@cwellt_software/cwellt-reactjs-lib 1.5.5 → 1.6.1
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/content/icons/IconLibrary.stories.tsx +18 -0
- package/dist/index.cjs.js +117 -93
- package/dist/index.css +2 -2
- package/dist/index.d.ts +63 -42
- package/dist/index.es.js +117 -93
- package/dist/src/components/control/action/contextmenu/CwAnchoredMenu.d.ts +1 -1
- package/dist/src/components/control/action/contextmenu/CwAnchoredMenu.d.ts.map +1 -1
- package/dist/src/components/control/action/contextmenu/CwContextMenu.d.ts +2 -3
- package/dist/src/components/control/action/contextmenu/CwContextMenu.d.ts.map +1 -1
- package/dist/src/components/control/choice/dropdown/CwDropdownFilter.d.ts +4 -0
- package/dist/src/components/control/choice/dropdown/CwDropdownFilter.d.ts.map +1 -1
- package/dist/src/components/control/input/any/CwInput.d.ts +4 -0
- package/dist/src/components/control/input/any/CwInput.d.ts.map +1 -1
- package/dist/src/components/control/input/color/CwColorPicker.d.ts +2 -3
- package/dist/src/components/control/input/color/CwColorPicker.d.ts.map +1 -1
- package/dist/src/components/control/input/color/CwInputColor.d.ts +1 -2
- package/dist/src/components/control/input/color/CwInputColor.d.ts.map +1 -1
- package/dist/src/components/control/input/date-text/CwInputDateText.d.ts +4 -0
- package/dist/src/components/control/input/date-text/CwInputDateText.d.ts.map +1 -1
- package/dist/src/components/control/input/file/CwFileUploadMultiple.d.ts +1 -2
- package/dist/src/components/control/input/file/CwFileUploadMultiple.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts +0 -1
- package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDatePickerTemporal.d.ts +0 -1
- package/dist/src/components/control/input/new-dates/CwDatePickerTemporal.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePickerTemporal.d.ts +0 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePickerTemporal.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePickerCompact.d.ts +0 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePickerCompact.d.ts.map +1 -1
- package/dist/src/components/control/input/text/CwInputText.d.ts +3 -4
- package/dist/src/components/control/input/text/CwInputText.d.ts.map +1 -1
- package/dist/src/components/control/input/text-area/CwTextArea.d.ts +1 -1
- package/dist/src/components/control/input/text-area/CwTextArea.d.ts.map +1 -1
- package/dist/src/components/control/input/weekday/CwWeekdaySelector.d.ts +1 -2
- package/dist/src/components/control/input/weekday/CwWeekdaySelector.d.ts.map +1 -1
- package/dist/src/components/display/data/accordion/CwAccordionContainer.d.ts +2 -4
- package/dist/src/components/display/data/accordion/CwAccordionContainer.d.ts.map +1 -1
- package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts +4 -0
- package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts.map +1 -1
- package/dist/src/components/display/data/tooltip_manager/CwTooltip.d.ts +1 -2
- package/dist/src/components/display/data/tooltip_manager/CwTooltip.d.ts.map +1 -1
- package/dist/src/components/display/graphics/loading/CwLoading.d.ts +1 -1
- package/dist/src/components/display/graphics/loading/CwLoading.d.ts.map +1 -1
- package/dist/src/components/display/text/tag/CwChip.d.ts +9 -9
- package/dist/src/components/display/text/tag/CwChip.d.ts.map +1 -1
- package/dist/src/components/layout/card/CwCard.d.ts +17 -17
- package/dist/src/components/layout/card/CwCard.d.ts.map +1 -1
- package/dist/src/components/layout/confirmation-popup/CwConfirmationPopup.d.ts +5 -0
- package/dist/src/components/layout/confirmation-popup/CwConfirmationPopup.d.ts.map +1 -1
- package/dist/src/components/layout/dialog/CwDialog.d.ts +1 -1
- package/dist/src/components/layout/dialog/CwDialog.d.ts.map +1 -1
- package/dist/src/components/layout/list/details/CwExpandable.d.ts +2 -1
- package/dist/src/components/layout/list/details/CwExpandable.d.ts.map +1 -1
- package/dist/src/components/layout/modal/hover/CwModalHover.d.ts +2 -1
- package/dist/src/components/layout/modal/hover/CwModalHover.d.ts.map +1 -1
- package/dist/src/components/layout/table/grouped/CwTableGrouped.d.ts +1 -0
- package/dist/src/components/layout/table/grouped/CwTableGrouped.d.ts.map +1 -1
- package/package.json +11 -3
package/dist/index.es.js
CHANGED
|
@@ -7,7 +7,6 @@ import Draggable from 'react-draggable';
|
|
|
7
7
|
import { format } from 'date-fns';
|
|
8
8
|
import { enGB } from 'date-fns/locale';
|
|
9
9
|
import { DayPicker } from 'react-day-picker';
|
|
10
|
-
import 'react-day-picker/dist/style.css';
|
|
11
10
|
import { VariableSizeList } from 'react-window';
|
|
12
11
|
|
|
13
12
|
class CwSelectList {
|
|
@@ -175,7 +174,7 @@ function getContrastColor(color) {
|
|
|
175
174
|
return `hsl(${hsl.h}, ${contrastS}%, ${targetL}%)`;
|
|
176
175
|
}
|
|
177
176
|
|
|
178
|
-
var styles$
|
|
177
|
+
var styles$z = {"cw-tooltip-content":"cw-tooltip-module__cw-tooltip-content__RZczd","cw-tooltip":"cw-tooltip-module__cw-tooltip__1KYig"};
|
|
179
178
|
|
|
180
179
|
// Constants
|
|
181
180
|
const margin$1 = 16;
|
|
@@ -465,7 +464,7 @@ const CwTooltipManager = () => {
|
|
|
465
464
|
if (!state.isVisible || !state.content) {
|
|
466
465
|
return null;
|
|
467
466
|
}
|
|
468
|
-
return createPortal(jsx("div", { ref: tooltipRef, className: styles$
|
|
467
|
+
return createPortal(jsx("div", { ref: tooltipRef, className: styles$z["cw-tooltip-content"], "data-position": actualPosition, "data-visible": state.isVisible, "data-inline": state.displayInline, style: {
|
|
469
468
|
top: `${tooltipPosition.top}px`,
|
|
470
469
|
left: `${tooltipPosition.left}px`,
|
|
471
470
|
opacity: (isPositioned && !isMeasuring) ? 1 : 0,
|
|
@@ -546,7 +545,7 @@ const CwTooltipNew = ({ children, content = null, position = "right", dissapears
|
|
|
546
545
|
useEffect(() => {
|
|
547
546
|
ensureTooltipManager();
|
|
548
547
|
}, []);
|
|
549
|
-
return (jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$
|
|
548
|
+
return (jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$z["cw-tooltip"], children: children }));
|
|
550
549
|
};
|
|
551
550
|
|
|
552
551
|
const SVG_ICONS = {
|
|
@@ -666,7 +665,7 @@ function resolveBadgeAria(label, loading, hasText) {
|
|
|
666
665
|
return hasText ? {} : { 'aria-hidden': 'true' };
|
|
667
666
|
}
|
|
668
667
|
|
|
669
|
-
var styles$
|
|
668
|
+
var styles$y = {"badge":"cw-badge-module__badge__PKlak"};
|
|
670
669
|
|
|
671
670
|
/**
|
|
672
671
|
* CwBadge - the small coloured circle with a number, used for alert and notification counts.
|
|
@@ -695,7 +694,7 @@ const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'sm
|
|
|
695
694
|
? formatBadgeCount(count, max)
|
|
696
695
|
: undefined;
|
|
697
696
|
const isDot = !loading && !hasContent && count === undefined;
|
|
698
|
-
const badgeClassNames = ['cw-badge', styles$
|
|
697
|
+
const badgeClassNames = ['cw-badge', styles$y.badge, className].filter(Boolean).join(' ');
|
|
699
698
|
return (jsx("span", { className: badgeClassNames, "data-color": color, "data-variant": variant, "data-size": size, "data-loading": loading ? 'true' : undefined, "data-dot": isDot ? 'true' : undefined, ...resolveBadgeAria(label, loading, !loading && (hasContent || countText !== undefined)), style: style, children: loading ? jsx(CwIcon, { iconId: "spinner", size: "small" }) : hasContent ? content : countText }));
|
|
700
699
|
};
|
|
701
700
|
|
|
@@ -1083,7 +1082,7 @@ function CwLoading({ isLoading = false, text = '', size = 'regular', iconPositio
|
|
|
1083
1082
|
return (jsxs("div", { "aria-busy": isLoading, className: "cw-loading-container", "data-children": !!children, children: [overlay, jsx("div", { className: "cw-loading-disabled-content", children: children })] }));
|
|
1084
1083
|
}
|
|
1085
1084
|
|
|
1086
|
-
var styles$
|
|
1085
|
+
var styles$x = {"skeleton":"cw-skeleton-module__skeleton__Jvx2x","group":"cw-skeleton-module__group__Cm8AU"};
|
|
1087
1086
|
|
|
1088
1087
|
/*
|
|
1089
1088
|
* Internal helper for skeleton allocations (CwSkeleton, tables, cards).
|
|
@@ -1125,8 +1124,8 @@ function CwSkeleton({ variant = 'text', width, height, count = 1, radius, gap })
|
|
|
1125
1124
|
};
|
|
1126
1125
|
// The un-hashed cw-skeleton / cw-skeleton-group classes carry no styles in the
|
|
1127
1126
|
// library - they are stable public hooks for exceptional external overrides.
|
|
1128
|
-
const skeletonClassName = ['cw-skeleton', styles$
|
|
1129
|
-
const groupClassName = ['cw-skeleton-group', styles$
|
|
1127
|
+
const skeletonClassName = ['cw-skeleton', styles$x.skeleton].filter(Boolean).join(' ');
|
|
1128
|
+
const groupClassName = ['cw-skeleton-group', styles$x.group].filter(Boolean).join(' ');
|
|
1130
1129
|
const lineCount = normalizeSkeletonCount(count, 1);
|
|
1131
1130
|
if (lineCount <= 1) {
|
|
1132
1131
|
return (jsx("span", { className: skeletonClassName, "data-variant": variant, "aria-hidden": "true", style: style }));
|
|
@@ -1138,7 +1137,7 @@ function CwSkeleton({ variant = 'text', width, height, count = 1, radius, gap })
|
|
|
1138
1137
|
return (jsx("span", { className: groupClassName, "aria-hidden": "true", style: groupStyle, children: skeletonElements }));
|
|
1139
1138
|
}
|
|
1140
1139
|
|
|
1141
|
-
var styles$
|
|
1140
|
+
var styles$w = {"progress":"cw-progress-module__progress__d-g2-","value":"cw-progress-module__value__Q-DrH","header":"cw-progress-module__header__mv5ct","label":"cw-progress-module__label__jwOWp","track":"cw-progress-module__track__572-3","fill":"cw-progress-module__fill__fX1UA"};
|
|
1142
1141
|
|
|
1143
1142
|
/**
|
|
1144
1143
|
* CwProgress - a determinate or indeterminate progress bar.
|
|
@@ -1162,17 +1161,17 @@ function CwProgress({ value, indeterminate = false, label, rightLabel, size = 'r
|
|
|
1162
1161
|
const valueText = rightLabel ?? (percent !== undefined ? `${percent}%` : '');
|
|
1163
1162
|
// The un-hashed cw-progress class carries no styles in the library - a stable
|
|
1164
1163
|
// public hook for exceptional external overrides only.
|
|
1165
|
-
const rootClassName = ['cw-progress', styles$
|
|
1166
|
-
const labelSpan = label ? jsx("span", { className: styles$
|
|
1167
|
-
const valueLabel = showValue ? (jsx("span", { className: styles$
|
|
1168
|
-
return (jsxs("div", { className: rootClassName, "data-layout": layout, "data-size": size, "data-color": color, "data-prominent": prominent || undefined, "data-indeterminate": indeterminate || undefined, children: [layout === 'column' && (labelSpan || valueLabel) && (jsxs("header", { className: styles$
|
|
1164
|
+
const rootClassName = ['cw-progress', styles$w.progress, className].filter(Boolean).join(' ');
|
|
1165
|
+
const labelSpan = label ? jsx("span", { className: styles$w.label, id: labelId, children: label }) : null;
|
|
1166
|
+
const valueLabel = showValue ? (jsx("span", { className: styles$w.value, "data-mono": monoValue || undefined, children: valueText })) : null;
|
|
1167
|
+
return (jsxs("div", { className: rootClassName, "data-layout": layout, "data-size": size, "data-color": color, "data-prominent": prominent || undefined, "data-indeterminate": indeterminate || undefined, children: [layout === 'column' && (labelSpan || valueLabel) && (jsxs("header", { className: styles$w.header, children: [labelSpan, valueLabel] })), layout === 'row' && labelSpan, jsx("div", { className: styles$w.track, role: "progressbar", ...(label && { 'aria-labelledby': labelId }), ...(!indeterminate && percent !== undefined && {
|
|
1169
1168
|
'aria-valuenow': percent,
|
|
1170
1169
|
'aria-valuemin': 0,
|
|
1171
1170
|
'aria-valuemax': 100
|
|
1172
|
-
}), children: jsx("div", { className: styles$
|
|
1171
|
+
}), children: jsx("div", { className: styles$w.fill, style: !indeterminate && clamped !== undefined ? { width: `${clamped}%` } : undefined }) }), layout === 'row' && valueLabel] }));
|
|
1173
1172
|
}
|
|
1174
1173
|
|
|
1175
|
-
var styles$
|
|
1174
|
+
var styles$v = {"cw-generic-tooltip-content":"cw-generic-tooltip-module__cw-generic-tooltip-content__la-Si","cw-generic-tooltip":"cw-generic-tooltip-module__cw-generic-tooltip__Ij76M"};
|
|
1176
1175
|
|
|
1177
1176
|
// Constants moved outside to prevent recreation
|
|
1178
1177
|
const margin = 16;
|
|
@@ -1289,18 +1288,22 @@ const useTooltipPosition = (isVisible, containerRef, preferredPosition, tooltipC
|
|
|
1289
1288
|
*
|
|
1290
1289
|
* @see CwTooltipNew
|
|
1291
1290
|
*/
|
|
1291
|
+
/**
|
|
1292
|
+
* Portal-per-instance tooltip.
|
|
1293
|
+
* @deprecated Use {@link CwTooltipNew}: same API, one shared portal for every tooltip on the page.
|
|
1294
|
+
*/
|
|
1292
1295
|
const CwGenericTooltip = ({ children, content = null, position = defaultPosition, dissapearsWhenHover = false, hide = false, overlayStyle = {}, showDelay = 0, displayInline = false, }) => {
|
|
1293
1296
|
const [isVisible, setIsVisible] = useState(false);
|
|
1294
1297
|
const containerRef = useRef(null);
|
|
1295
1298
|
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
|
|
1296
1299
|
setIsVisible(true);
|
|
1297
1300
|
}, showDelay);
|
|
1298
|
-
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$
|
|
1301
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$v["cw-generic-tooltip-content"]);
|
|
1299
1302
|
// Memoize tooltip content creation
|
|
1300
1303
|
const tooltipContent = useMemo(() => {
|
|
1301
1304
|
if (hide || !isVisible || !content)
|
|
1302
1305
|
return null;
|
|
1303
|
-
return createPortal(jsx("div", { className: styles$
|
|
1306
|
+
return createPortal(jsx("div", { className: styles$v["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, "data-inline": displayInline, style: {
|
|
1304
1307
|
position: 'fixed',
|
|
1305
1308
|
top: `${tooltipPosition.top}px`,
|
|
1306
1309
|
left: `${tooltipPosition.left}px`,
|
|
@@ -1315,7 +1318,7 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1315
1318
|
clearTooltipTimeout();
|
|
1316
1319
|
setIsVisible(false);
|
|
1317
1320
|
}, [clearTooltipTimeout]);
|
|
1318
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
1321
|
+
return (jsxs("div", { ref: containerRef, className: styles$v["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, children: [tooltipContent, children] }));
|
|
1319
1322
|
};
|
|
1320
1323
|
|
|
1321
1324
|
const CwButton = React__default.forwardRef(function CwButton({ text, variant = 'solid', color = 'primary', size = 'medium', iconPosition = 'left', pressed, className = '', icon = "", title, tooltipPosition = "bottom", badge, children, ...buttonProps }, ref) {
|
|
@@ -1383,8 +1386,13 @@ function CwModal(custModalProps) {
|
|
|
1383
1386
|
return (jsx("div", { children: custModalProps.modalState && (jsxs("div", { className: custModalProps.classNameModalOverlay + " cwelltModalOverlay", children: [jsx("div", { className: "cwelltModalOverlayBg", onClick: custModalProps.onCloseModal }), jsx(Draggable, { disabled: isModalDisabled, axis: "both", nodeRef: draggableRef, children: jsxs("div", { className: custModalProps.classNameModal + " cwelltContainerModal", ref: draggableRef, style: widthModalDef !== "40em" ? modalStyle.widthCustomStyle : modalStyle.widthDefStyle, children: [jsxs("div", { className: "cwelltModalHeader", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsx("div", { className: "cwelltModalTitle", children: custModalProps.titleModal }), jsx("button", { className: "cwelltBtnCloseModal", onClick: custModalProps.onCloseModal, children: jsx("span", { className: "cwelltCloseIcon" }) })] }), jsx("div", { className: "cwelltModalBody", children: jsx("div", { className: "cwelltContainerModalBody", style: { position: "relative" }, children: custModalProps.children }) }), isHide === false ? (jsx("footer", { className: "legacy-modal-footer", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: custModalProps.onSaveModal, form: custModalProps.formSaveModal, hidden: custModalProps.HideBtnModal, type: custModalProps.HtmlSubmitModal }) })) : (jsx("div", { style: { display: "none" } }))] }) })] })) }));
|
|
1384
1387
|
}
|
|
1385
1388
|
|
|
1386
|
-
var styles$
|
|
1389
|
+
var styles$u = {"overlayPositioned":"CwConfirmationPopup-module__overlayPositioned__11qYB","popup":"CwConfirmationPopup-module__popup__ahPjM","message":"CwConfirmationPopup-module__message__MnNL4","buttons":"CwConfirmationPopup-module__buttons__fGYYE","button":"CwConfirmationPopup-module__button__ugYQE","confirmButton":"CwConfirmationPopup-module__confirmButton__rTP4S","cancelButton":"CwConfirmationPopup-module__cancelButton__Ry694"};
|
|
1387
1390
|
|
|
1391
|
+
/**
|
|
1392
|
+
* Small anchored confirmation for a destructive action.
|
|
1393
|
+
*
|
|
1394
|
+
* Preferably avoid using it, it needs a refactor.
|
|
1395
|
+
*/
|
|
1388
1396
|
function CwConfirmationPopup(props) {
|
|
1389
1397
|
const { isOpen, onConfirm, onCancel, message = "Are you sure you want to proceed?", confirmText = "Confirm", cancelText = "Cancel", placement = 'bottom', children } = props;
|
|
1390
1398
|
const triggerRef = useRef(null);
|
|
@@ -1447,15 +1455,15 @@ function CwConfirmationPopup(props) {
|
|
|
1447
1455
|
onCancel();
|
|
1448
1456
|
}
|
|
1449
1457
|
};
|
|
1450
|
-
return (jsxs(Fragment, { children: [renderChildren(), isOpen && (jsx("div", { className: styles$
|
|
1458
|
+
return (jsxs(Fragment, { children: [renderChildren(), isOpen && (jsx("div", { className: styles$u.overlayPositioned, onClick: handleOverlayClick, children: jsxs("div", { ref: popupRef, className: styles$u.popup, style: {
|
|
1451
1459
|
position: 'absolute',
|
|
1452
1460
|
top: `${position.top}px`,
|
|
1453
1461
|
left: `${position.left}px`,
|
|
1454
1462
|
transform: 'none'
|
|
1455
|
-
}, children: [jsx("p", { className: styles$
|
|
1463
|
+
}, children: [jsx("p", { className: styles$u.message, children: message }), jsxs("div", { className: styles$u.buttons, children: [jsx("button", { className: `${styles$u.button} ${styles$u.confirmButton}`, onClick: onConfirm, children: confirmText }), jsx("button", { className: `${styles$u.button} ${styles$u.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
|
|
1456
1464
|
}
|
|
1457
1465
|
|
|
1458
|
-
var styles$
|
|
1466
|
+
var styles$t = {"cw-dialog-main":"cw-dialog-module__cw-dialog-main__cHxHt","cw-dialog-button-close":"cw-dialog-module__cw-dialog-button-close__9GRd8"};
|
|
1459
1467
|
|
|
1460
1468
|
// Helper function to parse size values
|
|
1461
1469
|
const parseSize = (size) => {
|
|
@@ -1728,7 +1736,7 @@ const CwDialog = props => {
|
|
|
1728
1736
|
}
|
|
1729
1737
|
}
|
|
1730
1738
|
}, [open]);
|
|
1731
|
-
const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$
|
|
1739
|
+
const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$t["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
|
|
1732
1740
|
const content = useMemo(() => (jsx("section", { children: children })), [children]);
|
|
1733
1741
|
const footer = useMemo(() => (jsx("footer", { children: customFooter || (jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: onSave, tooltipPosition: "top", disabled: disableSave, "data-testid": "cw-dialog-save" })) })), [customFooter, onSave, disableSave]);
|
|
1734
1742
|
const resizeHandles = useMemo(() => size.autoHeight
|
|
@@ -1755,7 +1763,7 @@ const CwDialog = props => {
|
|
|
1755
1763
|
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
1756
1764
|
return { displayWidth, displayHeight };
|
|
1757
1765
|
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
1758
|
-
const dialogContent = (jsx("div", { "data-has-scrim": hasScrim, className: styles$
|
|
1766
|
+
const dialogContent = (jsx("div", { "data-has-scrim": hasScrim, className: styles$t["cw-dialog-main"], onMouseDown: handleScrimMouseDown, onMouseUp: handleScrimMouseUpOrLeave, onMouseLeave: handleScrimMouseUpOrLeave, "data-pressing": isPressingScrim, children: jsxs("dialog", { ...domProps, ref: dialogRef, style: {
|
|
1759
1767
|
left: `${position.x}px`,
|
|
1760
1768
|
top: `${position.y}px`,
|
|
1761
1769
|
width: displayDimensions.displayWidth,
|
|
@@ -1808,7 +1816,8 @@ class CwReportModal extends React.Component {
|
|
|
1808
1816
|
}
|
|
1809
1817
|
|
|
1810
1818
|
/**
|
|
1811
|
-
* A modal that appears when an element is hovered
|
|
1819
|
+
* A modal that appears when an element is hovered.
|
|
1820
|
+
* Preferably avoid using it, it needs a refactor.
|
|
1812
1821
|
* @param children Contents of the modal
|
|
1813
1822
|
* @param hovereable Element to hover to display the modal
|
|
1814
1823
|
* @param onFirstOpened Function to run only once when the modal opens for the first time
|
|
@@ -1916,7 +1925,7 @@ function CwAlign(props) {
|
|
|
1916
1925
|
}, children: props.children }));
|
|
1917
1926
|
}
|
|
1918
1927
|
|
|
1919
|
-
var styles$
|
|
1928
|
+
var styles$s = {"card":"cw-card-module__card__HJUT0","clickable":"cw-card-module__clickable__Y-V3X","disabled":"cw-card-module__disabled__0wHh1","content":"cw-card-module__content__ma9qy","headerContent":"cw-card-module__headerContent__x4Jfl","footerTags":"cw-card-module__footerTags__80sSW"};
|
|
1920
1929
|
|
|
1921
1930
|
/**
|
|
1922
1931
|
* CwCard - A simple card component for displaying content in a contained format
|
|
@@ -1942,10 +1951,10 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1942
1951
|
// Construct class names using CSS modules
|
|
1943
1952
|
const cardClassNames = [
|
|
1944
1953
|
'cw-card',
|
|
1945
|
-
styles$
|
|
1954
|
+
styles$s.card,
|
|
1946
1955
|
className,
|
|
1947
|
-
clickable ? styles$
|
|
1948
|
-
disabled ? styles$
|
|
1956
|
+
clickable ? styles$s.clickable : '',
|
|
1957
|
+
disabled ? styles$s.disabled : '',
|
|
1949
1958
|
].filter(Boolean).join(' ');
|
|
1950
1959
|
// Handle click event when card is clickable
|
|
1951
1960
|
const handleClick = () => {
|
|
@@ -1963,15 +1972,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1963
1972
|
const hasFooter = hasChips || footer || (hasActions && resolvedDirection === "row");
|
|
1964
1973
|
// Actions component to reuse. While loading, each provided action renders a circular
|
|
1965
1974
|
// ghost sized to the CwButton icon footprint (2rem) - no interactive buttons.
|
|
1966
|
-
const ActionsComponent = hasActions && !disabled ? (jsx("div", { className: styles$
|
|
1975
|
+
const ActionsComponent = hasActions && !disabled ? (jsx("div", { className: styles$s.actions, children: isLoading ? (jsxs(Fragment, { children: [extraActions && jsx(CwSkeleton, { variant: "circle", height: "2rem" }), onEdit && jsx(CwSkeleton, { variant: "circle", height: "2rem" }), onDelete && jsx(CwSkeleton, { variant: "circle", height: "2rem" })] })) : (jsxs(Fragment, { children: [extraActions ?? null, onEdit && jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) })) : null;
|
|
1967
1976
|
return (jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && !isLoading && {
|
|
1968
1977
|
role: 'button',
|
|
1969
1978
|
tabIndex: 0,
|
|
1970
1979
|
onClick: handleClick,
|
|
1971
|
-
}), "data-variant": variant, "data-direction": resolvedDirection, "aria-busy": isLoading || undefined, children: [isLoading ? (jsxs("header", { children: [jsx("div", { className: styles$
|
|
1980
|
+
}), "data-variant": variant, "data-direction": resolvedDirection, "aria-busy": isLoading || undefined, children: [isLoading ? (jsxs("header", { children: [jsx("div", { className: styles$s.headerContent, "data-align": resolvedAlign, children: jsx(CwSkeleton, { width: "8rem", height: "1.5em" }) }), resolvedDirection === "column" && ActionsComponent] })) : (hasHeader && (jsxs("header", { children: [(title || subtitle) && (jsxs("div", { className: styles$s.headerContent, "data-align": resolvedAlign, children: [title && jsx("h5", { children: title }), subtitle && jsx("strong", { children: subtitle })] })), resolvedDirection === "column" && ActionsComponent] }))), jsx("div", { className: styles$s.content, children: isLoading ? jsx(CwSkeleton, { count: normalizeSkeletonCount(skeletonLines, 3) }) : children }), hasFooter && (isLoading ? (jsx("footer", { children: jsx("div", { className: styles$s.footerTags, children: jsx(CwSkeleton, { variant: "rect", width: "4rem", height: "1.5em", radius: "1rem" }) }) })) : (jsxs("footer", { children: [hasChips && (jsx("div", { className: styles$s.footerTags, children: chips.map((chip, index) => (jsx(CwChip, { label: chip.label, colorScheme: chip.colorScheme, className: styles$s.chip, ...(chip.customColor && { customColor: chip.customColor }), ...(chip.variant && { variant: chip.variant }), ...(chip.icon && { icon: chip.icon }) }, index))) })), footer && (jsx("div", { className: styles$s.footerContent, children: footer }))] }))), resolvedDirection === "row" && ActionsComponent] }));
|
|
1972
1981
|
};
|
|
1973
1982
|
|
|
1974
|
-
var styles$
|
|
1983
|
+
var styles$r = {"cardContainer":"cw-card-list-module__cardContainer__l3YEh","pagination":"cw-card-list-module__pagination__5Ay78","pageInfo":"cw-card-list-module__pageInfo__uiMel","emptyState":"cw-card-list-module__emptyState__RlqiS"};
|
|
1975
1984
|
|
|
1976
1985
|
/**
|
|
1977
1986
|
* Option to display in the CwSelect
|
|
@@ -2066,16 +2075,14 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
|
|
|
2066
2075
|
icon: sortDirection === 'asc' ? 'arrow-up' : 'arrow-down',
|
|
2067
2076
|
onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'),
|
|
2068
2077
|
title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}`,
|
|
2069
|
-
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsx("div", { className: `${styles$
|
|
2078
|
+
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsx("div", { className: `${styles$r.cardContainer}`, "data-layout": layout, style: gridStyle, "aria-busy": true, children: Array.from({ length: normalizeSkeletonCount(skeletonCards, 6) }, (_, index) => (jsx(CwCard, { isLoading: true, children: null }, `skeleton_${index}`))) })) : sortedItems.length === 0 ? (jsx("div", { className: styles$r.emptyState, children: emptyState || jsx("p", { children: "No items to display" }) })) : (jsxs(Fragment, { children: [jsx("div", { className: `${styles$r.cardContainer}`, "data-layout": layout, style: gridStyle, children: visibleItems.map((item, index) => (jsx(React__default.Fragment, { children: renderCard(item, index) }, keyExtractor ? keyExtractor(item, index) : index))) }), totalPages > 1 && (jsxs("div", { className: styles$r.pagination, children: [jsx(CwButton, { variant: "icon", icon: "chevron-left", disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)) }), jsxs("span", { className: styles$r.pageInfo, children: [currentPage, " / ", totalPages] }), jsx(CwButton, { variant: "icon", icon: "chevron-right", disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)) })] }))] }))] }));
|
|
2070
2079
|
}
|
|
2071
2080
|
|
|
2072
|
-
var styles$
|
|
2081
|
+
var styles$q = {"cw-accordion":"cw-accordion-module__cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module__cw-accordion-body__xlI8b"};
|
|
2073
2082
|
|
|
2074
2083
|
/**
|
|
2075
|
-
*
|
|
2076
|
-
* @
|
|
2077
|
-
* @remarks Previously CwAccordionContainer
|
|
2078
|
-
* @returns
|
|
2084
|
+
* Legacy collapsible section with its own header markup.
|
|
2085
|
+
* @deprecated Use {@link CwExpandable} instead.
|
|
2079
2086
|
*/
|
|
2080
2087
|
function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
2081
2088
|
// #region Hooks
|
|
@@ -2086,7 +2093,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
2086
2093
|
setVisible_accordionBody(!isVisible_accordionBody);
|
|
2087
2094
|
};
|
|
2088
2095
|
// #endregion
|
|
2089
|
-
return (jsxs("div", { className: styles$
|
|
2096
|
+
return (jsxs("div", { className: styles$q["cw-accordion"], style: CwelltAccordionContainerProps.style, "data-open": isVisible_accordionBody, children: [jsxs("header", { onClick: () => showAccordionBody(), children: [jsx("div", { children: CwelltAccordionContainerProps.desc_text }), jsx("button", { className: "cw-button-icon" })] }), jsx("div", { className: styles$q["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
|
|
2090
2097
|
}
|
|
2091
2098
|
|
|
2092
2099
|
/*
|
|
@@ -2328,7 +2335,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2328
2335
|
: classNameRow ?? "";
|
|
2329
2336
|
return (jsxs(React__default.Fragment, { children: [jsxs("tr", { className: `${dynamicClassName} ${hasClassNameRow(item) ? item.classNameRow : ""} ${isSelected ? "cw-table-row-selected" : ""}`, onClick: (e) => rowSelection && handleRowClick(item, e), "data-row-key": itemKey != null ? String(itemKey) : undefined, style: {
|
|
2330
2337
|
cursor: rowSelection ? "pointer" : "default",
|
|
2331
|
-
backgroundColor: isSelected ? "var(--cw-
|
|
2338
|
+
backgroundColor: isSelected ? "var(--cw-table-row-selected-background)" : undefined,
|
|
2332
2339
|
transition: "background-color 0.2s ease",
|
|
2333
2340
|
}, children: [expandedRowRender && (jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === itemKey
|
|
2334
2341
|
? "cwi-chevron-down"
|
|
@@ -2361,7 +2368,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2361
2368
|
}, min: 1, max: totalPages }), jsx("span", { children: "/" }), jsx("span", { children: totalPages }), jsx(CwButton, { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: currentPage === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2362
2369
|
}
|
|
2363
2370
|
|
|
2364
|
-
var styles$
|
|
2371
|
+
var styles$p = {"dropIndicator":"cw-sortable-table-module__dropIndicator__ov-Jz","dragging":"cw-sortable-table-module__dragging__MrLrz","saveBar":"cw-sortable-table-module__saveBar__3OdoZ cw-flex-row cw-align-center-center cw-gap-small"};
|
|
2365
2372
|
|
|
2366
2373
|
/**
|
|
2367
2374
|
* Hook that provides state management for CwSortableTable.
|
|
@@ -2424,7 +2431,7 @@ function useSortableTable(initialItems) {
|
|
|
2424
2431
|
}
|
|
2425
2432
|
|
|
2426
2433
|
// ─── Drop indicator row ───────────────────────────────────────────────────────
|
|
2427
|
-
const DropIndicatorRow = ({ colSpan }) => (jsx("tr", { className: styles$
|
|
2434
|
+
const DropIndicatorRow = ({ colSpan }) => (jsx("tr", { className: styles$p.dropIndicator, "aria-hidden": true, children: jsx("td", { colSpan: colSpan, children: jsx("div", {}) }) }));
|
|
2428
2435
|
// ─── Loading skeleton ─────────────────────────────────────────────────────────
|
|
2429
2436
|
// Plain td cells (no local class): the ghost cells get the same global cw-table
|
|
2430
2437
|
// padding as real body cells, so row heights match the loaded rows exactly.
|
|
@@ -2527,11 +2534,11 @@ function CwSortableTable({ columns, data, rowKey = "key", onReorder, loading = f
|
|
|
2527
2534
|
return items.map((item, index) => {
|
|
2528
2535
|
const key = item[rowKey];
|
|
2529
2536
|
const isDragging = draggedItem?.[rowKey] === key;
|
|
2530
|
-
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && (jsx(DropIndicatorRow, { colSpan: totalCols })), jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$
|
|
2537
|
+
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && (jsx(DropIndicatorRow, { colSpan: totalCols })), jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$p.dragging : "", children: [showHandle && (jsx("td", { className: "cw-table-col-action", children: jsx(CwIcon, { iconId: "grip-dots", color: "neutral", style: { opacity: 0.75 } }) })), columns.map(col => (jsx("td", { className: col.className ?? "", style: col.width ? { width: col.width } : undefined, children: renderCell(item, col) }, `${String(key)}_${col.key}`)))] }), index === items.length - 1 && dropIndicatorIndex === items.length && (jsx(DropIndicatorRow, { colSpan: totalCols }))] }, String(key)));
|
|
2531
2538
|
});
|
|
2532
2539
|
};
|
|
2533
2540
|
// ── Render ──────────────────────────────────────────────────────────────
|
|
2534
|
-
return (jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, "aria-busy": loading || undefined, children: [jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { children: jsxs("tr", { children: [showHandle && jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsx("tbody", { children: renderBody() })] }), !loading && hasChanges && (jsxs("footer", { className: styles$
|
|
2541
|
+
return (jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, "aria-busy": loading || undefined, children: [jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { children: jsxs("tr", { children: [showHandle && jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsx("tbody", { children: renderBody() })] }), !loading && hasChanges && (jsxs("footer", { className: styles$p.saveBar, children: [jsx(CwButton, { variant: "outline", color: "neutral", icon: "undo", text: discardLabel, onClick: handleDiscard }), jsx(CwButton, { variant: "solid", color: "primary", icon: "save", text: saveLabel, onClick: () => handleSave(onReorder) })] }))] }));
|
|
2535
2542
|
}
|
|
2536
2543
|
|
|
2537
2544
|
/**
|
|
@@ -2703,7 +2710,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
2703
2710
|
const dynamicClassName = typeof classNameRow === "function" ? classNameRow(item) : (classNameRow ?? "");
|
|
2704
2711
|
return (jsxs(React__default.Fragment, { children: [jsxs("tr", { className: `${dynamicClassName} ${hasClassNameRow(item) ? item.classNameRow : ""} ${isSelected ? "cw-table-row-selected" : ""}`, onClick: (e) => rowSelection && handleRowClick(item, e), "data-row-key": itemKey != null ? String(itemKey) : undefined, style: {
|
|
2705
2712
|
cursor: rowSelection ? "pointer" : "default",
|
|
2706
|
-
backgroundColor: isSelected ? "var(--cw-
|
|
2713
|
+
backgroundColor: isSelected ? "var(--cw-table-row-selected-background)" : undefined,
|
|
2707
2714
|
transition: "background-color 0.2s ease",
|
|
2708
2715
|
}, children: [expandedRowRender && (jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === itemKey ? "cwi-chevron-down" : "cwi-chevron-right"}` }) })), columns.map((col) => (jsx("td", { className: col.className ?? "", children: col.render ? col.render(item) : col.dataIndex ? String(item[col.dataIndex] ?? "") : "" }, `${itemKey}_${col.key}`)))] }), expandedRowRender && expandedRowKey === itemKey && (jsx("tr", { className: "cw-table-row-expanded", children: jsx("td", { colSpan: getColSpan(), children: expandedRowRender(item) }) }))] }, String(itemKey)));
|
|
2709
2716
|
});
|
|
@@ -2732,7 +2739,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
2732
2739
|
}, min: 1, max: totalPages }), jsx("span", { children: "/" }), jsx("span", { children: totalPages }), jsx(CwButton, { onClick: () => handlePageChange(state.page + 1), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2733
2740
|
}
|
|
2734
2741
|
|
|
2735
|
-
var styles$
|
|
2742
|
+
var styles$o = {"cw-tabs":"cw-tabs-module__cw-tabs__1pmji","cw-tabs-content":"cw-tabs-module__cw-tabs-content__HTp8d"};
|
|
2736
2743
|
|
|
2737
2744
|
const BADGE_COLOR_SCHEMES = ['primary', 'danger', 'warning', 'success', 'info', 'neutral'];
|
|
2738
2745
|
function isBadgeColorScheme(value) {
|
|
@@ -2786,15 +2793,16 @@ function CwTabs(CwTabsProps) {
|
|
|
2786
2793
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
2787
2794
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
2788
2795
|
: undefined;
|
|
2789
|
-
return (jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$
|
|
2796
|
+
return (jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$o['cw-tabs'] + (CwTabsProps.className ? ` ${CwTabsProps.className}` : "") + "", style: CwTabsProps.style, "data-tabs-position": position, children: [jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => {
|
|
2790
2797
|
const badgeScheme = tab.badgeColor && isBadgeColorScheme(tab.badgeColor) ? tab.badgeColor : undefined;
|
|
2791
2798
|
const rawBadgeColor = tab.badgeColor && !badgeScheme ? tab.badgeColor : undefined;
|
|
2792
2799
|
return (jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, "data-tab-key": tab.key, "data-badge-themed": tab.badgeColor ? "true" : undefined, children: [jsx(TabIcon, { icon: tab.icon }), tab.title, (tab.badge !== undefined || tab.badgeColor) && (jsx(CwBadge, { count: typeof tab.badge === 'number' ? tab.badge : undefined, content: typeof tab.badge === 'string' ? tab.badge : undefined, size: "medium", color: badgeScheme ?? 'primary', variant: badgeScheme ? 'solid' : 'soft', style: rawBadgeColor ? { backgroundColor: rawBadgeColor, color: getContrastColor(rawBadgeColor) } : undefined }))] }, tab.key));
|
|
2793
|
-
}) }), jsx("div", { className: styles$
|
|
2800
|
+
}) }), jsx("div", { className: styles$o['cw-tabs-content'], "data-active-tab-key": activeTab ?? undefined, style: CwTabsProps.contentHeight ? { '--tabs-height': CwTabsProps.contentHeight } : undefined, children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
|
|
2794
2801
|
}
|
|
2795
2802
|
|
|
2796
2803
|
/**
|
|
2797
|
-
* An expandable element with briefing and children displayed when clicked
|
|
2804
|
+
* An expandable element with briefing and children displayed when clicked.
|
|
2805
|
+
* Preferably avoid using it, it needs a refactor.
|
|
2798
2806
|
* @param briefing Title of the expandable
|
|
2799
2807
|
* @param onToggle Function to run when expandable is toggled open/closed
|
|
2800
2808
|
* @param onClose Function to run when expandable is closed
|
|
@@ -2817,7 +2825,7 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
2817
2825
|
return (jsxs("details", { ref: myRef, ...detailsProps, className: "cw-expandable", children: [jsx("summary", { children: briefing }), children && jsx("section", { children: children })] }));
|
|
2818
2826
|
};
|
|
2819
2827
|
|
|
2820
|
-
var styles$
|
|
2828
|
+
var styles$n = {"cw-master-detail":"cw-master-detail-module__cw-master-detail__O8-FA","resizer":"cw-master-detail-module__resizer__hvGhL","detail":"cw-master-detail-module__detail__BG4Dm","skeletonRow":"cw-master-detail-module__skeletonRow__6BUgt","detailSkeleton":"cw-master-detail-module__detailSkeleton__GcDS4","detail-empty":"cw-master-detail-module__detail-empty__KFScK"};
|
|
2821
2829
|
|
|
2822
2830
|
/*
|
|
2823
2831
|
* Fixed rem widths for the ghosts: the master rows and detail panel size their
|
|
@@ -2861,12 +2869,12 @@ const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, de
|
|
|
2861
2869
|
document.body.style.userSelect = '';
|
|
2862
2870
|
};
|
|
2863
2871
|
}, [isResizing, minMasterWidth, maxMasterWidth]);
|
|
2864
|
-
const rootClassName = [styles$
|
|
2872
|
+
const rootClassName = [styles$n['cw-master-detail'], className].filter(Boolean).join(' ');
|
|
2865
2873
|
return (jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, "aria-busy": loading || undefined, children: [jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsx("search", { children: jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsx("header", { children: masterHeader })), jsx("ul", { children: loading
|
|
2866
|
-
? Array.from({ length: skeletonRows }, (_unused, rowIndex) => (jsxs("li", { "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "circle", height: "2rem" }), jsxs("div", { className: styles$
|
|
2867
|
-
: items.map((item) => (jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsx("footer", { children: masterFooter }))] }), resizable && (jsx("div", { className: styles$
|
|
2874
|
+
? Array.from({ length: skeletonRows }, (_unused, rowIndex) => (jsxs("li", { "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "circle", height: "2rem" }), jsxs("div", { className: styles$n.skeletonRow, children: [jsx(CwSkeleton, { variant: "text", width: MASTER_TITLE_WIDTHS[rowIndex % MASTER_TITLE_WIDTHS.length] }), jsx(CwSkeleton, { variant: "text", width: MASTER_SUBTITLE_WIDTH })] })] }, `skeleton_${rowIndex}`)))
|
|
2875
|
+
: items.map((item) => (jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsx("footer", { children: masterFooter }))] }), resizable && (jsx("div", { className: styles$n.resizer, "data-resizing": isResizing, onMouseDown: handleMouseDown })), jsx("section", { className: styles$n.detail, children: loading ? (jsxs("div", { className: styles$n.detailSkeleton, "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "text", width: "14rem", height: "1.5em" }), jsx(CwSkeleton, { variant: "text", width: "22rem" }), jsx(CwSkeleton, { variant: "text", width: "18rem" }), jsx(CwSkeleton, { variant: "text", width: "20rem" })] })) : selectedKey && detailContent
|
|
2868
2876
|
? detailContent
|
|
2869
|
-
: (jsx("div", { className: styles$
|
|
2877
|
+
: (jsx("div", { className: styles$n['detail-empty'], children: emptyDetail ?? 'Select an item to view details' })) })] }));
|
|
2870
2878
|
};
|
|
2871
2879
|
|
|
2872
2880
|
/*
|
|
@@ -2906,7 +2914,7 @@ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "
|
|
|
2906
2914
|
return (jsx("dl", { className: `cw-keyvalue-list ${className}`, "data-direction": groupLayout?.direction, "data-align": groupLayout?.align, "data-justify": groupLayout?.justify, "data-gap": groupLayout?.gap, "aria-busy": loading || undefined, ...htmlProps, children: renderItems() }));
|
|
2907
2915
|
};
|
|
2908
2916
|
|
|
2909
|
-
var styles$
|
|
2917
|
+
var styles$m = {"sortableList":"cw-sortable-list-module__sortableList__PyLO-","sortableItem":"cw-sortable-list-module__sortableItem__FAnn2","readOnly":"cw-sortable-list-module__readOnly__r7GcH","dragging":"cw-sortable-list-module__dragging__MD715","moved":"cw-sortable-list-module__moved__sE6-N","expandedContent":"cw-sortable-list-module__expandedContent__Kocna","sortableHandle":"cw-sortable-list-module__sortableHandle__HvYBK","sortableContent":"cw-sortable-list-module__sortableContent__C6JhR","sortableTitle":"cw-sortable-list-module__sortableTitle__EgWXr","sortableExtraContent":"cw-sortable-list-module__sortableExtraContent__s4LSv","sortableActions":"cw-sortable-list-module__sortableActions__gwQOU","dropIndicator":"cw-sortable-list-module__dropIndicator__MNSF-","emptyMessage":"cw-sortable-list-module__emptyMessage__gMpaL"};
|
|
2910
2918
|
|
|
2911
2919
|
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, maxHeight = "300px", }) {
|
|
2912
2920
|
const [draggedItem, setDraggedItem] = useState(null);
|
|
@@ -2969,15 +2977,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
|
|
|
2969
2977
|
}
|
|
2970
2978
|
};
|
|
2971
2979
|
if (items.length === 0) {
|
|
2972
|
-
return (jsx("div", { className: `${styles$
|
|
2980
|
+
return (jsx("div", { className: `${styles$m.sortableList} ${styles$m.emptyState} ${className}`, children: jsx("div", { className: styles$m.emptyMessage, children: emptyMessage }) }));
|
|
2973
2981
|
}
|
|
2974
|
-
return (jsx("div", { className: `${styles$
|
|
2982
|
+
return (jsx("div", { className: `${styles$m.sortableList} ${className}`, style: { maxHeight }, children: items.map((item, index) => {
|
|
2975
2983
|
const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
|
|
2976
2984
|
const isDragging = draggedItem?.id === item.id;
|
|
2977
2985
|
const isMoved = movedItems.has(item.id);
|
|
2978
2986
|
const canExpand = Boolean(expandedContent);
|
|
2979
2987
|
const isExpanded = expandedItems.has(item.id);
|
|
2980
|
-
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && jsx("div", { className: styles$
|
|
2988
|
+
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && jsx("div", { className: styles$m.dropIndicator }), jsxs("div", { className: `${styles$m.sortableItem} ${isDragging ? styles$m.dragging : ''} ${isMoved ? styles$m.moved : ''} ${readOnly ? styles$m.readOnly : ''}`, draggable: !readOnly, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, children: [jsxs("header", { children: [canExpand ? (jsx(CwButton, { variant: "icon", onClick: () => toggleExpanded(item.id), type: "button", title: isExpanded ? "Collapse" : "Expand", icon: isExpanded ? "chevron-up" : "chevron-down" })) : showHandle ? (jsx("div", { className: styles$m.sortableHandle, children: jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxs("div", { className: styles$m.sortableContent, children: [jsx("div", { className: styles$m.sortableTitle, children: title }), extraContent && jsx("div", { className: styles$m.sortableExtraContent, children: extraContent })] }), jsx("div", { className: styles$m.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsx("div", { className: styles$m.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsx("div", { className: styles$m.dropIndicator }))] }, item.id));
|
|
2981
2989
|
}) }));
|
|
2982
2990
|
}
|
|
2983
2991
|
|
|
@@ -3036,6 +3044,7 @@ function useSortableList(initialItems) {
|
|
|
3036
3044
|
|
|
3037
3045
|
/**
|
|
3038
3046
|
* A table with expandable row groups.
|
|
3047
|
+
* Preferably avoid using it, it needs a refactor.
|
|
3039
3048
|
* @param props The data to display
|
|
3040
3049
|
* @example
|
|
3041
3050
|
* const sampleTableData: CwTableGroupedData = {
|
|
@@ -3103,7 +3112,7 @@ const CwTableGrouped = props => {
|
|
|
3103
3112
|
group.rows.map((child, j) => (jsx("tr", { "data-row": true, "data-row-last-of-group": j == group.rows.length - 1, children: child.cells.map((cell, k) => (jsx("td", { children: cell.content }, k))) }, j)))] }, i))) }), jsx("tfoot", {})] }) }));
|
|
3104
3113
|
};
|
|
3105
3114
|
|
|
3106
|
-
var styles$
|
|
3115
|
+
var styles$l = {"fileUploadContainer":"cw-file-upload-multiple-module__fileUploadContainer__liEc1","hiddenInput":"cw-file-upload-multiple-module__hiddenInput__TZBBI","uploadArea":"cw-file-upload-multiple-module__uploadArea__DdOhs","uploadAreaDisabled":"cw-file-upload-multiple-module__uploadAreaDisabled__VWeFX","uploadTitle":"cw-file-upload-multiple-module__uploadTitle__gjRk8","uploadSubtitle":"cw-file-upload-multiple-module__uploadSubtitle__Z0S5t","filesContainer":"cw-file-upload-multiple-module__filesContainer__g44PY","fileItem":"cw-file-upload-multiple-module__fileItem__w27Dg","fileIcon":"cw-file-upload-multiple-module__fileIcon__iJJUX","fileExtension":"cw-file-upload-multiple-module__fileExtension__vOuHv","fileInfo":"cw-file-upload-multiple-module__fileInfo__R5ZTv","fileName":"cw-file-upload-multiple-module__fileName__DjepK","fileSize":"cw-file-upload-multiple-module__fileSize__b8GSm","smallButton":"cw-file-upload-multiple-module__smallButton__siUAh"};
|
|
3107
3116
|
|
|
3108
3117
|
const DEFAULT_LABELS$1 = {
|
|
3109
3118
|
uploadDisabled: 'Upload disabled',
|
|
@@ -3289,12 +3298,12 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3289
3298
|
}
|
|
3290
3299
|
}
|
|
3291
3300
|
};
|
|
3292
|
-
return (jsxs("div", { className: `${styles$
|
|
3301
|
+
return (jsxs("div", { className: `${styles$l.fileUploadContainer} ${fileUploadProps.className}`, children: [jsx("input", { ref: fileInputRef, type: "file", name: fileUploadProps.name, accept: fileUploadProps.accept, multiple: fileUploadProps.multiple, onChange: handleFileSelectInternal, disabled: fileUploadProps.disabled, "aria-label": "files", className: styles$l.hiddenInput }), selectedFiles.length === 0 && !existingFile ? (jsxs("div", { className: `${styles$l.uploadArea} ${fileUploadProps.disabled ? styles$l.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsx(CwIcon, { iconId: "upload" }), jsx("p", { className: `${styles$l.uploadTitle}`, children: fileUploadProps.disabled ? labels.uploadDisabled : labels.clickToUpload }), jsxs("p", { className: `${styles$l.uploadSubtitle}`, children: [fileUploadProps.accept ? labels.acceptedFiles(fileUploadProps.accept) : labels.allTypesAccepted, !fileUploadProps.multiple && ` ${labels.singleFileOnly}`] })] })) : selectedFiles.length === 0 && existingFile ? (jsxs("div", { className: styles$l.filesContainer, children: [jsxs("div", { className: styles$l.fileItem, children: [jsxs("div", { className: styles$l.fileIcon, children: [jsx(CwIcon, { iconId: "page" }), jsx("span", { className: styles$l.fileExtension, children: getFileExtension(existingFile) })] }), jsx("div", { className: styles$l.fileInfo, children: jsx("p", { className: styles$l.fileName, children: existingFile }) }), jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => {
|
|
3293
3302
|
setExistingFile(undefined);
|
|
3294
3303
|
if (fileUploadProps.onSelect) {
|
|
3295
3304
|
fileUploadProps.onSelect(null);
|
|
3296
3305
|
}
|
|
3297
|
-
}, disabled: fileUploadProps.disabled, className: styles$
|
|
3306
|
+
}, disabled: fileUploadProps.disabled, className: styles$l.smallButton })] }), jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled })] })) : (jsxs("div", { className: styles$l.filesContainer, children: [jsxs("header", { className: "cw-flex-row cw-align-between-center cw-flex-wrap", children: [jsx("small", { className: styles$l.filesCount, children: fileUploadProps.statusText ?? labels.filesSelected(selectedFiles.length) }), jsxs("div", { className: "cw-flex-row", children: [fileUploadProps.onConfirm && selectedFiles.length > 0 && (jsx(CwButton, { onClick: () => {
|
|
3298
3307
|
let files = fileInputRef.current?.files ?? null;
|
|
3299
3308
|
if (!files) {
|
|
3300
3309
|
const dataTransfer = new DataTransfer();
|
|
@@ -3302,9 +3311,13 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3302
3311
|
files = dataTransfer.files;
|
|
3303
3312
|
}
|
|
3304
3313
|
fileUploadProps.onConfirm?.(files);
|
|
3305
|
-
}, disabled: fileUploadProps.disabled || fileUploadProps.confirmDisabled, icon: "upload", text: fileUploadProps.confirmLabel ?? labels.upload })), !fileUploadProps.hideClearAll && (jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] })] }), selectedFiles.map((file, index) => (jsxs("div", { className: styles$
|
|
3314
|
+
}, disabled: fileUploadProps.disabled || fileUploadProps.confirmDisabled, icon: "upload", text: fileUploadProps.confirmLabel ?? labels.upload })), !fileUploadProps.hideClearAll && (jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] })] }), selectedFiles.map((file, index) => (jsxs("div", { className: styles$l.fileItem, children: [jsxs("div", { className: styles$l.fileIcon, children: [jsx(CwIcon, { iconId: "page" }), jsx("span", { className: styles$l.fileExtension, children: getFileExtension(file.name) })] }), jsxs("div", { className: styles$l.fileInfo, children: [jsx("p", { className: styles$l.fileName, children: file.name }), jsxs("p", { className: styles$l.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$l.smallButton })] }, `${file.name}-${file.size}`))), fileUploadProps.multiple && (jsx(CwButton, { text: labels.addMoreFiles, icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
|
|
3306
3315
|
}
|
|
3307
3316
|
|
|
3317
|
+
/**
|
|
3318
|
+
* Legacy text input with its own label markup, predating the design system.
|
|
3319
|
+
* @deprecated Use {@link CwInputText} instead.
|
|
3320
|
+
*/
|
|
3308
3321
|
function CwInput(CwInputProps) {
|
|
3309
3322
|
const handleChange = (e) => {
|
|
3310
3323
|
CwInputProps.onChange(e.target.value);
|
|
@@ -3351,7 +3364,7 @@ function CwDigit(props) {
|
|
|
3351
3364
|
return (jsxs("div", { className: "cw-input-text", "data-direction": labelProps ? flexDirection : "column", "data-feedback-position": feedbackPosition, children: [jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { className: "cw-input-button", children: [jsx("input", { type: "number", ...inputProps, "aria-describedby": describedBy }), buttonProps && jsx(CwButton, { ...buttonProps })] })] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-info", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
3352
3365
|
}
|
|
3353
3366
|
|
|
3354
|
-
var styles$
|
|
3367
|
+
var styles$k = {"colorPreview":"cw-color-picker-module__colorPreview__ylJcD","hueBar":"cw-color-picker-module__hueBar__bFhyC","hueBarSlider":"cw-color-picker-module__hueBarSlider__D53IV","colorPickerInteractiveArea":"cw-color-picker-module__colorPickerInteractiveArea__KZFR1","colorArea":"cw-color-picker-module__colorArea__xgpSE","colorAreaOverlay":"cw-color-picker-module__colorAreaOverlay__pmgOc","hueBackground":"cw-color-picker-module__hueBackground__Mks78","whiteGradient":"cw-color-picker-module__whiteGradient__Bt-fU","blackGradient":"cw-color-picker-module__blackGradient__VnEKJ","colorAreaCursor":"cw-color-picker-module__colorAreaCursor__lotg3"};
|
|
3355
3368
|
|
|
3356
3369
|
const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
|
|
3357
3370
|
const [rgb, setRgb] = useState({ r: 255, g: 255, b: 255 });
|
|
@@ -3554,13 +3567,13 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
|
|
|
3554
3567
|
// Calculate background color for the main area based on current hue
|
|
3555
3568
|
const hueColor = hsvToRgb(hsv.h, 100, 100);
|
|
3556
3569
|
const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
|
|
3557
|
-
return (jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsx("div", { className: styles$
|
|
3570
|
+
return (jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsx("div", { className: styles$k.colorPreview, style: { backgroundColor: hexColor, color: getContrastColor(hexColor) }, children: previewText }), jsx("button", { type: "button", className: "cw-button", onClick: toggleInputMode, style: { minWidth: "3ch" }, children: inputMode === 'hex' ? 'RGB' : 'HEX' })] }), jsx("div", { className: "color-inputs-row", children: inputMode === 'hex' ? (jsx("input", { type: "text", value: hexColor, onChange: handleHexChange })) : (jsxs("div", { className: "cw-grid-base-3 cw-gap-small", children: [jsxs("div", { children: [jsx("label", { children: "R:" }), jsx("input", { type: "number", name: "r", min: "0", max: "255", value: rgb.r, onChange: handleRgbChange })] }), jsxs("div", { children: [jsx("label", { children: "G:" }), jsx("input", { type: "number", name: "g", min: "0", max: "255", value: rgb.g, onChange: handleRgbChange })] }), jsxs("div", { children: [jsx("label", { children: "B:" }), jsx("input", { type: "number", name: "b", min: "0", max: "255", value: rgb.b, onChange: handleRgbChange })] })] })) }), jsxs("div", { className: styles$k.colorPickerInteractiveArea, children: [jsx("div", { className: styles$k.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsx("div", { className: styles$k.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxs("div", { className: styles$k.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxs("div", { className: styles$k.colorAreaOverlay, children: [jsx("div", { className: styles$k.hueBackground, style: { backgroundColor: hueHex } }), jsx("div", { className: styles$k.whiteGradient }), jsx("div", { className: styles$k.blackGradient })] }), jsx("div", { className: styles$k.colorAreaCursor, style: {
|
|
3558
3571
|
left: `${hsv.s}%`,
|
|
3559
3572
|
top: `${100 - hsv.v}%`
|
|
3560
3573
|
} })] })] })] }));
|
|
3561
3574
|
};
|
|
3562
3575
|
|
|
3563
|
-
var styles$
|
|
3576
|
+
var styles$j = {"container":"cw-input-color-module__container__x7gpk","selectColor":"cw-input-color-module__selectColor__DTo3V","disabled":"cw-input-color-module__disabled__O1fK5","readOnly":"cw-input-color-module__readOnly__HL-Bz","colorDropdown":"cw-input-color-module__colorDropdown__pX2bc"};
|
|
3564
3577
|
|
|
3565
3578
|
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, readOnly = false, width = '4rem', height = '2rem', labelProps, layoutProps, className, style, }) => {
|
|
3566
3579
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -3693,11 +3706,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
3693
3706
|
break;
|
|
3694
3707
|
}
|
|
3695
3708
|
};
|
|
3696
|
-
return (jsxs("div", { className: `cw-input-color ${styles$
|
|
3709
|
+
return (jsxs("div", { className: `cw-input-color ${styles$j.container}${className ? ` ${className}` : ''}`, style: style, "data-direction": layoutProps?.direction ?? "row", "data-align": layoutProps?.align, children: [labelProps && (jsx(CwLabel, { ...labelProps })), jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$j.selectColor} ${disabled ? styles$j.disabled : ''} ${readOnly ? styles$j.readOnly : ''}`, style: {
|
|
3697
3710
|
width,
|
|
3698
3711
|
height,
|
|
3699
3712
|
backgroundColor: value,
|
|
3700
|
-
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && createPortal(jsx("div", { ref: dropdownRef, className: styles$
|
|
3713
|
+
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && createPortal(jsx("div", { ref: dropdownRef, className: styles$j.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
|
|
3701
3714
|
};
|
|
3702
3715
|
|
|
3703
3716
|
/**
|
|
@@ -3713,7 +3726,6 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
3713
3726
|
* @example
|
|
3714
3727
|
* ```tsx
|
|
3715
3728
|
* <CwInputText
|
|
3716
|
-
* iconProps={{ id: "home" }}
|
|
3717
3729
|
* labelProps={{ children: "Name", width: "100px" }}
|
|
3718
3730
|
* buttonProps={{ children: "Ok", onclick:()=>{alert("hi")} }}
|
|
3719
3731
|
* feedback={{ type: "danger", message: "This field is required" }}
|
|
@@ -3764,13 +3776,15 @@ function CwInputNumber(CwInputNumberProps) {
|
|
|
3764
3776
|
}
|
|
3765
3777
|
|
|
3766
3778
|
function CwTextArea(props) {
|
|
3767
|
-
const { alignProps, buttonProps, iconProps, labelProps, resize, feedback, style, ...textareaProps } = props;
|
|
3779
|
+
const { alignProps, buttonProps, iconProps, labelProps, resize, feedback, style, className, ...textareaProps } = props;
|
|
3780
|
+
// Like CwInputText: className lands on the container, not on the textarea.
|
|
3781
|
+
const containerClassName = className ? `cw-text-area ${className}` : "cw-text-area";
|
|
3768
3782
|
const feedbackMessages = feedback
|
|
3769
3783
|
? Array.isArray(feedback) ? feedback : [feedback]
|
|
3770
3784
|
: [];
|
|
3771
3785
|
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
3772
3786
|
const dataDirection = { 'data-direction': flexDirection };
|
|
3773
|
-
return (jsxs("div", { className:
|
|
3787
|
+
return (jsxs("div", { className: containerClassName, ...dataDirection, style: style, children: [jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("textarea", { ...textareaProps, itemProp: textareaProps.required === true ? "required" : "", style: { resize: resize } }), buttonProps && jsx(CwButton, { ...buttonProps })] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { className: "cw-input-info", "data-color": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
3774
3788
|
}
|
|
3775
3789
|
|
|
3776
3790
|
/**
|
|
@@ -3886,6 +3900,10 @@ function formatPlainDate$1(pd, format) {
|
|
|
3886
3900
|
* />
|
|
3887
3901
|
* ```
|
|
3888
3902
|
*/
|
|
3903
|
+
/**
|
|
3904
|
+
* Text date input with a native picker fallback, predating the calendar pickers.
|
|
3905
|
+
* @deprecated Use {@link CwDatePickerTemporal} (or {@link CwDatePicker} at a JS Date boundary) instead.
|
|
3906
|
+
*/
|
|
3889
3907
|
function CwInputDateText(props) {
|
|
3890
3908
|
const displayFormat = "DD.MM.YYYY";
|
|
3891
3909
|
const internalFormat = "YYYY-MM-DD";
|
|
@@ -3947,7 +3965,7 @@ function CwInputDateText(props) {
|
|
|
3947
3965
|
return (jsx("div", { className: "cw-input-date-text", children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { children: [jsx("input", { type: "text", disabled: disabled, maxLength: 10, onChange: onChangeInputText, pattern: "^$ --|[.0-9\\/\\-]{10}", placeholder: format.toLowerCase(), readOnly: readOnly, ref: textInputRef, required: required, size: width, tabIndex: tabIndex, value: displayedDate }), jsxs("span", { children: [jsx(CwIcon, { iconId: "calendar" }), jsx("input", { type: "date", disabled: disabled, onChange: onChangeInputDate, readOnly: readOnly, ref: dateInputRef, tabIndex: -1, value: date, ...inputProps })] })] }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
3948
3966
|
}
|
|
3949
3967
|
|
|
3950
|
-
var styles$
|
|
3968
|
+
var styles$i = {"hiddenInput":"cw-input-image-module__hiddenInput__pS7hb","dropZone":"cw-input-image-module__dropZone__ygrGu","title":"cw-input-image-module__title__Rji5M","subtitle":"cw-input-image-module__subtitle__djYYu","container":"cw-input-image-module__container__qh7Tm"};
|
|
3951
3969
|
|
|
3952
3970
|
const DEFAULT_LABELS = {
|
|
3953
3971
|
dropImageHere: "Drop image here",
|
|
@@ -4026,7 +4044,7 @@ function CwInputImage(props) {
|
|
|
4026
4044
|
const file = e.currentTarget.files?.[0];
|
|
4027
4045
|
void handleFile(file ?? null);
|
|
4028
4046
|
};
|
|
4029
|
-
return (jsxs("div", { className: `cw-input-image ${styles$
|
|
4047
|
+
return (jsxs("div", { className: `cw-input-image ${styles$i.container}`, "data-size": size, children: [jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, className: styles$i.dropZone, children: [jsx(CwIcon, { iconId: "upload" }), jsxs("div", { className: "cw-flex-column cw-gap-tiny", children: [jsx("p", { className: styles$i.title, children: labels.dropImageHere }), jsx("p", { className: styles$i.subtitle, children: labels.acceptedFormats(allowedFormats.join(", ").replace(/image\//g, "")) })] })] }), jsxs("div", { className: "cw-flex-row cw-align-center-center cw-gap-small", children: [jsx(CwButton, { onClick: onPasteButtonClick, icon: "paste", text: labels.paste, size: size }), jsx(CwButton, { onClick: () => inputRef.current?.click(), icon: "folder-open", text: labels.browse, size: size })] }), jsx("input", { ref: inputRef, type: "file", accept: allowedFormats.join(","), onChange: handleFileChange, className: styles$i.hiddenInput, ...inputProps })] }));
|
|
4030
4048
|
}
|
|
4031
4049
|
|
|
4032
4050
|
/**
|
|
@@ -4158,7 +4176,7 @@ const CwImageArea = forwardRef((props, ref) => {
|
|
|
4158
4176
|
});
|
|
4159
4177
|
CwImageArea.displayName = "CwImageArea";
|
|
4160
4178
|
|
|
4161
|
-
var styles$
|
|
4179
|
+
var styles$h = {"container":"cw-weekday-selector-module__container__pwcvx","days":"cw-weekday-selector-module__days__Dd3RH"};
|
|
4162
4180
|
|
|
4163
4181
|
/* 2024-01-01 was a Monday. Formatted in UTC so a negative browser offset cannot shift a day. */
|
|
4164
4182
|
const MONDAY_UTC = Date.UTC(2024, 0, 1);
|
|
@@ -4356,16 +4374,16 @@ const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labe
|
|
|
4356
4374
|
// Points at the label element rather than copying its text, which also covers a labelProps that
|
|
4357
4375
|
// carries children instead of `text`.
|
|
4358
4376
|
const labelId = labelProps?.id ?? `${feedbackId}-label`;
|
|
4359
|
-
return (jsxs("div", { className: `cw-weekday-selector ${styles$
|
|
4377
|
+
return (jsxs("div", { className: `cw-weekday-selector ${styles$h.container}${className ? ` ${className}` : ""}`, "data-direction": labelProps ? layout?.direction ?? "row" : "column", "data-align": layout?.align, "data-gap": layout?.gap, children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsx("div", { role: "group", className: styles$h.days, "aria-labelledby": labelProps ? labelId : undefined, "aria-describedby": describedBy, children: Weekdays.getFullWeek().map(day => (jsx("input", { type: "checkbox", "data-day": day, "data-letter": dayNames[day].letter, "aria-label": dayNames[day].full, title: dayNames[day].full, checked: selectedDays.includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4360
4378
|
};
|
|
4361
4379
|
|
|
4362
|
-
var styles$
|
|
4380
|
+
var styles$g = {"check-container":"cw-check-module__check-container__4nscZ","group":"cw-check-module__group__6JCQo","options":"cw-check-module__options__-g9LF"};
|
|
4363
4381
|
|
|
4364
4382
|
function CwCheck(props) {
|
|
4365
4383
|
const { labelProps, labelText, direction, alignment, className, ...inputProps } = props;
|
|
4366
4384
|
const resolvedDirection = direction ?? alignment ?? "row";
|
|
4367
4385
|
const displayText = labelProps?.text ?? labelText;
|
|
4368
|
-
return (jsx("div", { className: `cw-check ${styles$
|
|
4386
|
+
return (jsx("div", { className: `cw-check ${styles$g["check-container"]}${className ? ` ${className}` : ''}`, children: jsxs("label", { "data-direction": resolvedDirection, children: [jsx("input", { type: "checkbox", ...inputProps }), displayText && (jsx("span", { className: "cw-icon-text", children: displayText }))] }) }));
|
|
4369
4387
|
}
|
|
4370
4388
|
|
|
4371
4389
|
function CwCheckbox(CwCheckboxProps) {
|
|
@@ -4419,14 +4437,14 @@ function CwCheckboxGroup({ options, value = [], onChange, labelProps, groupLayou
|
|
|
4419
4437
|
?? (optionsAlignment === "column" ? "row" : "column");
|
|
4420
4438
|
// Each checkbox's box-to-text layout is the opposite of the options flow, mirroring CwRadioGroup.
|
|
4421
4439
|
const checkDirection = itemDirection === "row" ? "column" : "row";
|
|
4422
|
-
return (jsxs("div", { className: `cw-checkbox-group ${styles$
|
|
4440
|
+
return (jsxs("div", { className: `cw-checkbox-group ${styles$g.group}${className ? ` ${className}` : ""}`, "data-testid": dataTestId, "data-direction": labelProps ? groupDirection : "column", "data-align": groupLayout?.align, "data-gap": groupLayout?.gap, children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsx("div", { className: styles$g.options, role: "group", "aria-label": labelProps?.text, "aria-describedby": describedBy, "aria-required": required || undefined, "data-direction": itemDirection, "data-gap": itemLayout?.gap, children: options.map((option) => (jsx(CwCheck, { labelProps: { text: option.label }, checked: value.includes(option.value), disabled: disabled || option.disabled, direction: checkDirection, onChange: (e) => handleChange(option.value, e.currentTarget.checked) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4423
4441
|
}
|
|
4424
4442
|
|
|
4425
|
-
var styles$
|
|
4443
|
+
var styles$f = {"radio":"cw-radio-module__radio__5sh7a","group":"cw-radio-module__group__br-HM","options":"cw-radio-module__options__LSw7M"};
|
|
4426
4444
|
|
|
4427
4445
|
/** Single native radio input. Building block for CwRadioGroup. */
|
|
4428
4446
|
function CwRadio({ label, direction = "row", className, ...inputProps }) {
|
|
4429
|
-
return (jsxs("label", { className: `cw-radio ${styles$
|
|
4447
|
+
return (jsxs("label", { className: `cw-radio ${styles$f.radio}${className ? ` ${className}` : ""}`, "data-direction": direction, children: [jsx("input", { type: "radio", ...inputProps }), label && jsx("span", { children: label })] }));
|
|
4430
4448
|
}
|
|
4431
4449
|
|
|
4432
4450
|
/**
|
|
@@ -4453,7 +4471,7 @@ function CwRadioGroup({ options, value, onChange, labelProps, groupLayout, itemL
|
|
|
4453
4471
|
// (itemLayout column) reads best with the circle beside the text; a side-by-side row reads
|
|
4454
4472
|
// best with the circle above the text.
|
|
4455
4473
|
const radioDirection = itemLayout?.direction === "row" ? "column" : "row";
|
|
4456
|
-
return (jsxs("div", { className: `cw-radio-group ${styles$
|
|
4474
|
+
return (jsxs("div", { className: `cw-radio-group ${styles$f.group}${className ? ` ${className}` : ""}`, "data-testid": dataTestId, "data-direction": labelProps ? (groupLayout?.direction ?? "column") : "column", "data-align": groupLayout?.align, "data-gap": groupLayout?.gap, children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsx("div", { className: styles$f.options, role: "radiogroup", "aria-describedby": describedBy, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : (ariaLabel ?? labelProps?.text), "aria-required": required || undefined, "data-direction": itemLayout?.direction ?? "column", "data-gap": itemLayout?.gap, children: options.map((option) => (jsx(CwRadio, { name: groupName, label: option.label, direction: radioDirection, checked: value === option.value, required: required, disabled: disabled || option.disabled, onChange: () => onChange(option.value) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4457
4475
|
}
|
|
4458
4476
|
|
|
4459
4477
|
function CwToggle(props) {
|
|
@@ -4594,7 +4612,7 @@ function useDropdownPortal({ anchorRef, isOpen, onClose, positionStrategy = defa
|
|
|
4594
4612
|
return { panelRef, panelStyle: style, renderPanel };
|
|
4595
4613
|
}
|
|
4596
4614
|
|
|
4597
|
-
var
|
|
4615
|
+
var styles$e = {"dropdown":"cw-dropdown-module__dropdown__EFZ9M cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-dropdown-module__option__TuMdI cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-dropdown-module__optionFocused__7LGaC cw-choice-dropdown-module__optionFocused__BYMxj","optionSelected":"cw-dropdown-module__optionSelected__OiXIc cw-choice-dropdown-module__optionSelected__Lt8Xg","optionDisabled":"cw-dropdown-module__optionDisabled__lYM6w cw-choice-dropdown-module__optionDisabled__n3scM","emptyState":"cw-dropdown-module__emptyState__gp8KT cw-choice-dropdown-module__emptyState__HO0Y7","searchBox":"cw-dropdown-module__searchBox__Bx0JE cw-choice-dropdown-module__searchBox__0gox7","searchInput":"cw-dropdown-module__searchInput__JrxCK cw-choice-dropdown-module__searchInput__G5oRs","value":"cw-dropdown-module__value__i-7IN","colorCircle":"cw-dropdown-module__colorCircle__5kgiT cw-choice-dropdown-module__colorCircle__x7mI9"};
|
|
4598
4616
|
|
|
4599
4617
|
/**
|
|
4600
4618
|
* Custom dropdown component with colour-coded options, optional search filter, and full
|
|
@@ -4708,14 +4726,18 @@ function CwDropdown({ options, value, onChange, labelProps, alignProps, placehol
|
|
|
4708
4726
|
}
|
|
4709
4727
|
}, [isOpen, highlightedIndex, filteredOptions, handleOptionSelect]);
|
|
4710
4728
|
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
4711
|
-
return (jsx("div", { ref: containerRef, className: `cw-dropdown${className ? ` ${className}` : ""}`, "data-direction": flexDirection, style: style, ...otherProps, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsxs("div", { className:
|
|
4712
|
-
|
|
4713
|
-
value === option.value ?
|
|
4714
|
-
highlightedIndex === index ?
|
|
4715
|
-
option.disabled ?
|
|
4716
|
-
].filter(Boolean).join(" "), onClick: () => !option.disabled && handleOptionSelect(option.value), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": value === option.value, "aria-disabled": option.disabled, children: [option.color && (jsx("span", { className:
|
|
4729
|
+
return (jsx("div", { ref: containerRef, className: `cw-dropdown${className ? ` ${className}` : ""}`, "data-direction": flexDirection, style: style, ...otherProps, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsxs("div", { className: styles$e.value, children: [jsxs("div", { className: "cw-dropdown-wrapper", ref: wrapperRef, children: [jsxs("button", { type: "button", className: "cw-dropdown-trigger", onClick: handleTriggerClick, onKeyDown: handleKeyDown, disabled: disabled, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-labelledby": labelProps ? `${labelId} ${valueId}` : undefined, "aria-label": labelProps ? undefined : (selectedOption?.label || placeholder), "aria-describedby": describedBy, children: [jsx("div", { className: "cw-dropdown-trigger-content", id: valueId, children: selectedOption ? (jsxs(Fragment, { children: [selectedOption.color && (jsx("span", { className: styles$e.colorCircle, style: { backgroundColor: selectedOption.color } })), jsx("span", { children: selectedOption.label })] })) : (jsx("span", { className: "cw-dropdown-placeholder", children: placeholder })) }), jsx(CwIcon, { iconId: "chevron-down", size: "small" })] }), renderPanel(jsxs("div", { ref: panelRef, className: styles$e.dropdown, style: panelStyle, role: "listbox", onKeyDown: handleKeyDown, children: [allowSearch && (jsx("div", { className: styles$e.searchBox, children: jsx("input", { ref: inputRef, type: "text", placeholder: "Search...", value: searchText, onChange: handleSearchChange, onKeyDown: handleKeyDown, className: styles$e.searchInput, autoComplete: "off" }) })), jsx("ul", { children: filteredOptions.length > 0 ? (filteredOptions.map((option, index) => (jsxs("li", { ref: highlightedIndex === index ? highlightedItemRef : null, className: [
|
|
4730
|
+
styles$e.option,
|
|
4731
|
+
value === option.value ? styles$e.optionSelected : "",
|
|
4732
|
+
highlightedIndex === index ? styles$e.optionFocused : "",
|
|
4733
|
+
option.disabled ? styles$e.optionDisabled : "",
|
|
4734
|
+
].filter(Boolean).join(" "), onClick: () => !option.disabled && handleOptionSelect(option.value), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": value === option.value, "aria-disabled": option.disabled, children: [option.color && (jsx("span", { className: styles$e.colorCircle, style: { backgroundColor: option.color } })), jsx("span", { children: option.label })] }, option.value)))) : (jsx("li", { className: styles$e.emptyState, children: "No options available" })) })] }))] }), feedbackMessages.map((item, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": item.type, "aria-live": "polite", children: item.message }, index)))] })] }) }));
|
|
4717
4735
|
}
|
|
4718
4736
|
|
|
4737
|
+
/**
|
|
4738
|
+
* Legacy action menu with a fixed item shape and caller-owned open state.
|
|
4739
|
+
* @deprecated Use {@link CwPopoverButton} with your own content instead.
|
|
4740
|
+
*/
|
|
4719
4741
|
function CwDropdownFilter(props) {
|
|
4720
4742
|
// Determine visibility state
|
|
4721
4743
|
const isVisible = props.DropDownFilterState ?? false;
|
|
@@ -5044,8 +5066,8 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5044
5066
|
}
|
|
5045
5067
|
else {
|
|
5046
5068
|
return {
|
|
5047
|
-
onPrimary: "var(--cw-
|
|
5048
|
-
primary: "var(--cw-
|
|
5069
|
+
onPrimary: "var(--cw-text-on-primary)",
|
|
5070
|
+
primary: "var(--cw-accent-primary)"
|
|
5049
5071
|
};
|
|
5050
5072
|
}
|
|
5051
5073
|
};
|
|
@@ -5082,7 +5104,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5082
5104
|
};
|
|
5083
5105
|
return (jsxs("form", { ref: componentRef, id: id, "data-testid": testId, className: `${styles$b["cw-multi-filter"]}${className ? ` ${className}` : ""}`, style: style, onSubmit: (e) => {
|
|
5084
5106
|
e.preventDefault();
|
|
5085
|
-
}, children: [jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$b["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-
|
|
5107
|
+
}, children: [jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$b["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-outline-variant)" } : {}, children: [jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.currentTarget.value), autoComplete: "off", placeholder: selectedTags.size === 0 ? placeholder : "", onKeyDown: e => {
|
|
5086
5108
|
switch (e.key) {
|
|
5087
5109
|
case "Enter":
|
|
5088
5110
|
case "Tab": {
|
|
@@ -5469,6 +5491,8 @@ function CwNavMenu({ items, loading = false, isActive, renderLink = defaultRende
|
|
|
5469
5491
|
: visibleItems.map(item => renderItem(item, 1)) }), showEmptyMessage && jsx("p", { className: styles$8.emptyMessage, children: emptyMessage })] }));
|
|
5470
5492
|
}
|
|
5471
5493
|
|
|
5494
|
+
var dropdownStyles = {"dropdown":"cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-choice-dropdown-module__optionFocused__BYMxj"};
|
|
5495
|
+
|
|
5472
5496
|
/**
|
|
5473
5497
|
* Pure keyboard-navigation resolver shared by the `CwSearchInput` combobox.
|
|
5474
5498
|
* Kept side-effect-free so the arrow/home/end/enter/escape behaviour can be unit
|
|
@@ -9884,8 +9908,8 @@ const Scheduler = (props) => {
|
|
|
9884
9908
|
timeLinePercentage: timeLinePercentage,
|
|
9885
9909
|
isUtc: isUtc
|
|
9886
9910
|
};
|
|
9887
|
-
const evenColor = "var(--cw-
|
|
9888
|
-
const oddColor = "var(--cw-
|
|
9911
|
+
const evenColor = "var(--cw-surface-neutral-low)";
|
|
9912
|
+
const oddColor = "var(--cw-surface-neutral-medium)";
|
|
9889
9913
|
const weekendsLines = useMemo(() => getWeekendLinesByDatesVisible(selectedDate, visibleDays), [selectedDate, visibleDays]);
|
|
9890
9914
|
const divisionLines = useMemo(() => getLinesByDivisions(divisions), [divisions, visibleDays]);
|
|
9891
9915
|
// Timeline percentage calculation
|