@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.
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/Accordion.js CHANGED
@@ -1,39 +1,197 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ACCORDION_PARTS, classes, focusTitleOnClick, setPanelOpen, } from "@xds/core";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ACCORDION_PARTS, classes, focusTitleOnClick, setPanelOpen } from "@xds/core";
3
3
  import * as accordion from "@zag-js/accordion";
4
4
  import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
5
- import { useId, useLayoutEffect, useRef, useState, } from "react";
5
+ import { useId, useLayoutEffect, useRef, useState } from "react";
6
6
  import { Icon } from "./Icon.js";
7
- export function Accordion({ items, expanded, onChange, multiple = false, className, style, }) {
8
- const service = useMachine(accordion.machine, {
9
- id: useId(),
10
- value: [...expanded],
11
- onValueChange: (details) => onChange(details.value),
12
- multiple,
13
- collapsible: true,
14
- hiddenUntilFound: true,
15
- });
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export function Accordion(t0) {
9
+ const $ = _c(18);
10
+ const {
11
+ items,
12
+ expanded,
13
+ onChange,
14
+ multiple: t1,
15
+ className,
16
+ style
17
+ } = t0;
18
+ const multiple = t1 === undefined ? false : t1;
19
+ const t2 = useId();
20
+ let t3;
21
+ if ($[0] !== expanded) {
22
+ t3 = [...expanded];
23
+ $[0] = expanded;
24
+ $[1] = t3;
25
+ } else {
26
+ t3 = $[1];
27
+ }
28
+ let t4;
29
+ if ($[2] !== onChange) {
30
+ t4 = details => onChange(details.value);
31
+ $[2] = onChange;
32
+ $[3] = t4;
33
+ } else {
34
+ t4 = $[3];
35
+ }
36
+ let t5;
37
+ if ($[4] !== multiple || $[5] !== t2 || $[6] !== t3 || $[7] !== t4) {
38
+ t5 = {
39
+ id: t2,
40
+ value: t3,
41
+ onValueChange: t4,
42
+ multiple,
43
+ collapsible: true,
44
+ hiddenUntilFound: true
45
+ };
46
+ $[4] = multiple;
47
+ $[5] = t2;
48
+ $[6] = t3;
49
+ $[7] = t4;
50
+ $[8] = t5;
51
+ } else {
52
+ t5 = $[8];
53
+ }
54
+ const service = useMachine(accordion.machine, t5);
55
+ let t6;
56
+ let t7;
57
+ if ($[9] !== className || $[10] !== items || $[11] !== service || $[12] !== style) {
16
58
  const api = accordion.connect(service, normalizeProps);
17
- return (_jsx("div", { ...mergeProps(api.getRootProps(), {
18
- className: classes("xds-accordion", className),
19
- style,
20
- }), children: items.map((item) => {
21
- const { hidden: _hidden, ...body } = api.getItemContentProps({ value: item.value });
22
- return (_jsxs("div", { ...api.getItemProps({ value: item.value }), className: "xds-accordion__item", children: [_jsx("h3", { ...api.getItemHeaderProps({ value: item.value }), className: "xds-accordion__heading", children: _jsxs("button", { ...mergeProps(api.getItemTriggerProps({ value: item.value }), {
23
- onClick: focusTitleOnClick,
24
- }), type: "button", className: "xds-accordion__trigger group", children: [_jsxs("span", { className: ACCORDION_PARTS.text, children: [_jsx("span", { className: ACCORDION_PARTS.title, children: item.title }), item.description && (_jsx("span", { className: ACCORDION_PARTS.description, children: item.description }))] }), _jsx(Icon, { name: "chevron-down", size: "sm", className: ACCORDION_PARTS.chevron })] }) }), _jsx(Panel, { open: api.value.includes(item.value), attributes: body, children: item.content })] }, item.value));
25
- }) }));
59
+ t6 = mergeProps(api.getRootProps(), {
60
+ className: classes("xds-accordion", className),
61
+ style
62
+ });
63
+ t7 = items.map(item => {
64
+ const {
65
+ hidden: _hidden,
66
+ ...body
67
+ } = api.getItemContentProps({
68
+ value: item.value
69
+ });
70
+ return /*#__PURE__*/_jsxs("div", {
71
+ ...api.getItemProps({
72
+ value: item.value
73
+ }),
74
+ className: "xds-accordion__item",
75
+ children: [/*#__PURE__*/_jsx("h3", {
76
+ ...api.getItemHeaderProps({
77
+ value: item.value
78
+ }),
79
+ className: "xds-accordion__heading",
80
+ children: /*#__PURE__*/_jsxs("button", {
81
+ ...mergeProps(api.getItemTriggerProps({
82
+ value: item.value
83
+ }), {
84
+ onClick: focusTitleOnClick
85
+ }),
86
+ type: "button",
87
+ className: "xds-accordion__trigger group",
88
+ children: [/*#__PURE__*/_jsxs("span", {
89
+ className: ACCORDION_PARTS.text,
90
+ children: [/*#__PURE__*/_jsx("span", {
91
+ className: ACCORDION_PARTS.title,
92
+ children: item.title
93
+ }), item.description && /*#__PURE__*/_jsx("span", {
94
+ className: ACCORDION_PARTS.description,
95
+ children: item.description
96
+ })]
97
+ }), /*#__PURE__*/_jsx(Icon, {
98
+ name: "chevron-down",
99
+ size: "sm",
100
+ className: ACCORDION_PARTS.chevron
101
+ })]
102
+ })
103
+ }), /*#__PURE__*/_jsx(Panel, {
104
+ open: api.value.includes(item.value),
105
+ attributes: body,
106
+ children: item.content
107
+ })]
108
+ }, item.value);
109
+ });
110
+ $[9] = className;
111
+ $[10] = items;
112
+ $[11] = service;
113
+ $[12] = style;
114
+ $[13] = t6;
115
+ $[14] = t7;
116
+ } else {
117
+ t6 = $[13];
118
+ t7 = $[14];
119
+ }
120
+ let t8;
121
+ if ($[15] !== t6 || $[16] !== t7) {
122
+ t8 = /*#__PURE__*/_jsx("div", {
123
+ ...t6,
124
+ children: t7
125
+ });
126
+ $[15] = t6;
127
+ $[16] = t7;
128
+ $[17] = t8;
129
+ } else {
130
+ t8 = $[17];
131
+ }
132
+ return t8;
26
133
  }
27
- function Panel({ open, attributes, children, }) {
28
- const panel = useRef(null);
29
- const shown = useRef(undefined);
30
- const [closedAtFirst] = useState(!open);
31
- useLayoutEffect(() => {
32
- if (!panel.current)
33
- return;
34
- const stop = setPanelOpen(panel.current, open, shown.current !== undefined && shown.current !== open);
35
- shown.current = open;
36
- return stop;
37
- }, [open]);
38
- return (_jsx("div", { ...attributes, ref: panel, hidden: closedAtFirst || undefined, role: "group", "aria-hidden": open ? undefined : true, className: "xds-accordion__panel", children: _jsx("div", { className: "xds-accordion__body", children: children }) }));
134
+ function Panel(t0) {
135
+ const $ = _c(10);
136
+ const {
137
+ open,
138
+ attributes,
139
+ children
140
+ } = t0;
141
+ const panel = useRef(null);
142
+ const shown = useRef(undefined);
143
+ const [closedAtFirst] = useState(!open);
144
+ let t1;
145
+ let t2;
146
+ if ($[0] !== open) {
147
+ t1 = () => {
148
+ if (!panel.current) {
149
+ return;
150
+ }
151
+ const stop = setPanelOpen(panel.current, open, shown.current !== undefined && shown.current !== open);
152
+ shown.current = open;
153
+ return stop;
154
+ };
155
+ t2 = [open];
156
+ $[0] = open;
157
+ $[1] = t1;
158
+ $[2] = t2;
159
+ } else {
160
+ t1 = $[1];
161
+ t2 = $[2];
162
+ }
163
+ useLayoutEffect(t1, t2);
164
+ const t3 = closedAtFirst || undefined;
165
+ const t4 = open ? undefined : true;
166
+ let t5;
167
+ if ($[3] !== children) {
168
+ t5 = /*#__PURE__*/_jsx("div", {
169
+ className: "xds-accordion__body",
170
+ children: children
171
+ });
172
+ $[3] = children;
173
+ $[4] = t5;
174
+ } else {
175
+ t5 = $[4];
176
+ }
177
+ let t6;
178
+ if ($[5] !== attributes || $[6] !== t3 || $[7] !== t4 || $[8] !== t5) {
179
+ t6 = /*#__PURE__*/_jsx("div", {
180
+ ...attributes,
181
+ ref: panel,
182
+ hidden: t3,
183
+ role: "group",
184
+ "aria-hidden": t4,
185
+ className: "xds-accordion__panel",
186
+ children: t5
187
+ });
188
+ $[5] = attributes;
189
+ $[6] = t3;
190
+ $[7] = t4;
191
+ $[8] = t5;
192
+ $[9] = t6;
193
+ } else {
194
+ t6 = $[9];
195
+ }
196
+ return t6;
39
197
  }
package/dist/Avatar.js CHANGED
@@ -1,10 +1,69 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { avatarClass, avatarInitials, classes, pictureClass, rootPart, } from "@xds/core";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { avatarClass, avatarInitials, classes, pictureClass, rootPart } from "@xds/core";
3
3
  import { useDefaults } from "./Defaults.js";
4
4
  import { usePicture } from "./picture.js";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export function Avatar(props) {
6
- const defaults = useDefaults("Avatar");
7
- const { name, src, size = defaults.size, className, style } = props;
8
- const picture = usePicture(src);
9
- return (_jsxs("span", { role: "img", "aria-label": name, className: classes(rootPart("Avatar"), avatarClass(size), className), style: style, children: [avatarInitials(name, size), src && picture.loaded !== false && (_jsx("img", { src: src, alt: "", "aria-hidden": "true", className: pictureClass(picture.loaded === true), ref: picture.ref, onLoad: picture.onLoad, onError: picture.onError }))] }));
7
+ const $ = _c(15);
8
+ const defaults = useDefaults("Avatar");
9
+ const {
10
+ name,
11
+ src,
12
+ className,
13
+ style
14
+ } = props;
15
+ const size = props.size ?? defaults.size;
16
+ const picture = usePicture(src);
17
+ let t0;
18
+ if ($[0] !== className || $[1] !== size) {
19
+ t0 = classes(rootPart("Avatar"), avatarClass(size), className);
20
+ $[0] = className;
21
+ $[1] = size;
22
+ $[2] = t0;
23
+ } else {
24
+ t0 = $[2];
25
+ }
26
+ let t1;
27
+ if ($[3] !== name || $[4] !== size) {
28
+ t1 = avatarInitials(name, size);
29
+ $[3] = name;
30
+ $[4] = size;
31
+ $[5] = t1;
32
+ } else {
33
+ t1 = $[5];
34
+ }
35
+ let t2;
36
+ if ($[6] !== picture || $[7] !== src) {
37
+ t2 = src && picture.loaded !== false && /*#__PURE__*/_jsx("img", {
38
+ src: src,
39
+ alt: "",
40
+ "aria-hidden": "true",
41
+ className: pictureClass(picture.loaded === true),
42
+ ...picture.image
43
+ });
44
+ $[6] = picture;
45
+ $[7] = src;
46
+ $[8] = t2;
47
+ } else {
48
+ t2 = $[8];
49
+ }
50
+ let t3;
51
+ if ($[9] !== name || $[10] !== style || $[11] !== t0 || $[12] !== t1 || $[13] !== t2) {
52
+ t3 = /*#__PURE__*/_jsxs("span", {
53
+ role: "img",
54
+ "aria-label": name,
55
+ className: t0,
56
+ style: style,
57
+ children: [t1, t2]
58
+ });
59
+ $[9] = name;
60
+ $[10] = style;
61
+ $[11] = t0;
62
+ $[12] = t1;
63
+ $[13] = t2;
64
+ $[14] = t3;
65
+ } else {
66
+ t3 = $[14];
67
+ }
68
+ return t3;
10
69
  }
@@ -1,10 +1,105 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { avatarStack, avatarStackClass, avatarStackItemClass, avatarStackRestClass, classes, rootPart, } from "@xds/core";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { avatarStack, avatarStackClass, avatarStackItemClass, avatarStackRestClass, classes, rootPart } from "@xds/core";
3
3
  import { Avatar } from "./Avatar.js";
4
4
  import { useDefaults } from "./Defaults.js";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export function AvatarStack(props) {
6
- const defaults = useDefaults("AvatarStack");
7
- const { people, max, size = defaults.size ?? "md", label, className, style } = props;
8
- const stack = avatarStack(people, max, label);
9
- return (_jsxs("span", { role: "img", "aria-label": stack.name, className: classes(rootPart("AvatarStack"), avatarStackClass, className), style: style, children: [stack.shown.map((person, index) => (_jsx("span", { "aria-hidden": "true", className: avatarStackItemClass(size), children: _jsx(Avatar, { name: person.name, src: person.src, size: size }) }, index))), stack.rest > 0 && (_jsxs("span", { "aria-hidden": "true", className: avatarStackRestClass(size), children: ["+", stack.rest] }))] }));
7
+ const $ = _c(26);
8
+ const defaults = useDefaults("AvatarStack");
9
+ const {
10
+ people,
11
+ max,
12
+ label,
13
+ className,
14
+ style
15
+ } = props;
16
+ const size = props.size ?? defaults.size ?? "md";
17
+ let stack;
18
+ let t0;
19
+ let t1;
20
+ let t2;
21
+ let t3;
22
+ let t4;
23
+ if ($[0] !== className || $[1] !== label || $[2] !== max || $[3] !== people || $[4] !== size || $[5] !== style) {
24
+ stack = avatarStack(people, max, label);
25
+ t0 = "img";
26
+ t1 = stack.name;
27
+ if ($[12] !== className) {
28
+ t2 = classes(rootPart("AvatarStack"), avatarStackClass, className);
29
+ $[12] = className;
30
+ $[13] = t2;
31
+ } else {
32
+ t2 = $[13];
33
+ }
34
+ t3 = style;
35
+ let t5;
36
+ if ($[14] !== size) {
37
+ t5 = (person, index) => /*#__PURE__*/_jsx("span", {
38
+ "aria-hidden": "true",
39
+ className: avatarStackItemClass(size),
40
+ children: /*#__PURE__*/_jsx(Avatar, {
41
+ name: person.name,
42
+ src: person.src,
43
+ size: size
44
+ })
45
+ }, index);
46
+ $[14] = size;
47
+ $[15] = t5;
48
+ } else {
49
+ t5 = $[15];
50
+ }
51
+ t4 = stack.shown.map(t5);
52
+ $[0] = className;
53
+ $[1] = label;
54
+ $[2] = max;
55
+ $[3] = people;
56
+ $[4] = size;
57
+ $[5] = style;
58
+ $[6] = stack;
59
+ $[7] = t0;
60
+ $[8] = t1;
61
+ $[9] = t2;
62
+ $[10] = t3;
63
+ $[11] = t4;
64
+ } else {
65
+ stack = $[6];
66
+ t0 = $[7];
67
+ t1 = $[8];
68
+ t2 = $[9];
69
+ t3 = $[10];
70
+ t4 = $[11];
71
+ }
72
+ let t5;
73
+ if ($[16] !== size || $[17] !== stack.rest) {
74
+ t5 = stack.rest > 0 && /*#__PURE__*/_jsxs("span", {
75
+ "aria-hidden": "true",
76
+ className: avatarStackRestClass(size),
77
+ children: ["+", stack.rest]
78
+ });
79
+ $[16] = size;
80
+ $[17] = stack.rest;
81
+ $[18] = t5;
82
+ } else {
83
+ t5 = $[18];
84
+ }
85
+ let t6;
86
+ if ($[19] !== t0 || $[20] !== t1 || $[21] !== t2 || $[22] !== t3 || $[23] !== t4 || $[24] !== t5) {
87
+ t6 = /*#__PURE__*/_jsxs("span", {
88
+ role: t0,
89
+ "aria-label": t1,
90
+ className: t2,
91
+ style: t3,
92
+ children: [t4, t5]
93
+ });
94
+ $[19] = t0;
95
+ $[20] = t1;
96
+ $[21] = t2;
97
+ $[22] = t3;
98
+ $[23] = t4;
99
+ $[24] = t5;
100
+ $[25] = t6;
101
+ } else {
102
+ t6 = $[25];
103
+ }
104
+ return t6;
10
105
  }
package/dist/Badge.js CHANGED
@@ -1,9 +1,66 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { badgeClass, badgeDotClass, classes, rootPart } from "@xds/core";
3
3
  import { useDefaults } from "./Defaults.js";
4
4
  import { Icon } from "./Icon.js";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export function Badge(props) {
6
- const defaults = useDefaults("Badge");
7
- const { tone = defaults.tone, dot = false, icon, className, style, children } = props;
8
- return (_jsxs("span", { className: classes(rootPart("Badge"), badgeClass(tone), className), style: style, children: [dot && _jsx("span", { "aria-hidden": true, className: badgeDotClass }), icon && _jsx(Icon, { name: icon, size: "xs" }), children] }));
7
+ const $ = _c(13);
8
+ const defaults = useDefaults("Badge");
9
+ const {
10
+ dot: t0,
11
+ icon,
12
+ className,
13
+ style,
14
+ children
15
+ } = props;
16
+ const dot = t0 === undefined ? false : t0;
17
+ const tone = props.tone ?? defaults.tone;
18
+ let t1;
19
+ if ($[0] !== className || $[1] !== tone) {
20
+ t1 = classes(rootPart("Badge"), badgeClass(tone), className);
21
+ $[0] = className;
22
+ $[1] = tone;
23
+ $[2] = t1;
24
+ } else {
25
+ t1 = $[2];
26
+ }
27
+ let t2;
28
+ if ($[3] !== dot) {
29
+ t2 = dot && /*#__PURE__*/_jsx("span", {
30
+ "aria-hidden": true,
31
+ className: badgeDotClass
32
+ });
33
+ $[3] = dot;
34
+ $[4] = t2;
35
+ } else {
36
+ t2 = $[4];
37
+ }
38
+ let t3;
39
+ if ($[5] !== icon) {
40
+ t3 = icon && /*#__PURE__*/_jsx(Icon, {
41
+ name: icon,
42
+ size: "xs"
43
+ });
44
+ $[5] = icon;
45
+ $[6] = t3;
46
+ } else {
47
+ t3 = $[6];
48
+ }
49
+ let t4;
50
+ if ($[7] !== children || $[8] !== style || $[9] !== t1 || $[10] !== t2 || $[11] !== t3) {
51
+ t4 = /*#__PURE__*/_jsxs("span", {
52
+ className: t1,
53
+ style: style,
54
+ children: [t2, t3, children]
55
+ });
56
+ $[7] = children;
57
+ $[8] = style;
58
+ $[9] = t1;
59
+ $[10] = t2;
60
+ $[11] = t3;
61
+ $[12] = t4;
62
+ } else {
63
+ t4 = $[12];
64
+ }
65
+ return t4;
9
66
  }
package/dist/Banner.js CHANGED
@@ -1,10 +1,166 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { BANNER_PARTS, bannerClass, bannerIconClass, bannerIconPath, bannerRole, classes, rootPart, } from "@xds/core";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { BANNER_PARTS, bannerClass, bannerIconClass, bannerIconPath, bannerRole, classes, rootPart } from "@xds/core";
3
3
  import { Button } from "./Button.js";
4
4
  import { useDefaults } from "./Defaults.js";
5
5
  import { IconButton } from "./IconButton.js";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
7
  export function Banner(props) {
7
- const defaults = useDefaults("Banner");
8
- const { tone = defaults.tone, title, action, onDismiss, dismissLabel = "Dismiss", className, style, children, } = props;
9
- return (_jsxs("div", { role: bannerRole(tone), className: classes(rootPart("Banner"), bannerClass(tone), className), style: style, children: [_jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", className: bannerIconClass(tone), children: _jsx("path", { fill: "currentColor", d: bannerIconPath(tone) }) }), _jsxs("div", { className: BANNER_PARTS.body, children: [title && _jsx("p", { className: BANNER_PARTS.title, children: title }), _jsx("div", { children: children }), action && (_jsx("div", { className: BANNER_PARTS.action, children: _jsx(Button, { variant: "secondary", size: "sm", onPress: action.onPress, children: action.label }) }))] }), onDismiss && (_jsx("div", { className: BANNER_PARTS.dismiss, children: _jsx(IconButton, { icon: "x", label: dismissLabel, variant: "ghost", size: "sm", onPress: onDismiss }) }))] }));
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;
10
166
  }