@xds/react 0.1.0 → 1.0.0-rc.1
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.
- package/dist/Accordion.js +191 -33
- package/dist/Avatar.js +65 -6
- package/dist/AvatarStack.js +101 -6
- package/dist/Badge.js +61 -4
- package/dist/Banner.js +161 -5
- package/dist/Button.js +152 -24
- package/dist/Card.js +171 -12
- package/dist/Checkbox.js +138 -3
- package/dist/Chip.js +71 -4
- package/dist/ChipBar.js +36 -3
- package/dist/CountBadge.js +62 -9
- package/dist/DatePicker.js +421 -25
- package/dist/DateRangePicker.js +362 -40
- package/dist/Defaults.js +42 -7
- package/dist/Dialog.js +128 -24
- package/dist/Divider.js +29 -3
- package/dist/EmptyState.js +83 -3
- package/dist/Icon.js +74 -4
- package/dist/IconButton.js +113 -18
- package/dist/ListRow.js +180 -10
- package/dist/MediaCard.js +273 -11
- package/dist/Menu.js +234 -58
- package/dist/ProgressBar.js +63 -4
- package/dist/RadioGroup.js +173 -12
- package/dist/SearchField.js +148 -16
- package/dist/SectionHeader.js +121 -5
- package/dist/SegmentedControl.js +104 -5
- package/dist/Select.js +307 -55
- package/dist/Sidebar.js +212 -19
- package/dist/Skeleton.js +61 -5
- package/dist/Slider.js +142 -35
- package/dist/Spinner.js +93 -4
- package/dist/Switch.js +114 -3
- package/dist/Tabs.js +130 -14
- package/dist/Text.js +42 -4
- package/dist/TextField.js +209 -26
- package/dist/Thumbnail.js +146 -7
- package/dist/Toast.js +118 -30
- package/dist/Tooltip.js +154 -20
- package/dist/base.d.ts +11 -0
- package/dist/base.js +10 -0
- package/dist/modal-popover.js +32 -10
- package/dist/picture.d.ts +6 -4
- package/dist/picture.js +72 -17
- package/dist/portal.js +24 -4
- package/dist/presence.js +30 -9
- package/dist/preview.d.ts +14 -3
- package/dist/preview.js +118 -74
- package/dist/root.js +1 -0
- package/dist/trigger.d.ts +7 -0
- package/dist/trigger.js +41 -8
- package/eject/files/Accordion.tsx +157 -0
- package/eject/files/Avatar.tsx +41 -0
- package/eject/files/AvatarStack.tsx +47 -0
- package/eject/files/Badge.tsx +33 -0
- package/eject/files/Banner.tsx +70 -0
- package/eject/files/Button.tsx +88 -0
- package/eject/files/Card.tsx +85 -0
- package/eject/files/Checkbox.tsx +59 -0
- package/eject/files/Chip.tsx +43 -0
- package/eject/files/ChipBar.tsx +31 -0
- package/eject/files/CountBadge.tsx +50 -0
- package/eject/files/DatePicker.tsx +192 -0
- package/eject/files/DateRangePicker.tsx +271 -0
- package/eject/files/Dialog.tsx +108 -0
- package/eject/files/Divider.tsx +13 -0
- package/eject/files/EmptyState.tsx +39 -0
- package/eject/files/Icon.tsx +38 -0
- package/eject/files/IconButton.tsx +62 -0
- package/eject/files/ListRow.tsx +86 -0
- package/eject/files/MediaCard.tsx +111 -0
- package/eject/files/Menu.tsx +168 -0
- package/eject/files/ProgressBar.tsx +34 -0
- package/eject/files/RadioGroup.tsx +112 -0
- package/eject/files/SearchField.tsx +88 -0
- package/eject/files/SectionHeader.tsx +56 -0
- package/eject/files/SegmentedControl.tsx +57 -0
- package/eject/files/Select.tsx +228 -0
- package/eject/files/Sidebar.tsx +149 -0
- package/eject/files/Skeleton.tsx +28 -0
- package/eject/files/Slider.tsx +109 -0
- package/eject/files/Spinner.tsx +36 -0
- package/eject/files/Switch.tsx +53 -0
- package/eject/files/Tabs.tsx +71 -0
- package/eject/files/Text.tsx +31 -0
- package/eject/files/TextField.tsx +122 -0
- package/eject/files/Thumbnail.tsx +66 -0
- package/eject/files/Toast.tsx +88 -0
- package/eject/files/Tooltip.tsx +120 -0
- package/eject/files/accordion.css +89 -0
- package/eject/files/accordion.ts +67 -0
- package/eject/files/avatar-stack.ts +57 -0
- package/eject/files/avatar.ts +42 -0
- package/eject/files/badge.ts +30 -0
- package/eject/files/banner.ts +68 -0
- package/eject/files/base.css +38 -0
- package/eject/files/button.css +241 -0
- package/eject/files/button.ts +106 -0
- package/eject/files/card.ts +58 -0
- package/eject/files/checkbox.ts +32 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +352 -0
- package/eject/files/date-picker.ts +250 -0
- package/eject/files/date-range-picker.ts +323 -0
- package/eject/files/dialog.css +139 -0
- package/eject/files/dialog.ts +15 -0
- package/eject/files/divider.ts +5 -0
- package/eject/files/empty-state.ts +22 -0
- package/eject/files/icon.ts +36 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +176 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/progress-bar.ts +23 -0
- package/eject/files/radio-group.css +160 -0
- package/eject/files/radio-group.ts +24 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +30 -0
- package/eject/files/select.css +285 -0
- package/eject/files/select.ts +36 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +136 -0
- package/eject/files/slider.ts +65 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +34 -0
- package/eject/files/tabs.css +112 -0
- package/eject/files/tabs.ts +35 -0
- package/eject/files/text-field.css +229 -0
- package/eject/files/text-field.ts +48 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +104 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +814 -0
- package/package.json +9 -4
package/dist/RadioGroup.js
CHANGED
|
@@ -1,15 +1,176 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { classes } from "@xds/core";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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;
|
|
15
175
|
}
|
|
176
|
+
const ids = (...all) => all.filter(Boolean).join(" ") || undefined;
|
package/dist/SearchField.js
CHANGED
|
@@ -1,20 +1,152 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { classes, rootPart } from "@xds/core";
|
|
3
3
|
import { useRef } from "react";
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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;
|
|
20
152
|
}
|
package/dist/SectionHeader.js
CHANGED
|
@@ -1,8 +1,124 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { classes, rootPart, SECTION_HEADER_PARTS
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { classes, rootPart, SECTION_HEADER_PARTS } from "@xds/core";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
8
124
|
}
|
package/dist/SegmentedControl.js
CHANGED
|
@@ -1,7 +1,106 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { classes, rootPart, segmentedControlClass, segmentedControlOptionClass, segmentedControlSegmentClass
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { classes, rootPart, segmentedControlClass, segmentedControlOptionClass, segmentedControlSegmentClass } from "@xds/core";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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;
|
|
7
106
|
}
|