@cwellt_software/cwellt-reactjs-lib 1.4.13 → 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 +343 -94
- package/dist/index.css +2 -2
- package/dist/index.d.ts +287 -81
- package/dist/index.es.js +342 -96
- 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/action/buttons/CwButtons.d.ts +5 -5
- package/dist/src/components/control/action/buttons/CwButtons.d.ts.map +1 -1
- package/dist/src/components/control/action/search/CwSearch.d.ts +1 -1
- package/dist/src/components/control/action/search/CwSearch.d.ts.map +1 -1
- package/dist/src/components/control/choice/checkbox/CwCheck.d.ts +7 -6
- package/dist/src/components/control/choice/checkbox/CwCheck.d.ts.map +1 -1
- package/dist/src/components/control/choice/checkbox/CwCheckbox.d.ts +1 -1
- package/dist/src/components/control/choice/checkbox/CwCheckbox.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/dropdown/CwDropdownFilter.d.ts +1 -1
- package/dist/src/components/control/choice/dropdown/CwDropdownFilter.d.ts.map +1 -1
- package/dist/src/components/control/choice/dropdown/CwPopoverButton.d.ts +1 -1
- package/dist/src/components/control/choice/dropdown/CwPopoverButton.d.ts.map +1 -1
- package/dist/src/components/control/choice/option/CwOption.d.ts +1 -1
- package/dist/src/components/control/choice/option/CwOption.d.ts.map +1 -1
- package/dist/src/components/control/choice/select/CwDropdown.d.ts +1 -1
- package/dist/src/components/control/choice/select/CwDropdown.d.ts.map +1 -1
- package/dist/src/components/control/choice/select/CwSelect.d.ts +1 -1
- package/dist/src/components/control/choice/select/CwSelect.d.ts.map +1 -1
- package/dist/src/components/control/choice/tag-selector/CwTagSelector.d.ts +1 -1
- package/dist/src/components/control/choice/tag-selector/CwTagSelector.d.ts.map +1 -1
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts +7 -6
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts.map +1 -1
- package/dist/src/components/control/choice/tree-view/CwTreeView.d.ts +1 -1
- package/dist/src/components/control/choice/tree-view/CwTreeView.d.ts.map +1 -1
- package/dist/src/components/control/input/any/CwInput.d.ts +1 -1
- package/dist/src/components/control/input/any/CwInput.d.ts.map +1 -1
- package/dist/src/components/control/input/date-text/CwInputDateText.d.ts +1 -1
- package/dist/src/components/control/input/date-text/CwInputDateText.d.ts.map +1 -1
- package/dist/src/components/control/input/datetime/CwInputDatetime.d.ts +1 -1
- package/dist/src/components/control/input/datetime/CwInputDatetime.d.ts.map +1 -1
- package/dist/src/components/control/input/digit/CwDigit.d.ts +1 -1
- package/dist/src/components/control/input/digit/CwDigit.d.ts.map +1 -1
- package/dist/src/components/control/input/file/CwFileUpload.d.ts +1 -1
- package/dist/src/components/control/input/file/CwFileUpload.d.ts.map +1 -1
- package/dist/src/components/control/input/file/CwFileUploadMultiple.d.ts +1 -1
- package/dist/src/components/control/input/file/CwFileUploadMultiple.d.ts.map +1 -1
- package/dist/src/components/control/input/image/CwInputImage.d.ts +1 -1
- package/dist/src/components/control/input/image/CwInputImage.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts +2 -1
- package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDatePickerTemporal.d.ts +2 -1
- package/dist/src/components/control/input/new-dates/CwDatePickerTemporal.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePicker.d.ts +1 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePickerTemporal.d.ts +2 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePickerTemporal.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePicker.d.ts +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePickerCompact.d.ts +2 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePickerCompact.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePickerTemporal.d.ts +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePickerTemporal.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwTimePicker.d.ts +4 -3
- package/dist/src/components/control/input/new-dates/CwTimePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/number/CwInputNumber.d.ts +1 -1
- package/dist/src/components/control/input/number/CwInputNumber.d.ts.map +1 -1
- package/dist/src/components/control/input/phone/CwInputPhone.d.ts +1 -1
- package/dist/src/components/control/input/phone/CwInputPhone.d.ts.map +1 -1
- package/dist/src/components/control/input/text/CwInputText.d.ts +1 -1
- package/dist/src/components/control/input/text/CwInputText.d.ts.map +1 -1
- package/dist/src/components/control/input/text-area/CwTextArea.d.ts +1 -1
- package/dist/src/components/control/input/text-area/CwTextArea.d.ts.map +1 -1
- package/dist/src/components/control/input/time/CwTime.d.ts +1 -1
- package/dist/src/components/control/input/time/CwTime.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/CwSchedulerComp.d.ts +1 -1
- package/dist/src/components/custom/scheduler/CwSuperSchedulerComp.d.ts +1 -1
- package/dist/src/components/custom/scheduler/components/day_headers/DayHeader.d.ts +1 -1
- package/dist/src/components/custom/scheduler/components/day_headers/DayHeader.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/components/day_headers/MonthHeader.d.ts +1 -1
- package/dist/src/components/custom/scheduler/components/day_headers/MonthHeader.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/components/day_headers/WeekHeader.d.ts +1 -1
- package/dist/src/components/custom/scheduler/components/day_headers/WeekHeader.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/components/scheduler_timeline/SchedulerTimeLine.d.ts +1 -1
- package/dist/src/components/custom/scheduler/components/scheduler_timeline/SchedulerTimeLine.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/components/time_headers/TimeHeader.d.ts +1 -1
- package/dist/src/components/custom/scheduler/components/time_headers/TimeHeader.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderDivision.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderDivision.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderTitle.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderTitle.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgroundEvent.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgroundEvent.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/SchedulerRow.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/SchedulerRow.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/DivisionLine.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/DivisionLine.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/TimeLine.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/TimeLine.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/WeekEndLine.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/WeekEndLine.d.ts.map +1 -1
- package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts +1 -1
- package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts.map +1 -1
- package/dist/src/components/custom/super-scheduler/SuperScheduler.d.ts +2 -2
- package/dist/src/components/custom/super-scheduler/SuperScheduler.d.ts.map +1 -1
- package/dist/src/components/display/data/accordion/CwAccordionContainer.d.ts +1 -1
- package/dist/src/components/display/data/accordion/CwAccordionContainer.d.ts.map +1 -1
- package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts +2 -2
- package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts.map +1 -1
- package/dist/src/components/display/data/table/CwTable.d.ts +1 -1
- package/dist/src/components/display/data/table/CwTable.d.ts.map +1 -1
- package/dist/src/components/display/data/table-serverside/CwTableServerSide.d.ts +1 -1
- package/dist/src/components/display/data/table-serverside/CwTableServerSide.d.ts.map +1 -1
- package/dist/src/components/display/data/table_sortable/CwSortableTable.d.ts +1 -1
- package/dist/src/components/display/data/table_sortable/CwSortableTable.d.ts.map +1 -1
- package/dist/src/components/display/data/tooltip_manager/CwTooltipManager.d.ts.map +1 -1
- package/dist/src/components/display/graphics/icon/CwIcon.d.ts +2 -2
- package/dist/src/components/display/graphics/icon/CwIcon.d.ts.map +1 -1
- package/dist/src/components/display/graphics/icon/svg-icons.d.ts +2 -2
- package/dist/src/components/display/graphics/image-gallery/CwImageGallery.d.ts +1 -1
- package/dist/src/components/display/graphics/image-gallery/CwImageGallery.d.ts.map +1 -1
- package/dist/src/components/display/graphics/image-zoom/CwImageZoom.d.ts +1 -1
- package/dist/src/components/display/graphics/image-zoom/CwImageZoom.d.ts.map +1 -1
- package/dist/src/components/display/graphics/loading/CwLoading.d.ts +1 -1
- package/dist/src/components/display/graphics/loading/CwLoading.d.ts.map +1 -1
- package/dist/src/components/display/graphics/loading-small/CwLoadingSmall.d.ts +1 -1
- package/dist/src/components/display/graphics/loading-small/CwLoadingSmall.d.ts.map +1 -1
- package/dist/src/components/display/text/heading/CwHeadingMain.d.ts +1 -1
- package/dist/src/components/display/text/heading/CwHeadingMain.d.ts.map +1 -1
- package/dist/src/components/display/text/heading/CwHeadingSecond.d.ts +1 -1
- package/dist/src/components/display/text/heading/CwHeadingSecond.d.ts.map +1 -1
- package/dist/src/components/display/text/label/CwLabel.d.ts +1 -1
- package/dist/src/components/display/text/label/CwLabel.d.ts.map +1 -1
- package/dist/src/components/display/text/message/CwMessage.d.ts +1 -1
- package/dist/src/components/layout/align/CwAlign.d.ts +1 -1
- package/dist/src/components/layout/align/CwAlign.d.ts.map +1 -1
- package/dist/src/components/layout/card/CwCardList.d.ts +1 -1
- package/dist/src/components/layout/card/CwCardList.d.ts.map +1 -1
- package/dist/src/components/layout/confirmation-popup/CwConfirmationPopup.d.ts +2 -2
- package/dist/src/components/layout/confirmation-popup/CwConfirmationPopup.d.ts.map +1 -1
- package/dist/src/components/layout/list/sortable/CwSortableList.d.ts +2 -2
- package/dist/src/components/layout/list/sortable/CwSortableList.d.ts.map +1 -1
- package/dist/src/components/layout/modal/legacy/cw_modal.d.ts +1 -1
- package/dist/src/components/layout/modal/legacy/cw_modal.d.ts.map +1 -1
- package/dist/src/components/layout/modal/legacy/cw_modal_report.d.ts +1 -1
- package/dist/src/components/layout/tabs/CwTabs.d.ts +1 -1
- package/dist/src/components/layout/tabs/CwTabs.d.ts.map +1 -1
- package/dist/src/dev/index.d.ts +1 -1
- package/dist/src/dev/index.d.ts.map +1 -1
- package/dist/src/dev/palette.d.ts +2 -2
- package/dist/src/dev/palette.d.ts.map +1 -1
- package/dist/src/dev/previews.d.ts +2 -1
- package/dist/src/dev/previews.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/src/playground/pages/TooltipCrashPage.d.ts +3 -0
- package/dist/src/playground/pages/TooltipCrashPage.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;
|
|
@@ -219,6 +219,11 @@ const showTooltip = (content, triggerElement, position = "right", dissapearsWhen
|
|
|
219
219
|
constraintRect: constraintElement?.getBoundingClientRect()
|
|
220
220
|
};
|
|
221
221
|
stateUpdateCallbacks.forEach((cb) => cb());
|
|
222
|
+
// Self-heal: if the manager root died (e.g. a prior uncaught error), rebuild
|
|
223
|
+
// it now. The fresh manager initializes from the currentState set above, so
|
|
224
|
+
// this tooltip still shows on this hover — no page reload required. No-op
|
|
225
|
+
// (cheap guard return) when the manager is alive.
|
|
226
|
+
ensureTooltipManager();
|
|
222
227
|
};
|
|
223
228
|
const hideTooltip = (delay = 100) => {
|
|
224
229
|
if (hideTimeout !== undefined) {
|
|
@@ -259,15 +264,59 @@ const calculatePositionForSide$1 = (position, triggerRect, tooltipRect) => {
|
|
|
259
264
|
}
|
|
260
265
|
};
|
|
261
266
|
const MANAGER_CONTAINER_CLASS = "cw-tooltip-manager";
|
|
267
|
+
// Live reference to the manager's React root. Non-null while the manager is
|
|
268
|
+
// mounted (or being built), null once it unmounts — including when React tears
|
|
269
|
+
// the root down after an uncaught error. This is the liveness signal used to
|
|
270
|
+
// self-heal: a dead root leaves a stale container div in the DOM, so checking
|
|
271
|
+
// the div alone (as before) would never rebuild. The manager's effect nulls it
|
|
272
|
+
// on unmount (see CwTooltipManager).
|
|
273
|
+
let managerRoot = null;
|
|
262
274
|
const ensureTooltipManager = () => {
|
|
263
|
-
|
|
275
|
+
// Truthy => alive or already being built this tick (guards against the many
|
|
276
|
+
// CwTooltipNew that mount in the same commit each spinning up their own root).
|
|
277
|
+
if (managerRoot)
|
|
264
278
|
return;
|
|
279
|
+
// Remove any dead container left behind by a previous crash before rebuilding.
|
|
280
|
+
document.querySelectorAll(`.${MANAGER_CONTAINER_CLASS}`).forEach((el) => el.remove());
|
|
265
281
|
const container = document.createElement("div");
|
|
266
282
|
container.className = MANAGER_CONTAINER_CLASS;
|
|
267
283
|
document.body.appendChild(container);
|
|
268
|
-
|
|
269
|
-
|
|
284
|
+
managerRoot = client.createRoot(container);
|
|
285
|
+
managerRoot.render(jsxRuntime.jsx(CwTooltipManager, {}));
|
|
270
286
|
};
|
|
287
|
+
/**
|
|
288
|
+
* Isolates a crashing tooltip's content from the shared singleton root.
|
|
289
|
+
* Without this, an error thrown while rendering any single tooltip's content
|
|
290
|
+
* would unmount the whole CwTooltipManager root, killing every tooltip across
|
|
291
|
+
* the app until a full page reload.
|
|
292
|
+
*
|
|
293
|
+
* NOTE: React error boundaries can ONLY be implemented as class components —
|
|
294
|
+
* there is no hook / functional-component equivalent (see the React docs). This
|
|
295
|
+
* is the accepted exception to the project's functional-component convention;
|
|
296
|
+
* it is intentional infrastructure, not a refactor target — do not flag it.
|
|
297
|
+
*/
|
|
298
|
+
class TooltipErrorBoundary extends React.Component {
|
|
299
|
+
state = { hasError: false };
|
|
300
|
+
static getDerivedStateFromError() {
|
|
301
|
+
return { hasError: true };
|
|
302
|
+
}
|
|
303
|
+
componentDidCatch(error) {
|
|
304
|
+
// Contain the crash: log it, then hide the tooltip so the manager stays
|
|
305
|
+
// mounted and the next hover works normally.
|
|
306
|
+
console.error("CwTooltip content crashed; hiding tooltip.", error);
|
|
307
|
+
this.props.onError();
|
|
308
|
+
}
|
|
309
|
+
componentDidUpdate(prevProps) {
|
|
310
|
+
// Recover for the hover-to-adjacent-element case, where content swaps
|
|
311
|
+
// without the boundary unmounting: clear the error so new content renders.
|
|
312
|
+
if (this.state.hasError && prevProps.children !== this.props.children) {
|
|
313
|
+
this.setState({ hasError: false });
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
render() {
|
|
317
|
+
return this.state.hasError ? null : this.props.children;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
271
320
|
// Main component
|
|
272
321
|
/**
|
|
273
322
|
* Global tooltip renderer. Manages a single portal instance in the DOM,
|
|
@@ -297,6 +346,11 @@ const CwTooltipManager = () => {
|
|
|
297
346
|
stateUpdateCallbacks.add(update);
|
|
298
347
|
return () => {
|
|
299
348
|
stateUpdateCallbacks.delete(update);
|
|
349
|
+
// Signal that the root is gone so ensureTooltipManager rebuilds it on
|
|
350
|
+
// the next show — covers React tearing down the root after an uncaught
|
|
351
|
+
// error in the manager's own machinery (which the content boundary,
|
|
352
|
+
// living inside this tree, cannot catch).
|
|
353
|
+
managerRoot = null;
|
|
300
354
|
};
|
|
301
355
|
}, []);
|
|
302
356
|
// Function to calculate position
|
|
@@ -422,11 +476,11 @@ const CwTooltipManager = () => {
|
|
|
422
476
|
if (!state.isVisible || !state.content) {
|
|
423
477
|
return null;
|
|
424
478
|
}
|
|
425
|
-
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: {
|
|
426
480
|
top: `${tooltipPosition.top}px`,
|
|
427
481
|
left: `${tooltipPosition.left}px`,
|
|
428
482
|
opacity: (isPositioned && !isMeasuring) ? 1 : 0,
|
|
429
|
-
}, onMouseEnter: () => state.dissapearsWhenHover && hideTooltip(), children: state.content }), document.body);
|
|
483
|
+
}, onMouseEnter: () => state.dissapearsWhenHover && hideTooltip(), children: jsxRuntime.jsx(TooltipErrorBoundary, { onError: () => hideTooltip(0), children: state.content }) }), document.body);
|
|
430
484
|
};
|
|
431
485
|
|
|
432
486
|
/**
|
|
@@ -503,7 +557,7 @@ const CwTooltipNew = ({ children, content = null, position = "right", dissapears
|
|
|
503
557
|
React.useEffect(() => {
|
|
504
558
|
ensureTooltipManager();
|
|
505
559
|
}, []);
|
|
506
|
-
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 }));
|
|
507
561
|
};
|
|
508
562
|
|
|
509
563
|
function CwIcon(props) {
|
|
@@ -966,7 +1020,7 @@ function CwLoadingSmall(CwelltLoadingAppointements) {
|
|
|
966
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", {})) }));
|
|
967
1021
|
}
|
|
968
1022
|
|
|
969
|
-
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"};
|
|
970
1024
|
|
|
971
1025
|
// Constants moved outside to prevent recreation
|
|
972
1026
|
const margin = 16;
|
|
@@ -1089,12 +1143,12 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1089
1143
|
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
|
|
1090
1144
|
setIsVisible(true);
|
|
1091
1145
|
}, showDelay);
|
|
1092
|
-
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$
|
|
1146
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$t["cw-generic-tooltip-content"]);
|
|
1093
1147
|
// Memoize tooltip content creation
|
|
1094
1148
|
const tooltipContent = React.useMemo(() => {
|
|
1095
1149
|
if (hide || !isVisible || !content)
|
|
1096
1150
|
return null;
|
|
1097
|
-
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: {
|
|
1098
1152
|
position: 'fixed',
|
|
1099
1153
|
top: `${tooltipPosition.top}px`,
|
|
1100
1154
|
left: `${tooltipPosition.left}px`,
|
|
@@ -1109,10 +1163,10 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1109
1163
|
clearTooltipTimeout();
|
|
1110
1164
|
setIsVisible(false);
|
|
1111
1165
|
}, [clearTooltipTimeout]);
|
|
1112
|
-
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] }));
|
|
1113
1167
|
};
|
|
1114
1168
|
|
|
1115
|
-
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) {
|
|
1116
1170
|
// Build CSS classes based on variant and props
|
|
1117
1171
|
let buttonClass = `cw-button-${variant}`;
|
|
1118
1172
|
// Add icon class only for icon variant without children
|
|
@@ -1123,9 +1177,18 @@ function CwButton({ text, variant = 'solid', color = 'primary', className = '',
|
|
|
1123
1177
|
buttonClass += ` ${className}`;
|
|
1124
1178
|
}
|
|
1125
1179
|
const tooltipContent = title || (variant === 'icon' && text ? text : undefined);
|
|
1126
|
-
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] }))) }));
|
|
1127
1189
|
return tooltipContent ? (jsxRuntime.jsx(CwTooltipNew, { content: tooltipContent, position: tooltipPosition, displayInline: true, children: buttonElement })) : (buttonElement);
|
|
1128
|
-
}
|
|
1190
|
+
});
|
|
1191
|
+
CwButton.displayName = "CwButton";
|
|
1129
1192
|
|
|
1130
1193
|
// Reference for draggable modal
|
|
1131
1194
|
/**
|
|
@@ -1162,7 +1225,7 @@ function CwModal(custModalProps) {
|
|
|
1162
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" } }))] }) })] })) }));
|
|
1163
1226
|
}
|
|
1164
1227
|
|
|
1165
|
-
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"};
|
|
1166
1229
|
|
|
1167
1230
|
function CwConfirmationPopup(props) {
|
|
1168
1231
|
const { isOpen, onConfirm, onCancel, message = "Are you sure you want to proceed?", confirmText = "Confirm", cancelText = "Cancel", placement = 'bottom', children } = props;
|
|
@@ -1226,15 +1289,15 @@ function CwConfirmationPopup(props) {
|
|
|
1226
1289
|
onCancel();
|
|
1227
1290
|
}
|
|
1228
1291
|
};
|
|
1229
|
-
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: {
|
|
1230
1293
|
position: 'absolute',
|
|
1231
1294
|
top: `${position.top}px`,
|
|
1232
1295
|
left: `${position.left}px`,
|
|
1233
1296
|
transform: 'none'
|
|
1234
|
-
}, 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 })] })] }) }))] }));
|
|
1235
1298
|
}
|
|
1236
1299
|
|
|
1237
|
-
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"};
|
|
1238
1301
|
|
|
1239
1302
|
// Helper function to parse size values
|
|
1240
1303
|
const parseSize = (size) => {
|
|
@@ -1507,7 +1570,7 @@ const CwDialog = props => {
|
|
|
1507
1570
|
}
|
|
1508
1571
|
}
|
|
1509
1572
|
}, [open]);
|
|
1510
|
-
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]);
|
|
1511
1574
|
const content = React.useMemo(() => (jsxRuntime.jsx("section", { children: children })), [children]);
|
|
1512
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]);
|
|
1513
1576
|
const resizeHandles = React.useMemo(() => size.autoHeight
|
|
@@ -1534,7 +1597,7 @@ const CwDialog = props => {
|
|
|
1534
1597
|
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
1535
1598
|
return { displayWidth, displayHeight };
|
|
1536
1599
|
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
1537
|
-
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: {
|
|
1538
1601
|
left: `${position.x}px`,
|
|
1539
1602
|
top: `${position.y}px`,
|
|
1540
1603
|
width: displayDimensions.displayWidth,
|
|
@@ -1695,7 +1758,7 @@ function CwAlign(props) {
|
|
|
1695
1758
|
}, children: props.children }));
|
|
1696
1759
|
}
|
|
1697
1760
|
|
|
1698
|
-
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"};
|
|
1699
1762
|
|
|
1700
1763
|
/**
|
|
1701
1764
|
* CwCard - A simple card component for displaying content in a contained format
|
|
@@ -1721,11 +1784,11 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1721
1784
|
// Construct class names using CSS modules
|
|
1722
1785
|
const cardClassNames = [
|
|
1723
1786
|
'cw-card',
|
|
1724
|
-
styles$
|
|
1787
|
+
styles$q.card,
|
|
1725
1788
|
className,
|
|
1726
|
-
clickable ? styles$
|
|
1727
|
-
disabled ? styles$
|
|
1728
|
-
isLoading ? styles$
|
|
1789
|
+
clickable ? styles$q.clickable : '',
|
|
1790
|
+
disabled ? styles$q.disabled : '',
|
|
1791
|
+
isLoading ? styles$q.loading : '',
|
|
1729
1792
|
].filter(Boolean).join(' ');
|
|
1730
1793
|
// Handle click event when card is clickable
|
|
1731
1794
|
const handleClick = () => {
|
|
@@ -1742,15 +1805,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1742
1805
|
// Determine if footer should be rendered
|
|
1743
1806
|
const hasFooter = hasChips || footer || (hasActions && resolvedDirection === "row");
|
|
1744
1807
|
// Actions component to reuse
|
|
1745
|
-
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;
|
|
1746
1809
|
return (jsxRuntime.jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && {
|
|
1747
1810
|
role: 'button',
|
|
1748
1811
|
tabIndex: 0,
|
|
1749
1812
|
onClick: handleClick,
|
|
1750
|
-
}), "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" }) }))] }));
|
|
1751
1814
|
};
|
|
1752
1815
|
|
|
1753
|
-
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"};
|
|
1754
1817
|
|
|
1755
1818
|
/**
|
|
1756
1819
|
* Option to display in the CwSelect
|
|
@@ -1845,10 +1908,10 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
|
|
|
1845
1908
|
icon: sortDirection === 'asc' ? 'arrow-up' : 'arrow-down',
|
|
1846
1909
|
onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'),
|
|
1847
1910
|
title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}`,
|
|
1848
|
-
}, 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)) })] }))] }))] }));
|
|
1849
1912
|
}
|
|
1850
1913
|
|
|
1851
|
-
var styles$
|
|
1914
|
+
var styles$o = {"cw-accordion":"cw-accordion-module__cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module__cw-accordion-body__xlI8b"};
|
|
1852
1915
|
|
|
1853
1916
|
/**
|
|
1854
1917
|
*
|
|
@@ -1865,7 +1928,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
1865
1928
|
setVisible_accordionBody(!isVisible_accordionBody);
|
|
1866
1929
|
};
|
|
1867
1930
|
// #endregion
|
|
1868
|
-
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 })] }));
|
|
1869
1932
|
}
|
|
1870
1933
|
|
|
1871
1934
|
/**
|
|
@@ -2123,7 +2186,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2123
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" })] })] }))] }));
|
|
2124
2187
|
}
|
|
2125
2188
|
|
|
2126
|
-
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"};
|
|
2127
2190
|
|
|
2128
2191
|
/**
|
|
2129
2192
|
* Hook that provides state management for CwSortableTable.
|
|
@@ -2186,9 +2249,9 @@ function useSortableTable(initialItems) {
|
|
|
2186
2249
|
}
|
|
2187
2250
|
|
|
2188
2251
|
// ─── Drop indicator row ───────────────────────────────────────────────────────
|
|
2189
|
-
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", {}) }) }));
|
|
2190
2253
|
// ─── Loading skeleton ─────────────────────────────────────────────────────────
|
|
2191
|
-
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))) }));
|
|
2192
2255
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
2193
2256
|
/**
|
|
2194
2257
|
* CwSortableTable
|
|
@@ -2275,11 +2338,11 @@ function CwSortableTable({ columns, data, rowKey = "key", onReorder, loading = f
|
|
|
2275
2338
|
return items.map((item, index) => {
|
|
2276
2339
|
const key = item[rowKey];
|
|
2277
2340
|
const isDragging = draggedItem?.[rowKey] === key;
|
|
2278
|
-
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)));
|
|
2279
2342
|
});
|
|
2280
2343
|
};
|
|
2281
2344
|
// ── Render ──────────────────────────────────────────────────────────────
|
|
2282
|
-
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) })] }))] }));
|
|
2283
2346
|
}
|
|
2284
2347
|
|
|
2285
2348
|
/**
|
|
@@ -2478,7 +2541,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
2478
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" })] })] }))] }));
|
|
2479
2542
|
}
|
|
2480
2543
|
|
|
2481
|
-
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"};
|
|
2482
2545
|
|
|
2483
2546
|
const TabIcon = ({ icon }) => {
|
|
2484
2547
|
if (!icon)
|
|
@@ -2528,7 +2591,7 @@ function CwTabs(CwTabsProps) {
|
|
|
2528
2591
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
2529
2592
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
2530
2593
|
: undefined;
|
|
2531
|
-
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 })] }));
|
|
2532
2595
|
}
|
|
2533
2596
|
|
|
2534
2597
|
/**
|
|
@@ -2555,7 +2618,7 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
2555
2618
|
return (jsxRuntime.jsxs("details", { ref: myRef, ...detailsProps, className: "cw-expandable", children: [jsxRuntime.jsx("summary", { children: briefing }), children && jsxRuntime.jsx("section", { children: children })] }));
|
|
2556
2619
|
};
|
|
2557
2620
|
|
|
2558
|
-
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"};
|
|
2559
2622
|
|
|
2560
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, }) => {
|
|
2561
2624
|
const [masterWidth, setMasterWidth] = React.useState(initialWidth);
|
|
@@ -2591,10 +2654,10 @@ const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, de
|
|
|
2591
2654
|
document.body.style.userSelect = '';
|
|
2592
2655
|
};
|
|
2593
2656
|
}, [isResizing, minMasterWidth, maxMasterWidth]);
|
|
2594
|
-
const rootClassName = [styles$
|
|
2595
|
-
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
|
|
2596
2659
|
? detailContent
|
|
2597
|
-
: (jsxRuntime.jsx("div", { className: styles$
|
|
2660
|
+
: (jsxRuntime.jsx("div", { className: styles$l['detail-empty'], children: emptyDetail ?? 'Select an item to view details' })) })] }));
|
|
2598
2661
|
};
|
|
2599
2662
|
|
|
2600
2663
|
/**
|
|
@@ -2619,7 +2682,7 @@ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "
|
|
|
2619
2682
|
: emptyValue })] }, item.key))) }));
|
|
2620
2683
|
};
|
|
2621
2684
|
|
|
2622
|
-
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"};
|
|
2623
2686
|
|
|
2624
2687
|
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, maxHeight = "300px", }) {
|
|
2625
2688
|
const [draggedItem, setDraggedItem] = React.useState(null);
|
|
@@ -2682,15 +2745,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
|
|
|
2682
2745
|
}
|
|
2683
2746
|
};
|
|
2684
2747
|
if (items.length === 0) {
|
|
2685
|
-
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 }) }));
|
|
2686
2749
|
}
|
|
2687
|
-
return (jsxRuntime.jsx("div", { className: `${styles$
|
|
2750
|
+
return (jsxRuntime.jsx("div", { className: `${styles$k.sortableList} ${className}`, style: { maxHeight }, children: items.map((item, index) => {
|
|
2688
2751
|
const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
|
|
2689
2752
|
const isDragging = draggedItem?.id === item.id;
|
|
2690
2753
|
const isMoved = movedItems.has(item.id);
|
|
2691
2754
|
const canExpand = Boolean(expandedContent);
|
|
2692
2755
|
const isExpanded = expandedItems.has(item.id);
|
|
2693
|
-
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));
|
|
2694
2757
|
}) }));
|
|
2695
2758
|
}
|
|
2696
2759
|
|
|
@@ -2867,7 +2930,7 @@ function CwFileUpload(fileUploadProps) {
|
|
|
2867
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}`] }) })] }));
|
|
2868
2931
|
}
|
|
2869
2932
|
|
|
2870
|
-
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"};
|
|
2871
2934
|
|
|
2872
2935
|
const DEFAULT_LABELS = {
|
|
2873
2936
|
uploadDisabled: 'Upload disabled',
|
|
@@ -3034,12 +3097,12 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3034
3097
|
}
|
|
3035
3098
|
}
|
|
3036
3099
|
};
|
|
3037
|
-
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: () => {
|
|
3038
3101
|
setExistingFile(undefined);
|
|
3039
3102
|
if (fileUploadProps.onSelect) {
|
|
3040
3103
|
fileUploadProps.onSelect(null);
|
|
3041
3104
|
}
|
|
3042
|
-
}, 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 }))] }))] }));
|
|
3043
3106
|
}
|
|
3044
3107
|
|
|
3045
3108
|
function CwInput(CwInputProps) {
|
|
@@ -3080,7 +3143,7 @@ function CwDigit(props) {
|
|
|
3080
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 })] }) }));
|
|
3081
3144
|
}
|
|
3082
3145
|
|
|
3083
|
-
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"};
|
|
3084
3147
|
|
|
3085
3148
|
const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
|
|
3086
3149
|
const [rgb, setRgb] = React.useState({ r: 255, g: 255, b: 255 });
|
|
@@ -3283,13 +3346,13 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
|
|
|
3283
3346
|
// Calculate background color for the main area based on current hue
|
|
3284
3347
|
const hueColor = hsvToRgb(hsv.h, 100, 100);
|
|
3285
3348
|
const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
|
|
3286
|
-
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: {
|
|
3287
3350
|
left: `${hsv.s}%`,
|
|
3288
3351
|
top: `${100 - hsv.v}%`
|
|
3289
3352
|
} })] })] })] }));
|
|
3290
3353
|
};
|
|
3291
3354
|
|
|
3292
|
-
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"};
|
|
3293
3356
|
|
|
3294
3357
|
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, readOnly = false, width = '4rem', height = '2rem', labelProps, layoutProps, }) => {
|
|
3295
3358
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -3422,11 +3485,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
3422
3485
|
break;
|
|
3423
3486
|
}
|
|
3424
3487
|
};
|
|
3425
|
-
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: {
|
|
3426
3489
|
width,
|
|
3427
3490
|
height,
|
|
3428
3491
|
backgroundColor: value,
|
|
3429
|
-
}, "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)] }));
|
|
3430
3493
|
};
|
|
3431
3494
|
|
|
3432
3495
|
/**
|
|
@@ -3676,7 +3739,7 @@ function CwInputDateText(props) {
|
|
|
3676
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 })] }) }));
|
|
3677
3740
|
}
|
|
3678
3741
|
|
|
3679
|
-
var styles$
|
|
3742
|
+
var styles$g = {"dropZone":"cw-input-image-module__dropZone__ygrGu"};
|
|
3680
3743
|
|
|
3681
3744
|
function CwInputImage(props) {
|
|
3682
3745
|
const [_uploadedImage, setUploadedImage] = React.useState(null);
|
|
@@ -3724,7 +3787,7 @@ function CwInputImage(props) {
|
|
|
3724
3787
|
const file = e.target.files?.[0];
|
|
3725
3788
|
handleFile(file ?? null);
|
|
3726
3789
|
};
|
|
3727
|
-
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 })] }));
|
|
3728
3791
|
}
|
|
3729
3792
|
|
|
3730
3793
|
/**
|
|
@@ -3856,7 +3919,7 @@ const CwImageArea = React.forwardRef((props, ref) => {
|
|
|
3856
3919
|
});
|
|
3857
3920
|
CwImageArea.displayName = "CwImageArea";
|
|
3858
3921
|
|
|
3859
|
-
var styles$
|
|
3922
|
+
var styles$f = {"cw-weekday-selector":"cw-weekday-selector-module__cw-weekday-selector__Iz4GZ"};
|
|
3860
3923
|
|
|
3861
3924
|
/**
|
|
3862
3925
|
* This class represents a week where days can be selected or unselected
|
|
@@ -3996,15 +4059,16 @@ const CwWeekdaySelector = ({ value = "", onChange, disabled = false }) => {
|
|
|
3996
4059
|
setSelectedDays(newWeekdays);
|
|
3997
4060
|
onChange?.(newWeekdays.toString());
|
|
3998
4061
|
};
|
|
3999
|
-
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))) }));
|
|
4000
4063
|
};
|
|
4001
4064
|
|
|
4002
|
-
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"};
|
|
4003
4066
|
|
|
4004
4067
|
function CwCheck(props) {
|
|
4005
|
-
const { labelProps, labelText,
|
|
4006
|
-
const
|
|
4007
|
-
|
|
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 }))] }) }));
|
|
4008
4072
|
}
|
|
4009
4073
|
|
|
4010
4074
|
function CwCheckbox(CwCheckboxProps) {
|
|
@@ -4022,7 +4086,16 @@ function CwCheckbox(CwCheckboxProps) {
|
|
|
4022
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] }));
|
|
4023
4087
|
}
|
|
4024
4088
|
|
|
4025
|
-
|
|
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, }) {
|
|
4026
4099
|
const handleChange = (optionValue, checked) => {
|
|
4027
4100
|
if (checked) {
|
|
4028
4101
|
onChange([...value, optionValue]);
|
|
@@ -4034,15 +4107,57 @@ function CwCheckboxGroup({ options, value = [], onChange, labelProps, alignProps
|
|
|
4034
4107
|
const feedbackMessages = feedback
|
|
4035
4108
|
? Array.isArray(feedback) ? feedback : [feedback]
|
|
4036
4109
|
: [];
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
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)))] }));
|
|
4040
4154
|
}
|
|
4041
4155
|
|
|
4042
4156
|
function CwToggle(props) {
|
|
4043
|
-
const { labelProps, labelText,
|
|
4044
|
-
const
|
|
4045
|
-
|
|
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", {
|
|
4046
4161
|
//data-color={color}
|
|
4047
4162
|
type: "checkbox", ...inputProps })] }) }));
|
|
4048
4163
|
}
|
|
@@ -4301,7 +4416,7 @@ function CwDropdownFilter(props) {
|
|
|
4301
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))) }) }))] }));
|
|
4302
4417
|
}
|
|
4303
4418
|
|
|
4304
|
-
var styles$
|
|
4419
|
+
var styles$c = {"container":"cw-popover-button-module__container__YSWQU","panel":"cw-popover-button-module__panel__C-BTn"};
|
|
4305
4420
|
|
|
4306
4421
|
/**
|
|
4307
4422
|
* Button that toggles a floating panel with arbitrary children.
|
|
@@ -4380,7 +4495,7 @@ function CwPopoverButton({ children, panelWidth = "auto", placement = "bottom-st
|
|
|
4380
4495
|
}
|
|
4381
4496
|
panel.showPopover();
|
|
4382
4497
|
}, [placement]);
|
|
4383
|
-
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 })] }));
|
|
4384
4499
|
}
|
|
4385
4500
|
|
|
4386
4501
|
function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor, onPrimaryColor) {
|
|
@@ -4398,13 +4513,13 @@ function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor
|
|
|
4398
4513
|
return result;
|
|
4399
4514
|
}
|
|
4400
4515
|
|
|
4401
|
-
var styles$
|
|
4516
|
+
var styles$b = {"cw-multifilter-tag":"cw-multi-filter-tag-module__cw-multifilter-tag__Epda-"};
|
|
4402
4517
|
|
|
4403
4518
|
const CwMultiFilterTag = props => {
|
|
4404
4519
|
const { ID, Name, Value, Category, Removable, PrimaryColor, Selectable, Selected } = props;
|
|
4405
4520
|
const backgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
|
|
4406
4521
|
const isOutlineMode = Selected && !Removable;
|
|
4407
|
-
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: () => {
|
|
4408
4523
|
if (Selectable)
|
|
4409
4524
|
props.OnSelect?.(props);
|
|
4410
4525
|
}, children: jsxRuntime.jsx(CwChip, { label: Name, colorScheme: "custom", customColor: backgroundColor, variant: isOutlineMode ? "outline" : "soft", closable: Removable, onClose: () => props.OnRemove?.(props),
|
|
@@ -4414,7 +4529,7 @@ const CwMultiFilterTag = props => {
|
|
|
4414
4529
|
} : undefined }) }));
|
|
4415
4530
|
};
|
|
4416
4531
|
|
|
4417
|
-
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"};
|
|
4418
4533
|
|
|
4419
4534
|
/**
|
|
4420
4535
|
* A multiple filter selector, a MULTI-SELECT even. Allows users to select and filter items based on tags.
|
|
@@ -4641,9 +4756,9 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4641
4756
|
inputRef.current?.focus();
|
|
4642
4757
|
}
|
|
4643
4758
|
};
|
|
4644
|
-
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) => {
|
|
4645
4760
|
e.preventDefault();
|
|
4646
|
-
}, 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 => {
|
|
4647
4762
|
switch (e.key) {
|
|
4648
4763
|
case "Enter":
|
|
4649
4764
|
case "Tab": {
|
|
@@ -4670,7 +4785,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4670
4785
|
break;
|
|
4671
4786
|
}
|
|
4672
4787
|
}
|
|
4673
|
-
} })] }), 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: {
|
|
4674
4789
|
backgroundColor: getColor(category).primary,
|
|
4675
4790
|
color: getColor(category).onPrimary,
|
|
4676
4791
|
}, onClick: () => handleClickCategory(category), children: category }, category)))] }), jsxRuntime.jsx("ul", { children: displayTags
|
|
@@ -4696,7 +4811,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4696
4811
|
} }, props.ID))) })] }))] }));
|
|
4697
4812
|
};
|
|
4698
4813
|
|
|
4699
|
-
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"};
|
|
4700
4815
|
|
|
4701
4816
|
/**
|
|
4702
4817
|
* Multi-select input with chip tags and searchable dropdown.
|
|
@@ -4831,11 +4946,11 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
4831
4946
|
// Keeping containerRef for any other potential use
|
|
4832
4947
|
const direction = alignProps?.flexDirection ?? "row";
|
|
4833
4948
|
const feedbackMessages = feedback ? (Array.isArray(feedback) ? feedback : [feedback]) : [];
|
|
4834
|
-
return (jsxRuntime.jsxs("div", { ref: containerRef, className: `${styles$
|
|
4835
|
-
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)] }));
|
|
4836
4951
|
}
|
|
4837
4952
|
|
|
4838
|
-
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"};
|
|
4839
4954
|
|
|
4840
4955
|
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null }) {
|
|
4841
4956
|
const [expanded, setExpanded] = React.useState(new Set());
|
|
@@ -4902,10 +5017,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4902
5017
|
const isLeaf = !hasChildren;
|
|
4903
5018
|
const isSelected = selectedId?.toString().toLowerCase() === node.id.toString().toLowerCase();
|
|
4904
5019
|
const selectable = allowParentSelection || isLeaf;
|
|
4905
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
4906
|
-
styles$
|
|
4907
|
-
isSelected && styles$
|
|
4908
|
-
!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"]
|
|
4909
5024
|
].filter(Boolean).join(' '), style: { paddingLeft: `${depth * 24 + 8}px` }, onClick: () => {
|
|
4910
5025
|
if (selectable) {
|
|
4911
5026
|
setSelectedId(node.id);
|
|
@@ -4914,7 +5029,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4914
5029
|
else {
|
|
4915
5030
|
toggleExpand(node.id);
|
|
4916
5031
|
}
|
|
4917
|
-
}, 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));
|
|
4918
5033
|
};
|
|
4919
5034
|
// Function to search for nodes that match the search term
|
|
4920
5035
|
const searchInTree = (nodes, searchTerm) => {
|
|
@@ -4938,7 +5053,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4938
5053
|
return results;
|
|
4939
5054
|
};
|
|
4940
5055
|
const filteredData = searchInTree(data, search);
|
|
4941
|
-
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"] })) })] }));
|
|
4942
5057
|
}
|
|
4943
5058
|
|
|
4944
5059
|
/**
|
|
@@ -5296,7 +5411,7 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5296
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))) }) }))] }));
|
|
5297
5412
|
};
|
|
5298
5413
|
|
|
5299
|
-
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"};
|
|
5300
5415
|
|
|
5301
5416
|
const ARROW_SIZE = 8;
|
|
5302
5417
|
const SAFETY_MARGIN = 8;
|
|
@@ -5437,14 +5552,14 @@ const CwAnchoredMenu = ({ children, options, onSelect, placement = 'bottom', ope
|
|
|
5437
5552
|
document.removeEventListener("keydown", handleEscape);
|
|
5438
5553
|
};
|
|
5439
5554
|
}, [isOpen]);
|
|
5440
|
-
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: {
|
|
5441
5556
|
top: `${position.y}px`,
|
|
5442
5557
|
left: `${position.x}px`,
|
|
5443
|
-
}, "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) => {
|
|
5444
5559
|
e.stopPropagation();
|
|
5445
5560
|
e.preventDefault();
|
|
5446
5561
|
handleOptionClick(option);
|
|
5447
|
-
}, 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)] }));
|
|
5448
5563
|
};
|
|
5449
5564
|
|
|
5450
5565
|
/**
|
|
@@ -5517,12 +5632,143 @@ const CwContextMenu = ({ children, options, offset = DEFAULT_OFFSET, onSelect })
|
|
|
5517
5632
|
document.removeEventListener("keydown", handleEscape);
|
|
5518
5633
|
};
|
|
5519
5634
|
}, [isOpen]);
|
|
5520
|
-
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: {
|
|
5521
5636
|
top: `${position.y}px`,
|
|
5522
5637
|
left: `${position.x}px`,
|
|
5523
|
-
}, 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)] }));
|
|
5524
5639
|
};
|
|
5525
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
|
+
|
|
5526
5772
|
/**
|
|
5527
5773
|
* Save button wrapper (6 uses pending delete)
|
|
5528
5774
|
* @deprecated Use <CwButton variant="icon" icon="save" onClick={...} /> instead
|
|
@@ -8447,7 +8693,7 @@ crewAssignmentSchedulerContextMenu, }) => {
|
|
|
8447
8693
|
};
|
|
8448
8694
|
|
|
8449
8695
|
const TimeLine$1 = ({ id, toolTipTitle, marginLeft, color = "rgba(255,0,0,.6)", pixels = 2, height = "100%", zIndex = 1, }) => {
|
|
8450
|
-
return (jsxRuntime.jsx(
|
|
8696
|
+
return (jsxRuntime.jsx(CwTooltipNew, { content: toolTipTitle, position: "top", children: jsxRuntime.jsx("div", { id: id, style: {
|
|
8451
8697
|
borderLeft: `${pixels}px solid ${color}`,
|
|
8452
8698
|
marginLeft: marginLeft,
|
|
8453
8699
|
width: "0px",
|
|
@@ -11076,6 +11322,8 @@ exports.CwBtnDelete = CwBtnDelete;
|
|
|
11076
11322
|
exports.CwBtnEdit = CwBtnEdit;
|
|
11077
11323
|
exports.CwBtnSave = CwBtnSave;
|
|
11078
11324
|
exports.CwButton = CwButton;
|
|
11325
|
+
exports.CwButtonSplit = CwButtonSplit;
|
|
11326
|
+
exports.CwButtonSwitch = CwButtonSwitch;
|
|
11079
11327
|
exports.CwCard = CwCard;
|
|
11080
11328
|
exports.CwCardList = CwCardList;
|
|
11081
11329
|
exports.CwCheck = CwCheck;
|
|
@@ -11132,6 +11380,7 @@ exports.CwMultiFilterTag = CwMultiFilterTag;
|
|
|
11132
11380
|
exports.CwNote = CwNote;
|
|
11133
11381
|
exports.CwOption = CwOption;
|
|
11134
11382
|
exports.CwPopoverButton = CwPopoverButton;
|
|
11383
|
+
exports.CwRadioGroup = CwRadioGroup;
|
|
11135
11384
|
exports.CwReportModal = CwReportModal;
|
|
11136
11385
|
exports.CwScheduler = CwScheduler;
|
|
11137
11386
|
exports.CwSearchAsync = CwSearchAsync;
|