@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":"Checkbox.cjs","names":["styled","CheckboxPrimitive","React","CheckIcon"],"sources":["../../../components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\n\nconst StyledIndicator = styled(CheckboxPrimitive.Indicator, {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n});\n\nconst StyledCheckbox = styled(CheckboxPrimitive.Root, {\n all: 'unset',\n border: 'none',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\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 WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n overflow: 'hidden',\n\n '&[data-state=checked]': {\n backgroundColor: '$checkboxCheckedBg',\n boxShadow: 'inset 0 0 0 1px transparent',\n color: '$checkboxCheckedIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxCheckedHoverBg',\n },\n },\n },\n\n '&[data-state=unchecked]': {\n backgroundColor: '$checkboxBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxBorder',\n color: '$checkboxIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxHoverBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxHoverBorder',\n },\n },\n },\n\n '&:focus': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n backgroundColor: '$checkboxDisabledBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxDisabledBorder',\n '&::placeholder': {\n color: '$checkboxDisabledText',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$checkboxIndicatorDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n medium: {\n width: 18,\n height: 18,\n borderRadius: '$2',\n },\n large: {\n width: '$5',\n height: '$5',\n borderRadius: '$3',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\ntype CheckboxPrimitiveProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'as'>;\nexport type CheckboxVariants = VariantProps<typeof StyledCheckbox>;\nexport type CheckboxProps = CheckboxPrimitiveProps & CheckboxVariants & { css?: CSS };\n\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof StyledCheckbox>, CheckboxProps>(\n (props, forwardedRef) => {\n return (\n <StyledCheckbox {...props} ref={forwardedRef}>\n <StyledIndicator>\n <CheckIcon height={40} width={40} />\n </StyledIndicator>\n </StyledCheckbox>\n );\n }\n);\n"],"mappings":";;;;;;;;;AAMA,IAAM,kBAAkBA,wBAAAA,OAAOC,yBAAkB,WAAW;CAC1D,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT,CAAC;AAED,IAAM,iBAAiBD,wBAAAA,OAAOC,yBAAkB,MAAM;CACpD,KAAK;CACL,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAEA,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,SAAS;CACT,yBAAyB;CACzB,UAAU;CAEV,yBAAyB;EACvB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW,EACT,iBAAiB,0BACnB,EACF;CACF;CAEA,2BAA2B;EACzB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW;GACT,iBAAiB;GACjB,WAAW;EACb,EACF;CACF;CAEA,WAAW;EACT,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,kBAAkB,EAChB,OAAO,wBACT;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,+BACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,QAAQ;GACN,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;CACF,EACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAMD,IAAa,WAAWC,MAAAA,QAAM,YAC3B,OAAO,iBAAiB;CACvB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD;EAAgB,GAAI;EAAO,KAAK;EAC9B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;GAAW,QAAQ;GAAI,OAAO;EAAK,CAAA,EACpB,CAAA;CACH,CAAA;AAEpB,CACF"}
1
+ {"version":3,"file":"Checkbox.cjs","names":["styled","CheckboxPrimitive","React","useFieldControl","CheckIcon"],"sources":["../../../components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { useFieldControl } from '../Field/FieldContext';\n\nconst StyledIndicator = styled(CheckboxPrimitive.Indicator, {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n});\n\nconst StyledCheckbox = styled(CheckboxPrimitive.Root, {\n all: 'unset',\n border: 'none',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\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 WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n overflow: 'hidden',\n\n '&[data-state=checked]': {\n backgroundColor: '$checkboxCheckedBg',\n boxShadow: 'inset 0 0 0 1px transparent',\n color: '$checkboxCheckedIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxCheckedHoverBg',\n },\n },\n },\n\n '&[data-state=unchecked]': {\n backgroundColor: '$checkboxBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxBorder',\n color: '$checkboxIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxHoverBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxHoverBorder',\n },\n },\n },\n\n '&[aria-invalid=\"true\"][data-state=unchecked]:not(:focus)': {\n boxShadow: 'inset 0 0 0 1px $colors$checkboxInvalidBorder',\n },\n\n '&:focus': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n backgroundColor: '$checkboxDisabledBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxDisabledBorder',\n '&::placeholder': {\n color: '$checkboxDisabledText',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$checkboxIndicatorDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n medium: {\n width: 18,\n height: 18,\n borderRadius: '$2',\n },\n large: {\n width: '$5',\n height: '$5',\n borderRadius: '$3',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\ntype CheckboxPrimitiveProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'as'>;\nexport type CheckboxVariants = VariantProps<typeof StyledCheckbox>;\nexport type CheckboxProps = CheckboxPrimitiveProps & CheckboxVariants & { css?: CSS };\n\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof StyledCheckbox>, CheckboxProps>(\n (\n { id, disabled, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...props },\n forwardedRef,\n ) => {\n const control = useFieldControl({\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n\n return (\n <StyledCheckbox\n {...props}\n id={control.id}\n disabled={control.disabled}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n ref={forwardedRef}\n >\n <StyledIndicator>\n <CheckIcon height={40} width={40} aria-hidden />\n </StyledIndicator>\n </StyledCheckbox>\n );\n },\n);\n"],"mappings":";;;;;;;;;;AAOA,IAAM,kBAAkBA,wBAAAA,OAAOC,yBAAkB,WAAW;CAC1D,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT,CAAC;AAED,IAAM,iBAAiBD,wBAAAA,OAAOC,yBAAkB,MAAM;CACpD,KAAK;CACL,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAEA,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,SAAS;CACT,yBAAyB;CACzB,UAAU;CAEV,yBAAyB;EACvB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW,EACT,iBAAiB,0BACnB,EACF;CACF;CAEA,2BAA2B;EACzB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW;GACT,iBAAiB;GACjB,WAAW;EACb,EACF;CACF;CAEA,8DAA4D,EAC1D,WAAW,gDACb;CAEA,WAAW;EACT,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,kBAAkB,EAChB,OAAO,wBACT;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,+BACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,QAAQ;GACN,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;CACF,EACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAMD,IAAa,WAAWC,MAAAA,QAAM,YAE1B,EAAE,IAAI,UAAU,oBAAoB,iBAAiB,gBAAgB,aAAa,GAAG,SACrF,iBACG;CACH,MAAM,UAAUC,qBAAAA,gBAAgB;EAC9B;EACA;EACA,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD;EACE,GAAI;EACJ,IAAI,QAAQ;EACZ,UAAU,QAAQ;EAClB,oBAAkB,QAAQ;EAC1B,gBAAc,QAAQ;EACtB,KAAK;EAEL,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;GAAW,QAAQ;GAAI,OAAO;GAAI,eAAA;EAAa,CAAA,EAChC,CAAA;CACH,CAAA;AAEpB,CACF"}
@@ -1,4 +1,5 @@
1
1
  import { styled } from "../../stitches.config.js";
2
+ import { useFieldControl } from "../Field/FieldContext.js";
2
3
  import { CheckIcon } from "@radix-ui/react-icons";
3
4
  import React from "react";
4
5
  import { jsx } from "react/jsx-runtime";
@@ -43,6 +44,7 @@ var StyledCheckbox = styled(CheckboxPrimitive.Root, {
43
44
  boxShadow: "inset 0 0 0 1px $colors$checkboxHoverBorder"
44
45
  } }
45
46
  },
47
+ "&[aria-invalid=\"true\"][data-state=unchecked]:not(:focus)": { boxShadow: "inset 0 0 0 1px $colors$checkboxInvalidBorder" },
46
48
  "&:focus": {
47
49
  outline: "none",
48
50
  boxShadow: "inset 0 0 0 1px $colors$checkboxFocusBorder"
@@ -68,13 +70,24 @@ var StyledCheckbox = styled(CheckboxPrimitive.Root, {
68
70
  } },
69
71
  defaultVariants: { size: "medium" }
70
72
  });
71
- var Checkbox = React.forwardRef((props, forwardedRef) => {
73
+ var Checkbox = React.forwardRef(({ id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
74
+ const control = useFieldControl({
75
+ id,
76
+ disabled,
77
+ "aria-describedby": ariaDescribedBy,
78
+ "aria-invalid": ariaInvalid
79
+ });
72
80
  return /* @__PURE__ */ jsx(StyledCheckbox, {
73
81
  ...props,
82
+ id: control.id,
83
+ disabled: control.disabled,
84
+ "aria-describedby": control["aria-describedby"],
85
+ "aria-invalid": control["aria-invalid"],
74
86
  ref: forwardedRef,
75
87
  children: /* @__PURE__ */ jsx(StyledIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {
76
88
  height: 40,
77
- width: 40
89
+ width: 40,
90
+ "aria-hidden": true
78
91
  }) })
79
92
  });
80
93
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":[],"sources":["../../../components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\n\nconst StyledIndicator = styled(CheckboxPrimitive.Indicator, {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n});\n\nconst StyledCheckbox = styled(CheckboxPrimitive.Root, {\n all: 'unset',\n border: 'none',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\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 WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n overflow: 'hidden',\n\n '&[data-state=checked]': {\n backgroundColor: '$checkboxCheckedBg',\n boxShadow: 'inset 0 0 0 1px transparent',\n color: '$checkboxCheckedIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxCheckedHoverBg',\n },\n },\n },\n\n '&[data-state=unchecked]': {\n backgroundColor: '$checkboxBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxBorder',\n color: '$checkboxIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxHoverBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxHoverBorder',\n },\n },\n },\n\n '&:focus': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n backgroundColor: '$checkboxDisabledBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxDisabledBorder',\n '&::placeholder': {\n color: '$checkboxDisabledText',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$checkboxIndicatorDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n medium: {\n width: 18,\n height: 18,\n borderRadius: '$2',\n },\n large: {\n width: '$5',\n height: '$5',\n borderRadius: '$3',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\ntype CheckboxPrimitiveProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'as'>;\nexport type CheckboxVariants = VariantProps<typeof StyledCheckbox>;\nexport type CheckboxProps = CheckboxPrimitiveProps & CheckboxVariants & { css?: CSS };\n\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof StyledCheckbox>, CheckboxProps>(\n (props, forwardedRef) => {\n return (\n <StyledCheckbox {...props} ref={forwardedRef}>\n <StyledIndicator>\n <CheckIcon height={40} width={40} />\n </StyledIndicator>\n </StyledCheckbox>\n );\n }\n);\n"],"mappings":";;;;;;AAMA,IAAM,kBAAkB,OAAO,kBAAkB,WAAW;CAC1D,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT,CAAC;AAED,IAAM,iBAAiB,OAAO,kBAAkB,MAAM;CACpD,KAAK;CACL,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAEA,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,SAAS;CACT,yBAAyB;CACzB,UAAU;CAEV,yBAAyB;EACvB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW,EACT,iBAAiB,0BACnB,EACF;CACF;CAEA,2BAA2B;EACzB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW;GACT,iBAAiB;GACjB,WAAW;EACb,EACF;CACF;CAEA,WAAW;EACT,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,kBAAkB,EAChB,OAAO,wBACT;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,+BACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,QAAQ;GACN,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;CACF,EACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAMD,IAAa,WAAW,MAAM,YAC3B,OAAO,iBAAiB;CACvB,OACE,oBAAC,gBAAD;EAAgB,GAAI;EAAO,KAAK;EAC9B,UAAA,oBAAC,iBAAD,EAAA,UACE,oBAAC,WAAD;GAAW,QAAQ;GAAI,OAAO;EAAK,CAAA,EACpB,CAAA;CACH,CAAA;AAEpB,CACF"}
1
+ {"version":3,"file":"Checkbox.js","names":[],"sources":["../../../components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { useFieldControl } from '../Field/FieldContext';\n\nconst StyledIndicator = styled(CheckboxPrimitive.Indicator, {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n});\n\nconst StyledCheckbox = styled(CheckboxPrimitive.Root, {\n all: 'unset',\n border: 'none',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\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 WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n overflow: 'hidden',\n\n '&[data-state=checked]': {\n backgroundColor: '$checkboxCheckedBg',\n boxShadow: 'inset 0 0 0 1px transparent',\n color: '$checkboxCheckedIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxCheckedHoverBg',\n },\n },\n },\n\n '&[data-state=unchecked]': {\n backgroundColor: '$checkboxBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxBorder',\n color: '$checkboxIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxHoverBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxHoverBorder',\n },\n },\n },\n\n '&[aria-invalid=\"true\"][data-state=unchecked]:not(:focus)': {\n boxShadow: 'inset 0 0 0 1px $colors$checkboxInvalidBorder',\n },\n\n '&:focus': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n backgroundColor: '$checkboxDisabledBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxDisabledBorder',\n '&::placeholder': {\n color: '$checkboxDisabledText',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$checkboxIndicatorDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n medium: {\n width: 18,\n height: 18,\n borderRadius: '$2',\n },\n large: {\n width: '$5',\n height: '$5',\n borderRadius: '$3',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\ntype CheckboxPrimitiveProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'as'>;\nexport type CheckboxVariants = VariantProps<typeof StyledCheckbox>;\nexport type CheckboxProps = CheckboxPrimitiveProps & CheckboxVariants & { css?: CSS };\n\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof StyledCheckbox>, CheckboxProps>(\n (\n { id, disabled, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...props },\n forwardedRef,\n ) => {\n const control = useFieldControl({\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n\n return (\n <StyledCheckbox\n {...props}\n id={control.id}\n disabled={control.disabled}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n ref={forwardedRef}\n >\n <StyledIndicator>\n <CheckIcon height={40} width={40} aria-hidden />\n </StyledIndicator>\n </StyledCheckbox>\n );\n },\n);\n"],"mappings":";;;;;;;AAOA,IAAM,kBAAkB,OAAO,kBAAkB,WAAW;CAC1D,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT,CAAC;AAED,IAAM,iBAAiB,OAAO,kBAAkB,MAAM;CACpD,KAAK;CACL,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAEA,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,SAAS;CACT,yBAAyB;CACzB,UAAU;CAEV,yBAAyB;EACvB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW,EACT,iBAAiB,0BACnB,EACF;CACF;CAEA,2BAA2B;EACzB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW;GACT,iBAAiB;GACjB,WAAW;EACb,EACF;CACF;CAEA,8DAA4D,EAC1D,WAAW,gDACb;CAEA,WAAW;EACT,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,kBAAkB,EAChB,OAAO,wBACT;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,+BACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,QAAQ;GACN,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;CACF,EACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAMD,IAAa,WAAW,MAAM,YAE1B,EAAE,IAAI,UAAU,oBAAoB,iBAAiB,gBAAgB,aAAa,GAAG,SACrF,iBACG;CACH,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CAED,OACE,oBAAC,gBAAD;EACE,GAAI;EACJ,IAAI,QAAQ;EACZ,UAAU,QAAQ;EAClB,oBAAkB,QAAQ;EAC1B,gBAAc,QAAQ;EACtB,KAAK;EAEL,UAAA,oBAAC,iBAAD,EAAA,UACE,oBAAC,WAAD;GAAW,QAAQ;GAAI,OAAO;GAAI,eAAA;EAAa,CAAA,EAChC,CAAA;CACH,CAAA;AAEpB,CACF"}
@@ -16,7 +16,8 @@ var Theme;
16
16
  checkboxFocusBorder: "$primary",
17
17
  checkboxDisabledBg: "$deepBlue3",
18
18
  checkboxDisabledBorder: "$deepBlue5",
19
- checkboxIndicatorDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString()
19
+ checkboxIndicatorDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString(),
20
+ checkboxInvalidBorder: "$red9"
20
21
  });
21
22
  _Theme.getDark = (primaryColor) => ({
22
23
  checkboxIcon: "$deepBlue1",
@@ -30,7 +31,8 @@ var Theme;
30
31
  checkboxFocusBorder: "$primary",
31
32
  checkboxDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString(),
32
33
  checkboxDisabledBorder: "transparent",
33
- checkboxIndicatorDisabledBg: "$deepBlue1"
34
+ checkboxIndicatorDisabledBg: "$deepBlue1",
35
+ checkboxInvalidBorder: "$red9"
34
36
  });
35
37
  })(Theme || (Theme = {}));
36
38
  Object.defineProperty(exports, "Theme", {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.themes.cjs","names":["tinycolor"],"sources":["../../../components/Checkbox/Checkbox.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n checkboxIcon: Property.Color;\n checkboxBg: Property.Color;\n checkboxCheckedBg: Property.Color;\n checkboxBorder: Property.Color;\n checkboxCheckedIcon: Property.Color;\n checkboxCheckedHoverBg: Property.Color;\n checkboxHoverBg: Property.Color;\n checkboxHoverBorder: Property.Color;\n checkboxFocusBorder: Property.Color;\n checkboxDisabledBg: Property.Color;\n checkboxDisabledBorder: Property.Color;\n checkboxIndicatorDisabledBg: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue11',\n checkboxBg: 'transparent',\n checkboxBorder: '$slate8',\n checkboxCheckedBg: '$primary',\n checkboxCheckedIcon: 'white',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).darken().toHslString(),\n checkboxHoverBg: 'transparent',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: '$deepBlue3',\n checkboxDisabledBorder: '$deepBlue5',\n checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n });\n\n export const getDark: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue1',\n checkboxBg: 'transparent',\n checkboxCheckedBg: '$primary',\n checkboxBorder: '$slate9',\n checkboxCheckedIcon: '$deepBlue1',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).lighten(10).toHslString(),\n checkboxHoverBg: '$deepBlue3',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxDisabledBorder: 'transparent',\n checkboxIndicatorDisabledBg: '$deepBlue1',\n });\n}\n"],"mappings":";;;;AAKO,IAAU;CAAV,SAAA,QAAA;CAkBQ,OAAA,YAAqB,kBAAkB;EAClD,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,yBAAA,GAAwBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;EAC3E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;EACpB,wBAAwB;EACxB,8BAAA,GAA6BA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;CACvF;CAEa,OAAA,WAAoB,kBAAkB;EACjD,cAAc;EACd,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,yBAAA,GAAwBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY;EAC9E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,qBAAA,GAAoBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC5E,wBAAwB;EACxB,6BAA6B;CAC/B;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
1
+ {"version":3,"file":"Checkbox.themes.cjs","names":["tinycolor"],"sources":["../../../components/Checkbox/Checkbox.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n checkboxIcon: Property.Color;\n checkboxBg: Property.Color;\n checkboxCheckedBg: Property.Color;\n checkboxBorder: Property.Color;\n checkboxCheckedIcon: Property.Color;\n checkboxCheckedHoverBg: Property.Color;\n checkboxHoverBg: Property.Color;\n checkboxHoverBorder: Property.Color;\n checkboxFocusBorder: Property.Color;\n checkboxDisabledBg: Property.Color;\n checkboxDisabledBorder: Property.Color;\n checkboxIndicatorDisabledBg: Property.Color;\n checkboxInvalidBorder: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue11',\n checkboxBg: 'transparent',\n checkboxBorder: '$slate8',\n checkboxCheckedBg: '$primary',\n checkboxCheckedIcon: 'white',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).darken().toHslString(),\n checkboxHoverBg: 'transparent',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: '$deepBlue3',\n checkboxDisabledBorder: '$deepBlue5',\n checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxInvalidBorder: '$red9',\n });\n\n export const getDark: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue1',\n checkboxBg: 'transparent',\n checkboxCheckedBg: '$primary',\n checkboxBorder: '$slate9',\n checkboxCheckedIcon: '$deepBlue1',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).lighten(10).toHslString(),\n checkboxHoverBg: '$deepBlue3',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxDisabledBorder: 'transparent',\n checkboxIndicatorDisabledBg: '$deepBlue1',\n checkboxInvalidBorder: '$red9',\n });\n}\n"],"mappings":";;;;AAKO,IAAU;CAAV,SAAA,QAAA;CAmBQ,OAAA,YAAqB,kBAAkB;EAClD,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,yBAAA,GAAwBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;EAC3E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;EACpB,wBAAwB;EACxB,8BAAA,GAA6BA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EACrF,uBAAuB;CACzB;CAEa,OAAA,WAAoB,kBAAkB;EACjD,cAAc;EACd,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,yBAAA,GAAwBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY;EAC9E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,qBAAA,GAAoBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC5E,wBAAwB;EACxB,6BAA6B;EAC7B,uBAAuB;CACzB;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
@@ -14,7 +14,8 @@ var Theme;
14
14
  checkboxFocusBorder: "$primary",
15
15
  checkboxDisabledBg: "$deepBlue3",
16
16
  checkboxDisabledBorder: "$deepBlue5",
17
- checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString()
17
+ checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString(),
18
+ checkboxInvalidBorder: "$red9"
18
19
  });
19
20
  _Theme.getDark = (primaryColor) => ({
20
21
  checkboxIcon: "$deepBlue1",
@@ -28,7 +29,8 @@ var Theme;
28
29
  checkboxFocusBorder: "$primary",
29
30
  checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString(),
30
31
  checkboxDisabledBorder: "transparent",
31
- checkboxIndicatorDisabledBg: "$deepBlue1"
32
+ checkboxIndicatorDisabledBg: "$deepBlue1",
33
+ checkboxInvalidBorder: "$red9"
32
34
  });
33
35
  })(Theme || (Theme = {}));
34
36
  export { Theme };
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.themes.js","names":[],"sources":["../../../components/Checkbox/Checkbox.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n checkboxIcon: Property.Color;\n checkboxBg: Property.Color;\n checkboxCheckedBg: Property.Color;\n checkboxBorder: Property.Color;\n checkboxCheckedIcon: Property.Color;\n checkboxCheckedHoverBg: Property.Color;\n checkboxHoverBg: Property.Color;\n checkboxHoverBorder: Property.Color;\n checkboxFocusBorder: Property.Color;\n checkboxDisabledBg: Property.Color;\n checkboxDisabledBorder: Property.Color;\n checkboxIndicatorDisabledBg: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue11',\n checkboxBg: 'transparent',\n checkboxBorder: '$slate8',\n checkboxCheckedBg: '$primary',\n checkboxCheckedIcon: 'white',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).darken().toHslString(),\n checkboxHoverBg: 'transparent',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: '$deepBlue3',\n checkboxDisabledBorder: '$deepBlue5',\n checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n });\n\n export const getDark: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue1',\n checkboxBg: 'transparent',\n checkboxCheckedBg: '$primary',\n checkboxBorder: '$slate9',\n checkboxCheckedIcon: '$deepBlue1',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).lighten(10).toHslString(),\n checkboxHoverBg: '$deepBlue3',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxDisabledBorder: 'transparent',\n checkboxIndicatorDisabledBg: '$deepBlue1',\n });\n}\n"],"mappings":";;AAKO,IAAU;CAAV,SAAA,QAAA;CAkBQ,OAAA,YAAqB,kBAAkB;EAClD,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,wBAAwB,UAAU,aAAa,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;EAC3E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;EACpB,wBAAwB;EACxB,6BAA6B,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;CACvF;CAEa,OAAA,WAAoB,kBAAkB;EACjD,cAAc;EACd,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,wBAAwB,UAAU,aAAa,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY;EAC9E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC5E,wBAAwB;EACxB,6BAA6B;CAC/B;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
1
+ {"version":3,"file":"Checkbox.themes.js","names":[],"sources":["../../../components/Checkbox/Checkbox.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n checkboxIcon: Property.Color;\n checkboxBg: Property.Color;\n checkboxCheckedBg: Property.Color;\n checkboxBorder: Property.Color;\n checkboxCheckedIcon: Property.Color;\n checkboxCheckedHoverBg: Property.Color;\n checkboxHoverBg: Property.Color;\n checkboxHoverBorder: Property.Color;\n checkboxFocusBorder: Property.Color;\n checkboxDisabledBg: Property.Color;\n checkboxDisabledBorder: Property.Color;\n checkboxIndicatorDisabledBg: Property.Color;\n checkboxInvalidBorder: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue11',\n checkboxBg: 'transparent',\n checkboxBorder: '$slate8',\n checkboxCheckedBg: '$primary',\n checkboxCheckedIcon: 'white',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).darken().toHslString(),\n checkboxHoverBg: 'transparent',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: '$deepBlue3',\n checkboxDisabledBorder: '$deepBlue5',\n checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxInvalidBorder: '$red9',\n });\n\n export const getDark: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue1',\n checkboxBg: 'transparent',\n checkboxCheckedBg: '$primary',\n checkboxBorder: '$slate9',\n checkboxCheckedIcon: '$deepBlue1',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).lighten(10).toHslString(),\n checkboxHoverBg: '$deepBlue3',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxDisabledBorder: 'transparent',\n checkboxIndicatorDisabledBg: '$deepBlue1',\n checkboxInvalidBorder: '$red9',\n });\n}\n"],"mappings":";;AAKO,IAAU;CAAV,SAAA,QAAA;CAmBQ,OAAA,YAAqB,kBAAkB;EAClD,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,wBAAwB,UAAU,aAAa,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;EAC3E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;EACpB,wBAAwB;EACxB,6BAA6B,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EACrF,uBAAuB;CACzB;CAEa,OAAA,WAAoB,kBAAkB;EACjD,cAAc;EACd,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,wBAAwB,UAAU,aAAa,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY;EAC9E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC5E,wBAAwB;EACxB,6BAA6B;EAC7B,uBAAuB;CACzB;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
@@ -87,7 +87,7 @@ var DateTimePickerInput = react.default.forwardRef(({ inputCSS, inputProps, onCh
87
87
  ref: fowardedRef,
88
88
  children: [
89
89
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.Input, {
90
- startAdornment: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.CalendarIcon, {}),
90
+ startAdornment: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.CalendarIcon, { "aria-hidden": true }),
91
91
  ...getReferenceProps(),
92
92
  ...inputProps,
93
93
  css: {
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimePickerInput.cjs","names":["styled","React","useRef","useState","useMemo","offset","flip","shift","arrow","useFloating","autoUpdate","useClick","useDismiss","useRole","useInteractions","Input","CalendarIcon","parse","FloatingFocusManager","Card","DateTimePicker","format","FloatingArrow"],"sources":["../../../components/DateTimePickerInput/DateTimePickerInput.tsx"],"sourcesContent":["import {\n arrow,\n autoUpdate,\n flip,\n FloatingArrow,\n FloatingFocusManager,\n offset,\n Placement,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { CalendarIcon } from '@radix-ui/react-icons';\nimport { DPUserConfig } from '@rehookify/datepicker';\nimport { format, parse } from 'date-fns';\nimport React, { MouseEventHandler, Ref, useMemo, useRef, useState } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\nimport { DateTimePicker } from '../DateTimePicker';\nimport { Input, InputHandle } from '../Input';\n\nconst StyledWrapper = styled('div', {\n display: 'flex',\n position: 'relative',\n width: '100%',\n\n '& .firefox-patch': {\n display: 'none',\n },\n\n '@supports (-moz-appearance: none)': {\n '& .firefox-patch': {\n display: 'block',\n width: '20px',\n height: '20px',\n position: 'absolute',\n right: '17px',\n top: '6px',\n background: '$inputBg',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$inputFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n },\n\n '@hover': {\n '&:hover .firefox-patch': {\n '&::before': {\n backgroundColor: '$inputHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n },\n});\n\nexport type DateTimePickerInputProps = Omit<DPUserConfig, 'onDatesChange' | 'selectedDates'> & {\n inputCSS?: CSS;\n inputProps?: Omit<typeof Input, 'css' | 'onChange' | 'ref' | 'value'>;\n onChange?: (d: Date[]) => void;\n pickerCSS?: CSS;\n pickerPlacement?: Placement;\n showDatePresets?: boolean;\n showTimePicker?: boolean;\n};\n\nexport type DateTimePickerInputVariants = VariantProps<DateTimePickerInputProps>;\n\nexport const DateTimePickerInput = React.forwardRef<\n React.ElementRef<typeof StyledWrapper>,\n DateTimePickerInputProps\n>(\n (\n {\n inputCSS,\n inputProps,\n onChange,\n pickerCSS,\n pickerPlacement,\n showDatePresets,\n showTimePicker,\n ...pickerProps\n },\n fowardedRef,\n ) => {\n const formatStr = \"yyyy-MM-dd'T'HH:mm\";\n\n const arrowRef = useRef(null);\n\n const [inputValue, setInputValue] = useState<string>('');\n const [selectedDates, setSelectedDates] = useState<Date[]>([]);\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n\n const middleware = useMemo(\n () => [\n offset(10),\n flip(),\n shift(),\n // arrowRef is passed to floating-ui which handles it correctly\n arrow({ element: arrowRef }),\n ],\n [],\n );\n\n const { refs, floatingStyles, context } = useFloating({\n open: isPickerOpen,\n onOpenChange: setIsPickerOpen,\n placement: pickerPlacement,\n middleware,\n whileElementsMounted: autoUpdate,\n });\n\n const click = useClick(context);\n const dismiss = useDismiss(context);\n const role = useRole(context);\n\n const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);\n const { onClick: onFirefoxPatchClick } = getReferenceProps();\n\n return (\n <StyledWrapper ref={fowardedRef}>\n <Input\n startAdornment={<CalendarIcon />}\n {...getReferenceProps()}\n {...inputProps}\n css={{ '& input::-webkit-calendar-picker-indicator': { display: 'none' }, ...inputCSS }}\n onChange={(evt) => {\n const value = evt.currentTarget.value;\n setInputValue(value);\n try {\n const newDates = (value as string)\n .split(',')\n .map((d) => parse(d.trim(), formatStr, new Date()));\n setSelectedDates(newDates);\n if (onChange) onChange(newDates);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n // empty\n }\n }}\n ref={refs.setReference as Ref<InputHandle>}\n type=\"datetime-local\"\n value={inputValue}\n />\n <div\n className=\"firefox-patch\"\n onClick={onFirefoxPatchClick as MouseEventHandler<HTMLDivElement>}\n />\n {isPickerOpen && (\n <FloatingFocusManager context={context} initialFocus={-1} modal={false}>\n {/* refs.setFloating is a stable callback ref from floating-ui */}\n <div ref={refs.setFloating} style={floatingStyles} {...getFloatingProps()}>\n <Card>\n <DateTimePicker\n {...pickerProps}\n css={pickerCSS}\n onDatesChange={(d) => {\n setSelectedDates(d);\n setInputValue(d.map((date) => format(date, formatStr)).join(', '));\n if (onChange) onChange(d);\n }}\n onFastTravelClick={() => setIsPickerOpen(false)}\n onTimeButtonClick={() => setIsPickerOpen(false)}\n selectedDates={selectedDates}\n showDatePresets={showDatePresets}\n showTimePicker={showTimePicker}\n />\n </Card>\n <FloatingArrow ref={arrowRef} context={context} fill=\"var(--colors-01dp)\" />\n </div>\n </FloatingFocusManager>\n )}\n </StyledWrapper>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;AAyBA,IAAM,gBAAgBA,wBAAAA,OAAO,OAAO;CAClC,SAAS;CACT,UAAU;CACV,OAAO;CAEP,oBAAoB,EAClB,SAAS,OACX;CAEA,qCAAqC;EACnC,oBAAoB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACR,UAAU;GACV,OAAO;GACP,KAAK;GACL,YAAY;GAEZ,aAAa;IACX,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,eAAe;GACjB;GACA,YAAY;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,eAAe;GACjB;GAEA,mBAAmB;IACjB,aAAa,EACX,iBAAiB,gBACnB;IACA,YAAY;KACV,iBAAiB;KACjB,SAAS;IACX;GACF;EACF;EAEA,UAAU,EACR,0BAA0B;GACxB,aAAa,EACX,iBAAiB,gBACnB;GACA,YAAY;IACV,iBAAiB;IACjB,SAAS;GACX;EACF,EACF;CACF;AACF,CAAC;AAcD,IAAa,sBAAsBC,MAAAA,QAAM,YAKrC,EACE,UACA,YACA,UACA,WACA,iBACA,iBACA,gBACA,GAAG,eAEL,gBACG;CACH,MAAM,YAAY;CAElB,MAAM,YAAA,GAAWC,MAAAA,OAAAA,CAAO,IAAI;CAE5B,MAAM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AAK;KACnB,IAAI;MACF,MAAM,WAAY,MACf,MAAM,GAAG,CAAC,CACV,KAAK,OAAA,GAAMC,SAAAA,MAAAA,CAAM,EAAE,KAAK,GAAG,2BAAW,IAAI,KAAK,CAAC,CAAC;MACpD,iBAAiB,QAAQ;MACzB,IAAI,UAAU,SAAS,QAAQ;KAEjC,SAAS,KAAK,CAEd;IACF;IACA,KAAK,KAAK;IACV,MAAK;IACL,OAAO;GACR,CAAA;GACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACE,WAAU;IACV,SAAS;GACV,CAAA;GACA,gBACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,sBAAD;IAA+B;IAAS,cAAc;IAAI,OAAO;IAE/D,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;KAAK,KAAK,KAAK;KAAa,OAAO;KAAgB,GAAI,iBAAiB;KAAxE,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,aAAAA,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,gBAAD;MACE,GAAI;MACJ,KAAK;MACL,gBAAgB,MAAM;OACpB,iBAAiB,CAAC;OAClB,cAAc,EAAE,KAAK,UAAA,GAASC,SAAAA,OAAAA,CAAO,MAAM,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;OACjE,IAAI,UAAU,SAAS,CAAC;MAC1B;MACA,yBAAyB,gBAAgB,KAAK;MAC9C,yBAAyB,gBAAgB,KAAK;MAC/B;MACE;MACD;KACjB,CAAA,EACG,CAAA,GACN,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,eAAD;MAAe,KAAK;MAAmB;MAAS,MAAK;KAAsB,CAAA,CACxE;;GACe,CAAA;EAEX;;AAEnB,CACF"}
1
+ {"version":3,"file":"DateTimePickerInput.cjs","names":["styled","React","useRef","useState","useMemo","offset","flip","shift","arrow","useFloating","autoUpdate","useClick","useDismiss","useRole","useInteractions","Input","CalendarIcon","parse","FloatingFocusManager","Card","DateTimePicker","format","FloatingArrow"],"sources":["../../../components/DateTimePickerInput/DateTimePickerInput.tsx"],"sourcesContent":["import {\n arrow,\n autoUpdate,\n flip,\n FloatingArrow,\n FloatingFocusManager,\n offset,\n Placement,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { CalendarIcon } from '@radix-ui/react-icons';\nimport { DPUserConfig } from '@rehookify/datepicker';\nimport { format, parse } from 'date-fns';\nimport React, { MouseEventHandler, Ref, useMemo, useRef, useState } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\nimport { DateTimePicker } from '../DateTimePicker';\nimport { Input, InputHandle } from '../Input';\n\nconst StyledWrapper = styled('div', {\n display: 'flex',\n position: 'relative',\n width: '100%',\n\n '& .firefox-patch': {\n display: 'none',\n },\n\n '@supports (-moz-appearance: none)': {\n '& .firefox-patch': {\n display: 'block',\n width: '20px',\n height: '20px',\n position: 'absolute',\n right: '17px',\n top: '6px',\n background: '$inputBg',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$inputFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n },\n\n '@hover': {\n '&:hover .firefox-patch': {\n '&::before': {\n backgroundColor: '$inputHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n },\n});\n\nexport type DateTimePickerInputProps = Omit<DPUserConfig, 'onDatesChange' | 'selectedDates'> & {\n inputCSS?: CSS;\n inputProps?: Omit<typeof Input, 'css' | 'onChange' | 'ref' | 'value'>;\n onChange?: (d: Date[]) => void;\n pickerCSS?: CSS;\n pickerPlacement?: Placement;\n showDatePresets?: boolean;\n showTimePicker?: boolean;\n};\n\nexport type DateTimePickerInputVariants = VariantProps<DateTimePickerInputProps>;\n\nexport const DateTimePickerInput = React.forwardRef<\n React.ElementRef<typeof StyledWrapper>,\n DateTimePickerInputProps\n>(\n (\n {\n inputCSS,\n inputProps,\n onChange,\n pickerCSS,\n pickerPlacement,\n showDatePresets,\n showTimePicker,\n ...pickerProps\n },\n fowardedRef,\n ) => {\n const formatStr = \"yyyy-MM-dd'T'HH:mm\";\n\n const arrowRef = useRef(null);\n\n const [inputValue, setInputValue] = useState<string>('');\n const [selectedDates, setSelectedDates] = useState<Date[]>([]);\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n\n const middleware = useMemo(\n () => [\n offset(10),\n flip(),\n shift(),\n // arrowRef is passed to floating-ui which handles it correctly\n arrow({ element: arrowRef }),\n ],\n [],\n );\n\n const { refs, floatingStyles, context } = useFloating({\n open: isPickerOpen,\n onOpenChange: setIsPickerOpen,\n placement: pickerPlacement,\n middleware,\n whileElementsMounted: autoUpdate,\n });\n\n const click = useClick(context);\n const dismiss = useDismiss(context);\n const role = useRole(context);\n\n const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);\n const { onClick: onFirefoxPatchClick } = getReferenceProps();\n\n return (\n <StyledWrapper ref={fowardedRef}>\n <Input\n startAdornment={<CalendarIcon aria-hidden />}\n {...getReferenceProps()}\n {...inputProps}\n css={{ '& input::-webkit-calendar-picker-indicator': { display: 'none' }, ...inputCSS }}\n onChange={(evt) => {\n const value = evt.currentTarget.value;\n setInputValue(value);\n try {\n const newDates = (value as string)\n .split(',')\n .map((d) => parse(d.trim(), formatStr, new Date()));\n setSelectedDates(newDates);\n if (onChange) onChange(newDates);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n // empty\n }\n }}\n ref={refs.setReference as Ref<InputHandle>}\n type=\"datetime-local\"\n value={inputValue}\n />\n <div\n className=\"firefox-patch\"\n onClick={onFirefoxPatchClick as MouseEventHandler<HTMLDivElement>}\n />\n {isPickerOpen && (\n <FloatingFocusManager context={context} initialFocus={-1} modal={false}>\n {/* refs.setFloating is a stable callback ref from floating-ui */}\n <div ref={refs.setFloating} style={floatingStyles} {...getFloatingProps()}>\n <Card>\n <DateTimePicker\n {...pickerProps}\n css={pickerCSS}\n onDatesChange={(d) => {\n setSelectedDates(d);\n setInputValue(d.map((date) => format(date, formatStr)).join(', '));\n if (onChange) onChange(d);\n }}\n onFastTravelClick={() => setIsPickerOpen(false)}\n onTimeButtonClick={() => setIsPickerOpen(false)}\n selectedDates={selectedDates}\n showDatePresets={showDatePresets}\n showTimePicker={showTimePicker}\n />\n </Card>\n <FloatingArrow ref={arrowRef} context={context} fill=\"var(--colors-01dp)\" />\n </div>\n </FloatingFocusManager>\n )}\n </StyledWrapper>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;AAyBA,IAAM,gBAAgBA,wBAAAA,OAAO,OAAO;CAClC,SAAS;CACT,UAAU;CACV,OAAO;CAEP,oBAAoB,EAClB,SAAS,OACX;CAEA,qCAAqC;EACnC,oBAAoB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACR,UAAU;GACV,OAAO;GACP,KAAK;GACL,YAAY;GAEZ,aAAa;IACX,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,eAAe;GACjB;GACA,YAAY;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,eAAe;GACjB;GAEA,mBAAmB;IACjB,aAAa,EACX,iBAAiB,gBACnB;IACA,YAAY;KACV,iBAAiB;KACjB,SAAS;IACX;GACF;EACF;EAEA,UAAU,EACR,0BAA0B;GACxB,aAAa,EACX,iBAAiB,gBACnB;GACA,YAAY;IACV,iBAAiB;IACjB,SAAS;GACX;EACF,EACF;CACF;AACF,CAAC;AAcD,IAAa,sBAAsBC,MAAAA,QAAM,YAKrC,EACE,UACA,YACA,UACA,WACA,iBACA,iBACA,gBACA,GAAG,eAEL,gB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TimePickerInput = React.forwardRef(({ inputCSS, inputProps, onChange, pi
85
85
  ref: fowardedRef,
86
86
  children: [
87
87
  /* @__PURE__ */ jsx(Input, {
88
- startAdornment: /* @__PURE__ */ jsx(CalendarIcon, {}),
88
+ startAdornment: /* @__PURE__ */ jsx(CalendarIcon, { "aria-hidden": true }),
89
89
  ...getReferenceProps(),
90
90
  ...inputProps,
91
91
  css: {
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimePickerInput.js","names":[],"sources":["../../../components/DateTimePickerInput/DateTimePickerInput.tsx"],"sourcesContent":["import {\n arrow,\n autoUpdate,\n flip,\n FloatingArrow,\n FloatingFocusManager,\n offset,\n Placement,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { CalendarIcon } from '@radix-ui/react-icons';\nimport { DPUserConfig } from '@rehookify/datepicker';\nimport { format, parse } from 'date-fns';\nimport React, { MouseEventHandler, Ref, useMemo, useRef, useState } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\nimport { DateTimePicker } from '../DateTimePicker';\nimport { Input, InputHandle } from '../Input';\n\nconst StyledWrapper = styled('div', {\n display: 'flex',\n position: 'relative',\n width: '100%',\n\n '& .firefox-patch': {\n display: 'none',\n },\n\n '@supports (-moz-appearance: none)': {\n '& .firefox-patch': {\n display: 'block',\n width: '20px',\n height: '20px',\n position: 'absolute',\n right: '17px',\n top: '6px',\n background: '$inputBg',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$inputFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n },\n\n '@hover': {\n '&:hover .firefox-patch': {\n '&::before': {\n backgroundColor: '$inputHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n },\n});\n\nexport type DateTimePickerInputProps = Omit<DPUserConfig, 'onDatesChange' | 'selectedDates'> & {\n inputCSS?: CSS;\n inputProps?: Omit<typeof Input, 'css' | 'onChange' | 'ref' | 'value'>;\n onChange?: (d: Date[]) => void;\n pickerCSS?: CSS;\n pickerPlacement?: Placement;\n showDatePresets?: boolean;\n showTimePicker?: boolean;\n};\n\nexport type DateTimePickerInputVariants = VariantProps<DateTimePickerInputProps>;\n\nexport const DateTimePickerInput = React.forwardRef<\n React.ElementRef<typeof StyledWrapper>,\n DateTimePickerInputProps\n>(\n (\n {\n inputCSS,\n inputProps,\n onChange,\n pickerCSS,\n pickerPlacement,\n showDatePresets,\n showTimePicker,\n ...pickerProps\n },\n fowardedRef,\n ) => {\n const formatStr = \"yyyy-MM-dd'T'HH:mm\";\n\n const arrowRef = useRef(null);\n\n const [inputValue, setInputValue] = useState<string>('');\n const [selectedDates, setSelectedDates] = useState<Date[]>([]);\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n\n const middleware = useMemo(\n () => [\n offset(10),\n flip(),\n shift(),\n // arrowRef is passed to floating-ui which handles it correctly\n arrow({ element: arrowRef }),\n ],\n [],\n );\n\n const { refs, floatingStyles, context } = useFloating({\n open: isPickerOpen,\n onOpenChange: setIsPickerOpen,\n placement: pickerPlacement,\n middleware,\n whileElementsMounted: autoUpdate,\n });\n\n const click = useClick(context);\n const dismiss = useDismiss(context);\n const role = useRole(context);\n\n const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);\n const { onClick: onFirefoxPatchClick } = getReferenceProps();\n\n return (\n <StyledWrapper ref={fowardedRef}>\n <Input\n startAdornment={<CalendarIcon />}\n {...getReferenceProps()}\n {...inputProps}\n css={{ '& input::-webkit-calendar-picker-indicator': { display: 'none' }, ...inputCSS }}\n onChange={(evt) => {\n const value = evt.currentTarget.value;\n setInputValue(value);\n try {\n const newDates = (value as string)\n .split(',')\n .map((d) => parse(d.trim(), formatStr, new Date()));\n setSelectedDates(newDates);\n if (onChange) onChange(newDates);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n // empty\n }\n }}\n ref={refs.setReference as Ref<InputHandle>}\n type=\"datetime-local\"\n value={inputValue}\n />\n <div\n className=\"firefox-patch\"\n onClick={onFirefoxPatchClick as MouseEventHandler<HTMLDivElement>}\n />\n {isPickerOpen && (\n <FloatingFocusManager context={context} initialFocus={-1} modal={false}>\n {/* refs.setFloating is a stable callback ref from floating-ui */}\n <div ref={refs.setFloating} style={floatingStyles} {...getFloatingProps()}>\n <Card>\n <DateTimePicker\n {...pickerProps}\n css={pickerCSS}\n onDatesChange={(d) => {\n setSelectedDates(d);\n setInputValue(d.map((date) => format(date, formatStr)).join(', '));\n if (onChange) onChange(d);\n }}\n onFastTravelClick={() => setIsPickerOpen(false)}\n onTimeButtonClick={() => setIsPickerOpen(false)}\n selectedDates={selectedDates}\n showDatePresets={showDatePresets}\n showTimePicker={showTimePicker}\n />\n </Card>\n <FloatingArrow ref={arrowRef} context={context} fill=\"var(--colors-01dp)\" />\n </div>\n </FloatingFocusManager>\n )}\n </StyledWrapper>\n );\n },\n);\n"],"mappings":";;;;;;;;;;AAyBA,IAAM,gBAAgB,OAAO,OAAO;CAClC,SAAS;CACT,UAAU;CACV,OAAO;CAEP,oBAAoB,EAClB,SAAS,OACX;CAEA,qCAAqC;EACnC,oBAAoB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACR,UAAU;GACV,OAAO;GACP,KAAK;GACL,YAAY;GAEZ,aAAa;IACX,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,eAAe;GACjB;GACA,YAAY;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,eAAe;GACjB;GAEA,mBAAmB;IACjB,aAAa,EACX,iBAAiB,gBACnB;IACA,YAAY;KACV,iBAAiB;KACjB,SAAS;IACX;G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,KAAK,CAAC,CAAC;MACpD,iBAAiB,QAAQ;MACzB,IAAI,UAAU,SAAS,QAAQ;KAEjC,SAAS,KAAK,CAEd;IACF;IACA,KAAK,KAAK;IACV,MAAK;IACL,OAAO;GACR,CAAA;GACD,oBAAC,OAAD;IACE,WAAU;IACV,SAAS;GACV,CAAA;GACA,gBACC,oBAAC,sBAAD;IAA+B;IAAS,cAAc;IAAI,OAAO;IAE/D,UAAA,qBAAC,OAAD;KAAK,KAAK,KAAK;KAAa,OAAO;KAAgB,GAAI,iBAAiB;KAAxE,UAAA,CACE,oBAAC,MAAD,EAAA,UACE,oBAAC,gBAAD;MACE,GAAI;MACJ,KAAK;MACL,gBAAgB,MAAM;OACpB,iBAAiB,CAAC;OAClB,cAAc,EAAE,KAAK,SAAS,OAAO,MAAM,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;OACjE,IAAI,UAAU,SAAS,CAAC;MAC1B;MACA,yBAAyB,gBAAgB,KAAK;MAC9C,yBAAyB,gBAAgB,KAAK;MAC/B;MACE;MACD;KACjB,CAAA,EACG,CAAA,GACN,oBAAC,eAAD;MAAe,KAAK;MAAmB;MAAS,MAAK;KAAsB,CAAA,CACxE;;GACe,CAAA;EAEX;;AAEnB,CACF"}
1
+ {"version":3,"file":"DateTimePickerInput.js","names":[],"sources":["../../../components/DateTimePickerInput/DateTimePickerInput.tsx"],"sourcesContent":["import {\n arrow,\n autoUpdate,\n flip,\n FloatingArrow,\n FloatingFocusManager,\n offset,\n Placement,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { CalendarIcon } from '@radix-ui/react-icons';\nimport { DPUserConfig } from '@rehookify/datepicker';\nimport { format, parse } from 'date-fns';\nimport React, { MouseEventHandler, Ref, useMemo, useRef, useState } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\nimport { DateTimePicker } from '../DateTimePicker';\nimport { Input, InputHandle } from '../Input';\n\nconst StyledWrapper = styled('div', {\n display: 'flex',\n position: 'relative',\n width: '100%',\n\n '& .firefox-patch': {\n display: 'none',\n },\n\n '@supports (-moz-appearance: none)': {\n '& .firefox-patch': {\n display: 'block',\n width: '20px',\n height: '20px',\n position: 'absolute',\n right: '17px',\n top: '6px',\n background: '$inputBg',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$inputFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n },\n\n '@hover': {\n '&:hover .firefox-patch': {\n '&::before': {\n backgroundColor: '$inputHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n },\n});\n\nexport type DateTimePickerInputProps = Omit<DPUserConfig, 'onDatesChange' | 'selectedDates'> & {\n inputCSS?: CSS;\n inputProps?: Omit<typeof Input, 'css' | 'onChange' | 'ref' | 'value'>;\n onChange?: (d: Date[]) => void;\n pickerCSS?: CSS;\n pickerPlacement?: Placement;\n showDatePresets?: boolean;\n showTimePicker?: boolean;\n};\n\nexport type DateTimePickerInputVariants = VariantProps<DateTimePickerInputProps>;\n\nexport const DateTimePickerInput = React.forwardRef<\n React.ElementRef<typeof StyledWrapper>,\n DateTimePickerInputProps\n>(\n (\n {\n inputCSS,\n inputProps,\n onChange,\n pickerCSS,\n pickerPlacement,\n showDatePresets,\n showTimePicker,\n ...pickerProps\n },\n fowardedRef,\n ) => {\n const formatStr = \"yyyy-MM-dd'T'HH:mm\";\n\n const arrowRef = useRef(null);\n\n const [inputValue, setInputValue] = useState<string>('');\n const [selectedDates, setSelectedDates] = useState<Date[]>([]);\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n\n const middleware = useMemo(\n () => [\n offset(10),\n flip(),\n shift(),\n // arrowRef is passed to floating-ui which handles it correctly\n arrow({ element: arrowRef }),\n ],\n [],\n );\n\n const { refs, floatingStyles, context } = useFloating({\n open: isPickerOpen,\n onOpenChange: setIsPickerOpen,\n placement: pickerPlacement,\n middleware,\n whileElementsMounted: autoUpdate,\n });\n\n const click = useClick(context);\n const dismiss = useDismiss(context);\n const role = useRole(context);\n\n const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);\n const { onClick: onFirefoxPatchClick } = getReferenceProps();\n\n return (\n <StyledWrapper ref={fowardedRef}>\n <Input\n startAdornment={<CalendarIcon aria-hidden />}\n {...getReferenceProps()}\n {...inputProps}\n css={{ '& input::-webkit-calendar-picker-indicator': { display: 'none' }, ...inputCSS }}\n onChange={(evt) => {\n const value = evt.currentTarget.value;\n setInputValue(value);\n try {\n const newDates = (value as string)\n .split(',')\n .map((d) => parse(d.trim(), formatStr, new Date()));\n setSelectedDates(newDates);\n if (onChange) onChange(newDates);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n // empty\n }\n }}\n ref={refs.setReference as Ref<InputHandle>}\n type=\"datetime-local\"\n value={inputValue}\n />\n <div\n className=\"firefox-patch\"\n onClick={onFirefoxPatchClick as MouseEventHandler<HTMLDivElement>}\n />\n {isPickerOpen && (\n <FloatingFocusManager context={context} initialFocus={-1} modal={false}>\n {/* refs.setFloating is a stable callback ref from floating-ui */}\n <div ref={refs.setFloating} style={floatingStyles} {...getFloatingProps()}>\n <Card>\n <DateTimePicker\n {...pickerProps}\n css={pickerCSS}\n onDatesChange={(d) => {\n setSelectedDates(d);\n setInputValue(d.map((date) => format(date, formatStr)).join(', '));\n if (onChange) onChange(d);\n }}\n onFastTravelClick={() => setIsPickerOpen(false)}\n onTimeButtonClick={() => setIsPickerOpen(false)}\n selectedDates={selectedDates}\n showDatePresets={showDatePresets}\n showTimePicker={showTimePicker}\n />\n </Card>\n <FloatingArrow ref={arrowRef} context={context} fill=\"var(--colors-01dp)\" />\n </div>\n </FloatingFocusManager>\n )}\n </StyledWrapper>\n );\n },\n);\n"],"mappings":";;;;;;;;;;AAyBA,IAAM,gBAAgB,OAAO,OAAO;CAClC,SAAS;CACT,UAAU;CACV,OAAO;CAEP,oBAAoB,EAClB,SAAS,OACX;CAEA,qCAAqC;EACnC,oBAAoB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACR,UAAU;GACV,OAAO;GACP,KAAK;GACL,YAAY;GAEZ,aAAa;IACX,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,eAAe;GACjB;GACA,YAAY;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,OAAO;IACP,eAAe;GACjB;GAEA,mBAAmB;IACjB,aAAa,EACX,iBAAiB,gBACnB;IACA,YAAY;KACV,iBAAiB;KACjB,SAAS;IACX;GACF;EACF;EAEA,UAAU,EACR,0BAA0B;GACxB,aAAa,EACX,iBAAiB,gBACnB;GACA,YAAY;IACV,iBAAiB;IACjB,SAAS;GACX;EACF,EACF;CACF;AACF,CAAC;AAcD,IAAa,sBAAsB,MAAM,YAKrC,EACE,UACA,YACA,UACA,WACA,iBACA,iBACA,gBACA,GAAG,eAEL,gBACG;CACH,MAAM,YAAY;CAElB,MAAM,WAAW,OAAO,IAAI;CAE5B,MAAM,CAAC,YAAY,iBAAiB,SAAiB,EAAE;CACvD,MAAM,CAAC,eAAe,oBAAoB,SAAiB,CAAC,CAAC;CAC7D,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CAEtD,MAAM,aAAa,cACX;EACJ,OAAO,EAAE;EACT,KAAK;EACL,MAAM;EAEN,MAAM,EAAE,SAAS,SAAS,CAAC;CAC7B,GACA,CAAC,CACH;CAEA,MAAM,EAAE,MAAM,gBAAgB,YAAY,YAAY;EACpD,MAAM;EACN,cAAc;EACd,WAAW;EACX;EACA,sBAAsB;CACxB,CAAC;CAED,MAAM,QAAQ,SAAS,OAAO;CAC9B,MAAM,UAAU,WAAW,OAAO;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,KAAK;MAAmB;MAAS,MAAK;KAAsB,CAAA,CACxE;;GACe,CAAA;EAEX;;AAEnB,CACF"}
@@ -54,14 +54,15 @@ var DialogCloseIconButton = react.default.forwardRef((props, forwardedRef) => /*
54
54
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IconButton.IconButton, {
55
55
  ref: forwardedRef,
56
56
  css: { color: "$hiContrast" },
57
+ "aria-label": "Close",
57
58
  ...props,
58
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.Cross1Icon, {})
59
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.Cross1Icon, { "aria-hidden": true })
59
60
  })
60
61
  }));
61
- var DialogContent = react.default.forwardRef(({ children, ...props }, forwardedRef) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContent, {
62
+ var DialogContent = react.default.forwardRef(({ children, closeLabel = "Close", ...props }, forwardedRef) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContent, {
62
63
  ...props,
63
64
  ref: forwardedRef,
64
- children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogCloseIconButton, {})]
65
+ children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogCloseIconButton, { "aria-label": closeLabel })]
65
66
  }));
66
67
  var DialogClosePrimitive = _radix_ui_react_dialog.Close;
67
68
  var DialogDescription = _radix_ui_react_dialog.Description;
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.cjs","names":["styled","DialogPrimitive","overlayStyles","Card","elevationVariants","React","IconButton","Cross1Icon"],"sources":["../../../components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Cross1Icon } from '@radix-ui/react-icons';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\nimport { elevationVariants } from '../Elevation/Elevation';\nimport { IconButton } from '../IconButton';\nimport { overlayStyles } from '../Overlay';\n\ntype DialogProps = React.ComponentProps<typeof DialogPrimitive.Root> & {\n children: React.ReactNode;\n};\n\nexport const DialogOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n});\n\nexport function Dialog({ children, ...props }: DialogProps) {\n return <DialogPrimitive.Root {...props}>{children}</DialogPrimitive.Root>;\n}\n\nexport const StyledContent = styled(DialogPrimitive.Content, Card, {\n position: 'fixed',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n minWidth: 200,\n maxHeight: '85vh',\n padding: '$4',\n marginTop: '-5vh',\n backgroundColor: '$dialogBackground',\n boxShadow: 'inset 0 0 0 1px $colors$deepBlue4',\n borderRadius: '$3',\n // animation: `${fadeIn} 125ms linear, ${moveDown} 125ms cubic-bezier(0.22, 1, 0.36, 1)`,\n willChange: 'transform',\n overflow: 'auto',\n\n '&::before': {\n boxShadow: 'none',\n },\n\n '&:focus': {\n outline: 'none',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 5,\n },\n});\n\nconst StyledCloseButton = styled(DialogPrimitive.Close, {\n position: 'absolute',\n top: '$2',\n right: '$2',\n cursor: 'pointer',\n});\n\ninterface DialogCloseButtonProps\n extends VariantProps<typeof IconButton>,\n ComponentProps<typeof IconButton> {}\nexport const DialogCloseIconButton = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n DialogCloseButtonProps\n>((props, forwardedRef) => (\n <StyledCloseButton asChild>\n <IconButton ref={forwardedRef} css={{ color: '$hiContrast' }} {...props}>\n <Cross1Icon />\n </IconButton>\n </StyledCloseButton>\n));\n\ntype DialogContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;\ntype DialogContentProps = DialogContentPrimitiveProps &\n VariantProps<typeof StyledContent> & { css?: CSS };\n\nexport const DialogContent = React.forwardRef<\n React.ElementRef<typeof StyledContent>,\n DialogContentProps\n>(({ children, ...props }, forwardedRef) => (\n <StyledContent {...props} ref={forwardedRef}>\n {children}\n <DialogCloseIconButton />\n </StyledContent>\n));\n\nexport const DialogClosePrimitive = DialogPrimitive.Close;\nexport const DialogDescription = DialogPrimitive.Description;\nexport const DialogPortal = DialogPrimitive.Portal;\nexport const DialogTitle = DialogPrimitive.Title;\nexport const DialogTrigger = DialogPrimitive.Trigger;\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAa,gBAAgBA,wBAAAA,OAAOC,uBAAgB,SAASC,gBAAAA,eAAe;CAC1E,UAAU;CACV,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACR,CAAC;AAED,SAAgB,OAAO,EAAE,UAAU,GAAG,SAAsB;CAC1D,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACD,uBAAgB,MAAjB;EAAsB,GAAI;EAAQ;CAA+B,CAAA;AAC1E;AAEA,IAAa,gBAAgBD,wBAAAA,OAAOC,uBAAgB,SAASE,aAAAA,MAAM;CACjE,UAAU;CACV,KAAK;CACL,MAAM;CACN,WAAW;CACX,UAAU;CACV,WAAW;CACX,SAAS;CACT,WAAW;CACX,iBAAiB;CACjB,WAAW;CACX,cAAc;CAEd,YAAY;CACZ,UAAU;CAEV,aAAa,EACX,WAAW,OACb;CAEA,WAAW,EACT,SAAS,OACX;CAEA,UAAU,EACR,WAAWC,kBAAAA,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC;AAED,IAAM,oBAAoBJ,wBAAAA,OAAOC,uBAAgB,OAAO;CACtD,UAAU;CACV,KAAK;CACL,OAAO;CACP,QAAQ;AACV,CAAC;AAKD,IAAa,wBAAwBI,MAAAA,QAAM,YAGxC,OAAO,iBACR,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;CAAmB,SAAA;CACjB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,YAAD;EAAY,KAAK;EAAc,KAAK,EAAE,OAAO,cAAc;EAAG,GAAI;EAChE,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,YAAD,CAAa,CAAA;CACH,CAAA;AACK,CAAA,CACpB;AAMD,IAAa,gBAAgBF,MAAAA,QAAM,YAGhC,EAAE,UAAU,GAAG,SAAS,iBACzB,iBAAA,GAAA,kBAAA,KAAA,CAAC,eAAD;CAAe,GAAI;CAAO,KAAK;CAA/B,UAAA,CACG,UACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,uBAAD,CAAwB,CAAA,CACX;AAChB,CAAA,CAAA;AAED,IAAa,uBAAuBJ,uBAAgB;AACpD,IAAa,oBAAoBA,uBAAgB;AACjD,IAAa,eAAeA,uBAAgB;AAC5C,IAAa,cAAcA,uBAAgB;AAC3C,IAAa,gBAAgBA,uBAAgB"}
1
+ {"version":3,"file":"Dialog.cjs","names":["styled","DialogPrimitive","overlayStyles","Card","elevationVariants","React","IconButton","Cross1Icon"],"sources":["../../../components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Cross1Icon } from '@radix-ui/react-icons';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\nimport { elevationVariants } from '../Elevation/Elevation';\nimport { IconButton } from '../IconButton';\nimport { overlayStyles } from '../Overlay';\n\ntype DialogProps = React.ComponentProps<typeof DialogPrimitive.Root> & {\n children: React.ReactNode;\n};\n\nexport const DialogOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n});\n\nexport function Dialog({ children, ...props }: DialogProps) {\n return <DialogPrimitive.Root {...props}>{children}</DialogPrimitive.Root>;\n}\n\nexport const StyledContent = styled(DialogPrimitive.Content, Card, {\n position: 'fixed',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n minWidth: 200,\n maxHeight: '85vh',\n padding: '$4',\n marginTop: '-5vh',\n backgroundColor: '$dialogBackground',\n boxShadow: 'inset 0 0 0 1px $colors$deepBlue4',\n borderRadius: '$3',\n // animation: `${fadeIn} 125ms linear, ${moveDown} 125ms cubic-bezier(0.22, 1, 0.36, 1)`,\n willChange: 'transform',\n overflow: 'auto',\n\n '&::before': {\n boxShadow: 'none',\n },\n\n '&:focus': {\n outline: 'none',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 5,\n },\n});\n\nconst StyledCloseButton = styled(DialogPrimitive.Close, {\n position: 'absolute',\n top: '$2',\n right: '$2',\n cursor: 'pointer',\n});\n\ninterface DialogCloseButtonProps\n extends VariantProps<typeof IconButton>, ComponentProps<typeof IconButton> {}\nexport const DialogCloseIconButton = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n DialogCloseButtonProps\n>((props, forwardedRef) => (\n <StyledCloseButton asChild>\n <IconButton ref={forwardedRef} css={{ color: '$hiContrast' }} aria-label=\"Close\" {...props}>\n <Cross1Icon aria-hidden />\n </IconButton>\n </StyledCloseButton>\n));\n\ntype DialogContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;\ntype DialogContentProps = DialogContentPrimitiveProps &\n VariantProps<typeof StyledContent> & { css?: CSS; closeLabel?: string };\n\nexport const DialogContent = React.forwardRef<\n React.ElementRef<typeof StyledContent>,\n DialogContentProps\n>(({ children, closeLabel = 'Close', ...props }, forwardedRef) => (\n <StyledContent {...props} ref={forwardedRef}>\n {children}\n <DialogCloseIconButton aria-label={closeLabel} />\n </StyledContent>\n));\n\nexport const DialogClosePrimitive = DialogPrimitive.Close;\nexport const DialogDescription = DialogPrimitive.Description;\nexport const DialogPortal = DialogPrimitive.Portal;\nexport const DialogTitle = DialogPrimitive.Title;\nexport const DialogTrigger = DialogPrimitive.Trigger;\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAa,gBAAgBA,wBAAAA,OAAOC,uBAAgB,SAASC,gBAAAA,eAAe;CAC1E,UAAU;CACV,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACR,CA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AAgB;AACpD,IAAa,oBAAoBA,uBAAgB;AACjD,IAAa,eAAeA,uBAAgB;AAC5C,IAAa,cAAcA,uBAAgB;AAC3C,IAAa,gBAAgBA,uBAAgB"}
@@ -51,14 +51,15 @@ var DialogCloseIconButton = React.forwardRef((props, forwardedRef) => /* @__PURE
51
51
  children: /* @__PURE__ */ jsx(IconButton, {
52
52
  ref: forwardedRef,
53
53
  css: { color: "$hiContrast" },
54
+ "aria-label": "Close",
54
55
  ...props,
55
- children: /* @__PURE__ */ jsx(Cross1Icon, {})
56
+ children: /* @__PURE__ */ jsx(Cross1Icon, { "aria-hidden": true })
56
57
  })
57
58
  }));
58
- var DialogContent = React.forwardRef(({ children, ...props }, forwardedRef) => /* @__PURE__ */ jsxs(StyledContent, {
59
+ var DialogContent = React.forwardRef(({ children, closeLabel = "Close", ...props }, forwardedRef) => /* @__PURE__ */ jsxs(StyledContent, {
59
60
  ...props,
60
61
  ref: forwardedRef,
61
- children: [children, /* @__PURE__ */ jsx(DialogCloseIconButton, {})]
62
+ children: [children, /* @__PURE__ */ jsx(DialogCloseIconButton, { "aria-label": closeLabel })]
62
63
  }));
63
64
  var DialogClosePrimitive = DialogPrimitive.Close;
64
65
  var DialogDescription = DialogPrimitive.Description;
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","names":[],"sources":["../../../components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Cross1Icon } from '@radix-ui/react-icons';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\nimport { elevationVariants } from '../Elevation/Elevation';\nimport { IconButton } from '../IconButton';\nimport { overlayStyles } from '../Overlay';\n\ntype DialogProps = React.ComponentProps<typeof DialogPrimitive.Root> & {\n children: React.ReactNode;\n};\n\nexport const DialogOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n});\n\nexport function Dialog({ children, ...props }: DialogProps) {\n return <DialogPrimitive.Root {...props}>{children}</DialogPrimitive.Root>;\n}\n\nexport const StyledContent = styled(DialogPrimitive.Content, Card, {\n position: 'fixed',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n minWidth: 200,\n maxHeight: '85vh',\n padding: '$4',\n marginTop: '-5vh',\n backgroundColor: '$dialogBackground',\n boxShadow: 'inset 0 0 0 1px $colors$deepBlue4',\n borderRadius: '$3',\n // animation: `${fadeIn} 125ms linear, ${moveDown} 125ms cubic-bezier(0.22, 1, 0.36, 1)`,\n willChange: 'transform',\n overflow: 'auto',\n\n '&::before': {\n boxShadow: 'none',\n },\n\n '&:focus': {\n outline: 'none',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 5,\n },\n});\n\nconst StyledCloseButton = styled(DialogPrimitive.Close, {\n position: 'absolute',\n top: '$2',\n right: '$2',\n cursor: 'pointer',\n});\n\ninterface DialogCloseButtonProps\n extends VariantProps<typeof IconButton>,\n ComponentProps<typeof IconButton> {}\nexport const DialogCloseIconButton = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n DialogCloseButtonProps\n>((props, forwardedRef) => (\n <StyledCloseButton asChild>\n <IconButton ref={forwardedRef} css={{ color: '$hiContrast' }} {...props}>\n <Cross1Icon />\n </IconButton>\n </StyledCloseButton>\n));\n\ntype DialogContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;\ntype DialogContentProps = DialogContentPrimitiveProps &\n VariantProps<typeof StyledContent> & { css?: CSS };\n\nexport const DialogContent = React.forwardRef<\n React.ElementRef<typeof StyledContent>,\n DialogContentProps\n>(({ children, ...props }, forwardedRef) => (\n <StyledContent {...props} ref={forwardedRef}>\n {children}\n <DialogCloseIconButton />\n </StyledContent>\n));\n\nexport const DialogClosePrimitive = DialogPrimitive.Close;\nexport const DialogDescription = DialogPrimitive.Description;\nexport const DialogPortal = DialogPrimitive.Portal;\nexport const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;AAC3C,IAAa,gBAAgB,gBAAgB"}
1
+ {"version":3,"file":"Dialog.js","names":[],"sources":["../../../components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Cross1Icon } from '@radix-ui/react-icons';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Card } from '../Card';\nimport { elevationVariants } from '../Elevation/Elevation';\nimport { IconButton } from '../IconButton';\nimport { overlayStyles } from '../Overlay';\n\ntype DialogProps = React.ComponentProps<typeof DialogPrimitive.Root> & {\n children: React.ReactNode;\n};\n\nexport const DialogOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n});\n\nexport function Dialog({ children, ...props }: DialogProps) {\n return <DialogPrimitive.Root {...props}>{children}</DialogPrimitive.Root>;\n}\n\nexport const StyledContent = styled(DialogPrimitive.Content, Card, {\n position: 'fixed',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n minWidth: 200,\n maxHeight: '85vh',\n padding: '$4',\n marginTop: '-5vh',\n backgroundColor: '$dialogBackground',\n boxShadow: 'inset 0 0 0 1px $colors$deepBlue4',\n borderRadius: '$3',\n // animation: `${fadeIn} 125ms linear, ${moveDown} 125ms cubic-bezier(0.22, 1, 0.36, 1)`,\n willChange: 'transform',\n overflow: 'auto',\n\n '&::before': {\n boxShadow: 'none',\n },\n\n '&:focus': {\n outline: 'none',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 5,\n },\n});\n\nconst StyledCloseButton = styled(DialogPrimitive.Close, {\n position: 'absolute',\n top: '$2',\n right: '$2',\n cursor: 'pointer',\n});\n\ninterface DialogCloseButtonProps\n extends VariantProps<typeof IconButton>, ComponentProps<typeof IconButton> {}\nexport const DialogCloseIconButton = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n DialogCloseButtonProps\n>((props, forwardedRef) => (\n <StyledCloseButton asChild>\n <IconButton ref={forwardedRef} css={{ color: '$hiContrast' }} aria-label=\"Close\" {...props}>\n <Cross1Icon aria-hidden />\n </IconButton>\n </StyledCloseButton>\n));\n\ntype DialogContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;\ntype DialogContentProps = DialogContentPrimitiveProps &\n VariantProps<typeof StyledContent> & { css?: CSS; closeLabel?: string };\n\nexport const DialogContent = React.forwardRef<\n React.ElementRef<typeof StyledContent>,\n DialogContentProps\n>(({ children, closeLabel = 'Close', ...props }, forwardedRef) => (\n <StyledContent {...props} ref={forwardedRef}>\n {children}\n <DialogCloseIconButton aria-label={closeLabel} />\n </StyledContent>\n));\n\nexport const DialogClosePrimitive = DialogPrimitive.Close;\nexport const DialogDescription = DialogPrimitive.Description;\nexport const DialogPortal = DialogPrimitive.Portal;\nexport const DialogTitle = DialogPrimitive.Title;\nexport const DialogTrigger = DialogPrimitive.Trigger;\n"],"mappings":";;;;;;;;;;AAcA,IAAa,gBAAgB,OAAO,gBAAgB,SAAS,eAAe;CAC1E,UAAU;CACV,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACR,CAAC;AAED,SAAgB,OAAO,EAAE,UAAU,GAAG,SAAsB;CAC1D,OAAO,oBAAC,gBAAgB,MAAjB;EAAsB,GAAI;EAAQ;CAA+B,CAAA;AAC1E;AAEA,IAAa,gBAAgB,OAAO,gBAAgB,SAAS,MAAM;CACjE,UAAU;CACV,KAAK;CACL,MAAM;CACN,WAAW;CACX,UAAU;CACV,WAAW;CACX,SAAS;CACT,WAAW;CACX,iBAAiB;CACjB,WAAW;CACX,cAAc;CAEd,YAAY;CACZ,UAAU;CAEV,aAAa,EACX,WAAW,OACb;CAEA,WAAW,EACT,SAAS,OACX;CAEA,UAAU,EACR,WAAW,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC;AAED,IAAM,oBAAoB,OAAO,gBAAgB,OAAO;CACtD,UAAU;CACV,KAAK;CACL,OAAO;CACP,QAAQ;AACV,CAAC;AAID,IAAa,wBAAwB,MAAM,YAGxC,OAAO,iBACR,oBAAC,mBAAD;CAAmB,SAAA;CACjB,UAAA,oBAAC,YAAD;EAAY,KAAK;EAAc,KAAK,EAAE,OAAO,cAAc;EAAG,cAAW;EAAQ,GAAI;EACnF,UAAA,oBAAC,YAAD,EAAY,eAAA,KAAa,CAAA;CACf,CAAA;AACK,CAAA,CACpB;AAMD,IAAa,gBAAgB,MAAM,YAGhC,EAAE,UAAU,aAAa,SAAS,GAAG,SAAS,iBAC/C,qBAAC,eAAD;CAAe,GAAI;CAAO,KAAK;CAA/B,UAAA,CACG,UACD,oBAAC,uBAAD,EAAuB,cAAY,WAAa,CAAA,CACnC;AAChB,CAAA,CAAA;AAED,IAAa,uBAAuB,gBAAgB;AACpD,IAAa,oBAAoB,gBAAgB;AACjD,IAAa,eAAe,gBAAgB;AAC5C,IAAa,cAAc,gBAAgB;AAC3C,IAAa,gBAAgB,gBAAgB"}
@@ -0,0 +1,91 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ const require_Box = require("../Box/Box.cjs");
3
+ const require_Text = require("../Text/Text.cjs");
4
+ const require_Label = require("../Label/Label.cjs");
5
+ const require_FieldContext = require("./FieldContext.cjs");
6
+ const require_VisuallyHidden = require("../VisuallyHidden/VisuallyHidden.cjs");
7
+ let react = require("react");
8
+ react = require_runtime.__toESM(react, 1);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ // components/Field/Field.tsx
11
+ var MESSAGE_CSS = {
12
+ display: "block",
13
+ m: 0,
14
+ mt: "$1"
15
+ };
16
+ /**
17
+ * Gives a label, a description and an error to the one form control inside it.
18
+ * Its label connects to one control, so do not put two controls in one Field.
19
+ */
20
+ var Field = ({ label, description, error, announceError, labelPosition = "top", children, css, ...props }) => {
21
+ const { context, labelFor, labelVariant, hasLabel, hasDescription, hasError, onFocus, onBlur } = require_FieldContext.useFieldRoot({
22
+ label,
23
+ description,
24
+ error,
25
+ ...props
26
+ });
27
+ const announcedError = require_FieldContext.useAnnouncedError(Boolean(announceError), hasError ? context.errorId : void 0, context.labelId);
28
+ const labelNode = react.default.useMemo(() => {
29
+ if (!hasLabel || !context.labelId) return null;
30
+ if (typeof label === "function") return label({
31
+ variant: labelVariant,
32
+ htmlFor: labelFor,
33
+ id: context.labelId
34
+ });
35
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Label.Label, {
36
+ variant: labelVariant,
37
+ htmlFor: labelFor,
38
+ id: context.labelId,
39
+ children: label
40
+ });
41
+ }, [
42
+ hasLabel,
43
+ label,
44
+ labelVariant,
45
+ labelFor,
46
+ context.labelId
47
+ ]);
48
+ const errorNode = hasError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
49
+ as: "p",
50
+ id: context.errorId,
51
+ size: "0",
52
+ variant: "invalid",
53
+ css: MESSAGE_CSS,
54
+ children: error
55
+ });
56
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FieldContext.FieldContext.Provider, {
57
+ value: context,
58
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
59
+ css,
60
+ onFocus,
61
+ onBlur,
62
+ children: [
63
+ labelPosition === "end" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
64
+ css: {
65
+ display: "flex",
66
+ alignItems: "center",
67
+ gap: "$2",
68
+ "& > [role=\"switch\"]": { m: 0 }
69
+ },
70
+ children: [children, labelNode]
71
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [labelNode, children] }),
72
+ hasDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
73
+ as: "p",
74
+ id: context.descriptionId,
75
+ size: "0",
76
+ variant: "subtle",
77
+ css: MESSAGE_CSS,
78
+ children: description
79
+ }),
80
+ errorNode,
81
+ announceError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_VisuallyHidden.VisuallyHidden, {
82
+ "aria-live": "polite",
83
+ children: announcedError
84
+ })
85
+ ]
86
+ })
87
+ });
88
+ };
89
+ exports.Field = Field;
90
+
91
+ //# sourceMappingURL=Field.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.cjs","names":["useFieldRoot","useAnnouncedError","React","Label","Text","FieldContext","Box","_Fragment","VisuallyHidden"],"sources":["../../../components/Field/Field.tsx"],"sourcesContent":["import React from 'react';\n\nimport { CSS } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { Label } from '../Label';\nimport { Text } from '../Text';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { FieldBaseProps, FieldContext, useAnnouncedError, useFieldRoot } from './FieldContext';\n\nexport type FieldProps = FieldBaseProps & { css?: CSS };\n\nconst MESSAGE_CSS = { display: 'block', m: 0, mt: '$1' };\n\n/**\n * Gives a label, a description and an error to the one form control inside it.\n * Its label connects to one control, so do not put two controls in one Field.\n */\nexport const Field = ({\n label,\n description,\n error,\n announceError,\n labelPosition = 'top',\n children,\n css,\n ...props\n}: FieldProps) => {\n const { context, labelFor, labelVariant, hasLabel, hasDescription, hasError, onFocus, onBlur } =\n useFieldRoot({ label, description, error, ...props });\n const announcedError = useAnnouncedError(\n Boolean(announceError),\n hasError ? context.errorId : undefined,\n context.labelId,\n );\n\n const labelNode = React.useMemo(() => {\n if (!hasLabel || !context.labelId) {\n return null;\n }\n if (typeof label === 'function') {\n return label({ variant: labelVariant, htmlFor: labelFor, id: context.labelId });\n }\n return (\n <Label variant={labelVariant} htmlFor={labelFor} id={context.labelId}>\n {label}\n </Label>\n );\n }, [hasLabel, label, labelVariant, labelFor, context.labelId]);\n\n const errorNode = hasError && (\n <Text as=\"p\" id={context.errorId} size=\"0\" variant=\"invalid\" css={MESSAGE_CSS}>\n {error}\n </Text>\n );\n\n return (\n <FieldContext.Provider value={context}>\n <Box css={css} onFocus={onFocus} onBlur={onBlur}>\n {labelPosition === 'end' ? (\n <Box\n css={{\n display: 'flex',\n alignItems: 'center',\n gap: '$2',\n '& > [role=\"switch\"]': { m: 0 },\n }}\n >\n {children}\n {labelNode}\n </Box>\n ) : (\n <>\n {labelNode}\n {children}\n </>\n )}\n {hasDescription && (\n <Text as=\"p\" id={context.descriptionId} size=\"0\" variant=\"subtle\" css={MESSAGE_CSS}>\n {description}\n </Text>\n )}\n {errorNode}\n {announceError && <VisuallyHidden aria-live=\"polite\">{announcedError}</VisuallyHidden>}\n </Box>\n </FieldContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;AAWA,IAAM,cAAc;CAAE,SAAS;CAAS,GAAG;CAAG,IAAI;AAAK;;;;;AAMvD,IAAa,SAAS,EACpB,OACA,aACA,OACA,eACA,gBAAgB,OAChB,UACA,KACA,GAAG,YACa;CAChB,MAAM,EAAE,SAAS,UAAU,cAAc,UAAU,gBAAgB,UAAU,SAAS,WACpFA,qBAAAA,aAAa;EAAE;EAAO;EAAa;EAAO,GAAG;CAAM,CAAC;CACtD,MAAM,iBAAiBC,qBAAAA,kBACrB,QAAQ,aAAa,GACrB,WAAW,QAAQ,UAAU,KAAA,GAC7B,QAAQ,OACV;CAEA,MAAM,YAAYC,MAAAA,QAAM,cAAc;EACpC,IAAI,CAAC,YAAY,CAAC,QAAQ,SACxB,OAAO;EAET,IAAI,OAAO,UAAU,YACnB,OAAO,MAAM;GAAE,SAAS;GAAc,SAAS;GAAU,IAAI,QAAQ;EAAQ,CAAC;EAEhF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,OAAD;GAAO,SAAS;GAAc,SAAS;GAAU,IAAI,QAAQ;GAC1D,UAAA;EACI,CAAA;CAEX,GAAG;EAAC;EAAU;EAAO;EAAc;EAAU,QAAQ;CAAO,CAAC;CAE7D,MAAM,YAAY,YAChB,iBAAA,GAAA,kBAAA,IAAA,CAACC,aAAAA,MAAD;EAAM,IAAG;EAAI,IAAI,QAAQ;EAAS,MAAK;EAAI,SAAQ;EAAU,KAAK;EAC/D,UAAA;CACG,CAAA;CAGR,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,aAAa,UAAd;EAAuB,OAAO;EAC5B,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACC,YAAAA,KAAD;GAAU;GAAc;GAAiB;GAAzC,UAAA;IACG,kBAAkB,QACjB,iBAAA,GAAA,kBAAA,KAAA,CAACA,YAAAA,KAAD;KACE,KAAK;MACH,SAAS;MACT,YAAY;MACZ,KAAK;MACL,yBAAuB,EAAE,GAAG,EAAE;KAChC;KANF,UAAA,CAQG,UACA,SACE;IAEL,CAAA,IAAA,iBAAA,GAAA,kBAAA,KAAA,CAAAC,kBAAAA,UAAA,EAAA,UAAA,CACG,WACA,QACD,EAAA,CAAA;IAEH,kBACC,iBAAA,GAAA,kBAAA,IAAA,CAACH,aAAAA,MAAD;KAAM,IAAG;KAAI,IAAI,QAAQ;KAAe,MAAK;KAAI,SAAQ;KAAS,KAAK;KACpE,UAAA;IACG,CAAA;IAEP;IACA,iBAAiB,iBAAA,GAAA,kBAAA,IAAA,CAACI,uBAAAA,gBAAD;KAAgB,aAAU;KAAU,UAAA;IAA+B,CAAA;GAClF;;CACgB,CAAA;AAE3B"}
@@ -0,0 +1,89 @@
1
+ import { Box } from "../Box/Box.js";
2
+ import { Text } from "../Text/Text.js";
3
+ import { Label } from "../Label/Label.js";
4
+ import { FieldContext, useAnnouncedError, useFieldRoot } from "./FieldContext.js";
5
+ import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
6
+ import React from "react";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ // components/Field/Field.tsx
9
+ var MESSAGE_CSS = {
10
+ display: "block",
11
+ m: 0,
12
+ mt: "$1"
13
+ };
14
+ /**
15
+ * Gives a label, a description and an error to the one form control inside it.
16
+ * Its label connects to one control, so do not put two controls in one Field.
17
+ */
18
+ var Field = ({ label, description, error, announceError, labelPosition = "top", children, css, ...props }) => {
19
+ const { context, labelFor, labelVariant, hasLabel, hasDescription, hasError, onFocus, onBlur } = useFieldRoot({
20
+ label,
21
+ description,
22
+ error,
23
+ ...props
24
+ });
25
+ const announcedError = useAnnouncedError(Boolean(announceError), hasError ? context.errorId : void 0, context.labelId);
26
+ const labelNode = React.useMemo(() => {
27
+ if (!hasLabel || !context.labelId) return null;
28
+ if (typeof label === "function") return label({
29
+ variant: labelVariant,
30
+ htmlFor: labelFor,
31
+ id: context.labelId
32
+ });
33
+ return /* @__PURE__ */ jsx(Label, {
34
+ variant: labelVariant,
35
+ htmlFor: labelFor,
36
+ id: context.labelId,
37
+ children: label
38
+ });
39
+ }, [
40
+ hasLabel,
41
+ label,
42
+ labelVariant,
43
+ labelFor,
44
+ context.labelId
45
+ ]);
46
+ const errorNode = hasError && /* @__PURE__ */ jsx(Text, {
47
+ as: "p",
48
+ id: context.errorId,
49
+ size: "0",
50
+ variant: "invalid",
51
+ css: MESSAGE_CSS,
52
+ children: error
53
+ });
54
+ return /* @__PURE__ */ jsx(FieldContext.Provider, {
55
+ value: context,
56
+ children: /* @__PURE__ */ jsxs(Box, {
57
+ css,
58
+ onFocus,
59
+ onBlur,
60
+ children: [
61
+ labelPosition === "end" ? /* @__PURE__ */ jsxs(Box, {
62
+ css: {
63
+ display: "flex",
64
+ alignItems: "center",
65
+ gap: "$2",
66
+ "& > [role=\"switch\"]": { m: 0 }
67
+ },
68
+ children: [children, labelNode]
69
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [labelNode, children] }),
70
+ hasDescription && /* @__PURE__ */ jsx(Text, {
71
+ as: "p",
72
+ id: context.descriptionId,
73
+ size: "0",
74
+ variant: "subtle",
75
+ css: MESSAGE_CSS,
76
+ children: description
77
+ }),
78
+ errorNode,
79
+ announceError && /* @__PURE__ */ jsx(VisuallyHidden, {
80
+ "aria-live": "polite",
81
+ children: announcedError
82
+ })
83
+ ]
84
+ })
85
+ });
86
+ };
87
+ export { Field };
88
+
89
+ //# sourceMappingURL=Field.js.map
@@ -0,0 +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' };\n\n/**\n * Gives a label, a description and an error to the one form control inside it.\n * Its label connects to one control, so do not put two controls in one Field.\n */\nexport const Field = ({\n label,\n description,\n error,\n announceError,\n labelPosition = 'top',\n children,\n css,\n ...props\n}: FieldProps) => {\n const { context, labelFor, labelVariant, hasLabel, hasDescription, hasError, onFocus, onBlur } =\n useFieldRoot({ label, description, error, ...props });\n const announcedError = useAnnouncedError(\n Boolean(announceError),\n hasError ? context.errorId : undefined,\n context.labelId,\n );\n\n const labelNode = React.useMemo(() => {\n if (!hasLabel || !context.labelId) {\n return null;\n }\n if (typeof label === 'function') {\n return label({ variant: labelVariant, htmlFor: labelFor, id: context.labelId });\n }\n return (\n <Label variant={labelVariant} htmlFor={labelFor} id={context.labelId}>\n {label}\n </Label>\n );\n }, [hasLabel, label, labelVariant, labelFor, context.labelId]);\n\n const errorNode = hasError && (\n <Text as=\"p\" id={context.errorId} size=\"0\" variant=\"invalid\" css={MESSAGE_CSS}>\n {error}\n </Text>\n );\n\n return (\n <FieldContext.Provider value={context}>\n <Box css={css} onFocus={onFocus} onBlur={onBlur}>\n {labelPosition === 'end' ? (\n <Box\n css={{\n display: 'flex',\n alignItems: 'center',\n gap: '$2',\n '& > [role=\"switch\"]': { m: 0 },\n }}\n >\n {children}\n {labelNode}\n </Box>\n ) : (\n <>\n {labelNode}\n {children}\n </>\n )}\n {hasDescription && (\n <Text as=\"p\" id={context.descriptionId} size=\"0\" variant=\"subtle\" css={MESSAGE_CSS}>\n {description}\n </Text>\n )}\n {errorNode}\n {announceError && <VisuallyHidden aria-live=\"polite\">{announcedError}</VisuallyHidden>}\n </Box>\n </FieldContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;AAWA,IAAM,cAAc;CAAE,SAAS;CAAS,GAAG;CAAG,IAAI;AAAK;;;;;AAMvD,IAAa,SAAS,EACpB,OACA,aACA,OACA,eACA,gBAAgB,OAChB,UACA,KACA,GAAG,YACa;CAChB,MAAM,EAAE,SAAS,UAAU,cAAc,UAAU,gBAAgB,UAAU,SAAS,WACpF,aAAa;EAAE;EAAO;EAAa;EAAO,GAAG;CAAM,CAAC;CACtD,MAAM,iBAAiB,kBACrB,QAAQ,aAAa,GACrB,WAAW,QAAQ,UAAU,KAAA,GAC7B,QAAQ,OACV;CAEA,MAAM,YAAY,MAAM,cAAc;EACpC,IAAI,CAAC,YAAY,CAAC,QAAQ,SACxB,OAAO;EAET,IAAI,OAAO,UAAU,YACnB,OAAO,MAAM;GAAE,SAAS;GAAc,SAAS;GAAU,IAAI,QAAQ;EAAQ,CAAC;EAEhF,OACE,oBAAC,OAAD;GAAO,SAAS;GAAc,SAAS;GAAU,IAAI,QAAQ;GAC1D,UAAA;EACI,CAAA;CAEX,GAAG;EAAC;EAAU;EAAO;EAAc;EAAU,QAAQ;CAAO,CAAC;CAE7D,MAAM,YAAY,YAChB,oBAAC,MAAD;EAAM,IAAG;EAAI,IAAI,QAAQ;EAAS,MAAK;EAAI,SAAQ;EAAU,KAAK;EAC/D,UAAA;CACG,CAAA;CAGR,OACE,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAC5B,UAAA,qBAAC,KAAD;GAAU;GAAc;GAAiB;GAAzC,UAAA;IACG,kBAAkB,QACjB,qBAAC,KAAD;KACE,KAAK;MACH,SAAS;MACT,YAAY;MACZ,KAAK;MACL,yBAAuB,EAAE,GAAG,EAAE;KAChC;KANF,UAAA,CAQG,UACA,SACE;IAEL,CAAA,IAAA,qBAAAA,UAAA,EAAA,U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