@traefik-labs/faency 13.4.0 → 13.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/components/AriaTable/AriaTable.cjs +15 -5
  2. package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
  3. package/dist/components/AriaTable/AriaTable.js +16 -6
  4. package/dist/components/AriaTable/AriaTable.js.map +1 -1
  5. package/dist/components/CodeBlock/CodeBlock.cjs +2 -2
  6. package/dist/components/CodeBlock/CodeBlock.js +2 -2
  7. package/dist/components/CodeBlock/CodeBlock.vanilla.cjs +3 -3
  8. package/dist/components/CodeBlock/CodeBlock.vanilla.js +3 -3
  9. package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -1
  10. package/dist/components/DateTimePicker/DateTimePicker.js +1 -1
  11. package/dist/components/Dialog/Dialog.cjs +1 -1
  12. package/dist/components/Dialog/Dialog.js +1 -1
  13. package/dist/components/Field/Field.cjs +80 -33
  14. package/dist/components/Field/Field.cjs.map +1 -1
  15. package/dist/components/Field/Field.js +80 -33
  16. package/dist/components/Field/Field.js.map +1 -1
  17. package/dist/components/Field/Field.vanilla.cjs +62 -32
  18. package/dist/components/Field/Field.vanilla.cjs.map +1 -1
  19. package/dist/components/Field/Field.vanilla.css.cjs +6 -0
  20. package/dist/components/Field/Field.vanilla.css.cjs.map +1 -1
  21. package/dist/components/Field/Field.vanilla.css.js +4 -1
  22. package/dist/components/Field/Field.vanilla.css.js.map +1 -1
  23. package/dist/components/Field/Field.vanilla.js +63 -33
  24. package/dist/components/Field/Field.vanilla.js.map +1 -1
  25. package/dist/components/Field/FieldContext.cjs +48 -10
  26. package/dist/components/Field/FieldContext.cjs.map +1 -1
  27. package/dist/components/Field/FieldContext.js +48 -10
  28. package/dist/components/Field/FieldContext.js.map +1 -1
  29. package/dist/components/List/List.cjs +1 -1
  30. package/dist/components/List/List.js +1 -1
  31. package/dist/components/Meter/Meter.vanilla.cjs +1 -1
  32. package/dist/components/Meter/Meter.vanilla.js +1 -1
  33. package/dist/components/NavigationTree/NavigationTreeItem.cjs +2 -2
  34. package/dist/components/NavigationTree/NavigationTreeItem.js +2 -2
  35. package/dist/components/RowLink/RowLink.cjs +35 -12
  36. package/dist/components/RowLink/RowLink.cjs.map +1 -1
  37. package/dist/components/RowLink/RowLink.js +34 -12
  38. package/dist/components/RowLink/RowLink.js.map +1 -1
  39. package/dist/components/Select/Select.cjs +1 -1
  40. package/dist/components/Select/Select.js +1 -1
  41. package/dist/components/Spinner/Spinner.vanilla.cjs +1 -1
  42. package/dist/components/Spinner/Spinner.vanilla.js +1 -1
  43. package/dist/components/Table/Table.cjs +13 -4
  44. package/dist/components/Table/Table.cjs.map +1 -1
  45. package/dist/components/Table/Table.js +13 -4
  46. package/dist/components/Table/Table.js.map +1 -1
  47. package/dist/components/TextField/TextField.cjs +1 -1
  48. package/dist/components/TextField/TextField.js +1 -1
  49. package/dist/components/TextField/TextField.vanilla.cjs +1 -1
  50. package/dist/components/TextField/TextField.vanilla.js +1 -1
  51. package/dist/components/Textarea/Textarea.cjs +2 -2
  52. package/dist/components/Textarea/Textarea.js +2 -2
  53. package/dist/components/Textarea/Textarea.vanilla.cjs +2 -2
  54. package/dist/components/Textarea/Textarea.vanilla.js +2 -2
  55. package/dist/components/Toast/ToastProvider.vanilla.cjs +1 -1
  56. package/dist/components/Toast/ToastProvider.vanilla.js +1 -1
  57. package/dist/faency.css +1612 -1597
  58. package/dist/index.cjs +29 -29
  59. package/dist/index.d.ts +26 -7
  60. package/dist/index.js +29 -29
  61. package/dist/utils/warnOnce.cjs +13 -0
  62. package/dist/utils/warnOnce.cjs.map +1 -0
  63. package/dist/utils/warnOnce.js +13 -0
  64. package/dist/utils/warnOnce.js.map +1 -0
  65. package/package.json +10 -17
@@ -1,10 +1,10 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
- const require_Box = require("../Box/Box.cjs");
4
3
  const require_deepMerge = require("../../utils/deepMerge.cjs");
4
+ const require_Box = require("../Box/Box.cjs");
5
5
  const require_RowLink = require("../RowLink/RowLink.cjs");
6
- const require_ExpandButton = require("../Table/ExpandButton.cjs");
7
6
  const require_Table = require("../Table/Table.cjs");
7
+ const require_ExpandButton = require("../Table/ExpandButton.cjs");
8
8
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
9
9
  let react = require("react");
10
10
  react = require_runtime.__toESM(react, 1);
@@ -62,7 +62,7 @@ var AnimatedContainer = ({ id, isOpen, children }) => {
62
62
  })
63
63
  });
64
64
  };
65
- var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn, tableHead, css, href, linkAs, linkCell, linkProps, interactive, ...props }, ref) => {
65
+ var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn, tableHead, css, href, linkAs, linkCell, linkProps, linkOverlay, interactive, onClick, onAuxClick, ...props }, ref) => {
66
66
  if (asChild && href !== void 0) throw new Error("Tr cannot use href with asChild. Use RowLink in a cell instead.");
67
67
  const Component = asChild ? StyledTrSlot : StyledTr;
68
68
  const [isCollapsed, setIsCollapsed] = (0, react.useState)(false);
@@ -116,7 +116,8 @@ var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, expandLab
116
116
  href,
117
117
  linkAs,
118
118
  linkCell,
119
- linkProps
119
+ linkProps,
120
+ linkOverlay
120
121
  }, Td)] });
121
122
  }, [
122
123
  asChild,
@@ -125,7 +126,8 @@ var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, expandLab
125
126
  href,
126
127
  linkAs,
127
128
  linkCell,
128
- linkProps
129
+ linkProps,
130
+ linkOverlay
129
131
  ]);
130
132
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
131
133
  ref,
@@ -135,6 +137,14 @@ var Tr = (0, react.forwardRef)(({ asChild, children, collapsedContent, expandLab
135
137
  [`&:nth-last-child(2) > span`]: { borderBottom: "none" }
136
138
  } : { ...css },
137
139
  interactive: interactive ?? (href !== void 0 || void 0),
140
+ onClick: (event) => {
141
+ onClick?.(event);
142
+ require_RowLink.openRowLink(event);
143
+ },
144
+ onAuxClick: (event) => {
145
+ onAuxClick?.(event);
146
+ require_RowLink.openRowLink(event);
147
+ },
138
148
  ...props,
139
149
  children: renderedChildren
140
150
  }), !!collapsedContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedContainer, {
@@ -1 +1 @@
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,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AK,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,CAAAS,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,KAAKI,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,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
+ {"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 {\n openRowLink,\n ROW_LINK_CONTROL_Z_INDEX,\n RowLinkShortcutProps,\n withRowLink,\n} 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 linkOverlay,\n interactive,\n onClick,\n onAuxClick,\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, linkOverlay }, Td)}\n </>\n );\n }, [asChild, TdEl, children, href, linkAs, linkCell, linkProps, linkOverlay]);\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 onClick={(event) => {\n onClick?.(event);\n openRowLink(event);\n }}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\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":";;;;;;;;;;;;;AAqCA,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,GAAiB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GAAA,kBAAA,KAAA,CAAAS,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,KAAKI,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,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,9 @@
1
1
  import { styled } from "../../stitches.config.js";
2
- import { Box } from "../Box/Box.js";
3
2
  import { deepMerge } from "../../utils/deepMerge.js";
4
- import { withRowLink } from "../RowLink/RowLink.js";
5
- import { ExpandButton } from "../Table/ExpandButton.js";
3
+ import { Box } from "../Box/Box.js";
4
+ import { openRowLink, withRowLink } from "../RowLink/RowLink.js";
6
5
  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";
6
+ import { ExpandButton } from "../Table/ExpandButton.js";
7
7
  import { ChevronRightIcon } from "@radix-ui/react-icons";
8
8
  import { Children, cloneElement, forwardRef, isValidElement, useId, useMemo, useState } from "react";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -60,7 +60,7 @@ var AnimatedContainer = ({ id, isOpen, children }) => {
60
60
  })
61
61
  });
62
62
  };
63
- var Tr = forwardRef(({ asChild, children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn, tableHead, css, href, linkAs, linkCell, linkProps, interactive, ...props }, ref) => {
63
+ var Tr = forwardRef(({ asChild, children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn, tableHead, css, href, linkAs, linkCell, linkProps, linkOverlay, interactive, onClick, onAuxClick, ...props }, ref) => {
64
64
  if (asChild && href !== void 0) throw new Error("Tr cannot use href with asChild. Use RowLink in a cell instead.");
65
65
  const Component = asChild ? StyledTrSlot : StyledTr;
66
66
  const [isCollapsed, setIsCollapsed] = useState(false);
@@ -114,7 +114,8 @@ var Tr = forwardRef(({ asChild, children, collapsedContent, expandLabel = "Expan
114
114
  href,
115
115
  linkAs,
116
116
  linkCell,
117
- linkProps
117
+ linkProps,
118
+ linkOverlay
118
119
  }, Td)] });
119
120
  }, [
120
121
  asChild,
@@ -123,7 +124,8 @@ var Tr = forwardRef(({ asChild, children, collapsedContent, expandLabel = "Expan
123
124
  href,
124
125
  linkAs,
125
126
  linkCell,
126
- linkProps
127
+ linkProps,
128
+ linkOverlay
127
129
  ]);
128
130
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Component, {
129
131
  ref,
@@ -133,6 +135,14 @@ var Tr = forwardRef(({ asChild, children, collapsedContent, expandLabel = "Expan
133
135
  [`&:nth-last-child(2) > span`]: { borderBottom: "none" }
134
136
  } : { ...css },
135
137
  interactive: interactive ?? (href !== void 0 || void 0),
138
+ onClick: (event) => {
139
+ onClick?.(event);
140
+ openRowLink(event);
141
+ },
142
+ onAuxClick: (event) => {
143
+ onAuxClick?.(event);
144
+ openRowLink(event);
145
+ },
136
146
  ...props,
137
147
  children: renderedChildren
138
148
  }), !!collapsedContent && /* @__PURE__ */ jsx(AnimatedContainer, {
@@ -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 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,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,WAAW,OAAO,OAAOC,YAAS,EACtC,SAAS,YACX,CAAC;AACD,IAAM,eAAe,OAAO,MAAM,QAAQ;AAE1C,IAAM,qBAAqB,EACzB,IACA,QACA,eAKI;CACJ,MAAM,eAAe,cAEjB,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,iBAAiB,cAEnB,SACI;EACE,YAAY;EACZ,SAAS;EACT,eAAe;CACjB,IACA;EACE,YAAY;EACZ,QAAQ;EACR,UAAU;EACV,SAAS;CACX,GACN,CAAC,MAAM,CACT;CAEA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C;AAOD,IAAa,KAAK,YACf,EAAE,aAAa,KAAK,GAAG,SAAS,QAAQ;CACvC,MAAM,iBAAiB,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 {\n openRowLink,\n ROW_LINK_CONTROL_Z_INDEX,\n RowLinkShortcutProps,\n withRowLink,\n} 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 linkOverlay,\n interactive,\n onClick,\n onAuxClick,\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, linkOverlay }, Td)}\n </>\n );\n }, [asChild, TdEl, children, href, linkAs, linkCell, linkProps, linkOverlay]);\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 onClick={(event) => {\n onClick?.(event);\n openRowLink(event);\n }}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\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":";;;;;;;;;;;AAqCA,IAAa,UAAU,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AK,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,8 +1,8 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
- const require_AccessibleIcon = require("../AccessibleIcon/AccessibleIcon.cjs");
3
2
  const require_stitches_config = require("../../stitches.config.cjs");
4
- const require_Box = require("../Box/Box.cjs");
5
3
  const require_useIsomorphicLayoutEffect = require("../../utils/useIsomorphicLayoutEffect.cjs");
4
+ const require_AccessibleIcon = require("../AccessibleIcon/AccessibleIcon.cjs");
5
+ const require_Box = require("../Box/Box.cjs");
6
6
  const require_Button = require("../Button/Button.cjs");
7
7
  const require_colorSchemeContext = require("../colorSchemeContext.cjs");
8
8
  require("./prism-extend.cjs");
@@ -1,7 +1,7 @@
1
- import { AccessibleIcon } from "../AccessibleIcon/AccessibleIcon.js";
2
1
  import { styled } from "../../stitches.config.js";
3
- import { Box } from "../Box/Box.js";
4
2
  import { useIsomorphicLayoutEffect } from "../../utils/useIsomorphicLayoutEffect.js";
3
+ import { AccessibleIcon } from "../AccessibleIcon/AccessibleIcon.js";
4
+ import { Box } from "../Box/Box.js";
5
5
  import { Button } from "../Button/Button.js";
6
6
  import { useColorScheme } from "../colorSchemeContext.js";
7
7
  import { Prism } from "./prism-extend.js";
@@ -1,11 +1,11 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
- const require_AccessibleIcon = require("../AccessibleIcon/AccessibleIcon.cjs");
3
2
  const require_cssProps = require("../../styles/cssProps.cjs");
4
- const require_useIsomorphicLayoutEffect = require("../../utils/useIsomorphicLayoutEffect.cjs");
5
3
  const require_themeContext = require("../../styles/themeContext.cjs");
4
+ const require_useIsomorphicLayoutEffect = require("../../utils/useIsomorphicLayoutEffect.cjs");
5
+ const require_AccessibleIcon = require("../AccessibleIcon/AccessibleIcon.cjs");
6
6
  const require_Button_vanilla = require("../Button/Button.vanilla.cjs");
7
- require("./prism-extend.cjs");
8
7
  const require_CodeBlock_vanilla_css = require("./CodeBlock.vanilla.css.cjs");
8
+ require("./prism-extend.cjs");
9
9
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
10
10
  let react = require("react");
11
11
  react = require_runtime.__toESM(react, 1);
@@ -1,10 +1,10 @@
1
- import { AccessibleIcon } from "../AccessibleIcon/AccessibleIcon.js";
2
1
  import { processCSSProp } from "../../styles/cssProps.js";
3
- import { useIsomorphicLayoutEffect } from "../../utils/useIsomorphicLayoutEffect.js";
4
2
  import { useVanillaExtractTheme } from "../../styles/themeContext.js";
3
+ import { useIsomorphicLayoutEffect } from "../../utils/useIsomorphicLayoutEffect.js";
4
+ import { AccessibleIcon } from "../AccessibleIcon/AccessibleIcon.js";
5
5
  import { ButtonVanilla } from "../Button/Button.vanilla.js";
6
- import { Prism } from "./prism-extend.js";
7
6
  import { codeContent, codeContentBottomPadding, codeContentTopPadding, copyButtonWrapperBottomLeft, copyButtonWrapperBottomRight, copyButtonWrapperTop, copyButtonWrapperTopLeft, pre, preNoBorder } from "./CodeBlock.vanilla.css.js";
7
+ import { Prism } from "./prism-extend.js";
8
8
  import { CheckIcon, CopyIcon } from "@radix-ui/react-icons";
9
9
  import { forwardRef, useCallback, useRef, useState } from "react";
10
10
  import { assignInlineVars } from "@vanilla-extract/dynamic";
@@ -1,9 +1,9 @@
1
1
  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
+ const require_Button = require("../Button/Button.cjs");
4
5
  const require_Flex = require("../Flex/Flex.cjs");
5
6
  const require_Text = require("../Text/Text.cjs");
6
- const require_Button = require("../Button/Button.cjs");
7
7
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
8
8
  let react = require("react");
9
9
  react = require_runtime.__toESM(react, 1);
@@ -1,8 +1,8 @@
1
1
  import { styled } from "../../stitches.config.js";
2
2
  import { Box } from "../Box/Box.js";
3
+ import { Button } from "../Button/Button.js";
3
4
  import { Flex } from "../Flex/Flex.js";
4
5
  import { Text } from "../Text/Text.js";
5
- import { Button } from "../Button/Button.js";
6
6
  import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons";
7
7
  import React, { useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
- const require_Elevation = require("../Elevation/Elevation.cjs");
4
3
  const require_Card = require("../Card/Card.cjs");
4
+ const require_Elevation = require("../Elevation/Elevation.cjs");
5
5
  const require_IconButton = require("../IconButton/IconButton.cjs");
6
6
  const require_Overlay = require("../Overlay.cjs");
7
7
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
@@ -1,6 +1,6 @@
1
1
  import { styled } from "../../stitches.config.js";
2
- import { elevationVariants } from "../Elevation/Elevation.js";
3
2
  import { Card } from "../Card/Card.js";
3
+ import { elevationVariants } from "../Elevation/Elevation.js";
4
4
  import { IconButton } from "../IconButton/IconButton.js";
5
5
  import { overlayStyles } from "../Overlay.js";
6
6
  import { Cross1Icon } from "@radix-ui/react-icons";
@@ -1,9 +1,9 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_Box = require("../Box/Box.cjs");
3
- const require_Text = require("../Text/Text.cjs");
4
3
  const require_Label = require("../Label/Label.cjs");
5
- const require_FieldContext = require("./FieldContext.cjs");
4
+ const require_Text = require("../Text/Text.cjs");
6
5
  const require_VisuallyHidden = require("../VisuallyHidden/VisuallyHidden.cjs");
6
+ const require_FieldContext = require("./FieldContext.cjs");
7
7
  let react = require("react");
8
8
  react = require_runtime.__toESM(react, 1);
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -11,56 +11,106 @@ let react_jsx_runtime = require("react/jsx-runtime");
11
11
  var MESSAGE_CSS = {
12
12
  display: "block",
13
13
  m: 0,
14
- mt: "$1"
14
+ mt: "$1",
15
+ lineHeight: 1.4
16
+ };
17
+ var COMPACT_LABEL_CSS = { lineHeight: 1.4 };
18
+ var HINT_ABOVE_CONTROL_CSS = {
19
+ ...MESSAGE_CSS,
20
+ mb: "$2"
21
+ };
22
+ var START_ROW_CSS = {
23
+ display: "flex",
24
+ flexWrap: "wrap",
25
+ alignItems: "baseline",
26
+ columnGap: "$5",
27
+ rowGap: "$2"
28
+ };
29
+ var START_LABEL_CSS = {
30
+ flex: "1 1 0",
31
+ minWidth: "10rem"
32
+ };
33
+ var START_CONTROL_CSS = {
34
+ flex: "2 1 0",
35
+ minWidth: "16rem"
15
36
  };
16
37
  /**
17
- * Gives a label, a description and an error to the one form control inside it.
18
- * Its label connects to one control, so do not put two controls in one Field.
38
+ * Gives a label, a hint, a description and an error to the one form control inside it.
39
+ * For more than one control, use `group`.
19
40
  */
20
- var Field = ({ label, description, error, announceError, labelPosition = "top", children, css, ...props }) => {
21
- const { context, labelFor, labelVariant, hasLabel, hasDescription, hasError, onFocus, onBlur } = require_FieldContext.useFieldRoot({
41
+ var Field = ({ label, hint, description, error, announceError, labelPosition = "top", children, css, ...props }) => {
42
+ const { context, ids, groupProps, messageSize, labelFor, labelVariant, hasLabel, hasHint, hasDescription, hasError, onFocus, onBlur } = require_FieldContext.useFieldRoot({
22
43
  label,
44
+ hint,
23
45
  description,
24
46
  error,
25
47
  ...props
26
48
  });
27
- const announcedError = require_FieldContext.useAnnouncedError(Boolean(announceError), hasError ? context.errorId : void 0, context.labelId);
49
+ const announcedError = require_FieldContext.useAnnouncedError(Boolean(announceError), hasError ? ids.errorId : void 0, ids.labelId);
28
50
  const labelNode = react.default.useMemo(() => {
29
- if (!hasLabel || !context.labelId) return null;
51
+ if (!hasLabel || !ids.labelId) return null;
30
52
  if (typeof label === "function") return label({
31
53
  variant: labelVariant,
32
54
  htmlFor: labelFor,
33
- id: context.labelId
55
+ id: ids.labelId
34
56
  });
35
57
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Label.Label, {
36
58
  variant: labelVariant,
37
59
  htmlFor: labelFor,
38
- id: context.labelId,
60
+ id: ids.labelId,
61
+ css: hasHint || labelPosition === "start" ? COMPACT_LABEL_CSS : void 0,
39
62
  children: label
40
63
  });
41
64
  }, [
42
65
  hasLabel,
66
+ hasHint,
43
67
  label,
68
+ labelPosition,
44
69
  labelVariant,
45
70
  labelFor,
46
- context.labelId
71
+ ids.labelId
47
72
  ]);
48
- const errorNode = hasError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
73
+ const hintNode = hasHint && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
74
+ as: "p",
75
+ id: ids.hintId,
76
+ size: messageSize,
77
+ variant: "subtle",
78
+ css: labelPosition === "top" ? HINT_ABOVE_CONTROL_CSS : MESSAGE_CSS,
79
+ children: hint
80
+ });
81
+ const messages = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [hasDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
49
82
  as: "p",
50
- id: context.errorId,
51
- size: "0",
83
+ id: ids.descriptionId,
84
+ size: messageSize,
85
+ variant: "subtle",
86
+ css: MESSAGE_CSS,
87
+ children: description
88
+ }), hasError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
89
+ as: "p",
90
+ id: ids.errorId,
91
+ size: messageSize,
52
92
  variant: "invalid",
53
93
  css: MESSAGE_CSS,
54
94
  children: error
55
- });
95
+ })] });
56
96
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldContext.FieldContext.Provider, {
57
97
  value: context,
58
98
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
59
- css,
99
+ css: labelPosition === "start" ? {
100
+ ...START_ROW_CSS,
101
+ ...css
102
+ } : css,
60
103
  onFocus,
61
104
  onBlur,
62
- children: [
63
- labelPosition === "end" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
105
+ ...groupProps,
106
+ children: [labelPosition === "start" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
107
+ css: START_LABEL_CSS,
108
+ children: [labelNode, hintNode]
109
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
110
+ css: START_CONTROL_CSS,
111
+ children: [children, messages]
112
+ })] }) : labelPosition === "end" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
113
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
64
114
  css: {
65
115
  display: "flex",
66
116
  alignItems: "center",
@@ -68,21 +118,18 @@ var Field = ({ label, description, error, announceError, labelPosition = "top",
68
118
  "& > [role=\"switch\"]": { m: 0 }
69
119
  },
70
120
  children: [children, labelNode]
71
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [labelNode, children] }),
72
- hasDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
73
- as: "p",
74
- id: context.descriptionId,
75
- size: "0",
76
- variant: "subtle",
77
- css: MESSAGE_CSS,
78
- children: description
79
121
  }),
80
- errorNode,
81
- announceError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_VisuallyHidden.VisuallyHidden, {
82
- "aria-live": "polite",
83
- children: announcedError
84
- })
85
- ]
122
+ hintNode,
123
+ messages
124
+ ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
125
+ labelNode,
126
+ hintNode,
127
+ children,
128
+ messages
129
+ ] }), announceError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_VisuallyHidden.VisuallyHidden, {
130
+ "aria-live": "polite",
131
+ children: announcedError
132
+ })]
86
133
  })
87
134
  });
88
135
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Field.cjs","names":["useFieldRoot","useAnnouncedError","React","Label","Text","FieldContext","Box","_Fragment","VisuallyHidden"],"sources":["../../../components/Field/Field.tsx"],"sourcesContent":["import React from 'react';\n\nimport { CSS } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { Label } from '../Label';\nimport { Text } from '../Text';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { FieldBaseProps, FieldContext, useAnnouncedError, useFieldRoot } from './FieldContext';\n\nexport type FieldProps = FieldBaseProps & { css?: CSS };\n\nconst MESSAGE_CSS = { display: 'block', m: 0, mt: '$1' };\n\n/**\n * Gives a label, a description and an error to the one form control inside it.\n * Its label connects to one control, so do not put two controls in one Field.\n */\nexport const Field = ({\n label,\n description,\n error,\n announceError,\n labelPosition = 'top',\n children,\n css,\n ...props\n}: FieldProps) => {\n const { context, labelFor, labelVariant, hasLabel, hasDescription, hasError, onFocus, onBlur } =\n useFieldRoot({ label, description, error, ...props });\n const announcedError = useAnnouncedError(\n Boolean(announceError),\n hasError ? context.errorId : undefined,\n context.labelId,\n );\n\n const labelNode = React.useMemo(() => {\n if (!hasLabel || !context.labelId) {\n return null;\n }\n if (typeof label === 'function') {\n return label({ variant: labelVariant, htmlFor: labelFor, id: context.labelId });\n }\n return (\n <Label variant={labelVariant} htmlFor={labelFor} id={context.labelId}>\n {label}\n </Label>\n );\n }, [hasLabel, label, labelVariant, labelFor, context.labelId]);\n\n const errorNode = hasError && (\n <Text as=\"p\" id={context.errorId} size=\"0\" variant=\"invalid\" css={MESSAGE_CSS}>\n {error}\n </Text>\n );\n\n return (\n <FieldContext.Provider value={context}>\n <Box css={css} onFocus={onFocus} onBlur={onBlur}>\n {labelPosition === 'end' ? (\n <Box\n css={{\n display: 'flex',\n alignItems: 'center',\n gap: '$2',\n '& > [role=\"switch\"]': { m: 0 },\n }}\n >\n {children}\n {labelNode}\n </Box>\n ) : (\n <>\n {labelNode}\n {children}\n </>\n )}\n {hasDescription && (\n <Text as=\"p\" id={context.descriptionId} size=\"0\" variant=\"subtle\" css={MESSAGE_CSS}>\n {description}\n </Text>\n )}\n {errorNode}\n {announceError && <VisuallyHidden aria-live=\"polite\">{announcedError}</VisuallyHidden>}\n </Box>\n </FieldContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;AAWA,IAAM,cAAc;CAAE,SAAS;CAAS,GAAG;CAAG,IAAI;AAAK;;;;;AAMvD,IAAa,SAAS,EACpB,OACA,aACA,OACA,eACA,gBAAgB,OAChB,UACA,KACA,GAAG,YACa;CAChB,MAAM,EAAE,SAAS,UAAU,cAAc,UAAU,gBAAgB,UAAU,SAAS,WACpFA,qBAAAA,aAAa;EAAE;EAAO;EAAa;EAAO,GAAG;CAAM,CAAC;CACtD,MAAM,iBAAiBC,qBAAAA,kBACrB,QAAQ,aAAa,GACrB,WAAW,QAAQ,UAAU,KAAA,GAC7B,QAAQ,OACV;CAEA,MAAM,YAAYC,MAAAA,QAAM,cAAc;EACpC,IAAI,CAAC,YAAY,CAAC,QAAQ,SACxB,OAAO;EAET,IAAI,OAAO,UAAU,YACnB,O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idden"],"sources":["../../../components/Field/Field.tsx"],"sourcesContent":["import React from 'react';\n\nimport { CSS } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { Label } from '../Label';\nimport { Text } from '../Text';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { FieldBaseProps, FieldContext, useAnnouncedError, useFieldRoot } from './FieldContext';\n\nexport type FieldProps = FieldBaseProps & { css?: CSS };\n\nconst MESSAGE_CSS = { display: 'block', m: 0, mt: '$1', lineHeight: 1.4 };\n// The tall line of a label makes room for a control right under it. Before a hint or beside a control, it is a gap.\nconst COMPACT_LABEL_CSS = { lineHeight: 1.4 };\nconst HINT_ABOVE_CONTROL_CSS = { ...MESSAGE_CSS, mb: '$2' };\n\nconst START_ROW_CSS = {\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'baseline',\n columnGap: '$5',\n rowGap: '$2',\n};\nconst START_LABEL_CSS = { flex: '1 1 0', minWidth: '10rem' };\nconst START_CONTROL_CSS = { flex: '2 1 0', minWidth: '16rem' };\n\n/**\n * Gives a label, a hint, a description and an error to the one form control inside it.\n * For more than one control, use `group`.\n */\nexport const Field = ({\n label,\n hint,\n description,\n error,\n announceError,\n labelPosition = 'top',\n children,\n css,\n ...props\n}: FieldProps) => {\n const {\n context,\n ids,\n groupProps,\n messageSize,\n labelFor,\n labelVariant,\n hasLabel,\n hasHint,\n hasDescription,\n hasError,\n onFocus,\n onBlur,\n } = useFieldRoot({ label, hint, description, error, ...props });\n const announcedError = useAnnouncedError(\n Boolean(announceError),\n hasError ? ids.errorId : undefined,\n ids.labelId,\n );\n\n const labelNode = React.useMemo(() => {\n if (!hasLabel || !ids.labelId) {\n return null;\n }\n if (typeof label === 'function') {\n return label({ variant: labelVariant, htmlFor: labelFor, id: ids.labelId });\n }\n return (\n <Label\n variant={labelVariant}\n htmlFor={labelFor}\n id={ids.labelId}\n css={hasHint || labelPosition === 'start' ? COMPACT_LABEL_CSS : undefined}\n >\n {label}\n </Label>\n );\n }, [hasLabel, hasHint, label, labelPosition, labelVariant, labelFor, ids.labelId]);\n\n const hintNode = hasHint && (\n <Text\n as=\"p\"\n id={ids.hintId}\n size={messageSize}\n variant=\"subtle\"\n css={labelPosition === 'top' ? HINT_ABOVE_CONTROL_CSS : MESSAGE_CSS}\n >\n {hint}\n </Text>\n );\n\n const messages = (\n <>\n {hasDescription && (\n <Text as=\"p\" id={ids.descriptionId} size={messageSize} variant=\"subtle\" css={MESSAGE_CSS}>\n {description}\n </Text>\n )}\n {hasError && (\n <Text as=\"p\" id={ids.errorId} size={messageSize} variant=\"invalid\" css={MESSAGE_CSS}>\n {error}\n </Text>\n )}\n </>\n );\n\n return (\n <FieldContext.Provider value={context}>\n <Box\n css={labelPosition === 'start' ? { ...START_ROW_CSS, ...css } : css}\n onFocus={onFocus}\n onBlur={onBlur}\n {...groupProps}\n >\n {labelPosition === 'start' ? (\n <>\n <Box css={START_LABEL_CSS}>\n {labelNode}\n {hintNode}\n </Box>\n <Box css={START_CONTROL_CSS}>\n {children}\n {messages}\n </Box>\n </>\n ) : labelPosition === 'end' ? (\n <>\n <Box\n css={{\n display: 'flex',\n alignItems: 'center',\n gap: '$2',\n '& > [role=\"switch\"]': { m: 0 },\n }}\n >\n {children}\n {labelNode}\n </Box>\n {hintNode}\n {messages}\n </>\n ) : (\n <>\n {labelNode}\n {hintNode}\n {children}\n {messages}\n </>\n )}\n {announceError && <VisuallyHidden aria-live=\"polite\">{announcedError}</VisuallyHidden>}\n </Box>\n </FieldContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;AAWA,IAAM,cAAc;CAAE,SAAS;CAAS,GAAG;CAAG,IAAI;CAAM,YAAY;AAAI;AAExE,IAAM,oBAAoB,EAAE,YAAY,IAAI;AAC5C,IAAM,yBAAyB;CAAE,GAAG;CAAa,IAAI;AAAK;AAE1D,IAAM,gBAAgB;CACpB,SAAS;CACT,UAAU;CACV,YAAY;CACZ,WAAW;CACX,QAAQ;AACV;AACA,IAAM,kBAAkB;CAAE,MAAM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