@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
@@ -1,18 +1,231 @@
1
- import { Fragment as _Fragment, 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
3
  import { useTranslation } from 'react-i18next';
4
4
  import { ChevronDown, History } from 'lucide-react';
5
- import { Icon } from './Icon.js';
5
+ import { Icon } from "./Icon.js";
6
6
  import * as Menu from './menu/index.parts.js';
7
- import { ProjectSwitcherRow } from './project-switcher-row.js';
8
- export function ProjectSwitcher({ current, projects, recentProjects, onSelect, leading, before, children, label, disabled, open, defaultOpen, onOpenChange, className, ref }) {
9
- const { t } = useTranslation('ui');
10
- return (_jsxs(Menu.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange, children: [_jsxs(Menu.Trigger, { ref: ref, disabled: disabled, "aria-label": label ?? current?.name ?? t('projectSwitcher.label'), className: clsx('project-switcher-trigger', className), children: [leading, current?.icon, _jsx("span", { className: "truncate text-sm font-medium text-text", children: current?.name ?? t('projectSwitcher.label') }), _jsx(Icon, { icon: ChevronDown, size: 14, className: "shrink-0 text-text-muted" })] }), _jsx(Menu.Popup, { className: "min-w-60", children: _jsx(ProjectSwitcherGroups, { projects: projects, recentProjects: recentProjects, before: before, onSelect: onSelect, children: children }) })] }));
7
+ import { ProjectSwitcherRow } from "./project-switcher-row.js";
8
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
+ export function ProjectSwitcher(t0) {
10
+ const $ = _c(32);
11
+ const {
12
+ current,
13
+ projects,
14
+ recentProjects,
15
+ onSelect,
16
+ leading,
17
+ before,
18
+ children,
19
+ label,
20
+ disabled,
21
+ open,
22
+ defaultOpen,
23
+ onOpenChange,
24
+ className,
25
+ ref
26
+ } = t0;
27
+ const {
28
+ t
29
+ } = useTranslation("ui");
30
+ let t1;
31
+ if ($[0] !== current?.name || $[1] !== label || $[2] !== t) {
32
+ t1 = label ?? current?.name ?? t("projectSwitcher.label");
33
+ $[0] = current?.name;
34
+ $[1] = label;
35
+ $[2] = t;
36
+ $[3] = t1;
37
+ } else {
38
+ t1 = $[3];
39
+ }
40
+ let t2;
41
+ if ($[4] !== className) {
42
+ t2 = clsx("project-switcher-trigger", className);
43
+ $[4] = className;
44
+ $[5] = t2;
45
+ } else {
46
+ t2 = $[5];
47
+ }
48
+ const t3 = current?.icon;
49
+ let t4;
50
+ if ($[6] !== current?.name || $[7] !== t) {
51
+ t4 = current?.name ?? t("projectSwitcher.label");
52
+ $[6] = current?.name;
53
+ $[7] = t;
54
+ $[8] = t4;
55
+ } else {
56
+ t4 = $[8];
57
+ }
58
+ let t5;
59
+ if ($[9] !== t4) {
60
+ t5 = /*#__PURE__*/_jsx("span", {
61
+ className: "truncate text-sm font-medium text-text",
62
+ children: t4
63
+ });
64
+ $[9] = t4;
65
+ $[10] = t5;
66
+ } else {
67
+ t5 = $[10];
68
+ }
69
+ let t6;
70
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
71
+ t6 = /*#__PURE__*/_jsx(Icon, {
72
+ icon: ChevronDown,
73
+ size: 14,
74
+ className: "shrink-0 text-text-muted"
75
+ });
76
+ $[11] = t6;
77
+ } else {
78
+ t6 = $[11];
79
+ }
80
+ let t7;
81
+ if ($[12] !== disabled || $[13] !== leading || $[14] !== ref || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t5) {
82
+ t7 = /*#__PURE__*/_jsxs(Menu.Trigger, {
83
+ ref: ref,
84
+ disabled: disabled,
85
+ "aria-label": t1,
86
+ className: t2,
87
+ children: [leading, t3, t5, t6]
88
+ });
89
+ $[12] = disabled;
90
+ $[13] = leading;
91
+ $[14] = ref;
92
+ $[15] = t1;
93
+ $[16] = t2;
94
+ $[17] = t3;
95
+ $[18] = t5;
96
+ $[19] = t7;
97
+ } else {
98
+ t7 = $[19];
99
+ }
100
+ let t8;
101
+ if ($[20] !== before || $[21] !== children || $[22] !== onSelect || $[23] !== projects || $[24] !== recentProjects) {
102
+ t8 = /*#__PURE__*/_jsx(Menu.Popup, {
103
+ className: "min-w-60",
104
+ children: /*#__PURE__*/_jsx(ProjectSwitcherGroups, {
105
+ projects: projects,
106
+ recentProjects: recentProjects,
107
+ before: before,
108
+ onSelect: onSelect,
109
+ children: children
110
+ })
111
+ });
112
+ $[20] = before;
113
+ $[21] = children;
114
+ $[22] = onSelect;
115
+ $[23] = projects;
116
+ $[24] = recentProjects;
117
+ $[25] = t8;
118
+ } else {
119
+ t8 = $[25];
120
+ }
121
+ let t9;
122
+ if ($[26] !== defaultOpen || $[27] !== onOpenChange || $[28] !== open || $[29] !== t7 || $[30] !== t8) {
123
+ t9 = /*#__PURE__*/_jsxs(Menu.Root, {
124
+ open: open,
125
+ defaultOpen: defaultOpen,
126
+ onOpenChange: onOpenChange,
127
+ children: [t7, t8]
128
+ });
129
+ $[26] = defaultOpen;
130
+ $[27] = onOpenChange;
131
+ $[28] = open;
132
+ $[29] = t7;
133
+ $[30] = t8;
134
+ $[31] = t9;
135
+ } else {
136
+ t9 = $[31];
137
+ }
138
+ return t9;
11
139
  }
12
140
  /* The rows of the popup, apart from it so they render without an open menu. */
13
- export function ProjectSwitcherGroups({ projects, recentProjects = [], before, children, onSelect }) {
14
- const { t } = useTranslation('ui');
15
- // The theme hides a separator at the top of a menu or against another, so a group that draws
16
- // nothing leaves no line behind.
17
- return (_jsxs(_Fragment, { children: [projects.map((project) => (_jsx(ProjectSwitcherRow, { project: project, onSelect: onSelect }, project.id))), before && (_jsxs(_Fragment, { children: [_jsx(Menu.Separator, {}), before] })), (recentProjects.length > 0 || children) && (_jsxs(_Fragment, { children: [_jsx(Menu.Separator, {}), recentProjects.length > 0 && (_jsxs(Menu.SubmenuRoot, { children: [_jsxs(Menu.SubmenuTrigger, { children: [_jsx(Icon, { icon: History, size: 14 }), " ", t('projectSwitcher.recent')] }), _jsx(Menu.Popup, { className: "min-w-60", children: recentProjects.map((project) => (_jsx(ProjectSwitcherRow, { project: project, onSelect: onSelect }, project.id))) })] })), children] }))] }));
18
- }
141
+ export function ProjectSwitcherGroups(t0) {
142
+ const $ = _c(18);
143
+ const {
144
+ projects,
145
+ recentProjects: t1,
146
+ before,
147
+ children,
148
+ onSelect
149
+ } = t0;
150
+ let t2;
151
+ if ($[0] !== t1) {
152
+ t2 = t1 === undefined ? [] : t1;
153
+ $[0] = t1;
154
+ $[1] = t2;
155
+ } else {
156
+ t2 = $[1];
157
+ }
158
+ const recentProjects = t2;
159
+ const {
160
+ t
161
+ } = useTranslation("ui");
162
+ let t3;
163
+ if ($[2] !== onSelect || $[3] !== projects) {
164
+ let t4;
165
+ if ($[5] !== onSelect) {
166
+ t4 = project => /*#__PURE__*/_jsx(ProjectSwitcherRow, {
167
+ project: project,
168
+ onSelect: onSelect
169
+ }, project.id);
170
+ $[5] = onSelect;
171
+ $[6] = t4;
172
+ } else {
173
+ t4 = $[6];
174
+ }
175
+ t3 = projects.map(t4);
176
+ $[2] = onSelect;
177
+ $[3] = projects;
178
+ $[4] = t3;
179
+ } else {
180
+ t3 = $[4];
181
+ }
182
+ let t4;
183
+ if ($[7] !== before) {
184
+ t4 = before && /*#__PURE__*/_jsxs(_Fragment, {
185
+ children: [/*#__PURE__*/_jsx(Menu.Separator, {}), before]
186
+ });
187
+ $[7] = before;
188
+ $[8] = t4;
189
+ } else {
190
+ t4 = $[8];
191
+ }
192
+ let t5;
193
+ if ($[9] !== children || $[10] !== onSelect || $[11] !== recentProjects || $[12] !== t) {
194
+ t5 = (recentProjects.length > 0 || children) && /*#__PURE__*/_jsxs(_Fragment, {
195
+ children: [/*#__PURE__*/_jsx(Menu.Separator, {}), recentProjects.length > 0 && /*#__PURE__*/_jsxs(Menu.SubmenuRoot, {
196
+ children: [/*#__PURE__*/_jsxs(Menu.SubmenuTrigger, {
197
+ children: [/*#__PURE__*/_jsx(Icon, {
198
+ icon: History,
199
+ size: 14
200
+ }), " ", t("projectSwitcher.recent")]
201
+ }), /*#__PURE__*/_jsx(Menu.Popup, {
202
+ className: "min-w-60",
203
+ children: recentProjects.map(project_0 => /*#__PURE__*/_jsx(ProjectSwitcherRow, {
204
+ project: project_0,
205
+ onSelect: onSelect
206
+ }, project_0.id))
207
+ })]
208
+ }), children]
209
+ });
210
+ $[9] = children;
211
+ $[10] = onSelect;
212
+ $[11] = recentProjects;
213
+ $[12] = t;
214
+ $[13] = t5;
215
+ } else {
216
+ t5 = $[13];
217
+ }
218
+ let t6;
219
+ if ($[14] !== t3 || $[15] !== t4 || $[16] !== t5) {
220
+ t6 = /*#__PURE__*/_jsxs(_Fragment, {
221
+ children: [t3, t4, t5]
222
+ });
223
+ $[14] = t3;
224
+ $[15] = t4;
225
+ $[16] = t5;
226
+ $[17] = t6;
227
+ } else {
228
+ t6 = $[17];
229
+ }
230
+ return t6;
231
+ }
@@ -1,11 +1,11 @@
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 { useTranslation } from 'react-i18next';
4
- import { Button } from './Button.js';
5
- import { DialogDescription, DialogFooter, DialogPopup, DialogRoot, DialogTitle } from './dialog/parts.js';
6
- import { Field, FormError } from './Field.js';
7
- import { Icon } from './Icon.js';
8
- import { Input, TextArea } from './Input.js';
4
+ import { Button } from "./Button.js";
5
+ import { DialogDescription, DialogFooter, DialogPopup, DialogRoot, DialogTitle } from "./dialog/parts.js";
6
+ import { Field, FormError } from "./Field.js";
7
+ import { Icon } from "./Icon.js";
8
+ import { Input, TextArea } from "./Input.js";
9
9
  import { useAsyncAction } from './useAsyncAction.js';
10
10
  /*
11
11
  * The one dialog a question is asked in: a name to type, or a warning to agree with. Every confirm
@@ -13,35 +13,350 @@ import { useAsyncAction } from './useAsyncAction.js';
13
13
  * because what a confirm leads to is the caller's business: an action that asks a second question
14
14
  * would be shut out by a close of its own.
15
15
  */
16
- export function PromptDialog({ open, title, titleIcon, description, field, area, confirmLabel, confirmBusyLabel, confirmIcon, danger = false, busy = false, allowEmpty = false, confirmDisabled = false, secondary, nested = false, children, onConfirm, fallbackMessage, onOpenChange, className, ref }) {
17
- const { t } = useTranslation('ui');
18
- /* The dialog stays mounted between questions, so every opening starts from what it was handed.
19
- The token is what it was handed, so a new question resets the fields in the same render that
20
- shows it and not in a second one after. */
21
- const token = open ? `${field?.initial ?? ''}\u0000${area?.initial ?? ''}` : '';
22
- const [draft, setDraft] = useState({ token, value: field?.initial ?? '', body: area?.initial ?? '' });
23
- const step = useAsyncAction(fallbackMessage);
24
- if (draft.token !== token) {
25
- setDraft({ token, value: field?.initial ?? '', body: area?.initial ?? '' });
26
- step.clear();
27
- }
28
- const value = draft.value;
29
- const body = draft.body;
30
- const working = busy || step.busy;
31
- const setValue = (next) => setDraft({ ...draft, value: next });
32
- const setBody = (next) => setDraft({ ...draft, body: next });
33
- const submit = () => {
34
- if (!working && !confirmDisabled && (field === undefined || allowEmpty || value.trim() !== '')) {
35
- void step.run(async () => await onConfirm(value.trim(), body.trim()));
36
- }
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ export function PromptDialog(t0) {
18
+ const $ = _c(80);
19
+ const {
20
+ open,
21
+ title,
22
+ titleIcon,
23
+ description,
24
+ field,
25
+ area,
26
+ confirmLabel,
27
+ confirmBusyLabel,
28
+ confirmIcon,
29
+ danger: t1,
30
+ busy: t2,
31
+ allowEmpty: t3,
32
+ confirmDisabled: t4,
33
+ secondary,
34
+ nested: t5,
35
+ children,
36
+ onConfirm,
37
+ fallbackMessage,
38
+ onOpenChange,
39
+ className,
40
+ ref
41
+ } = t0;
42
+ const danger = t1 === undefined ? false : t1;
43
+ const busy = t2 === undefined ? false : t2;
44
+ const allowEmpty = t3 === undefined ? false : t3;
45
+ const confirmDisabled = t4 === undefined ? false : t4;
46
+ const nested = t5 === undefined ? false : t5;
47
+ const {
48
+ t
49
+ } = useTranslation("ui");
50
+ const token = open ? `${field?.initial ?? ""}\u0000${area?.initial ?? ""}` : "";
51
+ const t6 = field?.initial ?? "";
52
+ const t7 = area?.initial ?? "";
53
+ let t8;
54
+ if ($[0] !== t6 || $[1] !== t7 || $[2] !== token) {
55
+ t8 = {
56
+ token,
57
+ value: t6,
58
+ body: t7
37
59
  };
38
- const close = () => onOpenChange(false);
39
- return (_jsx(DialogRoot, { open: open, onOpenChange: (next) => !next && close(), children: _jsxs(DialogPopup, { ref: ref, size: "sm", nested: nested, className: className, children: [_jsxs(DialogTitle, { className: "flex items-center gap-2 break-words", children: [titleIcon && _jsx(Icon, { icon: titleIcon, size: 16 }), title] }), description !== undefined && _jsx(DialogDescription, { className: "mt-1 break-words", children: description }), field !== undefined && (_jsx(Field, { label: field.label, className: "mt-4", children: _jsx(Input, { autoFocus: true, mono: field.mono === true, "aria-label": field.ariaLabel, spellCheck: false, placeholder: field.placeholder, maxLength: field.maxLength, value: value, onChange: (event) => setValue(event.target.value), onKeyDown: (event) => {
40
- // Whatever listens on the window has keys of its own, and a name may hold any of them.
41
- event.stopPropagation();
42
- if (event.key === 'Enter') {
43
- event.preventDefault();
44
- submit();
45
- }
46
- } }) })), area !== undefined && (_jsx(Field, { label: area.label, className: "mt-3", children: _jsx(TextArea, { rows: 5, spellCheck: false, placeholder: area.placeholder, value: body, onChange: (event) => setBody(event.target.value) }) })), children, step.failure !== null && _jsx(FormError, { className: "mt-2 break-words", children: step.failure }), _jsxs(DialogFooter, { children: [_jsx(Button, { onClick: close, children: t('action.cancel') }), secondary !== undefined && (_jsx(Button, { disabled: working, onClick: secondary.onClick, children: secondary.label })), _jsxs(Button, { variant: danger ? 'danger' : 'primary', disabled: working || confirmDisabled || (field !== undefined && !allowEmpty && value.trim() === ''), onClick: submit, children: [confirmIcon && _jsx(Icon, { icon: confirmIcon, size: 12 }), working && confirmBusyLabel !== undefined ? confirmBusyLabel : confirmLabel] })] })] }) }));
47
- }
60
+ $[0] = t6;
61
+ $[1] = t7;
62
+ $[2] = token;
63
+ $[3] = t8;
64
+ } else {
65
+ t8 = $[3];
66
+ }
67
+ const [draft, setDraft] = useState(t8);
68
+ const step = useAsyncAction(fallbackMessage);
69
+ if (draft.token !== token) {
70
+ setDraft({
71
+ token,
72
+ value: field?.initial ?? "",
73
+ body: area?.initial ?? ""
74
+ });
75
+ step.clear();
76
+ }
77
+ const value = draft.value;
78
+ const body = draft.body;
79
+ const working = busy || step.busy;
80
+ let t9;
81
+ if ($[4] !== draft) {
82
+ t9 = next => setDraft({
83
+ ...draft,
84
+ value: next
85
+ });
86
+ $[4] = draft;
87
+ $[5] = t9;
88
+ } else {
89
+ t9 = $[5];
90
+ }
91
+ const setValue = t9;
92
+ let t10;
93
+ if ($[6] !== draft) {
94
+ t10 = next_0 => setDraft({
95
+ ...draft,
96
+ body: next_0
97
+ });
98
+ $[6] = draft;
99
+ $[7] = t10;
100
+ } else {
101
+ t10 = $[7];
102
+ }
103
+ const setBody = t10;
104
+ let t11;
105
+ if ($[8] !== allowEmpty || $[9] !== body || $[10] !== confirmDisabled || $[11] !== field || $[12] !== onConfirm || $[13] !== step || $[14] !== value || $[15] !== working) {
106
+ t11 = () => {
107
+ if (!working && !confirmDisabled && (field === undefined || allowEmpty || value.trim() !== "")) {
108
+ step.run(async () => await onConfirm(value.trim(), body.trim()));
109
+ }
110
+ };
111
+ $[8] = allowEmpty;
112
+ $[9] = body;
113
+ $[10] = confirmDisabled;
114
+ $[11] = field;
115
+ $[12] = onConfirm;
116
+ $[13] = step;
117
+ $[14] = value;
118
+ $[15] = working;
119
+ $[16] = t11;
120
+ } else {
121
+ t11 = $[16];
122
+ }
123
+ const submit = t11;
124
+ let t12;
125
+ if ($[17] !== onOpenChange) {
126
+ t12 = () => onOpenChange(false);
127
+ $[17] = onOpenChange;
128
+ $[18] = t12;
129
+ } else {
130
+ t12 = $[18];
131
+ }
132
+ const close = t12;
133
+ let t13;
134
+ if ($[19] !== close) {
135
+ t13 = next_1 => !next_1 && close();
136
+ $[19] = close;
137
+ $[20] = t13;
138
+ } else {
139
+ t13 = $[20];
140
+ }
141
+ let t14;
142
+ if ($[21] !== titleIcon) {
143
+ t14 = titleIcon && /*#__PURE__*/_jsx(Icon, {
144
+ icon: titleIcon,
145
+ size: 16
146
+ });
147
+ $[21] = titleIcon;
148
+ $[22] = t14;
149
+ } else {
150
+ t14 = $[22];
151
+ }
152
+ let t15;
153
+ if ($[23] !== t14 || $[24] !== title) {
154
+ t15 = /*#__PURE__*/_jsxs(DialogTitle, {
155
+ className: "flex items-center gap-2 break-words",
156
+ children: [t14, title]
157
+ });
158
+ $[23] = t14;
159
+ $[24] = title;
160
+ $[25] = t15;
161
+ } else {
162
+ t15 = $[25];
163
+ }
164
+ let t16;
165
+ if ($[26] !== description) {
166
+ t16 = description !== undefined && /*#__PURE__*/_jsx(DialogDescription, {
167
+ className: "mt-1 break-words",
168
+ children: description
169
+ });
170
+ $[26] = description;
171
+ $[27] = t16;
172
+ } else {
173
+ t16 = $[27];
174
+ }
175
+ let t17;
176
+ if ($[28] !== field || $[29] !== setValue || $[30] !== submit || $[31] !== value) {
177
+ t17 = field !== undefined && /*#__PURE__*/_jsx(Field, {
178
+ label: field.label,
179
+ className: "mt-4",
180
+ children: /*#__PURE__*/_jsx(Input, {
181
+ autoFocus: true,
182
+ mono: field.mono === true,
183
+ "aria-label": field.ariaLabel,
184
+ spellCheck: false,
185
+ placeholder: field.placeholder,
186
+ maxLength: field.maxLength,
187
+ value: value,
188
+ onChange: event => setValue(event.target.value),
189
+ onKeyDown: event_0 => {
190
+ event_0.stopPropagation();
191
+ if (event_0.key === "Enter") {
192
+ event_0.preventDefault();
193
+ submit();
194
+ }
195
+ }
196
+ })
197
+ });
198
+ $[28] = field;
199
+ $[29] = setValue;
200
+ $[30] = submit;
201
+ $[31] = value;
202
+ $[32] = t17;
203
+ } else {
204
+ t17 = $[32];
205
+ }
206
+ let t18;
207
+ if ($[33] !== area || $[34] !== body || $[35] !== setBody) {
208
+ t18 = area !== undefined && /*#__PURE__*/_jsx(Field, {
209
+ label: area.label,
210
+ className: "mt-3",
211
+ children: /*#__PURE__*/_jsx(TextArea, {
212
+ rows: 5,
213
+ spellCheck: false,
214
+ placeholder: area.placeholder,
215
+ value: body,
216
+ onChange: event_1 => setBody(event_1.target.value)
217
+ })
218
+ });
219
+ $[33] = area;
220
+ $[34] = body;
221
+ $[35] = setBody;
222
+ $[36] = t18;
223
+ } else {
224
+ t18 = $[36];
225
+ }
226
+ let t19;
227
+ if ($[37] !== step.failure) {
228
+ t19 = step.failure !== null && /*#__PURE__*/_jsx(FormError, {
229
+ className: "mt-2 break-words",
230
+ children: step.failure
231
+ });
232
+ $[37] = step.failure;
233
+ $[38] = t19;
234
+ } else {
235
+ t19 = $[38];
236
+ }
237
+ let t20;
238
+ if ($[39] !== t) {
239
+ t20 = t("action.cancel");
240
+ $[39] = t;
241
+ $[40] = t20;
242
+ } else {
243
+ t20 = $[40];
244
+ }
245
+ let t21;
246
+ if ($[41] !== close || $[42] !== t20) {
247
+ t21 = /*#__PURE__*/_jsx(Button, {
248
+ onClick: close,
249
+ children: t20
250
+ });
251
+ $[41] = close;
252
+ $[42] = t20;
253
+ $[43] = t21;
254
+ } else {
255
+ t21 = $[43];
256
+ }
257
+ let t22;
258
+ if ($[44] !== secondary || $[45] !== working) {
259
+ t22 = secondary !== undefined && /*#__PURE__*/_jsx(Button, {
260
+ disabled: working,
261
+ onClick: secondary.onClick,
262
+ children: secondary.label
263
+ });
264
+ $[44] = secondary;
265
+ $[45] = working;
266
+ $[46] = t22;
267
+ } else {
268
+ t22 = $[46];
269
+ }
270
+ const t23 = danger ? "danger" : "primary";
271
+ let t24;
272
+ if ($[47] !== allowEmpty || $[48] !== confirmDisabled || $[49] !== field || $[50] !== value || $[51] !== working) {
273
+ t24 = working || confirmDisabled || field !== undefined && !allowEmpty && value.trim() === "";
274
+ $[47] = allowEmpty;
275
+ $[48] = confirmDisabled;
276
+ $[49] = field;
277
+ $[50] = value;
278
+ $[51] = working;
279
+ $[52] = t24;
280
+ } else {
281
+ t24 = $[52];
282
+ }
283
+ let t25;
284
+ if ($[53] !== confirmIcon) {
285
+ t25 = confirmIcon && /*#__PURE__*/_jsx(Icon, {
286
+ icon: confirmIcon,
287
+ size: 12
288
+ });
289
+ $[53] = confirmIcon;
290
+ $[54] = t25;
291
+ } else {
292
+ t25 = $[54];
293
+ }
294
+ const t26 = working && confirmBusyLabel !== undefined ? confirmBusyLabel : confirmLabel;
295
+ let t27;
296
+ if ($[55] !== submit || $[56] !== t23 || $[57] !== t24 || $[58] !== t25 || $[59] !== t26) {
297
+ t27 = /*#__PURE__*/_jsxs(Button, {
298
+ variant: t23,
299
+ disabled: t24,
300
+ onClick: submit,
301
+ children: [t25, t26]
302
+ });
303
+ $[55] = submit;
304
+ $[56] = t23;
305
+ $[57] = t24;
306
+ $[58] = t25;
307
+ $[59] = t26;
308
+ $[60] = t27;
309
+ } else {
310
+ t27 = $[60];
311
+ }
312
+ let t28;
313
+ if ($[61] !== t21 || $[62] !== t22 || $[63] !== t27) {
314
+ t28 = /*#__PURE__*/_jsxs(DialogFooter, {
315
+ children: [t21, t22, t27]
316
+ });
317
+ $[61] = t21;
318
+ $[62] = t22;
319
+ $[63] = t27;
320
+ $[64] = t28;
321
+ } else {
322
+ t28 = $[64];
323
+ }
324
+ let t29;
325
+ if ($[65] !== children || $[66] !== className || $[67] !== nested || $[68] !== ref || $[69] !== t15 || $[70] !== t16 || $[71] !== t17 || $[72] !== t18 || $[73] !== t19 || $[74] !== t28) {
326
+ t29 = /*#__PURE__*/_jsxs(DialogPopup, {
327
+ ref: ref,
328
+ size: "sm",
329
+ nested: nested,
330
+ className: className,
331
+ children: [t15, t16, t17, t18, children, t19, t28]
332
+ });
333
+ $[65] = children;
334
+ $[66] = className;
335
+ $[67] = nested;
336
+ $[68] = ref;
337
+ $[69] = t15;
338
+ $[70] = t16;
339
+ $[71] = t17;
340
+ $[72] = t18;
341
+ $[73] = t19;
342
+ $[74] = t28;
343
+ $[75] = t29;
344
+ } else {
345
+ t29 = $[75];
346
+ }
347
+ let t30;
348
+ if ($[76] !== open || $[77] !== t13 || $[78] !== t29) {
349
+ t30 = /*#__PURE__*/_jsx(DialogRoot, {
350
+ open: open,
351
+ onOpenChange: t13,
352
+ children: t29
353
+ });
354
+ $[76] = open;
355
+ $[77] = t13;
356
+ $[78] = t29;
357
+ $[79] = t30;
358
+ } else {
359
+ t30 = $[79];
360
+ }
361
+ return t30;
362
+ }