UNPKG

@vimeo/iris

Version:
95 lines (92 loc) 8.33 kB
import { a as __makeTemplateObject, b as __rest, c as __assign } from '../../tslib.es6-7f0e734f.js'; import React__default from 'react'; import styled from 'styled-components'; import { Button } from '../Button/Button.esm.js'; import { Tip } from '../Tip/Tip.esm.js'; import { Focus } from '../../utils/css.esm.js'; import { core } from '../../tokens/core.esm.js'; import '../Button/Button.style.esm.js'; import 'polished'; import '../Button/Button.config.esm.js'; import '../Button/FeaturedIcon.esm.js'; import '../../themes/index.esm.js'; import '../../color/colors.esm.js'; import '../../tokens/color/index.esm.js'; import '../../tokens/color/background/background.esm.js'; import '../../tokens/util/readToken.esm.js'; import '../../tokens/util/clamp.esm.js'; import '../../tokens/color/format/format.esm.js'; import '../../tokens/color/format/primary.esm.js'; import '../../tokens/color/format/secondary.esm.js'; import '../../tokens/color/format/tertiary.esm.js'; import '../../tokens/color/rainbow/rainbow.esm.js'; import '../../tokens/color/rainbow/conic/index.esm.js'; import '../../tokens/color/rainbow/conic/sm.esm.js'; import '../../tokens/color/rainbow/conic/xl.esm.js'; import '../../tokens/color/rainbow/linear/index.esm.js'; import '../../tokens/color/rainbow/linear/sm.esm.js'; import '../../tokens/color/rainbow/linear/xl.esm.js'; import '../../tokens/color/livestream/livestream.esm.js'; import '../../tokens/color/status/status.esm.js'; import '../../tokens/color/status/caution.esm.js'; import '../../tokens/color/status/negative.esm.js'; import '../../tokens/color/status/positive.esm.js'; import '../../tokens/color/stroke/stroke.esm.js'; import '../../tokens/color/surface/surface.esm.js'; import '../../tokens/color/text/text.esm.js'; import '../../tokens/util/round.esm.js'; import '../../tokens/color/upsell/upsell.esm.js'; import '../../tokens/color/upsell/sm.esm.js'; import '../../tokens/color/upsell/xl.esm.js'; import '../../tokens/color/upsell/new.esm.js'; import '../../tokens/edge/edge.esm.js'; import '../../tokens/space/space.esm.js'; import '../../tokens/typography/index.esm.js'; import '../../tokens/typography/size/size.esm.js'; import '../LoaderCircular/LoaderCircular.esm.js'; import '../LoaderCircular/LoaderCircular.style.esm.js'; import '../../utils/HOCs/withIris.esm.js'; import '../../utils/hooks/useDeprecate.esm.js'; import '../../utils/general/mergeReactRefs.esm.js'; import '../Tip/Tip.settings.esm.js'; import '../Tip/Tip.style.esm.js'; import '../../utils/hooks/usePortal_DEPRECATED/usePortal_DEPRECATED.esm.js'; import 'react-dom'; import '../../utils/hooks/usePortal_DEPRECATED/usePortal_DEPRECATED.style.esm.js'; import '../../utils/hooks/usePortal_DEPRECATED/useMountAnimations.esm.js'; import '../../utils/hooks/useIsomorphicEffect.esm.js'; import '../../utils/DOM/getComputedStyles.esm.js'; import '../../utils/DOM/animate.esm.js'; import '../../utils/events/onEvent.esm.js'; import '../../utils/hooks/usePortal_DEPRECATED/coordinates.esm.js'; import '../../utils/hooks/usePortal_DEPRECATED/Anchor.esm.js'; import '../../utils/hooks/useOutsideClick.esm.js'; import '../../utils/DOM/SSR.esm.js'; import '../../utils/DOM/createPortalOutlet.esm.js'; import '../../utils/DOM/createElement.esm.js'; import '../../utils/hooks/useIrisError.esm.js'; import '../../utils/general/generateUID.esm.js'; import '../../typography/Paragraph/Paragraph.esm.js'; import '../../typography/Paragraph/Paragraph.style.esm.js'; import '../../typography/Text/Text.esm.js'; import '../../typography/Text/Text.style.esm.js'; import '../../typography/typography.esm.js'; import '../../typography/Text/EditableText.esm.js'; import '../../utils/hooks/useLayoutStyles.esm.js'; import '../../utils/DOM/geometry.esm.js'; function Item(_a) { var _b = _a.attach, attach = _b === void 0 ? 'right' : _b; _a.children; var icon = _a.icon, label = _a.label, _d = _a.labelAsTooltip, labelAsTooltip = _d === void 0 ? true : _d, onClick = _a.onClick, isActive = _a.isActive, activeStyles = _a.activeStyles, props = __rest(_a, ["attach", "children", "icon", "label", "labelAsTooltip", "onClick", "isActive", "activeStyles"]); return labelAsTooltip ? (React__default.createElement(Tip, { attach: attach, content: label }, React__default.createElement(ItemStyled, __assign({ "aria-label": label, format: "basic", icon: icon, onClick: onClick, size: "md", variant: "minimalTransparent", isActive: isActive, activeStyles: activeStyles }, props)))) : (React__default.createElement(ItemLabelledStyled, __assign({ format: "basic", icon: icon, onClick: onClick, size: "md", variant: "minimalTransparent", isActive: isActive, activeStyles: activeStyles }, props), label)); } var ItemStyled = styled(Button)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 3rem;\n text-align: left;\n padding: 0.25rem 0.25rem 0.25rem 0.75rem;\n justify-content: start;\n ", ";\n\n > svg {\n padding: 0 !important;\n width: 1.25rem;\n min-width: 1.25rem;\n max-width: 1.25rem;\n height: 1.25rem;\n min-height: 1.25rem;\n max-height: 1.25rem;\n }\n"], ["\n height: 3rem;\n text-align: left;\n padding: 0.25rem 0.25rem 0.25rem 0.75rem;\n justify-content: start;\n ", ";\n\n > svg {\n padding: 0 !important;\n width: 1.25rem;\n min-width: 1.25rem;\n max-width: 1.25rem;\n height: 1.25rem;\n min-height: 1.25rem;\n max-height: 1.25rem;\n }\n"])), function (_a) { var isActive = _a.isActive, activeStyles = _a.activeStyles; return isActive && activeStyles ? activeStyles : ''; }); var ItemLabelledStyled = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 4rem;\n width: 4rem;\n min-height: 4rem;\n min-width: 4rem;\n padding: 0.25rem;\n margin: 2px 0;\n align-items: center;\n flex-direction: column;\n overflow: hidden;\n // The negative margin here is to adjust the look of the\n // sidebar gutter, in order to avoid making an adjustment to the existing\n // sidebar padding which would break the no-labels version of the sidebar\n margin: 0.125rem -0.25rem;\n\n ", "\n\n > svg {\n // !important: Overrides padding placed on svg in Stylebar.style.ts\n padding: 0 !important;\n width: 1.25rem;\n height: 1.25rem;\n min-width: 1.25rem;\n max-width: 1.25rem;\n min-height: 1.25rem;\n max-height: 1.25rem;\n margin: 0 0 0.45rem 0;\n }\n\n // Button label\n > span {\n font-weight: 400;\n text-overflow: initial;\n font-size: 0.6875rem;\n line-height: initial;\n white-space: initial;\n }\n\n > ", " {\n // Accounts for the negative side margin, causing the focus ring to not be visible\n border-width: 0.4rem;\n }\n"], ["\n height: 4rem;\n width: 4rem;\n min-height: 4rem;\n min-width: 4rem;\n padding: 0.25rem;\n margin: 2px 0;\n align-items: center;\n flex-direction: column;\n overflow: hidden;\n // The negative margin here is to adjust the look of the\n // sidebar gutter, in order to avoid making an adjustment to the existing\n // sidebar padding which would break the no-labels version of the sidebar\n margin: 0.125rem -0.25rem;\n\n ", "\n\n > svg {\n // !important: Overrides padding placed on svg in Stylebar.style.ts\n padding: 0 !important;\n width: 1.25rem;\n height: 1.25rem;\n min-width: 1.25rem;\n max-width: 1.25rem;\n min-height: 1.25rem;\n max-height: 1.25rem;\n margin: 0 0 0.45rem 0;\n }\n\n // Button label\n > span {\n font-weight: 400;\n text-overflow: initial;\n font-size: 0.6875rem;\n line-height: initial;\n white-space: initial;\n }\n\n > ", " {\n // Accounts for the negative side margin, causing the focus ring to not be visible\n border-width: 0.4rem;\n }\n"])), function (_a) { var isActive = _a.isActive, activeStyles = _a.activeStyles; return isActive && activeStyles ? activeStyles : ''; }, Focus); var Break = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 100%;\n border-top: 1px solid ", ";\n margin: 0.35rem auto;\n transition: 120ms ease-in-out;\n"], ["\n width: 100%;\n border-top: 1px solid ", ";\n margin: 0.35rem auto;\n transition: 120ms ease-in-out;\n"])), core.color.stroke); var templateObject_1, templateObject_2, templateObject_3; export { Break, Item };