@traefik-labs/faency 13.4.0 → 13.6.0
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/components/AriaTable/AriaTable.cjs +13 -5
- package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
- package/dist/components/AriaTable/AriaTable.constants.cjs +5 -0
- package/dist/components/AriaTable/AriaTable.constants.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.constants.js +5 -0
- package/dist/components/AriaTable/AriaTable.constants.js.map +1 -0
- package/dist/components/AriaTable/AriaTable.js +13 -5
- package/dist/components/AriaTable/AriaTable.js.map +1 -1
- package/dist/components/AriaTable/AriaTable.vanilla.cjs +194 -0
- package/dist/components/AriaTable/AriaTable.vanilla.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.cjs +28 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.js +17 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.js.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.js +185 -0
- package/dist/components/AriaTable/AriaTable.vanilla.js.map +1 -0
- package/dist/components/Badge/Badge.vanilla.cjs +2 -1
- package/dist/components/Badge/Badge.vanilla.cjs.map +1 -1
- package/dist/components/Badge/Badge.vanilla.js +2 -1
- package/dist/components/Badge/Badge.vanilla.js.map +1 -1
- package/dist/components/Blockquote/Blockquote.vanilla.cjs +2 -1
- package/dist/components/Blockquote/Blockquote.vanilla.cjs.map +1 -1
- package/dist/components/Blockquote/Blockquote.vanilla.js +2 -1
- package/dist/components/Blockquote/Blockquote.vanilla.js.map +1 -1
- package/dist/components/Box/Box.vanilla.cjs +2 -1
- package/dist/components/Box/Box.vanilla.cjs.map +1 -1
- package/dist/components/Box/Box.vanilla.js +2 -1
- package/dist/components/Box/Box.vanilla.js.map +1 -1
- package/dist/components/Bubble/Bubble.vanilla.cjs +2 -1
- package/dist/components/Bubble/Bubble.vanilla.cjs.map +1 -1
- package/dist/components/Bubble/Bubble.vanilla.js +2 -1
- package/dist/components/Bubble/Bubble.vanilla.js.map +1 -1
- package/dist/components/Button/Button.vanilla.cjs +2 -1
- package/dist/components/Button/Button.vanilla.cjs.map +1 -1
- package/dist/components/Button/Button.vanilla.js +2 -1
- package/dist/components/Button/Button.vanilla.js.map +1 -1
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.cjs +5 -4
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.cjs.map +1 -1
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.js +5 -4
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.js.map +1 -1
- package/dist/components/Card/Card.vanilla.cjs +2 -1
- package/dist/components/Card/Card.vanilla.cjs.map +1 -1
- package/dist/components/Card/Card.vanilla.js +2 -1
- package/dist/components/Card/Card.vanilla.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.cjs +2 -2
- package/dist/components/CodeBlock/CodeBlock.js +2 -2
- package/dist/components/CodeBlock/CodeBlock.vanilla.cjs +6 -14
- package/dist/components/CodeBlock/CodeBlock.vanilla.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.vanilla.js +6 -14
- package/dist/components/CodeBlock/CodeBlock.vanilla.js.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.cjs +2 -2
- package/dist/components/Combobox/Combobox.vanilla.cjs.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.js +2 -2
- package/dist/components/Combobox/Combobox.vanilla.js.map +1 -1
- package/dist/components/Container/Container.vanilla.cjs +2 -1
- package/dist/components/Container/Container.vanilla.cjs.map +1 -1
- package/dist/components/Container/Container.vanilla.js +2 -1
- package/dist/components/Container/Container.vanilla.js.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +1 -1
- package/dist/components/Dialog/Dialog.cjs +1 -1
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/Elevation/Elevation.vanilla.cjs +2 -1
- package/dist/components/Elevation/Elevation.vanilla.cjs.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.css.cjs.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.css.js.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.js +2 -1
- package/dist/components/Elevation/Elevation.vanilla.js.map +1 -1
- package/dist/components/Field/Field.cjs +80 -33
- package/dist/components/Field/Field.cjs.map +1 -1
- package/dist/components/Field/Field.js +80 -33
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/Field.vanilla.cjs +62 -32
- package/dist/components/Field/Field.vanilla.cjs.map +1 -1
- package/dist/components/Field/Field.vanilla.css.cjs +6 -0
- package/dist/components/Field/Field.vanilla.css.cjs.map +1 -1
- package/dist/components/Field/Field.vanilla.css.js +4 -1
- package/dist/components/Field/Field.vanilla.css.js.map +1 -1
- package/dist/components/Field/Field.vanilla.js +63 -33
- package/dist/components/Field/Field.vanilla.js.map +1 -1
- package/dist/components/Field/FieldContext.cjs +48 -10
- package/dist/components/Field/FieldContext.cjs.map +1 -1
- package/dist/components/Field/FieldContext.js +48 -10
- package/dist/components/Field/FieldContext.js.map +1 -1
- package/dist/components/Flex/Flex.vanilla.cjs +2 -1
- package/dist/components/Flex/Flex.vanilla.cjs.map +1 -1
- package/dist/components/Flex/Flex.vanilla.js +2 -1
- package/dist/components/Flex/Flex.vanilla.js.map +1 -1
- package/dist/components/Grid/Grid.vanilla.cjs +2 -1
- package/dist/components/Grid/Grid.vanilla.cjs.map +1 -1
- package/dist/components/Grid/Grid.vanilla.js +2 -1
- package/dist/components/Grid/Grid.vanilla.js.map +1 -1
- package/dist/components/IconButton/IconButton.vanilla.cjs +2 -1
- package/dist/components/IconButton/IconButton.vanilla.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.vanilla.js +2 -1
- package/dist/components/IconButton/IconButton.vanilla.js.map +1 -1
- package/dist/components/Image/Image.vanilla.cjs +2 -1
- package/dist/components/Image/Image.vanilla.cjs.map +1 -1
- package/dist/components/Image/Image.vanilla.js +2 -1
- package/dist/components/Image/Image.vanilla.js.map +1 -1
- package/dist/components/Input/Input.vanilla.cjs +2 -1
- package/dist/components/Input/Input.vanilla.cjs.map +1 -1
- package/dist/components/Input/Input.vanilla.js +2 -1
- package/dist/components/Input/Input.vanilla.js.map +1 -1
- package/dist/components/Label/Label.vanilla.cjs +2 -1
- package/dist/components/Label/Label.vanilla.cjs.map +1 -1
- package/dist/components/Label/Label.vanilla.js +2 -1
- package/dist/components/Label/Label.vanilla.js.map +1 -1
- package/dist/components/List/List.cjs +1 -1
- package/dist/components/List/List.js +1 -1
- package/dist/components/Meter/Meter.vanilla.cjs +3 -2
- package/dist/components/Meter/Meter.vanilla.cjs.map +1 -1
- package/dist/components/Meter/Meter.vanilla.js +3 -2
- package/dist/components/Meter/Meter.vanilla.js.map +1 -1
- package/dist/components/NavigationTree/NavigationTreeItem.cjs +2 -2
- package/dist/components/NavigationTree/NavigationTreeItem.js +2 -2
- package/dist/components/Panel/Panel.vanilla.cjs +2 -1
- package/dist/components/Panel/Panel.vanilla.cjs.map +1 -1
- package/dist/components/Panel/Panel.vanilla.js +2 -1
- package/dist/components/Panel/Panel.vanilla.js.map +1 -1
- package/dist/components/Paragraph/Paragraph.vanilla.cjs +2 -1
- package/dist/components/Paragraph/Paragraph.vanilla.cjs.map +1 -1
- package/dist/components/Paragraph/Paragraph.vanilla.js +2 -1
- package/dist/components/Paragraph/Paragraph.vanilla.js.map +1 -1
- package/dist/components/RowLink/RowLink.cjs +18 -46
- package/dist/components/RowLink/RowLink.cjs.map +1 -1
- package/dist/components/RowLink/RowLink.constants.cjs +7 -0
- package/dist/components/RowLink/RowLink.constants.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.constants.js +6 -0
- package/dist/components/RowLink/RowLink.constants.js.map +1 -0
- package/dist/components/RowLink/RowLink.js +15 -45
- package/dist/components/RowLink/RowLink.js.map +1 -1
- package/dist/components/RowLink/RowLink.utils.cjs +87 -0
- package/dist/components/RowLink/RowLink.utils.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.utils.js +83 -0
- package/dist/components/RowLink/RowLink.utils.js.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.cjs +21 -0
- package/dist/components/RowLink/RowLink.vanilla.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.css.cjs +10 -0
- package/dist/components/RowLink/RowLink.vanilla.css.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.css.js +8 -0
- package/dist/components/RowLink/RowLink.vanilla.css.js.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.js +19 -0
- package/dist/components/RowLink/RowLink.vanilla.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs +3 -3
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.js +3 -3
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.js.map +1 -1
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.cjs +2 -1
- package/dist/components/Skeleton/Skeleton.vanilla.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.js +2 -1
- package/dist/components/Skeleton/Skeleton.vanilla.js.map +1 -1
- package/dist/components/Spinner/Spinner.vanilla.cjs +3 -2
- package/dist/components/Spinner/Spinner.vanilla.cjs.map +1 -1
- package/dist/components/Spinner/Spinner.vanilla.js +3 -2
- package/dist/components/Spinner/Spinner.vanilla.js.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.cjs +4 -3
- package/dist/components/SplitLayout/SplitLayout.vanilla.cjs.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.js +4 -3
- package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -1
- package/dist/components/Table/ExpandToggle.vanilla.cjs +30 -0
- package/dist/components/Table/ExpandToggle.vanilla.cjs.map +1 -0
- package/dist/components/Table/ExpandToggle.vanilla.js +27 -0
- package/dist/components/Table/ExpandToggle.vanilla.js.map +1 -0
- package/dist/components/Table/SortButton.vanilla.cjs +38 -0
- package/dist/components/Table/SortButton.vanilla.cjs.map +1 -0
- package/dist/components/Table/SortButton.vanilla.js +35 -0
- package/dist/components/Table/SortButton.vanilla.js.map +1 -0
- package/dist/components/Table/Table.cjs +11 -4
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.js +11 -4
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.vanilla.cjs +142 -0
- package/dist/components/Table/Table.vanilla.cjs.map +1 -0
- package/dist/components/Table/Table.vanilla.css.cjs +178 -0
- package/dist/components/Table/Table.vanilla.css.cjs.map +1 -0
- package/dist/components/Table/Table.vanilla.css.js +161 -0
- package/dist/components/Table/Table.vanilla.css.js.map +1 -0
- package/dist/components/Table/Table.vanilla.js +133 -0
- package/dist/components/Table/Table.vanilla.js.map +1 -0
- package/dist/components/Table/useTableSort.cjs +60 -0
- package/dist/components/Table/useTableSort.cjs.map +1 -0
- package/dist/components/Table/useTableSort.js +59 -0
- package/dist/components/Table/useTableSort.js.map +1 -0
- package/dist/components/Text/Text.vanilla.cjs +2 -1
- package/dist/components/Text/Text.vanilla.cjs.map +1 -1
- package/dist/components/Text/Text.vanilla.js +2 -1
- package/dist/components/Text/Text.vanilla.js.map +1 -1
- package/dist/components/TextField/TextField.cjs +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.vanilla.cjs +1 -1
- package/dist/components/TextField/TextField.vanilla.js +1 -1
- package/dist/components/Textarea/Textarea.cjs +2 -2
- package/dist/components/Textarea/Textarea.js +2 -2
- package/dist/components/Textarea/Textarea.vanilla.cjs +4 -3
- package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.js +4 -3
- package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
- package/dist/components/Toast/Toast.vanilla.cjs +5 -5
- package/dist/components/Toast/Toast.vanilla.cjs.map +1 -1
- package/dist/components/Toast/Toast.vanilla.js +5 -5
- package/dist/components/Toast/Toast.vanilla.js.map +1 -1
- package/dist/components/Toast/ToastProvider.vanilla.cjs +1 -1
- package/dist/components/Toast/ToastProvider.vanilla.js +1 -1
- package/dist/faency.css +3001 -2303
- package/dist/index.cjs +50 -29
- package/dist/index.d.ts +570 -24
- package/dist/index.js +33 -30
- package/dist/styles/cx.cjs +5 -0
- package/dist/styles/cx.cjs.map +1 -0
- package/dist/styles/cx.js +5 -0
- package/dist/styles/cx.js.map +1 -0
- package/dist/styles/themes.css.cjs.map +1 -1
- package/dist/styles/themes.css.js.map +1 -1
- package/dist/styles/tokens.css.cjs +55 -44
- package/dist/styles/tokens.css.cjs.map +1 -1
- package/dist/styles/tokens.css.js +55 -44
- package/dist/styles/tokens.css.js.map +1 -1
- package/dist/styles/useInlineStyle.cjs +16 -0
- package/dist/styles/useInlineStyle.cjs.map +1 -0
- package/dist/styles/useInlineStyle.js +16 -0
- package/dist/styles/useInlineStyle.js.map +1 -0
- package/dist/utils/warnOnce.cjs +13 -0
- package/dist/utils/warnOnce.cjs.map +1 -0
- package/dist/utils/warnOnce.js +13 -0
- package/dist/utils/warnOnce.js.map +1 -0
- package/package.json +10 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitLayout.vanilla.cjs","names":["useLayoutEffect","useEffect","useCallback","useSyncExternalStore","createContext","useContext","forwardRef","useVanillaExtractTheme","processCSSProp","useRef","useState","root","assignInlineVars","FlexVanilla","main","useId","_Fragment","aside"],"sources":["../../../components/SplitLayout/SplitLayout.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport type { Gap } from '../../styles/types';\nimport { FlexVanilla } from '../Flex/Flex.vanilla';\nimport { HANDLE_WIDTH } from './SplitLayout.constants';\nimport { aside, handle, handleLine, main, root } from './SplitLayout.vanilla.css';\n\n/** Pixels, or a share of the layout such as `'25%'`. */\nexport type SplitLayoutWidth = number | `${number}%`;\n\nconst KEY_STEP = 16;\nconst DEFAULT_MIN_WIDTH: SplitLayoutWidth = '25%';\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nconst toPx = (width: SplitLayoutWidth, layoutWidth: number) =>\n typeof width === 'number' ? width : (parseFloat(width) / 100) * layoutWidth;\n\nconst storageName = (key: string) => `split:${key}`;\n\nconst readSaved = (key: string): number | null => {\n try {\n const saved = Number(window.localStorage.getItem(storageName(key)));\n return saved > 0 ? saved : null;\n } catch {\n return null;\n }\n};\n\nconst writeSaved = (key: string, width: number | null) => {\n try {\n if (width == null) window.localStorage.removeItem(storageName(key));\n else window.localStorage.setItem(storageName(key), String(width));\n } catch {\n // Storage can be unavailable (private mode, blocked); remembering is only a convenience.\n }\n};\n\nconst useMaxWidth = (px: number) => {\n const query = `(max-width: ${px}px)`;\n const subscribe = useCallback(\n (onChange: () => void) => {\n const mq = window.matchMedia(query);\n mq.addEventListener('change', onChange);\n return () => mq.removeEventListener('change', onChange);\n },\n [query],\n );\n\n return useSyncExternalStore(\n subscribe,\n () => window.matchMedia(query).matches,\n () => false,\n );\n};\n\ntype SplitContextValue = {\n stacked: boolean;\n layoutWidth: number;\n mainMinWidth: SplitLayoutWidth;\n setMainMinWidth: (width: SplitLayoutWidth) => void;\n};\n\nconst SplitContext = createContext<SplitContextValue | null>(null);\n\nconst useSplit = (component: string) => {\n const split = useContext(SplitContext);\n if (!split) throw new Error(`${component} must be used inside SplitLayoutVanilla`);\n return split;\n};\n\nconst stickyCss = (stacked: boolean, stickyTop?: string | number) =>\n !stacked && stickyTop != null ? { position: 'sticky', top: stickyTop } : {};\n\nexport type SplitLayoutVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps & {\n /** The panes stack at this viewport width (px) and below. */\n breakpoint?: number;\n };\n\nexport const SplitLayoutVanilla = forwardRef<HTMLDivElement, SplitLayoutVanillaProps>(\n ({ breakpoint = 1024, className, css, style, children, ...props }, ref) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const setRefs = useCallback(\n (el: HTMLDivElement | null) => {\n containerRef.current = el;\n if (typeof ref === 'function') ref(el);\n else if (ref) ref.current = el;\n },\n [ref],\n );\n\n const stacked = useMaxWidth(breakpoint);\n const [layoutWidth, setLayoutWidth] = useState(0);\n const [mainMinWidth, setMainMinWidth] = useState<SplitLayoutWidth>(DEFAULT_MIN_WIDTH);\n\n useIsomorphicLayoutEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n setLayoutWidth(el.clientWidth);\n const observer = new ResizeObserver(() => setLayoutWidth(el.clientWidth));\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n\n return (\n <SplitContext.Provider value={{ stacked, layoutWidth, mainMinWidth, setMainMinWidth }}>\n <div\n ref={setRefs}\n className={`${root} ${className || ''}`.trim()}\n data-stacked={stacked ? '' : undefined}\n style={{ ...cssStyles, ...style, ...assignInlineVars(vars) }}\n {...props}\n >\n {children}\n </div>\n </SplitContext.Provider>\n );\n },\n);\n\nSplitLayoutVanilla.displayName = 'SplitLayoutVanilla';\n\ntype PaneProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps & {\n gap?: Gap;\n /** Keeps the pane in view while the page scrolls, this far from the top. Off when stacked. */\n stickyTop?: string | number;\n /** The pane never gets narrower than this while resizing. */\n minWidth?: SplitLayoutWidth;\n };\n\nexport type SplitLayoutMainVanillaProps = PaneProps;\n\nexport const SplitLayoutMainVanilla = forwardRef<HTMLDivElement, SplitLayoutMainVanillaProps>(\n ({ stickyTop, minWidth = DEFAULT_MIN_WIDTH, className, css, ...props }, ref) => {\n const { stacked, setMainMinWidth } = useSplit('SplitLayoutMainVanilla');\n\n useIsomorphicLayoutEffect(() => {\n setMainMinWidth(minWidth);\n return () => setMainMinWidth(DEFAULT_MIN_WIDTH);\n }, [minWidth, setMainMinWidth]);\n\n return (\n <FlexVanilla\n ref={ref}\n direction=\"column\"\n className={`${main} ${className || ''}`.trim()}\n css={{ ...stickyCss(stacked, stickyTop), ...css }}\n {...props}\n />\n );\n },\n);\n\nSplitLayoutMainVanilla.displayName = 'SplitLayoutMainVanilla';\n\nexport type SplitLayoutAsideVanillaProps = PaneProps & {\n /** Starting width in px. */\n defaultWidth?: number;\n /** Starting width as a share of the layout, e.g. 0.3. Overrides `defaultWidth`. */\n defaultFraction?: number;\n /** Remembers the width in localStorage under `split:<storageKey>`. */\n storageKey?: string;\n /** Accessible name of the divider. */\n resizeLabel?: string;\n};\n\nexport const SplitLayoutAsideVanilla = forwardRef<HTMLDivElement, SplitLayoutAsideVanillaProps>(\n (\n {\n defaultWidth = 360,\n defaultFraction,\n minWidth = DEFAULT_MIN_WIDTH,\n storageKey,\n resizeLabel = 'Resize',\n stickyTop,\n className,\n css,\n id,\n ...props\n },\n ref,\n ) => {\n const { stacked, layoutWidth, mainMinWidth } = useSplit('SplitLayoutAsideVanilla');\n const generatedId = useId();\n const paneId = id ?? generatedId;\n\n // null means \"use the default\", which may depend on the measured layout width.\n const [wanted, setWanted] = useState<number | null>(() =>\n storageKey ? readSaved(storageKey) : null,\n );\n\n const measured = layoutWidth > 0;\n const min = Math.round(toPx(minWidth, layoutWidth));\n // The aside's own minimum wins when both minimums don't fit.\n const max = measured\n ? Math.round(Math.max(layoutWidth - HANDLE_WIDTH - toPx(mainMinWidth, layoutWidth), min))\n : null;\n const clamp = (w: number) => Math.round(Math.min(Math.max(w, min), max ?? Infinity));\n\n const startWidth =\n defaultFraction != null && measured ? layoutWidth * defaultFraction : defaultWidth;\n const width = clamp(wanted ?? startWidth);\n\n // Handlers read the latest render through this ref so they stay stable during a drag.\n const latestRef = useRef({ width, min, max, clamp, storageKey });\n latestRef.current = { width, min, max, clamp, storageKey };\n\n const resize = useCallback((next: number) => {\n const w = latestRef.current.clamp(next);\n setWanted(w);\n return w;\n }, []);\n\n const persist = useCallback((w: number | null) => {\n const key = latestRef.current.storageKey;\n if (key) writeSaved(key, w);\n }, []);\n\n const onPointerDown = useCallback(\n (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n e.preventDefault();\n const startX = e.clientX;\n const from = latestRef.current.width;\n let last = from;\n\n const onMove = (ev: PointerEvent) => {\n last = resize(from - (ev.clientX - startX));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n document.body.style.userSelect = '';\n document.body.style.cursor = '';\n // A click without a drag must not replace a defaultFraction with a fixed width.\n if (last !== from) persist(last);\n };\n\n document.body.style.userSelect = 'none';\n document.body.style.cursor = 'col-resize';\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n },\n [resize, persist],\n );\n\n const onDoubleClick = useCallback(() => {\n setWanted(null);\n persist(null);\n }, [persist]);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n const { width: current, min: lo, max: hi } = latestRef.current;\n let next: number;\n if (e.key === 'ArrowLeft') next = current + KEY_STEP;\n else if (e.key === 'ArrowRight') next = current - KEY_STEP;\n else if (e.key === 'Home') next = lo;\n else if (e.key === 'End' && hi != null) next = hi;\n else return;\n e.preventDefault();\n persist(resize(next));\n },\n [resize, persist],\n );\n\n return (\n <>\n {!stacked && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-controls={paneId}\n aria-valuenow={width}\n aria-valuemin={min}\n aria-valuemax={max ?? undefined}\n tabIndex={0}\n title=\"Drag to resize, double-click to reset\"\n className={handle}\n onPointerDown={onPointerDown}\n onDoubleClick={onDoubleClick}\n onKeyDown={onKeyDown}\n >\n <span className={handleLine} />\n </div>\n )}\n <FlexVanilla\n ref={ref}\n id={paneId}\n direction=\"column\"\n className={`${aside} ${className || ''}`.trim()}\n css={{ ...(stacked ? {} : { width }), ...stickyCss(stacked, stickyTop), ...css }}\n {...props}\n />\n </>\n );\n },\n);\n\nSplitLayoutAsideVanilla.displayName = 'SplitLayoutAsideVanilla';\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,WAAW;AACjB,IAAM,oBAAsC;AAE5C,IAAM,4BAA4B,OAAO,WAAW,cAAcA,MAAAA,kBAAkBC,MAAAA;AAEpF,IAAM,QAAQ,OAAyB,gBACrC,OAAO,UAAU,WAAW,QAAS,WAAW,KAAK,IAAI,MAAO;AAElE,IAAM,eAAe,QAAgB,SAAS;AAE9C,IAAM,aAAa,QAA+B;CAChD,IAAI;EACF,MAAM,QAAQ,OAAO,OAAO,aAAa,QAAQ,YAAY,GAAG,CAAC,CAAC;EAClE,OAAO,QAAQ,IAAI,QAAQ;CAC7B,QAAQ;EACN,OAAO;CACT;AACF;AAEA,IAAM,cAAc,KAAa,UAAyB;CACxD,IAAI;EACF,IAAI,SAAS,MAAM,OAAO,aAAa,WAAW,YAAY,GAAG,CAAC;OAC7D,OAAO,aAAa,QAAQ,YAAY,GAAG,GAAG,OAAO,KAAK,CAAC;CAClE,QAAQ,CAER;AACF;AAEA,IAAM,eAAe,OAAe;CAClC,MAAM,QAAQ,eAAe,GAAG;CAChC,MAAM,aAAA,GAAYC,MAAAA,YAAAA,EACf,aAAyB;EACxB,MAAM,KAAK,OAAO,WAAW,KAAK;EAClC,GAAG,iBAAiB,UAAU,QAAQ;EACtC,aAAa,GAAG,oBAAoB,UAAU,QAAQ;CACxD,GACA,CAAC,KAAK,CACR;CAEA,QAAA,GAAOC,MAAAA,qBAAAA,CACL,iBACM,OAAO,WAAW,KAAK,CAAC,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;EAC9C,KAAK;GAAE,GAAI,UAAU,CAAC,IAAI,EAAE,MAAM;GAAI,GAAG,UAAU,SAAS,SAAS;GAAG,GAAG;EAAI;EAC/E,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CACF;AAEA,wBAAwB,cAAc"}
|
|
1
|
+
{"version":3,"file":"SplitLayout.vanilla.cjs","names":["useLayoutEffect","useEffect","useCallback","useSyncExternalStore","createContext","useContext","forwardRef","useVanillaExtractTheme","processCSSProp","useRef","useState","cx","root","assignInlineVars","FlexVanilla","main","useId","_Fragment","aside"],"sources":["../../../components/SplitLayout/SplitLayout.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport type { Gap } from '../../styles/types';\nimport { FlexVanilla } from '../Flex/Flex.vanilla';\nimport { HANDLE_WIDTH } from './SplitLayout.constants';\nimport { aside, handle, handleLine, main, root } from './SplitLayout.vanilla.css';\n\n/** Pixels, or a share of the layout such as `'25%'`. */\nexport type SplitLayoutWidth = number | `${number}%`;\n\nconst KEY_STEP = 16;\nconst DEFAULT_MIN_WIDTH: SplitLayoutWidth = '25%';\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nconst toPx = (width: SplitLayoutWidth, layoutWidth: number) =>\n typeof width === 'number' ? width : (parseFloat(width) / 100) * layoutWidth;\n\nconst storageName = (key: string) => `split:${key}`;\n\nconst readSaved = (key: string): number | null => {\n try {\n const saved = Number(window.localStorage.getItem(storageName(key)));\n return saved > 0 ? saved : null;\n } catch {\n return null;\n }\n};\n\nconst writeSaved = (key: string, width: number | null) => {\n try {\n if (width == null) window.localStorage.removeItem(storageName(key));\n else window.localStorage.setItem(storageName(key), String(width));\n } catch {\n // Storage can be unavailable (private mode, blocked); remembering is only a convenience.\n }\n};\n\nconst useMaxWidth = (px: number) => {\n const query = `(max-width: ${px}px)`;\n const subscribe = useCallback(\n (onChange: () => void) => {\n const mq = window.matchMedia(query);\n mq.addEventListener('change', onChange);\n return () => mq.removeEventListener('change', onChange);\n },\n [query],\n );\n\n return useSyncExternalStore(\n subscribe,\n () => window.matchMedia(query).matches,\n () => false,\n );\n};\n\ntype SplitContextValue = {\n stacked: boolean;\n layoutWidth: number;\n mainMinWidth: SplitLayoutWidth;\n setMainMinWidth: (width: SplitLayoutWidth) => void;\n};\n\nconst SplitContext = createContext<SplitContextValue | null>(null);\n\nconst useSplit = (component: string) => {\n const split = useContext(SplitContext);\n if (!split) throw new Error(`${component} must be used inside SplitLayoutVanilla`);\n return split;\n};\n\nconst stickyCss = (stacked: boolean, stickyTop?: string | number) =>\n !stacked && stickyTop != null ? { position: 'sticky', top: stickyTop } : {};\n\nexport type SplitLayoutVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps & {\n /** The panes stack at this viewport width (px) and below. */\n breakpoint?: number;\n };\n\nexport const SplitLayoutVanilla = forwardRef<HTMLDivElement, SplitLayoutVanillaProps>(\n ({ breakpoint = 1024, className, css, style, children, ...props }, ref) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const setRefs = useCallback(\n (el: HTMLDivElement | null) => {\n containerRef.current = el;\n if (typeof ref === 'function') ref(el);\n else if (ref) ref.current = el;\n },\n [ref],\n );\n\n const stacked = useMaxWidth(breakpoint);\n const [layoutWidth, setLayoutWidth] = useState(0);\n const [mainMinWidth, setMainMinWidth] = useState<SplitLayoutWidth>(DEFAULT_MIN_WIDTH);\n\n useIsomorphicLayoutEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n setLayoutWidth(el.clientWidth);\n const observer = new ResizeObserver(() => setLayoutWidth(el.clientWidth));\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n\n return (\n <SplitContext.Provider value={{ stacked, layoutWidth, mainMinWidth, setMainMinWidth }}>\n <div\n ref={setRefs}\n className={cx(root, className)}\n data-stacked={stacked ? '' : undefined}\n style={{ ...cssStyles, ...style, ...assignInlineVars(vars) }}\n {...props}\n >\n {children}\n </div>\n </SplitContext.Provider>\n );\n },\n);\n\nSplitLayoutVanilla.displayName = 'SplitLayoutVanilla';\n\ntype PaneProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps & {\n gap?: Gap;\n /** Keeps the pane in view while the page scrolls, this far from the top. Off when stacked. */\n stickyTop?: string | number;\n /** The pane never gets narrower than this while resizing. */\n minWidth?: SplitLayoutWidth;\n };\n\nexport type SplitLayoutMainVanillaProps = PaneProps;\n\nexport const SplitLayoutMainVanilla = forwardRef<HTMLDivElement, SplitLayoutMainVanillaProps>(\n ({ stickyTop, minWidth = DEFAULT_MIN_WIDTH, className, css, ...props }, ref) => {\n const { stacked, setMainMinWidth } = useSplit('SplitLayoutMainVanilla');\n\n useIsomorphicLayoutEffect(() => {\n setMainMinWidth(minWidth);\n return () => setMainMinWidth(DEFAULT_MIN_WIDTH);\n }, [minWidth, setMainMinWidth]);\n\n return (\n <FlexVanilla\n ref={ref}\n direction=\"column\"\n className={cx(main, className)}\n css={{ ...stickyCss(stacked, stickyTop), ...css }}\n {...props}\n />\n );\n },\n);\n\nSplitLayoutMainVanilla.displayName = 'SplitLayoutMainVanilla';\n\nexport type SplitLayoutAsideVanillaProps = PaneProps & {\n /** Starting width in px. */\n defaultWidth?: number;\n /** Starting width as a share of the layout, e.g. 0.3. Overrides `defaultWidth`. */\n defaultFraction?: number;\n /** Remembers the width in localStorage under `split:<storageKey>`. */\n storageKey?: string;\n /** Accessible name of the divider. */\n resizeLabel?: string;\n};\n\nexport const SplitLayoutAsideVanilla = forwardRef<HTMLDivElement, SplitLayoutAsideVanillaProps>(\n (\n {\n defaultWidth = 360,\n defaultFraction,\n minWidth = DEFAULT_MIN_WIDTH,\n storageKey,\n resizeLabel = 'Resize',\n stickyTop,\n className,\n css,\n id,\n ...props\n },\n ref,\n ) => {\n const { stacked, layoutWidth, mainMinWidth } = useSplit('SplitLayoutAsideVanilla');\n const generatedId = useId();\n const paneId = id ?? generatedId;\n\n // null means \"use the default\", which may depend on the measured layout width.\n const [wanted, setWanted] = useState<number | null>(() =>\n storageKey ? readSaved(storageKey) : null,\n );\n\n const measured = layoutWidth > 0;\n const min = Math.round(toPx(minWidth, layoutWidth));\n // The aside's own minimum wins when both minimums don't fit.\n const max = measured\n ? Math.round(Math.max(layoutWidth - HANDLE_WIDTH - toPx(mainMinWidth, layoutWidth), min))\n : null;\n const clamp = (w: number) => Math.round(Math.min(Math.max(w, min), max ?? Infinity));\n\n const startWidth =\n defaultFraction != null && measured ? layoutWidth * defaultFraction : defaultWidth;\n const width = clamp(wanted ?? startWidth);\n\n // Handlers read the latest render through this ref so they stay stable during a drag.\n const latestRef = useRef({ width, min, max, clamp, storageKey });\n latestRef.current = { width, min, max, clamp, storageKey };\n\n const resize = useCallback((next: number) => {\n const w = latestRef.current.clamp(next);\n setWanted(w);\n return w;\n }, []);\n\n const persist = useCallback((w: number | null) => {\n const key = latestRef.current.storageKey;\n if (key) writeSaved(key, w);\n }, []);\n\n const onPointerDown = useCallback(\n (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n e.preventDefault();\n const startX = e.clientX;\n const from = latestRef.current.width;\n let last = from;\n\n const onMove = (ev: PointerEvent) => {\n last = resize(from - (ev.clientX - startX));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n document.body.style.userSelect = '';\n document.body.style.cursor = '';\n // A click without a drag must not replace a defaultFraction with a fixed width.\n if (last !== from) persist(last);\n };\n\n document.body.style.userSelect = 'none';\n document.body.style.cursor = 'col-resize';\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n },\n [resize, persist],\n );\n\n const onDoubleClick = useCallback(() => {\n setWanted(null);\n persist(null);\n }, [persist]);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n const { width: current, min: lo, max: hi } = latestRef.current;\n let next: number;\n if (e.key === 'ArrowLeft') next = current + KEY_STEP;\n else if (e.key === 'ArrowRight') next = current - KEY_STEP;\n else if (e.key === 'Home') next = lo;\n else if (e.key === 'End' && hi != null) next = hi;\n else return;\n e.preventDefault();\n persist(resize(next));\n },\n [resize, persist],\n );\n\n return (\n <>\n {!stacked && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-controls={paneId}\n aria-valuenow={width}\n aria-valuemin={min}\n aria-valuemax={max ?? undefined}\n tabIndex={0}\n title=\"Drag to resize, double-click to reset\"\n className={handle}\n onPointerDown={onPointerDown}\n onDoubleClick={onDoubleClick}\n onKeyDown={onKeyDown}\n >\n <span className={handleLine} />\n </div>\n )}\n <FlexVanilla\n ref={ref}\n id={paneId}\n direction=\"column\"\n className={cx(aside, className)}\n css={{ ...(stacked ? {} : { width }), ...stickyCss(stacked, stickyTop), ...css }}\n {...props}\n />\n </>\n );\n },\n);\n\nSplitLayoutAsideVanilla.displayName = 'SplitLayoutAsideVanilla';\n"],"mappings":";;;;;;;;;;;AAyBA,IAAM,WAAW;AACjB,IAAM,oBAAsC;AAE5C,IAAM,4BAA4B,OAAO,WAAW,cAAcA,MAAAA,kBAAkBC,MAAAA;AAEpF,IAAM,QAAQ,OAAyB,gBACrC,OAAO,UAAU,WAAW,QAAS,WAAW,KAAK,IAAI,MAAO;AAElE,IAAM,eAAe,QAAgB,SAAS;AAE9C,IAAM,aAAa,QAA+B;CAChD,IAAI;EACF,MAAM,QAAQ,OAAO,OAAO,aAAa,QAAQ,YAAY,GAAG,CAAC,CAAC;EAClE,OAAO,QAAQ,IAAI,QAAQ;CAC7B,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,OAAO,CAClB;CAEA,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAAe,kBAAAA,UAAA,EAAA,UAAA,CACG,CAAC,WACA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,MAAK;EACL,oBAAiB;EACjB,cAAY;EACZ,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,iBAAe,OAAO,KAAA;EACtB,UAAU;EACV,OAAM;EACN,WAAA;EACe;EACA;EACJ;EAEX,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,WAAA,YAAwB,CAAA;CAC3B,CAAA,GAEP,iBAAA,GAAA,kBAAA,IAAA,CAACH,qBAAAA,aAAD;EACO;EACL,IAAI;EACJ,WAAU;EACV,WAAWH,WAAAA,GAAGO,gCAAAA,OAAO,SAAS;EAC9B,KAAK;GAAE,GAAI,UAAU,CAAC,IAAI,EAAE,MAAM;GAAI,GAAG,UAAU,SAAS,SAAS;GAAG,GAAG;EAAI;EAC/E,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CACF;AAEA,wBAAwB,cAAc"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { processCSSProp } from "../../styles/cssProps.js";
|
|
2
|
+
import { cx } from "../../styles/cx.js";
|
|
2
3
|
import { useVanillaExtractTheme } from "../../styles/themeContext.js";
|
|
3
4
|
import { FlexVanilla } from "../Flex/Flex.vanilla.js";
|
|
4
5
|
import { aside, main, root } from "./SplitLayout.vanilla.css.js";
|
|
@@ -73,7 +74,7 @@ var SplitLayoutVanilla = forwardRef(({ breakpoint = 1024, className, css, style,
|
|
|
73
74
|
},
|
|
74
75
|
children: /* @__PURE__ */ jsx("div", {
|
|
75
76
|
ref: setRefs,
|
|
76
|
-
className:
|
|
77
|
+
className: cx(root, className),
|
|
77
78
|
"data-stacked": stacked ? "" : void 0,
|
|
78
79
|
style: {
|
|
79
80
|
...cssStyles,
|
|
@@ -95,7 +96,7 @@ var SplitLayoutMainVanilla = forwardRef(({ stickyTop, minWidth = DEFAULT_MIN_WID
|
|
|
95
96
|
return /* @__PURE__ */ jsx(FlexVanilla, {
|
|
96
97
|
ref,
|
|
97
98
|
direction: "column",
|
|
98
|
-
className:
|
|
99
|
+
className: cx(main, className),
|
|
99
100
|
css: {
|
|
100
101
|
...stickyCss(stacked, stickyTop),
|
|
101
102
|
...css
|
|
@@ -195,7 +196,7 @@ var SplitLayoutAsideVanilla = forwardRef(({ defaultWidth = 360, defaultFraction,
|
|
|
195
196
|
ref,
|
|
196
197
|
id: paneId,
|
|
197
198
|
direction: "column",
|
|
198
|
-
className:
|
|
199
|
+
className: cx(aside, className),
|
|
199
200
|
css: {
|
|
200
201
|
...stacked ? {} : { width },
|
|
201
202
|
...stickyCss(stacked, stickyTop),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitLayout.vanilla.js","names":["_Fragment"],"sources":["../../../components/SplitLayout/SplitLayout.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport type { Gap } from '../../styles/types';\nimport { FlexVanilla } from '../Flex/Flex.vanilla';\nimport { HANDLE_WIDTH } from './SplitLayout.constants';\nimport { aside, handle, handleLine, main, root } from './SplitLayout.vanilla.css';\n\n/** Pixels, or a share of the layout such as `'25%'`. */\nexport type SplitLayoutWidth = number | `${number}%`;\n\nconst KEY_STEP = 16;\nconst DEFAULT_MIN_WIDTH: SplitLayoutWidth = '25%';\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nconst toPx = (width: SplitLayoutWidth, layoutWidth: number) =>\n typeof width === 'number' ? width : (parseFloat(width) / 100) * layoutWidth;\n\nconst storageName = (key: string) => `split:${key}`;\n\nconst readSaved = (key: string): number | null => {\n try {\n const saved = Number(window.localStorage.getItem(storageName(key)));\n return saved > 0 ? saved : null;\n } catch {\n return null;\n }\n};\n\nconst writeSaved = (key: string, width: number | null) => {\n try {\n if (width == null) window.localStorage.removeItem(storageName(key));\n else window.localStorage.setItem(storageName(key), String(width));\n } catch {\n // Storage can be unavailable (private mode, blocked); remembering is only a convenience.\n }\n};\n\nconst useMaxWidth = (px: number) => {\n const query = `(max-width: ${px}px)`;\n const subscribe = useCallback(\n (onChange: () => void) => {\n const mq = window.matchMedia(query);\n mq.addEventListener('change', onChange);\n return () => mq.removeEventListener('change', onChange);\n },\n [query],\n );\n\n return useSyncExternalStore(\n subscribe,\n () => window.matchMedia(query).matches,\n () => false,\n );\n};\n\ntype SplitContextValue = {\n stacked: boolean;\n layoutWidth: number;\n mainMinWidth: SplitLayoutWidth;\n setMainMinWidth: (width: SplitLayoutWidth) => void;\n};\n\nconst SplitContext = createContext<SplitContextValue | null>(null);\n\nconst useSplit = (component: string) => {\n const split = useContext(SplitContext);\n if (!split) throw new Error(`${component} must be used inside SplitLayoutVanilla`);\n return split;\n};\n\nconst stickyCss = (stacked: boolean, stickyTop?: string | number) =>\n !stacked && stickyTop != null ? { position: 'sticky', top: stickyTop } : {};\n\nexport type SplitLayoutVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps & {\n /** The panes stack at this viewport width (px) and below. */\n breakpoint?: number;\n };\n\nexport const SplitLayoutVanilla = forwardRef<HTMLDivElement, SplitLayoutVanillaProps>(\n ({ breakpoint = 1024, className, css, style, children, ...props }, ref) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const setRefs = useCallback(\n (el: HTMLDivElement | null) => {\n containerRef.current = el;\n if (typeof ref === 'function') ref(el);\n else if (ref) ref.current = el;\n },\n [ref],\n );\n\n const stacked = useMaxWidth(breakpoint);\n const [layoutWidth, setLayoutWidth] = useState(0);\n const [mainMinWidth, setMainMinWidth] = useState<SplitLayoutWidth>(DEFAULT_MIN_WIDTH);\n\n useIsomorphicLayoutEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n setLayoutWidth(el.clientWidth);\n const observer = new ResizeObserver(() => setLayoutWidth(el.clientWidth));\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n\n return (\n <SplitContext.Provider value={{ stacked, layoutWidth, mainMinWidth, setMainMinWidth }}>\n <div\n ref={setRefs}\n className={`${root} ${className || ''}`.trim()}\n data-stacked={stacked ? '' : undefined}\n style={{ ...cssStyles, ...style, ...assignInlineVars(vars) }}\n {...props}\n >\n {children}\n </div>\n </SplitContext.Provider>\n );\n },\n);\n\nSplitLayoutVanilla.displayName = 'SplitLayoutVanilla';\n\ntype PaneProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps & {\n gap?: Gap;\n /** Keeps the pane in view while the page scrolls, this far from the top. Off when stacked. */\n stickyTop?: string | number;\n /** The pane never gets narrower than this while resizing. */\n minWidth?: SplitLayoutWidth;\n };\n\nexport type SplitLayoutMainVanillaProps = PaneProps;\n\nexport const SplitLayoutMainVanilla = forwardRef<HTMLDivElement, SplitLayoutMainVanillaProps>(\n ({ stickyTop, minWidth = DEFAULT_MIN_WIDTH, className, css, ...props }, ref) => {\n const { stacked, setMainMinWidth } = useSplit('SplitLayoutMainVanilla');\n\n useIsomorphicLayoutEffect(() => {\n setMainMinWidth(minWidth);\n return () => setMainMinWidth(DEFAULT_MIN_WIDTH);\n }, [minWidth, setMainMinWidth]);\n\n return (\n <FlexVanilla\n ref={ref}\n direction=\"column\"\n className={`${main} ${className || ''}`.trim()}\n css={{ ...stickyCss(stacked, stickyTop), ...css }}\n {...props}\n />\n );\n },\n);\n\nSplitLayoutMainVanilla.displayName = 'SplitLayoutMainVanilla';\n\nexport type SplitLayoutAsideVanillaProps = PaneProps & {\n /** Starting width in px. */\n defaultWidth?: number;\n /** Starting width as a share of the layout, e.g. 0.3. Overrides `defaultWidth`. */\n defaultFraction?: number;\n /** Remembers the width in localStorage under `split:<storageKey>`. */\n storageKey?: string;\n /** Accessible name of the divider. */\n resizeLabel?: string;\n};\n\nexport const SplitLayoutAsideVanilla = forwardRef<HTMLDivElement, SplitLayoutAsideVanillaProps>(\n (\n {\n defaultWidth = 360,\n defaultFraction,\n minWidth = DEFAULT_MIN_WIDTH,\n storageKey,\n resizeLabel = 'Resize',\n stickyTop,\n className,\n css,\n id,\n ...props\n },\n ref,\n ) => {\n const { stacked, layoutWidth, mainMinWidth } = useSplit('SplitLayoutAsideVanilla');\n const generatedId = useId();\n const paneId = id ?? generatedId;\n\n // null means \"use the default\", which may depend on the measured layout width.\n const [wanted, setWanted] = useState<number | null>(() =>\n storageKey ? readSaved(storageKey) : null,\n );\n\n const measured = layoutWidth > 0;\n const min = Math.round(toPx(minWidth, layoutWidth));\n // The aside's own minimum wins when both minimums don't fit.\n const max = measured\n ? Math.round(Math.max(layoutWidth - HANDLE_WIDTH - toPx(mainMinWidth, layoutWidth), min))\n : null;\n const clamp = (w: number) => Math.round(Math.min(Math.max(w, min), max ?? Infinity));\n\n const startWidth =\n defaultFraction != null && measured ? layoutWidth * defaultFraction : defaultWidth;\n const width = clamp(wanted ?? startWidth);\n\n // Handlers read the latest render through this ref so they stay stable during a drag.\n const latestRef = useRef({ width, min, max, clamp, storageKey });\n latestRef.current = { width, min, max, clamp, storageKey };\n\n const resize = useCallback((next: number) => {\n const w = latestRef.current.clamp(next);\n setWanted(w);\n return w;\n }, []);\n\n const persist = useCallback((w: number | null) => {\n const key = latestRef.current.storageKey;\n if (key) writeSaved(key, w);\n }, []);\n\n const onPointerDown = useCallback(\n (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n e.preventDefault();\n const startX = e.clientX;\n const from = latestRef.current.width;\n let last = from;\n\n const onMove = (ev: PointerEvent) => {\n last = resize(from - (ev.clientX - startX));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n document.body.style.userSelect = '';\n document.body.style.cursor = '';\n // A click without a drag must not replace a defaultFraction with a fixed width.\n if (last !== from) persist(last);\n };\n\n document.body.style.userSelect = 'none';\n document.body.style.cursor = 'col-resize';\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n },\n [resize, persist],\n );\n\n const onDoubleClick = useCallback(() => {\n setWanted(null);\n persist(null);\n }, [persist]);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n const { width: current, min: lo, max: hi } = latestRef.current;\n let next: number;\n if (e.key === 'ArrowLeft') next = current + KEY_STEP;\n else if (e.key === 'ArrowRight') next = current - KEY_STEP;\n else if (e.key === 'Home') next = lo;\n else if (e.key === 'End' && hi != null) next = hi;\n else return;\n e.preventDefault();\n persist(resize(next));\n },\n [resize, persist],\n );\n\n return (\n <>\n {!stacked && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-controls={paneId}\n aria-valuenow={width}\n aria-valuemin={min}\n aria-valuemax={max ?? undefined}\n tabIndex={0}\n title=\"Drag to resize, double-click to reset\"\n className={handle}\n onPointerDown={onPointerDown}\n onDoubleClick={onDoubleClick}\n onKeyDown={onKeyDown}\n >\n <span className={handleLine} />\n </div>\n )}\n <FlexVanilla\n ref={ref}\n id={paneId}\n direction=\"column\"\n className={`${aside} ${className || ''}`.trim()}\n css={{ ...(stacked ? {} : { width }), ...stickyCss(stacked, stickyTop), ...css }}\n {...props}\n />\n </>\n );\n },\n);\n\nSplitLayoutAsideVanilla.displayName = 'SplitLayoutAsideVanilla';\n"],"mappings":";;;;;;;;AAwBA,IAAM,WAAW;AACjB,IAAM,oBAAsC;AAE5C,IAAM,4BAA4B,OAAO,WAAW,cAAc,kBAAkB;AAEpF,IAAM,QAAQ,OAAyB,gBACrC,OAAO,UAAU,WAAW,QAAS,WAAW,KAAK,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GAAG,MAAM,GAAG,aAAa,KAAK,KAAK;EAC9C,KAAK;GAAE,GAAI,UAAU,CAAC,IAAI,EAAE,MAAM;GAAI,GAAG,UAAU,SAAS,SAAS;GAAG,GAAG;EAAI;EAC/E,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CACF;AAEA,wBAAwB,cAAc"}
|
|
1
|
+
{"version":3,"file":"SplitLayout.vanilla.js","names":["_Fragment"],"sources":["../../../components/SplitLayout/SplitLayout.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport type { Gap } from '../../styles/types';\nimport { FlexVanilla } from '../Flex/Flex.vanilla';\nimport { HANDLE_WIDTH } from './SplitLayout.constants';\nimport { aside, handle, handleLine, main, root } from './SplitLayout.vanilla.css';\n\n/** Pixels, or a share of the layout such as `'25%'`. */\nexport type SplitLayoutWidth = number | `${number}%`;\n\nconst KEY_STEP = 16;\nconst DEFAULT_MIN_WIDTH: SplitLayoutWidth = '25%';\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nconst toPx = (width: SplitLayoutWidth, layoutWidth: number) =>\n typeof width === 'number' ? width : (parseFloat(width) / 100) * layoutWidth;\n\nconst storageName = (key: string) => `split:${key}`;\n\nconst readSaved = (key: string): number | null => {\n try {\n const saved = Number(window.localStorage.getItem(storageName(key)));\n return saved > 0 ? saved : null;\n } catch {\n return null;\n }\n};\n\nconst writeSaved = (key: string, width: number | null) => {\n try {\n if (width == null) window.localStorage.removeItem(storageName(key));\n else window.localStorage.setItem(storageName(key), String(width));\n } catch {\n // Storage can be unavailable (private mode, blocked); remembering is only a convenience.\n }\n};\n\nconst useMaxWidth = (px: number) => {\n const query = `(max-width: ${px}px)`;\n const subscribe = useCallback(\n (onChange: () => void) => {\n const mq = window.matchMedia(query);\n mq.addEventListener('change', onChange);\n return () => mq.removeEventListener('change', onChange);\n },\n [query],\n );\n\n return useSyncExternalStore(\n subscribe,\n () => window.matchMedia(query).matches,\n () => false,\n );\n};\n\ntype SplitContextValue = {\n stacked: boolean;\n layoutWidth: number;\n mainMinWidth: SplitLayoutWidth;\n setMainMinWidth: (width: SplitLayoutWidth) => void;\n};\n\nconst SplitContext = createContext<SplitContextValue | null>(null);\n\nconst useSplit = (component: string) => {\n const split = useContext(SplitContext);\n if (!split) throw new Error(`${component} must be used inside SplitLayoutVanilla`);\n return split;\n};\n\nconst stickyCss = (stacked: boolean, stickyTop?: string | number) =>\n !stacked && stickyTop != null ? { position: 'sticky', top: stickyTop } : {};\n\nexport type SplitLayoutVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps & {\n /** The panes stack at this viewport width (px) and below. */\n breakpoint?: number;\n };\n\nexport const SplitLayoutVanilla = forwardRef<HTMLDivElement, SplitLayoutVanillaProps>(\n ({ breakpoint = 1024, className, css, style, children, ...props }, ref) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const setRefs = useCallback(\n (el: HTMLDivElement | null) => {\n containerRef.current = el;\n if (typeof ref === 'function') ref(el);\n else if (ref) ref.current = el;\n },\n [ref],\n );\n\n const stacked = useMaxWidth(breakpoint);\n const [layoutWidth, setLayoutWidth] = useState(0);\n const [mainMinWidth, setMainMinWidth] = useState<SplitLayoutWidth>(DEFAULT_MIN_WIDTH);\n\n useIsomorphicLayoutEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n setLayoutWidth(el.clientWidth);\n const observer = new ResizeObserver(() => setLayoutWidth(el.clientWidth));\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n\n return (\n <SplitContext.Provider value={{ stacked, layoutWidth, mainMinWidth, setMainMinWidth }}>\n <div\n ref={setRefs}\n className={cx(root, className)}\n data-stacked={stacked ? '' : undefined}\n style={{ ...cssStyles, ...style, ...assignInlineVars(vars) }}\n {...props}\n >\n {children}\n </div>\n </SplitContext.Provider>\n );\n },\n);\n\nSplitLayoutVanilla.displayName = 'SplitLayoutVanilla';\n\ntype PaneProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps & {\n gap?: Gap;\n /** Keeps the pane in view while the page scrolls, this far from the top. Off when stacked. */\n stickyTop?: string | number;\n /** The pane never gets narrower than this while resizing. */\n minWidth?: SplitLayoutWidth;\n };\n\nexport type SplitLayoutMainVanillaProps = PaneProps;\n\nexport const SplitLayoutMainVanilla = forwardRef<HTMLDivElement, SplitLayoutMainVanillaProps>(\n ({ stickyTop, minWidth = DEFAULT_MIN_WIDTH, className, css, ...props }, ref) => {\n const { stacked, setMainMinWidth } = useSplit('SplitLayoutMainVanilla');\n\n useIsomorphicLayoutEffect(() => {\n setMainMinWidth(minWidth);\n return () => setMainMinWidth(DEFAULT_MIN_WIDTH);\n }, [minWidth, setMainMinWidth]);\n\n return (\n <FlexVanilla\n ref={ref}\n direction=\"column\"\n className={cx(main, className)}\n css={{ ...stickyCss(stacked, stickyTop), ...css }}\n {...props}\n />\n );\n },\n);\n\nSplitLayoutMainVanilla.displayName = 'SplitLayoutMainVanilla';\n\nexport type SplitLayoutAsideVanillaProps = PaneProps & {\n /** Starting width in px. */\n defaultWidth?: number;\n /** Starting width as a share of the layout, e.g. 0.3. Overrides `defaultWidth`. */\n defaultFraction?: number;\n /** Remembers the width in localStorage under `split:<storageKey>`. */\n storageKey?: string;\n /** Accessible name of the divider. */\n resizeLabel?: string;\n};\n\nexport const SplitLayoutAsideVanilla = forwardRef<HTMLDivElement, SplitLayoutAsideVanillaProps>(\n (\n {\n defaultWidth = 360,\n defaultFraction,\n minWidth = DEFAULT_MIN_WIDTH,\n storageKey,\n resizeLabel = 'Resize',\n stickyTop,\n className,\n css,\n id,\n ...props\n },\n ref,\n ) => {\n const { stacked, layoutWidth, mainMinWidth } = useSplit('SplitLayoutAsideVanilla');\n const generatedId = useId();\n const paneId = id ?? generatedId;\n\n // null means \"use the default\", which may depend on the measured layout width.\n const [wanted, setWanted] = useState<number | null>(() =>\n storageKey ? readSaved(storageKey) : null,\n );\n\n const measured = layoutWidth > 0;\n const min = Math.round(toPx(minWidth, layoutWidth));\n // The aside's own minimum wins when both minimums don't fit.\n const max = measured\n ? Math.round(Math.max(layoutWidth - HANDLE_WIDTH - toPx(mainMinWidth, layoutWidth), min))\n : null;\n const clamp = (w: number) => Math.round(Math.min(Math.max(w, min), max ?? Infinity));\n\n const startWidth =\n defaultFraction != null && measured ? layoutWidth * defaultFraction : defaultWidth;\n const width = clamp(wanted ?? startWidth);\n\n // Handlers read the latest render through this ref so they stay stable during a drag.\n const latestRef = useRef({ width, min, max, clamp, storageKey });\n latestRef.current = { width, min, max, clamp, storageKey };\n\n const resize = useCallback((next: number) => {\n const w = latestRef.current.clamp(next);\n setWanted(w);\n return w;\n }, []);\n\n const persist = useCallback((w: number | null) => {\n const key = latestRef.current.storageKey;\n if (key) writeSaved(key, w);\n }, []);\n\n const onPointerDown = useCallback(\n (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n e.preventDefault();\n const startX = e.clientX;\n const from = latestRef.current.width;\n let last = from;\n\n const onMove = (ev: PointerEvent) => {\n last = resize(from - (ev.clientX - startX));\n };\n const onUp = () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n document.body.style.userSelect = '';\n document.body.style.cursor = '';\n // A click without a drag must not replace a defaultFraction with a fixed width.\n if (last !== from) persist(last);\n };\n\n document.body.style.userSelect = 'none';\n document.body.style.cursor = 'col-resize';\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n },\n [resize, persist],\n );\n\n const onDoubleClick = useCallback(() => {\n setWanted(null);\n persist(null);\n }, [persist]);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n const { width: current, min: lo, max: hi } = latestRef.current;\n let next: number;\n if (e.key === 'ArrowLeft') next = current + KEY_STEP;\n else if (e.key === 'ArrowRight') next = current - KEY_STEP;\n else if (e.key === 'Home') next = lo;\n else if (e.key === 'End' && hi != null) next = hi;\n else return;\n e.preventDefault();\n persist(resize(next));\n },\n [resize, persist],\n );\n\n return (\n <>\n {!stacked && (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-controls={paneId}\n aria-valuenow={width}\n aria-valuemin={min}\n aria-valuemax={max ?? undefined}\n tabIndex={0}\n title=\"Drag to resize, double-click to reset\"\n className={handle}\n onPointerDown={onPointerDown}\n onDoubleClick={onDoubleClick}\n onKeyDown={onKeyDown}\n >\n <span className={handleLine} />\n </div>\n )}\n <FlexVanilla\n ref={ref}\n id={paneId}\n direction=\"column\"\n className={cx(aside, className)}\n css={{ ...(stacked ? {} : { width }), ...stickyCss(stacked, stickyTop), ...css }}\n {...props}\n />\n </>\n );\n },\n);\n\nSplitLayoutAsideVanilla.displayName = 'SplitLayoutAsideVanilla';\n"],"mappings":";;;;;;;;;AAyBA,IAAM,WAAW;AACjB,IAAM,oBAAsC;AAE5C,IAAM,4BAA4B,OAAO,WAAW,cAAc,kBAAkB;AAEpF,IAAM,QAAQ,OAAyB,gBACrC,OAAO,UAAU,WAAW,QAAS,WAAW,KAAK,IAAI,MAAO;AAElE,IAAM,eAAe,QAAgB,SAAS;AAE9C,IAAM,aAAa,QAA+B;CAChD,IAAI;EACF,MAAM,QAAQ,OAAO,OAAO,aAAa,QAAQ,YAAY,GAAG,CAAC,CAAC;EAClE,OAAO,QAAQ,IAAI,QAAQ;CAC7B,QAAQ;EACN,OAAO;CACT;AACF;AAEA,IAAM,cAAc,KAAa,UAAyB;CACxD,IAAI;EACF,IAAI,SAAS,MAAM,OAAO,aAAa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C,OAAO,iBAAiB,aAAa,IAAI;EACzC,OAAO,iBAAiB,iBAAiB,IAAI;CAC/C,GACA,CAAC,QAAQ,OAAO,CAClB;CAEA,MAAM,gBAAgB,kBAAkB;EACtC,UAAU,IAAI;EACd,QAAQ,IAAI;CACd,GAAG,CAAC,OAAO,CAAC;CAEZ,MAAM,YAAY,aACf,MAA2B;EAC1B,MAAM,EAAE,OAAO,SAAS,KAAK,IAAI,KAAK,OAAO,UAAU;EACvD,IAAI;EACJ,IAAI,EAAE,QAAQ,aAAa,OAAO,UAAU;OACvC,IAAI,EAAE,QAAQ,cAAc,OAAO,UAAU;OAC7C,IAAI,EAAE,QAAQ,QAAQ,OAAO;OAC7B,IAAI,EAAE,QAAQ,SAAS,MAAM,MAAM,OAAO;OAC1C;EACL,EAAE,eAAe;EACjB,QAAQ,OAAO,IAAI,CAAC;CACtB,GACA,CAAC,QAAQ,OAAO,CAClB;CAEA,OACE,qBAAAA,UAAA,EAAA,UAAA,CACG,CAAC,WACA,oBAAC,OAAD;EACE,MAAK;EACL,oBAAiB;EACjB,cAAY;EACZ,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,iBAAe,OAAO,KAAA;EACtB,UAAU;EACV,OAAM;EACN,WAAA;EACe;EACA;EACJ;EAEX,UAAA,oBAAC,QAAD,EAAM,WAAA,YAAwB,CAAA;CAC3B,CAAA,GAEP,oBAAC,aAAD;EACO;EACL,IAAI;EACJ,WAAU;EACV,WAAW,GAAG,OAAO,SAAS;EAC9B,KAAK;GAAE,GAAI,UAAU,CAAC,IAAI,EAAE,MAAM;GAAI,GAAG,UAAU,SAAS,SAAS;GAAG,GAAG;EAAI;EAC/E,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CACF;AAEA,wBAAwB,cAAc"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_Table_vanilla_css = require("./Table.vanilla.css.cjs");
|
|
3
|
+
let _radix_ui_react_icons = require("@radix-ui/react-icons");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_runtime.__toESM(react, 1);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
// components/Table/ExpandToggle.vanilla.tsx
|
|
8
|
+
var stopEvent = (e) => {
|
|
9
|
+
e.stopPropagation();
|
|
10
|
+
e.preventDefault();
|
|
11
|
+
};
|
|
12
|
+
var ExpandToggleVanilla = ({ label, isOpen, controls, onToggle }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
13
|
+
className: require_Table_vanilla_css.toggle,
|
|
14
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
15
|
+
type: "button",
|
|
16
|
+
className: require_Table_vanilla_css.expandButton,
|
|
17
|
+
"aria-label": label,
|
|
18
|
+
"aria-expanded": isOpen,
|
|
19
|
+
"aria-controls": controls,
|
|
20
|
+
onClick: onToggle,
|
|
21
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.ChevronRightIcon, {
|
|
22
|
+
"aria-hidden": true,
|
|
23
|
+
className: require_Table_vanilla_css.chevron
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
exports.ExpandToggleVanilla = ExpandToggleVanilla;
|
|
28
|
+
exports.stopEvent = stopEvent;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=ExpandToggle.vanilla.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandToggle.vanilla.cjs","names":["toggle","expandButton","ChevronRightIcon","chevron"],"sources":["../../../components/Table/ExpandToggle.vanilla.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { chevron, expandButton, toggle } from './Table.vanilla.css';\n\nexport const stopEvent = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n};\n\ntype ExpandToggleVanillaProps = {\n label: string;\n isOpen: boolean;\n controls: string;\n onToggle: () => void;\n};\n\nexport const ExpandToggleVanilla = ({\n label,\n isOpen,\n controls,\n onToggle,\n}: ExpandToggleVanillaProps) => (\n <div className={toggle}>\n <button\n type=\"button\"\n className={expandButton}\n aria-label={label}\n aria-expanded={isOpen}\n aria-controls={controls}\n onClick={onToggle}\n >\n <ChevronRightIcon aria-hidden className={chevron} />\n </button>\n </div>\n);\n"],"mappings":";;;;;;;AAKA,IAAa,aAAa,MAAwB;CAChD,EAAE,gBAAgB;CAClB,EAAE,eAAe;AACnB;AASA,IAAa,uBAAuB,EAClC,OACA,QACA,UACA,eAEA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;CAAK,WAAWA,0BAAAA;CACd,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EACE,MAAK;EACL,WAAWC,0BAAAA;EACX,cAAY;EACZ,iBAAe;EACf,iBAAe;EACf,SAAS;EAET,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,kBAAD;GAAkB,eAAA;GAAY,WAAWC,0BAAAA;EAAU,CAAA;CAC7C,CAAA;AACL,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { chevron, expandButton, toggle } from "./Table.vanilla.css.js";
|
|
2
|
+
import { ChevronRightIcon } from "@radix-ui/react-icons";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// components/Table/ExpandToggle.vanilla.tsx
|
|
6
|
+
var stopEvent = (e) => {
|
|
7
|
+
e.stopPropagation();
|
|
8
|
+
e.preventDefault();
|
|
9
|
+
};
|
|
10
|
+
var ExpandToggleVanilla = ({ label, isOpen, controls, onToggle }) => /* @__PURE__ */ jsx("div", {
|
|
11
|
+
className: toggle,
|
|
12
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
13
|
+
type: "button",
|
|
14
|
+
className: expandButton,
|
|
15
|
+
"aria-label": label,
|
|
16
|
+
"aria-expanded": isOpen,
|
|
17
|
+
"aria-controls": controls,
|
|
18
|
+
onClick: onToggle,
|
|
19
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
20
|
+
"aria-hidden": true,
|
|
21
|
+
className: chevron
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
export { ExpandToggleVanilla, stopEvent };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=ExpandToggle.vanilla.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandToggle.vanilla.js","names":[],"sources":["../../../components/Table/ExpandToggle.vanilla.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { chevron, expandButton, toggle } from './Table.vanilla.css';\n\nexport const stopEvent = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n};\n\ntype ExpandToggleVanillaProps = {\n label: string;\n isOpen: boolean;\n controls: string;\n onToggle: () => void;\n};\n\nexport const ExpandToggleVanilla = ({\n label,\n isOpen,\n controls,\n onToggle,\n}: ExpandToggleVanillaProps) => (\n <div className={toggle}>\n <button\n type=\"button\"\n className={expandButton}\n aria-label={label}\n aria-expanded={isOpen}\n aria-controls={controls}\n onClick={onToggle}\n >\n <ChevronRightIcon aria-hidden className={chevron} />\n </button>\n </div>\n);\n"],"mappings":";;;;;AAKA,IAAa,aAAa,MAAwB;CAChD,EAAE,gBAAgB;CAClB,EAAE,eAAe;AACnB;AASA,IAAa,uBAAuB,EAClC,OACA,QACA,UACA,eAEA,oBAAC,OAAD;CAAK,WAAW;CACd,UAAA,oBAAC,UAAD;EACE,MAAK;EACL,WAAW;EACX,cAAY;EACZ,iBAAe;EACf,iBAAe;EACf,SAAS;EAET,UAAA,oBAAC,kBAAD;GAAkB,eAAA;GAAY,WAAW;EAAU,CAAA;CAC7C,CAAA;AACL,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_Table_vanilla_css = require("./Table.vanilla.css.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_runtime.__toESM(react, 1);
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
// components/Table/SortButton.vanilla.tsx
|
|
7
|
+
var ARIA_SORT = {
|
|
8
|
+
asc: "ascending",
|
|
9
|
+
desc: "descending"
|
|
10
|
+
};
|
|
11
|
+
var SortButtonVanilla = ({ sort, onSort, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
12
|
+
type: "button",
|
|
13
|
+
className: require_Table_vanilla_css.sortButton,
|
|
14
|
+
onClick: onSort,
|
|
15
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
16
|
+
"aria-hidden": true,
|
|
17
|
+
className: require_Table_vanilla_css.sortIcon,
|
|
18
|
+
width: "8",
|
|
19
|
+
height: "14",
|
|
20
|
+
viewBox: "0 0 8 14",
|
|
21
|
+
fill: "none",
|
|
22
|
+
stroke: "currentColor",
|
|
23
|
+
strokeWidth: "1.5",
|
|
24
|
+
strokeLinecap: "round",
|
|
25
|
+
strokeLinejoin: "round",
|
|
26
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
27
|
+
d: "M1 5 4 2l3 3",
|
|
28
|
+
className: sort === "asc" ? require_Table_vanilla_css.sortIconActive : void 0
|
|
29
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
30
|
+
d: "m1 9 3 3 3-3",
|
|
31
|
+
className: sort === "desc" ? require_Table_vanilla_css.sortIconActive : void 0
|
|
32
|
+
})]
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
exports.ARIA_SORT = ARIA_SORT;
|
|
36
|
+
exports.SortButtonVanilla = SortButtonVanilla;
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=SortButton.vanilla.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortButton.vanilla.cjs","names":["sortButton","sortIcon","sortIconActive"],"sources":["../../../components/Table/SortButton.vanilla.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n\nimport { sortButton, sortIcon, sortIconActive } from './Table.vanilla.css';\nimport { TableSortDirection } from './useTableSort';\n\nexport const ARIA_SORT = { asc: 'ascending', desc: 'descending' } as const;\n\ntype SortButtonVanillaProps = {\n sort?: TableSortDirection;\n onSort: () => void;\n children?: ReactNode;\n};\n\nexport const SortButtonVanilla = ({ sort, onSort, children }: SortButtonVanillaProps) => (\n <button type=\"button\" className={sortButton} onClick={onSort}>\n {children}\n <svg\n aria-hidden\n className={sortIcon}\n width=\"8\"\n height=\"14\"\n viewBox=\"0 0 8 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M1 5 4 2l3 3\" className={sort === 'asc' ? sortIconActive : undefined} />\n <path d=\"m1 9 3 3 3-3\" className={sort === 'desc' ? sortIconActive : undefined} />\n </svg>\n </button>\n);\n"],"mappings":";;;;;;AAKA,IAAa,YAAY;CAAE,KAAK;CAAa,MAAM;AAAa;AAQhE,IAAa,qBAAqB,EAAE,MAAM,QAAQ,eAChD,iBAAA,GAAA,kBAAA,KAAA,CAAC,UAAD;CAAQ,MAAK;CAAS,WAAWA,0BAAAA;CAAY,SAAS;CAAtD,UAAA,CACG,UACD,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,eAAA;EACA,WAAWC,0BAAAA;EACX,OAAM;EACN,QAAO;EACP,SAAQ;EACR,MAAK;EACL,QAAO;EACP,aAAY;EACZ,eAAc;EACd,gBAAe;EAVjB,UAAA,CAYE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,GAAE;GAAe,WAAW,SAAS,QAAQC,0BAAAA,iBAAiB,KAAA;EAAY,CAAA,GAChF,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,GAAE;GAAe,WAAW,SAAS,SAASA,0BAAAA,iBAAiB,KAAA;EAAY,CAAA,CAC9E;CACC,CAAA,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { sortButton, sortIcon, sortIconActive } from "./Table.vanilla.css.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// components/Table/SortButton.vanilla.tsx
|
|
5
|
+
var ARIA_SORT = {
|
|
6
|
+
asc: "ascending",
|
|
7
|
+
desc: "descending"
|
|
8
|
+
};
|
|
9
|
+
var SortButtonVanilla = ({ sort, onSort, children }) => /* @__PURE__ */ jsxs("button", {
|
|
10
|
+
type: "button",
|
|
11
|
+
className: sortButton,
|
|
12
|
+
onClick: onSort,
|
|
13
|
+
children: [children, /* @__PURE__ */ jsxs("svg", {
|
|
14
|
+
"aria-hidden": true,
|
|
15
|
+
className: sortIcon,
|
|
16
|
+
width: "8",
|
|
17
|
+
height: "14",
|
|
18
|
+
viewBox: "0 0 8 14",
|
|
19
|
+
fill: "none",
|
|
20
|
+
stroke: "currentColor",
|
|
21
|
+
strokeWidth: "1.5",
|
|
22
|
+
strokeLinecap: "round",
|
|
23
|
+
strokeLinejoin: "round",
|
|
24
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
25
|
+
d: "M1 5 4 2l3 3",
|
|
26
|
+
className: sort === "asc" ? sortIconActive : void 0
|
|
27
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
28
|
+
d: "m1 9 3 3 3-3",
|
|
29
|
+
className: sort === "desc" ? sortIconActive : void 0
|
|
30
|
+
})]
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
export { ARIA_SORT, SortButtonVanilla };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=SortButton.vanilla.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortButton.vanilla.js","names":[],"sources":["../../../components/Table/SortButton.vanilla.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n\nimport { sortButton, sortIcon, sortIconActive } from './Table.vanilla.css';\nimport { TableSortDirection } from './useTableSort';\n\nexport const ARIA_SORT = { asc: 'ascending', desc: 'descending' } as const;\n\ntype SortButtonVanillaProps = {\n sort?: TableSortDirection;\n onSort: () => void;\n children?: ReactNode;\n};\n\nexport const SortButtonVanilla = ({ sort, onSort, children }: SortButtonVanillaProps) => (\n <button type=\"button\" className={sortButton} onClick={onSort}>\n {children}\n <svg\n aria-hidden\n className={sortIcon}\n width=\"8\"\n height=\"14\"\n viewBox=\"0 0 8 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M1 5 4 2l3 3\" className={sort === 'asc' ? sortIconActive : undefined} />\n <path d=\"m1 9 3 3 3-3\" className={sort === 'desc' ? sortIconActive : undefined} />\n </svg>\n </button>\n);\n"],"mappings":";;;;AAKA,IAAa,YAAY;CAAE,KAAK;CAAa,MAAM;AAAa;AAQhE,IAAa,qBAAqB,EAAE,MAAM,QAAQ,eAChD,qBAAC,UAAD;CAAQ,MAAK;CAAS,WAAW;CAAY,SAAS;CAAtD,UAAA,CACG,UACD,qBAAC,OAAD;EACE,eAAA;EACA,WAAW;EACX,OAAM;EACN,QAAO;EACP,SAAQ;EACR,MAAK;EACL,QAAO;EACP,aAAY;EACZ,eAAc;EACd,gBAAe;EAVjB,UAAA,CAYE,oBAAC,QAAD;GAAM,GAAE;GAAe,WAAW,SAAS,QAAQ,iBAAiB,KAAA;EAAY,CAAA,GAChF,oBAAC,QAAD;GAAM,GAAE;GAAe,WAAW,SAAS,SAAS,iBAAiB,KAAA;EAAY,CAAA,CAC9E;CACC,CAAA,CAAA"}
|
|
@@ -2,10 +2,11 @@ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
const require_stitches_config = require("../../stitches.config.cjs");
|
|
3
3
|
const require_Box = require("../Box/Box.cjs");
|
|
4
4
|
const require_Elevation = require("../Elevation/Elevation.cjs");
|
|
5
|
-
const require_RowLink = require("../RowLink/RowLink.cjs");
|
|
6
5
|
const require_Flex = require("../Flex/Flex.cjs");
|
|
7
|
-
const require_Text = require("../Text/Text.cjs");
|
|
8
6
|
const require_Label = require("../Label/Label.cjs");
|
|
7
|
+
const require_RowLink_utils = require("../RowLink/RowLink.utils.cjs");
|
|
8
|
+
const require_RowLink = require("../RowLink/RowLink.cjs");
|
|
9
|
+
const require_Text = require("../Text/Text.cjs");
|
|
9
10
|
const require_ExpandButton = require("./ExpandButton.cjs");
|
|
10
11
|
let _radix_ui_react_icons = require("@radix-ui/react-icons");
|
|
11
12
|
let react = require("react");
|
|
@@ -106,7 +107,7 @@ var AnimatedTr = ({ id, collapsedContentColSpan, isOpen, children }) => {
|
|
|
106
107
|
})
|
|
107
108
|
}) });
|
|
108
109
|
};
|
|
109
|
-
var Tr = (0, react.forwardRef)(({ children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn = false, tableHead = false, collapsedContentColSpan = 1, css, href, linkAs, linkCell, linkProps, interactive, ...props }, ref) => {
|
|
110
|
+
var Tr = (0, react.forwardRef)(({ children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn = false, tableHead = false, collapsedContentColSpan = 1, css, href, linkAs, linkCell, linkProps, linkOverlay, interactive, onClick, onAuxClick, ...props }, ref) => {
|
|
110
111
|
const [isCollapsed, setIsCollapsed] = (0, react.useState)(false);
|
|
111
112
|
const contentId = (0, react.useId)();
|
|
112
113
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledTr, {
|
|
@@ -116,6 +117,11 @@ var Tr = (0, react.forwardRef)(({ children, collapsedContent, expandLabel = "Exp
|
|
|
116
117
|
[`&:nth-last-child(2) > ${Td}`]: { borderBottom: "none" }
|
|
117
118
|
} : { ...css },
|
|
118
119
|
interactive: interactive ?? (href !== void 0 || void 0),
|
|
120
|
+
onClick: (event) => require_RowLink_utils.handleRowClick(event, onClick),
|
|
121
|
+
onAuxClick: (event) => {
|
|
122
|
+
onAuxClick?.(event);
|
|
123
|
+
require_RowLink_utils.openRowLink(event);
|
|
124
|
+
},
|
|
119
125
|
...props,
|
|
120
126
|
children: [
|
|
121
127
|
emptyFirstColumn ? tableHead ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Th, { css: { width: 24 } }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Td, {}) : null,
|
|
@@ -158,7 +164,8 @@ var Tr = (0, react.forwardRef)(({ children, collapsedContent, expandLabel = "Exp
|
|
|
158
164
|
href,
|
|
159
165
|
linkAs,
|
|
160
166
|
linkCell,
|
|
161
|
-
linkProps
|
|
167
|
+
linkProps,
|
|
168
|
+
linkOverlay
|
|
162
169
|
}, Td)
|
|
163
170
|
]
|
|
164
171
|
}), !!collapsedContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedTr, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.cjs","names":["styled","Text","Label","rowLinkRowStyles","useMemo","Box","forwardRef","useState","useId","_Fragment","Flex","ExpandButton","ChevronRightIcon","withRowLink","rowLinkTableStyles","elevationVariants"],"sources":["../../../components/Table/Table.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React, {\n ComponentProps,\n ElementRef,\n forwardRef,\n ReactNode,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\nimport { Label } from '../Label';\nimport {\n ROW_LINK_CONTROL_Z_INDEX,\n rowLinkRowStyles,\n RowLinkShortcutProps,\n rowLinkTableStyles,\n withRowLink,\n} from '../RowLink';\nimport { Text } from '../Text';\nimport { ExpandButton } from './ExpandButton';\n\nexport const Caption = styled('caption', Text, {\n display: 'table-caption',\n textAlign: 'start',\n fontVariantNumeric: 'proportional-nums',\n fontWeight: '$medium',\n lineHeight: '1.25',\n});\n\nexport const Tbody = styled('tbody', {\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const Th = styled('th', Label, {\n // override Label\n display: 'table-cell',\n verticalAlign: 'inherit',\n\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n\n textAlign: 'start',\n p: '$2 $3',\n borderBottom: '1px solid $tableRowBorder',\n\n variants: {\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n transform: {\n capitalize: {\n display: 'table-cell', // revert Label enforced value\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const Td = styled('td', {\n boxSizing: 'border-box',\n p: '$5 $3',\n borderBottom: '1px solid $tableRowBorder',\n fontSize: '$3',\n lineHeight: '16px',\n verticalAlign: 'inherit',\n variants: {\n subtle: {\n true: {\n fontWeight: '$regular',\n color: '$tableSubtleText',\n },\n },\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const StyledTr = styled('tr', rowLinkRowStyles, {\n verticalAlign: 'inherit',\n '&:hover': {\n color: '$tableHoverText',\n },\n [`&:last-child > ${Td}`]: {\n borderBottom: 'none',\n },\n\n variants: {\n interactive: {\n true: {\n '&:hover': {\n backgroundColor: '$tableHoverBackground',\n cursor: 'pointer',\n },\n },\n },\n active: {\n true: {\n backgroundColor: '$tableHoverBackground',\n color: '$tableActiveText',\n fontWeight: '$semiBold',\n },\n },\n },\n compoundVariants: [\n {\n interactive: true,\n active: true,\n css: {\n '&:hover': {\n color: '$tableActiveHoverText',\n },\n },\n },\n ],\n});\n\nconst AnimatedTr = ({\n id,\n collapsedContentColSpan,\n isOpen,\n children,\n}: {\n id: string;\n collapsedContentColSpan: number;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'padding 0.2s ease-out, visibility 0s' }\n : {\n transition: 'padding 0.2s ease-out, visibility 0s 0.2s',\n visibility: 'hidden',\n lineHeight: 0,\n fontSize: 0,\n padding: '0px 16px',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'all 0.2s ease-out' }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n },\n [isOpen],\n );\n\n return (\n <Tr>\n <Td id={id} colSpan={collapsedContentColSpan} css={appliedStyle}>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </Tr>\n );\n};\nexport type TrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n children: React.ReactNode;\n collapsedContent?: React.ReactNode;\n expandLabel?: string;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n collapsedContentColSpan?: number;\n } & RowLinkShortcutProps;\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, TrProps>(\n (\n {\n children,\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n collapsedContentColSpan = 1,\n css,\n href,\n linkAs,\n linkCell,\n linkProps,\n interactive,\n ...props\n },\n ref,\n ) => {\n const [isCollapsed, setIsCollapsed] = useState(false);\n const contentId = useId();\n\n return (\n <>\n <StyledTr\n ref={ref}\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > ${Td}`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n interactive={interactive ?? (href !== undefined || undefined)}\n {...props}\n >\n {emptyFirstColumn ? tableHead ? <Th css={{ width: 24 }} /> : <Td /> : null}\n {!!collapsedContent && (\n <Td\n css={{ padding: '0 0 0 $3' }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <Flex\n align=\"center\"\n justify=\"center\"\n css={{\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n height: '40px',\n '&:hover': {\n color: '$tableActiveText',\n },\n }}\n >\n <ExpandButton\n type=\"button\"\n css={{ width: '100%', height: '100%' }}\n aria-label={expandLabel}\n aria-expanded={isCollapsed}\n aria-controls={contentId}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n <ChevronRightIcon\n aria-hidden\n style={{\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </ExpandButton>\n </Flex>\n </Td>\n )}\n {withRowLink(children, { href, linkAs, linkCell, linkProps }, Td)}\n </StyledTr>\n {!!collapsedContent && (\n <AnimatedTr\n id={contentId}\n isOpen={isCollapsed}\n collapsedContentColSpan={collapsedContentColSpan}\n >\n {collapsedContent}\n </AnimatedTr>\n )}\n </>\n );\n },\n);\n\nexport const Tfoot = styled('tfoot', {\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableFooterLayerBackground',\n borderRadius: 'inherit',\n },\n\n [`& ${Td}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n p: '$2 $3',\n },\n});\n\nexport const Thead = styled('thead', {\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableHeaderLayerBackground',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n },\n\n [`& ${Th}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n },\n});\n\nexport const Table = styled('table', rowLinkTableStyles, {\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: '$rubik',\n color: '$tableText',\n borderRadius: '$3',\n overflow: 'hidden',\n [`& ${Tbody}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n [`& ${Td}`]: {\n borderTop: '1px solid $tableRowBorder',\n },\n },\n [`& ${Thead}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nexport type TableVariants = VariantProps<typeof Table>;\nexport type TableProps = TableVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;;;;;;;;;AA0BA,IAAa,UAAUA,wBAAAA,OAAO,WAAWC,aAAAA,MAAM;CAC7C,SAAS;CACT,WAAW;CACX,oBAAoB;CACpB,YAAY;CACZ,YAAY;AACd,CAAC;AAED,IAAa,QAAQD,wBAAAA,OAAO,SAAS;CACnC,OAAO;CACP,eAAe;AACjB,CAAC;AAED,IAAa,KAAKA,wBAAAA,OAAO,MAAME,cAAAA,OAAO;CAEpC,SAAS;CACT,eAAe;CAEf,qBAAqB;CACrB,sBAAsB;CAEtB,WAAW;CACX,GAAG;CACH,cAAc;CAEd,UAAU;EACR,OAAO;GACL,OAAO,EACL,WAAW,QACb;GACA,QAAQ,EACN,WAAW,SACb;GACA,KAAK,EACH,WAAW,MACb;EACF;EACA,WAAW,EACT,YAAY,EACV,SAAS,aACX,EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,IAAa,KAAKF,wBAAAA,OAAO,MAAM;CAC7B,WAAW;CACX,GAAG;CACH,cAAc;CACd,UAAU;CACV,YAAY;CACZ,eAAe;CACf,UAAU;EACR,QAAQ,EACN,MAAM;GACJ,YAAY;GACZ,OAAO;EACT,EACF;EACA,OAAO;GACL,OAAO,EACL,WAAW,QACb;GACA,QAAQ,EACN,WAAW,SACb;G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AA;IACV,CAAA;GACJ,CAAA;GAELC,gBAAAA,YAAY,UAAU;IAAE;IAAM;IAAQ;IAAU;GAAU,GAAG,EAAE;EACxD;CACT,CAAA,GAAA,CAAC,CAAC,oBACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD;EACE,IAAI;EACJ,QAAQ;EACiB;EAExB,UAAA;CACS,CAAA,CAEd,EAAA,CAAA;AAEN,CACF;AAEA,IAAa,QAAQb,wBAAAA,OAAO,SAAS;CACnC,eAAe;CACf,UAAU;CACV,cAAc;CAEd,YAAY;EACV,eAAe;EACf,SAAS;EACT,UAAU;EACV,OAAO;EACP,iBAAiB;EACjB,cAAc;CAChB;EAEC,KAAK,OAAO;EACX,UAAU;EACV,OAAO;EACP,YAAY;EACZ,GAAG;CACL;AACF,CAAC;AAED,IAAa,QAAQA,wBAAAA,OAAO,SAAS;CACnC,UAAU;CACV,qBAAqB;CACrB,sBAAsB;CACtB,eAAe;CAEf,YAAY;EACV,eAAe;EACf,SAAS;EACT,UAAU;EACV,OAAO;EACP,iBAAiB;EACjB,qBAAqB;EACrB,sBAAsB;CACxB;EAEC,KAAK,OAAO;EACX,UAAU;EACV,OAAO;EACP,YAAY;CACd;AACF,CAAC;AAED,IAAa,QAAQA,wBAAAA,OAAO,SAASc,gBAAAA,oBAAoB;CACvD,OAAO;CACP,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,eAAe;CACf,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;EACT,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;GACrB,KAAK,OAAO,EACX,WAAW,4BACb;CACF;EACC,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;CACxB;CAEA,UAAU,EACR,WAAWC,kBAAAA,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"Table.cjs","names":["styled","Text","Label","rowLinkRowStyles","useMemo","Box","forwardRef","useState","useId","_Fragment","handleRowClick","Flex","ExpandButton","ChevronRightIcon","withRowLink","rowLinkTableStyles","elevationVariants"],"sources":["../../../components/Table/Table.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React, {\n ComponentProps,\n ElementRef,\n forwardRef,\n ReactNode,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\nimport { Label } from '../Label';\nimport {\n handleRowClick,\n openRowLink,\n ROW_LINK_CONTROL_Z_INDEX,\n rowLinkRowStyles,\n RowLinkShortcutProps,\n rowLinkTableStyles,\n withRowLink,\n} from '../RowLink';\nimport { Text } from '../Text';\nimport { ExpandButton } from './ExpandButton';\n\nexport const Caption = styled('caption', Text, {\n display: 'table-caption',\n textAlign: 'start',\n fontVariantNumeric: 'proportional-nums',\n fontWeight: '$medium',\n lineHeight: '1.25',\n});\n\nexport const Tbody = styled('tbody', {\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const Th = styled('th', Label, {\n // override Label\n display: 'table-cell',\n verticalAlign: 'inherit',\n\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n\n textAlign: 'start',\n p: '$2 $3',\n borderBottom: '1px solid $tableRowBorder',\n\n variants: {\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n transform: {\n capitalize: {\n display: 'table-cell', // revert Label enforced value\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const Td = styled('td', {\n boxSizing: 'border-box',\n p: '$5 $3',\n borderBottom: '1px solid $tableRowBorder',\n fontSize: '$3',\n lineHeight: '16px',\n verticalAlign: 'inherit',\n variants: {\n subtle: {\n true: {\n fontWeight: '$regular',\n color: '$tableSubtleText',\n },\n },\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const StyledTr = styled('tr', rowLinkRowStyles, {\n verticalAlign: 'inherit',\n '&:hover': {\n color: '$tableHoverText',\n },\n [`&:last-child > ${Td}`]: {\n borderBottom: 'none',\n },\n\n variants: {\n interactive: {\n true: {\n '&:hover': {\n backgroundColor: '$tableHoverBackground',\n cursor: 'pointer',\n },\n },\n },\n active: {\n true: {\n backgroundColor: '$tableHoverBackground',\n color: '$tableActiveText',\n fontWeight: '$semiBold',\n },\n },\n },\n compoundVariants: [\n {\n interactive: true,\n active: true,\n css: {\n '&:hover': {\n color: '$tableActiveHoverText',\n },\n },\n },\n ],\n});\n\nconst AnimatedTr = ({\n id,\n collapsedContentColSpan,\n isOpen,\n children,\n}: {\n id: string;\n collapsedContentColSpan: number;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'padding 0.2s ease-out, visibility 0s' }\n : {\n transition: 'padding 0.2s ease-out, visibility 0s 0.2s',\n visibility: 'hidden',\n lineHeight: 0,\n fontSize: 0,\n padding: '0px 16px',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'all 0.2s ease-out' }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n },\n [isOpen],\n );\n\n return (\n <Tr>\n <Td id={id} colSpan={collapsedContentColSpan} css={appliedStyle}>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </Tr>\n );\n};\nexport type TrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n children: React.ReactNode;\n collapsedContent?: React.ReactNode;\n expandLabel?: string;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n collapsedContentColSpan?: number;\n } & RowLinkShortcutProps;\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, TrProps>(\n (\n {\n children,\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n collapsedContentColSpan = 1,\n css,\n href,\n linkAs,\n linkCell,\n linkProps,\n linkOverlay,\n interactive,\n onClick,\n onAuxClick,\n ...props\n },\n ref,\n ) => {\n const [isCollapsed, setIsCollapsed] = useState(false);\n const contentId = useId();\n\n return (\n <>\n <StyledTr\n ref={ref}\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > ${Td}`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n interactive={interactive ?? (href !== undefined || undefined)}\n onClick={(event) => handleRowClick(event, onClick)}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\n {...props}\n >\n {emptyFirstColumn ? tableHead ? <Th css={{ width: 24 }} /> : <Td /> : null}\n {!!collapsedContent && (\n <Td\n css={{ padding: '0 0 0 $3' }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <Flex\n align=\"center\"\n justify=\"center\"\n css={{\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n height: '40px',\n '&:hover': {\n color: '$tableActiveText',\n },\n }}\n >\n <ExpandButton\n type=\"button\"\n css={{ width: '100%', height: '100%' }}\n aria-label={expandLabel}\n aria-expanded={isCollapsed}\n aria-controls={contentId}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n <ChevronRightIcon\n aria-hidden\n style={{\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </ExpandButton>\n </Flex>\n </Td>\n )}\n {withRowLink(children, { href, linkAs, linkCell, linkProps, linkOverlay }, Td)}\n </StyledTr>\n {!!collapsedContent && (\n <AnimatedTr\n id={contentId}\n isOpen={isCollapsed}\n collapsedContentColSpan={collapsedContentColSpan}\n >\n {collapsedContent}\n </AnimatedTr>\n )}\n </>\n );\n },\n);\n\nexport const Tfoot = styled('tfoot', {\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableFooterLayerBackground',\n borderRadius: 'inherit',\n },\n\n [`& ${Td}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n p: '$2 $3',\n },\n});\n\nexport const Thead = styled('thead', {\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableHeaderLayerBackground',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n },\n\n [`& ${Th}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n },\n});\n\nexport const Table = styled('table', rowLinkTableStyles, {\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: '$rubik',\n color: '$tableText',\n borderRadius: '$3',\n overflow: 'hidden',\n [`& ${Tbody}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n [`& ${Td}`]: {\n borderTop: '1px solid $tableRowBorder',\n },\n },\n [`& ${Thead}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nexport type TableVariants = VariantProps<typeof Table>;\nexport type TableProps = TableVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,IAAa,UAAUA,wBAAAA,OAAO,WAAWC,aAAAA,MAAM;CAC7C,SAAS;CACT,WAAW;CACX,oBAAoB;CACpB,YAAY;CACZ,YAAY;AACd,CAAC;AAED,IAAa,QAAQD,wBAAAA,OAAO,SAAS;CACnC,OAAO;CACP,eA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QAAQA,wBAAAA,OAAO,SAAS;CACnC,UAAU;CACV,qBAAqB;CACrB,sBAAsB;CACtB,eAAe;CAEf,YAAY;EACV,eAAe;EACf,SAAS;EACT,UAAU;EACV,OAAO;EACP,iBAAiB;EACjB,qBAAqB;EACrB,sBAAsB;CACxB;EAEC,KAAK,OAAO;EACX,UAAU;EACV,OAAO;EACP,YAAY;CACd;AACF,CAAC;AAED,IAAa,QAAQA,wBAAAA,OAAO,SAASe,gBAAAA,oBAAoB;CACvD,OAAO;CACP,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,eAAe;CACf,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;EACT,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;GACrB,KAAK,OAAO,EACX,WAAW,4BACb;CACF;EACC,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;CACxB;CAEA,UAAU,EACR,WAAWC,kBAAAA,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { styled } from "../../stitches.config.js";
|
|
2
2
|
import { Box } from "../Box/Box.js";
|
|
3
3
|
import { elevationVariants } from "../Elevation/Elevation.js";
|
|
4
|
-
import { rowLinkRowStyles, rowLinkTableStyles, withRowLink } from "../RowLink/RowLink.js";
|
|
5
4
|
import { Flex } from "../Flex/Flex.js";
|
|
6
|
-
import { Text } from "../Text/Text.js";
|
|
7
5
|
import { Label } from "../Label/Label.js";
|
|
6
|
+
import { handleRowClick, openRowLink } from "../RowLink/RowLink.utils.js";
|
|
7
|
+
import { rowLinkRowStyles, rowLinkTableStyles, withRowLink } from "../RowLink/RowLink.js";
|
|
8
|
+
import { Text } from "../Text/Text.js";
|
|
8
9
|
import { ExpandButton } from "./ExpandButton.js";
|
|
9
10
|
import { ChevronRightIcon } from "@radix-ui/react-icons";
|
|
10
11
|
import { forwardRef, useId, useMemo, useState } from "react";
|
|
@@ -104,7 +105,7 @@ var AnimatedTr = ({ id, collapsedContentColSpan, isOpen, children }) => {
|
|
|
104
105
|
})
|
|
105
106
|
}) });
|
|
106
107
|
};
|
|
107
|
-
var Tr = forwardRef(({ children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn = false, tableHead = false, collapsedContentColSpan = 1, css, href, linkAs, linkCell, linkProps, interactive, ...props }, ref) => {
|
|
108
|
+
var Tr = forwardRef(({ children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn = false, tableHead = false, collapsedContentColSpan = 1, css, href, linkAs, linkCell, linkProps, linkOverlay, interactive, onClick, onAuxClick, ...props }, ref) => {
|
|
108
109
|
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
109
110
|
const contentId = useId();
|
|
110
111
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(StyledTr, {
|
|
@@ -114,6 +115,11 @@ var Tr = forwardRef(({ children, collapsedContent, expandLabel = "Expand row", e
|
|
|
114
115
|
[`&:nth-last-child(2) > ${Td}`]: { borderBottom: "none" }
|
|
115
116
|
} : { ...css },
|
|
116
117
|
interactive: interactive ?? (href !== void 0 || void 0),
|
|
118
|
+
onClick: (event) => handleRowClick(event, onClick),
|
|
119
|
+
onAuxClick: (event) => {
|
|
120
|
+
onAuxClick?.(event);
|
|
121
|
+
openRowLink(event);
|
|
122
|
+
},
|
|
117
123
|
...props,
|
|
118
124
|
children: [
|
|
119
125
|
emptyFirstColumn ? tableHead ? /* @__PURE__ */ jsx(Th, { css: { width: 24 } }) : /* @__PURE__ */ jsx(Td, {}) : null,
|
|
@@ -156,7 +162,8 @@ var Tr = forwardRef(({ children, collapsedContent, expandLabel = "Expand row", e
|
|
|
156
162
|
href,
|
|
157
163
|
linkAs,
|
|
158
164
|
linkCell,
|
|
159
|
-
linkProps
|
|
165
|
+
linkProps,
|
|
166
|
+
linkOverlay
|
|
160
167
|
}, Td)
|
|
161
168
|
]
|
|
162
169
|
}), !!collapsedContent && /* @__PURE__ */ jsx(AnimatedTr, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","names":["_Fragment"],"sources":["../../../components/Table/Table.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React, {\n ComponentProps,\n ElementRef,\n forwardRef,\n ReactNode,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\nimport { Label } from '../Label';\nimport {\n ROW_LINK_CONTROL_Z_INDEX,\n rowLinkRowStyles,\n RowLinkShortcutProps,\n rowLinkTableStyles,\n withRowLink,\n} from '../RowLink';\nimport { Text } from '../Text';\nimport { ExpandButton } from './ExpandButton';\n\nexport const Caption = styled('caption', Text, {\n display: 'table-caption',\n textAlign: 'start',\n fontVariantNumeric: 'proportional-nums',\n fontWeight: '$medium',\n lineHeight: '1.25',\n});\n\nexport const Tbody = styled('tbody', {\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const Th = styled('th', Label, {\n // override Label\n display: 'table-cell',\n verticalAlign: 'inherit',\n\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n\n textAlign: 'start',\n p: '$2 $3',\n borderBottom: '1px solid $tableRowBorder',\n\n variants: {\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n transform: {\n capitalize: {\n display: 'table-cell', // revert Label enforced value\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const Td = styled('td', {\n boxSizing: 'border-box',\n p: '$5 $3',\n borderBottom: '1px solid $tableRowBorder',\n fontSize: '$3',\n lineHeight: '16px',\n verticalAlign: 'inherit',\n variants: {\n subtle: {\n true: {\n fontWeight: '$regular',\n color: '$tableSubtleText',\n },\n },\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const StyledTr = styled('tr', rowLinkRowStyles, {\n verticalAlign: 'inherit',\n '&:hover': {\n color: '$tableHoverText',\n },\n [`&:last-child > ${Td}`]: {\n borderBottom: 'none',\n },\n\n variants: {\n interactive: {\n true: {\n '&:hover': {\n backgroundColor: '$tableHoverBackground',\n cursor: 'pointer',\n },\n },\n },\n active: {\n true: {\n backgroundColor: '$tableHoverBackground',\n color: '$tableActiveText',\n fontWeight: '$semiBold',\n },\n },\n },\n compoundVariants: [\n {\n interactive: true,\n active: true,\n css: {\n '&:hover': {\n color: '$tableActiveHoverText',\n },\n },\n },\n ],\n});\n\nconst AnimatedTr = ({\n id,\n collapsedContentColSpan,\n isOpen,\n children,\n}: {\n id: string;\n collapsedContentColSpan: number;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'padding 0.2s ease-out, visibility 0s' }\n : {\n transition: 'padding 0.2s ease-out, visibility 0s 0.2s',\n visibility: 'hidden',\n lineHeight: 0,\n fontSize: 0,\n padding: '0px 16px',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'all 0.2s ease-out' }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n },\n [isOpen],\n );\n\n return (\n <Tr>\n <Td id={id} colSpan={collapsedContentColSpan} css={appliedStyle}>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </Tr>\n );\n};\nexport type TrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n children: React.ReactNode;\n collapsedContent?: React.ReactNode;\n expandLabel?: string;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n collapsedContentColSpan?: number;\n } & RowLinkShortcutProps;\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, TrProps>(\n (\n {\n children,\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n collapsedContentColSpan = 1,\n css,\n href,\n linkAs,\n linkCell,\n linkProps,\n interactive,\n ...props\n },\n ref,\n ) => {\n const [isCollapsed, setIsCollapsed] = useState(false);\n const contentId = useId();\n\n return (\n <>\n <StyledTr\n ref={ref}\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > ${Td}`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n interactive={interactive ?? (href !== undefined || undefined)}\n {...props}\n >\n {emptyFirstColumn ? tableHead ? <Th css={{ width: 24 }} /> : <Td /> : null}\n {!!collapsedContent && (\n <Td\n css={{ padding: '0 0 0 $3' }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <Flex\n align=\"center\"\n justify=\"center\"\n css={{\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n height: '40px',\n '&:hover': {\n color: '$tableActiveText',\n },\n }}\n >\n <ExpandButton\n type=\"button\"\n css={{ width: '100%', height: '100%' }}\n aria-label={expandLabel}\n aria-expanded={isCollapsed}\n aria-controls={contentId}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n <ChevronRightIcon\n aria-hidden\n style={{\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </ExpandButton>\n </Flex>\n </Td>\n )}\n {withRowLink(children, { href, linkAs, linkCell, linkProps }, Td)}\n </StyledTr>\n {!!collapsedContent && (\n <AnimatedTr\n id={contentId}\n isOpen={isCollapsed}\n collapsedContentColSpan={collapsedContentColSpan}\n >\n {collapsedContent}\n </AnimatedTr>\n )}\n </>\n );\n },\n);\n\nexport const Tfoot = styled('tfoot', {\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableFooterLayerBackground',\n borderRadius: 'inherit',\n },\n\n [`& ${Td}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n p: '$2 $3',\n },\n});\n\nexport const Thead = styled('thead', {\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableHeaderLayerBackground',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n },\n\n [`& ${Th}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n },\n});\n\nexport const Table = styled('table', rowLinkTableStyles, {\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: '$rubik',\n color: '$tableText',\n borderRadius: '$3',\n overflow: 'hidden',\n [`& ${Tbody}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n [`& ${Td}`]: {\n borderTop: '1px solid $tableRowBorder',\n },\n },\n [`& ${Thead}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nexport type TableVariants = VariantProps<typeof Table>;\nexport type TableProps = TableVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;;;;;;;AA0BA,IAAa,UAAU,OAAO,WAAW,MAAM;CAC7C,SAAS;CACT,WAAW;CACX,oBAAoB;CACpB,YAAY;CACZ,YAAY;AACd,CAAC;AAED,IAAa,QAAQ,OAAO,SAAS;CACnC,OAAO;CACP,eAAe;AACjB,CAAC;AAED,IAAa,KAAK,OAAO,MAAM,OAAO;CAEpC,SAAS;CACT,eAAe;CAEf,qBAAqB;CACrB,sBAAsB;CAEtB,WAAW;CACX,GAAG;CACH,cAAc;CAEd,UAAU;EACR,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,UAAU;IAAE;IAAM;IAAQ;IAAU;GAAU,GAAG,EAAE;EACxD;CACT,CAAA,GAAA,CAAC,CAAC,oBACD,oBAAC,YAAD;EACE,IAAI;EACJ,QAAQ;EACiB;EAExB,UAAA;CACS,CAAA,CAEd,EAAA,CAAA;AAEN,CACF;AAEA,IAAa,QAAQ,OAAO,SAAS;CACnC,eAAe;CACf,UAAU;CACV,cAAc;CAEd,YAAY;EACV,eAAe;EACf,SAAS;EACT,UAAU;EACV,OAAO;EACP,iBAAiB;EACjB,cAAc;CAChB;EAEC,KAAK,OAAO;EACX,UAAU;EACV,OAAO;EACP,YAAY;EACZ,GAAG;CACL;AACF,CAAC;AAED,IAAa,QAAQ,OAAO,SAAS;CACnC,UAAU;CACV,qBAAqB;CACrB,sBAAsB;CACtB,eAAe;CAEf,YAAY;EACV,eAAe;EACf,SAAS;EACT,UAAU;EACV,OAAO;EACP,iBAAiB;EACjB,qBAAqB;EACrB,sBAAsB;CACxB;EAEC,KAAK,OAAO;EACX,UAAU;EACV,OAAO;EACP,YAAY;CACd;AACF,CAAC;AAED,IAAa,QAAQ,OAAO,SAAS,oBAAoB;CACvD,OAAO;CACP,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,eAAe;CACf,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;EACT,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;GACrB,KAAK,OAAO,EACX,WAAW,4BACb;CACF;EACC,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;CACxB;CAEA,UAAU,EACR,WAAW,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"Table.js","names":["_Fragment"],"sources":["../../../components/Table/Table.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React, {\n ComponentProps,\n ElementRef,\n forwardRef,\n ReactNode,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\nimport { Label } from '../Label';\nimport {\n handleRowClick,\n openRowLink,\n ROW_LINK_CONTROL_Z_INDEX,\n rowLinkRowStyles,\n RowLinkShortcutProps,\n rowLinkTableStyles,\n withRowLink,\n} from '../RowLink';\nimport { Text } from '../Text';\nimport { ExpandButton } from './ExpandButton';\n\nexport const Caption = styled('caption', Text, {\n display: 'table-caption',\n textAlign: 'start',\n fontVariantNumeric: 'proportional-nums',\n fontWeight: '$medium',\n lineHeight: '1.25',\n});\n\nexport const Tbody = styled('tbody', {\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const Th = styled('th', Label, {\n // override Label\n display: 'table-cell',\n verticalAlign: 'inherit',\n\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n\n textAlign: 'start',\n p: '$2 $3',\n borderBottom: '1px solid $tableRowBorder',\n\n variants: {\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n transform: {\n capitalize: {\n display: 'table-cell', // revert Label enforced value\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const Td = styled('td', {\n boxSizing: 'border-box',\n p: '$5 $3',\n borderBottom: '1px solid $tableRowBorder',\n fontSize: '$3',\n lineHeight: '16px',\n verticalAlign: 'inherit',\n variants: {\n subtle: {\n true: {\n fontWeight: '$regular',\n color: '$tableSubtleText',\n },\n },\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const StyledTr = styled('tr', rowLinkRowStyles, {\n verticalAlign: 'inherit',\n '&:hover': {\n color: '$tableHoverText',\n },\n [`&:last-child > ${Td}`]: {\n borderBottom: 'none',\n },\n\n variants: {\n interactive: {\n true: {\n '&:hover': {\n backgroundColor: '$tableHoverBackground',\n cursor: 'pointer',\n },\n },\n },\n active: {\n true: {\n backgroundColor: '$tableHoverBackground',\n color: '$tableActiveText',\n fontWeight: '$semiBold',\n },\n },\n },\n compoundVariants: [\n {\n interactive: true,\n active: true,\n css: {\n '&:hover': {\n color: '$tableActiveHoverText',\n },\n },\n },\n ],\n});\n\nconst AnimatedTr = ({\n id,\n collapsedContentColSpan,\n isOpen,\n children,\n}: {\n id: string;\n collapsedContentColSpan: number;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'padding 0.2s ease-out, visibility 0s' }\n : {\n transition: 'padding 0.2s ease-out, visibility 0s 0.2s',\n visibility: 'hidden',\n lineHeight: 0,\n fontSize: 0,\n padding: '0px 16px',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'all 0.2s ease-out' }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n },\n [isOpen],\n );\n\n return (\n <Tr>\n <Td id={id} colSpan={collapsedContentColSpan} css={appliedStyle}>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </Tr>\n );\n};\nexport type TrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n children: React.ReactNode;\n collapsedContent?: React.ReactNode;\n expandLabel?: string;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n collapsedContentColSpan?: number;\n } & RowLinkShortcutProps;\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, TrProps>(\n (\n {\n children,\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n collapsedContentColSpan = 1,\n css,\n href,\n linkAs,\n linkCell,\n linkProps,\n linkOverlay,\n interactive,\n onClick,\n onAuxClick,\n ...props\n },\n ref,\n ) => {\n const [isCollapsed, setIsCollapsed] = useState(false);\n const contentId = useId();\n\n return (\n <>\n <StyledTr\n ref={ref}\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > ${Td}`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n interactive={interactive ?? (href !== undefined || undefined)}\n onClick={(event) => handleRowClick(event, onClick)}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\n {...props}\n >\n {emptyFirstColumn ? tableHead ? <Th css={{ width: 24 }} /> : <Td /> : null}\n {!!collapsedContent && (\n <Td\n css={{ padding: '0 0 0 $3' }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <Flex\n align=\"center\"\n justify=\"center\"\n css={{\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n height: '40px',\n '&:hover': {\n color: '$tableActiveText',\n },\n }}\n >\n <ExpandButton\n type=\"button\"\n css={{ width: '100%', height: '100%' }}\n aria-label={expandLabel}\n aria-expanded={isCollapsed}\n aria-controls={contentId}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n <ChevronRightIcon\n aria-hidden\n style={{\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </ExpandButton>\n </Flex>\n </Td>\n )}\n {withRowLink(children, { href, linkAs, linkCell, linkProps, linkOverlay }, Td)}\n </StyledTr>\n {!!collapsedContent && (\n <AnimatedTr\n id={contentId}\n isOpen={isCollapsed}\n collapsedContentColSpan={collapsedContentColSpan}\n >\n {collapsedContent}\n </AnimatedTr>\n )}\n </>\n );\n },\n);\n\nexport const Tfoot = styled('tfoot', {\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableFooterLayerBackground',\n borderRadius: 'inherit',\n },\n\n [`& ${Td}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n p: '$2 $3',\n },\n});\n\nexport const Thead = styled('thead', {\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableHeaderLayerBackground',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n },\n\n [`& ${Th}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n },\n});\n\nexport const Table = styled('table', rowLinkTableStyles, {\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: '$rubik',\n color: '$tableText',\n borderRadius: '$3',\n overflow: 'hidden',\n [`& ${Tbody}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n [`& ${Td}`]: {\n borderTop: '1px solid $tableRowBorder',\n },\n },\n [`& ${Thead}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nexport type TableVariants = VariantProps<typeof Table>;\nexport type TableProps = TableVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;;;;;;;;AA4BA,IAAa,UAAU,OAAO,WAAW,MAAM;CAC7C,SAAS;CACT,WAAW;CACX,oBAAoB;CACpB,YAAY;CACZ,YAAY;AACd,CAAC;AAED,IAAa,QAAQ,OAAO,SAAS;CACnC,OAAO;CACP,eAAe;AACjB,CAAC;AAED,IAAa,KAAK,OAAO,MAAM,OAAO;CAEpC,SAAS;CACT,eAAe;CAEf,qBAAqB;CACrB,sBAAsB;CAEtB,WAAW;CACX,GAAG;CACH,cAAc;CAEd,UAAU;EACR,OAAO;GACL,OAAO,EACL,WAAW,QACb;GACA,QAAQ,EACN,WAAW,SACb;GACA,KAAK,EACH,WAAW,MACb;EACF;EACA,WAAW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