@cwellt_software/cwellt-reactjs-lib 1.4.14 → 1.4.15
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.js +284 -89
- package/dist/index.css +2 -2
- package/dist/index.d.ts +227 -20
- package/dist/index.es.js +283 -91
- package/dist/src/common/hooks/useRovingSingleSelect.d.ts +28 -0
- package/dist/src/common/hooks/useRovingSingleSelect.d.ts.map +1 -0
- package/dist/src/components/control/action/button/CwButton.d.ts +14 -4
- package/dist/src/components/control/action/button/CwButton.d.ts.map +1 -1
- package/dist/src/components/control/action/button/CwButtonSplit.d.ts +52 -0
- package/dist/src/components/control/action/button/CwButtonSplit.d.ts.map +1 -0
- package/dist/src/components/control/action/button/CwButtonSwitch.d.ts +65 -0
- package/dist/src/components/control/action/button/CwButtonSwitch.d.ts.map +1 -0
- package/dist/src/components/control/choice/checkbox/CwCheck.d.ts +6 -5
- package/dist/src/components/control/choice/checkbox/CwCheck.d.ts.map +1 -1
- package/dist/src/components/control/choice/checkbox/CwCheckboxGroup.d.ts +30 -7
- package/dist/src/components/control/choice/checkbox/CwCheckboxGroup.d.ts.map +1 -1
- package/dist/src/components/control/choice/checkbox/CwRadio.d.ts +10 -0
- package/dist/src/components/control/choice/checkbox/CwRadio.d.ts.map +1 -0
- package/dist/src/components/control/choice/checkbox/CwRadioGroup.d.ts +58 -0
- package/dist/src/components/control/choice/checkbox/CwRadioGroup.d.ts.map +1 -0
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts +6 -5
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/playground/PlaygroundApp.d.ts.map +1 -1
- package/dist/src/playground/PlaygroundSection.d.ts +13 -0
- package/dist/src/playground/PlaygroundSection.d.ts.map +1 -0
- package/dist/src/playground/pages/CwButtonPage.d.ts +3 -0
- package/dist/src/playground/pages/CwButtonPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwButtonSplitPage.d.ts +3 -0
- package/dist/src/playground/pages/CwButtonSplitPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwButtonSwitchPage.d.ts +3 -0
- package/dist/src/playground/pages/CwButtonSwitchPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwCheckboxGroupPage.d.ts +3 -0
- package/dist/src/playground/pages/CwCheckboxGroupPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwRadioGroupPage.d.ts +3 -0
- package/dist/src/playground/pages/CwRadioGroupPage.d.ts.map +1 -0
- package/dist/test/common/hooks/useRovingSingleSelect.test.d.ts +2 -0
- package/dist/test/common/hooks/useRovingSingleSelect.test.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -186,7 +186,7 @@ const SVG_ICONS = {
|
|
|
186
186
|
'sortable-desc': (jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 128 128", fill: "currentColor", children: [jsxRuntime.jsx("path", { d: "M93.1675 73.1739C94.5691 74.5758 94.7323 76.7924 93.5515 78.3846L93.1675 78.8326L63.6741 108.326L34.1755 78.8326C32.6908 77.3518 32.6014 74.9761 33.9708 73.3881C35.3401 71.8001 37.7033 71.5391 39.3861 72.7899L39.8341 73.1739L63.6741 97.0137L87.5088 73.1739C88.9104 71.7726 91.1274 71.6092 92.7194 72.7899L93.1674 73.1739H93.1675Z", opacity: "1" }), jsxRuntime.jsx("path", { d: "M34.1714 55.1518C32.7697 53.7499 32.6066 51.5333 33.7874 49.9411L34.1714 49.4931L63.6647 20L93.1634 49.4931C94.6481 50.9739 94.7375 53.3496 93.3681 54.9376C91.9987 56.5256 89.6356 56.7866 87.9527 55.5358L87.5047 55.1517L63.6647 31.312L39.8301 55.1518C38.4285 56.5531 36.2115 56.7165 34.6195 55.5358L34.1715 55.1518L34.1714 55.1518Z", opacity: "0.3" })] })),
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
-
var styles$
|
|
189
|
+
var styles$u = {"cw-tooltip-content":"cw-tooltip-module__cw-tooltip-content__RZczd","cw-tooltip":"cw-tooltip-module__cw-tooltip__1KYig"};
|
|
190
190
|
|
|
191
191
|
// Constants
|
|
192
192
|
const margin$1 = 16;
|
|
@@ -476,7 +476,7 @@ const CwTooltipManager = () => {
|
|
|
476
476
|
if (!state.isVisible || !state.content) {
|
|
477
477
|
return null;
|
|
478
478
|
}
|
|
479
|
-
return reactDom.createPortal(jsxRuntime.jsx("div", { ref: tooltipRef, className: styles$
|
|
479
|
+
return reactDom.createPortal(jsxRuntime.jsx("div", { ref: tooltipRef, className: styles$u["cw-tooltip-content"], "data-position": actualPosition, "data-visible": state.isVisible, "data-inline": state.displayInline, style: {
|
|
480
480
|
top: `${tooltipPosition.top}px`,
|
|
481
481
|
left: `${tooltipPosition.left}px`,
|
|
482
482
|
opacity: (isPositioned && !isMeasuring) ? 1 : 0,
|
|
@@ -557,7 +557,7 @@ const CwTooltipNew = ({ children, content = null, position = "right", dissapears
|
|
|
557
557
|
React.useEffect(() => {
|
|
558
558
|
ensureTooltipManager();
|
|
559
559
|
}, []);
|
|
560
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$
|
|
560
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$u["cw-tooltip"], children: children }));
|
|
561
561
|
};
|
|
562
562
|
|
|
563
563
|
function CwIcon(props) {
|
|
@@ -1020,7 +1020,7 @@ function CwLoadingSmall(CwelltLoadingAppointements) {
|
|
|
1020
1020
|
return (jsxRuntime.jsx("div", { children: CwelltLoadingAppointements.isLoading === true ? (jsxRuntime.jsx("div", { className: "cw-loading-container", children: jsxRuntime.jsx("div", { className: "cw-loading" }) })) : (jsxRuntime.jsx("div", {})) }));
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
|
-
var styles$
|
|
1023
|
+
var styles$t = {"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"};
|
|
1024
1024
|
|
|
1025
1025
|
// Constants moved outside to prevent recreation
|
|
1026
1026
|
const margin = 16;
|
|
@@ -1143,12 +1143,12 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1143
1143
|
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
|
|
1144
1144
|
setIsVisible(true);
|
|
1145
1145
|
}, showDelay);
|
|
1146
|
-
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$
|
|
1146
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$t["cw-generic-tooltip-content"]);
|
|
1147
1147
|
// Memoize tooltip content creation
|
|
1148
1148
|
const tooltipContent = React.useMemo(() => {
|
|
1149
1149
|
if (hide || !isVisible || !content)
|
|
1150
1150
|
return null;
|
|
1151
|
-
return reactDom.createPortal(jsxRuntime.jsx("div", { className: styles$
|
|
1151
|
+
return reactDom.createPortal(jsxRuntime.jsx("div", { className: styles$t["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, "data-inline": displayInline, style: {
|
|
1152
1152
|
position: 'fixed',
|
|
1153
1153
|
top: `${tooltipPosition.top}px`,
|
|
1154
1154
|
left: `${tooltipPosition.left}px`,
|
|
@@ -1163,10 +1163,10 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1163
1163
|
clearTooltipTimeout();
|
|
1164
1164
|
setIsVisible(false);
|
|
1165
1165
|
}, [clearTooltipTimeout]);
|
|
1166
|
-
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$
|
|
1166
|
+
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$t["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, children: [tooltipContent, children] }));
|
|
1167
1167
|
};
|
|
1168
1168
|
|
|
1169
|
-
function CwButton({ text, variant = 'solid', color = 'primary', className = '', icon = "", title, tooltipPosition = "bottom", children, ...buttonProps }) {
|
|
1169
|
+
const CwButton = React.forwardRef(function CwButton({ text, variant = 'solid', color = 'primary', size = 'medium', iconPosition = 'left', pressed, className = '', icon = "", title, tooltipPosition = "bottom", children, ...buttonProps }, ref) {
|
|
1170
1170
|
// Build CSS classes based on variant and props
|
|
1171
1171
|
let buttonClass = `cw-button-${variant}`;
|
|
1172
1172
|
// Add icon class only for icon variant without children
|
|
@@ -1177,9 +1177,18 @@ function CwButton({ text, variant = 'solid', color = 'primary', className = '',
|
|
|
1177
1177
|
buttonClass += ` ${className}`;
|
|
1178
1178
|
}
|
|
1179
1179
|
const tooltipContent = title || (variant === 'icon' && text ? text : undefined);
|
|
1180
|
-
const
|
|
1180
|
+
const iconElement = icon ? jsxRuntime.jsx(CwIcon, { iconId: icon }) : null;
|
|
1181
|
+
const textElement = text ? jsxRuntime.jsx("strong", { children: text }) : null;
|
|
1182
|
+
// Only emit toggle attributes when `pressed` is defined; otherwise output stays identical to a normal button.
|
|
1183
|
+
const pressedProps = pressed !== undefined
|
|
1184
|
+
? { "aria-pressed": pressed, "data-pressed": pressed ? "true" : undefined }
|
|
1185
|
+
: {};
|
|
1186
|
+
const buttonElement = (jsxRuntime.jsx("button", { ref: ref, type: "button", className: buttonClass, ...buttonProps, "data-color": color, "data-size": size, ...pressedProps, "aria-label": tooltipContent ?? buttonProps["aria-label"], children: variant === 'icon' ? null : (children ?? (iconPosition === 'right'
|
|
1187
|
+
? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [textElement, iconElement] })
|
|
1188
|
+
: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconElement, textElement] }))) }));
|
|
1181
1189
|
return tooltipContent ? (jsxRuntime.jsx(CwTooltipNew, { content: tooltipContent, position: tooltipPosition, displayInline: true, children: buttonElement })) : (buttonElement);
|
|
1182
|
-
}
|
|
1190
|
+
});
|
|
1191
|
+
CwButton.displayName = "CwButton";
|
|
1183
1192
|
|
|
1184
1193
|
// Reference for draggable modal
|
|
1185
1194
|
/**
|
|
@@ -1216,7 +1225,7 @@ function CwModal(custModalProps) {
|
|
|
1216
1225
|
return (jsxRuntime.jsx("div", { children: custModalProps.modalState && (jsxRuntime.jsxs("div", { className: custModalProps.classNameModalOverlay + " cwelltModalOverlay", children: [jsxRuntime.jsx("div", { className: "cwelltModalOverlayBg", onClick: custModalProps.onCloseModal }), jsxRuntime.jsx(Draggable, { disabled: isModalDisabled, axis: "both", nodeRef: draggableRef, children: jsxRuntime.jsxs("div", { className: custModalProps.classNameModal + " cwelltContainerModal", ref: draggableRef, style: widthModalDef !== "40em" ? modalStyle.widthCustomStyle : modalStyle.widthDefStyle, children: [jsxRuntime.jsxs("div", { className: "cwelltModalHeader", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsxRuntime.jsx("div", { className: "cwelltModalTitle", children: custModalProps.titleModal }), jsxRuntime.jsx("button", { className: "cwelltBtnCloseModal", onClick: custModalProps.onCloseModal, children: jsxRuntime.jsx("span", { className: "cwelltCloseIcon" }) })] }), jsxRuntime.jsx("div", { className: "cwelltModalBody", children: jsxRuntime.jsx("div", { className: "cwelltContainerModalBody", style: { position: "relative" }, children: custModalProps.children }) }), isHide === false ? (jsxRuntime.jsx("footer", { className: "legacy-modal-footer", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: custModalProps.onSaveModal, form: custModalProps.formSaveModal, hidden: custModalProps.HideBtnModal, type: custModalProps.HtmlSubmitModal }) })) : (jsxRuntime.jsx("div", { style: { display: "none" } }))] }) })] })) }));
|
|
1217
1226
|
}
|
|
1218
1227
|
|
|
1219
|
-
var styles$
|
|
1228
|
+
var styles$s = {"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"};
|
|
1220
1229
|
|
|
1221
1230
|
function CwConfirmationPopup(props) {
|
|
1222
1231
|
const { isOpen, onConfirm, onCancel, message = "Are you sure you want to proceed?", confirmText = "Confirm", cancelText = "Cancel", placement = 'bottom', children } = props;
|
|
@@ -1280,15 +1289,15 @@ function CwConfirmationPopup(props) {
|
|
|
1280
1289
|
onCancel();
|
|
1281
1290
|
}
|
|
1282
1291
|
};
|
|
1283
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderChildren(), isOpen && (jsxRuntime.jsx("div", { className: styles$
|
|
1292
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderChildren(), isOpen && (jsxRuntime.jsx("div", { className: styles$s.overlayPositioned, onClick: handleOverlayClick, children: jsxRuntime.jsxs("div", { ref: popupRef, className: styles$s.popup, style: {
|
|
1284
1293
|
position: 'absolute',
|
|
1285
1294
|
top: `${position.top}px`,
|
|
1286
1295
|
left: `${position.left}px`,
|
|
1287
1296
|
transform: 'none'
|
|
1288
|
-
}, children: [jsxRuntime.jsx("p", { className: styles$
|
|
1297
|
+
}, children: [jsxRuntime.jsx("p", { className: styles$s.message, children: message }), jsxRuntime.jsxs("div", { className: styles$s.buttons, children: [jsxRuntime.jsx("button", { className: `${styles$s.button} ${styles$s.confirmButton}`, onClick: onConfirm, children: confirmText }), jsxRuntime.jsx("button", { className: `${styles$s.button} ${styles$s.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
|
|
1289
1298
|
}
|
|
1290
1299
|
|
|
1291
|
-
var styles$
|
|
1300
|
+
var styles$r = {"cw-dialog-main":"cw-dialog-module__cw-dialog-main__cHxHt","cw-dialog-button-close":"cw-dialog-module__cw-dialog-button-close__9GRd8"};
|
|
1292
1301
|
|
|
1293
1302
|
// Helper function to parse size values
|
|
1294
1303
|
const parseSize = (size) => {
|
|
@@ -1561,7 +1570,7 @@ const CwDialog = props => {
|
|
|
1561
1570
|
}
|
|
1562
1571
|
}
|
|
1563
1572
|
}, [open]);
|
|
1564
|
-
const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$
|
|
1573
|
+
const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$r["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
|
|
1565
1574
|
const content = React.useMemo(() => (jsxRuntime.jsx("section", { children: children })), [children]);
|
|
1566
1575
|
const footer = React.useMemo(() => (jsxRuntime.jsx("footer", { children: customFooter || (jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: onSave, tooltipPosition: "top", disabled: disableSave, "data-testid": "cw-dialog-save" })) })), [customFooter, onSave, disableSave]);
|
|
1567
1576
|
const resizeHandles = React.useMemo(() => size.autoHeight
|
|
@@ -1588,7 +1597,7 @@ const CwDialog = props => {
|
|
|
1588
1597
|
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
1589
1598
|
return { displayWidth, displayHeight };
|
|
1590
1599
|
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
1591
|
-
const dialogContent = (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$
|
|
1600
|
+
const dialogContent = (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$r["cw-dialog-main"], onMouseDown: handleScrimMouseDown, onMouseUp: handleScrimMouseUpOrLeave, onMouseLeave: handleScrimMouseUpOrLeave, "data-pressing": isPressingScrim, children: jsxRuntime.jsxs("dialog", { ...domProps, ref: dialogRef, style: {
|
|
1592
1601
|
left: `${position.x}px`,
|
|
1593
1602
|
top: `${position.y}px`,
|
|
1594
1603
|
width: displayDimensions.displayWidth,
|
|
@@ -1749,7 +1758,7 @@ function CwAlign(props) {
|
|
|
1749
1758
|
}, children: props.children }));
|
|
1750
1759
|
}
|
|
1751
1760
|
|
|
1752
|
-
var styles$
|
|
1761
|
+
var styles$q = {"card":"cw-card-module__card__HJUT0","clickable":"cw-card-module__clickable__Y-V3X","disabled":"cw-card-module__disabled__0wHh1","loading":"cw-card-module__loading__-fzlx","content":"cw-card-module__content__ma9qy","headerContent":"cw-card-module__headerContent__x4Jfl","footerTags":"cw-card-module__footerTags__80sSW","loadingOverlay":"cw-card-module__loadingOverlay__8-zVV"};
|
|
1753
1762
|
|
|
1754
1763
|
/**
|
|
1755
1764
|
* CwCard - A simple card component for displaying content in a contained format
|
|
@@ -1775,11 +1784,11 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1775
1784
|
// Construct class names using CSS modules
|
|
1776
1785
|
const cardClassNames = [
|
|
1777
1786
|
'cw-card',
|
|
1778
|
-
styles$
|
|
1787
|
+
styles$q.card,
|
|
1779
1788
|
className,
|
|
1780
|
-
clickable ? styles$
|
|
1781
|
-
disabled ? styles$
|
|
1782
|
-
isLoading ? styles$
|
|
1789
|
+
clickable ? styles$q.clickable : '',
|
|
1790
|
+
disabled ? styles$q.disabled : '',
|
|
1791
|
+
isLoading ? styles$q.loading : '',
|
|
1783
1792
|
].filter(Boolean).join(' ');
|
|
1784
1793
|
// Handle click event when card is clickable
|
|
1785
1794
|
const handleClick = () => {
|
|
@@ -1796,15 +1805,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1796
1805
|
// Determine if footer should be rendered
|
|
1797
1806
|
const hasFooter = hasChips || footer || (hasActions && resolvedDirection === "row");
|
|
1798
1807
|
// Actions component to reuse
|
|
1799
|
-
const ActionsComponent = hasActions && !disabled ? (jsxRuntime.jsxs("div", { className: styles$
|
|
1808
|
+
const ActionsComponent = hasActions && !disabled ? (jsxRuntime.jsxs("div", { className: styles$q.actions, children: [extraActions ?? null, onEdit && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) : null;
|
|
1800
1809
|
return (jsxRuntime.jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && {
|
|
1801
1810
|
role: 'button',
|
|
1802
1811
|
tabIndex: 0,
|
|
1803
1812
|
onClick: handleClick,
|
|
1804
|
-
}), "data-variant": variant, "data-direction": resolvedDirection, children: [hasHeader && (jsxRuntime.jsxs("header", { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: styles$
|
|
1813
|
+
}), "data-variant": variant, "data-direction": resolvedDirection, children: [hasHeader && (jsxRuntime.jsxs("header", { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: styles$q.headerContent, "data-align": resolvedAlign, children: [title && jsxRuntime.jsx("h5", { children: title }), subtitle && jsxRuntime.jsx("strong", { children: subtitle })] })), resolvedDirection === "column" && ActionsComponent] })), jsxRuntime.jsx("div", { className: styles$q.content, children: children }), hasFooter && (jsxRuntime.jsxs("footer", { children: [hasChips && (jsxRuntime.jsx("div", { className: styles$q.footerTags, children: chips.map((chip, index) => (jsxRuntime.jsx(CwChip, { label: chip.label, colorScheme: chip.colorScheme, className: styles$q.chip, ...(chip.customColor && { customColor: chip.customColor }), ...(chip.variant && { variant: chip.variant }), ...(chip.icon && { icon: chip.icon }) }, index))) })), footer && (jsxRuntime.jsx("div", { className: styles$q.footerContent, children: footer }))] })), resolvedDirection === "row" && ActionsComponent, isLoading && (jsxRuntime.jsx("div", { className: styles$q.loadingOverlay, children: jsxRuntime.jsx(CwLoading, { isLoading: isLoading, size: "small" }) }))] }));
|
|
1805
1814
|
};
|
|
1806
1815
|
|
|
1807
|
-
var styles$
|
|
1816
|
+
var styles$p = {"cardContainer":"cw-card-list-module__cardContainer__l3YEh","pagination":"cw-card-list-module__pagination__5Ay78","pageInfo":"cw-card-list-module__pageInfo__uiMel","loading":"cw-card-list-module__loading__cYpND","emptyState":"cw-card-list-module__emptyState__RlqiS"};
|
|
1808
1817
|
|
|
1809
1818
|
/**
|
|
1810
1819
|
* Option to display in the CwSelect
|
|
@@ -1899,10 +1908,10 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
|
|
|
1899
1908
|
icon: sortDirection === 'asc' ? 'arrow-up' : 'arrow-down',
|
|
1900
1909
|
onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'),
|
|
1901
1910
|
title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}`,
|
|
1902
|
-
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsxRuntime.jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsxRuntime.jsx("div", { className: styles$
|
|
1911
|
+
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsxRuntime.jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsxRuntime.jsx("div", { className: styles$p.loading, children: jsxRuntime.jsx(CwLoading, { isLoading: isLoading }) })) : sortedItems.length === 0 ? (jsxRuntime.jsx("div", { className: styles$p.emptyState, children: emptyState || jsxRuntime.jsx("p", { children: "No items to display" }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `${styles$p.cardContainer}`, "data-layout": layout, style: gridStyle, children: visibleItems.map((item, index) => (jsxRuntime.jsx(React.Fragment, { children: renderCard(item, index) }, keyExtractor ? keyExtractor(item, index) : index))) }), totalPages > 1 && (jsxRuntime.jsxs("div", { className: styles$p.pagination, children: [jsxRuntime.jsx(CwButton, { variant: "icon", icon: "chevron-left", disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)) }), jsxRuntime.jsxs("span", { className: styles$p.pageInfo, children: [currentPage, " / ", totalPages] }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "chevron-right", disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)) })] }))] }))] }));
|
|
1903
1912
|
}
|
|
1904
1913
|
|
|
1905
|
-
var styles$
|
|
1914
|
+
var styles$o = {"cw-accordion":"cw-accordion-module__cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module__cw-accordion-body__xlI8b"};
|
|
1906
1915
|
|
|
1907
1916
|
/**
|
|
1908
1917
|
*
|
|
@@ -1919,7 +1928,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
1919
1928
|
setVisible_accordionBody(!isVisible_accordionBody);
|
|
1920
1929
|
};
|
|
1921
1930
|
// #endregion
|
|
1922
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
1931
|
+
return (jsxRuntime.jsxs("div", { className: styles$o["cw-accordion"], style: CwelltAccordionContainerProps.style, "data-open": isVisible_accordionBody, children: [jsxRuntime.jsxs("header", { onClick: () => showAccordionBody(), children: [jsxRuntime.jsx("div", { children: CwelltAccordionContainerProps.desc_text }), jsxRuntime.jsx("button", { className: "cw-button-icon" })] }), jsxRuntime.jsx("div", { className: styles$o["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
|
|
1923
1932
|
}
|
|
1924
1933
|
|
|
1925
1934
|
/**
|
|
@@ -2177,7 +2186,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2177
2186
|
}, min: 1, max: totalPages }), jsxRuntime.jsx("span", { children: "/" }), jsxRuntime.jsx("span", { children: totalPages }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: currentPage === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2178
2187
|
}
|
|
2179
2188
|
|
|
2180
|
-
var styles$
|
|
2189
|
+
var styles$n = {"dropIndicator":"cw-sortable-table-module__dropIndicator__ov-Jz","dragging":"cw-sortable-table-module__dragging__MrLrz","skeletonRow":"cw-sortable-table-module__skeletonRow__vyD0M","skeleton":"cw-sortable-table-module__skeleton__QGXAD","saveBar":"cw-sortable-table-module__saveBar__3OdoZ cw-flex-row cw-align-center-center cw-gap-small"};
|
|
2181
2190
|
|
|
2182
2191
|
/**
|
|
2183
2192
|
* Hook that provides state management for CwSortableTable.
|
|
@@ -2240,9 +2249,9 @@ function useSortableTable(initialItems) {
|
|
|
2240
2249
|
}
|
|
2241
2250
|
|
|
2242
2251
|
// ─── Drop indicator row ───────────────────────────────────────────────────────
|
|
2243
|
-
const DropIndicatorRow = ({ colSpan }) => (jsxRuntime.jsx("tr", { className: styles$
|
|
2252
|
+
const DropIndicatorRow = ({ colSpan }) => (jsxRuntime.jsx("tr", { className: styles$n.dropIndicator, "aria-hidden": true, children: jsxRuntime.jsx("td", { colSpan: colSpan, children: jsxRuntime.jsx("div", {}) }) }));
|
|
2244
2253
|
// ─── Loading skeleton ─────────────────────────────────────────────────────────
|
|
2245
|
-
const LoadingRows = ({ colSpan }) => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 4 }).map((_, i) => (jsxRuntime.jsx("tr", { className: styles$
|
|
2254
|
+
const LoadingRows = ({ colSpan }) => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 4 }).map((_, i) => (jsxRuntime.jsx("tr", { className: styles$n.skeletonRow, children: jsxRuntime.jsx("td", { colSpan: colSpan, children: jsxRuntime.jsx("div", { className: styles$n.skeleton }) }) }, i))) }));
|
|
2246
2255
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
2247
2256
|
/**
|
|
2248
2257
|
* CwSortableTable
|
|
@@ -2329,11 +2338,11 @@ function CwSortableTable({ columns, data, rowKey = "key", onReorder, loading = f
|
|
|
2329
2338
|
return items.map((item, index) => {
|
|
2330
2339
|
const key = item[rowKey];
|
|
2331
2340
|
const isDragging = draggedItem?.[rowKey] === key;
|
|
2332
|
-
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && (jsxRuntime.jsx(DropIndicatorRow, { colSpan: totalCols })), jsxRuntime.jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$
|
|
2341
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && (jsxRuntime.jsx(DropIndicatorRow, { colSpan: totalCols })), jsxRuntime.jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$n.dragging : "", children: [showHandle && (jsxRuntime.jsx("td", { className: "cw-table-col-action", children: jsxRuntime.jsx(CwIcon, { iconId: "grip-dots", color: "neutral", style: { opacity: 0.75 } }) })), columns.map(col => (jsxRuntime.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 && (jsxRuntime.jsx(DropIndicatorRow, { colSpan: totalCols }))] }, String(key)));
|
|
2333
2342
|
});
|
|
2334
2343
|
};
|
|
2335
2344
|
// ── Render ──────────────────────────────────────────────────────────────
|
|
2336
|
-
return (jsxRuntime.jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, children: [jsxRuntime.jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsxRuntime.jsx("thead", { children: jsxRuntime.jsxs("tr", { children: [showHandle && jsxRuntime.jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsxRuntime.jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderBody() })] }), hasChanges && (jsxRuntime.jsxs("footer", { className: styles$
|
|
2345
|
+
return (jsxRuntime.jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, children: [jsxRuntime.jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsxRuntime.jsx("thead", { children: jsxRuntime.jsxs("tr", { children: [showHandle && jsxRuntime.jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsxRuntime.jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderBody() })] }), hasChanges && (jsxRuntime.jsxs("footer", { className: styles$n.saveBar, children: [jsxRuntime.jsx(CwButton, { variant: "outline", color: "neutral", icon: "undo", text: discardLabel, onClick: handleDiscard }), jsxRuntime.jsx(CwButton, { variant: "solid", color: "primary", icon: "save", text: saveLabel, onClick: () => handleSave(onReorder) })] }))] }));
|
|
2337
2346
|
}
|
|
2338
2347
|
|
|
2339
2348
|
/**
|
|
@@ -2532,7 +2541,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
2532
2541
|
}, min: 1, max: totalPages }), jsxRuntime.jsx("span", { children: "/" }), jsxRuntime.jsx("span", { children: totalPages }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(state.page + 1), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2533
2542
|
}
|
|
2534
2543
|
|
|
2535
|
-
var styles$
|
|
2544
|
+
var styles$m = {"cw-tabs":"cw-tabs-module__cw-tabs__1pmji","badge":"cw-tabs-module__badge__AmVxW","cw-tabs-content":"cw-tabs-module__cw-tabs-content__HTp8d"};
|
|
2536
2545
|
|
|
2537
2546
|
const TabIcon = ({ icon }) => {
|
|
2538
2547
|
if (!icon)
|
|
@@ -2582,7 +2591,7 @@ function CwTabs(CwTabsProps) {
|
|
|
2582
2591
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
2583
2592
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
2584
2593
|
: undefined;
|
|
2585
|
-
return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$
|
|
2594
|
+
return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$m['cw-tabs'] + (CwTabsProps.className ? ` ${CwTabsProps.className}` : "") + "", style: CwTabsProps.style, "data-tabs-position": position, children: [jsxRuntime.jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxRuntime.jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, "data-tab-key": tab.key, children: [jsxRuntime.jsx(TabIcon, { icon: tab.icon }), tab.title, (tab.badge !== undefined || tab.badgeColor) && (jsxRuntime.jsx("span", { className: styles$m['badge'], style: tab.badgeColor ? { backgroundColor: tab.badgeColor, color: getContrastColor(tab.badgeColor) } : undefined, children: tab.badge }))] }, tab.key))) }), jsxRuntime.jsx("div", { className: styles$m['cw-tabs-content'], "data-active-tab-key": activeTab ?? undefined, children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
|
|
2586
2595
|
}
|
|
2587
2596
|
|
|
2588
2597
|
/**
|
|
@@ -2609,7 +2618,7 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
2609
2618
|
return (jsxRuntime.jsxs("details", { ref: myRef, ...detailsProps, className: "cw-expandable", children: [jsxRuntime.jsx("summary", { children: briefing }), children && jsxRuntime.jsx("section", { children: children })] }));
|
|
2610
2619
|
};
|
|
2611
2620
|
|
|
2612
|
-
var styles$
|
|
2621
|
+
var styles$l = {"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","detail-empty":"cw-master-detail-module__detail-empty__KFScK"};
|
|
2613
2622
|
|
|
2614
2623
|
const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, detailContent, emptyDetail, searchPlaceholder = 'Search...', onSearch, masterHeader, masterFooter, masterWidth: initialWidth = 320, minMasterWidth = 240, maxMasterWidth = 500, resizable = true, showSearch = true, }) => {
|
|
2615
2624
|
const [masterWidth, setMasterWidth] = React.useState(initialWidth);
|
|
@@ -2645,10 +2654,10 @@ const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, de
|
|
|
2645
2654
|
document.body.style.userSelect = '';
|
|
2646
2655
|
};
|
|
2647
2656
|
}, [isResizing, minMasterWidth, maxMasterWidth]);
|
|
2648
|
-
const rootClassName = [styles$
|
|
2649
|
-
return (jsxRuntime.jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, children: [jsxRuntime.jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsxRuntime.jsx("search", { children: jsxRuntime.jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsxRuntime.jsx("header", { children: masterHeader })), jsxRuntime.jsx("ul", { children: items.map((item) => (jsxRuntime.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 && (jsxRuntime.jsx("footer", { children: masterFooter }))] }), resizable && (jsxRuntime.jsx("div", { className: styles$
|
|
2657
|
+
const rootClassName = [styles$l['cw-master-detail'], className].filter(Boolean).join(' ');
|
|
2658
|
+
return (jsxRuntime.jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, children: [jsxRuntime.jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsxRuntime.jsx("search", { children: jsxRuntime.jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsxRuntime.jsx("header", { children: masterHeader })), jsxRuntime.jsx("ul", { children: items.map((item) => (jsxRuntime.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 && (jsxRuntime.jsx("footer", { children: masterFooter }))] }), resizable && (jsxRuntime.jsx("div", { className: styles$l.resizer, "data-resizing": isResizing, onMouseDown: handleMouseDown })), jsxRuntime.jsx("section", { className: styles$l.detail, children: selectedKey && detailContent
|
|
2650
2659
|
? detailContent
|
|
2651
|
-
: (jsxRuntime.jsx("div", { className: styles$
|
|
2660
|
+
: (jsxRuntime.jsx("div", { className: styles$l['detail-empty'], children: emptyDetail ?? 'Select an item to view details' })) })] }));
|
|
2652
2661
|
};
|
|
2653
2662
|
|
|
2654
2663
|
/**
|
|
@@ -2673,7 +2682,7 @@ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "
|
|
|
2673
2682
|
: emptyValue })] }, item.key))) }));
|
|
2674
2683
|
};
|
|
2675
2684
|
|
|
2676
|
-
var styles$
|
|
2685
|
+
var styles$k = {"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"};
|
|
2677
2686
|
|
|
2678
2687
|
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, maxHeight = "300px", }) {
|
|
2679
2688
|
const [draggedItem, setDraggedItem] = React.useState(null);
|
|
@@ -2736,15 +2745,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
|
|
|
2736
2745
|
}
|
|
2737
2746
|
};
|
|
2738
2747
|
if (items.length === 0) {
|
|
2739
|
-
return (jsxRuntime.jsx("div", { className: `${styles$
|
|
2748
|
+
return (jsxRuntime.jsx("div", { className: `${styles$k.sortableList} ${styles$k.emptyState} ${className}`, children: jsxRuntime.jsx("div", { className: styles$k.emptyMessage, children: emptyMessage }) }));
|
|
2740
2749
|
}
|
|
2741
|
-
return (jsxRuntime.jsx("div", { className: `${styles$
|
|
2750
|
+
return (jsxRuntime.jsx("div", { className: `${styles$k.sortableList} ${className}`, style: { maxHeight }, children: items.map((item, index) => {
|
|
2742
2751
|
const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
|
|
2743
2752
|
const isDragging = draggedItem?.id === item.id;
|
|
2744
2753
|
const isMoved = movedItems.has(item.id);
|
|
2745
2754
|
const canExpand = Boolean(expandedContent);
|
|
2746
2755
|
const isExpanded = expandedItems.has(item.id);
|
|
2747
|
-
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && jsxRuntime.jsx("div", { className: styles$
|
|
2756
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && jsxRuntime.jsx("div", { className: styles$k.dropIndicator }), jsxRuntime.jsxs("div", { className: `${styles$k.sortableItem} ${isDragging ? styles$k.dragging : ''} ${isMoved ? styles$k.moved : ''} ${readOnly ? styles$k.readOnly : ''}`, draggable: !readOnly, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, children: [jsxRuntime.jsxs("header", { children: [canExpand ? (jsxRuntime.jsx(CwButton, { variant: "icon", onClick: () => toggleExpanded(item.id), type: "button", title: isExpanded ? "Collapse" : "Expand", icon: isExpanded ? "chevron-up" : "chevron-down" })) : showHandle ? (jsxRuntime.jsx("div", { className: styles$k.sortableHandle, children: jsxRuntime.jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxRuntime.jsxs("div", { className: styles$k.sortableContent, children: [jsxRuntime.jsx("div", { className: styles$k.sortableTitle, children: title }), extraContent && jsxRuntime.jsx("div", { className: styles$k.sortableExtraContent, children: extraContent })] }), jsxRuntime.jsx("div", { className: styles$k.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsxRuntime.jsx("div", { className: styles$k.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsxRuntime.jsx("div", { className: styles$k.dropIndicator }))] }, item.id));
|
|
2748
2757
|
}) }));
|
|
2749
2758
|
}
|
|
2750
2759
|
|
|
@@ -2921,7 +2930,7 @@ function CwFileUpload(fileUploadProps) {
|
|
|
2921
2930
|
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "row", children: [jsxRuntime.jsx("input", { className: "cw-button", type: "file", accept: fileUploadProps.accept, readOnly: true, placeholder: "No file selected...", onChange: handleFileChange }), previewURL && (jsxRuntime.jsx("div", { className: "row", children: jsxRuntime.jsx("img", { src: previewURL, alt: "Preview", style: { maxWidth: "200px", maxHeight: "200px" } }) }))] }), error && jsxRuntime.jsx("div", { className: "row error", children: error }), jsxRuntime.jsx("div", { className: "row", children: jsxRuntime.jsxs("label", { children: ["Please note: File/image has to be in ", fileUploadProps.acceptString, " format", fileUploadProps.sizeString && `, ${fileUploadProps.sizeString}`] }) })] }));
|
|
2922
2931
|
}
|
|
2923
2932
|
|
|
2924
|
-
var styles$
|
|
2933
|
+
var styles$j = {"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"};
|
|
2925
2934
|
|
|
2926
2935
|
const DEFAULT_LABELS = {
|
|
2927
2936
|
uploadDisabled: 'Upload disabled',
|
|
@@ -3088,12 +3097,12 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3088
3097
|
}
|
|
3089
3098
|
}
|
|
3090
3099
|
};
|
|
3091
|
-
return (jsxRuntime.jsxs("div", { className: `${styles$
|
|
3100
|
+
return (jsxRuntime.jsxs("div", { className: `${styles$j.fileUploadContainer} ${fileUploadProps.className}`, children: [jsxRuntime.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$j.hiddenInput }), selectedFiles.length === 0 && !existingFile ? (jsxRuntime.jsxs("div", { className: `${styles$j.uploadArea} ${fileUploadProps.disabled ? styles$j.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsxRuntime.jsx(CwIcon, { iconId: "upload" }), jsxRuntime.jsx("p", { className: `${styles$j.uploadTitle}`, children: fileUploadProps.disabled ? labels.uploadDisabled : labels.clickToUpload }), jsxRuntime.jsxs("p", { className: `${styles$j.uploadSubtitle}`, children: [fileUploadProps.accept ? labels.acceptedFiles(fileUploadProps.accept) : labels.allTypesAccepted, !fileUploadProps.multiple && ` ${labels.singleFileOnly}`] })] })) : selectedFiles.length === 0 && existingFile ? (jsxRuntime.jsxs("div", { className: styles$j.filesContainer, children: [jsxRuntime.jsxs("div", { className: styles$j.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$j.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$j.fileExtension, children: getFileExtension(existingFile) })] }), jsxRuntime.jsx("div", { className: styles$j.fileInfo, children: jsxRuntime.jsx("p", { className: styles$j.fileName, children: existingFile }) }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => {
|
|
3092
3101
|
setExistingFile(undefined);
|
|
3093
3102
|
if (fileUploadProps.onSelect) {
|
|
3094
3103
|
fileUploadProps.onSelect(null);
|
|
3095
3104
|
}
|
|
3096
|
-
}, disabled: fileUploadProps.disabled, className: styles$
|
|
3105
|
+
}, disabled: fileUploadProps.disabled, className: styles$j.smallButton })] }), jsxRuntime.jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled })] })) : (jsxRuntime.jsxs("div", { className: styles$j.filesContainer, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center", children: [jsxRuntime.jsx("small", { className: styles$j.filesCount, children: labels.filesSelected(selectedFiles.length) }), !fileUploadProps.hideClearAll && (jsxRuntime.jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] }), selectedFiles.map((file, index) => (jsxRuntime.jsxs("div", { className: styles$j.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$j.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$j.fileExtension, children: getFileExtension(file.name) })] }), jsxRuntime.jsxs("div", { className: styles$j.fileInfo, children: [jsxRuntime.jsx("p", { className: styles$j.fileName, children: file.name }), jsxRuntime.jsxs("p", { className: styles$j.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$j.smallButton })] }, index))), fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: labels.addMoreFiles, icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
|
|
3097
3106
|
}
|
|
3098
3107
|
|
|
3099
3108
|
function CwInput(CwInputProps) {
|
|
@@ -3134,7 +3143,7 @@ function CwDigit(props) {
|
|
|
3134
3143
|
return (jsxRuntime.jsx("div", { className: "cw-input-text", children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsx("input", { type: "number", ...inputProps }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
|
|
3135
3144
|
}
|
|
3136
3145
|
|
|
3137
|
-
var styles$
|
|
3146
|
+
var styles$i = {"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"};
|
|
3138
3147
|
|
|
3139
3148
|
const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
|
|
3140
3149
|
const [rgb, setRgb] = React.useState({ r: 255, g: 255, b: 255 });
|
|
@@ -3337,13 +3346,13 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
|
|
|
3337
3346
|
// Calculate background color for the main area based on current hue
|
|
3338
3347
|
const hueColor = hsvToRgb(hsv.h, 100, 100);
|
|
3339
3348
|
const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
|
|
3340
|
-
return (jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsxRuntime.jsx("div", { className: styles$
|
|
3349
|
+
return (jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsxRuntime.jsx("div", { className: styles$i.colorPreview, style: { backgroundColor: hexColor, color: getContrastColor(hexColor) }, children: previewText }), jsxRuntime.jsx("button", { type: "button", className: "cw-button", onClick: toggleInputMode, style: { minWidth: "3ch" }, children: inputMode === 'hex' ? 'RGB' : 'HEX' })] }), jsxRuntime.jsx("div", { className: "color-inputs-row", children: inputMode === 'hex' ? (jsxRuntime.jsx("input", { type: "text", value: hexColor, onChange: handleHexChange })) : (jsxRuntime.jsxs("div", { className: "cw-grid-base-3 cw-gap-small", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "R:" }), jsxRuntime.jsx("input", { type: "number", name: "r", min: "0", max: "255", value: rgb.r, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "G:" }), jsxRuntime.jsx("input", { type: "number", name: "g", min: "0", max: "255", value: rgb.g, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "B:" }), jsxRuntime.jsx("input", { type: "number", name: "b", min: "0", max: "255", value: rgb.b, onChange: handleRgbChange })] })] })) }), jsxRuntime.jsxs("div", { className: styles$i.colorPickerInteractiveArea, children: [jsxRuntime.jsx("div", { className: styles$i.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsxRuntime.jsx("div", { className: styles$i.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxRuntime.jsxs("div", { className: styles$i.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxRuntime.jsxs("div", { className: styles$i.colorAreaOverlay, children: [jsxRuntime.jsx("div", { className: styles$i.hueBackground, style: { backgroundColor: hueHex } }), jsxRuntime.jsx("div", { className: styles$i.whiteGradient }), jsxRuntime.jsx("div", { className: styles$i.blackGradient })] }), jsxRuntime.jsx("div", { className: styles$i.colorAreaCursor, style: {
|
|
3341
3350
|
left: `${hsv.s}%`,
|
|
3342
3351
|
top: `${100 - hsv.v}%`
|
|
3343
3352
|
} })] })] })] }));
|
|
3344
3353
|
};
|
|
3345
3354
|
|
|
3346
|
-
var styles$
|
|
3355
|
+
var styles$h = {"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"};
|
|
3347
3356
|
|
|
3348
3357
|
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, readOnly = false, width = '4rem', height = '2rem', labelProps, layoutProps, }) => {
|
|
3349
3358
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -3476,11 +3485,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
3476
3485
|
break;
|
|
3477
3486
|
}
|
|
3478
3487
|
};
|
|
3479
|
-
return (jsxRuntime.jsxs("div", { className: `cw-input-color ${styles$
|
|
3488
|
+
return (jsxRuntime.jsxs("div", { className: `cw-input-color ${styles$h.container}`, "data-direction": layoutProps?.direction ?? "row", "data-align": layoutProps?.align, children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps })), jsxRuntime.jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$h.selectColor} ${disabled ? styles$h.disabled : ''} ${readOnly ? styles$h.readOnly : ''}`, style: {
|
|
3480
3489
|
width,
|
|
3481
3490
|
height,
|
|
3482
3491
|
backgroundColor: value,
|
|
3483
|
-
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: dropdownRef, className: styles$
|
|
3492
|
+
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: dropdownRef, className: styles$h.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsxRuntime.jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
|
|
3484
3493
|
};
|
|
3485
3494
|
|
|
3486
3495
|
/**
|
|
@@ -3730,7 +3739,7 @@ function CwInputDateText(props) {
|
|
|
3730
3739
|
return (jsxRuntime.jsx("div", { className: "cw-input-date-text", children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("div", { children: [jsxRuntime.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 }), jsxRuntime.jsxs("span", { children: [jsxRuntime.jsx(CwIcon, { iconId: "calendar" }), jsxRuntime.jsx("input", { type: "date", disabled: disabled, onChange: onChangeInputDate, readOnly: readOnly, ref: dateInputRef, tabIndex: -1, value: date, ...inputProps })] })] }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
|
|
3731
3740
|
}
|
|
3732
3741
|
|
|
3733
|
-
var styles$
|
|
3742
|
+
var styles$g = {"dropZone":"cw-input-image-module__dropZone__ygrGu"};
|
|
3734
3743
|
|
|
3735
3744
|
function CwInputImage(props) {
|
|
3736
3745
|
const [_uploadedImage, setUploadedImage] = React.useState(null);
|
|
@@ -3778,7 +3787,7 @@ function CwInputImage(props) {
|
|
|
3778
3787
|
const file = e.target.files?.[0];
|
|
3779
3788
|
handleFile(file ?? null);
|
|
3780
3789
|
};
|
|
3781
|
-
return (jsxRuntime.jsxs("div", { className: "cw-input-image", children: [jsxRuntime.jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, className: styles$
|
|
3790
|
+
return (jsxRuntime.jsxs("div", { className: "cw-input-image", children: [jsxRuntime.jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, className: styles$g.dropZone, children: [jsxRuntime.jsx("p", { children: "Drop image here" }), jsxRuntime.jsxs("small", { children: ["(", allowedFormats.join(", ").replace(/image\//g, ""), ")"] })] }), jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-center-center cw-gap-small", children: [jsxRuntime.jsx(CwButton, { onClick: onPasteButtonClick, icon: "paste", text: "Paste" }), jsxRuntime.jsx(CwButton, { onClick: () => inputRef.current?.click(), icon: "folder-open", text: "Browse" })] }), jsxRuntime.jsx("input", { ref: inputRef, type: "file", accept: allowedFormats.join(","), onChange: handleFileChange, style: { display: "none" }, ...inputProps })] }));
|
|
3782
3791
|
}
|
|
3783
3792
|
|
|
3784
3793
|
/**
|
|
@@ -3910,7 +3919,7 @@ const CwImageArea = React.forwardRef((props, ref) => {
|
|
|
3910
3919
|
});
|
|
3911
3920
|
CwImageArea.displayName = "CwImageArea";
|
|
3912
3921
|
|
|
3913
|
-
var styles$
|
|
3922
|
+
var styles$f = {"cw-weekday-selector":"cw-weekday-selector-module__cw-weekday-selector__Iz4GZ"};
|
|
3914
3923
|
|
|
3915
3924
|
/**
|
|
3916
3925
|
* This class represents a week where days can be selected or unselected
|
|
@@ -4050,15 +4059,16 @@ const CwWeekdaySelector = ({ value = "", onChange, disabled = false }) => {
|
|
|
4050
4059
|
setSelectedDays(newWeekdays);
|
|
4051
4060
|
onChange?.(newWeekdays.toString());
|
|
4052
4061
|
};
|
|
4053
|
-
return (jsxRuntime.jsx("div", { className: styles$
|
|
4062
|
+
return (jsxRuntime.jsx("div", { className: styles$f["cw-weekday-selector"], children: Weekdays.getFullWeek().map(day => (jsxRuntime.jsx("input", { type: "checkbox", "data-day": day, checked: selectedDays.toArray().includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }));
|
|
4054
4063
|
};
|
|
4055
4064
|
|
|
4056
|
-
var styles$
|
|
4065
|
+
var styles$e = {"check-container":"cw-check-module__check-container__4nscZ","group":"cw-check-module__group__6JCQo","options":"cw-check-module__options__-g9LF"};
|
|
4057
4066
|
|
|
4058
4067
|
function CwCheck(props) {
|
|
4059
|
-
const { labelProps, labelText,
|
|
4060
|
-
const
|
|
4061
|
-
|
|
4068
|
+
const { labelProps, labelText, direction, alignment, className, ...inputProps } = props;
|
|
4069
|
+
const resolvedDirection = direction ?? alignment ?? "row";
|
|
4070
|
+
const displayText = labelProps?.text ?? labelText;
|
|
4071
|
+
return (jsxRuntime.jsx("div", { className: `cw-check ${styles$e["check-container"]}${className ? ` ${className}` : ''}`, children: jsxRuntime.jsxs("label", { "data-direction": resolvedDirection, children: [jsxRuntime.jsx("input", { type: "checkbox", ...inputProps }), displayText && (jsxRuntime.jsx("span", { className: "cw-icon-text", children: displayText }))] }) }));
|
|
4062
4072
|
}
|
|
4063
4073
|
|
|
4064
4074
|
function CwCheckbox(CwCheckboxProps) {
|
|
@@ -4076,7 +4086,16 @@ function CwCheckbox(CwCheckboxProps) {
|
|
|
4076
4086
|
: "cw_checkboxContent cwellt_flex_row" + " " + CwCheckboxProps.classNameContainer, style: CwCheckboxProps.styleContainer, children: [inputElement, CwCheckboxProps.labelName ? (jsxRuntime.jsx("label", { htmlFor: CwCheckboxProps.id, className: CwCheckboxProps.labelClassName, children: CwCheckboxProps.labelName })) : null] }));
|
|
4077
4087
|
}
|
|
4078
4088
|
|
|
4079
|
-
|
|
4089
|
+
/**
|
|
4090
|
+
* CwCheckboxGroup - Multi-select group of native checkbox inputs.
|
|
4091
|
+
*
|
|
4092
|
+
* Use for selecting any number of values from a list of options. Layout follows the
|
|
4093
|
+
* CwKeyValueList / CwRadioGroup convention with two nested {@link CwLayoutProps} axes applied as
|
|
4094
|
+
* `data-*` attributes: `groupLayout` positions the label relative to the group block (root grid),
|
|
4095
|
+
* `itemLayout` controls how the checkboxes flow among themselves (options container) and, on the
|
|
4096
|
+
* opposite axis, each checkbox's own box-to-text layout.
|
|
4097
|
+
*/
|
|
4098
|
+
function CwCheckboxGroup({ options, value = [], onChange, labelProps, groupLayout, itemLayout, required, disabled, className, feedback, alignProps, optionsAlignment, "data-testid": dataTestId, }) {
|
|
4080
4099
|
const handleChange = (optionValue, checked) => {
|
|
4081
4100
|
if (checked) {
|
|
4082
4101
|
onChange([...value, optionValue]);
|
|
@@ -4088,15 +4107,57 @@ function CwCheckboxGroup({ options, value = [], onChange, labelProps, alignProps
|
|
|
4088
4107
|
const feedbackMessages = feedback
|
|
4089
4108
|
? Array.isArray(feedback) ? feedback : [feedback]
|
|
4090
4109
|
: [];
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4110
|
+
// Effective layout — precedence: new `groupLayout`/`itemLayout` > legacy-derived > default.
|
|
4111
|
+
// Legacy `alignProps.flexDirection` drove the label-vs-options axis (default "row" = label
|
|
4112
|
+
// beside the options); map it to `groupLayout.direction`.
|
|
4113
|
+
const groupDirection = groupLayout?.direction
|
|
4114
|
+
?? (alignProps?.flexDirection === "column" ? "column" : "row");
|
|
4115
|
+
// Legacy `optionsAlignment` is inverted relative to the options flow: "row" stacked the options
|
|
4116
|
+
// (column flow) with each check internally row; "column" laid them inline (row flow) with each
|
|
4117
|
+
// check internally column. Default reproduces the legacy `optionsAlignment="row"` case.
|
|
4118
|
+
const itemDirection = itemLayout?.direction
|
|
4119
|
+
?? (optionsAlignment === "column" ? "row" : "column");
|
|
4120
|
+
// Each checkbox's box-to-text layout is the opposite of the options flow, mirroring CwRadioGroup.
|
|
4121
|
+
const checkDirection = itemDirection === "row" ? "column" : "row";
|
|
4122
|
+
return (jsxRuntime.jsxs("div", { className: `cw-checkbox-group ${styles$e.group}${className ? ` ${className}` : ""}`, "data-testid": dataTestId, "data-direction": labelProps ? groupDirection : "column", "data-align": groupLayout?.align, "data-gap": groupLayout?.gap, children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsx("div", { className: styles$e.options, role: "group", "aria-label": labelProps?.text, "aria-required": required || undefined, "data-direction": itemDirection, "data-gap": itemLayout?.gap, children: options.map((option) => (jsxRuntime.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) => (jsxRuntime.jsx("p", { className: "cw-input-info", "data-color": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
var styles$d = {"radio":"cw-radio-module__radio__5sh7a","group":"cw-radio-module__group__br-HM","options":"cw-radio-module__options__LSw7M"};
|
|
4126
|
+
|
|
4127
|
+
/** Single native radio input. Building block for CwRadioGroup. */
|
|
4128
|
+
function CwRadio({ label, direction = "row", className, ...inputProps }) {
|
|
4129
|
+
return (jsxRuntime.jsxs("label", { className: `cw-radio ${styles$d.radio}${className ? ` ${className}` : ""}`, "data-direction": direction, children: [jsxRuntime.jsx("input", { type: "radio", ...inputProps }), label && jsxRuntime.jsx("span", { children: label })] }));
|
|
4130
|
+
}
|
|
4131
|
+
|
|
4132
|
+
/**
|
|
4133
|
+
* CwRadioGroup - Single-select group of native radio inputs.
|
|
4134
|
+
*
|
|
4135
|
+
* Built on `<input type="radio">` sharing one `name`, so the browser provides radio-group
|
|
4136
|
+
* semantics (roving tabindex, arrow-key navigation) natively. Use for a single choice from a
|
|
4137
|
+
* list of options; for 2–3 options shown as a strip use CwButtonSwitch.
|
|
4138
|
+
*
|
|
4139
|
+
* Layout follows the CwKeyValueList convention with two nested {@link CwLayoutProps} axes
|
|
4140
|
+
* applied as `data-*` attributes: `groupLayout` positions the label relative to the radiogroup
|
|
4141
|
+
* block (root grid), `itemLayout` controls how the radios flow among themselves (options
|
|
4142
|
+
* container) and, on the opposite axis, each radio's own circle-to-text layout.
|
|
4143
|
+
*/
|
|
4144
|
+
function CwRadioGroup({ options, value, onChange, labelProps, groupLayout, itemLayout, required, disabled, className, feedback, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "data-testid": dataTestId, }) {
|
|
4145
|
+
const groupName = React.useId();
|
|
4146
|
+
const feedbackMessages = feedback
|
|
4147
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
4148
|
+
: [];
|
|
4149
|
+
// Each radio's circle-to-text layout is the opposite of the options flow: a stacked list
|
|
4150
|
+
// (itemLayout column) reads best with the circle beside the text; a side-by-side row reads
|
|
4151
|
+
// best with the circle above the text.
|
|
4152
|
+
const radioDirection = itemLayout?.direction === "row" ? "column" : "row";
|
|
4153
|
+
return (jsxRuntime.jsxs("div", { className: `cw-radio-group ${styles$d.group}${className ? ` ${className}` : ""}`, "data-testid": dataTestId, "data-direction": labelProps ? (groupLayout?.direction ?? "column") : "column", "data-align": groupLayout?.align, "data-gap": groupLayout?.gap, children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsx("div", { className: styles$d.options, role: "radiogroup", "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) => (jsxRuntime.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) => (jsxRuntime.jsx("p", { className: "cw-input-info", "data-color": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
4094
4154
|
}
|
|
4095
4155
|
|
|
4096
4156
|
function CwToggle(props) {
|
|
4097
|
-
const { labelProps, labelText,
|
|
4098
|
-
const
|
|
4099
|
-
|
|
4157
|
+
const { labelProps, labelText, direction, alignment, className, style, ...inputProps } = props;
|
|
4158
|
+
const resolvedDirection = direction ?? alignment ?? "row";
|
|
4159
|
+
const displayText = labelProps?.text ?? labelText;
|
|
4160
|
+
return (jsxRuntime.jsx("div", { className: `cw-toggle ${className ? ` ${className}` : ''}`, style: style, children: jsxRuntime.jsxs("label", { className: "cw-toggle-label", "data-direction": resolvedDirection, children: [displayText && (jsxRuntime.jsx("span", { className: "cw-icon-text", children: displayText })), jsxRuntime.jsx("input", {
|
|
4100
4161
|
//data-color={color}
|
|
4101
4162
|
type: "checkbox", ...inputProps })] }) }));
|
|
4102
4163
|
}
|
|
@@ -4355,7 +4416,7 @@ function CwDropdownFilter(props) {
|
|
|
4355
4416
|
return (jsxRuntime.jsxs("div", { id: props.IdContent, className: containerClassName, children: [props.children, isVisible && (jsxRuntime.jsx("nav", { className: "cw-dropdown-menu", style: inlineStyles, onMouseLeave: props.onMouseLeave, id: props.idDropDownFilter, role: "menu", children: jsxRuntime.jsx("ul", { role: "none", children: props.DataSourceDropDownItem?.map((item) => (jsxRuntime.jsx("li", { id: item.IdDropDown_filter, role: "menuitem", children: item.dropDownFilter_desc }, item.IdDropDown_filter))) }) }))] }));
|
|
4356
4417
|
}
|
|
4357
4418
|
|
|
4358
|
-
var styles$
|
|
4419
|
+
var styles$c = {"container":"cw-popover-button-module__container__YSWQU","panel":"cw-popover-button-module__panel__C-BTn"};
|
|
4359
4420
|
|
|
4360
4421
|
/**
|
|
4361
4422
|
* Button that toggles a floating panel with arbitrary children.
|
|
@@ -4434,7 +4495,7 @@ function CwPopoverButton({ children, panelWidth = "auto", placement = "bottom-st
|
|
|
4434
4495
|
}
|
|
4435
4496
|
panel.showPopover();
|
|
4436
4497
|
}, [placement]);
|
|
4437
|
-
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$
|
|
4498
|
+
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$c.container, children: [jsxRuntime.jsx(CwButton, { ...buttonProps, onClick: handleClick }), jsxRuntime.jsx("div", { ref: panelCallbackRef, className: `${styles$c.panel}${panelClassName ? ` ${panelClassName}` : ""}`, style: { width: panelWidth }, children: children })] }));
|
|
4438
4499
|
}
|
|
4439
4500
|
|
|
4440
4501
|
function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor, onPrimaryColor) {
|
|
@@ -4452,13 +4513,13 @@ function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor
|
|
|
4452
4513
|
return result;
|
|
4453
4514
|
}
|
|
4454
4515
|
|
|
4455
|
-
var styles$
|
|
4516
|
+
var styles$b = {"cw-multifilter-tag":"cw-multi-filter-tag-module__cw-multifilter-tag__Epda-"};
|
|
4456
4517
|
|
|
4457
4518
|
const CwMultiFilterTag = props => {
|
|
4458
4519
|
const { ID, Name, Value, Category, Removable, PrimaryColor, Selectable, Selected } = props;
|
|
4459
4520
|
const backgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
|
|
4460
4521
|
const isOutlineMode = Selected && !Removable;
|
|
4461
|
-
return (jsxRuntime.jsx("li", { className: styles$
|
|
4522
|
+
return (jsxRuntime.jsx("li", { className: styles$b["cw-multifilter-tag"], id: ID, "data-value": Value, "data-category": Category, "data-selected": !!Selected, title: props.tooltip ?? Name, onClick: () => {
|
|
4462
4523
|
if (Selectable)
|
|
4463
4524
|
props.OnSelect?.(props);
|
|
4464
4525
|
}, children: jsxRuntime.jsx(CwChip, { label: Name, colorScheme: "custom", customColor: backgroundColor, variant: isOutlineMode ? "outline" : "soft", closable: Removable, onClose: () => props.OnRemove?.(props),
|
|
@@ -4468,7 +4529,7 @@ const CwMultiFilterTag = props => {
|
|
|
4468
4529
|
} : undefined }) }));
|
|
4469
4530
|
};
|
|
4470
4531
|
|
|
4471
|
-
var styles$
|
|
4532
|
+
var styles$a = {"cw-multi-filter-catalog-container":"cw-multi-filter-module__cw-multi-filter-catalog-container__S3nsq","cw-multi-filter":"cw-multi-filter-module__cw-multi-filter__zipBK","category-selected":"cw-multi-filter-module__category-selected__eYbes","cw-multi-filter-search":"cw-multi-filter-module__cw-multi-filter-search__eyHr0 cw-choice-input-box-module__inputBox__gHY9d"};
|
|
4472
4533
|
|
|
4473
4534
|
/**
|
|
4474
4535
|
* A multiple filter selector, a MULTI-SELECT even. Allows users to select and filter items based on tags.
|
|
@@ -4695,9 +4756,9 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4695
4756
|
inputRef.current?.focus();
|
|
4696
4757
|
}
|
|
4697
4758
|
};
|
|
4698
|
-
return (jsxRuntime.jsxs("form", { ref: componentRef, id: id, className: `${styles$
|
|
4759
|
+
return (jsxRuntime.jsxs("form", { ref: componentRef, id: id, className: `${styles$a["cw-multi-filter"]}${className ? ` ${className}` : ""}`, style: style, onSubmit: (e) => {
|
|
4699
4760
|
e.preventDefault();
|
|
4700
|
-
}, children: [jsxRuntime.jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$
|
|
4761
|
+
}, children: [jsxRuntime.jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$a["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-color-outline-variant)" } : {}, children: [jsxRuntime.jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (React.createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsxRuntime.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 => {
|
|
4701
4762
|
switch (e.key) {
|
|
4702
4763
|
case "Enter":
|
|
4703
4764
|
case "Tab": {
|
|
@@ -4724,7 +4785,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4724
4785
|
break;
|
|
4725
4786
|
}
|
|
4726
4787
|
}
|
|
4727
|
-
} })] }), selectedTags.size > 0 && (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: e => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChangeSelectedTags(new Set()); setIsPanelOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), renderPanel(jsxRuntime.jsxs("section", { ref: panelRef, className: styles$
|
|
4788
|
+
} })] }), selectedTags.size > 0 && (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: e => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChangeSelectedTags(new Set()); setIsPanelOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), renderPanel(jsxRuntime.jsxs("section", { ref: panelRef, className: styles$a["cw-multi-filter-catalog-container"], style: panelStyle, children: [jsxRuntime.jsxs("nav", { children: [jsxRuntime.jsx("button", { className: selectedCategory === "All" ? styles$a["category-selected"] : undefined, onClick: () => handleClickCategory("All"), children: allCategoriesLabel }), Array.from(categoriesMappedToTags().keys()).map(category => (jsxRuntime.jsx("button", { className: selectedCategory === category ? styles$a["category-selected"] : undefined, style: {
|
|
4728
4789
|
backgroundColor: getColor(category).primary,
|
|
4729
4790
|
color: getColor(category).onPrimary,
|
|
4730
4791
|
}, onClick: () => handleClickCategory(category), children: category }, category)))] }), jsxRuntime.jsx("ul", { children: displayTags
|
|
@@ -4750,7 +4811,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4750
4811
|
} }, props.ID))) })] }))] }));
|
|
4751
4812
|
};
|
|
4752
4813
|
|
|
4753
|
-
var styles$
|
|
4814
|
+
var styles$9 = {"container":"cw-tag-selector-module__container__-do8i","inputBox":"cw-tag-selector-module__inputBox__3NGz9 cw-choice-input-box-module__inputBox__gHY9d","disabled":"cw-tag-selector-module__disabled__vbud9 cw-choice-input-box-module__disabled__TFAnC","dropdown":"cw-tag-selector-module__dropdown__X6Dob cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-tag-selector-module__option__2UQ7g cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-tag-selector-module__optionFocused__8-lv8 cw-choice-dropdown-module__optionFocused__BYMxj","optionDot":"cw-tag-selector-module__optionDot__CdFlG cw-choice-dropdown-module__colorCircle__x7mI9","selectAll":"cw-tag-selector-module__selectAll__HyvMA"};
|
|
4754
4815
|
|
|
4755
4816
|
/**
|
|
4756
4817
|
* Multi-select input with chip tags and searchable dropdown.
|
|
@@ -4885,11 +4946,11 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
4885
4946
|
// Keeping containerRef for any other potential use
|
|
4886
4947
|
const direction = alignProps?.flexDirection ?? "row";
|
|
4887
4948
|
const feedbackMessages = feedback ? (Array.isArray(feedback) ? feedback : [feedback]) : [];
|
|
4888
|
-
return (jsxRuntime.jsxs("div", { ref: containerRef, className: `${styles$
|
|
4889
|
-
inputRef.current?.focus(); }, children: [selectedOptions.map(opt => (jsxRuntime.jsx(CwChip, { label: opt.label, colorScheme: opt.color ? "custom" : "info", customColor: opt.color, closable: !disabled, onClose: () => handleRemove(opt.value) }, opt.value))), jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: search, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: selectedOptions.length === 0 ? placeholder : "", disabled: disabled, autoComplete: "off" }), value.length > 0 && !disabled && (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: (e) => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChange([]); setSearch(""); setOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] })] }), feedbackMessages.map((fb, i) => (jsxRuntime.jsx("p", { className: "cw-input-info", "data-color": fb.type, children: fb.message }, i))), renderPanel((showSelectAll || filtered.length > 0) ? (jsxRuntime.jsxs("div", { ref: panelRef, className: styles$
|
|
4949
|
+
return (jsxRuntime.jsxs("div", { ref: containerRef, className: `${styles$9.container}${className ? ` ${className}` : ""}`, style: style, id: id, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("div", { className: `${styles$9.inputBox}${disabled ? ` ${styles$9.disabled}` : ""}`, ref: inputBoxRef, onClick: () => { if (!disabled)
|
|
4950
|
+
inputRef.current?.focus(); }, children: [selectedOptions.map(opt => (jsxRuntime.jsx(CwChip, { label: opt.label, colorScheme: opt.color ? "custom" : "info", customColor: opt.color, closable: !disabled, onClose: () => handleRemove(opt.value) }, opt.value))), jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: search, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: selectedOptions.length === 0 ? placeholder : "", disabled: disabled, autoComplete: "off" }), value.length > 0 && !disabled && (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: (e) => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChange([]); setSearch(""); setOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] })] }), feedbackMessages.map((fb, i) => (jsxRuntime.jsx("p", { className: "cw-input-info", "data-color": fb.type, children: fb.message }, i))), renderPanel((showSelectAll || filtered.length > 0) ? (jsxRuntime.jsxs("div", { ref: panelRef, className: styles$9.dropdown, style: panelStyle, children: [showSelectAll && !search && (jsxRuntime.jsxs("div", { className: styles$9.selectAll, onMouseDown: (e) => e.preventDefault(), onClick: handleToggleAll, children: [jsxRuntime.jsx("input", { type: "checkbox", checked: allSelected, readOnly: true, tabIndex: -1 }), allSelected ? "Deselect all" : "Select all"] })), jsxRuntime.jsx("ul", { ref: listRef, children: filtered.map((opt, idx) => (jsxRuntime.jsxs("li", { className: `${styles$9.option}${idx === focusedIndex ? ` ${styles$9.optionFocused}` : ""}`, onMouseDown: (e) => e.preventDefault(), onClick: () => handleSelect(opt.value), onMouseEnter: () => setFocusedIndex(idx), title: opt.tooltip, children: [opt.color && jsxRuntime.jsx("span", { className: styles$9.optionDot, style: { backgroundColor: opt.color } }), opt.label] }, opt.value))) })] })) : null)] }));
|
|
4890
4951
|
}
|
|
4891
4952
|
|
|
4892
|
-
var styles$
|
|
4953
|
+
var styles$8 = {"tree-container":"cw-tree-view-module__tree-container__NN-HJ","tree-wrapper":"cw-tree-view-module__tree-wrapper__keBZI","tree-item":"cw-tree-view-module__tree-item__prE9N","tree-node":"cw-tree-view-module__tree-node__wfro9","selected":"cw-tree-view-module__selected__XJQ0w","non-selectable":"cw-tree-view-module__non-selectable__YuPSx","tree-children":"cw-tree-view-module__tree-children__ji8CZ","empty-state":"cw-tree-view-module__empty-state__yvRjo","tree-label":"cw-tree-view-module__tree-label__ss3Nf","tree-spacer":"cw-tree-view-module__tree-spacer__E9Ud2"};
|
|
4893
4954
|
|
|
4894
4955
|
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null }) {
|
|
4895
4956
|
const [expanded, setExpanded] = React.useState(new Set());
|
|
@@ -4956,10 +5017,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4956
5017
|
const isLeaf = !hasChildren;
|
|
4957
5018
|
const isSelected = selectedId?.toString().toLowerCase() === node.id.toString().toLowerCase();
|
|
4958
5019
|
const selectable = allowParentSelection || isLeaf;
|
|
4959
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
4960
|
-
styles$
|
|
4961
|
-
isSelected && styles$
|
|
4962
|
-
!selectable && styles$
|
|
5020
|
+
return (jsxRuntime.jsxs("div", { className: styles$8["tree-item"], children: [jsxRuntime.jsxs("div", { className: [
|
|
5021
|
+
styles$8["tree-node"],
|
|
5022
|
+
isSelected && styles$8["selected"],
|
|
5023
|
+
!selectable && styles$8["non-selectable"]
|
|
4963
5024
|
].filter(Boolean).join(' '), style: { paddingLeft: `${depth * 24 + 8}px` }, onClick: () => {
|
|
4964
5025
|
if (selectable) {
|
|
4965
5026
|
setSelectedId(node.id);
|
|
@@ -4968,7 +5029,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4968
5029
|
else {
|
|
4969
5030
|
toggleExpand(node.id);
|
|
4970
5031
|
}
|
|
4971
|
-
}, children: [hasChildren && (jsxRuntime.jsx(CwIcon, { size: "large", iconId: isExpanded ? "chevron-down" : "chevron-right" })), jsxRuntime.jsx("div", { className: `${styles$
|
|
5032
|
+
}, children: [hasChildren && (jsxRuntime.jsx(CwIcon, { size: "large", iconId: isExpanded ? "chevron-down" : "chevron-right" })), jsxRuntime.jsx("div", { className: `${styles$8["tree-label"]} ${!hasChildren ? styles$8["tree-spacer"] : ''}`, children: node.label })] }), hasChildren && isExpanded && (jsxRuntime.jsx("div", { className: styles$8["tree-children"], children: node.children.map((child) => renderNode(child, depth + 1)) }))] }, node.id));
|
|
4972
5033
|
};
|
|
4973
5034
|
// Function to search for nodes that match the search term
|
|
4974
5035
|
const searchInTree = (nodes, searchTerm) => {
|
|
@@ -4992,7 +5053,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4992
5053
|
return results;
|
|
4993
5054
|
};
|
|
4994
5055
|
const filteredData = searchInTree(data, search);
|
|
4995
|
-
return (jsxRuntime.jsxs("div", { className: `cw-tree-view ${styles$
|
|
5056
|
+
return (jsxRuntime.jsxs("div", { className: `cw-tree-view ${styles$8["tree-container"]}`, children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx("input", { type: "text", placeholder: "Search in tree...", value: search, onChange: (e) => setSearch(e.target.value) }), search && (jsxRuntime.jsx(CwButton, { onClick: () => setSearch(""), type: "button", icon: "close", variant: "icon", color: "neutral" }))] }), jsxRuntime.jsx("div", { className: styles$8["tree-wrapper"], children: filteredData.length > 0 ? (filteredData.map((node) => renderNode(node))) : (jsxRuntime.jsxs("div", { className: styles$8["empty-state"], children: [jsxRuntime.jsx(CwIcon, { iconId: "comment" }), search ? "No results found" : "There are no items"] })) })] }));
|
|
4996
5057
|
}
|
|
4997
5058
|
|
|
4998
5059
|
/**
|
|
@@ -5350,7 +5411,7 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5350
5411
|
}, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: isInitialLoading ? "Loading…" : placeholder, disabled: disabled, required: required, autoComplete: "off", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": showDropdown, "aria-controls": listboxId, "aria-activedescendant": highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined, title: tooltipText }), (isLoading || isInitialLoading) && (jsxRuntime.jsx("div", { className: "cw-search-input-loading", children: jsxRuntime.jsx(CwIcon, { iconId: "spinner" }) })), jsxRuntime.jsx("div", { className: "cw-search-input-icons", children: inputValue && !disabled && !isInitialLoading ? (jsxRuntime.jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selection", variant: "icon", icon: "close", color: "neutral" })) : (icon ? jsxRuntime.jsx(CwIcon, { ...icon }) : jsxRuntime.jsx(CwIcon, { iconId: "search" })) })] })] }), renderPanel(jsxRuntime.jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsxRuntime.jsx("ul", { children: options.map((option, index) => (jsxRuntime.jsx("li", { id: optionId(index), className: `${dropdownStyles.option}${index === highlightedIndex ? ` ${dropdownStyles.optionFocused}` : ""}`, onClick: () => handleOptionSelect(option.id), onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: option.subLabel ? (jsxRuntime.jsxs("span", { className: "cw-search-async-option-lines", children: [jsxRuntime.jsx("span", { children: option.label }), jsxRuntime.jsx("span", { className: "cw-search-async-option-sub", children: option.subLabel })] })) : (option.label) }, option.id))) }) }))] }));
|
|
5351
5412
|
};
|
|
5352
5413
|
|
|
5353
|
-
var styles$
|
|
5414
|
+
var styles$7 = {"menu":"cw-context-menu-module__menu__tXmun","item":"cw-context-menu-module__item__-ko8L","arrow":"cw-context-menu-module__arrow__LHZmQ"};
|
|
5354
5415
|
|
|
5355
5416
|
const ARROW_SIZE = 8;
|
|
5356
5417
|
const SAFETY_MARGIN = 8;
|
|
@@ -5491,14 +5552,14 @@ const CwAnchoredMenu = ({ children, options, onSelect, placement = 'bottom', ope
|
|
|
5491
5552
|
document.removeEventListener("keydown", handleEscape);
|
|
5492
5553
|
};
|
|
5493
5554
|
}, [isOpen]);
|
|
5494
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: triggerRef, onContextMenu: handleContextMenu, style: { display: "contents" }, children: children }), isOpen && normalizedOptions.length > 0 && reactDom.createPortal(jsxRuntime.jsxs("div", { ref: menuRef, className: styles$
|
|
5555
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: triggerRef, onContextMenu: handleContextMenu, style: { display: "contents" }, children: children }), isOpen && normalizedOptions.length > 0 && reactDom.createPortal(jsxRuntime.jsxs("div", { ref: menuRef, className: styles$7["menu"], style: {
|
|
5495
5556
|
top: `${position.y}px`,
|
|
5496
5557
|
left: `${position.x}px`,
|
|
5497
|
-
}, "data-has-arrow": "true", children: [jsxRuntime.jsx("div", { ref: arrowRef, className: styles$
|
|
5558
|
+
}, "data-has-arrow": "true", children: [jsxRuntime.jsx("div", { ref: arrowRef, className: styles$7["arrow"], "data-placement": placement }), normalizedOptions.map(option => (jsxRuntime.jsxs("div", { onClick: (e) => {
|
|
5498
5559
|
e.stopPropagation();
|
|
5499
5560
|
e.preventDefault();
|
|
5500
5561
|
handleOptionClick(option);
|
|
5501
|
-
}, className: `${styles$
|
|
5562
|
+
}, className: `${styles$7["item"]} ${option.disabled ? styles$7["disabled"] : ""}`, "data-disabled": option.disabled, children: [option.icon && jsxRuntime.jsx("span", { className: styles$7["icon"], children: option.icon }), option.label] }, option.key)))] }), document.body)] }));
|
|
5502
5563
|
};
|
|
5503
5564
|
|
|
5504
5565
|
/**
|
|
@@ -5571,12 +5632,143 @@ const CwContextMenu = ({ children, options, offset = DEFAULT_OFFSET, onSelect })
|
|
|
5571
5632
|
document.removeEventListener("keydown", handleEscape);
|
|
5572
5633
|
};
|
|
5573
5634
|
}, [isOpen]);
|
|
5574
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { onContextMenu: handleContextMenu, children: children }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: menuRef, className: styles$
|
|
5635
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { onContextMenu: handleContextMenu, children: children }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: menuRef, className: styles$7["menu"], style: {
|
|
5575
5636
|
top: `${position.y}px`,
|
|
5576
5637
|
left: `${position.x}px`,
|
|
5577
|
-
}, children: options.map(option => (jsxRuntime.jsx("div", { onClick: () => handleOptionClick(option), className: styles$
|
|
5638
|
+
}, children: options.map(option => (jsxRuntime.jsx("div", { onClick: () => handleOptionClick(option), className: styles$7["item"], children: option }, option))) }), document.body)] }));
|
|
5578
5639
|
};
|
|
5579
5640
|
|
|
5641
|
+
var styles$6 = {"split":"cw-button-split-module__split__B2KbU","menu":"cw-button-split-module__menu__mKDlt","item":"cw-button-split-module__item__Aqw6f"};
|
|
5642
|
+
|
|
5643
|
+
/**
|
|
5644
|
+
* CwButtonSplit - A primary action joined to a dropdown of alternative actions.
|
|
5645
|
+
*
|
|
5646
|
+
* Composes a main {@link CwButton} with a {@link CwPopoverButton} chevron whose
|
|
5647
|
+
* panel holds a vertical menu of alternatives (rendered as `variant="ghost"` rows).
|
|
5648
|
+
* Both parts share variant, color and size and read as one joined control.
|
|
5649
|
+
*
|
|
5650
|
+
* @example
|
|
5651
|
+
* <CwButtonSplit
|
|
5652
|
+
* text="Save"
|
|
5653
|
+
* icon="save"
|
|
5654
|
+
* onClick={handleSave}
|
|
5655
|
+
* actions={[
|
|
5656
|
+
* { key: "saveAs", label: "Save as…", icon: "copy" },
|
|
5657
|
+
* { key: "saveAndClose", label: "Save and close" },
|
|
5658
|
+
* ]}
|
|
5659
|
+
* onSelect={handleSelect}
|
|
5660
|
+
* />
|
|
5661
|
+
*/
|
|
5662
|
+
function CwButtonSplit({ text, icon, onClick, actions, onSelect, variant = "solid", color = "primary", size = "medium", disabled = false, placement = "bottom-end", "data-testid": dataTestId, }) {
|
|
5663
|
+
const handleSelect = (action) => (event) => {
|
|
5664
|
+
onSelect(action.key);
|
|
5665
|
+
event.currentTarget.closest("[popover]")?.hidePopover();
|
|
5666
|
+
};
|
|
5667
|
+
return (jsxRuntime.jsxs("div", { className: styles$6.split, "data-variant": variant, "data-testid": dataTestId, children: [jsxRuntime.jsx(CwButton, { text: text, icon: icon, variant: variant, color: color, size: size, onClick: onClick, disabled: disabled }), jsxRuntime.jsx(CwPopoverButton, { icon: "chevron-down", title: "More actions", variant: variant, color: color, size: size, disabled: disabled, placement: placement, children: jsxRuntime.jsx("div", { className: styles$6.menu, children: actions.map((action) => (jsxRuntime.jsx(CwButton, { variant: "ghost", color: "neutral", text: action.label, icon: action.icon, disabled: action.disabled, className: styles$6.item, onClick: handleSelect(action) }, action.key))) }) })] }));
|
|
5668
|
+
}
|
|
5669
|
+
|
|
5670
|
+
/**
|
|
5671
|
+
* Roving-tabindex single-select behaviour for a custom radio group (e.g. a segmented
|
|
5672
|
+
* button strip that has no native grouping). The active segment is the selected one,
|
|
5673
|
+
* or the first enabled option when nothing is selected. Arrow keys (Right/Down = next,
|
|
5674
|
+
* Left/Up = previous) move focus and select, wrapping around and skipping disabled
|
|
5675
|
+
* options; Space/Enter selects the focused segment.
|
|
5676
|
+
*
|
|
5677
|
+
* Native form controls (e.g. `<input type="radio">` sharing a name) already get this
|
|
5678
|
+
* behaviour from the browser — use this hook only for non-native custom groups.
|
|
5679
|
+
*/
|
|
5680
|
+
function useRovingSingleSelect(options, value, onChange) {
|
|
5681
|
+
const elementRefs = React.useRef([]);
|
|
5682
|
+
const selectedIndex = options.findIndex((option) => option.value === value);
|
|
5683
|
+
const firstEnabledIndex = options.findIndex((option) => !option.disabled);
|
|
5684
|
+
// If the selected option is disabled it cannot hold the tab stop (disabled elements are out of
|
|
5685
|
+
// the tab order), so fall back to the first enabled option to keep the group reachable by Tab.
|
|
5686
|
+
const activeIndex = selectedIndex >= 0 && !options[selectedIndex]?.disabled ? selectedIndex : firstEnabledIndex;
|
|
5687
|
+
const focusAndSelect = React.useCallback((index) => {
|
|
5688
|
+
const option = options[index];
|
|
5689
|
+
if (!option || option.disabled)
|
|
5690
|
+
return;
|
|
5691
|
+
onChange(option.value);
|
|
5692
|
+
elementRefs.current[index]?.focus();
|
|
5693
|
+
}, [options, onChange]);
|
|
5694
|
+
const moveFocus = React.useCallback((fromIndex, direction) => {
|
|
5695
|
+
const count = options.length;
|
|
5696
|
+
if (count === 0)
|
|
5697
|
+
return;
|
|
5698
|
+
let nextIndex = fromIndex;
|
|
5699
|
+
for (let step = 0; step < count; step++) {
|
|
5700
|
+
nextIndex = (nextIndex + direction + count) % count;
|
|
5701
|
+
if (!options[nextIndex]?.disabled) {
|
|
5702
|
+
focusAndSelect(nextIndex);
|
|
5703
|
+
return;
|
|
5704
|
+
}
|
|
5705
|
+
}
|
|
5706
|
+
}, [options, focusAndSelect]);
|
|
5707
|
+
const getSegmentProps = React.useCallback((index) => ({
|
|
5708
|
+
tabIndex: index === activeIndex ? 0 : -1,
|
|
5709
|
+
ref: (element) => {
|
|
5710
|
+
elementRefs.current[index] = element;
|
|
5711
|
+
},
|
|
5712
|
+
onKeyDown: (event) => {
|
|
5713
|
+
switch (event.key) {
|
|
5714
|
+
case "ArrowRight":
|
|
5715
|
+
case "ArrowDown":
|
|
5716
|
+
event.preventDefault();
|
|
5717
|
+
moveFocus(index, 1);
|
|
5718
|
+
break;
|
|
5719
|
+
case "ArrowLeft":
|
|
5720
|
+
case "ArrowUp":
|
|
5721
|
+
event.preventDefault();
|
|
5722
|
+
moveFocus(index, -1);
|
|
5723
|
+
break;
|
|
5724
|
+
case " ":
|
|
5725
|
+
case "Enter":
|
|
5726
|
+
event.preventDefault();
|
|
5727
|
+
focusAndSelect(index);
|
|
5728
|
+
break;
|
|
5729
|
+
}
|
|
5730
|
+
},
|
|
5731
|
+
}), [activeIndex, moveFocus, focusAndSelect]);
|
|
5732
|
+
return { activeIndex, getSegmentProps };
|
|
5733
|
+
}
|
|
5734
|
+
|
|
5735
|
+
var styles$5 = {"switch":"cw-button-switch-module__switch__vdWV-","segment":"cw-button-switch-module__segment__JmVla","iconOnly":"cw-button-switch-module__iconOnly__-kCwj"};
|
|
5736
|
+
|
|
5737
|
+
/**
|
|
5738
|
+
* CwButtonSwitch - Segmented single-select control: a strip of joined CwButtons.
|
|
5739
|
+
*
|
|
5740
|
+
* The selected segment renders `solid`, the others `outline`, both sharing the `color`
|
|
5741
|
+
* theme (`primary` default, `danger`, or `neutral`). It is a proper ARIA radiogroup with
|
|
5742
|
+
* roving tabindex (one tab stop) and arrow-key navigation, provided by
|
|
5743
|
+
* {@link useRovingSingleSelect}. Use for 2–3 mutually-exclusive options that benefit from
|
|
5744
|
+
* being shown side by side; for a longer list use CwRadioGroup.
|
|
5745
|
+
*
|
|
5746
|
+
* `direction="column"` renders the strip vertically (stacked, full-width segments) instead of
|
|
5747
|
+
* the default horizontal `row`; arrow-key navigation handles both orientations.
|
|
5748
|
+
*
|
|
5749
|
+
* Set `iconOnly` to render just each option's icon; the option's `label` is still required
|
|
5750
|
+
* and is passed as the segment title, so it becomes the tooltip and the accessible name.
|
|
5751
|
+
*
|
|
5752
|
+
* It is an inline control with no form label — if a caption is needed, place it next to the
|
|
5753
|
+
* control at the call site, and pass `aria-label` (or `aria-labelledby`) to name the radiogroup
|
|
5754
|
+
* for screen readers.
|
|
5755
|
+
*
|
|
5756
|
+
* @example
|
|
5757
|
+
* <CwButtonSwitch
|
|
5758
|
+
* options={[{ value: "list", label: "List", icon: "list" }, { value: "grid", label: "Grid", icon: "grid" }]}
|
|
5759
|
+
* value={view}
|
|
5760
|
+
* onChange={setView}
|
|
5761
|
+
* />
|
|
5762
|
+
*/
|
|
5763
|
+
function CwButtonSwitch({ options, value, onChange, size = "medium", color = "primary", iconOnly = false, direction = "row", disabled = false, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "data-testid": dataTestId, }) {
|
|
5764
|
+
const { getSegmentProps } = useRovingSingleSelect(options, value, onChange);
|
|
5765
|
+
return (jsxRuntime.jsx("div", { className: `cw-button-switch ${styles$5.switch}`, role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : ariaLabel, "data-direction": direction, "data-testid": dataTestId, children: options.map((option, index) => {
|
|
5766
|
+
const selected = option.value === value;
|
|
5767
|
+
const segmentProps = getSegmentProps(index);
|
|
5768
|
+
return (jsxRuntime.jsx(CwButton, { text: iconOnly ? undefined : option.label, title: iconOnly ? option.label : undefined, icon: option.icon, size: size, color: color, variant: selected ? "solid" : "outline", role: "radio", "aria-checked": selected, disabled: disabled || option.disabled, onClick: () => onChange(option.value), className: `${styles$5.segment}${iconOnly ? ` ${styles$5.iconOnly}` : ""}`, tabIndex: segmentProps.tabIndex, ref: segmentProps.ref, onKeyDown: segmentProps.onKeyDown }, option.value));
|
|
5769
|
+
}) }));
|
|
5770
|
+
}
|
|
5771
|
+
|
|
5580
5772
|
/**
|
|
5581
5773
|
* Save button wrapper (6 uses pending delete)
|
|
5582
5774
|
* @deprecated Use <CwButton variant="icon" icon="save" onClick={...} /> instead
|
|
@@ -11130,6 +11322,8 @@ exports.CwBtnDelete = CwBtnDelete;
|
|
|
11130
11322
|
exports.CwBtnEdit = CwBtnEdit;
|
|
11131
11323
|
exports.CwBtnSave = CwBtnSave;
|
|
11132
11324
|
exports.CwButton = CwButton;
|
|
11325
|
+
exports.CwButtonSplit = CwButtonSplit;
|
|
11326
|
+
exports.CwButtonSwitch = CwButtonSwitch;
|
|
11133
11327
|
exports.CwCard = CwCard;
|
|
11134
11328
|
exports.CwCardList = CwCardList;
|
|
11135
11329
|
exports.CwCheck = CwCheck;
|
|
@@ -11186,6 +11380,7 @@ exports.CwMultiFilterTag = CwMultiFilterTag;
|
|
|
11186
11380
|
exports.CwNote = CwNote;
|
|
11187
11381
|
exports.CwOption = CwOption;
|
|
11188
11382
|
exports.CwPopoverButton = CwPopoverButton;
|
|
11383
|
+
exports.CwRadioGroup = CwRadioGroup;
|
|
11189
11384
|
exports.CwReportModal = CwReportModal;
|
|
11190
11385
|
exports.CwScheduler = CwScheduler;
|
|
11191
11386
|
exports.CwSearchAsync = CwSearchAsync;
|