cetec-design-system 4.6.0-0 → 4.7.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 +518 -201
- package/dist/index.js.map +1 -1
- package/dist/panda.buildinfo.json +5 -2
- package/dist/preset.js +193 -63
- package/dist/preset.js.map +1 -1
- package/dist/specs/recipes.json +11 -0
- package/dist/styles.css +139 -6
- package/dist/types/index.d.ts +98 -0
- package/package.json +1 -1
- package/src/recipes/filterField.ts +138 -0
- package/src/recipes/recipes-slot.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -974,7 +974,7 @@ const spinnerVariantKeys = [
|
|
|
974
974
|
"inverse",
|
|
975
975
|
"centered"
|
|
976
976
|
];
|
|
977
|
-
const getVariantProps$
|
|
977
|
+
const getVariantProps$z = (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$z
|
|
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$y = (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$y
|
|
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$x = (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$x
|
|
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$w = (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$w
|
|
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$v = (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$v
|
|
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$u = (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$u
|
|
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$t = (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$t
|
|
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$s = (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$s
|
|
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$r = (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$r
|
|
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$q = (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$q
|
|
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$p = (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$p
|
|
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$o = (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$o
|
|
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$n = (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$n
|
|
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$m = (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$m
|
|
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$l = (variants) => ({ ...drawerDefaultVariants, ...compact(variants) });
|
|
2430
2430
|
const drawer = /* @__PURE__ */ Object.assign(drawerFn, {
|
|
2431
2431
|
__recipe__: false,
|
|
2432
2432
|
__name__: "drawer",
|
|
@@ -2453,6 +2453,64 @@ const drawer = /* @__PURE__ */ Object.assign(drawerFn, {
|
|
|
2453
2453
|
splitVariantProps(props) {
|
|
2454
2454
|
return splitProps$1(props, drawerVariantKeys);
|
|
2455
2455
|
},
|
|
2456
|
+
getVariantProps: getVariantProps$l
|
|
2457
|
+
});
|
|
2458
|
+
const filterFieldDefaultVariants = {};
|
|
2459
|
+
const filterFieldCompoundVariants = [];
|
|
2460
|
+
const filterFieldSlotNames = [
|
|
2461
|
+
[
|
|
2462
|
+
"root",
|
|
2463
|
+
"filterField__root"
|
|
2464
|
+
],
|
|
2465
|
+
[
|
|
2466
|
+
"icon",
|
|
2467
|
+
"filterField__icon"
|
|
2468
|
+
],
|
|
2469
|
+
[
|
|
2470
|
+
"values",
|
|
2471
|
+
"filterField__values"
|
|
2472
|
+
],
|
|
2473
|
+
[
|
|
2474
|
+
"sizer",
|
|
2475
|
+
"filterField__sizer"
|
|
2476
|
+
],
|
|
2477
|
+
[
|
|
2478
|
+
"token",
|
|
2479
|
+
"filterField__token"
|
|
2480
|
+
],
|
|
2481
|
+
[
|
|
2482
|
+
"input",
|
|
2483
|
+
"filterField__input"
|
|
2484
|
+
],
|
|
2485
|
+
[
|
|
2486
|
+
"more",
|
|
2487
|
+
"filterField__more"
|
|
2488
|
+
],
|
|
2489
|
+
[
|
|
2490
|
+
"shortcut",
|
|
2491
|
+
"filterField__shortcut"
|
|
2492
|
+
],
|
|
2493
|
+
[
|
|
2494
|
+
"clear",
|
|
2495
|
+
"filterField__clear"
|
|
2496
|
+
]
|
|
2497
|
+
];
|
|
2498
|
+
const filterFieldSlotFns = /* @__PURE__ */ filterFieldSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, filterFieldDefaultVariants, getSlotCompoundVariant(filterFieldCompoundVariants, slotName))]);
|
|
2499
|
+
const filterFieldFn = memo((props = {}) => {
|
|
2500
|
+
return Object.fromEntries(filterFieldSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2501
|
+
});
|
|
2502
|
+
const filterFieldVariantKeys = [];
|
|
2503
|
+
const getVariantProps$k = (variants) => ({ ...filterFieldDefaultVariants, ...compact(variants) });
|
|
2504
|
+
const filterField = /* @__PURE__ */ Object.assign(filterFieldFn, {
|
|
2505
|
+
__recipe__: false,
|
|
2506
|
+
__name__: "filterField",
|
|
2507
|
+
raw: (props) => props,
|
|
2508
|
+
classNameMap: {},
|
|
2509
|
+
variantKeys: filterFieldVariantKeys,
|
|
2510
|
+
variantMap: {},
|
|
2511
|
+
splitVariantProps(props) {
|
|
2512
|
+
return splitProps$1(props, filterFieldVariantKeys);
|
|
2513
|
+
},
|
|
2456
2514
|
getVariantProps: getVariantProps$k
|
|
2457
2515
|
});
|
|
2458
2516
|
const filterMenuDefaultVariants = {
|
|
@@ -15592,6 +15650,9 @@ const defaultLocaleLabels = {
|
|
|
15592
15650
|
optionCreated: (value) => `${value} created and selected.`,
|
|
15593
15651
|
optionRemoved: (label2) => `${label2} removed.`,
|
|
15594
15652
|
moreSelected: (count2) => `${count2} more selected`,
|
|
15653
|
+
filterOrSearch: "Filter or search",
|
|
15654
|
+
clearFilters: "Clear all filters",
|
|
15655
|
+
moreFilters: (count2) => `+${count2} more`,
|
|
15595
15656
|
copyCode: "Copy code",
|
|
15596
15657
|
copied: "Copied",
|
|
15597
15658
|
copyFailed: "Copy failed",
|
|
@@ -22699,6 +22760,433 @@ const DrawerFooter = (props) => {
|
|
|
22699
22760
|
const classes = drawer();
|
|
22700
22761
|
return /* @__PURE__ */ jsx(Box, { className: cx(classes.footer, className), ...otherProps, children });
|
|
22701
22762
|
};
|
|
22763
|
+
const MAX_VISIBLE_VALUES = 2;
|
|
22764
|
+
const FilterToken = (props) => {
|
|
22765
|
+
const {
|
|
22766
|
+
field,
|
|
22767
|
+
operator,
|
|
22768
|
+
value,
|
|
22769
|
+
state = "applied",
|
|
22770
|
+
tone = "default",
|
|
22771
|
+
operatorLocked,
|
|
22772
|
+
editor,
|
|
22773
|
+
disabled,
|
|
22774
|
+
retainFocus,
|
|
22775
|
+
onFieldClick,
|
|
22776
|
+
onOperatorClick,
|
|
22777
|
+
onValueClick,
|
|
22778
|
+
onRemove,
|
|
22779
|
+
removeLabel,
|
|
22780
|
+
...rest
|
|
22781
|
+
} = props;
|
|
22782
|
+
const [className, otherProps] = splitProps(rest);
|
|
22783
|
+
const classes = filterToken();
|
|
22784
|
+
const { labels } = useLocale();
|
|
22785
|
+
const values = Array.isArray(value) ? value : void 0;
|
|
22786
|
+
const fullValue = Array.isArray(value) ? value.join(", ") : value;
|
|
22787
|
+
const hidden = values ? Math.max(0, values.length - MAX_VISIBLE_VALUES) : 0;
|
|
22788
|
+
const shownValue = values ? values.slice(0, MAX_VISIBLE_VALUES).join(", ") : value;
|
|
22789
|
+
const sentence = [field, operator, fullValue].filter(Boolean).join(" ");
|
|
22790
|
+
const keepFocus = retainFocus ? (e) => e.preventDefault() : void 0;
|
|
22791
|
+
const valueTextRef = useRef(null);
|
|
22792
|
+
const [clipped, setClipped] = useState(false);
|
|
22793
|
+
useLayoutEffect(() => {
|
|
22794
|
+
const node = valueTextRef.current;
|
|
22795
|
+
if (!node) {
|
|
22796
|
+
setClipped(false);
|
|
22797
|
+
return;
|
|
22798
|
+
}
|
|
22799
|
+
const check = () => setClipped(node.scrollWidth > node.clientWidth);
|
|
22800
|
+
check();
|
|
22801
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
22802
|
+
const observer = new ResizeObserver(check);
|
|
22803
|
+
observer.observe(node);
|
|
22804
|
+
return () => observer.disconnect();
|
|
22805
|
+
}, [shownValue, editor]);
|
|
22806
|
+
const part = (slot, content, onClick, extra) => onClick ? /* @__PURE__ */ jsx(
|
|
22807
|
+
Box,
|
|
22808
|
+
{
|
|
22809
|
+
as: "button",
|
|
22810
|
+
type: "button",
|
|
22811
|
+
className: cx(classes.part, slot),
|
|
22812
|
+
disabled,
|
|
22813
|
+
onMouseDown: keepFocus,
|
|
22814
|
+
onClick,
|
|
22815
|
+
...extra,
|
|
22816
|
+
children: content
|
|
22817
|
+
}
|
|
22818
|
+
) : /* @__PURE__ */ jsx(Box, { as: "span", className: cx(classes.part, slot), ...extra, children: content });
|
|
22819
|
+
const valueContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22820
|
+
/* @__PURE__ */ jsx(
|
|
22821
|
+
Box,
|
|
22822
|
+
{
|
|
22823
|
+
as: "span",
|
|
22824
|
+
ref: valueTextRef,
|
|
22825
|
+
className: classes.valueText,
|
|
22826
|
+
"aria-hidden": hidden > 0 || void 0,
|
|
22827
|
+
children: shownValue || "…"
|
|
22828
|
+
}
|
|
22829
|
+
),
|
|
22830
|
+
hidden > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22831
|
+
/* @__PURE__ */ jsx(Box, { as: "span", className: classes.count, "aria-hidden": true, children: `+${hidden}` }),
|
|
22832
|
+
/* @__PURE__ */ jsx(Box, { as: "span", srOnly: true, children: fullValue })
|
|
22833
|
+
] })
|
|
22834
|
+
] });
|
|
22835
|
+
return /* @__PURE__ */ jsxs(
|
|
22836
|
+
Box,
|
|
22837
|
+
{
|
|
22838
|
+
...dsComponent("FilterToken"),
|
|
22839
|
+
as: "span",
|
|
22840
|
+
role: "group",
|
|
22841
|
+
"aria-label": sentence,
|
|
22842
|
+
className: cx(classes.root, className),
|
|
22843
|
+
"data-state": state,
|
|
22844
|
+
"data-tone": tone,
|
|
22845
|
+
"data-disabled": disabled || void 0,
|
|
22846
|
+
...otherProps,
|
|
22847
|
+
children: [
|
|
22848
|
+
part(classes.field, field, onFieldClick ?? onValueClick),
|
|
22849
|
+
part(
|
|
22850
|
+
classes.operator,
|
|
22851
|
+
operator,
|
|
22852
|
+
operatorLocked ? void 0 : onOperatorClick,
|
|
22853
|
+
operatorLocked ? { "data-locked": true } : void 0
|
|
22854
|
+
),
|
|
22855
|
+
editor !== void 0 ? (
|
|
22856
|
+
// `inert` keeps a disabled token's editor out of the tab order.
|
|
22857
|
+
/* @__PURE__ */ jsxs(
|
|
22858
|
+
Box,
|
|
22859
|
+
{
|
|
22860
|
+
as: "span",
|
|
22861
|
+
className: cx(classes.part, classes.editor),
|
|
22862
|
+
inert: disabled || void 0,
|
|
22863
|
+
children: [
|
|
22864
|
+
shownValue && /* @__PURE__ */ jsx(Box, { as: "span", className: classes.value, children: valueContent }),
|
|
22865
|
+
editor
|
|
22866
|
+
]
|
|
22867
|
+
}
|
|
22868
|
+
)
|
|
22869
|
+
) : value !== void 0 && /* @__PURE__ */ jsx(Tooltip, { text: fullValue ?? "", disabled: hidden === 0 && !clipped, children: part(classes.value, valueContent, onValueClick) }),
|
|
22870
|
+
onRemove && state !== "removing" && /* @__PURE__ */ jsx(
|
|
22871
|
+
Box,
|
|
22872
|
+
{
|
|
22873
|
+
as: "button",
|
|
22874
|
+
type: "button",
|
|
22875
|
+
className: classes.remove,
|
|
22876
|
+
"aria-label": removeLabel ?? labels.removeFilter(sentence),
|
|
22877
|
+
disabled,
|
|
22878
|
+
onMouseDown: keepFocus,
|
|
22879
|
+
onClick: onRemove,
|
|
22880
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "x", size: "16", "aria-hidden": true })
|
|
22881
|
+
}
|
|
22882
|
+
)
|
|
22883
|
+
]
|
|
22884
|
+
}
|
|
22885
|
+
);
|
|
22886
|
+
};
|
|
22887
|
+
const specialSymbols = {
|
|
22888
|
+
"⌘": "command",
|
|
22889
|
+
"⌥": "option",
|
|
22890
|
+
"⌃": "control",
|
|
22891
|
+
"⇪": "shift",
|
|
22892
|
+
"⎋": "escape",
|
|
22893
|
+
"⌫": "delete",
|
|
22894
|
+
"↩": "return",
|
|
22895
|
+
"⇥": "tab",
|
|
22896
|
+
"←": "left",
|
|
22897
|
+
"→": "right",
|
|
22898
|
+
"↑": "up",
|
|
22899
|
+
"↓": "down"
|
|
22900
|
+
};
|
|
22901
|
+
const isSpecialSymbol = (value) => value in specialSymbols;
|
|
22902
|
+
const getKbdLabel = (value) => isSpecialSymbol(value) ? specialSymbols[value] : value;
|
|
22903
|
+
const defaultClasses = kbd({});
|
|
22904
|
+
const symbolClasses = kbd({ variant: "symbol" });
|
|
22905
|
+
const Kbd = (props) => {
|
|
22906
|
+
const { keys, ...rest } = props;
|
|
22907
|
+
const [className, otherProps] = splitProps(rest);
|
|
22908
|
+
const tooltipText = keys.map(getKbdLabel).join(" + ");
|
|
22909
|
+
const keyOccurrences = /* @__PURE__ */ new Map();
|
|
22910
|
+
const renderedKeys = keys.map((keyValue) => {
|
|
22911
|
+
const occurrence = keyOccurrences.get(keyValue) ?? 0;
|
|
22912
|
+
keyOccurrences.set(keyValue, occurrence + 1);
|
|
22913
|
+
return { id: `${keyValue}-${occurrence}`, value: keyValue };
|
|
22914
|
+
});
|
|
22915
|
+
const content = /* @__PURE__ */ jsx(
|
|
22916
|
+
Box,
|
|
22917
|
+
{
|
|
22918
|
+
...dsComponent("Kbd"),
|
|
22919
|
+
as: "span",
|
|
22920
|
+
className: cx(defaultClasses.kbdGroup, className),
|
|
22921
|
+
...otherProps,
|
|
22922
|
+
children: renderedKeys.map(({ id, value }) => /* @__PURE__ */ jsx(
|
|
22923
|
+
Box,
|
|
22924
|
+
{
|
|
22925
|
+
as: "kbd",
|
|
22926
|
+
className: isSpecialSymbol(value) ? symbolClasses.key : defaultClasses.key,
|
|
22927
|
+
children: value
|
|
22928
|
+
},
|
|
22929
|
+
id
|
|
22930
|
+
))
|
|
22931
|
+
}
|
|
22932
|
+
);
|
|
22933
|
+
return /* @__PURE__ */ jsx(Tooltip, { text: tooltipText, children: content });
|
|
22934
|
+
};
|
|
22935
|
+
const MORE_BUTTON_RESERVE = 96;
|
|
22936
|
+
const isTextEntry = (target) => target instanceof HTMLElement && Boolean(
|
|
22937
|
+
target.closest(
|
|
22938
|
+
'input, textarea, select, [contenteditable=""], [contenteditable="true"]'
|
|
22939
|
+
)
|
|
22940
|
+
);
|
|
22941
|
+
const FilterField = (props) => {
|
|
22942
|
+
const {
|
|
22943
|
+
tokens: tokens2,
|
|
22944
|
+
inputValue,
|
|
22945
|
+
onInputChange,
|
|
22946
|
+
inputProps,
|
|
22947
|
+
inputRef,
|
|
22948
|
+
placeholder,
|
|
22949
|
+
editingKey = null,
|
|
22950
|
+
onMoreClick,
|
|
22951
|
+
moreOpen,
|
|
22952
|
+
onClearAll,
|
|
22953
|
+
clearLabel,
|
|
22954
|
+
shortcut,
|
|
22955
|
+
disabled,
|
|
22956
|
+
...rest
|
|
22957
|
+
} = props;
|
|
22958
|
+
const [className, otherProps] = splitProps(rest);
|
|
22959
|
+
const classes = filterField();
|
|
22960
|
+
const { labels } = useLocale();
|
|
22961
|
+
const [armedKey, setArmedKey] = useState(null);
|
|
22962
|
+
const [hasFocus, setHasFocus] = useState(false);
|
|
22963
|
+
const rootRef = useRef(null);
|
|
22964
|
+
const sizerRef = useRef(null);
|
|
22965
|
+
const moreRef = useRef(null);
|
|
22966
|
+
const inputElement = useRef(null);
|
|
22967
|
+
const tokenElements = useRef(/* @__PURE__ */ new Map());
|
|
22968
|
+
const refocus = useRef(false);
|
|
22969
|
+
const trackInput = useCallback((node) => {
|
|
22970
|
+
if (node) {
|
|
22971
|
+
inputElement.current = node;
|
|
22972
|
+
if (refocus.current) {
|
|
22973
|
+
refocus.current = false;
|
|
22974
|
+
node.focus();
|
|
22975
|
+
}
|
|
22976
|
+
return;
|
|
22977
|
+
}
|
|
22978
|
+
if (inputElement.current && inputElement.current === inputElement.current.ownerDocument.activeElement) {
|
|
22979
|
+
refocus.current = true;
|
|
22980
|
+
}
|
|
22981
|
+
}, []);
|
|
22982
|
+
const mergedInputRef = useMergeRefs([trackInput, inputRef]);
|
|
22983
|
+
const focusInput = useCallback(() => {
|
|
22984
|
+
var _a;
|
|
22985
|
+
return (_a = inputElement.current) == null ? void 0 : _a.focus();
|
|
22986
|
+
}, []);
|
|
22987
|
+
const removable = tokens2.filter(
|
|
22988
|
+
(token2) => token2.onRemove && token2.state !== "removing"
|
|
22989
|
+
);
|
|
22990
|
+
const lastRemovable = removable[removable.length - 1];
|
|
22991
|
+
const armed = armedKey !== null && (lastRemovable == null ? void 0 : lastRemovable.key) === armedKey ? armedKey : null;
|
|
22992
|
+
const keys = tokens2.map((token2) => token2.key);
|
|
22993
|
+
const getItemElement = useCallback(
|
|
22994
|
+
(key) => tokenElements.current.get(key) ?? null,
|
|
22995
|
+
[]
|
|
22996
|
+
);
|
|
22997
|
+
const { visible, overflow } = useOverflowItems({
|
|
22998
|
+
items: keys,
|
|
22999
|
+
containerRef: sizerRef,
|
|
23000
|
+
getItemElement,
|
|
23001
|
+
activeItem: editingKey ?? armed,
|
|
23002
|
+
reserve: MORE_BUTTON_RESERVE,
|
|
23003
|
+
reserveRef: moreRef
|
|
23004
|
+
});
|
|
23005
|
+
const hiddenKeys = overflow.filter((key) => keys.includes(key));
|
|
23006
|
+
const hiddenTokens = tokens2.filter((token2) => hiddenKeys.includes(token2.key));
|
|
23007
|
+
const visibleKeys = new Set(visible);
|
|
23008
|
+
useEffect(() => {
|
|
23009
|
+
if (!shortcut || disabled) return;
|
|
23010
|
+
const onKeyDown2 = (event) => {
|
|
23011
|
+
if (event.key !== shortcut || event.metaKey || event.ctrlKey || event.altKey || event.defaultPrevented || isTextEntry(event.target)) {
|
|
23012
|
+
return;
|
|
23013
|
+
}
|
|
23014
|
+
event.preventDefault();
|
|
23015
|
+
focusInput();
|
|
23016
|
+
};
|
|
23017
|
+
document.addEventListener("keydown", onKeyDown2);
|
|
23018
|
+
return () => document.removeEventListener("keydown", onKeyDown2);
|
|
23019
|
+
}, [shortcut, disabled, focusInput]);
|
|
23020
|
+
const onKeyDown = (event) => {
|
|
23021
|
+
var _a, _b;
|
|
23022
|
+
(_a = inputProps == null ? void 0 : inputProps.onKeyDown) == null ? void 0 : _a.call(inputProps, event);
|
|
23023
|
+
if (event.defaultPrevented) return;
|
|
23024
|
+
if (event.key !== "Backspace") {
|
|
23025
|
+
setArmedKey(null);
|
|
23026
|
+
return;
|
|
23027
|
+
}
|
|
23028
|
+
if (inputValue !== "" || editingKey !== null || !lastRemovable) return;
|
|
23029
|
+
event.preventDefault();
|
|
23030
|
+
if (armed === lastRemovable.key) {
|
|
23031
|
+
setArmedKey(null);
|
|
23032
|
+
(_b = lastRemovable.onRemove) == null ? void 0 : _b.call(lastRemovable);
|
|
23033
|
+
} else {
|
|
23034
|
+
setArmedKey(lastRemovable.key);
|
|
23035
|
+
}
|
|
23036
|
+
};
|
|
23037
|
+
const withFocus = (handler) => handler && ((...args) => {
|
|
23038
|
+
focusInput();
|
|
23039
|
+
handler(...args);
|
|
23040
|
+
});
|
|
23041
|
+
const input = (inline) => /* @__PURE__ */ jsx(
|
|
23042
|
+
"input",
|
|
23043
|
+
{
|
|
23044
|
+
type: "text",
|
|
23045
|
+
autoComplete: "off",
|
|
23046
|
+
spellCheck: false,
|
|
23047
|
+
"aria-label": labels.filterOrSearch,
|
|
23048
|
+
"aria-keyshortcuts": shortcut,
|
|
23049
|
+
...inputProps,
|
|
23050
|
+
ref: mergedInputRef,
|
|
23051
|
+
className: cx(classes.input, inputProps == null ? void 0 : inputProps.className),
|
|
23052
|
+
"data-inline": inline || void 0,
|
|
23053
|
+
size: inline ? Math.max(inputValue.length, 1) : void 0,
|
|
23054
|
+
value: inputValue,
|
|
23055
|
+
placeholder: inline ? void 0 : placeholder,
|
|
23056
|
+
disabled,
|
|
23057
|
+
onChange: (event) => {
|
|
23058
|
+
setArmedKey(null);
|
|
23059
|
+
onInputChange(event.target.value);
|
|
23060
|
+
},
|
|
23061
|
+
onKeyDown
|
|
23062
|
+
}
|
|
23063
|
+
);
|
|
23064
|
+
const editingVisible = editingKey !== null && visibleKeys.has(editingKey);
|
|
23065
|
+
const showClear = Boolean(onClearAll) && !disabled && (tokens2.length > 0 || inputValue !== "");
|
|
23066
|
+
return /* @__PURE__ */ jsxs(
|
|
23067
|
+
Box,
|
|
23068
|
+
{
|
|
23069
|
+
...dsComponent("FilterField"),
|
|
23070
|
+
ref: rootRef,
|
|
23071
|
+
className: cx(classes.root, className),
|
|
23072
|
+
"data-disabled": disabled || void 0,
|
|
23073
|
+
"data-has-clear": showClear || void 0,
|
|
23074
|
+
onFocusCapture: () => setHasFocus(true),
|
|
23075
|
+
onBlurCapture: (event) => {
|
|
23076
|
+
var _a;
|
|
23077
|
+
if ((_a = rootRef.current) == null ? void 0 : _a.contains(event.relatedTarget)) {
|
|
23078
|
+
return;
|
|
23079
|
+
}
|
|
23080
|
+
setHasFocus(false);
|
|
23081
|
+
setArmedKey(null);
|
|
23082
|
+
},
|
|
23083
|
+
onMouseDown: (event) => {
|
|
23084
|
+
if (disabled || event.target !== event.currentTarget) return;
|
|
23085
|
+
event.preventDefault();
|
|
23086
|
+
focusInput();
|
|
23087
|
+
},
|
|
23088
|
+
...otherProps,
|
|
23089
|
+
children: [
|
|
23090
|
+
/* @__PURE__ */ jsx(
|
|
23091
|
+
Icon,
|
|
23092
|
+
{
|
|
23093
|
+
name: "search",
|
|
23094
|
+
size: "20",
|
|
23095
|
+
fill: disabled ? "icon.disabled" : "icon.subtle",
|
|
23096
|
+
className: classes.icon,
|
|
23097
|
+
"aria-hidden": true
|
|
23098
|
+
}
|
|
23099
|
+
),
|
|
23100
|
+
/* @__PURE__ */ jsxs(
|
|
23101
|
+
Box,
|
|
23102
|
+
{
|
|
23103
|
+
className: classes.values,
|
|
23104
|
+
onMouseDown: (event) => {
|
|
23105
|
+
if (disabled || event.target !== event.currentTarget) return;
|
|
23106
|
+
event.preventDefault();
|
|
23107
|
+
focusInput();
|
|
23108
|
+
},
|
|
23109
|
+
children: [
|
|
23110
|
+
/* @__PURE__ */ jsx(Box, { ref: sizerRef, className: classes.sizer, "aria-hidden": true }),
|
|
23111
|
+
tokens2.map(({ key, ...token2 }) => {
|
|
23112
|
+
const overflowed = !visibleKeys.has(key);
|
|
23113
|
+
const editing = key === editingKey && !overflowed;
|
|
23114
|
+
return /* @__PURE__ */ jsx(
|
|
23115
|
+
Box,
|
|
23116
|
+
{
|
|
23117
|
+
as: "span",
|
|
23118
|
+
ref: (node) => {
|
|
23119
|
+
if (node) tokenElements.current.set(key, node);
|
|
23120
|
+
else tokenElements.current.delete(key);
|
|
23121
|
+
},
|
|
23122
|
+
className: classes.token,
|
|
23123
|
+
"data-overflowed": overflowed || void 0,
|
|
23124
|
+
inert: overflowed || void 0,
|
|
23125
|
+
children: /* @__PURE__ */ jsx(
|
|
23126
|
+
FilterToken,
|
|
23127
|
+
{
|
|
23128
|
+
...token2,
|
|
23129
|
+
state: key === armed ? "armed" : token2.state,
|
|
23130
|
+
disabled,
|
|
23131
|
+
retainFocus: true,
|
|
23132
|
+
editor: editing ? input(true) : void 0,
|
|
23133
|
+
onFieldClick: withFocus(token2.onFieldClick),
|
|
23134
|
+
onOperatorClick: withFocus(token2.onOperatorClick),
|
|
23135
|
+
onValueClick: withFocus(token2.onValueClick),
|
|
23136
|
+
onRemove: withFocus(token2.onRemove)
|
|
23137
|
+
}
|
|
23138
|
+
)
|
|
23139
|
+
},
|
|
23140
|
+
key
|
|
23141
|
+
);
|
|
23142
|
+
}),
|
|
23143
|
+
hiddenTokens.length > 0 && /* @__PURE__ */ jsx(
|
|
23144
|
+
Button,
|
|
23145
|
+
{
|
|
23146
|
+
ref: moreRef,
|
|
23147
|
+
size: "sm",
|
|
23148
|
+
variant: "hollow",
|
|
23149
|
+
iconAfter: "caret-down",
|
|
23150
|
+
className: classes.more,
|
|
23151
|
+
disabled,
|
|
23152
|
+
"aria-expanded": onMoreClick ? Boolean(moreOpen) : void 0,
|
|
23153
|
+
"data-open": moreOpen || void 0,
|
|
23154
|
+
"data-pending": hiddenTokens.some(
|
|
23155
|
+
(token2) => token2.state === "pending" || token2.state === "removing"
|
|
23156
|
+
) || void 0,
|
|
23157
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
23158
|
+
onClick: (event) => {
|
|
23159
|
+
focusInput();
|
|
23160
|
+
onMoreClick == null ? void 0 : onMoreClick(hiddenKeys, event.currentTarget);
|
|
23161
|
+
},
|
|
23162
|
+
children: labels.moreFilters(hiddenTokens.length)
|
|
23163
|
+
}
|
|
23164
|
+
),
|
|
23165
|
+
!editingVisible && input(false)
|
|
23166
|
+
]
|
|
23167
|
+
}
|
|
23168
|
+
),
|
|
23169
|
+
shortcut && !hasFocus && !disabled && /* @__PURE__ */ jsx(Kbd, { keys: [shortcut], className: classes.shortcut }),
|
|
23170
|
+
showClear && /* @__PURE__ */ jsx(
|
|
23171
|
+
IconButton,
|
|
23172
|
+
{
|
|
23173
|
+
variant: "ghost",
|
|
23174
|
+
size: "sm",
|
|
23175
|
+
iconName: "x",
|
|
23176
|
+
altText: clearLabel ?? labels.clearFilters,
|
|
23177
|
+
className: classes.clear,
|
|
23178
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
23179
|
+
onClick: () => {
|
|
23180
|
+
setArmedKey(null);
|
|
23181
|
+
focusInput();
|
|
23182
|
+
onClearAll == null ? void 0 : onClearAll();
|
|
23183
|
+
}
|
|
23184
|
+
}
|
|
23185
|
+
)
|
|
23186
|
+
]
|
|
23187
|
+
}
|
|
23188
|
+
);
|
|
23189
|
+
};
|
|
22702
23190
|
const getFilterMenuOptionId = (menuId, key) => `${menuId}-option-${encodeURIComponent(key)}`;
|
|
22703
23191
|
const isPickable = (row) => row.type === "item" && !row.disabled;
|
|
22704
23192
|
const useFilterMenu = (options) => {
|
|
@@ -22906,130 +23394,6 @@ const FilterMenu = (props) => {
|
|
|
22906
23394
|
}
|
|
22907
23395
|
) }) });
|
|
22908
23396
|
};
|
|
22909
|
-
const MAX_VISIBLE_VALUES = 2;
|
|
22910
|
-
const FilterToken = (props) => {
|
|
22911
|
-
const {
|
|
22912
|
-
field,
|
|
22913
|
-
operator,
|
|
22914
|
-
value,
|
|
22915
|
-
state = "applied",
|
|
22916
|
-
tone = "default",
|
|
22917
|
-
operatorLocked,
|
|
22918
|
-
editor,
|
|
22919
|
-
disabled,
|
|
22920
|
-
retainFocus,
|
|
22921
|
-
onFieldClick,
|
|
22922
|
-
onOperatorClick,
|
|
22923
|
-
onValueClick,
|
|
22924
|
-
onRemove,
|
|
22925
|
-
removeLabel,
|
|
22926
|
-
...rest
|
|
22927
|
-
} = props;
|
|
22928
|
-
const [className, otherProps] = splitProps(rest);
|
|
22929
|
-
const classes = filterToken();
|
|
22930
|
-
const { labels } = useLocale();
|
|
22931
|
-
const values = Array.isArray(value) ? value : void 0;
|
|
22932
|
-
const fullValue = Array.isArray(value) ? value.join(", ") : value;
|
|
22933
|
-
const hidden = values ? Math.max(0, values.length - MAX_VISIBLE_VALUES) : 0;
|
|
22934
|
-
const shownValue = values ? values.slice(0, MAX_VISIBLE_VALUES).join(", ") : value;
|
|
22935
|
-
const sentence = [field, operator, fullValue].filter(Boolean).join(" ");
|
|
22936
|
-
const keepFocus = retainFocus ? (e) => e.preventDefault() : void 0;
|
|
22937
|
-
const valueTextRef = useRef(null);
|
|
22938
|
-
const [clipped, setClipped] = useState(false);
|
|
22939
|
-
useLayoutEffect(() => {
|
|
22940
|
-
const node = valueTextRef.current;
|
|
22941
|
-
if (!node) {
|
|
22942
|
-
setClipped(false);
|
|
22943
|
-
return;
|
|
22944
|
-
}
|
|
22945
|
-
const check = () => setClipped(node.scrollWidth > node.clientWidth);
|
|
22946
|
-
check();
|
|
22947
|
-
if (typeof ResizeObserver === "undefined") return;
|
|
22948
|
-
const observer = new ResizeObserver(check);
|
|
22949
|
-
observer.observe(node);
|
|
22950
|
-
return () => observer.disconnect();
|
|
22951
|
-
}, [shownValue, editor]);
|
|
22952
|
-
const part = (slot, content, onClick, extra) => onClick ? /* @__PURE__ */ jsx(
|
|
22953
|
-
Box,
|
|
22954
|
-
{
|
|
22955
|
-
as: "button",
|
|
22956
|
-
type: "button",
|
|
22957
|
-
className: cx(classes.part, slot),
|
|
22958
|
-
disabled,
|
|
22959
|
-
onMouseDown: keepFocus,
|
|
22960
|
-
onClick,
|
|
22961
|
-
...extra,
|
|
22962
|
-
children: content
|
|
22963
|
-
}
|
|
22964
|
-
) : /* @__PURE__ */ jsx(Box, { as: "span", className: cx(classes.part, slot), ...extra, children: content });
|
|
22965
|
-
const valueContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22966
|
-
/* @__PURE__ */ jsx(
|
|
22967
|
-
Box,
|
|
22968
|
-
{
|
|
22969
|
-
as: "span",
|
|
22970
|
-
ref: valueTextRef,
|
|
22971
|
-
className: classes.valueText,
|
|
22972
|
-
"aria-hidden": hidden > 0 || void 0,
|
|
22973
|
-
children: shownValue || "…"
|
|
22974
|
-
}
|
|
22975
|
-
),
|
|
22976
|
-
hidden > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22977
|
-
/* @__PURE__ */ jsx(Box, { as: "span", className: classes.count, "aria-hidden": true, children: `+${hidden}` }),
|
|
22978
|
-
/* @__PURE__ */ jsx(Box, { as: "span", srOnly: true, children: fullValue })
|
|
22979
|
-
] })
|
|
22980
|
-
] });
|
|
22981
|
-
return /* @__PURE__ */ jsxs(
|
|
22982
|
-
Box,
|
|
22983
|
-
{
|
|
22984
|
-
...dsComponent("FilterToken"),
|
|
22985
|
-
as: "span",
|
|
22986
|
-
role: "group",
|
|
22987
|
-
"aria-label": sentence,
|
|
22988
|
-
className: cx(classes.root, className),
|
|
22989
|
-
"data-state": state,
|
|
22990
|
-
"data-tone": tone,
|
|
22991
|
-
"data-disabled": disabled || void 0,
|
|
22992
|
-
...otherProps,
|
|
22993
|
-
children: [
|
|
22994
|
-
part(classes.field, field, onFieldClick ?? onValueClick),
|
|
22995
|
-
part(
|
|
22996
|
-
classes.operator,
|
|
22997
|
-
operator,
|
|
22998
|
-
operatorLocked ? void 0 : onOperatorClick,
|
|
22999
|
-
operatorLocked ? { "data-locked": true } : void 0
|
|
23000
|
-
),
|
|
23001
|
-
editor !== void 0 ? (
|
|
23002
|
-
// `inert` keeps a disabled token's editor out of the tab order.
|
|
23003
|
-
/* @__PURE__ */ jsxs(
|
|
23004
|
-
Box,
|
|
23005
|
-
{
|
|
23006
|
-
as: "span",
|
|
23007
|
-
className: cx(classes.part, classes.editor),
|
|
23008
|
-
inert: disabled || void 0,
|
|
23009
|
-
children: [
|
|
23010
|
-
shownValue && /* @__PURE__ */ jsx(Box, { as: "span", className: classes.value, children: valueContent }),
|
|
23011
|
-
editor
|
|
23012
|
-
]
|
|
23013
|
-
}
|
|
23014
|
-
)
|
|
23015
|
-
) : value !== void 0 && /* @__PURE__ */ jsx(Tooltip, { text: fullValue ?? "", disabled: hidden === 0 && !clipped, children: part(classes.value, valueContent, onValueClick) }),
|
|
23016
|
-
onRemove && state !== "removing" && /* @__PURE__ */ jsx(
|
|
23017
|
-
Box,
|
|
23018
|
-
{
|
|
23019
|
-
as: "button",
|
|
23020
|
-
type: "button",
|
|
23021
|
-
className: classes.remove,
|
|
23022
|
-
"aria-label": removeLabel ?? labels.removeFilter(sentence),
|
|
23023
|
-
disabled,
|
|
23024
|
-
onMouseDown: keepFocus,
|
|
23025
|
-
onClick: onRemove,
|
|
23026
|
-
children: /* @__PURE__ */ jsx(Icon, { name: "x", size: "16", "aria-hidden": true })
|
|
23027
|
-
}
|
|
23028
|
-
)
|
|
23029
|
-
]
|
|
23030
|
-
}
|
|
23031
|
-
);
|
|
23032
|
-
};
|
|
23033
23397
|
const Required = () => {
|
|
23034
23398
|
return /* @__PURE__ */ jsx(Text, { color: "text.danger", fontSize: "inherit", lineHeight: "tight", children: "*" });
|
|
23035
23399
|
};
|
|
@@ -23172,54 +23536,6 @@ const InlineNote = (props) => {
|
|
|
23172
23536
|
}
|
|
23173
23537
|
);
|
|
23174
23538
|
};
|
|
23175
|
-
const specialSymbols = {
|
|
23176
|
-
"⌘": "command",
|
|
23177
|
-
"⌥": "option",
|
|
23178
|
-
"⌃": "control",
|
|
23179
|
-
"⇪": "shift",
|
|
23180
|
-
"⎋": "escape",
|
|
23181
|
-
"⌫": "delete",
|
|
23182
|
-
"↩": "return",
|
|
23183
|
-
"⇥": "tab",
|
|
23184
|
-
"←": "left",
|
|
23185
|
-
"→": "right",
|
|
23186
|
-
"↑": "up",
|
|
23187
|
-
"↓": "down"
|
|
23188
|
-
};
|
|
23189
|
-
const isSpecialSymbol = (value) => value in specialSymbols;
|
|
23190
|
-
const getKbdLabel = (value) => isSpecialSymbol(value) ? specialSymbols[value] : value;
|
|
23191
|
-
const defaultClasses = kbd({});
|
|
23192
|
-
const symbolClasses = kbd({ variant: "symbol" });
|
|
23193
|
-
const Kbd = (props) => {
|
|
23194
|
-
const { keys, ...rest } = props;
|
|
23195
|
-
const [className, otherProps] = splitProps(rest);
|
|
23196
|
-
const tooltipText = keys.map(getKbdLabel).join(" + ");
|
|
23197
|
-
const keyOccurrences = /* @__PURE__ */ new Map();
|
|
23198
|
-
const renderedKeys = keys.map((keyValue) => {
|
|
23199
|
-
const occurrence = keyOccurrences.get(keyValue) ?? 0;
|
|
23200
|
-
keyOccurrences.set(keyValue, occurrence + 1);
|
|
23201
|
-
return { id: `${keyValue}-${occurrence}`, value: keyValue };
|
|
23202
|
-
});
|
|
23203
|
-
const content = /* @__PURE__ */ jsx(
|
|
23204
|
-
Box,
|
|
23205
|
-
{
|
|
23206
|
-
...dsComponent("Kbd"),
|
|
23207
|
-
as: "span",
|
|
23208
|
-
className: cx(defaultClasses.kbdGroup, className),
|
|
23209
|
-
...otherProps,
|
|
23210
|
-
children: renderedKeys.map(({ id, value }) => /* @__PURE__ */ jsx(
|
|
23211
|
-
Box,
|
|
23212
|
-
{
|
|
23213
|
-
as: "kbd",
|
|
23214
|
-
className: isSpecialSymbol(value) ? symbolClasses.key : defaultClasses.key,
|
|
23215
|
-
children: value
|
|
23216
|
-
},
|
|
23217
|
-
id
|
|
23218
|
-
))
|
|
23219
|
-
}
|
|
23220
|
-
);
|
|
23221
|
-
return /* @__PURE__ */ jsx(Tooltip, { text: tooltipText, children: content });
|
|
23222
|
-
};
|
|
23223
23539
|
const ModalWrapperContext = createContext(null);
|
|
23224
23540
|
const useModalWrapperContext = () => {
|
|
23225
23541
|
const context2 = useContext(ModalWrapperContext);
|
|
@@ -26493,6 +26809,7 @@ export {
|
|
|
26493
26809
|
DrawerFooter,
|
|
26494
26810
|
DrawerHeader,
|
|
26495
26811
|
DsChainScope,
|
|
26812
|
+
FilterField,
|
|
26496
26813
|
FilterMenu,
|
|
26497
26814
|
FilterToken,
|
|
26498
26815
|
FormField,
|