@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
package/dist/Banner.js ADDED
@@ -0,0 +1,166 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { BANNER_PARTS, bannerClass, bannerIconClass, bannerIconPath, bannerRole, classes, rootPart } from "@xds/core";
3
+ import { Button } from "./Button.js";
4
+ import { useDefaults } from "./Defaults.js";
5
+ import { IconButton } from "./IconButton.js";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ export function Banner(props) {
8
+ const $ = _c(34);
9
+ const defaults = useDefaults("Banner");
10
+ const {
11
+ title,
12
+ action,
13
+ onDismiss,
14
+ dismissLabel: t0,
15
+ className,
16
+ style,
17
+ children
18
+ } = props;
19
+ const dismissLabel = t0 === undefined ? "Dismiss" : t0;
20
+ const tone = props.tone ?? defaults.tone;
21
+ let t1;
22
+ if ($[0] !== tone) {
23
+ t1 = bannerRole(tone);
24
+ $[0] = tone;
25
+ $[1] = t1;
26
+ } else {
27
+ t1 = $[1];
28
+ }
29
+ let t2;
30
+ if ($[2] !== className || $[3] !== tone) {
31
+ t2 = classes(rootPart("Banner"), bannerClass(tone), className);
32
+ $[2] = className;
33
+ $[3] = tone;
34
+ $[4] = t2;
35
+ } else {
36
+ t2 = $[4];
37
+ }
38
+ let t3;
39
+ if ($[5] !== tone) {
40
+ t3 = bannerIconClass(tone);
41
+ $[5] = tone;
42
+ $[6] = t3;
43
+ } else {
44
+ t3 = $[6];
45
+ }
46
+ let t4;
47
+ if ($[7] !== tone) {
48
+ t4 = bannerIconPath(tone);
49
+ $[7] = tone;
50
+ $[8] = t4;
51
+ } else {
52
+ t4 = $[8];
53
+ }
54
+ let t5;
55
+ if ($[9] !== t4) {
56
+ t5 = /*#__PURE__*/_jsx("path", {
57
+ fill: "currentColor",
58
+ d: t4
59
+ });
60
+ $[9] = t4;
61
+ $[10] = t5;
62
+ } else {
63
+ t5 = $[10];
64
+ }
65
+ let t6;
66
+ if ($[11] !== t3 || $[12] !== t5) {
67
+ t6 = /*#__PURE__*/_jsx("svg", {
68
+ viewBox: "0 0 24 24",
69
+ "aria-hidden": "true",
70
+ className: t3,
71
+ children: t5
72
+ });
73
+ $[11] = t3;
74
+ $[12] = t5;
75
+ $[13] = t6;
76
+ } else {
77
+ t6 = $[13];
78
+ }
79
+ let t7;
80
+ if ($[14] !== title) {
81
+ t7 = title && /*#__PURE__*/_jsx("p", {
82
+ className: BANNER_PARTS.title,
83
+ children: title
84
+ });
85
+ $[14] = title;
86
+ $[15] = t7;
87
+ } else {
88
+ t7 = $[15];
89
+ }
90
+ let t8;
91
+ if ($[16] !== children) {
92
+ t8 = /*#__PURE__*/_jsx("div", {
93
+ children: children
94
+ });
95
+ $[16] = children;
96
+ $[17] = t8;
97
+ } else {
98
+ t8 = $[17];
99
+ }
100
+ let t9;
101
+ if ($[18] !== action) {
102
+ t9 = action && /*#__PURE__*/_jsx("div", {
103
+ className: BANNER_PARTS.action,
104
+ children: /*#__PURE__*/_jsx(Button, {
105
+ variant: "secondary",
106
+ size: "sm",
107
+ onPress: action.onPress,
108
+ children: action.label
109
+ })
110
+ });
111
+ $[18] = action;
112
+ $[19] = t9;
113
+ } else {
114
+ t9 = $[19];
115
+ }
116
+ let t10;
117
+ if ($[20] !== t7 || $[21] !== t8 || $[22] !== t9) {
118
+ t10 = /*#__PURE__*/_jsxs("div", {
119
+ className: BANNER_PARTS.body,
120
+ children: [t7, t8, t9]
121
+ });
122
+ $[20] = t7;
123
+ $[21] = t8;
124
+ $[22] = t9;
125
+ $[23] = t10;
126
+ } else {
127
+ t10 = $[23];
128
+ }
129
+ let t11;
130
+ if ($[24] !== dismissLabel || $[25] !== onDismiss) {
131
+ t11 = onDismiss && /*#__PURE__*/_jsx("div", {
132
+ className: BANNER_PARTS.dismiss,
133
+ children: /*#__PURE__*/_jsx(IconButton, {
134
+ icon: "x",
135
+ label: dismissLabel,
136
+ variant: "ghost",
137
+ size: "sm",
138
+ onPress: onDismiss
139
+ })
140
+ });
141
+ $[24] = dismissLabel;
142
+ $[25] = onDismiss;
143
+ $[26] = t11;
144
+ } else {
145
+ t11 = $[26];
146
+ }
147
+ let t12;
148
+ if ($[27] !== style || $[28] !== t1 || $[29] !== t10 || $[30] !== t11 || $[31] !== t2 || $[32] !== t6) {
149
+ t12 = /*#__PURE__*/_jsxs("div", {
150
+ role: t1,
151
+ className: t2,
152
+ style: style,
153
+ children: [t6, t10, t11]
154
+ });
155
+ $[27] = style;
156
+ $[28] = t1;
157
+ $[29] = t10;
158
+ $[30] = t11;
159
+ $[31] = t2;
160
+ $[32] = t6;
161
+ $[33] = t12;
162
+ } else {
163
+ t12 = $[33];
164
+ }
165
+ return t12;
166
+ }
@@ -0,0 +1,14 @@
1
+ import { type ButtonBaseProps } from "@xds/core";
2
+ import type { ReactNode } from "react";
3
+ import type { RootProps } from "./root.ts";
4
+ export type { ButtonVariant, ControlSize } from "@xds/core";
5
+ export type ButtonProps = ButtonBaseProps & RootProps & {
6
+ onPress?: () => void;
7
+ /** Leave it out for a button that holds only an icon, and name that one with `aria-label`. */
8
+ children?: ReactNode;
9
+ };
10
+ /**
11
+ * A native button. It also opens a Menu or a Tooltip it is the trigger of: their props reach
12
+ * it through context.
13
+ */
14
+ export declare function Button(props: ButtonProps): import("react").JSX.Element;
package/dist/Button.js ADDED
@@ -0,0 +1,159 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { BUTTON_ICON, buttonClass, classes, isHeld } from "@xds/core";
3
+ import { useDefaults } from "./Defaults.js";
4
+ import { Icon } from "./Icon.js";
5
+ import { Spinner } from "./Spinner.js";
6
+ import { useTrigger } from "./trigger.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export function Button(props) {
9
+ const $ = _c(41);
10
+ const defaults = useDefaults("Button");
11
+ const {
12
+ iconStart,
13
+ iconEnd,
14
+ selected,
15
+ disabled: t0,
16
+ loading: t1,
17
+ fullWidth: t2,
18
+ type: t3,
19
+ onPress,
20
+ "aria-label": label,
21
+ className,
22
+ style,
23
+ children
24
+ } = props;
25
+ const disabled = t0 === undefined ? false : t0;
26
+ const loading = t1 === undefined ? false : t1;
27
+ const fullWidth = t2 === undefined ? false : t2;
28
+ const type = t3 === undefined ? "button" : t3;
29
+ const variant = props.variant ?? defaults.variant ?? "secondary";
30
+ const size = props.size ?? defaults.size ?? "md";
31
+ const icon = BUTTON_ICON[size];
32
+ let t4;
33
+ if ($[0] !== children || $[1] !== className || $[2] !== fullWidth || $[3] !== iconEnd || $[4] !== iconStart || $[5] !== size || $[6] !== variant) {
34
+ t4 = classes(buttonClass({
35
+ variant,
36
+ size,
37
+ iconOnly: children == null && (iconStart !== undefined || iconEnd !== undefined),
38
+ fullWidth
39
+ }), className);
40
+ $[0] = children;
41
+ $[1] = className;
42
+ $[2] = fullWidth;
43
+ $[3] = iconEnd;
44
+ $[4] = iconStart;
45
+ $[5] = size;
46
+ $[6] = variant;
47
+ $[7] = t4;
48
+ } else {
49
+ t4 = $[7];
50
+ }
51
+ const t5 = loading || undefined;
52
+ const t6 = loading ? "" : undefined;
53
+ let t7;
54
+ if ($[8] !== loading || $[9] !== onPress) {
55
+ t7 = () => {
56
+ if (!loading) {
57
+ onPress?.();
58
+ }
59
+ };
60
+ $[8] = loading;
61
+ $[9] = onPress;
62
+ $[10] = t7;
63
+ } else {
64
+ t7 = $[10];
65
+ }
66
+ let t8;
67
+ if ($[11] !== disabled || $[12] !== label || $[13] !== selected || $[14] !== style || $[15] !== t4 || $[16] !== t5 || $[17] !== t6 || $[18] !== t7) {
68
+ t8 = {
69
+ className: t4,
70
+ style,
71
+ disabled,
72
+ "aria-disabled": t5,
73
+ "data-pending": t6,
74
+ "aria-pressed": selected,
75
+ "aria-label": label,
76
+ onClick: t7
77
+ };
78
+ $[11] = disabled;
79
+ $[12] = label;
80
+ $[13] = selected;
81
+ $[14] = style;
82
+ $[15] = t4;
83
+ $[16] = t5;
84
+ $[17] = t6;
85
+ $[18] = t7;
86
+ $[19] = t8;
87
+ } else {
88
+ t8 = $[19];
89
+ }
90
+ const attributes = useTrigger(t8, loading);
91
+ let t9;
92
+ if ($[20] !== icon || $[21] !== iconStart || $[22] !== loading) {
93
+ t9 = loading && (iconStart ? /*#__PURE__*/_jsx("span", {
94
+ className: icon.box,
95
+ children: /*#__PURE__*/_jsx(Spinner, {
96
+ size: "sm"
97
+ })
98
+ }) : /*#__PURE__*/_jsx(Spinner, {
99
+ size: "sm"
100
+ }));
101
+ $[20] = icon;
102
+ $[21] = iconStart;
103
+ $[22] = loading;
104
+ $[23] = t9;
105
+ } else {
106
+ t9 = $[23];
107
+ }
108
+ let t10;
109
+ if ($[24] !== disabled || $[25] !== icon || $[26] !== iconStart || $[27] !== loading || $[28] !== selected || $[29] !== variant) {
110
+ t10 = iconStart && !loading && /*#__PURE__*/_jsx(Icon, {
111
+ name: iconStart,
112
+ size: icon.size,
113
+ filled: isHeld({
114
+ variant,
115
+ selected,
116
+ disabled
117
+ })
118
+ });
119
+ $[24] = disabled;
120
+ $[25] = icon;
121
+ $[26] = iconStart;
122
+ $[27] = loading;
123
+ $[28] = selected;
124
+ $[29] = variant;
125
+ $[30] = t10;
126
+ } else {
127
+ t10 = $[30];
128
+ }
129
+ let t11;
130
+ if ($[31] !== icon || $[32] !== iconEnd) {
131
+ t11 = iconEnd && /*#__PURE__*/_jsx(Icon, {
132
+ name: iconEnd,
133
+ size: icon.size
134
+ });
135
+ $[31] = icon;
136
+ $[32] = iconEnd;
137
+ $[33] = t11;
138
+ } else {
139
+ t11 = $[33];
140
+ }
141
+ let t12;
142
+ if ($[34] !== attributes || $[35] !== children || $[36] !== t10 || $[37] !== t11 || $[38] !== t9 || $[39] !== type) {
143
+ t12 = /*#__PURE__*/_jsxs("button", {
144
+ ...attributes,
145
+ type: type,
146
+ children: [t9, t10, children, t11]
147
+ });
148
+ $[34] = attributes;
149
+ $[35] = children;
150
+ $[36] = t10;
151
+ $[37] = t11;
152
+ $[38] = t9;
153
+ $[39] = type;
154
+ $[40] = t12;
155
+ } else {
156
+ t12 = $[40];
157
+ }
158
+ return t12;
159
+ }
package/dist/Card.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { type CardBaseProps } from "@xds/core";
2
+ import type { ReactNode } from "react";
3
+ import type { RootProps } from "./root.ts";
4
+ export type CardProps = CardBaseProps & RootProps & {
5
+ /** Sit across from the title. A pressable card takes none: it is one button already. */
6
+ actions?: ReactNode;
7
+ /** A picture or a drawing at the top, running edge to edge above the padding. */
8
+ media?: ReactNode;
9
+ /** Makes the whole card one button. Put no other control inside it then. */
10
+ onPress?: () => void;
11
+ children?: ReactNode;
12
+ };
13
+ /**
14
+ * A surface that groups related content. A hairline outline and a trace of shadow lift it off
15
+ * the page; in dark mode, where shadows barely show, the lighter fill does that. `title`
16
+ * renders as a heading; `actions` sit across from it.
17
+ */
18
+ export declare function Card({ title, description, actions, media, flush, onPress, selected, className, style, children, }: CardProps): import("react").JSX.Element;
package/dist/Card.js ADDED
@@ -0,0 +1,173 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { CARD_PARTS, cardClass, cardMediaClass, classes, rootPart } from "@xds/core";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
+ export function Card(t0) {
5
+ const $ = _c(43);
6
+ const {
7
+ title,
8
+ description,
9
+ actions,
10
+ media,
11
+ flush: t1,
12
+ onPress,
13
+ selected,
14
+ className,
15
+ style,
16
+ children
17
+ } = t0;
18
+ const flush = t1 === undefined ? false : t1;
19
+ let t2;
20
+ if ($[0] !== className || $[1] !== flush || $[2] !== onPress || $[3] !== selected) {
21
+ t2 = classes(rootPart("Card"), cardClass({
22
+ selected,
23
+ flush,
24
+ pressable: onPress !== undefined
25
+ }), className);
26
+ $[0] = className;
27
+ $[1] = flush;
28
+ $[2] = onPress;
29
+ $[3] = selected;
30
+ $[4] = t2;
31
+ } else {
32
+ t2 = $[4];
33
+ }
34
+ const surface = t2;
35
+ let t3;
36
+ if ($[5] !== onPress) {
37
+ t3 = onPress ? ["span", "span", "span", "span"] : ["header", "div", "h2", "p"];
38
+ $[5] = onPress;
39
+ $[6] = t3;
40
+ } else {
41
+ t3 = $[6];
42
+ }
43
+ const [Header, Box, Title, Line] = t3;
44
+ let t4;
45
+ if ($[7] !== Box || $[8] !== flush || $[9] !== media) {
46
+ t4 = media != null && /*#__PURE__*/_jsx(Box, {
47
+ className: cardMediaClass(flush),
48
+ children: media
49
+ });
50
+ $[7] = Box;
51
+ $[8] = flush;
52
+ $[9] = media;
53
+ $[10] = t4;
54
+ } else {
55
+ t4 = $[10];
56
+ }
57
+ let t5;
58
+ if ($[11] !== Box || $[12] !== Header || $[13] !== Line || $[14] !== Title || $[15] !== actions || $[16] !== description || $[17] !== onPress || $[18] !== title) {
59
+ t5 = (title || actions && !onPress) && /*#__PURE__*/_jsxs(Header, {
60
+ className: CARD_PARTS.header,
61
+ children: [/*#__PURE__*/_jsxs(Box, {
62
+ className: CARD_PARTS.heading,
63
+ children: [title && /*#__PURE__*/_jsx(Title, {
64
+ className: CARD_PARTS.title,
65
+ children: title
66
+ }), description && /*#__PURE__*/_jsx(Line, {
67
+ className: CARD_PARTS.description,
68
+ children: description
69
+ })]
70
+ }), actions && !onPress && /*#__PURE__*/_jsx("div", {
71
+ className: CARD_PARTS.actions,
72
+ children: actions
73
+ })]
74
+ });
75
+ $[11] = Box;
76
+ $[12] = Header;
77
+ $[13] = Line;
78
+ $[14] = Title;
79
+ $[15] = actions;
80
+ $[16] = description;
81
+ $[17] = onPress;
82
+ $[18] = title;
83
+ $[19] = t5;
84
+ } else {
85
+ t5 = $[19];
86
+ }
87
+ let t6;
88
+ if ($[20] !== children || $[21] !== t4 || $[22] !== t5) {
89
+ t6 = /*#__PURE__*/_jsxs(_Fragment, {
90
+ children: [t4, t5, children]
91
+ });
92
+ $[20] = children;
93
+ $[21] = t4;
94
+ $[22] = t5;
95
+ $[23] = t6;
96
+ } else {
97
+ t6 = $[23];
98
+ }
99
+ const parts = t6;
100
+ let t7;
101
+ if ($[24] !== Box || $[25] !== flush || $[26] !== parts) {
102
+ t7 = flush ? /*#__PURE__*/_jsx(Box, {
103
+ className: CARD_PARTS.flush,
104
+ children: parts
105
+ }) : parts;
106
+ $[24] = Box;
107
+ $[25] = flush;
108
+ $[26] = parts;
109
+ $[27] = t7;
110
+ } else {
111
+ t7 = $[27];
112
+ }
113
+ const content = t7;
114
+ if (!onPress) {
115
+ let t8;
116
+ if ($[28] !== selected) {
117
+ t8 = selected ? {
118
+ "aria-current": "true"
119
+ } : {};
120
+ $[28] = selected;
121
+ $[29] = t8;
122
+ } else {
123
+ t8 = $[29];
124
+ }
125
+ let t9;
126
+ if ($[30] !== content || $[31] !== style || $[32] !== surface || $[33] !== t8) {
127
+ t9 = /*#__PURE__*/_jsx("section", {
128
+ ...t8,
129
+ className: surface,
130
+ style: style,
131
+ children: content
132
+ });
133
+ $[30] = content;
134
+ $[31] = style;
135
+ $[32] = surface;
136
+ $[33] = t8;
137
+ $[34] = t9;
138
+ } else {
139
+ t9 = $[34];
140
+ }
141
+ return t9;
142
+ }
143
+ let t8;
144
+ if ($[35] !== selected) {
145
+ t8 = selected === undefined ? {} : {
146
+ "aria-pressed": selected
147
+ };
148
+ $[35] = selected;
149
+ $[36] = t8;
150
+ } else {
151
+ t8 = $[36];
152
+ }
153
+ let t9;
154
+ if ($[37] !== content || $[38] !== onPress || $[39] !== style || $[40] !== surface || $[41] !== t8) {
155
+ t9 = /*#__PURE__*/_jsx("button", {
156
+ type: "button",
157
+ onClick: onPress,
158
+ ...t8,
159
+ className: surface,
160
+ style: style,
161
+ children: content
162
+ });
163
+ $[37] = content;
164
+ $[38] = onPress;
165
+ $[39] = style;
166
+ $[40] = surface;
167
+ $[41] = t8;
168
+ $[42] = t9;
169
+ } else {
170
+ t9 = $[42];
171
+ }
172
+ return t9;
173
+ }
@@ -0,0 +1,10 @@
1
+ import { type CheckboxBaseProps } from "@xds/core";
2
+ import type { RootProps } from "./root.ts";
3
+ export type CheckboxProps = CheckboxBaseProps & RootProps & {
4
+ onChange: (checked: boolean) => void;
5
+ };
6
+ /**
7
+ * A choice that is applied later, with the form it belongs to. A native checkbox: the input is
8
+ * hidden and the box is drawn beside it.
9
+ */
10
+ export declare function Checkbox({ checked, onChange, label, name, disabled, className, style, ...aria }: CheckboxProps): import("react").JSX.Element;
@@ -0,0 +1,140 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { CHECKBOX_MARK, checkboxBoxClass, checkboxClass, checkboxLabelClass, checkboxMarkClass, classes, rootPart } from "@xds/core";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ export function Checkbox(t0) {
5
+ const $ = _c(29);
6
+ let aria;
7
+ let checked;
8
+ let className;
9
+ let label;
10
+ let name;
11
+ let onChange;
12
+ let style;
13
+ let t1;
14
+ if ($[0] !== t0) {
15
+ ({
16
+ checked,
17
+ onChange,
18
+ label,
19
+ name,
20
+ disabled: t1,
21
+ className,
22
+ style,
23
+ ...aria
24
+ } = t0);
25
+ $[0] = t0;
26
+ $[1] = aria;
27
+ $[2] = checked;
28
+ $[3] = className;
29
+ $[4] = label;
30
+ $[5] = name;
31
+ $[6] = onChange;
32
+ $[7] = style;
33
+ $[8] = t1;
34
+ } else {
35
+ aria = $[1];
36
+ checked = $[2];
37
+ className = $[3];
38
+ label = $[4];
39
+ name = $[5];
40
+ onChange = $[6];
41
+ style = $[7];
42
+ t1 = $[8];
43
+ }
44
+ const disabled = t1 === undefined ? false : t1;
45
+ let t2;
46
+ if ($[9] !== className) {
47
+ t2 = classes(rootPart("Checkbox"), checkboxClass, className);
48
+ $[9] = className;
49
+ $[10] = t2;
50
+ } else {
51
+ t2 = $[10];
52
+ }
53
+ let t3;
54
+ if ($[11] !== onChange) {
55
+ t3 = event => onChange(event.target.checked);
56
+ $[11] = onChange;
57
+ $[12] = t3;
58
+ } else {
59
+ t3 = $[12];
60
+ }
61
+ let t4;
62
+ if ($[13] !== name) {
63
+ t4 = name ? {
64
+ name
65
+ } : {};
66
+ $[13] = name;
67
+ $[14] = t4;
68
+ } else {
69
+ t4 = $[14];
70
+ }
71
+ let t5;
72
+ if ($[15] !== aria || $[16] !== checked || $[17] !== disabled || $[18] !== t3 || $[19] !== t4) {
73
+ t5 = /*#__PURE__*/_jsx("input", {
74
+ ...aria,
75
+ type: "checkbox",
76
+ className: "peer sr-only",
77
+ checked: checked,
78
+ disabled: disabled,
79
+ onChange: t3,
80
+ ...t4
81
+ });
82
+ $[15] = aria;
83
+ $[16] = checked;
84
+ $[17] = disabled;
85
+ $[18] = t3;
86
+ $[19] = t4;
87
+ $[20] = t5;
88
+ } else {
89
+ t5 = $[20];
90
+ }
91
+ let t6;
92
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
93
+ t6 = /*#__PURE__*/_jsx("span", {
94
+ className: checkboxBoxClass,
95
+ children: /*#__PURE__*/_jsx("svg", {
96
+ viewBox: "0 0 16 16",
97
+ fill: "none",
98
+ "aria-hidden": "true",
99
+ className: checkboxMarkClass,
100
+ children: /*#__PURE__*/_jsx("path", {
101
+ d: CHECKBOX_MARK,
102
+ stroke: "currentColor",
103
+ strokeWidth: "2",
104
+ strokeLinecap: "round",
105
+ strokeLinejoin: "round"
106
+ })
107
+ })
108
+ });
109
+ $[21] = t6;
110
+ } else {
111
+ t6 = $[21];
112
+ }
113
+ let t7;
114
+ if ($[22] !== label) {
115
+ t7 = label && /*#__PURE__*/_jsx("span", {
116
+ className: checkboxLabelClass,
117
+ children: label
118
+ });
119
+ $[22] = label;
120
+ $[23] = t7;
121
+ } else {
122
+ t7 = $[23];
123
+ }
124
+ let t8;
125
+ if ($[24] !== style || $[25] !== t2 || $[26] !== t5 || $[27] !== t7) {
126
+ t8 = /*#__PURE__*/_jsxs("label", {
127
+ className: t2,
128
+ style: style,
129
+ children: [t5, t6, t7]
130
+ });
131
+ $[24] = style;
132
+ $[25] = t2;
133
+ $[26] = t5;
134
+ $[27] = t7;
135
+ $[28] = t8;
136
+ } else {
137
+ t8 = $[28];
138
+ }
139
+ return t8;
140
+ }
package/dist/Chip.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { type ChipBaseProps } from "@xds/core";
2
+ import type { RootProps } from "./root.ts";
3
+ export type ChipProps = ChipBaseProps & RootProps & {
4
+ onPress?: () => void;
5
+ };
6
+ /**
7
+ * A choice that filters what is shown. Unlike a Badge it is pressed. A selected chip is tinted,
8
+ * outlined and marked with a check, so the state does not depend on color.
9
+ *
10
+ * It is a toggle button: assistive technology hears whether it is pressed.
11
+ */
12
+ export declare function Chip({ label, selected, onPress, iconStart, disabled, className, style, }: ChipProps): import("react").JSX.Element;