cetec-design-system 3.6.0-0 → 4.0.1-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 +370 -62
- package/dist/index.js.map +1 -1
- package/dist/panda.buildinfo.json +21 -6
- package/dist/preset.js +316 -28
- package/dist/preset.js.map +1 -1
- package/dist/specs/recipes.json +67 -16
- package/dist/styles.css +279 -33
- package/dist/types/index.d.ts +190 -36
- package/package.json +8 -11
- package/src/recipes/code.ts +38 -24
- package/src/recipes/codeBlock.ts +279 -0
- package/src/recipes/menu.ts +6 -1
- package/src/recipes/recipes-regular.ts +1 -1
- package/src/recipes/recipes-slot.ts +1 -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, useEffect, useCallback, useId as useId$1, isValidElement, Children, cloneElement, useReducer } 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";
|
|
@@ -543,8 +543,16 @@ const checkboxInput = /* @__PURE__ */ Object.assign(memo(checkboxInputFn.recipeF
|
|
|
543
543
|
},
|
|
544
544
|
getVariantProps: checkboxInputFn.getVariantProps
|
|
545
545
|
});
|
|
546
|
-
const codeFn = /* @__PURE__ */ createRecipe("code", {
|
|
547
|
-
|
|
546
|
+
const codeFn = /* @__PURE__ */ createRecipe("code", {
|
|
547
|
+
"variant": "subtle"
|
|
548
|
+
}, []);
|
|
549
|
+
const codeVariantMap = {
|
|
550
|
+
"variant": [
|
|
551
|
+
"subtle",
|
|
552
|
+
"outline",
|
|
553
|
+
"plain"
|
|
554
|
+
]
|
|
555
|
+
};
|
|
548
556
|
const codeVariantKeys = Object.keys(codeVariantMap);
|
|
549
557
|
const code = /* @__PURE__ */ Object.assign(memo(codeFn.recipeFn), {
|
|
550
558
|
__recipe__: true,
|
|
@@ -883,24 +891,6 @@ const list = /* @__PURE__ */ Object.assign(memo(listFn.recipeFn), {
|
|
|
883
891
|
},
|
|
884
892
|
getVariantProps: listFn.getVariantProps
|
|
885
893
|
});
|
|
886
|
-
const preFn = /* @__PURE__ */ createRecipe("pre", {}, []);
|
|
887
|
-
const preVariantMap = {};
|
|
888
|
-
const preVariantKeys = Object.keys(preVariantMap);
|
|
889
|
-
const pre = /* @__PURE__ */ Object.assign(memo(preFn.recipeFn), {
|
|
890
|
-
__recipe__: true,
|
|
891
|
-
__name__: "pre",
|
|
892
|
-
__getCompoundVariantCss__: preFn.__getCompoundVariantCss__,
|
|
893
|
-
raw: (props) => props,
|
|
894
|
-
variantKeys: preVariantKeys,
|
|
895
|
-
variantMap: preVariantMap,
|
|
896
|
-
merge(recipe) {
|
|
897
|
-
return mergeRecipes(this, recipe);
|
|
898
|
-
},
|
|
899
|
-
splitVariantProps(props) {
|
|
900
|
-
return splitProps$1(props, preVariantKeys);
|
|
901
|
-
},
|
|
902
|
-
getVariantProps: preFn.getVariantProps
|
|
903
|
-
});
|
|
904
894
|
const radioInputFn = /* @__PURE__ */ createRecipe("radioInput", {}, []);
|
|
905
895
|
const radioInputVariantMap = {};
|
|
906
896
|
const radioInputVariantKeys = Object.keys(radioInputVariantMap);
|
|
@@ -984,7 +974,7 @@ const spinnerVariantKeys = [
|
|
|
984
974
|
"inverse",
|
|
985
975
|
"centered"
|
|
986
976
|
];
|
|
987
|
-
const getVariantProps$
|
|
977
|
+
const getVariantProps$v = (variants) => ({ ...spinnerDefaultVariants, ...compact(variants) });
|
|
988
978
|
const spinner = /* @__PURE__ */ Object.assign(spinnerFn, {
|
|
989
979
|
__recipe__: false,
|
|
990
980
|
__name__: "spinner",
|
|
@@ -1009,7 +999,7 @@ const spinner = /* @__PURE__ */ Object.assign(spinnerFn, {
|
|
|
1009
999
|
splitVariantProps(props) {
|
|
1010
1000
|
return splitProps$1(props, spinnerVariantKeys);
|
|
1011
1001
|
},
|
|
1012
|
-
getVariantProps: getVariantProps$
|
|
1002
|
+
getVariantProps: getVariantProps$v
|
|
1013
1003
|
});
|
|
1014
1004
|
const tagFn = /* @__PURE__ */ createRecipe("tag", {
|
|
1015
1005
|
"variant": "default",
|
|
@@ -1677,7 +1667,7 @@ const toggleFn = memo((props = {}) => {
|
|
|
1677
1667
|
return Object.fromEntries(toggleSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
1678
1668
|
});
|
|
1679
1669
|
const toggleVariantKeys = [];
|
|
1680
|
-
const getVariantProps$
|
|
1670
|
+
const getVariantProps$u = (variants) => ({ ...toggleDefaultVariants, ...compact(variants) });
|
|
1681
1671
|
const toggle = /* @__PURE__ */ Object.assign(toggleFn, {
|
|
1682
1672
|
__recipe__: false,
|
|
1683
1673
|
__name__: "toggle",
|
|
@@ -1688,7 +1678,7 @@ const toggle = /* @__PURE__ */ Object.assign(toggleFn, {
|
|
|
1688
1678
|
splitVariantProps(props) {
|
|
1689
1679
|
return splitProps$1(props, toggleVariantKeys);
|
|
1690
1680
|
},
|
|
1691
|
-
getVariantProps: getVariantProps$
|
|
1681
|
+
getVariantProps: getVariantProps$u
|
|
1692
1682
|
});
|
|
1693
1683
|
const alertDefaultVariants = {
|
|
1694
1684
|
"tone": "info"
|
|
@@ -1731,7 +1721,7 @@ const alertFn = memo((props = {}) => {
|
|
|
1731
1721
|
const alertVariantKeys = [
|
|
1732
1722
|
"tone"
|
|
1733
1723
|
];
|
|
1734
|
-
const getVariantProps$
|
|
1724
|
+
const getVariantProps$t = (variants) => ({ ...alertDefaultVariants, ...compact(variants) });
|
|
1735
1725
|
const alert = /* @__PURE__ */ Object.assign(alertFn, {
|
|
1736
1726
|
__recipe__: false,
|
|
1737
1727
|
__name__: "alert",
|
|
@@ -1750,7 +1740,7 @@ const alert = /* @__PURE__ */ Object.assign(alertFn, {
|
|
|
1750
1740
|
splitVariantProps(props) {
|
|
1751
1741
|
return splitProps$1(props, alertVariantKeys);
|
|
1752
1742
|
},
|
|
1753
|
-
getVariantProps: getVariantProps$
|
|
1743
|
+
getVariantProps: getVariantProps$t
|
|
1754
1744
|
});
|
|
1755
1745
|
const autocompleteDefaultVariants = {
|
|
1756
1746
|
"size": "md",
|
|
@@ -1807,7 +1797,7 @@ const autocompleteVariantKeys = [
|
|
|
1807
1797
|
"layer",
|
|
1808
1798
|
"size"
|
|
1809
1799
|
];
|
|
1810
|
-
const getVariantProps$
|
|
1800
|
+
const getVariantProps$s = (variants) => ({ ...autocompleteDefaultVariants, ...compact(variants) });
|
|
1811
1801
|
const autocomplete = /* @__PURE__ */ Object.assign(autocompleteFn, {
|
|
1812
1802
|
__recipe__: false,
|
|
1813
1803
|
__name__: "autocomplete",
|
|
@@ -1829,7 +1819,7 @@ const autocomplete = /* @__PURE__ */ Object.assign(autocompleteFn, {
|
|
|
1829
1819
|
splitVariantProps(props) {
|
|
1830
1820
|
return splitProps$1(props, autocompleteVariantKeys);
|
|
1831
1821
|
},
|
|
1832
|
-
getVariantProps: getVariantProps$
|
|
1822
|
+
getVariantProps: getVariantProps$s
|
|
1833
1823
|
});
|
|
1834
1824
|
const avatarDefaultVariants = {
|
|
1835
1825
|
"size": "md",
|
|
@@ -1866,7 +1856,7 @@ const avatarVariantKeys = [
|
|
|
1866
1856
|
"size",
|
|
1867
1857
|
"shape"
|
|
1868
1858
|
];
|
|
1869
|
-
const getVariantProps$
|
|
1859
|
+
const getVariantProps$r = (variants) => ({ ...avatarDefaultVariants, ...compact(variants) });
|
|
1870
1860
|
const avatar = /* @__PURE__ */ Object.assign(avatarFn, {
|
|
1871
1861
|
__recipe__: false,
|
|
1872
1862
|
__name__: "avatar",
|
|
@@ -1891,7 +1881,7 @@ const avatar = /* @__PURE__ */ Object.assign(avatarFn, {
|
|
|
1891
1881
|
splitVariantProps(props) {
|
|
1892
1882
|
return splitProps$1(props, avatarVariantKeys);
|
|
1893
1883
|
},
|
|
1894
|
-
getVariantProps: getVariantProps$
|
|
1884
|
+
getVariantProps: getVariantProps$r
|
|
1895
1885
|
});
|
|
1896
1886
|
const badgeDefaultVariants = {
|
|
1897
1887
|
"size": "md",
|
|
@@ -1918,7 +1908,7 @@ const badgeVariantKeys = [
|
|
|
1918
1908
|
"dot",
|
|
1919
1909
|
"variant"
|
|
1920
1910
|
];
|
|
1921
|
-
const getVariantProps$
|
|
1911
|
+
const getVariantProps$q = (variants) => ({ ...badgeDefaultVariants, ...compact(variants) });
|
|
1922
1912
|
const badge = /* @__PURE__ */ Object.assign(badgeFn, {
|
|
1923
1913
|
__recipe__: false,
|
|
1924
1914
|
__name__: "badge",
|
|
@@ -1954,7 +1944,7 @@ const badge = /* @__PURE__ */ Object.assign(badgeFn, {
|
|
|
1954
1944
|
splitVariantProps(props) {
|
|
1955
1945
|
return splitProps$1(props, badgeVariantKeys);
|
|
1956
1946
|
},
|
|
1957
|
-
getVariantProps: getVariantProps$
|
|
1947
|
+
getVariantProps: getVariantProps$q
|
|
1958
1948
|
});
|
|
1959
1949
|
const breadcrumbsDefaultVariants = {};
|
|
1960
1950
|
const breadcrumbsCompoundVariants = [];
|
|
@@ -1981,7 +1971,7 @@ const breadcrumbsFn = memo((props = {}) => {
|
|
|
1981
1971
|
return Object.fromEntries(breadcrumbsSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
1982
1972
|
});
|
|
1983
1973
|
const breadcrumbsVariantKeys = [];
|
|
1984
|
-
const getVariantProps$
|
|
1974
|
+
const getVariantProps$p = (variants) => ({ ...breadcrumbsDefaultVariants, ...compact(variants) });
|
|
1985
1975
|
const breadcrumbs = /* @__PURE__ */ Object.assign(breadcrumbsFn, {
|
|
1986
1976
|
__recipe__: false,
|
|
1987
1977
|
__name__: "breadcrumbs",
|
|
@@ -1992,7 +1982,7 @@ const breadcrumbs = /* @__PURE__ */ Object.assign(breadcrumbsFn, {
|
|
|
1992
1982
|
splitVariantProps(props) {
|
|
1993
1983
|
return splitProps$1(props, breadcrumbsVariantKeys);
|
|
1994
1984
|
},
|
|
1995
|
-
getVariantProps: getVariantProps$
|
|
1985
|
+
getVariantProps: getVariantProps$p
|
|
1996
1986
|
});
|
|
1997
1987
|
const buttonDefaultVariants = {
|
|
1998
1988
|
"variant": "standard",
|
|
@@ -2023,7 +2013,7 @@ const buttonVariantKeys = [
|
|
|
2023
2013
|
"before",
|
|
2024
2014
|
"after"
|
|
2025
2015
|
];
|
|
2026
|
-
const getVariantProps$
|
|
2016
|
+
const getVariantProps$o = (variants) => ({ ...buttonDefaultVariants, ...compact(variants) });
|
|
2027
2017
|
const button = /* @__PURE__ */ Object.assign(buttonFn, {
|
|
2028
2018
|
__recipe__: false,
|
|
2029
2019
|
__name__: "button",
|
|
@@ -2057,7 +2047,7 @@ const button = /* @__PURE__ */ Object.assign(buttonFn, {
|
|
|
2057
2047
|
splitVariantProps(props) {
|
|
2058
2048
|
return splitProps$1(props, buttonVariantKeys);
|
|
2059
2049
|
},
|
|
2060
|
-
getVariantProps: getVariantProps$
|
|
2050
|
+
getVariantProps: getVariantProps$o
|
|
2061
2051
|
});
|
|
2062
2052
|
const calendarDefaultVariants = {
|
|
2063
2053
|
"type": "days"
|
|
@@ -2096,7 +2086,7 @@ const calendarFn = memo((props = {}) => {
|
|
|
2096
2086
|
const calendarVariantKeys = [
|
|
2097
2087
|
"type"
|
|
2098
2088
|
];
|
|
2099
|
-
const getVariantProps$
|
|
2089
|
+
const getVariantProps$n = (variants) => ({ ...calendarDefaultVariants, ...compact(variants) });
|
|
2100
2090
|
const calendar = /* @__PURE__ */ Object.assign(calendarFn, {
|
|
2101
2091
|
__recipe__: false,
|
|
2102
2092
|
__name__: "calendar",
|
|
@@ -2113,7 +2103,7 @@ const calendar = /* @__PURE__ */ Object.assign(calendarFn, {
|
|
|
2113
2103
|
splitVariantProps(props) {
|
|
2114
2104
|
return splitProps$1(props, calendarVariantKeys);
|
|
2115
2105
|
},
|
|
2116
|
-
getVariantProps: getVariantProps$
|
|
2106
|
+
getVariantProps: getVariantProps$n
|
|
2117
2107
|
});
|
|
2118
2108
|
const checkboxDefaultVariants = {};
|
|
2119
2109
|
const checkboxCompoundVariants = [];
|
|
@@ -2140,7 +2130,7 @@ const checkboxFn = memo((props = {}) => {
|
|
|
2140
2130
|
return Object.fromEntries(checkboxSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2141
2131
|
});
|
|
2142
2132
|
const checkboxVariantKeys = [];
|
|
2143
|
-
const getVariantProps$
|
|
2133
|
+
const getVariantProps$m = (variants) => ({ ...checkboxDefaultVariants, ...compact(variants) });
|
|
2144
2134
|
const checkbox = /* @__PURE__ */ Object.assign(checkboxFn, {
|
|
2145
2135
|
__recipe__: false,
|
|
2146
2136
|
__name__: "checkbox",
|
|
@@ -2151,7 +2141,7 @@ const checkbox = /* @__PURE__ */ Object.assign(checkboxFn, {
|
|
|
2151
2141
|
splitVariantProps(props) {
|
|
2152
2142
|
return splitProps$1(props, checkboxVariantKeys);
|
|
2153
2143
|
},
|
|
2154
|
-
getVariantProps: getVariantProps$
|
|
2144
|
+
getVariantProps: getVariantProps$m
|
|
2155
2145
|
});
|
|
2156
2146
|
const chipDefaultVariants = {
|
|
2157
2147
|
"size": "md"
|
|
@@ -2189,7 +2179,7 @@ const chipVariantKeys = [
|
|
|
2189
2179
|
"after",
|
|
2190
2180
|
"dismissable"
|
|
2191
2181
|
];
|
|
2192
|
-
const getVariantProps$
|
|
2182
|
+
const getVariantProps$l = (variants) => ({ ...chipDefaultVariants, ...compact(variants) });
|
|
2193
2183
|
const chip = /* @__PURE__ */ Object.assign(chipFn, {
|
|
2194
2184
|
__recipe__: false,
|
|
2195
2185
|
__name__: "chip",
|
|
@@ -2216,6 +2206,111 @@ const chip = /* @__PURE__ */ Object.assign(chipFn, {
|
|
|
2216
2206
|
splitVariantProps(props) {
|
|
2217
2207
|
return splitProps$1(props, chipVariantKeys);
|
|
2218
2208
|
},
|
|
2209
|
+
getVariantProps: getVariantProps$l
|
|
2210
|
+
});
|
|
2211
|
+
const codeBlockDefaultVariants = {
|
|
2212
|
+
"tone": "default",
|
|
2213
|
+
"size": "md",
|
|
2214
|
+
"wrap": false,
|
|
2215
|
+
"lineNumbers": false,
|
|
2216
|
+
"collapsed": false,
|
|
2217
|
+
"actionGutter": false
|
|
2218
|
+
};
|
|
2219
|
+
const codeBlockCompoundVariants = [];
|
|
2220
|
+
const codeBlockSlotNames = [
|
|
2221
|
+
[
|
|
2222
|
+
"root",
|
|
2223
|
+
"codeBlock__root"
|
|
2224
|
+
],
|
|
2225
|
+
[
|
|
2226
|
+
"header",
|
|
2227
|
+
"codeBlock__header"
|
|
2228
|
+
],
|
|
2229
|
+
[
|
|
2230
|
+
"title",
|
|
2231
|
+
"codeBlock__title"
|
|
2232
|
+
],
|
|
2233
|
+
[
|
|
2234
|
+
"actions",
|
|
2235
|
+
"codeBlock__actions"
|
|
2236
|
+
],
|
|
2237
|
+
[
|
|
2238
|
+
"floatingActions",
|
|
2239
|
+
"codeBlock__floatingActions"
|
|
2240
|
+
],
|
|
2241
|
+
[
|
|
2242
|
+
"content",
|
|
2243
|
+
"codeBlock__content"
|
|
2244
|
+
],
|
|
2245
|
+
[
|
|
2246
|
+
"pre",
|
|
2247
|
+
"codeBlock__pre"
|
|
2248
|
+
],
|
|
2249
|
+
[
|
|
2250
|
+
"code",
|
|
2251
|
+
"codeBlock__code"
|
|
2252
|
+
],
|
|
2253
|
+
[
|
|
2254
|
+
"line",
|
|
2255
|
+
"codeBlock__line"
|
|
2256
|
+
],
|
|
2257
|
+
[
|
|
2258
|
+
"lineNumber",
|
|
2259
|
+
"codeBlock__lineNumber"
|
|
2260
|
+
],
|
|
2261
|
+
[
|
|
2262
|
+
"expand",
|
|
2263
|
+
"codeBlock__expand"
|
|
2264
|
+
]
|
|
2265
|
+
];
|
|
2266
|
+
const codeBlockSlotFns = /* @__PURE__ */ codeBlockSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, codeBlockDefaultVariants, getSlotCompoundVariant(codeBlockCompoundVariants, slotName))]);
|
|
2267
|
+
const codeBlockFn = memo((props = {}) => {
|
|
2268
|
+
return Object.fromEntries(codeBlockSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2269
|
+
});
|
|
2270
|
+
const codeBlockVariantKeys = [
|
|
2271
|
+
"tone",
|
|
2272
|
+
"size",
|
|
2273
|
+
"wrap",
|
|
2274
|
+
"lineNumbers",
|
|
2275
|
+
"collapsed",
|
|
2276
|
+
"actionGutter"
|
|
2277
|
+
];
|
|
2278
|
+
const getVariantProps$k = (variants) => ({ ...codeBlockDefaultVariants, ...compact(variants) });
|
|
2279
|
+
const codeBlock = /* @__PURE__ */ Object.assign(codeBlockFn, {
|
|
2280
|
+
__recipe__: false,
|
|
2281
|
+
__name__: "codeBlock",
|
|
2282
|
+
raw: (props) => props,
|
|
2283
|
+
classNameMap: {},
|
|
2284
|
+
variantKeys: codeBlockVariantKeys,
|
|
2285
|
+
variantMap: {
|
|
2286
|
+
"tone": [
|
|
2287
|
+
"default",
|
|
2288
|
+
"inverse"
|
|
2289
|
+
],
|
|
2290
|
+
"size": [
|
|
2291
|
+
"sm",
|
|
2292
|
+
"md"
|
|
2293
|
+
],
|
|
2294
|
+
"wrap": [
|
|
2295
|
+
"true",
|
|
2296
|
+
"false"
|
|
2297
|
+
],
|
|
2298
|
+
"lineNumbers": [
|
|
2299
|
+
"true",
|
|
2300
|
+
"false"
|
|
2301
|
+
],
|
|
2302
|
+
"collapsed": [
|
|
2303
|
+
"true",
|
|
2304
|
+
"false"
|
|
2305
|
+
],
|
|
2306
|
+
"actionGutter": [
|
|
2307
|
+
"true",
|
|
2308
|
+
"false"
|
|
2309
|
+
]
|
|
2310
|
+
},
|
|
2311
|
+
splitVariantProps(props) {
|
|
2312
|
+
return splitProps$1(props, codeBlockVariantKeys);
|
|
2313
|
+
},
|
|
2219
2314
|
getVariantProps: getVariantProps$k
|
|
2220
2315
|
});
|
|
2221
2316
|
const dateMenusDefaultVariants = {};
|
|
@@ -15744,6 +15839,44 @@ function useContainerQuery(containerRef, size2, direction = "min") {
|
|
|
15744
15839
|
() => false
|
|
15745
15840
|
);
|
|
15746
15841
|
}
|
|
15842
|
+
function useClipboard(options = {}) {
|
|
15843
|
+
const { timeout = 2e3 } = options;
|
|
15844
|
+
const [copied, setCopied] = useState(false);
|
|
15845
|
+
const [failed, setFailed] = useState(false);
|
|
15846
|
+
const timerRef = useRef(null);
|
|
15847
|
+
const attemptRef = useRef(0);
|
|
15848
|
+
useEffect(
|
|
15849
|
+
() => () => {
|
|
15850
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15851
|
+
},
|
|
15852
|
+
[]
|
|
15853
|
+
);
|
|
15854
|
+
const copy = useCallback(
|
|
15855
|
+
async (text2) => {
|
|
15856
|
+
const attempt = ++attemptRef.current;
|
|
15857
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15858
|
+
setFailed(false);
|
|
15859
|
+
try {
|
|
15860
|
+
if (typeof navigator === "undefined" || !navigator.clipboard) {
|
|
15861
|
+
throw new Error("Clipboard API is not available.");
|
|
15862
|
+
}
|
|
15863
|
+
await navigator.clipboard.writeText(text2);
|
|
15864
|
+
} catch {
|
|
15865
|
+
if (attempt !== attemptRef.current) return false;
|
|
15866
|
+
setCopied(false);
|
|
15867
|
+
setFailed(true);
|
|
15868
|
+
return false;
|
|
15869
|
+
}
|
|
15870
|
+
if (attempt !== attemptRef.current) return true;
|
|
15871
|
+
setCopied(true);
|
|
15872
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15873
|
+
timerRef.current = setTimeout(() => setCopied(false), timeout);
|
|
15874
|
+
return true;
|
|
15875
|
+
},
|
|
15876
|
+
[timeout]
|
|
15877
|
+
);
|
|
15878
|
+
return { copy, copied, failed };
|
|
15879
|
+
}
|
|
15747
15880
|
const Tag = (props) => {
|
|
15748
15881
|
const { variant, hue, iconBefore, iconAfter, children, ...rest } = props;
|
|
15749
15882
|
const [className, otherProps] = splitProps(rest);
|
|
@@ -16999,36 +17132,207 @@ const ChipGroup = (props) => {
|
|
|
16999
17132
|
) });
|
|
17000
17133
|
};
|
|
17001
17134
|
const Code = (props) => {
|
|
17002
|
-
const {
|
|
17135
|
+
const { variant, language, children, ...rest } = props;
|
|
17003
17136
|
const [className, otherProps] = splitProps(rest);
|
|
17004
17137
|
return /* @__PURE__ */ jsx(
|
|
17005
17138
|
Box,
|
|
17006
17139
|
{
|
|
17007
17140
|
...dsComponent("Code"),
|
|
17008
17141
|
as: "code",
|
|
17009
|
-
className: cx(code({}), className),
|
|
17010
|
-
|
|
17142
|
+
className: cx(code({ variant }), className),
|
|
17143
|
+
"data-language": language,
|
|
17011
17144
|
...otherProps,
|
|
17012
|
-
children
|
|
17145
|
+
children
|
|
17013
17146
|
}
|
|
17014
17147
|
);
|
|
17015
17148
|
};
|
|
17016
|
-
const
|
|
17149
|
+
const DS_PART_ATTRIBUTE = "data-ds-part";
|
|
17150
|
+
const dsPart = (part) => ({
|
|
17151
|
+
[DS_PART_ATTRIBUTE]: part
|
|
17152
|
+
});
|
|
17153
|
+
const stripTrailingNewline = (value) => value.replace(/\r?\n$/, "");
|
|
17154
|
+
const scrollbarHeight = (element) => {
|
|
17155
|
+
const styles = getComputedStyle(element);
|
|
17156
|
+
return Math.max(
|
|
17157
|
+
0,
|
|
17158
|
+
element.offsetHeight - element.clientHeight - parseFloat(styles.borderTopWidth) - parseFloat(styles.borderBottomWidth)
|
|
17159
|
+
);
|
|
17160
|
+
};
|
|
17161
|
+
const CodeBlock = (props) => {
|
|
17017
17162
|
const {
|
|
17163
|
+
code: codeProp,
|
|
17018
17164
|
children,
|
|
17019
|
-
|
|
17020
|
-
|
|
17165
|
+
language,
|
|
17166
|
+
title,
|
|
17167
|
+
copyable = true,
|
|
17168
|
+
copyLabel = "Copy code",
|
|
17169
|
+
maxLines,
|
|
17170
|
+
expanded: expandedProp,
|
|
17171
|
+
defaultExpanded = false,
|
|
17172
|
+
onExpandedChange,
|
|
17173
|
+
lineNumbers = false,
|
|
17174
|
+
tone = "default",
|
|
17175
|
+
size: size2,
|
|
17176
|
+
wrap,
|
|
17177
|
+
style,
|
|
17021
17178
|
...rest
|
|
17022
17179
|
} = props;
|
|
17023
17180
|
const [className, otherProps] = splitProps(rest);
|
|
17024
|
-
|
|
17181
|
+
const text2 = stripTrailingNewline(codeProp ?? children ?? "");
|
|
17182
|
+
const lines = text2.split(/\r?\n/);
|
|
17183
|
+
const lineCount = lines.length;
|
|
17184
|
+
const showLineNumbers = lineNumbers !== false;
|
|
17185
|
+
const lineStart = typeof lineNumbers === "object" ? lineNumbers.start : 1;
|
|
17186
|
+
const lastLineNumber = lineStart + lineCount - 1;
|
|
17187
|
+
const [expanded, setExpanded] = useControllableState({
|
|
17188
|
+
value: expandedProp,
|
|
17189
|
+
defaultValue: defaultExpanded,
|
|
17190
|
+
onChange: onExpandedChange
|
|
17191
|
+
});
|
|
17192
|
+
const canCollapse = maxLines !== void 0 && lineCount > maxLines;
|
|
17193
|
+
const collapsed = canCollapse && !expanded;
|
|
17194
|
+
const floatingCopy = copyable && title === void 0;
|
|
17195
|
+
const classes = codeBlock({
|
|
17196
|
+
tone,
|
|
17197
|
+
size: size2,
|
|
17198
|
+
wrap,
|
|
17199
|
+
lineNumbers: showLineNumbers,
|
|
17200
|
+
collapsed,
|
|
17201
|
+
actionGutter: floatingCopy
|
|
17202
|
+
});
|
|
17203
|
+
const { copy, copied, failed } = useClipboard();
|
|
17204
|
+
const labelId = useId$1();
|
|
17205
|
+
const contentId = useId$1();
|
|
17206
|
+
const contentRef = useRef(null);
|
|
17207
|
+
const [overflowing, setOverflowing] = useState(false);
|
|
17208
|
+
const [collapsedHeight, setCollapsedHeight] = useState();
|
|
17209
|
+
useLayoutEffect(() => {
|
|
17210
|
+
const element = contentRef.current;
|
|
17211
|
+
if (!element) return void 0;
|
|
17212
|
+
const measure = () => {
|
|
17213
|
+
var _a;
|
|
17214
|
+
const lastVisibleLine = collapsed && maxLines !== void 0 ? (_a = element.querySelector("code")) == null ? void 0 : _a.children[maxLines - 1] : void 0;
|
|
17215
|
+
const pre = element.firstElementChild;
|
|
17216
|
+
if (lastVisibleLine && pre) {
|
|
17217
|
+
const bottom = lastVisibleLine.getBoundingClientRect().bottom - element.getBoundingClientRect().top + element.scrollTop + parseFloat(getComputedStyle(pre).paddingBottom) + scrollbarHeight(element);
|
|
17218
|
+
setCollapsedHeight(Math.ceil(bottom));
|
|
17219
|
+
} else {
|
|
17220
|
+
setCollapsedHeight(void 0);
|
|
17221
|
+
}
|
|
17222
|
+
setOverflowing(
|
|
17223
|
+
element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight
|
|
17224
|
+
);
|
|
17225
|
+
};
|
|
17226
|
+
measure();
|
|
17227
|
+
if (typeof ResizeObserver === "undefined") return void 0;
|
|
17228
|
+
const observer = new ResizeObserver(measure);
|
|
17229
|
+
observer.observe(element);
|
|
17230
|
+
const codeElement = element.querySelector("code");
|
|
17231
|
+
if (codeElement) observer.observe(codeElement);
|
|
17232
|
+
return () => observer.disconnect();
|
|
17233
|
+
}, [text2, collapsed, maxLines, wrap, showLineNumbers, size2]);
|
|
17234
|
+
const labelSource = typeof title === "string" ? title : language;
|
|
17235
|
+
const label2 = labelSource ? `${labelSource} code block` : "Code block";
|
|
17236
|
+
const rootStyle = {
|
|
17237
|
+
"--code-block-max-lines": maxLines,
|
|
17238
|
+
"--code-block-collapsed-h": collapsed && collapsedHeight !== void 0 ? `${String(collapsedHeight)}px` : void 0,
|
|
17239
|
+
"--code-block-gutter": `${String(Math.max(lastLineNumber, 1)).length}ch`,
|
|
17240
|
+
...style
|
|
17241
|
+
};
|
|
17242
|
+
const copyButton = copyable ? /* @__PURE__ */ jsx(
|
|
17243
|
+
IconButton,
|
|
17244
|
+
{
|
|
17245
|
+
...dsPart("copy"),
|
|
17246
|
+
iconName: copied ? "check" : "copy",
|
|
17247
|
+
altText: copied ? "Copied" : copyLabel,
|
|
17248
|
+
variant: tone === "inverse" ? "primary" : "ghost",
|
|
17249
|
+
size: "sm",
|
|
17250
|
+
onClick: () => {
|
|
17251
|
+
void copy(text2);
|
|
17252
|
+
}
|
|
17253
|
+
}
|
|
17254
|
+
) : null;
|
|
17255
|
+
return /* @__PURE__ */ jsxs(
|
|
17025
17256
|
Box,
|
|
17026
17257
|
{
|
|
17027
|
-
...dsComponent("
|
|
17028
|
-
|
|
17029
|
-
|
|
17258
|
+
...dsComponent("CodeBlock"),
|
|
17259
|
+
className: cx(classes.root, className),
|
|
17260
|
+
"data-language": language,
|
|
17261
|
+
style: rootStyle,
|
|
17030
17262
|
...otherProps,
|
|
17031
|
-
children:
|
|
17263
|
+
children: [
|
|
17264
|
+
/* @__PURE__ */ jsx(Box, { as: "span", id: labelId, srOnly: true, children: label2 }),
|
|
17265
|
+
title !== void 0 && /* @__PURE__ */ jsxs(Box, { className: classes.header, children: [
|
|
17266
|
+
/* @__PURE__ */ jsx(Box, { className: classes.title, children: title }),
|
|
17267
|
+
copyButton && /* @__PURE__ */ jsx(Box, { className: classes.actions, children: copyButton })
|
|
17268
|
+
] }),
|
|
17269
|
+
floatingCopy && /* @__PURE__ */ jsx(Box, { className: classes.floatingActions, children: copyButton }),
|
|
17270
|
+
/* @__PURE__ */ jsx(
|
|
17271
|
+
Box,
|
|
17272
|
+
{
|
|
17273
|
+
ref: contentRef,
|
|
17274
|
+
id: contentId,
|
|
17275
|
+
className: classes.content,
|
|
17276
|
+
...overflowing && {
|
|
17277
|
+
tabIndex: 0,
|
|
17278
|
+
role: "region",
|
|
17279
|
+
"aria-labelledby": labelId
|
|
17280
|
+
},
|
|
17281
|
+
children: /* @__PURE__ */ jsx(Box, { as: "pre", className: classes.pre, children: /* @__PURE__ */ jsx(
|
|
17282
|
+
Box,
|
|
17283
|
+
{
|
|
17284
|
+
as: "code",
|
|
17285
|
+
className: cx(classes.code, language && `language-${language}`),
|
|
17286
|
+
children: lines.map((line, index2) => /* @__PURE__ */ jsxs(
|
|
17287
|
+
Box,
|
|
17288
|
+
{
|
|
17289
|
+
as: "span",
|
|
17290
|
+
className: classes.line,
|
|
17291
|
+
children: [
|
|
17292
|
+
showLineNumbers && /* @__PURE__ */ jsx(
|
|
17293
|
+
Box,
|
|
17294
|
+
{
|
|
17295
|
+
as: "span",
|
|
17296
|
+
"aria-hidden": "true",
|
|
17297
|
+
className: classes.lineNumber,
|
|
17298
|
+
"data-line": lineStart + index2
|
|
17299
|
+
}
|
|
17300
|
+
),
|
|
17301
|
+
line
|
|
17302
|
+
]
|
|
17303
|
+
},
|
|
17304
|
+
index2
|
|
17305
|
+
))
|
|
17306
|
+
}
|
|
17307
|
+
) })
|
|
17308
|
+
}
|
|
17309
|
+
),
|
|
17310
|
+
canCollapse && /* @__PURE__ */ jsxs(
|
|
17311
|
+
Box,
|
|
17312
|
+
{
|
|
17313
|
+
as: "button",
|
|
17314
|
+
type: "button",
|
|
17315
|
+
...dsPart("expand"),
|
|
17316
|
+
className: classes.expand,
|
|
17317
|
+
"aria-expanded": expanded,
|
|
17318
|
+
"aria-controls": contentId,
|
|
17319
|
+
onClick: () => setExpanded(!expanded),
|
|
17320
|
+
children: [
|
|
17321
|
+
/* @__PURE__ */ jsx(
|
|
17322
|
+
Icon,
|
|
17323
|
+
{
|
|
17324
|
+
name: expanded ? "collapse-vertical" : "expand-vertical",
|
|
17325
|
+
size: "16",
|
|
17326
|
+
fill: "current",
|
|
17327
|
+
"aria-hidden": "true"
|
|
17328
|
+
}
|
|
17329
|
+
),
|
|
17330
|
+
expanded ? "Show less" : `Show all ${lineCount} lines`
|
|
17331
|
+
]
|
|
17332
|
+
}
|
|
17333
|
+
),
|
|
17334
|
+
/* @__PURE__ */ jsx(Box, { as: "span", role: "status", "aria-live": "polite", srOnly: true, children: copied ? "Copied" : failed ? "Copy failed" : "" })
|
|
17335
|
+
]
|
|
17032
17336
|
}
|
|
17033
17337
|
);
|
|
17034
17338
|
};
|
|
@@ -18935,8 +19239,11 @@ const Menu = (props) => {
|
|
|
18935
19239
|
return;
|
|
18936
19240
|
}
|
|
18937
19241
|
const updateWrapperSize = () => {
|
|
18938
|
-
const
|
|
18939
|
-
const
|
|
19242
|
+
const rect = sizeProbe.getBoundingClientRect();
|
|
19243
|
+
const activeLevelEl = activeLevelRef.current;
|
|
19244
|
+
const scrollbarWidth = activeLevelEl && !shouldUsePanelDiginProbeFill ? activeLevelEl.offsetWidth - activeLevelEl.clientWidth : 0;
|
|
19245
|
+
const nextWidth = Math.ceil(rect.width) + scrollbarWidth;
|
|
19246
|
+
const nextHeight = Math.ceil(rect.height);
|
|
18940
19247
|
setWrapperSize((previous) => {
|
|
18941
19248
|
if (previous.width === nextWidth && previous.height === nextHeight) {
|
|
18942
19249
|
return previous;
|
|
@@ -18950,6 +19257,9 @@ const Menu = (props) => {
|
|
|
18950
19257
|
updateWrapperSize();
|
|
18951
19258
|
const resizeObserver = new ResizeObserver(updateWrapperSize);
|
|
18952
19259
|
resizeObserver.observe(sizeProbe);
|
|
19260
|
+
if (activeLevelRef.current) {
|
|
19261
|
+
resizeObserver.observe(activeLevelRef.current);
|
|
19262
|
+
}
|
|
18953
19263
|
return () => {
|
|
18954
19264
|
resizeObserver.disconnect();
|
|
18955
19265
|
};
|
|
@@ -18961,7 +19271,8 @@ const Menu = (props) => {
|
|
|
18961
19271
|
diginDepth,
|
|
18962
19272
|
hasVisibleResults,
|
|
18963
19273
|
isMenuVisible,
|
|
18964
|
-
shouldUseDiginSizing
|
|
19274
|
+
shouldUseDiginSizing,
|
|
19275
|
+
shouldUsePanelDiginProbeFill
|
|
18965
19276
|
]);
|
|
18966
19277
|
useLayoutEffect(() => {
|
|
18967
19278
|
var _a2;
|
|
@@ -22542,10 +22853,6 @@ const RadioInput = (props) => {
|
|
|
22542
22853
|
}
|
|
22543
22854
|
);
|
|
22544
22855
|
};
|
|
22545
|
-
const DS_PART_ATTRIBUTE = "data-ds-part";
|
|
22546
|
-
const dsPart = (part) => ({
|
|
22547
|
-
[DS_PART_ATTRIBUTE]: part
|
|
22548
|
-
});
|
|
22549
22856
|
const AutocompleteListbox = (props) => {
|
|
22550
22857
|
const {
|
|
22551
22858
|
activeIndex,
|
|
@@ -24636,6 +24943,7 @@ export {
|
|
|
24636
24943
|
Chip,
|
|
24637
24944
|
ChipGroup,
|
|
24638
24945
|
Code,
|
|
24946
|
+
CodeBlock,
|
|
24639
24947
|
ConfirmationModal,
|
|
24640
24948
|
DateInput,
|
|
24641
24949
|
DateMenu,
|
|
@@ -24678,7 +24986,6 @@ export {
|
|
|
24678
24986
|
ModalWrapper,
|
|
24679
24987
|
Option,
|
|
24680
24988
|
PageBanner,
|
|
24681
|
-
Pre,
|
|
24682
24989
|
Radio,
|
|
24683
24990
|
RadioGroup,
|
|
24684
24991
|
RadioInput,
|
|
@@ -24714,6 +25021,7 @@ export {
|
|
|
24714
25021
|
isItemMatch,
|
|
24715
25022
|
splitProps,
|
|
24716
25023
|
useChipGroup,
|
|
25024
|
+
useClipboard,
|
|
24717
25025
|
useContainerQuery,
|
|
24718
25026
|
useDrawerContext,
|
|
24719
25027
|
useForm2 as useForm,
|