@activecollab/components 2.0.570 → 2.0.572
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/cjs/components/Autocomplete/Styles.js +1 -1
- package/dist/cjs/components/Autocomplete/Styles.js.map +1 -1
- package/dist/cjs/components/Dialog/Styles.js +1 -1
- package/dist/cjs/components/Dialog/Styles.js.map +1 -1
- package/dist/cjs/components/GlobalStyle.js +1 -1
- package/dist/cjs/components/GlobalStyle.js.map +1 -1
- package/dist/cjs/components/Icons/collection/ArrowUpCircle.js +61 -0
- package/dist/cjs/components/Icons/collection/ArrowUpCircle.js.map +1 -0
- package/dist/cjs/components/Icons/collection/Storage.js +61 -0
- package/dist/cjs/components/Icons/collection/Storage.js.map +1 -0
- package/dist/cjs/components/Icons/collection/index.js +14 -0
- package/dist/cjs/components/Icons/collection/index.js.map +1 -1
- package/dist/cjs/components/IdentityMark/Styles.js +7 -0
- package/dist/cjs/components/IdentityMark/Styles.js.map +1 -1
- package/dist/cjs/components/MainMenu/MainMenu.js +25 -13
- package/dist/cjs/components/MainMenu/MainMenu.js.map +1 -1
- package/dist/cjs/components/MainMenu/Styles.js +1 -1
- package/dist/cjs/components/MainMenu/Styles.js.map +1 -1
- package/dist/cjs/components/MainMenu/hooks.js +33 -2
- package/dist/cjs/components/MainMenu/hooks.js.map +1 -1
- package/dist/cjs/components/MainMenu/types.js +2 -1
- package/dist/cjs/components/MainMenu/types.js.map +1 -1
- package/dist/cjs/components/ObjectFormModal/Styles.js +2 -2
- package/dist/cjs/components/ObjectFormModal/Styles.js.map +1 -1
- package/dist/cjs/components/PillButton/PillButton.js +5 -2
- package/dist/cjs/components/PillButton/PillButton.js.map +1 -1
- package/dist/cjs/components/PillButton/Styles.js +3 -1
- package/dist/cjs/components/PillButton/Styles.js.map +1 -1
- package/dist/cjs/components/PillGroup/PillGroup.js.map +1 -1
- package/dist/cjs/components/PillGroup/Styles.js +4 -1
- package/dist/cjs/components/PillGroup/Styles.js.map +1 -1
- package/dist/cjs/components/PresenceCapsule/PresenceCapsule.js +11 -8
- package/dist/cjs/components/PresenceCapsule/PresenceCapsule.js.map +1 -1
- package/dist/cjs/components/PresenceCapsule/Styles.js +7 -8
- package/dist/cjs/components/PresenceCapsule/Styles.js.map +1 -1
- package/dist/cjs/components/PropertyList/Styles.js +1 -1
- package/dist/cjs/components/PropertyList/Styles.js.map +1 -1
- package/dist/cjs/components/Sheet/Sheet.js +5 -2
- package/dist/cjs/components/Sheet/Sheet.js.map +1 -1
- package/dist/cjs/components/Sheet/Styles.js +19 -14
- package/dist/cjs/components/Sheet/Styles.js.map +1 -1
- package/dist/cjs/components/SwatchPalette/swatchPalette.js +1 -1
- package/dist/cjs/components/SwatchPalette/swatchPalette.js.map +1 -1
- package/dist/cjs/components/SwatchPalette/swatchPalette.test.js +1 -1
- package/dist/cjs/components/SwatchPalette/swatchPalette.test.js.map +1 -1
- package/dist/cjs/components/ToastMessage/Styles.js +6 -6
- package/dist/cjs/components/ToastMessage/Styles.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +5 -0
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/Styles.js +71 -16
- package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +112 -92
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js +12 -4
- package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js.map +1 -1
- package/dist/cjs/presentation/shared/ActivityFeed.js +1 -1
- package/dist/cjs/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/esm/components/Autocomplete/Styles.js +1 -1
- package/dist/esm/components/Autocomplete/Styles.js.map +1 -1
- package/dist/esm/components/Dialog/Styles.js +1 -1
- package/dist/esm/components/Dialog/Styles.js.map +1 -1
- package/dist/esm/components/GlobalStyle.d.ts.map +1 -1
- package/dist/esm/components/GlobalStyle.js +1 -1
- package/dist/esm/components/GlobalStyle.js.map +1 -1
- package/dist/esm/components/Icons/collection/ArrowUpCircle.d.ts +32 -0
- package/dist/esm/components/Icons/collection/ArrowUpCircle.d.ts.map +1 -0
- package/dist/esm/components/Icons/collection/ArrowUpCircle.js +54 -0
- package/dist/esm/components/Icons/collection/ArrowUpCircle.js.map +1 -0
- package/dist/esm/components/Icons/collection/Storage.d.ts +32 -0
- package/dist/esm/components/Icons/collection/Storage.d.ts.map +1 -0
- package/dist/esm/components/Icons/collection/Storage.js +54 -0
- package/dist/esm/components/Icons/collection/Storage.js.map +1 -0
- package/dist/esm/components/Icons/collection/index.d.ts +2 -0
- package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/index.js +2 -0
- package/dist/esm/components/Icons/collection/index.js.map +1 -1
- package/dist/esm/components/IdentityMark/Styles.d.ts +1 -1
- package/dist/esm/components/IdentityMark/Styles.d.ts.map +1 -1
- package/dist/esm/components/IdentityMark/Styles.js +7 -0
- package/dist/esm/components/IdentityMark/Styles.js.map +1 -1
- package/dist/esm/components/MainMenu/MainMenu.d.ts.map +1 -1
- package/dist/esm/components/MainMenu/MainMenu.js +25 -12
- package/dist/esm/components/MainMenu/MainMenu.js.map +1 -1
- package/dist/esm/components/MainMenu/Styles.d.ts.map +1 -1
- package/dist/esm/components/MainMenu/Styles.js +1 -1
- package/dist/esm/components/MainMenu/Styles.js.map +1 -1
- package/dist/esm/components/MainMenu/hooks.d.ts +1 -0
- package/dist/esm/components/MainMenu/hooks.d.ts.map +1 -1
- package/dist/esm/components/MainMenu/hooks.js +28 -1
- package/dist/esm/components/MainMenu/hooks.js.map +1 -1
- package/dist/esm/components/MainMenu/types.d.ts +1 -0
- package/dist/esm/components/MainMenu/types.d.ts.map +1 -1
- package/dist/esm/components/MainMenu/types.js +2 -1
- package/dist/esm/components/MainMenu/types.js.map +1 -1
- package/dist/esm/components/ObjectFormModal/Styles.js +2 -2
- package/dist/esm/components/ObjectFormModal/Styles.js.map +1 -1
- package/dist/esm/components/PillButton/PillButton.d.ts +3 -1
- package/dist/esm/components/PillButton/PillButton.d.ts.map +1 -1
- package/dist/esm/components/PillButton/PillButton.js +5 -2
- package/dist/esm/components/PillButton/PillButton.js.map +1 -1
- package/dist/esm/components/PillButton/Styles.d.ts.map +1 -1
- package/dist/esm/components/PillButton/Styles.js +3 -1
- package/dist/esm/components/PillButton/Styles.js.map +1 -1
- package/dist/esm/components/PillGroup/PillGroup.d.ts +2 -2
- package/dist/esm/components/PillGroup/PillGroup.d.ts.map +1 -1
- package/dist/esm/components/PillGroup/PillGroup.js.map +1 -1
- package/dist/esm/components/PillGroup/Styles.d.ts.map +1 -1
- package/dist/esm/components/PillGroup/Styles.js +2 -1
- package/dist/esm/components/PillGroup/Styles.js.map +1 -1
- package/dist/esm/components/PresenceCapsule/PresenceCapsule.d.ts +2 -2
- package/dist/esm/components/PresenceCapsule/PresenceCapsule.d.ts.map +1 -1
- package/dist/esm/components/PresenceCapsule/PresenceCapsule.js +11 -8
- package/dist/esm/components/PresenceCapsule/PresenceCapsule.js.map +1 -1
- package/dist/esm/components/PresenceCapsule/Styles.d.ts +1 -3
- package/dist/esm/components/PresenceCapsule/Styles.d.ts.map +1 -1
- package/dist/esm/components/PresenceCapsule/Styles.js +6 -5
- package/dist/esm/components/PresenceCapsule/Styles.js.map +1 -1
- package/dist/esm/components/PropertyList/Styles.js +1 -1
- package/dist/esm/components/PropertyList/Styles.js.map +1 -1
- package/dist/esm/components/Sheet/Sheet.d.ts +2 -0
- package/dist/esm/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Sheet.js +6 -3
- package/dist/esm/components/Sheet/Sheet.js.map +1 -1
- package/dist/esm/components/Sheet/Styles.d.ts +1 -0
- package/dist/esm/components/Sheet/Styles.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Styles.js +17 -12
- package/dist/esm/components/Sheet/Styles.js.map +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.d.ts +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.d.ts.map +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.js +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.js.map +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.test.js +1 -1
- package/dist/esm/components/SwatchPalette/swatchPalette.test.js.map +1 -1
- package/dist/esm/components/ToastMessage/Styles.d.ts.map +1 -1
- package/dist/esm/components/ToastMessage/Styles.js +3 -3
- package/dist/esm/components/ToastMessage/Styles.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +5 -0
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/Styles.d.ts +12 -3
- package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/Styles.js +70 -15
- package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +7 -2
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +106 -89
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts +4 -0
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js +13 -5
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js.map +1 -1
- package/dist/esm/presentation/shared/ActivityFeed.js +1 -1
- package/dist/esm/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/index.js +954 -693
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -85,6 +85,11 @@ export const Tooltip = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
85
85
|
if (event.type === "mouseover" && childrenProps.onMouseOver) {
|
|
86
86
|
childrenProps.onMouseOver(event);
|
|
87
87
|
}
|
|
88
|
+
|
|
89
|
+
// React bubbles a hover from a portal, such as an open menu, up to its trigger.
|
|
90
|
+
if (!event.currentTarget.contains(event.target)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
88
93
|
(_childNode$current2 = childNode.current) == null || _childNode$current2.removeAttribute("title");
|
|
89
94
|
setArmed(true);
|
|
90
95
|
setOpen(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["React","useCallback","useEffect","useRef","useState","forwardRef","classnames","StyledTooltip","Portal","useLayerContext","layers","useForkRef","Popper","FromElement","FROM_ELEMENT_FADE_OUT","TooltipAnimation","_ref","children","props","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","timeout","enter","exit","Tooltip","_ref2","ref","title","className","style","_ref2$isLight","isLight","_ref2$placement","placement","_ref2$TransitionCompo","TransitionComponent","popperTooltipStyle","popperTooltipClassName","disable","popperModifiers","_useLayerContext","_useLayerContext$zInd","zIndex","skyscraper","_useState","open","setOpen","_useState2","armed","setArmed","childNode","lastChildNode","setChildNode","node","current","Promise","resolve","then","undefined","closeOutsideTrigger","event","_childNode$current","contains","target","document","addEventListener","removeEventListener","handleEnter","_childNode$current2","childrenProps","type","onMouseOver","removeAttribute","handleLeave","onMouseLeave","currentTarget","handleOwnRef","handleRef","Fragment","cloneElement","anchorEl","transition","modifiers","role","_ref3","_ref3$transitionProps","transitionProps","$isLight","displayName"],"sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, {\n ReactElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n CSSProperties,\n MouseEvent,\n forwardRef,\n Ref,\n FC,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledTooltip } from \"./Styles\";\nimport { Portal, useLayerContext } from \"../../helpers\";\nimport { layers } from \"../../utils\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { Popper, Placement, PopperModifier } from \"../Popper\";\nimport { TransitionProps } from \"../Transitions\";\nimport { FromElement, FROM_ELEMENT_FADE_OUT } from \"../Transitions/FromElement\";\n\ninterface ElementWithRef<T> extends ReactElement {\n ref?: Ref<T>;\n}\n\nexport interface ITooltipProps {\n /** Children element. */\n children: ElementWithRef<HTMLElement>;\n /** Title element. */\n title: ReactElement | string;\n /** Applies passed styles */\n style?: CSSProperties;\n /** Applies passed classes */\n className?: string;\n /** Open */\n open?: boolean;\n /** Placement */\n placement?: Placement;\n /** Transition component */\n TransitionComponent?: React.FC<TransitionProps>;\n /** Light tooltip */\n isLight?: boolean;\n /** Popper Tooltip style */\n popperTooltipStyle?: CSSProperties;\n /** Popper Tooltip class name*/\n popperTooltipClassName?: string;\n /** Remove tooltip */\n disable?: boolean;\n /** Extra Popper.js modifiers for the tooltip popper */\n popperModifiers?: PopperModifier[];\n}\n\ninterface ITooltipAnimation extends TransitionProps {\n children: ReactElement;\n}\n\nconst TooltipAnimation: FC<ITooltipAnimation> = ({ children, ...props }) => {\n return (\n <FromElement timeout={{ enter: 0, exit: FROM_ELEMENT_FADE_OUT }} {...props}>\n {children}\n </FromElement>\n );\n};\n\nexport const Tooltip = forwardRef<HTMLElement, ITooltipProps>(\n (\n {\n children,\n title,\n className,\n style,\n isLight = false,\n placement = \"top\",\n TransitionComponent = TooltipAnimation,\n popperTooltipStyle,\n popperTooltipClassName,\n disable,\n popperModifiers,\n },\n ref\n ) => {\n const { zIndex = layers.skyscraper } = useLayerContext();\n const [open, setOpen] = useState(false);\n // The popper mounts on the first hover. A list with a tooltip in every row mounts none of them before.\n const [armed, setArmed] = useState(false);\n // A ref, not state: state would render every tooltip again right after it mounts.\n const childNode = useRef<HTMLElement | null>(null);\n const lastChildNode = useRef<HTMLElement | null>(null);\n // A trigger that leaves the page sends no mouseleave, so its tooltip closes here. A router link hands a new ref\n // callback on every render, so a null that the same node follows in the same commit is no leave.\n const setChildNode = useCallback((node: HTMLElement | null) => {\n childNode.current = node;\n\n if (node) {\n if (lastChildNode.current && node !== lastChildNode.current) {\n setOpen(false);\n }\n\n lastChildNode.current = node;\n\n return;\n }\n\n Promise.resolve().then(() => {\n if (!childNode.current) {\n setOpen(false);\n }\n });\n }, []);\n\n // A mouseleave can also get lost under a still pointer, so any pointer move outside the trigger closes it.\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n\n const closeOutsideTrigger = (event: globalThis.MouseEvent): void => {\n if (!childNode.current?.contains(event.target as Node)) {\n setOpen(false);\n }\n };\n\n document.addEventListener(\"mouseover\", closeOutsideTrigger, true);\n\n return () =>\n document.removeEventListener(\"mouseover\", closeOutsideTrigger, true);\n }, [open]);\n\n const handleEnter = (event: MouseEvent<HTMLElement>): void => {\n const childrenProps = children.props;\n\n if (event.type === \"mouseover\" && childrenProps.onMouseOver) {\n childrenProps.onMouseOver(event);\n }\n\n childNode.current?.removeAttribute(\"title\");\n\n setArmed(true);\n setOpen(true);\n };\n\n const handleLeave = (event: MouseEvent<HTMLElement>): void => {\n const childrenProps = children.props;\n\n if (\n event.type === \"mouseleave\" &&\n childrenProps.onMouseLeave &&\n event.currentTarget === childNode.current\n ) {\n childrenProps.onMouseLeave(event);\n }\n\n setOpen(false);\n };\n\n const handleOwnRef = useForkRef(children.ref, ref);\n const handleRef = useForkRef(setChildNode, handleOwnRef);\n\n const childrenProps = {\n onMouseOver: handleEnter,\n onMouseLeave: handleLeave,\n ref: handleRef,\n };\n\n return (\n <>\n {React.cloneElement(children, childrenProps)}\n {!disable && armed && (\n <Portal>\n <Popper\n anchorEl={childNode.current}\n open={childNode.current ? open : false}\n placement={placement}\n transition\n modifiers={popperModifiers}\n className={popperTooltipClassName}\n style={{ zIndex, ...popperTooltipStyle }}\n role=\"tooltip\"\n >\n {({ transitionProps = {} }) => (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - due to @node/types making ts more strict\n <TransitionComponent {...transitionProps} style={style}>\n <StyledTooltip\n className={classnames(\"c-tooltip-ds\", className)}\n $isLight={isLight}\n >\n {title}\n </StyledTooltip>\n </TransitionComponent>\n )}\n </Popper>\n </Portal>\n )}\n </>\n );\n }\n);\n\nTooltip.displayName = \"Tooltip\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,EAGRC,UAAU,QAGL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,aAAa,QAAQ,UAAU;AACxC,SAASC,MAAM,EAAEC,eAAe,QAAQ,eAAe;AACvD,SAASC,MAAM,QAAQ,aAAa;AACpC,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,MAAM,QAAmC,WAAW;AAE7D,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,4BAA4B;AAqC/E,MAAMC,gBAAuC,GAAGC,IAAA,IAA4B;EAAA,IAAzBC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAKC,KAAK,GAAAC,6BAAA,CAAAH,IAAA,EAAAI,SAAA;EACnE,oBACEpB,KAAA,CAAAqB,aAAA,CAACR,WAAW,EAAAS,QAAA;IAACC,OAAO,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,IAAI,EAAEX;IAAsB;EAAE,GAAKI,KAAK,GACvED,QACU,CAAC;AAElB,CAAC;AAED,OAAO,MAAMS,OAAO,gBAAGrB,UAAU,CAC/B,CAAAsB,KAAA,EAcEC,GAAG,KACA;EAAA,IAbDX,QAAQ,GAAAU,KAAA,CAARV,QAAQ;IACRY,KAAK,GAAAF,KAAA,CAALE,KAAK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;MACAvF,KAAA,CAAAqB,aAAA,CAACgB,mBAAmB,EAAAf,QAAA,KAAKkE,eAAe;QAAEzD,KAAK,EAAEA;MAAM,iBACrD/B,KAAA,CAAAqB,aAAA,CAACd,aAAa;QACZuB,SAAS,EAAExB,UAAU,CAAC,cAAc,EAAEwB,SAAS,CAAE;QACjD2D,QAAQ,EAAExD;MAAQ,GAEjBJ,KACY,CACI;IAAC;EAAA,CAElB,CACF,CAEV,CAAC;AAEP,CACF,CAAC;AAEDH,OAAO,CAACgE,WAAW,GAAG,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["React","useCallback","useEffect","useRef","useState","forwardRef","classnames","StyledTooltip","Portal","useLayerContext","layers","useForkRef","Popper","FromElement","FROM_ELEMENT_FADE_OUT","TooltipAnimation","_ref","children","props","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","timeout","enter","exit","Tooltip","_ref2","ref","title","className","style","_ref2$isLight","isLight","_ref2$placement","placement","_ref2$TransitionCompo","TransitionComponent","popperTooltipStyle","popperTooltipClassName","disable","popperModifiers","_useLayerContext","_useLayerContext$zInd","zIndex","skyscraper","_useState","open","setOpen","_useState2","armed","setArmed","childNode","lastChildNode","setChildNode","node","current","Promise","resolve","then","undefined","closeOutsideTrigger","event","_childNode$current","contains","target","document","addEventListener","removeEventListener","handleEnter","_childNode$current2","childrenProps","type","onMouseOver","currentTarget","removeAttribute","handleLeave","onMouseLeave","handleOwnRef","handleRef","Fragment","cloneElement","anchorEl","transition","modifiers","role","_ref3","_ref3$transitionProps","transitionProps","$isLight","displayName"],"sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, {\n ReactElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n CSSProperties,\n MouseEvent,\n forwardRef,\n Ref,\n FC,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledTooltip } from \"./Styles\";\nimport { Portal, useLayerContext } from \"../../helpers\";\nimport { layers } from \"../../utils\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { Popper, Placement, PopperModifier } from \"../Popper\";\nimport { TransitionProps } from \"../Transitions\";\nimport { FromElement, FROM_ELEMENT_FADE_OUT } from \"../Transitions/FromElement\";\n\ninterface ElementWithRef<T> extends ReactElement {\n ref?: Ref<T>;\n}\n\nexport interface ITooltipProps {\n /** Children element. */\n children: ElementWithRef<HTMLElement>;\n /** Title element. */\n title: ReactElement | string;\n /** Applies passed styles */\n style?: CSSProperties;\n /** Applies passed classes */\n className?: string;\n /** Open */\n open?: boolean;\n /** Placement */\n placement?: Placement;\n /** Transition component */\n TransitionComponent?: React.FC<TransitionProps>;\n /** Light tooltip */\n isLight?: boolean;\n /** Popper Tooltip style */\n popperTooltipStyle?: CSSProperties;\n /** Popper Tooltip class name*/\n popperTooltipClassName?: string;\n /** Remove tooltip */\n disable?: boolean;\n /** Extra Popper.js modifiers for the tooltip popper */\n popperModifiers?: PopperModifier[];\n}\n\ninterface ITooltipAnimation extends TransitionProps {\n children: ReactElement;\n}\n\nconst TooltipAnimation: FC<ITooltipAnimation> = ({ children, ...props }) => {\n return (\n <FromElement timeout={{ enter: 0, exit: FROM_ELEMENT_FADE_OUT }} {...props}>\n {children}\n </FromElement>\n );\n};\n\nexport const Tooltip = forwardRef<HTMLElement, ITooltipProps>(\n (\n {\n children,\n title,\n className,\n style,\n isLight = false,\n placement = \"top\",\n TransitionComponent = TooltipAnimation,\n popperTooltipStyle,\n popperTooltipClassName,\n disable,\n popperModifiers,\n },\n ref\n ) => {\n const { zIndex = layers.skyscraper } = useLayerContext();\n const [open, setOpen] = useState(false);\n // The popper mounts on the first hover. A list with a tooltip in every row mounts none of them before.\n const [armed, setArmed] = useState(false);\n // A ref, not state: state would render every tooltip again right after it mounts.\n const childNode = useRef<HTMLElement | null>(null);\n const lastChildNode = useRef<HTMLElement | null>(null);\n // A trigger that leaves the page sends no mouseleave, so its tooltip closes here. A router link hands a new ref\n // callback on every render, so a null that the same node follows in the same commit is no leave.\n const setChildNode = useCallback((node: HTMLElement | null) => {\n childNode.current = node;\n\n if (node) {\n if (lastChildNode.current && node !== lastChildNode.current) {\n setOpen(false);\n }\n\n lastChildNode.current = node;\n\n return;\n }\n\n Promise.resolve().then(() => {\n if (!childNode.current) {\n setOpen(false);\n }\n });\n }, []);\n\n // A mouseleave can also get lost under a still pointer, so any pointer move outside the trigger closes it.\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n\n const closeOutsideTrigger = (event: globalThis.MouseEvent): void => {\n if (!childNode.current?.contains(event.target as Node)) {\n setOpen(false);\n }\n };\n\n document.addEventListener(\"mouseover\", closeOutsideTrigger, true);\n\n return () =>\n document.removeEventListener(\"mouseover\", closeOutsideTrigger, true);\n }, [open]);\n\n const handleEnter = (event: MouseEvent<HTMLElement>): void => {\n const childrenProps = children.props;\n\n if (event.type === \"mouseover\" && childrenProps.onMouseOver) {\n childrenProps.onMouseOver(event);\n }\n\n // React bubbles a hover from a portal, such as an open menu, up to its trigger.\n if (!event.currentTarget.contains(event.target as Node)) {\n return;\n }\n\n childNode.current?.removeAttribute(\"title\");\n\n setArmed(true);\n setOpen(true);\n };\n\n const handleLeave = (event: MouseEvent<HTMLElement>): void => {\n const childrenProps = children.props;\n\n if (\n event.type === \"mouseleave\" &&\n childrenProps.onMouseLeave &&\n event.currentTarget === childNode.current\n ) {\n childrenProps.onMouseLeave(event);\n }\n\n setOpen(false);\n };\n\n const handleOwnRef = useForkRef(children.ref, ref);\n const handleRef = useForkRef(setChildNode, handleOwnRef);\n\n const childrenProps = {\n onMouseOver: handleEnter,\n onMouseLeave: handleLeave,\n ref: handleRef,\n };\n\n return (\n <>\n {React.cloneElement(children, childrenProps)}\n {!disable && armed && (\n <Portal>\n <Popper\n anchorEl={childNode.current}\n open={childNode.current ? open : false}\n placement={placement}\n transition\n modifiers={popperModifiers}\n className={popperTooltipClassName}\n style={{ zIndex, ...popperTooltipStyle }}\n role=\"tooltip\"\n >\n {({ transitionProps = {} }) => (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - due to @node/types making ts more strict\n <TransitionComponent {...transitionProps} style={style}>\n <StyledTooltip\n className={classnames(\"c-tooltip-ds\", className)}\n $isLight={isLight}\n >\n {title}\n </StyledTooltip>\n </TransitionComponent>\n )}\n </Popper>\n </Portal>\n )}\n </>\n );\n }\n);\n\nTooltip.displayName = \"Tooltip\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,EAGRC,UAAU,QAGL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,aAAa,QAAQ,UAAU;AACxC,SAASC,MAAM,EAAEC,eAAe,QAAQ,eAAe;AACvD,SAASC,MAAM,QAAQ,aAAa;AACpC,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,MAAM,QAAmC,WAAW;AAE7D,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,4BAA4B;AAqC/E,MAAMC,gBAAuC,GAAGC,IAAA,IAA4B;EAAA,IAAzBC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAKC,KAAK,GAAAC,6BAAA,CAAAH,IAAA,EAAAI,SAAA;EACnE,oBACEpB,KAAA,CAAAqB,aAAA,CAACR,WAAW,EAAAS,QAAA;IAACC,OAAO,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,IAAI,EAAEX;IAAsB;EAAE,GAAKI,KAAK,GACvED,QACU,CAAC;AAElB,CAAC;AAED,OAAO,MAAMS,OAAO,gBAAGrB,UAAU,CAC/B,CAAAsB,KAAA,EAcEC,GAAG,KACA;EAAA,IAbDX,QAAQ,GAAAU,KAAA,CAARV,QAAQ;IACRY,KAAK,GAAAF,KAAA,CAALE,KAAK;IACLC,SAAS,GAAAH,KAAA,CAATG,SAAS;IACTC,KAAK,GAAAJ,KAAA,CAALI,KAAK;IAAAC,aAAA,GAAAL,KAAA,CACLM,OAAO;IAAPA,OAAO,GAAAD,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,mBAAmB,EAAAf,QAAA,KAAKkE,eAAe;QAAEzD,KAAK,EAAEA;MAAM,iBACrD/B,KAAA,CAAAqB,aAAA,CAACd,aAAa;QACZuB,SAAS,EAAExB,UAAU,CAAC,cAAc,EAAEwB,SAAS,CAAE;QACjD2D,QAAQ,EAAExD;MAAQ,GAEjBJ,KACY,CACI;IAAC;EAAA,CAElB,CACF,CAEV,CAAC;AAEP,CACF,CAAC;AAEDH,OAAO,CAACgE,WAAW,GAAG,SAAS","ignoreList":[]}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
export declare const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;
|
|
1
2
|
export declare const VIEW_SWITCHER_PROMPT_MS = 5000;
|
|
2
|
-
export declare const VIEW_SWITCHER_RESIZE_MS = 200;
|
|
3
3
|
export declare const VIEW_SWITCHER_APPLIED_MS = 900;
|
|
4
|
-
export declare const VIEW_SWITCHER_LEAVE_MS =
|
|
4
|
+
export declare const VIEW_SWITCHER_LEAVE_MS = 200;
|
|
5
5
|
export declare const StyledViewSwitcher: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const StyledViewSwitcherTrack: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const StyledViewSwitcherOptions: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
8
|
export declare const StyledViewSwitcherOption: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
8
9
|
export declare const StyledViewSwitcherMenuOption: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
10
|
+
export declare const StyledViewSwitcherMenuRoot: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const StyledViewSwitcherMenuClip: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
12
|
export declare const StyledViewSwitcherMenuIcon: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
10
13
|
export declare const StyledViewSwitcherMenuList: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").ListProps & {
|
|
11
14
|
children?: import("react").ReactNode | undefined;
|
|
@@ -20,5 +23,11 @@ export declare const StyledViewSwitcherMenuList: import("styled-components").Sty
|
|
|
20
23
|
}, any, {}, never>;
|
|
21
24
|
export declare const StyledViewSwitcherMenuLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
22
25
|
export declare const StyledViewSwitcherPromptTitle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
23
|
-
export declare const StyledViewSwitcherPrompt: import("styled-components").StyledComponent<
|
|
26
|
+
export declare const StyledViewSwitcherPrompt: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
27
|
+
export declare const StyledViewSwitcherPromptClip: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
28
|
+
export declare const StyledViewSwitcherPromptPill: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
29
|
+
export declare const StyledViewSwitcherAction: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
30
|
+
export declare const StyledViewSwitcherLine: import("styled-components").StyledComponent<"i", any, {}, never>;
|
|
31
|
+
export declare const StyledViewSwitcherDismiss: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
32
|
+
export declare const StyledViewSwitcherApplied: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
24
33
|
//# sourceMappingURL=Styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B,MAAM,CAAC;AACjD,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,kBAAkB,oEAI9B,CAAC;AAIF,eAAO,MAAM,uBAAuB,oEASnC,CAAC;AAIF,eAAO,MAAM,yBAAyB,oEAGrC,CAAC;AAIF,eAAO,MAAM,wBAAwB,uEA4CpC,CAAC;AAIF,eAAO,MAAM,4BAA4B,uEAwDxC,CAAC;AA6BF,eAAO,MAAM,0BAA0B,oEA8BtC,CAAC;AAIF,eAAO,MAAM,0BAA0B,oEAOtC,CAAC;AAIF,eAAO,MAAM,0BAA0B,qEAKtC,CAAC;AAIF,eAAO,MAAM,0BAA0B;;;;;;;;;;kBAEtC,CAAC;AAIF,eAAO,MAAM,2BAA2B,qEAOvC,CAAC;AAiCF,eAAO,MAAM,6BAA6B,qEAOzC,CAAC;AAQF,eAAO,MAAM,wBAAwB,oEAuDpC,CAAC;AAIF,eAAO,MAAM,4BAA4B,oEAIxC,CAAC;AAIF,eAAO,MAAM,4BAA4B,oEAexC,CAAC;AAIF,eAAO,MAAM,wBAAwB,uEA8BpC,CAAC;AAIF,eAAO,MAAM,sBAAsB,kEAMlC,CAAC;AAIF,eAAO,MAAM,yBAAyB,uEAmCrC,CAAC;AAIF,eAAO,MAAM,yBAAyB,qEAuBrC,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import styled, { keyframes } from "styled-components";
|
|
2
2
|
import { BoxSizingStyle } from "../BoxSizingStyle";
|
|
3
3
|
import { List } from "../List";
|
|
4
|
-
|
|
4
|
+
export const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;
|
|
5
5
|
export const VIEW_SWITCHER_PROMPT_MS = 5000;
|
|
6
|
-
export const VIEW_SWITCHER_RESIZE_MS = 200;
|
|
7
6
|
export const VIEW_SWITCHER_APPLIED_MS = 900;
|
|
8
|
-
export const VIEW_SWITCHER_LEAVE_MS =
|
|
7
|
+
export const VIEW_SWITCHER_LEAVE_MS = 200;
|
|
9
8
|
export const StyledViewSwitcher = styled.div.withConfig({
|
|
10
9
|
displayName: "Styles__StyledViewSwitcher",
|
|
11
10
|
componentId: "sc-1cg2mte-0"
|
|
@@ -14,45 +13,101 @@ StyledViewSwitcher.displayName = "StyledViewSwitcher";
|
|
|
14
13
|
export const StyledViewSwitcherTrack = styled.div.withConfig({
|
|
15
14
|
displayName: "Styles__StyledViewSwitcherTrack",
|
|
16
15
|
componentId: "sc-1cg2mte-1"
|
|
17
|
-
})(["", " display:inline-flex;align-items:center;
|
|
16
|
+
})(["", " position:relative;display:inline-flex;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);"], BoxSizingStyle);
|
|
18
17
|
StyledViewSwitcherTrack.displayName = "StyledViewSwitcherTrack";
|
|
18
|
+
export const StyledViewSwitcherOptions = styled.div.withConfig({
|
|
19
|
+
displayName: "Styles__StyledViewSwitcherOptions",
|
|
20
|
+
componentId: "sc-1cg2mte-2"
|
|
21
|
+
})(["display:inline-flex;align-items:center;"]);
|
|
22
|
+
StyledViewSwitcherOptions.displayName = "StyledViewSwitcherOptions";
|
|
19
23
|
export const StyledViewSwitcherOption = styled.button.withConfig({
|
|
20
24
|
displayName: "Styles__StyledViewSwitcherOption",
|
|
21
|
-
componentId: "sc-1cg2mte-
|
|
25
|
+
componentId: "sc-1cg2mte-3"
|
|
22
26
|
})(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:34px;height:26px;margin:0;padding:0;border:0;border-radius:var(--ac-br-rounded);background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease,box-shadow 150ms ease;svg{width:20px;height:20px;fill:var(--color-theme-700);}&:hover{background-color:color-mix( in srgb,var(--color-theme-900) 16%,transparent );}&[aria-checked=\"true\"]{background-color:var(--page-paper-main);box-shadow:var(--shadow-float);cursor:default;svg{fill:var(--color-theme-900);}}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
23
27
|
StyledViewSwitcherOption.displayName = "StyledViewSwitcherOption";
|
|
24
28
|
export const StyledViewSwitcherMenuOption = styled.button.withConfig({
|
|
25
29
|
displayName: "Styles__StyledViewSwitcherMenuOption",
|
|
26
|
-
componentId: "sc-1cg2mte-
|
|
30
|
+
componentId: "sc-1cg2mte-4"
|
|
27
31
|
})(["", " display:inline-flex;align-items:center;gap:4px;height:26px;margin:0;padding:0 8px 0 12px;border:0;border-radius:var(--ac-br-rounded);background-color:var(--page-paper-main);box-shadow:var(--shadow-float);color:var(--color-theme-900);font-size:calc(13px * var(--text-scale,1));white-space:nowrap;cursor:pointer;outline:none;svg{flex-shrink:0;fill:var(--color-theme-900);}&:has(.c-view-switcher-menu__icon){padding-left:8px;}.c-view-switcher-menu__values{display:inline-grid;}.c-view-switcher-menu__value{display:inline-flex;grid-area:1 / 1;align-items:center;gap:4px;visibility:hidden;}.c-view-switcher-menu__value[data-selected=\"true\"]{visibility:visible;}.c-view-switcher-menu__icon{display:inline-flex;flex-shrink:0;}.c-view-switcher-menu__icon svg{width:20px;height:20px;}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
28
32
|
StyledViewSwitcherMenuOption.displayName = "StyledViewSwitcherMenuOption";
|
|
33
|
+
const VIEW_SWITCHER_MENU_REVEAL_MS = 200;
|
|
34
|
+
const VIEW_SWITCHER_MENU_GAP = 8;
|
|
35
|
+
const menuReveal = keyframes(["from{grid-template-columns:0fr;margin-right:-", "px;}"], VIEW_SWITCHER_MENU_GAP);
|
|
36
|
+
const menuConceal = keyframes(["to{grid-template-columns:0fr;margin-right:-", "px;}"], VIEW_SWITCHER_MENU_GAP);
|
|
37
|
+
const menuClip = keyframes(["from,to{overflow:hidden;}"]);
|
|
38
|
+
|
|
39
|
+
// The width opens from nothing, so the controls beside the menu move aside with it.
|
|
40
|
+
export const StyledViewSwitcherMenuRoot = styled(StyledViewSwitcher).withConfig({
|
|
41
|
+
displayName: "Styles__StyledViewSwitcherMenuRoot",
|
|
42
|
+
componentId: "sc-1cg2mte-5"
|
|
43
|
+
})(["display:inline-grid;grid-template-columns:1fr;&[data-animate-in]{animation:", " ", "ms cubic-bezier(0.4,0,0.2,1);}&[data-animate-in] > .c-view-switcher-menu__clip{animation:", " ", "ms;}&[data-leaving]{pointer-events:none;animation:", " ", "ms cubic-bezier(0.4,0,0.2,1) forwards;}&[data-leaving] > .c-view-switcher-menu__clip{overflow:hidden;}@media (prefers-reduced-motion:reduce){&[data-animate-in],&[data-animate-in] > .c-view-switcher-menu__clip,&[data-leaving]{animation:none;}}"], menuReveal, VIEW_SWITCHER_MENU_REVEAL_MS, menuClip, VIEW_SWITCHER_MENU_REVEAL_MS, menuConceal, VIEW_SWITCHER_MENU_REVEAL_MS);
|
|
44
|
+
StyledViewSwitcherMenuRoot.displayName = "StyledViewSwitcherMenuRoot";
|
|
45
|
+
export const StyledViewSwitcherMenuClip = styled.div.withConfig({
|
|
46
|
+
displayName: "Styles__StyledViewSwitcherMenuClip",
|
|
47
|
+
componentId: "sc-1cg2mte-6"
|
|
48
|
+
})(["display:flex;min-width:0;> *{flex-shrink:0;}"]);
|
|
49
|
+
StyledViewSwitcherMenuClip.displayName = "StyledViewSwitcherMenuClip";
|
|
29
50
|
export const StyledViewSwitcherMenuIcon = styled.span.withConfig({
|
|
30
51
|
displayName: "Styles__StyledViewSwitcherMenuIcon",
|
|
31
|
-
componentId: "sc-1cg2mte-
|
|
52
|
+
componentId: "sc-1cg2mte-7"
|
|
32
53
|
})(["display:inline-flex;flex-shrink:0;margin-right:8px;fill:var(--color-theme-900);"]);
|
|
33
54
|
StyledViewSwitcherMenuIcon.displayName = "StyledViewSwitcherMenuIcon";
|
|
34
55
|
export const StyledViewSwitcherMenuList = styled(List).withConfig({
|
|
35
56
|
displayName: "Styles__StyledViewSwitcherMenuList",
|
|
36
|
-
componentId: "sc-1cg2mte-
|
|
57
|
+
componentId: "sc-1cg2mte-8"
|
|
37
58
|
})(["padding:8px 0;"]);
|
|
38
59
|
StyledViewSwitcherMenuList.displayName = "StyledViewSwitcherMenuList";
|
|
39
60
|
export const StyledViewSwitcherMenuLabel = styled.span.withConfig({
|
|
40
61
|
displayName: "Styles__StyledViewSwitcherMenuLabel",
|
|
41
|
-
componentId: "sc-1cg2mte-
|
|
62
|
+
componentId: "sc-1cg2mte-9"
|
|
42
63
|
})(["flex:1;&[data-selected=\"true\"]{font-weight:bold;color:var(--color-primary);}"]);
|
|
43
64
|
StyledViewSwitcherMenuLabel.displayName = "StyledViewSwitcherMenuLabel";
|
|
44
65
|
const promptIn = keyframes(["from{opacity:0;}"]);
|
|
45
|
-
const promptOut = keyframes(["to{
|
|
46
|
-
const
|
|
66
|
+
const promptOut = keyframes(["to{clip-path:inset(0 0 0 100%);}"]);
|
|
67
|
+
const appliedIn = keyframes(["from{opacity:0;transform:translateY(6px);}"]);
|
|
47
68
|
const appliedIcon = keyframes(["from{opacity:0;transform:scale(0.4);}60%{transform:scale(1.2);}"]);
|
|
48
69
|
export const StyledViewSwitcherPromptTitle = styled.span.withConfig({
|
|
49
70
|
displayName: "Styles__StyledViewSwitcherPromptTitle",
|
|
50
|
-
componentId: "sc-1cg2mte-
|
|
71
|
+
componentId: "sc-1cg2mte-10"
|
|
51
72
|
})(["position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;"]);
|
|
52
73
|
StyledViewSwitcherPromptTitle.displayName = "StyledViewSwitcherPromptTitle";
|
|
53
|
-
|
|
74
|
+
const PROMPT_EASE = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
75
|
+
const APPLIED_SWAP_MS = 160;
|
|
76
|
+
|
|
77
|
+
// The offer covers the buttons and keeps the width of the switcher, so nothing beside it moves.
|
|
78
|
+
export const StyledViewSwitcherPrompt = styled.div.withConfig({
|
|
54
79
|
displayName: "Styles__StyledViewSwitcherPrompt",
|
|
55
|
-
componentId: "sc-1cg2mte-
|
|
56
|
-
})(["
|
|
80
|
+
componentId: "sc-1cg2mte-11"
|
|
81
|
+
})(["", " position:absolute;top:3px;right:3px;bottom:3px;z-index:1;display:flex;min-width:calc(100% - 6px);animation:", " ", "ms ", ";&[data-phase=\"applying\"],&[data-phase=\"applied\"]{pointer-events:none;}&[data-phase=\"applying\"] .c-view-switcher__prompt-pill{opacity:0.7;}.c-view-switcher__action,.c-view-switcher__line,.c-view-switcher__dismiss{transition:opacity ", "ms ", ",transform ", "ms ", ",visibility 0s linear ", "ms,background-color 150ms ease;}&[data-confirmed] .c-view-switcher__action,&[data-confirmed] .c-view-switcher__line,&[data-confirmed] .c-view-switcher__dismiss{visibility:hidden;opacity:0;transform:translateY(-6px);}&[data-phase=\"leaving\"]{pointer-events:none;animation:", " ", "ms ", " forwards;}@media (prefers-reduced-motion:reduce){animation:none;&[data-phase=\"leaving\"]{animation:none;}.c-view-switcher__action,.c-view-switcher__line,.c-view-switcher__dismiss,.c-view-switcher__prompt-pill{transition:none;}}"], BoxSizingStyle, promptIn, VIEW_SWITCHER_LEAVE_MS, PROMPT_EASE, APPLIED_SWAP_MS, PROMPT_EASE, APPLIED_SWAP_MS, PROMPT_EASE, APPLIED_SWAP_MS, promptOut, VIEW_SWITCHER_LEAVE_MS, PROMPT_EASE);
|
|
57
82
|
StyledViewSwitcherPrompt.displayName = "StyledViewSwitcherPrompt";
|
|
83
|
+
export const StyledViewSwitcherPromptClip = styled.div.withConfig({
|
|
84
|
+
displayName: "Styles__StyledViewSwitcherPromptClip",
|
|
85
|
+
componentId: "sc-1cg2mte-12"
|
|
86
|
+
})(["display:flex;flex:1;min-width:0;"]);
|
|
87
|
+
StyledViewSwitcherPromptClip.displayName = "StyledViewSwitcherPromptClip";
|
|
88
|
+
export const StyledViewSwitcherPromptPill = styled.div.withConfig({
|
|
89
|
+
displayName: "Styles__StyledViewSwitcherPromptPill",
|
|
90
|
+
componentId: "sc-1cg2mte-13"
|
|
91
|
+
})(["", " position:relative;display:inline-flex;flex:1;align-items:center;justify-content:center;height:26px;border-radius:var(--ac-br-rounded);background-color:var(--color-primary-opaque-300);color:var(--color-primary);font-size:calc(0.75rem * var(--text-scale,1));font-weight:500;white-space:nowrap;transition:opacity 150ms ease;"], BoxSizingStyle);
|
|
92
|
+
StyledViewSwitcherPromptPill.displayName = "StyledViewSwitcherPromptPill";
|
|
93
|
+
export const StyledViewSwitcherAction = styled.button.withConfig({
|
|
94
|
+
displayName: "Styles__StyledViewSwitcherAction",
|
|
95
|
+
componentId: "sc-1cg2mte-14"
|
|
96
|
+
})(["", " display:inline-flex;align-items:center;gap:4px;height:26px;margin:0;padding:0 2px 0 6px;border:0;border-radius:var(--ac-br-rounded);background-color:transparent;color:inherit;font:inherit;cursor:pointer;outline:none;svg{flex-shrink:0;width:16px;height:16px;fill:currentColor;}&:hover{color:var(--color-theme-900);}&:focus-visible{box-shadow:inset 0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
97
|
+
StyledViewSwitcherAction.displayName = "StyledViewSwitcherAction";
|
|
98
|
+
export const StyledViewSwitcherLine = styled.i.withConfig({
|
|
99
|
+
displayName: "Styles__StyledViewSwitcherLine",
|
|
100
|
+
componentId: "sc-1cg2mte-15"
|
|
101
|
+
})(["flex-shrink:0;width:1px;height:14px;margin:0 1px 0 6px;background-color:color-mix(in srgb,var(--color-primary) 35%,transparent);"]);
|
|
102
|
+
StyledViewSwitcherLine.displayName = "StyledViewSwitcherLine";
|
|
103
|
+
export const StyledViewSwitcherDismiss = styled.button.withConfig({
|
|
104
|
+
displayName: "Styles__StyledViewSwitcherDismiss",
|
|
105
|
+
componentId: "sc-1cg2mte-16"
|
|
106
|
+
})(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:22px;height:22px;margin:0 2px 0 0;padding:0;border:0;border-radius:50%;background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease;svg{width:16px;height:16px;margin-left:-1px;fill:var(--color-theme-700);}&:hover{background-color:color-mix( in srgb,var(--color-theme-900) 16%,transparent );}&:focus-visible{box-shadow:inset 0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
107
|
+
StyledViewSwitcherDismiss.displayName = "StyledViewSwitcherDismiss";
|
|
108
|
+
export const StyledViewSwitcherApplied = styled.span.withConfig({
|
|
109
|
+
displayName: "Styles__StyledViewSwitcherApplied",
|
|
110
|
+
componentId: "sc-1cg2mte-17"
|
|
111
|
+
})(["position:absolute;inset:0;display:inline-flex;align-items:center;justify-content:center;gap:4px;animation:", " ", "ms ", " 60ms backwards;svg{width:16px;height:16px;fill:currentColor;animation:", " 250ms ease-out 60ms backwards;}@media (prefers-reduced-motion:reduce){animation:none;svg{animation:none;}}"], appliedIn, APPLIED_SWAP_MS, PROMPT_EASE, appliedIcon);
|
|
112
|
+
StyledViewSwitcherApplied.displayName = "StyledViewSwitcherApplied";
|
|
58
113
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","keyframes","BoxSizingStyle","List","PillGroup","VIEW_SWITCHER_PROMPT_MS","VIEW_SWITCHER_RESIZE_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","div","withConfig","displayName","componentId","StyledViewSwitcherTrack","StyledViewSwitcherOption","button","StyledViewSwitcherMenuOption","StyledViewSwitcherMenuIcon","span","StyledViewSwitcherMenuList","StyledViewSwitcherMenuLabel","promptIn","promptOut","promptTimeLeft","appliedIcon","StyledViewSwitcherPromptTitle","StyledViewSwitcherPrompt"],"sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\nimport { PillGroup } from \"../PillGroup\";\n\nexport const VIEW_SWITCHER_PROMPT_MS = 5000;\nexport const VIEW_SWITCHER_RESIZE_MS = 200;\nexport const VIEW_SWITCHER_APPLIED_MS = 900;\nexport const VIEW_SWITCHER_LEAVE_MS = 150;\n\nexport const StyledViewSwitcher = styled.div`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n`;\n\nStyledViewSwitcher.displayName = \"StyledViewSwitcher\";\n\nexport const StyledViewSwitcherTrack = styled.div`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n height: 32px;\n padding: 3px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-theme-300);\n transition: width ${VIEW_SWITCHER_RESIZE_MS}ms cubic-bezier(0.4, 0, 0.2, 1);\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n`;\n\nStyledViewSwitcherTrack.displayName = \"StyledViewSwitcherTrack\";\n\nexport const StyledViewSwitcherOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 34px;\n height: 26px;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease, box-shadow 150ms ease;\n\n svg {\n width: 20px;\n height: 20px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &[aria-checked=\"true\"] {\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n cursor: default;\n\n svg {\n fill: var(--color-theme-900);\n }\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherOption.displayName = \"StyledViewSwitcherOption\";\n\nexport const StyledViewSwitcherMenuOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 8px 0 12px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n color: var(--color-theme-900);\n font-size: calc(13px * var(--text-scale, 1));\n white-space: nowrap;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n fill: var(--color-theme-900);\n }\n\n &:has(.c-view-switcher-menu__icon) {\n padding-left: 8px;\n }\n\n .c-view-switcher-menu__values {\n display: inline-grid;\n }\n\n .c-view-switcher-menu__value {\n display: inline-flex;\n grid-area: 1 / 1;\n align-items: center;\n gap: 4px;\n visibility: hidden;\n }\n\n .c-view-switcher-menu__value[data-selected=\"true\"] {\n visibility: visible;\n }\n\n .c-view-switcher-menu__icon {\n display: inline-flex;\n flex-shrink: 0;\n }\n\n .c-view-switcher-menu__icon svg {\n width: 20px;\n height: 20px;\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherMenuOption.displayName = \"StyledViewSwitcherMenuOption\";\n\nexport const StyledViewSwitcherMenuIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n margin-right: 8px;\n fill: var(--color-theme-900);\n`;\n\nStyledViewSwitcherMenuIcon.displayName = \"StyledViewSwitcherMenuIcon\";\n\nexport const StyledViewSwitcherMenuList = styled(List)`\n padding: 8px 0;\n`;\n\nStyledViewSwitcherMenuList.displayName = \"StyledViewSwitcherMenuList\";\n\nexport const StyledViewSwitcherMenuLabel = styled.span`\n flex: 1;\n\n &[data-selected=\"true\"] {\n font-weight: bold;\n color: var(--color-primary);\n }\n`;\n\nStyledViewSwitcherMenuLabel.displayName = \"StyledViewSwitcherMenuLabel\";\n\nconst promptIn = keyframes`\n from {\n opacity: 0;\n }\n`;\n\nconst promptOut = keyframes`\n to {\n opacity: 0;\n transform: scale(0.96);\n }\n`;\n\nconst promptTimeLeft = keyframes`\n to {\n transform: scaleX(0);\n }\n`;\n\nconst appliedIcon = keyframes`\n from {\n opacity: 0;\n transform: scale(0.4);\n }\n 60% {\n transform: scale(1.2);\n }\n`;\n\nexport const StyledViewSwitcherPromptTitle = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n`;\n\nStyledViewSwitcherPromptTitle.displayName = \"StyledViewSwitcherPromptTitle\";\n\nexport const StyledViewSwitcherPrompt = styled(PillGroup)`\n flex: 1 0 auto;\n max-width: none;\n animation: ${promptIn} 150ms ease-out;\n\n .c-pill-button:not(.c-pill-button--icon-only) {\n flex: 1 0 auto;\n justify-content: center;\n font-size: calc(0.75rem * var(--text-scale, 1));\n }\n\n & > .c-pill-button:not(.c-pill-button--icon-only) {\n white-space: nowrap;\n }\n\n .c-view-switcher__dismiss {\n position: relative;\n width: 32px;\n overflow: hidden;\n }\n\n /* The fill goes down to nothing when the prompt dismisses itself. */\n .c-view-switcher__dismiss::before {\n content: \"\";\n position: absolute;\n inset: 0;\n background-color: color-mix(in srgb, var(--color-primary) 25%, transparent);\n transform-origin: left;\n animation: ${promptTimeLeft} ${VIEW_SWITCHER_PROMPT_MS}ms linear forwards;\n }\n\n .c-view-switcher__dismiss > * {\n position: relative;\n }\n\n &[data-phase=\"applying\"] {\n pointer-events: none;\n\n .c-pill-button {\n opacity: 0.7;\n }\n\n .c-view-switcher__dismiss::before {\n animation-play-state: paused;\n }\n }\n\n &[data-phase=\"applied\"] {\n pointer-events: none;\n\n .c-pill-button {\n background-color: color-mix(\n in srgb,\n var(--color-primary) 30%,\n transparent\n );\n }\n\n .c-pill-button svg {\n width: 16px;\n height: 16px;\n animation: ${appliedIcon} 250ms ease-out;\n }\n }\n\n &[data-phase=\"leaving\"] {\n pointer-events: none;\n animation: ${promptOut} ${VIEW_SWITCHER_LEAVE_MS}ms ease-in forwards;\n }\n`;\n\nStyledViewSwitcherPrompt.displayName = \"StyledViewSwitcherPrompt\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,SAAS,QAAQ,mBAAmB;AAErD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,SAAS,QAAQ,cAAc;AAExC,OAAO,MAAMC,uBAAuB,GAAG,IAAI;AAC3C,OAAO,MAAMC,uBAAuB,GAAG,GAAG;AAC1C,OAAO,MAAMC,wBAAwB,GAAG,GAAG;AAC3C,OAAO,MAAMC,sBAAsB,GAAG,GAAG;AAEzC,OAAO,MAAMC,kBAAkB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8BAI/B;AAED,MAAMwB,WAAW,GAAGxB,SAAS,qEAQ5B;AAED,OAAO,MAAMyB,6BAA6B,GAAG1B,MAAM,CAACmB,IAAI,CAAAR,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,uGAOvD;AAEDa,6BAA6B,CAACd,WAAW,GAAG,+BAA+B;AAE3E,OAAO,MAAMe,wBAAwB,GAAG3B,MAAM,CAACI,SAAS,CAAC,CAAAO,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wgCAG1CS,QAAQ,EAyBNE,cAAc,EAAInB,uBAAuB,EAiCvCoB,WAAW,EAMbF,SAAS,EAAIf,sBAAsB,CAEnD;AAEDmB,wBAAwB,CAACf,WAAW,GAAG,0BAA0B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","keyframes","BoxSizingStyle","List","VIEW_SWITCHER_PROMPT_DELAY_MS","VIEW_SWITCHER_PROMPT_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","div","withConfig","displayName","componentId","StyledViewSwitcherTrack","StyledViewSwitcherOptions","StyledViewSwitcherOption","button","StyledViewSwitcherMenuOption","VIEW_SWITCHER_MENU_REVEAL_MS","VIEW_SWITCHER_MENU_GAP","menuReveal","menuConceal","menuClip","StyledViewSwitcherMenuRoot","StyledViewSwitcherMenuClip","StyledViewSwitcherMenuIcon","span","StyledViewSwitcherMenuList","StyledViewSwitcherMenuLabel","promptIn","promptOut","appliedIn","appliedIcon","StyledViewSwitcherPromptTitle","PROMPT_EASE","APPLIED_SWAP_MS","StyledViewSwitcherPrompt","StyledViewSwitcherPromptClip","StyledViewSwitcherPromptPill","StyledViewSwitcherAction","StyledViewSwitcherLine","i","StyledViewSwitcherDismiss","StyledViewSwitcherApplied"],"sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\n\nexport const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;\nexport const VIEW_SWITCHER_PROMPT_MS = 5000;\nexport const VIEW_SWITCHER_APPLIED_MS = 900;\nexport const VIEW_SWITCHER_LEAVE_MS = 200;\n\nexport const StyledViewSwitcher = styled.div`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n`;\n\nStyledViewSwitcher.displayName = \"StyledViewSwitcher\";\n\nexport const StyledViewSwitcherTrack = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n align-items: center;\n height: 32px;\n padding: 3px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-theme-300);\n`;\n\nStyledViewSwitcherTrack.displayName = \"StyledViewSwitcherTrack\";\n\nexport const StyledViewSwitcherOptions = styled.div`\n display: inline-flex;\n align-items: center;\n`;\n\nStyledViewSwitcherOptions.displayName = \"StyledViewSwitcherOptions\";\n\nexport const StyledViewSwitcherOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 34px;\n height: 26px;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease, box-shadow 150ms ease;\n\n svg {\n width: 20px;\n height: 20px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &[aria-checked=\"true\"] {\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n cursor: default;\n\n svg {\n fill: var(--color-theme-900);\n }\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherOption.displayName = \"StyledViewSwitcherOption\";\n\nexport const StyledViewSwitcherMenuOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 8px 0 12px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n color: var(--color-theme-900);\n font-size: calc(13px * var(--text-scale, 1));\n white-space: nowrap;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n fill: var(--color-theme-900);\n }\n\n &:has(.c-view-switcher-menu__icon) {\n padding-left: 8px;\n }\n\n .c-view-switcher-menu__values {\n display: inline-grid;\n }\n\n .c-view-switcher-menu__value {\n display: inline-flex;\n grid-area: 1 / 1;\n align-items: center;\n gap: 4px;\n visibility: hidden;\n }\n\n .c-view-switcher-menu__value[data-selected=\"true\"] {\n visibility: visible;\n }\n\n .c-view-switcher-menu__icon {\n display: inline-flex;\n flex-shrink: 0;\n }\n\n .c-view-switcher-menu__icon svg {\n width: 20px;\n height: 20px;\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherMenuOption.displayName = \"StyledViewSwitcherMenuOption\";\n\nconst VIEW_SWITCHER_MENU_REVEAL_MS = 200;\nconst VIEW_SWITCHER_MENU_GAP = 8;\n\nconst menuReveal = keyframes`\n from {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuConceal = keyframes`\n to {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuClip = keyframes`\n from,\n to {\n overflow: hidden;\n }\n`;\n\n// The width opens from nothing, so the controls beside the menu move aside with it.\nexport const StyledViewSwitcherMenuRoot = styled(StyledViewSwitcher)`\n display: inline-grid;\n grid-template-columns: 1fr;\n\n &[data-animate-in] {\n animation: ${menuReveal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n &[data-animate-in] > .c-view-switcher-menu__clip {\n animation: ${menuClip} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms;\n }\n\n &[data-leaving] {\n pointer-events: none;\n animation: ${menuConceal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n &[data-leaving] > .c-view-switcher-menu__clip {\n overflow: hidden;\n }\n\n @media (prefers-reduced-motion: reduce) {\n &[data-animate-in],\n &[data-animate-in] > .c-view-switcher-menu__clip,\n &[data-leaving] {\n animation: none;\n }\n }\n`;\n\nStyledViewSwitcherMenuRoot.displayName = \"StyledViewSwitcherMenuRoot\";\n\nexport const StyledViewSwitcherMenuClip = styled.div`\n display: flex;\n min-width: 0;\n\n > * {\n flex-shrink: 0;\n }\n`;\n\nStyledViewSwitcherMenuClip.displayName = \"StyledViewSwitcherMenuClip\";\n\nexport const StyledViewSwitcherMenuIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n margin-right: 8px;\n fill: var(--color-theme-900);\n`;\n\nStyledViewSwitcherMenuIcon.displayName = \"StyledViewSwitcherMenuIcon\";\n\nexport const StyledViewSwitcherMenuList = styled(List)`\n padding: 8px 0;\n`;\n\nStyledViewSwitcherMenuList.displayName = \"StyledViewSwitcherMenuList\";\n\nexport const StyledViewSwitcherMenuLabel = styled.span`\n flex: 1;\n\n &[data-selected=\"true\"] {\n font-weight: bold;\n color: var(--color-primary);\n }\n`;\n\nStyledViewSwitcherMenuLabel.displayName = \"StyledViewSwitcherMenuLabel\";\n\nconst promptIn = keyframes`\n from {\n opacity: 0;\n }\n`;\n\nconst promptOut = keyframes`\n to {\n clip-path: inset(0 0 0 100%);\n }\n`;\n\nconst appliedIn = keyframes`\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n`;\n\nconst appliedIcon = keyframes`\n from {\n opacity: 0;\n transform: scale(0.4);\n }\n 60% {\n transform: scale(1.2);\n }\n`;\n\nexport const StyledViewSwitcherPromptTitle = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n`;\n\nStyledViewSwitcherPromptTitle.displayName = \"StyledViewSwitcherPromptTitle\";\n\nconst PROMPT_EASE = \"cubic-bezier(0.4, 0, 0.2, 1)\";\nconst APPLIED_SWAP_MS = 160;\n\n// The offer covers the buttons and keeps the width of the switcher, so nothing beside it moves.\nexport const StyledViewSwitcherPrompt = styled.div`\n ${BoxSizingStyle}\n position: absolute;\n top: 3px;\n right: 3px;\n bottom: 3px;\n z-index: 1;\n display: flex;\n min-width: calc(100% - 6px);\n animation: ${promptIn} ${VIEW_SWITCHER_LEAVE_MS}ms ${PROMPT_EASE};\n\n &[data-phase=\"applying\"],\n &[data-phase=\"applied\"] {\n pointer-events: none;\n }\n\n &[data-phase=\"applying\"] .c-view-switcher__prompt-pill {\n opacity: 0.7;\n }\n\n .c-view-switcher__action,\n .c-view-switcher__line,\n .c-view-switcher__dismiss {\n transition: opacity ${APPLIED_SWAP_MS}ms ${PROMPT_EASE},\n transform ${APPLIED_SWAP_MS}ms ${PROMPT_EASE},\n visibility 0s linear ${APPLIED_SWAP_MS}ms, background-color 150ms ease;\n }\n\n &[data-confirmed] .c-view-switcher__action,\n &[data-confirmed] .c-view-switcher__line,\n &[data-confirmed] .c-view-switcher__dismiss {\n visibility: hidden;\n opacity: 0;\n transform: translateY(-6px);\n }\n\n &[data-phase=\"leaving\"] {\n pointer-events: none;\n animation: ${promptOut} ${VIEW_SWITCHER_LEAVE_MS}ms ${PROMPT_EASE} forwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n\n &[data-phase=\"leaving\"] {\n animation: none;\n }\n\n .c-view-switcher__action,\n .c-view-switcher__line,\n .c-view-switcher__dismiss,\n .c-view-switcher__prompt-pill {\n transition: none;\n }\n }\n`;\n\nStyledViewSwitcherPrompt.displayName = \"StyledViewSwitcherPrompt\";\n\nexport const StyledViewSwitcherPromptClip = styled.div`\n display: flex;\n flex: 1;\n min-width: 0;\n`;\n\nStyledViewSwitcherPromptClip.displayName = \"StyledViewSwitcherPromptClip\";\n\nexport const StyledViewSwitcherPromptPill = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n height: 26px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-primary-opaque-300);\n color: var(--color-primary);\n font-size: calc(0.75rem * var(--text-scale, 1));\n font-weight: 500;\n white-space: nowrap;\n transition: opacity 150ms ease;\n`;\n\nStyledViewSwitcherPromptPill.displayName = \"StyledViewSwitcherPromptPill\";\n\nexport const StyledViewSwitcherAction = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 2px 0 6px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n fill: currentColor;\n }\n\n &:hover {\n color: var(--color-theme-900);\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherAction.displayName = \"StyledViewSwitcherAction\";\n\nexport const StyledViewSwitcherLine = styled.i`\n flex-shrink: 0;\n width: 1px;\n height: 14px;\n margin: 0 1px 0 6px;\n background-color: color-mix(in srgb, var(--color-primary) 35%, transparent);\n`;\n\nStyledViewSwitcherLine.displayName = \"StyledViewSwitcherLine\";\n\nexport const StyledViewSwitcherDismiss = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n margin: 0 2px 0 0;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease;\n\n svg {\n width: 16px;\n height: 16px;\n margin-left: -1px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherDismiss.displayName = \"StyledViewSwitcherDismiss\";\n\nexport const StyledViewSwitcherApplied = styled.span`\n position: absolute;\n inset: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n animation: ${appliedIn} ${APPLIED_SWAP_MS}ms ${PROMPT_EASE} 60ms backwards;\n\n svg {\n width: 16px;\n height: 16px;\n fill: currentColor;\n animation: ${appliedIcon} 250ms ease-out 60ms backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n\n svg {\n animation: none;\n }\n }\n`;\n\nStyledViewSwitcherApplied.displayName = \"StyledViewSwitcherApplied\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,SAAS,QAAQ,mBAAmB;AAErD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAE9B,OAAO,MAAMC,6BAA6B,GAAG,GAAG;AAChD,OAAO,MAAMC,uBAAuB,GAAG,IAAI;AAC3C,OAAO,MAAMC,wBAAwB,GAAG,GAAG;AAC3C,OAAO,MAAMC,sBAAsB,GAAG,GAAG;AAEzC,OAAO,MAAMC,kBAAkB,GAAGR,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gDACxCV,cAAc,CAGjB;AAEDM,kBAAkB,CAACG,WAAW,GAAG,oBAAoB;AAErD,OAAO,MAAME,uBAAuB,GAAGb,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0KAC7CV,cAAc,CAQjB;AAEDW,uBAAuB,CAACF,WAAW,GAAG,yBAAyB;AAE/D,OAAO,MAAMG,yBAAyB,GAAGd,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+CAGlD;AAEDE,yBAAyB,CAACH,WAAW,GAAG,2BAA2B;AAEnE,OAAO,MAAMI,wBAAwB,GAAGf,MAAM,CAACgB,MAAM,CA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,wBAAwB,GAAGvC,MAAM,CAACgB,MAAM,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yYACjDV,cAAc,CA6BjB;AAEDqC,wBAAwB,CAAC5B,WAAW,GAAG,0BAA0B;AAEjE,OAAO,MAAM6B,sBAAsB,GAAGxC,MAAM,CAACyC,CAAC,CAAA/B,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wIAM7C;AAED4B,sBAAsB,CAAC7B,WAAW,GAAG,wBAAwB;AAE7D,OAAO,MAAM+B,yBAAyB,GAAG1C,MAAM,CAACgB,MAAM,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,ueAClDV,cAAc,CAkCjB;AAEDwC,yBAAyB,CAAC/B,WAAW,GAAG,2BAA2B;AAEnE,OAAO,MAAMgC,yBAAyB,GAAG3C,MAAM,CAAC0B,IAAI,CAAAhB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yTAOrCmB,SAAS,EAAII,eAAe,EAAMD,WAAW,EAM3CF,WAAW,CAU3B;AAEDW,yBAAyB,CAAChC,WAAW,GAAG,2BAA2B","ignoreList":[]}
|
|
@@ -15,20 +15,25 @@ export interface ViewSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
15
15
|
"aria-label"?: string;
|
|
16
16
|
/** Turns on the extra action offered after a switch. A result of false shows no confirmation. */
|
|
17
17
|
onApplyToAll?: (id: string) => unknown;
|
|
18
|
-
/**
|
|
18
|
+
/** Short visible text of the extra action. */
|
|
19
19
|
applyToAllLabel?: string;
|
|
20
|
+
/** Tooltip and accessible name of the extra action. */
|
|
21
|
+
applyToAllTitle?: string;
|
|
20
22
|
/** Accessible name of the extra action group. Defaults to "Now in {label}". */
|
|
21
23
|
offerTitle?: (view: ViewSwitcherView) => ReactNode;
|
|
22
24
|
/** Accessible name of the button that dismisses the extra action. */
|
|
23
25
|
dismissLabel?: string;
|
|
24
26
|
/** Text that confirms the extra action. */
|
|
25
27
|
appliedLabel?: string;
|
|
28
|
+
/** A new value opens the extra action for the checked view, for a change made outside the buttons. */
|
|
29
|
+
offerKey?: string | number;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* @component ViewSwitcher
|
|
29
33
|
* @description
|
|
30
34
|
* Icon-only radiogroup that switches the view of a page. A tooltip shows the view name on hover.
|
|
31
|
-
* With onApplyToAll, a switch
|
|
35
|
+
* With onApplyToAll, a switch or a click on the checked view opens a compact extra action beside the buttons
|
|
36
|
+
* after a short delay, for five seconds.
|
|
32
37
|
*
|
|
33
38
|
* @example
|
|
34
39
|
* <ViewSwitcher
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/ViewSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,cAAc,EAEd,SAAS,
|
|
1
|
+
{"version":3,"file":"ViewSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/ViewSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,cAAc,EAEd,SAAS,EAMV,MAAM,OAAO,CAAC;AA0Bf,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxD,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iGAAiG;IACjG,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,SAAS,CAAC;IACnD,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,0FA8UxB,CAAC"}
|