@traefik-labs/faency 13.6.0 → 13.7.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.
Files changed (37) hide show
  1. package/dist/components/AriaTable/AriaTable.js +4 -4
  2. package/dist/components/AriaTable/AriaTable.js.map +1 -1
  3. package/dist/components/AriaTable/AriaTable.vanilla.js +3 -3
  4. package/dist/components/AriaTable/AriaTable.vanilla.js.map +1 -1
  5. package/dist/components/Elevation/Elevation.vanilla.css.cjs.map +1 -1
  6. package/dist/components/Elevation/Elevation.vanilla.css.js.map +1 -1
  7. package/dist/components/Field/Field.js +5 -5
  8. package/dist/components/Field/Field.js.map +1 -1
  9. package/dist/components/Field/Field.vanilla.js +5 -5
  10. package/dist/components/Field/Field.vanilla.js.map +1 -1
  11. package/dist/components/List/List.vanilla.cjs +128 -0
  12. package/dist/components/List/List.vanilla.cjs.map +1 -0
  13. package/dist/components/List/List.vanilla.css.cjs +30 -0
  14. package/dist/components/List/List.vanilla.css.cjs.map +1 -0
  15. package/dist/components/List/List.vanilla.css.js +25 -0
  16. package/dist/components/List/List.vanilla.css.js.map +1 -0
  17. package/dist/components/List/List.vanilla.js +124 -0
  18. package/dist/components/List/List.vanilla.js.map +1 -0
  19. package/dist/components/SplitLayout/SplitLayout.vanilla.js +2 -2
  20. package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -1
  21. package/dist/components/Table/Table.js +2 -2
  22. package/dist/components/Table/Table.js.map +1 -1
  23. package/dist/components/Table/Table.vanilla.js +2 -2
  24. package/dist/components/Table/Table.vanilla.js.map +1 -1
  25. package/dist/components/TextField/TextField.vanilla.js +2 -2
  26. package/dist/components/TextField/TextField.vanilla.js.map +1 -1
  27. package/dist/faency.css +2051 -1877
  28. package/dist/index.cjs +4 -0
  29. package/dist/index.d.ts +112 -34
  30. package/dist/index.js +2 -1
  31. package/dist/styles/themes.css.cjs.map +1 -1
  32. package/dist/styles/themes.css.js.map +1 -1
  33. package/dist/styles/tokens.css.cjs +93 -90
  34. package/dist/styles/tokens.css.cjs.map +1 -1
  35. package/dist/styles/tokens.css.js +93 -90
  36. package/dist/styles/tokens.css.js.map +1 -1
  37. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.vanilla.css.js","names":["_7a468"],"sources":["../../../components/List/List.vanilla.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\nimport { elevationVariants } from '../Elevation/Elevation.vanilla.css';\n\nconst list = {\n margin: '0 0 0 8px',\n padding: 0,\n color: tokens.colors.textDefault,\n};\n\nexport const ul = style(list);\nexport const ol = style(list);\n\nconst checkboxList = `${ul}:has(> li > span > input[type=\"checkbox\"])`;\n\nglobalStyle(checkboxList, {\n margin: 0,\n listStyle: 'none',\n});\n\nglobalStyle(`${checkboxList} > li`, {\n marginLeft: 0,\n});\n\nglobalStyle(`${checkboxList} > li > span input`, {\n margin: '0 3px 0 0',\n});\n\n// A nested checkbox list keeps its indentation.\nglobalStyle(`li > ${checkboxList}, li > ${checkboxList} > li`, {\n marginLeft: tokens.space[2],\n});\n\nglobalStyle(`${ol} > li::marker`, {\n fontSize: tokens.fontSizes[3],\n fontFamily: tokens.fonts.rubik,\n});\n\nexport const liRecipe = recipe({\n base: {\n margin: tokens.space[2],\n outline: 'none',\n position: 'relative',\n selectors: {\n '&:focus-within': {\n boxShadow: 'none',\n },\n },\n },\n\n variants: {\n elevation: elevationVariants,\n },\n\n defaultVariants: {\n elevation: 0,\n },\n});\n\nconst itemContent = style({\n backgroundColor: 'transparent',\n color: 'inherit',\n borderRadius: 'inherit',\n fontFamily: tokens.fonts.rubik,\n fontSize: tokens.fontSizes[3],\n fontVariantNumeric: 'tabular-nums',\n});\n\nexport const itemText = style([\n itemContent,\n {\n flexGrow: 1,\n padding: tokens.space[1],\n },\n]);\n\nconst itemLayer = {\n borderRadius: 'inherit',\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n} as const;\n\nconst primaryTint = {\n backgroundColor: tokens.colors.primary,\n opacity: 0.05,\n};\n\nexport const itemButton = style([\n itemContent,\n {\n appearance: 'none',\n userSelect: 'none',\n boxSizing: 'border-box',\n border: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n // Transparent, not none: forced-colors mode drops the box-shadow ring but shows this outline.\n outline: '2px solid transparent',\n outlineOffset: '-2px',\n flexGrow: 1,\n width: '100%',\n padding: tokens.space[2],\n position: 'relative',\n\n selectors: {\n '&::before': itemLayer,\n '&::after': itemLayer,\n // No pointer-events: none, or clicks would fall through to the <li> and fire its onClick.\n '&:disabled': {\n opacity: 0.5,\n },\n '&:focus, &:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${tokens.colors.listItemFocusBorder}`,\n },\n '&:enabled:active::before': {\n backgroundColor: tokens.colors.listItemActiveBg,\n },\n '&:enabled:active::after': primaryTint,\n },\n\n '@media': {\n '(any-hover: hover)': {\n selectors: {\n '&:enabled:hover': {\n cursor: 'pointer',\n },\n '&:enabled:hover::before': {\n backgroundColor: tokens.colors.listItemHoverBg,\n },\n '&:enabled:hover::after': primaryTint,\n },\n },\n },\n },\n]);\n\nexport const controlsWrapper = style({\n position: 'absolute',\n top: 0,\n right: tokens.space[2],\n zIndex: 1,\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'visible',\n});\n"],"mappings":""}
@@ -0,0 +1,124 @@
1
+ import { processCSSProp } from "../../styles/cssProps.js";
2
+ import { cx } from "../../styles/cx.js";
3
+ import { useVanillaExtractTheme } from "../../styles/themeContext.js";
4
+ import { warnOnce } from "../../utils/warnOnce.js";
5
+ import { flexRecipe } from "../Flex/Flex.vanilla.css.js";
6
+ import { itemButton, itemText, liRecipe, ol, ul } from "./List.vanilla.css.js";
7
+ import { Children, Fragment, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useMemo, useRef } from "react";
8
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ // components/List/List.vanilla.tsx
11
+ var ListVanillaContext = createContext({ interactive: false });
12
+ var useInlineStyle = (css, style) => {
13
+ const { colors } = useVanillaExtractTheme();
14
+ const { style: cssStyles, vars } = processCSSProp(css, colors);
15
+ return {
16
+ ...cssStyles,
17
+ ...style,
18
+ ...assignInlineVars(vars)
19
+ };
20
+ };
21
+ var useListContextValue = (interactive) => {
22
+ const parent = useContext(ListVanillaContext);
23
+ return useMemo(() => ({ interactive: interactive ?? parent.interactive }), [interactive, parent.interactive]);
24
+ };
25
+ var UlVanilla = forwardRef(({ interactive, className, css, style, ...props }, ref) => {
26
+ const contextValue = useListContextValue(interactive);
27
+ const inlineStyle = useInlineStyle(css, style);
28
+ return /* @__PURE__ */ jsx(ListVanillaContext.Provider, {
29
+ value: contextValue,
30
+ children: /* @__PURE__ */ jsx("ul", {
31
+ ref,
32
+ role: "list",
33
+ className: cx(ul, className),
34
+ style: inlineStyle,
35
+ ...props
36
+ })
37
+ });
38
+ });
39
+ UlVanilla.displayName = "UlVanilla";
40
+ var OlVanilla = forwardRef(({ interactive, className, css, style, ...props }, ref) => {
41
+ const contextValue = useListContextValue(interactive);
42
+ const inlineStyle = useInlineStyle(css, style);
43
+ return /* @__PURE__ */ jsx(ListVanillaContext.Provider, {
44
+ value: contextValue,
45
+ children: /* @__PURE__ */ jsx("ol", {
46
+ ref,
47
+ role: "list",
48
+ className: cx(ol, className),
49
+ style: inlineStyle,
50
+ ...props
51
+ })
52
+ });
53
+ });
54
+ OlVanilla.displayName = "OlVanilla";
55
+ var NESTED_LIST_WARNING = "LiVanilla: a nested list is rendered inside the item content, so it ends up in its button or span. Make UlVanilla or OlVanilla a direct child of LiVanilla, and wrap only its items in your component.";
56
+ var splitNestedLists = (children) => {
57
+ const content = [];
58
+ const nestedLists = [];
59
+ Children.toArray(children).forEach((child) => {
60
+ if (!isValidElement(child)) content.push(child);
61
+ else if (child.type === UlVanilla || child.type === OlVanilla) nestedLists.push(child);
62
+ else if (child.type === Fragment) {
63
+ const inner = splitNestedLists(child.props.children);
64
+ content.push(/* @__PURE__ */ jsx(Fragment, { children: inner.content }, child.key));
65
+ if (inner.nestedLists.length) nestedLists.push(/* @__PURE__ */ jsx(Fragment, { children: inner.nestedLists }, child.key));
66
+ } else content.push(child);
67
+ });
68
+ return {
69
+ content,
70
+ nestedLists
71
+ };
72
+ };
73
+ var LiVanilla = forwardRef(({ controls, disabled, elevation, align, justify, direction, gap, wrap, className, css, style, children, ...props }, ref) => {
74
+ const { interactive } = useContext(ListVanillaContext);
75
+ const inlineStyle = useInlineStyle(css, style);
76
+ const { content, nestedLists } = splitNestedLists(children);
77
+ const contentRef = useRef(null);
78
+ const setContentRef = useCallback((node) => {
79
+ contentRef.current = node;
80
+ }, []);
81
+ useEffect(() => {
82
+ if (contentRef.current?.querySelector("ul, ol")) warnOnce(NESTED_LIST_WARNING);
83
+ });
84
+ return /* @__PURE__ */ jsxs("li", {
85
+ ref,
86
+ className: cx(liRecipe({ elevation }), className),
87
+ style: inlineStyle,
88
+ ...props,
89
+ children: [
90
+ interactive ? /* @__PURE__ */ jsx("button", {
91
+ ref: setContentRef,
92
+ type: "button",
93
+ disabled,
94
+ className: cx(flexRecipe({
95
+ align,
96
+ justify,
97
+ direction,
98
+ gap,
99
+ wrap
100
+ }), itemButton),
101
+ children: content
102
+ }) : /* @__PURE__ */ jsx("span", {
103
+ ref: setContentRef,
104
+ className: cx(flexRecipe({
105
+ align: align ?? "center",
106
+ justify,
107
+ direction,
108
+ gap: gap ?? 1,
109
+ wrap
110
+ }), itemText),
111
+ children: content
112
+ }),
113
+ nestedLists,
114
+ !!controls && /* @__PURE__ */ jsx("div", {
115
+ className: "bq2jhfc",
116
+ children: controls
117
+ })
118
+ ]
119
+ });
120
+ });
121
+ LiVanilla.displayName = "LiVanilla";
122
+ export { LiVanilla, OlVanilla, UlVanilla };
123
+
124
+ //# sourceMappingURL=List.vanilla.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.vanilla.js","names":[],"sources":["../../../components/List/List.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport React, {\n Children,\n createContext,\n CSSProperties,\n forwardRef,\n Fragment,\n isValidElement,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport type {\n FlexAlignSimplified,\n FlexDirection,\n FlexJustifySimplified,\n Gap,\n} from '../../styles/types';\nimport { warnOnce } from '../../utils/warnOnce';\nimport { flexRecipe } from '../Flex/Flex.vanilla.css';\nimport { controlsWrapper, itemButton, itemText, liRecipe, ol, ul } from './List.vanilla.css';\n\nconst ListVanillaContext = createContext({ interactive: false });\n\nconst useInlineStyle = (css: CSSProps['css'], style?: CSSProperties) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n return { ...cssStyles, ...style, ...assignInlineVars(vars) };\n};\n\nconst useListContextValue = (interactive?: boolean) => {\n const parent = useContext(ListVanillaContext);\n return useMemo(\n () => ({ interactive: interactive ?? parent.interactive }),\n [interactive, parent.interactive],\n );\n};\n\ntype ListOwnProps = CSSProps & {\n /** Renders the items as buttons. Nested lists inherit it. */\n interactive?: boolean;\n};\n\nexport type UlVanillaProps = React.HTMLAttributes<HTMLUListElement> & ListOwnProps;\n\nexport const UlVanilla = forwardRef<HTMLUListElement, UlVanillaProps>(\n ({ interactive, className, css, style, ...props }, ref) => {\n const contextValue = useListContextValue(interactive);\n const inlineStyle = useInlineStyle(css, style);\n\n return (\n <ListVanillaContext.Provider value={contextValue}>\n <ul ref={ref} role=\"list\" className={cx(ul, className)} style={inlineStyle} {...props} />\n </ListVanillaContext.Provider>\n );\n },\n);\n\nUlVanilla.displayName = 'UlVanilla';\n\nexport type OlVanillaProps = React.OlHTMLAttributes<HTMLOListElement> & ListOwnProps;\n\nexport const OlVanilla = forwardRef<HTMLOListElement, OlVanillaProps>(\n ({ interactive, className, css, style, ...props }, ref) => {\n const contextValue = useListContextValue(interactive);\n const inlineStyle = useInlineStyle(css, style);\n\n return (\n <ListVanillaContext.Provider value={contextValue}>\n <ol ref={ref} role=\"list\" className={cx(ol, className)} style={inlineStyle} {...props} />\n </ListVanillaContext.Provider>\n );\n },\n);\n\nOlVanilla.displayName = 'OlVanilla';\n\ntype LiRecipeVariants = NonNullable<RecipeVariants<typeof liRecipe>>;\n\nexport type LiVanillaProps = React.LiHTMLAttributes<HTMLLIElement> &\n CSSProps &\n LiRecipeVariants & {\n /** Shown on the right of the item, outside its button. */\n controls?: ReactNode;\n /** Disables the item's button. Only applies in an interactive list. */\n disabled?: boolean;\n align?: FlexAlignSimplified;\n justify?: FlexJustifySimplified;\n direction?: FlexDirection;\n gap?: Gap;\n wrap?: 'wrap' | 'noWrap' | 'wrapReverse';\n };\n\nconst NESTED_LIST_WARNING =\n 'LiVanilla: a nested list is rendered inside the item content, so it ends up in its button or span. ' +\n 'Make UlVanilla or OlVanilla a direct child of LiVanilla, and wrap only its items in your component.';\n\n// Looks into fragments, but not into components: what they render is unknown at this point.\nconst splitNestedLists = (children: ReactNode) => {\n const content: ReactNode[] = [];\n const nestedLists: ReactNode[] = [];\n\n // eslint-disable-next-line @eslint-react/no-children-to-array\n Children.toArray(children).forEach((child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) {\n content.push(child);\n } else if (child.type === UlVanilla || child.type === OlVanilla) {\n nestedLists.push(child);\n } else if (child.type === Fragment) {\n const inner = splitNestedLists(child.props.children);\n content.push(<Fragment key={child.key}>{inner.content}</Fragment>);\n if (inner.nestedLists.length) {\n nestedLists.push(<Fragment key={child.key}>{inner.nestedLists}</Fragment>);\n }\n } else {\n content.push(child);\n }\n });\n\n return { content, nestedLists };\n};\n\nexport const LiVanilla = forwardRef<HTMLLIElement, LiVanillaProps>(\n (\n {\n controls,\n disabled,\n elevation,\n align,\n justify,\n direction,\n gap,\n wrap,\n className,\n css,\n style,\n children,\n ...props\n },\n ref,\n ) => {\n const { interactive } = useContext(ListVanillaContext);\n const inlineStyle = useInlineStyle(css, style);\n const { content, nestedLists } = splitNestedLists(children);\n\n const contentRef = useRef<HTMLElement | null>(null);\n const setContentRef = useCallback((node: HTMLElement | null) => {\n contentRef.current = node;\n }, []);\n\n // A list rendered by a wrapper component can't be detected before render.\n useEffect(() => {\n if (contentRef.current?.querySelector('ul, ol')) {\n warnOnce(NESTED_LIST_WARNING);\n }\n });\n\n return (\n <li\n ref={ref}\n className={cx(liRecipe({ elevation }), className)}\n style={inlineStyle}\n {...props}\n >\n {interactive ? (\n <button\n ref={setContentRef}\n type=\"button\"\n disabled={disabled}\n className={cx(flexRecipe({ align, justify, direction, gap, wrap }), itemButton)}\n >\n {content}\n </button>\n ) : (\n <span\n ref={setContentRef}\n className={cx(\n flexRecipe({ align: align ?? 'center', justify, direction, gap: gap ?? 1, wrap }),\n itemText,\n )}\n >\n {content}\n </span>\n )}\n {nestedLists}\n {!!controls && <div className={controlsWrapper}>{controls}</div>}\n </li>\n );\n },\n);\n\nLiVanilla.displayName = 'LiVanilla';\n"],"mappings":";;;;;;;;;;AA8BA,IAAM,qBAAqB,cAAc,EAAE,aAAa,MAAM,CAAC;AAE/D,IAAM,kBAAkB,KAAsB,UAA0B;CACtE,MAAM,EAAE,WAAW,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAC7D,OAAO;EAAE,GAAG;EAAW,GAAG;EAAO,GAAG,iBAAiB,IAAI;CAAE;AAC7D;AAEA,IAAM,uBAAuB,gBAA0B;CACrD,MAAM,SAAS,WAAW,kBAAkB;CAC5C,OAAO,eACE,EAAE,aAAa,eAAe,OAAO,YAAY,IACxD,CAAC,aA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AAxC,MAAM,GAAkC,CAAC;EAE7E,OACE,QAAQ,KAAK,KAAK;CAEtB,CAAC;CAED,OAAO;EAAE;EAAS;CAAY;AAChC;AAEA,IAAa,YAAY,YAErB,EACE,UACA,UACA,WACA,OACA,SACA,WACA,KACA,MACA,WACA,KACA,OACA,UACA,GAAG,SAEL,QACG;CACH,MAAM,EAAE,gBAAgB,WAAW,kBAAkB;CACrD,MAAM,cAAc,eAAe,KAAK,KAAK;CAC7C,MAAM,EAAE,SAAS,gBAAgB,iBAAiB,QAAQ;CAE1D,MAAM,aAAa,OAA2B,IAAI;CAClD,MAAM,gBAAgB,aAAa,SAA6B;EAC9D,WAAW,UAAU;CACvB,GAAG,CAAC,CAAC;CAGL,gBAAgB;EACd,IAAI,WAAW,SAAS,cAAc,QAAQ,GAC5C,SAAS,mBAAmB;CAEhC,CAAC;CAED,OACE,qBAAC,MAAD;EACO;EACL,WAAW,GAAG,SAAS,EAAE,UAAU,CAAC,GAAG,SAAS;EAChD,OAAO;EACP,GAAI;EAJN,UAAA;GAMG,cACC,oBAAC,UAAD;IACE,KAAK;IACL,MAAK;IACK;IACV,WAAW,GAAG,WAAW;KAAE;KAAO;KAAS;KAAW;KAAK;IAAK,CAAC,GAAG,UAAU;IAE7E,UAAA;GACK,CAAA,IAER,oBAAC,QAAD;IACE,KAAK;IACL,WAAW,GACT,WAAW;KAAE,OAAO,SAAS;KAAU;KAAS;KAAW,KAAK,OAAO;KAAG;IAAK,CAAC,GAChF,QACF;IAEC,UAAA;GACG,CAAA;GAEP;GACA,CAAC,CAAC,YAAY,oBAAC,OAAD;IAAK,WAAA;IAA6B,UAAA;GAAc,CAAA;EAC7D;;AAER,CACF;AAEA,UAAU,cAAc"}
@@ -5,7 +5,7 @@ import { FlexVanilla } from "../Flex/Flex.vanilla.js";
5
5
  import { aside, main, root } from "./SplitLayout.vanilla.css.js";
6
6
  import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
7
7
  import { assignInlineVars } from "@vanilla-extract/dynamic";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  // components/SplitLayout/SplitLayout.vanilla.tsx
10
10
  var KEY_STEP = 16;
11
11
  var DEFAULT_MIN_WIDTH = "25%";
@@ -177,7 +177,7 @@ var SplitLayoutAsideVanilla = forwardRef(({ defaultWidth = 360, defaultFraction,
177
177
  e.preventDefault();
178
178
  persist(resize(next));
179
179
  }, [resize, persist]);
180
- return /* @__PURE__ */ jsxs(Fragment, { children: [!stacked && /* @__PURE__ */ jsx("div", {
180
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [!stacked && /* @__PURE__ */ jsx("div", {
181
181
  role: "separator",
182
182
  "aria-orientation": "vertical",
183
183
  "aria-label": resizeLabel,
@@ -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 { 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,O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AAG,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
+ {"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,WAAW,YAAY,GAAG,CAAC;O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I;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,YAAA,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"}
@@ -9,7 +9,7 @@ import { Text } from "../Text/Text.js";
9
9
  import { ExpandButton } from "./ExpandButton.js";
10
10
  import { ChevronRightIcon } from "@radix-ui/react-icons";
11
11
  import { forwardRef, useId, useMemo, useState } from "react";
12
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
13
  // components/Table/Table.tsx
14
14
  var Caption = styled("caption", Text, {
15
15
  display: "table-caption",
@@ -108,7 +108,7 @@ var AnimatedTr = ({ id, collapsedContentColSpan, isOpen, children }) => {
108
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) => {
109
109
  const [isCollapsed, setIsCollapsed] = useState(false);
110
110
  const contentId = useId();
111
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(StyledTr, {
111
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(StyledTr, {
112
112
  ref,
113
113
  css: !!collapsedContent && !isCollapsed ? {
114
114
  ...css,
@@ -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 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,EACT,YAAY,EACV,SAAS,aACX,EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,IAAa,KAAK,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;GACA,KAAK,EACH,WAAW,MACb;EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,IAAa,WAAW,OAAO,MAAM,kBAAkB;CACrD,eAAe;CACf,WAAW,EACT,OAAO,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AO,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,EACT,YAAY,EACV,SAAS,aACX,EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,IAAa,KAAK,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;GACA,KAAK,EACH,WAAW,MACb;EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,IAAa,WAAW,OAAO,MAAM,kBAAkB;CACrD,eAAe;CACf,WAAW,E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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"}
@@ -7,7 +7,7 @@ import { ExpandToggleVanilla, stopEvent } from "./ExpandToggle.vanilla.js";
7
7
  import { ARIA_SORT, SortButtonVanilla } from "./SortButton.vanilla.js";
8
8
  import { captionRecipe, tableRecipe, tbody, tdRecipe, tfoot, thRecipe, thead, trRecipe } from "./Table.vanilla.css.js";
9
9
  import { forwardRef, useId, useState } from "react";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
11
  // components/Table/Table.vanilla.tsx
12
12
  var TableVanilla = forwardRef(({ elevation, className, css, style, ...props }, ref) => /* @__PURE__ */ jsx("table", {
13
13
  ref,
@@ -79,7 +79,7 @@ var TrVanilla = forwardRef(({ collapsedContent: collapsedContent$1, collapsedCon
79
79
  const contentId = useId();
80
80
  const inlineStyle = useInlineStyle(css, style);
81
81
  const collapsible = !!collapsedContent$1;
82
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
82
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
83
83
  ref,
84
84
  className: cx(trRecipe({
85
85
  interactive: interactive ?? (href !== void 0 || void 0),
@@ -1 +1 @@
1
- {"version":3,"file":"Table.vanilla.js","names":["collapsedContent","_Fragment"],"sources":["../../../components/Table/Table.vanilla.tsx"],"sourcesContent":["import { RecipeVariants } from '@vanilla-extract/recipes';\nimport React, { forwardRef, ReactNode, useId, useState } from 'react';\n\nimport { CSSProps } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useInlineStyle } from '../../styles/useInlineStyle';\nimport {\n handleRowClick,\n mapRowLink,\n openRowLink,\n RowLinkShortcutProps,\n} from '../RowLink/RowLink.utils';\nimport { RowLinkVanilla } from '../RowLink/RowLink.vanilla';\nimport { rowLinkRow, rowLinkTable } from '../RowLink/RowLink.vanilla.css';\nimport { ExpandToggleVanilla, stopEvent } from './ExpandToggle.vanilla';\nimport { ARIA_SORT, SortButtonVanilla } from './SortButton.vanilla';\nimport {\n captionRecipe,\n collapsedCell,\n collapsedContent as collapsedContentClass,\n emptyHeaderCell,\n tableRecipe,\n tbody,\n tdRecipe,\n tfoot,\n thead,\n thRecipe,\n toggleCell,\n trRecipe,\n} from './Table.vanilla.css';\nimport { TableSortProps } from './useTableSort';\n\ntype TableRecipeVariants = NonNullable<RecipeVariants<typeof tableRecipe>>;\ntype CaptionRecipeVariants = NonNullable<RecipeVariants<typeof captionRecipe>>;\ntype TrRecipeVariants = NonNullable<RecipeVariants<typeof trRecipe>>;\ntype ThRecipeVariants = NonNullable<RecipeVariants<typeof thRecipe>>;\ntype TdRecipeVariants = NonNullable<RecipeVariants<typeof tdRecipe>>;\n\nexport type TableVanillaProps = React.TableHTMLAttributes<HTMLTableElement> &\n CSSProps &\n TableRecipeVariants;\n\nexport const TableVanilla = forwardRef<HTMLTableElement, TableVanillaProps>(\n ({ elevation, className, css, style, ...props }, ref) => (\n <table\n ref={ref}\n className={cx(tableRecipe({ elevation }), rowLinkTable, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nTableVanilla.displayName = 'TableVanilla';\n\nexport type CaptionVanillaProps = React.HTMLAttributes<HTMLTableCaptionElement> &\n CSSProps &\n CaptionRecipeVariants;\n\nexport const CaptionVanilla = forwardRef<HTMLTableCaptionElement, CaptionVanillaProps>(\n (\n { size, weight, variant, gradient, transform, noWrap, className, css, style, ...props },\n ref,\n ) => (\n <caption\n ref={ref}\n className={cx(\n captionRecipe({ size, weight, variant, gradient, transform, noWrap }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nCaptionVanilla.displayName = 'CaptionVanilla';\n\nexport type TableSectionVanillaProps = React.HTMLAttributes<HTMLTableSectionElement> & CSSProps;\n\nconst section = (Tag: 'thead' | 'tbody' | 'tfoot', sectionClass: string, displayName: string) => {\n const Section = forwardRef<HTMLTableSectionElement, TableSectionVanillaProps>(\n ({ className, css, style, ...props }, ref) => (\n <Tag\n ref={ref}\n className={cx(sectionClass, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n );\n Section.displayName = displayName;\n return Section;\n};\n\nexport const TheadVanilla = section('thead', thead, 'TheadVanilla');\nexport const TbodyVanilla = section('tbody', tbody, 'TbodyVanilla');\nexport const TfootVanilla = section('tfoot', tfoot, 'TfootVanilla');\n\nexport type ThVanillaProps = Omit<React.ThHTMLAttributes<HTMLTableCellElement>, 'align'> &\n CSSProps &\n ThRecipeVariants &\n TableSortProps;\n\nexport const ThVanilla = forwardRef<HTMLTableCellElement, ThVanillaProps>(\n (\n {\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n align,\n sort,\n onSort,\n className,\n css,\n style,\n children,\n ...props\n },\n ref,\n ) => (\n <th\n ref={ref}\n aria-sort={sort && ARIA_SORT[sort]}\n className={cx(\n thRecipe({ size, weight, variant, gradient, transform, noWrap, align }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n >\n {onSort ? (\n <SortButtonVanilla sort={sort} onSort={onSort}>\n {children}\n </SortButtonVanilla>\n ) : (\n children\n )}\n </th>\n ),\n);\n\nThVanilla.displayName = 'ThVanilla';\n\nexport type TdVanillaProps = Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'align'> &\n CSSProps &\n TdRecipeVariants;\n\nexport const TdVanilla = forwardRef<HTMLTableCellElement, TdVanillaProps>(\n ({ subtle, align, className, css, style, ...props }, ref) => (\n <td\n ref={ref}\n className={cx(tdRecipe({ subtle, align }), className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nTdVanilla.displayName = 'TdVanilla';\n\nexport type TrVanillaProps = React.HTMLAttributes<HTMLTableRowElement> &\n CSSProps &\n TrRecipeVariants &\n RowLinkShortcutProps & {\n /** Content shown in a full-width row below, toggled by a button in a new first cell. */\n collapsedContent?: ReactNode;\n /** Column span of the collapsed content row; set it to the number of columns. */\n collapsedContentColSpan?: number;\n /** Accessible name of the expand button. */\n expandLabel?: string;\n /** Adds an empty first cell, to line up with rows that have an expand button. */\n emptyFirstColumn?: boolean;\n /** Styles the empty first cell as a header, for a row in `TheadVanilla`. */\n tableHead?: boolean;\n };\n\nexport const TrVanilla = forwardRef<HTMLTableRowElement, TrVanillaProps>(\n (\n {\n collapsedContent,\n collapsedContentColSpan = 1,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n href,\n linkAs,\n linkCell,\n linkProps,\n linkOverlay,\n interactive,\n active,\n className,\n css,\n style,\n children,\n onClick,\n onAuxClick,\n ...props\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const contentId = useId();\n const inlineStyle = useInlineStyle(css, style);\n const collapsible = !!collapsedContent;\n\n return (\n <>\n <tr\n ref={ref}\n className={cx(\n trRecipe({ interactive: interactive ?? (href !== undefined || undefined), active }),\n rowLinkRow,\n className,\n )}\n data-collapsed={collapsible && !isOpen ? '' : undefined}\n style={inlineStyle}\n onClick={(event) => handleRowClick(event, onClick)}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\n {...props}\n >\n {emptyFirstColumn &&\n (tableHead ? <td className={cx(thRecipe(), emptyHeaderCell)} /> : <TdVanilla />)}\n {collapsible && (\n <TdVanilla className={toggleCell} onClick={stopEvent}>\n <ExpandToggleVanilla\n label={expandLabel}\n isOpen={isOpen}\n controls={contentId}\n onToggle={() => setIsOpen((open) => !open)}\n />\n </TdVanilla>\n )}\n {mapRowLink(\n children,\n { href, linkAs, linkCell, linkProps, linkOverlay },\n TdVanilla,\n RowLinkVanilla,\n { row: 'TrVanilla', cell: 'TdVanilla' },\n )}\n </tr>\n {collapsible && (\n <TrVanilla>\n <TdVanilla\n id={contentId}\n colSpan={collapsedContentColSpan}\n className={collapsedCell}\n data-closed={isOpen ? undefined : ''}\n >\n <div className={collapsedContentClass}>{collapsedContent}</div>\n </TdVanilla>\n </TrVanilla>\n )}\n </>\n );\n },\n);\n\nTrVanilla.displayName = 'TrVanilla';\n"],"mappings":";;;;;;;;;;;AA0CA,IAAa,eAAe,YACzB,EAAE,WAAW,WAAW,KAAK,OAAO,GAAG,SAAS,QAC/C,oBAAC,SAAD;CACO;CACL,WAAW,GAAG,YAAY,EAAE,UAAU,CAAC,GAAG,cAAc,SAAS;CACjE,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,aAAa,cAAc;AAM3B,IAAa,iBAAiB,YAE1B,EAAE,MAAM,QAAQ,SAAS,UAAU,WAAW,QAAQ,WAAW,KAAK,OAAO,GAAG,SAChF,QAEA,oBAAC,WAAD;CACO;CACL,WAAW,GACT,cAAc;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC,GACpE,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,eAAe,cAAc;AAI7B,IAAM,WAAW,KAAkC,cAAsB,gBAAwB;CAC/F,MAAM,U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7C,MAAM,cAAc,CAAC,CAACA;CAEtB,OACE,qBAAAC,UAAA,EAAA,UAAA,CACE,qBAAC,MAAD;EACO;EACL,WAAW,GACT,SAAS;GAAE,aAAa,gBAAgB,SAAS,KAAA,KAAa,KAAA;GAAY;EAAO,CAAC,GAClF,YACA,SACF;EACA,kBAAgB,eAAe,CAAC,SAAS,KAAK,KAAA;EAC9C,OAAO;EACP,UAAU,UAAU,eAAe,OAAO,OAAO;EACjD,aAAa,UAAU;GACrB,aAAa,KAAK;GAClB,YAAY,KAAK;EACnB;EACA,GAAI;EAdN,UAAA;GAgBG,qBACE,YAAY,oBAAC,MAAD,EAAI,WAAW,GAAG,SAAS,GAAA,YAAkB,EAAI,CAAA,IAAI,oBAAC,WAAD,CAAY,CAAA;GAC/E,eACC,oBAAC,WAAD;IAAW,WAAA;IAAuB,SAAS;IACzC,UAAA,oBAAC,qBAAD;KACE,OAAO;KACC;KACR,UAAU;KACV,gBAAgB,WAAW,SAAS,CAAC,IAAI;IAC1C,CAAA;GACQ,CAAA;GAEZ,WACC,UACA;IAAE;IAAM;IAAQ;IAAU;IAAW;GAAY,GACjD,WACA,gBACA;IAAE,KAAK;IAAa,MAAM;GAAY,CACxC;EACE;CACH,CAAA,GAAA,eACC,oBAAC,WAAD,EAAA,UACE,oBAAC,WAAD;EACE,IAAI;EACJ,SAAS;EACT,WAAA;EACA,eAAa,SAAS,KAAA,IAAY;EAElC,UAAA,oBAAC,OAAD;GAAK,WAAA;GAAmC,UAAAD;EAAsB,CAAA;CACrD,CAAA,EACF,CAAA,CAEb,EAAA,CAAA;AAEN,CACF;AAEA,UAAU,cAAc"}
1
+ {"version":3,"file":"Table.vanilla.js","names":["collapsedContent","_Fragment"],"sources":["../../../components/Table/Table.vanilla.tsx"],"sourcesContent":["import { RecipeVariants } from '@vanilla-extract/recipes';\nimport React, { forwardRef, ReactNode, useId, useState } from 'react';\n\nimport { CSSProps } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useInlineStyle } from '../../styles/useInlineStyle';\nimport {\n handleRowClick,\n mapRowLink,\n openRowLink,\n RowLinkShortcutProps,\n} from '../RowLink/RowLink.utils';\nimport { RowLinkVanilla } from '../RowLink/RowLink.vanilla';\nimport { rowLinkRow, rowLinkTable } from '../RowLink/RowLink.vanilla.css';\nimport { ExpandToggleVanilla, stopEvent } from './ExpandToggle.vanilla';\nimport { ARIA_SORT, SortButtonVanilla } from './SortButton.vanilla';\nimport {\n captionRecipe,\n collapsedCell,\n collapsedContent as collapsedContentClass,\n emptyHeaderCell,\n tableRecipe,\n tbody,\n tdRecipe,\n tfoot,\n thead,\n thRecipe,\n toggleCell,\n trRecipe,\n} from './Table.vanilla.css';\nimport { TableSortProps } from './useTableSort';\n\ntype TableRecipeVariants = NonNullable<RecipeVariants<typeof tableRecipe>>;\ntype CaptionRecipeVariants = NonNullable<RecipeVariants<typeof captionRecipe>>;\ntype TrRecipeVariants = NonNullable<RecipeVariants<typeof trRecipe>>;\ntype ThRecipeVariants = NonNullable<RecipeVariants<typeof thRecipe>>;\ntype TdRecipeVariants = NonNullable<RecipeVariants<typeof tdRecipe>>;\n\nexport type TableVanillaProps = React.TableHTMLAttributes<HTMLTableElement> &\n CSSProps &\n TableRecipeVariants;\n\nexport const TableVanilla = forwardRef<HTMLTableElement, TableVanillaProps>(\n ({ elevation, className, css, style, ...props }, ref) => (\n <table\n ref={ref}\n className={cx(tableRecipe({ elevation }), rowLinkTable, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nTableVanilla.displayName = 'TableVanilla';\n\nexport type CaptionVanillaProps = React.HTMLAttributes<HTMLTableCaptionElement> &\n CSSProps &\n CaptionRecipeVariants;\n\nexport const CaptionVanilla = forwardRef<HTMLTableCaptionElement, CaptionVanillaProps>(\n (\n { size, weight, variant, gradient, transform, noWrap, className, css, style, ...props },\n ref,\n ) => (\n <caption\n ref={ref}\n className={cx(\n captionRecipe({ size, weight, variant, gradient, transform, noWrap }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nCaptionVanilla.displayName = 'CaptionVanilla';\n\nexport type TableSectionVanillaProps = React.HTMLAttributes<HTMLTableSectionElement> & CSSProps;\n\nconst section = (Tag: 'thead' | 'tbody' | 'tfoot', sectionClass: string, displayName: string) => {\n const Section = forwardRef<HTMLTableSectionElement, TableSectionVanillaProps>(\n ({ className, css, style, ...props }, ref) => (\n <Tag\n ref={ref}\n className={cx(sectionClass, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n );\n Section.displayName = displayName;\n return Section;\n};\n\nexport const TheadVanilla = section('thead', thead, 'TheadVanilla');\nexport const TbodyVanilla = section('tbody', tbody, 'TbodyVanilla');\nexport const TfootVanilla = section('tfoot', tfoot, 'TfootVanilla');\n\nexport type ThVanillaProps = Omit<React.ThHTMLAttributes<HTMLTableCellElement>, 'align'> &\n CSSProps &\n ThRecipeVariants &\n TableSortProps;\n\nexport const ThVanilla = forwardRef<HTMLTableCellElement, ThVanillaProps>(\n (\n {\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n align,\n sort,\n onSort,\n className,\n css,\n style,\n children,\n ...props\n },\n ref,\n ) => (\n <th\n ref={ref}\n aria-sort={sort && ARIA_SORT[sort]}\n className={cx(\n thRecipe({ size, weight, variant, gradient, transform, noWrap, align }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n >\n {onSort ? (\n <SortButtonVanilla sort={sort} onSort={onSort}>\n {children}\n </SortButtonVanilla>\n ) : (\n children\n )}\n </th>\n ),\n);\n\nThVanilla.displayName = 'ThVanilla';\n\nexport type TdVanillaProps = Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'align'> &\n CSSProps &\n TdRecipeVariants;\n\nexport const TdVanilla = forwardRef<HTMLTableCellElement, TdVanillaProps>(\n ({ subtle, align, className, css, style, ...props }, ref) => (\n <td\n ref={ref}\n className={cx(tdRecipe({ subtle, align }), className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nTdVanilla.displayName = 'TdVanilla';\n\nexport type TrVanillaProps = React.HTMLAttributes<HTMLTableRowElement> &\n CSSProps &\n TrRecipeVariants &\n RowLinkShortcutProps & {\n /** Content shown in a full-width row below, toggled by a button in a new first cell. */\n collapsedContent?: ReactNode;\n /** Column span of the collapsed content row; set it to the number of columns. */\n collapsedContentColSpan?: number;\n /** Accessible name of the expand button. */\n expandLabel?: string;\n /** Adds an empty first cell, to line up with rows that have an expand button. */\n emptyFirstColumn?: boolean;\n /** Styles the empty first cell as a header, for a row in `TheadVanilla`. */\n tableHead?: boolean;\n };\n\nexport const TrVanilla = forwardRef<HTMLTableRowElement, TrVanillaProps>(\n (\n {\n collapsedContent,\n collapsedContentColSpan = 1,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n href,\n linkAs,\n linkCell,\n linkProps,\n linkOverlay,\n interactive,\n active,\n className,\n css,\n style,\n children,\n onClick,\n onAuxClick,\n ...props\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const contentId = useId();\n const inlineStyle = useInlineStyle(css, style);\n const collapsible = !!collapsedContent;\n\n return (\n <>\n <tr\n ref={ref}\n className={cx(\n trRecipe({ interactive: interactive ?? (href !== undefined || undefined), active }),\n rowLinkRow,\n className,\n )}\n data-collapsed={collapsible && !isOpen ? '' : undefined}\n style={inlineStyle}\n onClick={(event) => handleRowClick(event, onClick)}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\n {...props}\n >\n {emptyFirstColumn &&\n (tableHead ? <td className={cx(thRecipe(), emptyHeaderCell)} /> : <TdVanilla />)}\n {collapsible && (\n <TdVanilla className={toggleCell} onClick={stopEvent}>\n <ExpandToggleVanilla\n label={expandLabel}\n isOpen={isOpen}\n controls={contentId}\n onToggle={() => setIsOpen((open) => !open)}\n />\n </TdVanilla>\n )}\n {mapRowLink(\n children,\n { href, linkAs, linkCell, linkProps, linkOverlay },\n TdVanilla,\n RowLinkVanilla,\n { row: 'TrVanilla', cell: 'TdVanilla' },\n )}\n </tr>\n {collapsible && (\n <TrVanilla>\n <TdVanilla\n id={contentId}\n colSpan={collapsedContentColSpan}\n className={collapsedCell}\n data-closed={isOpen ? undefined : ''}\n >\n <div className={collapsedContentClass}>{collapsedContent}</div>\n </TdVanilla>\n </TrVanilla>\n )}\n </>\n );\n },\n);\n\nTrVanilla.displayName = 'TrVanilla';\n"],"mappings":";;;;;;;;;;;AA0CA,IAAa,eAAe,YACzB,EAAE,WAAW,WAAW,KAAK,OAAO,GAAG,SAAS,QAC/C,oBAAC,SAAD;CACO;CACL,WAAW,GAAG,YAAY,EAAE,UAAU,CAAC,GAAG,cAAc,SAAS;CACjE,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,aAAa,cAAc;AAM3B,IAAa,iBAAiB,YAE1B,EAAE,MAAM,QAAQ,SAAS,UAAU,WAAW,QAAQ,WAAW,KAAK,OAAO,GAAG,SAChF,QAEA,oBAAC,WAAD;CACO;CACL,WAAW,GACT,cAAc;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC,GACpE,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,eAAe,cAAc;AAI7B,IAAM,WAAW,KAAkC,cAAsB,gBAAwB;CAC/F,MAAM,UAAU,YACb,EAAE,WAAW,KAAK,OAAO,GAAG,SAAS,QACpC,oBAAC,KAAD;EACO;EACL,WAAW,GAAG,cAAc,SAAS;EACrC,OAAO,eAAe,KAAK,KAAK;EAChC,GAAI;CACL,CAAA,CAEL;CACA,QAAQ,cAAc;CACtB,OAAO;AACT;AAEA,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAClE,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAClE,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAOlE,IAAa,YAAY,YAErB,EACE,MACA,QACA,SACA,UACA,WACA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,YAAY,oBAAC,MAAD,EAAI,WAAW,GAAG,SAAS,GAAA,YAAkB,EAAI,CAAA,IAAI,oBAAC,WAAD,CAAY,CAAA;GAC/E,eACC,oBAAC,WAAD;IAAW,WAAA;IAAuB,SAAS;IACzC,UAAA,oBAAC,qBAAD;KACE,OAAO;KACC;KACR,UAAU;KACV,gBAAgB,WAAW,SAAS,CAAC,IAAI;IAC1C,CAAA;GACQ,CAAA;GAEZ,WACC,UACA;IAAE;IAAM;IAAQ;IAAU;IAAW;GAAY,GACjD,WACA,gBACA;IAAE,KAAK;IAAa,MAAM;GAAY,CACxC;EACE;CACH,CAAA,GAAA,eACC,oBAAC,WAAD,EAAA,UACE,oBAAC,WAAD;EACE,IAAI;EACJ,SAAS;EACT,WAAA;EACA,eAAa,SAAS,KAAA,IAAY;EAElC,UAAA,oBAAC,OAAD;GAAK,WAAA;GAAmC,UAAAD;EAAsB,CAAA;CACrD,CAAA,EACF,CAAA,CAEb,EAAA,CAAA;AAEN,CACF;AAEA,UAAU,cAAc"}
@@ -5,7 +5,7 @@ import { Tooltip } from "../Tooltip/Tooltip.js";
5
5
  import "./TextField.vanilla.css.js";
6
6
  import { CrossCircledIcon, ExclamationTriangleIcon, EyeClosedIcon, EyeOpenIcon } from "@radix-ui/react-icons";
7
7
  import React from "react";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  // components/TextField/TextField.vanilla.tsx
10
10
  var TextFieldVanilla = React.forwardRef(({ state, clearable, label: LabelOrComponent, description, error, announceError, id, type, disabled, readOnly, css, ...props }, forwardedRef) => {
11
11
  const inputRef = React.useRef(null);
@@ -49,7 +49,7 @@ var TextFieldVanilla = React.forwardRef(({ state, clearable, label: LabelOrCompo
49
49
  }, [setInnerType]);
50
50
  const PasswordVisibilityToggleIcon = isPasswordVisible ? EyeClosedIcon : EyeOpenIcon;
51
51
  const passwordAction = React.useMemo(() => isPasswordVisible ? "Hide password" : "Show password", [isPasswordVisible]);
52
- const adornments = /* @__PURE__ */ jsxs(Fragment, { children: [
52
+ const adornments = /* @__PURE__ */ jsxs(Fragment$1, { children: [
53
53
  invalid && /* @__PURE__ */ jsx(ExclamationTriangleIcon, {
54
54
  className: "_1q0c5701",
55
55
  "aria-hidden": true
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.vanilla.js","names":["_Fragment"],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldContext } from '../Field/FieldContext';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { Tooltip } from '../Tooltip';\nimport { adornmentButton, adornmentGroup, invalidIcon } from './TextField.vanilla.css';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n id?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n};\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n description,\n error,\n announceError,\n id,\n type,\n disabled,\n readOnly,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const outerField = useFieldContext();\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = state === 'invalid' || Boolean(error) || Boolean(outerField?.invalid);\n\n const renderLabel = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return undefined;\n }\n if (typeof LabelOrComponent === 'string') {\n return LabelOrComponent;\n }\n return (labelProps: FieldLabelProps) => <LabelOrComponent {...labelProps} />;\n }, [LabelOrComponent]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = readOnly || disabled || Boolean(outerField?.disabled);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;\n setValue?.call(current, '');\n current.dispatchEvent(new Event('input', { bubbles: true }));\n current.focus();\n }\n }, [inputRef]);\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const PasswordVisibilityToggleIcon = isPasswordVisible ? EyeClosedIcon : EyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n const adornments = (\n <>\n {invalid && <ExclamationTriangleIcon className={invalidIcon} aria-hidden />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <button\n type=\"button\"\n className={adornmentButton}\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n >\n <PasswordVisibilityToggleIcon aria-hidden />\n </button>\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <button\n type=\"button\"\n className={adornmentButton}\n aria-label=\"Clear\"\n onClick={handleClear}\n >\n <CrossCircledIcon aria-hidden />\n </button>\n </Tooltip>\n )}\n </>\n );\n\n const input = (\n <InputVanilla\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment &&\n (hasAdornmentGroup ? <div className={adornmentGroup}>{adornments}</div> : adornments)\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n {...props}\n />\n );\n\n return (\n <FieldVanilla\n id={id}\n label={renderLabel}\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={disabled}\n css={{ boxSizing: 'border-box', ...css }}\n >\n {input}\n </FieldVanilla>\n );\n },\n);\n\nTextFieldVanilla.displayName = 'TextFieldVanilla';\n"],"mappings":";;;;;;;;;AA8BA,IAAa,mBAAmB,MAAM,YAKlC,EACE,OACA,WACA,OAAO,kBACP,aACA,OACA,eACA,IACA,MACA,UACA,UACA,KACA,GAAG,SAEL,iBACG;CACH,MAAM,WAAW,MAAM,OAAkC,IAAI;CAC7D,MAAM,oBAAoB,oBAAoB,SAAS,OAA6B;CAEpF,MAAM,aAAa,gBAAgB;CACnC,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,IAAI;CACrD,MAAM,oBAAoB,MAAM,cAAc,cAAc,YAAY,CAAC,SAAS,CAAC;CAEnF,MAAM,UAAU,UAAU,aAAa,QAAQ,KAAK,KAAK,QAAQ,YAAY,OAAO;CAEpF,MAAM,cAAc,MAAM,cAAc;EACtC,IAAI,qBAAqB,KAAA,KAAa,qBAAqB,MACzD;EAEF,IAAI,OAAO,qBAAqB,UAC9B,OAAO;EAET,QAAQ,eAAgC,oBAAC,kBAAD,EAAkB,GAAI,WAAa,CAAA;CAC7E,GAAG,CAAC,gBAAgB,CAAC;CAErB,MAAM,iBAAiB,MAAM,cAAc,SAAS,YAAY,CAAC,IAAI,CAAC;CAEtE,MAAM,kBAAkB,MAAM,cACrB,iBAAiB,YAAY,MACpC;EAAC;EAAgB;EAAM;CAAS,CAClC;CAEA,MAAM,oBAAoB,MAAM,cACxB,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A;CAGJ,MAAM,QACJ,oBAAC,cAAD;EACM;EACJ,KAAK;EACL,cACE,sBACC,oBAAoB,oBAAC,OAAD;GAAK,WAAA;GAA4B,UAAA;EAAgB,CAAA,IAAI;EAErE;EACP,MAAM;EACI;EACA;EACV,GAAI;CACL,CAAA;CAGH,OACE,oBAAC,cAAD;EACM;EACJ,OAAO;EACM;EACN;EACQ;EACf,SAAS,UAAU;EACT;EACV,KAAK;GAAE,WAAW;GAAc,GAAG;EAAI;EAEtC,UAAA;CACW,CAAA;AAElB,CACF;AAEA,iBAAiB,cAAc"}
1
+ {"version":3,"file":"TextField.vanilla.js","names":["_Fragment"],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldContext } from '../Field/FieldContext';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { Tooltip } from '../Tooltip';\nimport { adornmentButton, adornmentGroup, invalidIcon } from './TextField.vanilla.css';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n id?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n};\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n description,\n error,\n announceError,\n id,\n type,\n disabled,\n readOnly,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const outerField = useFieldContext();\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = state === 'invalid' || Boolean(error) || Boolean(outerField?.invalid);\n\n const renderLabel = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return undefined;\n }\n if (typeof LabelOrComponent === 'string') {\n return LabelOrComponent;\n }\n return (labelProps: FieldLabelProps) => <LabelOrComponent {...labelProps} />;\n }, [LabelOrComponent]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = readOnly || disabled || Boolean(outerField?.disabled);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;\n setValue?.call(current, '');\n current.dispatchEvent(new Event('input', { bubbles: true }));\n current.focus();\n }\n }, [inputRef]);\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const PasswordVisibilityToggleIcon = isPasswordVisible ? EyeClosedIcon : EyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n const adornments = (\n <>\n {invalid && <ExclamationTriangleIcon className={invalidIcon} aria-hidden />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <button\n type=\"button\"\n className={adornmentButton}\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n >\n <PasswordVisibilityToggleIcon aria-hidden />\n </button>\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <button\n type=\"button\"\n className={adornmentButton}\n aria-label=\"Clear\"\n onClick={handleClear}\n >\n <CrossCircledIcon aria-hidden />\n </button>\n </Tooltip>\n )}\n </>\n );\n\n const input = (\n <InputVanilla\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment &&\n (hasAdornmentGroup ? <div className={adornmentGroup}>{adornments}</div> : adornments)\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n {...props}\n />\n );\n\n return (\n <FieldVanilla\n id={id}\n label={renderLabel}\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={disabled}\n css={{ boxSizing: 'border-box', ...css }}\n >\n {input}\n </FieldVanilla>\n );\n },\n);\n\nTextFieldVanilla.displayName = 'TextFieldVanilla';\n"],"mappings":";;;;;;;;;AA8BA,IAAa,mBAAmB,MAAM,YAKlC,EACE,OACA,WACA,OAAO,kBACP,aACA,OACA,eACA,IACA,MACA,UACA,UACA,KACA,GAAG,SAEL,iBACG;CACH,MAAM,WAAW,MAAM,OAAkC,IAAI;CAC7D,MAAM,oBAAoB,oBAAoB,SAAS,OAA6B;CAEpF,MAAM,aAAa,gBAAgB;CACnC,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,IAAI;CACrD,MAAM,oBAAoB,MAAM,cAAc,cAAc,YAAY,CAAC,SAAS,CAAC;CAEnF,MAAM,UAAU,UAAU,aAAa,QAAQ,KAAK,KAAK,QAAQ,YAAY,OAAO;CAEpF,MAAM,cAAc,MAAM,cAAc;EACtC,IAAI,qBAAqB,KAAA,KAAa,qBAAqB,MACzD;EAEF,IAAI,OAAO,qBAAqB,UAC9B,OAAO;EAET,QAAQ,eAAgC,oBAAC,kBAAD,EAAkB,GAAI,WAAa,CAAA;CAC7E,GAAG,CAAC,gBAAgB,CAAC;CAErB,MAAM,iBAAiB,MAAM,cAAc,S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