cetec-design-system 4.2.0-0 → 4.3.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +955 -67
- package/dist/index.js.map +1 -1
- package/dist/panda.buildinfo.json +18 -7
- package/dist/preset.js +158 -0
- package/dist/preset.js.map +1 -1
- package/dist/specs/recipes.json +25 -0
- package/dist/styles.css +206 -14
- package/dist/types/index.d.ts +327 -0
- package/package.json +3 -1
- package/src/recipes/recipes-slot.ts +1 -0
- package/src/recipes/tabs.ts +161 -0
- package/src/utils/compoundComponent.ts +29 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { createContext, useContext, useMemo, forwardRef, createElement, useLayoutEffect, useState, useRef, useSyncExternalStore,
|
|
3
|
+
import { createContext, useContext, useMemo, forwardRef, createElement, useLayoutEffect, useState, useRef, useSyncExternalStore, useCallback, useEffect, useId as useId$1, isValidElement, Children, cloneElement, useReducer, Fragment as Fragment$1 } from "react";
|
|
4
4
|
import * as ReactDOM from "react-dom";
|
|
5
5
|
import { b as breakpoints, c as containerSizes } from "./containerSizes-nJuD-1Ap.js";
|
|
6
6
|
import { useForm } from "@tanstack/react-form";
|
|
@@ -974,7 +974,7 @@ const spinnerVariantKeys = [
|
|
|
974
974
|
"inverse",
|
|
975
975
|
"centered"
|
|
976
976
|
];
|
|
977
|
-
const getVariantProps$
|
|
977
|
+
const getVariantProps$w = (variants) => ({ ...spinnerDefaultVariants, ...compact(variants) });
|
|
978
978
|
const spinner = /* @__PURE__ */ Object.assign(spinnerFn, {
|
|
979
979
|
__recipe__: false,
|
|
980
980
|
__name__: "spinner",
|
|
@@ -999,7 +999,7 @@ const spinner = /* @__PURE__ */ Object.assign(spinnerFn, {
|
|
|
999
999
|
splitVariantProps(props) {
|
|
1000
1000
|
return splitProps$1(props, spinnerVariantKeys);
|
|
1001
1001
|
},
|
|
1002
|
-
getVariantProps: getVariantProps$
|
|
1002
|
+
getVariantProps: getVariantProps$w
|
|
1003
1003
|
});
|
|
1004
1004
|
const tagFn = /* @__PURE__ */ createRecipe("tag", {
|
|
1005
1005
|
"variant": "default",
|
|
@@ -1667,7 +1667,7 @@ const toggleFn = memo((props = {}) => {
|
|
|
1667
1667
|
return Object.fromEntries(toggleSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
1668
1668
|
});
|
|
1669
1669
|
const toggleVariantKeys = [];
|
|
1670
|
-
const getVariantProps$
|
|
1670
|
+
const getVariantProps$v = (variants) => ({ ...toggleDefaultVariants, ...compact(variants) });
|
|
1671
1671
|
const toggle = /* @__PURE__ */ Object.assign(toggleFn, {
|
|
1672
1672
|
__recipe__: false,
|
|
1673
1673
|
__name__: "toggle",
|
|
@@ -1678,7 +1678,7 @@ const toggle = /* @__PURE__ */ Object.assign(toggleFn, {
|
|
|
1678
1678
|
splitVariantProps(props) {
|
|
1679
1679
|
return splitProps$1(props, toggleVariantKeys);
|
|
1680
1680
|
},
|
|
1681
|
-
getVariantProps: getVariantProps$
|
|
1681
|
+
getVariantProps: getVariantProps$v
|
|
1682
1682
|
});
|
|
1683
1683
|
const alertDefaultVariants = {
|
|
1684
1684
|
"tone": "info"
|
|
@@ -1721,7 +1721,7 @@ const alertFn = memo((props = {}) => {
|
|
|
1721
1721
|
const alertVariantKeys = [
|
|
1722
1722
|
"tone"
|
|
1723
1723
|
];
|
|
1724
|
-
const getVariantProps$
|
|
1724
|
+
const getVariantProps$u = (variants) => ({ ...alertDefaultVariants, ...compact(variants) });
|
|
1725
1725
|
const alert = /* @__PURE__ */ Object.assign(alertFn, {
|
|
1726
1726
|
__recipe__: false,
|
|
1727
1727
|
__name__: "alert",
|
|
@@ -1740,7 +1740,7 @@ const alert = /* @__PURE__ */ Object.assign(alertFn, {
|
|
|
1740
1740
|
splitVariantProps(props) {
|
|
1741
1741
|
return splitProps$1(props, alertVariantKeys);
|
|
1742
1742
|
},
|
|
1743
|
-
getVariantProps: getVariantProps$
|
|
1743
|
+
getVariantProps: getVariantProps$u
|
|
1744
1744
|
});
|
|
1745
1745
|
const autocompleteDefaultVariants = {
|
|
1746
1746
|
"size": "md",
|
|
@@ -1797,7 +1797,7 @@ const autocompleteVariantKeys = [
|
|
|
1797
1797
|
"layer",
|
|
1798
1798
|
"size"
|
|
1799
1799
|
];
|
|
1800
|
-
const getVariantProps$
|
|
1800
|
+
const getVariantProps$t = (variants) => ({ ...autocompleteDefaultVariants, ...compact(variants) });
|
|
1801
1801
|
const autocomplete = /* @__PURE__ */ Object.assign(autocompleteFn, {
|
|
1802
1802
|
__recipe__: false,
|
|
1803
1803
|
__name__: "autocomplete",
|
|
@@ -1819,7 +1819,7 @@ const autocomplete = /* @__PURE__ */ Object.assign(autocompleteFn, {
|
|
|
1819
1819
|
splitVariantProps(props) {
|
|
1820
1820
|
return splitProps$1(props, autocompleteVariantKeys);
|
|
1821
1821
|
},
|
|
1822
|
-
getVariantProps: getVariantProps$
|
|
1822
|
+
getVariantProps: getVariantProps$t
|
|
1823
1823
|
});
|
|
1824
1824
|
const avatarDefaultVariants = {
|
|
1825
1825
|
"size": "md",
|
|
@@ -1856,7 +1856,7 @@ const avatarVariantKeys = [
|
|
|
1856
1856
|
"size",
|
|
1857
1857
|
"shape"
|
|
1858
1858
|
];
|
|
1859
|
-
const getVariantProps$
|
|
1859
|
+
const getVariantProps$s = (variants) => ({ ...avatarDefaultVariants, ...compact(variants) });
|
|
1860
1860
|
const avatar = /* @__PURE__ */ Object.assign(avatarFn, {
|
|
1861
1861
|
__recipe__: false,
|
|
1862
1862
|
__name__: "avatar",
|
|
@@ -1881,7 +1881,7 @@ const avatar = /* @__PURE__ */ Object.assign(avatarFn, {
|
|
|
1881
1881
|
splitVariantProps(props) {
|
|
1882
1882
|
return splitProps$1(props, avatarVariantKeys);
|
|
1883
1883
|
},
|
|
1884
|
-
getVariantProps: getVariantProps$
|
|
1884
|
+
getVariantProps: getVariantProps$s
|
|
1885
1885
|
});
|
|
1886
1886
|
const badgeDefaultVariants = {
|
|
1887
1887
|
"size": "md",
|
|
@@ -1908,7 +1908,7 @@ const badgeVariantKeys = [
|
|
|
1908
1908
|
"dot",
|
|
1909
1909
|
"variant"
|
|
1910
1910
|
];
|
|
1911
|
-
const getVariantProps$
|
|
1911
|
+
const getVariantProps$r = (variants) => ({ ...badgeDefaultVariants, ...compact(variants) });
|
|
1912
1912
|
const badge = /* @__PURE__ */ Object.assign(badgeFn, {
|
|
1913
1913
|
__recipe__: false,
|
|
1914
1914
|
__name__: "badge",
|
|
@@ -1944,7 +1944,7 @@ const badge = /* @__PURE__ */ Object.assign(badgeFn, {
|
|
|
1944
1944
|
splitVariantProps(props) {
|
|
1945
1945
|
return splitProps$1(props, badgeVariantKeys);
|
|
1946
1946
|
},
|
|
1947
|
-
getVariantProps: getVariantProps$
|
|
1947
|
+
getVariantProps: getVariantProps$r
|
|
1948
1948
|
});
|
|
1949
1949
|
const breadcrumbsDefaultVariants = {};
|
|
1950
1950
|
const breadcrumbsCompoundVariants = [];
|
|
@@ -1971,7 +1971,7 @@ const breadcrumbsFn = memo((props = {}) => {
|
|
|
1971
1971
|
return Object.fromEntries(breadcrumbsSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
1972
1972
|
});
|
|
1973
1973
|
const breadcrumbsVariantKeys = [];
|
|
1974
|
-
const getVariantProps$
|
|
1974
|
+
const getVariantProps$q = (variants) => ({ ...breadcrumbsDefaultVariants, ...compact(variants) });
|
|
1975
1975
|
const breadcrumbs = /* @__PURE__ */ Object.assign(breadcrumbsFn, {
|
|
1976
1976
|
__recipe__: false,
|
|
1977
1977
|
__name__: "breadcrumbs",
|
|
@@ -1982,7 +1982,7 @@ const breadcrumbs = /* @__PURE__ */ Object.assign(breadcrumbsFn, {
|
|
|
1982
1982
|
splitVariantProps(props) {
|
|
1983
1983
|
return splitProps$1(props, breadcrumbsVariantKeys);
|
|
1984
1984
|
},
|
|
1985
|
-
getVariantProps: getVariantProps$
|
|
1985
|
+
getVariantProps: getVariantProps$q
|
|
1986
1986
|
});
|
|
1987
1987
|
const buttonDefaultVariants = {
|
|
1988
1988
|
"variant": "standard",
|
|
@@ -2013,7 +2013,7 @@ const buttonVariantKeys = [
|
|
|
2013
2013
|
"before",
|
|
2014
2014
|
"after"
|
|
2015
2015
|
];
|
|
2016
|
-
const getVariantProps$
|
|
2016
|
+
const getVariantProps$p = (variants) => ({ ...buttonDefaultVariants, ...compact(variants) });
|
|
2017
2017
|
const button = /* @__PURE__ */ Object.assign(buttonFn, {
|
|
2018
2018
|
__recipe__: false,
|
|
2019
2019
|
__name__: "button",
|
|
@@ -2047,7 +2047,7 @@ const button = /* @__PURE__ */ Object.assign(buttonFn, {
|
|
|
2047
2047
|
splitVariantProps(props) {
|
|
2048
2048
|
return splitProps$1(props, buttonVariantKeys);
|
|
2049
2049
|
},
|
|
2050
|
-
getVariantProps: getVariantProps$
|
|
2050
|
+
getVariantProps: getVariantProps$p
|
|
2051
2051
|
});
|
|
2052
2052
|
const calendarDefaultVariants = {
|
|
2053
2053
|
"type": "days"
|
|
@@ -2086,7 +2086,7 @@ const calendarFn = memo((props = {}) => {
|
|
|
2086
2086
|
const calendarVariantKeys = [
|
|
2087
2087
|
"type"
|
|
2088
2088
|
];
|
|
2089
|
-
const getVariantProps$
|
|
2089
|
+
const getVariantProps$o = (variants) => ({ ...calendarDefaultVariants, ...compact(variants) });
|
|
2090
2090
|
const calendar = /* @__PURE__ */ Object.assign(calendarFn, {
|
|
2091
2091
|
__recipe__: false,
|
|
2092
2092
|
__name__: "calendar",
|
|
@@ -2103,7 +2103,7 @@ const calendar = /* @__PURE__ */ Object.assign(calendarFn, {
|
|
|
2103
2103
|
splitVariantProps(props) {
|
|
2104
2104
|
return splitProps$1(props, calendarVariantKeys);
|
|
2105
2105
|
},
|
|
2106
|
-
getVariantProps: getVariantProps$
|
|
2106
|
+
getVariantProps: getVariantProps$o
|
|
2107
2107
|
});
|
|
2108
2108
|
const checkboxDefaultVariants = {};
|
|
2109
2109
|
const checkboxCompoundVariants = [];
|
|
@@ -2130,7 +2130,7 @@ const checkboxFn = memo((props = {}) => {
|
|
|
2130
2130
|
return Object.fromEntries(checkboxSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2131
2131
|
});
|
|
2132
2132
|
const checkboxVariantKeys = [];
|
|
2133
|
-
const getVariantProps$
|
|
2133
|
+
const getVariantProps$n = (variants) => ({ ...checkboxDefaultVariants, ...compact(variants) });
|
|
2134
2134
|
const checkbox = /* @__PURE__ */ Object.assign(checkboxFn, {
|
|
2135
2135
|
__recipe__: false,
|
|
2136
2136
|
__name__: "checkbox",
|
|
@@ -2141,7 +2141,7 @@ const checkbox = /* @__PURE__ */ Object.assign(checkboxFn, {
|
|
|
2141
2141
|
splitVariantProps(props) {
|
|
2142
2142
|
return splitProps$1(props, checkboxVariantKeys);
|
|
2143
2143
|
},
|
|
2144
|
-
getVariantProps: getVariantProps$
|
|
2144
|
+
getVariantProps: getVariantProps$n
|
|
2145
2145
|
});
|
|
2146
2146
|
const chipDefaultVariants = {
|
|
2147
2147
|
"size": "md"
|
|
@@ -2179,7 +2179,7 @@ const chipVariantKeys = [
|
|
|
2179
2179
|
"after",
|
|
2180
2180
|
"dismissable"
|
|
2181
2181
|
];
|
|
2182
|
-
const getVariantProps$
|
|
2182
|
+
const getVariantProps$m = (variants) => ({ ...chipDefaultVariants, ...compact(variants) });
|
|
2183
2183
|
const chip = /* @__PURE__ */ Object.assign(chipFn, {
|
|
2184
2184
|
__recipe__: false,
|
|
2185
2185
|
__name__: "chip",
|
|
@@ -2206,7 +2206,7 @@ const chip = /* @__PURE__ */ Object.assign(chipFn, {
|
|
|
2206
2206
|
splitVariantProps(props) {
|
|
2207
2207
|
return splitProps$1(props, chipVariantKeys);
|
|
2208
2208
|
},
|
|
2209
|
-
getVariantProps: getVariantProps$
|
|
2209
|
+
getVariantProps: getVariantProps$m
|
|
2210
2210
|
});
|
|
2211
2211
|
const codeBlockDefaultVariants = {
|
|
2212
2212
|
"tone": "default",
|
|
@@ -2275,7 +2275,7 @@ const codeBlockVariantKeys = [
|
|
|
2275
2275
|
"collapsed",
|
|
2276
2276
|
"actionGutter"
|
|
2277
2277
|
];
|
|
2278
|
-
const getVariantProps$
|
|
2278
|
+
const getVariantProps$l = (variants) => ({ ...codeBlockDefaultVariants, ...compact(variants) });
|
|
2279
2279
|
const codeBlock = /* @__PURE__ */ Object.assign(codeBlockFn, {
|
|
2280
2280
|
__recipe__: false,
|
|
2281
2281
|
__name__: "codeBlock",
|
|
@@ -2311,7 +2311,7 @@ const codeBlock = /* @__PURE__ */ Object.assign(codeBlockFn, {
|
|
|
2311
2311
|
splitVariantProps(props) {
|
|
2312
2312
|
return splitProps$1(props, codeBlockVariantKeys);
|
|
2313
2313
|
},
|
|
2314
|
-
getVariantProps: getVariantProps$
|
|
2314
|
+
getVariantProps: getVariantProps$l
|
|
2315
2315
|
});
|
|
2316
2316
|
const dateMenusDefaultVariants = {};
|
|
2317
2317
|
const dateMenusCompoundVariants = [];
|
|
@@ -2334,7 +2334,7 @@ const dateMenusFn = memo((props = {}) => {
|
|
|
2334
2334
|
return Object.fromEntries(dateMenusSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2335
2335
|
});
|
|
2336
2336
|
const dateMenusVariantKeys = [];
|
|
2337
|
-
const getVariantProps$
|
|
2337
|
+
const getVariantProps$k = (variants) => ({ ...dateMenusDefaultVariants, ...compact(variants) });
|
|
2338
2338
|
const dateMenus = /* @__PURE__ */ Object.assign(dateMenusFn, {
|
|
2339
2339
|
__recipe__: false,
|
|
2340
2340
|
__name__: "dateMenus",
|
|
@@ -2345,7 +2345,7 @@ const dateMenus = /* @__PURE__ */ Object.assign(dateMenusFn, {
|
|
|
2345
2345
|
splitVariantProps(props) {
|
|
2346
2346
|
return splitProps$1(props, dateMenusVariantKeys);
|
|
2347
2347
|
},
|
|
2348
|
-
getVariantProps: getVariantProps$
|
|
2348
|
+
getVariantProps: getVariantProps$k
|
|
2349
2349
|
});
|
|
2350
2350
|
const dateTimeMenusDefaultVariants = {};
|
|
2351
2351
|
const dateTimeMenusCompoundVariants = [];
|
|
@@ -2368,7 +2368,7 @@ const dateTimeMenusFn = memo((props = {}) => {
|
|
|
2368
2368
|
return Object.fromEntries(dateTimeMenusSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2369
2369
|
});
|
|
2370
2370
|
const dateTimeMenusVariantKeys = [];
|
|
2371
|
-
const getVariantProps$
|
|
2371
|
+
const getVariantProps$j = (variants) => ({ ...dateTimeMenusDefaultVariants, ...compact(variants) });
|
|
2372
2372
|
const dateTimeMenus = /* @__PURE__ */ Object.assign(dateTimeMenusFn, {
|
|
2373
2373
|
__recipe__: false,
|
|
2374
2374
|
__name__: "dateTimeMenus",
|
|
@@ -2379,7 +2379,7 @@ const dateTimeMenus = /* @__PURE__ */ Object.assign(dateTimeMenusFn, {
|
|
|
2379
2379
|
splitVariantProps(props) {
|
|
2380
2380
|
return splitProps$1(props, dateTimeMenusVariantKeys);
|
|
2381
2381
|
},
|
|
2382
|
-
getVariantProps: getVariantProps$
|
|
2382
|
+
getVariantProps: getVariantProps$j
|
|
2383
2383
|
});
|
|
2384
2384
|
const drawerDefaultVariants = {
|
|
2385
2385
|
"side": "right",
|
|
@@ -2426,7 +2426,7 @@ const drawerVariantKeys = [
|
|
|
2426
2426
|
"size",
|
|
2427
2427
|
"scrollable"
|
|
2428
2428
|
];
|
|
2429
|
-
const getVariantProps$
|
|
2429
|
+
const getVariantProps$i = (variants) => ({ ...drawerDefaultVariants, ...compact(variants) });
|
|
2430
2430
|
const drawer = /* @__PURE__ */ Object.assign(drawerFn, {
|
|
2431
2431
|
__recipe__: false,
|
|
2432
2432
|
__name__: "drawer",
|
|
@@ -2453,7 +2453,7 @@ const drawer = /* @__PURE__ */ Object.assign(drawerFn, {
|
|
|
2453
2453
|
splitVariantProps(props) {
|
|
2454
2454
|
return splitProps$1(props, drawerVariantKeys);
|
|
2455
2455
|
},
|
|
2456
|
-
getVariantProps: getVariantProps$
|
|
2456
|
+
getVariantProps: getVariantProps$i
|
|
2457
2457
|
});
|
|
2458
2458
|
const formFieldDefaultVariants = {
|
|
2459
2459
|
"layout": "default",
|
|
@@ -2482,7 +2482,7 @@ const formFieldVariantKeys = [
|
|
|
2482
2482
|
"layout",
|
|
2483
2483
|
"size"
|
|
2484
2484
|
];
|
|
2485
|
-
const getVariantProps$
|
|
2485
|
+
const getVariantProps$h = (variants) => ({ ...formFieldDefaultVariants, ...compact(variants) });
|
|
2486
2486
|
const formField = /* @__PURE__ */ Object.assign(formFieldFn, {
|
|
2487
2487
|
__recipe__: false,
|
|
2488
2488
|
__name__: "formField",
|
|
@@ -2504,7 +2504,7 @@ const formField = /* @__PURE__ */ Object.assign(formFieldFn, {
|
|
|
2504
2504
|
splitVariantProps(props) {
|
|
2505
2505
|
return splitProps$1(props, formFieldVariantKeys);
|
|
2506
2506
|
},
|
|
2507
|
-
getVariantProps: getVariantProps$
|
|
2507
|
+
getVariantProps: getVariantProps$h
|
|
2508
2508
|
});
|
|
2509
2509
|
const iconButtonDefaultVariants = {
|
|
2510
2510
|
"variant": "standard",
|
|
@@ -2533,7 +2533,7 @@ const iconButtonVariantKeys = [
|
|
|
2533
2533
|
"variant",
|
|
2534
2534
|
"size"
|
|
2535
2535
|
];
|
|
2536
|
-
const getVariantProps$
|
|
2536
|
+
const getVariantProps$g = (variants) => ({ ...iconButtonDefaultVariants, ...compact(variants) });
|
|
2537
2537
|
const iconButton = /* @__PURE__ */ Object.assign(iconButtonFn, {
|
|
2538
2538
|
__recipe__: false,
|
|
2539
2539
|
__name__: "iconButton",
|
|
@@ -2561,7 +2561,7 @@ const iconButton = /* @__PURE__ */ Object.assign(iconButtonFn, {
|
|
|
2561
2561
|
splitVariantProps(props) {
|
|
2562
2562
|
return splitProps$1(props, iconButtonVariantKeys);
|
|
2563
2563
|
},
|
|
2564
|
-
getVariantProps: getVariantProps$
|
|
2564
|
+
getVariantProps: getVariantProps$g
|
|
2565
2565
|
});
|
|
2566
2566
|
const inlineNoteDefaultVariants = {
|
|
2567
2567
|
"tone": "info"
|
|
@@ -2588,7 +2588,7 @@ const inlineNoteFn = memo((props = {}) => {
|
|
|
2588
2588
|
const inlineNoteVariantKeys = [
|
|
2589
2589
|
"tone"
|
|
2590
2590
|
];
|
|
2591
|
-
const getVariantProps$
|
|
2591
|
+
const getVariantProps$f = (variants) => ({ ...inlineNoteDefaultVariants, ...compact(variants) });
|
|
2592
2592
|
const inlineNote = /* @__PURE__ */ Object.assign(inlineNoteFn, {
|
|
2593
2593
|
__recipe__: false,
|
|
2594
2594
|
__name__: "inlineNote",
|
|
@@ -2607,7 +2607,7 @@ const inlineNote = /* @__PURE__ */ Object.assign(inlineNoteFn, {
|
|
|
2607
2607
|
splitVariantProps(props) {
|
|
2608
2608
|
return splitProps$1(props, inlineNoteVariantKeys);
|
|
2609
2609
|
},
|
|
2610
|
-
getVariantProps: getVariantProps$
|
|
2610
|
+
getVariantProps: getVariantProps$f
|
|
2611
2611
|
});
|
|
2612
2612
|
const kbdDefaultVariants = {
|
|
2613
2613
|
"variant": "default"
|
|
@@ -2630,7 +2630,7 @@ const kbdFn = memo((props = {}) => {
|
|
|
2630
2630
|
const kbdVariantKeys = [
|
|
2631
2631
|
"variant"
|
|
2632
2632
|
];
|
|
2633
|
-
const getVariantProps$
|
|
2633
|
+
const getVariantProps$e = (variants) => ({ ...kbdDefaultVariants, ...compact(variants) });
|
|
2634
2634
|
const kbd = /* @__PURE__ */ Object.assign(kbdFn, {
|
|
2635
2635
|
__recipe__: false,
|
|
2636
2636
|
__name__: "kbd",
|
|
@@ -2646,7 +2646,7 @@ const kbd = /* @__PURE__ */ Object.assign(kbdFn, {
|
|
|
2646
2646
|
splitVariantProps(props) {
|
|
2647
2647
|
return splitProps$1(props, kbdVariantKeys);
|
|
2648
2648
|
},
|
|
2649
|
-
getVariantProps: getVariantProps$
|
|
2649
|
+
getVariantProps: getVariantProps$e
|
|
2650
2650
|
});
|
|
2651
2651
|
const listItemGroupDefaultVariants = {
|
|
2652
2652
|
"density": "compact"
|
|
@@ -2673,7 +2673,7 @@ const listItemGroupFn = memo((props = {}) => {
|
|
|
2673
2673
|
const listItemGroupVariantKeys = [
|
|
2674
2674
|
"density"
|
|
2675
2675
|
];
|
|
2676
|
-
const getVariantProps$
|
|
2676
|
+
const getVariantProps$d = (variants) => ({ ...listItemGroupDefaultVariants, ...compact(variants) });
|
|
2677
2677
|
const listItemGroup = /* @__PURE__ */ Object.assign(listItemGroupFn, {
|
|
2678
2678
|
__recipe__: false,
|
|
2679
2679
|
__name__: "listItemGroup",
|
|
@@ -2690,7 +2690,7 @@ const listItemGroup = /* @__PURE__ */ Object.assign(listItemGroupFn, {
|
|
|
2690
2690
|
splitVariantProps(props) {
|
|
2691
2691
|
return splitProps$1(props, listItemGroupVariantKeys);
|
|
2692
2692
|
},
|
|
2693
|
-
getVariantProps: getVariantProps$
|
|
2693
|
+
getVariantProps: getVariantProps$d
|
|
2694
2694
|
});
|
|
2695
2695
|
const listItemDefaultVariants = {
|
|
2696
2696
|
"variant": "default",
|
|
@@ -2746,7 +2746,7 @@ const listItemVariantKeys = [
|
|
|
2746
2746
|
"iconBefore",
|
|
2747
2747
|
"iconAfter"
|
|
2748
2748
|
];
|
|
2749
|
-
const getVariantProps$
|
|
2749
|
+
const getVariantProps$c = (variants) => ({ ...listItemDefaultVariants, ...compact(variants) });
|
|
2750
2750
|
const listItem = /* @__PURE__ */ Object.assign(listItemFn, {
|
|
2751
2751
|
__recipe__: false,
|
|
2752
2752
|
__name__: "listItem",
|
|
@@ -2781,7 +2781,7 @@ const listItem = /* @__PURE__ */ Object.assign(listItemFn, {
|
|
|
2781
2781
|
splitVariantProps(props) {
|
|
2782
2782
|
return splitProps$1(props, listItemVariantKeys);
|
|
2783
2783
|
},
|
|
2784
|
-
getVariantProps: getVariantProps$
|
|
2784
|
+
getVariantProps: getVariantProps$c
|
|
2785
2785
|
});
|
|
2786
2786
|
const menuDefaultVariants = {
|
|
2787
2787
|
"density": "compact",
|
|
@@ -2828,7 +2828,7 @@ const menuVariantKeys = [
|
|
|
2828
2828
|
"panel",
|
|
2829
2829
|
"scrollable"
|
|
2830
2830
|
];
|
|
2831
|
-
const getVariantProps$
|
|
2831
|
+
const getVariantProps$b = (variants) => ({ ...menuDefaultVariants, ...compact(variants) });
|
|
2832
2832
|
const menu = /* @__PURE__ */ Object.assign(menuFn, {
|
|
2833
2833
|
__recipe__: false,
|
|
2834
2834
|
__name__: "menu",
|
|
@@ -2855,7 +2855,7 @@ const menu = /* @__PURE__ */ Object.assign(menuFn, {
|
|
|
2855
2855
|
splitVariantProps(props) {
|
|
2856
2856
|
return splitProps$1(props, menuVariantKeys);
|
|
2857
2857
|
},
|
|
2858
|
-
getVariantProps: getVariantProps$
|
|
2858
|
+
getVariantProps: getVariantProps$b
|
|
2859
2859
|
});
|
|
2860
2860
|
const modalDefaultVariants = {
|
|
2861
2861
|
"size": "md",
|
|
@@ -2904,7 +2904,7 @@ const modalVariantKeys = [
|
|
|
2904
2904
|
"size",
|
|
2905
2905
|
"position"
|
|
2906
2906
|
];
|
|
2907
|
-
const getVariantProps$
|
|
2907
|
+
const getVariantProps$a = (variants) => ({ ...modalDefaultVariants, ...compact(variants) });
|
|
2908
2908
|
const modal = /* @__PURE__ */ Object.assign(modalFn, {
|
|
2909
2909
|
__recipe__: false,
|
|
2910
2910
|
__name__: "modal",
|
|
@@ -2928,7 +2928,7 @@ const modal = /* @__PURE__ */ Object.assign(modalFn, {
|
|
|
2928
2928
|
splitVariantProps(props) {
|
|
2929
2929
|
return splitProps$1(props, modalVariantKeys);
|
|
2930
2930
|
},
|
|
2931
|
-
getVariantProps: getVariantProps$
|
|
2931
|
+
getVariantProps: getVariantProps$a
|
|
2932
2932
|
});
|
|
2933
2933
|
const pageBannerDefaultVariants = {
|
|
2934
2934
|
"tone": "info"
|
|
@@ -2963,7 +2963,7 @@ const pageBannerFn = memo((props = {}) => {
|
|
|
2963
2963
|
const pageBannerVariantKeys = [
|
|
2964
2964
|
"tone"
|
|
2965
2965
|
];
|
|
2966
|
-
const getVariantProps$
|
|
2966
|
+
const getVariantProps$9 = (variants) => ({ ...pageBannerDefaultVariants, ...compact(variants) });
|
|
2967
2967
|
const pageBanner = /* @__PURE__ */ Object.assign(pageBannerFn, {
|
|
2968
2968
|
__recipe__: false,
|
|
2969
2969
|
__name__: "pageBanner",
|
|
@@ -2982,7 +2982,7 @@ const pageBanner = /* @__PURE__ */ Object.assign(pageBannerFn, {
|
|
|
2982
2982
|
splitVariantProps(props) {
|
|
2983
2983
|
return splitProps$1(props, pageBannerVariantKeys);
|
|
2984
2984
|
},
|
|
2985
|
-
getVariantProps: getVariantProps$
|
|
2985
|
+
getVariantProps: getVariantProps$9
|
|
2986
2986
|
});
|
|
2987
2987
|
const radioDefaultVariants = {};
|
|
2988
2988
|
const radioCompoundVariants = [];
|
|
@@ -3009,7 +3009,7 @@ const radioFn = memo((props = {}) => {
|
|
|
3009
3009
|
return Object.fromEntries(radioSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
3010
3010
|
});
|
|
3011
3011
|
const radioVariantKeys = [];
|
|
3012
|
-
const getVariantProps$
|
|
3012
|
+
const getVariantProps$8 = (variants) => ({ ...radioDefaultVariants, ...compact(variants) });
|
|
3013
3013
|
const radio = /* @__PURE__ */ Object.assign(radioFn, {
|
|
3014
3014
|
__recipe__: false,
|
|
3015
3015
|
__name__: "radio",
|
|
@@ -3020,7 +3020,7 @@ const radio = /* @__PURE__ */ Object.assign(radioFn, {
|
|
|
3020
3020
|
splitVariantProps(props) {
|
|
3021
3021
|
return splitProps$1(props, radioVariantKeys);
|
|
3022
3022
|
},
|
|
3023
|
-
getVariantProps: getVariantProps$
|
|
3023
|
+
getVariantProps: getVariantProps$8
|
|
3024
3024
|
});
|
|
3025
3025
|
const segmentedFieldsDefaultVariants = {
|
|
3026
3026
|
"size": "md"
|
|
@@ -3055,7 +3055,7 @@ const segmentedFieldsVariantKeys = [
|
|
|
3055
3055
|
"before",
|
|
3056
3056
|
"after"
|
|
3057
3057
|
];
|
|
3058
|
-
const getVariantProps$
|
|
3058
|
+
const getVariantProps$7 = (variants) => ({ ...segmentedFieldsDefaultVariants, ...compact(variants) });
|
|
3059
3059
|
const segmentedFields = /* @__PURE__ */ Object.assign(segmentedFieldsFn, {
|
|
3060
3060
|
__recipe__: false,
|
|
3061
3061
|
__name__: "segmentedFields",
|
|
@@ -3088,7 +3088,7 @@ const segmentedFields = /* @__PURE__ */ Object.assign(segmentedFieldsFn, {
|
|
|
3088
3088
|
splitVariantProps(props) {
|
|
3089
3089
|
return splitProps$1(props, segmentedFieldsVariantKeys);
|
|
3090
3090
|
},
|
|
3091
|
-
getVariantProps: getVariantProps$
|
|
3091
|
+
getVariantProps: getVariantProps$7
|
|
3092
3092
|
});
|
|
3093
3093
|
const segmentedInputsDefaultVariants = {
|
|
3094
3094
|
"size": "md"
|
|
@@ -3115,7 +3115,7 @@ const segmentedInputsFn = memo((props = {}) => {
|
|
|
3115
3115
|
const segmentedInputsVariantKeys = [
|
|
3116
3116
|
"size"
|
|
3117
3117
|
];
|
|
3118
|
-
const getVariantProps$
|
|
3118
|
+
const getVariantProps$6 = (variants) => ({ ...segmentedInputsDefaultVariants, ...compact(variants) });
|
|
3119
3119
|
const segmentedInputs = /* @__PURE__ */ Object.assign(segmentedInputsFn, {
|
|
3120
3120
|
__recipe__: false,
|
|
3121
3121
|
__name__: "segmentedInputs",
|
|
@@ -3133,7 +3133,7 @@ const segmentedInputs = /* @__PURE__ */ Object.assign(segmentedInputsFn, {
|
|
|
3133
3133
|
splitVariantProps(props) {
|
|
3134
3134
|
return splitProps$1(props, segmentedInputsVariantKeys);
|
|
3135
3135
|
},
|
|
3136
|
-
getVariantProps: getVariantProps$
|
|
3136
|
+
getVariantProps: getVariantProps$6
|
|
3137
3137
|
});
|
|
3138
3138
|
const selectDefaultVariants = {
|
|
3139
3139
|
"size": "md"
|
|
@@ -3183,7 +3183,7 @@ const selectVariantKeys = [
|
|
|
3183
3183
|
"multiple",
|
|
3184
3184
|
"autoSize"
|
|
3185
3185
|
];
|
|
3186
|
-
const getVariantProps$
|
|
3186
|
+
const getVariantProps$5 = (variants) => ({ ...selectDefaultVariants, ...compact(variants) });
|
|
3187
3187
|
const select = /* @__PURE__ */ Object.assign(selectFn, {
|
|
3188
3188
|
__recipe__: false,
|
|
3189
3189
|
__name__: "select",
|
|
@@ -3211,6 +3211,73 @@ const select = /* @__PURE__ */ Object.assign(selectFn, {
|
|
|
3211
3211
|
splitVariantProps(props) {
|
|
3212
3212
|
return splitProps$1(props, selectVariantKeys);
|
|
3213
3213
|
},
|
|
3214
|
+
getVariantProps: getVariantProps$5
|
|
3215
|
+
});
|
|
3216
|
+
const tabsDefaultVariants = {
|
|
3217
|
+
"hasOverflow": false
|
|
3218
|
+
};
|
|
3219
|
+
const tabsCompoundVariants = [];
|
|
3220
|
+
const tabsSlotNames = [
|
|
3221
|
+
[
|
|
3222
|
+
"root",
|
|
3223
|
+
"tabs__root"
|
|
3224
|
+
],
|
|
3225
|
+
[
|
|
3226
|
+
"strip",
|
|
3227
|
+
"tabs__strip"
|
|
3228
|
+
],
|
|
3229
|
+
[
|
|
3230
|
+
"list",
|
|
3231
|
+
"tabs__list"
|
|
3232
|
+
],
|
|
3233
|
+
[
|
|
3234
|
+
"tab",
|
|
3235
|
+
"tabs__tab"
|
|
3236
|
+
],
|
|
3237
|
+
[
|
|
3238
|
+
"badge",
|
|
3239
|
+
"tabs__badge"
|
|
3240
|
+
],
|
|
3241
|
+
[
|
|
3242
|
+
"overflow",
|
|
3243
|
+
"tabs__overflow"
|
|
3244
|
+
],
|
|
3245
|
+
[
|
|
3246
|
+
"menu",
|
|
3247
|
+
"tabs__menu"
|
|
3248
|
+
],
|
|
3249
|
+
[
|
|
3250
|
+
"panel",
|
|
3251
|
+
"tabs__panel"
|
|
3252
|
+
]
|
|
3253
|
+
];
|
|
3254
|
+
const tabsSlotFns = /* @__PURE__ */ tabsSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, tabsDefaultVariants, getSlotCompoundVariant(tabsCompoundVariants, slotName))]);
|
|
3255
|
+
const tabsFn = memo((props = {}) => {
|
|
3256
|
+
return Object.fromEntries(tabsSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
3257
|
+
});
|
|
3258
|
+
const tabsVariantKeys = [
|
|
3259
|
+
"hasOverflow",
|
|
3260
|
+
"overflowed"
|
|
3261
|
+
];
|
|
3262
|
+
const getVariantProps$4 = (variants) => ({ ...tabsDefaultVariants, ...compact(variants) });
|
|
3263
|
+
const tabs = /* @__PURE__ */ Object.assign(tabsFn, {
|
|
3264
|
+
__recipe__: false,
|
|
3265
|
+
__name__: "tabs",
|
|
3266
|
+
raw: (props) => props,
|
|
3267
|
+
classNameMap: {},
|
|
3268
|
+
variantKeys: tabsVariantKeys,
|
|
3269
|
+
variantMap: {
|
|
3270
|
+
"hasOverflow": [
|
|
3271
|
+
"false",
|
|
3272
|
+
"true"
|
|
3273
|
+
],
|
|
3274
|
+
"overflowed": [
|
|
3275
|
+
"true"
|
|
3276
|
+
]
|
|
3277
|
+
},
|
|
3278
|
+
splitVariantProps(props) {
|
|
3279
|
+
return splitProps$1(props, tabsVariantKeys);
|
|
3280
|
+
},
|
|
3214
3281
|
getVariantProps: getVariantProps$4
|
|
3215
3282
|
});
|
|
3216
3283
|
const textInputDefaultVariants = {
|
|
@@ -15930,6 +15997,239 @@ function useContainerQuery(containerRef, size2, direction = "min") {
|
|
|
15930
15997
|
() => false
|
|
15931
15998
|
);
|
|
15932
15999
|
}
|
|
16000
|
+
const DEFAULT_RESERVE = 32;
|
|
16001
|
+
const areKeysEqual = (a, b) => a.length === b.length && a.every((key, index2) => key === b[index2]);
|
|
16002
|
+
const syncObservedElements = (observer, current, desired) => {
|
|
16003
|
+
for (const element of current) {
|
|
16004
|
+
if (!desired.has(element)) observer == null ? void 0 : observer.unobserve(element);
|
|
16005
|
+
}
|
|
16006
|
+
for (const element of desired) {
|
|
16007
|
+
if (!current.has(element)) observer == null ? void 0 : observer.observe(element);
|
|
16008
|
+
}
|
|
16009
|
+
return desired;
|
|
16010
|
+
};
|
|
16011
|
+
const useOverflowItems = ({
|
|
16012
|
+
items,
|
|
16013
|
+
containerRef,
|
|
16014
|
+
getItemElement,
|
|
16015
|
+
activeItem = null,
|
|
16016
|
+
reserve = DEFAULT_RESERVE,
|
|
16017
|
+
reserveRef,
|
|
16018
|
+
enabled = true
|
|
16019
|
+
}) => {
|
|
16020
|
+
const [visible, setVisible] = useState(() => [...items]);
|
|
16021
|
+
const [overflow, setOverflow] = useState([]);
|
|
16022
|
+
const [forcedItem, setForcedItem] = useState(null);
|
|
16023
|
+
const frameRef = useRef(null);
|
|
16024
|
+
const itemsRef = useRef(items);
|
|
16025
|
+
const activeItemRef = useRef(activeItem);
|
|
16026
|
+
const forcedItemRef = useRef(forcedItem);
|
|
16027
|
+
const requestsRef = useRef([]);
|
|
16028
|
+
const lastActiveItemRef = useRef(activeItem);
|
|
16029
|
+
const reserveValueRef = useRef(reserve);
|
|
16030
|
+
const reserveElementRef = useRef(null);
|
|
16031
|
+
const enabledRef = useRef(enabled);
|
|
16032
|
+
const observerRef = useRef(null);
|
|
16033
|
+
const observedElementsRef = useRef(/* @__PURE__ */ new Set());
|
|
16034
|
+
const pendingVisibilityRef = useRef(null);
|
|
16035
|
+
const measure = useCallback(() => {
|
|
16036
|
+
var _a;
|
|
16037
|
+
const container = containerRef.current;
|
|
16038
|
+
const currentItems = itemsRef.current;
|
|
16039
|
+
if (!enabledRef.current || !container) {
|
|
16040
|
+
setVisible(
|
|
16041
|
+
(current) => areKeysEqual(current, currentItems) ? current : [...currentItems]
|
|
16042
|
+
);
|
|
16043
|
+
setOverflow((current) => current.length === 0 ? current : []);
|
|
16044
|
+
return;
|
|
16045
|
+
}
|
|
16046
|
+
const styles = globalThis.getComputedStyle(container);
|
|
16047
|
+
const paddingInline = Number.parseFloat(styles.paddingLeft || "0") + Number.parseFloat(styles.paddingRight || "0");
|
|
16048
|
+
const gap = Number.parseFloat(styles.columnGap || "0") || 0;
|
|
16049
|
+
const fullWidth = container.clientWidth - paddingInline;
|
|
16050
|
+
const widths = currentItems.map(
|
|
16051
|
+
(key) => {
|
|
16052
|
+
var _a2;
|
|
16053
|
+
return ((_a2 = getItemElement(key)) == null ? void 0 : _a2.offsetWidth) ?? Number.POSITIVE_INFINITY;
|
|
16054
|
+
}
|
|
16055
|
+
);
|
|
16056
|
+
const forcedKey = forcedItemRef.current;
|
|
16057
|
+
const activeKey = activeItemRef.current;
|
|
16058
|
+
const priorityItem = forcedKey ?? activeKey;
|
|
16059
|
+
const priorityIndex = priorityItem === null ? -1 : currentItems.indexOf(priorityItem);
|
|
16060
|
+
const anchor = priorityIndex === -1 ? 0 : priorityIndex;
|
|
16061
|
+
const requiredIndices = [
|
|
16062
|
+
...new Set(
|
|
16063
|
+
[forcedKey, activeKey].filter((key) => key !== null).map((key) => currentItems.indexOf(key)).filter((index2) => index2 !== -1)
|
|
16064
|
+
)
|
|
16065
|
+
];
|
|
16066
|
+
const byDistanceFromActive = currentItems.map((_key, index2) => index2).sort((a, b) => {
|
|
16067
|
+
const distance = Math.abs(a - anchor) - Math.abs(b - anchor);
|
|
16068
|
+
return distance === 0 ? a - b : distance;
|
|
16069
|
+
});
|
|
16070
|
+
const fit = (forcedIndices, usable) => {
|
|
16071
|
+
const kept2 = /* @__PURE__ */ new Set();
|
|
16072
|
+
let used = 0;
|
|
16073
|
+
for (const index2 of forcedIndices) {
|
|
16074
|
+
used += (widths[index2] ?? 0) + (kept2.size > 0 ? gap : 0);
|
|
16075
|
+
kept2.add(index2);
|
|
16076
|
+
}
|
|
16077
|
+
for (const index2 of byDistanceFromActive) {
|
|
16078
|
+
if (kept2.has(index2)) continue;
|
|
16079
|
+
const width = (widths[index2] ?? 0) + (kept2.size > 0 ? gap : 0);
|
|
16080
|
+
if (used + width > usable) break;
|
|
16081
|
+
used += width;
|
|
16082
|
+
kept2.add(index2);
|
|
16083
|
+
}
|
|
16084
|
+
return kept2;
|
|
16085
|
+
};
|
|
16086
|
+
let kept = fit([], fullWidth);
|
|
16087
|
+
if (kept.size < currentItems.length) {
|
|
16088
|
+
const reservedWidth = ((_a = reserveElementRef.current) == null ? void 0 : _a.offsetWidth) ?? reserveValueRef.current;
|
|
16089
|
+
const usable = fullWidth - reservedWidth;
|
|
16090
|
+
kept = fit([], usable);
|
|
16091
|
+
if (requiredIndices.some((index2) => !kept.has(index2))) {
|
|
16092
|
+
kept = fit(requiredIndices, usable);
|
|
16093
|
+
}
|
|
16094
|
+
}
|
|
16095
|
+
const nextVisible = [];
|
|
16096
|
+
const nextOverflow = [];
|
|
16097
|
+
currentItems.forEach((key, index2) => {
|
|
16098
|
+
if (kept.has(index2)) {
|
|
16099
|
+
nextVisible.push(key);
|
|
16100
|
+
} else {
|
|
16101
|
+
nextOverflow.push(key);
|
|
16102
|
+
}
|
|
16103
|
+
});
|
|
16104
|
+
setVisible(
|
|
16105
|
+
(current) => areKeysEqual(current, nextVisible) ? current : nextVisible
|
|
16106
|
+
);
|
|
16107
|
+
setOverflow(
|
|
16108
|
+
(current) => areKeysEqual(current, nextOverflow) ? current : nextOverflow
|
|
16109
|
+
);
|
|
16110
|
+
}, [containerRef, getItemElement]);
|
|
16111
|
+
const ensureVisible = useCallback(
|
|
16112
|
+
(key, onVisible) => {
|
|
16113
|
+
if (!itemsRef.current.includes(key)) return;
|
|
16114
|
+
const requests = requestsRef.current;
|
|
16115
|
+
const isTracked = requests.length > 0 || key !== activeItemRef.current;
|
|
16116
|
+
if (isTracked) {
|
|
16117
|
+
requestsRef.current = [
|
|
16118
|
+
...requests.filter((request) => request !== key),
|
|
16119
|
+
key
|
|
16120
|
+
];
|
|
16121
|
+
setForcedItem(key);
|
|
16122
|
+
}
|
|
16123
|
+
if (!overflow.includes(key)) {
|
|
16124
|
+
pendingVisibilityRef.current = null;
|
|
16125
|
+
onVisible == null ? void 0 : onVisible();
|
|
16126
|
+
return;
|
|
16127
|
+
}
|
|
16128
|
+
pendingVisibilityRef.current = { key, onVisible };
|
|
16129
|
+
setForcedItem(key);
|
|
16130
|
+
},
|
|
16131
|
+
[overflow]
|
|
16132
|
+
);
|
|
16133
|
+
useLayoutEffect(() => {
|
|
16134
|
+
const schedule = () => {
|
|
16135
|
+
if (frameRef.current !== null) {
|
|
16136
|
+
globalThis.cancelAnimationFrame(frameRef.current);
|
|
16137
|
+
}
|
|
16138
|
+
frameRef.current = globalThis.requestAnimationFrame(() => {
|
|
16139
|
+
frameRef.current = null;
|
|
16140
|
+
measure();
|
|
16141
|
+
});
|
|
16142
|
+
};
|
|
16143
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedule);
|
|
16144
|
+
observerRef.current = observer;
|
|
16145
|
+
globalThis.addEventListener("resize", schedule);
|
|
16146
|
+
return () => {
|
|
16147
|
+
observer == null ? void 0 : observer.disconnect();
|
|
16148
|
+
observerRef.current = null;
|
|
16149
|
+
observedElementsRef.current.clear();
|
|
16150
|
+
globalThis.removeEventListener("resize", schedule);
|
|
16151
|
+
if (frameRef.current !== null) {
|
|
16152
|
+
globalThis.cancelAnimationFrame(frameRef.current);
|
|
16153
|
+
frameRef.current = null;
|
|
16154
|
+
}
|
|
16155
|
+
};
|
|
16156
|
+
}, [measure]);
|
|
16157
|
+
useLayoutEffect(() => {
|
|
16158
|
+
if (!areKeysEqual(itemsRef.current, items)) {
|
|
16159
|
+
itemsRef.current = [...items];
|
|
16160
|
+
}
|
|
16161
|
+
activeItemRef.current = activeItem;
|
|
16162
|
+
forcedItemRef.current = forcedItem;
|
|
16163
|
+
reserveValueRef.current = reserve;
|
|
16164
|
+
reserveElementRef.current = (reserveRef == null ? void 0 : reserveRef.current) ?? null;
|
|
16165
|
+
enabledRef.current = enabled;
|
|
16166
|
+
const desiredElements = /* @__PURE__ */ new Set();
|
|
16167
|
+
const container = containerRef.current;
|
|
16168
|
+
if (enabled && container) {
|
|
16169
|
+
desiredElements.add(container);
|
|
16170
|
+
if (reserveElementRef.current) {
|
|
16171
|
+
desiredElements.add(reserveElementRef.current);
|
|
16172
|
+
}
|
|
16173
|
+
for (const key of itemsRef.current) {
|
|
16174
|
+
const element = getItemElement(key);
|
|
16175
|
+
if (element) desiredElements.add(element);
|
|
16176
|
+
}
|
|
16177
|
+
}
|
|
16178
|
+
observedElementsRef.current = syncObservedElements(
|
|
16179
|
+
observerRef.current,
|
|
16180
|
+
observedElementsRef.current,
|
|
16181
|
+
desiredElements
|
|
16182
|
+
);
|
|
16183
|
+
measure();
|
|
16184
|
+
}, [
|
|
16185
|
+
activeItem,
|
|
16186
|
+
containerRef,
|
|
16187
|
+
enabled,
|
|
16188
|
+
forcedItem,
|
|
16189
|
+
getItemElement,
|
|
16190
|
+
items,
|
|
16191
|
+
measure,
|
|
16192
|
+
reserve,
|
|
16193
|
+
reserveRef
|
|
16194
|
+
]);
|
|
16195
|
+
useLayoutEffect(() => {
|
|
16196
|
+
var _a;
|
|
16197
|
+
const pending = pendingVisibilityRef.current;
|
|
16198
|
+
if (!pending) return;
|
|
16199
|
+
if (!itemsRef.current.includes(pending.key)) {
|
|
16200
|
+
pendingVisibilityRef.current = null;
|
|
16201
|
+
setForcedItem(null);
|
|
16202
|
+
return;
|
|
16203
|
+
}
|
|
16204
|
+
if (overflow.includes(pending.key)) return;
|
|
16205
|
+
pendingVisibilityRef.current = null;
|
|
16206
|
+
(_a = pending.onVisible) == null ? void 0 : _a.call(pending);
|
|
16207
|
+
}, [overflow]);
|
|
16208
|
+
useLayoutEffect(() => {
|
|
16209
|
+
if (lastActiveItemRef.current !== activeItem) {
|
|
16210
|
+
lastActiveItemRef.current = activeItem;
|
|
16211
|
+
const requests = requestsRef.current;
|
|
16212
|
+
const index2 = activeItem === null ? -1 : requests.indexOf(activeItem);
|
|
16213
|
+
requestsRef.current = index2 === -1 ? [] : requests.slice(index2 + 1);
|
|
16214
|
+
}
|
|
16215
|
+
if (forcedItem === null) return;
|
|
16216
|
+
const isRemoved = !items.includes(forcedItem);
|
|
16217
|
+
if (!isRemoved && requestsRef.current.length > 0) return;
|
|
16218
|
+
const pending = pendingVisibilityRef.current;
|
|
16219
|
+
if (pending && (isRemoved || pending.key !== activeItem)) {
|
|
16220
|
+
pendingVisibilityRef.current = null;
|
|
16221
|
+
}
|
|
16222
|
+
requestsRef.current = [];
|
|
16223
|
+
setForcedItem(null);
|
|
16224
|
+
}, [activeItem, forcedItem, items]);
|
|
16225
|
+
return {
|
|
16226
|
+
visible,
|
|
16227
|
+
overflow,
|
|
16228
|
+
hasOverflow: overflow.length > 0,
|
|
16229
|
+
measure,
|
|
16230
|
+
ensureVisible
|
|
16231
|
+
};
|
|
16232
|
+
};
|
|
15933
16233
|
function useClipboard(options = {}) {
|
|
15934
16234
|
const { timeout = 2e3 } = options;
|
|
15935
16235
|
const [copied, setCopied] = useState(false);
|
|
@@ -18721,6 +19021,20 @@ const DateTimeInput = (props) => {
|
|
|
18721
19021
|
};
|
|
18722
19022
|
const FloatingLayerContext = createContext("elevated");
|
|
18723
19023
|
const useFloatingLayer = () => useContext(FloatingLayerContext);
|
|
19024
|
+
const getCompoundComponentType = (node, markerKey) => {
|
|
19025
|
+
if (!node || typeof node !== "object" || !("type" in node)) {
|
|
19026
|
+
return null;
|
|
19027
|
+
}
|
|
19028
|
+
const component = node.type;
|
|
19029
|
+
if (typeof component !== "function" && typeof component !== "object" || component === null) {
|
|
19030
|
+
return null;
|
|
19031
|
+
}
|
|
19032
|
+
const marker = component[markerKey];
|
|
19033
|
+
return typeof marker === "string" ? marker : null;
|
|
19034
|
+
};
|
|
19035
|
+
const setCompoundComponentType = (component, markerKey, componentType) => {
|
|
19036
|
+
Object.assign(component, { [markerKey]: componentType });
|
|
19037
|
+
};
|
|
18724
19038
|
const MENU_COMPONENT_TYPES = {
|
|
18725
19039
|
group: "MenuGroup",
|
|
18726
19040
|
item: "MenuItem",
|
|
@@ -18792,14 +19106,7 @@ const isItemMatch = ({
|
|
|
18792
19106
|
return textValue.toLowerCase().includes(query.trim().toLowerCase());
|
|
18793
19107
|
};
|
|
18794
19108
|
const getComponentType = (node) => {
|
|
18795
|
-
|
|
18796
|
-
return null;
|
|
18797
|
-
}
|
|
18798
|
-
if (!("type" in node)) {
|
|
18799
|
-
return null;
|
|
18800
|
-
}
|
|
18801
|
-
const type = node.type;
|
|
18802
|
-
return (type == null ? void 0 : type[menuComponentTypeKey]) ?? null;
|
|
19109
|
+
return getCompoundComponentType(node, menuComponentTypeKey);
|
|
18803
19110
|
};
|
|
18804
19111
|
const hasMatchingItems = (children, filterContext) => {
|
|
18805
19112
|
return Children.toArray(children).some((childNode) => {
|
|
@@ -19705,7 +20012,11 @@ const MenuGroup = (props) => {
|
|
|
19705
20012
|
}
|
|
19706
20013
|
);
|
|
19707
20014
|
};
|
|
19708
|
-
|
|
20015
|
+
setCompoundComponentType(
|
|
20016
|
+
MenuGroup,
|
|
20017
|
+
menuComponentTypeKey,
|
|
20018
|
+
MENU_COMPONENT_TYPES.group
|
|
20019
|
+
);
|
|
19709
20020
|
const getHighlightParts = (value, query) => {
|
|
19710
20021
|
const safeQuery = query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
19711
20022
|
const regExp = new RegExp(`(${safeQuery})`, "ig");
|
|
@@ -20002,7 +20313,11 @@ const MenuItem = (props) => {
|
|
|
20002
20313
|
}
|
|
20003
20314
|
);
|
|
20004
20315
|
};
|
|
20005
|
-
|
|
20316
|
+
setCompoundComponentType(
|
|
20317
|
+
MenuItem,
|
|
20318
|
+
menuComponentTypeKey,
|
|
20319
|
+
MENU_COMPONENT_TYPES.item
|
|
20320
|
+
);
|
|
20006
20321
|
const MenuProvider = ({ children, root, filter }) => {
|
|
20007
20322
|
const rootValue = {
|
|
20008
20323
|
...defaultMenuRootContextValue,
|
|
@@ -20488,7 +20803,11 @@ const SubMenu = (props) => {
|
|
|
20488
20803
|
) }) })
|
|
20489
20804
|
] });
|
|
20490
20805
|
};
|
|
20491
|
-
|
|
20806
|
+
setCompoundComponentType(
|
|
20807
|
+
SubMenu,
|
|
20808
|
+
menuComponentTypeKey,
|
|
20809
|
+
MENU_COMPONENT_TYPES.subMenu
|
|
20810
|
+
);
|
|
20492
20811
|
const DateMenu = (props) => {
|
|
20493
20812
|
const {
|
|
20494
20813
|
trigger,
|
|
@@ -22999,6 +23318,569 @@ const RadioInput = (props) => {
|
|
|
22999
23318
|
}
|
|
23000
23319
|
);
|
|
23001
23320
|
};
|
|
23321
|
+
const TabsContext = createContext(null);
|
|
23322
|
+
const TabPanelActiveContext = createContext(true);
|
|
23323
|
+
const TabsProvider = TabsContext.Provider;
|
|
23324
|
+
const TabPanelActiveProvider = TabPanelActiveContext.Provider;
|
|
23325
|
+
const useTabsContext = () => {
|
|
23326
|
+
const context2 = useContext(TabsContext);
|
|
23327
|
+
if (!context2) {
|
|
23328
|
+
throw new Error("Tabs compound components must be used within <Tabs />");
|
|
23329
|
+
}
|
|
23330
|
+
return context2;
|
|
23331
|
+
};
|
|
23332
|
+
const useTabPanelActive = () => useContext(TabPanelActiveContext);
|
|
23333
|
+
const TABS_COMPONENT_TYPES = {
|
|
23334
|
+
tab: "Tab",
|
|
23335
|
+
panel: "TabPanel"
|
|
23336
|
+
};
|
|
23337
|
+
const tabsComponentTypeKey = "__tabsComponentType";
|
|
23338
|
+
const getTabsComponentType = (node) => {
|
|
23339
|
+
return getCompoundComponentType(node, tabsComponentTypeKey);
|
|
23340
|
+
};
|
|
23341
|
+
const flattenTabsChildren = (children) => {
|
|
23342
|
+
const flattened = [];
|
|
23343
|
+
const visit = (nodes, keyPrefix) => {
|
|
23344
|
+
Children.toArray(nodes).forEach((child) => {
|
|
23345
|
+
if (isValidElement(child) && child.type === Fragment$1) {
|
|
23346
|
+
visit(child.props.children, `${keyPrefix}${String(child.key)}/`);
|
|
23347
|
+
return;
|
|
23348
|
+
}
|
|
23349
|
+
flattened.push(
|
|
23350
|
+
keyPrefix !== "" && isValidElement(child) ? cloneElement(child, { key: `${keyPrefix}${String(child.key)}` }) : child
|
|
23351
|
+
);
|
|
23352
|
+
});
|
|
23353
|
+
};
|
|
23354
|
+
visit(children, "");
|
|
23355
|
+
return flattened;
|
|
23356
|
+
};
|
|
23357
|
+
const overflowedTabClass = tabs({ overflowed: true }).tab;
|
|
23358
|
+
const badgeTooltipClasses = tooltip({ size: "md", hasTitle: false });
|
|
23359
|
+
const Tab = (props) => {
|
|
23360
|
+
const {
|
|
23361
|
+
value,
|
|
23362
|
+
children,
|
|
23363
|
+
// Read by `Tabs` off this element's props for the overflow menu. It is
|
|
23364
|
+
// pulled out here so it never reaches the DOM as a stray attribute.
|
|
23365
|
+
label: _label,
|
|
23366
|
+
badge: badge2,
|
|
23367
|
+
badgeTooltip,
|
|
23368
|
+
disabled = false,
|
|
23369
|
+
onClick,
|
|
23370
|
+
onKeyDown,
|
|
23371
|
+
ref,
|
|
23372
|
+
...rest
|
|
23373
|
+
} = props;
|
|
23374
|
+
const {
|
|
23375
|
+
classes,
|
|
23376
|
+
getPanelId,
|
|
23377
|
+
getTabId,
|
|
23378
|
+
onTabKeyDown,
|
|
23379
|
+
overflowValues,
|
|
23380
|
+
registerTabElement,
|
|
23381
|
+
selectTab,
|
|
23382
|
+
selectedValue
|
|
23383
|
+
} = useTabsContext();
|
|
23384
|
+
const isSelected = selectedValue === value;
|
|
23385
|
+
const isOverflowed = overflowValues.includes(value);
|
|
23386
|
+
const [className, otherProps] = splitProps(rest);
|
|
23387
|
+
const setElement = useCallback(
|
|
23388
|
+
(element) => {
|
|
23389
|
+
registerTabElement(value, element);
|
|
23390
|
+
},
|
|
23391
|
+
[registerTabElement, value]
|
|
23392
|
+
);
|
|
23393
|
+
const tabClassName = isOverflowed ? overflowedTabClass : classes.tab;
|
|
23394
|
+
const hasBadge = typeof badge2 === "number" && badge2 !== 0;
|
|
23395
|
+
const hasBadgeTooltip = hasBadge && Boolean(badgeTooltip) && !isOverflowed;
|
|
23396
|
+
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
23397
|
+
const arrowRef = useRef(null);
|
|
23398
|
+
const tooltipOpen = hasBadgeTooltip && isTooltipOpen;
|
|
23399
|
+
const { refs, elements, floatingStyles, context: context2 } = useOverlayFloating({
|
|
23400
|
+
open: tooltipOpen,
|
|
23401
|
+
onOpenChange: setIsTooltipOpen,
|
|
23402
|
+
placement: "bottom",
|
|
23403
|
+
middleware: createOverlayMiddleware({
|
|
23404
|
+
offset: 8,
|
|
23405
|
+
extras: [arrow({ element: arrowRef })]
|
|
23406
|
+
})
|
|
23407
|
+
});
|
|
23408
|
+
const hover = useHover(context2, { enabled: hasBadgeTooltip, move: false });
|
|
23409
|
+
const focus = useFocus(context2, { enabled: hasBadgeTooltip });
|
|
23410
|
+
const dismiss = useDismiss(context2, { enabled: hasBadgeTooltip });
|
|
23411
|
+
const role = useRole(context2, { enabled: hasBadgeTooltip, role: "tooltip" });
|
|
23412
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
23413
|
+
hover,
|
|
23414
|
+
focus,
|
|
23415
|
+
dismiss,
|
|
23416
|
+
role
|
|
23417
|
+
]);
|
|
23418
|
+
const mergedRef = useMergeRefs([setElement, refs.setReference, ref]);
|
|
23419
|
+
const badgeElement = hasBadge ? /* @__PURE__ */ jsx(Box, { ref: refs.setPositionReference, className: classes.badge, children: /* @__PURE__ */ jsx(Badge, { count: badge2, variant: "subtle" }) }) : null;
|
|
23420
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23421
|
+
/* @__PURE__ */ jsxs(
|
|
23422
|
+
Box,
|
|
23423
|
+
{
|
|
23424
|
+
...{
|
|
23425
|
+
as: "button",
|
|
23426
|
+
type: "button"
|
|
23427
|
+
},
|
|
23428
|
+
ref: mergedRef,
|
|
23429
|
+
role: "tab",
|
|
23430
|
+
"aria-selected": isSelected,
|
|
23431
|
+
"aria-controls": getPanelId(value),
|
|
23432
|
+
"aria-hidden": isOverflowed || void 0,
|
|
23433
|
+
disabled,
|
|
23434
|
+
tabIndex: isSelected && !isOverflowed ? 0 : -1,
|
|
23435
|
+
className: cx(tabClassName, className),
|
|
23436
|
+
...getReferenceProps({
|
|
23437
|
+
...otherProps,
|
|
23438
|
+
onClick: (event) => {
|
|
23439
|
+
onClick == null ? void 0 : onClick(event);
|
|
23440
|
+
if (disabled || event.defaultPrevented) return;
|
|
23441
|
+
selectTab(event, value, "clicked-on-tab");
|
|
23442
|
+
},
|
|
23443
|
+
onKeyDown: (event) => {
|
|
23444
|
+
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
23445
|
+
if (!event.defaultPrevented) onTabKeyDown(event);
|
|
23446
|
+
}
|
|
23447
|
+
}),
|
|
23448
|
+
id: getTabId(value),
|
|
23449
|
+
children: [
|
|
23450
|
+
children,
|
|
23451
|
+
badgeElement
|
|
23452
|
+
]
|
|
23453
|
+
}
|
|
23454
|
+
),
|
|
23455
|
+
tooltipOpen ? /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(DsChainPortalRoot, { reference: elements.domReference, children: /* @__PURE__ */ jsxs(
|
|
23456
|
+
Box,
|
|
23457
|
+
{
|
|
23458
|
+
...dsComponent("Tooltip"),
|
|
23459
|
+
ref: refs.setFloating,
|
|
23460
|
+
style: floatingStyles,
|
|
23461
|
+
className: badgeTooltipClasses.tooltipContent,
|
|
23462
|
+
...getFloatingProps(),
|
|
23463
|
+
children: [
|
|
23464
|
+
/* @__PURE__ */ jsx(Box, { className: badgeTooltipClasses.text, children: badgeTooltip }),
|
|
23465
|
+
/* @__PURE__ */ jsx(
|
|
23466
|
+
FloatingArrow,
|
|
23467
|
+
{
|
|
23468
|
+
ref: arrowRef,
|
|
23469
|
+
context: context2,
|
|
23470
|
+
fill: token.var("colors.bg.neutral.inverse")
|
|
23471
|
+
}
|
|
23472
|
+
)
|
|
23473
|
+
]
|
|
23474
|
+
}
|
|
23475
|
+
) }) }) : null
|
|
23476
|
+
] });
|
|
23477
|
+
};
|
|
23478
|
+
setCompoundComponentType(Tab, tabsComponentTypeKey, TABS_COMPONENT_TYPES.tab);
|
|
23479
|
+
const TabPanel = (props) => {
|
|
23480
|
+
const { value, children, ...rest } = props;
|
|
23481
|
+
const { classes, getPanelId, getTabId, selectedValue, unmountInactive } = useTabsContext();
|
|
23482
|
+
const isActive = selectedValue === value;
|
|
23483
|
+
const [className, otherProps] = splitProps(rest);
|
|
23484
|
+
if (unmountInactive && !isActive) {
|
|
23485
|
+
return null;
|
|
23486
|
+
}
|
|
23487
|
+
const renderProps = { isActive };
|
|
23488
|
+
const content = typeof children === "function" ? children(renderProps) : children;
|
|
23489
|
+
return /* @__PURE__ */ jsx(TabPanelActiveProvider, { value: isActive, children: /* @__PURE__ */ jsx(
|
|
23490
|
+
Box,
|
|
23491
|
+
{
|
|
23492
|
+
role: "tabpanel",
|
|
23493
|
+
"aria-labelledby": getTabId(value),
|
|
23494
|
+
tabIndex: isActive ? 0 : -1,
|
|
23495
|
+
display: isActive ? "block" : "none",
|
|
23496
|
+
_hidden: { display: "none" },
|
|
23497
|
+
className: cx(classes.panel, className),
|
|
23498
|
+
...otherProps,
|
|
23499
|
+
id: getPanelId(value),
|
|
23500
|
+
hidden: !isActive,
|
|
23501
|
+
children: content
|
|
23502
|
+
}
|
|
23503
|
+
) });
|
|
23504
|
+
};
|
|
23505
|
+
setCompoundComponentType(
|
|
23506
|
+
TabPanel,
|
|
23507
|
+
tabsComponentTypeKey,
|
|
23508
|
+
TABS_COMPONENT_TYPES.panel
|
|
23509
|
+
);
|
|
23510
|
+
const getNodeText = (node) => {
|
|
23511
|
+
if (node === null || node === void 0 || typeof node === "boolean") {
|
|
23512
|
+
return "";
|
|
23513
|
+
}
|
|
23514
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
23515
|
+
return String(node);
|
|
23516
|
+
}
|
|
23517
|
+
if (Array.isArray(node)) {
|
|
23518
|
+
return node.map((child) => getNodeText(child)).join("");
|
|
23519
|
+
}
|
|
23520
|
+
if (isValidElement(node)) {
|
|
23521
|
+
return getNodeText(node.props.children);
|
|
23522
|
+
}
|
|
23523
|
+
return "";
|
|
23524
|
+
};
|
|
23525
|
+
const useTabs = ({
|
|
23526
|
+
children,
|
|
23527
|
+
value,
|
|
23528
|
+
defaultValue,
|
|
23529
|
+
onChange,
|
|
23530
|
+
listRef,
|
|
23531
|
+
overflowRef
|
|
23532
|
+
}) => {
|
|
23533
|
+
var _a;
|
|
23534
|
+
const tabs2 = useMemo(() => {
|
|
23535
|
+
const descriptors = [];
|
|
23536
|
+
flattenTabsChildren(children).forEach((child) => {
|
|
23537
|
+
if (!isValidElement(child) || getTabsComponentType(child) !== TABS_COMPONENT_TYPES.tab) {
|
|
23538
|
+
return;
|
|
23539
|
+
}
|
|
23540
|
+
const props = child.props;
|
|
23541
|
+
if (typeof props.value !== "string") return;
|
|
23542
|
+
descriptors.push({
|
|
23543
|
+
value: props.value,
|
|
23544
|
+
// An explicit `label` overrides the flattened children, which in turn
|
|
23545
|
+
// fall back to `value` when the children carry no text at all.
|
|
23546
|
+
label: props.label || getNodeText(props.children) || props.value,
|
|
23547
|
+
disabled: Boolean(props.disabled),
|
|
23548
|
+
badge: props.badge,
|
|
23549
|
+
badgeTooltip: props.badgeTooltip
|
|
23550
|
+
});
|
|
23551
|
+
});
|
|
23552
|
+
return descriptors;
|
|
23553
|
+
}, [children]);
|
|
23554
|
+
const tabValues = useMemo(() => tabs2.map((tab) => tab.value), [tabs2]);
|
|
23555
|
+
const firstValue = (_a = tabs2.find((tab) => !tab.disabled)) == null ? void 0 : _a.value;
|
|
23556
|
+
const [storedValue, setStoredValue, isControlled] = useControllableState({
|
|
23557
|
+
value,
|
|
23558
|
+
defaultValue: defaultValue ?? firstValue ?? ""
|
|
23559
|
+
});
|
|
23560
|
+
const requestedValueRef = useRef(storedValue);
|
|
23561
|
+
const pendingRequestsRef = useRef([]);
|
|
23562
|
+
const recordRequest = useCallback((nextValue) => {
|
|
23563
|
+
requestedValueRef.current = nextValue;
|
|
23564
|
+
pendingRequestsRef.current = [
|
|
23565
|
+
...pendingRequestsRef.current.filter((pending) => pending !== nextValue),
|
|
23566
|
+
nextValue
|
|
23567
|
+
];
|
|
23568
|
+
}, []);
|
|
23569
|
+
useEffect(() => {
|
|
23570
|
+
const pending = pendingRequestsRef.current;
|
|
23571
|
+
const index2 = pending.indexOf(storedValue);
|
|
23572
|
+
if (index2 === -1) {
|
|
23573
|
+
pendingRequestsRef.current = [];
|
|
23574
|
+
requestedValueRef.current = storedValue;
|
|
23575
|
+
return;
|
|
23576
|
+
}
|
|
23577
|
+
pendingRequestsRef.current = pending.slice(index2 + 1);
|
|
23578
|
+
}, [storedValue]);
|
|
23579
|
+
const storedTab = tabs2.find((tab) => tab.value === storedValue);
|
|
23580
|
+
const isStoredValueSelectable = Boolean(storedTab && !storedTab.disabled);
|
|
23581
|
+
const selectedValue = isStoredValueSelectable ? storedValue : firstValue;
|
|
23582
|
+
const fallbackNotificationRef = useRef(null);
|
|
23583
|
+
useEffect(() => {
|
|
23584
|
+
if (isStoredValueSelectable) {
|
|
23585
|
+
fallbackNotificationRef.current = null;
|
|
23586
|
+
return;
|
|
23587
|
+
}
|
|
23588
|
+
const notificationKey = JSON.stringify([storedValue, firstValue ?? null]);
|
|
23589
|
+
if (fallbackNotificationRef.current === notificationKey) return;
|
|
23590
|
+
fallbackNotificationRef.current = notificationKey;
|
|
23591
|
+
if (!isControlled) {
|
|
23592
|
+
setStoredValue(firstValue ?? "");
|
|
23593
|
+
}
|
|
23594
|
+
if (firstValue !== void 0) {
|
|
23595
|
+
recordRequest(firstValue);
|
|
23596
|
+
onChange == null ? void 0 : onChange(null, firstValue, "fallback-after-removal");
|
|
23597
|
+
}
|
|
23598
|
+
}, [
|
|
23599
|
+
firstValue,
|
|
23600
|
+
isControlled,
|
|
23601
|
+
isStoredValueSelectable,
|
|
23602
|
+
onChange,
|
|
23603
|
+
recordRequest,
|
|
23604
|
+
setStoredValue,
|
|
23605
|
+
storedValue
|
|
23606
|
+
]);
|
|
23607
|
+
const elementsRef = useRef(/* @__PURE__ */ new Map());
|
|
23608
|
+
const registerTabElement = useCallback(
|
|
23609
|
+
(tabValue, element) => {
|
|
23610
|
+
if (element) {
|
|
23611
|
+
elementsRef.current.set(tabValue, element);
|
|
23612
|
+
} else {
|
|
23613
|
+
elementsRef.current.delete(tabValue);
|
|
23614
|
+
}
|
|
23615
|
+
},
|
|
23616
|
+
[]
|
|
23617
|
+
);
|
|
23618
|
+
const getItemElement = useCallback(
|
|
23619
|
+
(tabValue) => elementsRef.current.get(tabValue) ?? null,
|
|
23620
|
+
[]
|
|
23621
|
+
);
|
|
23622
|
+
const { ensureVisible, overflow, hasOverflow } = useOverflowItems({
|
|
23623
|
+
items: tabValues,
|
|
23624
|
+
containerRef: listRef,
|
|
23625
|
+
getItemElement,
|
|
23626
|
+
activeItem: selectedValue ?? null,
|
|
23627
|
+
reserveRef: overflowRef
|
|
23628
|
+
});
|
|
23629
|
+
const selectTab = useCallback(
|
|
23630
|
+
(event, nextValue, reason) => {
|
|
23631
|
+
if (nextValue === storedValue && requestedValueRef.current === storedValue) {
|
|
23632
|
+
return;
|
|
23633
|
+
}
|
|
23634
|
+
recordRequest(nextValue);
|
|
23635
|
+
setStoredValue(nextValue);
|
|
23636
|
+
onChange == null ? void 0 : onChange(event, nextValue, reason);
|
|
23637
|
+
},
|
|
23638
|
+
[onChange, recordRequest, setStoredValue, storedValue]
|
|
23639
|
+
);
|
|
23640
|
+
const focusTab = useCallback(
|
|
23641
|
+
(tabValue, options) => {
|
|
23642
|
+
ensureVisible(tabValue, () => {
|
|
23643
|
+
const focus = () => {
|
|
23644
|
+
var _a2;
|
|
23645
|
+
return (_a2 = elementsRef.current.get(tabValue)) == null ? void 0 : _a2.focus();
|
|
23646
|
+
};
|
|
23647
|
+
if (options == null ? void 0 : options.afterMenuClose) {
|
|
23648
|
+
queueMicrotask(focus);
|
|
23649
|
+
} else {
|
|
23650
|
+
focus();
|
|
23651
|
+
}
|
|
23652
|
+
});
|
|
23653
|
+
},
|
|
23654
|
+
[ensureVisible]
|
|
23655
|
+
);
|
|
23656
|
+
const onTabKeyDown = useCallback(
|
|
23657
|
+
(event) => {
|
|
23658
|
+
const navigable = tabs2.filter((tab) => !tab.disabled).map((tab) => tab.value);
|
|
23659
|
+
if (navigable.length === 0) return;
|
|
23660
|
+
let currentValue = selectedValue;
|
|
23661
|
+
for (const [tabValue, element] of elementsRef.current) {
|
|
23662
|
+
if (element === event.currentTarget) {
|
|
23663
|
+
currentValue = tabValue;
|
|
23664
|
+
break;
|
|
23665
|
+
}
|
|
23666
|
+
}
|
|
23667
|
+
const currentIndex = currentValue === void 0 ? 0 : Math.max(0, navigable.indexOf(currentValue));
|
|
23668
|
+
let nextIndex;
|
|
23669
|
+
switch (event.key) {
|
|
23670
|
+
case "ArrowRight":
|
|
23671
|
+
nextIndex = (currentIndex + 1) % navigable.length;
|
|
23672
|
+
break;
|
|
23673
|
+
case "ArrowLeft":
|
|
23674
|
+
nextIndex = (currentIndex - 1 + navigable.length) % navigable.length;
|
|
23675
|
+
break;
|
|
23676
|
+
case "Home":
|
|
23677
|
+
nextIndex = 0;
|
|
23678
|
+
break;
|
|
23679
|
+
case "End":
|
|
23680
|
+
nextIndex = navigable.length - 1;
|
|
23681
|
+
break;
|
|
23682
|
+
default:
|
|
23683
|
+
return;
|
|
23684
|
+
}
|
|
23685
|
+
event.preventDefault();
|
|
23686
|
+
const nextValue = navigable[nextIndex];
|
|
23687
|
+
if (nextValue === void 0) return;
|
|
23688
|
+
selectTab(event, nextValue, "clicked-on-tab");
|
|
23689
|
+
focusTab(nextValue);
|
|
23690
|
+
},
|
|
23691
|
+
[focusTab, selectTab, selectedValue, tabs2]
|
|
23692
|
+
);
|
|
23693
|
+
const overflowTabs = useMemo(
|
|
23694
|
+
() => overflow.map((item) => tabs2.find((tab) => tab.value === item)).filter((tab) => Boolean(tab)),
|
|
23695
|
+
[overflow, tabs2]
|
|
23696
|
+
);
|
|
23697
|
+
return {
|
|
23698
|
+
hasOverflow,
|
|
23699
|
+
focusTab,
|
|
23700
|
+
onTabKeyDown,
|
|
23701
|
+
overflowTabs,
|
|
23702
|
+
overflowValues: overflow,
|
|
23703
|
+
registerTabElement,
|
|
23704
|
+
selectTab,
|
|
23705
|
+
selectedValue,
|
|
23706
|
+
tabs: tabs2
|
|
23707
|
+
};
|
|
23708
|
+
};
|
|
23709
|
+
const TabsOverflowMenu = ({
|
|
23710
|
+
className,
|
|
23711
|
+
focusTab,
|
|
23712
|
+
tabs: tabs2,
|
|
23713
|
+
selectTab,
|
|
23714
|
+
selectedValue
|
|
23715
|
+
}) => {
|
|
23716
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
23717
|
+
return /* @__PURE__ */ jsx(
|
|
23718
|
+
Menu,
|
|
23719
|
+
{
|
|
23720
|
+
open: isOpen,
|
|
23721
|
+
onOpenChange: setIsOpen,
|
|
23722
|
+
placement: "bottom-end",
|
|
23723
|
+
className,
|
|
23724
|
+
trigger: /* @__PURE__ */ jsx(
|
|
23725
|
+
IconButton,
|
|
23726
|
+
{
|
|
23727
|
+
variant: "ghost",
|
|
23728
|
+
size: "md",
|
|
23729
|
+
iconName: isOpen ? "caret-up" : "caret-down",
|
|
23730
|
+
altText: "More tabs",
|
|
23731
|
+
"aria-haspopup": "menu"
|
|
23732
|
+
}
|
|
23733
|
+
),
|
|
23734
|
+
children: tabs2.map((tab) => {
|
|
23735
|
+
const hasBadge = typeof tab.badge === "number" && tab.badge !== 0;
|
|
23736
|
+
return /* @__PURE__ */ jsx(
|
|
23737
|
+
MenuItem,
|
|
23738
|
+
{
|
|
23739
|
+
label: hasBadge ? `${tab.label} (${String(tab.badge)})` : tab.label,
|
|
23740
|
+
description: hasBadge ? tab.badgeTooltip : void 0,
|
|
23741
|
+
disabled: tab.disabled,
|
|
23742
|
+
selected: tab.value === selectedValue,
|
|
23743
|
+
role: "menuitemradio",
|
|
23744
|
+
"aria-checked": tab.value === selectedValue,
|
|
23745
|
+
onClick: (event) => {
|
|
23746
|
+
selectTab(event, tab.value, "selected-from-overflow");
|
|
23747
|
+
setIsOpen(false);
|
|
23748
|
+
focusTab(tab.value, { afterMenuClose: true });
|
|
23749
|
+
}
|
|
23750
|
+
},
|
|
23751
|
+
tab.value
|
|
23752
|
+
);
|
|
23753
|
+
})
|
|
23754
|
+
}
|
|
23755
|
+
);
|
|
23756
|
+
};
|
|
23757
|
+
const Tabs = (props) => {
|
|
23758
|
+
const {
|
|
23759
|
+
children,
|
|
23760
|
+
value,
|
|
23761
|
+
defaultValue,
|
|
23762
|
+
onChange,
|
|
23763
|
+
unmountInactive = false,
|
|
23764
|
+
"aria-label": ariaLabel,
|
|
23765
|
+
"aria-labelledby": ariaLabelledBy,
|
|
23766
|
+
...rest
|
|
23767
|
+
} = props;
|
|
23768
|
+
const [className, otherProps] = splitProps(rest);
|
|
23769
|
+
const listRef = useRef(null);
|
|
23770
|
+
const overflowRef = useRef(null);
|
|
23771
|
+
const baseId = useId$1();
|
|
23772
|
+
const {
|
|
23773
|
+
focusTab,
|
|
23774
|
+
hasOverflow,
|
|
23775
|
+
onTabKeyDown,
|
|
23776
|
+
overflowTabs,
|
|
23777
|
+
overflowValues,
|
|
23778
|
+
registerTabElement,
|
|
23779
|
+
selectTab,
|
|
23780
|
+
selectedValue
|
|
23781
|
+
} = useTabs({
|
|
23782
|
+
children,
|
|
23783
|
+
value,
|
|
23784
|
+
defaultValue,
|
|
23785
|
+
onChange,
|
|
23786
|
+
listRef,
|
|
23787
|
+
overflowRef
|
|
23788
|
+
});
|
|
23789
|
+
const classes = useMemo(
|
|
23790
|
+
() => tabs({ hasOverflow }),
|
|
23791
|
+
[hasOverflow]
|
|
23792
|
+
);
|
|
23793
|
+
const [tabChildren, restChildren] = useMemo(() => {
|
|
23794
|
+
const strip = [];
|
|
23795
|
+
const below = [];
|
|
23796
|
+
flattenTabsChildren(children).forEach((child) => {
|
|
23797
|
+
if (getTabsComponentType(child) === TABS_COMPONENT_TYPES.tab) {
|
|
23798
|
+
strip.push(child);
|
|
23799
|
+
} else {
|
|
23800
|
+
below.push(child);
|
|
23801
|
+
}
|
|
23802
|
+
});
|
|
23803
|
+
return [strip, below];
|
|
23804
|
+
}, [children]);
|
|
23805
|
+
const contextValue = useMemo(
|
|
23806
|
+
() => ({
|
|
23807
|
+
classes,
|
|
23808
|
+
// Values are free text; encoding keeps spaces out of the IDs that
|
|
23809
|
+
// `aria-controls` and `aria-labelledby` parse as token lists.
|
|
23810
|
+
getPanelId: (tabValue) => `${baseId}-panel-${encodeURIComponent(tabValue)}`,
|
|
23811
|
+
getTabId: (tabValue) => `${baseId}-tab-${encodeURIComponent(tabValue)}`,
|
|
23812
|
+
onTabKeyDown,
|
|
23813
|
+
overflowValues,
|
|
23814
|
+
registerTabElement,
|
|
23815
|
+
selectTab,
|
|
23816
|
+
selectedValue,
|
|
23817
|
+
unmountInactive
|
|
23818
|
+
}),
|
|
23819
|
+
[
|
|
23820
|
+
baseId,
|
|
23821
|
+
classes,
|
|
23822
|
+
onTabKeyDown,
|
|
23823
|
+
overflowValues,
|
|
23824
|
+
registerTabElement,
|
|
23825
|
+
selectTab,
|
|
23826
|
+
selectedValue,
|
|
23827
|
+
unmountInactive
|
|
23828
|
+
]
|
|
23829
|
+
);
|
|
23830
|
+
return /* @__PURE__ */ jsx(TabsProvider, { value: contextValue, children: /* @__PURE__ */ jsxs(
|
|
23831
|
+
Box,
|
|
23832
|
+
{
|
|
23833
|
+
...dsComponent("Tabs"),
|
|
23834
|
+
className: cx(classes.root, className),
|
|
23835
|
+
...otherProps,
|
|
23836
|
+
children: [
|
|
23837
|
+
/* @__PURE__ */ jsxs(Box, { className: classes.strip, children: [
|
|
23838
|
+
/* @__PURE__ */ jsx(
|
|
23839
|
+
Box,
|
|
23840
|
+
{
|
|
23841
|
+
ref: listRef,
|
|
23842
|
+
role: "tablist",
|
|
23843
|
+
"aria-label": ariaLabel,
|
|
23844
|
+
"aria-labelledby": ariaLabelledBy,
|
|
23845
|
+
"aria-orientation": "horizontal",
|
|
23846
|
+
className: classes.list,
|
|
23847
|
+
children: tabChildren
|
|
23848
|
+
}
|
|
23849
|
+
),
|
|
23850
|
+
/* @__PURE__ */ jsx(
|
|
23851
|
+
Box,
|
|
23852
|
+
{
|
|
23853
|
+
ref: overflowRef,
|
|
23854
|
+
className: classes.overflow,
|
|
23855
|
+
"aria-hidden": !hasOverflow || void 0,
|
|
23856
|
+
children: hasOverflow ? /* @__PURE__ */ jsx(
|
|
23857
|
+
TabsOverflowMenu,
|
|
23858
|
+
{
|
|
23859
|
+
className: classes.menu,
|
|
23860
|
+
focusTab,
|
|
23861
|
+
tabs: overflowTabs,
|
|
23862
|
+
selectTab,
|
|
23863
|
+
selectedValue
|
|
23864
|
+
}
|
|
23865
|
+
) : /* @__PURE__ */ jsx(
|
|
23866
|
+
IconButton,
|
|
23867
|
+
{
|
|
23868
|
+
variant: "ghost",
|
|
23869
|
+
size: "md",
|
|
23870
|
+
iconName: "caret-down",
|
|
23871
|
+
altText: "More tabs",
|
|
23872
|
+
disabled: true,
|
|
23873
|
+
tabIndex: -1
|
|
23874
|
+
}
|
|
23875
|
+
)
|
|
23876
|
+
}
|
|
23877
|
+
)
|
|
23878
|
+
] }),
|
|
23879
|
+
restChildren
|
|
23880
|
+
]
|
|
23881
|
+
}
|
|
23882
|
+
) });
|
|
23883
|
+
};
|
|
23002
23884
|
const AutocompleteListbox = (props) => {
|
|
23003
23885
|
const { labels } = useLocale();
|
|
23004
23886
|
const {
|
|
@@ -25186,6 +26068,9 @@ export {
|
|
|
25186
26068
|
Skeleton,
|
|
25187
26069
|
Spinner,
|
|
25188
26070
|
SubMenu,
|
|
26071
|
+
Tab,
|
|
26072
|
+
TabPanel,
|
|
26073
|
+
Tabs,
|
|
25189
26074
|
Tag,
|
|
25190
26075
|
Text,
|
|
25191
26076
|
TextInput,
|
|
@@ -25223,6 +26108,9 @@ export {
|
|
|
25223
26108
|
useMenuListContext,
|
|
25224
26109
|
useMenuRootContext,
|
|
25225
26110
|
useModalWrapperContext,
|
|
26111
|
+
useOverflowItems,
|
|
26112
|
+
useTabPanelActive,
|
|
26113
|
+
useTabsContext,
|
|
25226
26114
|
useTheme,
|
|
25227
26115
|
useToast
|
|
25228
26116
|
};
|