@traefik-labs/faency 13.2.0 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/Accordion.cjs +24 -18
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.js +24 -18
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Alert/Alert.cjs.map +1 -1
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/AriaTable/AriaTable.cjs +47 -9
- package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
- package/dist/components/AriaTable/AriaTable.js +48 -10
- package/dist/components/AriaTable/AriaTable.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/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.cjs +170 -0
- package/dist/components/Combobox/Combobox.vanilla.cjs.map +1 -0
- package/dist/components/Combobox/Combobox.vanilla.css.cjs +33 -0
- package/dist/components/Combobox/Combobox.vanilla.css.cjs.map +1 -0
- package/dist/components/Combobox/Combobox.vanilla.css.js +29 -0
- package/dist/components/Combobox/Combobox.vanilla.css.js.map +1 -0
- package/dist/components/Combobox/Combobox.vanilla.js +167 -0
- package/dist/components/Combobox/Combobox.vanilla.js.map +1 -0
- package/dist/components/Dialog/Dialog.cjs +4 -3
- package/dist/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/components/Dialog/Dialog.js +4 -3
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Meter/Meter.vanilla.cjs +74 -0
- package/dist/components/Meter/Meter.vanilla.cjs.map +1 -0
- package/dist/components/Meter/Meter.vanilla.css.cjs +26 -0
- package/dist/components/Meter/Meter.vanilla.css.cjs.map +1 -0
- package/dist/components/Meter/Meter.vanilla.css.js +21 -0
- package/dist/components/Meter/Meter.vanilla.css.js.map +1 -0
- package/dist/components/Meter/Meter.vanilla.js +72 -0
- package/dist/components/Meter/Meter.vanilla.js.map +1 -0
- package/dist/components/Navigation/Navigation.cjs +4 -1
- package/dist/components/Navigation/Navigation.cjs.map +1 -1
- package/dist/components/Navigation/Navigation.js +4 -1
- package/dist/components/Navigation/Navigation.js.map +1 -1
- package/dist/components/RadioAccordion/RadioAccordion.cjs +10 -6
- package/dist/components/RadioAccordion/RadioAccordion.cjs.map +1 -1
- package/dist/components/RadioAccordion/RadioAccordion.js +10 -6
- package/dist/components/RadioAccordion/RadioAccordion.js.map +1 -1
- package/dist/components/RowLink/RowLink.cjs +95 -0
- package/dist/components/RowLink/RowLink.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.js +90 -0
- package/dist/components/RowLink/RowLink.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs +57 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.cjs +35 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.cjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.js +34 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.css.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.js +53 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.js.map +1 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/SidePanel/SidePanel.cjs +3 -3
- package/dist/components/SidePanel/SidePanel.cjs.map +1 -1
- package/dist/components/SidePanel/SidePanel.js +3 -3
- package/dist/components/SidePanel/SidePanel.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.cjs +4 -0
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.js +4 -0
- package/dist/components/Skeleton/Skeleton.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.cjs +50 -0
- package/dist/components/Spinner/Spinner.vanilla.cjs.map +1 -0
- package/dist/components/Spinner/Spinner.vanilla.css.cjs +21 -0
- package/dist/components/Spinner/Spinner.vanilla.css.cjs.map +1 -0
- package/dist/components/Spinner/Spinner.vanilla.css.js +19 -0
- package/dist/components/Spinner/Spinner.vanilla.css.js.map +1 -0
- package/dist/components/Spinner/Spinner.vanilla.js +48 -0
- package/dist/components/Spinner/Spinner.vanilla.js.map +1 -0
- package/dist/components/SplitLayout/SplitLayout.vanilla.cjs +214 -0
- package/dist/components/SplitLayout/SplitLayout.vanilla.cjs.map +1 -0
- package/dist/components/SplitLayout/SplitLayout.vanilla.css.cjs +14 -0
- package/dist/components/SplitLayout/SplitLayout.vanilla.css.cjs.map +1 -0
- package/dist/components/SplitLayout/SplitLayout.vanilla.css.js +10 -0
- package/dist/components/SplitLayout/SplitLayout.vanilla.css.js.map +1 -0
- package/dist/components/SplitLayout/SplitLayout.vanilla.js +210 -0
- package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -0
- package/dist/components/Table/ExpandButton.cjs +18 -0
- package/dist/components/Table/ExpandButton.cjs.map +1 -0
- package/dist/components/Table/ExpandButton.js +19 -0
- package/dist/components/Table/ExpandButton.js.map +1 -0
- package/dist/components/Table/Table.cjs +39 -13
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.js +40 -14
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Toast/Toast.vanilla.cjs +96 -0
- package/dist/components/Toast/Toast.vanilla.cjs.map +1 -0
- package/dist/components/Toast/Toast.vanilla.css.cjs +44 -0
- package/dist/components/Toast/Toast.vanilla.css.cjs.map +1 -0
- package/dist/components/Toast/Toast.vanilla.css.js +37 -0
- package/dist/components/Toast/Toast.vanilla.css.js.map +1 -0
- package/dist/components/Toast/Toast.vanilla.js +90 -0
- package/dist/components/Toast/Toast.vanilla.js.map +1 -0
- package/dist/components/Toast/ToastProvider.vanilla.cjs +98 -0
- package/dist/components/Toast/ToastProvider.vanilla.cjs.map +1 -0
- package/dist/components/Toast/ToastProvider.vanilla.js +94 -0
- package/dist/components/Toast/ToastProvider.vanilla.js.map +1 -0
- package/dist/faency.css +2311 -1340
- package/dist/index.cjs +33 -6
- package/dist/index.d.ts +1185 -10
- package/dist/index.js +16 -7
- package/dist/styles/cssProps.cjs +3 -10
- package/dist/styles/cssProps.cjs.map +1 -1
- package/dist/styles/cssProps.js +3 -10
- package/dist/styles/cssProps.js.map +1 -1
- package/dist/styles/resolveColor.cjs +18 -0
- package/dist/styles/resolveColor.cjs.map +1 -0
- package/dist/styles/resolveColor.js +18 -0
- package/dist/styles/resolveColor.js.map +1 -0
- package/dist/styles/themes.css.cjs.map +1 -1
- package/dist/styles/themes.css.js.map +1 -1
- package/dist/styles/tokens.css.cjs +484 -0
- package/dist/styles/tokens.css.cjs.map +1 -0
- package/dist/styles/tokens.css.js +484 -0
- package/dist/styles/tokens.css.js.map +1 -0
- package/package.json +3 -9
|
@@ -91,24 +91,30 @@ var StyledAccordionContentWrapper = require_stitches_config.styled("div", {
|
|
|
91
91
|
});
|
|
92
92
|
var AccordionRoot = StyledAccordionRoot;
|
|
93
93
|
var AccordionItem = StyledAccordionItem;
|
|
94
|
-
var AccordionTrigger = react.default.forwardRef(({ children, noIcon = false, customIcon, ...props }, forwardedRef) =>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
var AccordionTrigger = react.default.forwardRef(({ children, noIcon = false, customIcon, headingLevel = 3, ...props }, forwardedRef) => {
|
|
95
|
+
const Heading = headingLevel === "none" ? "div" : `h${headingLevel}`;
|
|
96
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledAccordionHeader, {
|
|
97
|
+
asChild: true,
|
|
98
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledAccordionTrigger, {
|
|
99
|
+
ref: forwardedRef,
|
|
100
|
+
...props,
|
|
101
|
+
children: [!noIcon ? customIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
102
|
+
css: {
|
|
103
|
+
mr: "$2",
|
|
104
|
+
c: "$accordionText"
|
|
105
|
+
},
|
|
106
|
+
"aria-hidden": true,
|
|
107
|
+
children: customIcon
|
|
108
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledAccordionChevron, { "aria-hidden": true }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
109
|
+
css: {
|
|
110
|
+
ml: noIcon ? "$5" : 0,
|
|
111
|
+
width: "100%"
|
|
112
|
+
},
|
|
113
|
+
children
|
|
114
|
+
})]
|
|
115
|
+
}) })
|
|
116
|
+
});
|
|
117
|
+
});
|
|
112
118
|
var AccordionContent = react.default.forwardRef(({ children, size, ...props }, forwardedRef) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledAccordionContent, {
|
|
113
119
|
...props,
|
|
114
120
|
ref: forwardedRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.cjs","names":["keyframes","styled","AccordionPrimitive","elevationVariants","ChevronRightIcon","React","Box"],"sources":["../../../components/Accordion/Accordion.tsx"],"sourcesContent":["// @ts-nocheck\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\n\nconst open = keyframes({\n from: { height: 0 },\n to: { height: 'var(--radix-accordion-content-height)' },\n});\n\nconst close = keyframes({\n from: { height: 'var(--radix-accordion-content-height)' },\n to: { height: 0 },\n});\n\nconst StyledAccordionRoot = styled(AccordionPrimitive.Root, {\n borderRadius: 0,\n bc: 'transparent',\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 0,\n },\n});\n\nconst StyledAccordionItem = styled(AccordionPrimitive.Item, {\n mt: '$1',\n borderRadius: 'inherit',\n '&:first-child': {\n mt: 0,\n },\n boxShadow: '0 1px 0 0 $colors$divider',\n});\n\nexport const StyledAccordionHeader = styled(AccordionPrimitive.Header, {\n all: 'unset',\n display: 'flex',\n borderRadius: 'inherit',\n});\n\nexport const StyledAccordionTrigger = styled(AccordionPrimitive.Trigger, {\n all: 'unset',\n borderRadius: 'inherit',\n fontFamily: 'inherit',\n bc: '$contentBg',\n c: '$accordionLabel',\n px: '$2',\n lineHeight: 1,\n fontSize: '$3',\n display: 'flex',\n flex: 1,\n alignItems: 'center',\n justifyContent: 'flex-start',\n position: 'relative',\n '&::before': {\n borderRadius: 'inherit',\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n '&:focus': {\n boxShadow: 'inset 0 0 0 1px $colors$accordionActiveShadow',\n },\n '@hover': {\n '&:not([disabled])': {\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: '$accordionHoverShadow',\n },\n },\n },\n },\n transition: 'opacity 200ms ease-out',\n variants: {\n size: {\n small: {\n py: '$2',\n },\n medium: {\n py: '$3',\n },\n large: {\n py: '$5',\n },\n },\n },\n defaultVariants: {\n size: 'small',\n },\n});\n\nconst StyledAccordionChevron = styled(ChevronRightIcon, {\n mr: '$2',\n c: '$accordionText',\n transition: 'transform 200ms ease-out',\n '[data-state=open] > &': {\n transform: 'rotateZ(90deg)',\n },\n});\n\nconst StyledAccordionContent = styled(AccordionPrimitive.Content, {\n overflow: 'hidden',\n fontSize: '$3',\n c: '$accordionText',\n '&[data-state=\"open\"]': {\n animation: `${open} 200ms ease-out`,\n },\n '&[data-state=\"closed\"]': {\n animation: `${close} 200ms ease-out`,\n },\n});\n\nconst StyledAccordionContentWrapper = styled('div', {\n variants: {\n size: {\n small: {\n py: '$2',\n },\n medium: {\n py: '$3',\n },\n large: {\n py: '$5',\n },\n },\n },\n defaultVariants: {\n size: 'small',\n },\n});\n\n// EXPORTS\nexport const AccordionRoot = StyledAccordionRoot as any;\nexport const AccordionItem = StyledAccordionItem as any;\nexport type AccordionTriggerProps = React.ComponentProps<typeof StyledAccordionTrigger> &\n VariantProps<typeof StyledAccordionTrigger> & {\n children: React.ReactNode;\n customIcon?: React.ReactNode;\n noIcon?: boolean;\n };\nexport const AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof StyledAccordionTrigger>,\n AccordionTriggerProps\n>(({ children, noIcon = false, customIcon, ...props }, forwardedRef) => (\n <StyledAccordionHeader>\n
|
|
1
|
+
{"version":3,"file":"Accordion.cjs","names":["keyframes","styled","AccordionPrimitive","elevationVariants","ChevronRightIcon","React","Box"],"sources":["../../../components/Accordion/Accordion.tsx"],"sourcesContent":["// @ts-nocheck\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\n\nconst open = keyframes({\n from: { height: 0 },\n to: { height: 'var(--radix-accordion-content-height)' },\n});\n\nconst close = keyframes({\n from: { height: 'var(--radix-accordion-content-height)' },\n to: { height: 0 },\n});\n\nconst StyledAccordionRoot = styled(AccordionPrimitive.Root, {\n borderRadius: 0,\n bc: 'transparent',\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 0,\n },\n});\n\nconst StyledAccordionItem = styled(AccordionPrimitive.Item, {\n mt: '$1',\n borderRadius: 'inherit',\n '&:first-child': {\n mt: 0,\n },\n boxShadow: '0 1px 0 0 $colors$divider',\n});\n\nexport const StyledAccordionHeader = styled(AccordionPrimitive.Header, {\n all: 'unset',\n display: 'flex',\n borderRadius: 'inherit',\n});\n\nexport const StyledAccordionTrigger = styled(AccordionPrimitive.Trigger, {\n all: 'unset',\n borderRadius: 'inherit',\n fontFamily: 'inherit',\n bc: '$contentBg',\n c: '$accordionLabel',\n px: '$2',\n lineHeight: 1,\n fontSize: '$3',\n display: 'flex',\n flex: 1,\n alignItems: 'center',\n justifyContent: 'flex-start',\n position: 'relative',\n '&::before': {\n borderRadius: 'inherit',\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n '&:focus': {\n boxShadow: 'inset 0 0 0 1px $colors$accordionActiveShadow',\n },\n '@hover': {\n '&:not([disabled])': {\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: '$accordionHoverShadow',\n },\n },\n },\n },\n transition: 'opacity 200ms ease-out',\n variants: {\n size: {\n small: {\n py: '$2',\n },\n medium: {\n py: '$3',\n },\n large: {\n py: '$5',\n },\n },\n },\n defaultVariants: {\n size: 'small',\n },\n});\n\nconst StyledAccordionChevron = styled(ChevronRightIcon, {\n mr: '$2',\n c: '$accordionText',\n transition: 'transform 200ms ease-out',\n '[data-state=open] > &': {\n transform: 'rotateZ(90deg)',\n },\n});\n\nconst StyledAccordionContent = styled(AccordionPrimitive.Content, {\n overflow: 'hidden',\n fontSize: '$3',\n c: '$accordionText',\n '&[data-state=\"open\"]': {\n animation: `${open} 200ms ease-out`,\n },\n '&[data-state=\"closed\"]': {\n animation: `${close} 200ms ease-out`,\n },\n});\n\nconst StyledAccordionContentWrapper = styled('div', {\n variants: {\n size: {\n small: {\n py: '$2',\n },\n medium: {\n py: '$3',\n },\n large: {\n py: '$5',\n },\n },\n },\n defaultVariants: {\n size: 'small',\n },\n});\n\n// EXPORTS\nexport const AccordionRoot = StyledAccordionRoot as any;\nexport const AccordionItem = StyledAccordionItem as any;\nexport type AccordionTriggerProps = React.ComponentProps<typeof StyledAccordionTrigger> &\n VariantProps<typeof StyledAccordionTrigger> & {\n children: React.ReactNode;\n customIcon?: React.ReactNode;\n noIcon?: boolean;\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6 | 'none';\n };\nexport const AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof StyledAccordionTrigger>,\n AccordionTriggerProps\n>(({ children, noIcon = false, customIcon, headingLevel = 3, ...props }, forwardedRef) => {\n const Heading = headingLevel === 'none' ? 'div' : (`h${headingLevel}` as const);\n\n return (\n <StyledAccordionHeader asChild>\n <Heading>\n <StyledAccordionTrigger ref={forwardedRef} {...props}>\n {!noIcon ? (\n customIcon ? (\n <Box css={{ mr: '$2', c: '$accordionText' }} aria-hidden>\n {customIcon}\n </Box>\n ) : (\n <StyledAccordionChevron aria-hidden />\n )\n ) : null}\n <Box css={{ ml: noIcon ? '$5' : 0, width: '100%' }}>{children}</Box>\n </StyledAccordionTrigger>\n </Heading>\n </StyledAccordionHeader>\n );\n});\n\nexport type AccordionContentProps = VariantProps<typeof StyledAccordionContent> &\n Pick<VariantProps<typeof StyledAccordionContentWrapper>, 'size'> & {\n children: React.ReactNode;\n css?: CSS;\n };\nexport const AccordionContent = React.forwardRef<\n React.ElementRef<typeof StyledAccordionContent>,\n AccordionContentProps\n>(({ children, size, ...props }, forwardedRef) => (\n <StyledAccordionContent {...props} ref={forwardedRef}>\n <StyledAccordionContentWrapper size={size}>{children}</StyledAccordionContentWrapper>\n </StyledAccordionContent>\n));\n"],"mappings":";;;;;;;;;;;AASA,IAAM,OAAOA,wBAAAA,UAAU;CACrB,MAAM,EAAE,QAAQ,EAAE;CAClB,IAAI,EAAE,QAAQ,wCAAwC;AACxD,CAAC;AAED,IAAM,QAAQA,wBAAAA,UAAU;CACtB,MAAM,EAAE,QAAQ,wCAAwC;CACxD,IAAI,EAAE,QAAQ,EAAE;AAClB,CAAC;AAED,IAAM,sB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AAA,CACzB"}
|
|
@@ -88,24 +88,30 @@ var StyledAccordionContentWrapper = styled("div", {
|
|
|
88
88
|
});
|
|
89
89
|
var AccordionRoot = StyledAccordionRoot;
|
|
90
90
|
var AccordionItem = StyledAccordionItem;
|
|
91
|
-
var AccordionTrigger = React.forwardRef(({ children, noIcon = false, customIcon, ...props }, forwardedRef) =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
var AccordionTrigger = React.forwardRef(({ children, noIcon = false, customIcon, headingLevel = 3, ...props }, forwardedRef) => {
|
|
92
|
+
const Heading = headingLevel === "none" ? "div" : `h${headingLevel}`;
|
|
93
|
+
return /* @__PURE__ */ jsx(StyledAccordionHeader, {
|
|
94
|
+
asChild: true,
|
|
95
|
+
children: /* @__PURE__ */ jsx(Heading, { children: /* @__PURE__ */ jsxs(StyledAccordionTrigger, {
|
|
96
|
+
ref: forwardedRef,
|
|
97
|
+
...props,
|
|
98
|
+
children: [!noIcon ? customIcon ? /* @__PURE__ */ jsx(Box, {
|
|
99
|
+
css: {
|
|
100
|
+
mr: "$2",
|
|
101
|
+
c: "$accordionText"
|
|
102
|
+
},
|
|
103
|
+
"aria-hidden": true,
|
|
104
|
+
children: customIcon
|
|
105
|
+
}) : /* @__PURE__ */ jsx(StyledAccordionChevron, { "aria-hidden": true }) : null, /* @__PURE__ */ jsx(Box, {
|
|
106
|
+
css: {
|
|
107
|
+
ml: noIcon ? "$5" : 0,
|
|
108
|
+
width: "100%"
|
|
109
|
+
},
|
|
110
|
+
children
|
|
111
|
+
})]
|
|
112
|
+
}) })
|
|
113
|
+
});
|
|
114
|
+
});
|
|
109
115
|
var AccordionContent = React.forwardRef(({ children, size, ...props }, forwardedRef) => /* @__PURE__ */ jsx(StyledAccordionContent, {
|
|
110
116
|
...props,
|
|
111
117
|
ref: forwardedRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","names":[],"sources":["../../../components/Accordion/Accordion.tsx"],"sourcesContent":["// @ts-nocheck\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\n\nconst open = keyframes({\n from: { height: 0 },\n to: { height: 'var(--radix-accordion-content-height)' },\n});\n\nconst close = keyframes({\n from: { height: 'var(--radix-accordion-content-height)' },\n to: { height: 0 },\n});\n\nconst StyledAccordionRoot = styled(AccordionPrimitive.Root, {\n borderRadius: 0,\n bc: 'transparent',\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 0,\n },\n});\n\nconst StyledAccordionItem = styled(AccordionPrimitive.Item, {\n mt: '$1',\n borderRadius: 'inherit',\n '&:first-child': {\n mt: 0,\n },\n boxShadow: '0 1px 0 0 $colors$divider',\n});\n\nexport const StyledAccordionHeader = styled(AccordionPrimitive.Header, {\n all: 'unset',\n display: 'flex',\n borderRadius: 'inherit',\n});\n\nexport const StyledAccordionTrigger = styled(AccordionPrimitive.Trigger, {\n all: 'unset',\n borderRadius: 'inherit',\n fontFamily: 'inherit',\n bc: '$contentBg',\n c: '$accordionLabel',\n px: '$2',\n lineHeight: 1,\n fontSize: '$3',\n display: 'flex',\n flex: 1,\n alignItems: 'center',\n justifyContent: 'flex-start',\n position: 'relative',\n '&::before': {\n borderRadius: 'inherit',\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n '&:focus': {\n boxShadow: 'inset 0 0 0 1px $colors$accordionActiveShadow',\n },\n '@hover': {\n '&:not([disabled])': {\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: '$accordionHoverShadow',\n },\n },\n },\n },\n transition: 'opacity 200ms ease-out',\n variants: {\n size: {\n small: {\n py: '$2',\n },\n medium: {\n py: '$3',\n },\n large: {\n py: '$5',\n },\n },\n },\n defaultVariants: {\n size: 'small',\n },\n});\n\nconst StyledAccordionChevron = styled(ChevronRightIcon, {\n mr: '$2',\n c: '$accordionText',\n transition: 'transform 200ms ease-out',\n '[data-state=open] > &': {\n transform: 'rotateZ(90deg)',\n },\n});\n\nconst StyledAccordionContent = styled(AccordionPrimitive.Content, {\n overflow: 'hidden',\n fontSize: '$3',\n c: '$accordionText',\n '&[data-state=\"open\"]': {\n animation: `${open} 200ms ease-out`,\n },\n '&[data-state=\"closed\"]': {\n animation: `${close} 200ms ease-out`,\n },\n});\n\nconst StyledAccordionContentWrapper = styled('div', {\n variants: {\n size: {\n small: {\n py: '$2',\n },\n medium: {\n py: '$3',\n },\n large: {\n py: '$5',\n },\n },\n },\n defaultVariants: {\n size: 'small',\n },\n});\n\n// EXPORTS\nexport const AccordionRoot = StyledAccordionRoot as any;\nexport const AccordionItem = StyledAccordionItem as any;\nexport type AccordionTriggerProps = React.ComponentProps<typeof StyledAccordionTrigger> &\n VariantProps<typeof StyledAccordionTrigger> & {\n children: React.ReactNode;\n customIcon?: React.ReactNode;\n noIcon?: boolean;\n };\nexport const AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof StyledAccordionTrigger>,\n AccordionTriggerProps\n>(({ children, noIcon = false, customIcon, ...props }, forwardedRef) => (\n <StyledAccordionHeader>\n
|
|
1
|
+
{"version":3,"file":"Accordion.js","names":[],"sources":["../../../components/Accordion/Accordion.tsx"],"sourcesContent":["// @ts-nocheck\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\n\nconst open = keyframes({\n from: { height: 0 },\n to: { height: 'var(--radix-accordion-content-height)' },\n});\n\nconst close = keyframes({\n from: { height: 'var(--radix-accordion-content-height)' },\n to: { height: 0 },\n});\n\nconst StyledAccordionRoot = styled(AccordionPrimitive.Root, {\n borderRadius: 0,\n bc: 'transparent',\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 0,\n },\n});\n\nconst StyledAccordionItem = styled(AccordionPrimitive.Item, {\n mt: '$1',\n borderRadius: 'inherit',\n '&:first-child': {\n mt: 0,\n },\n boxShadow: '0 1px 0 0 $colors$divider',\n});\n\nexport const StyledAccordionHeader = styled(AccordionPrimitive.Header, {\n all: 'unset',\n display: 'flex',\n borderRadius: 'inherit',\n});\n\nexport const StyledAccordionTrigger = styled(AccordionPrimitive.Trigger, {\n all: 'unset',\n borderRadius: 'inherit',\n fontFamily: 'inherit',\n bc: '$contentBg',\n c: '$accordionLabel',\n px: '$2',\n lineHeight: 1,\n fontSize: '$3',\n display: 'flex',\n flex: 1,\n alignItems: 'center',\n justifyContent: 'flex-start',\n position: 'relative',\n '&::before': {\n borderRadius: 'inherit',\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n '&:focus': {\n boxShadow: 'inset 0 0 0 1px $colors$accordionActiveShadow',\n },\n '@hover': {\n '&:not([disabled])': {\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: '$accordionHoverShadow',\n },\n },\n },\n },\n transition: 'opacity 200ms ease-out',\n variants: {\n size: {\n small: {\n py: '$2',\n },\n medium: {\n py: '$3',\n },\n large: {\n py: '$5',\n },\n },\n },\n defaultVariants: {\n size: 'small',\n },\n});\n\nconst StyledAccordionChevron = styled(ChevronRightIcon, {\n mr: '$2',\n c: '$accordionText',\n transition: 'transform 200ms ease-out',\n '[data-state=open] > &': {\n transform: 'rotateZ(90deg)',\n },\n});\n\nconst StyledAccordionContent = styled(AccordionPrimitive.Content, {\n overflow: 'hidden',\n fontSize: '$3',\n c: '$accordionText',\n '&[data-state=\"open\"]': {\n animation: `${open} 200ms ease-out`,\n },\n '&[data-state=\"closed\"]': {\n animation: `${close} 200ms ease-out`,\n },\n});\n\nconst StyledAccordionContentWrapper = styled('div', {\n variants: {\n size: {\n small: {\n py: '$2',\n },\n medium: {\n py: '$3',\n },\n large: {\n py: '$5',\n },\n },\n },\n defaultVariants: {\n size: 'small',\n },\n});\n\n// EXPORTS\nexport const AccordionRoot = StyledAccordionRoot as any;\nexport const AccordionItem = StyledAccordionItem as any;\nexport type AccordionTriggerProps = React.ComponentProps<typeof StyledAccordionTrigger> &\n VariantProps<typeof StyledAccordionTrigger> & {\n children: React.ReactNode;\n customIcon?: React.ReactNode;\n noIcon?: boolean;\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6 | 'none';\n };\nexport const AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof StyledAccordionTrigger>,\n AccordionTriggerProps\n>(({ children, noIcon = false, customIcon, headingLevel = 3, ...props }, forwardedRef) => {\n const Heading = headingLevel === 'none' ? 'div' : (`h${headingLevel}` as const);\n\n return (\n <StyledAccordionHeader asChild>\n <Heading>\n <StyledAccordionTrigger ref={forwardedRef} {...props}>\n {!noIcon ? (\n customIcon ? (\n <Box css={{ mr: '$2', c: '$accordionText' }} aria-hidden>\n {customIcon}\n </Box>\n ) : (\n <StyledAccordionChevron aria-hidden />\n )\n ) : null}\n <Box css={{ ml: noIcon ? '$5' : 0, width: '100%' }}>{children}</Box>\n </StyledAccordionTrigger>\n </Heading>\n </StyledAccordionHeader>\n );\n});\n\nexport type AccordionContentProps = VariantProps<typeof StyledAccordionContent> &\n Pick<VariantProps<typeof StyledAccordionContentWrapper>, 'size'> & {\n children: React.ReactNode;\n css?: CSS;\n };\nexport const AccordionContent = React.forwardRef<\n React.ElementRef<typeof StyledAccordionContent>,\n AccordionContentProps\n>(({ children, size, ...props }, forwardedRef) => (\n <StyledAccordionContent {...props} ref={forwardedRef}>\n <StyledAccordionContentWrapper size={size}>{children}</StyledAccordion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cjs","names":["styled","Card"],"sources":["../../../components/Alert/Alert.tsx"],"sourcesContent":["import { styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\n\nexport const Alert = styled(Card, {\n variants: {\n variant: {\n gray: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$slate9',\n },\n },\n info: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$blue9',\n },\n },\n success: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$green9',\n },\n },\n warning: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$orange9',\n },\n },\n error: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$red9',\n },\n },\n },\n },\n defaultVariants: {\n variant: 'gray',\n },\n});\n\nexport type AlertVariants = VariantProps<typeof Alert>;\nexport type AlertProps = AlertVariants & NonNullable<unknown>;\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Alert.cjs","names":["styled","Card"],"sources":["../../../components/Alert/Alert.tsx"],"sourcesContent":["import { styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\n\n// TODO: when migrating to AlertVanilla, color the variants with the vanilla tone tokens\n// (info → toneInfo*, success → toneSuccess*, warning → toneWarning*, error → toneDanger*, gray → toneNeutral*)\n// instead of the raw $blue9/$green9/$orange9/$red9/$slate9 scale steps used here.\nexport const Alert = styled(Card, {\n variants: {\n variant: {\n gray: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$slate9',\n },\n },\n info: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$blue9',\n },\n },\n success: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$green9',\n },\n },\n warning: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$orange9',\n },\n },\n error: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$red9',\n },\n },\n },\n },\n defaultVariants: {\n variant: 'gray',\n },\n});\n\nexport type AlertVariants = VariantProps<typeof Alert>;\nexport type AlertProps = AlertVariants & NonNullable<unknown>;\n"],"mappings":";;;AAMA,IAAa,QAAQA,wBAAAA,OAAOC,aAAAA,MAAM;CAChC,UAAU,EACR,SAAS;EACP,MAAM,EACJ,aAAa,EACX,WAAW,iCACb,EACF;EACA,MAAM,EACJ,aAAa,EACX,WAAW,gCACb,EACF;EACA,SAAS,EACP,aAAa,EACX,WAAW,iCACb,EACF;EACA,SAAS,EACP,aAAa,EACX,WAAW,kCACb,EACF;EACA,OAAO,EACL,aAAa,EACX,WAAW,+BACb,EACF;CACF,EACF;CACA,iBAAiB,EACf,SAAS,OACX;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","names":[],"sources":["../../../components/Alert/Alert.tsx"],"sourcesContent":["import { styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\n\nexport const Alert = styled(Card, {\n variants: {\n variant: {\n gray: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$slate9',\n },\n },\n info: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$blue9',\n },\n },\n success: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$green9',\n },\n },\n warning: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$orange9',\n },\n },\n error: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$red9',\n },\n },\n },\n },\n defaultVariants: {\n variant: 'gray',\n },\n});\n\nexport type AlertVariants = VariantProps<typeof Alert>;\nexport type AlertProps = AlertVariants & NonNullable<unknown>;\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Alert.js","names":[],"sources":["../../../components/Alert/Alert.tsx"],"sourcesContent":["import { styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\n\n// TODO: when migrating to AlertVanilla, color the variants with the vanilla tone tokens\n// (info → toneInfo*, success → toneSuccess*, warning → toneWarning*, error → toneDanger*, gray → toneNeutral*)\n// instead of the raw $blue9/$green9/$orange9/$red9/$slate9 scale steps used here.\nexport const Alert = styled(Card, {\n variants: {\n variant: {\n gray: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$slate9',\n },\n },\n info: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$blue9',\n },\n },\n success: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$green9',\n },\n },\n warning: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$orange9',\n },\n },\n error: {\n '&::before': {\n boxShadow: 'inset 0 0 0 1px $colors$red9',\n },\n },\n },\n },\n defaultVariants: {\n variant: 'gray',\n },\n});\n\nexport type AlertVariants = VariantProps<typeof Alert>;\nexport type AlertProps = AlertVariants & NonNullable<unknown>;\n"],"mappings":";;;AAMA,IAAa,QAAQ,OAAO,MAAM;CAChC,UAAU,EACR,SAAS;EACP,MAAM,EACJ,aAAa,EACX,WAAW,iCACb,EACF;EACA,MAAM,EACJ,aAAa,EACX,WAAW,gCACb,EACF;EACA,SAAS,EACP,aAAa,EACX,WAAW,iCACb,EACF;EACA,SAAS,EACP,aAAa,EACX,WAAW,kCACb,EACF;EACA,OAAO,EACL,aAAa,EACX,WAAW,+BACb,EACF;CACF,EACF;CACA,iBAAiB,EACf,SAAS,OACX;AACF,CAAC"}
|
|
@@ -2,6 +2,8 @@ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
const require_stitches_config = require("../../stitches.config.cjs");
|
|
3
3
|
const require_Box = require("../Box/Box.cjs");
|
|
4
4
|
const require_deepMerge = require("../../utils/deepMerge.cjs");
|
|
5
|
+
const require_RowLink = require("../RowLink/RowLink.cjs");
|
|
6
|
+
const require_ExpandButton = require("../Table/ExpandButton.cjs");
|
|
5
7
|
const require_Table = require("../Table/Table.cjs");
|
|
6
8
|
let _radix_ui_react_icons = require("@radix-ui/react-icons");
|
|
7
9
|
let react = require("react");
|
|
@@ -24,17 +26,18 @@ var Tfoot = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_
|
|
|
24
26
|
}));
|
|
25
27
|
var StyledTr = require_stitches_config.styled("div", require_Table.StyledTr, { display: "table-row" });
|
|
26
28
|
var StyledTrSlot = require_stitches_config.styled(_radix_ui_react_slot.Slot, StyledTr);
|
|
27
|
-
var AnimatedContainer = ({ isOpen, children }) => {
|
|
29
|
+
var AnimatedContainer = ({ id, isOpen, children }) => {
|
|
28
30
|
const appliedStyle = (0, react.useMemo)(() => isOpen ? {
|
|
29
|
-
transition: "all 0.2s ease-out",
|
|
31
|
+
transition: "all 0.2s ease-out, visibility 0s",
|
|
30
32
|
paddingBottom: 0,
|
|
31
33
|
paddingTop: 0,
|
|
32
34
|
border: "none"
|
|
33
35
|
} : {
|
|
34
|
-
transition: "all 0.2s ease-out",
|
|
36
|
+
transition: "all 0.2s ease-out, visibility 0s 0.2s",
|
|
35
37
|
padding: "0px 16px",
|
|
36
38
|
pointerEvents: "none",
|
|
37
|
-
border: "none"
|
|
39
|
+
border: "none",
|
|
40
|
+
visibility: "hidden"
|
|
38
41
|
}, [isOpen]);
|
|
39
42
|
const containerStyle = (0, react.useMemo)(() => isOpen ? {
|
|
40
43
|
transition: "all 0.2s ease-out",
|
|
@@ -47,6 +50,7 @@ var AnimatedContainer = ({ isOpen, children }) => {
|
|
|
47
50
|
padding: "0px 16px"
|
|
48
51
|
}, [isOpen]);
|
|
49
52
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledTr, {
|
|
53
|
+
id,
|
|
50
54
|
css: isOpen ? { "&:not(:last-child)": { borderBottom: "1px solid $tableRowBorder" } } : {},
|
|
51
55
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Td, {
|
|
52
56
|
css: appliedStyle,
|
|
@@ -58,9 +62,11 @@ var AnimatedContainer = ({ isOpen, children }) => {
|
|
|
58
62
|
})
|
|
59
63
|
});
|
|
60
64
|
};
|
|
61
|
-
var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, emptyFirstColumn, tableHead, css, ...props }, ref) => {
|
|
65
|
+
var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn, tableHead, css, href, linkAs, linkCell, linkProps, interactive, ...props }, ref) => {
|
|
66
|
+
if (asChild && href !== void 0) throw new Error("Tr cannot use href with asChild. Use RowLink in a cell instead.");
|
|
62
67
|
const Component = asChild ? StyledTrSlot : StyledTr;
|
|
63
68
|
const [isCollapsed, setIsCollapsed] = (0, react.useState)(false);
|
|
69
|
+
const contentId = (0, react.useId)();
|
|
64
70
|
if (!asChild) {
|
|
65
71
|
const arrayChildren = react.Children.toArray(children);
|
|
66
72
|
if (arrayChildren.some((child) => {
|
|
@@ -70,26 +76,56 @@ var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, emptyFirs
|
|
|
70
76
|
}) && arrayChildren.length > 1) throw new Error("Using fullColSpan is allowed only for a single full width Td.");
|
|
71
77
|
}
|
|
72
78
|
const TdEl = (0, react.useMemo)(() => emptyFirstColumn ? tableHead ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Th, { css: { width: 24 } }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Td, {}, "empty-td") : collapsedContent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Td, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
79
|
+
css: {
|
|
80
|
+
position: "relative",
|
|
81
|
+
zIndex: 2
|
|
82
|
+
},
|
|
73
83
|
onClick: (e) => {
|
|
74
84
|
e.stopPropagation();
|
|
75
85
|
e.preventDefault();
|
|
76
86
|
},
|
|
77
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.ChevronRightIcon, {
|
|
87
|
+
children: asChild ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.ChevronRightIcon, {
|
|
78
88
|
onClick: () => setIsCollapsed(!isCollapsed),
|
|
79
89
|
style: {
|
|
80
90
|
cursor: "pointer",
|
|
81
91
|
transition: "transform 0.2s ease-out",
|
|
82
92
|
transform: isCollapsed ? "rotate(90deg)" : "initial"
|
|
83
93
|
}
|
|
94
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ExpandButton.ExpandButton, {
|
|
95
|
+
type: "button",
|
|
96
|
+
"aria-label": expandLabel,
|
|
97
|
+
"aria-expanded": isCollapsed,
|
|
98
|
+
"aria-controls": contentId,
|
|
99
|
+
onClick: () => setIsCollapsed(!isCollapsed),
|
|
100
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.ChevronRightIcon, {
|
|
101
|
+
"aria-hidden": true,
|
|
102
|
+
style: {
|
|
103
|
+
transition: "transform 0.2s ease-out",
|
|
104
|
+
transform: isCollapsed ? "rotate(90deg)" : "initial"
|
|
105
|
+
}
|
|
106
|
+
})
|
|
84
107
|
})
|
|
85
|
-
}) }, "chevron-td") : null, [
|
|
108
|
+
}) }, "chevron-td") : null, [
|
|
109
|
+
isCollapsed,
|
|
110
|
+
asChild,
|
|
111
|
+
expandLabel
|
|
112
|
+
]);
|
|
86
113
|
const renderedChildren = (0, react.useMemo)(() => {
|
|
87
114
|
if (asChild) return (0, react.cloneElement)(children, { ...children?.props }, [TdEl, ...children?.props?.children || []]);
|
|
88
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [TdEl, children
|
|
115
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [TdEl, require_RowLink.withRowLink(children, {
|
|
116
|
+
href,
|
|
117
|
+
linkAs,
|
|
118
|
+
linkCell,
|
|
119
|
+
linkProps
|
|
120
|
+
}, Td)] });
|
|
89
121
|
}, [
|
|
90
122
|
asChild,
|
|
91
123
|
TdEl,
|
|
92
|
-
children
|
|
124
|
+
children,
|
|
125
|
+
href,
|
|
126
|
+
linkAs,
|
|
127
|
+
linkCell,
|
|
128
|
+
linkProps
|
|
93
129
|
]);
|
|
94
130
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
95
131
|
ref,
|
|
@@ -98,9 +134,11 @@ var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, emptyFirs
|
|
|
98
134
|
...css,
|
|
99
135
|
[`&:nth-last-child(2) > span`]: { borderBottom: "none" }
|
|
100
136
|
} : { ...css },
|
|
137
|
+
interactive: interactive ?? (href !== void 0 || void 0),
|
|
101
138
|
...props,
|
|
102
139
|
children: renderedChildren
|
|
103
140
|
}), !!collapsedContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedContainer, {
|
|
141
|
+
id: contentId,
|
|
104
142
|
isOpen: isCollapsed,
|
|
105
143
|
children: collapsedContent
|
|
106
144
|
})] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaTable.cjs","names":["styled","TableCaption","TableTbody","forwardRef","TableTfoot","TableTr","Slot","useMemo","Box","useState","Children","isValidElement","ChevronRightIcon","cloneElement","_Fragment","TableTh","TableTd","deepMerge","TableThead","TableTable"],"sources":["../../../components/AriaTable/AriaTable.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, {\n Children,\n cloneElement,\n ComponentProps,\n ElementRef,\n forwardRef,\n isValidElement,\n ReactNode,\n useMemo,\n useState,\n} from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { deepMerge } from '../../utils/deepMerge';\nimport { Box } from '../Box';\nimport type { TableVariants } from '../Table';\nimport {\n Caption as TableCaption,\n StyledTr as TableTr,\n Table as TableTable,\n Tbody as TableTbody,\n Td as TableTd,\n Tfoot as TableTfoot,\n Th as TableTh,\n Thead as TableThead,\n} from '../Table';\n\nexport const Caption = styled('div', TableCaption, {\n display: 'table-caption',\n});\n\nconst StyledTbody = styled('div', TableTbody, {\n display: 'table-row-group',\n});\nexport const Tbody = forwardRef<\n ElementRef<typeof StyledTbody>,\n ComponentProps<typeof StyledTbody> & VariantProps<typeof StyledTbody>\n>((props, ref) => <StyledTbody ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTfoot = styled('div', TableTfoot, {\n display: 'table-footer-group',\n});\nexport const Tfoot = forwardRef<\n ElementRef<typeof StyledTfoot>,\n ComponentProps<typeof StyledTfoot> & VariantProps<typeof StyledTfoot>\n>((props, ref) => <StyledTfoot ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTr = styled('div', TableTr, {\n display: 'table-row',\n});\nconst StyledTrSlot = styled(Slot, StyledTr);\n\nconst AnimatedContainer = ({ isOpen, children }: { isOpen: boolean; children: ReactNode }) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? {\n transition: 'all 0.2s ease-out',\n paddingBottom: 0,\n paddingTop: 0,\n border: 'none',\n }\n : {\n transition: 'all 0.2s ease-out',\n padding: '0px 16px',\n pointerEvents: 'none',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? {\n transition: 'all 0.2s ease-out',\n padding: '16px',\n paddingBottom: 0,\n }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n padding: '0px 16px',\n },\n [isOpen],\n );\n\n return (\n <StyledTr\n css={isOpen ? { '&:not(:last-child)': { borderBottom: '1px solid $tableRowBorder' } } : {}}\n >\n <Td css={appliedStyle} fullColSpan>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </StyledTr>\n );\n};\n\nexport type AriaTrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n asChild?: boolean;\n collapsedContent?: React.ReactNode;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n children?: React.ReactNode;\n };\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, AriaTrProps>(\n ({ asChild, children, collapsedContent, emptyFirstColumn, tableHead, css, ...props }, ref) => {\n const Component = asChild ? StyledTrSlot : StyledTr;\n const [isCollapsed, setIsCollapsed] = useState(false);\n\n if (!asChild) {\n // eslint-disable-next-line @eslint-react/no-children-to-array\n const arrayChildren = Children.toArray(children);\n const hasColSpanChildren = arrayChildren.some((child) => {\n if (!isValidElement(child)) {\n return false;\n }\n const { fullColSpan } = child.props as TdProps;\n return !!fullColSpan;\n });\n if (hasColSpanChildren && arrayChildren.length > 1) {\n throw new Error('Using fullColSpan is allowed only for a single full width Td.');\n }\n }\n\n const TdEl = useMemo(\n () =>\n emptyFirstColumn ? (\n tableHead ? (\n <Th css={{ width: 24 }} />\n ) : (\n <Td key=\"empty-td\" />\n )\n ) : collapsedContent ? (\n <Td key=\"chevron-td\">\n <Box\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <ChevronRightIcon\n onClick={() => setIsCollapsed(!isCollapsed)}\n style={{\n cursor: 'pointer',\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </Box>\n </Td>\n ) : null,\n // eslint-disable-next-line @eslint-react/exhaustive-deps\n [isCollapsed],\n );\n\n const renderedChildren = useMemo(() => {\n if (asChild) {\n // eslint-disable-next-line @eslint-react/no-clone-element\n return cloneElement(\n children as any,\n {\n // @ts-ignore: Object is possibly 'null'.\n ...children?.props,\n },\n // @ts-ignore: Object is possibly 'null'.\n [TdEl, ...(children?.props?.children || [])],\n );\n }\n\n return (\n <>\n {TdEl}\n {children}\n </>\n );\n }, [asChild, TdEl, children]);\n\n return (\n <>\n <Component\n ref={ref}\n role=\"row\"\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > span`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n {...props}\n >\n {renderedChildren}\n </Component>\n {!!collapsedContent && (\n <AnimatedContainer isOpen={isCollapsed}>{collapsedContent}</AnimatedContainer>\n )}\n </>\n );\n },\n);\n\nconst StyledTh = styled('span', TableTh, {\n display: 'table-cell',\n});\n\nexport interface ThProps extends ComponentProps<typeof StyledTh>, VariantProps<typeof StyledTh> {}\n\nexport const Th = forwardRef<ElementRef<typeof StyledTh>, ComponentProps<typeof StyledTh>>(\n (props, ref) => <StyledTh ref={ref} role=\"columnheader\" {...props} />,\n);\n\nconst StyledTd = styled('span', TableTd, {\n display: 'table-cell',\n});\n\nconst FillerTd = styled(StyledTd, {\n visibility: 'hidden',\n});\nexport type TdProps = ComponentProps<typeof StyledTd> &\n VariantProps<typeof StyledTd> &\n VariantProps<typeof TableTd> & {\n fullColSpan?: boolean;\n };\n\nexport const Td = forwardRef<ElementRef<typeof StyledTd>, TdProps>(\n ({ fullColSpan, css, ...props }, ref) => {\n const fullColSpanCss = useMemo(\n () =>\n fullColSpan\n ? {\n position: 'absolute',\n left: 0,\n width: '100%',\n height: '100%',\n }\n : {},\n [fullColSpan],\n );\n if (fullColSpan) {\n return (\n <>\n <FillerTd css={css} {...props} />\n <StyledTd ref={ref} role=\"cell\" css={deepMerge(fullColSpanCss, css)} {...props} />\n </>\n );\n }\n return <StyledTd ref={ref} role=\"cell\" css={css} {...props} />;\n },\n);\n\nconst StyledThead = styled('div', TableThead, {\n display: 'table-header-group',\n});\nexport const Thead = forwardRef<\n ElementRef<typeof StyledThead>,\n ComponentProps<typeof StyledThead> & VariantProps<typeof StyledThead> & NonNullable<unknown>\n>((props, ref) => <StyledThead ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTable = styled('div', TableTable, {\n display: 'table',\n});\nexport const Table = forwardRef<\n ElementRef<typeof StyledTable>,\n ComponentProps<typeof StyledTable> &\n VariantProps<typeof StyledTable> & { hasCollapsibleChildren?: boolean }\n>(({ hasCollapsibleChildren, css, ...props }, ref) => (\n <StyledTable\n ref={ref}\n role=\"table\"\n css={hasCollapsibleChildren ? { borderCollapse: 'collapse', ...css } : css}\n {...props}\n />\n));\n\nexport type AriaTableVariants = VariantProps<typeof Table>;\nexport type AriaTableProps = TableVariants & { children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GAAG,SAAS,QAAQ;CACvC,MAAM,kBAAA,GAAiBI,MAAAA,QAAAA,OAEnB,cACI;EACE,UAAU;EACV,MAAM;EACN,OAAO;EACP,QAAQ;CACV,IACA,CAAC,GACP,CAAC,WAAW,CACd;CACA,IAAI,aACF,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAAO,kBAAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EAAe;EAAK,GAAI;CAAQ,CAAA,GAChC,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EAAe;EAAK,MAAK;EAAO,KAAKG,kBAAAA,UAAU,gBAAgB,GAAG;EAAG,GAAI;CAAQ,CAAA,CACjF,EAAA,CAAA;CAGN,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EAAe;EAAK,MAAK;EAAY;EAAK,GAAI;CAAQ,CAAA;AAC/D,CACF;AAEA,IAAM,cAAcjB,wBAAAA,OAAO,OAAOkB,cAAAA,OAAY,EAC5C,SAAS,qBACX,CAAC;AACD,IAAa,SAAA,GAAQf,MAAAA,WAAAA,EAGlB,OAAO,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;CAAkB;CAAK,MAAK;CAAW,GAAI;AAAQ,CAAA,CAAC;AAEtE,IAAM,cAAcH,wBAAAA,OAAO,OAAOmB,cAAAA,OAAY,EAC5C,SAAS,QACX,CAAC;AACD,IAAa,SAAA,GAAQhB,MAAAA,WAAAA,EAIlB,EAAE,wBAAwB,KAAK,GAAG,SAAS,QAC5C,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;CACO;CACL,MAAK;CACL,KAAK,yBAAyB;EAAE,gBAAgB;EAAY,GAAG;CAAI,IAAI;CACvE,GAAI;AACL,CAAA,CACF"}
|
|
1
|
+
{"version":3,"file":"AriaTable.cjs","names":["styled","TableCaption","TableTbody","forwardRef","TableTfoot","TableTr","Slot","useMemo","Box","useState","useId","Children","isValidElement","ChevronRightIcon","ExpandButton","cloneElement","_Fragment","withRowLink","TableTh","TableTd","deepMerge","TableThead","TableTable"],"sources":["../../../components/AriaTable/AriaTable.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, {\n Children,\n cloneElement,\n ComponentProps,\n ElementRef,\n forwardRef,\n isValidElement,\n ReactNode,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { deepMerge } from '../../utils/deepMerge';\nimport { Box } from '../Box';\nimport { ROW_LINK_CONTROL_Z_INDEX, RowLinkShortcutProps, withRowLink } from '../RowLink';\nimport type { TableVariants } from '../Table';\nimport {\n Caption as TableCaption,\n StyledTr as TableTr,\n Table as TableTable,\n Tbody as TableTbody,\n Td as TableTd,\n Tfoot as TableTfoot,\n Th as TableTh,\n Thead as TableThead,\n} from '../Table';\nimport { ExpandButton } from '../Table/ExpandButton';\n\nexport const Caption = styled('div', TableCaption, {\n display: 'table-caption',\n});\n\nconst StyledTbody = styled('div', TableTbody, {\n display: 'table-row-group',\n});\nexport const Tbody = forwardRef<\n ElementRef<typeof StyledTbody>,\n ComponentProps<typeof StyledTbody> & VariantProps<typeof StyledTbody>\n>((props, ref) => <StyledTbody ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTfoot = styled('div', TableTfoot, {\n display: 'table-footer-group',\n});\nexport const Tfoot = forwardRef<\n ElementRef<typeof StyledTfoot>,\n ComponentProps<typeof StyledTfoot> & VariantProps<typeof StyledTfoot>\n>((props, ref) => <StyledTfoot ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTr = styled('div', TableTr, {\n display: 'table-row',\n});\nconst StyledTrSlot = styled(Slot, StyledTr);\n\nconst AnimatedContainer = ({\n id,\n isOpen,\n children,\n}: {\n id: string;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? {\n transition: 'all 0.2s ease-out, visibility 0s',\n paddingBottom: 0,\n paddingTop: 0,\n border: 'none',\n }\n : {\n transition: 'all 0.2s ease-out, visibility 0s 0.2s',\n padding: '0px 16px',\n pointerEvents: 'none',\n border: 'none',\n visibility: 'hidden',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? {\n transition: 'all 0.2s ease-out',\n padding: '16px',\n paddingBottom: 0,\n }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n padding: '0px 16px',\n },\n [isOpen],\n );\n\n return (\n <StyledTr\n id={id}\n css={isOpen ? { '&:not(:last-child)': { borderBottom: '1px solid $tableRowBorder' } } : {}}\n >\n <Td css={appliedStyle} fullColSpan>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </StyledTr>\n );\n};\n\nexport type AriaTrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n asChild?: boolean;\n collapsedContent?: React.ReactNode;\n expandLabel?: string;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n children?: React.ReactNode;\n } & RowLinkShortcutProps;\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, AriaTrProps>(\n (\n {\n asChild,\n children,\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn,\n tableHead,\n css,\n href,\n linkAs,\n linkCell,\n linkProps,\n interactive,\n ...props\n },\n ref,\n ) => {\n if (asChild && href !== undefined) {\n throw new Error('Tr cannot use href with asChild. Use RowLink in a cell instead.');\n }\n const Component = asChild ? StyledTrSlot : StyledTr;\n const [isCollapsed, setIsCollapsed] = useState(false);\n const contentId = useId();\n\n if (!asChild) {\n // eslint-disable-next-line @eslint-react/no-children-to-array\n const arrayChildren = Children.toArray(children);\n const hasColSpanChildren = arrayChildren.some((child) => {\n if (!isValidElement(child)) {\n return false;\n }\n const { fullColSpan } = child.props as TdProps;\n return !!fullColSpan;\n });\n if (hasColSpanChildren && arrayChildren.length > 1) {\n throw new Error('Using fullColSpan is allowed only for a single full width Td.');\n }\n }\n\n const TdEl = useMemo(\n () =>\n emptyFirstColumn ? (\n tableHead ? (\n <Th css={{ width: 24 }} />\n ) : (\n <Td key=\"empty-td\" />\n )\n ) : collapsedContent ? (\n <Td key=\"chevron-td\">\n <Box\n css={{ position: 'relative', zIndex: ROW_LINK_CONTROL_Z_INDEX }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n {asChild ? (\n <ChevronRightIcon\n onClick={() => setIsCollapsed(!isCollapsed)}\n style={{\n cursor: 'pointer',\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n ) : (\n <ExpandButton\n type=\"button\"\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 )}\n </Box>\n </Td>\n ) : null,\n // eslint-disable-next-line @eslint-react/exhaustive-deps\n [isCollapsed, asChild, expandLabel],\n );\n\n const renderedChildren = useMemo(() => {\n if (asChild) {\n // eslint-disable-next-line @eslint-react/no-clone-element\n return cloneElement(\n children as any,\n {\n // @ts-ignore: Object is possibly 'null'.\n ...children?.props,\n },\n // @ts-ignore: Object is possibly 'null'.\n [TdEl, ...(children?.props?.children || [])],\n );\n }\n\n return (\n <>\n {TdEl}\n {withRowLink(children, { href, linkAs, linkCell, linkProps }, Td)}\n </>\n );\n }, [asChild, TdEl, children, href, linkAs, linkCell, linkProps]);\n\n return (\n <>\n <Component\n ref={ref}\n role=\"row\"\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > span`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n interactive={interactive ?? (href !== undefined || undefined)}\n {...props}\n >\n {renderedChildren}\n </Component>\n {!!collapsedContent && (\n <AnimatedContainer id={contentId} isOpen={isCollapsed}>\n {collapsedContent}\n </AnimatedContainer>\n )}\n </>\n );\n },\n);\n\nconst StyledTh = styled('span', TableTh, {\n display: 'table-cell',\n});\n\nexport interface ThProps extends ComponentProps<typeof StyledTh>, VariantProps<typeof StyledTh> {}\n\nexport const Th = forwardRef<ElementRef<typeof StyledTh>, ComponentProps<typeof StyledTh>>(\n (props, ref) => <StyledTh ref={ref} role=\"columnheader\" {...props} />,\n);\n\nconst StyledTd = styled('span', TableTd, {\n display: 'table-cell',\n});\n\nconst FillerTd = styled(StyledTd, {\n visibility: 'hidden',\n});\nexport type TdProps = ComponentProps<typeof StyledTd> &\n VariantProps<typeof StyledTd> &\n VariantProps<typeof TableTd> & {\n fullColSpan?: boolean;\n };\n\nexport const Td = forwardRef<ElementRef<typeof StyledTd>, TdProps>(\n ({ fullColSpan, css, ...props }, ref) => {\n const fullColSpanCss = useMemo(\n () =>\n fullColSpan\n ? {\n position: 'absolute',\n left: 0,\n width: '100%',\n height: '100%',\n }\n : {},\n [fullColSpan],\n );\n if (fullColSpan) {\n return (\n <>\n <FillerTd css={css} {...props} />\n <StyledTd ref={ref} role=\"cell\" css={deepMerge(fullColSpanCss, css)} {...props} />\n </>\n );\n }\n return <StyledTd ref={ref} role=\"cell\" css={css} {...props} />;\n },\n);\n\nconst StyledThead = styled('div', TableThead, {\n display: 'table-header-group',\n});\nexport const Thead = forwardRef<\n ElementRef<typeof StyledThead>,\n ComponentProps<typeof StyledThead> & VariantProps<typeof StyledThead> & NonNullable<unknown>\n>((props, ref) => <StyledThead ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTable = styled('div', TableTable, {\n display: 'table',\n});\nexport const Table = forwardRef<\n ElementRef<typeof StyledTable>,\n ComponentProps<typeof StyledTable> &\n VariantProps<typeof StyledTable> & { hasCollapsibleChildren?: boolean }\n>(({ hasCollapsibleChildren, css, ...props }, ref) => (\n <StyledTable\n ref={ref}\n role=\"table\"\n css={hasCollapsibleChildren ? { borderCollapse: 'collapse', ...css } : css}\n {...props}\n />\n));\n\nexport type AriaTableVariants = VariantProps<typeof Table>;\nexport type AriaTableProps = TableVariants & { children?: React.ReactNode; css?: CSS };\n"],"mappings":";;;;;;;;;;;;;AAgCA,IAAa,UAAUA,wBAAAA,OAAO,OAAOC,cAAAA,SAAc,EACjD,SAAS,gBACX,CAAC;AAED,IAAM,cAAcD,wBAAAA,OAAO,OAAOE,cAAAA,OAAY,EAC5C,SAAS,kBACX,CAAC;AACD,IAAa,SAAA,GAAQC,MAAAA,WAAAA,EAGlB,OAAO,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;CAAkB;CAAK,MAAK;CAAW,GAAI;AAAQ,CAAA,CAAC;AAEtE,IAAM,cAAcH,wBAAAA,OAAO,OAAOI,cAAAA,OAAY,EAC5C,SAAS,qBACX,CAAC;AACD,IAAa,SAAA,GAAQD,MAAAA,WAAAA,EAGlB,OAAO,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;CAAkB;CAAK,MAAK;CAAW,GAAI;AAAQ,CAAA,CAAC;AAEtE,IAAM,WAAWH,wBAAAA,OAAO,OAAOK,cAAAA,UAAS,EACtC,SAAS,YACX,CAAC;AACD,IAAM,eAAeL,wBAAAA,OAAOM,qBAAAA,MAAM,QAAQ;AAE1C,IAAM,qBAAqB,EACzB,IACA,QACA,eAKI;CACJ,MAAM,gBAAA,GAAeC,MAAAA,QAAAA,OAEjB,SACI;EACE,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,QAAQ;CACV,IACA;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EACf,QAAQ;EACR,YAAY;CACd,GACN,CAAC,MAAM,CACT;CAEA,MAAM,kBAAA,GAAiBA,MAAAA,QAAAA,OAEnB,SACI;EACE,YAAY;EACZ,SAAS;EACT,eAAe;CACjB,IACA;EACE,YAAY;EACZ,QAAQ;EACR,UAAU;EACV,SAAS;CACX,GACN,CAAC,MAAM,CACT;CAEA,OACE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CAAC,UAAD;EAAe;EAAK,MAAK;EAAY;EAAK,GAAI;CAAQ,CAAA;AAC/D,CACF;AAEA,IAAM,cAAcpB,wBAAAA,OAAO,OAAOqB,cAAAA,OAAY,EAC5C,SAAS,qBACX,CAAC;AACD,IAAa,SAAA,GAAQlB,MAAAA,WAAAA,EAGlB,OAAO,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;CAAkB;CAAK,MAAK;CAAW,GAAI;AAAQ,CAAA,CAAC;AAEtE,IAAM,cAAcH,wBAAAA,OAAO,OAAOsB,cAAAA,OAAY,EAC5C,SAAS,QACX,CAAC;AACD,IAAa,SAAA,GAAQnB,MAAAA,WAAAA,EAIlB,EAAE,wBAAwB,KAAK,GAAG,SAAS,QAC5C,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;CACO;CACL,MAAK;CACL,KAAK,yBAAyB;EAAE,gBAAgB;EAAY,GAAG;CAAI,IAAI;CACvE,GAAI;AACL,CAAA,CACF"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { styled } from "../../stitches.config.js";
|
|
2
2
|
import { Box } from "../Box/Box.js";
|
|
3
3
|
import { deepMerge } from "../../utils/deepMerge.js";
|
|
4
|
+
import { withRowLink } from "../RowLink/RowLink.js";
|
|
5
|
+
import { ExpandButton } from "../Table/ExpandButton.js";
|
|
4
6
|
import { Caption as Caption$1, StyledTr as StyledTr$1, Table as Table$1, Tbody as Tbody$1, Td as Td$1, Tfoot as Tfoot$1, Th as Th$1, Thead as Thead$1 } from "../Table/Table.js";
|
|
5
7
|
import { ChevronRightIcon } from "@radix-ui/react-icons";
|
|
6
|
-
import { Children, cloneElement, forwardRef, isValidElement, useMemo, useState } from "react";
|
|
8
|
+
import { Children, cloneElement, forwardRef, isValidElement, useId, useMemo, useState } from "react";
|
|
7
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
10
|
import { Slot } from "@radix-ui/react-slot";
|
|
9
11
|
// components/AriaTable/AriaTable.tsx
|
|
@@ -22,17 +24,18 @@ var Tfoot = forwardRef((props, ref) => /* @__PURE__ */ jsx(StyledTfoot, {
|
|
|
22
24
|
}));
|
|
23
25
|
var StyledTr = styled("div", StyledTr$1, { display: "table-row" });
|
|
24
26
|
var StyledTrSlot = styled(Slot, StyledTr);
|
|
25
|
-
var AnimatedContainer = ({ isOpen, children }) => {
|
|
27
|
+
var AnimatedContainer = ({ id, isOpen, children }) => {
|
|
26
28
|
const appliedStyle = useMemo(() => isOpen ? {
|
|
27
|
-
transition: "all 0.2s ease-out",
|
|
29
|
+
transition: "all 0.2s ease-out, visibility 0s",
|
|
28
30
|
paddingBottom: 0,
|
|
29
31
|
paddingTop: 0,
|
|
30
32
|
border: "none"
|
|
31
33
|
} : {
|
|
32
|
-
transition: "all 0.2s ease-out",
|
|
34
|
+
transition: "all 0.2s ease-out, visibility 0s 0.2s",
|
|
33
35
|
padding: "0px 16px",
|
|
34
36
|
pointerEvents: "none",
|
|
35
|
-
border: "none"
|
|
37
|
+
border: "none",
|
|
38
|
+
visibility: "hidden"
|
|
36
39
|
}, [isOpen]);
|
|
37
40
|
const containerStyle = useMemo(() => isOpen ? {
|
|
38
41
|
transition: "all 0.2s ease-out",
|
|
@@ -45,6 +48,7 @@ var AnimatedContainer = ({ isOpen, children }) => {
|
|
|
45
48
|
padding: "0px 16px"
|
|
46
49
|
}, [isOpen]);
|
|
47
50
|
return /* @__PURE__ */ jsx(StyledTr, {
|
|
51
|
+
id,
|
|
48
52
|
css: isOpen ? { "&:not(:last-child)": { borderBottom: "1px solid $tableRowBorder" } } : {},
|
|
49
53
|
children: /* @__PURE__ */ jsx(Td, {
|
|
50
54
|
css: appliedStyle,
|
|
@@ -56,9 +60,11 @@ var AnimatedContainer = ({ isOpen, children }) => {
|
|
|
56
60
|
})
|
|
57
61
|
});
|
|
58
62
|
};
|
|
59
|
-
var Tr = forwardRef(({ asChild, children, collapsedContent, emptyFirstColumn, tableHead, css, ...props }, ref) => {
|
|
63
|
+
var Tr = forwardRef(({ asChild, children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn, tableHead, css, href, linkAs, linkCell, linkProps, interactive, ...props }, ref) => {
|
|
64
|
+
if (asChild && href !== void 0) throw new Error("Tr cannot use href with asChild. Use RowLink in a cell instead.");
|
|
60
65
|
const Component = asChild ? StyledTrSlot : StyledTr;
|
|
61
66
|
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
67
|
+
const contentId = useId();
|
|
62
68
|
if (!asChild) {
|
|
63
69
|
const arrayChildren = Children.toArray(children);
|
|
64
70
|
if (arrayChildren.some((child) => {
|
|
@@ -68,26 +74,56 @@ var Tr = forwardRef(({ asChild, children, collapsedContent, emptyFirstColumn, ta
|
|
|
68
74
|
}) && arrayChildren.length > 1) throw new Error("Using fullColSpan is allowed only for a single full width Td.");
|
|
69
75
|
}
|
|
70
76
|
const TdEl = useMemo(() => emptyFirstColumn ? tableHead ? /* @__PURE__ */ jsx(Th, { css: { width: 24 } }) : /* @__PURE__ */ jsx(Td, {}, "empty-td") : collapsedContent ? /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Box, {
|
|
77
|
+
css: {
|
|
78
|
+
position: "relative",
|
|
79
|
+
zIndex: 2
|
|
80
|
+
},
|
|
71
81
|
onClick: (e) => {
|
|
72
82
|
e.stopPropagation();
|
|
73
83
|
e.preventDefault();
|
|
74
84
|
},
|
|
75
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
85
|
+
children: asChild ? /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
76
86
|
onClick: () => setIsCollapsed(!isCollapsed),
|
|
77
87
|
style: {
|
|
78
88
|
cursor: "pointer",
|
|
79
89
|
transition: "transform 0.2s ease-out",
|
|
80
90
|
transform: isCollapsed ? "rotate(90deg)" : "initial"
|
|
81
91
|
}
|
|
92
|
+
}) : /* @__PURE__ */ jsx(ExpandButton, {
|
|
93
|
+
type: "button",
|
|
94
|
+
"aria-label": expandLabel,
|
|
95
|
+
"aria-expanded": isCollapsed,
|
|
96
|
+
"aria-controls": contentId,
|
|
97
|
+
onClick: () => setIsCollapsed(!isCollapsed),
|
|
98
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
99
|
+
"aria-hidden": true,
|
|
100
|
+
style: {
|
|
101
|
+
transition: "transform 0.2s ease-out",
|
|
102
|
+
transform: isCollapsed ? "rotate(90deg)" : "initial"
|
|
103
|
+
}
|
|
104
|
+
})
|
|
82
105
|
})
|
|
83
|
-
}) }, "chevron-td") : null, [
|
|
106
|
+
}) }, "chevron-td") : null, [
|
|
107
|
+
isCollapsed,
|
|
108
|
+
asChild,
|
|
109
|
+
expandLabel
|
|
110
|
+
]);
|
|
84
111
|
const renderedChildren = useMemo(() => {
|
|
85
112
|
if (asChild) return cloneElement(children, { ...children?.props }, [TdEl, ...children?.props?.children || []]);
|
|
86
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [TdEl, children
|
|
113
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [TdEl, withRowLink(children, {
|
|
114
|
+
href,
|
|
115
|
+
linkAs,
|
|
116
|
+
linkCell,
|
|
117
|
+
linkProps
|
|
118
|
+
}, Td)] });
|
|
87
119
|
}, [
|
|
88
120
|
asChild,
|
|
89
121
|
TdEl,
|
|
90
|
-
children
|
|
122
|
+
children,
|
|
123
|
+
href,
|
|
124
|
+
linkAs,
|
|
125
|
+
linkCell,
|
|
126
|
+
linkProps
|
|
91
127
|
]);
|
|
92
128
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Component, {
|
|
93
129
|
ref,
|
|
@@ -96,9 +132,11 @@ var Tr = forwardRef(({ asChild, children, collapsedContent, emptyFirstColumn, ta
|
|
|
96
132
|
...css,
|
|
97
133
|
[`&:nth-last-child(2) > span`]: { borderBottom: "none" }
|
|
98
134
|
} : { ...css },
|
|
135
|
+
interactive: interactive ?? (href !== void 0 || void 0),
|
|
99
136
|
...props,
|
|
100
137
|
children: renderedChildren
|
|
101
138
|
}), !!collapsedContent && /* @__PURE__ */ jsx(AnimatedContainer, {
|
|
139
|
+
id: contentId,
|
|
102
140
|
isOpen: isCollapsed,
|
|
103
141
|
children: collapsedContent
|
|
104
142
|
})] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaTable.js","names":["TableCaption","TableTbody","TableTfoot","TableTr","_Fragment","TableTh","TableTd","TableThead","TableTable"],"sources":["../../../components/AriaTable/AriaTable.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, {\n Children,\n cloneElement,\n ComponentProps,\n ElementRef,\n forwardRef,\n isValidElement,\n ReactNode,\n useMemo,\n useState,\n} from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { deepMerge } from '../../utils/deepMerge';\nimport { Box } from '../Box';\nimport type { TableVariants } from '../Table';\nimport {\n Caption as TableCaption,\n StyledTr as TableTr,\n Table as TableTable,\n Tbody as TableTbody,\n Td as TableTd,\n Tfoot as TableTfoot,\n Th as TableTh,\n Thead as TableThead,\n} from '../Table';\n\nexport const Caption = styled('div', TableCaption, {\n display: 'table-caption',\n});\n\nconst StyledTbody = styled('div', TableTbody, {\n display: 'table-row-group',\n});\nexport const Tbody = forwardRef<\n ElementRef<typeof StyledTbody>,\n ComponentProps<typeof StyledTbody> & VariantProps<typeof StyledTbody>\n>((props, ref) => <StyledTbody ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTfoot = styled('div', TableTfoot, {\n display: 'table-footer-group',\n});\nexport const Tfoot = forwardRef<\n ElementRef<typeof StyledTfoot>,\n ComponentProps<typeof StyledTfoot> & VariantProps<typeof StyledTfoot>\n>((props, ref) => <StyledTfoot ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTr = styled('div', TableTr, {\n display: 'table-row',\n});\nconst StyledTrSlot = styled(Slot, StyledTr);\n\nconst AnimatedContainer = ({ isOpen, children }: { isOpen: boolean; children: ReactNode }) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? {\n transition: 'all 0.2s ease-out',\n paddingBottom: 0,\n paddingTop: 0,\n border: 'none',\n }\n : {\n transition: 'all 0.2s ease-out',\n padding: '0px 16px',\n pointerEvents: 'none',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? {\n transition: 'all 0.2s ease-out',\n padding: '16px',\n paddingBottom: 0,\n }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n padding: '0px 16px',\n },\n [isOpen],\n );\n\n return (\n <StyledTr\n css={isOpen ? { '&:not(:last-child)': { borderBottom: '1px solid $tableRowBorder' } } : {}}\n >\n <Td css={appliedStyle} fullColSpan>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </StyledTr>\n );\n};\n\nexport type AriaTrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n asChild?: boolean;\n collapsedContent?: React.ReactNode;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n children?: React.ReactNode;\n };\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, AriaTrProps>(\n ({ asChild, children, collapsedContent, emptyFirstColumn, tableHead, css, ...props }, ref) => {\n const Component = asChild ? StyledTrSlot : StyledTr;\n const [isCollapsed, setIsCollapsed] = useState(false);\n\n if (!asChild) {\n // eslint-disable-next-line @eslint-react/no-children-to-array\n const arrayChildren = Children.toArray(children);\n const hasColSpanChildren = arrayChildren.some((child) => {\n if (!isValidElement(child)) {\n return false;\n }\n const { fullColSpan } = child.props as TdProps;\n return !!fullColSpan;\n });\n if (hasColSpanChildren && arrayChildren.length > 1) {\n throw new Error('Using fullColSpan is allowed only for a single full width Td.');\n }\n }\n\n const TdEl = useMemo(\n () =>\n emptyFirstColumn ? (\n tableHead ? (\n <Th css={{ width: 24 }} />\n ) : (\n <Td key=\"empty-td\" />\n )\n ) : collapsedContent ? (\n <Td key=\"chevron-td\">\n <Box\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <ChevronRightIcon\n onClick={() => setIsCollapsed(!isCollapsed)}\n style={{\n cursor: 'pointer',\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </Box>\n </Td>\n ) : null,\n // eslint-disable-next-line @eslint-react/exhaustive-deps\n [isCollapsed],\n );\n\n const renderedChildren = useMemo(() => {\n if (asChild) {\n // eslint-disable-next-line @eslint-react/no-clone-element\n return cloneElement(\n children as any,\n {\n // @ts-ignore: Object is possibly 'null'.\n ...children?.props,\n },\n // @ts-ignore: Object is possibly 'null'.\n [TdEl, ...(children?.props?.children || [])],\n );\n }\n\n return (\n <>\n {TdEl}\n {children}\n </>\n );\n }, [asChild, TdEl, children]);\n\n return (\n <>\n <Component\n ref={ref}\n role=\"row\"\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > span`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n {...props}\n >\n {renderedChildren}\n </Component>\n {!!collapsedContent && (\n <AnimatedContainer isOpen={isCollapsed}>{collapsedContent}</AnimatedContainer>\n )}\n </>\n );\n },\n);\n\nconst StyledTh = styled('span', TableTh, {\n display: 'table-cell',\n});\n\nexport interface ThProps extends ComponentProps<typeof StyledTh>, VariantProps<typeof StyledTh> {}\n\nexport const Th = forwardRef<ElementRef<typeof StyledTh>, ComponentProps<typeof StyledTh>>(\n (props, ref) => <StyledTh ref={ref} role=\"columnheader\" {...props} />,\n);\n\nconst StyledTd = styled('span', TableTd, {\n display: 'table-cell',\n});\n\nconst FillerTd = styled(StyledTd, {\n visibility: 'hidden',\n});\nexport type TdProps = ComponentProps<typeof StyledTd> &\n VariantProps<typeof StyledTd> &\n VariantProps<typeof TableTd> & {\n fullColSpan?: boolean;\n };\n\nexport const Td = forwardRef<ElementRef<typeof StyledTd>, TdProps>(\n ({ fullColSpan, css, ...props }, ref) => {\n const fullColSpanCss = useMemo(\n () =>\n fullColSpan\n ? {\n position: 'absolute',\n left: 0,\n width: '100%',\n height: '100%',\n }\n : {},\n [fullColSpan],\n );\n if (fullColSpan) {\n return (\n <>\n <FillerTd css={css} {...props} />\n <StyledTd ref={ref} role=\"cell\" css={deepMerge(fullColSpanCss, css)} {...props} />\n </>\n );\n }\n return <StyledTd ref={ref} role=\"cell\" css={css} {...props} />;\n },\n);\n\nconst StyledThead = styled('div', TableThead, {\n display: 'table-header-group',\n});\nexport const Thead = forwardRef<\n ElementRef<typeof StyledThead>,\n ComponentProps<typeof StyledThead> & VariantProps<typeof StyledThead> & NonNullable<unknown>\n>((props, ref) => <StyledThead ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTable = styled('div', TableTable, {\n display: 'table',\n});\nexport const Table = forwardRef<\n ElementRef<typeof StyledTable>,\n ComponentProps<typeof StyledTable> &\n VariantProps<typeof StyledTable> & { hasCollapsibleChildren?: boolean }\n>(({ hasCollapsibleChildren, css, ...props }, ref) => (\n <StyledTable\n ref={ref}\n role=\"table\"\n css={hasCollapsibleChildren ? { borderCollapse: 'collapse', ...css } : css}\n {...props}\n />\n));\n\nexport type AriaTableVariants = VariantProps<typeof Table>;\nexport type AriaTableProps = TableVariants & { children?: React.ReactNode; css?: CSS };\n"],"mappings":";;;;;;;;;AA6BA,IAAa,UAAU,OAAO,OAAOA,WAAc,EACjD,SAAS,gBACX,CAAC;AAED,IAAM,cAAc,OAAO,OAAOC,SAAY,EAC5C,SAAS,kBACX,CAAC;AACD,IAAa,QAAQ,YAGlB,OAAO,QAAQ,oBAAC,aAAD;CAAkB;CAAK,MAAK;CAAW,GAAI;AAAQ,CAAA,CAAC;AAEtE,IAAM,cAAc,OAAO,OAAOC,SAAY,EAC5C,SAAS,qBACX,CAAC;AACD,IAAa,QAAQ,YAGlB,OAAO,QAAQ,oBAAC,aAAD;CAAkB;CAAK,MAAK;CAAW,GAAI;AAAQ,CAAA,CAAC;AAEtE,IAAM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iB,cAEnB,cACI;EACE,UAAU;EACV,MAAM;EACN,OAAO;EACP,QAAQ;CACV,IACA,CAAC,GACP,CAAC,WAAW,CACd;CACA,IAAI,aACF,OACE,qBAAAF,UAAA,EAAA,UAAA,CACE,oBAAC,UAAD;EAAe;EAAK,GAAI;CAAQ,CAAA,GAChC,oBAAC,UAAD;EAAe;EAAK,MAAK;EAAO,KAAK,UAAU,gBAAgB,GAAG;EAAG,GAAI;CAAQ,CAAA,CACjF,EAAA,CAAA;CAGN,OAAO,oBAAC,UAAD;EAAe;EAAK,MAAK;EAAY;EAAK,GAAI;CAAQ,CAAA;AAC/D,CACF;AAEA,IAAM,cAAc,OAAO,OAAOG,SAAY,EAC5C,SAAS,qBACX,CAAC;AACD,IAAa,QAAQ,YAGlB,OAAO,QAAQ,oBAAC,aAAD;CAAkB;CAAK,MAAK;CAAW,GAAI;AAAQ,CAAA,CAAC;AAEtE,IAAM,cAAc,OAAO,OAAOC,SAAY,EAC5C,SAAS,QACX,CAAC;AACD,IAAa,QAAQ,YAIlB,EAAE,wBAAwB,KAAK,GAAG,SAAS,QAC5C,oBAAC,aAAD;CACO;CACL,MAAK;CACL,KAAK,yBAAyB;EAAE,gBAAgB;EAAY,GAAG;CAAI,IAAI;CACvE,GAAI;AACL,CAAA,CACF"}
|
|
1
|
+
{"version":3,"file":"AriaTable.js","names":["TableCaption","TableTbody","TableTfoot","TableTr","_Fragment","TableTh","TableTd","TableThead","TableTable"],"sources":["../../../components/AriaTable/AriaTable.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, {\n Children,\n cloneElement,\n ComponentProps,\n ElementRef,\n forwardRef,\n isValidElement,\n ReactNode,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { deepMerge } from '../../utils/deepMerge';\nimport { Box } from '../Box';\nimport { ROW_LINK_CONTROL_Z_INDEX, RowLinkShortcutProps, withRowLink } from '../RowLink';\nimport type { TableVariants } from '../Table';\nimport {\n Caption as TableCaption,\n StyledTr as TableTr,\n Table as TableTable,\n Tbody as TableTbody,\n Td as TableTd,\n Tfoot as TableTfoot,\n Th as TableTh,\n Thead as TableThead,\n} from '../Table';\nimport { ExpandButton } from '../Table/ExpandButton';\n\nexport const Caption = styled('div', TableCaption, {\n display: 'table-caption',\n});\n\nconst StyledTbody = styled('div', TableTbody, {\n display: 'table-row-group',\n});\nexport const Tbody = forwardRef<\n ElementRef<typeof StyledTbody>,\n ComponentProps<typeof StyledTbody> & VariantProps<typeof StyledTbody>\n>((props, ref) => <StyledTbody ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTfoot = styled('div', TableTfoot, {\n display: 'table-footer-group',\n});\nexport const Tfoot = forwardRef<\n ElementRef<typeof StyledTfoot>,\n ComponentProps<typeof StyledTfoot> & VariantProps<typeof StyledTfoot>\n>((props, ref) => <StyledTfoot ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTr = styled('div', TableTr, {\n display: 'table-row',\n});\nconst StyledTrSlot = styled(Slot, StyledTr);\n\nconst AnimatedContainer = ({\n id,\n isOpen,\n children,\n}: {\n id: string;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? {\n transition: 'all 0.2s ease-out, visibility 0s',\n paddingBottom: 0,\n paddingTop: 0,\n border: 'none',\n }\n : {\n transition: 'all 0.2s ease-out, visibility 0s 0.2s',\n padding: '0px 16px',\n pointerEvents: 'none',\n border: 'none',\n visibility: 'hidden',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? {\n transition: 'all 0.2s ease-out',\n padding: '16px',\n paddingBottom: 0,\n }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n padding: '0px 16px',\n },\n [isOpen],\n );\n\n return (\n <StyledTr\n id={id}\n css={isOpen ? { '&:not(:last-child)': { borderBottom: '1px solid $tableRowBorder' } } : {}}\n >\n <Td css={appliedStyle} fullColSpan>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </StyledTr>\n );\n};\n\nexport type AriaTrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n asChild?: boolean;\n collapsedContent?: React.ReactNode;\n expandLabel?: string;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n children?: React.ReactNode;\n } & RowLinkShortcutProps;\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, AriaTrProps>(\n (\n {\n asChild,\n children,\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn,\n tableHead,\n css,\n href,\n linkAs,\n linkCell,\n linkProps,\n interactive,\n ...props\n },\n ref,\n ) => {\n if (asChild && href !== undefined) {\n throw new Error('Tr cannot use href with asChild. Use RowLink in a cell instead.');\n }\n const Component = asChild ? StyledTrSlot : StyledTr;\n const [isCollapsed, setIsCollapsed] = useState(false);\n const contentId = useId();\n\n if (!asChild) {\n // eslint-disable-next-line @eslint-react/no-children-to-array\n const arrayChildren = Children.toArray(children);\n const hasColSpanChildren = arrayChildren.some((child) => {\n if (!isValidElement(child)) {\n return false;\n }\n const { fullColSpan } = child.props as TdProps;\n return !!fullColSpan;\n });\n if (hasColSpanChildren && arrayChildren.length > 1) {\n throw new Error('Using fullColSpan is allowed only for a single full width Td.');\n }\n }\n\n const TdEl = useMemo(\n () =>\n emptyFirstColumn ? (\n tableHead ? (\n <Th css={{ width: 24 }} />\n ) : (\n <Td key=\"empty-td\" />\n )\n ) : collapsedContent ? (\n <Td key=\"chevron-td\">\n <Box\n css={{ position: 'relative', zIndex: ROW_LINK_CONTROL_Z_INDEX }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n {asChild ? (\n <ChevronRightIcon\n onClick={() => setIsCollapsed(!isCollapsed)}\n style={{\n cursor: 'pointer',\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n ) : (\n <ExpandButton\n type=\"button\"\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 )}\n </Box>\n </Td>\n ) : null,\n // eslint-disable-next-line @eslint-react/exhaustive-deps\n [isCollapsed, asChild, expandLabel],\n );\n\n const renderedChildren = useMemo(() => {\n if (asChild) {\n // eslint-disable-next-line @eslint-react/no-clone-element\n return cloneElement(\n children as any,\n {\n // @ts-ignore: Object is possibly 'null'.\n ...children?.props,\n },\n // @ts-ignore: Object is possibly 'null'.\n [TdEl, ...(children?.props?.children || [])],\n );\n }\n\n return (\n <>\n {TdEl}\n {withRowLink(children, { href, linkAs, linkCell, linkProps }, Td)}\n </>\n );\n }, [asChild, TdEl, children, href, linkAs, linkCell, linkProps]);\n\n return (\n <>\n <Component\n ref={ref}\n role=\"row\"\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > span`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n interactive={interactive ?? (href !== undefined || undefined)}\n {...props}\n >\n {renderedChildren}\n </Component>\n {!!collapsedContent && (\n <AnimatedContainer id={contentId} isOpen={isCollapsed}>\n {collapsedContent}\n </AnimatedContainer>\n )}\n </>\n );\n },\n);\n\nconst StyledTh = styled('span', TableTh, {\n display: 'table-cell',\n});\n\nexport interface ThProps extends ComponentProps<typeof StyledTh>, VariantProps<typeof StyledTh> {}\n\nexport const Th = forwardRef<ElementRef<typeof StyledTh>, ComponentProps<typeof StyledTh>>(\n (props, ref) => <StyledTh ref={ref} role=\"columnheader\" {...props} />,\n);\n\nconst StyledTd = styled('span', TableTd, {\n display: 'table-cell',\n});\n\nconst FillerTd = styled(StyledTd, {\n visibility: 'hidden',\n});\nexport type TdProps = ComponentProps<typeof StyledTd> &\n VariantProps<typeof StyledTd> &\n VariantProps<typeof TableTd> & {\n fullColSpan?: boolean;\n };\n\nexport const Td = forwardRef<ElementRef<typeof StyledTd>, TdProps>(\n ({ fullColSpan, css, ...props }, ref) => {\n const fullColSpanCss = useMemo(\n () =>\n fullColSpan\n ? {\n position: 'absolute',\n left: 0,\n width: '100%',\n height: '100%',\n }\n : {},\n [fullColSpan],\n );\n if (fullColSpan) {\n return (\n <>\n <FillerTd css={css} {...props} />\n <StyledTd ref={ref} role=\"cell\" css={deepMerge(fullColSpanCss, css)} {...props} />\n </>\n );\n }\n return <StyledTd ref={ref} role=\"cell\" css={css} {...props} />;\n },\n);\n\nconst StyledThead = styled('div', TableThead, {\n display: 'table-header-group',\n});\nexport const Thead = forwardRef<\n ElementRef<typeof StyledThead>,\n ComponentProps<typeof StyledThead> & VariantProps<typeof StyledThead> & NonNullable<unknown>\n>((props, ref) => <StyledThead ref={ref} role=\"rowgroup\" {...props} />);\n\nconst StyledTable = styled('div', TableTable, {\n display: 'table',\n});\nexport const Table = forwardRef<\n ElementRef<typeof StyledTable>,\n ComponentProps<typeof StyledTable> &\n VariantProps<typeof StyledTable> & { hasCollapsibleChildren?: boolean }\n>(({ hasCollapsibleChildren, css, ...props }, ref) => (\n <StyledTable\n ref={ref}\n role=\"table\"\n css={hasCollapsibleChildren ? { borderCollapse: 'collapse', ...css } : css}\n {...props}\n />\n));\n\nexport type AriaTableVariants = VariantProps<typeof Table>;\nexport type AriaTableProps = TableVariants & { children?: React.ReactNode; css?: CSS };\n"],"mappings":";;;;;;;;;;;AAgCA,IAAa,UAAU,OAAO,OAAOA,WAAc,EACjD,SAAS,gBACX,CAAC;AAED,IAAM,cAAc,OAAO,OAAOC,SAAY,EAC5C,SAAS,kBACX,CAAC;AACD,IAAa,QAAQ,YAGlB,OAAO,QAAQ,oBAAC,aAAD;CAAkB;CAAK,MAAK;CAAW,GAAI;AAAQ,CAAA,CAAC;AAEtE,IAAM,cAAc,OAA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