@adecore/ui 0.31.12 → 0.33.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/Tile.js CHANGED
@@ -1,10 +1,154 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
- import { Kbd } from './Kbd.js';
3
+ import { Kbd } from "./Kbd.js";
4
4
  /*
5
5
  * One thing to start with, as a card that is a button: a start screen and the empty places of an app
6
6
  * use it, so a place to begin looks the same wherever it is offered.
7
7
  */
8
- export function Tile({ icon, title, description, shortcut, primary = false, size = 'md', className, type = 'button', ...rest }) {
9
- return (_jsxs("button", { type: type, className: clsx('flex min-w-0 items-center border bg-surface text-left hover:bg-surface-hover disabled:opacity-50 disabled:hover:bg-surface', size === 'md' ? 'gap-3 rounded-xl p-3' : 'gap-2 rounded-lg px-2 py-1.5', primary ? 'border-accent' : 'border-border', className), ...rest, children: [_jsx("span", { className: clsx('grid size-8 shrink-0 place-items-center rounded-lg', primary ? 'bg-accent text-accent-text' : 'bg-surface-sunken text-text-muted'), children: icon }), _jsxs("span", { className: "flex min-w-0 grow flex-col", children: [_jsx("span", { className: "truncate text-sm font-medium text-text", children: title }), description && _jsx("span", { className: "truncate text-xs text-text-muted", children: description })] }), shortcut && _jsx(Kbd, { shortcut: shortcut, variant: "inline", className: "shrink-0" })] }));
10
- }
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export function Tile(t0) {
10
+ const $ = _c(35);
11
+ let className;
12
+ let description;
13
+ let icon;
14
+ let rest;
15
+ let shortcut;
16
+ let t1;
17
+ let t2;
18
+ let t3;
19
+ let title;
20
+ if ($[0] !== t0) {
21
+ ({
22
+ icon,
23
+ title,
24
+ description,
25
+ shortcut,
26
+ primary: t1,
27
+ size: t2,
28
+ className,
29
+ type: t3,
30
+ ...rest
31
+ } = t0);
32
+ $[0] = t0;
33
+ $[1] = className;
34
+ $[2] = description;
35
+ $[3] = icon;
36
+ $[4] = rest;
37
+ $[5] = shortcut;
38
+ $[6] = t1;
39
+ $[7] = t2;
40
+ $[8] = t3;
41
+ $[9] = title;
42
+ } else {
43
+ className = $[1];
44
+ description = $[2];
45
+ icon = $[3];
46
+ rest = $[4];
47
+ shortcut = $[5];
48
+ t1 = $[6];
49
+ t2 = $[7];
50
+ t3 = $[8];
51
+ title = $[9];
52
+ }
53
+ const primary = t1 === undefined ? false : t1;
54
+ const size = t2 === undefined ? "md" : t2;
55
+ const type = t3 === undefined ? "button" : t3;
56
+ const t4 = size === "md" ? "gap-3 rounded-xl p-3" : "gap-2 rounded-lg px-2 py-1.5";
57
+ const t5 = primary ? "border-accent" : "border-border";
58
+ let t6;
59
+ if ($[10] !== className || $[11] !== t4 || $[12] !== t5) {
60
+ t6 = clsx("flex min-w-0 items-center border bg-surface text-left hover:bg-surface-hover disabled:opacity-50 disabled:hover:bg-surface", t4, t5, className);
61
+ $[10] = className;
62
+ $[11] = t4;
63
+ $[12] = t5;
64
+ $[13] = t6;
65
+ } else {
66
+ t6 = $[13];
67
+ }
68
+ const t7 = primary ? "bg-accent text-accent-text" : "bg-surface-sunken text-text-muted";
69
+ let t8;
70
+ if ($[14] !== t7) {
71
+ t8 = clsx("grid size-8 shrink-0 place-items-center rounded-lg", t7);
72
+ $[14] = t7;
73
+ $[15] = t8;
74
+ } else {
75
+ t8 = $[15];
76
+ }
77
+ let t9;
78
+ if ($[16] !== icon || $[17] !== t8) {
79
+ t9 = /*#__PURE__*/_jsx("span", {
80
+ className: t8,
81
+ children: icon
82
+ });
83
+ $[16] = icon;
84
+ $[17] = t8;
85
+ $[18] = t9;
86
+ } else {
87
+ t9 = $[18];
88
+ }
89
+ let t10;
90
+ if ($[19] !== title) {
91
+ t10 = /*#__PURE__*/_jsx("span", {
92
+ className: "truncate text-sm font-medium text-text",
93
+ children: title
94
+ });
95
+ $[19] = title;
96
+ $[20] = t10;
97
+ } else {
98
+ t10 = $[20];
99
+ }
100
+ let t11;
101
+ if ($[21] !== description) {
102
+ t11 = description && /*#__PURE__*/_jsx("span", {
103
+ className: "truncate text-xs text-text-muted",
104
+ children: description
105
+ });
106
+ $[21] = description;
107
+ $[22] = t11;
108
+ } else {
109
+ t11 = $[22];
110
+ }
111
+ let t12;
112
+ if ($[23] !== t10 || $[24] !== t11) {
113
+ t12 = /*#__PURE__*/_jsxs("span", {
114
+ className: "flex min-w-0 grow flex-col",
115
+ children: [t10, t11]
116
+ });
117
+ $[23] = t10;
118
+ $[24] = t11;
119
+ $[25] = t12;
120
+ } else {
121
+ t12 = $[25];
122
+ }
123
+ let t13;
124
+ if ($[26] !== shortcut) {
125
+ t13 = shortcut && /*#__PURE__*/_jsx(Kbd, {
126
+ shortcut: shortcut,
127
+ variant: "inline",
128
+ className: "shrink-0"
129
+ });
130
+ $[26] = shortcut;
131
+ $[27] = t13;
132
+ } else {
133
+ t13 = $[27];
134
+ }
135
+ let t14;
136
+ if ($[28] !== rest || $[29] !== t12 || $[30] !== t13 || $[31] !== t6 || $[32] !== t9 || $[33] !== type) {
137
+ t14 = /*#__PURE__*/_jsxs("button", {
138
+ type: type,
139
+ className: t6,
140
+ ...rest,
141
+ children: [t9, t12, t13]
142
+ });
143
+ $[28] = rest;
144
+ $[29] = t12;
145
+ $[30] = t13;
146
+ $[31] = t6;
147
+ $[32] = t9;
148
+ $[33] = type;
149
+ $[34] = t14;
150
+ } else {
151
+ t14 = $[34];
152
+ }
153
+ return t14;
154
+ }
package/dist/Toasts.js CHANGED
@@ -1,25 +1,27 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { useState } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { CircleAlert, CircleCheck, Trash, X } from 'lucide-react';
6
- import { Button } from './Button.js';
7
- import { Icon } from './Icon.js';
8
- import { IconButton } from './IconButton.js';
9
- import { Kbd } from './Kbd.js';
10
- import { Spinner } from './Spinner.js';
11
- import { Surface } from './Surface.js';
6
+ import { useStore } from 'zustand';
7
+ import { Button } from "./Button.js";
8
+ import { Icon } from "./Icon.js";
9
+ import { IconButton } from "./IconButton.js";
10
+ import { Kbd } from "./Kbd.js";
11
+ import { Spinner } from "./Spinner.js";
12
+ import { Surface } from "./Surface.js";
12
13
  import { elapsedOf } from './toast-store.js';
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
15
  const ICON = {
14
- success: CircleCheck,
15
- error: CircleAlert,
16
- deleted: Trash
16
+ success: CircleCheck,
17
+ error: CircleAlert,
18
+ deleted: Trash
17
19
  };
18
20
  const TONE = {
19
- progress: 'text-text-muted',
20
- success: 'text-status-idle',
21
- error: 'text-status-error',
22
- deleted: 'text-text-muted'
21
+ progress: 'text-text-muted',
22
+ success: 'text-status-idle',
23
+ error: 'text-status-error',
24
+ deleted: 'text-text-muted'
23
25
  };
24
26
  /* The box is as tall as the title's own line, so what sits beside the title centers on that line. */
25
27
  const TITLE_LINE = 'flex h-(--text-sm--line-height) shrink-0 items-center';
@@ -27,31 +29,387 @@ const TITLE_LINE = 'flex h-(--text-sm--line-height) shrink-0 items-center';
27
29
  * How long the offer in a toast still stands, drawn from the timer that takes the toast away: the
28
30
  * ring starts as far along as that timer already is, so both end together. With motion off it stays full.
29
31
  */
30
- function TimerRing({ deadline, onDismiss }) {
31
- const { t } = useTranslation('ui');
32
- const lifetime = deadline.end - deadline.start;
33
- const [elapsed] = useState(() => elapsedOf(deadline, Date.now()));
34
- return (_jsxs(IconButton, { size: "xs", label: t('action.dismiss'), className: "group/ring relative -my-px", onClick: onDismiss, children: [_jsxs("svg", { width: 16, height: 16, viewBox: "0 0 16 16", className: "-rotate-90", "aria-hidden": true, children: [_jsx("circle", { cx: 8, cy: 8, r: 6, fill: "none", strokeWidth: 2, className: "stroke-border" }), _jsx("circle", { cx: 8, cy: 8, r: 6, fill: "none", strokeWidth: 2, pathLength: 1, strokeDasharray: 1, className: "toast-timer-arc stroke-current", style: { animationDuration: `${lifetime}ms`, animationDelay: `${-elapsed}ms` } })] }), _jsx(Icon, { icon: X, size: 8, className: "absolute opacity-0 group-hover/ring:opacity-100 group-focus-visible/ring:opacity-100" })] }));
32
+ function TimerRing(t0) {
33
+ const $ = _c(13);
34
+ const {
35
+ deadline,
36
+ onDismiss
37
+ } = t0;
38
+ const {
39
+ t
40
+ } = useTranslation("ui");
41
+ const lifetime = deadline.end - deadline.start;
42
+ let t1;
43
+ if ($[0] !== deadline) {
44
+ t1 = () => elapsedOf(deadline, Date.now());
45
+ $[0] = deadline;
46
+ $[1] = t1;
47
+ } else {
48
+ t1 = $[1];
49
+ }
50
+ const [elapsed] = useState(t1);
51
+ let t2;
52
+ if ($[2] !== t) {
53
+ t2 = t("action.dismiss");
54
+ $[2] = t;
55
+ $[3] = t2;
56
+ } else {
57
+ t2 = $[3];
58
+ }
59
+ let t3;
60
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
61
+ t3 = /*#__PURE__*/_jsx("circle", {
62
+ cx: 8,
63
+ cy: 8,
64
+ r: 6,
65
+ fill: "none",
66
+ strokeWidth: 2,
67
+ className: "stroke-border"
68
+ });
69
+ $[4] = t3;
70
+ } else {
71
+ t3 = $[4];
72
+ }
73
+ const t4 = `${lifetime}ms`;
74
+ const t5 = `${-elapsed}ms`;
75
+ let t6;
76
+ if ($[5] !== t4 || $[6] !== t5) {
77
+ t6 = /*#__PURE__*/_jsxs("svg", {
78
+ width: 16,
79
+ height: 16,
80
+ viewBox: "0 0 16 16",
81
+ className: "-rotate-90",
82
+ "aria-hidden": true,
83
+ children: [t3, /*#__PURE__*/_jsx("circle", {
84
+ cx: 8,
85
+ cy: 8,
86
+ r: 6,
87
+ fill: "none",
88
+ strokeWidth: 2,
89
+ pathLength: 1,
90
+ strokeDasharray: 1,
91
+ className: "toast-timer-arc stroke-current",
92
+ style: {
93
+ animationDuration: t4,
94
+ animationDelay: t5
95
+ }
96
+ })]
97
+ });
98
+ $[5] = t4;
99
+ $[6] = t5;
100
+ $[7] = t6;
101
+ } else {
102
+ t6 = $[7];
103
+ }
104
+ let t7;
105
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
106
+ t7 = /*#__PURE__*/_jsx(Icon, {
107
+ icon: X,
108
+ size: 8,
109
+ className: "absolute opacity-0 group-hover/ring:opacity-100 group-focus-visible/ring:opacity-100"
110
+ });
111
+ $[8] = t7;
112
+ } else {
113
+ t7 = $[8];
114
+ }
115
+ let t8;
116
+ if ($[9] !== onDismiss || $[10] !== t2 || $[11] !== t6) {
117
+ t8 = /*#__PURE__*/_jsxs(IconButton, {
118
+ size: "xs",
119
+ label: t2,
120
+ className: "group/ring relative -my-px",
121
+ onClick: onDismiss,
122
+ children: [t6, t7]
123
+ });
124
+ $[9] = onDismiss;
125
+ $[10] = t2;
126
+ $[11] = t6;
127
+ $[12] = t8;
128
+ } else {
129
+ t8 = $[12];
130
+ }
131
+ return t8;
35
132
  }
36
- function ActionButton({ action }) {
37
- return (_jsxs("span", { className: "flex items-center gap-2", children: [_jsx(Button, { size: "xs", onClick: action.run, children: action.label }), action.shortcut && _jsx(Kbd, { shortcut: action.shortcut, className: "font-sans text-xs text-text-faint" })] }));
133
+ function ActionButton(t0) {
134
+ const $ = _c(8);
135
+ const {
136
+ action
137
+ } = t0;
138
+ let t1;
139
+ if ($[0] !== action.label || $[1] !== action.run) {
140
+ t1 = /*#__PURE__*/_jsx(Button, {
141
+ size: "xs",
142
+ onClick: action.run,
143
+ children: action.label
144
+ });
145
+ $[0] = action.label;
146
+ $[1] = action.run;
147
+ $[2] = t1;
148
+ } else {
149
+ t1 = $[2];
150
+ }
151
+ let t2;
152
+ if ($[3] !== action.shortcut) {
153
+ t2 = action.shortcut && /*#__PURE__*/_jsx(Kbd, {
154
+ shortcut: action.shortcut,
155
+ className: "font-sans text-xs text-text-faint"
156
+ });
157
+ $[3] = action.shortcut;
158
+ $[4] = t2;
159
+ } else {
160
+ t2 = $[4];
161
+ }
162
+ let t3;
163
+ if ($[5] !== t1 || $[6] !== t2) {
164
+ t3 = /*#__PURE__*/_jsxs("span", {
165
+ className: "flex items-center gap-2",
166
+ children: [t1, t2]
167
+ });
168
+ $[5] = t1;
169
+ $[6] = t2;
170
+ $[7] = t3;
171
+ } else {
172
+ t3 = $[7];
173
+ }
174
+ return t3;
38
175
  }
39
- function ToastCard({ toast, footer, onDismiss }) {
40
- const { t } = useTranslation('ui');
41
- // A toast that goes by itself keeps its close button out of sight until the pointer or the keyboard is on it.
42
- const leaves = toast.kind === 'deleted' || (toast.kind === 'success' && toast.persist !== true);
43
- const actions = [...(toast.action === undefined ? [] : [toast.action]), ...(toast.actions ?? [])];
44
- // An offer that runs out shows how long it has left instead.
45
- const countdown = actions.length > 0 ? toast.deadline : undefined;
46
- return (_jsxs(Surface, { className: "group flex items-start gap-3 rounded-[10px] py-2.5 pr-2 pl-3", children: [_jsx("span", { className: clsx(TITLE_LINE, 'w-4 justify-center'), children: toast.kind === 'progress' ? (_jsx(Spinner, { size: 16, className: TONE.progress })) : (_jsx(Icon, { icon: ICON[toast.kind], size: 16, className: TONE[toast.kind] })) }), _jsxs("div", { className: "flex min-w-0 grow flex-col gap-1", children: [_jsx("span", { className: "text-sm break-words text-text", children: toast.title }), toast.description !== undefined && toast.description !== '' && (_jsx("span", { className: "text-xs break-words text-pretty text-text-muted", children: toast.description })), actions.length > 1 && (_jsx("span", { className: "mt-1 -ml-2 flex flex-wrap items-center gap-x-2 gap-y-1", children: actions.map((action) => (_jsx(ActionButton, { action: action }, action.label))) })), footer?.(toast)] }), actions.length === 1 && (_jsx("span", { className: TITLE_LINE, children: _jsx(ActionButton, { action: actions[0] }) })), countdown !== undefined ? (_jsx(TimerRing, { deadline: countdown, onDismiss: onDismiss }, countdown.start)) : (_jsx(IconButton, { icon: X, size: "xs", label: t('action.dismiss'), className: clsx('-my-px', leaves && 'opacity-0 group-focus-within:opacity-100 group-hover:opacity-100'), onClick: onDismiss }))] }));
176
+ function ToastCard(t0) {
177
+ const $ = _c(37);
178
+ const {
179
+ toast,
180
+ footer,
181
+ onDismiss
182
+ } = t0;
183
+ const {
184
+ t
185
+ } = useTranslation("ui");
186
+ const leaves = toast.kind === "deleted" || toast.kind === "success" && toast.persist !== true;
187
+ let t1;
188
+ if ($[0] !== toast.action) {
189
+ t1 = toast.action === undefined ? [] : [toast.action];
190
+ $[0] = toast.action;
191
+ $[1] = t1;
192
+ } else {
193
+ t1 = $[1];
194
+ }
195
+ let t2;
196
+ if ($[2] !== toast.actions) {
197
+ t2 = toast.actions ?? [];
198
+ $[2] = toast.actions;
199
+ $[3] = t2;
200
+ } else {
201
+ t2 = $[3];
202
+ }
203
+ let t3;
204
+ if ($[4] !== t1 || $[5] !== t2) {
205
+ t3 = [...t1, ...t2];
206
+ $[4] = t1;
207
+ $[5] = t2;
208
+ $[6] = t3;
209
+ } else {
210
+ t3 = $[6];
211
+ }
212
+ const actions = t3;
213
+ const countdown = actions.length > 0 ? toast.deadline : undefined;
214
+ let t4;
215
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
216
+ t4 = clsx(TITLE_LINE, "w-4 justify-center");
217
+ $[7] = t4;
218
+ } else {
219
+ t4 = $[7];
220
+ }
221
+ let t5;
222
+ if ($[8] !== toast.kind) {
223
+ t5 = /*#__PURE__*/_jsx("span", {
224
+ className: t4,
225
+ children: toast.kind === "progress" ? /*#__PURE__*/_jsx(Spinner, {
226
+ size: 16,
227
+ className: TONE.progress
228
+ }) : /*#__PURE__*/_jsx(Icon, {
229
+ icon: ICON[toast.kind],
230
+ size: 16,
231
+ className: TONE[toast.kind]
232
+ })
233
+ });
234
+ $[8] = toast.kind;
235
+ $[9] = t5;
236
+ } else {
237
+ t5 = $[9];
238
+ }
239
+ let t6;
240
+ if ($[10] !== toast.title) {
241
+ t6 = /*#__PURE__*/_jsx("span", {
242
+ className: "text-sm break-words text-text",
243
+ children: toast.title
244
+ });
245
+ $[10] = toast.title;
246
+ $[11] = t6;
247
+ } else {
248
+ t6 = $[11];
249
+ }
250
+ let t7;
251
+ if ($[12] !== toast.description) {
252
+ t7 = toast.description !== undefined && toast.description !== "" && /*#__PURE__*/_jsx("span", {
253
+ className: "text-xs break-words text-pretty text-text-muted",
254
+ children: toast.description
255
+ });
256
+ $[12] = toast.description;
257
+ $[13] = t7;
258
+ } else {
259
+ t7 = $[13];
260
+ }
261
+ let t8;
262
+ if ($[14] !== actions) {
263
+ t8 = actions.length > 1 && /*#__PURE__*/_jsx("span", {
264
+ className: "mt-1 -ml-2 flex flex-wrap items-center gap-x-2 gap-y-1",
265
+ children: actions.map(_temp)
266
+ });
267
+ $[14] = actions;
268
+ $[15] = t8;
269
+ } else {
270
+ t8 = $[15];
271
+ }
272
+ let t9;
273
+ if ($[16] !== footer || $[17] !== toast) {
274
+ t9 = footer?.(toast);
275
+ $[16] = footer;
276
+ $[17] = toast;
277
+ $[18] = t9;
278
+ } else {
279
+ t9 = $[18];
280
+ }
281
+ let t10;
282
+ if ($[19] !== t6 || $[20] !== t7 || $[21] !== t8 || $[22] !== t9) {
283
+ t10 = /*#__PURE__*/_jsxs("div", {
284
+ className: "flex min-w-0 grow flex-col gap-1",
285
+ children: [t6, t7, t8, t9]
286
+ });
287
+ $[19] = t6;
288
+ $[20] = t7;
289
+ $[21] = t8;
290
+ $[22] = t9;
291
+ $[23] = t10;
292
+ } else {
293
+ t10 = $[23];
294
+ }
295
+ let t11;
296
+ if ($[24] !== actions[0] || $[25] !== actions.length) {
297
+ t11 = actions.length === 1 && /*#__PURE__*/_jsx("span", {
298
+ className: TITLE_LINE,
299
+ children: /*#__PURE__*/_jsx(ActionButton, {
300
+ action: actions[0]
301
+ })
302
+ });
303
+ $[24] = actions[0];
304
+ $[25] = actions.length;
305
+ $[26] = t11;
306
+ } else {
307
+ t11 = $[26];
308
+ }
309
+ let t12;
310
+ if ($[27] !== countdown || $[28] !== leaves || $[29] !== onDismiss || $[30] !== t) {
311
+ t12 = countdown !== undefined ? /*#__PURE__*/_jsx(TimerRing, {
312
+ deadline: countdown,
313
+ onDismiss: onDismiss
314
+ }, countdown.start) : /*#__PURE__*/_jsx(IconButton, {
315
+ icon: X,
316
+ size: "xs",
317
+ label: t("action.dismiss"),
318
+ className: clsx("-my-px", leaves && "opacity-0 group-focus-within:opacity-100 group-hover:opacity-100"),
319
+ onClick: onDismiss
320
+ });
321
+ $[27] = countdown;
322
+ $[28] = leaves;
323
+ $[29] = onDismiss;
324
+ $[30] = t;
325
+ $[31] = t12;
326
+ } else {
327
+ t12 = $[31];
328
+ }
329
+ let t13;
330
+ if ($[32] !== t10 || $[33] !== t11 || $[34] !== t12 || $[35] !== t5) {
331
+ t13 = /*#__PURE__*/_jsxs(Surface, {
332
+ className: "group flex items-start gap-3 rounded-[10px] py-2.5 pr-2 pl-3",
333
+ children: [t5, t10, t11, t12]
334
+ });
335
+ $[32] = t10;
336
+ $[33] = t11;
337
+ $[34] = t12;
338
+ $[35] = t5;
339
+ $[36] = t13;
340
+ } else {
341
+ t13 = $[36];
342
+ }
343
+ return t13;
47
344
  }
48
345
  /*
49
346
  * Bottom right, over everything: what an action is doing while it runs and how it went when it is
50
347
  * over, and a deletion that can still be taken back. A success takes itself away after four seconds,
51
348
  * a deletion after eight, and a failure waits to be read.
52
349
  */
53
- export function Toasts({ store, footer, className, ref }) {
54
- const toasts = store((state) => state.toasts);
55
- // Stays mounted with nothing in it: a screen reader skips what a live region says the moment it is inserted.
56
- return (_jsx("div", { ref: ref, className: clsx('fixed right-4 bottom-4 z-(--z-popup) flex w-90 max-w-[calc(100vw-32px)] flex-col gap-2', className), role: "status", "aria-live": "polite", children: toasts.map((toast) => (_jsx(ToastCard, { toast: toast, footer: footer, onDismiss: () => store.getState().dismiss(toast.id) }, toast.id))) }));
350
+ function _temp(action) {
351
+ return /*#__PURE__*/_jsx(ActionButton, {
352
+ action: action
353
+ }, action.label);
354
+ }
355
+ export function Toasts(t0) {
356
+ const $ = _c(13);
357
+ const {
358
+ store,
359
+ footer,
360
+ className,
361
+ ref
362
+ } = t0;
363
+ const toasts = useStore(store, _temp2);
364
+ let t1;
365
+ if ($[0] !== className) {
366
+ t1 = clsx("fixed right-4 bottom-4 z-(--z-popup) flex w-90 max-w-[calc(100vw-32px)] flex-col gap-2", className);
367
+ $[0] = className;
368
+ $[1] = t1;
369
+ } else {
370
+ t1 = $[1];
371
+ }
372
+ let t2;
373
+ if ($[2] !== footer || $[3] !== store || $[4] !== toasts) {
374
+ let t3;
375
+ if ($[6] !== footer || $[7] !== store) {
376
+ t3 = toast => /*#__PURE__*/_jsx(ToastCard, {
377
+ toast: toast,
378
+ footer: footer,
379
+ onDismiss: () => store.getState().dismiss(toast.id)
380
+ }, toast.id);
381
+ $[6] = footer;
382
+ $[7] = store;
383
+ $[8] = t3;
384
+ } else {
385
+ t3 = $[8];
386
+ }
387
+ t2 = toasts.map(t3);
388
+ $[2] = footer;
389
+ $[3] = store;
390
+ $[4] = toasts;
391
+ $[5] = t2;
392
+ } else {
393
+ t2 = $[5];
394
+ }
395
+ let t3;
396
+ if ($[9] !== ref || $[10] !== t1 || $[11] !== t2) {
397
+ t3 = /*#__PURE__*/_jsx("div", {
398
+ ref: ref,
399
+ className: t1,
400
+ role: "status",
401
+ "aria-live": "polite",
402
+ children: t2
403
+ });
404
+ $[9] = ref;
405
+ $[10] = t1;
406
+ $[11] = t2;
407
+ $[12] = t3;
408
+ } else {
409
+ t3 = $[12];
410
+ }
411
+ return t3;
57
412
  }
413
+ function _temp2(state) {
414
+ return state.toasts;
415
+ }