@capra/core 1.8.1 → 1.9.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.
Files changed (49) hide show
  1. package/dist/index.cjs +330 -92
  2. package/dist/index.d.cts +663 -639
  3. package/dist/index.d.mts +663 -639
  4. package/dist/index.mjs +317 -80
  5. package/dist/style.css +328 -167
  6. package/docs/core-alert--usage.md +2 -0
  7. package/docs/core-anchor--usage.md +2 -0
  8. package/docs/core-autocompletefield--usage.md +2 -0
  9. package/docs/core-badge--usage.md +2 -0
  10. package/docs/core-breadcrumbs--usage.md +2 -0
  11. package/docs/core-button--usage.md +2 -0
  12. package/docs/core-buttonlink--usage.md +2 -0
  13. package/docs/core-checkbox--usage.md +2 -0
  14. package/docs/core-collapse--usage.md +2 -0
  15. package/docs/core-datepickerfield--usage.md +2 -0
  16. package/docs/core-daterangepickerfield--usage.md +2 -0
  17. package/docs/core-divider--usage.md +2 -0
  18. package/docs/core-emptystate--usage.md +2 -0
  19. package/docs/core-helpertext--usage.md +2 -0
  20. package/docs/core-iconbutton--usage.md +2 -0
  21. package/docs/core-inputrow--usage.md +2 -0
  22. package/docs/core-label--usage.md +2 -0
  23. package/docs/core-link--usage.md +2 -0
  24. package/docs/core-listitem--usage.md +2 -0
  25. package/docs/core-menu--usage.md +2 -0
  26. package/docs/core-modal--usage.md +2 -0
  27. package/docs/core-pagination--usage.md +2 -0
  28. package/docs/core-pill--usage.md +2 -0
  29. package/docs/core-radio--usage.md +2 -0
  30. package/docs/core-radiogroup--usage.md +2 -0
  31. package/docs/core-radiotile--usage.md +2 -0
  32. package/docs/core-ribbon--usage.md +2 -0
  33. package/docs/core-skeleton--usage.md +1 -2
  34. package/docs/core-skeletongroup--usage.md +0 -1
  35. package/docs/core-spinner--usage.md +2 -0
  36. package/docs/core-switch--usage.md +2 -0
  37. package/docs/core-tabnav--usage.md +2 -0
  38. package/docs/core-tag--usage.md +2 -0
  39. package/docs/core-text--usage.md +2 -0
  40. package/docs/core-textarea--usage.md +2 -0
  41. package/docs/core-textinput--usage.md +2 -0
  42. package/docs/core-tooltip--usage.md +2 -0
  43. package/docs/core-topnav--usage.md +2 -0
  44. package/docs/core-tree--design.md +31 -0
  45. package/docs/core-tree--usage.md +102 -0
  46. package/docs/core-verticalnavigation--usage.md +2 -0
  47. package/docs/history-changelogs-capra-core--docs.md +35 -0
  48. package/docs/index.md +2 -0
  49. package/package.json +9 -10
package/dist/index.cjs CHANGED
@@ -22,8 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  }) : target, mod));
23
23
  //#endregion
24
24
  let react = require("react");
25
- let react$1 = __toESM(react, 1);
26
- react = __toESM(react);
25
+ react = __toESM(react, 1);
27
26
  let _capra_icons = require("@capra/icons");
28
27
  let react_aria_components = require("react-aria-components");
29
28
  let react_aria = require("react-aria");
@@ -61,7 +60,7 @@ var Button_module_default = {
61
60
  /**
62
61
  * `forwardRef` function with proper typing to handle polymorphic components
63
62
  */
64
- const fixedForwardRef = react$1.forwardRef;
63
+ const fixedForwardRef = react.forwardRef;
65
64
  //#endregion
66
65
  //#region src/components/Text/Text.module.css
67
66
  var Text_module_default = { "base": "capra-Text-module-JSrT1a-base" };
@@ -253,7 +252,7 @@ const VisuallyHidden = ({ children, ...props }) => {
253
252
  //#endregion
254
253
  //#region src/components/input-helpers/Label.tsx
255
254
  /** Label text and optional required indicator for form fields, aligned with Capra field layouts. */
256
- const Label$1 = react.forwardRef((props, ref) => {
255
+ const Label = react.forwardRef((props, ref) => {
257
256
  const [mergedProps, mergedRef] = (0, react_aria_components.useContextProps)(props, ref, react_aria_components.LabelContext);
258
257
  const { trailingSlot, children, required, FORCE__className: classNameOverride, style, ...labelProps } = mergedProps;
259
258
  if (!children) return null;
@@ -266,7 +265,7 @@ const Label$1 = react.forwardRef((props, ref) => {
266
265
  "aria-hidden": true
267
266
  }, "*"), /* @__PURE__ */ react.createElement(VisuallyHidden, null, "This field is required"))), trailingSlot && /* @__PURE__ */ react.createElement("span", { className: Label_module_default.trailingSlot }, trailingSlot));
268
267
  });
269
- Label$1.displayName = "Label";
268
+ Label.displayName = "Label";
270
269
  //#endregion
271
270
  //#region src/components/TextInput/TextInput.module.css
272
271
  var TextInput_module_default = {
@@ -396,7 +395,7 @@ function AutocompleteFieldWithoutRef(props, ref) {
396
395
  id,
397
396
  shouldFocusWrap: true,
398
397
  ref: comboboxRef
399
- }, /* @__PURE__ */ react.default.createElement(Label$1, null, label), /* @__PURE__ */ react.default.createElement(TextInput, {
398
+ }, /* @__PURE__ */ react.default.createElement(Label, null, label), /* @__PURE__ */ react.default.createElement(TextInput, {
400
399
  ...inputProps,
401
400
  ref,
402
401
  trailingSlot: trailingContent
@@ -610,27 +609,32 @@ function BadgeLayout({ children }) {
610
609
  //#endregion
611
610
  //#region src/components/ListItem/ListItem.module.css
612
611
  var ListItem_module_default = {
613
- "content": "capra-ListItem-module-VUh15W-content",
614
- "description": "capra-ListItem-module-VUh15W-description",
615
- "label": "capra-ListItem-module-VUh15W-label",
616
- "leading": "capra-ListItem-module-VUh15W-leading",
617
- "listItem": "capra-ListItem-module-VUh15W-listItem",
618
- "slot": "capra-ListItem-module-VUh15W-slot",
619
- "slots": "capra-ListItem-module-VUh15W-slots",
620
- "suffix": "capra-ListItem-module-VUh15W-suffix",
621
- "trailing": "capra-ListItem-module-VUh15W-trailing"
612
+ "__listItem-layout": "capra-ListItem-module-QN6vFW-__listItem-layout",
613
+ "content": "capra-ListItem-module-QN6vFW-content",
614
+ "description": "capra-ListItem-module-QN6vFW-description",
615
+ "label": "capra-ListItem-module-QN6vFW-label",
616
+ "leading": "capra-ListItem-module-QN6vFW-leading",
617
+ "listItem": "capra-ListItem-module-QN6vFW-listItem capra-ListItem-module-QN6vFW-__listItem-layout",
618
+ "slot": "capra-ListItem-module-QN6vFW-slot",
619
+ "slots": "capra-ListItem-module-QN6vFW-slots",
620
+ "suffix": "capra-ListItem-module-QN6vFW-suffix",
621
+ "trailing": "capra-ListItem-module-QN6vFW-trailing"
622
622
  };
623
623
  //#endregion
624
624
  //#region src/components/ListItem/ListItemSlots.tsx
625
+ const CollapsedSlot = "__CollapsedSlot__";
625
626
  const ListItemSlots = ({ children, trailing = false, FORCE__className }) => {
626
627
  if (react.default.Children.count(children) === 0) return null;
627
628
  return /* @__PURE__ */ react.default.createElement("div", {
628
629
  className: clsx(ListItem_module_default.slots, FORCE__className),
629
630
  "data-trailing": trailing || void 0
630
- }, react.default.Children.map(children, (child, index) => /* @__PURE__ */ react.default.createElement("div", {
631
- key: index,
632
- className: ListItem_module_default.slot
633
- }, child)));
631
+ }, react.default.Children.map(children, (child, index) => {
632
+ if (child === "__CollapsedSlot__") return void 0;
633
+ return /* @__PURE__ */ react.default.createElement("div", {
634
+ key: index,
635
+ className: ListItem_module_default.slot
636
+ }, child);
637
+ }));
634
638
  };
635
639
  //#endregion
636
640
  //#region src/components/ListItem/ListItem.tsx
@@ -653,7 +657,7 @@ const Trailing = ({ children, FORCE__className }) => {
653
657
  const Content = ({ children, FORCE__className }) => {
654
658
  return /* @__PURE__ */ react.createElement("div", { className: clsx(ListItem_module_default.content, FORCE__className) }, children);
655
659
  };
656
- const Label = ({ children, id }) => {
660
+ const Label$1 = ({ children, id }) => {
657
661
  return /* @__PURE__ */ react.createElement("div", {
658
662
  id,
659
663
  className: ListItem_module_default.label
@@ -672,7 +676,7 @@ const Spacer = () => {
672
676
  });
673
677
  };
674
678
  ListItem.Content = Content;
675
- ListItem.Label = Label;
679
+ ListItem.Label = Label$1;
676
680
  ListItem.Description = Description;
677
681
  ListItem.Suffix = Suffix;
678
682
  ListItem.Spacer = Spacer;
@@ -781,7 +785,7 @@ function RadioWithoutRef({ name, checked, required, disabled, value, onChange, F
781
785
  const Radio = fixedForwardRef(RadioWithoutRef);
782
786
  //#endregion
783
787
  //#region src/components/RadioTile/RadioTile.module.css
784
- var RadioTile_module_default = { "base": "capra-RadioTile-module-zbnLia-base" };
788
+ var RadioTile_module_default = { "base": "capra-RadioTile-module-iEQ2jG-base" };
785
789
  //#endregion
786
790
  //#region src/components/RadioTile/RadioTile.tsx
787
791
  function RadioTileWithoutRef({ children, checked, disabled, description, icon, FORCE__className, ...props }, ref) {
@@ -1113,7 +1117,7 @@ const TextField = react.forwardRef((props, ref) => {
1113
1117
  className: fieldLayout_module_default.field,
1114
1118
  "data-capra-field-root": "",
1115
1119
  "data-layout": layout
1116
- }, /* @__PURE__ */ react.createElement(Label$1, { required }, label), /* @__PURE__ */ react.createElement(TextInput, {
1120
+ }, /* @__PURE__ */ react.createElement(Label, { required }, label), /* @__PURE__ */ react.createElement(TextInput, {
1117
1121
  ref,
1118
1122
  ...inputRest,
1119
1123
  appearance,
@@ -1217,7 +1221,7 @@ const NumberField = react.forwardRef((props, ref) => {
1217
1221
  className: fieldLayout_module_default.field,
1218
1222
  "data-capra-field-root": "",
1219
1223
  "data-layout": layout
1220
- }, /* @__PURE__ */ react.createElement(Label$1, { required }, label), /* @__PURE__ */ react.createElement(react_aria_components.Group, {
1224
+ }, /* @__PURE__ */ react.createElement(Label, { required }, label), /* @__PURE__ */ react.createElement(react_aria_components.Group, {
1221
1225
  "data-capra-text-input": "",
1222
1226
  "data-size": size,
1223
1227
  className: clsx(TextInput_module_default.wrapper, NumberField_module_default.withStepper, classNameOverride)
@@ -2233,7 +2237,7 @@ function DatePickerFieldInner(props, ref) {
2233
2237
  isInvalid,
2234
2238
  shouldForceLeadingZeros: true,
2235
2239
  validationBehavior: "aria"
2236
- }, /* @__PURE__ */ react.createElement(Label$1, { required }, label), /* @__PURE__ */ react.createElement(DatePickerFieldRow, {
2240
+ }, /* @__PURE__ */ react.createElement(Label, { required }, label), /* @__PURE__ */ react.createElement(DatePickerFieldRow, {
2237
2241
  appearance,
2238
2242
  size,
2239
2243
  leadingSlot,
@@ -2475,7 +2479,7 @@ function DateRangePickerFieldInner(props, ref) {
2475
2479
  isInvalid,
2476
2480
  shouldForceLeadingZeros: true,
2477
2481
  validationBehavior: "aria"
2478
- }, /* @__PURE__ */ react.createElement(Label$1, { required }, label), /* @__PURE__ */ react.createElement(DateRangePickerFieldRow, {
2482
+ }, /* @__PURE__ */ react.createElement(Label, { required }, label), /* @__PURE__ */ react.createElement(DateRangePickerFieldRow, {
2479
2483
  appearance,
2480
2484
  size,
2481
2485
  leadingSlot,
@@ -2605,15 +2609,15 @@ function syncTextareaAutoSize(textarea, autoSize, rowsFromProps) {
2605
2609
  textarea.style.overflowY = maxRows && contentHeight > maxHeight ? "auto" : "hidden";
2606
2610
  }
2607
2611
  function useTextAreaAutoSize({ config, ref, rows, value, onChange, onInput }) {
2608
- const textareaRef = react$1.useRef(null);
2612
+ const textareaRef = react.useRef(null);
2609
2613
  const autoSizeActive = isAutoSizeEnabled(config);
2610
- react$1.useImperativeHandle(ref, () => textareaRef.current);
2611
- const resize = react$1.useCallback(() => {
2614
+ react.useImperativeHandle(ref, () => textareaRef.current);
2615
+ const resize = react.useCallback(() => {
2612
2616
  const el = textareaRef.current;
2613
2617
  if (!el || !isAutoSizeEnabled(config)) return;
2614
2618
  syncTextareaAutoSize(el, config, rows);
2615
2619
  }, [config, rows]);
2616
- react$1.useLayoutEffect(() => {
2620
+ react.useLayoutEffect(() => {
2617
2621
  const el = textareaRef.current;
2618
2622
  if (!el) return;
2619
2623
  if (!autoSizeActive) {
@@ -2627,7 +2631,7 @@ function useTextAreaAutoSize({ config, ref, rows, value, onChange, onInput }) {
2627
2631
  resize,
2628
2632
  value
2629
2633
  ]);
2630
- react$1.useLayoutEffect(() => {
2634
+ react.useLayoutEffect(() => {
2631
2635
  if (!autoSizeActive) return;
2632
2636
  const el = textareaRef.current;
2633
2637
  if (!el || typeof ResizeObserver === "undefined") return;
@@ -2638,7 +2642,7 @@ function useTextAreaAutoSize({ config, ref, rows, value, onChange, onInput }) {
2638
2642
  return {
2639
2643
  isActive: autoSizeActive,
2640
2644
  ref: textareaRef,
2641
- onChange: react$1.useCallback((event) => {
2645
+ onChange: react.useCallback((event) => {
2642
2646
  onChange?.(event.target.value);
2643
2647
  if (autoSizeActive) queueMicrotask(resize);
2644
2648
  }, [
@@ -2646,7 +2650,7 @@ function useTextAreaAutoSize({ config, ref, rows, value, onChange, onInput }) {
2646
2650
  onChange,
2647
2651
  resize
2648
2652
  ]),
2649
- onInput: react$1.useCallback((event) => {
2653
+ onInput: react.useCallback((event) => {
2650
2654
  onInput?.(event);
2651
2655
  if (autoSizeActive) queueMicrotask(resize);
2652
2656
  }, [
@@ -2704,7 +2708,7 @@ const TextArea = react.forwardRef((props, ref) => {
2704
2708
  ...ariaFieldProps,
2705
2709
  className: fieldLayout_module_default.field,
2706
2710
  "data-layout": layout
2707
- }, /* @__PURE__ */ react.createElement(Label$1, { required }, label), /* @__PURE__ */ react.createElement("div", {
2711
+ }, /* @__PURE__ */ react.createElement(Label, { required }, label), /* @__PURE__ */ react.createElement("div", {
2708
2712
  className: clsx(TextArea_module_default.wrapper, classNameOverride),
2709
2713
  "data-has-indicator": hasIndicator,
2710
2714
  "data-autosize": autoSizeActive,
@@ -2733,23 +2737,24 @@ TextArea.displayName = "TextArea";
2733
2737
  //#endregion
2734
2738
  //#region src/components/Modal/Modal.module.css
2735
2739
  var Modal_module_default = {
2736
- "confirmationActions": "capra-Modal-module-j-u8iq-confirmationActions",
2737
- "confirmationBody": "capra-Modal-module-j-u8iq-confirmationBody",
2738
- "confirmationIcon": "capra-Modal-module-j-u8iq-confirmationIcon",
2739
- "confirmationLayout": "capra-Modal-module-j-u8iq-confirmationLayout",
2740
- "confirmationMessage": "capra-Modal-module-j-u8iq-confirmationMessage",
2741
- "confirmationSurface": "capra-Modal-module-j-u8iq-confirmationSurface",
2742
- "content": "capra-Modal-module-j-u8iq-content",
2743
- "contentShow": "capra-Modal-module-j-u8iq-contentShow",
2744
- "expandedFooterLayout": "capra-Modal-module-j-u8iq-expandedFooterLayout",
2745
- "expandedTitleLayout": "capra-Modal-module-j-u8iq-expandedTitleLayout",
2746
- "footer": "capra-Modal-module-j-u8iq-footer",
2747
- "footerActions": "capra-Modal-module-j-u8iq-footerActions",
2748
- "header": "capra-Modal-module-j-u8iq-header",
2749
- "headerLeading": "capra-Modal-module-j-u8iq-headerLeading",
2750
- "overlay": "capra-Modal-module-j-u8iq-overlay",
2751
- "overlayShow": "capra-Modal-module-j-u8iq-overlayShow",
2752
- "surface": "capra-Modal-module-j-u8iq-surface"
2740
+ "confirmationActions": "capra-Modal-module-gAoc6W-confirmationActions",
2741
+ "confirmationBody": "capra-Modal-module-gAoc6W-confirmationBody",
2742
+ "confirmationIcon": "capra-Modal-module-gAoc6W-confirmationIcon",
2743
+ "confirmationLayout": "capra-Modal-module-gAoc6W-confirmationLayout",
2744
+ "confirmationMessage": "capra-Modal-module-gAoc6W-confirmationMessage",
2745
+ "confirmationSurface": "capra-Modal-module-gAoc6W-confirmationSurface",
2746
+ "content": "capra-Modal-module-gAoc6W-content",
2747
+ "contentShow": "capra-Modal-module-gAoc6W-contentShow",
2748
+ "dialog": "capra-Modal-module-gAoc6W-dialog",
2749
+ "expandedFooterLayout": "capra-Modal-module-gAoc6W-expandedFooterLayout",
2750
+ "expandedTitleLayout": "capra-Modal-module-gAoc6W-expandedTitleLayout",
2751
+ "footer": "capra-Modal-module-gAoc6W-footer",
2752
+ "footerActions": "capra-Modal-module-gAoc6W-footerActions",
2753
+ "header": "capra-Modal-module-gAoc6W-header",
2754
+ "headerLeading": "capra-Modal-module-gAoc6W-headerLeading",
2755
+ "overlay": "capra-Modal-module-gAoc6W-overlay",
2756
+ "overlayShow": "capra-Modal-module-gAoc6W-overlayShow",
2757
+ "surface": "capra-Modal-module-gAoc6W-surface"
2753
2758
  };
2754
2759
  //#endregion
2755
2760
  //#region src/components/Text/Heading.tsx
@@ -2771,10 +2776,7 @@ const Heading = react.forwardRef(function Heading(props, ref) {
2771
2776
  //#endregion
2772
2777
  //#region src/components/Modal/Modal.tsx
2773
2778
  function ModalInner({ children, isOpen: open, onIsOpenChange: onOpenChange, title, footer, size = "md", isDismissible = true, FORCE__className, confirmButtonText = "OK", cancelButtonText = "Cancel", onClose, onConfirm, getContainer }) {
2774
- const footerToDisplay = footer !== void 0 ? footer : /* @__PURE__ */ react.createElement(ModalFooterActions, null, cancelButtonText && /* @__PURE__ */ react.createElement(Button, {
2775
- slot: "close",
2776
- onPress: () => onClose?.()
2777
- }, cancelButtonText), /* @__PURE__ */ react.createElement(Button, {
2779
+ const footerToDisplay = footer !== void 0 ? footer : /* @__PURE__ */ react.createElement(ModalFooterActions, null, cancelButtonText && /* @__PURE__ */ react.createElement(Button, { slot: "close" }, cancelButtonText), /* @__PURE__ */ react.createElement(Button, {
2778
2780
  onPress: () => onConfirm?.(),
2779
2781
  variant: "primary"
2780
2782
  }, confirmButtonText));
@@ -2791,7 +2793,7 @@ function ModalInner({ children, isOpen: open, onIsOpenChange: onOpenChange, titl
2791
2793
  }, /* @__PURE__ */ react.createElement(react_aria_components.Modal, {
2792
2794
  className: clsx(Modal_module_default.surface, FORCE__className),
2793
2795
  "data-size": size ?? "md"
2794
- }, /* @__PURE__ */ react.createElement(react_aria_components.Dialog, { className: "" }, (!!title || isDismissible) && /* @__PURE__ */ react.createElement("div", { className: Modal_module_default.header }, /* @__PURE__ */ react.createElement("div", { className: Modal_module_default.headerLeading }, !!title && typeof title === "string" ? /* @__PURE__ */ react.createElement(ModalHeading, null, title) : title), isDismissible && /* @__PURE__ */ react.createElement(IconButton, {
2796
+ }, /* @__PURE__ */ react.createElement(react_aria_components.Dialog, { className: Modal_module_default.dialog }, (!!title || isDismissible) && /* @__PURE__ */ react.createElement("div", { className: Modal_module_default.header }, /* @__PURE__ */ react.createElement("div", { className: Modal_module_default.headerLeading }, !!title && typeof title === "string" ? /* @__PURE__ */ react.createElement(ModalHeading, null, title) : title), isDismissible && /* @__PURE__ */ react.createElement(IconButton, {
2795
2797
  slot: "close",
2796
2798
  variant: "tertiary",
2797
2799
  appearance: "neutral",
@@ -2961,9 +2963,9 @@ const drawerAnimationMs = 300;
2961
2963
  * (via `animationend` or a duration fallback timeout).
2962
2964
  */
2963
2965
  function useDrawerExitAnimation(isOpen) {
2964
- const [isRendered, setIsRendered] = react$1.useState(isOpen);
2965
- const closeTimeoutRef = react$1.useRef(void 0);
2966
- const finishCloseAnimation = react$1.useCallback(() => {
2966
+ const [isRendered, setIsRendered] = react.useState(isOpen);
2967
+ const closeTimeoutRef = react.useRef(void 0);
2968
+ const finishCloseAnimation = react.useCallback(() => {
2967
2969
  if (isOpen) return;
2968
2970
  if (closeTimeoutRef.current !== void 0) {
2969
2971
  window.clearTimeout(closeTimeoutRef.current);
@@ -2971,7 +2973,7 @@ function useDrawerExitAnimation(isOpen) {
2971
2973
  }
2972
2974
  setIsRendered(false);
2973
2975
  }, [isOpen]);
2974
- react$1.useEffect(() => {
2976
+ react.useEffect(() => {
2975
2977
  if (isOpen) {
2976
2978
  if (closeTimeoutRef.current !== void 0) {
2977
2979
  window.clearTimeout(closeTimeoutRef.current);
@@ -2998,7 +3000,7 @@ function useDrawerExitAnimation(isOpen) {
2998
3000
  }, [isOpen, isRendered]);
2999
3001
  return {
3000
3002
  isRendered,
3001
- onSheetAnimationEnd: react$1.useCallback((event) => {
3003
+ onSheetAnimationEnd: react.useCallback((event) => {
3002
3004
  if (event.target !== event.currentTarget || isOpen) return;
3003
3005
  finishCloseAnimation();
3004
3006
  }, [finishCloseAnimation, isOpen])
@@ -4099,20 +4101,20 @@ const Toast = {
4099
4101
  //#endregion
4100
4102
  //#region src/components/Menu/Menu.module.css
4101
4103
  var Menu_module_default = {
4102
- "divider": "capra-Menu-module-y-WdTa-divider",
4103
- "header": "capra-Menu-module-y-WdTa-header",
4104
- "list": "capra-Menu-module-y-WdTa-list",
4105
- "menu": "capra-Menu-module-y-WdTa-menu",
4106
- "menuItem": "capra-Menu-module-y-WdTa-menuItem",
4107
- "menuItemDescription": "capra-Menu-module-y-WdTa-menuItemDescription",
4108
- "menuItemLabel": "capra-Menu-module-y-WdTa-menuItemLabel",
4109
- "menuItemLeadingGutter": "capra-Menu-module-y-WdTa-menuItemLeadingGutter",
4110
- "menuItemListItemShell": "capra-Menu-module-y-WdTa-menuItemListItemShell",
4111
- "menuItemShortcut": "capra-Menu-module-y-WdTa-menuItemShortcut",
4112
- "menuItemTrailingGroup": "capra-Menu-module-y-WdTa-menuItemTrailingGroup",
4113
- "menuItemTrailingGutter": "capra-Menu-module-y-WdTa-menuItemTrailingGutter",
4114
- "menuTriggerSlot": "capra-Menu-module-y-WdTa-menuTriggerSlot",
4115
- "section": "capra-Menu-module-y-WdTa-section"
4104
+ "divider": "capra-Menu-module-3G4VeG-divider",
4105
+ "header": "capra-Menu-module-3G4VeG-header",
4106
+ "list": "capra-Menu-module-3G4VeG-list",
4107
+ "menu": "capra-Menu-module-3G4VeG-menu",
4108
+ "menuItem": "capra-Menu-module-3G4VeG-menuItem",
4109
+ "menuItemDescription": "capra-Menu-module-3G4VeG-menuItemDescription",
4110
+ "menuItemLabel": "capra-Menu-module-3G4VeG-menuItemLabel",
4111
+ "menuItemLeadingGutter": "capra-Menu-module-3G4VeG-menuItemLeadingGutter",
4112
+ "menuItemListItemShell": "capra-Menu-module-3G4VeG-menuItemListItemShell",
4113
+ "menuItemShortcut": "capra-Menu-module-3G4VeG-menuItemShortcut",
4114
+ "menuItemTrailingGroup": "capra-Menu-module-3G4VeG-menuItemTrailingGroup",
4115
+ "menuItemTrailingGutter": "capra-Menu-module-3G4VeG-menuItemTrailingGutter",
4116
+ "menuTriggerSlot": "capra-Menu-module-3G4VeG-menuTriggerSlot",
4117
+ "section": "capra-Menu-module-3G4VeG-section"
4116
4118
  };
4117
4119
  //#endregion
4118
4120
  //#region src/components/Menu/Menu.tsx
@@ -4383,23 +4385,23 @@ const submenuPanelClassName = Menu_module_default.menu;
4383
4385
  //#endregion
4384
4386
  //#region src/components/TabNav/TabNav.module.css
4385
4387
  var TabNav_module_default = {
4386
- "dropdownIcon": "capra-TabNav-module-e0IbmW-dropdownIcon",
4387
- "extraContent": "capra-TabNav-module-e0IbmW-extraContent",
4388
- "indentSpacer": "capra-TabNav-module-e0IbmW-indentSpacer",
4389
- "panel": "capra-TabNav-module-e0IbmW-panel",
4390
- "root": "capra-TabNav-module-e0IbmW-root",
4391
- "subMenu": "capra-TabNav-module-e0IbmW-subMenu",
4392
- "subMenuItem": "capra-TabNav-module-e0IbmW-subMenuItem",
4393
- "subMenuItemActive": "capra-TabNav-module-e0IbmW-subMenuItemActive",
4394
- "subTab": "capra-TabNav-module-e0IbmW-subTab",
4395
- "subTabList": "capra-TabNav-module-e0IbmW-subTabList",
4396
- "subTabListItem": "capra-TabNav-module-e0IbmW-subTabListItem",
4397
- "tab": "capra-TabNav-module-e0IbmW-tab",
4398
- "tabBar": "capra-TabNav-module-e0IbmW-tabBar",
4399
- "tabGroup": "capra-TabNav-module-e0IbmW-tabGroup",
4400
- "tabIcon": "capra-TabNav-module-e0IbmW-tabIcon",
4401
- "tabLabel": "capra-TabNav-module-e0IbmW-tabLabel",
4402
- "tabList": "capra-TabNav-module-e0IbmW-tabList"
4388
+ "dropdownIcon": "capra-TabNav-module-qqfvea-dropdownIcon",
4389
+ "extraContent": "capra-TabNav-module-qqfvea-extraContent",
4390
+ "indentSpacer": "capra-TabNav-module-qqfvea-indentSpacer",
4391
+ "panel": "capra-TabNav-module-qqfvea-panel",
4392
+ "root": "capra-TabNav-module-qqfvea-root",
4393
+ "subMenu": "capra-TabNav-module-qqfvea-subMenu",
4394
+ "subMenuItem": "capra-TabNav-module-qqfvea-subMenuItem",
4395
+ "subMenuItemActive": "capra-TabNav-module-qqfvea-subMenuItemActive",
4396
+ "subTab": "capra-TabNav-module-qqfvea-subTab",
4397
+ "subTabList": "capra-TabNav-module-qqfvea-subTabList",
4398
+ "subTabListItem": "capra-TabNav-module-qqfvea-subTabListItem",
4399
+ "tab": "capra-TabNav-module-qqfvea-tab",
4400
+ "tabBar": "capra-TabNav-module-qqfvea-tabBar",
4401
+ "tabGroup": "capra-TabNav-module-qqfvea-tabGroup",
4402
+ "tabIcon": "capra-TabNav-module-qqfvea-tabIcon",
4403
+ "tabLabel": "capra-TabNav-module-qqfvea-tabLabel",
4404
+ "tabList": "capra-TabNav-module-qqfvea-tabList"
4403
4405
  };
4404
4406
  //#endregion
4405
4407
  //#region src/components/TabNav/TabNav.tsx
@@ -4973,6 +4975,240 @@ function ArrowSvg() {
4973
4975
  }));
4974
4976
  }
4975
4977
  //#endregion
4978
+ //#region src/components/Tree/Tree.module.css
4979
+ var Tree_module_default = {
4980
+ "chevronButton": "capra-Tree-module--hXpBa-chevronButton",
4981
+ "chevronIcon": "capra-Tree-module--hXpBa-chevronIcon",
4982
+ "indentSpacer": "capra-Tree-module--hXpBa-indentSpacer",
4983
+ "item": "capra-Tree-module--hXpBa-item capra-ListItem-module-QN6vFW-__listItem-layout",
4984
+ "itemContent": "capra-Tree-module--hXpBa-itemContent capra-ListItem-module-QN6vFW-content",
4985
+ "itemLabel": "capra-Tree-module--hXpBa-itemLabel capra-ListItem-module-QN6vFW-label",
4986
+ "itemSuffix": "capra-Tree-module--hXpBa-itemSuffix capra-ListItem-module-QN6vFW-suffix",
4987
+ "label": "capra-Tree-module--hXpBa-label",
4988
+ "root": "capra-Tree-module--hXpBa-root",
4989
+ "selectionCheckbox": "capra-Tree-module--hXpBa-selectionCheckbox",
4990
+ "suffix": "capra-Tree-module--hXpBa-suffix"
4991
+ };
4992
+ //#endregion
4993
+ //#region src/components/Tree/Tree.tsx
4994
+ const TreeSelectionContext = react.createContext(null);
4995
+ function getTextValue(item) {
4996
+ return typeof item.label === "string" ? item.label : String(item.key);
4997
+ }
4998
+ function buildTreeIndex(items) {
4999
+ const parentByKey = /* @__PURE__ */ new Map();
5000
+ const descendantsByKey = /* @__PURE__ */ new Map();
5001
+ const selectableDescendantsByKey = /* @__PURE__ */ new Map();
5002
+ const disabledKeys = /* @__PURE__ */ new Set();
5003
+ const selectableKeys = /* @__PURE__ */ new Set();
5004
+ const visit = (item, parent) => {
5005
+ parentByKey.set(item.key, parent);
5006
+ if (item.isDisabled) disabledKeys.add(item.key);
5007
+ else selectableKeys.add(item.key);
5008
+ const descendants = [];
5009
+ const selectableDescendants = [];
5010
+ for (const child of item.children ?? []) {
5011
+ visit(child, item.key);
5012
+ descendants.push(child.key, ...descendantsByKey.get(child.key) ?? []);
5013
+ if (!child.isDisabled) selectableDescendants.push(child.key);
5014
+ for (const descendant of selectableDescendantsByKey.get(child.key) ?? []) selectableDescendants.push(descendant);
5015
+ }
5016
+ descendantsByKey.set(item.key, descendants);
5017
+ selectableDescendantsByKey.set(item.key, selectableDescendants);
5018
+ };
5019
+ for (const item of items) visit(item, null);
5020
+ return {
5021
+ parentByKey,
5022
+ descendantsByKey,
5023
+ selectableDescendantsByKey,
5024
+ disabledKeys,
5025
+ selectableKeys
5026
+ };
5027
+ }
5028
+ function sanitizeSelection(selection, index) {
5029
+ const next = /* @__PURE__ */ new Set();
5030
+ for (const key of selection) if (index.parentByKey.has(key) && !index.disabledKeys.has(key)) next.add(key);
5031
+ return next;
5032
+ }
5033
+ function reconcileParentKeys(selection, index) {
5034
+ const next = new Set(selection);
5035
+ for (const [key, selectableDescendants] of index.selectableDescendantsByKey) {
5036
+ if (selectableDescendants.length === 0) continue;
5037
+ if (!selectableDescendants.every((descendantKey) => next.has(descendantKey))) next.delete(key);
5038
+ }
5039
+ return next;
5040
+ }
5041
+ function selectionToSet(selection, index) {
5042
+ if (selection === "all") return new Set(index.selectableKeys);
5043
+ if (selection == null) return /* @__PURE__ */ new Set();
5044
+ return sanitizeSelection(selection, index);
5045
+ }
5046
+ function expandKeysWithAncestors(keys, index) {
5047
+ if (keys == null) return;
5048
+ const expanded = /* @__PURE__ */ new Set();
5049
+ for (const key of keys) {
5050
+ if (!index.parentByKey.has(key)) continue;
5051
+ let current = key;
5052
+ while (current != null) {
5053
+ expanded.add(current);
5054
+ current = index.parentByKey.get(current) ?? null;
5055
+ }
5056
+ }
5057
+ return expanded;
5058
+ }
5059
+ function getCheckboxState(key, selectedKeys, index) {
5060
+ const selectableDescendants = index.selectableDescendantsByKey.get(key) ?? [];
5061
+ if (selectableDescendants.length === 0) return {
5062
+ checked: selectedKeys.has(key),
5063
+ indeterminate: false
5064
+ };
5065
+ const selectedDescendantCount = selectableDescendants.filter((descendantKey) => selectedKeys.has(descendantKey)).length;
5066
+ const allSelectableDescendantsSelected = selectedDescendantCount === selectableDescendants.length;
5067
+ const someSelectableDescendantsSelected = selectedDescendantCount > 0;
5068
+ if (allSelectableDescendantsSelected || selectedKeys.has(key)) return {
5069
+ checked: true,
5070
+ indeterminate: false
5071
+ };
5072
+ return {
5073
+ checked: false,
5074
+ indeterminate: someSelectableDescendantsSelected
5075
+ };
5076
+ }
5077
+ function applySelectionChange(prev, next, index) {
5078
+ const cascadedSelection = sanitizeSelection(next, index);
5079
+ for (const key of next) {
5080
+ if (prev.has(key) || index.disabledKeys.has(key)) continue;
5081
+ if ((index.descendantsByKey.get(key) ?? []).length === 0) continue;
5082
+ cascadedSelection.add(key);
5083
+ for (const descendantKey of index.selectableDescendantsByKey.get(key) ?? []) cascadedSelection.add(descendantKey);
5084
+ }
5085
+ for (const key of prev) {
5086
+ if (next.has(key) || index.disabledKeys.has(key)) continue;
5087
+ if ((index.descendantsByKey.get(key) ?? []).length === 0) continue;
5088
+ cascadedSelection.delete(key);
5089
+ for (const descendantKey of index.descendantsByKey.get(key) ?? []) cascadedSelection.delete(descendantKey);
5090
+ }
5091
+ return reconcileParentKeys(cascadedSelection, index);
5092
+ }
5093
+ function TreeSelectionCheckbox({ item }) {
5094
+ const context = react.useContext(TreeSelectionContext);
5095
+ if (context?.selectionMode !== "multiple") return null;
5096
+ const checkboxState = getCheckboxState(item.key, context.selectedKeys, context.index);
5097
+ return /* @__PURE__ */ react.createElement(Checkbox, {
5098
+ "aria-checked": checkboxState.indeterminate ? "mixed" : checkboxState.checked ? "true" : "false",
5099
+ "aria-label": getTextValue(item),
5100
+ checked: checkboxState.checked,
5101
+ disabled: context.index.disabledKeys.has(item.key),
5102
+ indeterminate: checkboxState.indeterminate,
5103
+ FORCE__className: Tree_module_default.selectionCheckbox,
5104
+ onChange: (event) => {
5105
+ event.stopPropagation();
5106
+ context.toggleSelection(item.key);
5107
+ },
5108
+ onClick: (event) => {
5109
+ event.stopPropagation();
5110
+ },
5111
+ onMouseDown: (event) => {
5112
+ event.stopPropagation();
5113
+ },
5114
+ onKeyDown: (event) => {
5115
+ event.stopPropagation();
5116
+ },
5117
+ onPointerDown: (event) => {
5118
+ event.stopPropagation();
5119
+ }
5120
+ });
5121
+ }
5122
+ function renderTreeItem(item) {
5123
+ return /* @__PURE__ */ react.createElement(react_aria_components.TreeItem, {
5124
+ id: item.key,
5125
+ key: item.key,
5126
+ className: Tree_module_default.item,
5127
+ isDisabled: item.isDisabled,
5128
+ textValue: getTextValue(item)
5129
+ }, /* @__PURE__ */ react.createElement(react_aria_components.TreeItemContent, null, ({ hasChildItems, id, level, selectionMode }) => /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(ListItem.Leading, null, Array.from({ length: Math.max(level - 1, 0) }).map((_, index) => /* @__PURE__ */ react.createElement("span", {
5130
+ key: `${String(item.key)}-indent-${index}`,
5131
+ "aria-hidden": "true",
5132
+ className: Tree_module_default.indentSpacer
5133
+ })), hasChildItems ? /* @__PURE__ */ react.createElement(react_aria_components.Button, {
5134
+ slot: "chevron",
5135
+ className: Tree_module_default.chevronButton
5136
+ }, /* @__PURE__ */ react.createElement("span", {
5137
+ "aria-hidden": "true",
5138
+ className: Tree_module_default.chevronIcon
5139
+ }, /* @__PURE__ */ react.createElement(_capra_icons.CaretRight, { size: "xs" }))) : /* @__PURE__ */ react.createElement("div", null), selectionMode === "multiple" ? /* @__PURE__ */ react.createElement(TreeSelectionCheckbox, { item }) : CollapsedSlot), /* @__PURE__ */ react.createElement("div", { className: Tree_module_default.itemContent }, /* @__PURE__ */ react.createElement("div", {
5140
+ id: String(id),
5141
+ className: Tree_module_default.itemLabel
5142
+ }, item.label)), /* @__PURE__ */ react.createElement(ListItem.Trailing, null, item.suffix ? /* @__PURE__ */ react.createElement("div", { className: Tree_module_default.itemSuffix }, item.suffix) : CollapsedSlot, item.trailingSlot || "__CollapsedSlot__"))), /* @__PURE__ */ react.createElement(react_aria_components.Collection, { items: item.children }, renderTreeItem));
5143
+ }
5144
+ /**
5145
+ * A hierarchical tree with cascading multi-select and Capra ListItem row layout.
5146
+ */
5147
+ function Tree({ FORCE__className: classNameOverride, items, selectionMode = "multiple", defaultSelectedKeys, selectedKeys, onSelectionChange, expandedKeys, defaultExpandedKeys, ...props }) {
5148
+ const index = react.useMemo(() => buildTreeIndex(items), [items]);
5149
+ const resolvedExpandedKeys = react.useMemo(() => expandKeysWithAncestors(expandedKeys, index), [expandedKeys, index]);
5150
+ const resolvedDefaultExpandedKeys = react.useMemo(() => expandKeysWithAncestors(defaultExpandedKeys, index), [defaultExpandedKeys, index]);
5151
+ const [internalSelectedKeys, setInternalSelectedKeys] = react.useState(() => applySelectionChange(/* @__PURE__ */ new Set(), selectionToSet(selectedKeys ?? defaultSelectedKeys, index), index));
5152
+ react.useEffect(() => {
5153
+ const nextSelectedKeys = selectedKeys != null ? applySelectionChange(/* @__PURE__ */ new Set(), selectionToSet(selectedKeys, index), index) : reconcileParentKeys(sanitizeSelection(internalSelectedKeys, index), index);
5154
+ if (nextSelectedKeys.size !== internalSelectedKeys.size || Array.from(nextSelectedKeys).some((key) => !internalSelectedKeys.has(key))) setInternalSelectedKeys(nextSelectedKeys);
5155
+ }, [
5156
+ index,
5157
+ internalSelectedKeys,
5158
+ selectedKeys
5159
+ ]);
5160
+ const selectedKeysRef = react.useRef(internalSelectedKeys);
5161
+ selectedKeysRef.current = internalSelectedKeys;
5162
+ const commitSelection = react.useCallback((nextSelectedKeys) => {
5163
+ setInternalSelectedKeys(nextSelectedKeys);
5164
+ onSelectionChange?.(new Set(nextSelectedKeys));
5165
+ }, [onSelectionChange]);
5166
+ const toggleSelection = react.useCallback((key) => {
5167
+ if (selectionMode !== "multiple" || index.disabledKeys.has(key)) return;
5168
+ const nextSelectedKeys = new Set(selectedKeysRef.current);
5169
+ if (nextSelectedKeys.has(key)) nextSelectedKeys.delete(key);
5170
+ else nextSelectedKeys.add(key);
5171
+ commitSelection(applySelectionChange(selectedKeysRef.current, nextSelectedKeys, index));
5172
+ }, [
5173
+ commitSelection,
5174
+ index,
5175
+ selectionMode
5176
+ ]);
5177
+ const handleSelectionChange = react.useCallback((nextSelection) => {
5178
+ if (selectionMode !== "multiple") {
5179
+ commitSelection(selectionToSet(nextSelection, index));
5180
+ return;
5181
+ }
5182
+ commitSelection(applySelectionChange(selectedKeysRef.current, selectionToSet(nextSelection, index), index));
5183
+ }, [
5184
+ commitSelection,
5185
+ index,
5186
+ selectionMode
5187
+ ]);
5188
+ const selectionContext = react.useMemo(() => ({
5189
+ index,
5190
+ selectedKeys: internalSelectedKeys,
5191
+ selectionMode,
5192
+ toggleSelection
5193
+ }), [
5194
+ index,
5195
+ internalSelectedKeys,
5196
+ selectionMode,
5197
+ toggleSelection
5198
+ ]);
5199
+ return /* @__PURE__ */ react.createElement(TreeSelectionContext.Provider, { value: selectionContext }, /* @__PURE__ */ react.createElement(react_aria_components.Tree, {
5200
+ ...props,
5201
+ selectionBehavior: "toggle",
5202
+ className: clsx(Tree_module_default.root, classNameOverride),
5203
+ items,
5204
+ selectedKeys: internalSelectedKeys,
5205
+ selectionMode,
5206
+ onSelectionChange: handleSelectionChange,
5207
+ expandedKeys: resolvedExpandedKeys,
5208
+ defaultExpandedKeys: resolvedDefaultExpandedKeys
5209
+ }, /* @__PURE__ */ react.createElement(react_aria_components.Collection, { items }, renderTreeItem)));
5210
+ }
5211
+ //#endregion
4976
5212
  exports.Alert = Alert;
4977
5213
  exports.Anchor = Anchor;
4978
5214
  exports.AutocompleteField = AutocompleteField;
@@ -4993,6 +5229,7 @@ exports.Drawer = Drawer;
4993
5229
  exports.EmptyState = EmptyState;
4994
5230
  exports.IconButton = IconButton;
4995
5231
  exports.InputRow = InputRow;
5232
+ exports.Label = Label;
4996
5233
  exports.Link = Link;
4997
5234
  exports.ListItem = ListItem;
4998
5235
  exports.Menu = Menu;
@@ -5026,6 +5263,7 @@ exports.TextField = TextField;
5026
5263
  exports.Toast = Toast;
5027
5264
  exports.Tooltip = Tooltip;
5028
5265
  exports.TopNav = TopNav;
5266
+ exports.Tree = Tree;
5029
5267
  exports.VerticalNavigation = VerticalNavigation;
5030
5268
  exports.VisuallyHidden = VisuallyHidden;
5031
5269
  exports.submenuPanelClassName = submenuPanelClassName;