@xds/react 0.1.0 → 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 (140) hide show
  1. package/dist/Accordion.js +191 -33
  2. package/dist/Avatar.js +65 -6
  3. package/dist/AvatarStack.js +101 -6
  4. package/dist/Badge.js +61 -4
  5. package/dist/Banner.js +161 -5
  6. package/dist/Button.js +152 -24
  7. package/dist/Card.js +171 -12
  8. package/dist/Checkbox.js +138 -3
  9. package/dist/Chip.js +71 -4
  10. package/dist/ChipBar.js +36 -3
  11. package/dist/CountBadge.js +62 -9
  12. package/dist/DatePicker.js +421 -25
  13. package/dist/DateRangePicker.js +362 -40
  14. package/dist/Defaults.js +42 -7
  15. package/dist/Dialog.js +128 -24
  16. package/dist/Divider.js +29 -3
  17. package/dist/EmptyState.js +83 -3
  18. package/dist/Icon.js +74 -4
  19. package/dist/IconButton.js +113 -18
  20. package/dist/ListRow.js +180 -10
  21. package/dist/MediaCard.js +273 -11
  22. package/dist/Menu.js +234 -58
  23. package/dist/ProgressBar.js +63 -4
  24. package/dist/RadioGroup.js +173 -12
  25. package/dist/SearchField.js +148 -16
  26. package/dist/SectionHeader.js +121 -5
  27. package/dist/SegmentedControl.js +104 -5
  28. package/dist/Select.js +307 -55
  29. package/dist/Sidebar.js +212 -19
  30. package/dist/Skeleton.js +61 -5
  31. package/dist/Slider.js +142 -35
  32. package/dist/Spinner.js +93 -4
  33. package/dist/Switch.js +114 -3
  34. package/dist/Tabs.js +130 -14
  35. package/dist/Text.js +42 -4
  36. package/dist/TextField.js +209 -26
  37. package/dist/Thumbnail.js +146 -7
  38. package/dist/Toast.js +118 -30
  39. package/dist/Tooltip.js +154 -20
  40. package/dist/base.d.ts +11 -0
  41. package/dist/base.js +10 -0
  42. package/dist/modal-popover.js +32 -10
  43. package/dist/picture.d.ts +6 -4
  44. package/dist/picture.js +72 -17
  45. package/dist/portal.js +24 -4
  46. package/dist/presence.js +30 -9
  47. package/dist/preview.d.ts +14 -3
  48. package/dist/preview.js +118 -74
  49. package/dist/root.js +1 -0
  50. package/dist/trigger.d.ts +7 -0
  51. package/dist/trigger.js +41 -8
  52. package/eject/files/Accordion.tsx +157 -0
  53. package/eject/files/Avatar.tsx +41 -0
  54. package/eject/files/AvatarStack.tsx +47 -0
  55. package/eject/files/Badge.tsx +33 -0
  56. package/eject/files/Banner.tsx +70 -0
  57. package/eject/files/Button.tsx +88 -0
  58. package/eject/files/Card.tsx +85 -0
  59. package/eject/files/Checkbox.tsx +59 -0
  60. package/eject/files/Chip.tsx +43 -0
  61. package/eject/files/ChipBar.tsx +31 -0
  62. package/eject/files/CountBadge.tsx +50 -0
  63. package/eject/files/DatePicker.tsx +192 -0
  64. package/eject/files/DateRangePicker.tsx +271 -0
  65. package/eject/files/Dialog.tsx +108 -0
  66. package/eject/files/Divider.tsx +13 -0
  67. package/eject/files/EmptyState.tsx +39 -0
  68. package/eject/files/Icon.tsx +38 -0
  69. package/eject/files/IconButton.tsx +62 -0
  70. package/eject/files/ListRow.tsx +86 -0
  71. package/eject/files/MediaCard.tsx +111 -0
  72. package/eject/files/Menu.tsx +168 -0
  73. package/eject/files/ProgressBar.tsx +34 -0
  74. package/eject/files/RadioGroup.tsx +112 -0
  75. package/eject/files/SearchField.tsx +88 -0
  76. package/eject/files/SectionHeader.tsx +56 -0
  77. package/eject/files/SegmentedControl.tsx +57 -0
  78. package/eject/files/Select.tsx +228 -0
  79. package/eject/files/Sidebar.tsx +149 -0
  80. package/eject/files/Skeleton.tsx +28 -0
  81. package/eject/files/Slider.tsx +109 -0
  82. package/eject/files/Spinner.tsx +36 -0
  83. package/eject/files/Switch.tsx +53 -0
  84. package/eject/files/Tabs.tsx +71 -0
  85. package/eject/files/Text.tsx +31 -0
  86. package/eject/files/TextField.tsx +122 -0
  87. package/eject/files/Thumbnail.tsx +66 -0
  88. package/eject/files/Toast.tsx +88 -0
  89. package/eject/files/Tooltip.tsx +120 -0
  90. package/eject/files/accordion.css +89 -0
  91. package/eject/files/accordion.ts +67 -0
  92. package/eject/files/avatar-stack.ts +57 -0
  93. package/eject/files/avatar.ts +42 -0
  94. package/eject/files/badge.ts +30 -0
  95. package/eject/files/banner.ts +68 -0
  96. package/eject/files/base.css +38 -0
  97. package/eject/files/button.css +241 -0
  98. package/eject/files/button.ts +106 -0
  99. package/eject/files/card.ts +58 -0
  100. package/eject/files/checkbox.ts +32 -0
  101. package/eject/files/chip-bar.ts +16 -0
  102. package/eject/files/chip.ts +35 -0
  103. package/eject/files/count-badge.ts +32 -0
  104. package/eject/files/date-picker.css +352 -0
  105. package/eject/files/date-picker.ts +250 -0
  106. package/eject/files/date-range-picker.ts +323 -0
  107. package/eject/files/dialog.css +139 -0
  108. package/eject/files/dialog.ts +15 -0
  109. package/eject/files/divider.ts +5 -0
  110. package/eject/files/empty-state.ts +22 -0
  111. package/eject/files/icon.ts +36 -0
  112. package/eject/files/list-row.ts +66 -0
  113. package/eject/files/media-card.ts +66 -0
  114. package/eject/files/menu.css +176 -0
  115. package/eject/files/menu.ts +84 -0
  116. package/eject/files/parts.ts +17 -0
  117. package/eject/files/progress-bar.ts +23 -0
  118. package/eject/files/radio-group.css +160 -0
  119. package/eject/files/radio-group.ts +24 -0
  120. package/eject/files/section-header.ts +32 -0
  121. package/eject/files/segmented-control.ts +30 -0
  122. package/eject/files/select.css +285 -0
  123. package/eject/files/select.ts +36 -0
  124. package/eject/files/sidebar.ts +75 -0
  125. package/eject/files/skeleton.ts +51 -0
  126. package/eject/files/slider.css +136 -0
  127. package/eject/files/slider.ts +65 -0
  128. package/eject/files/spinner.ts +22 -0
  129. package/eject/files/switch.ts +34 -0
  130. package/eject/files/tabs.css +112 -0
  131. package/eject/files/tabs.ts +35 -0
  132. package/eject/files/text-field.css +229 -0
  133. package/eject/files/text-field.ts +48 -0
  134. package/eject/files/text.ts +38 -0
  135. package/eject/files/thumbnail.ts +51 -0
  136. package/eject/files/toast.ts +31 -0
  137. package/eject/files/tooltip.css +104 -0
  138. package/eject/files/tooltip.ts +21 -0
  139. package/eject/manifest.json +814 -0
  140. package/package.json +9 -4
package/dist/Slider.js CHANGED
@@ -1,44 +1,151 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { classes, focusThumbOnPress, sliderArrowValue, sliderPageSize, sliderValueText, } from "@xds/core";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { classes, focusThumbOnPress, sliderArrowValue, sliderPageSize, sliderValueText } from "@xds/core";
3
3
  import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
4
4
  import * as slider from "@zag-js/slider";
5
5
  import { useId, useRef } from "react";
6
- export function Slider({ label, value, onChange, min = 0, max = 100, step = 1, disabled = false, showValue = false, className, style, }) {
7
- const pageSize = sliderPageSize({ min, max, step });
8
- const service = useMachine(slider.machine, {
9
- id: useId(),
10
- value: [value],
11
- onValueChange: (details) => onChange(details.value[0] ?? min),
6
+ import { useMergedProps } from "./trigger.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export function Slider(t0) {
9
+ const $ = _c(10);
10
+ const {
11
+ label,
12
+ value,
13
+ onChange,
14
+ min: t1,
15
+ max: t2,
16
+ step: t3,
17
+ disabled: t4,
18
+ showValue: t5,
19
+ className,
20
+ style
21
+ } = t0;
22
+ const min = t1 === undefined ? 0 : t1;
23
+ const max = t2 === undefined ? 100 : t2;
24
+ const step = t3 === undefined ? 1 : t3;
25
+ const disabled = t4 === undefined ? false : t4;
26
+ const showValue = t5 === undefined ? false : t5;
27
+ const pageSize = sliderPageSize({
28
+ min,
29
+ max,
30
+ step
31
+ });
32
+ let t6;
33
+ if ($[0] !== min || $[1] !== onChange) {
34
+ t6 = details => onChange(details.value[0] ?? min);
35
+ $[0] = min;
36
+ $[1] = onChange;
37
+ $[2] = t6;
38
+ } else {
39
+ t6 = $[2];
40
+ }
41
+ const service = useMachine(slider.machine, {
42
+ id: useId(),
43
+ value: [value],
44
+ onValueChange: t6,
45
+ min,
46
+ max,
47
+ step,
48
+ largeStep: pageSize,
49
+ disabled,
50
+ thumbAlignment: "center",
51
+ getAriaValueText: _temp
52
+ });
53
+ const api = slider.connect(service, normalizeProps);
54
+ const thumbElement = useRef(null);
55
+ const thumb = mergeProps(api.getThumbProps({
56
+ index: 0
57
+ }), {
58
+ onKeyDown: event => {
59
+ if (disabled) {
60
+ return;
61
+ }
62
+ const next = sliderArrowValue(event, {
63
+ value: api.value[0] ?? min,
12
64
  min,
13
65
  max,
14
66
  step,
15
- largeStep: pageSize,
16
- disabled,
17
- thumbAlignment: "center",
18
- getAriaValueText: (details) => sliderValueText(details.value),
67
+ pageSize
68
+ });
69
+ if (next !== undefined) {
70
+ api.setThumbValue(0, next);
71
+ }
72
+ }
73
+ });
74
+ let t7;
75
+ if ($[3] !== disabled) {
76
+ t7 = {
77
+ onPointerDown: event_0 => {
78
+ if (!disabled) {
79
+ focusThumbOnPress(event_0, thumbElement.current);
80
+ }
81
+ }
82
+ };
83
+ $[3] = disabled;
84
+ $[4] = t7;
85
+ } else {
86
+ t7 = $[4];
87
+ }
88
+ const control = useMergedProps(api.getControlProps(), t7);
89
+ const t8 = mergeProps(api.getRootProps(), {
90
+ className: classes("xds-slider", className),
91
+ style
92
+ });
93
+ const t9 = api.getLabelProps().id;
94
+ const t10 = "xds-slider__thumb";
95
+ const t11 = api.getHiddenInputProps({
96
+ index: 0
97
+ });
98
+ let t12;
99
+ if ($[5] !== t11) {
100
+ t12 = /*#__PURE__*/_jsx("input", {
101
+ ...t11
19
102
  });
20
- const api = slider.connect(service, normalizeProps);
21
- const thumbElement = useRef(null);
22
- const thumb = mergeProps(api.getThumbProps({ index: 0 }), {
23
- onKeyDown: (event) => {
24
- if (disabled)
25
- return;
26
- const next = sliderArrowValue(event, {
27
- value: api.value[0] ?? min,
28
- min,
29
- max,
30
- step,
31
- pageSize,
32
- });
33
- if (next !== undefined)
34
- api.setThumbValue(0, next);
35
- },
103
+ $[5] = t11;
104
+ $[6] = t12;
105
+ } else {
106
+ t12 = $[6];
107
+ }
108
+ let t13;
109
+ if ($[7] !== t12 || $[8] !== thumb) {
110
+ t13 = /*#__PURE__*/_jsx("div", {
111
+ ...thumb,
112
+ ref: thumbElement,
113
+ className: t10,
114
+ children: t12
36
115
  });
37
- const control = mergeProps(api.getControlProps(), {
38
- onPointerDown: (event) => {
39
- if (!disabled)
40
- focusThumbOnPress(event, thumbElement.current);
41
- },
42
- });
43
- return (_jsxs("div", { ...mergeProps(api.getRootProps(), { className: classes("xds-slider", className), style }), role: "group", "aria-labelledby": api.getLabelProps().id, children: [_jsx("label", { ...api.getLabelProps(), className: "xds-slider__label", children: label }), showValue && (_jsx("output", { ...api.getValueTextProps(), "aria-live": "off", className: "xds-slider__output", children: sliderValueText(api.value[0] ?? value) })), _jsxs("div", { ...control, className: "xds-slider__control", children: [_jsx("div", { ...api.getTrackProps(), className: "xds-slider__track", children: _jsx("div", { ...api.getRangeProps(), className: "xds-slider__range" }) }), _jsx("div", { ...thumb, ref: thumbElement, className: "xds-slider__thumb", children: _jsx("input", { ...api.getHiddenInputProps({ index: 0 }) }) })] })] }));
116
+ $[7] = t12;
117
+ $[8] = thumb;
118
+ $[9] = t13;
119
+ } else {
120
+ t13 = $[9];
121
+ }
122
+ return /*#__PURE__*/_jsxs("div", {
123
+ ...t8,
124
+ role: "group",
125
+ "aria-labelledby": t9,
126
+ children: [/*#__PURE__*/_jsx("label", {
127
+ ...api.getLabelProps(),
128
+ className: "xds-slider__label",
129
+ children: label
130
+ }), showValue && /*#__PURE__*/_jsx("output", {
131
+ ...api.getValueTextProps(),
132
+ "aria-live": "off",
133
+ className: "xds-slider__output",
134
+ children: sliderValueText(api.value[0] ?? value)
135
+ }), /*#__PURE__*/_jsxs("div", {
136
+ ...control,
137
+ className: "xds-slider__control",
138
+ children: [/*#__PURE__*/_jsx("div", {
139
+ ...api.getTrackProps(),
140
+ className: "xds-slider__track",
141
+ children: /*#__PURE__*/_jsx("div", {
142
+ ...api.getRangeProps(),
143
+ className: "xds-slider__range"
144
+ })
145
+ }), t13]
146
+ })]
147
+ });
148
+ }
149
+ function _temp(details_0) {
150
+ return sliderValueText(details_0.value);
44
151
  }
package/dist/Spinner.js CHANGED
@@ -1,8 +1,97 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { classes, rootPart, spinnerClass } from "@xds/core";
3
3
  import { useDefaults } from "./Defaults.js";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
5
  export function Spinner(props) {
5
- const defaults = useDefaults("Spinner");
6
- const { size = defaults.size, label, className, style } = props;
7
- return (_jsx("span", { className: classes(rootPart("Spinner"), "inline-flex shrink-0", className), style: style, ...(label ? { role: "status", "aria-label": label } : { "aria-hidden": true }), children: _jsxs("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", className: spinnerClass(size), children: [_jsx("circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", strokeWidth: "3", opacity: "0.25" }), _jsx("path", { d: "M21 12a9 9 0 0 0-9-9", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" })] }) }));
6
+ const $ = _c(15);
7
+ const defaults = useDefaults("Spinner");
8
+ const {
9
+ label,
10
+ className,
11
+ style
12
+ } = props;
13
+ const size = props.size ?? defaults.size;
14
+ let t0;
15
+ if ($[0] !== className) {
16
+ t0 = classes(rootPart("Spinner"), "inline-flex shrink-0", className);
17
+ $[0] = className;
18
+ $[1] = t0;
19
+ } else {
20
+ t0 = $[1];
21
+ }
22
+ let t1;
23
+ if ($[2] !== label) {
24
+ t1 = label ? {
25
+ role: "status",
26
+ "aria-label": label
27
+ } : {
28
+ "aria-hidden": true
29
+ };
30
+ $[2] = label;
31
+ $[3] = t1;
32
+ } else {
33
+ t1 = $[3];
34
+ }
35
+ let t2;
36
+ if ($[4] !== size) {
37
+ t2 = spinnerClass(size);
38
+ $[4] = size;
39
+ $[5] = t2;
40
+ } else {
41
+ t2 = $[5];
42
+ }
43
+ let t3;
44
+ let t4;
45
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
46
+ t3 = /*#__PURE__*/_jsx("circle", {
47
+ cx: "12",
48
+ cy: "12",
49
+ r: "9",
50
+ stroke: "currentColor",
51
+ strokeWidth: "3",
52
+ opacity: "0.25"
53
+ });
54
+ t4 = /*#__PURE__*/_jsx("path", {
55
+ d: "M21 12a9 9 0 0 0-9-9",
56
+ stroke: "currentColor",
57
+ strokeWidth: "3",
58
+ strokeLinecap: "round"
59
+ });
60
+ $[6] = t3;
61
+ $[7] = t4;
62
+ } else {
63
+ t3 = $[6];
64
+ t4 = $[7];
65
+ }
66
+ let t5;
67
+ if ($[8] !== t2) {
68
+ t5 = /*#__PURE__*/_jsxs("svg", {
69
+ viewBox: "0 0 24 24",
70
+ fill: "none",
71
+ "aria-hidden": "true",
72
+ className: t2,
73
+ children: [t3, t4]
74
+ });
75
+ $[8] = t2;
76
+ $[9] = t5;
77
+ } else {
78
+ t5 = $[9];
79
+ }
80
+ let t6;
81
+ if ($[10] !== style || $[11] !== t0 || $[12] !== t1 || $[13] !== t5) {
82
+ t6 = /*#__PURE__*/_jsx("span", {
83
+ className: t0,
84
+ style: style,
85
+ ...t1,
86
+ children: t5
87
+ });
88
+ $[10] = style;
89
+ $[11] = t0;
90
+ $[12] = t1;
91
+ $[13] = t5;
92
+ $[14] = t6;
93
+ } else {
94
+ t6 = $[14];
95
+ }
96
+ return t6;
8
97
  }
package/dist/Switch.js CHANGED
@@ -1,5 +1,116 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { classes, rootPart, switchClass, switchLabelClass, switchThumbClass, switchTrackClass } from "@xds/core";
1
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { classes, rootPart, switchClass, switchLabelClass, switchThumbClass, switchTrackClass, } from "@xds/core";
3
- export function Switch({ checked, onChange, label, disabled = false, className, style, ...aria }) {
4
- return (_jsxs("label", { className: classes(rootPart("Switch"), switchClass, className), style: style, children: [_jsx("input", { ...aria, type: "checkbox", role: "switch", "aria-checked": checked, className: "peer sr-only", checked: checked, disabled: disabled, onChange: (event) => onChange(event.target.checked) }), _jsx("span", { className: switchTrackClass, children: _jsx("span", { className: switchThumbClass }) }), label && _jsx("span", { className: switchLabelClass, children: label })] }));
4
+ export function Switch(t0) {
5
+ const $ = _c(25);
6
+ let aria;
7
+ let checked;
8
+ let className;
9
+ let label;
10
+ let onChange;
11
+ let style;
12
+ let t1;
13
+ if ($[0] !== t0) {
14
+ ({
15
+ checked,
16
+ onChange,
17
+ label,
18
+ disabled: t1,
19
+ className,
20
+ style,
21
+ ...aria
22
+ } = t0);
23
+ $[0] = t0;
24
+ $[1] = aria;
25
+ $[2] = checked;
26
+ $[3] = className;
27
+ $[4] = label;
28
+ $[5] = onChange;
29
+ $[6] = style;
30
+ $[7] = t1;
31
+ } else {
32
+ aria = $[1];
33
+ checked = $[2];
34
+ className = $[3];
35
+ label = $[4];
36
+ onChange = $[5];
37
+ style = $[6];
38
+ t1 = $[7];
39
+ }
40
+ const disabled = t1 === undefined ? false : t1;
41
+ let t2;
42
+ if ($[8] !== className) {
43
+ t2 = classes(rootPart("Switch"), switchClass, className);
44
+ $[8] = className;
45
+ $[9] = t2;
46
+ } else {
47
+ t2 = $[9];
48
+ }
49
+ let t3;
50
+ if ($[10] !== onChange) {
51
+ t3 = event => onChange(event.target.checked);
52
+ $[10] = onChange;
53
+ $[11] = t3;
54
+ } else {
55
+ t3 = $[11];
56
+ }
57
+ let t4;
58
+ if ($[12] !== aria || $[13] !== checked || $[14] !== disabled || $[15] !== t3) {
59
+ t4 = /*#__PURE__*/_jsx("input", {
60
+ ...aria,
61
+ type: "checkbox",
62
+ role: "switch",
63
+ "aria-checked": checked,
64
+ className: "peer sr-only",
65
+ checked: checked,
66
+ disabled: disabled,
67
+ onChange: t3
68
+ });
69
+ $[12] = aria;
70
+ $[13] = checked;
71
+ $[14] = disabled;
72
+ $[15] = t3;
73
+ $[16] = t4;
74
+ } else {
75
+ t4 = $[16];
76
+ }
77
+ let t5;
78
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
79
+ t5 = /*#__PURE__*/_jsx("span", {
80
+ className: switchTrackClass,
81
+ children: /*#__PURE__*/_jsx("span", {
82
+ className: switchThumbClass
83
+ })
84
+ });
85
+ $[17] = t5;
86
+ } else {
87
+ t5 = $[17];
88
+ }
89
+ let t6;
90
+ if ($[18] !== label) {
91
+ t6 = label && /*#__PURE__*/_jsx("span", {
92
+ className: switchLabelClass,
93
+ children: label
94
+ });
95
+ $[18] = label;
96
+ $[19] = t6;
97
+ } else {
98
+ t6 = $[19];
99
+ }
100
+ let t7;
101
+ if ($[20] !== style || $[21] !== t2 || $[22] !== t4 || $[23] !== t6) {
102
+ t7 = /*#__PURE__*/_jsxs("label", {
103
+ className: t2,
104
+ style: style,
105
+ children: [t4, t5, t6]
106
+ });
107
+ $[20] = style;
108
+ $[21] = t2;
109
+ $[22] = t4;
110
+ $[23] = t6;
111
+ $[24] = t7;
112
+ } else {
113
+ t7 = $[24];
114
+ }
115
+ return t7;
5
116
  }
package/dist/Tabs.js CHANGED
@@ -1,21 +1,137 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { classes, tabStopIndex, tabsClass } from "@xds/core";
3
3
  import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
4
4
  import * as tabs from "@zag-js/tabs";
5
5
  import { useId } from "react";
6
6
  import { Icon } from "./Icon.js";
7
- export function Tabs({ items, value, onChange, label, fullWidth = false, className, style, }) {
8
- const service = useMachine(tabs.machine, {
9
- id: useId(),
10
- value,
11
- onValueChange: (details) => onChange(details.value),
12
- });
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export function Tabs(t0) {
9
+ const $ = _c(29);
10
+ const {
11
+ items,
12
+ value,
13
+ onChange,
14
+ label,
15
+ fullWidth: t1,
16
+ className,
17
+ style
18
+ } = t0;
19
+ const fullWidth = t1 === undefined ? false : t1;
20
+ const t2 = useId();
21
+ let t3;
22
+ if ($[0] !== onChange) {
23
+ t3 = details => onChange(details.value);
24
+ $[0] = onChange;
25
+ $[1] = t3;
26
+ } else {
27
+ t3 = $[1];
28
+ }
29
+ let t4;
30
+ if ($[2] !== t2 || $[3] !== t3 || $[4] !== value) {
31
+ t4 = {
32
+ id: t2,
33
+ value,
34
+ onValueChange: t3
35
+ };
36
+ $[2] = t2;
37
+ $[3] = t3;
38
+ $[4] = value;
39
+ $[5] = t4;
40
+ } else {
41
+ t4 = $[5];
42
+ }
43
+ const service = useMachine(tabs.machine, t4);
44
+ let t10;
45
+ let t5;
46
+ let t6;
47
+ let t7;
48
+ let t8;
49
+ let t9;
50
+ if ($[6] !== className || $[7] !== fullWidth || $[8] !== items || $[9] !== label || $[10] !== service || $[11] !== style) {
13
51
  const api = tabs.connect(service, normalizeProps);
14
- return (_jsx("div", { ...mergeProps(api.getRootProps(), {
15
- className: classes(tabsClass(fullWidth), className),
16
- style,
17
- }), children: _jsxs("div", { ...api.getListProps(), "aria-label": label, className: "xds-tabs__list", children: [items.map((item) => {
18
- const trigger = api.getTriggerProps({ value: item.value });
19
- return (_jsxs("button", { ...trigger, tabIndex: tabStopIndex(api.focusedValue, item.value, trigger.tabIndex), "aria-controls": undefined, type: "button", className: "xds-tabs__tab", children: [item.icon && _jsx(Icon, { name: item.icon, size: "sm" }), item.label] }, item.value));
20
- }), _jsx("div", { ...api.getIndicatorProps(), className: "xds-tabs__indicator" })] }) }));
52
+ t10 = mergeProps(api.getRootProps(), {
53
+ className: classes(tabsClass(fullWidth), className),
54
+ style
55
+ });
56
+ t6 = api.getListProps();
57
+ t7 = label;
58
+ t8 = "xds-tabs__list";
59
+ t9 = items.map(item => {
60
+ const trigger = api.getTriggerProps({
61
+ value: item.value
62
+ });
63
+ return /*#__PURE__*/_jsxs("button", {
64
+ ...trigger,
65
+ tabIndex: tabStopIndex(api.focusedValue, item.value, trigger.tabIndex),
66
+ "aria-controls": undefined,
67
+ type: "button",
68
+ className: "xds-tabs__tab",
69
+ children: [item.icon && /*#__PURE__*/_jsx(Icon, {
70
+ name: item.icon,
71
+ size: "sm"
72
+ }), item.label]
73
+ }, item.value);
74
+ });
75
+ t5 = api.getIndicatorProps();
76
+ $[6] = className;
77
+ $[7] = fullWidth;
78
+ $[8] = items;
79
+ $[9] = label;
80
+ $[10] = service;
81
+ $[11] = style;
82
+ $[12] = t10;
83
+ $[13] = t5;
84
+ $[14] = t6;
85
+ $[15] = t7;
86
+ $[16] = t8;
87
+ $[17] = t9;
88
+ } else {
89
+ t10 = $[12];
90
+ t5 = $[13];
91
+ t6 = $[14];
92
+ t7 = $[15];
93
+ t8 = $[16];
94
+ t9 = $[17];
95
+ }
96
+ let t11;
97
+ if ($[18] !== t5) {
98
+ t11 = /*#__PURE__*/_jsx("div", {
99
+ ...t5,
100
+ className: "xds-tabs__indicator"
101
+ });
102
+ $[18] = t5;
103
+ $[19] = t11;
104
+ } else {
105
+ t11 = $[19];
106
+ }
107
+ let t12;
108
+ if ($[20] !== t11 || $[21] !== t6 || $[22] !== t7 || $[23] !== t8 || $[24] !== t9) {
109
+ t12 = /*#__PURE__*/_jsxs("div", {
110
+ ...t6,
111
+ "aria-label": t7,
112
+ className: t8,
113
+ children: [t9, t11]
114
+ });
115
+ $[20] = t11;
116
+ $[21] = t6;
117
+ $[22] = t7;
118
+ $[23] = t8;
119
+ $[24] = t9;
120
+ $[25] = t12;
121
+ } else {
122
+ t12 = $[25];
123
+ }
124
+ let t13;
125
+ if ($[26] !== t10 || $[27] !== t12) {
126
+ t13 = /*#__PURE__*/_jsx("div", {
127
+ ...t10,
128
+ children: t12
129
+ });
130
+ $[26] = t10;
131
+ $[27] = t12;
132
+ $[28] = t13;
133
+ } else {
134
+ t13 = $[28];
135
+ }
136
+ return t13;
21
137
  }
package/dist/Text.js CHANGED
@@ -1,8 +1,46 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { classes, rootPart, textClass } from "@xds/core";
3
3
  import { useDefaults } from "./Defaults.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  export function Text(props) {
5
- const defaults = useDefaults("Text");
6
- const { variant = defaults.variant, tone = defaults.tone, as: Element = "p", className, style, children, } = props;
7
- return (_jsx(Element, { className: classes(rootPart("Text"), textClass({ variant, tone }), className), style: style, children: children }));
6
+ const $ = _c(9);
7
+ const defaults = useDefaults("Text");
8
+ const {
9
+ as: t0,
10
+ className,
11
+ style,
12
+ children
13
+ } = props;
14
+ const Element = t0 === undefined ? "p" : t0;
15
+ const variant = props.variant ?? defaults.variant;
16
+ const tone = props.tone ?? defaults.tone;
17
+ let t1;
18
+ if ($[0] !== className || $[1] !== tone || $[2] !== variant) {
19
+ t1 = classes(rootPart("Text"), textClass({
20
+ variant,
21
+ tone
22
+ }), className);
23
+ $[0] = className;
24
+ $[1] = tone;
25
+ $[2] = variant;
26
+ $[3] = t1;
27
+ } else {
28
+ t1 = $[3];
29
+ }
30
+ let t2;
31
+ if ($[4] !== Element || $[5] !== children || $[6] !== style || $[7] !== t1) {
32
+ t2 = /*#__PURE__*/_jsx(Element, {
33
+ className: t1,
34
+ style: style,
35
+ children: children
36
+ });
37
+ $[4] = Element;
38
+ $[5] = children;
39
+ $[6] = style;
40
+ $[7] = t1;
41
+ $[8] = t2;
42
+ } else {
43
+ t2 = $[8];
44
+ }
45
+ return t2;
8
46
  }