@iris-ui-kit/react 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin.cjs +305 -14
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +33 -7
- package/dist/admin.d.ts +33 -7
- package/dist/admin.js +2 -1
- package/dist/behaviors.cjs +2 -1
- package/dist/behaviors.cjs.map +1 -1
- package/dist/behaviors.d.cts +2 -1
- package/dist/behaviors.d.ts +2 -1
- package/dist/behaviors.js +2 -1
- package/dist/{chunk-UWUUEZCD.js → chunk-B4RS5WKC.js} +2 -2
- package/dist/{chunk-UWUUEZCD.js.map → chunk-B4RS5WKC.js.map} +1 -1
- package/dist/{chunk-2TQSTINK.js → chunk-BCL32KSE.js} +4 -100
- package/dist/chunk-BCL32KSE.js.map +1 -0
- package/dist/chunk-K2F7SC2T.js +107 -0
- package/dist/chunk-K2F7SC2T.js.map +1 -0
- package/dist/{chunk-VWCJJRSC.js → chunk-XVXURJZQ.js} +205 -19
- package/dist/chunk-XVXURJZQ.js.map +1 -0
- package/dist/index.cjs +1281 -943
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +169 -98
- package/dist/index.d.ts +169 -98
- package/dist/index.js +800 -658
- package/dist/index.js.map +1 -1
- package/dist/skeletons.cjs.map +1 -1
- package/dist/skeletons.js +1 -1
- package/package.json +91 -11
- package/dist/chunk-2TQSTINK.js.map +0 -1
- package/dist/chunk-VWCJJRSC.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -7,17 +7,18 @@ import { useDataState } from './chunk-HEJGN6UI.js';
|
|
|
7
7
|
export { DATA_STATE_CLASS, __resetDataStateStyles, installDataStateStyles, useDataState, usePrefersReducedMotion } from './chunk-HEJGN6UI.js';
|
|
8
8
|
export { IrisProvider, PluginStoreContext, usePlugin, usePluginStore } from './chunk-IDD35UJ6.js';
|
|
9
9
|
export { createClientFetcher, createResourceController, useResourceController } from './chunk-TQ33XJIK.js';
|
|
10
|
-
import { IrisCheckbox } from './chunk-
|
|
11
|
-
export { IrisAlert, IrisButton, IrisCheckbox, IrisDashboardTemplate, IrisDivider, IrisFormField, IrisInput, IrisLoginTemplate, IrisPasswordInput } from './chunk-
|
|
10
|
+
import { IrisCheckbox } from './chunk-B4RS5WKC.js';
|
|
11
|
+
export { IrisAlert, IrisButton, IrisCheckbox, IrisDashboardTemplate, IrisDivider, IrisFormField, IrisInput, IrisLoginTemplate, IrisPasswordInput } from './chunk-B4RS5WKC.js';
|
|
12
12
|
export { IrisContainer, IrisDashboardCard, IrisDashboardGrid, IrisStack } from './chunk-ZKBDUWUD.js';
|
|
13
13
|
export { SkinProvider, SkinResolutionError, applySkin, builtinSkins, createSkinCatalog, createSkinEngine, createSkinRegistry, darkSkin, lightSkin, loadSkin, localStorageSkinStorage, memorySkinStorage, renderSkinStyle, resolveSkin, skinBootScript, skinError, skinToCssEntries, useSkin, useSkinContext, useSkinOptional, validateSkin } from './chunk-WIHBIDVJ.js';
|
|
14
|
-
import { IrisSlot, useMachine } from './chunk-
|
|
15
|
-
export { DropdownContext, IrisAdminBreadcrumb, IrisAdminLayout, IrisAdminTabs, IrisBreadcrumb, IrisBreadcrumbItem, IrisDropdown, IrisDropdownItem, IrisDropdownMenu, IrisDropdownSeparator, IrisDropdownTrigger, IrisIcon, IrisNavMenu, IrisSlot, createTabsNav, filterNavByAccess, findNavNode, findNavPath, firstLeaf, flattenNav, isBranch, isClosable, nodeAllowsRoles, useAdminShell, useDropdownContext, useMachine, useTabsNav, visibleNav } from './chunk-
|
|
14
|
+
import { IrisSlot, useMachine } from './chunk-XVXURJZQ.js';
|
|
15
|
+
export { DropdownContext, IrisAdminBreadcrumb, IrisAdminLayout, IrisAdminTabs, IrisBreadcrumb, IrisBreadcrumbItem, IrisDropdown, IrisDropdownItem, IrisDropdownMenu, IrisDropdownSeparator, IrisDropdownTrigger, IrisIcon, IrisNavMenu, IrisSlot, createAdminPreferences, createTabsNav, filterNavByAccess, findNavNode, findNavPath, firstLeaf, flattenNav, isBranch, isClosable, localStorageAdminPreferencesStorage, nodeAllowsRoles, useAdminPreferences, useAdminShell, useDropdownContext, useMachine, useTabsNav, visibleNav } from './chunk-XVXURJZQ.js';
|
|
16
16
|
export { ThemeProvider, useColorScheme, useDirection, useTheme, useThemeContext, useThemeOptional } from './chunk-XCK4RIXB.js';
|
|
17
17
|
export { IrisHeaderLayout, IrisSidebarLayout } from './chunk-J5FB2UB2.js';
|
|
18
18
|
export { useAsyncResource, usePaginatedResource } from './chunk-TO7YVSAI.js';
|
|
19
|
-
import { useDrag } from './chunk-
|
|
20
|
-
export { IrisClickOutside, IrisHotkey, IrisLongPress, IrisMovable, IrisResizable,
|
|
19
|
+
import { useDrag } from './chunk-BCL32KSE.js';
|
|
20
|
+
export { IrisClickOutside, IrisHotkey, IrisLongPress, IrisMovable, IrisResizable, useDrag } from './chunk-BCL32KSE.js';
|
|
21
|
+
export { IrisSortable, SORTABLE_ITEM_ATTR } from './chunk-K2F7SC2T.js';
|
|
21
22
|
export { createClientDataSource, createDataSource, createGroupedView, useDataSource, useGroupedView } from './chunk-53KFLVIZ.js';
|
|
22
23
|
export { IrisErrorBoundary } from './chunk-SORLRLS4.js';
|
|
23
24
|
import { useI18n } from './chunk-OMOTUHYI.js';
|
|
@@ -28,16 +29,61 @@ export { useDismiss, useFloating } from './chunk-6BMFMCMQ.js';
|
|
|
28
29
|
export { FormContext, IrisForm, useField, useFieldArray, useForm, useFormContext } from './chunk-DE6V6NOI.js';
|
|
29
30
|
import { useStore } from './chunk-RZNYIFV2.js';
|
|
30
31
|
export { useStore, useStoreSelector } from './chunk-RZNYIFV2.js';
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import { composeEventHandlers, createStore, createVirtualizer, createKeyboardNav, createSelectionModel, createHoverIntent, createFloatingMachine, generateId, createAutoDismiss, nextEnabledIndex, getPageRange, flattenLeafColumns, buildHeaderMatrix, createExpansion,
|
|
32
|
+
import * as React67 from 'react';
|
|
33
|
+
import { useState, useRef, useEffect } from 'react';
|
|
34
|
+
import { composeEventHandlers, createStore, createVirtualizer, createKeyboardNav, createReconnectingSource, createDisposableScope, createResilientFetcher, createSelectionModel, createHoverIntent, createFloatingMachine, generateId, createAutoDismiss, nextEnabledIndex, getPageRange, flattenLeafColumns, buildHeaderMatrix, createExpansion, flattenTree, withSortedChildren, createCellRange, computeVirtualRange, aggregate, toCsv, downloadFile, toSpreadsheetXml, startOfMonth, clampDate, isSameMonth, buildMonthMatrix, getWeekdayNames, formatMonthYear, startOfDay, endOfMonth, addMonths, isSameDay, isOutOfRange, formatLocalISO, createTreeSelection, rgbaToHsva, hexToRgba, hsvaToRgba, rgbToHex, clamp01, copyText, nextGridCell, compareValues, addDays } from '@iris-ui-kit/core';
|
|
34
35
|
export { addDays, addMonths, buildMonthMatrix, clamp01, clampDate, composeEventHandlers, createFloatingMachine, createMachine, createStore, endOfMonth, formatLocalISO, formatMonthYear, generateId, getPageRange, getWeekdayNames, hexToRgba, hsvToRgb, hsvaToRgba, isOutOfRange, isSameDay, isSameMonth, mergeProps, rgbToHex, rgbToHsv, rgbaToHsva, startOfDay, startOfMonth } from '@iris-ui-kit/core';
|
|
36
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
35
37
|
import { createPortal } from 'react-dom';
|
|
36
38
|
import { getDirection } from '@iris-ui-kit/theme';
|
|
37
39
|
export { applyTheme, createThemeStore, getCssVar, toCssVarName } from '@iris-ui-kit/theme';
|
|
38
40
|
export { ALL_TOKEN_NAMES, COLOR_TOKENS, RADII_TOKENS, SPACING_TOKENS, darkTheme, lightTheme } from '@iris-ui-kit/tokens';
|
|
39
41
|
export { createIconRegistry, defaultIconRegistry, defaultIcons, renderIconSvg, resolveIcon, resolveThemedIcon } from '@iris-ui-kit/icons';
|
|
40
42
|
|
|
43
|
+
function useReconnectingSource(connect, handlers, options) {
|
|
44
|
+
const [status, setStatus] = useState("idle");
|
|
45
|
+
const handlersRef = useRef(handlers);
|
|
46
|
+
handlersRef.current = handlers;
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const source = createReconnectingSource(
|
|
49
|
+
connect,
|
|
50
|
+
{
|
|
51
|
+
onMessage: (data) => handlersRef.current.onMessage?.(data),
|
|
52
|
+
onOpen: () => handlersRef.current.onOpen?.(),
|
|
53
|
+
onError: (err) => handlersRef.current.onError?.(err),
|
|
54
|
+
onClose: () => handlersRef.current.onClose?.(),
|
|
55
|
+
onStatus: (s) => setStatus(s)
|
|
56
|
+
},
|
|
57
|
+
options
|
|
58
|
+
);
|
|
59
|
+
source.open();
|
|
60
|
+
return () => source.close();
|
|
61
|
+
}, [connect, options]);
|
|
62
|
+
return status;
|
|
63
|
+
}
|
|
64
|
+
function useDisposableScope() {
|
|
65
|
+
const scopeRef = useRef(null);
|
|
66
|
+
if (scopeRef.current === null) {
|
|
67
|
+
scopeRef.current = createDisposableScope();
|
|
68
|
+
}
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const scope = scopeRef.current;
|
|
71
|
+
return () => scope.destroy();
|
|
72
|
+
}, []);
|
|
73
|
+
return scopeRef;
|
|
74
|
+
}
|
|
75
|
+
function useResilientFetcher(options) {
|
|
76
|
+
const ref = useRef(null);
|
|
77
|
+
if (ref.current === null) {
|
|
78
|
+
ref.current = createResilientFetcher(options);
|
|
79
|
+
}
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
return () => {
|
|
82
|
+
ref.current?.cache.clear();
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
return ref.current;
|
|
86
|
+
}
|
|
41
87
|
var TONE_TO_VAR = {
|
|
42
88
|
primary: "--iris-primary",
|
|
43
89
|
success: "--iris-success",
|
|
@@ -126,8 +172,8 @@ function IrisAvatar({
|
|
|
126
172
|
style,
|
|
127
173
|
...rest
|
|
128
174
|
}) {
|
|
129
|
-
const [failed, setFailed] =
|
|
130
|
-
|
|
175
|
+
const [failed, setFailed] = React67.useState(false);
|
|
176
|
+
React67.useEffect(() => {
|
|
131
177
|
setFailed(false);
|
|
132
178
|
}, [src]);
|
|
133
179
|
const px = resolveSize(size);
|
|
@@ -234,7 +280,7 @@ function IrisSpinner({
|
|
|
234
280
|
...rest
|
|
235
281
|
}) {
|
|
236
282
|
const { t } = useI18n();
|
|
237
|
-
|
|
283
|
+
React67.useEffect(installSpinnerStyles, []);
|
|
238
284
|
const px = resolveSize2(size);
|
|
239
285
|
const sw = strokeWidth || Math.max(1.5, Math.round(px * 0.12));
|
|
240
286
|
const resolvedLabel = label ?? t("spinner.loading");
|
|
@@ -441,7 +487,7 @@ function IrisSkeleton({
|
|
|
441
487
|
...rest
|
|
442
488
|
}) {
|
|
443
489
|
const { t } = useI18n();
|
|
444
|
-
|
|
490
|
+
React67.useEffect(installSkeletonStyles, []);
|
|
445
491
|
const w = width !== void 0 ? toCss(width) : defaultWidth(shape);
|
|
446
492
|
const h = height !== void 0 ? toCss(height) : defaultHeight(shape, width);
|
|
447
493
|
return /* @__PURE__ */ jsx(
|
|
@@ -533,7 +579,7 @@ function IrisProgress({
|
|
|
533
579
|
style,
|
|
534
580
|
...rest
|
|
535
581
|
}) {
|
|
536
|
-
|
|
582
|
+
React67.useEffect(installProgressStyles, []);
|
|
537
583
|
const isIndeterminate = indeterminate || value === null || value === void 0;
|
|
538
584
|
const clamped = !isIndeterminate && value !== null ? Math.max(0, Math.min(max, value)) : 0;
|
|
539
585
|
const percent = isIndeterminate ? 0 : clamped / Math.max(1, max) * 100;
|
|
@@ -795,7 +841,7 @@ var SIZE_MAP4 = {
|
|
|
795
841
|
md: { padding: "8px 12px", fontSize: "14px" },
|
|
796
842
|
lg: { padding: "10px 12px", fontSize: "16px" }
|
|
797
843
|
};
|
|
798
|
-
var IrisTextarea =
|
|
844
|
+
var IrisTextarea = React67.forwardRef(
|
|
799
845
|
function IrisTextarea2({
|
|
800
846
|
size = "md",
|
|
801
847
|
invalid = false,
|
|
@@ -811,10 +857,10 @@ var IrisTextarea = React68.forwardRef(
|
|
|
811
857
|
defaultValue,
|
|
812
858
|
...rest
|
|
813
859
|
}, ref) {
|
|
814
|
-
const [focused, setFocused] =
|
|
815
|
-
const innerRef =
|
|
816
|
-
|
|
817
|
-
const resize =
|
|
860
|
+
const [focused, setFocused] = React67.useState(false);
|
|
861
|
+
const innerRef = React67.useRef(null);
|
|
862
|
+
React67.useImperativeHandle(ref, () => innerRef.current, []);
|
|
863
|
+
const resize = React67.useCallback(() => {
|
|
818
864
|
const el = innerRef.current;
|
|
819
865
|
if (!el || !autosize) return;
|
|
820
866
|
const lineHeight = parseFloat(getComputedStyle(el).lineHeight || "0") || 20;
|
|
@@ -822,7 +868,7 @@ var IrisTextarea = React68.forwardRef(
|
|
|
822
868
|
const maxPx = maxRows > 0 ? lineHeight * maxRows : Infinity;
|
|
823
869
|
el.style.height = `${Math.min(maxPx, el.scrollHeight)}px`;
|
|
824
870
|
}, [autosize, maxRows]);
|
|
825
|
-
|
|
871
|
+
React67.useEffect(() => {
|
|
826
872
|
if (autosize) resize();
|
|
827
873
|
}, [autosize, resize, value]);
|
|
828
874
|
const sizeStyles = SIZE_MAP4[size];
|
|
@@ -894,7 +940,7 @@ var DIM_MAP = {
|
|
|
894
940
|
md: { width: "36px", height: "20px", thumb: "16px" },
|
|
895
941
|
lg: { width: "44px", height: "24px", thumb: "20px" }
|
|
896
942
|
};
|
|
897
|
-
var IrisSwitch =
|
|
943
|
+
var IrisSwitch = React67.forwardRef(function IrisSwitch2({
|
|
898
944
|
checked,
|
|
899
945
|
defaultChecked,
|
|
900
946
|
onChange,
|
|
@@ -905,7 +951,7 @@ var IrisSwitch = React68.forwardRef(function IrisSwitch2({
|
|
|
905
951
|
style,
|
|
906
952
|
...rest
|
|
907
953
|
}, ref) {
|
|
908
|
-
const [internalChecked, setInternalChecked] =
|
|
954
|
+
const [internalChecked, setInternalChecked] = React67.useState(Boolean(defaultChecked));
|
|
909
955
|
const isControlled = checked !== void 0;
|
|
910
956
|
const value = isControlled ? Boolean(checked) : internalChecked;
|
|
911
957
|
const handleChange = (e) => {
|
|
@@ -1000,7 +1046,7 @@ function roundToStep(value, step) {
|
|
|
1000
1046
|
const places = decimalsOf(step);
|
|
1001
1047
|
return Number(value.toFixed(places));
|
|
1002
1048
|
}
|
|
1003
|
-
var IrisNumberInput =
|
|
1049
|
+
var IrisNumberInput = React67.forwardRef(
|
|
1004
1050
|
function IrisNumberInput2({
|
|
1005
1051
|
value,
|
|
1006
1052
|
defaultValue = null,
|
|
@@ -1019,19 +1065,19 @@ var IrisNumberInput = React68.forwardRef(
|
|
|
1019
1065
|
}, ref) {
|
|
1020
1066
|
const { t } = useI18n();
|
|
1021
1067
|
const isControlled = value !== void 0;
|
|
1022
|
-
const [internal, setInternal] =
|
|
1068
|
+
const [internal, setInternal] = React67.useState(defaultValue ?? null);
|
|
1023
1069
|
const current = isControlled ? value : internal;
|
|
1024
|
-
const [rawText, setRawText] =
|
|
1070
|
+
const [rawText, setRawText] = React67.useState(
|
|
1025
1071
|
current === null || current === void 0 ? "" : String(current)
|
|
1026
1072
|
);
|
|
1027
|
-
|
|
1073
|
+
React67.useEffect(() => {
|
|
1028
1074
|
if (current === null || current === void 0) {
|
|
1029
1075
|
setRawText("");
|
|
1030
1076
|
} else {
|
|
1031
1077
|
setRawText(String(current));
|
|
1032
1078
|
}
|
|
1033
1079
|
}, [current]);
|
|
1034
|
-
const [focused, setFocused] =
|
|
1080
|
+
const [focused, setFocused] = React67.useState(false);
|
|
1035
1081
|
const setValue = (next) => {
|
|
1036
1082
|
if (next === null) {
|
|
1037
1083
|
if (!isControlled) setInternal(null);
|
|
@@ -1225,16 +1271,17 @@ function IrisOtpInput({
|
|
|
1225
1271
|
id,
|
|
1226
1272
|
ariaDescribedby,
|
|
1227
1273
|
style,
|
|
1228
|
-
className
|
|
1274
|
+
className,
|
|
1275
|
+
...rest
|
|
1229
1276
|
}) {
|
|
1230
1277
|
const { t } = useI18n();
|
|
1231
1278
|
const isControlled = valueProp !== void 0;
|
|
1232
|
-
const [internal, setInternal] =
|
|
1279
|
+
const [internal, setInternal] = React67.useState(
|
|
1233
1280
|
() => sanitize(defaultValue, type).slice(0, length)
|
|
1234
1281
|
);
|
|
1235
1282
|
const value = sanitize(isControlled ? valueProp : internal, type).slice(0, length);
|
|
1236
|
-
const cellsRef =
|
|
1237
|
-
const [focusedIndex, setFocusedIndex] =
|
|
1283
|
+
const cellsRef = React67.useRef([]);
|
|
1284
|
+
const [focusedIndex, setFocusedIndex] = React67.useState(-1);
|
|
1238
1285
|
const focusCell = (i) => {
|
|
1239
1286
|
const el = cellsRef.current[Math.max(0, Math.min(length - 1, i))];
|
|
1240
1287
|
if (el) {
|
|
@@ -1298,7 +1345,7 @@ function IrisOtpInput({
|
|
|
1298
1345
|
if (disabled) return;
|
|
1299
1346
|
writeFrom(i, e.clipboardData.getData("text"));
|
|
1300
1347
|
};
|
|
1301
|
-
|
|
1348
|
+
React67.useEffect(() => {
|
|
1302
1349
|
if (autoFocus) cellsRef.current[0]?.focus();
|
|
1303
1350
|
}, [autoFocus]);
|
|
1304
1351
|
const sz = SIZE_MAP6[size];
|
|
@@ -1311,6 +1358,7 @@ function IrisOtpInput({
|
|
|
1311
1358
|
role: "group",
|
|
1312
1359
|
"aria-disabled": disabled ? "true" : void 0,
|
|
1313
1360
|
className,
|
|
1361
|
+
...rest,
|
|
1314
1362
|
style: { display: "inline-flex", gap: 8, direction: "inherit", ...style },
|
|
1315
1363
|
children: Array.from({ length }, (_, i) => {
|
|
1316
1364
|
const char = value.charAt(i);
|
|
@@ -1388,14 +1436,15 @@ function IrisRating({
|
|
|
1388
1436
|
id,
|
|
1389
1437
|
ariaDescribedby,
|
|
1390
1438
|
style,
|
|
1391
|
-
className
|
|
1439
|
+
className,
|
|
1440
|
+
...rest
|
|
1392
1441
|
}) {
|
|
1393
1442
|
const { t } = useI18n();
|
|
1394
1443
|
const step = allowHalf ? 0.5 : 1;
|
|
1395
1444
|
const isControlled = valueProp !== void 0;
|
|
1396
|
-
const [internal, setInternal] =
|
|
1445
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
1397
1446
|
const value = clamp2(isControlled ? valueProp : internal, 0, max);
|
|
1398
|
-
const [hover, setHover] =
|
|
1447
|
+
const [hover, setHover] = React67.useState(null);
|
|
1399
1448
|
const interactive = !readonly && !disabled;
|
|
1400
1449
|
const display = hover ?? value;
|
|
1401
1450
|
const setValue = (next) => {
|
|
@@ -1463,6 +1512,7 @@ function IrisRating({
|
|
|
1463
1512
|
className,
|
|
1464
1513
|
onKeyDown: handleKeyDown,
|
|
1465
1514
|
onMouseLeave: () => setHover(null),
|
|
1515
|
+
...rest,
|
|
1466
1516
|
style: {
|
|
1467
1517
|
display: "inline-flex",
|
|
1468
1518
|
gap: Math.round(px * 0.18),
|
|
@@ -1534,20 +1584,21 @@ function IrisCombobox({
|
|
|
1534
1584
|
id,
|
|
1535
1585
|
ariaDescribedby,
|
|
1536
1586
|
style,
|
|
1537
|
-
className
|
|
1587
|
+
className,
|
|
1588
|
+
...rest
|
|
1538
1589
|
}) {
|
|
1539
1590
|
const { t } = useI18n();
|
|
1540
|
-
const reactId =
|
|
1591
|
+
const reactId = React67.useId();
|
|
1541
1592
|
const listboxId = `${reactId}-listbox`;
|
|
1542
1593
|
const optionId = (i) => `${reactId}-opt-${i}`;
|
|
1543
1594
|
const isControlled = valueProp !== void 0;
|
|
1544
|
-
const [internal, setInternal] =
|
|
1595
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
1545
1596
|
const currentValue = isControlled ? valueProp : internal;
|
|
1546
|
-
const [query, setQuery] =
|
|
1547
|
-
const [filtering, setFiltering] =
|
|
1548
|
-
const [open, setOpen] =
|
|
1549
|
-
const [activeIndex, setActiveIndex] =
|
|
1550
|
-
const [focused, setFocused] =
|
|
1597
|
+
const [query, setQuery] = React67.useState("");
|
|
1598
|
+
const [filtering, setFiltering] = React67.useState(false);
|
|
1599
|
+
const [open, setOpen] = React67.useState(false);
|
|
1600
|
+
const [activeIndex, setActiveIndex] = React67.useState(-1);
|
|
1601
|
+
const [focused, setFocused] = React67.useState(false);
|
|
1551
1602
|
const selected = options.find((o) => o.value === currentValue);
|
|
1552
1603
|
const display = filtering ? query : selected?.label ?? "";
|
|
1553
1604
|
const needle = query.trim().toLowerCase();
|
|
@@ -1617,6 +1668,7 @@ function IrisCombobox({
|
|
|
1617
1668
|
"data-iris-combobox-size": size,
|
|
1618
1669
|
"data-state": open ? "open" : "closed",
|
|
1619
1670
|
className,
|
|
1671
|
+
...rest,
|
|
1620
1672
|
style: { position: "relative", display: "inline-block", minWidth: 200, ...style },
|
|
1621
1673
|
children: [
|
|
1622
1674
|
/* @__PURE__ */ jsx(
|
|
@@ -1744,13 +1796,15 @@ function IrisTimeline({
|
|
|
1744
1796
|
items,
|
|
1745
1797
|
renderItem,
|
|
1746
1798
|
style,
|
|
1747
|
-
className
|
|
1799
|
+
className,
|
|
1800
|
+
...rest
|
|
1748
1801
|
}) {
|
|
1749
1802
|
return /* @__PURE__ */ jsx(
|
|
1750
1803
|
"ol",
|
|
1751
1804
|
{
|
|
1752
1805
|
"data-iris-timeline": "",
|
|
1753
1806
|
className,
|
|
1807
|
+
...rest,
|
|
1754
1808
|
style: { listStyle: "none", margin: 0, padding: 0, ...style },
|
|
1755
1809
|
children: items.map((item, i) => {
|
|
1756
1810
|
const isLast = i === items.length - 1;
|
|
@@ -1880,13 +1934,14 @@ function IrisCarousel({
|
|
|
1880
1934
|
showIndicators = true,
|
|
1881
1935
|
ariaLabel,
|
|
1882
1936
|
style,
|
|
1883
|
-
className
|
|
1937
|
+
className,
|
|
1938
|
+
...rest
|
|
1884
1939
|
}) {
|
|
1885
1940
|
const { t } = useI18n();
|
|
1886
|
-
const slides =
|
|
1941
|
+
const slides = React67.Children.toArray(children);
|
|
1887
1942
|
const count = slides.length;
|
|
1888
1943
|
const isControlled = indexProp !== void 0;
|
|
1889
|
-
const [internal, setInternal] =
|
|
1944
|
+
const [internal, setInternal] = React67.useState(defaultIndex);
|
|
1890
1945
|
const current = Math.min(
|
|
1891
1946
|
Math.max(0, isControlled ? indexProp : internal),
|
|
1892
1947
|
Math.max(0, count - 1)
|
|
@@ -1898,12 +1953,12 @@ function IrisCarousel({
|
|
|
1898
1953
|
if (!isControlled) setInternal(next);
|
|
1899
1954
|
onIndexChange?.(next);
|
|
1900
1955
|
};
|
|
1901
|
-
const onIndexChangeRef =
|
|
1956
|
+
const onIndexChangeRef = React67.useRef(onIndexChange);
|
|
1902
1957
|
onIndexChangeRef.current = onIndexChange;
|
|
1903
|
-
const [hovered, setHovered] =
|
|
1904
|
-
const [focusedWithin, setFocusedWithin] =
|
|
1958
|
+
const [hovered, setHovered] = React67.useState(false);
|
|
1959
|
+
const [focusedWithin, setFocusedWithin] = React67.useState(false);
|
|
1905
1960
|
const paused = pauseOnHover && hovered || focusedWithin;
|
|
1906
|
-
|
|
1961
|
+
React67.useEffect(() => {
|
|
1907
1962
|
if (!autoplay || paused || count <= 1 || prefersReducedMotion()) return;
|
|
1908
1963
|
const id = setTimeout(() => {
|
|
1909
1964
|
const target = (current + 1) % count;
|
|
@@ -1935,6 +1990,7 @@ function IrisCarousel({
|
|
|
1935
1990
|
onMouseLeave: () => setHovered(false),
|
|
1936
1991
|
onFocus: () => setFocusedWithin(true),
|
|
1937
1992
|
onBlur: () => setFocusedWithin(false),
|
|
1993
|
+
...rest,
|
|
1938
1994
|
style: { position: "relative", outline: "none", ...style },
|
|
1939
1995
|
children: [
|
|
1940
1996
|
/* @__PURE__ */ jsx(
|
|
@@ -2069,7 +2125,8 @@ function IrisStatistic({
|
|
|
2069
2125
|
trendValue,
|
|
2070
2126
|
size = "md",
|
|
2071
2127
|
style,
|
|
2072
|
-
className
|
|
2128
|
+
className,
|
|
2129
|
+
...rest
|
|
2073
2130
|
}) {
|
|
2074
2131
|
const affix = { fontSize: "0.6em", color: "var(--iris-muted)" };
|
|
2075
2132
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2078,6 +2135,7 @@ function IrisStatistic({
|
|
|
2078
2135
|
"data-iris-statistic": "",
|
|
2079
2136
|
"data-trend": trend,
|
|
2080
2137
|
className,
|
|
2138
|
+
...rest,
|
|
2081
2139
|
style: { display: "flex", flexDirection: "column", gap: 4, ...style },
|
|
2082
2140
|
children: [
|
|
2083
2141
|
label != null ? /* @__PURE__ */ jsx("div", { "data-iris-statistic-label": "", style: { fontSize: 13, color: "var(--iris-muted)" }, children: label }) : null,
|
|
@@ -2129,7 +2187,8 @@ function IrisDescriptions({
|
|
|
2129
2187
|
layout = "horizontal",
|
|
2130
2188
|
bordered = false,
|
|
2131
2189
|
style,
|
|
2132
|
-
className
|
|
2190
|
+
className,
|
|
2191
|
+
...rest
|
|
2133
2192
|
}) {
|
|
2134
2193
|
const horizontal = layout === "horizontal";
|
|
2135
2194
|
const pad3 = bordered ? "8px 12px" : void 0;
|
|
@@ -2153,6 +2212,7 @@ function IrisDescriptions({
|
|
|
2153
2212
|
"data-iris-descriptions": "",
|
|
2154
2213
|
"data-layout": layout,
|
|
2155
2214
|
className,
|
|
2215
|
+
...rest,
|
|
2156
2216
|
style: {
|
|
2157
2217
|
display: "grid",
|
|
2158
2218
|
gridTemplateColumns: horizontal ? `repeat(${columns}, max-content 1fr)` : `repeat(${columns}, 1fr)`,
|
|
@@ -2168,7 +2228,7 @@ function IrisDescriptions({
|
|
|
2168
2228
|
children: items.map((item, i) => {
|
|
2169
2229
|
const rowBorder = bordered && i >= columns ? "1px solid var(--iris-border)" : void 0;
|
|
2170
2230
|
if (horizontal) {
|
|
2171
|
-
return /* @__PURE__ */ jsxs(
|
|
2231
|
+
return /* @__PURE__ */ jsxs(React67.Fragment, { children: [
|
|
2172
2232
|
/* @__PURE__ */ jsx(
|
|
2173
2233
|
"dt",
|
|
2174
2234
|
{
|
|
@@ -2219,19 +2279,20 @@ function IrisTransfer({
|
|
|
2219
2279
|
searchable = false,
|
|
2220
2280
|
disabled = false,
|
|
2221
2281
|
style,
|
|
2222
|
-
className
|
|
2282
|
+
className,
|
|
2283
|
+
...rest
|
|
2223
2284
|
}) {
|
|
2224
2285
|
const safeOptions = options ?? [];
|
|
2225
2286
|
const { t } = useI18n();
|
|
2226
2287
|
const isControlled = valueProp !== void 0;
|
|
2227
|
-
const [internal, setInternal] =
|
|
2288
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
2228
2289
|
const value = isControlled ? valueProp : internal;
|
|
2229
2290
|
const valueSet = new Set(value);
|
|
2230
|
-
const sourceModelRef =
|
|
2291
|
+
const sourceModelRef = React67.useRef(null);
|
|
2231
2292
|
if (sourceModelRef.current === null) {
|
|
2232
2293
|
sourceModelRef.current = createSelectionModel({ mode: "multiple" });
|
|
2233
2294
|
}
|
|
2234
|
-
const targetModelRef =
|
|
2295
|
+
const targetModelRef = React67.useRef(null);
|
|
2235
2296
|
if (targetModelRef.current === null) {
|
|
2236
2297
|
targetModelRef.current = createSelectionModel({ mode: "multiple" });
|
|
2237
2298
|
}
|
|
@@ -2239,8 +2300,8 @@ function IrisTransfer({
|
|
|
2239
2300
|
const targetModel = targetModelRef.current;
|
|
2240
2301
|
const sourceChecked = useStore(sourceModel.store);
|
|
2241
2302
|
const targetChecked = useStore(targetModel.store);
|
|
2242
|
-
const [sourceQuery, setSourceQuery] =
|
|
2243
|
-
const [targetQuery, setTargetQuery] =
|
|
2303
|
+
const [sourceQuery, setSourceQuery] = React67.useState("");
|
|
2304
|
+
const [targetQuery, setTargetQuery] = React67.useState("");
|
|
2244
2305
|
const setValue = (next) => {
|
|
2245
2306
|
if (!isControlled) setInternal(next);
|
|
2246
2307
|
onValueChange?.(next);
|
|
@@ -2423,6 +2484,7 @@ function IrisTransfer({
|
|
|
2423
2484
|
"data-iris-transfer": "",
|
|
2424
2485
|
"data-disabled": disabled ? "true" : void 0,
|
|
2425
2486
|
className,
|
|
2487
|
+
...rest,
|
|
2426
2488
|
style: { display: "inline-flex", alignItems: "stretch", gap: 12, ...style },
|
|
2427
2489
|
children: [
|
|
2428
2490
|
renderPane("source"),
|
|
@@ -2474,45 +2536,55 @@ function IrisWatermark({
|
|
|
2474
2536
|
opacity = 0.15,
|
|
2475
2537
|
gap = 24,
|
|
2476
2538
|
style,
|
|
2477
|
-
className
|
|
2539
|
+
className,
|
|
2540
|
+
...rest
|
|
2478
2541
|
}) {
|
|
2479
|
-
return /* @__PURE__ */ jsxs(
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
"
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
pointerEvents: "none",
|
|
2491
|
-
userSelect: "none",
|
|
2492
|
-
display: "flex",
|
|
2493
|
-
flexWrap: "wrap",
|
|
2494
|
-
alignContent: "flex-start",
|
|
2495
|
-
gap,
|
|
2496
|
-
opacity
|
|
2497
|
-
},
|
|
2498
|
-
children: Array.from({ length: TILE_COUNT }, (_, i) => /* @__PURE__ */ jsx(
|
|
2499
|
-
"span",
|
|
2542
|
+
return /* @__PURE__ */ jsxs(
|
|
2543
|
+
"div",
|
|
2544
|
+
{
|
|
2545
|
+
"data-iris-watermark": "",
|
|
2546
|
+
className,
|
|
2547
|
+
...rest,
|
|
2548
|
+
style: { position: "relative", ...style },
|
|
2549
|
+
children: [
|
|
2550
|
+
children,
|
|
2551
|
+
/* @__PURE__ */ jsx(
|
|
2552
|
+
"div",
|
|
2500
2553
|
{
|
|
2501
|
-
"data-iris-watermark-
|
|
2554
|
+
"data-iris-watermark-overlay": "",
|
|
2555
|
+
"aria-hidden": "true",
|
|
2502
2556
|
style: {
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2557
|
+
position: "absolute",
|
|
2558
|
+
inset: 0,
|
|
2559
|
+
overflow: "hidden",
|
|
2560
|
+
pointerEvents: "none",
|
|
2561
|
+
userSelect: "none",
|
|
2562
|
+
display: "flex",
|
|
2563
|
+
flexWrap: "wrap",
|
|
2564
|
+
alignContent: "flex-start",
|
|
2565
|
+
gap,
|
|
2566
|
+
opacity
|
|
2508
2567
|
},
|
|
2509
|
-
children:
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2568
|
+
children: Array.from({ length: TILE_COUNT }, (_, i) => /* @__PURE__ */ jsx(
|
|
2569
|
+
"span",
|
|
2570
|
+
{
|
|
2571
|
+
"data-iris-watermark-tile": "",
|
|
2572
|
+
style: {
|
|
2573
|
+
transform: `rotate(${rotate}deg)`,
|
|
2574
|
+
fontSize,
|
|
2575
|
+
color,
|
|
2576
|
+
whiteSpace: "nowrap",
|
|
2577
|
+
lineHeight: 1
|
|
2578
|
+
},
|
|
2579
|
+
children: content
|
|
2580
|
+
},
|
|
2581
|
+
i
|
|
2582
|
+
))
|
|
2583
|
+
}
|
|
2584
|
+
)
|
|
2585
|
+
]
|
|
2586
|
+
}
|
|
2587
|
+
);
|
|
2516
2588
|
}
|
|
2517
2589
|
function prefersReducedMotion2() {
|
|
2518
2590
|
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -2526,13 +2598,14 @@ function IrisBackTop({
|
|
|
2526
2598
|
ariaLabel,
|
|
2527
2599
|
children,
|
|
2528
2600
|
style,
|
|
2529
|
-
className
|
|
2601
|
+
className,
|
|
2602
|
+
...rest
|
|
2530
2603
|
}) {
|
|
2531
2604
|
const { t } = useI18n();
|
|
2532
|
-
const [visible, setVisible] =
|
|
2533
|
-
const targetRef =
|
|
2605
|
+
const [visible, setVisible] = React67.useState(false);
|
|
2606
|
+
const targetRef = React67.useRef(target);
|
|
2534
2607
|
targetRef.current = target;
|
|
2535
|
-
|
|
2608
|
+
React67.useEffect(() => {
|
|
2536
2609
|
const el = resolve(targetRef.current);
|
|
2537
2610
|
const onScroll = () => {
|
|
2538
2611
|
const top = el === window ? window.scrollY ?? 0 : el.scrollTop;
|
|
@@ -2561,6 +2634,7 @@ function IrisBackTop({
|
|
|
2561
2634
|
"aria-label": ariaLabel ?? t("backTop.label"),
|
|
2562
2635
|
onClick: scrollToTop,
|
|
2563
2636
|
className,
|
|
2637
|
+
...rest,
|
|
2564
2638
|
style: {
|
|
2565
2639
|
position: "fixed",
|
|
2566
2640
|
insetInlineEnd: 24,
|
|
@@ -2592,19 +2666,20 @@ function IrisAffix({
|
|
|
2592
2666
|
onChange,
|
|
2593
2667
|
children,
|
|
2594
2668
|
style,
|
|
2595
|
-
className
|
|
2669
|
+
className,
|
|
2670
|
+
...rest
|
|
2596
2671
|
}) {
|
|
2597
|
-
const placeholderRef =
|
|
2598
|
-
const contentRef =
|
|
2599
|
-
const [affixed, setAffixed] =
|
|
2600
|
-
const [fixedStyle, setFixedStyle] =
|
|
2601
|
-
const [reserve, setReserve] =
|
|
2602
|
-
const onChangeRef =
|
|
2672
|
+
const placeholderRef = React67.useRef(null);
|
|
2673
|
+
const contentRef = React67.useRef(null);
|
|
2674
|
+
const [affixed, setAffixed] = React67.useState(false);
|
|
2675
|
+
const [fixedStyle, setFixedStyle] = React67.useState(void 0);
|
|
2676
|
+
const [reserve, setReserve] = React67.useState(void 0);
|
|
2677
|
+
const onChangeRef = React67.useRef(onChange);
|
|
2603
2678
|
onChangeRef.current = onChange;
|
|
2604
|
-
const targetRef =
|
|
2679
|
+
const targetRef = React67.useRef(target);
|
|
2605
2680
|
targetRef.current = target;
|
|
2606
|
-
const affixedRef =
|
|
2607
|
-
|
|
2681
|
+
const affixedRef = React67.useRef(false);
|
|
2682
|
+
React67.useEffect(() => {
|
|
2608
2683
|
const el = resolve2(targetRef.current);
|
|
2609
2684
|
const useTop = offsetTop != null || offsetBottom == null;
|
|
2610
2685
|
const ot = offsetTop ?? 0;
|
|
@@ -2646,6 +2721,7 @@ function IrisAffix({
|
|
|
2646
2721
|
"data-iris-affix": "",
|
|
2647
2722
|
"data-affixed": affixed ? "true" : void 0,
|
|
2648
2723
|
className,
|
|
2724
|
+
...rest,
|
|
2649
2725
|
style: { ...affixed && reserve ? { height: reserve } : null, ...style },
|
|
2650
2726
|
children: /* @__PURE__ */ jsx("div", { ref: contentRef, "data-iris-affix-content": "", style: affixed ? fixedStyle : void 0, children })
|
|
2651
2727
|
}
|
|
@@ -2665,7 +2741,8 @@ function IrisResult({
|
|
|
2665
2741
|
extra,
|
|
2666
2742
|
children,
|
|
2667
2743
|
style,
|
|
2668
|
-
className
|
|
2744
|
+
className,
|
|
2745
|
+
...rest
|
|
2669
2746
|
}) {
|
|
2670
2747
|
const s = STATUS[status];
|
|
2671
2748
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2674,6 +2751,7 @@ function IrisResult({
|
|
|
2674
2751
|
"data-iris-result": "",
|
|
2675
2752
|
"data-status": status,
|
|
2676
2753
|
className,
|
|
2754
|
+
...rest,
|
|
2677
2755
|
style: {
|
|
2678
2756
|
display: "flex",
|
|
2679
2757
|
flexDirection: "column",
|
|
@@ -2768,16 +2846,17 @@ function IrisTreeSelect({
|
|
|
2768
2846
|
id,
|
|
2769
2847
|
ariaDescribedby,
|
|
2770
2848
|
style,
|
|
2771
|
-
className
|
|
2849
|
+
className,
|
|
2850
|
+
...rest
|
|
2772
2851
|
}) {
|
|
2773
2852
|
const { t } = useI18n();
|
|
2774
|
-
const rootRef =
|
|
2853
|
+
const rootRef = React67.useRef(null);
|
|
2775
2854
|
const isControlled = value !== void 0;
|
|
2776
|
-
const [internal, setInternal] =
|
|
2855
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
2777
2856
|
const currentValue = isControlled ? value : internal;
|
|
2778
|
-
const [open, setOpen] =
|
|
2779
|
-
const [expanded, setExpanded] =
|
|
2780
|
-
const [focused, setFocused] =
|
|
2857
|
+
const [open, setOpen] = React67.useState(false);
|
|
2858
|
+
const [expanded, setExpanded] = React67.useState(() => new Set(defaultExpanded ?? []));
|
|
2859
|
+
const [focused, setFocused] = React67.useState(false);
|
|
2781
2860
|
const selected = currentValue ? findNode(options, currentValue) : void 0;
|
|
2782
2861
|
const selectNode = (node) => {
|
|
2783
2862
|
if (node.disabled) return;
|
|
@@ -2791,7 +2870,7 @@ function IrisTreeSelect({
|
|
|
2791
2870
|
else next.add(v);
|
|
2792
2871
|
return next;
|
|
2793
2872
|
});
|
|
2794
|
-
|
|
2873
|
+
React67.useEffect(() => {
|
|
2795
2874
|
if (!open) return;
|
|
2796
2875
|
const onDown = (e) => {
|
|
2797
2876
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
@@ -2879,6 +2958,7 @@ function IrisTreeSelect({
|
|
|
2879
2958
|
"data-iris-tree-select": "",
|
|
2880
2959
|
"data-state": open ? "open" : "closed",
|
|
2881
2960
|
className,
|
|
2961
|
+
...rest,
|
|
2882
2962
|
style: { position: "relative", display: "inline-block", minWidth: 220, ...style },
|
|
2883
2963
|
children: [
|
|
2884
2964
|
/* @__PURE__ */ jsxs(
|
|
@@ -2983,19 +3063,20 @@ function IrisMentions({
|
|
|
2983
3063
|
id,
|
|
2984
3064
|
ariaDescribedby,
|
|
2985
3065
|
style,
|
|
2986
|
-
className
|
|
3066
|
+
className,
|
|
3067
|
+
...rest
|
|
2987
3068
|
}) {
|
|
2988
|
-
const reactId =
|
|
3069
|
+
const reactId = React67.useId();
|
|
2989
3070
|
const listboxId = `${reactId}-listbox`;
|
|
2990
3071
|
const isControlled = value !== void 0;
|
|
2991
|
-
const [internal, setInternal] =
|
|
3072
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
2992
3073
|
const text = isControlled ? value : internal;
|
|
2993
|
-
const textareaRef =
|
|
2994
|
-
const startRef =
|
|
2995
|
-
const caretRef =
|
|
2996
|
-
const pendingCaret =
|
|
2997
|
-
const [active, setActive] =
|
|
2998
|
-
const [activeIndex, setActiveIndex] =
|
|
3074
|
+
const textareaRef = React67.useRef(null);
|
|
3075
|
+
const startRef = React67.useRef(0);
|
|
3076
|
+
const caretRef = React67.useRef(0);
|
|
3077
|
+
const pendingCaret = React67.useRef(null);
|
|
3078
|
+
const [active, setActive] = React67.useState(null);
|
|
3079
|
+
const [activeIndex, setActiveIndex] = React67.useState(0);
|
|
2999
3080
|
const filtered = active ? options.filter((o) => o.label.toLowerCase().includes(active.query.toLowerCase())) : [];
|
|
3000
3081
|
const open = active !== null && filtered.length > 0;
|
|
3001
3082
|
const setText = (next) => {
|
|
@@ -3043,7 +3124,7 @@ function IrisMentions({
|
|
|
3043
3124
|
setActive(null);
|
|
3044
3125
|
}
|
|
3045
3126
|
};
|
|
3046
|
-
|
|
3127
|
+
React67.useEffect(() => {
|
|
3047
3128
|
if (pendingCaret.current != null && textareaRef.current) {
|
|
3048
3129
|
const pos = pendingCaret.current;
|
|
3049
3130
|
textareaRef.current.focus();
|
|
@@ -3057,6 +3138,7 @@ function IrisMentions({
|
|
|
3057
3138
|
{
|
|
3058
3139
|
"data-iris-mentions": "",
|
|
3059
3140
|
className,
|
|
3141
|
+
...rest,
|
|
3060
3142
|
style: { position: "relative", display: "inline-block", minWidth: 240, ...style },
|
|
3061
3143
|
children: [
|
|
3062
3144
|
/* @__PURE__ */ jsx(
|
|
@@ -3184,16 +3266,17 @@ function IrisCascader({
|
|
|
3184
3266
|
id,
|
|
3185
3267
|
ariaDescribedby,
|
|
3186
3268
|
style,
|
|
3187
|
-
className
|
|
3269
|
+
className,
|
|
3270
|
+
...rest
|
|
3188
3271
|
}) {
|
|
3189
3272
|
const { t } = useI18n();
|
|
3190
|
-
const rootRef =
|
|
3273
|
+
const rootRef = React67.useRef(null);
|
|
3191
3274
|
const isControlled = value !== void 0;
|
|
3192
|
-
const [internal, setInternal] =
|
|
3275
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
3193
3276
|
const currentValue = isControlled ? value : internal;
|
|
3194
|
-
const [open, setOpen] =
|
|
3195
|
-
const [activePath, setActivePath] =
|
|
3196
|
-
const [focused, setFocused] =
|
|
3277
|
+
const [open, setOpen] = React67.useState(false);
|
|
3278
|
+
const [activePath, setActivePath] = React67.useState(defaultValue);
|
|
3279
|
+
const [focused, setFocused] = React67.useState(false);
|
|
3197
3280
|
const columns = buildColumns(options, activePath);
|
|
3198
3281
|
const labels = pathLabels(options, currentValue);
|
|
3199
3282
|
const toggleOpen = () => {
|
|
@@ -3214,7 +3297,7 @@ function IrisCascader({
|
|
|
3214
3297
|
setOpen(false);
|
|
3215
3298
|
}
|
|
3216
3299
|
};
|
|
3217
|
-
|
|
3300
|
+
React67.useEffect(() => {
|
|
3218
3301
|
if (!open) return;
|
|
3219
3302
|
const onDown = (e) => {
|
|
3220
3303
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
@@ -3231,6 +3314,7 @@ function IrisCascader({
|
|
|
3231
3314
|
"data-iris-cascader": "",
|
|
3232
3315
|
"data-state": open ? "open" : "closed",
|
|
3233
3316
|
className,
|
|
3317
|
+
...rest,
|
|
3234
3318
|
style: { position: "relative", display: "inline-block", minWidth: 240, ...style },
|
|
3235
3319
|
children: [
|
|
3236
3320
|
/* @__PURE__ */ jsxs(
|
|
@@ -3371,14 +3455,15 @@ function IrisSegmented({
|
|
|
3371
3455
|
block = false,
|
|
3372
3456
|
ariaLabel,
|
|
3373
3457
|
style,
|
|
3374
|
-
className
|
|
3458
|
+
className,
|
|
3459
|
+
...rest
|
|
3375
3460
|
}) {
|
|
3376
3461
|
const safeOptions = options ?? [];
|
|
3377
3462
|
const norm = normalize(safeOptions);
|
|
3378
3463
|
const isControlled = value !== void 0;
|
|
3379
|
-
const refs =
|
|
3464
|
+
const refs = React67.useRef([]);
|
|
3380
3465
|
const toKeys = (v) => v ? [v] : [];
|
|
3381
|
-
const modelRef =
|
|
3466
|
+
const modelRef = React67.useRef(null);
|
|
3382
3467
|
if (modelRef.current === null) {
|
|
3383
3468
|
modelRef.current = createSelectionModel({
|
|
3384
3469
|
mode: "single",
|
|
@@ -3388,16 +3473,16 @@ function IrisSegmented({
|
|
|
3388
3473
|
}
|
|
3389
3474
|
const model = modelRef.current;
|
|
3390
3475
|
const currentValue = useStore(model.store)[0] ?? "";
|
|
3391
|
-
|
|
3476
|
+
React67.useEffect(() => {
|
|
3392
3477
|
if (isControlled) model.sync(toKeys(value));
|
|
3393
3478
|
}, [value, isControlled, model]);
|
|
3394
3479
|
const displayValue = isControlled ? toKeys(value)[0] ?? "" : currentValue;
|
|
3395
3480
|
const rebaseToProp = () => {
|
|
3396
3481
|
if (isControlled) model.sync(toKeys(value));
|
|
3397
3482
|
};
|
|
3398
|
-
const isOptionEnabled =
|
|
3483
|
+
const isOptionEnabled = React67.useCallback((i) => !norm[i]?.disabled, [norm]);
|
|
3399
3484
|
const selectedIndex = norm.findIndex((o) => o.value === displayValue);
|
|
3400
|
-
const navRef =
|
|
3485
|
+
const navRef = React67.useRef(null);
|
|
3401
3486
|
if (navRef.current === null) {
|
|
3402
3487
|
navRef.current = createKeyboardNav({
|
|
3403
3488
|
count: norm.length,
|
|
@@ -3408,7 +3493,7 @@ function IrisSegmented({
|
|
|
3408
3493
|
});
|
|
3409
3494
|
}
|
|
3410
3495
|
const nav = navRef.current;
|
|
3411
|
-
|
|
3496
|
+
React67.useEffect(() => {
|
|
3412
3497
|
nav.reset(norm.length);
|
|
3413
3498
|
});
|
|
3414
3499
|
const rovingIndex = nav.index;
|
|
@@ -3429,6 +3514,7 @@ function IrisSegmented({
|
|
|
3429
3514
|
"data-iris-segmented-size": size,
|
|
3430
3515
|
"data-disabled": disabled ? "true" : void 0,
|
|
3431
3516
|
className,
|
|
3517
|
+
...rest,
|
|
3432
3518
|
onKeyDown: (e) => {
|
|
3433
3519
|
const action = nav.handleKeyDown({
|
|
3434
3520
|
key: e.key,
|
|
@@ -3498,15 +3584,16 @@ function IrisImage({
|
|
|
3498
3584
|
fallback,
|
|
3499
3585
|
preview = true,
|
|
3500
3586
|
style,
|
|
3501
|
-
className
|
|
3587
|
+
className,
|
|
3588
|
+
...rest
|
|
3502
3589
|
}) {
|
|
3503
3590
|
const { t } = useI18n();
|
|
3504
|
-
const [errored, setErrored] =
|
|
3505
|
-
const [open, setOpen] =
|
|
3506
|
-
|
|
3591
|
+
const [errored, setErrored] = React67.useState(false);
|
|
3592
|
+
const [open, setOpen] = React67.useState(false);
|
|
3593
|
+
React67.useEffect(() => {
|
|
3507
3594
|
setErrored(false);
|
|
3508
3595
|
}, [src]);
|
|
3509
|
-
|
|
3596
|
+
React67.useEffect(() => {
|
|
3510
3597
|
if (!open) return;
|
|
3511
3598
|
const onKey = (e) => {
|
|
3512
3599
|
if (e.key === "Escape") setOpen(false);
|
|
@@ -3528,6 +3615,7 @@ function IrisImage({
|
|
|
3528
3615
|
height,
|
|
3529
3616
|
loading: "lazy",
|
|
3530
3617
|
className,
|
|
3618
|
+
...rest,
|
|
3531
3619
|
onError: () => {
|
|
3532
3620
|
if (!errored) setErrored(true);
|
|
3533
3621
|
},
|
|
@@ -3625,15 +3713,16 @@ function IrisFloatButton({
|
|
|
3625
3713
|
actions,
|
|
3626
3714
|
offset,
|
|
3627
3715
|
style,
|
|
3628
|
-
className
|
|
3716
|
+
className,
|
|
3717
|
+
...rest
|
|
3629
3718
|
}) {
|
|
3630
3719
|
const { t } = useI18n();
|
|
3631
|
-
const rootRef =
|
|
3632
|
-
const [open, setOpen] =
|
|
3720
|
+
const rootRef = React67.useRef(null);
|
|
3721
|
+
const [open, setOpen] = React67.useState(false);
|
|
3633
3722
|
const hasActions = !!actions && actions.length > 0;
|
|
3634
3723
|
const content = children ?? icon ?? "+";
|
|
3635
3724
|
const radius = shape === "circle" ? "50%" : "var(--iris-radius-md, 6px)";
|
|
3636
|
-
|
|
3725
|
+
React67.useEffect(() => {
|
|
3637
3726
|
if (!open) return;
|
|
3638
3727
|
const onDown = (e) => {
|
|
3639
3728
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
@@ -3654,6 +3743,7 @@ function IrisFloatButton({
|
|
|
3654
3743
|
ref: rootRef,
|
|
3655
3744
|
"data-iris-float-button-root": "",
|
|
3656
3745
|
className,
|
|
3746
|
+
...rest,
|
|
3657
3747
|
style: {
|
|
3658
3748
|
position: "fixed",
|
|
3659
3749
|
insetBlockEnd: offset?.bottom ?? 24,
|
|
@@ -3727,19 +3817,20 @@ function IrisAnchor({
|
|
|
3727
3817
|
onChange,
|
|
3728
3818
|
ariaLabel,
|
|
3729
3819
|
style,
|
|
3730
|
-
className
|
|
3820
|
+
className,
|
|
3821
|
+
...rest
|
|
3731
3822
|
}) {
|
|
3732
|
-
const [active, setActive] =
|
|
3733
|
-
const activeRef =
|
|
3734
|
-
const itemsRef =
|
|
3823
|
+
const [active, setActive] = React67.useState("");
|
|
3824
|
+
const activeRef = React67.useRef("");
|
|
3825
|
+
const itemsRef = React67.useRef(items);
|
|
3735
3826
|
itemsRef.current = items;
|
|
3736
|
-
const offsetRef =
|
|
3827
|
+
const offsetRef = React67.useRef(offset);
|
|
3737
3828
|
offsetRef.current = offset;
|
|
3738
|
-
const onChangeRef =
|
|
3829
|
+
const onChangeRef = React67.useRef(onChange);
|
|
3739
3830
|
onChangeRef.current = onChange;
|
|
3740
|
-
const targetRef =
|
|
3831
|
+
const targetRef = React67.useRef(target);
|
|
3741
3832
|
targetRef.current = target;
|
|
3742
|
-
|
|
3833
|
+
React67.useEffect(() => {
|
|
3743
3834
|
const el = resolve3(targetRef.current);
|
|
3744
3835
|
const compute = () => {
|
|
3745
3836
|
let current = "";
|
|
@@ -3768,7 +3859,7 @@ function IrisAnchor({
|
|
|
3768
3859
|
setActive(href);
|
|
3769
3860
|
onChange?.(href);
|
|
3770
3861
|
};
|
|
3771
|
-
return /* @__PURE__ */ jsx("nav", { "data-iris-anchor": "", "aria-label": ariaLabel, className, style, children: /* @__PURE__ */ jsx(
|
|
3862
|
+
return /* @__PURE__ */ jsx("nav", { "data-iris-anchor": "", "aria-label": ariaLabel, className, ...rest, style, children: /* @__PURE__ */ jsx(
|
|
3772
3863
|
"ul",
|
|
3773
3864
|
{
|
|
3774
3865
|
style: {
|
|
@@ -3824,13 +3915,14 @@ function IrisCountdown({
|
|
|
3824
3915
|
onFinish,
|
|
3825
3916
|
size = "md",
|
|
3826
3917
|
style,
|
|
3827
|
-
className
|
|
3918
|
+
className,
|
|
3919
|
+
...rest
|
|
3828
3920
|
}) {
|
|
3829
|
-
const [now, setNow] =
|
|
3830
|
-
const onFinishRef =
|
|
3921
|
+
const [now, setNow] = React67.useState(() => Date.now());
|
|
3922
|
+
const onFinishRef = React67.useRef(onFinish);
|
|
3831
3923
|
onFinishRef.current = onFinish;
|
|
3832
|
-
const finishedRef =
|
|
3833
|
-
|
|
3924
|
+
const finishedRef = React67.useRef(false);
|
|
3925
|
+
React67.useEffect(() => {
|
|
3834
3926
|
finishedRef.current = false;
|
|
3835
3927
|
const tick = format.includes("SSS") ? 100 : 1e3;
|
|
3836
3928
|
const finishIfDue = (n, id2) => {
|
|
@@ -3858,6 +3950,7 @@ function IrisCountdown({
|
|
|
3858
3950
|
"data-iris-countdown": "",
|
|
3859
3951
|
"data-finished": finished ? "true" : void 0,
|
|
3860
3952
|
className,
|
|
3953
|
+
...rest,
|
|
3861
3954
|
style: { display: "flex", flexDirection: "column", gap: 4, ...style },
|
|
3862
3955
|
children: [
|
|
3863
3956
|
title != null ? /* @__PURE__ */ jsx("div", { "data-iris-countdown-title": "", style: { fontSize: 13, color: "var(--iris-muted)" }, children: title }) : null,
|
|
@@ -3911,23 +4004,24 @@ function IrisTour({
|
|
|
3911
4004
|
onClose,
|
|
3912
4005
|
onFinish,
|
|
3913
4006
|
style,
|
|
3914
|
-
className
|
|
4007
|
+
className,
|
|
4008
|
+
...rest
|
|
3915
4009
|
}) {
|
|
3916
4010
|
const { t } = useI18n();
|
|
3917
4011
|
const isControlled = open !== void 0;
|
|
3918
|
-
const [internalOpen, setInternalOpen] =
|
|
4012
|
+
const [internalOpen, setInternalOpen] = React67.useState(defaultOpen);
|
|
3919
4013
|
const isOpen = isControlled ? open : internalOpen;
|
|
3920
|
-
const [step, setStep] =
|
|
3921
|
-
const [spotlight, setSpotlight] =
|
|
3922
|
-
const wasOpen =
|
|
4014
|
+
const [step, setStep] = React67.useState(0);
|
|
4015
|
+
const [spotlight, setSpotlight] = React67.useState(null);
|
|
4016
|
+
const wasOpen = React67.useRef(false);
|
|
3923
4017
|
const total = steps.length;
|
|
3924
4018
|
const current = Math.min(step, Math.max(0, total - 1));
|
|
3925
4019
|
const stepData = steps[current];
|
|
3926
|
-
|
|
4020
|
+
React67.useEffect(() => {
|
|
3927
4021
|
if (isOpen && !wasOpen.current) setStep(0);
|
|
3928
4022
|
wasOpen.current = isOpen;
|
|
3929
4023
|
}, [isOpen]);
|
|
3930
|
-
|
|
4024
|
+
React67.useEffect(() => {
|
|
3931
4025
|
if (!isOpen || !stepData) return;
|
|
3932
4026
|
const el = stepData.target?.();
|
|
3933
4027
|
if (el) {
|
|
@@ -3941,7 +4035,7 @@ function IrisTour({
|
|
|
3941
4035
|
if (!isControlled) setInternalOpen(false);
|
|
3942
4036
|
onClose?.();
|
|
3943
4037
|
};
|
|
3944
|
-
|
|
4038
|
+
React67.useEffect(() => {
|
|
3945
4039
|
if (!isOpen) return;
|
|
3946
4040
|
const onKey = (e) => {
|
|
3947
4041
|
if (e.key === "Escape") close();
|
|
@@ -3969,7 +4063,7 @@ function IrisTour({
|
|
|
3969
4063
|
const spotlit = spotlight && spotlight.width > 0;
|
|
3970
4064
|
const cardPos = spotlit ? { top: spotlight.top + spotlight.height + 12, insetInlineStart: spotlight.left } : { top: "50%", insetInlineStart: "50%", transform: "translate(-50%, -50%)" };
|
|
3971
4065
|
const dialogLabel = typeof stepData.title === "string" ? stepData.title : t("tour.step", { current: current + 1, total });
|
|
3972
|
-
return /* @__PURE__ */ jsxs("div", { "data-iris-tour": "", className, style, children: [
|
|
4066
|
+
return /* @__PURE__ */ jsxs("div", { "data-iris-tour": "", className, ...rest, style, children: [
|
|
3973
4067
|
/* @__PURE__ */ jsx(
|
|
3974
4068
|
"div",
|
|
3975
4069
|
{
|
|
@@ -4055,14 +4149,15 @@ function IrisTagInput({
|
|
|
4055
4149
|
id,
|
|
4056
4150
|
ariaDescribedby,
|
|
4057
4151
|
style,
|
|
4058
|
-
className
|
|
4152
|
+
className,
|
|
4153
|
+
...rest
|
|
4059
4154
|
}) {
|
|
4060
4155
|
const { t } = useI18n();
|
|
4061
4156
|
const isControlled = value !== void 0;
|
|
4062
|
-
const [internal, setInternal] =
|
|
4157
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
4063
4158
|
const tags = isControlled ? value : internal;
|
|
4064
|
-
const [input, setInput] =
|
|
4065
|
-
const [focused, setFocused] =
|
|
4159
|
+
const [input, setInput] = React67.useState("");
|
|
4160
|
+
const [focused, setFocused] = React67.useState(false);
|
|
4066
4161
|
const setTags = (next) => {
|
|
4067
4162
|
if (!isControlled) setInternal(next);
|
|
4068
4163
|
onValueChange?.(next);
|
|
@@ -4109,6 +4204,7 @@ function IrisTagInput({
|
|
|
4109
4204
|
"data-iris-tag-input": "",
|
|
4110
4205
|
"data-state": invalid ? "invalid" : focused ? "focused" : "idle",
|
|
4111
4206
|
className,
|
|
4207
|
+
...rest,
|
|
4112
4208
|
style: {
|
|
4113
4209
|
display: "flex",
|
|
4114
4210
|
flexWrap: "wrap",
|
|
@@ -4213,11 +4309,12 @@ function IrisCopyButton({
|
|
|
4213
4309
|
disabled = false,
|
|
4214
4310
|
size = "md",
|
|
4215
4311
|
style,
|
|
4216
|
-
className
|
|
4312
|
+
className,
|
|
4313
|
+
...rest
|
|
4217
4314
|
}) {
|
|
4218
4315
|
const { t } = useI18n();
|
|
4219
|
-
const [copied, setCopied] =
|
|
4220
|
-
const timerRef =
|
|
4316
|
+
const [copied, setCopied] = React67.useState(false);
|
|
4317
|
+
const timerRef = React67.useRef(void 0);
|
|
4221
4318
|
const copy = async () => {
|
|
4222
4319
|
if (disabled) return;
|
|
4223
4320
|
try {
|
|
@@ -4232,7 +4329,7 @@ function IrisCopyButton({
|
|
|
4232
4329
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
4233
4330
|
timerRef.current = setTimeout(() => setCopied(false), timeout);
|
|
4234
4331
|
};
|
|
4235
|
-
|
|
4332
|
+
React67.useEffect(
|
|
4236
4333
|
() => () => {
|
|
4237
4334
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
4238
4335
|
},
|
|
@@ -4248,6 +4345,7 @@ function IrisCopyButton({
|
|
|
4248
4345
|
disabled,
|
|
4249
4346
|
onClick: copy,
|
|
4250
4347
|
className,
|
|
4348
|
+
...rest,
|
|
4251
4349
|
style: {
|
|
4252
4350
|
display: "inline-flex",
|
|
4253
4351
|
alignItems: "center",
|
|
@@ -4284,7 +4382,8 @@ function IrisProgressCircle({
|
|
|
4284
4382
|
format,
|
|
4285
4383
|
ariaLabel,
|
|
4286
4384
|
style,
|
|
4287
|
-
className
|
|
4385
|
+
className,
|
|
4386
|
+
...rest
|
|
4288
4387
|
}) {
|
|
4289
4388
|
const ratio = Math.max(0, Math.min(1, max > 0 ? value / max : 0));
|
|
4290
4389
|
const percent = Math.round(ratio * 100);
|
|
@@ -4304,6 +4403,7 @@ function IrisProgressCircle({
|
|
|
4304
4403
|
"aria-valuetext": `${percent}%`,
|
|
4305
4404
|
"aria-label": ariaLabel,
|
|
4306
4405
|
className,
|
|
4406
|
+
...rest,
|
|
4307
4407
|
style: { position: "relative", display: "inline-flex", width: size, height: size, ...style },
|
|
4308
4408
|
children: [
|
|
4309
4409
|
/* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, "aria-hidden": "true", children: [
|
|
@@ -4372,13 +4472,14 @@ function IrisSplitButton({
|
|
|
4372
4472
|
disabled = false,
|
|
4373
4473
|
menuAriaLabel,
|
|
4374
4474
|
style,
|
|
4375
|
-
className
|
|
4475
|
+
className,
|
|
4476
|
+
...rest
|
|
4376
4477
|
}) {
|
|
4377
4478
|
const { t } = useI18n();
|
|
4378
|
-
const rootRef =
|
|
4379
|
-
const [open, setOpen] =
|
|
4479
|
+
const rootRef = React67.useRef(null);
|
|
4480
|
+
const [open, setOpen] = React67.useState(false);
|
|
4380
4481
|
const hasActions = !!actions && actions.length > 0;
|
|
4381
|
-
|
|
4482
|
+
React67.useEffect(() => {
|
|
4382
4483
|
if (!open) return;
|
|
4383
4484
|
const onDown = (e) => {
|
|
4384
4485
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
@@ -4416,6 +4517,7 @@ function IrisSplitButton({
|
|
|
4416
4517
|
"data-iris-split-button": "",
|
|
4417
4518
|
"data-state": open ? "open" : "closed",
|
|
4418
4519
|
className,
|
|
4520
|
+
...rest,
|
|
4419
4521
|
style: { position: "relative", display: "inline-flex", ...style },
|
|
4420
4522
|
children: [
|
|
4421
4523
|
/* @__PURE__ */ jsx(
|
|
@@ -4515,7 +4617,8 @@ function IrisAspectRatio({
|
|
|
4515
4617
|
ratio = 16 / 9,
|
|
4516
4618
|
children,
|
|
4517
4619
|
style,
|
|
4518
|
-
className
|
|
4620
|
+
className,
|
|
4621
|
+
...rest
|
|
4519
4622
|
}) {
|
|
4520
4623
|
return /* @__PURE__ */ jsx(
|
|
4521
4624
|
"div",
|
|
@@ -4523,6 +4626,7 @@ function IrisAspectRatio({
|
|
|
4523
4626
|
"data-iris-aspect-ratio": "",
|
|
4524
4627
|
"data-ratio": ratio,
|
|
4525
4628
|
className,
|
|
4629
|
+
...rest,
|
|
4526
4630
|
style: { position: "relative", width: "100%", aspectRatio: String(ratio), ...style },
|
|
4527
4631
|
children: /* @__PURE__ */ jsx(
|
|
4528
4632
|
"div",
|
|
@@ -4564,7 +4668,8 @@ function IrisScrollArea({
|
|
|
4564
4668
|
axis = "vertical",
|
|
4565
4669
|
children,
|
|
4566
4670
|
style,
|
|
4567
|
-
className
|
|
4671
|
+
className,
|
|
4672
|
+
...rest
|
|
4568
4673
|
}) {
|
|
4569
4674
|
return /* @__PURE__ */ jsx(
|
|
4570
4675
|
"div",
|
|
@@ -4573,6 +4678,7 @@ function IrisScrollArea({
|
|
|
4573
4678
|
"data-axis": axis,
|
|
4574
4679
|
tabIndex: 0,
|
|
4575
4680
|
className,
|
|
4681
|
+
...rest,
|
|
4576
4682
|
style: { ...OVERFLOW[axis], maxHeight, maxWidth, outline: "none", ...style },
|
|
4577
4683
|
children
|
|
4578
4684
|
}
|
|
@@ -4584,7 +4690,8 @@ function IrisRibbon({
|
|
|
4584
4690
|
color,
|
|
4585
4691
|
children,
|
|
4586
4692
|
style,
|
|
4587
|
-
className
|
|
4693
|
+
className,
|
|
4694
|
+
...rest
|
|
4588
4695
|
}) {
|
|
4589
4696
|
const side = placement === "end" ? {
|
|
4590
4697
|
insetInlineEnd: 0,
|
|
@@ -4601,6 +4708,7 @@ function IrisRibbon({
|
|
|
4601
4708
|
"data-iris-ribbon": "",
|
|
4602
4709
|
"data-placement": placement,
|
|
4603
4710
|
className,
|
|
4711
|
+
...rest,
|
|
4604
4712
|
style: { position: "relative", display: "inline-block", ...style },
|
|
4605
4713
|
children: [
|
|
4606
4714
|
children,
|
|
@@ -4644,7 +4752,8 @@ function IrisGauge({
|
|
|
4644
4752
|
format,
|
|
4645
4753
|
ariaLabel,
|
|
4646
4754
|
style,
|
|
4647
|
-
className
|
|
4755
|
+
className,
|
|
4756
|
+
...rest
|
|
4648
4757
|
}) {
|
|
4649
4758
|
const span = max - min;
|
|
4650
4759
|
const ratio = Math.max(0, Math.min(1, span > 0 ? (value - min) / span : 0));
|
|
@@ -4667,6 +4776,7 @@ function IrisGauge({
|
|
|
4667
4776
|
"aria-valuetext": `${percent}%`,
|
|
4668
4777
|
"aria-label": ariaLabel,
|
|
4669
4778
|
className,
|
|
4779
|
+
...rest,
|
|
4670
4780
|
style: { position: "relative", display: "inline-block", width: size, ...style },
|
|
4671
4781
|
children: [
|
|
4672
4782
|
/* @__PURE__ */ jsxs("svg", { width: size, height, viewBox: `0 0 ${size} ${height}`, "aria-hidden": "true", children: [
|
|
@@ -4727,11 +4837,12 @@ function IrisMarquee({
|
|
|
4727
4837
|
pauseOnHover = true,
|
|
4728
4838
|
gap = 40,
|
|
4729
4839
|
style,
|
|
4730
|
-
className
|
|
4840
|
+
className,
|
|
4841
|
+
...rest
|
|
4731
4842
|
}) {
|
|
4732
|
-
const trackRef =
|
|
4733
|
-
const animRef =
|
|
4734
|
-
|
|
4843
|
+
const trackRef = React67.useRef(null);
|
|
4844
|
+
const animRef = React67.useRef(null);
|
|
4845
|
+
React67.useEffect(() => {
|
|
4735
4846
|
const el = trackRef.current;
|
|
4736
4847
|
if (!el || typeof el.animate !== "function" || prefersReducedMotion4()) return;
|
|
4737
4848
|
const frames = direction === "left" ? [{ transform: "translateX(0%)" }, { transform: "translateX(-50%)" }] : [{ transform: "translateX(-50%)" }, { transform: "translateX(0%)" }];
|
|
@@ -4765,6 +4876,7 @@ function IrisMarquee({
|
|
|
4765
4876
|
{
|
|
4766
4877
|
"data-iris-marquee": "",
|
|
4767
4878
|
className,
|
|
4879
|
+
...rest,
|
|
4768
4880
|
onMouseEnter: () => {
|
|
4769
4881
|
if (pauseOnHover) animRef.current?.pause();
|
|
4770
4882
|
},
|
|
@@ -4792,7 +4904,8 @@ function IrisMasonry({
|
|
|
4792
4904
|
gap = 16,
|
|
4793
4905
|
children,
|
|
4794
4906
|
style,
|
|
4795
|
-
className
|
|
4907
|
+
className,
|
|
4908
|
+
...rest
|
|
4796
4909
|
}) {
|
|
4797
4910
|
return /* @__PURE__ */ jsx(
|
|
4798
4911
|
"div",
|
|
@@ -4800,8 +4913,9 @@ function IrisMasonry({
|
|
|
4800
4913
|
"data-iris-masonry": "",
|
|
4801
4914
|
"data-columns": columns,
|
|
4802
4915
|
className,
|
|
4916
|
+
...rest,
|
|
4803
4917
|
style: { columnCount: columns, columnGap: gap, ...style },
|
|
4804
|
-
children:
|
|
4918
|
+
children: React67.Children.map(children, (child) => /* @__PURE__ */ jsx("div", { "data-iris-masonry-item": "", style: { breakInside: "avoid", marginBlockEnd: gap }, children: child }))
|
|
4805
4919
|
}
|
|
4806
4920
|
);
|
|
4807
4921
|
}
|
|
@@ -4811,7 +4925,8 @@ function IrisFieldset({
|
|
|
4811
4925
|
hint,
|
|
4812
4926
|
children,
|
|
4813
4927
|
style,
|
|
4814
|
-
className
|
|
4928
|
+
className,
|
|
4929
|
+
...rest
|
|
4815
4930
|
}) {
|
|
4816
4931
|
return /* @__PURE__ */ jsxs(
|
|
4817
4932
|
"fieldset",
|
|
@@ -4819,6 +4934,7 @@ function IrisFieldset({
|
|
|
4819
4934
|
"data-iris-fieldset": "",
|
|
4820
4935
|
disabled,
|
|
4821
4936
|
className,
|
|
4937
|
+
...rest,
|
|
4822
4938
|
style: {
|
|
4823
4939
|
minInlineSize: 0,
|
|
4824
4940
|
margin: 0,
|
|
@@ -4861,17 +4977,18 @@ function IrisToolbar({
|
|
|
4861
4977
|
orientation = "horizontal",
|
|
4862
4978
|
ariaLabel,
|
|
4863
4979
|
style,
|
|
4864
|
-
className
|
|
4980
|
+
className,
|
|
4981
|
+
...rest
|
|
4865
4982
|
}) {
|
|
4866
|
-
const ref =
|
|
4867
|
-
const items =
|
|
4983
|
+
const ref = React67.useRef(null);
|
|
4984
|
+
const items = React67.useCallback(() => {
|
|
4868
4985
|
const root = ref.current;
|
|
4869
4986
|
if (!root) return [];
|
|
4870
4987
|
return Array.from(root.querySelectorAll(SELECTOR)).filter(
|
|
4871
4988
|
(el) => !el.hasAttribute("disabled")
|
|
4872
4989
|
);
|
|
4873
4990
|
}, []);
|
|
4874
|
-
const navRef =
|
|
4991
|
+
const navRef = React67.useRef(null);
|
|
4875
4992
|
if (navRef.current === null) {
|
|
4876
4993
|
navRef.current = createKeyboardNav({
|
|
4877
4994
|
count: 0,
|
|
@@ -4881,10 +4998,10 @@ function IrisToolbar({
|
|
|
4881
4998
|
});
|
|
4882
4999
|
}
|
|
4883
5000
|
const nav = navRef.current;
|
|
4884
|
-
|
|
5001
|
+
React67.useEffect(() => {
|
|
4885
5002
|
nav.reset(items().length);
|
|
4886
5003
|
});
|
|
4887
|
-
|
|
5004
|
+
React67.useEffect(() => {
|
|
4888
5005
|
items().forEach((el, i) => {
|
|
4889
5006
|
el.tabIndex = i === 0 ? 0 : -1;
|
|
4890
5007
|
});
|
|
@@ -4925,6 +5042,7 @@ function IrisToolbar({
|
|
|
4925
5042
|
className,
|
|
4926
5043
|
onFocusCapture,
|
|
4927
5044
|
onKeyDown,
|
|
5045
|
+
...rest,
|
|
4928
5046
|
style: {
|
|
4929
5047
|
display: "inline-flex",
|
|
4930
5048
|
flexDirection: orientation === "vertical" ? "column" : "row",
|
|
@@ -4936,14 +5054,14 @@ function IrisToolbar({
|
|
|
4936
5054
|
}
|
|
4937
5055
|
);
|
|
4938
5056
|
}
|
|
4939
|
-
var RadioGroupContext =
|
|
5057
|
+
var RadioGroupContext = React67.createContext(null);
|
|
4940
5058
|
var DIM_MAP2 = {
|
|
4941
5059
|
sm: "14px",
|
|
4942
5060
|
md: "18px",
|
|
4943
5061
|
lg: "22px"
|
|
4944
5062
|
};
|
|
4945
|
-
var IrisRadio =
|
|
4946
|
-
const ctx =
|
|
5063
|
+
var IrisRadio = React67.forwardRef(function IrisRadio2({ value, size = "md", disabled, children, style, ...rest }, ref) {
|
|
5064
|
+
const ctx = React67.useContext(RadioGroupContext);
|
|
4947
5065
|
if (!ctx) throw new Error("IrisRadio must be used inside <IrisRadioGroup>");
|
|
4948
5066
|
const isDisabled = disabled || ctx.disabled;
|
|
4949
5067
|
const isChecked = ctx.value === value;
|
|
@@ -5028,7 +5146,7 @@ function IrisRadioGroup({
|
|
|
5028
5146
|
}) {
|
|
5029
5147
|
const isControlled = value !== void 0;
|
|
5030
5148
|
const toKeys = (v) => v == null ? [] : [v];
|
|
5031
|
-
const modelRef =
|
|
5149
|
+
const modelRef = React67.useRef(null);
|
|
5032
5150
|
if (modelRef.current === null) {
|
|
5033
5151
|
modelRef.current = createSelectionModel({
|
|
5034
5152
|
mode: "single",
|
|
@@ -5038,10 +5156,10 @@ function IrisRadioGroup({
|
|
|
5038
5156
|
}
|
|
5039
5157
|
const model = modelRef.current;
|
|
5040
5158
|
const current = useStore(model.store)[0] ?? null;
|
|
5041
|
-
|
|
5159
|
+
React67.useEffect(() => {
|
|
5042
5160
|
if (isControlled) model.sync(toKeys(value));
|
|
5043
5161
|
}, [value, isControlled, model]);
|
|
5044
|
-
const autoName =
|
|
5162
|
+
const autoName = React67.useId();
|
|
5045
5163
|
const groupName = name ?? `iris-radio-${autoName}`;
|
|
5046
5164
|
const setValue = (next) => {
|
|
5047
5165
|
if (disabled) return;
|
|
@@ -5073,18 +5191,19 @@ function IrisTooltip({
|
|
|
5073
5191
|
closeDelay = 0,
|
|
5074
5192
|
portalTarget,
|
|
5075
5193
|
disabled = false,
|
|
5076
|
-
children
|
|
5194
|
+
children,
|
|
5195
|
+
...rest
|
|
5077
5196
|
}) {
|
|
5078
|
-
const triggerRef =
|
|
5079
|
-
const floatingRef =
|
|
5080
|
-
const tooltipId =
|
|
5081
|
-
const [open, setOpen] =
|
|
5082
|
-
const hi =
|
|
5197
|
+
const triggerRef = React67.useRef(null);
|
|
5198
|
+
const floatingRef = React67.useRef(null);
|
|
5199
|
+
const tooltipId = React67.useId();
|
|
5200
|
+
const [open, setOpen] = React67.useState(false);
|
|
5201
|
+
const hi = React67.useMemo(
|
|
5083
5202
|
() => createHoverIntent({ openDelay, closeDelay, onChange: setOpen }),
|
|
5084
5203
|
[openDelay, closeDelay]
|
|
5085
5204
|
);
|
|
5086
|
-
|
|
5087
|
-
|
|
5205
|
+
React67.useEffect(() => () => hi.stop(), [hi]);
|
|
5206
|
+
React67.useEffect(() => {
|
|
5088
5207
|
if (!open) return;
|
|
5089
5208
|
const onKeyDown = (e) => {
|
|
5090
5209
|
if (e.key === "Escape") hi.close();
|
|
@@ -5092,7 +5211,7 @@ function IrisTooltip({
|
|
|
5092
5211
|
document.addEventListener("keydown", onKeyDown);
|
|
5093
5212
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5094
5213
|
}, [open, hi]);
|
|
5095
|
-
|
|
5214
|
+
React67.useEffect(() => {
|
|
5096
5215
|
if (disabled && open) hi.close();
|
|
5097
5216
|
}, [disabled, open, hi]);
|
|
5098
5217
|
const { floatingStyles } = useFloating({
|
|
@@ -5102,23 +5221,23 @@ function IrisTooltip({
|
|
|
5102
5221
|
placement,
|
|
5103
5222
|
offset
|
|
5104
5223
|
});
|
|
5105
|
-
const captureTriggerRef =
|
|
5224
|
+
const captureTriggerRef = React67.useCallback((el) => {
|
|
5106
5225
|
triggerRef.current = el;
|
|
5107
5226
|
}, []);
|
|
5108
|
-
const captureFloatingRef =
|
|
5227
|
+
const captureFloatingRef = React67.useCallback((el) => {
|
|
5109
5228
|
floatingRef.current = el;
|
|
5110
5229
|
}, []);
|
|
5111
|
-
if (!
|
|
5230
|
+
if (!React67.isValidElement(children)) {
|
|
5112
5231
|
if (process.env.NODE_ENV !== "production") {
|
|
5113
5232
|
console.warn("[iris-ui] IrisTooltip requires a single React element child as trigger");
|
|
5114
5233
|
}
|
|
5115
5234
|
return null;
|
|
5116
5235
|
}
|
|
5117
|
-
const handleEnter =
|
|
5236
|
+
const handleEnter = React67.useCallback(
|
|
5118
5237
|
() => openDelay > 0 ? hi.pointerEnter() : hi.open(),
|
|
5119
5238
|
[openDelay, hi]
|
|
5120
5239
|
);
|
|
5121
|
-
const handleLeave =
|
|
5240
|
+
const handleLeave = React67.useCallback(
|
|
5122
5241
|
() => closeDelay > 0 ? hi.pointerLeave() : hi.close(),
|
|
5123
5242
|
[closeDelay, hi]
|
|
5124
5243
|
);
|
|
@@ -5128,6 +5247,7 @@ function IrisTooltip({
|
|
|
5128
5247
|
ref: captureFloatingRef,
|
|
5129
5248
|
id: tooltipId,
|
|
5130
5249
|
role: "tooltip",
|
|
5250
|
+
...rest,
|
|
5131
5251
|
"data-state": "open",
|
|
5132
5252
|
"data-placement": placement,
|
|
5133
5253
|
style: {
|
|
@@ -5162,9 +5282,9 @@ function IrisTooltip({
|
|
|
5162
5282
|
portaled
|
|
5163
5283
|
] });
|
|
5164
5284
|
}
|
|
5165
|
-
var PopoverContext =
|
|
5285
|
+
var PopoverContext = React67.createContext(null);
|
|
5166
5286
|
function usePopoverContext(componentName) {
|
|
5167
|
-
const ctx =
|
|
5287
|
+
const ctx = React67.useContext(PopoverContext);
|
|
5168
5288
|
if (!ctx) {
|
|
5169
5289
|
throw new Error(`[iris-ui] ${componentName} must be a descendant of <IrisPopover>`);
|
|
5170
5290
|
}
|
|
@@ -5181,7 +5301,7 @@ function IrisPopover({
|
|
|
5181
5301
|
const isControlled = openProp !== void 0;
|
|
5182
5302
|
const [state, send] = useMachine(() => createFloatingMachine(defaultOpen ? "open" : "closed"));
|
|
5183
5303
|
const internalOpen = state.value === "open";
|
|
5184
|
-
|
|
5304
|
+
React67.useEffect(() => {
|
|
5185
5305
|
if (!isControlled) return;
|
|
5186
5306
|
const target = openProp ? "open" : "closed";
|
|
5187
5307
|
if (state.value !== target) {
|
|
@@ -5189,7 +5309,7 @@ function IrisPopover({
|
|
|
5189
5309
|
}
|
|
5190
5310
|
}, [isControlled, openProp, state.value, send]);
|
|
5191
5311
|
const open = isControlled ? Boolean(openProp) : internalOpen;
|
|
5192
|
-
const setOpen =
|
|
5312
|
+
const setOpen = React67.useCallback(
|
|
5193
5313
|
(next) => {
|
|
5194
5314
|
if (!isControlled) {
|
|
5195
5315
|
send({ type: next ? "OPEN" : "CLOSE" });
|
|
@@ -5198,10 +5318,10 @@ function IrisPopover({
|
|
|
5198
5318
|
},
|
|
5199
5319
|
[isControlled, send, onOpenChange]
|
|
5200
5320
|
);
|
|
5201
|
-
const triggerRef =
|
|
5202
|
-
const contentRef =
|
|
5203
|
-
const contentId =
|
|
5204
|
-
const value =
|
|
5321
|
+
const triggerRef = React67.useRef(null);
|
|
5322
|
+
const contentRef = React67.useRef(null);
|
|
5323
|
+
const contentId = React67.useId();
|
|
5324
|
+
const value = React67.useMemo(
|
|
5205
5325
|
() => ({
|
|
5206
5326
|
open,
|
|
5207
5327
|
setOpen,
|
|
@@ -5215,10 +5335,10 @@ function IrisPopover({
|
|
|
5215
5335
|
);
|
|
5216
5336
|
return /* @__PURE__ */ jsx(PopoverContext.Provider, { value, children });
|
|
5217
5337
|
}
|
|
5218
|
-
var IrisPopoverTrigger =
|
|
5338
|
+
var IrisPopoverTrigger = React67.forwardRef(
|
|
5219
5339
|
function IrisPopoverTrigger2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5220
5340
|
const ctx = usePopoverContext("IrisPopoverTrigger");
|
|
5221
|
-
const captureRef =
|
|
5341
|
+
const captureRef = React67.useCallback(
|
|
5222
5342
|
(el) => {
|
|
5223
5343
|
ctx.triggerRef.current = el;
|
|
5224
5344
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -5239,7 +5359,7 @@ var IrisPopoverTrigger = React68.forwardRef(
|
|
|
5239
5359
|
onClick: handleClick
|
|
5240
5360
|
};
|
|
5241
5361
|
if (asChild) {
|
|
5242
|
-
if (!
|
|
5362
|
+
if (!React67.isValidElement(children)) {
|
|
5243
5363
|
if (process.env.NODE_ENV !== "production") {
|
|
5244
5364
|
console.warn("[iris-ui] IrisPopoverTrigger asChild requires a single React element");
|
|
5245
5365
|
}
|
|
@@ -5259,11 +5379,11 @@ var IrisPopoverTrigger = React68.forwardRef(
|
|
|
5259
5379
|
);
|
|
5260
5380
|
}
|
|
5261
5381
|
);
|
|
5262
|
-
var IrisPopoverContent =
|
|
5382
|
+
var IrisPopoverContent = React67.forwardRef(
|
|
5263
5383
|
function IrisPopoverContent2({ portalTarget, autoFocus = true, restoreFocus = true, style, children, ...rest }, forwardedRef) {
|
|
5264
5384
|
const ctx = usePopoverContext("IrisPopoverContent");
|
|
5265
|
-
const innerRef =
|
|
5266
|
-
const captureRef =
|
|
5385
|
+
const innerRef = React67.useRef(null);
|
|
5386
|
+
const captureRef = React67.useCallback(
|
|
5267
5387
|
(el) => {
|
|
5268
5388
|
innerRef.current = el;
|
|
5269
5389
|
ctx.contentRef.current = el;
|
|
@@ -5285,9 +5405,9 @@ var IrisPopoverContent = React68.forwardRef(
|
|
|
5285
5405
|
exclude: [ctx.triggerRef, ctx.contentRef],
|
|
5286
5406
|
onDismiss: () => ctx.setOpen(false)
|
|
5287
5407
|
});
|
|
5288
|
-
const lastFocusedRef =
|
|
5289
|
-
const wasOpenRef =
|
|
5290
|
-
|
|
5408
|
+
const lastFocusedRef = React67.useRef(null);
|
|
5409
|
+
const wasOpenRef = React67.useRef(false);
|
|
5410
|
+
React67.useEffect(() => {
|
|
5291
5411
|
if (ctx.open && !wasOpenRef.current) {
|
|
5292
5412
|
lastFocusedRef.current = document.activeElement ?? ctx.triggerRef.current;
|
|
5293
5413
|
if (autoFocus) {
|
|
@@ -5335,9 +5455,9 @@ var IrisPopoverContent = React68.forwardRef(
|
|
|
5335
5455
|
return createPortal(node, portalTarget ?? document.body);
|
|
5336
5456
|
}
|
|
5337
5457
|
);
|
|
5338
|
-
var DialogContext =
|
|
5458
|
+
var DialogContext = React67.createContext(null);
|
|
5339
5459
|
function useDialogContext(componentName) {
|
|
5340
|
-
const ctx =
|
|
5460
|
+
const ctx = React67.useContext(DialogContext);
|
|
5341
5461
|
if (!ctx) {
|
|
5342
5462
|
throw new Error(`[iris-ui] ${componentName} must be a descendant of <IrisDialog>`);
|
|
5343
5463
|
}
|
|
@@ -5354,7 +5474,7 @@ function IrisDialog({
|
|
|
5354
5474
|
const isControlled = openProp !== void 0;
|
|
5355
5475
|
const [state, send] = useMachine(() => createFloatingMachine(defaultOpen ? "open" : "closed"));
|
|
5356
5476
|
const internalOpen = state.value === "open";
|
|
5357
|
-
|
|
5477
|
+
React67.useEffect(() => {
|
|
5358
5478
|
if (!isControlled) return;
|
|
5359
5479
|
const target = openProp ? "open" : "closed";
|
|
5360
5480
|
if (state.value !== target) {
|
|
@@ -5362,7 +5482,7 @@ function IrisDialog({
|
|
|
5362
5482
|
}
|
|
5363
5483
|
}, [isControlled, openProp, state.value, send]);
|
|
5364
5484
|
const open = isControlled ? Boolean(openProp) : internalOpen;
|
|
5365
|
-
const setOpen =
|
|
5485
|
+
const setOpen = React67.useCallback(
|
|
5366
5486
|
(next) => {
|
|
5367
5487
|
if (!isControlled) {
|
|
5368
5488
|
send({ type: next ? "OPEN" : "CLOSE" });
|
|
@@ -5371,16 +5491,16 @@ function IrisDialog({
|
|
|
5371
5491
|
},
|
|
5372
5492
|
[isControlled, send, onOpenChange]
|
|
5373
5493
|
);
|
|
5374
|
-
const triggerRef =
|
|
5375
|
-
const contentRef =
|
|
5376
|
-
const contentId =
|
|
5377
|
-
const titleId =
|
|
5378
|
-
const descriptionId =
|
|
5379
|
-
const titleCountRef =
|
|
5380
|
-
const descCountRef =
|
|
5381
|
-
const [hasTitle, setHasTitle] =
|
|
5382
|
-
const [hasDescription, setHasDescription] =
|
|
5383
|
-
const registerTitle =
|
|
5494
|
+
const triggerRef = React67.useRef(null);
|
|
5495
|
+
const contentRef = React67.useRef(null);
|
|
5496
|
+
const contentId = React67.useId();
|
|
5497
|
+
const titleId = React67.useId();
|
|
5498
|
+
const descriptionId = React67.useId();
|
|
5499
|
+
const titleCountRef = React67.useRef(0);
|
|
5500
|
+
const descCountRef = React67.useRef(0);
|
|
5501
|
+
const [hasTitle, setHasTitle] = React67.useState(false);
|
|
5502
|
+
const [hasDescription, setHasDescription] = React67.useState(false);
|
|
5503
|
+
const registerTitle = React67.useCallback(() => {
|
|
5384
5504
|
titleCountRef.current += 1;
|
|
5385
5505
|
setHasTitle(true);
|
|
5386
5506
|
return () => {
|
|
@@ -5388,7 +5508,7 @@ function IrisDialog({
|
|
|
5388
5508
|
if (titleCountRef.current <= 0) setHasTitle(false);
|
|
5389
5509
|
};
|
|
5390
5510
|
}, []);
|
|
5391
|
-
const registerDescription =
|
|
5511
|
+
const registerDescription = React67.useCallback(() => {
|
|
5392
5512
|
descCountRef.current += 1;
|
|
5393
5513
|
setHasDescription(true);
|
|
5394
5514
|
return () => {
|
|
@@ -5396,7 +5516,7 @@ function IrisDialog({
|
|
|
5396
5516
|
if (descCountRef.current <= 0) setHasDescription(false);
|
|
5397
5517
|
};
|
|
5398
5518
|
}, []);
|
|
5399
|
-
const value =
|
|
5519
|
+
const value = React67.useMemo(
|
|
5400
5520
|
() => ({
|
|
5401
5521
|
open,
|
|
5402
5522
|
setOpen,
|
|
@@ -5428,10 +5548,10 @@ function IrisDialog({
|
|
|
5428
5548
|
);
|
|
5429
5549
|
return /* @__PURE__ */ jsx(DialogContext.Provider, { value, children });
|
|
5430
5550
|
}
|
|
5431
|
-
var IrisDialogTrigger =
|
|
5551
|
+
var IrisDialogTrigger = React67.forwardRef(
|
|
5432
5552
|
function IrisDialogTrigger2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5433
5553
|
const ctx = useDialogContext("IrisDialogTrigger");
|
|
5434
|
-
const captureRef =
|
|
5554
|
+
const captureRef = React67.useCallback(
|
|
5435
5555
|
(el) => {
|
|
5436
5556
|
ctx.triggerRef.current = el;
|
|
5437
5557
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -5452,7 +5572,7 @@ var IrisDialogTrigger = React68.forwardRef(
|
|
|
5452
5572
|
onClick: handleClick
|
|
5453
5573
|
};
|
|
5454
5574
|
if (asChild) {
|
|
5455
|
-
if (!
|
|
5575
|
+
if (!React67.isValidElement(children)) {
|
|
5456
5576
|
if (process.env.NODE_ENV !== "production") {
|
|
5457
5577
|
console.warn("[iris-ui] IrisDialogTrigger asChild requires a single React element");
|
|
5458
5578
|
}
|
|
@@ -5472,11 +5592,11 @@ var IrisDialogTrigger = React68.forwardRef(
|
|
|
5472
5592
|
);
|
|
5473
5593
|
}
|
|
5474
5594
|
);
|
|
5475
|
-
var IrisDialogContent =
|
|
5595
|
+
var IrisDialogContent = React67.forwardRef(
|
|
5476
5596
|
function IrisDialogContent2({ portalTarget, style, onPointerDown, children, ...rest }, forwardedRef) {
|
|
5477
5597
|
const ctx = useDialogContext("IrisDialogContent");
|
|
5478
|
-
const innerRef =
|
|
5479
|
-
const captureRef =
|
|
5598
|
+
const innerRef = React67.useRef(null);
|
|
5599
|
+
const captureRef = React67.useCallback(
|
|
5480
5600
|
(el) => {
|
|
5481
5601
|
innerRef.current = el;
|
|
5482
5602
|
ctx.contentRef.current = el;
|
|
@@ -5492,7 +5612,7 @@ var IrisDialogContent = React68.forwardRef(
|
|
|
5492
5612
|
active: ctx.open,
|
|
5493
5613
|
returnFocusTo: ctx.triggerRef
|
|
5494
5614
|
});
|
|
5495
|
-
|
|
5615
|
+
React67.useEffect(() => {
|
|
5496
5616
|
if (!ctx.open || !ctx.closeOnEscape) return;
|
|
5497
5617
|
const onKeyDown = (e) => {
|
|
5498
5618
|
if (e.key === "Escape") {
|
|
@@ -5563,11 +5683,11 @@ var IrisDialogContent = React68.forwardRef(
|
|
|
5563
5683
|
return createPortal(node, portalTarget ?? document.body);
|
|
5564
5684
|
}
|
|
5565
5685
|
);
|
|
5566
|
-
var IrisDialogTitle =
|
|
5686
|
+
var IrisDialogTitle = React67.forwardRef(
|
|
5567
5687
|
function IrisDialogTitle2({ as = "h2", style, children, ...rest }, ref) {
|
|
5568
5688
|
const ctx = useDialogContext("IrisDialogTitle");
|
|
5569
|
-
|
|
5570
|
-
return
|
|
5689
|
+
React67.useEffect(() => ctx.registerTitle(), [ctx.registerTitle]);
|
|
5690
|
+
return React67.createElement(
|
|
5571
5691
|
as,
|
|
5572
5692
|
{
|
|
5573
5693
|
...rest,
|
|
@@ -5584,11 +5704,11 @@ var IrisDialogTitle = React68.forwardRef(
|
|
|
5584
5704
|
);
|
|
5585
5705
|
}
|
|
5586
5706
|
);
|
|
5587
|
-
var IrisDialogDescription =
|
|
5707
|
+
var IrisDialogDescription = React67.forwardRef(
|
|
5588
5708
|
function IrisDialogDescription2({ as = "p", style, children, ...rest }, ref) {
|
|
5589
5709
|
const ctx = useDialogContext("IrisDialogDescription");
|
|
5590
|
-
|
|
5591
|
-
return
|
|
5710
|
+
React67.useEffect(() => ctx.registerDescription(), [ctx.registerDescription]);
|
|
5711
|
+
return React67.createElement(
|
|
5592
5712
|
as,
|
|
5593
5713
|
{
|
|
5594
5714
|
...rest,
|
|
@@ -5605,7 +5725,7 @@ var IrisDialogDescription = React68.forwardRef(
|
|
|
5605
5725
|
);
|
|
5606
5726
|
}
|
|
5607
5727
|
);
|
|
5608
|
-
var IrisDialogClose =
|
|
5728
|
+
var IrisDialogClose = React67.forwardRef(
|
|
5609
5729
|
function IrisDialogClose2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5610
5730
|
const ctx = useDialogContext("IrisDialogClose");
|
|
5611
5731
|
const handleClick = composeEventHandlers(
|
|
@@ -5613,7 +5733,7 @@ var IrisDialogClose = React68.forwardRef(
|
|
|
5613
5733
|
() => ctx.setOpen(false)
|
|
5614
5734
|
);
|
|
5615
5735
|
if (asChild) {
|
|
5616
|
-
if (!
|
|
5736
|
+
if (!React67.isValidElement(children)) {
|
|
5617
5737
|
if (process.env.NODE_ENV !== "production") {
|
|
5618
5738
|
console.warn("[iris-ui] IrisDialogClose asChild requires a single React element");
|
|
5619
5739
|
}
|
|
@@ -5633,9 +5753,9 @@ var IrisDialogClose = React68.forwardRef(
|
|
|
5633
5753
|
);
|
|
5634
5754
|
}
|
|
5635
5755
|
);
|
|
5636
|
-
var DrawerContext =
|
|
5756
|
+
var DrawerContext = React67.createContext(null);
|
|
5637
5757
|
function useDrawerContext(componentName) {
|
|
5638
|
-
const ctx =
|
|
5758
|
+
const ctx = React67.useContext(DrawerContext);
|
|
5639
5759
|
if (!ctx) {
|
|
5640
5760
|
throw new Error(`[iris-ui] ${componentName} must be a descendant of <IrisDrawer>`);
|
|
5641
5761
|
}
|
|
@@ -5654,7 +5774,7 @@ function IrisDrawer({
|
|
|
5654
5774
|
const isControlled = openProp !== void 0;
|
|
5655
5775
|
const [state, send] = useMachine(() => createFloatingMachine(defaultOpen ? "open" : "closed"));
|
|
5656
5776
|
const internalOpen = state.value === "open";
|
|
5657
|
-
|
|
5777
|
+
React67.useEffect(() => {
|
|
5658
5778
|
if (!isControlled) return;
|
|
5659
5779
|
const target = openProp ? "open" : "closed";
|
|
5660
5780
|
if (state.value !== target) {
|
|
@@ -5662,7 +5782,7 @@ function IrisDrawer({
|
|
|
5662
5782
|
}
|
|
5663
5783
|
}, [isControlled, openProp, state.value, send]);
|
|
5664
5784
|
const open = isControlled ? Boolean(openProp) : internalOpen;
|
|
5665
|
-
const setOpen =
|
|
5785
|
+
const setOpen = React67.useCallback(
|
|
5666
5786
|
(next) => {
|
|
5667
5787
|
if (!isControlled) {
|
|
5668
5788
|
send({ type: next ? "OPEN" : "CLOSE" });
|
|
@@ -5671,14 +5791,14 @@ function IrisDrawer({
|
|
|
5671
5791
|
},
|
|
5672
5792
|
[isControlled, send, onOpenChange]
|
|
5673
5793
|
);
|
|
5674
|
-
const triggerRef =
|
|
5675
|
-
const contentRef =
|
|
5676
|
-
const id =
|
|
5794
|
+
const triggerRef = React67.useRef(null);
|
|
5795
|
+
const contentRef = React67.useRef(null);
|
|
5796
|
+
const id = React67.useId();
|
|
5677
5797
|
const contentId = `${id}-content`;
|
|
5678
5798
|
const titleId = `${id}-title`;
|
|
5679
|
-
const titleCountRef =
|
|
5680
|
-
const [hasTitle, setHasTitle] =
|
|
5681
|
-
const registerTitle =
|
|
5799
|
+
const titleCountRef = React67.useRef(0);
|
|
5800
|
+
const [hasTitle, setHasTitle] = React67.useState(false);
|
|
5801
|
+
const registerTitle = React67.useCallback(() => {
|
|
5682
5802
|
titleCountRef.current += 1;
|
|
5683
5803
|
setHasTitle(true);
|
|
5684
5804
|
return () => {
|
|
@@ -5686,7 +5806,7 @@ function IrisDrawer({
|
|
|
5686
5806
|
if (titleCountRef.current <= 0) setHasTitle(false);
|
|
5687
5807
|
};
|
|
5688
5808
|
}, []);
|
|
5689
|
-
const value =
|
|
5809
|
+
const value = React67.useMemo(
|
|
5690
5810
|
() => ({
|
|
5691
5811
|
open,
|
|
5692
5812
|
setOpen,
|
|
@@ -5716,10 +5836,10 @@ function IrisDrawer({
|
|
|
5716
5836
|
);
|
|
5717
5837
|
return /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children });
|
|
5718
5838
|
}
|
|
5719
|
-
var IrisDrawerTrigger =
|
|
5839
|
+
var IrisDrawerTrigger = React67.forwardRef(
|
|
5720
5840
|
function IrisDrawerTrigger2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5721
5841
|
const ctx = useDrawerContext("IrisDrawerTrigger");
|
|
5722
|
-
const captureRef =
|
|
5842
|
+
const captureRef = React67.useCallback(
|
|
5723
5843
|
(el) => {
|
|
5724
5844
|
ctx.triggerRef.current = el;
|
|
5725
5845
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -5740,7 +5860,7 @@ var IrisDrawerTrigger = React68.forwardRef(
|
|
|
5740
5860
|
onClick: handleClick
|
|
5741
5861
|
};
|
|
5742
5862
|
if (asChild) {
|
|
5743
|
-
if (!
|
|
5863
|
+
if (!React67.isValidElement(children)) {
|
|
5744
5864
|
if (process.env.NODE_ENV !== "production") {
|
|
5745
5865
|
console.warn("[iris-ui] IrisDrawerTrigger asChild requires a single React element");
|
|
5746
5866
|
}
|
|
@@ -5823,11 +5943,11 @@ function panelPositionStyle(side, size) {
|
|
|
5823
5943
|
}
|
|
5824
5944
|
}
|
|
5825
5945
|
var EXIT_DURATION_MS = 220;
|
|
5826
|
-
var IrisDrawerContent =
|
|
5946
|
+
var IrisDrawerContent = React67.forwardRef(
|
|
5827
5947
|
function IrisDrawerContent2({ portalTarget, style, children, ...rest }, forwardedRef) {
|
|
5828
5948
|
const ctx = useDrawerContext("IrisDrawerContent");
|
|
5829
|
-
const innerRef =
|
|
5830
|
-
const captureRef =
|
|
5949
|
+
const innerRef = React67.useRef(null);
|
|
5950
|
+
const captureRef = React67.useCallback(
|
|
5831
5951
|
(el) => {
|
|
5832
5952
|
innerRef.current = el;
|
|
5833
5953
|
ctx.contentRef.current = el;
|
|
@@ -5837,9 +5957,9 @@ var IrisDrawerContent = React68.forwardRef(
|
|
|
5837
5957
|
},
|
|
5838
5958
|
[ctx, forwardedRef]
|
|
5839
5959
|
);
|
|
5840
|
-
const [mounted, setMounted] =
|
|
5841
|
-
const [visible, setVisible] =
|
|
5842
|
-
|
|
5960
|
+
const [mounted, setMounted] = React67.useState(ctx.open);
|
|
5961
|
+
const [visible, setVisible] = React67.useState(ctx.open);
|
|
5962
|
+
React67.useEffect(() => {
|
|
5843
5963
|
if (ctx.open) {
|
|
5844
5964
|
setMounted(true);
|
|
5845
5965
|
const raf = requestAnimationFrame(() => setVisible(true));
|
|
@@ -5856,7 +5976,7 @@ var IrisDrawerContent = React68.forwardRef(
|
|
|
5856
5976
|
active: ctx.open,
|
|
5857
5977
|
returnFocusTo: ctx.triggerRef
|
|
5858
5978
|
});
|
|
5859
|
-
|
|
5979
|
+
React67.useEffect(() => {
|
|
5860
5980
|
if (!ctx.open || !ctx.closeOnEscape) return;
|
|
5861
5981
|
const onKeyDown = (e) => {
|
|
5862
5982
|
if (e.key === "Escape") {
|
|
@@ -5922,10 +6042,10 @@ var IrisDrawerContent = React68.forwardRef(
|
|
|
5922
6042
|
return createPortal(node, portalTarget ?? document.body);
|
|
5923
6043
|
}
|
|
5924
6044
|
);
|
|
5925
|
-
var IrisDrawerTitle =
|
|
6045
|
+
var IrisDrawerTitle = React67.forwardRef(
|
|
5926
6046
|
function IrisDrawerTitle2({ style, children, ...rest }, ref) {
|
|
5927
6047
|
const ctx = useDrawerContext("IrisDrawerTitle");
|
|
5928
|
-
|
|
6048
|
+
React67.useEffect(() => ctx.registerTitle(), [ctx.registerTitle]);
|
|
5929
6049
|
return /* @__PURE__ */ jsx(
|
|
5930
6050
|
"h2",
|
|
5931
6051
|
{
|
|
@@ -5946,7 +6066,7 @@ var IrisDrawerTitle = React68.forwardRef(
|
|
|
5946
6066
|
);
|
|
5947
6067
|
}
|
|
5948
6068
|
);
|
|
5949
|
-
var IrisDrawerClose =
|
|
6069
|
+
var IrisDrawerClose = React67.forwardRef(
|
|
5950
6070
|
function IrisDrawerClose2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5951
6071
|
const ctx = useDrawerContext("IrisDrawerClose");
|
|
5952
6072
|
const handleClick = composeEventHandlers(
|
|
@@ -5954,7 +6074,7 @@ var IrisDrawerClose = React68.forwardRef(
|
|
|
5954
6074
|
() => ctx.setOpen(false)
|
|
5955
6075
|
);
|
|
5956
6076
|
if (asChild) {
|
|
5957
|
-
if (!
|
|
6077
|
+
if (!React67.isValidElement(children)) {
|
|
5958
6078
|
if (process.env.NODE_ENV !== "production") {
|
|
5959
6079
|
console.warn("[iris-ui] IrisDrawerClose asChild requires a single React element");
|
|
5960
6080
|
}
|
|
@@ -6086,24 +6206,24 @@ function IrisToastViewport({
|
|
|
6086
6206
|
...rest
|
|
6087
6207
|
}) {
|
|
6088
6208
|
const { t } = useI18n();
|
|
6089
|
-
const allToasts =
|
|
6090
|
-
const toasts =
|
|
6209
|
+
const allToasts = React67.useSyncExternalStore(subscribeToasts, getToasts, () => []);
|
|
6210
|
+
const toasts = React67.useMemo(
|
|
6091
6211
|
() => allToasts.length > max ? allToasts.slice(-max) : allToasts,
|
|
6092
6212
|
[allToasts, max]
|
|
6093
6213
|
);
|
|
6094
|
-
const [hovered, setHovered] =
|
|
6095
|
-
const dismissersRef =
|
|
6214
|
+
const [hovered, setHovered] = React67.useState(false);
|
|
6215
|
+
const dismissersRef = React67.useRef(/* @__PURE__ */ new Map());
|
|
6096
6216
|
const SWIPE_DISMISS_PX = 80;
|
|
6097
|
-
const [drag, setDrag] =
|
|
6098
|
-
const dragRef =
|
|
6099
|
-
const cancelDismisser =
|
|
6217
|
+
const [drag, setDrag] = React67.useState(null);
|
|
6218
|
+
const dragRef = React67.useRef(null);
|
|
6219
|
+
const cancelDismisser = React67.useCallback((id) => {
|
|
6100
6220
|
const d = dismissersRef.current.get(id);
|
|
6101
6221
|
if (d) {
|
|
6102
6222
|
d.cancel();
|
|
6103
6223
|
dismissersRef.current.delete(id);
|
|
6104
6224
|
}
|
|
6105
6225
|
}, []);
|
|
6106
|
-
const armDismisser =
|
|
6226
|
+
const armDismisser = React67.useCallback((toast) => {
|
|
6107
6227
|
if (!toast.duration || toast.duration === Infinity) return;
|
|
6108
6228
|
const remaining = Math.max(0, toast.createdAt + toast.duration - Date.now());
|
|
6109
6229
|
const dismisser = createAutoDismiss({
|
|
@@ -6116,7 +6236,7 @@ function IrisToastViewport({
|
|
|
6116
6236
|
dismissersRef.current.set(toast.id, dismisser);
|
|
6117
6237
|
dismisser.start();
|
|
6118
6238
|
}, []);
|
|
6119
|
-
|
|
6239
|
+
React67.useEffect(() => {
|
|
6120
6240
|
const liveIds = new Set(toasts.map((t2) => t2.id));
|
|
6121
6241
|
for (const id of Array.from(dismissersRef.current.keys())) {
|
|
6122
6242
|
if (!liveIds.has(id)) cancelDismisser(id);
|
|
@@ -6128,14 +6248,14 @@ function IrisToastViewport({
|
|
|
6128
6248
|
}
|
|
6129
6249
|
}
|
|
6130
6250
|
}, [toasts, hovered, armDismisser, cancelDismisser]);
|
|
6131
|
-
|
|
6251
|
+
React67.useEffect(() => {
|
|
6132
6252
|
if (hovered) {
|
|
6133
6253
|
for (const d of dismissersRef.current.values()) d.pause();
|
|
6134
6254
|
} else {
|
|
6135
6255
|
for (const d of dismissersRef.current.values()) d.resume();
|
|
6136
6256
|
}
|
|
6137
6257
|
}, [hovered]);
|
|
6138
|
-
|
|
6258
|
+
React67.useEffect(() => {
|
|
6139
6259
|
const dismissers = dismissersRef.current;
|
|
6140
6260
|
return () => {
|
|
6141
6261
|
for (const d of dismissers.values()) d.cancel();
|
|
@@ -6270,9 +6390,9 @@ function IrisToastViewport({
|
|
|
6270
6390
|
if (typeof document === "undefined") return null;
|
|
6271
6391
|
return createPortal(node, portalTarget ?? document.body);
|
|
6272
6392
|
}
|
|
6273
|
-
var TabsContext =
|
|
6393
|
+
var TabsContext = React67.createContext(null);
|
|
6274
6394
|
function useTabsContext(componentName) {
|
|
6275
|
-
const ctx =
|
|
6395
|
+
const ctx = React67.useContext(TabsContext);
|
|
6276
6396
|
if (!ctx) {
|
|
6277
6397
|
throw new Error(`[iris-ui] ${componentName} must be inside an <IrisTabs>`);
|
|
6278
6398
|
}
|
|
@@ -6288,24 +6408,24 @@ function IrisTabs({
|
|
|
6288
6408
|
children
|
|
6289
6409
|
}) {
|
|
6290
6410
|
const isControlled = valueProp !== void 0;
|
|
6291
|
-
const [internalValue, setInternalValue] =
|
|
6411
|
+
const [internalValue, setInternalValue] = React67.useState(defaultValue ?? null);
|
|
6292
6412
|
const effectiveValue = isControlled ? valueProp : internalValue;
|
|
6293
|
-
const setValue =
|
|
6413
|
+
const setValue = React67.useCallback(
|
|
6294
6414
|
(next) => {
|
|
6295
6415
|
if (!isControlled) setInternalValue(next);
|
|
6296
6416
|
onValueChange?.(next);
|
|
6297
6417
|
},
|
|
6298
6418
|
[isControlled, onValueChange]
|
|
6299
6419
|
);
|
|
6300
|
-
const triggersRef =
|
|
6301
|
-
const listRef =
|
|
6302
|
-
const focusTriggerByValue =
|
|
6420
|
+
const triggersRef = React67.useRef([]);
|
|
6421
|
+
const listRef = React67.useRef(null);
|
|
6422
|
+
const focusTriggerByValue = React67.useCallback((value2) => {
|
|
6303
6423
|
const root = listRef.current;
|
|
6304
6424
|
if (!root) return;
|
|
6305
6425
|
const el = root.querySelector(`[data-iris-tabs-trigger][data-value="${value2}"]`);
|
|
6306
6426
|
el?.focus();
|
|
6307
6427
|
}, []);
|
|
6308
|
-
const registerTrigger =
|
|
6428
|
+
const registerTrigger = React67.useCallback(
|
|
6309
6429
|
(value2, isDisabled) => {
|
|
6310
6430
|
if (triggersRef.current.some((t) => t.value === value2)) {
|
|
6311
6431
|
return () => {
|
|
@@ -6324,7 +6444,7 @@ function IrisTabs({
|
|
|
6324
6444
|
},
|
|
6325
6445
|
[isControlled]
|
|
6326
6446
|
);
|
|
6327
|
-
const moveFocus =
|
|
6447
|
+
const moveFocus = React67.useCallback(
|
|
6328
6448
|
(from, delta) => {
|
|
6329
6449
|
const enabled = triggersRef.current.filter((t) => !t.isDisabled());
|
|
6330
6450
|
if (enabled.length === 0) return;
|
|
@@ -6341,7 +6461,7 @@ function IrisTabs({
|
|
|
6341
6461
|
},
|
|
6342
6462
|
[setValue, focusTriggerByValue]
|
|
6343
6463
|
);
|
|
6344
|
-
const value =
|
|
6464
|
+
const value = React67.useMemo(
|
|
6345
6465
|
() => ({
|
|
6346
6466
|
value: effectiveValue,
|
|
6347
6467
|
setValue,
|
|
@@ -6356,10 +6476,10 @@ function IrisTabs({
|
|
|
6356
6476
|
);
|
|
6357
6477
|
return /* @__PURE__ */ jsx(TabsContext.Provider, { value, children });
|
|
6358
6478
|
}
|
|
6359
|
-
var IrisTabsList =
|
|
6479
|
+
var IrisTabsList = React67.forwardRef(
|
|
6360
6480
|
function IrisTabsList2({ style, children, ...rest }, forwardedRef) {
|
|
6361
6481
|
const ctx = useTabsContext("IrisTabsList");
|
|
6362
|
-
const captureRef =
|
|
6482
|
+
const captureRef = React67.useCallback(
|
|
6363
6483
|
(el) => {
|
|
6364
6484
|
ctx.listRef.current = el;
|
|
6365
6485
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -6390,15 +6510,15 @@ var IrisTabsList = React68.forwardRef(
|
|
|
6390
6510
|
);
|
|
6391
6511
|
}
|
|
6392
6512
|
);
|
|
6393
|
-
var IrisTabsTrigger =
|
|
6513
|
+
var IrisTabsTrigger = React67.forwardRef(
|
|
6394
6514
|
function IrisTabsTrigger2({ value, asChild = false, disabled, onClick, onKeyDown, style, children, ...rest }, forwardedRef) {
|
|
6395
6515
|
const ctx = useTabsContext("IrisTabsTrigger");
|
|
6396
6516
|
const isDisabled = Boolean(disabled) || ctx.disabled;
|
|
6397
6517
|
const isActive = ctx.value === value;
|
|
6398
|
-
const isDisabledRef =
|
|
6518
|
+
const isDisabledRef = React67.useRef(isDisabled);
|
|
6399
6519
|
isDisabledRef.current = isDisabled;
|
|
6400
6520
|
const register = ctx.registerTrigger;
|
|
6401
|
-
|
|
6521
|
+
React67.useEffect(() => {
|
|
6402
6522
|
return register(value, () => isDisabledRef.current);
|
|
6403
6523
|
}, [register, value]);
|
|
6404
6524
|
const handleClick = composeEventHandlers(
|
|
@@ -6447,7 +6567,7 @@ var IrisTabsTrigger = React68.forwardRef(
|
|
|
6447
6567
|
onKeyDown: handleKeyDown
|
|
6448
6568
|
};
|
|
6449
6569
|
if (asChild) {
|
|
6450
|
-
if (!
|
|
6570
|
+
if (!React67.isValidElement(children)) {
|
|
6451
6571
|
if (process.env.NODE_ENV !== "production") {
|
|
6452
6572
|
console.warn("[iris-ui] IrisTabsTrigger asChild requires a single React element");
|
|
6453
6573
|
}
|
|
@@ -6487,7 +6607,7 @@ var IrisTabsTrigger = React68.forwardRef(
|
|
|
6487
6607
|
);
|
|
6488
6608
|
}
|
|
6489
6609
|
);
|
|
6490
|
-
var IrisTabsContent =
|
|
6610
|
+
var IrisTabsContent = React67.forwardRef(
|
|
6491
6611
|
function IrisTabsContent2({ value, forceMount = false, style, children, ...rest }, ref) {
|
|
6492
6612
|
const ctx = useTabsContext("IrisTabsContent");
|
|
6493
6613
|
const isActive = ctx.value === value;
|
|
@@ -6514,9 +6634,9 @@ var IrisTabsContent = React68.forwardRef(
|
|
|
6514
6634
|
);
|
|
6515
6635
|
}
|
|
6516
6636
|
);
|
|
6517
|
-
var AccordionContext =
|
|
6637
|
+
var AccordionContext = React67.createContext(null);
|
|
6518
6638
|
function useAccordionContext(componentName) {
|
|
6519
|
-
const ctx =
|
|
6639
|
+
const ctx = React67.useContext(AccordionContext);
|
|
6520
6640
|
if (!ctx) {
|
|
6521
6641
|
throw new Error(`[iris-ui] ${componentName} must be inside an <IrisAccordion>`);
|
|
6522
6642
|
}
|
|
@@ -6533,9 +6653,9 @@ function IrisAccordion({
|
|
|
6533
6653
|
}) {
|
|
6534
6654
|
const isControlled = valueProp !== void 0;
|
|
6535
6655
|
const initial = defaultValue !== void 0 ? defaultValue : multiple ? [] : null;
|
|
6536
|
-
const [internal, setInternal] =
|
|
6656
|
+
const [internal, setInternal] = React67.useState(initial);
|
|
6537
6657
|
const current = isControlled ? valueProp : internal;
|
|
6538
|
-
const isOpen =
|
|
6658
|
+
const isOpen = React67.useCallback(
|
|
6539
6659
|
(v) => {
|
|
6540
6660
|
const c = current;
|
|
6541
6661
|
if (c === null || c === void 0) return false;
|
|
@@ -6544,9 +6664,9 @@ function IrisAccordion({
|
|
|
6544
6664
|
},
|
|
6545
6665
|
[current]
|
|
6546
6666
|
);
|
|
6547
|
-
const controlledRef =
|
|
6667
|
+
const controlledRef = React67.useRef(valueProp);
|
|
6548
6668
|
controlledRef.current = valueProp;
|
|
6549
|
-
const toggle =
|
|
6669
|
+
const toggle = React67.useCallback(
|
|
6550
6670
|
(v) => {
|
|
6551
6671
|
const compute = (prev) => {
|
|
6552
6672
|
if (multiple) {
|
|
@@ -6570,9 +6690,9 @@ function IrisAccordion({
|
|
|
6570
6690
|
},
|
|
6571
6691
|
[multiple, collapsible, isControlled, onValueChange]
|
|
6572
6692
|
);
|
|
6573
|
-
const rootId =
|
|
6574
|
-
const itemsRef =
|
|
6575
|
-
const navRef =
|
|
6693
|
+
const rootId = React67.useId();
|
|
6694
|
+
const itemsRef = React67.useRef([]);
|
|
6695
|
+
const navRef = React67.useRef(null);
|
|
6576
6696
|
if (navRef.current === null) {
|
|
6577
6697
|
navRef.current = createKeyboardNav({
|
|
6578
6698
|
count: itemsRef.current.length,
|
|
@@ -6581,11 +6701,11 @@ function IrisAccordion({
|
|
|
6581
6701
|
});
|
|
6582
6702
|
}
|
|
6583
6703
|
const nav = navRef.current;
|
|
6584
|
-
|
|
6704
|
+
React67.useEffect(() => {
|
|
6585
6705
|
nav.reset(itemsRef.current.length);
|
|
6586
6706
|
});
|
|
6587
6707
|
const activeIndex = useStore(nav.store);
|
|
6588
|
-
const registerItem =
|
|
6708
|
+
const registerItem = React67.useCallback(
|
|
6589
6709
|
(value, el) => {
|
|
6590
6710
|
if (!itemsRef.current.find((it) => it.value === value)) {
|
|
6591
6711
|
itemsRef.current = [...itemsRef.current, { value, el }];
|
|
@@ -6596,7 +6716,7 @@ function IrisAccordion({
|
|
|
6596
6716
|
},
|
|
6597
6717
|
[]
|
|
6598
6718
|
);
|
|
6599
|
-
const focusItem =
|
|
6719
|
+
const focusItem = React67.useCallback(
|
|
6600
6720
|
(value) => {
|
|
6601
6721
|
const idx = itemsRef.current.findIndex((it) => it.value === value);
|
|
6602
6722
|
if (idx >= 0) nav.focus(idx);
|
|
@@ -6613,7 +6733,7 @@ function IrisAccordion({
|
|
|
6613
6733
|
items[action.target]?.el.current?.focus();
|
|
6614
6734
|
}
|
|
6615
6735
|
};
|
|
6616
|
-
const ctx =
|
|
6736
|
+
const ctx = React67.useMemo(
|
|
6617
6737
|
() => ({ isOpen, toggle, rootId, collapsible, multiple, activeIndex, registerItem, focusItem }),
|
|
6618
6738
|
[isOpen, toggle, rootId, collapsible, multiple, activeIndex, registerItem, focusItem]
|
|
6619
6739
|
);
|
|
@@ -6628,14 +6748,14 @@ function IrisAccordion({
|
|
|
6628
6748
|
}
|
|
6629
6749
|
) });
|
|
6630
6750
|
}
|
|
6631
|
-
var IrisAccordionItem =
|
|
6751
|
+
var IrisAccordionItem = React67.forwardRef(
|
|
6632
6752
|
function IrisAccordionItem2({ value, title, disabled = false, style, children, ...rest }, ref) {
|
|
6633
6753
|
const ctx = useAccordionContext("IrisAccordionItem");
|
|
6634
6754
|
const open = ctx.isOpen(value);
|
|
6635
6755
|
const headerId = `${ctx.rootId}-h-${value}`;
|
|
6636
6756
|
const contentId = `${ctx.rootId}-c-${value}`;
|
|
6637
|
-
const triggerRef =
|
|
6638
|
-
|
|
6757
|
+
const triggerRef = React67.useRef(null);
|
|
6758
|
+
React67.useEffect(() => {
|
|
6639
6759
|
return ctx.registerItem(value, triggerRef);
|
|
6640
6760
|
}, [ctx.registerItem, value]);
|
|
6641
6761
|
const onTrigger = () => {
|
|
@@ -6727,9 +6847,9 @@ var IrisAccordionItem = React68.forwardRef(
|
|
|
6727
6847
|
);
|
|
6728
6848
|
}
|
|
6729
6849
|
);
|
|
6730
|
-
var StepperContext =
|
|
6850
|
+
var StepperContext = React67.createContext(null);
|
|
6731
6851
|
function useStepperContext(componentName) {
|
|
6732
|
-
const ctx =
|
|
6852
|
+
const ctx = React67.useContext(StepperContext);
|
|
6733
6853
|
if (!ctx) {
|
|
6734
6854
|
throw new Error(`[iris-ui] ${componentName} must be inside an <IrisStepper>`);
|
|
6735
6855
|
}
|
|
@@ -6746,19 +6866,19 @@ function IrisStepper({
|
|
|
6746
6866
|
...rest
|
|
6747
6867
|
}) {
|
|
6748
6868
|
const isControlled = valueProp !== void 0;
|
|
6749
|
-
const [internal, setInternal] =
|
|
6750
|
-
const [total, setTotal] =
|
|
6869
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
6870
|
+
const [total, setTotal] = React67.useState(0);
|
|
6751
6871
|
const rawValue = isControlled ? valueProp : internal;
|
|
6752
6872
|
const current = Math.max(0, Math.min(total - 1, rawValue));
|
|
6753
|
-
const setValue =
|
|
6873
|
+
const setValue = React67.useCallback(
|
|
6754
6874
|
(next) => {
|
|
6755
6875
|
if (!isControlled) setInternal(next);
|
|
6756
6876
|
onValueChange?.(next);
|
|
6757
6877
|
},
|
|
6758
6878
|
[isControlled, onValueChange]
|
|
6759
6879
|
);
|
|
6760
|
-
const nextIndexRef =
|
|
6761
|
-
const registerStep =
|
|
6880
|
+
const nextIndexRef = React67.useRef(0);
|
|
6881
|
+
const registerStep = React67.useCallback(() => {
|
|
6762
6882
|
const index = nextIndexRef.current;
|
|
6763
6883
|
nextIndexRef.current += 1;
|
|
6764
6884
|
setTotal((t) => Math.max(t, index + 1));
|
|
@@ -6768,7 +6888,7 @@ function IrisStepper({
|
|
|
6768
6888
|
}
|
|
6769
6889
|
};
|
|
6770
6890
|
}, []);
|
|
6771
|
-
const goTo =
|
|
6891
|
+
const goTo = React67.useCallback(
|
|
6772
6892
|
(index) => {
|
|
6773
6893
|
if (index < 0 || index >= total) return;
|
|
6774
6894
|
if (linear && index > current) return;
|
|
@@ -6777,7 +6897,7 @@ function IrisStepper({
|
|
|
6777
6897
|
},
|
|
6778
6898
|
[total, linear, current, setValue]
|
|
6779
6899
|
);
|
|
6780
|
-
const computeStatus =
|
|
6900
|
+
const computeStatus = React67.useCallback(
|
|
6781
6901
|
(index) => {
|
|
6782
6902
|
if (index < current) return "completed";
|
|
6783
6903
|
if (index === current) return "active";
|
|
@@ -6785,7 +6905,7 @@ function IrisStepper({
|
|
|
6785
6905
|
},
|
|
6786
6906
|
[current]
|
|
6787
6907
|
);
|
|
6788
|
-
const ctx =
|
|
6908
|
+
const ctx = React67.useMemo(
|
|
6789
6909
|
() => ({
|
|
6790
6910
|
current,
|
|
6791
6911
|
total,
|
|
@@ -6823,12 +6943,12 @@ var STATUS_COLOR = {
|
|
|
6823
6943
|
completed: "var(--iris-success)",
|
|
6824
6944
|
error: "var(--iris-danger)"
|
|
6825
6945
|
};
|
|
6826
|
-
var IrisStepperStep =
|
|
6946
|
+
var IrisStepperStep = React67.forwardRef(
|
|
6827
6947
|
function IrisStepperStep2({ title, description, status, disabled = false, style, ...rest }, ref) {
|
|
6828
6948
|
const ctx = useStepperContext("IrisStepperStep");
|
|
6829
|
-
const [index, setIndex] =
|
|
6949
|
+
const [index, setIndex] = React67.useState(-1);
|
|
6830
6950
|
const register = ctx.registerStep;
|
|
6831
|
-
|
|
6951
|
+
React67.useEffect(() => {
|
|
6832
6952
|
const { index: i, unregister } = register();
|
|
6833
6953
|
setIndex(i);
|
|
6834
6954
|
return unregister;
|
|
@@ -6959,9 +7079,9 @@ var IrisStepperStep = React68.forwardRef(
|
|
|
6959
7079
|
);
|
|
6960
7080
|
}
|
|
6961
7081
|
);
|
|
6962
|
-
var ToggleGroupContext =
|
|
7082
|
+
var ToggleGroupContext = React67.createContext(null);
|
|
6963
7083
|
function useToggleGroupContext(componentName) {
|
|
6964
|
-
const ctx =
|
|
7084
|
+
const ctx = React67.useContext(ToggleGroupContext);
|
|
6965
7085
|
if (!ctx) {
|
|
6966
7086
|
throw new Error(`[iris-ui] ${componentName} must be inside an <IrisToggleGroup>`);
|
|
6967
7087
|
}
|
|
@@ -6985,7 +7105,7 @@ function IrisToggleGroup(props) {
|
|
|
6985
7105
|
const isControlled = valueProp !== void 0;
|
|
6986
7106
|
const toKeys = (v) => v == null ? [] : Array.isArray(v) ? v : [v];
|
|
6987
7107
|
const fromKeys = (keys) => isMultiple ? keys : keys[0] ?? null;
|
|
6988
|
-
const modelRef =
|
|
7108
|
+
const modelRef = React67.useRef(null);
|
|
6989
7109
|
if (modelRef.current === null) {
|
|
6990
7110
|
const initial = defaultValue !== void 0 ? defaultValue : isMultiple ? [] : null;
|
|
6991
7111
|
modelRef.current = createSelectionModel({
|
|
@@ -6996,15 +7116,15 @@ function IrisToggleGroup(props) {
|
|
|
6996
7116
|
}
|
|
6997
7117
|
const model = modelRef.current;
|
|
6998
7118
|
const selected = useStore(model.store);
|
|
6999
|
-
|
|
7119
|
+
React67.useEffect(() => {
|
|
7000
7120
|
if (isControlled) model.sync(toKeys(valueProp));
|
|
7001
7121
|
}, [valueProp, isControlled, model]);
|
|
7002
7122
|
const displaySelected = isControlled ? toKeys(valueProp) : selected;
|
|
7003
|
-
const isActive =
|
|
7123
|
+
const isActive = React67.useCallback(
|
|
7004
7124
|
(v) => displaySelected.includes(v),
|
|
7005
7125
|
[displaySelected]
|
|
7006
7126
|
);
|
|
7007
|
-
const toggle =
|
|
7127
|
+
const toggle = React67.useCallback(
|
|
7008
7128
|
(v) => {
|
|
7009
7129
|
if (disabled) return;
|
|
7010
7130
|
if (isControlled) model.sync(toKeys(valueProp));
|
|
@@ -7012,8 +7132,8 @@ function IrisToggleGroup(props) {
|
|
|
7012
7132
|
},
|
|
7013
7133
|
[disabled, model, isControlled, valueProp]
|
|
7014
7134
|
);
|
|
7015
|
-
const itemsRef =
|
|
7016
|
-
const navRef =
|
|
7135
|
+
const itemsRef = React67.useRef([]);
|
|
7136
|
+
const navRef = React67.useRef(null);
|
|
7017
7137
|
if (navRef.current === null) {
|
|
7018
7138
|
navRef.current = createKeyboardNav({
|
|
7019
7139
|
count: itemsRef.current.length,
|
|
@@ -7022,10 +7142,10 @@ function IrisToggleGroup(props) {
|
|
|
7022
7142
|
});
|
|
7023
7143
|
}
|
|
7024
7144
|
const nav = navRef.current;
|
|
7025
|
-
|
|
7145
|
+
React67.useEffect(() => {
|
|
7026
7146
|
nav.reset(itemsRef.current.length);
|
|
7027
7147
|
});
|
|
7028
|
-
const registerItem =
|
|
7148
|
+
const registerItem = React67.useCallback((value, el) => {
|
|
7029
7149
|
if (!itemsRef.current.find((it) => it.value === value)) {
|
|
7030
7150
|
itemsRef.current = [...itemsRef.current, { value, el }];
|
|
7031
7151
|
}
|
|
@@ -7033,7 +7153,7 @@ function IrisToggleGroup(props) {
|
|
|
7033
7153
|
itemsRef.current = itemsRef.current.filter((it) => it.value !== value);
|
|
7034
7154
|
};
|
|
7035
7155
|
}, []);
|
|
7036
|
-
const moveFocus =
|
|
7156
|
+
const moveFocus = React67.useCallback((from, delta) => {
|
|
7037
7157
|
const items = itemsRef.current;
|
|
7038
7158
|
if (items.length === 0) return;
|
|
7039
7159
|
const idx = items.findIndex((it) => it.value === from);
|
|
@@ -7043,7 +7163,7 @@ function IrisToggleGroup(props) {
|
|
|
7043
7163
|
else nextIdx = (idx + delta + items.length) % items.length;
|
|
7044
7164
|
items[nextIdx]?.el.current?.focus();
|
|
7045
7165
|
}, []);
|
|
7046
|
-
const focusItem =
|
|
7166
|
+
const focusItem = React67.useCallback(
|
|
7047
7167
|
(value) => {
|
|
7048
7168
|
const idx = itemsRef.current.findIndex((it) => it.value === value);
|
|
7049
7169
|
if (idx >= 0) nav.focus(idx);
|
|
@@ -7066,7 +7186,7 @@ function IrisToggleGroup(props) {
|
|
|
7066
7186
|
}
|
|
7067
7187
|
}
|
|
7068
7188
|
};
|
|
7069
|
-
const ctx =
|
|
7189
|
+
const ctx = React67.useMemo(
|
|
7070
7190
|
() => ({
|
|
7071
7191
|
type,
|
|
7072
7192
|
orientation,
|
|
@@ -7127,11 +7247,11 @@ var SIZE_FONT = {
|
|
|
7127
7247
|
md: "13px",
|
|
7128
7248
|
lg: "14px"
|
|
7129
7249
|
};
|
|
7130
|
-
var IrisToggleGroupItem =
|
|
7250
|
+
var IrisToggleGroupItem = React67.forwardRef(
|
|
7131
7251
|
function IrisToggleGroupItem2({ value, disabled, onClick, onKeyDown, onFocus, style, children, ...rest }, forwardedRef) {
|
|
7132
7252
|
const ctx = useToggleGroupContext("IrisToggleGroupItem");
|
|
7133
|
-
const elRef =
|
|
7134
|
-
const captureRef =
|
|
7253
|
+
const elRef = React67.useRef(null);
|
|
7254
|
+
const captureRef = React67.useCallback(
|
|
7135
7255
|
(el) => {
|
|
7136
7256
|
elRef.current = el;
|
|
7137
7257
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -7141,7 +7261,7 @@ var IrisToggleGroupItem = React68.forwardRef(
|
|
|
7141
7261
|
[forwardedRef]
|
|
7142
7262
|
);
|
|
7143
7263
|
const register = ctx.registerItem;
|
|
7144
|
-
|
|
7264
|
+
React67.useEffect(() => {
|
|
7145
7265
|
return register(value, elRef);
|
|
7146
7266
|
}, [register, value]);
|
|
7147
7267
|
const active = ctx.isActive(value);
|
|
@@ -7214,7 +7334,7 @@ function IrisPagination({
|
|
|
7214
7334
|
}) {
|
|
7215
7335
|
const { t } = useI18n();
|
|
7216
7336
|
const isControlled = valueProp !== void 0;
|
|
7217
|
-
const [internal, setInternal] =
|
|
7337
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
7218
7338
|
const totalPages = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
7219
7339
|
const raw = isControlled ? valueProp : internal;
|
|
7220
7340
|
const current = Math.min(totalPages, Math.max(1, raw));
|
|
@@ -7352,15 +7472,15 @@ function IrisDragger({
|
|
|
7352
7472
|
...rest
|
|
7353
7473
|
}) {
|
|
7354
7474
|
const isControlled = valueProp !== void 0;
|
|
7355
|
-
const [internal, setInternal] =
|
|
7475
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
7356
7476
|
const position = isControlled ? valueProp : internal;
|
|
7357
|
-
const positionRef =
|
|
7477
|
+
const positionRef = React67.useRef(position);
|
|
7358
7478
|
positionRef.current = position;
|
|
7359
|
-
const rootRef =
|
|
7360
|
-
const handleRef =
|
|
7479
|
+
const rootRef = React67.useRef(null);
|
|
7480
|
+
const handleRef = React67.useRef(null);
|
|
7361
7481
|
const dragHandleRef = handle ? handleRef : rootRef;
|
|
7362
|
-
const [dragging, setDragging] =
|
|
7363
|
-
const startPosRef =
|
|
7482
|
+
const [dragging, setDragging] = React67.useState(false);
|
|
7483
|
+
const startPosRef = React67.useRef({ x: 0, y: 0 });
|
|
7364
7484
|
const clamp6 = (p) => ({
|
|
7365
7485
|
x: Math.max(bounds.minX ?? -Infinity, Math.min(bounds.maxX ?? Infinity, p.x)),
|
|
7366
7486
|
y: Math.max(bounds.minY ?? -Infinity, Math.min(bounds.maxY ?? Infinity, p.y))
|
|
@@ -7434,16 +7554,16 @@ function IrisSplitter({
|
|
|
7434
7554
|
...rest
|
|
7435
7555
|
}) {
|
|
7436
7556
|
const isControlled = valueProp !== void 0;
|
|
7437
|
-
const [internal, setInternal] =
|
|
7557
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
7438
7558
|
const ratio = isControlled ? valueProp : internal;
|
|
7439
|
-
const ratioRef =
|
|
7559
|
+
const ratioRef = React67.useRef(ratio);
|
|
7440
7560
|
ratioRef.current = ratio;
|
|
7441
|
-
const containerRef =
|
|
7442
|
-
const handleRef =
|
|
7443
|
-
const [dragging, setDragging] =
|
|
7561
|
+
const containerRef = React67.useRef(null);
|
|
7562
|
+
const handleRef = React67.useRef(null);
|
|
7563
|
+
const [dragging, setDragging] = React67.useState(false);
|
|
7444
7564
|
const isHorizontal = orientation === "horizontal";
|
|
7445
|
-
const startRatioRef =
|
|
7446
|
-
const totalSizeRef =
|
|
7565
|
+
const startRatioRef = React67.useRef(0);
|
|
7566
|
+
const totalSizeRef = React67.useRef(0);
|
|
7447
7567
|
const setRatio = (next) => {
|
|
7448
7568
|
if (!isControlled) setInternal(next);
|
|
7449
7569
|
onValueChange?.(next);
|
|
@@ -7585,9 +7705,9 @@ function handlePosition(handle) {
|
|
|
7585
7705
|
return s;
|
|
7586
7706
|
}
|
|
7587
7707
|
function ResizerHandle(props) {
|
|
7588
|
-
const handleRef =
|
|
7589
|
-
const startSizeRef =
|
|
7590
|
-
const aspectRef =
|
|
7708
|
+
const handleRef = React67.useRef(null);
|
|
7709
|
+
const startSizeRef = React67.useRef({ width: 0, height: 0 });
|
|
7710
|
+
const aspectRef = React67.useRef(1);
|
|
7591
7711
|
useDrag({
|
|
7592
7712
|
handle: handleRef,
|
|
7593
7713
|
disabled: props.disabled,
|
|
@@ -7649,7 +7769,7 @@ function IrisResizer({
|
|
|
7649
7769
|
children,
|
|
7650
7770
|
...rest
|
|
7651
7771
|
}) {
|
|
7652
|
-
const sizeRef =
|
|
7772
|
+
const sizeRef = React67.useRef(value);
|
|
7653
7773
|
sizeRef.current = value;
|
|
7654
7774
|
return /* @__PURE__ */ jsxs(
|
|
7655
7775
|
"div",
|
|
@@ -7706,27 +7826,28 @@ function IrisSelect({
|
|
|
7706
7826
|
ariaDescribedby,
|
|
7707
7827
|
renderTrigger,
|
|
7708
7828
|
style,
|
|
7709
|
-
className
|
|
7829
|
+
className,
|
|
7830
|
+
...rest
|
|
7710
7831
|
}) {
|
|
7711
7832
|
const { t } = useI18n();
|
|
7712
7833
|
const safeItems = items ?? [];
|
|
7713
7834
|
const resolvedPlaceholder = placeholder ?? t("select.placeholder");
|
|
7714
7835
|
const isControlled = valueProp !== void 0;
|
|
7715
|
-
const [internal, setInternal] =
|
|
7836
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
7716
7837
|
const value = isControlled ? valueProp : internal;
|
|
7717
|
-
const [open, setOpen] =
|
|
7838
|
+
const [open, setOpen] = React67.useState(false);
|
|
7718
7839
|
const selectedItem = safeItems.find((it) => it.value === value) ?? null;
|
|
7719
7840
|
const label = selectedItem ? selectedItem.label ?? String(selectedItem.value) : resolvedPlaceholder;
|
|
7720
7841
|
const setValue = (next) => {
|
|
7721
7842
|
if (!isControlled) setInternal(next);
|
|
7722
7843
|
onValueChange?.(next);
|
|
7723
7844
|
};
|
|
7724
|
-
const isEnabled =
|
|
7725
|
-
const labels =
|
|
7845
|
+
const isEnabled = React67.useCallback((i) => !safeItems[i]?.disabled, [safeItems]);
|
|
7846
|
+
const labels = React67.useMemo(
|
|
7726
7847
|
() => safeItems.map((it) => it.label ?? String(it.value)),
|
|
7727
7848
|
[safeItems]
|
|
7728
7849
|
);
|
|
7729
|
-
const navRef =
|
|
7850
|
+
const navRef = React67.useRef(null);
|
|
7730
7851
|
if (navRef.current === null) {
|
|
7731
7852
|
const selIdx = safeItems.findIndex((it) => it.value === value);
|
|
7732
7853
|
const initial = selIdx >= 0 && !safeItems[selIdx]?.disabled ? selIdx : void 0;
|
|
@@ -7739,10 +7860,10 @@ function IrisSelect({
|
|
|
7739
7860
|
});
|
|
7740
7861
|
}
|
|
7741
7862
|
const nav = navRef.current;
|
|
7742
|
-
|
|
7863
|
+
React67.useEffect(() => {
|
|
7743
7864
|
nav.reset(safeItems.length);
|
|
7744
7865
|
});
|
|
7745
|
-
|
|
7866
|
+
React67.useEffect(() => {
|
|
7746
7867
|
if (open) {
|
|
7747
7868
|
const selIdx = safeItems.findIndex((it) => it.value === value);
|
|
7748
7869
|
if (selIdx >= 0 && !safeItems[selIdx]?.disabled) {
|
|
@@ -7753,8 +7874,8 @@ function IrisSelect({
|
|
|
7753
7874
|
}
|
|
7754
7875
|
}, [open, safeItems, value, nav]);
|
|
7755
7876
|
const activeIndex = useStore(nav.store);
|
|
7756
|
-
const listRef =
|
|
7757
|
-
|
|
7877
|
+
const listRef = React67.useRef(null);
|
|
7878
|
+
React67.useEffect(() => {
|
|
7758
7879
|
if (!open || activeIndex < 0) return;
|
|
7759
7880
|
const el = listRef.current?.querySelector(
|
|
7760
7881
|
`[data-iris-select-option-index="${activeIndex}"]`
|
|
@@ -7810,6 +7931,7 @@ function IrisSelect({
|
|
|
7810
7931
|
"aria-haspopup": "listbox",
|
|
7811
7932
|
"aria-invalid": invalid ? "true" : void 0,
|
|
7812
7933
|
"aria-describedby": ariaDescribedby,
|
|
7934
|
+
...rest,
|
|
7813
7935
|
style: triggerStyle,
|
|
7814
7936
|
children: [
|
|
7815
7937
|
/* @__PURE__ */ jsx("span", { style: { flex: 1, minWidth: 0 }, children: label }),
|
|
@@ -7908,7 +8030,7 @@ function IrisSelect({
|
|
|
7908
8030
|
)
|
|
7909
8031
|
] });
|
|
7910
8032
|
}
|
|
7911
|
-
var IrisVirtualScroll =
|
|
8033
|
+
var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
7912
8034
|
items,
|
|
7913
8035
|
itemHeight,
|
|
7914
8036
|
estimatedItemHeight = 40,
|
|
@@ -7919,25 +8041,26 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
7919
8041
|
onScroll,
|
|
7920
8042
|
onRangeChange,
|
|
7921
8043
|
style,
|
|
7922
|
-
className
|
|
8044
|
+
className,
|
|
8045
|
+
...rest
|
|
7923
8046
|
}, forwardedRef) {
|
|
7924
|
-
const viewportRef =
|
|
7925
|
-
const [scrollTop, setScrollTop] =
|
|
7926
|
-
const [viewportHeight, setViewportHeight] =
|
|
8047
|
+
const viewportRef = React67.useRef(null);
|
|
8048
|
+
const [scrollTop, setScrollTop] = React67.useState(0);
|
|
8049
|
+
const [viewportHeight, setViewportHeight] = React67.useState(
|
|
7927
8050
|
typeof height === "number" ? height : 0
|
|
7928
8051
|
);
|
|
7929
|
-
const rafRef =
|
|
8052
|
+
const rafRef = React67.useRef(null);
|
|
7930
8053
|
const auto = itemHeight === "auto";
|
|
7931
8054
|
const userFn = typeof itemHeight === "function" ? itemHeight : null;
|
|
7932
8055
|
const fixedHeight = typeof itemHeight === "number" ? itemHeight : 0;
|
|
7933
8056
|
const variable = userFn !== null || auto;
|
|
7934
|
-
const measuredRef =
|
|
7935
|
-
const [measureVersion, setMeasureVersion] =
|
|
7936
|
-
const itemsRef =
|
|
8057
|
+
const measuredRef = React67.useRef(/* @__PURE__ */ new Map());
|
|
8058
|
+
const [measureVersion, setMeasureVersion] = React67.useState(0);
|
|
8059
|
+
const itemsRef = React67.useRef(items);
|
|
7937
8060
|
itemsRef.current = items;
|
|
7938
|
-
const keyOfRef =
|
|
8061
|
+
const keyOfRef = React67.useRef(keyOf);
|
|
7939
8062
|
keyOfRef.current = keyOf;
|
|
7940
|
-
const estimateSize =
|
|
8063
|
+
const estimateSize = React67.useCallback(
|
|
7941
8064
|
(index) => {
|
|
7942
8065
|
if (userFn) return userFn(index);
|
|
7943
8066
|
if (auto) return measuredRef.current.get(index) ?? estimatedItemHeight;
|
|
@@ -7945,9 +8068,9 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
7945
8068
|
},
|
|
7946
8069
|
[userFn, auto, estimatedItemHeight, fixedHeight]
|
|
7947
8070
|
);
|
|
7948
|
-
const estimateRef =
|
|
8071
|
+
const estimateRef = React67.useRef(estimateSize);
|
|
7949
8072
|
estimateRef.current = estimateSize;
|
|
7950
|
-
const virtualizer =
|
|
8073
|
+
const virtualizer = React67.useMemo(
|
|
7951
8074
|
() => createVirtualizer({
|
|
7952
8075
|
count: items.length,
|
|
7953
8076
|
estimateSize: (index) => estimateRef.current(index),
|
|
@@ -7965,19 +8088,19 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
7965
8088
|
// not deps (recreating would reset the controller's scroll + cache).
|
|
7966
8089
|
[items.length, buffer, variable]
|
|
7967
8090
|
);
|
|
7968
|
-
|
|
8091
|
+
React67.useLayoutEffect(() => {
|
|
7969
8092
|
if (variable) virtualizer.remeasure();
|
|
7970
8093
|
}, [virtualizer, userFn, measureVersion, estimatedItemHeight, variable]);
|
|
7971
|
-
|
|
8094
|
+
React67.useLayoutEffect(() => {
|
|
7972
8095
|
virtualizer.setViewportSize(viewportHeight);
|
|
7973
8096
|
virtualizer.setScroll(scrollTop);
|
|
7974
8097
|
}, [virtualizer, viewportHeight, scrollTop]);
|
|
7975
|
-
const vstate =
|
|
8098
|
+
const vstate = React67.useSyncExternalStore(virtualizer.subscribe, virtualizer.getState);
|
|
7976
8099
|
const totalHeight = vstate.totalSize;
|
|
7977
8100
|
const itemInState = (i) => vstate.items.find((it) => it.index === i);
|
|
7978
8101
|
const offsetOf = (i) => variable ? itemInState(i)?.start ?? i * estimateRef.current(i) : i * fixedHeight;
|
|
7979
8102
|
const heightOf = (i) => variable ? itemInState(i)?.size ?? estimateRef.current(i) : fixedHeight;
|
|
7980
|
-
const range =
|
|
8103
|
+
const range = React67.useMemo(() => {
|
|
7981
8104
|
if (variable) return { start: vstate.startIndex, end: vstate.endIndex + 1 };
|
|
7982
8105
|
const startRaw = Math.floor(scrollTop / Math.max(1, fixedHeight));
|
|
7983
8106
|
const visibleCount = fixedHeight <= 0 ? 0 : Math.ceil(viewportHeight / fixedHeight);
|
|
@@ -7985,8 +8108,8 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
7985
8108
|
const end = Math.min(items.length, startRaw + visibleCount + buffer);
|
|
7986
8109
|
return { start, end };
|
|
7987
8110
|
}, [variable, vstate, scrollTop, viewportHeight, fixedHeight, buffer, items.length]);
|
|
7988
|
-
const rangeRef =
|
|
7989
|
-
|
|
8111
|
+
const rangeRef = React67.useRef(range);
|
|
8112
|
+
React67.useEffect(() => {
|
|
7990
8113
|
if (rangeRef.current.start !== range.start || rangeRef.current.end !== range.end) {
|
|
7991
8114
|
rangeRef.current = range;
|
|
7992
8115
|
onRangeChange?.(range);
|
|
@@ -8006,12 +8129,12 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
8006
8129
|
});
|
|
8007
8130
|
});
|
|
8008
8131
|
};
|
|
8009
|
-
const measureViewport =
|
|
8132
|
+
const measureViewport = React67.useCallback(() => {
|
|
8010
8133
|
const el = viewportRef.current;
|
|
8011
8134
|
if (!el) return;
|
|
8012
8135
|
setViewportHeight(el.clientHeight);
|
|
8013
8136
|
}, []);
|
|
8014
|
-
|
|
8137
|
+
React67.useEffect(() => {
|
|
8015
8138
|
measureViewport();
|
|
8016
8139
|
if (typeof ResizeObserver === "undefined") return;
|
|
8017
8140
|
const el = viewportRef.current;
|
|
@@ -8020,15 +8143,15 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
8020
8143
|
ro.observe(el);
|
|
8021
8144
|
return () => ro.disconnect();
|
|
8022
8145
|
}, [measureViewport]);
|
|
8023
|
-
|
|
8146
|
+
React67.useEffect(() => {
|
|
8024
8147
|
return () => {
|
|
8025
8148
|
if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
|
|
8026
8149
|
};
|
|
8027
8150
|
}, []);
|
|
8028
|
-
const rowObserverRef =
|
|
8029
|
-
const indexByEl =
|
|
8030
|
-
const elByIndex =
|
|
8031
|
-
|
|
8151
|
+
const rowObserverRef = React67.useRef(null);
|
|
8152
|
+
const indexByEl = React67.useRef(/* @__PURE__ */ new WeakMap());
|
|
8153
|
+
const elByIndex = React67.useRef(/* @__PURE__ */ new Map());
|
|
8154
|
+
React67.useEffect(() => {
|
|
8032
8155
|
if (!auto || typeof ResizeObserver === "undefined") return;
|
|
8033
8156
|
const ro = new ResizeObserver((entries) => {
|
|
8034
8157
|
let changed = false;
|
|
@@ -8064,13 +8187,13 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
8064
8187
|
ro?.observe(el);
|
|
8065
8188
|
}
|
|
8066
8189
|
};
|
|
8067
|
-
|
|
8190
|
+
React67.useEffect(() => {
|
|
8068
8191
|
const el = viewportRef.current;
|
|
8069
8192
|
if (!el) return;
|
|
8070
8193
|
const max = Math.max(0, totalHeight - viewportHeight);
|
|
8071
8194
|
if (el.scrollTop > max) el.scrollTop = max;
|
|
8072
8195
|
}, [items.length, totalHeight, viewportHeight]);
|
|
8073
|
-
const scrollToIndex =
|
|
8196
|
+
const scrollToIndex = React67.useCallback(
|
|
8074
8197
|
(index, align = "start") => {
|
|
8075
8198
|
const el = viewportRef.current;
|
|
8076
8199
|
if (!el) return;
|
|
@@ -8079,7 +8202,7 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
8079
8202
|
},
|
|
8080
8203
|
[virtualizer]
|
|
8081
8204
|
);
|
|
8082
|
-
const scrollToOffset =
|
|
8205
|
+
const scrollToOffset = React67.useCallback(
|
|
8083
8206
|
(offset) => {
|
|
8084
8207
|
const el = viewportRef.current;
|
|
8085
8208
|
if (!el) return;
|
|
@@ -8087,11 +8210,11 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
8087
8210
|
},
|
|
8088
8211
|
[virtualizer]
|
|
8089
8212
|
);
|
|
8090
|
-
const refresh =
|
|
8213
|
+
const refresh = React67.useCallback(() => {
|
|
8091
8214
|
measureViewport();
|
|
8092
8215
|
handleScroll();
|
|
8093
8216
|
}, [measureViewport]);
|
|
8094
|
-
|
|
8217
|
+
React67.useImperativeHandle(forwardedRef, () => ({ scrollToIndex, scrollToOffset, refresh }), [
|
|
8095
8218
|
scrollToIndex,
|
|
8096
8219
|
scrollToOffset,
|
|
8097
8220
|
refresh
|
|
@@ -8137,6 +8260,7 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
8137
8260
|
"data-iris-virtual-scroll": "",
|
|
8138
8261
|
className,
|
|
8139
8262
|
onScroll: handleScroll,
|
|
8263
|
+
...rest,
|
|
8140
8264
|
style: containerStyle,
|
|
8141
8265
|
children: /* @__PURE__ */ jsx(
|
|
8142
8266
|
"div",
|
|
@@ -8149,6 +8273,59 @@ var IrisVirtualScroll = React68.forwardRef(function IrisVirtualScroll2({
|
|
|
8149
8273
|
}
|
|
8150
8274
|
);
|
|
8151
8275
|
});
|
|
8276
|
+
function useTableSort(data, options) {
|
|
8277
|
+
const { leafColumns, sort: sortProp, defaultSort, onSortChange } = options;
|
|
8278
|
+
const sortControlled = sortProp !== void 0;
|
|
8279
|
+
const [sortInternal, setSortInternal] = React67.useState(
|
|
8280
|
+
defaultSort ?? null
|
|
8281
|
+
);
|
|
8282
|
+
const sortState = sortControlled ? sortProp ?? null : sortInternal;
|
|
8283
|
+
const sortComparator = React67.useMemo(() => {
|
|
8284
|
+
if (!sortState) return null;
|
|
8285
|
+
const col = leafColumns.find((c) => c.key === sortState.key);
|
|
8286
|
+
if (!col) return null;
|
|
8287
|
+
const dir = sortState.direction === "asc" ? 1 : -1;
|
|
8288
|
+
const sorter = col.sorter ?? ((a, b) => compareValues(getCellValue(a, col), getCellValue(b, col)));
|
|
8289
|
+
return (a, b) => sorter(a, b) * dir;
|
|
8290
|
+
}, [leafColumns, sortState]);
|
|
8291
|
+
const sortedData = React67.useMemo(() => {
|
|
8292
|
+
if (!sortComparator) return data;
|
|
8293
|
+
return [...data].sort(sortComparator);
|
|
8294
|
+
}, [data, sortComparator]);
|
|
8295
|
+
const setSort = React67.useCallback(
|
|
8296
|
+
(next) => {
|
|
8297
|
+
if (!sortControlled) setSortInternal(next);
|
|
8298
|
+
onSortChange?.(next);
|
|
8299
|
+
},
|
|
8300
|
+
[sortControlled, onSortChange]
|
|
8301
|
+
);
|
|
8302
|
+
const cycleSort = React67.useCallback(
|
|
8303
|
+
(col) => {
|
|
8304
|
+
if (!col.sortable) return;
|
|
8305
|
+
if (!sortState || sortState.key !== col.key) {
|
|
8306
|
+
setSort({ key: col.key, direction: "asc" });
|
|
8307
|
+
return;
|
|
8308
|
+
}
|
|
8309
|
+
if (sortState.direction === "asc") {
|
|
8310
|
+
setSort({ key: col.key, direction: "desc" });
|
|
8311
|
+
return;
|
|
8312
|
+
}
|
|
8313
|
+
setSort(null);
|
|
8314
|
+
},
|
|
8315
|
+
[sortState, setSort]
|
|
8316
|
+
);
|
|
8317
|
+
return {
|
|
8318
|
+
sortState,
|
|
8319
|
+
cycleSort,
|
|
8320
|
+
setSort,
|
|
8321
|
+
sortComparator,
|
|
8322
|
+
sortedData
|
|
8323
|
+
};
|
|
8324
|
+
}
|
|
8325
|
+
function getCellValue(row, column) {
|
|
8326
|
+
const key = column.dataIndex ?? column.key;
|
|
8327
|
+
return row[key];
|
|
8328
|
+
}
|
|
8152
8329
|
var RESIZE_STEP = 16;
|
|
8153
8330
|
var SELECTION_COL_WIDTH = 40;
|
|
8154
8331
|
var EXPAND_COL_WIDTH = 40;
|
|
@@ -8166,8 +8343,8 @@ function ColumnResizeHandle({
|
|
|
8166
8343
|
maxWidth,
|
|
8167
8344
|
onResize
|
|
8168
8345
|
}) {
|
|
8169
|
-
const ref =
|
|
8170
|
-
const startRef =
|
|
8346
|
+
const ref = React67.useRef(null);
|
|
8347
|
+
const startRef = React67.useRef(0);
|
|
8171
8348
|
const clamp6 = (w) => Math.max(minWidth, Math.min(maxWidth, Math.round(w)));
|
|
8172
8349
|
const measure = () => width ?? ref.current?.parentElement?.getBoundingClientRect().width ?? minWidth;
|
|
8173
8350
|
useDrag({
|
|
@@ -8212,7 +8389,7 @@ function ColumnResizeHandle({
|
|
|
8212
8389
|
}
|
|
8213
8390
|
);
|
|
8214
8391
|
}
|
|
8215
|
-
function
|
|
8392
|
+
function getCellValue2(row, column) {
|
|
8216
8393
|
const key = column.dataIndex ?? column.key;
|
|
8217
8394
|
return row[key];
|
|
8218
8395
|
}
|
|
@@ -8233,6 +8410,7 @@ function IrisTable({
|
|
|
8233
8410
|
columnWidths: columnWidthsProp,
|
|
8234
8411
|
defaultColumnWidths,
|
|
8235
8412
|
onColumnWidthsChange,
|
|
8413
|
+
onRowClick,
|
|
8236
8414
|
onCellEdit,
|
|
8237
8415
|
renderDetail,
|
|
8238
8416
|
rowExpandable,
|
|
@@ -8249,29 +8427,36 @@ function IrisTable({
|
|
|
8249
8427
|
loadingState,
|
|
8250
8428
|
errorState,
|
|
8251
8429
|
style,
|
|
8252
|
-
className
|
|
8430
|
+
className,
|
|
8431
|
+
...rest
|
|
8253
8432
|
}) {
|
|
8254
8433
|
const { t } = useI18n();
|
|
8255
|
-
const safeColumns =
|
|
8256
|
-
const grouped =
|
|
8434
|
+
const safeColumns = React67.useMemo(() => columns ?? [], [columns]);
|
|
8435
|
+
const grouped = React67.useMemo(
|
|
8257
8436
|
() => safeColumns.some((c) => c.children && c.children.length > 0),
|
|
8258
8437
|
[safeColumns]
|
|
8259
8438
|
);
|
|
8260
|
-
const leafColumns =
|
|
8439
|
+
const leafColumns = React67.useMemo(
|
|
8261
8440
|
() => grouped ? flattenLeafColumns(safeColumns) : safeColumns,
|
|
8262
8441
|
[grouped, safeColumns]
|
|
8263
8442
|
);
|
|
8264
|
-
const headerMatrix =
|
|
8443
|
+
const headerMatrix = React67.useMemo(
|
|
8265
8444
|
() => grouped ? buildHeaderMatrix(safeColumns) : null,
|
|
8266
8445
|
[grouped, safeColumns]
|
|
8267
8446
|
);
|
|
8268
|
-
const
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8447
|
+
const {
|
|
8448
|
+
sortState: sort,
|
|
8449
|
+
cycleSort,
|
|
8450
|
+
sortComparator,
|
|
8451
|
+
sortedData
|
|
8452
|
+
} = useTableSort(data ?? [], {
|
|
8453
|
+
leafColumns,
|
|
8454
|
+
sort: sortProp,
|
|
8455
|
+
defaultSort,
|
|
8456
|
+
onSortChange
|
|
8457
|
+
});
|
|
8273
8458
|
const selControlled = selectionProp !== void 0;
|
|
8274
|
-
const selModelRef =
|
|
8459
|
+
const selModelRef = React67.useRef(null);
|
|
8275
8460
|
if (selModelRef.current === null) {
|
|
8276
8461
|
selModelRef.current = createSelectionModel({
|
|
8277
8462
|
mode: selectable === "single" ? "single" : "multiple",
|
|
@@ -8281,7 +8466,7 @@ function IrisTable({
|
|
|
8281
8466
|
}
|
|
8282
8467
|
const selModel = selModelRef.current;
|
|
8283
8468
|
const selection = useStore(selModel.store);
|
|
8284
|
-
|
|
8469
|
+
React67.useEffect(() => {
|
|
8285
8470
|
if (selControlled) selModel.sync(selectionProp);
|
|
8286
8471
|
}, [selectionProp, selControlled, selModel]);
|
|
8287
8472
|
const displaySelection = selControlled ? selectionProp : selection;
|
|
@@ -8289,7 +8474,7 @@ function IrisTable({
|
|
|
8289
8474
|
if (selControlled) selModel.sync(selectionProp);
|
|
8290
8475
|
};
|
|
8291
8476
|
const hasDetail = renderDetail !== void 0;
|
|
8292
|
-
const expansionRef =
|
|
8477
|
+
const expansionRef = React67.useRef(null);
|
|
8293
8478
|
if (expansionRef.current === null) {
|
|
8294
8479
|
expansionRef.current = createExpansion({
|
|
8295
8480
|
mode: "multiple",
|
|
@@ -8301,7 +8486,7 @@ function IrisTable({
|
|
|
8301
8486
|
const expandedKeys = useStore(expansion.store);
|
|
8302
8487
|
const isRowExpandable = (row, idx) => hasDetail && (rowExpandable ? rowExpandable(row, idx) : true);
|
|
8303
8488
|
const widthsControlled = columnWidthsProp !== void 0;
|
|
8304
|
-
const [widthsInternal, setWidthsInternal] =
|
|
8489
|
+
const [widthsInternal, setWidthsInternal] = React67.useState(
|
|
8305
8490
|
defaultColumnWidths ?? {}
|
|
8306
8491
|
);
|
|
8307
8492
|
const columnWidths = widthsControlled ? columnWidthsProp : widthsInternal;
|
|
@@ -8310,13 +8495,13 @@ function IrisTable({
|
|
|
8310
8495
|
if (!widthsControlled) setWidthsInternal(next);
|
|
8311
8496
|
onColumnWidthsChange?.(next);
|
|
8312
8497
|
};
|
|
8313
|
-
const [editingCellId, setEditingCellId] =
|
|
8314
|
-
const [editingDraft, setEditingDraft] =
|
|
8315
|
-
const [editError, setEditError] =
|
|
8316
|
-
const draftRef =
|
|
8317
|
-
const editorRef =
|
|
8498
|
+
const [editingCellId, setEditingCellId] = React67.useState(null);
|
|
8499
|
+
const [editingDraft, setEditingDraft] = React67.useState("");
|
|
8500
|
+
const [editError, setEditError] = React67.useState(null);
|
|
8501
|
+
const draftRef = React67.useRef("");
|
|
8502
|
+
const editorRef = React67.useRef(null);
|
|
8318
8503
|
const cellId = (rowIdent, colKey) => `${rowIdent}::${colKey}`;
|
|
8319
|
-
|
|
8504
|
+
React67.useEffect(() => {
|
|
8320
8505
|
if (editingCellId !== null) editorRef.current?.focus();
|
|
8321
8506
|
}, [editingCellId]);
|
|
8322
8507
|
const setDraft = (value) => {
|
|
@@ -8325,7 +8510,7 @@ function IrisTable({
|
|
|
8325
8510
|
};
|
|
8326
8511
|
const beginEdit = (row, col, rowIdent) => {
|
|
8327
8512
|
if (!col.editable) return;
|
|
8328
|
-
const current =
|
|
8513
|
+
const current = getCellValue2(row, col);
|
|
8329
8514
|
setDraft(current == null ? "" : String(current));
|
|
8330
8515
|
setEditError(null);
|
|
8331
8516
|
setEditingCellId(cellId(rowIdent, col.key));
|
|
@@ -8336,7 +8521,7 @@ function IrisTable({
|
|
|
8336
8521
|
};
|
|
8337
8522
|
const commitEdit = (row, col, rowIndex) => {
|
|
8338
8523
|
if (editingCellId === null) return;
|
|
8339
|
-
const oldValue =
|
|
8524
|
+
const oldValue = getCellValue2(row, col);
|
|
8340
8525
|
const draft = draftRef.current;
|
|
8341
8526
|
const newValue = col.editor === "number" ? draft === "" || Number.isNaN(Number(draft)) ? oldValue : Number(draft) : draft;
|
|
8342
8527
|
if (col.validate) {
|
|
@@ -8352,34 +8537,6 @@ function IrisTable({
|
|
|
8352
8537
|
onCellEdit?.({ row, column: col, oldValue, newValue, rowIndex });
|
|
8353
8538
|
}
|
|
8354
8539
|
};
|
|
8355
|
-
const sortComparator = React68.useMemo(() => {
|
|
8356
|
-
if (!sort) return null;
|
|
8357
|
-
const col = leafColumns.find((c) => c.key === sort.key);
|
|
8358
|
-
if (!col) return null;
|
|
8359
|
-
const dir = sort.direction === "asc" ? 1 : -1;
|
|
8360
|
-
const sorter = col.sorter ?? ((a, b) => compareValues(getCellValue(a, col), getCellValue(b, col)));
|
|
8361
|
-
return (a, b) => sorter(a, b) * dir;
|
|
8362
|
-
}, [leafColumns, sort]);
|
|
8363
|
-
const sortedData = React68.useMemo(() => {
|
|
8364
|
-
if (!sortComparator) return data ?? [];
|
|
8365
|
-
return [...data ?? []].sort(sortComparator);
|
|
8366
|
-
}, [data, sortComparator]);
|
|
8367
|
-
const setSort = (next) => {
|
|
8368
|
-
if (!sortControlled) setSortInternal(next);
|
|
8369
|
-
onSortChange?.(next);
|
|
8370
|
-
};
|
|
8371
|
-
const cycleSort = (col) => {
|
|
8372
|
-
if (!col.sortable) return;
|
|
8373
|
-
if (!sort || sort.key !== col.key) {
|
|
8374
|
-
setSort({ key: col.key, direction: "asc" });
|
|
8375
|
-
return;
|
|
8376
|
-
}
|
|
8377
|
-
if (sort.direction === "asc") {
|
|
8378
|
-
setSort({ key: col.key, direction: "desc" });
|
|
8379
|
-
return;
|
|
8380
|
-
}
|
|
8381
|
-
setSort(null);
|
|
8382
|
-
};
|
|
8383
8540
|
const onHeaderKeyDown = (e, col) => {
|
|
8384
8541
|
if (!col.sortable) return;
|
|
8385
8542
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -8396,7 +8553,7 @@ function IrisTable({
|
|
|
8396
8553
|
selModel.toggle(rowKeyOf(row));
|
|
8397
8554
|
};
|
|
8398
8555
|
const treeMode = getSubRows !== void 0;
|
|
8399
|
-
const flatTree =
|
|
8556
|
+
const flatTree = React67.useMemo(
|
|
8400
8557
|
() => treeMode ? flattenTree(sortedData, {
|
|
8401
8558
|
getKey: (r) => String(rowKeyOf(r)),
|
|
8402
8559
|
// With an active sort, sort each level's children by the same
|
|
@@ -8416,7 +8573,7 @@ function IrisTable({
|
|
|
8416
8573
|
const allKeys = bodyData.map(rowKeyOf);
|
|
8417
8574
|
const allSelected = selectable === "multi" && (selControlled ? allKeys.length > 0 && allKeys.every((k) => displaySelection.includes(k)) : selModel.isAllSelected(allKeys));
|
|
8418
8575
|
const someSelected = selectable === "multi" && allKeys.some((k) => displaySelection.includes(k)) && !allSelected;
|
|
8419
|
-
const gridTemplateColumns =
|
|
8576
|
+
const gridTemplateColumns = React67.useMemo(() => {
|
|
8420
8577
|
const widths = [];
|
|
8421
8578
|
if (hasDetail) widths.push(`${EXPAND_COL_WIDTH}px`);
|
|
8422
8579
|
if (selectable !== "none") widths.push("40px");
|
|
@@ -8429,7 +8586,7 @@ function IrisTable({
|
|
|
8429
8586
|
}
|
|
8430
8587
|
return widths.join(" ");
|
|
8431
8588
|
}, [leafColumns, selectable, columnWidths, hasDetail]);
|
|
8432
|
-
const pinnedOffsets =
|
|
8589
|
+
const pinnedOffsets = React67.useMemo(() => {
|
|
8433
8590
|
const map = {};
|
|
8434
8591
|
const widthOf = (col) => columnWidths[col.key] ?? (typeof col.width === "number" ? col.width : DEFAULT_PINNED_WIDTH);
|
|
8435
8592
|
let left = (hasDetail ? EXPAND_COL_WIDTH : 0) + (selectable !== "none" ? SELECTION_COL_WIDTH : 0);
|
|
@@ -8459,20 +8616,20 @@ function IrisTable({
|
|
|
8459
8616
|
background: "var(--iris-background)"
|
|
8460
8617
|
};
|
|
8461
8618
|
};
|
|
8462
|
-
const rootRef =
|
|
8463
|
-
const [scrollLeft, setScrollLeft] =
|
|
8464
|
-
const [viewportWidth, setViewportWidth] =
|
|
8465
|
-
const cellRangeRef =
|
|
8619
|
+
const rootRef = React67.useRef(null);
|
|
8620
|
+
const [scrollLeft, setScrollLeft] = React67.useState(0);
|
|
8621
|
+
const [viewportWidth, setViewportWidth] = React67.useState(0);
|
|
8622
|
+
const cellRangeRef = React67.useRef(null);
|
|
8466
8623
|
if (cellRangeRef.current === null) {
|
|
8467
8624
|
cellRangeRef.current = createCellRange();
|
|
8468
8625
|
}
|
|
8469
8626
|
const cellRangeCtrl = cellRangeRef.current;
|
|
8470
|
-
const cellRangeState =
|
|
8627
|
+
const cellRangeState = React67.useSyncExternalStore(
|
|
8471
8628
|
cellRangeCtrl.subscribe,
|
|
8472
8629
|
cellRangeCtrl.getState,
|
|
8473
8630
|
cellRangeCtrl.getState
|
|
8474
8631
|
);
|
|
8475
|
-
const isInRange =
|
|
8632
|
+
const isInRange = React67.useCallback(
|
|
8476
8633
|
(row, col) => {
|
|
8477
8634
|
const { anchor, active } = cellRangeState;
|
|
8478
8635
|
if (!anchor || !active) return false;
|
|
@@ -8484,7 +8641,7 @@ function IrisTable({
|
|
|
8484
8641
|
},
|
|
8485
8642
|
[cellRangeState]
|
|
8486
8643
|
);
|
|
8487
|
-
const [focusedCell, setFocusedCell] =
|
|
8644
|
+
const [focusedCell, setFocusedCell] = React67.useState(null);
|
|
8488
8645
|
const GRID_NAV_KEYS = /* @__PURE__ */ new Set([
|
|
8489
8646
|
"ArrowUp",
|
|
8490
8647
|
"ArrowDown",
|
|
@@ -8537,13 +8694,13 @@ function IrisTable({
|
|
|
8537
8694
|
else nextCol = Math.min(leafColumns.length - 1, nextCol + 1);
|
|
8538
8695
|
cellRangeCtrl.extendRange(nextRow, nextCol);
|
|
8539
8696
|
};
|
|
8540
|
-
const resolvedColWidths =
|
|
8697
|
+
const resolvedColWidths = React67.useMemo(
|
|
8541
8698
|
() => leafColumns.map(
|
|
8542
8699
|
(col) => columnWidths[col.key] ?? (typeof col.width === "number" ? col.width : DEFAULT_PINNED_WIDTH)
|
|
8543
8700
|
),
|
|
8544
8701
|
[leafColumns, columnWidths]
|
|
8545
8702
|
);
|
|
8546
|
-
|
|
8703
|
+
React67.useEffect(() => {
|
|
8547
8704
|
if (!columnVirtualization) return;
|
|
8548
8705
|
const el = rootRef.current;
|
|
8549
8706
|
if (!el) return;
|
|
@@ -8554,7 +8711,7 @@ function IrisTable({
|
|
|
8554
8711
|
ro.observe(el);
|
|
8555
8712
|
return () => ro.disconnect();
|
|
8556
8713
|
}, [columnVirtualization]);
|
|
8557
|
-
const visibleColSet =
|
|
8714
|
+
const visibleColSet = React67.useMemo(() => {
|
|
8558
8715
|
if (!columnVirtualization) return null;
|
|
8559
8716
|
const w = computeVirtualRange({
|
|
8560
8717
|
itemCount: leafColumns.length,
|
|
@@ -8594,6 +8751,7 @@ function IrisTable({
|
|
|
8594
8751
|
"aria-posinset": treeMeta ? treeMeta.posInset : void 0,
|
|
8595
8752
|
"data-iris-table-row": String(k ?? idx),
|
|
8596
8753
|
"data-iris-table-row-selected": selected ? "true" : void 0,
|
|
8754
|
+
onClick: () => onRowClick?.(row, idx),
|
|
8597
8755
|
style: { display: "grid", gridTemplateColumns, ...extraStyle },
|
|
8598
8756
|
children: [
|
|
8599
8757
|
hasDetail ? /* @__PURE__ */ jsx(
|
|
@@ -8658,7 +8816,7 @@ function IrisTable({
|
|
|
8658
8816
|
) : null,
|
|
8659
8817
|
leafColumns.map((col, ci) => {
|
|
8660
8818
|
if (visibleColSet && !visibleColSet.has(ci)) return null;
|
|
8661
|
-
const raw =
|
|
8819
|
+
const raw = getCellValue2(row, col);
|
|
8662
8820
|
const editing = editingCellId === cellId(k, col.key);
|
|
8663
8821
|
return /* @__PURE__ */ jsxs(
|
|
8664
8822
|
"div",
|
|
@@ -8807,6 +8965,7 @@ function IrisTable({
|
|
|
8807
8965
|
if (cellRange) handleCellRangeKey(e);
|
|
8808
8966
|
} : void 0,
|
|
8809
8967
|
onScroll: columnVirtualization ? (e) => setScrollLeft(e.currentTarget.scrollLeft) : void 0,
|
|
8968
|
+
...rest,
|
|
8810
8969
|
style: {
|
|
8811
8970
|
background: "var(--iris-background)",
|
|
8812
8971
|
color: "var(--iris-foreground)",
|
|
@@ -9047,7 +9206,7 @@ function IrisTable({
|
|
|
9047
9206
|
const main = renderRow(row, idx, void 0, flatTree?.[idx]);
|
|
9048
9207
|
if (!hasDetail || !isRowExpandable(row, idx) || !expandedKeys.includes(String(rowKeyOf(row))))
|
|
9049
9208
|
return main;
|
|
9050
|
-
return /* @__PURE__ */ jsxs(
|
|
9209
|
+
return /* @__PURE__ */ jsxs(React67.Fragment, { children: [
|
|
9051
9210
|
main,
|
|
9052
9211
|
/* @__PURE__ */ jsx(
|
|
9053
9212
|
"div",
|
|
@@ -9085,7 +9244,7 @@ function IrisTable({
|
|
|
9085
9244
|
leafColumns.map((col, ci) => {
|
|
9086
9245
|
if (visibleColSet && !visibleColSet.has(ci)) return null;
|
|
9087
9246
|
const op = col.summary;
|
|
9088
|
-
const value = op ? aggregate(bodyData, (r) =>
|
|
9247
|
+
const value = op ? aggregate(bodyData, (r) => getCellValue2(r, col), op) : null;
|
|
9089
9248
|
return /* @__PURE__ */ jsx(
|
|
9090
9249
|
"div",
|
|
9091
9250
|
{
|
|
@@ -9105,45 +9264,23 @@ function IrisTable({
|
|
|
9105
9264
|
}
|
|
9106
9265
|
);
|
|
9107
9266
|
}
|
|
9108
|
-
var FORMULA_LEAD = /^[=+\-@\t\r]/;
|
|
9109
|
-
function neutralizeFormula(text) {
|
|
9110
|
-
return FORMULA_LEAD.test(text) ? `'${text}` : text;
|
|
9111
|
-
}
|
|
9112
|
-
function csvCell(value) {
|
|
9113
|
-
if (value == null) return "";
|
|
9114
|
-
const isNumber = typeof value === "number" && Number.isFinite(value);
|
|
9115
|
-
const s = isNumber ? String(value) : neutralizeFormula(String(value));
|
|
9116
|
-
if (/[",\r\n]/.test(s)) {
|
|
9117
|
-
return `"${s.replace(/"/g, '""')}"`;
|
|
9118
|
-
}
|
|
9119
|
-
return s;
|
|
9120
|
-
}
|
|
9121
9267
|
function exportCsv(rows, columns) {
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
${body}` : header;
|
|
9268
|
+
return toCsv(
|
|
9269
|
+
rows,
|
|
9270
|
+
columns.map((column) => ({
|
|
9271
|
+
key: column.key,
|
|
9272
|
+
title: column.title,
|
|
9273
|
+
dataIndex: typeof column.dataIndex === "string" ? column.dataIndex : void 0
|
|
9274
|
+
}))
|
|
9275
|
+
);
|
|
9131
9276
|
}
|
|
9132
9277
|
async function downloadCsv(filename, csv) {
|
|
9133
9278
|
const BOM = String.fromCharCode(65279);
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
const anchor = document.createElement("a");
|
|
9140
|
-
anchor.href = url;
|
|
9141
|
-
anchor.download = filename;
|
|
9142
|
-
anchor.style.display = "none";
|
|
9143
|
-
document.body.appendChild(anchor);
|
|
9144
|
-
anchor.click();
|
|
9145
|
-
document.body.removeChild(anchor);
|
|
9146
|
-
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
9279
|
+
await downloadFile({
|
|
9280
|
+
filename,
|
|
9281
|
+
content: BOM + csv,
|
|
9282
|
+
mimeType: "text/csv;charset=utf-8;"
|
|
9283
|
+
});
|
|
9147
9284
|
}
|
|
9148
9285
|
function exportExcel(rows, columns, options) {
|
|
9149
9286
|
return toSpreadsheetXml(
|
|
@@ -9157,20 +9294,11 @@ function exportExcel(rows, columns, options) {
|
|
|
9157
9294
|
);
|
|
9158
9295
|
}
|
|
9159
9296
|
async function downloadExcel(filename, xml) {
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
const url = URL.createObjectURL(blob);
|
|
9166
|
-
const anchor = document.createElement("a");
|
|
9167
|
-
anchor.href = url;
|
|
9168
|
-
anchor.download = filename;
|
|
9169
|
-
anchor.style.display = "none";
|
|
9170
|
-
document.body.appendChild(anchor);
|
|
9171
|
-
anchor.click();
|
|
9172
|
-
document.body.removeChild(anchor);
|
|
9173
|
-
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
9297
|
+
await downloadFile({
|
|
9298
|
+
filename,
|
|
9299
|
+
content: xml,
|
|
9300
|
+
mimeType: "application/vnd.ms-excel;charset=utf-8"
|
|
9301
|
+
});
|
|
9174
9302
|
}
|
|
9175
9303
|
function safeLocale(locale) {
|
|
9176
9304
|
if (locale === void 0) return void 0;
|
|
@@ -9191,33 +9319,34 @@ function IrisCalendar({
|
|
|
9191
9319
|
locale,
|
|
9192
9320
|
disabled = false,
|
|
9193
9321
|
style,
|
|
9194
|
-
className
|
|
9322
|
+
className,
|
|
9323
|
+
...rest
|
|
9195
9324
|
}) {
|
|
9196
9325
|
const { t } = useI18n();
|
|
9197
9326
|
const isControlled = valueProp !== void 0;
|
|
9198
|
-
const [internal, setInternal] =
|
|
9327
|
+
const [internal, setInternal] = React67.useState(defaultValue ?? null);
|
|
9199
9328
|
const selectedValue = isControlled ? valueProp : internal;
|
|
9200
9329
|
const initialMonth = defaultMonth ?? selectedValue ?? /* @__PURE__ */ new Date();
|
|
9201
|
-
const [visibleMonth, setVisibleMonth] =
|
|
9202
|
-
const [focusDate, setFocusDate] =
|
|
9330
|
+
const [visibleMonth, setVisibleMonth] = React67.useState(startOfMonth(initialMonth));
|
|
9331
|
+
const [focusDate, setFocusDate] = React67.useState(
|
|
9203
9332
|
clampDate(selectedValue ?? /* @__PURE__ */ new Date(), min, max)
|
|
9204
9333
|
);
|
|
9205
|
-
|
|
9334
|
+
React67.useEffect(() => {
|
|
9206
9335
|
if (selectedValue && !isSameMonth(selectedValue, visibleMonth)) {
|
|
9207
9336
|
setVisibleMonth(startOfMonth(selectedValue));
|
|
9208
9337
|
setFocusDate(clampDate(selectedValue, min, max));
|
|
9209
9338
|
}
|
|
9210
9339
|
}, [selectedValue, visibleMonth, min, max]);
|
|
9211
|
-
const matrix =
|
|
9340
|
+
const matrix = React67.useMemo(
|
|
9212
9341
|
() => buildMonthMatrix(visibleMonth, weekStartsOn),
|
|
9213
9342
|
[visibleMonth, weekStartsOn]
|
|
9214
9343
|
);
|
|
9215
|
-
const weekdays =
|
|
9344
|
+
const weekdays = React67.useMemo(
|
|
9216
9345
|
() => getWeekdayNames(weekStartsOn, locale),
|
|
9217
9346
|
[weekStartsOn, locale]
|
|
9218
9347
|
);
|
|
9219
|
-
const title =
|
|
9220
|
-
const dayLabelFmt =
|
|
9348
|
+
const title = React67.useMemo(() => formatMonthYear(visibleMonth, locale), [visibleMonth, locale]);
|
|
9349
|
+
const dayLabelFmt = React67.useMemo(
|
|
9221
9350
|
() => new Intl.DateTimeFormat(safeLocale(locale), {
|
|
9222
9351
|
weekday: "long",
|
|
9223
9352
|
year: "numeric",
|
|
@@ -9311,6 +9440,7 @@ function IrisCalendar({
|
|
|
9311
9440
|
className,
|
|
9312
9441
|
"data-iris-calendar": "",
|
|
9313
9442
|
"data-disabled": disabled ? "" : void 0,
|
|
9443
|
+
...rest,
|
|
9314
9444
|
style: {
|
|
9315
9445
|
display: "inline-flex",
|
|
9316
9446
|
flexDirection: "column",
|
|
@@ -9487,13 +9617,14 @@ function IrisDatePicker({
|
|
|
9487
9617
|
id,
|
|
9488
9618
|
ariaDescribedby,
|
|
9489
9619
|
style,
|
|
9490
|
-
className
|
|
9620
|
+
className,
|
|
9621
|
+
...rest
|
|
9491
9622
|
}) {
|
|
9492
9623
|
const { t } = useI18n();
|
|
9493
9624
|
const isControlled = valueProp !== void 0;
|
|
9494
|
-
const [internal, setInternal] =
|
|
9625
|
+
const [internal, setInternal] = React67.useState(defaultValue ?? null);
|
|
9495
9626
|
const value = isControlled ? valueProp : internal;
|
|
9496
|
-
const [open, setOpen] =
|
|
9627
|
+
const [open, setOpen] = React67.useState(false);
|
|
9497
9628
|
const display = formatDisplay(value, locale);
|
|
9498
9629
|
const handleSelect = (next) => {
|
|
9499
9630
|
if (!isControlled) setInternal(next);
|
|
@@ -9512,6 +9643,7 @@ function IrisDatePicker({
|
|
|
9512
9643
|
"aria-describedby": ariaDescribedby,
|
|
9513
9644
|
"data-iris-date-picker-trigger": "",
|
|
9514
9645
|
"data-iris-date-picker-iso": value ? formatLocalISO(value) : void 0,
|
|
9646
|
+
...rest,
|
|
9515
9647
|
"data-state": open ? "open" : "closed",
|
|
9516
9648
|
style: {
|
|
9517
9649
|
display: "inline-flex",
|
|
@@ -9574,13 +9706,14 @@ function IrisTree({
|
|
|
9574
9706
|
loadingState,
|
|
9575
9707
|
errorState,
|
|
9576
9708
|
style,
|
|
9577
|
-
className
|
|
9709
|
+
className,
|
|
9710
|
+
...rest
|
|
9578
9711
|
}) {
|
|
9579
9712
|
const safeNodes = nodes ?? [];
|
|
9580
9713
|
const expControlled = expandedProp !== void 0;
|
|
9581
9714
|
const selControlled = selectedProp !== void 0;
|
|
9582
|
-
const [expInternal, setExpInternal] =
|
|
9583
|
-
const [selInternal, setSelInternal] =
|
|
9715
|
+
const [expInternal, setExpInternal] = React67.useState(defaultExpanded);
|
|
9716
|
+
const [selInternal, setSelInternal] = React67.useState(defaultSelected);
|
|
9584
9717
|
const expanded = expControlled ? expandedProp : expInternal;
|
|
9585
9718
|
const selected = selControlled ? selectedProp : selInternal;
|
|
9586
9719
|
const { t } = useI18n();
|
|
@@ -9589,19 +9722,19 @@ function IrisTree({
|
|
|
9589
9722
|
error,
|
|
9590
9723
|
empty: safeNodes.length === 0
|
|
9591
9724
|
});
|
|
9592
|
-
const [lazyCache, setLazyCache] =
|
|
9593
|
-
const [loadingIds, setLoadingIds] =
|
|
9594
|
-
const [errorIds, setErrorIds] =
|
|
9595
|
-
const expandedSet =
|
|
9596
|
-
const selectedSet =
|
|
9597
|
-
const childrenOf =
|
|
9725
|
+
const [lazyCache, setLazyCache] = React67.useState(/* @__PURE__ */ new Map());
|
|
9726
|
+
const [loadingIds, setLoadingIds] = React67.useState(/* @__PURE__ */ new Set());
|
|
9727
|
+
const [errorIds, setErrorIds] = React67.useState(/* @__PURE__ */ new Set());
|
|
9728
|
+
const expandedSet = React67.useMemo(() => new Set(expanded), [expanded]);
|
|
9729
|
+
const selectedSet = React67.useMemo(() => new Set(selected), [selected]);
|
|
9730
|
+
const childrenOf = React67.useCallback(
|
|
9598
9731
|
(node) => {
|
|
9599
9732
|
if (node.children && node.children.length > 0) return node.children;
|
|
9600
9733
|
return lazyCache.get(node.id) ?? null;
|
|
9601
9734
|
},
|
|
9602
9735
|
[lazyCache]
|
|
9603
9736
|
);
|
|
9604
|
-
const hasChildrenFn =
|
|
9737
|
+
const hasChildrenFn = React67.useCallback(
|
|
9605
9738
|
(node) => {
|
|
9606
9739
|
if (node.isLeaf) return false;
|
|
9607
9740
|
if (node.children && node.children.length > 0) return true;
|
|
@@ -9610,7 +9743,7 @@ function IrisTree({
|
|
|
9610
9743
|
},
|
|
9611
9744
|
[lazyCache]
|
|
9612
9745
|
);
|
|
9613
|
-
const flat =
|
|
9746
|
+
const flat = React67.useMemo(() => {
|
|
9614
9747
|
const out = [];
|
|
9615
9748
|
const walk = (ns, depth, parentId) => {
|
|
9616
9749
|
for (const node of ns) {
|
|
@@ -9625,7 +9758,7 @@ function IrisTree({
|
|
|
9625
9758
|
walk(safeNodes, 0, null);
|
|
9626
9759
|
return out;
|
|
9627
9760
|
}, [safeNodes, expandedSet, childrenOf, hasChildrenFn]);
|
|
9628
|
-
const checkNodes =
|
|
9761
|
+
const checkNodes = React67.useMemo(() => {
|
|
9629
9762
|
const out = [];
|
|
9630
9763
|
const walk = (ns, parentKey) => {
|
|
9631
9764
|
for (const node of ns) {
|
|
@@ -9637,9 +9770,9 @@ function IrisTree({
|
|
|
9637
9770
|
walk(safeNodes, void 0);
|
|
9638
9771
|
return out;
|
|
9639
9772
|
}, [safeNodes, lazyCache]);
|
|
9640
|
-
const onCheckedRef =
|
|
9773
|
+
const onCheckedRef = React67.useRef(onCheckedChange);
|
|
9641
9774
|
onCheckedRef.current = onCheckedChange;
|
|
9642
|
-
const checkModel =
|
|
9775
|
+
const checkModel = React67.useMemo(
|
|
9643
9776
|
() => createTreeSelection({
|
|
9644
9777
|
nodes: checkNodes,
|
|
9645
9778
|
defaultChecked,
|
|
@@ -9647,18 +9780,18 @@ function IrisTree({
|
|
|
9647
9780
|
}),
|
|
9648
9781
|
[checkNodes, defaultChecked]
|
|
9649
9782
|
);
|
|
9650
|
-
|
|
9783
|
+
React67.useSyncExternalStore(
|
|
9651
9784
|
checkModel.selection.store.subscribe,
|
|
9652
9785
|
checkModel.selection.get,
|
|
9653
9786
|
checkModel.selection.get
|
|
9654
9787
|
);
|
|
9655
|
-
const [activeId, setActiveId] =
|
|
9656
|
-
|
|
9788
|
+
const [activeId, setActiveId] = React67.useState(flat[0]?.node.id ?? null);
|
|
9789
|
+
React67.useEffect(() => {
|
|
9657
9790
|
if (!activeId || !flat.some((f) => f.node.id === activeId)) {
|
|
9658
9791
|
setActiveId(flat[0]?.node.id ?? null);
|
|
9659
9792
|
}
|
|
9660
9793
|
}, [flat, activeId]);
|
|
9661
|
-
const expandedRef =
|
|
9794
|
+
const expandedRef = React67.useRef(expanded);
|
|
9662
9795
|
expandedRef.current = expanded;
|
|
9663
9796
|
const setExpanded = (next) => {
|
|
9664
9797
|
if (!expControlled) setExpInternal(next);
|
|
@@ -9767,6 +9900,7 @@ function IrisTree({
|
|
|
9767
9900
|
onKeyDown,
|
|
9768
9901
|
className,
|
|
9769
9902
|
"data-iris-tree": "",
|
|
9903
|
+
...rest,
|
|
9770
9904
|
style: {
|
|
9771
9905
|
display: "flex",
|
|
9772
9906
|
flexDirection: "column",
|
|
@@ -9941,14 +10075,15 @@ function IrisList({
|
|
|
9941
10075
|
errorState,
|
|
9942
10076
|
renderItem,
|
|
9943
10077
|
style,
|
|
9944
|
-
className
|
|
10078
|
+
className,
|
|
10079
|
+
...rest
|
|
9945
10080
|
}) {
|
|
9946
10081
|
const safeItems = items ?? [];
|
|
9947
10082
|
const isControlled = valueProp !== void 0;
|
|
9948
10083
|
const asKey = (v) => v;
|
|
9949
10084
|
const toKeys = (v) => v == null ? [] : Array.isArray(v) ? v.map(asKey) : [asKey(v)];
|
|
9950
10085
|
const fromKeys = (keys) => multi ? keys : keys[0] ?? null;
|
|
9951
|
-
const modelRef =
|
|
10086
|
+
const modelRef = React67.useRef(null);
|
|
9952
10087
|
if (modelRef.current === null) {
|
|
9953
10088
|
const initial = defaultValue !== void 0 ? defaultValue : multi ? [] : null;
|
|
9954
10089
|
modelRef.current = createSelectionModel({
|
|
@@ -9959,7 +10094,7 @@ function IrisList({
|
|
|
9959
10094
|
}
|
|
9960
10095
|
const model = modelRef.current;
|
|
9961
10096
|
const selectedKeys = useStore(model.store);
|
|
9962
|
-
|
|
10097
|
+
React67.useEffect(() => {
|
|
9963
10098
|
if (isControlled) model.sync(toKeys(valueProp));
|
|
9964
10099
|
}, [valueProp, isControlled, model]);
|
|
9965
10100
|
const displaySelectedKeys = isControlled ? toKeys(valueProp) : selectedKeys;
|
|
@@ -9972,12 +10107,12 @@ function IrisList({
|
|
|
9972
10107
|
error,
|
|
9973
10108
|
empty: safeItems.length === 0
|
|
9974
10109
|
});
|
|
9975
|
-
const isSelected =
|
|
10110
|
+
const isSelected = React67.useCallback(
|
|
9976
10111
|
(v) => displaySelectedKeys.includes(v),
|
|
9977
10112
|
[displaySelectedKeys]
|
|
9978
10113
|
);
|
|
9979
|
-
const isEnabled =
|
|
9980
|
-
const ctxRef =
|
|
10114
|
+
const isEnabled = React67.useCallback((i) => !safeItems[i]?.disabled, [safeItems]);
|
|
10115
|
+
const ctxRef = React67.useRef({
|
|
9981
10116
|
items: safeItems,
|
|
9982
10117
|
multi,
|
|
9983
10118
|
loop,
|
|
@@ -9987,7 +10122,7 @@ function IrisList({
|
|
|
9987
10122
|
onSelect,
|
|
9988
10123
|
asKey
|
|
9989
10124
|
});
|
|
9990
|
-
const navRef =
|
|
10125
|
+
const navRef = React67.useRef(null);
|
|
9991
10126
|
if (navRef.current === null) {
|
|
9992
10127
|
navRef.current = createKeyboardNav({
|
|
9993
10128
|
count: safeItems.length,
|
|
@@ -9996,7 +10131,7 @@ function IrisList({
|
|
|
9996
10131
|
});
|
|
9997
10132
|
}
|
|
9998
10133
|
const nav = navRef.current;
|
|
9999
|
-
|
|
10134
|
+
React67.useEffect(() => {
|
|
10000
10135
|
nav.reset(safeItems.length);
|
|
10001
10136
|
});
|
|
10002
10137
|
ctxRef.current = {
|
|
@@ -10010,7 +10145,7 @@ function IrisList({
|
|
|
10010
10145
|
asKey
|
|
10011
10146
|
};
|
|
10012
10147
|
const activeIndex = useStore(nav.store);
|
|
10013
|
-
const listRef =
|
|
10148
|
+
const listRef = React67.useRef(null);
|
|
10014
10149
|
const focusAt = (index) => {
|
|
10015
10150
|
const el = listRef.current?.querySelector(`[data-iris-list-index="${index}"]`);
|
|
10016
10151
|
el?.focus();
|
|
@@ -10051,6 +10186,7 @@ function IrisList({
|
|
|
10051
10186
|
"data-iris-list": "",
|
|
10052
10187
|
className,
|
|
10053
10188
|
onKeyDown,
|
|
10189
|
+
...rest,
|
|
10054
10190
|
style: {
|
|
10055
10191
|
listStyle: "none",
|
|
10056
10192
|
margin: 0,
|
|
@@ -10133,16 +10269,17 @@ function IrisFileUpload({
|
|
|
10133
10269
|
id,
|
|
10134
10270
|
renderList,
|
|
10135
10271
|
style,
|
|
10136
|
-
className
|
|
10272
|
+
className,
|
|
10273
|
+
...rest
|
|
10137
10274
|
}) {
|
|
10138
10275
|
const { t } = useI18n();
|
|
10139
10276
|
const resolvedLabel = label ?? t("fileUpload.label");
|
|
10140
10277
|
const isControlled = valueProp !== void 0;
|
|
10141
|
-
const [internal, setInternal] =
|
|
10278
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
10142
10279
|
const files = isControlled ? valueProp : internal;
|
|
10143
|
-
const inputRef =
|
|
10144
|
-
const dragCountRef =
|
|
10145
|
-
const [dragOver, setDragOver] =
|
|
10280
|
+
const inputRef = React67.useRef(null);
|
|
10281
|
+
const dragCountRef = React67.useRef(0);
|
|
10282
|
+
const [dragOver, setDragOver] = React67.useState(false);
|
|
10146
10283
|
const acceptMatches = (file) => {
|
|
10147
10284
|
if (!accept) return true;
|
|
10148
10285
|
const tokens = accept.split(",").map((t2) => t2.trim()).filter(Boolean);
|
|
@@ -10259,6 +10396,7 @@ function IrisFileUpload({
|
|
|
10259
10396
|
"data-drag-over": dragOver ? "true" : void 0,
|
|
10260
10397
|
"data-disabled": disabled ? "true" : void 0,
|
|
10261
10398
|
className,
|
|
10399
|
+
...rest,
|
|
10262
10400
|
style,
|
|
10263
10401
|
children: [
|
|
10264
10402
|
/* @__PURE__ */ jsx(
|
|
@@ -10366,9 +10504,9 @@ function IrisFileUpload({
|
|
|
10366
10504
|
}
|
|
10367
10505
|
);
|
|
10368
10506
|
}
|
|
10369
|
-
var MenuContext =
|
|
10507
|
+
var MenuContext = React67.createContext(null);
|
|
10370
10508
|
function useMenuContext(componentName) {
|
|
10371
|
-
const ctx =
|
|
10509
|
+
const ctx = React67.useContext(MenuContext);
|
|
10372
10510
|
if (!ctx) {
|
|
10373
10511
|
throw new Error(`[iris-ui] ${componentName} must be a descendant of <IrisMenu>`);
|
|
10374
10512
|
}
|
|
@@ -10385,7 +10523,7 @@ function IrisMenu({
|
|
|
10385
10523
|
const isControlled = openProp !== void 0;
|
|
10386
10524
|
const [state, send] = useMachine(() => createFloatingMachine(defaultOpen ? "open" : "closed"));
|
|
10387
10525
|
const internalOpen = state.value === "open";
|
|
10388
|
-
|
|
10526
|
+
React67.useEffect(() => {
|
|
10389
10527
|
if (!isControlled) return;
|
|
10390
10528
|
const target = openProp ? "open" : "closed";
|
|
10391
10529
|
if (state.value !== target) {
|
|
@@ -10393,18 +10531,18 @@ function IrisMenu({
|
|
|
10393
10531
|
}
|
|
10394
10532
|
}, [isControlled, openProp, state.value, send]);
|
|
10395
10533
|
const open = isControlled ? Boolean(openProp) : internalOpen;
|
|
10396
|
-
const setOpen =
|
|
10534
|
+
const setOpen = React67.useCallback(
|
|
10397
10535
|
(next) => {
|
|
10398
10536
|
if (!isControlled) send({ type: next ? "OPEN" : "CLOSE" });
|
|
10399
10537
|
onOpenChange?.(next);
|
|
10400
10538
|
},
|
|
10401
10539
|
[isControlled, send, onOpenChange]
|
|
10402
10540
|
);
|
|
10403
|
-
const triggerRef =
|
|
10404
|
-
const contentRef =
|
|
10405
|
-
const contentId =
|
|
10406
|
-
const closeRoot =
|
|
10407
|
-
const value =
|
|
10541
|
+
const triggerRef = React67.useRef(null);
|
|
10542
|
+
const contentRef = React67.useRef(null);
|
|
10543
|
+
const contentId = React67.useId();
|
|
10544
|
+
const closeRoot = React67.useCallback(() => setOpen(false), [setOpen]);
|
|
10545
|
+
const value = React67.useMemo(
|
|
10408
10546
|
() => ({
|
|
10409
10547
|
open,
|
|
10410
10548
|
setOpen,
|
|
@@ -10419,10 +10557,10 @@ function IrisMenu({
|
|
|
10419
10557
|
);
|
|
10420
10558
|
return /* @__PURE__ */ jsx(MenuContext.Provider, { value, children });
|
|
10421
10559
|
}
|
|
10422
|
-
var IrisMenuTrigger =
|
|
10560
|
+
var IrisMenuTrigger = React67.forwardRef(
|
|
10423
10561
|
function IrisMenuTrigger2({ asChild = false, onClick, onKeyDown, children, ...rest }, forwardedRef) {
|
|
10424
10562
|
const ctx = useMenuContext("IrisMenuTrigger");
|
|
10425
|
-
const captureRef =
|
|
10563
|
+
const captureRef = React67.useCallback(
|
|
10426
10564
|
(el) => {
|
|
10427
10565
|
ctx.triggerRef.current = el;
|
|
10428
10566
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -10453,7 +10591,7 @@ var IrisMenuTrigger = React68.forwardRef(
|
|
|
10453
10591
|
onKeyDown: handleKeyDown
|
|
10454
10592
|
};
|
|
10455
10593
|
if (asChild) {
|
|
10456
|
-
if (!
|
|
10594
|
+
if (!React67.isValidElement(children)) {
|
|
10457
10595
|
if (process.env.NODE_ENV !== "production") {
|
|
10458
10596
|
console.warn("[iris-ui] IrisMenuTrigger asChild requires a single React element");
|
|
10459
10597
|
}
|
|
@@ -10473,11 +10611,11 @@ var IrisMenuTrigger = React68.forwardRef(
|
|
|
10473
10611
|
);
|
|
10474
10612
|
}
|
|
10475
10613
|
);
|
|
10476
|
-
var IrisMenuContent =
|
|
10614
|
+
var IrisMenuContent = React67.forwardRef(
|
|
10477
10615
|
function IrisMenuContent2({ portalTarget, style, onKeyDown, children, ...rest }, forwardedRef) {
|
|
10478
10616
|
const ctx = useMenuContext("IrisMenuContent");
|
|
10479
|
-
const innerRef =
|
|
10480
|
-
const captureRef =
|
|
10617
|
+
const innerRef = React67.useRef(null);
|
|
10618
|
+
const captureRef = React67.useCallback(
|
|
10481
10619
|
(el) => {
|
|
10482
10620
|
innerRef.current = el;
|
|
10483
10621
|
ctx.contentRef.current = el;
|
|
@@ -10499,8 +10637,8 @@ var IrisMenuContent = React68.forwardRef(
|
|
|
10499
10637
|
exclude: [ctx.triggerRef, ctx.contentRef],
|
|
10500
10638
|
onDismiss: () => ctx.setOpen(false)
|
|
10501
10639
|
});
|
|
10502
|
-
const wasOpenRef =
|
|
10503
|
-
|
|
10640
|
+
const wasOpenRef = React67.useRef(false);
|
|
10641
|
+
React67.useEffect(() => {
|
|
10504
10642
|
if (ctx.open && !wasOpenRef.current) {
|
|
10505
10643
|
queueMicrotask(() => {
|
|
10506
10644
|
const items = innerRef.current?.querySelectorAll('[role="menuitem"]');
|
|
@@ -10511,7 +10649,7 @@ var IrisMenuContent = React68.forwardRef(
|
|
|
10511
10649
|
}
|
|
10512
10650
|
wasOpenRef.current = ctx.open;
|
|
10513
10651
|
}, [ctx.open, ctx.triggerRef]);
|
|
10514
|
-
const navRef =
|
|
10652
|
+
const navRef = React67.useRef(null);
|
|
10515
10653
|
if (navRef.current === null) {
|
|
10516
10654
|
navRef.current = createKeyboardNav({ count: 0, loop: true });
|
|
10517
10655
|
}
|
|
@@ -10574,10 +10712,10 @@ var IrisMenuContent = React68.forwardRef(
|
|
|
10574
10712
|
return createPortal(node, portalTarget ?? document.body);
|
|
10575
10713
|
}
|
|
10576
10714
|
);
|
|
10577
|
-
var IrisMenuItem =
|
|
10715
|
+
var IrisMenuItem = React67.forwardRef(
|
|
10578
10716
|
function IrisMenuItem2({ disabled = false, keepOpen = false, onSelect, onClick, onKeyDown, style, children, ...rest }, ref) {
|
|
10579
10717
|
const ctx = useMenuContext("IrisMenuItem");
|
|
10580
|
-
const [hovered, setHovered] =
|
|
10718
|
+
const [hovered, setHovered] = React67.useState(false);
|
|
10581
10719
|
const fire = (event) => {
|
|
10582
10720
|
if (disabled) return;
|
|
10583
10721
|
onSelect?.(event);
|
|
@@ -10632,7 +10770,7 @@ var IrisMenuItem = React68.forwardRef(
|
|
|
10632
10770
|
);
|
|
10633
10771
|
}
|
|
10634
10772
|
);
|
|
10635
|
-
var IrisMenuSeparator =
|
|
10773
|
+
var IrisMenuSeparator = React67.forwardRef(
|
|
10636
10774
|
function IrisMenuSeparator2({ style, ...rest }, ref) {
|
|
10637
10775
|
return /* @__PURE__ */ jsx(
|
|
10638
10776
|
"div",
|
|
@@ -10653,11 +10791,11 @@ function IrisMenuSub({
|
|
|
10653
10791
|
children
|
|
10654
10792
|
}) {
|
|
10655
10793
|
const parentCtx = useMenuContext("IrisMenuSub");
|
|
10656
|
-
const [open, setOpenState] =
|
|
10657
|
-
const triggerRef =
|
|
10658
|
-
const contentRef =
|
|
10659
|
-
const openTimerRef =
|
|
10660
|
-
const clearTimer =
|
|
10794
|
+
const [open, setOpenState] = React67.useState(false);
|
|
10795
|
+
const triggerRef = React67.useRef(null);
|
|
10796
|
+
const contentRef = React67.useRef(null);
|
|
10797
|
+
const openTimerRef = React67.useRef(null);
|
|
10798
|
+
const clearTimer = React67.useCallback(() => {
|
|
10661
10799
|
if (openTimerRef.current) {
|
|
10662
10800
|
clearTimeout(openTimerRef.current);
|
|
10663
10801
|
openTimerRef.current = null;
|
|
@@ -10670,7 +10808,7 @@ function IrisMenuSub({
|
|
|
10670
10808
|
openTimerRef.current = null;
|
|
10671
10809
|
}, HOVER_OPEN_DELAY);
|
|
10672
10810
|
};
|
|
10673
|
-
|
|
10811
|
+
React67.useEffect(() => clearTimer, [clearTimer]);
|
|
10674
10812
|
const { floatingStyles } = useFloating({
|
|
10675
10813
|
anchor: triggerRef,
|
|
10676
10814
|
floating: contentRef,
|
|
@@ -10678,9 +10816,9 @@ function IrisMenuSub({
|
|
|
10678
10816
|
placement: "right-start",
|
|
10679
10817
|
offset: -4
|
|
10680
10818
|
});
|
|
10681
|
-
const setOpen =
|
|
10682
|
-
const wasOpenRef =
|
|
10683
|
-
|
|
10819
|
+
const setOpen = React67.useCallback((v) => setOpenState(v), []);
|
|
10820
|
+
const wasOpenRef = React67.useRef(false);
|
|
10821
|
+
React67.useEffect(() => {
|
|
10684
10822
|
if (open && !wasOpenRef.current) {
|
|
10685
10823
|
queueMicrotask(() => {
|
|
10686
10824
|
const first = contentRef.current?.querySelector('[role="menuitem"]');
|
|
@@ -10725,7 +10863,7 @@ function IrisMenuSub({
|
|
|
10725
10863
|
parentCtx.closeRoot();
|
|
10726
10864
|
}
|
|
10727
10865
|
};
|
|
10728
|
-
const ctxValue =
|
|
10866
|
+
const ctxValue = React67.useMemo(
|
|
10729
10867
|
() => ({
|
|
10730
10868
|
open,
|
|
10731
10869
|
setOpen,
|
|
@@ -10837,7 +10975,7 @@ function IrisBanner({
|
|
|
10837
10975
|
}) {
|
|
10838
10976
|
const { t } = useI18n();
|
|
10839
10977
|
const isControlled = openProp !== void 0;
|
|
10840
|
-
const [internalOpen, setInternalOpen] =
|
|
10978
|
+
const [internalOpen, setInternalOpen] = React67.useState(defaultOpen);
|
|
10841
10979
|
const isOpen = isControlled ? Boolean(openProp) : internalOpen;
|
|
10842
10980
|
const handleClose = () => {
|
|
10843
10981
|
if (!isControlled) setInternalOpen(false);
|
|
@@ -10923,11 +11061,12 @@ function IrisTimePicker({
|
|
|
10923
11061
|
id,
|
|
10924
11062
|
ariaDescribedby,
|
|
10925
11063
|
style,
|
|
10926
|
-
className
|
|
11064
|
+
className,
|
|
11065
|
+
...rest
|
|
10927
11066
|
}) {
|
|
10928
11067
|
const { t } = useI18n();
|
|
10929
11068
|
const isControlled = valueProp !== void 0;
|
|
10930
|
-
const [internal, setInternal] =
|
|
11069
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
10931
11070
|
const value = isControlled ? valueProp ?? defaultValue : internal;
|
|
10932
11071
|
const setValue = (next) => {
|
|
10933
11072
|
if (!isControlled) setInternal(next);
|
|
@@ -11022,6 +11161,7 @@ function IrisTimePicker({
|
|
|
11022
11161
|
"data-iris-time-picker": "",
|
|
11023
11162
|
"data-disabled": disabled ? "true" : void 0,
|
|
11024
11163
|
className,
|
|
11164
|
+
...rest,
|
|
11025
11165
|
style: {
|
|
11026
11166
|
display: "inline-flex",
|
|
11027
11167
|
alignItems: "center",
|
|
@@ -11112,18 +11252,19 @@ function IrisDateRangePicker({
|
|
|
11112
11252
|
id,
|
|
11113
11253
|
ariaDescribedby,
|
|
11114
11254
|
style,
|
|
11115
|
-
className
|
|
11255
|
+
className,
|
|
11256
|
+
...rest
|
|
11116
11257
|
}) {
|
|
11117
11258
|
const { t } = useI18n();
|
|
11118
11259
|
const isControlled = valueProp !== void 0;
|
|
11119
|
-
const [internal, setInternal] =
|
|
11260
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
11120
11261
|
const value = isControlled ? valueProp ?? { start: null, end: null } : internal;
|
|
11121
|
-
const [open, setOpen] =
|
|
11122
|
-
const leftMonth =
|
|
11262
|
+
const [open, setOpen] = React67.useState(false);
|
|
11263
|
+
const leftMonth = React67.useMemo(
|
|
11123
11264
|
() => value.start ? startOfMonth(value.start) : startOfMonth(/* @__PURE__ */ new Date()),
|
|
11124
11265
|
[value.start]
|
|
11125
11266
|
);
|
|
11126
|
-
const display =
|
|
11267
|
+
const display = React67.useMemo(() => {
|
|
11127
11268
|
const s = formatDisplay2(value.start, locale);
|
|
11128
11269
|
const e = formatDisplay2(value.end, locale);
|
|
11129
11270
|
if (s && e) return `${s} \u2192 ${e}`;
|
|
@@ -11158,6 +11299,7 @@ function IrisDateRangePicker({
|
|
|
11158
11299
|
disabled: disabled || void 0,
|
|
11159
11300
|
"aria-invalid": invalid ? "true" : void 0,
|
|
11160
11301
|
"aria-describedby": ariaDescribedby,
|
|
11302
|
+
...rest,
|
|
11161
11303
|
"data-iris-date-range-picker-trigger": "",
|
|
11162
11304
|
"data-state": open ? "open" : "closed",
|
|
11163
11305
|
style: {
|
|
@@ -11241,14 +11383,14 @@ function IrisSlider({
|
|
|
11241
11383
|
}) {
|
|
11242
11384
|
const { t } = useI18n();
|
|
11243
11385
|
const isControlled = valueProp !== void 0;
|
|
11244
|
-
const [internal, setInternal] =
|
|
11386
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
11245
11387
|
const raw = isControlled ? valueProp : internal;
|
|
11246
11388
|
const value = clamp4(roundToStep2(raw, step, min), min, max);
|
|
11247
|
-
const valueRef =
|
|
11389
|
+
const valueRef = React67.useRef(value);
|
|
11248
11390
|
valueRef.current = value;
|
|
11249
|
-
const trackRef =
|
|
11250
|
-
const thumbRef =
|
|
11251
|
-
const [dragging, setDragging] =
|
|
11391
|
+
const trackRef = React67.useRef(null);
|
|
11392
|
+
const thumbRef = React67.useRef(null);
|
|
11393
|
+
const [dragging, setDragging] = React67.useState(false);
|
|
11252
11394
|
const isHorizontal = orientation === "horizontal";
|
|
11253
11395
|
const setValue = (next) => {
|
|
11254
11396
|
const clamped = clamp4(roundToStep2(next, step, min), min, max);
|
|
@@ -11416,16 +11558,16 @@ function IrisRangeSlider({
|
|
|
11416
11558
|
}) {
|
|
11417
11559
|
const { t } = useI18n();
|
|
11418
11560
|
const isControlled = valueProp !== void 0;
|
|
11419
|
-
const [internal, setInternal] =
|
|
11561
|
+
const [internal, setInternal] = React67.useState(defaultValue);
|
|
11420
11562
|
const raw = isControlled ? valueProp : internal;
|
|
11421
11563
|
const startVal = clamp5(roundToStep3(raw[0] ?? min, step, min), min, max);
|
|
11422
11564
|
const endVal = clamp5(roundToStep3(raw[1] ?? max, step, min), min, max);
|
|
11423
|
-
const trackRef =
|
|
11424
|
-
const startRef =
|
|
11425
|
-
const endRef =
|
|
11426
|
-
const [dragging, setDragging] =
|
|
11565
|
+
const trackRef = React67.useRef(null);
|
|
11566
|
+
const startRef = React67.useRef(null);
|
|
11567
|
+
const endRef = React67.useRef(null);
|
|
11568
|
+
const [dragging, setDragging] = React67.useState(null);
|
|
11427
11569
|
const percent = (v) => (v - min) / Math.max(1e-9, max - min) * 100;
|
|
11428
|
-
const setRange =
|
|
11570
|
+
const setRange = React67.useCallback(
|
|
11429
11571
|
(next) => {
|
|
11430
11572
|
if (!isControlled) setInternal(next);
|
|
11431
11573
|
onChange?.(next);
|
|
@@ -11628,14 +11770,14 @@ function IrisColorPicker({
|
|
|
11628
11770
|
}) {
|
|
11629
11771
|
const { t } = useI18n();
|
|
11630
11772
|
const initialHex = value ?? defaultValue ?? "#000000";
|
|
11631
|
-
const [hsva, setHsva] =
|
|
11773
|
+
const [hsva, setHsva] = React67.useState(
|
|
11632
11774
|
() => rgbaToHsva(hexToRgba(initialHex) ?? { r: 0, g: 0, b: 0, a: 1 })
|
|
11633
11775
|
);
|
|
11634
|
-
const [hexDraft, setHexDraft] =
|
|
11635
|
-
const padRef =
|
|
11636
|
-
const hueRef =
|
|
11637
|
-
const alphaRef =
|
|
11638
|
-
|
|
11776
|
+
const [hexDraft, setHexDraft] = React67.useState(null);
|
|
11777
|
+
const padRef = React67.useRef(null);
|
|
11778
|
+
const hueRef = React67.useRef(null);
|
|
11779
|
+
const alphaRef = React67.useRef(null);
|
|
11780
|
+
React67.useEffect(() => {
|
|
11639
11781
|
if (value === void 0) return;
|
|
11640
11782
|
const parsed = hexToRgba(value);
|
|
11641
11783
|
if (!parsed) return;
|
|
@@ -11966,10 +12108,10 @@ function IrisCommandPalette({
|
|
|
11966
12108
|
const { t } = useI18n();
|
|
11967
12109
|
const resolvedPlaceholder = placeholder ?? t("commandPalette.placeholder");
|
|
11968
12110
|
const resolvedEmptyText = emptyText ?? t("commandPalette.empty");
|
|
11969
|
-
const [query, setQuery] =
|
|
11970
|
-
const [activeIndex, setActiveIndex] =
|
|
11971
|
-
const surfaceRef =
|
|
11972
|
-
const matches =
|
|
12111
|
+
const [query, setQuery] = React67.useState("");
|
|
12112
|
+
const [activeIndex, setActiveIndex] = React67.useState(0);
|
|
12113
|
+
const surfaceRef = React67.useRef(null);
|
|
12114
|
+
const matches = React67.useMemo(() => {
|
|
11973
12115
|
const result = [];
|
|
11974
12116
|
for (const item of items) {
|
|
11975
12117
|
const score = filter(query, item);
|
|
@@ -11978,7 +12120,7 @@ function IrisCommandPalette({
|
|
|
11978
12120
|
result.sort((a, b) => a.score - b.score);
|
|
11979
12121
|
return result;
|
|
11980
12122
|
}, [items, query, filter]);
|
|
11981
|
-
const groupedFlat =
|
|
12123
|
+
const groupedFlat = React67.useMemo(() => {
|
|
11982
12124
|
const out = [];
|
|
11983
12125
|
let currentGroup;
|
|
11984
12126
|
for (const m of matches) {
|
|
@@ -11991,19 +12133,19 @@ function IrisCommandPalette({
|
|
|
11991
12133
|
}
|
|
11992
12134
|
return out;
|
|
11993
12135
|
}, [matches]);
|
|
11994
|
-
const itemRows =
|
|
12136
|
+
const itemRows = React67.useMemo(() => {
|
|
11995
12137
|
const out = [];
|
|
11996
12138
|
groupedFlat.forEach((row, i) => {
|
|
11997
12139
|
if (row.kind === "item" && !row.item.disabled) out.push({ item: row.item, flat: i });
|
|
11998
12140
|
});
|
|
11999
12141
|
return out;
|
|
12000
12142
|
}, [groupedFlat]);
|
|
12001
|
-
|
|
12143
|
+
React67.useEffect(() => {
|
|
12002
12144
|
if (!open) return;
|
|
12003
12145
|
setQuery("");
|
|
12004
12146
|
setActiveIndex(0);
|
|
12005
12147
|
}, [open]);
|
|
12006
|
-
|
|
12148
|
+
React67.useEffect(() => {
|
|
12007
12149
|
setActiveIndex(0);
|
|
12008
12150
|
}, [query]);
|
|
12009
12151
|
useBodyScrollLock(open);
|
|
@@ -12020,7 +12162,7 @@ function IrisCommandPalette({
|
|
|
12020
12162
|
if (total === 0) return;
|
|
12021
12163
|
setActiveIndex((prev) => (prev + delta + total) % total);
|
|
12022
12164
|
};
|
|
12023
|
-
const keyHandlerRef =
|
|
12165
|
+
const keyHandlerRef = React67.useRef(() => {
|
|
12024
12166
|
});
|
|
12025
12167
|
keyHandlerRef.current = (event) => {
|
|
12026
12168
|
switch (event.key) {
|
|
@@ -12044,7 +12186,7 @@ function IrisCommandPalette({
|
|
|
12044
12186
|
break;
|
|
12045
12187
|
}
|
|
12046
12188
|
};
|
|
12047
|
-
|
|
12189
|
+
React67.useEffect(() => {
|
|
12048
12190
|
if (!open) return;
|
|
12049
12191
|
const onKey = (e) => keyHandlerRef.current(e);
|
|
12050
12192
|
document.addEventListener("keydown", onKey);
|
|
@@ -12212,6 +12354,6 @@ function IrisCommandPalette({
|
|
|
12212
12354
|
return createPortal(node, document.body);
|
|
12213
12355
|
}
|
|
12214
12356
|
|
|
12215
|
-
export { AccordionContext, DialogContext, DrawerContext, IrisAccordion, IrisAccordionItem, IrisAffix, IrisAnchor, IrisAspectRatio, IrisAvatar, IrisBackTop, IrisBadge, IrisBanner, IrisCalendar, IrisCard, IrisCarousel, IrisCascader, IrisChip, IrisColorPicker, IrisCombobox, IrisCommandPalette, IrisCopyButton, IrisCountdown, IrisDatePicker, IrisDateRangePicker, IrisDescriptions, IrisDialog, IrisDialogClose, IrisDialogContent, IrisDialogDescription, IrisDialogTitle, IrisDialogTrigger, IrisDragger, IrisDrawer, IrisDrawerClose, IrisDrawerContent, IrisDrawerTitle, IrisDrawerTrigger, IrisEmptyState, IrisFieldset, IrisFileUpload, IrisFloatButton, IrisGauge, IrisImage, IrisKbd, IrisList, IrisMarquee, IrisMasonry, IrisMentions, IrisMenu, IrisMenuContent, IrisMenuItem, IrisMenuSeparator, IrisMenuSub, IrisMenuTrigger, IrisNumberInput, IrisOtpInput, IrisPagination, IrisPopover, IrisPopoverContent, IrisPopoverTrigger, IrisProgress, IrisProgressCircle, IrisRadio, IrisRadioGroup, IrisRangeSlider, IrisRating, IrisResizer, IrisResult, IrisRibbon, IrisScrollArea, IrisSegmented, IrisSelect, IrisSkeleton, IrisSlider, IrisSpinner, IrisSplitButton, IrisSplitter, IrisStatistic, IrisStepper, IrisStepperStep, IrisSwitch, IrisTable, IrisTabs, IrisTabsContent, IrisTabsList, IrisTabsTrigger, IrisTagInput, IrisTextarea, IrisTimePicker, IrisTimeline, IrisToastViewport, IrisToggleGroup, IrisToggleGroupItem, IrisToolbar, IrisTooltip, IrisTour, IrisTransfer, IrisTree, IrisTreeSelect, IrisVirtualScroll, IrisVisuallyHidden, IrisWatermark, MenuContext, PopoverContext, RadioGroupContext, StepperContext, TabsContext, ToggleGroupContext, __PROGRESS_STYLE_ID, __SKELETON_STYLE_ID, __SPINNER_STYLE_ID, __resetProgressStyles, __resetSkeletonStyles, __resetSpinnerStyles, clearToasts, defaultFilter, dismissToast, downloadCsv, downloadExcel, exportCsv, exportExcel, formatBytes, formatRemaining, getToasts, pushToast, subscribeToasts, useAccordionContext, useDialogContext, useDrawerContext, useMenuContext, usePopoverContext, useStepperContext, useTabsContext, useToast, useToggleGroupContext };
|
|
12357
|
+
export { AccordionContext, DialogContext, DrawerContext, IrisAccordion, IrisAccordionItem, IrisAffix, IrisAnchor, IrisAspectRatio, IrisAvatar, IrisBackTop, IrisBadge, IrisBanner, IrisCalendar, IrisCard, IrisCarousel, IrisCascader, IrisChip, IrisColorPicker, IrisCombobox, IrisCommandPalette, IrisCopyButton, IrisCountdown, IrisDatePicker, IrisDateRangePicker, IrisDescriptions, IrisDialog, IrisDialogClose, IrisDialogContent, IrisDialogDescription, IrisDialogTitle, IrisDialogTrigger, IrisDragger, IrisDrawer, IrisDrawerClose, IrisDrawerContent, IrisDrawerTitle, IrisDrawerTrigger, IrisEmptyState, IrisFieldset, IrisFileUpload, IrisFloatButton, IrisGauge, IrisImage, IrisKbd, IrisList, IrisMarquee, IrisMasonry, IrisMentions, IrisMenu, IrisMenuContent, IrisMenuItem, IrisMenuSeparator, IrisMenuSub, IrisMenuTrigger, IrisNumberInput, IrisOtpInput, IrisPagination, IrisPopover, IrisPopoverContent, IrisPopoverTrigger, IrisProgress, IrisProgressCircle, IrisRadio, IrisRadioGroup, IrisRangeSlider, IrisRating, IrisResizer, IrisResult, IrisRibbon, IrisScrollArea, IrisSegmented, IrisSelect, IrisSkeleton, IrisSlider, IrisSpinner, IrisSplitButton, IrisSplitter, IrisStatistic, IrisStepper, IrisStepperStep, IrisSwitch, IrisTable, IrisTabs, IrisTabsContent, IrisTabsList, IrisTabsTrigger, IrisTagInput, IrisTextarea, IrisTimePicker, IrisTimeline, IrisToastViewport, IrisToggleGroup, IrisToggleGroupItem, IrisToolbar, IrisTooltip, IrisTour, IrisTransfer, IrisTree, IrisTreeSelect, IrisVirtualScroll, IrisVisuallyHidden, IrisWatermark, MenuContext, PopoverContext, RadioGroupContext, StepperContext, TabsContext, ToggleGroupContext, __PROGRESS_STYLE_ID, __SKELETON_STYLE_ID, __SPINNER_STYLE_ID, __resetProgressStyles, __resetSkeletonStyles, __resetSpinnerStyles, clearToasts, defaultFilter, dismissToast, downloadCsv, downloadExcel, exportCsv, exportExcel, formatBytes, formatRemaining, getToasts, pushToast, subscribeToasts, useAccordionContext, useDialogContext, useDisposableScope, useDrawerContext, useMenuContext, usePopoverContext, useReconnectingSource, useResilientFetcher, useStepperContext, useTabsContext, useToast, useToggleGroupContext };
|
|
12216
12358
|
//# sourceMappingURL=index.js.map
|
|
12217
12359
|
//# sourceMappingURL=index.js.map
|