cetec-design-system 4.1.1-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 +1254 -218
- package/dist/index.js.map +1 -1
- package/dist/panda.buildinfo.json +83 -67
- package/dist/preset.js +158 -0
- package/dist/preset.js.map +1 -1
- package/dist/specs/recipes.json +25 -0
- package/dist/styles.css +226 -14
- package/dist/types/index.d.ts +524 -1
- package/package.json +12 -2
- 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 = {
|
|
@@ -15388,6 +15455,76 @@ const Text = (props) => {
|
|
|
15388
15455
|
);
|
|
15389
15456
|
return definition ? /* @__PURE__ */ jsx(Tooltip, { text: definition, children: content }) : content;
|
|
15390
15457
|
};
|
|
15458
|
+
const defaultLocaleLabels = {
|
|
15459
|
+
cancel: "Cancel",
|
|
15460
|
+
submit: "Submit",
|
|
15461
|
+
apply: "Apply",
|
|
15462
|
+
dismiss: "Dismiss",
|
|
15463
|
+
closeDialog: "Close dialog",
|
|
15464
|
+
removeItem: (item) => `Remove ${item}`,
|
|
15465
|
+
switchToTheme: (nextTheme) => `Switch to ${nextTheme} theme`,
|
|
15466
|
+
selectPlaceholder: "Select...",
|
|
15467
|
+
noResults: "No results found",
|
|
15468
|
+
suggestions: "Suggestions",
|
|
15469
|
+
loadingOptions: "Loading options…",
|
|
15470
|
+
noOptions: "No options",
|
|
15471
|
+
addOption: (value) => `Add “${value}”`,
|
|
15472
|
+
optionSelected: (label2) => `${label2} selected.`,
|
|
15473
|
+
optionCreated: (value) => `${value} created and selected.`,
|
|
15474
|
+
optionRemoved: (label2) => `${label2} removed.`,
|
|
15475
|
+
moreSelected: (count2) => `${count2} more selected`,
|
|
15476
|
+
chooseDate: "Choose date",
|
|
15477
|
+
previousMonth: "Previous month",
|
|
15478
|
+
nextMonth: "Next month",
|
|
15479
|
+
previousYear: "Previous year",
|
|
15480
|
+
nextYear: "Next year",
|
|
15481
|
+
previousYears: "Previous years",
|
|
15482
|
+
nextYears: "Next years",
|
|
15483
|
+
chooseMonthIn: (year) => `Choose a month in ${year}`,
|
|
15484
|
+
chooseYear: "Choose a year",
|
|
15485
|
+
today: "today",
|
|
15486
|
+
selected: "selected",
|
|
15487
|
+
rangeStart: "range start",
|
|
15488
|
+
rangeEnd: "range end",
|
|
15489
|
+
date: "Date",
|
|
15490
|
+
time: "Time",
|
|
15491
|
+
startDate: "Start date",
|
|
15492
|
+
endDate: "End date",
|
|
15493
|
+
startTime: "Start time",
|
|
15494
|
+
endTime: "End time",
|
|
15495
|
+
month: "Month",
|
|
15496
|
+
day: "Day",
|
|
15497
|
+
year: "Year",
|
|
15498
|
+
hour: "Hour",
|
|
15499
|
+
minute: "Minute",
|
|
15500
|
+
meridiem: "AM or PM",
|
|
15501
|
+
fieldHour: (field) => `${field} hour`,
|
|
15502
|
+
fieldMinute: (field) => `${field} minute`,
|
|
15503
|
+
fieldMeridiem: (field) => `${field} AM or PM`,
|
|
15504
|
+
monthPlaceholder: "MM",
|
|
15505
|
+
dayPlaceholder: "DD",
|
|
15506
|
+
yearPlaceholder: "YYYY",
|
|
15507
|
+
hourPlaceholder: "HH",
|
|
15508
|
+
minutePlaceholder: "MM",
|
|
15509
|
+
hourColumn: "HR",
|
|
15510
|
+
minuteColumn: "MIN",
|
|
15511
|
+
meridiemColumn: "AM/PM",
|
|
15512
|
+
clearDate: "Clear date",
|
|
15513
|
+
clearDateRange: "Clear date range",
|
|
15514
|
+
clearTime: "Clear time",
|
|
15515
|
+
clearTimeRange: "Clear time range",
|
|
15516
|
+
clearDateTime: "Clear date and time",
|
|
15517
|
+
clearStartDateTime: "Clear start date and time",
|
|
15518
|
+
clearEndDateTime: "Clear end date and time"
|
|
15519
|
+
};
|
|
15520
|
+
const DEFAULT_LOCALE = "en-US";
|
|
15521
|
+
const LocaleContext = createContext({
|
|
15522
|
+
locale: DEFAULT_LOCALE,
|
|
15523
|
+
labels: defaultLocaleLabels
|
|
15524
|
+
});
|
|
15525
|
+
function useLocale() {
|
|
15526
|
+
return useContext(LocaleContext);
|
|
15527
|
+
}
|
|
15391
15528
|
const toneIconNames$3 = {
|
|
15392
15529
|
info: "info",
|
|
15393
15530
|
success: "success",
|
|
@@ -15403,6 +15540,7 @@ const toneIconColors$2 = {
|
|
|
15403
15540
|
neutral: "icon.subtle"
|
|
15404
15541
|
};
|
|
15405
15542
|
const Alert = (props) => {
|
|
15543
|
+
const { labels } = useLocale();
|
|
15406
15544
|
const {
|
|
15407
15545
|
tone = "info",
|
|
15408
15546
|
title,
|
|
@@ -15411,7 +15549,7 @@ const Alert = (props) => {
|
|
|
15411
15549
|
secondaryAction,
|
|
15412
15550
|
dismissible = false,
|
|
15413
15551
|
onDismiss,
|
|
15414
|
-
dismissLabel =
|
|
15552
|
+
dismissLabel = labels.dismiss,
|
|
15415
15553
|
...rest
|
|
15416
15554
|
} = props;
|
|
15417
15555
|
const [className, otherProps] = splitProps(rest);
|
|
@@ -15859,6 +15997,239 @@ function useContainerQuery(containerRef, size2, direction = "min") {
|
|
|
15859
15997
|
() => false
|
|
15860
15998
|
);
|
|
15861
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
|
+
};
|
|
15862
16233
|
function useClipboard(options = {}) {
|
|
15863
16234
|
const { timeout = 2e3 } = options;
|
|
15864
16235
|
const [copied, setCopied] = useState(false);
|
|
@@ -16190,44 +16561,64 @@ function getMinuteValues(minuteStep) {
|
|
|
16190
16561
|
}
|
|
16191
16562
|
return values;
|
|
16192
16563
|
}
|
|
16193
|
-
const
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
|
|
16203
|
-
|
|
16204
|
-
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
"
|
|
16225
|
-
"
|
|
16226
|
-
"
|
|
16227
|
-
"
|
|
16228
|
-
"
|
|
16229
|
-
"
|
|
16230
|
-
|
|
16564
|
+
const WEEK_START_UTC = Date.UTC(2017, 0, 1);
|
|
16565
|
+
const DAY_MS = 24 * 60 * 60 * 1e3;
|
|
16566
|
+
function utcDate(year, month, day) {
|
|
16567
|
+
const date = /* @__PURE__ */ new Date(0);
|
|
16568
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
16569
|
+
return date;
|
|
16570
|
+
}
|
|
16571
|
+
function resolveLocale(locale) {
|
|
16572
|
+
try {
|
|
16573
|
+
return Intl.DateTimeFormat.supportedLocalesOf(locale).length > 0 ? locale : DEFAULT_LOCALE;
|
|
16574
|
+
} catch {
|
|
16575
|
+
return DEFAULT_LOCALE;
|
|
16576
|
+
}
|
|
16577
|
+
}
|
|
16578
|
+
function getFirstDayOfWeek(locale) {
|
|
16579
|
+
var _a;
|
|
16580
|
+
try {
|
|
16581
|
+
const intlLocale = new Intl.Locale(locale);
|
|
16582
|
+
const weekInfo = ((_a = intlLocale.getWeekInfo) == null ? void 0 : _a.call(intlLocale)) ?? intlLocale.weekInfo;
|
|
16583
|
+
return weekInfo ? weekInfo.firstDay % 7 : 0;
|
|
16584
|
+
} catch {
|
|
16585
|
+
return 0;
|
|
16586
|
+
}
|
|
16587
|
+
}
|
|
16588
|
+
function getCalendarNames(locale) {
|
|
16589
|
+
const resolved = resolveLocale(locale);
|
|
16590
|
+
const format = (options) => new Intl.DateTimeFormat(resolved, {
|
|
16591
|
+
...options,
|
|
16592
|
+
calendar: "gregory",
|
|
16593
|
+
timeZone: "UTC"
|
|
16594
|
+
});
|
|
16595
|
+
const monthLong = format({ month: "long" });
|
|
16596
|
+
const monthShort = format({ month: "short" });
|
|
16597
|
+
const weekdayLong = format({ weekday: "long" });
|
|
16598
|
+
const weekdayShort = format({ weekday: "short" });
|
|
16599
|
+
const monthYear = format({ month: "long", year: "numeric" });
|
|
16600
|
+
const fullDate = format({ month: "long", day: "numeric", year: "numeric" });
|
|
16601
|
+
const monthDates = Array.from(
|
|
16602
|
+
{ length: 12 },
|
|
16603
|
+
(_, index2) => utcDate(2e3, index2 + 1, 1)
|
|
16604
|
+
);
|
|
16605
|
+
const firstDayOfWeek = getFirstDayOfWeek(resolved);
|
|
16606
|
+
const weekDates = Array.from(
|
|
16607
|
+
{ length: 7 },
|
|
16608
|
+
(_, index2) => new Date(WEEK_START_UTC + (firstDayOfWeek + index2) % 7 * DAY_MS)
|
|
16609
|
+
);
|
|
16610
|
+
return {
|
|
16611
|
+
firstDayOfWeek,
|
|
16612
|
+
months: monthDates.map((date) => monthLong.format(date)),
|
|
16613
|
+
monthsShort: monthDates.map((date) => monthShort.format(date)),
|
|
16614
|
+
weekdays: weekDates.map((date) => weekdayLong.format(date)),
|
|
16615
|
+
weekdaysShort: weekDates.map(
|
|
16616
|
+
(date) => weekdayShort.format(date).replace(/\.$/, "")
|
|
16617
|
+
),
|
|
16618
|
+
formatMonthYear: (year, month) => monthYear.format(utcDate(year, month, 1)),
|
|
16619
|
+
formatDate: ({ year, month, day }) => fullDate.format(utcDate(year, month, day))
|
|
16620
|
+
};
|
|
16621
|
+
}
|
|
16231
16622
|
const YEAR_WINDOW_SIZE = 12;
|
|
16232
16623
|
function monthInRange(year, month, min2, max2) {
|
|
16233
16624
|
if (min2 && (year < min2.year || year === min2.year && month < min2.month))
|
|
@@ -16250,13 +16641,13 @@ function getCellVariant(state) {
|
|
|
16250
16641
|
}
|
|
16251
16642
|
return state.isInRange ? "selected" : "ghost";
|
|
16252
16643
|
}
|
|
16253
|
-
function getDayAriaLabel(date,
|
|
16254
|
-
const
|
|
16255
|
-
if (state.isToday)
|
|
16256
|
-
if (state.isSelected)
|
|
16257
|
-
if (state.isRangeStart)
|
|
16258
|
-
if (state.isRangeEnd)
|
|
16259
|
-
return
|
|
16644
|
+
function getDayAriaLabel(date, state, labels, names) {
|
|
16645
|
+
const parts = [names.formatDate(date)];
|
|
16646
|
+
if (state.isToday) parts.push(labels.today);
|
|
16647
|
+
if (state.isSelected) parts.push(labels.selected);
|
|
16648
|
+
if (state.isRangeStart) parts.push(labels.rangeStart);
|
|
16649
|
+
if (state.isRangeEnd) parts.push(labels.rangeEnd);
|
|
16650
|
+
return parts.join(", ");
|
|
16260
16651
|
}
|
|
16261
16652
|
const CalendarCell = ({
|
|
16262
16653
|
ariaLabel,
|
|
@@ -16294,20 +16685,21 @@ const DayGridContent = ({
|
|
|
16294
16685
|
disabled,
|
|
16295
16686
|
getDayState,
|
|
16296
16687
|
handleDaySelect,
|
|
16297
|
-
|
|
16688
|
+
labels,
|
|
16689
|
+
names,
|
|
16298
16690
|
viewDate
|
|
16299
16691
|
}) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16300
|
-
|
|
16692
|
+
names.weekdaysShort.map((weekday, index2) => /* @__PURE__ */ jsx(
|
|
16301
16693
|
Text,
|
|
16302
16694
|
{
|
|
16303
16695
|
textStyle: "mono.xs",
|
|
16304
16696
|
allCaps: true,
|
|
16305
16697
|
className: classes.weekdayLabel,
|
|
16306
16698
|
role: "columnheader",
|
|
16307
|
-
"aria-label":
|
|
16699
|
+
"aria-label": names.weekdays[index2] ?? weekday,
|
|
16308
16700
|
children: weekday
|
|
16309
16701
|
},
|
|
16310
|
-
|
|
16702
|
+
index2
|
|
16311
16703
|
)),
|
|
16312
16704
|
Array.from({ length: dayCells.length / 7 }, (_, rowIndex) => /* @__PURE__ */ jsx(Box, { role: "row", display: "contents", children: dayCells.slice(rowIndex * 7, rowIndex * 7 + 7).map((day, columnIndex) => {
|
|
16313
16705
|
if (day === null) {
|
|
@@ -16332,7 +16724,7 @@ const DayGridContent = ({
|
|
|
16332
16724
|
classes,
|
|
16333
16725
|
disabled,
|
|
16334
16726
|
label: day,
|
|
16335
|
-
ariaLabel: getDayAriaLabel(date,
|
|
16727
|
+
ariaLabel: getDayAriaLabel(date, state, labels, names),
|
|
16336
16728
|
state,
|
|
16337
16729
|
onClick: () => handleDaySelect(date),
|
|
16338
16730
|
onKeyDown: (event) => {
|
|
@@ -16351,21 +16743,21 @@ const MonthGridContent = ({
|
|
|
16351
16743
|
disabled,
|
|
16352
16744
|
getMonthState,
|
|
16353
16745
|
handleMonthSelect,
|
|
16746
|
+
names,
|
|
16354
16747
|
year
|
|
16355
|
-
}) => /* @__PURE__ */ jsx(Fragment, { children:
|
|
16748
|
+
}) => /* @__PURE__ */ jsx(Fragment, { children: names.monthsShort.map((label2, index2) => {
|
|
16356
16749
|
const month = index2 + 1;
|
|
16357
|
-
const fullMonthName = MONTH_NAMES[index2] ?? label2;
|
|
16358
16750
|
return /* @__PURE__ */ jsx(
|
|
16359
16751
|
CalendarCell,
|
|
16360
16752
|
{
|
|
16361
16753
|
classes,
|
|
16362
16754
|
disabled,
|
|
16363
16755
|
label: label2,
|
|
16364
|
-
ariaLabel:
|
|
16756
|
+
ariaLabel: names.formatMonthYear(year, month),
|
|
16365
16757
|
state: getMonthState(month),
|
|
16366
16758
|
onClick: () => handleMonthSelect(month)
|
|
16367
16759
|
},
|
|
16368
|
-
|
|
16760
|
+
month
|
|
16369
16761
|
);
|
|
16370
16762
|
}) });
|
|
16371
16763
|
const YearGridContent = ({
|
|
@@ -16387,6 +16779,8 @@ const YearGridContent = ({
|
|
|
16387
16779
|
year
|
|
16388
16780
|
)) });
|
|
16389
16781
|
const Calendar = (props) => {
|
|
16782
|
+
const { labels, locale } = useLocale();
|
|
16783
|
+
const names = useMemo(() => getCalendarNames(locale), [locale]);
|
|
16390
16784
|
const {
|
|
16391
16785
|
value = null,
|
|
16392
16786
|
onChange,
|
|
@@ -16398,7 +16792,7 @@ const Calendar = (props) => {
|
|
|
16398
16792
|
defaultViewDate,
|
|
16399
16793
|
onViewDateChange,
|
|
16400
16794
|
disabled = false,
|
|
16401
|
-
label: label2 =
|
|
16795
|
+
label: label2 = labels.chooseDate,
|
|
16402
16796
|
...rest
|
|
16403
16797
|
} = props;
|
|
16404
16798
|
const [className, otherProps] = splitProps(rest);
|
|
@@ -16419,18 +16813,17 @@ const Calendar = (props) => {
|
|
|
16419
16813
|
() => getYearWindowStart(viewDate.year)
|
|
16420
16814
|
);
|
|
16421
16815
|
const classes = calendar({ type: viewLevel });
|
|
16422
|
-
const
|
|
16423
|
-
const monthLabel = `${monthName} ${viewDate.year}`;
|
|
16816
|
+
const monthLabel = names.formatMonthYear(viewDate.year, viewDate.month);
|
|
16424
16817
|
const yearWindowEnd = yearWindowStart + YEAR_WINDOW_SIZE - 1;
|
|
16425
16818
|
const dayCells = useMemo(() => {
|
|
16426
|
-
const
|
|
16819
|
+
const leadingDays = (firstWeekdayOfMonth(viewDate.year, viewDate.month) - names.firstDayOfWeek + 7) % 7;
|
|
16427
16820
|
const totalDays = daysInMonth$1(viewDate.year, viewDate.month);
|
|
16428
16821
|
const cells = [];
|
|
16429
|
-
for (let i = 0; i <
|
|
16822
|
+
for (let i = 0; i < leadingDays; i += 1) cells.push(null);
|
|
16430
16823
|
for (let day = 1; day <= totalDays; day += 1) cells.push(day);
|
|
16431
16824
|
while (cells.length % 7 !== 0) cells.push(null);
|
|
16432
16825
|
return cells;
|
|
16433
|
-
}, [viewDate.month, viewDate.year]);
|
|
16826
|
+
}, [names.firstDayOfWeek, viewDate.month, viewDate.year]);
|
|
16434
16827
|
const windowYears = useMemo(
|
|
16435
16828
|
() => Array.from({ length: YEAR_WINDOW_SIZE }, (_, i) => yearWindowStart + i),
|
|
16436
16829
|
[yearWindowStart]
|
|
@@ -16486,8 +16879,8 @@ const Calendar = (props) => {
|
|
|
16486
16879
|
switch (viewLevel) {
|
|
16487
16880
|
case "days":
|
|
16488
16881
|
return {
|
|
16489
|
-
previousLabel:
|
|
16490
|
-
nextLabel:
|
|
16882
|
+
previousLabel: labels.previousMonth,
|
|
16883
|
+
nextLabel: labels.nextMonth,
|
|
16491
16884
|
title: monthLabel,
|
|
16492
16885
|
onTitleClick: () => setViewLevel("months"),
|
|
16493
16886
|
previousDisabled: disabled || !monthInRange(
|
|
@@ -16502,8 +16895,8 @@ const Calendar = (props) => {
|
|
|
16502
16895
|
};
|
|
16503
16896
|
case "months":
|
|
16504
16897
|
return {
|
|
16505
|
-
previousLabel:
|
|
16506
|
-
nextLabel:
|
|
16898
|
+
previousLabel: labels.previousYear,
|
|
16899
|
+
nextLabel: labels.nextYear,
|
|
16507
16900
|
title: String(viewDate.year),
|
|
16508
16901
|
onTitleClick: () => {
|
|
16509
16902
|
setYearWindowStart(getYearWindowStart(viewDate.year));
|
|
@@ -16516,8 +16909,8 @@ const Calendar = (props) => {
|
|
|
16516
16909
|
};
|
|
16517
16910
|
case "years":
|
|
16518
16911
|
return {
|
|
16519
|
-
previousLabel:
|
|
16520
|
-
nextLabel:
|
|
16912
|
+
previousLabel: labels.previousYears,
|
|
16913
|
+
nextLabel: labels.nextYears,
|
|
16521
16914
|
title: `${yearWindowStart}-${yearWindowEnd}`,
|
|
16522
16915
|
titleDisabled: true,
|
|
16523
16916
|
previousDisabled: disabled || !yearInRange(yearWindowStart - 1, minDate, maxDate),
|
|
@@ -16528,7 +16921,7 @@ const Calendar = (props) => {
|
|
|
16528
16921
|
}
|
|
16529
16922
|
};
|
|
16530
16923
|
const headerConfig = getHeaderConfig();
|
|
16531
|
-
const gridAriaLabel = viewLevel === "days" ? monthLabel : viewLevel === "months" ?
|
|
16924
|
+
const gridAriaLabel = viewLevel === "days" ? monthLabel : viewLevel === "months" ? labels.chooseMonthIn(viewDate.year) : labels.chooseYear;
|
|
16532
16925
|
return /* @__PURE__ */ jsxs(
|
|
16533
16926
|
Box,
|
|
16534
16927
|
{
|
|
@@ -16584,7 +16977,8 @@ const Calendar = (props) => {
|
|
|
16584
16977
|
disabled,
|
|
16585
16978
|
getDayState,
|
|
16586
16979
|
handleDaySelect,
|
|
16587
|
-
|
|
16980
|
+
labels,
|
|
16981
|
+
names,
|
|
16588
16982
|
viewDate
|
|
16589
16983
|
}
|
|
16590
16984
|
) : viewLevel === "months" ? /* @__PURE__ */ jsx(
|
|
@@ -16594,6 +16988,7 @@ const Calendar = (props) => {
|
|
|
16594
16988
|
disabled,
|
|
16595
16989
|
getMonthState,
|
|
16596
16990
|
handleMonthSelect,
|
|
16991
|
+
names,
|
|
16597
16992
|
year: viewDate.year
|
|
16598
16993
|
}
|
|
16599
16994
|
) : /* @__PURE__ */ jsx(
|
|
@@ -16803,6 +17198,7 @@ const MAX_VISIBLE_ITEMS = 2;
|
|
|
16803
17198
|
const Chip = (props) => {
|
|
16804
17199
|
const groupContext = useChipGroup();
|
|
16805
17200
|
const fieldContext = useFieldContext();
|
|
17201
|
+
const { labels } = useLocale();
|
|
16806
17202
|
const slotContext = useSlotContext();
|
|
16807
17203
|
const {
|
|
16808
17204
|
size: sizeProp,
|
|
@@ -16923,7 +17319,7 @@ const Chip = (props) => {
|
|
|
16923
17319
|
};
|
|
16924
17320
|
const isOverflowing = items !== void 0 && items.length > MAX_VISIBLE_ITEMS;
|
|
16925
17321
|
const label2 = items ? isOverflowing ? `${items.slice(0, MAX_VISIBLE_ITEMS).join(", ")} +${items.length - MAX_VISIBLE_ITEMS}` : items.join(", ") : children;
|
|
16926
|
-
const resolvedDismissLabel = dismissLabel ||
|
|
17322
|
+
const resolvedDismissLabel = dismissLabel || labels.removeItem(items ? items.join(", ") : String(children));
|
|
16927
17323
|
const handleDismissClick = (e) => {
|
|
16928
17324
|
e.stopPropagation();
|
|
16929
17325
|
onDismiss == null ? void 0 : onDismiss();
|
|
@@ -17637,13 +18033,14 @@ const getSeparatorContent = (format, separator) => {
|
|
|
17637
18033
|
return format === "YYYY-MM-DD" ? "-" : "/";
|
|
17638
18034
|
};
|
|
17639
18035
|
const SegmentedDate = (props) => {
|
|
18036
|
+
const { labels } = useLocale();
|
|
17640
18037
|
const {
|
|
17641
18038
|
value,
|
|
17642
18039
|
defaultValue = null,
|
|
17643
18040
|
onChange,
|
|
17644
18041
|
format = "YYYY-MM-DD",
|
|
17645
18042
|
separators,
|
|
17646
|
-
label: label2 =
|
|
18043
|
+
label: label2 = labels.date,
|
|
17647
18044
|
disabled,
|
|
17648
18045
|
onFocusWithin,
|
|
17649
18046
|
onBlurWithin,
|
|
@@ -17667,8 +18064,8 @@ const SegmentedDate = (props) => {
|
|
|
17667
18064
|
type: "segment",
|
|
17668
18065
|
kind: "numeric",
|
|
17669
18066
|
id: "month",
|
|
17670
|
-
label:
|
|
17671
|
-
placeholder:
|
|
18067
|
+
label: labels.month,
|
|
18068
|
+
placeholder: labels.monthPlaceholder,
|
|
17672
18069
|
value: values.month,
|
|
17673
18070
|
digits: 2,
|
|
17674
18071
|
min: 1,
|
|
@@ -17678,8 +18075,8 @@ const SegmentedDate = (props) => {
|
|
|
17678
18075
|
type: "segment",
|
|
17679
18076
|
kind: "numeric",
|
|
17680
18077
|
id: "day",
|
|
17681
|
-
label:
|
|
17682
|
-
placeholder:
|
|
18078
|
+
label: labels.day,
|
|
18079
|
+
placeholder: labels.dayPlaceholder,
|
|
17683
18080
|
value: values.day,
|
|
17684
18081
|
digits: 2,
|
|
17685
18082
|
min: 1,
|
|
@@ -17696,8 +18093,8 @@ const SegmentedDate = (props) => {
|
|
|
17696
18093
|
type: "segment",
|
|
17697
18094
|
kind: "numeric",
|
|
17698
18095
|
id: "year",
|
|
17699
|
-
label:
|
|
17700
|
-
placeholder:
|
|
18096
|
+
label: labels.year,
|
|
18097
|
+
placeholder: labels.yearPlaceholder,
|
|
17701
18098
|
value: values.year,
|
|
17702
18099
|
digits: 4,
|
|
17703
18100
|
min: 1900,
|
|
@@ -17725,7 +18122,7 @@ const SegmentedDate = (props) => {
|
|
|
17725
18122
|
separator("day-year"),
|
|
17726
18123
|
yearSegment
|
|
17727
18124
|
];
|
|
17728
|
-
}, [format, resolvedValue, separatorGap, separators]);
|
|
18125
|
+
}, [format, labels, resolvedValue, separatorGap, separators]);
|
|
17729
18126
|
return /* @__PURE__ */ jsx(
|
|
17730
18127
|
SegmentedInput,
|
|
17731
18128
|
{
|
|
@@ -17759,6 +18156,7 @@ const to24Hour = (hour12, meridiem) => {
|
|
|
17759
18156
|
return hour12 === 12 ? 12 : hour12 + 12;
|
|
17760
18157
|
};
|
|
17761
18158
|
const SegmentedTime = (props) => {
|
|
18159
|
+
const { labels } = useLocale();
|
|
17762
18160
|
const {
|
|
17763
18161
|
value,
|
|
17764
18162
|
defaultValue = null,
|
|
@@ -17766,7 +18164,7 @@ const SegmentedTime = (props) => {
|
|
|
17766
18164
|
timeFormat,
|
|
17767
18165
|
minuteStep = 1,
|
|
17768
18166
|
separators,
|
|
17769
|
-
label: label2 =
|
|
18167
|
+
label: label2 = labels.time,
|
|
17770
18168
|
disabled,
|
|
17771
18169
|
onFocusWithin,
|
|
17772
18170
|
onBlurWithin,
|
|
@@ -17791,8 +18189,8 @@ const SegmentedTime = (props) => {
|
|
|
17791
18189
|
type: "segment",
|
|
17792
18190
|
kind: "numeric",
|
|
17793
18191
|
id: "hour",
|
|
17794
|
-
label:
|
|
17795
|
-
placeholder:
|
|
18192
|
+
label: labels.hour,
|
|
18193
|
+
placeholder: labels.hourPlaceholder,
|
|
17796
18194
|
value: displayHour,
|
|
17797
18195
|
digits: 2,
|
|
17798
18196
|
min: resolvedTimeFormat === "12" ? 1 : 0,
|
|
@@ -17808,8 +18206,8 @@ const SegmentedTime = (props) => {
|
|
|
17808
18206
|
type: "segment",
|
|
17809
18207
|
kind: "numeric",
|
|
17810
18208
|
id: "minute",
|
|
17811
|
-
label:
|
|
17812
|
-
placeholder:
|
|
18209
|
+
label: labels.minute,
|
|
18210
|
+
placeholder: labels.minutePlaceholder,
|
|
17813
18211
|
value: (resolvedValue == null ? void 0 : resolvedValue.minute) ?? null,
|
|
17814
18212
|
digits: 2,
|
|
17815
18213
|
min: 0,
|
|
@@ -17829,7 +18227,7 @@ const SegmentedTime = (props) => {
|
|
|
17829
18227
|
type: "segment",
|
|
17830
18228
|
kind: "choice",
|
|
17831
18229
|
id: "meridiem",
|
|
17832
|
-
label:
|
|
18230
|
+
label: labels.meridiem,
|
|
17833
18231
|
placeholder: "AM",
|
|
17834
18232
|
value: meridiem,
|
|
17835
18233
|
choices: ["AM", "PM"],
|
|
@@ -17841,7 +18239,13 @@ const SegmentedTime = (props) => {
|
|
|
17841
18239
|
);
|
|
17842
18240
|
}
|
|
17843
18241
|
return nextItems;
|
|
17844
|
-
}, [
|
|
18242
|
+
}, [
|
|
18243
|
+
labels,
|
|
18244
|
+
resolvedMinuteStep,
|
|
18245
|
+
resolvedTimeFormat,
|
|
18246
|
+
resolvedValue,
|
|
18247
|
+
separators
|
|
18248
|
+
]);
|
|
17845
18249
|
return /* @__PURE__ */ jsx(
|
|
17846
18250
|
SegmentedInput,
|
|
17847
18251
|
{
|
|
@@ -17923,6 +18327,7 @@ const InputSlot = ({
|
|
|
17923
18327
|
};
|
|
17924
18328
|
const DateInput = (props) => {
|
|
17925
18329
|
const fieldContext = useFieldContext();
|
|
18330
|
+
const { labels } = useLocale();
|
|
17926
18331
|
const {
|
|
17927
18332
|
id,
|
|
17928
18333
|
value,
|
|
@@ -17935,7 +18340,7 @@ const DateInput = (props) => {
|
|
|
17935
18340
|
iconBefore,
|
|
17936
18341
|
iconAfter,
|
|
17937
18342
|
clearable = true,
|
|
17938
|
-
clearLabel =
|
|
18343
|
+
clearLabel = labels.clearDate,
|
|
17939
18344
|
error: errorProp,
|
|
17940
18345
|
disabled: disabledProp,
|
|
17941
18346
|
invalid: invalidProp,
|
|
@@ -18031,20 +18436,21 @@ const DateInput = (props) => {
|
|
|
18031
18436
|
const EMPTY_RANGE$6 = { start: null, end: null };
|
|
18032
18437
|
const DateRangeInput = (props) => {
|
|
18033
18438
|
const fieldContext = useFieldContext();
|
|
18439
|
+
const { labels } = useLocale();
|
|
18034
18440
|
const {
|
|
18035
18441
|
id,
|
|
18036
18442
|
value,
|
|
18037
18443
|
defaultValue,
|
|
18038
18444
|
onChange,
|
|
18039
18445
|
dateFormat,
|
|
18040
|
-
startLabel =
|
|
18041
|
-
endLabel =
|
|
18446
|
+
startLabel = labels.startDate,
|
|
18447
|
+
endLabel = labels.endDate,
|
|
18042
18448
|
before,
|
|
18043
18449
|
after,
|
|
18044
18450
|
iconBefore,
|
|
18045
18451
|
iconAfter,
|
|
18046
18452
|
clearable = true,
|
|
18047
|
-
clearLabel =
|
|
18453
|
+
clearLabel = labels.clearDateRange,
|
|
18048
18454
|
error: errorProp,
|
|
18049
18455
|
disabled: disabledProp,
|
|
18050
18456
|
invalid: invalidProp,
|
|
@@ -18183,6 +18589,7 @@ const DateRangeInput = (props) => {
|
|
|
18183
18589
|
};
|
|
18184
18590
|
const TimeInput = (props) => {
|
|
18185
18591
|
const fieldContext = useFieldContext();
|
|
18592
|
+
const { labels } = useLocale();
|
|
18186
18593
|
const {
|
|
18187
18594
|
id,
|
|
18188
18595
|
value,
|
|
@@ -18196,7 +18603,7 @@ const TimeInput = (props) => {
|
|
|
18196
18603
|
iconBefore,
|
|
18197
18604
|
iconAfter,
|
|
18198
18605
|
clearable = true,
|
|
18199
|
-
clearLabel =
|
|
18606
|
+
clearLabel = labels.clearTime,
|
|
18200
18607
|
error: errorProp,
|
|
18201
18608
|
disabled: disabledProp,
|
|
18202
18609
|
invalid: invalidProp,
|
|
@@ -18295,6 +18702,7 @@ const TimeInput = (props) => {
|
|
|
18295
18702
|
const EMPTY_RANGE$5 = { start: null, end: null };
|
|
18296
18703
|
const TimeRangeInput = (props) => {
|
|
18297
18704
|
const fieldContext = useFieldContext();
|
|
18705
|
+
const { labels } = useLocale();
|
|
18298
18706
|
const {
|
|
18299
18707
|
id,
|
|
18300
18708
|
value,
|
|
@@ -18302,14 +18710,14 @@ const TimeRangeInput = (props) => {
|
|
|
18302
18710
|
onChange,
|
|
18303
18711
|
timeFormat,
|
|
18304
18712
|
minuteStep,
|
|
18305
|
-
startLabel =
|
|
18306
|
-
endLabel =
|
|
18713
|
+
startLabel = labels.startTime,
|
|
18714
|
+
endLabel = labels.endTime,
|
|
18307
18715
|
before,
|
|
18308
18716
|
after,
|
|
18309
18717
|
iconBefore,
|
|
18310
18718
|
iconAfter,
|
|
18311
18719
|
clearable = true,
|
|
18312
|
-
clearLabel =
|
|
18720
|
+
clearLabel = labels.clearTimeRange,
|
|
18313
18721
|
error: errorProp,
|
|
18314
18722
|
disabled: disabledProp,
|
|
18315
18723
|
invalid: invalidProp,
|
|
@@ -18450,6 +18858,7 @@ const TimeRangeInput = (props) => {
|
|
|
18450
18858
|
};
|
|
18451
18859
|
const DateTimeInput = (props) => {
|
|
18452
18860
|
const fieldContext = useFieldContext();
|
|
18861
|
+
const { labels } = useLocale();
|
|
18453
18862
|
const {
|
|
18454
18863
|
id,
|
|
18455
18864
|
value,
|
|
@@ -18458,14 +18867,14 @@ const DateTimeInput = (props) => {
|
|
|
18458
18867
|
dateFormat,
|
|
18459
18868
|
timeFormat,
|
|
18460
18869
|
minuteStep,
|
|
18461
|
-
dateLabel =
|
|
18462
|
-
timeLabel =
|
|
18870
|
+
dateLabel = labels.date,
|
|
18871
|
+
timeLabel = labels.time,
|
|
18463
18872
|
before,
|
|
18464
18873
|
after,
|
|
18465
18874
|
iconBefore,
|
|
18466
18875
|
iconAfter,
|
|
18467
18876
|
clearable = true,
|
|
18468
|
-
clearLabel =
|
|
18877
|
+
clearLabel = labels.clearDateTime,
|
|
18469
18878
|
error: errorProp,
|
|
18470
18879
|
disabled: disabledProp,
|
|
18471
18880
|
invalid: invalidProp,
|
|
@@ -18612,6 +19021,20 @@ const DateTimeInput = (props) => {
|
|
|
18612
19021
|
};
|
|
18613
19022
|
const FloatingLayerContext = createContext("elevated");
|
|
18614
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
|
+
};
|
|
18615
19038
|
const MENU_COMPONENT_TYPES = {
|
|
18616
19039
|
group: "MenuGroup",
|
|
18617
19040
|
item: "MenuItem",
|
|
@@ -18683,14 +19106,7 @@ const isItemMatch = ({
|
|
|
18683
19106
|
return textValue.toLowerCase().includes(query.trim().toLowerCase());
|
|
18684
19107
|
};
|
|
18685
19108
|
const getComponentType = (node) => {
|
|
18686
|
-
|
|
18687
|
-
return null;
|
|
18688
|
-
}
|
|
18689
|
-
if (!("type" in node)) {
|
|
18690
|
-
return null;
|
|
18691
|
-
}
|
|
18692
|
-
const type = node.type;
|
|
18693
|
-
return (type == null ? void 0 : type[menuComponentTypeKey]) ?? null;
|
|
19109
|
+
return getCompoundComponentType(node, menuComponentTypeKey);
|
|
18694
19110
|
};
|
|
18695
19111
|
const hasMatchingItems = (children, filterContext) => {
|
|
18696
19112
|
return Children.toArray(children).some((childNode) => {
|
|
@@ -18902,6 +19318,7 @@ const withLevelScopedKeys = (nodes, levelKey) => {
|
|
|
18902
19318
|
};
|
|
18903
19319
|
const Menu = (props) => {
|
|
18904
19320
|
var _a;
|
|
19321
|
+
const { labels } = useLocale();
|
|
18905
19322
|
const nodeId = useFloatingNodeId();
|
|
18906
19323
|
const floatingLayer = useFloatingLayer();
|
|
18907
19324
|
const {
|
|
@@ -19318,7 +19735,7 @@ const Menu = (props) => {
|
|
|
19318
19735
|
...otherProps,
|
|
19319
19736
|
style: floatingStyle,
|
|
19320
19737
|
children: [
|
|
19321
|
-
!hasVisibleResults && /* @__PURE__ */ jsx(Box, { className: classes.noResults, children: renderNoResults ?? /* @__PURE__ */ jsx(Text, { textStyle: "body.sm", children:
|
|
19738
|
+
!hasVisibleResults && /* @__PURE__ */ jsx(Box, { className: classes.noResults, children: renderNoResults ?? /* @__PURE__ */ jsx(Text, { textStyle: "body.sm", children: labels.noResults }) }),
|
|
19322
19739
|
hasVisibleResults && /* @__PURE__ */ jsxs(
|
|
19323
19740
|
Box,
|
|
19324
19741
|
{
|
|
@@ -19595,7 +20012,11 @@ const MenuGroup = (props) => {
|
|
|
19595
20012
|
}
|
|
19596
20013
|
);
|
|
19597
20014
|
};
|
|
19598
|
-
|
|
20015
|
+
setCompoundComponentType(
|
|
20016
|
+
MenuGroup,
|
|
20017
|
+
menuComponentTypeKey,
|
|
20018
|
+
MENU_COMPONENT_TYPES.group
|
|
20019
|
+
);
|
|
19599
20020
|
const getHighlightParts = (value, query) => {
|
|
19600
20021
|
const safeQuery = query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
19601
20022
|
const regExp = new RegExp(`(${safeQuery})`, "ig");
|
|
@@ -19892,7 +20313,11 @@ const MenuItem = (props) => {
|
|
|
19892
20313
|
}
|
|
19893
20314
|
);
|
|
19894
20315
|
};
|
|
19895
|
-
|
|
20316
|
+
setCompoundComponentType(
|
|
20317
|
+
MenuItem,
|
|
20318
|
+
menuComponentTypeKey,
|
|
20319
|
+
MENU_COMPONENT_TYPES.item
|
|
20320
|
+
);
|
|
19896
20321
|
const MenuProvider = ({ children, root, filter }) => {
|
|
19897
20322
|
const rootValue = {
|
|
19898
20323
|
...defaultMenuRootContextValue,
|
|
@@ -20378,7 +20803,11 @@ const SubMenu = (props) => {
|
|
|
20378
20803
|
) }) })
|
|
20379
20804
|
] });
|
|
20380
20805
|
};
|
|
20381
|
-
|
|
20806
|
+
setCompoundComponentType(
|
|
20807
|
+
SubMenu,
|
|
20808
|
+
menuComponentTypeKey,
|
|
20809
|
+
MENU_COMPONENT_TYPES.subMenu
|
|
20810
|
+
);
|
|
20382
20811
|
const DateMenu = (props) => {
|
|
20383
20812
|
const {
|
|
20384
20813
|
trigger,
|
|
@@ -20442,6 +20871,7 @@ const DateMenu = (props) => {
|
|
|
20442
20871
|
const EMPTY_RANGE$4 = { start: null, end: null };
|
|
20443
20872
|
const sameMonth = (a, b) => a.year === b.year && a.month === b.month;
|
|
20444
20873
|
const DateRangeMenu = (props) => {
|
|
20874
|
+
const { labels } = useLocale();
|
|
20445
20875
|
const {
|
|
20446
20876
|
trigger,
|
|
20447
20877
|
open: controlledOpen,
|
|
@@ -20453,8 +20883,8 @@ const DateRangeMenu = (props) => {
|
|
|
20453
20883
|
minDate,
|
|
20454
20884
|
maxDate,
|
|
20455
20885
|
disabled = false,
|
|
20456
|
-
startLabel =
|
|
20457
|
-
endLabel =
|
|
20886
|
+
startLabel = labels.startDate,
|
|
20887
|
+
endLabel = labels.endDate,
|
|
20458
20888
|
...rest
|
|
20459
20889
|
} = props;
|
|
20460
20890
|
const isInline = rest.inline === true;
|
|
@@ -20555,14 +20985,14 @@ const DateRangeMenu = (props) => {
|
|
|
20555
20985
|
)
|
|
20556
20986
|
] }),
|
|
20557
20987
|
/* @__PURE__ */ jsxs(Box, { className: classes.footer, children: [
|
|
20558
|
-
/* @__PURE__ */ jsx(Button, { variant: "standard", onClick: handleCancel, children:
|
|
20988
|
+
/* @__PURE__ */ jsx(Button, { variant: "standard", onClick: handleCancel, children: labels.cancel }),
|
|
20559
20989
|
/* @__PURE__ */ jsx(
|
|
20560
20990
|
Button,
|
|
20561
20991
|
{
|
|
20562
20992
|
variant: "primary",
|
|
20563
20993
|
disabled: !draft.start || !draft.end,
|
|
20564
20994
|
onClick: handleApply,
|
|
20565
|
-
children:
|
|
20995
|
+
children: labels.apply
|
|
20566
20996
|
}
|
|
20567
20997
|
)
|
|
20568
20998
|
] })
|
|
@@ -20750,6 +21180,7 @@ const scrollSelectedIntoView$2 = (colRef) => {
|
|
|
20750
21180
|
col.scrollTop = Math.min(Math.max(targetScrollTop, 0), maxScrollTop);
|
|
20751
21181
|
};
|
|
20752
21182
|
const TimeMenu = (props) => {
|
|
21183
|
+
const { labels } = useLocale();
|
|
20753
21184
|
const {
|
|
20754
21185
|
trigger,
|
|
20755
21186
|
open: controlledOpen,
|
|
@@ -20823,9 +21254,9 @@ const TimeMenu = (props) => {
|
|
|
20823
21254
|
ref: hourColRef,
|
|
20824
21255
|
className: classes.column,
|
|
20825
21256
|
role: "listbox",
|
|
20826
|
-
"aria-label":
|
|
21257
|
+
"aria-label": labels.hour,
|
|
20827
21258
|
children: [
|
|
20828
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children:
|
|
21259
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children: labels.hourColumn }),
|
|
20829
21260
|
/* @__PURE__ */ jsx(List, { children: hourValues.map((hour) => /* @__PURE__ */ jsx(
|
|
20830
21261
|
ListItem,
|
|
20831
21262
|
{
|
|
@@ -20845,9 +21276,9 @@ const TimeMenu = (props) => {
|
|
|
20845
21276
|
ref: minuteColRef,
|
|
20846
21277
|
className: classes.column,
|
|
20847
21278
|
role: "listbox",
|
|
20848
|
-
"aria-label":
|
|
21279
|
+
"aria-label": labels.minute,
|
|
20849
21280
|
children: [
|
|
20850
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children:
|
|
21281
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children: labels.minuteColumn }),
|
|
20851
21282
|
/* @__PURE__ */ jsx(List, { children: minuteValues.map((minute) => /* @__PURE__ */ jsx(
|
|
20852
21283
|
ListItem,
|
|
20853
21284
|
{
|
|
@@ -20867,9 +21298,9 @@ const TimeMenu = (props) => {
|
|
|
20867
21298
|
ref: meridiemColRef,
|
|
20868
21299
|
className: classes.column,
|
|
20869
21300
|
role: "listbox",
|
|
20870
|
-
"aria-label":
|
|
21301
|
+
"aria-label": labels.meridiem,
|
|
20871
21302
|
children: [
|
|
20872
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children:
|
|
21303
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children: labels.meridiemColumn }),
|
|
20873
21304
|
/* @__PURE__ */ jsx(List, { children: ["AM", "PM"].map((meridiem) => /* @__PURE__ */ jsx(
|
|
20874
21305
|
ListItem,
|
|
20875
21306
|
{
|
|
@@ -20914,6 +21345,7 @@ const TimeColumns = ({
|
|
|
20914
21345
|
value,
|
|
20915
21346
|
onChange
|
|
20916
21347
|
}) => {
|
|
21348
|
+
const { labels } = useLocale();
|
|
20917
21349
|
const displayHour = value && timeFormat === "12" ? to12Hour$1(value.hour).hour12 : (value == null ? void 0 : value.hour) ?? null;
|
|
20918
21350
|
const displayMeridiem = value && timeFormat === "12" ? to12Hour$1(value.hour).meridiem : null;
|
|
20919
21351
|
const displayMinute = (value == null ? void 0 : value.minute) ?? null;
|
|
@@ -20947,9 +21379,9 @@ const TimeColumns = ({
|
|
|
20947
21379
|
ref: hourColRef,
|
|
20948
21380
|
className: classes.column,
|
|
20949
21381
|
role: "listbox",
|
|
20950
|
-
"aria-label":
|
|
21382
|
+
"aria-label": labels.fieldHour(label2),
|
|
20951
21383
|
children: [
|
|
20952
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children:
|
|
21384
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children: labels.hourColumn }),
|
|
20953
21385
|
/* @__PURE__ */ jsx(List, { children: hourValues.map((hour) => /* @__PURE__ */ jsx(
|
|
20954
21386
|
ListItem,
|
|
20955
21387
|
{
|
|
@@ -20969,9 +21401,9 @@ const TimeColumns = ({
|
|
|
20969
21401
|
ref: minuteColRef,
|
|
20970
21402
|
className: classes.column,
|
|
20971
21403
|
role: "listbox",
|
|
20972
|
-
"aria-label":
|
|
21404
|
+
"aria-label": labels.fieldMinute(label2),
|
|
20973
21405
|
children: [
|
|
20974
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children:
|
|
21406
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children: labels.minuteColumn }),
|
|
20975
21407
|
/* @__PURE__ */ jsx(List, { children: minuteValues.map((minute) => /* @__PURE__ */ jsx(
|
|
20976
21408
|
ListItem,
|
|
20977
21409
|
{
|
|
@@ -20991,9 +21423,9 @@ const TimeColumns = ({
|
|
|
20991
21423
|
ref: meridiemColRef,
|
|
20992
21424
|
className: classes.column,
|
|
20993
21425
|
role: "listbox",
|
|
20994
|
-
"aria-label":
|
|
21426
|
+
"aria-label": labels.fieldMeridiem(label2),
|
|
20995
21427
|
children: [
|
|
20996
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children:
|
|
21428
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: classes.columnHeader, children: labels.meridiemColumn }),
|
|
20997
21429
|
/* @__PURE__ */ jsx(List, { children: ["AM", "PM"].map((meridiem) => /* @__PURE__ */ jsx(
|
|
20998
21430
|
ListItem,
|
|
20999
21431
|
{
|
|
@@ -21010,6 +21442,7 @@ const TimeColumns = ({
|
|
|
21010
21442
|
] });
|
|
21011
21443
|
};
|
|
21012
21444
|
const TimeRangeMenu = (props) => {
|
|
21445
|
+
const { labels } = useLocale();
|
|
21013
21446
|
const {
|
|
21014
21447
|
trigger,
|
|
21015
21448
|
open: controlledOpen,
|
|
@@ -21021,8 +21454,8 @@ const TimeRangeMenu = (props) => {
|
|
|
21021
21454
|
timeFormat = "12",
|
|
21022
21455
|
minuteStep = 1,
|
|
21023
21456
|
disabled = false,
|
|
21024
|
-
startLabel =
|
|
21025
|
-
endLabel =
|
|
21457
|
+
startLabel = labels.startTime,
|
|
21458
|
+
endLabel = labels.endTime,
|
|
21026
21459
|
...rest
|
|
21027
21460
|
} = props;
|
|
21028
21461
|
const isInline = rest.inline === true;
|
|
@@ -21094,14 +21527,14 @@ const TimeRangeMenu = (props) => {
|
|
|
21094
21527
|
)
|
|
21095
21528
|
] }),
|
|
21096
21529
|
/* @__PURE__ */ jsxs(Box, { className: classes.footer, children: [
|
|
21097
|
-
/* @__PURE__ */ jsx(Button, { variant: "standard", onClick: handleCancel, children:
|
|
21530
|
+
/* @__PURE__ */ jsx(Button, { variant: "standard", onClick: handleCancel, children: labels.cancel }),
|
|
21098
21531
|
/* @__PURE__ */ jsx(
|
|
21099
21532
|
Button,
|
|
21100
21533
|
{
|
|
21101
21534
|
variant: "primary",
|
|
21102
21535
|
disabled: !draft.start || !draft.end,
|
|
21103
21536
|
onClick: handleApply,
|
|
21104
|
-
children:
|
|
21537
|
+
children: labels.apply
|
|
21105
21538
|
}
|
|
21106
21539
|
)
|
|
21107
21540
|
] })
|
|
@@ -21127,6 +21560,7 @@ const scrollSelectedIntoView = (colRef) => {
|
|
|
21127
21560
|
col.scrollTop = Math.min(Math.max(targetScrollTop, 0), maxScrollTop);
|
|
21128
21561
|
};
|
|
21129
21562
|
const DateTimeMenu = (props) => {
|
|
21563
|
+
const { labels } = useLocale();
|
|
21130
21564
|
const {
|
|
21131
21565
|
trigger,
|
|
21132
21566
|
open: controlledOpen,
|
|
@@ -21275,9 +21709,9 @@ const DateTimeMenu = (props) => {
|
|
|
21275
21709
|
ref: hourColRef,
|
|
21276
21710
|
className: columnClasses.column,
|
|
21277
21711
|
role: "listbox",
|
|
21278
|
-
"aria-label":
|
|
21712
|
+
"aria-label": labels.hour,
|
|
21279
21713
|
children: [
|
|
21280
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: columnClasses.columnHeader, children:
|
|
21714
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: columnClasses.columnHeader, children: labels.hourColumn }),
|
|
21281
21715
|
/* @__PURE__ */ jsx(List, { children: hourValues.map((hour) => /* @__PURE__ */ jsx(
|
|
21282
21716
|
ListItem,
|
|
21283
21717
|
{
|
|
@@ -21297,9 +21731,9 @@ const DateTimeMenu = (props) => {
|
|
|
21297
21731
|
ref: minuteColRef,
|
|
21298
21732
|
className: columnClasses.column,
|
|
21299
21733
|
role: "listbox",
|
|
21300
|
-
"aria-label":
|
|
21734
|
+
"aria-label": labels.minute,
|
|
21301
21735
|
children: [
|
|
21302
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: columnClasses.columnHeader, children:
|
|
21736
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: columnClasses.columnHeader, children: labels.minuteColumn }),
|
|
21303
21737
|
/* @__PURE__ */ jsx(List, { children: minuteValues.map((minute) => /* @__PURE__ */ jsx(
|
|
21304
21738
|
ListItem,
|
|
21305
21739
|
{
|
|
@@ -21319,9 +21753,9 @@ const DateTimeMenu = (props) => {
|
|
|
21319
21753
|
ref: meridiemColRef,
|
|
21320
21754
|
className: columnClasses.column,
|
|
21321
21755
|
role: "listbox",
|
|
21322
|
-
"aria-label":
|
|
21756
|
+
"aria-label": labels.meridiem,
|
|
21323
21757
|
children: [
|
|
21324
|
-
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: columnClasses.columnHeader, children:
|
|
21758
|
+
/* @__PURE__ */ jsx(Box, { "data-column-header": true, className: columnClasses.columnHeader, children: labels.meridiemColumn }),
|
|
21325
21759
|
/* @__PURE__ */ jsx(List, { children: ["AM", "PM"].map((meridiem) => /* @__PURE__ */ jsx(
|
|
21326
21760
|
ListItem,
|
|
21327
21761
|
{
|
|
@@ -21340,14 +21774,14 @@ const DateTimeMenu = (props) => {
|
|
|
21340
21774
|
)
|
|
21341
21775
|
] }),
|
|
21342
21776
|
/* @__PURE__ */ jsxs(Box, { className: classes.footer, children: [
|
|
21343
|
-
/* @__PURE__ */ jsx(Button, { variant: "standard", onClick: handleCancel, children:
|
|
21777
|
+
/* @__PURE__ */ jsx(Button, { variant: "standard", onClick: handleCancel, children: labels.cancel }),
|
|
21344
21778
|
/* @__PURE__ */ jsx(
|
|
21345
21779
|
Button,
|
|
21346
21780
|
{
|
|
21347
21781
|
variant: "primary",
|
|
21348
21782
|
disabled: !draftDate || !draftTime,
|
|
21349
21783
|
onClick: handleApply,
|
|
21350
|
-
children:
|
|
21784
|
+
children: labels.apply
|
|
21351
21785
|
}
|
|
21352
21786
|
)
|
|
21353
21787
|
] })
|
|
@@ -21811,6 +22245,7 @@ const DateTimePicker = (props) => {
|
|
|
21811
22245
|
const WRAP_BREAKPOINT = 458;
|
|
21812
22246
|
const EMPTY_RANGE = { start: null, end: null };
|
|
21813
22247
|
const DateTimeRangePicker = (props) => {
|
|
22248
|
+
const { labels } = useLocale();
|
|
21814
22249
|
const {
|
|
21815
22250
|
before,
|
|
21816
22251
|
after,
|
|
@@ -21829,12 +22264,12 @@ const DateTimeRangePicker = (props) => {
|
|
|
21829
22264
|
minuteStep,
|
|
21830
22265
|
minDate,
|
|
21831
22266
|
maxDate,
|
|
21832
|
-
startDateLabel =
|
|
21833
|
-
startTimeLabel =
|
|
21834
|
-
endDateLabel =
|
|
21835
|
-
endTimeLabel =
|
|
21836
|
-
startClearLabel =
|
|
21837
|
-
endClearLabel =
|
|
22267
|
+
startDateLabel = labels.startDate,
|
|
22268
|
+
startTimeLabel = labels.startTime,
|
|
22269
|
+
endDateLabel = labels.endDate,
|
|
22270
|
+
endTimeLabel = labels.endTime,
|
|
22271
|
+
startClearLabel = labels.clearStartDateTime,
|
|
22272
|
+
endClearLabel = labels.clearEndDateTime,
|
|
21838
22273
|
placement
|
|
21839
22274
|
} = props;
|
|
21840
22275
|
const [currentValue, setCurrentValue] = useControllableState({
|
|
@@ -22459,6 +22894,7 @@ const ModalFooter = (props) => {
|
|
|
22459
22894
|
return /* @__PURE__ */ jsx(Box, { className: cx(classes.footer, className), ...otherProps, children });
|
|
22460
22895
|
};
|
|
22461
22896
|
const ModalHeader = (props) => {
|
|
22897
|
+
const { labels } = useLocale();
|
|
22462
22898
|
const { title, titleId, showCloseButton = true, children, ...rest } = props;
|
|
22463
22899
|
const [className, otherProps] = splitProps(rest);
|
|
22464
22900
|
const classes = modal();
|
|
@@ -22481,8 +22917,8 @@ const ModalHeader = (props) => {
|
|
|
22481
22917
|
variant: "ghost",
|
|
22482
22918
|
size: isSm ? "md" : "lg",
|
|
22483
22919
|
onClick: onClose,
|
|
22484
|
-
altText:
|
|
22485
|
-
"aria-label":
|
|
22920
|
+
altText: labels.closeDialog,
|
|
22921
|
+
"aria-label": labels.closeDialog,
|
|
22486
22922
|
className: classes.closeButton,
|
|
22487
22923
|
iconName: "x"
|
|
22488
22924
|
}
|
|
@@ -22490,6 +22926,7 @@ const ModalHeader = (props) => {
|
|
|
22490
22926
|
] }) });
|
|
22491
22927
|
};
|
|
22492
22928
|
const Modal = (props) => {
|
|
22929
|
+
const { labels } = useLocale();
|
|
22493
22930
|
const {
|
|
22494
22931
|
open,
|
|
22495
22932
|
onOpenChange,
|
|
@@ -22497,8 +22934,8 @@ const Modal = (props) => {
|
|
|
22497
22934
|
defaultValues,
|
|
22498
22935
|
onSubmit,
|
|
22499
22936
|
children,
|
|
22500
|
-
submitLabel =
|
|
22501
|
-
cancelLabel =
|
|
22937
|
+
submitLabel = labels.submit,
|
|
22938
|
+
cancelLabel = labels.cancel,
|
|
22502
22939
|
submitDisabled = false,
|
|
22503
22940
|
footer,
|
|
22504
22941
|
size: size2,
|
|
@@ -22581,13 +23018,14 @@ const typeDefaults = {
|
|
|
22581
23018
|
}
|
|
22582
23019
|
};
|
|
22583
23020
|
const ConfirmationModal = (props) => {
|
|
23021
|
+
const { labels } = useLocale();
|
|
22584
23022
|
const {
|
|
22585
23023
|
open,
|
|
22586
23024
|
onOpenChange,
|
|
22587
23025
|
title,
|
|
22588
23026
|
description,
|
|
22589
23027
|
confirmLabel,
|
|
22590
|
-
cancelLabel =
|
|
23028
|
+
cancelLabel = labels.cancel,
|
|
22591
23029
|
type = "default",
|
|
22592
23030
|
onConfirm,
|
|
22593
23031
|
confirmLoading = false,
|
|
@@ -22880,7 +23318,571 @@ const RadioInput = (props) => {
|
|
|
22880
23318
|
}
|
|
22881
23319
|
);
|
|
22882
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
|
+
};
|
|
22883
23884
|
const AutocompleteListbox = (props) => {
|
|
23885
|
+
const { labels } = useLocale();
|
|
22884
23886
|
const {
|
|
22885
23887
|
activeIndex,
|
|
22886
23888
|
baseId,
|
|
@@ -22915,7 +23917,7 @@ const AutocompleteListbox = (props) => {
|
|
|
22915
23917
|
ref: floatingRef,
|
|
22916
23918
|
id: listboxId,
|
|
22917
23919
|
role: "listbox",
|
|
22918
|
-
"aria-label":
|
|
23920
|
+
"aria-label": labels.suggestions,
|
|
22919
23921
|
"aria-multiselectable": multiple || void 0,
|
|
22920
23922
|
"aria-busy": loading || loadingMore || void 0,
|
|
22921
23923
|
density,
|
|
@@ -23240,7 +24242,6 @@ const resolveSelectedAutocompleteOption = (selectedValue, childOptionByValue, op
|
|
|
23240
24242
|
};
|
|
23241
24243
|
const getFirstEnabledOptionIndex = (options) => options.findIndex((option) => !option.disabled);
|
|
23242
24244
|
const LOAD_MORE_THRESHOLD_PX = 32;
|
|
23243
|
-
const defaultGetCreateOptionLabel = (inputValue) => `Add “${inputValue}”`;
|
|
23244
24245
|
const chipSizeByAutocompleteSize = {
|
|
23245
24246
|
sm: "sm",
|
|
23246
24247
|
md: "sm",
|
|
@@ -23264,6 +24265,7 @@ const useAutocompleteController = (props) => {
|
|
|
23264
24265
|
var _a;
|
|
23265
24266
|
const floatingLayer = useFloatingLayer();
|
|
23266
24267
|
const fieldContext = useFieldContext();
|
|
24268
|
+
const { labels } = useLocale();
|
|
23267
24269
|
const {
|
|
23268
24270
|
value: controlledValue,
|
|
23269
24271
|
defaultValue,
|
|
@@ -23279,9 +24281,9 @@ const useAutocompleteController = (props) => {
|
|
|
23279
24281
|
multiple = false,
|
|
23280
24282
|
allowCustomValue = false,
|
|
23281
24283
|
isCustomValue,
|
|
23282
|
-
getCreateOptionLabel =
|
|
24284
|
+
getCreateOptionLabel = labels.addOption,
|
|
23283
24285
|
limitTags,
|
|
23284
|
-
placeholder =
|
|
24286
|
+
placeholder = labels.selectPlaceholder,
|
|
23285
24287
|
placement = "bottom-start",
|
|
23286
24288
|
offset: offset2 = 4,
|
|
23287
24289
|
children,
|
|
@@ -23298,8 +24300,8 @@ const useAutocompleteController = (props) => {
|
|
|
23298
24300
|
loadingMore = false,
|
|
23299
24301
|
hasMore = false,
|
|
23300
24302
|
onLoadMore,
|
|
23301
|
-
loadingText =
|
|
23302
|
-
noOptionsText =
|
|
24303
|
+
loadingText = labels.loadingOptions,
|
|
24304
|
+
noOptionsText = labels.noOptions,
|
|
23303
24305
|
"aria-label": ariaLabel,
|
|
23304
24306
|
"aria-labelledby": ariaLabelledBy,
|
|
23305
24307
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -23456,17 +24458,17 @@ const useAutocompleteController = (props) => {
|
|
|
23456
24458
|
if (option.created) {
|
|
23457
24459
|
const createdOption = { ...option, label: option.value };
|
|
23458
24460
|
state.selectOption(createdOption, "create-option");
|
|
23459
|
-
setAnnouncement(
|
|
24461
|
+
setAnnouncement(labels.optionCreated(option.value));
|
|
23460
24462
|
} else {
|
|
23461
24463
|
state.selectOption(option);
|
|
23462
|
-
setAnnouncement(
|
|
24464
|
+
setAnnouncement(labels.optionSelected(option.label));
|
|
23463
24465
|
}
|
|
23464
24466
|
setActiveIndex(null);
|
|
23465
24467
|
if (restoreFocus) {
|
|
23466
24468
|
requestAnimationFrame(focusInput);
|
|
23467
24469
|
}
|
|
23468
24470
|
},
|
|
23469
|
-
[focusInput, state]
|
|
24471
|
+
[focusInput, labels, state]
|
|
23470
24472
|
);
|
|
23471
24473
|
const tryCommitCreateOption = useCallback(() => {
|
|
23472
24474
|
if (!createOption || disabled || readOnly || suppressCreateCommitRef.current) {
|
|
@@ -23548,9 +24550,9 @@ const useAutocompleteController = (props) => {
|
|
|
23548
24550
|
const removeSelectedValue = useCallback(
|
|
23549
24551
|
(selectedValue, label2) => {
|
|
23550
24552
|
state.removeOption(selectedValue);
|
|
23551
|
-
setAnnouncement(
|
|
24553
|
+
setAnnouncement(labels.optionRemoved(label2));
|
|
23552
24554
|
},
|
|
23553
|
-
[state]
|
|
24555
|
+
[labels, state]
|
|
23554
24556
|
);
|
|
23555
24557
|
const handleTokenDismiss = useCallback(
|
|
23556
24558
|
(selectedValue, label2) => {
|
|
@@ -23775,6 +24777,7 @@ const useAutocompleteController = (props) => {
|
|
|
23775
24777
|
};
|
|
23776
24778
|
};
|
|
23777
24779
|
const Autocomplete = (props) => {
|
|
24780
|
+
const { labels } = useLocale();
|
|
23778
24781
|
const controller = useAutocompleteController(props);
|
|
23779
24782
|
const {
|
|
23780
24783
|
activeIndex,
|
|
@@ -23892,7 +24895,7 @@ const Autocomplete = (props) => {
|
|
|
23892
24895
|
{
|
|
23893
24896
|
as: "span",
|
|
23894
24897
|
className: classes.overflowIndicator,
|
|
23895
|
-
"aria-label":
|
|
24898
|
+
"aria-label": labels.moreSelected(hiddenTagCount),
|
|
23896
24899
|
children: `+${hiddenTagCount}`
|
|
23897
24900
|
}
|
|
23898
24901
|
),
|
|
@@ -24045,13 +25048,14 @@ const getSelectedOptions = (options, value, multiple) => {
|
|
|
24045
25048
|
};
|
|
24046
25049
|
const Select = (props) => {
|
|
24047
25050
|
var _a;
|
|
25051
|
+
const { labels } = useLocale();
|
|
24048
25052
|
const floatingLayer = useFloatingLayer();
|
|
24049
25053
|
const {
|
|
24050
25054
|
value: controlledValue,
|
|
24051
25055
|
defaultValue = null,
|
|
24052
25056
|
onChange,
|
|
24053
25057
|
multiple = false,
|
|
24054
|
-
placeholder =
|
|
25058
|
+
placeholder = labels.selectPlaceholder,
|
|
24055
25059
|
open: controlledOpen,
|
|
24056
25060
|
defaultOpen = false,
|
|
24057
25061
|
onOpenChange,
|
|
@@ -24588,8 +25592,30 @@ function useTheme() {
|
|
|
24588
25592
|
}
|
|
24589
25593
|
return context2;
|
|
24590
25594
|
}
|
|
25595
|
+
function mergeLabels(parent, overrides) {
|
|
25596
|
+
const defined = Object.fromEntries(
|
|
25597
|
+
Object.entries(overrides).filter(([, value]) => value !== void 0)
|
|
25598
|
+
);
|
|
25599
|
+
return { ...parent, ...defined };
|
|
25600
|
+
}
|
|
25601
|
+
function LocaleProvider({
|
|
25602
|
+
locale,
|
|
25603
|
+
labels,
|
|
25604
|
+
children
|
|
25605
|
+
}) {
|
|
25606
|
+
const parent = useContext(LocaleContext);
|
|
25607
|
+
const contextValue = useMemo(
|
|
25608
|
+
() => ({
|
|
25609
|
+
locale: locale ?? parent.locale,
|
|
25610
|
+
labels: labels ? mergeLabels(parent.labels, labels) : parent.labels
|
|
25611
|
+
}),
|
|
25612
|
+
[locale, labels, parent]
|
|
25613
|
+
);
|
|
25614
|
+
return /* @__PURE__ */ jsx(LocaleContext.Provider, { value: contextValue, children });
|
|
25615
|
+
}
|
|
24591
25616
|
const ThemeSwitcher = () => {
|
|
24592
25617
|
const { theme, setTheme } = useTheme();
|
|
25618
|
+
const { labels } = useLocale();
|
|
24593
25619
|
const toggleTheme = () => {
|
|
24594
25620
|
setTheme(theme === "light" ? "dark" : "light");
|
|
24595
25621
|
};
|
|
@@ -24598,7 +25624,7 @@ const ThemeSwitcher = () => {
|
|
|
24598
25624
|
{
|
|
24599
25625
|
...dsComponent("ThemeSwitcher"),
|
|
24600
25626
|
variant: "ghost",
|
|
24601
|
-
altText:
|
|
25627
|
+
altText: labels.switchToTheme(theme === "light" ? "dark" : "light"),
|
|
24602
25628
|
onClick: toggleTheme,
|
|
24603
25629
|
iconName: theme === "light" ? "moon" : "sun"
|
|
24604
25630
|
}
|
|
@@ -24619,6 +25645,7 @@ const toneIconColors = {
|
|
|
24619
25645
|
neutral: "icon.subtle"
|
|
24620
25646
|
};
|
|
24621
25647
|
const Toast = (props) => {
|
|
25648
|
+
const { labels } = useLocale();
|
|
24622
25649
|
const {
|
|
24623
25650
|
tone = "neutral",
|
|
24624
25651
|
children,
|
|
@@ -24627,7 +25654,7 @@ const Toast = (props) => {
|
|
|
24627
25654
|
dismissible = true,
|
|
24628
25655
|
onDismiss,
|
|
24629
25656
|
duration = null,
|
|
24630
|
-
dismissLabel =
|
|
25657
|
+
dismissLabel = labels.dismiss,
|
|
24631
25658
|
state = "open",
|
|
24632
25659
|
onMouseEnter,
|
|
24633
25660
|
onMouseLeave,
|
|
@@ -25018,6 +26045,7 @@ export {
|
|
|
25018
26045
|
List,
|
|
25019
26046
|
ListItem,
|
|
25020
26047
|
ListItemGroup,
|
|
26048
|
+
LocaleProvider,
|
|
25021
26049
|
Menu,
|
|
25022
26050
|
MenuGroup,
|
|
25023
26051
|
MenuItem,
|
|
@@ -25040,6 +26068,9 @@ export {
|
|
|
25040
26068
|
Skeleton,
|
|
25041
26069
|
Spinner,
|
|
25042
26070
|
SubMenu,
|
|
26071
|
+
Tab,
|
|
26072
|
+
TabPanel,
|
|
26073
|
+
Tabs,
|
|
25043
26074
|
Tag,
|
|
25044
26075
|
Text,
|
|
25045
26076
|
TextInput,
|
|
@@ -25057,6 +26088,7 @@ export {
|
|
|
25057
26088
|
Toggle,
|
|
25058
26089
|
ToggleInput,
|
|
25059
26090
|
Tooltip,
|
|
26091
|
+
defaultLocaleLabels,
|
|
25060
26092
|
deriveItemTextValue,
|
|
25061
26093
|
getComponentType,
|
|
25062
26094
|
getHighlightedTextParts,
|
|
@@ -25070,11 +26102,15 @@ export {
|
|
|
25070
26102
|
useForm2 as useForm,
|
|
25071
26103
|
useIconConfig,
|
|
25072
26104
|
useListContext,
|
|
26105
|
+
useLocale,
|
|
25073
26106
|
useMediaQuery,
|
|
25074
26107
|
useMenuFilterContext,
|
|
25075
26108
|
useMenuListContext,
|
|
25076
26109
|
useMenuRootContext,
|
|
25077
26110
|
useModalWrapperContext,
|
|
26111
|
+
useOverflowItems,
|
|
26112
|
+
useTabPanelActive,
|
|
26113
|
+
useTabsContext,
|
|
25078
26114
|
useTheme,
|
|
25079
26115
|
useToast
|
|
25080
26116
|
};
|