@iquji-web/web-component 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +135 -2
- package/dist/calendar.d.ts +27 -0
- package/dist/color-picker.d.ts +24 -0
- package/dist/confirmation.d.ts +12 -0
- package/dist/data-table.d.ts +16 -0
- package/dist/date-picker.d.ts +37 -0
- package/dist/desktop-account.d.ts +45 -0
- package/dist/desktop-rail.d.ts +21 -0
- package/dist/desktop-shell.d.ts +9 -0
- package/dist/desktop-tabs.d.ts +24 -0
- package/dist/desktop-titlebar.d.ts +17 -0
- package/dist/drawer.d.ts +24 -0
- package/dist/emoji-picker.d.ts +21 -0
- package/dist/feedback.d.ts +27 -0
- package/dist/floating.d.ts +66 -0
- package/dist/form-dialog-resize.d.ts +24 -0
- package/dist/form-dialog.d.ts +9 -0
- package/dist/form-steps.d.ts +18 -0
- package/dist/forms.d.ts +77 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.js +4920 -0
- package/dist/layout.d.ts +15 -0
- package/dist/multi-select.d.ts +24 -0
- package/dist/navigation.d.ts +17 -0
- package/dist/notification.d.ts +27 -0
- package/dist/overlay-focus.d.ts +8 -0
- package/dist/overlay-layer.d.ts +32 -0
- package/dist/overlay-presence.d.ts +6 -0
- package/dist/overlay-scope.d.ts +8 -0
- package/dist/overlays.d.ts +22 -0
- package/dist/pagination.d.ts +13 -0
- package/dist/progress-bar.d.ts +12 -0
- package/dist/scroll-area.d.ts +10 -0
- package/dist/search-dialog.d.ts +26 -0
- package/dist/settings-layout.d.ts +24 -0
- package/dist/settings-nav.d.ts +31 -0
- package/dist/settings-rows.d.ts +53 -0
- package/dist/styles.css +4426 -0
- package/dist/timeline.d.ts +17 -0
- package/dist/tooltip.d.ts +12 -0
- package/dist/utils.d.ts +1 -0
- package/dist/workbench.d.ts +32 -0
- package/package.json +43 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,4920 @@
|
|
|
1
|
+
// src/index.tsx
|
|
2
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
3
|
+
|
|
4
|
+
// src/calendar.tsx
|
|
5
|
+
import { IqujiIcon } from "@iquji-web/web-icons";
|
|
6
|
+
import { useCallback, useMemo, useState } from "react";
|
|
7
|
+
|
|
8
|
+
// src/utils.ts
|
|
9
|
+
function classNames(...names) {
|
|
10
|
+
return names.filter(Boolean).join(" ");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/calendar.tsx
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var pad2 = (n) => n < 10 ? `0${n}` : `${n}`;
|
|
16
|
+
function formatCalendarDate(date) {
|
|
17
|
+
return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`;
|
|
18
|
+
}
|
|
19
|
+
function parseCalendarDate(str) {
|
|
20
|
+
if (!str)
|
|
21
|
+
return null;
|
|
22
|
+
const match = /^(\d{4})-(\d{1,2})-(\d{1,2})$/u.exec(str.trim());
|
|
23
|
+
if (!match)
|
|
24
|
+
return null;
|
|
25
|
+
const year = Number.parseInt(match[1] ?? "", 10);
|
|
26
|
+
const month = Number.parseInt(match[2] ?? "", 10) - 1;
|
|
27
|
+
const day = Number.parseInt(match[3] ?? "", 10);
|
|
28
|
+
const date = new Date(year, month, day);
|
|
29
|
+
if (date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return date;
|
|
33
|
+
}
|
|
34
|
+
var WEEKDAY_NAMES_ZH = ["日", "一", "二", "三", "四", "五", "六"];
|
|
35
|
+
var WEEKDAY_NAMES_EN = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
36
|
+
function IqujiCalendar({
|
|
37
|
+
className,
|
|
38
|
+
clearable = true,
|
|
39
|
+
defaultValue,
|
|
40
|
+
disabledDate,
|
|
41
|
+
footer,
|
|
42
|
+
locale = "zh-CN",
|
|
43
|
+
max,
|
|
44
|
+
min,
|
|
45
|
+
onChange,
|
|
46
|
+
onClear,
|
|
47
|
+
showToday = true,
|
|
48
|
+
value
|
|
49
|
+
}) {
|
|
50
|
+
const isZh = locale.startsWith("zh");
|
|
51
|
+
const weekdays = isZh ? WEEKDAY_NAMES_ZH : WEEKDAY_NAMES_EN;
|
|
52
|
+
const initialDate = useMemo(() => {
|
|
53
|
+
return parseCalendarDate(value ?? defaultValue) ?? new Date;
|
|
54
|
+
}, [value, defaultValue]);
|
|
55
|
+
const [viewYear, setViewYear] = useState(initialDate.getFullYear());
|
|
56
|
+
const [viewMonth, setViewMonth] = useState(initialDate.getMonth());
|
|
57
|
+
const todayString = useMemo(() => formatCalendarDate(new Date), []);
|
|
58
|
+
const selectedDateString = useMemo(() => {
|
|
59
|
+
if (value !== undefined) {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
return defaultValue ?? null;
|
|
63
|
+
}, [value, defaultValue]);
|
|
64
|
+
const calendarDays = useMemo(() => {
|
|
65
|
+
const days = [];
|
|
66
|
+
const firstDayOfMonth = new Date(viewYear, viewMonth, 1);
|
|
67
|
+
const startingDayOfWeek = firstDayOfMonth.getDay();
|
|
68
|
+
const daysInCurrentMonth = new Date(viewYear, viewMonth + 1, 0).getDate();
|
|
69
|
+
const daysInPrevMonth = new Date(viewYear, viewMonth, 0).getDate();
|
|
70
|
+
for (let i = startingDayOfWeek - 1;i >= 0; i--) {
|
|
71
|
+
const dayNumber = daysInPrevMonth - i;
|
|
72
|
+
const prevDate = new Date(viewYear, viewMonth - 1, dayNumber);
|
|
73
|
+
const dateString = formatCalendarDate(prevDate);
|
|
74
|
+
const isDateDisabled = Boolean(min && dateString < min) || Boolean(max && dateString > max) || Boolean(disabledDate?.(prevDate));
|
|
75
|
+
days.push({
|
|
76
|
+
date: prevDate,
|
|
77
|
+
dateString,
|
|
78
|
+
dayNumber,
|
|
79
|
+
isCurrentMonth: false,
|
|
80
|
+
isToday: dateString === todayString,
|
|
81
|
+
isSelected: dateString === selectedDateString,
|
|
82
|
+
isDisabled: isDateDisabled
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
for (let dayNumber = 1;dayNumber <= daysInCurrentMonth; dayNumber++) {
|
|
86
|
+
const currentDate = new Date(viewYear, viewMonth, dayNumber);
|
|
87
|
+
const dateString = formatCalendarDate(currentDate);
|
|
88
|
+
const isDateDisabled = Boolean(min && dateString < min) || Boolean(max && dateString > max) || Boolean(disabledDate?.(currentDate));
|
|
89
|
+
days.push({
|
|
90
|
+
date: currentDate,
|
|
91
|
+
dateString,
|
|
92
|
+
dayNumber,
|
|
93
|
+
isCurrentMonth: true,
|
|
94
|
+
isToday: dateString === todayString,
|
|
95
|
+
isSelected: dateString === selectedDateString,
|
|
96
|
+
isDisabled: isDateDisabled
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const remainingDays = 42 - days.length;
|
|
100
|
+
for (let dayNumber = 1;dayNumber <= remainingDays; dayNumber++) {
|
|
101
|
+
const nextDate = new Date(viewYear, viewMonth + 1, dayNumber);
|
|
102
|
+
const dateString = formatCalendarDate(nextDate);
|
|
103
|
+
const isDateDisabled = Boolean(min && dateString < min) || Boolean(max && dateString > max) || Boolean(disabledDate?.(nextDate));
|
|
104
|
+
days.push({
|
|
105
|
+
date: nextDate,
|
|
106
|
+
dateString,
|
|
107
|
+
dayNumber,
|
|
108
|
+
isCurrentMonth: false,
|
|
109
|
+
isToday: dateString === todayString,
|
|
110
|
+
isSelected: dateString === selectedDateString,
|
|
111
|
+
isDisabled: isDateDisabled
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return days;
|
|
115
|
+
}, [
|
|
116
|
+
viewYear,
|
|
117
|
+
viewMonth,
|
|
118
|
+
min,
|
|
119
|
+
max,
|
|
120
|
+
disabledDate,
|
|
121
|
+
todayString,
|
|
122
|
+
selectedDateString
|
|
123
|
+
]);
|
|
124
|
+
const handlePrevYear = useCallback(() => {
|
|
125
|
+
setViewYear((prev) => prev - 1);
|
|
126
|
+
}, []);
|
|
127
|
+
const handleNextYear = useCallback(() => {
|
|
128
|
+
setViewYear((prev) => prev + 1);
|
|
129
|
+
}, []);
|
|
130
|
+
const handlePrevMonth = useCallback(() => {
|
|
131
|
+
setViewMonth((prev) => {
|
|
132
|
+
if (prev === 0) {
|
|
133
|
+
setViewYear((y) => y - 1);
|
|
134
|
+
return 11;
|
|
135
|
+
}
|
|
136
|
+
return prev - 1;
|
|
137
|
+
});
|
|
138
|
+
}, []);
|
|
139
|
+
const handleNextMonth = useCallback(() => {
|
|
140
|
+
setViewMonth((prev) => {
|
|
141
|
+
if (prev === 11) {
|
|
142
|
+
setViewYear((y) => y + 1);
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
return prev + 1;
|
|
146
|
+
});
|
|
147
|
+
}, []);
|
|
148
|
+
const handleSelectDay = useCallback((day) => {
|
|
149
|
+
if (day.isDisabled)
|
|
150
|
+
return;
|
|
151
|
+
if (!day.isCurrentMonth) {
|
|
152
|
+
setViewYear(day.date.getFullYear());
|
|
153
|
+
setViewMonth(day.date.getMonth());
|
|
154
|
+
}
|
|
155
|
+
onChange?.(day.dateString);
|
|
156
|
+
}, [onChange]);
|
|
157
|
+
const handleToday = useCallback(() => {
|
|
158
|
+
const today = new Date;
|
|
159
|
+
setViewYear(today.getFullYear());
|
|
160
|
+
setViewMonth(today.getMonth());
|
|
161
|
+
onChange?.(formatCalendarDate(today));
|
|
162
|
+
}, [onChange]);
|
|
163
|
+
const handleClear = useCallback(() => {
|
|
164
|
+
onClear?.();
|
|
165
|
+
}, [onClear]);
|
|
166
|
+
const titleText = isZh ? `${viewYear} 年 ${viewMonth + 1} 月` : new Intl.DateTimeFormat(locale, {
|
|
167
|
+
month: "short",
|
|
168
|
+
year: "numeric"
|
|
169
|
+
}).format(new Date(viewYear, viewMonth, 1));
|
|
170
|
+
const calendarWeeks = Array.from({ length: Math.ceil(calendarDays.length / 7) }, (_, index) => calendarDays.slice(index * 7, index * 7 + 7));
|
|
171
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
172
|
+
"aria-label": titleText,
|
|
173
|
+
className: classNames("iquji-calendar", className),
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ jsxs("div", {
|
|
176
|
+
className: "iquji-calendar__header",
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ jsxs("div", {
|
|
179
|
+
className: "iquji-calendar__nav",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx("button", {
|
|
182
|
+
"aria-label": isZh ? "上一年" : "Previous year",
|
|
183
|
+
className: "iquji-calendar__nav-btn",
|
|
184
|
+
onClick: handlePrevYear,
|
|
185
|
+
type: "button",
|
|
186
|
+
children: /* @__PURE__ */ jsx(IqujiIcon, {
|
|
187
|
+
decorative: true,
|
|
188
|
+
name: "chevrons-left",
|
|
189
|
+
size: 14
|
|
190
|
+
})
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ jsx("button", {
|
|
193
|
+
"aria-label": isZh ? "上一月" : "Previous month",
|
|
194
|
+
className: "iquji-calendar__nav-btn",
|
|
195
|
+
onClick: handlePrevMonth,
|
|
196
|
+
type: "button",
|
|
197
|
+
children: /* @__PURE__ */ jsx(IqujiIcon, {
|
|
198
|
+
decorative: true,
|
|
199
|
+
name: "chevron-left",
|
|
200
|
+
size: 14
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ jsx("span", {
|
|
206
|
+
className: "iquji-calendar__title",
|
|
207
|
+
children: titleText
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ jsxs("div", {
|
|
210
|
+
className: "iquji-calendar__nav",
|
|
211
|
+
children: [
|
|
212
|
+
/* @__PURE__ */ jsx("button", {
|
|
213
|
+
"aria-label": isZh ? "下一月" : "Next month",
|
|
214
|
+
className: "iquji-calendar__nav-btn",
|
|
215
|
+
onClick: handleNextMonth,
|
|
216
|
+
type: "button",
|
|
217
|
+
children: /* @__PURE__ */ jsx(IqujiIcon, {
|
|
218
|
+
decorative: true,
|
|
219
|
+
name: "chevron-right",
|
|
220
|
+
size: 14
|
|
221
|
+
})
|
|
222
|
+
}),
|
|
223
|
+
/* @__PURE__ */ jsx("button", {
|
|
224
|
+
"aria-label": isZh ? "下一年" : "Next year",
|
|
225
|
+
className: "iquji-calendar__nav-btn",
|
|
226
|
+
onClick: handleNextYear,
|
|
227
|
+
type: "button",
|
|
228
|
+
children: /* @__PURE__ */ jsx(IqujiIcon, {
|
|
229
|
+
decorative: true,
|
|
230
|
+
name: "chevrons-right",
|
|
231
|
+
size: 14
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ jsxs("table", {
|
|
239
|
+
"aria-label": isZh ? "日期" : "Dates",
|
|
240
|
+
className: "iquji-calendar__table",
|
|
241
|
+
children: [
|
|
242
|
+
/* @__PURE__ */ jsx("thead", {
|
|
243
|
+
children: /* @__PURE__ */ jsx("tr", {
|
|
244
|
+
className: "iquji-calendar__weekdays",
|
|
245
|
+
children: weekdays.map((name) => /* @__PURE__ */ jsx("th", {
|
|
246
|
+
className: "iquji-calendar__weekday",
|
|
247
|
+
scope: "col",
|
|
248
|
+
children: name
|
|
249
|
+
}, name))
|
|
250
|
+
})
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ jsx("tbody", {
|
|
253
|
+
className: "iquji-calendar__body",
|
|
254
|
+
children: calendarWeeks.map((week) => /* @__PURE__ */ jsx("tr", {
|
|
255
|
+
className: "iquji-calendar__grid",
|
|
256
|
+
children: week.map((day) => {
|
|
257
|
+
const names = classNames("iquji-calendar__cell", !day.isCurrentMonth ? "iquji-calendar__cell--outside" : undefined, day.isToday ? "iquji-calendar__cell--today" : undefined, day.isSelected ? "iquji-calendar__cell--selected" : undefined, day.isDisabled ? "iquji-calendar__cell--disabled" : undefined);
|
|
258
|
+
return /* @__PURE__ */ jsx("td", {
|
|
259
|
+
className: "iquji-calendar__day",
|
|
260
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
261
|
+
"aria-label": day.dateString,
|
|
262
|
+
"aria-pressed": day.isSelected,
|
|
263
|
+
className: names,
|
|
264
|
+
disabled: day.isDisabled,
|
|
265
|
+
onClick: () => handleSelectDay(day),
|
|
266
|
+
tabIndex: day.isCurrentMonth ? 0 : -1,
|
|
267
|
+
type: "button",
|
|
268
|
+
children: day.dayNumber
|
|
269
|
+
})
|
|
270
|
+
}, day.dateString);
|
|
271
|
+
})
|
|
272
|
+
}, week[0]?.dateString))
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
}),
|
|
276
|
+
(showToday || clearable && selectedDateString || footer) && /* @__PURE__ */ jsxs("div", {
|
|
277
|
+
className: "iquji-calendar__footer",
|
|
278
|
+
children: [
|
|
279
|
+
showToday && /* @__PURE__ */ jsx("button", {
|
|
280
|
+
className: "iquji-calendar__footer-btn",
|
|
281
|
+
onClick: handleToday,
|
|
282
|
+
type: "button",
|
|
283
|
+
children: isZh ? "今天" : "Today"
|
|
284
|
+
}),
|
|
285
|
+
clearable && Boolean(selectedDateString) && /* @__PURE__ */ jsx("button", {
|
|
286
|
+
className: "iquji-calendar__footer-btn iquji-calendar__footer-btn--clear",
|
|
287
|
+
onClick: handleClear,
|
|
288
|
+
type: "button",
|
|
289
|
+
children: isZh ? "清除" : "Clear"
|
|
290
|
+
}),
|
|
291
|
+
footer
|
|
292
|
+
]
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
// src/color-picker.tsx
|
|
298
|
+
import { useEffect, useRef as useRef2, useState as useState3 } from "react";
|
|
299
|
+
|
|
300
|
+
// src/floating.tsx
|
|
301
|
+
import { Menu as BaseMenu } from "@base-ui/react/menu";
|
|
302
|
+
import { Popover as BasePopover } from "@base-ui/react/popover";
|
|
303
|
+
import { IqujiIcon as IqujiIcon2 } from "@iquji-web/web-icons";
|
|
304
|
+
import {
|
|
305
|
+
useState as useState2
|
|
306
|
+
} from "react";
|
|
307
|
+
|
|
308
|
+
// src/overlay-focus.ts
|
|
309
|
+
import { useCallback as useCallback2, useRef } from "react";
|
|
310
|
+
function resolveIqujiOverlayInitialFocus(ref) {
|
|
311
|
+
if (!ref)
|
|
312
|
+
return;
|
|
313
|
+
return () => {
|
|
314
|
+
const target = ref.current;
|
|
315
|
+
return target?.isConnected && !target.matches(':disabled, [aria-disabled="true"]') && !target.closest("[hidden], [inert]") ? target : true;
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
var floatingTriggers = new WeakMap;
|
|
319
|
+
function useIqujiFloatingTriggerRefs() {
|
|
320
|
+
const trigger = useRef(null);
|
|
321
|
+
const popup = useRef(null);
|
|
322
|
+
const triggerRef = useCallback2((element) => {
|
|
323
|
+
trigger.current = element;
|
|
324
|
+
if (element && popup.current)
|
|
325
|
+
floatingTriggers.set(popup.current, element);
|
|
326
|
+
}, []);
|
|
327
|
+
const popupRef = useCallback2((element) => {
|
|
328
|
+
popup.current = element;
|
|
329
|
+
if (element && trigger.current)
|
|
330
|
+
floatingTriggers.set(element, trigger.current);
|
|
331
|
+
}, []);
|
|
332
|
+
return { triggerRef, popupRef };
|
|
333
|
+
}
|
|
334
|
+
var resolveReturnTarget = (element) => {
|
|
335
|
+
const visited = new Set;
|
|
336
|
+
let target = element;
|
|
337
|
+
while (!visited.has(target)) {
|
|
338
|
+
visited.add(target);
|
|
339
|
+
const popup = target.closest(".iquji-menu-popup, .iquji-popover-popup");
|
|
340
|
+
const trigger = popup ? floatingTriggers.get(popup) : undefined;
|
|
341
|
+
if (!trigger)
|
|
342
|
+
break;
|
|
343
|
+
target = trigger;
|
|
344
|
+
}
|
|
345
|
+
return target;
|
|
346
|
+
};
|
|
347
|
+
function restoreIqujiOverlayFocus(resolveTarget) {
|
|
348
|
+
const target = resolveTarget();
|
|
349
|
+
if (target instanceof HTMLElement)
|
|
350
|
+
target.focus({ preventScroll: true });
|
|
351
|
+
}
|
|
352
|
+
function useIqujiOverlayReturnFocus(open) {
|
|
353
|
+
const wasOpen = useRef(false);
|
|
354
|
+
const currentOpen = useRef(open);
|
|
355
|
+
currentOpen.current = open;
|
|
356
|
+
const returnTarget = useRef(null);
|
|
357
|
+
if (open && !wasOpen.current) {
|
|
358
|
+
const activeElement = typeof document === "undefined" ? null : document.activeElement;
|
|
359
|
+
returnTarget.current = typeof HTMLElement !== "undefined" && activeElement instanceof HTMLElement && activeElement !== document.body && activeElement !== document.documentElement ? resolveReturnTarget(activeElement) : null;
|
|
360
|
+
}
|
|
361
|
+
wasOpen.current = Boolean(open);
|
|
362
|
+
return useCallback2(() => {
|
|
363
|
+
if (currentOpen.current)
|
|
364
|
+
return false;
|
|
365
|
+
const target = returnTarget.current;
|
|
366
|
+
const active = typeof document !== "undefined" && document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
367
|
+
const focusedPopup = active ? active.closest("[data-iquji-overlay-surface][data-open], .iquji-floating-popup[data-open]") : null;
|
|
368
|
+
if (focusedPopup && !focusedPopup.contains(target))
|
|
369
|
+
return false;
|
|
370
|
+
if (active && active !== target && active.matches('input, textarea, select, [contenteditable="true"]') && !active.closest("[hidden], [inert]") && !active.closest("[data-iquji-overlay-surface]:not([data-open])"))
|
|
371
|
+
return false;
|
|
372
|
+
if (!target)
|
|
373
|
+
return true;
|
|
374
|
+
if (target.hasAttribute("data-iquji-overlay-surface") && active !== target && target.contains(active))
|
|
375
|
+
return false;
|
|
376
|
+
if (!target.isConnected || target.matches(':disabled, [aria-disabled="true"]') || target.closest("[hidden], [inert]"))
|
|
377
|
+
return false;
|
|
378
|
+
return target;
|
|
379
|
+
}, []);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// src/overlay-scope.tsx
|
|
383
|
+
import {
|
|
384
|
+
createContext,
|
|
385
|
+
useContext,
|
|
386
|
+
useMemo as useMemo2
|
|
387
|
+
} from "react";
|
|
388
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
389
|
+
var IqujiOverlayScopeContext = createContext(undefined);
|
|
390
|
+
function IqujiOverlayScopeProvider({
|
|
391
|
+
children,
|
|
392
|
+
container
|
|
393
|
+
}) {
|
|
394
|
+
const value = useMemo2(() => container, [container]);
|
|
395
|
+
return /* @__PURE__ */ jsx2(IqujiOverlayScopeContext.Provider, {
|
|
396
|
+
value,
|
|
397
|
+
children
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
function useIqujiOverlayContainer() {
|
|
401
|
+
return useContext(IqujiOverlayScopeContext);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// src/floating.tsx
|
|
405
|
+
import { jsx as jsx3, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
|
|
406
|
+
function MenuEntryContent({
|
|
407
|
+
entry,
|
|
408
|
+
chevron = false
|
|
409
|
+
}) {
|
|
410
|
+
return /* @__PURE__ */ jsxs2(Fragment, {
|
|
411
|
+
children: [
|
|
412
|
+
entry.icon ? /* @__PURE__ */ jsx3("span", {
|
|
413
|
+
"aria-hidden": "true",
|
|
414
|
+
className: "iquji-menu-item__icon",
|
|
415
|
+
children: entry.icon
|
|
416
|
+
}) : null,
|
|
417
|
+
/* @__PURE__ */ jsx3("span", {
|
|
418
|
+
className: "iquji-menu-item__label",
|
|
419
|
+
children: entry.label
|
|
420
|
+
}),
|
|
421
|
+
entry.shortcut ? /* @__PURE__ */ jsx3("span", {
|
|
422
|
+
"aria-hidden": "true",
|
|
423
|
+
className: "iquji-menu-item__shortcut",
|
|
424
|
+
children: entry.shortcut
|
|
425
|
+
}) : null,
|
|
426
|
+
chevron ? /* @__PURE__ */ jsx3(IqujiIcon2, {
|
|
427
|
+
className: "iquji-menu-item__chevron",
|
|
428
|
+
decorative: true,
|
|
429
|
+
name: "chevron-right",
|
|
430
|
+
size: 15
|
|
431
|
+
}) : null
|
|
432
|
+
]
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
function DropdownSubmenu({ item }) {
|
|
436
|
+
const [open, setOpen] = useState2(false);
|
|
437
|
+
const portalContainer = useIqujiOverlayContainer();
|
|
438
|
+
const structured = item.kind === "submenu" ? item.items : undefined;
|
|
439
|
+
return /* @__PURE__ */ jsxs2(BaseMenu.SubmenuRoot, {
|
|
440
|
+
open,
|
|
441
|
+
onOpenChange: setOpen,
|
|
442
|
+
children: [
|
|
443
|
+
/* @__PURE__ */ jsx3(BaseMenu.SubmenuTrigger, {
|
|
444
|
+
className: classNames("iquji-menu-item", item.kind === "item" && item.tone === "danger" ? "iquji-menu-item--danger" : undefined),
|
|
445
|
+
disabled: item.disabled,
|
|
446
|
+
onClick: () => {
|
|
447
|
+
if (!item.disabled)
|
|
448
|
+
setOpen(true);
|
|
449
|
+
},
|
|
450
|
+
openOnHover: true,
|
|
451
|
+
children: /* @__PURE__ */ jsx3(MenuEntryContent, {
|
|
452
|
+
chevron: true,
|
|
453
|
+
entry: item
|
|
454
|
+
})
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ jsx3(BaseMenu.Portal, {
|
|
457
|
+
container: portalContainer ?? undefined,
|
|
458
|
+
children: /* @__PURE__ */ jsx3(BaseMenu.Positioner, {
|
|
459
|
+
align: "start",
|
|
460
|
+
className: "iquji-floating-positioner",
|
|
461
|
+
side: "right",
|
|
462
|
+
sideOffset: 4,
|
|
463
|
+
style: { zIndex: portalContainer ? undefined : 1002 },
|
|
464
|
+
children: /* @__PURE__ */ jsx3(BaseMenu.Popup, {
|
|
465
|
+
className: "iquji-floating-popup iquji-menu-popup",
|
|
466
|
+
children: open ? structured ? renderMenuEntries(structured) : item.kind === "submenu" ? null : item.submenu : null
|
|
467
|
+
})
|
|
468
|
+
})
|
|
469
|
+
})
|
|
470
|
+
]
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
function renderMenuEntry(entry) {
|
|
474
|
+
if (entry.kind === "separator") {
|
|
475
|
+
return /* @__PURE__ */ jsx3(BaseMenu.Separator, {
|
|
476
|
+
className: "iquji-menu-separator"
|
|
477
|
+
}, entry.key);
|
|
478
|
+
}
|
|
479
|
+
if (entry.kind === "label") {
|
|
480
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
481
|
+
className: "iquji-menu-label",
|
|
482
|
+
role: "presentation",
|
|
483
|
+
children: entry.label
|
|
484
|
+
}, entry.key);
|
|
485
|
+
}
|
|
486
|
+
if (entry.kind === "submenu" || entry.submenu) {
|
|
487
|
+
return /* @__PURE__ */ jsx3(DropdownSubmenu, {
|
|
488
|
+
item: entry
|
|
489
|
+
}, entry.key);
|
|
490
|
+
}
|
|
491
|
+
return /* @__PURE__ */ jsx3(BaseMenu.Item, {
|
|
492
|
+
"aria-keyshortcuts": entry.keyshortcuts,
|
|
493
|
+
className: classNames("iquji-menu-item", entry.tone === "danger" ? "iquji-menu-item--danger" : undefined),
|
|
494
|
+
disabled: entry.disabled,
|
|
495
|
+
onClick: entry.onSelect,
|
|
496
|
+
children: /* @__PURE__ */ jsx3(MenuEntryContent, {
|
|
497
|
+
entry
|
|
498
|
+
})
|
|
499
|
+
}, entry.key);
|
|
500
|
+
}
|
|
501
|
+
function renderMenuEntries(entries) {
|
|
502
|
+
return entries.map(renderMenuEntry);
|
|
503
|
+
}
|
|
504
|
+
var IqujiDropdownMenu = ({
|
|
505
|
+
trigger,
|
|
506
|
+
items,
|
|
507
|
+
open,
|
|
508
|
+
onOpenChange,
|
|
509
|
+
align,
|
|
510
|
+
side,
|
|
511
|
+
sideOffset,
|
|
512
|
+
anchor,
|
|
513
|
+
collisionBoundary,
|
|
514
|
+
finalFocus,
|
|
515
|
+
popupStyle,
|
|
516
|
+
ariaLabel
|
|
517
|
+
}) => {
|
|
518
|
+
const portalContainer = useIqujiOverlayContainer();
|
|
519
|
+
const { triggerRef, popupRef } = useIqujiFloatingTriggerRefs();
|
|
520
|
+
return /* @__PURE__ */ jsxs2(BaseMenu.Root, {
|
|
521
|
+
open,
|
|
522
|
+
onOpenChange,
|
|
523
|
+
children: [
|
|
524
|
+
/* @__PURE__ */ jsx3(BaseMenu.Trigger, {
|
|
525
|
+
ref: triggerRef,
|
|
526
|
+
render: trigger
|
|
527
|
+
}),
|
|
528
|
+
/* @__PURE__ */ jsx3(BaseMenu.Portal, {
|
|
529
|
+
keepMounted: true,
|
|
530
|
+
container: portalContainer ?? undefined,
|
|
531
|
+
children: /* @__PURE__ */ jsx3(BaseMenu.Positioner, {
|
|
532
|
+
align,
|
|
533
|
+
anchor,
|
|
534
|
+
collisionBoundary,
|
|
535
|
+
className: "iquji-floating-positioner",
|
|
536
|
+
side,
|
|
537
|
+
sideOffset,
|
|
538
|
+
style: { zIndex: portalContainer ? undefined : 1002 },
|
|
539
|
+
children: /* @__PURE__ */ jsx3(BaseMenu.Popup, {
|
|
540
|
+
"aria-label": ariaLabel,
|
|
541
|
+
className: "iquji-floating-popup iquji-menu-popup",
|
|
542
|
+
finalFocus,
|
|
543
|
+
ref: popupRef,
|
|
544
|
+
style: popupStyle,
|
|
545
|
+
children: renderMenuEntries(items)
|
|
546
|
+
})
|
|
547
|
+
})
|
|
548
|
+
})
|
|
549
|
+
]
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
function IqujiPopover({
|
|
553
|
+
anchor,
|
|
554
|
+
trigger,
|
|
555
|
+
children,
|
|
556
|
+
open,
|
|
557
|
+
onOpenChange,
|
|
558
|
+
side = "bottom",
|
|
559
|
+
align,
|
|
560
|
+
sideOffset = 8,
|
|
561
|
+
collisionBoundary,
|
|
562
|
+
collisionPadding,
|
|
563
|
+
collisionAvoidance,
|
|
564
|
+
popupStyle,
|
|
565
|
+
finalFocus
|
|
566
|
+
}) {
|
|
567
|
+
const container = useIqujiOverlayContainer();
|
|
568
|
+
const { triggerRef, popupRef } = useIqujiFloatingTriggerRefs();
|
|
569
|
+
return /* @__PURE__ */ jsxs2(BasePopover.Root, {
|
|
570
|
+
open,
|
|
571
|
+
onOpenChange,
|
|
572
|
+
children: [
|
|
573
|
+
/* @__PURE__ */ jsx3(BasePopover.Trigger, {
|
|
574
|
+
ref: triggerRef,
|
|
575
|
+
render: trigger
|
|
576
|
+
}),
|
|
577
|
+
/* @__PURE__ */ jsx3(BasePopover.Portal, {
|
|
578
|
+
keepMounted: true,
|
|
579
|
+
container: container ?? undefined,
|
|
580
|
+
children: /* @__PURE__ */ jsx3(BasePopover.Positioner, {
|
|
581
|
+
anchor,
|
|
582
|
+
side,
|
|
583
|
+
align,
|
|
584
|
+
sideOffset,
|
|
585
|
+
collisionBoundary,
|
|
586
|
+
collisionPadding,
|
|
587
|
+
collisionAvoidance,
|
|
588
|
+
className: "iquji-floating-positioner",
|
|
589
|
+
style: { zIndex: container ? undefined : 1002 },
|
|
590
|
+
children: /* @__PURE__ */ jsx3(BasePopover.Popup, {
|
|
591
|
+
ref: popupRef,
|
|
592
|
+
finalFocus,
|
|
593
|
+
className: "iquji-floating-popup iquji-popover-popup",
|
|
594
|
+
style: popupStyle,
|
|
595
|
+
children
|
|
596
|
+
})
|
|
597
|
+
})
|
|
598
|
+
})
|
|
599
|
+
]
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// src/color-picker.tsx
|
|
604
|
+
import { jsx as jsx4, jsxs as jsxs3, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
605
|
+
var normalizeIqujiColor = (value) => /^#[0-9a-f]{6}$/iu.test(value.trim()) ? value.trim().toLowerCase() : null;
|
|
606
|
+
function IqujiColorPicker({
|
|
607
|
+
value,
|
|
608
|
+
onChange,
|
|
609
|
+
presets,
|
|
610
|
+
label,
|
|
611
|
+
defaultLabel,
|
|
612
|
+
customLabel,
|
|
613
|
+
hexLabel,
|
|
614
|
+
applyLabel,
|
|
615
|
+
cancelLabel,
|
|
616
|
+
disabled = false,
|
|
617
|
+
trigger,
|
|
618
|
+
onOpenChange,
|
|
619
|
+
finalFocus
|
|
620
|
+
}) {
|
|
621
|
+
const currentOnOpenChange = useRef2(onOpenChange);
|
|
622
|
+
currentOnOpenChange.current = onOpenChange;
|
|
623
|
+
const [open, setOpen] = useState3(false);
|
|
624
|
+
const [custom, setCustom] = useState3(false);
|
|
625
|
+
const [draft, setDraft] = useState3(value ?? "#000000");
|
|
626
|
+
const valid = normalizeIqujiColor(draft);
|
|
627
|
+
const changeOpen = (next, reason = "programmatic") => {
|
|
628
|
+
if (next && disabled)
|
|
629
|
+
return;
|
|
630
|
+
setOpen(next);
|
|
631
|
+
if (next) {
|
|
632
|
+
setCustom(false);
|
|
633
|
+
setDraft(value ?? "#000000");
|
|
634
|
+
}
|
|
635
|
+
onOpenChange?.(next, reason);
|
|
636
|
+
};
|
|
637
|
+
useEffect(() => {
|
|
638
|
+
if (disabled && open) {
|
|
639
|
+
setOpen(false);
|
|
640
|
+
currentOnOpenChange.current?.(false, "disabled");
|
|
641
|
+
}
|
|
642
|
+
}, [disabled, open]);
|
|
643
|
+
const choose = (next) => {
|
|
644
|
+
if (disabled)
|
|
645
|
+
return;
|
|
646
|
+
onChange(next);
|
|
647
|
+
changeOpen(false, "selection");
|
|
648
|
+
};
|
|
649
|
+
return /* @__PURE__ */ jsx4(IqujiPopover, {
|
|
650
|
+
open,
|
|
651
|
+
onOpenChange: (next, details) => changeOpen(next, details.reason),
|
|
652
|
+
align: "start",
|
|
653
|
+
collisionPadding: 12,
|
|
654
|
+
collisionAvoidance: { side: "flip", align: "shift", fallbackAxisSide: "start" },
|
|
655
|
+
popupStyle: { maxWidth: "calc(100vw - 32px)" },
|
|
656
|
+
finalFocus,
|
|
657
|
+
trigger: trigger ?? /* @__PURE__ */ jsxs3(IqujiButton, {
|
|
658
|
+
compact: true,
|
|
659
|
+
variant: "ghost",
|
|
660
|
+
disabled,
|
|
661
|
+
"aria-label": label,
|
|
662
|
+
children: [
|
|
663
|
+
/* @__PURE__ */ jsx4("span", {
|
|
664
|
+
className: "iquji-color-swatch",
|
|
665
|
+
style: { backgroundColor: value ?? "transparent" }
|
|
666
|
+
}),
|
|
667
|
+
label
|
|
668
|
+
]
|
|
669
|
+
}),
|
|
670
|
+
children: /* @__PURE__ */ jsxs3("fieldset", {
|
|
671
|
+
className: "iquji-color-picker",
|
|
672
|
+
"aria-label": label,
|
|
673
|
+
children: [
|
|
674
|
+
/* @__PURE__ */ jsx4(IqujiButton, {
|
|
675
|
+
compact: true,
|
|
676
|
+
variant: "ghost",
|
|
677
|
+
disabled,
|
|
678
|
+
onClick: () => choose(null),
|
|
679
|
+
children: defaultLabel
|
|
680
|
+
}),
|
|
681
|
+
/* @__PURE__ */ jsx4("div", {
|
|
682
|
+
className: "iquji-color-presets",
|
|
683
|
+
children: presets.map((preset) => /* @__PURE__ */ jsxs3(IqujiButton, {
|
|
684
|
+
compact: true,
|
|
685
|
+
variant: "ghost",
|
|
686
|
+
disabled: disabled || !normalizeIqujiColor(preset.value),
|
|
687
|
+
"aria-label": preset.label,
|
|
688
|
+
title: preset.label,
|
|
689
|
+
"aria-pressed": value === preset.value,
|
|
690
|
+
onClick: () => choose(preset.value),
|
|
691
|
+
children: [
|
|
692
|
+
/* @__PURE__ */ jsx4("span", {
|
|
693
|
+
className: "iquji-color-swatch",
|
|
694
|
+
style: { backgroundColor: preset.value }
|
|
695
|
+
}),
|
|
696
|
+
/* @__PURE__ */ jsx4("span", {
|
|
697
|
+
className: "iquji-color-name",
|
|
698
|
+
children: preset.label
|
|
699
|
+
})
|
|
700
|
+
]
|
|
701
|
+
}, preset.value))
|
|
702
|
+
}),
|
|
703
|
+
!custom ? /* @__PURE__ */ jsx4(IqujiButton, {
|
|
704
|
+
compact: true,
|
|
705
|
+
variant: "ghost",
|
|
706
|
+
disabled,
|
|
707
|
+
onClick: () => setCustom(true),
|
|
708
|
+
children: customLabel
|
|
709
|
+
}) : /* @__PURE__ */ jsxs3(Fragment2, {
|
|
710
|
+
children: [
|
|
711
|
+
/* @__PURE__ */ jsx4("input", {
|
|
712
|
+
className: "iquji-color-spectrum",
|
|
713
|
+
type: "color",
|
|
714
|
+
value: valid ?? "#000000",
|
|
715
|
+
"aria-label": customLabel,
|
|
716
|
+
disabled,
|
|
717
|
+
onChange: (event) => setDraft(event.target.value)
|
|
718
|
+
}),
|
|
719
|
+
/* @__PURE__ */ jsxs3("label", {
|
|
720
|
+
className: "iquji-color-hex",
|
|
721
|
+
children: [
|
|
722
|
+
hexLabel,
|
|
723
|
+
/* @__PURE__ */ jsx4("input", {
|
|
724
|
+
value: draft,
|
|
725
|
+
spellCheck: false,
|
|
726
|
+
maxLength: 7,
|
|
727
|
+
"aria-invalid": !valid,
|
|
728
|
+
disabled,
|
|
729
|
+
onChange: (event) => setDraft(event.target.value)
|
|
730
|
+
})
|
|
731
|
+
]
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ jsxs3("div", {
|
|
734
|
+
className: "iquji-color-actions",
|
|
735
|
+
children: [
|
|
736
|
+
/* @__PURE__ */ jsx4(IqujiButton, {
|
|
737
|
+
compact: true,
|
|
738
|
+
variant: "secondary",
|
|
739
|
+
onClick: () => changeOpen(false, "cancel"),
|
|
740
|
+
children: cancelLabel
|
|
741
|
+
}),
|
|
742
|
+
/* @__PURE__ */ jsx4(IqujiButton, {
|
|
743
|
+
compact: true,
|
|
744
|
+
disabled: disabled || !valid,
|
|
745
|
+
onClick: () => valid && choose(valid),
|
|
746
|
+
children: applyLabel
|
|
747
|
+
})
|
|
748
|
+
]
|
|
749
|
+
})
|
|
750
|
+
]
|
|
751
|
+
})
|
|
752
|
+
]
|
|
753
|
+
})
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
// src/confirmation.tsx
|
|
757
|
+
import { useRef as useRef5 } from "react";
|
|
758
|
+
|
|
759
|
+
// src/overlays.tsx
|
|
760
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
761
|
+
import { IqujiIcon as IqujiIcon3 } from "@iquji-web/web-icons";
|
|
762
|
+
import {
|
|
763
|
+
useId,
|
|
764
|
+
useState as useState6
|
|
765
|
+
} from "react";
|
|
766
|
+
|
|
767
|
+
// src/overlay-layer.tsx
|
|
768
|
+
import {
|
|
769
|
+
createContext as createContext2,
|
|
770
|
+
useCallback as useCallback3,
|
|
771
|
+
useContext as useContext2,
|
|
772
|
+
useEffect as useEffect2,
|
|
773
|
+
useMemo as useMemo3,
|
|
774
|
+
useRef as useRef3,
|
|
775
|
+
useState as useState4
|
|
776
|
+
} from "react";
|
|
777
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
778
|
+
function useIqujiOverlayModal(open, isTopLayer) {
|
|
779
|
+
const [focused, setFocused] = useState4(false);
|
|
780
|
+
useEffect2(() => {
|
|
781
|
+
if (!open || !isTopLayer)
|
|
782
|
+
setFocused(false);
|
|
783
|
+
}, [open, isTopLayer]);
|
|
784
|
+
return {
|
|
785
|
+
modal: !open || isTopLayer && focused ? "trap-focus" : false,
|
|
786
|
+
onFocusCapture(event) {
|
|
787
|
+
if (open && isTopLayer && event.currentTarget.contains(event.target))
|
|
788
|
+
setFocused(true);
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
var Context = createContext2(null);
|
|
793
|
+
var Ancestors = createContext2([]);
|
|
794
|
+
var locks = new WeakMap;
|
|
795
|
+
var nextOrder = 0;
|
|
796
|
+
function orderedLayers(layers) {
|
|
797
|
+
const pending = [...layers].sort((left, right) => left.order - right.order);
|
|
798
|
+
const result = [];
|
|
799
|
+
while (pending.length) {
|
|
800
|
+
const index = pending.findIndex((layer) => !pending.some((other) => layer.ancestors.includes(other.id)));
|
|
801
|
+
result.push(...pending.splice(index, 1));
|
|
802
|
+
}
|
|
803
|
+
return result;
|
|
804
|
+
}
|
|
805
|
+
function IqujiOverlayAncestry({
|
|
806
|
+
id,
|
|
807
|
+
children
|
|
808
|
+
}) {
|
|
809
|
+
const ancestors = useContext2(Ancestors);
|
|
810
|
+
const value = useMemo3(() => [...ancestors, id], [ancestors, id]);
|
|
811
|
+
return /* @__PURE__ */ jsx5(Ancestors.Provider, {
|
|
812
|
+
value,
|
|
813
|
+
children
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
function IqujiOverlayProvider({ children }) {
|
|
817
|
+
const [layers, setLayers] = useState4([]);
|
|
818
|
+
const register = useCallback3((layer) => setLayers((current) => orderedLayers([
|
|
819
|
+
...current.filter((value2) => value2.id !== layer.id),
|
|
820
|
+
layer
|
|
821
|
+
])), []);
|
|
822
|
+
const unregister = useCallback3((id) => setLayers((current) => orderedLayers(current.filter((layer) => layer.id !== id))), []);
|
|
823
|
+
const locked = layers.length > 0;
|
|
824
|
+
useEffect2(() => {
|
|
825
|
+
if (!locked)
|
|
826
|
+
return;
|
|
827
|
+
const body = document.body;
|
|
828
|
+
const lock = locks.get(body) ?? { count: 0, overflow: body.style.overflow };
|
|
829
|
+
lock.count++;
|
|
830
|
+
locks.set(body, lock);
|
|
831
|
+
body.style.overflow = "hidden";
|
|
832
|
+
return () => {
|
|
833
|
+
if (--lock.count === 0) {
|
|
834
|
+
body.style.overflow = lock.overflow;
|
|
835
|
+
locks.delete(body);
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
}, [locked]);
|
|
839
|
+
const value = useMemo3(() => ({ layers, register, unregister }), [layers, register, unregister]);
|
|
840
|
+
return /* @__PURE__ */ jsx5(Context.Provider, {
|
|
841
|
+
value,
|
|
842
|
+
children
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
function IqujiOverlayBoundary({ children }) {
|
|
846
|
+
return useContext2(Context) ? children : /* @__PURE__ */ jsx5(IqujiOverlayProvider, {
|
|
847
|
+
children
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
function useIqujiOverlayLayer(id, kind, active, open, container) {
|
|
851
|
+
const opening = useRef3({ open: false, order: 0 });
|
|
852
|
+
if (open && !opening.current.open)
|
|
853
|
+
opening.current.order = ++nextOrder;
|
|
854
|
+
opening.current.open = open;
|
|
855
|
+
const order = opening.current.order;
|
|
856
|
+
const ancestors = useContext2(Ancestors);
|
|
857
|
+
const context = useContext2(Context);
|
|
858
|
+
const register = context?.register, unregister = context?.unregister;
|
|
859
|
+
useEffect2(() => {
|
|
860
|
+
if (!active || !register || !unregister)
|
|
861
|
+
return;
|
|
862
|
+
register({ id, kind, order, ancestors, container, open });
|
|
863
|
+
return () => unregister(id);
|
|
864
|
+
}, [
|
|
865
|
+
active,
|
|
866
|
+
id,
|
|
867
|
+
kind,
|
|
868
|
+
order,
|
|
869
|
+
ancestors,
|
|
870
|
+
container,
|
|
871
|
+
open,
|
|
872
|
+
register,
|
|
873
|
+
unregister
|
|
874
|
+
]);
|
|
875
|
+
const layers = context?.layers ?? [];
|
|
876
|
+
const index = layers.findIndex((layer) => layer.id === id);
|
|
877
|
+
const base = 1000 + Math.max(index, 0) * 20;
|
|
878
|
+
return {
|
|
879
|
+
registered: index !== -1,
|
|
880
|
+
isTopLayer: !layers.length || layers.at(-1)?.id === id,
|
|
881
|
+
backdrop: base,
|
|
882
|
+
surface: base + 1,
|
|
883
|
+
floating: base + 2
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
function useIqujiNotificationContainer() {
|
|
887
|
+
const context = useContext2(Context);
|
|
888
|
+
return [...context?.layers ?? []].reverse().find((layer) => layer.open)?.container ?? undefined;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// src/overlay-presence.ts
|
|
892
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef4, useState as useState5 } from "react";
|
|
893
|
+
function useIqujiOverlayPresence(open, onCloseComplete) {
|
|
894
|
+
const [present, setPresent] = useState5(open);
|
|
895
|
+
const currentOpen = useRef4(open), completed = useRef4(!open), pending = useRef4(false), completion = useRef4(onCloseComplete);
|
|
896
|
+
currentOpen.current = open;
|
|
897
|
+
completion.current = onCloseComplete;
|
|
898
|
+
if (open) {
|
|
899
|
+
completed.current = false;
|
|
900
|
+
pending.current = false;
|
|
901
|
+
}
|
|
902
|
+
useEffect3(() => {
|
|
903
|
+
if (open)
|
|
904
|
+
setPresent(true);
|
|
905
|
+
}, [open]);
|
|
906
|
+
const complete = useCallback4((nextOpen) => {
|
|
907
|
+
if (nextOpen || currentOpen.current || completed.current)
|
|
908
|
+
return;
|
|
909
|
+
completed.current = true;
|
|
910
|
+
pending.current = true;
|
|
911
|
+
setPresent(false);
|
|
912
|
+
}, []);
|
|
913
|
+
const notify = useCallback4(() => {
|
|
914
|
+
if (currentOpen.current || !pending.current)
|
|
915
|
+
return;
|
|
916
|
+
pending.current = false;
|
|
917
|
+
completion.current?.();
|
|
918
|
+
}, []);
|
|
919
|
+
return { active: open || present, complete, notify };
|
|
920
|
+
}
|
|
921
|
+
function useIqujiOverlayCompletion(presence, registered, finalFocus) {
|
|
922
|
+
const { active, notify } = presence;
|
|
923
|
+
useEffect3(() => {
|
|
924
|
+
if (active || registered)
|
|
925
|
+
return;
|
|
926
|
+
let cancelled = false;
|
|
927
|
+
queueMicrotask(() => {
|
|
928
|
+
if (!cancelled) {
|
|
929
|
+
restoreIqujiOverlayFocus(finalFocus);
|
|
930
|
+
notify();
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
return () => {
|
|
934
|
+
cancelled = true;
|
|
935
|
+
};
|
|
936
|
+
}, [active, registered, notify, finalFocus]);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// src/overlays.tsx
|
|
940
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
941
|
+
var widths = {
|
|
942
|
+
sm: "min(92vw, 420px)",
|
|
943
|
+
md: "min(92vw, 720px)",
|
|
944
|
+
lg: "min(94vw, 960px)"
|
|
945
|
+
};
|
|
946
|
+
function IqujiDialog(props) {
|
|
947
|
+
return /* @__PURE__ */ jsx6(IqujiOverlayBoundary, {
|
|
948
|
+
children: /* @__PURE__ */ jsx6(DialogContent, {
|
|
949
|
+
...props
|
|
950
|
+
})
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
function DialogContent({
|
|
954
|
+
open,
|
|
955
|
+
onOpenChange,
|
|
956
|
+
onCloseComplete,
|
|
957
|
+
title,
|
|
958
|
+
description,
|
|
959
|
+
heading,
|
|
960
|
+
headerActions,
|
|
961
|
+
closeLabel,
|
|
962
|
+
children,
|
|
963
|
+
actions,
|
|
964
|
+
initialFocusRef,
|
|
965
|
+
popupRef,
|
|
966
|
+
mandatory = false,
|
|
967
|
+
destroyOnClose = true,
|
|
968
|
+
size = "md",
|
|
969
|
+
surface = "panel",
|
|
970
|
+
layout = "standard",
|
|
971
|
+
width,
|
|
972
|
+
className,
|
|
973
|
+
style,
|
|
974
|
+
onFocusCapture,
|
|
975
|
+
...props
|
|
976
|
+
}) {
|
|
977
|
+
const id = useId();
|
|
978
|
+
const [container, setContainer] = useState6(null);
|
|
979
|
+
const presence = useIqujiOverlayPresence(open, onCloseComplete);
|
|
980
|
+
const layer = useIqujiOverlayLayer(id, "dialog", presence.active, open, container);
|
|
981
|
+
const focus = useIqujiOverlayModal(open, layer.isTopLayer);
|
|
982
|
+
const finalFocus = useIqujiOverlayReturnFocus(open);
|
|
983
|
+
useIqujiOverlayCompletion(presence, layer.registered, finalFocus);
|
|
984
|
+
if (!mandatory && !closeLabel)
|
|
985
|
+
throw new Error("可关闭对话框必须提供 closeLabel");
|
|
986
|
+
return /* @__PURE__ */ jsx6(IqujiOverlayAncestry, {
|
|
987
|
+
id,
|
|
988
|
+
children: /* @__PURE__ */ jsx6(Dialog.Root, {
|
|
989
|
+
open,
|
|
990
|
+
modal: focus.modal,
|
|
991
|
+
disablePointerDismissal: mandatory,
|
|
992
|
+
onOpenChange: (next, details) => {
|
|
993
|
+
if (!next && (mandatory || !layer.isTopLayer)) {
|
|
994
|
+
details.cancel();
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
onOpenChange?.(next);
|
|
998
|
+
},
|
|
999
|
+
onOpenChangeComplete: (next) => {
|
|
1000
|
+
if (!next)
|
|
1001
|
+
restoreIqujiOverlayFocus(finalFocus);
|
|
1002
|
+
presence.complete(next);
|
|
1003
|
+
},
|
|
1004
|
+
children: /* @__PURE__ */ jsxs4(Dialog.Portal, {
|
|
1005
|
+
keepMounted: !destroyOnClose,
|
|
1006
|
+
container: typeof document === "undefined" ? undefined : document.body,
|
|
1007
|
+
children: [
|
|
1008
|
+
/* @__PURE__ */ jsx6(Dialog.Backdrop, {
|
|
1009
|
+
forceRender: true,
|
|
1010
|
+
className: "iquji-overlay-backdrop iquji-dialog-backdrop",
|
|
1011
|
+
style: { zIndex: layer.backdrop }
|
|
1012
|
+
}),
|
|
1013
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1014
|
+
ref: setContainer,
|
|
1015
|
+
className: "iquji-overlay-floating-layer",
|
|
1016
|
+
"data-iquji-overlay-portal": "",
|
|
1017
|
+
style: { zIndex: layer.floating }
|
|
1018
|
+
}),
|
|
1019
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1020
|
+
className: "iquji-dialog-positioner",
|
|
1021
|
+
style: { zIndex: layer.surface },
|
|
1022
|
+
children: /* @__PURE__ */ jsx6(Dialog.Popup, {
|
|
1023
|
+
...props,
|
|
1024
|
+
ref: popupRef,
|
|
1025
|
+
onFocusCapture: (event) => {
|
|
1026
|
+
focus.onFocusCapture(event);
|
|
1027
|
+
onFocusCapture?.(event);
|
|
1028
|
+
},
|
|
1029
|
+
initialFocus: !open || layer.isTopLayer ? resolveIqujiOverlayInitialFocus(initialFocusRef) : false,
|
|
1030
|
+
finalFocus,
|
|
1031
|
+
className: classNames("iquji-dialog iquji-floating-popup", surface === "glass" && "iquji-dialog--glass", layout === "compact" && "iquji-dialog--compact", className),
|
|
1032
|
+
"data-iquji-overlay-surface": "",
|
|
1033
|
+
"data-mandatory": mandatory || undefined,
|
|
1034
|
+
style: {
|
|
1035
|
+
width: width ?? widths[size],
|
|
1036
|
+
zIndex: layer.surface,
|
|
1037
|
+
...style
|
|
1038
|
+
},
|
|
1039
|
+
children: /* @__PURE__ */ jsx6(IqujiOverlayScopeProvider, {
|
|
1040
|
+
container,
|
|
1041
|
+
children: /* @__PURE__ */ jsxs4("div", {
|
|
1042
|
+
className: "iquji-dialog__surface",
|
|
1043
|
+
children: [
|
|
1044
|
+
(title || description || heading || headerActions) && /* @__PURE__ */ jsxs4("header", {
|
|
1045
|
+
className: "iquji-dialog__header",
|
|
1046
|
+
children: [
|
|
1047
|
+
/* @__PURE__ */ jsxs4("div", {
|
|
1048
|
+
className: "iquji-dialog__heading",
|
|
1049
|
+
children: [
|
|
1050
|
+
heading,
|
|
1051
|
+
title && /* @__PURE__ */ jsx6(Dialog.Title, {
|
|
1052
|
+
className: classNames("iquji-dialog__title", Boolean(heading) && "iquji-dialog__title--hidden"),
|
|
1053
|
+
children: title
|
|
1054
|
+
}),
|
|
1055
|
+
description && /* @__PURE__ */ jsx6(Dialog.Description, {
|
|
1056
|
+
className: "iquji-dialog__description",
|
|
1057
|
+
children: description
|
|
1058
|
+
})
|
|
1059
|
+
]
|
|
1060
|
+
}),
|
|
1061
|
+
/* @__PURE__ */ jsxs4("div", {
|
|
1062
|
+
className: "iquji-dialog__header-actions",
|
|
1063
|
+
children: [
|
|
1064
|
+
headerActions,
|
|
1065
|
+
!mandatory && /* @__PURE__ */ jsx6(Dialog.Close, {
|
|
1066
|
+
render: /* @__PURE__ */ jsx6(IconButton, {
|
|
1067
|
+
label: closeLabel ?? "",
|
|
1068
|
+
icon: /* @__PURE__ */ jsx6(IqujiIcon3, {
|
|
1069
|
+
name: "close"
|
|
1070
|
+
})
|
|
1071
|
+
})
|
|
1072
|
+
})
|
|
1073
|
+
]
|
|
1074
|
+
})
|
|
1075
|
+
]
|
|
1076
|
+
}),
|
|
1077
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1078
|
+
className: "iquji-dialog__body",
|
|
1079
|
+
children
|
|
1080
|
+
}),
|
|
1081
|
+
actions && /* @__PURE__ */ jsx6("footer", {
|
|
1082
|
+
className: "iquji-dialog__actions",
|
|
1083
|
+
children: actions
|
|
1084
|
+
})
|
|
1085
|
+
]
|
|
1086
|
+
})
|
|
1087
|
+
})
|
|
1088
|
+
})
|
|
1089
|
+
})
|
|
1090
|
+
]
|
|
1091
|
+
})
|
|
1092
|
+
})
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
// src/confirmation.tsx
|
|
1097
|
+
import { jsx as jsx7, jsxs as jsxs5, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
1098
|
+
function IqujiConfirmDialog({
|
|
1099
|
+
confirmLabel,
|
|
1100
|
+
cancelLabel,
|
|
1101
|
+
confirmLoading = false,
|
|
1102
|
+
confirmDisabled = false,
|
|
1103
|
+
additionalActions,
|
|
1104
|
+
onConfirm,
|
|
1105
|
+
onOpenChange,
|
|
1106
|
+
initialFocusRef,
|
|
1107
|
+
size,
|
|
1108
|
+
width,
|
|
1109
|
+
layout = "compact",
|
|
1110
|
+
...props
|
|
1111
|
+
}) {
|
|
1112
|
+
const cancel = useRef5(null);
|
|
1113
|
+
return /* @__PURE__ */ jsx7(IqujiDialog, {
|
|
1114
|
+
...props,
|
|
1115
|
+
initialFocusRef: initialFocusRef ?? cancel,
|
|
1116
|
+
size: size ?? "sm",
|
|
1117
|
+
width: width ?? (size === undefined ? "min(92vw, 420px)" : undefined),
|
|
1118
|
+
layout,
|
|
1119
|
+
mandatory: confirmLoading || props.mandatory,
|
|
1120
|
+
onOpenChange,
|
|
1121
|
+
actions: /* @__PURE__ */ jsxs5(Fragment3, {
|
|
1122
|
+
children: [
|
|
1123
|
+
additionalActions,
|
|
1124
|
+
/* @__PURE__ */ jsx7(IqujiButton, {
|
|
1125
|
+
variant: "secondary",
|
|
1126
|
+
ref: cancel,
|
|
1127
|
+
disabled: confirmLoading,
|
|
1128
|
+
onClick: () => onOpenChange?.(false),
|
|
1129
|
+
children: cancelLabel
|
|
1130
|
+
}),
|
|
1131
|
+
/* @__PURE__ */ jsx7(IqujiButton, {
|
|
1132
|
+
variant: "danger",
|
|
1133
|
+
disabled: confirmDisabled,
|
|
1134
|
+
loading: confirmLoading,
|
|
1135
|
+
onClick: onConfirm,
|
|
1136
|
+
children: confirmLabel
|
|
1137
|
+
})
|
|
1138
|
+
]
|
|
1139
|
+
})
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
// src/data-table.tsx
|
|
1143
|
+
import {
|
|
1144
|
+
flexRender,
|
|
1145
|
+
getCoreRowModel,
|
|
1146
|
+
useReactTable
|
|
1147
|
+
} from "@tanstack/react-table";
|
|
1148
|
+
|
|
1149
|
+
// src/layout.tsx
|
|
1150
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1151
|
+
function IqujiPageHeader({
|
|
1152
|
+
actions,
|
|
1153
|
+
className,
|
|
1154
|
+
description,
|
|
1155
|
+
eyebrow,
|
|
1156
|
+
title,
|
|
1157
|
+
titleId,
|
|
1158
|
+
...headerProps
|
|
1159
|
+
}) {
|
|
1160
|
+
return /* @__PURE__ */ jsxs6("header", {
|
|
1161
|
+
className: classNames("iquji-page-header", className),
|
|
1162
|
+
...headerProps,
|
|
1163
|
+
children: [
|
|
1164
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
1165
|
+
className: "iquji-page-header__copy",
|
|
1166
|
+
children: [
|
|
1167
|
+
eyebrow ? /* @__PURE__ */ jsx8("div", {
|
|
1168
|
+
className: "iquji-page-header__eyebrow",
|
|
1169
|
+
children: eyebrow
|
|
1170
|
+
}) : null,
|
|
1171
|
+
/* @__PURE__ */ jsx8("h1", {
|
|
1172
|
+
id: titleId,
|
|
1173
|
+
tabIndex: -1,
|
|
1174
|
+
children: title
|
|
1175
|
+
}),
|
|
1176
|
+
description ? /* @__PURE__ */ jsx8("div", {
|
|
1177
|
+
className: "iquji-page-header__description",
|
|
1178
|
+
children: description
|
|
1179
|
+
}) : null
|
|
1180
|
+
]
|
|
1181
|
+
}),
|
|
1182
|
+
actions ? /* @__PURE__ */ jsx8("div", {
|
|
1183
|
+
className: "iquji-page-header__actions",
|
|
1184
|
+
children: actions
|
|
1185
|
+
}) : null
|
|
1186
|
+
]
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
function IqujiTableFrame({
|
|
1190
|
+
busy = false,
|
|
1191
|
+
children,
|
|
1192
|
+
className,
|
|
1193
|
+
label,
|
|
1194
|
+
toolbar,
|
|
1195
|
+
...divProps
|
|
1196
|
+
}) {
|
|
1197
|
+
return /* @__PURE__ */ jsxs6("div", {
|
|
1198
|
+
"aria-busy": busy,
|
|
1199
|
+
className: classNames("iquji-table-frame", className),
|
|
1200
|
+
...divProps,
|
|
1201
|
+
children: [
|
|
1202
|
+
toolbar ? /* @__PURE__ */ jsx8("div", {
|
|
1203
|
+
className: "iquji-table-frame__toolbar",
|
|
1204
|
+
children: toolbar
|
|
1205
|
+
}) : null,
|
|
1206
|
+
/* @__PURE__ */ jsx8("section", {
|
|
1207
|
+
"aria-label": label,
|
|
1208
|
+
className: "iquji-table-frame__scroller",
|
|
1209
|
+
tabIndex: 0,
|
|
1210
|
+
children
|
|
1211
|
+
})
|
|
1212
|
+
]
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
// src/data-table.tsx
|
|
1217
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1218
|
+
function IqujiDataTable({
|
|
1219
|
+
busy = false,
|
|
1220
|
+
columns,
|
|
1221
|
+
data,
|
|
1222
|
+
emptyBody = "当前筛选没有结果。",
|
|
1223
|
+
emptyTitle = "暂无数据",
|
|
1224
|
+
label,
|
|
1225
|
+
toolbar,
|
|
1226
|
+
onRowClick,
|
|
1227
|
+
rowKey,
|
|
1228
|
+
className
|
|
1229
|
+
}) {
|
|
1230
|
+
const table = useReactTable({
|
|
1231
|
+
columns,
|
|
1232
|
+
data,
|
|
1233
|
+
getCoreRowModel: getCoreRowModel(),
|
|
1234
|
+
...rowKey ? { getRowId: (row) => rowKey(row) } : {}
|
|
1235
|
+
});
|
|
1236
|
+
if (data.length === 0) {
|
|
1237
|
+
return /* @__PURE__ */ jsx9(IqujiEmptyState, {
|
|
1238
|
+
body: emptyBody,
|
|
1239
|
+
title: emptyTitle
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
return /* @__PURE__ */ jsx9(IqujiTableFrame, {
|
|
1243
|
+
busy,
|
|
1244
|
+
className,
|
|
1245
|
+
label,
|
|
1246
|
+
toolbar,
|
|
1247
|
+
children: /* @__PURE__ */ jsxs7("table", {
|
|
1248
|
+
className: "iquji-data-table",
|
|
1249
|
+
children: [
|
|
1250
|
+
/* @__PURE__ */ jsx9("thead", {
|
|
1251
|
+
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx9("tr", {
|
|
1252
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx9("th", {
|
|
1253
|
+
scope: "col",
|
|
1254
|
+
children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())
|
|
1255
|
+
}, header.id))
|
|
1256
|
+
}, headerGroup.id))
|
|
1257
|
+
}),
|
|
1258
|
+
/* @__PURE__ */ jsx9("tbody", {
|
|
1259
|
+
children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx9("tr", {
|
|
1260
|
+
"data-clickable": onRowClick ? "true" : undefined,
|
|
1261
|
+
onClick: onRowClick ? () => onRowClick(row.original) : undefined,
|
|
1262
|
+
onKeyDown: onRowClick ? (event) => {
|
|
1263
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1264
|
+
event.preventDefault();
|
|
1265
|
+
onRowClick(row.original);
|
|
1266
|
+
}
|
|
1267
|
+
} : undefined,
|
|
1268
|
+
tabIndex: onRowClick ? 0 : undefined,
|
|
1269
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx9("td", {
|
|
1270
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
1271
|
+
}, cell.id))
|
|
1272
|
+
}, row.id))
|
|
1273
|
+
})
|
|
1274
|
+
]
|
|
1275
|
+
})
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
// src/date-picker.tsx
|
|
1279
|
+
import { Popover as BasePopover2 } from "@base-ui/react/popover";
|
|
1280
|
+
import { IqujiIcon as IqujiIcon4 } from "@iquji-web/web-icons";
|
|
1281
|
+
import {
|
|
1282
|
+
forwardRef,
|
|
1283
|
+
useCallback as useCallback5,
|
|
1284
|
+
useId as useId2,
|
|
1285
|
+
useState as useState7
|
|
1286
|
+
} from "react";
|
|
1287
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1288
|
+
var IqujiDatePicker = forwardRef(function IqujiDatePicker2({
|
|
1289
|
+
"aria-invalid": ariaInvalid,
|
|
1290
|
+
allowClear = true,
|
|
1291
|
+
className,
|
|
1292
|
+
compact = false,
|
|
1293
|
+
defaultValue,
|
|
1294
|
+
disabled = false,
|
|
1295
|
+
disabledDate,
|
|
1296
|
+
iconStart,
|
|
1297
|
+
id,
|
|
1298
|
+
invalid = false,
|
|
1299
|
+
locale = "zh-CN",
|
|
1300
|
+
max,
|
|
1301
|
+
min,
|
|
1302
|
+
name,
|
|
1303
|
+
onChange,
|
|
1304
|
+
placeholder = "请选择日期",
|
|
1305
|
+
value,
|
|
1306
|
+
...triggerProps
|
|
1307
|
+
}, ref) {
|
|
1308
|
+
const generatedId = useId2();
|
|
1309
|
+
const triggerId = id ?? `${generatedId}-datepicker`;
|
|
1310
|
+
const overlayContainer = useIqujiOverlayContainer();
|
|
1311
|
+
const [open, setOpen] = useState7(false);
|
|
1312
|
+
const [internalValue, setInternalValue] = useState7(defaultValue ?? null);
|
|
1313
|
+
const isControlled = value !== undefined;
|
|
1314
|
+
const currentValue = isControlled ? value : internalValue;
|
|
1315
|
+
const actualInvalid = invalid || ariaInvalid === true || ariaInvalid === "true";
|
|
1316
|
+
const handleDateChange = useCallback5((nextDate) => {
|
|
1317
|
+
if (!isControlled) {
|
|
1318
|
+
setInternalValue(nextDate);
|
|
1319
|
+
}
|
|
1320
|
+
onChange?.(nextDate);
|
|
1321
|
+
setOpen(false);
|
|
1322
|
+
}, [isControlled, onChange]);
|
|
1323
|
+
const handleClear = useCallback5((event) => {
|
|
1324
|
+
event?.stopPropagation();
|
|
1325
|
+
event?.preventDefault();
|
|
1326
|
+
if (!isControlled) {
|
|
1327
|
+
setInternalValue(null);
|
|
1328
|
+
}
|
|
1329
|
+
onChange?.(null);
|
|
1330
|
+
setOpen(false);
|
|
1331
|
+
}, [isControlled, onChange]);
|
|
1332
|
+
const names = classNames("iquji-date-picker", compact ? "iquji-date-picker--compact" : undefined, actualInvalid ? "is-invalid" : undefined, currentValue ? "has-value" : "is-empty", allowClear && Boolean(currentValue) && !disabled ? "has-clear" : undefined, className);
|
|
1333
|
+
return /* @__PURE__ */ jsxs8(BasePopover2.Root, {
|
|
1334
|
+
onOpenChange: (nextOpen) => {
|
|
1335
|
+
if (!disabled) {
|
|
1336
|
+
setOpen(nextOpen);
|
|
1337
|
+
}
|
|
1338
|
+
},
|
|
1339
|
+
open: open && !disabled,
|
|
1340
|
+
children: [
|
|
1341
|
+
/* @__PURE__ */ jsxs8("div", {
|
|
1342
|
+
className: classNames("iquji-date-picker__control", compact ? "iquji-date-picker__control--compact" : undefined),
|
|
1343
|
+
children: [
|
|
1344
|
+
/* @__PURE__ */ jsxs8(BasePopover2.Trigger, {
|
|
1345
|
+
...triggerProps,
|
|
1346
|
+
"aria-haspopup": "dialog",
|
|
1347
|
+
"aria-invalid": actualInvalid || undefined,
|
|
1348
|
+
"aria-label": triggerProps["aria-label"] ?? placeholder,
|
|
1349
|
+
className: names,
|
|
1350
|
+
"data-disabled": disabled || undefined,
|
|
1351
|
+
"data-invalid": actualInvalid || undefined,
|
|
1352
|
+
disabled,
|
|
1353
|
+
id: triggerId,
|
|
1354
|
+
name,
|
|
1355
|
+
ref,
|
|
1356
|
+
type: "button",
|
|
1357
|
+
children: [
|
|
1358
|
+
iconStart ? /* @__PURE__ */ jsx10("span", {
|
|
1359
|
+
"aria-hidden": "true",
|
|
1360
|
+
className: "iquji-date-picker__start-icon",
|
|
1361
|
+
children: iconStart
|
|
1362
|
+
}) : null,
|
|
1363
|
+
/* @__PURE__ */ jsx10("span", {
|
|
1364
|
+
className: classNames("iquji-date-picker__value", !currentValue ? "iquji-date-picker__placeholder" : undefined),
|
|
1365
|
+
children: currentValue || placeholder
|
|
1366
|
+
}),
|
|
1367
|
+
/* @__PURE__ */ jsx10("span", {
|
|
1368
|
+
className: "iquji-date-picker__actions",
|
|
1369
|
+
children: /* @__PURE__ */ jsx10("span", {
|
|
1370
|
+
"aria-hidden": "true",
|
|
1371
|
+
className: "iquji-date-picker__indicator",
|
|
1372
|
+
children: /* @__PURE__ */ jsx10(IqujiIcon4, {
|
|
1373
|
+
decorative: true,
|
|
1374
|
+
name: "calendar",
|
|
1375
|
+
size: 15
|
|
1376
|
+
})
|
|
1377
|
+
})
|
|
1378
|
+
})
|
|
1379
|
+
]
|
|
1380
|
+
}),
|
|
1381
|
+
allowClear && Boolean(currentValue) && !disabled ? /* @__PURE__ */ jsx10("button", {
|
|
1382
|
+
"aria-label": "清除日期",
|
|
1383
|
+
className: "iquji-date-picker__clear-btn",
|
|
1384
|
+
onClick: handleClear,
|
|
1385
|
+
type: "button",
|
|
1386
|
+
children: /* @__PURE__ */ jsx10(IqujiIcon4, {
|
|
1387
|
+
decorative: true,
|
|
1388
|
+
name: "close",
|
|
1389
|
+
size: 14
|
|
1390
|
+
})
|
|
1391
|
+
}) : null
|
|
1392
|
+
]
|
|
1393
|
+
}),
|
|
1394
|
+
/* @__PURE__ */ jsx10(BasePopover2.Portal, {
|
|
1395
|
+
container: overlayContainer,
|
|
1396
|
+
children: /* @__PURE__ */ jsx10(BasePopover2.Positioner, {
|
|
1397
|
+
align: "start",
|
|
1398
|
+
className: "iquji-date-picker__positioner",
|
|
1399
|
+
sideOffset: 4,
|
|
1400
|
+
children: /* @__PURE__ */ jsx10(BasePopover2.Popup, {
|
|
1401
|
+
className: "iquji-date-picker__popup",
|
|
1402
|
+
"data-iquji-overlay": "date-picker",
|
|
1403
|
+
children: /* @__PURE__ */ jsx10(IqujiCalendar, {
|
|
1404
|
+
clearable: allowClear,
|
|
1405
|
+
defaultValue,
|
|
1406
|
+
disabledDate,
|
|
1407
|
+
locale,
|
|
1408
|
+
max,
|
|
1409
|
+
min,
|
|
1410
|
+
onChange: handleDateChange,
|
|
1411
|
+
onClear: handleClear,
|
|
1412
|
+
value: currentValue
|
|
1413
|
+
})
|
|
1414
|
+
})
|
|
1415
|
+
})
|
|
1416
|
+
})
|
|
1417
|
+
]
|
|
1418
|
+
});
|
|
1419
|
+
});
|
|
1420
|
+
IqujiDatePicker.displayName = "IqujiDatePicker";
|
|
1421
|
+
// src/desktop-account.tsx
|
|
1422
|
+
import { IqujiIcon as IqujiIcon5 } from "@iquji-web/web-icons";
|
|
1423
|
+
import { useId as useId3, useState as useState8 } from "react";
|
|
1424
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1425
|
+
function AccountAvatar({
|
|
1426
|
+
avatar,
|
|
1427
|
+
avatarLabel,
|
|
1428
|
+
avatarTone = "accent",
|
|
1429
|
+
size
|
|
1430
|
+
}) {
|
|
1431
|
+
return /* @__PURE__ */ jsx11("span", {
|
|
1432
|
+
className: size === "sm" ? "iquji-desktop-account__trigger-avatar" : "iquji-desktop-account-card__avatar",
|
|
1433
|
+
"data-tone": avatarTone,
|
|
1434
|
+
children: avatar ?? avatarLabel ?? (size === "sm" ? /* @__PURE__ */ jsx11(IqujiIcon5, {
|
|
1435
|
+
decorative: true,
|
|
1436
|
+
name: "user",
|
|
1437
|
+
size: 16
|
|
1438
|
+
}) : /* @__PURE__ */ jsx11(IqujiIcon5, {
|
|
1439
|
+
decorative: true,
|
|
1440
|
+
name: "user",
|
|
1441
|
+
size: 20
|
|
1442
|
+
}))
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
function IqujiDesktopAccountCard({
|
|
1446
|
+
name,
|
|
1447
|
+
secondary,
|
|
1448
|
+
badge,
|
|
1449
|
+
avatar,
|
|
1450
|
+
avatarLabel,
|
|
1451
|
+
avatarTone,
|
|
1452
|
+
usage,
|
|
1453
|
+
sections,
|
|
1454
|
+
footer,
|
|
1455
|
+
onItemSelect,
|
|
1456
|
+
className
|
|
1457
|
+
}) {
|
|
1458
|
+
const usageLabelId = useId3();
|
|
1459
|
+
const usageValue = usage && Number.isFinite(usage.value) ? Math.min(Math.max(usage.value, 0), 100) : 0;
|
|
1460
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
1461
|
+
className: classNames("iquji-desktop-account-card", className),
|
|
1462
|
+
children: [
|
|
1463
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
1464
|
+
className: "iquji-desktop-account-card__header",
|
|
1465
|
+
children: [
|
|
1466
|
+
/* @__PURE__ */ jsx11(AccountAvatar, {
|
|
1467
|
+
avatar,
|
|
1468
|
+
avatarLabel,
|
|
1469
|
+
avatarTone,
|
|
1470
|
+
size: "md"
|
|
1471
|
+
}),
|
|
1472
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
1473
|
+
className: "iquji-desktop-account-card__identity",
|
|
1474
|
+
children: [
|
|
1475
|
+
/* @__PURE__ */ jsx11("span", {
|
|
1476
|
+
className: "iquji-desktop-account-card__name",
|
|
1477
|
+
children: name
|
|
1478
|
+
}),
|
|
1479
|
+
secondary ? /* @__PURE__ */ jsx11("span", {
|
|
1480
|
+
className: "iquji-desktop-account-card__secondary",
|
|
1481
|
+
children: secondary
|
|
1482
|
+
}) : null,
|
|
1483
|
+
badge ? /* @__PURE__ */ jsx11("span", {
|
|
1484
|
+
className: "iquji-desktop-account-card__badge",
|
|
1485
|
+
children: badge
|
|
1486
|
+
}) : null
|
|
1487
|
+
]
|
|
1488
|
+
})
|
|
1489
|
+
]
|
|
1490
|
+
}),
|
|
1491
|
+
usage ? /* @__PURE__ */ jsxs9("div", {
|
|
1492
|
+
className: "iquji-desktop-account-card__usage",
|
|
1493
|
+
children: [
|
|
1494
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
1495
|
+
className: "iquji-desktop-account-card__usage-copy",
|
|
1496
|
+
children: [
|
|
1497
|
+
/* @__PURE__ */ jsx11("span", {
|
|
1498
|
+
id: usageLabelId,
|
|
1499
|
+
children: usage.label
|
|
1500
|
+
}),
|
|
1501
|
+
usage.valueText ? /* @__PURE__ */ jsx11("span", {
|
|
1502
|
+
children: usage.valueText
|
|
1503
|
+
}) : null
|
|
1504
|
+
]
|
|
1505
|
+
}),
|
|
1506
|
+
/* @__PURE__ */ jsx11("div", {
|
|
1507
|
+
"aria-labelledby": usageLabelId,
|
|
1508
|
+
"aria-valuemax": 100,
|
|
1509
|
+
"aria-valuemin": 0,
|
|
1510
|
+
"aria-valuenow": usageValue,
|
|
1511
|
+
className: "iquji-desktop-account-card__meter",
|
|
1512
|
+
"data-tone": usage.tone ?? "accent",
|
|
1513
|
+
role: "progressbar",
|
|
1514
|
+
children: /* @__PURE__ */ jsx11("span", {
|
|
1515
|
+
className: "iquji-desktop-account-card__meter-fill",
|
|
1516
|
+
style: { width: `${usageValue}%` }
|
|
1517
|
+
})
|
|
1518
|
+
})
|
|
1519
|
+
]
|
|
1520
|
+
}) : null,
|
|
1521
|
+
/* @__PURE__ */ jsx11("div", {
|
|
1522
|
+
className: "iquji-desktop-account-card__sections",
|
|
1523
|
+
children: sections.map((section) => /* @__PURE__ */ jsx11("div", {
|
|
1524
|
+
className: "iquji-desktop-account-card__section",
|
|
1525
|
+
children: section.items.map((item) => /* @__PURE__ */ jsxs9("button", {
|
|
1526
|
+
"aria-keyshortcuts": item.keyshortcuts,
|
|
1527
|
+
className: "iquji-desktop-account-card__item",
|
|
1528
|
+
"data-tone": item.tone ?? "neutral",
|
|
1529
|
+
disabled: item.disabled,
|
|
1530
|
+
onClick: () => {
|
|
1531
|
+
item.onSelect?.();
|
|
1532
|
+
onItemSelect?.(item);
|
|
1533
|
+
},
|
|
1534
|
+
type: "button",
|
|
1535
|
+
children: [
|
|
1536
|
+
item.icon ? /* @__PURE__ */ jsx11("span", {
|
|
1537
|
+
"aria-hidden": "true",
|
|
1538
|
+
className: "iquji-desktop-account-card__item-icon",
|
|
1539
|
+
children: item.icon
|
|
1540
|
+
}) : null,
|
|
1541
|
+
/* @__PURE__ */ jsx11("span", {
|
|
1542
|
+
className: "iquji-desktop-account-card__item-label",
|
|
1543
|
+
children: item.label
|
|
1544
|
+
}),
|
|
1545
|
+
item.shortcut ? /* @__PURE__ */ jsx11("span", {
|
|
1546
|
+
"aria-hidden": "true",
|
|
1547
|
+
className: "iquji-desktop-account-card__item-shortcut",
|
|
1548
|
+
children: item.shortcut
|
|
1549
|
+
}) : null,
|
|
1550
|
+
item.trailing ? /* @__PURE__ */ jsx11("span", {
|
|
1551
|
+
"aria-hidden": "true",
|
|
1552
|
+
className: "iquji-desktop-account-card__item-trailing",
|
|
1553
|
+
children: item.trailing
|
|
1554
|
+
}) : null
|
|
1555
|
+
]
|
|
1556
|
+
}, item.key))
|
|
1557
|
+
}, section.key))
|
|
1558
|
+
}),
|
|
1559
|
+
footer ? /* @__PURE__ */ jsx11("div", {
|
|
1560
|
+
className: "iquji-desktop-account-card__footer",
|
|
1561
|
+
children: footer
|
|
1562
|
+
}) : null
|
|
1563
|
+
]
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
function IqujiDesktopAccount({
|
|
1567
|
+
card,
|
|
1568
|
+
trigger,
|
|
1569
|
+
triggerLabel,
|
|
1570
|
+
open,
|
|
1571
|
+
onOpenChange,
|
|
1572
|
+
closeOnSelect = true
|
|
1573
|
+
}) {
|
|
1574
|
+
const [internalOpen, setInternalOpen] = useState8(false);
|
|
1575
|
+
const actualOpen = open ?? internalOpen;
|
|
1576
|
+
const changeOpen = (next) => {
|
|
1577
|
+
if (open === undefined) {
|
|
1578
|
+
setInternalOpen(next);
|
|
1579
|
+
}
|
|
1580
|
+
onOpenChange?.(next);
|
|
1581
|
+
};
|
|
1582
|
+
const triggerElement = trigger ?? /* @__PURE__ */ jsx11("button", {
|
|
1583
|
+
"aria-label": triggerLabel,
|
|
1584
|
+
className: "iquji-desktop-account__trigger",
|
|
1585
|
+
type: "button",
|
|
1586
|
+
children: /* @__PURE__ */ jsx11(AccountAvatar, {
|
|
1587
|
+
avatar: card.avatar,
|
|
1588
|
+
avatarLabel: card.avatarLabel,
|
|
1589
|
+
avatarTone: card.avatarTone,
|
|
1590
|
+
size: "sm"
|
|
1591
|
+
})
|
|
1592
|
+
});
|
|
1593
|
+
return /* @__PURE__ */ jsx11(IqujiPopover, {
|
|
1594
|
+
align: "start",
|
|
1595
|
+
onOpenChange: changeOpen,
|
|
1596
|
+
open: actualOpen,
|
|
1597
|
+
side: "top",
|
|
1598
|
+
trigger: triggerElement,
|
|
1599
|
+
children: /* @__PURE__ */ jsx11(IqujiDesktopAccountCard, {
|
|
1600
|
+
...card,
|
|
1601
|
+
onItemSelect: (item) => {
|
|
1602
|
+
card.onItemSelect?.(item);
|
|
1603
|
+
if (closeOnSelect) {
|
|
1604
|
+
changeOpen(false);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
})
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
// src/tooltip.tsx
|
|
1611
|
+
import { cloneElement, useId as useId4 } from "react";
|
|
1612
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1613
|
+
function IqujiTooltip({
|
|
1614
|
+
children,
|
|
1615
|
+
className,
|
|
1616
|
+
content,
|
|
1617
|
+
placement = "top"
|
|
1618
|
+
}) {
|
|
1619
|
+
const tooltipId = useId4();
|
|
1620
|
+
const describedBy = [children.props["aria-describedby"], tooltipId].filter(Boolean).join(" ");
|
|
1621
|
+
return /* @__PURE__ */ jsxs10("span", {
|
|
1622
|
+
className: classNames("iquji-tooltip", className),
|
|
1623
|
+
children: [
|
|
1624
|
+
cloneElement(children, { "aria-describedby": describedBy }),
|
|
1625
|
+
/* @__PURE__ */ jsx12("span", {
|
|
1626
|
+
className: "iquji-tooltip__content",
|
|
1627
|
+
"data-placement": placement,
|
|
1628
|
+
id: tooltipId,
|
|
1629
|
+
role: "tooltip",
|
|
1630
|
+
children: content
|
|
1631
|
+
})
|
|
1632
|
+
]
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
// src/desktop-rail.tsx
|
|
1637
|
+
import { jsx as jsx13, jsxs as jsxs11, Fragment as Fragment4 } from "react/jsx-runtime";
|
|
1638
|
+
function IqujiDesktopRail({
|
|
1639
|
+
label,
|
|
1640
|
+
items,
|
|
1641
|
+
footer,
|
|
1642
|
+
showDivider = true,
|
|
1643
|
+
className
|
|
1644
|
+
}) {
|
|
1645
|
+
return /* @__PURE__ */ jsxs11("aside", {
|
|
1646
|
+
className: classNames("iquji-desktop-rail", className),
|
|
1647
|
+
"data-show-divider": showDivider ? "true" : "false",
|
|
1648
|
+
children: [
|
|
1649
|
+
/* @__PURE__ */ jsx13("nav", {
|
|
1650
|
+
"aria-label": label,
|
|
1651
|
+
className: "iquji-desktop-rail__nav",
|
|
1652
|
+
children: items.map((item) => {
|
|
1653
|
+
const content = /* @__PURE__ */ jsxs11(Fragment4, {
|
|
1654
|
+
children: [
|
|
1655
|
+
/* @__PURE__ */ jsx13("span", {
|
|
1656
|
+
"aria-hidden": "true",
|
|
1657
|
+
className: "iquji-desktop-rail__icon",
|
|
1658
|
+
children: item.icon
|
|
1659
|
+
}),
|
|
1660
|
+
item.badge ? /* @__PURE__ */ jsx13("span", {
|
|
1661
|
+
className: "iquji-desktop-rail__badge",
|
|
1662
|
+
children: item.badge
|
|
1663
|
+
}) : null
|
|
1664
|
+
]
|
|
1665
|
+
});
|
|
1666
|
+
const trigger = item.href && !item.disabled ? /* @__PURE__ */ jsx13("a", {
|
|
1667
|
+
"aria-current": item.active ? "page" : undefined,
|
|
1668
|
+
"aria-label": item.label,
|
|
1669
|
+
className: "iquji-desktop-rail__item",
|
|
1670
|
+
"data-active": item.active || undefined,
|
|
1671
|
+
href: item.href,
|
|
1672
|
+
onClick: item.onSelect,
|
|
1673
|
+
onFocus: item.onIntent,
|
|
1674
|
+
onMouseEnter: item.onIntent,
|
|
1675
|
+
children: content
|
|
1676
|
+
}) : /* @__PURE__ */ jsx13("button", {
|
|
1677
|
+
"aria-current": item.active ? "page" : undefined,
|
|
1678
|
+
"aria-label": item.label,
|
|
1679
|
+
className: "iquji-desktop-rail__item",
|
|
1680
|
+
"data-active": item.active || undefined,
|
|
1681
|
+
disabled: item.disabled,
|
|
1682
|
+
onFocus: item.onIntent,
|
|
1683
|
+
onMouseEnter: item.onIntent,
|
|
1684
|
+
onClick: item.disabled ? undefined : item.onSelect,
|
|
1685
|
+
type: "button",
|
|
1686
|
+
children: content
|
|
1687
|
+
});
|
|
1688
|
+
return /* @__PURE__ */ jsx13(IqujiTooltip, {
|
|
1689
|
+
content: item.tooltip ?? item.label,
|
|
1690
|
+
placement: "right",
|
|
1691
|
+
children: trigger
|
|
1692
|
+
}, item.id);
|
|
1693
|
+
})
|
|
1694
|
+
}),
|
|
1695
|
+
footer ? /* @__PURE__ */ jsx13("div", {
|
|
1696
|
+
className: "iquji-desktop-rail__footer",
|
|
1697
|
+
children: footer
|
|
1698
|
+
}) : null
|
|
1699
|
+
]
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
// src/desktop-shell.tsx
|
|
1703
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1704
|
+
function IqujiDesktopShell({
|
|
1705
|
+
children,
|
|
1706
|
+
className,
|
|
1707
|
+
contentId = "iquji-desktop-content",
|
|
1708
|
+
rail,
|
|
1709
|
+
skipLinkLabel,
|
|
1710
|
+
windowBar,
|
|
1711
|
+
...divProps
|
|
1712
|
+
}) {
|
|
1713
|
+
return /* @__PURE__ */ jsxs12("div", {
|
|
1714
|
+
...divProps,
|
|
1715
|
+
className: classNames("iquji-desktop-shell", className),
|
|
1716
|
+
"data-has-window-bar": windowBar ? "true" : "false",
|
|
1717
|
+
children: [
|
|
1718
|
+
skipLinkLabel ? /* @__PURE__ */ jsx14("a", {
|
|
1719
|
+
className: "iquji-skip-link",
|
|
1720
|
+
href: `#${contentId}`,
|
|
1721
|
+
children: skipLinkLabel
|
|
1722
|
+
}) : null,
|
|
1723
|
+
windowBar,
|
|
1724
|
+
/* @__PURE__ */ jsxs12("div", {
|
|
1725
|
+
className: "iquji-desktop-shell__body",
|
|
1726
|
+
"data-has-rail": rail ? "true" : "false",
|
|
1727
|
+
children: [
|
|
1728
|
+
rail,
|
|
1729
|
+
/* @__PURE__ */ jsx14("main", {
|
|
1730
|
+
className: "iquji-desktop-shell__content",
|
|
1731
|
+
id: contentId,
|
|
1732
|
+
tabIndex: -1,
|
|
1733
|
+
children
|
|
1734
|
+
})
|
|
1735
|
+
]
|
|
1736
|
+
})
|
|
1737
|
+
]
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
// src/desktop-tabs.tsx
|
|
1741
|
+
import { IqujiIcon as IqujiIcon6 } from "@iquji-web/web-icons";
|
|
1742
|
+
import {
|
|
1743
|
+
useRef as useRef6
|
|
1744
|
+
} from "react";
|
|
1745
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1746
|
+
function closeLabelOf(tab, closeTabLabel) {
|
|
1747
|
+
return tab.closeLabel ?? closeTabLabel?.(tab);
|
|
1748
|
+
}
|
|
1749
|
+
function IqujiDesktopTabStrip({
|
|
1750
|
+
tabs,
|
|
1751
|
+
activeTabId,
|
|
1752
|
+
label,
|
|
1753
|
+
onActiveTabChange,
|
|
1754
|
+
onTabClose,
|
|
1755
|
+
onTabAdd,
|
|
1756
|
+
addTabLabel,
|
|
1757
|
+
closeTabLabel,
|
|
1758
|
+
tabActions,
|
|
1759
|
+
className
|
|
1760
|
+
}) {
|
|
1761
|
+
const tabRefs = useRef6(new Map);
|
|
1762
|
+
const enabledTabs = tabs.filter((tab) => !tab.disabled);
|
|
1763
|
+
const enabledIndexById = new Map(enabledTabs.map((tab, index) => [tab.id, index]));
|
|
1764
|
+
const activeIndex = enabledTabs.findIndex((tab) => tab.id === activeTabId);
|
|
1765
|
+
const rovingIndex = activeIndex >= 0 ? activeIndex : 0;
|
|
1766
|
+
const activate = (id) => {
|
|
1767
|
+
onActiveTabChange?.(id);
|
|
1768
|
+
tabRefs.current.get(id)?.focus();
|
|
1769
|
+
};
|
|
1770
|
+
const moveFocus = (event, direction) => {
|
|
1771
|
+
if (enabledTabs.length === 0)
|
|
1772
|
+
return;
|
|
1773
|
+
const current = Math.max(0, enabledTabs.findIndex((tab) => tab.id === activeTabId));
|
|
1774
|
+
const next = enabledTabs[(current + direction + enabledTabs.length) % enabledTabs.length];
|
|
1775
|
+
if (!next)
|
|
1776
|
+
return;
|
|
1777
|
+
event.preventDefault();
|
|
1778
|
+
activate(next.id);
|
|
1779
|
+
};
|
|
1780
|
+
const handleTabKeyDown = (event) => {
|
|
1781
|
+
if (event.key === "ArrowRight") {
|
|
1782
|
+
moveFocus(event, 1);
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
if (event.key === "ArrowLeft") {
|
|
1786
|
+
moveFocus(event, -1);
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
if (event.key === "Home") {
|
|
1790
|
+
const first = enabledTabs[0];
|
|
1791
|
+
if (first) {
|
|
1792
|
+
event.preventDefault();
|
|
1793
|
+
activate(first.id);
|
|
1794
|
+
}
|
|
1795
|
+
return;
|
|
1796
|
+
}
|
|
1797
|
+
if (event.key === "End") {
|
|
1798
|
+
const last = enabledTabs[enabledTabs.length - 1];
|
|
1799
|
+
if (last) {
|
|
1800
|
+
event.preventDefault();
|
|
1801
|
+
activate(last.id);
|
|
1802
|
+
}
|
|
1803
|
+
return;
|
|
1804
|
+
}
|
|
1805
|
+
if (event.key === "Delete" && activeTabId && onTabClose) {
|
|
1806
|
+
const active = tabs.find((tab) => tab.id === activeTabId);
|
|
1807
|
+
if (active && !active.disabled && closeLabelOf(active, closeTabLabel)) {
|
|
1808
|
+
event.preventDefault();
|
|
1809
|
+
onTabClose(activeTabId);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
return /* @__PURE__ */ jsxs13("div", {
|
|
1814
|
+
className: classNames("iquji-desktop-tabstrip", className),
|
|
1815
|
+
children: [
|
|
1816
|
+
tabs.length > 0 ? /* @__PURE__ */ jsx15("div", {
|
|
1817
|
+
"aria-label": label,
|
|
1818
|
+
className: "iquji-desktop-tabstrip__list",
|
|
1819
|
+
role: "tablist",
|
|
1820
|
+
children: tabs.map((tab) => {
|
|
1821
|
+
const active = tab.id === activeTabId;
|
|
1822
|
+
const closeLabel = closeLabelOf(tab, closeTabLabel);
|
|
1823
|
+
const canClose = Boolean(onTabClose && tab.closable !== false && closeLabel);
|
|
1824
|
+
return /* @__PURE__ */ jsxs13("div", {
|
|
1825
|
+
className: "iquji-desktop-tab",
|
|
1826
|
+
"data-active": active || undefined,
|
|
1827
|
+
role: "presentation",
|
|
1828
|
+
children: [
|
|
1829
|
+
/* @__PURE__ */ jsxs13("button", {
|
|
1830
|
+
"aria-selected": active,
|
|
1831
|
+
className: "iquji-desktop-tab__select",
|
|
1832
|
+
disabled: tab.disabled,
|
|
1833
|
+
onClick: () => onActiveTabChange?.(tab.id),
|
|
1834
|
+
onKeyDown: handleTabKeyDown,
|
|
1835
|
+
ref: (element) => {
|
|
1836
|
+
if (element) {
|
|
1837
|
+
tabRefs.current.set(tab.id, element);
|
|
1838
|
+
} else {
|
|
1839
|
+
tabRefs.current.delete(tab.id);
|
|
1840
|
+
}
|
|
1841
|
+
},
|
|
1842
|
+
role: "tab",
|
|
1843
|
+
tabIndex: tab.disabled ? -1 : enabledIndexById.get(tab.id) === rovingIndex ? 0 : -1,
|
|
1844
|
+
type: "button",
|
|
1845
|
+
children: [
|
|
1846
|
+
tab.icon ? /* @__PURE__ */ jsx15("span", {
|
|
1847
|
+
"aria-hidden": "true",
|
|
1848
|
+
className: "iquji-desktop-tab__icon",
|
|
1849
|
+
children: tab.icon
|
|
1850
|
+
}) : null,
|
|
1851
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1852
|
+
className: "iquji-desktop-tab__label",
|
|
1853
|
+
children: tab.label
|
|
1854
|
+
}),
|
|
1855
|
+
tab.dirty ? /* @__PURE__ */ jsx15("span", {
|
|
1856
|
+
"aria-hidden": "true",
|
|
1857
|
+
className: "iquji-desktop-tab__dirty"
|
|
1858
|
+
}) : null
|
|
1859
|
+
]
|
|
1860
|
+
}),
|
|
1861
|
+
canClose ? /* @__PURE__ */ jsx15(IconButton, {
|
|
1862
|
+
className: "iquji-desktop-tab__close",
|
|
1863
|
+
compact: true,
|
|
1864
|
+
icon: /* @__PURE__ */ jsx15(IqujiIcon6, {
|
|
1865
|
+
decorative: true,
|
|
1866
|
+
name: "close",
|
|
1867
|
+
size: 14
|
|
1868
|
+
}),
|
|
1869
|
+
label: closeLabel ?? "",
|
|
1870
|
+
onClick: () => onTabClose?.(tab.id),
|
|
1871
|
+
tabIndex: active ? 0 : -1
|
|
1872
|
+
}) : null
|
|
1873
|
+
]
|
|
1874
|
+
}, tab.id);
|
|
1875
|
+
})
|
|
1876
|
+
}) : /* @__PURE__ */ jsx15("div", {
|
|
1877
|
+
className: "iquji-desktop-tabstrip__list"
|
|
1878
|
+
}),
|
|
1879
|
+
onTabAdd && addTabLabel ? /* @__PURE__ */ jsx15(IconButton, {
|
|
1880
|
+
className: "iquji-desktop-tabstrip__add",
|
|
1881
|
+
compact: true,
|
|
1882
|
+
icon: /* @__PURE__ */ jsx15(IqujiIcon6, {
|
|
1883
|
+
decorative: true,
|
|
1884
|
+
name: "plus",
|
|
1885
|
+
size: 15
|
|
1886
|
+
}),
|
|
1887
|
+
label: addTabLabel,
|
|
1888
|
+
onClick: onTabAdd
|
|
1889
|
+
}) : null,
|
|
1890
|
+
tabActions ? /* @__PURE__ */ jsx15("div", {
|
|
1891
|
+
className: "iquji-desktop-tabstrip__actions",
|
|
1892
|
+
children: tabActions
|
|
1893
|
+
}) : null
|
|
1894
|
+
]
|
|
1895
|
+
});
|
|
1896
|
+
}
|
|
1897
|
+
// src/desktop-titlebar.tsx
|
|
1898
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1899
|
+
function lengthOf(value) {
|
|
1900
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
1901
|
+
}
|
|
1902
|
+
function hasLength(value) {
|
|
1903
|
+
return typeof value === "number" ? value > 0 : value.trim() !== "";
|
|
1904
|
+
}
|
|
1905
|
+
function IqujiDesktopTitleBar({
|
|
1906
|
+
actions,
|
|
1907
|
+
children,
|
|
1908
|
+
className,
|
|
1909
|
+
dragRegion = false,
|
|
1910
|
+
leading,
|
|
1911
|
+
style,
|
|
1912
|
+
windowControls,
|
|
1913
|
+
windowControlsPlacement = "start",
|
|
1914
|
+
windowControlsSpace = 0,
|
|
1915
|
+
...headerProps
|
|
1916
|
+
}) {
|
|
1917
|
+
const reserveSpace = typeof windowControlsSpace === "number" ? windowControlsSpace > 0 : hasLength(windowControlsSpace);
|
|
1918
|
+
const reservedStyle = reserveSpace ? windowControlsPlacement === "start" ? { paddingLeft: lengthOf(windowControlsSpace) } : { paddingRight: lengthOf(windowControlsSpace) } : undefined;
|
|
1919
|
+
return /* @__PURE__ */ jsxs14("header", {
|
|
1920
|
+
...headerProps,
|
|
1921
|
+
className: classNames("iquji-desktop-titlebar", className),
|
|
1922
|
+
"data-iquji-drag-region": dragRegion || undefined,
|
|
1923
|
+
style: { ...style, ...reservedStyle },
|
|
1924
|
+
children: [
|
|
1925
|
+
windowControlsPlacement === "start" && windowControls ? /* @__PURE__ */ jsx16("div", {
|
|
1926
|
+
className: "iquji-desktop-titlebar__window-controls",
|
|
1927
|
+
children: windowControls
|
|
1928
|
+
}) : null,
|
|
1929
|
+
leading ? /* @__PURE__ */ jsx16("div", {
|
|
1930
|
+
className: "iquji-desktop-titlebar__leading",
|
|
1931
|
+
children: leading
|
|
1932
|
+
}) : null,
|
|
1933
|
+
/* @__PURE__ */ jsx16("div", {
|
|
1934
|
+
className: "iquji-desktop-titlebar__center",
|
|
1935
|
+
children
|
|
1936
|
+
}),
|
|
1937
|
+
actions ? /* @__PURE__ */ jsx16("div", {
|
|
1938
|
+
className: "iquji-desktop-titlebar__actions",
|
|
1939
|
+
children: actions
|
|
1940
|
+
}) : null,
|
|
1941
|
+
windowControlsPlacement === "end" && windowControls ? /* @__PURE__ */ jsx16("div", {
|
|
1942
|
+
className: "iquji-desktop-titlebar__window-controls",
|
|
1943
|
+
children: windowControls
|
|
1944
|
+
}) : null
|
|
1945
|
+
]
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
// src/drawer.tsx
|
|
1949
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
1950
|
+
import { IqujiIcon as IqujiIcon7 } from "@iquji-web/web-icons";
|
|
1951
|
+
import {
|
|
1952
|
+
useId as useId5,
|
|
1953
|
+
useState as useState9
|
|
1954
|
+
} from "react";
|
|
1955
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1956
|
+
var widths2 = {
|
|
1957
|
+
sm: "min(92vw, 420px)",
|
|
1958
|
+
md: "min(92vw, 720px)",
|
|
1959
|
+
lg: "min(94vw, 960px)",
|
|
1960
|
+
xl: "min(96vw, 1180px)"
|
|
1961
|
+
};
|
|
1962
|
+
function widthOf(value) {
|
|
1963
|
+
return typeof value === "number" ? `${value}px` : widths2[value] ?? value;
|
|
1964
|
+
}
|
|
1965
|
+
function IqujiDrawer(props) {
|
|
1966
|
+
return /* @__PURE__ */ jsx17(IqujiOverlayBoundary, {
|
|
1967
|
+
children: /* @__PURE__ */ jsx17(DrawerContent, {
|
|
1968
|
+
...props
|
|
1969
|
+
})
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
function DrawerContent({
|
|
1973
|
+
open,
|
|
1974
|
+
onOpenChange,
|
|
1975
|
+
onCloseComplete,
|
|
1976
|
+
onEscape,
|
|
1977
|
+
initialFocusRef,
|
|
1978
|
+
title,
|
|
1979
|
+
description,
|
|
1980
|
+
closeLabel,
|
|
1981
|
+
headerMeta,
|
|
1982
|
+
headerToolbar,
|
|
1983
|
+
actions,
|
|
1984
|
+
actionBarLayout = "end",
|
|
1985
|
+
children,
|
|
1986
|
+
size = "md",
|
|
1987
|
+
width,
|
|
1988
|
+
surface = "panel",
|
|
1989
|
+
className,
|
|
1990
|
+
bodyClassName,
|
|
1991
|
+
destroyOnClose = false
|
|
1992
|
+
}) {
|
|
1993
|
+
const id = useId5();
|
|
1994
|
+
const [container, setContainer] = useState9(null);
|
|
1995
|
+
const presence = useIqujiOverlayPresence(open, onCloseComplete);
|
|
1996
|
+
const layer = useIqujiOverlayLayer(id, "drawer", presence.active, open, container);
|
|
1997
|
+
const focus = useIqujiOverlayModal(open, layer.isTopLayer);
|
|
1998
|
+
const finalFocus = useIqujiOverlayReturnFocus(open);
|
|
1999
|
+
useIqujiOverlayCompletion(presence, layer.registered, finalFocus);
|
|
2000
|
+
return /* @__PURE__ */ jsx17(IqujiOverlayAncestry, {
|
|
2001
|
+
id,
|
|
2002
|
+
children: /* @__PURE__ */ jsx17(Drawer.Root, {
|
|
2003
|
+
open,
|
|
2004
|
+
modal: focus.modal,
|
|
2005
|
+
swipeDirection: "right",
|
|
2006
|
+
onOpenChange: (next, details) => {
|
|
2007
|
+
if (!next && (!layer.isTopLayer || details.reason === "escape-key" && onEscape?.())) {
|
|
2008
|
+
details.cancel();
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2011
|
+
onOpenChange?.(next);
|
|
2012
|
+
},
|
|
2013
|
+
onOpenChangeComplete: (next) => {
|
|
2014
|
+
if (!next)
|
|
2015
|
+
restoreIqujiOverlayFocus(finalFocus);
|
|
2016
|
+
presence.complete(next);
|
|
2017
|
+
},
|
|
2018
|
+
children: /* @__PURE__ */ jsxs15(Drawer.Portal, {
|
|
2019
|
+
keepMounted: !destroyOnClose,
|
|
2020
|
+
container: typeof document === "undefined" ? undefined : document.body,
|
|
2021
|
+
children: [
|
|
2022
|
+
/* @__PURE__ */ jsx17(Drawer.Backdrop, {
|
|
2023
|
+
forceRender: true,
|
|
2024
|
+
className: "iquji-overlay-backdrop iquji-drawer-backdrop",
|
|
2025
|
+
style: { zIndex: layer.backdrop }
|
|
2026
|
+
}),
|
|
2027
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2028
|
+
ref: setContainer,
|
|
2029
|
+
className: "iquji-overlay-floating-layer",
|
|
2030
|
+
"data-iquji-overlay-portal": "",
|
|
2031
|
+
style: { zIndex: layer.floating }
|
|
2032
|
+
}),
|
|
2033
|
+
/* @__PURE__ */ jsx17(Drawer.Popup, {
|
|
2034
|
+
onFocusCapture: focus.onFocusCapture,
|
|
2035
|
+
initialFocus: !open || layer.isTopLayer ? resolveIqujiOverlayInitialFocus(initialFocusRef) : false,
|
|
2036
|
+
"data-iquji-overlay-surface": "",
|
|
2037
|
+
finalFocus,
|
|
2038
|
+
className: classNames("iquji-drawer", surface === "canvas" && "iquji-drawer--canvas", className),
|
|
2039
|
+
style: { width: widthOf(width ?? size), zIndex: layer.surface },
|
|
2040
|
+
children: /* @__PURE__ */ jsxs15(IqujiOverlayScopeProvider, {
|
|
2041
|
+
container,
|
|
2042
|
+
children: [
|
|
2043
|
+
(title || description || headerMeta) && /* @__PURE__ */ jsxs15("header", {
|
|
2044
|
+
className: "iquji-drawer__header",
|
|
2045
|
+
children: [
|
|
2046
|
+
/* @__PURE__ */ jsxs15("div", {
|
|
2047
|
+
className: "iquji-drawer__heading",
|
|
2048
|
+
children: [
|
|
2049
|
+
title && /* @__PURE__ */ jsx17(Drawer.Title, {
|
|
2050
|
+
className: "iquji-dialog__title",
|
|
2051
|
+
children: title
|
|
2052
|
+
}),
|
|
2053
|
+
description && /* @__PURE__ */ jsx17(Drawer.Description, {
|
|
2054
|
+
className: "iquji-dialog__description",
|
|
2055
|
+
children: description
|
|
2056
|
+
})
|
|
2057
|
+
]
|
|
2058
|
+
}),
|
|
2059
|
+
headerMeta && /* @__PURE__ */ jsx17("div", {
|
|
2060
|
+
className: "iquji-drawer__meta",
|
|
2061
|
+
children: headerMeta
|
|
2062
|
+
}),
|
|
2063
|
+
/* @__PURE__ */ jsx17(Drawer.Close, {
|
|
2064
|
+
render: /* @__PURE__ */ jsx17(IconButton, {
|
|
2065
|
+
label: closeLabel,
|
|
2066
|
+
icon: /* @__PURE__ */ jsx17(IqujiIcon7, {
|
|
2067
|
+
name: "close"
|
|
2068
|
+
})
|
|
2069
|
+
})
|
|
2070
|
+
})
|
|
2071
|
+
]
|
|
2072
|
+
}),
|
|
2073
|
+
headerToolbar && /* @__PURE__ */ jsx17("div", {
|
|
2074
|
+
className: "iquji-drawer__toolbar",
|
|
2075
|
+
children: headerToolbar
|
|
2076
|
+
}),
|
|
2077
|
+
/* @__PURE__ */ jsx17("div", {
|
|
2078
|
+
className: classNames("iquji-drawer__body", bodyClassName),
|
|
2079
|
+
children
|
|
2080
|
+
}),
|
|
2081
|
+
actions && /* @__PURE__ */ jsx17("footer", {
|
|
2082
|
+
className: "iquji-drawer__actions",
|
|
2083
|
+
children: /* @__PURE__ */ jsx17("div", {
|
|
2084
|
+
className: classNames("iquji-drawer__action-row", actionBarLayout === "full" && "iquji-drawer__action-row--full"),
|
|
2085
|
+
children: actions
|
|
2086
|
+
})
|
|
2087
|
+
})
|
|
2088
|
+
]
|
|
2089
|
+
})
|
|
2090
|
+
})
|
|
2091
|
+
]
|
|
2092
|
+
})
|
|
2093
|
+
})
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
// src/feedback.tsx
|
|
2097
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2098
|
+
function IqujiBadge({
|
|
2099
|
+
className,
|
|
2100
|
+
tone = "neutral",
|
|
2101
|
+
...spanProps
|
|
2102
|
+
}) {
|
|
2103
|
+
return /* @__PURE__ */ jsx18("span", {
|
|
2104
|
+
className: classNames("iquji-badge", className),
|
|
2105
|
+
"data-tone": tone,
|
|
2106
|
+
...spanProps
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
function IqujiAlert({
|
|
2110
|
+
children,
|
|
2111
|
+
className,
|
|
2112
|
+
role,
|
|
2113
|
+
title,
|
|
2114
|
+
tone = "info",
|
|
2115
|
+
...divProps
|
|
2116
|
+
}) {
|
|
2117
|
+
return /* @__PURE__ */ jsxs16("div", {
|
|
2118
|
+
className: classNames("iquji-alert", className),
|
|
2119
|
+
"data-tone": tone,
|
|
2120
|
+
role: role ?? (tone === "danger" ? "alert" : "status"),
|
|
2121
|
+
...divProps,
|
|
2122
|
+
children: [
|
|
2123
|
+
title ? /* @__PURE__ */ jsx18("div", {
|
|
2124
|
+
className: "iquji-alert__title",
|
|
2125
|
+
children: title
|
|
2126
|
+
}) : null,
|
|
2127
|
+
/* @__PURE__ */ jsx18("div", {
|
|
2128
|
+
className: "iquji-alert__body",
|
|
2129
|
+
children
|
|
2130
|
+
})
|
|
2131
|
+
]
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
function IqujiSkeleton({
|
|
2135
|
+
className,
|
|
2136
|
+
height,
|
|
2137
|
+
shape = "line",
|
|
2138
|
+
style,
|
|
2139
|
+
width,
|
|
2140
|
+
...spanProps
|
|
2141
|
+
}) {
|
|
2142
|
+
return /* @__PURE__ */ jsx18("span", {
|
|
2143
|
+
"aria-hidden": "true",
|
|
2144
|
+
className: classNames("iquji-skeleton", className),
|
|
2145
|
+
"data-shape": shape,
|
|
2146
|
+
style: { ...style, height, width },
|
|
2147
|
+
...spanProps
|
|
2148
|
+
});
|
|
2149
|
+
}
|
|
2150
|
+
function IqujiAsyncStateFrame({
|
|
2151
|
+
children,
|
|
2152
|
+
className,
|
|
2153
|
+
emptyFallback,
|
|
2154
|
+
errorFallback,
|
|
2155
|
+
loadingFallback,
|
|
2156
|
+
refreshLabel,
|
|
2157
|
+
state,
|
|
2158
|
+
...divProps
|
|
2159
|
+
}) {
|
|
2160
|
+
const content = state === "loading" ? loadingFallback : state === "empty" ? emptyFallback : state === "error" ? errorFallback : children;
|
|
2161
|
+
return /* @__PURE__ */ jsxs16("div", {
|
|
2162
|
+
"aria-busy": state === "loading" || state === "refreshing",
|
|
2163
|
+
className: classNames("iquji-async-state-frame", className),
|
|
2164
|
+
"data-state": state,
|
|
2165
|
+
...divProps,
|
|
2166
|
+
children: [
|
|
2167
|
+
content,
|
|
2168
|
+
state === "refreshing" && refreshLabel ? /* @__PURE__ */ jsx18("div", {
|
|
2169
|
+
className: "iquji-async-state-frame__progress",
|
|
2170
|
+
role: "status",
|
|
2171
|
+
children: /* @__PURE__ */ jsx18("span", {
|
|
2172
|
+
className: "iquji-visually-hidden",
|
|
2173
|
+
children: refreshLabel
|
|
2174
|
+
})
|
|
2175
|
+
}) : null,
|
|
2176
|
+
state === "refreshing" && !refreshLabel ? /* @__PURE__ */ jsx18("div", {
|
|
2177
|
+
"aria-hidden": "true",
|
|
2178
|
+
className: "iquji-async-state-frame__progress"
|
|
2179
|
+
}) : null
|
|
2180
|
+
]
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
// src/form-dialog.tsx
|
|
2184
|
+
import { IqujiIcon as IqujiIcon8 } from "@iquji-web/web-icons";
|
|
2185
|
+
|
|
2186
|
+
// src/form-dialog-resize.tsx
|
|
2187
|
+
import { Component, createRef } from "react";
|
|
2188
|
+
|
|
2189
|
+
class FormDialogResize extends Component {
|
|
2190
|
+
popup = createRef();
|
|
2191
|
+
animation = null;
|
|
2192
|
+
motion = null;
|
|
2193
|
+
componentDidMount() {
|
|
2194
|
+
this.motion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2195
|
+
this.motion.addEventListener("change", this.preferenceChanged);
|
|
2196
|
+
window.addEventListener("resize", this.stop);
|
|
2197
|
+
}
|
|
2198
|
+
getSnapshotBeforeUpdate(previous) {
|
|
2199
|
+
if (!previous.open || !this.props.open || previous.expanded === this.props.expanded)
|
|
2200
|
+
return null;
|
|
2201
|
+
const bounds = this.popup.current?.getBoundingClientRect();
|
|
2202
|
+
return bounds ? { width: bounds.width, height: bounds.height } : null;
|
|
2203
|
+
}
|
|
2204
|
+
componentDidUpdate(_previous, _state, before) {
|
|
2205
|
+
if (!this.props.open) {
|
|
2206
|
+
this.stop();
|
|
2207
|
+
return;
|
|
2208
|
+
}
|
|
2209
|
+
if (!before)
|
|
2210
|
+
return;
|
|
2211
|
+
this.stop();
|
|
2212
|
+
const popup = this.popup.current;
|
|
2213
|
+
if (!popup || this.motion?.matches || typeof popup.animate !== "function")
|
|
2214
|
+
return;
|
|
2215
|
+
const after = popup.getBoundingClientRect();
|
|
2216
|
+
if (before.width === after.width && before.height === after.height)
|
|
2217
|
+
return;
|
|
2218
|
+
const style = getComputedStyle(popup);
|
|
2219
|
+
const token = style.getPropertyValue("--iquji-motion-overlay").trim();
|
|
2220
|
+
const duration = Number.parseFloat(token) * (token.endsWith("ms") ? 1 : 1000);
|
|
2221
|
+
if (!Number.isFinite(duration) || duration <= 0)
|
|
2222
|
+
return;
|
|
2223
|
+
const animation = popup.animate([
|
|
2224
|
+
{
|
|
2225
|
+
width: `${before.width}px`,
|
|
2226
|
+
height: `${before.height}px`,
|
|
2227
|
+
maxHeight: `${before.height}px`
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
width: `${after.width}px`,
|
|
2231
|
+
height: `${after.height}px`,
|
|
2232
|
+
maxHeight: `${after.height}px`
|
|
2233
|
+
}
|
|
2234
|
+
], {
|
|
2235
|
+
duration,
|
|
2236
|
+
easing: style.getPropertyValue("--iquji-ease-standard").trim() || "ease"
|
|
2237
|
+
});
|
|
2238
|
+
this.animation = animation;
|
|
2239
|
+
animation.onfinish = () => {
|
|
2240
|
+
if (this.animation === animation)
|
|
2241
|
+
this.animation = null;
|
|
2242
|
+
};
|
|
2243
|
+
}
|
|
2244
|
+
componentWillUnmount() {
|
|
2245
|
+
this.stop();
|
|
2246
|
+
this.motion?.removeEventListener("change", this.preferenceChanged);
|
|
2247
|
+
window.removeEventListener("resize", this.stop);
|
|
2248
|
+
}
|
|
2249
|
+
stop = () => {
|
|
2250
|
+
const animation = this.animation;
|
|
2251
|
+
this.animation = null;
|
|
2252
|
+
animation?.cancel();
|
|
2253
|
+
};
|
|
2254
|
+
preferenceChanged = () => {
|
|
2255
|
+
if (this.motion?.matches)
|
|
2256
|
+
this.stop();
|
|
2257
|
+
};
|
|
2258
|
+
render() {
|
|
2259
|
+
return this.props.children(this.popup);
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
// src/form-dialog.tsx
|
|
2264
|
+
import { jsx as jsx19, jsxs as jsxs17, Fragment as Fragment5 } from "react/jsx-runtime";
|
|
2265
|
+
function IqujiFormDialog({
|
|
2266
|
+
expanded,
|
|
2267
|
+
onExpandedChange,
|
|
2268
|
+
expandLabel,
|
|
2269
|
+
collapseLabel,
|
|
2270
|
+
className,
|
|
2271
|
+
headerActions,
|
|
2272
|
+
width,
|
|
2273
|
+
...props
|
|
2274
|
+
}) {
|
|
2275
|
+
return /* @__PURE__ */ jsx19(FormDialogResize, {
|
|
2276
|
+
open: props.open,
|
|
2277
|
+
expanded,
|
|
2278
|
+
children: (popupRef) => /* @__PURE__ */ jsx19(IqujiDialog, {
|
|
2279
|
+
...props,
|
|
2280
|
+
popupRef,
|
|
2281
|
+
className: classNames("iquji-form-dialog", expanded && "iquji-form-dialog--expanded", className),
|
|
2282
|
+
width: expanded ? "min(calc(100vw - 48px), 1000px)" : width,
|
|
2283
|
+
headerActions: /* @__PURE__ */ jsxs17(Fragment5, {
|
|
2284
|
+
children: [
|
|
2285
|
+
headerActions,
|
|
2286
|
+
/* @__PURE__ */ jsx19(IconButton, {
|
|
2287
|
+
"aria-expanded": expanded,
|
|
2288
|
+
icon: /* @__PURE__ */ jsx19(IqujiIcon8, {
|
|
2289
|
+
decorative: true,
|
|
2290
|
+
name: expanded ? "minimize" : "maximize"
|
|
2291
|
+
}),
|
|
2292
|
+
label: expanded ? collapseLabel : expandLabel,
|
|
2293
|
+
onClick: () => onExpandedChange(!expanded)
|
|
2294
|
+
})
|
|
2295
|
+
]
|
|
2296
|
+
})
|
|
2297
|
+
})
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
// src/form-steps.tsx
|
|
2301
|
+
import { IqujiIcon as IqujiIcon9 } from "@iquji-web/web-icons";
|
|
2302
|
+
import { useId as useId6, useRef as useRef7 } from "react";
|
|
2303
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2304
|
+
function IqujiFormSteps({
|
|
2305
|
+
label,
|
|
2306
|
+
steps,
|
|
2307
|
+
value,
|
|
2308
|
+
onChange,
|
|
2309
|
+
className,
|
|
2310
|
+
completedLabel
|
|
2311
|
+
}) {
|
|
2312
|
+
const id = useId6();
|
|
2313
|
+
const refs = useRef7(new Map);
|
|
2314
|
+
const enabled = steps.filter((step) => !step.disabled);
|
|
2315
|
+
const selectedEnabled = enabled.some((step) => step.id === value);
|
|
2316
|
+
const moveFocus = (event, current) => {
|
|
2317
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229 || !enabled.length)
|
|
2318
|
+
return;
|
|
2319
|
+
const index = enabled.findIndex((step) => step.id === current);
|
|
2320
|
+
let next;
|
|
2321
|
+
if (event.key === "Home")
|
|
2322
|
+
next = enabled[0];
|
|
2323
|
+
else if (event.key === "End")
|
|
2324
|
+
next = enabled.at(-1);
|
|
2325
|
+
else if (event.key === "ArrowRight" || event.key === "ArrowDown")
|
|
2326
|
+
next = enabled[(index + 1) % enabled.length];
|
|
2327
|
+
else if (event.key === "ArrowLeft" || event.key === "ArrowUp")
|
|
2328
|
+
next = enabled[(index - 1 + enabled.length) % enabled.length];
|
|
2329
|
+
if (next) {
|
|
2330
|
+
event.preventDefault();
|
|
2331
|
+
refs.current.get(next.id)?.focus();
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
return /* @__PURE__ */ jsx20("nav", {
|
|
2335
|
+
"aria-label": label,
|
|
2336
|
+
className: classNames("iquji-form-steps", className),
|
|
2337
|
+
children: /* @__PURE__ */ jsx20("ol", {
|
|
2338
|
+
children: steps.map((step, index) => /* @__PURE__ */ jsx20("li", {
|
|
2339
|
+
children: /* @__PURE__ */ jsxs18("button", {
|
|
2340
|
+
"aria-current": step.id === value ? "step" : undefined,
|
|
2341
|
+
"aria-label": typeof step.label === "string" ? step.label : undefined,
|
|
2342
|
+
"aria-describedby": [
|
|
2343
|
+
step.description && `${id}-${step.id}-description`,
|
|
2344
|
+
step.completed && completedLabel && `${id}-${step.id}-completed`
|
|
2345
|
+
].filter(Boolean).join(" ") || undefined,
|
|
2346
|
+
"aria-labelledby": typeof step.label === "string" ? undefined : `${id}-${step.id}-label`,
|
|
2347
|
+
className: classNames("iquji-form-steps__step", step.completed && "iquji-form-steps__step--completed"),
|
|
2348
|
+
disabled: step.disabled,
|
|
2349
|
+
onClick: () => onChange(step.id),
|
|
2350
|
+
onKeyDown: (event) => moveFocus(event, step.id),
|
|
2351
|
+
ref: (element) => {
|
|
2352
|
+
if (element)
|
|
2353
|
+
refs.current.set(step.id, element);
|
|
2354
|
+
else
|
|
2355
|
+
refs.current.delete(step.id);
|
|
2356
|
+
},
|
|
2357
|
+
tabIndex: !step.disabled && (step.id === value || !selectedEnabled && step === enabled[0]) ? 0 : -1,
|
|
2358
|
+
type: "button",
|
|
2359
|
+
children: [
|
|
2360
|
+
/* @__PURE__ */ jsx20("span", {
|
|
2361
|
+
"aria-hidden": "true",
|
|
2362
|
+
className: "iquji-form-steps__marker",
|
|
2363
|
+
children: step.completed ? /* @__PURE__ */ jsx20(IqujiIcon9, {
|
|
2364
|
+
decorative: true,
|
|
2365
|
+
name: "check"
|
|
2366
|
+
}) : index + 1
|
|
2367
|
+
}),
|
|
2368
|
+
/* @__PURE__ */ jsxs18("span", {
|
|
2369
|
+
className: "iquji-form-steps__text",
|
|
2370
|
+
children: [
|
|
2371
|
+
/* @__PURE__ */ jsx20("span", {
|
|
2372
|
+
id: `${id}-${step.id}-label`,
|
|
2373
|
+
className: "iquji-form-steps__label",
|
|
2374
|
+
children: step.label
|
|
2375
|
+
}),
|
|
2376
|
+
step.description && /* @__PURE__ */ jsx20("span", {
|
|
2377
|
+
id: `${id}-${step.id}-description`,
|
|
2378
|
+
className: "iquji-form-steps__description",
|
|
2379
|
+
children: step.description
|
|
2380
|
+
}),
|
|
2381
|
+
step.completed && completedLabel && /* @__PURE__ */ jsx20("span", {
|
|
2382
|
+
id: `${id}-${step.id}-completed`,
|
|
2383
|
+
className: "iquji-form-steps__status",
|
|
2384
|
+
children: completedLabel
|
|
2385
|
+
})
|
|
2386
|
+
]
|
|
2387
|
+
})
|
|
2388
|
+
]
|
|
2389
|
+
})
|
|
2390
|
+
}, step.id))
|
|
2391
|
+
})
|
|
2392
|
+
});
|
|
2393
|
+
}
|
|
2394
|
+
// src/forms.tsx
|
|
2395
|
+
import { Select as BaseSelect } from "@base-ui/react/select";
|
|
2396
|
+
import { IqujiIcon as IqujiIcon10 } from "@iquji-web/web-icons";
|
|
2397
|
+
import {
|
|
2398
|
+
cloneElement as cloneElement2,
|
|
2399
|
+
forwardRef as forwardRef2,
|
|
2400
|
+
useId as useId7
|
|
2401
|
+
} from "react";
|
|
2402
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2403
|
+
function IqujiField({
|
|
2404
|
+
children,
|
|
2405
|
+
className,
|
|
2406
|
+
description,
|
|
2407
|
+
error,
|
|
2408
|
+
id,
|
|
2409
|
+
label,
|
|
2410
|
+
required = false
|
|
2411
|
+
}) {
|
|
2412
|
+
const generatedId = useId7();
|
|
2413
|
+
const controlId = children.props.id ?? id ?? `${generatedId}-control`;
|
|
2414
|
+
const descriptionId = description ? `${controlId}-description` : undefined;
|
|
2415
|
+
const errorId = error ? `${controlId}-error` : undefined;
|
|
2416
|
+
const actualRequired = required || children.props.required === true;
|
|
2417
|
+
const describedBy = [
|
|
2418
|
+
children.props["aria-describedby"],
|
|
2419
|
+
descriptionId,
|
|
2420
|
+
errorId
|
|
2421
|
+
].filter(Boolean).join(" ");
|
|
2422
|
+
const controlProps = {
|
|
2423
|
+
id: controlId,
|
|
2424
|
+
required: actualRequired
|
|
2425
|
+
};
|
|
2426
|
+
if (describedBy) {
|
|
2427
|
+
controlProps["aria-describedby"] = describedBy;
|
|
2428
|
+
}
|
|
2429
|
+
if (error) {
|
|
2430
|
+
controlProps["aria-invalid"] = true;
|
|
2431
|
+
}
|
|
2432
|
+
return /* @__PURE__ */ jsxs19("div", {
|
|
2433
|
+
className: classNames("iquji-field", className),
|
|
2434
|
+
children: [
|
|
2435
|
+
/* @__PURE__ */ jsxs19("label", {
|
|
2436
|
+
className: "iquji-field__label",
|
|
2437
|
+
htmlFor: controlId,
|
|
2438
|
+
children: [
|
|
2439
|
+
label,
|
|
2440
|
+
actualRequired ? /* @__PURE__ */ jsx21("span", {
|
|
2441
|
+
"aria-hidden": "true",
|
|
2442
|
+
children: "*"
|
|
2443
|
+
}) : null
|
|
2444
|
+
]
|
|
2445
|
+
}),
|
|
2446
|
+
cloneElement2(children, controlProps),
|
|
2447
|
+
description ? /* @__PURE__ */ jsx21("div", {
|
|
2448
|
+
className: "iquji-field__description",
|
|
2449
|
+
id: descriptionId,
|
|
2450
|
+
children: description
|
|
2451
|
+
}) : null,
|
|
2452
|
+
error ? /* @__PURE__ */ jsx21("div", {
|
|
2453
|
+
className: "iquji-field__error",
|
|
2454
|
+
id: errorId,
|
|
2455
|
+
role: "alert",
|
|
2456
|
+
children: error
|
|
2457
|
+
}) : null
|
|
2458
|
+
]
|
|
2459
|
+
});
|
|
2460
|
+
}
|
|
2461
|
+
var IqujiInput = forwardRef2(function IqujiInput2({ className, ...inputProps }, ref) {
|
|
2462
|
+
return /* @__PURE__ */ jsx21("input", {
|
|
2463
|
+
className: classNames("iquji-input", className),
|
|
2464
|
+
ref,
|
|
2465
|
+
...inputProps
|
|
2466
|
+
});
|
|
2467
|
+
});
|
|
2468
|
+
var IqujiTextarea = forwardRef2(function IqujiTextarea2({ className, ...textareaProps }, ref) {
|
|
2469
|
+
return /* @__PURE__ */ jsx21("textarea", {
|
|
2470
|
+
className: classNames("iquji-textarea", className),
|
|
2471
|
+
ref,
|
|
2472
|
+
...textareaProps
|
|
2473
|
+
});
|
|
2474
|
+
});
|
|
2475
|
+
function IqujiSelect({
|
|
2476
|
+
"aria-invalid": ariaInvalid,
|
|
2477
|
+
autoComplete,
|
|
2478
|
+
className,
|
|
2479
|
+
compact = false,
|
|
2480
|
+
defaultValue,
|
|
2481
|
+
disabled = false,
|
|
2482
|
+
groups,
|
|
2483
|
+
iconStart,
|
|
2484
|
+
id,
|
|
2485
|
+
invalid = false,
|
|
2486
|
+
name,
|
|
2487
|
+
onValueChange,
|
|
2488
|
+
options,
|
|
2489
|
+
placeholder,
|
|
2490
|
+
ref,
|
|
2491
|
+
required = false,
|
|
2492
|
+
triggerPresentation = "value",
|
|
2493
|
+
value,
|
|
2494
|
+
...triggerProps
|
|
2495
|
+
}) {
|
|
2496
|
+
const overlayContainer = useIqujiOverlayContainer();
|
|
2497
|
+
const allOptions = groups ? groups.flatMap((group) => group.options) : options;
|
|
2498
|
+
const renderOptions = (entries) => entries.map((option, index) => /* @__PURE__ */ jsxs19(BaseSelect.Item, {
|
|
2499
|
+
className: "iquji-select__item",
|
|
2500
|
+
disabled: option.disabled,
|
|
2501
|
+
value: option.value,
|
|
2502
|
+
children: [
|
|
2503
|
+
/* @__PURE__ */ jsx21(BaseSelect.ItemText, {
|
|
2504
|
+
className: "iquji-select__item-text",
|
|
2505
|
+
children: option.label
|
|
2506
|
+
}),
|
|
2507
|
+
/* @__PURE__ */ jsx21(BaseSelect.ItemIndicator, {
|
|
2508
|
+
className: "iquji-select__item-indicator",
|
|
2509
|
+
children: /* @__PURE__ */ jsx21(IqujiIcon10, {
|
|
2510
|
+
decorative: true,
|
|
2511
|
+
name: "check",
|
|
2512
|
+
size: 16
|
|
2513
|
+
})
|
|
2514
|
+
})
|
|
2515
|
+
]
|
|
2516
|
+
}, option.key ?? `${index}:${String(option.value)}`));
|
|
2517
|
+
const actualInvalid = invalid || ariaInvalid === true || ariaInvalid === "true";
|
|
2518
|
+
const names = classNames("iquji-select", compact ? "iquji-select--compact" : undefined, triggerPresentation === "icon-only" ? "iquji-select--icon-only" : undefined, className);
|
|
2519
|
+
const triggerTitle = triggerProps.title ?? (triggerPresentation === "icon-only" && typeof triggerProps["aria-label"] === "string" ? triggerProps["aria-label"] : undefined);
|
|
2520
|
+
const triggerAriaLabel = triggerProps["aria-label"] ?? (triggerPresentation === "icon-only" && typeof triggerProps.title === "string" ? triggerProps.title : undefined);
|
|
2521
|
+
return /* @__PURE__ */ jsxs19(BaseSelect.Root, {
|
|
2522
|
+
autoComplete,
|
|
2523
|
+
defaultValue,
|
|
2524
|
+
disabled,
|
|
2525
|
+
id,
|
|
2526
|
+
items: allOptions,
|
|
2527
|
+
name,
|
|
2528
|
+
onOpenChange: (_open, details) => {
|
|
2529
|
+
if (details.reason === "escape-key") {
|
|
2530
|
+
details.event.stopPropagation();
|
|
2531
|
+
}
|
|
2532
|
+
},
|
|
2533
|
+
onValueChange: (nextValue) => onValueChange?.(nextValue),
|
|
2534
|
+
required,
|
|
2535
|
+
value,
|
|
2536
|
+
children: [
|
|
2537
|
+
/* @__PURE__ */ jsxs19(BaseSelect.Trigger, {
|
|
2538
|
+
...triggerProps,
|
|
2539
|
+
"aria-label": triggerAriaLabel,
|
|
2540
|
+
"aria-invalid": actualInvalid || undefined,
|
|
2541
|
+
className: names,
|
|
2542
|
+
"data-invalid": actualInvalid || undefined,
|
|
2543
|
+
"data-trigger-presentation": triggerPresentation,
|
|
2544
|
+
title: triggerTitle,
|
|
2545
|
+
ref,
|
|
2546
|
+
children: [
|
|
2547
|
+
iconStart ? /* @__PURE__ */ jsx21("span", {
|
|
2548
|
+
"aria-hidden": "true",
|
|
2549
|
+
className: "iquji-select__start-icon",
|
|
2550
|
+
children: iconStart
|
|
2551
|
+
}) : null,
|
|
2552
|
+
/* @__PURE__ */ jsx21(BaseSelect.Value, {
|
|
2553
|
+
"aria-hidden": triggerPresentation === "icon-only" || undefined,
|
|
2554
|
+
className: "iquji-select__value",
|
|
2555
|
+
placeholder
|
|
2556
|
+
}),
|
|
2557
|
+
/* @__PURE__ */ jsx21(BaseSelect.Icon, {
|
|
2558
|
+
"aria-hidden": "true",
|
|
2559
|
+
className: "iquji-select__indicator",
|
|
2560
|
+
children: /* @__PURE__ */ jsx21(IqujiIcon10, {
|
|
2561
|
+
decorative: true,
|
|
2562
|
+
name: "chevron-down",
|
|
2563
|
+
size: 16
|
|
2564
|
+
})
|
|
2565
|
+
})
|
|
2566
|
+
]
|
|
2567
|
+
}),
|
|
2568
|
+
/* @__PURE__ */ jsx21(BaseSelect.Portal, {
|
|
2569
|
+
className: "iquji-select__portal",
|
|
2570
|
+
container: overlayContainer,
|
|
2571
|
+
children: /* @__PURE__ */ jsx21(BaseSelect.Positioner, {
|
|
2572
|
+
align: triggerPresentation === "icon-only" ? "end" : "start",
|
|
2573
|
+
alignItemWithTrigger: false,
|
|
2574
|
+
className: "iquji-select__positioner",
|
|
2575
|
+
sideOffset: 4,
|
|
2576
|
+
children: /* @__PURE__ */ jsxs19(BaseSelect.Popup, {
|
|
2577
|
+
className: "iquji-select__popup",
|
|
2578
|
+
"data-iquji-overlay": "select",
|
|
2579
|
+
finalFocus: true,
|
|
2580
|
+
children: [
|
|
2581
|
+
/* @__PURE__ */ jsx21(BaseSelect.ScrollUpArrow, {
|
|
2582
|
+
className: "iquji-select__scroll-arrow",
|
|
2583
|
+
children: /* @__PURE__ */ jsx21(IqujiIcon10, {
|
|
2584
|
+
decorative: true,
|
|
2585
|
+
name: "arrow-up",
|
|
2586
|
+
size: 15
|
|
2587
|
+
})
|
|
2588
|
+
}),
|
|
2589
|
+
/* @__PURE__ */ jsx21(BaseSelect.List, {
|
|
2590
|
+
className: "iquji-select__list",
|
|
2591
|
+
children: groups ? groups.map((group) => /* @__PURE__ */ jsxs19(BaseSelect.Group, {
|
|
2592
|
+
className: "iquji-select__group",
|
|
2593
|
+
children: [
|
|
2594
|
+
/* @__PURE__ */ jsx21(BaseSelect.GroupLabel, {
|
|
2595
|
+
className: "iquji-select__group-label",
|
|
2596
|
+
children: group.label
|
|
2597
|
+
}),
|
|
2598
|
+
renderOptions(group.options)
|
|
2599
|
+
]
|
|
2600
|
+
}, group.key)) : renderOptions(options)
|
|
2601
|
+
}),
|
|
2602
|
+
/* @__PURE__ */ jsx21(BaseSelect.ScrollDownArrow, {
|
|
2603
|
+
className: "iquji-select__scroll-arrow",
|
|
2604
|
+
children: /* @__PURE__ */ jsx21(IqujiIcon10, {
|
|
2605
|
+
decorative: true,
|
|
2606
|
+
name: "arrow-down",
|
|
2607
|
+
size: 15
|
|
2608
|
+
})
|
|
2609
|
+
})
|
|
2610
|
+
]
|
|
2611
|
+
})
|
|
2612
|
+
})
|
|
2613
|
+
})
|
|
2614
|
+
]
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
function IqujiChoice({
|
|
2618
|
+
"aria-describedby": ariaDescribedBy,
|
|
2619
|
+
className,
|
|
2620
|
+
description,
|
|
2621
|
+
label,
|
|
2622
|
+
type,
|
|
2623
|
+
...inputProps
|
|
2624
|
+
}) {
|
|
2625
|
+
const descriptionId = useId7();
|
|
2626
|
+
const describedBy = [ariaDescribedBy, description ? descriptionId : undefined].filter(Boolean).join(" ");
|
|
2627
|
+
return /* @__PURE__ */ jsxs19("label", {
|
|
2628
|
+
className: classNames("iquji-choice", className),
|
|
2629
|
+
children: [
|
|
2630
|
+
/* @__PURE__ */ jsx21("input", {
|
|
2631
|
+
"aria-describedby": describedBy || undefined,
|
|
2632
|
+
type,
|
|
2633
|
+
...inputProps
|
|
2634
|
+
}),
|
|
2635
|
+
/* @__PURE__ */ jsx21("span", {
|
|
2636
|
+
className: "iquji-choice__control",
|
|
2637
|
+
"aria-hidden": "true"
|
|
2638
|
+
}),
|
|
2639
|
+
/* @__PURE__ */ jsxs19("span", {
|
|
2640
|
+
className: "iquji-choice__content",
|
|
2641
|
+
children: [
|
|
2642
|
+
/* @__PURE__ */ jsx21("span", {
|
|
2643
|
+
className: "iquji-choice__label",
|
|
2644
|
+
children: label
|
|
2645
|
+
}),
|
|
2646
|
+
description ? /* @__PURE__ */ jsx21("span", {
|
|
2647
|
+
className: "iquji-choice__description",
|
|
2648
|
+
id: descriptionId,
|
|
2649
|
+
children: description
|
|
2650
|
+
}) : null
|
|
2651
|
+
]
|
|
2652
|
+
})
|
|
2653
|
+
]
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
function IqujiCheckbox(props) {
|
|
2657
|
+
return /* @__PURE__ */ jsx21(IqujiChoice, {
|
|
2658
|
+
type: "checkbox",
|
|
2659
|
+
...props
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2662
|
+
function IqujiRadio(props) {
|
|
2663
|
+
return /* @__PURE__ */ jsx21(IqujiChoice, {
|
|
2664
|
+
type: "radio",
|
|
2665
|
+
...props
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
function IqujiSwitch({ className, ...props }) {
|
|
2669
|
+
return /* @__PURE__ */ jsx21(IqujiChoice, {
|
|
2670
|
+
className: classNames("iquji-switch", className),
|
|
2671
|
+
role: "switch",
|
|
2672
|
+
type: "checkbox",
|
|
2673
|
+
...props
|
|
2674
|
+
});
|
|
2675
|
+
}
|
|
2676
|
+
function IqujiSegmentedControl({
|
|
2677
|
+
className,
|
|
2678
|
+
disabled = false,
|
|
2679
|
+
label,
|
|
2680
|
+
onChange,
|
|
2681
|
+
options,
|
|
2682
|
+
value
|
|
2683
|
+
}) {
|
|
2684
|
+
return /* @__PURE__ */ jsxs19("fieldset", {
|
|
2685
|
+
className: classNames("iquji-segmented", className),
|
|
2686
|
+
disabled,
|
|
2687
|
+
children: [
|
|
2688
|
+
/* @__PURE__ */ jsx21("legend", {
|
|
2689
|
+
className: "iquji-visually-hidden",
|
|
2690
|
+
children: label
|
|
2691
|
+
}),
|
|
2692
|
+
options.map((option) => /* @__PURE__ */ jsx21("button", {
|
|
2693
|
+
"aria-pressed": option.value === value,
|
|
2694
|
+
disabled: disabled || option.disabled,
|
|
2695
|
+
onClick: () => onChange(option.value),
|
|
2696
|
+
type: "button",
|
|
2697
|
+
children: option.label
|
|
2698
|
+
}, option.value))
|
|
2699
|
+
]
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2702
|
+
// src/multi-select.tsx
|
|
2703
|
+
import { useId as useId8, useMemo as useMemo4, useState as useState10 } from "react";
|
|
2704
|
+
import { IqujiIcon as IqujiIcon11 } from "@iquji-web/web-icons";
|
|
2705
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2706
|
+
function IqujiMultiSelect({
|
|
2707
|
+
className,
|
|
2708
|
+
clearLabel,
|
|
2709
|
+
clearOptionLabel,
|
|
2710
|
+
disabled = false,
|
|
2711
|
+
emptyLabel = "没有匹配项",
|
|
2712
|
+
label,
|
|
2713
|
+
onChange,
|
|
2714
|
+
options,
|
|
2715
|
+
placeholder = "请选择",
|
|
2716
|
+
searchable = false,
|
|
2717
|
+
searchLabel = "搜索选项",
|
|
2718
|
+
selectAllLabel,
|
|
2719
|
+
value,
|
|
2720
|
+
variant = "select"
|
|
2721
|
+
}) {
|
|
2722
|
+
const labelId = useId8();
|
|
2723
|
+
const [open, setOpen] = useState10(false);
|
|
2724
|
+
const [query, setQuery] = useState10("");
|
|
2725
|
+
const selected = useMemo4(() => new Set(value), [value]);
|
|
2726
|
+
const visible = useMemo4(() => {
|
|
2727
|
+
const keyword = query.trim().toLowerCase();
|
|
2728
|
+
if (!keyword)
|
|
2729
|
+
return options;
|
|
2730
|
+
return options.filter((option) => `${typeof option.label === "string" ? option.label : ""} ${option.value}`.toLowerCase().includes(keyword));
|
|
2731
|
+
}, [options, query]);
|
|
2732
|
+
const selectedOptions = options.filter((option) => selected.has(option.value));
|
|
2733
|
+
const toggle = (option, checked) => {
|
|
2734
|
+
if (option.disabled || disabled)
|
|
2735
|
+
return;
|
|
2736
|
+
const next = new Set(selected);
|
|
2737
|
+
if (checked)
|
|
2738
|
+
next.add(option.value);
|
|
2739
|
+
else
|
|
2740
|
+
next.delete(option.value);
|
|
2741
|
+
onChange(options.filter((item) => next.has(item.value)).map((item) => item.value));
|
|
2742
|
+
};
|
|
2743
|
+
const selectAll = () => {
|
|
2744
|
+
if (disabled)
|
|
2745
|
+
return;
|
|
2746
|
+
const next = new Set(selected);
|
|
2747
|
+
for (const option of options) {
|
|
2748
|
+
if (!option.disabled)
|
|
2749
|
+
next.add(option.value);
|
|
2750
|
+
}
|
|
2751
|
+
onChange(options.filter((item) => next.has(item.value)).map((item) => item.value));
|
|
2752
|
+
};
|
|
2753
|
+
const isSelectVariant = variant === "select";
|
|
2754
|
+
const isTagsVariant = variant === "tags";
|
|
2755
|
+
const isCheckboxVariant = variant === "checkbox";
|
|
2756
|
+
return /* @__PURE__ */ jsxs20("div", {
|
|
2757
|
+
className: classNames("iquji-multi-select", className),
|
|
2758
|
+
children: [
|
|
2759
|
+
/* @__PURE__ */ jsx22("span", {
|
|
2760
|
+
className: "iquji-multi-select__label",
|
|
2761
|
+
id: labelId,
|
|
2762
|
+
children: label
|
|
2763
|
+
}),
|
|
2764
|
+
/* @__PURE__ */ jsx22(IqujiPopover, {
|
|
2765
|
+
align: "start",
|
|
2766
|
+
onOpenChange: setOpen,
|
|
2767
|
+
open,
|
|
2768
|
+
sideOffset: 4,
|
|
2769
|
+
trigger: /* @__PURE__ */ jsxs20("button", {
|
|
2770
|
+
type: "button",
|
|
2771
|
+
"aria-expanded": open,
|
|
2772
|
+
"aria-haspopup": "listbox",
|
|
2773
|
+
"aria-labelledby": labelId,
|
|
2774
|
+
className: classNames("iquji-select", "iquji-multi-select__trigger", open && "iquji-multi-select__trigger--open", selectedOptions.length === 0 && "iquji-multi-select__trigger--empty"),
|
|
2775
|
+
disabled,
|
|
2776
|
+
children: [
|
|
2777
|
+
/* @__PURE__ */ jsx22("span", {
|
|
2778
|
+
className: "iquji-select__value iquji-multi-select__value",
|
|
2779
|
+
children: isTagsVariant ? selectedOptions.length > 0 ? /* @__PURE__ */ jsxs20("span", {
|
|
2780
|
+
className: "iquji-multi-select__tags",
|
|
2781
|
+
children: [
|
|
2782
|
+
selectedOptions.slice(0, 3).map((option) => /* @__PURE__ */ jsx22("span", {
|
|
2783
|
+
className: "iquji-multi-select__tag",
|
|
2784
|
+
children: option.label
|
|
2785
|
+
}, option.value)),
|
|
2786
|
+
selectedOptions.length > 3 ? /* @__PURE__ */ jsxs20("span", {
|
|
2787
|
+
className: "iquji-multi-select__tag iquji-multi-select__tag--count",
|
|
2788
|
+
children: [
|
|
2789
|
+
"+",
|
|
2790
|
+
selectedOptions.length - 3
|
|
2791
|
+
]
|
|
2792
|
+
}) : null
|
|
2793
|
+
]
|
|
2794
|
+
}) : /* @__PURE__ */ jsx22("span", {
|
|
2795
|
+
className: "iquji-multi-select__placeholder",
|
|
2796
|
+
children: placeholder
|
|
2797
|
+
}) : selectedOptions.length > 0 ? /* @__PURE__ */ jsx22("span", {
|
|
2798
|
+
className: "iquji-multi-select__text",
|
|
2799
|
+
children: selectedOptions.map((option) => option.label).join("、")
|
|
2800
|
+
}) : /* @__PURE__ */ jsx22("span", {
|
|
2801
|
+
className: "iquji-multi-select__placeholder",
|
|
2802
|
+
children: placeholder
|
|
2803
|
+
})
|
|
2804
|
+
}),
|
|
2805
|
+
/* @__PURE__ */ jsx22("span", {
|
|
2806
|
+
className: classNames("iquji-select__indicator", "iquji-multi-select__indicator", open && "iquji-multi-select__indicator--open"),
|
|
2807
|
+
"aria-hidden": "true",
|
|
2808
|
+
children: /* @__PURE__ */ jsx22(IqujiIcon11, {
|
|
2809
|
+
decorative: true,
|
|
2810
|
+
name: "chevron-down",
|
|
2811
|
+
size: 16
|
|
2812
|
+
})
|
|
2813
|
+
})
|
|
2814
|
+
]
|
|
2815
|
+
}),
|
|
2816
|
+
children: /* @__PURE__ */ jsxs20("div", {
|
|
2817
|
+
className: "iquji-multi-select__popup",
|
|
2818
|
+
children: [
|
|
2819
|
+
searchable ? /* @__PURE__ */ jsx22("div", {
|
|
2820
|
+
className: "iquji-multi-select__search",
|
|
2821
|
+
children: /* @__PURE__ */ jsx22(IqujiInput, {
|
|
2822
|
+
"aria-label": searchLabel,
|
|
2823
|
+
onChange: (event) => setQuery(event.currentTarget.value),
|
|
2824
|
+
placeholder: searchLabel,
|
|
2825
|
+
value: query
|
|
2826
|
+
})
|
|
2827
|
+
}) : null,
|
|
2828
|
+
/* @__PURE__ */ jsxs20("div", {
|
|
2829
|
+
"aria-label": label,
|
|
2830
|
+
className: "iquji-select__list iquji-multi-select__options",
|
|
2831
|
+
role: "listbox",
|
|
2832
|
+
"aria-multiselectable": "true",
|
|
2833
|
+
children: [
|
|
2834
|
+
clearOptionLabel ? /* @__PURE__ */ jsxs20("div", {
|
|
2835
|
+
role: "option",
|
|
2836
|
+
"aria-selected": selected.size === 0,
|
|
2837
|
+
className: classNames("iquji-select__item", "iquji-multi-select__item", selected.size === 0 && "iquji-select__item--selected iquji-multi-select__item--selected"),
|
|
2838
|
+
onClick: () => {
|
|
2839
|
+
if (!disabled)
|
|
2840
|
+
onChange([]);
|
|
2841
|
+
},
|
|
2842
|
+
children: [
|
|
2843
|
+
isCheckboxVariant ? /* @__PURE__ */ jsx22("span", {
|
|
2844
|
+
className: classNames("iquji-multi-select__checkbox", selected.size === 0 && "iquji-multi-select__checkbox--checked"),
|
|
2845
|
+
"aria-hidden": "true",
|
|
2846
|
+
children: selected.size === 0 ? /* @__PURE__ */ jsx22(IqujiIcon11, {
|
|
2847
|
+
decorative: true,
|
|
2848
|
+
name: "check",
|
|
2849
|
+
size: 11,
|
|
2850
|
+
strokeWidth: 2.4
|
|
2851
|
+
}) : null
|
|
2852
|
+
}) : null,
|
|
2853
|
+
/* @__PURE__ */ jsx22("span", {
|
|
2854
|
+
className: "iquji-select__item-text iquji-multi-select__item-text",
|
|
2855
|
+
children: clearOptionLabel
|
|
2856
|
+
}),
|
|
2857
|
+
!isCheckboxVariant && selected.size === 0 ? /* @__PURE__ */ jsx22("span", {
|
|
2858
|
+
className: "iquji-select__item-indicator iquji-multi-select__item-indicator",
|
|
2859
|
+
"aria-hidden": "true",
|
|
2860
|
+
children: /* @__PURE__ */ jsx22(IqujiIcon11, {
|
|
2861
|
+
decorative: true,
|
|
2862
|
+
name: "check",
|
|
2863
|
+
size: 16
|
|
2864
|
+
})
|
|
2865
|
+
}) : null
|
|
2866
|
+
]
|
|
2867
|
+
}) : null,
|
|
2868
|
+
visible.map((option) => {
|
|
2869
|
+
const isChecked = selected.has(option.value);
|
|
2870
|
+
const isOptionDisabled = disabled || option.disabled;
|
|
2871
|
+
return /* @__PURE__ */ jsxs20("div", {
|
|
2872
|
+
role: "option",
|
|
2873
|
+
"aria-selected": isChecked,
|
|
2874
|
+
"aria-disabled": isOptionDisabled,
|
|
2875
|
+
"data-disabled": isOptionDisabled || undefined,
|
|
2876
|
+
className: classNames("iquji-select__item", "iquji-multi-select__item", isChecked && "iquji-select__item--selected iquji-multi-select__item--selected", isOptionDisabled && "iquji-multi-select__item--disabled"),
|
|
2877
|
+
onClick: () => {
|
|
2878
|
+
if (!isOptionDisabled) {
|
|
2879
|
+
toggle(option, !isChecked);
|
|
2880
|
+
}
|
|
2881
|
+
},
|
|
2882
|
+
children: [
|
|
2883
|
+
isCheckboxVariant ? /* @__PURE__ */ jsx22("span", {
|
|
2884
|
+
className: classNames("iquji-multi-select__checkbox", isChecked && "iquji-multi-select__checkbox--checked"),
|
|
2885
|
+
"aria-hidden": "true",
|
|
2886
|
+
children: isChecked ? /* @__PURE__ */ jsx22(IqujiIcon11, {
|
|
2887
|
+
decorative: true,
|
|
2888
|
+
name: "check",
|
|
2889
|
+
size: 11,
|
|
2890
|
+
strokeWidth: 2.4
|
|
2891
|
+
}) : null
|
|
2892
|
+
}) : null,
|
|
2893
|
+
/* @__PURE__ */ jsxs20("div", {
|
|
2894
|
+
className: "iquji-multi-select__item-content",
|
|
2895
|
+
children: [
|
|
2896
|
+
/* @__PURE__ */ jsx22("span", {
|
|
2897
|
+
className: "iquji-select__item-text iquji-multi-select__item-text",
|
|
2898
|
+
children: option.label
|
|
2899
|
+
}),
|
|
2900
|
+
option.description ? /* @__PURE__ */ jsx22("span", {
|
|
2901
|
+
className: "iquji-multi-select__item-desc",
|
|
2902
|
+
children: option.description
|
|
2903
|
+
}) : null
|
|
2904
|
+
]
|
|
2905
|
+
}),
|
|
2906
|
+
!isCheckboxVariant && isChecked ? /* @__PURE__ */ jsx22("span", {
|
|
2907
|
+
className: "iquji-select__item-indicator iquji-multi-select__item-indicator",
|
|
2908
|
+
"aria-hidden": "true",
|
|
2909
|
+
children: /* @__PURE__ */ jsx22(IqujiIcon11, {
|
|
2910
|
+
decorative: true,
|
|
2911
|
+
name: "check",
|
|
2912
|
+
size: 16
|
|
2913
|
+
})
|
|
2914
|
+
}) : null
|
|
2915
|
+
]
|
|
2916
|
+
}, option.value);
|
|
2917
|
+
}),
|
|
2918
|
+
visible.length === 0 ? /* @__PURE__ */ jsx22("p", {
|
|
2919
|
+
className: "iquji-multi-select__empty",
|
|
2920
|
+
children: emptyLabel
|
|
2921
|
+
}) : null
|
|
2922
|
+
]
|
|
2923
|
+
}),
|
|
2924
|
+
selectAllLabel || clearLabel ? /* @__PURE__ */ jsxs20("div", {
|
|
2925
|
+
className: "iquji-multi-select__actions",
|
|
2926
|
+
children: [
|
|
2927
|
+
selectAllLabel ? /* @__PURE__ */ jsx22(IqujiButton, {
|
|
2928
|
+
compact: true,
|
|
2929
|
+
disabled: disabled || selected.size === options.length,
|
|
2930
|
+
onClick: selectAll,
|
|
2931
|
+
variant: "ghost",
|
|
2932
|
+
children: selectAllLabel
|
|
2933
|
+
}) : null,
|
|
2934
|
+
clearLabel ? /* @__PURE__ */ jsx22(IqujiButton, {
|
|
2935
|
+
compact: true,
|
|
2936
|
+
disabled: disabled || selected.size === 0,
|
|
2937
|
+
onClick: () => {
|
|
2938
|
+
if (!disabled)
|
|
2939
|
+
onChange([]);
|
|
2940
|
+
},
|
|
2941
|
+
variant: "ghost",
|
|
2942
|
+
children: clearLabel
|
|
2943
|
+
}) : null
|
|
2944
|
+
]
|
|
2945
|
+
}) : null
|
|
2946
|
+
]
|
|
2947
|
+
})
|
|
2948
|
+
})
|
|
2949
|
+
]
|
|
2950
|
+
});
|
|
2951
|
+
}
|
|
2952
|
+
// src/navigation.tsx
|
|
2953
|
+
import { useId as useId9, useRef as useRef8 } from "react";
|
|
2954
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2955
|
+
function IqujiTabs({
|
|
2956
|
+
id,
|
|
2957
|
+
className,
|
|
2958
|
+
label,
|
|
2959
|
+
onChange,
|
|
2960
|
+
panelId,
|
|
2961
|
+
tabs,
|
|
2962
|
+
value,
|
|
2963
|
+
variant = "underline"
|
|
2964
|
+
}) {
|
|
2965
|
+
const generatedId = useId9();
|
|
2966
|
+
const tabsId = id ?? generatedId;
|
|
2967
|
+
const refs = useRef8(new Map);
|
|
2968
|
+
const enabled = tabs.filter((tab) => !tab.disabled);
|
|
2969
|
+
const selectedEnabled = enabled.some((tab) => tab.value === value);
|
|
2970
|
+
const moveFocus = (event, current, direction) => {
|
|
2971
|
+
const currentIndex = enabled.findIndex((tab) => tab.value === current);
|
|
2972
|
+
const nextIndex = (currentIndex + direction + enabled.length) % enabled.length;
|
|
2973
|
+
const next = enabled[nextIndex];
|
|
2974
|
+
if (!next) {
|
|
2975
|
+
return;
|
|
2976
|
+
}
|
|
2977
|
+
event.preventDefault();
|
|
2978
|
+
onChange(next.value);
|
|
2979
|
+
refs.current.get(next.value)?.focus();
|
|
2980
|
+
};
|
|
2981
|
+
return /* @__PURE__ */ jsx23("div", {
|
|
2982
|
+
"aria-label": label,
|
|
2983
|
+
className: classNames("iquji-tabs", variant === "segmented" && "iquji-tabs--segmented", className),
|
|
2984
|
+
id: tabsId,
|
|
2985
|
+
role: "tablist",
|
|
2986
|
+
children: tabs.map((tab) => {
|
|
2987
|
+
const selected = tab.value === value;
|
|
2988
|
+
return /* @__PURE__ */ jsx23("button", {
|
|
2989
|
+
"aria-controls": panelId,
|
|
2990
|
+
"aria-selected": selected,
|
|
2991
|
+
disabled: tab.disabled,
|
|
2992
|
+
id: `${tabsId}-${tab.value}`,
|
|
2993
|
+
onClick: () => onChange(tab.value),
|
|
2994
|
+
onKeyDown: (event) => {
|
|
2995
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229)
|
|
2996
|
+
return;
|
|
2997
|
+
if (event.key === "ArrowRight") {
|
|
2998
|
+
moveFocus(event, tab.value, 1);
|
|
2999
|
+
} else if (event.key === "ArrowLeft") {
|
|
3000
|
+
moveFocus(event, tab.value, -1);
|
|
3001
|
+
} else if (event.key === "Home") {
|
|
3002
|
+
const first = tabs.find((item) => !item.disabled);
|
|
3003
|
+
if (first) {
|
|
3004
|
+
event.preventDefault();
|
|
3005
|
+
onChange(first.value);
|
|
3006
|
+
refs.current.get(first.value)?.focus();
|
|
3007
|
+
}
|
|
3008
|
+
} else if (event.key === "End") {
|
|
3009
|
+
const last = [...tabs].reverse().find((item) => !item.disabled);
|
|
3010
|
+
if (last) {
|
|
3011
|
+
event.preventDefault();
|
|
3012
|
+
onChange(last.value);
|
|
3013
|
+
refs.current.get(last.value)?.focus();
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
},
|
|
3017
|
+
ref: (element) => {
|
|
3018
|
+
if (element) {
|
|
3019
|
+
refs.current.set(tab.value, element);
|
|
3020
|
+
} else {
|
|
3021
|
+
refs.current.delete(tab.value);
|
|
3022
|
+
}
|
|
3023
|
+
},
|
|
3024
|
+
role: "tab",
|
|
3025
|
+
tabIndex: !tab.disabled && (selected || !selectedEnabled && tab === enabled[0]) ? 0 : -1,
|
|
3026
|
+
type: "button",
|
|
3027
|
+
children: tab.label
|
|
3028
|
+
}, tab.value);
|
|
3029
|
+
})
|
|
3030
|
+
});
|
|
3031
|
+
}
|
|
3032
|
+
// src/notification.tsx
|
|
3033
|
+
import { Toast } from "@base-ui/react/toast";
|
|
3034
|
+
import { IqujiIcon as IqujiIcon12 } from "@iquji-web/web-icons";
|
|
3035
|
+
import {
|
|
3036
|
+
createContext as createContext3,
|
|
3037
|
+
useCallback as useCallback6,
|
|
3038
|
+
useContext as useContext3,
|
|
3039
|
+
useEffect as useEffect4,
|
|
3040
|
+
useId as useId10,
|
|
3041
|
+
useMemo as useMemo5,
|
|
3042
|
+
useRef as useRef9,
|
|
3043
|
+
useState as useState11
|
|
3044
|
+
} from "react";
|
|
3045
|
+
import { jsx as jsx24, jsxs as jsxs21, Fragment as Fragment6 } from "react/jsx-runtime";
|
|
3046
|
+
var Context2 = createContext3(null);
|
|
3047
|
+
var TimerPauseContext = createContext3(false);
|
|
3048
|
+
var icons = {
|
|
3049
|
+
info: "circle-info",
|
|
3050
|
+
success: "check-circle",
|
|
3051
|
+
warning: "circle-alert",
|
|
3052
|
+
danger: "x-circle"
|
|
3053
|
+
};
|
|
3054
|
+
function IqujiNotificationProvider({
|
|
3055
|
+
children,
|
|
3056
|
+
closeLabel,
|
|
3057
|
+
label = "通知",
|
|
3058
|
+
placement = "topRight",
|
|
3059
|
+
duration = 5000,
|
|
3060
|
+
maxCount = 3
|
|
3061
|
+
}) {
|
|
3062
|
+
if (!closeLabel.trim())
|
|
3063
|
+
throw new Error("通知必须提供 closeLabel");
|
|
3064
|
+
if (!Number.isFinite(duration) || duration < 0)
|
|
3065
|
+
throw new Error("通知 duration 必须为非负有限数");
|
|
3066
|
+
if (!Number.isInteger(maxCount) || maxCount < 1)
|
|
3067
|
+
throw new Error("通知 maxCount 必须为正整数");
|
|
3068
|
+
return /* @__PURE__ */ jsx24(Toast.Provider, {
|
|
3069
|
+
timeout: duration,
|
|
3070
|
+
limit: maxCount,
|
|
3071
|
+
children: /* @__PURE__ */ jsx24(NotificationContent, {
|
|
3072
|
+
closeLabel,
|
|
3073
|
+
label,
|
|
3074
|
+
placement,
|
|
3075
|
+
duration,
|
|
3076
|
+
maxCount,
|
|
3077
|
+
children
|
|
3078
|
+
})
|
|
3079
|
+
});
|
|
3080
|
+
}
|
|
3081
|
+
function NotificationContent({
|
|
3082
|
+
children,
|
|
3083
|
+
closeLabel,
|
|
3084
|
+
label,
|
|
3085
|
+
placement,
|
|
3086
|
+
duration,
|
|
3087
|
+
maxCount
|
|
3088
|
+
}) {
|
|
3089
|
+
const { add, close, update, toasts } = Toast.useToastManager();
|
|
3090
|
+
const container = useIqujiNotificationContainer();
|
|
3091
|
+
const prefix = useId10();
|
|
3092
|
+
const sequence = useRef9(0);
|
|
3093
|
+
const active = useRef9(new Map);
|
|
3094
|
+
const [windowFocused, setWindowFocused] = useState11(true);
|
|
3095
|
+
useEffect4(() => {
|
|
3096
|
+
const win = document.defaultView;
|
|
3097
|
+
if (!win)
|
|
3098
|
+
return;
|
|
3099
|
+
const handleBlur = (event) => {
|
|
3100
|
+
if (event.target === win)
|
|
3101
|
+
setWindowFocused(false);
|
|
3102
|
+
};
|
|
3103
|
+
const handleFocus = (event) => {
|
|
3104
|
+
if (!event.relatedTarget && event.target !== win)
|
|
3105
|
+
setWindowFocused(true);
|
|
3106
|
+
};
|
|
3107
|
+
win.addEventListener("blur", handleBlur, true);
|
|
3108
|
+
win.addEventListener("focus", handleFocus, true);
|
|
3109
|
+
return () => {
|
|
3110
|
+
win.removeEventListener("blur", handleBlur, true);
|
|
3111
|
+
win.removeEventListener("focus", handleFocus, true);
|
|
3112
|
+
};
|
|
3113
|
+
}, []);
|
|
3114
|
+
const open = useCallback6((options) => {
|
|
3115
|
+
const timeout = options.duration ?? duration;
|
|
3116
|
+
if (!Number.isFinite(timeout) || timeout < 0)
|
|
3117
|
+
throw new Error("通知 duration 必须为非负有限数");
|
|
3118
|
+
const key = options.key ?? `${prefix}-${++sequence.current}`;
|
|
3119
|
+
const existing = active.current.get(key);
|
|
3120
|
+
const id = existing ?? `${prefix}-notification-${++sequence.current}`;
|
|
3121
|
+
const configuration = {
|
|
3122
|
+
title: options.title,
|
|
3123
|
+
description: options.description,
|
|
3124
|
+
type: options.tone ?? "info",
|
|
3125
|
+
timeout,
|
|
3126
|
+
data: { actions: options.actions, revision: ++sequence.current },
|
|
3127
|
+
onClose: () => {
|
|
3128
|
+
if (active.current.get(key) === id)
|
|
3129
|
+
active.current.delete(key);
|
|
3130
|
+
options.onClose?.();
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
if (existing) {
|
|
3134
|
+
update(existing, configuration);
|
|
3135
|
+
} else {
|
|
3136
|
+
while (active.current.size >= maxCount) {
|
|
3137
|
+
const oldest = active.current.values().next().value;
|
|
3138
|
+
if (!oldest)
|
|
3139
|
+
break;
|
|
3140
|
+
close(oldest);
|
|
3141
|
+
}
|
|
3142
|
+
active.current.set(key, id);
|
|
3143
|
+
add({ ...configuration, id });
|
|
3144
|
+
}
|
|
3145
|
+
return key;
|
|
3146
|
+
}, [add, close, update, duration, maxCount, prefix]);
|
|
3147
|
+
const dismiss = useCallback6((key) => {
|
|
3148
|
+
if (key === undefined)
|
|
3149
|
+
close();
|
|
3150
|
+
else {
|
|
3151
|
+
const id = active.current.get(key);
|
|
3152
|
+
if (id)
|
|
3153
|
+
close(id);
|
|
3154
|
+
}
|
|
3155
|
+
}, [close]);
|
|
3156
|
+
const api = useMemo5(() => ({ open, close: dismiss }), [open, dismiss]);
|
|
3157
|
+
return /* @__PURE__ */ jsxs21(Context2.Provider, {
|
|
3158
|
+
value: api,
|
|
3159
|
+
children: [
|
|
3160
|
+
children,
|
|
3161
|
+
/* @__PURE__ */ jsx24(Toast.Portal, {
|
|
3162
|
+
container,
|
|
3163
|
+
children: /* @__PURE__ */ jsx24(Toast.Viewport, {
|
|
3164
|
+
"aria-label": label,
|
|
3165
|
+
className: "iquji-notification-viewport",
|
|
3166
|
+
"data-placement": placement,
|
|
3167
|
+
render: (props, state) => /* @__PURE__ */ jsx24("div", {
|
|
3168
|
+
...props,
|
|
3169
|
+
children: /* @__PURE__ */ jsx24(TimerPauseContext.Provider, {
|
|
3170
|
+
value: state.expanded || !windowFocused,
|
|
3171
|
+
children: props.children
|
|
3172
|
+
})
|
|
3173
|
+
}),
|
|
3174
|
+
children: toasts.map((toast) => {
|
|
3175
|
+
const tone = toast.type ?? "info";
|
|
3176
|
+
const timeout = toast.timeout ?? duration;
|
|
3177
|
+
return /* @__PURE__ */ jsxs21(Toast.Root, {
|
|
3178
|
+
className: "iquji-notification",
|
|
3179
|
+
"data-tone": tone,
|
|
3180
|
+
role: tone === "danger" ? "alert" : "status",
|
|
3181
|
+
onKeyDown: (event) => {
|
|
3182
|
+
if (event.key === "Escape")
|
|
3183
|
+
event.stopPropagation();
|
|
3184
|
+
},
|
|
3185
|
+
swipeDirection: [],
|
|
3186
|
+
toast,
|
|
3187
|
+
children: [
|
|
3188
|
+
/* @__PURE__ */ jsx24("span", {
|
|
3189
|
+
className: "iquji-notification__icon-badge",
|
|
3190
|
+
children: /* @__PURE__ */ jsx24(IqujiIcon12, {
|
|
3191
|
+
className: "iquji-notification__icon",
|
|
3192
|
+
decorative: true,
|
|
3193
|
+
name: icons[tone],
|
|
3194
|
+
size: 14
|
|
3195
|
+
})
|
|
3196
|
+
}),
|
|
3197
|
+
/* @__PURE__ */ jsxs21(Toast.Content, {
|
|
3198
|
+
className: "iquji-notification__content",
|
|
3199
|
+
children: [
|
|
3200
|
+
/* @__PURE__ */ jsx24(Toast.Title, {
|
|
3201
|
+
className: "iquji-notification__title"
|
|
3202
|
+
}),
|
|
3203
|
+
toast.description != null && /* @__PURE__ */ jsx24(Toast.Description, {
|
|
3204
|
+
className: "iquji-notification__description"
|
|
3205
|
+
}),
|
|
3206
|
+
toast.data?.actions && /* @__PURE__ */ jsx24("div", {
|
|
3207
|
+
className: "iquji-notification__actions",
|
|
3208
|
+
children: toast.data.actions
|
|
3209
|
+
})
|
|
3210
|
+
]
|
|
3211
|
+
}),
|
|
3212
|
+
/* @__PURE__ */ jsx24(NotificationTimer, {
|
|
3213
|
+
duration: timeout,
|
|
3214
|
+
closeLabel
|
|
3215
|
+
}, toast.data?.revision)
|
|
3216
|
+
]
|
|
3217
|
+
}, toast.id);
|
|
3218
|
+
})
|
|
3219
|
+
})
|
|
3220
|
+
})
|
|
3221
|
+
]
|
|
3222
|
+
});
|
|
3223
|
+
}
|
|
3224
|
+
function NotificationTimer({
|
|
3225
|
+
duration,
|
|
3226
|
+
closeLabel
|
|
3227
|
+
}) {
|
|
3228
|
+
const paused = useContext3(TimerPauseContext);
|
|
3229
|
+
const remaining = useRef9(duration);
|
|
3230
|
+
const [seconds, setSeconds] = useState11(() => Math.ceil(duration / 1000));
|
|
3231
|
+
useEffect4(() => {
|
|
3232
|
+
if (duration <= 0 || paused)
|
|
3233
|
+
return;
|
|
3234
|
+
const started = Date.now();
|
|
3235
|
+
const initial = remaining.current;
|
|
3236
|
+
const update = () => {
|
|
3237
|
+
remaining.current = Math.max(0, initial - (Date.now() - started));
|
|
3238
|
+
setSeconds(Math.ceil(remaining.current / 1000));
|
|
3239
|
+
};
|
|
3240
|
+
const interval = setInterval(() => {
|
|
3241
|
+
update();
|
|
3242
|
+
}, 100);
|
|
3243
|
+
return () => {
|
|
3244
|
+
clearInterval(interval);
|
|
3245
|
+
remaining.current = Math.max(0, initial - (Date.now() - started));
|
|
3246
|
+
};
|
|
3247
|
+
}, [duration, paused]);
|
|
3248
|
+
return /* @__PURE__ */ jsxs21(Fragment6, {
|
|
3249
|
+
children: [
|
|
3250
|
+
/* @__PURE__ */ jsxs21("div", {
|
|
3251
|
+
className: "iquji-notification__side",
|
|
3252
|
+
children: [
|
|
3253
|
+
duration > 0 && /* @__PURE__ */ jsxs21("span", {
|
|
3254
|
+
"aria-hidden": "true",
|
|
3255
|
+
className: "iquji-notification__countdown",
|
|
3256
|
+
children: [
|
|
3257
|
+
seconds,
|
|
3258
|
+
"s"
|
|
3259
|
+
]
|
|
3260
|
+
}),
|
|
3261
|
+
/* @__PURE__ */ jsx24(Toast.Close, {
|
|
3262
|
+
render: /* @__PURE__ */ jsx24(IconButton, {
|
|
3263
|
+
compact: true,
|
|
3264
|
+
className: "iquji-notification__close",
|
|
3265
|
+
icon: /* @__PURE__ */ jsx24(IqujiIcon12, {
|
|
3266
|
+
decorative: true,
|
|
3267
|
+
name: "close",
|
|
3268
|
+
size: 12
|
|
3269
|
+
}),
|
|
3270
|
+
label: closeLabel
|
|
3271
|
+
})
|
|
3272
|
+
})
|
|
3273
|
+
]
|
|
3274
|
+
}),
|
|
3275
|
+
duration > 0 && /* @__PURE__ */ jsx24("span", {
|
|
3276
|
+
"aria-hidden": "true",
|
|
3277
|
+
className: "iquji-notification__progress",
|
|
3278
|
+
style: {
|
|
3279
|
+
animationDuration: `${duration}ms`,
|
|
3280
|
+
animationPlayState: paused ? "paused" : "running"
|
|
3281
|
+
}
|
|
3282
|
+
})
|
|
3283
|
+
]
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3286
|
+
function useIqujiNotification() {
|
|
3287
|
+
const value = useContext3(Context2);
|
|
3288
|
+
if (!value)
|
|
3289
|
+
throw new Error("useIqujiNotification 必须在 IqujiNotificationProvider 中使用");
|
|
3290
|
+
return value;
|
|
3291
|
+
}
|
|
3292
|
+
// src/pagination.tsx
|
|
3293
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3294
|
+
function IqujiPagination({
|
|
3295
|
+
page,
|
|
3296
|
+
pageSize,
|
|
3297
|
+
total,
|
|
3298
|
+
label,
|
|
3299
|
+
previousLabel,
|
|
3300
|
+
nextLabel,
|
|
3301
|
+
summary,
|
|
3302
|
+
onPageChange,
|
|
3303
|
+
className
|
|
3304
|
+
}) {
|
|
3305
|
+
if (!Number.isSafeInteger(page) || page < 1 || !Number.isSafeInteger(pageSize) || pageSize < 1 || !Number.isSafeInteger(total) || total < 0) {
|
|
3306
|
+
throw new RangeError("分页必须使用有效页码、正整数页大小和非负总数");
|
|
3307
|
+
}
|
|
3308
|
+
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
|
3309
|
+
const range = [
|
|
3310
|
+
total === 0 ? 0 : Math.min(total, (page - 1) * pageSize + 1),
|
|
3311
|
+
Math.min(total, page * pageSize)
|
|
3312
|
+
];
|
|
3313
|
+
return /* @__PURE__ */ jsxs22("nav", {
|
|
3314
|
+
"aria-label": label,
|
|
3315
|
+
className: classNames("iquji-pagination", className),
|
|
3316
|
+
children: [
|
|
3317
|
+
summary ? /* @__PURE__ */ jsx25("span", {
|
|
3318
|
+
children: summary(total, range)
|
|
3319
|
+
}) : null,
|
|
3320
|
+
/* @__PURE__ */ jsx25(IqujiButton, {
|
|
3321
|
+
compact: true,
|
|
3322
|
+
disabled: !onPageChange || page <= 1,
|
|
3323
|
+
onClick: () => onPageChange?.(page - 1, pageSize),
|
|
3324
|
+
variant: "secondary",
|
|
3325
|
+
children: previousLabel
|
|
3326
|
+
}),
|
|
3327
|
+
/* @__PURE__ */ jsxs22("span", {
|
|
3328
|
+
children: [
|
|
3329
|
+
page,
|
|
3330
|
+
" / ",
|
|
3331
|
+
pageCount
|
|
3332
|
+
]
|
|
3333
|
+
}),
|
|
3334
|
+
/* @__PURE__ */ jsx25(IqujiButton, {
|
|
3335
|
+
compact: true,
|
|
3336
|
+
disabled: !onPageChange || page >= pageCount,
|
|
3337
|
+
onClick: () => onPageChange?.(page + 1, pageSize),
|
|
3338
|
+
variant: "secondary",
|
|
3339
|
+
children: nextLabel
|
|
3340
|
+
})
|
|
3341
|
+
]
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3344
|
+
// src/progress-bar.tsx
|
|
3345
|
+
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3346
|
+
function IqujiProgressBar({
|
|
3347
|
+
className,
|
|
3348
|
+
formatValue,
|
|
3349
|
+
indeterminate = false,
|
|
3350
|
+
label,
|
|
3351
|
+
max = 100,
|
|
3352
|
+
showValue = false,
|
|
3353
|
+
tone = "info",
|
|
3354
|
+
value,
|
|
3355
|
+
...divProps
|
|
3356
|
+
}) {
|
|
3357
|
+
if (!Number.isFinite(max) || max <= 0) {
|
|
3358
|
+
throw new RangeError("进度条最大值必须是正数");
|
|
3359
|
+
}
|
|
3360
|
+
const determinate = !indeterminate && value !== undefined && Number.isFinite(value);
|
|
3361
|
+
const current = determinate ? Math.min(Math.max(value, 0), max) : 0;
|
|
3362
|
+
const percent = determinate ? current / max * 100 : 0;
|
|
3363
|
+
return /* @__PURE__ */ jsxs23("div", {
|
|
3364
|
+
className: classNames("iquji-progress", className),
|
|
3365
|
+
...divProps,
|
|
3366
|
+
children: [
|
|
3367
|
+
/* @__PURE__ */ jsxs23("div", {
|
|
3368
|
+
className: "iquji-progress__heading",
|
|
3369
|
+
children: [
|
|
3370
|
+
/* @__PURE__ */ jsx26("span", {
|
|
3371
|
+
className: "iquji-progress__label",
|
|
3372
|
+
children: label
|
|
3373
|
+
}),
|
|
3374
|
+
showValue && determinate ? /* @__PURE__ */ jsx26("span", {
|
|
3375
|
+
className: "iquji-progress__value",
|
|
3376
|
+
children: formatValue ? formatValue(current, max) : `${Math.round(percent)}%`
|
|
3377
|
+
}) : null
|
|
3378
|
+
]
|
|
3379
|
+
}),
|
|
3380
|
+
/* @__PURE__ */ jsx26("div", {
|
|
3381
|
+
"aria-label": label,
|
|
3382
|
+
"aria-valuemax": determinate ? max : undefined,
|
|
3383
|
+
"aria-valuemin": determinate ? 0 : undefined,
|
|
3384
|
+
"aria-valuenow": determinate ? current : undefined,
|
|
3385
|
+
className: "iquji-progress__track",
|
|
3386
|
+
"data-indeterminate": !determinate || undefined,
|
|
3387
|
+
"data-tone": tone,
|
|
3388
|
+
role: "progressbar",
|
|
3389
|
+
children: /* @__PURE__ */ jsx26("span", {
|
|
3390
|
+
className: "iquji-progress__fill",
|
|
3391
|
+
style: determinate ? { width: `${percent}%` } : undefined
|
|
3392
|
+
})
|
|
3393
|
+
})
|
|
3394
|
+
]
|
|
3395
|
+
});
|
|
3396
|
+
}
|
|
3397
|
+
// src/scroll-area.tsx
|
|
3398
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3399
|
+
function size(value) {
|
|
3400
|
+
if (value === undefined)
|
|
3401
|
+
return;
|
|
3402
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
3403
|
+
}
|
|
3404
|
+
function IqujiScrollArea({
|
|
3405
|
+
children,
|
|
3406
|
+
className,
|
|
3407
|
+
height,
|
|
3408
|
+
label,
|
|
3409
|
+
maxHeight,
|
|
3410
|
+
orientation = "vertical",
|
|
3411
|
+
style,
|
|
3412
|
+
tabIndex = 0,
|
|
3413
|
+
...divProps
|
|
3414
|
+
}) {
|
|
3415
|
+
const styles = {
|
|
3416
|
+
...style,
|
|
3417
|
+
height: size(height),
|
|
3418
|
+
maxHeight: size(maxHeight)
|
|
3419
|
+
};
|
|
3420
|
+
return /* @__PURE__ */ jsx27("div", {
|
|
3421
|
+
"aria-label": label,
|
|
3422
|
+
className: classNames("iquji-scroll-area", className),
|
|
3423
|
+
"data-orientation": orientation,
|
|
3424
|
+
role: "region",
|
|
3425
|
+
style: styles,
|
|
3426
|
+
tabIndex,
|
|
3427
|
+
...divProps,
|
|
3428
|
+
children
|
|
3429
|
+
});
|
|
3430
|
+
}
|
|
3431
|
+
// src/search-dialog.tsx
|
|
3432
|
+
import { IqujiIcon as IqujiIcon13 } from "@iquji-web/web-icons";
|
|
3433
|
+
import {
|
|
3434
|
+
useEffect as useEffect5,
|
|
3435
|
+
useId as useId11,
|
|
3436
|
+
useMemo as useMemo6,
|
|
3437
|
+
useRef as useRef10,
|
|
3438
|
+
useState as useState12
|
|
3439
|
+
} from "react";
|
|
3440
|
+
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3441
|
+
function IqujiSearchDialog({
|
|
3442
|
+
open,
|
|
3443
|
+
onOpenChange,
|
|
3444
|
+
title,
|
|
3445
|
+
placeholder,
|
|
3446
|
+
emptyLabel,
|
|
3447
|
+
closeLabel,
|
|
3448
|
+
groups,
|
|
3449
|
+
onSelect
|
|
3450
|
+
}) {
|
|
3451
|
+
const id = useId11();
|
|
3452
|
+
const input = useRef10(null);
|
|
3453
|
+
const options = useRef10(new Map);
|
|
3454
|
+
const composing = useRef10(false);
|
|
3455
|
+
const [query, setQuery] = useState12("");
|
|
3456
|
+
const [activeId, setActiveId] = useState12(null);
|
|
3457
|
+
const filtered = useMemo6(() => {
|
|
3458
|
+
const term = query.trim().toLocaleLowerCase();
|
|
3459
|
+
return groups.flatMap((group) => {
|
|
3460
|
+
const items = group.items.filter((item) => [item.title, item.description, item.keywords].filter(Boolean).join(" ").toLocaleLowerCase().includes(term));
|
|
3461
|
+
return items.length ? [{ ...group, items }] : [];
|
|
3462
|
+
});
|
|
3463
|
+
}, [groups, query]);
|
|
3464
|
+
const enabled = useMemo6(() => filtered.flatMap((group) => group.items.filter((item) => !item.disabled)), [filtered]);
|
|
3465
|
+
const active = enabled.find((item) => item.id === activeId) ?? enabled[0];
|
|
3466
|
+
const selectedId = active?.id;
|
|
3467
|
+
const optionId = (itemId) => `${id}-option-${encodeURIComponent(itemId)}`;
|
|
3468
|
+
useEffect5(() => {
|
|
3469
|
+
setQuery("");
|
|
3470
|
+
setActiveId(null);
|
|
3471
|
+
composing.current = false;
|
|
3472
|
+
}, [open]);
|
|
3473
|
+
useEffect5(() => {
|
|
3474
|
+
if (activeId && !enabled.some((item) => item.id === activeId))
|
|
3475
|
+
setActiveId(null);
|
|
3476
|
+
}, [activeId, enabled]);
|
|
3477
|
+
useEffect5(() => {
|
|
3478
|
+
if (open && selectedId)
|
|
3479
|
+
options.current.get(selectedId)?.scrollIntoView?.({ block: "nearest" });
|
|
3480
|
+
}, [selectedId, open, query]);
|
|
3481
|
+
const select = (item) => {
|
|
3482
|
+
if (!open || item.disabled)
|
|
3483
|
+
return;
|
|
3484
|
+
onSelect(item.id);
|
|
3485
|
+
};
|
|
3486
|
+
const onKeyDown = (event) => {
|
|
3487
|
+
if (composing.current || event.nativeEvent.isComposing || event.keyCode === 229) {
|
|
3488
|
+
if (event.key === "Escape")
|
|
3489
|
+
event.stopPropagation();
|
|
3490
|
+
return;
|
|
3491
|
+
}
|
|
3492
|
+
if (event.key === "Enter") {
|
|
3493
|
+
event.preventDefault();
|
|
3494
|
+
if (active)
|
|
3495
|
+
select(active);
|
|
3496
|
+
return;
|
|
3497
|
+
}
|
|
3498
|
+
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key))
|
|
3499
|
+
return;
|
|
3500
|
+
event.preventDefault();
|
|
3501
|
+
if (!enabled.length)
|
|
3502
|
+
return;
|
|
3503
|
+
const index = active ? enabled.findIndex((item) => item.id === active.id) : 0;
|
|
3504
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : (index + (event.key === "ArrowDown" ? 1 : -1) + enabled.length) % enabled.length;
|
|
3505
|
+
setActiveId(enabled[next]?.id ?? null);
|
|
3506
|
+
};
|
|
3507
|
+
return /* @__PURE__ */ jsxs24(IqujiDialog, {
|
|
3508
|
+
className: "iquji-search-dialog",
|
|
3509
|
+
open,
|
|
3510
|
+
onOpenChange,
|
|
3511
|
+
title,
|
|
3512
|
+
closeLabel,
|
|
3513
|
+
initialFocusRef: input,
|
|
3514
|
+
width: "min(560px, 92vw)",
|
|
3515
|
+
children: [
|
|
3516
|
+
/* @__PURE__ */ jsxs24("div", {
|
|
3517
|
+
className: "iquji-search-dialog__query",
|
|
3518
|
+
children: [
|
|
3519
|
+
/* @__PURE__ */ jsx28(IqujiIcon13, {
|
|
3520
|
+
decorative: true,
|
|
3521
|
+
name: "search"
|
|
3522
|
+
}),
|
|
3523
|
+
/* @__PURE__ */ jsx28("input", {
|
|
3524
|
+
"aria-activedescendant": open && active ? optionId(active.id) : undefined,
|
|
3525
|
+
"aria-autocomplete": "list",
|
|
3526
|
+
"aria-controls": `${id}-results`,
|
|
3527
|
+
"aria-expanded": open,
|
|
3528
|
+
"aria-label": title,
|
|
3529
|
+
autoComplete: "off",
|
|
3530
|
+
onChange: (event) => {
|
|
3531
|
+
setQuery(event.target.value);
|
|
3532
|
+
setActiveId(null);
|
|
3533
|
+
},
|
|
3534
|
+
onCompositionStart: () => {
|
|
3535
|
+
composing.current = true;
|
|
3536
|
+
},
|
|
3537
|
+
onCompositionEnd: () => {
|
|
3538
|
+
composing.current = false;
|
|
3539
|
+
},
|
|
3540
|
+
onKeyDown,
|
|
3541
|
+
placeholder,
|
|
3542
|
+
ref: input,
|
|
3543
|
+
role: "combobox",
|
|
3544
|
+
spellCheck: false,
|
|
3545
|
+
type: "text",
|
|
3546
|
+
value: query
|
|
3547
|
+
})
|
|
3548
|
+
]
|
|
3549
|
+
}),
|
|
3550
|
+
/* @__PURE__ */ jsxs24("div", {
|
|
3551
|
+
className: "iquji-search-dialog__results",
|
|
3552
|
+
children: [
|
|
3553
|
+
/* @__PURE__ */ jsx28("div", {
|
|
3554
|
+
"aria-label": title,
|
|
3555
|
+
id: `${id}-results`,
|
|
3556
|
+
role: "listbox",
|
|
3557
|
+
children: filtered.map((group) => {
|
|
3558
|
+
const labelId = `${id}-group-${encodeURIComponent(group.id)}`;
|
|
3559
|
+
return /* @__PURE__ */ jsxs24("div", {
|
|
3560
|
+
"aria-labelledby": labelId,
|
|
3561
|
+
className: "iquji-search-dialog__group",
|
|
3562
|
+
role: "group",
|
|
3563
|
+
children: [
|
|
3564
|
+
/* @__PURE__ */ jsx28("div", {
|
|
3565
|
+
className: "iquji-search-dialog__group-label",
|
|
3566
|
+
id: labelId,
|
|
3567
|
+
children: group.label
|
|
3568
|
+
}),
|
|
3569
|
+
group.items.map((item) => {
|
|
3570
|
+
const itemId = optionId(item.id);
|
|
3571
|
+
const hasMetadata = item.metadata !== undefined && item.metadata !== null;
|
|
3572
|
+
const descriptionIds = [
|
|
3573
|
+
item.description ? `${itemId}-description` : null,
|
|
3574
|
+
hasMetadata ? `${itemId}-metadata` : null
|
|
3575
|
+
].filter(Boolean).join(" ");
|
|
3576
|
+
return /* @__PURE__ */ jsxs24("button", {
|
|
3577
|
+
"aria-describedby": descriptionIds || undefined,
|
|
3578
|
+
"aria-disabled": item.disabled || undefined,
|
|
3579
|
+
"aria-labelledby": `${itemId}-title`,
|
|
3580
|
+
"aria-selected": active?.id === item.id,
|
|
3581
|
+
className: "iquji-search-dialog__option",
|
|
3582
|
+
disabled: item.disabled,
|
|
3583
|
+
id: itemId,
|
|
3584
|
+
onClick: () => select(item),
|
|
3585
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
3586
|
+
onMouseMove: () => {
|
|
3587
|
+
if (!item.disabled)
|
|
3588
|
+
setActiveId(item.id);
|
|
3589
|
+
},
|
|
3590
|
+
ref: (element) => {
|
|
3591
|
+
if (element)
|
|
3592
|
+
options.current.set(item.id, element);
|
|
3593
|
+
else
|
|
3594
|
+
options.current.delete(item.id);
|
|
3595
|
+
},
|
|
3596
|
+
role: "option",
|
|
3597
|
+
tabIndex: -1,
|
|
3598
|
+
type: "button",
|
|
3599
|
+
children: [
|
|
3600
|
+
item.icon && /* @__PURE__ */ jsx28("span", {
|
|
3601
|
+
"aria-hidden": "true",
|
|
3602
|
+
className: "iquji-search-dialog__icon",
|
|
3603
|
+
children: item.icon
|
|
3604
|
+
}),
|
|
3605
|
+
/* @__PURE__ */ jsxs24("span", {
|
|
3606
|
+
className: "iquji-search-dialog__item-content",
|
|
3607
|
+
children: [
|
|
3608
|
+
/* @__PURE__ */ jsx28("span", {
|
|
3609
|
+
className: "iquji-search-dialog__item-title",
|
|
3610
|
+
id: `${itemId}-title`,
|
|
3611
|
+
children: item.title
|
|
3612
|
+
}),
|
|
3613
|
+
item.description && /* @__PURE__ */ jsx28("span", {
|
|
3614
|
+
className: "iquji-search-dialog__description",
|
|
3615
|
+
id: `${itemId}-description`,
|
|
3616
|
+
children: item.description
|
|
3617
|
+
})
|
|
3618
|
+
]
|
|
3619
|
+
}),
|
|
3620
|
+
hasMetadata && /* @__PURE__ */ jsx28("span", {
|
|
3621
|
+
className: "iquji-search-dialog__metadata",
|
|
3622
|
+
id: `${itemId}-metadata`,
|
|
3623
|
+
children: item.metadata
|
|
3624
|
+
})
|
|
3625
|
+
]
|
|
3626
|
+
}, item.id);
|
|
3627
|
+
})
|
|
3628
|
+
]
|
|
3629
|
+
}, group.id);
|
|
3630
|
+
})
|
|
3631
|
+
}),
|
|
3632
|
+
!filtered.length && /* @__PURE__ */ jsx28("p", {
|
|
3633
|
+
className: "iquji-search-dialog__empty",
|
|
3634
|
+
role: "status",
|
|
3635
|
+
children: emptyLabel
|
|
3636
|
+
})
|
|
3637
|
+
]
|
|
3638
|
+
})
|
|
3639
|
+
]
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
// src/settings-layout.tsx
|
|
3643
|
+
import {
|
|
3644
|
+
useId as useId12
|
|
3645
|
+
} from "react";
|
|
3646
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3647
|
+
function IqujiSettingsLayout({
|
|
3648
|
+
navigation,
|
|
3649
|
+
children,
|
|
3650
|
+
className,
|
|
3651
|
+
navigationClassName,
|
|
3652
|
+
contentClassName,
|
|
3653
|
+
...divProps
|
|
3654
|
+
}) {
|
|
3655
|
+
return /* @__PURE__ */ jsxs25("div", {
|
|
3656
|
+
className: classNames("iquji-settings", className),
|
|
3657
|
+
...divProps,
|
|
3658
|
+
children: [
|
|
3659
|
+
/* @__PURE__ */ jsx29("div", {
|
|
3660
|
+
className: classNames("iquji-settings__navigation", navigationClassName),
|
|
3661
|
+
children: navigation
|
|
3662
|
+
}),
|
|
3663
|
+
/* @__PURE__ */ jsx29("div", {
|
|
3664
|
+
className: classNames("iquji-settings__content", contentClassName),
|
|
3665
|
+
children
|
|
3666
|
+
})
|
|
3667
|
+
]
|
|
3668
|
+
});
|
|
3669
|
+
}
|
|
3670
|
+
function IqujiSettingsContent({
|
|
3671
|
+
actions,
|
|
3672
|
+
children,
|
|
3673
|
+
className,
|
|
3674
|
+
description,
|
|
3675
|
+
title,
|
|
3676
|
+
titleId,
|
|
3677
|
+
...sectionProps
|
|
3678
|
+
}) {
|
|
3679
|
+
const generatedId = useId12();
|
|
3680
|
+
const headingId = titleId ?? `${generatedId}-title`;
|
|
3681
|
+
return /* @__PURE__ */ jsxs25("section", {
|
|
3682
|
+
"aria-labelledby": headingId,
|
|
3683
|
+
className: classNames("iquji-settings-content", className),
|
|
3684
|
+
...sectionProps,
|
|
3685
|
+
children: [
|
|
3686
|
+
/* @__PURE__ */ jsxs25("header", {
|
|
3687
|
+
className: "iquji-settings-content__header",
|
|
3688
|
+
children: [
|
|
3689
|
+
/* @__PURE__ */ jsxs25("div", {
|
|
3690
|
+
children: [
|
|
3691
|
+
/* @__PURE__ */ jsx29("h1", {
|
|
3692
|
+
id: headingId,
|
|
3693
|
+
tabIndex: -1,
|
|
3694
|
+
children: title
|
|
3695
|
+
}),
|
|
3696
|
+
description ? /* @__PURE__ */ jsx29("p", {
|
|
3697
|
+
className: "iquji-settings-content__description",
|
|
3698
|
+
children: description
|
|
3699
|
+
}) : null
|
|
3700
|
+
]
|
|
3701
|
+
}),
|
|
3702
|
+
actions ? /* @__PURE__ */ jsx29("div", {
|
|
3703
|
+
className: "iquji-settings-content__actions",
|
|
3704
|
+
children: actions
|
|
3705
|
+
}) : null
|
|
3706
|
+
]
|
|
3707
|
+
}),
|
|
3708
|
+
/* @__PURE__ */ jsx29("div", {
|
|
3709
|
+
className: "iquji-settings-content__body",
|
|
3710
|
+
children
|
|
3711
|
+
})
|
|
3712
|
+
]
|
|
3713
|
+
});
|
|
3714
|
+
}
|
|
3715
|
+
function IqujiSettingsSection({
|
|
3716
|
+
actions,
|
|
3717
|
+
children,
|
|
3718
|
+
className,
|
|
3719
|
+
description,
|
|
3720
|
+
title,
|
|
3721
|
+
titleId,
|
|
3722
|
+
...sectionProps
|
|
3723
|
+
}) {
|
|
3724
|
+
const generatedId = useId12();
|
|
3725
|
+
const headingId = titleId ?? `${generatedId}-title`;
|
|
3726
|
+
return /* @__PURE__ */ jsxs25("section", {
|
|
3727
|
+
"aria-labelledby": headingId,
|
|
3728
|
+
className: classNames("iquji-settings-section", className),
|
|
3729
|
+
...sectionProps,
|
|
3730
|
+
children: [
|
|
3731
|
+
/* @__PURE__ */ jsxs25("header", {
|
|
3732
|
+
className: "iquji-settings-section__header",
|
|
3733
|
+
children: [
|
|
3734
|
+
/* @__PURE__ */ jsxs25("div", {
|
|
3735
|
+
children: [
|
|
3736
|
+
/* @__PURE__ */ jsx29("h2", {
|
|
3737
|
+
id: headingId,
|
|
3738
|
+
children: title
|
|
3739
|
+
}),
|
|
3740
|
+
description ? /* @__PURE__ */ jsx29("p", {
|
|
3741
|
+
className: "iquji-settings-section__description",
|
|
3742
|
+
children: description
|
|
3743
|
+
}) : null
|
|
3744
|
+
]
|
|
3745
|
+
}),
|
|
3746
|
+
actions ? /* @__PURE__ */ jsx29("div", {
|
|
3747
|
+
className: "iquji-settings-section__actions",
|
|
3748
|
+
children: actions
|
|
3749
|
+
}) : null
|
|
3750
|
+
]
|
|
3751
|
+
}),
|
|
3752
|
+
/* @__PURE__ */ jsx29("div", {
|
|
3753
|
+
className: "iquji-settings-section__rows",
|
|
3754
|
+
children
|
|
3755
|
+
})
|
|
3756
|
+
]
|
|
3757
|
+
});
|
|
3758
|
+
}
|
|
3759
|
+
// src/settings-nav.tsx
|
|
3760
|
+
import { IqujiIcon as IqujiIcon14 } from "@iquji-web/web-icons";
|
|
3761
|
+
import { useId as useId13 } from "react";
|
|
3762
|
+
import { jsx as jsx30, jsxs as jsxs26, Fragment as Fragment7 } from "react/jsx-runtime";
|
|
3763
|
+
function navItemContent(item) {
|
|
3764
|
+
return /* @__PURE__ */ jsxs26(Fragment7, {
|
|
3765
|
+
children: [
|
|
3766
|
+
item.icon ? /* @__PURE__ */ jsx30("span", {
|
|
3767
|
+
"aria-hidden": "true",
|
|
3768
|
+
className: "iquji-settings-nav__item-icon",
|
|
3769
|
+
children: item.icon
|
|
3770
|
+
}) : null,
|
|
3771
|
+
/* @__PURE__ */ jsx30("span", {
|
|
3772
|
+
className: "iquji-settings-nav__item-label",
|
|
3773
|
+
children: item.label
|
|
3774
|
+
}),
|
|
3775
|
+
item.trailing ? /* @__PURE__ */ jsx30("span", {
|
|
3776
|
+
className: "iquji-settings-nav__item-trailing",
|
|
3777
|
+
children: item.trailing
|
|
3778
|
+
}) : null
|
|
3779
|
+
]
|
|
3780
|
+
});
|
|
3781
|
+
}
|
|
3782
|
+
function IqujiSettingsNav({
|
|
3783
|
+
label,
|
|
3784
|
+
groups,
|
|
3785
|
+
header,
|
|
3786
|
+
search,
|
|
3787
|
+
emptyLabel,
|
|
3788
|
+
className
|
|
3789
|
+
}) {
|
|
3790
|
+
const generatedId = useId13();
|
|
3791
|
+
const searchId = `${generatedId}-search`;
|
|
3792
|
+
return /* @__PURE__ */ jsxs26("div", {
|
|
3793
|
+
className: classNames("iquji-settings-nav", className),
|
|
3794
|
+
children: [
|
|
3795
|
+
header ? /* @__PURE__ */ jsx30("div", {
|
|
3796
|
+
className: "iquji-settings-nav__header",
|
|
3797
|
+
children: header
|
|
3798
|
+
}) : null,
|
|
3799
|
+
search ? /* @__PURE__ */ jsxs26("div", {
|
|
3800
|
+
className: "iquji-settings-nav__search",
|
|
3801
|
+
children: [
|
|
3802
|
+
/* @__PURE__ */ jsx30("label", {
|
|
3803
|
+
className: "iquji-visually-hidden",
|
|
3804
|
+
htmlFor: searchId,
|
|
3805
|
+
children: search.label
|
|
3806
|
+
}),
|
|
3807
|
+
/* @__PURE__ */ jsx30("span", {
|
|
3808
|
+
"aria-hidden": "true",
|
|
3809
|
+
className: "iquji-settings-nav__search-icon",
|
|
3810
|
+
children: /* @__PURE__ */ jsx30(IqujiIcon14, {
|
|
3811
|
+
decorative: true,
|
|
3812
|
+
name: "search",
|
|
3813
|
+
size: 15
|
|
3814
|
+
})
|
|
3815
|
+
}),
|
|
3816
|
+
/* @__PURE__ */ jsx30("input", {
|
|
3817
|
+
autoComplete: "off",
|
|
3818
|
+
className: "iquji-settings-nav__search-input",
|
|
3819
|
+
id: searchId,
|
|
3820
|
+
onChange: (event) => search.onChange(event.target.value),
|
|
3821
|
+
placeholder: search.placeholder,
|
|
3822
|
+
spellCheck: false,
|
|
3823
|
+
type: "search",
|
|
3824
|
+
value: search.value
|
|
3825
|
+
})
|
|
3826
|
+
]
|
|
3827
|
+
}) : null,
|
|
3828
|
+
/* @__PURE__ */ jsxs26("nav", {
|
|
3829
|
+
"aria-label": label,
|
|
3830
|
+
className: "iquji-settings-nav__nav",
|
|
3831
|
+
children: [
|
|
3832
|
+
groups.length === 0 && emptyLabel ? /* @__PURE__ */ jsx30("p", {
|
|
3833
|
+
className: "iquji-settings-nav__empty",
|
|
3834
|
+
role: "status",
|
|
3835
|
+
children: emptyLabel
|
|
3836
|
+
}) : null,
|
|
3837
|
+
groups.map((group, index) => {
|
|
3838
|
+
const headingId = group.label ? `${generatedId}-group-${index}` : undefined;
|
|
3839
|
+
return /* @__PURE__ */ jsxs26("div", {
|
|
3840
|
+
"aria-labelledby": headingId,
|
|
3841
|
+
className: "iquji-settings-nav__group",
|
|
3842
|
+
role: headingId ? "group" : undefined,
|
|
3843
|
+
children: [
|
|
3844
|
+
group.label ? /* @__PURE__ */ jsx30("h2", {
|
|
3845
|
+
className: "iquji-settings-nav__group-label",
|
|
3846
|
+
id: headingId,
|
|
3847
|
+
children: group.label
|
|
3848
|
+
}) : null,
|
|
3849
|
+
/* @__PURE__ */ jsx30("div", {
|
|
3850
|
+
className: "iquji-settings-nav__items",
|
|
3851
|
+
children: group.items.map((item) => item.href && !item.disabled ? /* @__PURE__ */ jsx30("a", {
|
|
3852
|
+
"aria-current": item.active ? "page" : undefined,
|
|
3853
|
+
className: "iquji-settings-nav__item",
|
|
3854
|
+
"data-active": item.active || undefined,
|
|
3855
|
+
href: item.href,
|
|
3856
|
+
onClick: item.onSelect,
|
|
3857
|
+
children: navItemContent(item)
|
|
3858
|
+
}, item.key) : /* @__PURE__ */ jsx30("button", {
|
|
3859
|
+
"aria-current": item.active ? "page" : undefined,
|
|
3860
|
+
className: "iquji-settings-nav__item",
|
|
3861
|
+
"data-active": item.active || undefined,
|
|
3862
|
+
disabled: item.disabled,
|
|
3863
|
+
onClick: item.onSelect,
|
|
3864
|
+
type: "button",
|
|
3865
|
+
children: navItemContent(item)
|
|
3866
|
+
}, item.key))
|
|
3867
|
+
})
|
|
3868
|
+
]
|
|
3869
|
+
}, group.key);
|
|
3870
|
+
})
|
|
3871
|
+
]
|
|
3872
|
+
})
|
|
3873
|
+
]
|
|
3874
|
+
});
|
|
3875
|
+
}
|
|
3876
|
+
// src/settings-rows.tsx
|
|
3877
|
+
import { useId as useId14 } from "react";
|
|
3878
|
+
import { jsx as jsx31, jsxs as jsxs27, Fragment as Fragment8 } from "react/jsx-runtime";
|
|
3879
|
+
function SettingsRowFrame({
|
|
3880
|
+
label,
|
|
3881
|
+
description,
|
|
3882
|
+
labelId,
|
|
3883
|
+
descriptionId,
|
|
3884
|
+
htmlFor,
|
|
3885
|
+
disabled = false,
|
|
3886
|
+
align = "center",
|
|
3887
|
+
className,
|
|
3888
|
+
labelClassName,
|
|
3889
|
+
controlClassName,
|
|
3890
|
+
control
|
|
3891
|
+
}) {
|
|
3892
|
+
return /* @__PURE__ */ jsxs27("div", {
|
|
3893
|
+
className: classNames("iquji-settings-row", className),
|
|
3894
|
+
"data-align": align,
|
|
3895
|
+
"data-disabled": disabled || undefined,
|
|
3896
|
+
children: [
|
|
3897
|
+
/* @__PURE__ */ jsxs27("div", {
|
|
3898
|
+
className: "iquji-settings-row__copy",
|
|
3899
|
+
children: [
|
|
3900
|
+
htmlFor ? /* @__PURE__ */ jsx31("label", {
|
|
3901
|
+
className: classNames("iquji-settings-row__label", labelClassName),
|
|
3902
|
+
htmlFor,
|
|
3903
|
+
id: labelId,
|
|
3904
|
+
children: label
|
|
3905
|
+
}) : /* @__PURE__ */ jsx31("span", {
|
|
3906
|
+
className: classNames("iquji-settings-row__label", labelClassName),
|
|
3907
|
+
id: labelId,
|
|
3908
|
+
children: label
|
|
3909
|
+
}),
|
|
3910
|
+
description !== undefined && description !== null ? /* @__PURE__ */ jsx31("span", {
|
|
3911
|
+
className: "iquji-settings-row__description",
|
|
3912
|
+
id: descriptionId,
|
|
3913
|
+
children: description
|
|
3914
|
+
}) : null
|
|
3915
|
+
]
|
|
3916
|
+
}),
|
|
3917
|
+
/* @__PURE__ */ jsx31("div", {
|
|
3918
|
+
className: classNames("iquji-settings-row__control", controlClassName),
|
|
3919
|
+
children: control
|
|
3920
|
+
})
|
|
3921
|
+
]
|
|
3922
|
+
});
|
|
3923
|
+
}
|
|
3924
|
+
function IqujiSettingsRow({
|
|
3925
|
+
label,
|
|
3926
|
+
description,
|
|
3927
|
+
control,
|
|
3928
|
+
htmlFor,
|
|
3929
|
+
labelId,
|
|
3930
|
+
descriptionId,
|
|
3931
|
+
align,
|
|
3932
|
+
disabled,
|
|
3933
|
+
className,
|
|
3934
|
+
labelClassName,
|
|
3935
|
+
controlClassName
|
|
3936
|
+
}) {
|
|
3937
|
+
const generatedId = useId14();
|
|
3938
|
+
return /* @__PURE__ */ jsx31(SettingsRowFrame, {
|
|
3939
|
+
align,
|
|
3940
|
+
className,
|
|
3941
|
+
control,
|
|
3942
|
+
controlClassName,
|
|
3943
|
+
description,
|
|
3944
|
+
descriptionId: description !== undefined && description !== null ? descriptionId ?? `${generatedId}-description` : undefined,
|
|
3945
|
+
disabled,
|
|
3946
|
+
htmlFor,
|
|
3947
|
+
label,
|
|
3948
|
+
labelClassName,
|
|
3949
|
+
labelId: labelId ?? `${generatedId}-label`
|
|
3950
|
+
});
|
|
3951
|
+
}
|
|
3952
|
+
function IqujiSettingsSwitchRow({
|
|
3953
|
+
className,
|
|
3954
|
+
...props
|
|
3955
|
+
}) {
|
|
3956
|
+
return /* @__PURE__ */ jsx31(IqujiSwitch, {
|
|
3957
|
+
...props,
|
|
3958
|
+
className: classNames("iquji-settings-row", "iquji-settings-row--switch", className)
|
|
3959
|
+
});
|
|
3960
|
+
}
|
|
3961
|
+
function IqujiSettingsSelectRow({
|
|
3962
|
+
label,
|
|
3963
|
+
description,
|
|
3964
|
+
options,
|
|
3965
|
+
groups,
|
|
3966
|
+
value,
|
|
3967
|
+
defaultValue,
|
|
3968
|
+
onValueChange,
|
|
3969
|
+
placeholder,
|
|
3970
|
+
disabled = false,
|
|
3971
|
+
invalid = false,
|
|
3972
|
+
required = false,
|
|
3973
|
+
compact = false,
|
|
3974
|
+
name,
|
|
3975
|
+
id,
|
|
3976
|
+
align,
|
|
3977
|
+
className,
|
|
3978
|
+
labelClassName,
|
|
3979
|
+
controlClassName
|
|
3980
|
+
}) {
|
|
3981
|
+
const generatedId = useId14();
|
|
3982
|
+
const labelId = `${generatedId}-label`;
|
|
3983
|
+
const descriptionId = description !== undefined && description !== null ? `${generatedId}-description` : undefined;
|
|
3984
|
+
const selectProps = {
|
|
3985
|
+
"aria-labelledby": labelId,
|
|
3986
|
+
...descriptionId ? { "aria-describedby": descriptionId } : {},
|
|
3987
|
+
compact,
|
|
3988
|
+
disabled,
|
|
3989
|
+
invalid,
|
|
3990
|
+
options,
|
|
3991
|
+
required,
|
|
3992
|
+
...groups !== undefined ? { groups } : {},
|
|
3993
|
+
...value !== undefined ? { value } : {},
|
|
3994
|
+
...defaultValue !== undefined ? { defaultValue } : {},
|
|
3995
|
+
...onValueChange ? { onValueChange } : {},
|
|
3996
|
+
...placeholder !== undefined ? { placeholder } : {},
|
|
3997
|
+
...name !== undefined ? { name } : {},
|
|
3998
|
+
...id !== undefined ? { id } : {}
|
|
3999
|
+
};
|
|
4000
|
+
return /* @__PURE__ */ jsx31(SettingsRowFrame, {
|
|
4001
|
+
align,
|
|
4002
|
+
className,
|
|
4003
|
+
control: /* @__PURE__ */ jsx31(IqujiSelect, {
|
|
4004
|
+
...selectProps
|
|
4005
|
+
}),
|
|
4006
|
+
controlClassName,
|
|
4007
|
+
description,
|
|
4008
|
+
descriptionId,
|
|
4009
|
+
disabled,
|
|
4010
|
+
label,
|
|
4011
|
+
labelClassName,
|
|
4012
|
+
labelId
|
|
4013
|
+
});
|
|
4014
|
+
}
|
|
4015
|
+
function IqujiSettingsActionRow({
|
|
4016
|
+
label,
|
|
4017
|
+
description,
|
|
4018
|
+
value,
|
|
4019
|
+
action,
|
|
4020
|
+
disabled = false,
|
|
4021
|
+
align = "center",
|
|
4022
|
+
className,
|
|
4023
|
+
valueClassName,
|
|
4024
|
+
controlClassName
|
|
4025
|
+
}) {
|
|
4026
|
+
const generatedId = useId14();
|
|
4027
|
+
const labelId = `${generatedId}-label`;
|
|
4028
|
+
const descriptionId = description !== undefined && description !== null ? `${generatedId}-description` : undefined;
|
|
4029
|
+
return /* @__PURE__ */ jsx31(SettingsRowFrame, {
|
|
4030
|
+
align,
|
|
4031
|
+
className,
|
|
4032
|
+
control: /* @__PURE__ */ jsxs27(Fragment8, {
|
|
4033
|
+
children: [
|
|
4034
|
+
value !== undefined && value !== null ? /* @__PURE__ */ jsx31("span", {
|
|
4035
|
+
className: classNames("iquji-settings-row__value", valueClassName),
|
|
4036
|
+
children: value
|
|
4037
|
+
}) : null,
|
|
4038
|
+
action
|
|
4039
|
+
]
|
|
4040
|
+
}),
|
|
4041
|
+
controlClassName,
|
|
4042
|
+
description,
|
|
4043
|
+
descriptionId,
|
|
4044
|
+
disabled,
|
|
4045
|
+
label,
|
|
4046
|
+
labelId
|
|
4047
|
+
});
|
|
4048
|
+
}
|
|
4049
|
+
// src/timeline.tsx
|
|
4050
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4051
|
+
function IqujiTimeline({
|
|
4052
|
+
className,
|
|
4053
|
+
emptyLabel = "暂无时间线记录",
|
|
4054
|
+
items,
|
|
4055
|
+
label,
|
|
4056
|
+
...sectionProps
|
|
4057
|
+
}) {
|
|
4058
|
+
return /* @__PURE__ */ jsx32("section", {
|
|
4059
|
+
"aria-label": label,
|
|
4060
|
+
className: classNames("iquji-timeline", className),
|
|
4061
|
+
...sectionProps,
|
|
4062
|
+
children: items.length === 0 ? /* @__PURE__ */ jsx32("p", {
|
|
4063
|
+
className: "iquji-timeline__empty",
|
|
4064
|
+
children: emptyLabel
|
|
4065
|
+
}) : /* @__PURE__ */ jsx32("ol", {
|
|
4066
|
+
className: "iquji-timeline__list",
|
|
4067
|
+
children: items.map((item) => /* @__PURE__ */ jsxs28("li", {
|
|
4068
|
+
className: "iquji-timeline__item",
|
|
4069
|
+
"data-tone": item.tone ?? "neutral",
|
|
4070
|
+
children: [
|
|
4071
|
+
/* @__PURE__ */ jsx32("span", {
|
|
4072
|
+
"aria-hidden": "true",
|
|
4073
|
+
className: "iquji-timeline__marker",
|
|
4074
|
+
children: item.icon
|
|
4075
|
+
}),
|
|
4076
|
+
/* @__PURE__ */ jsxs28("div", {
|
|
4077
|
+
className: "iquji-timeline__content",
|
|
4078
|
+
children: [
|
|
4079
|
+
/* @__PURE__ */ jsxs28("div", {
|
|
4080
|
+
className: "iquji-timeline__heading",
|
|
4081
|
+
children: [
|
|
4082
|
+
/* @__PURE__ */ jsx32("span", {
|
|
4083
|
+
className: "iquji-timeline__title",
|
|
4084
|
+
children: item.title
|
|
4085
|
+
}),
|
|
4086
|
+
item.timestamp ? /* @__PURE__ */ jsx32("span", {
|
|
4087
|
+
className: "iquji-timeline__timestamp",
|
|
4088
|
+
children: item.timestamp
|
|
4089
|
+
}) : null
|
|
4090
|
+
]
|
|
4091
|
+
}),
|
|
4092
|
+
item.description ? /* @__PURE__ */ jsx32("div", {
|
|
4093
|
+
className: "iquji-timeline__description",
|
|
4094
|
+
children: item.description
|
|
4095
|
+
}) : null,
|
|
4096
|
+
item.status ? /* @__PURE__ */ jsx32("div", {
|
|
4097
|
+
className: "iquji-timeline__status",
|
|
4098
|
+
children: item.status
|
|
4099
|
+
}) : null
|
|
4100
|
+
]
|
|
4101
|
+
})
|
|
4102
|
+
]
|
|
4103
|
+
}, item.id))
|
|
4104
|
+
})
|
|
4105
|
+
});
|
|
4106
|
+
}
|
|
4107
|
+
// src/workbench.tsx
|
|
4108
|
+
import {
|
|
4109
|
+
useId as useId15,
|
|
4110
|
+
useLayoutEffect,
|
|
4111
|
+
useRef as useRef11,
|
|
4112
|
+
useState as useState13
|
|
4113
|
+
} from "react";
|
|
4114
|
+
import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4115
|
+
var DEFAULT_LEFT_WIDTH = 240;
|
|
4116
|
+
var DEFAULT_LEFT_MIN = 180;
|
|
4117
|
+
var DEFAULT_LEFT_MAX = 420;
|
|
4118
|
+
var DEFAULT_RIGHT_WIDTH = 420;
|
|
4119
|
+
var DEFAULT_RIGHT_MIN = 280;
|
|
4120
|
+
var DEFAULT_RIGHT_MAX = 640;
|
|
4121
|
+
var DEFAULT_CENTER_MIN = 480;
|
|
4122
|
+
var RESIZE_STEP = 16;
|
|
4123
|
+
function numberOr(value, fallback) {
|
|
4124
|
+
return value !== undefined && Number.isFinite(value) ? value : fallback;
|
|
4125
|
+
}
|
|
4126
|
+
function widthBounds(minValue, maxValue) {
|
|
4127
|
+
const min = Math.max(0, Math.round(numberOr(minValue, 0)));
|
|
4128
|
+
const max = Math.max(min, Math.round(numberOr(maxValue, min)));
|
|
4129
|
+
return { min, max };
|
|
4130
|
+
}
|
|
4131
|
+
function clampWidth(value, min, max) {
|
|
4132
|
+
const lower = Math.max(0, Math.min(min, max));
|
|
4133
|
+
const upper = Math.max(lower, max);
|
|
4134
|
+
return Math.min(Math.max(value, lower), upper);
|
|
4135
|
+
}
|
|
4136
|
+
function IqujiWorkbenchLayout({
|
|
4137
|
+
left,
|
|
4138
|
+
center,
|
|
4139
|
+
right,
|
|
4140
|
+
leftWidth,
|
|
4141
|
+
defaultLeftWidth,
|
|
4142
|
+
onLeftWidthChange,
|
|
4143
|
+
leftMinWidth,
|
|
4144
|
+
leftMaxWidth,
|
|
4145
|
+
leftCollapsed = false,
|
|
4146
|
+
rightWidth,
|
|
4147
|
+
defaultRightWidth,
|
|
4148
|
+
onRightWidthChange,
|
|
4149
|
+
rightMinWidth,
|
|
4150
|
+
rightMaxWidth,
|
|
4151
|
+
rightCollapsed = false,
|
|
4152
|
+
centerMinWidth,
|
|
4153
|
+
onLayoutChange,
|
|
4154
|
+
leftResizeLabel = "Resize left panel",
|
|
4155
|
+
rightResizeLabel = "Resize right panel",
|
|
4156
|
+
className,
|
|
4157
|
+
leftClassName,
|
|
4158
|
+
centerClassName,
|
|
4159
|
+
rightClassName
|
|
4160
|
+
}) {
|
|
4161
|
+
const generatedId = useId15();
|
|
4162
|
+
const rootRef = useRef11(null);
|
|
4163
|
+
const leftRef = useRef11(null);
|
|
4164
|
+
const centerRef = useRef11(null);
|
|
4165
|
+
const rightRef = useRef11(null);
|
|
4166
|
+
const previousGeometry = useRef11(null);
|
|
4167
|
+
const dragRef = useRef11(null);
|
|
4168
|
+
const [resizing, setResizing] = useState13(null);
|
|
4169
|
+
const leftBounds = widthBounds(leftMinWidth ?? DEFAULT_LEFT_MIN, leftMaxWidth ?? DEFAULT_LEFT_MAX);
|
|
4170
|
+
const rightBounds = widthBounds(rightMinWidth ?? DEFAULT_RIGHT_MIN, rightMaxWidth ?? DEFAULT_RIGHT_MAX);
|
|
4171
|
+
const leftDefault = clampWidth(numberOr(defaultLeftWidth, DEFAULT_LEFT_WIDTH), leftBounds.min, leftBounds.max);
|
|
4172
|
+
const rightDefault = clampWidth(numberOr(defaultRightWidth, DEFAULT_RIGHT_WIDTH), rightBounds.min, rightBounds.max);
|
|
4173
|
+
const [internalLeftWidth, setInternalLeftWidth] = useState13(leftDefault);
|
|
4174
|
+
const [internalRightWidth, setInternalRightWidth] = useState13(rightDefault);
|
|
4175
|
+
const leftValue = clampWidth(numberOr(leftWidth, internalLeftWidth), leftBounds.min, leftBounds.max);
|
|
4176
|
+
const rightValue = clampWidth(numberOr(rightWidth, internalRightWidth), rightBounds.min, rightBounds.max);
|
|
4177
|
+
const centerMin = Math.max(1, Math.round(numberOr(centerMinWidth, DEFAULT_CENTER_MIN)));
|
|
4178
|
+
const hasLeft = left !== undefined && left !== null;
|
|
4179
|
+
const hasRight = right !== undefined && right !== null;
|
|
4180
|
+
const leftVisible = hasLeft && !leftCollapsed;
|
|
4181
|
+
const rightVisible = hasRight && !rightCollapsed;
|
|
4182
|
+
useLayoutEffect(() => {
|
|
4183
|
+
if (!onLayoutChange) {
|
|
4184
|
+
previousGeometry.current = null;
|
|
4185
|
+
return;
|
|
4186
|
+
}
|
|
4187
|
+
let disposed = false;
|
|
4188
|
+
const measure = () => {
|
|
4189
|
+
if (disposed)
|
|
4190
|
+
return;
|
|
4191
|
+
const geometry = {
|
|
4192
|
+
leftWidth: leftVisible ? leftRef.current?.getBoundingClientRect().width ?? 0 : 0,
|
|
4193
|
+
centerWidth: centerRef.current?.getBoundingClientRect().width ?? 0,
|
|
4194
|
+
rightWidth: rightVisible ? rightRef.current?.getBoundingClientRect().width ?? 0 : 0
|
|
4195
|
+
};
|
|
4196
|
+
const previous = previousGeometry.current;
|
|
4197
|
+
if (previous?.leftWidth === geometry.leftWidth && previous.centerWidth === geometry.centerWidth && previous.rightWidth === geometry.rightWidth)
|
|
4198
|
+
return;
|
|
4199
|
+
previousGeometry.current = geometry;
|
|
4200
|
+
onLayoutChange(geometry);
|
|
4201
|
+
};
|
|
4202
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
4203
|
+
for (const pane of [leftRef.current, centerRef.current, rightRef.current]) {
|
|
4204
|
+
if (pane)
|
|
4205
|
+
observer?.observe(pane);
|
|
4206
|
+
}
|
|
4207
|
+
measure();
|
|
4208
|
+
return () => {
|
|
4209
|
+
disposed = true;
|
|
4210
|
+
observer?.disconnect();
|
|
4211
|
+
};
|
|
4212
|
+
}, [hasLeft, hasRight, leftVisible, onLayoutChange, rightVisible]);
|
|
4213
|
+
const limitForSide = (side, requested) => {
|
|
4214
|
+
const bounds = side === "left" ? leftBounds : rightBounds;
|
|
4215
|
+
const otherWidth = side === "left" ? rightVisible ? rightValue : 0 : leftVisible ? leftValue : 0;
|
|
4216
|
+
const measuredWidth = rootRef.current?.getBoundingClientRect().width ?? 0;
|
|
4217
|
+
const available = measuredWidth > 0 ? measuredWidth - centerMin - otherWidth : Number.POSITIVE_INFINITY;
|
|
4218
|
+
return clampWidth(requested, bounds.min, Math.min(bounds.max, available));
|
|
4219
|
+
};
|
|
4220
|
+
const changeLeftWidth = (next) => {
|
|
4221
|
+
const limited = limitForSide("left", next);
|
|
4222
|
+
if (leftWidth === undefined) {
|
|
4223
|
+
setInternalLeftWidth(limited);
|
|
4224
|
+
}
|
|
4225
|
+
onLeftWidthChange?.(limited);
|
|
4226
|
+
};
|
|
4227
|
+
const changeRightWidth = (next) => {
|
|
4228
|
+
const limited = limitForSide("right", next);
|
|
4229
|
+
if (rightWidth === undefined) {
|
|
4230
|
+
setInternalRightWidth(limited);
|
|
4231
|
+
}
|
|
4232
|
+
onRightWidthChange?.(limited);
|
|
4233
|
+
};
|
|
4234
|
+
const changeSideWidth = (side, next) => {
|
|
4235
|
+
if (side === "left") {
|
|
4236
|
+
changeLeftWidth(next);
|
|
4237
|
+
} else {
|
|
4238
|
+
changeRightWidth(next);
|
|
4239
|
+
}
|
|
4240
|
+
};
|
|
4241
|
+
const currentWidth = (side) => side === "left" ? leftValue : rightValue;
|
|
4242
|
+
const startDrag = (side, event) => {
|
|
4243
|
+
if (event.button !== 0)
|
|
4244
|
+
return;
|
|
4245
|
+
event.preventDefault();
|
|
4246
|
+
event.currentTarget.focus();
|
|
4247
|
+
if (typeof event.currentTarget.setPointerCapture === "function") {
|
|
4248
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
4249
|
+
}
|
|
4250
|
+
dragRef.current = {
|
|
4251
|
+
side,
|
|
4252
|
+
pointerId: event.pointerId,
|
|
4253
|
+
startX: event.clientX,
|
|
4254
|
+
startWidth: currentWidth(side)
|
|
4255
|
+
};
|
|
4256
|
+
setResizing(side);
|
|
4257
|
+
};
|
|
4258
|
+
const moveDrag = (side, event) => {
|
|
4259
|
+
const drag = dragRef.current;
|
|
4260
|
+
if (!drag || drag.side !== side || drag.pointerId !== event.pointerId) {
|
|
4261
|
+
return;
|
|
4262
|
+
}
|
|
4263
|
+
const delta = event.clientX - drag.startX;
|
|
4264
|
+
changeSideWidth(side, drag.startWidth + (side === "left" ? delta : -delta));
|
|
4265
|
+
};
|
|
4266
|
+
const finishDrag = (event) => {
|
|
4267
|
+
if (dragRef.current?.pointerId !== event.pointerId)
|
|
4268
|
+
return;
|
|
4269
|
+
dragRef.current = null;
|
|
4270
|
+
setResizing(null);
|
|
4271
|
+
if (typeof event.currentTarget.releasePointerCapture === "function" && event.currentTarget.hasPointerCapture?.(event.pointerId)) {
|
|
4272
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
4273
|
+
}
|
|
4274
|
+
};
|
|
4275
|
+
const handleKeyDown = (side, event) => {
|
|
4276
|
+
const step = event.shiftKey ? RESIZE_STEP * 4 : RESIZE_STEP;
|
|
4277
|
+
const current = currentWidth(side);
|
|
4278
|
+
let next = null;
|
|
4279
|
+
if (event.key === "ArrowLeft") {
|
|
4280
|
+
next = current + (side === "left" ? -step : step);
|
|
4281
|
+
} else if (event.key === "ArrowRight") {
|
|
4282
|
+
next = current + (side === "left" ? step : -step);
|
|
4283
|
+
} else if (event.key === "Home") {
|
|
4284
|
+
next = side === "left" ? leftBounds.min : rightBounds.min;
|
|
4285
|
+
} else if (event.key === "End") {
|
|
4286
|
+
next = side === "left" ? leftBounds.max : rightBounds.max;
|
|
4287
|
+
}
|
|
4288
|
+
if (next === null)
|
|
4289
|
+
return;
|
|
4290
|
+
event.preventDefault();
|
|
4291
|
+
changeSideWidth(side, next);
|
|
4292
|
+
};
|
|
4293
|
+
const resetWidth = (side, event) => {
|
|
4294
|
+
event.preventDefault();
|
|
4295
|
+
changeSideWidth(side, side === "left" ? leftDefault : rightDefault);
|
|
4296
|
+
};
|
|
4297
|
+
const style = {
|
|
4298
|
+
"--iquji-workbench-left-width": `${leftVisible ? leftValue : 0}px`,
|
|
4299
|
+
"--iquji-workbench-right-width": `${rightVisible ? rightValue : 0}px`,
|
|
4300
|
+
"--iquji-workbench-center-min-width": `${centerMin}px`
|
|
4301
|
+
};
|
|
4302
|
+
const renderResizer = (side) => {
|
|
4303
|
+
const bounds = side === "left" ? leftBounds : rightBounds;
|
|
4304
|
+
const value = currentWidth(side);
|
|
4305
|
+
const paneId = side === "left" ? `${generatedId}-left` : `${generatedId}-right`;
|
|
4306
|
+
return /* @__PURE__ */ jsx33("div", {
|
|
4307
|
+
"aria-controls": paneId,
|
|
4308
|
+
"aria-label": side === "left" ? leftResizeLabel : rightResizeLabel,
|
|
4309
|
+
"aria-orientation": "vertical",
|
|
4310
|
+
"aria-valuemax": bounds.max,
|
|
4311
|
+
"aria-valuemin": bounds.min,
|
|
4312
|
+
"aria-valuenow": value,
|
|
4313
|
+
className: classNames("iquji-workbench__resizer", `iquji-workbench__resizer--${side}`),
|
|
4314
|
+
onDoubleClick: (event) => resetWidth(side, event),
|
|
4315
|
+
onKeyDown: (event) => handleKeyDown(side, event),
|
|
4316
|
+
onPointerCancel: finishDrag,
|
|
4317
|
+
onPointerDown: (event) => startDrag(side, event),
|
|
4318
|
+
onPointerMove: (event) => moveDrag(side, event),
|
|
4319
|
+
onPointerUp: finishDrag,
|
|
4320
|
+
role: "separator",
|
|
4321
|
+
tabIndex: 0
|
|
4322
|
+
});
|
|
4323
|
+
};
|
|
4324
|
+
return /* @__PURE__ */ jsxs29("div", {
|
|
4325
|
+
className: classNames("iquji-workbench", leftCollapsed && "iquji-workbench--left-collapsed", rightCollapsed && "iquji-workbench--right-collapsed", className),
|
|
4326
|
+
"data-resizing": resizing ?? undefined,
|
|
4327
|
+
ref: rootRef,
|
|
4328
|
+
style,
|
|
4329
|
+
children: [
|
|
4330
|
+
hasLeft ? /* @__PURE__ */ jsxs29("div", {
|
|
4331
|
+
"aria-hidden": leftCollapsed || undefined,
|
|
4332
|
+
className: classNames("iquji-workbench__pane", "iquji-workbench__pane--left", leftClassName),
|
|
4333
|
+
id: `${generatedId}-left`,
|
|
4334
|
+
inert: leftCollapsed || undefined,
|
|
4335
|
+
ref: leftRef,
|
|
4336
|
+
children: [
|
|
4337
|
+
left,
|
|
4338
|
+
leftVisible ? renderResizer("left") : null
|
|
4339
|
+
]
|
|
4340
|
+
}) : null,
|
|
4341
|
+
/* @__PURE__ */ jsx33("div", {
|
|
4342
|
+
className: classNames("iquji-workbench__pane", "iquji-workbench__pane--center", centerClassName),
|
|
4343
|
+
id: `${generatedId}-center`,
|
|
4344
|
+
ref: centerRef,
|
|
4345
|
+
children: center
|
|
4346
|
+
}),
|
|
4347
|
+
hasRight ? /* @__PURE__ */ jsxs29("div", {
|
|
4348
|
+
"aria-hidden": rightCollapsed || undefined,
|
|
4349
|
+
className: classNames("iquji-workbench__pane", "iquji-workbench__pane--right", rightClassName),
|
|
4350
|
+
id: `${generatedId}-right`,
|
|
4351
|
+
inert: rightCollapsed || undefined,
|
|
4352
|
+
ref: rightRef,
|
|
4353
|
+
children: [
|
|
4354
|
+
rightVisible ? renderResizer("right") : null,
|
|
4355
|
+
right
|
|
4356
|
+
]
|
|
4357
|
+
}) : null
|
|
4358
|
+
]
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4361
|
+
// src/emoji-picker.tsx
|
|
4362
|
+
import { useId as useId16, useMemo as useMemo7, useRef as useRef12, useState as useState14 } from "react";
|
|
4363
|
+
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4364
|
+
function IqujiEmojiPicker({ value, options, onChange, label, searchLabel, emptyLabel, clearLabel, allLabel, disabled, variant = "primary" }) {
|
|
4365
|
+
const [open, setOpen] = useState14(false), [search, setSearch] = useState14("");
|
|
4366
|
+
const [category, setCategory] = useState14(null), [active, setActive] = useState14(0);
|
|
4367
|
+
const id = useId16(), buttons = useRef12(new Map);
|
|
4368
|
+
const categories = useMemo7(() => [...new Set(options.flatMap((option) => option.category ? [option.category] : []))], [options]);
|
|
4369
|
+
const filtered = useMemo7(() => options.filter((option) => (!category || option.category === category) && `${option.label} ${option.keywords ?? ""} ${option.value}`.toLocaleLowerCase().includes(search.trim().toLocaleLowerCase())), [options, search, category]);
|
|
4370
|
+
const navigate = (event) => {
|
|
4371
|
+
const offset = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: 6, ArrowUp: -6 }[event.key];
|
|
4372
|
+
if (offset === undefined && event.key !== "Home" && event.key !== "End")
|
|
4373
|
+
return;
|
|
4374
|
+
event.preventDefault();
|
|
4375
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? filtered.length - 1 : Math.max(0, Math.min(filtered.length - 1, active + (offset ?? 0)));
|
|
4376
|
+
setActive(next);
|
|
4377
|
+
buttons.current.get(next)?.focus();
|
|
4378
|
+
};
|
|
4379
|
+
return /* @__PURE__ */ jsx34(IqujiPopover, {
|
|
4380
|
+
open,
|
|
4381
|
+
onOpenChange: (next) => {
|
|
4382
|
+
setOpen(next);
|
|
4383
|
+
if (!next) {
|
|
4384
|
+
setSearch("");
|
|
4385
|
+
setCategory(null);
|
|
4386
|
+
setActive(0);
|
|
4387
|
+
}
|
|
4388
|
+
},
|
|
4389
|
+
trigger: /* @__PURE__ */ jsx34(IqujiButton, {
|
|
4390
|
+
variant,
|
|
4391
|
+
disabled,
|
|
4392
|
+
"aria-label": label,
|
|
4393
|
+
children: value ?? label
|
|
4394
|
+
}),
|
|
4395
|
+
children: /* @__PURE__ */ jsxs30("section", {
|
|
4396
|
+
className: "iquji-emoji-picker",
|
|
4397
|
+
"aria-label": label,
|
|
4398
|
+
children: [
|
|
4399
|
+
/* @__PURE__ */ jsx34("label", {
|
|
4400
|
+
htmlFor: id,
|
|
4401
|
+
children: searchLabel
|
|
4402
|
+
}),
|
|
4403
|
+
/* @__PURE__ */ jsx34(IqujiInput, {
|
|
4404
|
+
id,
|
|
4405
|
+
value: search,
|
|
4406
|
+
onChange: (event) => {
|
|
4407
|
+
setSearch(event.target.value);
|
|
4408
|
+
setActive(0);
|
|
4409
|
+
},
|
|
4410
|
+
onKeyDown: (event) => {
|
|
4411
|
+
if (event.key === "ArrowDown" && filtered.length) {
|
|
4412
|
+
event.preventDefault();
|
|
4413
|
+
buttons.current.get(0)?.focus();
|
|
4414
|
+
}
|
|
4415
|
+
}
|
|
4416
|
+
}),
|
|
4417
|
+
categories.length > 0 && /* @__PURE__ */ jsxs30("div", {
|
|
4418
|
+
className: "iquji-emoji-picker__categories",
|
|
4419
|
+
role: "group",
|
|
4420
|
+
"aria-label": label,
|
|
4421
|
+
children: [
|
|
4422
|
+
/* @__PURE__ */ jsx34(IqujiButton, {
|
|
4423
|
+
compact: true,
|
|
4424
|
+
variant: "ghost",
|
|
4425
|
+
"aria-pressed": category === null,
|
|
4426
|
+
onClick: () => {
|
|
4427
|
+
setCategory(null);
|
|
4428
|
+
setActive(0);
|
|
4429
|
+
},
|
|
4430
|
+
children: allLabel ?? searchLabel
|
|
4431
|
+
}),
|
|
4432
|
+
categories.map((item) => /* @__PURE__ */ jsx34(IqujiButton, {
|
|
4433
|
+
compact: true,
|
|
4434
|
+
variant: "ghost",
|
|
4435
|
+
"aria-pressed": category === item,
|
|
4436
|
+
onClick: () => {
|
|
4437
|
+
setCategory(item);
|
|
4438
|
+
setActive(0);
|
|
4439
|
+
},
|
|
4440
|
+
children: item
|
|
4441
|
+
}, item))
|
|
4442
|
+
]
|
|
4443
|
+
}),
|
|
4444
|
+
/* @__PURE__ */ jsx34("div", {
|
|
4445
|
+
className: "iquji-emoji-picker__grid",
|
|
4446
|
+
role: "group",
|
|
4447
|
+
"aria-label": label,
|
|
4448
|
+
onKeyDown: navigate,
|
|
4449
|
+
children: filtered.map((option, index) => /* @__PURE__ */ jsx34(IqujiButton, {
|
|
4450
|
+
ref: (element) => {
|
|
4451
|
+
if (element)
|
|
4452
|
+
buttons.current.set(index, element);
|
|
4453
|
+
else
|
|
4454
|
+
buttons.current.delete(index);
|
|
4455
|
+
},
|
|
4456
|
+
tabIndex: index === Math.min(active, filtered.length - 1) ? 0 : -1,
|
|
4457
|
+
variant: "ghost",
|
|
4458
|
+
"aria-label": option.label,
|
|
4459
|
+
"aria-pressed": value === option.value,
|
|
4460
|
+
title: option.label,
|
|
4461
|
+
onFocus: () => setActive(index),
|
|
4462
|
+
onClick: () => {
|
|
4463
|
+
onChange(option.value);
|
|
4464
|
+
setOpen(false);
|
|
4465
|
+
setSearch("");
|
|
4466
|
+
setCategory(null);
|
|
4467
|
+
setActive(0);
|
|
4468
|
+
},
|
|
4469
|
+
children: option.value
|
|
4470
|
+
}, option.value))
|
|
4471
|
+
}),
|
|
4472
|
+
!filtered.length && /* @__PURE__ */ jsx34("p", {
|
|
4473
|
+
role: "status",
|
|
4474
|
+
children: emptyLabel
|
|
4475
|
+
}),
|
|
4476
|
+
/* @__PURE__ */ jsx34(IqujiButton, {
|
|
4477
|
+
variant: "ghost",
|
|
4478
|
+
onClick: () => {
|
|
4479
|
+
onChange(null);
|
|
4480
|
+
setOpen(false);
|
|
4481
|
+
},
|
|
4482
|
+
children: clearLabel
|
|
4483
|
+
})
|
|
4484
|
+
]
|
|
4485
|
+
})
|
|
4486
|
+
});
|
|
4487
|
+
}
|
|
4488
|
+
|
|
4489
|
+
// src/index.tsx
|
|
4490
|
+
import { jsx as jsx35, jsxs as jsxs31, Fragment as Fragment9 } from "react/jsx-runtime";
|
|
4491
|
+
var renderNavigationItem = (item) => {
|
|
4492
|
+
const content = /* @__PURE__ */ jsxs31(Fragment9, {
|
|
4493
|
+
children: [
|
|
4494
|
+
item.icon,
|
|
4495
|
+
/* @__PURE__ */ jsx35("span", {
|
|
4496
|
+
children: item.label
|
|
4497
|
+
})
|
|
4498
|
+
]
|
|
4499
|
+
});
|
|
4500
|
+
return item.disabled || !item.href ? /* @__PURE__ */ jsx35("button", {
|
|
4501
|
+
"aria-label": item.label,
|
|
4502
|
+
className: "iquji-app-shell__navigation-item",
|
|
4503
|
+
"data-disabled": "true",
|
|
4504
|
+
disabled: true,
|
|
4505
|
+
type: "button",
|
|
4506
|
+
children: content
|
|
4507
|
+
}, item.id) : /* @__PURE__ */ jsx35("a", {
|
|
4508
|
+
"aria-label": item.label,
|
|
4509
|
+
"aria-current": item.active ? "page" : undefined,
|
|
4510
|
+
className: "iquji-app-shell__navigation-item",
|
|
4511
|
+
"data-active": item.active || undefined,
|
|
4512
|
+
href: item.href,
|
|
4513
|
+
onClick: item.onNavigate,
|
|
4514
|
+
onFocus: item.onIntent,
|
|
4515
|
+
onMouseEnter: item.onIntent,
|
|
4516
|
+
children: content
|
|
4517
|
+
}, item.id);
|
|
4518
|
+
};
|
|
4519
|
+
function AppShell({
|
|
4520
|
+
brand,
|
|
4521
|
+
navigationLabel,
|
|
4522
|
+
navigation: navigation2,
|
|
4523
|
+
navigationGroups,
|
|
4524
|
+
header,
|
|
4525
|
+
children,
|
|
4526
|
+
mainId = "iquji-main-content",
|
|
4527
|
+
skipLinkLabel
|
|
4528
|
+
}) {
|
|
4529
|
+
return /* @__PURE__ */ jsxs31("div", {
|
|
4530
|
+
className: "iquji-app-shell",
|
|
4531
|
+
children: [
|
|
4532
|
+
skipLinkLabel ? /* @__PURE__ */ jsx35("a", {
|
|
4533
|
+
className: "iquji-skip-link",
|
|
4534
|
+
href: `#${mainId}`,
|
|
4535
|
+
children: skipLinkLabel
|
|
4536
|
+
}) : null,
|
|
4537
|
+
/* @__PURE__ */ jsxs31("aside", {
|
|
4538
|
+
className: "iquji-app-shell__sidebar",
|
|
4539
|
+
children: [
|
|
4540
|
+
/* @__PURE__ */ jsx35("div", {
|
|
4541
|
+
className: "iquji-app-shell__brand",
|
|
4542
|
+
children: brand
|
|
4543
|
+
}),
|
|
4544
|
+
/* @__PURE__ */ jsx35("nav", {
|
|
4545
|
+
"aria-label": navigationLabel,
|
|
4546
|
+
className: "iquji-app-shell__navigation",
|
|
4547
|
+
children: navigationGroups?.length ? navigationGroups.map((group) => /* @__PURE__ */ jsxs31("section", {
|
|
4548
|
+
"aria-labelledby": `${group.id}-navigation-heading`,
|
|
4549
|
+
className: "iquji-app-shell__navigation-group",
|
|
4550
|
+
children: [
|
|
4551
|
+
/* @__PURE__ */ jsx35("h2", {
|
|
4552
|
+
className: "iquji-app-shell__navigation-heading",
|
|
4553
|
+
id: `${group.id}-navigation-heading`,
|
|
4554
|
+
children: group.label
|
|
4555
|
+
}),
|
|
4556
|
+
group.items.map(renderNavigationItem)
|
|
4557
|
+
]
|
|
4558
|
+
}, group.id)) : navigation2.map(renderNavigationItem)
|
|
4559
|
+
})
|
|
4560
|
+
]
|
|
4561
|
+
}),
|
|
4562
|
+
/* @__PURE__ */ jsxs31("div", {
|
|
4563
|
+
className: "iquji-app-shell__workspace",
|
|
4564
|
+
children: [
|
|
4565
|
+
/* @__PURE__ */ jsx35("header", {
|
|
4566
|
+
className: "iquji-app-shell__header",
|
|
4567
|
+
children: header
|
|
4568
|
+
}),
|
|
4569
|
+
/* @__PURE__ */ jsx35("main", {
|
|
4570
|
+
className: "iquji-app-shell__main",
|
|
4571
|
+
id: mainId,
|
|
4572
|
+
tabIndex: -1,
|
|
4573
|
+
children
|
|
4574
|
+
})
|
|
4575
|
+
]
|
|
4576
|
+
})
|
|
4577
|
+
]
|
|
4578
|
+
});
|
|
4579
|
+
}
|
|
4580
|
+
var IconButton = forwardRef3(function IconButton2({
|
|
4581
|
+
className,
|
|
4582
|
+
compact = false,
|
|
4583
|
+
disabled,
|
|
4584
|
+
icon,
|
|
4585
|
+
label,
|
|
4586
|
+
loading = false,
|
|
4587
|
+
type = "button",
|
|
4588
|
+
variant = "ghost",
|
|
4589
|
+
...buttonProps
|
|
4590
|
+
}, ref) {
|
|
4591
|
+
const names = [
|
|
4592
|
+
"iquji-icon-button",
|
|
4593
|
+
`iquji-icon-button--${variant}`,
|
|
4594
|
+
compact ? "iquji-icon-button--compact" : null,
|
|
4595
|
+
className
|
|
4596
|
+
].filter(Boolean).join(" ");
|
|
4597
|
+
return /* @__PURE__ */ jsx35("button", {
|
|
4598
|
+
...buttonProps,
|
|
4599
|
+
"aria-busy": loading || undefined,
|
|
4600
|
+
"aria-label": label,
|
|
4601
|
+
className: names,
|
|
4602
|
+
disabled: disabled || loading,
|
|
4603
|
+
ref,
|
|
4604
|
+
title: label,
|
|
4605
|
+
type,
|
|
4606
|
+
children: loading ? /* @__PURE__ */ jsx35("span", {
|
|
4607
|
+
"aria-hidden": "true",
|
|
4608
|
+
className: "iquji-button__spinner"
|
|
4609
|
+
}) : /* @__PURE__ */ jsx35("span", {
|
|
4610
|
+
"aria-hidden": "true",
|
|
4611
|
+
className: "iquji-icon-button__icon",
|
|
4612
|
+
children: icon
|
|
4613
|
+
})
|
|
4614
|
+
});
|
|
4615
|
+
});
|
|
4616
|
+
function StatusBadge({
|
|
4617
|
+
tone = "neutral",
|
|
4618
|
+
className,
|
|
4619
|
+
...props
|
|
4620
|
+
}) {
|
|
4621
|
+
const names = ["iquji-status-badge", className].filter(Boolean).join(" ");
|
|
4622
|
+
return /* @__PURE__ */ jsx35("span", {
|
|
4623
|
+
className: names,
|
|
4624
|
+
"data-tone": tone,
|
|
4625
|
+
...props
|
|
4626
|
+
});
|
|
4627
|
+
}
|
|
4628
|
+
var IqujiButton = forwardRef3(function IqujiButton2({
|
|
4629
|
+
allowLabelWrap = false,
|
|
4630
|
+
block = false,
|
|
4631
|
+
children,
|
|
4632
|
+
className,
|
|
4633
|
+
compact = false,
|
|
4634
|
+
disabled,
|
|
4635
|
+
iconEnd,
|
|
4636
|
+
iconStart,
|
|
4637
|
+
loading = false,
|
|
4638
|
+
type = "button",
|
|
4639
|
+
variant = "primary",
|
|
4640
|
+
...buttonProps
|
|
4641
|
+
}, ref) {
|
|
4642
|
+
const names = [
|
|
4643
|
+
"iquji-button",
|
|
4644
|
+
`iquji-button--${variant}`,
|
|
4645
|
+
compact ? "iquji-button--compact" : null,
|
|
4646
|
+
block ? "iquji-button--block" : null,
|
|
4647
|
+
allowLabelWrap ? "iquji-button--allow-label-wrap" : null,
|
|
4648
|
+
className
|
|
4649
|
+
].filter(Boolean).join(" ");
|
|
4650
|
+
const content = typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx35("span", {
|
|
4651
|
+
className: "iquji-button__label",
|
|
4652
|
+
children
|
|
4653
|
+
}) : children;
|
|
4654
|
+
return /* @__PURE__ */ jsxs31("button", {
|
|
4655
|
+
...buttonProps,
|
|
4656
|
+
"aria-busy": loading || undefined,
|
|
4657
|
+
className: names,
|
|
4658
|
+
disabled: disabled || loading,
|
|
4659
|
+
ref,
|
|
4660
|
+
type,
|
|
4661
|
+
children: [
|
|
4662
|
+
loading ? /* @__PURE__ */ jsx35("span", {
|
|
4663
|
+
className: "iquji-button__spinner",
|
|
4664
|
+
"aria-hidden": "true"
|
|
4665
|
+
}) : iconStart ? /* @__PURE__ */ jsx35("span", {
|
|
4666
|
+
className: "iquji-button__icon",
|
|
4667
|
+
"aria-hidden": "true",
|
|
4668
|
+
children: iconStart
|
|
4669
|
+
}) : null,
|
|
4670
|
+
content,
|
|
4671
|
+
!loading && iconEnd ? /* @__PURE__ */ jsx35("span", {
|
|
4672
|
+
className: "iquji-button__icon",
|
|
4673
|
+
"aria-hidden": "true",
|
|
4674
|
+
children: iconEnd
|
|
4675
|
+
}) : null
|
|
4676
|
+
]
|
|
4677
|
+
});
|
|
4678
|
+
});
|
|
4679
|
+
function IqujiButtonLink({
|
|
4680
|
+
"aria-disabled": ariaDisabled,
|
|
4681
|
+
allowLabelWrap = false,
|
|
4682
|
+
block = false,
|
|
4683
|
+
children,
|
|
4684
|
+
className,
|
|
4685
|
+
compact = false,
|
|
4686
|
+
disabled = false,
|
|
4687
|
+
href,
|
|
4688
|
+
iconEnd,
|
|
4689
|
+
iconStart,
|
|
4690
|
+
loading = false,
|
|
4691
|
+
onClick,
|
|
4692
|
+
tabIndex,
|
|
4693
|
+
variant = "primary",
|
|
4694
|
+
...anchorProps
|
|
4695
|
+
}) {
|
|
4696
|
+
const blocked = disabled || loading || ariaDisabled === true || ariaDisabled === "true";
|
|
4697
|
+
const names = [
|
|
4698
|
+
"iquji-button-link",
|
|
4699
|
+
`iquji-button-link--${variant}`,
|
|
4700
|
+
compact ? "iquji-button-link--compact" : null,
|
|
4701
|
+
block ? "iquji-button-link--block" : null,
|
|
4702
|
+
allowLabelWrap ? "iquji-button-link--allow-label-wrap" : null,
|
|
4703
|
+
className
|
|
4704
|
+
].filter(Boolean).join(" ");
|
|
4705
|
+
const content = typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx35("span", {
|
|
4706
|
+
className: "iquji-button__label",
|
|
4707
|
+
children
|
|
4708
|
+
}) : children;
|
|
4709
|
+
return /* @__PURE__ */ jsxs31("a", {
|
|
4710
|
+
...anchorProps,
|
|
4711
|
+
"aria-busy": loading || undefined,
|
|
4712
|
+
"aria-disabled": blocked || undefined,
|
|
4713
|
+
className: names,
|
|
4714
|
+
"data-loading": loading || undefined,
|
|
4715
|
+
href: blocked ? undefined : href,
|
|
4716
|
+
role: anchorProps.role ?? (blocked ? "link" : undefined),
|
|
4717
|
+
onClick: (event) => {
|
|
4718
|
+
if (blocked) {
|
|
4719
|
+
event.preventDefault();
|
|
4720
|
+
event.stopPropagation();
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
onClick?.(event);
|
|
4724
|
+
},
|
|
4725
|
+
tabIndex: blocked ? -1 : tabIndex,
|
|
4726
|
+
children: [
|
|
4727
|
+
loading ? /* @__PURE__ */ jsx35("span", {
|
|
4728
|
+
className: "iquji-button__spinner",
|
|
4729
|
+
"aria-hidden": "true"
|
|
4730
|
+
}) : iconStart ? /* @__PURE__ */ jsx35("span", {
|
|
4731
|
+
className: "iquji-button__icon",
|
|
4732
|
+
"aria-hidden": "true",
|
|
4733
|
+
children: iconStart
|
|
4734
|
+
}) : null,
|
|
4735
|
+
content,
|
|
4736
|
+
!loading && iconEnd ? /* @__PURE__ */ jsx35("span", {
|
|
4737
|
+
className: "iquji-button__icon",
|
|
4738
|
+
"aria-hidden": "true",
|
|
4739
|
+
children: iconEnd
|
|
4740
|
+
}) : null
|
|
4741
|
+
]
|
|
4742
|
+
});
|
|
4743
|
+
}
|
|
4744
|
+
function IqujiPanel({
|
|
4745
|
+
className,
|
|
4746
|
+
header,
|
|
4747
|
+
children,
|
|
4748
|
+
...sectionProps
|
|
4749
|
+
}) {
|
|
4750
|
+
const names = ["iquji-panel", className].filter(Boolean).join(" ");
|
|
4751
|
+
return /* @__PURE__ */ jsxs31("section", {
|
|
4752
|
+
className: names,
|
|
4753
|
+
...sectionProps,
|
|
4754
|
+
children: [
|
|
4755
|
+
header ? /* @__PURE__ */ jsx35("header", {
|
|
4756
|
+
className: "iquji-panel__header",
|
|
4757
|
+
children: header
|
|
4758
|
+
}) : null,
|
|
4759
|
+
children
|
|
4760
|
+
]
|
|
4761
|
+
});
|
|
4762
|
+
}
|
|
4763
|
+
function IqujiPageHeading({
|
|
4764
|
+
aside,
|
|
4765
|
+
className,
|
|
4766
|
+
kicker,
|
|
4767
|
+
summary,
|
|
4768
|
+
title,
|
|
4769
|
+
titleId
|
|
4770
|
+
}) {
|
|
4771
|
+
const names = ["iquji-page-heading", className].filter(Boolean).join(" ");
|
|
4772
|
+
return /* @__PURE__ */ jsxs31("div", {
|
|
4773
|
+
className: names,
|
|
4774
|
+
children: [
|
|
4775
|
+
/* @__PURE__ */ jsxs31("div", {
|
|
4776
|
+
children: [
|
|
4777
|
+
kicker ? /* @__PURE__ */ jsx35("p", {
|
|
4778
|
+
className: "iquji-page-heading__kicker",
|
|
4779
|
+
children: kicker
|
|
4780
|
+
}) : null,
|
|
4781
|
+
/* @__PURE__ */ jsx35("h1", {
|
|
4782
|
+
id: titleId,
|
|
4783
|
+
children: title
|
|
4784
|
+
}),
|
|
4785
|
+
summary ? /* @__PURE__ */ jsx35("p", {
|
|
4786
|
+
className: "iquji-page-heading__summary",
|
|
4787
|
+
children: summary
|
|
4788
|
+
}) : null
|
|
4789
|
+
]
|
|
4790
|
+
}),
|
|
4791
|
+
aside
|
|
4792
|
+
]
|
|
4793
|
+
});
|
|
4794
|
+
}
|
|
4795
|
+
function IqujiEmptyState({
|
|
4796
|
+
action,
|
|
4797
|
+
body,
|
|
4798
|
+
className,
|
|
4799
|
+
icon,
|
|
4800
|
+
title,
|
|
4801
|
+
titleId,
|
|
4802
|
+
children,
|
|
4803
|
+
...sectionProps
|
|
4804
|
+
}) {
|
|
4805
|
+
const names = ["iquji-empty-state", className].filter(Boolean).join(" ");
|
|
4806
|
+
return /* @__PURE__ */ jsxs31("section", {
|
|
4807
|
+
className: names,
|
|
4808
|
+
...sectionProps,
|
|
4809
|
+
children: [
|
|
4810
|
+
icon ? /* @__PURE__ */ jsx35("span", {
|
|
4811
|
+
className: "iquji-empty-state__icon",
|
|
4812
|
+
"aria-hidden": "true",
|
|
4813
|
+
children: icon
|
|
4814
|
+
}) : null,
|
|
4815
|
+
title ? /* @__PURE__ */ jsx35("h2", {
|
|
4816
|
+
id: titleId,
|
|
4817
|
+
children: title
|
|
4818
|
+
}) : null,
|
|
4819
|
+
body ? /* @__PURE__ */ jsx35("p", {
|
|
4820
|
+
children: body
|
|
4821
|
+
}) : null,
|
|
4822
|
+
children,
|
|
4823
|
+
action ? /* @__PURE__ */ jsx35("div", {
|
|
4824
|
+
className: "iquji-empty-state__action",
|
|
4825
|
+
children: action
|
|
4826
|
+
}) : null
|
|
4827
|
+
]
|
|
4828
|
+
});
|
|
4829
|
+
}
|
|
4830
|
+
function IqujiLoadingState({
|
|
4831
|
+
className,
|
|
4832
|
+
label,
|
|
4833
|
+
...divProps
|
|
4834
|
+
}) {
|
|
4835
|
+
const names = ["iquji-loading-state", className].filter(Boolean).join(" ");
|
|
4836
|
+
return /* @__PURE__ */ jsxs31("div", {
|
|
4837
|
+
"aria-busy": "true",
|
|
4838
|
+
"aria-live": "polite",
|
|
4839
|
+
className: names,
|
|
4840
|
+
role: "status",
|
|
4841
|
+
...divProps,
|
|
4842
|
+
children: [
|
|
4843
|
+
/* @__PURE__ */ jsx35("span", {
|
|
4844
|
+
className: "iquji-loading-state__spinner",
|
|
4845
|
+
"aria-hidden": "true"
|
|
4846
|
+
}),
|
|
4847
|
+
/* @__PURE__ */ jsx35("span", {
|
|
4848
|
+
children: label
|
|
4849
|
+
})
|
|
4850
|
+
]
|
|
4851
|
+
});
|
|
4852
|
+
}
|
|
4853
|
+
export {
|
|
4854
|
+
useIqujiOverlayContainer,
|
|
4855
|
+
useIqujiNotification,
|
|
4856
|
+
parseCalendarDate,
|
|
4857
|
+
normalizeIqujiColor,
|
|
4858
|
+
formatCalendarDate,
|
|
4859
|
+
StatusBadge,
|
|
4860
|
+
IqujiWorkbenchLayout,
|
|
4861
|
+
IqujiTooltip,
|
|
4862
|
+
IqujiTimeline,
|
|
4863
|
+
IqujiTextarea,
|
|
4864
|
+
IqujiTabs,
|
|
4865
|
+
IqujiTableFrame,
|
|
4866
|
+
IqujiSwitch,
|
|
4867
|
+
IqujiSkeleton,
|
|
4868
|
+
IqujiSettingsSwitchRow,
|
|
4869
|
+
IqujiSettingsSelectRow,
|
|
4870
|
+
IqujiSettingsSection,
|
|
4871
|
+
IqujiSettingsRow,
|
|
4872
|
+
IqujiSettingsNav,
|
|
4873
|
+
IqujiSettingsLayout,
|
|
4874
|
+
IqujiSettingsContent,
|
|
4875
|
+
IqujiSettingsActionRow,
|
|
4876
|
+
IqujiSelect,
|
|
4877
|
+
IqujiSegmentedControl,
|
|
4878
|
+
IqujiSearchDialog,
|
|
4879
|
+
IqujiScrollArea,
|
|
4880
|
+
IqujiRadio,
|
|
4881
|
+
IqujiProgressBar,
|
|
4882
|
+
IqujiPopover,
|
|
4883
|
+
IqujiPanel,
|
|
4884
|
+
IqujiPagination,
|
|
4885
|
+
IqujiPageHeading,
|
|
4886
|
+
IqujiPageHeader,
|
|
4887
|
+
IqujiOverlayScopeProvider,
|
|
4888
|
+
IqujiOverlayProvider,
|
|
4889
|
+
IqujiNotificationProvider,
|
|
4890
|
+
IqujiMultiSelect,
|
|
4891
|
+
IqujiLoadingState,
|
|
4892
|
+
IqujiInput,
|
|
4893
|
+
IqujiFormSteps,
|
|
4894
|
+
IqujiFormDialog,
|
|
4895
|
+
IqujiField,
|
|
4896
|
+
IqujiEmptyState,
|
|
4897
|
+
IqujiEmojiPicker,
|
|
4898
|
+
IqujiDropdownMenu,
|
|
4899
|
+
IqujiDrawer,
|
|
4900
|
+
IqujiDialog,
|
|
4901
|
+
IqujiDesktopTitleBar,
|
|
4902
|
+
IqujiDesktopTabStrip,
|
|
4903
|
+
IqujiDesktopShell,
|
|
4904
|
+
IqujiDesktopRail,
|
|
4905
|
+
IqujiDesktopAccountCard,
|
|
4906
|
+
IqujiDesktopAccount,
|
|
4907
|
+
IqujiDatePicker,
|
|
4908
|
+
IqujiDataTable,
|
|
4909
|
+
IqujiConfirmDialog,
|
|
4910
|
+
IqujiColorPicker,
|
|
4911
|
+
IqujiCheckbox,
|
|
4912
|
+
IqujiCalendar,
|
|
4913
|
+
IqujiButtonLink,
|
|
4914
|
+
IqujiButton,
|
|
4915
|
+
IqujiBadge,
|
|
4916
|
+
IqujiAsyncStateFrame,
|
|
4917
|
+
IqujiAlert,
|
|
4918
|
+
IconButton,
|
|
4919
|
+
AppShell
|
|
4920
|
+
};
|