@traefik-labs/faency 13.1.1 → 13.3.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 (141) hide show
  1. package/dist/components/Accordion/Accordion.cjs +24 -18
  2. package/dist/components/Accordion/Accordion.cjs.map +1 -1
  3. package/dist/components/Accordion/Accordion.js +24 -18
  4. package/dist/components/Accordion/Accordion.js.map +1 -1
  5. package/dist/components/AriaTable/AriaTable.cjs +47 -9
  6. package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
  7. package/dist/components/AriaTable/AriaTable.js +48 -10
  8. package/dist/components/AriaTable/AriaTable.js.map +1 -1
  9. package/dist/components/Checkbox/Checkbox.cjs +15 -2
  10. package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
  11. package/dist/components/Checkbox/Checkbox.js +15 -2
  12. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  13. package/dist/components/Checkbox/Checkbox.themes.cjs +4 -2
  14. package/dist/components/Checkbox/Checkbox.themes.cjs.map +1 -1
  15. package/dist/components/Checkbox/Checkbox.themes.js +4 -2
  16. package/dist/components/Checkbox/Checkbox.themes.js.map +1 -1
  17. package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs +1 -1
  18. package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs.map +1 -1
  19. package/dist/components/DateTimePickerInput/DateTimePickerInput.js +1 -1
  20. package/dist/components/DateTimePickerInput/DateTimePickerInput.js.map +1 -1
  21. package/dist/components/Dialog/Dialog.cjs +4 -3
  22. package/dist/components/Dialog/Dialog.cjs.map +1 -1
  23. package/dist/components/Dialog/Dialog.js +4 -3
  24. package/dist/components/Dialog/Dialog.js.map +1 -1
  25. package/dist/components/Field/Field.cjs +91 -0
  26. package/dist/components/Field/Field.cjs.map +1 -0
  27. package/dist/components/Field/Field.js +89 -0
  28. package/dist/components/Field/Field.js.map +1 -0
  29. package/dist/components/Field/Field.vanilla.cjs +95 -0
  30. package/dist/components/Field/Field.vanilla.cjs.map +1 -0
  31. package/dist/components/Field/Field.vanilla.css.cjs +6 -0
  32. package/dist/components/Field/Field.vanilla.css.cjs.map +1 -0
  33. package/dist/components/Field/Field.vanilla.css.js +6 -0
  34. package/dist/components/Field/Field.vanilla.css.js.map +1 -0
  35. package/dist/components/Field/Field.vanilla.js +93 -0
  36. package/dist/components/Field/Field.vanilla.js.map +1 -0
  37. package/dist/components/Field/FieldContext.cjs +136 -0
  38. package/dist/components/Field/FieldContext.cjs.map +1 -0
  39. package/dist/components/Field/FieldContext.js +130 -0
  40. package/dist/components/Field/FieldContext.js.map +1 -0
  41. package/dist/components/Input/Input.cjs +31 -6
  42. package/dist/components/Input/Input.cjs.map +1 -1
  43. package/dist/components/Input/Input.js +31 -6
  44. package/dist/components/Input/Input.js.map +1 -1
  45. package/dist/components/Input/Input.vanilla.cjs +17 -4
  46. package/dist/components/Input/Input.vanilla.cjs.map +1 -1
  47. package/dist/components/Input/Input.vanilla.css.cjs.map +1 -1
  48. package/dist/components/Input/Input.vanilla.css.js.map +1 -1
  49. package/dist/components/Input/Input.vanilla.js +17 -4
  50. package/dist/components/Input/Input.vanilla.js.map +1 -1
  51. package/dist/components/Navigation/Navigation.cjs +4 -1
  52. package/dist/components/Navigation/Navigation.cjs.map +1 -1
  53. package/dist/components/Navigation/Navigation.js +4 -1
  54. package/dist/components/Navigation/Navigation.js.map +1 -1
  55. package/dist/components/Radio/Radio.cjs +21 -1
  56. package/dist/components/Radio/Radio.cjs.map +1 -1
  57. package/dist/components/Radio/Radio.js +21 -1
  58. package/dist/components/Radio/Radio.js.map +1 -1
  59. package/dist/components/Radio/Radio.themes.cjs +4 -2
  60. package/dist/components/Radio/Radio.themes.cjs.map +1 -1
  61. package/dist/components/Radio/Radio.themes.js +4 -2
  62. package/dist/components/Radio/Radio.themes.js.map +1 -1
  63. package/dist/components/RadioAccordion/RadioAccordion.cjs +10 -6
  64. package/dist/components/RadioAccordion/RadioAccordion.cjs.map +1 -1
  65. package/dist/components/RadioAccordion/RadioAccordion.js +10 -6
  66. package/dist/components/RadioAccordion/RadioAccordion.js.map +1 -1
  67. package/dist/components/RowLink/RowLink.cjs +95 -0
  68. package/dist/components/RowLink/RowLink.cjs.map +1 -0
  69. package/dist/components/RowLink/RowLink.js +90 -0
  70. package/dist/components/RowLink/RowLink.js.map +1 -0
  71. package/dist/components/Select/Select.cjs +33 -4
  72. package/dist/components/Select/Select.cjs.map +1 -1
  73. package/dist/components/Select/Select.js +33 -4
  74. package/dist/components/Select/Select.js.map +1 -1
  75. package/dist/components/SidePanel/SidePanel.cjs +3 -3
  76. package/dist/components/SidePanel/SidePanel.cjs.map +1 -1
  77. package/dist/components/SidePanel/SidePanel.js +3 -3
  78. package/dist/components/SidePanel/SidePanel.js.map +1 -1
  79. package/dist/components/Skeleton/Skeleton.cjs +4 -0
  80. package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
  81. package/dist/components/Skeleton/Skeleton.js +4 -0
  82. package/dist/components/Skeleton/Skeleton.js.map +1 -1
  83. package/dist/components/Skeleton/Skeleton.vanilla.css.cjs.map +1 -1
  84. package/dist/components/Skeleton/Skeleton.vanilla.css.js.map +1 -1
  85. package/dist/components/Switch/Switch.cjs +19 -5
  86. package/dist/components/Switch/Switch.cjs.map +1 -1
  87. package/dist/components/Switch/Switch.js +19 -5
  88. package/dist/components/Switch/Switch.js.map +1 -1
  89. package/dist/components/Switch/Switch.themes.cjs +4 -2
  90. package/dist/components/Switch/Switch.themes.cjs.map +1 -1
  91. package/dist/components/Switch/Switch.themes.js +4 -2
  92. package/dist/components/Switch/Switch.themes.js.map +1 -1
  93. package/dist/components/Table/ExpandButton.cjs +18 -0
  94. package/dist/components/Table/ExpandButton.cjs.map +1 -0
  95. package/dist/components/Table/ExpandButton.js +19 -0
  96. package/dist/components/Table/ExpandButton.js.map +1 -0
  97. package/dist/components/Table/Table.cjs +39 -13
  98. package/dist/components/Table/Table.cjs.map +1 -1
  99. package/dist/components/Table/Table.js +40 -14
  100. package/dist/components/Table/Table.js.map +1 -1
  101. package/dist/components/Text/Text.themes.cjs +2 -2
  102. package/dist/components/Text/Text.themes.cjs.map +1 -1
  103. package/dist/components/Text/Text.themes.js +2 -2
  104. package/dist/components/Text/Text.themes.js.map +1 -1
  105. package/dist/components/Text/Text.vanilla.cjs +36 -0
  106. package/dist/components/Text/Text.vanilla.cjs.map +1 -0
  107. package/dist/components/Text/Text.vanilla.css.cjs +55 -0
  108. package/dist/components/Text/Text.vanilla.css.cjs.map +1 -0
  109. package/dist/components/Text/Text.vanilla.css.js +56 -0
  110. package/dist/components/Text/Text.vanilla.css.js.map +1 -0
  111. package/dist/components/Text/Text.vanilla.js +36 -0
  112. package/dist/components/Text/Text.vanilla.js.map +1 -0
  113. package/dist/components/TextField/TextField.cjs +73 -77
  114. package/dist/components/TextField/TextField.cjs.map +1 -1
  115. package/dist/components/TextField/TextField.js +73 -77
  116. package/dist/components/TextField/TextField.js.map +1 -1
  117. package/dist/components/TextField/TextField.vanilla.cjs +70 -86
  118. package/dist/components/TextField/TextField.vanilla.cjs.map +1 -1
  119. package/dist/components/TextField/TextField.vanilla.css.cjs +10 -0
  120. package/dist/components/TextField/TextField.vanilla.css.cjs.map +1 -0
  121. package/dist/components/TextField/TextField.vanilla.css.js +8 -0
  122. package/dist/components/TextField/TextField.vanilla.css.js.map +1 -0
  123. package/dist/components/TextField/TextField.vanilla.js +71 -87
  124. package/dist/components/TextField/TextField.vanilla.js.map +1 -1
  125. package/dist/components/Textarea/Textarea.cjs +51 -41
  126. package/dist/components/Textarea/Textarea.cjs.map +1 -1
  127. package/dist/components/Textarea/Textarea.js +51 -41
  128. package/dist/components/Textarea/Textarea.js.map +1 -1
  129. package/dist/components/Textarea/Textarea.vanilla.cjs +49 -49
  130. package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
  131. package/dist/components/Textarea/Textarea.vanilla.css.cjs.map +1 -1
  132. package/dist/components/Textarea/Textarea.vanilla.css.js.map +1 -1
  133. package/dist/components/Textarea/Textarea.vanilla.js +49 -49
  134. package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
  135. package/dist/faency.css +176 -14
  136. package/dist/index.cjs +11 -1
  137. package/dist/index.d.ts +777 -3
  138. package/dist/index.js +6 -2
  139. package/dist/styles/themes.css.cjs.map +1 -1
  140. package/dist/styles/themes.css.js.map +1 -1
  141. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Navigation.js","names":[],"sources":["../../../components/Navigation/Navigation.tsx"],"sourcesContent":["import React, { ReactNode, useMemo } from 'react';\n\nimport { CSS, css, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\n\nconst FlexWithOpacity = styled(Flex, {\n opacity: 0.74,\n\n variants: {\n active: {\n true: {\n opacity: 1,\n },\n },\n },\n});\n\nconst baseNavItemCss = css({\n position: 'relative',\n display: 'flex',\n boxSizing: 'border-box',\n alignItems: 'center',\n backgroundColor: '$navButtonBg',\n color: '$navButtonText',\n border: 'none',\n minHeight: '$7',\n width: '100%',\n px: '$3',\n py: '$2',\n borderRadius: '$3',\n cursor: 'pointer',\n fontFamily: '$rubik',\n fontWeight: '$medium',\n outline: 'none',\n fontSize: '$3',\n mt: '$2',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n borderRadius: '$3',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n borderRadius: '$3',\n },\n\n [`&:focus > ${FlexWithOpacity}, &:hover > ${FlexWithOpacity}`]: {\n opacity: 1,\n },\n\n '&:focus': {\n color: '$navButtonFocusText',\n boxShadow: 'inset 0 0 0 2px $colors$navButtonFocusBorder',\n\n '&::before': {\n backgroundColor: '$navButtonFocusBg',\n },\n '&::after': {\n backgroundColor: '$navButtonFocusBg2',\n opacity: 0.05,\n },\n },\n\n '@hover': {\n '&:hover': {\n color: '$navButtonHoverText',\n\n '&::before': {\n backgroundColor: '$navButtonHoverBg',\n },\n '&::after': {\n backgroundColor: '$navButtonHoverBg2',\n opacity: 0.05,\n },\n },\n },\n\n '&:first-child': {\n mt: 0,\n },\n\n variants: {\n active: {\n true: {\n color: '$navButtonActiveText',\n\n '&::before': {\n backgroundColor: '$navButtonActiveBg',\n },\n '&::after': {\n backgroundColor: '$navButtonActiveBg2',\n opacity: 0.05,\n },\n\n '@hover': {\n '&:hover': {\n color: '$navButtonActiveText',\n },\n },\n\n '&:focus': {\n color: '$navButtonActiveText',\n },\n },\n },\n },\n defaultVariants: {\n active: false,\n },\n});\n\nexport const NavigationContainer = styled('div', {\n display: 'flex',\n boxSizing: 'border-box',\n flexDirection: 'column',\n});\n\nexport type NavigationContainerVariants = VariantProps<typeof NavigationContainer>;\nexport type NavigationContainerProps = NavigationContainerVariants & NonNullable<unknown>;\n\nexport const NavigationDrawer = styled('nav', {\n display: 'flex',\n boxSizing: 'border-box',\n padding: '$3',\n maxWidth: '240px',\n flexDirection: 'column',\n variants: {\n elevation: elevationVariants,\n fullWidth: {\n true: {\n px: 0,\n '> *, > div > *,': {\n borderRadius: 0,\n\n '&::before': {\n borderRadius: 0,\n },\n\n '&::after': {\n borderRadius: 0,\n },\n\n '&:focus': {\n border: 'none',\n boxShadow: 'none',\n },\n },\n },\n },\n },\n defaultVariants: {\n elevation: 1,\n fullWidth: false,\n },\n});\n\nexport type NavigationDrawerVariants = VariantProps<typeof NavigationDrawer>;\nexport type NavigationDrawerProps = NavigationDrawerVariants & NonNullable<unknown>;\n\nconst StyledLink = styled('a', baseNavItemCss, {\n textDecoration: 'none',\n});\n\ntype StyledLinkProps = VariantProps<typeof StyledLink> & React.ComponentProps<typeof StyledLink>;\n\nconst StyledButton = styled('button', baseNavItemCss);\n\ntype StyledButtonProps = VariantProps<typeof StyledButton> &\n React.ComponentProps<typeof StyledButton>;\ninterface NavigationItemBaseProps {\n css?: CSS;\n startAdornment?: ReactNode;\n endAdornment?: ReactNode;\n children?: ReactNode;\n active?: boolean;\n}\n\ntype NavigationItemButtonProps = NavigationItemBaseProps &\n StyledButtonProps & {\n as?: 'button';\n };\ntype NavigationItemLinkProps = NavigationItemBaseProps &\n StyledLinkProps &\n React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n as: 'a';\n };\n\nexport type NavigationItemProps = NavigationItemButtonProps | NavigationItemLinkProps;\n\nconst NavigationItemWrapper = (props: NavigationItemProps): JSX.Element =>\n props.as === 'a' ? <StyledLink {...props} /> : <StyledButton type=\"button\" {...props} />;\n\nexport const NavigationItem = ({\n startAdornment,\n endAdornment,\n children,\n ...restProps\n}: NavigationItemProps): JSX.Element => {\n const hasStartAdornment = useMemo(() => Boolean(startAdornment), [startAdornment]);\n const hasEndAdornment = useMemo(() => Boolean(endAdornment), [endAdornment]);\n\n return (\n <NavigationItemWrapper {...restProps}>\n {hasStartAdornment && (\n <FlexWithOpacity css={{ pr: '$2', ml: '-$1' }} active={restProps.active}>\n {startAdornment}\n </FlexWithOpacity>\n )}\n <FlexWithOpacity css={{ flexGrow: 1 }} active={restProps.active}>\n {children}\n </FlexWithOpacity>\n {hasEndAdornment && <Flex css={{ pl: '$2', mr: '-$1' }}>{endAdornment}</Flex>}\n </NavigationItemWrapper>\n );\n};\n\nexport type NavigationItemVariants = VariantProps<typeof NavigationItem>;\n\nexport const NavigationLink = (props: Omit<NavigationItemLinkProps, 'as'>) => (\n <NavigationItem as=\"a\" {...props} />\n);\n\nexport type NavigationLinkVariants = VariantProps<typeof NavigationLink>;\n\nexport type NavigationLinkProps = NavigationLinkVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;AAMA,IAAM,kBAAkB,OAAO,MAAM;CACnC,SAAS;CAET,UAAU,EACR,QAAQ,EACN,MAAM,EACJ,SAAS,EACX,EACF,EACF;AACF,CAAC;AAED,IAAM,iBAAiB,IAAI;CACzB,UAAU;CACV,SAAS;CACT,WAAW;CACX,YAAY;CACZ,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AChB;IAEA,WAAW;KACT,QAAQ;KACR,WAAW;IACb;GACF;EACF,EACF;CACF;CACA,iBAAiB;EACf,WAAW;EACX,WAAW;CACb;AACF,CAAC;AAKD,IAAM,aAAa,OAAO,KAAK,gBAAgB,EAC7C,gBAAgB,OAClB,CAAC;AAID,IAAM,eAAe,OAAO,UAAU,cAAc;AAwBpD,IAAM,yBAAyB,UAC7B,MAAM,OAAO,MAAM,oBAAC,YAAD,EAAY,GAAI,MAAQ,CAAA,IAAI,oBAAC,cAAD;CAAc,MAAK;CAAS,GAAI;AAAQ,CAAA;AAEzF,IAAa,kBAAkB,EAC7B,gBACA,cACA,UACA,GAAG,gBACmC;CACtC,MAAM,oBAAoB,cAAc,QAAQ,cAAc,GAAG,CAAC,cAAc,CAAC;CACjF,MAAM,kBAAkB,cAAc,QAAQ,YAAY,GAAG,CAAC,YAAY,CAAC;CAE3E,OACE,qBAAC,uBAAD;EAAuB,GAAI;EAA3B,UAAA;GACG,qBACC,oBAAC,iBAAD;IAAiB,KAAK;KAAE,IAAI;KAAM,IAAI;IAAM;IAAG,QAAQ,UAAU;IAC9D,UAAA;GACc,CAAA;GAEnB,oBAAC,iBAAD;IAAiB,KAAK,EAAE,UAAU,EAAE;IAAG,QAAQ,UAAU;IACtD;GACc,CAAA;GAChB,mBAAmB,oBAAC,MAAD;IAAM,KAAK;KAAE,IAAI;KAAM,IAAI;IAAM;IAAI,UAAA;GAAmB,CAAA;EACvD;;AAE3B;AAIA,IAAa,kBAAkB,UAC7B,oBAAC,gBAAD;CAAgB,IAAG;CAAI,GAAI;AAAQ,CAAA"}
1
+ {"version":3,"file":"Navigation.js","names":[],"sources":["../../../components/Navigation/Navigation.tsx"],"sourcesContent":["import React, { ReactNode, useMemo } from 'react';\n\nimport { CSS, css, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\n\nconst FlexWithOpacity = styled(Flex, {\n opacity: 0.74,\n\n variants: {\n active: {\n true: {\n opacity: 1,\n },\n },\n },\n});\n\nconst baseNavItemCss = css({\n position: 'relative',\n display: 'flex',\n boxSizing: 'border-box',\n alignItems: 'center',\n backgroundColor: '$navButtonBg',\n color: '$navButtonText',\n border: 'none',\n minHeight: '$7',\n width: '100%',\n px: '$3',\n py: '$2',\n borderRadius: '$3',\n cursor: 'pointer',\n fontFamily: '$rubik',\n fontWeight: '$medium',\n outline: 'none',\n fontSize: '$3',\n mt: '$2',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n borderRadius: '$3',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n borderRadius: '$3',\n },\n\n [`&:focus > ${FlexWithOpacity}, &:hover > ${FlexWithOpacity}`]: {\n opacity: 1,\n },\n\n '&:focus': {\n color: '$navButtonFocusText',\n boxShadow: 'inset 0 0 0 2px $colors$navButtonFocusBorder',\n\n '&::before': {\n backgroundColor: '$navButtonFocusBg',\n },\n '&::after': {\n backgroundColor: '$navButtonFocusBg2',\n opacity: 0.05,\n },\n },\n\n '@hover': {\n '&:hover': {\n color: '$navButtonHoverText',\n\n '&::before': {\n backgroundColor: '$navButtonHoverBg',\n },\n '&::after': {\n backgroundColor: '$navButtonHoverBg2',\n opacity: 0.05,\n },\n },\n },\n\n '&:first-child': {\n mt: 0,\n },\n\n variants: {\n active: {\n true: {\n color: '$navButtonActiveText',\n\n '&::before': {\n backgroundColor: '$navButtonActiveBg',\n },\n '&::after': {\n backgroundColor: '$navButtonActiveBg2',\n opacity: 0.05,\n },\n\n '@hover': {\n '&:hover': {\n color: '$navButtonActiveText',\n },\n },\n\n '&:focus': {\n color: '$navButtonActiveText',\n },\n },\n },\n },\n defaultVariants: {\n active: false,\n },\n});\n\nexport const NavigationContainer = styled('div', {\n display: 'flex',\n boxSizing: 'border-box',\n flexDirection: 'column',\n});\n\nexport type NavigationContainerVariants = VariantProps<typeof NavigationContainer>;\nexport type NavigationContainerProps = NavigationContainerVariants & NonNullable<unknown>;\n\nexport const NavigationDrawer = styled('nav', {\n display: 'flex',\n boxSizing: 'border-box',\n padding: '$3',\n maxWidth: '240px',\n flexDirection: 'column',\n variants: {\n elevation: elevationVariants,\n fullWidth: {\n true: {\n px: 0,\n '> *, > div > *,': {\n borderRadius: 0,\n\n '&::before': {\n borderRadius: 0,\n },\n\n '&::after': {\n borderRadius: 0,\n },\n\n '&:focus': {\n border: 'none',\n boxShadow: 'none',\n },\n },\n },\n },\n },\n defaultVariants: {\n elevation: 1,\n fullWidth: false,\n },\n});\n\nexport type NavigationDrawerVariants = VariantProps<typeof NavigationDrawer>;\nexport type NavigationDrawerProps = NavigationDrawerVariants & NonNullable<unknown>;\n\nconst StyledLink = styled('a', baseNavItemCss, {\n textDecoration: 'none',\n});\n\ntype StyledLinkProps = VariantProps<typeof StyledLink> & React.ComponentProps<typeof StyledLink>;\n\nconst StyledButton = styled('button', baseNavItemCss);\n\ntype StyledButtonProps = VariantProps<typeof StyledButton> &\n React.ComponentProps<typeof StyledButton>;\ninterface NavigationItemBaseProps {\n css?: CSS;\n startAdornment?: ReactNode;\n endAdornment?: ReactNode;\n children?: ReactNode;\n active?: boolean;\n}\n\ntype NavigationItemButtonProps = NavigationItemBaseProps &\n StyledButtonProps & {\n as?: 'button';\n };\ntype NavigationItemLinkProps = NavigationItemBaseProps &\n StyledLinkProps &\n React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n as: 'a';\n };\n\nexport type NavigationItemProps = NavigationItemButtonProps | NavigationItemLinkProps;\n\nconst NavigationItemWrapper = (props: NavigationItemProps): JSX.Element =>\n props.as === 'a' ? (\n <StyledLink aria-current={props.active ? 'page' : undefined} {...props} />\n ) : (\n <StyledButton type=\"button\" {...props} />\n );\n\nexport const NavigationItem = ({\n startAdornment,\n endAdornment,\n children,\n ...restProps\n}: NavigationItemProps): JSX.Element => {\n const hasStartAdornment = useMemo(() => Boolean(startAdornment), [startAdornment]);\n const hasEndAdornment = useMemo(() => Boolean(endAdornment), [endAdornment]);\n\n return (\n <NavigationItemWrapper {...restProps}>\n {hasStartAdornment && (\n <FlexWithOpacity css={{ pr: '$2', ml: '-$1' }} active={restProps.active}>\n {startAdornment}\n </FlexWithOpacity>\n )}\n <FlexWithOpacity css={{ flexGrow: 1 }} active={restProps.active}>\n {children}\n </FlexWithOpacity>\n {hasEndAdornment && <Flex css={{ pl: '$2', mr: '-$1' }}>{endAdornment}</Flex>}\n </NavigationItemWrapper>\n );\n};\n\nexport type NavigationItemVariants = VariantProps<typeof NavigationItem>;\n\nexport const NavigationLink = (props: Omit<NavigationItemLinkProps, 'as'>) => (\n <NavigationItem as=\"a\" {...props} />\n);\n\nexport type NavigationLinkVariants = VariantProps<typeof NavigationLink>;\n\nexport type NavigationLinkProps = NavigationLinkVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;AAMA,IAAM,kBAAkB,OAAO,MAAM;CACnC,SAAS;CAET,UAAU,EACR,QAAQ,EACN,MAAM,EACJ,SAAS,EACX,EACF,EACF;AACF,CAAC;AAED,IAAM,iBAAiB,IAAI;CACzB,UAAU;CACV,SAAS;CACT,WAAW;CACX,YAAY;CACZ,iBAAiB;CACjB,OAAO;CACP,QAAQ;CACR,WAAW;CACX,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,cAAc;CACd,QAAQ;CACR,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,UAAU;CACV,IAAI;CAEJ,aAAa;EACX,WAAW;EACX,SAAS;EACT,UAAU;EACV,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;EACN,cAAc;CAChB;CACA,YAAY;EACV,WAAW;EACX,SAAS;EACT,UAAU;EACV,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;EACN,cAAc;CAChB;EAEC,aAAa,gBAAgB,cAAc,oBAAoB,EAC9D,SAAS,EACX;CAEA,WAAW;EACT,OAAO;EACP,WAA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CACtC,MAAM,oBAAoB,cAAc,QAAQ,cAAc,GAAG,CAAC,cAAc,CAAC;CACjF,MAAM,kBAAkB,cAAc,QAAQ,YAAY,GAAG,CAAC,YAAY,CAAC;CAE3E,OACE,qBAAC,uBAAD;EAAuB,GAAI;EAA3B,UAAA;GACG,qBACC,oBAAC,iBAAD;IAAiB,KAAK;KAAE,IAAI;KAAM,IAAI;IAAM;IAAG,QAAQ,UAAU;IAC9D,UAAA;GACc,CAAA;GAEnB,oBAAC,iBAAD;IAAiB,KAAK,EAAE,UAAU,EAAE;IAAG,QAAQ,UAAU;IACtD;GACc,CAAA;GAChB,mBAAmB,oBAAC,MAAD;IAAM,KAAK;KAAE,IAAI;KAAM,IAAI;IAAM;IAAI,UAAA;GAAmB,CAAA;EACvD;;AAE3B;AAIA,IAAa,kBAAkB,UAC7B,oBAAC,gBAAD;CAAgB,IAAG;CAAI,GAAI;AAAQ,CAAA"}
@@ -1,12 +1,31 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
+ const require_FieldContext = require("../Field/FieldContext.cjs");
3
4
  let react = require("react");
4
5
  react = require_runtime.__toESM(react, 1);
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  let _radix_ui_react_radio_group = require("@radix-ui/react-radio-group");
7
8
  _radix_ui_react_radio_group = require_runtime.__toESM(_radix_ui_react_radio_group, 1);
8
9
  // components/Radio/Radio.tsx
9
- var RadioGroup = require_stitches_config.styled(_radix_ui_react_radio_group.Root, { display: "flex" });
10
+ var RadioGroupRoot = react.default.forwardRef(({ id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-labelledby": ariaLabelledBy, ...props }, forwardedRef) => {
11
+ const control = require_FieldContext.useFieldControl({
12
+ id,
13
+ disabled,
14
+ "aria-describedby": ariaDescribedBy,
15
+ "aria-invalid": ariaInvalid,
16
+ labelable: false
17
+ });
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_radio_group.Root, {
19
+ ...props,
20
+ id: control.id,
21
+ disabled: control.disabled,
22
+ "aria-labelledby": ariaLabelledBy ?? control.labelId,
23
+ "aria-describedby": control["aria-describedby"],
24
+ "aria-invalid": control["aria-invalid"],
25
+ ref: forwardedRef
26
+ });
27
+ });
28
+ var RadioGroup = require_stitches_config.styled(RadioGroupRoot, { display: "flex" });
10
29
  var INDICATOR_BASE_STYLES = {
11
30
  alignItems: "center",
12
31
  display: "flex",
@@ -47,6 +66,7 @@ var RADIO_BASE_STYLES = {
47
66
  "&[data-state=checked]": { backgroundColor: "$radioIndicator" }
48
67
  };
49
68
  var StyledRadio = require_stitches_config.styled(_radix_ui_react_radio_group.Item, RADIO_BASE_STYLES, {
69
+ "[role=\"radiogroup\"][aria-invalid=\"true\"] &:not(:focus-visible)": { boxShadow: "inset 0 0 0 1px $colors$radioInvalidBorder" },
50
70
  "@hover": { "&:hover": {
51
71
  cursor: "pointer",
52
72
  boxShadow: "inset 0 0 0 1px $colors$radioHoverBorder"
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.cjs","names":["styled","RadioGroupPrimitive","React"],"sources":["../../../components/Radio/Radio.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\n\nexport const RadioGroup = styled(RadioGroupPrimitive.Root, {\n display: 'flex',\n});\n\nexport const INDICATOR_BASE_STYLES = {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n position: 'relative',\n '&::after': {\n content: '\"\"',\n display: 'block',\n width: '7px',\n height: '7px',\n borderRadius: '$round',\n backgroundColor: '$contentBg',\n },\n};\n\nconst StyledIndicator = styled(RadioGroupPrimitive.Indicator, INDICATOR_BASE_STYLES);\n\nexport const RADIO_BASE_STYLES = {\n all: 'unset',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n alignItems: 'center',\n appearance: 'none',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n padding: '0',\n textDecoration: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n borderRadius: '50%',\n color: '$hiContrast',\n boxShadow: 'inset 0 0 0 1px $colors$radioBorder',\n overflow: 'hidden',\n '&[data-state=checked]': {\n backgroundColor: '$radioIndicator',\n },\n};\nconst StyledRadio = styled(RadioGroupPrimitive.Item, RADIO_BASE_STYLES, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n boxShadow: 'inset 0 0 0 1px $colors$radioHoverBorder',\n },\n },\n '&:focus-visible': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$radioFocusBorder, 0 0 0 1px $colors$radioFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n '&::placeholder': {\n color: '$radioDisabledText',\n },\n '&[data-state=checked]': {\n backgroundColor: '$radioIndicatorDisabledBg',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$radioDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n '1': {\n width: '$3',\n height: '$3',\n },\n '2': {\n width: '$5',\n height: '$5',\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n width: '$3',\n height: '$3',\n },\n },\n },\n },\n },\n defaultVariants: {\n size: '1',\n },\n});\n\nexport type RadioVariants = VariantProps<typeof StyledRadio>;\ntype RadioGroupItemPrimitiveProps = Omit<\n React.ComponentProps<typeof RadioGroupPrimitive.Item>,\n 'as'\n>;\nexport type RadioProps = RadioGroupItemPrimitiveProps & RadioVariants & { css?: CSS };\n\nexport const Radio = React.forwardRef<React.ElementRef<typeof StyledRadio>, RadioProps>(\n (props, forwardedRef) => (\n <StyledRadio {...props} ref={forwardedRef}>\n <StyledIndicator />\n </StyledRadio>\n )\n);\n"],"mappings":";;;;;;;;A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C,aAAD;CAAa,GAAI;CAAO,KAAK;CAC3B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,CAAkB,CAAA;AACP,CAAA,CAEjB"}
1
+ {"version":3,"file":"Radio.cjs","names":["React","useFieldControl","RadioGroupPrimitive","styled"],"sources":["../../../components/Radio/Radio.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { useFieldControl } from '../Field/FieldContext';\n\nconst RadioGroupRoot = React.forwardRef<HTMLDivElement, RadioGroupPrimitive.RadioGroupProps>(\n (\n {\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n forwardedRef,\n ) => {\n const control = useFieldControl({\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n labelable: false,\n });\n\n return (\n <RadioGroupPrimitive.Root\n {...props}\n id={control.id}\n disabled={control.disabled}\n aria-labelledby={ariaLabelledBy ?? control.labelId}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n ref={forwardedRef}\n />\n );\n },\n);\n\nexport const RadioGroup = styled(RadioGroupRoot, {\n display: 'flex',\n});\n\nexport const INDICATOR_BASE_STYLES = {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n position: 'relative',\n '&::after': {\n content: '\"\"',\n display: 'block',\n width: '7px',\n height: '7px',\n borderRadius: '$round',\n backgroundColor: '$contentBg',\n },\n};\n\nconst StyledIndicator = styled(RadioGroupPrimitive.Indicator, INDICATOR_BASE_STYLES);\n\nexport const RADIO_BASE_STYLES = {\n all: 'unset',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n alignItems: 'center',\n appearance: 'none',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n padding: '0',\n textDecoration: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n borderRadius: '50%',\n color: '$hiContrast',\n boxShadow: 'inset 0 0 0 1px $colors$radioBorder',\n overflow: 'hidden',\n '&[data-state=checked]': {\n backgroundColor: '$radioIndicator',\n },\n};\nconst StyledRadio = styled(RadioGroupPrimitive.Item, RADIO_BASE_STYLES, {\n '[role=\"radiogroup\"][aria-invalid=\"true\"] &:not(:focus-visible)': {\n boxShadow: 'inset 0 0 0 1px $colors$radioInvalidBorder',\n },\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n boxShadow: 'inset 0 0 0 1px $colors$radioHoverBorder',\n },\n },\n '&:focus-visible': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$radioFocusBorder, 0 0 0 1px $colors$radioFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n '&::placeholder': {\n color: '$radioDisabledText',\n },\n '&[data-state=checked]': {\n backgroundColor: '$radioIndicatorDisabledBg',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$radioDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n '1': {\n width: '$3',\n height: '$3',\n },\n '2': {\n width: '$5',\n height: '$5',\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n width: '$3',\n height: '$3',\n },\n },\n },\n },\n },\n defaultVariants: {\n size: '1',\n },\n});\n\nexport type RadioVariants = VariantProps<typeof StyledRadio>;\ntype RadioGroupItemPrimitiveProps = Omit<\n React.ComponentProps<typeof RadioGroupPrimitive.Item>,\n 'as'\n>;\nexport type RadioProps = RadioGroupItemPrimitiveProps & RadioVariants & { css?: CSS };\n\nexport const Radio = React.forwardRef<React.ElementRef<typeof StyledRadio>, RadioProps>(\n (props, forwardedRef) => (\n <StyledRadio {...props} ref={forwardedRef}>\n <StyledIndicator />\n </StyledRadio>\n ),\n);\n"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;EACjB,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,kBAAkB,EAChB,OAAO,qBACT;EACA,yBAAyB,EACvB,iBAAiB,4BACnB;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,mBACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,KAAK;GACH,OAAO;GACP,QAAQ;EACV;EACA,KAAK;GACH,OAAO;GACP,QAAQ;IAEP,KAAK,oBAAoB,EACxB,YAAY;IACV,OAAO;IACP,QAAQ;GACV,EACF;EACF;CACF,EACF;CACA,iBAAiB,EACf,MAAM,IACR;AACF,CAAC;AASD,IAAa,QAAQF,MAAAA,QAAM,YACxB,OAAO,iBACN,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;CAAa,GAAI;CAAO,KAAK;CAC3B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,CAAkB,CAAA;AACP,CAAA,CAEjB"}
@@ -1,9 +1,28 @@
1
1
  import { styled } from "../../stitches.config.js";
2
+ import { useFieldControl } from "../Field/FieldContext.js";
2
3
  import React from "react";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
5
6
  // components/Radio/Radio.tsx
6
- var RadioGroup = styled(RadioGroupPrimitive.Root, { display: "flex" });
7
+ var RadioGroupRoot = React.forwardRef(({ id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-labelledby": ariaLabelledBy, ...props }, forwardedRef) => {
8
+ const control = useFieldControl({
9
+ id,
10
+ disabled,
11
+ "aria-describedby": ariaDescribedBy,
12
+ "aria-invalid": ariaInvalid,
13
+ labelable: false
14
+ });
15
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, {
16
+ ...props,
17
+ id: control.id,
18
+ disabled: control.disabled,
19
+ "aria-labelledby": ariaLabelledBy ?? control.labelId,
20
+ "aria-describedby": control["aria-describedby"],
21
+ "aria-invalid": control["aria-invalid"],
22
+ ref: forwardedRef
23
+ });
24
+ });
25
+ var RadioGroup = styled(RadioGroupRoot, { display: "flex" });
7
26
  var INDICATOR_BASE_STYLES = {
8
27
  alignItems: "center",
9
28
  display: "flex",
@@ -44,6 +63,7 @@ var RADIO_BASE_STYLES = {
44
63
  "&[data-state=checked]": { backgroundColor: "$radioIndicator" }
45
64
  };
46
65
  var StyledRadio = styled(RadioGroupPrimitive.Item, RADIO_BASE_STYLES, {
66
+ "[role=\"radiogroup\"][aria-invalid=\"true\"] &:not(:focus-visible)": { boxShadow: "inset 0 0 0 1px $colors$radioInvalidBorder" },
47
67
  "@hover": { "&:hover": {
48
68
  cursor: "pointer",
49
69
  boxShadow: "inset 0 0 0 1px $colors$radioHoverBorder"
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","names":[],"sources":["../../../components/Radio/Radio.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\n\nexport const RadioGroup = styled(RadioGroupPrimitive.Root, {\n display: 'flex',\n});\n\nexport const INDICATOR_BASE_STYLES = {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n position: 'relative',\n '&::after': {\n content: '\"\"',\n display: 'block',\n width: '7px',\n height: '7px',\n borderRadius: '$round',\n backgroundColor: '$contentBg',\n },\n};\n\nconst StyledIndicator = styled(RadioGroupPrimitive.Indicator, INDICATOR_BASE_STYLES);\n\nexport const RADIO_BASE_STYLES = {\n all: 'unset',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n alignItems: 'center',\n appearance: 'none',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n padding: '0',\n textDecoration: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n borderRadius: '50%',\n color: '$hiContrast',\n boxShadow: 'inset 0 0 0 1px $colors$radioBorder',\n overflow: 'hidden',\n '&[data-state=checked]': {\n backgroundColor: '$radioIndicator',\n },\n};\nconst StyledRadio = styled(RadioGroupPrimitive.Item, RADIO_BASE_STYLES, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n boxShadow: 'inset 0 0 0 1px $colors$radioHoverBorder',\n },\n },\n '&:focus-visible': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$radioFocusBorder, 0 0 0 1px $colors$radioFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n '&::placeholder': {\n color: '$radioDisabledText',\n },\n '&[data-state=checked]': {\n backgroundColor: '$radioIndicatorDisabledBg',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$radioDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n '1': {\n width: '$3',\n height: '$3',\n },\n '2': {\n width: '$5',\n height: '$5',\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n width: '$3',\n height: '$3',\n },\n },\n },\n },\n },\n defaultVariants: {\n size: '1',\n },\n});\n\nexport type RadioVariants = VariantProps<typeof StyledRadio>;\ntype RadioGroupItemPrimitiveProps = Omit<\n React.ComponentProps<typeof RadioGroupPrimitive.Item>,\n 'as'\n>;\nexport type RadioProps = RadioGroupItemPrimitiveProps & RadioVariants & { css?: CSS };\n\nexport const Radio = React.forwardRef<React.ElementRef<typeof StyledRadio>, RadioProps>(\n (props, forwardedRef) => (\n <StyledRadio {...props} ref={forwardedRef}>\n <StyledIndicator />\n </StyledRadio>\n )\n);\n"],"mappings":";;;;;AAKA,IAAa,aAAa,OAAO,oBAAoB,MAAM,EACzD,SAAS,OACX,CAAC;AAED,IAAa,wBAAwB;CACnC,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;CACP,UAAU;CACV,YAAY;EACV,SAAS;EACT,SAAS;EACT,OAAO;EACP,QAAQ;EACR,cAAc;EACd,iBAAiB;CACnB;AACF;AAEA,IAAM,kBAAkB,OAAO,oBAAoB,WAAW,qBAAqB;AAEnF,IAAa,oBAAoB;CAC/B,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CACA,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,SAAS;CACT,gBAAgB;CAChB,yBAAyB;CAEzB,cAAc;CACd,OAAO;CACP,WAAW;CACX,UAAU;CACV,yBAAyB,EACvB,iBAAiB,kBACnB;AACF;AACA,IAAM,cAAc,OAAO,oBAAoB,MAAM,mBAAmB;CACtE,UAAU,EACR,WAAW;EACT,QAAQ;EACR,WAAW;CACb,EACF;CACA,mBAAmB;EACjB,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,kBAAkB,EAChB,OAAO,qBACT;EACA,yBAAyB,EACvB,iBAAiB,4BACnB;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,mBACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,KAAK;GACH,OAAO;GACP,QAAQ;EACV;EACA,KAAK;GACH,OAAO;GACP,QAAQ;IAEP,KAAK,oBAAoB,EACxB,YAAY;IACV,OAAO;IACP,QAAQ;GACV,EACF;EACF;CACF,EACF;CACA,iBAAiB,EACf,MAAM,IACR;AACF,CAAC;AASD,IAAa,QAAQ,MAAM,YACxB,OAAO,iBACN,oBAAC,aAAD;CAAa,GAAI;CAAO,KAAK;CAC3B,UAAA,oBAAC,iBAAD,CAAkB,CAAA;AACP,CAAA,CAEjB"}
1
+ {"version":3,"file":"Radio.js","names":[],"sources":["../../../components/Radio/Radio.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { useFieldControl } from '../Field/FieldContext';\n\nconst RadioGroupRoot = React.forwardRef<HTMLDivElement, RadioGroupPrimitive.RadioGroupProps>(\n (\n {\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n forwardedRef,\n ) => {\n const control = useFieldControl({\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n labelable: false,\n });\n\n return (\n <RadioGroupPrimitive.Root\n {...props}\n id={control.id}\n disabled={control.disabled}\n aria-labelledby={ariaLabelledBy ?? control.labelId}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n ref={forwardedRef}\n />\n );\n },\n);\n\nexport const RadioGroup = styled(RadioGroupRoot, {\n display: 'flex',\n});\n\nexport const INDICATOR_BASE_STYLES = {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n position: 'relative',\n '&::after': {\n content: '\"\"',\n display: 'block',\n width: '7px',\n height: '7px',\n borderRadius: '$round',\n backgroundColor: '$contentBg',\n },\n};\n\nconst StyledIndicator = styled(RadioGroupPrimitive.Indicator, INDICATOR_BASE_STYLES);\n\nexport const RADIO_BASE_STYLES = {\n all: 'unset',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n alignItems: 'center',\n appearance: 'none',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n padding: '0',\n textDecoration: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n borderRadius: '50%',\n color: '$hiContrast',\n boxShadow: 'inset 0 0 0 1px $colors$radioBorder',\n overflow: 'hidden',\n '&[data-state=checked]': {\n backgroundColor: '$radioIndicator',\n },\n};\nconst StyledRadio = styled(RadioGroupPrimitive.Item, RADIO_BASE_STYLES, {\n '[role=\"radiogroup\"][aria-invalid=\"true\"] &:not(:focus-visible)': {\n boxShadow: 'inset 0 0 0 1px $colors$radioInvalidBorder',\n },\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n boxShadow: 'inset 0 0 0 1px $colors$radioHoverBorder',\n },\n },\n '&:focus-visible': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$radioFocusBorder, 0 0 0 1px $colors$radioFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n '&::placeholder': {\n color: '$radioDisabledText',\n },\n '&[data-state=checked]': {\n backgroundColor: '$radioIndicatorDisabledBg',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$radioDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n '1': {\n width: '$3',\n height: '$3',\n },\n '2': {\n width: '$5',\n height: '$5',\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n width: '$3',\n height: '$3',\n },\n },\n },\n },\n },\n defaultVariants: {\n size: '1',\n },\n});\n\nexport type RadioVariants = VariantProps<typeof StyledRadio>;\ntype RadioGroupItemPrimitiveProps = Omit<\n React.ComponentProps<typeof RadioGroupPrimitive.Item>,\n 'as'\n>;\nexport type RadioProps = RadioGroupItemPrimitiveProps & RadioVariants & { css?: CSS };\n\nexport const Radio = React.forwardRef<React.ElementRef<typeof StyledRadio>, RadioProps>(\n (props, forwardedRef) => (\n <StyledRadio {...props} ref={forwardedRef}>\n <StyledIndicator />\n </StyledRadio>\n ),\n);\n"],"mappings":";;;;;;AAMA,IAAM,iBAAiB,MAAM,YAEzB,EACE,IACA,UACA,oBAAoB,iBACpB,gBAAgB,aAChB,mBAAmB,gBACnB,GAAG,SAEL,iBACG;CACH,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA,oBAAoB;EACpB,gBAAgB;EAChB,WAAW;CACb,CAAC;CAED,OACE,oBAAC,oBAAoB,MAArB;EACE,GAAI;EACJ,IAAI,QAAQ;EACZ,UAAU,QAAQ;EAClB,mBAAiB,kBAAkB,QAAQ;EAC3C,oBAAkB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AM,YACxB,OAAO,iBACN,oBAAC,aAAD;CAAa,GAAI;CAAO,KAAK;CAC3B,UAAA,oBAAC,iBAAD,CAAkB,CAAA;AACP,CAAA,CAEjB"}
@@ -12,7 +12,8 @@ var Theme;
12
12
  radioFocusBorder: "$primary",
13
13
  radioDisabledBg: "$deepBlue3",
14
14
  radioDisabledBorder: "$deepBlue5",
15
- radioIndicatorDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString()
15
+ radioIndicatorDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString(),
16
+ radioInvalidBorder: "$red9"
16
17
  });
17
18
  _Theme.getDark = (primaryColor) => ({
18
19
  radioIndicator: "$primary",
@@ -22,7 +23,8 @@ var Theme;
22
23
  radioFocusBorder: "$primary",
23
24
  radioDisabledBg: "$deepBlue3",
24
25
  radioDisabledBorder: "$deepBlue4",
25
- radioIndicatorDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString()
26
+ radioIndicatorDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString(),
27
+ radioInvalidBorder: "$red9"
26
28
  });
27
29
  })(Theme || (Theme = {}));
28
30
  Object.defineProperty(exports, "Theme", {
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.themes.cjs","names":["tinycolor"],"sources":["../../../components/Radio/Radio.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\nexport namespace Theme {\n type Colors = {\n radioBorder: Property.Color;\n radioHoverBg: Property.Color;\n radioHoverBorder: Property.Color;\n radioFocusBorder: Property.Color;\n radioDisabledBg: Property.Color;\n radioDisabledBorder: Property.Color;\n radioIndicatorDisabledBg: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n radioIndicator: '$primary',\n radioBorder: '$grayBlue9',\n radioHoverBg: 'transparent',\n radioHoverBorder: '$primary',\n radioFocusBorder: '$primary',\n radioDisabledBg: '$deepBlue3',\n radioDisabledBorder: '$deepBlue5',\n radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n });\n\n export const getDark: Factory = (primaryColor) => ({\n radioIndicator: '$primary',\n radioBorder: '$grayBlue9',\n radioHoverBg: '$deepBlue3',\n radioHoverBorder: '$primary',\n radioFocusBorder: '$primary',\n radioDisabledBg: '$deepBlue3',\n radioDisabledBorder: '$deepBlue4',\n radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n });\n}\n"],"mappings":";;;;AAIO,IAAU;CAAV,SAAA,QAAA;CAaQ,OAAA,YAAqB,kBAAkB;EAClD,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,iBAAiB;EACjB,qBAAqB;EACrB,2BAAA,GAA0BA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;CACpF;CAEa,OAAA,WAAoB,kBAAkB;EACjD,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,iBAAiB;EACjB,qBAAqB;EACrB,2BAAA,GAA0BA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;CACpF;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
1
+ {"version":3,"file":"Radio.themes.cjs","names":["tinycolor"],"sources":["../../../components/Radio/Radio.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\nexport namespace Theme {\n type Colors = {\n radioBorder: Property.Color;\n radioHoverBg: Property.Color;\n radioHoverBorder: Property.Color;\n radioFocusBorder: Property.Color;\n radioDisabledBg: Property.Color;\n radioDisabledBorder: Property.Color;\n radioIndicatorDisabledBg: Property.Color;\n radioInvalidBorder: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n radioIndicator: '$primary',\n radioBorder: '$grayBlue9',\n radioHoverBg: 'transparent',\n radioHoverBorder: '$primary',\n radioFocusBorder: '$primary',\n radioDisabledBg: '$deepBlue3',\n radioDisabledBorder: '$deepBlue5',\n radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n radioInvalidBorder: '$red9',\n });\n\n export const getDark: Factory = (primaryColor) => ({\n radioIndicator: '$primary',\n radioBorder: '$grayBlue9',\n radioHoverBg: '$deepBlue3',\n radioHoverBorder: '$primary',\n radioFocusBorder: '$primary',\n radioDisabledBg: '$deepBlue3',\n radioDisabledBorder: '$deepBlue4',\n radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n radioInvalidBorder: '$red9',\n });\n}\n"],"mappings":";;;;AAIO,IAAU;CAAV,SAAA,QAAA;CAcQ,OAAA,YAAqB,kBAAkB;EAClD,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,iBAAiB;EACjB,qBAAqB;EACrB,2BAAA,GAA0BA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAClF,oBAAoB;CACtB;CAEa,OAAA,WAAoB,kBAAkB;EACjD,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,iBAAiB;EACjB,qBAAqB;EACrB,2BAAA,GAA0BA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAClF,oBAAoB;CACtB;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
@@ -10,7 +10,8 @@ var Theme;
10
10
  radioFocusBorder: "$primary",
11
11
  radioDisabledBg: "$deepBlue3",
12
12
  radioDisabledBorder: "$deepBlue5",
13
- radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString()
13
+ radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString(),
14
+ radioInvalidBorder: "$red9"
14
15
  });
15
16
  _Theme.getDark = (primaryColor) => ({
16
17
  radioIndicator: "$primary",
@@ -20,7 +21,8 @@ var Theme;
20
21
  radioFocusBorder: "$primary",
21
22
  radioDisabledBg: "$deepBlue3",
22
23
  radioDisabledBorder: "$deepBlue4",
23
- radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString()
24
+ radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString(),
25
+ radioInvalidBorder: "$red9"
24
26
  });
25
27
  })(Theme || (Theme = {}));
26
28
  export { Theme };
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.themes.js","names":[],"sources":["../../../components/Radio/Radio.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\nexport namespace Theme {\n type Colors = {\n radioBorder: Property.Color;\n radioHoverBg: Property.Color;\n radioHoverBorder: Property.Color;\n radioFocusBorder: Property.Color;\n radioDisabledBg: Property.Color;\n radioDisabledBorder: Property.Color;\n radioIndicatorDisabledBg: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n radioIndicator: '$primary',\n radioBorder: '$grayBlue9',\n radioHoverBg: 'transparent',\n radioHoverBorder: '$primary',\n radioFocusBorder: '$primary',\n radioDisabledBg: '$deepBlue3',\n radioDisabledBorder: '$deepBlue5',\n radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n });\n\n export const getDark: Factory = (primaryColor) => ({\n radioIndicator: '$primary',\n radioBorder: '$grayBlue9',\n radioHoverBg: '$deepBlue3',\n radioHoverBorder: '$primary',\n radioFocusBorder: '$primary',\n radioDisabledBg: '$deepBlue3',\n radioDisabledBorder: '$deepBlue4',\n radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n });\n}\n"],"mappings":";;AAIO,IAAU;CAAV,SAAA,QAAA;CAaQ,OAAA,YAAqB,kBAAkB;EAClD,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,iBAAiB;EACjB,qBAAqB;EACrB,0BAA0B,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;CACpF;CAEa,OAAA,WAAoB,kBAAkB;EACjD,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,iBAAiB;EACjB,qBAAqB;EACrB,0BAA0B,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;CACpF;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
1
+ {"version":3,"file":"Radio.themes.js","names":[],"sources":["../../../components/Radio/Radio.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\nexport namespace Theme {\n type Colors = {\n radioBorder: Property.Color;\n radioHoverBg: Property.Color;\n radioHoverBorder: Property.Color;\n radioFocusBorder: Property.Color;\n radioDisabledBg: Property.Color;\n radioDisabledBorder: Property.Color;\n radioIndicatorDisabledBg: Property.Color;\n radioInvalidBorder: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n radioIndicator: '$primary',\n radioBorder: '$grayBlue9',\n radioHoverBg: 'transparent',\n radioHoverBorder: '$primary',\n radioFocusBorder: '$primary',\n radioDisabledBg: '$deepBlue3',\n radioDisabledBorder: '$deepBlue5',\n radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n radioInvalidBorder: '$red9',\n });\n\n export const getDark: Factory = (primaryColor) => ({\n radioIndicator: '$primary',\n radioBorder: '$grayBlue9',\n radioHoverBg: '$deepBlue3',\n radioHoverBorder: '$primary',\n radioFocusBorder: '$primary',\n radioDisabledBg: '$deepBlue3',\n radioDisabledBorder: '$deepBlue4',\n radioIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n radioInvalidBorder: '$red9',\n });\n}\n"],"mappings":";;AAIO,IAAU;CAAV,SAAA,QAAA;CAcQ,OAAA,YAAqB,kBAAkB;EAClD,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,iBAAiB;EACjB,qBAAqB;EACrB,0BAA0B,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAClF,oBAAoB;CACtB;CAEa,OAAA,WAAoB,kBAAkB;EACjD,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,iBAAiB;EACjB,qBAAqB;EACrB,0BAA0B,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAClF,oBAAoB;CACtB;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
@@ -31,12 +31,16 @@ var StyledRadio = require_stitches_config.styled("div", require_Radio.RADIO_BASE
31
31
  });
32
32
  var StyledIndicator = require_stitches_config.styled("div", require_Radio.INDICATOR_BASE_STYLES);
33
33
  var StyledRadioAccordionTrigger = require_stitches_config.styled(require_Accordion.StyledAccordionTrigger, { "@hover": { "&:hover": { [`& ${StyledRadio}`]: { boxShadow: "inset 0 0 0 1px $colors$radioHoverBorder" } } } });
34
- var RadioAccordionTrigger = react.default.forwardRef(({ children, ...props }, ref) => {
35
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Accordion.StyledAccordionHeader, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledRadioAccordionTrigger, {
36
- ref,
37
- ...props,
38
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledRadio, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIndicator, {}) }), children]
39
- }) });
34
+ var RadioAccordionTrigger = react.default.forwardRef(({ children, headingLevel = 3, ...props }, ref) => {
35
+ const Heading = headingLevel === "none" ? "div" : `h${headingLevel}`;
36
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Accordion.StyledAccordionHeader, {
37
+ asChild: true,
38
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledRadioAccordionTrigger, {
39
+ ref,
40
+ ...props,
41
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledRadio, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIndicator, {}) }), children]
42
+ }) })
43
+ });
40
44
  });
41
45
  var RadioAccordionContent = require_Accordion.AccordionContent;
42
46
  exports.RadioAccordionContent = RadioAccordionContent;
@@ -1 +1 @@
1
- {"version":3,"file":"RadioAccordion.cjs","names":["AccordionRoot","React","AccordionItem","styled","RADIO_BASE_STYLES","INDICATOR_BASE_STYLES","StyledAccordionTrigger","StyledAccordionHeader","AccordionContent"],"sources":["../../../components/RadioAccordion/RadioAccordion.tsx"],"sourcesContent":["import type { AccordionSingleProps } from '@radix-ui/react-accordion';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport {\n AccordionContent,\n AccordionItem,\n AccordionRoot,\n AccordionTriggerProps,\n StyledAccordionHeader,\n StyledAccordionTrigger,\n} from '../Accordion';\nimport { INDICATOR_BASE_STYLES, RADIO_BASE_STYLES } from '../Radio';\n\nexport interface RadioAccordionRootProps\n extends Omit<AccordionSingleProps, 'type' | 'collapsible'>,\n Omit<VariantProps<typeof AccordionRoot>, 'type' | 'collapsible'> {\n css?: CSS; // could not skipped\n}\n\nexport const RadioAccordionRoot: (props: RadioAccordionRootProps) => JSX.Element = (props) => (\n <AccordionRoot {...props} type=\"single\" collapsible={false} />\n);\n\nexport interface RadioAccordionItemProps\n extends ComponentProps<typeof AccordionItem>,\n VariantProps<typeof AccordionItem> {}\nexport const RadioAccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionItem>,\n RadioAccordionItemProps\n>(({ value, children, ...props }, forwardedRef) => {\n return (\n <AccordionItem\n value={value}\n ref={forwardedRef}\n css={{ display: 'inherit', flexDirection: 'column' }}\n {...props}\n >\n {children}\n </AccordionItem>\n );\n});\n\nconst StyledRadio = styled('div', RADIO_BASE_STYLES, {\n width: 18,\n height: 18,\n mr: '$2',\n '[data-state=open] > &': {\n backgroundColor: '$radioIndicator',\n },\n});\n\nconst StyledIndicator = styled('div', INDICATOR_BASE_STYLES);\n\nconst StyledRadioAccordionTrigger = styled(StyledAccordionTrigger, {\n '@hover': {\n '&:hover': {\n [`& ${StyledRadio}`]: {\n boxShadow: 'inset 0 0 0 1px $colors$radioHoverBorder',\n },\n },\n },\n});\n\nexport interface RadioAccordionTriggerProps extends AccordionTriggerProps {}\nexport const RadioAccordionTrigger = React.forwardRef<\n React.ElementRef<typeof StyledRadioAccordionTrigger>,\n RadioAccordionTriggerProps\n>(({ children, ...props }, ref) => {\n return (\n <StyledAccordionHeader>\n <StyledRadioAccordionTrigger ref={ref} {...props}>\n <StyledRadio>\n <StyledIndicator />\n </StyledRadio>\n {children}\n </StyledRadioAccordionTrigger>\n </StyledAccordionHeader>\n );\n});\n\nexport const RadioAccordionContent = AccordionContent;\n"],"mappings":";;;;;;;;AAoBA,IAAa,sBAAuE,UAClF,iBAAA,GAAA,kBAAA,IAAA,CAACA,kBAAAA,eAAD;CAAe,GAAI;CAAO,MAAK;CAAS,aAAa;AAAQ,CAAA;AAM/D,IAAa,qBAAqBC,MAAAA,QAAM,YAGrC,EAAE,OAAO,UAAU,GAAG,SAAS,iBAAiB;CACjD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,eAAD;EACS;EACP,KAAK;EACL,KAAK;GAAE,SAAS;GAAW,eAAe;EAAS;EACnD,GAAI;EAEH;CACY,CAAA;AAEnB,CAAC;AAED,IAAM,cAAcC,wBAAAA,OAAO,OAAOC,cAAAA,mBAAmB;CACnD,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,yBAAyB,EACvB,iBAAiB,kBACnB;AACF,CAAC;AAED,IAAM,kBAAkBD,wBAAAA,OAAO,OAAOE,cAAAA,qBAAqB;AAE3D,IAAM,8BAA8BF,wBAAAA,OAAOG,kBAAAA,wBAAwB,EACjE,UAAU,EACR,WAAW,GACR,KAAK,gBAAgB,EACpB,WAAW,2CACb,EACF,EACF,EACF,CAAC;AAGD,IAAa,wBAAwBL,MAAAA,QAAM,YAGxC,EAAE,UAAU,GAAG,SAAS,QAAQ;CACjC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACM,kBAAAA,uBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,6BAAD;EAAkC;EAAK,GAAI;EAA3C,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,CAAkB,CAAA,EACP,CAAA,GACZ,QAC0B;CACR,CAAA,EAAA,CAAA;AAE3B,CAAC;AAED,IAAa,wBAAwBC,kBAAAA"}
1
+ {"version":3,"file":"RadioAccordion.cjs","names":["AccordionRoot","React","AccordionItem","styled","RADIO_BASE_STYLES","INDICATOR_BASE_STYLES","StyledAccordionTrigger","StyledAccordionHeader","AccordionContent"],"sources":["../../../components/RadioAccordion/RadioAccordion.tsx"],"sourcesContent":["import type { AccordionSingleProps } from '@radix-ui/react-accordion';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport {\n AccordionContent,\n AccordionItem,\n AccordionRoot,\n AccordionTriggerProps,\n StyledAccordionHeader,\n StyledAccordionTrigger,\n} from '../Accordion';\nimport { INDICATOR_BASE_STYLES, RADIO_BASE_STYLES } from '../Radio';\n\nexport interface RadioAccordionRootProps\n extends\n Omit<AccordionSingleProps, 'type' | 'collapsible'>,\n Omit<VariantProps<typeof AccordionRoot>, 'type' | 'collapsible'> {\n css?: CSS; // could not skipped\n}\n\nexport const RadioAccordionRoot: (props: RadioAccordionRootProps) => JSX.Element = (props) => (\n <AccordionRoot {...props} type=\"single\" collapsible={false} />\n);\n\nexport interface RadioAccordionItemProps\n extends ComponentProps<typeof AccordionItem>, VariantProps<typeof AccordionItem> {}\nexport const RadioAccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionItem>,\n RadioAccordionItemProps\n>(({ value, children, ...props }, forwardedRef) => {\n return (\n <AccordionItem\n value={value}\n ref={forwardedRef}\n css={{ display: 'inherit', flexDirection: 'column' }}\n {...props}\n >\n {children}\n </AccordionItem>\n );\n});\n\nconst StyledRadio = styled('div', RADIO_BASE_STYLES, {\n width: 18,\n height: 18,\n mr: '$2',\n '[data-state=open] > &': {\n backgroundColor: '$radioIndicator',\n },\n});\n\nconst StyledIndicator = styled('div', INDICATOR_BASE_STYLES);\n\nconst StyledRadioAccordionTrigger = styled(StyledAccordionTrigger, {\n '@hover': {\n '&:hover': {\n [`& ${StyledRadio}`]: {\n boxShadow: 'inset 0 0 0 1px $colors$radioHoverBorder',\n },\n },\n },\n});\n\nexport interface RadioAccordionTriggerProps extends Omit<\n AccordionTriggerProps,\n 'customIcon' | 'noIcon'\n> {}\nexport const RadioAccordionTrigger = React.forwardRef<\n React.ElementRef<typeof StyledRadioAccordionTrigger>,\n RadioAccordionTriggerProps\n>(({ children, headingLevel = 3, ...props }, ref) => {\n const Heading = headingLevel === 'none' ? 'div' : (`h${headingLevel}` as const);\n\n return (\n <StyledAccordionHeader asChild>\n <Heading>\n <StyledRadioAccordionTrigger ref={ref} {...props}>\n <StyledRadio>\n <StyledIndicator />\n </StyledRadio>\n {children}\n </StyledRadioAccordionTrigger>\n </Heading>\n </StyledAccordionHeader>\n );\n});\n\nexport const RadioAccordionContent = AccordionContent;\n"],"mappings":";;;;;;;;AAqBA,IAAa,sBAAuE,UAClF,iBAAA,GAAA,kBAAA,IAAA,CAACA,kBAAAA,eAAD;CAAe,GAAI;CAAO,MAAK;CAAS,aAAa;AAAQ,CAAA;AAK/D,IAAa,qBAAqBC,MAAAA,QAAM,YAGrC,EAAE,OAAO,UAAU,GAAG,SAAS,iBAAiB;CACjD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,eAAD;EACS;EACP,KAAK;EACL,KAAK;GAAE,SAAS;GAAW,eAAe;EAAS;EACnD,GAAI;EAEH;CACY,CAAA;AAEnB,CAAC;AAED,IAAM,cAAcC,wBAAAA,OAAO,OAAOC,cAAAA,mBAAmB;CACnD,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,yBAAyB,EACvB,iBAAiB,kBACnB;AACF,CAAC;AAED,IAAM,kBAAkBD,wBAAAA,OAAO,OAAOE,cAAAA,qBAAqB;AAE3D,IAAM,8BAA8BF,wBAAAA,OAAOG,kBAAAA,wBAAwB,EACjE,UAAU,EACR,WAAW,GACR,KAAK,gBAAgB,EACpB,WAAW,2CACb,EACF,EACF,EACF,CAAC;AAMD,IAAa,wBAAwBL,MAAAA,QAAM,YAGxC,EAAE,UAAU,eAAe,GAAG,GAAG,SAAS,QAAQ;CACnD,MAAM,UAAU,iBAAiB,SAAS,QAAS,IAAI;CAEvD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACM,kBAAAA,uBAAD;EAAuB,SAAA;EACrB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,6BAAD;GAAkC;GAAK,GAAI;GAA3C,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,CAAkB,CAAA,EACP,CAAA,GACZ,QAC0B;EACtB,CAAA,EAAA,CAAA;CACY,CAAA;AAE3B,CAAC;AAED,IAAa,wBAAwBC,kBAAAA"}
@@ -29,12 +29,16 @@ var StyledRadio = styled("div", RADIO_BASE_STYLES, {
29
29
  });
30
30
  var StyledIndicator = styled("div", INDICATOR_BASE_STYLES);
31
31
  var StyledRadioAccordionTrigger = styled(StyledAccordionTrigger, { "@hover": { "&:hover": { [`& ${StyledRadio}`]: { boxShadow: "inset 0 0 0 1px $colors$radioHoverBorder" } } } });
32
- var RadioAccordionTrigger = React.forwardRef(({ children, ...props }, ref) => {
33
- return /* @__PURE__ */ jsx(StyledAccordionHeader, { children: /* @__PURE__ */ jsxs(StyledRadioAccordionTrigger, {
34
- ref,
35
- ...props,
36
- children: [/* @__PURE__ */ jsx(StyledRadio, { children: /* @__PURE__ */ jsx(StyledIndicator, {}) }), children]
37
- }) });
32
+ var RadioAccordionTrigger = React.forwardRef(({ children, headingLevel = 3, ...props }, ref) => {
33
+ const Heading = headingLevel === "none" ? "div" : `h${headingLevel}`;
34
+ return /* @__PURE__ */ jsx(StyledAccordionHeader, {
35
+ asChild: true,
36
+ children: /* @__PURE__ */ jsx(Heading, { children: /* @__PURE__ */ jsxs(StyledRadioAccordionTrigger, {
37
+ ref,
38
+ ...props,
39
+ children: [/* @__PURE__ */ jsx(StyledRadio, { children: /* @__PURE__ */ jsx(StyledIndicator, {}) }), children]
40
+ }) })
41
+ });
38
42
  });
39
43
  var RadioAccordionContent = AccordionContent;
40
44
  export { RadioAccordionContent, RadioAccordionItem, RadioAccordionRoot, RadioAccordionTrigger };
@@ -1 +1 @@
1
- {"version":3,"file":"RadioAccordion.js","names":[],"sources":["../../../components/RadioAccordion/RadioAccordion.tsx"],"sourcesContent":["import type { AccordionSingleProps } from '@radix-ui/react-accordion';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport {\n AccordionContent,\n AccordionItem,\n AccordionRoot,\n AccordionTriggerProps,\n StyledAccordionHeader,\n StyledAccordionTrigger,\n} from '../Accordion';\nimport { INDICATOR_BASE_STYLES, RADIO_BASE_STYLES } from '../Radio';\n\nexport interface RadioAccordionRootProps\n extends Omit<AccordionSingleProps, 'type' | 'collapsible'>,\n Omit<VariantProps<typeof AccordionRoot>, 'type' | 'collapsible'> {\n css?: CSS; // could not skipped\n}\n\nexport const RadioAccordionRoot: (props: RadioAccordionRootProps) => JSX.Element = (props) => (\n <AccordionRoot {...props} type=\"single\" collapsible={false} />\n);\n\nexport interface RadioAccordionItemProps\n extends ComponentProps<typeof AccordionItem>,\n VariantProps<typeof AccordionItem> {}\nexport const RadioAccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionItem>,\n RadioAccordionItemProps\n>(({ value, children, ...props }, forwardedRef) => {\n return (\n <AccordionItem\n value={value}\n ref={forwardedRef}\n css={{ display: 'inherit', flexDirection: 'column' }}\n {...props}\n >\n {children}\n </AccordionItem>\n );\n});\n\nconst StyledRadio = styled('div', RADIO_BASE_STYLES, {\n width: 18,\n height: 18,\n mr: '$2',\n '[data-state=open] > &': {\n backgroundColor: '$radioIndicator',\n },\n});\n\nconst StyledIndicator = styled('div', INDICATOR_BASE_STYLES);\n\nconst StyledRadioAccordionTrigger = styled(StyledAccordionTrigger, {\n '@hover': {\n '&:hover': {\n [`& ${StyledRadio}`]: {\n boxShadow: 'inset 0 0 0 1px $colors$radioHoverBorder',\n },\n },\n },\n});\n\nexport interface RadioAccordionTriggerProps extends AccordionTriggerProps {}\nexport const RadioAccordionTrigger = React.forwardRef<\n React.ElementRef<typeof StyledRadioAccordionTrigger>,\n RadioAccordionTriggerProps\n>(({ children, ...props }, ref) => {\n return (\n <StyledAccordionHeader>\n <StyledRadioAccordionTrigger ref={ref} {...props}>\n <StyledRadio>\n <StyledIndicator />\n </StyledRadio>\n {children}\n </StyledRadioAccordionTrigger>\n </StyledAccordionHeader>\n );\n});\n\nexport const RadioAccordionContent = AccordionContent;\n"],"mappings":";;;;;;AAoBA,IAAa,sBAAuE,UAClF,oBAAC,eAAD;CAAe,GAAI;CAAO,MAAK;CAAS,aAAa;AAAQ,CAAA;AAM/D,IAAa,qBAAqB,MAAM,YAGrC,EAAE,OAAO,UAAU,GAAG,SAAS,iBAAiB;CACjD,OACE,oBAAC,eAAD;EACS;EACP,KAAK;EACL,KAAK;GAAE,SAAS;GAAW,eAAe;EAAS;EACnD,GAAI;EAEH;CACY,CAAA;AAEnB,CAAC;AAED,IAAM,cAAc,OAAO,OAAO,mBAAmB;CACnD,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,yBAAyB,EACvB,iBAAiB,kBACnB;AACF,CAAC;AAED,IAAM,kBAAkB,OAAO,OAAO,qBAAqB;AAE3D,IAAM,8BAA8B,OAAO,wBAAwB,EACjE,UAAU,EACR,WAAW,GACR,KAAK,gBAAgB,EACpB,WAAW,2CACb,EACF,EACF,EACF,CAAC;AAGD,IAAa,wBAAwB,MAAM,YAGxC,EAAE,UAAU,GAAG,SAAS,QAAQ;CACjC,OACE,oBAAC,uBAAD,EAAA,UACE,qBAAC,6BAAD;EAAkC;EAAK,GAAI;EAA3C,UAAA,CACE,oBAAC,aAAD,EAAA,UACE,oBAAC,iBAAD,CAAkB,CAAA,EACP,CAAA,GACZ,QAC0B;CACR,CAAA,EAAA,CAAA;AAE3B,CAAC;AAED,IAAa,wBAAwB"}
1
+ {"version":3,"file":"RadioAccordion.js","names":[],"sources":["../../../components/RadioAccordion/RadioAccordion.tsx"],"sourcesContent":["import type { AccordionSingleProps } from '@radix-ui/react-accordion';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport {\n AccordionContent,\n AccordionItem,\n AccordionRoot,\n AccordionTriggerProps,\n StyledAccordionHeader,\n StyledAccordionTrigger,\n} from '../Accordion';\nimport { INDICATOR_BASE_STYLES, RADIO_BASE_STYLES } from '../Radio';\n\nexport interface RadioAccordionRootProps\n extends\n Omit<AccordionSingleProps, 'type' | 'collapsible'>,\n Omit<VariantProps<typeof AccordionRoot>, 'type' | 'collapsible'> {\n css?: CSS; // could not skipped\n}\n\nexport const RadioAccordionRoot: (props: RadioAccordionRootProps) => JSX.Element = (props) => (\n <AccordionRoot {...props} type=\"single\" collapsible={false} />\n);\n\nexport interface RadioAccordionItemProps\n extends ComponentProps<typeof AccordionItem>, VariantProps<typeof AccordionItem> {}\nexport const RadioAccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionItem>,\n RadioAccordionItemProps\n>(({ value, children, ...props }, forwardedRef) => {\n return (\n <AccordionItem\n value={value}\n ref={forwardedRef}\n css={{ display: 'inherit', flexDirection: 'column' }}\n {...props}\n >\n {children}\n </AccordionItem>\n );\n});\n\nconst StyledRadio = styled('div', RADIO_BASE_STYLES, {\n width: 18,\n height: 18,\n mr: '$2',\n '[data-state=open] > &': {\n backgroundColor: '$radioIndicator',\n },\n});\n\nconst StyledIndicator = styled('div', INDICATOR_BASE_STYLES);\n\nconst StyledRadioAccordionTrigger = styled(StyledAccordionTrigger, {\n '@hover': {\n '&:hover': {\n [`& ${StyledRadio}`]: {\n boxShadow: 'inset 0 0 0 1px $colors$radioHoverBorder',\n },\n },\n },\n});\n\nexport interface RadioAccordionTriggerProps extends Omit<\n AccordionTriggerProps,\n 'customIcon' | 'noIcon'\n> {}\nexport const RadioAccordionTrigger = React.forwardRef<\n React.ElementRef<typeof StyledRadioAccordionTrigger>,\n RadioAccordionTriggerProps\n>(({ children, headingLevel = 3, ...props }, ref) => {\n const Heading = headingLevel === 'none' ? 'div' : (`h${headingLevel}` as const);\n\n return (\n <StyledAccordionHeader asChild>\n <Heading>\n <StyledRadioAccordionTrigger ref={ref} {...props}>\n <StyledRadio>\n <StyledIndicator />\n </StyledRadio>\n {children}\n </StyledRadioAccordionTrigger>\n </Heading>\n </StyledAccordionHeader>\n );\n});\n\nexport const RadioAccordionContent = AccordionContent;\n"],"mappings":";;;;;;AAqBA,IAAa,sBAAuE,UAClF,oBAAC,eAAD;CAAe,GAAI;CAAO,MAAK;CAAS,aAAa;AAAQ,CAAA;AAK/D,IAAa,qBAAqB,MAAM,YAGrC,EAAE,OAAO,UAAU,GAAG,SAAS,iBAAiB;CACjD,OACE,oBAAC,eAAD;EACS;EACP,KAAK;EACL,KAAK;GAAE,SAAS;GAAW,eAAe;EAAS;EACnD,GAAI;EAEH;CACY,CAAA;AAEnB,CAAC;AAED,IAAM,cAAc,OAAO,OAAO,mBAAmB;CACnD,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,yBAAyB,EACvB,iBAAiB,kBACnB;AACF,CAAC;AAED,IAAM,kBAAkB,OAAO,OAAO,qBAAqB;AAE3D,IAAM,8BAA8B,OAAO,wBAAwB,EACjE,UAAU,EACR,WAAW,GACR,KAAK,gBAAgB,EACpB,WAAW,2CACb,EACF,EACF,EACF,CAAC;AAMD,IAAa,wBAAwB,MAAM,YAGxC,EAAE,UAAU,eAAe,GAAG,GAAG,SAAS,QAAQ;CACnD,MAAM,UAAU,iBAAiB,SAAS,QAAS,IAAI;CAEvD,OACE,oBAAC,uBAAD;EAAuB,SAAA;EACrB,UAAA,oBAAC,SAAD,EAAA,UACE,qBAAC,6BAAD;GAAkC;GAAK,GAAI;GAA3C,UAAA,CACE,oBAAC,aAAD,EAAA,UACE,oBAAC,iBAAD,CAAkB,CAAA,EACP,CAAA,GACZ,QAC0B;EACtB,CAAA,EAAA,CAAA;CACY,CAAA;AAE3B,CAAC;AAED,IAAa,wBAAwB"}
@@ -0,0 +1,95 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ const require_stitches_config = require("../../stitches.config.cjs");
3
+ let react = require("react");
4
+ react = require_runtime.__toESM(react, 1);
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ let _radix_ui_react_slot = require("@radix-ui/react-slot");
7
+ // components/RowLink/RowLink.tsx
8
+ var ROW_LINK_ATTRIBUTE = "data-row-link";
9
+ var STITCHES_INTERNAL = Symbol.for("sxs.internal");
10
+ var ROW_LINK_Z_INDEX = 1;
11
+ var ROW_LINK_CONTROLS = `:where(a, button, input, select, textarea, [tabindex]):where(:not([${ROW_LINK_ATTRIBUTE}]))`;
12
+ var rowLinkStyles = {
13
+ color: "inherit",
14
+ textDecoration: "none",
15
+ outline: "none",
16
+ "&::after": {
17
+ content: "\"\"",
18
+ position: "absolute",
19
+ inset: 0,
20
+ zIndex: ROW_LINK_Z_INDEX
21
+ },
22
+ "&:focus-visible::after": {
23
+ outlineWidth: "2px",
24
+ outlineStyle: "solid",
25
+ outlineColor: "$focusOutline",
26
+ outlineOffset: "-2px"
27
+ }
28
+ };
29
+ var StyledRowLink = require_stitches_config.styled("a", rowLinkStyles);
30
+ var StyledRowLinkSlot = require_stitches_config.styled(_radix_ui_react_slot.Slot, rowLinkStyles);
31
+ /** Styles for a table that can hold a `RowLink`. */
32
+ var rowLinkTableStyles = { [`&:has([${ROW_LINK_ATTRIBUTE}])`]: { isolation: "isolate" } };
33
+ /** Styles for a table row that can hold a `RowLink`. */
34
+ var rowLinkRowStyles = {
35
+ [`&:has([${ROW_LINK_ATTRIBUTE}])`]: { position: "relative" },
36
+ [`&:has([${ROW_LINK_ATTRIBUTE}]) ${ROW_LINK_CONTROLS}`]: {
37
+ position: "relative",
38
+ zIndex: 2
39
+ }
40
+ };
41
+ /**
42
+ * A link that covers its whole table row, so that a click on the row opens it.
43
+ * Other links and buttons in the row stay above it.
44
+ */
45
+ var RowLink = react.default.forwardRef(({ asChild, ...props }, forwardedRef) => {
46
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? StyledRowLinkSlot : StyledRowLink, {
47
+ ref: forwardedRef,
48
+ [ROW_LINK_ATTRIBUTE]: "",
49
+ ...props
50
+ });
51
+ });
52
+ RowLink.displayName = "RowLink";
53
+ var isCellType = (type, cellType) => {
54
+ if (type === cellType) return true;
55
+ if (!type || typeof type !== "object" && typeof type !== "function") return false;
56
+ const { className, [STITCHES_INTERNAL]: internal } = type;
57
+ const cellClassName = cellType.className;
58
+ return internal?.type === cellType || !!cellClassName && className === cellClassName;
59
+ };
60
+ var warnedMessages = /* @__PURE__ */ new Set();
61
+ var warnOnce = (message) => {
62
+ if (typeof process !== "undefined" && process.env.NODE_ENV === "production") return;
63
+ if (!warnedMessages.has(message)) {
64
+ warnedMessages.add(message);
65
+ console.warn(message);
66
+ }
67
+ };
68
+ /** Puts the content of the `cellType` cell at `linkCell` in a `RowLink` to `href`. */
69
+ var withRowLink = (children, { href, linkAs: LinkComponent = "a", linkCell = 0, linkProps }, cellType) => {
70
+ if (href === void 0) return children;
71
+ let cellIndex = -1;
72
+ let linked = false;
73
+ const mapped = react.Children.map(children, (child) => {
74
+ if (!(0, react.isValidElement)(child)) return child;
75
+ cellIndex += 1;
76
+ if (cellIndex !== linkCell || !isCellType(child.type, cellType)) return child;
77
+ linked = true;
78
+ return (0, react.cloneElement)(child, void 0, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowLink, {
79
+ asChild: true,
80
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkComponent, {
81
+ ...linkProps,
82
+ href,
83
+ children: child.props.children
84
+ })
85
+ }));
86
+ });
87
+ if (!linked) warnOnce(`Tr: the child at linkCell ${linkCell} is not a Td, so the row has no link. Use a Td for that cell, or put a RowLink in it.`);
88
+ return mapped;
89
+ };
90
+ exports.RowLink = RowLink;
91
+ exports.rowLinkRowStyles = rowLinkRowStyles;
92
+ exports.rowLinkTableStyles = rowLinkTableStyles;
93
+ exports.withRowLink = withRowLink;
94
+
95
+ //# sourceMappingURL=RowLink.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RowLink.cjs","names":["styled","Slot","React","Children","isValidElement","cloneElement"],"sources":["../../../components/RowLink/RowLink.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { Children, cloneElement, ElementType, isValidElement, ReactNode } from 'react';\n\nimport { CSS, styled } from '../../stitches.config';\n\nconst ROW_LINK_ATTRIBUTE = 'data-row-link';\nconst STITCHES_INTERNAL = Symbol.for('sxs.internal');\n\nconst ROW_LINK_Z_INDEX = 1;\nexport const ROW_LINK_CONTROL_Z_INDEX = 2;\nconst ROW_LINK_CONTROLS = `:where(a, button, input, select, textarea, [tabindex]):where(:not([${ROW_LINK_ATTRIBUTE}]))`;\n\nconst rowLinkStyles = {\n color: 'inherit',\n textDecoration: 'none',\n outline: 'none',\n\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n zIndex: ROW_LINK_Z_INDEX,\n },\n\n '&:focus-visible::after': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: '$focusOutline',\n outlineOffset: '-2px',\n },\n};\n\nconst StyledRowLink = styled('a', rowLinkStyles);\nconst StyledRowLinkSlot = styled(Slot, rowLinkStyles);\n\n/** Styles for a table that can hold a `RowLink`. */\nexport const rowLinkTableStyles = {\n [`&:has([${ROW_LINK_ATTRIBUTE}])`]: {\n isolation: 'isolate',\n },\n};\n\n/** Styles for a table row that can hold a `RowLink`. */\nexport const rowLinkRowStyles = {\n [`&:has([${ROW_LINK_ATTRIBUTE}])`]: {\n position: 'relative',\n },\n // Not at zero specificity, so that it wins over the `all: unset` of controls such as Checkbox.\n [`&:has([${ROW_LINK_ATTRIBUTE}]) ${ROW_LINK_CONTROLS}`]: {\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n },\n};\n\nexport type RowLinkProps = React.ComponentProps<typeof StyledRowLink> & {\n asChild?: boolean;\n css?: CSS;\n};\n\n/**\n * A link that covers its whole table row, so that a click on the row opens it.\n * Other links and buttons in the row stay above it.\n */\nexport const RowLink = React.forwardRef<HTMLAnchorElement, RowLinkProps>(\n ({ asChild, ...props }, forwardedRef) => {\n const Component = asChild ? StyledRowLinkSlot : StyledRowLink;\n\n return <Component ref={forwardedRef} {...{ [ROW_LINK_ATTRIBUTE]: '' }} {...props} />;\n },\n);\n\nRowLink.displayName = 'RowLink';\n\nexport type RowLinkShortcutProps = {\n href?: string;\n /**\n * The link component, for example a router link. It must pass its props and ref to its `<a>`,\n * and it must be defined outside render, or the link mounts again on each render.\n */\n linkAs?: ElementType;\n /** Other props for the link component, for example `{ returnTo }`. */\n linkProps?: Record<string, unknown>;\n /** The index of the cell that holds the link, among the direct children of the row. */\n linkCell?: number;\n};\n\ntype StitchesType = { className?: string; [STITCHES_INTERNAL]?: { type?: unknown } };\n\n// A Stitches `styled(Td)` keeps the class name of a Stitches Td, or renders a component Td.\n// This reads Stitches 1.x internals; the styled Td tests catch a change in them.\nconst isCellType = (type: unknown, cellType: ElementType) => {\n if (type === cellType) {\n return true;\n }\n if (!type || (typeof type !== 'object' && typeof type !== 'function')) {\n return false;\n }\n const { className, [STITCHES_INTERNAL]: internal } = type as StitchesType;\n const cellClassName = (cellType as StitchesType).className;\n return internal?.type === cellType || (!!cellClassName && className === cellClassName);\n};\n\nconst warnedMessages = new Set<string>();\n\n/** Clears the warnings that were already logged. For tests only. */\nexport const resetRowLinkWarnings = () => warnedMessages.clear();\n\nconst warnOnce = (message: string) => {\n if (typeof process !== 'undefined' && process.env.NODE_ENV === 'production') {\n return;\n }\n if (!warnedMessages.has(message)) {\n warnedMessages.add(message);\n console.warn(message);\n }\n};\n\n/** Puts the content of the `cellType` cell at `linkCell` in a `RowLink` to `href`. */\nexport const withRowLink = (\n children: ReactNode,\n { href, linkAs: LinkComponent = 'a', linkCell = 0, linkProps }: RowLinkShortcutProps,\n cellType: ElementType,\n) => {\n if (href === undefined) {\n return children;\n }\n\n let cellIndex = -1;\n let linked = false;\n // eslint-disable-next-line @eslint-react/no-children-map\n const mapped = Children.map(children, (child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) {\n return child;\n }\n cellIndex += 1;\n if (cellIndex !== linkCell || !isCellType(child.type, cellType)) {\n return child;\n }\n linked = true;\n // eslint-disable-next-line @eslint-react/no-clone-element\n return cloneElement(\n child,\n undefined,\n <RowLink asChild>\n <LinkComponent {...linkProps} href={href}>\n {child.props.children}\n </LinkComponent>\n </RowLink>,\n );\n });\n\n if (!linked) {\n warnOnce(\n `Tr: the child at linkCell ${linkCell} is not a Td, so the row has no link. Use a Td for that cell, or put a RowLink in it.`,\n );\n }\n\n return mapped;\n};\n"],"mappings":";;;;;;;AAKA,IAAM,qBAAqB;AAC3B,IAAM,oBAAoB,OAAO,IAAI,cAAc;AAEnD,IAAM,mBAAmB;AAEzB,IAAM,oBAAoB,sEAAsE,mBAAmB;AAEnH,IAAM,gBAAgB;CACpB,OAAO;CACP,gBAAgB;CAChB,SAAS;CAET,YAAY;EACV,SAAS;EACT,UAAU;EACV,OAAO;EACP,QAAQ;CACV;CAEA,0BAA0B;EACxB,cAAc;EACd,cAAc;EACd,cAAc;EACd,eAAe;CACjB;AACF;AAEA,IAAM,gBAAgBA,wBAAAA,OAAO,KAAK,aAAa;AAC/C,IAAM,oBAAoBA,wBAAAA,OAAOC,qBAAAA,MAAM,aAAa;;AAGpD,IAAa,qBAAqB,GAC/B,UAAU,mBAAmB,MAAM,EAClC,WAAW,UACb,EACF;;AAGA,IAAa,mBAAmB;EAC7B,UAAU,mBAAmB,MAAM,EAClC,UAAU,WACZ;EAEC,UAAU,mBAAmB,KAAK,sBAAsB;EACvD,UAAU;EACV,QAAA;CACF;AACF;;;;;AAWA,IAAa,UAAUC,MAAAA,QAAM,YAC1B,EAAE,SAAS,GAAG,SAAS,iBAAiB;CAGvC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAFW,UAAU,oBAAoB,eAEzC;EAAW,KAAK;GAAqB,qBAAqB;EAAM,GAAI;CAAQ,CAAA;AACrF,CACF;AAEA,QAAQ,cAAc;AAmBtB,IAAM,cAAc,MAAe,aAA0B;CAC3D,IAAI,SAAS,UACX,OAAO;CAET,IAAI,CAAC,QAAS,OAAO,SAAS,YAAY,OAAO,SAAS,YACxD,OAAO;CAET,MAAM,EAAE,YAAY,oBAAoB,aAAa;CACrD,MAAM,gBAAiB,SAA0B;CACjD,OAAO,UAAU,SAAS,YAAa,CAAC,CAAC,iBAAiB,cAAc;AAC1E;AAEA,IAAM,iCAAiB,IAAI,IAAY;AAKvC,IAAM,YAAY,YAAoB;CACpC,IAAI,OAAO,YAAY,eAAA,QAAA,IAAA,aAAwC,cAC7D;CAEF,IAAI,CAAC,eAAe,IAAI,OAAO,GAAG;EAChC,eAAe,IAAI,OAAO;EAC1B,QAAQ,KAAK,OAAO;CACtB;AACF;;AAGA,IAAa,eACX,UACA,EAAE,MAAM,QAAQ,gBAAgB,KAAK,WAAW,GAAG,aACnD,aACG;CACH,IAAI,SAAS,KAAA,GACX,OAAO;CAGT,IAAI,YAAY;CAChB,IAAI,SAAS;CAEb,MAAM,SAASC,MAAAA,SAAS,IAAI,WAAW,UAAU;EAC/C,IAAI,EAAA,GAACC,MAAAA,eAAAA,CAAyC,KAAK,GACjD,OAAO;EAET,aAAa;EACb,IAAI,cAAc,YAAY,CAAC,WAAW,MAAM,MAAM,QAAQ,GAC5D,OAAO;EAET,SAAS;EAET,QAAA,GAAOC,MAAAA,aAAAA,CACL,OACA,KAAA,GACA,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD;GAAS,SAAA;GACP,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;IAAe,GAAI;IAAiB;IACjC,UAAA,MAAM,MAAM;GACA,CAAA;EACR,CAAA,CACX;CACF,CAAC;CAED,IAAI,CAAC,QACH,SACE,6BAA6B,SAAS,sFACxC;CAGF,OAAO;AACT"}
@@ -0,0 +1,90 @@
1
+ import { styled } from "../../stitches.config.js";
2
+ import React, { Children, cloneElement, isValidElement } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Slot } from "@radix-ui/react-slot";
5
+ // components/RowLink/RowLink.tsx
6
+ var ROW_LINK_ATTRIBUTE = "data-row-link";
7
+ var STITCHES_INTERNAL = Symbol.for("sxs.internal");
8
+ var ROW_LINK_Z_INDEX = 1;
9
+ var ROW_LINK_CONTROLS = `:where(a, button, input, select, textarea, [tabindex]):where(:not([${ROW_LINK_ATTRIBUTE}]))`;
10
+ var rowLinkStyles = {
11
+ color: "inherit",
12
+ textDecoration: "none",
13
+ outline: "none",
14
+ "&::after": {
15
+ content: "\"\"",
16
+ position: "absolute",
17
+ inset: 0,
18
+ zIndex: ROW_LINK_Z_INDEX
19
+ },
20
+ "&:focus-visible::after": {
21
+ outlineWidth: "2px",
22
+ outlineStyle: "solid",
23
+ outlineColor: "$focusOutline",
24
+ outlineOffset: "-2px"
25
+ }
26
+ };
27
+ var StyledRowLink = styled("a", rowLinkStyles);
28
+ var StyledRowLinkSlot = styled(Slot, rowLinkStyles);
29
+ /** Styles for a table that can hold a `RowLink`. */
30
+ var rowLinkTableStyles = { [`&:has([${ROW_LINK_ATTRIBUTE}])`]: { isolation: "isolate" } };
31
+ /** Styles for a table row that can hold a `RowLink`. */
32
+ var rowLinkRowStyles = {
33
+ [`&:has([${ROW_LINK_ATTRIBUTE}])`]: { position: "relative" },
34
+ [`&:has([${ROW_LINK_ATTRIBUTE}]) ${ROW_LINK_CONTROLS}`]: {
35
+ position: "relative",
36
+ zIndex: 2
37
+ }
38
+ };
39
+ /**
40
+ * A link that covers its whole table row, so that a click on the row opens it.
41
+ * Other links and buttons in the row stay above it.
42
+ */
43
+ var RowLink = React.forwardRef(({ asChild, ...props }, forwardedRef) => {
44
+ return /* @__PURE__ */ jsx(asChild ? StyledRowLinkSlot : StyledRowLink, {
45
+ ref: forwardedRef,
46
+ [ROW_LINK_ATTRIBUTE]: "",
47
+ ...props
48
+ });
49
+ });
50
+ RowLink.displayName = "RowLink";
51
+ var isCellType = (type, cellType) => {
52
+ if (type === cellType) return true;
53
+ if (!type || typeof type !== "object" && typeof type !== "function") return false;
54
+ const { className, [STITCHES_INTERNAL]: internal } = type;
55
+ const cellClassName = cellType.className;
56
+ return internal?.type === cellType || !!cellClassName && className === cellClassName;
57
+ };
58
+ var warnedMessages = /* @__PURE__ */ new Set();
59
+ var warnOnce = (message) => {
60
+ if (typeof process !== "undefined" && process.env.NODE_ENV === "production") return;
61
+ if (!warnedMessages.has(message)) {
62
+ warnedMessages.add(message);
63
+ console.warn(message);
64
+ }
65
+ };
66
+ /** Puts the content of the `cellType` cell at `linkCell` in a `RowLink` to `href`. */
67
+ var withRowLink = (children, { href, linkAs: LinkComponent = "a", linkCell = 0, linkProps }, cellType) => {
68
+ if (href === void 0) return children;
69
+ let cellIndex = -1;
70
+ let linked = false;
71
+ const mapped = Children.map(children, (child) => {
72
+ if (!isValidElement(child)) return child;
73
+ cellIndex += 1;
74
+ if (cellIndex !== linkCell || !isCellType(child.type, cellType)) return child;
75
+ linked = true;
76
+ return cloneElement(child, void 0, /* @__PURE__ */ jsx(RowLink, {
77
+ asChild: true,
78
+ children: /* @__PURE__ */ jsx(LinkComponent, {
79
+ ...linkProps,
80
+ href,
81
+ children: child.props.children
82
+ })
83
+ }));
84
+ });
85
+ if (!linked) warnOnce(`Tr: the child at linkCell ${linkCell} is not a Td, so the row has no link. Use a Td for that cell, or put a RowLink in it.`);
86
+ return mapped;
87
+ };
88
+ export { RowLink, rowLinkRowStyles, rowLinkTableStyles, withRowLink };
89
+
90
+ //# sourceMappingURL=RowLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RowLink.js","names":[],"sources":["../../../components/RowLink/RowLink.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { Children, cloneElement, ElementType, isValidElement, ReactNode } from 'react';\n\nimport { CSS, styled } from '../../stitches.config';\n\nconst ROW_LINK_ATTRIBUTE = 'data-row-link';\nconst STITCHES_INTERNAL = Symbol.for('sxs.internal');\n\nconst ROW_LINK_Z_INDEX = 1;\nexport const ROW_LINK_CONTROL_Z_INDEX = 2;\nconst ROW_LINK_CONTROLS = `:where(a, button, input, select, textarea, [tabindex]):where(:not([${ROW_LINK_ATTRIBUTE}]))`;\n\nconst rowLinkStyles = {\n color: 'inherit',\n textDecoration: 'none',\n outline: 'none',\n\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n zIndex: ROW_LINK_Z_INDEX,\n },\n\n '&:focus-visible::after': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: '$focusOutline',\n outlineOffset: '-2px',\n },\n};\n\nconst StyledRowLink = styled('a', rowLinkStyles);\nconst StyledRowLinkSlot = styled(Slot, rowLinkStyles);\n\n/** Styles for a table that can hold a `RowLink`. */\nexport const rowLinkTableStyles = {\n [`&:has([${ROW_LINK_ATTRIBUTE}])`]: {\n isolation: 'isolate',\n },\n};\n\n/** Styles for a table row that can hold a `RowLink`. */\nexport const rowLinkRowStyles = {\n [`&:has([${ROW_LINK_ATTRIBUTE}])`]: {\n position: 'relative',\n },\n // Not at zero specificity, so that it wins over the `all: unset` of controls such as Checkbox.\n [`&:has([${ROW_LINK_ATTRIBUTE}]) ${ROW_LINK_CONTROLS}`]: {\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n },\n};\n\nexport type RowLinkProps = React.ComponentProps<typeof StyledRowLink> & {\n asChild?: boolean;\n css?: CSS;\n};\n\n/**\n * A link that covers its whole table row, so that a click on the row opens it.\n * Other links and buttons in the row stay above it.\n */\nexport const RowLink = React.forwardRef<HTMLAnchorElement, RowLinkProps>(\n ({ asChild, ...props }, forwardedRef) => {\n const Component = asChild ? StyledRowLinkSlot : StyledRowLink;\n\n return <Component ref={forwardedRef} {...{ [ROW_LINK_ATTRIBUTE]: '' }} {...props} />;\n },\n);\n\nRowLink.displayName = 'RowLink';\n\nexport type RowLinkShortcutProps = {\n href?: string;\n /**\n * The link component, for example a router link. It must pass its props and ref to its `<a>`,\n * and it must be defined outside render, or the link mounts again on each render.\n */\n linkAs?: ElementType;\n /** Other props for the link component, for example `{ returnTo }`. */\n linkProps?: Record<string, unknown>;\n /** The index of the cell that holds the link, among the direct children of the row. */\n linkCell?: number;\n};\n\ntype StitchesType = { className?: string; [STITCHES_INTERNAL]?: { type?: unknown } };\n\n// A Stitches `styled(Td)` keeps the class name of a Stitches Td, or renders a component Td.\n// This reads Stitches 1.x internals; the styled Td tests catch a change in them.\nconst isCellType = (type: unknown, cellType: ElementType) => {\n if (type === cellType) {\n return true;\n }\n if (!type || (typeof type !== 'object' && typeof type !== 'function')) {\n return false;\n }\n const { className, [STITCHES_INTERNAL]: internal } = type as StitchesType;\n const cellClassName = (cellType as StitchesType).className;\n return internal?.type === cellType || (!!cellClassName && className === cellClassName);\n};\n\nconst warnedMessages = new Set<string>();\n\n/** Clears the warnings that were already logged. For tests only. */\nexport const resetRowLinkWarnings = () => warnedMessages.clear();\n\nconst warnOnce = (message: string) => {\n if (typeof process !== 'undefined' && process.env.NODE_ENV === 'production') {\n return;\n }\n if (!warnedMessages.has(message)) {\n warnedMessages.add(message);\n console.warn(message);\n }\n};\n\n/** Puts the content of the `cellType` cell at `linkCell` in a `RowLink` to `href`. */\nexport const withRowLink = (\n children: ReactNode,\n { href, linkAs: LinkComponent = 'a', linkCell = 0, linkProps }: RowLinkShortcutProps,\n cellType: ElementType,\n) => {\n if (href === undefined) {\n return children;\n }\n\n let cellIndex = -1;\n let linked = false;\n // eslint-disable-next-line @eslint-react/no-children-map\n const mapped = Children.map(children, (child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) {\n return child;\n }\n cellIndex += 1;\n if (cellIndex !== linkCell || !isCellType(child.type, cellType)) {\n return child;\n }\n linked = true;\n // eslint-disable-next-line @eslint-react/no-clone-element\n return cloneElement(\n child,\n undefined,\n <RowLink asChild>\n <LinkComponent {...linkProps} href={href}>\n {child.props.children}\n </LinkComponent>\n </RowLink>,\n );\n });\n\n if (!linked) {\n warnOnce(\n `Tr: the child at linkCell ${linkCell} is not a Td, so the row has no link. Use a Td for that cell, or put a RowLink in it.`,\n );\n }\n\n return mapped;\n};\n"],"mappings":";;;;;AAKA,IAAM,qBAAqB;AAC3B,IAAM,oBAAoB,OAAO,IAAI,cAAc;AAEnD,IAAM,mBAAmB;AAEzB,IAAM,oBAAo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