@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 +781 -72
- package/dist/index.d.cts +342 -47
- package/dist/index.d.mts +342 -47
- package/dist/index.mjs +780 -77
- package/dist/style.css +647 -93
- package/docs/core-autocompletefield--usage.md +1 -1
- 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-selectfield--design.md +66 -0
- package/docs/core-selectfield--usage.md +145 -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 +31 -0
- package/docs/index.md +6 -0
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
|
-
import React, { Suspense
|
|
3
|
-
import { AnglesLeft, AnglesRight, ArrowUpRightFromSquare, AttentionOutlined, AttentionSolid, CalendarNextOutlined, CalendarOutlined, CalendarPrevOutlined, CaretRight, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, CircleXmark, CloseOutlined, DragGrip, Exclamation, EyeInvisibleOutlined, EyeOutlined, InfoOutlined, InfoSolid, Loading, SuccessOutlined, SuccessSolid, SwapRightOutlined, WarningOutlined, WarningSolid } from "@capra/icons";
|
|
4
|
-
import { Breadcrumb as Breadcrumb$1, Breadcrumbs as Breadcrumbs$1, Button as Button$1, ButtonContext, Calendar, CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, Collection, ComboBox, DateInput, DatePicker, DatePickerStateContext, DateRangePicker, DateRangePickerStateContext, DateSegment, Dialog, DialogTrigger, Disclosure, DisclosurePanel, Focusable, Group, Header, Heading, HeadingContext, Input, InputContext, LabelContext, Link as Link$1, ListBox, ListBoxItem, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal as Modal$1, ModalOverlay, NumberField as NumberField$1, OverlayArrow, OverlayTriggerStateContext, Popover as Popover$1, Pressable, RangeCalendar, RangeCalendarStateContext, RouterProvider, Separator, SubmenuTrigger, Text as Text$1, TextArea as TextArea$1, TextContext, TextField as TextField$1, Tooltip as Tooltip$1, TooltipTrigger, Tree as Tree$1, TreeItem, TreeItemContent, composeRenderProps, useContextProps, useSlottedContext } from "react-aria-components";
|
|
5
|
-
import { FocusScope, UNSAFE_PortalProvider, useDateFormatter, useFocusWithin, usePreventScroll } from "react-aria";
|
|
2
|
+
import React, { Suspense } from "react";
|
|
3
|
+
import { AnglesLeft, AnglesRight, ArrowUpRightFromSquare, AttentionOutlined, AttentionSolid, CalendarNextOutlined, CalendarOutlined, CalendarPrevOutlined, CaretDown, CaretRight, CaretUp, CheckOutlined, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, CircleXmark, CloseOutlined, DragGrip, Exclamation, EyeInvisibleOutlined, EyeOutlined, FilterOutlined, InfoOutlined, InfoSolid, Loading, SuccessOutlined, SuccessSolid, SwapRightOutlined, WarningOutlined, WarningSolid } from "@capra/icons";
|
|
4
|
+
import { Autocomplete, Breadcrumb as Breadcrumb$1, Breadcrumbs as Breadcrumbs$1, Button as Button$1, ButtonContext, Calendar, CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, Cell, Checkbox as Checkbox$1, Collection, Column, ColumnResizer, ComboBox, DateInput, DatePicker, DatePickerStateContext, DateRangePicker, DateRangePickerStateContext, DateSegment, Dialog, DialogTrigger, Disclosure, DisclosurePanel, DropIndicator, FieldInputContext, Focusable, Group, Header, Heading, HeadingContext, Input, InputContext, LabelContext, Link as Link$1, ListBox, ListBoxItem, ListBoxSection, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal as Modal$1, ModalOverlay, NumberField as NumberField$1, OverlayArrow, OverlayTriggerStateContext, Popover as Popover$1, Pressable, RangeCalendar, RangeCalendarStateContext, RouterProvider, Row, Select, SelectStateContext, SelectValue, Separator, SubmenuTrigger, Table as Table$1, TableBody, TableHeader, Tag as Tag$1, TagGroup, TagList, Text as Text$1, TextArea as TextArea$1, TextContext, TextField as TextField$1, ToggleButton, ToggleButtonGroup as ToggleButtonGroup$1, Tooltip as Tooltip$1, TooltipTrigger, Tree as Tree$1, TreeItem, TreeItemContent, composeRenderProps, useContextProps, useDragAndDrop, useFilter, useSlottedContext, useTableOptions } from "react-aria-components";
|
|
5
|
+
import { FocusScope, UNSAFE_PortalProvider, mergeProps, useButton, useDateFormatter, useFocusRing, useFocusWithin, usePreventScroll } from "react-aria";
|
|
6
6
|
import { createRoot } from "react-dom/client";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
8
|
//#region ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/lite.mjs
|
|
@@ -246,12 +246,12 @@ Label.displayName = "Label";
|
|
|
246
246
|
//#endregion
|
|
247
247
|
//#region src/components/TextInput/TextInput.module.css
|
|
248
248
|
var TextInput_module_default = {
|
|
249
|
-
"errorIndicator": "capra-TextInput-module-
|
|
250
|
-
"input": "capra-TextInput-module-
|
|
251
|
-
"leadingSlot": "capra-TextInput-module-
|
|
252
|
-
"trailingSlot": "capra-TextInput-module-
|
|
253
|
-
"warningIndicator": "capra-TextInput-module-
|
|
254
|
-
"wrapper": "capra-TextInput-module-
|
|
249
|
+
"errorIndicator": "capra-TextInput-module--5NVeG-errorIndicator",
|
|
250
|
+
"input": "capra-TextInput-module--5NVeG-input",
|
|
251
|
+
"leadingSlot": "capra-TextInput-module--5NVeG-leadingSlot",
|
|
252
|
+
"trailingSlot": "capra-TextInput-module--5NVeG-trailingSlot",
|
|
253
|
+
"warningIndicator": "capra-TextInput-module--5NVeG-warningIndicator",
|
|
254
|
+
"wrapper": "capra-TextInput-module--5NVeG-wrapper"
|
|
255
255
|
};
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/components/TextInput/TextInput.tsx
|
|
@@ -323,11 +323,50 @@ HelperText.displayName = "HelperText";
|
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/components/input-helpers/fieldLayout.module.css
|
|
325
325
|
var fieldLayout_module_default = {
|
|
326
|
-
"field": "capra-fieldLayout-module-
|
|
327
|
-
"fieldContent": "capra-fieldLayout-module-
|
|
328
|
-
"labelRow": "capra-fieldLayout-module-
|
|
326
|
+
"field": "capra-fieldLayout-module-0mM4jW-field",
|
|
327
|
+
"fieldContent": "capra-fieldLayout-module-0mM4jW-fieldContent",
|
|
328
|
+
"labelRow": "capra-fieldLayout-module-0mM4jW-labelRow"
|
|
329
329
|
};
|
|
330
330
|
//#endregion
|
|
331
|
+
//#region src/components/input-helpers/useAnchorWidth.ts
|
|
332
|
+
/**
|
|
333
|
+
* Element that visually bounds the field (select trigger or text input shell). The popover matches
|
|
334
|
+
* its width and left edge, which differs from the field root in horizontal layouts where the label
|
|
335
|
+
* sits beside the control.
|
|
336
|
+
*/
|
|
337
|
+
function getShellElement(anchor) {
|
|
338
|
+
return anchor.querySelector("[data-capra-anchor-width-target]") ?? anchor.querySelector("[data-capra-text-input]") ?? anchor;
|
|
339
|
+
}
|
|
340
|
+
/** Element React Aria anchors the popover to: the select trigger or the combobox input. */
|
|
341
|
+
function getTriggerElement(anchor) {
|
|
342
|
+
return anchor.querySelector("[data-capra-anchor-width-target]") ?? anchor.querySelector("input") ?? anchor;
|
|
343
|
+
}
|
|
344
|
+
function useAnchorWidth(additionalDependencies = []) {
|
|
345
|
+
const anchorRef = React$1.useRef(null);
|
|
346
|
+
const [width, setWidth] = React$1.useState(null);
|
|
347
|
+
const [offset, setOffset] = React$1.useState(0);
|
|
348
|
+
React$1.useEffect(() => {
|
|
349
|
+
const anchor = anchorRef.current;
|
|
350
|
+
if (!anchor) return;
|
|
351
|
+
const measure = () => {
|
|
352
|
+
const shell = getShellElement(anchor);
|
|
353
|
+
const trigger = getTriggerElement(anchor);
|
|
354
|
+
setWidth(shell.offsetWidth + "px");
|
|
355
|
+
setOffset(shell.getBoundingClientRect().left - trigger.getBoundingClientRect().left);
|
|
356
|
+
};
|
|
357
|
+
const observer = new ResizeObserver(measure);
|
|
358
|
+
observer.observe(anchor);
|
|
359
|
+
const shell = getShellElement(anchor);
|
|
360
|
+
if (shell !== anchor) observer.observe(shell);
|
|
361
|
+
return () => observer.disconnect();
|
|
362
|
+
}, additionalDependencies);
|
|
363
|
+
return [
|
|
364
|
+
anchorRef,
|
|
365
|
+
width,
|
|
366
|
+
offset
|
|
367
|
+
];
|
|
368
|
+
}
|
|
369
|
+
//#endregion
|
|
331
370
|
//#region src/components/Autocomplete/AutocompleteField.module.css
|
|
332
371
|
var AutocompleteField_module_default = {
|
|
333
372
|
"item": "capra-AutocompleteField-module-MVvKYa-item",
|
|
@@ -386,41 +425,6 @@ function AutocompleteFieldWithoutRef(props, ref) {
|
|
|
386
425
|
style: { width: shouldAutoSizeDropdown ? width : void 0 }
|
|
387
426
|
}, /* @__PURE__ */ React.createElement(ListBox, { className: AutocompleteField_module_default.listbox }, children)));
|
|
388
427
|
}
|
|
389
|
-
function useResizeObserver({ ref, onResize, additionalDependencies = [] }) {
|
|
390
|
-
React.useEffect(() => {
|
|
391
|
-
if (!ref.current) return;
|
|
392
|
-
const observer = new ResizeObserver((entries) => {
|
|
393
|
-
onResize(entries[0]);
|
|
394
|
-
});
|
|
395
|
-
observer.observe(ref.current);
|
|
396
|
-
return () => observer.disconnect();
|
|
397
|
-
}, [
|
|
398
|
-
ref,
|
|
399
|
-
onResize,
|
|
400
|
-
...additionalDependencies
|
|
401
|
-
]);
|
|
402
|
-
}
|
|
403
|
-
function useAnchorWidth(additionalDependencies = []) {
|
|
404
|
-
const anchorRef = React.useRef(null);
|
|
405
|
-
const [width, setWidth] = useState(null);
|
|
406
|
-
const [offset, setOffset] = useState(0);
|
|
407
|
-
useResizeObserver({
|
|
408
|
-
ref: anchorRef,
|
|
409
|
-
onResize: useCallback(() => {
|
|
410
|
-
if (anchorRef.current) {
|
|
411
|
-
setWidth(anchorRef.current.offsetWidth + "px");
|
|
412
|
-
const input = anchorRef.current.querySelector("input");
|
|
413
|
-
if (input) setOffset(anchorRef.current.offsetLeft - input.offsetLeft);
|
|
414
|
-
}
|
|
415
|
-
}, [anchorRef]),
|
|
416
|
-
additionalDependencies
|
|
417
|
-
});
|
|
418
|
-
return [
|
|
419
|
-
anchorRef,
|
|
420
|
-
width,
|
|
421
|
-
offset
|
|
422
|
-
];
|
|
423
|
-
}
|
|
424
428
|
/**
|
|
425
429
|
* 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.
|
|
426
430
|
*/
|
|
@@ -562,18 +566,23 @@ var Badge_module_default = {
|
|
|
562
566
|
/**
|
|
563
567
|
* Badges display an indicator/counter on an associated component.
|
|
564
568
|
*/
|
|
565
|
-
function Badge({ appearance = "danger", variant = "counter", size = "md", count = 0, showZero = false, overflowCount = 99, FORCE__className, style, ...props }) {
|
|
569
|
+
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 }) {
|
|
566
570
|
if (variant === "counter" && !showZero && !count) return null;
|
|
567
571
|
const getBadgeContent = () => {
|
|
568
572
|
if (variant === "dot") return null;
|
|
569
573
|
const value = Math.max(count, 0);
|
|
570
574
|
return value > overflowCount ? `${overflowCount}+` : value;
|
|
571
575
|
};
|
|
576
|
+
const role = decorative ? void 0 : variant === "dot" ? "img" : "status";
|
|
572
577
|
return /* @__PURE__ */ React$1.createElement("span", {
|
|
578
|
+
"aria-hidden": decorative || void 0,
|
|
579
|
+
"aria-label": decorative ? void 0 : ariaLabel,
|
|
580
|
+
"aria-labelledby": decorative ? void 0 : ariaLabelledBy,
|
|
573
581
|
className: clsx(Badge_module_default.badge, FORCE__className),
|
|
574
582
|
"data-appearance": appearance,
|
|
575
583
|
"data-size": size,
|
|
576
584
|
"data-variant": variant,
|
|
585
|
+
role,
|
|
577
586
|
style,
|
|
578
587
|
...props
|
|
579
588
|
}, getBadgeContent());
|
|
@@ -811,7 +820,7 @@ function RadioTileWithoutRef({ children, checked, disabled, description, icon, F
|
|
|
811
820
|
const RadioTile = fixedForwardRef(RadioTileWithoutRef);
|
|
812
821
|
//#endregion
|
|
813
822
|
//#region src/components/Switch/Switch.module.css
|
|
814
|
-
var Switch_module_default = { "switch": "capra-Switch-module-
|
|
823
|
+
var Switch_module_default = { "switch": "capra-Switch-module-j8Yc-q-switch" };
|
|
815
824
|
//#endregion
|
|
816
825
|
//#region src/components/Switch/Switch.tsx
|
|
817
826
|
const Switch = React$1.forwardRef((props, ref) => {
|
|
@@ -921,9 +930,11 @@ function Tag({ draggable, color = "default", icon: Icon, children, size = "md",
|
|
|
921
930
|
//#endregion
|
|
922
931
|
//#region src/components/Checkbox/Checkbox.module.css
|
|
923
932
|
var Checkbox_module_default = {
|
|
924
|
-
"base": "capra-Checkbox-module-
|
|
925
|
-
"
|
|
926
|
-
"
|
|
933
|
+
"base": "capra-Checkbox-module-IniPuq-base",
|
|
934
|
+
"inner": "capra-Checkbox-module-IniPuq-inner",
|
|
935
|
+
"input": "capra-Checkbox-module-IniPuq-input",
|
|
936
|
+
"label": "capra-Checkbox-module-IniPuq-label",
|
|
937
|
+
"text": "capra-Checkbox-module-IniPuq-text"
|
|
927
938
|
};
|
|
928
939
|
//#endregion
|
|
929
940
|
//#region src/components/Checkbox/Checkbox.tsx
|
|
@@ -991,6 +1002,27 @@ const Checkbox = React$1.forwardRef((props, ref) => {
|
|
|
991
1002
|
}, children));
|
|
992
1003
|
});
|
|
993
1004
|
Checkbox.displayName = "Checkbox";
|
|
1005
|
+
const RACCheckbox = React$1.forwardRef((props, ref) => {
|
|
1006
|
+
const { indeterminate, disabled, checked, defaultChecked, children, onChange, id, name, value, slot, FORCE__className: classNameOverride } = props;
|
|
1007
|
+
const hasLabel = Boolean(children);
|
|
1008
|
+
const inputRef = React$1.useRef(null);
|
|
1009
|
+
React$1.useImperativeHandle(ref, () => inputRef.current);
|
|
1010
|
+
return /* @__PURE__ */ React$1.createElement(Checkbox$1, {
|
|
1011
|
+
id,
|
|
1012
|
+
name,
|
|
1013
|
+
value: value?.toString(),
|
|
1014
|
+
slot,
|
|
1015
|
+
className: clsx(Checkbox_module_default.base, classNameOverride),
|
|
1016
|
+
isSelected: checked,
|
|
1017
|
+
defaultSelected: defaultChecked,
|
|
1018
|
+
isIndeterminate: indeterminate,
|
|
1019
|
+
isDisabled: disabled,
|
|
1020
|
+
"data-has-label": hasLabel ? "true" : "false",
|
|
1021
|
+
onChange,
|
|
1022
|
+
inputRef
|
|
1023
|
+
}, ({ isIndeterminate, isSelected }) => /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement("div", { className: Checkbox_module_default.input }, /* @__PURE__ */ React$1.createElement("div", { className: Checkbox_module_default.inner }), isIndeterminate ? /* @__PURE__ */ React$1.createElement(IndeterminateIcon, null) : isSelected ? /* @__PURE__ */ React$1.createElement(CheckedIcon, null) : null), /* @__PURE__ */ React$1.createElement("div", { className: Checkbox_module_default.text }, children)));
|
|
1024
|
+
});
|
|
1025
|
+
RACCheckbox.displayName = "RACCheckbox";
|
|
994
1026
|
//#endregion
|
|
995
1027
|
//#region src/components/Collapse/Collapse.module.css
|
|
996
1028
|
var Collapse_module_default = {
|
|
@@ -1155,12 +1187,12 @@ PasswordField.displayName = "PasswordField";
|
|
|
1155
1187
|
//#endregion
|
|
1156
1188
|
//#region src/components/NumberField/NumberField.module.css
|
|
1157
1189
|
var NumberField_module_default = {
|
|
1158
|
-
"slotAlign": "capra-NumberField-module-
|
|
1159
|
-
"stepButton": "capra-NumberField-module-
|
|
1160
|
-
"stepDivider": "capra-NumberField-module-
|
|
1161
|
-
"stepIcon": "capra-NumberField-module-
|
|
1162
|
-
"stepper": "capra-NumberField-module-
|
|
1163
|
-
"withStepper": "capra-NumberField-module-
|
|
1190
|
+
"slotAlign": "capra-NumberField-module-IscOzq-slotAlign",
|
|
1191
|
+
"stepButton": "capra-NumberField-module-IscOzq-stepButton",
|
|
1192
|
+
"stepDivider": "capra-NumberField-module-IscOzq-stepDivider",
|
|
1193
|
+
"stepIcon": "capra-NumberField-module-IscOzq-stepIcon",
|
|
1194
|
+
"stepper": "capra-NumberField-module-IscOzq-stepper",
|
|
1195
|
+
"withStepper": "capra-NumberField-module-IscOzq-withStepper"
|
|
1164
1196
|
};
|
|
1165
1197
|
//#endregion
|
|
1166
1198
|
//#region src/components/NumberField/NumberField.tsx
|
|
@@ -2290,6 +2322,430 @@ const DatePickerFieldWithRef = React$1.forwardRef(DatePickerFieldInner);
|
|
|
2290
2322
|
DatePickerFieldWithRef.displayName = "DatePickerField";
|
|
2291
2323
|
const DatePickerField = DatePickerFieldWithRef;
|
|
2292
2324
|
//#endregion
|
|
2325
|
+
//#region src/components/SelectField/SelectField.module.css
|
|
2326
|
+
var SelectField_module_default = {
|
|
2327
|
+
"chevron": "capra-SelectField-module-KwnLuW-chevron",
|
|
2328
|
+
"dropdownPanel": "capra-SelectField-module-KwnLuW-dropdownPanel",
|
|
2329
|
+
"emptyState": "capra-SelectField-module-KwnLuW-emptyState",
|
|
2330
|
+
"errorIndicator": "capra-SelectField-module-KwnLuW-errorIndicator",
|
|
2331
|
+
"header": "capra-SelectField-module-KwnLuW-header",
|
|
2332
|
+
"item": "capra-SelectField-module-KwnLuW-item",
|
|
2333
|
+
"itemCheck": "capra-SelectField-module-KwnLuW-itemCheck",
|
|
2334
|
+
"itemContent": "capra-SelectField-module-KwnLuW-itemContent",
|
|
2335
|
+
"leadingSlot": "capra-SelectField-module-KwnLuW-leadingSlot",
|
|
2336
|
+
"listbox": "capra-SelectField-module-KwnLuW-listbox",
|
|
2337
|
+
"multipleOpenButton": "capra-SelectField-module-KwnLuW-multipleOpenButton",
|
|
2338
|
+
"multipleTrigger": "capra-SelectField-module-KwnLuW-multipleTrigger",
|
|
2339
|
+
"search": "capra-SelectField-module-KwnLuW-search",
|
|
2340
|
+
"section": "capra-SelectField-module-KwnLuW-section",
|
|
2341
|
+
"singleTrigger": "capra-SelectField-module-KwnLuW-singleTrigger",
|
|
2342
|
+
"tag": "capra-SelectField-module-KwnLuW-tag",
|
|
2343
|
+
"tagGroup": "capra-SelectField-module-KwnLuW-tagGroup",
|
|
2344
|
+
"tagIcon": "capra-SelectField-module-KwnLuW-tagIcon",
|
|
2345
|
+
"tagLabel": "capra-SelectField-module-KwnLuW-tagLabel",
|
|
2346
|
+
"tagList": "capra-SelectField-module-KwnLuW-tagList",
|
|
2347
|
+
"tagRemove": "capra-SelectField-module-KwnLuW-tagRemove",
|
|
2348
|
+
"trailingSlot": "capra-SelectField-module-KwnLuW-trailingSlot",
|
|
2349
|
+
"triggerShell": "capra-SelectField-module-KwnLuW-triggerShell",
|
|
2350
|
+
"value": "capra-SelectField-module-KwnLuW-value",
|
|
2351
|
+
"valueIcon": "capra-SelectField-module-KwnLuW-valueIcon",
|
|
2352
|
+
"valueText": "capra-SelectField-module-KwnLuW-valueText",
|
|
2353
|
+
"warningIndicator": "capra-SelectField-module-KwnLuW-warningIndicator"
|
|
2354
|
+
};
|
|
2355
|
+
//#endregion
|
|
2356
|
+
//#region src/components/SelectField/SelectField.tsx
|
|
2357
|
+
/** When true, SelectField.Item indents by default (inside SelectField.Section that contains SelectField.Header). */
|
|
2358
|
+
const SelectFieldSectionIndentContext = React$1.createContext(false);
|
|
2359
|
+
function normalizeIterable(value) {
|
|
2360
|
+
return value === void 0 ? void 0 : Array.from(value);
|
|
2361
|
+
}
|
|
2362
|
+
function getItemLabelFromNode(node) {
|
|
2363
|
+
if (typeof node === "string") return node;
|
|
2364
|
+
if (typeof node === "number") return String(node);
|
|
2365
|
+
if (React$1.isValidElement(node)) {
|
|
2366
|
+
if (typeof node.props.textValue === "string") return node.props.textValue;
|
|
2367
|
+
return getItemLabelFromNode(node.props.children);
|
|
2368
|
+
}
|
|
2369
|
+
return "";
|
|
2370
|
+
}
|
|
2371
|
+
function removeKeysFromSelection(selection, keys) {
|
|
2372
|
+
return (selection ?? []).filter((selectedKey) => !keys.has(selectedKey));
|
|
2373
|
+
}
|
|
2374
|
+
function getItemIcon(item) {
|
|
2375
|
+
if (item && typeof item === "object" && "icon" in item) {
|
|
2376
|
+
const icon = item.icon;
|
|
2377
|
+
return icon && typeof icon === "object" && "__brand" in icon ? icon : void 0;
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
function isDefaultSection(item) {
|
|
2381
|
+
const children = item.children;
|
|
2382
|
+
return children != null && typeof children !== "string" && typeof children[Symbol.iterator] === "function";
|
|
2383
|
+
}
|
|
2384
|
+
function SelectFieldIndicators(props) {
|
|
2385
|
+
const { appearance } = props;
|
|
2386
|
+
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, appearance === "warning" ? /* @__PURE__ */ React$1.createElement("span", {
|
|
2387
|
+
className: SelectField_module_default.warningIndicator,
|
|
2388
|
+
"aria-hidden": true
|
|
2389
|
+
}, /* @__PURE__ */ React$1.createElement(WarningOutlined, { size: "sm" })) : null, appearance === "danger" ? /* @__PURE__ */ React$1.createElement("span", {
|
|
2390
|
+
className: SelectField_module_default.errorIndicator,
|
|
2391
|
+
"aria-hidden": true
|
|
2392
|
+
}, /* @__PURE__ */ React$1.createElement(Exclamation, { size: "sm" })) : null, /* @__PURE__ */ React$1.createElement("span", {
|
|
2393
|
+
className: SelectField_module_default.chevron,
|
|
2394
|
+
"aria-hidden": true
|
|
2395
|
+
}, /* @__PURE__ */ React$1.createElement(ChevronDown, { size: "sm" })));
|
|
2396
|
+
}
|
|
2397
|
+
function SelectFieldTriggerButton(props) {
|
|
2398
|
+
const { appearance, buttonRef, children, className, ...rest } = props;
|
|
2399
|
+
const localRef = React$1.useRef(null);
|
|
2400
|
+
const ref = buttonRef ?? localRef;
|
|
2401
|
+
const [mergedProps, mergedRef] = useContextProps({
|
|
2402
|
+
...rest,
|
|
2403
|
+
className
|
|
2404
|
+
}, ref, ButtonContext);
|
|
2405
|
+
const { buttonProps, isPressed } = useButton(mergedProps, mergedRef);
|
|
2406
|
+
const { focusProps, isFocused, isFocusVisible } = useFocusRing(mergedProps);
|
|
2407
|
+
return /* @__PURE__ */ React$1.createElement("button", {
|
|
2408
|
+
...mergeProps(buttonProps, focusProps),
|
|
2409
|
+
ref: mergedRef,
|
|
2410
|
+
className,
|
|
2411
|
+
"aria-invalid": appearance === "danger" ? true : void 0,
|
|
2412
|
+
"data-pressed": isPressed || void 0,
|
|
2413
|
+
"data-focused": isFocused || void 0,
|
|
2414
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
2415
|
+
"data-disabled": mergedProps.isDisabled || void 0
|
|
2416
|
+
}, children);
|
|
2417
|
+
}
|
|
2418
|
+
function SelectFieldTrigger(props) {
|
|
2419
|
+
const { appearance, disabled, leadingSlot, placeholder, required, selectedItemsLabel, size, triggerRef } = props;
|
|
2420
|
+
const state = React$1.useContext(SelectStateContext);
|
|
2421
|
+
const openButtonRef = React$1.useRef(null);
|
|
2422
|
+
if (!state) return null;
|
|
2423
|
+
if (!(state.selectionManager.selectionMode === "multiple")) return /* @__PURE__ */ React$1.createElement(SelectFieldTriggerButton, {
|
|
2424
|
+
appearance,
|
|
2425
|
+
className: clsx(SelectField_module_default.triggerShell, SelectField_module_default.singleTrigger),
|
|
2426
|
+
"data-capra-anchor-width-target": "",
|
|
2427
|
+
"data-size": size,
|
|
2428
|
+
"data-disabled": disabled || void 0,
|
|
2429
|
+
"aria-required": required || void 0,
|
|
2430
|
+
isDisabled: disabled
|
|
2431
|
+
}, leadingSlot ? /* @__PURE__ */ React$1.createElement("span", { className: SelectField_module_default.leadingSlot }, leadingSlot) : null, /* @__PURE__ */ React$1.createElement(SelectValue, { className: SelectField_module_default.value }, ({ isPlaceholder, selectedText, selectedItems }) => {
|
|
2432
|
+
const ValueIcon = getItemIcon(selectedItems[0]);
|
|
2433
|
+
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, ValueIcon ? /* @__PURE__ */ React$1.createElement("span", {
|
|
2434
|
+
className: SelectField_module_default.valueIcon,
|
|
2435
|
+
"aria-hidden": true
|
|
2436
|
+
}, /* @__PURE__ */ React$1.createElement(ValueIcon, { size: "sm" })) : null, /* @__PURE__ */ React$1.createElement("span", {
|
|
2437
|
+
className: SelectField_module_default.valueText,
|
|
2438
|
+
"data-placeholder": isPlaceholder || !selectedText || void 0
|
|
2439
|
+
}, selectedText || placeholder));
|
|
2440
|
+
}), /* @__PURE__ */ React$1.createElement("span", { className: SelectField_module_default.trailingSlot }, /* @__PURE__ */ React$1.createElement(SelectFieldIndicators, { appearance })));
|
|
2441
|
+
const hasSelection = !state.selectionManager.isEmpty;
|
|
2442
|
+
const handleEmptyTriggerPress = (event) => {
|
|
2443
|
+
if (disabled || hasSelection || state.isOpen) return;
|
|
2444
|
+
if (event.target.closest("button")) return;
|
|
2445
|
+
openButtonRef.current?.focus();
|
|
2446
|
+
state.open();
|
|
2447
|
+
};
|
|
2448
|
+
return /* @__PURE__ */ React$1.createElement(Group, {
|
|
2449
|
+
ref: triggerRef,
|
|
2450
|
+
className: clsx(SelectField_module_default.triggerShell, SelectField_module_default.multipleTrigger),
|
|
2451
|
+
"data-capra-anchor-width-target": "",
|
|
2452
|
+
"data-size": size,
|
|
2453
|
+
"data-disabled": disabled || void 0,
|
|
2454
|
+
"data-empty": hasSelection ? void 0 : "",
|
|
2455
|
+
onClick: handleEmptyTriggerPress
|
|
2456
|
+
}, leadingSlot ? /* @__PURE__ */ React$1.createElement("span", { className: SelectField_module_default.leadingSlot }, leadingSlot) : null, /* @__PURE__ */ React$1.createElement(ButtonContext.Provider, { value: null }, /* @__PURE__ */ React$1.createElement(SelectValue, { className: SelectField_module_default.value }, ({ state: selectState }) => {
|
|
2457
|
+
const tagItems = selectState.selectedItems.filter((item) => item != null).map((item) => ({
|
|
2458
|
+
id: item.key,
|
|
2459
|
+
label: item.textValue || getItemLabelFromNode(item.rendered) || String(item.key),
|
|
2460
|
+
icon: getItemIcon(item.value)
|
|
2461
|
+
}));
|
|
2462
|
+
return /* @__PURE__ */ React$1.createElement(TagGroup, {
|
|
2463
|
+
"aria-label": selectedItemsLabel,
|
|
2464
|
+
className: SelectField_module_default.tagGroup,
|
|
2465
|
+
onRemove: disabled ? void 0 : (keys) => {
|
|
2466
|
+
const value = selectState.value;
|
|
2467
|
+
if (Array.isArray(value)) selectState.setValue(removeKeysFromSelection(value, keys));
|
|
2468
|
+
}
|
|
2469
|
+
}, /* @__PURE__ */ React$1.createElement(TagList, {
|
|
2470
|
+
className: SelectField_module_default.tagList,
|
|
2471
|
+
items: tagItems,
|
|
2472
|
+
renderEmptyState: () => /* @__PURE__ */ React$1.createElement("span", {
|
|
2473
|
+
className: SelectField_module_default.valueText,
|
|
2474
|
+
"data-placeholder": placeholder ? true : void 0
|
|
2475
|
+
}, placeholder)
|
|
2476
|
+
}, (item) => /* @__PURE__ */ React$1.createElement(Tag$1, {
|
|
2477
|
+
id: item.id,
|
|
2478
|
+
textValue: item.label,
|
|
2479
|
+
className: SelectField_module_default.tag,
|
|
2480
|
+
"data-size": size === "sm" ? "sm" : "md"
|
|
2481
|
+
}, ({ allowsRemoving }) => /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, item.icon ? /* @__PURE__ */ React$1.createElement("span", {
|
|
2482
|
+
className: SelectField_module_default.tagIcon,
|
|
2483
|
+
"aria-hidden": true
|
|
2484
|
+
}, /* @__PURE__ */ React$1.createElement(item.icon, { size: "xs" })) : null, /* @__PURE__ */ React$1.createElement("span", { className: SelectField_module_default.tagLabel }, item.label), allowsRemoving ? /* @__PURE__ */ React$1.createElement(Button$1, {
|
|
2485
|
+
slot: "remove",
|
|
2486
|
+
className: SelectField_module_default.tagRemove,
|
|
2487
|
+
"aria-label": "Delete",
|
|
2488
|
+
excludeFromTabOrder: true
|
|
2489
|
+
}, /* @__PURE__ */ React$1.createElement(CloseOutlined, { size: "xs" })) : null))));
|
|
2490
|
+
})), /* @__PURE__ */ React$1.createElement(SelectFieldTriggerButton, {
|
|
2491
|
+
appearance,
|
|
2492
|
+
buttonRef: openButtonRef,
|
|
2493
|
+
className: SelectField_module_default.multipleOpenButton,
|
|
2494
|
+
isDisabled: disabled,
|
|
2495
|
+
"aria-required": required || void 0
|
|
2496
|
+
}, /* @__PURE__ */ React$1.createElement("span", { className: SelectField_module_default.trailingSlot }, /* @__PURE__ */ React$1.createElement(SelectFieldIndicators, { appearance }))));
|
|
2497
|
+
}
|
|
2498
|
+
function SelectFieldItem(props) {
|
|
2499
|
+
const { id, textValue, isDisabled, indent: indentProp, value, children } = props;
|
|
2500
|
+
const indentFromSectionHeader = React$1.useContext(SelectFieldSectionIndentContext);
|
|
2501
|
+
const indent = indentProp !== void 0 ? indentProp : indentFromSectionHeader;
|
|
2502
|
+
return /* @__PURE__ */ React$1.createElement(ListBoxItem, {
|
|
2503
|
+
id,
|
|
2504
|
+
value,
|
|
2505
|
+
textValue: textValue || getItemLabelFromNode(children),
|
|
2506
|
+
isDisabled,
|
|
2507
|
+
className: SelectField_module_default.item,
|
|
2508
|
+
"data-indent": indent || void 0
|
|
2509
|
+
}, ({ isSelected, selectionMode }) => /* @__PURE__ */ React$1.createElement("div", { className: SelectField_module_default.itemContent }, selectionMode === "multiple" ? /* @__PURE__ */ React$1.createElement("span", {
|
|
2510
|
+
className: SelectField_module_default.itemCheck,
|
|
2511
|
+
"data-selected": isSelected || void 0,
|
|
2512
|
+
"aria-hidden": true
|
|
2513
|
+
}, isSelected ? /* @__PURE__ */ React$1.createElement(CheckOutlined, { size: "sm" }) : null) : null, typeof children === "string" ? /* @__PURE__ */ React$1.createElement(Text, { slot: "label" }, children) : children));
|
|
2514
|
+
}
|
|
2515
|
+
function SelectFieldHeader(props) {
|
|
2516
|
+
const { id, label = "Header", FORCE__className: classNameOverride, children } = props;
|
|
2517
|
+
return /* @__PURE__ */ React$1.createElement(Header, {
|
|
2518
|
+
id,
|
|
2519
|
+
className: clsx(SelectField_module_default.header, classNameOverride)
|
|
2520
|
+
}, children ?? label);
|
|
2521
|
+
}
|
|
2522
|
+
SelectFieldHeader.displayName = "SelectField.Header";
|
|
2523
|
+
function isSelectFieldHeaderElement(child) {
|
|
2524
|
+
return React$1.isValidElement(child) && child.type === SelectFieldHeader;
|
|
2525
|
+
}
|
|
2526
|
+
function SelectFieldSection(props) {
|
|
2527
|
+
const { children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, FORCE__className: classNameOverride, className, ...rest } = props;
|
|
2528
|
+
const autoHeaderId = React$1.useId();
|
|
2529
|
+
const childArray = React$1.Children.toArray(children);
|
|
2530
|
+
let headerIndex = -1;
|
|
2531
|
+
for (let i = 0; i < childArray.length; i++) if (isSelectFieldHeaderElement(childArray[i])) {
|
|
2532
|
+
headerIndex = i;
|
|
2533
|
+
break;
|
|
2534
|
+
}
|
|
2535
|
+
const hasHeader = headerIndex >= 0;
|
|
2536
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2537
|
+
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.");
|
|
2538
|
+
}
|
|
2539
|
+
const labelledBy = hasHeader ? ariaLabelledBy ?? autoHeaderId : ariaLabelledBy;
|
|
2540
|
+
const effectiveAriaLabel = hasHeader ? void 0 : ariaLabel;
|
|
2541
|
+
const resolvedChildren = hasHeader && headerIndex >= 0 ? childArray.map((child, i) => {
|
|
2542
|
+
if (i === headerIndex && isSelectFieldHeaderElement(child)) return React$1.cloneElement(child, { id: child.props.id ?? autoHeaderId });
|
|
2543
|
+
return child;
|
|
2544
|
+
}) : children;
|
|
2545
|
+
return /* @__PURE__ */ React$1.createElement(SelectFieldSectionIndentContext.Provider, { value: hasHeader }, /* @__PURE__ */ React$1.createElement(ListBoxSection, {
|
|
2546
|
+
"aria-label": effectiveAriaLabel,
|
|
2547
|
+
"aria-labelledby": labelledBy,
|
|
2548
|
+
className: clsx(SelectField_module_default.section, className, classNameOverride),
|
|
2549
|
+
...rest
|
|
2550
|
+
}, resolvedChildren));
|
|
2551
|
+
}
|
|
2552
|
+
SelectFieldSection.displayName = "SelectField.Section";
|
|
2553
|
+
function defaultSelectFieldItemRenderer(item) {
|
|
2554
|
+
if (isDefaultSection(item)) {
|
|
2555
|
+
const { id, label, "aria-label": ariaLabel, children } = item;
|
|
2556
|
+
return /* @__PURE__ */ React$1.createElement(SelectFieldSection, {
|
|
2557
|
+
key: String(id),
|
|
2558
|
+
"aria-label": label ? void 0 : ariaLabel
|
|
2559
|
+
}, label ? /* @__PURE__ */ React$1.createElement(SelectFieldHeader, { label }) : null, /* @__PURE__ */ React$1.createElement(Collection, { items: children }, (child) => defaultSelectFieldItemRenderer(child)));
|
|
2560
|
+
}
|
|
2561
|
+
const Icon = item.icon;
|
|
2562
|
+
return /* @__PURE__ */ React$1.createElement(SelectFieldItem, {
|
|
2563
|
+
id: item.id,
|
|
2564
|
+
textValue: item.label
|
|
2565
|
+
}, Icon ? /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(Icon, { size: "sm" }), /* @__PURE__ */ React$1.createElement(Text, { slot: "label" }, item.label)) : item.label);
|
|
2566
|
+
}
|
|
2567
|
+
function SelectFieldLabel(props) {
|
|
2568
|
+
const { children, required } = props;
|
|
2569
|
+
const { elementType: _elementType, ...labelContextWithoutElementType } = useSlottedContext(LabelContext) ?? {};
|
|
2570
|
+
return /* @__PURE__ */ React$1.createElement(LabelContext.Provider, { value: labelContextWithoutElementType }, /* @__PURE__ */ React$1.createElement(Label, { required }, children));
|
|
2571
|
+
}
|
|
2572
|
+
function AutocompleteTextInput(props) {
|
|
2573
|
+
const { placeholder, shouldFocus, size } = props;
|
|
2574
|
+
const ref = React$1.useRef(null);
|
|
2575
|
+
const [mergedProps, mergedRef] = useContextProps({
|
|
2576
|
+
"aria-label": props["aria-label"],
|
|
2577
|
+
placeholder,
|
|
2578
|
+
type: "search"
|
|
2579
|
+
}, ref, FieldInputContext);
|
|
2580
|
+
const { onChange, value, ...inputProps } = mergedProps;
|
|
2581
|
+
const inputRef = mergedRef;
|
|
2582
|
+
React$1.useLayoutEffect(() => {
|
|
2583
|
+
if (!shouldFocus) return;
|
|
2584
|
+
const input = inputRef.current;
|
|
2585
|
+
if (!input) return;
|
|
2586
|
+
requestAnimationFrame(() => {
|
|
2587
|
+
try {
|
|
2588
|
+
input.focus({ preventScroll: true });
|
|
2589
|
+
} catch {}
|
|
2590
|
+
});
|
|
2591
|
+
}, [inputRef, shouldFocus]);
|
|
2592
|
+
return /* @__PURE__ */ React$1.createElement(TextInput, {
|
|
2593
|
+
...inputProps,
|
|
2594
|
+
ref: inputRef,
|
|
2595
|
+
size,
|
|
2596
|
+
value: typeof value === "string" ? value : "",
|
|
2597
|
+
onChange: (event) => {
|
|
2598
|
+
onChange?.(event.target.value);
|
|
2599
|
+
}
|
|
2600
|
+
});
|
|
2601
|
+
}
|
|
2602
|
+
function SelectFieldInner(props, ref) {
|
|
2603
|
+
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;
|
|
2604
|
+
const [searchValue, setSearchValue] = React$1.useState("");
|
|
2605
|
+
const [popoverWidth, setPopoverWidth] = React$1.useState();
|
|
2606
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React$1.useState(Boolean(defaultOpen));
|
|
2607
|
+
const isPopoverOpen = isOpen ?? uncontrolledOpen;
|
|
2608
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
2609
|
+
const [anchorRef, width, offset] = useAnchorWidth([
|
|
2610
|
+
canSearch,
|
|
2611
|
+
selectionMode,
|
|
2612
|
+
size
|
|
2613
|
+
]);
|
|
2614
|
+
const multipleTriggerRef = React$1.useRef(null);
|
|
2615
|
+
const selectedItemsLabel = label ? `Selected ${label}` : ariaLabel ?? "Selected items";
|
|
2616
|
+
React$1.useImperativeHandle(ref, () => anchorRef.current, [anchorRef]);
|
|
2617
|
+
React$1.useLayoutEffect(() => {
|
|
2618
|
+
const trigger = multipleTriggerRef.current ?? anchorRef.current;
|
|
2619
|
+
if (selectionMode !== "multiple" || !isPopoverOpen || popoverWidth || !trigger) return;
|
|
2620
|
+
setPopoverWidth(`${trigger.offsetWidth}px`);
|
|
2621
|
+
}, [
|
|
2622
|
+
isPopoverOpen,
|
|
2623
|
+
popoverWidth,
|
|
2624
|
+
selectionMode,
|
|
2625
|
+
width,
|
|
2626
|
+
anchorRef
|
|
2627
|
+
]);
|
|
2628
|
+
const itemList = React$1.useMemo(() => items ? Array.from(items) : void 0, [items]);
|
|
2629
|
+
const resolvedChildren = children ?? (itemList ? defaultSelectFieldItemRenderer : void 0);
|
|
2630
|
+
const handleOpenChange = React$1.useCallback((nextOpen) => {
|
|
2631
|
+
if (isOpen === void 0) setUncontrolledOpen(nextOpen);
|
|
2632
|
+
if (selectionMode === "multiple" && !nextOpen) setPopoverWidth(void 0);
|
|
2633
|
+
if (!nextOpen) setSearchValue("");
|
|
2634
|
+
onOpenChange?.(nextOpen);
|
|
2635
|
+
}, [
|
|
2636
|
+
isOpen,
|
|
2637
|
+
onOpenChange,
|
|
2638
|
+
selectionMode
|
|
2639
|
+
]);
|
|
2640
|
+
const dropdownWidth = selectionMode === "multiple" ? popoverWidth ?? width ?? void 0 : width ?? void 0;
|
|
2641
|
+
const listBoxSearchProps = canSearch ? {
|
|
2642
|
+
autoFocus: false,
|
|
2643
|
+
renderEmptyState: () => /* @__PURE__ */ React$1.createElement("span", { className: SelectField_module_default.emptyState }, "No results")
|
|
2644
|
+
} : {};
|
|
2645
|
+
const listBox = /* @__PURE__ */ React$1.createElement(ListBox, {
|
|
2646
|
+
...listBoxSearchProps,
|
|
2647
|
+
className: SelectField_module_default.listbox,
|
|
2648
|
+
"data-selection-mode": selectionMode,
|
|
2649
|
+
items: itemList
|
|
2650
|
+
}, resolvedChildren);
|
|
2651
|
+
const popoverContent = canSearch ? /* @__PURE__ */ React$1.createElement(Autocomplete, {
|
|
2652
|
+
filter: contains,
|
|
2653
|
+
inputValue: searchValue,
|
|
2654
|
+
onInputChange: setSearchValue
|
|
2655
|
+
}, /* @__PURE__ */ React$1.createElement("div", { className: SelectField_module_default.search }, /* @__PURE__ */ React$1.createElement(AutocompleteTextInput, {
|
|
2656
|
+
"aria-label": searchPlaceholder || "Search",
|
|
2657
|
+
placeholder: searchPlaceholder || "Search",
|
|
2658
|
+
shouldFocus: isPopoverOpen,
|
|
2659
|
+
size
|
|
2660
|
+
})), listBox) : listBox;
|
|
2661
|
+
const selectContent = /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement("div", { className: fieldLayout_module_default.labelRow }, /* @__PURE__ */ React$1.createElement(SelectFieldLabel, { required }, label)), /* @__PURE__ */ React$1.createElement("div", { className: fieldLayout_module_default.fieldContent }, /* @__PURE__ */ React$1.createElement(SelectFieldTrigger, {
|
|
2662
|
+
appearance,
|
|
2663
|
+
disabled,
|
|
2664
|
+
leadingSlot,
|
|
2665
|
+
placeholder,
|
|
2666
|
+
required,
|
|
2667
|
+
selectedItemsLabel,
|
|
2668
|
+
size,
|
|
2669
|
+
triggerRef: selectionMode === "multiple" ? multipleTriggerRef : void 0
|
|
2670
|
+
}), /* @__PURE__ */ React$1.createElement(HelperText, {
|
|
2671
|
+
appearance,
|
|
2672
|
+
disabled
|
|
2673
|
+
}, helperText)), /* @__PURE__ */ React$1.createElement(Popover$1, {
|
|
2674
|
+
className: SelectField_module_default.dropdownPanel,
|
|
2675
|
+
offset: 2,
|
|
2676
|
+
crossOffset: offset,
|
|
2677
|
+
triggerRef: selectionMode === "multiple" ? multipleTriggerRef : void 0,
|
|
2678
|
+
style: { width: shouldAutoSizeDropdown ? dropdownWidth : void 0 }
|
|
2679
|
+
}, popoverContent));
|
|
2680
|
+
if (props.selectionMode === "multiple") {
|
|
2681
|
+
const handleChange = (nextValue) => {
|
|
2682
|
+
props.onChange?.(new Set(nextValue));
|
|
2683
|
+
};
|
|
2684
|
+
return /* @__PURE__ */ React$1.createElement(Select, {
|
|
2685
|
+
id,
|
|
2686
|
+
ref: anchorRef,
|
|
2687
|
+
name,
|
|
2688
|
+
className: clsx(fieldLayout_module_default.field, classNameOverride),
|
|
2689
|
+
"data-capra-field-root": "",
|
|
2690
|
+
"data-layout": layout,
|
|
2691
|
+
isDisabled: disabled,
|
|
2692
|
+
isRequired: required,
|
|
2693
|
+
isInvalid: appearance === "danger",
|
|
2694
|
+
validationBehavior: "aria",
|
|
2695
|
+
placeholder,
|
|
2696
|
+
selectionMode: "multiple",
|
|
2697
|
+
disabledKeys,
|
|
2698
|
+
value: normalizeIterable(props.value),
|
|
2699
|
+
defaultValue: normalizeIterable(props.defaultValue),
|
|
2700
|
+
onChange: handleChange,
|
|
2701
|
+
isOpen,
|
|
2702
|
+
defaultOpen,
|
|
2703
|
+
onOpenChange: handleOpenChange,
|
|
2704
|
+
autoFocus,
|
|
2705
|
+
"aria-label": ariaLabel,
|
|
2706
|
+
"aria-labelledby": ariaLabelledBy,
|
|
2707
|
+
"aria-describedby": ariaDescribedBy
|
|
2708
|
+
}, selectContent);
|
|
2709
|
+
}
|
|
2710
|
+
const handleChange = (nextValue) => {
|
|
2711
|
+
props.onChange?.(nextValue ?? null);
|
|
2712
|
+
};
|
|
2713
|
+
return /* @__PURE__ */ React$1.createElement(Select, {
|
|
2714
|
+
id,
|
|
2715
|
+
ref: anchorRef,
|
|
2716
|
+
name,
|
|
2717
|
+
className: clsx(fieldLayout_module_default.field, classNameOverride),
|
|
2718
|
+
"data-capra-field-root": "",
|
|
2719
|
+
"data-layout": layout,
|
|
2720
|
+
isDisabled: disabled,
|
|
2721
|
+
isRequired: required,
|
|
2722
|
+
isInvalid: appearance === "danger",
|
|
2723
|
+
validationBehavior: "aria",
|
|
2724
|
+
placeholder,
|
|
2725
|
+
selectionMode: "single",
|
|
2726
|
+
disabledKeys,
|
|
2727
|
+
value: props.value,
|
|
2728
|
+
defaultValue: props.defaultValue,
|
|
2729
|
+
onChange: handleChange,
|
|
2730
|
+
isOpen,
|
|
2731
|
+
defaultOpen,
|
|
2732
|
+
onOpenChange: handleOpenChange,
|
|
2733
|
+
autoFocus,
|
|
2734
|
+
"aria-label": ariaLabel,
|
|
2735
|
+
"aria-labelledby": ariaLabelledBy,
|
|
2736
|
+
"aria-describedby": ariaDescribedBy
|
|
2737
|
+
}, selectContent);
|
|
2738
|
+
}
|
|
2739
|
+
const SelectFieldRoot = React$1.forwardRef(SelectFieldInner);
|
|
2740
|
+
/**
|
|
2741
|
+
* Composed select field with Capra label/helper text layout, single and multiple selection, and an optional popover search input.
|
|
2742
|
+
*/
|
|
2743
|
+
const SelectField = Object.assign(SelectFieldRoot, {
|
|
2744
|
+
Item: SelectFieldItem,
|
|
2745
|
+
Header: SelectFieldHeader,
|
|
2746
|
+
Section: SelectFieldSection
|
|
2747
|
+
});
|
|
2748
|
+
//#endregion
|
|
2293
2749
|
//#region src/components/DateRangePickerField/DateRangePickerField.module.css
|
|
2294
2750
|
var DateRangePickerField_module_default = {
|
|
2295
2751
|
"cell": "capra-DateRangePickerField-module-QpPhpG-cell",
|
|
@@ -3236,8 +3692,61 @@ function ButtonLinkWithoutRef({ appearance = "default", as: asComponent, block,
|
|
|
3236
3692
|
*/
|
|
3237
3693
|
const ButtonLink = fixedForwardRef(ButtonLinkWithoutRef);
|
|
3238
3694
|
//#endregion
|
|
3695
|
+
//#region src/components/ToggleButtonGroup/ToggleButtonGroup.module.css
|
|
3696
|
+
var ToggleButtonGroup_module_default = { "base": "capra-ToggleButtonGroup-module-cS5LeW-base" };
|
|
3697
|
+
//#endregion
|
|
3698
|
+
//#region src/components/ToggleButtonGroup/ToggleButtonGroup.tsx
|
|
3699
|
+
function isIconOnlyItem(item) {
|
|
3700
|
+
return !("text" in item);
|
|
3701
|
+
}
|
|
3702
|
+
function renderToggleButtonItem(item, size, groupDisabled) {
|
|
3703
|
+
const isDisabled = groupDisabled || item.disabled;
|
|
3704
|
+
if (isIconOnlyItem(item)) {
|
|
3705
|
+
const Icon = item.icon;
|
|
3706
|
+
return /* @__PURE__ */ React$1.createElement(ToggleButton, {
|
|
3707
|
+
key: item.key,
|
|
3708
|
+
id: item.key,
|
|
3709
|
+
isDisabled,
|
|
3710
|
+
"aria-label": item["aria-label"],
|
|
3711
|
+
className: clsx(Button_module_default.base, Button_module_default.icon),
|
|
3712
|
+
"data-variant": "secondary",
|
|
3713
|
+
"data-appearance": "default",
|
|
3714
|
+
"data-size": size
|
|
3715
|
+
}, /* @__PURE__ */ React$1.createElement(Icon, { size: "sm" }));
|
|
3716
|
+
}
|
|
3717
|
+
const LeadingIcon = item.icon;
|
|
3718
|
+
return /* @__PURE__ */ React$1.createElement(ToggleButton, {
|
|
3719
|
+
key: item.key,
|
|
3720
|
+
id: item.key,
|
|
3721
|
+
isDisabled,
|
|
3722
|
+
"aria-label": item["aria-label"],
|
|
3723
|
+
className: Button_module_default.base,
|
|
3724
|
+
"data-variant": "secondary",
|
|
3725
|
+
"data-appearance": "default",
|
|
3726
|
+
"data-size": size
|
|
3727
|
+
}, LeadingIcon ? /* @__PURE__ */ React$1.createElement("span", { className: Button_module_default.iconLayout }, /* @__PURE__ */ React$1.createElement(LeadingIcon, { size: "sm" })) : null, /* @__PURE__ */ React$1.createElement("span", { className: Button_module_default.textLayout }, /* @__PURE__ */ React$1.createElement(Text, {
|
|
3728
|
+
color: "inherit",
|
|
3729
|
+
variant: "body"
|
|
3730
|
+
}, item.text)));
|
|
3731
|
+
}
|
|
3732
|
+
/**
|
|
3733
|
+
* A group of toggle buttons for choosing one or more options from a set.
|
|
3734
|
+
*/
|
|
3735
|
+
function ToggleButtonGroup({ items, size = "md", disabled = false, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, disallowEmptySelection, FORCE__className: classNameOverride, ...props }) {
|
|
3736
|
+
return /* @__PURE__ */ React$1.createElement(ToggleButtonGroup$1, {
|
|
3737
|
+
...props,
|
|
3738
|
+
isDisabled: disabled,
|
|
3739
|
+
selectionMode,
|
|
3740
|
+
selectedKeys,
|
|
3741
|
+
defaultSelectedKeys,
|
|
3742
|
+
onSelectionChange,
|
|
3743
|
+
disallowEmptySelection,
|
|
3744
|
+
className: clsx(ToggleButtonGroup_module_default.base, classNameOverride)
|
|
3745
|
+
}, items.map((item) => renderToggleButtonItem(item, size, disabled)));
|
|
3746
|
+
}
|
|
3747
|
+
//#endregion
|
|
3239
3748
|
//#region src/components/Link/Link.module.css
|
|
3240
|
-
var Link_module_default = { "base": "capra-Link-module-
|
|
3749
|
+
var Link_module_default = { "base": "capra-Link-module-OvXy7G-base" };
|
|
3241
3750
|
//#endregion
|
|
3242
3751
|
//#region src/components/Link/Link.tsx
|
|
3243
3752
|
function LinkWithoutRef({ as: asComponent, children, isExternal = false, FORCE__className: classNameOverride, ...rest }, ref) {
|
|
@@ -4097,21 +4606,21 @@ const Toast = {
|
|
|
4097
4606
|
//#endregion
|
|
4098
4607
|
//#region src/components/Menu/Menu.module.css
|
|
4099
4608
|
var Menu_module_default = {
|
|
4100
|
-
"divider": "capra-Menu-module-
|
|
4101
|
-
"header": "capra-Menu-module-
|
|
4102
|
-
"list": "capra-Menu-module-
|
|
4103
|
-
"menu": "capra-Menu-module-
|
|
4104
|
-
"menuItem": "capra-Menu-module-
|
|
4105
|
-
"menuItemDescription": "capra-Menu-module-
|
|
4106
|
-
"menuItemLabel": "capra-Menu-module-
|
|
4107
|
-
"menuItemLeadingGutter": "capra-Menu-module-
|
|
4108
|
-
"menuItemListItemShell": "capra-Menu-module-
|
|
4109
|
-
"menuItemShortcut": "capra-Menu-module-
|
|
4110
|
-
"menuItemTrailingGroup": "capra-Menu-module-
|
|
4111
|
-
"menuItemTrailingGutter": "capra-Menu-module-
|
|
4112
|
-
"menuTriggerSlot": "capra-Menu-module-
|
|
4113
|
-
"section": "capra-Menu-module-
|
|
4114
|
-
"slot": "capra-Menu-module-
|
|
4609
|
+
"divider": "capra-Menu-module-eTI_TG-divider",
|
|
4610
|
+
"header": "capra-Menu-module-eTI_TG-header",
|
|
4611
|
+
"list": "capra-Menu-module-eTI_TG-list",
|
|
4612
|
+
"menu": "capra-Menu-module-eTI_TG-menu",
|
|
4613
|
+
"menuItem": "capra-Menu-module-eTI_TG-menuItem",
|
|
4614
|
+
"menuItemDescription": "capra-Menu-module-eTI_TG-menuItemDescription",
|
|
4615
|
+
"menuItemLabel": "capra-Menu-module-eTI_TG-menuItemLabel",
|
|
4616
|
+
"menuItemLeadingGutter": "capra-Menu-module-eTI_TG-menuItemLeadingGutter",
|
|
4617
|
+
"menuItemListItemShell": "capra-Menu-module-eTI_TG-menuItemListItemShell",
|
|
4618
|
+
"menuItemShortcut": "capra-Menu-module-eTI_TG-menuItemShortcut",
|
|
4619
|
+
"menuItemTrailingGroup": "capra-Menu-module-eTI_TG-menuItemTrailingGroup",
|
|
4620
|
+
"menuItemTrailingGutter": "capra-Menu-module-eTI_TG-menuItemTrailingGutter",
|
|
4621
|
+
"menuTriggerSlot": "capra-Menu-module-eTI_TG-menuTriggerSlot",
|
|
4622
|
+
"section": "capra-Menu-module-eTI_TG-section",
|
|
4623
|
+
"slot": "capra-Menu-module-eTI_TG-slot"
|
|
4115
4624
|
};
|
|
4116
4625
|
//#endregion
|
|
4117
4626
|
//#region src/components/Menu/Menu.tsx
|
|
@@ -4195,7 +4704,7 @@ const MenuSection$1 = ({ children, "aria-label": ariaLabel, "aria-labelledby": a
|
|
|
4195
4704
|
}, resolvedChildren));
|
|
4196
4705
|
};
|
|
4197
4706
|
MenuSection$1.displayName = "Menu.Section";
|
|
4198
|
-
const MenuItem$1 = ({ as: Component, label, description, ariaLabel, href, disabled = false, active = false, variant = "default", icon, indent: indentProp, shortcut, parent = false, onPress, onClick, FORCE__className, children, ...rest }) => {
|
|
4707
|
+
const MenuItem$1 = ({ 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 }) => {
|
|
4199
4708
|
const indentFromSectionHeader = React$1.useContext(MenuSectionIndentContext);
|
|
4200
4709
|
const indent = indentProp !== void 0 ? indentProp : indentFromSectionHeader ? true : false;
|
|
4201
4710
|
const labelContent = children ?? label;
|
|
@@ -4223,6 +4732,7 @@ const MenuItem$1 = ({ as: Component, label, description, ariaLabel, href, disabl
|
|
|
4223
4732
|
"aria-label": ariaLabel,
|
|
4224
4733
|
"aria-current": active ? "page" : void 0,
|
|
4225
4734
|
className: clsx(Menu_module_default.menuItem, FORCE__className),
|
|
4735
|
+
"data-allow-line-wrap": allowItemLineWrap,
|
|
4226
4736
|
"data-variant": variant,
|
|
4227
4737
|
"data-active": active || void 0,
|
|
4228
4738
|
"data-indent": indent || void 0,
|
|
@@ -4935,6 +5445,199 @@ function ArrowSvg() {
|
|
|
4935
5445
|
}));
|
|
4936
5446
|
}
|
|
4937
5447
|
//#endregion
|
|
5448
|
+
//#region src/components/FilterToolbar/FilterToolbar.module.css
|
|
5449
|
+
var FilterToolbar_module_default = { "toolbar": "capra-FilterToolbar-module-1TgfVW-toolbar" };
|
|
5450
|
+
//#endregion
|
|
5451
|
+
//#region src/components/FilterToolbar/FilterToolbar.tsx
|
|
5452
|
+
function FilterToolbar({ filterInputProps, renderActions, renderBulkEditText, renderBulkEditActions, selectedKeys }) {
|
|
5453
|
+
return selectedKeys === "all" || selectedKeys.size > 0 ? /* @__PURE__ */ React$1.createElement("div", {
|
|
5454
|
+
className: FilterToolbar_module_default.toolbar,
|
|
5455
|
+
"data-mode": "bulk-edit"
|
|
5456
|
+
}, /* @__PURE__ */ React$1.createElement("div", null, renderBulkEditText?.()), /* @__PURE__ */ React$1.createElement("div", null, renderBulkEditActions?.())) : /* @__PURE__ */ React$1.createElement("div", { className: FilterToolbar_module_default.toolbar }, /* @__PURE__ */ React$1.createElement("div", null, /* @__PURE__ */ React$1.createElement(TextField, {
|
|
5457
|
+
placeholder: "Filter value",
|
|
5458
|
+
...filterInputProps,
|
|
5459
|
+
leadingSlot: /* @__PURE__ */ React$1.createElement(FilterOutlined, {
|
|
5460
|
+
size: "sm",
|
|
5461
|
+
color: "var(--cds2-color-foreground-subtle)"
|
|
5462
|
+
}),
|
|
5463
|
+
size: "sm"
|
|
5464
|
+
})), /* @__PURE__ */ React$1.createElement("div", null, renderActions?.()));
|
|
5465
|
+
}
|
|
5466
|
+
//#endregion
|
|
5467
|
+
//#region src/components/Table/Table.module.css
|
|
5468
|
+
var Table_module_default = {
|
|
5469
|
+
"base": "capra-Table-module-YRCV0q-base",
|
|
5470
|
+
"cell": "capra-Table-module-YRCV0q-cell",
|
|
5471
|
+
"column": "capra-Table-module-YRCV0q-column",
|
|
5472
|
+
"columnDivider": "capra-Table-module-YRCV0q-columnDivider",
|
|
5473
|
+
"columnHeader": "capra-Table-module-YRCV0q-columnHeader",
|
|
5474
|
+
"columnName": "capra-Table-module-YRCV0q-columnName",
|
|
5475
|
+
"dropIndicator": "capra-Table-module-YRCV0q-dropIndicator",
|
|
5476
|
+
"header": "capra-Table-module-YRCV0q-header",
|
|
5477
|
+
"row": "capra-Table-module-YRCV0q-row",
|
|
5478
|
+
"sortIcons": "capra-Table-module-YRCV0q-sortIcons"
|
|
5479
|
+
};
|
|
5480
|
+
//#endregion
|
|
5481
|
+
//#region src/components/Table/Table.tsx
|
|
5482
|
+
const EMPTY_CELL_PLACEHOLDER = "--";
|
|
5483
|
+
function isEmptyValue(value) {
|
|
5484
|
+
return value === null || value === void 0 || value === "";
|
|
5485
|
+
}
|
|
5486
|
+
function defineColumns(columns) {
|
|
5487
|
+
return columns;
|
|
5488
|
+
}
|
|
5489
|
+
function TableWithoutRef({ FORCE__className: classNameOverride, items, columns, visibleColumns, sortDescriptor, density = "default", appearance = "zebra", onSortChange, selectedKeys, onSelectionChange, isLoading = false, enableDragAndDrop = false, renderActionColumn, ...props }, ref) {
|
|
5490
|
+
const columnsToRender = React$1.useMemo(() => {
|
|
5491
|
+
return visibleColumns.map((id) => columns.find((c) => c.id === id)).filter((c) => c != null);
|
|
5492
|
+
}, [columns, visibleColumns]);
|
|
5493
|
+
const [dndItems, setDndItems] = React$1.useState(items);
|
|
5494
|
+
React$1.useEffect(() => {
|
|
5495
|
+
setDndItems(items);
|
|
5496
|
+
}, [items]);
|
|
5497
|
+
const { dragAndDropHooks } = useDragAndDrop({
|
|
5498
|
+
getItems(keys) {
|
|
5499
|
+
return [...keys].map((key) => ({ "text/plain": String(key) }));
|
|
5500
|
+
},
|
|
5501
|
+
onReorder(e) {
|
|
5502
|
+
setDndItems((prev) => {
|
|
5503
|
+
const movedItems = [...e.keys].map((key) => prev.find((item) => item.id === key));
|
|
5504
|
+
const filtered = prev.filter((item) => !e.keys.has(item.id));
|
|
5505
|
+
const targetIndex = filtered.findIndex((item) => item.id === e.target.key);
|
|
5506
|
+
if (e.target.dropPosition === "before") filtered.splice(targetIndex, 0, ...movedItems);
|
|
5507
|
+
else filtered.splice(targetIndex + 1, 0, ...movedItems);
|
|
5508
|
+
return filtered;
|
|
5509
|
+
});
|
|
5510
|
+
},
|
|
5511
|
+
renderDropIndicator(target) {
|
|
5512
|
+
return /* @__PURE__ */ React$1.createElement(DropIndicator, {
|
|
5513
|
+
target,
|
|
5514
|
+
className: Table_module_default.dropIndicator
|
|
5515
|
+
});
|
|
5516
|
+
}
|
|
5517
|
+
});
|
|
5518
|
+
const skeletonItems = React$1.useMemo(() => Array.from({ length: 5 }, (_, i) => ({ id: `skeleton-${i}` })), []);
|
|
5519
|
+
return /* @__PURE__ */ React$1.createElement(Table$1, {
|
|
5520
|
+
...props,
|
|
5521
|
+
ref,
|
|
5522
|
+
sortDescriptor,
|
|
5523
|
+
selectedKeys,
|
|
5524
|
+
onSelectionChange,
|
|
5525
|
+
className: clsx(Table_module_default.base, classNameOverride),
|
|
5526
|
+
"data-density": density,
|
|
5527
|
+
"data-appearance": appearance,
|
|
5528
|
+
onSortChange,
|
|
5529
|
+
dragAndDropHooks: enableDragAndDrop ? dragAndDropHooks : void 0
|
|
5530
|
+
}, /* @__PURE__ */ React$1.createElement(TableHeader$1, {
|
|
5531
|
+
columns: columnsToRender,
|
|
5532
|
+
className: Table_module_default.header,
|
|
5533
|
+
shouldShowActionColumn: !!renderActionColumn
|
|
5534
|
+
}, (column) => {
|
|
5535
|
+
return /* @__PURE__ */ React$1.createElement(Column$1, {
|
|
5536
|
+
isRowHeader: true,
|
|
5537
|
+
key: column.id,
|
|
5538
|
+
id: column.id,
|
|
5539
|
+
allowsSorting: !enableDragAndDrop && column.allowsSorting,
|
|
5540
|
+
textValue: column.label
|
|
5541
|
+
}, column.label);
|
|
5542
|
+
}), /* @__PURE__ */ React$1.createElement(TableBody, {
|
|
5543
|
+
items: isLoading ? skeletonItems : enableDragAndDrop ? dndItems : items,
|
|
5544
|
+
dependencies: [columnsToRender, isLoading],
|
|
5545
|
+
className: Table_module_default.body
|
|
5546
|
+
}, (_item) => {
|
|
5547
|
+
const item = _item;
|
|
5548
|
+
return /* @__PURE__ */ React$1.createElement(Row$1, {
|
|
5549
|
+
isDisabled: item.isDisabled === true ? true : false,
|
|
5550
|
+
key: item.id,
|
|
5551
|
+
id: item.id,
|
|
5552
|
+
columns: columnsToRender,
|
|
5553
|
+
className: Table_module_default.row,
|
|
5554
|
+
actionColumn: !isLoading && renderActionColumn ? renderActionColumn(item) : void 0
|
|
5555
|
+
}, (column) => {
|
|
5556
|
+
return /* @__PURE__ */ React$1.createElement(Cell$1, {
|
|
5557
|
+
key: column.id,
|
|
5558
|
+
id: `${item.id}__${column.id}`,
|
|
5559
|
+
className: Table_module_default.cell
|
|
5560
|
+
}, isLoading ? /* @__PURE__ */ React$1.createElement(Skeleton, {
|
|
5561
|
+
title: false,
|
|
5562
|
+
paragraph: { rows: 1 },
|
|
5563
|
+
active: true
|
|
5564
|
+
}) : isEmptyValue(item[column.id]) ? /* @__PURE__ */ React$1.createElement("span", null, "--") : column.render ? column.render(item[column.id], item) : /* @__PURE__ */ React$1.createElement("span", null, item[column.id]));
|
|
5565
|
+
});
|
|
5566
|
+
}));
|
|
5567
|
+
}
|
|
5568
|
+
/**
|
|
5569
|
+
* A component for rendering tabular data
|
|
5570
|
+
*/
|
|
5571
|
+
const Table = fixedForwardRef(TableWithoutRef);
|
|
5572
|
+
function Column$1(props) {
|
|
5573
|
+
return /* @__PURE__ */ React$1.createElement(Column, {
|
|
5574
|
+
...props,
|
|
5575
|
+
className: Table_module_default.column
|
|
5576
|
+
}, ({ allowsSorting, sortDirection }) => {
|
|
5577
|
+
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement("div", { className: Table_module_default.columnHeader }, /* @__PURE__ */ React$1.createElement(Group, {
|
|
5578
|
+
role: "presentation",
|
|
5579
|
+
tabIndex: -1,
|
|
5580
|
+
className: Table_module_default.columnName
|
|
5581
|
+
}, props.children), allowsSorting && (sortDirection ? /* @__PURE__ */ React$1.createElement(SortedIcons, { sortDirection }) : /* @__PURE__ */ React$1.createElement(NonSortedIcons, null)), props.allowsResizing && /* @__PURE__ */ React$1.createElement(ColumnResizer, null)), /* @__PURE__ */ React$1.createElement("div", { className: Table_module_default.columnDivider }));
|
|
5582
|
+
});
|
|
5583
|
+
}
|
|
5584
|
+
function TableHeader$1({ columns, children, shouldShowActionColumn, ...otherProps }) {
|
|
5585
|
+
const { selectionBehavior, selectionMode, allowsDragging } = useTableOptions();
|
|
5586
|
+
return /* @__PURE__ */ React$1.createElement(TableHeader, otherProps, allowsDragging && /* @__PURE__ */ React$1.createElement(Column, {
|
|
5587
|
+
width: 20,
|
|
5588
|
+
minWidth: 20,
|
|
5589
|
+
style: { width: 20 },
|
|
5590
|
+
className: Table_module_default.column
|
|
5591
|
+
}, /* @__PURE__ */ React$1.createElement("div", { className: Table_module_default.columnDivider })), selectionBehavior === "toggle" && /* @__PURE__ */ React$1.createElement(Column, {
|
|
5592
|
+
width: 32,
|
|
5593
|
+
minWidth: 32,
|
|
5594
|
+
style: { width: 32 },
|
|
5595
|
+
className: Table_module_default.column
|
|
5596
|
+
}, selectionMode === "multiple" && /* @__PURE__ */ React$1.createElement(RACCheckbox, { slot: "selection" }), /* @__PURE__ */ React$1.createElement("div", { className: Table_module_default.columnDivider })), /* @__PURE__ */ React$1.createElement(Collection, { items: columns }, children), shouldShowActionColumn && /* @__PURE__ */ React$1.createElement(Column, { className: Table_module_default.column }, "Actions"));
|
|
5597
|
+
}
|
|
5598
|
+
function Row$1({ id, columns, children, actionColumn, ...otherProps }) {
|
|
5599
|
+
const { selectionBehavior, allowsDragging } = useTableOptions();
|
|
5600
|
+
return /* @__PURE__ */ React$1.createElement(Row, {
|
|
5601
|
+
id,
|
|
5602
|
+
...otherProps
|
|
5603
|
+
}, allowsDragging && /* @__PURE__ */ React$1.createElement(Cell$1, {
|
|
5604
|
+
className: Table_module_default.cell,
|
|
5605
|
+
"data-padding": "reduced"
|
|
5606
|
+
}, /* @__PURE__ */ React$1.createElement(IconButton, {
|
|
5607
|
+
slot: "drag",
|
|
5608
|
+
appearance: "neutral",
|
|
5609
|
+
variant: "tertiary",
|
|
5610
|
+
size: "xs",
|
|
5611
|
+
icon: DragGrip,
|
|
5612
|
+
"aria-label": "Drag"
|
|
5613
|
+
})), selectionBehavior === "toggle" && /* @__PURE__ */ React$1.createElement(Cell$1, {
|
|
5614
|
+
className: Table_module_default.cell,
|
|
5615
|
+
"data-padding": "reduced"
|
|
5616
|
+
}, /* @__PURE__ */ React$1.createElement(RACCheckbox, { slot: "selection" })), /* @__PURE__ */ React$1.createElement(Collection, { items: columns }, children), actionColumn && /* @__PURE__ */ React$1.createElement(Cell$1, { className: Table_module_default.cell }, actionColumn));
|
|
5617
|
+
}
|
|
5618
|
+
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\"]";
|
|
5619
|
+
function Cell$1(props) {
|
|
5620
|
+
return /* @__PURE__ */ React$1.createElement(Cell, {
|
|
5621
|
+
...props,
|
|
5622
|
+
onPointerDown: (e) => {
|
|
5623
|
+
if (e.target.closest(INTERACTIVE_ELEMENT_SELECTOR)) e.stopPropagation();
|
|
5624
|
+
}
|
|
5625
|
+
}, composeRenderProps(props.children, (children, { hasChildItems, isTreeColumn }) => /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, isTreeColumn && hasChildItems && /* @__PURE__ */ React$1.createElement(IconButton, {
|
|
5626
|
+
slot: "chevron",
|
|
5627
|
+
icon: ChevronRight,
|
|
5628
|
+
"aria-label": "Chevron"
|
|
5629
|
+
}), children)));
|
|
5630
|
+
}
|
|
5631
|
+
function NonSortedIcons() {
|
|
5632
|
+
return /* @__PURE__ */ React$1.createElement("div", { className: Table_module_default.sortIcons }, /* @__PURE__ */ React$1.createElement(CaretUp, { size: "sm" }), /* @__PURE__ */ React$1.createElement(CaretDown, { size: "sm" }));
|
|
5633
|
+
}
|
|
5634
|
+
function SortedIcons(props) {
|
|
5635
|
+
return /* @__PURE__ */ React$1.createElement("div", {
|
|
5636
|
+
className: Table_module_default.sortIcons,
|
|
5637
|
+
"data-sort-direction": props.sortDirection
|
|
5638
|
+
}, /* @__PURE__ */ React$1.createElement(CaretUp, { size: "sm" }), /* @__PURE__ */ React$1.createElement(CaretDown, { size: "sm" }));
|
|
5639
|
+
}
|
|
5640
|
+
//#endregion
|
|
4938
5641
|
//#region src/components/Tree/Tree.module.css
|
|
4939
5642
|
var Tree_module_default = {
|
|
4940
5643
|
"chevronButton": "capra-Tree-module--hXpBa-chevronButton",
|
|
@@ -5169,4 +5872,4 @@ function Tree({ FORCE__className: classNameOverride, items, selectionMode = "mul
|
|
|
5169
5872
|
}, /* @__PURE__ */ React$1.createElement(Collection, { items }, renderTreeItem)));
|
|
5170
5873
|
}
|
|
5171
5874
|
//#endregion
|
|
5172
|
-
export { Alert, Anchor, AutocompleteField, Badge, BadgeLayout, Breadcrumb, Breadcrumbs, Button, ButtonLink, Card, Checkbox, Collapse, CustomTooltipTrigger, DatePickerField, DateRangePickerField, Divider, Drawer, EmptyState, IconButton, InputRow, Label, Link, ListItem, Menu, Modal, NumberField, Pagination, PasswordField, Pill, Popover, Radio, RadioGroup, RadioTile, Ribbon, RouterProvider, SKELETON_SIZE, SKELETON_SIZE_TOKENS, Skeleton, SkeletonGroup, Spinner, Switch, TabNav, Tag, Text, TextArea, TextField, Toast, Tooltip, TopNav, Tree, VerticalNavigation, VisuallyHidden, submenuPanelClassName, tagColors };
|
|
5875
|
+
export { Alert, Anchor, AutocompleteField, Badge, BadgeLayout, Breadcrumb, Breadcrumbs, Button, ButtonLink, Card, Checkbox, Collapse, CustomTooltipTrigger, DatePickerField, DateRangePickerField, Divider, Drawer, EMPTY_CELL_PLACEHOLDER, EmptyState, FilterToolbar, IconButton, InputRow, Label, Link, ListItem, Menu, Modal, NumberField, Pagination, PasswordField, Pill, Popover, Radio, RadioGroup, RadioTile, Ribbon, RouterProvider, SKELETON_SIZE, SKELETON_SIZE_TOKENS, SelectField, Skeleton, SkeletonGroup, Spinner, Switch, TabNav, Table, Tag, Text, TextArea, TextField, Toast, ToggleButtonGroup, Tooltip, TopNav, Tree, VerticalNavigation, VisuallyHidden, defineColumns, submenuPanelClassName, tagColors };
|