@traefik-labs/faency 13.6.0 → 13.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/components/AriaTable/AriaTable.js +4 -4
  2. package/dist/components/AriaTable/AriaTable.js.map +1 -1
  3. package/dist/components/AriaTable/AriaTable.vanilla.js +3 -3
  4. package/dist/components/AriaTable/AriaTable.vanilla.js.map +1 -1
  5. package/dist/components/Elevation/Elevation.vanilla.css.cjs.map +1 -1
  6. package/dist/components/Elevation/Elevation.vanilla.css.js.map +1 -1
  7. package/dist/components/Field/Field.js +5 -5
  8. package/dist/components/Field/Field.js.map +1 -1
  9. package/dist/components/Field/Field.vanilla.js +5 -5
  10. package/dist/components/Field/Field.vanilla.js.map +1 -1
  11. package/dist/components/List/List.vanilla.cjs +128 -0
  12. package/dist/components/List/List.vanilla.cjs.map +1 -0
  13. package/dist/components/List/List.vanilla.css.cjs +30 -0
  14. package/dist/components/List/List.vanilla.css.cjs.map +1 -0
  15. package/dist/components/List/List.vanilla.css.js +25 -0
  16. package/dist/components/List/List.vanilla.css.js.map +1 -0
  17. package/dist/components/List/List.vanilla.js +124 -0
  18. package/dist/components/List/List.vanilla.js.map +1 -0
  19. package/dist/components/SplitLayout/SplitLayout.vanilla.js +2 -2
  20. package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -1
  21. package/dist/components/Table/Table.js +2 -2
  22. package/dist/components/Table/Table.js.map +1 -1
  23. package/dist/components/Table/Table.vanilla.js +2 -2
  24. package/dist/components/Table/Table.vanilla.js.map +1 -1
  25. package/dist/components/TextField/TextField.vanilla.js +2 -2
  26. package/dist/components/TextField/TextField.vanilla.js.map +1 -1
  27. package/dist/faency.css +2051 -1877
  28. package/dist/index.cjs +4 -0
  29. package/dist/index.d.ts +112 -34
  30. package/dist/index.js +2 -1
  31. package/dist/styles/themes.css.cjs.map +1 -1
  32. package/dist/styles/themes.css.js.map +1 -1
  33. package/dist/styles/tokens.css.cjs +93 -90
  34. package/dist/styles/tokens.css.cjs.map +1 -1
  35. package/dist/styles/tokens.css.js +93 -90
  36. package/dist/styles/tokens.css.js.map +1 -1
  37. package/package.json +1 -1
@@ -7,7 +7,7 @@ import { Caption as Caption$1, StyledTr as StyledTr$1, Table as Table$1, Tbody a
7
7
  import { ExpandButton } from "../Table/ExpandButton.js";
8
8
  import { ChevronRightIcon } from "@radix-ui/react-icons";
9
9
  import { Children, cloneElement, forwardRef, isValidElement, useId, useMemo, useState } from "react";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { Slot } from "@radix-ui/react-slot";
12
12
  // components/AriaTable/AriaTable.tsx
13
13
  var Caption = styled("div", Caption$1, { display: "table-caption" });
@@ -111,7 +111,7 @@ var Tr = forwardRef(({ asChild, children, collapsedContent, expandLabel = "Expan
111
111
  ]);
112
112
  const renderedChildren = useMemo(() => {
113
113
  if (asChild) return cloneElement(children, { ...children?.props }, [TdEl, ...children?.props?.children || []]);
114
- return /* @__PURE__ */ jsxs(Fragment, { children: [TdEl, withRowLink(children, {
114
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [TdEl, withRowLink(children, {
115
115
  href,
116
116
  linkAs,
117
117
  linkCell,
@@ -128,7 +128,7 @@ var Tr = forwardRef(({ asChild, children, collapsedContent, expandLabel = "Expan
128
128
  linkProps,
129
129
  linkOverlay
130
130
  ]);
131
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Component, {
131
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Component, {
132
132
  ref,
133
133
  role: "row",
134
134
  css: !!collapsedContent && !isCollapsed ? {
@@ -164,7 +164,7 @@ var Td = forwardRef(({ fullColSpan, css, ...props }, ref) => {
164
164
  width: "100%",
165
165
  height: "100%"
166
166
  } : {}, [fullColSpan]);
167
- if (fullColSpan) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FillerTd, {
167
+ if (fullColSpan) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FillerTd, {
168
168
  css,
169
169
  ...props
170
170
  }), /* @__PURE__ */ jsx(StyledTd, {
@@ -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 {\n handleRowClick,\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) => handleRowClick(event, onClick)}\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":";;;;;;;;;;;;AAsCA,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;C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Td","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 handleRowClick,\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) => handleRowClick(event, onClick)}\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":";;;;;;;;;;;;AAsCA,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,OACE,oBAAC,UAAD;EACM;EACJ,KAAK,SAAS,EAAE,sBAAsB,EAAE,cAAc,4BAA4B,EAAE,IAAI,CAAC;EAEzF,UAAA,oBAAC,IAAD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AAC;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,YAAA,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"}
@@ -10,7 +10,7 @@ import { captionRecipe, tableRecipe, tbody, tdRecipe, tfoot, thRecipe, thead, tr
10
10
  import { FULL_COL_SPAN_ATTRIBUTE } from "./AriaTable.constants.js";
11
11
  import { ariaCell, ariaTable, ariaTbody, ariaTfoot, ariaThead, ariaTr, fillerCell, fullColSpanCell } from "./AriaTable.vanilla.css.js";
12
12
  import { Children, forwardRef, isValidElement, useCallback, useId, useRef, useState } from "react";
13
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
14
  // components/AriaTable/AriaTable.vanilla.tsx
15
15
  var AriaTableVanilla = forwardRef(({ elevation, hasCollapsibleChildren = false, className, css, style, ...props }, ref) => /* @__PURE__ */ jsx("div", {
16
16
  ref,
@@ -87,7 +87,7 @@ var FullColSpanCell = forwardRef(({ className, ...props }, forwardedRef) => {
87
87
  if (typeof forwardedRef === "function") forwardedRef(node);
88
88
  else if (forwardedRef) forwardedRef.current = node;
89
89
  }, [forwardedRef]);
90
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
90
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
91
91
  "aria-hidden": true,
92
92
  className: cx(ariaCell, fillerCell),
93
93
  style: { height }
@@ -123,7 +123,7 @@ var AriaTrVanilla = forwardRef(({ collapsedContent: collapsedContent$1, expandLa
123
123
  const inlineStyle = useInlineStyle(css, style);
124
124
  const collapsible = !!collapsedContent$1;
125
125
  assertFullColSpanAlone(children, Number(emptyFirstColumn) + Number(collapsible));
126
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
126
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
127
127
  ref,
128
128
  role: "row",
129
129
  className: cx(trRecipe({
@@ -1 +1 @@
1
- {"version":3,"file":"AriaTable.vanilla.js","names":["_Fragment","collapsedContent"],"sources":["../../../components/AriaTable/AriaTable.vanilla.tsx"],"sourcesContent":["import { RecipeVariants } from '@vanilla-extract/recipes';\nimport React, {\n Children,\n forwardRef,\n isValidElement,\n ReactNode,\n useCallback,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { CSSProps } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useInlineStyle } from '../../styles/useInlineStyle';\nimport { useIsomorphicLayoutEffect } from '../../utils/useIsomorphicLayoutEffect';\nimport {\n handleRowClick,\n mapRowLink,\n openRowLink,\n RowLinkShortcutProps,\n} from '../RowLink/RowLink.utils';\nimport { RowLinkVanilla } from '../RowLink/RowLink.vanilla';\nimport { rowLinkRow, rowLinkTable } from '../RowLink/RowLink.vanilla.css';\nimport { ExpandToggleVanilla, stopEvent } from '../Table/ExpandToggle.vanilla';\nimport { ARIA_SORT, SortButtonVanilla } from '../Table/SortButton.vanilla';\nimport {\n captionRecipe,\n emptyHeaderCell,\n tableRecipe,\n tbody,\n tdRecipe,\n tfoot,\n thead,\n thRecipe,\n toggleCell,\n trRecipe,\n} from '../Table/Table.vanilla.css';\nimport { TableSortProps } from '../Table/useTableSort';\nimport { FULL_COL_SPAN_ATTRIBUTE } from './AriaTable.constants';\nimport {\n ariaCell,\n ariaTable,\n ariaTbody,\n ariaTfoot,\n ariaThead,\n ariaTr,\n collapsedCell,\n collapsedContent as collapsedContentClass,\n collapsedRow,\n collapsibleTable,\n fillerCell,\n fullColSpanCell,\n} from './AriaTable.vanilla.css';\n\ntype TableRecipeVariants = NonNullable<RecipeVariants<typeof tableRecipe>>;\ntype CaptionRecipeVariants = NonNullable<RecipeVariants<typeof captionRecipe>>;\ntype TrRecipeVariants = NonNullable<RecipeVariants<typeof trRecipe>>;\ntype ThRecipeVariants = NonNullable<RecipeVariants<typeof thRecipe>>;\ntype TdRecipeVariants = NonNullable<RecipeVariants<typeof tdRecipe>>;\n\nexport type AriaTableVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps &\n TableRecipeVariants & {\n /** Collapses the borders, for a table with collapsible rows. */\n hasCollapsibleChildren?: boolean;\n };\n\nexport const AriaTableVanilla = forwardRef<HTMLDivElement, AriaTableVanillaProps>(\n ({ elevation, hasCollapsibleChildren = false, className, css, style, ...props }, ref) => (\n <div\n ref={ref}\n role=\"table\"\n className={cx(\n tableRecipe({ elevation }),\n ariaTable,\n hasCollapsibleChildren && collapsibleTable,\n rowLinkTable,\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nAriaTableVanilla.displayName = 'AriaTableVanilla';\n\nexport type AriaCaptionVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps &\n CaptionRecipeVariants;\n\nexport const AriaCaptionVanilla = forwardRef<HTMLDivElement, AriaCaptionVanillaProps>(\n (\n { size, weight, variant, gradient, transform, noWrap, className, css, style, ...props },\n ref,\n ) => (\n <div\n ref={ref}\n className={cx(\n captionRecipe({ size, weight, variant, gradient, transform, noWrap }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nAriaCaptionVanilla.displayName = 'AriaCaptionVanilla';\n\nexport type AriaTableSectionVanillaProps = React.HTMLAttributes<HTMLDivElement> & CSSProps;\n\nconst section = (sectionClass: string, displayName: string) => {\n const Section = forwardRef<HTMLDivElement, AriaTableSectionVanillaProps>(\n ({ className, css, style, ...props }, ref) => (\n <div\n ref={ref}\n role=\"rowgroup\"\n className={cx(sectionClass, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n );\n Section.displayName = displayName;\n return Section;\n};\n\nexport const AriaTheadVanilla = section(cx(thead, ariaThead), 'AriaTheadVanilla');\nexport const AriaTbodyVanilla = section(cx(tbody, ariaTbody), 'AriaTbodyVanilla');\nexport const AriaTfootVanilla = section(cx(tfoot, ariaTfoot), 'AriaTfootVanilla');\n\nexport type AriaThVanillaProps = React.HTMLAttributes<HTMLSpanElement> &\n CSSProps &\n ThRecipeVariants &\n TableSortProps;\n\nexport const AriaThVanilla = forwardRef<HTMLSpanElement, AriaThVanillaProps>(\n (\n {\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n align,\n sort,\n onSort,\n className,\n css,\n style,\n children,\n ...props\n },\n ref,\n ) => (\n <span\n ref={ref}\n role=\"columnheader\"\n aria-sort={sort && ARIA_SORT[sort]}\n className={cx(\n thRecipe({ size, weight, variant, gradient, transform, noWrap, align }),\n ariaCell,\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n >\n {onSort ? (\n <SortButtonVanilla sort={sort} onSort={onSort}>\n {children}\n </SortButtonVanilla>\n ) : (\n children\n )}\n </span>\n ),\n);\n\nAriaThVanilla.displayName = 'AriaThVanilla';\n\nexport type AriaTdVanillaProps = React.HTMLAttributes<HTMLSpanElement> &\n CSSProps &\n TdRecipeVariants & {\n /** Spans the whole row. It must be the only cell of its row. */\n fullColSpan?: boolean;\n };\n\n// The cell is taken out of the row to span it, so an empty filler as tall as the cell holds the row open.\nconst FullColSpanCell = forwardRef<HTMLSpanElement, React.HTMLAttributes<HTMLSpanElement>>(\n ({ className, ...props }, forwardedRef) => {\n const cellRef = useRef<HTMLSpanElement | null>(null);\n const [height, setHeight] = useState(0);\n\n useIsomorphicLayoutEffect(() => {\n const cell = cellRef.current;\n if (!cell || typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n const update = () => setHeight(cell.offsetHeight);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(cell);\n return () => observer.disconnect();\n }, []);\n\n const setRefs = useCallback(\n (node: HTMLSpanElement | null) => {\n cellRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef],\n );\n\n return (\n <>\n <span aria-hidden className={cx(ariaCell, fillerCell)} style={{ height }} />\n <span\n ref={setRefs}\n role=\"cell\"\n {...{ [FULL_COL_SPAN_ATTRIBUTE]: '' }}\n className={cx(className, fullColSpanCell)}\n {...props}\n />\n </>\n );\n },\n);\n\nFullColSpanCell.displayName = 'FullColSpanCell';\n\nexport const AriaTdVanilla = forwardRef<HTMLSpanElement, AriaTdVanillaProps>(\n ({ fullColSpan = false, subtle, align, className, css, style, ...props }, ref) => {\n const Cell = fullColSpan ? FullColSpanCell : 'span';\n\n return (\n <Cell\n ref={ref}\n role=\"cell\"\n className={cx(tdRecipe({ subtle, align }), ariaCell, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n );\n },\n);\n\nAriaTdVanilla.displayName = 'AriaTdVanilla';\n\nconst assertFullColSpanAlone = (children: ReactNode, addedCells: number) => {\n // eslint-disable-next-line @eslint-react/no-children-to-array\n const cells = Children.toArray(children);\n const hasFullColSpan = cells.some(\n (child) => isValidElement<AriaTdVanillaProps>(child) && !!child.props.fullColSpan,\n );\n if (hasFullColSpan && cells.length + addedCells > 1) {\n throw new Error(\n 'AriaTrVanilla: a fullColSpan AriaTdVanilla must be the only cell of its row, without emptyFirstColumn or collapsedContent.',\n );\n }\n};\n\nexport type AriaTrVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps &\n TrRecipeVariants &\n RowLinkShortcutProps & {\n /** Content shown in a full-width row below, toggled by a button in a new first cell. */\n collapsedContent?: ReactNode;\n /** Accessible name of the expand button. */\n expandLabel?: string;\n /** Adds an empty first cell, to line up with rows that have an expand button. */\n emptyFirstColumn?: boolean;\n /** Styles the empty first cell as a header, for a row in `AriaTheadVanilla`. */\n tableHead?: boolean;\n };\n\nexport const AriaTrVanilla = forwardRef<HTMLDivElement, AriaTrVanillaProps>(\n (\n {\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n href,\n linkAs,\n linkCell,\n linkProps,\n linkOverlay,\n interactive,\n active,\n className,\n css,\n style,\n children,\n onClick,\n onAuxClick,\n ...props\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const contentId = useId();\n const inlineStyle = useInlineStyle(css, style);\n const collapsible = !!collapsedContent;\n\n assertFullColSpanAlone(children, Number(emptyFirstColumn) + Number(collapsible));\n\n return (\n <>\n <div\n ref={ref}\n role=\"row\"\n className={cx(\n trRecipe({ interactive: interactive ?? (href !== undefined || undefined), active }),\n ariaTr,\n rowLinkRow,\n className,\n )}\n data-collapsed={collapsible && !isOpen ? '' : undefined}\n style={inlineStyle}\n onClick={(event) => handleRowClick(event, onClick)}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\n {...props}\n >\n {emptyFirstColumn &&\n (tableHead ? (\n <span role=\"cell\" className={cx(thRecipe(), ariaCell, emptyHeaderCell)} />\n ) : (\n <AriaTdVanilla />\n ))}\n {collapsible && (\n <AriaTdVanilla className={toggleCell} onClick={stopEvent}>\n <ExpandToggleVanilla\n label={expandLabel}\n isOpen={isOpen}\n controls={contentId}\n onToggle={() => setIsOpen((open) => !open)}\n />\n </AriaTdVanilla>\n )}\n {mapRowLink(\n children,\n { href, linkAs, linkCell, linkProps, linkOverlay },\n AriaTdVanilla,\n RowLinkVanilla,\n { row: 'AriaTrVanilla', cell: 'AriaTdVanilla' },\n )}\n </div>\n {collapsible && (\n <AriaTrVanilla className={collapsedRow} data-open={isOpen ? '' : undefined}>\n <AriaTdVanilla\n id={contentId}\n fullColSpan\n className={collapsedCell}\n data-closed={isOpen ? undefined : ''}\n >\n <div className={collapsedContentClass}>{collapsedContent}</div>\n </AriaTdVanilla>\n </AriaTrVanilla>\n )}\n </>\n );\n },\n);\n\nAriaTrVanilla.displayName = 'AriaTrVanilla';\n"],"mappings":";;;;;;;;;;;;;;AAoEA,IAAa,mBAAmB,YAC7B,EAAE,WAAW,yBAAyB,OAAO,WAAW,KAAK,OAAO,GAAG,SAAS,QAC/E,oBAAC,OAAD;CACO;CACL,MAAK;CACL,WAAW,GACT,YAAY,EAAE,UAAU,CAAC,GACzB,WACA,0BAAA,WACA,cACA,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,iBAAiB,cAAc;AAM/B,IAAa,qBAAqB,YAE9B,EAAE,MAAM,QAAQ,SAAS,UAAU,WAAW,QAAQ,WAAW,KAAK,OAAO,GAAG,SAChF,QAEA,oBAAC,OAAD;CACO;CACL,WAAW,GACT,cAAc;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC,GACpE,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,mBAAmB,cAAc;AAIjC,IAAM,WAAW,cAAsB,gBAAwB;CAC7D,MAAM,UAAU,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gBAAgB,IAAI,OAAO,WAAW,CAAC;CAE/E,OACE,qBAAAD,UAAA,EAAA,UAAA,CACE,qBAAC,OAAD;EACO;EACL,MAAK;EACL,WAAW,GACT,SAAS;GAAE,aAAa,gBAAgB,SAAS,KAAA,KAAa,KAAA;GAAY;EAAO,CAAC,GAClF,QACA,YACA,SACF;EACA,kBAAgB,eAAe,CAAC,SAAS,KAAK,KAAA;EAC9C,OAAO;EACP,UAAU,UAAU,eAAe,OAAO,OAAO;EACjD,aAAa,UAAU;GACrB,aAAa,KAAK;GAClB,YAAY,KAAK;EACnB;EACA,GAAI;EAhBN,UAAA;GAkBG,qBACE,YACC,oBAAC,QAAD;IAAM,MAAK;IAAO,WAAW,GAAG,SAAS,GAAA,WAAA,YAA4B;GAAI,CAAA,IAEzE,oBAAC,eAAD,CAAgB,CAAA;GAEnB,eACC,oBAAC,eAAD;IAAe,WAAA;IAAuB,SAAS;IAC7C,UAAA,oBAAC,qBAAD;KACE,OAAO;KACC;KACR,UAAU;KACV,gBAAgB,WAAW,SAAS,CAAC,IAAI;IAC1C,CAAA;GACY,CAAA;GAEhB,WACC,UACA;IAAE;IAAM;IAAQ;IAAU;IAAW;GAAY,GACjD,eACA,gBACA;IAAE,KAAK;IAAiB,MAAM;GAAgB,CAChD;EACG;CACJ,CAAA,GAAA,eACC,oBAAC,eAAD;EAAe,WAAA;EAAyB,aAAW,SAAS,KAAK,KAAA;EAC/D,UAAA,oBAAC,eAAD;GACE,IAAI;GACJ,aAAA;GACA,WAAA;GACA,eAAa,SAAS,KAAA,IAAY;GAElC,UAAA,oBAAC,OAAD;IAAK,WAAA;IAAmC,UAAAC;GAAsB,CAAA;EACjD,CAAA;CACF,CAAA,CAEjB,EAAA,CAAA;AAEN,CACF;AAEA,cAAc,cAAc"}
1
+ {"version":3,"file":"AriaTable.vanilla.js","names":["_Fragment","collapsedContent"],"sources":["../../../components/AriaTable/AriaTable.vanilla.tsx"],"sourcesContent":["import { RecipeVariants } from '@vanilla-extract/recipes';\nimport React, {\n Children,\n forwardRef,\n isValidElement,\n ReactNode,\n useCallback,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { CSSProps } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useInlineStyle } from '../../styles/useInlineStyle';\nimport { useIsomorphicLayoutEffect } from '../../utils/useIsomorphicLayoutEffect';\nimport {\n handleRowClick,\n mapRowLink,\n openRowLink,\n RowLinkShortcutProps,\n} from '../RowLink/RowLink.utils';\nimport { RowLinkVanilla } from '../RowLink/RowLink.vanilla';\nimport { rowLinkRow, rowLinkTable } from '../RowLink/RowLink.vanilla.css';\nimport { ExpandToggleVanilla, stopEvent } from '../Table/ExpandToggle.vanilla';\nimport { ARIA_SORT, SortButtonVanilla } from '../Table/SortButton.vanilla';\nimport {\n captionRecipe,\n emptyHeaderCell,\n tableRecipe,\n tbody,\n tdRecipe,\n tfoot,\n thead,\n thRecipe,\n toggleCell,\n trRecipe,\n} from '../Table/Table.vanilla.css';\nimport { TableSortProps } from '../Table/useTableSort';\nimport { FULL_COL_SPAN_ATTRIBUTE } from './AriaTable.constants';\nimport {\n ariaCell,\n ariaTable,\n ariaTbody,\n ariaTfoot,\n ariaThead,\n ariaTr,\n collapsedCell,\n collapsedContent as collapsedContentClass,\n collapsedRow,\n collapsibleTable,\n fillerCell,\n fullColSpanCell,\n} from './AriaTable.vanilla.css';\n\ntype TableRecipeVariants = NonNullable<RecipeVariants<typeof tableRecipe>>;\ntype CaptionRecipeVariants = NonNullable<RecipeVariants<typeof captionRecipe>>;\ntype TrRecipeVariants = NonNullable<RecipeVariants<typeof trRecipe>>;\ntype ThRecipeVariants = NonNullable<RecipeVariants<typeof thRecipe>>;\ntype TdRecipeVariants = NonNullable<RecipeVariants<typeof tdRecipe>>;\n\nexport type AriaTableVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps &\n TableRecipeVariants & {\n /** Collapses the borders, for a table with collapsible rows. */\n hasCollapsibleChildren?: boolean;\n };\n\nexport const AriaTableVanilla = forwardRef<HTMLDivElement, AriaTableVanillaProps>(\n ({ elevation, hasCollapsibleChildren = false, className, css, style, ...props }, ref) => (\n <div\n ref={ref}\n role=\"table\"\n className={cx(\n tableRecipe({ elevation }),\n ariaTable,\n hasCollapsibleChildren && collapsibleTable,\n rowLinkTable,\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nAriaTableVanilla.displayName = 'AriaTableVanilla';\n\nexport type AriaCaptionVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps &\n CaptionRecipeVariants;\n\nexport const AriaCaptionVanilla = forwardRef<HTMLDivElement, AriaCaptionVanillaProps>(\n (\n { size, weight, variant, gradient, transform, noWrap, className, css, style, ...props },\n ref,\n ) => (\n <div\n ref={ref}\n className={cx(\n captionRecipe({ size, weight, variant, gradient, transform, noWrap }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nAriaCaptionVanilla.displayName = 'AriaCaptionVanilla';\n\nexport type AriaTableSectionVanillaProps = React.HTMLAttributes<HTMLDivElement> & CSSProps;\n\nconst section = (sectionClass: string, displayName: string) => {\n const Section = forwardRef<HTMLDivElement, AriaTableSectionVanillaProps>(\n ({ className, css, style, ...props }, ref) => (\n <div\n ref={ref}\n role=\"rowgroup\"\n className={cx(sectionClass, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n );\n Section.displayName = displayName;\n return Section;\n};\n\nexport const AriaTheadVanilla = section(cx(thead, ariaThead), 'AriaTheadVanilla');\nexport const AriaTbodyVanilla = section(cx(tbody, ariaTbody), 'AriaTbodyVanilla');\nexport const AriaTfootVanilla = section(cx(tfoot, ariaTfoot), 'AriaTfootVanilla');\n\nexport type AriaThVanillaProps = React.HTMLAttributes<HTMLSpanElement> &\n CSSProps &\n ThRecipeVariants &\n TableSortProps;\n\nexport const AriaThVanilla = forwardRef<HTMLSpanElement, AriaThVanillaProps>(\n (\n {\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n align,\n sort,\n onSort,\n className,\n css,\n style,\n children,\n ...props\n },\n ref,\n ) => (\n <span\n ref={ref}\n role=\"columnheader\"\n aria-sort={sort && ARIA_SORT[sort]}\n className={cx(\n thRecipe({ size, weight, variant, gradient, transform, noWrap, align }),\n ariaCell,\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n >\n {onSort ? (\n <SortButtonVanilla sort={sort} onSort={onSort}>\n {children}\n </SortButtonVanilla>\n ) : (\n children\n )}\n </span>\n ),\n);\n\nAriaThVanilla.displayName = 'AriaThVanilla';\n\nexport type AriaTdVanillaProps = React.HTMLAttributes<HTMLSpanElement> &\n CSSProps &\n TdRecipeVariants & {\n /** Spans the whole row. It must be the only cell of its row. */\n fullColSpan?: boolean;\n };\n\n// The cell is taken out of the row to span it, so an empty filler as tall as the cell holds the row open.\nconst FullColSpanCell = forwardRef<HTMLSpanElement, React.HTMLAttributes<HTMLSpanElement>>(\n ({ className, ...props }, forwardedRef) => {\n const cellRef = useRef<HTMLSpanElement | null>(null);\n const [height, setHeight] = useState(0);\n\n useIsomorphicLayoutEffect(() => {\n const cell = cellRef.current;\n if (!cell || typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n const update = () => setHeight(cell.offsetHeight);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(cell);\n return () => observer.disconnect();\n }, []);\n\n const setRefs = useCallback(\n (node: HTMLSpanElement | null) => {\n cellRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef],\n );\n\n return (\n <>\n <span aria-hidden className={cx(ariaCell, fillerCell)} style={{ height }} />\n <span\n ref={setRefs}\n role=\"cell\"\n {...{ [FULL_COL_SPAN_ATTRIBUTE]: '' }}\n className={cx(className, fullColSpanCell)}\n {...props}\n />\n </>\n );\n },\n);\n\nFullColSpanCell.displayName = 'FullColSpanCell';\n\nexport const AriaTdVanilla = forwardRef<HTMLSpanElement, AriaTdVanillaProps>(\n ({ fullColSpan = false, subtle, align, className, css, style, ...props }, ref) => {\n const Cell = fullColSpan ? FullColSpanCell : 'span';\n\n return (\n <Cell\n ref={ref}\n role=\"cell\"\n className={cx(tdRecipe({ subtle, align }), ariaCell, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n );\n },\n);\n\nAriaTdVanilla.displayName = 'AriaTdVanilla';\n\nconst assertFullColSpanAlone = (children: ReactNode, addedCells: number) => {\n // eslint-disable-next-line @eslint-react/no-children-to-array\n const cells = Children.toArray(children);\n const hasFullColSpan = cells.some(\n (child) => isValidElement<AriaTdVanillaProps>(child) && !!child.props.fullColSpan,\n );\n if (hasFullColSpan && cells.length + addedCells > 1) {\n throw new Error(\n 'AriaTrVanilla: a fullColSpan AriaTdVanilla must be the only cell of its row, without emptyFirstColumn or collapsedContent.',\n );\n }\n};\n\nexport type AriaTrVanillaProps = React.HTMLAttributes<HTMLDivElement> &\n CSSProps &\n TrRecipeVariants &\n RowLinkShortcutProps & {\n /** Content shown in a full-width row below, toggled by a button in a new first cell. */\n collapsedContent?: ReactNode;\n /** Accessible name of the expand button. */\n expandLabel?: string;\n /** Adds an empty first cell, to line up with rows that have an expand button. */\n emptyFirstColumn?: boolean;\n /** Styles the empty first cell as a header, for a row in `AriaTheadVanilla`. */\n tableHead?: boolean;\n };\n\nexport const AriaTrVanilla = forwardRef<HTMLDivElement, AriaTrVanillaProps>(\n (\n {\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n href,\n linkAs,\n linkCell,\n linkProps,\n linkOverlay,\n interactive,\n active,\n className,\n css,\n style,\n children,\n onClick,\n onAuxClick,\n ...props\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const contentId = useId();\n const inlineStyle = useInlineStyle(css, style);\n const collapsible = !!collapsedContent;\n\n assertFullColSpanAlone(children, Number(emptyFirstColumn) + Number(collapsible));\n\n return (\n <>\n <div\n ref={ref}\n role=\"row\"\n className={cx(\n trRecipe({ interactive: interactive ?? (href !== undefined || undefined), active }),\n ariaTr,\n rowLinkRow,\n className,\n )}\n data-collapsed={collapsible && !isOpen ? '' : undefined}\n style={inlineStyle}\n onClick={(event) => handleRowClick(event, onClick)}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\n {...props}\n >\n {emptyFirstColumn &&\n (tableHead ? (\n <span role=\"cell\" className={cx(thRecipe(), ariaCell, emptyHeaderCell)} />\n ) : (\n <AriaTdVanilla />\n ))}\n {collapsible && (\n <AriaTdVanilla className={toggleCell} onClick={stopEvent}>\n <ExpandToggleVanilla\n label={expandLabel}\n isOpen={isOpen}\n controls={contentId}\n onToggle={() => setIsOpen((open) => !open)}\n />\n </AriaTdVanilla>\n )}\n {mapRowLink(\n children,\n { href, linkAs, linkCell, linkProps, linkOverlay },\n AriaTdVanilla,\n RowLinkVanilla,\n { row: 'AriaTrVanilla', cell: 'AriaTdVanilla' },\n )}\n </div>\n {collapsible && (\n <AriaTrVanilla className={collapsedRow} data-open={isOpen ? '' : undefined}>\n <AriaTdVanilla\n id={contentId}\n fullColSpan\n className={collapsedCell}\n data-closed={isOpen ? undefined : ''}\n >\n <div className={collapsedContentClass}>{collapsedContent}</div>\n </AriaTdVanilla>\n </AriaTrVanilla>\n )}\n </>\n );\n },\n);\n\nAriaTrVanilla.displayName = 'AriaTrVanilla';\n"],"mappings":";;;;;;;;;;;;;;AAoEA,IAAa,mBAAmB,YAC7B,EAAE,WAAW,yBAAyB,OAAO,WAAW,KAAK,OAAO,GAAG,SAAS,QAC/E,oBAAC,OAAD;CACO;CACL,MAAK;CACL,WAAW,GACT,YAAY,EAAE,UAAU,CAAC,GACzB,WACA,0BAAA,WACA,cACA,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,iBAAiB,cAAc;AAM/B,IAAa,qBAAqB,YAE9B,EAAE,MAAM,QAAQ,SAAS,UAAU,WAAW,QAAQ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AAY;GAElC,UAAA,oBAAC,OAAD;IAAK,WAAA;IAAmC,UAAAC;GAAsB,CAAA;EACjD,CAAA;CACF,CAAA,CAEjB,EAAA,CAAA;AAEN,CACF;AAEA,cAAc,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Elevation.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/Elevation/Elevation.vanilla.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\n\nconst elevationBase = style({\n display: 'inline-block',\n});\n\nexport const elevationVariants = {\n 0: {\n boxShadow: 'none',\n },\n 1: {\n backgroundColor: tokens.colors['01dp'],\n boxShadow:\n '0 1px 5px 0 hsla(0, 0%, 0%, 0.2), 0 3px 1px -2px hsla(0, 0%, 0%, 0.12), 0 2px 2px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 2: {\n backgroundColor: tokens.colors['02dp'],\n boxShadow:\n '0 2px 4px -1px hsla(0, 0%, 0%, 0.2), 0 1px 10px 0 hsla(0, 0%, 0%, 0.12), 0 4px 5px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 3: {\n backgroundColor: tokens.colors['03dp'],\n boxShadow:\n '0 3px 5px -1px hsla(0, 0%, 0%, 0.2), 0 1px 18px 0 hsla(0, 0%, 0%, 0.12), 0 6px 10px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 4: {\n backgroundColor: tokens.colors['04dp'],\n boxShadow:\n '0 7px 8px -4px hsla(0, 0%, 0%, 0.2), 0 5px 22px 4px hsla(0, 0%, 0%, 0.12), 0 12px 17px 2px hsla(0, 0%, 0%, 0.14)',\n },\n 5: {\n backgroundColor: tokens.colors['05dp'],\n boxShadow:\n '0 11px 15px -7px hsla(0, 0%, 0%, 0.2), 0 9px 46px 8px hsla(0, 0%, 0%, 0.12), 0 24px 38px 3px hsla(0, 0%, 0%, 0.14)',\n },\n} as const;\n\nexport const elevationRecipe = recipe({\n base: elevationBase,\n\n variants: {\n variant: elevationVariants,\n },\n\n defaultVariants: {\n variant: 1,\n },\n});\n"],"mappings":""}
1
+ {"version":3,"file":"Elevation.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/Elevation/Elevation.vanilla.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\n\nconst elevationBase = style({\n display: 'inline-block',\n});\n\nexport const elevationVariants = {\n 0: {\n boxShadow: 'none',\n },\n 1: {\n backgroundColor: tokens.colors['01dp'],\n boxShadow:\n '0 1px 5px 0 hsla(0, 0%, 0%, 0.2), 0 3px 1px -2px hsla(0, 0%, 0%, 0.12), 0 2px 2px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 2: {\n backgroundColor: tokens.colors['02dp'],\n boxShadow:\n '0 2px 4px -1px hsla(0, 0%, 0%, 0.2), 0 1px 10px 0 hsla(0, 0%, 0%, 0.12), 0 4px 5px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 3: {\n backgroundColor: tokens.colors['03dp'],\n boxShadow:\n '0 3px 5px -1px hsla(0, 0%, 0%, 0.2), 0 1px 18px 0 hsla(0, 0%, 0%, 0.12), 0 6px 10px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 4: {\n backgroundColor: tokens.colors['04dp'],\n boxShadow:\n '0 7px 8px -4px hsla(0, 0%, 0%, 0.2), 0 5px 22px 4px hsla(0, 0%, 0%, 0.12), 0 12px 17px 2px hsla(0, 0%, 0%, 0.14)',\n },\n 5: {\n backgroundColor: tokens.colors['05dp'],\n boxShadow:\n '0 11px 15px -7px hsla(0, 0%, 0%, 0.2), 0 9px 46px 8px hsla(0, 0%, 0%, 0.12), 0 24px 38px 3px hsla(0, 0%, 0%, 0.14)',\n },\n};\n\nexport const elevationRecipe = recipe({\n base: elevationBase,\n\n variants: {\n variant: elevationVariants,\n },\n\n defaultVariants: {\n variant: 1,\n },\n});\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Elevation.vanilla.css.js","names":["_7a468"],"sources":["../../../components/Elevation/Elevation.vanilla.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\n\nconst elevationBase = style({\n display: 'inline-block',\n});\n\nexport const elevationVariants = {\n 0: {\n boxShadow: 'none',\n },\n 1: {\n backgroundColor: tokens.colors['01dp'],\n boxShadow:\n '0 1px 5px 0 hsla(0, 0%, 0%, 0.2), 0 3px 1px -2px hsla(0, 0%, 0%, 0.12), 0 2px 2px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 2: {\n backgroundColor: tokens.colors['02dp'],\n boxShadow:\n '0 2px 4px -1px hsla(0, 0%, 0%, 0.2), 0 1px 10px 0 hsla(0, 0%, 0%, 0.12), 0 4px 5px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 3: {\n backgroundColor: tokens.colors['03dp'],\n boxShadow:\n '0 3px 5px -1px hsla(0, 0%, 0%, 0.2), 0 1px 18px 0 hsla(0, 0%, 0%, 0.12), 0 6px 10px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 4: {\n backgroundColor: tokens.colors['04dp'],\n boxShadow:\n '0 7px 8px -4px hsla(0, 0%, 0%, 0.2), 0 5px 22px 4px hsla(0, 0%, 0%, 0.12), 0 12px 17px 2px hsla(0, 0%, 0%, 0.14)',\n },\n 5: {\n backgroundColor: tokens.colors['05dp'],\n boxShadow:\n '0 11px 15px -7px hsla(0, 0%, 0%, 0.2), 0 9px 46px 8px hsla(0, 0%, 0%, 0.12), 0 24px 38px 3px hsla(0, 0%, 0%, 0.14)',\n },\n} as const;\n\nexport const elevationRecipe = recipe({\n base: elevationBase,\n\n variants: {\n variant: elevationVariants,\n },\n\n defaultVariants: {\n variant: 1,\n },\n});\n"],"mappings":""}
1
+ {"version":3,"file":"Elevation.vanilla.css.js","names":["_7a468"],"sources":["../../../components/Elevation/Elevation.vanilla.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\n\nconst elevationBase = style({\n display: 'inline-block',\n});\n\nexport const elevationVariants = {\n 0: {\n boxShadow: 'none',\n },\n 1: {\n backgroundColor: tokens.colors['01dp'],\n boxShadow:\n '0 1px 5px 0 hsla(0, 0%, 0%, 0.2), 0 3px 1px -2px hsla(0, 0%, 0%, 0.12), 0 2px 2px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 2: {\n backgroundColor: tokens.colors['02dp'],\n boxShadow:\n '0 2px 4px -1px hsla(0, 0%, 0%, 0.2), 0 1px 10px 0 hsla(0, 0%, 0%, 0.12), 0 4px 5px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 3: {\n backgroundColor: tokens.colors['03dp'],\n boxShadow:\n '0 3px 5px -1px hsla(0, 0%, 0%, 0.2), 0 1px 18px 0 hsla(0, 0%, 0%, 0.12), 0 6px 10px 0 hsla(0, 0%, 0%, 0.14)',\n },\n 4: {\n backgroundColor: tokens.colors['04dp'],\n boxShadow:\n '0 7px 8px -4px hsla(0, 0%, 0%, 0.2), 0 5px 22px 4px hsla(0, 0%, 0%, 0.12), 0 12px 17px 2px hsla(0, 0%, 0%, 0.14)',\n },\n 5: {\n backgroundColor: tokens.colors['05dp'],\n boxShadow:\n '0 11px 15px -7px hsla(0, 0%, 0%, 0.2), 0 9px 46px 8px hsla(0, 0%, 0%, 0.12), 0 24px 38px 3px hsla(0, 0%, 0%, 0.14)',\n },\n};\n\nexport const elevationRecipe = recipe({\n base: elevationBase,\n\n variants: {\n variant: elevationVariants,\n },\n\n defaultVariants: {\n variant: 1,\n },\n});\n"],"mappings":""}
@@ -4,7 +4,7 @@ import { Text } from "../Text/Text.js";
4
4
  import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
5
5
  import { FieldContext, useAnnouncedError, useFieldRoot } from "./FieldContext.js";
6
6
  import React from "react";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
  // components/Field/Field.tsx
9
9
  var MESSAGE_CSS = {
10
10
  display: "block",
@@ -76,7 +76,7 @@ var Field = ({ label, hint, description, error, announceError, labelPosition = "
76
76
  css: labelPosition === "top" ? HINT_ABOVE_CONTROL_CSS : MESSAGE_CSS,
77
77
  children: hint
78
78
  });
79
- const messages = /* @__PURE__ */ jsxs(Fragment, { children: [hasDescription && /* @__PURE__ */ jsx(Text, {
79
+ const messages = /* @__PURE__ */ jsxs(Fragment$1, { children: [hasDescription && /* @__PURE__ */ jsx(Text, {
80
80
  as: "p",
81
81
  id: ids.descriptionId,
82
82
  size: messageSize,
@@ -101,13 +101,13 @@ var Field = ({ label, hint, description, error, announceError, labelPosition = "
101
101
  onFocus,
102
102
  onBlur,
103
103
  ...groupProps,
104
- children: [labelPosition === "start" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Box, {
104
+ children: [labelPosition === "start" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box, {
105
105
  css: START_LABEL_CSS,
106
106
  children: [labelNode, hintNode]
107
107
  }), /* @__PURE__ */ jsxs(Box, {
108
108
  css: START_CONTROL_CSS,
109
109
  children: [children, messages]
110
- })] }) : labelPosition === "end" ? /* @__PURE__ */ jsxs(Fragment, { children: [
110
+ })] }) : labelPosition === "end" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
111
111
  /* @__PURE__ */ jsxs(Box, {
112
112
  css: {
113
113
  display: "flex",
@@ -119,7 +119,7 @@ var Field = ({ label, hint, description, error, announceError, labelPosition = "
119
119
  }),
120
120
  hintNode,
121
121
  messages
122
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
122
+ ] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
123
123
  labelNode,
124
124
  hintNode,
125
125
  children,
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","names":["_Fragment"],"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,IA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ACE,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAC5B,UAAA,qBAAC,KAAD;GACE,KAAK,kBAAkB,UAAU;IAAE,GAAG;IAAe,GAAG;GAAI,IAAI;GACvD;GACD;GACR,GAAI;GAJN,UAAA,CAMG,kBAAkB,UACjB,qBAAAA,UAAA,EAAA,UAAA,CACE,qBAAC,KAAD;IAAK,KAAK;IAAV,UAAA,CACG,WACA,QACE;GACL,CAAA,GAAA,qBAAC,KAAD;IAAK,KAAK;IAAV,UAAA,CACG,UACA,QACE;GACL,CAAA,CAAA,EAAA,CAAA,IACA,kBAAkB,QACpB,qBAAAA,UAAA,EAAA,UAAA;IACE,qBAAC,KAAD;KACE,KAAK;MACH,SAAS;MACT,YAAY;MACZ,KAAK;MACL,yBAAuB,EAAE,GAAG,EAAE;KAChC;KANF,UAAA,CAQG,UACA,SACE;;IACJ;IACA;GACD,EAAA,CAAA,IAEF,qBAAAA,UAAA,EAAA,UAAA;IACG;IACA;IACA;IACA;GACD,EAAA,CAAA,GAEH,iBAAiB,oBAAC,gBAAD;IAAgB,aAAU;IAAU,UAAA;GAA+B,CAAA,CAClF;;CACgB,CAAA;AAE3B"}
1
+ {"version":3,"file":"Field.js","names":["_Fragment"],"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;CAAS,UAAU;AAAQ;AAC3D,IAAM,oBAAoB;CAAE,MAAM;CAAS,UAAU;AAAQ;;;;;AAM7D,IAAa,SAAS,EACpB,OACA,MACA,aACA,OACA,eACA,gBAAgB,OAChB,UACA,KACA,GAAG,YACa;CAChB,MAAM,EACJ,SACA,KACA,YACA,aACA,UACA,cACA,UACA,SACA,gBACA,UACA,SACA,WACE,aAAa;EAAE;EAAO;EAAM;EAAa;EAAO,GAAG;CAAM,CAAC;CAC9D,MAAM,iBAAiB,kBACrB,QAAQ,aAAa,GACrB,WAAW,IAAI,UAAU,KAAA,GACzB,IAAI,OACN;CAEA,MAAM,YAAY,MAAM,cAAc;EACpC,IAAI,CAAC,YAAY,CAAC,IAAI,SACpB,OAAO;EAET,IAAI,OAAO,UA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;KANF,UAAA,CAQG,UACA,SACE;;IACJ;IACA;GACD,EAAA,CAAA,IAEF,qBAAAA,YAAA,EAAA,UAAA;IACG;IACA;IACA;IACA;GACD,EAAA,CAAA,GAEH,iBAAiB,oBAAC,gBAAD;IAAgB,aAAU;IAAU,UAAA;GAA+B,CAAA,CAClF;;CACgB,CAAA;AAE3B"}
@@ -8,7 +8,7 @@ import { endLabelRow, startControl, startLabel, startRow } from "./Field.vanilla
8
8
  import { FieldContext, useAnnouncedError, useFieldRoot } from "./FieldContext.js";
9
9
  import React from "react";
10
10
  import { assignInlineVars } from "@vanilla-extract/dynamic";
11
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
12
  // components/Field/Field.vanilla.tsx
13
13
  var MESSAGE_CSS = {
14
14
  display: "block",
@@ -67,7 +67,7 @@ var FieldVanilla = ({ label, hint, description, error, announceError, labelPosit
67
67
  css: labelPosition === "top" ? HINT_ABOVE_CONTROL_CSS : MESSAGE_CSS,
68
68
  children: hint
69
69
  });
70
- const messages = /* @__PURE__ */ jsxs(Fragment, { children: [hasDescription && /* @__PURE__ */ jsx(TextVanilla, {
70
+ const messages = /* @__PURE__ */ jsxs(Fragment$1, { children: [hasDescription && /* @__PURE__ */ jsx(TextVanilla, {
71
71
  as: "p",
72
72
  id: ids.descriptionId,
73
73
  size: messageSize,
@@ -93,20 +93,20 @@ var FieldVanilla = ({ label, hint, description, error, announceError, labelPosit
93
93
  onFocus,
94
94
  onBlur,
95
95
  ...groupProps,
96
- children: [labelPosition === "start" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(BoxVanilla, {
96
+ children: [labelPosition === "start" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(BoxVanilla, {
97
97
  className: startLabel,
98
98
  children: [labelNode, hintNode]
99
99
  }), /* @__PURE__ */ jsxs(BoxVanilla, {
100
100
  className: startControl,
101
101
  children: [children, messages]
102
- })] }) : labelPosition === "end" ? /* @__PURE__ */ jsxs(Fragment, { children: [
102
+ })] }) : labelPosition === "end" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
103
103
  /* @__PURE__ */ jsxs(BoxVanilla, {
104
104
  className: endLabelRow,
105
105
  children: [children, labelNode]
106
106
  }),
107
107
  hintNode,
108
108
  messages
109
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ ] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
110
110
  labelNode,
111
111
  hintNode,
112
112
  children,
@@ -1 +1 @@
1
- {"version":3,"file":"Field.vanilla.js","names":["_Fragment"],"sources":["../../../components/Field/Field.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { BoxVanilla } from '../Box';\nimport { LabelVanilla } from '../Label';\nimport { TextVanilla } from '../Text';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { endLabelRow, startControl, startLabel, startRow } from './Field.vanilla.css';\nimport { FieldBaseProps, FieldContext, useAnnouncedError, useFieldRoot } from './FieldContext';\n\nexport type FieldVanillaProps = FieldBaseProps & { css?: CSSProps['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\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 FieldVanilla = ({\n label,\n hint,\n description,\n error,\n announceError,\n labelPosition = 'top',\n children,\n css,\n ...props\n}: FieldVanillaProps) => {\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 const { colors } = useVanillaExtractTheme();\n const { style: rootStyle, vars: rootVars } = processCSSProp(css, colors);\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 <LabelVanilla\n variant={labelVariant}\n htmlFor={labelFor}\n id={ids.labelId}\n css={hasHint || labelPosition === 'start' ? COMPACT_LABEL_CSS : undefined}\n >\n {label}\n </LabelVanilla>\n );\n }, [hasLabel, hasHint, label, labelPosition, labelVariant, labelFor, ids.labelId]);\n\n const hintNode = hasHint && (\n <TextVanilla\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 </TextVanilla>\n );\n\n const messages = (\n <>\n {hasDescription && (\n <TextVanilla\n as=\"p\"\n id={ids.descriptionId}\n size={messageSize}\n variant=\"subtle\"\n css={MESSAGE_CSS}\n >\n {description}\n </TextVanilla>\n )}\n {hasError && (\n <TextVanilla as=\"p\" id={ids.errorId} size={messageSize} variant=\"invalid\" css={MESSAGE_CSS}>\n {error}\n </TextVanilla>\n )}\n </>\n );\n\n return (\n <FieldContext.Provider value={context}>\n <div\n className={labelPosition === 'start' ? startRow : undefined}\n style={{ ...rootStyle, ...assignInlineVars(rootVars) }}\n onFocus={onFocus}\n onBlur={onBlur}\n {...groupProps}\n >\n {labelPosition === 'start' ? (\n <>\n <BoxVanilla className={startLabel}>\n {labelNode}\n {hintNode}\n </BoxVanilla>\n <BoxVanilla className={startControl}>\n {children}\n {messages}\n </BoxVanilla>\n </>\n ) : labelPosition === 'end' ? (\n <>\n <BoxVanilla className={endLabelRow}>\n {children}\n {labelNode}\n </BoxVanilla>\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 </div>\n </FieldContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAcA,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;;;;;AAM1D,IAAa,gBAAgB,EAC3B,OACA,MACA,aACA,OACA,eACA,gBAAgB,OAChB,UACA,KACA,GAAG,YACoB;CACvB,MAAM,EACJ,SACA,KACA,YACA,aACA,UACA,cACA,UACA,SACA,gBACA,UACA,SACA,WACE,aAAa;EAAE;EAAO;EAAM;EAAa;EAAO,GAAG;CAAM,CAAC;CAC9D,MAAM,iBAAiB,kBACrB,QAAQ,aAAa,GACrB,WAAW,IAAI,UAAU,KAAA,GACzB,IAAI,OACN;CACA,MAAM,EAAE,WAAW,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,MAAM,aAAa,eAAe,KAAK,MAAM;CAEvE,MAAM,YAAY,MAAM,cAAc;EACpC,IAAI,CAAC,YAAY,CAAC,IAAI,SACpB,OAAO;EAET,IAAI,OAAO,UAAU,YACnB,OAAO,MAAM;GAAE,SAAS;GAAc,SAAS;GAAU,IAAI,IAAI;EAAQ,CAAC;EAE5E,OACE,oBAAC,cAAD;GACE,SAAS;GACT,SAAS;GACT,IAAI,IAAI;GACR,KAAK,WAAW,kBAAkB,UAAU,oBAAoB,KAAA;GAE/D,UAAA;EACW,CAAA;CAElB,GAAG;EAAC;EAAU;EAAS;EAAO;EAAe;EAAc;EAAU,IAAI;CAAO,CAAC;CAEjF,MAAM,WAAW,WACf,oBAAC,aAAD;EACE,IAAG;EACH,IAAI,IAAI;EACR,MAAM;EACN,SAAQ;EACR,KAAK,kBAAkB,QAAQ,yBAAyB;EAEvD,UAAA;CACU,CAAA;CAGf,MAAM,WACJ,qBAAAA,UAAA,EAAA,UAAA,CACG,kBACC,oBAAC,aAAD;EACE,IAAG;EACH,IAAI,IAAI;EACR,MAAM;EACN,SAAQ;EACR,KAAK;EAEJ,UAAA;CACU,CAAA,GAEd,YACC,oBAAC,aAAD;EAAa,IAAG;EAAI,IAAI,IAAI;EAAS,MAAM;EAAa,SAAQ;EAAU,KAAK;EAC5E,UAAA;CACU,CAAA,CAEf,EAAA,CAAA;CAGJ,OACE,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAC5B,UAAA,qBAAC,OAAD;GACE,WAAW,kBAAkB,UAAU,WAAW,KAAA;GAClD,OAAO;IAAE,GAAG;IAAW,GAAG,iBAAiB,QAAQ;GAAE;GAC5C;GACD;GACR,GAAI;GALN,UAAA,CAOG,kBAAkB,UACjB,qBAAAA,UAAA,EAAA,UAAA,CACE,qBAAC,YAAD;IAAY,WAAW;IAAvB,UAAA,CACG,WACA,QACS;GACZ,CAAA,GAAA,qBAAC,YAAD;IAAY,WAAW;IAAvB,UAAA,CACG,UACA,QACS;GACZ,CAAA,CAAA,EAAA,CAAA,IACA,kBAAkB,QACpB,qBAAAA,UAAA,EAAA,UAAA;IACE,qBAAC,YAAD;KAAY,WAAW;KAAvB,UAAA,CACG,UACA,SACS;;IACX;IACA;GACD,EAAA,CAAA,IAEF,qBAAAA,UAAA,EAAA,UAAA;IACG;IACA;IACA;IACA;GACD,EAAA,CAAA,GAEH,iBAAiB,oBAAC,gBAAD;IAAgB,aAAU;IAAU,UAAA;GAA+B,CAAA,CAClF;;CACgB,CAAA;AAE3B"}
1
+ {"version":3,"file":"Field.vanilla.js","names":["_Fragment"],"sources":["../../../components/Field/Field.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { BoxVanilla } from '../Box';\nimport { LabelVanilla } from '../Label';\nimport { TextVanilla } from '../Text';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { endLabelRow, startControl, startLabel, startRow } from './Field.vanilla.css';\nimport { FieldBaseProps, FieldContext, useAnnouncedError, useFieldRoot } from './FieldContext';\n\nexport type FieldVanillaProps = FieldBaseProps & { css?: CSSProps['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\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 FieldVanilla = ({\n label,\n hint,\n description,\n error,\n announceError,\n labelPosition = 'top',\n children,\n css,\n ...props\n}: FieldVanillaProps) => {\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 const { colors } = useVanillaExtractTheme();\n const { style: rootStyle, vars: rootVars } = processCSSProp(css, colors);\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 <LabelVanilla\n variant={labelVariant}\n htmlFor={labelFor}\n id={ids.labelId}\n css={hasHint || labelPosition === 'start' ? COMPACT_LABEL_CSS : undefined}\n >\n {label}\n </LabelVanilla>\n );\n }, [hasLabel, hasHint, label, labelPosition, labelVariant, labelFor, ids.labelId]);\n\n const hintNode = hasHint && (\n <TextVanilla\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 </TextVanilla>\n );\n\n const messages = (\n <>\n {hasDescription && (\n <TextVanilla\n as=\"p\"\n id={ids.descriptionId}\n size={messageSize}\n variant=\"subtle\"\n css={MESSAGE_CSS}\n >\n {description}\n </TextVanilla>\n )}\n {hasError && (\n <TextVanilla as=\"p\" id={ids.errorId} size={messageSize} variant=\"invalid\" css={MESSAGE_CSS}>\n {error}\n </TextVanilla>\n )}\n </>\n );\n\n return (\n <FieldContext.Provider value={context}>\n <div\n className={labelPosition === 'start' ? startRow : undefined}\n style={{ ...rootStyle, ...assignInlineVars(rootVars) }}\n onFocus={onFocus}\n onBlur={onBlur}\n {...groupProps}\n >\n {labelPosition === 'start' ? (\n <>\n <BoxVanilla className={startLabel}>\n {labelNode}\n {hintNode}\n </BoxVanilla>\n <BoxVanilla className={startControl}>\n {children}\n {messages}\n </BoxVanilla>\n </>\n ) : labelPosition === 'end' ? (\n <>\n <BoxVanilla className={endLabelRow}>\n {children}\n {labelNode}\n </BoxVanilla>\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 </div>\n </FieldContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAcA,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;;;;;AAM1D,IAAa,gBAAgB,EAC3B,OACA,MACA,aACA,OACA,eACA,gBAAgB,OAChB,UACA,KACA,GAAG,YACoB;CACvB,MAAM,EACJ,SACA,KACA,YACA,aACA,UACA,cACA,UACA,SACA,gBACA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;GAC5C;GACD;GACR,GAAI;GALN,UAAA,CAOG,kBAAkB,UACjB,qBAAAA,YAAA,EAAA,UAAA,CACE,qBAAC,YAAD;IAAY,WAAW;IAAvB,UAAA,CACG,WACA,QACS;GACZ,CAAA,GAAA,qBAAC,YAAD;IAAY,WAAW;IAAvB,UAAA,CACG,UACA,QACS;GACZ,CAAA,CAAA,EAAA,CAAA,IACA,kBAAkB,QACpB,qBAAAA,YAAA,EAAA,UAAA;IACE,qBAAC,YAAD;KAAY,WAAW;KAAvB,UAAA,CACG,UACA,SACS;;IACX;IACA;GACD,EAAA,CAAA,IAEF,qBAAAA,YAAA,EAAA,UAAA;IACG;IACA;IACA;IACA;GACD,EAAA,CAAA,GAEH,iBAAiB,oBAAC,gBAAD;IAAgB,aAAU;IAAU,UAAA;GAA+B,CAAA,CAClF;;CACgB,CAAA;AAE3B"}
@@ -0,0 +1,128 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ const require_cssProps = require("../../styles/cssProps.cjs");
3
+ const require_cx = require("../../styles/cx.cjs");
4
+ const require_themeContext = require("../../styles/themeContext.cjs");
5
+ const require_warnOnce = require("../../utils/warnOnce.cjs");
6
+ const require_Flex_vanilla_css = require("../Flex/Flex.vanilla.css.cjs");
7
+ const require_List_vanilla_css = require("./List.vanilla.css.cjs");
8
+ let react = require("react");
9
+ react = require_runtime.__toESM(react, 1);
10
+ let _vanilla_extract_dynamic = require("@vanilla-extract/dynamic");
11
+ let react_jsx_runtime = require("react/jsx-runtime");
12
+ // components/List/List.vanilla.tsx
13
+ var ListVanillaContext = (0, react.createContext)({ interactive: false });
14
+ var useInlineStyle = (css, style) => {
15
+ const { colors } = require_themeContext.useVanillaExtractTheme();
16
+ const { style: cssStyles, vars } = require_cssProps.processCSSProp(css, colors);
17
+ return {
18
+ ...cssStyles,
19
+ ...style,
20
+ ...(0, _vanilla_extract_dynamic.assignInlineVars)(vars)
21
+ };
22
+ };
23
+ var useListContextValue = (interactive) => {
24
+ const parent = (0, react.useContext)(ListVanillaContext);
25
+ return (0, react.useMemo)(() => ({ interactive: interactive ?? parent.interactive }), [interactive, parent.interactive]);
26
+ };
27
+ var UlVanilla = (0, react.forwardRef)(({ interactive, className, css, style, ...props }, ref) => {
28
+ const contextValue = useListContextValue(interactive);
29
+ const inlineStyle = useInlineStyle(css, style);
30
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListVanillaContext.Provider, {
31
+ value: contextValue,
32
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
33
+ ref,
34
+ role: "list",
35
+ className: require_cx.cx(require_List_vanilla_css.ul, className),
36
+ style: inlineStyle,
37
+ ...props
38
+ })
39
+ });
40
+ });
41
+ UlVanilla.displayName = "UlVanilla";
42
+ var OlVanilla = (0, react.forwardRef)(({ interactive, className, css, style, ...props }, ref) => {
43
+ const contextValue = useListContextValue(interactive);
44
+ const inlineStyle = useInlineStyle(css, style);
45
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListVanillaContext.Provider, {
46
+ value: contextValue,
47
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
48
+ ref,
49
+ role: "list",
50
+ className: require_cx.cx(require_List_vanilla_css.ol, className),
51
+ style: inlineStyle,
52
+ ...props
53
+ })
54
+ });
55
+ });
56
+ OlVanilla.displayName = "OlVanilla";
57
+ var NESTED_LIST_WARNING = "LiVanilla: a nested list is rendered inside the item content, so it ends up in its button or span. Make UlVanilla or OlVanilla a direct child of LiVanilla, and wrap only its items in your component.";
58
+ var splitNestedLists = (children) => {
59
+ const content = [];
60
+ const nestedLists = [];
61
+ react.Children.toArray(children).forEach((child) => {
62
+ if (!(0, react.isValidElement)(child)) content.push(child);
63
+ else if (child.type === UlVanilla || child.type === OlVanilla) nestedLists.push(child);
64
+ else if (child.type === react.Fragment) {
65
+ const inner = splitNestedLists(child.props.children);
66
+ content.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: inner.content }, child.key));
67
+ if (inner.nestedLists.length) nestedLists.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: inner.nestedLists }, child.key));
68
+ } else content.push(child);
69
+ });
70
+ return {
71
+ content,
72
+ nestedLists
73
+ };
74
+ };
75
+ var LiVanilla = (0, react.forwardRef)(({ controls, disabled, elevation, align, justify, direction, gap, wrap, className, css, style, children, ...props }, ref) => {
76
+ const { interactive } = (0, react.useContext)(ListVanillaContext);
77
+ const inlineStyle = useInlineStyle(css, style);
78
+ const { content, nestedLists } = splitNestedLists(children);
79
+ const contentRef = (0, react.useRef)(null);
80
+ const setContentRef = (0, react.useCallback)((node) => {
81
+ contentRef.current = node;
82
+ }, []);
83
+ (0, react.useEffect)(() => {
84
+ if (contentRef.current?.querySelector("ul, ol")) require_warnOnce.warnOnce(NESTED_LIST_WARNING);
85
+ });
86
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
87
+ ref,
88
+ className: require_cx.cx(require_List_vanilla_css.liRecipe({ elevation }), className),
89
+ style: inlineStyle,
90
+ ...props,
91
+ children: [
92
+ interactive ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
93
+ ref: setContentRef,
94
+ type: "button",
95
+ disabled,
96
+ className: require_cx.cx(require_Flex_vanilla_css.flexRecipe({
97
+ align,
98
+ justify,
99
+ direction,
100
+ gap,
101
+ wrap
102
+ }), require_List_vanilla_css.itemButton),
103
+ children: content
104
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
105
+ ref: setContentRef,
106
+ className: require_cx.cx(require_Flex_vanilla_css.flexRecipe({
107
+ align: align ?? "center",
108
+ justify,
109
+ direction,
110
+ gap: gap ?? 1,
111
+ wrap
112
+ }), require_List_vanilla_css.itemText),
113
+ children: content
114
+ }),
115
+ nestedLists,
116
+ !!controls && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
117
+ className: "bq2jhfc",
118
+ children: controls
119
+ })
120
+ ]
121
+ });
122
+ });
123
+ LiVanilla.displayName = "LiVanilla";
124
+ exports.LiVanilla = LiVanilla;
125
+ exports.OlVanilla = OlVanilla;
126
+ exports.UlVanilla = UlVanilla;
127
+
128
+ //# sourceMappingURL=List.vanilla.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.vanilla.cjs","names":["createContext","useVanillaExtractTheme","processCSSProp","assignInlineVars","useContext","useMemo","forwardRef","cx","ul","ol","isValidElement","Fragment","useRef","useCallback","liRecipe","flexRecipe","itemButton","itemText"],"sources":["../../../components/List/List.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport React, {\n Children,\n createContext,\n CSSProperties,\n forwardRef,\n Fragment,\n isValidElement,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport type {\n FlexAlignSimplified,\n FlexDirection,\n FlexJustifySimplified,\n Gap,\n} from '../../styles/types';\nimport { warnOnce } from '../../utils/warnOnce';\nimport { flexRecipe } from '../Flex/Flex.vanilla.css';\nimport { controlsWrapper, itemButton, itemText, liRecipe, ol, ul } from './List.vanilla.css';\n\nconst ListVanillaContext = createContext({ interactive: false });\n\nconst useInlineStyle = (css: CSSProps['css'], style?: CSSProperties) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n return { ...cssStyles, ...style, ...assignInlineVars(vars) };\n};\n\nconst useListContextValue = (interactive?: boolean) => {\n const parent = useContext(ListVanillaContext);\n return useMemo(\n () => ({ interactive: interactive ?? parent.interactive }),\n [interactive, parent.interactive],\n );\n};\n\ntype ListOwnProps = CSSProps & {\n /** Renders the items as buttons. Nested lists inherit it. */\n interactive?: boolean;\n};\n\nexport type UlVanillaProps = React.HTMLAttributes<HTMLUListElement> & ListOwnProps;\n\nexport const UlVanilla = forwardRef<HTMLUListElement, UlVanillaProps>(\n ({ interactive, className, css, style, ...props }, ref) => {\n const contextValue = useListContextValue(interactive);\n const inlineStyle = useInlineStyle(css, style);\n\n return (\n <ListVanillaContext.Provider value={contextValue}>\n <ul ref={ref} role=\"list\" className={cx(ul, className)} style={inlineStyle} {...props} />\n </ListVanillaContext.Provider>\n );\n },\n);\n\nUlVanilla.displayName = 'UlVanilla';\n\nexport type OlVanillaProps = React.OlHTMLAttributes<HTMLOListElement> & ListOwnProps;\n\nexport const OlVanilla = forwardRef<HTMLOListElement, OlVanillaProps>(\n ({ interactive, className, css, style, ...props }, ref) => {\n const contextValue = useListContextValue(interactive);\n const inlineStyle = useInlineStyle(css, style);\n\n return (\n <ListVanillaContext.Provider value={contextValue}>\n <ol ref={ref} role=\"list\" className={cx(ol, className)} style={inlineStyle} {...props} />\n </ListVanillaContext.Provider>\n );\n },\n);\n\nOlVanilla.displayName = 'OlVanilla';\n\ntype LiRecipeVariants = NonNullable<RecipeVariants<typeof liRecipe>>;\n\nexport type LiVanillaProps = React.LiHTMLAttributes<HTMLLIElement> &\n CSSProps &\n LiRecipeVariants & {\n /** Shown on the right of the item, outside its button. */\n controls?: ReactNode;\n /** Disables the item's button. Only applies in an interactive list. */\n disabled?: boolean;\n align?: FlexAlignSimplified;\n justify?: FlexJustifySimplified;\n direction?: FlexDirection;\n gap?: Gap;\n wrap?: 'wrap' | 'noWrap' | 'wrapReverse';\n };\n\nconst NESTED_LIST_WARNING =\n 'LiVanilla: a nested list is rendered inside the item content, so it ends up in its button or span. ' +\n 'Make UlVanilla or OlVanilla a direct child of LiVanilla, and wrap only its items in your component.';\n\n// Looks into fragments, but not into components: what they render is unknown at this point.\nconst splitNestedLists = (children: ReactNode) => {\n const content: ReactNode[] = [];\n const nestedLists: ReactNode[] = [];\n\n // eslint-disable-next-line @eslint-react/no-children-to-array\n Children.toArray(children).forEach((child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) {\n content.push(child);\n } else if (child.type === UlVanilla || child.type === OlVanilla) {\n nestedLists.push(child);\n } else if (child.type === Fragment) {\n const inner = splitNestedLists(child.props.children);\n content.push(<Fragment key={child.key}>{inner.content}</Fragment>);\n if (inner.nestedLists.length) {\n nestedLists.push(<Fragment key={child.key}>{inner.nestedLists}</Fragment>);\n }\n } else {\n content.push(child);\n }\n });\n\n return { content, nestedLists };\n};\n\nexport const LiVanilla = forwardRef<HTMLLIElement, LiVanillaProps>(\n (\n {\n controls,\n disabled,\n elevation,\n align,\n justify,\n direction,\n gap,\n wrap,\n className,\n css,\n style,\n children,\n ...props\n },\n ref,\n ) => {\n const { interactive } = useContext(ListVanillaContext);\n const inlineStyle = useInlineStyle(css, style);\n const { content, nestedLists } = splitNestedLists(children);\n\n const contentRef = useRef<HTMLElement | null>(null);\n const setContentRef = useCallback((node: HTMLElement | null) => {\n contentRef.current = node;\n }, []);\n\n // A list rendered by a wrapper component can't be detected before render.\n useEffect(() => {\n if (contentRef.current?.querySelector('ul, ol')) {\n warnOnce(NESTED_LIST_WARNING);\n }\n });\n\n return (\n <li\n ref={ref}\n className={cx(liRecipe({ elevation }), className)}\n style={inlineStyle}\n {...props}\n >\n {interactive ? (\n <button\n ref={setContentRef}\n type=\"button\"\n disabled={disabled}\n className={cx(flexRecipe({ align, justify, direction, gap, wrap }), itemButton)}\n >\n {content}\n </button>\n ) : (\n <span\n ref={setContentRef}\n className={cx(\n flexRecipe({ align: align ?? 'center', justify, direction, gap: gap ?? 1, wrap }),\n itemText,\n )}\n >\n {content}\n </span>\n )}\n {nestedLists}\n {!!controls && <div className={controlsWrapper}>{controls}</div>}\n </li>\n );\n },\n);\n\nLiVanilla.displayName = 'LiVanilla';\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAM,sBAAA,GAAqBA,MAAAA,cAAAA,CAAc,EAAE,aAAa,MAAM,CAAC;AAE/D,IAAM,kBAAkB,KAAsB,UAA0B;CACtE,MAAM,EAAE,WAAWC,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C5C,iBAAA,SAAS,mBAAmB;CAEhC,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,MAAD;EACO;EACL,WAAWN,WAAAA,GAAGO,yBAAAA,SAAS,EAAE,UAAU,CAAC,GAAG,SAAS;EAChD,OAAO;EACP,GAAI;EAJN,UAAA;GAMG,cACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;IACE,KAAK;IACL,MAAK;IACK;IACV,WAAWP,WAAAA,GAAGQ,yBAAAA,WAAW;KAAE;KAAO;KAAS;KAAW;KAAK;IAAK,CAAC,GAAGC,yBAAAA,UAAU;IAE7E,UAAA;GACK,CAAA,IAER,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IACE,KAAK;IACL,WAAWT,WAAAA,GACTQ,yBAAAA,WAAW;KAAE,OAAO,SAAS;KAAU;KAAS;KAAW,KAAK,OAAO;KAAG;IAAK,CAAC,GAChFE,yBAAAA,QACF;IAEC,UAAA;GACG,CAAA;GAEP;GACA,CAAC,CAAC,YAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAA;IAA6B,UAAA;GAAc,CAAA;EAC7D;;AAER,CACF;AAEA,UAAU,cAAc"}
@@ -0,0 +1,30 @@
1
+ ;/* empty css */
2
+ ;/* empty css */
3
+ let _vanilla_extract_recipes_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
4
+ // components/List/List.vanilla.css.ts
5
+ var ul = "bq2jhf0";
6
+ var ol = "bq2jhf1";
7
+ var liRecipe = (0, _vanilla_extract_recipes_createRuntimeFn.createRuntimeFn)({
8
+ defaultClassName: "bq2jhf2",
9
+ variantClassNames: { elevation: {
10
+ "0": "bq2jhf3",
11
+ "1": "bq2jhf4",
12
+ "2": "bq2jhf5",
13
+ "3": "bq2jhf6",
14
+ "4": "bq2jhf7",
15
+ "5": "bq2jhf8"
16
+ } },
17
+ defaultVariants: { elevation: 0 },
18
+ compoundVariants: []
19
+ });
20
+ var itemText = "bq2jhfa bq2jhf9";
21
+ var itemButton = "bq2jhfb bq2jhf9";
22
+ var controlsWrapper = "bq2jhfc";
23
+ exports.controlsWrapper = controlsWrapper;
24
+ exports.itemButton = itemButton;
25
+ exports.itemText = itemText;
26
+ exports.liRecipe = liRecipe;
27
+ exports.ol = ol;
28
+ exports.ul = ul;
29
+
30
+ //# sourceMappingURL=List.vanilla.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/List/List.vanilla.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\nimport { elevationVariants } from '../Elevation/Elevation.vanilla.css';\n\nconst list = {\n margin: '0 0 0 8px',\n padding: 0,\n color: tokens.colors.textDefault,\n};\n\nexport const ul = style(list);\nexport const ol = style(list);\n\nconst checkboxList = `${ul}:has(> li > span > input[type=\"checkbox\"])`;\n\nglobalStyle(checkboxList, {\n margin: 0,\n listStyle: 'none',\n});\n\nglobalStyle(`${checkboxList} > li`, {\n marginLeft: 0,\n});\n\nglobalStyle(`${checkboxList} > li > span input`, {\n margin: '0 3px 0 0',\n});\n\n// A nested checkbox list keeps its indentation.\nglobalStyle(`li > ${checkboxList}, li > ${checkboxList} > li`, {\n marginLeft: tokens.space[2],\n});\n\nglobalStyle(`${ol} > li::marker`, {\n fontSize: tokens.fontSizes[3],\n fontFamily: tokens.fonts.rubik,\n});\n\nexport const liRecipe = recipe({\n base: {\n margin: tokens.space[2],\n outline: 'none',\n position: 'relative',\n selectors: {\n '&:focus-within': {\n boxShadow: 'none',\n },\n },\n },\n\n variants: {\n elevation: elevationVariants,\n },\n\n defaultVariants: {\n elevation: 0,\n },\n});\n\nconst itemContent = style({\n backgroundColor: 'transparent',\n color: 'inherit',\n borderRadius: 'inherit',\n fontFamily: tokens.fonts.rubik,\n fontSize: tokens.fontSizes[3],\n fontVariantNumeric: 'tabular-nums',\n});\n\nexport const itemText = style([\n itemContent,\n {\n flexGrow: 1,\n padding: tokens.space[1],\n },\n]);\n\nconst itemLayer = {\n borderRadius: 'inherit',\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n} as const;\n\nconst primaryTint = {\n backgroundColor: tokens.colors.primary,\n opacity: 0.05,\n};\n\nexport const itemButton = style([\n itemContent,\n {\n appearance: 'none',\n userSelect: 'none',\n boxSizing: 'border-box',\n border: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n // Transparent, not none: forced-colors mode drops the box-shadow ring but shows this outline.\n outline: '2px solid transparent',\n outlineOffset: '-2px',\n flexGrow: 1,\n width: '100%',\n padding: tokens.space[2],\n position: 'relative',\n\n selectors: {\n '&::before': itemLayer,\n '&::after': itemLayer,\n // No pointer-events: none, or clicks would fall through to the <li> and fire its onClick.\n '&:disabled': {\n opacity: 0.5,\n },\n '&:focus, &:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${tokens.colors.listItemFocusBorder}`,\n },\n '&:enabled:active::before': {\n backgroundColor: tokens.colors.listItemActiveBg,\n },\n '&:enabled:active::after': primaryTint,\n },\n\n '@media': {\n '(any-hover: hover)': {\n selectors: {\n '&:enabled:hover': {\n cursor: 'pointer',\n },\n '&:enabled:hover::before': {\n backgroundColor: tokens.colors.listItemHoverBg,\n },\n '&:enabled:hover::after': primaryTint,\n },\n },\n },\n },\n]);\n\nexport const controlsWrapper = style({\n position: 'absolute',\n top: 0,\n right: tokens.space[2],\n zIndex: 1,\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'visible',\n});\n"],"mappings":""}
@@ -0,0 +1,25 @@
1
+ /* empty css */
2
+ /* empty css */
3
+ import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
4
+ // components/List/List.vanilla.css.ts
5
+ var ul = "bq2jhf0";
6
+ var ol = "bq2jhf1";
7
+ var liRecipe = createRuntimeFn({
8
+ defaultClassName: "bq2jhf2",
9
+ variantClassNames: { elevation: {
10
+ "0": "bq2jhf3",
11
+ "1": "bq2jhf4",
12
+ "2": "bq2jhf5",
13
+ "3": "bq2jhf6",
14
+ "4": "bq2jhf7",
15
+ "5": "bq2jhf8"
16
+ } },
17
+ defaultVariants: { elevation: 0 },
18
+ compoundVariants: []
19
+ });
20
+ var itemText = "bq2jhfa bq2jhf9";
21
+ var itemButton = "bq2jhfb bq2jhf9";
22
+ var controlsWrapper = "bq2jhfc";
23
+ export { controlsWrapper, itemButton, itemText, liRecipe, ol, ul };
24
+
25
+ //# sourceMappingURL=List.vanilla.css.js.map