@capra/core 1.12.0 → 1.14.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.cjs CHANGED
@@ -269,12 +269,12 @@ Label.displayName = "Label";
269
269
  //#endregion
270
270
  //#region src/components/TextInput/TextInput.module.css
271
271
  var TextInput_module_default = {
272
- "errorIndicator": "capra-TextInput-module-pTHfnG-errorIndicator",
273
- "input": "capra-TextInput-module-pTHfnG-input",
274
- "leadingSlot": "capra-TextInput-module-pTHfnG-leadingSlot",
275
- "trailingSlot": "capra-TextInput-module-pTHfnG-trailingSlot",
276
- "warningIndicator": "capra-TextInput-module-pTHfnG-warningIndicator",
277
- "wrapper": "capra-TextInput-module-pTHfnG-wrapper"
272
+ "errorIndicator": "capra-TextInput-module--5NVeG-errorIndicator",
273
+ "input": "capra-TextInput-module--5NVeG-input",
274
+ "leadingSlot": "capra-TextInput-module--5NVeG-leadingSlot",
275
+ "trailingSlot": "capra-TextInput-module--5NVeG-trailingSlot",
276
+ "warningIndicator": "capra-TextInput-module--5NVeG-warningIndicator",
277
+ "wrapper": "capra-TextInput-module--5NVeG-wrapper"
278
278
  };
279
279
  //#endregion
280
280
  //#region src/components/TextInput/TextInput.tsx
@@ -346,11 +346,50 @@ HelperText.displayName = "HelperText";
346
346
  //#endregion
347
347
  //#region src/components/input-helpers/fieldLayout.module.css
348
348
  var fieldLayout_module_default = {
349
- "field": "capra-fieldLayout-module-GZD11W-field",
350
- "fieldContent": "capra-fieldLayout-module-GZD11W-fieldContent",
351
- "labelRow": "capra-fieldLayout-module-GZD11W-labelRow"
349
+ "field": "capra-fieldLayout-module-0mM4jW-field",
350
+ "fieldContent": "capra-fieldLayout-module-0mM4jW-fieldContent",
351
+ "labelRow": "capra-fieldLayout-module-0mM4jW-labelRow"
352
352
  };
353
353
  //#endregion
354
+ //#region src/components/input-helpers/useAnchorWidth.ts
355
+ /**
356
+ * Element that visually bounds the field (select trigger or text input shell). The popover matches
357
+ * its width and left edge, which differs from the field root in horizontal layouts where the label
358
+ * sits beside the control.
359
+ */
360
+ function getShellElement(anchor) {
361
+ return anchor.querySelector("[data-capra-anchor-width-target]") ?? anchor.querySelector("[data-capra-text-input]") ?? anchor;
362
+ }
363
+ /** Element React Aria anchors the popover to: the select trigger or the combobox input. */
364
+ function getTriggerElement(anchor) {
365
+ return anchor.querySelector("[data-capra-anchor-width-target]") ?? anchor.querySelector("input") ?? anchor;
366
+ }
367
+ function useAnchorWidth(additionalDependencies = []) {
368
+ const anchorRef = react.useRef(null);
369
+ const [width, setWidth] = react.useState(null);
370
+ const [offset, setOffset] = react.useState(0);
371
+ react.useEffect(() => {
372
+ const anchor = anchorRef.current;
373
+ if (!anchor) return;
374
+ const measure = () => {
375
+ const shell = getShellElement(anchor);
376
+ const trigger = getTriggerElement(anchor);
377
+ setWidth(shell.offsetWidth + "px");
378
+ setOffset(shell.getBoundingClientRect().left - trigger.getBoundingClientRect().left);
379
+ };
380
+ const observer = new ResizeObserver(measure);
381
+ observer.observe(anchor);
382
+ const shell = getShellElement(anchor);
383
+ if (shell !== anchor) observer.observe(shell);
384
+ return () => observer.disconnect();
385
+ }, additionalDependencies);
386
+ return [
387
+ anchorRef,
388
+ width,
389
+ offset
390
+ ];
391
+ }
392
+ //#endregion
354
393
  //#region src/components/Autocomplete/AutocompleteField.module.css
355
394
  var AutocompleteField_module_default = {
356
395
  "item": "capra-AutocompleteField-module-MVvKYa-item",
@@ -409,41 +448,6 @@ function AutocompleteFieldWithoutRef(props, ref) {
409
448
  style: { width: shouldAutoSizeDropdown ? width : void 0 }
410
449
  }, /* @__PURE__ */ react.default.createElement(react_aria_components.ListBox, { className: AutocompleteField_module_default.listbox }, children)));
411
450
  }
412
- function useResizeObserver({ ref, onResize, additionalDependencies = [] }) {
413
- react.default.useEffect(() => {
414
- if (!ref.current) return;
415
- const observer = new ResizeObserver((entries) => {
416
- onResize(entries[0]);
417
- });
418
- observer.observe(ref.current);
419
- return () => observer.disconnect();
420
- }, [
421
- ref,
422
- onResize,
423
- ...additionalDependencies
424
- ]);
425
- }
426
- function useAnchorWidth(additionalDependencies = []) {
427
- const anchorRef = react.default.useRef(null);
428
- const [width, setWidth] = (0, react.useState)(null);
429
- const [offset, setOffset] = (0, react.useState)(0);
430
- useResizeObserver({
431
- ref: anchorRef,
432
- onResize: (0, react.useCallback)(() => {
433
- if (anchorRef.current) {
434
- setWidth(anchorRef.current.offsetWidth + "px");
435
- const input = anchorRef.current.querySelector("input");
436
- if (input) setOffset(anchorRef.current.offsetLeft - input.offsetLeft);
437
- }
438
- }, [anchorRef]),
439
- additionalDependencies
440
- });
441
- return [
442
- anchorRef,
443
- width,
444
- offset
445
- ];
446
- }
447
451
  /**
448
452
  * AutocompleteField combines a text field with a suggestions list. Consumers can supply static `AutocompleteField.Item` children or an `items` collection with an optional default item renderer. The field allows custom values that are not in the list.
449
453
  */
@@ -585,18 +589,23 @@ var Badge_module_default = {
585
589
  /**
586
590
  * Badges display an indicator/counter on an associated component.
587
591
  */
588
- function Badge({ appearance = "danger", variant = "counter", size = "md", count = 0, showZero = false, overflowCount = 99, FORCE__className, style, ...props }) {
592
+ function Badge({ appearance = "danger", variant = "counter", size = "md", count = 0, showZero = false, overflowCount = 99, decorative, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, FORCE__className, style, ...props }) {
589
593
  if (variant === "counter" && !showZero && !count) return null;
590
594
  const getBadgeContent = () => {
591
595
  if (variant === "dot") return null;
592
596
  const value = Math.max(count, 0);
593
597
  return value > overflowCount ? `${overflowCount}+` : value;
594
598
  };
599
+ const role = decorative ? void 0 : variant === "dot" ? "img" : "status";
595
600
  return /* @__PURE__ */ react.createElement("span", {
601
+ "aria-hidden": decorative || void 0,
602
+ "aria-label": decorative ? void 0 : ariaLabel,
603
+ "aria-labelledby": decorative ? void 0 : ariaLabelledBy,
596
604
  className: clsx(Badge_module_default.badge, FORCE__className),
597
605
  "data-appearance": appearance,
598
606
  "data-size": size,
599
607
  "data-variant": variant,
608
+ role,
600
609
  style,
601
610
  ...props
602
611
  }, getBadgeContent());
@@ -834,7 +843,7 @@ function RadioTileWithoutRef({ children, checked, disabled, description, icon, F
834
843
  const RadioTile = fixedForwardRef(RadioTileWithoutRef);
835
844
  //#endregion
836
845
  //#region src/components/Switch/Switch.module.css
837
- var Switch_module_default = { "switch": "capra-Switch-module-16LYpW-switch" };
846
+ var Switch_module_default = { "switch": "capra-Switch-module-j8Yc-q-switch" };
838
847
  //#endregion
839
848
  //#region src/components/Switch/Switch.tsx
840
849
  const Switch = react.forwardRef((props, ref) => {
@@ -944,9 +953,11 @@ function Tag({ draggable, color = "default", icon: Icon, children, size = "md",
944
953
  //#endregion
945
954
  //#region src/components/Checkbox/Checkbox.module.css
946
955
  var Checkbox_module_default = {
947
- "base": "capra-Checkbox-module-EcGsRq-base",
948
- "input": "capra-Checkbox-module-EcGsRq-input",
949
- "label": "capra-Checkbox-module-EcGsRq-label"
956
+ "base": "capra-Checkbox-module-IniPuq-base",
957
+ "inner": "capra-Checkbox-module-IniPuq-inner",
958
+ "input": "capra-Checkbox-module-IniPuq-input",
959
+ "label": "capra-Checkbox-module-IniPuq-label",
960
+ "text": "capra-Checkbox-module-IniPuq-text"
950
961
  };
951
962
  //#endregion
952
963
  //#region src/components/Checkbox/Checkbox.tsx
@@ -1014,6 +1025,27 @@ const Checkbox = react.forwardRef((props, ref) => {
1014
1025
  }, children));
1015
1026
  });
1016
1027
  Checkbox.displayName = "Checkbox";
1028
+ const RACCheckbox = react.forwardRef((props, ref) => {
1029
+ const { indeterminate, disabled, checked, defaultChecked, children, onChange, id, name, value, slot, FORCE__className: classNameOverride } = props;
1030
+ const hasLabel = Boolean(children);
1031
+ const inputRef = react.useRef(null);
1032
+ react.useImperativeHandle(ref, () => inputRef.current);
1033
+ return /* @__PURE__ */ react.createElement(react_aria_components.Checkbox, {
1034
+ id,
1035
+ name,
1036
+ value: value?.toString(),
1037
+ slot,
1038
+ className: clsx(Checkbox_module_default.base, classNameOverride),
1039
+ isSelected: checked,
1040
+ defaultSelected: defaultChecked,
1041
+ isIndeterminate: indeterminate,
1042
+ isDisabled: disabled,
1043
+ "data-has-label": hasLabel ? "true" : "false",
1044
+ onChange,
1045
+ inputRef
1046
+ }, ({ isIndeterminate, isSelected }) => /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement("div", { className: Checkbox_module_default.input }, /* @__PURE__ */ react.createElement("div", { className: Checkbox_module_default.inner }), isIndeterminate ? /* @__PURE__ */ react.createElement(IndeterminateIcon, null) : isSelected ? /* @__PURE__ */ react.createElement(CheckedIcon, null) : null), /* @__PURE__ */ react.createElement("div", { className: Checkbox_module_default.text }, children)));
1047
+ });
1048
+ RACCheckbox.displayName = "RACCheckbox";
1017
1049
  //#endregion
1018
1050
  //#region src/components/Collapse/Collapse.module.css
1019
1051
  var Collapse_module_default = {
@@ -1178,12 +1210,12 @@ PasswordField.displayName = "PasswordField";
1178
1210
  //#endregion
1179
1211
  //#region src/components/NumberField/NumberField.module.css
1180
1212
  var NumberField_module_default = {
1181
- "slotAlign": "capra-NumberField-module-crO5za-slotAlign",
1182
- "stepButton": "capra-NumberField-module-crO5za-stepButton",
1183
- "stepDivider": "capra-NumberField-module-crO5za-stepDivider",
1184
- "stepIcon": "capra-NumberField-module-crO5za-stepIcon",
1185
- "stepper": "capra-NumberField-module-crO5za-stepper",
1186
- "withStepper": "capra-NumberField-module-crO5za-withStepper"
1213
+ "slotAlign": "capra-NumberField-module-IscOzq-slotAlign",
1214
+ "stepButton": "capra-NumberField-module-IscOzq-stepButton",
1215
+ "stepDivider": "capra-NumberField-module-IscOzq-stepDivider",
1216
+ "stepIcon": "capra-NumberField-module-IscOzq-stepIcon",
1217
+ "stepper": "capra-NumberField-module-IscOzq-stepper",
1218
+ "withStepper": "capra-NumberField-module-IscOzq-withStepper"
1187
1219
  };
1188
1220
  //#endregion
1189
1221
  //#region src/components/NumberField/NumberField.tsx
@@ -2313,6 +2345,430 @@ const DatePickerFieldWithRef = react.forwardRef(DatePickerFieldInner);
2313
2345
  DatePickerFieldWithRef.displayName = "DatePickerField";
2314
2346
  const DatePickerField = DatePickerFieldWithRef;
2315
2347
  //#endregion
2348
+ //#region src/components/SelectField/SelectField.module.css
2349
+ var SelectField_module_default = {
2350
+ "chevron": "capra-SelectField-module-KwnLuW-chevron",
2351
+ "dropdownPanel": "capra-SelectField-module-KwnLuW-dropdownPanel",
2352
+ "emptyState": "capra-SelectField-module-KwnLuW-emptyState",
2353
+ "errorIndicator": "capra-SelectField-module-KwnLuW-errorIndicator",
2354
+ "header": "capra-SelectField-module-KwnLuW-header",
2355
+ "item": "capra-SelectField-module-KwnLuW-item",
2356
+ "itemCheck": "capra-SelectField-module-KwnLuW-itemCheck",
2357
+ "itemContent": "capra-SelectField-module-KwnLuW-itemContent",
2358
+ "leadingSlot": "capra-SelectField-module-KwnLuW-leadingSlot",
2359
+ "listbox": "capra-SelectField-module-KwnLuW-listbox",
2360
+ "multipleOpenButton": "capra-SelectField-module-KwnLuW-multipleOpenButton",
2361
+ "multipleTrigger": "capra-SelectField-module-KwnLuW-multipleTrigger",
2362
+ "search": "capra-SelectField-module-KwnLuW-search",
2363
+ "section": "capra-SelectField-module-KwnLuW-section",
2364
+ "singleTrigger": "capra-SelectField-module-KwnLuW-singleTrigger",
2365
+ "tag": "capra-SelectField-module-KwnLuW-tag",
2366
+ "tagGroup": "capra-SelectField-module-KwnLuW-tagGroup",
2367
+ "tagIcon": "capra-SelectField-module-KwnLuW-tagIcon",
2368
+ "tagLabel": "capra-SelectField-module-KwnLuW-tagLabel",
2369
+ "tagList": "capra-SelectField-module-KwnLuW-tagList",
2370
+ "tagRemove": "capra-SelectField-module-KwnLuW-tagRemove",
2371
+ "trailingSlot": "capra-SelectField-module-KwnLuW-trailingSlot",
2372
+ "triggerShell": "capra-SelectField-module-KwnLuW-triggerShell",
2373
+ "value": "capra-SelectField-module-KwnLuW-value",
2374
+ "valueIcon": "capra-SelectField-module-KwnLuW-valueIcon",
2375
+ "valueText": "capra-SelectField-module-KwnLuW-valueText",
2376
+ "warningIndicator": "capra-SelectField-module-KwnLuW-warningIndicator"
2377
+ };
2378
+ //#endregion
2379
+ //#region src/components/SelectField/SelectField.tsx
2380
+ /** When true, SelectField.Item indents by default (inside SelectField.Section that contains SelectField.Header). */
2381
+ const SelectFieldSectionIndentContext = react.createContext(false);
2382
+ function normalizeIterable(value) {
2383
+ return value === void 0 ? void 0 : Array.from(value);
2384
+ }
2385
+ function getItemLabelFromNode(node) {
2386
+ if (typeof node === "string") return node;
2387
+ if (typeof node === "number") return String(node);
2388
+ if (react.isValidElement(node)) {
2389
+ if (typeof node.props.textValue === "string") return node.props.textValue;
2390
+ return getItemLabelFromNode(node.props.children);
2391
+ }
2392
+ return "";
2393
+ }
2394
+ function removeKeysFromSelection(selection, keys) {
2395
+ return (selection ?? []).filter((selectedKey) => !keys.has(selectedKey));
2396
+ }
2397
+ function getItemIcon(item) {
2398
+ if (item && typeof item === "object" && "icon" in item) {
2399
+ const icon = item.icon;
2400
+ return icon && typeof icon === "object" && "__brand" in icon ? icon : void 0;
2401
+ }
2402
+ }
2403
+ function isDefaultSection(item) {
2404
+ const children = item.children;
2405
+ return children != null && typeof children !== "string" && typeof children[Symbol.iterator] === "function";
2406
+ }
2407
+ function SelectFieldIndicators(props) {
2408
+ const { appearance } = props;
2409
+ return /* @__PURE__ */ react.createElement(react.Fragment, null, appearance === "warning" ? /* @__PURE__ */ react.createElement("span", {
2410
+ className: SelectField_module_default.warningIndicator,
2411
+ "aria-hidden": true
2412
+ }, /* @__PURE__ */ react.createElement(_capra_icons.WarningOutlined, { size: "sm" })) : null, appearance === "danger" ? /* @__PURE__ */ react.createElement("span", {
2413
+ className: SelectField_module_default.errorIndicator,
2414
+ "aria-hidden": true
2415
+ }, /* @__PURE__ */ react.createElement(_capra_icons.Exclamation, { size: "sm" })) : null, /* @__PURE__ */ react.createElement("span", {
2416
+ className: SelectField_module_default.chevron,
2417
+ "aria-hidden": true
2418
+ }, /* @__PURE__ */ react.createElement(_capra_icons.ChevronDown, { size: "sm" })));
2419
+ }
2420
+ function SelectFieldTriggerButton(props) {
2421
+ const { appearance, buttonRef, children, className, ...rest } = props;
2422
+ const localRef = react.useRef(null);
2423
+ const ref = buttonRef ?? localRef;
2424
+ const [mergedProps, mergedRef] = (0, react_aria_components.useContextProps)({
2425
+ ...rest,
2426
+ className
2427
+ }, ref, react_aria_components.ButtonContext);
2428
+ const { buttonProps, isPressed } = (0, react_aria.useButton)(mergedProps, mergedRef);
2429
+ const { focusProps, isFocused, isFocusVisible } = (0, react_aria.useFocusRing)(mergedProps);
2430
+ return /* @__PURE__ */ react.createElement("button", {
2431
+ ...(0, react_aria.mergeProps)(buttonProps, focusProps),
2432
+ ref: mergedRef,
2433
+ className,
2434
+ "aria-invalid": appearance === "danger" ? true : void 0,
2435
+ "data-pressed": isPressed || void 0,
2436
+ "data-focused": isFocused || void 0,
2437
+ "data-focus-visible": isFocusVisible || void 0,
2438
+ "data-disabled": mergedProps.isDisabled || void 0
2439
+ }, children);
2440
+ }
2441
+ function SelectFieldTrigger(props) {
2442
+ const { appearance, disabled, leadingSlot, placeholder, required, selectedItemsLabel, size, triggerRef } = props;
2443
+ const state = react.useContext(react_aria_components.SelectStateContext);
2444
+ const openButtonRef = react.useRef(null);
2445
+ if (!state) return null;
2446
+ if (!(state.selectionManager.selectionMode === "multiple")) return /* @__PURE__ */ react.createElement(SelectFieldTriggerButton, {
2447
+ appearance,
2448
+ className: clsx(SelectField_module_default.triggerShell, SelectField_module_default.singleTrigger),
2449
+ "data-capra-anchor-width-target": "",
2450
+ "data-size": size,
2451
+ "data-disabled": disabled || void 0,
2452
+ "aria-required": required || void 0,
2453
+ isDisabled: disabled
2454
+ }, leadingSlot ? /* @__PURE__ */ react.createElement("span", { className: SelectField_module_default.leadingSlot }, leadingSlot) : null, /* @__PURE__ */ react.createElement(react_aria_components.SelectValue, { className: SelectField_module_default.value }, ({ isPlaceholder, selectedText, selectedItems }) => {
2455
+ const ValueIcon = getItemIcon(selectedItems[0]);
2456
+ return /* @__PURE__ */ react.createElement(react.Fragment, null, ValueIcon ? /* @__PURE__ */ react.createElement("span", {
2457
+ className: SelectField_module_default.valueIcon,
2458
+ "aria-hidden": true
2459
+ }, /* @__PURE__ */ react.createElement(ValueIcon, { size: "sm" })) : null, /* @__PURE__ */ react.createElement("span", {
2460
+ className: SelectField_module_default.valueText,
2461
+ "data-placeholder": isPlaceholder || !selectedText || void 0
2462
+ }, selectedText || placeholder));
2463
+ }), /* @__PURE__ */ react.createElement("span", { className: SelectField_module_default.trailingSlot }, /* @__PURE__ */ react.createElement(SelectFieldIndicators, { appearance })));
2464
+ const hasSelection = !state.selectionManager.isEmpty;
2465
+ const handleEmptyTriggerPress = (event) => {
2466
+ if (disabled || hasSelection || state.isOpen) return;
2467
+ if (event.target.closest("button")) return;
2468
+ openButtonRef.current?.focus();
2469
+ state.open();
2470
+ };
2471
+ return /* @__PURE__ */ react.createElement(react_aria_components.Group, {
2472
+ ref: triggerRef,
2473
+ className: clsx(SelectField_module_default.triggerShell, SelectField_module_default.multipleTrigger),
2474
+ "data-capra-anchor-width-target": "",
2475
+ "data-size": size,
2476
+ "data-disabled": disabled || void 0,
2477
+ "data-empty": hasSelection ? void 0 : "",
2478
+ onClick: handleEmptyTriggerPress
2479
+ }, leadingSlot ? /* @__PURE__ */ react.createElement("span", { className: SelectField_module_default.leadingSlot }, leadingSlot) : null, /* @__PURE__ */ react.createElement(react_aria_components.ButtonContext.Provider, { value: null }, /* @__PURE__ */ react.createElement(react_aria_components.SelectValue, { className: SelectField_module_default.value }, ({ state: selectState }) => {
2480
+ const tagItems = selectState.selectedItems.filter((item) => item != null).map((item) => ({
2481
+ id: item.key,
2482
+ label: item.textValue || getItemLabelFromNode(item.rendered) || String(item.key),
2483
+ icon: getItemIcon(item.value)
2484
+ }));
2485
+ return /* @__PURE__ */ react.createElement(react_aria_components.TagGroup, {
2486
+ "aria-label": selectedItemsLabel,
2487
+ className: SelectField_module_default.tagGroup,
2488
+ onRemove: disabled ? void 0 : (keys) => {
2489
+ const value = selectState.value;
2490
+ if (Array.isArray(value)) selectState.setValue(removeKeysFromSelection(value, keys));
2491
+ }
2492
+ }, /* @__PURE__ */ react.createElement(react_aria_components.TagList, {
2493
+ className: SelectField_module_default.tagList,
2494
+ items: tagItems,
2495
+ renderEmptyState: () => /* @__PURE__ */ react.createElement("span", {
2496
+ className: SelectField_module_default.valueText,
2497
+ "data-placeholder": placeholder ? true : void 0
2498
+ }, placeholder)
2499
+ }, (item) => /* @__PURE__ */ react.createElement(react_aria_components.Tag, {
2500
+ id: item.id,
2501
+ textValue: item.label,
2502
+ className: SelectField_module_default.tag,
2503
+ "data-size": size === "sm" ? "sm" : "md"
2504
+ }, ({ allowsRemoving }) => /* @__PURE__ */ react.createElement(react.Fragment, null, item.icon ? /* @__PURE__ */ react.createElement("span", {
2505
+ className: SelectField_module_default.tagIcon,
2506
+ "aria-hidden": true
2507
+ }, /* @__PURE__ */ react.createElement(item.icon, { size: "xs" })) : null, /* @__PURE__ */ react.createElement("span", { className: SelectField_module_default.tagLabel }, item.label), allowsRemoving ? /* @__PURE__ */ react.createElement(react_aria_components.Button, {
2508
+ slot: "remove",
2509
+ className: SelectField_module_default.tagRemove,
2510
+ "aria-label": "Delete",
2511
+ excludeFromTabOrder: true
2512
+ }, /* @__PURE__ */ react.createElement(_capra_icons.CloseOutlined, { size: "xs" })) : null))));
2513
+ })), /* @__PURE__ */ react.createElement(SelectFieldTriggerButton, {
2514
+ appearance,
2515
+ buttonRef: openButtonRef,
2516
+ className: SelectField_module_default.multipleOpenButton,
2517
+ isDisabled: disabled,
2518
+ "aria-required": required || void 0
2519
+ }, /* @__PURE__ */ react.createElement("span", { className: SelectField_module_default.trailingSlot }, /* @__PURE__ */ react.createElement(SelectFieldIndicators, { appearance }))));
2520
+ }
2521
+ function SelectFieldItem(props) {
2522
+ const { id, textValue, isDisabled, indent: indentProp, value, children } = props;
2523
+ const indentFromSectionHeader = react.useContext(SelectFieldSectionIndentContext);
2524
+ const indent = indentProp !== void 0 ? indentProp : indentFromSectionHeader;
2525
+ return /* @__PURE__ */ react.createElement(react_aria_components.ListBoxItem, {
2526
+ id,
2527
+ value,
2528
+ textValue: textValue || getItemLabelFromNode(children),
2529
+ isDisabled,
2530
+ className: SelectField_module_default.item,
2531
+ "data-indent": indent || void 0
2532
+ }, ({ isSelected, selectionMode }) => /* @__PURE__ */ react.createElement("div", { className: SelectField_module_default.itemContent }, selectionMode === "multiple" ? /* @__PURE__ */ react.createElement("span", {
2533
+ className: SelectField_module_default.itemCheck,
2534
+ "data-selected": isSelected || void 0,
2535
+ "aria-hidden": true
2536
+ }, isSelected ? /* @__PURE__ */ react.createElement(_capra_icons.CheckOutlined, { size: "sm" }) : null) : null, typeof children === "string" ? /* @__PURE__ */ react.createElement(Text, { slot: "label" }, children) : children));
2537
+ }
2538
+ function SelectFieldHeader(props) {
2539
+ const { id, label = "Header", FORCE__className: classNameOverride, children } = props;
2540
+ return /* @__PURE__ */ react.createElement(react_aria_components.Header, {
2541
+ id,
2542
+ className: clsx(SelectField_module_default.header, classNameOverride)
2543
+ }, children ?? label);
2544
+ }
2545
+ SelectFieldHeader.displayName = "SelectField.Header";
2546
+ function isSelectFieldHeaderElement(child) {
2547
+ return react.isValidElement(child) && child.type === SelectFieldHeader;
2548
+ }
2549
+ function SelectFieldSection(props) {
2550
+ const { children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, FORCE__className: classNameOverride, className, ...rest } = props;
2551
+ const autoHeaderId = react.useId();
2552
+ const childArray = react.Children.toArray(children);
2553
+ let headerIndex = -1;
2554
+ for (let i = 0; i < childArray.length; i++) if (isSelectFieldHeaderElement(childArray[i])) {
2555
+ headerIndex = i;
2556
+ break;
2557
+ }
2558
+ const hasHeader = headerIndex >= 0;
2559
+ if (process.env.NODE_ENV !== "production") {
2560
+ if (!hasHeader && !ariaLabel?.trim() && !ariaLabelledBy?.trim()) console.error("SelectField.Section: provide aria-label or aria-labelledby when the section has no direct SelectField.Header child.");
2561
+ }
2562
+ const labelledBy = hasHeader ? ariaLabelledBy ?? autoHeaderId : ariaLabelledBy;
2563
+ const effectiveAriaLabel = hasHeader ? void 0 : ariaLabel;
2564
+ const resolvedChildren = hasHeader && headerIndex >= 0 ? childArray.map((child, i) => {
2565
+ if (i === headerIndex && isSelectFieldHeaderElement(child)) return react.cloneElement(child, { id: child.props.id ?? autoHeaderId });
2566
+ return child;
2567
+ }) : children;
2568
+ return /* @__PURE__ */ react.createElement(SelectFieldSectionIndentContext.Provider, { value: hasHeader }, /* @__PURE__ */ react.createElement(react_aria_components.ListBoxSection, {
2569
+ "aria-label": effectiveAriaLabel,
2570
+ "aria-labelledby": labelledBy,
2571
+ className: clsx(SelectField_module_default.section, className, classNameOverride),
2572
+ ...rest
2573
+ }, resolvedChildren));
2574
+ }
2575
+ SelectFieldSection.displayName = "SelectField.Section";
2576
+ function defaultSelectFieldItemRenderer(item) {
2577
+ if (isDefaultSection(item)) {
2578
+ const { id, label, "aria-label": ariaLabel, children } = item;
2579
+ return /* @__PURE__ */ react.createElement(SelectFieldSection, {
2580
+ key: String(id),
2581
+ "aria-label": label ? void 0 : ariaLabel
2582
+ }, label ? /* @__PURE__ */ react.createElement(SelectFieldHeader, { label }) : null, /* @__PURE__ */ react.createElement(react_aria_components.Collection, { items: children }, (child) => defaultSelectFieldItemRenderer(child)));
2583
+ }
2584
+ const Icon = item.icon;
2585
+ return /* @__PURE__ */ react.createElement(SelectFieldItem, {
2586
+ id: item.id,
2587
+ textValue: item.label
2588
+ }, Icon ? /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(Icon, { size: "sm" }), /* @__PURE__ */ react.createElement(Text, { slot: "label" }, item.label)) : item.label);
2589
+ }
2590
+ function SelectFieldLabel(props) {
2591
+ const { children, required } = props;
2592
+ const { elementType: _elementType, ...labelContextWithoutElementType } = (0, react_aria_components.useSlottedContext)(react_aria_components.LabelContext) ?? {};
2593
+ return /* @__PURE__ */ react.createElement(react_aria_components.LabelContext.Provider, { value: labelContextWithoutElementType }, /* @__PURE__ */ react.createElement(Label, { required }, children));
2594
+ }
2595
+ function AutocompleteTextInput(props) {
2596
+ const { placeholder, shouldFocus, size } = props;
2597
+ const ref = react.useRef(null);
2598
+ const [mergedProps, mergedRef] = (0, react_aria_components.useContextProps)({
2599
+ "aria-label": props["aria-label"],
2600
+ placeholder,
2601
+ type: "search"
2602
+ }, ref, react_aria_components.FieldInputContext);
2603
+ const { onChange, value, ...inputProps } = mergedProps;
2604
+ const inputRef = mergedRef;
2605
+ react.useLayoutEffect(() => {
2606
+ if (!shouldFocus) return;
2607
+ const input = inputRef.current;
2608
+ if (!input) return;
2609
+ requestAnimationFrame(() => {
2610
+ try {
2611
+ input.focus({ preventScroll: true });
2612
+ } catch {}
2613
+ });
2614
+ }, [inputRef, shouldFocus]);
2615
+ return /* @__PURE__ */ react.createElement(TextInput, {
2616
+ ...inputProps,
2617
+ ref: inputRef,
2618
+ size,
2619
+ value: typeof value === "string" ? value : "",
2620
+ onChange: (event) => {
2621
+ onChange?.(event.target.value);
2622
+ }
2623
+ });
2624
+ }
2625
+ function SelectFieldInner(props, ref) {
2626
+ const { appearance = "default", autoFocus, canSearch, defaultOpen, disabled, disabledKeys, helperText, id, isOpen, items, children, label, layout, leadingSlot, name, onOpenChange, placeholder, required, searchPlaceholder, selectionMode = "single", shouldAutoSizeDropdown = true, size = "md", FORCE__className: classNameOverride, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy } = props;
2627
+ const [searchValue, setSearchValue] = react.useState("");
2628
+ const [popoverWidth, setPopoverWidth] = react.useState();
2629
+ const [uncontrolledOpen, setUncontrolledOpen] = react.useState(Boolean(defaultOpen));
2630
+ const isPopoverOpen = isOpen ?? uncontrolledOpen;
2631
+ const { contains } = (0, react_aria_components.useFilter)({ sensitivity: "base" });
2632
+ const [anchorRef, width, offset] = useAnchorWidth([
2633
+ canSearch,
2634
+ selectionMode,
2635
+ size
2636
+ ]);
2637
+ const multipleTriggerRef = react.useRef(null);
2638
+ const selectedItemsLabel = label ? `Selected ${label}` : ariaLabel ?? "Selected items";
2639
+ react.useImperativeHandle(ref, () => anchorRef.current, [anchorRef]);
2640
+ react.useLayoutEffect(() => {
2641
+ const trigger = multipleTriggerRef.current ?? anchorRef.current;
2642
+ if (selectionMode !== "multiple" || !isPopoverOpen || popoverWidth || !trigger) return;
2643
+ setPopoverWidth(`${trigger.offsetWidth}px`);
2644
+ }, [
2645
+ isPopoverOpen,
2646
+ popoverWidth,
2647
+ selectionMode,
2648
+ width,
2649
+ anchorRef
2650
+ ]);
2651
+ const itemList = react.useMemo(() => items ? Array.from(items) : void 0, [items]);
2652
+ const resolvedChildren = children ?? (itemList ? defaultSelectFieldItemRenderer : void 0);
2653
+ const handleOpenChange = react.useCallback((nextOpen) => {
2654
+ if (isOpen === void 0) setUncontrolledOpen(nextOpen);
2655
+ if (selectionMode === "multiple" && !nextOpen) setPopoverWidth(void 0);
2656
+ if (!nextOpen) setSearchValue("");
2657
+ onOpenChange?.(nextOpen);
2658
+ }, [
2659
+ isOpen,
2660
+ onOpenChange,
2661
+ selectionMode
2662
+ ]);
2663
+ const dropdownWidth = selectionMode === "multiple" ? popoverWidth ?? width ?? void 0 : width ?? void 0;
2664
+ const listBoxSearchProps = canSearch ? {
2665
+ autoFocus: false,
2666
+ renderEmptyState: () => /* @__PURE__ */ react.createElement("span", { className: SelectField_module_default.emptyState }, "No results")
2667
+ } : {};
2668
+ const listBox = /* @__PURE__ */ react.createElement(react_aria_components.ListBox, {
2669
+ ...listBoxSearchProps,
2670
+ className: SelectField_module_default.listbox,
2671
+ "data-selection-mode": selectionMode,
2672
+ items: itemList
2673
+ }, resolvedChildren);
2674
+ const popoverContent = canSearch ? /* @__PURE__ */ react.createElement(react_aria_components.Autocomplete, {
2675
+ filter: contains,
2676
+ inputValue: searchValue,
2677
+ onInputChange: setSearchValue
2678
+ }, /* @__PURE__ */ react.createElement("div", { className: SelectField_module_default.search }, /* @__PURE__ */ react.createElement(AutocompleteTextInput, {
2679
+ "aria-label": searchPlaceholder || "Search",
2680
+ placeholder: searchPlaceholder || "Search",
2681
+ shouldFocus: isPopoverOpen,
2682
+ size
2683
+ })), listBox) : listBox;
2684
+ const selectContent = /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement("div", { className: fieldLayout_module_default.labelRow }, /* @__PURE__ */ react.createElement(SelectFieldLabel, { required }, label)), /* @__PURE__ */ react.createElement("div", { className: fieldLayout_module_default.fieldContent }, /* @__PURE__ */ react.createElement(SelectFieldTrigger, {
2685
+ appearance,
2686
+ disabled,
2687
+ leadingSlot,
2688
+ placeholder,
2689
+ required,
2690
+ selectedItemsLabel,
2691
+ size,
2692
+ triggerRef: selectionMode === "multiple" ? multipleTriggerRef : void 0
2693
+ }), /* @__PURE__ */ react.createElement(HelperText, {
2694
+ appearance,
2695
+ disabled
2696
+ }, helperText)), /* @__PURE__ */ react.createElement(react_aria_components.Popover, {
2697
+ className: SelectField_module_default.dropdownPanel,
2698
+ offset: 2,
2699
+ crossOffset: offset,
2700
+ triggerRef: selectionMode === "multiple" ? multipleTriggerRef : void 0,
2701
+ style: { width: shouldAutoSizeDropdown ? dropdownWidth : void 0 }
2702
+ }, popoverContent));
2703
+ if (props.selectionMode === "multiple") {
2704
+ const handleChange = (nextValue) => {
2705
+ props.onChange?.(new Set(nextValue));
2706
+ };
2707
+ return /* @__PURE__ */ react.createElement(react_aria_components.Select, {
2708
+ id,
2709
+ ref: anchorRef,
2710
+ name,
2711
+ className: clsx(fieldLayout_module_default.field, classNameOverride),
2712
+ "data-capra-field-root": "",
2713
+ "data-layout": layout,
2714
+ isDisabled: disabled,
2715
+ isRequired: required,
2716
+ isInvalid: appearance === "danger",
2717
+ validationBehavior: "aria",
2718
+ placeholder,
2719
+ selectionMode: "multiple",
2720
+ disabledKeys,
2721
+ value: normalizeIterable(props.value),
2722
+ defaultValue: normalizeIterable(props.defaultValue),
2723
+ onChange: handleChange,
2724
+ isOpen,
2725
+ defaultOpen,
2726
+ onOpenChange: handleOpenChange,
2727
+ autoFocus,
2728
+ "aria-label": ariaLabel,
2729
+ "aria-labelledby": ariaLabelledBy,
2730
+ "aria-describedby": ariaDescribedBy
2731
+ }, selectContent);
2732
+ }
2733
+ const handleChange = (nextValue) => {
2734
+ props.onChange?.(nextValue ?? null);
2735
+ };
2736
+ return /* @__PURE__ */ react.createElement(react_aria_components.Select, {
2737
+ id,
2738
+ ref: anchorRef,
2739
+ name,
2740
+ className: clsx(fieldLayout_module_default.field, classNameOverride),
2741
+ "data-capra-field-root": "",
2742
+ "data-layout": layout,
2743
+ isDisabled: disabled,
2744
+ isRequired: required,
2745
+ isInvalid: appearance === "danger",
2746
+ validationBehavior: "aria",
2747
+ placeholder,
2748
+ selectionMode: "single",
2749
+ disabledKeys,
2750
+ value: props.value,
2751
+ defaultValue: props.defaultValue,
2752
+ onChange: handleChange,
2753
+ isOpen,
2754
+ defaultOpen,
2755
+ onOpenChange: handleOpenChange,
2756
+ autoFocus,
2757
+ "aria-label": ariaLabel,
2758
+ "aria-labelledby": ariaLabelledBy,
2759
+ "aria-describedby": ariaDescribedBy
2760
+ }, selectContent);
2761
+ }
2762
+ const SelectFieldRoot = react.forwardRef(SelectFieldInner);
2763
+ /**
2764
+ * Composed select field with Capra label/helper text layout, single and multiple selection, and an optional popover search input.
2765
+ */
2766
+ const SelectField = Object.assign(SelectFieldRoot, {
2767
+ Item: SelectFieldItem,
2768
+ Header: SelectFieldHeader,
2769
+ Section: SelectFieldSection
2770
+ });
2771
+ //#endregion
2316
2772
  //#region src/components/DateRangePickerField/DateRangePickerField.module.css
2317
2773
  var DateRangePickerField_module_default = {
2318
2774
  "cell": "capra-DateRangePickerField-module-QpPhpG-cell",
@@ -3259,8 +3715,61 @@ function ButtonLinkWithoutRef({ appearance = "default", as: asComponent, block,
3259
3715
  */
3260
3716
  const ButtonLink = fixedForwardRef(ButtonLinkWithoutRef);
3261
3717
  //#endregion
3718
+ //#region src/components/ToggleButtonGroup/ToggleButtonGroup.module.css
3719
+ var ToggleButtonGroup_module_default = { "base": "capra-ToggleButtonGroup-module-cS5LeW-base" };
3720
+ //#endregion
3721
+ //#region src/components/ToggleButtonGroup/ToggleButtonGroup.tsx
3722
+ function isIconOnlyItem(item) {
3723
+ return !("text" in item);
3724
+ }
3725
+ function renderToggleButtonItem(item, size, groupDisabled) {
3726
+ const isDisabled = groupDisabled || item.disabled;
3727
+ if (isIconOnlyItem(item)) {
3728
+ const Icon = item.icon;
3729
+ return /* @__PURE__ */ react.createElement(react_aria_components.ToggleButton, {
3730
+ key: item.key,
3731
+ id: item.key,
3732
+ isDisabled,
3733
+ "aria-label": item["aria-label"],
3734
+ className: clsx(Button_module_default.base, Button_module_default.icon),
3735
+ "data-variant": "secondary",
3736
+ "data-appearance": "default",
3737
+ "data-size": size
3738
+ }, /* @__PURE__ */ react.createElement(Icon, { size: "sm" }));
3739
+ }
3740
+ const LeadingIcon = item.icon;
3741
+ return /* @__PURE__ */ react.createElement(react_aria_components.ToggleButton, {
3742
+ key: item.key,
3743
+ id: item.key,
3744
+ isDisabled,
3745
+ "aria-label": item["aria-label"],
3746
+ className: Button_module_default.base,
3747
+ "data-variant": "secondary",
3748
+ "data-appearance": "default",
3749
+ "data-size": size
3750
+ }, LeadingIcon ? /* @__PURE__ */ react.createElement("span", { className: Button_module_default.iconLayout }, /* @__PURE__ */ react.createElement(LeadingIcon, { size: "sm" })) : null, /* @__PURE__ */ react.createElement("span", { className: Button_module_default.textLayout }, /* @__PURE__ */ react.createElement(Text, {
3751
+ color: "inherit",
3752
+ variant: "body"
3753
+ }, item.text)));
3754
+ }
3755
+ /**
3756
+ * A group of toggle buttons for choosing one or more options from a set.
3757
+ */
3758
+ function ToggleButtonGroup({ items, size = "md", disabled = false, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, disallowEmptySelection, FORCE__className: classNameOverride, ...props }) {
3759
+ return /* @__PURE__ */ react.createElement(react_aria_components.ToggleButtonGroup, {
3760
+ ...props,
3761
+ isDisabled: disabled,
3762
+ selectionMode,
3763
+ selectedKeys,
3764
+ defaultSelectedKeys,
3765
+ onSelectionChange,
3766
+ disallowEmptySelection,
3767
+ className: clsx(ToggleButtonGroup_module_default.base, classNameOverride)
3768
+ }, items.map((item) => renderToggleButtonItem(item, size, disabled)));
3769
+ }
3770
+ //#endregion
3262
3771
  //#region src/components/Link/Link.module.css
3263
- var Link_module_default = { "base": "capra-Link-module-7lYr7a-base" };
3772
+ var Link_module_default = { "base": "capra-Link-module-OvXy7G-base" };
3264
3773
  //#endregion
3265
3774
  //#region src/components/Link/Link.tsx
3266
3775
  function LinkWithoutRef({ as: asComponent, children, isExternal = false, FORCE__className: classNameOverride, ...rest }, ref) {
@@ -4120,21 +4629,21 @@ const Toast = {
4120
4629
  //#endregion
4121
4630
  //#region src/components/Menu/Menu.module.css
4122
4631
  var Menu_module_default = {
4123
- "divider": "capra-Menu-module-HIhAFW-divider",
4124
- "header": "capra-Menu-module-HIhAFW-header",
4125
- "list": "capra-Menu-module-HIhAFW-list",
4126
- "menu": "capra-Menu-module-HIhAFW-menu",
4127
- "menuItem": "capra-Menu-module-HIhAFW-menuItem",
4128
- "menuItemDescription": "capra-Menu-module-HIhAFW-menuItemDescription",
4129
- "menuItemLabel": "capra-Menu-module-HIhAFW-menuItemLabel",
4130
- "menuItemLeadingGutter": "capra-Menu-module-HIhAFW-menuItemLeadingGutter",
4131
- "menuItemListItemShell": "capra-Menu-module-HIhAFW-menuItemListItemShell",
4132
- "menuItemShortcut": "capra-Menu-module-HIhAFW-menuItemShortcut",
4133
- "menuItemTrailingGroup": "capra-Menu-module-HIhAFW-menuItemTrailingGroup",
4134
- "menuItemTrailingGutter": "capra-Menu-module-HIhAFW-menuItemTrailingGutter",
4135
- "menuTriggerSlot": "capra-Menu-module-HIhAFW-menuTriggerSlot",
4136
- "section": "capra-Menu-module-HIhAFW-section",
4137
- "slot": "capra-Menu-module-HIhAFW-slot"
4632
+ "divider": "capra-Menu-module-eTI_TG-divider",
4633
+ "header": "capra-Menu-module-eTI_TG-header",
4634
+ "list": "capra-Menu-module-eTI_TG-list",
4635
+ "menu": "capra-Menu-module-eTI_TG-menu",
4636
+ "menuItem": "capra-Menu-module-eTI_TG-menuItem",
4637
+ "menuItemDescription": "capra-Menu-module-eTI_TG-menuItemDescription",
4638
+ "menuItemLabel": "capra-Menu-module-eTI_TG-menuItemLabel",
4639
+ "menuItemLeadingGutter": "capra-Menu-module-eTI_TG-menuItemLeadingGutter",
4640
+ "menuItemListItemShell": "capra-Menu-module-eTI_TG-menuItemListItemShell",
4641
+ "menuItemShortcut": "capra-Menu-module-eTI_TG-menuItemShortcut",
4642
+ "menuItemTrailingGroup": "capra-Menu-module-eTI_TG-menuItemTrailingGroup",
4643
+ "menuItemTrailingGutter": "capra-Menu-module-eTI_TG-menuItemTrailingGutter",
4644
+ "menuTriggerSlot": "capra-Menu-module-eTI_TG-menuTriggerSlot",
4645
+ "section": "capra-Menu-module-eTI_TG-section",
4646
+ "slot": "capra-Menu-module-eTI_TG-slot"
4138
4647
  };
4139
4648
  //#endregion
4140
4649
  //#region src/components/Menu/Menu.tsx
@@ -4218,7 +4727,7 @@ const MenuSection = ({ children, "aria-label": ariaLabel, "aria-labelledby": ari
4218
4727
  }, resolvedChildren));
4219
4728
  };
4220
4729
  MenuSection.displayName = "Menu.Section";
4221
- const MenuItem = ({ as: Component, label, description, ariaLabel, href, disabled = false, active = false, variant = "default", icon, indent: indentProp, shortcut, parent = false, onPress, onClick, FORCE__className, children, ...rest }) => {
4730
+ const MenuItem = ({ as: Component, label, description, ariaLabel, href, disabled = false, active = false, variant = "default", icon, indent: indentProp, shortcut, parent = false, onPress, onClick, FORCE__className, children, allowItemLineWrap = false, ...rest }) => {
4222
4731
  const indentFromSectionHeader = react.useContext(MenuSectionIndentContext);
4223
4732
  const indent = indentProp !== void 0 ? indentProp : indentFromSectionHeader ? true : false;
4224
4733
  const labelContent = children ?? label;
@@ -4246,6 +4755,7 @@ const MenuItem = ({ as: Component, label, description, ariaLabel, href, disabled
4246
4755
  "aria-label": ariaLabel,
4247
4756
  "aria-current": active ? "page" : void 0,
4248
4757
  className: clsx(Menu_module_default.menuItem, FORCE__className),
4758
+ "data-allow-line-wrap": allowItemLineWrap,
4249
4759
  "data-variant": variant,
4250
4760
  "data-active": active || void 0,
4251
4761
  "data-indent": indent || void 0,
@@ -4958,6 +5468,199 @@ function ArrowSvg() {
4958
5468
  }));
4959
5469
  }
4960
5470
  //#endregion
5471
+ //#region src/components/FilterToolbar/FilterToolbar.module.css
5472
+ var FilterToolbar_module_default = { "toolbar": "capra-FilterToolbar-module-1TgfVW-toolbar" };
5473
+ //#endregion
5474
+ //#region src/components/FilterToolbar/FilterToolbar.tsx
5475
+ function FilterToolbar({ filterInputProps, renderActions, renderBulkEditText, renderBulkEditActions, selectedKeys }) {
5476
+ return selectedKeys === "all" || selectedKeys.size > 0 ? /* @__PURE__ */ react.createElement("div", {
5477
+ className: FilterToolbar_module_default.toolbar,
5478
+ "data-mode": "bulk-edit"
5479
+ }, /* @__PURE__ */ react.createElement("div", null, renderBulkEditText?.()), /* @__PURE__ */ react.createElement("div", null, renderBulkEditActions?.())) : /* @__PURE__ */ react.createElement("div", { className: FilterToolbar_module_default.toolbar }, /* @__PURE__ */ react.createElement("div", null, /* @__PURE__ */ react.createElement(TextField, {
5480
+ placeholder: "Filter value",
5481
+ ...filterInputProps,
5482
+ leadingSlot: /* @__PURE__ */ react.createElement(_capra_icons.FilterOutlined, {
5483
+ size: "sm",
5484
+ color: "var(--cds2-color-foreground-subtle)"
5485
+ }),
5486
+ size: "sm"
5487
+ })), /* @__PURE__ */ react.createElement("div", null, renderActions?.()));
5488
+ }
5489
+ //#endregion
5490
+ //#region src/components/Table/Table.module.css
5491
+ var Table_module_default = {
5492
+ "base": "capra-Table-module-YRCV0q-base",
5493
+ "cell": "capra-Table-module-YRCV0q-cell",
5494
+ "column": "capra-Table-module-YRCV0q-column",
5495
+ "columnDivider": "capra-Table-module-YRCV0q-columnDivider",
5496
+ "columnHeader": "capra-Table-module-YRCV0q-columnHeader",
5497
+ "columnName": "capra-Table-module-YRCV0q-columnName",
5498
+ "dropIndicator": "capra-Table-module-YRCV0q-dropIndicator",
5499
+ "header": "capra-Table-module-YRCV0q-header",
5500
+ "row": "capra-Table-module-YRCV0q-row",
5501
+ "sortIcons": "capra-Table-module-YRCV0q-sortIcons"
5502
+ };
5503
+ //#endregion
5504
+ //#region src/components/Table/Table.tsx
5505
+ const EMPTY_CELL_PLACEHOLDER = "--";
5506
+ function isEmptyValue(value) {
5507
+ return value === null || value === void 0 || value === "";
5508
+ }
5509
+ function defineColumns(columns) {
5510
+ return columns;
5511
+ }
5512
+ function TableWithoutRef({ FORCE__className: classNameOverride, items, columns, visibleColumns, sortDescriptor, density = "default", appearance = "zebra", onSortChange, selectedKeys, onSelectionChange, isLoading = false, enableDragAndDrop = false, renderActionColumn, ...props }, ref) {
5513
+ const columnsToRender = react.useMemo(() => {
5514
+ return visibleColumns.map((id) => columns.find((c) => c.id === id)).filter((c) => c != null);
5515
+ }, [columns, visibleColumns]);
5516
+ const [dndItems, setDndItems] = react.useState(items);
5517
+ react.useEffect(() => {
5518
+ setDndItems(items);
5519
+ }, [items]);
5520
+ const { dragAndDropHooks } = (0, react_aria_components.useDragAndDrop)({
5521
+ getItems(keys) {
5522
+ return [...keys].map((key) => ({ "text/plain": String(key) }));
5523
+ },
5524
+ onReorder(e) {
5525
+ setDndItems((prev) => {
5526
+ const movedItems = [...e.keys].map((key) => prev.find((item) => item.id === key));
5527
+ const filtered = prev.filter((item) => !e.keys.has(item.id));
5528
+ const targetIndex = filtered.findIndex((item) => item.id === e.target.key);
5529
+ if (e.target.dropPosition === "before") filtered.splice(targetIndex, 0, ...movedItems);
5530
+ else filtered.splice(targetIndex + 1, 0, ...movedItems);
5531
+ return filtered;
5532
+ });
5533
+ },
5534
+ renderDropIndicator(target) {
5535
+ return /* @__PURE__ */ react.createElement(react_aria_components.DropIndicator, {
5536
+ target,
5537
+ className: Table_module_default.dropIndicator
5538
+ });
5539
+ }
5540
+ });
5541
+ const skeletonItems = react.useMemo(() => Array.from({ length: 5 }, (_, i) => ({ id: `skeleton-${i}` })), []);
5542
+ return /* @__PURE__ */ react.createElement(react_aria_components.Table, {
5543
+ ...props,
5544
+ ref,
5545
+ sortDescriptor,
5546
+ selectedKeys,
5547
+ onSelectionChange,
5548
+ className: clsx(Table_module_default.base, classNameOverride),
5549
+ "data-density": density,
5550
+ "data-appearance": appearance,
5551
+ onSortChange,
5552
+ dragAndDropHooks: enableDragAndDrop ? dragAndDropHooks : void 0
5553
+ }, /* @__PURE__ */ react.createElement(TableHeader, {
5554
+ columns: columnsToRender,
5555
+ className: Table_module_default.header,
5556
+ shouldShowActionColumn: !!renderActionColumn
5557
+ }, (column) => {
5558
+ return /* @__PURE__ */ react.createElement(Column, {
5559
+ isRowHeader: true,
5560
+ key: column.id,
5561
+ id: column.id,
5562
+ allowsSorting: !enableDragAndDrop && column.allowsSorting,
5563
+ textValue: column.label
5564
+ }, column.label);
5565
+ }), /* @__PURE__ */ react.createElement(react_aria_components.TableBody, {
5566
+ items: isLoading ? skeletonItems : enableDragAndDrop ? dndItems : items,
5567
+ dependencies: [columnsToRender, isLoading],
5568
+ className: Table_module_default.body
5569
+ }, (_item) => {
5570
+ const item = _item;
5571
+ return /* @__PURE__ */ react.createElement(Row, {
5572
+ isDisabled: item.isDisabled === true ? true : false,
5573
+ key: item.id,
5574
+ id: item.id,
5575
+ columns: columnsToRender,
5576
+ className: Table_module_default.row,
5577
+ actionColumn: !isLoading && renderActionColumn ? renderActionColumn(item) : void 0
5578
+ }, (column) => {
5579
+ return /* @__PURE__ */ react.createElement(Cell, {
5580
+ key: column.id,
5581
+ id: `${item.id}__${column.id}`,
5582
+ className: Table_module_default.cell
5583
+ }, isLoading ? /* @__PURE__ */ react.createElement(Skeleton, {
5584
+ title: false,
5585
+ paragraph: { rows: 1 },
5586
+ active: true
5587
+ }) : isEmptyValue(item[column.id]) ? /* @__PURE__ */ react.createElement("span", null, "--") : column.render ? column.render(item[column.id], item) : /* @__PURE__ */ react.createElement("span", null, item[column.id]));
5588
+ });
5589
+ }));
5590
+ }
5591
+ /**
5592
+ * A component for rendering tabular data
5593
+ */
5594
+ const Table = fixedForwardRef(TableWithoutRef);
5595
+ function Column(props) {
5596
+ return /* @__PURE__ */ react.createElement(react_aria_components.Column, {
5597
+ ...props,
5598
+ className: Table_module_default.column
5599
+ }, ({ allowsSorting, sortDirection }) => {
5600
+ return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement("div", { className: Table_module_default.columnHeader }, /* @__PURE__ */ react.createElement(react_aria_components.Group, {
5601
+ role: "presentation",
5602
+ tabIndex: -1,
5603
+ className: Table_module_default.columnName
5604
+ }, props.children), allowsSorting && (sortDirection ? /* @__PURE__ */ react.createElement(SortedIcons, { sortDirection }) : /* @__PURE__ */ react.createElement(NonSortedIcons, null)), props.allowsResizing && /* @__PURE__ */ react.createElement(react_aria_components.ColumnResizer, null)), /* @__PURE__ */ react.createElement("div", { className: Table_module_default.columnDivider }));
5605
+ });
5606
+ }
5607
+ function TableHeader({ columns, children, shouldShowActionColumn, ...otherProps }) {
5608
+ const { selectionBehavior, selectionMode, allowsDragging } = (0, react_aria_components.useTableOptions)();
5609
+ return /* @__PURE__ */ react.createElement(react_aria_components.TableHeader, otherProps, allowsDragging && /* @__PURE__ */ react.createElement(react_aria_components.Column, {
5610
+ width: 20,
5611
+ minWidth: 20,
5612
+ style: { width: 20 },
5613
+ className: Table_module_default.column
5614
+ }, /* @__PURE__ */ react.createElement("div", { className: Table_module_default.columnDivider })), selectionBehavior === "toggle" && /* @__PURE__ */ react.createElement(react_aria_components.Column, {
5615
+ width: 32,
5616
+ minWidth: 32,
5617
+ style: { width: 32 },
5618
+ className: Table_module_default.column
5619
+ }, selectionMode === "multiple" && /* @__PURE__ */ react.createElement(RACCheckbox, { slot: "selection" }), /* @__PURE__ */ react.createElement("div", { className: Table_module_default.columnDivider })), /* @__PURE__ */ react.createElement(react_aria_components.Collection, { items: columns }, children), shouldShowActionColumn && /* @__PURE__ */ react.createElement(react_aria_components.Column, { className: Table_module_default.column }, "Actions"));
5620
+ }
5621
+ function Row({ id, columns, children, actionColumn, ...otherProps }) {
5622
+ const { selectionBehavior, allowsDragging } = (0, react_aria_components.useTableOptions)();
5623
+ return /* @__PURE__ */ react.createElement(react_aria_components.Row, {
5624
+ id,
5625
+ ...otherProps
5626
+ }, allowsDragging && /* @__PURE__ */ react.createElement(Cell, {
5627
+ className: Table_module_default.cell,
5628
+ "data-padding": "reduced"
5629
+ }, /* @__PURE__ */ react.createElement(IconButton, {
5630
+ slot: "drag",
5631
+ appearance: "neutral",
5632
+ variant: "tertiary",
5633
+ size: "xs",
5634
+ icon: _capra_icons.DragGrip,
5635
+ "aria-label": "Drag"
5636
+ })), selectionBehavior === "toggle" && /* @__PURE__ */ react.createElement(Cell, {
5637
+ className: Table_module_default.cell,
5638
+ "data-padding": "reduced"
5639
+ }, /* @__PURE__ */ react.createElement(RACCheckbox, { slot: "selection" })), /* @__PURE__ */ react.createElement(react_aria_components.Collection, { items: columns }, children), actionColumn && /* @__PURE__ */ react.createElement(Cell, { className: Table_module_default.cell }, actionColumn));
5640
+ }
5641
+ const INTERACTIVE_ELEMENT_SELECTOR = "a[href], button, input, select, textarea, [role=\"button\"], [role=\"checkbox\"], [role=\"combobox\"], [role=\"link\"], [role=\"slider\"], [role=\"spinbutton\"], [role=\"switch\"], [role=\"textbox\"]";
5642
+ function Cell(props) {
5643
+ return /* @__PURE__ */ react.createElement(react_aria_components.Cell, {
5644
+ ...props,
5645
+ onPointerDown: (e) => {
5646
+ if (e.target.closest(INTERACTIVE_ELEMENT_SELECTOR)) e.stopPropagation();
5647
+ }
5648
+ }, (0, react_aria_components.composeRenderProps)(props.children, (children, { hasChildItems, isTreeColumn }) => /* @__PURE__ */ react.createElement(react.Fragment, null, isTreeColumn && hasChildItems && /* @__PURE__ */ react.createElement(IconButton, {
5649
+ slot: "chevron",
5650
+ icon: _capra_icons.ChevronRight,
5651
+ "aria-label": "Chevron"
5652
+ }), children)));
5653
+ }
5654
+ function NonSortedIcons() {
5655
+ return /* @__PURE__ */ react.createElement("div", { className: Table_module_default.sortIcons }, /* @__PURE__ */ react.createElement(_capra_icons.CaretUp, { size: "sm" }), /* @__PURE__ */ react.createElement(_capra_icons.CaretDown, { size: "sm" }));
5656
+ }
5657
+ function SortedIcons(props) {
5658
+ return /* @__PURE__ */ react.createElement("div", {
5659
+ className: Table_module_default.sortIcons,
5660
+ "data-sort-direction": props.sortDirection
5661
+ }, /* @__PURE__ */ react.createElement(_capra_icons.CaretUp, { size: "sm" }), /* @__PURE__ */ react.createElement(_capra_icons.CaretDown, { size: "sm" }));
5662
+ }
5663
+ //#endregion
4961
5664
  //#region src/components/Tree/Tree.module.css
4962
5665
  var Tree_module_default = {
4963
5666
  "chevronButton": "capra-Tree-module--hXpBa-chevronButton",
@@ -5209,7 +5912,9 @@ exports.DatePickerField = DatePickerField;
5209
5912
  exports.DateRangePickerField = DateRangePickerField;
5210
5913
  exports.Divider = Divider;
5211
5914
  exports.Drawer = Drawer;
5915
+ exports.EMPTY_CELL_PLACEHOLDER = EMPTY_CELL_PLACEHOLDER;
5212
5916
  exports.EmptyState = EmptyState;
5917
+ exports.FilterToolbar = FilterToolbar;
5213
5918
  exports.IconButton = IconButton;
5214
5919
  exports.InputRow = InputRow;
5215
5920
  exports.Label = Label;
@@ -5234,20 +5939,24 @@ Object.defineProperty(exports, "RouterProvider", {
5234
5939
  });
5235
5940
  exports.SKELETON_SIZE = SKELETON_SIZE;
5236
5941
  exports.SKELETON_SIZE_TOKENS = SKELETON_SIZE_TOKENS;
5942
+ exports.SelectField = SelectField;
5237
5943
  exports.Skeleton = Skeleton;
5238
5944
  exports.SkeletonGroup = SkeletonGroup;
5239
5945
  exports.Spinner = Spinner;
5240
5946
  exports.Switch = Switch;
5241
5947
  exports.TabNav = TabNav;
5948
+ exports.Table = Table;
5242
5949
  exports.Tag = Tag;
5243
5950
  exports.Text = Text;
5244
5951
  exports.TextArea = TextArea;
5245
5952
  exports.TextField = TextField;
5246
5953
  exports.Toast = Toast;
5954
+ exports.ToggleButtonGroup = ToggleButtonGroup;
5247
5955
  exports.Tooltip = Tooltip;
5248
5956
  exports.TopNav = TopNav;
5249
5957
  exports.Tree = Tree;
5250
5958
  exports.VerticalNavigation = VerticalNavigation;
5251
5959
  exports.VisuallyHidden = VisuallyHidden;
5960
+ exports.defineColumns = defineColumns;
5252
5961
  exports.submenuPanelClassName = submenuPanelClassName;
5253
5962
  exports.tagColors = tagColors;