@activecollab/components 2.0.557 → 2.0.559
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 +3 -3
- package/dist/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/cjs/components/Icons/collection/OpenBook.js +66 -0
- package/dist/cjs/components/Icons/collection/OpenBook.js.map +1 -0
- package/dist/cjs/components/Icons/collection/SendBlank.js +3 -1
- package/dist/cjs/components/Icons/collection/SendBlank.js.map +1 -1
- package/dist/cjs/components/Icons/collection/SendFilled.js +2 -2
- package/dist/cjs/components/Icons/collection/SendFilled.js.map +1 -1
- package/dist/cjs/components/Icons/collection/index.js +7 -0
- package/dist/cjs/components/Icons/collection/index.js.map +1 -1
- package/dist/cjs/components/ObjectLayout/ObjectLayout.js +4 -2
- package/dist/cjs/components/ObjectLayout/ObjectLayout.js.map +1 -1
- package/dist/cjs/components/PillButton/PillButton.js.map +1 -1
- package/dist/cjs/components/PillButton/Styles.js +13 -3
- package/dist/cjs/components/PillButton/Styles.js.map +1 -1
- package/dist/cjs/components/PillGroup/Styles.js +3 -1
- package/dist/cjs/components/PillGroup/Styles.js.map +1 -1
- package/dist/cjs/components/Sheet/Sheet.js +150 -41
- package/dist/cjs/components/Sheet/Sheet.js.map +1 -1
- package/dist/cjs/components/Sheet/Styles.js +37 -15
- package/dist/cjs/components/Sheet/Styles.js.map +1 -1
- package/dist/cjs/hooks/useResizablePanel.js +5 -3
- package/dist/cjs/hooks/useResizablePanel.js.map +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js +3 -3
- package/dist/esm/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/esm/components/Icons/collection/OpenBook.d.ts +32 -0
- package/dist/esm/components/Icons/collection/OpenBook.d.ts.map +1 -0
- package/dist/esm/components/Icons/collection/OpenBook.js +59 -0
- package/dist/esm/components/Icons/collection/OpenBook.js.map +1 -0
- package/dist/esm/components/Icons/collection/SendBlank.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/SendBlank.js +3 -1
- package/dist/esm/components/Icons/collection/SendBlank.js.map +1 -1
- package/dist/esm/components/Icons/collection/SendFilled.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/SendFilled.js +2 -2
- package/dist/esm/components/Icons/collection/SendFilled.js.map +1 -1
- package/dist/esm/components/Icons/collection/index.d.ts +1 -0
- package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/index.js +1 -0
- package/dist/esm/components/Icons/collection/index.js.map +1 -1
- package/dist/esm/components/ObjectLayout/ObjectLayout.d.ts +2 -0
- package/dist/esm/components/ObjectLayout/ObjectLayout.d.ts.map +1 -1
- package/dist/esm/components/ObjectLayout/ObjectLayout.js +4 -2
- package/dist/esm/components/ObjectLayout/ObjectLayout.js.map +1 -1
- package/dist/esm/components/PillButton/PillButton.d.ts +2 -2
- package/dist/esm/components/PillButton/PillButton.d.ts.map +1 -1
- 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 +10 -2
- package/dist/esm/components/PillButton/Styles.js.map +1 -1
- package/dist/esm/components/PillGroup/Styles.d.ts.map +1 -1
- package/dist/esm/components/PillGroup/Styles.js +3 -1
- package/dist/esm/components/PillGroup/Styles.js.map +1 -1
- package/dist/esm/components/Sheet/Sheet.d.ts +11 -0
- package/dist/esm/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Sheet.js +139 -41
- package/dist/esm/components/Sheet/Sheet.js.map +1 -1
- package/dist/esm/components/Sheet/Styles.d.ts +3 -0
- package/dist/esm/components/Sheet/Styles.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Styles.js +35 -13
- package/dist/esm/components/Sheet/Styles.js.map +1 -1
- package/dist/esm/hooks/useResizablePanel.d.ts +4 -1
- package/dist/esm/hooks/useResizablePanel.d.ts.map +1 -1
- package/dist/esm/hooks/useResizablePanel.js +5 -3
- package/dist/esm/hooks/useResizablePanel.js.map +1 -1
- package/dist/index.js +786 -583
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.js","names":["React","useCallback","useEffect","forwardRef","useState","useImperativeHandle","useRef","classnames","StyledAnimatedSpan","StyledCssTransition","StyledHeader","StyledIconsWrapperSmall","StyledListSeparator","StyledSheetIcons","StyledSheetWrapper","SHEET_ENTER_MS","SHEET_EXIT_MS","StyledSheetSurface","StyledSheetWrapperPaper","PortalContainerProvider","usePortalContainer","usePropWarning","IconButton","Overlay","Tooltip","Fade","Window","useHostAboveOpenModal","INSET_VAR","INSET_DURATION_VAR","CONTROLS_ROOM","useSheetInset","wrapperRef","isOn","wrapper","current","undefined","root","document","documentElement","update","_wrapper$getBoundingC","getBoundingClientRect","left","style","setProperty","clientWidth","removeProperty","observer","ResizeObserver","isWidth","event","propertyName","startWidth","target","endWidth","observe","window","addEventListener","disconnect","removeEventListener","Sheet","_ref","ref","children","onClose","_ref$controls","controls","_ref$open","open","defaultOpen","_ref$animation","animation","_ref$position","position","_ref$mode","mode","maxWidth","_ref$surface","surface","_ref$disableFocusLock","disableFocusLock","_ref$disableScrollLoc","disableScrollLock","_ref$disableBackgroun","disableBackgroundColor","bodyStyle","bodyClassName","dismissOnBackdropClick","onBackdropClickBlocked","disableBackgroundClick","rest","_objectWithoutPropertiesLoose","_excluded","_useState","setOpen","_useState2","exited","setExited","_useState3","overlayEntered","setOverlayEntered","handleEnter","handleExited","handleClose","handleOverlayEntered","handleOverlayExit","closesOnBackdropClick","handleBackgroundClick","preventDefault","close","portalContainer","_useHostAboveOpenModa","modalHost","host","modalHostPending","pending","sheetWindow","createElement","_extends","pointerEvents","in","timeout","onEntered","onExit","onClick","className","$position","$mode","$maxWidth","appear","classNames","$direction","onEnter","onExited","length","map","_ref2","index","IconComponent","icon","tooltip","disabled","title","disable","key","$disabled","paperClass","$surface","_ref3","variant","value","displayName"],"sources":["../../../../src/components/Sheet/Sheet.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n forwardRef,\n HTMLAttributes,\n useState,\n CSSProperties,\n MouseEvent,\n useImperativeHandle,\n useRef,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n StyledAnimatedSpan,\n StyledCssTransition,\n StyledHeader,\n StyledIconsWrapperSmall,\n StyledListSeparator,\n StyledSheetIcons,\n StyledSheetWrapper,\n SHEET_ENTER_MS,\n SHEET_EXIT_MS,\n StyledSheetSurface,\n StyledSheetWrapperPaper,\n} from \"./Styles\";\nimport { PortalContainerProvider, usePortalContainer } from \"../../helpers\";\nimport { usePropWarning } from \"../Dialog/usePropWarning\";\nimport { IconButton } from \"../IconButton\";\nimport { Overlay } from \"../Overlay\";\nimport { Tooltip } from \"../Tooltip\";\nimport { Fade } from \"../Transitions\";\nimport { Window } from \"../Window\";\nimport { useHostAboveOpenModal } from \"./useHostAboveOpenModal\";\n\nconst INSET_VAR = \"--c-sheet-inset-right\";\nconst INSET_DURATION_VAR = \"--c-sheet-inset-duration\";\n// The controls column stands 48px left of the sheet. With less room it is not there.\nconst CONTROLS_ROOM = 64;\n\n// A right sheet tells the page, on the root, how far from the right edge it starts, so a floating part of the page\n// can move out of its way with the same timing.\nconst useSheetInset = (\n wrapperRef: React.RefObject<HTMLDivElement>,\n isOn: boolean\n) => {\n useEffect(() => {\n const wrapper = wrapperRef.current;\n\n if (!isOn || !wrapper) {\n return undefined;\n }\n\n const root = document.documentElement;\n const update = () => {\n const { left } = wrapper.getBoundingClientRect();\n\n if (left >= CONTROLS_ROOM) {\n root.style.setProperty(INSET_VAR, `${root.clientWidth - left}px`);\n } else {\n root.style.removeProperty(INSET_VAR);\n }\n };\n const observer =\n typeof ResizeObserver === \"undefined\"\n ? undefined\n : // eslint-disable-next-line compat/compat\n new ResizeObserver(update);\n\n // While the width moves, the edge moves on every frame, so the parts follow it with no timing of their own.\n const isWidth = (event: Event) =>\n (event as TransitionEvent).propertyName === \"max-width\";\n const startWidth = (event: Event) => {\n if (event.target === wrapper && isWidth(event)) {\n root.style.setProperty(INSET_DURATION_VAR, \"0ms\");\n }\n };\n const endWidth = (event: Event) => {\n if (event.target === wrapper && isWidth(event)) {\n root.style.setProperty(INSET_DURATION_VAR, `${SHEET_ENTER_MS}ms`);\n update();\n }\n };\n\n root.style.setProperty(INSET_DURATION_VAR, `${SHEET_ENTER_MS}ms`);\n update();\n observer?.observe(wrapper);\n window.addEventListener(\"resize\", update);\n wrapper.addEventListener(\"transitionrun\", startWidth);\n wrapper.addEventListener(\"transitionend\", endWidth);\n wrapper.addEventListener(\"transitioncancel\", endWidth);\n\n return () => {\n observer?.disconnect();\n window.removeEventListener(\"resize\", update);\n wrapper.removeEventListener(\"transitionrun\", startWidth);\n wrapper.removeEventListener(\"transitionend\", endWidth);\n wrapper.removeEventListener(\"transitioncancel\", endWidth);\n root.style.setProperty(INSET_DURATION_VAR, `${SHEET_EXIT_MS}ms`);\n root.style.removeProperty(INSET_VAR);\n };\n }, [wrapperRef, isOn]);\n};\n\ninterface ControlProps {\n onClick: () => void;\n icon: React.ReactElement;\n tooltip: string;\n disabled: boolean;\n className: string;\n}\n\ninterface ISheet {\n onClose?: () => void;\n controls?: ControlProps[];\n open?: boolean;\n animation?: \"top\" | \"bottom\" | \"left\" | \"right\";\n position?: \"center\" | \"left\" | \"right\";\n mode?: \"normal\" | \"stretch\";\n /** The widest the sheet gets in stretch mode. A number is in pixels. */\n maxWidth?: number | string;\n /** \"sheet\" draws the paper on the sheet surface with large corners. */\n surface?: \"paper\" | \"sheet\";\n disableFocusLock?: boolean;\n disableScrollLock?: boolean;\n disableBackgroundColor?: boolean;\n bodyStyle?: CSSProperties;\n bodyClassName?: string;\n /** A click on the backdrop closes the sheet. On by default. */\n dismissOnBackdropClick?: boolean;\n /** A click on the backdrop that did not close the sheet, because dismissOnBackdropClick is off. */\n onBackdropClickBlocked?: (event: MouseEvent<HTMLDivElement>) => void;\n /** @deprecated Use dismissOnBackdropClick={false}. Still works, with a warning in development, and will be removed. */\n disableBackgroundClick?: boolean;\n}\n\nexport interface SheetMethods {\n close: () => void;\n}\n\ntype SheetProps = ISheet & HTMLAttributes<HTMLDivElement>;\n\nexport const Sheet = forwardRef<SheetMethods, SheetProps>(\n (\n {\n children,\n onClose,\n controls = [],\n open: defaultOpen = false,\n animation = \"top\",\n position = \"center\",\n mode = \"normal\",\n maxWidth,\n surface = \"paper\",\n disableFocusLock = false,\n disableScrollLock = false,\n disableBackgroundColor = false,\n bodyStyle,\n bodyClassName,\n dismissOnBackdropClick,\n onBackdropClickBlocked,\n disableBackgroundClick,\n ...rest\n },\n ref\n ) => {\n const [open, setOpen] = useState(defaultOpen);\n const [exited, setExited] = useState(true);\n // Clicks pass through the overlay until it has faded in, and again from the first moment it fades out. Over a\n // native dialog it takes them all the time, since a click through it would hit the dialog's backdrop.\n const [overlayEntered, setOverlayEntered] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setOpen(defaultOpen);\n }, [defaultOpen]);\n\n const handleEnter = useCallback(() => {\n setExited(false);\n }, []);\n\n const handleExited = useCallback(() => {\n setExited(true);\n onClose?.();\n }, [onClose]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, []);\n\n const handleOverlayEntered = useCallback(() => {\n setOverlayEntered(true);\n }, []);\n\n const handleOverlayExit = useCallback(() => {\n setOverlayEntered(false);\n }, []);\n\n usePropWarning(\n \"Sheet\",\n \"disableBackgroundClick\",\n disableBackgroundClick,\n \"deprecated\",\n \"Use dismissOnBackdropClick={false}.\"\n );\n\n const closesOnBackdropClick =\n dismissOnBackdropClick ?? !disableBackgroundClick;\n\n // Over a native dialog the overlay takes clicks while it fades out too, and a sheet that is closing has nothing\n // left to block.\n const handleBackgroundClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (!open) {\n return;\n }\n\n if (closesOnBackdropClick) {\n event.preventDefault();\n handleClose();\n } else {\n onBackdropClickBlocked?.(event);\n }\n },\n [open, closesOnBackdropClick, handleClose, onBackdropClickBlocked]\n );\n\n useImperativeHandle(ref, () => ({\n close: handleClose,\n }));\n\n const portalContainer = usePortalContainer();\n const { host: modalHost, pending: modalHostPending } =\n useHostAboveOpenModal(open || !exited, portalContainer === undefined);\n\n // A pending sheet renders no wrapper yet, so the inset starts once it does.\n useSheetInset(\n wrapperRef,\n open && position === \"right\" && !modalHostPending\n );\n\n if ((!open && exited) || modalHostPending) {\n return null;\n }\n\n const sheetWindow = (\n <Window\n {...rest}\n // The overlay and the sheet take the clicks, so the window lets them through where the overlay does.\n style={{ ...rest.style, pointerEvents: \"none\" }}\n onClose={handleClose}\n disableFocusLock={disableFocusLock}\n disableScrollLock={disableScrollLock}\n >\n <Fade\n in={open}\n timeout={open ? SHEET_ENTER_MS : SHEET_EXIT_MS}\n onEntered={handleOverlayEntered}\n onExit={handleOverlayExit}\n >\n <Overlay\n onClick={handleBackgroundClick}\n disableBackgroundColor={disableBackgroundColor}\n style={{\n pointerEvents:\n modalHost || (open && overlayEntered) ? \"auto\" : \"none\",\n }}\n />\n </Fade>\n <StyledSheetWrapper\n ref={wrapperRef}\n className={classnames(\"c-sheet__wrapper\", bodyClassName)}\n style={bodyStyle}\n $position={position}\n $mode={mode}\n $maxWidth={maxWidth}\n >\n <StyledCssTransition\n appear\n in={open}\n timeout={SHEET_ENTER_MS}\n classNames=\"c-sheet__animation\"\n $direction={animation}\n onEnter={handleEnter}\n onExited={handleExited}\n >\n <StyledSheetSurface>\n {controls.length > 0 && (\n <StyledSheetIcons>\n {controls.map(\n (\n {\n icon: IconComponent,\n tooltip,\n onClick,\n disabled,\n className,\n },\n index\n ) => (\n <Tooltip\n title={tooltip}\n disable={!tooltip || disabled}\n key={`c-sheet-control-${index}`}\n >\n <StyledAnimatedSpan\n onClick={onClick}\n $disabled={disabled}\n className={className}\n >\n {IconComponent}\n </StyledAnimatedSpan>\n </Tooltip>\n )\n )}\n </StyledSheetIcons>\n )}\n <StyledSheetWrapperPaper\n paperClass=\"c-sheet__wrapper__paper\"\n $surface={surface}\n >\n {controls.length > 0 && (\n <StyledHeader>\n <StyledIconsWrapperSmall>\n {controls.map(\n (\n {\n icon: IconComponent,\n tooltip,\n onClick,\n disabled,\n className,\n },\n index\n ) => (\n <Tooltip\n title={tooltip}\n disable={!tooltip || disabled}\n key={index}\n >\n <IconButton\n onClick={onClick}\n disabled={disabled}\n className={className}\n variant=\"text gray\"\n >\n {IconComponent}\n </IconButton>\n </Tooltip>\n )\n )}\n </StyledIconsWrapperSmall>\n <StyledListSeparator />\n </StyledHeader>\n )}\n {children}\n </StyledSheetWrapperPaper>\n </StyledSheetSurface>\n </StyledCssTransition>\n </StyledSheetWrapper>\n </Window>\n );\n\n // The provider is always there, so the Window keeps its place in the tree when the sheet gets a host.\n return (\n <PortalContainerProvider value={modalHost ?? portalContainer}>\n {sheetWindow}\n </PortalContainerProvider>\n );\n }\n);\n\nSheet.displayName = \"Sheet\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,UAAU,EAEVC,QAAQ,EAGRC,mBAAmB,EACnBC,MAAM,QACD,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,YAAY,EACZC,uBAAuB,EACvBC,mBAAmB,EACnBC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,EACdC,aAAa,EACbC,kBAAkB,EAClBC,uBAAuB,QAClB,UAAU;AACjB,SAASC,uBAAuB,EAAEC,kBAAkB,QAAQ,eAAe;AAC3E,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,OAAO,QAAQ,YAAY;AACpC,SAASC,OAAO,QAAQ,YAAY;AACpC,SAASC,IAAI,QAAQ,gBAA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AAW,GAElBX,aACS,CACL,CAAC;EAAA,CAEd,CACuB,CAAC,eAC1B3I,KAAA,CAAAsH,aAAA,CAAC1G,mBAAmB,MAAE,CACV,CACf,EACAoD,QACsB,CACP,CACD,CACH,CACd,CACT;;EAED;EACA,oBACEhE,KAAA,CAAAsH,aAAA,CAACnG,uBAAuB;IAACoI,KAAK,EAAEtC,SAAS,WAATA,SAAS,GAAIF;EAAgB,GAC1DM,WACsB,CAAC;AAE9B,CACF,CAAC;AAEDxD,KAAK,CAAC2F,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Sheet.js","names":["React","useCallback","useEffect","useLayoutEffect","forwardRef","useState","useImperativeHandle","useRef","classnames","StyledAnimatedSpan","StyledCssTransition","StyledHeader","StyledIconsWrapperSmall","StyledListSeparator","StyledSheetControlGroup","StyledSheetIcons","StyledSheetSideContent","StyledSheetWrapper","SHEET_ENTER_MS","SHEET_EXIT_MS","StyledSheetSurface","StyledSheetWrapperPaper","StyledSheetResizeHandle","PortalContainerProvider","usePortalContainer","useResizablePanel","usePropWarning","IconButton","Overlay","Tooltip","Fade","Window","useHostAboveOpenModal","INSET_VAR","WIDTH_VAR","INSET_DURATION_VAR","CONTROLS_ROOM","writeInset","wrapper","root","document","documentElement","_wrapper$getBoundingC","getBoundingClientRect","left","style","setProperty","clientWidth","removeProperty","useSheetInset","wrapperRef","isOn","isResizing","resizedWidth","current","undefined","update","observer","ResizeObserver","isWidth","event","propertyName","startWidth","target","endWidth","observe","window","addEventListener","disconnect","removeEventListener","useWrapperWidth","_useState","width","setWidth","measure","noResize","groupControls","controls","reduce","runs","control","_last$","last","length","group","push","Sheet","_ref","ref","children","onClose","_ref$controls","sideContent","_ref$open","open","defaultOpen","_ref$animation","animation","_ref$position","position","_ref$mode","mode","maxWidth","_ref$surface","surface","_ref$disableFocusLock","disableFocusLock","_ref$disableScrollLoc","disableScrollLock","_ref$disableBackgroun","disableBackgroundColor","bodyStyle","bodyClassName","dismissOnBackdropClick","onBackdropClickBlocked","disableBackgroundClick","onWidthChange","onWidthReset","_ref$resizeMin","resizeMin","_ref$resizeMax","resizeMax","_ref$resizeLabel","resizeLabel","rest","_objectWithoutPropertiesLoose","_excluded","_useState2","setOpen","_useState3","exited","setExited","_useState4","overlayEntered","setOverlayEntered","handleEnter","handleExited","handleClose","handleOverlayEntered","handleOverlayExit","closesOnBackdropClick","handleBackgroundClick","preventDefault","close","portalContainer","_useHostAboveOpenModa","modalHost","host","modalHostPending","pending","isResizable","Boolean","measuredWidth","_useResizablePanel","side","min","max","onChange","onReset","handleProps","isHandleActive","active","resizeHandleProps","_excluded2","sheetWindow","createElement","_extends","pointerEvents","in","timeout","onEntered","onExit","onClick","className","transition","$position","$mode","$maxWidth","appear","classNames","$direction","onEnter","onExited","map","run","runIndex","items","_ref2","index","IconComponent","icon","tooltip","disabled","title","disable","key","$disabled","paperClass","$surface","_ref3","variant","label","edge","value","displayName"],"sources":["../../../../src/components/Sheet/Sheet.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useLayoutEffect,\n forwardRef,\n HTMLAttributes,\n useState,\n CSSProperties,\n MouseEvent,\n useImperativeHandle,\n useRef,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n StyledAnimatedSpan,\n StyledCssTransition,\n StyledHeader,\n StyledIconsWrapperSmall,\n StyledListSeparator,\n StyledSheetControlGroup,\n StyledSheetIcons,\n StyledSheetSideContent,\n StyledSheetWrapper,\n SHEET_ENTER_MS,\n SHEET_EXIT_MS,\n StyledSheetSurface,\n StyledSheetWrapperPaper,\n StyledSheetResizeHandle,\n} from \"./Styles\";\nimport { PortalContainerProvider, usePortalContainer } from \"../../helpers\";\nimport { useResizablePanel } from \"../../hooks\";\nimport { usePropWarning } from \"../Dialog/usePropWarning\";\nimport { IconButton } from \"../IconButton\";\nimport { Overlay } from \"../Overlay\";\nimport { Tooltip } from \"../Tooltip\";\nimport { Fade } from \"../Transitions\";\nimport { Window } from \"../Window\";\nimport { useHostAboveOpenModal } from \"./useHostAboveOpenModal\";\n\nconst INSET_VAR = \"--c-sheet-inset-right\";\nconst WIDTH_VAR = \"--c-sheet-width\";\nconst INSET_DURATION_VAR = \"--c-sheet-inset-duration\";\n// The controls column stands 48px left of the sheet. With less room it is not there.\nconst CONTROLS_ROOM = 64;\n\nconst writeInset = (wrapper: HTMLDivElement) => {\n const root = document.documentElement;\n const { left } = wrapper.getBoundingClientRect();\n\n if (left >= CONTROLS_ROOM) {\n root.style.setProperty(INSET_VAR, `${root.clientWidth - left}px`);\n } else {\n root.style.removeProperty(INSET_VAR);\n }\n};\n\n// A right sheet tells the page, on the root, how far from the right edge it starts, so a floating part of the page\n// can move out of its way with the same timing.\nconst useSheetInset = (\n wrapperRef: React.RefObject<HTMLDivElement>,\n isOn: boolean,\n isResizing: boolean,\n resizedWidth: number\n) => {\n useEffect(() => {\n const wrapper = wrapperRef.current;\n\n if (!isOn || !wrapper) {\n return undefined;\n }\n\n const root = document.documentElement;\n const update = () => writeInset(wrapper);\n const observer =\n typeof ResizeObserver === \"undefined\"\n ? undefined\n : // eslint-disable-next-line compat/compat\n new ResizeObserver(update);\n\n // While the width moves, the edge moves on every frame, so the parts follow it with no timing of their own.\n const isWidth = (event: Event) =>\n (event as TransitionEvent).propertyName === \"max-width\";\n const startWidth = (event: Event) => {\n if (event.target === wrapper && isWidth(event)) {\n root.style.setProperty(INSET_DURATION_VAR, \"0ms\");\n }\n };\n const endWidth = (event: Event) => {\n if (event.target === wrapper && isWidth(event)) {\n root.style.setProperty(INSET_DURATION_VAR, `${SHEET_ENTER_MS}ms`);\n update();\n }\n };\n\n root.style.setProperty(INSET_DURATION_VAR, `${SHEET_ENTER_MS}ms`);\n update();\n observer?.observe(wrapper);\n window.addEventListener(\"resize\", update);\n wrapper.addEventListener(\"transitionrun\", startWidth);\n wrapper.addEventListener(\"transitionend\", endWidth);\n wrapper.addEventListener(\"transitioncancel\", endWidth);\n\n return () => {\n observer?.disconnect();\n window.removeEventListener(\"resize\", update);\n wrapper.removeEventListener(\"transitionrun\", startWidth);\n wrapper.removeEventListener(\"transitionend\", endWidth);\n wrapper.removeEventListener(\"transitioncancel\", endWidth);\n root.style.setProperty(INSET_DURATION_VAR, `${SHEET_EXIT_MS}ms`);\n root.style.removeProperty(INSET_VAR);\n };\n }, [wrapperRef, isOn]);\n\n // Before the first frame of the drag, so the parts never animate a move of the edge.\n useLayoutEffect(() => {\n if (!isOn || !isResizing) {\n return undefined;\n }\n\n const root = document.documentElement;\n\n root.style.setProperty(INSET_DURATION_VAR, \"0ms\");\n root.style.setProperty(\"cursor\", \"col-resize\");\n\n return () => {\n root.style.setProperty(INSET_DURATION_VAR, `${SHEET_ENTER_MS}ms`);\n root.style.removeProperty(\"cursor\");\n };\n }, [isOn, isResizing]);\n\n // A resize observer reports a frame late, so a drag writes the inset in the commit of its width.\n useLayoutEffect(() => {\n if (isOn && isResizing && wrapperRef.current) {\n writeInset(wrapperRef.current);\n }\n }, [wrapperRef, isOn, isResizing, resizedWidth]);\n};\n\nconst useWrapperWidth = (\n wrapperRef: React.RefObject<HTMLDivElement>,\n isOn: boolean\n) => {\n const [width, setWidth] = useState(0);\n\n useEffect(() => {\n const wrapper = wrapperRef.current;\n\n if (!isOn || !wrapper) {\n return undefined;\n }\n\n const measure = () => setWidth(wrapper.getBoundingClientRect().width);\n const observer =\n typeof ResizeObserver === \"undefined\"\n ? undefined\n : // eslint-disable-next-line compat/compat\n new ResizeObserver(measure);\n\n measure();\n observer?.observe(wrapper);\n\n return () => observer?.disconnect();\n }, [wrapperRef, isOn]);\n\n return width;\n};\n\nconst noResize = () => undefined;\n\ninterface ControlProps {\n onClick: () => void;\n icon: React.ReactElement;\n tooltip: string;\n disabled: boolean;\n className: string;\n /** Controls that follow each other with one group share one capsule in the side column. */\n group?: string;\n}\n\n// The side column as a list of single controls and runs of controls of one group.\nconst groupControls = (controls: ControlProps[]) =>\n controls.reduce<ControlProps[][]>((runs, control) => {\n const last = runs[runs.length - 1];\n\n if (control.group && last?.[0]?.group === control.group) {\n last.push(control);\n } else {\n runs.push([control]);\n }\n\n return runs;\n }, []);\n\ninterface ISheet {\n onClose?: () => void;\n controls?: ControlProps[];\n /** Content under the controls of the side column, such as who is here. It shows only with controls. */\n sideContent?: React.ReactNode;\n open?: boolean;\n animation?: \"top\" | \"bottom\" | \"left\" | \"right\";\n position?: \"center\" | \"left\" | \"right\";\n mode?: \"normal\" | \"stretch\";\n /** The widest the sheet gets in stretch mode. A number is in pixels. */\n maxWidth?: number | string;\n /** \"sheet\" draws the paper on the sheet surface with large corners. */\n surface?: \"paper\" | \"sheet\";\n disableFocusLock?: boolean;\n disableScrollLock?: boolean;\n disableBackgroundColor?: boolean;\n bodyStyle?: CSSProperties;\n bodyClassName?: string;\n /** A click on the backdrop closes the sheet. On by default. */\n dismissOnBackdropClick?: boolean;\n /** A click on the backdrop that did not close the sheet, because dismissOnBackdropClick is off. */\n onBackdropClickBlocked?: (event: MouseEvent<HTMLDivElement>) => void;\n /** @deprecated Use dismissOnBackdropClick={false}. Still works, with a warning in development, and will be removed. */\n disableBackgroundClick?: boolean;\n /** With it a stretch sheet on a side has a resize handle on its free edge. Called with a whole pixel at the end of a drag and on each key press. */\n onWidthChange?: (width: number) => void;\n /** A double click on the resize handle. */\n onWidthReset?: () => void;\n resizeMin?: number;\n resizeMax?: number;\n resizeLabel?: string;\n}\n\nexport interface SheetMethods {\n close: () => void;\n}\n\ntype SheetProps = ISheet & HTMLAttributes<HTMLDivElement>;\n\nexport const Sheet = forwardRef<SheetMethods, SheetProps>(\n (\n {\n children,\n onClose,\n controls = [],\n sideContent,\n open: defaultOpen = false,\n animation = \"top\",\n position = \"center\",\n mode = \"normal\",\n maxWidth,\n surface = \"paper\",\n disableFocusLock = false,\n disableScrollLock = false,\n disableBackgroundColor = false,\n bodyStyle,\n bodyClassName,\n dismissOnBackdropClick,\n onBackdropClickBlocked,\n disableBackgroundClick,\n onWidthChange,\n onWidthReset,\n resizeMin = 600,\n resizeMax = 1800,\n resizeLabel = \"Resize sheet\",\n ...rest\n },\n ref\n ) => {\n const [open, setOpen] = useState(defaultOpen);\n const [exited, setExited] = useState(true);\n // Clicks pass through the overlay until it has faded in, and again from the first moment it fades out. Over a\n // native dialog it takes them all the time, since a click through it would hit the dialog's backdrop.\n const [overlayEntered, setOverlayEntered] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setOpen(defaultOpen);\n }, [defaultOpen]);\n\n const handleEnter = useCallback(() => {\n setExited(false);\n }, []);\n\n const handleExited = useCallback(() => {\n setExited(true);\n onClose?.();\n }, [onClose]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, []);\n\n const handleOverlayEntered = useCallback(() => {\n setOverlayEntered(true);\n }, []);\n\n const handleOverlayExit = useCallback(() => {\n setOverlayEntered(false);\n }, []);\n\n usePropWarning(\n \"Sheet\",\n \"disableBackgroundClick\",\n disableBackgroundClick,\n \"deprecated\",\n \"Use dismissOnBackdropClick={false}.\"\n );\n\n const closesOnBackdropClick =\n dismissOnBackdropClick ?? !disableBackgroundClick;\n\n // Over a native dialog the overlay takes clicks while it fades out too, and a sheet that is closing has nothing\n // left to block.\n const handleBackgroundClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (!open) {\n return;\n }\n\n if (closesOnBackdropClick) {\n event.preventDefault();\n handleClose();\n } else {\n onBackdropClickBlocked?.(event);\n }\n },\n [open, closesOnBackdropClick, handleClose, onBackdropClickBlocked]\n );\n\n useImperativeHandle(ref, () => ({\n close: handleClose,\n }));\n\n const portalContainer = usePortalContainer();\n const { host: modalHost, pending: modalHostPending } =\n useHostAboveOpenModal(open || !exited, portalContainer === undefined);\n\n const isResizable =\n Boolean(onWidthChange) && mode === \"stretch\" && position !== \"center\";\n const measuredWidth = useWrapperWidth(\n wrapperRef,\n isResizable && open && !modalHostPending\n );\n const {\n width: resizedWidth,\n isResizing,\n handleProps,\n } = useResizablePanel({\n side: position === \"left\" ? \"left\" : \"right\",\n width: measuredWidth,\n min: resizeMin,\n max: resizeMax,\n onChange: onWidthChange ?? noResize,\n onReset: onWidthReset,\n });\n const { active: isHandleActive, ...resizeHandleProps } = handleProps;\n\n // A pending sheet renders no wrapper yet, so the inset starts once it does.\n useSheetInset(\n wrapperRef,\n open && position === \"right\" && !modalHostPending,\n isResizing,\n resizedWidth\n );\n\n if ((!open && exited) || modalHostPending) {\n return null;\n }\n\n const sheetWindow = (\n <Window\n {...rest}\n // The overlay and the sheet take the clicks, so the window lets them through where the overlay does.\n style={{ ...rest.style, pointerEvents: \"none\" }}\n onClose={handleClose}\n disableFocusLock={disableFocusLock}\n disableScrollLock={disableScrollLock}\n >\n <Fade\n in={open}\n timeout={open ? SHEET_ENTER_MS : SHEET_EXIT_MS}\n onEntered={handleOverlayEntered}\n onExit={handleOverlayExit}\n >\n <Overlay\n onClick={handleBackgroundClick}\n disableBackgroundColor={disableBackgroundColor}\n style={{\n pointerEvents:\n modalHost || (open && overlayEntered) ? \"auto\" : \"none\",\n }}\n />\n </Fade>\n <StyledSheetWrapper\n ref={wrapperRef}\n className={classnames(\"c-sheet__wrapper\", bodyClassName)}\n style={\n isResizing\n ? ({\n ...bodyStyle,\n maxWidth: `${resizedWidth}px`,\n transition: \"none\",\n [WIDTH_VAR]: `${resizedWidth}px`,\n } as CSSProperties)\n : bodyStyle\n }\n $position={position}\n $mode={mode}\n $maxWidth={maxWidth}\n >\n <StyledCssTransition\n appear\n in={open}\n timeout={SHEET_ENTER_MS}\n classNames=\"c-sheet__animation\"\n $direction={animation}\n onEnter={handleEnter}\n onExited={handleExited}\n >\n <StyledSheetSurface>\n {controls.length > 0 && (\n <StyledSheetIcons>\n {groupControls(controls).map((run, runIndex) => {\n const items = run.map(\n (\n {\n icon: IconComponent,\n tooltip,\n onClick,\n disabled,\n className,\n },\n index\n ) => (\n <Tooltip\n title={tooltip}\n disable={!tooltip || disabled}\n key={`c-sheet-control-${runIndex}-${index}`}\n >\n <StyledAnimatedSpan\n onClick={onClick}\n $disabled={disabled}\n className={className}\n >\n {IconComponent}\n </StyledAnimatedSpan>\n </Tooltip>\n )\n );\n\n return run[0].group ? (\n <StyledSheetControlGroup\n key={`c-sheet-group-${runIndex}`}\n className={classnames(\n \"c-sheet__control-group\",\n run[0].className\n )}\n >\n {items}\n </StyledSheetControlGroup>\n ) : (\n items\n );\n })}\n {sideContent ? (\n <StyledSheetSideContent className=\"c-sheet__side-content\">\n {sideContent}\n </StyledSheetSideContent>\n ) : null}\n </StyledSheetIcons>\n )}\n <StyledSheetWrapperPaper\n paperClass=\"c-sheet__wrapper__paper\"\n $surface={surface}\n >\n {controls.length > 0 && (\n <StyledHeader>\n <StyledIconsWrapperSmall>\n {controls.map(\n (\n {\n icon: IconComponent,\n tooltip,\n onClick,\n disabled,\n className,\n },\n index\n ) => (\n <Tooltip\n title={tooltip}\n disable={!tooltip || disabled}\n key={index}\n >\n <IconButton\n onClick={onClick}\n disabled={disabled}\n className={className}\n variant=\"text gray\"\n >\n {IconComponent}\n </IconButton>\n </Tooltip>\n )\n )}\n </StyledIconsWrapperSmall>\n <StyledListSeparator />\n </StyledHeader>\n )}\n {children}\n </StyledSheetWrapperPaper>\n {isResizable ? (\n <StyledSheetResizeHandle\n {...resizeHandleProps}\n active={isHandleActive}\n label={resizeLabel}\n edge={position === \"left\" ? \"right\" : \"left\"}\n className={`c-sheet__resize c-sheet__resize--${\n position === \"left\" ? \"right\" : \"left\"\n }`}\n />\n ) : null}\n </StyledSheetSurface>\n </StyledCssTransition>\n </StyledSheetWrapper>\n </Window>\n );\n\n // The provider is always there, so the Window keeps its place in the tree when the sheet gets a host.\n return (\n <PortalContainerProvider value={modalHost ?? portalContainer}>\n {sheetWindow}\n </PortalContainerProvider>\n );\n }\n);\n\nSheet.displayName = \"Sheet\";\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,UAAU,EAEVC,QAAQ,EAGRC,mBAA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AI,EAAEvG,QAAQ,KAAK,MAAM,GAAG,OAAO,GAAG,MAAO;IAC7C0E,SAAS,yCACP1E,QAAQ,KAAK,MAAM,GAAG,OAAO,GAAG,MAAM;EACrC,EACJ,CAAC,GACA,IACc,CACD,CACH,CACd,CACT;;EAED;EACA,oBACEnG,KAAA,CAAAqK,aAAA,CAAC9I,uBAAuB;IAACoL,KAAK,EAAEzD,SAAS,WAATA,SAAS,GAAIF;EAAgB,GAC1DoB,WACsB,CAAC;AAE9B,CACF,CAAC;AAED9E,KAAK,CAACsH,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CSSTransition } from "react-transition-group";
|
|
2
2
|
export declare const SHEET_ENTER_MS = 400;
|
|
3
3
|
export declare const SHEET_EXIT_MS = 200;
|
|
4
|
+
export declare const StyledSheetControlGroup: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
5
|
+
export declare const StyledSheetSideContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
6
|
export declare const StyledSheetIcons: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
7
|
interface IStyledSheetWrapper {
|
|
6
8
|
$position?: "center" | "left" | "right";
|
|
@@ -13,6 +15,7 @@ interface IStyledSheetWrapperPaper {
|
|
|
13
15
|
$surface?: "paper" | "sheet";
|
|
14
16
|
}
|
|
15
17
|
export declare const StyledSheetSurface: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const StyledSheetResizeHandle: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").IResizeHandleProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
16
19
|
export declare const StyledSheetWrapperPaper: import("styled-components").StyledComponent<"div", any, IStyledSheetWrapperPaper, never>;
|
|
17
20
|
interface IStyledAnimatedSpan {
|
|
18
21
|
$disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Sheet/Styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Sheet/Styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAUvD,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,aAAa,MAAM,CAAC;AAGjC,eAAO,MAAM,uBAAuB,qEAcnC,CAAC;AAKF,eAAO,MAAM,sBAAsB,oEAQlC,CAAC;AAIF,eAAO,MAAM,gBAAgB,oEA4B5B,CAAC;AAIF,UAAU,mBAAmB;IAC3B,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACxC,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAKD,eAAO,MAAM,kBAAkB,qFA0G9B,CAAC;AAIF,UAAU,wBAAwB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,oEAS9B,CAAC;AAKF,eAAO,MAAM,uBAAuB,yLAQnC,CAAC;AAIF,eAAO,MAAM,uBAAuB,0FA6BnC,CAAC;AAIF,UAAU,mBAAmB;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,sFAc9B,CAAC;AAIF,eAAO,MAAM,mBAAmB;gBAClB,MAAM;SA6HnB,CAAC;AAIF,eAAO,MAAM,mBAAmB;;;kBAE/B,CAAC;AAIF,eAAO,MAAM,uBAAuB,oEASnC,CAAC;AAIF,eAAO,MAAM,YAAY,oEAIxB,CAAC"}
|
|
@@ -3,20 +3,35 @@ import styled, { css } from "styled-components";
|
|
|
3
3
|
import { BoxSizingStyle } from "../BoxSizingStyle";
|
|
4
4
|
import { FontStyle } from "../FontStyle";
|
|
5
5
|
import { ListSeparator } from "../List";
|
|
6
|
+
import { ResizeHandle } from "../ResizeHandle";
|
|
6
7
|
export const SHEET_ENTER_MS = 400;
|
|
7
8
|
export const SHEET_EXIT_MS = 200;
|
|
9
|
+
|
|
10
|
+
// One capsule for the controls of one group, in place of a circle for each. Its controls lose their own circle.
|
|
11
|
+
export const StyledSheetControlGroup = styled.span.withConfig({
|
|
12
|
+
displayName: "Styles__StyledSheetControlGroup",
|
|
13
|
+
componentId: "sc-144eyxd-0"
|
|
14
|
+
})(["&&&{flex-direction:column;height:auto;border-radius:20px;}&&& > span{top:0;right:0;padding:0;box-shadow:none;background-color:transparent;}"]);
|
|
15
|
+
StyledSheetControlGroup.displayName = "StyledSheetControlGroup";
|
|
16
|
+
|
|
17
|
+
// Free content under the controls, out of the reach of their circle styles.
|
|
18
|
+
export const StyledSheetSideContent = styled.div.withConfig({
|
|
19
|
+
displayName: "Styles__StyledSheetSideContent",
|
|
20
|
+
componentId: "sc-144eyxd-1"
|
|
21
|
+
})(["order:100;position:relative;display:flex;flex-direction:column;align-items:center;width:40px;"]);
|
|
22
|
+
StyledSheetSideContent.displayName = "StyledSheetSideContent";
|
|
8
23
|
export const StyledSheetIcons = styled.div.withConfig({
|
|
9
24
|
displayName: "Styles__StyledSheetIcons",
|
|
10
|
-
componentId: "sc-144eyxd-
|
|
11
|
-
})(["display:flex;height:0;position:relative
|
|
25
|
+
componentId: "sc-144eyxd-2"
|
|
26
|
+
})(["display:flex;height:0;position:relative;> span,> ", " > span{position:relative;background-color:var(--page-paper-main);box-shadow:var(--shadow-secondary);cursor:pointer;border-radius:100%;width:40px;height:40px;display:flex;justify-content:center;align-items:center;& > *{height:40px;width:40px;padding:8px;fill:var(--color-theme-600);}}@media (max-width:640px){display:none;}"], StyledSheetControlGroup);
|
|
12
27
|
StyledSheetIcons.displayName = "StyledSheetIcons";
|
|
13
28
|
const toCssSize = value => typeof value === "number" ? value + "px" : value;
|
|
14
29
|
export const StyledSheetWrapper = styled.div.withConfig({
|
|
15
30
|
displayName: "Styles__StyledSheetWrapper",
|
|
16
|
-
componentId: "sc-144eyxd-
|
|
31
|
+
componentId: "sc-144eyxd-3"
|
|
17
32
|
})(["", " ", " position:relative;max-width:95vw;display:flex;flex-direction:row;", " ", " ", " ", " ", " ", " ", ""], BoxSizingStyle, FontStyle, props => {
|
|
18
33
|
var _props$$maxWidth;
|
|
19
|
-
return props.$mode === "stretch" ? css(["margin-top:8px;height:calc(100vh - 16px);width:calc(100vw - 100px);max-width:", ";transition:max-width ", "ms ease;@media (prefers-reduced-motion:reduce){transition:none;}", "{flex-direction:column;width:0;height:calc(100vh - 32px);& > *{margin-bottom:8px;}span{top:8px;}}"], toCssSize((_props$$maxWidth = props.$maxWidth) != null ? _props$$maxWidth : 1000), SHEET_ENTER_MS, StyledSheetIcons) : css(["max-height:calc(100vh - 156px);margin-top:126px;margin-bottom:30px;width:540px;flex-direction:column;", "{flex-direction:row-reverse;& > *{margin-left:8px;}span{top:-48px;right:8px;}}"], StyledSheetIcons);
|
|
34
|
+
return props.$mode === "stretch" ? css(["margin-top:8px;height:calc(100vh - 16px);width:calc(100vw - 100px);max-width:", ";transition:max-width ", "ms ease;@media (prefers-reduced-motion:reduce){transition:none;}", "{flex-direction:column;width:0;height:calc(100vh - 32px);& > *{margin-bottom:8px;}> span,> .c-sheet__side-content{top:8px;}}"], toCssSize((_props$$maxWidth = props.$maxWidth) != null ? _props$$maxWidth : 1000), SHEET_ENTER_MS, StyledSheetIcons) : css(["max-height:calc(100vh - 156px);margin-top:126px;margin-bottom:30px;width:540px;flex-direction:column;", "{flex-direction:row-reverse;& > *{margin-left:8px;}> span,> .c-sheet__side-content{top:-48px;right:8px;}}"], StyledSheetIcons);
|
|
20
35
|
}, props => props.$mode === "stretch" && css(["@media (max-width:640px){width:100%;height:100%;}"]), props => props.$position === "center" && css(["", ""], {
|
|
21
36
|
"marginLeft": "auto",
|
|
22
37
|
"marginRight": "auto"
|
|
@@ -26,45 +41,52 @@ export const StyledSheetWrapper = styled.div.withConfig({
|
|
|
26
41
|
}), props => props.$position === "right" && css(["", ""], {
|
|
27
42
|
"marginLeft": "auto",
|
|
28
43
|
"marginRight": "0.5rem"
|
|
29
|
-
}), props => props.$mode === "stretch" && props.$position !== "left" && css(["", "{span{right:48px;}}"], StyledSheetIcons), props => props.$mode === "stretch" && props.$position === "left" && css(["flex-direction:row-reverse;", "{span{right:-8px;}}"], StyledSheetIcons));
|
|
44
|
+
}), props => props.$mode === "stretch" && props.$position !== "left" && css(["", "{> span,> .c-sheet__side-content{right:48px;}}"], StyledSheetIcons), props => props.$mode === "stretch" && props.$position === "left" && css(["flex-direction:row-reverse;", "{> span,> .c-sheet__side-content{right:-8px;}}"], StyledSheetIcons));
|
|
30
45
|
StyledSheetWrapper.displayName = "StyledSheetWrapper";
|
|
31
46
|
export const StyledSheetSurface = styled.div.withConfig({
|
|
32
47
|
displayName: "Styles__StyledSheetSurface",
|
|
33
|
-
componentId: "sc-144eyxd-
|
|
34
|
-
})(["pointer-events:auto;display:flex;flex-direction:inherit;flex:1 1 auto;min-width:0;min-height:0;"]);
|
|
48
|
+
componentId: "sc-144eyxd-4"
|
|
49
|
+
})(["pointer-events:auto;position:relative;display:flex;flex-direction:inherit;flex:1 1 auto;min-width:0;min-height:0;"]);
|
|
35
50
|
StyledSheetSurface.displayName = "StyledSheetSurface";
|
|
51
|
+
|
|
52
|
+
/* The line stops short of the large corners of the paper. */
|
|
53
|
+
export const StyledSheetResizeHandle = styled(ResizeHandle).withConfig({
|
|
54
|
+
displayName: "Styles__StyledSheetResizeHandle",
|
|
55
|
+
componentId: "sc-144eyxd-5"
|
|
56
|
+
})(["top:24px;bottom:24px;z-index:1;@media (max-width:640px){display:none;}"]);
|
|
57
|
+
StyledSheetResizeHandle.displayName = "StyledSheetResizeHandle";
|
|
36
58
|
export const StyledSheetWrapperPaper = styled.div.attrs(props => ({
|
|
37
59
|
className: props.paperClass
|
|
38
60
|
})).withConfig({
|
|
39
61
|
displayName: "Styles__StyledSheetWrapperPaper",
|
|
40
|
-
componentId: "sc-144eyxd-
|
|
62
|
+
componentId: "sc-144eyxd-6"
|
|
41
63
|
})(["background-color:var(--page-paper-main);color:var(--color-theme-900);box-shadow:var(--shadow-primary);border-radius:6px;overflow:auto;animation:0.3s linear ease-out;transform:translateZ(0);contain:paint;overscroll-behavior:none;", " ", ""], props => props.$surface === "sheet" && css(["background-color:var(--surface-sheet);box-shadow:var(--surface-sheet-shadow,var(--shadow-primary));@media (min-width:641px){border-radius:24px;}"]), {
|
|
42
64
|
"flex": "1 1 auto"
|
|
43
65
|
});
|
|
44
66
|
StyledSheetWrapperPaper.displayName = "StyledSheetWrapperPaper";
|
|
45
67
|
export const StyledAnimatedSpan = styled.span.withConfig({
|
|
46
68
|
displayName: "Styles__StyledAnimatedSpan",
|
|
47
|
-
componentId: "sc-144eyxd-
|
|
69
|
+
componentId: "sc-144eyxd-7"
|
|
48
70
|
})(["&:hover svg{fill:var(--color-primary);}", ""], props => props.$disabled && css(["pointer-events:none;svg{opacity:0.5;}"]));
|
|
49
71
|
StyledAnimatedSpan.displayName = "StyledAnimatedSpan";
|
|
50
72
|
export const StyledCssTransition = styled(CSSTransition).withConfig({
|
|
51
73
|
displayName: "Styles__StyledCssTransition",
|
|
52
|
-
componentId: "sc-144eyxd-
|
|
74
|
+
componentId: "sc-144eyxd-8"
|
|
53
75
|
})(["", " ", " ", " ", ""], props => props.$direction === "top" && css(["&.c-sheet__animation-enter{opacity:0;transform:translateY(-100%);}&.c-sheet__animation-enter-active{opacity:1;transform:translateY(0);transition:opacity ", "ms,transform ", "ms;}&.c-sheet__animation-appear{opacity:0;transform:translateY(-100%);}&.c-sheet__animation-appear-active{opacity:1;transform:translateY(0);transition:opacity ", "ms,transform ", "ms;}&.c-sheet__animation-exit{opacity:1;}&.c-sheet__animation-exit-active{opacity:0;transform:translateY(-100%);transition:opacity ", "ms,transform ", "ms;}"], SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_EXIT_MS, SHEET_EXIT_MS), props => props.$direction === "bottom" && css(["&.c-sheet__animation-enter{opacity:0;transform:translateY(100%);}&.c-sheet__animation-enter-active{opacity:1;transform:translateY(0);transition:opacity ", "ms,transform ", "ms;}&.c-sheet__animation-appear{opacity:0;transform:translateY(100%);}&.c-sheet__animation-appear-active{opacity:1;transform:translateY(0);transition:opacity ", "ms,transform ", "ms;}&.c-sheet__animation-exit{opacity:1;}&.c-sheet__animation-exit-active{opacity:0;transform:translateY(100%);transition:opacity ", "ms,transform ", "ms;}"], SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_EXIT_MS, SHEET_EXIT_MS), props => props.$direction === "left" && css(["&.c-sheet__animation-enter{opacity:0;transform:translateX(-100%);}&.c-sheet__animation-enter-active{opacity:1;transform:translateX(0);transition:opacity ", "ms,transform ", "ms;}&.c-sheet__animation-appear{opacity:0;transform:translateX(-100%);}&.c-sheet__animation-appear-active{opacity:1;transform:translateX(0);transition:opacity ", "ms,transform ", "ms;}&.c-sheet__animation-exit{opacity:1;}&.c-sheet__animation-exit-active{opacity:0;transform:translateX(-100%);transition:opacity ", "ms,transform ", "ms;}"], SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_EXIT_MS, SHEET_EXIT_MS), props => props.$direction === "right" && css(["&.c-sheet__animation-enter{opacity:0;transform:translateX(100%);}&.c-sheet__animation-enter-active{opacity:1;transform:translateX(0);transition:opacity ", "ms,transform ", "ms;}&.c-sheet__animation-appear{opacity:0;transform:translateX(100%);}&.c-sheet__animation-appear-active{opacity:1;transform:translateX(0);transition:opacity ", "ms,transform ", "ms;}&.c-sheet__animation-exit{opacity:1;}&.c-sheet__animation-exit-active{opacity:0;transform:translateX(100%);transition:opacity ", "ms,transform ", "ms;}"], SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_ENTER_MS, SHEET_EXIT_MS, SHEET_EXIT_MS));
|
|
54
76
|
StyledCssTransition.displayName = "StyledCssTransition";
|
|
55
77
|
export const StyledListSeparator = styled(ListSeparator).withConfig({
|
|
56
78
|
displayName: "Styles__StyledListSeparator",
|
|
57
|
-
componentId: "sc-144eyxd-
|
|
79
|
+
componentId: "sc-144eyxd-9"
|
|
58
80
|
})(["margin:0;"]);
|
|
59
81
|
StyledListSeparator.displayName = "StyledListSeparator";
|
|
60
82
|
export const StyledIconsWrapperSmall = styled.div.withConfig({
|
|
61
83
|
displayName: "Styles__StyledIconsWrapperSmall",
|
|
62
|
-
componentId: "sc-144eyxd-
|
|
84
|
+
componentId: "sc-144eyxd-10"
|
|
63
85
|
})(["height:40px;display:flex;gap:8px;padding-left:16px;padding-right:16px;align-items:center;place-content:end;flex-direction:row-reverse;"]);
|
|
64
86
|
StyledIconsWrapperSmall.displayName = "StyledIconsWrapperSmall";
|
|
65
87
|
export const StyledHeader = styled.div.withConfig({
|
|
66
88
|
displayName: "Styles__StyledHeader",
|
|
67
|
-
componentId: "sc-144eyxd-
|
|
89
|
+
componentId: "sc-144eyxd-11"
|
|
68
90
|
})(["@media (min-width:640px){display:none;}"]);
|
|
69
91
|
StyledHeader.displayName = "StyledHeader";
|
|
70
92
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["CSSTransition","styled","css","BoxSizingStyle","FontStyle","ListSeparator","SHEET_ENTER_MS","SHEET_EXIT_MS","StyledSheetIcons","div","withConfig","displayName","componentId","toCssSize","value","StyledSheetWrapper","props","_props$$maxWidth","$mode","$maxWidth","$position","StyledSheetSurface","StyledSheetWrapperPaper","attrs","className","paperClass","$surface","StyledAnimatedSpan","span","$disabled","StyledCssTransition","$direction","StyledListSeparator","StyledIconsWrapperSmall","StyledHeader"],"sources":["../../../../src/components/Sheet/Styles.ts"],"sourcesContent":["import { CSSTransition } from \"react-transition-group\";\n\nimport styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\nimport { ListSeparator } from \"../List\";\n\nexport const SHEET_ENTER_MS = 400;\nexport const SHEET_EXIT_MS = 200;\n\nexport const StyledSheetIcons = styled.div`\n display: flex;\n height: 0;\n position: relative;\n\n span {\n position: relative;\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-secondary);\n cursor: pointer;\n border-radius: 100%;\n width: 40px;\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n & > * {\n height: 40px;\n width: 40px;\n padding: 8px;\n fill: var(--color-theme-600);\n }\n }\n\n @media (max-width: 640px) {\n display: none;\n }\n`;\n\nStyledSheetIcons.displayName = \"StyledSheetIcons\";\n\ninterface IStyledSheetWrapper {\n $position?: \"center\" | \"left\" | \"right\";\n $mode?: \"normal\" | \"stretch\";\n $maxWidth?: number | string;\n}\n\nconst toCssSize = (value: number | string) =>\n typeof value === \"number\" ? `${value}px` : value;\n\nexport const StyledSheetWrapper = styled.div<IStyledSheetWrapper>`\n ${BoxSizingStyle}\n ${FontStyle}\n\n position: relative;\n max-width: 95vw;\n display: flex;\n flex-direction: row;\n\n ${(props) =>\n props.$mode === \"stretch\"\n ? css`\n margin-top: 8px;\n height: calc(100vh - 16px);\n width: calc(100vw - 100px);\n max-width: ${toCssSize(props.$maxWidth ?? 1000)};\n transition: max-width ${SHEET_ENTER_MS}ms ease;\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n ${StyledSheetIcons} {\n flex-direction: column;\n width: 0;\n height: calc(100vh - 32px);\n & > * {\n margin-bottom: 8px;\n }\n span {\n top: 8px;\n }\n }\n `\n : css`\n max-height: calc(100vh - 156px);\n margin-top: 126px;\n margin-bottom: 30px;\n width: 540px;\n flex-direction: column;\n\n ${StyledSheetIcons} {\n flex-direction: row-reverse;\n & > * {\n margin-left: 8px;\n }\n span {\n top: -48px;\n right: 8px;\n }\n }\n `}\n\n ${(props) =>\n props.$mode === \"stretch\" &&\n css`\n @media (max-width: 640px) {\n width: 100%;\n height: 100%;\n }\n `}\n\n ${(props) =>\n props.$position === \"center\" &&\n css`\n ${tw`tw-mx-auto`}\n `}\n\n ${(props) =>\n props.$position === \"left\" &&\n css`\n ${tw`tw-ml-2 tw-mr-auto`}\n `}\n\n ${(props) =>\n props.$position === \"right\" &&\n css`\n ${tw`tw-mr-2 tw-ml-auto`}\n `}\n\n ${(props) =>\n props.$mode === \"stretch\" &&\n props.$position !== \"left\" &&\n css`\n ${StyledSheetIcons} {\n span {\n right: 48px;\n }\n }\n `}\n\n ${(props) =>\n props.$mode === \"stretch\" &&\n props.$position === \"left\" &&\n css`\n flex-direction: row-reverse;\n\n ${StyledSheetIcons} {\n span {\n right: -8px;\n }\n }\n `}\n`;\n\nStyledSheetWrapper.displayName = \"StyledSheetWrapper\";\n\ninterface IStyledSheetWrapperPaper {\n paperClass?: string;\n $surface?: \"paper\" | \"sheet\";\n}\n\nexport const StyledSheetSurface = styled.div`\n /* The surface slides in, so the pointer follows it and not the still wrapper around it. */\n pointer-events: auto;\n display: flex;\n flex-direction: inherit;\n flex: 1 1 auto;\n min-width: 0;\n min-height: 0;\n`;\n\nStyledSheetSurface.displayName = \"StyledSheetSurface\";\n\nexport const StyledSheetWrapperPaper = styled.div.attrs<IStyledSheetWrapperPaper>(\n (props) => ({\n className: props.paperClass,\n })\n)<IStyledSheetWrapperPaper>`\n background-color: var(--page-paper-main);\n color: var(--color-theme-900);\n box-shadow: var(--shadow-primary);\n border-radius: 6px;\n overflow: auto;\n animation: 0.3s linear ease-out;\n /* Scrolling here must not dirty the blurred overlays below, which already clip to this box. */\n transform: translateZ(0);\n contain: paint;\n /* A scroll that runs off the end must stop here, with no bounce. Chained or bounced, it moves what the blur samples. */\n overscroll-behavior: none;\n\n ${(props) =>\n props.$surface === \"sheet\" &&\n css`\n background-color: var(--surface-sheet);\n box-shadow: var(--surface-sheet-shadow, var(--shadow-primary));\n\n @media (min-width: 641px) {\n border-radius: 24px;\n }\n `}\n\n ${tw`tw-flex-auto`}\n`;\n\nStyledSheetWrapperPaper.displayName = \"StyledSheetWrapperPaper\";\n\ninterface IStyledAnimatedSpan {\n $disabled?: boolean;\n}\n\nexport const StyledAnimatedSpan = styled.span<IStyledAnimatedSpan>`\n &:hover svg {\n fill: var(--color-primary);\n }\n\n ${(props) =>\n props.$disabled &&\n css`\n pointer-events: none;\n\n svg {\n opacity: 0.5;\n }\n `}\n`;\n\nStyledAnimatedSpan.displayName = \"StyledAnimatedSpan\";\n\nexport const StyledCssTransition = styled(CSSTransition)<{\n $direction: string;\n}>`\n ${(props) =>\n props.$direction === \"top\" &&\n css`\n &.c-sheet__animation-enter {\n opacity: 0;\n transform: translateY(-100%);\n }\n &.c-sheet__animation-enter-active {\n opacity: 1;\n transform: translateY(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-appear {\n opacity: 0;\n transform: translateY(-100%);\n }\n &.c-sheet__animation-appear-active {\n opacity: 1;\n transform: translateY(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-exit {\n opacity: 1;\n }\n &.c-sheet__animation-exit-active {\n opacity: 0;\n transform: translateY(-100%);\n transition: opacity ${SHEET_EXIT_MS}ms, transform ${SHEET_EXIT_MS}ms;\n }\n `}\n\n ${(props) =>\n props.$direction === \"bottom\" &&\n css`\n &.c-sheet__animation-enter {\n opacity: 0;\n transform: translateY(100%);\n }\n &.c-sheet__animation-enter-active {\n opacity: 1;\n transform: translateY(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-appear {\n opacity: 0;\n transform: translateY(100%);\n }\n &.c-sheet__animation-appear-active {\n opacity: 1;\n transform: translateY(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-exit {\n opacity: 1;\n }\n &.c-sheet__animation-exit-active {\n opacity: 0;\n transform: translateY(100%);\n transition: opacity ${SHEET_EXIT_MS}ms, transform ${SHEET_EXIT_MS}ms;\n }\n `}\n\n ${(props) =>\n props.$direction === \"left\" &&\n css`\n &.c-sheet__animation-enter {\n opacity: 0;\n transform: translateX(-100%);\n }\n &.c-sheet__animation-enter-active {\n opacity: 1;\n transform: translateX(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-appear {\n opacity: 0;\n transform: translateX(-100%);\n }\n &.c-sheet__animation-appear-active {\n opacity: 1;\n transform: translateX(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-exit {\n opacity: 1;\n }\n &.c-sheet__animation-exit-active {\n opacity: 0;\n transform: translateX(-100%);\n transition: opacity ${SHEET_EXIT_MS}ms, transform ${SHEET_EXIT_MS}ms;\n }\n `}\n\n ${(props) =>\n props.$direction === \"right\" &&\n css`\n &.c-sheet__animation-enter {\n opacity: 0;\n transform: translateX(100%);\n }\n &.c-sheet__animation-enter-active {\n opacity: 1;\n transform: translateX(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-appear {\n opacity: 0;\n transform: translateX(100%);\n }\n &.c-sheet__animation-appear-active {\n opacity: 1;\n transform: translateX(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-exit {\n opacity: 1;\n }\n &.c-sheet__animation-exit-active {\n opacity: 0;\n transform: translateX(100%);\n transition: opacity ${SHEET_EXIT_MS}ms, transform ${SHEET_EXIT_MS}ms;\n }\n `}\n`;\n\nStyledCssTransition.displayName = \"StyledCssTransition\";\n\nexport const StyledListSeparator = styled(ListSeparator)`\n margin: 0;\n`;\n\nStyledListSeparator.displayName = \"StyledListSeparator\";\n\nexport const StyledIconsWrapperSmall = styled.div`\n height: 40px;\n display: flex;\n gap: 8px;\n padding-left: 16px;\n padding-right: 16px;\n align-items: center;\n place-content: end;\n flex-direction: row-reverse;\n`;\n\nStyledIconsWrapperSmall.displayName = \"StyledIconsWrapperSmall\";\n\nexport const StyledHeader = styled.div`\n @media (min-width: 640px) {\n display: none;\n }\n`;\n\nStyledHeader.displayName = \"StyledHeader\";\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,wBAAwB;AAEtD,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,aAAa,QAAQ,SAAS;AAEvC,OAAO,MAAMC,cAAc,GAAG,GAAG;AACjC,OAAO,MAAMC,aAAa,GAAG,GAAG;AAEhC,OAAO,MAAMC,gBAAgB,GAAGP,MAAM,CAACQ,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gXA2BzC;AAEDJ,gBAAgB,CAACG,WAAW,GAAG,kBAAkB;AAQjD,MAAME,SAAS,GAAIC,KAAsB,IACvC,OAAOA,KAAK,KAAK,QAAQ,GAAMA,KAAK,UAAOA,KAAK;AAElD,OAAO,MAAMC,kBAAkB,GAAGd,MAAM,CAACQ,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,sHACxCT,cAAc,EACdC,SAAS,EAORY,KAAK;EAAA,IAAAC,gBAAA;EAAA,OACND,KAAK,CAACE,KAAK,KAAK,SAAS,GACrBhB,GAAG,uRAIYW,SAAS,EAAAI,gBAAA,GAACD,KAAK,CAACG,SAAS,YAAAF,gBAAA,GAAI,IAAI,CAAC,EACvBX,cAAc,EAKpCE,gBAAgB,IAYpBN,GAAG,8LAOCM,gBAAgB,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AAAA,8IAShD;AAEDqB,uBAAuB,CAACtB,WAAW,GAAG,yBAAyB;AAE/D,OAAO,MAAMuB,YAAY,GAAGjC,MAAM,CAACQ,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+CAIrC;AAEDsB,YAAY,CAACvB,WAAW,GAAG,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["CSSTransition","styled","css","BoxSizingStyle","FontStyle","ListSeparator","ResizeHandle","SHEET_ENTER_MS","SHEET_EXIT_MS","StyledSheetControlGroup","span","withConfig","displayName","componentId","StyledSheetSideContent","div","StyledSheetIcons","toCssSize","value","StyledSheetWrapper","props","_props$$maxWidth","$mode","$maxWidth","$position","StyledSheetSurface","StyledSheetResizeHandle","StyledSheetWrapperPaper","attrs","className","paperClass","$surface","StyledAnimatedSpan","$disabled","StyledCssTransition","$direction","StyledListSeparator","StyledIconsWrapperSmall","StyledHeader"],"sources":["../../../../src/components/Sheet/Styles.ts"],"sourcesContent":["import { CSSTransition } from \"react-transition-group\";\n\nimport styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\nimport { ListSeparator } from \"../List\";\nimport { ResizeHandle } from \"../ResizeHandle\";\n\nexport const SHEET_ENTER_MS = 400;\nexport const SHEET_EXIT_MS = 200;\n\n// One capsule for the controls of one group, in place of a circle for each. Its controls lose their own circle.\nexport const StyledSheetControlGroup = styled.span`\n &&& {\n flex-direction: column;\n height: auto;\n border-radius: 20px;\n }\n\n &&& > span {\n top: 0;\n right: 0;\n padding: 0;\n box-shadow: none;\n background-color: transparent;\n }\n`;\n\nStyledSheetControlGroup.displayName = \"StyledSheetControlGroup\";\n\n// Free content under the controls, out of the reach of their circle styles.\nexport const StyledSheetSideContent = styled.div`\n /* After the controls, also when they set an order of their own. */\n order: 100;\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 40px;\n`;\n\nStyledSheetSideContent.displayName = \"StyledSheetSideContent\";\n\nexport const StyledSheetIcons = styled.div`\n display: flex;\n height: 0;\n position: relative;\n\n > span,\n > ${StyledSheetControlGroup} > span {\n position: relative;\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-secondary);\n cursor: pointer;\n border-radius: 100%;\n width: 40px;\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n & > * {\n height: 40px;\n width: 40px;\n padding: 8px;\n fill: var(--color-theme-600);\n }\n }\n\n @media (max-width: 640px) {\n display: none;\n }\n`;\n\nStyledSheetIcons.displayName = \"StyledSheetIcons\";\n\ninterface IStyledSheetWrapper {\n $position?: \"center\" | \"left\" | \"right\";\n $mode?: \"normal\" | \"stretch\";\n $maxWidth?: number | string;\n}\n\nconst toCssSize = (value: number | string) =>\n typeof value === \"number\" ? `${value}px` : value;\n\nexport const StyledSheetWrapper = styled.div<IStyledSheetWrapper>`\n ${BoxSizingStyle}\n ${FontStyle}\n\n position: relative;\n max-width: 95vw;\n display: flex;\n flex-direction: row;\n\n ${(props) =>\n props.$mode === \"stretch\"\n ? css`\n margin-top: 8px;\n height: calc(100vh - 16px);\n width: calc(100vw - 100px);\n max-width: ${toCssSize(props.$maxWidth ?? 1000)};\n transition: max-width ${SHEET_ENTER_MS}ms ease;\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n ${StyledSheetIcons} {\n flex-direction: column;\n width: 0;\n height: calc(100vh - 32px);\n & > * {\n margin-bottom: 8px;\n }\n > span,\n > .c-sheet__side-content {\n top: 8px;\n }\n }\n `\n : css`\n max-height: calc(100vh - 156px);\n margin-top: 126px;\n margin-bottom: 30px;\n width: 540px;\n flex-direction: column;\n\n ${StyledSheetIcons} {\n flex-direction: row-reverse;\n & > * {\n margin-left: 8px;\n }\n > span,\n > .c-sheet__side-content {\n top: -48px;\n right: 8px;\n }\n }\n `}\n\n ${(props) =>\n props.$mode === \"stretch\" &&\n css`\n @media (max-width: 640px) {\n width: 100%;\n height: 100%;\n }\n `}\n\n ${(props) =>\n props.$position === \"center\" &&\n css`\n ${tw`tw-mx-auto`}\n `}\n\n ${(props) =>\n props.$position === \"left\" &&\n css`\n ${tw`tw-ml-2 tw-mr-auto`}\n `}\n\n ${(props) =>\n props.$position === \"right\" &&\n css`\n ${tw`tw-mr-2 tw-ml-auto`}\n `}\n\n ${(props) =>\n props.$mode === \"stretch\" &&\n props.$position !== \"left\" &&\n css`\n ${StyledSheetIcons} {\n > span,\n > .c-sheet__side-content {\n right: 48px;\n }\n }\n `}\n\n ${(props) =>\n props.$mode === \"stretch\" &&\n props.$position === \"left\" &&\n css`\n flex-direction: row-reverse;\n\n ${StyledSheetIcons} {\n > span,\n > .c-sheet__side-content {\n right: -8px;\n }\n }\n `}\n`;\n\nStyledSheetWrapper.displayName = \"StyledSheetWrapper\";\n\ninterface IStyledSheetWrapperPaper {\n paperClass?: string;\n $surface?: \"paper\" | \"sheet\";\n}\n\nexport const StyledSheetSurface = styled.div`\n /* The surface slides in, so the pointer follows it and not the still wrapper around it. */\n pointer-events: auto;\n position: relative;\n display: flex;\n flex-direction: inherit;\n flex: 1 1 auto;\n min-width: 0;\n min-height: 0;\n`;\n\nStyledSheetSurface.displayName = \"StyledSheetSurface\";\n\n/* The line stops short of the large corners of the paper. */\nexport const StyledSheetResizeHandle = styled(ResizeHandle)`\n top: 24px;\n bottom: 24px;\n z-index: 1;\n\n @media (max-width: 640px) {\n display: none;\n }\n`;\n\nStyledSheetResizeHandle.displayName = \"StyledSheetResizeHandle\";\n\nexport const StyledSheetWrapperPaper = styled.div.attrs<IStyledSheetWrapperPaper>(\n (props) => ({\n className: props.paperClass,\n })\n)<IStyledSheetWrapperPaper>`\n background-color: var(--page-paper-main);\n color: var(--color-theme-900);\n box-shadow: var(--shadow-primary);\n border-radius: 6px;\n overflow: auto;\n animation: 0.3s linear ease-out;\n /* Scrolling here must not dirty the blurred overlays below, which already clip to this box. */\n transform: translateZ(0);\n contain: paint;\n /* A scroll that runs off the end must stop here, with no bounce. Chained or bounced, it moves what the blur samples. */\n overscroll-behavior: none;\n\n ${(props) =>\n props.$surface === \"sheet\" &&\n css`\n background-color: var(--surface-sheet);\n box-shadow: var(--surface-sheet-shadow, var(--shadow-primary));\n\n @media (min-width: 641px) {\n border-radius: 24px;\n }\n `}\n\n ${tw`tw-flex-auto`}\n`;\n\nStyledSheetWrapperPaper.displayName = \"StyledSheetWrapperPaper\";\n\ninterface IStyledAnimatedSpan {\n $disabled?: boolean;\n}\n\nexport const StyledAnimatedSpan = styled.span<IStyledAnimatedSpan>`\n &:hover svg {\n fill: var(--color-primary);\n }\n\n ${(props) =>\n props.$disabled &&\n css`\n pointer-events: none;\n\n svg {\n opacity: 0.5;\n }\n `}\n`;\n\nStyledAnimatedSpan.displayName = \"StyledAnimatedSpan\";\n\nexport const StyledCssTransition = styled(CSSTransition)<{\n $direction: string;\n}>`\n ${(props) =>\n props.$direction === \"top\" &&\n css`\n &.c-sheet__animation-enter {\n opacity: 0;\n transform: translateY(-100%);\n }\n &.c-sheet__animation-enter-active {\n opacity: 1;\n transform: translateY(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-appear {\n opacity: 0;\n transform: translateY(-100%);\n }\n &.c-sheet__animation-appear-active {\n opacity: 1;\n transform: translateY(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-exit {\n opacity: 1;\n }\n &.c-sheet__animation-exit-active {\n opacity: 0;\n transform: translateY(-100%);\n transition: opacity ${SHEET_EXIT_MS}ms, transform ${SHEET_EXIT_MS}ms;\n }\n `}\n\n ${(props) =>\n props.$direction === \"bottom\" &&\n css`\n &.c-sheet__animation-enter {\n opacity: 0;\n transform: translateY(100%);\n }\n &.c-sheet__animation-enter-active {\n opacity: 1;\n transform: translateY(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-appear {\n opacity: 0;\n transform: translateY(100%);\n }\n &.c-sheet__animation-appear-active {\n opacity: 1;\n transform: translateY(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-exit {\n opacity: 1;\n }\n &.c-sheet__animation-exit-active {\n opacity: 0;\n transform: translateY(100%);\n transition: opacity ${SHEET_EXIT_MS}ms, transform ${SHEET_EXIT_MS}ms;\n }\n `}\n\n ${(props) =>\n props.$direction === \"left\" &&\n css`\n &.c-sheet__animation-enter {\n opacity: 0;\n transform: translateX(-100%);\n }\n &.c-sheet__animation-enter-active {\n opacity: 1;\n transform: translateX(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-appear {\n opacity: 0;\n transform: translateX(-100%);\n }\n &.c-sheet__animation-appear-active {\n opacity: 1;\n transform: translateX(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-exit {\n opacity: 1;\n }\n &.c-sheet__animation-exit-active {\n opacity: 0;\n transform: translateX(-100%);\n transition: opacity ${SHEET_EXIT_MS}ms, transform ${SHEET_EXIT_MS}ms;\n }\n `}\n\n ${(props) =>\n props.$direction === \"right\" &&\n css`\n &.c-sheet__animation-enter {\n opacity: 0;\n transform: translateX(100%);\n }\n &.c-sheet__animation-enter-active {\n opacity: 1;\n transform: translateX(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-appear {\n opacity: 0;\n transform: translateX(100%);\n }\n &.c-sheet__animation-appear-active {\n opacity: 1;\n transform: translateX(0);\n transition: opacity ${SHEET_ENTER_MS}ms, transform ${SHEET_ENTER_MS}ms;\n }\n &.c-sheet__animation-exit {\n opacity: 1;\n }\n &.c-sheet__animation-exit-active {\n opacity: 0;\n transform: translateX(100%);\n transition: opacity ${SHEET_EXIT_MS}ms, transform ${SHEET_EXIT_MS}ms;\n }\n `}\n`;\n\nStyledCssTransition.displayName = \"StyledCssTransition\";\n\nexport const StyledListSeparator = styled(ListSeparator)`\n margin: 0;\n`;\n\nStyledListSeparator.displayName = \"StyledListSeparator\";\n\nexport const StyledIconsWrapperSmall = styled.div`\n height: 40px;\n display: flex;\n gap: 8px;\n padding-left: 16px;\n padding-right: 16px;\n align-items: center;\n place-content: end;\n flex-direction: row-reverse;\n`;\n\nStyledIconsWrapperSmall.displayName = \"StyledIconsWrapperSmall\";\n\nexport const StyledHeader = styled.div`\n @media (min-width: 640px) {\n display: none;\n }\n`;\n\nStyledHeader.displayName = \"StyledHeader\";\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,wBAAwB;AAEtD,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,OAAO,MAAMC,cAAc,GAAG,GAAG;AACjC,OAAO,MAAMC,aAAa,GAAG,GAAG;;AAEhC;AACA,OAAO,MAAMC,uBAAuB,GAAGR,MAAM,CAACS,IAAI,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,mJAcjD;AAEDJ,uBAAuB,CAACG,WAAW,GAAG,yBAAyB;;AAE/D;AACA,OAAO,MAAME,sBAAsB,GAAGb,MAAM,CAACc,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,qGAQ/C;AAEDC,sBAAsB,CAACF,WAAW,GAAG,wBAAwB;AAE7D,OAAO,MAAMI,gBAAgB,GAAGf,MAAM,CAACc,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,iYAMpCJ,uBAAuB,CAsB5B;AAEDO,gBAAgB,CAACJ,WAAW,GAAG,kBAAkB;AAQjD,MAAMK,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AAU,KAAK,MAAM,IAC3BjC,GAAG,qgBAQuBK,cAAc,EAAiBA,cAAc,EAS7CA,cAAc,EAAiBA,cAAc,EAQ7CC,aAAa,EAAiBA,aAAa,CAEpE,EAEAY,KAAK,IACNA,KAAK,CAACe,UAAU,KAAK,OAAO,IAC5BjC,GAAG,kgBAQuBK,cAAc,EAAiBA,cAAc,EAS7CA,cAAc,EAAiBA,cAAc,EAQ7CC,aAAa,EAAiBA,aAAa,CAEpE,CACJ;AAED0B,mBAAmB,CAACtB,WAAW,GAAG,qBAAqB;AAEvD,OAAO,MAAMwB,mBAAmB,GAAGnC,MAAM,CAACI,aAAa,CAAC,CAAAM,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,iBAEvD;AAEDuB,mBAAmB,CAACxB,WAAW,GAAG,qBAAqB;AAEvD,OAAO,MAAMyB,uBAAuB,GAAGpC,MAAM,CAACc,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,8IAShD;AAEDwB,uBAAuB,CAACzB,WAAW,GAAG,yBAAyB;AAE/D,OAAO,MAAM0B,YAAY,GAAGrC,MAAM,CAACc,GAAG,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+CAIrC;AAEDyB,YAAY,CAAC1B,WAAW,GAAG,cAAc","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ export interface UseResizablePanelOptions {
|
|
|
10
10
|
step?: number;
|
|
11
11
|
/** Called once at the end of a drag, and on each key press. */
|
|
12
12
|
onChange: (width: number) => void;
|
|
13
|
+
/** With it a double click on the handle resets the width. */
|
|
14
|
+
onReset?: () => void;
|
|
13
15
|
}
|
|
14
16
|
export interface ResizeHandleProps {
|
|
15
17
|
active: boolean;
|
|
@@ -18,8 +20,9 @@ export interface ResizeHandleProps {
|
|
|
18
20
|
"aria-valuemin": number;
|
|
19
21
|
"aria-valuemax": number;
|
|
20
22
|
"aria-valuenow": number;
|
|
23
|
+
onDoubleClick?: () => void;
|
|
21
24
|
}
|
|
22
|
-
export declare const useResizablePanel: ({ side, width, min, max, step, onChange, }: UseResizablePanelOptions) => {
|
|
25
|
+
export declare const useResizablePanel: ({ side, width, min, max, step, onChange, onReset, }: UseResizablePanelOptions) => {
|
|
23
26
|
width: number;
|
|
24
27
|
isResizing: boolean;
|
|
25
28
|
handleProps: ResizeHandleProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizablePanel.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResizablePanel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,eAAe,GAC1B,OAAO,OAAO,EACd,KAAK,MAAM,EACX,KAAK,MAAM,EACX,WAAU,MAAY,KACrB,MAMF,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,sFAAsF;IACtF,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"useResizablePanel.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResizablePanel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,eAAe,GAC1B,OAAO,OAAO,EACd,KAAK,MAAM,EACX,KAAK,MAAM,EACX,WAAU,MAAY,KACrB,MAMF,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,sFAAsF;IACtF,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAChE,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC7D,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,eAAO,MAAM,iBAAiB,GAAI,qDAQ/B,wBAAwB;;;;CA0G1B,CAAC"}
|
|
@@ -14,7 +14,8 @@ export const useResizablePanel = _ref => {
|
|
|
14
14
|
max = _ref.max,
|
|
15
15
|
_ref$step = _ref.step,
|
|
16
16
|
step = _ref$step === void 0 ? 16 : _ref$step,
|
|
17
|
-
onChange = _ref.onChange
|
|
17
|
+
onChange = _ref.onChange,
|
|
18
|
+
onReset = _ref.onReset;
|
|
18
19
|
const _useState = useState(() => clampPanelWidth(width, min, max)),
|
|
19
20
|
resized = _useState[0],
|
|
20
21
|
setResized = _useState[1];
|
|
@@ -87,8 +88,9 @@ export const useResizablePanel = _ref => {
|
|
|
87
88
|
onKeyDown,
|
|
88
89
|
"aria-valuemin": min,
|
|
89
90
|
"aria-valuemax": max,
|
|
90
|
-
"aria-valuenow": resized
|
|
91
|
-
|
|
91
|
+
"aria-valuenow": resized,
|
|
92
|
+
onDoubleClick: onReset
|
|
93
|
+
}), [isResizing, onPointerDown, onKeyDown, min, max, resized, onReset]);
|
|
92
94
|
return {
|
|
93
95
|
width: resized,
|
|
94
96
|
isResizing,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizablePanel.js","names":["useCallback","useEffect","useMemo","useRef","useState","clampPanelWidth","width","min","max","fallback","numeric","Number","isFinite","Math","useResizablePanel","_ref","side","_ref$step","step","onChange","_useState","resized","setResized","_useState2","isResizing","setIsResizing","resizedRef","isResizingRef","stopRef","current","onPointerDown","event","button","startX","clientX","startWidth","handleMove","moveEvent","delta","next","handleEnd","round","window","removeEventListener","addEventListener","preventDefault","onKeyDown","grow","shrink","targets","Home","End","key","handleProps","active"],"sources":["../../../src/hooks/useResizablePanel.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport type React from \"react\";\n\nexport const clampPanelWidth = (\n width: unknown,\n min: number,\n max: number,\n fallback: number = min\n): number => {\n const numeric = Number(width);\n\n if (!Number.isFinite(numeric)) return fallback;\n\n return Math.min(Math.max(numeric, min), max);\n};\n\nexport interface UseResizablePanelOptions {\n /** The side of the layout the panel stands on. Its handle is on the opposite edge. */\n side: \"left\" | \"right\";\n width: number;\n min: number;\n max: number;\n /** The change of one arrow key press, in pixels. */\n step?: number;\n /** Called once at the end of a drag, and on each key press. */\n onChange: (width: number) => void;\n}\n\nexport interface ResizeHandleProps {\n active: boolean;\n onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n \"aria-valuemin\": number;\n \"aria-valuemax\": number;\n \"aria-valuenow\": number;\n}\n\nexport const useResizablePanel = ({\n side,\n width,\n min,\n max,\n step = 16,\n onChange,\n}: UseResizablePanelOptions) => {\n const [resized, setResized] = useState(() =>\n clampPanelWidth(width, min, max)\n );\n const [isResizing, setIsResizing] = useState(false);\n const resizedRef = useRef(resized);\n const isResizingRef = useRef(false);\n const stopRef = useRef<(() => void) | null>(null);\n\n resizedRef.current = resized;\n\n useEffect(() => {\n if (!isResizingRef.current) {\n setResized(clampPanelWidth(width, min, max));\n }\n }, [width, min, max]);\n\n useEffect(() => () => stopRef.current?.(), []);\n\n const onPointerDown = useCallback(\n (event: React.PointerEvent<HTMLElement>) => {\n if (event.button != null && event.button !== 0) return;\n\n const startX = event.clientX;\n const startWidth = resizedRef.current;\n\n isResizingRef.current = true;\n setIsResizing(true);\n\n const handleMove = (moveEvent: PointerEvent) => {\n const delta =\n side === \"right\"\n ? startX - moveEvent.clientX\n : moveEvent.clientX - startX;\n const next = clampPanelWidth(startWidth + delta, min, max);\n\n resizedRef.current = next;\n setResized(next);\n };\n\n const handleEnd = () => {\n stopRef.current?.();\n\n if (resizedRef.current !== startWidth) {\n onChange(Math.round(resizedRef.current));\n }\n };\n\n stopRef.current = () => {\n isResizingRef.current = false;\n setIsResizing(false);\n stopRef.current = null;\n window.removeEventListener(\"pointermove\", handleMove);\n window.removeEventListener(\"pointerup\", handleEnd);\n window.removeEventListener(\"pointercancel\", handleEnd);\n };\n\n window.addEventListener(\"pointermove\", handleMove);\n window.addEventListener(\"pointerup\", handleEnd);\n window.addEventListener(\"pointercancel\", handleEnd);\n event.preventDefault();\n },\n [side, min, max, onChange]\n );\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n const grow = side === \"right\" ? \"ArrowLeft\" : \"ArrowRight\";\n const shrink = side === \"right\" ? \"ArrowRight\" : \"ArrowLeft\";\n const current = resizedRef.current;\n const targets: Record<string, number> = {\n [grow]: current + step,\n [shrink]: current - step,\n Home: min,\n End: max,\n };\n\n if (!(event.key in targets)) return;\n\n event.preventDefault();\n\n const next = clampPanelWidth(targets[event.key], min, max);\n\n if (next !== current) {\n resizedRef.current = next;\n setResized(next);\n onChange(Math.round(next));\n }\n },\n [side, min, max, step, onChange]\n );\n\n const handleProps: ResizeHandleProps = useMemo(\n () => ({\n active: isResizing,\n onPointerDown,\n onKeyDown,\n \"aria-valuemin\": min,\n \"aria-valuemax\": max,\n \"aria-valuenow\": resized,\n }),\n [isResizing, onPointerDown, onKeyDown, min, max, resized]\n );\n\n return { width: resized, isResizing, handleProps };\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGzE,OAAO,MAAMC,eAAe,GAAG,SAAAA,CAC7BC,KAAc,EACdC,GAAW,EACXC,GAAW,EACXC,QAAgB,EACL;EAAA,IADXA,QAAgB;IAAhBA,QAAgB,GAAGF,GAAG;EAAA;EAEtB,MAAMG,OAAO,GAAGC,MAAM,CAACL,KAAK,CAAC;EAE7B,IAAI,CAACK,MAAM,CAACC,QAAQ,CAACF,OAAO,CAAC,EAAE,OAAOD,QAAQ;EAE9C,OAAOI,IAAI,CAACN,GAAG,CAACM,IAAI,CAACL,GAAG,CAACE,OAAO,EAAEH,GAAG,CAAC,EAAEC,GAAG,CAAC;AAC9C,CAAC;
|
|
1
|
+
{"version":3,"file":"useResizablePanel.js","names":["useCallback","useEffect","useMemo","useRef","useState","clampPanelWidth","width","min","max","fallback","numeric","Number","isFinite","Math","useResizablePanel","_ref","side","_ref$step","step","onChange","onReset","_useState","resized","setResized","_useState2","isResizing","setIsResizing","resizedRef","isResizingRef","stopRef","current","onPointerDown","event","button","startX","clientX","startWidth","handleMove","moveEvent","delta","next","handleEnd","round","window","removeEventListener","addEventListener","preventDefault","onKeyDown","grow","shrink","targets","Home","End","key","handleProps","active","onDoubleClick"],"sources":["../../../src/hooks/useResizablePanel.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport type React from \"react\";\n\nexport const clampPanelWidth = (\n width: unknown,\n min: number,\n max: number,\n fallback: number = min\n): number => {\n const numeric = Number(width);\n\n if (!Number.isFinite(numeric)) return fallback;\n\n return Math.min(Math.max(numeric, min), max);\n};\n\nexport interface UseResizablePanelOptions {\n /** The side of the layout the panel stands on. Its handle is on the opposite edge. */\n side: \"left\" | \"right\";\n width: number;\n min: number;\n max: number;\n /** The change of one arrow key press, in pixels. */\n step?: number;\n /** Called once at the end of a drag, and on each key press. */\n onChange: (width: number) => void;\n /** With it a double click on the handle resets the width. */\n onReset?: () => void;\n}\n\nexport interface ResizeHandleProps {\n active: boolean;\n onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n \"aria-valuemin\": number;\n \"aria-valuemax\": number;\n \"aria-valuenow\": number;\n onDoubleClick?: () => void;\n}\n\nexport const useResizablePanel = ({\n side,\n width,\n min,\n max,\n step = 16,\n onChange,\n onReset,\n}: UseResizablePanelOptions) => {\n const [resized, setResized] = useState(() =>\n clampPanelWidth(width, min, max)\n );\n const [isResizing, setIsResizing] = useState(false);\n const resizedRef = useRef(resized);\n const isResizingRef = useRef(false);\n const stopRef = useRef<(() => void) | null>(null);\n\n resizedRef.current = resized;\n\n useEffect(() => {\n if (!isResizingRef.current) {\n setResized(clampPanelWidth(width, min, max));\n }\n }, [width, min, max]);\n\n useEffect(() => () => stopRef.current?.(), []);\n\n const onPointerDown = useCallback(\n (event: React.PointerEvent<HTMLElement>) => {\n if (event.button != null && event.button !== 0) return;\n\n const startX = event.clientX;\n const startWidth = resizedRef.current;\n\n isResizingRef.current = true;\n setIsResizing(true);\n\n const handleMove = (moveEvent: PointerEvent) => {\n const delta =\n side === \"right\"\n ? startX - moveEvent.clientX\n : moveEvent.clientX - startX;\n const next = clampPanelWidth(startWidth + delta, min, max);\n\n resizedRef.current = next;\n setResized(next);\n };\n\n const handleEnd = () => {\n stopRef.current?.();\n\n if (resizedRef.current !== startWidth) {\n onChange(Math.round(resizedRef.current));\n }\n };\n\n stopRef.current = () => {\n isResizingRef.current = false;\n setIsResizing(false);\n stopRef.current = null;\n window.removeEventListener(\"pointermove\", handleMove);\n window.removeEventListener(\"pointerup\", handleEnd);\n window.removeEventListener(\"pointercancel\", handleEnd);\n };\n\n window.addEventListener(\"pointermove\", handleMove);\n window.addEventListener(\"pointerup\", handleEnd);\n window.addEventListener(\"pointercancel\", handleEnd);\n event.preventDefault();\n },\n [side, min, max, onChange]\n );\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n const grow = side === \"right\" ? \"ArrowLeft\" : \"ArrowRight\";\n const shrink = side === \"right\" ? \"ArrowRight\" : \"ArrowLeft\";\n const current = resizedRef.current;\n const targets: Record<string, number> = {\n [grow]: current + step,\n [shrink]: current - step,\n Home: min,\n End: max,\n };\n\n if (!(event.key in targets)) return;\n\n event.preventDefault();\n\n const next = clampPanelWidth(targets[event.key], min, max);\n\n if (next !== current) {\n resizedRef.current = next;\n setResized(next);\n onChange(Math.round(next));\n }\n },\n [side, min, max, step, onChange]\n );\n\n const handleProps: ResizeHandleProps = useMemo(\n () => ({\n active: isResizing,\n onPointerDown,\n onKeyDown,\n \"aria-valuemin\": min,\n \"aria-valuemax\": max,\n \"aria-valuenow\": resized,\n onDoubleClick: onReset,\n }),\n [isResizing, onPointerDown, onKeyDown, min, max, resized, onReset]\n );\n\n return { width: resized, isResizing, handleProps };\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGzE,OAAO,MAAMC,eAAe,GAAG,SAAAA,CAC7BC,KAAc,EACdC,GAAW,EACXC,GAAW,EACXC,QAAgB,EACL;EAAA,IADXA,QAAgB;IAAhBA,QAAgB,GAAGF,GAAG;EAAA;EAEtB,MAAMG,OAAO,GAAGC,MAAM,CAACL,KAAK,CAAC;EAE7B,IAAI,CAACK,MAAM,CAACC,QAAQ,CAACF,OAAO,CAAC,EAAE,OAAOD,QAAQ;EAE9C,OAAOI,IAAI,CAACN,GAAG,CAACM,IAAI,CAACL,GAAG,CAACE,OAAO,EAAEH,GAAG,CAAC,EAAEC,GAAG,CAAC;AAC9C,CAAC;AA0BD,OAAO,MAAMM,iBAAiB,GAAGC,IAAA,IAQD;EAAA,IAP9BC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJV,KAAK,GAAA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