@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,6 +1,8 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
3
  const require_Elevation = require("../Elevation/Elevation.cjs");
4
+ const require_colorSchemeContext = require("../colorSchemeContext.cjs");
5
+ const require_FieldContext = require("../Field/FieldContext.cjs");
4
6
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
5
7
  let react = require("react");
6
8
  react = require_runtime.__toESM(react, 1);
@@ -75,6 +77,15 @@ var SelectWrapper = require_stitches_config.styled("div", {
75
77
  fontWeight: "$regular",
76
78
  height: "$5",
77
79
  flexShrink: 0,
80
+ [`& ${StyledSelect}:-webkit-autofill, & ${StyledSelect}:autofill`]: {
81
+ boxShadow: "inset 0 0 0 1px $colors$selectBorder, inset 0 0 0 100px $colors$selectBg",
82
+ WebkitTextFillColor: "$colors$hiContrast"
83
+ },
84
+ [`& ${StyledSelect}:-webkit-autofill:has(option[value=""]:checked)`]: {
85
+ colorScheme: "light !important",
86
+ WebkitTextFillColor: "black"
87
+ },
88
+ [`& ${StyledSelect}:-webkit-autofill:focus-visible, & ${StyledSelect}:autofill:focus-visible`]: { boxShadow: `inset 0 0 0 2px $colors$selectFocusBorder, inset 0 0 0 100px $colors$selectBg, ${FOCUS_SHADOW}` },
78
89
  "&::before": {
79
90
  boxSizing: "border-box",
80
91
  content: "\"\"",
@@ -166,24 +177,42 @@ var SelectWrapper = require_stitches_config.styled("div", {
166
177
  } },
167
178
  state: { invalid: {
168
179
  boxShadow: "inset 0 0 0 1px $colors$selectInvalidBorder",
180
+ [`& ${StyledSelect}:-webkit-autofill, & ${StyledSelect}:autofill`]: { boxShadow: "inset 0 0 0 1px $colors$selectInvalidBorder, inset 0 0 0 100px $colors$selectBg" },
169
181
  "&:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$selectInvalidBorder, ${FOCUS_SHADOW}` }
170
182
  } }
171
183
  },
172
184
  defaultVariants: { size: "medium" }
173
185
  });
174
- var Select = react.default.forwardRef(({ css, size, state, variant, cursor, ...props }, forwardedRef) => {
186
+ var Select = react.default.forwardRef(({ css, size, state, variant, cursor, id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, style, ...props }, forwardedRef) => {
187
+ const colorScheme = require_colorSchemeContext.useColorScheme();
188
+ const control = require_FieldContext.useFieldControl({
189
+ id,
190
+ disabled,
191
+ invalid: state === "invalid",
192
+ "aria-describedby": ariaDescribedBy,
193
+ "aria-invalid": ariaInvalid
194
+ });
175
195
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SelectWrapper, {
176
196
  css,
177
197
  size,
178
- state,
198
+ state: control.invalid ? "invalid" : state,
179
199
  variant,
180
- disabled: props.disabled,
200
+ disabled: control.disabled,
181
201
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSelect, {
182
202
  ref: forwardedRef,
203
+ id: control.id,
204
+ disabled: control.disabled,
205
+ "aria-describedby": control["aria-describedby"],
206
+ "aria-invalid": control["aria-invalid"],
207
+ style: {
208
+ colorScheme,
209
+ ...style
210
+ },
183
211
  ...props
184
212
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledCaretSortIcon, {
185
213
  size,
186
- cursor
214
+ cursor,
215
+ "aria-hidden": true
187
216
  })]
188
217
  });
189
218
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","names":["elevationVariants","styled","CaretSortIcon","React"],"sources":["../../../components/Select/Select.tsx"],"sourcesContent":["import { CaretSortIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\n\n// CONSTANTS\nconst FOCUS_SHADOW = elevationVariants[1].boxShadow; // apply elevation $1 when focus\nconst CARET_WIDTH = '15px';\n\nconst StyledCaretSortIcon = styled(CaretSortIcon, {\n position: 'absolute',\n pointerEvents: 'none',\n display: 'inline',\n\n variants: {\n // Use margins instead of top/left to avoid setting \"position: relative\" on parent,\n // which would make stacking context tricky with Select used in a control group.\n size: {\n small: {\n marginTop: 5,\n marginLeft: -16,\n },\n medium: {\n marginTop: 9,\n marginLeft: -16,\n },\n large: {\n marginTop: 13,\n marginLeft: -16,\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '&:focus': {\n cursor: 'text',\n },\n },\n text: {\n cursor: 'text',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\nconst StyledSelect = styled('select', {\n appearance: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n borderRadius: 'inherit',\n color: 'inherit',\n font: 'inherit',\n outline: 'none',\n width: '100%',\n height: '100%',\n pl: '$1',\n pr: '$3',\n lineHeight: '25px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n\n '& option': {\n color: 'black',\n bc: 'white',\n },\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$selectFocusBorder, ${FOCUS_SHADOW}`,\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n color: '$selectDisabledText',\n },\n});\n\nconst SelectWrapper = styled('div', {\n position: 'relative',\n backgroundColor: '$selectBg',\n borderRadius: '$2',\n boxShadow: 'inset 0 0 0 1px $colors$selectBorder',\n color: '$selectText',\n fontFamily: '$rubik',\n fontSize: '$1',\n fontVariantNumeric: 'tabular-nums',\n fontWeight: '$regular',\n height: '$5',\n flexShrink: 0,\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n borderRadius: 'inherit',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n borderRadius: 'inherit',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$selectFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: '$selectHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n\n variants: {\n disabled: {\n true: {\n opacity: 0.7,\n color: '$selectDisabledText',\n '@hover': {\n '&:hover': {\n '&::before': {\n display: 'none',\n },\n '&::after': {\n display: 'none',\n },\n },\n },\n },\n },\n size: {\n small: {\n borderRadius: '$2',\n height: '$5',\n fontSize: '$1',\n lineHeight: '$sizes$5',\n '&:-webkit-autofill::first-line': {\n fontSize: '$1',\n },\n [`& ${StyledSelect}`]: {\n pl: '$2',\n pr: `calc($2 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($2 / 2)',\n },\n },\n medium: {\n borderRadius: '$3',\n height: '$6',\n fontSize: '$3',\n lineHeight: '$sizes$6',\n '&:-webkit-autofill::first-line': {\n fontSize: '$3',\n },\n [`& ${StyledSelect}`]: {\n pl: '$3',\n pr: `calc($3 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($3 / 2)',\n },\n },\n large: {\n borderRadius: '$3',\n height: '$7',\n fontSize: '$3',\n lineHeight: '$sizes$7',\n '&:-webkit-autofill::first-line': {\n fontSize: '$3',\n },\n [`& ${StyledSelect}`]: {\n pl: '$3',\n pr: `calc($3 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($3 / 2)',\n },\n },\n },\n variant: {\n ghost: {\n boxShadow: 'none',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n boxShadow: 'inset 0 0 0 1px $colors$slateA7',\n backgroundColor: '$selectHoverBg',\n },\n },\n '&:focus-within': {\n backgroundColor: '$loContrast',\n boxShadow:\n 'inset 0px 0px 0px 1px $colors$selectFocusBorder, 0px 0px 0px 1px $colors$selectFocusBorder',\n },\n },\n },\n state: {\n invalid: {\n boxShadow: 'inset 0 0 0 1px $colors$selectInvalidBorder',\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$selectInvalidBorder, ${FOCUS_SHADOW}`,\n },\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\nexport type SelectVariants = VariantProps<typeof StyledSelect> &\n VariantProps<typeof SelectWrapper> &\n VariantProps<typeof StyledCaretSortIcon>;\n\nexport type SelectProps = Omit<React.ComponentProps<typeof StyledSelect>, 'size'> &\n SelectVariants & { css?: CSS };\n\nexport const Select = React.forwardRef<React.ElementRef<typeof StyledSelect>, SelectProps>(\n ({ css, size, state, variant, cursor, ...props }, forwardedRef) => {\n return (\n <SelectWrapper\n css={css}\n size={size}\n state={state}\n variant={variant}\n disabled={props.disabled}\n >\n <StyledSelect ref={forwardedRef} {...props} />\n <StyledCaretSortIcon size={size} cursor={cursor} />\n </SelectWrapper>\n );\n }\n);\n\nSelect.toString = () => `.${SelectWrapper.className}`;\n"],"mappings":";;;;;;;;AAOA,IAAM,eAAeA,kBAAAA,kBAAkB,EAAE,CAAC;AAC1C,IAAM,cAAc;AAEpB,IAAM,sBAAsBC,wBAAAA,OAAOC,sBAAAA,eAAe;CAChD,UAAU;CACV,eAAe;CACf,SAAS;CAET,UAAU;EAGR,MAAM;GACJ,OAAO;IACL,WAAW;IACX,YAAY;GACd;GACA,QAAQ;IACN,WAAW;IACX,YAAY;GACd;GACA,OAAO;IACL,WAAW;IACX,YAAY;GACd;EACF;EACA,QAAQ;GACN,SAAS;IACP,QAAQ;IACR,WAAW,EACT,QAAQ,OACV;GACF;GACA,MAAM,EACJ,QAAQ,OACV;EACF;CACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAED,IAAM,eAAeD,wBAAAA,OAAO,UAAU;CACpC,YAA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;IACV,YAAY;IACZ,kCAAkC,EAChC,UAAU,KACZ;KACC,KAAK,iBAAiB;KACrB,IAAI;KACJ,IAAI,aAAa,YAAY;IAC/B;KACC,KAAK,wBAAwB,EAC5B,OAAO,eACT;GACF;GACA,OAAO;IACL,cAAc;IACd,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,kCAAkC,EAChC,UAAU,KACZ;KACC,KAAK,iBAAiB;KACrB,IAAI;KACJ,IAAI,aAAa,YAAY;IAC/B;KACC,KAAK,wBAAwB,EAC5B,OAAO,eACT;GACF;EACF;EACA,SAAS,EACP,OAAO;GACL,WAAW;GACX,iBAAiB;GACjB,UAAU,EACR,WAAW;IACT,WAAW;IACX,iBAAiB;GACnB,EACF;GACA,kBAAkB;IAChB,iBAAiB;IACjB,WACE;GACJ;EACF,EACF;EACA,OAAO,EACL,SAAS;GACP,WAAW;GACX,mBAAmB,EACjB,WAAW,gDAAgD,eAC7D;EACF,EACF;CACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AASD,IAAa,SAASE,MAAAA,QAAM,YACzB,EAAE,KAAK,MAAM,OAAO,SAAS,QAAQ,GAAG,SAAS,iBAAiB;CACjE,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,eAAD;EACO;EACC;EACC;EACE;EACT,UAAU,MAAM;EALlB,UAAA,CAOE,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;GAAc,KAAK;GAAc,GAAI;EAAQ,CAAA,GAC7C,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAD;GAA2B;GAAc;EAAS,CAAA,CACrC;;AAEnB,CACF;AAEA,OAAO,iBAAiB,IAAI,cAAc"}
1
+ {"version":3,"file":"Select.cjs","names":["elevationVariants","styled","CaretSortIcon","React","useColorScheme","useFieldControl"],"sources":["../../../components/Select/Select.tsx"],"sourcesContent":["import { CaretSortIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { useColorScheme } from '../colorSchemeContext';\nimport { elevationVariants } from '../Elevation';\nimport { useFieldControl } from '../Field/FieldContext';\n\n// CONSTANTS\nconst FOCUS_SHADOW = elevationVariants[1].boxShadow; // apply elevation $1 when focus\nconst CARET_WIDTH = '15px';\n\nconst StyledCaretSortIcon = styled(CaretSortIcon, {\n position: 'absolute',\n pointerEvents: 'none',\n display: 'inline',\n\n variants: {\n // Use margins instead of top/left to avoid setting \"position: relative\" on parent,\n // which would make stacking context tricky with Select used in a control group.\n size: {\n small: {\n marginTop: 5,\n marginLeft: -16,\n },\n medium: {\n marginTop: 9,\n marginLeft: -16,\n },\n large: {\n marginTop: 13,\n marginLeft: -16,\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '&:focus': {\n cursor: 'text',\n },\n },\n text: {\n cursor: 'text',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\nconst StyledSelect = styled('select', {\n appearance: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n borderRadius: 'inherit',\n color: 'inherit',\n font: 'inherit',\n outline: 'none',\n width: '100%',\n height: '100%',\n pl: '$1',\n pr: '$3',\n lineHeight: '25px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n\n '& option': {\n color: 'black',\n bc: 'white',\n },\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$selectFocusBorder, ${FOCUS_SHADOW}`,\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n color: '$selectDisabledText',\n },\n});\n\nconst SelectWrapper = styled('div', {\n position: 'relative',\n backgroundColor: '$selectBg',\n borderRadius: '$2',\n boxShadow: 'inset 0 0 0 1px $colors$selectBorder',\n color: '$selectText',\n fontFamily: '$rubik',\n fontSize: '$1',\n fontVariantNumeric: 'tabular-nums',\n fontWeight: '$regular',\n height: '$5',\n flexShrink: 0,\n\n [`& ${StyledSelect}:-webkit-autofill, & ${StyledSelect}:autofill`]: {\n boxShadow: 'inset 0 0 0 1px $colors$selectBorder, inset 0 0 0 100px $colors$selectBg',\n WebkitTextFillColor: '$colors$hiContrast',\n },\n\n [`& ${StyledSelect}:-webkit-autofill:has(option[value=\"\"]:checked)`]: {\n colorScheme: 'light !important',\n WebkitTextFillColor: 'black',\n },\n\n [`& ${StyledSelect}:-webkit-autofill:focus-visible, & ${StyledSelect}:autofill:focus-visible`]: {\n boxShadow: `inset 0 0 0 2px $colors$selectFocusBorder, inset 0 0 0 100px $colors$selectBg, ${FOCUS_SHADOW}`,\n },\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n borderRadius: 'inherit',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n borderRadius: 'inherit',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$selectFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: '$selectHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n\n variants: {\n disabled: {\n true: {\n opacity: 0.7,\n color: '$selectDisabledText',\n '@hover': {\n '&:hover': {\n '&::before': {\n display: 'none',\n },\n '&::after': {\n display: 'none',\n },\n },\n },\n },\n },\n size: {\n small: {\n borderRadius: '$2',\n height: '$5',\n fontSize: '$1',\n lineHeight: '$sizes$5',\n '&:-webkit-autofill::first-line': {\n fontSize: '$1',\n },\n [`& ${StyledSelect}`]: {\n pl: '$2',\n pr: `calc($2 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($2 / 2)',\n },\n },\n medium: {\n borderRadius: '$3',\n height: '$6',\n fontSize: '$3',\n lineHeight: '$sizes$6',\n '&:-webkit-autofill::first-line': {\n fontSize: '$3',\n },\n [`& ${StyledSelect}`]: {\n pl: '$3',\n pr: `calc($3 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($3 / 2)',\n },\n },\n large: {\n borderRadius: '$3',\n height: '$7',\n fontSize: '$3',\n lineHeight: '$sizes$7',\n '&:-webkit-autofill::first-line': {\n fontSize: '$3',\n },\n [`& ${StyledSelect}`]: {\n pl: '$3',\n pr: `calc($3 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($3 / 2)',\n },\n },\n },\n variant: {\n ghost: {\n boxShadow: 'none',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n boxShadow: 'inset 0 0 0 1px $colors$slateA7',\n backgroundColor: '$selectHoverBg',\n },\n },\n '&:focus-within': {\n backgroundColor: '$loContrast',\n boxShadow:\n 'inset 0px 0px 0px 1px $colors$selectFocusBorder, 0px 0px 0px 1px $colors$selectFocusBorder',\n },\n },\n },\n state: {\n invalid: {\n boxShadow: 'inset 0 0 0 1px $colors$selectInvalidBorder',\n [`& ${StyledSelect}:-webkit-autofill, & ${StyledSelect}:autofill`]: {\n boxShadow:\n 'inset 0 0 0 1px $colors$selectInvalidBorder, inset 0 0 0 100px $colors$selectBg',\n },\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$selectInvalidBorder, ${FOCUS_SHADOW}`,\n },\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\nexport type SelectVariants = VariantProps<typeof StyledSelect> &\n VariantProps<typeof SelectWrapper> &\n VariantProps<typeof StyledCaretSortIcon>;\n\nexport type SelectProps = Omit<React.ComponentProps<typeof StyledSelect>, 'size'> &\n SelectVariants & { css?: CSS };\n\nexport const Select = React.forwardRef<React.ElementRef<typeof StyledSelect>, SelectProps>(\n (\n {\n css,\n size,\n state,\n variant,\n cursor,\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n style,\n ...props\n },\n forwardedRef,\n ) => {\n const colorScheme = useColorScheme();\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n\n return (\n <SelectWrapper\n css={css}\n size={size}\n state={control.invalid ? 'invalid' : state}\n variant={variant}\n disabled={control.disabled}\n >\n <StyledSelect\n ref={forwardedRef}\n id={control.id}\n disabled={control.disabled}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n style={{ colorScheme, ...style }}\n {...props}\n />\n <StyledCaretSortIcon size={size} cursor={cursor} aria-hidden />\n </SelectWrapper>\n );\n },\n);\n\nSelect.toString = () => `.${SelectWrapper.className}`;\n"],"mappings":";;;;;;;;;;AASA,IAAM,eAAeA,kBAAAA,kBAAkB,EAAE,CAAC;AAC1C,IAAM,cAAc;AAEpB,IAAM,sBAAsBC,wBAAAA,OAAOC,sBAAAA,eAAe;CAChD,UAAU;CACV,eAAe;CACf,SAAS;CAET,UAAU;EAGR,MAAM;GACJ,OAAO;IACL,WAAW;IACX,YAAY;GACd;GACA,QAAQ;IACN,WAAW;IACX,YAAY;GACd;GACA,OAAO;IACL,WAAW;IACX,YAAY;GACd;EACF;EACA,QAAQ;GACN,SAAS;IACP,QAAQ;IACR,WAAW,EACT,QAAQ,OACV;GACF;GACA,MAAM,EACJ,QAAQ,OACV;EACF;CACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAED,IAAM,eAAeD,wBAAAA,OAAO,UAAU;CACpC,YAAY;CACZ,iBAAiB;CACjB,QAAQ;CACR,cAAc;CACd,OAAO;CACP,MAAM;CACN,SAAS;CACT,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,IAAI;CACJ,YAAY;CACZ,UAAU;CACV,cAAc;CACd,YAAY;CAEZ,YAAY;EACV,OAAO;EACP,IAAI;CACN;CAEA,mBAAmB,EACjB,WAAW,8CAA8C,eAC3D;CAEA,cAAc;EACZ,eAAe;EACf,OAAO;CACT;AACF,CAAC;AAED,IAAM,gBAAgBA,wBAAAA,OAAO,OAAO;CACl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AEA,OAAO,iBAAiB,IAAI,cAAc"}
@@ -1,5 +1,7 @@
1
1
  import { styled } from "../../stitches.config.js";
2
2
  import { elevationVariants } from "../Elevation/Elevation.js";
3
+ import { useColorScheme } from "../colorSchemeContext.js";
4
+ import { useFieldControl } from "../Field/FieldContext.js";
3
5
  import { CaretSortIcon } from "@radix-ui/react-icons";
4
6
  import React from "react";
5
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -73,6 +75,15 @@ var SelectWrapper = styled("div", {
73
75
  fontWeight: "$regular",
74
76
  height: "$5",
75
77
  flexShrink: 0,
78
+ [`& ${StyledSelect}:-webkit-autofill, & ${StyledSelect}:autofill`]: {
79
+ boxShadow: "inset 0 0 0 1px $colors$selectBorder, inset 0 0 0 100px $colors$selectBg",
80
+ WebkitTextFillColor: "$colors$hiContrast"
81
+ },
82
+ [`& ${StyledSelect}:-webkit-autofill:has(option[value=""]:checked)`]: {
83
+ colorScheme: "light !important",
84
+ WebkitTextFillColor: "black"
85
+ },
86
+ [`& ${StyledSelect}:-webkit-autofill:focus-visible, & ${StyledSelect}:autofill:focus-visible`]: { boxShadow: `inset 0 0 0 2px $colors$selectFocusBorder, inset 0 0 0 100px $colors$selectBg, ${FOCUS_SHADOW}` },
76
87
  "&::before": {
77
88
  boxSizing: "border-box",
78
89
  content: "\"\"",
@@ -164,24 +175,42 @@ var SelectWrapper = styled("div", {
164
175
  } },
165
176
  state: { invalid: {
166
177
  boxShadow: "inset 0 0 0 1px $colors$selectInvalidBorder",
178
+ [`& ${StyledSelect}:-webkit-autofill, & ${StyledSelect}:autofill`]: { boxShadow: "inset 0 0 0 1px $colors$selectInvalidBorder, inset 0 0 0 100px $colors$selectBg" },
167
179
  "&:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$selectInvalidBorder, ${FOCUS_SHADOW}` }
168
180
  } }
169
181
  },
170
182
  defaultVariants: { size: "medium" }
171
183
  });
172
- var Select = React.forwardRef(({ css, size, state, variant, cursor, ...props }, forwardedRef) => {
184
+ var Select = React.forwardRef(({ css, size, state, variant, cursor, id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, style, ...props }, forwardedRef) => {
185
+ const colorScheme = useColorScheme();
186
+ const control = useFieldControl({
187
+ id,
188
+ disabled,
189
+ invalid: state === "invalid",
190
+ "aria-describedby": ariaDescribedBy,
191
+ "aria-invalid": ariaInvalid
192
+ });
173
193
  return /* @__PURE__ */ jsxs(SelectWrapper, {
174
194
  css,
175
195
  size,
176
- state,
196
+ state: control.invalid ? "invalid" : state,
177
197
  variant,
178
- disabled: props.disabled,
198
+ disabled: control.disabled,
179
199
  children: [/* @__PURE__ */ jsx(StyledSelect, {
180
200
  ref: forwardedRef,
201
+ id: control.id,
202
+ disabled: control.disabled,
203
+ "aria-describedby": control["aria-describedby"],
204
+ "aria-invalid": control["aria-invalid"],
205
+ style: {
206
+ colorScheme,
207
+ ...style
208
+ },
181
209
  ...props
182
210
  }), /* @__PURE__ */ jsx(StyledCaretSortIcon, {
183
211
  size,
184
- cursor
212
+ cursor,
213
+ "aria-hidden": true
185
214
  })]
186
215
  });
187
216
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":[],"sources":["../../../components/Select/Select.tsx"],"sourcesContent":["import { CaretSortIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\n\n// CONSTANTS\nconst FOCUS_SHADOW = elevationVariants[1].boxShadow; // apply elevation $1 when focus\nconst CARET_WIDTH = '15px';\n\nconst StyledCaretSortIcon = styled(CaretSortIcon, {\n position: 'absolute',\n pointerEvents: 'none',\n display: 'inline',\n\n variants: {\n // Use margins instead of top/left to avoid setting \"position: relative\" on parent,\n // which would make stacking context tricky with Select used in a control group.\n size: {\n small: {\n marginTop: 5,\n marginLeft: -16,\n },\n medium: {\n marginTop: 9,\n marginLeft: -16,\n },\n large: {\n marginTop: 13,\n marginLeft: -16,\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '&:focus': {\n cursor: 'text',\n },\n },\n text: {\n cursor: 'text',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\nconst StyledSelect = styled('select', {\n appearance: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n borderRadius: 'inherit',\n color: 'inherit',\n font: 'inherit',\n outline: 'none',\n width: '100%',\n height: '100%',\n pl: '$1',\n pr: '$3',\n lineHeight: '25px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n\n '& option': {\n color: 'black',\n bc: 'white',\n },\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$selectFocusBorder, ${FOCUS_SHADOW}`,\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n color: '$selectDisabledText',\n },\n});\n\nconst SelectWrapper = styled('div', {\n position: 'relative',\n backgroundColor: '$selectBg',\n borderRadius: '$2',\n boxShadow: 'inset 0 0 0 1px $colors$selectBorder',\n color: '$selectText',\n fontFamily: '$rubik',\n fontSize: '$1',\n fontVariantNumeric: 'tabular-nums',\n fontWeight: '$regular',\n height: '$5',\n flexShrink: 0,\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n borderRadius: 'inherit',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n borderRadius: 'inherit',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$selectFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: '$selectHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n\n variants: {\n disabled: {\n true: {\n opacity: 0.7,\n color: '$selectDisabledText',\n '@hover': {\n '&:hover': {\n '&::before': {\n display: 'none',\n },\n '&::after': {\n display: 'none',\n },\n },\n },\n },\n },\n size: {\n small: {\n borderRadius: '$2',\n height: '$5',\n fontSize: '$1',\n lineHeight: '$sizes$5',\n '&:-webkit-autofill::first-line': {\n fontSize: '$1',\n },\n [`& ${StyledSelect}`]: {\n pl: '$2',\n pr: `calc($2 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($2 / 2)',\n },\n },\n medium: {\n borderRadius: '$3',\n height: '$6',\n fontSize: '$3',\n lineHeight: '$sizes$6',\n '&:-webkit-autofill::first-line': {\n fontSize: '$3',\n },\n [`& ${StyledSelect}`]: {\n pl: '$3',\n pr: `calc($3 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($3 / 2)',\n },\n },\n large: {\n borderRadius: '$3',\n height: '$7',\n fontSize: '$3',\n lineHeight: '$sizes$7',\n '&:-webkit-autofill::first-line': {\n fontSize: '$3',\n },\n [`& ${StyledSelect}`]: {\n pl: '$3',\n pr: `calc($3 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($3 / 2)',\n },\n },\n },\n variant: {\n ghost: {\n boxShadow: 'none',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n boxShadow: 'inset 0 0 0 1px $colors$slateA7',\n backgroundColor: '$selectHoverBg',\n },\n },\n '&:focus-within': {\n backgroundColor: '$loContrast',\n boxShadow:\n 'inset 0px 0px 0px 1px $colors$selectFocusBorder, 0px 0px 0px 1px $colors$selectFocusBorder',\n },\n },\n },\n state: {\n invalid: {\n boxShadow: 'inset 0 0 0 1px $colors$selectInvalidBorder',\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$selectInvalidBorder, ${FOCUS_SHADOW}`,\n },\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\nexport type SelectVariants = VariantProps<typeof StyledSelect> &\n VariantProps<typeof SelectWrapper> &\n VariantProps<typeof StyledCaretSortIcon>;\n\nexport type SelectProps = Omit<React.ComponentProps<typeof StyledSelect>, 'size'> &\n SelectVariants & { css?: CSS };\n\nexport const Select = React.forwardRef<React.ElementRef<typeof StyledSelect>, SelectProps>(\n ({ css, size, state, variant, cursor, ...props }, forwardedRef) => {\n return (\n <SelectWrapper\n css={css}\n size={size}\n state={state}\n variant={variant}\n disabled={props.disabled}\n >\n <StyledSelect ref={forwardedRef} {...props} />\n <StyledCaretSortIcon size={size} cursor={cursor} />\n </SelectWrapper>\n );\n }\n);\n\nSelect.toString = () => `.${SelectWrapper.className}`;\n"],"mappings":";;;;;;AAOA,IAAM,eAAe,kBAAkB,EAAE,CAAC;AAC1C,IAAM,cAAc;AAEpB,IAAM,sBAAsB,OAAO,eAAe;CAChD,UAAU;CACV,eAAe;CACf,SAAS;CAET,UAAU;EAGR,MAAM;GACJ,OAAO;IACL,WAAW;IACX,YAAY;GACd;GACA,QAAQ;IACN,WAAW;IACX,YAAY;GACd;GACA,OAAO;IACL,WAAW;IACX,YAAY;GACd;EACF;EACA,QAAQ;GACN,SAAS;IACP,QAAQ;IACR,WAAW,EACT,QAAQ,OACV;GACF;GACA,MAAM,EACJ,QAAQ,OACV;EACF;CACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAED,IAAM,eAAe,OAAO,UAAU;CACpC,YAAY;CACZ,iBAAiB;CACjB,QAAQ;CACR,cAAc;CACd,OAAO;CACP,MAAM;CACN,SAAS;CACT,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,IAAI;CACJ,YAAY;CACZ,UAAU;CACV,cAAc;CACd,YAAY;CAEZ,YAAY;EACV,OAAO;EACP,IAAI;CACN;CAEA,mBAAmB,EACjB,WAAW,8CAA8C,eAC3D;CAEA,cAAc;EACZ,eAAe;EACf,OAAO;CACT;AACF,CAAC;AAED,IAAM,gBAAgB,OAAO,OAAO;CAClC,UAAU;CACV,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,OAAO;CACP,YAAY;CACZ,UAAU;CACV,oBAAoB;C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AiB;GACnB,EACF;GACA,kBAAkB;IAChB,iBAAiB;IACjB,WACE;GACJ;EACF,EACF;EACA,OAAO,EACL,SAAS;GACP,WAAW;GACX,mBAAmB,EACjB,WAAW,gDAAgD,eAC7D;EACF,EACF;CACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AASD,IAAa,SAAS,MAAM,YACzB,EAAE,KAAK,MAAM,OAAO,SAAS,QAAQ,GAAG,SAAS,iBAAiB;CACjE,OACE,qBAAC,eAAD;EACO;EACC;EACC;EACE;EACT,UAAU,MAAM;EALlB,UAAA,CAOE,oBAAC,cAAD;GAAc,KAAK;GAAc,GAAI;EAAQ,CAAA,GAC7C,oBAAC,qBAAD;GAA2B;GAAc;EAAS,CAAA,CACrC;;AAEnB,CACF;AAEA,OAAO,iBAAiB,IAAI,cAAc"}
1
+ {"version":3,"file":"Select.js","names":[],"sources":["../../../components/Select/Select.tsx"],"sourcesContent":["import { CaretSortIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { useColorScheme } from '../colorSchemeContext';\nimport { elevationVariants } from '../Elevation';\nimport { useFieldControl } from '../Field/FieldContext';\n\n// CONSTANTS\nconst FOCUS_SHADOW = elevationVariants[1].boxShadow; // apply elevation $1 when focus\nconst CARET_WIDTH = '15px';\n\nconst StyledCaretSortIcon = styled(CaretSortIcon, {\n position: 'absolute',\n pointerEvents: 'none',\n display: 'inline',\n\n variants: {\n // Use margins instead of top/left to avoid setting \"position: relative\" on parent,\n // which would make stacking context tricky with Select used in a control group.\n size: {\n small: {\n marginTop: 5,\n marginLeft: -16,\n },\n medium: {\n marginTop: 9,\n marginLeft: -16,\n },\n large: {\n marginTop: 13,\n marginLeft: -16,\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '&:focus': {\n cursor: 'text',\n },\n },\n text: {\n cursor: 'text',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\nconst StyledSelect = styled('select', {\n appearance: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n borderRadius: 'inherit',\n color: 'inherit',\n font: 'inherit',\n outline: 'none',\n width: '100%',\n height: '100%',\n pl: '$1',\n pr: '$3',\n lineHeight: '25px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n\n '& option': {\n color: 'black',\n bc: 'white',\n },\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$selectFocusBorder, ${FOCUS_SHADOW}`,\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n color: '$selectDisabledText',\n },\n});\n\nconst SelectWrapper = styled('div', {\n position: 'relative',\n backgroundColor: '$selectBg',\n borderRadius: '$2',\n boxShadow: 'inset 0 0 0 1px $colors$selectBorder',\n color: '$selectText',\n fontFamily: '$rubik',\n fontSize: '$1',\n fontVariantNumeric: 'tabular-nums',\n fontWeight: '$regular',\n height: '$5',\n flexShrink: 0,\n\n [`& ${StyledSelect}:-webkit-autofill, & ${StyledSelect}:autofill`]: {\n boxShadow: 'inset 0 0 0 1px $colors$selectBorder, inset 0 0 0 100px $colors$selectBg',\n WebkitTextFillColor: '$colors$hiContrast',\n },\n\n [`& ${StyledSelect}:-webkit-autofill:has(option[value=\"\"]:checked)`]: {\n colorScheme: 'light !important',\n WebkitTextFillColor: 'black',\n },\n\n [`& ${StyledSelect}:-webkit-autofill:focus-visible, & ${StyledSelect}:autofill:focus-visible`]: {\n boxShadow: `inset 0 0 0 2px $colors$selectFocusBorder, inset 0 0 0 100px $colors$selectBg, ${FOCUS_SHADOW}`,\n },\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n borderRadius: 'inherit',\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n borderRadius: 'inherit',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$selectFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: '$selectHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n\n variants: {\n disabled: {\n true: {\n opacity: 0.7,\n color: '$selectDisabledText',\n '@hover': {\n '&:hover': {\n '&::before': {\n display: 'none',\n },\n '&::after': {\n display: 'none',\n },\n },\n },\n },\n },\n size: {\n small: {\n borderRadius: '$2',\n height: '$5',\n fontSize: '$1',\n lineHeight: '$sizes$5',\n '&:-webkit-autofill::first-line': {\n fontSize: '$1',\n },\n [`& ${StyledSelect}`]: {\n pl: '$2',\n pr: `calc($2 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($2 / 2)',\n },\n },\n medium: {\n borderRadius: '$3',\n height: '$6',\n fontSize: '$3',\n lineHeight: '$sizes$6',\n '&:-webkit-autofill::first-line': {\n fontSize: '$3',\n },\n [`& ${StyledSelect}`]: {\n pl: '$3',\n pr: `calc($3 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($3 / 2)',\n },\n },\n large: {\n borderRadius: '$3',\n height: '$7',\n fontSize: '$3',\n lineHeight: '$sizes$7',\n '&:-webkit-autofill::first-line': {\n fontSize: '$3',\n },\n [`& ${StyledSelect}`]: {\n pl: '$3',\n pr: `calc($3 + ${CARET_WIDTH})`,\n },\n [`& ${StyledCaretSortIcon}`]: {\n right: 'calc($3 / 2)',\n },\n },\n },\n variant: {\n ghost: {\n boxShadow: 'none',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n boxShadow: 'inset 0 0 0 1px $colors$slateA7',\n backgroundColor: '$selectHoverBg',\n },\n },\n '&:focus-within': {\n backgroundColor: '$loContrast',\n boxShadow:\n 'inset 0px 0px 0px 1px $colors$selectFocusBorder, 0px 0px 0px 1px $colors$selectFocusBorder',\n },\n },\n },\n state: {\n invalid: {\n boxShadow: 'inset 0 0 0 1px $colors$selectInvalidBorder',\n [`& ${StyledSelect}:-webkit-autofill, & ${StyledSelect}:autofill`]: {\n boxShadow:\n 'inset 0 0 0 1px $colors$selectInvalidBorder, inset 0 0 0 100px $colors$selectBg',\n },\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$selectInvalidBorder, ${FOCUS_SHADOW}`,\n },\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\nexport type SelectVariants = VariantProps<typeof StyledSelect> &\n VariantProps<typeof SelectWrapper> &\n VariantProps<typeof StyledCaretSortIcon>;\n\nexport type SelectProps = Omit<React.ComponentProps<typeof StyledSelect>, 'size'> &\n SelectVariants & { css?: CSS };\n\nexport const Select = React.forwardRef<React.ElementRef<typeof StyledSelect>, SelectProps>(\n (\n {\n css,\n size,\n state,\n variant,\n cursor,\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n style,\n ...props\n },\n forwardedRef,\n ) => {\n const colorScheme = useColorScheme();\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n\n return (\n <SelectWrapper\n css={css}\n size={size}\n state={control.invalid ? 'invalid' : state}\n variant={variant}\n disabled={control.disabled}\n >\n <StyledSelect\n ref={forwardedRef}\n id={control.id}\n disabled={control.disabled}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n style={{ colorScheme, ...style }}\n {...props}\n />\n <StyledCaretSortIcon size={size} cursor={cursor} aria-hidden />\n </SelectWrapper>\n );\n },\n);\n\nSelect.toString = () => `.${SelectWrapper.className}`;\n"],"mappings":";;;;;;;;AASA,IAAM,eAAe,kBAAkB,EAAE,CAAC;AAC1C,IAAM,cAAc;AAEpB,IAAM,sBAAsB,OAAO,eAAe;CAChD,UAAU;CACV,eAAe;CACf,SAAS;CAET,UAAU;EAGR,MAAM;GACJ,OAAO;IACL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AoB,iBACpB,gBAAgB,aAChB,OACA,GAAG,SAEL,iBACG;CACH,MAAM,cAAc,eAAe;CACnC,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA,SAAS,UAAU;EACnB,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CAED,OACE,qBAAC,eAAD;EACO;EACC;EACN,OAAO,QAAQ,UAAU,YAAY;EAC5B;EACT,UAAU,QAAQ;EALpB,UAAA,CAOE,oBAAC,cAAD;GACE,KAAK;GACL,IAAI,QAAQ;GACZ,UAAU,QAAQ;GAClB,oBAAkB,QAAQ;GAC1B,gBAAc,QAAQ;GACtB,OAAO;IAAE;IAAa,GAAG;GAAM;GAC/B,GAAI;EACL,CAAA,GACD,oBAAC,qBAAD;GAA2B;GAAc;GAAQ,eAAA;EAAa,CAAA,CACjD;;AAEnB,CACF;AAEA,OAAO,iBAAiB,IAAI,cAAc"}
@@ -84,10 +84,10 @@ var SidePanelCloseIconButton = react.default.forwardRef((props, forwardedRef) =>
84
84
  ref: forwardedRef,
85
85
  css: { color: "$hiContrast" },
86
86
  ...props,
87
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.Cross1Icon, {})
87
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.Cross1Icon, { "aria-hidden": true })
88
88
  })
89
89
  }));
90
- var SidePanel = react.default.forwardRef(({ description, noOverlay = false, noCloseIcon = false, children, onOpenChange, open = false, defaultOpen = false, ...props }, forwardedRef) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Root, {
90
+ var SidePanel = react.default.forwardRef(({ description, noOverlay = false, noCloseIcon = false, closeLabel = "Close", children, onOpenChange, open = false, defaultOpen = false, ...props }, forwardedRef) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Root, {
91
91
  open,
92
92
  onOpenChange,
93
93
  defaultOpen,
@@ -100,7 +100,7 @@ var SidePanel = react.default.forwardRef(({ description, noOverlay = false, noCl
100
100
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dialog.Description, { children: description })
101
101
  }) : null,
102
102
  children,
103
- !noCloseIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidePanelCloseIconButton, {})
103
+ !noCloseIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidePanelCloseIconButton, { "aria-label": closeLabel })
104
104
  ]
105
105
  })] })
106
106
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanel.cjs","names":["keyframes","styled","DialogPrimitive","overlayStyles","React","IconButton","Cross1Icon","VisuallyHidden"],"sources":["../../../components/SidePanel/SidePanel.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Cross1Icon } from '@radix-ui/react-icons';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\nimport { IconButton } from '../IconButton';\nimport { overlayStyles } from '../Overlay';\n\nconst fadeIn = keyframes({\n from: { opacity: '0' },\n to: { opacity: '1' },\n});\n\nconst fadeOut = keyframes({\n from: { opacity: '1' },\n to: { opacity: '0' },\n});\n\nconst SidePanelOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n\n '&[data-state=\"open\"]': {\n animation: `${fadeIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n '&[data-state=\"closed\"]': {\n animation: `${fadeOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n});\n\nconst slideIn = keyframes({\n from: { transform: '$$transformValue' },\n to: { transform: 'translate3d(0,0,0)' },\n});\n\nconst slideOut = keyframes({\n from: { transform: 'translate3d(0,0,0)' },\n to: { transform: '$$transformValue' },\n});\n\nconst StyledContent = styled(DialogPrimitive.Content, {\n backgroundColor: '$sidePanelBackground',\n boxShadow: 'inset 0 0 0 1px $colors$deepBlue4',\n position: 'fixed',\n top: 0,\n bottom: 0,\n width: 375,\n p: '$4',\n\n '&[data-state=\"open\"]': {\n animation: `${slideIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n '&[data-state=\"closed\"]': {\n animation: `${slideOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n variants: {\n side: {\n top: {\n $$transformValue: 'translate3d(0,-100%,0)',\n width: '100%',\n height: 250,\n bottom: 'auto',\n },\n right: {\n $$transformValue: 'translate3d(100%,0,0)',\n right: 0,\n maxWidth: '50%',\n },\n bottom: {\n $$transformValue: 'translate3d(0,100%,0)',\n width: '100%',\n height: 250,\n bottom: 0,\n top: 'auto',\n },\n left: {\n $$transformValue: 'translate3d(-100%,0,0)',\n left: 0,\n maxWidth: '50%',\n },\n },\n },\n\n defaultVariants: {\n side: 'right',\n },\n});\n\nconst StyledCloseButton = styled(DialogPrimitive.Close, {\n position: 'absolute',\n top: '$2',\n right: '$2',\n cursor: 'pointer',\n});\n\ninterface SidePanelCloseButtonProps\n extends VariantProps<typeof IconButton>,\n ComponentProps<typeof IconButton> {}\n\nconst SidePanelCloseIconButton = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n SidePanelCloseButtonProps\n>((props, forwardedRef) => (\n <StyledCloseButton asChild>\n <IconButton ref={forwardedRef} css={{ color: '$hiContrast' }} {...props}>\n <Cross1Icon />\n </IconButton>\n </StyledCloseButton>\n));\n\ntype SidePanelContentVariants = VariantProps<typeof StyledContent>;\ntype SidePanelContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;\ntype SidePanelProps = SidePanelContentPrimitiveProps &\n SidePanelContentVariants & {\n css?: CSS;\n description?: string;\n noOverlay?: boolean;\n noCloseIcon?: boolean;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange(open: boolean): void;\n };\n\nexport const SidePanel = React.forwardRef<React.ElementRef<typeof StyledContent>, SidePanelProps>(\n (\n {\n description,\n noOverlay = false,\n noCloseIcon = false,\n children,\n onOpenChange,\n open = false,\n defaultOpen = false,\n ...props\n },\n forwardedRef,\n ) => (\n <DialogPrimitive.Root open={open} onOpenChange={onOpenChange} defaultOpen={defaultOpen}>\n <DialogPrimitive.Portal>\n {!noOverlay && <SidePanelOverlay />}\n <StyledContent {...props} ref={forwardedRef}>\n {description ? (\n <VisuallyHidden asChild>\n <DialogPrimitive.Description>{description}</DialogPrimitive.Description>\n </VisuallyHidden>\n ) : null}\n {children}\n {!noCloseIcon && <SidePanelCloseIconButton />}\n </StyledContent>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n ),\n);\n"],"mappings":";;;;;;;;;;;;AASA,IAAM,SAASA,wBAAAA,UAAU;CACvB,MAAM,EAAE,SAAS,IAAI;CACrB,IAAI,EAAE,SAAS,IAAI;AACrB,CAAC;AAED,IAAM,UAAUA,wBAAAA,UAAU;CACxB,MAAM,EAAE,SAAS,IAAI;CACrB,IAAI,EAAE,SAAS,IAAI;AACrB,CAAC;AAED,IAAM,mBAAmBC,wBAAAA,OAAOC,uBAAgB,SAASC,gBAAAA,eAAe;CACtE,UAAU;CACV,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CAEN,0BAAwB,EACtB,WAAW,GAAG,OAAO,uCACvB;CAEA,4BAA0B,EACxB,WAAW,GAAG,QAAQ,uCACxB;AACF,CAAC;AAED,IAAM,UAAUH,wBAAAA,UAAU;CACxB,MAAM,EAAE,WAAW,mBAAmB;CACtC,IAAI,EAAE,WAAW,qBAAqB;AACxC,CAAC;AAED,IAAM,WAAWA,wBAAAA,UAAU;CACzB,MAAM,EAAE,WAAW,qBAAqB;CACxC,IAAI,EAAE,WAAW,mBAAmB;AACtC,CAAC;AAED,IAAM,gBAAgBC,wBAAAA,OAAOC,uBAAgB,SAAS;CACpD,iBAAiB;CACjB,WAAW;CACX,UAAU;CACV,KAAK;CACL,QAAQ;CACR,OAAO;CACP,GAAG;CAEH,0BAAwB,EACtB,WAAW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;GACG,cACC,iBAAA,GAAA,kBAAA,IAAA,CAACK,gCAAAA,gBAAD;IAAgB,SAAA;IACd,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACL,uBAAgB,aAAjB,EAAA,UAA8B,YAAyC,CAAA;GACzD,CAAA,IACd;GACH;GACA,CAAC,eAAe,iBAAA,GAAA,kBAAA,IAAA,CAAC,0BAAD,CAA2B,CAAA;EAC/B;CACO,CAAA,CAAA,EAAA,CAAA;AACJ,CAAA,CAE1B"}
1
+ {"version":3,"file":"SidePanel.cjs","names":["keyframes","styled","DialogPrimitive","overlayStyles","React","IconButton","Cross1Icon","VisuallyHidden"],"sources":["../../../components/SidePanel/SidePanel.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Cross1Icon } from '@radix-ui/react-icons';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\nimport { IconButton } from '../IconButton';\nimport { overlayStyles } from '../Overlay';\n\nconst fadeIn = keyframes({\n from: { opacity: '0' },\n to: { opacity: '1' },\n});\n\nconst fadeOut = keyframes({\n from: { opacity: '1' },\n to: { opacity: '0' },\n});\n\nconst SidePanelOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n\n '&[data-state=\"open\"]': {\n animation: `${fadeIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n '&[data-state=\"closed\"]': {\n animation: `${fadeOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n});\n\nconst slideIn = keyframes({\n from: { transform: '$$transformValue' },\n to: { transform: 'translate3d(0,0,0)' },\n});\n\nconst slideOut = keyframes({\n from: { transform: 'translate3d(0,0,0)' },\n to: { transform: '$$transformValue' },\n});\n\nconst StyledContent = styled(DialogPrimitive.Content, {\n backgroundColor: '$sidePanelBackground',\n boxShadow: 'inset 0 0 0 1px $colors$deepBlue4',\n position: 'fixed',\n top: 0,\n bottom: 0,\n width: 375,\n p: '$4',\n\n '&[data-state=\"open\"]': {\n animation: `${slideIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n '&[data-state=\"closed\"]': {\n animation: `${slideOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n variants: {\n side: {\n top: {\n $$transformValue: 'translate3d(0,-100%,0)',\n width: '100%',\n height: 250,\n bottom: 'auto',\n },\n right: {\n $$transformValue: 'translate3d(100%,0,0)',\n right: 0,\n maxWidth: '50%',\n },\n bottom: {\n $$transformValue: 'translate3d(0,100%,0)',\n width: '100%',\n height: 250,\n bottom: 0,\n top: 'auto',\n },\n left: {\n $$transformValue: 'translate3d(-100%,0,0)',\n left: 0,\n maxWidth: '50%',\n },\n },\n },\n\n defaultVariants: {\n side: 'right',\n },\n});\n\nconst StyledCloseButton = styled(DialogPrimitive.Close, {\n position: 'absolute',\n top: '$2',\n right: '$2',\n cursor: 'pointer',\n});\n\ninterface SidePanelCloseButtonProps\n extends VariantProps<typeof IconButton>, ComponentProps<typeof IconButton> {}\n\nconst SidePanelCloseIconButton = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n SidePanelCloseButtonProps\n>((props, forwardedRef) => (\n <StyledCloseButton asChild>\n <IconButton ref={forwardedRef} css={{ color: '$hiContrast' }} {...props}>\n <Cross1Icon aria-hidden />\n </IconButton>\n </StyledCloseButton>\n));\n\ntype SidePanelContentVariants = VariantProps<typeof StyledContent>;\ntype SidePanelContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;\ntype SidePanelProps = SidePanelContentPrimitiveProps &\n SidePanelContentVariants & {\n css?: CSS;\n description?: string;\n noOverlay?: boolean;\n noCloseIcon?: boolean;\n closeLabel?: string;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange(open: boolean): void;\n };\n\nexport const SidePanel = React.forwardRef<React.ElementRef<typeof StyledContent>, SidePanelProps>(\n (\n {\n description,\n noOverlay = false,\n noCloseIcon = false,\n closeLabel = 'Close',\n children,\n onOpenChange,\n open = false,\n defaultOpen = false,\n ...props\n },\n forwardedRef,\n ) => (\n <DialogPrimitive.Root open={open} onOpenChange={onOpenChange} defaultOpen={defaultOpen}>\n <DialogPrimitive.Portal>\n {!noOverlay && <SidePanelOverlay />}\n <StyledContent {...props} ref={forwardedRef}>\n {description ? (\n <VisuallyHidden asChild>\n <DialogPrimitive.Description>{description}</DialogPrimitive.Description>\n </VisuallyHidden>\n ) : null}\n {children}\n {!noCloseIcon && <SidePanelCloseIconButton aria-label={closeLabel} />}\n </StyledContent>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n ),\n);\n"],"mappings":";;;;;;;;;;;;AASA,IAAM,SAASA,wBAAAA,UAAU;CACvB,MAAM,EAAE,SAAS,IAAI;CACrB,IAAI,EAAE,SAAS,IAAI;AACrB,CAAC;AAED,IAAM,UAAUA,wBAAAA,UAAU;CACxB,MAAM,EAAE,SAAS,IAAI;CACrB,IAAI,EAAE,SAAS,IAAI;AACrB,CAAC;AAED,IAAM,mBAAmBC,wBAAAA,OAAOC,uBAAgB,SAASC,gBAAAA,eAAe;CACtE,UAAU;CACV,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CAEN,0BAAwB,EACtB,WAAW,GAAG,OAAO,uCACvB;CAEA,4BAA0B,EACxB,WAAW,GAAG,QAAQ,uCACxB;AACF,CAAC;AAED,IAAM,UAAUH,wBAAAA,UAAU;CACxB,MAAM,EAAE,WAAW,mBAAmB;CACtC,IAAI,EAAE,WAAW,qBAAqB;AACxC,CAAC;AAED,IAAM,WAAWA,wBAAAA,UAAU;CACzB,MAAM,EAAE,WAAW,qBAAqB;CACxC,IAAI,EAAE,WAAW,mBAAmB;AACtC,CAAC;AAED,IAAM,gBAAgBC,wBAAAA,OAAOC,uBAAgB,SAAS;CACpD,iBAAiB;CACjB,WAAW;CACX,UAAU;CACV,KAAK;CACL,QAA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iBAAA,GAAA,kBAAA,KAAA,CAAC,eAAD;EAAe,GAAI;EAAO,KAAK;EAA/B,UAAA;GACG,cACC,iBAAA,GAAA,kBAAA,IAAA,CAACK,gCAAAA,gBAAD;IAAgB,SAAA;IACd,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACL,uBAAgB,aAAjB,EAAA,UAA8B,YAAyC,CAAA;GACzD,CAAA,IACd;GACH;GACA,CAAC,eAAe,iBAAA,GAAA,kBAAA,IAAA,CAAC,0BAAD,EAA0B,cAAY,WAAa,CAAA;EACvD;CACO,CAAA,CAAA,EAAA,CAAA;AACJ,CAAA,CAE1B"}
@@ -81,10 +81,10 @@ var SidePanelCloseIconButton = React.forwardRef((props, forwardedRef) => /* @__P
81
81
  ref: forwardedRef,
82
82
  css: { color: "$hiContrast" },
83
83
  ...props,
84
- children: /* @__PURE__ */ jsx(Cross1Icon, {})
84
+ children: /* @__PURE__ */ jsx(Cross1Icon, { "aria-hidden": true })
85
85
  })
86
86
  }));
87
- var SidePanel = React.forwardRef(({ description, noOverlay = false, noCloseIcon = false, children, onOpenChange, open = false, defaultOpen = false, ...props }, forwardedRef) => /* @__PURE__ */ jsx(DialogPrimitive.Root, {
87
+ var SidePanel = React.forwardRef(({ description, noOverlay = false, noCloseIcon = false, closeLabel = "Close", children, onOpenChange, open = false, defaultOpen = false, ...props }, forwardedRef) => /* @__PURE__ */ jsx(DialogPrimitive.Root, {
88
88
  open,
89
89
  onOpenChange,
90
90
  defaultOpen,
@@ -97,7 +97,7 @@ var SidePanel = React.forwardRef(({ description, noOverlay = false, noCloseIcon
97
97
  children: /* @__PURE__ */ jsx(DialogPrimitive.Description, { children: description })
98
98
  }) : null,
99
99
  children,
100
- !noCloseIcon && /* @__PURE__ */ jsx(SidePanelCloseIconButton, {})
100
+ !noCloseIcon && /* @__PURE__ */ jsx(SidePanelCloseIconButton, { "aria-label": closeLabel })
101
101
  ]
102
102
  })] })
103
103
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanel.js","names":[],"sources":["../../../components/SidePanel/SidePanel.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Cross1Icon } from '@radix-ui/react-icons';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\nimport { IconButton } from '../IconButton';\nimport { overlayStyles } from '../Overlay';\n\nconst fadeIn = keyframes({\n from: { opacity: '0' },\n to: { opacity: '1' },\n});\n\nconst fadeOut = keyframes({\n from: { opacity: '1' },\n to: { opacity: '0' },\n});\n\nconst SidePanelOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n\n '&[data-state=\"open\"]': {\n animation: `${fadeIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n '&[data-state=\"closed\"]': {\n animation: `${fadeOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n});\n\nconst slideIn = keyframes({\n from: { transform: '$$transformValue' },\n to: { transform: 'translate3d(0,0,0)' },\n});\n\nconst slideOut = keyframes({\n from: { transform: 'translate3d(0,0,0)' },\n to: { transform: '$$transformValue' },\n});\n\nconst StyledContent = styled(DialogPrimitive.Content, {\n backgroundColor: '$sidePanelBackground',\n boxShadow: 'inset 0 0 0 1px $colors$deepBlue4',\n position: 'fixed',\n top: 0,\n bottom: 0,\n width: 375,\n p: '$4',\n\n '&[data-state=\"open\"]': {\n animation: `${slideIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n '&[data-state=\"closed\"]': {\n animation: `${slideOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n variants: {\n side: {\n top: {\n $$transformValue: 'translate3d(0,-100%,0)',\n width: '100%',\n height: 250,\n bottom: 'auto',\n },\n right: {\n $$transformValue: 'translate3d(100%,0,0)',\n right: 0,\n maxWidth: '50%',\n },\n bottom: {\n $$transformValue: 'translate3d(0,100%,0)',\n width: '100%',\n height: 250,\n bottom: 0,\n top: 'auto',\n },\n left: {\n $$transformValue: 'translate3d(-100%,0,0)',\n left: 0,\n maxWidth: '50%',\n },\n },\n },\n\n defaultVariants: {\n side: 'right',\n },\n});\n\nconst StyledCloseButton = styled(DialogPrimitive.Close, {\n position: 'absolute',\n top: '$2',\n right: '$2',\n cursor: 'pointer',\n});\n\ninterface SidePanelCloseButtonProps\n extends VariantProps<typeof IconButton>,\n ComponentProps<typeof IconButton> {}\n\nconst SidePanelCloseIconButton = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n SidePanelCloseButtonProps\n>((props, forwardedRef) => (\n <StyledCloseButton asChild>\n <IconButton ref={forwardedRef} css={{ color: '$hiContrast' }} {...props}>\n <Cross1Icon />\n </IconButton>\n </StyledCloseButton>\n));\n\ntype SidePanelContentVariants = VariantProps<typeof StyledContent>;\ntype SidePanelContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;\ntype SidePanelProps = SidePanelContentPrimitiveProps &\n SidePanelContentVariants & {\n css?: CSS;\n description?: string;\n noOverlay?: boolean;\n noCloseIcon?: boolean;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange(open: boolean): void;\n };\n\nexport const SidePanel = React.forwardRef<React.ElementRef<typeof StyledContent>, SidePanelProps>(\n (\n {\n description,\n noOverlay = false,\n noCloseIcon = false,\n children,\n onOpenChange,\n open = false,\n defaultOpen = false,\n ...props\n },\n forwardedRef,\n ) => (\n <DialogPrimitive.Root open={open} onOpenChange={onOpenChange} defaultOpen={defaultOpen}>\n <DialogPrimitive.Portal>\n {!noOverlay && <SidePanelOverlay />}\n <StyledContent {...props} ref={forwardedRef}>\n {description ? (\n <VisuallyHidden asChild>\n <DialogPrimitive.Description>{description}</DialogPrimitive.Description>\n </VisuallyHidden>\n ) : null}\n {children}\n {!noCloseIcon && <SidePanelCloseIconButton />}\n </StyledContent>\n </DialogPrimitive.Portal>\n </DialogPr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K;CACL,OAAO;CACP,QAAQ;AACV,CAAC;AAMD,IAAM,2BAA2B,MAAM,YAGpC,OAAO,iBACR,oBAAC,mBAAD;CAAmB,SAAA;CACjB,UAAA,oBAAC,YAAD;EAAY,KAAK;EAAc,KAAK,EAAE,OAAO,cAAc;EAAG,GAAI;EAChE,UAAA,oBAAC,YAAD,CAAa,CAAA;CACH,CAAA;AACK,CAAA,CACpB;AAeD,IAAa,YAAY,MAAM,YAE3B,EACE,aACA,YAAY,OACZ,cAAc,OACd,UACA,cACA,OAAO,OACP,cAAc,OACd,GAAG,SAEL,iBAEA,oBAAC,gBAAgB,MAAjB;CAA4B;CAAoB;CAA2B;CACzE,UAAA,qBAAC,gBAAgB,QAAjB,EAAA,UAAA,CACG,CAAC,aAAa,oBAAC,kBAAD,CAAmB,CAAA,GAClC,qBAAC,eAAD;EAAe,GAAI;EAAO,KAAK;EAA/B,UAAA;GACG,cACC,oBAAC,gBAAD;IAAgB,SAAA;IACd,UAAA,oBAAC,gBAAgB,aAAjB,EAAA,UAA8B,YAAyC,CAAA;GACzD,CAAA,IACd;GACH;GACA,CAAC,eAAe,oBAAC,0BAAD,CAA2B,CAAA;EAC/B;CACO,CAAA,CAAA,EAAA,CAAA;AACJ,CAAA,CAE1B"}
1
+ {"version":3,"file":"SidePanel.js","names":[],"sources":["../../../components/SidePanel/SidePanel.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Cross1Icon } from '@radix-ui/react-icons';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\nimport { IconButton } from '../IconButton';\nimport { overlayStyles } from '../Overlay';\n\nconst fadeIn = keyframes({\n from: { opacity: '0' },\n to: { opacity: '1' },\n});\n\nconst fadeOut = keyframes({\n from: { opacity: '1' },\n to: { opacity: '0' },\n});\n\nconst SidePanelOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n\n '&[data-state=\"open\"]': {\n animation: `${fadeIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n '&[data-state=\"closed\"]': {\n animation: `${fadeOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n});\n\nconst slideIn = keyframes({\n from: { transform: '$$transformValue' },\n to: { transform: 'translate3d(0,0,0)' },\n});\n\nconst slideOut = keyframes({\n from: { transform: 'translate3d(0,0,0)' },\n to: { transform: '$$transformValue' },\n});\n\nconst StyledContent = styled(DialogPrimitive.Content, {\n backgroundColor: '$sidePanelBackground',\n boxShadow: 'inset 0 0 0 1px $colors$deepBlue4',\n position: 'fixed',\n top: 0,\n bottom: 0,\n width: 375,\n p: '$4',\n\n '&[data-state=\"open\"]': {\n animation: `${slideIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n '&[data-state=\"closed\"]': {\n animation: `${slideOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,\n },\n\n variants: {\n side: {\n top: {\n $$transformValue: 'translate3d(0,-100%,0)',\n width: '100%',\n height: 250,\n bottom: 'auto',\n },\n right: {\n $$transformValue: 'translate3d(100%,0,0)',\n right: 0,\n maxWidth: '50%',\n },\n bottom: {\n $$transformValue: 'translate3d(0,100%,0)',\n width: '100%',\n height: 250,\n bottom: 0,\n top: 'auto',\n },\n left: {\n $$transformValue: 'translate3d(-100%,0,0)',\n left: 0,\n maxWidth: '50%',\n },\n },\n },\n\n defaultVariants: {\n side: 'right',\n },\n});\n\nconst StyledCloseButton = styled(DialogPrimitive.Close, {\n position: 'absolute',\n top: '$2',\n right: '$2',\n cursor: 'pointer',\n});\n\ninterface SidePanelCloseButtonProps\n extends VariantProps<typeof IconButton>, ComponentProps<typeof IconButton> {}\n\nconst SidePanelCloseIconButton = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n SidePanelCloseButtonProps\n>((props, forwardedRef) => (\n <StyledCloseButton asChild>\n <IconButton ref={forwardedRef} css={{ color: '$hiContrast' }} {...props}>\n <Cross1Icon aria-hidden />\n </IconButton>\n </StyledCloseButton>\n));\n\ntype SidePanelContentVariants = VariantProps<typeof StyledContent>;\ntype SidePanelContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;\ntype SidePanelProps = SidePanelContentPrimitiveProps &\n SidePanelContentVariants & {\n css?: CSS;\n description?: string;\n noOverlay?: boolean;\n noCloseIcon?: boolean;\n closeLabel?: string;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange(open: boolean): void;\n };\n\nexport const SidePanel = React.forwardRef<React.ElementRef<typeof StyledContent>, SidePanelProps>(\n (\n {\n description,\n noOverlay = false,\n noCloseIcon = false,\n closeLabel = 'Close',\n children,\n onOpenChange,\n open = false,\n defaultOpen = false,\n ...props\n },\n forwardedRef,\n ) => (\n <DialogPrimitive.Root open={open} onOpenChange={onOpenChange} defaultOpen={defaultOpen}>\n <DialogPrimitive.Portal>\n {!noOverlay && <SidePanelOverlay />}\n <StyledContent {...props} ref={forwardedRef}>\n {description ? (\n <VisuallyHidden asChild>\n <DialogPrimitive.Description>{description}</DialogPrimitive.Description>\n </VisuallyHidden>\n ) : null}\n {children}\n {!noCloseIcon && <SidePanelCloseIconButton aria-label={closeLabel} />}\n </StyledContent>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n ),\n);\n"],"mappings":";;;;;;;;;AASA,IAAM,SAAS,UAAU;CACvB,MAAM,EAAE,SAAS,IAAI;CACrB,IAAI,EAAE,SAAS,IAAI;AACrB,CAAC;AAED,IAAM,UAAU,UAAU;CACxB,MAAM,EAAE,SAAS,IAAI;CACrB,IAAI,EAAE,SAAS,IAAI;AACrB,CAAC;AAED,IAAM,mBAAmB,OAAO,gBAAgB,SAAS,eAAe;CACtE,UAAU;CACV,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CAEN,0BAAwB,EACtB,WAAW,GAAG,OAAO,uCACvB;CAEA,4BA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BAEA,oBAAC,gBAAgB,MAAjB;CAA4B;CAAoB;CAA2B;CACzE,UAAA,qBAAC,gBAAgB,QAAjB,EAAA,UAAA,CACG,CAAC,aAAa,oBAAC,kBAAD,CAAmB,CAAA,GAClC,qBAAC,eAAD;EAAe,GAAI;EAAO,KAAK;EAA/B,UAAA;GACG,cACC,oBAAC,gBAAD;IAAgB,SAAA;IACd,UAAA,oBAAC,gBAAgB,aAAjB,EAAA,UAA8B,YAAyC,CAAA;GACzD,CAAA,IACd;GACH;GACA,CAAC,eAAe,oBAAC,0BAAD,EAA0B,cAAY,WAAa,CAAA;EACvD;CACO,CAAA,CAAA,EAAA,CAAA;AACJ,CAAA,CAE1B"}
@@ -33,6 +33,10 @@ var Skeleton = require_stitches_config.styled("div", {
33
33
  right: 0,
34
34
  top: 0
35
35
  },
36
+ "@motion": { "&::after": {
37
+ animation: "none",
38
+ opacity: 0
39
+ } },
36
40
  variants: { variant: {
37
41
  square: { borderRadius: "$2" },
38
42
  circle: { borderRadius: "$round" },
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.cjs","names":["keyframes","styled"],"sources":["../../../components/Skeleton/Skeleton.tsx"],"sourcesContent":["import { keyframes, styled, VariantProps } from '../../stitches.config';\n\nconst pulse = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: '100%' },\n});\n\nexport const Skeleton = styled('div', {\n backgroundColor: '$skeletonBackground',\n position: 'relative',\n overflow: 'hidden',\n borderRadius: '3px',\n height: 'auto',\n width: 'auto',\n '&:not(:empty)': {\n '& > *': {\n visibility: 'hidden',\n display: 'block',\n },\n maxWidth: 'fit-content',\n },\n\n '&::after': {\n animationName: `${pulse}`,\n animationDuration: '500ms',\n animationDirection: 'alternate',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'ease-in-out',\n backgroundColor: '$skeletonAnimation',\n borderRadius: 'inherit',\n bottom: 0,\n content: '\"\"',\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n\n variants: {\n variant: {\n square: {\n borderRadius: '$2',\n },\n circle: {\n borderRadius: '$round',\n },\n badge: {\n borderRadius: '$pill',\n display: 'inline-flex',\n },\n button: {\n borderRadius: '$3',\n display: 'inline-flex',\n },\n text: {\n '&:empty:before': {\n content: '\"\\\\00a0\"', // adds a space character before element\n },\n },\n },\n },\n defaultVariants: {\n variant: 'text',\n },\n});\n\nexport type SkeletonVariants = VariantProps<typeof Skeleton>;\nexport type SkeletonProps = SkeletonVariants & NonNullable<unknown>;\n"],"mappings":";;AAEA,IAAM,QAAQA,wBAAAA,UAAU;CACtB,MAAM,EAAE,SAAS,EAAE;CACnB,QAAQ,EAAE,SAAS,OAAO;AAC5B,CAAC;AAED,IAAa,WAAWC,wBAAAA,OAAO,OAAO;CACpC,iBAAiB;CACjB,UAAU;CACV,UAAU;CACV,cAAc;CACd,QAAQ;CACR,OAAO;CACP,iBAAiB;EACf,SAAS;GACP,YAAY;GACZ,SAAS;EACX;EACA,UAAU;CACZ;CAEA,YAAY;EACV,eAAe,GAAG;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,yBAAyB;EACzB,yBAAyB;EACzB,iBAAiB;EACjB,cAAc;EACd,QAAQ;EACR,SAAS;EACT,MAAM;EACN,UAAU;EACV,OAAO;EACP,KAAK;CACP;CAEA,UAAU,EACR,SAAS;EACP,QAAQ,EACN,cAAc,KAChB;EACA,QAAQ,EACN,cAAc,SAChB;EACA,OAAO;GACL,cAAc;GACd,SAAS;EACX;EACA,QAAQ;GACN,cAAc;GACd,SAAS;EACX;EACA,MAAM,EACJ,kBAAkB,EAChB,SAAS,aACX,EACF;CACF,EACF;CACA,iBAAiB,EACf,SAAS,OACX;AACF,CAAC"}
1
+ {"version":3,"file":"Skeleton.cjs","names":["keyframes","styled"],"sources":["../../../components/Skeleton/Skeleton.tsx"],"sourcesContent":["import { keyframes, styled, VariantProps } from '../../stitches.config';\n\nconst pulse = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: '100%' },\n});\n\nexport const Skeleton = styled('div', {\n backgroundColor: '$skeletonBackground',\n position: 'relative',\n overflow: 'hidden',\n borderRadius: '3px',\n height: 'auto',\n width: 'auto',\n '&:not(:empty)': {\n '& > *': {\n visibility: 'hidden',\n display: 'block',\n },\n maxWidth: 'fit-content',\n },\n\n '&::after': {\n animationName: `${pulse}`,\n animationDuration: '500ms',\n animationDirection: 'alternate',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'ease-in-out',\n backgroundColor: '$skeletonAnimation',\n borderRadius: 'inherit',\n bottom: 0,\n content: '\"\"',\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n\n '@motion': {\n '&::after': {\n animation: 'none',\n opacity: 0,\n },\n },\n\n variants: {\n variant: {\n square: {\n borderRadius: '$2',\n },\n circle: {\n borderRadius: '$round',\n },\n badge: {\n borderRadius: '$pill',\n display: 'inline-flex',\n },\n button: {\n borderRadius: '$3',\n display: 'inline-flex',\n },\n text: {\n '&:empty:before': {\n content: '\"\\\\00a0\"', // adds a space character before element\n },\n },\n },\n },\n defaultVariants: {\n variant: 'text',\n },\n});\n\nexport type SkeletonVariants = VariantProps<typeof Skeleton>;\nexport type SkeletonProps = SkeletonVariants & NonNullable<unknown>;\n"],"mappings":";;AAEA,IAAM,QAAQA,wBAAAA,UAAU;CACtB,MAAM,EAAE,SAAS,EAAE;CACnB,QAAQ,EAAE,SAAS,OAAO;AAC5B,CAAC;AAED,IAAa,WAAWC,wBAAAA,OAAO,OAAO;CACpC,iBAAiB;CACjB,UAAU;CACV,UAAU;CACV,cAAc;CACd,QAAQ;CACR,OAAO;CACP,iBAAiB;EACf,SAAS;GACP,YAAY;GACZ,SAAS;EACX;EACA,UAAU;CACZ;CAEA,YAAY;EACV,eAAe,GAAG;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,yBAAyB;EACzB,yBAAyB;EACzB,iBAAiB;EACjB,cAAc;EACd,QAAQ;EACR,SAAS;EACT,MAAM;EACN,UAAU;EACV,OAAO;EACP,KAAK;CACP;CAEA,WAAW,EACT,YAAY;EACV,WAAW;EACX,SAAS;CACX,EACF;CAEA,UAAU,EACR,SAAS;EACP,QAAQ,EACN,cAAc,KAChB;EACA,QAAQ,EACN,cAAc,SAChB;EACA,OAAO;GACL,cAAc;GACd,SAAS;EACX;EACA,QAAQ;GACN,cAAc;GACd,SAAS;EACX;EACA,MAAM,EACJ,kBAAkB,EAChB,SAAS,aACX,EACF;CACF,EACF;CACA,iBAAiB,EACf,SAAS,OACX;AACF,CAAC"}
@@ -33,6 +33,10 @@ var Skeleton = styled("div", {
33
33
  right: 0,
34
34
  top: 0
35
35
  },
36
+ "@motion": { "&::after": {
37
+ animation: "none",
38
+ opacity: 0
39
+ } },
36
40
  variants: { variant: {
37
41
  square: { borderRadius: "$2" },
38
42
  circle: { borderRadius: "$round" },
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.js","names":[],"sources":["../../../components/Skeleton/Skeleton.tsx"],"sourcesContent":["import { keyframes, styled, VariantProps } from '../../stitches.config';\n\nconst pulse = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: '100%' },\n});\n\nexport const Skeleton = styled('div', {\n backgroundColor: '$skeletonBackground',\n position: 'relative',\n overflow: 'hidden',\n borderRadius: '3px',\n height: 'auto',\n width: 'auto',\n '&:not(:empty)': {\n '& > *': {\n visibility: 'hidden',\n display: 'block',\n },\n maxWidth: 'fit-content',\n },\n\n '&::after': {\n animationName: `${pulse}`,\n animationDuration: '500ms',\n animationDirection: 'alternate',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'ease-in-out',\n backgroundColor: '$skeletonAnimation',\n borderRadius: 'inherit',\n bottom: 0,\n content: '\"\"',\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n\n variants: {\n variant: {\n square: {\n borderRadius: '$2',\n },\n circle: {\n borderRadius: '$round',\n },\n badge: {\n borderRadius: '$pill',\n display: 'inline-flex',\n },\n button: {\n borderRadius: '$3',\n display: 'inline-flex',\n },\n text: {\n '&:empty:before': {\n content: '\"\\\\00a0\"', // adds a space character before element\n },\n },\n },\n },\n defaultVariants: {\n variant: 'text',\n },\n});\n\nexport type SkeletonVariants = VariantProps<typeof Skeleton>;\nexport type SkeletonProps = SkeletonVariants & NonNullable<unknown>;\n"],"mappings":";;AAEA,IAAM,QAAQ,UAAU;CACtB,MAAM,EAAE,SAAS,EAAE;CACnB,QAAQ,EAAE,SAAS,OAAO;AAC5B,CAAC;AAED,IAAa,WAAW,OAAO,OAAO;CACpC,iBAAiB;CACjB,UAAU;CACV,UAAU;CACV,cAAc;CACd,QAAQ;CACR,OAAO;CACP,iBAAiB;EACf,SAAS;GACP,YAAY;GACZ,SAAS;EACX;EACA,UAAU;CACZ;CAEA,YAAY;EACV,eAAe,GAAG;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,yBAAyB;EACzB,yBAAyB;EACzB,iBAAiB;EACjB,cAAc;EACd,QAAQ;EACR,SAAS;EACT,MAAM;EACN,UAAU;EACV,OAAO;EACP,KAAK;CACP;CAEA,UAAU,EACR,SAAS;EACP,QAAQ,EACN,cAAc,KAChB;EACA,QAAQ,EACN,cAAc,SAChB;EACA,OAAO;GACL,cAAc;GACd,SAAS;EACX;EACA,QAAQ;GACN,cAAc;GACd,SAAS;EACX;EACA,MAAM,EACJ,kBAAkB,EAChB,SAAS,aACX,EACF;CACF,EACF;CACA,iBAAiB,EACf,SAAS,OACX;AACF,CAAC"}
1
+ {"version":3,"file":"Skeleton.js","names":[],"sources":["../../../components/Skeleton/Skeleton.tsx"],"sourcesContent":["import { keyframes, styled, VariantProps } from '../../stitches.config';\n\nconst pulse = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: '100%' },\n});\n\nexport const Skeleton = styled('div', {\n backgroundColor: '$skeletonBackground',\n position: 'relative',\n overflow: 'hidden',\n borderRadius: '3px',\n height: 'auto',\n width: 'auto',\n '&:not(:empty)': {\n '& > *': {\n visibility: 'hidden',\n display: 'block',\n },\n maxWidth: 'fit-content',\n },\n\n '&::after': {\n animationName: `${pulse}`,\n animationDuration: '500ms',\n animationDirection: 'alternate',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'ease-in-out',\n backgroundColor: '$skeletonAnimation',\n borderRadius: 'inherit',\n bottom: 0,\n content: '\"\"',\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n\n '@motion': {\n '&::after': {\n animation: 'none',\n opacity: 0,\n },\n },\n\n variants: {\n variant: {\n square: {\n borderRadius: '$2',\n },\n circle: {\n borderRadius: '$round',\n },\n badge: {\n borderRadius: '$pill',\n display: 'inline-flex',\n },\n button: {\n borderRadius: '$3',\n display: 'inline-flex',\n },\n text: {\n '&:empty:before': {\n content: '\"\\\\00a0\"', // adds a space character before element\n },\n },\n },\n },\n defaultVariants: {\n variant: 'text',\n },\n});\n\nexport type SkeletonVariants = VariantProps<typeof Skeleton>;\nexport type SkeletonProps = SkeletonVariants & NonNullable<unknown>;\n"],"mappings":";;AAEA,IAAM,QAAQ,UAAU;CACtB,MAAM,EAAE,SAAS,EAAE;CACnB,QAAQ,EAAE,SAAS,OAAO;AAC5B,CAAC;AAED,IAAa,WAAW,OAAO,OAAO;CACpC,iBAAiB;CACjB,UAAU;CACV,UAAU;CACV,cAAc;CACd,QAAQ;CACR,OAAO;CACP,iBAAiB;EACf,SAAS;GACP,YAAY;GACZ,SAAS;EACX;EACA,UAAU;CACZ;CAEA,YAAY;EACV,eAAe,GAAG;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,yBAAyB;EACzB,yBAAyB;EACzB,iBAAiB;EACjB,cAAc;EACd,QAAQ;EACR,SAAS;EACT,MAAM;EACN,UAAU;EACV,OAAO;EACP,KAAK;CACP;CAEA,WAAW,EACT,YAAY;EACV,WAAW;EACX,SAAS;CACX,EACF;CAEA,UAAU,EACR,SAAS;EACP,QAAQ,EACN,cAAc,KAChB;EACA,QAAQ,EACN,cAAc,SAChB;EACA,OAAO;GACL,cAAc;GACd,SAAS;EACX;EACA,QAAQ;GACN,cAAc;GACd,SAAS;EACX;EACA,MAAM,EACJ,kBAAkB,EAChB,SAAS,aACX,EACF;CACF,EACF;CACA,iBAAiB,EACf,SAAS,OACX;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/Skeleton/Skeleton.vanilla.css.ts"],"sourcesContent":["import { globalStyle, keyframes, style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\n\nconst pulse = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: 1 },\n});\n\nconst skeletonBase = style({\n backgroundColor: tokens.colors.skeletonBackground,\n position: 'relative',\n overflow: 'hidden',\n borderRadius: '3px',\n height: 'auto',\n width: 'auto',\n\n selectors: {\n '&:not(:empty)': {\n maxWidth: 'fit-content',\n },\n },\n\n '::after': {\n animationName: pulse,\n animationDuration: '500ms',\n animationDirection: 'alternate',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'ease-in-out',\n backgroundColor: tokens.colors.skeletonAnimation,\n borderRadius: 'inherit',\n bottom: 0,\n content: '\"\"',\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n});\n\n// Global styles for child elements inside skeleton\nglobalStyle(`${skeletonBase}:not(:empty) > *`, {\n visibility: 'hidden',\n display: 'block',\n});\n\nexport const skeletonRecipe = recipe({\n base: skeletonBase,\n\n variants: {\n variant: {\n square: {\n borderRadius: tokens.radii['2'],\n },\n circle: {\n borderRadius: tokens.radii.round,\n },\n badge: {\n borderRadius: tokens.radii.pill,\n display: 'inline-flex',\n },\n button: {\n borderRadius: tokens.radii['3'],\n display: 'inline-flex',\n },\n text: {\n selectors: {\n '&:empty::before': {\n content: '\"\\\\00a0\"',\n },\n },\n },\n },\n },\n\n defaultVariants: {\n variant: 'text',\n },\n});\n"],"mappings":""}
1
+ {"version":3,"file":"Skeleton.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/Skeleton/Skeleton.vanilla.css.ts"],"sourcesContent":["import { globalStyle, keyframes, style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { breakpoints } from '../../styles/breakpoints.css';\nimport { tokens } from '../../styles/tokens.css';\n\nconst pulse = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: 1 },\n});\n\nconst skeletonBase = style({\n backgroundColor: tokens.colors.skeletonBackground,\n position: 'relative',\n overflow: 'hidden',\n borderRadius: '3px',\n height: 'auto',\n width: 'auto',\n\n selectors: {\n '&:not(:empty)': {\n maxWidth: 'fit-content',\n },\n },\n\n '::after': {\n animationName: pulse,\n animationDuration: '500ms',\n animationDirection: 'alternate',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'ease-in-out',\n backgroundColor: tokens.colors.skeletonAnimation,\n borderRadius: 'inherit',\n bottom: 0,\n content: '\"\"',\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n});\n\nglobalStyle(`${skeletonBase}::after`, {\n '@media': {\n [breakpoints.motion]: {\n animation: 'none',\n opacity: 0,\n },\n },\n});\n\n// Global styles for child elements inside skeleton\nglobalStyle(`${skeletonBase}:not(:empty) > *`, {\n visibility: 'hidden',\n display: 'block',\n});\n\nexport const skeletonRecipe = recipe({\n base: skeletonBase,\n\n variants: {\n variant: {\n square: {\n borderRadius: tokens.radii['2'],\n },\n circle: {\n borderRadius: tokens.radii.round,\n },\n badge: {\n borderRadius: tokens.radii.pill,\n display: 'inline-flex',\n },\n button: {\n borderRadius: tokens.radii['3'],\n display: 'inline-flex',\n },\n text: {\n selectors: {\n '&:empty::before': {\n content: '\"\\\\00a0\"',\n },\n },\n },\n },\n },\n\n defaultVariants: {\n variant: 'text',\n },\n});\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.vanilla.css.js","names":["_7a468"],"sources":["../../../components/Skeleton/Skeleton.vanilla.css.ts"],"sourcesContent":["import { globalStyle, keyframes, style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { tokens } from '../../styles/tokens.css';\n\nconst pulse = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: 1 },\n});\n\nconst skeletonBase = style({\n backgroundColor: tokens.colors.skeletonBackground,\n position: 'relative',\n overflow: 'hidden',\n borderRadius: '3px',\n height: 'auto',\n width: 'auto',\n\n selectors: {\n '&:not(:empty)': {\n maxWidth: 'fit-content',\n },\n },\n\n '::after': {\n animationName: pulse,\n animationDuration: '500ms',\n animationDirection: 'alternate',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'ease-in-out',\n backgroundColor: tokens.colors.skeletonAnimation,\n borderRadius: 'inherit',\n bottom: 0,\n content: '\"\"',\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n});\n\n// Global styles for child elements inside skeleton\nglobalStyle(`${skeletonBase}:not(:empty) > *`, {\n visibility: 'hidden',\n display: 'block',\n});\n\nexport const skeletonRecipe = recipe({\n base: skeletonBase,\n\n variants: {\n variant: {\n square: {\n borderRadius: tokens.radii['2'],\n },\n circle: {\n borderRadius: tokens.radii.round,\n },\n badge: {\n borderRadius: tokens.radii.pill,\n display: 'inline-flex',\n },\n button: {\n borderRadius: tokens.radii['3'],\n display: 'inline-flex',\n },\n text: {\n selectors: {\n '&:empty::before': {\n content: '\"\\\\00a0\"',\n },\n },\n },\n },\n },\n\n defaultVariants: {\n variant: 'text',\n },\n});\n"],"mappings":""}
1
+ {"version":3,"file":"Skeleton.vanilla.css.js","names":["_7a468"],"sources":["../../../components/Skeleton/Skeleton.vanilla.css.ts"],"sourcesContent":["import { globalStyle, keyframes, style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { breakpoints } from '../../styles/breakpoints.css';\nimport { tokens } from '../../styles/tokens.css';\n\nconst pulse = keyframes({\n '0%': { opacity: 0 },\n '100%': { opacity: 1 },\n});\n\nconst skeletonBase = style({\n backgroundColor: tokens.colors.skeletonBackground,\n position: 'relative',\n overflow: 'hidden',\n borderRadius: '3px',\n height: 'auto',\n width: 'auto',\n\n selectors: {\n '&:not(:empty)': {\n maxWidth: 'fit-content',\n },\n },\n\n '::after': {\n animationName: pulse,\n animationDuration: '500ms',\n animationDirection: 'alternate',\n animationIterationCount: 'infinite',\n animationTimingFunction: 'ease-in-out',\n backgroundColor: tokens.colors.skeletonAnimation,\n borderRadius: 'inherit',\n bottom: 0,\n content: '\"\"',\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n});\n\nglobalStyle(`${skeletonBase}::after`, {\n '@media': {\n [breakpoints.motion]: {\n animation: 'none',\n opacity: 0,\n },\n },\n});\n\n// Global styles for child elements inside skeleton\nglobalStyle(`${skeletonBase}:not(:empty) > *`, {\n visibility: 'hidden',\n display: 'block',\n});\n\nexport const skeletonRecipe = recipe({\n base: skeletonBase,\n\n variants: {\n variant: {\n square: {\n borderRadius: tokens.radii['2'],\n },\n circle: {\n borderRadius: tokens.radii.round,\n },\n badge: {\n borderRadius: tokens.radii.pill,\n display: 'inline-flex',\n },\n button: {\n borderRadius: tokens.radii['3'],\n display: 'inline-flex',\n },\n text: {\n selectors: {\n '&:empty::before': {\n content: '\"\\\\00a0\"',\n },\n },\n },\n },\n },\n\n defaultVariants: {\n variant: 'text',\n },\n});\n"],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
3
  const require_Elevation = require("../Elevation/Elevation.cjs");
4
+ const require_FieldContext = require("../Field/FieldContext.cjs");
4
5
  let react = require("react");
5
6
  react = require_runtime.__toESM(react, 1);
6
7
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -54,6 +55,7 @@ var StyledSwitch = require_stitches_config.styled(_radix_ui_react_switch.Root, {
54
55
  opacity: .38
55
56
  },
56
57
  "&[data-state=\"checked\"]": { backgroundColor: "$switchActiveBackground" },
58
+ "&[aria-invalid=\"true\"]:not(:focus)": { boxShadow: "inset 0 0 0 1px $colors$switchInvalidBorder" },
57
59
  variants: { size: {
58
60
  "1": {
59
61
  width: ROOT_WIDTH,
@@ -73,11 +75,23 @@ var StyledSwitch = require_stitches_config.styled(_radix_ui_react_switch.Root, {
73
75
  } },
74
76
  defaultVariants: { size: "1" }
75
77
  });
76
- var Switch = react.default.forwardRef((props, forwardedRef) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSwitch, {
77
- ...props,
78
- ref: forwardedRef,
79
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledThumb, {})
80
- }));
78
+ var Switch = react.default.forwardRef(({ id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
79
+ const control = require_FieldContext.useFieldControl({
80
+ id,
81
+ disabled,
82
+ "aria-describedby": ariaDescribedBy,
83
+ "aria-invalid": ariaInvalid
84
+ });
85
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSwitch, {
86
+ ...props,
87
+ id: control.id,
88
+ disabled: control.disabled,
89
+ "aria-describedby": control["aria-describedby"],
90
+ "aria-invalid": control["aria-invalid"],
91
+ ref: forwardedRef,
92
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledThumb, {})
93
+ });
94
+ });
81
95
  exports.Switch = Switch;
82
96
 
83
97
  //# sourceMappingURL=Switch.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.cjs","names":["styled","SwitchPrimitive","elevationVariants","React"],"sources":["../../../components/Switch/Switch.tsx"],"sourcesContent":["import * as SwitchPrimitive from '@radix-ui/react-switch';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\n\n// CONSTANTS\nconst THUMB_DIAMETER = 14; // @FIXME: shouldn't this size be part of theme ?\nconst LARGE_RATIO = 1.5;\nconst THUMB_GAP = 2; // Gap between thumb and background\nconst ROOT_WIDTH = 32;\nconst ROOT_HEIGHT = 18;\n\n// COMPONENTS\nconst StyledThumb = styled(SwitchPrimitive.Thumb, {\n position: 'absolute',\n left: 0,\n width: THUMB_DIAMETER,\n height: THUMB_DIAMETER,\n backgroundColor: '$switchThumb',\n borderRadius: '$round',\n boxShadow: 'rgba(0, 0, 0, 0.3) 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 1px 2px;',\n transition: 'transform 100ms cubic-bezier(0.22, 1, 0.36, 1)',\n transform: `translateX(${THUMB_GAP}px)`,\n willChange: 'transform',\n\n '&[data-state=\"checked\"]': {\n transform: `translateX(${ROOT_WIDTH - THUMB_GAP - THUMB_DIAMETER}px)`,\n },\n});\n\nconst StyledSwitch = styled(SwitchPrimitive.Root, {\n all: 'unset',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n\n // Reset\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n backgroundColor: '$switchBackground',\n borderRadius: '$pill',\n position: 'relative',\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n [`& ${StyledThumb}`]: {\n ...elevationVariants[1],\n },\n },\n },\n '&:focus': {\n outline: '2px solid $switchFocusBorder',\n [`& ${StyledThumb}`]: {\n ...elevationVariants[2],\n },\n },\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.38,\n },\n '&[data-state=\"checked\"]': {\n backgroundColor: '$switchActiveBackground',\n },\n\n variants: {\n size: {\n '1': {\n width: ROOT_WIDTH,\n height: ROOT_HEIGHT,\n m: '$2',\n },\n '2': {\n width: ROOT_WIDTH * LARGE_RATIO,\n height: ROOT_HEIGHT * LARGE_RATIO,\n [`& ${StyledThumb}`]: {\n width: THUMB_DIAMETER * LARGE_RATIO,\n height: THUMB_DIAMETER * LARGE_RATIO,\n transform: `translateX(${LARGE_RATIO * THUMB_GAP})`,\n\n '&[data-state=\"checked\"]': {\n transform: `translateX(${LARGE_RATIO * (ROOT_WIDTH - THUMB_GAP - THUMB_DIAMETER)}px)`,\n },\n },\n },\n },\n },\n defaultVariants: {\n size: '1',\n },\n});\n\nexport type SwitchVariants = VariantProps<typeof StyledSwitch>;\ntype SwitchPrimitiveProps = Omit<React.ComponentProps<typeof SwitchPrimitive.Root>, 'as'>;\nexport type SwitchProps = SwitchPrimitiveProps & SwitchVariants & { css?: CSS };\n\nexport const Switch = React.forwardRef<React.ElementRef<typeof StyledSwitch>, SwitchProps>(\n (props, forwardedRef) => (\n <StyledSwitch {...props} ref={forwardedRef}>\n <StyledThumb />\n </StyledSwitch>\n )\n);\n"],"mappings":";;;;;;;;;AAOA,IAAM,iBAAiB;AACvB,IAAM,cAAc;AACpB,IAAM,YAAY;AAClB,IAAM,aAAa;AACnB,IAAM,cAAc;AAGpB,IAAM,cAAcA,wBAAAA,OAAOC,uBAAgB,OAAO;CAChD,UAAU;CACV,MAAM;CACN,OAAO;CACP,QAAQ;CACR,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,YAAY;CACZ,WAAW,cAAc,UAAU;CACnC,YAAY;CAEZ,6BAA2B,EACzB,WAAW,mBACb;AACF,CAAC;AAED,IAAM,eAAeD,wBAAAA,OAAOC,uBAAgB,MAAM;CAChD,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAGA,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,yBAAyB;CAEzB,iBAAiB;CACjB,cAAc;CACd,UAAU;CACV,UAAU,EACR,WAAW;EACT,QAAQ;GACP,KAAK,gBAAgB,EACpB,GAAGC,kBAAAA,kBAAkB,GACvB;CACF,EACF;CACA,WAAW;EACT,SAAS;GACR,KAAK,gBAAgB,EACpB,GAAGA,kBAAAA,kBAAkB,GACvB;CACF;CACA,cAAc;EACZ,eAAe;EACf,SAAS;CACX;CACA,6BAA2B,EACzB,iBAAiB,0BACnB;CAEA,UAAU,EACR,MAAM;EACJ,KAAK;GACH,OAAO;GACP,QAAQ;GACR,GAAG;EACL;EACA,KAAK;GACH,OAAO,aAAa;GACpB,QAAQ,cAAc;IACrB,KAAK,gBAAgB;IACpB,OAAO,iBAAiB;IACxB,QAAQ,iBAAiB;IACzB,WAAW,cAAc,cAAc,UAAU;IAEjD,6BAA2B,EACzB,WAAW,cAAc,cAAe,GAAyC,KACnF;GACF;EACF;CACF,EACF;CACA,iBAAiB,EACf,MAAM,IACR;AACF,CAAC;AAMD,IAAa,SAASC,MAAAA,QAAM,YACzB,OAAO,iBACN,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;CAAc,GAAI;CAAO,KAAK;CAC5B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD,CAAc,CAAA;AACF,CAAA,CAElB"}
1
+ {"version":3,"file":"Switch.cjs","names":["styled","SwitchPrimitive","elevationVariants","React","useFieldControl"],"sources":["../../../components/Switch/Switch.tsx"],"sourcesContent":["import * as SwitchPrimitive from '@radix-ui/react-switch';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\nimport { useFieldControl } from '../Field/FieldContext';\n\n// CONSTANTS\nconst THUMB_DIAMETER = 14; // @FIXME: shouldn't this size be part of theme ?\nconst LARGE_RATIO = 1.5;\nconst THUMB_GAP = 2; // Gap between thumb and background\nconst ROOT_WIDTH = 32;\nconst ROOT_HEIGHT = 18;\n\n// COMPONENTS\nconst StyledThumb = styled(SwitchPrimitive.Thumb, {\n position: 'absolute',\n left: 0,\n width: THUMB_DIAMETER,\n height: THUMB_DIAMETER,\n backgroundColor: '$switchThumb',\n borderRadius: '$round',\n boxShadow: 'rgba(0, 0, 0, 0.3) 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 1px 2px;',\n transition: 'transform 100ms cubic-bezier(0.22, 1, 0.36, 1)',\n transform: `translateX(${THUMB_GAP}px)`,\n willChange: 'transform',\n\n '&[data-state=\"checked\"]': {\n transform: `translateX(${ROOT_WIDTH - THUMB_GAP - THUMB_DIAMETER}px)`,\n },\n});\n\nconst StyledSwitch = styled(SwitchPrimitive.Root, {\n all: 'unset',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n\n // Reset\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n backgroundColor: '$switchBackground',\n borderRadius: '$pill',\n position: 'relative',\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n [`& ${StyledThumb}`]: {\n ...elevationVariants[1],\n },\n },\n },\n '&:focus': {\n outline: '2px solid $switchFocusBorder',\n [`& ${StyledThumb}`]: {\n ...elevationVariants[2],\n },\n },\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.38,\n },\n '&[data-state=\"checked\"]': {\n backgroundColor: '$switchActiveBackground',\n },\n\n '&[aria-invalid=\"true\"]:not(:focus)': {\n boxShadow: 'inset 0 0 0 1px $colors$switchInvalidBorder',\n },\n\n variants: {\n size: {\n '1': {\n width: ROOT_WIDTH,\n height: ROOT_HEIGHT,\n m: '$2',\n },\n '2': {\n width: ROOT_WIDTH * LARGE_RATIO,\n height: ROOT_HEIGHT * LARGE_RATIO,\n [`& ${StyledThumb}`]: {\n width: THUMB_DIAMETER * LARGE_RATIO,\n height: THUMB_DIAMETER * LARGE_RATIO,\n transform: `translateX(${LARGE_RATIO * THUMB_GAP})`,\n\n '&[data-state=\"checked\"]': {\n transform: `translateX(${LARGE_RATIO * (ROOT_WIDTH - THUMB_GAP - THUMB_DIAMETER)}px)`,\n },\n },\n },\n },\n },\n defaultVariants: {\n size: '1',\n },\n});\n\nexport type SwitchVariants = VariantProps<typeof StyledSwitch>;\ntype SwitchPrimitiveProps = Omit<React.ComponentProps<typeof SwitchPrimitive.Root>, 'as'>;\nexport type SwitchProps = SwitchPrimitiveProps & SwitchVariants & { css?: CSS };\n\nexport const Switch = React.forwardRef<React.ElementRef<typeof StyledSwitch>, SwitchProps>(\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 <StyledSwitch\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 <StyledThumb />\n </StyledSwitch>\n );\n },\n);\n"],"mappings":";;;;;;;;;;AAQA,IAAM,iBAAiB;AACvB,IAAM,cAAc;AACpB,IAAM,YAAY;AAClB,IAAM,aAAa;AACnB,IAAM,cAAc;AAGpB,IAAM,cAAcA,wBAAAA,OAAOC,uBAAgB,OAAO;CAChD,UAAU;CACV,MAAM;CACN,OAAO;CACP,QAAQ;CACR,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,YAAY;CACZ,WAAW,cAAc,UAAU;CACnC,YAAY;CAEZ,6BAA2B,EACzB,WAAW,mBACb;AACF,CAAC;AAED,IAAM,eAAeD,wBAAAA,OAAOC,uBAAgB,MAAM;CAChD,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAGA,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,yBAAyB;CAEzB,iBAAiB;CACjB,cAAc;CACd,UAAU;CACV,UAAU,EACR,WAAW;EACT,QAAQ;GACP,KAAK,gBAAgB,EACpB,GAAGC,kBAAAA,kBAAkB,GACvB;CACF,EACF;CACA,WAAW;EACT,SAAS;GACR,KAAK,gBAAgB,EACpB,GAAGA,kBAAAA,kBAAkB,GACvB;CACF;CACA,cAAc;EACZ,eAAe;EACf,SAAS;CACX;CACA,6BAA2B,EACzB,iBAAiB,0BACnB;CAEA,wCAAsC,EACpC,WAAW,8CACb;CAEA,UAAU,EACR,MAAM;EACJ,KAAK;GACH,OAAO;GACP,QAAQ;GACR,GAAG;EACL;EACA,KAAK;GACH,OAAO,aAAa;GACpB,QAAQ,cAAc;IACrB,KAAK,gBAAgB;IACpB,OAAO,iBAAiB;IACxB,QAAQ,iBAAiB;IACzB,WAAW,cAAc,cAAc,UAAU;IAEjD,6BAA2B,EACzB,WAAW,cAAc,cAAe,GAAyC,KACnF;GACF;EACF;CACF,EACF;CACA,iBAAiB,EACf,MAAM,IACR;AACF,CAAC;AAMD,IAAa,SAASC,MAAAA,QAAM,YAExB,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,cAAD;EACE,GAAI;EACJ,IAAI,QAAQ;EACZ,UAAU,QAAQ;EAClB,oBAAkB,QAAQ;EAC1B,gBAAc,QAAQ;EACtB,KAAK;EAEL,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD,CAAc,CAAA;CACF,CAAA;AAElB,CACF"}
@@ -1,5 +1,6 @@
1
1
  import { styled } from "../../stitches.config.js";
2
2
  import { elevationVariants } from "../Elevation/Elevation.js";
3
+ import { useFieldControl } from "../Field/FieldContext.js";
3
4
  import React from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import * as SwitchPrimitive from "@radix-ui/react-switch";
@@ -51,6 +52,7 @@ var StyledSwitch = styled(SwitchPrimitive.Root, {
51
52
  opacity: .38
52
53
  },
53
54
  "&[data-state=\"checked\"]": { backgroundColor: "$switchActiveBackground" },
55
+ "&[aria-invalid=\"true\"]:not(:focus)": { boxShadow: "inset 0 0 0 1px $colors$switchInvalidBorder" },
54
56
  variants: { size: {
55
57
  "1": {
56
58
  width: ROOT_WIDTH,
@@ -70,11 +72,23 @@ var StyledSwitch = styled(SwitchPrimitive.Root, {
70
72
  } },
71
73
  defaultVariants: { size: "1" }
72
74
  });
73
- var Switch = React.forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(StyledSwitch, {
74
- ...props,
75
- ref: forwardedRef,
76
- children: /* @__PURE__ */ jsx(StyledThumb, {})
77
- }));
75
+ var Switch = React.forwardRef(({ id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
76
+ const control = useFieldControl({
77
+ id,
78
+ disabled,
79
+ "aria-describedby": ariaDescribedBy,
80
+ "aria-invalid": ariaInvalid
81
+ });
82
+ return /* @__PURE__ */ jsx(StyledSwitch, {
83
+ ...props,
84
+ id: control.id,
85
+ disabled: control.disabled,
86
+ "aria-describedby": control["aria-describedby"],
87
+ "aria-invalid": control["aria-invalid"],
88
+ ref: forwardedRef,
89
+ children: /* @__PURE__ */ jsx(StyledThumb, {})
90
+ });
91
+ });
78
92
  export { Switch };
79
93
 
80
94
  //# sourceMappingURL=Switch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","names":[],"sources":["../../../components/Switch/Switch.tsx"],"sourcesContent":["import * as SwitchPrimitive from '@radix-ui/react-switch';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\n\n// CONSTANTS\nconst THUMB_DIAMETER = 14; // @FIXME: shouldn't this size be part of theme ?\nconst LARGE_RATIO = 1.5;\nconst THUMB_GAP = 2; // Gap between thumb and background\nconst ROOT_WIDTH = 32;\nconst ROOT_HEIGHT = 18;\n\n// COMPONENTS\nconst StyledThumb = styled(SwitchPrimitive.Thumb, {\n position: 'absolute',\n left: 0,\n width: THUMB_DIAMETER,\n height: THUMB_DIAMETER,\n backgroundColor: '$switchThumb',\n borderRadius: '$round',\n boxShadow: 'rgba(0, 0, 0, 0.3) 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 1px 2px;',\n transition: 'transform 100ms cubic-bezier(0.22, 1, 0.36, 1)',\n transform: `translateX(${THUMB_GAP}px)`,\n willChange: 'transform',\n\n '&[data-state=\"checked\"]': {\n transform: `translateX(${ROOT_WIDTH - THUMB_GAP - THUMB_DIAMETER}px)`,\n },\n});\n\nconst StyledSwitch = styled(SwitchPrimitive.Root, {\n all: 'unset',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n\n // Reset\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n backgroundColor: '$switchBackground',\n borderRadius: '$pill',\n position: 'relative',\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n [`& ${StyledThumb}`]: {\n ...elevationVariants[1],\n },\n },\n },\n '&:focus': {\n outline: '2px solid $switchFocusBorder',\n [`& ${StyledThumb}`]: {\n ...elevationVariants[2],\n },\n },\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.38,\n },\n '&[data-state=\"checked\"]': {\n backgroundColor: '$switchActiveBackground',\n },\n\n variants: {\n size: {\n '1': {\n width: ROOT_WIDTH,\n height: ROOT_HEIGHT,\n m: '$2',\n },\n '2': {\n width: ROOT_WIDTH * LARGE_RATIO,\n height: ROOT_HEIGHT * LARGE_RATIO,\n [`& ${StyledThumb}`]: {\n width: THUMB_DIAMETER * LARGE_RATIO,\n height: THUMB_DIAMETER * LARGE_RATIO,\n transform: `translateX(${LARGE_RATIO * THUMB_GAP})`,\n\n '&[data-state=\"checked\"]': {\n transform: `translateX(${LARGE_RATIO * (ROOT_WIDTH - THUMB_GAP - THUMB_DIAMETER)}px)`,\n },\n },\n },\n },\n },\n defaultVariants: {\n size: '1',\n },\n});\n\nexport type SwitchVariants = VariantProps<typeof StyledSwitch>;\ntype SwitchPrimitiveProps = Omit<React.ComponentProps<typeof SwitchPrimitive.Root>, 'as'>;\nexport type SwitchProps = SwitchPrimitiveProps & SwitchVariants & { css?: CSS };\n\nexport const Switch = React.forwardRef<React.ElementRef<typeof StyledSwitch>, SwitchProps>(\n (props, forwardedRef) => (\n <StyledSwitch {...props} ref={forwardedRef}>\n <StyledThumb />\n </StyledSwitch>\n )\n);\n"],"mappings":";;;;;;AAOA,IAAM,iBAAiB;AACvB,IAAM,cAAc;AACpB,IAAM,YAAY;AAClB,IAAM,aAAa;AACnB,IAAM,cAAc;AAGpB,IAAM,cAAc,OAAO,gBAAgB,OAAO;CAChD,UAAU;CACV,MAAM;CACN,OAAO;CACP,QAAQ;CACR,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,YAAY;CACZ,WAAW,cAAc,UAAU;CACnC,YAAY;CAEZ,6BAA2B,EACzB,WAAW,mBACb;AACF,CAAC;AAED,IAAM,eAAe,OAAO,gBAAgB,MAAM;CAChD,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAGA,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,yBAAyB;CAEzB,iBAAiB;CACjB,cAAc;CACd,UAAU;CACV,UAAU,EACR,WAAW;EACT,QAAQ;GACP,KAAK,gBAAgB,EACpB,GAAG,kBAAkB,GACvB;CACF,EACF;CACA,WAAW;EACT,SAAS;GACR,KAAK,gBAAgB,EACpB,GAAG,kBAAkB,GACvB;CACF;CACA,cAAc;EACZ,eAAe;EACf,SAAS;CACX;CACA,6BAA2B,EACzB,iBAAiB,0BACnB;CAEA,UAAU,EACR,MAAM;EACJ,KAAK;GACH,OAAO;GACP,QAAQ;GACR,GAAG;EACL;EACA,KAAK;GACH,OAAO,aAAa;GACpB,QAAQ,cAAc;IACrB,KAAK,gBAAgB;IACpB,OAAO,iBAAiB;IACxB,QAAQ,iBAAiB;IACzB,WAAW,cAAc,cAAc,UAAU;IAEjD,6BAA2B,EACzB,WAAW,cAAc,cAAe,GAAyC,KACnF;GACF;EACF;CACF,EACF;CACA,iBAAiB,EACf,MAAM,IACR;AACF,CAAC;AAMD,IAAa,SAAS,MAAM,YACzB,OAAO,iBACN,oBAAC,cAAD;CAAc,GAAI;CAAO,KAAK;CAC5B,UAAA,oBAAC,aAAD,CAAc,CAAA;AACF,CAAA,CAElB"}
1
+ {"version":3,"file":"Switch.js","names":[],"sources":["../../../components/Switch/Switch.tsx"],"sourcesContent":["import * as SwitchPrimitive from '@radix-ui/react-switch';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\nimport { useFieldControl } from '../Field/FieldContext';\n\n// CONSTANTS\nconst THUMB_DIAMETER = 14; // @FIXME: shouldn't this size be part of theme ?\nconst LARGE_RATIO = 1.5;\nconst THUMB_GAP = 2; // Gap between thumb and background\nconst ROOT_WIDTH = 32;\nconst ROOT_HEIGHT = 18;\n\n// COMPONENTS\nconst StyledThumb = styled(SwitchPrimitive.Thumb, {\n position: 'absolute',\n left: 0,\n width: THUMB_DIAMETER,\n height: THUMB_DIAMETER,\n backgroundColor: '$switchThumb',\n borderRadius: '$round',\n boxShadow: 'rgba(0, 0, 0, 0.3) 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 1px 2px;',\n transition: 'transform 100ms cubic-bezier(0.22, 1, 0.36, 1)',\n transform: `translateX(${THUMB_GAP}px)`,\n willChange: 'transform',\n\n '&[data-state=\"checked\"]': {\n transform: `translateX(${ROOT_WIDTH - THUMB_GAP - THUMB_DIAMETER}px)`,\n },\n});\n\nconst StyledSwitch = styled(SwitchPrimitive.Root, {\n all: 'unset',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n\n // Reset\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n backgroundColor: '$switchBackground',\n borderRadius: '$pill',\n position: 'relative',\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n [`& ${StyledThumb}`]: {\n ...elevationVariants[1],\n },\n },\n },\n '&:focus': {\n outline: '2px solid $switchFocusBorder',\n [`& ${StyledThumb}`]: {\n ...elevationVariants[2],\n },\n },\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.38,\n },\n '&[data-state=\"checked\"]': {\n backgroundColor: '$switchActiveBackground',\n },\n\n '&[aria-invalid=\"true\"]:not(:focus)': {\n boxShadow: 'inset 0 0 0 1px $colors$switchInvalidBorder',\n },\n\n variants: {\n size: {\n '1': {\n width: ROOT_WIDTH,\n height: ROOT_HEIGHT,\n m: '$2',\n },\n '2': {\n width: ROOT_WIDTH * LARGE_RATIO,\n height: ROOT_HEIGHT * LARGE_RATIO,\n [`& ${StyledThumb}`]: {\n width: THUMB_DIAMETER * LARGE_RATIO,\n height: THUMB_DIAMETER * LARGE_RATIO,\n transform: `translateX(${LARGE_RATIO * THUMB_GAP})`,\n\n '&[data-state=\"checked\"]': {\n transform: `translateX(${LARGE_RATIO * (ROOT_WIDTH - THUMB_GAP - THUMB_DIAMETER)}px)`,\n },\n },\n },\n },\n },\n defaultVariants: {\n size: '1',\n },\n});\n\nexport type SwitchVariants = VariantProps<typeof StyledSwitch>;\ntype SwitchPrimitiveProps = Omit<React.ComponentProps<typeof SwitchPrimitive.Root>, 'as'>;\nexport type SwitchProps = SwitchPrimitiveProps & SwitchVariants & { css?: CSS };\n\nexport const Switch = React.forwardRef<React.ElementRef<typeof StyledSwitch>, SwitchProps>(\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 <StyledSwitch\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 <StyledThumb />\n </StyledSwitch>\n );\n },\n);\n"],"mappings":";;;;;;;AAQA,IAAM,iBAAiB;AACvB,IAAM,cAAc;AACpB,IAAM,YAAY;AAClB,IAAM,aAAa;AACnB,IAAM,cAAc;AAGpB,IAAM,cAAc,OAAO,gBAAgB,OAAO;CAChD,UAAU;CACV,MAAM;CACN,OAAO;CACP,QAAQ;CACR,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,YAAY;CACZ,WAAW,cAAc,UAAU;CACnC,YAAY;CAEZ,6BAA2B,EACzB,WAAW,mBACb;AACF,CAAC;AAED,IAAM,eAAe,OAAO,gBAAgB,MAAM;CAChD,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAGA,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,yBAAyB;CAEzB,iBAAiB;CACjB,cAAc;CACd,UAAU;CACV,UAAU,EACR,WAAW;EACT,QAAQ;GACP,KAAK,gBAAgB,EACpB,GAAG,kBAAkB,GACvB;CACF,EACF;CACA,WAAW;EACT,SAAS;GACR,KAAK,gBAAgB,EACpB,GAAG,kBAAkB,GACvB;CACF;CACA,cAAc;EACZ,eAAe;EACf,SAAS;CACX;CACA,6BAA2B,EACzB,iBAAiB,0BACnB;CAEA,wCAAsC,EACpC,WAAW,8CACb;CAEA,UAAU,EACR,MAAM;EACJ,KAAK;GACH,OAAO;GACP,QAAQ;GACR,GAAG;EACL;EACA,KAAK;GACH,OAAO,aAAa;GACpB,QAAQ,cAAc;IACrB,KAAK,gBAAgB;IACpB,OAAO,iBAAiB;IACxB,QAAQ,iBAAiB;IACzB,WAAW,cAAc,cAAc,UAAU;IA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