cetec-design-system 3.5.1-0 → 3.6.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 +314 -39
- package/dist/index.js.map +1 -1
- package/dist/panda.buildinfo.json +15 -4
- package/dist/preset.js +168 -7
- package/dist/preset.js.map +1 -1
- package/dist/specs/keyframes.json +44 -0
- package/dist/specs/recipes.json +37 -0
- package/dist/styles.css +201 -10
- package/dist/types/index.d.ts +207 -1
- package/package.json +1 -1
- package/src/recipes/drawer.ts +150 -0
- package/src/recipes/recipes-slot.ts +1 -0
- package/src/styles/utilities/keyframes.ts +17 -0
package/dist/index.js
CHANGED
|
@@ -984,7 +984,7 @@ const spinnerVariantKeys = [
|
|
|
984
984
|
"inverse",
|
|
985
985
|
"centered"
|
|
986
986
|
];
|
|
987
|
-
const getVariantProps$
|
|
987
|
+
const getVariantProps$u = (variants) => ({ ...spinnerDefaultVariants, ...compact(variants) });
|
|
988
988
|
const spinner = /* @__PURE__ */ Object.assign(spinnerFn, {
|
|
989
989
|
__recipe__: false,
|
|
990
990
|
__name__: "spinner",
|
|
@@ -1009,7 +1009,7 @@ const spinner = /* @__PURE__ */ Object.assign(spinnerFn, {
|
|
|
1009
1009
|
splitVariantProps(props) {
|
|
1010
1010
|
return splitProps$1(props, spinnerVariantKeys);
|
|
1011
1011
|
},
|
|
1012
|
-
getVariantProps: getVariantProps$
|
|
1012
|
+
getVariantProps: getVariantProps$u
|
|
1013
1013
|
});
|
|
1014
1014
|
const tagFn = /* @__PURE__ */ createRecipe("tag", {
|
|
1015
1015
|
"variant": "default",
|
|
@@ -1677,7 +1677,7 @@ const toggleFn = memo((props = {}) => {
|
|
|
1677
1677
|
return Object.fromEntries(toggleSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
1678
1678
|
});
|
|
1679
1679
|
const toggleVariantKeys = [];
|
|
1680
|
-
const getVariantProps$
|
|
1680
|
+
const getVariantProps$t = (variants) => ({ ...toggleDefaultVariants, ...compact(variants) });
|
|
1681
1681
|
const toggle = /* @__PURE__ */ Object.assign(toggleFn, {
|
|
1682
1682
|
__recipe__: false,
|
|
1683
1683
|
__name__: "toggle",
|
|
@@ -1688,7 +1688,7 @@ const toggle = /* @__PURE__ */ Object.assign(toggleFn, {
|
|
|
1688
1688
|
splitVariantProps(props) {
|
|
1689
1689
|
return splitProps$1(props, toggleVariantKeys);
|
|
1690
1690
|
},
|
|
1691
|
-
getVariantProps: getVariantProps$
|
|
1691
|
+
getVariantProps: getVariantProps$t
|
|
1692
1692
|
});
|
|
1693
1693
|
const alertDefaultVariants = {
|
|
1694
1694
|
"tone": "info"
|
|
@@ -1731,7 +1731,7 @@ const alertFn = memo((props = {}) => {
|
|
|
1731
1731
|
const alertVariantKeys = [
|
|
1732
1732
|
"tone"
|
|
1733
1733
|
];
|
|
1734
|
-
const getVariantProps$
|
|
1734
|
+
const getVariantProps$s = (variants) => ({ ...alertDefaultVariants, ...compact(variants) });
|
|
1735
1735
|
const alert = /* @__PURE__ */ Object.assign(alertFn, {
|
|
1736
1736
|
__recipe__: false,
|
|
1737
1737
|
__name__: "alert",
|
|
@@ -1750,7 +1750,7 @@ const alert = /* @__PURE__ */ Object.assign(alertFn, {
|
|
|
1750
1750
|
splitVariantProps(props) {
|
|
1751
1751
|
return splitProps$1(props, alertVariantKeys);
|
|
1752
1752
|
},
|
|
1753
|
-
getVariantProps: getVariantProps$
|
|
1753
|
+
getVariantProps: getVariantProps$s
|
|
1754
1754
|
});
|
|
1755
1755
|
const autocompleteDefaultVariants = {
|
|
1756
1756
|
"size": "md",
|
|
@@ -1807,7 +1807,7 @@ const autocompleteVariantKeys = [
|
|
|
1807
1807
|
"layer",
|
|
1808
1808
|
"size"
|
|
1809
1809
|
];
|
|
1810
|
-
const getVariantProps$
|
|
1810
|
+
const getVariantProps$r = (variants) => ({ ...autocompleteDefaultVariants, ...compact(variants) });
|
|
1811
1811
|
const autocomplete = /* @__PURE__ */ Object.assign(autocompleteFn, {
|
|
1812
1812
|
__recipe__: false,
|
|
1813
1813
|
__name__: "autocomplete",
|
|
@@ -1829,7 +1829,7 @@ const autocomplete = /* @__PURE__ */ Object.assign(autocompleteFn, {
|
|
|
1829
1829
|
splitVariantProps(props) {
|
|
1830
1830
|
return splitProps$1(props, autocompleteVariantKeys);
|
|
1831
1831
|
},
|
|
1832
|
-
getVariantProps: getVariantProps$
|
|
1832
|
+
getVariantProps: getVariantProps$r
|
|
1833
1833
|
});
|
|
1834
1834
|
const avatarDefaultVariants = {
|
|
1835
1835
|
"size": "md",
|
|
@@ -1866,7 +1866,7 @@ const avatarVariantKeys = [
|
|
|
1866
1866
|
"size",
|
|
1867
1867
|
"shape"
|
|
1868
1868
|
];
|
|
1869
|
-
const getVariantProps$
|
|
1869
|
+
const getVariantProps$q = (variants) => ({ ...avatarDefaultVariants, ...compact(variants) });
|
|
1870
1870
|
const avatar = /* @__PURE__ */ Object.assign(avatarFn, {
|
|
1871
1871
|
__recipe__: false,
|
|
1872
1872
|
__name__: "avatar",
|
|
@@ -1891,7 +1891,7 @@ const avatar = /* @__PURE__ */ Object.assign(avatarFn, {
|
|
|
1891
1891
|
splitVariantProps(props) {
|
|
1892
1892
|
return splitProps$1(props, avatarVariantKeys);
|
|
1893
1893
|
},
|
|
1894
|
-
getVariantProps: getVariantProps$
|
|
1894
|
+
getVariantProps: getVariantProps$q
|
|
1895
1895
|
});
|
|
1896
1896
|
const badgeDefaultVariants = {
|
|
1897
1897
|
"size": "md",
|
|
@@ -1918,7 +1918,7 @@ const badgeVariantKeys = [
|
|
|
1918
1918
|
"dot",
|
|
1919
1919
|
"variant"
|
|
1920
1920
|
];
|
|
1921
|
-
const getVariantProps$
|
|
1921
|
+
const getVariantProps$p = (variants) => ({ ...badgeDefaultVariants, ...compact(variants) });
|
|
1922
1922
|
const badge = /* @__PURE__ */ Object.assign(badgeFn, {
|
|
1923
1923
|
__recipe__: false,
|
|
1924
1924
|
__name__: "badge",
|
|
@@ -1954,7 +1954,7 @@ const badge = /* @__PURE__ */ Object.assign(badgeFn, {
|
|
|
1954
1954
|
splitVariantProps(props) {
|
|
1955
1955
|
return splitProps$1(props, badgeVariantKeys);
|
|
1956
1956
|
},
|
|
1957
|
-
getVariantProps: getVariantProps$
|
|
1957
|
+
getVariantProps: getVariantProps$p
|
|
1958
1958
|
});
|
|
1959
1959
|
const breadcrumbsDefaultVariants = {};
|
|
1960
1960
|
const breadcrumbsCompoundVariants = [];
|
|
@@ -1981,7 +1981,7 @@ const breadcrumbsFn = memo((props = {}) => {
|
|
|
1981
1981
|
return Object.fromEntries(breadcrumbsSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
1982
1982
|
});
|
|
1983
1983
|
const breadcrumbsVariantKeys = [];
|
|
1984
|
-
const getVariantProps$
|
|
1984
|
+
const getVariantProps$o = (variants) => ({ ...breadcrumbsDefaultVariants, ...compact(variants) });
|
|
1985
1985
|
const breadcrumbs = /* @__PURE__ */ Object.assign(breadcrumbsFn, {
|
|
1986
1986
|
__recipe__: false,
|
|
1987
1987
|
__name__: "breadcrumbs",
|
|
@@ -1992,7 +1992,7 @@ const breadcrumbs = /* @__PURE__ */ Object.assign(breadcrumbsFn, {
|
|
|
1992
1992
|
splitVariantProps(props) {
|
|
1993
1993
|
return splitProps$1(props, breadcrumbsVariantKeys);
|
|
1994
1994
|
},
|
|
1995
|
-
getVariantProps: getVariantProps$
|
|
1995
|
+
getVariantProps: getVariantProps$o
|
|
1996
1996
|
});
|
|
1997
1997
|
const buttonDefaultVariants = {
|
|
1998
1998
|
"variant": "standard",
|
|
@@ -2023,7 +2023,7 @@ const buttonVariantKeys = [
|
|
|
2023
2023
|
"before",
|
|
2024
2024
|
"after"
|
|
2025
2025
|
];
|
|
2026
|
-
const getVariantProps$
|
|
2026
|
+
const getVariantProps$n = (variants) => ({ ...buttonDefaultVariants, ...compact(variants) });
|
|
2027
2027
|
const button = /* @__PURE__ */ Object.assign(buttonFn, {
|
|
2028
2028
|
__recipe__: false,
|
|
2029
2029
|
__name__: "button",
|
|
@@ -2057,7 +2057,7 @@ const button = /* @__PURE__ */ Object.assign(buttonFn, {
|
|
|
2057
2057
|
splitVariantProps(props) {
|
|
2058
2058
|
return splitProps$1(props, buttonVariantKeys);
|
|
2059
2059
|
},
|
|
2060
|
-
getVariantProps: getVariantProps$
|
|
2060
|
+
getVariantProps: getVariantProps$n
|
|
2061
2061
|
});
|
|
2062
2062
|
const calendarDefaultVariants = {
|
|
2063
2063
|
"type": "days"
|
|
@@ -2096,7 +2096,7 @@ const calendarFn = memo((props = {}) => {
|
|
|
2096
2096
|
const calendarVariantKeys = [
|
|
2097
2097
|
"type"
|
|
2098
2098
|
];
|
|
2099
|
-
const getVariantProps$
|
|
2099
|
+
const getVariantProps$m = (variants) => ({ ...calendarDefaultVariants, ...compact(variants) });
|
|
2100
2100
|
const calendar = /* @__PURE__ */ Object.assign(calendarFn, {
|
|
2101
2101
|
__recipe__: false,
|
|
2102
2102
|
__name__: "calendar",
|
|
@@ -2113,7 +2113,7 @@ const calendar = /* @__PURE__ */ Object.assign(calendarFn, {
|
|
|
2113
2113
|
splitVariantProps(props) {
|
|
2114
2114
|
return splitProps$1(props, calendarVariantKeys);
|
|
2115
2115
|
},
|
|
2116
|
-
getVariantProps: getVariantProps$
|
|
2116
|
+
getVariantProps: getVariantProps$m
|
|
2117
2117
|
});
|
|
2118
2118
|
const checkboxDefaultVariants = {};
|
|
2119
2119
|
const checkboxCompoundVariants = [];
|
|
@@ -2140,7 +2140,7 @@ const checkboxFn = memo((props = {}) => {
|
|
|
2140
2140
|
return Object.fromEntries(checkboxSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2141
2141
|
});
|
|
2142
2142
|
const checkboxVariantKeys = [];
|
|
2143
|
-
const getVariantProps$
|
|
2143
|
+
const getVariantProps$l = (variants) => ({ ...checkboxDefaultVariants, ...compact(variants) });
|
|
2144
2144
|
const checkbox = /* @__PURE__ */ Object.assign(checkboxFn, {
|
|
2145
2145
|
__recipe__: false,
|
|
2146
2146
|
__name__: "checkbox",
|
|
@@ -2151,7 +2151,7 @@ const checkbox = /* @__PURE__ */ Object.assign(checkboxFn, {
|
|
|
2151
2151
|
splitVariantProps(props) {
|
|
2152
2152
|
return splitProps$1(props, checkboxVariantKeys);
|
|
2153
2153
|
},
|
|
2154
|
-
getVariantProps: getVariantProps$
|
|
2154
|
+
getVariantProps: getVariantProps$l
|
|
2155
2155
|
});
|
|
2156
2156
|
const chipDefaultVariants = {
|
|
2157
2157
|
"size": "md"
|
|
@@ -2189,7 +2189,7 @@ const chipVariantKeys = [
|
|
|
2189
2189
|
"after",
|
|
2190
2190
|
"dismissable"
|
|
2191
2191
|
];
|
|
2192
|
-
const getVariantProps$
|
|
2192
|
+
const getVariantProps$k = (variants) => ({ ...chipDefaultVariants, ...compact(variants) });
|
|
2193
2193
|
const chip = /* @__PURE__ */ Object.assign(chipFn, {
|
|
2194
2194
|
__recipe__: false,
|
|
2195
2195
|
__name__: "chip",
|
|
@@ -2216,7 +2216,7 @@ const chip = /* @__PURE__ */ Object.assign(chipFn, {
|
|
|
2216
2216
|
splitVariantProps(props) {
|
|
2217
2217
|
return splitProps$1(props, chipVariantKeys);
|
|
2218
2218
|
},
|
|
2219
|
-
getVariantProps: getVariantProps$
|
|
2219
|
+
getVariantProps: getVariantProps$k
|
|
2220
2220
|
});
|
|
2221
2221
|
const dateMenusDefaultVariants = {};
|
|
2222
2222
|
const dateMenusCompoundVariants = [];
|
|
@@ -2239,7 +2239,7 @@ const dateMenusFn = memo((props = {}) => {
|
|
|
2239
2239
|
return Object.fromEntries(dateMenusSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2240
2240
|
});
|
|
2241
2241
|
const dateMenusVariantKeys = [];
|
|
2242
|
-
const getVariantProps$
|
|
2242
|
+
const getVariantProps$j = (variants) => ({ ...dateMenusDefaultVariants, ...compact(variants) });
|
|
2243
2243
|
const dateMenus = /* @__PURE__ */ Object.assign(dateMenusFn, {
|
|
2244
2244
|
__recipe__: false,
|
|
2245
2245
|
__name__: "dateMenus",
|
|
@@ -2250,7 +2250,7 @@ const dateMenus = /* @__PURE__ */ Object.assign(dateMenusFn, {
|
|
|
2250
2250
|
splitVariantProps(props) {
|
|
2251
2251
|
return splitProps$1(props, dateMenusVariantKeys);
|
|
2252
2252
|
},
|
|
2253
|
-
getVariantProps: getVariantProps$
|
|
2253
|
+
getVariantProps: getVariantProps$j
|
|
2254
2254
|
});
|
|
2255
2255
|
const dateTimeMenusDefaultVariants = {};
|
|
2256
2256
|
const dateTimeMenusCompoundVariants = [];
|
|
@@ -2273,7 +2273,7 @@ const dateTimeMenusFn = memo((props = {}) => {
|
|
|
2273
2273
|
return Object.fromEntries(dateTimeMenusSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2274
2274
|
});
|
|
2275
2275
|
const dateTimeMenusVariantKeys = [];
|
|
2276
|
-
const getVariantProps$
|
|
2276
|
+
const getVariantProps$i = (variants) => ({ ...dateTimeMenusDefaultVariants, ...compact(variants) });
|
|
2277
2277
|
const dateTimeMenus = /* @__PURE__ */ Object.assign(dateTimeMenusFn, {
|
|
2278
2278
|
__recipe__: false,
|
|
2279
2279
|
__name__: "dateTimeMenus",
|
|
@@ -2284,6 +2284,80 @@ const dateTimeMenus = /* @__PURE__ */ Object.assign(dateTimeMenusFn, {
|
|
|
2284
2284
|
splitVariantProps(props) {
|
|
2285
2285
|
return splitProps$1(props, dateTimeMenusVariantKeys);
|
|
2286
2286
|
},
|
|
2287
|
+
getVariantProps: getVariantProps$i
|
|
2288
|
+
});
|
|
2289
|
+
const drawerDefaultVariants = {
|
|
2290
|
+
"side": "right",
|
|
2291
|
+
"size": "md",
|
|
2292
|
+
"scrollable": true
|
|
2293
|
+
};
|
|
2294
|
+
const drawerCompoundVariants = [];
|
|
2295
|
+
const drawerSlotNames = [
|
|
2296
|
+
[
|
|
2297
|
+
"overlay",
|
|
2298
|
+
"drawer__overlay"
|
|
2299
|
+
],
|
|
2300
|
+
[
|
|
2301
|
+
"container",
|
|
2302
|
+
"drawer__container"
|
|
2303
|
+
],
|
|
2304
|
+
[
|
|
2305
|
+
"header",
|
|
2306
|
+
"drawer__header"
|
|
2307
|
+
],
|
|
2308
|
+
[
|
|
2309
|
+
"title",
|
|
2310
|
+
"drawer__title"
|
|
2311
|
+
],
|
|
2312
|
+
[
|
|
2313
|
+
"closeButton",
|
|
2314
|
+
"drawer__closeButton"
|
|
2315
|
+
],
|
|
2316
|
+
[
|
|
2317
|
+
"body",
|
|
2318
|
+
"drawer__body"
|
|
2319
|
+
],
|
|
2320
|
+
[
|
|
2321
|
+
"footer",
|
|
2322
|
+
"drawer__footer"
|
|
2323
|
+
]
|
|
2324
|
+
];
|
|
2325
|
+
const drawerSlotFns = /* @__PURE__ */ drawerSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, drawerDefaultVariants, getSlotCompoundVariant(drawerCompoundVariants, slotName))]);
|
|
2326
|
+
const drawerFn = memo((props = {}) => {
|
|
2327
|
+
return Object.fromEntries(drawerSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
2328
|
+
});
|
|
2329
|
+
const drawerVariantKeys = [
|
|
2330
|
+
"side",
|
|
2331
|
+
"size",
|
|
2332
|
+
"scrollable"
|
|
2333
|
+
];
|
|
2334
|
+
const getVariantProps$h = (variants) => ({ ...drawerDefaultVariants, ...compact(variants) });
|
|
2335
|
+
const drawer = /* @__PURE__ */ Object.assign(drawerFn, {
|
|
2336
|
+
__recipe__: false,
|
|
2337
|
+
__name__: "drawer",
|
|
2338
|
+
raw: (props) => props,
|
|
2339
|
+
classNameMap: {},
|
|
2340
|
+
variantKeys: drawerVariantKeys,
|
|
2341
|
+
variantMap: {
|
|
2342
|
+
"side": [
|
|
2343
|
+
"right",
|
|
2344
|
+
"left"
|
|
2345
|
+
],
|
|
2346
|
+
"size": [
|
|
2347
|
+
"sm",
|
|
2348
|
+
"md",
|
|
2349
|
+
"lg",
|
|
2350
|
+
"xl",
|
|
2351
|
+
"full"
|
|
2352
|
+
],
|
|
2353
|
+
"scrollable": [
|
|
2354
|
+
"true",
|
|
2355
|
+
"false"
|
|
2356
|
+
]
|
|
2357
|
+
},
|
|
2358
|
+
splitVariantProps(props) {
|
|
2359
|
+
return splitProps$1(props, drawerVariantKeys);
|
|
2360
|
+
},
|
|
2287
2361
|
getVariantProps: getVariantProps$h
|
|
2288
2362
|
});
|
|
2289
2363
|
const formFieldDefaultVariants = {
|
|
@@ -21513,6 +21587,216 @@ const DateTimeRangePicker = (props) => {
|
|
|
21513
21587
|
}
|
|
21514
21588
|
);
|
|
21515
21589
|
};
|
|
21590
|
+
const DrawerContext = createContext(null);
|
|
21591
|
+
const useDrawerContext = () => {
|
|
21592
|
+
const context2 = useContext(DrawerContext);
|
|
21593
|
+
if (!context2) {
|
|
21594
|
+
throw new Error("Drawer components must be used within a <Drawer>");
|
|
21595
|
+
}
|
|
21596
|
+
return context2;
|
|
21597
|
+
};
|
|
21598
|
+
const DRAWER_MOTION_MS = 200;
|
|
21599
|
+
const drawerPhaseReducer = (phase, action) => {
|
|
21600
|
+
switch (action.type) {
|
|
21601
|
+
case "open":
|
|
21602
|
+
return "open";
|
|
21603
|
+
case "startClosing":
|
|
21604
|
+
return phase === "closed" ? phase : "closing";
|
|
21605
|
+
case "finishClosing":
|
|
21606
|
+
return "closed";
|
|
21607
|
+
default:
|
|
21608
|
+
return phase;
|
|
21609
|
+
}
|
|
21610
|
+
};
|
|
21611
|
+
const prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
21612
|
+
const Drawer = (props) => {
|
|
21613
|
+
const {
|
|
21614
|
+
open,
|
|
21615
|
+
onOpenChange,
|
|
21616
|
+
modal: modal2 = true,
|
|
21617
|
+
side = "right",
|
|
21618
|
+
size: size2 = "md",
|
|
21619
|
+
preventOutsideClose = false,
|
|
21620
|
+
initialFocus,
|
|
21621
|
+
returnFocus = true,
|
|
21622
|
+
children,
|
|
21623
|
+
id,
|
|
21624
|
+
ref,
|
|
21625
|
+
onKeyDown,
|
|
21626
|
+
onAnimationEnd,
|
|
21627
|
+
...rest
|
|
21628
|
+
} = props;
|
|
21629
|
+
const [className, otherProps] = splitProps(rest);
|
|
21630
|
+
const classes = drawer({ side, size: size2 });
|
|
21631
|
+
const [phase, dispatch] = useReducer(
|
|
21632
|
+
drawerPhaseReducer,
|
|
21633
|
+
open ? "open" : "closed"
|
|
21634
|
+
);
|
|
21635
|
+
const panelRef = useRef(null);
|
|
21636
|
+
const { refs, context: context2 } = useOverlayFloating({
|
|
21637
|
+
open,
|
|
21638
|
+
onOpenChange,
|
|
21639
|
+
strategy: "fixed",
|
|
21640
|
+
middleware: []
|
|
21641
|
+
});
|
|
21642
|
+
const dismiss = useDismiss(context2, {
|
|
21643
|
+
escapeKey: modal2,
|
|
21644
|
+
outsidePress: modal2 && !preventOutsideClose
|
|
21645
|
+
});
|
|
21646
|
+
const { getFloatingProps } = useInteractions([dismiss]);
|
|
21647
|
+
useEffect(() => {
|
|
21648
|
+
if (open) {
|
|
21649
|
+
dispatch({ type: "open" });
|
|
21650
|
+
return;
|
|
21651
|
+
}
|
|
21652
|
+
dispatch({ type: "startClosing" });
|
|
21653
|
+
const timeout = setTimeout(
|
|
21654
|
+
() => dispatch({ type: "finishClosing" }),
|
|
21655
|
+
prefersReducedMotion() ? 0 : DRAWER_MOTION_MS
|
|
21656
|
+
);
|
|
21657
|
+
return () => clearTimeout(timeout);
|
|
21658
|
+
}, [open]);
|
|
21659
|
+
const setPanelRef = useCallback(
|
|
21660
|
+
(node) => {
|
|
21661
|
+
panelRef.current = node;
|
|
21662
|
+
refs.setFloating(node);
|
|
21663
|
+
},
|
|
21664
|
+
[refs]
|
|
21665
|
+
);
|
|
21666
|
+
const mergedPanelRef = useMergeRefs([setPanelRef, ref]);
|
|
21667
|
+
const onClose = useCallback(() => {
|
|
21668
|
+
if (open) {
|
|
21669
|
+
onOpenChange(false);
|
|
21670
|
+
}
|
|
21671
|
+
}, [open, onOpenChange]);
|
|
21672
|
+
const handleKeyDown = (event) => {
|
|
21673
|
+
var _a;
|
|
21674
|
+
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
21675
|
+
if (modal2 || event.key !== "Escape" || event.defaultPrevented) {
|
|
21676
|
+
return;
|
|
21677
|
+
}
|
|
21678
|
+
if (event.nativeEvent.isComposing) {
|
|
21679
|
+
return;
|
|
21680
|
+
}
|
|
21681
|
+
if (!((_a = panelRef.current) == null ? void 0 : _a.contains(event.target))) {
|
|
21682
|
+
return;
|
|
21683
|
+
}
|
|
21684
|
+
event.stopPropagation();
|
|
21685
|
+
onClose();
|
|
21686
|
+
};
|
|
21687
|
+
const contextValue = useMemo(
|
|
21688
|
+
() => ({ open: phase === "open", onClose, modal: modal2 }),
|
|
21689
|
+
[modal2, onClose, phase]
|
|
21690
|
+
);
|
|
21691
|
+
if (phase === "closed") {
|
|
21692
|
+
return null;
|
|
21693
|
+
}
|
|
21694
|
+
const dataState = phase === "closing" ? "closing" : "open";
|
|
21695
|
+
return /* @__PURE__ */ jsx(FloatingLayerContext.Provider, { value: "modalFloating", children: /* @__PURE__ */ jsx(DrawerContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsxs(DsChainPortalRoot, { children: [
|
|
21696
|
+
modal2 && /* @__PURE__ */ jsx(
|
|
21697
|
+
FloatingOverlay,
|
|
21698
|
+
{
|
|
21699
|
+
lockScroll: true,
|
|
21700
|
+
className: classes.overlay,
|
|
21701
|
+
"data-state": dataState,
|
|
21702
|
+
"aria-hidden": "true"
|
|
21703
|
+
}
|
|
21704
|
+
),
|
|
21705
|
+
/* @__PURE__ */ jsx(
|
|
21706
|
+
FloatingFocusManager,
|
|
21707
|
+
{
|
|
21708
|
+
context: context2,
|
|
21709
|
+
modal: modal2,
|
|
21710
|
+
initialFocus: initialFocus ?? (modal2 ? 0 : panelRef),
|
|
21711
|
+
returnFocus,
|
|
21712
|
+
closeOnFocusOut: false,
|
|
21713
|
+
children: /* @__PURE__ */ jsx(
|
|
21714
|
+
Box,
|
|
21715
|
+
{
|
|
21716
|
+
...dsComponent("Drawer"),
|
|
21717
|
+
ref: mergedPanelRef,
|
|
21718
|
+
className: cx(classes.container, className),
|
|
21719
|
+
"data-state": dataState,
|
|
21720
|
+
"data-side": side,
|
|
21721
|
+
id,
|
|
21722
|
+
role: "dialog",
|
|
21723
|
+
"aria-modal": modal2 ? "true" : void 0,
|
|
21724
|
+
...getFloatingProps({
|
|
21725
|
+
// Consumer props go through Floating UI so its handlers
|
|
21726
|
+
// merge with them instead of being overwritten.
|
|
21727
|
+
...otherProps,
|
|
21728
|
+
onKeyDown: handleKeyDown,
|
|
21729
|
+
onAnimationEnd: (event) => {
|
|
21730
|
+
onAnimationEnd == null ? void 0 : onAnimationEnd(event);
|
|
21731
|
+
if (phase === "closing" && event.target === event.currentTarget) {
|
|
21732
|
+
dispatch({ type: "finishClosing" });
|
|
21733
|
+
}
|
|
21734
|
+
}
|
|
21735
|
+
}),
|
|
21736
|
+
children
|
|
21737
|
+
}
|
|
21738
|
+
)
|
|
21739
|
+
}
|
|
21740
|
+
)
|
|
21741
|
+
] }) }) }) });
|
|
21742
|
+
};
|
|
21743
|
+
const Heading = (props) => {
|
|
21744
|
+
const { level = "h2", allCaps, children, ...rest } = props;
|
|
21745
|
+
const [className, otherProps] = splitProps(rest);
|
|
21746
|
+
return /* @__PURE__ */ jsx(
|
|
21747
|
+
Text,
|
|
21748
|
+
{
|
|
21749
|
+
...dsComponent("Heading"),
|
|
21750
|
+
as: level,
|
|
21751
|
+
className: cx(heading({ level, allCaps }), className),
|
|
21752
|
+
...otherProps,
|
|
21753
|
+
children
|
|
21754
|
+
}
|
|
21755
|
+
);
|
|
21756
|
+
};
|
|
21757
|
+
const DrawerHeader = (props) => {
|
|
21758
|
+
const { title, titleId, showCloseButton = true, children, ...rest } = props;
|
|
21759
|
+
const [className, otherProps] = splitProps(rest);
|
|
21760
|
+
const classes = drawer();
|
|
21761
|
+
const { onClose } = useDrawerContext();
|
|
21762
|
+
const isSm = useMediaQuery("sm");
|
|
21763
|
+
return /* @__PURE__ */ jsx(Box, { className: cx(classes.header, className), ...otherProps, children: children ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21764
|
+
title && /* @__PURE__ */ jsx(
|
|
21765
|
+
Heading,
|
|
21766
|
+
{
|
|
21767
|
+
id: titleId,
|
|
21768
|
+
level: "h3",
|
|
21769
|
+
textStyle: { base: "heading.sm", sm: "heading.xs" },
|
|
21770
|
+
className: classes.title,
|
|
21771
|
+
children: title
|
|
21772
|
+
}
|
|
21773
|
+
),
|
|
21774
|
+
showCloseButton && /* @__PURE__ */ jsx(
|
|
21775
|
+
IconButton,
|
|
21776
|
+
{
|
|
21777
|
+
variant: "ghost",
|
|
21778
|
+
size: isSm ? "md" : "lg",
|
|
21779
|
+
onClick: onClose,
|
|
21780
|
+
altText: "Close drawer",
|
|
21781
|
+
"aria-label": "Close drawer",
|
|
21782
|
+
className: classes.closeButton,
|
|
21783
|
+
iconName: "x"
|
|
21784
|
+
}
|
|
21785
|
+
)
|
|
21786
|
+
] }) });
|
|
21787
|
+
};
|
|
21788
|
+
const DrawerBody = (props) => {
|
|
21789
|
+
const { children, scrollable = true, ...rest } = props;
|
|
21790
|
+
const [className, otherProps] = splitProps(rest);
|
|
21791
|
+
const classes = drawer({ scrollable });
|
|
21792
|
+
return /* @__PURE__ */ jsx(Box, { className: cx(classes.body, className), ...otherProps, children });
|
|
21793
|
+
};
|
|
21794
|
+
const DrawerFooter = (props) => {
|
|
21795
|
+
const { children, ...rest } = props;
|
|
21796
|
+
const [className, otherProps] = splitProps(rest);
|
|
21797
|
+
const classes = drawer();
|
|
21798
|
+
return /* @__PURE__ */ jsx(Box, { className: cx(classes.footer, className), ...otherProps, children });
|
|
21799
|
+
};
|
|
21516
21800
|
const Required = () => {
|
|
21517
21801
|
return /* @__PURE__ */ jsx(Text, { color: "text.danger", fontSize: "inherit", lineHeight: "tight", children: "*" });
|
|
21518
21802
|
};
|
|
@@ -21599,20 +21883,6 @@ const FormField = (props) => {
|
|
|
21599
21883
|
}
|
|
21600
21884
|
);
|
|
21601
21885
|
};
|
|
21602
|
-
const Heading = (props) => {
|
|
21603
|
-
const { level = "h2", allCaps, children, ...rest } = props;
|
|
21604
|
-
const [className, otherProps] = splitProps(rest);
|
|
21605
|
-
return /* @__PURE__ */ jsx(
|
|
21606
|
-
Text,
|
|
21607
|
-
{
|
|
21608
|
-
...dsComponent("Heading"),
|
|
21609
|
-
as: level,
|
|
21610
|
-
className: cx(heading({ level, allCaps }), className),
|
|
21611
|
-
...otherProps,
|
|
21612
|
-
children
|
|
21613
|
-
}
|
|
21614
|
-
);
|
|
21615
|
-
};
|
|
21616
21886
|
const toneIconNames$2 = {
|
|
21617
21887
|
info: "info",
|
|
21618
21888
|
success: "success",
|
|
@@ -24378,6 +24648,10 @@ export {
|
|
|
24378
24648
|
DateTimePicker,
|
|
24379
24649
|
DateTimeRangePicker,
|
|
24380
24650
|
Divider,
|
|
24651
|
+
Drawer,
|
|
24652
|
+
DrawerBody,
|
|
24653
|
+
DrawerFooter,
|
|
24654
|
+
DrawerHeader,
|
|
24381
24655
|
DsChainScope,
|
|
24382
24656
|
FormField,
|
|
24383
24657
|
Heading,
|
|
@@ -24441,6 +24715,7 @@ export {
|
|
|
24441
24715
|
splitProps,
|
|
24442
24716
|
useChipGroup,
|
|
24443
24717
|
useContainerQuery,
|
|
24718
|
+
useDrawerContext,
|
|
24444
24719
|
useForm2 as useForm,
|
|
24445
24720
|
useIconConfig,
|
|
24446
24721
|
useListContext,
|