@xds/react 0.0.0-stage → 0.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 (190) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/dist/Accordion.d.ts +20 -0
  4. package/dist/Accordion.js +197 -0
  5. package/dist/Avatar.d.ts +9 -0
  6. package/dist/Avatar.js +69 -0
  7. package/dist/AvatarStack.d.ts +8 -0
  8. package/dist/AvatarStack.js +105 -0
  9. package/dist/Badge.d.ts +13 -0
  10. package/dist/Badge.js +66 -0
  11. package/dist/Banner.d.ts +23 -0
  12. package/dist/Banner.js +166 -0
  13. package/dist/Button.d.ts +14 -0
  14. package/dist/Button.js +159 -0
  15. package/dist/Card.d.ts +18 -0
  16. package/dist/Card.js +173 -0
  17. package/dist/Checkbox.d.ts +10 -0
  18. package/dist/Checkbox.js +140 -0
  19. package/dist/Chip.d.ts +12 -0
  20. package/dist/Chip.js +74 -0
  21. package/dist/ChipBar.d.ts +12 -0
  22. package/dist/ChipBar.js +38 -0
  23. package/dist/CountBadge.d.ts +12 -0
  24. package/dist/CountBadge.js +64 -0
  25. package/dist/DatePicker.d.ts +20 -0
  26. package/dist/DatePicker.js +429 -0
  27. package/dist/DateRangePicker.d.ts +24 -0
  28. package/dist/DateRangePicker.js +370 -0
  29. package/dist/Defaults.d.ts +17 -0
  30. package/dist/Defaults.js +48 -0
  31. package/dist/Dialog.d.ts +20 -0
  32. package/dist/Dialog.js +137 -0
  33. package/dist/Divider.d.ts +4 -0
  34. package/dist/Divider.js +31 -0
  35. package/dist/EmptyState.d.ts +12 -0
  36. package/dist/EmptyState.js +86 -0
  37. package/dist/Icon.d.ts +9 -0
  38. package/dist/Icon.js +79 -0
  39. package/dist/IconButton.d.ts +12 -0
  40. package/dist/IconButton.js +119 -0
  41. package/dist/ListRow.d.ts +21 -0
  42. package/dist/ListRow.js +185 -0
  43. package/dist/MediaCard.d.ts +20 -0
  44. package/dist/MediaCard.js +279 -0
  45. package/dist/Menu.d.ts +18 -0
  46. package/dist/Menu.js +244 -0
  47. package/dist/ProgressBar.d.ts +8 -0
  48. package/dist/ProgressBar.js +65 -0
  49. package/dist/RadioGroup.d.ts +15 -0
  50. package/dist/RadioGroup.js +176 -0
  51. package/dist/SearchField.d.ts +15 -0
  52. package/dist/SearchField.js +152 -0
  53. package/dist/SectionHeader.d.ts +14 -0
  54. package/dist/SectionHeader.js +124 -0
  55. package/dist/SegmentedControl.d.ts +12 -0
  56. package/dist/SegmentedControl.js +106 -0
  57. package/dist/Select.d.ts +18 -0
  58. package/dist/Select.js +318 -0
  59. package/dist/Sidebar.d.ts +21 -0
  60. package/dist/Sidebar.js +220 -0
  61. package/dist/Skeleton.d.ts +11 -0
  62. package/dist/Skeleton.js +64 -0
  63. package/dist/Slider.d.ts +13 -0
  64. package/dist/Slider.js +151 -0
  65. package/dist/Spinner.d.ts +9 -0
  66. package/dist/Spinner.js +97 -0
  67. package/dist/Switch.d.ts +13 -0
  68. package/dist/Switch.js +116 -0
  69. package/dist/Tabs.d.ts +14 -0
  70. package/dist/Tabs.js +137 -0
  71. package/dist/Text.d.ts +10 -0
  72. package/dist/Text.js +46 -0
  73. package/dist/TextField.d.ts +22 -0
  74. package/dist/TextField.js +213 -0
  75. package/dist/Thumbnail.d.ts +9 -0
  76. package/dist/Thumbnail.js +152 -0
  77. package/dist/Toast.d.ts +14 -0
  78. package/dist/Toast.js +121 -0
  79. package/dist/Tooltip.d.ts +26 -0
  80. package/dist/Tooltip.js +166 -0
  81. package/dist/base.d.ts +11 -0
  82. package/dist/base.js +10 -0
  83. package/dist/index.d.ts +39 -0
  84. package/dist/index.js +39 -0
  85. package/dist/modal-popover.d.ts +7 -0
  86. package/dist/modal-popover.js +37 -0
  87. package/dist/picture.d.ts +13 -0
  88. package/dist/picture.js +76 -0
  89. package/dist/portal.d.ts +9 -0
  90. package/dist/portal.js +27 -0
  91. package/dist/presence.d.ts +6 -0
  92. package/dist/presence.js +34 -0
  93. package/dist/preview.d.ts +17 -0
  94. package/dist/preview.js +126 -0
  95. package/dist/root.d.ts +12 -0
  96. package/dist/root.js +1 -0
  97. package/dist/trigger.d.ts +24 -0
  98. package/dist/trigger.js +47 -0
  99. package/eject/files/Accordion.tsx +157 -0
  100. package/eject/files/Avatar.tsx +41 -0
  101. package/eject/files/AvatarStack.tsx +47 -0
  102. package/eject/files/Badge.tsx +33 -0
  103. package/eject/files/Banner.tsx +70 -0
  104. package/eject/files/Button.tsx +88 -0
  105. package/eject/files/Card.tsx +85 -0
  106. package/eject/files/Checkbox.tsx +59 -0
  107. package/eject/files/Chip.tsx +43 -0
  108. package/eject/files/ChipBar.tsx +31 -0
  109. package/eject/files/CountBadge.tsx +50 -0
  110. package/eject/files/DatePicker.tsx +192 -0
  111. package/eject/files/DateRangePicker.tsx +271 -0
  112. package/eject/files/Dialog.tsx +108 -0
  113. package/eject/files/Divider.tsx +13 -0
  114. package/eject/files/EmptyState.tsx +39 -0
  115. package/eject/files/Icon.tsx +38 -0
  116. package/eject/files/IconButton.tsx +62 -0
  117. package/eject/files/ListRow.tsx +86 -0
  118. package/eject/files/MediaCard.tsx +111 -0
  119. package/eject/files/Menu.tsx +168 -0
  120. package/eject/files/ProgressBar.tsx +34 -0
  121. package/eject/files/RadioGroup.tsx +112 -0
  122. package/eject/files/SearchField.tsx +88 -0
  123. package/eject/files/SectionHeader.tsx +56 -0
  124. package/eject/files/SegmentedControl.tsx +57 -0
  125. package/eject/files/Select.tsx +228 -0
  126. package/eject/files/Sidebar.tsx +149 -0
  127. package/eject/files/Skeleton.tsx +28 -0
  128. package/eject/files/Slider.tsx +109 -0
  129. package/eject/files/Spinner.tsx +36 -0
  130. package/eject/files/Switch.tsx +53 -0
  131. package/eject/files/Tabs.tsx +71 -0
  132. package/eject/files/Text.tsx +31 -0
  133. package/eject/files/TextField.tsx +122 -0
  134. package/eject/files/Thumbnail.tsx +66 -0
  135. package/eject/files/Toast.tsx +88 -0
  136. package/eject/files/Tooltip.tsx +120 -0
  137. package/eject/files/accordion.css +89 -0
  138. package/eject/files/accordion.ts +67 -0
  139. package/eject/files/avatar-stack.ts +57 -0
  140. package/eject/files/avatar.ts +42 -0
  141. package/eject/files/badge.ts +30 -0
  142. package/eject/files/banner.ts +68 -0
  143. package/eject/files/base.css +38 -0
  144. package/eject/files/button.css +241 -0
  145. package/eject/files/button.ts +106 -0
  146. package/eject/files/card.ts +58 -0
  147. package/eject/files/checkbox.ts +32 -0
  148. package/eject/files/chip-bar.ts +16 -0
  149. package/eject/files/chip.ts +35 -0
  150. package/eject/files/count-badge.ts +32 -0
  151. package/eject/files/date-picker.css +352 -0
  152. package/eject/files/date-picker.ts +250 -0
  153. package/eject/files/date-range-picker.ts +323 -0
  154. package/eject/files/dialog.css +139 -0
  155. package/eject/files/dialog.ts +15 -0
  156. package/eject/files/divider.ts +5 -0
  157. package/eject/files/empty-state.ts +22 -0
  158. package/eject/files/icon.ts +36 -0
  159. package/eject/files/list-row.ts +66 -0
  160. package/eject/files/media-card.ts +66 -0
  161. package/eject/files/menu.css +176 -0
  162. package/eject/files/menu.ts +84 -0
  163. package/eject/files/parts.ts +17 -0
  164. package/eject/files/progress-bar.ts +23 -0
  165. package/eject/files/radio-group.css +160 -0
  166. package/eject/files/radio-group.ts +24 -0
  167. package/eject/files/section-header.ts +32 -0
  168. package/eject/files/segmented-control.ts +30 -0
  169. package/eject/files/select.css +285 -0
  170. package/eject/files/select.ts +36 -0
  171. package/eject/files/sidebar.ts +75 -0
  172. package/eject/files/skeleton.ts +51 -0
  173. package/eject/files/slider.css +136 -0
  174. package/eject/files/slider.ts +65 -0
  175. package/eject/files/spinner.ts +22 -0
  176. package/eject/files/switch.ts +34 -0
  177. package/eject/files/tabs.css +112 -0
  178. package/eject/files/tabs.ts +35 -0
  179. package/eject/files/text-field.css +229 -0
  180. package/eject/files/text-field.ts +48 -0
  181. package/eject/files/text.ts +38 -0
  182. package/eject/files/thumbnail.ts +51 -0
  183. package/eject/files/toast.ts +31 -0
  184. package/eject/files/tooltip.css +104 -0
  185. package/eject/files/tooltip.ts +21 -0
  186. package/eject/manifest.json +814 -0
  187. package/package.json +66 -4
  188. package/page.css +20 -0
  189. package/styles.css +3252 -0
  190. package/tailwind.css +2665 -0
@@ -0,0 +1,176 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { classes } from "@xds/core";
3
+ import { useId } from "react";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export function RadioGroup(t0) {
6
+ const $ = _c(40);
7
+ const {
8
+ label,
9
+ options,
10
+ value,
11
+ onChange,
12
+ disabled: t1,
13
+ error,
14
+ name,
15
+ className,
16
+ style
17
+ } = t0;
18
+ const disabled = t1 === undefined ? false : t1;
19
+ const id = useId();
20
+ const labelId = `${id}-label`;
21
+ const errorId = `${id}-error`;
22
+ const invalid = error !== undefined;
23
+ const t2 = invalid ? errorId : undefined;
24
+ const t3 = invalid || undefined;
25
+ const t4 = disabled || undefined;
26
+ let t5;
27
+ if ($[0] !== className) {
28
+ t5 = classes("xds-radio-group", className);
29
+ $[0] = className;
30
+ $[1] = t5;
31
+ } else {
32
+ t5 = $[1];
33
+ }
34
+ let t6;
35
+ if ($[2] !== label || $[3] !== labelId) {
36
+ t6 = /*#__PURE__*/_jsx("span", {
37
+ id: labelId,
38
+ className: "xds-radio-group__label",
39
+ children: label
40
+ });
41
+ $[2] = label;
42
+ $[3] = labelId;
43
+ $[4] = t6;
44
+ } else {
45
+ t6 = $[4];
46
+ }
47
+ let t7;
48
+ if ($[5] !== disabled || $[6] !== errorId || $[7] !== id || $[8] !== invalid || $[9] !== name || $[10] !== onChange || $[11] !== options || $[12] !== value) {
49
+ let t8;
50
+ if ($[14] !== disabled || $[15] !== errorId || $[16] !== id || $[17] !== invalid || $[18] !== name || $[19] !== onChange || $[20] !== value) {
51
+ t8 = (option, index) => /*#__PURE__*/_jsxs("label", {
52
+ className: "xds-radio-group__option",
53
+ children: [/*#__PURE__*/_jsx("input", {
54
+ type: "radio",
55
+ className: "xds-radio-group__input sr-only",
56
+ name: name ?? id,
57
+ value: option.value,
58
+ checked: option.value === value,
59
+ disabled: disabled,
60
+ "aria-labelledby": `${id}-${index}`,
61
+ "aria-describedby": ids(option.description ? `${id}-${index}-description` : undefined, invalid ? errorId : undefined),
62
+ "aria-invalid": invalid || undefined,
63
+ onChange: () => onChange(option.value)
64
+ }), /*#__PURE__*/_jsxs("span", {
65
+ className: "xds-radio-group__row",
66
+ children: [/*#__PURE__*/_jsx("span", {
67
+ className: "xds-radio-group__circle-line",
68
+ children: /*#__PURE__*/_jsx("span", {
69
+ className: "xds-radio-group__circle",
70
+ children: /*#__PURE__*/_jsx("span", {
71
+ className: "xds-radio-group__dot"
72
+ })
73
+ })
74
+ }), /*#__PURE__*/_jsxs("span", {
75
+ className: "xds-radio-group__words",
76
+ children: [/*#__PURE__*/_jsx("span", {
77
+ id: `${id}-${index}`,
78
+ className: "xds-radio-group__text",
79
+ children: option.label
80
+ }), option.description && /*#__PURE__*/_jsx("span", {
81
+ id: `${id}-${index}-description`,
82
+ className: "xds-radio-group__description",
83
+ children: option.description
84
+ })]
85
+ })]
86
+ })]
87
+ }, option.value);
88
+ $[14] = disabled;
89
+ $[15] = errorId;
90
+ $[16] = id;
91
+ $[17] = invalid;
92
+ $[18] = name;
93
+ $[19] = onChange;
94
+ $[20] = value;
95
+ $[21] = t8;
96
+ } else {
97
+ t8 = $[21];
98
+ }
99
+ t7 = options.map(t8);
100
+ $[5] = disabled;
101
+ $[6] = errorId;
102
+ $[7] = id;
103
+ $[8] = invalid;
104
+ $[9] = name;
105
+ $[10] = onChange;
106
+ $[11] = options;
107
+ $[12] = value;
108
+ $[13] = t7;
109
+ } else {
110
+ t7 = $[13];
111
+ }
112
+ let t8;
113
+ if ($[22] !== t7) {
114
+ t8 = /*#__PURE__*/_jsx("div", {
115
+ className: "xds-radio-group__options",
116
+ children: t7
117
+ });
118
+ $[22] = t7;
119
+ $[23] = t8;
120
+ } else {
121
+ t8 = $[23];
122
+ }
123
+ let t9;
124
+ if ($[24] !== error || $[25] !== errorId || $[26] !== invalid) {
125
+ t9 = invalid && /*#__PURE__*/_jsx("span", {
126
+ id: errorId,
127
+ className: "xds-radio-group__error",
128
+ children: error
129
+ });
130
+ $[24] = error;
131
+ $[25] = errorId;
132
+ $[26] = invalid;
133
+ $[27] = t9;
134
+ } else {
135
+ t9 = $[27];
136
+ }
137
+ let t10;
138
+ if ($[28] !== t9) {
139
+ t10 = /*#__PURE__*/_jsx("div", {
140
+ "aria-live": "polite",
141
+ children: t9
142
+ });
143
+ $[28] = t9;
144
+ $[29] = t10;
145
+ } else {
146
+ t10 = $[29];
147
+ }
148
+ let t11;
149
+ if ($[30] !== labelId || $[31] !== style || $[32] !== t10 || $[33] !== t2 || $[34] !== t3 || $[35] !== t4 || $[36] !== t5 || $[37] !== t6 || $[38] !== t8) {
150
+ t11 = /*#__PURE__*/_jsxs("div", {
151
+ role: "radiogroup",
152
+ "aria-labelledby": labelId,
153
+ "aria-describedby": t2,
154
+ "aria-invalid": t3,
155
+ "aria-disabled": t4,
156
+ "aria-orientation": "vertical",
157
+ className: t5,
158
+ style: style,
159
+ children: [t6, t8, t10]
160
+ });
161
+ $[30] = labelId;
162
+ $[31] = style;
163
+ $[32] = t10;
164
+ $[33] = t2;
165
+ $[34] = t3;
166
+ $[35] = t4;
167
+ $[36] = t5;
168
+ $[37] = t6;
169
+ $[38] = t8;
170
+ $[39] = t11;
171
+ } else {
172
+ t11 = $[39];
173
+ }
174
+ return t11;
175
+ }
176
+ const ids = (...all) => all.filter(Boolean).join(" ") || undefined;
@@ -0,0 +1,15 @@
1
+ import { type SearchFieldBaseProps } from "@xds/core";
2
+ import type { RootProps } from "./root.ts";
3
+ export type SearchFieldProps = SearchFieldBaseProps & RootProps & {
4
+ onChange: (value: string) => void;
5
+ /** Called with the query on Enter, or on the search key of a software keyboard. */
6
+ onSubmit?: (value: string) => void;
7
+ };
8
+ /**
9
+ * A text field for a query: TextField's box as a pill, with a search icon in front and, while
10
+ * there is a value, a control that clears it. Escape clears too.
11
+ *
12
+ * Use it to filter or search what is on the screen. For a value that is saved with a form,
13
+ * use a TextField, which has a visible label.
14
+ */
15
+ export declare function SearchField({ value, onChange, onSubmit, label, placeholder, disabled, clearLabel, className, style, }: SearchFieldProps): import("react").JSX.Element;
@@ -0,0 +1,152 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { classes, rootPart } from "@xds/core";
3
+ import { useRef } from "react";
4
+ import { Icon } from "./Icon.js";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ export function SearchField(t0) {
7
+ const $ = _c(29);
8
+ const {
9
+ value,
10
+ onChange,
11
+ onSubmit,
12
+ label,
13
+ placeholder,
14
+ disabled: t1,
15
+ clearLabel: t2,
16
+ className,
17
+ style
18
+ } = t0;
19
+ const disabled = t1 === undefined ? false : t1;
20
+ const clearLabel = t2 === undefined ? "Clear" : t2;
21
+ const input = useRef(null);
22
+ let t3;
23
+ if ($[0] !== className) {
24
+ t3 = classes("xds-text-field", rootPart("SearchField"), className);
25
+ $[0] = className;
26
+ $[1] = t3;
27
+ } else {
28
+ t3 = $[1];
29
+ }
30
+ let t4;
31
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
32
+ t4 = /*#__PURE__*/_jsx("span", {
33
+ className: "xds-text-field__slot xds-text-field__slot--leading",
34
+ children: /*#__PURE__*/_jsx(Icon, {
35
+ name: "search",
36
+ size: "sm"
37
+ })
38
+ });
39
+ $[2] = t4;
40
+ } else {
41
+ t4 = $[2];
42
+ }
43
+ const t5 = value !== "" ? "" : undefined;
44
+ let t6;
45
+ if ($[3] !== onChange) {
46
+ t6 = event => onChange(event.currentTarget.value);
47
+ $[3] = onChange;
48
+ $[4] = t6;
49
+ } else {
50
+ t6 = $[4];
51
+ }
52
+ let t7;
53
+ if ($[5] !== onChange || $[6] !== onSubmit || $[7] !== value) {
54
+ t7 = event_0 => {
55
+ if (event_0.nativeEvent.isComposing) {
56
+ return;
57
+ }
58
+ if (event_0.key === "Enter") {
59
+ onSubmit?.(value);
60
+ }
61
+ if (event_0.key === "Escape" && value !== "") {
62
+ event_0.stopPropagation();
63
+ onChange("");
64
+ }
65
+ };
66
+ $[5] = onChange;
67
+ $[6] = onSubmit;
68
+ $[7] = value;
69
+ $[8] = t7;
70
+ } else {
71
+ t7 = $[8];
72
+ }
73
+ let t8;
74
+ if ($[9] !== disabled || $[10] !== label || $[11] !== placeholder || $[12] !== t5 || $[13] !== t6 || $[14] !== t7 || $[15] !== value) {
75
+ t8 = /*#__PURE__*/_jsx("input", {
76
+ ref: input,
77
+ type: "text",
78
+ className: "xds-text-field__input",
79
+ "aria-label": label,
80
+ enterKeyHint: "search",
81
+ placeholder: placeholder,
82
+ value: value,
83
+ disabled: disabled,
84
+ "data-uses-escape": t5,
85
+ onChange: t6,
86
+ onKeyDown: t7
87
+ });
88
+ $[9] = disabled;
89
+ $[10] = label;
90
+ $[11] = placeholder;
91
+ $[12] = t5;
92
+ $[13] = t6;
93
+ $[14] = t7;
94
+ $[15] = value;
95
+ $[16] = t8;
96
+ } else {
97
+ t8 = $[16];
98
+ }
99
+ let t9;
100
+ if ($[17] !== clearLabel || $[18] !== disabled || $[19] !== onChange || $[20] !== value) {
101
+ t9 = value !== "" && !disabled && /*#__PURE__*/_jsx("span", {
102
+ className: "xds-text-field__slot xds-text-field__slot--trailing",
103
+ children: /*#__PURE__*/_jsx("button", {
104
+ type: "button",
105
+ "aria-label": clearLabel,
106
+ onClick: () => {
107
+ onChange("");
108
+ input.current?.focus();
109
+ },
110
+ className: "-me-1 flex size-xds-target-min cursor-pointer items-center justify-center rounded-xds-full hover:text-xds-field-text focus-visible:outline-(length:--xds-focus-width) focus-visible:outline-xds-border-focus focus-visible:outline-solid",
111
+ children: /*#__PURE__*/_jsx(Icon, {
112
+ name: "circle-x",
113
+ size: "sm"
114
+ })
115
+ })
116
+ });
117
+ $[17] = clearLabel;
118
+ $[18] = disabled;
119
+ $[19] = onChange;
120
+ $[20] = value;
121
+ $[21] = t9;
122
+ } else {
123
+ t9 = $[21];
124
+ }
125
+ let t10;
126
+ if ($[22] !== t8 || $[23] !== t9) {
127
+ t10 = /*#__PURE__*/_jsxs("div", {
128
+ className: "xds-text-field__control xds-text-field__control--pill xds-text-field__group",
129
+ children: [t4, t8, t9]
130
+ });
131
+ $[22] = t8;
132
+ $[23] = t9;
133
+ $[24] = t10;
134
+ } else {
135
+ t10 = $[24];
136
+ }
137
+ let t11;
138
+ if ($[25] !== style || $[26] !== t10 || $[27] !== t3) {
139
+ t11 = /*#__PURE__*/_jsx("div", {
140
+ className: t3,
141
+ style: style,
142
+ children: t10
143
+ });
144
+ $[25] = style;
145
+ $[26] = t10;
146
+ $[27] = t3;
147
+ $[28] = t11;
148
+ } else {
149
+ t11 = $[28];
150
+ }
151
+ return t11;
152
+ }
@@ -0,0 +1,14 @@
1
+ import { type SectionHeaderBaseProps } from "@xds/core";
2
+ import type { RootProps } from "./root.ts";
3
+ export type SectionHeaderProps = SectionHeaderBaseProps & RootProps & {
4
+ /** A link-like action at the end, such as "See all". */
5
+ action?: {
6
+ label: string;
7
+ onPress: () => void;
8
+ };
9
+ };
10
+ /**
11
+ * The title row of a group of content. The title is a heading at `level`; the action is a quiet
12
+ * button with a chevron at its end edge, which points the other way in a right-to-left layout.
13
+ */
14
+ export declare function SectionHeader({ title, description, icon, action, level, className, style, }: SectionHeaderProps): import("react").JSX.Element;
@@ -0,0 +1,124 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { classes, rootPart, SECTION_HEADER_PARTS } from "@xds/core";
3
+ import { Button } from "./Button.js";
4
+ import { Icon } from "./Icon.js";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ export function SectionHeader(t0) {
7
+ const $ = _c(22);
8
+ const {
9
+ title,
10
+ description,
11
+ icon,
12
+ action,
13
+ level: t1,
14
+ className,
15
+ style
16
+ } = t0;
17
+ const level = t1 === undefined ? 2 : t1;
18
+ const Heading = `h${level}`;
19
+ let t2;
20
+ if ($[0] !== className) {
21
+ t2 = classes(rootPart("SectionHeader"), SECTION_HEADER_PARTS.root, className);
22
+ $[0] = className;
23
+ $[1] = t2;
24
+ } else {
25
+ t2 = $[1];
26
+ }
27
+ let t3;
28
+ if ($[2] !== icon) {
29
+ t3 = icon && /*#__PURE__*/_jsx("span", {
30
+ className: SECTION_HEADER_PARTS.icon,
31
+ children: /*#__PURE__*/_jsx(Icon, {
32
+ name: icon,
33
+ size: "md"
34
+ })
35
+ });
36
+ $[2] = icon;
37
+ $[3] = t3;
38
+ } else {
39
+ t3 = $[3];
40
+ }
41
+ let t4;
42
+ if ($[4] !== Heading || $[5] !== title) {
43
+ t4 = /*#__PURE__*/_jsx(Heading, {
44
+ className: SECTION_HEADER_PARTS.title,
45
+ children: title
46
+ });
47
+ $[4] = Heading;
48
+ $[5] = title;
49
+ $[6] = t4;
50
+ } else {
51
+ t4 = $[6];
52
+ }
53
+ let t5;
54
+ if ($[7] !== description) {
55
+ t5 = description && /*#__PURE__*/_jsx("p", {
56
+ className: SECTION_HEADER_PARTS.description,
57
+ children: description
58
+ });
59
+ $[7] = description;
60
+ $[8] = t5;
61
+ } else {
62
+ t5 = $[8];
63
+ }
64
+ let t6;
65
+ if ($[9] !== t4 || $[10] !== t5) {
66
+ t6 = /*#__PURE__*/_jsxs("div", {
67
+ className: SECTION_HEADER_PARTS.text,
68
+ children: [t4, t5]
69
+ });
70
+ $[9] = t4;
71
+ $[10] = t5;
72
+ $[11] = t6;
73
+ } else {
74
+ t6 = $[11];
75
+ }
76
+ let t7;
77
+ if ($[12] !== t3 || $[13] !== t6) {
78
+ t7 = /*#__PURE__*/_jsxs("div", {
79
+ className: SECTION_HEADER_PARTS.lead,
80
+ children: [t3, t6]
81
+ });
82
+ $[12] = t3;
83
+ $[13] = t6;
84
+ $[14] = t7;
85
+ } else {
86
+ t7 = $[14];
87
+ }
88
+ let t8;
89
+ if ($[15] !== action) {
90
+ t8 = action && /*#__PURE__*/_jsx("span", {
91
+ className: SECTION_HEADER_PARTS.action,
92
+ children: /*#__PURE__*/_jsxs(Button, {
93
+ variant: "ghost",
94
+ size: "sm",
95
+ onPress: action.onPress,
96
+ children: [action.label, /*#__PURE__*/_jsx(Icon, {
97
+ name: "chevron-right",
98
+ size: "sm",
99
+ className: SECTION_HEADER_PARTS.chevron
100
+ })]
101
+ })
102
+ });
103
+ $[15] = action;
104
+ $[16] = t8;
105
+ } else {
106
+ t8 = $[16];
107
+ }
108
+ let t9;
109
+ if ($[17] !== style || $[18] !== t2 || $[19] !== t7 || $[20] !== t8) {
110
+ t9 = /*#__PURE__*/_jsxs("div", {
111
+ className: t2,
112
+ style: style,
113
+ children: [t7, t8]
114
+ });
115
+ $[17] = style;
116
+ $[18] = t2;
117
+ $[19] = t7;
118
+ $[20] = t8;
119
+ $[21] = t9;
120
+ } else {
121
+ t9 = $[21];
122
+ }
123
+ return t9;
124
+ }
@@ -0,0 +1,12 @@
1
+ import { type SegmentedControlBaseProps } from "@xds/core";
2
+ import type { RootProps } from "./root.ts";
3
+ export type SegmentedControlProps<Value extends string> = SegmentedControlBaseProps<Value> & RootProps & {
4
+ onChange: (value: Value) => void;
5
+ };
6
+ /**
7
+ * A choice between a few views or modes, all visible at once. The selected segment is outlined
8
+ * as well as filled, so the choice does not depend on telling two greys apart.
9
+ *
10
+ * It is a group of native radio buttons, so the arrow keys move between segments.
11
+ */
12
+ export declare function SegmentedControl<Value extends string>({ options, value, onChange, fullWidth, className, style, ...aria }: SegmentedControlProps<Value>): import("react").JSX.Element;
@@ -0,0 +1,106 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { classes, rootPart, segmentedControlClass, segmentedControlOptionClass, segmentedControlSegmentClass } from "@xds/core";
3
+ import { useId } from "react";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export function SegmentedControl(t0) {
6
+ const $ = _c(27);
7
+ let aria;
8
+ let className;
9
+ let onChange;
10
+ let options;
11
+ let style;
12
+ let t1;
13
+ let value;
14
+ if ($[0] !== t0) {
15
+ ({
16
+ options,
17
+ value,
18
+ onChange,
19
+ fullWidth: t1,
20
+ className,
21
+ style,
22
+ ...aria
23
+ } = t0);
24
+ $[0] = t0;
25
+ $[1] = aria;
26
+ $[2] = className;
27
+ $[3] = onChange;
28
+ $[4] = options;
29
+ $[5] = style;
30
+ $[6] = t1;
31
+ $[7] = value;
32
+ } else {
33
+ aria = $[1];
34
+ className = $[2];
35
+ onChange = $[3];
36
+ options = $[4];
37
+ style = $[5];
38
+ t1 = $[6];
39
+ value = $[7];
40
+ }
41
+ const fullWidth = t1 === undefined ? false : t1;
42
+ const name = useId();
43
+ let t2;
44
+ if ($[8] !== className || $[9] !== fullWidth) {
45
+ t2 = classes(rootPart("SegmentedControl"), segmentedControlClass(fullWidth), className);
46
+ $[8] = className;
47
+ $[9] = fullWidth;
48
+ $[10] = t2;
49
+ } else {
50
+ t2 = $[10];
51
+ }
52
+ let t3;
53
+ if ($[11] !== fullWidth || $[12] !== name || $[13] !== onChange || $[14] !== options || $[15] !== value) {
54
+ let t4;
55
+ if ($[17] !== fullWidth || $[18] !== name || $[19] !== onChange || $[20] !== value) {
56
+ t4 = option => /*#__PURE__*/_jsxs("label", {
57
+ className: segmentedControlOptionClass(fullWidth),
58
+ children: [/*#__PURE__*/_jsx("input", {
59
+ type: "radio",
60
+ name: name,
61
+ value: option.value,
62
+ className: "peer sr-only",
63
+ checked: option.value === value,
64
+ onChange: () => onChange(option.value)
65
+ }), /*#__PURE__*/_jsx("span", {
66
+ className: segmentedControlSegmentClass,
67
+ children: option.label
68
+ })]
69
+ }, option.value);
70
+ $[17] = fullWidth;
71
+ $[18] = name;
72
+ $[19] = onChange;
73
+ $[20] = value;
74
+ $[21] = t4;
75
+ } else {
76
+ t4 = $[21];
77
+ }
78
+ t3 = options.map(t4);
79
+ $[11] = fullWidth;
80
+ $[12] = name;
81
+ $[13] = onChange;
82
+ $[14] = options;
83
+ $[15] = value;
84
+ $[16] = t3;
85
+ } else {
86
+ t3 = $[16];
87
+ }
88
+ let t4;
89
+ if ($[22] !== aria || $[23] !== style || $[24] !== t2 || $[25] !== t3) {
90
+ t4 = /*#__PURE__*/_jsx("div", {
91
+ ...aria,
92
+ role: "radiogroup",
93
+ className: t2,
94
+ style: style,
95
+ children: t3
96
+ });
97
+ $[22] = aria;
98
+ $[23] = style;
99
+ $[24] = t2;
100
+ $[25] = t3;
101
+ $[26] = t4;
102
+ } else {
103
+ t4 = $[26];
104
+ }
105
+ return t4;
106
+ }
@@ -0,0 +1,18 @@
1
+ import { type SelectBaseProps } from "@xds/core";
2
+ import type { RootProps } from "./root.ts";
3
+ export type { SelectOption } from "@xds/core";
4
+ /** `className` and `style` are for the field, not for the list that opens from it. */
5
+ export type SelectProps<Value extends string = string> = SelectBaseProps<Value> & RootProps & {
6
+ onChange: (value: Value) => void;
7
+ };
8
+ /**
9
+ * A field for choosing one option from a list too long to show at once. Closed, it looks like a
10
+ * TextField; pressed, it opens the list under itself with a Menu's surface, as wide as the
11
+ * field. Choosing an option calls `onChange` and closes the list; a press outside or Escape
12
+ * closes it too.
13
+ *
14
+ * The field is a button that says it opens a list box and whether the list is open. In the list
15
+ * the arrow keys move, typing jumps to an option, and Enter chooses. The chosen option is
16
+ * selected for assistive technology and marked with a check.
17
+ */
18
+ export declare function Select<Value extends string = string>({ label, options, value, onChange, placeholder, description, error, name, disabled, className, style, }: SelectProps<Value>): import("react").JSX.Element;