@capra/core 1.13.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 +340 -60
- package/dist/index.d.cts +228 -55
- package/dist/index.d.mts +228 -55
- package/dist/index.mjs +338 -63
- package/dist/style.css +334 -116
- package/docs/core-badge--design.md +10 -2
- package/docs/core-badge--usage.md +7 -1
- package/docs/core-checkbox--usage.md +1 -0
- package/docs/core-table--design.md +17 -0
- package/docs/core-table--usage.md +198 -0
- package/docs/core-togglebuttongroup--design.md +89 -0
- package/docs/core-togglebuttongroup--usage.md +113 -0
- package/docs/history-changelogs-capra-core--docs.md +21 -0
- package/docs/index.md +4 -0
- package/package.json +3 -3
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-
|
|
273
|
-
"input": "capra-TextInput-module-
|
|
274
|
-
"leadingSlot": "capra-TextInput-module-
|
|
275
|
-
"trailingSlot": "capra-TextInput-module-
|
|
276
|
-
"warningIndicator": "capra-TextInput-module-
|
|
277
|
-
"wrapper": "capra-TextInput-module-
|
|
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
|
|
@@ -589,18 +589,23 @@ var Badge_module_default = {
|
|
|
589
589
|
/**
|
|
590
590
|
* Badges display an indicator/counter on an associated component.
|
|
591
591
|
*/
|
|
592
|
-
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 }) {
|
|
593
593
|
if (variant === "counter" && !showZero && !count) return null;
|
|
594
594
|
const getBadgeContent = () => {
|
|
595
595
|
if (variant === "dot") return null;
|
|
596
596
|
const value = Math.max(count, 0);
|
|
597
597
|
return value > overflowCount ? `${overflowCount}+` : value;
|
|
598
598
|
};
|
|
599
|
+
const role = decorative ? void 0 : variant === "dot" ? "img" : "status";
|
|
599
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,
|
|
600
604
|
className: clsx(Badge_module_default.badge, FORCE__className),
|
|
601
605
|
"data-appearance": appearance,
|
|
602
606
|
"data-size": size,
|
|
603
607
|
"data-variant": variant,
|
|
608
|
+
role,
|
|
604
609
|
style,
|
|
605
610
|
...props
|
|
606
611
|
}, getBadgeContent());
|
|
@@ -948,9 +953,11 @@ function Tag({ draggable, color = "default", icon: Icon, children, size = "md",
|
|
|
948
953
|
//#endregion
|
|
949
954
|
//#region src/components/Checkbox/Checkbox.module.css
|
|
950
955
|
var Checkbox_module_default = {
|
|
951
|
-
"base": "capra-Checkbox-module-
|
|
952
|
-
"
|
|
953
|
-
"
|
|
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"
|
|
954
961
|
};
|
|
955
962
|
//#endregion
|
|
956
963
|
//#region src/components/Checkbox/Checkbox.tsx
|
|
@@ -1018,6 +1025,27 @@ const Checkbox = react.forwardRef((props, ref) => {
|
|
|
1018
1025
|
}, children));
|
|
1019
1026
|
});
|
|
1020
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";
|
|
1021
1049
|
//#endregion
|
|
1022
1050
|
//#region src/components/Collapse/Collapse.module.css
|
|
1023
1051
|
var Collapse_module_default = {
|
|
@@ -1182,12 +1210,12 @@ PasswordField.displayName = "PasswordField";
|
|
|
1182
1210
|
//#endregion
|
|
1183
1211
|
//#region src/components/NumberField/NumberField.module.css
|
|
1184
1212
|
var NumberField_module_default = {
|
|
1185
|
-
"slotAlign": "capra-NumberField-module-
|
|
1186
|
-
"stepButton": "capra-NumberField-module-
|
|
1187
|
-
"stepDivider": "capra-NumberField-module-
|
|
1188
|
-
"stepIcon": "capra-NumberField-module-
|
|
1189
|
-
"stepper": "capra-NumberField-module-
|
|
1190
|
-
"withStepper": "capra-NumberField-module-
|
|
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"
|
|
1191
1219
|
};
|
|
1192
1220
|
//#endregion
|
|
1193
1221
|
//#region src/components/NumberField/NumberField.tsx
|
|
@@ -2319,33 +2347,33 @@ const DatePickerField = DatePickerFieldWithRef;
|
|
|
2319
2347
|
//#endregion
|
|
2320
2348
|
//#region src/components/SelectField/SelectField.module.css
|
|
2321
2349
|
var SelectField_module_default = {
|
|
2322
|
-
"chevron": "capra-SelectField-module-
|
|
2323
|
-
"dropdownPanel": "capra-SelectField-module-
|
|
2324
|
-
"emptyState": "capra-SelectField-module-
|
|
2325
|
-
"errorIndicator": "capra-SelectField-module-
|
|
2326
|
-
"header": "capra-SelectField-module-
|
|
2327
|
-
"item": "capra-SelectField-module-
|
|
2328
|
-
"itemCheck": "capra-SelectField-module-
|
|
2329
|
-
"itemContent": "capra-SelectField-module-
|
|
2330
|
-
"leadingSlot": "capra-SelectField-module-
|
|
2331
|
-
"listbox": "capra-SelectField-module-
|
|
2332
|
-
"multipleOpenButton": "capra-SelectField-module-
|
|
2333
|
-
"multipleTrigger": "capra-SelectField-module-
|
|
2334
|
-
"search": "capra-SelectField-module-
|
|
2335
|
-
"section": "capra-SelectField-module-
|
|
2336
|
-
"singleTrigger": "capra-SelectField-module-
|
|
2337
|
-
"tag": "capra-SelectField-module-
|
|
2338
|
-
"tagGroup": "capra-SelectField-module-
|
|
2339
|
-
"tagIcon": "capra-SelectField-module-
|
|
2340
|
-
"tagLabel": "capra-SelectField-module-
|
|
2341
|
-
"tagList": "capra-SelectField-module-
|
|
2342
|
-
"tagRemove": "capra-SelectField-module-
|
|
2343
|
-
"trailingSlot": "capra-SelectField-module-
|
|
2344
|
-
"triggerShell": "capra-SelectField-module-
|
|
2345
|
-
"value": "capra-SelectField-module-
|
|
2346
|
-
"valueIcon": "capra-SelectField-module-
|
|
2347
|
-
"valueText": "capra-SelectField-module-
|
|
2348
|
-
"warningIndicator": "capra-SelectField-module-
|
|
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"
|
|
2349
2377
|
};
|
|
2350
2378
|
//#endregion
|
|
2351
2379
|
//#region src/components/SelectField/SelectField.tsx
|
|
@@ -3687,8 +3715,61 @@ function ButtonLinkWithoutRef({ appearance = "default", as: asComponent, block,
|
|
|
3687
3715
|
*/
|
|
3688
3716
|
const ButtonLink = fixedForwardRef(ButtonLinkWithoutRef);
|
|
3689
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
|
|
3690
3771
|
//#region src/components/Link/Link.module.css
|
|
3691
|
-
var Link_module_default = { "base": "capra-Link-module-
|
|
3772
|
+
var Link_module_default = { "base": "capra-Link-module-OvXy7G-base" };
|
|
3692
3773
|
//#endregion
|
|
3693
3774
|
//#region src/components/Link/Link.tsx
|
|
3694
3775
|
function LinkWithoutRef({ as: asComponent, children, isExternal = false, FORCE__className: classNameOverride, ...rest }, ref) {
|
|
@@ -4548,21 +4629,21 @@ const Toast = {
|
|
|
4548
4629
|
//#endregion
|
|
4549
4630
|
//#region src/components/Menu/Menu.module.css
|
|
4550
4631
|
var Menu_module_default = {
|
|
4551
|
-
"divider": "capra-Menu-module-
|
|
4552
|
-
"header": "capra-Menu-module-
|
|
4553
|
-
"list": "capra-Menu-module-
|
|
4554
|
-
"menu": "capra-Menu-module-
|
|
4555
|
-
"menuItem": "capra-Menu-module-
|
|
4556
|
-
"menuItemDescription": "capra-Menu-module-
|
|
4557
|
-
"menuItemLabel": "capra-Menu-module-
|
|
4558
|
-
"menuItemLeadingGutter": "capra-Menu-module-
|
|
4559
|
-
"menuItemListItemShell": "capra-Menu-module-
|
|
4560
|
-
"menuItemShortcut": "capra-Menu-module-
|
|
4561
|
-
"menuItemTrailingGroup": "capra-Menu-module-
|
|
4562
|
-
"menuItemTrailingGutter": "capra-Menu-module-
|
|
4563
|
-
"menuTriggerSlot": "capra-Menu-module-
|
|
4564
|
-
"section": "capra-Menu-module-
|
|
4565
|
-
"slot": "capra-Menu-module-
|
|
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"
|
|
4566
4647
|
};
|
|
4567
4648
|
//#endregion
|
|
4568
4649
|
//#region src/components/Menu/Menu.tsx
|
|
@@ -4646,7 +4727,7 @@ const MenuSection = ({ children, "aria-label": ariaLabel, "aria-labelledby": ari
|
|
|
4646
4727
|
}, resolvedChildren));
|
|
4647
4728
|
};
|
|
4648
4729
|
MenuSection.displayName = "Menu.Section";
|
|
4649
|
-
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 }) => {
|
|
4650
4731
|
const indentFromSectionHeader = react.useContext(MenuSectionIndentContext);
|
|
4651
4732
|
const indent = indentProp !== void 0 ? indentProp : indentFromSectionHeader ? true : false;
|
|
4652
4733
|
const labelContent = children ?? label;
|
|
@@ -4674,6 +4755,7 @@ const MenuItem = ({ as: Component, label, description, ariaLabel, href, disabled
|
|
|
4674
4755
|
"aria-label": ariaLabel,
|
|
4675
4756
|
"aria-current": active ? "page" : void 0,
|
|
4676
4757
|
className: clsx(Menu_module_default.menuItem, FORCE__className),
|
|
4758
|
+
"data-allow-line-wrap": allowItemLineWrap,
|
|
4677
4759
|
"data-variant": variant,
|
|
4678
4760
|
"data-active": active || void 0,
|
|
4679
4761
|
"data-indent": indent || void 0,
|
|
@@ -5386,6 +5468,199 @@ function ArrowSvg() {
|
|
|
5386
5468
|
}));
|
|
5387
5469
|
}
|
|
5388
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
|
|
5389
5664
|
//#region src/components/Tree/Tree.module.css
|
|
5390
5665
|
var Tree_module_default = {
|
|
5391
5666
|
"chevronButton": "capra-Tree-module--hXpBa-chevronButton",
|
|
@@ -5637,7 +5912,9 @@ exports.DatePickerField = DatePickerField;
|
|
|
5637
5912
|
exports.DateRangePickerField = DateRangePickerField;
|
|
5638
5913
|
exports.Divider = Divider;
|
|
5639
5914
|
exports.Drawer = Drawer;
|
|
5915
|
+
exports.EMPTY_CELL_PLACEHOLDER = EMPTY_CELL_PLACEHOLDER;
|
|
5640
5916
|
exports.EmptyState = EmptyState;
|
|
5917
|
+
exports.FilterToolbar = FilterToolbar;
|
|
5641
5918
|
exports.IconButton = IconButton;
|
|
5642
5919
|
exports.InputRow = InputRow;
|
|
5643
5920
|
exports.Label = Label;
|
|
@@ -5668,15 +5945,18 @@ exports.SkeletonGroup = SkeletonGroup;
|
|
|
5668
5945
|
exports.Spinner = Spinner;
|
|
5669
5946
|
exports.Switch = Switch;
|
|
5670
5947
|
exports.TabNav = TabNav;
|
|
5948
|
+
exports.Table = Table;
|
|
5671
5949
|
exports.Tag = Tag;
|
|
5672
5950
|
exports.Text = Text;
|
|
5673
5951
|
exports.TextArea = TextArea;
|
|
5674
5952
|
exports.TextField = TextField;
|
|
5675
5953
|
exports.Toast = Toast;
|
|
5954
|
+
exports.ToggleButtonGroup = ToggleButtonGroup;
|
|
5676
5955
|
exports.Tooltip = Tooltip;
|
|
5677
5956
|
exports.TopNav = TopNav;
|
|
5678
5957
|
exports.Tree = Tree;
|
|
5679
5958
|
exports.VerticalNavigation = VerticalNavigation;
|
|
5680
5959
|
exports.VisuallyHidden = VisuallyHidden;
|
|
5960
|
+
exports.defineColumns = defineColumns;
|
|
5681
5961
|
exports.submenuPanelClassName = submenuPanelClassName;
|
|
5682
5962
|
exports.tagColors = tagColors;
|