@kanso-labs/kanso-ui 0.26.2 → 0.26.4

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 (177) hide show
  1. package/dist/calendar/index.js +1 -1
  2. package/dist/calendar/index.js.map +1 -1
  3. package/dist/calendar/months.js.map +1 -1
  4. package/dist/calendar/styles.js.map +1 -1
  5. package/dist/chip/styles.js.map +1 -1
  6. package/dist/components/app-bar/index.js +148 -40
  7. package/dist/components/app-bar/index.js.map +1 -1
  8. package/dist/components/autocomplete/index.js +1 -1
  9. package/dist/components/autocomplete/index.js.map +1 -1
  10. package/dist/components/avatar/index.js +46 -14
  11. package/dist/components/avatar/index.js.map +1 -1
  12. package/dist/components/breadcrumbs/index.js +1 -1
  13. package/dist/components/breadcrumbs/index.js.map +1 -1
  14. package/dist/components/button/index.js +67 -18
  15. package/dist/components/button/index.js.map +1 -1
  16. package/dist/components/calendar/index.js +1 -1
  17. package/dist/components/calendar/index.js.map +1 -1
  18. package/dist/components/card/index.js +71 -19
  19. package/dist/components/card/index.js.map +1 -1
  20. package/dist/components/checkbox/index.js +1 -1
  21. package/dist/components/checkbox/index.js.map +1 -1
  22. package/dist/components/checkbox-group/index.js +1 -1
  23. package/dist/components/checkbox-group/index.js.map +1 -1
  24. package/dist/components/chip/index.js +1 -1
  25. package/dist/components/chip/index.js.map +1 -1
  26. package/dist/components/chip-group/index.js +118 -28
  27. package/dist/components/chip-group/index.js.map +1 -1
  28. package/dist/components/code/index.js.map +1 -1
  29. package/dist/components/color-area/index.js +66 -12
  30. package/dist/components/color-area/index.js.map +1 -1
  31. package/dist/components/color-field/index.js +61 -12
  32. package/dist/components/color-field/index.js.map +1 -1
  33. package/dist/components/color-picker/index.js +146 -43
  34. package/dist/components/color-picker/index.js.map +1 -1
  35. package/dist/components/color-slider/index.js +116 -21
  36. package/dist/components/color-slider/index.js.map +1 -1
  37. package/dist/components/color-swatch/index.js +1 -1
  38. package/dist/components/color-swatch/index.js.map +1 -1
  39. package/dist/components/color-swatch-picker/index.js +1 -1
  40. package/dist/components/color-swatch-picker/index.js.map +1 -1
  41. package/dist/components/color-wheel/index.js +75 -11
  42. package/dist/components/color-wheel/index.js.map +1 -1
  43. package/dist/components/combo-box/index.js +113 -32
  44. package/dist/components/combo-box/index.js.map +1 -1
  45. package/dist/components/container/index.js +53 -10
  46. package/dist/components/container/index.js.map +1 -1
  47. package/dist/components/copy-field/index.js +95 -40
  48. package/dist/components/copy-field/index.js.map +1 -1
  49. package/dist/components/currency/index.js +68 -11
  50. package/dist/components/currency/index.js.map +1 -1
  51. package/dist/components/date-field/index.js +64 -15
  52. package/dist/components/date-field/index.js.map +1 -1
  53. package/dist/components/date-picker/index.js +121 -38
  54. package/dist/components/date-picker/index.js.map +1 -1
  55. package/dist/components/date-range-picker/index.js +154 -52
  56. package/dist/components/date-range-picker/index.js.map +1 -1
  57. package/dist/components/dialog/index.js +87 -19
  58. package/dist/components/dialog/index.js.map +1 -1
  59. package/dist/components/disclosure/index.js +43 -10
  60. package/dist/components/disclosure/index.js.map +1 -1
  61. package/dist/components/disclosure-group/index.js +49 -6
  62. package/dist/components/disclosure-group/index.js.map +1 -1
  63. package/dist/components/drop-zone/index.js +1 -1
  64. package/dist/components/drop-zone/index.js.map +1 -1
  65. package/dist/components/drop-zone/styles.js.map +1 -1
  66. package/dist/components/feed/index.js +52 -9
  67. package/dist/components/feed/index.js.map +1 -1
  68. package/dist/components/form/index.js +39 -6
  69. package/dist/components/form/index.js.map +1 -1
  70. package/dist/components/icon-button/index.js +89 -29
  71. package/dist/components/icon-button/index.js.map +1 -1
  72. package/dist/components/keycap/index.js.map +1 -1
  73. package/dist/components/link/index.js +52 -11
  74. package/dist/components/link/index.js.map +1 -1
  75. package/dist/components/list/index.js +96 -16
  76. package/dist/components/list/index.js.map +1 -1
  77. package/dist/components/list-box/index.js +45 -8
  78. package/dist/components/list-box/index.js.map +1 -1
  79. package/dist/components/list-detail/index.js +99 -20
  80. package/dist/components/list-detail/index.js.map +1 -1
  81. package/dist/components/list-item/index.js +42 -15
  82. package/dist/components/list-item/index.js.map +1 -1
  83. package/dist/components/menu/index.js +139 -23
  84. package/dist/components/menu/index.js.map +1 -1
  85. package/dist/components/meter/index.js +68 -8
  86. package/dist/components/meter/index.js.map +1 -1
  87. package/dist/components/navigation-tree/index.js +1 -1
  88. package/dist/components/navigation-tree/index.js.map +1 -1
  89. package/dist/components/number-field/index.js +135 -47
  90. package/dist/components/number-field/index.js.map +1 -1
  91. package/dist/components/popover/index.js +226 -49
  92. package/dist/components/popover/index.js.map +1 -1
  93. package/dist/components/product-icon/index.js +50 -17
  94. package/dist/components/product-icon/index.js.map +1 -1
  95. package/dist/components/progress-indicator/index.js +92 -9
  96. package/dist/components/progress-indicator/index.js.map +1 -1
  97. package/dist/components/radio-group/index.js +44 -10
  98. package/dist/components/radio-group/index.js.map +1 -1
  99. package/dist/components/range-calendar/index.js +1 -1
  100. package/dist/components/range-calendar/index.js.map +1 -1
  101. package/dist/components/search-field/index.js +44 -9
  102. package/dist/components/search-field/index.js.map +1 -1
  103. package/dist/components/segmented-button/index.js +111 -19
  104. package/dist/components/segmented-button/index.js.map +1 -1
  105. package/dist/components/select/index.js +48 -10
  106. package/dist/components/select/index.js.map +1 -1
  107. package/dist/components/separator/index.js +21 -6
  108. package/dist/components/separator/index.js.map +1 -1
  109. package/dist/components/sheet/index.js +87 -19
  110. package/dist/components/sheet/index.js.map +1 -1
  111. package/dist/components/slider/index.js +90 -18
  112. package/dist/components/slider/index.js.map +1 -1
  113. package/dist/components/snackbar/index.js +1 -1
  114. package/dist/components/snackbar/index.js.map +1 -1
  115. package/dist/components/stack/index.js +54 -9
  116. package/dist/components/stack/index.js.map +1 -1
  117. package/dist/components/supporting-pane/index.js +91 -20
  118. package/dist/components/supporting-pane/index.js.map +1 -1
  119. package/dist/components/switch/index.js +57 -12
  120. package/dist/components/switch/index.js.map +1 -1
  121. package/dist/components/table/index.js +229 -46
  122. package/dist/components/table/index.js.map +1 -1
  123. package/dist/components/tabs/index.js +1 -1
  124. package/dist/components/tabs/index.js.map +1 -1
  125. package/dist/components/tag/index.js +53 -10
  126. package/dist/components/tag/index.js.map +1 -1
  127. package/dist/components/text/index.js +54 -9
  128. package/dist/components/text/index.js.map +1 -1
  129. package/dist/components/text-area/index.js +70 -15
  130. package/dist/components/text-area/index.js.map +1 -1
  131. package/dist/components/text-field/index.js +73 -16
  132. package/dist/components/text-field/index.js.map +1 -1
  133. package/dist/components/time-field/index.js +64 -15
  134. package/dist/components/time-field/index.js.map +1 -1
  135. package/dist/components/token-field/index.js +133 -18
  136. package/dist/components/token-field/index.js.map +1 -1
  137. package/dist/components/toolbar/index.js +68 -11
  138. package/dist/components/toolbar/index.js.map +1 -1
  139. package/dist/components/tooltip/index.js +87 -11
  140. package/dist/components/tooltip/index.js.map +1 -1
  141. package/dist/components/tree/index.js +96 -16
  142. package/dist/components/tree/index.js.map +1 -1
  143. package/dist/drag/hooks.js +1 -1
  144. package/dist/drag/hooks.js.map +1 -1
  145. package/dist/drag/index.js +1 -1
  146. package/dist/drag/index.js.map +1 -1
  147. package/dist/drag/styles.js.map +1 -1
  148. package/dist/field/index.js +338 -96
  149. package/dist/field/index.js.map +1 -1
  150. package/dist/field/root.js.map +1 -1
  151. package/dist/glyphs/index.js +1 -1
  152. package/dist/glyphs/index.js.map +1 -1
  153. package/dist/hooks/useImageLoadingStatus.js +1 -1
  154. package/dist/hooks/useImageLoadingStatus.js.map +1 -1
  155. package/dist/hooks/useRipple.js +1 -1
  156. package/dist/hooks/useRipple.js.map +1 -1
  157. package/dist/indicator/index.js +1 -1
  158. package/dist/indicator/index.js.map +1 -1
  159. package/dist/indicator/styles.js.map +1 -1
  160. package/dist/layout.js.map +1 -1
  161. package/dist/render/aria.js.map +1 -1
  162. package/dist/render/useRender.js +66 -21
  163. package/dist/render/useRender.js.map +1 -1
  164. package/dist/row/index.js +97 -23
  165. package/dist/row/index.js.map +1 -1
  166. package/dist/row/styles.js.map +1 -1
  167. package/dist/segments/index.js.map +1 -1
  168. package/dist/segments/styles.js.map +1 -1
  169. package/dist/styles/chequer.js.map +1 -1
  170. package/dist/styles/color.js.map +1 -1
  171. package/dist/styles/merge.js.map +1 -1
  172. package/dist/styles/overlay.js.map +1 -1
  173. package/dist/styles/picker.js.map +1 -1
  174. package/dist/styles/ripple.js.map +1 -1
  175. package/dist/tokens/design.tokens.stylex.js.map +1 -1
  176. package/dist/tokens/values.js.map +1 -1
  177. package/package.json +8 -6
@@ -1,6 +1,7 @@
1
1
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
2
2
  import { mergeStyles } from "../../styles/merge.js";
3
3
  import { thumbClassName } from "../../styles/color.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { ColorThumb, ColorWheel, ColorWheelTrack } from "react-aria-components";
6
7
  //#region src/components/color-wheel/index.tsx
@@ -41,22 +42,85 @@ const styles = {
41
42
  * The call site's `className` and `style` land on the wheel, which is the
42
43
  * element a layout positions. Its size comes from `outerRadius`.
43
44
  */
44
- function ColorWheel$1({ className, isDisabled = false, outerRadius = DEFAULT_OUTER_RADIUS, style, thickness = DEFAULT_THICKNESS, ...props$1 }) {
45
- const innerRadius = Math.max(0, outerRadius - thickness);
46
- return /* @__PURE__ */ jsxs(ColorWheel, {
47
- innerRadius,
48
- isDisabled,
49
- outerRadius,
50
- ...props$1,
51
- ...mergeStyles({
45
+ function ColorWheel$1(t0) {
46
+ const $ = c(24);
47
+ let className;
48
+ let props$1;
49
+ let style;
50
+ let t1;
51
+ let t2;
52
+ let t3;
53
+ if ($[0] !== t0) {
54
+ ({className, isDisabled: t1, outerRadius: t2, style, thickness: t3, ...props$1} = t0);
55
+ $[0] = t0;
56
+ $[1] = className;
57
+ $[2] = props$1;
58
+ $[3] = style;
59
+ $[4] = t1;
60
+ $[5] = t2;
61
+ $[6] = t3;
62
+ } else {
63
+ className = $[1];
64
+ props$1 = $[2];
65
+ style = $[3];
66
+ t1 = $[4];
67
+ t2 = $[5];
68
+ t3 = $[6];
69
+ }
70
+ const isDisabled = t1 === void 0 ? false : t1;
71
+ const outerRadius = t2 === void 0 ? DEFAULT_OUTER_RADIUS : t2;
72
+ const innerRadius = Math.max(0, outerRadius - (t3 === void 0 ? DEFAULT_THICKNESS : t3));
73
+ let t4;
74
+ if ($[7] !== className || $[8] !== isDisabled || $[9] !== style) {
75
+ t4 = mergeStyles({
52
76
  0: { className: "x9f619 x1rg5ohu x14ju556" },
53
77
  1: { className: "x9f619 x1rg5ohu x14ju556 x1ppv7y9" }
54
78
  }[!!isDisabled << 0], {
55
79
  className,
56
80
  style
57
- }),
58
- children: [/* @__PURE__ */ jsx(ColorWheelTrack, { ...props(styles.track, styles.trackRing(innerRadius), isDisabled && styles.trackDisabled) }), /* @__PURE__ */ jsx(ColorThumb, { className: thumbClassName })]
59
- });
81
+ });
82
+ $[7] = className;
83
+ $[8] = isDisabled;
84
+ $[9] = style;
85
+ $[10] = t4;
86
+ } else t4 = $[10];
87
+ let t5;
88
+ if ($[11] !== innerRadius || $[12] !== isDisabled) {
89
+ t5 = props(styles.track, styles.trackRing(innerRadius), isDisabled && styles.trackDisabled);
90
+ $[11] = innerRadius;
91
+ $[12] = isDisabled;
92
+ $[13] = t5;
93
+ } else t5 = $[13];
94
+ let t6;
95
+ if ($[14] !== t5) {
96
+ t6 = /* @__PURE__ */ jsx(ColorWheelTrack, { ...t5 });
97
+ $[14] = t5;
98
+ $[15] = t6;
99
+ } else t6 = $[15];
100
+ let t7;
101
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
102
+ t7 = /* @__PURE__ */ jsx(ColorThumb, { className: thumbClassName });
103
+ $[16] = t7;
104
+ } else t7 = $[16];
105
+ let t8;
106
+ if ($[17] !== innerRadius || $[18] !== isDisabled || $[19] !== outerRadius || $[20] !== props$1 || $[21] !== t4 || $[22] !== t6) {
107
+ t8 = /* @__PURE__ */ jsxs(ColorWheel, {
108
+ innerRadius,
109
+ isDisabled,
110
+ outerRadius,
111
+ ...props$1,
112
+ ...t4,
113
+ children: [t6, t7]
114
+ });
115
+ $[17] = innerRadius;
116
+ $[18] = isDisabled;
117
+ $[19] = outerRadius;
118
+ $[20] = props$1;
119
+ $[21] = t4;
120
+ $[22] = t6;
121
+ $[23] = t8;
122
+ } else t8 = $[23];
123
+ return t8;
60
124
  }
61
125
  //#endregion
62
126
  export { ColorWheel$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/color-wheel/index.tsx"],"sourcesContent":["import type { ColorWheelProps as RACColorWheelProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorThumb as RACColorThumb, ColorWheel as RACColorWheel, ColorWheelTrack as RACColorWheelTrack } from 'react-aria-components';\nimport { thumbClassName } from '../../styles/color';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// Hue as a ring. React Aria paints the conic gradient on the track's own\n// inline `background` and sizes it from `outerRadius`, so what is here is\n// the hole in the middle and the handle `ColorSlider` already draws, from\n// `src/styles/color.ts`.\n//\n// The design carries no page for this. Three things follow, each a choice\n// rather than a reading.\n//\n// **The ring's thickness is the sliders page's 16dp track.** A hue wheel and\n// a hue slider are the same control in two shapes, so the band a reader\n// drags along is the same width in both.\n//\n// **The thickness is a prop and the inner radius is not.** React Aria takes\n// both radii and would accept an inner one larger than the outer, which\n// draws nothing at all; deriving it is what stops the two disagreeing.\n//\n// **The hole is cut with a mask, not drawn with a disc on top.** A disc in\n// the wheel's own surface colour would be opaque, so anything the wheel is\n// placed over — a card, a photograph, another control — would be hidden by\n// a circle nothing explains. The mask leaves the middle genuinely empty,\n// which is also what lets a swatch or an area sit inside one.\n\nconst DEFAULT_OUTER_RADIUS = 100;\n// The sliders page's track, which is what a hue slider draws.\nconst DEFAULT_THICKNESS = 16;\nconst _temp = {\n kX1K2I: \"xwjwp01\",\n \"$$css\": true\n};\nconst styles = {\n track: {\n kkrTdU: \"x1ypdohk\",\n $$css: true\n },\n trackDisabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n trackRing: (inner: number) => [_temp, {\n \"--x-maskImage\": `radial-gradient(circle at center, transparent ${Math.max(0, inner - 0.5)}px, #000 ${inner + 0.5}px)` != null ? `radial-gradient(circle at center, transparent ${Math.max(0, inner - 0.5)}px, #000 ${inner + 0.5}px)` : undefined\n }]\n};\ntype ColorWheelProps = Omit<RACColorWheelProps, 'children' | 'className' | 'innerRadius' | 'outerRadius' | 'style'> & {\n /** A function may compute the class from the wheel's render state. */\n className?: string;\n /**\n * How far the ring reaches from the centre, in pixels. The wheel is twice\n * this across.\n * @default 100\n */\n outerRadius?: number;\n /** Lands on the wheel, as `className` does. */\n style?: React.CSSProperties;\n /**\n * How wide the band is, in pixels. The inner radius is this in from\n * `outerRadius`, so the two cannot disagree.\n * @default 16\n */\n thickness?: number;\n};\n\n/**\n * Hue as a ring, with a handle on it. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue`, as a CSS colour\n * string or a `Color` from `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorWheel defaultValue=\"hsl(200, 100%, 50%)\" />\n * ```\n *\n * A wheel slides hue and nothing else, so unlike `ColorSlider` and\n * `ColorArea` it names no channel and there is no space for one to be\n * missing from — a hex value works here.\n *\n * The middle is genuinely empty rather than filled, so a `ColorArea` or a\n * `ColorSwatch` can sit inside one. React Aria names the handle \"Hue\" and\n * announces the value; pass `aria-label` to say something else.\n *\n * The call site's `className` and `style` land on the wheel, which is the\n * element a layout positions. Its size comes from `outerRadius`.\n */\nfunction ColorWheel({\n className,\n isDisabled = false,\n outerRadius = DEFAULT_OUTER_RADIUS,\n style,\n thickness = DEFAULT_THICKNESS,\n ...props\n}: ColorWheelProps) {\n const innerRadius = Math.max(0, outerRadius - thickness);\n return <RACColorWheel innerRadius={innerRadius} isDisabled={isDisabled} outerRadius={outerRadius} {...props} {...mergeStyles({\n 0: {\n className: \"x9f619 x1rg5ohu x14ju556\"\n },\n 1: {\n className: \"x9f619 x1rg5ohu x14ju556 x1ppv7y9\"\n }\n }[!!isDisabled << 0], {\n className,\n style\n })}>\n <RACColorWheelTrack {...stylex.props(styles.track, styles.trackRing(innerRadius), isDisabled && styles.trackDisabled)} />\n <RACColorThumb className={thumbClassName} />\n </RACColorWheel>;\n}\nexport type { ColorWheelProps };\nexport default ColorWheel;"],"mappings":";;;;;;AA8BA,MAAM,uBAAuB;AAE7B,MAAM,oBAAoB;AAC1B,MAAM,QAAQ;CACZ,QAAQ;CACR,SAAS;AACX;AACA,MAAM,SAAS;CACb,OAAO;EACL,QAAQ;EACR,OAAO;CACT;CACA,eAAe;EACb,QAAQ;EACR,OAAO;CACT;CACA,YAAY,UAAkB,CAAC,OAAO,EACpC,iBAAiB,iDAAiD,KAAK,IAAI,GAAG,QAAQ,EAAG,EAAC,WAAY,QAAQ,GAAG,QAAS,OAAO,iDAAiD,KAAK,IAAI,GAAG,QAAQ,EAAG,EAAC,WAAY,QAAQ,GAAG,OAAQ,KAAA,EAC3O,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,aAAW,EAClB,WACA,aAAa,OACb,cAAc,sBACd,OACA,YAAY,mBACZ,GAAG,WACe;CAClB,MAAM,cAAc,KAAK,IAAI,GAAG,cAAc,SAAS;CACvD,OAAO,qBAAC,YAAD;EAA4B;EAAyB;EAAyB;EAAa,GAAI;EAAO,GAAI,YAAY;GAC3H,GAAG,EACD,WAAW,2BACb;GACA,GAAG,EACD,WAAW,oCACb;EACF,EAAE,CAAC,CAAC,cAAc,IAAI;GACpB;GACA;EACF,CAAC;EAVM,UAAA,CAWH,oBAAC,iBAAD,EAAoB,GAAI,MAAa,OAAO,OAAO,OAAO,UAAU,WAAW,GAAG,cAAc,OAAO,aAAa,EAAE,CAAA,GACtH,oBAAC,YAAD,EAAe,WAAW,eAAe,CAAA,CAC5B;;AACnB"}
1
+ {"version":3,"file":"index.js","names":["ColorWheelProps","RACColorWheelProps","stylex","ColorThumb","RACColorThumb","ColorWheel","RACColorWheel","ColorWheelTrack","RACColorWheelTrack","thumbClassName","mergeStyles","stateLayerOpacity","DEFAULT_OUTER_RADIUS","DEFAULT_THICKNESS","_temp","kX1K2I","styles","track","kkrTdU","$$css","trackDisabled","trackRing","inner","Math","max","undefined","Omit","className","outerRadius","style","React","CSSProperties","thickness","t0","$","_c","props","t1","t2","t3","isDisabled","innerRadius","t4","0","1","t5","t6","t7","Symbol","for","t8"],"sources":["../../../src/components/color-wheel/index.tsx"],"sourcesContent":["import type { ColorWheelProps as RACColorWheelProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorThumb as RACColorThumb, ColorWheel as RACColorWheel, ColorWheelTrack as RACColorWheelTrack } from 'react-aria-components';\nimport { thumbClassName } from '../../styles/color';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// Hue as a ring. React Aria paints the conic gradient on the track's own\n// inline `background` and sizes it from `outerRadius`, so what is here is\n// the hole in the middle and the handle `ColorSlider` already draws, from\n// `src/styles/color.ts`.\n//\n// The design carries no page for this. Three things follow, each a choice\n// rather than a reading.\n//\n// **The ring's thickness is the sliders page's 16dp track.** A hue wheel and\n// a hue slider are the same control in two shapes, so the band a reader\n// drags along is the same width in both.\n//\n// **The thickness is a prop and the inner radius is not.** React Aria takes\n// both radii and would accept an inner one larger than the outer, which\n// draws nothing at all; deriving it is what stops the two disagreeing.\n//\n// **The hole is cut with a mask, not drawn with a disc on top.** A disc in\n// the wheel's own surface colour would be opaque, so anything the wheel is\n// placed over — a card, a photograph, another control — would be hidden by\n// a circle nothing explains. The mask leaves the middle genuinely empty,\n// which is also what lets a swatch or an area sit inside one.\n\nconst DEFAULT_OUTER_RADIUS = 100;\n// The sliders page's track, which is what a hue slider draws.\nconst DEFAULT_THICKNESS = 16;\nconst _temp = {\n kX1K2I: \"xwjwp01\",\n \"$$css\": true\n};\nconst styles = {\n track: {\n kkrTdU: \"x1ypdohk\",\n $$css: true\n },\n trackDisabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n trackRing: (inner: number) => [_temp, {\n \"--x-maskImage\": `radial-gradient(circle at center, transparent ${Math.max(0, inner - 0.5)}px, #000 ${inner + 0.5}px)` != null ? `radial-gradient(circle at center, transparent ${Math.max(0, inner - 0.5)}px, #000 ${inner + 0.5}px)` : undefined\n }]\n};\ntype ColorWheelProps = Omit<RACColorWheelProps, 'children' | 'className' | 'innerRadius' | 'outerRadius' | 'style'> & {\n /** A function may compute the class from the wheel's render state. */\n className?: string;\n /**\n * How far the ring reaches from the centre, in pixels. The wheel is twice\n * this across.\n * @default 100\n */\n outerRadius?: number;\n /** Lands on the wheel, as `className` does. */\n style?: React.CSSProperties;\n /**\n * How wide the band is, in pixels. The inner radius is this in from\n * `outerRadius`, so the two cannot disagree.\n * @default 16\n */\n thickness?: number;\n};\n\n/**\n * Hue as a ring, with a handle on it. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue`, as a CSS colour\n * string or a `Color` from `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorWheel defaultValue=\"hsl(200, 100%, 50%)\" />\n * ```\n *\n * A wheel slides hue and nothing else, so unlike `ColorSlider` and\n * `ColorArea` it names no channel and there is no space for one to be\n * missing from — a hex value works here.\n *\n * The middle is genuinely empty rather than filled, so a `ColorArea` or a\n * `ColorSwatch` can sit inside one. React Aria names the handle \"Hue\" and\n * announces the value; pass `aria-label` to say something else.\n *\n * The call site's `className` and `style` land on the wheel, which is the\n * element a layout positions. Its size comes from `outerRadius`.\n */\nfunction ColorWheel({\n className,\n isDisabled = false,\n outerRadius = DEFAULT_OUTER_RADIUS,\n style,\n thickness = DEFAULT_THICKNESS,\n ...props\n}: ColorWheelProps) {\n const innerRadius = Math.max(0, outerRadius - thickness);\n return <RACColorWheel innerRadius={innerRadius} isDisabled={isDisabled} outerRadius={outerRadius} {...props} {...mergeStyles({\n 0: {\n className: \"x9f619 x1rg5ohu x14ju556\"\n },\n 1: {\n className: \"x9f619 x1rg5ohu x14ju556 x1ppv7y9\"\n }\n }[!!isDisabled << 0], {\n className,\n style\n })}>\n <RACColorWheelTrack {...stylex.props(styles.track, styles.trackRing(innerRadius), isDisabled && styles.trackDisabled)} />\n <RACColorThumb className={thumbClassName} />\n </RACColorWheel>;\n}\nexport type { ColorWheelProps };\nexport default ColorWheel;"],"mappings":";;;;;;;AA8BA,MAAMY,uBAAuB;AAE7B,MAAMC,oBAAoB;AAC1B,MAAMC,QAAQ;CACZC,QAAQ;CACR,SAAS;AACX;AACA,MAAMC,SAAS;CACbC,OAAO;EACLC,QAAQ;EACRC,OAAO;CACT;CACAC,eAAe;EACbF,QAAQ;EACRC,OAAO;CACT;CACAE,YAAYC,UAAkB,CAACR,OAAO,EACpC,iBAAiB,iDAAiDS,KAAKC,IAAI,GAAGF,QAAQ,EAAG,EAAC,WAAYA,QAAQ,GAAG,QAAS,OAAO,iDAAiDC,KAAKC,IAAI,GAAGF,QAAQ,EAAG,EAAC,WAAYA,QAAQ,GAAG,OAAQG,KAAAA,EAC3O,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAApB,aAAA4B,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAR;CAAA,IAAAS;CAAA,IAAAP;CAAA,IAAAQ;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAoB,CAAA,CAAAN,WAAAa,YAAAH,IAAAT,aAAAU,IAAAT,OAAAG,WAAAO,IAAA,GAAAH,WAAAH;EAOFC,EAAA,KAAAD;EAAAC,EAAA,KAAAP;EAAAO,EAAA,KAAAE;EAAAF,EAAA,KAAAL;EAAAK,EAAA,KAAAG;EAAAH,EAAA,KAAAI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A;EAAIyB,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAgB;CAAA,IAAAhB,EAAA,QAAAO,eAAAP,EAAA,QAAAM,cAAAN,EAAA,QAAAN,eAAAM,EAAA,QAAAE,WAAAF,EAAA,QAAAQ,MAAAR,EAAA,QAAAY,IAAA;EAZzCI,KAAA,qBAAC,YAAD;GAA4BT;GAAyBD;GAAyBZ;GAAW,GAAMQ;GAAK,GAAMM;GAA1G,UAAA,CAWHI,IACAC,EAZiB;;EAaHb,EAAA,MAAAO;EAAAP,EAAA,MAAAM;EAAAN,EAAA,MAAAN;EAAAM,EAAA,MAAAE;EAAAF,EAAA,MAAAQ;EAAAR,EAAA,MAAAY;EAAAZ,EAAA,MAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAAA,OAbXgB;AAaW"}
@@ -5,9 +5,9 @@ import { fieldStyles, invalidFrom, useFieldValidationBehavior } from "../../fiel
5
5
  import { FieldBox, FieldInput, FieldMessage, FieldValue } from "../../field/index.js";
6
6
  import { overlay } from "../../styles/overlay.js";
7
7
  import ListBox$1 from "../list-box/index.js";
8
+ import { c } from "react/compiler-runtime";
8
9
  import { useContext, useRef } from "react";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
- import { c } from "react/compiler-runtime";
11
11
  import { Button, ComboBox, ComboBoxStateContext, ComboBoxValue, Popover } from "react-aria-components";
12
12
  //#region src/components/combo-box/index.tsx
13
13
  const TOGGLE = /* @__PURE__ */ jsx(ComboToggle, {});
@@ -71,39 +71,120 @@ function ChosenValues() {
71
71
  * The call site's `className` and `style` land on the field as a whole,
72
72
  * which is the element a layout positions.
73
73
  */
74
- function ComboBox$1({ container, description, error, floatingLabel = true, isDisabled = false, label, leadingIcon, options, variant = "filled", ...props$1 }) {
74
+ function ComboBox$1(t0) {
75
+ const $ = c(34);
76
+ const { container, description, error, floatingLabel: t1, isDisabled: t2, label, leadingIcon, options, variant: t3, ...props$1 } = t0;
77
+ const floatingLabel = t1 === void 0 ? true : t1;
78
+ const isDisabled = t2 === void 0 ? false : t2;
79
+ const variant = t3 === void 0 ? "filled" : t3;
75
80
  const validationBehavior = useFieldValidationBehavior();
76
81
  const boxRef = useRef(null);
77
- return /* @__PURE__ */ jsxs(ComboBox, {
78
- isDisabled,
79
- isInvalid: invalidFrom(error),
80
- validationBehavior,
81
- ...props$1,
82
- ...mergeStatefulStyles(props(fieldStyles.root), props$1),
83
- children: [
84
- /* @__PURE__ */ jsxs(FieldBox, {
85
- floatingLabel,
86
- isDisabled,
87
- isInvalid: invalidFrom(error),
88
- label,
89
- leading: leadingIcon,
90
- ref: boxRef,
91
- trailing: TOGGLE,
92
- variant,
93
- children: [props$1.selectionMode === "multiple" ? /* @__PURE__ */ jsx(ChosenValues, {}) : null, /* @__PURE__ */ jsx(FieldInput, {})]
94
- }),
95
- /* @__PURE__ */ jsx(FieldMessage, {
96
- description,
97
- error
98
- }),
99
- /* @__PURE__ */ jsx(Popover, {
100
- triggerRef: boxRef,
101
- UNSTABLE_portalContainer: container,
102
- ...props(overlay.popup, styles.list),
103
- children: /* @__PURE__ */ jsx(ListBox$1, { children: options })
104
- })
105
- ]
106
- });
82
+ const T0 = ComboBox;
83
+ let t4;
84
+ if ($[0] !== error) {
85
+ t4 = invalidFrom(error);
86
+ $[0] = error;
87
+ $[1] = t4;
88
+ } else t4 = $[1];
89
+ const t5 = mergeStatefulStyles(props(fieldStyles.root), props$1);
90
+ let t6;
91
+ if ($[2] !== error) {
92
+ t6 = invalidFrom(error);
93
+ $[2] = error;
94
+ $[3] = t6;
95
+ } else t6 = $[3];
96
+ let t7;
97
+ if ($[4] !== props$1.selectionMode) {
98
+ t7 = props$1.selectionMode === "multiple" ? /* @__PURE__ */ jsx(ChosenValues, {}) : null;
99
+ $[4] = props$1.selectionMode;
100
+ $[5] = t7;
101
+ } else t7 = $[5];
102
+ let t8;
103
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
104
+ t8 = /* @__PURE__ */ jsx(FieldInput, {});
105
+ $[6] = t8;
106
+ } else t8 = $[6];
107
+ let t9;
108
+ if ($[7] !== floatingLabel || $[8] !== isDisabled || $[9] !== label || $[10] !== leadingIcon || $[11] !== t6 || $[12] !== t7 || $[13] !== variant) {
109
+ t9 = /* @__PURE__ */ jsxs(FieldBox, {
110
+ floatingLabel,
111
+ isDisabled,
112
+ isInvalid: t6,
113
+ label,
114
+ leading: leadingIcon,
115
+ ref: boxRef,
116
+ trailing: TOGGLE,
117
+ variant,
118
+ children: [t7, t8]
119
+ });
120
+ $[7] = floatingLabel;
121
+ $[8] = isDisabled;
122
+ $[9] = label;
123
+ $[10] = leadingIcon;
124
+ $[11] = t6;
125
+ $[12] = t7;
126
+ $[13] = variant;
127
+ $[14] = t9;
128
+ } else t9 = $[14];
129
+ let t10;
130
+ if ($[15] !== description || $[16] !== error) {
131
+ t10 = /* @__PURE__ */ jsx(FieldMessage, {
132
+ description,
133
+ error
134
+ });
135
+ $[15] = description;
136
+ $[16] = error;
137
+ $[17] = t10;
138
+ } else t10 = $[17];
139
+ let t11;
140
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
141
+ t11 = props(overlay.popup, styles.list);
142
+ $[18] = t11;
143
+ } else t11 = $[18];
144
+ let t12;
145
+ if ($[19] !== options) {
146
+ t12 = /* @__PURE__ */ jsx(ListBox$1, { children: options });
147
+ $[19] = options;
148
+ $[20] = t12;
149
+ } else t12 = $[20];
150
+ let t13;
151
+ if ($[21] !== container || $[22] !== t12) {
152
+ t13 = /* @__PURE__ */ jsx(Popover, {
153
+ triggerRef: boxRef,
154
+ UNSTABLE_portalContainer: container,
155
+ ...t11,
156
+ children: t12
157
+ });
158
+ $[21] = container;
159
+ $[22] = t12;
160
+ $[23] = t13;
161
+ } else t13 = $[23];
162
+ let t14;
163
+ if ($[24] !== T0 || $[25] !== isDisabled || $[26] !== props$1 || $[27] !== t10 || $[28] !== t13 || $[29] !== t4 || $[30] !== t5 || $[31] !== t9 || $[32] !== validationBehavior) {
164
+ t14 = /* @__PURE__ */ jsxs(T0, {
165
+ isDisabled,
166
+ isInvalid: t4,
167
+ validationBehavior,
168
+ ...props$1,
169
+ ...t5,
170
+ children: [
171
+ t9,
172
+ t10,
173
+ t13
174
+ ]
175
+ });
176
+ $[24] = T0;
177
+ $[25] = isDisabled;
178
+ $[26] = props$1;
179
+ $[27] = t10;
180
+ $[28] = t13;
181
+ $[29] = t4;
182
+ $[30] = t5;
183
+ $[31] = t9;
184
+ $[32] = validationBehavior;
185
+ $[33] = t14;
186
+ } else t14 = $[33];
187
+ return t14;
107
188
  }
108
189
  /**
109
190
  * The button that opens the list. It takes its press behaviour from the
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/combo-box/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ComboBoxProps as RACComboBoxProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { ComboBoxStateContext, Button as RACButton, ComboBox as RACComboBox, ComboBoxValue as RACComboBoxValue, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport ListBox from '../list-box';\n\n// The text fields page's autocomplete text field: a text field that filters a\n// list as it is typed. Everything above the list is the field chrome in\n// `src/field` — the same box, label, supporting line and error treatment\n// every other field draws — and the list is ListBox on the shared overlay\n// surface, positioned and sized against the box exactly as Select's is.\n//\n// It is Select's shape with two differences.\n//\n// The control is a real input, so the box is not a press target — typing has\n// to reach the input — and only the chevron at the end opens the list. That\n// is what the page draws too: an autocomplete text field is a text field,\n// with a button on it.\n//\n// And the field is an element tree rather than a function of React Aria's\n// render state, which every other component here writes. React Aria builds a\n// combo box's collection by walking its children for options, and a function\n// is opaque to that walk: with one, the collection is empty until the list\n// has been opened, so a `defaultSelectedKey` resolves to no text and the\n// field starts blank. What needed the render state — whether the list is\n// open — reads the combo box's own state from context instead.\n//\n// Two more things are this component's own.\n//\n// **Filtering is React Aria's, and stays theirs.** `defaultFilter` takes a\n// predicate, and the package re-exports `useFilter` for a locale-aware one;\n// `items` with `useAsyncList` is how a list that is fetched rather than\n// listed gets in. None of that is wrapped, because a combo box's whole job\n// is which options it shows and a wrapper would be a second place to decide\n// it.\n//\n// **A value that is not in the list is allowed or refused, not corrected.**\n// `allowsCustomValue` is React Aria's, and with it off the input reverts to\n// the last chosen option on blur rather than keeping text that means nothing.\n//\n// Choosing more than one is `selectionMode=\"multiple\"`, which draws the\n// chosen options before the input through React Aria's `ComboBoxValue`. For\n// a field that draws each of them as a removable chip, the coverage plan has\n// TokenField.\n\n// Hoisted so it is not a new element on every render, which is what\n// react-perf's jsx-no-jsx-as-prop is after.\nconst TOGGLE = <ComboToggle />;\nconst styles = {\n list: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n kzqmXN: \"xlvufjm\",\n kskxy: \"xedcshv\",\n ks0D6T: \"x1x1rfll\",\n k7Eaqz: \"xeuugli\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n }\n};\ntype ComboBoxProps<T extends object = object, M extends ComboBoxSelectionMode = 'single'> = {\n /**\n * Where to portal the list. Defaults to the end of `<body>`, which is\n * right for an app that sets its StyleX theme on `:root`. An app that\n * scopes the theme to a subtree has to point this at an element inside it,\n * or the list renders outside the theme and falls back to the tokens'\n * `prefers-color-scheme` default.\n */\n container?: Element;\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message, the red underline, and\n * `aria-invalid` all follow from it.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or holds a value. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a combo box with\n * no label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role.\n */\n leadingIcon?: ReactNode;\n /**\n * The options. `ListBox.Item` for each, and `ListBox.Section` to group\n * them — the list inside is a ListBox, and takes everything one does.\n */\n options?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACComboBoxProps<T, M>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n// React Aria's combo box takes its own two-value selection mode rather than\n// the collection-wide one, which also has `none`; that type is local to its\n// module, so the two values are named again here.\ntype ComboBoxSelectionMode = 'multiple' | 'single';\n\n/**\n * The chosen options, drawn before the input when more than one may be\n * chosen. The chrome's `FieldValue` is the styled element and React Aria's\n * `ComboBoxValue` sits inside it, as it does in Select.\n */\nfunction ChosenValues() {\n return <FieldValue className=\"x2lah0s\">\n <RACComboBoxValue />\n </FieldValue>;\n}\n\n/**\n * A labelled text field that filters a list as it is typed. Its value is\n * React Aria's: pass `value` with `onChange` to control which option is\n * chosen, `inputValue` with `onInputChange` to control the text, or the\n * `default` forms of either to let it keep its own. React Aria's older\n * `selectedKey` names are deprecated and are left out of this component's\n * props rather than passed through.\n *\n * ```tsx\n * <ComboBox\n * label=\"Label\"\n * options={\n * <>\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * <ListBox.Item id=\"second\">Second item</ListBox.Item>\n * </>\n * }\n * />\n * ```\n *\n * Filtering is React Aria's: `defaultFilter` takes a predicate, `useFilter`\n * is re-exported for a locale-aware one, and `items` with `useAsyncList`\n * feeds a list that is fetched rather than listed. `allowsCustomValue` lets\n * the field keep text that matches nothing.\n *\n * The box, label, input, supporting line and error are the field chrome in\n * `src/field`, shared with every other field; the list is ListBox on the\n * overlay surface every anchored panel here draws.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction ComboBox<T extends object = object, M extends ComboBoxSelectionMode = 'single'>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: ComboBoxProps<T, M>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from: the box, not the\n // button inside it, which is a 24dp icon.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACComboBox<T, M> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `ComboBox` does not, so the box\n // is told outright or its label and its underline never turn.\n isDisabled={isDisabled} isInvalid={invalidFrom(error)} label={label} leading={leadingIcon} ref={boxRef} trailing={TOGGLE} variant={variant}>\n {props.selectionMode === 'multiple' ? <ChosenValues /> : null}\n <FieldInput />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover triggerRef={boxRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...stylex.props(overlay.popup, styles.list)}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </RACComboBox>;\n}\n\n/**\n * The button that opens the list. It takes its press behaviour from the\n * combo box around it through React Aria's button context, and reads whether\n * the list is open from the combo box's state rather than from a render prop\n * — the whole field cannot be a render function, since React Aria builds its\n * collection by walking the children and a function is opaque to that walk.\n */\nfunction ComboToggle() {\n const state = useContext(ComboBoxStateContext);\n return <RACButton className=\"x6s0dn4 xjbqb8w xxk0z11 x3y1ksm xc342km x9f619 x1heor9g x1ypdohk x3nfvp2 xvy4d1p xl56j7k xrgy624 x1hl8ikr x9v5kkp x1t137rt x1de99jn x1717udv\">\n <ChevronEndGlyph {...{\n 0: {\n className: \"xxk0z11 xvy4d1p x1iffjtl xx6bhzk x11xpdln\"\n },\n 1: {\n className: \"xxk0z11 xvy4d1p xx6bhzk x11xpdln x9tu13d\"\n }\n }[!!(state?.isOpen === true) << 0]} />\n </RACButton>;\n}\nexport type { ComboBoxProps, ComboBoxSelectionMode };\nexport default ComboBox;"],"mappings":";;;;;;;;;;;;AAwDA,MAAM,SAAS,oBAAC,aAAD,CAAY,CAAA;AAC3B,MAAM,SAAS,EACb,MAAM;CACJ,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;AACT,EACF;;;;;;AA4DA,SAAA,eAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EACS,KAAA,oBAAC,YAAD;GAAsB,WAAA;GACzB,UAAA,oBAAC,eAAD,CAAiB,CAAA;EADH,CAAA;EAEH,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAFR;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCjB,SAAS,WAAgF,EACvF,WACA,aACA,OACA,gBAAgB,MAChB,aAAa,OACb,OACA,aACA,SACA,UAAU,UACV,GAAG,WACmB;CACtB,MAAM,qBAAqB,2BAA2B;CAGtD,MAAM,SAAS,OAAuB,IAAI;CAC1C,OAAO,qBAAC,UAAD;EAA+B;EAAY,WAAW,YAAY,KAAK;EAAuB;EAAoB,GAAI;EAAO,GAAI,oBAAoB,MAAa,YAAY,IAAI,GAAG,OAAK;EAA1L,UAAA;GACH,qBAAC,UAAD;IAAyB;IAIf;IAAY,WAAW,YAAY,KAAK;IAAU;IAAO,SAAS;IAAa,KAAK;IAAQ,UAAU;IAAiB;IAJjI,UAAA,CAKG,QAAM,kBAAkB,aAAa,oBAAC,cAAD,CAAa,CAAA,IAAM,MACzD,oBAAC,YAAD,CAAW,CAAA,CACH;;GACV,oBAAC,cAAD;IAA2B;IAAoB;GAAM,CAAA;GACrD,oBAAC,SAAD;IAAY,YAAY;IAE1B,0BAA0B;IAAW,GAAI,MAAa,QAAQ,OAAO,OAAO,IAAI;IAC5E,UAAA,oBAAC,WAAD,EAAA,UAAU,QAAiB,CAAA;GACjB,CAAA;EACD;;AACjB;;;;;;;;AASA,SAAA,cAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CACE,MAAA,QAAc,WAAW,oBAAoB;CAAE,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EAEtB,KAAA;GAAA,GAClB,EAAA,WACU,4CACb;GAAC,GACE,EAAA,WACU,2CACb;EACF;EAAC,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAPsB,MAAA,KAAA,GAOrB,CAAC,EAAE,OAAK,WAAa,SAAS;CAAE,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAR7B,KAAA,oBAAC,QAAD;GAAqB,WAAA;GACxB,UAAA,oBAAC,iBAAD,EAAgB,GAAK,GAOW,CAAA;EARnB,CAAA;EASH,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OATP;AASO"}
1
+ {"version":3,"file":"index.js","names":["ReactNode","ComboBoxProps","RACComboBoxProps","stylex","useContext","useRef","ComboBoxStateContext","Button","RACButton","ComboBox","RACComboBox","ComboBoxValue","RACComboBoxValue","Popover","RACPopover","FieldVariant","FieldBox","FieldInput","FieldMessage","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","ChevronEndGlyph","mergeStatefulStyles","overlay","colors","radii","spacing","ListBox","TOGGLE","styles","list","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","ComboBoxSelectionMode","container","Element","description","error","floatingLabel","label","leadingIcon","options","variant","Omit","T","M","ChosenValues","$","_c","t0","Symbol","for","t1","isDisabled","t2","t3","props","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","t7","selectionMode","t8","t9","t10","t11","popup","t12","t13","t14","ComboToggle","state","0","className","1","isOpen"],"sources":["../../../src/components/combo-box/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ComboBoxProps as RACComboBoxProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { ComboBoxStateContext, Button as RACButton, ComboBox as RACComboBox, ComboBoxValue as RACComboBoxValue, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport ListBox from '../list-box';\n\n// The text fields page's autocomplete text field: a text field that filters a\n// list as it is typed. Everything above the list is the field chrome in\n// `src/field` — the same box, label, supporting line and error treatment\n// every other field draws — and the list is ListBox on the shared overlay\n// surface, positioned and sized against the box exactly as Select's is.\n//\n// It is Select's shape with two differences.\n//\n// The control is a real input, so the box is not a press target — typing has\n// to reach the input — and only the chevron at the end opens the list. That\n// is what the page draws too: an autocomplete text field is a text field,\n// with a button on it.\n//\n// And the field is an element tree rather than a function of React Aria's\n// render state, which every other component here writes. React Aria builds a\n// combo box's collection by walking its children for options, and a function\n// is opaque to that walk: with one, the collection is empty until the list\n// has been opened, so a `defaultSelectedKey` resolves to no text and the\n// field starts blank. What needed the render state — whether the list is\n// open — reads the combo box's own state from context instead.\n//\n// Two more things are this component's own.\n//\n// **Filtering is React Aria's, and stays theirs.** `defaultFilter` takes a\n// predicate, and the package re-exports `useFilter` for a locale-aware one;\n// `items` with `useAsyncList` is how a list that is fetched rather than\n// listed gets in. None of that is wrapped, because a combo box's whole job\n// is which options it shows and a wrapper would be a second place to decide\n// it.\n//\n// **A value that is not in the list is allowed or refused, not corrected.**\n// `allowsCustomValue` is React Aria's, and with it off the input reverts to\n// the last chosen option on blur rather than keeping text that means nothing.\n//\n// Choosing more than one is `selectionMode=\"multiple\"`, which draws the\n// chosen options before the input through React Aria's `ComboBoxValue`. For\n// a field that draws each of them as a removable chip, the coverage plan has\n// TokenField.\n\n// Hoisted so it is not a new element on every render, which is what\n// react-perf's jsx-no-jsx-as-prop is after.\nconst TOGGLE = <ComboToggle />;\nconst styles = {\n list: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n kzqmXN: \"xlvufjm\",\n kskxy: \"xedcshv\",\n ks0D6T: \"x1x1rfll\",\n k7Eaqz: \"xeuugli\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n }\n};\ntype ComboBoxProps<T extends object = object, M extends ComboBoxSelectionMode = 'single'> = {\n /**\n * Where to portal the list. Defaults to the end of `<body>`, which is\n * right for an app that sets its StyleX theme on `:root`. An app that\n * scopes the theme to a subtree has to point this at an element inside it,\n * or the list renders outside the theme and falls back to the tokens'\n * `prefers-color-scheme` default.\n */\n container?: Element;\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message, the red underline, and\n * `aria-invalid` all follow from it.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or holds a value. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a combo box with\n * no label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role.\n */\n leadingIcon?: ReactNode;\n /**\n * The options. `ListBox.Item` for each, and `ListBox.Section` to group\n * them — the list inside is a ListBox, and takes everything one does.\n */\n options?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACComboBoxProps<T, M>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n// React Aria's combo box takes its own two-value selection mode rather than\n// the collection-wide one, which also has `none`; that type is local to its\n// module, so the two values are named again here.\ntype ComboBoxSelectionMode = 'multiple' | 'single';\n\n/**\n * The chosen options, drawn before the input when more than one may be\n * chosen. The chrome's `FieldValue` is the styled element and React Aria's\n * `ComboBoxValue` sits inside it, as it does in Select.\n */\nfunction ChosenValues() {\n return <FieldValue className=\"x2lah0s\">\n <RACComboBoxValue />\n </FieldValue>;\n}\n\n/**\n * A labelled text field that filters a list as it is typed. Its value is\n * React Aria's: pass `value` with `onChange` to control which option is\n * chosen, `inputValue` with `onInputChange` to control the text, or the\n * `default` forms of either to let it keep its own. React Aria's older\n * `selectedKey` names are deprecated and are left out of this component's\n * props rather than passed through.\n *\n * ```tsx\n * <ComboBox\n * label=\"Label\"\n * options={\n * <>\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * <ListBox.Item id=\"second\">Second item</ListBox.Item>\n * </>\n * }\n * />\n * ```\n *\n * Filtering is React Aria's: `defaultFilter` takes a predicate, `useFilter`\n * is re-exported for a locale-aware one, and `items` with `useAsyncList`\n * feeds a list that is fetched rather than listed. `allowsCustomValue` lets\n * the field keep text that matches nothing.\n *\n * The box, label, input, supporting line and error are the field chrome in\n * `src/field`, shared with every other field; the list is ListBox on the\n * overlay surface every anchored panel here draws.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction ComboBox<T extends object = object, M extends ComboBoxSelectionMode = 'single'>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: ComboBoxProps<T, M>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from: the box, not the\n // button inside it, which is a 24dp icon.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACComboBox<T, M> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `ComboBox` does not, so the box\n // is told outright or its label and its underline never turn.\n isDisabled={isDisabled} isInvalid={invalidFrom(error)} label={label} leading={leadingIcon} ref={boxRef} trailing={TOGGLE} variant={variant}>\n {props.selectionMode === 'multiple' ? <ChosenValues /> : null}\n <FieldInput />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover triggerRef={boxRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...stylex.props(overlay.popup, styles.list)}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </RACComboBox>;\n}\n\n/**\n * The button that opens the list. It takes its press behaviour from the\n * combo box around it through React Aria's button context, and reads whether\n * the list is open from the combo box's state rather than from a render prop\n * — the whole field cannot be a render function, since React Aria builds its\n * collection by walking the children and a function is opaque to that walk.\n */\nfunction ComboToggle() {\n const state = useContext(ComboBoxStateContext);\n return <RACButton className=\"x6s0dn4 xjbqb8w xxk0z11 x3y1ksm xc342km x9f619 x1heor9g x1ypdohk x3nfvp2 xvy4d1p xl56j7k xrgy624 x1hl8ikr x9v5kkp x1t137rt x1de99jn x1717udv\">\n <ChevronEndGlyph {...{\n 0: {\n className: \"xxk0z11 xvy4d1p x1iffjtl xx6bhzk x11xpdln\"\n },\n 1: {\n className: \"xxk0z11 xvy4d1p xx6bhzk x11xpdln x9tu13d\"\n }\n }[!!(state?.isOpen === true) << 0]} />\n </RACButton>;\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A;CAAA,OAfT2B;AAeS;;;;;;;;AAUlB,SAAAC,cAAA;CAAA,MAAA5B,IAAAC,EAAA,CAAA;CACE,MAAA4B,QAAcjF,WAAWE,oBAAoB;CAAE,IAAAoD;CAAA,IAAAF,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EAEtBF,KAAA;GAAA4B,GAClB,EAAAC,WACU,4CACb;GAACC,GACE,EAAAD,WACU,2CACb;EACF;EAAC/B,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAPsB,MAAAK,KAAAH,GAOrB,CAAC,EAAE2B,OAAKI,WAAa,SAAS;CAAE,IAAA1B;CAAA,IAAAP,EAAA,OAAAK,IAAA;EAR7BE,KAAA,oBAAC,QAAD;GAAqB,WAAA;GACxB,UAAA,oBAAC,iBAAD,EAAgB,GAAKF,GAOW,CAAA;EARnB,CAAA;EASHL,EAAA,KAAAK;EAAAL,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OATPO;AASO"}
@@ -1,6 +1,7 @@
1
1
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
2
2
  import { useRender } from "../../render/useRender.js";
3
3
  import { mergeStyles } from "../../styles/merge.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  //#region src/components/container/index.tsx
5
6
  const DEFAULT_MAX_INLINE_SIZE = "960px";
6
7
  const _temp = {
@@ -32,16 +33,58 @@ const styles = {
32
33
  * `render` swaps the element, for a container that should be a `<main>` or a
33
34
  * `<section>` rather than a `<div>`.
34
35
  */
35
- function Container({ maxInlineSize = DEFAULT_MAX_INLINE_SIZE, padding = "default", render, ...props$1 }) {
36
- const padded = padding === "none" ? styles.paddingNone : styles.paddingDefault;
37
- return useRender({
38
- defaultTagName: "div",
39
- props: {
40
- ...props$1,
41
- ...mergeStyles(props(styles.root(maxInlineSize), padded), props$1)
42
- },
43
- render
44
- });
36
+ function Container(t0) {
37
+ const $ = c(13);
38
+ let render;
39
+ let t1;
40
+ let t2;
41
+ let t3;
42
+ let t4;
43
+ if ($[0] !== t0) {
44
+ const { maxInlineSize: t5, padding: t6, render: t7, ...props$1 } = t0;
45
+ render = t7;
46
+ const maxInlineSize = t5 === void 0 ? DEFAULT_MAX_INLINE_SIZE : t5;
47
+ const padded = (t6 === void 0 ? "default" : t6) === "none" ? styles.paddingNone : styles.paddingDefault;
48
+ t4 = useRender;
49
+ t3 = "div";
50
+ t1 = props$1;
51
+ t2 = mergeStyles(props(styles.root(maxInlineSize), padded), props$1);
52
+ $[0] = t0;
53
+ $[1] = render;
54
+ $[2] = t1;
55
+ $[3] = t2;
56
+ $[4] = t3;
57
+ $[5] = t4;
58
+ } else {
59
+ render = $[1];
60
+ t1 = $[2];
61
+ t2 = $[3];
62
+ t3 = $[4];
63
+ t4 = $[5];
64
+ }
65
+ let t5;
66
+ if ($[6] !== t1 || $[7] !== t2) {
67
+ t5 = {
68
+ ...t1,
69
+ ...t2
70
+ };
71
+ $[6] = t1;
72
+ $[7] = t2;
73
+ $[8] = t5;
74
+ } else t5 = $[8];
75
+ let t6;
76
+ if ($[9] !== render || $[10] !== t3 || $[11] !== t5) {
77
+ t6 = {
78
+ defaultTagName: t3,
79
+ props: t5,
80
+ render
81
+ };
82
+ $[9] = render;
83
+ $[10] = t3;
84
+ $[11] = t5;
85
+ $[12] = t6;
86
+ } else t6 = $[12];
87
+ return t4(t6);
45
88
  }
46
89
  //#endregion
47
90
  export { Container as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/container/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { spacing } from '../../tokens/design.tokens.stylex';\n\n// The width fourteen of this library's own story files already centre their\n// page on, which is what makes it the default rather than a number picked\n// here. A measure is a property of the content: 960px suits a page of mixed\n// components, and prose wants something nearer 58ch, which is what the story\n// files that hold prose use. Say which one you mean rather than taking this.\nconst DEFAULT_MAX_INLINE_SIZE = '960px';\n\n// One pixel of the layout pages' own breakpoint: a compact window is below\n// 600, and a medium window starts at it.\nconst MEDIUM_WINDOW = '@media (width >= 600px)';\n\n// A dynamic style rather than a static one, for the same reason Feed's is:\n// the measure comes from the call site and StyleX compiles its classes ahead\n// of time, so the value is written to a custom property inline instead.\n//\n// No Material Design page draws a page container; the layout pages give the\n// margins one keeps. The gutter is the margin those pages give a window of\n// each size — 16dp while the window is compact, 24dp from medium up — and\n// the measure is the call site's, since the pages leave a pane's width to\n// its content.\nconst _temp = {\n kB7OPa: \"x9f619\",\n kzqmXN: \"xh8yej3\",\n kUOVxO: \"xvueqy4\",\n ks0D6T: \"x13i5qev\",\n \"$$css\": true\n};\nconst styles = {\n paddingDefault: {\n kg3NbH: \"x790zyz x1njmi9r\",\n $$css: true\n },\n paddingNone: {\n kg3NbH: \"xnjsko4\",\n $$css: true\n },\n root: (maxInlineSize: string) => [_temp, {\n \"--x-maxInlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(maxInlineSize)\n }]\n};\ntype ContainerProps = RenderComponentProps<'div'> & {\n /**\n * How wide the content may run before it stops growing. The container is\n * centred in whatever space is left over.\n *\n * Worth setting. The default suits a page of mixed components; prose wants\n * a measure in `ch`, since what makes a line hard to read is how many\n * characters it holds rather than how many pixels.\n * @default '960px'\n */\n maxInlineSize?: string;\n /**\n * Inline padding, which is what keeps the content off the edge of the\n * window once it is narrower than the measure. `none` is for a container\n * nested inside one that already has it.\n * @default 'default'\n */\n padding?: 'default' | 'none';\n};\n\n/**\n * A centred measure for a page or a section of one: content grows to a width\n * and stops, with the leftover space split evenly either side.\n *\n * Layout only — it paints no surface and gives its children no container of\n * their own, which is what separates it from Card. It sets no gaps either, so\n * reach for Stack inside it for the rhythm between sections.\n *\n * `render` swaps the element, for a container that should be a `<main>` or a\n * `<section>` rather than a `<div>`.\n */\nfunction Container({\n maxInlineSize = DEFAULT_MAX_INLINE_SIZE,\n padding = 'default',\n render,\n ...props\n}: ContainerProps) {\n const padded = padding === 'none' ? styles.paddingNone : styles.paddingDefault;\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n ...mergeStyles(stylex.props(styles.root(maxInlineSize), padded), props)\n },\n render\n });\n}\nexport type { ContainerProps };\nexport default Container;"],"mappings":";;;;AAYA,MAAM,0BAA0B;AAehC,MAAM,QAAQ;CACZ,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;AACX;AACA,MAAM,SAAS;CACb,gBAAgB;EACd,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,OAAO;CACT;CACA,OAAO,kBAA0B,CAAC,OAAO,EACvC,uBAAsB,QAAO,OAAO,QAAQ,WAAW,MAAM,OAAO,OAAO,OAAO,MAAM,KAAA,EAAA,CAAW,aAAa,EAClH,CAAC;AACH;;;;;;;;;;;;AAgCA,SAAS,UAAU,EACjB,gBAAgB,yBAChB,UAAU,WACV,QACA,GAAG,WACc;CACjB,MAAM,SAAS,YAAY,SAAS,OAAO,cAAc,OAAO;CAChE,OAAO,UAAU;EACf,gBAAgB;EAChB,OAAO;GACL,GAAG;GACH,GAAG,YAAY,MAAa,OAAO,KAAK,aAAa,GAAG,MAAM,GAAG,OAAK;EACxE;EACA;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":["stylex","RenderComponentProps","useRender","mergeStyles","spacing","DEFAULT_MAX_INLINE_SIZE","MEDIUM_WINDOW","_temp","kB7OPa","kzqmXN","kUOVxO","ks0D6T","styles","paddingDefault","kg3NbH","$$css","paddingNone","root","maxInlineSize","val","undefined","ContainerProps","padding","Container","t0","$","_c","render","t1","t2","t3","t4","t5","t6","t7","props","padded","defaultTagName"],"sources":["../../../src/components/container/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { spacing } from '../../tokens/design.tokens.stylex';\n\n// The width fourteen of this library's own story files already centre their\n// page on, which is what makes it the default rather than a number picked\n// here. A measure is a property of the content: 960px suits a page of mixed\n// components, and prose wants something nearer 58ch, which is what the story\n// files that hold prose use. Say which one you mean rather than taking this.\nconst DEFAULT_MAX_INLINE_SIZE = '960px';\n\n// One pixel of the layout pages' own breakpoint: a compact window is below\n// 600, and a medium window starts at it.\nconst MEDIUM_WINDOW = '@media (width >= 600px)';\n\n// A dynamic style rather than a static one, for the same reason Feed's is:\n// the measure comes from the call site and StyleX compiles its classes ahead\n// of time, so the value is written to a custom property inline instead.\n//\n// No Material Design page draws a page container; the layout pages give the\n// margins one keeps. The gutter is the margin those pages give a window of\n// each size — 16dp while the window is compact, 24dp from medium up — and\n// the measure is the call site's, since the pages leave a pane's width to\n// its content.\nconst _temp = {\n kB7OPa: \"x9f619\",\n kzqmXN: \"xh8yej3\",\n kUOVxO: \"xvueqy4\",\n ks0D6T: \"x13i5qev\",\n \"$$css\": true\n};\nconst styles = {\n paddingDefault: {\n kg3NbH: \"x790zyz x1njmi9r\",\n $$css: true\n },\n paddingNone: {\n kg3NbH: \"xnjsko4\",\n $$css: true\n },\n root: (maxInlineSize: string) => [_temp, {\n \"--x-maxInlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(maxInlineSize)\n }]\n};\ntype ContainerProps = RenderComponentProps<'div'> & {\n /**\n * How wide the content may run before it stops growing. The container is\n * centred in whatever space is left over.\n *\n * Worth setting. The default suits a page of mixed components; prose wants\n * a measure in `ch`, since what makes a line hard to read is how many\n * characters it holds rather than how many pixels.\n * @default '960px'\n */\n maxInlineSize?: string;\n /**\n * Inline padding, which is what keeps the content off the edge of the\n * window once it is narrower than the measure. `none` is for a container\n * nested inside one that already has it.\n * @default 'default'\n */\n padding?: 'default' | 'none';\n};\n\n/**\n * A centred measure for a page or a section of one: content grows to a width\n * and stops, with the leftover space split evenly either side.\n *\n * Layout only — it paints no surface and gives its children no container of\n * their own, which is what separates it from Card. It sets no gaps either, so\n * reach for Stack inside it for the rhythm between sections.\n *\n * `render` swaps the element, for a container that should be a `<main>` or a\n * `<section>` rather than a `<div>`.\n */\nfunction Container({\n maxInlineSize = DEFAULT_MAX_INLINE_SIZE,\n padding = 'default',\n render,\n ...props\n}: ContainerProps) {\n const padded = padding === 'none' ? styles.paddingNone : styles.paddingDefault;\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n ...mergeStyles(stylex.props(styles.root(maxInlineSize), padded), props)\n },\n render\n });\n}\nexport type { ContainerProps };\nexport default Container;"],"mappings":";;;;;AAYA,MAAMK,0BAA0B;AAehC,MAAME,QAAQ;CACZC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACR,SAAS;AACX;AACA,MAAMC,SAAS;CACbC,gBAAgB;EACdC,QAAQ;EACRC,OAAO;CACT;CACAC,aAAa;EACXF,QAAQ;EACRC,OAAO;CACT;CACAE,OAAOC,kBAA0B,CAACX,OAAO,EACvC,uBAAsBY,QAAO,OAAOA,QAAQ,WAAWA,MAAM,OAAOA,OAAO,OAAOA,MAAMC,KAAAA,EAAAA,CAAWF,aAAa,EAClH,CAAC;AACH;;;;;;;;;;;;AAgCA,SAAAK,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAD,IAAA;EAAmB,MAAA,EAAAN,eAAAc,IAAAV,SAAAW,IAAAN,QAAAO,IAAA,GAAAC,YAAAX;EAAAG,SAAAO;EACjB,MAAAhB,gBAAAc,OAAAZ,KAAAA,IAAAf,0BAAA2B;EAKA,MAAAI,UAJAH,OAAAb,KAAAA,IAAA,YAAAa,QAI2B,SAASrB,OAAMI,cAAeJ,OAAMC;EACxDX,KAAAA;EACW4B,KAAA;EAEXK,KAAAA;EACAN,KAAA1B,YAAYH,MAAaY,OAAMK,KAAMC,aAAa,GAAGkB,MAAM,GAAGD,OAAK;EAACV,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAA;EAAAJ,SAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;EAAAM,KAAAN,EAAA;CAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAG,MAAAH,EAAA,OAAAI,IAAA;EAFlEG,KAAA;GAAA,GACFG;GAAK,GACLN;EACL;EAACJ,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAE,UAAAF,EAAA,QAAAK,MAAAL,EAAA,QAAAO,IAAA;EALcC,KAAA;GAAAI,gBACCP;GAAKK,OACdH;GAGNL;EAEH;EAACF,EAAA,KAAAE;EAAAF,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAPMvB,GAAU+B,EAOhB;AAAC"}
@@ -1,7 +1,8 @@
1
1
  import { mergeStyles } from "../../styles/merge.js";
2
2
  import Button from "../button/index.js";
3
3
  import Code from "../code/index.js";
4
- import { useCallback, useEffect, useRef, useState } from "react";
4
+ import { c } from "react/compiler-runtime";
5
+ import { useEffect, useRef, useState } from "react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  //#region src/components/copy-field/index.tsx
7
8
  const COPIED_RESET_MS = 2e3;
@@ -10,49 +11,103 @@ const COPIED_RESET_MS = 2e3;
10
11
  * It shows the value in the mono face and copies it on request, confirming
11
12
  * on the button itself.
12
13
  */
13
- function CopyField({ copiedLabel = "Copied", copyLabel = "Copy", onCopied, value, ...props }) {
14
+ function CopyField(t0) {
15
+ const $ = c(18);
16
+ const { copiedLabel: t1, copyLabel: t2, onCopied, value, ...props } = t0;
17
+ const copiedLabel = t1 === void 0 ? "Copied" : t1;
18
+ const copyLabel = t2 === void 0 ? "Copy" : t2;
14
19
  const [copied, setCopied] = useState(false);
15
20
  const timer = useRef(void 0);
16
- useEffect(() => () => {
17
- clearTimeout(timer.current);
18
- }, []);
19
- const handleCopy = useCallback(() => {
20
- const write = async () => {
21
- try {
22
- await navigator.clipboard.writeText(value);
23
- } catch {
24
- setCopied(false);
25
- return;
26
- }
27
- setCopied(true);
28
- onCopied?.(value);
21
+ let t3;
22
+ let t4;
23
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24
+ t3 = () => () => {
29
25
  clearTimeout(timer.current);
30
- timer.current = setTimeout(() => {
31
- setCopied(false);
32
- }, COPIED_RESET_MS);
33
26
  };
34
- write();
35
- }, [onCopied, value]);
36
- return /* @__PURE__ */ jsxs("div", {
37
- ...props,
38
- ...mergeStyles({ className: "x6s0dn4 x14s9m32 x1fwvt7v x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x78zum5 x126z3so xmqoko8 x18fpw6u" }, props),
39
- children: [
40
- /* @__PURE__ */ jsx("span", {
41
- className: "x1iyjqo2 x1b35g6e xeuugli",
42
- children: /* @__PURE__ */ jsx(Code, { children: value })
43
- }),
44
- /* @__PURE__ */ jsx(Button, {
45
- onClick: handleCopy,
46
- size: "xs",
47
- variant: "text",
48
- children: copied ? copiedLabel : copyLabel
49
- }),
50
- /* @__PURE__ */ jsx("output", {
51
- className: "xjm9jq1 x1hyvwdk x1i1rx1s xb3r6kr x10l6tqk xuxw1ft",
52
- children: copied ? copiedLabel : ""
53
- })
54
- ]
55
- });
27
+ t4 = [];
28
+ $[0] = t3;
29
+ $[1] = t4;
30
+ } else {
31
+ t3 = $[0];
32
+ t4 = $[1];
33
+ }
34
+ useEffect(t3, t4);
35
+ let t5;
36
+ if ($[2] !== onCopied || $[3] !== value) {
37
+ t5 = () => {
38
+ const write = async () => {
39
+ try {
40
+ await navigator.clipboard.writeText(value);
41
+ } catch {
42
+ setCopied(false);
43
+ return;
44
+ }
45
+ setCopied(true);
46
+ onCopied?.(value);
47
+ clearTimeout(timer.current);
48
+ timer.current = setTimeout(() => {
49
+ setCopied(false);
50
+ }, COPIED_RESET_MS);
51
+ };
52
+ write();
53
+ };
54
+ $[2] = onCopied;
55
+ $[3] = value;
56
+ $[4] = t5;
57
+ } else t5 = $[4];
58
+ const handleCopy = t5;
59
+ const t6 = mergeStyles({ className: "x6s0dn4 x14s9m32 x1fwvt7v x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x78zum5 x126z3so xmqoko8 x18fpw6u" }, props);
60
+ let t7;
61
+ if ($[5] !== value) {
62
+ t7 = /* @__PURE__ */ jsx("span", {
63
+ className: "x1iyjqo2 x1b35g6e xeuugli",
64
+ children: /* @__PURE__ */ jsx(Code, { children: value })
65
+ });
66
+ $[5] = value;
67
+ $[6] = t7;
68
+ } else t7 = $[6];
69
+ const t8 = copied ? copiedLabel : copyLabel;
70
+ let t9;
71
+ if ($[7] !== handleCopy || $[8] !== t8) {
72
+ t9 = /* @__PURE__ */ jsx(Button, {
73
+ onClick: handleCopy,
74
+ size: "xs",
75
+ variant: "text",
76
+ children: t8
77
+ });
78
+ $[7] = handleCopy;
79
+ $[8] = t8;
80
+ $[9] = t9;
81
+ } else t9 = $[9];
82
+ const t10 = copied ? copiedLabel : "";
83
+ let t11;
84
+ if ($[10] !== t10) {
85
+ t11 = /* @__PURE__ */ jsx("output", {
86
+ className: "xjm9jq1 x1hyvwdk x1i1rx1s xb3r6kr x10l6tqk xuxw1ft",
87
+ children: t10
88
+ });
89
+ $[10] = t10;
90
+ $[11] = t11;
91
+ } else t11 = $[11];
92
+ let t12;
93
+ if ($[12] !== props || $[13] !== t11 || $[14] !== t6 || $[15] !== t7 || $[16] !== t9) {
94
+ t12 = /* @__PURE__ */ jsxs("div", {
95
+ ...props,
96
+ ...t6,
97
+ children: [
98
+ t7,
99
+ t9,
100
+ t11
101
+ ]
102
+ });
103
+ $[12] = props;
104
+ $[13] = t11;
105
+ $[14] = t6;
106
+ $[15] = t7;
107
+ $[16] = t9;
108
+ $[17] = t12;
109
+ } else t12 = $[17];
110
+ return t12;
56
111
  }
57
112
  //#endregion
58
113
  export { CopyField as default };