@traefik-labs/faency 13.6.0 → 13.7.1
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/README.md +11 -3
- package/dist/components/AriaTable/AriaTable.js +4 -4
- package/dist/components/AriaTable/AriaTable.js.map +1 -1
- package/dist/components/AriaTable/AriaTable.vanilla.css.cjs.map +1 -1
- package/dist/components/AriaTable/AriaTable.vanilla.css.js.map +1 -1
- package/dist/components/AriaTable/AriaTable.vanilla.js +3 -3
- package/dist/components/AriaTable/AriaTable.vanilla.js.map +1 -1
- package/dist/components/Avatar/Avatar.vanilla.css.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.vanilla.css.js.map +1 -1
- package/dist/components/Badge/Badge.vanilla.css.cjs.map +1 -1
- package/dist/components/Badge/Badge.vanilla.css.js.map +1 -1
- package/dist/components/Blockquote/Blockquote.vanilla.css.cjs.map +1 -1
- package/dist/components/Blockquote/Blockquote.vanilla.css.js.map +1 -1
- package/dist/components/Box/Box.vanilla.css.cjs.map +1 -1
- package/dist/components/Box/Box.vanilla.css.js.map +1 -1
- package/dist/components/Bubble/Bubble.vanilla.css.cjs.map +1 -1
- package/dist/components/Bubble/Bubble.vanilla.css.js.map +1 -1
- package/dist/components/Button/Button.vanilla.css.cjs.map +1 -1
- package/dist/components/Button/Button.vanilla.css.js.map +1 -1
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.css.cjs.map +1 -1
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.css.js.map +1 -1
- package/dist/components/Card/Card.vanilla.css.cjs.map +1 -1
- package/dist/components/Card/Card.vanilla.css.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.vanilla.css.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.vanilla.css.js.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.css.cjs.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.css.js.map +1 -1
- package/dist/components/Container/Container.vanilla.css.cjs.map +1 -1
- package/dist/components/Container/Container.vanilla.css.js.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/Field/Field.js +5 -5
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/Field.vanilla.css.cjs.map +1 -1
- package/dist/components/Field/Field.vanilla.css.js.map +1 -1
- package/dist/components/Field/Field.vanilla.js +5 -5
- package/dist/components/Field/Field.vanilla.js.map +1 -1
- package/dist/components/Flex/Flex.vanilla.css.cjs.map +1 -1
- package/dist/components/Flex/Flex.vanilla.css.js.map +1 -1
- package/dist/components/Grid/Grid.vanilla.css.cjs.map +1 -1
- package/dist/components/Grid/Grid.vanilla.css.js.map +1 -1
- package/dist/components/IconButton/IconButton.vanilla.css.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.vanilla.css.js.map +1 -1
- package/dist/components/Image/Image.vanilla.css.cjs.map +1 -1
- package/dist/components/Image/Image.vanilla.css.js.map +1 -1
- package/dist/components/Input/Input.vanilla.css.cjs.map +1 -1
- package/dist/components/Input/Input.vanilla.css.js.map +1 -1
- package/dist/components/Label/Label.vanilla.css.cjs.map +1 -1
- package/dist/components/Label/Label.vanilla.css.js.map +1 -1
- package/dist/components/List/List.vanilla.cjs +128 -0
- package/dist/components/List/List.vanilla.cjs.map +1 -0
- package/dist/components/List/List.vanilla.css.cjs +30 -0
- package/dist/components/List/List.vanilla.css.cjs.map +1 -0
- package/dist/components/List/List.vanilla.css.js +25 -0
- package/dist/components/List/List.vanilla.css.js.map +1 -0
- package/dist/components/List/List.vanilla.js +124 -0
- package/dist/components/List/List.vanilla.js.map +1 -0
- package/dist/components/Meter/Meter.vanilla.css.cjs.map +1 -1
- package/dist/components/Meter/Meter.vanilla.css.js.map +1 -1
- package/dist/components/Panel/Panel.vanilla.css.cjs.map +1 -1
- package/dist/components/Panel/Panel.vanilla.css.js.map +1 -1
- package/dist/components/Paragraph/Paragraph.vanilla.css.cjs.map +1 -1
- package/dist/components/Paragraph/Paragraph.vanilla.css.js.map +1 -1
- package/dist/components/RowLink/RowLink.vanilla.css.cjs.map +1 -1
- package/dist/components/RowLink/RowLink.vanilla.css.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.cjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.css.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.css.js.map +1 -1
- package/dist/components/Spinner/Spinner.vanilla.css.cjs.map +1 -1
- package/dist/components/Spinner/Spinner.vanilla.css.js.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.css.cjs.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.css.js.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.js +2 -2
- package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -1
- package/dist/components/Table/Table.js +2 -2
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.vanilla.css.cjs.map +1 -1
- package/dist/components/Table/Table.vanilla.css.js.map +1 -1
- package/dist/components/Table/Table.vanilla.js +2 -2
- package/dist/components/Table/Table.vanilla.js.map +1 -1
- package/dist/components/Text/Text.vanilla.css.cjs.map +1 -1
- package/dist/components/Text/Text.vanilla.css.js.map +1 -1
- package/dist/components/TextField/TextField.vanilla.css.cjs.map +1 -1
- package/dist/components/TextField/TextField.vanilla.css.js.map +1 -1
- package/dist/components/TextField/TextField.vanilla.js +2 -2
- package/dist/components/TextField/TextField.vanilla.js.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.css.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.css.js.map +1 -1
- package/dist/components/Toast/Toast.vanilla.css.cjs.map +1 -1
- package/dist/components/Toast/Toast.vanilla.css.js.map +1 -1
- package/dist/faency.css +2051 -1877
- package/dist/index.cjs +4 -0
- package/dist/index.d.ts +112 -34
- package/dist/index.js +2 -1
- package/dist/styles/themes.css.cjs.map +1 -1
- package/dist/styles/themes.css.js.map +1 -1
- package/dist/styles/tokens.css.cjs +93 -90
- package/dist/styles/tokens.css.cjs.map +1 -1
- package/dist/styles/tokens.css.js +93 -90
- package/dist/styles/tokens.css.js.map +1 -1
- package/dist/utils/warnOnce.cjs +8 -1
- package/dist/utils/warnOnce.cjs.map +1 -1
- package/dist/utils/warnOnce.js +8 -1
- package/dist/utils/warnOnce.js.map +1 -1
- package/package.json +16 -16
|
@@ -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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,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Meter.vanilla.css.cjs","names":[
|
|
1
|
+
{"version":3,"file":"Meter.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Meter.vanilla.css.js","names":[
|
|
1
|
+
{"version":3,"file":"Meter.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.vanilla.css.cjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"Panel.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.vanilla.css.js","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"Panel.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paragraph.vanilla.css.cjs","names":[
|
|
1
|
+
{"version":3,"file":"Paragraph.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paragraph.vanilla.css.js","names":[
|
|
1
|
+
{"version":3,"file":"Paragraph.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowLink.vanilla.css.cjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"RowLink.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowLink.vanilla.css.js","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"RowLink.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.vanilla.css.cjs","names":[
|
|
1
|
+
{"version":3,"file":"SegmentedControl.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.vanilla.css.js","names":[
|
|
1
|
+
{"version":3,"file":"SegmentedControl.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.vanilla.css.cjs","names":[
|
|
1
|
+
{"version":3,"file":"Skeleton.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.vanilla.css.js","names":[
|
|
1
|
+
{"version":3,"file":"Skeleton.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.vanilla.css.cjs","names":[
|
|
1
|
+
{"version":3,"file":"Spinner.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.vanilla.css.js","names":[
|
|
1
|
+
{"version":3,"file":"Spinner.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitLayout.vanilla.css.cjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"SplitLayout.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitLayout.vanilla.css.js","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"SplitLayout.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -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\nSplitLayoutAsideV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AA;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"}
|
|
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,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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,cAA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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,EACT,YAAY,EACV,SAAS,aACX,EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,IAAa,KAAK,OAAO,MAAM;CAC7B,WAAW;CAC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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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.vanilla.css.cjs","names":[
|
|
1
|
+
{"version":3,"file":"Table.vanilla.css.cjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.vanilla.css.js","names":[
|
|
1
|
+
{"version":3,"file":"Table.vanilla.css.js","names":[],"sources":[],"mappings":""}
|
|
@@ -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),
|