cetec-design-system 3.5.0-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 CHANGED
@@ -984,7 +984,7 @@ const spinnerVariantKeys = [
984
984
  "inverse",
985
985
  "centered"
986
986
  ];
987
- const getVariantProps$t = (variants) => ({ ...spinnerDefaultVariants, ...compact(variants) });
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$t
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$s = (variants) => ({ ...toggleDefaultVariants, ...compact(variants) });
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$s
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$r = (variants) => ({ ...alertDefaultVariants, ...compact(variants) });
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$r
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$q = (variants) => ({ ...autocompleteDefaultVariants, ...compact(variants) });
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$q
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$p = (variants) => ({ ...avatarDefaultVariants, ...compact(variants) });
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$p
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$o = (variants) => ({ ...badgeDefaultVariants, ...compact(variants) });
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$o
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$n = (variants) => ({ ...breadcrumbsDefaultVariants, ...compact(variants) });
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$n
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$m = (variants) => ({ ...buttonDefaultVariants, ...compact(variants) });
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$m
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$l = (variants) => ({ ...calendarDefaultVariants, ...compact(variants) });
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$l
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$k = (variants) => ({ ...checkboxDefaultVariants, ...compact(variants) });
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$k
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$j = (variants) => ({ ...chipDefaultVariants, ...compact(variants) });
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$j
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$i = (variants) => ({ ...dateMenusDefaultVariants, ...compact(variants) });
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$i
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$h = (variants) => ({ ...dateTimeMenusDefaultVariants, ...compact(variants) });
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 = {
@@ -18338,6 +18412,52 @@ const hasMatchingItems = (children, filterContext) => {
18338
18412
  return true;
18339
18413
  });
18340
18414
  };
18415
+ const findSubMenuKeyPath = (children, target, trail = []) => {
18416
+ for (const childNode of Children.toArray(children)) {
18417
+ if (!isValidElement(childNode)) {
18418
+ continue;
18419
+ }
18420
+ const child = childNode;
18421
+ const componentType = getComponentType(child);
18422
+ const nextTrail = [...trail, String(child.key)];
18423
+ if (componentType === MENU_COMPONENT_TYPES.subMenu) {
18424
+ if (child.props.children === target) {
18425
+ return nextTrail;
18426
+ }
18427
+ const nested = findSubMenuKeyPath(
18428
+ child.props.children,
18429
+ target,
18430
+ nextTrail
18431
+ );
18432
+ if (nested) {
18433
+ return nested;
18434
+ }
18435
+ } else if (componentType === MENU_COMPONENT_TYPES.group) {
18436
+ const nested = findSubMenuKeyPath(
18437
+ child.props.children,
18438
+ target,
18439
+ nextTrail
18440
+ );
18441
+ if (nested) {
18442
+ return nested;
18443
+ }
18444
+ }
18445
+ }
18446
+ return null;
18447
+ };
18448
+ const findSubMenuChildren = (children, keyPath) => {
18449
+ const [key, ...rest] = keyPath;
18450
+ if (key === void 0) {
18451
+ return children;
18452
+ }
18453
+ const match = Children.toArray(children).find(
18454
+ (childNode) => isValidElement(childNode) && String(childNode.key) === key
18455
+ );
18456
+ if (!match) {
18457
+ return void 0;
18458
+ }
18459
+ return findSubMenuChildren(match.props.children, rest);
18460
+ };
18341
18461
  const getHighlightedTextParts = (value, query) => {
18342
18462
  if (!query.trim()) {
18343
18463
  return [{ text: value, match: false }];
@@ -18402,6 +18522,8 @@ function navigateListMainAxisLoop(listRef, direction, previousIndex) {
18402
18522
  }
18403
18523
  return previousIndex ?? null;
18404
18524
  }
18525
+ const focusableInLevelSelector = 'input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href],[tabindex]:not([tabindex="-1"])';
18526
+ const isTextEntryTarget = (target) => target instanceof HTMLElement && (target.isContentEditable || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement || target instanceof HTMLInputElement && !["button", "checkbox", "submit", "reset"].includes(target.type));
18405
18527
  const defaultGetItemText = ({
18406
18528
  label: label2,
18407
18529
  description
@@ -18509,6 +18631,7 @@ const Menu = (props) => {
18509
18631
  }
18510
18632
  onOpenChange == null ? void 0 : onOpenChange(nextOpen);
18511
18633
  };
18634
+ const diginFocusIntentRef = useRef(null);
18512
18635
  const [diginLevels, setDiginLevels] = useState([]);
18513
18636
  const [wrapperSize, setWrapperSize] = useState({
18514
18637
  width: null,
@@ -18551,7 +18674,10 @@ const Menu = (props) => {
18551
18674
  const focus = useFocus(floating.context, {
18552
18675
  enabled: hasReference && triggerInteraction === "focus"
18553
18676
  });
18554
- const dismiss = useDismiss(floating.context, { enabled: hasReference });
18677
+ const dismiss = useDismiss(floating.context, {
18678
+ enabled: hasReference,
18679
+ escapeKey: diginDepth === 0
18680
+ });
18555
18681
  const role = useRole(floating.context, { role: "menu" });
18556
18682
  const listNavigation = useListNavigation(floating.context, {
18557
18683
  listRef,
@@ -18577,7 +18703,11 @@ const Menu = (props) => {
18577
18703
  }),
18578
18704
  [filterMode, getItemText, highlightMatches, query]
18579
18705
  );
18580
- const activeLevelChildren = ((_a = diginLevels[diginLevels.length - 1]) == null ? void 0 : _a.children) ?? children;
18706
+ const liveDiginLevels = diginLevels.map((level) => ({
18707
+ ...level,
18708
+ children: (level.path && findSubMenuChildren(children, level.path)) ?? level.children
18709
+ }));
18710
+ const activeLevelChildren = ((_a = liveDiginLevels[liveDiginLevels.length - 1]) == null ? void 0 : _a.children) ?? children;
18581
18711
  const hasVisibleResults = hasMatchingItems(
18582
18712
  activeLevelChildren,
18583
18713
  filterContextValue
@@ -18593,6 +18723,8 @@ const Menu = (props) => {
18593
18723
  setDiginLevels([]);
18594
18724
  },
18595
18725
  onPushDiginLevel: (title, levelChildren) => {
18726
+ const returnIndex = activeIndex;
18727
+ diginFocusIntentRef.current = "first";
18596
18728
  setDiginLevels((prev) => {
18597
18729
  const activeLevel2 = prev[prev.length - 1];
18598
18730
  if (activeLevel2 && activeLevel2.title === title && activeLevel2.children === levelChildren) {
@@ -18603,29 +18735,169 @@ const Menu = (props) => {
18603
18735
  {
18604
18736
  key: `${title}-${prev.length}`,
18605
18737
  title,
18606
- children: levelChildren
18738
+ children: levelChildren,
18739
+ returnIndex,
18740
+ path: findSubMenuKeyPath(children, levelChildren)
18607
18741
  }
18608
18742
  ];
18609
18743
  });
18610
18744
  },
18611
18745
  onPopDiginLevel: () => {
18746
+ const poppedLevel = diginLevels[diginLevels.length - 1];
18747
+ if (!poppedLevel) {
18748
+ return;
18749
+ }
18750
+ diginFocusIntentRef.current = { index: poppedLevel.returnIndex };
18612
18751
  setDiginLevels((prev) => prev.slice(0, -1));
18613
18752
  },
18614
18753
  diginDepth,
18615
18754
  onMenubarEdgeNavigate
18616
18755
  };
18756
+ useEffect(() => {
18757
+ const intent = diginFocusIntentRef.current;
18758
+ if (!intent) {
18759
+ return;
18760
+ }
18761
+ diginFocusIntentRef.current = null;
18762
+ setActiveIndex(null);
18763
+ let timer;
18764
+ const focusLevel = (attemptsLeft) => {
18765
+ var _a2;
18766
+ const levelElement = activeLevelRef.current;
18767
+ const index2 = intent === "first" ? findFirstEnabledListIndex(listRef) : intent.index;
18768
+ const item = index2 === null ? null : listRef.current[index2];
18769
+ if (item && item.isConnected && (levelElement == null ? void 0 : levelElement.contains(item)) && !item.hasAttribute("disabled")) {
18770
+ item.focus({ preventScroll: true });
18771
+ (_a2 = item.scrollIntoView) == null ? void 0 : _a2.call(item, { block: "nearest" });
18772
+ setActiveIndex(index2);
18773
+ return;
18774
+ }
18775
+ if (attemptsLeft > 0) {
18776
+ timer = setTimeout(() => focusLevel(attemptsLeft - 1), 16);
18777
+ return;
18778
+ }
18779
+ const focusables = Array.from(
18780
+ (levelElement == null ? void 0 : levelElement.querySelectorAll(focusableInLevelSelector)) ?? []
18781
+ );
18782
+ const fallback = focusables.find((element) => !element.matches("[data-menu-back]")) ?? focusables[0];
18783
+ fallback == null ? void 0 : fallback.focus({ preventScroll: true });
18784
+ };
18785
+ timer = setTimeout(() => focusLevel(3), 0);
18786
+ return () => {
18787
+ clearTimeout(timer);
18788
+ };
18789
+ }, [diginDepth]);
18790
+ const keepsFocusOnTrigger = Boolean(onMenubarEdgeNavigate) || triggerInteraction === "focus";
18791
+ useEffect(() => {
18792
+ if (!hasReference || !isOpen || activeIndex === null || keepsFocusOnTrigger) {
18793
+ return;
18794
+ }
18795
+ const timer = setTimeout(() => {
18796
+ const referenceElement = floating.elements.domReference;
18797
+ const floatingElement = floating.elements.floating;
18798
+ const activeElement2 = document.activeElement;
18799
+ const focusIsStranded = Boolean(referenceElement) && (activeElement2 === referenceElement || activeElement2 === document.body);
18800
+ const item = listRef.current[activeIndex];
18801
+ if (focusIsStranded && (item == null ? void 0 : item.isConnected) && (floatingElement == null ? void 0 : floatingElement.contains(item))) {
18802
+ item.focus({ preventScroll: true });
18803
+ }
18804
+ }, 50);
18805
+ return () => {
18806
+ clearTimeout(timer);
18807
+ };
18808
+ }, [
18809
+ activeIndex,
18810
+ floating.elements.domReference,
18811
+ floating.elements.floating,
18812
+ hasReference,
18813
+ isOpen,
18814
+ keepsFocusOnTrigger
18815
+ ]);
18816
+ const isComposingRef = useRef(false);
18817
+ useEffect(() => {
18818
+ let compositionTimeout;
18819
+ const handleCompositionStart = () => {
18820
+ clearTimeout(compositionTimeout);
18821
+ isComposingRef.current = true;
18822
+ };
18823
+ const handleCompositionEnd = () => {
18824
+ compositionTimeout = setTimeout(() => {
18825
+ isComposingRef.current = false;
18826
+ }, 5);
18827
+ };
18828
+ document.addEventListener("compositionstart", handleCompositionStart);
18829
+ document.addEventListener("compositionend", handleCompositionEnd);
18830
+ return () => {
18831
+ clearTimeout(compositionTimeout);
18832
+ document.removeEventListener("compositionstart", handleCompositionStart);
18833
+ document.removeEventListener("compositionend", handleCompositionEnd);
18834
+ };
18835
+ }, []);
18836
+ useEffect(() => {
18837
+ if (diginDepth === 0) {
18838
+ return;
18839
+ }
18840
+ const handleEscape = (event) => {
18841
+ if (event.key !== "Escape" || event.defaultPrevented || event.isComposing || isComposingRef.current) {
18842
+ return;
18843
+ }
18844
+ const activeElement2 = document.activeElement;
18845
+ const referenceElement = floating.elements.domReference;
18846
+ const floatingElement = floating.elements.floating;
18847
+ const focusIsInMenu = hasReference && activeElement2 === document.body || Boolean(floatingElement == null ? void 0 : floatingElement.contains(activeElement2)) || Boolean(referenceElement == null ? void 0 : referenceElement.contains(activeElement2));
18848
+ if (!focusIsInMenu) {
18849
+ return;
18850
+ }
18851
+ event.preventDefault();
18852
+ event.stopPropagation();
18853
+ rootContextValue.onPopDiginLevel();
18854
+ };
18855
+ document.addEventListener("keydown", handleEscape);
18856
+ return () => {
18857
+ document.removeEventListener("keydown", handleEscape);
18858
+ };
18859
+ });
18860
+ const handleLevelsKeyDown = (event) => {
18861
+ if (event.key !== "Escape" && event.key !== "Tab" && isTextEntryTarget(event.target)) {
18862
+ event.stopPropagation();
18863
+ }
18864
+ };
18865
+ const handleDiginKeyDown = (event) => {
18866
+ if (diginDepth > 0 && event.key === "ArrowLeft" && !event.defaultPrevented) {
18867
+ event.preventDefault();
18868
+ event.stopPropagation();
18869
+ rootContextValue.onPopDiginLevel();
18870
+ }
18871
+ };
18617
18872
  const navigateMainAxis = useCallback((direction) => {
18618
18873
  setActiveIndex(
18619
18874
  (prev) => navigateListMainAxisLoop(listRef, direction, prev)
18620
18875
  );
18621
18876
  }, []);
18877
+ const [firstEnabledIndex, setFirstEnabledIndex] = useState(
18878
+ null
18879
+ );
18880
+ useEffect(() => {
18881
+ let cancelled = false;
18882
+ queueMicrotask(() => {
18883
+ if (cancelled) {
18884
+ return;
18885
+ }
18886
+ const next = findFirstEnabledListIndex(listRef);
18887
+ setFirstEnabledIndex((previous) => previous === next ? previous : next);
18888
+ });
18889
+ return () => {
18890
+ cancelled = true;
18891
+ };
18892
+ });
18622
18893
  const menuListContextValue = {
18623
18894
  activeIndex,
18895
+ tabbableIndex: activeIndex ?? firstEnabledIndex,
18624
18896
  getItemProps: (userProps) => getItemProps(userProps),
18625
18897
  navigateMainAxis,
18626
18898
  nestedMenuDepth: 0
18627
18899
  };
18628
- const levels = [{ key: "root", title: "Menu", children }, ...diginLevels];
18900
+ const levels = [{ key: "root", title: "Menu", children }, ...liveDiginLevels];
18629
18901
  const activeLevel = levels[Math.min(diginDepth, levels.length - 1)];
18630
18902
  const levelCount = levels.length;
18631
18903
  const trackWidthPercent = levelCount * 100;
@@ -18691,6 +18963,10 @@ const Menu = (props) => {
18691
18963
  isMenuVisible,
18692
18964
  shouldUseDiginSizing
18693
18965
  ]);
18966
+ useLayoutEffect(() => {
18967
+ var _a2;
18968
+ (_a2 = sizeProbeRef.current) == null ? void 0 : _a2.querySelectorAll("[id]").forEach((element) => element.removeAttribute("id"));
18969
+ });
18694
18970
  const diginWrapperStyle = shouldUseDiginSizing && wrapperSize.width && wrapperSize.height ? {
18695
18971
  width: `${wrapperSize.width}px`,
18696
18972
  height: `${wrapperSize.height}px`
@@ -18707,120 +18983,130 @@ const Menu = (props) => {
18707
18983
  ...dsComponent("Menu"),
18708
18984
  ref: floating.refs.setFloating,
18709
18985
  className: cx(classes.wrapper, className),
18710
- ...getFloatingProps(),
18986
+ ...getFloatingProps({ onKeyDown: handleDiginKeyDown }),
18711
18987
  ...otherProps,
18712
18988
  style: floatingStyle,
18713
18989
  children: [
18714
18990
  !hasVisibleResults && /* @__PURE__ */ jsx(Box, { className: classes.noResults, children: renderNoResults ?? /* @__PURE__ */ jsx(Text, { textStyle: "body.sm", children: "No results found" }) }),
18715
- hasVisibleResults && /* @__PURE__ */ jsxs(Box, { className: classes.levelsViewport, children: [
18716
- shouldUseDiginSizing && /* @__PURE__ */ jsx(
18717
- Box,
18718
- {
18719
- ref: sizeProbeRef,
18720
- className: classes.sizeProbe,
18721
- "aria-hidden": true,
18722
- style: diginSizeProbeStyle,
18723
- children: /* @__PURE__ */ jsxs(Box, { className: classes.level, children: [
18724
- diginDepth > 0 && /* @__PURE__ */ jsxs(
18725
- Box,
18726
- {
18727
- as: "button",
18728
- type: "button",
18729
- className: classes.backHeader,
18730
- children: [
18731
- /* @__PURE__ */ jsx(Icon, { name: "caret-left", fill: "icon" }),
18732
- activeLevel.title
18733
- ]
18734
- }
18735
- ),
18736
- /* @__PURE__ */ jsx(Box, { className: listClassName, children: withLevelScopedKeys(
18737
- activeLevel.children,
18738
- `${activeLevel.key}-probe`
18739
- ) })
18740
- ] })
18741
- }
18742
- ),
18743
- /* @__PURE__ */ jsx(
18744
- Box,
18745
- {
18746
- className: classes.levelsTrack,
18747
- style: {
18748
- width: `${trackWidthPercent}%`,
18749
- transform: `translateX(-${trackTranslatePercent}%)`
18750
- },
18751
- children: levels.map((level, index2) => {
18752
- const isActiveLevel = index2 === diginDepth;
18753
- const levelChildren = withLevelScopedKeys(
18754
- level.children,
18755
- level.key
18756
- );
18757
- if (!isActiveLevel) {
18758
- return /* @__PURE__ */ jsxs(
18759
- Box,
18760
- {
18761
- className: classes.level,
18762
- style: {
18763
- flex: `0 0 ${levelWidthPercent}%`
18764
- },
18765
- "aria-hidden": true,
18766
- children: [
18767
- index2 > 0 && /* @__PURE__ */ jsxs(
18768
- Box,
18769
- {
18770
- as: "button",
18771
- type: "button",
18772
- className: classes.backHeader,
18773
- onClick: rootContextValue.onPopDiginLevel,
18774
- children: [
18775
- /* @__PURE__ */ jsx(Icon, { name: "caret-left" }),
18776
- level.title
18777
- ]
18778
- }
18779
- ),
18780
- /* @__PURE__ */ jsx(Box, { className: listClassName, children: levelChildren })
18781
- ]
18782
- },
18783
- level.key
18784
- );
18785
- }
18786
- return /* @__PURE__ */ jsx(
18787
- MenuListProvider,
18788
- {
18789
- value: menuListContextValue,
18790
- children: /* @__PURE__ */ jsx(FloatingList, { elementsRef: listRef, labelsRef, children: /* @__PURE__ */ jsxs(
18991
+ hasVisibleResults && /* @__PURE__ */ jsxs(
18992
+ Box,
18993
+ {
18994
+ className: classes.levelsViewport,
18995
+ onKeyDown: handleLevelsKeyDown,
18996
+ children: [
18997
+ shouldUseDiginSizing && /* @__PURE__ */ jsx(
18998
+ Box,
18999
+ {
19000
+ ref: sizeProbeRef,
19001
+ className: classes.sizeProbe,
19002
+ "aria-hidden": true,
19003
+ inert: true,
19004
+ style: diginSizeProbeStyle,
19005
+ children: /* @__PURE__ */ jsxs(Box, { className: classes.level, children: [
19006
+ diginDepth > 0 && /* @__PURE__ */ jsxs(
18791
19007
  Box,
18792
19008
  {
18793
- ref: activeLevelRef,
18794
- className: classes.level,
18795
- style: {
18796
- flex: `0 0 ${levelWidthPercent}%`
18797
- },
19009
+ as: "button",
19010
+ type: "button",
19011
+ className: classes.backHeader,
18798
19012
  children: [
18799
- index2 > 0 && /* @__PURE__ */ jsxs(
18800
- Box,
18801
- {
18802
- as: "button",
18803
- type: "button",
18804
- ref: activeBackHeaderRef,
18805
- className: classes.backHeader,
18806
- onClick: rootContextValue.onPopDiginLevel,
18807
- children: [
18808
- /* @__PURE__ */ jsx(Icon, { name: "caret-left" }),
18809
- level.title
18810
- ]
18811
- }
18812
- ),
18813
- /* @__PURE__ */ jsx(Box, { className: listClassName, children: levelChildren })
19013
+ /* @__PURE__ */ jsx(Icon, { name: "caret-left", fill: "icon" }),
19014
+ activeLevel.title
18814
19015
  ]
18815
19016
  }
19017
+ ),
19018
+ /* @__PURE__ */ jsx(Box, { className: listClassName, children: withLevelScopedKeys(
19019
+ activeLevel.children,
19020
+ `${activeLevel.key}-probe`
18816
19021
  ) })
19022
+ ] })
19023
+ }
19024
+ ),
19025
+ /* @__PURE__ */ jsx(
19026
+ Box,
19027
+ {
19028
+ className: classes.levelsTrack,
19029
+ style: {
19030
+ width: `${trackWidthPercent}%`,
19031
+ transform: `translateX(-${trackTranslatePercent}%)`
18817
19032
  },
18818
- level.key
18819
- );
18820
- })
18821
- }
18822
- )
18823
- ] })
19033
+ children: levels.map((level, index2) => {
19034
+ const isActiveLevel = index2 === diginDepth;
19035
+ const levelChildren = withLevelScopedKeys(
19036
+ level.children,
19037
+ level.key
19038
+ );
19039
+ if (!isActiveLevel) {
19040
+ return /* @__PURE__ */ jsxs(
19041
+ Box,
19042
+ {
19043
+ className: classes.level,
19044
+ style: {
19045
+ flex: `0 0 ${levelWidthPercent}%`
19046
+ },
19047
+ "aria-hidden": true,
19048
+ inert: true,
19049
+ children: [
19050
+ index2 > 0 && /* @__PURE__ */ jsxs(
19051
+ Box,
19052
+ {
19053
+ as: "button",
19054
+ type: "button",
19055
+ className: classes.backHeader,
19056
+ onClick: rootContextValue.onPopDiginLevel,
19057
+ children: [
19058
+ /* @__PURE__ */ jsx(Icon, { name: "caret-left" }),
19059
+ level.title
19060
+ ]
19061
+ }
19062
+ ),
19063
+ /* @__PURE__ */ jsx(Box, { className: listClassName, children: levelChildren })
19064
+ ]
19065
+ },
19066
+ level.key
19067
+ );
19068
+ }
19069
+ return /* @__PURE__ */ jsx(
19070
+ MenuListProvider,
19071
+ {
19072
+ value: menuListContextValue,
19073
+ children: /* @__PURE__ */ jsx(FloatingList, { elementsRef: listRef, labelsRef, children: /* @__PURE__ */ jsxs(
19074
+ Box,
19075
+ {
19076
+ ref: activeLevelRef,
19077
+ className: classes.level,
19078
+ style: {
19079
+ flex: `0 0 ${levelWidthPercent}%`
19080
+ },
19081
+ children: [
19082
+ index2 > 0 && /* @__PURE__ */ jsxs(
19083
+ Box,
19084
+ {
19085
+ as: "button",
19086
+ type: "button",
19087
+ ref: activeBackHeaderRef,
19088
+ "data-menu-back": "",
19089
+ className: classes.backHeader,
19090
+ onClick: rootContextValue.onPopDiginLevel,
19091
+ children: [
19092
+ /* @__PURE__ */ jsx(Icon, { name: "caret-left" }),
19093
+ level.title
19094
+ ]
19095
+ }
19096
+ ),
19097
+ /* @__PURE__ */ jsx(Box, { className: listClassName, children: levelChildren })
19098
+ ]
19099
+ }
19100
+ ) })
19101
+ },
19102
+ level.key
19103
+ );
19104
+ })
19105
+ }
19106
+ )
19107
+ ]
19108
+ }
19109
+ )
18824
19110
  ]
18825
19111
  }
18826
19112
  ) }) });
@@ -19143,6 +19429,12 @@ const MenuItem = (props) => {
19143
19429
  };
19144
19430
  const { onKeyDown: itemOnKeyDown, ...itemPropsRest } = itemProps;
19145
19431
  const handleItemKeyDown = (event) => {
19432
+ if (event.key === "ArrowLeft" && rootContext.diginDepth > 0 && ((listContext == null ? void 0 : listContext.nestedMenuDepth) ?? 0) === 0) {
19433
+ event.preventDefault();
19434
+ event.stopPropagation();
19435
+ rootContext.onPopDiginLevel();
19436
+ return;
19437
+ }
19146
19438
  if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
19147
19439
  if (href) {
19148
19440
  itemOnKeyDown == null ? void 0 : itemOnKeyDown(event);
@@ -19204,7 +19496,7 @@ const MenuItem = (props) => {
19204
19496
  "data-selected": selected,
19205
19497
  "data-disabled": disabled,
19206
19498
  "data-active": listContext ? listContext.activeIndex === listItemData.index : false,
19207
- tabIndex: listContext ? listContext.activeIndex === listItemData.index ? 0 : -1 : 0,
19499
+ tabIndex: listContext ? (listContext.tabbableIndex ?? listContext.activeIndex) === listItemData.index ? 0 : -1 : 0,
19208
19500
  ...itemPropsRest,
19209
19501
  onKeyDown: handleItemKeyDown,
19210
19502
  ...restProps,
@@ -19444,7 +19736,7 @@ const SubMenu = (props) => {
19444
19736
  return true;
19445
19737
  };
19446
19738
  if (!applyFirst()) {
19447
- requestAnimationFrame(() => {
19739
+ setTimeout(() => {
19448
19740
  if (!applyFirst()) {
19449
19741
  openedFromParentArrowRightRef.current = false;
19450
19742
  }
@@ -19613,7 +19905,7 @@ const SubMenu = (props) => {
19613
19905
  "data-selected": selected,
19614
19906
  "data-disabled": disabled,
19615
19907
  "data-active": parentListContext ? parentListContext.activeIndex === listItemData.index : false,
19616
- tabIndex: parentListContext ? parentListContext.activeIndex === listItemData.index ? 0 : -1 : 0,
19908
+ tabIndex: parentListContext ? (parentListContext.tabbableIndex ?? parentListContext.activeIndex) === listItemData.index ? 0 : -1 : 0,
19617
19909
  ...diginButtonProps,
19618
19910
  type: "button",
19619
19911
  children: [
@@ -19674,7 +19966,7 @@ const SubMenu = (props) => {
19674
19966
  "data-selected": selected,
19675
19967
  "data-disabled": disabled,
19676
19968
  "data-active": parentListContext ? parentListContext.activeIndex === listItemData.index : false,
19677
- tabIndex: parentListContext ? parentListContext.activeIndex === listItemData.index ? 0 : -1 : 0,
19969
+ tabIndex: parentListContext ? (parentListContext.tabbableIndex ?? parentListContext.activeIndex) === listItemData.index ? 0 : -1 : 0,
19678
19970
  ...referencePropsWithoutRef,
19679
19971
  type: "button",
19680
19972
  children: [
@@ -21295,6 +21587,216 @@ const DateTimeRangePicker = (props) => {
21295
21587
  }
21296
21588
  );
21297
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
+ };
21298
21800
  const Required = () => {
21299
21801
  return /* @__PURE__ */ jsx(Text, { color: "text.danger", fontSize: "inherit", lineHeight: "tight", children: "*" });
21300
21802
  };
@@ -21381,20 +21883,6 @@ const FormField = (props) => {
21381
21883
  }
21382
21884
  );
21383
21885
  };
21384
- const Heading = (props) => {
21385
- const { level = "h2", allCaps, children, ...rest } = props;
21386
- const [className, otherProps] = splitProps(rest);
21387
- return /* @__PURE__ */ jsx(
21388
- Text,
21389
- {
21390
- ...dsComponent("Heading"),
21391
- as: level,
21392
- className: cx(heading({ level, allCaps }), className),
21393
- ...otherProps,
21394
- children
21395
- }
21396
- );
21397
- };
21398
21886
  const toneIconNames$2 = {
21399
21887
  info: "info",
21400
21888
  success: "success",
@@ -24160,6 +24648,10 @@ export {
24160
24648
  DateTimePicker,
24161
24649
  DateTimeRangePicker,
24162
24650
  Divider,
24651
+ Drawer,
24652
+ DrawerBody,
24653
+ DrawerFooter,
24654
+ DrawerHeader,
24163
24655
  DsChainScope,
24164
24656
  FormField,
24165
24657
  Heading,
@@ -24223,6 +24715,7 @@ export {
24223
24715
  splitProps,
24224
24716
  useChipGroup,
24225
24717
  useContainerQuery,
24718
+ useDrawerContext,
24226
24719
  useForm2 as useForm,
24227
24720
  useIconConfig,
24228
24721
  useListContext,