@traefik-labs/faency 13.1.0 → 13.2.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 (123) hide show
  1. package/dist/components/Badge/Badge.cjs +1 -5
  2. package/dist/components/Badge/Badge.cjs.map +1 -1
  3. package/dist/components/Badge/Badge.js +2 -6
  4. package/dist/components/Badge/Badge.js.map +1 -1
  5. package/dist/components/Button/Button.cjs +1 -2
  6. package/dist/components/Button/Button.cjs.map +1 -1
  7. package/dist/components/Button/Button.js +2 -3
  8. package/dist/components/Button/Button.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/CodeBlock/CodeBlock.cjs +2 -1
  18. package/dist/components/CodeBlock/CodeBlock.cjs.map +1 -1
  19. package/dist/components/CodeBlock/CodeBlock.js +3 -2
  20. package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
  21. package/dist/components/CodeBlock/CodeBlock.vanilla.cjs +2 -1
  22. package/dist/components/CodeBlock/CodeBlock.vanilla.cjs.map +1 -1
  23. package/dist/components/CodeBlock/CodeBlock.vanilla.js +3 -2
  24. package/dist/components/CodeBlock/CodeBlock.vanilla.js.map +1 -1
  25. package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs +1 -1
  26. package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs.map +1 -1
  27. package/dist/components/DateTimePickerInput/DateTimePickerInput.js +1 -1
  28. package/dist/components/DateTimePickerInput/DateTimePickerInput.js.map +1 -1
  29. package/dist/components/Field/Field.cjs +91 -0
  30. package/dist/components/Field/Field.cjs.map +1 -0
  31. package/dist/components/Field/Field.js +89 -0
  32. package/dist/components/Field/Field.js.map +1 -0
  33. package/dist/components/Field/Field.vanilla.cjs +95 -0
  34. package/dist/components/Field/Field.vanilla.cjs.map +1 -0
  35. package/dist/components/Field/Field.vanilla.css.cjs +6 -0
  36. package/dist/components/Field/Field.vanilla.css.cjs.map +1 -0
  37. package/dist/components/Field/Field.vanilla.css.js +6 -0
  38. package/dist/components/Field/Field.vanilla.css.js.map +1 -0
  39. package/dist/components/Field/Field.vanilla.js +93 -0
  40. package/dist/components/Field/Field.vanilla.js.map +1 -0
  41. package/dist/components/Field/FieldContext.cjs +136 -0
  42. package/dist/components/Field/FieldContext.cjs.map +1 -0
  43. package/dist/components/Field/FieldContext.js +130 -0
  44. package/dist/components/Field/FieldContext.js.map +1 -0
  45. package/dist/components/Input/Input.cjs +31 -6
  46. package/dist/components/Input/Input.cjs.map +1 -1
  47. package/dist/components/Input/Input.js +31 -6
  48. package/dist/components/Input/Input.js.map +1 -1
  49. package/dist/components/Input/Input.vanilla.cjs +17 -4
  50. package/dist/components/Input/Input.vanilla.cjs.map +1 -1
  51. package/dist/components/Input/Input.vanilla.css.cjs.map +1 -1
  52. package/dist/components/Input/Input.vanilla.css.js.map +1 -1
  53. package/dist/components/Input/Input.vanilla.js +17 -4
  54. package/dist/components/Input/Input.vanilla.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/Select/Select.cjs +33 -4
  64. package/dist/components/Select/Select.cjs.map +1 -1
  65. package/dist/components/Select/Select.js +33 -4
  66. package/dist/components/Select/Select.js.map +1 -1
  67. package/dist/components/Switch/Switch.cjs +19 -5
  68. package/dist/components/Switch/Switch.cjs.map +1 -1
  69. package/dist/components/Switch/Switch.js +19 -5
  70. package/dist/components/Switch/Switch.js.map +1 -1
  71. package/dist/components/Switch/Switch.themes.cjs +4 -2
  72. package/dist/components/Switch/Switch.themes.cjs.map +1 -1
  73. package/dist/components/Switch/Switch.themes.js +4 -2
  74. package/dist/components/Switch/Switch.themes.js.map +1 -1
  75. package/dist/components/Text/Text.themes.cjs +2 -2
  76. package/dist/components/Text/Text.themes.cjs.map +1 -1
  77. package/dist/components/Text/Text.themes.js +2 -2
  78. package/dist/components/Text/Text.themes.js.map +1 -1
  79. package/dist/components/Text/Text.vanilla.cjs +36 -0
  80. package/dist/components/Text/Text.vanilla.cjs.map +1 -0
  81. package/dist/components/Text/Text.vanilla.css.cjs +55 -0
  82. package/dist/components/Text/Text.vanilla.css.cjs.map +1 -0
  83. package/dist/components/Text/Text.vanilla.css.js +56 -0
  84. package/dist/components/Text/Text.vanilla.css.js.map +1 -0
  85. package/dist/components/Text/Text.vanilla.js +36 -0
  86. package/dist/components/Text/Text.vanilla.js.map +1 -0
  87. package/dist/components/TextField/TextField.cjs +74 -78
  88. package/dist/components/TextField/TextField.cjs.map +1 -1
  89. package/dist/components/TextField/TextField.js +74 -78
  90. package/dist/components/TextField/TextField.js.map +1 -1
  91. package/dist/components/TextField/TextField.vanilla.cjs +70 -86
  92. package/dist/components/TextField/TextField.vanilla.cjs.map +1 -1
  93. package/dist/components/TextField/TextField.vanilla.css.cjs +10 -0
  94. package/dist/components/TextField/TextField.vanilla.css.cjs.map +1 -0
  95. package/dist/components/TextField/TextField.vanilla.css.js +8 -0
  96. package/dist/components/TextField/TextField.vanilla.css.js.map +1 -0
  97. package/dist/components/TextField/TextField.vanilla.js +71 -87
  98. package/dist/components/TextField/TextField.vanilla.js.map +1 -1
  99. package/dist/components/Textarea/Textarea.cjs +51 -41
  100. package/dist/components/Textarea/Textarea.cjs.map +1 -1
  101. package/dist/components/Textarea/Textarea.js +51 -41
  102. package/dist/components/Textarea/Textarea.js.map +1 -1
  103. package/dist/components/Textarea/Textarea.vanilla.cjs +49 -49
  104. package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
  105. package/dist/components/Textarea/Textarea.vanilla.css.cjs.map +1 -1
  106. package/dist/components/Textarea/Textarea.vanilla.css.js.map +1 -1
  107. package/dist/components/Textarea/Textarea.vanilla.js +49 -49
  108. package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
  109. package/dist/faency.css +170 -14
  110. package/dist/index.cjs +7 -1
  111. package/dist/index.d.ts +375 -0
  112. package/dist/index.js +5 -2
  113. package/dist/styles/themeContext.cjs +2 -1
  114. package/dist/styles/themeContext.cjs.map +1 -1
  115. package/dist/styles/themeContext.js +3 -2
  116. package/dist/styles/themeContext.js.map +1 -1
  117. package/dist/styles/themes.css.cjs.map +1 -1
  118. package/dist/styles/themes.css.js.map +1 -1
  119. package/dist/utils/useIsomorphicLayoutEffect.cjs +6 -0
  120. package/dist/utils/useIsomorphicLayoutEffect.cjs.map +1 -0
  121. package/dist/utils/useIsomorphicLayoutEffect.js +6 -0
  122. package/dist/utils/useIsomorphicLayoutEffect.js.map +1 -0
  123. package/package.json +15 -15
@@ -97,11 +97,7 @@ var StyledButtonBadge = require_stitches_config.styled("button", BADGE_BASE_STYL
97
97
  });
98
98
  var StyledButtonBadgeSlot = require_stitches_config.styled(_radix_ui_react_slot.Slot, StyledButtonBadge);
99
99
  var Badge = react.default.forwardRef(({ interactive, asChild, ...props }, forwardedRef) => {
100
- const Component = (0, react.useMemo)(() => {
101
- if (interactive) return asChild ? StyledButtonBadgeSlot : StyledButtonBadge;
102
- return asChild ? StyledSpanBadgeSlot : StyledSpanBadge;
103
- }, [asChild]);
104
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
100
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(interactive ? asChild ? StyledButtonBadgeSlot : StyledButtonBadge : asChild ? StyledSpanBadgeSlot : StyledSpanBadge, {
105
101
  ...props,
106
102
  ref: forwardedRef
107
103
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.cjs","names":["COLORS","styled","Slot","React","useMemo"],"sources":["../../../components/Badge/Badge.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { ComponentProps, useMemo } from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { COLORS } from './Badge.vanilla';\n\ntype COLOR_VALUES = (typeof COLORS)[number];\n\nconst getColorBadgeStyles = (color: COLOR_VALUES) => ({\n bc: `$${color}6`,\n color: `$${color}10`,\n border: `1px solid $${color}10`,\n});\n\ntype ColorVariants = Record<COLOR_VALUES, { bc: string; color: string }>;\nconst colorVariants: ColorVariants = COLORS.reduce(\n (variants, color) => ({\n ...variants,\n [color]: getColorBadgeStyles(color),\n }),\n {} as ColorVariants,\n);\n\nconst interactiveColorVariants: ColorVariants = COLORS.reduce(\n (variants, color) => ({\n ...variants,\n [color]: {\n ...getColorBadgeStyles(color),\n },\n }),\n {} as ColorVariants,\n);\n\nconst alphaColorCompoundVariants = COLORS.map((color) => ({\n alphaBg: true,\n variant: color,\n css: { bc: `$${color}A6` },\n}));\n\nconst BADGE_BASE_STYLES = {\n // Reset\n alignItems: 'center',\n appearance: 'none',\n border: 'none',\n boxSizing: 'border-box',\n display: 'inline-flex',\n flexShrink: 0,\n fontFamily: '$rubik',\n fontWeight: '$medium',\n justifyContent: 'center',\n lineHeight: '1',\n verticalAlign: 'middle',\n outline: 'none',\n padding: '0',\n textDecoration: 'none',\n userSelect: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n borderRadius: '$pill',\n whiteSpace: 'nowrap',\n fontVariantNumeric: 'tabular-nums',\n position: 'relative',\n\n '&:disabled': {\n backgroundColor: '$slate3',\n pointerEvents: 'none',\n color: '$slate8',\n },\n variants: {\n size: {\n small: {\n height: '$4',\n px: '$2',\n fontSize: '$2',\n },\n large: {\n height: '$5',\n px: '$3',\n fontSize: '$3',\n },\n },\n variant: colorVariants,\n alphaBg: {\n true: {},\n },\n borderless: {\n true: {\n border: 'none',\n },\n },\n },\n compoundVariants: alphaColorCompoundVariants,\n defaultVariants: {\n size: 'small',\n variant: 'gray',\n borderless: false,\n },\n};\n\nconst StyledSpanBadge = styled('span', BADGE_BASE_STYLES);\nconst StyledSpanBadgeSlot = styled(Slot, StyledSpanBadge);\n\nconst StyledButtonBadge = styled('button', BADGE_BASE_STYLES, {\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n borderRadius: 'inherit',\n },\n '&:focus-visible': {\n outline: '2px solid $primary',\n },\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: '$badgeInteractiveBackgroundHover',\n },\n },\n '&:active': {\n '&::before': {\n backgroundColor: '$badgeInteractiveBackgroundActive',\n },\n },\n\n variants: {\n variant: interactiveColorVariants,\n borderless: {\n true: {\n border: 'none',\n },\n },\n },\n});\nconst StyledButtonBadgeSlot = styled(Slot, StyledButtonBadge);\n\ntype BadgeProps = ComponentProps<typeof StyledButtonBadge> &\n VariantProps<typeof StyledButtonBadge> & {\n asChild?: boolean;\n interactive?: boolean;\n };\n\nexport const Badge = React.forwardRef<React.ElementRef<typeof StyledButtonBadge>, BadgeProps>(\n ({ interactive, asChild, ...props }, forwardedRef) => {\n const Component = useMemo(() => {\n if (interactive) {\n return asChild ? StyledButtonBadgeSlot : StyledButtonBadge;\n }\n return asChild ? StyledSpanBadgeSlot : StyledSpanBadge;\n // eslint-disable-next-line @eslint-react/exhaustive-deps\n }, [asChild]);\n\n return <Component {...props} ref={forwardedRef} />;\n },\n);\n"],"mappings":";;;;;;;;AAQA,IAAM,uBAAuB,WAAyB;CACpD,IAAI,IAAI,MAAM;CACd,OAAO,IAAI,MAAM;CACjB,QAAQ,cAAc,MAAM;AAC9B;AAGA,IAAM,gB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CACA,WAAW;EACT,QAAQ;EACR,aAAa,EACX,iBAAiB,mCACnB;CACF;CACA,YAAY,EACV,aAAa,EACX,iBAAiB,oCACnB,EACF;CAEA,UAAU;EACR,SAAS;EACT,YAAY,EACV,MAAM,EACJ,QAAQ,OACV,EACF;CACF;AACF,CAAC;AACD,IAAM,wBAAwBA,wBAAAA,OAAOC,qBAAAA,MAAM,iBAAiB;AAQ5D,IAAa,QAAQC,MAAAA,QAAM,YACxB,EAAE,aAAa,SAAS,GAAG,SAAS,iBAAiB;CACpD,MAAM,aAAA,GAAYC,MAAAA,QAAAA,OAAc;EAC9B,IAAI,aACF,OAAO,UAAU,wBAAwB;EAE3C,OAAO,UAAU,sBAAsB;CAEzC,GAAG,CAAC,OAAO,CAAC;CAEZ,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EAAW,GAAI;EAAO,KAAK;CAAe,CAAA;AACnD,CACF"}
1
+ {"version":3,"file":"Badge.cjs","names":["COLORS","styled","Slot","React"],"sources":["../../../components/Badge/Badge.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { ComponentProps } from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { COLORS } from './Badge.vanilla';\n\ntype COLOR_VALUES = (typeof COLORS)[number];\n\nconst getColorBadgeStyles = (color: COLOR_VALUES) => ({\n bc: `$${color}6`,\n color: `$${color}10`,\n border: `1px solid $${color}10`,\n});\n\ntype ColorVariants = Record<COLOR_VALUES, { bc: string; color: string }>;\nconst colorVariants: ColorVariants = COLORS.reduce(\n (variants, color) => ({\n ...variants,\n [color]: getColorBadgeStyles(color),\n }),\n {} as ColorVariants,\n);\n\nconst interactiveColorVariants: ColorVariants = COLORS.reduce(\n (variants, color) => ({\n ...variants,\n [color]: {\n ...getColorBadgeStyles(color),\n },\n }),\n {} as ColorVariants,\n);\n\nconst alphaColorCompoundVariants = COLORS.map((color) => ({\n alphaBg: true,\n variant: color,\n css: { bc: `$${color}A6` },\n}));\n\nconst BADGE_BASE_STYLES = {\n // Reset\n alignItems: 'center',\n appearance: 'none',\n border: 'none',\n boxSizing: 'border-box',\n display: 'inline-flex',\n flexShrink: 0,\n fontFamily: '$rubik',\n fontWeight: '$medium',\n justifyContent: 'center',\n lineHeight: '1',\n verticalAlign: 'middle',\n outline: 'none',\n padding: '0',\n textDecoration: 'none',\n userSelect: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n borderRadius: '$pill',\n whiteSpace: 'nowrap',\n fontVariantNumeric: 'tabular-nums',\n position: 'relative',\n\n '&:disabled': {\n backgroundColor: '$slate3',\n pointerEvents: 'none',\n color: '$slate8',\n },\n variants: {\n size: {\n small: {\n height: '$4',\n px: '$2',\n fontSize: '$2',\n },\n large: {\n height: '$5',\n px: '$3',\n fontSize: '$3',\n },\n },\n variant: colorVariants,\n alphaBg: {\n true: {},\n },\n borderless: {\n true: {\n border: 'none',\n },\n },\n },\n compoundVariants: alphaColorCompoundVariants,\n defaultVariants: {\n size: 'small',\n variant: 'gray',\n borderless: false,\n },\n};\n\nconst StyledSpanBadge = styled('span', BADGE_BASE_STYLES);\nconst StyledSpanBadgeSlot = styled(Slot, StyledSpanBadge);\n\nconst StyledButtonBadge = styled('button', BADGE_BASE_STYLES, {\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n borderRadius: 'inherit',\n },\n '&:focus-visible': {\n outline: '2px solid $primary',\n },\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: '$badgeInteractiveBackgroundHover',\n },\n },\n '&:active': {\n '&::before': {\n backgroundColor: '$badgeInteractiveBackgroundActive',\n },\n },\n\n variants: {\n variant: interactiveColorVariants,\n borderless: {\n true: {\n border: 'none',\n },\n },\n },\n});\nconst StyledButtonBadgeSlot = styled(Slot, StyledButtonBadge);\n\ntype BadgeProps = ComponentProps<typeof StyledButtonBadge> &\n VariantProps<typeof StyledButtonBadge> & {\n asChild?: boolean;\n interactive?: boolean;\n };\n\nexport const Badge = React.forwardRef<React.ElementRef<typeof StyledButtonBadge>, BadgeProps>(\n ({ interactive, asChild, ...props }, forwardedRef) => {\n const Component = interactive\n ? asChild\n ? StyledButtonBadgeSlot\n : StyledButtonBadge\n : asChild\n ? StyledSpanBadgeSlot\n : StyledSpanBadge;\n\n return <Component {...props} ref={forwardedRef} />;\n },\n);\n"],"mappings":";;;;;;;;AAQA,IAAM,uBAAuB,WAAyB;CACpD,IAAI,IAAI,MAAM;CACd,OAAO,IAAI,MAAM;CACjB,QAAQ,cAAc,MAAM;AAC9B;AAGA,IAAM,gBAA+BA,sBAAAA,OAAO,QACzC,UAAU,WAAW;CACpB,GAAG;EACF,QAAQ,oBAAoB,KAAK;AACpC,IACA,CAAC,CACH;AAEA,IAAM,2BAA0CA,sBAAAA,OAAO,QACpD,UAAU,WAAW;CACpB,GAAG;EACF,QAAQ,EACP,GAAG,oBAAoB,KAAK,EAC9B;AACF,IACA,CAAC,CACH;AAEA,IAAM,6BAA6BA,sBAAAA,OAAO,KAAK,WAAW;CACxD,SAAS;CACT,SAAS;CACT,KAAK,EAAE,IAAI,IAAI,MAAM,IAAI;AAC3B,EAAE;AAEF,IAAM,oBAAoB;CAExB,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,eAAe;CACf,SAAS;CACT,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,yBAAyB;CACzB,cAAc;CACd,YAAY;CACZ,oBAAoB;CACpB,UAAU;CAEV,cAAc;EACZ,iBAAiB;EACjB,eAAe;EACf,OAAO;CACT;CACA,UAAU;EACR,MAAM;GACJ,OAAO;IACL,QAAQ;IACR,IAAI;IACJ,UAAU;GACZ;GACA,OAAO;IACL,QAAQ;IACR,IAAI;IACJ,UAAU;GACZ;EACF;EACA,SAAS;EACT,SAAS,EACP,MAAM,CAAC,EACT;EACA,YAAY,EACV,MAAM,EACJ,QAAQ,OACV,EACF;CACF;CACA,kBAAkB;CAClB,iBAAiB;EACf,MAAM;EACN,SAAS;EACT,YAAY;CACd;AACF;AAEA,IAAM,kBAAkBC,wBAAAA,OAAO,QAAQ,iBAAiB;AACxD,IAAM,sBAAsBA,wBAAAA,OAAOC,qBAAAA,MAAM,eAAe;AAExD,IAAM,oBAAoBD,wBAAAA,OAAO,UAAU,mBAAmB;CAC5D,aAAa;EACX,WAAW;EACX,SAAS;EACT,UAAU;EACV,OAAO;EACP,cAAc;CAChB;CACA,mBAAmB,EACjB,SAAS,qBACX;CACA,WAAW;EACT,QAAQ;EACR,aAAa,EACX,iBAAiB,mCACnB;CACF;CACA,YAAY,EACV,aAAa,EACX,iBAAiB,oCACnB,EACF;CAEA,UAAU;EACR,SAAS;EACT,YAAY,EACV,MAAM,EACJ,QAAQ,OACV,EACF;CACF;AACF,CAAC;AACD,IAAM,wBAAwBA,wBAAAA,OAAOC,qBAAAA,MAAM,iBAAiB;AAQ5D,IAAa,QAAQC,MAAAA,QAAM,YACxB,EAAE,aAAa,SAAS,GAAG,SAAS,iBAAiB;CASpD,OAAO,iBAAA,GAAA,kBAAA,IAAA,CARW,cACd,UACE,wBACA,oBACF,UACE,sBACA,iBAEC;EAAW,GAAI;EAAO,KAAK;CAAe,CAAA;AACnD,CACF"}
@@ -1,6 +1,6 @@
1
1
  import { styled } from "../../stitches.config.js";
2
2
  import { COLORS } from "./Badge.vanilla.js";
3
- import React, { useMemo } from "react";
3
+ import React from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { Slot } from "@radix-ui/react-slot";
6
6
  // components/Badge/Badge.tsx
@@ -95,11 +95,7 @@ var StyledButtonBadge = styled("button", BADGE_BASE_STYLES, {
95
95
  });
96
96
  var StyledButtonBadgeSlot = styled(Slot, StyledButtonBadge);
97
97
  var Badge = React.forwardRef(({ interactive, asChild, ...props }, forwardedRef) => {
98
- const Component = useMemo(() => {
99
- if (interactive) return asChild ? StyledButtonBadgeSlot : StyledButtonBadge;
100
- return asChild ? StyledSpanBadgeSlot : StyledSpanBadge;
101
- }, [asChild]);
102
- return /* @__PURE__ */ jsx(Component, {
98
+ return /* @__PURE__ */ jsx(interactive ? asChild ? StyledButtonBadgeSlot : StyledButtonBadge : asChild ? StyledSpanBadgeSlot : StyledSpanBadge, {
103
99
  ...props,
104
100
  ref: forwardedRef
105
101
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","names":[],"sources":["../../../components/Badge/Badge.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { ComponentProps, useMemo } from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { COLORS } from './Badge.vanilla';\n\ntype COLOR_VALUES = (typeof COLORS)[number];\n\nconst getColorBadgeStyles = (color: COLOR_VALUES) => ({\n bc: `$${color}6`,\n color: `$${color}10`,\n border: `1px solid $${color}10`,\n});\n\ntype ColorVariants = Record<COLOR_VALUES, { bc: string; color: string }>;\nconst colorVariants: ColorVariants = COLORS.reduce(\n (variants, color) => ({\n ...variants,\n [color]: getColorBadgeStyles(color),\n }),\n {} as ColorVariants,\n);\n\nconst interactiveColorVariants: ColorVariants = COLORS.reduce(\n (variants, color) => ({\n ...variants,\n [color]: {\n ...getColorBadgeStyles(color),\n },\n }),\n {} as ColorVariants,\n);\n\nconst alphaColorCompoundVariants = COLORS.map((color) => ({\n alphaBg: true,\n variant: color,\n css: { bc: `$${color}A6` },\n}));\n\nconst BADGE_BASE_STYLES = {\n // Reset\n alignItems: 'center',\n appearance: 'none',\n border: 'none',\n boxSizing: 'border-box',\n display: 'inline-flex',\n flexShrink: 0,\n fontFamily: '$rubik',\n fontWeight: '$medium',\n justifyContent: 'center',\n lineHeight: '1',\n verticalAlign: 'middle',\n outline: 'none',\n padding: '0',\n textDecoration: 'none',\n userSelect: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n borderRadius: '$pill',\n whiteSpace: 'nowrap',\n fontVariantNumeric: 'tabular-nums',\n position: 'relative',\n\n '&:disabled': {\n backgroundColor: '$slate3',\n pointerEvents: 'none',\n color: '$slate8',\n },\n variants: {\n size: {\n small: {\n height: '$4',\n px: '$2',\n fontSize: '$2',\n },\n large: {\n height: '$5',\n px: '$3',\n fontSize: '$3',\n },\n },\n variant: colorVariants,\n alphaBg: {\n true: {},\n },\n borderless: {\n true: {\n border: 'none',\n },\n },\n },\n compoundVariants: alphaColorCompoundVariants,\n defaultVariants: {\n size: 'small',\n variant: 'gray',\n borderless: false,\n },\n};\n\nconst StyledSpanBadge = styled('span', BADGE_BASE_STYLES);\nconst StyledSpanBadgeSlot = styled(Slot, StyledSpanBadge);\n\nconst StyledButtonBadge = styled('button', BADGE_BASE_STYLES, {\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n borderRadius: 'inherit',\n },\n '&:focus-visible': {\n outline: '2px solid $primary',\n },\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: '$badgeInteractiveBackgroundHover',\n },\n },\n '&:active': {\n '&::before': {\n backgroundColor: '$badgeInteractiveBackgroundActive',\n },\n },\n\n variants: {\n variant: interactiveColorVariants,\n borderless: {\n true: {\n border: 'none',\n },\n },\n },\n});\nconst StyledButtonBadgeSlot = styled(Slot, StyledButtonBadge);\n\ntype BadgeProps = ComponentProps<typeof StyledButtonBadge> &\n VariantProps<typeof StyledButtonBadge> & {\n asChild?: boolean;\n interactive?: boolean;\n };\n\nexport const Badge = React.forwardRef<React.ElementRef<typeof StyledButtonBadge>, BadgeProps>(\n ({ interactive, asChild, ...props }, forwardedRef) => {\n const Component = useMemo(() => {\n if (interactive) {\n return asChild ? StyledButtonBadgeSlot : StyledButtonBadge;\n }\n return asChild ? StyledSpanBadgeSlot : StyledSpanBadge;\n // eslint-disable-next-line @eslint-react/exhaustive-deps\n }, [asChild]);\n\n return <Component {...props} ref={forwardedRef} />;\n },\n);\n"],"mappings":";;;;;;AAQA,IAAM,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AAc;CAChB;CACA,mBAAmB,EACjB,SAAS,qBACX;CACA,WAAW;EACT,QAAQ;EACR,aAAa,EACX,iBAAiB,mCACnB;CACF;CACA,YAAY,EACV,aAAa,EACX,iBAAiB,oCACnB,EACF;CAEA,UAAU;EACR,SAAS;EACT,YAAY,EACV,MAAM,EACJ,QAAQ,OACV,EACF;CACF;AACF,CAAC;AACD,IAAM,wBAAwB,OAAO,MAAM,iBAAiB;AAQ5D,IAAa,QAAQ,MAAM,YACxB,EAAE,aAAa,SAAS,GAAG,SAAS,iBAAiB;CACpD,MAAM,YAAY,cAAc;EAC9B,IAAI,aACF,OAAO,UAAU,wBAAwB;EAE3C,OAAO,UAAU,sBAAsB;CAEzC,GAAG,CAAC,OAAO,CAAC;CAEZ,OAAO,oBAAC,WAAD;EAAW,GAAI;EAAO,KAAK;CAAe,CAAA;AACnD,CACF"}
1
+ {"version":3,"file":"Badge.js","names":[],"sources":["../../../components/Badge/Badge.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { ComponentProps } from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { COLORS } from './Badge.vanilla';\n\ntype COLOR_VALUES = (typeof COLORS)[number];\n\nconst getColorBadgeStyles = (color: COLOR_VALUES) => ({\n bc: `$${color}6`,\n color: `$${color}10`,\n border: `1px solid $${color}10`,\n});\n\ntype ColorVariants = Record<COLOR_VALUES, { bc: string; color: string }>;\nconst colorVariants: ColorVariants = COLORS.reduce(\n (variants, color) => ({\n ...variants,\n [color]: getColorBadgeStyles(color),\n }),\n {} as ColorVariants,\n);\n\nconst interactiveColorVariants: ColorVariants = COLORS.reduce(\n (variants, color) => ({\n ...variants,\n [color]: {\n ...getColorBadgeStyles(color),\n },\n }),\n {} as ColorVariants,\n);\n\nconst alphaColorCompoundVariants = COLORS.map((color) => ({\n alphaBg: true,\n variant: color,\n css: { bc: `$${color}A6` },\n}));\n\nconst BADGE_BASE_STYLES = {\n // Reset\n alignItems: 'center',\n appearance: 'none',\n border: 'none',\n boxSizing: 'border-box',\n display: 'inline-flex',\n flexShrink: 0,\n fontFamily: '$rubik',\n fontWeight: '$medium',\n justifyContent: 'center',\n lineHeight: '1',\n verticalAlign: 'middle',\n outline: 'none',\n padding: '0',\n textDecoration: 'none',\n userSelect: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n borderRadius: '$pill',\n whiteSpace: 'nowrap',\n fontVariantNumeric: 'tabular-nums',\n position: 'relative',\n\n '&:disabled': {\n backgroundColor: '$slate3',\n pointerEvents: 'none',\n color: '$slate8',\n },\n variants: {\n size: {\n small: {\n height: '$4',\n px: '$2',\n fontSize: '$2',\n },\n large: {\n height: '$5',\n px: '$3',\n fontSize: '$3',\n },\n },\n variant: colorVariants,\n alphaBg: {\n true: {},\n },\n borderless: {\n true: {\n border: 'none',\n },\n },\n },\n compoundVariants: alphaColorCompoundVariants,\n defaultVariants: {\n size: 'small',\n variant: 'gray',\n borderless: false,\n },\n};\n\nconst StyledSpanBadge = styled('span', BADGE_BASE_STYLES);\nconst StyledSpanBadgeSlot = styled(Slot, StyledSpanBadge);\n\nconst StyledButtonBadge = styled('button', BADGE_BASE_STYLES, {\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n borderRadius: 'inherit',\n },\n '&:focus-visible': {\n outline: '2px solid $primary',\n },\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: '$badgeInteractiveBackgroundHover',\n },\n },\n '&:active': {\n '&::before': {\n backgroundColor: '$badgeInteractiveBackgroundActive',\n },\n },\n\n variants: {\n variant: interactiveColorVariants,\n borderless: {\n true: {\n border: 'none',\n },\n },\n },\n});\nconst StyledButtonBadgeSlot = styled(Slot, StyledButtonBadge);\n\ntype BadgeProps = ComponentProps<typeof StyledButtonBadge> &\n VariantProps<typeof StyledButtonBadge> & {\n asChild?: boolean;\n interactive?: boolean;\n };\n\nexport const Badge = React.forwardRef<React.ElementRef<typeof StyledButtonBadge>, BadgeProps>(\n ({ interactive, asChild, ...props }, forwardedRef) => {\n const Component = interactive\n ? asChild\n ? StyledButtonBadgeSlot\n : StyledButtonBadge\n : asChild\n ? StyledSpanBadgeSlot\n : StyledSpanBadge;\n\n return <Component {...props} ref={forwardedRef} />;\n },\n);\n"],"mappings":";;;;;;AAQA,IAAM,uBAAuB,WAAyB;CACpD,IAAI,IAAI,MAAM;CACd,OAAO,IAAI,MAAM;CACjB,QAAQ,cAAc,MAAM;AAC9B;AAGA,IAAM,gBAA+B,OAAO,QACzC,UAAU,WAAW;CACpB,GAAG;EACF,QAAQ,oBAAoB,KAAK;AACpC,IACA,CAAC,CACH;AAEA,IAAM,2BAA0C,OAAO,QACpD,UAAU,WAAW;CACpB,GAAG;EACF,QAAQ,EACP,GAAG,oBAAoB,KAAK,EAC9B;AACF,IACA,CAAC,CACH;AAEA,IAAM,6BAA6B,OAAO,KAAK,WAAW;CACxD,SAAS;CACT,SAAS;CACT,KAAK,EAAE,IAAI,IAAI,MAAM,IAAI;AAC3B,EAAE;AAEF,IAAM,oBAAoB;CAExB,YAAY;CACZ,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,eAAe;CACf,SAAS;CACT,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,yBAAyB;CACzB,cAAc;CACd,YAAY;CACZ,oBAAoB;CACpB,UAAU;CAEV,cAAc;EACZ,iBAAiB;EACjB,eAAe;EACf,OAAO;CACT;CACA,UAAU;EACR,MAAM;GACJ,OAAO;IACL,QAAQ;IACR,IAAI;IACJ,UAAU;GACZ;GACA,OAAO;IACL,QAAQ;IACR,IAAI;IACJ,UAAU;GACZ;EACF;EACA,SAAS;EACT,SAAS,EACP,MAAM,CAAC,EACT;EACA,YAAY,EACV,MAAM,EACJ,QAAQ,OACV,EACF;CACF;CACA,kBAAkB;CAClB,iBAAiB;EACf,MAAM;EACN,SAAS;EACT,YAAY;CACd;AACF;AAEA,IAAM,kBAAkB,OAAO,QAAQ,iBAAiB;AACxD,IAAM,sBAAsB,OAAO,MAAM,eAAe;AAExD,IAAM,oBAAoB,OAAO,UAAU,mBAAmB;CAC5D,aAAa;EACX,WAAW;EACX,SAAS;EACT,UAAU;EACV,OAAO;EACP,cAAc;CAChB;CACA,mBAAmB,EACjB,SAAS,qBACX;CACA,WAAW;EACT,QAAQ;EACR,aAAa,EACX,iBAAiB,mCACnB;CACF;CACA,YAAY,EACV,aAAa,EACX,iBAAiB,oCACnB,EACF;CAEA,UAAU;EACR,SAAS;EACT,YAAY,EACV,MAAM,EACJ,QAAQ,OACV,EACF;CACF;AACF,CAAC;AACD,IAAM,wBAAwB,OAAO,MAAM,iBAAiB;AAQ5D,IAAa,QAAQ,MAAM,YACxB,EAAE,aAAa,SAAS,GAAG,SAAS,iBAAiB;CASpD,OAAO,oBARW,cACd,UACE,wBACA,oBACF,UACE,sBACA,iBAEC;EAAW,GAAI;EAAO,KAAK;CAAe,CAAA;AACnD,CACF"}
@@ -227,8 +227,7 @@ var StyledButton = require_stitches_config.styled("button", BUTTON_BASE_STYLES,
227
227
  });
228
228
  var StyledButtonSlot = require_stitches_config.styled(_radix_ui_react_slot.Slot, StyledButton);
229
229
  var Button = react.default.forwardRef(({ children, asChild, ...props }, forwardedRef) => {
230
- const Component = (0, react.useMemo)(() => asChild ? StyledButtonSlot : StyledButton, [asChild]);
231
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
230
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? StyledButtonSlot : StyledButton, {
232
231
  ref: forwardedRef,
233
232
  ...props,
234
233
  children
@@ -1 +1 @@
1
- {"version":3,"file":"Button.cjs","names":["keyframes","styled","Slot","React","useMemo"],"sources":["../../../components/Button/Button.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { ComponentProps, useMemo } from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\n\nexport const BUTTON_BASE_STYLES = {\n appearance: 'none',\n userSelect: 'none',\n boxSizing: 'border-box',\n border: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.5,\n },\n};\n\nconst BG_SIZES = {\n small: '$sizes$8',\n medium: '$sizes$9',\n large: '$sizes$10',\n};\n\nconst backgroundSizeAnimation = (size: keyof typeof BG_SIZES) => ({\n $$bgSize: BG_SIZES[size],\n backgroundSize: '$$bgSize',\n backgroundImage: `linear-gradient(\n -45deg,\n transparent 33%,\n $colors$deepBlue4 33%,\n $colors$deepBlue4 66%,\n transparent 66%\n )`,\n animation: `${keyframes({\n '100%': { transform: 'translateX($$bgSize)' },\n })} 500ms linear infinite`,\n});\n\nexport const StyledButton = styled('button', BUTTON_BASE_STYLES, {\n // Reset\n all: 'unset',\n alignItems: 'center',\n overflow: 'hidden',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n\n // Custom reset?\n display: 'inline-flex',\n flexShrink: 0,\n justifyContent: 'center',\n lineHeight: '1',\n\n // Custom\n position: 'relative',\n height: '$5',\n px: '$2',\n fontFamily: '$rubik',\n fontSize: '$3',\n fontWeight: '$medium',\n fontVariantNumeric: 'tabular-nums',\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$focusOutline`,\n '&::before': {\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n },\n '&::after': {\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n },\n '&::after': {\n opacity: 0.05,\n },\n },\n },\n\n '&:active': {\n '&::before': {\n backgroundColor: 'rgba(0, 0, 0, 0.15)',\n },\n },\n\n variants: {\n size: {\n small: {\n borderRadius: '$button',\n height: '$5',\n px: '$2',\n fontSize: '$1',\n lineHeight: '$sizes$5',\n },\n medium: {\n borderRadius: '$button',\n height: '$6',\n px: '$3',\n fontSize: '$3',\n lineHeight: '$sizes$6',\n },\n large: {\n borderRadius: '$button',\n height: '$7',\n px: '$3',\n fontSize: '$3',\n lineHeight: '$sizes$7',\n },\n },\n variant: {\n primary: {\n bc: '$buttonPrimaryBg',\n c: '$buttonPrimaryText',\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonPrimaryFocusBorder',\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$buttonPrimaryBg',\n },\n },\n },\n },\n secondary: {\n bc: '$buttonSecondaryBg',\n c: '$buttonSecondaryText',\n boxShadow: 'inset 0 0 0 2px $colors$buttonSecondaryBorder',\n '&:active': {\n boxShadow: 'inset 0 0 0 1px $colors$buttonSecondaryBorder',\n },\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonSecondaryFocusBorder',\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$buttonPrimaryBg',\n },\n },\n },\n },\n red: {\n backgroundColor: '$buttonRedBg',\n color: '$buttonRedText',\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonRedFocusBg',\n },\n },\n },\n state: {\n active: {\n bc: '$deepBlue5',\n c: '$deepBlue11',\n '&:active': {\n backgroundColor: '$deepBlue5',\n },\n },\n waiting: {\n bc: '$deepBlue3',\n boxShadow: `inset 0 0 0 1px $deepBlue4`,\n c: 'transparent',\n overflow: 'hidden',\n pointerEvents: 'none',\n '&::after': {\n left: '-100%',\n width: '200%',\n ...backgroundSizeAnimation('medium'),\n },\n },\n },\n ghost: {\n true: {\n boxShadow: 'none',\n '@hover': {\n '&:hover': {\n boxShadow: 'none',\n },\n },\n },\n },\n rounded: {\n true: {\n borderRadius: '$pill',\n },\n },\n },\n compoundVariants: [\n {\n variant: 'primary',\n ghost: 'true',\n css: {\n color: '$buttonPrimaryBg',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n color: '$buttonPrimaryGhostHoverText',\n backgroundColor: 'transparent',\n },\n },\n },\n },\n {\n variant: 'primary',\n state: 'active',\n css: {\n backgroundColor: '$buttonPrimaryFocusBg',\n color: '$buttonPrimaryText',\n boxShadow: 'inset 0 0 0 2px white',\n },\n },\n {\n variant: 'secondary',\n state: 'waiting',\n css: {\n backgroundColor: '$deepBlue3',\n color: 'transparent',\n },\n },\n {\n variant: 'secondary',\n ghost: true,\n css: {\n backgroundColor: 'transparent',\n color: '$buttonSecondaryText',\n boxShadow: 'none',\n },\n },\n {\n variant: 'red',\n state: 'waiting',\n css: {\n backgroundColor: '$deepBlue3',\n color: 'transparent',\n },\n },\n {\n variant: 'red',\n state: 'active',\n css: {\n backgroundColor: '$buttonRedFocusBg',\n color: '$buttonRedText',\n boxShadow: 'inset 0 0 0 2px white',\n },\n },\n {\n variant: 'red',\n ghost: 'true',\n css: {\n color: '$buttonRedBg',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n color: '$buttonRedHoverText',\n backgroundColor: 'transparent',\n },\n },\n },\n },\n {\n size: 'small',\n state: 'waiting',\n css: {\n '&::after': backgroundSizeAnimation('small'),\n },\n },\n {\n size: 'large',\n state: 'waiting',\n css: {\n '&::after': backgroundSizeAnimation('large'),\n },\n },\n ],\n defaultVariants: {\n size: 'medium',\n variant: 'primary',\n },\n});\nconst StyledButtonSlot = styled(Slot, StyledButton);\n\nexport interface ButtonVariants extends VariantProps<typeof StyledButton> {}\nexport type ButtonProps = ComponentProps<typeof StyledButton> &\n ButtonVariants & {\n css?: CSS;\n asChild?: boolean;\n as?: string;\n };\n\nexport const Button = React.forwardRef<React.ElementRef<typeof StyledButton>, ButtonProps>(\n ({ children, asChild, ...props }, forwardedRef) => {\n const Component = useMemo(() => (asChild ? StyledButtonSlot : StyledButton), [asChild]);\n return (\n <Component ref={forwardedRef} {...props}>\n {children}\n </Component>\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;IACP,IAAI;IACJ,GAAG;IACH,mBAAmB,EACjB,WAAW,mDACb;IACA,UAAU,EACR,WAAW,EACT,YAAY,EACV,iBAAiB,mBACnB,EACF,EACF;GACF;GACA,WAAW;IACT,IAAI;IACJ,GAAG;IACH,WAAW;IACX,YAAY,EACV,WAAW,gDACb;IACA,mBAAmB,EACjB,WAAW,qDACb;IACA,UAAU,EACR,WAAW,EACT,YAAY,EACV,iBAAiB,mBACnB,EACF,EACF;GACF;GACA,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,mBAAmB,EACjB,WAAW,2CACb;GACF;EACF;EACA,OAAO;GACL,QAAQ;IACN,IAAI;IACJ,GAAG;IACH,YAAY,EACV,iBAAiB,aACnB;GACF;GACA,SAAS;IACP,IAAI;IACJ,WAAW;IACX,GAAG;IACH,UAAU;IACV,eAAe;IACf,YAAY;KACV,MAAM;KACN,OAAO;KACP,GAAG,wBAAwB,QAAQ;IACrC;GACF;EACF;EACA,OAAO,EACL,MAAM;GACJ,WAAW;GACX,UAAU,EACR,WAAW,EACT,WAAW,OACb,EACF;EACF,EACF;EACA,SAAS,EACP,MAAM,EACJ,cAAc,QAChB,EACF;CACF;CACA,kBAAkB;EAChB;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,OAAO;IACP,iBAAiB;IACjB,UAAU,EACR,WAAW;KACT,OAAO;KACP,iBAAiB;IACnB,EACF;GACF;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;GACT;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;GACT;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,OAAO;IACP,iBAAiB;IACjB,UAAU,EACR,WAAW;KACT,OAAO;KACP,iBAAiB;IACnB,EACF;GACF;EACF;EACA;GACE,MAAM;GACN,OAAO;GACP,KAAK,EACH,YAAY,wBAAwB,OAAO,EAC7C;EACF;EACA;GACE,MAAM;GACN,OAAO;GACP,KAAK,EACH,YAAY,wBAAwB,OAAO,EAC7C;EACF;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;AACF,CAAC;AACD,IAAM,mBAAmBA,wBAAAA,OAAOC,qBAAAA,MAAM,YAAY;AAUlD,IAAa,SAASC,MAAAA,QAAM,YACzB,EAAE,UAAU,SAAS,GAAG,SAAS,iBAAiB;CACjD,MAAM,aAAA,GAAYC,MAAAA,QAAAA,OAAe,UAAU,mBAAmB,cAAe,CAAC,OAAO,CAAC;CACtF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EAAW,KAAK;EAAc,GAAI;EAC/B;CACQ,CAAA;AAEf,CACF"}
1
+ {"version":3,"file":"Button.cjs","names":["keyframes","styled","Slot","React"],"sources":["../../../components/Button/Button.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\n\nexport const BUTTON_BASE_STYLES = {\n appearance: 'none',\n userSelect: 'none',\n boxSizing: 'border-box',\n border: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.5,\n },\n};\n\nconst BG_SIZES = {\n small: '$sizes$8',\n medium: '$sizes$9',\n large: '$sizes$10',\n};\n\nconst backgroundSizeAnimation = (size: keyof typeof BG_SIZES) => ({\n $$bgSize: BG_SIZES[size],\n backgroundSize: '$$bgSize',\n backgroundImage: `linear-gradient(\n -45deg,\n transparent 33%,\n $colors$deepBlue4 33%,\n $colors$deepBlue4 66%,\n transparent 66%\n )`,\n animation: `${keyframes({\n '100%': { transform: 'translateX($$bgSize)' },\n })} 500ms linear infinite`,\n});\n\nexport const StyledButton = styled('button', BUTTON_BASE_STYLES, {\n // Reset\n all: 'unset',\n alignItems: 'center',\n overflow: 'hidden',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n\n // Custom reset?\n display: 'inline-flex',\n flexShrink: 0,\n justifyContent: 'center',\n lineHeight: '1',\n\n // Custom\n position: 'relative',\n height: '$5',\n px: '$2',\n fontFamily: '$rubik',\n fontSize: '$3',\n fontWeight: '$medium',\n fontVariantNumeric: 'tabular-nums',\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$focusOutline`,\n '&::before': {\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n },\n '&::after': {\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n },\n '&::after': {\n opacity: 0.05,\n },\n },\n },\n\n '&:active': {\n '&::before': {\n backgroundColor: 'rgba(0, 0, 0, 0.15)',\n },\n },\n\n variants: {\n size: {\n small: {\n borderRadius: '$button',\n height: '$5',\n px: '$2',\n fontSize: '$1',\n lineHeight: '$sizes$5',\n },\n medium: {\n borderRadius: '$button',\n height: '$6',\n px: '$3',\n fontSize: '$3',\n lineHeight: '$sizes$6',\n },\n large: {\n borderRadius: '$button',\n height: '$7',\n px: '$3',\n fontSize: '$3',\n lineHeight: '$sizes$7',\n },\n },\n variant: {\n primary: {\n bc: '$buttonPrimaryBg',\n c: '$buttonPrimaryText',\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonPrimaryFocusBorder',\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$buttonPrimaryBg',\n },\n },\n },\n },\n secondary: {\n bc: '$buttonSecondaryBg',\n c: '$buttonSecondaryText',\n boxShadow: 'inset 0 0 0 2px $colors$buttonSecondaryBorder',\n '&:active': {\n boxShadow: 'inset 0 0 0 1px $colors$buttonSecondaryBorder',\n },\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonSecondaryFocusBorder',\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$buttonPrimaryBg',\n },\n },\n },\n },\n red: {\n backgroundColor: '$buttonRedBg',\n color: '$buttonRedText',\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonRedFocusBg',\n },\n },\n },\n state: {\n active: {\n bc: '$deepBlue5',\n c: '$deepBlue11',\n '&:active': {\n backgroundColor: '$deepBlue5',\n },\n },\n waiting: {\n bc: '$deepBlue3',\n boxShadow: `inset 0 0 0 1px $deepBlue4`,\n c: 'transparent',\n overflow: 'hidden',\n pointerEvents: 'none',\n '&::after': {\n left: '-100%',\n width: '200%',\n ...backgroundSizeAnimation('medium'),\n },\n },\n },\n ghost: {\n true: {\n boxShadow: 'none',\n '@hover': {\n '&:hover': {\n boxShadow: 'none',\n },\n },\n },\n },\n rounded: {\n true: {\n borderRadius: '$pill',\n },\n },\n },\n compoundVariants: [\n {\n variant: 'primary',\n ghost: 'true',\n css: {\n color: '$buttonPrimaryBg',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n color: '$buttonPrimaryGhostHoverText',\n backgroundColor: 'transparent',\n },\n },\n },\n },\n {\n variant: 'primary',\n state: 'active',\n css: {\n backgroundColor: '$buttonPrimaryFocusBg',\n color: '$buttonPrimaryText',\n boxShadow: 'inset 0 0 0 2px white',\n },\n },\n {\n variant: 'secondary',\n state: 'waiting',\n css: {\n backgroundColor: '$deepBlue3',\n color: 'transparent',\n },\n },\n {\n variant: 'secondary',\n ghost: true,\n css: {\n backgroundColor: 'transparent',\n color: '$buttonSecondaryText',\n boxShadow: 'none',\n },\n },\n {\n variant: 'red',\n state: 'waiting',\n css: {\n backgroundColor: '$deepBlue3',\n color: 'transparent',\n },\n },\n {\n variant: 'red',\n state: 'active',\n css: {\n backgroundColor: '$buttonRedFocusBg',\n color: '$buttonRedText',\n boxShadow: 'inset 0 0 0 2px white',\n },\n },\n {\n variant: 'red',\n ghost: 'true',\n css: {\n color: '$buttonRedBg',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n color: '$buttonRedHoverText',\n backgroundColor: 'transparent',\n },\n },\n },\n },\n {\n size: 'small',\n state: 'waiting',\n css: {\n '&::after': backgroundSizeAnimation('small'),\n },\n },\n {\n size: 'large',\n state: 'waiting',\n css: {\n '&::after': backgroundSizeAnimation('large'),\n },\n },\n ],\n defaultVariants: {\n size: 'medium',\n variant: 'primary',\n },\n});\nconst StyledButtonSlot = styled(Slot, StyledButton);\n\nexport interface ButtonVariants extends VariantProps<typeof StyledButton> {}\nexport type ButtonProps = ComponentProps<typeof StyledButton> &\n ButtonVariants & {\n css?: CSS;\n asChild?: boolean;\n as?: string;\n };\n\nexport const Button = React.forwardRef<React.ElementRef<typeof StyledButton>, ButtonProps>(\n ({ children, asChild, ...props }, forwardedRef) => {\n const Component = asChild ? StyledButtonSlot : StyledButton;\n return (\n <Component ref={forwardedRef} {...props}>\n {children}\n </Component>\n );\n },\n);\n"],"mappings":";;;;;;;AAKA,IAAa,qBAAqB;CAChC,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,QAAQ;CACR,yBAAyB;CACzB,cAAc;EACZ,eAAe;EACf,SAAS;CACX;AACF;AAEA,IAAM,WAAW;CACf,OAAO;CACP,QAAQ;CACR,OAAO;AACT;AAEA,IAAM,2BAA2B,UAAiC;CAChE,UAAU,SAAS;CACnB,gBAAgB;CAChB,iBAAiB;;;;;;;CAOjB,WAAW,GAAGA,wBAAAA,UAAU,EACtB,QAAQ,EAAE,WAAW,uBAAuB,EAC9C,CAAC,EAAE;AACL;AAEA,IAAa,eAAeC,wB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,GAAG;IACH,YAAY,EACV,iBAAiB,aACnB;GACF;GACA,SAAS;IACP,IAAI;IACJ,WAAW;IACX,GAAG;IACH,UAAU;IACV,eAAe;IACf,YAAY;KACV,MAAM;KACN,OAAO;KACP,GAAG,wBAAwB,QAAQ;IACrC;GACF;EACF;EACA,OAAO,EACL,MAAM;GACJ,WAAW;GACX,UAAU,EACR,WAAW,EACT,WAAW,OACb,EACF;EACF,EACF;EACA,SAAS,EACP,MAAM,EACJ,cAAc,QAChB,EACF;CACF;CACA,kBAAkB;EAChB;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,OAAO;IACP,iBAAiB;IACjB,UAAU,EACR,WAAW;KACT,OAAO;KACP,iBAAiB;IACnB,EACF;GACF;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;GACT;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;GACT;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,OAAO;IACP,iBAAiB;IACjB,UAAU,EACR,WAAW;KACT,OAAO;KACP,iBAAiB;IACnB,EACF;GACF;EACF;EACA;GACE,MAAM;GACN,OAAO;GACP,KAAK,EACH,YAAY,wBAAwB,OAAO,EAC7C;EACF;EACA;GACE,MAAM;GACN,OAAO;GACP,KAAK,EACH,YAAY,wBAAwB,OAAO,EAC7C;EACF;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;AACF,CAAC;AACD,IAAM,mBAAmBA,wBAAAA,OAAOC,qBAAAA,MAAM,YAAY;AAUlD,IAAa,SAASC,MAAAA,QAAM,YACzB,EAAE,UAAU,SAAS,GAAG,SAAS,iBAAiB;CAEjD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAFgB,UAAU,mBAAmB,cAE7C;EAAW,KAAK;EAAc,GAAI;EAC/B;CACQ,CAAA;AAEf,CACF"}
@@ -1,5 +1,5 @@
1
1
  import { keyframes, styled } from "../../stitches.config.js";
2
- import React, { useMemo } from "react";
2
+ import React from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { Slot } from "@radix-ui/react-slot";
5
5
  // components/Button/Button.tsx
@@ -225,8 +225,7 @@ var StyledButton = styled("button", BUTTON_BASE_STYLES, {
225
225
  });
226
226
  var StyledButtonSlot = styled(Slot, StyledButton);
227
227
  var Button = React.forwardRef(({ children, asChild, ...props }, forwardedRef) => {
228
- const Component = useMemo(() => asChild ? StyledButtonSlot : StyledButton, [asChild]);
229
- return /* @__PURE__ */ jsx(Component, {
228
+ return /* @__PURE__ */ jsx(asChild ? StyledButtonSlot : StyledButton, {
230
229
  ref: forwardedRef,
231
230
  ...props,
232
231
  children
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":[],"sources":["../../../components/Button/Button.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { ComponentProps, useMemo } from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\n\nexport const BUTTON_BASE_STYLES = {\n appearance: 'none',\n userSelect: 'none',\n boxSizing: 'border-box',\n border: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.5,\n },\n};\n\nconst BG_SIZES = {\n small: '$sizes$8',\n medium: '$sizes$9',\n large: '$sizes$10',\n};\n\nconst backgroundSizeAnimation = (size: keyof typeof BG_SIZES) => ({\n $$bgSize: BG_SIZES[size],\n backgroundSize: '$$bgSize',\n backgroundImage: `linear-gradient(\n -45deg,\n transparent 33%,\n $colors$deepBlue4 33%,\n $colors$deepBlue4 66%,\n transparent 66%\n )`,\n animation: `${keyframes({\n '100%': { transform: 'translateX($$bgSize)' },\n })} 500ms linear infinite`,\n});\n\nexport const StyledButton = styled('button', BUTTON_BASE_STYLES, {\n // Reset\n all: 'unset',\n alignItems: 'center',\n overflow: 'hidden',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n\n // Custom reset?\n display: 'inline-flex',\n flexShrink: 0,\n justifyContent: 'center',\n lineHeight: '1',\n\n // Custom\n position: 'relative',\n height: '$5',\n px: '$2',\n fontFamily: '$rubik',\n fontSize: '$3',\n fontWeight: '$medium',\n fontVariantNumeric: 'tabular-nums',\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$focusOutline`,\n '&::before': {\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n },\n '&::after': {\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n },\n '&::after': {\n opacity: 0.05,\n },\n },\n },\n\n '&:active': {\n '&::before': {\n backgroundColor: 'rgba(0, 0, 0, 0.15)',\n },\n },\n\n variants: {\n size: {\n small: {\n borderRadius: '$button',\n height: '$5',\n px: '$2',\n fontSize: '$1',\n lineHeight: '$sizes$5',\n },\n medium: {\n borderRadius: '$button',\n height: '$6',\n px: '$3',\n fontSize: '$3',\n lineHeight: '$sizes$6',\n },\n large: {\n borderRadius: '$button',\n height: '$7',\n px: '$3',\n fontSize: '$3',\n lineHeight: '$sizes$7',\n },\n },\n variant: {\n primary: {\n bc: '$buttonPrimaryBg',\n c: '$buttonPrimaryText',\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonPrimaryFocusBorder',\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$buttonPrimaryBg',\n },\n },\n },\n },\n secondary: {\n bc: '$buttonSecondaryBg',\n c: '$buttonSecondaryText',\n boxShadow: 'inset 0 0 0 2px $colors$buttonSecondaryBorder',\n '&:active': {\n boxShadow: 'inset 0 0 0 1px $colors$buttonSecondaryBorder',\n },\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonSecondaryFocusBorder',\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$buttonPrimaryBg',\n },\n },\n },\n },\n red: {\n backgroundColor: '$buttonRedBg',\n color: '$buttonRedText',\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonRedFocusBg',\n },\n },\n },\n state: {\n active: {\n bc: '$deepBlue5',\n c: '$deepBlue11',\n '&:active': {\n backgroundColor: '$deepBlue5',\n },\n },\n waiting: {\n bc: '$deepBlue3',\n boxShadow: `inset 0 0 0 1px $deepBlue4`,\n c: 'transparent',\n overflow: 'hidden',\n pointerEvents: 'none',\n '&::after': {\n left: '-100%',\n width: '200%',\n ...backgroundSizeAnimation('medium'),\n },\n },\n },\n ghost: {\n true: {\n boxShadow: 'none',\n '@hover': {\n '&:hover': {\n boxShadow: 'none',\n },\n },\n },\n },\n rounded: {\n true: {\n borderRadius: '$pill',\n },\n },\n },\n compoundVariants: [\n {\n variant: 'primary',\n ghost: 'true',\n css: {\n color: '$buttonPrimaryBg',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n color: '$buttonPrimaryGhostHoverText',\n backgroundColor: 'transparent',\n },\n },\n },\n },\n {\n variant: 'primary',\n state: 'active',\n css: {\n backgroundColor: '$buttonPrimaryFocusBg',\n color: '$buttonPrimaryText',\n boxShadow: 'inset 0 0 0 2px white',\n },\n },\n {\n variant: 'secondary',\n state: 'waiting',\n css: {\n backgroundColor: '$deepBlue3',\n color: 'transparent',\n },\n },\n {\n variant: 'secondary',\n ghost: true,\n css: {\n backgroundColor: 'transparent',\n color: '$buttonSecondaryText',\n boxShadow: 'none',\n },\n },\n {\n variant: 'red',\n state: 'waiting',\n css: {\n backgroundColor: '$deepBlue3',\n color: 'transparent',\n },\n },\n {\n variant: 'red',\n state: 'active',\n css: {\n backgroundColor: '$buttonRedFocusBg',\n color: '$buttonRedText',\n boxShadow: 'inset 0 0 0 2px white',\n },\n },\n {\n variant: 'red',\n ghost: 'true',\n css: {\n color: '$buttonRedBg',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n color: '$buttonRedHoverText',\n backgroundColor: 'transparent',\n },\n },\n },\n },\n {\n size: 'small',\n state: 'waiting',\n css: {\n '&::after': backgroundSizeAnimation('small'),\n },\n },\n {\n size: 'large',\n state: 'waiting',\n css: {\n '&::after': backgroundSizeAnimation('large'),\n },\n },\n ],\n defaultVariants: {\n size: 'medium',\n variant: 'primary',\n },\n});\nconst StyledButtonSlot = styled(Slot, StyledButton);\n\nexport interface ButtonVariants extends VariantProps<typeof StyledButton> {}\nexport type ButtonProps = ComponentProps<typeof StyledButton> &\n ButtonVariants & {\n css?: CSS;\n asChild?: boolean;\n as?: string;\n };\n\nexport const Button = React.forwardRef<React.ElementRef<typeof StyledButton>, ButtonProps>(\n ({ children, asChild, ...props }, forwardedRef) => {\n const Component = useMemo(() => (asChild ? StyledButtonSlot : StyledButton), [asChild]);\n return (\n <Component ref={forwardedRef} {...props}>\n {children}\n </Component>\n );\n },\n);\n"],"mappings":";;;;;AAKA,IAAa,qBAAqB;CAChC,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,QAAQ;CACR,yBAAyB;CACzB,cAAc;EACZ,eAAe;EACf,SAAS;CACX;AACF;AAEA,IAAM,WAAW;CACf,OAAO;CACP,QAAQ;CACR,OAAO;AACT;AAEA,IAAM,2BAA2B,UAAiC;CAChE,UAAU,SAAS;CACnB,gBAAgB;CAChB,iBAAiB;;;;;;;CAOjB,WAAW,GAAG,UAAU,EACtB,QAAQ,EAAE,WAAW,uBAAuB,EAC9C,CAAC,EAAE;AACL;AAEA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AI;IACJ,GAAG;IACH,YAAY,EACV,iBAAiB,aACnB;GACF;GACA,SAAS;IACP,IAAI;IACJ,WAAW;IACX,GAAG;IACH,UAAU;IACV,eAAe;IACf,YAAY;KACV,MAAM;KACN,OAAO;KACP,GAAG,wBAAwB,QAAQ;IACrC;GACF;EACF;EACA,OAAO,EACL,MAAM;GACJ,WAAW;GACX,UAAU,EACR,WAAW,EACT,WAAW,OACb,EACF;EACF,EACF;EACA,SAAS,EACP,MAAM,EACJ,cAAc,QAChB,EACF;CACF;CACA,kBAAkB;EAChB;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,OAAO;IACP,iBAAiB;IACjB,UAAU,EACR,WAAW;KACT,OAAO;KACP,iBAAiB;IACnB,EACF;GACF;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;GACT;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;GACT;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,OAAO;IACP,iBAAiB;IACjB,UAAU,EACR,WAAW;KACT,OAAO;KACP,iBAAiB;IACnB,EACF;GACF;EACF;EACA;GACE,MAAM;GACN,OAAO;GACP,KAAK,EACH,YAAY,wBAAwB,OAAO,EAC7C;EACF;EACA;GACE,MAAM;GACN,OAAO;GACP,KAAK,EACH,YAAY,wBAAwB,OAAO,EAC7C;EACF;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;AACF,CAAC;AACD,IAAM,mBAAmB,OAAO,MAAM,YAAY;AAUlD,IAAa,SAAS,MAAM,YACzB,EAAE,UAAU,SAAS,GAAG,SAAS,iBAAiB;CACjD,MAAM,YAAY,cAAe,UAAU,mBAAmB,cAAe,CAAC,OAAO,CAAC;CACtF,OACE,oBAAC,WAAD;EAAW,KAAK;EAAc,GAAI;EAC/B;CACQ,CAAA;AAEf,CACF"}
1
+ {"version":3,"file":"Button.js","names":[],"sources":["../../../components/Button/Button.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { ComponentProps } from 'react';\n\nimport { CSS, keyframes, styled, VariantProps } from '../../stitches.config';\n\nexport const BUTTON_BASE_STYLES = {\n appearance: 'none',\n userSelect: 'none',\n boxSizing: 'border-box',\n border: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.5,\n },\n};\n\nconst BG_SIZES = {\n small: '$sizes$8',\n medium: '$sizes$9',\n large: '$sizes$10',\n};\n\nconst backgroundSizeAnimation = (size: keyof typeof BG_SIZES) => ({\n $$bgSize: BG_SIZES[size],\n backgroundSize: '$$bgSize',\n backgroundImage: `linear-gradient(\n -45deg,\n transparent 33%,\n $colors$deepBlue4 33%,\n $colors$deepBlue4 66%,\n transparent 66%\n )`,\n animation: `${keyframes({\n '100%': { transform: 'translateX($$bgSize)' },\n })} 500ms linear infinite`,\n});\n\nexport const StyledButton = styled('button', BUTTON_BASE_STYLES, {\n // Reset\n all: 'unset',\n alignItems: 'center',\n overflow: 'hidden',\n\n '&::before': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n '&::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n },\n\n // Custom reset?\n display: 'inline-flex',\n flexShrink: 0,\n justifyContent: 'center',\n lineHeight: '1',\n\n // Custom\n position: 'relative',\n height: '$5',\n px: '$2',\n fontFamily: '$rubik',\n fontSize: '$3',\n fontWeight: '$medium',\n fontVariantNumeric: 'tabular-nums',\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$focusOutline`,\n '&::before': {\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n },\n '&::after': {\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n '&::before': {\n backgroundColor: 'rgba(255, 255, 255, 0.15)',\n },\n '&::after': {\n opacity: 0.05,\n },\n },\n },\n\n '&:active': {\n '&::before': {\n backgroundColor: 'rgba(0, 0, 0, 0.15)',\n },\n },\n\n variants: {\n size: {\n small: {\n borderRadius: '$button',\n height: '$5',\n px: '$2',\n fontSize: '$1',\n lineHeight: '$sizes$5',\n },\n medium: {\n borderRadius: '$button',\n height: '$6',\n px: '$3',\n fontSize: '$3',\n lineHeight: '$sizes$6',\n },\n large: {\n borderRadius: '$button',\n height: '$7',\n px: '$3',\n fontSize: '$3',\n lineHeight: '$sizes$7',\n },\n },\n variant: {\n primary: {\n bc: '$buttonPrimaryBg',\n c: '$buttonPrimaryText',\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonPrimaryFocusBorder',\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$buttonPrimaryBg',\n },\n },\n },\n },\n secondary: {\n bc: '$buttonSecondaryBg',\n c: '$buttonSecondaryText',\n boxShadow: 'inset 0 0 0 2px $colors$buttonSecondaryBorder',\n '&:active': {\n boxShadow: 'inset 0 0 0 1px $colors$buttonSecondaryBorder',\n },\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonSecondaryFocusBorder',\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$buttonPrimaryBg',\n },\n },\n },\n },\n red: {\n backgroundColor: '$buttonRedBg',\n color: '$buttonRedText',\n '&:focus-visible': {\n boxShadow: 'inset 0 0 0 2px $colors$buttonRedFocusBg',\n },\n },\n },\n state: {\n active: {\n bc: '$deepBlue5',\n c: '$deepBlue11',\n '&:active': {\n backgroundColor: '$deepBlue5',\n },\n },\n waiting: {\n bc: '$deepBlue3',\n boxShadow: `inset 0 0 0 1px $deepBlue4`,\n c: 'transparent',\n overflow: 'hidden',\n pointerEvents: 'none',\n '&::after': {\n left: '-100%',\n width: '200%',\n ...backgroundSizeAnimation('medium'),\n },\n },\n },\n ghost: {\n true: {\n boxShadow: 'none',\n '@hover': {\n '&:hover': {\n boxShadow: 'none',\n },\n },\n },\n },\n rounded: {\n true: {\n borderRadius: '$pill',\n },\n },\n },\n compoundVariants: [\n {\n variant: 'primary',\n ghost: 'true',\n css: {\n color: '$buttonPrimaryBg',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n color: '$buttonPrimaryGhostHoverText',\n backgroundColor: 'transparent',\n },\n },\n },\n },\n {\n variant: 'primary',\n state: 'active',\n css: {\n backgroundColor: '$buttonPrimaryFocusBg',\n color: '$buttonPrimaryText',\n boxShadow: 'inset 0 0 0 2px white',\n },\n },\n {\n variant: 'secondary',\n state: 'waiting',\n css: {\n backgroundColor: '$deepBlue3',\n color: 'transparent',\n },\n },\n {\n variant: 'secondary',\n ghost: true,\n css: {\n backgroundColor: 'transparent',\n color: '$buttonSecondaryText',\n boxShadow: 'none',\n },\n },\n {\n variant: 'red',\n state: 'waiting',\n css: {\n backgroundColor: '$deepBlue3',\n color: 'transparent',\n },\n },\n {\n variant: 'red',\n state: 'active',\n css: {\n backgroundColor: '$buttonRedFocusBg',\n color: '$buttonRedText',\n boxShadow: 'inset 0 0 0 2px white',\n },\n },\n {\n variant: 'red',\n ghost: 'true',\n css: {\n color: '$buttonRedBg',\n backgroundColor: 'transparent',\n '@hover': {\n '&:hover': {\n color: '$buttonRedHoverText',\n backgroundColor: 'transparent',\n },\n },\n },\n },\n {\n size: 'small',\n state: 'waiting',\n css: {\n '&::after': backgroundSizeAnimation('small'),\n },\n },\n {\n size: 'large',\n state: 'waiting',\n css: {\n '&::after': backgroundSizeAnimation('large'),\n },\n },\n ],\n defaultVariants: {\n size: 'medium',\n variant: 'primary',\n },\n});\nconst StyledButtonSlot = styled(Slot, StyledButton);\n\nexport interface ButtonVariants extends VariantProps<typeof StyledButton> {}\nexport type ButtonProps = ComponentProps<typeof StyledButton> &\n ButtonVariants & {\n css?: CSS;\n asChild?: boolean;\n as?: string;\n };\n\nexport const Button = React.forwardRef<React.ElementRef<typeof StyledButton>, ButtonProps>(\n ({ children, asChild, ...props }, forwardedRef) => {\n const Component = asChild ? StyledButtonSlot : StyledButton;\n return (\n <Component ref={forwardedRef} {...props}>\n {children}\n </Component>\n );\n },\n);\n"],"mappings":";;;;;AAKA,IAAa,qBAAqB;CAChC,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,QAAQ;CACR,yBAAyB;CACzB,cAAc;EACZ,eAAe;EACf,SAAS;CACX;AACF;AAEA,IAAM,WAAW;CACf,OAAO;CACP,QAAQ;CACR,OAAO;AACT;AAEA,IAAM,2BAA2B,UAAiC;CAChE,UAAU,SAAS;CACnB,gBAAgB;CAChB,iBAAiB;;;;;;;CAOjB,WAAW,GAAG,UAAU,EACtB,QAAQ,EAAE,WAAW,uBAAuB,EAC9C,CAAC,EAAE;AACL;AAEA,IAAa,eAAe,OAAO,UAAU,oBAAoB;CAE/D,KAAK;CACL,YAAY;CACZ,UAAU;CAEV,aAAa;EACX,WAAW;EACX,SAAS;EACT,UAAU;EACV,OAAO;CACT;CACA,YAAY;EACV,WAAW;EACX,SAAS;EACT,UAAU;EACV,OAAO;CACT;CAGA,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CAGZ,UAAU;CACV,QAAQ;CACR,IAAI;CACJ,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,oBAAoB;CAEpB,mBAAmB;EACjB,WAAW;EACX,aAAa,EACX,iBAAiB,4BACnB;EACA,YAAY,EACV,SAAS,IACX;CACF;CAEA,UAAU,EACR,WAAW;EACT,QAAQ;EACR,aAAa,EACX,iBAAiB,4BACnB;EACA,YAAY,EACV,SAAS,IACX;CACF,EACF;CAEA,YAAY,EACV,aAAa,EACX,iBAAiB,sBACnB,EACF;CAEA,UAAU;EACR,MAAM;GACJ,OAAO;IACL,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,UAAU;IACV,YAAY;GACd;GACA,QAAQ;IACN,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,UAAU;IACV,YAAY;GACd;GACA,OAAO;IACL,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,UAAU;IACV,YAAY;GACd;EACF;EACA,SAAS;GACP,SAAS;IACP,IAAI;IACJ,GAAG;IACH,mBAAmB,EACjB,WAAW,mDACb;IACA,UAAU,EACR,WAAW,EACT,YAAY,EACV,iBAAiB,mBACnB,EACF,EACF;GACF;GACA,WAAW;IACT,IAAI;IACJ,GAAG;IACH,WAAW;IACX,YAAY,EACV,WAAW,gDACb;IACA,mBAAmB,EACjB,WAAW,qDACb;IACA,UAAU,EACR,WAAW,EACT,YAAY,EACV,iBAAiB,mBACnB,EACF,EACF;GACF;GACA,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,mBAAmB,EACjB,WAAW,2CACb;GACF;EACF;EACA,OAAO;GACL,QAAQ;IACN,IAAI;IACJ,GAAG;IACH,YAAY,EACV,iBAAiB,aACnB;GACF;GACA,SAAS;IACP,IAAI;IACJ,WAAW;IACX,GAAG;IACH,UAAU;IACV,eAAe;IACf,YAAY;KACV,MAAM;KACN,OAAO;KACP,GAAG,wBAAwB,QAAQ;IACrC;GACF;EACF;EACA,OAAO,EACL,MAAM;GACJ,WAAW;GACX,UAAU,EACR,WAAW,EACT,WAAW,OACb,EACF;EACF,EACF;EACA,SAAS,EACP,MAAM,EACJ,cAAc,QAChB,EACF;CACF;CACA,kBAAkB;EAChB;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,OAAO;IACP,iBAAiB;IACjB,UAAU,EACR,WAAW;KACT,OAAO;KACP,iBAAiB;IACnB,EACF;GACF;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;GACT;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;GACT;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,iBAAiB;IACjB,OAAO;IACP,WAAW;GACb;EACF;EACA;GACE,SAAS;GACT,OAAO;GACP,KAAK;IACH,OAAO;IACP,iBAAiB;IACjB,UAAU,EACR,WAAW;KACT,OAAO;KACP,iBAAiB;IACnB,EACF;GACF;EACF;EACA;GACE,MAAM;GACN,OAAO;GACP,KAAK,EACH,YAAY,wBAAwB,OAAO,EAC7C;EACF;EACA;GACE,MAAM;GACN,OAAO;GACP,KAAK,EACH,YAAY,wBAAwB,OAAO,EAC7C;EACF;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;AACF,CAAC;AACD,IAAM,mBAAmB,OAAO,MAAM,YAAY;AAUlD,IAAa,SAAS,MAAM,YACzB,EAAE,UAAU,SAAS,GAAG,SAAS,iBAAiB;CAEjD,OACE,oBAFgB,UAAU,mBAAmB,cAE7C;EAAW,KAAK;EAAc,GAAI;EAC/B;CACQ,CAAA;AAEf,CACF"}
@@ -1,5 +1,6 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_stitches_config = require("../../stitches.config.cjs");
3
+ const require_FieldContext = require("../Field/FieldContext.cjs");
3
4
  let _radix_ui_react_icons = require("@radix-ui/react-icons");
4
5
  let react = require("react");
5
6
  react = require_runtime.__toESM(react, 1);
@@ -46,6 +47,7 @@ var StyledCheckbox = require_stitches_config.styled(_radix_ui_react_checkbox.Roo
46
47
  boxShadow: "inset 0 0 0 1px $colors$checkboxHoverBorder"
47
48
  } }
48
49
  },
50
+ "&[aria-invalid=\"true\"][data-state=unchecked]:not(:focus)": { boxShadow: "inset 0 0 0 1px $colors$checkboxInvalidBorder" },
49
51
  "&:focus": {
50
52
  outline: "none",
51
53
  boxShadow: "inset 0 0 0 1px $colors$checkboxFocusBorder"
@@ -71,13 +73,24 @@ var StyledCheckbox = require_stitches_config.styled(_radix_ui_react_checkbox.Roo
71
73
  } },
72
74
  defaultVariants: { size: "medium" }
73
75
  });
74
- var Checkbox = react.default.forwardRef((props, forwardedRef) => {
76
+ var Checkbox = react.default.forwardRef(({ id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
77
+ const control = require_FieldContext.useFieldControl({
78
+ id,
79
+ disabled,
80
+ "aria-describedby": ariaDescribedBy,
81
+ "aria-invalid": ariaInvalid
82
+ });
75
83
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledCheckbox, {
76
84
  ...props,
85
+ id: control.id,
86
+ disabled: control.disabled,
87
+ "aria-describedby": control["aria-describedby"],
88
+ "aria-invalid": control["aria-invalid"],
77
89
  ref: forwardedRef,
78
90
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.CheckIcon, {
79
91
  height: 40,
80
- width: 40
92
+ width: 40,
93
+ "aria-hidden": true
81
94
  }) })
82
95
  });
83
96
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.cjs","names":["styled","CheckboxPrimitive","React","CheckIcon"],"sources":["../../../components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\n\nconst StyledIndicator = styled(CheckboxPrimitive.Indicator, {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n});\n\nconst StyledCheckbox = styled(CheckboxPrimitive.Root, {\n all: 'unset',\n border: 'none',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n\n alignItems: 'center',\n appearance: 'none',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n padding: '0',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n overflow: 'hidden',\n\n '&[data-state=checked]': {\n backgroundColor: '$checkboxCheckedBg',\n boxShadow: 'inset 0 0 0 1px transparent',\n color: '$checkboxCheckedIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxCheckedHoverBg',\n },\n },\n },\n\n '&[data-state=unchecked]': {\n backgroundColor: '$checkboxBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxBorder',\n color: '$checkboxIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxHoverBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxHoverBorder',\n },\n },\n },\n\n '&:focus': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n backgroundColor: '$checkboxDisabledBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxDisabledBorder',\n '&::placeholder': {\n color: '$checkboxDisabledText',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$checkboxIndicatorDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n medium: {\n width: 18,\n height: 18,\n borderRadius: '$2',\n },\n large: {\n width: '$5',\n height: '$5',\n borderRadius: '$3',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\ntype CheckboxPrimitiveProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'as'>;\nexport type CheckboxVariants = VariantProps<typeof StyledCheckbox>;\nexport type CheckboxProps = CheckboxPrimitiveProps & CheckboxVariants & { css?: CSS };\n\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof StyledCheckbox>, CheckboxProps>(\n (props, forwardedRef) => {\n return (\n <StyledCheckbox {...props} ref={forwardedRef}>\n <StyledIndicator>\n <CheckIcon height={40} width={40} />\n </StyledIndicator>\n </StyledCheckbox>\n );\n }\n);\n"],"mappings":";;;;;;;;;AAMA,IAAM,kBAAkBA,wBAAAA,OAAOC,yBAAkB,WAAW;CAC1D,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT,CAAC;AAED,IAAM,iBAAiBD,wBAAAA,OAAOC,yBAAkB,MAAM;CACpD,KAAK;CACL,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAEA,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,SAAS;CACT,yBAAyB;CACzB,UAAU;CAEV,yBAAyB;EACvB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW,EACT,iBAAiB,0BACnB,EACF;CACF;CAEA,2BAA2B;EACzB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW;GACT,iBAAiB;GACjB,WAAW;EACb,EACF;CACF;CAEA,WAAW;EACT,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,kBAAkB,EAChB,OAAO,wBACT;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,+BACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,QAAQ;GACN,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;CACF,EACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAMD,IAAa,WAAWC,MAAAA,QAAM,YAC3B,OAAO,iBAAiB;CACvB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD;EAAgB,GAAI;EAAO,KAAK;EAC9B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;GAAW,QAAQ;GAAI,OAAO;EAAK,CAAA,EACpB,CAAA;CACH,CAAA;AAEpB,CACF"}
1
+ {"version":3,"file":"Checkbox.cjs","names":["styled","CheckboxPrimitive","React","useFieldControl","CheckIcon"],"sources":["../../../components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { useFieldControl } from '../Field/FieldContext';\n\nconst StyledIndicator = styled(CheckboxPrimitive.Indicator, {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n});\n\nconst StyledCheckbox = styled(CheckboxPrimitive.Root, {\n all: 'unset',\n border: 'none',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n\n alignItems: 'center',\n appearance: 'none',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n padding: '0',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n overflow: 'hidden',\n\n '&[data-state=checked]': {\n backgroundColor: '$checkboxCheckedBg',\n boxShadow: 'inset 0 0 0 1px transparent',\n color: '$checkboxCheckedIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxCheckedHoverBg',\n },\n },\n },\n\n '&[data-state=unchecked]': {\n backgroundColor: '$checkboxBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxBorder',\n color: '$checkboxIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxHoverBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxHoverBorder',\n },\n },\n },\n\n '&[aria-invalid=\"true\"][data-state=unchecked]:not(:focus)': {\n boxShadow: 'inset 0 0 0 1px $colors$checkboxInvalidBorder',\n },\n\n '&:focus': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n backgroundColor: '$checkboxDisabledBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxDisabledBorder',\n '&::placeholder': {\n color: '$checkboxDisabledText',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$checkboxIndicatorDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n medium: {\n width: 18,\n height: 18,\n borderRadius: '$2',\n },\n large: {\n width: '$5',\n height: '$5',\n borderRadius: '$3',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\ntype CheckboxPrimitiveProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'as'>;\nexport type CheckboxVariants = VariantProps<typeof StyledCheckbox>;\nexport type CheckboxProps = CheckboxPrimitiveProps & CheckboxVariants & { css?: CSS };\n\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof StyledCheckbox>, CheckboxProps>(\n (\n { id, disabled, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...props },\n forwardedRef,\n ) => {\n const control = useFieldControl({\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n\n return (\n <StyledCheckbox\n {...props}\n id={control.id}\n disabled={control.disabled}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n ref={forwardedRef}\n >\n <StyledIndicator>\n <CheckIcon height={40} width={40} aria-hidden />\n </StyledIndicator>\n </StyledCheckbox>\n );\n },\n);\n"],"mappings":";;;;;;;;;;AAOA,IAAM,kBAAkBA,wBAAAA,OAAOC,yBAAkB,WAAW;CAC1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AU,QAAQ;EAClB,oBAAkB,QAAQ;EAC1B,gBAAc,QAAQ;EACtB,KAAK;EAEL,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;GAAW,QAAQ;GAAI,OAAO;GAAI,eAAA;EAAa,CAAA,EAChC,CAAA;CACH,CAAA;AAEpB,CACF"}
@@ -1,4 +1,5 @@
1
1
  import { styled } from "../../stitches.config.js";
2
+ import { useFieldControl } from "../Field/FieldContext.js";
2
3
  import { CheckIcon } from "@radix-ui/react-icons";
3
4
  import React from "react";
4
5
  import { jsx } from "react/jsx-runtime";
@@ -43,6 +44,7 @@ var StyledCheckbox = styled(CheckboxPrimitive.Root, {
43
44
  boxShadow: "inset 0 0 0 1px $colors$checkboxHoverBorder"
44
45
  } }
45
46
  },
47
+ "&[aria-invalid=\"true\"][data-state=unchecked]:not(:focus)": { boxShadow: "inset 0 0 0 1px $colors$checkboxInvalidBorder" },
46
48
  "&:focus": {
47
49
  outline: "none",
48
50
  boxShadow: "inset 0 0 0 1px $colors$checkboxFocusBorder"
@@ -68,13 +70,24 @@ var StyledCheckbox = styled(CheckboxPrimitive.Root, {
68
70
  } },
69
71
  defaultVariants: { size: "medium" }
70
72
  });
71
- var Checkbox = React.forwardRef((props, forwardedRef) => {
73
+ var Checkbox = React.forwardRef(({ id, disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
74
+ const control = useFieldControl({
75
+ id,
76
+ disabled,
77
+ "aria-describedby": ariaDescribedBy,
78
+ "aria-invalid": ariaInvalid
79
+ });
72
80
  return /* @__PURE__ */ jsx(StyledCheckbox, {
73
81
  ...props,
82
+ id: control.id,
83
+ disabled: control.disabled,
84
+ "aria-describedby": control["aria-describedby"],
85
+ "aria-invalid": control["aria-invalid"],
74
86
  ref: forwardedRef,
75
87
  children: /* @__PURE__ */ jsx(StyledIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {
76
88
  height: 40,
77
- width: 40
89
+ width: 40,
90
+ "aria-hidden": true
78
91
  }) })
79
92
  });
80
93
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":[],"sources":["../../../components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\n\nconst StyledIndicator = styled(CheckboxPrimitive.Indicator, {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n});\n\nconst StyledCheckbox = styled(CheckboxPrimitive.Root, {\n all: 'unset',\n border: 'none',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n\n alignItems: 'center',\n appearance: 'none',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n padding: '0',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n overflow: 'hidden',\n\n '&[data-state=checked]': {\n backgroundColor: '$checkboxCheckedBg',\n boxShadow: 'inset 0 0 0 1px transparent',\n color: '$checkboxCheckedIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxCheckedHoverBg',\n },\n },\n },\n\n '&[data-state=unchecked]': {\n backgroundColor: '$checkboxBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxBorder',\n color: '$checkboxIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxHoverBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxHoverBorder',\n },\n },\n },\n\n '&:focus': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n backgroundColor: '$checkboxDisabledBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxDisabledBorder',\n '&::placeholder': {\n color: '$checkboxDisabledText',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$checkboxIndicatorDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n medium: {\n width: 18,\n height: 18,\n borderRadius: '$2',\n },\n large: {\n width: '$5',\n height: '$5',\n borderRadius: '$3',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\ntype CheckboxPrimitiveProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'as'>;\nexport type CheckboxVariants = VariantProps<typeof StyledCheckbox>;\nexport type CheckboxProps = CheckboxPrimitiveProps & CheckboxVariants & { css?: CSS };\n\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof StyledCheckbox>, CheckboxProps>(\n (props, forwardedRef) => {\n return (\n <StyledCheckbox {...props} ref={forwardedRef}>\n <StyledIndicator>\n <CheckIcon height={40} width={40} />\n </StyledIndicator>\n </StyledCheckbox>\n );\n }\n);\n"],"mappings":";;;;;;AAMA,IAAM,kBAAkB,OAAO,kBAAkB,WAAW;CAC1D,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT,CAAC;AAED,IAAM,iBAAiB,OAAO,kBAAkB,MAAM;CACpD,KAAK;CACL,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAEA,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,SAAS;CACT,yBAAyB;CACzB,UAAU;CAEV,yBAAyB;EACvB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW,EACT,iBAAiB,0BACnB,EACF;CACF;CAEA,2BAA2B;EACzB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW;GACT,iBAAiB;GACjB,WAAW;EACb,EACF;CACF;CAEA,WAAW;EACT,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,kBAAkB,EAChB,OAAO,wBACT;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,+BACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,QAAQ;GACN,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;CACF,EACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAMD,IAAa,WAAW,MAAM,YAC3B,OAAO,iBAAiB;CACvB,OACE,oBAAC,gBAAD;EAAgB,GAAI;EAAO,KAAK;EAC9B,UAAA,oBAAC,iBAAD,EAAA,UACE,oBAAC,WAAD;GAAW,QAAQ;GAAI,OAAO;EAAK,CAAA,EACpB,CAAA;CACH,CAAA;AAEpB,CACF"}
1
+ {"version":3,"file":"Checkbox.js","names":[],"sources":["../../../components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { useFieldControl } from '../Field/FieldContext';\n\nconst StyledIndicator = styled(CheckboxPrimitive.Indicator, {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n});\n\nconst StyledCheckbox = styled(CheckboxPrimitive.Root, {\n all: 'unset',\n border: 'none',\n boxSizing: 'border-box',\n userSelect: 'none',\n '&::before': {\n boxSizing: 'border-box',\n },\n '&::after': {\n boxSizing: 'border-box',\n },\n\n alignItems: 'center',\n appearance: 'none',\n display: 'inline-flex',\n justifyContent: 'center',\n lineHeight: '1',\n margin: '0',\n outline: 'none',\n padding: '0',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n overflow: 'hidden',\n\n '&[data-state=checked]': {\n backgroundColor: '$checkboxCheckedBg',\n boxShadow: 'inset 0 0 0 1px transparent',\n color: '$checkboxCheckedIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxCheckedHoverBg',\n },\n },\n },\n\n '&[data-state=unchecked]': {\n backgroundColor: '$checkboxBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxBorder',\n color: '$checkboxIcon',\n\n '@hover': {\n '&:hover': {\n backgroundColor: '$checkboxHoverBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxHoverBorder',\n },\n },\n },\n\n '&[aria-invalid=\"true\"][data-state=unchecked]:not(:focus)': {\n boxShadow: 'inset 0 0 0 1px $colors$checkboxInvalidBorder',\n },\n\n '&:focus': {\n outline: 'none',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxFocusBorder',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n backgroundColor: '$checkboxDisabledBg',\n boxShadow: 'inset 0 0 0 1px $colors$checkboxDisabledBorder',\n '&::placeholder': {\n color: '$checkboxDisabledText',\n },\n\n [`& ${StyledIndicator}`]: {\n '&::after': {\n backgroundColor: '$checkboxIndicatorDisabledBg',\n },\n },\n },\n\n variants: {\n size: {\n medium: {\n width: 18,\n height: 18,\n borderRadius: '$2',\n },\n large: {\n width: '$5',\n height: '$5',\n borderRadius: '$3',\n },\n },\n },\n defaultVariants: {\n size: 'medium',\n },\n});\n\ntype CheckboxPrimitiveProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'as'>;\nexport type CheckboxVariants = VariantProps<typeof StyledCheckbox>;\nexport type CheckboxProps = CheckboxPrimitiveProps & CheckboxVariants & { css?: CSS };\n\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof StyledCheckbox>, CheckboxProps>(\n (\n { id, disabled, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...props },\n forwardedRef,\n ) => {\n const control = useFieldControl({\n id,\n disabled,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n\n return (\n <StyledCheckbox\n {...props}\n id={control.id}\n disabled={control.disabled}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n ref={forwardedRef}\n >\n <StyledIndicator>\n <CheckIcon height={40} width={40} aria-hidden />\n </StyledIndicator>\n </StyledCheckbox>\n );\n },\n);\n"],"mappings":";;;;;;;AAOA,IAAM,kBAAkB,OAAO,kBAAkB,WAAW;CAC1D,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT,CAAC;AAED,IAAM,iBAAiB,OAAO,kBAAkB,MAAM;CACpD,KAAK;CACL,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,aAAa,EACX,WAAW,aACb;CACA,YAAY,EACV,WAAW,aACb;CAEA,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,SAAS;CACT,yBAAyB;CACzB,UAAU;CAEV,yBAAyB;EACvB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW,EACT,iBAAiB,0BACnB,EACF;CACF;CAEA,2BAA2B;EACzB,iBAAiB;EACjB,WAAW;EACX,OAAO;EAEP,UAAU,EACR,WAAW;GACT,iBAAiB;GACjB,WAAW;EACb,EACF;CACF;CAEA,8DAA4D,EAC1D,WAAW,gDACb;CAEA,WAAW;EACT,SAAS;EACT,WAAW;CACb;CAEA,cAAc;EACZ,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,kBAAkB,EAChB,OAAO,wBACT;GAEC,KAAK,oBAAoB,EACxB,YAAY,EACV,iBAAiB,+BACnB,EACF;CACF;CAEA,UAAU,EACR,MAAM;EACJ,QAAQ;GACN,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,cAAc;EAChB;CACF,EACF;CACA,iBAAiB,EACf,MAAM,SACR;AACF,CAAC;AAMD,IAAa,WAAW,MAAM,YAE1B,EAAE,IAAI,UAAU,oBAAoB,iBAAiB,gBAAgB,aAAa,GAAG,SACrF,iBACG;CACH,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CAED,OACE,oBAAC,gBAAD;EACE,GAAI;EACJ,IAAI,QAAQ;EACZ,UAAU,QAAQ;EAClB,oBAAkB,QAAQ;EAC1B,gBAAc,QAAQ;EACtB,KAAK;EAEL,UAAA,oBAAC,iBAAD,EAAA,UACE,oBAAC,WAAD;GAAW,QAAQ;GAAI,OAAO;GAAI,eAAA;EAAa,CAAA,EAChC,CAAA;CACH,CAAA;AAEpB,CACF"}
@@ -16,7 +16,8 @@ var Theme;
16
16
  checkboxFocusBorder: "$primary",
17
17
  checkboxDisabledBg: "$deepBlue3",
18
18
  checkboxDisabledBorder: "$deepBlue5",
19
- checkboxIndicatorDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString()
19
+ checkboxIndicatorDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString(),
20
+ checkboxInvalidBorder: "$red9"
20
21
  });
21
22
  _Theme.getDark = (primaryColor) => ({
22
23
  checkboxIcon: "$deepBlue1",
@@ -30,7 +31,8 @@ var Theme;
30
31
  checkboxFocusBorder: "$primary",
31
32
  checkboxDisabledBg: (0, tinycolor2.default)(primaryColor.value).setAlpha(.6).toHslString(),
32
33
  checkboxDisabledBorder: "transparent",
33
- checkboxIndicatorDisabledBg: "$deepBlue1"
34
+ checkboxIndicatorDisabledBg: "$deepBlue1",
35
+ checkboxInvalidBorder: "$red9"
34
36
  });
35
37
  })(Theme || (Theme = {}));
36
38
  Object.defineProperty(exports, "Theme", {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.themes.cjs","names":["tinycolor"],"sources":["../../../components/Checkbox/Checkbox.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n checkboxIcon: Property.Color;\n checkboxBg: Property.Color;\n checkboxCheckedBg: Property.Color;\n checkboxBorder: Property.Color;\n checkboxCheckedIcon: Property.Color;\n checkboxCheckedHoverBg: Property.Color;\n checkboxHoverBg: Property.Color;\n checkboxHoverBorder: Property.Color;\n checkboxFocusBorder: Property.Color;\n checkboxDisabledBg: Property.Color;\n checkboxDisabledBorder: Property.Color;\n checkboxIndicatorDisabledBg: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue11',\n checkboxBg: 'transparent',\n checkboxBorder: '$slate8',\n checkboxCheckedBg: '$primary',\n checkboxCheckedIcon: 'white',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).darken().toHslString(),\n checkboxHoverBg: 'transparent',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: '$deepBlue3',\n checkboxDisabledBorder: '$deepBlue5',\n checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n });\n\n export const getDark: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue1',\n checkboxBg: 'transparent',\n checkboxCheckedBg: '$primary',\n checkboxBorder: '$slate9',\n checkboxCheckedIcon: '$deepBlue1',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).lighten(10).toHslString(),\n checkboxHoverBg: '$deepBlue3',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxDisabledBorder: 'transparent',\n checkboxIndicatorDisabledBg: '$deepBlue1',\n });\n}\n"],"mappings":";;;;AAKO,IAAU;CAAV,SAAA,QAAA;CAkBQ,OAAA,YAAqB,kBAAkB;EAClD,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,yBAAA,GAAwBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;EAC3E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;EACpB,wBAAwB;EACxB,8BAAA,GAA6BA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;CACvF;CAEa,OAAA,WAAoB,kBAAkB;EACjD,cAAc;EACd,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,yBAAA,GAAwBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY;EAC9E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,qBAAA,GAAoBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC5E,wBAAwB;EACxB,6BAA6B;CAC/B;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
1
+ {"version":3,"file":"Checkbox.themes.cjs","names":["tinycolor"],"sources":["../../../components/Checkbox/Checkbox.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n checkboxIcon: Property.Color;\n checkboxBg: Property.Color;\n checkboxCheckedBg: Property.Color;\n checkboxBorder: Property.Color;\n checkboxCheckedIcon: Property.Color;\n checkboxCheckedHoverBg: Property.Color;\n checkboxHoverBg: Property.Color;\n checkboxHoverBorder: Property.Color;\n checkboxFocusBorder: Property.Color;\n checkboxDisabledBg: Property.Color;\n checkboxDisabledBorder: Property.Color;\n checkboxIndicatorDisabledBg: Property.Color;\n checkboxInvalidBorder: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue11',\n checkboxBg: 'transparent',\n checkboxBorder: '$slate8',\n checkboxCheckedBg: '$primary',\n checkboxCheckedIcon: 'white',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).darken().toHslString(),\n checkboxHoverBg: 'transparent',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: '$deepBlue3',\n checkboxDisabledBorder: '$deepBlue5',\n checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxInvalidBorder: '$red9',\n });\n\n export const getDark: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue1',\n checkboxBg: 'transparent',\n checkboxCheckedBg: '$primary',\n checkboxBorder: '$slate9',\n checkboxCheckedIcon: '$deepBlue1',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).lighten(10).toHslString(),\n checkboxHoverBg: '$deepBlue3',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxDisabledBorder: 'transparent',\n checkboxIndicatorDisabledBg: '$deepBlue1',\n checkboxInvalidBorder: '$red9',\n });\n}\n"],"mappings":";;;;AAKO,IAAU;CAAV,SAAA,QAAA;CAmBQ,OAAA,YAAqB,kBAAkB;EAClD,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,yBAAA,GAAwBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;EAC3E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;EACpB,wBAAwB;EACxB,8BAAA,GAA6BA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EACrF,uBAAuB;CACzB;CAEa,OAAA,WAAoB,kBAAkB;EACjD,cAAc;EACd,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,yBAAA,GAAwBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY;EAC9E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,qBAAA,GAAoBA,WAAAA,QAAAA,CAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC5E,wBAAwB;EACxB,6BAA6B;EAC7B,uBAAuB;CACzB;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
@@ -14,7 +14,8 @@ var Theme;
14
14
  checkboxFocusBorder: "$primary",
15
15
  checkboxDisabledBg: "$deepBlue3",
16
16
  checkboxDisabledBorder: "$deepBlue5",
17
- checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString()
17
+ checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString(),
18
+ checkboxInvalidBorder: "$red9"
18
19
  });
19
20
  _Theme.getDark = (primaryColor) => ({
20
21
  checkboxIcon: "$deepBlue1",
@@ -28,7 +29,8 @@ var Theme;
28
29
  checkboxFocusBorder: "$primary",
29
30
  checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(.6).toHslString(),
30
31
  checkboxDisabledBorder: "transparent",
31
- checkboxIndicatorDisabledBg: "$deepBlue1"
32
+ checkboxIndicatorDisabledBg: "$deepBlue1",
33
+ checkboxInvalidBorder: "$red9"
32
34
  });
33
35
  })(Theme || (Theme = {}));
34
36
  export { Theme };
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.themes.js","names":[],"sources":["../../../components/Checkbox/Checkbox.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n checkboxIcon: Property.Color;\n checkboxBg: Property.Color;\n checkboxCheckedBg: Property.Color;\n checkboxBorder: Property.Color;\n checkboxCheckedIcon: Property.Color;\n checkboxCheckedHoverBg: Property.Color;\n checkboxHoverBg: Property.Color;\n checkboxHoverBorder: Property.Color;\n checkboxFocusBorder: Property.Color;\n checkboxDisabledBg: Property.Color;\n checkboxDisabledBorder: Property.Color;\n checkboxIndicatorDisabledBg: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue11',\n checkboxBg: 'transparent',\n checkboxBorder: '$slate8',\n checkboxCheckedBg: '$primary',\n checkboxCheckedIcon: 'white',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).darken().toHslString(),\n checkboxHoverBg: 'transparent',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: '$deepBlue3',\n checkboxDisabledBorder: '$deepBlue5',\n checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n });\n\n export const getDark: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue1',\n checkboxBg: 'transparent',\n checkboxCheckedBg: '$primary',\n checkboxBorder: '$slate9',\n checkboxCheckedIcon: '$deepBlue1',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).lighten(10).toHslString(),\n checkboxHoverBg: '$deepBlue3',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxDisabledBorder: 'transparent',\n checkboxIndicatorDisabledBg: '$deepBlue1',\n });\n}\n"],"mappings":";;AAKO,IAAU;CAAV,SAAA,QAAA;CAkBQ,OAAA,YAAqB,kBAAkB;EAClD,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,wBAAwB,UAAU,aAAa,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;EAC3E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;EACpB,wBAAwB;EACxB,6BAA6B,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;CACvF;CAEa,OAAA,WAAoB,kBAAkB;EACjD,cAAc;EACd,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,wBAAwB,UAAU,aAAa,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY;EAC9E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC5E,wBAAwB;EACxB,6BAA6B;CAC/B;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
1
+ {"version":3,"file":"Checkbox.themes.js","names":[],"sources":["../../../components/Checkbox/Checkbox.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n checkboxIcon: Property.Color;\n checkboxBg: Property.Color;\n checkboxCheckedBg: Property.Color;\n checkboxBorder: Property.Color;\n checkboxCheckedIcon: Property.Color;\n checkboxCheckedHoverBg: Property.Color;\n checkboxHoverBg: Property.Color;\n checkboxHoverBorder: Property.Color;\n checkboxFocusBorder: Property.Color;\n checkboxDisabledBg: Property.Color;\n checkboxDisabledBorder: Property.Color;\n checkboxIndicatorDisabledBg: Property.Color;\n checkboxInvalidBorder: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue11',\n checkboxBg: 'transparent',\n checkboxBorder: '$slate8',\n checkboxCheckedBg: '$primary',\n checkboxCheckedIcon: 'white',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).darken().toHslString(),\n checkboxHoverBg: 'transparent',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: '$deepBlue3',\n checkboxDisabledBorder: '$deepBlue5',\n checkboxIndicatorDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxInvalidBorder: '$red9',\n });\n\n export const getDark: Factory = (primaryColor) => ({\n checkboxIcon: '$deepBlue1',\n checkboxBg: 'transparent',\n checkboxCheckedBg: '$primary',\n checkboxBorder: '$slate9',\n checkboxCheckedIcon: '$deepBlue1',\n checkboxCheckedHoverBg: tinycolor(primaryColor.value).lighten(10).toHslString(),\n checkboxHoverBg: '$deepBlue3',\n checkboxHoverBorder: '$primary',\n checkboxFocusBorder: '$primary',\n checkboxDisabledBg: tinycolor(primaryColor.value).setAlpha(0.6).toHslString(),\n checkboxDisabledBorder: 'transparent',\n checkboxIndicatorDisabledBg: '$deepBlue1',\n checkboxInvalidBorder: '$red9',\n });\n}\n"],"mappings":";;AAKO,IAAU;CAAV,SAAA,QAAA;CAmBQ,OAAA,YAAqB,kBAAkB;EAClD,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,wBAAwB,UAAU,aAAa,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY;EAC3E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;EACpB,wBAAwB;EACxB,6BAA6B,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EACrF,uBAAuB;CACzB;CAEa,OAAA,WAAoB,kBAAkB;EACjD,cAAc;EACd,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;EAChB,qBAAqB;EACrB,wBAAwB,UAAU,aAAa,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY;EAC9E,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC5E,wBAAwB;EACxB,6BAA6B;EAC7B,uBAAuB;CACzB;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
@@ -2,6 +2,7 @@ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  const require_AccessibleIcon = require("../AccessibleIcon/AccessibleIcon.cjs");
3
3
  const require_stitches_config = require("../../stitches.config.cjs");
4
4
  const require_Box = require("../Box/Box.cjs");
5
+ const require_useIsomorphicLayoutEffect = require("../../utils/useIsomorphicLayoutEffect.cjs");
5
6
  const require_Button = require("../Button/Button.cjs");
6
7
  const require_colorSchemeContext = require("../colorSchemeContext.cjs");
7
8
  require("./prism-extend.cjs");
@@ -57,7 +58,7 @@ var CodeBlock = (0, react.forwardRef)(({ lang = "text", code, copyable = false,
57
58
  if (typeof ref === "function") ref(node);
58
59
  else if (ref) ref.current = node;
59
60
  }, [ref]);
60
- (0, react.useLayoutEffect)(() => {
61
+ require_useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
61
62
  if (!copyable) return;
62
63
  const pre = preRef.current;
63
64
  const wrapper = buttonWrapperRef.current;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.cjs","names":["styled","forwardRef","useColorScheme","themes","useState","useRef","useCallback","Button","AccessibleIcon","CheckIcon","CopyIcon","Highlight","Prism","Box"],"sources":["../../../components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import { CheckIcon, CopyIcon } from '@radix-ui/react-icons';\nimport { Highlight, Language, themes } from 'prism-react-renderer';\nimport React, {\n ComponentProps,\n forwardRef,\n useCallback,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { CSS, styled } from '../../stitches.config';\nimport { AccessibleIcon } from '../AccessibleIcon';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { useColorScheme } from '../colorSchemeContext';\nimport type {\n CodeBlockCopyButtonAlign,\n CodeBlockCopyErrorHandler,\n CodeBlockLanguage,\n} from './index';\nimport { Prism } from './prism-extend';\n\nconst Pre = styled('pre', {\n m: 0,\n borderRadius: '$2',\n overflow: 'auto',\n border: '1px solid $colors$deepBlue3',\n fontSize: '$2',\n lineHeight: 1.6,\n\n variants: {\n noBorder: {\n true: { border: 'none' },\n },\n },\n});\n\nconst CopyButtonWrapper = styled('div', {\n position: 'absolute',\n zIndex: 1,\n variants: {\n position: {\n top: { top: '$2', right: '$3' },\n topLeft: { top: '$2', left: '$3' },\n bottomRight: { bottom: '$2', right: '$3' },\n bottomLeft: { bottom: '$2', left: '$3' },\n },\n },\n\n defaultVariants: {\n position: 'top',\n },\n});\n\nexport type CodeBlockProps = {\n lang?: CodeBlockLanguage;\n code: string;\n copyable?: boolean;\n copyText?: string;\n copiedText?: string;\n copyButtonAlign?: CodeBlockCopyButtonAlign;\n onCopy?: () => void;\n onCopyError?: CodeBlockCopyErrorHandler;\n noBorder?: boolean;\n wrapText?: boolean;\n colorScheme?: 'light' | 'dark';\n maxHeight?: number | string;\n css?: CSS;\n} & Omit<ComponentProps<typeof Pre>, 'css'>;\n\nexport const CodeBlock = forwardRef<HTMLPreElement, CodeBlockProps>(\n (\n {\n lang = 'text',\n code,\n copyable = false,\n copyText,\n copiedText,\n copyButtonAlign = 'top right',\n onCopy,\n onCopyError,\n noBorder,\n wrapText = false,\n colorScheme,\n maxHeight = 424,\n css,\n style,\n className,\n ...props\n },\n ref,\n ) => {\n const systemScheme = useColorScheme();\n const resolvedScheme = colorScheme ?? systemScheme;\n const prismTheme = resolvedScheme === 'dark' ? themes.nightOwl : themes.nightOwlLight;\n\n const isBottom = copyButtonAlign.includes('bottom');\n const isLeft = copyButtonAlign.includes('left');\n const buttonPosition = isBottom\n ? isLeft\n ? 'bottomLeft'\n : 'bottomRight'\n : isLeft\n ? 'topLeft'\n : 'top';\n\n const [copied, setCopied] = useState(false);\n\n const preRef = useRef<HTMLPreElement | null>(\n null,\n ) as React.MutableRefObject<HTMLPreElement | null>;\n const buttonWrapperRef = useRef<HTMLDivElement>(null);\n\n const setPreRef = useCallback(\n (node: HTMLPreElement | null) => {\n preRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLPreElement | null>).current = node;\n },\n [ref],\n );\n\n useLayoutEffect(() => {\n if (!copyable) return;\n const pre = preRef.current;\n const wrapper = buttonWrapperRef.current;\n if (!pre || !wrapper) return;\n\n const isBottomAlign = isBottom;\n const borderH = noBorder ? 0 : 2;\n\n const update = () => {\n if (!isLeft) {\n const vScrollbar = Math.max(0, pre.offsetWidth - pre.clientWidth - borderH);\n wrapper.style.right = `${16 + vScrollbar}px`;\n }\n if (isBottomAlign) {\n const hScrollbar = Math.max(0, pre.offsetHeight - pre.clientHeight - borderH);\n wrapper.style.bottom = `${8 + hScrollbar}px`;\n }\n };\n\n update();\n const observer = new ResizeObserver(update);\n observer.observe(pre);\n return () => observer.disconnect();\n }, [copyable, isBottom, isLeft, noBorder]);\n\n const handleCopy = async () => {\n try {\n try {\n await navigator.clipboard.writeText(code);\n } catch (error) {\n // clipboard write failed (e.g. permission denied) — leave UI unchanged unless a fallback handled it\n if ((await onCopyError?.(error, code)) !== true) return;\n }\n setCopied(true);\n onCopy?.();\n setTimeout(() => setCopied(false), 1500);\n } catch {\n // onCopyError or onCopy threw — leave UI unchanged\n }\n };\n\n const copyButton = copyable ? (\n <Button\n variant=\"secondary\"\n ghost\n size=\"small\"\n type=\"button\"\n onClick={handleCopy}\n css={{\n color: '$hiContrast',\n gap: '$1',\n backgroundColor: '$codeBlockCopyButtonBg',\n height: '32px',\n }}\n >\n <AccessibleIcon label={copied ? 'Copied' : 'Copy'}>\n {copied ? <CheckIcon /> : <CopyIcon />}\n </AccessibleIcon>\n {copied ? copiedText : copyText}\n </Button>\n ) : null;\n\n return (\n <Highlight\n theme={prismTheme}\n code={code}\n language={(Prism.languages[lang] != null ? lang : 'text') as Language}\n >\n {({\n className: highlightClass,\n style: highlightStyle,\n tokens,\n getLineProps,\n getTokenProps,\n }) => (\n <Box css={{ position: 'relative', ...css }}>\n <Pre\n ref={setPreRef}\n className={[highlightClass, className].filter(Boolean).join(' ')}\n style={{ maxHeight, ...highlightStyle, backgroundColor: 'inherit', ...style }}\n noBorder={noBorder}\n {...props}\n >\n <Box\n css={{\n p: '$4',\n ...(copyable && isLeft && isBottom ? { pb: '$7' } : {}),\n ...(copyable && isLeft && !isBottom ? { pt: '$7' } : {}),\n }}\n >\n {tokens.map((line, i) => (\n <div\n key={i}\n {...getLineProps({ line })}\n style={\n wrapText ? { whiteSpace: 'pre-wrap', wordBreak: 'break-all' } : undefined\n }\n >\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </Box>\n </Pre>\n {copyButton && (\n <CopyButtonWrapper ref={buttonWrapperRef} position={buttonPosition}>\n {copyButton}\n </CopyButtonWrapper>\n )}\n </Box>\n )}\n </Highlight>\n );\n },\n);\n\nCodeBlock.displayName = 'CodeBlock';\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAM,MAAMA,wBAAAA,OAAO,OAAO;CACxB,GAAG;CACH,cAAc;CACd,UAAU;CACV,QAAQ;CACR,UAAU;CACV,YAAY;CAEZ,UAAU,EACR,UAAU,EACR,MAAM,EAAE,QAAQ,OAAO,EACzB,EACF;AACF,CAAC;AAED,IAAM,oBAAoBA,wBAAAA,OAAO,OAAO;CACtC,UAAU;CACV,QAAQ;CACR,UAAU,EACR,UAAU;EACR,KAAK;GAAE,KAAK;GAAM,OAAO;EAAK;EAC9B,SAAS;GAAE,KAAK;GAAM,MAAM;EAAK;EACjC,aAAa;GAAE,QAAQ;GAAM,OAAO;EAAK;EACzC,YAAY;GAAE,QAAQ;GAAM,MAAM;EAAK;CACzC,EACF;CAEA,iBAAiB,EACf,UAAU,MACZ;AACF,CAAC;AAkBD,IAAa,aAAA,GAAYC,MAAAA,WAAAA,EAErB,EACE,OAAO,QACP,MACA,WAAW,OACX,UACA,YACA,kBAAkB,aAClB,QACA,aACA,UACA,WAAW,OACX,aACA,YAAY,KACZ,KACA,OACA,W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GAAI;IAEJ,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,YAAAA,KAAD;KACE,KAAK;MACH,GAAG;MACH,GAAI,YAAY,UAAU,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;MACrD,GAAI,YAAY,UAAU,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;KACxD;KAEC,UAAA,OAAO,KAAK,MAAM,MACjB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;MAEE,GAAI,aAAa,EAAE,KAAK,CAAC;MACzB,OACE,WAAW;OAAE,YAAY;OAAY,WAAW;MAAY,IAAI,KAAA;MAGjE,UAAA,KAAK,KAAK,OAAO,QAChB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAgB,GAAI,cAAc,EAAE,MAAM,CAAC,EAAI,GAApC,GAAoC,CAChD;KACE,GATE,CASF,CACN;IACE,CAAA;GACF,CAAA,GACJ,cACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;IAAmB,KAAK;IAAkB,UAAU;IACjD,UAAA;GACgB,CAAA,CAElB;;CAEE,CAAA;AAEf,CACF;AAEA,UAAU,cAAc"}
1
+ {"version":3,"file":"CodeBlock.cjs","names":["styled","forwardRef","useColorScheme","themes","useState","useRef","useCallback","Button","AccessibleIcon","CheckIcon","CopyIcon","Highlight","Prism","Box"],"sources":["../../../components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import { CheckIcon, CopyIcon } from '@radix-ui/react-icons';\nimport { Highlight, Language, themes } from 'prism-react-renderer';\nimport React, { ComponentProps, forwardRef, useCallback, useRef, useState } from 'react';\n\nimport { CSS, styled } from '../../stitches.config';\nimport { useIsomorphicLayoutEffect } from '../../utils/useIsomorphicLayoutEffect';\nimport { AccessibleIcon } from '../AccessibleIcon';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { useColorScheme } from '../colorSchemeContext';\nimport type {\n CodeBlockCopyButtonAlign,\n CodeBlockCopyErrorHandler,\n CodeBlockLanguage,\n} from './index';\nimport { Prism } from './prism-extend';\n\nconst Pre = styled('pre', {\n m: 0,\n borderRadius: '$2',\n overflow: 'auto',\n border: '1px solid $colors$deepBlue3',\n fontSize: '$2',\n lineHeight: 1.6,\n\n variants: {\n noBorder: {\n true: { border: 'none' },\n },\n },\n});\n\nconst CopyButtonWrapper = styled('div', {\n position: 'absolute',\n zIndex: 1,\n variants: {\n position: {\n top: { top: '$2', right: '$3' },\n topLeft: { top: '$2', left: '$3' },\n bottomRight: { bottom: '$2', right: '$3' },\n bottomLeft: { bottom: '$2', left: '$3' },\n },\n },\n\n defaultVariants: {\n position: 'top',\n },\n});\n\nexport type CodeBlockProps = {\n lang?: CodeBlockLanguage;\n code: string;\n copyable?: boolean;\n copyText?: string;\n copiedText?: string;\n copyButtonAlign?: CodeBlockCopyButtonAlign;\n onCopy?: () => void;\n onCopyError?: CodeBlockCopyErrorHandler;\n noBorder?: boolean;\n wrapText?: boolean;\n colorScheme?: 'light' | 'dark';\n maxHeight?: number | string;\n css?: CSS;\n} & Omit<ComponentProps<typeof Pre>, 'css'>;\n\nexport const CodeBlock = forwardRef<HTMLPreElement, CodeBlockProps>(\n (\n {\n lang = 'text',\n code,\n copyable = false,\n copyText,\n copiedText,\n copyButtonAlign = 'top right',\n onCopy,\n onCopyError,\n noBorder,\n wrapText = false,\n colorScheme,\n maxHeight = 424,\n css,\n style,\n className,\n ...props\n },\n ref,\n ) => {\n const systemScheme = useColorScheme();\n const resolvedScheme = colorScheme ?? systemScheme;\n const prismTheme = resolvedScheme === 'dark' ? themes.nightOwl : themes.nightOwlLight;\n\n const isBottom = copyButtonAlign.includes('bottom');\n const isLeft = copyButtonAlign.includes('left');\n const buttonPosition = isBottom\n ? isLeft\n ? 'bottomLeft'\n : 'bottomRight'\n : isLeft\n ? 'topLeft'\n : 'top';\n\n const [copied, setCopied] = useState(false);\n\n const preRef = useRef<HTMLPreElement | null>(\n null,\n ) as React.MutableRefObject<HTMLPreElement | null>;\n const buttonWrapperRef = useRef<HTMLDivElement>(null);\n\n const setPreRef = useCallback(\n (node: HTMLPreElement | null) => {\n preRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLPreElement | null>).current = node;\n },\n [ref],\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!copyable) return;\n const pre = preRef.current;\n const wrapper = buttonWrapperRef.current;\n if (!pre || !wrapper) return;\n\n const isBottomAlign = isBottom;\n const borderH = noBorder ? 0 : 2;\n\n const update = () => {\n if (!isLeft) {\n const vScrollbar = Math.max(0, pre.offsetWidth - pre.clientWidth - borderH);\n wrapper.style.right = `${16 + vScrollbar}px`;\n }\n if (isBottomAlign) {\n const hScrollbar = Math.max(0, pre.offsetHeight - pre.clientHeight - borderH);\n wrapper.style.bottom = `${8 + hScrollbar}px`;\n }\n };\n\n update();\n const observer = new ResizeObserver(update);\n observer.observe(pre);\n return () => observer.disconnect();\n }, [copyable, isBottom, isLeft, noBorder]);\n\n const handleCopy = async () => {\n try {\n try {\n await navigator.clipboard.writeText(code);\n } catch (error) {\n // clipboard write failed (e.g. permission denied) — leave UI unchanged unless a fallback handled it\n if ((await onCopyError?.(error, code)) !== true) return;\n }\n setCopied(true);\n onCopy?.();\n setTimeout(() => setCopied(false), 1500);\n } catch {\n // onCopyError or onCopy threw — leave UI unchanged\n }\n };\n\n const copyButton = copyable ? (\n <Button\n variant=\"secondary\"\n ghost\n size=\"small\"\n type=\"button\"\n onClick={handleCopy}\n css={{\n color: '$hiContrast',\n gap: '$1',\n backgroundColor: '$codeBlockCopyButtonBg',\n height: '32px',\n }}\n >\n <AccessibleIcon label={copied ? 'Copied' : 'Copy'}>\n {copied ? <CheckIcon /> : <CopyIcon />}\n </AccessibleIcon>\n {copied ? copiedText : copyText}\n </Button>\n ) : null;\n\n return (\n <Highlight\n theme={prismTheme}\n code={code}\n language={(Prism.languages[lang] != null ? lang : 'text') as Language}\n >\n {({\n className: highlightClass,\n style: highlightStyle,\n tokens,\n getLineProps,\n getTokenProps,\n }) => (\n <Box css={{ position: 'relative', ...css }}>\n <Pre\n ref={setPreRef}\n className={[highlightClass, className].filter(Boolean).join(' ')}\n style={{ maxHeight, ...highlightStyle, backgroundColor: 'inherit', ...style }}\n noBorder={noBorder}\n {...props}\n >\n <Box\n css={{\n p: '$4',\n ...(copyable && isLeft && isBottom ? { pb: '$7' } : {}),\n ...(copyable && isLeft && !isBottom ? { pt: '$7' } : {}),\n }}\n >\n {tokens.map((line, i) => (\n <div\n key={i}\n {...getLineProps({ line })}\n style={\n wrapText ? { whiteSpace: 'pre-wrap', wordBreak: 'break-all' } : undefined\n }\n >\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </Box>\n </Pre>\n {copyButton && (\n <CopyButtonWrapper ref={buttonWrapperRef} position={buttonPosition}>\n {copyButton}\n </CopyButtonWrapper>\n )}\n </Box>\n )}\n </Highlight>\n );\n },\n);\n\nCodeBlock.displayName = 'CodeBlock';\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAM,MAAMA,wBAAAA,OAAO,OAAO;CACxB,GAAG;CACH,cAAc;CACd,UAAU;CACV,QAAQ;CACR,UAAU;CACV,YAAY;CAEZ,UAAU,EACR,UAAU,EACR,MAAM,EAAE,QAAQ,OAAO,EACzB,EACF;AACF,CAAC;AAED,IAAM,oBAAoBA,wBAAAA,OAAO,OAAO;CACtC,UAAU;CACV,QAAQ;CACR,UAAU,EACR,UAAU;EACR,KAAK;GAAE,KAAK;GAAM,OAAO;EAAK;EAC9B,SAAS;GAAE,KAAK;GAAM,MAAM;EAAK;EACjC,aAAa;GAAE,QAAQ;GAAM,OAAO;EAAK;EACzC,YAAY;GAAE,QAAQ;GAAM,MAAM;EAAK;CACzC,EACF;CAEA,iBAAiB,EACf,UAAU,MACZ;AACF,CAAC;AAkBD,IAAa,aAAA,GAAYC,MAAAA,WAAAA,EAErB,EACE,OAAO,QACP,MACA,WAAW,OACX,UACA,YACA,kBAAkB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KAAgB,iBAAiB;KAAW,GAAG;IAAM;IAClE;IACV,GAAI;IAEJ,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,YAAAA,KAAD;KACE,KAAK;MACH,GAAG;MACH,GAAI,YAAY,UAAU,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;MACrD,GAAI,YAAY,UAAU,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;KACxD;KAEC,UAAA,OAAO,KAAK,MAAM,MACjB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;MAEE,GAAI,aAAa,EAAE,KAAK,CAAC;MACzB,OACE,WAAW;OAAE,YAAY;OAAY,WAAW;MAAY,IAAI,KAAA;MAGjE,UAAA,KAAK,KAAK,OAAO,QAChB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAgB,GAAI,cAAc,EAAE,MAAM,CAAC,EAAI,GAApC,GAAoC,CAChD;KACE,GATE,CASF,CACN;IACE,CAAA;GACF,CAAA,GACJ,cACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;IAAmB,KAAK;IAAkB,UAAU;IACjD,UAAA;GACgB,CAAA,CAElB;;CAEE,CAAA;AAEf,CACF;AAEA,UAAU,cAAc"}
@@ -1,11 +1,12 @@
1
1
  import { AccessibleIcon } from "../AccessibleIcon/AccessibleIcon.js";
2
2
  import { styled } from "../../stitches.config.js";
3
3
  import { Box } from "../Box/Box.js";
4
+ import { useIsomorphicLayoutEffect } from "../../utils/useIsomorphicLayoutEffect.js";
4
5
  import { Button } from "../Button/Button.js";
5
6
  import { useColorScheme } from "../colorSchemeContext.js";
6
7
  import { Prism } from "./prism-extend.js";
7
8
  import { CheckIcon, CopyIcon } from "@radix-ui/react-icons";
8
- import { forwardRef, useCallback, useLayoutEffect, useRef, useState } from "react";
9
+ import { forwardRef, useCallback, useRef, useState } from "react";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
11
  import { Highlight, themes } from "prism-react-renderer";
11
12
  // components/CodeBlock/CodeBlock.tsx
@@ -55,7 +56,7 @@ var CodeBlock = forwardRef(({ lang = "text", code, copyable = false, copyText, c
55
56
  if (typeof ref === "function") ref(node);
56
57
  else if (ref) ref.current = node;
57
58
  }, [ref]);
58
- useLayoutEffect(() => {
59
+ useIsomorphicLayoutEffect(() => {
59
60
  if (!copyable) return;
60
61
  const pre = preRef.current;
61
62
  const wrapper = buttonWrapperRef.current;