@adecore/ui 0.31.11 → 0.32.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 (163) hide show
  1. package/dist/AccentSwatches.js +290 -13
  2. package/dist/Banner.js +90 -9
  3. package/dist/Button.js +114 -22
  4. package/dist/ButtonGroup.js +62 -8
  5. package/dist/Checkbox.js +73 -4
  6. package/dist/ChoiceCards.js +205 -11
  7. package/dist/CloseButton.js +87 -7
  8. package/dist/ColorSwatch.js +132 -15
  9. package/dist/ColorWheelPicker.js +305 -71
  10. package/dist/ColumnResizeHandle.js +43 -8
  11. package/dist/DisabledReason.js +27 -8
  12. package/dist/DockShell.js +144 -37
  13. package/dist/EmptyState.js +95 -6
  14. package/dist/ErrorBoundary.js +254 -31
  15. package/dist/Field.js +349 -31
  16. package/dist/FileIcon.js +67 -6
  17. package/dist/Icon.js +38 -6
  18. package/dist/IconButton.js +176 -20
  19. package/dist/IconPicker.js +344 -73
  20. package/dist/Input.js +233 -14
  21. package/dist/Kbd.js +150 -10
  22. package/dist/LazyBoundary.js +14 -5
  23. package/dist/ListRow.js +75 -15
  24. package/dist/Meter.js +108 -5
  25. package/dist/MiddleTruncate.js +126 -45
  26. package/dist/PanelEmpty.js +64 -5
  27. package/dist/PanelHeader.js +95 -13
  28. package/dist/Pill.js +114 -19
  29. package/dist/ProjectSwitcher.js +225 -12
  30. package/dist/PromptDialog.js +352 -37
  31. package/dist/SectionLabel.js +62 -8
  32. package/dist/SegmentBar.js +197 -36
  33. package/dist/Segmented.js +130 -23
  34. package/dist/Select.js +310 -19
  35. package/dist/SelectSearch.js +344 -29
  36. package/dist/Separator.js +35 -4
  37. package/dist/ShortcutHints.js +146 -76
  38. package/dist/Skeleton.js +31 -4
  39. package/dist/Slider.js +172 -10
  40. package/dist/SlidingColumn.js +194 -34
  41. package/dist/Spinner.js +100 -3
  42. package/dist/Stepper.js +232 -11
  43. package/dist/Surface.js +62 -8
  44. package/dist/Switch.js +60 -6
  45. package/dist/TextMenu.js +212 -17
  46. package/dist/Tile.js +149 -5
  47. package/dist/Toasts.js +391 -33
  48. package/dist/Tooltip.js +153 -16
  49. package/dist/UIProvider.js +62 -15
  50. package/dist/Waveform.js +362 -93
  51. package/dist/Wipe.js +259 -34
  52. package/dist/ZoomControls.js +356 -14
  53. package/dist/class-name.js +1 -1
  54. package/dist/clipboard.js +15 -17
  55. package/dist/context-menu/index.parts.js +1 -1
  56. package/dist/dialog/index.parts.js +1 -1
  57. package/dist/dialog/parts.js +378 -29
  58. package/dist/dialog-layer.js +51 -18
  59. package/dist/error-boundary.js +19 -19
  60. package/dist/error-message.js +1 -1
  61. package/dist/field-context.js +7 -5
  62. package/dist/file-icon.js +23 -21
  63. package/dist/file-tree/helpers.js +133 -119
  64. package/dist/file-tree/index.parts.js +3 -3
  65. package/dist/file-tree/parts.js +418 -127
  66. package/dist/file-tree/style.js +1 -1
  67. package/dist/file-tree/use-file-tree-shift.js +43 -30
  68. package/dist/file-tree/use-file-tree.js +60 -18
  69. package/dist/file-tree/use-slots.js +220 -192
  70. package/dist/floating.js +2 -2
  71. package/dist/format/datetime.js +88 -38
  72. package/dist/format/duration.js +59 -53
  73. package/dist/format/index.js +1 -1
  74. package/dist/format/locale.js +76 -56
  75. package/dist/format/number.js +77 -61
  76. package/dist/format/regions.js +4 -2
  77. package/dist/format/time-zone.js +1 -1
  78. package/dist/icon-button-size.js +12 -2
  79. package/dist/icon-picker.js +70 -61
  80. package/dist/index.js +57 -57
  81. package/dist/key-value-list/index.parts.js +1 -1
  82. package/dist/key-value-list/parts.js +256 -22
  83. package/dist/lazy-landings.js +10 -10
  84. package/dist/lazy.js +84 -71
  85. package/dist/locales/en.js +80 -80
  86. package/dist/locales/nl.js +80 -80
  87. package/dist/locales.js +10 -7
  88. package/dist/menu/index.parts.js +1 -1
  89. package/dist/menu/parts.js +882 -44
  90. package/dist/merge-refs.js +8 -9
  91. package/dist/middle-truncate.js +24 -25
  92. package/dist/modality.js +27 -19
  93. package/dist/placement.js +11 -20
  94. package/dist/platform.js +6 -6
  95. package/dist/popover/index.parts.js +1 -1
  96. package/dist/popover/parts.js +173 -11
  97. package/dist/popup-layer.js +38 -17
  98. package/dist/prefetch.js +78 -79
  99. package/dist/preview-card/index.parts.js +1 -1
  100. package/dist/project-switcher-row.js +153 -12
  101. package/dist/select-row.js +69 -5
  102. package/dist/select-shared.js +6 -6
  103. package/dist/selection.js +16 -16
  104. package/dist/seti-icons.js +413 -413
  105. package/dist/settings/ConfirmDialog.js +55 -8
  106. package/dist/settings/DetailHeader.js +72 -4
  107. package/dist/settings/MasterDetail.js +119 -7
  108. package/dist/settings/SettingsDialog.js +820 -80
  109. package/dist/settings/SettingsRow.js +205 -18
  110. package/dist/settings/SettingsSection.js +96 -6
  111. package/dist/settings/index.js +7 -7
  112. package/dist/settings/target.js +7 -2
  113. package/dist/shortcut-hints.js +73 -55
  114. package/dist/shortcut.js +140 -104
  115. package/dist/step-places.js +1 -1
  116. package/dist/tabs/index.parts.js +1 -1
  117. package/dist/tabs/overflow.js +18 -18
  118. package/dist/tabs/parts.js +780 -166
  119. package/dist/testing/dedupe.js +82 -75
  120. package/dist/testing/fake-source.js +12 -12
  121. package/dist/testing/index.js +1 -1
  122. package/dist/toast-store.js +65 -46
  123. package/dist/tree/index.parts.js +1 -1
  124. package/dist/tree/parts.js +721 -94
  125. package/dist/tree/shift.js +28 -22
  126. package/dist/tree/style.js +2 -2
  127. package/dist/tree/use-tree-shift.js +178 -117
  128. package/dist/useAsyncAction.js +23 -19
  129. package/dist/useColumnResize.js +36 -34
  130. package/dist/useContentSize.js +62 -18
  131. package/dist/useMeasuredWidth.js +14 -3
  132. package/dist/useNow.js +73 -30
  133. package/dist/wipe-split.js +14 -14
  134. package/dist/workspace/DropPreview.js +60 -7
  135. package/dist/workspace/SplitView.js +1025 -441
  136. package/dist/workspace/TabStrip.js +810 -191
  137. package/dist/workspace/Workspace.js +276 -26
  138. package/dist/workspace/context.js +8 -3
  139. package/dist/workspace/geometry.js +173 -150
  140. package/dist/workspace/model.js +313 -250
  141. package/dist/workspace/preview.js +61 -61
  142. package/dist/zoom.js +2 -2
  143. package/package.json +1 -1
  144. package/src/ErrorBoundary.tsx +1 -1
  145. package/src/Field.tsx +4 -3
  146. package/src/IconPicker.tsx +3 -3
  147. package/src/LazyBoundary.tsx +2 -0
  148. package/src/MiddleTruncate.tsx +2 -2
  149. package/src/SegmentBar.tsx +2 -2
  150. package/src/Toasts.tsx +3 -1
  151. package/src/Tooltip.tsx +7 -10
  152. package/src/Waveform.tsx +3 -3
  153. package/src/file-tree/parts.tsx +6 -9
  154. package/src/file-tree/use-file-tree-shift.tsx +6 -9
  155. package/src/lazy.tsx +4 -0
  156. package/src/locales/en.ts +4 -4
  157. package/src/locales/nl.ts +5 -5
  158. package/src/settings/SettingsDialog.tsx +1 -1
  159. package/src/tree/parts.tsx +5 -8
  160. package/src/useContentSize.ts +3 -3
  161. package/src/workspace/SplitView.tsx +2 -2
  162. package/src/workspace/TabStrip.tsx +2 -3
  163. package/src/workspace/Workspace.tsx +2 -5
package/dist/Checkbox.js CHANGED
@@ -1,9 +1,78 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { Check, Minus } from 'lucide-react';
4
4
  import { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';
5
- import { Icon } from './Icon.js';
5
+ import { Icon } from "./Icon.js";
6
6
  /* Picked or not, as one item out of a list or an option that waits for a Save button. */
7
- export function Checkbox({ checked, onCheckedChange, label, indeterminate = false, disabled, className, ref }) {
8
- return (_jsx(BaseCheckbox.Root, { ref: ref, checked: checked, indeterminate: indeterminate, onCheckedChange: (next) => onCheckedChange(next), "aria-label": label, disabled: disabled, className: clsx('flex size-4 shrink-0 items-center justify-center rounded-sm border border-border-strong bg-surface text-accent-text transition-colors', 'data-checked:border-accent data-checked:bg-accent data-indeterminate:border-accent data-indeterminate:bg-accent data-disabled:opacity-50', className), children: _jsx(BaseCheckbox.Indicator, { render: (props, state) => (_jsx("span", { ...props, children: _jsx(Icon, { icon: state.indeterminate ? Minus : Check, size: 12 }) })) }) }));
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ export function Checkbox(t0) {
9
+ const $ = _c(13);
10
+ const {
11
+ checked,
12
+ onCheckedChange,
13
+ label,
14
+ indeterminate: t1,
15
+ disabled,
16
+ className,
17
+ ref
18
+ } = t0;
19
+ const indeterminate = t1 === undefined ? false : t1;
20
+ let t2;
21
+ if ($[0] !== onCheckedChange) {
22
+ t2 = next => onCheckedChange(next);
23
+ $[0] = onCheckedChange;
24
+ $[1] = t2;
25
+ } else {
26
+ t2 = $[1];
27
+ }
28
+ let t3;
29
+ if ($[2] !== className) {
30
+ t3 = clsx("flex size-4 shrink-0 items-center justify-center rounded-sm border border-border-strong bg-surface text-accent-text transition-colors", "data-checked:border-accent data-checked:bg-accent data-indeterminate:border-accent data-indeterminate:bg-accent data-disabled:opacity-50", className);
31
+ $[2] = className;
32
+ $[3] = t3;
33
+ } else {
34
+ t3 = $[3];
35
+ }
36
+ let t4;
37
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
38
+ t4 = /*#__PURE__*/_jsx(BaseCheckbox.Indicator, {
39
+ render: _temp
40
+ });
41
+ $[4] = t4;
42
+ } else {
43
+ t4 = $[4];
44
+ }
45
+ let t5;
46
+ if ($[5] !== checked || $[6] !== disabled || $[7] !== indeterminate || $[8] !== label || $[9] !== ref || $[10] !== t2 || $[11] !== t3) {
47
+ t5 = /*#__PURE__*/_jsx(BaseCheckbox.Root, {
48
+ ref: ref,
49
+ checked: checked,
50
+ indeterminate: indeterminate,
51
+ onCheckedChange: t2,
52
+ "aria-label": label,
53
+ disabled: disabled,
54
+ className: t3,
55
+ children: t4
56
+ });
57
+ $[5] = checked;
58
+ $[6] = disabled;
59
+ $[7] = indeterminate;
60
+ $[8] = label;
61
+ $[9] = ref;
62
+ $[10] = t2;
63
+ $[11] = t3;
64
+ $[12] = t5;
65
+ } else {
66
+ t5 = $[12];
67
+ }
68
+ return t5;
9
69
  }
70
+ function _temp(props, state) {
71
+ return /*#__PURE__*/_jsx("span", {
72
+ ...props,
73
+ children: /*#__PURE__*/_jsx(Icon, {
74
+ icon: state.indeterminate ? Minus : Check,
75
+ size: 12
76
+ })
77
+ });
78
+ }
@@ -1,21 +1,215 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Fragment, useId } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { Radio } from '@base-ui/react/radio';
5
5
  import { RadioGroup } from '@base-ui/react/radio-group';
6
- import { Icon } from './Icon.js';
7
- function ChoiceCard({ choice, radio }) {
8
- const id = useId();
9
- // As tall as the title's line, so the dot centers on it.
10
- const dot = (_jsx("span", { className: "flex h-(--text-sm--line-height) shrink-0 items-center", "aria-hidden": true, children: _jsx("span", { className: "size-4 rounded-full border border-border-strong group-data-checked:border-5 group-data-checked:border-accent group-data-checked:bg-accent-text" }) }));
11
- return (_jsxs(Radio.Root, { value: choice.value, disabled: choice.disabled, "aria-labelledby": `${id}-title`, "aria-describedby": `${id}-description`, className: "group focus-ring flex min-w-0 items-start gap-3 rounded-xl border border-border bg-surface p-3 text-left hover:bg-surface-hover data-checked:border-accent data-disabled:opacity-50 data-disabled:hover:bg-surface", children: [radio === 'start' && dot, choice.icon && (_jsx("span", { className: "grid size-8 shrink-0 place-items-center rounded-lg bg-surface-sunken text-text-muted group-data-checked:text-accent", children: _jsx(Icon, { icon: choice.icon, size: 16 }) })), _jsxs("span", { className: "flex min-w-0 grow flex-col gap-0.5", children: [_jsx("span", { id: `${id}-title`, className: "text-sm font-medium text-text", children: choice.title }), _jsx("span", { id: `${id}-description`, className: "text-xs text-pretty text-text-muted", children: choice.description })] }), radio === 'end' && dot] }));
6
+ import { Icon } from "./Icon.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ function ChoiceCard(t0) {
9
+ const $ = _c(21);
10
+ const {
11
+ choice,
12
+ radio
13
+ } = t0;
14
+ const id = useId();
15
+ let t1;
16
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
17
+ t1 = /*#__PURE__*/_jsx("span", {
18
+ className: "flex h-(--text-sm--line-height) shrink-0 items-center",
19
+ "aria-hidden": true,
20
+ children: /*#__PURE__*/_jsx("span", {
21
+ className: "size-4 rounded-full border border-border-strong group-data-checked:border-5 group-data-checked:border-accent group-data-checked:bg-accent-text"
22
+ })
23
+ });
24
+ $[0] = t1;
25
+ } else {
26
+ t1 = $[0];
27
+ }
28
+ const dot = t1;
29
+ const t2 = `${id}-title`;
30
+ const t3 = `${id}-description`;
31
+ const t4 = radio === "start" && dot;
32
+ let t5;
33
+ if ($[1] !== choice.icon) {
34
+ t5 = choice.icon && /*#__PURE__*/_jsx("span", {
35
+ className: "grid size-8 shrink-0 place-items-center rounded-lg bg-surface-sunken text-text-muted group-data-checked:text-accent",
36
+ children: /*#__PURE__*/_jsx(Icon, {
37
+ icon: choice.icon,
38
+ size: 16
39
+ })
40
+ });
41
+ $[1] = choice.icon;
42
+ $[2] = t5;
43
+ } else {
44
+ t5 = $[2];
45
+ }
46
+ const t6 = `${id}-title`;
47
+ let t7;
48
+ if ($[3] !== choice.title || $[4] !== t6) {
49
+ t7 = /*#__PURE__*/_jsx("span", {
50
+ id: t6,
51
+ className: "text-sm font-medium text-text",
52
+ children: choice.title
53
+ });
54
+ $[3] = choice.title;
55
+ $[4] = t6;
56
+ $[5] = t7;
57
+ } else {
58
+ t7 = $[5];
59
+ }
60
+ const t8 = `${id}-description`;
61
+ let t9;
62
+ if ($[6] !== choice.description || $[7] !== t8) {
63
+ t9 = /*#__PURE__*/_jsx("span", {
64
+ id: t8,
65
+ className: "text-xs text-pretty text-text-muted",
66
+ children: choice.description
67
+ });
68
+ $[6] = choice.description;
69
+ $[7] = t8;
70
+ $[8] = t9;
71
+ } else {
72
+ t9 = $[8];
73
+ }
74
+ let t10;
75
+ if ($[9] !== t7 || $[10] !== t9) {
76
+ t10 = /*#__PURE__*/_jsxs("span", {
77
+ className: "flex min-w-0 grow flex-col gap-0.5",
78
+ children: [t7, t9]
79
+ });
80
+ $[9] = t7;
81
+ $[10] = t9;
82
+ $[11] = t10;
83
+ } else {
84
+ t10 = $[11];
85
+ }
86
+ const t11 = radio === "end" && dot;
87
+ let t12;
88
+ if ($[12] !== choice.disabled || $[13] !== choice.value || $[14] !== t10 || $[15] !== t11 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
89
+ t12 = /*#__PURE__*/_jsxs(Radio.Root, {
90
+ value: choice.value,
91
+ disabled: choice.disabled,
92
+ "aria-labelledby": t2,
93
+ "aria-describedby": t3,
94
+ className: "group focus-ring flex min-w-0 items-start gap-3 rounded-xl border border-border bg-surface p-3 text-left hover:bg-surface-hover data-checked:border-accent data-disabled:opacity-50 data-disabled:hover:bg-surface",
95
+ children: [t4, t5, t10, t11]
96
+ });
97
+ $[12] = choice.disabled;
98
+ $[13] = choice.value;
99
+ $[14] = t10;
100
+ $[15] = t11;
101
+ $[16] = t2;
102
+ $[17] = t3;
103
+ $[18] = t4;
104
+ $[19] = t5;
105
+ $[20] = t12;
106
+ } else {
107
+ t12 = $[20];
108
+ }
109
+ return t12;
12
110
  }
13
111
  /*
14
112
  * One of a few options, each a card that says what it means, for a choice that deserves more than a
15
113
  * select: the cards stand side by side at the same width, one under the other or in a set number of
16
114
  * columns, and the arrow keys move between them.
17
115
  */
18
- export function ChoiceCards({ value, onValueChange, choices, label, orientation = 'horizontal', columns, radio = 'end', detail, disabled, className, ref }) {
19
- const vertical = columns === undefined && orientation === 'vertical';
20
- return (_jsx(RadioGroup, { ref: ref, value: value, onValueChange: (next) => onValueChange(next), disabled: disabled, "aria-label": label, className: clsx('grid gap-2', columns !== undefined || vertical ? 'grid-flow-row' : 'auto-cols-fr grid-flow-col', className), style: columns !== undefined ? { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` } : undefined, children: choices.map((choice) => (_jsxs(Fragment, { children: [_jsx(ChoiceCard, { choice: choice, radio: radio }), vertical && choice.value === value && detail] }, choice.value))) }));
21
- }
116
+ export function ChoiceCards(t0) {
117
+ const $ = _c(27);
118
+ const {
119
+ value,
120
+ onValueChange,
121
+ choices,
122
+ label,
123
+ orientation: t1,
124
+ columns,
125
+ radio: t2,
126
+ detail,
127
+ disabled,
128
+ className,
129
+ ref
130
+ } = t0;
131
+ const orientation = t1 === undefined ? "horizontal" : t1;
132
+ const radio = t2 === undefined ? "end" : t2;
133
+ const vertical = columns === undefined && orientation === "vertical";
134
+ let t3;
135
+ if ($[0] !== onValueChange) {
136
+ t3 = next => onValueChange(next);
137
+ $[0] = onValueChange;
138
+ $[1] = t3;
139
+ } else {
140
+ t3 = $[1];
141
+ }
142
+ const t4 = columns !== undefined || vertical ? "grid-flow-row" : "auto-cols-fr grid-flow-col";
143
+ let t5;
144
+ if ($[2] !== className || $[3] !== t4) {
145
+ t5 = clsx("grid gap-2", t4, className);
146
+ $[2] = className;
147
+ $[3] = t4;
148
+ $[4] = t5;
149
+ } else {
150
+ t5 = $[4];
151
+ }
152
+ let t6;
153
+ if ($[5] !== columns) {
154
+ t6 = columns !== undefined ? {
155
+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
156
+ } : undefined;
157
+ $[5] = columns;
158
+ $[6] = t6;
159
+ } else {
160
+ t6 = $[6];
161
+ }
162
+ let t7;
163
+ if ($[7] !== choices || $[8] !== detail || $[9] !== radio || $[10] !== value || $[11] !== vertical) {
164
+ let t8;
165
+ if ($[13] !== detail || $[14] !== radio || $[15] !== value || $[16] !== vertical) {
166
+ t8 = choice => /*#__PURE__*/_jsxs(Fragment, {
167
+ children: [/*#__PURE__*/_jsx(ChoiceCard, {
168
+ choice: choice,
169
+ radio: radio
170
+ }), vertical && choice.value === value && detail]
171
+ }, choice.value);
172
+ $[13] = detail;
173
+ $[14] = radio;
174
+ $[15] = value;
175
+ $[16] = vertical;
176
+ $[17] = t8;
177
+ } else {
178
+ t8 = $[17];
179
+ }
180
+ t7 = choices.map(t8);
181
+ $[7] = choices;
182
+ $[8] = detail;
183
+ $[9] = radio;
184
+ $[10] = value;
185
+ $[11] = vertical;
186
+ $[12] = t7;
187
+ } else {
188
+ t7 = $[12];
189
+ }
190
+ let t8;
191
+ if ($[18] !== disabled || $[19] !== label || $[20] !== ref || $[21] !== t3 || $[22] !== t5 || $[23] !== t6 || $[24] !== t7 || $[25] !== value) {
192
+ t8 = /*#__PURE__*/_jsx(RadioGroup, {
193
+ ref: ref,
194
+ value: value,
195
+ onValueChange: t3,
196
+ disabled: disabled,
197
+ "aria-label": label,
198
+ className: t5,
199
+ style: t6,
200
+ children: t7
201
+ });
202
+ $[18] = disabled;
203
+ $[19] = label;
204
+ $[20] = ref;
205
+ $[21] = t3;
206
+ $[22] = t5;
207
+ $[23] = t6;
208
+ $[24] = t7;
209
+ $[25] = value;
210
+ $[26] = t8;
211
+ } else {
212
+ t8 = $[26];
213
+ }
214
+ return t8;
215
+ }
@@ -1,11 +1,91 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { X } from 'lucide-react';
3
3
  import { Dialog } from '@base-ui/react/dialog';
4
- import { IconButton } from './IconButton.js';
4
+ import { IconButton } from "./IconButton.js";
5
5
  /* The close button in the header of every panel and dialog. In a dialog it is that dialog's own close part. */
6
- export function CloseButton({ label, kbd, size, className, ref, ...closes }) {
7
- if ('dialog' in closes) {
8
- return _jsx(IconButton, { ref: ref, icon: X, label: label, kbd: kbd, size: size, className: className, render: _jsx(Dialog.Close, {}) });
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export function CloseButton(t0) {
8
+ const $ = _c(21);
9
+ let className;
10
+ let closes;
11
+ let kbd;
12
+ let label;
13
+ let ref;
14
+ let size;
15
+ if ($[0] !== t0) {
16
+ ({
17
+ label,
18
+ kbd,
19
+ size,
20
+ className,
21
+ ref,
22
+ ...closes
23
+ } = t0);
24
+ $[0] = t0;
25
+ $[1] = className;
26
+ $[2] = closes;
27
+ $[3] = kbd;
28
+ $[4] = label;
29
+ $[5] = ref;
30
+ $[6] = size;
31
+ } else {
32
+ className = $[1];
33
+ closes = $[2];
34
+ kbd = $[3];
35
+ label = $[4];
36
+ ref = $[5];
37
+ size = $[6];
38
+ }
39
+ if ("dialog" in closes) {
40
+ let t1;
41
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
42
+ t1 = /*#__PURE__*/_jsx(Dialog.Close, {});
43
+ $[7] = t1;
44
+ } else {
45
+ t1 = $[7];
46
+ }
47
+ let t2;
48
+ if ($[8] !== className || $[9] !== kbd || $[10] !== label || $[11] !== ref || $[12] !== size) {
49
+ t2 = /*#__PURE__*/_jsx(IconButton, {
50
+ ref: ref,
51
+ icon: X,
52
+ label: label,
53
+ kbd: kbd,
54
+ size: size,
55
+ className: className,
56
+ render: t1
57
+ });
58
+ $[8] = className;
59
+ $[9] = kbd;
60
+ $[10] = label;
61
+ $[11] = ref;
62
+ $[12] = size;
63
+ $[13] = t2;
64
+ } else {
65
+ t2 = $[13];
9
66
  }
10
- return _jsx(IconButton, { ref: ref, icon: X, label: label, kbd: kbd, size: size, className: className, onClick: closes.onClick });
11
- }
67
+ return t2;
68
+ }
69
+ let t1;
70
+ if ($[14] !== className || $[15] !== closes.onClick || $[16] !== kbd || $[17] !== label || $[18] !== ref || $[19] !== size) {
71
+ t1 = /*#__PURE__*/_jsx(IconButton, {
72
+ ref: ref,
73
+ icon: X,
74
+ label: label,
75
+ kbd: kbd,
76
+ size: size,
77
+ className: className,
78
+ onClick: closes.onClick
79
+ });
80
+ $[14] = className;
81
+ $[15] = closes.onClick;
82
+ $[16] = kbd;
83
+ $[17] = label;
84
+ $[18] = ref;
85
+ $[19] = size;
86
+ $[20] = t1;
87
+ } else {
88
+ t1 = $[20];
89
+ }
90
+ return t1;
91
+ }
@@ -1,28 +1,145 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { Check } from 'lucide-react';
4
4
  import { useRender } from '@base-ui/react/use-render';
5
- import { Icon } from './Icon.js';
5
+ import { Icon } from "./Icon.js";
6
6
  /* `focus-ring` for the swatch that is a menu item rather than a button, which the keyboard reaches all the same. */
7
+ import { jsx as _jsx } from "react/jsx-runtime";
7
8
  const SWATCH = 'focus-ring grid h-6 w-6 place-items-center rounded-full text-accent-text';
8
9
  /* The ring of the picked color is offset against whatever the swatch stands on. */
9
10
  const PICKED_RING = {
10
- surface: 'ring-2 ring-accent ring-offset-2 ring-offset-surface',
11
- popup: 'ring-2 ring-accent ring-offset-1 ring-offset-surface-raised'
11
+ surface: 'ring-2 ring-accent ring-offset-2 ring-offset-surface',
12
+ popup: 'ring-2 ring-accent ring-offset-1 ring-offset-surface-raised'
12
13
  };
13
14
  /*
14
15
  * One color, drawn as the color itself. Its name belongs in a tooltip, so the circle carries a tick
15
16
  * alone when it is picked. Children replace the tick, such as the ellipsis of a "more colors" swatch.
16
17
  */
17
- export function ColorSwatch({ color, picked = false, on = 'surface', tick = true, render, className, style, ref, children, ...props }) {
18
- return useRender({
19
- render: render ?? _jsx("button", { type: "button" }),
20
- ref,
21
- props: {
22
- ...props,
23
- className: clsx(SWATCH, color === undefined ? 'border border-border-strong text-text-muted' : picked && PICKED_RING[on], className),
24
- style: color === undefined ? style : { ...style, background: color },
25
- children: children ?? (picked && tick && _jsx(Icon, { icon: Check, size: 12 }))
26
- }
18
+ export function ColorSwatch(t0) {
19
+ const $ = _c(32);
20
+ let children;
21
+ let className;
22
+ let color;
23
+ let props;
24
+ let ref;
25
+ let render;
26
+ let style;
27
+ let t1;
28
+ let t2;
29
+ let t3;
30
+ if ($[0] !== t0) {
31
+ ({
32
+ color,
33
+ picked: t1,
34
+ on: t2,
35
+ tick: t3,
36
+ render,
37
+ className,
38
+ style,
39
+ ref,
40
+ children,
41
+ ...props
42
+ } = t0);
43
+ $[0] = t0;
44
+ $[1] = children;
45
+ $[2] = className;
46
+ $[3] = color;
47
+ $[4] = props;
48
+ $[5] = ref;
49
+ $[6] = render;
50
+ $[7] = style;
51
+ $[8] = t1;
52
+ $[9] = t2;
53
+ $[10] = t3;
54
+ } else {
55
+ children = $[1];
56
+ className = $[2];
57
+ color = $[3];
58
+ props = $[4];
59
+ ref = $[5];
60
+ render = $[6];
61
+ style = $[7];
62
+ t1 = $[8];
63
+ t2 = $[9];
64
+ t3 = $[10];
65
+ }
66
+ const picked = t1 === undefined ? false : t1;
67
+ const on = t2 === undefined ? "surface" : t2;
68
+ const tick = t3 === undefined ? true : t3;
69
+ let t4;
70
+ if ($[11] !== render) {
71
+ t4 = render ?? /*#__PURE__*/_jsx("button", {
72
+ type: "button"
27
73
  });
28
- }
74
+ $[11] = render;
75
+ $[12] = t4;
76
+ } else {
77
+ t4 = $[12];
78
+ }
79
+ const t5 = color === undefined ? "border border-border-strong text-text-muted" : picked && PICKED_RING[on];
80
+ let t6;
81
+ if ($[13] !== className || $[14] !== t5) {
82
+ t6 = clsx(SWATCH, t5, className);
83
+ $[13] = className;
84
+ $[14] = t5;
85
+ $[15] = t6;
86
+ } else {
87
+ t6 = $[15];
88
+ }
89
+ let t7;
90
+ if ($[16] !== color || $[17] !== style) {
91
+ t7 = color === undefined ? style : {
92
+ ...style,
93
+ background: color
94
+ };
95
+ $[16] = color;
96
+ $[17] = style;
97
+ $[18] = t7;
98
+ } else {
99
+ t7 = $[18];
100
+ }
101
+ let t8;
102
+ if ($[19] !== children || $[20] !== picked || $[21] !== tick) {
103
+ t8 = children ?? (picked && tick && /*#__PURE__*/_jsx(Icon, {
104
+ icon: Check,
105
+ size: 12
106
+ }));
107
+ $[19] = children;
108
+ $[20] = picked;
109
+ $[21] = tick;
110
+ $[22] = t8;
111
+ } else {
112
+ t8 = $[22];
113
+ }
114
+ let t9;
115
+ if ($[23] !== props || $[24] !== t6 || $[25] !== t7 || $[26] !== t8) {
116
+ t9 = {
117
+ ...props,
118
+ className: t6,
119
+ style: t7,
120
+ children: t8
121
+ };
122
+ $[23] = props;
123
+ $[24] = t6;
124
+ $[25] = t7;
125
+ $[26] = t8;
126
+ $[27] = t9;
127
+ } else {
128
+ t9 = $[27];
129
+ }
130
+ let t10;
131
+ if ($[28] !== ref || $[29] !== t4 || $[30] !== t9) {
132
+ t10 = {
133
+ render: t4,
134
+ ref,
135
+ props: t9
136
+ };
137
+ $[28] = ref;
138
+ $[29] = t4;
139
+ $[30] = t9;
140
+ $[31] = t10;
141
+ } else {
142
+ t10 = $[31];
143
+ }
144
+ return useRender(t10);
145
+ }