@iris-ui-kit/react 0.2.0 → 0.2.2
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 +25 -25
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +2 -2
- package/dist/behaviors.cjs.map +1 -1
- package/dist/behaviors.js +1 -1
- package/dist/{chunk-SJO74IB3.js → chunk-7ILMMLK6.js} +2 -2
- package/dist/chunk-7ILMMLK6.js.map +1 -0
- package/dist/{chunk-6BMFMCMQ.js → chunk-AE2TTLTK.js} +2 -2
- package/dist/{chunk-6BMFMCMQ.js.map → chunk-AE2TTLTK.js.map} +1 -1
- package/dist/{chunk-BCL32KSE.js → chunk-APA5KNCK.js} +2 -2
- package/dist/chunk-APA5KNCK.js.map +1 -0
- package/dist/{chunk-YAHXR2CJ.js → chunk-CYQO33XH.js} +29 -5
- package/dist/chunk-CYQO33XH.js.map +1 -0
- package/dist/{chunk-XVXURJZQ.js → chunk-OD2O3BPM.js} +28 -28
- package/dist/chunk-OD2O3BPM.js.map +1 -0
- package/dist/{chunk-B4RS5WKC.js → chunk-V3KHE2WB.js} +137 -75
- package/dist/chunk-V3KHE2WB.js.map +1 -0
- package/dist/floating.cjs.map +1 -1
- package/dist/floating.js +1 -1
- package/dist/index.cjs +1605 -1104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +1221 -806
- package/dist/index.js.map +1 -1
- package/dist/layouts.cjs.map +1 -1
- package/dist/layouts.js +1 -1
- package/dist/skeletons.cjs +135 -73
- package/dist/skeletons.cjs.map +1 -1
- package/dist/skeletons.js +1 -1
- package/dist/undo.cjs +27 -3
- package/dist/undo.cjs.map +1 -1
- package/dist/undo.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-B4RS5WKC.js.map +0 -1
- package/dist/chunk-BCL32KSE.js.map +0 -1
- package/dist/chunk-SJO74IB3.js.map +0 -1
- package/dist/chunk-XVXURJZQ.js.map +0 -1
- package/dist/chunk-YAHXR2CJ.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
export { createUndoStack, useUndoStack } from './chunk-
|
|
3
|
-
export { IrisGrid } from './chunk-
|
|
2
|
+
export { createUndoStack, useUndoStack } from './chunk-CYQO33XH.js';
|
|
3
|
+
export { IrisGrid } from './chunk-7ILMMLK6.js';
|
|
4
4
|
import { useBodyScrollLock, useFocusTrap } from './chunk-AUA5GBT6.js';
|
|
5
5
|
export { __getBodyScrollLockCount, __resetBodyScrollLock, useBodyScrollLock, useFocusTrap } from './chunk-AUA5GBT6.js';
|
|
6
6
|
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-V3KHE2WB.js';
|
|
11
|
+
export { IrisAlert, IrisButton, IrisCheckbox, IrisDashboardTemplate, IrisDivider, IrisFormField, IrisInput, IrisLoginTemplate, IrisPasswordInput } from './chunk-V3KHE2WB.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, createAdminPreferences, createTabsNav, filterNavByAccess, findNavNode, findNavPath, firstLeaf, flattenNav, isBranch, isClosable, localStorageAdminPreferencesStorage, nodeAllowsRoles, useAdminPreferences, useAdminShell, useDropdownContext, useMachine, useTabsNav, visibleNav } from './chunk-
|
|
14
|
+
import { IrisSlot, useMachine } from './chunk-OD2O3BPM.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-OD2O3BPM.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, useDrag } from './chunk-
|
|
19
|
+
import { useDrag } from './chunk-APA5KNCK.js';
|
|
20
|
+
export { IrisClickOutside, IrisHotkey, IrisLongPress, IrisMovable, IrisResizable, useDrag } from './chunk-APA5KNCK.js';
|
|
21
21
|
export { IrisSortable, SORTABLE_ITEM_ATTR } from './chunk-K2F7SC2T.js';
|
|
22
22
|
export { createClientDataSource, createDataSource, createGroupedView, useDataSource, useGroupedView } from './chunk-53KFLVIZ.js';
|
|
23
23
|
export { IrisErrorBoundary } from './chunk-SORLRLS4.js';
|
|
24
24
|
import { useI18n } from './chunk-OMOTUHYI.js';
|
|
25
25
|
export { I18nContext, IrisI18nProvider, useI18n } from './chunk-OMOTUHYI.js';
|
|
26
26
|
import './chunk-YXIO5THG.js';
|
|
27
|
-
import { useFloating, useDismiss } from './chunk-
|
|
28
|
-
export { useDismiss, useFloating } from './chunk-
|
|
27
|
+
import { useFloating, useDismiss } from './chunk-AE2TTLTK.js';
|
|
28
|
+
export { useDismiss, useFloating } from './chunk-AE2TTLTK.js';
|
|
29
29
|
export { FormContext, IrisForm, useField, useFieldArray, useForm, useFormContext } from './chunk-DE6V6NOI.js';
|
|
30
30
|
import { useStore } from './chunk-RZNYIFV2.js';
|
|
31
31
|
export { useStore, useStoreSelector } from './chunk-RZNYIFV2.js';
|
|
32
|
-
import * as
|
|
32
|
+
import * as React70 from 'react';
|
|
33
33
|
import { useState, useRef, useEffect } from 'react';
|
|
34
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';
|
|
35
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';
|
|
@@ -102,7 +102,7 @@ function badgeStyle(variant, tone, size) {
|
|
|
102
102
|
fontWeight: 500,
|
|
103
103
|
lineHeight: 1,
|
|
104
104
|
whiteSpace: "nowrap",
|
|
105
|
-
fontSize: size === "sm" ? "
|
|
105
|
+
fontSize: size === "sm" ? "var(--iris-font-size-xs, 12px)" : "12px",
|
|
106
106
|
padding: size === "sm" ? "2px 6px" : "3px 8px"
|
|
107
107
|
};
|
|
108
108
|
switch (variant) {
|
|
@@ -110,7 +110,7 @@ function badgeStyle(variant, tone, size) {
|
|
|
110
110
|
return {
|
|
111
111
|
...base,
|
|
112
112
|
background: v,
|
|
113
|
-
color: "var(--iris-primary-foreground, #fff)",
|
|
113
|
+
color: tone === "warning" ? "var(--iris-warning-foreground, #451a03)" : tone === "primary" ? "var(--iris-primary-foreground, #fff)" : tone === "success" ? "var(--iris-success-foreground, #0f172a)" : tone === "danger" ? "var(--iris-danger-foreground, #0f172a)" : "var(--iris-foreground, #0f172a)",
|
|
114
114
|
border: "1px solid transparent"
|
|
115
115
|
};
|
|
116
116
|
case "outline":
|
|
@@ -172,8 +172,8 @@ function IrisAvatar({
|
|
|
172
172
|
style,
|
|
173
173
|
...rest
|
|
174
174
|
}) {
|
|
175
|
-
const [failed, setFailed] =
|
|
176
|
-
|
|
175
|
+
const [failed, setFailed] = React70.useState(false);
|
|
176
|
+
React70.useEffect(() => {
|
|
177
177
|
setFailed(false);
|
|
178
178
|
}, [src]);
|
|
179
179
|
const px = resolveSize(size);
|
|
@@ -280,7 +280,7 @@ function IrisSpinner({
|
|
|
280
280
|
...rest
|
|
281
281
|
}) {
|
|
282
282
|
const { t } = useI18n();
|
|
283
|
-
|
|
283
|
+
React70.useEffect(installSpinnerStyles, []);
|
|
284
284
|
const px = resolveSize2(size);
|
|
285
285
|
const sw = strokeWidth || Math.max(1.5, Math.round(px * 0.12));
|
|
286
286
|
const resolvedLabel = label ?? t("spinner.loading");
|
|
@@ -327,11 +327,27 @@ function IrisSpinner({
|
|
|
327
327
|
}
|
|
328
328
|
);
|
|
329
329
|
}
|
|
330
|
+
var STYLE_ID = "iris-card-styles";
|
|
331
|
+
var installed2 = false;
|
|
332
|
+
function installCardStyles() {
|
|
333
|
+
if (installed2 || typeof document === "undefined") return;
|
|
334
|
+
installed2 = true;
|
|
335
|
+
if (document.getElementById(STYLE_ID)) return;
|
|
336
|
+
const style = document.createElement("style");
|
|
337
|
+
style.id = STYLE_ID;
|
|
338
|
+
style.textContent = `
|
|
339
|
+
[data-iris-card-hover="true"]:hover {
|
|
340
|
+
transform: translateY(-2px);
|
|
341
|
+
box-shadow: var(--iris-shadow-lg);
|
|
342
|
+
}
|
|
343
|
+
`;
|
|
344
|
+
document.head.appendChild(style);
|
|
345
|
+
}
|
|
330
346
|
var PADDING_MAP = {
|
|
331
347
|
none: "0",
|
|
332
348
|
sm: "12px",
|
|
333
|
-
md: "var(--iris-padding-
|
|
334
|
-
lg: "24px"
|
|
349
|
+
md: "var(--iris-padding-lg, 20px)",
|
|
350
|
+
lg: "var(--iris-space-xl, 24px)"
|
|
335
351
|
};
|
|
336
352
|
function variantStyle(variant) {
|
|
337
353
|
const base = {
|
|
@@ -344,7 +360,7 @@ function variantStyle(variant) {
|
|
|
344
360
|
};
|
|
345
361
|
switch (variant) {
|
|
346
362
|
case "elevated":
|
|
347
|
-
return { ...base, boxShadow: "
|
|
363
|
+
return { ...base, boxShadow: "var(--iris-shadow-md)" };
|
|
348
364
|
case "outline":
|
|
349
365
|
return { ...base, border: "1px solid var(--iris-border)" };
|
|
350
366
|
case "subtle":
|
|
@@ -367,6 +383,9 @@ function IrisCard({
|
|
|
367
383
|
transition: hover ? "transform 160ms ease, box-shadow 160ms ease" : "none",
|
|
368
384
|
...style
|
|
369
385
|
};
|
|
386
|
+
React70.useEffect(() => {
|
|
387
|
+
installCardStyles();
|
|
388
|
+
}, []);
|
|
370
389
|
return /* @__PURE__ */ jsxs(
|
|
371
390
|
"div",
|
|
372
391
|
{
|
|
@@ -437,7 +456,7 @@ var CSS2 = `
|
|
|
437
456
|
border-radius: 50%;
|
|
438
457
|
}
|
|
439
458
|
[data-iris-skeleton-shape="text"] {
|
|
440
|
-
border-radius: 4px;
|
|
459
|
+
border-radius: var(--iris-radius-sm, 4px);
|
|
441
460
|
}
|
|
442
461
|
@media (prefers-reduced-motion: reduce) {
|
|
443
462
|
[data-iris-skeleton][data-iris-skeleton-animated="true"] {
|
|
@@ -445,22 +464,22 @@ var CSS2 = `
|
|
|
445
464
|
}
|
|
446
465
|
}
|
|
447
466
|
`.trim();
|
|
448
|
-
var
|
|
467
|
+
var installed3 = false;
|
|
449
468
|
function installSkeletonStyles() {
|
|
450
|
-
if (
|
|
469
|
+
if (installed3) return;
|
|
451
470
|
if (typeof document === "undefined") return;
|
|
452
471
|
if (document.getElementById(__SKELETON_STYLE_ID)) {
|
|
453
|
-
|
|
472
|
+
installed3 = true;
|
|
454
473
|
return;
|
|
455
474
|
}
|
|
456
475
|
const el = document.createElement("style");
|
|
457
476
|
el.id = __SKELETON_STYLE_ID;
|
|
458
477
|
el.textContent = CSS2;
|
|
459
478
|
document.head.appendChild(el);
|
|
460
|
-
|
|
479
|
+
installed3 = true;
|
|
461
480
|
}
|
|
462
481
|
function __resetSkeletonStyles() {
|
|
463
|
-
|
|
482
|
+
installed3 = false;
|
|
464
483
|
if (typeof document !== "undefined") {
|
|
465
484
|
document.getElementById(__SKELETON_STYLE_ID)?.remove();
|
|
466
485
|
}
|
|
@@ -487,7 +506,7 @@ function IrisSkeleton({
|
|
|
487
506
|
...rest
|
|
488
507
|
}) {
|
|
489
508
|
const { t } = useI18n();
|
|
490
|
-
|
|
509
|
+
React70.useEffect(installSkeletonStyles, []);
|
|
491
510
|
const w = width !== void 0 ? toCss(width) : defaultWidth(shape);
|
|
492
511
|
const h = height !== void 0 ? toCss(height) : defaultHeight(shape, width);
|
|
493
512
|
return /* @__PURE__ */ jsx(
|
|
@@ -540,22 +559,22 @@ var CSS3 = `
|
|
|
540
559
|
}
|
|
541
560
|
}
|
|
542
561
|
`.trim();
|
|
543
|
-
var
|
|
562
|
+
var installed4 = false;
|
|
544
563
|
function installProgressStyles() {
|
|
545
|
-
if (
|
|
564
|
+
if (installed4) return;
|
|
546
565
|
if (typeof document === "undefined") return;
|
|
547
566
|
if (document.getElementById(__PROGRESS_STYLE_ID)) {
|
|
548
|
-
|
|
567
|
+
installed4 = true;
|
|
549
568
|
return;
|
|
550
569
|
}
|
|
551
570
|
const el = document.createElement("style");
|
|
552
571
|
el.id = __PROGRESS_STYLE_ID;
|
|
553
572
|
el.textContent = CSS3;
|
|
554
573
|
document.head.appendChild(el);
|
|
555
|
-
|
|
574
|
+
installed4 = true;
|
|
556
575
|
}
|
|
557
576
|
function __resetProgressStyles() {
|
|
558
|
-
|
|
577
|
+
installed4 = false;
|
|
559
578
|
if (typeof document !== "undefined") {
|
|
560
579
|
document.getElementById(__PROGRESS_STYLE_ID)?.remove();
|
|
561
580
|
}
|
|
@@ -579,7 +598,7 @@ function IrisProgress({
|
|
|
579
598
|
style,
|
|
580
599
|
...rest
|
|
581
600
|
}) {
|
|
582
|
-
|
|
601
|
+
React70.useEffect(installProgressStyles, []);
|
|
583
602
|
const isIndeterminate = indeterminate || value === null || value === void 0;
|
|
584
603
|
const clamped = !isIndeterminate && value !== null ? Math.max(0, Math.min(max, value)) : 0;
|
|
585
604
|
const percent = isIndeterminate ? 0 : clamped / Math.max(1, max) * 100;
|
|
@@ -621,7 +640,7 @@ function chipStyle(variant, tone, size, clickable, disabled) {
|
|
|
621
640
|
const base = {
|
|
622
641
|
display: "inline-flex",
|
|
623
642
|
alignItems: "center",
|
|
624
|
-
gap:
|
|
643
|
+
gap: "var(--iris-space-xs, 8px)",
|
|
625
644
|
borderRadius: 9999,
|
|
626
645
|
fontFamily: "var(--iris-font-family, inherit)",
|
|
627
646
|
fontWeight: 500,
|
|
@@ -711,8 +730,8 @@ function IrisChip({
|
|
|
711
730
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
712
731
|
color: "inherit",
|
|
713
732
|
padding: 0,
|
|
714
|
-
marginInlineStart:
|
|
715
|
-
fontSize:
|
|
733
|
+
marginInlineStart: "var(--iris-space-xxs, 4px)",
|
|
734
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
716
735
|
lineHeight: 1,
|
|
717
736
|
flexShrink: 0,
|
|
718
737
|
opacity: 0.7
|
|
@@ -727,8 +746,14 @@ function IrisChip({
|
|
|
727
746
|
return /* @__PURE__ */ jsx("span", { ...sharedProps, children: content });
|
|
728
747
|
}
|
|
729
748
|
var SIZE_MAP3 = {
|
|
730
|
-
sm: {
|
|
731
|
-
|
|
749
|
+
sm: {
|
|
750
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
751
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-padding-sm, 6px)"
|
|
752
|
+
},
|
|
753
|
+
md: {
|
|
754
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
755
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-padding-sm, 6px)"
|
|
756
|
+
}
|
|
732
757
|
};
|
|
733
758
|
function IrisKbd({
|
|
734
759
|
keys = [],
|
|
@@ -741,7 +766,7 @@ function IrisKbd({
|
|
|
741
766
|
const baseStyle = {
|
|
742
767
|
display: "inline-flex",
|
|
743
768
|
alignItems: "center",
|
|
744
|
-
gap:
|
|
769
|
+
gap: "var(--iris-space-xxs, 4px)",
|
|
745
770
|
fontFamily: "var(--iris-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)",
|
|
746
771
|
fontSize: SIZE_MAP3[size].fontSize,
|
|
747
772
|
verticalAlign: "middle",
|
|
@@ -818,16 +843,39 @@ function IrisEmptyState({
|
|
|
818
843
|
"div",
|
|
819
844
|
{
|
|
820
845
|
"data-iris-empty-state-icon": "",
|
|
821
|
-
style: {
|
|
846
|
+
style: {
|
|
847
|
+
display: "flex",
|
|
848
|
+
alignItems: "center",
|
|
849
|
+
justifyContent: "center",
|
|
850
|
+
width: 48,
|
|
851
|
+
height: 48,
|
|
852
|
+
borderRadius: "var(--iris-radius-lg, 12px)",
|
|
853
|
+
background: "var(--iris-surface)",
|
|
854
|
+
color: "var(--iris-muted)",
|
|
855
|
+
opacity: 0.9,
|
|
856
|
+
fontSize: "var(--iris-font-size-2xl, 20px)",
|
|
857
|
+
lineHeight: 1
|
|
858
|
+
},
|
|
822
859
|
children: icon
|
|
823
860
|
}
|
|
824
861
|
) : null,
|
|
825
|
-
title ? /* @__PURE__ */ jsx(
|
|
862
|
+
title ? /* @__PURE__ */ jsx(
|
|
863
|
+
"div",
|
|
864
|
+
{
|
|
865
|
+
"data-iris-empty-state-title": "",
|
|
866
|
+
style: { fontWeight: 600, fontSize: "var(--iris-font-size-lg, 16px)" },
|
|
867
|
+
children: title
|
|
868
|
+
}
|
|
869
|
+
) : null,
|
|
826
870
|
description || children ? /* @__PURE__ */ jsx(
|
|
827
871
|
"div",
|
|
828
872
|
{
|
|
829
873
|
"data-iris-empty-state-description": "",
|
|
830
|
-
style: {
|
|
874
|
+
style: {
|
|
875
|
+
color: "var(--iris-muted)",
|
|
876
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
877
|
+
maxWidth: 380
|
|
878
|
+
},
|
|
831
879
|
children: description ?? children
|
|
832
880
|
}
|
|
833
881
|
) : null,
|
|
@@ -837,11 +885,17 @@ function IrisEmptyState({
|
|
|
837
885
|
);
|
|
838
886
|
}
|
|
839
887
|
var SIZE_MAP4 = {
|
|
840
|
-
sm: {
|
|
841
|
-
|
|
842
|
-
|
|
888
|
+
sm: {
|
|
889
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-space-xs, 8px)",
|
|
890
|
+
fontSize: "var(--iris-font-size-xs, 12px)"
|
|
891
|
+
},
|
|
892
|
+
md: { padding: "8px 12px", fontSize: "var(--iris-font-size-md, 14px)" },
|
|
893
|
+
lg: {
|
|
894
|
+
padding: "var(--iris-space-sm, 12px) var(--iris-padding-md, 12px)",
|
|
895
|
+
fontSize: "var(--iris-font-size-lg, 16px)"
|
|
896
|
+
}
|
|
843
897
|
};
|
|
844
|
-
var IrisTextarea =
|
|
898
|
+
var IrisTextarea = React70.forwardRef(
|
|
845
899
|
function IrisTextarea2({
|
|
846
900
|
size = "md",
|
|
847
901
|
invalid = false,
|
|
@@ -857,10 +911,10 @@ var IrisTextarea = React67.forwardRef(
|
|
|
857
911
|
defaultValue,
|
|
858
912
|
...rest
|
|
859
913
|
}, ref) {
|
|
860
|
-
const [focused, setFocused] =
|
|
861
|
-
const innerRef =
|
|
862
|
-
|
|
863
|
-
const resize =
|
|
914
|
+
const [focused, setFocused] = React70.useState(false);
|
|
915
|
+
const innerRef = React70.useRef(null);
|
|
916
|
+
React70.useImperativeHandle(ref, () => innerRef.current, []);
|
|
917
|
+
const resize = React70.useCallback(() => {
|
|
864
918
|
const el = innerRef.current;
|
|
865
919
|
if (!el || !autosize) return;
|
|
866
920
|
const lineHeight = parseFloat(getComputedStyle(el).lineHeight || "0") || 20;
|
|
@@ -868,12 +922,12 @@ var IrisTextarea = React67.forwardRef(
|
|
|
868
922
|
const maxPx = maxRows > 0 ? lineHeight * maxRows : Infinity;
|
|
869
923
|
el.style.height = `${Math.min(maxPx, el.scrollHeight)}px`;
|
|
870
924
|
}, [autosize, maxRows]);
|
|
871
|
-
|
|
925
|
+
React70.useEffect(() => {
|
|
872
926
|
if (autosize) resize();
|
|
873
927
|
}, [autosize, resize, value]);
|
|
874
928
|
const sizeStyles = SIZE_MAP4[size];
|
|
875
929
|
const borderColor = invalid ? "var(--iris-danger)" : focused ? "var(--iris-primary)" : "var(--iris-border)";
|
|
876
|
-
const boxShadow = focused ? `0 0 0 3px ${invalid ? "
|
|
930
|
+
const boxShadow = focused ? `0 0 0 3px ${invalid ? "color-mix(in srgb, var(--iris-danger) 18%, transparent)" : "color-mix(in srgb, var(--iris-primary) 18%, transparent)"}` : "none";
|
|
877
931
|
const wrapperStyle = {
|
|
878
932
|
display: "flex",
|
|
879
933
|
background: "var(--iris-background)",
|
|
@@ -940,7 +994,7 @@ var DIM_MAP = {
|
|
|
940
994
|
md: { width: "36px", height: "20px", thumb: "16px" },
|
|
941
995
|
lg: { width: "44px", height: "24px", thumb: "20px" }
|
|
942
996
|
};
|
|
943
|
-
var IrisSwitch =
|
|
997
|
+
var IrisSwitch = React70.forwardRef(function IrisSwitch2({
|
|
944
998
|
checked,
|
|
945
999
|
defaultChecked,
|
|
946
1000
|
onChange,
|
|
@@ -951,7 +1005,7 @@ var IrisSwitch = React67.forwardRef(function IrisSwitch2({
|
|
|
951
1005
|
style,
|
|
952
1006
|
...rest
|
|
953
1007
|
}, ref) {
|
|
954
|
-
const [internalChecked, setInternalChecked] =
|
|
1008
|
+
const [internalChecked, setInternalChecked] = React70.useState(Boolean(defaultChecked));
|
|
955
1009
|
const isControlled = checked !== void 0;
|
|
956
1010
|
const value = isControlled ? Boolean(checked) : internalChecked;
|
|
957
1011
|
const handleChange = (e) => {
|
|
@@ -968,7 +1022,7 @@ var IrisSwitch = React67.forwardRef(function IrisSwitch2({
|
|
|
968
1022
|
height: dim.height,
|
|
969
1023
|
background: value ? "var(--iris-primary)" : "var(--iris-border)",
|
|
970
1024
|
borderRadius: 999,
|
|
971
|
-
transition: "background-color
|
|
1025
|
+
transition: "background-color var(--iris-transition-fast, 150ms) ease",
|
|
972
1026
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
973
1027
|
opacity: disabled ? 0.6 : 1,
|
|
974
1028
|
verticalAlign: "middle"
|
|
@@ -983,8 +1037,8 @@ var IrisSwitch = React67.forwardRef(function IrisSwitch2({
|
|
|
983
1037
|
height: dim.thumb,
|
|
984
1038
|
background: "var(--iris-background)",
|
|
985
1039
|
borderRadius: 999,
|
|
986
|
-
transition: "left
|
|
987
|
-
boxShadow: "
|
|
1040
|
+
transition: "left var(--iris-transition-fast, 150ms) ease",
|
|
1041
|
+
boxShadow: "var(--iris-shadow-sm)"
|
|
988
1042
|
};
|
|
989
1043
|
return /* @__PURE__ */ jsxs(
|
|
990
1044
|
"label",
|
|
@@ -1029,9 +1083,13 @@ var IrisSwitch = React67.forwardRef(function IrisSwitch2({
|
|
|
1029
1083
|
);
|
|
1030
1084
|
});
|
|
1031
1085
|
var SIZE_MAP5 = {
|
|
1032
|
-
sm: { padding: "4px 8px", fontSize: "12px", minHeight: "28px" },
|
|
1033
|
-
md: {
|
|
1034
|
-
|
|
1086
|
+
sm: { padding: "4px 8px", fontSize: "var(--iris-font-size-xs, 12px)", minHeight: "28px" },
|
|
1087
|
+
md: {
|
|
1088
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
1089
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
1090
|
+
minHeight: "34px"
|
|
1091
|
+
},
|
|
1092
|
+
lg: { padding: "8px 12px", fontSize: "var(--iris-font-size-lg, 16px)", minHeight: "40px" }
|
|
1035
1093
|
};
|
|
1036
1094
|
function decimalsOf(step) {
|
|
1037
1095
|
if (!Number.isFinite(step)) return 0;
|
|
@@ -1046,7 +1104,7 @@ function roundToStep(value, step) {
|
|
|
1046
1104
|
const places = decimalsOf(step);
|
|
1047
1105
|
return Number(value.toFixed(places));
|
|
1048
1106
|
}
|
|
1049
|
-
var IrisNumberInput =
|
|
1107
|
+
var IrisNumberInput = React70.forwardRef(
|
|
1050
1108
|
function IrisNumberInput2({
|
|
1051
1109
|
value,
|
|
1052
1110
|
defaultValue = null,
|
|
@@ -1065,19 +1123,19 @@ var IrisNumberInput = React67.forwardRef(
|
|
|
1065
1123
|
}, ref) {
|
|
1066
1124
|
const { t } = useI18n();
|
|
1067
1125
|
const isControlled = value !== void 0;
|
|
1068
|
-
const [internal, setInternal] =
|
|
1126
|
+
const [internal, setInternal] = React70.useState(defaultValue ?? null);
|
|
1069
1127
|
const current = isControlled ? value : internal;
|
|
1070
|
-
const [rawText, setRawText] =
|
|
1128
|
+
const [rawText, setRawText] = React70.useState(
|
|
1071
1129
|
current === null || current === void 0 ? "" : String(current)
|
|
1072
1130
|
);
|
|
1073
|
-
|
|
1131
|
+
React70.useEffect(() => {
|
|
1074
1132
|
if (current === null || current === void 0) {
|
|
1075
1133
|
setRawText("");
|
|
1076
1134
|
} else {
|
|
1077
1135
|
setRawText(String(current));
|
|
1078
1136
|
}
|
|
1079
1137
|
}, [current]);
|
|
1080
|
-
const [focused, setFocused] =
|
|
1138
|
+
const [focused, setFocused] = React70.useState(false);
|
|
1081
1139
|
const setValue = (next) => {
|
|
1082
1140
|
if (next === null) {
|
|
1083
1141
|
if (!isControlled) setInternal(null);
|
|
@@ -1137,7 +1195,7 @@ var IrisNumberInput = React67.forwardRef(
|
|
|
1137
1195
|
};
|
|
1138
1196
|
const sizeStyles = SIZE_MAP5[size];
|
|
1139
1197
|
const borderColor = invalid ? "var(--iris-danger)" : focused ? "var(--iris-primary)" : "var(--iris-border)";
|
|
1140
|
-
const boxShadow = focused ? `0 0 0 3px ${invalid ? "
|
|
1198
|
+
const boxShadow = focused ? `0 0 0 3px ${invalid ? "color-mix(in srgb, var(--iris-danger) 18%, transparent)" : "color-mix(in srgb, var(--iris-primary) 18%, transparent)"}` : "none";
|
|
1141
1199
|
const atMin = current !== null && current !== void 0 && current <= min;
|
|
1142
1200
|
const atMax = current !== null && current !== void 0 && current >= max;
|
|
1143
1201
|
const ctrlBtnStyle = {
|
|
@@ -1241,9 +1299,9 @@ var IrisNumberInput = React67.forwardRef(
|
|
|
1241
1299
|
}
|
|
1242
1300
|
);
|
|
1243
1301
|
var SIZE_MAP6 = {
|
|
1244
|
-
sm: { box: 32, height: 36, fontSize:
|
|
1245
|
-
md: { box: 38, height: 44, fontSize:
|
|
1246
|
-
lg: { box: 44, height: 52, fontSize:
|
|
1302
|
+
sm: { box: 32, height: 36, fontSize: "var(--iris-font-size-md, 14px)" },
|
|
1303
|
+
md: { box: 38, height: 44, fontSize: "var(--iris-font-size-xl, 18px)" },
|
|
1304
|
+
lg: { box: 44, height: 52, fontSize: "var(--iris-font-size-2xl, 20px)" }
|
|
1247
1305
|
};
|
|
1248
1306
|
var PATTERNS = {
|
|
1249
1307
|
numeric: /[0-9]/,
|
|
@@ -1276,12 +1334,12 @@ function IrisOtpInput({
|
|
|
1276
1334
|
}) {
|
|
1277
1335
|
const { t } = useI18n();
|
|
1278
1336
|
const isControlled = valueProp !== void 0;
|
|
1279
|
-
const [internal, setInternal] =
|
|
1337
|
+
const [internal, setInternal] = React70.useState(
|
|
1280
1338
|
() => sanitize(defaultValue, type).slice(0, length)
|
|
1281
1339
|
);
|
|
1282
1340
|
const value = sanitize(isControlled ? valueProp : internal, type).slice(0, length);
|
|
1283
|
-
const cellsRef =
|
|
1284
|
-
const [focusedIndex, setFocusedIndex] =
|
|
1341
|
+
const cellsRef = React70.useRef([]);
|
|
1342
|
+
const [focusedIndex, setFocusedIndex] = React70.useState(-1);
|
|
1285
1343
|
const focusCell = (i) => {
|
|
1286
1344
|
const el = cellsRef.current[Math.max(0, Math.min(length - 1, i))];
|
|
1287
1345
|
if (el) {
|
|
@@ -1345,7 +1403,7 @@ function IrisOtpInput({
|
|
|
1345
1403
|
if (disabled) return;
|
|
1346
1404
|
writeFrom(i, e.clipboardData.getData("text"));
|
|
1347
1405
|
};
|
|
1348
|
-
|
|
1406
|
+
React70.useEffect(() => {
|
|
1349
1407
|
if (autoFocus) cellsRef.current[0]?.focus();
|
|
1350
1408
|
}, [autoFocus]);
|
|
1351
1409
|
const sz = SIZE_MAP6[size];
|
|
@@ -1404,7 +1462,7 @@ function IrisOtpInput({
|
|
|
1404
1462
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
1405
1463
|
outline: "none",
|
|
1406
1464
|
opacity: disabled ? 0.6 : 1,
|
|
1407
|
-
boxShadow: focused ? `0 0 0 3px ${invalid ? "
|
|
1465
|
+
boxShadow: focused ? `0 0 0 3px ${invalid ? "color-mix(in srgb, var(--iris-danger) 18%, transparent)" : "color-mix(in srgb, var(--iris-primary) 18%, transparent)"}` : "none",
|
|
1408
1466
|
transition: "border-color 120ms ease, box-shadow 120ms ease"
|
|
1409
1467
|
}
|
|
1410
1468
|
},
|
|
@@ -1442,9 +1500,9 @@ function IrisRating({
|
|
|
1442
1500
|
const { t } = useI18n();
|
|
1443
1501
|
const step = allowHalf ? 0.5 : 1;
|
|
1444
1502
|
const isControlled = valueProp !== void 0;
|
|
1445
|
-
const [internal, setInternal] =
|
|
1503
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
1446
1504
|
const value = clamp2(isControlled ? valueProp : internal, 0, max);
|
|
1447
|
-
const [hover, setHover] =
|
|
1505
|
+
const [hover, setHover] = React70.useState(null);
|
|
1448
1506
|
const interactive = !readonly && !disabled;
|
|
1449
1507
|
const display = hover ?? value;
|
|
1450
1508
|
const setValue = (next) => {
|
|
@@ -1567,9 +1625,13 @@ function IrisRating({
|
|
|
1567
1625
|
);
|
|
1568
1626
|
}
|
|
1569
1627
|
var SIZE_MAP8 = {
|
|
1570
|
-
sm: { padding: "4px 8px", fontSize: "12px", minHeight: "28px" },
|
|
1571
|
-
md: {
|
|
1572
|
-
|
|
1628
|
+
sm: { padding: "4px 8px", fontSize: "var(--iris-font-size-xs, 12px)", minHeight: "28px" },
|
|
1629
|
+
md: {
|
|
1630
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
1631
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
1632
|
+
minHeight: "34px"
|
|
1633
|
+
},
|
|
1634
|
+
lg: { padding: "8px 12px", fontSize: "var(--iris-font-size-lg, 16px)", minHeight: "40px" }
|
|
1573
1635
|
};
|
|
1574
1636
|
function IrisCombobox({
|
|
1575
1637
|
value: valueProp,
|
|
@@ -1588,17 +1650,17 @@ function IrisCombobox({
|
|
|
1588
1650
|
...rest
|
|
1589
1651
|
}) {
|
|
1590
1652
|
const { t } = useI18n();
|
|
1591
|
-
const reactId =
|
|
1653
|
+
const reactId = React70.useId();
|
|
1592
1654
|
const listboxId = `${reactId}-listbox`;
|
|
1593
1655
|
const optionId = (i) => `${reactId}-opt-${i}`;
|
|
1594
1656
|
const isControlled = valueProp !== void 0;
|
|
1595
|
-
const [internal, setInternal] =
|
|
1657
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
1596
1658
|
const currentValue = isControlled ? valueProp : internal;
|
|
1597
|
-
const [query, setQuery] =
|
|
1598
|
-
const [filtering, setFiltering] =
|
|
1599
|
-
const [open, setOpen] =
|
|
1600
|
-
const [activeIndex, setActiveIndex] =
|
|
1601
|
-
const [focused, setFocused] =
|
|
1659
|
+
const [query, setQuery] = React70.useState("");
|
|
1660
|
+
const [filtering, setFiltering] = React70.useState(false);
|
|
1661
|
+
const [open, setOpen] = React70.useState(false);
|
|
1662
|
+
const [activeIndex, setActiveIndex] = React70.useState(-1);
|
|
1663
|
+
const [focused, setFocused] = React70.useState(false);
|
|
1602
1664
|
const selected = options.find((o) => o.value === currentValue);
|
|
1603
1665
|
const display = filtering ? query : selected?.label ?? "";
|
|
1604
1666
|
const needle = query.trim().toLowerCase();
|
|
@@ -1714,7 +1776,7 @@ function IrisCombobox({
|
|
|
1714
1776
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
1715
1777
|
outline: "none",
|
|
1716
1778
|
opacity: disabled ? 0.6 : 1,
|
|
1717
|
-
boxShadow: focused ? `0 0 0 3px ${invalid ? "
|
|
1779
|
+
boxShadow: focused ? `0 0 0 3px ${invalid ? "color-mix(in srgb, var(--iris-danger) 18%, transparent)" : "color-mix(in srgb, var(--iris-primary) 18%, transparent)"}` : "none",
|
|
1718
1780
|
transition: "border-color 120ms ease, box-shadow 120ms ease"
|
|
1719
1781
|
}
|
|
1720
1782
|
}
|
|
@@ -1740,14 +1802,18 @@ function IrisCombobox({
|
|
|
1740
1802
|
background: "var(--iris-background)",
|
|
1741
1803
|
border: "1px solid var(--iris-border)",
|
|
1742
1804
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
1743
|
-
boxShadow: "
|
|
1805
|
+
boxShadow: "var(--iris-shadow-lg)"
|
|
1744
1806
|
},
|
|
1745
1807
|
children: filtered.length === 0 ? /* @__PURE__ */ jsx(
|
|
1746
1808
|
"li",
|
|
1747
1809
|
{
|
|
1748
1810
|
"data-iris-combobox-empty": "",
|
|
1749
1811
|
"aria-disabled": "true",
|
|
1750
|
-
style: {
|
|
1812
|
+
style: {
|
|
1813
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
1814
|
+
color: "var(--iris-muted)",
|
|
1815
|
+
fontSize: sz.fontSize
|
|
1816
|
+
},
|
|
1751
1817
|
children: resolvedEmpty
|
|
1752
1818
|
}
|
|
1753
1819
|
) : filtered.map((opt, i) => {
|
|
@@ -1766,7 +1832,7 @@ function IrisCombobox({
|
|
|
1766
1832
|
onMouseEnter: () => setActiveIndex(i),
|
|
1767
1833
|
onClick: () => selectOption(opt),
|
|
1768
1834
|
style: {
|
|
1769
|
-
padding: "6px
|
|
1835
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
1770
1836
|
fontSize: sz.fontSize,
|
|
1771
1837
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
1772
1838
|
cursor: opt.disabled ? "not-allowed" : "pointer",
|
|
@@ -1787,7 +1853,7 @@ function IrisCombobox({
|
|
|
1787
1853
|
}
|
|
1788
1854
|
var VARIANT_COLOR = {
|
|
1789
1855
|
default: "var(--iris-primary)",
|
|
1790
|
-
success: "var(--iris-success, #
|
|
1856
|
+
success: "var(--iris-success, #10b981)",
|
|
1791
1857
|
warning: "var(--iris-warning, #f59e0b)",
|
|
1792
1858
|
danger: "var(--iris-danger)",
|
|
1793
1859
|
info: "var(--iris-info, #0ea5e9)"
|
|
@@ -1869,7 +1935,10 @@ function IrisTimeline({
|
|
|
1869
1935
|
"div",
|
|
1870
1936
|
{
|
|
1871
1937
|
"data-iris-timeline-time": "",
|
|
1872
|
-
style: {
|
|
1938
|
+
style: {
|
|
1939
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
1940
|
+
color: "var(--iris-muted)"
|
|
1941
|
+
},
|
|
1873
1942
|
children: item.time
|
|
1874
1943
|
}
|
|
1875
1944
|
) : null,
|
|
@@ -1885,7 +1954,10 @@ function IrisTimeline({
|
|
|
1885
1954
|
"div",
|
|
1886
1955
|
{
|
|
1887
1956
|
"data-iris-timeline-desc": "",
|
|
1888
|
-
style: {
|
|
1957
|
+
style: {
|
|
1958
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
1959
|
+
color: "var(--iris-foreground)"
|
|
1960
|
+
},
|
|
1889
1961
|
children: item.description
|
|
1890
1962
|
}
|
|
1891
1963
|
) : null
|
|
@@ -1915,7 +1987,7 @@ var ARROW_BTN = {
|
|
|
1915
1987
|
background: "var(--iris-background)",
|
|
1916
1988
|
color: "var(--iris-foreground)",
|
|
1917
1989
|
cursor: "pointer",
|
|
1918
|
-
fontSize:
|
|
1990
|
+
fontSize: "var(--iris-font-size-xl, 18px)",
|
|
1919
1991
|
lineHeight: 1
|
|
1920
1992
|
};
|
|
1921
1993
|
function prefersReducedMotion() {
|
|
@@ -1938,10 +2010,10 @@ function IrisCarousel({
|
|
|
1938
2010
|
...rest
|
|
1939
2011
|
}) {
|
|
1940
2012
|
const { t } = useI18n();
|
|
1941
|
-
const slides =
|
|
2013
|
+
const slides = React70.Children.toArray(children);
|
|
1942
2014
|
const count = slides.length;
|
|
1943
2015
|
const isControlled = indexProp !== void 0;
|
|
1944
|
-
const [internal, setInternal] =
|
|
2016
|
+
const [internal, setInternal] = React70.useState(defaultIndex);
|
|
1945
2017
|
const current = Math.min(
|
|
1946
2018
|
Math.max(0, isControlled ? indexProp : internal),
|
|
1947
2019
|
Math.max(0, count - 1)
|
|
@@ -1953,12 +2025,12 @@ function IrisCarousel({
|
|
|
1953
2025
|
if (!isControlled) setInternal(next);
|
|
1954
2026
|
onIndexChange?.(next);
|
|
1955
2027
|
};
|
|
1956
|
-
const onIndexChangeRef =
|
|
2028
|
+
const onIndexChangeRef = React70.useRef(onIndexChange);
|
|
1957
2029
|
onIndexChangeRef.current = onIndexChange;
|
|
1958
|
-
const [hovered, setHovered] =
|
|
1959
|
-
const [focusedWithin, setFocusedWithin] =
|
|
2030
|
+
const [hovered, setHovered] = React70.useState(false);
|
|
2031
|
+
const [focusedWithin, setFocusedWithin] = React70.useState(false);
|
|
1960
2032
|
const paused = pauseOnHover && hovered || focusedWithin;
|
|
1961
|
-
|
|
2033
|
+
React70.useEffect(() => {
|
|
1962
2034
|
if (!autoplay || paused || count <= 1 || prefersReducedMotion()) return;
|
|
1963
2035
|
const id = setTimeout(() => {
|
|
1964
2036
|
const target = (current + 1) % count;
|
|
@@ -2062,7 +2134,7 @@ function IrisCarousel({
|
|
|
2062
2134
|
style: {
|
|
2063
2135
|
display: "flex",
|
|
2064
2136
|
justifyContent: "center",
|
|
2065
|
-
gap:
|
|
2137
|
+
gap: "var(--iris-space-xs, 8px)",
|
|
2066
2138
|
marginBlockStart: 8
|
|
2067
2139
|
},
|
|
2068
2140
|
children: slides.map((_, i) => /* @__PURE__ */ jsx(
|
|
@@ -2108,13 +2180,22 @@ function IrisCarousel({
|
|
|
2108
2180
|
}
|
|
2109
2181
|
);
|
|
2110
2182
|
}
|
|
2111
|
-
var VALUE_FONT = {
|
|
2183
|
+
var VALUE_FONT = {
|
|
2184
|
+
sm: "var(--iris-font-size-2xl, 20px)",
|
|
2185
|
+
md: "var(--iris-font-size-3xl, 24px)",
|
|
2186
|
+
lg: "var(--iris-font-size-4xl, 30px)"
|
|
2187
|
+
};
|
|
2112
2188
|
var TREND_COLOR = {
|
|
2113
|
-
up: "var(--iris-success, #
|
|
2189
|
+
up: "var(--iris-success, #10b981)",
|
|
2114
2190
|
down: "var(--iris-danger)",
|
|
2115
2191
|
neutral: "var(--iris-muted)"
|
|
2116
2192
|
};
|
|
2117
2193
|
var TREND_ARROW = { up: "\u25B2", down: "\u25BC", neutral: "" };
|
|
2194
|
+
var TREND_TONE = {
|
|
2195
|
+
success: "var(--iris-success, #10b981)",
|
|
2196
|
+
danger: "var(--iris-danger)",
|
|
2197
|
+
neutral: "var(--iris-muted)"
|
|
2198
|
+
};
|
|
2118
2199
|
function IrisStatistic({
|
|
2119
2200
|
label,
|
|
2120
2201
|
value,
|
|
@@ -2122,6 +2203,7 @@ function IrisStatistic({
|
|
|
2122
2203
|
suffix,
|
|
2123
2204
|
description,
|
|
2124
2205
|
trend,
|
|
2206
|
+
trendTone,
|
|
2125
2207
|
trendValue,
|
|
2126
2208
|
size = "md",
|
|
2127
2209
|
style,
|
|
@@ -2138,7 +2220,14 @@ function IrisStatistic({
|
|
|
2138
2220
|
...rest,
|
|
2139
2221
|
style: { display: "flex", flexDirection: "column", gap: 4, ...style },
|
|
2140
2222
|
children: [
|
|
2141
|
-
label != null ? /* @__PURE__ */ jsx(
|
|
2223
|
+
label != null ? /* @__PURE__ */ jsx(
|
|
2224
|
+
"div",
|
|
2225
|
+
{
|
|
2226
|
+
"data-iris-statistic-label": "",
|
|
2227
|
+
style: { fontSize: "var(--iris-font-size-sm, 13px)", color: "var(--iris-muted)" },
|
|
2228
|
+
children: label
|
|
2229
|
+
}
|
|
2230
|
+
) : null,
|
|
2142
2231
|
/* @__PURE__ */ jsxs(
|
|
2143
2232
|
"div",
|
|
2144
2233
|
{
|
|
@@ -2167,8 +2256,8 @@ function IrisStatistic({
|
|
|
2167
2256
|
display: "inline-flex",
|
|
2168
2257
|
alignItems: "center",
|
|
2169
2258
|
gap: 4,
|
|
2170
|
-
fontSize:
|
|
2171
|
-
color: trend ? TREND_COLOR[trend] : "var(--iris-muted)"
|
|
2259
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
2260
|
+
color: trend ? trendTone ? TREND_TONE[trendTone] : TREND_COLOR[trend] : "var(--iris-muted)"
|
|
2172
2261
|
},
|
|
2173
2262
|
children: [
|
|
2174
2263
|
trend && TREND_ARROW[trend] ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: TREND_ARROW[trend] }) : null,
|
|
@@ -2176,7 +2265,14 @@ function IrisStatistic({
|
|
|
2176
2265
|
]
|
|
2177
2266
|
}
|
|
2178
2267
|
) : null,
|
|
2179
|
-
description != null ? /* @__PURE__ */ jsx(
|
|
2268
|
+
description != null ? /* @__PURE__ */ jsx(
|
|
2269
|
+
"div",
|
|
2270
|
+
{
|
|
2271
|
+
"data-iris-statistic-desc": "",
|
|
2272
|
+
style: { fontSize: "var(--iris-font-size-xs, 12px)", color: "var(--iris-muted)" },
|
|
2273
|
+
children: description
|
|
2274
|
+
}
|
|
2275
|
+
) : null
|
|
2180
2276
|
]
|
|
2181
2277
|
}
|
|
2182
2278
|
);
|
|
@@ -2194,7 +2290,7 @@ function IrisDescriptions({
|
|
|
2194
2290
|
const pad3 = bordered ? "8px 12px" : void 0;
|
|
2195
2291
|
const labelStyle = {
|
|
2196
2292
|
margin: 0,
|
|
2197
|
-
fontSize:
|
|
2293
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
2198
2294
|
fontWeight: 500,
|
|
2199
2295
|
color: "var(--iris-muted)",
|
|
2200
2296
|
padding: pad3,
|
|
@@ -2202,7 +2298,7 @@ function IrisDescriptions({
|
|
|
2202
2298
|
};
|
|
2203
2299
|
const valueStyle = {
|
|
2204
2300
|
margin: 0,
|
|
2205
|
-
fontSize:
|
|
2301
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
2206
2302
|
color: "var(--iris-foreground)",
|
|
2207
2303
|
padding: pad3
|
|
2208
2304
|
};
|
|
@@ -2228,7 +2324,7 @@ function IrisDescriptions({
|
|
|
2228
2324
|
children: items.map((item, i) => {
|
|
2229
2325
|
const rowBorder = bordered && i >= columns ? "1px solid var(--iris-border)" : void 0;
|
|
2230
2326
|
if (horizontal) {
|
|
2231
|
-
return /* @__PURE__ */ jsxs(
|
|
2327
|
+
return /* @__PURE__ */ jsxs(React70.Fragment, { children: [
|
|
2232
2328
|
/* @__PURE__ */ jsx(
|
|
2233
2329
|
"dt",
|
|
2234
2330
|
{
|
|
@@ -2285,14 +2381,14 @@ function IrisTransfer({
|
|
|
2285
2381
|
const safeOptions = options ?? [];
|
|
2286
2382
|
const { t } = useI18n();
|
|
2287
2383
|
const isControlled = valueProp !== void 0;
|
|
2288
|
-
const [internal, setInternal] =
|
|
2384
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
2289
2385
|
const value = isControlled ? valueProp : internal;
|
|
2290
2386
|
const valueSet = new Set(value);
|
|
2291
|
-
const sourceModelRef =
|
|
2387
|
+
const sourceModelRef = React70.useRef(null);
|
|
2292
2388
|
if (sourceModelRef.current === null) {
|
|
2293
2389
|
sourceModelRef.current = createSelectionModel({ mode: "multiple" });
|
|
2294
2390
|
}
|
|
2295
|
-
const targetModelRef =
|
|
2391
|
+
const targetModelRef = React70.useRef(null);
|
|
2296
2392
|
if (targetModelRef.current === null) {
|
|
2297
2393
|
targetModelRef.current = createSelectionModel({ mode: "multiple" });
|
|
2298
2394
|
}
|
|
@@ -2300,8 +2396,8 @@ function IrisTransfer({
|
|
|
2300
2396
|
const targetModel = targetModelRef.current;
|
|
2301
2397
|
const sourceChecked = useStore(sourceModel.store);
|
|
2302
2398
|
const targetChecked = useStore(targetModel.store);
|
|
2303
|
-
const [sourceQuery, setSourceQuery] =
|
|
2304
|
-
const [targetQuery, setTargetQuery] =
|
|
2399
|
+
const [sourceQuery, setSourceQuery] = React70.useState("");
|
|
2400
|
+
const [targetQuery, setTargetQuery] = React70.useState("");
|
|
2305
2401
|
const setValue = (next) => {
|
|
2306
2402
|
if (!isControlled) setInternal(next);
|
|
2307
2403
|
onValueChange?.(next);
|
|
@@ -2341,7 +2437,7 @@ function IrisTransfer({
|
|
|
2341
2437
|
background: "var(--iris-background)",
|
|
2342
2438
|
color: "var(--iris-foreground)",
|
|
2343
2439
|
cursor: "pointer",
|
|
2344
|
-
fontSize:
|
|
2440
|
+
fontSize: "var(--iris-font-size-lg, 16px)",
|
|
2345
2441
|
lineHeight: 1
|
|
2346
2442
|
};
|
|
2347
2443
|
const renderPane = (side) => {
|
|
@@ -2369,33 +2465,51 @@ function IrisTransfer({
|
|
|
2369
2465
|
alignItems: "center",
|
|
2370
2466
|
justifyContent: "space-between",
|
|
2371
2467
|
gap: 8,
|
|
2372
|
-
padding: "6px
|
|
2468
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
2373
2469
|
borderBlockEnd: "1px solid var(--iris-border)",
|
|
2374
|
-
fontSize:
|
|
2470
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
2375
2471
|
fontWeight: 500
|
|
2376
2472
|
},
|
|
2377
2473
|
children: [
|
|
2378
|
-
/* @__PURE__ */ jsxs(
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
{
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2474
|
+
/* @__PURE__ */ jsxs(
|
|
2475
|
+
"label",
|
|
2476
|
+
{
|
|
2477
|
+
style: {
|
|
2478
|
+
display: "inline-flex",
|
|
2479
|
+
alignItems: "center",
|
|
2480
|
+
gap: "var(--iris-space-xs, 8px)",
|
|
2481
|
+
minWidth: 0
|
|
2482
|
+
},
|
|
2483
|
+
children: [
|
|
2484
|
+
/* @__PURE__ */ jsx(
|
|
2485
|
+
"input",
|
|
2486
|
+
{
|
|
2487
|
+
type: "checkbox",
|
|
2488
|
+
"data-iris-transfer-select-all": "",
|
|
2489
|
+
checked: allChecked,
|
|
2490
|
+
disabled: disabled || selectable.length === 0,
|
|
2491
|
+
ref: (el) => {
|
|
2492
|
+
if (el) el.indeterminate = someChecked && !allChecked;
|
|
2493
|
+
},
|
|
2494
|
+
onChange: toggleAll
|
|
2495
|
+
}
|
|
2496
|
+
),
|
|
2497
|
+
/* @__PURE__ */ jsx("span", { children: titles?.[side === "source" ? 0 : 1] })
|
|
2498
|
+
]
|
|
2499
|
+
}
|
|
2500
|
+
),
|
|
2501
|
+
/* @__PURE__ */ jsxs(
|
|
2502
|
+
"span",
|
|
2503
|
+
{
|
|
2504
|
+
"data-iris-transfer-count": "",
|
|
2505
|
+
style: { color: "var(--iris-muted)", fontSize: "var(--iris-font-size-xs, 12px)" },
|
|
2506
|
+
children: [
|
|
2507
|
+
checkedCount,
|
|
2508
|
+
"/",
|
|
2509
|
+
items.length
|
|
2510
|
+
]
|
|
2511
|
+
}
|
|
2512
|
+
)
|
|
2399
2513
|
]
|
|
2400
2514
|
}
|
|
2401
2515
|
),
|
|
@@ -2412,7 +2526,7 @@ function IrisTransfer({
|
|
|
2412
2526
|
style: {
|
|
2413
2527
|
margin: 8,
|
|
2414
2528
|
padding: "4px 8px",
|
|
2415
|
-
fontSize:
|
|
2529
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
2416
2530
|
border: "1px solid var(--iris-border)",
|
|
2417
2531
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
2418
2532
|
background: "var(--iris-background)",
|
|
@@ -2438,9 +2552,9 @@ function IrisTransfer({
|
|
|
2438
2552
|
{
|
|
2439
2553
|
"data-iris-transfer-empty": "",
|
|
2440
2554
|
style: {
|
|
2441
|
-
padding: "8px
|
|
2555
|
+
padding: "var(--iris-space-xs, 8px) var(--iris-space-sm, 12px)",
|
|
2442
2556
|
color: "var(--iris-muted)",
|
|
2443
|
-
fontSize:
|
|
2557
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
2444
2558
|
textAlign: "center"
|
|
2445
2559
|
},
|
|
2446
2560
|
children: t("transfer.empty")
|
|
@@ -2456,7 +2570,7 @@ function IrisTransfer({
|
|
|
2456
2570
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
2457
2571
|
cursor: o.disabled ? "not-allowed" : "pointer",
|
|
2458
2572
|
opacity: o.disabled ? 0.5 : 1,
|
|
2459
|
-
fontSize:
|
|
2573
|
+
fontSize: "var(--iris-font-size-md, 14px)"
|
|
2460
2574
|
},
|
|
2461
2575
|
children: [
|
|
2462
2576
|
/* @__PURE__ */ jsx(
|
|
@@ -2602,10 +2716,10 @@ function IrisBackTop({
|
|
|
2602
2716
|
...rest
|
|
2603
2717
|
}) {
|
|
2604
2718
|
const { t } = useI18n();
|
|
2605
|
-
const [visible, setVisible] =
|
|
2606
|
-
const targetRef =
|
|
2719
|
+
const [visible, setVisible] = React70.useState(false);
|
|
2720
|
+
const targetRef = React70.useRef(target);
|
|
2607
2721
|
targetRef.current = target;
|
|
2608
|
-
|
|
2722
|
+
React70.useEffect(() => {
|
|
2609
2723
|
const el = resolve(targetRef.current);
|
|
2610
2724
|
const onScroll = () => {
|
|
2611
2725
|
const top = el === window ? window.scrollY ?? 0 : el.scrollTop;
|
|
@@ -2647,11 +2761,11 @@ function IrisBackTop({
|
|
|
2647
2761
|
background: "var(--iris-surface, var(--iris-background))",
|
|
2648
2762
|
color: "var(--iris-foreground)",
|
|
2649
2763
|
cursor: "pointer",
|
|
2650
|
-
boxShadow: "
|
|
2764
|
+
boxShadow: "var(--iris-shadow-md)",
|
|
2651
2765
|
display: "inline-flex",
|
|
2652
2766
|
alignItems: "center",
|
|
2653
2767
|
justifyContent: "center",
|
|
2654
|
-
fontSize:
|
|
2768
|
+
fontSize: "var(--iris-font-size-xl, 18px)",
|
|
2655
2769
|
...style
|
|
2656
2770
|
},
|
|
2657
2771
|
children: children ?? "\u2191"
|
|
@@ -2669,17 +2783,17 @@ function IrisAffix({
|
|
|
2669
2783
|
className,
|
|
2670
2784
|
...rest
|
|
2671
2785
|
}) {
|
|
2672
|
-
const placeholderRef =
|
|
2673
|
-
const contentRef =
|
|
2674
|
-
const [affixed, setAffixed] =
|
|
2675
|
-
const [fixedStyle, setFixedStyle] =
|
|
2676
|
-
const [reserve, setReserve] =
|
|
2677
|
-
const onChangeRef =
|
|
2786
|
+
const placeholderRef = React70.useRef(null);
|
|
2787
|
+
const contentRef = React70.useRef(null);
|
|
2788
|
+
const [affixed, setAffixed] = React70.useState(false);
|
|
2789
|
+
const [fixedStyle, setFixedStyle] = React70.useState(void 0);
|
|
2790
|
+
const [reserve, setReserve] = React70.useState(void 0);
|
|
2791
|
+
const onChangeRef = React70.useRef(onChange);
|
|
2678
2792
|
onChangeRef.current = onChange;
|
|
2679
|
-
const targetRef =
|
|
2793
|
+
const targetRef = React70.useRef(target);
|
|
2680
2794
|
targetRef.current = target;
|
|
2681
|
-
const affixedRef =
|
|
2682
|
-
|
|
2795
|
+
const affixedRef = React70.useRef(false);
|
|
2796
|
+
React70.useEffect(() => {
|
|
2683
2797
|
const el = resolve2(targetRef.current);
|
|
2684
2798
|
const useTop = offsetTop != null || offsetBottom == null;
|
|
2685
2799
|
const ot = offsetTop ?? 0;
|
|
@@ -2728,7 +2842,7 @@ function IrisAffix({
|
|
|
2728
2842
|
);
|
|
2729
2843
|
}
|
|
2730
2844
|
var STATUS = {
|
|
2731
|
-
success: { color: "var(--iris-success, #
|
|
2845
|
+
success: { color: "var(--iris-success, #10b981)", glyph: "\u2713" },
|
|
2732
2846
|
error: { color: "var(--iris-danger)", glyph: "\u2715" },
|
|
2733
2847
|
info: { color: "var(--iris-info, #0ea5e9)", glyph: "i" },
|
|
2734
2848
|
warning: { color: "var(--iris-warning, #f59e0b)", glyph: "!" }
|
|
@@ -2774,9 +2888,9 @@ function IrisResult({
|
|
|
2774
2888
|
display: "inline-flex",
|
|
2775
2889
|
alignItems: "center",
|
|
2776
2890
|
justifyContent: "center",
|
|
2777
|
-
fontSize:
|
|
2891
|
+
fontSize: "var(--iris-font-size-4xl, 30px)",
|
|
2778
2892
|
fontWeight: 700,
|
|
2779
|
-
color: "#fff",
|
|
2893
|
+
color: "var(--iris-primary-foreground, #fff)",
|
|
2780
2894
|
background: s.color,
|
|
2781
2895
|
marginBlockEnd: 8
|
|
2782
2896
|
},
|
|
@@ -2787,7 +2901,11 @@ function IrisResult({
|
|
|
2787
2901
|
"div",
|
|
2788
2902
|
{
|
|
2789
2903
|
"data-iris-result-title": "",
|
|
2790
|
-
style: {
|
|
2904
|
+
style: {
|
|
2905
|
+
fontSize: "var(--iris-font-size-2xl, 20px)",
|
|
2906
|
+
fontWeight: 600,
|
|
2907
|
+
color: "var(--iris-foreground)"
|
|
2908
|
+
},
|
|
2791
2909
|
children: title
|
|
2792
2910
|
}
|
|
2793
2911
|
) : null,
|
|
@@ -2795,7 +2913,11 @@ function IrisResult({
|
|
|
2795
2913
|
"div",
|
|
2796
2914
|
{
|
|
2797
2915
|
"data-iris-result-subtitle": "",
|
|
2798
|
-
style: {
|
|
2916
|
+
style: {
|
|
2917
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
2918
|
+
color: "var(--iris-muted)",
|
|
2919
|
+
maxWidth: 480
|
|
2920
|
+
},
|
|
2799
2921
|
children: subtitle
|
|
2800
2922
|
}
|
|
2801
2923
|
) : null,
|
|
@@ -2819,9 +2941,13 @@ function IrisResult({
|
|
|
2819
2941
|
);
|
|
2820
2942
|
}
|
|
2821
2943
|
var SIZE_MAP9 = {
|
|
2822
|
-
sm: { padding: "4px 8px", fontSize: "12px", minHeight: "28px" },
|
|
2823
|
-
md: {
|
|
2824
|
-
|
|
2944
|
+
sm: { padding: "4px 8px", fontSize: "var(--iris-font-size-xs, 12px)", minHeight: "28px" },
|
|
2945
|
+
md: {
|
|
2946
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
2947
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
2948
|
+
minHeight: "34px"
|
|
2949
|
+
},
|
|
2950
|
+
lg: { padding: "8px 12px", fontSize: "var(--iris-font-size-lg, 16px)", minHeight: "40px" }
|
|
2825
2951
|
};
|
|
2826
2952
|
function findNode(nodes, value) {
|
|
2827
2953
|
for (const n of nodes) {
|
|
@@ -2850,13 +2976,13 @@ function IrisTreeSelect({
|
|
|
2850
2976
|
...rest
|
|
2851
2977
|
}) {
|
|
2852
2978
|
const { t } = useI18n();
|
|
2853
|
-
const rootRef =
|
|
2979
|
+
const rootRef = React70.useRef(null);
|
|
2854
2980
|
const isControlled = value !== void 0;
|
|
2855
|
-
const [internal, setInternal] =
|
|
2981
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
2856
2982
|
const currentValue = isControlled ? value : internal;
|
|
2857
|
-
const [open, setOpen] =
|
|
2858
|
-
const [expanded, setExpanded] =
|
|
2859
|
-
const [focused, setFocused] =
|
|
2983
|
+
const [open, setOpen] = React70.useState(false);
|
|
2984
|
+
const [expanded, setExpanded] = React70.useState(() => new Set(defaultExpanded ?? []));
|
|
2985
|
+
const [focused, setFocused] = React70.useState(false);
|
|
2860
2986
|
const selected = currentValue ? findNode(options, currentValue) : void 0;
|
|
2861
2987
|
const selectNode = (node) => {
|
|
2862
2988
|
if (node.disabled) return;
|
|
@@ -2870,7 +2996,7 @@ function IrisTreeSelect({
|
|
|
2870
2996
|
else next.add(v);
|
|
2871
2997
|
return next;
|
|
2872
2998
|
});
|
|
2873
|
-
|
|
2999
|
+
React70.useEffect(() => {
|
|
2874
3000
|
if (!open) return;
|
|
2875
3001
|
const onDown = (e) => {
|
|
2876
3002
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
@@ -2902,7 +3028,7 @@ function IrisTreeSelect({
|
|
|
2902
3028
|
alignItems: "center",
|
|
2903
3029
|
gap: 4,
|
|
2904
3030
|
paddingInlineStart: depth * 16 + 6,
|
|
2905
|
-
paddingInlineEnd:
|
|
3031
|
+
paddingInlineEnd: "var(--iris-space-xs, 8px)",
|
|
2906
3032
|
paddingBlock: 4,
|
|
2907
3033
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
2908
3034
|
background: isSelected ? "var(--iris-surface-hover, rgba(99,102,241,0.1))" : "transparent"
|
|
@@ -2922,7 +3048,7 @@ function IrisTreeSelect({
|
|
|
2922
3048
|
background: "transparent",
|
|
2923
3049
|
cursor: "pointer",
|
|
2924
3050
|
color: "var(--iris-muted)",
|
|
2925
|
-
fontSize:
|
|
3051
|
+
fontSize: "var(--iris-font-size-xs, 12px)"
|
|
2926
3052
|
},
|
|
2927
3053
|
children: isExpanded ? "\u25BE" : "\u25B8"
|
|
2928
3054
|
}
|
|
@@ -3006,7 +3132,14 @@ function IrisTreeSelect({
|
|
|
3006
3132
|
},
|
|
3007
3133
|
children: [
|
|
3008
3134
|
/* @__PURE__ */ jsx("span", { "data-iris-tree-select-value": "", children: selected ? selected.label : placeholder ?? t("select.placeholder") }),
|
|
3009
|
-
/* @__PURE__ */ jsx(
|
|
3135
|
+
/* @__PURE__ */ jsx(
|
|
3136
|
+
"span",
|
|
3137
|
+
{
|
|
3138
|
+
"aria-hidden": "true",
|
|
3139
|
+
style: { color: "var(--iris-muted)", fontSize: "var(--iris-font-size-xs, 12px)" },
|
|
3140
|
+
children: "\u25BE"
|
|
3141
|
+
}
|
|
3142
|
+
)
|
|
3010
3143
|
]
|
|
3011
3144
|
}
|
|
3012
3145
|
),
|
|
@@ -3029,7 +3162,7 @@ function IrisTreeSelect({
|
|
|
3029
3162
|
background: "var(--iris-background)",
|
|
3030
3163
|
border: "1px solid var(--iris-border)",
|
|
3031
3164
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
3032
|
-
boxShadow: "
|
|
3165
|
+
boxShadow: "var(--iris-shadow-lg)"
|
|
3033
3166
|
},
|
|
3034
3167
|
children: renderNodes(options, 0)
|
|
3035
3168
|
}
|
|
@@ -3066,17 +3199,17 @@ function IrisMentions({
|
|
|
3066
3199
|
className,
|
|
3067
3200
|
...rest
|
|
3068
3201
|
}) {
|
|
3069
|
-
const reactId =
|
|
3202
|
+
const reactId = React70.useId();
|
|
3070
3203
|
const listboxId = `${reactId}-listbox`;
|
|
3071
3204
|
const isControlled = value !== void 0;
|
|
3072
|
-
const [internal, setInternal] =
|
|
3205
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
3073
3206
|
const text = isControlled ? value : internal;
|
|
3074
|
-
const textareaRef =
|
|
3075
|
-
const startRef =
|
|
3076
|
-
const caretRef =
|
|
3077
|
-
const pendingCaret =
|
|
3078
|
-
const [active, setActive] =
|
|
3079
|
-
const [activeIndex, setActiveIndex] =
|
|
3207
|
+
const textareaRef = React70.useRef(null);
|
|
3208
|
+
const startRef = React70.useRef(0);
|
|
3209
|
+
const caretRef = React70.useRef(0);
|
|
3210
|
+
const pendingCaret = React70.useRef(null);
|
|
3211
|
+
const [active, setActive] = React70.useState(null);
|
|
3212
|
+
const [activeIndex, setActiveIndex] = React70.useState(0);
|
|
3080
3213
|
const filtered = active ? options.filter((o) => o.label.toLowerCase().includes(active.query.toLowerCase())) : [];
|
|
3081
3214
|
const open = active !== null && filtered.length > 0;
|
|
3082
3215
|
const setText = (next) => {
|
|
@@ -3124,7 +3257,7 @@ function IrisMentions({
|
|
|
3124
3257
|
setActive(null);
|
|
3125
3258
|
}
|
|
3126
3259
|
};
|
|
3127
|
-
|
|
3260
|
+
React70.useEffect(() => {
|
|
3128
3261
|
if (pendingCaret.current != null && textareaRef.current) {
|
|
3129
3262
|
const pos = pendingCaret.current;
|
|
3130
3263
|
textareaRef.current.focus();
|
|
@@ -3164,7 +3297,7 @@ function IrisMentions({
|
|
|
3164
3297
|
boxSizing: "border-box",
|
|
3165
3298
|
width: "100%",
|
|
3166
3299
|
padding: "8px 12px",
|
|
3167
|
-
fontSize:
|
|
3300
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
3168
3301
|
fontFamily: "inherit",
|
|
3169
3302
|
color: "var(--iris-foreground)",
|
|
3170
3303
|
background: "var(--iris-background)",
|
|
@@ -3196,7 +3329,7 @@ function IrisMentions({
|
|
|
3196
3329
|
background: "var(--iris-background)",
|
|
3197
3330
|
border: "1px solid var(--iris-border)",
|
|
3198
3331
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
3199
|
-
boxShadow: "
|
|
3332
|
+
boxShadow: "var(--iris-shadow-lg)"
|
|
3200
3333
|
},
|
|
3201
3334
|
children: filtered.map((opt, i) => /* @__PURE__ */ jsx(
|
|
3202
3335
|
"li",
|
|
@@ -3210,8 +3343,8 @@ function IrisMentions({
|
|
|
3210
3343
|
onMouseEnter: () => setActiveIndex(i),
|
|
3211
3344
|
onClick: () => insert(opt),
|
|
3212
3345
|
style: {
|
|
3213
|
-
padding: "6px
|
|
3214
|
-
fontSize:
|
|
3346
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
3347
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
3215
3348
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
3216
3349
|
cursor: "pointer",
|
|
3217
3350
|
background: i === activeIndex ? "var(--iris-surface-hover, rgba(99,102,241,0.1))" : "transparent"
|
|
@@ -3227,9 +3360,13 @@ function IrisMentions({
|
|
|
3227
3360
|
);
|
|
3228
3361
|
}
|
|
3229
3362
|
var SIZE_MAP10 = {
|
|
3230
|
-
sm: { padding: "4px 8px", fontSize: "12px", minHeight: "28px" },
|
|
3231
|
-
md: {
|
|
3232
|
-
|
|
3363
|
+
sm: { padding: "4px 8px", fontSize: "var(--iris-font-size-xs, 12px)", minHeight: "28px" },
|
|
3364
|
+
md: {
|
|
3365
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
3366
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
3367
|
+
minHeight: "34px"
|
|
3368
|
+
},
|
|
3369
|
+
lg: { padding: "8px 12px", fontSize: "var(--iris-font-size-lg, 16px)", minHeight: "40px" }
|
|
3233
3370
|
};
|
|
3234
3371
|
function pathLabels(options, path) {
|
|
3235
3372
|
const labels = [];
|
|
@@ -3270,13 +3407,13 @@ function IrisCascader({
|
|
|
3270
3407
|
...rest
|
|
3271
3408
|
}) {
|
|
3272
3409
|
const { t } = useI18n();
|
|
3273
|
-
const rootRef =
|
|
3410
|
+
const rootRef = React70.useRef(null);
|
|
3274
3411
|
const isControlled = value !== void 0;
|
|
3275
|
-
const [internal, setInternal] =
|
|
3412
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
3276
3413
|
const currentValue = isControlled ? value : internal;
|
|
3277
|
-
const [open, setOpen] =
|
|
3278
|
-
const [activePath, setActivePath] =
|
|
3279
|
-
const [focused, setFocused] =
|
|
3414
|
+
const [open, setOpen] = React70.useState(false);
|
|
3415
|
+
const [activePath, setActivePath] = React70.useState(defaultValue);
|
|
3416
|
+
const [focused, setFocused] = React70.useState(false);
|
|
3280
3417
|
const columns = buildColumns(options, activePath);
|
|
3281
3418
|
const labels = pathLabels(options, currentValue);
|
|
3282
3419
|
const toggleOpen = () => {
|
|
@@ -3297,7 +3434,7 @@ function IrisCascader({
|
|
|
3297
3434
|
setOpen(false);
|
|
3298
3435
|
}
|
|
3299
3436
|
};
|
|
3300
|
-
|
|
3437
|
+
React70.useEffect(() => {
|
|
3301
3438
|
if (!open) return;
|
|
3302
3439
|
const onDown = (e) => {
|
|
3303
3440
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
@@ -3362,7 +3499,14 @@ function IrisCascader({
|
|
|
3362
3499
|
},
|
|
3363
3500
|
children: [
|
|
3364
3501
|
/* @__PURE__ */ jsx("span", { "data-iris-cascader-value": "", children: labels.length ? labels.join(separator) : placeholder ?? t("select.placeholder") }),
|
|
3365
|
-
/* @__PURE__ */ jsx(
|
|
3502
|
+
/* @__PURE__ */ jsx(
|
|
3503
|
+
"span",
|
|
3504
|
+
{
|
|
3505
|
+
"aria-hidden": "true",
|
|
3506
|
+
style: { color: "var(--iris-muted)", fontSize: "var(--iris-font-size-xs, 12px)" },
|
|
3507
|
+
children: "\u25BE"
|
|
3508
|
+
}
|
|
3509
|
+
)
|
|
3366
3510
|
]
|
|
3367
3511
|
}
|
|
3368
3512
|
),
|
|
@@ -3380,7 +3524,7 @@ function IrisCascader({
|
|
|
3380
3524
|
background: "var(--iris-background)",
|
|
3381
3525
|
border: "1px solid var(--iris-border)",
|
|
3382
3526
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
3383
|
-
boxShadow: "
|
|
3527
|
+
boxShadow: "var(--iris-shadow-lg)",
|
|
3384
3528
|
overflow: "hidden"
|
|
3385
3529
|
},
|
|
3386
3530
|
children: columns.map((col, ci) => /* @__PURE__ */ jsx(
|
|
@@ -3415,7 +3559,7 @@ function IrisCascader({
|
|
|
3415
3559
|
alignItems: "center",
|
|
3416
3560
|
justifyContent: "space-between",
|
|
3417
3561
|
gap: 8,
|
|
3418
|
-
padding: "6px
|
|
3562
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
3419
3563
|
fontSize: sz.fontSize,
|
|
3420
3564
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
3421
3565
|
cursor: node.disabled ? "not-allowed" : "pointer",
|
|
@@ -3424,7 +3568,17 @@ function IrisCascader({
|
|
|
3424
3568
|
},
|
|
3425
3569
|
children: [
|
|
3426
3570
|
/* @__PURE__ */ jsx("span", { children: node.label }),
|
|
3427
|
-
hasChildren ? /* @__PURE__ */ jsx(
|
|
3571
|
+
hasChildren ? /* @__PURE__ */ jsx(
|
|
3572
|
+
"span",
|
|
3573
|
+
{
|
|
3574
|
+
"aria-hidden": "true",
|
|
3575
|
+
style: {
|
|
3576
|
+
color: "var(--iris-muted)",
|
|
3577
|
+
fontSize: "var(--iris-font-size-xs, 12px)"
|
|
3578
|
+
},
|
|
3579
|
+
children: "\u203A"
|
|
3580
|
+
}
|
|
3581
|
+
) : null
|
|
3428
3582
|
]
|
|
3429
3583
|
},
|
|
3430
3584
|
node.value
|
|
@@ -3440,9 +3594,17 @@ function IrisCascader({
|
|
|
3440
3594
|
);
|
|
3441
3595
|
}
|
|
3442
3596
|
var SIZE_MAP11 = {
|
|
3443
|
-
sm: {
|
|
3444
|
-
|
|
3445
|
-
|
|
3597
|
+
sm: {
|
|
3598
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-space-xs, 8px)",
|
|
3599
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
3600
|
+
height: 24
|
|
3601
|
+
},
|
|
3602
|
+
md: { padding: "4px 12px", fontSize: "var(--iris-font-size-md, 14px)", height: 30 },
|
|
3603
|
+
lg: {
|
|
3604
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-space-md, 16px)",
|
|
3605
|
+
fontSize: "var(--iris-font-size-lg, 16px)",
|
|
3606
|
+
height: 36
|
|
3607
|
+
}
|
|
3446
3608
|
};
|
|
3447
3609
|
var normalize = (options) => options.map((o) => typeof o === "string" ? { label: o, value: o } : o);
|
|
3448
3610
|
function IrisSegmented({
|
|
@@ -3461,9 +3623,9 @@ function IrisSegmented({
|
|
|
3461
3623
|
const safeOptions = options ?? [];
|
|
3462
3624
|
const norm = normalize(safeOptions);
|
|
3463
3625
|
const isControlled = value !== void 0;
|
|
3464
|
-
const refs =
|
|
3626
|
+
const refs = React70.useRef([]);
|
|
3465
3627
|
const toKeys = (v) => v ? [v] : [];
|
|
3466
|
-
const modelRef =
|
|
3628
|
+
const modelRef = React70.useRef(null);
|
|
3467
3629
|
if (modelRef.current === null) {
|
|
3468
3630
|
modelRef.current = createSelectionModel({
|
|
3469
3631
|
mode: "single",
|
|
@@ -3473,16 +3635,16 @@ function IrisSegmented({
|
|
|
3473
3635
|
}
|
|
3474
3636
|
const model = modelRef.current;
|
|
3475
3637
|
const currentValue = useStore(model.store)[0] ?? "";
|
|
3476
|
-
|
|
3638
|
+
React70.useEffect(() => {
|
|
3477
3639
|
if (isControlled) model.sync(toKeys(value));
|
|
3478
3640
|
}, [value, isControlled, model]);
|
|
3479
3641
|
const displayValue = isControlled ? toKeys(value)[0] ?? "" : currentValue;
|
|
3480
3642
|
const rebaseToProp = () => {
|
|
3481
3643
|
if (isControlled) model.sync(toKeys(value));
|
|
3482
3644
|
};
|
|
3483
|
-
const isOptionEnabled =
|
|
3645
|
+
const isOptionEnabled = React70.useCallback((i) => !norm[i]?.disabled, [norm]);
|
|
3484
3646
|
const selectedIndex = norm.findIndex((o) => o.value === displayValue);
|
|
3485
|
-
const navRef =
|
|
3647
|
+
const navRef = React70.useRef(null);
|
|
3486
3648
|
if (navRef.current === null) {
|
|
3487
3649
|
navRef.current = createKeyboardNav({
|
|
3488
3650
|
count: norm.length,
|
|
@@ -3493,7 +3655,7 @@ function IrisSegmented({
|
|
|
3493
3655
|
});
|
|
3494
3656
|
}
|
|
3495
3657
|
const nav = navRef.current;
|
|
3496
|
-
|
|
3658
|
+
React70.useEffect(() => {
|
|
3497
3659
|
nav.reset(norm.length);
|
|
3498
3660
|
});
|
|
3499
3661
|
const rovingIndex = nav.index;
|
|
@@ -3527,8 +3689,8 @@ function IrisSegmented({
|
|
|
3527
3689
|
style: {
|
|
3528
3690
|
display: block ? "flex" : "inline-flex",
|
|
3529
3691
|
width: block ? "100%" : void 0,
|
|
3530
|
-
gap:
|
|
3531
|
-
padding:
|
|
3692
|
+
gap: "var(--iris-space-xxs, 4px)",
|
|
3693
|
+
padding: "var(--iris-space-xxs, 4px)",
|
|
3532
3694
|
background: "var(--iris-surface)",
|
|
3533
3695
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
3534
3696
|
opacity: disabled ? 0.6 : 1,
|
|
@@ -3588,12 +3750,12 @@ function IrisImage({
|
|
|
3588
3750
|
...rest
|
|
3589
3751
|
}) {
|
|
3590
3752
|
const { t } = useI18n();
|
|
3591
|
-
const [errored, setErrored] =
|
|
3592
|
-
const [open, setOpen] =
|
|
3593
|
-
|
|
3753
|
+
const [errored, setErrored] = React70.useState(false);
|
|
3754
|
+
const [open, setOpen] = React70.useState(false);
|
|
3755
|
+
React70.useEffect(() => {
|
|
3594
3756
|
setErrored(false);
|
|
3595
3757
|
}, [src]);
|
|
3596
|
-
|
|
3758
|
+
React70.useEffect(() => {
|
|
3597
3759
|
if (!open) return;
|
|
3598
3760
|
const onKey = (e) => {
|
|
3599
3761
|
if (e.key === "Escape") setOpen(false);
|
|
@@ -3677,8 +3839,8 @@ function IrisImage({
|
|
|
3677
3839
|
borderRadius: "50%",
|
|
3678
3840
|
border: "none",
|
|
3679
3841
|
background: "rgba(0,0,0,0.5)",
|
|
3680
|
-
color: "#fff",
|
|
3681
|
-
fontSize:
|
|
3842
|
+
color: "var(--iris-primary-foreground, #fff)",
|
|
3843
|
+
fontSize: "var(--iris-font-size-2xl, 20px)",
|
|
3682
3844
|
lineHeight: 1,
|
|
3683
3845
|
cursor: "pointer"
|
|
3684
3846
|
},
|
|
@@ -3698,10 +3860,10 @@ var fab = (size, primary) => ({
|
|
|
3698
3860
|
justifyContent: "center",
|
|
3699
3861
|
border: primary ? "none" : "1px solid var(--iris-border)",
|
|
3700
3862
|
background: primary ? "var(--iris-primary)" : "var(--iris-background)",
|
|
3701
|
-
color: primary ? "#fff" : "var(--iris-foreground)",
|
|
3863
|
+
color: primary ? "var(--iris-primary-foreground, #fff)" : "var(--iris-foreground)",
|
|
3702
3864
|
cursor: "pointer",
|
|
3703
|
-
boxShadow: "
|
|
3704
|
-
fontSize: size > 44 ?
|
|
3865
|
+
boxShadow: "var(--iris-shadow-md)",
|
|
3866
|
+
fontSize: size > 44 ? "var(--iris-font-size-2xl, 20px)" : "var(--iris-font-size-lg, 16px)",
|
|
3705
3867
|
lineHeight: 1
|
|
3706
3868
|
});
|
|
3707
3869
|
function IrisFloatButton({
|
|
@@ -3717,12 +3879,12 @@ function IrisFloatButton({
|
|
|
3717
3879
|
...rest
|
|
3718
3880
|
}) {
|
|
3719
3881
|
const { t } = useI18n();
|
|
3720
|
-
const rootRef =
|
|
3721
|
-
const [open, setOpen] =
|
|
3882
|
+
const rootRef = React70.useRef(null);
|
|
3883
|
+
const [open, setOpen] = React70.useState(false);
|
|
3722
3884
|
const hasActions = !!actions && actions.length > 0;
|
|
3723
3885
|
const content = children ?? icon ?? "+";
|
|
3724
3886
|
const radius = shape === "circle" ? "50%" : "var(--iris-radius-md, 6px)";
|
|
3725
|
-
|
|
3887
|
+
React70.useEffect(() => {
|
|
3726
3888
|
if (!open) return;
|
|
3727
3889
|
const onDown = (e) => {
|
|
3728
3890
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
@@ -3820,17 +3982,17 @@ function IrisAnchor({
|
|
|
3820
3982
|
className,
|
|
3821
3983
|
...rest
|
|
3822
3984
|
}) {
|
|
3823
|
-
const [active, setActive] =
|
|
3824
|
-
const activeRef =
|
|
3825
|
-
const itemsRef =
|
|
3985
|
+
const [active, setActive] = React70.useState("");
|
|
3986
|
+
const activeRef = React70.useRef("");
|
|
3987
|
+
const itemsRef = React70.useRef(items);
|
|
3826
3988
|
itemsRef.current = items;
|
|
3827
|
-
const offsetRef =
|
|
3989
|
+
const offsetRef = React70.useRef(offset);
|
|
3828
3990
|
offsetRef.current = offset;
|
|
3829
|
-
const onChangeRef =
|
|
3991
|
+
const onChangeRef = React70.useRef(onChange);
|
|
3830
3992
|
onChangeRef.current = onChange;
|
|
3831
|
-
const targetRef =
|
|
3993
|
+
const targetRef = React70.useRef(target);
|
|
3832
3994
|
targetRef.current = target;
|
|
3833
|
-
|
|
3995
|
+
React70.useEffect(() => {
|
|
3834
3996
|
const el = resolve3(targetRef.current);
|
|
3835
3997
|
const compute = () => {
|
|
3836
3998
|
let current = "";
|
|
@@ -3886,7 +4048,7 @@ function IrisAnchor({
|
|
|
3886
4048
|
color: isActive ? "var(--iris-primary)" : "var(--iris-foreground)",
|
|
3887
4049
|
fontWeight: isActive ? 600 : 400,
|
|
3888
4050
|
textDecoration: "none",
|
|
3889
|
-
fontSize:
|
|
4051
|
+
fontSize: "var(--iris-font-size-md, 14px)"
|
|
3890
4052
|
},
|
|
3891
4053
|
children: item.title
|
|
3892
4054
|
}
|
|
@@ -3918,11 +4080,11 @@ function IrisCountdown({
|
|
|
3918
4080
|
className,
|
|
3919
4081
|
...rest
|
|
3920
4082
|
}) {
|
|
3921
|
-
const [now, setNow] =
|
|
3922
|
-
const onFinishRef =
|
|
4083
|
+
const [now, setNow] = React70.useState(() => Date.now());
|
|
4084
|
+
const onFinishRef = React70.useRef(onFinish);
|
|
3923
4085
|
onFinishRef.current = onFinish;
|
|
3924
|
-
const finishedRef =
|
|
3925
|
-
|
|
4086
|
+
const finishedRef = React70.useRef(false);
|
|
4087
|
+
React70.useEffect(() => {
|
|
3926
4088
|
finishedRef.current = false;
|
|
3927
4089
|
const tick = format.includes("SSS") ? 100 : 1e3;
|
|
3928
4090
|
const finishIfDue = (n, id2) => {
|
|
@@ -3953,7 +4115,14 @@ function IrisCountdown({
|
|
|
3953
4115
|
...rest,
|
|
3954
4116
|
style: { display: "flex", flexDirection: "column", gap: 4, ...style },
|
|
3955
4117
|
children: [
|
|
3956
|
-
title != null ? /* @__PURE__ */ jsx(
|
|
4118
|
+
title != null ? /* @__PURE__ */ jsx(
|
|
4119
|
+
"div",
|
|
4120
|
+
{
|
|
4121
|
+
"data-iris-countdown-title": "",
|
|
4122
|
+
style: { fontSize: "var(--iris-font-size-sm, 13px)", color: "var(--iris-muted)" },
|
|
4123
|
+
children: title
|
|
4124
|
+
}
|
|
4125
|
+
) : null,
|
|
3957
4126
|
/* @__PURE__ */ jsxs(
|
|
3958
4127
|
"div",
|
|
3959
4128
|
{
|
|
@@ -3980,7 +4149,7 @@ function IrisCountdown({
|
|
|
3980
4149
|
}
|
|
3981
4150
|
var btnBase = {
|
|
3982
4151
|
padding: "4px 12px",
|
|
3983
|
-
fontSize:
|
|
4152
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
3984
4153
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
3985
4154
|
cursor: "pointer"
|
|
3986
4155
|
};
|
|
@@ -3994,7 +4163,7 @@ var btnPrimary = {
|
|
|
3994
4163
|
...btnBase,
|
|
3995
4164
|
border: "none",
|
|
3996
4165
|
background: "var(--iris-primary)",
|
|
3997
|
-
color: "#fff"
|
|
4166
|
+
color: "var(--iris-primary-foreground, #fff)"
|
|
3998
4167
|
};
|
|
3999
4168
|
function IrisTour({
|
|
4000
4169
|
steps,
|
|
@@ -4009,19 +4178,19 @@ function IrisTour({
|
|
|
4009
4178
|
}) {
|
|
4010
4179
|
const { t } = useI18n();
|
|
4011
4180
|
const isControlled = open !== void 0;
|
|
4012
|
-
const [internalOpen, setInternalOpen] =
|
|
4181
|
+
const [internalOpen, setInternalOpen] = React70.useState(defaultOpen);
|
|
4013
4182
|
const isOpen = isControlled ? open : internalOpen;
|
|
4014
|
-
const [step, setStep] =
|
|
4015
|
-
const [spotlight, setSpotlight] =
|
|
4016
|
-
const wasOpen =
|
|
4183
|
+
const [step, setStep] = React70.useState(0);
|
|
4184
|
+
const [spotlight, setSpotlight] = React70.useState(null);
|
|
4185
|
+
const wasOpen = React70.useRef(false);
|
|
4017
4186
|
const total = steps.length;
|
|
4018
4187
|
const current = Math.min(step, Math.max(0, total - 1));
|
|
4019
4188
|
const stepData = steps[current];
|
|
4020
|
-
|
|
4189
|
+
React70.useEffect(() => {
|
|
4021
4190
|
if (isOpen && !wasOpen.current) setStep(0);
|
|
4022
4191
|
wasOpen.current = isOpen;
|
|
4023
4192
|
}, [isOpen]);
|
|
4024
|
-
|
|
4193
|
+
React70.useEffect(() => {
|
|
4025
4194
|
if (!isOpen || !stepData) return;
|
|
4026
4195
|
const el = stepData.target?.();
|
|
4027
4196
|
if (el) {
|
|
@@ -4035,7 +4204,7 @@ function IrisTour({
|
|
|
4035
4204
|
if (!isControlled) setInternalOpen(false);
|
|
4036
4205
|
onClose?.();
|
|
4037
4206
|
};
|
|
4038
|
-
|
|
4207
|
+
React70.useEffect(() => {
|
|
4039
4208
|
if (!isOpen) return;
|
|
4040
4209
|
const onKey = (e) => {
|
|
4041
4210
|
if (e.key === "Escape") close();
|
|
@@ -4105,16 +4274,27 @@ function IrisTour({
|
|
|
4105
4274
|
background: "var(--iris-background)",
|
|
4106
4275
|
border: "1px solid var(--iris-border)",
|
|
4107
4276
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
4108
|
-
boxShadow: "
|
|
4277
|
+
boxShadow: "var(--iris-shadow-lg)",
|
|
4109
4278
|
...cardPos
|
|
4110
4279
|
},
|
|
4111
4280
|
children: [
|
|
4112
|
-
stepData.title != null ? /* @__PURE__ */ jsx(
|
|
4281
|
+
stepData.title != null ? /* @__PURE__ */ jsx(
|
|
4282
|
+
"div",
|
|
4283
|
+
{
|
|
4284
|
+
"data-iris-tour-title": "",
|
|
4285
|
+
style: { fontWeight: 600, marginBlockEnd: "var(--iris-space-xs, 8px)" },
|
|
4286
|
+
children: stepData.title
|
|
4287
|
+
}
|
|
4288
|
+
) : null,
|
|
4113
4289
|
stepData.description != null ? /* @__PURE__ */ jsx(
|
|
4114
4290
|
"div",
|
|
4115
4291
|
{
|
|
4116
4292
|
"data-iris-tour-description": "",
|
|
4117
|
-
style: {
|
|
4293
|
+
style: {
|
|
4294
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
4295
|
+
color: "var(--iris-foreground)",
|
|
4296
|
+
marginBlockEnd: 12
|
|
4297
|
+
},
|
|
4118
4298
|
children: stepData.description
|
|
4119
4299
|
}
|
|
4120
4300
|
) : null,
|
|
@@ -4123,7 +4303,14 @@ function IrisTour({
|
|
|
4123
4303
|
{
|
|
4124
4304
|
style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 },
|
|
4125
4305
|
children: [
|
|
4126
|
-
/* @__PURE__ */ jsx(
|
|
4306
|
+
/* @__PURE__ */ jsx(
|
|
4307
|
+
"span",
|
|
4308
|
+
{
|
|
4309
|
+
"data-iris-tour-indicator": "",
|
|
4310
|
+
style: { fontSize: "var(--iris-font-size-xs, 12px)", color: "var(--iris-muted)" },
|
|
4311
|
+
children: t("tour.step", { current: current + 1, total })
|
|
4312
|
+
}
|
|
4313
|
+
),
|
|
4127
4314
|
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
4128
4315
|
/* @__PURE__ */ jsx("button", { type: "button", "data-iris-tour-skip": "", onClick: close, style: btnGhost, children: t("tour.skip") }),
|
|
4129
4316
|
current > 0 ? /* @__PURE__ */ jsx("button", { type: "button", "data-iris-tour-prev": "", onClick: prev, style: btnGhost, children: t("tour.prev") }) : null,
|
|
@@ -4154,10 +4341,10 @@ function IrisTagInput({
|
|
|
4154
4341
|
}) {
|
|
4155
4342
|
const { t } = useI18n();
|
|
4156
4343
|
const isControlled = value !== void 0;
|
|
4157
|
-
const [internal, setInternal] =
|
|
4344
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
4158
4345
|
const tags = isControlled ? value : internal;
|
|
4159
|
-
const [input, setInput] =
|
|
4160
|
-
const [focused, setFocused] =
|
|
4346
|
+
const [input, setInput] = React70.useState("");
|
|
4347
|
+
const [focused, setFocused] = React70.useState(false);
|
|
4161
4348
|
const setTags = (next) => {
|
|
4162
4349
|
if (!isControlled) setInternal(next);
|
|
4163
4350
|
onValueChange?.(next);
|
|
@@ -4209,14 +4396,14 @@ function IrisTagInput({
|
|
|
4209
4396
|
display: "flex",
|
|
4210
4397
|
flexWrap: "wrap",
|
|
4211
4398
|
alignItems: "center",
|
|
4212
|
-
gap:
|
|
4399
|
+
gap: "var(--iris-space-xs, 8px)",
|
|
4213
4400
|
padding: "4px 8px",
|
|
4214
4401
|
minHeight: 34,
|
|
4215
4402
|
background: "var(--iris-background)",
|
|
4216
4403
|
border: `1px solid ${borderColor}`,
|
|
4217
4404
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
4218
4405
|
opacity: disabled ? 0.6 : 1,
|
|
4219
|
-
boxShadow: focused ? `0 0 0 3px
|
|
4406
|
+
boxShadow: focused ? `0 0 0 3px color-mix(in srgb, var(--iris-primary) 18%, transparent)` : "none",
|
|
4220
4407
|
transition: "border-color 120ms ease, box-shadow 120ms ease",
|
|
4221
4408
|
...style
|
|
4222
4409
|
},
|
|
@@ -4230,8 +4417,8 @@ function IrisTagInput({
|
|
|
4230
4417
|
display: "inline-flex",
|
|
4231
4418
|
alignItems: "center",
|
|
4232
4419
|
gap: 4,
|
|
4233
|
-
padding: "
|
|
4234
|
-
fontSize:
|
|
4420
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-padding-sm, 6px)",
|
|
4421
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
4235
4422
|
background: "var(--iris-surface)",
|
|
4236
4423
|
border: "1px solid var(--iris-border)",
|
|
4237
4424
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
@@ -4252,7 +4439,7 @@ function IrisTagInput({
|
|
|
4252
4439
|
background: "transparent",
|
|
4253
4440
|
color: "var(--iris-muted)",
|
|
4254
4441
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
4255
|
-
fontSize:
|
|
4442
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
4256
4443
|
lineHeight: 1,
|
|
4257
4444
|
padding: 0
|
|
4258
4445
|
},
|
|
@@ -4286,8 +4473,8 @@ function IrisTagInput({
|
|
|
4286
4473
|
background: "transparent",
|
|
4287
4474
|
color: "var(--iris-foreground)",
|
|
4288
4475
|
fontFamily: "inherit",
|
|
4289
|
-
fontSize:
|
|
4290
|
-
padding: "
|
|
4476
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
4477
|
+
padding: "var(--iris-space-xxs, 4px) 0"
|
|
4291
4478
|
}
|
|
4292
4479
|
}
|
|
4293
4480
|
)
|
|
@@ -4296,9 +4483,12 @@ function IrisTagInput({
|
|
|
4296
4483
|
);
|
|
4297
4484
|
}
|
|
4298
4485
|
var SIZE_MAP12 = {
|
|
4299
|
-
sm: { padding: "4px 8px", fontSize:
|
|
4300
|
-
md: {
|
|
4301
|
-
|
|
4486
|
+
sm: { padding: "4px 8px", fontSize: "var(--iris-font-size-xs, 12px)" },
|
|
4487
|
+
md: {
|
|
4488
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
4489
|
+
fontSize: "var(--iris-font-size-md, 14px)"
|
|
4490
|
+
},
|
|
4491
|
+
lg: { padding: "8px 16px", fontSize: "var(--iris-font-size-lg, 16px)" }
|
|
4302
4492
|
};
|
|
4303
4493
|
function IrisCopyButton({
|
|
4304
4494
|
text,
|
|
@@ -4313,8 +4503,8 @@ function IrisCopyButton({
|
|
|
4313
4503
|
...rest
|
|
4314
4504
|
}) {
|
|
4315
4505
|
const { t } = useI18n();
|
|
4316
|
-
const [copied, setCopied] =
|
|
4317
|
-
const timerRef =
|
|
4506
|
+
const [copied, setCopied] = React70.useState(false);
|
|
4507
|
+
const timerRef = React70.useRef(void 0);
|
|
4318
4508
|
const copy = async () => {
|
|
4319
4509
|
if (disabled) return;
|
|
4320
4510
|
try {
|
|
@@ -4329,7 +4519,7 @@ function IrisCopyButton({
|
|
|
4329
4519
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
4330
4520
|
timerRef.current = setTimeout(() => setCopied(false), timeout);
|
|
4331
4521
|
};
|
|
4332
|
-
|
|
4522
|
+
React70.useEffect(
|
|
4333
4523
|
() => () => {
|
|
4334
4524
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
4335
4525
|
},
|
|
@@ -4349,14 +4539,14 @@ function IrisCopyButton({
|
|
|
4349
4539
|
style: {
|
|
4350
4540
|
display: "inline-flex",
|
|
4351
4541
|
alignItems: "center",
|
|
4352
|
-
gap:
|
|
4542
|
+
gap: "var(--iris-space-xs, 8px)",
|
|
4353
4543
|
padding: sz.padding,
|
|
4354
4544
|
fontSize: sz.fontSize,
|
|
4355
4545
|
fontFamily: "inherit",
|
|
4356
4546
|
border: "1px solid var(--iris-border)",
|
|
4357
4547
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
4358
|
-
background: copied ? "var(--iris-success, #
|
|
4359
|
-
color: copied ? "#fff" : "var(--iris-foreground)",
|
|
4548
|
+
background: copied ? "var(--iris-success, #10b981)" : "var(--iris-surface)",
|
|
4549
|
+
color: copied ? "var(--iris-primary-foreground, #fff)" : "var(--iris-foreground)",
|
|
4360
4550
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
4361
4551
|
opacity: disabled ? 0.6 : 1,
|
|
4362
4552
|
transition: "background-color 120ms ease, color 120ms ease",
|
|
@@ -4368,7 +4558,7 @@ function IrisCopyButton({
|
|
|
4368
4558
|
}
|
|
4369
4559
|
var COLOR = {
|
|
4370
4560
|
default: "var(--iris-primary)",
|
|
4371
|
-
success: "var(--iris-success, #
|
|
4561
|
+
success: "var(--iris-success, #10b981)",
|
|
4372
4562
|
danger: "var(--iris-danger)",
|
|
4373
4563
|
warning: "var(--iris-warning, #f59e0b)"
|
|
4374
4564
|
};
|
|
@@ -4459,9 +4649,21 @@ function IrisProgressCircle({
|
|
|
4459
4649
|
);
|
|
4460
4650
|
}
|
|
4461
4651
|
var SIZE_MAP13 = {
|
|
4462
|
-
sm: {
|
|
4463
|
-
|
|
4464
|
-
|
|
4652
|
+
sm: {
|
|
4653
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-space-sm, 12px)",
|
|
4654
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
4655
|
+
height: 28
|
|
4656
|
+
},
|
|
4657
|
+
md: {
|
|
4658
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-space-md, 16px)",
|
|
4659
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
4660
|
+
height: 34
|
|
4661
|
+
},
|
|
4662
|
+
lg: {
|
|
4663
|
+
padding: "var(--iris-space-xs, 8px) var(--iris-space-lg, 20px)",
|
|
4664
|
+
fontSize: "var(--iris-font-size-lg, 16px)",
|
|
4665
|
+
height: 40
|
|
4666
|
+
}
|
|
4465
4667
|
};
|
|
4466
4668
|
function IrisSplitButton({
|
|
4467
4669
|
children,
|
|
@@ -4476,10 +4678,10 @@ function IrisSplitButton({
|
|
|
4476
4678
|
...rest
|
|
4477
4679
|
}) {
|
|
4478
4680
|
const { t } = useI18n();
|
|
4479
|
-
const rootRef =
|
|
4480
|
-
const [open, setOpen] =
|
|
4681
|
+
const rootRef = React70.useRef(null);
|
|
4682
|
+
const [open, setOpen] = React70.useState(false);
|
|
4481
4683
|
const hasActions = !!actions && actions.length > 0;
|
|
4482
|
-
|
|
4684
|
+
React70.useEffect(() => {
|
|
4483
4685
|
if (!open) return;
|
|
4484
4686
|
const onDown = (e) => {
|
|
4485
4687
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
@@ -4497,7 +4699,7 @@ function IrisSplitButton({
|
|
|
4497
4699
|
const sz = SIZE_MAP13[size];
|
|
4498
4700
|
const colors = variant === "primary" ? {
|
|
4499
4701
|
background: "var(--iris-primary)",
|
|
4500
|
-
color: "#fff",
|
|
4702
|
+
color: "var(--iris-primary-foreground, #fff)",
|
|
4501
4703
|
border: "1px solid var(--iris-primary)"
|
|
4502
4704
|
} : {
|
|
4503
4705
|
background: "var(--iris-surface)",
|
|
@@ -4556,7 +4758,7 @@ function IrisSplitButton({
|
|
|
4556
4758
|
borderInlineStart: variant === "primary" ? "1px solid rgba(255,255,255,0.3)" : "1px solid var(--iris-border)",
|
|
4557
4759
|
padding: "0 8px",
|
|
4558
4760
|
minHeight: sz.height,
|
|
4559
|
-
fontSize:
|
|
4761
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
4560
4762
|
borderStartEndRadius: "var(--iris-radius-md, 6px)",
|
|
4561
4763
|
borderEndEndRadius: "var(--iris-radius-md, 6px)",
|
|
4562
4764
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
@@ -4586,7 +4788,7 @@ function IrisSplitButton({
|
|
|
4586
4788
|
background: "var(--iris-background)",
|
|
4587
4789
|
border: "1px solid var(--iris-border)",
|
|
4588
4790
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
4589
|
-
boxShadow: "
|
|
4791
|
+
boxShadow: "var(--iris-shadow-lg)"
|
|
4590
4792
|
},
|
|
4591
4793
|
children: actions.map((a) => /* @__PURE__ */ jsx(
|
|
4592
4794
|
"li",
|
|
@@ -4597,8 +4799,8 @@ function IrisSplitButton({
|
|
|
4597
4799
|
"data-key": a.key,
|
|
4598
4800
|
onClick: () => select(a),
|
|
4599
4801
|
style: {
|
|
4600
|
-
padding: "6px
|
|
4601
|
-
fontSize:
|
|
4802
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
4803
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
4602
4804
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
4603
4805
|
cursor: a.disabled ? "not-allowed" : "pointer",
|
|
4604
4806
|
color: a.disabled ? "var(--iris-muted)" : "var(--iris-foreground)"
|
|
@@ -4720,11 +4922,11 @@ function IrisRibbon({
|
|
|
4720
4922
|
position: "absolute",
|
|
4721
4923
|
insetBlockStart: 8,
|
|
4722
4924
|
background: color ?? "var(--iris-primary)",
|
|
4723
|
-
color: "#fff",
|
|
4724
|
-
padding: "
|
|
4725
|
-
fontSize:
|
|
4925
|
+
color: "var(--iris-primary-foreground, #fff)",
|
|
4926
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-space-sm, 12px)",
|
|
4927
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
4726
4928
|
fontWeight: 600,
|
|
4727
|
-
boxShadow: "
|
|
4929
|
+
boxShadow: "var(--iris-shadow-sm)",
|
|
4728
4930
|
whiteSpace: "nowrap",
|
|
4729
4931
|
...side
|
|
4730
4932
|
},
|
|
@@ -4737,7 +4939,7 @@ function IrisRibbon({
|
|
|
4737
4939
|
}
|
|
4738
4940
|
var COLOR2 = {
|
|
4739
4941
|
default: "var(--iris-primary)",
|
|
4740
|
-
success: "var(--iris-success, #
|
|
4942
|
+
success: "var(--iris-success, #10b981)",
|
|
4741
4943
|
danger: "var(--iris-danger)",
|
|
4742
4944
|
warning: "var(--iris-warning, #f59e0b)"
|
|
4743
4945
|
};
|
|
@@ -4773,7 +4975,7 @@ function IrisGauge({
|
|
|
4773
4975
|
"aria-valuenow": value,
|
|
4774
4976
|
"aria-valuemin": min,
|
|
4775
4977
|
"aria-valuemax": max,
|
|
4776
|
-
"aria-valuetext": `${percent}
|
|
4978
|
+
"aria-valuetext": min === 0 && max === 100 ? `${percent}%` : `${value} (${percent}%)`,
|
|
4777
4979
|
"aria-label": ariaLabel,
|
|
4778
4980
|
className,
|
|
4779
4981
|
...rest,
|
|
@@ -4820,7 +5022,7 @@ function IrisGauge({
|
|
|
4820
5022
|
color: "var(--iris-foreground)",
|
|
4821
5023
|
fontVariantNumeric: "tabular-nums"
|
|
4822
5024
|
},
|
|
4823
|
-
children: format ? format(value, percent) : `${percent}%`
|
|
5025
|
+
children: format ? format(value, percent) : min === 0 && max === 100 ? `${percent}%` : String(value)
|
|
4824
5026
|
}
|
|
4825
5027
|
) : null
|
|
4826
5028
|
]
|
|
@@ -4840,9 +5042,9 @@ function IrisMarquee({
|
|
|
4840
5042
|
className,
|
|
4841
5043
|
...rest
|
|
4842
5044
|
}) {
|
|
4843
|
-
const trackRef =
|
|
4844
|
-
const animRef =
|
|
4845
|
-
|
|
5045
|
+
const trackRef = React70.useRef(null);
|
|
5046
|
+
const animRef = React70.useRef(null);
|
|
5047
|
+
React70.useEffect(() => {
|
|
4846
5048
|
const el = trackRef.current;
|
|
4847
5049
|
if (!el || typeof el.animate !== "function" || prefersReducedMotion4()) return;
|
|
4848
5050
|
const frames = direction === "left" ? [{ transform: "translateX(0%)" }, { transform: "translateX(-50%)" }] : [{ transform: "translateX(-50%)" }, { transform: "translateX(0%)" }];
|
|
@@ -4915,7 +5117,7 @@ function IrisMasonry({
|
|
|
4915
5117
|
className,
|
|
4916
5118
|
...rest,
|
|
4917
5119
|
style: { columnCount: columns, columnGap: gap, ...style },
|
|
4918
|
-
children:
|
|
5120
|
+
children: React70.Children.map(children, (child) => /* @__PURE__ */ jsx("div", { "data-iris-masonry-item": "", style: { breakInside: "avoid", marginBlockEnd: gap }, children: child }))
|
|
4919
5121
|
}
|
|
4920
5122
|
);
|
|
4921
5123
|
}
|
|
@@ -4950,8 +5152,8 @@ function IrisFieldset({
|
|
|
4950
5152
|
{
|
|
4951
5153
|
"data-iris-fieldset-legend": "",
|
|
4952
5154
|
style: {
|
|
4953
|
-
padding: "0 6px",
|
|
4954
|
-
fontSize:
|
|
5155
|
+
padding: "0 var(--iris-padding-sm, 6px)",
|
|
5156
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
4955
5157
|
fontWeight: 600,
|
|
4956
5158
|
color: "var(--iris-foreground)"
|
|
4957
5159
|
},
|
|
@@ -4962,7 +5164,11 @@ function IrisFieldset({
|
|
|
4962
5164
|
"div",
|
|
4963
5165
|
{
|
|
4964
5166
|
"data-iris-fieldset-hint": "",
|
|
4965
|
-
style: {
|
|
5167
|
+
style: {
|
|
5168
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
5169
|
+
color: "var(--iris-muted)",
|
|
5170
|
+
marginBlockEnd: 8
|
|
5171
|
+
},
|
|
4966
5172
|
children: hint
|
|
4967
5173
|
}
|
|
4968
5174
|
) : null,
|
|
@@ -4980,15 +5186,15 @@ function IrisToolbar({
|
|
|
4980
5186
|
className,
|
|
4981
5187
|
...rest
|
|
4982
5188
|
}) {
|
|
4983
|
-
const ref =
|
|
4984
|
-
const items =
|
|
5189
|
+
const ref = React70.useRef(null);
|
|
5190
|
+
const items = React70.useCallback(() => {
|
|
4985
5191
|
const root = ref.current;
|
|
4986
5192
|
if (!root) return [];
|
|
4987
5193
|
return Array.from(root.querySelectorAll(SELECTOR)).filter(
|
|
4988
5194
|
(el) => !el.hasAttribute("disabled")
|
|
4989
5195
|
);
|
|
4990
5196
|
}, []);
|
|
4991
|
-
const navRef =
|
|
5197
|
+
const navRef = React70.useRef(null);
|
|
4992
5198
|
if (navRef.current === null) {
|
|
4993
5199
|
navRef.current = createKeyboardNav({
|
|
4994
5200
|
count: 0,
|
|
@@ -4998,10 +5204,10 @@ function IrisToolbar({
|
|
|
4998
5204
|
});
|
|
4999
5205
|
}
|
|
5000
5206
|
const nav = navRef.current;
|
|
5001
|
-
|
|
5207
|
+
React70.useEffect(() => {
|
|
5002
5208
|
nav.reset(items().length);
|
|
5003
5209
|
});
|
|
5004
|
-
|
|
5210
|
+
React70.useEffect(() => {
|
|
5005
5211
|
items().forEach((el, i) => {
|
|
5006
5212
|
el.tabIndex = i === 0 ? 0 : -1;
|
|
5007
5213
|
});
|
|
@@ -5054,14 +5260,14 @@ function IrisToolbar({
|
|
|
5054
5260
|
}
|
|
5055
5261
|
);
|
|
5056
5262
|
}
|
|
5057
|
-
var RadioGroupContext =
|
|
5263
|
+
var RadioGroupContext = React70.createContext(null);
|
|
5058
5264
|
var DIM_MAP2 = {
|
|
5059
5265
|
sm: "14px",
|
|
5060
5266
|
md: "18px",
|
|
5061
5267
|
lg: "22px"
|
|
5062
5268
|
};
|
|
5063
|
-
var IrisRadio =
|
|
5064
|
-
const ctx =
|
|
5269
|
+
var IrisRadio = React70.forwardRef(function IrisRadio2({ value, size = "md", disabled, children, style, ...rest }, ref) {
|
|
5270
|
+
const ctx = React70.useContext(RadioGroupContext);
|
|
5065
5271
|
if (!ctx) throw new Error("IrisRadio must be used inside <IrisRadioGroup>");
|
|
5066
5272
|
const isDisabled = disabled || ctx.disabled;
|
|
5067
5273
|
const isChecked = ctx.value === value;
|
|
@@ -5146,7 +5352,7 @@ function IrisRadioGroup({
|
|
|
5146
5352
|
}) {
|
|
5147
5353
|
const isControlled = value !== void 0;
|
|
5148
5354
|
const toKeys = (v) => v == null ? [] : [v];
|
|
5149
|
-
const modelRef =
|
|
5355
|
+
const modelRef = React70.useRef(null);
|
|
5150
5356
|
if (modelRef.current === null) {
|
|
5151
5357
|
modelRef.current = createSelectionModel({
|
|
5152
5358
|
mode: "single",
|
|
@@ -5156,10 +5362,10 @@ function IrisRadioGroup({
|
|
|
5156
5362
|
}
|
|
5157
5363
|
const model = modelRef.current;
|
|
5158
5364
|
const current = useStore(model.store)[0] ?? null;
|
|
5159
|
-
|
|
5365
|
+
React70.useEffect(() => {
|
|
5160
5366
|
if (isControlled) model.sync(toKeys(value));
|
|
5161
5367
|
}, [value, isControlled, model]);
|
|
5162
|
-
const autoName =
|
|
5368
|
+
const autoName = React70.useId();
|
|
5163
5369
|
const groupName = name ?? `iris-radio-${autoName}`;
|
|
5164
5370
|
const setValue = (next) => {
|
|
5165
5371
|
if (disabled) return;
|
|
@@ -5183,6 +5389,65 @@ function IrisRadioGroup({
|
|
|
5183
5389
|
}
|
|
5184
5390
|
) });
|
|
5185
5391
|
}
|
|
5392
|
+
|
|
5393
|
+
// src/floating/animations.ts
|
|
5394
|
+
var STYLE_ID2 = "iris-floating-animations";
|
|
5395
|
+
var installed5 = false;
|
|
5396
|
+
var ANIM_DIALOG = "var(--iris-anim-dialog)";
|
|
5397
|
+
var ANIM_POPOVER = "var(--iris-anim-popover)";
|
|
5398
|
+
var ANIM_TOAST = "var(--iris-anim-toast)";
|
|
5399
|
+
var ANIM_TOOLTIP = "var(--iris-anim-tooltip)";
|
|
5400
|
+
function installFloatingAnimations() {
|
|
5401
|
+
if (installed5 || typeof document === "undefined") return;
|
|
5402
|
+
installed5 = true;
|
|
5403
|
+
if (document.getElementById(STYLE_ID2)) return;
|
|
5404
|
+
const style = document.createElement("style");
|
|
5405
|
+
style.id = STYLE_ID2;
|
|
5406
|
+
style.textContent = `
|
|
5407
|
+
:root {
|
|
5408
|
+
--iris-anim-dialog: iris-dialog-in 150ms ease-out;
|
|
5409
|
+
--iris-anim-popover: iris-popover-in 150ms ease-out;
|
|
5410
|
+
--iris-anim-toast: iris-toast-in 200ms ease-out;
|
|
5411
|
+
--iris-anim-tooltip: iris-tooltip-in 120ms ease-out;
|
|
5412
|
+
}
|
|
5413
|
+
@keyframes iris-dialog-in {
|
|
5414
|
+
from { opacity: 0; transform: scale(0.96); }
|
|
5415
|
+
to { opacity: 1; transform: scale(1); }
|
|
5416
|
+
}
|
|
5417
|
+
@keyframes iris-popover-in {
|
|
5418
|
+
from { opacity: 0; transform: translateY(4px); }
|
|
5419
|
+
to { opacity: 1; transform: translateY(0); }
|
|
5420
|
+
}
|
|
5421
|
+
@keyframes iris-toast-in {
|
|
5422
|
+
from { opacity: 0; transform: translateY(-8px); }
|
|
5423
|
+
to { opacity: 1; transform: translateY(0); }
|
|
5424
|
+
}
|
|
5425
|
+
@keyframes iris-tooltip-in {
|
|
5426
|
+
from { opacity: 0; }
|
|
5427
|
+
to { opacity: 1; }
|
|
5428
|
+
}
|
|
5429
|
+
@media (prefers-reduced-motion: reduce) {
|
|
5430
|
+
:root {
|
|
5431
|
+
--iris-anim-dialog: none;
|
|
5432
|
+
--iris-anim-popover: none;
|
|
5433
|
+
--iris-anim-toast: none;
|
|
5434
|
+
--iris-anim-tooltip: none;
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
/* P4: global focus-visible ring for interactive controls */
|
|
5438
|
+
[data-iris-tabs-trigger]:focus-visible,
|
|
5439
|
+
[data-iris-switch]:focus-visible,
|
|
5440
|
+
[data-iris-checkbox]:focus-visible,
|
|
5441
|
+
[data-iris-select-trigger]:focus-visible,
|
|
5442
|
+
[data-iris-segmented-item]:focus-visible,
|
|
5443
|
+
[data-iris-menu-item]:focus-visible,
|
|
5444
|
+
[data-iris-nav-menu-item]:focus-visible {
|
|
5445
|
+
outline: 2px solid var(--iris-primary);
|
|
5446
|
+
outline-offset: 2px;
|
|
5447
|
+
}
|
|
5448
|
+
`;
|
|
5449
|
+
document.head.appendChild(style);
|
|
5450
|
+
}
|
|
5186
5451
|
function IrisTooltip({
|
|
5187
5452
|
content,
|
|
5188
5453
|
placement = "top",
|
|
@@ -5194,16 +5459,17 @@ function IrisTooltip({
|
|
|
5194
5459
|
children,
|
|
5195
5460
|
...rest
|
|
5196
5461
|
}) {
|
|
5197
|
-
|
|
5198
|
-
const
|
|
5199
|
-
const
|
|
5200
|
-
const
|
|
5201
|
-
const
|
|
5462
|
+
installFloatingAnimations();
|
|
5463
|
+
const triggerRef = React70.useRef(null);
|
|
5464
|
+
const floatingRef = React70.useRef(null);
|
|
5465
|
+
const tooltipId = React70.useId();
|
|
5466
|
+
const [open, setOpen] = React70.useState(false);
|
|
5467
|
+
const hi = React70.useMemo(
|
|
5202
5468
|
() => createHoverIntent({ openDelay, closeDelay, onChange: setOpen }),
|
|
5203
5469
|
[openDelay, closeDelay]
|
|
5204
5470
|
);
|
|
5205
|
-
|
|
5206
|
-
|
|
5471
|
+
React70.useEffect(() => () => hi.stop(), [hi]);
|
|
5472
|
+
React70.useEffect(() => {
|
|
5207
5473
|
if (!open) return;
|
|
5208
5474
|
const onKeyDown = (e) => {
|
|
5209
5475
|
if (e.key === "Escape") hi.close();
|
|
@@ -5211,7 +5477,7 @@ function IrisTooltip({
|
|
|
5211
5477
|
document.addEventListener("keydown", onKeyDown);
|
|
5212
5478
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5213
5479
|
}, [open, hi]);
|
|
5214
|
-
|
|
5480
|
+
React70.useEffect(() => {
|
|
5215
5481
|
if (disabled && open) hi.close();
|
|
5216
5482
|
}, [disabled, open, hi]);
|
|
5217
5483
|
const { floatingStyles } = useFloating({
|
|
@@ -5221,23 +5487,23 @@ function IrisTooltip({
|
|
|
5221
5487
|
placement,
|
|
5222
5488
|
offset
|
|
5223
5489
|
});
|
|
5224
|
-
const captureTriggerRef =
|
|
5490
|
+
const captureTriggerRef = React70.useCallback((el) => {
|
|
5225
5491
|
triggerRef.current = el;
|
|
5226
5492
|
}, []);
|
|
5227
|
-
const captureFloatingRef =
|
|
5493
|
+
const captureFloatingRef = React70.useCallback((el) => {
|
|
5228
5494
|
floatingRef.current = el;
|
|
5229
5495
|
}, []);
|
|
5230
|
-
if (!
|
|
5496
|
+
if (!React70.isValidElement(children)) {
|
|
5231
5497
|
if (process.env.NODE_ENV !== "production") {
|
|
5232
5498
|
console.warn("[iris-ui] IrisTooltip requires a single React element child as trigger");
|
|
5233
5499
|
}
|
|
5234
5500
|
return null;
|
|
5235
5501
|
}
|
|
5236
|
-
const handleEnter =
|
|
5502
|
+
const handleEnter = React70.useCallback(
|
|
5237
5503
|
() => openDelay > 0 ? hi.pointerEnter() : hi.open(),
|
|
5238
5504
|
[openDelay, hi]
|
|
5239
5505
|
);
|
|
5240
|
-
const handleLeave =
|
|
5506
|
+
const handleLeave = React70.useCallback(
|
|
5241
5507
|
() => closeDelay > 0 ? hi.pointerLeave() : hi.close(),
|
|
5242
5508
|
[closeDelay, hi]
|
|
5243
5509
|
);
|
|
@@ -5254,13 +5520,14 @@ function IrisTooltip({
|
|
|
5254
5520
|
...floatingStyles,
|
|
5255
5521
|
background: "var(--iris-foreground)",
|
|
5256
5522
|
color: "var(--iris-background)",
|
|
5523
|
+
animation: ANIM_TOOLTIP,
|
|
5257
5524
|
padding: "4px 8px",
|
|
5258
5525
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
5259
|
-
fontSize: "12px",
|
|
5526
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
5260
5527
|
lineHeight: 1.4,
|
|
5261
5528
|
maxWidth: "240px",
|
|
5262
5529
|
pointerEvents: "none",
|
|
5263
|
-
zIndex: 1100
|
|
5530
|
+
zIndex: "var(--iris-z-tooltip, 1100)"
|
|
5264
5531
|
},
|
|
5265
5532
|
children: content
|
|
5266
5533
|
}
|
|
@@ -5282,9 +5549,9 @@ function IrisTooltip({
|
|
|
5282
5549
|
portaled
|
|
5283
5550
|
] });
|
|
5284
5551
|
}
|
|
5285
|
-
var PopoverContext =
|
|
5552
|
+
var PopoverContext = React70.createContext(null);
|
|
5286
5553
|
function usePopoverContext(componentName) {
|
|
5287
|
-
const ctx =
|
|
5554
|
+
const ctx = React70.useContext(PopoverContext);
|
|
5288
5555
|
if (!ctx) {
|
|
5289
5556
|
throw new Error(`[iris-ui] ${componentName} must be a descendant of <IrisPopover>`);
|
|
5290
5557
|
}
|
|
@@ -5301,7 +5568,7 @@ function IrisPopover({
|
|
|
5301
5568
|
const isControlled = openProp !== void 0;
|
|
5302
5569
|
const [state, send] = useMachine(() => createFloatingMachine(defaultOpen ? "open" : "closed"));
|
|
5303
5570
|
const internalOpen = state.value === "open";
|
|
5304
|
-
|
|
5571
|
+
React70.useEffect(() => {
|
|
5305
5572
|
if (!isControlled) return;
|
|
5306
5573
|
const target = openProp ? "open" : "closed";
|
|
5307
5574
|
if (state.value !== target) {
|
|
@@ -5309,7 +5576,7 @@ function IrisPopover({
|
|
|
5309
5576
|
}
|
|
5310
5577
|
}, [isControlled, openProp, state.value, send]);
|
|
5311
5578
|
const open = isControlled ? Boolean(openProp) : internalOpen;
|
|
5312
|
-
const setOpen =
|
|
5579
|
+
const setOpen = React70.useCallback(
|
|
5313
5580
|
(next) => {
|
|
5314
5581
|
if (!isControlled) {
|
|
5315
5582
|
send({ type: next ? "OPEN" : "CLOSE" });
|
|
@@ -5318,10 +5585,10 @@ function IrisPopover({
|
|
|
5318
5585
|
},
|
|
5319
5586
|
[isControlled, send, onOpenChange]
|
|
5320
5587
|
);
|
|
5321
|
-
const triggerRef =
|
|
5322
|
-
const contentRef =
|
|
5323
|
-
const contentId =
|
|
5324
|
-
const value =
|
|
5588
|
+
const triggerRef = React70.useRef(null);
|
|
5589
|
+
const contentRef = React70.useRef(null);
|
|
5590
|
+
const contentId = React70.useId();
|
|
5591
|
+
const value = React70.useMemo(
|
|
5325
5592
|
() => ({
|
|
5326
5593
|
open,
|
|
5327
5594
|
setOpen,
|
|
@@ -5335,10 +5602,10 @@ function IrisPopover({
|
|
|
5335
5602
|
);
|
|
5336
5603
|
return /* @__PURE__ */ jsx(PopoverContext.Provider, { value, children });
|
|
5337
5604
|
}
|
|
5338
|
-
var IrisPopoverTrigger =
|
|
5605
|
+
var IrisPopoverTrigger = React70.forwardRef(
|
|
5339
5606
|
function IrisPopoverTrigger2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5340
5607
|
const ctx = usePopoverContext("IrisPopoverTrigger");
|
|
5341
|
-
const captureRef =
|
|
5608
|
+
const captureRef = React70.useCallback(
|
|
5342
5609
|
(el) => {
|
|
5343
5610
|
ctx.triggerRef.current = el;
|
|
5344
5611
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -5359,7 +5626,7 @@ var IrisPopoverTrigger = React67.forwardRef(
|
|
|
5359
5626
|
onClick: handleClick
|
|
5360
5627
|
};
|
|
5361
5628
|
if (asChild) {
|
|
5362
|
-
if (!
|
|
5629
|
+
if (!React70.isValidElement(children)) {
|
|
5363
5630
|
if (process.env.NODE_ENV !== "production") {
|
|
5364
5631
|
console.warn("[iris-ui] IrisPopoverTrigger asChild requires a single React element");
|
|
5365
5632
|
}
|
|
@@ -5379,12 +5646,13 @@ var IrisPopoverTrigger = React67.forwardRef(
|
|
|
5379
5646
|
);
|
|
5380
5647
|
}
|
|
5381
5648
|
);
|
|
5382
|
-
var IrisPopoverContent =
|
|
5649
|
+
var IrisPopoverContent = React70.forwardRef(
|
|
5383
5650
|
function IrisPopoverContent2({ portalTarget, autoFocus = true, restoreFocus = true, style, children, ...rest }, forwardedRef) {
|
|
5384
5651
|
const ctx = usePopoverContext("IrisPopoverContent");
|
|
5385
|
-
const innerRef =
|
|
5386
|
-
const captureRef =
|
|
5652
|
+
const innerRef = React70.useRef(null);
|
|
5653
|
+
const captureRef = React70.useCallback(
|
|
5387
5654
|
(el) => {
|
|
5655
|
+
installFloatingAnimations();
|
|
5388
5656
|
innerRef.current = el;
|
|
5389
5657
|
ctx.contentRef.current = el;
|
|
5390
5658
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -5405,9 +5673,9 @@ var IrisPopoverContent = React67.forwardRef(
|
|
|
5405
5673
|
exclude: [ctx.triggerRef, ctx.contentRef],
|
|
5406
5674
|
onDismiss: () => ctx.setOpen(false)
|
|
5407
5675
|
});
|
|
5408
|
-
const lastFocusedRef =
|
|
5409
|
-
const wasOpenRef =
|
|
5410
|
-
|
|
5676
|
+
const lastFocusedRef = React70.useRef(null);
|
|
5677
|
+
const wasOpenRef = React70.useRef(false);
|
|
5678
|
+
React70.useEffect(() => {
|
|
5411
5679
|
if (ctx.open && !wasOpenRef.current) {
|
|
5412
5680
|
lastFocusedRef.current = document.activeElement ?? ctx.triggerRef.current;
|
|
5413
5681
|
if (autoFocus) {
|
|
@@ -5436,14 +5704,15 @@ var IrisPopoverContent = React67.forwardRef(
|
|
|
5436
5704
|
"data-placement": ctx.placement,
|
|
5437
5705
|
style: {
|
|
5438
5706
|
...floatingStyles,
|
|
5439
|
-
background: "var(--iris-surface)",
|
|
5707
|
+
background: "var(--iris-surface-floating)",
|
|
5708
|
+
animation: ANIM_POPOVER,
|
|
5440
5709
|
color: "var(--iris-foreground)",
|
|
5441
5710
|
border: "1px solid var(--iris-border)",
|
|
5442
5711
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
5443
5712
|
padding: "var(--iris-padding-md, 12px)",
|
|
5444
|
-
boxShadow: "
|
|
5445
|
-
fontSize:
|
|
5446
|
-
zIndex:
|
|
5713
|
+
boxShadow: "var(--iris-shadow-lg)",
|
|
5714
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
5715
|
+
zIndex: "var(--iris-z-popover, 1000)",
|
|
5447
5716
|
outline: "none",
|
|
5448
5717
|
...style
|
|
5449
5718
|
},
|
|
@@ -5455,9 +5724,9 @@ var IrisPopoverContent = React67.forwardRef(
|
|
|
5455
5724
|
return createPortal(node, portalTarget ?? document.body);
|
|
5456
5725
|
}
|
|
5457
5726
|
);
|
|
5458
|
-
var DialogContext =
|
|
5727
|
+
var DialogContext = React70.createContext(null);
|
|
5459
5728
|
function useDialogContext(componentName) {
|
|
5460
|
-
const ctx =
|
|
5729
|
+
const ctx = React70.useContext(DialogContext);
|
|
5461
5730
|
if (!ctx) {
|
|
5462
5731
|
throw new Error(`[iris-ui] ${componentName} must be a descendant of <IrisDialog>`);
|
|
5463
5732
|
}
|
|
@@ -5474,7 +5743,7 @@ function IrisDialog({
|
|
|
5474
5743
|
const isControlled = openProp !== void 0;
|
|
5475
5744
|
const [state, send] = useMachine(() => createFloatingMachine(defaultOpen ? "open" : "closed"));
|
|
5476
5745
|
const internalOpen = state.value === "open";
|
|
5477
|
-
|
|
5746
|
+
React70.useEffect(() => {
|
|
5478
5747
|
if (!isControlled) return;
|
|
5479
5748
|
const target = openProp ? "open" : "closed";
|
|
5480
5749
|
if (state.value !== target) {
|
|
@@ -5482,7 +5751,7 @@ function IrisDialog({
|
|
|
5482
5751
|
}
|
|
5483
5752
|
}, [isControlled, openProp, state.value, send]);
|
|
5484
5753
|
const open = isControlled ? Boolean(openProp) : internalOpen;
|
|
5485
|
-
const setOpen =
|
|
5754
|
+
const setOpen = React70.useCallback(
|
|
5486
5755
|
(next) => {
|
|
5487
5756
|
if (!isControlled) {
|
|
5488
5757
|
send({ type: next ? "OPEN" : "CLOSE" });
|
|
@@ -5491,16 +5760,16 @@ function IrisDialog({
|
|
|
5491
5760
|
},
|
|
5492
5761
|
[isControlled, send, onOpenChange]
|
|
5493
5762
|
);
|
|
5494
|
-
const triggerRef =
|
|
5495
|
-
const contentRef =
|
|
5496
|
-
const contentId =
|
|
5497
|
-
const titleId =
|
|
5498
|
-
const descriptionId =
|
|
5499
|
-
const titleCountRef =
|
|
5500
|
-
const descCountRef =
|
|
5501
|
-
const [hasTitle, setHasTitle] =
|
|
5502
|
-
const [hasDescription, setHasDescription] =
|
|
5503
|
-
const registerTitle =
|
|
5763
|
+
const triggerRef = React70.useRef(null);
|
|
5764
|
+
const contentRef = React70.useRef(null);
|
|
5765
|
+
const contentId = React70.useId();
|
|
5766
|
+
const titleId = React70.useId();
|
|
5767
|
+
const descriptionId = React70.useId();
|
|
5768
|
+
const titleCountRef = React70.useRef(0);
|
|
5769
|
+
const descCountRef = React70.useRef(0);
|
|
5770
|
+
const [hasTitle, setHasTitle] = React70.useState(false);
|
|
5771
|
+
const [hasDescription, setHasDescription] = React70.useState(false);
|
|
5772
|
+
const registerTitle = React70.useCallback(() => {
|
|
5504
5773
|
titleCountRef.current += 1;
|
|
5505
5774
|
setHasTitle(true);
|
|
5506
5775
|
return () => {
|
|
@@ -5508,7 +5777,7 @@ function IrisDialog({
|
|
|
5508
5777
|
if (titleCountRef.current <= 0) setHasTitle(false);
|
|
5509
5778
|
};
|
|
5510
5779
|
}, []);
|
|
5511
|
-
const registerDescription =
|
|
5780
|
+
const registerDescription = React70.useCallback(() => {
|
|
5512
5781
|
descCountRef.current += 1;
|
|
5513
5782
|
setHasDescription(true);
|
|
5514
5783
|
return () => {
|
|
@@ -5516,7 +5785,7 @@ function IrisDialog({
|
|
|
5516
5785
|
if (descCountRef.current <= 0) setHasDescription(false);
|
|
5517
5786
|
};
|
|
5518
5787
|
}, []);
|
|
5519
|
-
const value =
|
|
5788
|
+
const value = React70.useMemo(
|
|
5520
5789
|
() => ({
|
|
5521
5790
|
open,
|
|
5522
5791
|
setOpen,
|
|
@@ -5548,10 +5817,10 @@ function IrisDialog({
|
|
|
5548
5817
|
);
|
|
5549
5818
|
return /* @__PURE__ */ jsx(DialogContext.Provider, { value, children });
|
|
5550
5819
|
}
|
|
5551
|
-
var IrisDialogTrigger =
|
|
5820
|
+
var IrisDialogTrigger = React70.forwardRef(
|
|
5552
5821
|
function IrisDialogTrigger2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5553
5822
|
const ctx = useDialogContext("IrisDialogTrigger");
|
|
5554
|
-
const captureRef =
|
|
5823
|
+
const captureRef = React70.useCallback(
|
|
5555
5824
|
(el) => {
|
|
5556
5825
|
ctx.triggerRef.current = el;
|
|
5557
5826
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -5572,7 +5841,7 @@ var IrisDialogTrigger = React67.forwardRef(
|
|
|
5572
5841
|
onClick: handleClick
|
|
5573
5842
|
};
|
|
5574
5843
|
if (asChild) {
|
|
5575
|
-
if (!
|
|
5844
|
+
if (!React70.isValidElement(children)) {
|
|
5576
5845
|
if (process.env.NODE_ENV !== "production") {
|
|
5577
5846
|
console.warn("[iris-ui] IrisDialogTrigger asChild requires a single React element");
|
|
5578
5847
|
}
|
|
@@ -5592,11 +5861,11 @@ var IrisDialogTrigger = React67.forwardRef(
|
|
|
5592
5861
|
);
|
|
5593
5862
|
}
|
|
5594
5863
|
);
|
|
5595
|
-
var IrisDialogContent =
|
|
5864
|
+
var IrisDialogContent = React70.forwardRef(
|
|
5596
5865
|
function IrisDialogContent2({ portalTarget, style, onPointerDown, children, ...rest }, forwardedRef) {
|
|
5597
5866
|
const ctx = useDialogContext("IrisDialogContent");
|
|
5598
|
-
const innerRef =
|
|
5599
|
-
const captureRef =
|
|
5867
|
+
const innerRef = React70.useRef(null);
|
|
5868
|
+
const captureRef = React70.useCallback(
|
|
5600
5869
|
(el) => {
|
|
5601
5870
|
innerRef.current = el;
|
|
5602
5871
|
ctx.contentRef.current = el;
|
|
@@ -5606,13 +5875,14 @@ var IrisDialogContent = React67.forwardRef(
|
|
|
5606
5875
|
},
|
|
5607
5876
|
[ctx, forwardedRef]
|
|
5608
5877
|
);
|
|
5878
|
+
installFloatingAnimations();
|
|
5609
5879
|
useBodyScrollLock(ctx.open);
|
|
5610
5880
|
useFocusTrap({
|
|
5611
5881
|
container: innerRef,
|
|
5612
5882
|
active: ctx.open,
|
|
5613
5883
|
returnFocusTo: ctx.triggerRef
|
|
5614
5884
|
});
|
|
5615
|
-
|
|
5885
|
+
React70.useEffect(() => {
|
|
5616
5886
|
if (!ctx.open || !ctx.closeOnEscape) return;
|
|
5617
5887
|
const onKeyDown = (e) => {
|
|
5618
5888
|
if (e.key === "Escape") {
|
|
@@ -5640,8 +5910,8 @@ var IrisDialogContent = React67.forwardRef(
|
|
|
5640
5910
|
style: {
|
|
5641
5911
|
position: "fixed",
|
|
5642
5912
|
inset: 0,
|
|
5643
|
-
background: "rgba(0, 0, 0, 0.5)",
|
|
5644
|
-
zIndex: 1200,
|
|
5913
|
+
background: "var(--iris-backdrop, rgba(0, 0, 0, 0.5))",
|
|
5914
|
+
zIndex: "var(--iris-z-modal, 1200)",
|
|
5645
5915
|
display: "flex",
|
|
5646
5916
|
alignItems: "center",
|
|
5647
5917
|
justifyContent: "center",
|
|
@@ -5661,12 +5931,13 @@ var IrisDialogContent = React67.forwardRef(
|
|
|
5661
5931
|
"data-state": "open",
|
|
5662
5932
|
onPointerDown: handleContentPointerDown,
|
|
5663
5933
|
style: {
|
|
5664
|
-
background: "var(--iris-surface)",
|
|
5934
|
+
background: "var(--iris-surface-floating)",
|
|
5665
5935
|
color: "var(--iris-foreground)",
|
|
5666
5936
|
border: "1px solid var(--iris-border)",
|
|
5667
5937
|
borderRadius: "var(--iris-radius-lg, 8px)",
|
|
5938
|
+
animation: ANIM_DIALOG,
|
|
5668
5939
|
padding: "var(--iris-padding-lg, 20px)",
|
|
5669
|
-
boxShadow: "
|
|
5940
|
+
boxShadow: "var(--iris-shadow-xl)",
|
|
5670
5941
|
maxWidth: "90vw",
|
|
5671
5942
|
maxHeight: "85vh",
|
|
5672
5943
|
overflow: "auto",
|
|
@@ -5683,11 +5954,11 @@ var IrisDialogContent = React67.forwardRef(
|
|
|
5683
5954
|
return createPortal(node, portalTarget ?? document.body);
|
|
5684
5955
|
}
|
|
5685
5956
|
);
|
|
5686
|
-
var IrisDialogTitle =
|
|
5957
|
+
var IrisDialogTitle = React70.forwardRef(
|
|
5687
5958
|
function IrisDialogTitle2({ as = "h2", style, children, ...rest }, ref) {
|
|
5688
5959
|
const ctx = useDialogContext("IrisDialogTitle");
|
|
5689
|
-
|
|
5690
|
-
return
|
|
5960
|
+
React70.useEffect(() => ctx.registerTitle(), [ctx.registerTitle]);
|
|
5961
|
+
return React70.createElement(
|
|
5691
5962
|
as,
|
|
5692
5963
|
{
|
|
5693
5964
|
...rest,
|
|
@@ -5695,7 +5966,7 @@ var IrisDialogTitle = React67.forwardRef(
|
|
|
5695
5966
|
id: ctx.titleId,
|
|
5696
5967
|
style: {
|
|
5697
5968
|
margin: "0 0 var(--iris-gap-md, 12px) 0",
|
|
5698
|
-
fontSize: "18px",
|
|
5969
|
+
fontSize: "var(--iris-font-size-xl, 18px)",
|
|
5699
5970
|
fontWeight: 600,
|
|
5700
5971
|
...style
|
|
5701
5972
|
}
|
|
@@ -5704,11 +5975,11 @@ var IrisDialogTitle = React67.forwardRef(
|
|
|
5704
5975
|
);
|
|
5705
5976
|
}
|
|
5706
5977
|
);
|
|
5707
|
-
var IrisDialogDescription =
|
|
5978
|
+
var IrisDialogDescription = React70.forwardRef(
|
|
5708
5979
|
function IrisDialogDescription2({ as = "p", style, children, ...rest }, ref) {
|
|
5709
5980
|
const ctx = useDialogContext("IrisDialogDescription");
|
|
5710
|
-
|
|
5711
|
-
return
|
|
5981
|
+
React70.useEffect(() => ctx.registerDescription(), [ctx.registerDescription]);
|
|
5982
|
+
return React70.createElement(
|
|
5712
5983
|
as,
|
|
5713
5984
|
{
|
|
5714
5985
|
...rest,
|
|
@@ -5717,7 +5988,7 @@ var IrisDialogDescription = React67.forwardRef(
|
|
|
5717
5988
|
style: {
|
|
5718
5989
|
margin: "0 0 var(--iris-gap-lg, 16px) 0",
|
|
5719
5990
|
color: "var(--iris-muted)",
|
|
5720
|
-
fontSize: "14px",
|
|
5991
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
5721
5992
|
...style
|
|
5722
5993
|
}
|
|
5723
5994
|
},
|
|
@@ -5725,7 +5996,7 @@ var IrisDialogDescription = React67.forwardRef(
|
|
|
5725
5996
|
);
|
|
5726
5997
|
}
|
|
5727
5998
|
);
|
|
5728
|
-
var IrisDialogClose =
|
|
5999
|
+
var IrisDialogClose = React70.forwardRef(
|
|
5729
6000
|
function IrisDialogClose2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5730
6001
|
const ctx = useDialogContext("IrisDialogClose");
|
|
5731
6002
|
const handleClick = composeEventHandlers(
|
|
@@ -5733,7 +6004,7 @@ var IrisDialogClose = React67.forwardRef(
|
|
|
5733
6004
|
() => ctx.setOpen(false)
|
|
5734
6005
|
);
|
|
5735
6006
|
if (asChild) {
|
|
5736
|
-
if (!
|
|
6007
|
+
if (!React70.isValidElement(children)) {
|
|
5737
6008
|
if (process.env.NODE_ENV !== "production") {
|
|
5738
6009
|
console.warn("[iris-ui] IrisDialogClose asChild requires a single React element");
|
|
5739
6010
|
}
|
|
@@ -5753,9 +6024,9 @@ var IrisDialogClose = React67.forwardRef(
|
|
|
5753
6024
|
);
|
|
5754
6025
|
}
|
|
5755
6026
|
);
|
|
5756
|
-
var DrawerContext =
|
|
6027
|
+
var DrawerContext = React70.createContext(null);
|
|
5757
6028
|
function useDrawerContext(componentName) {
|
|
5758
|
-
const ctx =
|
|
6029
|
+
const ctx = React70.useContext(DrawerContext);
|
|
5759
6030
|
if (!ctx) {
|
|
5760
6031
|
throw new Error(`[iris-ui] ${componentName} must be a descendant of <IrisDrawer>`);
|
|
5761
6032
|
}
|
|
@@ -5774,7 +6045,7 @@ function IrisDrawer({
|
|
|
5774
6045
|
const isControlled = openProp !== void 0;
|
|
5775
6046
|
const [state, send] = useMachine(() => createFloatingMachine(defaultOpen ? "open" : "closed"));
|
|
5776
6047
|
const internalOpen = state.value === "open";
|
|
5777
|
-
|
|
6048
|
+
React70.useEffect(() => {
|
|
5778
6049
|
if (!isControlled) return;
|
|
5779
6050
|
const target = openProp ? "open" : "closed";
|
|
5780
6051
|
if (state.value !== target) {
|
|
@@ -5782,7 +6053,7 @@ function IrisDrawer({
|
|
|
5782
6053
|
}
|
|
5783
6054
|
}, [isControlled, openProp, state.value, send]);
|
|
5784
6055
|
const open = isControlled ? Boolean(openProp) : internalOpen;
|
|
5785
|
-
const setOpen =
|
|
6056
|
+
const setOpen = React70.useCallback(
|
|
5786
6057
|
(next) => {
|
|
5787
6058
|
if (!isControlled) {
|
|
5788
6059
|
send({ type: next ? "OPEN" : "CLOSE" });
|
|
@@ -5791,14 +6062,14 @@ function IrisDrawer({
|
|
|
5791
6062
|
},
|
|
5792
6063
|
[isControlled, send, onOpenChange]
|
|
5793
6064
|
);
|
|
5794
|
-
const triggerRef =
|
|
5795
|
-
const contentRef =
|
|
5796
|
-
const id =
|
|
6065
|
+
const triggerRef = React70.useRef(null);
|
|
6066
|
+
const contentRef = React70.useRef(null);
|
|
6067
|
+
const id = React70.useId();
|
|
5797
6068
|
const contentId = `${id}-content`;
|
|
5798
6069
|
const titleId = `${id}-title`;
|
|
5799
|
-
const titleCountRef =
|
|
5800
|
-
const [hasTitle, setHasTitle] =
|
|
5801
|
-
const registerTitle =
|
|
6070
|
+
const titleCountRef = React70.useRef(0);
|
|
6071
|
+
const [hasTitle, setHasTitle] = React70.useState(false);
|
|
6072
|
+
const registerTitle = React70.useCallback(() => {
|
|
5802
6073
|
titleCountRef.current += 1;
|
|
5803
6074
|
setHasTitle(true);
|
|
5804
6075
|
return () => {
|
|
@@ -5806,7 +6077,7 @@ function IrisDrawer({
|
|
|
5806
6077
|
if (titleCountRef.current <= 0) setHasTitle(false);
|
|
5807
6078
|
};
|
|
5808
6079
|
}, []);
|
|
5809
|
-
const value =
|
|
6080
|
+
const value = React70.useMemo(
|
|
5810
6081
|
() => ({
|
|
5811
6082
|
open,
|
|
5812
6083
|
setOpen,
|
|
@@ -5836,10 +6107,10 @@ function IrisDrawer({
|
|
|
5836
6107
|
);
|
|
5837
6108
|
return /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children });
|
|
5838
6109
|
}
|
|
5839
|
-
var IrisDrawerTrigger =
|
|
6110
|
+
var IrisDrawerTrigger = React70.forwardRef(
|
|
5840
6111
|
function IrisDrawerTrigger2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
5841
6112
|
const ctx = useDrawerContext("IrisDrawerTrigger");
|
|
5842
|
-
const captureRef =
|
|
6113
|
+
const captureRef = React70.useCallback(
|
|
5843
6114
|
(el) => {
|
|
5844
6115
|
ctx.triggerRef.current = el;
|
|
5845
6116
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -5860,7 +6131,7 @@ var IrisDrawerTrigger = React67.forwardRef(
|
|
|
5860
6131
|
onClick: handleClick
|
|
5861
6132
|
};
|
|
5862
6133
|
if (asChild) {
|
|
5863
|
-
if (!
|
|
6134
|
+
if (!React70.isValidElement(children)) {
|
|
5864
6135
|
if (process.env.NODE_ENV !== "production") {
|
|
5865
6136
|
console.warn("[iris-ui] IrisDrawerTrigger asChild requires a single React element");
|
|
5866
6137
|
}
|
|
@@ -5943,11 +6214,11 @@ function panelPositionStyle(side, size) {
|
|
|
5943
6214
|
}
|
|
5944
6215
|
}
|
|
5945
6216
|
var EXIT_DURATION_MS = 220;
|
|
5946
|
-
var IrisDrawerContent =
|
|
6217
|
+
var IrisDrawerContent = React70.forwardRef(
|
|
5947
6218
|
function IrisDrawerContent2({ portalTarget, style, children, ...rest }, forwardedRef) {
|
|
5948
6219
|
const ctx = useDrawerContext("IrisDrawerContent");
|
|
5949
|
-
const innerRef =
|
|
5950
|
-
const captureRef =
|
|
6220
|
+
const innerRef = React70.useRef(null);
|
|
6221
|
+
const captureRef = React70.useCallback(
|
|
5951
6222
|
(el) => {
|
|
5952
6223
|
innerRef.current = el;
|
|
5953
6224
|
ctx.contentRef.current = el;
|
|
@@ -5957,9 +6228,9 @@ var IrisDrawerContent = React67.forwardRef(
|
|
|
5957
6228
|
},
|
|
5958
6229
|
[ctx, forwardedRef]
|
|
5959
6230
|
);
|
|
5960
|
-
const [mounted, setMounted] =
|
|
5961
|
-
const [visible, setVisible] =
|
|
5962
|
-
|
|
6231
|
+
const [mounted, setMounted] = React70.useState(ctx.open);
|
|
6232
|
+
const [visible, setVisible] = React70.useState(ctx.open);
|
|
6233
|
+
React70.useEffect(() => {
|
|
5963
6234
|
if (ctx.open) {
|
|
5964
6235
|
setMounted(true);
|
|
5965
6236
|
const raf = requestAnimationFrame(() => setVisible(true));
|
|
@@ -5976,7 +6247,7 @@ var IrisDrawerContent = React67.forwardRef(
|
|
|
5976
6247
|
active: ctx.open,
|
|
5977
6248
|
returnFocusTo: ctx.triggerRef
|
|
5978
6249
|
});
|
|
5979
|
-
|
|
6250
|
+
React70.useEffect(() => {
|
|
5980
6251
|
if (!ctx.open || !ctx.closeOnEscape) return;
|
|
5981
6252
|
const onKeyDown = (e) => {
|
|
5982
6253
|
if (e.key === "Escape") {
|
|
@@ -6042,10 +6313,10 @@ var IrisDrawerContent = React67.forwardRef(
|
|
|
6042
6313
|
return createPortal(node, portalTarget ?? document.body);
|
|
6043
6314
|
}
|
|
6044
6315
|
);
|
|
6045
|
-
var IrisDrawerTitle =
|
|
6316
|
+
var IrisDrawerTitle = React70.forwardRef(
|
|
6046
6317
|
function IrisDrawerTitle2({ style, children, ...rest }, ref) {
|
|
6047
6318
|
const ctx = useDrawerContext("IrisDrawerTitle");
|
|
6048
|
-
|
|
6319
|
+
React70.useEffect(() => ctx.registerTitle(), [ctx.registerTitle]);
|
|
6049
6320
|
return /* @__PURE__ */ jsx(
|
|
6050
6321
|
"h2",
|
|
6051
6322
|
{
|
|
@@ -6066,7 +6337,7 @@ var IrisDrawerTitle = React67.forwardRef(
|
|
|
6066
6337
|
);
|
|
6067
6338
|
}
|
|
6068
6339
|
);
|
|
6069
|
-
var IrisDrawerClose =
|
|
6340
|
+
var IrisDrawerClose = React70.forwardRef(
|
|
6070
6341
|
function IrisDrawerClose2({ asChild = false, onClick, children, ...rest }, forwardedRef) {
|
|
6071
6342
|
const ctx = useDrawerContext("IrisDrawerClose");
|
|
6072
6343
|
const handleClick = composeEventHandlers(
|
|
@@ -6074,7 +6345,7 @@ var IrisDrawerClose = React67.forwardRef(
|
|
|
6074
6345
|
() => ctx.setOpen(false)
|
|
6075
6346
|
);
|
|
6076
6347
|
if (asChild) {
|
|
6077
|
-
if (!
|
|
6348
|
+
if (!React70.isValidElement(children)) {
|
|
6078
6349
|
if (process.env.NODE_ENV !== "production") {
|
|
6079
6350
|
console.warn("[iris-ui] IrisDrawerClose asChild requires a single React element");
|
|
6080
6351
|
}
|
|
@@ -6154,19 +6425,19 @@ var VARIANT_BORDER = {
|
|
|
6154
6425
|
success: "var(--iris-success)",
|
|
6155
6426
|
danger: "var(--iris-danger)",
|
|
6156
6427
|
warning: "var(--iris-warning)",
|
|
6157
|
-
info: "var(--iris-
|
|
6428
|
+
info: "var(--iris-info)"
|
|
6158
6429
|
};
|
|
6159
6430
|
var VARIANT_ACCENT = {
|
|
6160
6431
|
default: "var(--iris-muted)",
|
|
6161
6432
|
success: "var(--iris-success)",
|
|
6162
6433
|
danger: "var(--iris-danger)",
|
|
6163
6434
|
warning: "var(--iris-warning)",
|
|
6164
|
-
info: "var(--iris-
|
|
6435
|
+
info: "var(--iris-info)"
|
|
6165
6436
|
};
|
|
6166
6437
|
function positionStyle(position) {
|
|
6167
6438
|
const base = {
|
|
6168
6439
|
position: "fixed",
|
|
6169
|
-
zIndex: 1400,
|
|
6440
|
+
zIndex: "var(--iris-z-toast, 1400)",
|
|
6170
6441
|
display: "flex",
|
|
6171
6442
|
flexDirection: "column",
|
|
6172
6443
|
gap: "var(--iris-gap-md, 12px)",
|
|
@@ -6205,25 +6476,26 @@ function IrisToastViewport({
|
|
|
6205
6476
|
style,
|
|
6206
6477
|
...rest
|
|
6207
6478
|
}) {
|
|
6479
|
+
installFloatingAnimations();
|
|
6208
6480
|
const { t } = useI18n();
|
|
6209
|
-
const allToasts =
|
|
6210
|
-
const toasts =
|
|
6481
|
+
const allToasts = React70.useSyncExternalStore(subscribeToasts, getToasts, () => []);
|
|
6482
|
+
const toasts = React70.useMemo(
|
|
6211
6483
|
() => allToasts.length > max ? allToasts.slice(-max) : allToasts,
|
|
6212
6484
|
[allToasts, max]
|
|
6213
6485
|
);
|
|
6214
|
-
const [hovered, setHovered] =
|
|
6215
|
-
const dismissersRef =
|
|
6486
|
+
const [hovered, setHovered] = React70.useState(false);
|
|
6487
|
+
const dismissersRef = React70.useRef(/* @__PURE__ */ new Map());
|
|
6216
6488
|
const SWIPE_DISMISS_PX = 80;
|
|
6217
|
-
const [drag, setDrag] =
|
|
6218
|
-
const dragRef =
|
|
6219
|
-
const cancelDismisser =
|
|
6489
|
+
const [drag, setDrag] = React70.useState(null);
|
|
6490
|
+
const dragRef = React70.useRef(null);
|
|
6491
|
+
const cancelDismisser = React70.useCallback((id) => {
|
|
6220
6492
|
const d = dismissersRef.current.get(id);
|
|
6221
6493
|
if (d) {
|
|
6222
6494
|
d.cancel();
|
|
6223
6495
|
dismissersRef.current.delete(id);
|
|
6224
6496
|
}
|
|
6225
6497
|
}, []);
|
|
6226
|
-
const armDismisser =
|
|
6498
|
+
const armDismisser = React70.useCallback((toast) => {
|
|
6227
6499
|
if (!toast.duration || toast.duration === Infinity) return;
|
|
6228
6500
|
const remaining = Math.max(0, toast.createdAt + toast.duration - Date.now());
|
|
6229
6501
|
const dismisser = createAutoDismiss({
|
|
@@ -6236,7 +6508,7 @@ function IrisToastViewport({
|
|
|
6236
6508
|
dismissersRef.current.set(toast.id, dismisser);
|
|
6237
6509
|
dismisser.start();
|
|
6238
6510
|
}, []);
|
|
6239
|
-
|
|
6511
|
+
React70.useEffect(() => {
|
|
6240
6512
|
const liveIds = new Set(toasts.map((t2) => t2.id));
|
|
6241
6513
|
for (const id of Array.from(dismissersRef.current.keys())) {
|
|
6242
6514
|
if (!liveIds.has(id)) cancelDismisser(id);
|
|
@@ -6248,14 +6520,14 @@ function IrisToastViewport({
|
|
|
6248
6520
|
}
|
|
6249
6521
|
}
|
|
6250
6522
|
}, [toasts, hovered, armDismisser, cancelDismisser]);
|
|
6251
|
-
|
|
6523
|
+
React70.useEffect(() => {
|
|
6252
6524
|
if (hovered) {
|
|
6253
6525
|
for (const d of dismissersRef.current.values()) d.pause();
|
|
6254
6526
|
} else {
|
|
6255
6527
|
for (const d of dismissersRef.current.values()) d.resume();
|
|
6256
6528
|
}
|
|
6257
6529
|
}, [hovered]);
|
|
6258
|
-
|
|
6530
|
+
React70.useEffect(() => {
|
|
6259
6531
|
const dismissers = dismissersRef.current;
|
|
6260
6532
|
return () => {
|
|
6261
6533
|
for (const d of dismissers.values()) d.cancel();
|
|
@@ -6314,15 +6586,16 @@ function IrisToastViewport({
|
|
|
6314
6586
|
display: "flex",
|
|
6315
6587
|
alignItems: "flex-start",
|
|
6316
6588
|
gap: "var(--iris-gap-md, 12px)",
|
|
6317
|
-
background: "var(--iris-surface)",
|
|
6589
|
+
background: "var(--iris-surface-floating)",
|
|
6590
|
+
animation: ANIM_TOAST,
|
|
6318
6591
|
color: "var(--iris-foreground)",
|
|
6319
6592
|
border: `1px solid ${VARIANT_BORDER[toast.variant]}`,
|
|
6320
6593
|
borderInlineStart: `4px solid ${VARIANT_ACCENT[toast.variant]}`,
|
|
6321
6594
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
6322
6595
|
padding: "var(--iris-padding-md, 12px)",
|
|
6323
|
-
boxShadow: "
|
|
6596
|
+
boxShadow: "var(--iris-shadow-lg)",
|
|
6324
6597
|
minWidth: 280,
|
|
6325
|
-
fontSize:
|
|
6598
|
+
fontSize: "var(--iris-font-size-md, 14px)"
|
|
6326
6599
|
},
|
|
6327
6600
|
children: [
|
|
6328
6601
|
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
@@ -6332,8 +6605,8 @@ function IrisToastViewport({
|
|
|
6332
6605
|
{
|
|
6333
6606
|
style: {
|
|
6334
6607
|
color: "var(--iris-muted)",
|
|
6335
|
-
fontSize:
|
|
6336
|
-
marginTop:
|
|
6608
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
6609
|
+
marginTop: "var(--iris-space-xxs, 4px)"
|
|
6337
6610
|
},
|
|
6338
6611
|
children: toast.description
|
|
6339
6612
|
}
|
|
@@ -6354,7 +6627,7 @@ function IrisToastViewport({
|
|
|
6354
6627
|
fontWeight: 600,
|
|
6355
6628
|
cursor: "pointer",
|
|
6356
6629
|
padding: "4px 8px",
|
|
6357
|
-
fontSize:
|
|
6630
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
6358
6631
|
fontFamily: "inherit"
|
|
6359
6632
|
},
|
|
6360
6633
|
children: toast.action.label
|
|
@@ -6374,7 +6647,7 @@ function IrisToastViewport({
|
|
|
6374
6647
|
color: "var(--iris-muted)",
|
|
6375
6648
|
lineHeight: 1,
|
|
6376
6649
|
fontFamily: "inherit",
|
|
6377
|
-
fontSize:
|
|
6650
|
+
fontSize: "var(--iris-font-size-lg, 16px)"
|
|
6378
6651
|
},
|
|
6379
6652
|
children: "\xD7"
|
|
6380
6653
|
}
|
|
@@ -6390,9 +6663,9 @@ function IrisToastViewport({
|
|
|
6390
6663
|
if (typeof document === "undefined") return null;
|
|
6391
6664
|
return createPortal(node, portalTarget ?? document.body);
|
|
6392
6665
|
}
|
|
6393
|
-
var TabsContext =
|
|
6666
|
+
var TabsContext = React70.createContext(null);
|
|
6394
6667
|
function useTabsContext(componentName) {
|
|
6395
|
-
const ctx =
|
|
6668
|
+
const ctx = React70.useContext(TabsContext);
|
|
6396
6669
|
if (!ctx) {
|
|
6397
6670
|
throw new Error(`[iris-ui] ${componentName} must be inside an <IrisTabs>`);
|
|
6398
6671
|
}
|
|
@@ -6408,24 +6681,24 @@ function IrisTabs({
|
|
|
6408
6681
|
children
|
|
6409
6682
|
}) {
|
|
6410
6683
|
const isControlled = valueProp !== void 0;
|
|
6411
|
-
const [internalValue, setInternalValue] =
|
|
6684
|
+
const [internalValue, setInternalValue] = React70.useState(defaultValue ?? null);
|
|
6412
6685
|
const effectiveValue = isControlled ? valueProp : internalValue;
|
|
6413
|
-
const setValue =
|
|
6686
|
+
const setValue = React70.useCallback(
|
|
6414
6687
|
(next) => {
|
|
6415
6688
|
if (!isControlled) setInternalValue(next);
|
|
6416
6689
|
onValueChange?.(next);
|
|
6417
6690
|
},
|
|
6418
6691
|
[isControlled, onValueChange]
|
|
6419
6692
|
);
|
|
6420
|
-
const triggersRef =
|
|
6421
|
-
const listRef =
|
|
6422
|
-
const focusTriggerByValue =
|
|
6693
|
+
const triggersRef = React70.useRef([]);
|
|
6694
|
+
const listRef = React70.useRef(null);
|
|
6695
|
+
const focusTriggerByValue = React70.useCallback((value2) => {
|
|
6423
6696
|
const root = listRef.current;
|
|
6424
6697
|
if (!root) return;
|
|
6425
6698
|
const el = root.querySelector(`[data-iris-tabs-trigger][data-value="${value2}"]`);
|
|
6426
6699
|
el?.focus();
|
|
6427
6700
|
}, []);
|
|
6428
|
-
const registerTrigger =
|
|
6701
|
+
const registerTrigger = React70.useCallback(
|
|
6429
6702
|
(value2, isDisabled) => {
|
|
6430
6703
|
if (triggersRef.current.some((t) => t.value === value2)) {
|
|
6431
6704
|
return () => {
|
|
@@ -6444,7 +6717,7 @@ function IrisTabs({
|
|
|
6444
6717
|
},
|
|
6445
6718
|
[isControlled]
|
|
6446
6719
|
);
|
|
6447
|
-
const moveFocus =
|
|
6720
|
+
const moveFocus = React70.useCallback(
|
|
6448
6721
|
(from, delta) => {
|
|
6449
6722
|
const enabled = triggersRef.current.filter((t) => !t.isDisabled());
|
|
6450
6723
|
if (enabled.length === 0) return;
|
|
@@ -6461,7 +6734,7 @@ function IrisTabs({
|
|
|
6461
6734
|
},
|
|
6462
6735
|
[setValue, focusTriggerByValue]
|
|
6463
6736
|
);
|
|
6464
|
-
const value =
|
|
6737
|
+
const value = React70.useMemo(
|
|
6465
6738
|
() => ({
|
|
6466
6739
|
value: effectiveValue,
|
|
6467
6740
|
setValue,
|
|
@@ -6476,10 +6749,10 @@ function IrisTabs({
|
|
|
6476
6749
|
);
|
|
6477
6750
|
return /* @__PURE__ */ jsx(TabsContext.Provider, { value, children });
|
|
6478
6751
|
}
|
|
6479
|
-
var IrisTabsList =
|
|
6752
|
+
var IrisTabsList = React70.forwardRef(
|
|
6480
6753
|
function IrisTabsList2({ style, children, ...rest }, forwardedRef) {
|
|
6481
6754
|
const ctx = useTabsContext("IrisTabsList");
|
|
6482
|
-
const captureRef =
|
|
6755
|
+
const captureRef = React70.useCallback(
|
|
6483
6756
|
(el) => {
|
|
6484
6757
|
ctx.listRef.current = el;
|
|
6485
6758
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -6500,7 +6773,7 @@ var IrisTabsList = React67.forwardRef(
|
|
|
6500
6773
|
style: {
|
|
6501
6774
|
display: "flex",
|
|
6502
6775
|
flexDirection: ctx.orientation === "horizontal" ? "row" : "column",
|
|
6503
|
-
gap:
|
|
6776
|
+
gap: "var(--iris-space-xxs, 4px)",
|
|
6504
6777
|
borderBottom: ctx.orientation === "horizontal" ? "1px solid var(--iris-border)" : "none",
|
|
6505
6778
|
borderInlineEnd: ctx.orientation === "vertical" ? "1px solid var(--iris-border)" : "none",
|
|
6506
6779
|
...style
|
|
@@ -6510,15 +6783,15 @@ var IrisTabsList = React67.forwardRef(
|
|
|
6510
6783
|
);
|
|
6511
6784
|
}
|
|
6512
6785
|
);
|
|
6513
|
-
var IrisTabsTrigger =
|
|
6786
|
+
var IrisTabsTrigger = React70.forwardRef(
|
|
6514
6787
|
function IrisTabsTrigger2({ value, asChild = false, disabled, onClick, onKeyDown, style, children, ...rest }, forwardedRef) {
|
|
6515
6788
|
const ctx = useTabsContext("IrisTabsTrigger");
|
|
6516
6789
|
const isDisabled = Boolean(disabled) || ctx.disabled;
|
|
6517
6790
|
const isActive = ctx.value === value;
|
|
6518
|
-
const isDisabledRef =
|
|
6791
|
+
const isDisabledRef = React70.useRef(isDisabled);
|
|
6519
6792
|
isDisabledRef.current = isDisabled;
|
|
6520
6793
|
const register = ctx.registerTrigger;
|
|
6521
|
-
|
|
6794
|
+
React70.useEffect(() => {
|
|
6522
6795
|
return register(value, () => isDisabledRef.current);
|
|
6523
6796
|
}, [register, value]);
|
|
6524
6797
|
const handleClick = composeEventHandlers(
|
|
@@ -6567,7 +6840,7 @@ var IrisTabsTrigger = React67.forwardRef(
|
|
|
6567
6840
|
onKeyDown: handleKeyDown
|
|
6568
6841
|
};
|
|
6569
6842
|
if (asChild) {
|
|
6570
|
-
if (!
|
|
6843
|
+
if (!React70.isValidElement(children)) {
|
|
6571
6844
|
if (process.env.NODE_ENV !== "production") {
|
|
6572
6845
|
console.warn("[iris-ui] IrisTabsTrigger asChild requires a single React element");
|
|
6573
6846
|
}
|
|
@@ -6586,13 +6859,12 @@ var IrisTabsTrigger = React67.forwardRef(
|
|
|
6586
6859
|
disabled: isDisabled ? true : void 0,
|
|
6587
6860
|
style: {
|
|
6588
6861
|
padding: "8px var(--iris-padding-md, 12px)",
|
|
6589
|
-
fontSize:
|
|
6862
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
6590
6863
|
fontWeight: 500,
|
|
6591
6864
|
fontFamily: "inherit",
|
|
6592
6865
|
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
6593
6866
|
opacity: isDisabled ? 0.5 : 1,
|
|
6594
6867
|
border: "none",
|
|
6595
|
-
outline: "none",
|
|
6596
6868
|
background: "transparent",
|
|
6597
6869
|
color: isActive ? "var(--iris-primary)" : "var(--iris-muted)",
|
|
6598
6870
|
marginBottom: horizontal ? -1 : void 0,
|
|
@@ -6607,7 +6879,7 @@ var IrisTabsTrigger = React67.forwardRef(
|
|
|
6607
6879
|
);
|
|
6608
6880
|
}
|
|
6609
6881
|
);
|
|
6610
|
-
var IrisTabsContent =
|
|
6882
|
+
var IrisTabsContent = React70.forwardRef(
|
|
6611
6883
|
function IrisTabsContent2({ value, forceMount = false, style, children, ...rest }, ref) {
|
|
6612
6884
|
const ctx = useTabsContext("IrisTabsContent");
|
|
6613
6885
|
const isActive = ctx.value === value;
|
|
@@ -6626,7 +6898,6 @@ var IrisTabsContent = React67.forwardRef(
|
|
|
6626
6898
|
tabIndex: 0,
|
|
6627
6899
|
style: {
|
|
6628
6900
|
padding: "var(--iris-padding-md, 12px) 0",
|
|
6629
|
-
outline: "none",
|
|
6630
6901
|
...style
|
|
6631
6902
|
},
|
|
6632
6903
|
children
|
|
@@ -6634,9 +6905,9 @@ var IrisTabsContent = React67.forwardRef(
|
|
|
6634
6905
|
);
|
|
6635
6906
|
}
|
|
6636
6907
|
);
|
|
6637
|
-
var AccordionContext =
|
|
6908
|
+
var AccordionContext = React70.createContext(null);
|
|
6638
6909
|
function useAccordionContext(componentName) {
|
|
6639
|
-
const ctx =
|
|
6910
|
+
const ctx = React70.useContext(AccordionContext);
|
|
6640
6911
|
if (!ctx) {
|
|
6641
6912
|
throw new Error(`[iris-ui] ${componentName} must be inside an <IrisAccordion>`);
|
|
6642
6913
|
}
|
|
@@ -6653,9 +6924,9 @@ function IrisAccordion({
|
|
|
6653
6924
|
}) {
|
|
6654
6925
|
const isControlled = valueProp !== void 0;
|
|
6655
6926
|
const initial = defaultValue !== void 0 ? defaultValue : multiple ? [] : null;
|
|
6656
|
-
const [internal, setInternal] =
|
|
6927
|
+
const [internal, setInternal] = React70.useState(initial);
|
|
6657
6928
|
const current = isControlled ? valueProp : internal;
|
|
6658
|
-
const isOpen =
|
|
6929
|
+
const isOpen = React70.useCallback(
|
|
6659
6930
|
(v) => {
|
|
6660
6931
|
const c = current;
|
|
6661
6932
|
if (c === null || c === void 0) return false;
|
|
@@ -6664,9 +6935,9 @@ function IrisAccordion({
|
|
|
6664
6935
|
},
|
|
6665
6936
|
[current]
|
|
6666
6937
|
);
|
|
6667
|
-
const controlledRef =
|
|
6938
|
+
const controlledRef = React70.useRef(valueProp);
|
|
6668
6939
|
controlledRef.current = valueProp;
|
|
6669
|
-
const toggle =
|
|
6940
|
+
const toggle = React70.useCallback(
|
|
6670
6941
|
(v) => {
|
|
6671
6942
|
const compute = (prev) => {
|
|
6672
6943
|
if (multiple) {
|
|
@@ -6690,9 +6961,9 @@ function IrisAccordion({
|
|
|
6690
6961
|
},
|
|
6691
6962
|
[multiple, collapsible, isControlled, onValueChange]
|
|
6692
6963
|
);
|
|
6693
|
-
const rootId =
|
|
6694
|
-
const itemsRef =
|
|
6695
|
-
const navRef =
|
|
6964
|
+
const rootId = React70.useId();
|
|
6965
|
+
const itemsRef = React70.useRef([]);
|
|
6966
|
+
const navRef = React70.useRef(null);
|
|
6696
6967
|
if (navRef.current === null) {
|
|
6697
6968
|
navRef.current = createKeyboardNav({
|
|
6698
6969
|
count: itemsRef.current.length,
|
|
@@ -6701,11 +6972,11 @@ function IrisAccordion({
|
|
|
6701
6972
|
});
|
|
6702
6973
|
}
|
|
6703
6974
|
const nav = navRef.current;
|
|
6704
|
-
|
|
6975
|
+
React70.useEffect(() => {
|
|
6705
6976
|
nav.reset(itemsRef.current.length);
|
|
6706
6977
|
});
|
|
6707
6978
|
const activeIndex = useStore(nav.store);
|
|
6708
|
-
const registerItem =
|
|
6979
|
+
const registerItem = React70.useCallback(
|
|
6709
6980
|
(value, el) => {
|
|
6710
6981
|
if (!itemsRef.current.find((it) => it.value === value)) {
|
|
6711
6982
|
itemsRef.current = [...itemsRef.current, { value, el }];
|
|
@@ -6716,7 +6987,7 @@ function IrisAccordion({
|
|
|
6716
6987
|
},
|
|
6717
6988
|
[]
|
|
6718
6989
|
);
|
|
6719
|
-
const focusItem =
|
|
6990
|
+
const focusItem = React70.useCallback(
|
|
6720
6991
|
(value) => {
|
|
6721
6992
|
const idx = itemsRef.current.findIndex((it) => it.value === value);
|
|
6722
6993
|
if (idx >= 0) nav.focus(idx);
|
|
@@ -6733,7 +7004,7 @@ function IrisAccordion({
|
|
|
6733
7004
|
items[action.target]?.el.current?.focus();
|
|
6734
7005
|
}
|
|
6735
7006
|
};
|
|
6736
|
-
const ctx =
|
|
7007
|
+
const ctx = React70.useMemo(
|
|
6737
7008
|
() => ({ isOpen, toggle, rootId, collapsible, multiple, activeIndex, registerItem, focusItem }),
|
|
6738
7009
|
[isOpen, toggle, rootId, collapsible, multiple, activeIndex, registerItem, focusItem]
|
|
6739
7010
|
);
|
|
@@ -6748,14 +7019,14 @@ function IrisAccordion({
|
|
|
6748
7019
|
}
|
|
6749
7020
|
) });
|
|
6750
7021
|
}
|
|
6751
|
-
var IrisAccordionItem =
|
|
7022
|
+
var IrisAccordionItem = React70.forwardRef(
|
|
6752
7023
|
function IrisAccordionItem2({ value, title, disabled = false, style, children, ...rest }, ref) {
|
|
6753
7024
|
const ctx = useAccordionContext("IrisAccordionItem");
|
|
6754
7025
|
const open = ctx.isOpen(value);
|
|
6755
7026
|
const headerId = `${ctx.rootId}-h-${value}`;
|
|
6756
7027
|
const contentId = `${ctx.rootId}-c-${value}`;
|
|
6757
|
-
const triggerRef =
|
|
6758
|
-
|
|
7028
|
+
const triggerRef = React70.useRef(null);
|
|
7029
|
+
React70.useEffect(() => {
|
|
6759
7030
|
return ctx.registerItem(value, triggerRef);
|
|
6760
7031
|
}, [ctx.registerItem, value]);
|
|
6761
7032
|
const onTrigger = () => {
|
|
@@ -6847,9 +7118,9 @@ var IrisAccordionItem = React67.forwardRef(
|
|
|
6847
7118
|
);
|
|
6848
7119
|
}
|
|
6849
7120
|
);
|
|
6850
|
-
var StepperContext =
|
|
7121
|
+
var StepperContext = React70.createContext(null);
|
|
6851
7122
|
function useStepperContext(componentName) {
|
|
6852
|
-
const ctx =
|
|
7123
|
+
const ctx = React70.useContext(StepperContext);
|
|
6853
7124
|
if (!ctx) {
|
|
6854
7125
|
throw new Error(`[iris-ui] ${componentName} must be inside an <IrisStepper>`);
|
|
6855
7126
|
}
|
|
@@ -6866,19 +7137,19 @@ function IrisStepper({
|
|
|
6866
7137
|
...rest
|
|
6867
7138
|
}) {
|
|
6868
7139
|
const isControlled = valueProp !== void 0;
|
|
6869
|
-
const [internal, setInternal] =
|
|
6870
|
-
const [total, setTotal] =
|
|
7140
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
7141
|
+
const [total, setTotal] = React70.useState(0);
|
|
6871
7142
|
const rawValue = isControlled ? valueProp : internal;
|
|
6872
7143
|
const current = Math.max(0, Math.min(total - 1, rawValue));
|
|
6873
|
-
const setValue =
|
|
7144
|
+
const setValue = React70.useCallback(
|
|
6874
7145
|
(next) => {
|
|
6875
7146
|
if (!isControlled) setInternal(next);
|
|
6876
7147
|
onValueChange?.(next);
|
|
6877
7148
|
},
|
|
6878
7149
|
[isControlled, onValueChange]
|
|
6879
7150
|
);
|
|
6880
|
-
const nextIndexRef =
|
|
6881
|
-
const registerStep =
|
|
7151
|
+
const nextIndexRef = React70.useRef(0);
|
|
7152
|
+
const registerStep = React70.useCallback(() => {
|
|
6882
7153
|
const index = nextIndexRef.current;
|
|
6883
7154
|
nextIndexRef.current += 1;
|
|
6884
7155
|
setTotal((t) => Math.max(t, index + 1));
|
|
@@ -6888,7 +7159,7 @@ function IrisStepper({
|
|
|
6888
7159
|
}
|
|
6889
7160
|
};
|
|
6890
7161
|
}, []);
|
|
6891
|
-
const goTo =
|
|
7162
|
+
const goTo = React70.useCallback(
|
|
6892
7163
|
(index) => {
|
|
6893
7164
|
if (index < 0 || index >= total) return;
|
|
6894
7165
|
if (linear && index > current) return;
|
|
@@ -6897,7 +7168,7 @@ function IrisStepper({
|
|
|
6897
7168
|
},
|
|
6898
7169
|
[total, linear, current, setValue]
|
|
6899
7170
|
);
|
|
6900
|
-
const computeStatus =
|
|
7171
|
+
const computeStatus = React70.useCallback(
|
|
6901
7172
|
(index) => {
|
|
6902
7173
|
if (index < current) return "completed";
|
|
6903
7174
|
if (index === current) return "active";
|
|
@@ -6905,7 +7176,7 @@ function IrisStepper({
|
|
|
6905
7176
|
},
|
|
6906
7177
|
[current]
|
|
6907
7178
|
);
|
|
6908
|
-
const ctx =
|
|
7179
|
+
const ctx = React70.useMemo(
|
|
6909
7180
|
() => ({
|
|
6910
7181
|
current,
|
|
6911
7182
|
total,
|
|
@@ -6943,12 +7214,12 @@ var STATUS_COLOR = {
|
|
|
6943
7214
|
completed: "var(--iris-success)",
|
|
6944
7215
|
error: "var(--iris-danger)"
|
|
6945
7216
|
};
|
|
6946
|
-
var IrisStepperStep =
|
|
7217
|
+
var IrisStepperStep = React70.forwardRef(
|
|
6947
7218
|
function IrisStepperStep2({ title, description, status, disabled = false, style, ...rest }, ref) {
|
|
6948
7219
|
const ctx = useStepperContext("IrisStepperStep");
|
|
6949
|
-
const [index, setIndex] =
|
|
7220
|
+
const [index, setIndex] = React70.useState(-1);
|
|
6950
7221
|
const register = ctx.registerStep;
|
|
6951
|
-
|
|
7222
|
+
React70.useEffect(() => {
|
|
6952
7223
|
const { index: i, unregister } = register();
|
|
6953
7224
|
setIndex(i);
|
|
6954
7225
|
return unregister;
|
|
@@ -6980,7 +7251,7 @@ var IrisStepperStep = React67.forwardRef(
|
|
|
6980
7251
|
background: s === "completed" ? color : "var(--iris-background)",
|
|
6981
7252
|
color: s === "completed" ? "var(--iris-primary-foreground, #fff)" : color,
|
|
6982
7253
|
border: `2px solid ${color}`,
|
|
6983
|
-
fontSize:
|
|
7254
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
6984
7255
|
fontWeight: 600,
|
|
6985
7256
|
lineHeight: 1,
|
|
6986
7257
|
transition: "background-color 120ms ease, color 120ms ease, border-color 120ms ease"
|
|
@@ -6993,14 +7264,21 @@ var IrisStepperStep = React67.forwardRef(
|
|
|
6993
7264
|
{
|
|
6994
7265
|
"data-iris-stepper-title": "",
|
|
6995
7266
|
style: {
|
|
6996
|
-
fontSize:
|
|
7267
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
6997
7268
|
fontWeight: s === "active" ? 600 : 500,
|
|
6998
7269
|
color: s === "pending" ? "var(--iris-muted)" : "var(--iris-foreground)"
|
|
6999
7270
|
},
|
|
7000
7271
|
children: title
|
|
7001
7272
|
}
|
|
7002
7273
|
) : null;
|
|
7003
|
-
const descNode = description ? /* @__PURE__ */ jsx(
|
|
7274
|
+
const descNode = description ? /* @__PURE__ */ jsx(
|
|
7275
|
+
"div",
|
|
7276
|
+
{
|
|
7277
|
+
"data-iris-stepper-description": "",
|
|
7278
|
+
style: { fontSize: "var(--iris-font-size-xs, 12px)", color: "var(--iris-muted)" },
|
|
7279
|
+
children: description
|
|
7280
|
+
}
|
|
7281
|
+
) : null;
|
|
7004
7282
|
const connector = !isLast ? /* @__PURE__ */ jsx(
|
|
7005
7283
|
"span",
|
|
7006
7284
|
{
|
|
@@ -7016,7 +7294,7 @@ var IrisStepperStep = React67.forwardRef(
|
|
|
7016
7294
|
width: 1,
|
|
7017
7295
|
minHeight: 24,
|
|
7018
7296
|
background: index < ctx.current ? STATUS_COLOR.completed : "var(--iris-border)",
|
|
7019
|
-
marginInlineStart:
|
|
7297
|
+
marginInlineStart: "var(--iris-space-md, 16px)",
|
|
7020
7298
|
marginTop: 4,
|
|
7021
7299
|
marginBottom: 4
|
|
7022
7300
|
}
|
|
@@ -7079,9 +7357,9 @@ var IrisStepperStep = React67.forwardRef(
|
|
|
7079
7357
|
);
|
|
7080
7358
|
}
|
|
7081
7359
|
);
|
|
7082
|
-
var ToggleGroupContext =
|
|
7360
|
+
var ToggleGroupContext = React70.createContext(null);
|
|
7083
7361
|
function useToggleGroupContext(componentName) {
|
|
7084
|
-
const ctx =
|
|
7362
|
+
const ctx = React70.useContext(ToggleGroupContext);
|
|
7085
7363
|
if (!ctx) {
|
|
7086
7364
|
throw new Error(`[iris-ui] ${componentName} must be inside an <IrisToggleGroup>`);
|
|
7087
7365
|
}
|
|
@@ -7105,7 +7383,7 @@ function IrisToggleGroup(props) {
|
|
|
7105
7383
|
const isControlled = valueProp !== void 0;
|
|
7106
7384
|
const toKeys = (v) => v == null ? [] : Array.isArray(v) ? v : [v];
|
|
7107
7385
|
const fromKeys = (keys) => isMultiple ? keys : keys[0] ?? null;
|
|
7108
|
-
const modelRef =
|
|
7386
|
+
const modelRef = React70.useRef(null);
|
|
7109
7387
|
if (modelRef.current === null) {
|
|
7110
7388
|
const initial = defaultValue !== void 0 ? defaultValue : isMultiple ? [] : null;
|
|
7111
7389
|
modelRef.current = createSelectionModel({
|
|
@@ -7116,15 +7394,15 @@ function IrisToggleGroup(props) {
|
|
|
7116
7394
|
}
|
|
7117
7395
|
const model = modelRef.current;
|
|
7118
7396
|
const selected = useStore(model.store);
|
|
7119
|
-
|
|
7397
|
+
React70.useEffect(() => {
|
|
7120
7398
|
if (isControlled) model.sync(toKeys(valueProp));
|
|
7121
7399
|
}, [valueProp, isControlled, model]);
|
|
7122
7400
|
const displaySelected = isControlled ? toKeys(valueProp) : selected;
|
|
7123
|
-
const isActive =
|
|
7401
|
+
const isActive = React70.useCallback(
|
|
7124
7402
|
(v) => displaySelected.includes(v),
|
|
7125
7403
|
[displaySelected]
|
|
7126
7404
|
);
|
|
7127
|
-
const toggle =
|
|
7405
|
+
const toggle = React70.useCallback(
|
|
7128
7406
|
(v) => {
|
|
7129
7407
|
if (disabled) return;
|
|
7130
7408
|
if (isControlled) model.sync(toKeys(valueProp));
|
|
@@ -7132,8 +7410,8 @@ function IrisToggleGroup(props) {
|
|
|
7132
7410
|
},
|
|
7133
7411
|
[disabled, model, isControlled, valueProp]
|
|
7134
7412
|
);
|
|
7135
|
-
const itemsRef =
|
|
7136
|
-
const navRef =
|
|
7413
|
+
const itemsRef = React70.useRef([]);
|
|
7414
|
+
const navRef = React70.useRef(null);
|
|
7137
7415
|
if (navRef.current === null) {
|
|
7138
7416
|
navRef.current = createKeyboardNav({
|
|
7139
7417
|
count: itemsRef.current.length,
|
|
@@ -7142,10 +7420,10 @@ function IrisToggleGroup(props) {
|
|
|
7142
7420
|
});
|
|
7143
7421
|
}
|
|
7144
7422
|
const nav = navRef.current;
|
|
7145
|
-
|
|
7423
|
+
React70.useEffect(() => {
|
|
7146
7424
|
nav.reset(itemsRef.current.length);
|
|
7147
7425
|
});
|
|
7148
|
-
const registerItem =
|
|
7426
|
+
const registerItem = React70.useCallback((value, el) => {
|
|
7149
7427
|
if (!itemsRef.current.find((it) => it.value === value)) {
|
|
7150
7428
|
itemsRef.current = [...itemsRef.current, { value, el }];
|
|
7151
7429
|
}
|
|
@@ -7153,7 +7431,7 @@ function IrisToggleGroup(props) {
|
|
|
7153
7431
|
itemsRef.current = itemsRef.current.filter((it) => it.value !== value);
|
|
7154
7432
|
};
|
|
7155
7433
|
}, []);
|
|
7156
|
-
const moveFocus =
|
|
7434
|
+
const moveFocus = React70.useCallback((from, delta) => {
|
|
7157
7435
|
const items = itemsRef.current;
|
|
7158
7436
|
if (items.length === 0) return;
|
|
7159
7437
|
const idx = items.findIndex((it) => it.value === from);
|
|
@@ -7163,7 +7441,7 @@ function IrisToggleGroup(props) {
|
|
|
7163
7441
|
else nextIdx = (idx + delta + items.length) % items.length;
|
|
7164
7442
|
items[nextIdx]?.el.current?.focus();
|
|
7165
7443
|
}, []);
|
|
7166
|
-
const focusItem =
|
|
7444
|
+
const focusItem = React70.useCallback(
|
|
7167
7445
|
(value) => {
|
|
7168
7446
|
const idx = itemsRef.current.findIndex((it) => it.value === value);
|
|
7169
7447
|
if (idx >= 0) nav.focus(idx);
|
|
@@ -7186,7 +7464,7 @@ function IrisToggleGroup(props) {
|
|
|
7186
7464
|
}
|
|
7187
7465
|
}
|
|
7188
7466
|
};
|
|
7189
|
-
const ctx =
|
|
7467
|
+
const ctx = React70.useMemo(
|
|
7190
7468
|
() => ({
|
|
7191
7469
|
type,
|
|
7192
7470
|
orientation,
|
|
@@ -7247,11 +7525,11 @@ var SIZE_FONT = {
|
|
|
7247
7525
|
md: "13px",
|
|
7248
7526
|
lg: "14px"
|
|
7249
7527
|
};
|
|
7250
|
-
var IrisToggleGroupItem =
|
|
7528
|
+
var IrisToggleGroupItem = React70.forwardRef(
|
|
7251
7529
|
function IrisToggleGroupItem2({ value, disabled, onClick, onKeyDown, onFocus, style, children, ...rest }, forwardedRef) {
|
|
7252
7530
|
const ctx = useToggleGroupContext("IrisToggleGroupItem");
|
|
7253
|
-
const elRef =
|
|
7254
|
-
const captureRef =
|
|
7531
|
+
const elRef = React70.useRef(null);
|
|
7532
|
+
const captureRef = React70.useCallback(
|
|
7255
7533
|
(el) => {
|
|
7256
7534
|
elRef.current = el;
|
|
7257
7535
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -7261,7 +7539,7 @@ var IrisToggleGroupItem = React67.forwardRef(
|
|
|
7261
7539
|
[forwardedRef]
|
|
7262
7540
|
);
|
|
7263
7541
|
const register = ctx.registerItem;
|
|
7264
|
-
|
|
7542
|
+
React70.useEffect(() => {
|
|
7265
7543
|
return register(value, elRef);
|
|
7266
7544
|
}, [register, value]);
|
|
7267
7545
|
const active = ctx.isActive(value);
|
|
@@ -7300,7 +7578,7 @@ var IrisToggleGroupItem = React67.forwardRef(
|
|
|
7300
7578
|
display: "inline-flex",
|
|
7301
7579
|
alignItems: "center",
|
|
7302
7580
|
justifyContent: "center",
|
|
7303
|
-
gap:
|
|
7581
|
+
gap: "var(--iris-space-xs, 8px)",
|
|
7304
7582
|
padding: SIZE_PADDING[ctx.size],
|
|
7305
7583
|
fontSize: SIZE_FONT[ctx.size],
|
|
7306
7584
|
fontFamily: "inherit",
|
|
@@ -7334,7 +7612,7 @@ function IrisPagination({
|
|
|
7334
7612
|
}) {
|
|
7335
7613
|
const { t } = useI18n();
|
|
7336
7614
|
const isControlled = valueProp !== void 0;
|
|
7337
|
-
const [internal, setInternal] =
|
|
7615
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
7338
7616
|
const totalPages = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
7339
7617
|
const raw = isControlled ? valueProp : internal;
|
|
7340
7618
|
const current = Math.min(totalPages, Math.max(1, raw));
|
|
@@ -7472,15 +7750,15 @@ function IrisDragger({
|
|
|
7472
7750
|
...rest
|
|
7473
7751
|
}) {
|
|
7474
7752
|
const isControlled = valueProp !== void 0;
|
|
7475
|
-
const [internal, setInternal] =
|
|
7753
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
7476
7754
|
const position = isControlled ? valueProp : internal;
|
|
7477
|
-
const positionRef =
|
|
7755
|
+
const positionRef = React70.useRef(position);
|
|
7478
7756
|
positionRef.current = position;
|
|
7479
|
-
const rootRef =
|
|
7480
|
-
const handleRef =
|
|
7757
|
+
const rootRef = React70.useRef(null);
|
|
7758
|
+
const handleRef = React70.useRef(null);
|
|
7481
7759
|
const dragHandleRef = handle ? handleRef : rootRef;
|
|
7482
|
-
const [dragging, setDragging] =
|
|
7483
|
-
const startPosRef =
|
|
7760
|
+
const [dragging, setDragging] = React70.useState(false);
|
|
7761
|
+
const startPosRef = React70.useRef({ x: 0, y: 0 });
|
|
7484
7762
|
const clamp6 = (p) => ({
|
|
7485
7763
|
x: Math.max(bounds.minX ?? -Infinity, Math.min(bounds.maxX ?? Infinity, p.x)),
|
|
7486
7764
|
y: Math.max(bounds.minY ?? -Infinity, Math.min(bounds.maxY ?? Infinity, p.y))
|
|
@@ -7554,16 +7832,16 @@ function IrisSplitter({
|
|
|
7554
7832
|
...rest
|
|
7555
7833
|
}) {
|
|
7556
7834
|
const isControlled = valueProp !== void 0;
|
|
7557
|
-
const [internal, setInternal] =
|
|
7835
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
7558
7836
|
const ratio = isControlled ? valueProp : internal;
|
|
7559
|
-
const ratioRef =
|
|
7837
|
+
const ratioRef = React70.useRef(ratio);
|
|
7560
7838
|
ratioRef.current = ratio;
|
|
7561
|
-
const containerRef =
|
|
7562
|
-
const handleRef =
|
|
7563
|
-
const [dragging, setDragging] =
|
|
7839
|
+
const containerRef = React70.useRef(null);
|
|
7840
|
+
const handleRef = React70.useRef(null);
|
|
7841
|
+
const [dragging, setDragging] = React70.useState(false);
|
|
7564
7842
|
const isHorizontal = orientation === "horizontal";
|
|
7565
|
-
const startRatioRef =
|
|
7566
|
-
const totalSizeRef =
|
|
7843
|
+
const startRatioRef = React70.useRef(0);
|
|
7844
|
+
const totalSizeRef = React70.useRef(0);
|
|
7567
7845
|
const setRatio = (next) => {
|
|
7568
7846
|
if (!isControlled) setInternal(next);
|
|
7569
7847
|
onValueChange?.(next);
|
|
@@ -7705,9 +7983,9 @@ function handlePosition(handle) {
|
|
|
7705
7983
|
return s;
|
|
7706
7984
|
}
|
|
7707
7985
|
function ResizerHandle(props) {
|
|
7708
|
-
const handleRef =
|
|
7709
|
-
const startSizeRef =
|
|
7710
|
-
const aspectRef =
|
|
7986
|
+
const handleRef = React70.useRef(null);
|
|
7987
|
+
const startSizeRef = React70.useRef({ width: 0, height: 0 });
|
|
7988
|
+
const aspectRef = React70.useRef(1);
|
|
7711
7989
|
useDrag({
|
|
7712
7990
|
handle: handleRef,
|
|
7713
7991
|
disabled: props.disabled,
|
|
@@ -7769,7 +8047,7 @@ function IrisResizer({
|
|
|
7769
8047
|
children,
|
|
7770
8048
|
...rest
|
|
7771
8049
|
}) {
|
|
7772
|
-
const sizeRef =
|
|
8050
|
+
const sizeRef = React70.useRef(value);
|
|
7773
8051
|
sizeRef.current = value;
|
|
7774
8052
|
return /* @__PURE__ */ jsxs(
|
|
7775
8053
|
"div",
|
|
@@ -7808,9 +8086,13 @@ function IrisResizer({
|
|
|
7808
8086
|
);
|
|
7809
8087
|
}
|
|
7810
8088
|
var SIZE_STYLES = {
|
|
7811
|
-
sm: { padding: "4px 24px 4px 8px", fontSize:
|
|
7812
|
-
md: {
|
|
7813
|
-
|
|
8089
|
+
sm: { padding: "4px 24px 4px 8px", fontSize: "var(--iris-font-size-xs, 12px)", minHeight: 28 },
|
|
8090
|
+
md: {
|
|
8091
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-space-xl, 24px) var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
8092
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
8093
|
+
minHeight: 34
|
|
8094
|
+
},
|
|
8095
|
+
lg: { padding: "8px 32px 8px 12px", fontSize: "var(--iris-font-size-lg, 16px)", minHeight: 40 }
|
|
7814
8096
|
};
|
|
7815
8097
|
function IrisSelect({
|
|
7816
8098
|
items,
|
|
@@ -7833,21 +8115,21 @@ function IrisSelect({
|
|
|
7833
8115
|
const safeItems = items ?? [];
|
|
7834
8116
|
const resolvedPlaceholder = placeholder ?? t("select.placeholder");
|
|
7835
8117
|
const isControlled = valueProp !== void 0;
|
|
7836
|
-
const [internal, setInternal] =
|
|
8118
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
7837
8119
|
const value = isControlled ? valueProp : internal;
|
|
7838
|
-
const [open, setOpen] =
|
|
8120
|
+
const [open, setOpen] = React70.useState(false);
|
|
7839
8121
|
const selectedItem = safeItems.find((it) => it.value === value) ?? null;
|
|
7840
8122
|
const label = selectedItem ? selectedItem.label ?? String(selectedItem.value) : resolvedPlaceholder;
|
|
7841
8123
|
const setValue = (next) => {
|
|
7842
8124
|
if (!isControlled) setInternal(next);
|
|
7843
8125
|
onValueChange?.(next);
|
|
7844
8126
|
};
|
|
7845
|
-
const isEnabled =
|
|
7846
|
-
const labels =
|
|
8127
|
+
const isEnabled = React70.useCallback((i) => !safeItems[i]?.disabled, [safeItems]);
|
|
8128
|
+
const labels = React70.useMemo(
|
|
7847
8129
|
() => safeItems.map((it) => it.label ?? String(it.value)),
|
|
7848
8130
|
[safeItems]
|
|
7849
8131
|
);
|
|
7850
|
-
const navRef =
|
|
8132
|
+
const navRef = React70.useRef(null);
|
|
7851
8133
|
if (navRef.current === null) {
|
|
7852
8134
|
const selIdx = safeItems.findIndex((it) => it.value === value);
|
|
7853
8135
|
const initial = selIdx >= 0 && !safeItems[selIdx]?.disabled ? selIdx : void 0;
|
|
@@ -7860,10 +8142,10 @@ function IrisSelect({
|
|
|
7860
8142
|
});
|
|
7861
8143
|
}
|
|
7862
8144
|
const nav = navRef.current;
|
|
7863
|
-
|
|
8145
|
+
React70.useEffect(() => {
|
|
7864
8146
|
nav.reset(safeItems.length);
|
|
7865
8147
|
});
|
|
7866
|
-
|
|
8148
|
+
React70.useEffect(() => {
|
|
7867
8149
|
if (open) {
|
|
7868
8150
|
const selIdx = safeItems.findIndex((it) => it.value === value);
|
|
7869
8151
|
if (selIdx >= 0 && !safeItems[selIdx]?.disabled) {
|
|
@@ -7874,8 +8156,8 @@ function IrisSelect({
|
|
|
7874
8156
|
}
|
|
7875
8157
|
}, [open, safeItems, value, nav]);
|
|
7876
8158
|
const activeIndex = useStore(nav.store);
|
|
7877
|
-
const listRef =
|
|
7878
|
-
|
|
8159
|
+
const listRef = React70.useRef(null);
|
|
8160
|
+
React70.useEffect(() => {
|
|
7879
8161
|
if (!open || activeIndex < 0) return;
|
|
7880
8162
|
const el = listRef.current?.querySelector(
|
|
7881
8163
|
`[data-iris-select-option-index="${activeIndex}"]`
|
|
@@ -7973,7 +8255,7 @@ function IrisSelect({
|
|
|
7973
8255
|
{
|
|
7974
8256
|
autoFocus: false,
|
|
7975
8257
|
style: { padding: "var(--iris-padding-sm, 4px)", minWidth: 180 },
|
|
7976
|
-
children: /* @__PURE__ */
|
|
8258
|
+
children: /* @__PURE__ */ jsxs(
|
|
7977
8259
|
"ul",
|
|
7978
8260
|
{
|
|
7979
8261
|
ref: listRef,
|
|
@@ -7988,49 +8270,82 @@ function IrisSelect({
|
|
|
7988
8270
|
padding: 0,
|
|
7989
8271
|
display: "flex",
|
|
7990
8272
|
flexDirection: "column",
|
|
7991
|
-
gap:
|
|
7992
|
-
|
|
8273
|
+
gap: "var(--iris-space-xxs, 4px)",
|
|
8274
|
+
maxHeight: 240,
|
|
8275
|
+
overflowY: "auto"
|
|
7993
8276
|
},
|
|
7994
|
-
children:
|
|
7995
|
-
|
|
7996
|
-
const isActive = index === activeIndex;
|
|
7997
|
-
return /* @__PURE__ */ jsx(
|
|
8277
|
+
children: [
|
|
8278
|
+
safeItems.length === 0 ? /* @__PURE__ */ jsx(
|
|
7998
8279
|
"li",
|
|
7999
8280
|
{
|
|
8000
|
-
|
|
8001
|
-
tabIndex: isActive ? 0 : -1,
|
|
8002
|
-
"aria-selected": isSelected,
|
|
8003
|
-
"aria-disabled": item.disabled ? "true" : void 0,
|
|
8004
|
-
"data-iris-select-option": "",
|
|
8005
|
-
"data-iris-select-option-index": index,
|
|
8006
|
-
"data-state": isSelected ? "selected" : isActive ? "active" : "idle",
|
|
8007
|
-
onClick: item.disabled ? void 0 : () => selectItem(item),
|
|
8008
|
-
onFocus: () => nav.focus(index),
|
|
8281
|
+
"data-iris-select-empty": "",
|
|
8009
8282
|
style: {
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
8015
|
-
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
8016
|
-
opacity: item.disabled ? 0.5 : 1,
|
|
8017
|
-
fontSize: 14,
|
|
8018
|
-
background: isSelected ? "var(--iris-primary)" : isActive ? "var(--iris-surface-hover)" : "transparent",
|
|
8019
|
-
color: isSelected ? "var(--iris-primary-foreground, #fff)" : "var(--iris-foreground)",
|
|
8020
|
-
outline: "none"
|
|
8283
|
+
padding: "var(--iris-space-xs, 8px) var(--iris-padding-sm, 6px)",
|
|
8284
|
+
color: "var(--iris-muted)",
|
|
8285
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
8286
|
+
textAlign: "center"
|
|
8021
8287
|
},
|
|
8022
|
-
children:
|
|
8023
|
-
}
|
|
8024
|
-
|
|
8025
|
-
)
|
|
8026
|
-
|
|
8288
|
+
children: t("select.empty")
|
|
8289
|
+
}
|
|
8290
|
+
) : null,
|
|
8291
|
+
safeItems.map((item, index) => {
|
|
8292
|
+
const isSelected = item.value === value;
|
|
8293
|
+
const isActive = index === activeIndex;
|
|
8294
|
+
return /* @__PURE__ */ jsxs(
|
|
8295
|
+
"li",
|
|
8296
|
+
{
|
|
8297
|
+
role: "option",
|
|
8298
|
+
tabIndex: isActive ? 0 : -1,
|
|
8299
|
+
"aria-selected": isSelected,
|
|
8300
|
+
"aria-disabled": item.disabled ? "true" : void 0,
|
|
8301
|
+
"data-iris-select-option": "",
|
|
8302
|
+
"data-iris-select-option-index": index,
|
|
8303
|
+
"data-state": isSelected ? "selected" : isActive ? "active" : "idle",
|
|
8304
|
+
onClick: item.disabled ? void 0 : () => selectItem(item),
|
|
8305
|
+
onFocus: () => nav.focus(index),
|
|
8306
|
+
style: {
|
|
8307
|
+
display: "flex",
|
|
8308
|
+
alignItems: "center",
|
|
8309
|
+
gap: "var(--iris-gap-sm, 6px)",
|
|
8310
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
8311
|
+
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
8312
|
+
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
8313
|
+
opacity: item.disabled ? 0.5 : 1,
|
|
8314
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
8315
|
+
background: isSelected ? "var(--iris-surface-selected, rgba(99, 102, 241, 0.12))" : isActive ? "var(--iris-surface-hover)" : "transparent",
|
|
8316
|
+
color: "var(--iris-foreground)",
|
|
8317
|
+
fontWeight: isSelected ? 600 : 400
|
|
8318
|
+
},
|
|
8319
|
+
children: [
|
|
8320
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1, minWidth: 0 }, children: item.label ?? String(item.value) }),
|
|
8321
|
+
isSelected ? /* @__PURE__ */ jsx(
|
|
8322
|
+
"svg",
|
|
8323
|
+
{
|
|
8324
|
+
"aria-hidden": "true",
|
|
8325
|
+
width: "14",
|
|
8326
|
+
height: "14",
|
|
8327
|
+
viewBox: "0 0 24 24",
|
|
8328
|
+
fill: "none",
|
|
8329
|
+
stroke: "var(--iris-primary)",
|
|
8330
|
+
strokeWidth: "2.5",
|
|
8331
|
+
strokeLinecap: "round",
|
|
8332
|
+
strokeLinejoin: "round",
|
|
8333
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
8334
|
+
}
|
|
8335
|
+
) : null
|
|
8336
|
+
]
|
|
8337
|
+
},
|
|
8338
|
+
String(item.value ?? index)
|
|
8339
|
+
);
|
|
8340
|
+
})
|
|
8341
|
+
]
|
|
8027
8342
|
}
|
|
8028
8343
|
)
|
|
8029
8344
|
}
|
|
8030
8345
|
)
|
|
8031
8346
|
] });
|
|
8032
8347
|
}
|
|
8033
|
-
var IrisVirtualScroll =
|
|
8348
|
+
var IrisVirtualScroll = React70.forwardRef(function IrisVirtualScroll2({
|
|
8034
8349
|
items,
|
|
8035
8350
|
itemHeight,
|
|
8036
8351
|
estimatedItemHeight = 40,
|
|
@@ -8044,23 +8359,23 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8044
8359
|
className,
|
|
8045
8360
|
...rest
|
|
8046
8361
|
}, forwardedRef) {
|
|
8047
|
-
const viewportRef =
|
|
8048
|
-
const [scrollTop, setScrollTop] =
|
|
8049
|
-
const [viewportHeight, setViewportHeight] =
|
|
8362
|
+
const viewportRef = React70.useRef(null);
|
|
8363
|
+
const [scrollTop, setScrollTop] = React70.useState(0);
|
|
8364
|
+
const [viewportHeight, setViewportHeight] = React70.useState(
|
|
8050
8365
|
typeof height === "number" ? height : 0
|
|
8051
8366
|
);
|
|
8052
|
-
const rafRef =
|
|
8367
|
+
const rafRef = React70.useRef(null);
|
|
8053
8368
|
const auto = itemHeight === "auto";
|
|
8054
8369
|
const userFn = typeof itemHeight === "function" ? itemHeight : null;
|
|
8055
8370
|
const fixedHeight = typeof itemHeight === "number" ? itemHeight : 0;
|
|
8056
8371
|
const variable = userFn !== null || auto;
|
|
8057
|
-
const measuredRef =
|
|
8058
|
-
const [measureVersion, setMeasureVersion] =
|
|
8059
|
-
const itemsRef =
|
|
8372
|
+
const measuredRef = React70.useRef(/* @__PURE__ */ new Map());
|
|
8373
|
+
const [measureVersion, setMeasureVersion] = React70.useState(0);
|
|
8374
|
+
const itemsRef = React70.useRef(items);
|
|
8060
8375
|
itemsRef.current = items;
|
|
8061
|
-
const keyOfRef =
|
|
8376
|
+
const keyOfRef = React70.useRef(keyOf);
|
|
8062
8377
|
keyOfRef.current = keyOf;
|
|
8063
|
-
const estimateSize =
|
|
8378
|
+
const estimateSize = React70.useCallback(
|
|
8064
8379
|
(index) => {
|
|
8065
8380
|
if (userFn) return userFn(index);
|
|
8066
8381
|
if (auto) return measuredRef.current.get(index) ?? estimatedItemHeight;
|
|
@@ -8068,9 +8383,9 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8068
8383
|
},
|
|
8069
8384
|
[userFn, auto, estimatedItemHeight, fixedHeight]
|
|
8070
8385
|
);
|
|
8071
|
-
const estimateRef =
|
|
8386
|
+
const estimateRef = React70.useRef(estimateSize);
|
|
8072
8387
|
estimateRef.current = estimateSize;
|
|
8073
|
-
const virtualizer =
|
|
8388
|
+
const virtualizer = React70.useMemo(
|
|
8074
8389
|
() => createVirtualizer({
|
|
8075
8390
|
count: items.length,
|
|
8076
8391
|
estimateSize: (index) => estimateRef.current(index),
|
|
@@ -8088,19 +8403,19 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8088
8403
|
// not deps (recreating would reset the controller's scroll + cache).
|
|
8089
8404
|
[items.length, buffer, variable]
|
|
8090
8405
|
);
|
|
8091
|
-
|
|
8406
|
+
React70.useLayoutEffect(() => {
|
|
8092
8407
|
if (variable) virtualizer.remeasure();
|
|
8093
8408
|
}, [virtualizer, userFn, measureVersion, estimatedItemHeight, variable]);
|
|
8094
|
-
|
|
8409
|
+
React70.useLayoutEffect(() => {
|
|
8095
8410
|
virtualizer.setViewportSize(viewportHeight);
|
|
8096
8411
|
virtualizer.setScroll(scrollTop);
|
|
8097
8412
|
}, [virtualizer, viewportHeight, scrollTop]);
|
|
8098
|
-
const vstate =
|
|
8413
|
+
const vstate = React70.useSyncExternalStore(virtualizer.subscribe, virtualizer.getState);
|
|
8099
8414
|
const totalHeight = vstate.totalSize;
|
|
8100
8415
|
const itemInState = (i) => vstate.items.find((it) => it.index === i);
|
|
8101
8416
|
const offsetOf = (i) => variable ? itemInState(i)?.start ?? i * estimateRef.current(i) : i * fixedHeight;
|
|
8102
8417
|
const heightOf = (i) => variable ? itemInState(i)?.size ?? estimateRef.current(i) : fixedHeight;
|
|
8103
|
-
const range =
|
|
8418
|
+
const range = React70.useMemo(() => {
|
|
8104
8419
|
if (variable) return { start: vstate.startIndex, end: vstate.endIndex + 1 };
|
|
8105
8420
|
const startRaw = Math.floor(scrollTop / Math.max(1, fixedHeight));
|
|
8106
8421
|
const visibleCount = fixedHeight <= 0 ? 0 : Math.ceil(viewportHeight / fixedHeight);
|
|
@@ -8108,8 +8423,8 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8108
8423
|
const end = Math.min(items.length, startRaw + visibleCount + buffer);
|
|
8109
8424
|
return { start, end };
|
|
8110
8425
|
}, [variable, vstate, scrollTop, viewportHeight, fixedHeight, buffer, items.length]);
|
|
8111
|
-
const rangeRef =
|
|
8112
|
-
|
|
8426
|
+
const rangeRef = React70.useRef(range);
|
|
8427
|
+
React70.useEffect(() => {
|
|
8113
8428
|
if (rangeRef.current.start !== range.start || rangeRef.current.end !== range.end) {
|
|
8114
8429
|
rangeRef.current = range;
|
|
8115
8430
|
onRangeChange?.(range);
|
|
@@ -8129,12 +8444,12 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8129
8444
|
});
|
|
8130
8445
|
});
|
|
8131
8446
|
};
|
|
8132
|
-
const measureViewport =
|
|
8447
|
+
const measureViewport = React70.useCallback(() => {
|
|
8133
8448
|
const el = viewportRef.current;
|
|
8134
8449
|
if (!el) return;
|
|
8135
8450
|
setViewportHeight(el.clientHeight);
|
|
8136
8451
|
}, []);
|
|
8137
|
-
|
|
8452
|
+
React70.useEffect(() => {
|
|
8138
8453
|
measureViewport();
|
|
8139
8454
|
if (typeof ResizeObserver === "undefined") return;
|
|
8140
8455
|
const el = viewportRef.current;
|
|
@@ -8143,15 +8458,15 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8143
8458
|
ro.observe(el);
|
|
8144
8459
|
return () => ro.disconnect();
|
|
8145
8460
|
}, [measureViewport]);
|
|
8146
|
-
|
|
8461
|
+
React70.useEffect(() => {
|
|
8147
8462
|
return () => {
|
|
8148
8463
|
if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
|
|
8149
8464
|
};
|
|
8150
8465
|
}, []);
|
|
8151
|
-
const rowObserverRef =
|
|
8152
|
-
const indexByEl =
|
|
8153
|
-
const elByIndex =
|
|
8154
|
-
|
|
8466
|
+
const rowObserverRef = React70.useRef(null);
|
|
8467
|
+
const indexByEl = React70.useRef(/* @__PURE__ */ new WeakMap());
|
|
8468
|
+
const elByIndex = React70.useRef(/* @__PURE__ */ new Map());
|
|
8469
|
+
React70.useEffect(() => {
|
|
8155
8470
|
if (!auto || typeof ResizeObserver === "undefined") return;
|
|
8156
8471
|
const ro = new ResizeObserver((entries) => {
|
|
8157
8472
|
let changed = false;
|
|
@@ -8187,13 +8502,13 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8187
8502
|
ro?.observe(el);
|
|
8188
8503
|
}
|
|
8189
8504
|
};
|
|
8190
|
-
|
|
8505
|
+
React70.useEffect(() => {
|
|
8191
8506
|
const el = viewportRef.current;
|
|
8192
8507
|
if (!el) return;
|
|
8193
8508
|
const max = Math.max(0, totalHeight - viewportHeight);
|
|
8194
8509
|
if (el.scrollTop > max) el.scrollTop = max;
|
|
8195
8510
|
}, [items.length, totalHeight, viewportHeight]);
|
|
8196
|
-
const scrollToIndex =
|
|
8511
|
+
const scrollToIndex = React70.useCallback(
|
|
8197
8512
|
(index, align = "start") => {
|
|
8198
8513
|
const el = viewportRef.current;
|
|
8199
8514
|
if (!el) return;
|
|
@@ -8202,7 +8517,7 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8202
8517
|
},
|
|
8203
8518
|
[virtualizer]
|
|
8204
8519
|
);
|
|
8205
|
-
const scrollToOffset =
|
|
8520
|
+
const scrollToOffset = React70.useCallback(
|
|
8206
8521
|
(offset) => {
|
|
8207
8522
|
const el = viewportRef.current;
|
|
8208
8523
|
if (!el) return;
|
|
@@ -8210,11 +8525,11 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8210
8525
|
},
|
|
8211
8526
|
[virtualizer]
|
|
8212
8527
|
);
|
|
8213
|
-
const refresh =
|
|
8528
|
+
const refresh = React70.useCallback(() => {
|
|
8214
8529
|
measureViewport();
|
|
8215
8530
|
handleScroll();
|
|
8216
8531
|
}, [measureViewport]);
|
|
8217
|
-
|
|
8532
|
+
React70.useImperativeHandle(forwardedRef, () => ({ scrollToIndex, scrollToOffset, refresh }), [
|
|
8218
8533
|
scrollToIndex,
|
|
8219
8534
|
scrollToOffset,
|
|
8220
8535
|
refresh
|
|
@@ -8276,11 +8591,11 @@ var IrisVirtualScroll = React67.forwardRef(function IrisVirtualScroll2({
|
|
|
8276
8591
|
function useTableSort(data, options) {
|
|
8277
8592
|
const { leafColumns, sort: sortProp, defaultSort, onSortChange } = options;
|
|
8278
8593
|
const sortControlled = sortProp !== void 0;
|
|
8279
|
-
const [sortInternal, setSortInternal] =
|
|
8594
|
+
const [sortInternal, setSortInternal] = React70.useState(
|
|
8280
8595
|
defaultSort ?? null
|
|
8281
8596
|
);
|
|
8282
8597
|
const sortState = sortControlled ? sortProp ?? null : sortInternal;
|
|
8283
|
-
const sortComparator =
|
|
8598
|
+
const sortComparator = React70.useMemo(() => {
|
|
8284
8599
|
if (!sortState) return null;
|
|
8285
8600
|
const col = leafColumns.find((c) => c.key === sortState.key);
|
|
8286
8601
|
if (!col) return null;
|
|
@@ -8288,18 +8603,18 @@ function useTableSort(data, options) {
|
|
|
8288
8603
|
const sorter = col.sorter ?? ((a, b) => compareValues(getCellValue(a, col), getCellValue(b, col)));
|
|
8289
8604
|
return (a, b) => sorter(a, b) * dir;
|
|
8290
8605
|
}, [leafColumns, sortState]);
|
|
8291
|
-
const sortedData =
|
|
8606
|
+
const sortedData = React70.useMemo(() => {
|
|
8292
8607
|
if (!sortComparator) return data;
|
|
8293
8608
|
return [...data].sort(sortComparator);
|
|
8294
8609
|
}, [data, sortComparator]);
|
|
8295
|
-
const setSort =
|
|
8610
|
+
const setSort = React70.useCallback(
|
|
8296
8611
|
(next) => {
|
|
8297
8612
|
if (!sortControlled) setSortInternal(next);
|
|
8298
8613
|
onSortChange?.(next);
|
|
8299
8614
|
},
|
|
8300
8615
|
[sortControlled, onSortChange]
|
|
8301
8616
|
);
|
|
8302
|
-
const cycleSort =
|
|
8617
|
+
const cycleSort = React70.useCallback(
|
|
8303
8618
|
(col) => {
|
|
8304
8619
|
if (!col.sortable) return;
|
|
8305
8620
|
if (!sortState || sortState.key !== col.key) {
|
|
@@ -8326,6 +8641,14 @@ function getCellValue(row, column) {
|
|
|
8326
8641
|
const key = column.dataIndex ?? column.key;
|
|
8327
8642
|
return row[key];
|
|
8328
8643
|
}
|
|
8644
|
+
var TABLE_ROW_CSS = `
|
|
8645
|
+
[data-iris-table] [role="row"]:hover {
|
|
8646
|
+
--iris-cell-bg: var(--iris-surface-hover);
|
|
8647
|
+
}
|
|
8648
|
+
[data-iris-table-row-selected="true"] {
|
|
8649
|
+
--iris-cell-bg: var(--iris-surface-selected);
|
|
8650
|
+
}
|
|
8651
|
+
`;
|
|
8329
8652
|
var RESIZE_STEP = 16;
|
|
8330
8653
|
var SELECTION_COL_WIDTH = 40;
|
|
8331
8654
|
var EXPAND_COL_WIDTH = 40;
|
|
@@ -8343,8 +8666,8 @@ function ColumnResizeHandle({
|
|
|
8343
8666
|
maxWidth,
|
|
8344
8667
|
onResize
|
|
8345
8668
|
}) {
|
|
8346
|
-
const ref =
|
|
8347
|
-
const startRef =
|
|
8669
|
+
const ref = React70.useRef(null);
|
|
8670
|
+
const startRef = React70.useRef(0);
|
|
8348
8671
|
const clamp6 = (w) => Math.max(minWidth, Math.min(maxWidth, Math.round(w)));
|
|
8349
8672
|
const measure = () => width ?? ref.current?.parentElement?.getBoundingClientRect().width ?? minWidth;
|
|
8350
8673
|
useDrag({
|
|
@@ -8426,21 +8749,30 @@ function IrisTable({
|
|
|
8426
8749
|
error = false,
|
|
8427
8750
|
loadingState,
|
|
8428
8751
|
errorState,
|
|
8752
|
+
onRetry,
|
|
8429
8753
|
style,
|
|
8430
8754
|
className,
|
|
8431
8755
|
...rest
|
|
8432
8756
|
}) {
|
|
8757
|
+
React70.useEffect(() => {
|
|
8758
|
+
if (typeof document === "undefined") return;
|
|
8759
|
+
if (document.getElementById("iris-table-row-styles")) return;
|
|
8760
|
+
const style2 = document.createElement("style");
|
|
8761
|
+
style2.id = "iris-table-row-styles";
|
|
8762
|
+
style2.textContent = TABLE_ROW_CSS;
|
|
8763
|
+
document.head.appendChild(style2);
|
|
8764
|
+
}, []);
|
|
8433
8765
|
const { t } = useI18n();
|
|
8434
|
-
const safeColumns =
|
|
8435
|
-
const grouped =
|
|
8766
|
+
const safeColumns = React70.useMemo(() => columns ?? [], [columns]);
|
|
8767
|
+
const grouped = React70.useMemo(
|
|
8436
8768
|
() => safeColumns.some((c) => c.children && c.children.length > 0),
|
|
8437
8769
|
[safeColumns]
|
|
8438
8770
|
);
|
|
8439
|
-
const leafColumns =
|
|
8771
|
+
const leafColumns = React70.useMemo(
|
|
8440
8772
|
() => grouped ? flattenLeafColumns(safeColumns) : safeColumns,
|
|
8441
8773
|
[grouped, safeColumns]
|
|
8442
8774
|
);
|
|
8443
|
-
const headerMatrix =
|
|
8775
|
+
const headerMatrix = React70.useMemo(
|
|
8444
8776
|
() => grouped ? buildHeaderMatrix(safeColumns) : null,
|
|
8445
8777
|
[grouped, safeColumns]
|
|
8446
8778
|
);
|
|
@@ -8456,7 +8788,7 @@ function IrisTable({
|
|
|
8456
8788
|
onSortChange
|
|
8457
8789
|
});
|
|
8458
8790
|
const selControlled = selectionProp !== void 0;
|
|
8459
|
-
const selModelRef =
|
|
8791
|
+
const selModelRef = React70.useRef(null);
|
|
8460
8792
|
if (selModelRef.current === null) {
|
|
8461
8793
|
selModelRef.current = createSelectionModel({
|
|
8462
8794
|
mode: selectable === "single" ? "single" : "multiple",
|
|
@@ -8466,7 +8798,7 @@ function IrisTable({
|
|
|
8466
8798
|
}
|
|
8467
8799
|
const selModel = selModelRef.current;
|
|
8468
8800
|
const selection = useStore(selModel.store);
|
|
8469
|
-
|
|
8801
|
+
React70.useEffect(() => {
|
|
8470
8802
|
if (selControlled) selModel.sync(selectionProp);
|
|
8471
8803
|
}, [selectionProp, selControlled, selModel]);
|
|
8472
8804
|
const displaySelection = selControlled ? selectionProp : selection;
|
|
@@ -8474,7 +8806,7 @@ function IrisTable({
|
|
|
8474
8806
|
if (selControlled) selModel.sync(selectionProp);
|
|
8475
8807
|
};
|
|
8476
8808
|
const hasDetail = renderDetail !== void 0;
|
|
8477
|
-
const expansionRef =
|
|
8809
|
+
const expansionRef = React70.useRef(null);
|
|
8478
8810
|
if (expansionRef.current === null) {
|
|
8479
8811
|
expansionRef.current = createExpansion({
|
|
8480
8812
|
mode: "multiple",
|
|
@@ -8486,7 +8818,7 @@ function IrisTable({
|
|
|
8486
8818
|
const expandedKeys = useStore(expansion.store);
|
|
8487
8819
|
const isRowExpandable = (row, idx) => hasDetail && (rowExpandable ? rowExpandable(row, idx) : true);
|
|
8488
8820
|
const widthsControlled = columnWidthsProp !== void 0;
|
|
8489
|
-
const [widthsInternal, setWidthsInternal] =
|
|
8821
|
+
const [widthsInternal, setWidthsInternal] = React70.useState(
|
|
8490
8822
|
defaultColumnWidths ?? {}
|
|
8491
8823
|
);
|
|
8492
8824
|
const columnWidths = widthsControlled ? columnWidthsProp : widthsInternal;
|
|
@@ -8495,13 +8827,13 @@ function IrisTable({
|
|
|
8495
8827
|
if (!widthsControlled) setWidthsInternal(next);
|
|
8496
8828
|
onColumnWidthsChange?.(next);
|
|
8497
8829
|
};
|
|
8498
|
-
const [editingCellId, setEditingCellId] =
|
|
8499
|
-
const [editingDraft, setEditingDraft] =
|
|
8500
|
-
const [editError, setEditError] =
|
|
8501
|
-
const draftRef =
|
|
8502
|
-
const editorRef =
|
|
8830
|
+
const [editingCellId, setEditingCellId] = React70.useState(null);
|
|
8831
|
+
const [editingDraft, setEditingDraft] = React70.useState("");
|
|
8832
|
+
const [editError, setEditError] = React70.useState(null);
|
|
8833
|
+
const draftRef = React70.useRef("");
|
|
8834
|
+
const editorRef = React70.useRef(null);
|
|
8503
8835
|
const cellId = (rowIdent, colKey) => `${rowIdent}::${colKey}`;
|
|
8504
|
-
|
|
8836
|
+
React70.useEffect(() => {
|
|
8505
8837
|
if (editingCellId !== null) editorRef.current?.focus();
|
|
8506
8838
|
}, [editingCellId]);
|
|
8507
8839
|
const setDraft = (value) => {
|
|
@@ -8553,7 +8885,7 @@ function IrisTable({
|
|
|
8553
8885
|
selModel.toggle(rowKeyOf(row));
|
|
8554
8886
|
};
|
|
8555
8887
|
const treeMode = getSubRows !== void 0;
|
|
8556
|
-
const flatTree =
|
|
8888
|
+
const flatTree = React70.useMemo(
|
|
8557
8889
|
() => treeMode ? flattenTree(sortedData, {
|
|
8558
8890
|
getKey: (r) => String(rowKeyOf(r)),
|
|
8559
8891
|
// With an active sort, sort each level's children by the same
|
|
@@ -8573,7 +8905,7 @@ function IrisTable({
|
|
|
8573
8905
|
const allKeys = bodyData.map(rowKeyOf);
|
|
8574
8906
|
const allSelected = selectable === "multi" && (selControlled ? allKeys.length > 0 && allKeys.every((k) => displaySelection.includes(k)) : selModel.isAllSelected(allKeys));
|
|
8575
8907
|
const someSelected = selectable === "multi" && allKeys.some((k) => displaySelection.includes(k)) && !allSelected;
|
|
8576
|
-
const gridTemplateColumns =
|
|
8908
|
+
const gridTemplateColumns = React70.useMemo(() => {
|
|
8577
8909
|
const widths = [];
|
|
8578
8910
|
if (hasDetail) widths.push(`${EXPAND_COL_WIDTH}px`);
|
|
8579
8911
|
if (selectable !== "none") widths.push("40px");
|
|
@@ -8586,7 +8918,7 @@ function IrisTable({
|
|
|
8586
8918
|
}
|
|
8587
8919
|
return widths.join(" ");
|
|
8588
8920
|
}, [leafColumns, selectable, columnWidths, hasDetail]);
|
|
8589
|
-
const pinnedOffsets =
|
|
8921
|
+
const pinnedOffsets = React70.useMemo(() => {
|
|
8590
8922
|
const map = {};
|
|
8591
8923
|
const widthOf = (col) => columnWidths[col.key] ?? (typeof col.width === "number" ? col.width : DEFAULT_PINNED_WIDTH);
|
|
8592
8924
|
let left = (hasDetail ? EXPAND_COL_WIDTH : 0) + (selectable !== "none" ? SELECTION_COL_WIDTH : 0);
|
|
@@ -8616,20 +8948,20 @@ function IrisTable({
|
|
|
8616
8948
|
background: "var(--iris-background)"
|
|
8617
8949
|
};
|
|
8618
8950
|
};
|
|
8619
|
-
const rootRef =
|
|
8620
|
-
const [scrollLeft, setScrollLeft] =
|
|
8621
|
-
const [viewportWidth, setViewportWidth] =
|
|
8622
|
-
const cellRangeRef =
|
|
8951
|
+
const rootRef = React70.useRef(null);
|
|
8952
|
+
const [scrollLeft, setScrollLeft] = React70.useState(0);
|
|
8953
|
+
const [viewportWidth, setViewportWidth] = React70.useState(0);
|
|
8954
|
+
const cellRangeRef = React70.useRef(null);
|
|
8623
8955
|
if (cellRangeRef.current === null) {
|
|
8624
8956
|
cellRangeRef.current = createCellRange();
|
|
8625
8957
|
}
|
|
8626
8958
|
const cellRangeCtrl = cellRangeRef.current;
|
|
8627
|
-
const cellRangeState =
|
|
8959
|
+
const cellRangeState = React70.useSyncExternalStore(
|
|
8628
8960
|
cellRangeCtrl.subscribe,
|
|
8629
8961
|
cellRangeCtrl.getState,
|
|
8630
8962
|
cellRangeCtrl.getState
|
|
8631
8963
|
);
|
|
8632
|
-
const isInRange =
|
|
8964
|
+
const isInRange = React70.useCallback(
|
|
8633
8965
|
(row, col) => {
|
|
8634
8966
|
const { anchor, active } = cellRangeState;
|
|
8635
8967
|
if (!anchor || !active) return false;
|
|
@@ -8641,7 +8973,7 @@ function IrisTable({
|
|
|
8641
8973
|
},
|
|
8642
8974
|
[cellRangeState]
|
|
8643
8975
|
);
|
|
8644
|
-
const [focusedCell, setFocusedCell] =
|
|
8976
|
+
const [focusedCell, setFocusedCell] = React70.useState(null);
|
|
8645
8977
|
const GRID_NAV_KEYS = /* @__PURE__ */ new Set([
|
|
8646
8978
|
"ArrowUp",
|
|
8647
8979
|
"ArrowDown",
|
|
@@ -8694,13 +9026,13 @@ function IrisTable({
|
|
|
8694
9026
|
else nextCol = Math.min(leafColumns.length - 1, nextCol + 1);
|
|
8695
9027
|
cellRangeCtrl.extendRange(nextRow, nextCol);
|
|
8696
9028
|
};
|
|
8697
|
-
const resolvedColWidths =
|
|
9029
|
+
const resolvedColWidths = React70.useMemo(
|
|
8698
9030
|
() => leafColumns.map(
|
|
8699
9031
|
(col) => columnWidths[col.key] ?? (typeof col.width === "number" ? col.width : DEFAULT_PINNED_WIDTH)
|
|
8700
9032
|
),
|
|
8701
9033
|
[leafColumns, columnWidths]
|
|
8702
9034
|
);
|
|
8703
|
-
|
|
9035
|
+
React70.useEffect(() => {
|
|
8704
9036
|
if (!columnVirtualization) return;
|
|
8705
9037
|
const el = rootRef.current;
|
|
8706
9038
|
if (!el) return;
|
|
@@ -8711,7 +9043,7 @@ function IrisTable({
|
|
|
8711
9043
|
ro.observe(el);
|
|
8712
9044
|
return () => ro.disconnect();
|
|
8713
9045
|
}, [columnVirtualization]);
|
|
8714
|
-
const visibleColSet =
|
|
9046
|
+
const visibleColSet = React70.useMemo(() => {
|
|
8715
9047
|
if (!columnVirtualization) return null;
|
|
8716
9048
|
const w = computeVirtualRange({
|
|
8717
9049
|
itemCount: leafColumns.length,
|
|
@@ -8762,7 +9094,7 @@ function IrisTable({
|
|
|
8762
9094
|
style: {
|
|
8763
9095
|
...baseCellStyle,
|
|
8764
9096
|
justifyContent: "center",
|
|
8765
|
-
background:
|
|
9097
|
+
background: "var(--iris-cell-bg, transparent)",
|
|
8766
9098
|
borderBottom: borderStyle
|
|
8767
9099
|
},
|
|
8768
9100
|
children: isRowExpandable(row, idx) ? /* @__PURE__ */ jsx(
|
|
@@ -8801,7 +9133,7 @@ function IrisTable({
|
|
|
8801
9133
|
style: {
|
|
8802
9134
|
...baseCellStyle,
|
|
8803
9135
|
justifyContent: "center",
|
|
8804
|
-
background:
|
|
9136
|
+
background: "var(--iris-cell-bg, transparent)",
|
|
8805
9137
|
borderBottom: borderStyle
|
|
8806
9138
|
},
|
|
8807
9139
|
children: /* @__PURE__ */ jsx(
|
|
@@ -8848,7 +9180,7 @@ function IrisTable({
|
|
|
8848
9180
|
style: {
|
|
8849
9181
|
...baseCellStyle,
|
|
8850
9182
|
...visibleColSet ? { gridColumnStart: colTrack(ci) } : null,
|
|
8851
|
-
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
9183
|
+
justifyContent: (col.align ?? (typeof getCellValue2(row, col) === "number" ? "right" : "left")) === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
8852
9184
|
background: cellRange && isInRange(idx, ci) ? "var(--iris-surface-selected, rgba(99,102,241,0.12))" : striped && idx % 2 === 1 ? "var(--iris-surface)" : "transparent",
|
|
8853
9185
|
borderBottom: borderStyle,
|
|
8854
9186
|
cursor: col.editable ? "cell" : cellRange ? "default" : void 0,
|
|
@@ -8921,7 +9253,7 @@ function IrisTable({
|
|
|
8921
9253
|
width: "100%",
|
|
8922
9254
|
border: `1px solid ${editError ? "var(--iris-danger)" : "var(--iris-primary)"}`,
|
|
8923
9255
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
8924
|
-
padding: "4px 6px",
|
|
9256
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-padding-sm, 6px)",
|
|
8925
9257
|
font: "inherit",
|
|
8926
9258
|
background: "var(--iris-background)",
|
|
8927
9259
|
color: "var(--iris-foreground)",
|
|
@@ -8935,7 +9267,11 @@ function IrisTable({
|
|
|
8935
9267
|
id: `${cellId(k, col.key)}-error`,
|
|
8936
9268
|
role: "alert",
|
|
8937
9269
|
"data-iris-table-editor-error": "",
|
|
8938
|
-
style: {
|
|
9270
|
+
style: {
|
|
9271
|
+
marginTop: "var(--iris-space-xxs, 4px)",
|
|
9272
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
9273
|
+
color: "var(--iris-danger)"
|
|
9274
|
+
},
|
|
8939
9275
|
children: editError
|
|
8940
9276
|
}
|
|
8941
9277
|
) : null
|
|
@@ -8969,7 +9305,7 @@ function IrisTable({
|
|
|
8969
9305
|
style: {
|
|
8970
9306
|
background: "var(--iris-background)",
|
|
8971
9307
|
color: "var(--iris-foreground)",
|
|
8972
|
-
fontSize:
|
|
9308
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
8973
9309
|
border: borderStyle,
|
|
8974
9310
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
8975
9311
|
// Column virtualization turns the table into a horizontal scroll container.
|
|
@@ -8990,7 +9326,7 @@ function IrisTable({
|
|
|
8990
9326
|
},
|
|
8991
9327
|
children: [
|
|
8992
9328
|
hasDetail ? /* @__PURE__ */ jsx("div", { role: "columnheader", style: { gridColumn: "1", gridRow: "1 / -1" } }) : null,
|
|
8993
|
-
selectable !== "none" ? /* @__PURE__ */
|
|
9329
|
+
selectable !== "none" ? /* @__PURE__ */ jsxs(
|
|
8994
9330
|
"div",
|
|
8995
9331
|
{
|
|
8996
9332
|
role: "columnheader",
|
|
@@ -9003,14 +9339,29 @@ function IrisTable({
|
|
|
9003
9339
|
borderBottom: borderStyle,
|
|
9004
9340
|
justifyContent: "center"
|
|
9005
9341
|
},
|
|
9006
|
-
children:
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9342
|
+
children: [
|
|
9343
|
+
selectable === "multi" ? /* @__PURE__ */ jsx(
|
|
9344
|
+
IrisCheckbox,
|
|
9345
|
+
{
|
|
9346
|
+
checked: allSelected ? true : someSelected ? "indeterminate" : false,
|
|
9347
|
+
onChange: toggleAll,
|
|
9348
|
+
"aria-label": t("table.selectAll")
|
|
9349
|
+
}
|
|
9350
|
+
) : null,
|
|
9351
|
+
selectable === "multi" && displaySelection.length > 0 ? /* @__PURE__ */ jsx(
|
|
9352
|
+
"span",
|
|
9353
|
+
{
|
|
9354
|
+
"data-iris-table-selected-count": "",
|
|
9355
|
+
style: {
|
|
9356
|
+
marginInlineStart: "var(--iris-space-xs, 8px)",
|
|
9357
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
9358
|
+
color: "var(--iris-muted)",
|
|
9359
|
+
whiteSpace: "nowrap"
|
|
9360
|
+
},
|
|
9361
|
+
children: t("table.selectedCount", { count: String(displaySelection.length) })
|
|
9362
|
+
}
|
|
9363
|
+
) : null
|
|
9364
|
+
]
|
|
9014
9365
|
}
|
|
9015
9366
|
) : null,
|
|
9016
9367
|
headerMatrix.flatMap(
|
|
@@ -9052,8 +9403,8 @@ function IrisTable({
|
|
|
9052
9403
|
"aria-hidden": "true",
|
|
9053
9404
|
"data-iris-table-sort-indicator": "",
|
|
9054
9405
|
style: {
|
|
9055
|
-
marginInlineStart:
|
|
9056
|
-
fontSize:
|
|
9406
|
+
marginInlineStart: "var(--iris-space-xs, 8px)",
|
|
9407
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
9057
9408
|
color: dir ? "var(--iris-primary)" : "var(--iris-muted)"
|
|
9058
9409
|
},
|
|
9059
9410
|
children: dir === "asc" ? "\u2191" : dir === "desc" ? "\u2193" : "\u2195"
|
|
@@ -9158,8 +9509,8 @@ function IrisTable({
|
|
|
9158
9509
|
"aria-hidden": "true",
|
|
9159
9510
|
"data-iris-table-sort-indicator": "",
|
|
9160
9511
|
style: {
|
|
9161
|
-
marginInlineStart:
|
|
9162
|
-
fontSize:
|
|
9512
|
+
marginInlineStart: "var(--iris-space-xs, 8px)",
|
|
9513
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
9163
9514
|
color: dir ? "var(--iris-primary)" : "var(--iris-muted)"
|
|
9164
9515
|
},
|
|
9165
9516
|
children: dir === "asc" ? "\u2191" : dir === "desc" ? "\u2193" : "\u2195"
|
|
@@ -9185,7 +9536,27 @@ function IrisTable({
|
|
|
9185
9536
|
}
|
|
9186
9537
|
)
|
|
9187
9538
|
),
|
|
9188
|
-
error ? /* @__PURE__ */
|
|
9539
|
+
error ? /* @__PURE__ */ jsxs("div", { role: "row", "data-iris-table-row": "error", style: STATE_ROW_STYLE, children: [
|
|
9540
|
+
/* @__PURE__ */ jsx("span", { style: { marginInlineEnd: onRetry ? "var(--iris-space-sm, 12px)" : 0 }, children: errorState ?? t("table.error") }),
|
|
9541
|
+
onRetry ? /* @__PURE__ */ jsx(
|
|
9542
|
+
"button",
|
|
9543
|
+
{
|
|
9544
|
+
type: "button",
|
|
9545
|
+
"data-iris-table-retry": "",
|
|
9546
|
+
onClick: onRetry,
|
|
9547
|
+
style: {
|
|
9548
|
+
border: "1px solid var(--iris-border)",
|
|
9549
|
+
background: "var(--iris-surface)",
|
|
9550
|
+
color: "var(--iris-foreground)",
|
|
9551
|
+
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
9552
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-space-xs, 8px)",
|
|
9553
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
9554
|
+
cursor: "pointer"
|
|
9555
|
+
},
|
|
9556
|
+
children: t("table.retry")
|
|
9557
|
+
}
|
|
9558
|
+
) : null
|
|
9559
|
+
] }) : loading ? /* @__PURE__ */ jsx("div", { role: "row", "aria-busy": "true", "data-iris-table-row": "loading", style: STATE_ROW_STYLE, children: loadingState ?? t("table.loading") }) : bodyData.length === 0 ? /* @__PURE__ */ jsx("div", { role: "row", "data-iris-table-row": "empty", style: STATE_ROW_STYLE, children: emptyState ?? t("table.empty") }) : virtualScroll && (!treeMode || !hasDetail) ? (
|
|
9189
9560
|
// Virtualize flat mode, and tree mode too — tree rows are uniform height,
|
|
9190
9561
|
// so the only thing that bars it is variable-height detail panels, hence
|
|
9191
9562
|
// the `!hasDetail` guard. `bodyData` is the flattened visible rows (=
|
|
@@ -9206,7 +9577,7 @@ function IrisTable({
|
|
|
9206
9577
|
const main = renderRow(row, idx, void 0, flatTree?.[idx]);
|
|
9207
9578
|
if (!hasDetail || !isRowExpandable(row, idx) || !expandedKeys.includes(String(rowKeyOf(row))))
|
|
9208
9579
|
return main;
|
|
9209
|
-
return /* @__PURE__ */ jsxs(
|
|
9580
|
+
return /* @__PURE__ */ jsxs(React70.Fragment, { children: [
|
|
9210
9581
|
main,
|
|
9211
9582
|
/* @__PURE__ */ jsx(
|
|
9212
9583
|
"div",
|
|
@@ -9324,29 +9695,29 @@ function IrisCalendar({
|
|
|
9324
9695
|
}) {
|
|
9325
9696
|
const { t } = useI18n();
|
|
9326
9697
|
const isControlled = valueProp !== void 0;
|
|
9327
|
-
const [internal, setInternal] =
|
|
9698
|
+
const [internal, setInternal] = React70.useState(defaultValue ?? null);
|
|
9328
9699
|
const selectedValue = isControlled ? valueProp : internal;
|
|
9329
9700
|
const initialMonth = defaultMonth ?? selectedValue ?? /* @__PURE__ */ new Date();
|
|
9330
|
-
const [visibleMonth, setVisibleMonth] =
|
|
9331
|
-
const [focusDate, setFocusDate] =
|
|
9701
|
+
const [visibleMonth, setVisibleMonth] = React70.useState(startOfMonth(initialMonth));
|
|
9702
|
+
const [focusDate, setFocusDate] = React70.useState(
|
|
9332
9703
|
clampDate(selectedValue ?? /* @__PURE__ */ new Date(), min, max)
|
|
9333
9704
|
);
|
|
9334
|
-
|
|
9705
|
+
React70.useEffect(() => {
|
|
9335
9706
|
if (selectedValue && !isSameMonth(selectedValue, visibleMonth)) {
|
|
9336
9707
|
setVisibleMonth(startOfMonth(selectedValue));
|
|
9337
9708
|
setFocusDate(clampDate(selectedValue, min, max));
|
|
9338
9709
|
}
|
|
9339
9710
|
}, [selectedValue, visibleMonth, min, max]);
|
|
9340
|
-
const matrix =
|
|
9711
|
+
const matrix = React70.useMemo(
|
|
9341
9712
|
() => buildMonthMatrix(visibleMonth, weekStartsOn),
|
|
9342
9713
|
[visibleMonth, weekStartsOn]
|
|
9343
9714
|
);
|
|
9344
|
-
const weekdays =
|
|
9715
|
+
const weekdays = React70.useMemo(
|
|
9345
9716
|
() => getWeekdayNames(weekStartsOn, locale),
|
|
9346
9717
|
[weekStartsOn, locale]
|
|
9347
9718
|
);
|
|
9348
|
-
const title =
|
|
9349
|
-
const dayLabelFmt =
|
|
9719
|
+
const title = React70.useMemo(() => formatMonthYear(visibleMonth, locale), [visibleMonth, locale]);
|
|
9720
|
+
const dayLabelFmt = React70.useMemo(
|
|
9350
9721
|
() => new Intl.DateTimeFormat(safeLocale(locale), {
|
|
9351
9722
|
weekday: "long",
|
|
9352
9723
|
year: "numeric",
|
|
@@ -9486,7 +9857,7 @@ function IrisCalendar({
|
|
|
9486
9857
|
{
|
|
9487
9858
|
"data-iris-calendar-title": "",
|
|
9488
9859
|
"aria-live": "polite",
|
|
9489
|
-
style: { fontWeight: 600, fontSize:
|
|
9860
|
+
style: { fontWeight: 600, fontSize: "var(--iris-font-size-md, 14px)" },
|
|
9490
9861
|
children: title
|
|
9491
9862
|
}
|
|
9492
9863
|
),
|
|
@@ -9517,12 +9888,12 @@ function IrisCalendar({
|
|
|
9517
9888
|
style: {
|
|
9518
9889
|
display: "grid",
|
|
9519
9890
|
gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
|
|
9520
|
-
gap:
|
|
9521
|
-
fontSize:
|
|
9891
|
+
gap: "var(--iris-space-xxs, 4px)",
|
|
9892
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
9522
9893
|
color: "var(--iris-muted)",
|
|
9523
9894
|
textAlign: "center"
|
|
9524
9895
|
},
|
|
9525
|
-
children: weekdays.map((name) => /* @__PURE__ */ jsx("div", { role: "columnheader", style: { padding: "
|
|
9896
|
+
children: weekdays.map((name) => /* @__PURE__ */ jsx("div", { role: "columnheader", style: { padding: "var(--iris-space-xxs, 4px) 0" }, children: name }, name))
|
|
9526
9897
|
}
|
|
9527
9898
|
),
|
|
9528
9899
|
/* @__PURE__ */ jsx(
|
|
@@ -9535,7 +9906,7 @@ function IrisCalendar({
|
|
|
9535
9906
|
style: {
|
|
9536
9907
|
display: "grid",
|
|
9537
9908
|
gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
|
|
9538
|
-
gap:
|
|
9909
|
+
gap: "var(--iris-space-xxs, 4px)"
|
|
9539
9910
|
},
|
|
9540
9911
|
children: matrix.map((week, wi) => /* @__PURE__ */ jsx(
|
|
9541
9912
|
"div",
|
|
@@ -9580,7 +9951,7 @@ function IrisCalendar({
|
|
|
9580
9951
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
9581
9952
|
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
9582
9953
|
opacity: isDisabled ? 0.45 : 1,
|
|
9583
|
-
fontSize:
|
|
9954
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
9584
9955
|
fontFamily: "inherit",
|
|
9585
9956
|
outline: "none"
|
|
9586
9957
|
},
|
|
@@ -9622,9 +9993,9 @@ function IrisDatePicker({
|
|
|
9622
9993
|
}) {
|
|
9623
9994
|
const { t } = useI18n();
|
|
9624
9995
|
const isControlled = valueProp !== void 0;
|
|
9625
|
-
const [internal, setInternal] =
|
|
9996
|
+
const [internal, setInternal] = React70.useState(defaultValue ?? null);
|
|
9626
9997
|
const value = isControlled ? valueProp : internal;
|
|
9627
|
-
const [open, setOpen] =
|
|
9998
|
+
const [open, setOpen] = React70.useState(false);
|
|
9628
9999
|
const display = formatDisplay(value, locale);
|
|
9629
10000
|
const handleSelect = (next) => {
|
|
9630
10001
|
if (!isControlled) setInternal(next);
|
|
@@ -9648,15 +10019,15 @@ function IrisDatePicker({
|
|
|
9648
10019
|
style: {
|
|
9649
10020
|
display: "inline-flex",
|
|
9650
10021
|
alignItems: "center",
|
|
9651
|
-
gap:
|
|
9652
|
-
padding: "6px 12px",
|
|
10022
|
+
gap: "var(--iris-space-xs, 8px)",
|
|
10023
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
9653
10024
|
background: "var(--iris-background)",
|
|
9654
10025
|
color: value ? "var(--iris-foreground)" : "var(--iris-muted)",
|
|
9655
10026
|
border: `1px solid ${invalid ? "var(--iris-danger)" : "var(--iris-border)"}`,
|
|
9656
10027
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
9657
10028
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
9658
10029
|
opacity: disabled ? 0.6 : 1,
|
|
9659
|
-
fontSize:
|
|
10030
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
9660
10031
|
fontFamily: "inherit",
|
|
9661
10032
|
minHeight: 34,
|
|
9662
10033
|
minWidth: 180,
|
|
@@ -9685,7 +10056,7 @@ var TREE_STATE_STYLE = {
|
|
|
9685
10056
|
padding: "12px",
|
|
9686
10057
|
textAlign: "center",
|
|
9687
10058
|
color: "var(--iris-muted)",
|
|
9688
|
-
fontSize:
|
|
10059
|
+
fontSize: "var(--iris-font-size-md, 14px)"
|
|
9689
10060
|
};
|
|
9690
10061
|
function IrisTree({
|
|
9691
10062
|
nodes,
|
|
@@ -9712,8 +10083,8 @@ function IrisTree({
|
|
|
9712
10083
|
const safeNodes = nodes ?? [];
|
|
9713
10084
|
const expControlled = expandedProp !== void 0;
|
|
9714
10085
|
const selControlled = selectedProp !== void 0;
|
|
9715
|
-
const [expInternal, setExpInternal] =
|
|
9716
|
-
const [selInternal, setSelInternal] =
|
|
10086
|
+
const [expInternal, setExpInternal] = React70.useState(defaultExpanded);
|
|
10087
|
+
const [selInternal, setSelInternal] = React70.useState(defaultSelected);
|
|
9717
10088
|
const expanded = expControlled ? expandedProp : expInternal;
|
|
9718
10089
|
const selected = selControlled ? selectedProp : selInternal;
|
|
9719
10090
|
const { t } = useI18n();
|
|
@@ -9722,19 +10093,19 @@ function IrisTree({
|
|
|
9722
10093
|
error,
|
|
9723
10094
|
empty: safeNodes.length === 0
|
|
9724
10095
|
});
|
|
9725
|
-
const [lazyCache, setLazyCache] =
|
|
9726
|
-
const [loadingIds, setLoadingIds] =
|
|
9727
|
-
const [errorIds, setErrorIds] =
|
|
9728
|
-
const expandedSet =
|
|
9729
|
-
const selectedSet =
|
|
9730
|
-
const childrenOf =
|
|
10096
|
+
const [lazyCache, setLazyCache] = React70.useState(/* @__PURE__ */ new Map());
|
|
10097
|
+
const [loadingIds, setLoadingIds] = React70.useState(/* @__PURE__ */ new Set());
|
|
10098
|
+
const [errorIds, setErrorIds] = React70.useState(/* @__PURE__ */ new Set());
|
|
10099
|
+
const expandedSet = React70.useMemo(() => new Set(expanded), [expanded]);
|
|
10100
|
+
const selectedSet = React70.useMemo(() => new Set(selected), [selected]);
|
|
10101
|
+
const childrenOf = React70.useCallback(
|
|
9731
10102
|
(node) => {
|
|
9732
10103
|
if (node.children && node.children.length > 0) return node.children;
|
|
9733
10104
|
return lazyCache.get(node.id) ?? null;
|
|
9734
10105
|
},
|
|
9735
10106
|
[lazyCache]
|
|
9736
10107
|
);
|
|
9737
|
-
const hasChildrenFn =
|
|
10108
|
+
const hasChildrenFn = React70.useCallback(
|
|
9738
10109
|
(node) => {
|
|
9739
10110
|
if (node.isLeaf) return false;
|
|
9740
10111
|
if (node.children && node.children.length > 0) return true;
|
|
@@ -9743,7 +10114,7 @@ function IrisTree({
|
|
|
9743
10114
|
},
|
|
9744
10115
|
[lazyCache]
|
|
9745
10116
|
);
|
|
9746
|
-
const flat =
|
|
10117
|
+
const flat = React70.useMemo(() => {
|
|
9747
10118
|
const out = [];
|
|
9748
10119
|
const walk = (ns, depth, parentId) => {
|
|
9749
10120
|
for (const node of ns) {
|
|
@@ -9758,7 +10129,7 @@ function IrisTree({
|
|
|
9758
10129
|
walk(safeNodes, 0, null);
|
|
9759
10130
|
return out;
|
|
9760
10131
|
}, [safeNodes, expandedSet, childrenOf, hasChildrenFn]);
|
|
9761
|
-
const checkNodes =
|
|
10132
|
+
const checkNodes = React70.useMemo(() => {
|
|
9762
10133
|
const out = [];
|
|
9763
10134
|
const walk = (ns, parentKey) => {
|
|
9764
10135
|
for (const node of ns) {
|
|
@@ -9770,9 +10141,9 @@ function IrisTree({
|
|
|
9770
10141
|
walk(safeNodes, void 0);
|
|
9771
10142
|
return out;
|
|
9772
10143
|
}, [safeNodes, lazyCache]);
|
|
9773
|
-
const onCheckedRef =
|
|
10144
|
+
const onCheckedRef = React70.useRef(onCheckedChange);
|
|
9774
10145
|
onCheckedRef.current = onCheckedChange;
|
|
9775
|
-
const checkModel =
|
|
10146
|
+
const checkModel = React70.useMemo(
|
|
9776
10147
|
() => createTreeSelection({
|
|
9777
10148
|
nodes: checkNodes,
|
|
9778
10149
|
defaultChecked,
|
|
@@ -9780,18 +10151,18 @@ function IrisTree({
|
|
|
9780
10151
|
}),
|
|
9781
10152
|
[checkNodes, defaultChecked]
|
|
9782
10153
|
);
|
|
9783
|
-
|
|
10154
|
+
React70.useSyncExternalStore(
|
|
9784
10155
|
checkModel.selection.store.subscribe,
|
|
9785
10156
|
checkModel.selection.get,
|
|
9786
10157
|
checkModel.selection.get
|
|
9787
10158
|
);
|
|
9788
|
-
const [activeId, setActiveId] =
|
|
9789
|
-
|
|
10159
|
+
const [activeId, setActiveId] = React70.useState(flat[0]?.node.id ?? null);
|
|
10160
|
+
React70.useEffect(() => {
|
|
9790
10161
|
if (!activeId || !flat.some((f) => f.node.id === activeId)) {
|
|
9791
10162
|
setActiveId(flat[0]?.node.id ?? null);
|
|
9792
10163
|
}
|
|
9793
10164
|
}, [flat, activeId]);
|
|
9794
|
-
const expandedRef =
|
|
10165
|
+
const expandedRef = React70.useRef(expanded);
|
|
9795
10166
|
expandedRef.current = expanded;
|
|
9796
10167
|
const setExpanded = (next) => {
|
|
9797
10168
|
if (!expControlled) setExpInternal(next);
|
|
@@ -9909,7 +10280,7 @@ function IrisTree({
|
|
|
9909
10280
|
color: "var(--iris-foreground)",
|
|
9910
10281
|
border: "1px solid var(--iris-border)",
|
|
9911
10282
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
9912
|
-
fontSize:
|
|
10283
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
9913
10284
|
...style
|
|
9914
10285
|
},
|
|
9915
10286
|
children: isContent ? flat.map(({ node, depth, hasChildren }) => {
|
|
@@ -9975,7 +10346,7 @@ function IrisTree({
|
|
|
9975
10346
|
color: "inherit",
|
|
9976
10347
|
cursor: "pointer",
|
|
9977
10348
|
padding: 0,
|
|
9978
|
-
fontSize:
|
|
10349
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
9979
10350
|
fontFamily: "inherit",
|
|
9980
10351
|
transition: "transform 120ms ease",
|
|
9981
10352
|
transform: isLoading ? "none" : isExpanded ? "rotate(90deg)" : "rotate(0deg)"
|
|
@@ -10057,7 +10428,7 @@ var LIST_STATE_STYLE = {
|
|
|
10057
10428
|
padding: "12px",
|
|
10058
10429
|
textAlign: "center",
|
|
10059
10430
|
color: "var(--iris-muted)",
|
|
10060
|
-
fontSize:
|
|
10431
|
+
fontSize: "var(--iris-font-size-md, 14px)"
|
|
10061
10432
|
};
|
|
10062
10433
|
function IrisList({
|
|
10063
10434
|
items,
|
|
@@ -10083,7 +10454,7 @@ function IrisList({
|
|
|
10083
10454
|
const asKey = (v) => v;
|
|
10084
10455
|
const toKeys = (v) => v == null ? [] : Array.isArray(v) ? v.map(asKey) : [asKey(v)];
|
|
10085
10456
|
const fromKeys = (keys) => multi ? keys : keys[0] ?? null;
|
|
10086
|
-
const modelRef =
|
|
10457
|
+
const modelRef = React70.useRef(null);
|
|
10087
10458
|
if (modelRef.current === null) {
|
|
10088
10459
|
const initial = defaultValue !== void 0 ? defaultValue : multi ? [] : null;
|
|
10089
10460
|
modelRef.current = createSelectionModel({
|
|
@@ -10094,7 +10465,7 @@ function IrisList({
|
|
|
10094
10465
|
}
|
|
10095
10466
|
const model = modelRef.current;
|
|
10096
10467
|
const selectedKeys = useStore(model.store);
|
|
10097
|
-
|
|
10468
|
+
React70.useEffect(() => {
|
|
10098
10469
|
if (isControlled) model.sync(toKeys(valueProp));
|
|
10099
10470
|
}, [valueProp, isControlled, model]);
|
|
10100
10471
|
const displaySelectedKeys = isControlled ? toKeys(valueProp) : selectedKeys;
|
|
@@ -10107,12 +10478,12 @@ function IrisList({
|
|
|
10107
10478
|
error,
|
|
10108
10479
|
empty: safeItems.length === 0
|
|
10109
10480
|
});
|
|
10110
|
-
const isSelected =
|
|
10481
|
+
const isSelected = React70.useCallback(
|
|
10111
10482
|
(v) => displaySelectedKeys.includes(v),
|
|
10112
10483
|
[displaySelectedKeys]
|
|
10113
10484
|
);
|
|
10114
|
-
const isEnabled =
|
|
10115
|
-
const ctxRef =
|
|
10485
|
+
const isEnabled = React70.useCallback((i) => !safeItems[i]?.disabled, [safeItems]);
|
|
10486
|
+
const ctxRef = React70.useRef({
|
|
10116
10487
|
items: safeItems,
|
|
10117
10488
|
multi,
|
|
10118
10489
|
loop,
|
|
@@ -10122,7 +10493,7 @@ function IrisList({
|
|
|
10122
10493
|
onSelect,
|
|
10123
10494
|
asKey
|
|
10124
10495
|
});
|
|
10125
|
-
const navRef =
|
|
10496
|
+
const navRef = React70.useRef(null);
|
|
10126
10497
|
if (navRef.current === null) {
|
|
10127
10498
|
navRef.current = createKeyboardNav({
|
|
10128
10499
|
count: safeItems.length,
|
|
@@ -10131,7 +10502,7 @@ function IrisList({
|
|
|
10131
10502
|
});
|
|
10132
10503
|
}
|
|
10133
10504
|
const nav = navRef.current;
|
|
10134
|
-
|
|
10505
|
+
React70.useEffect(() => {
|
|
10135
10506
|
nav.reset(safeItems.length);
|
|
10136
10507
|
});
|
|
10137
10508
|
ctxRef.current = {
|
|
@@ -10145,7 +10516,8 @@ function IrisList({
|
|
|
10145
10516
|
asKey
|
|
10146
10517
|
};
|
|
10147
10518
|
const activeIndex = useStore(nav.store);
|
|
10148
|
-
const
|
|
10519
|
+
const [hoveredIndex, setHoveredIndex] = React70.useState(-1);
|
|
10520
|
+
const listRef = React70.useRef(null);
|
|
10149
10521
|
const focusAt = (index) => {
|
|
10150
10522
|
const el = listRef.current?.querySelector(`[data-iris-list-index="${index}"]`);
|
|
10151
10523
|
el?.focus();
|
|
@@ -10193,8 +10565,10 @@ function IrisList({
|
|
|
10193
10565
|
padding: "var(--iris-padding-sm, 4px)",
|
|
10194
10566
|
display: "flex",
|
|
10195
10567
|
flexDirection: "column",
|
|
10196
|
-
gap:
|
|
10568
|
+
gap: "var(--iris-space-xxs, 4px)",
|
|
10197
10569
|
outline: "none",
|
|
10570
|
+
maxHeight: 240,
|
|
10571
|
+
overflowY: "auto",
|
|
10198
10572
|
...style
|
|
10199
10573
|
},
|
|
10200
10574
|
children: isContent ? safeItems.map((item, index) => {
|
|
@@ -10204,16 +10578,17 @@ function IrisList({
|
|
|
10204
10578
|
display: "flex",
|
|
10205
10579
|
alignItems: "center",
|
|
10206
10580
|
gap: "var(--iris-gap-sm, 6px)",
|
|
10207
|
-
padding: "6px var(--iris-padding-md, 12px)",
|
|
10581
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
10208
10582
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
10209
10583
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
10210
10584
|
opacity: item.disabled ? 0.5 : 1,
|
|
10211
|
-
fontSize:
|
|
10212
|
-
background: selected ? "var(--iris-
|
|
10213
|
-
color:
|
|
10585
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
10586
|
+
background: selected ? "var(--iris-surface-selected, rgba(99, 102, 241, 0.12))" : hoveredIndex === index ? "var(--iris-surface-hover)" : active ? "var(--iris-surface-hover)" : "transparent",
|
|
10587
|
+
color: "var(--iris-foreground)",
|
|
10588
|
+
fontWeight: selected ? 600 : 400,
|
|
10214
10589
|
outline: "none"
|
|
10215
10590
|
};
|
|
10216
|
-
return /* @__PURE__ */
|
|
10591
|
+
return /* @__PURE__ */ jsxs(
|
|
10217
10592
|
"li",
|
|
10218
10593
|
{
|
|
10219
10594
|
role: "option",
|
|
@@ -10223,10 +10598,29 @@ function IrisList({
|
|
|
10223
10598
|
"data-iris-list-index": index,
|
|
10224
10599
|
"data-iris-list-item": "",
|
|
10225
10600
|
"data-state": selected ? "selected" : active ? "active" : "idle",
|
|
10601
|
+
onMouseEnter: () => setHoveredIndex(index),
|
|
10602
|
+
onMouseLeave: () => setHoveredIndex((current) => current === index ? -1 : current),
|
|
10226
10603
|
onClick: item.disabled ? void 0 : () => select(item),
|
|
10227
10604
|
onFocus: () => nav.focus(index),
|
|
10228
10605
|
style: baseStyle,
|
|
10229
|
-
children:
|
|
10606
|
+
children: [
|
|
10607
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1, minWidth: 0 }, children: renderItem ? renderItem(item, { selected, active, index }) : item.label ?? String(item.value) }),
|
|
10608
|
+
selected ? /* @__PURE__ */ jsx(
|
|
10609
|
+
"svg",
|
|
10610
|
+
{
|
|
10611
|
+
"aria-hidden": "true",
|
|
10612
|
+
width: "14",
|
|
10613
|
+
height: "14",
|
|
10614
|
+
viewBox: "0 0 24 24",
|
|
10615
|
+
fill: "none",
|
|
10616
|
+
stroke: "var(--iris-primary)",
|
|
10617
|
+
strokeWidth: "2.5",
|
|
10618
|
+
strokeLinecap: "round",
|
|
10619
|
+
strokeLinejoin: "round",
|
|
10620
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
10621
|
+
}
|
|
10622
|
+
) : null
|
|
10623
|
+
]
|
|
10230
10624
|
},
|
|
10231
10625
|
String(item.value ?? index)
|
|
10232
10626
|
);
|
|
@@ -10275,11 +10669,11 @@ function IrisFileUpload({
|
|
|
10275
10669
|
const { t } = useI18n();
|
|
10276
10670
|
const resolvedLabel = label ?? t("fileUpload.label");
|
|
10277
10671
|
const isControlled = valueProp !== void 0;
|
|
10278
|
-
const [internal, setInternal] =
|
|
10672
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
10279
10673
|
const files = isControlled ? valueProp : internal;
|
|
10280
|
-
const inputRef =
|
|
10281
|
-
const dragCountRef =
|
|
10282
|
-
const [dragOver, setDragOver] =
|
|
10674
|
+
const inputRef = React70.useRef(null);
|
|
10675
|
+
const dragCountRef = React70.useRef(0);
|
|
10676
|
+
const [dragOver, setDragOver] = React70.useState(false);
|
|
10283
10677
|
const acceptMatches = (file) => {
|
|
10284
10678
|
if (!accept) return true;
|
|
10285
10679
|
const tokens = accept.split(",").map((t2) => t2.trim()).filter(Boolean);
|
|
@@ -10378,7 +10772,7 @@ function IrisFileUpload({
|
|
|
10378
10772
|
flexDirection: "column",
|
|
10379
10773
|
alignItems: "center",
|
|
10380
10774
|
justifyContent: "center",
|
|
10381
|
-
gap:
|
|
10775
|
+
gap: "var(--iris-space-xs, 8px)",
|
|
10382
10776
|
padding: "var(--iris-padding-lg, 20px)",
|
|
10383
10777
|
border: `2px dashed ${dragOver ? "var(--iris-primary)" : "var(--iris-border)"}`,
|
|
10384
10778
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
@@ -10438,8 +10832,15 @@ function IrisFileUpload({
|
|
|
10438
10832
|
onDrop,
|
|
10439
10833
|
style: zoneStyle,
|
|
10440
10834
|
children: [
|
|
10441
|
-
/* @__PURE__ */ jsx(
|
|
10442
|
-
|
|
10835
|
+
/* @__PURE__ */ jsx(
|
|
10836
|
+
"div",
|
|
10837
|
+
{
|
|
10838
|
+
"data-iris-file-upload-label": "",
|
|
10839
|
+
style: { fontSize: "var(--iris-font-size-md, 14px)", fontWeight: 500 },
|
|
10840
|
+
children: resolvedLabel
|
|
10841
|
+
}
|
|
10842
|
+
),
|
|
10843
|
+
accept ? /* @__PURE__ */ jsx("div", { style: { fontSize: "var(--iris-font-size-xs, 12px)", color: "var(--iris-muted)" }, children: accept }) : null
|
|
10443
10844
|
]
|
|
10444
10845
|
}
|
|
10445
10846
|
),
|
|
@@ -10463,15 +10864,21 @@ function IrisFileUpload({
|
|
|
10463
10864
|
display: "flex",
|
|
10464
10865
|
alignItems: "center",
|
|
10465
10866
|
gap: 8,
|
|
10466
|
-
padding: "6px
|
|
10867
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
10467
10868
|
background: "var(--iris-surface)",
|
|
10468
10869
|
border: "1px solid var(--iris-border)",
|
|
10469
10870
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
10470
|
-
fontSize:
|
|
10871
|
+
fontSize: "var(--iris-font-size-sm, 13px)"
|
|
10471
10872
|
},
|
|
10472
10873
|
children: [
|
|
10473
10874
|
/* @__PURE__ */ jsx("span", { style: { flex: 1, minWidth: 0 }, children: item.name }),
|
|
10474
|
-
/* @__PURE__ */ jsx(
|
|
10875
|
+
/* @__PURE__ */ jsx(
|
|
10876
|
+
"span",
|
|
10877
|
+
{
|
|
10878
|
+
style: { color: "var(--iris-muted)", fontSize: "var(--iris-font-size-xs, 12px)" },
|
|
10879
|
+
children: formatBytes(item.size)
|
|
10880
|
+
}
|
|
10881
|
+
),
|
|
10475
10882
|
/* @__PURE__ */ jsx(
|
|
10476
10883
|
"button",
|
|
10477
10884
|
{
|
|
@@ -10487,7 +10894,7 @@ function IrisFileUpload({
|
|
|
10487
10894
|
border: "none",
|
|
10488
10895
|
color: "var(--iris-muted)",
|
|
10489
10896
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
10490
|
-
fontSize:
|
|
10897
|
+
fontSize: "var(--iris-font-size-lg, 16px)",
|
|
10491
10898
|
lineHeight: 1,
|
|
10492
10899
|
padding: "0 4px"
|
|
10493
10900
|
},
|
|
@@ -10504,9 +10911,9 @@ function IrisFileUpload({
|
|
|
10504
10911
|
}
|
|
10505
10912
|
);
|
|
10506
10913
|
}
|
|
10507
|
-
var MenuContext =
|
|
10914
|
+
var MenuContext = React70.createContext(null);
|
|
10508
10915
|
function useMenuContext(componentName) {
|
|
10509
|
-
const ctx =
|
|
10916
|
+
const ctx = React70.useContext(MenuContext);
|
|
10510
10917
|
if (!ctx) {
|
|
10511
10918
|
throw new Error(`[iris-ui] ${componentName} must be a descendant of <IrisMenu>`);
|
|
10512
10919
|
}
|
|
@@ -10523,7 +10930,7 @@ function IrisMenu({
|
|
|
10523
10930
|
const isControlled = openProp !== void 0;
|
|
10524
10931
|
const [state, send] = useMachine(() => createFloatingMachine(defaultOpen ? "open" : "closed"));
|
|
10525
10932
|
const internalOpen = state.value === "open";
|
|
10526
|
-
|
|
10933
|
+
React70.useEffect(() => {
|
|
10527
10934
|
if (!isControlled) return;
|
|
10528
10935
|
const target = openProp ? "open" : "closed";
|
|
10529
10936
|
if (state.value !== target) {
|
|
@@ -10531,18 +10938,18 @@ function IrisMenu({
|
|
|
10531
10938
|
}
|
|
10532
10939
|
}, [isControlled, openProp, state.value, send]);
|
|
10533
10940
|
const open = isControlled ? Boolean(openProp) : internalOpen;
|
|
10534
|
-
const setOpen =
|
|
10941
|
+
const setOpen = React70.useCallback(
|
|
10535
10942
|
(next) => {
|
|
10536
10943
|
if (!isControlled) send({ type: next ? "OPEN" : "CLOSE" });
|
|
10537
10944
|
onOpenChange?.(next);
|
|
10538
10945
|
},
|
|
10539
10946
|
[isControlled, send, onOpenChange]
|
|
10540
10947
|
);
|
|
10541
|
-
const triggerRef =
|
|
10542
|
-
const contentRef =
|
|
10543
|
-
const contentId =
|
|
10544
|
-
const closeRoot =
|
|
10545
|
-
const value =
|
|
10948
|
+
const triggerRef = React70.useRef(null);
|
|
10949
|
+
const contentRef = React70.useRef(null);
|
|
10950
|
+
const contentId = React70.useId();
|
|
10951
|
+
const closeRoot = React70.useCallback(() => setOpen(false), [setOpen]);
|
|
10952
|
+
const value = React70.useMemo(
|
|
10546
10953
|
() => ({
|
|
10547
10954
|
open,
|
|
10548
10955
|
setOpen,
|
|
@@ -10557,10 +10964,10 @@ function IrisMenu({
|
|
|
10557
10964
|
);
|
|
10558
10965
|
return /* @__PURE__ */ jsx(MenuContext.Provider, { value, children });
|
|
10559
10966
|
}
|
|
10560
|
-
var IrisMenuTrigger =
|
|
10967
|
+
var IrisMenuTrigger = React70.forwardRef(
|
|
10561
10968
|
function IrisMenuTrigger2({ asChild = false, onClick, onKeyDown, children, ...rest }, forwardedRef) {
|
|
10562
10969
|
const ctx = useMenuContext("IrisMenuTrigger");
|
|
10563
|
-
const captureRef =
|
|
10970
|
+
const captureRef = React70.useCallback(
|
|
10564
10971
|
(el) => {
|
|
10565
10972
|
ctx.triggerRef.current = el;
|
|
10566
10973
|
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
@@ -10591,7 +10998,7 @@ var IrisMenuTrigger = React67.forwardRef(
|
|
|
10591
10998
|
onKeyDown: handleKeyDown
|
|
10592
10999
|
};
|
|
10593
11000
|
if (asChild) {
|
|
10594
|
-
if (!
|
|
11001
|
+
if (!React70.isValidElement(children)) {
|
|
10595
11002
|
if (process.env.NODE_ENV !== "production") {
|
|
10596
11003
|
console.warn("[iris-ui] IrisMenuTrigger asChild requires a single React element");
|
|
10597
11004
|
}
|
|
@@ -10611,11 +11018,11 @@ var IrisMenuTrigger = React67.forwardRef(
|
|
|
10611
11018
|
);
|
|
10612
11019
|
}
|
|
10613
11020
|
);
|
|
10614
|
-
var IrisMenuContent =
|
|
11021
|
+
var IrisMenuContent = React70.forwardRef(
|
|
10615
11022
|
function IrisMenuContent2({ portalTarget, style, onKeyDown, children, ...rest }, forwardedRef) {
|
|
10616
11023
|
const ctx = useMenuContext("IrisMenuContent");
|
|
10617
|
-
const innerRef =
|
|
10618
|
-
const captureRef =
|
|
11024
|
+
const innerRef = React70.useRef(null);
|
|
11025
|
+
const captureRef = React70.useCallback(
|
|
10619
11026
|
(el) => {
|
|
10620
11027
|
innerRef.current = el;
|
|
10621
11028
|
ctx.contentRef.current = el;
|
|
@@ -10637,8 +11044,8 @@ var IrisMenuContent = React67.forwardRef(
|
|
|
10637
11044
|
exclude: [ctx.triggerRef, ctx.contentRef],
|
|
10638
11045
|
onDismiss: () => ctx.setOpen(false)
|
|
10639
11046
|
});
|
|
10640
|
-
const wasOpenRef =
|
|
10641
|
-
|
|
11047
|
+
const wasOpenRef = React70.useRef(false);
|
|
11048
|
+
React70.useEffect(() => {
|
|
10642
11049
|
if (ctx.open && !wasOpenRef.current) {
|
|
10643
11050
|
queueMicrotask(() => {
|
|
10644
11051
|
const items = innerRef.current?.querySelectorAll('[role="menuitem"]');
|
|
@@ -10649,7 +11056,7 @@ var IrisMenuContent = React67.forwardRef(
|
|
|
10649
11056
|
}
|
|
10650
11057
|
wasOpenRef.current = ctx.open;
|
|
10651
11058
|
}, [ctx.open, ctx.triggerRef]);
|
|
10652
|
-
const navRef =
|
|
11059
|
+
const navRef = React70.useRef(null);
|
|
10653
11060
|
if (navRef.current === null) {
|
|
10654
11061
|
navRef.current = createKeyboardNav({ count: 0, loop: true });
|
|
10655
11062
|
}
|
|
@@ -10693,15 +11100,14 @@ var IrisMenuContent = React67.forwardRef(
|
|
|
10693
11100
|
onKeyDown: handleKeyDown,
|
|
10694
11101
|
style: {
|
|
10695
11102
|
...floatingStyles,
|
|
10696
|
-
background: "var(--iris-surface)",
|
|
11103
|
+
background: "var(--iris-surface-floating)",
|
|
10697
11104
|
color: "var(--iris-foreground)",
|
|
10698
11105
|
border: "1px solid var(--iris-border)",
|
|
10699
11106
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
10700
11107
|
padding: "var(--iris-padding-sm, 4px)",
|
|
10701
|
-
boxShadow: "
|
|
11108
|
+
boxShadow: "var(--iris-shadow-lg)",
|
|
10702
11109
|
minWidth: 180,
|
|
10703
|
-
|
|
10704
|
-
zIndex: 1e3,
|
|
11110
|
+
zIndex: "var(--iris-z-popover, 1000)",
|
|
10705
11111
|
...style
|
|
10706
11112
|
},
|
|
10707
11113
|
children
|
|
@@ -10712,10 +11118,10 @@ var IrisMenuContent = React67.forwardRef(
|
|
|
10712
11118
|
return createPortal(node, portalTarget ?? document.body);
|
|
10713
11119
|
}
|
|
10714
11120
|
);
|
|
10715
|
-
var IrisMenuItem =
|
|
11121
|
+
var IrisMenuItem = React70.forwardRef(
|
|
10716
11122
|
function IrisMenuItem2({ disabled = false, keepOpen = false, onSelect, onClick, onKeyDown, style, children, ...rest }, ref) {
|
|
10717
11123
|
const ctx = useMenuContext("IrisMenuItem");
|
|
10718
|
-
const [hovered, setHovered] =
|
|
11124
|
+
const [hovered, setHovered] = React70.useState(false);
|
|
10719
11125
|
const fire = (event) => {
|
|
10720
11126
|
if (disabled) return;
|
|
10721
11127
|
onSelect?.(event);
|
|
@@ -10754,14 +11160,13 @@ var IrisMenuItem = React67.forwardRef(
|
|
|
10754
11160
|
display: "flex",
|
|
10755
11161
|
alignItems: "center",
|
|
10756
11162
|
gap: "var(--iris-gap-sm, 6px)",
|
|
10757
|
-
padding: "6px var(--iris-padding-md, 12px)",
|
|
11163
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
10758
11164
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
10759
11165
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
10760
11166
|
opacity: disabled ? 0.5 : 1,
|
|
10761
11167
|
background: hovered && !disabled ? "var(--iris-surface-hover)" : "transparent",
|
|
10762
11168
|
color: "inherit",
|
|
10763
|
-
|
|
10764
|
-
fontSize: 14,
|
|
11169
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
10765
11170
|
transition: "background-color 80ms ease",
|
|
10766
11171
|
...style
|
|
10767
11172
|
},
|
|
@@ -10770,7 +11175,7 @@ var IrisMenuItem = React67.forwardRef(
|
|
|
10770
11175
|
);
|
|
10771
11176
|
}
|
|
10772
11177
|
);
|
|
10773
|
-
var IrisMenuSeparator =
|
|
11178
|
+
var IrisMenuSeparator = React70.forwardRef(
|
|
10774
11179
|
function IrisMenuSeparator2({ style, ...rest }, ref) {
|
|
10775
11180
|
return /* @__PURE__ */ jsx(
|
|
10776
11181
|
"div",
|
|
@@ -10791,11 +11196,11 @@ function IrisMenuSub({
|
|
|
10791
11196
|
children
|
|
10792
11197
|
}) {
|
|
10793
11198
|
const parentCtx = useMenuContext("IrisMenuSub");
|
|
10794
|
-
const [open, setOpenState] =
|
|
10795
|
-
const triggerRef =
|
|
10796
|
-
const contentRef =
|
|
10797
|
-
const openTimerRef =
|
|
10798
|
-
const clearTimer =
|
|
11199
|
+
const [open, setOpenState] = React70.useState(false);
|
|
11200
|
+
const triggerRef = React70.useRef(null);
|
|
11201
|
+
const contentRef = React70.useRef(null);
|
|
11202
|
+
const openTimerRef = React70.useRef(null);
|
|
11203
|
+
const clearTimer = React70.useCallback(() => {
|
|
10799
11204
|
if (openTimerRef.current) {
|
|
10800
11205
|
clearTimeout(openTimerRef.current);
|
|
10801
11206
|
openTimerRef.current = null;
|
|
@@ -10808,7 +11213,7 @@ function IrisMenuSub({
|
|
|
10808
11213
|
openTimerRef.current = null;
|
|
10809
11214
|
}, HOVER_OPEN_DELAY);
|
|
10810
11215
|
};
|
|
10811
|
-
|
|
11216
|
+
React70.useEffect(() => clearTimer, [clearTimer]);
|
|
10812
11217
|
const { floatingStyles } = useFloating({
|
|
10813
11218
|
anchor: triggerRef,
|
|
10814
11219
|
floating: contentRef,
|
|
@@ -10816,9 +11221,9 @@ function IrisMenuSub({
|
|
|
10816
11221
|
placement: "right-start",
|
|
10817
11222
|
offset: -4
|
|
10818
11223
|
});
|
|
10819
|
-
const setOpen =
|
|
10820
|
-
const wasOpenRef =
|
|
10821
|
-
|
|
11224
|
+
const setOpen = React70.useCallback((v) => setOpenState(v), []);
|
|
11225
|
+
const wasOpenRef = React70.useRef(false);
|
|
11226
|
+
React70.useEffect(() => {
|
|
10822
11227
|
if (open && !wasOpenRef.current) {
|
|
10823
11228
|
queueMicrotask(() => {
|
|
10824
11229
|
const first = contentRef.current?.querySelector('[role="menuitem"]');
|
|
@@ -10863,7 +11268,7 @@ function IrisMenuSub({
|
|
|
10863
11268
|
parentCtx.closeRoot();
|
|
10864
11269
|
}
|
|
10865
11270
|
};
|
|
10866
|
-
const ctxValue =
|
|
11271
|
+
const ctxValue = React70.useMemo(
|
|
10867
11272
|
() => ({
|
|
10868
11273
|
open,
|
|
10869
11274
|
setOpen,
|
|
@@ -10897,11 +11302,10 @@ function IrisMenuSub({
|
|
|
10897
11302
|
alignItems: "center",
|
|
10898
11303
|
justifyContent: "space-between",
|
|
10899
11304
|
gap: "var(--iris-gap-sm, 6px)",
|
|
10900
|
-
padding: "6px var(--iris-padding-md, 12px)",
|
|
11305
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
10901
11306
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
10902
11307
|
cursor: "pointer",
|
|
10903
|
-
|
|
10904
|
-
fontSize: 14,
|
|
11308
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
10905
11309
|
background: open ? "var(--iris-surface-hover)" : "transparent"
|
|
10906
11310
|
},
|
|
10907
11311
|
children: [
|
|
@@ -10934,14 +11338,13 @@ function IrisMenuSub({
|
|
|
10934
11338
|
onPointerEnter: clearTimer,
|
|
10935
11339
|
style: {
|
|
10936
11340
|
...floatingStyles,
|
|
10937
|
-
background: "var(--iris-surface)",
|
|
11341
|
+
background: "var(--iris-surface-floating)",
|
|
10938
11342
|
color: "var(--iris-foreground)",
|
|
10939
11343
|
border: "1px solid var(--iris-border)",
|
|
10940
11344
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
10941
11345
|
padding: "var(--iris-padding-sm, 4px)",
|
|
10942
|
-
boxShadow: "
|
|
11346
|
+
boxShadow: "var(--iris-shadow-lg)",
|
|
10943
11347
|
minWidth: 180,
|
|
10944
|
-
outline: "none",
|
|
10945
11348
|
zIndex: 1001
|
|
10946
11349
|
},
|
|
10947
11350
|
children: /* @__PURE__ */ jsx(MenuContext.Provider, { value: ctxValue, children })
|
|
@@ -10954,7 +11357,7 @@ function IrisMenuSub({
|
|
|
10954
11357
|
] });
|
|
10955
11358
|
}
|
|
10956
11359
|
var TONE_TO_VAR4 = {
|
|
10957
|
-
info: "--iris-
|
|
11360
|
+
info: "--iris-info",
|
|
10958
11361
|
success: "--iris-success",
|
|
10959
11362
|
warning: "--iris-warning",
|
|
10960
11363
|
danger: "--iris-danger",
|
|
@@ -10975,7 +11378,7 @@ function IrisBanner({
|
|
|
10975
11378
|
}) {
|
|
10976
11379
|
const { t } = useI18n();
|
|
10977
11380
|
const isControlled = openProp !== void 0;
|
|
10978
|
-
const [internalOpen, setInternalOpen] =
|
|
11381
|
+
const [internalOpen, setInternalOpen] = React70.useState(defaultOpen);
|
|
10979
11382
|
const isOpen = isControlled ? Boolean(openProp) : internalOpen;
|
|
10980
11383
|
const handleClose = () => {
|
|
10981
11384
|
if (!isControlled) setInternalOpen(false);
|
|
@@ -11032,7 +11435,7 @@ function IrisBanner({
|
|
|
11032
11435
|
border: "none",
|
|
11033
11436
|
cursor: "pointer",
|
|
11034
11437
|
color: "var(--iris-muted)",
|
|
11035
|
-
fontSize:
|
|
11438
|
+
fontSize: "var(--iris-font-size-lg, 16px)",
|
|
11036
11439
|
padding: "0 4px",
|
|
11037
11440
|
lineHeight: 1,
|
|
11038
11441
|
flexShrink: 0
|
|
@@ -11066,7 +11469,7 @@ function IrisTimePicker({
|
|
|
11066
11469
|
}) {
|
|
11067
11470
|
const { t } = useI18n();
|
|
11068
11471
|
const isControlled = valueProp !== void 0;
|
|
11069
|
-
const [internal, setInternal] =
|
|
11472
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
11070
11473
|
const value = isControlled ? valueProp ?? defaultValue : internal;
|
|
11071
11474
|
const setValue = (next) => {
|
|
11072
11475
|
if (!isControlled) setInternal(next);
|
|
@@ -11145,12 +11548,12 @@ function IrisTimePicker({
|
|
|
11145
11548
|
const fieldStyle = {
|
|
11146
11549
|
width: 48,
|
|
11147
11550
|
height: 34,
|
|
11148
|
-
padding: "4px 6px",
|
|
11551
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-padding-sm, 6px)",
|
|
11149
11552
|
background: "var(--iris-background)",
|
|
11150
11553
|
color: "var(--iris-foreground)",
|
|
11151
11554
|
border: `1px solid ${invalid ? "var(--iris-danger)" : "var(--iris-border)"}`,
|
|
11152
11555
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
11153
|
-
fontSize:
|
|
11556
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
11154
11557
|
fontFamily: "inherit",
|
|
11155
11558
|
textAlign: "center",
|
|
11156
11559
|
outline: "none"
|
|
@@ -11188,7 +11591,14 @@ function IrisTimePicker({
|
|
|
11188
11591
|
style: fieldStyle
|
|
11189
11592
|
}
|
|
11190
11593
|
),
|
|
11191
|
-
/* @__PURE__ */ jsx(
|
|
11594
|
+
/* @__PURE__ */ jsx(
|
|
11595
|
+
"span",
|
|
11596
|
+
{
|
|
11597
|
+
"aria-hidden": "true",
|
|
11598
|
+
style: { color: "var(--iris-muted)", fontSize: "var(--iris-font-size-md, 14px)" },
|
|
11599
|
+
children: ":"
|
|
11600
|
+
}
|
|
11601
|
+
),
|
|
11192
11602
|
/* @__PURE__ */ jsx(
|
|
11193
11603
|
"input",
|
|
11194
11604
|
{
|
|
@@ -11222,7 +11632,7 @@ function IrisTimePicker({
|
|
|
11222
11632
|
border: "1px solid var(--iris-border)",
|
|
11223
11633
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
11224
11634
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
11225
|
-
fontSize:
|
|
11635
|
+
fontSize: "var(--iris-font-size-sm, 13px)",
|
|
11226
11636
|
fontFamily: "inherit",
|
|
11227
11637
|
fontWeight: 600
|
|
11228
11638
|
},
|
|
@@ -11257,14 +11667,14 @@ function IrisDateRangePicker({
|
|
|
11257
11667
|
}) {
|
|
11258
11668
|
const { t } = useI18n();
|
|
11259
11669
|
const isControlled = valueProp !== void 0;
|
|
11260
|
-
const [internal, setInternal] =
|
|
11670
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
11261
11671
|
const value = isControlled ? valueProp ?? { start: null, end: null } : internal;
|
|
11262
|
-
const [open, setOpen] =
|
|
11263
|
-
const leftMonth =
|
|
11672
|
+
const [open, setOpen] = React70.useState(false);
|
|
11673
|
+
const leftMonth = React70.useMemo(
|
|
11264
11674
|
() => value.start ? startOfMonth(value.start) : startOfMonth(/* @__PURE__ */ new Date()),
|
|
11265
11675
|
[value.start]
|
|
11266
11676
|
);
|
|
11267
|
-
const display =
|
|
11677
|
+
const display = React70.useMemo(() => {
|
|
11268
11678
|
const s = formatDisplay2(value.start, locale);
|
|
11269
11679
|
const e = formatDisplay2(value.end, locale);
|
|
11270
11680
|
if (s && e) return `${s} \u2192 ${e}`;
|
|
@@ -11305,14 +11715,14 @@ function IrisDateRangePicker({
|
|
|
11305
11715
|
style: {
|
|
11306
11716
|
display: "inline-flex",
|
|
11307
11717
|
alignItems: "center",
|
|
11308
|
-
padding: "6px 12px",
|
|
11718
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
11309
11719
|
background: "var(--iris-background)",
|
|
11310
11720
|
color: display ? "var(--iris-foreground)" : "var(--iris-muted)",
|
|
11311
11721
|
border: `1px solid ${invalid ? "var(--iris-danger)" : "var(--iris-border)"}`,
|
|
11312
11722
|
borderRadius: "var(--iris-radius-md, 6px)",
|
|
11313
11723
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
11314
11724
|
opacity: disabled ? 0.6 : 1,
|
|
11315
|
-
fontSize:
|
|
11725
|
+
fontSize: "var(--iris-font-size-md, 14px)",
|
|
11316
11726
|
fontFamily: "inherit",
|
|
11317
11727
|
minHeight: 34,
|
|
11318
11728
|
minWidth: 260,
|
|
@@ -11383,14 +11793,14 @@ function IrisSlider({
|
|
|
11383
11793
|
}) {
|
|
11384
11794
|
const { t } = useI18n();
|
|
11385
11795
|
const isControlled = valueProp !== void 0;
|
|
11386
|
-
const [internal, setInternal] =
|
|
11796
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
11387
11797
|
const raw = isControlled ? valueProp : internal;
|
|
11388
11798
|
const value = clamp4(roundToStep2(raw, step, min), min, max);
|
|
11389
|
-
const valueRef =
|
|
11799
|
+
const valueRef = React70.useRef(value);
|
|
11390
11800
|
valueRef.current = value;
|
|
11391
|
-
const trackRef =
|
|
11392
|
-
const thumbRef =
|
|
11393
|
-
const [dragging, setDragging] =
|
|
11801
|
+
const trackRef = React70.useRef(null);
|
|
11802
|
+
const thumbRef = React70.useRef(null);
|
|
11803
|
+
const [dragging, setDragging] = React70.useState(false);
|
|
11394
11804
|
const isHorizontal = orientation === "horizontal";
|
|
11395
11805
|
const setValue = (next) => {
|
|
11396
11806
|
const clamped = clamp4(roundToStep2(next, step, min), min, max);
|
|
@@ -11558,16 +11968,16 @@ function IrisRangeSlider({
|
|
|
11558
11968
|
}) {
|
|
11559
11969
|
const { t } = useI18n();
|
|
11560
11970
|
const isControlled = valueProp !== void 0;
|
|
11561
|
-
const [internal, setInternal] =
|
|
11971
|
+
const [internal, setInternal] = React70.useState(defaultValue);
|
|
11562
11972
|
const raw = isControlled ? valueProp : internal;
|
|
11563
11973
|
const startVal = clamp5(roundToStep3(raw[0] ?? min, step, min), min, max);
|
|
11564
11974
|
const endVal = clamp5(roundToStep3(raw[1] ?? max, step, min), min, max);
|
|
11565
|
-
const trackRef =
|
|
11566
|
-
const startRef =
|
|
11567
|
-
const endRef =
|
|
11568
|
-
const [dragging, setDragging] =
|
|
11975
|
+
const trackRef = React70.useRef(null);
|
|
11976
|
+
const startRef = React70.useRef(null);
|
|
11977
|
+
const endRef = React70.useRef(null);
|
|
11978
|
+
const [dragging, setDragging] = React70.useState(null);
|
|
11569
11979
|
const percent = (v) => (v - min) / Math.max(1e-9, max - min) * 100;
|
|
11570
|
-
const setRange =
|
|
11980
|
+
const setRange = React70.useCallback(
|
|
11571
11981
|
(next) => {
|
|
11572
11982
|
if (!isControlled) setInternal(next);
|
|
11573
11983
|
onChange?.(next);
|
|
@@ -11650,7 +12060,7 @@ function IrisRangeSlider({
|
|
|
11650
12060
|
style: {
|
|
11651
12061
|
position: "relative",
|
|
11652
12062
|
width: "100%",
|
|
11653
|
-
padding: "
|
|
12063
|
+
padding: "var(--iris-space-md, 16px) var(--iris-space-xs, 8px)",
|
|
11654
12064
|
...style
|
|
11655
12065
|
},
|
|
11656
12066
|
children: /* @__PURE__ */ jsxs(
|
|
@@ -11770,14 +12180,14 @@ function IrisColorPicker({
|
|
|
11770
12180
|
}) {
|
|
11771
12181
|
const { t } = useI18n();
|
|
11772
12182
|
const initialHex = value ?? defaultValue ?? "#000000";
|
|
11773
|
-
const [hsva, setHsva] =
|
|
12183
|
+
const [hsva, setHsva] = React70.useState(
|
|
11774
12184
|
() => rgbaToHsva(hexToRgba(initialHex) ?? { r: 0, g: 0, b: 0, a: 1 })
|
|
11775
12185
|
);
|
|
11776
|
-
const [hexDraft, setHexDraft] =
|
|
11777
|
-
const padRef =
|
|
11778
|
-
const hueRef =
|
|
11779
|
-
const alphaRef =
|
|
11780
|
-
|
|
12186
|
+
const [hexDraft, setHexDraft] = React70.useState(null);
|
|
12187
|
+
const padRef = React70.useRef(null);
|
|
12188
|
+
const hueRef = React70.useRef(null);
|
|
12189
|
+
const alphaRef = React70.useRef(null);
|
|
12190
|
+
React70.useEffect(() => {
|
|
11781
12191
|
if (value === void 0) return;
|
|
11782
12192
|
const parsed = hexToRgba(value);
|
|
11783
12193
|
if (!parsed) return;
|
|
@@ -12108,10 +12518,10 @@ function IrisCommandPalette({
|
|
|
12108
12518
|
const { t } = useI18n();
|
|
12109
12519
|
const resolvedPlaceholder = placeholder ?? t("commandPalette.placeholder");
|
|
12110
12520
|
const resolvedEmptyText = emptyText ?? t("commandPalette.empty");
|
|
12111
|
-
const [query, setQuery] =
|
|
12112
|
-
const [activeIndex, setActiveIndex] =
|
|
12113
|
-
const surfaceRef =
|
|
12114
|
-
const matches =
|
|
12521
|
+
const [query, setQuery] = React70.useState("");
|
|
12522
|
+
const [activeIndex, setActiveIndex] = React70.useState(0);
|
|
12523
|
+
const surfaceRef = React70.useRef(null);
|
|
12524
|
+
const matches = React70.useMemo(() => {
|
|
12115
12525
|
const result = [];
|
|
12116
12526
|
for (const item of items) {
|
|
12117
12527
|
const score = filter(query, item);
|
|
@@ -12120,7 +12530,7 @@ function IrisCommandPalette({
|
|
|
12120
12530
|
result.sort((a, b) => a.score - b.score);
|
|
12121
12531
|
return result;
|
|
12122
12532
|
}, [items, query, filter]);
|
|
12123
|
-
const groupedFlat =
|
|
12533
|
+
const groupedFlat = React70.useMemo(() => {
|
|
12124
12534
|
const out = [];
|
|
12125
12535
|
let currentGroup;
|
|
12126
12536
|
for (const m of matches) {
|
|
@@ -12133,19 +12543,19 @@ function IrisCommandPalette({
|
|
|
12133
12543
|
}
|
|
12134
12544
|
return out;
|
|
12135
12545
|
}, [matches]);
|
|
12136
|
-
const itemRows =
|
|
12546
|
+
const itemRows = React70.useMemo(() => {
|
|
12137
12547
|
const out = [];
|
|
12138
12548
|
groupedFlat.forEach((row, i) => {
|
|
12139
12549
|
if (row.kind === "item" && !row.item.disabled) out.push({ item: row.item, flat: i });
|
|
12140
12550
|
});
|
|
12141
12551
|
return out;
|
|
12142
12552
|
}, [groupedFlat]);
|
|
12143
|
-
|
|
12553
|
+
React70.useEffect(() => {
|
|
12144
12554
|
if (!open) return;
|
|
12145
12555
|
setQuery("");
|
|
12146
12556
|
setActiveIndex(0);
|
|
12147
12557
|
}, [open]);
|
|
12148
|
-
|
|
12558
|
+
React70.useEffect(() => {
|
|
12149
12559
|
setActiveIndex(0);
|
|
12150
12560
|
}, [query]);
|
|
12151
12561
|
useBodyScrollLock(open);
|
|
@@ -12162,7 +12572,7 @@ function IrisCommandPalette({
|
|
|
12162
12572
|
if (total === 0) return;
|
|
12163
12573
|
setActiveIndex((prev) => (prev + delta + total) % total);
|
|
12164
12574
|
};
|
|
12165
|
-
const keyHandlerRef =
|
|
12575
|
+
const keyHandlerRef = React70.useRef(() => {
|
|
12166
12576
|
});
|
|
12167
12577
|
keyHandlerRef.current = (event) => {
|
|
12168
12578
|
switch (event.key) {
|
|
@@ -12186,7 +12596,7 @@ function IrisCommandPalette({
|
|
|
12186
12596
|
break;
|
|
12187
12597
|
}
|
|
12188
12598
|
};
|
|
12189
|
-
|
|
12599
|
+
React70.useEffect(() => {
|
|
12190
12600
|
if (!open) return;
|
|
12191
12601
|
const onKey = (e) => keyHandlerRef.current(e);
|
|
12192
12602
|
document.addEventListener("keydown", onKey);
|
|
@@ -12230,7 +12640,7 @@ function IrisCommandPalette({
|
|
|
12230
12640
|
color: "var(--iris-foreground)",
|
|
12231
12641
|
border: "1px solid var(--iris-border)",
|
|
12232
12642
|
borderRadius: "var(--iris-radius-lg, 8px)",
|
|
12233
|
-
boxShadow: "
|
|
12643
|
+
boxShadow: "var(--iris-shadow-xl)",
|
|
12234
12644
|
overflow: "hidden",
|
|
12235
12645
|
...style
|
|
12236
12646
|
},
|
|
@@ -12246,11 +12656,11 @@ function IrisCommandPalette({
|
|
|
12246
12656
|
onChange: (e) => setQuery(e.target.value),
|
|
12247
12657
|
style: {
|
|
12248
12658
|
width: "100%",
|
|
12249
|
-
padding: "8px
|
|
12659
|
+
padding: "var(--iris-space-xs, 8px) var(--iris-space-sm, 12px)",
|
|
12250
12660
|
background: "transparent",
|
|
12251
12661
|
border: "none",
|
|
12252
12662
|
outline: "none",
|
|
12253
|
-
fontSize:
|
|
12663
|
+
fontSize: "var(--iris-font-size-lg, 16px)",
|
|
12254
12664
|
fontFamily: "inherit",
|
|
12255
12665
|
color: "inherit"
|
|
12256
12666
|
}
|
|
@@ -12267,7 +12677,12 @@ function IrisCommandPalette({
|
|
|
12267
12677
|
"li",
|
|
12268
12678
|
{
|
|
12269
12679
|
"data-iris-command-palette-empty": "",
|
|
12270
|
-
style: {
|
|
12680
|
+
style: {
|
|
12681
|
+
padding: 20,
|
|
12682
|
+
textAlign: "center",
|
|
12683
|
+
color: "var(--iris-muted)",
|
|
12684
|
+
fontSize: "var(--iris-font-size-sm, 13px)"
|
|
12685
|
+
},
|
|
12271
12686
|
children: resolvedEmptyText
|
|
12272
12687
|
}
|
|
12273
12688
|
) : groupedFlat.map((row, i) => {
|
|
@@ -12277,11 +12692,11 @@ function IrisCommandPalette({
|
|
|
12277
12692
|
{
|
|
12278
12693
|
"data-iris-command-palette-group": "",
|
|
12279
12694
|
style: {
|
|
12280
|
-
padding: "6px 12px",
|
|
12281
|
-
fontSize:
|
|
12695
|
+
padding: "var(--iris-padding-sm, 6px) var(--iris-padding-md, 12px)",
|
|
12696
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
12282
12697
|
fontWeight: 600,
|
|
12283
12698
|
textTransform: "uppercase",
|
|
12284
|
-
letterSpacing: "0.04em",
|
|
12699
|
+
letterSpacing: "var(--iris-letter-spacing-wide, 0.04em)",
|
|
12285
12700
|
color: "var(--iris-muted)"
|
|
12286
12701
|
},
|
|
12287
12702
|
children: row.label
|
|
@@ -12311,14 +12726,14 @@ function IrisCommandPalette({
|
|
|
12311
12726
|
style: {
|
|
12312
12727
|
display: "flex",
|
|
12313
12728
|
alignItems: "center",
|
|
12314
|
-
gap:
|
|
12729
|
+
gap: "var(--iris-space-sm, 12px)",
|
|
12315
12730
|
padding: "8px 12px",
|
|
12316
12731
|
borderRadius: "var(--iris-radius-sm, 4px)",
|
|
12317
12732
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
12318
12733
|
opacity: item.disabled ? 0.5 : 1,
|
|
12319
12734
|
background: isActive ? "var(--iris-surface-hover)" : "transparent",
|
|
12320
12735
|
color: "inherit",
|
|
12321
|
-
fontSize:
|
|
12736
|
+
fontSize: "var(--iris-font-size-md, 14px)"
|
|
12322
12737
|
},
|
|
12323
12738
|
children: [
|
|
12324
12739
|
item.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { width: 20, textAlign: "center" }, children: item.icon }) : null,
|
|
@@ -12328,8 +12743,8 @@ function IrisCommandPalette({
|
|
|
12328
12743
|
{
|
|
12329
12744
|
"data-iris-command-palette-shortcut": "",
|
|
12330
12745
|
style: {
|
|
12331
|
-
fontSize:
|
|
12332
|
-
padding: "
|
|
12746
|
+
fontSize: "var(--iris-font-size-xs, 12px)",
|
|
12747
|
+
padding: "var(--iris-space-xxs, 4px) var(--iris-padding-sm, 6px)",
|
|
12333
12748
|
background: "var(--iris-background)",
|
|
12334
12749
|
border: "1px solid var(--iris-border)",
|
|
12335
12750
|
borderRadius: "var(--iris-radius-sm, 4px)",
|