@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.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useState, useRef, useEffect, useCallback, useLayoutEffect, createContext, useContext, cloneElement, useMemo, forwardRef, useImperativeHandle,
|
|
3
|
+
import React__default, { useState, useRef, useEffect, useCallback, useLayoutEffect, createContext, useContext, cloneElement, useMemo, forwardRef, useImperativeHandle, useId, createElement, memo, Fragment as Fragment$1, Component } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { createRoot } from 'react-dom/client';
|
|
6
6
|
import Draggable from 'react-draggable';
|
|
@@ -166,7 +166,7 @@ const SVG_ICONS = {
|
|
|
166
166
|
'sortable-desc': (jsxs("svg", { width: "16", height: "16", viewBox: "0 0 128 128", fill: "currentColor", children: [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" }), 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" })] })),
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
var styles$
|
|
169
|
+
var styles$u = {"cw-tooltip-content":"cw-tooltip-module__cw-tooltip-content__RZczd","cw-tooltip":"cw-tooltip-module__cw-tooltip__1KYig"};
|
|
170
170
|
|
|
171
171
|
// Constants
|
|
172
172
|
const margin$1 = 16;
|
|
@@ -199,6 +199,11 @@ const showTooltip = (content, triggerElement, position = "right", dissapearsWhen
|
|
|
199
199
|
constraintRect: constraintElement?.getBoundingClientRect()
|
|
200
200
|
};
|
|
201
201
|
stateUpdateCallbacks.forEach((cb) => cb());
|
|
202
|
+
// Self-heal: if the manager root died (e.g. a prior uncaught error), rebuild
|
|
203
|
+
// it now. The fresh manager initializes from the currentState set above, so
|
|
204
|
+
// this tooltip still shows on this hover — no page reload required. No-op
|
|
205
|
+
// (cheap guard return) when the manager is alive.
|
|
206
|
+
ensureTooltipManager();
|
|
202
207
|
};
|
|
203
208
|
const hideTooltip = (delay = 100) => {
|
|
204
209
|
if (hideTimeout !== undefined) {
|
|
@@ -239,15 +244,59 @@ const calculatePositionForSide$1 = (position, triggerRect, tooltipRect) => {
|
|
|
239
244
|
}
|
|
240
245
|
};
|
|
241
246
|
const MANAGER_CONTAINER_CLASS = "cw-tooltip-manager";
|
|
247
|
+
// Live reference to the manager's React root. Non-null while the manager is
|
|
248
|
+
// mounted (or being built), null once it unmounts — including when React tears
|
|
249
|
+
// the root down after an uncaught error. This is the liveness signal used to
|
|
250
|
+
// self-heal: a dead root leaves a stale container div in the DOM, so checking
|
|
251
|
+
// the div alone (as before) would never rebuild. The manager's effect nulls it
|
|
252
|
+
// on unmount (see CwTooltipManager).
|
|
253
|
+
let managerRoot = null;
|
|
242
254
|
const ensureTooltipManager = () => {
|
|
243
|
-
|
|
255
|
+
// Truthy => alive or already being built this tick (guards against the many
|
|
256
|
+
// CwTooltipNew that mount in the same commit each spinning up their own root).
|
|
257
|
+
if (managerRoot)
|
|
244
258
|
return;
|
|
259
|
+
// Remove any dead container left behind by a previous crash before rebuilding.
|
|
260
|
+
document.querySelectorAll(`.${MANAGER_CONTAINER_CLASS}`).forEach((el) => el.remove());
|
|
245
261
|
const container = document.createElement("div");
|
|
246
262
|
container.className = MANAGER_CONTAINER_CLASS;
|
|
247
263
|
document.body.appendChild(container);
|
|
248
|
-
|
|
249
|
-
|
|
264
|
+
managerRoot = createRoot(container);
|
|
265
|
+
managerRoot.render(jsx(CwTooltipManager, {}));
|
|
250
266
|
};
|
|
267
|
+
/**
|
|
268
|
+
* Isolates a crashing tooltip's content from the shared singleton root.
|
|
269
|
+
* Without this, an error thrown while rendering any single tooltip's content
|
|
270
|
+
* would unmount the whole CwTooltipManager root, killing every tooltip across
|
|
271
|
+
* the app until a full page reload.
|
|
272
|
+
*
|
|
273
|
+
* NOTE: React error boundaries can ONLY be implemented as class components —
|
|
274
|
+
* there is no hook / functional-component equivalent (see the React docs). This
|
|
275
|
+
* is the accepted exception to the project's functional-component convention;
|
|
276
|
+
* it is intentional infrastructure, not a refactor target — do not flag it.
|
|
277
|
+
*/
|
|
278
|
+
class TooltipErrorBoundary extends React__default.Component {
|
|
279
|
+
state = { hasError: false };
|
|
280
|
+
static getDerivedStateFromError() {
|
|
281
|
+
return { hasError: true };
|
|
282
|
+
}
|
|
283
|
+
componentDidCatch(error) {
|
|
284
|
+
// Contain the crash: log it, then hide the tooltip so the manager stays
|
|
285
|
+
// mounted and the next hover works normally.
|
|
286
|
+
console.error("CwTooltip content crashed; hiding tooltip.", error);
|
|
287
|
+
this.props.onError();
|
|
288
|
+
}
|
|
289
|
+
componentDidUpdate(prevProps) {
|
|
290
|
+
// Recover for the hover-to-adjacent-element case, where content swaps
|
|
291
|
+
// without the boundary unmounting: clear the error so new content renders.
|
|
292
|
+
if (this.state.hasError && prevProps.children !== this.props.children) {
|
|
293
|
+
this.setState({ hasError: false });
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
render() {
|
|
297
|
+
return this.state.hasError ? null : this.props.children;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
251
300
|
// Main component
|
|
252
301
|
/**
|
|
253
302
|
* Global tooltip renderer. Manages a single portal instance in the DOM,
|
|
@@ -277,6 +326,11 @@ const CwTooltipManager = () => {
|
|
|
277
326
|
stateUpdateCallbacks.add(update);
|
|
278
327
|
return () => {
|
|
279
328
|
stateUpdateCallbacks.delete(update);
|
|
329
|
+
// Signal that the root is gone so ensureTooltipManager rebuilds it on
|
|
330
|
+
// the next show — covers React tearing down the root after an uncaught
|
|
331
|
+
// error in the manager's own machinery (which the content boundary,
|
|
332
|
+
// living inside this tree, cannot catch).
|
|
333
|
+
managerRoot = null;
|
|
280
334
|
};
|
|
281
335
|
}, []);
|
|
282
336
|
// Function to calculate position
|
|
@@ -402,11 +456,11 @@ const CwTooltipManager = () => {
|
|
|
402
456
|
if (!state.isVisible || !state.content) {
|
|
403
457
|
return null;
|
|
404
458
|
}
|
|
405
|
-
return createPortal(jsx("div", { ref: tooltipRef, className: styles$
|
|
459
|
+
return createPortal(jsx("div", { ref: tooltipRef, className: styles$u["cw-tooltip-content"], "data-position": actualPosition, "data-visible": state.isVisible, "data-inline": state.displayInline, style: {
|
|
406
460
|
top: `${tooltipPosition.top}px`,
|
|
407
461
|
left: `${tooltipPosition.left}px`,
|
|
408
462
|
opacity: (isPositioned && !isMeasuring) ? 1 : 0,
|
|
409
|
-
}, onMouseEnter: () => state.dissapearsWhenHover && hideTooltip(), children: state.content }), document.body);
|
|
463
|
+
}, onMouseEnter: () => state.dissapearsWhenHover && hideTooltip(), children: jsx(TooltipErrorBoundary, { onError: () => hideTooltip(0), children: state.content }) }), document.body);
|
|
410
464
|
};
|
|
411
465
|
|
|
412
466
|
/**
|
|
@@ -483,7 +537,7 @@ const CwTooltipNew = ({ children, content = null, position = "right", dissapears
|
|
|
483
537
|
useEffect(() => {
|
|
484
538
|
ensureTooltipManager();
|
|
485
539
|
}, []);
|
|
486
|
-
return (jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$
|
|
540
|
+
return (jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$u["cw-tooltip"], children: children }));
|
|
487
541
|
};
|
|
488
542
|
|
|
489
543
|
function CwIcon(props) {
|
|
@@ -946,7 +1000,7 @@ function CwLoadingSmall(CwelltLoadingAppointements) {
|
|
|
946
1000
|
return (jsx("div", { children: CwelltLoadingAppointements.isLoading === true ? (jsx("div", { className: "cw-loading-container", children: jsx("div", { className: "cw-loading" }) })) : (jsx("div", {})) }));
|
|
947
1001
|
}
|
|
948
1002
|
|
|
949
|
-
var styles$
|
|
1003
|
+
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"};
|
|
950
1004
|
|
|
951
1005
|
// Constants moved outside to prevent recreation
|
|
952
1006
|
const margin = 16;
|
|
@@ -1069,12 +1123,12 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1069
1123
|
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
|
|
1070
1124
|
setIsVisible(true);
|
|
1071
1125
|
}, showDelay);
|
|
1072
|
-
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$
|
|
1126
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$t["cw-generic-tooltip-content"]);
|
|
1073
1127
|
// Memoize tooltip content creation
|
|
1074
1128
|
const tooltipContent = useMemo(() => {
|
|
1075
1129
|
if (hide || !isVisible || !content)
|
|
1076
1130
|
return null;
|
|
1077
|
-
return createPortal(jsx("div", { className: styles$
|
|
1131
|
+
return createPortal(jsx("div", { className: styles$t["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, "data-inline": displayInline, style: {
|
|
1078
1132
|
position: 'fixed',
|
|
1079
1133
|
top: `${tooltipPosition.top}px`,
|
|
1080
1134
|
left: `${tooltipPosition.left}px`,
|
|
@@ -1089,10 +1143,10 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1089
1143
|
clearTooltipTimeout();
|
|
1090
1144
|
setIsVisible(false);
|
|
1091
1145
|
}, [clearTooltipTimeout]);
|
|
1092
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
1146
|
+
return (jsxs("div", { ref: containerRef, className: styles$t["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, children: [tooltipContent, children] }));
|
|
1093
1147
|
};
|
|
1094
1148
|
|
|
1095
|
-
function CwButton({ text, variant = 'solid', color = 'primary', className = '', icon = "", title, tooltipPosition = "bottom", children, ...buttonProps }) {
|
|
1149
|
+
const CwButton = React__default.forwardRef(function CwButton({ text, variant = 'solid', color = 'primary', size = 'medium', iconPosition = 'left', pressed, className = '', icon = "", title, tooltipPosition = "bottom", children, ...buttonProps }, ref) {
|
|
1096
1150
|
// Build CSS classes based on variant and props
|
|
1097
1151
|
let buttonClass = `cw-button-${variant}`;
|
|
1098
1152
|
// Add icon class only for icon variant without children
|
|
@@ -1103,9 +1157,18 @@ function CwButton({ text, variant = 'solid', color = 'primary', className = '',
|
|
|
1103
1157
|
buttonClass += ` ${className}`;
|
|
1104
1158
|
}
|
|
1105
1159
|
const tooltipContent = title || (variant === 'icon' && text ? text : undefined);
|
|
1106
|
-
const
|
|
1160
|
+
const iconElement = icon ? jsx(CwIcon, { iconId: icon }) : null;
|
|
1161
|
+
const textElement = text ? jsx("strong", { children: text }) : null;
|
|
1162
|
+
// Only emit toggle attributes when `pressed` is defined; otherwise output stays identical to a normal button.
|
|
1163
|
+
const pressedProps = pressed !== undefined
|
|
1164
|
+
? { "aria-pressed": pressed, "data-pressed": pressed ? "true" : undefined }
|
|
1165
|
+
: {};
|
|
1166
|
+
const buttonElement = (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'
|
|
1167
|
+
? jsxs(Fragment, { children: [textElement, iconElement] })
|
|
1168
|
+
: jsxs(Fragment, { children: [iconElement, textElement] }))) }));
|
|
1107
1169
|
return tooltipContent ? (jsx(CwTooltipNew, { content: tooltipContent, position: tooltipPosition, displayInline: true, children: buttonElement })) : (buttonElement);
|
|
1108
|
-
}
|
|
1170
|
+
});
|
|
1171
|
+
CwButton.displayName = "CwButton";
|
|
1109
1172
|
|
|
1110
1173
|
// Reference for draggable modal
|
|
1111
1174
|
/**
|
|
@@ -1142,7 +1205,7 @@ function CwModal(custModalProps) {
|
|
|
1142
1205
|
return (jsx("div", { children: custModalProps.modalState && (jsxs("div", { className: custModalProps.classNameModalOverlay + " cwelltModalOverlay", children: [jsx("div", { className: "cwelltModalOverlayBg", onClick: custModalProps.onCloseModal }), jsx(Draggable, { disabled: isModalDisabled, axis: "both", nodeRef: draggableRef, children: jsxs("div", { className: custModalProps.classNameModal + " cwelltContainerModal", ref: draggableRef, style: widthModalDef !== "40em" ? modalStyle.widthCustomStyle : modalStyle.widthDefStyle, children: [jsxs("div", { className: "cwelltModalHeader", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsx("div", { className: "cwelltModalTitle", children: custModalProps.titleModal }), jsx("button", { className: "cwelltBtnCloseModal", onClick: custModalProps.onCloseModal, children: jsx("span", { className: "cwelltCloseIcon" }) })] }), jsx("div", { className: "cwelltModalBody", children: jsx("div", { className: "cwelltContainerModalBody", style: { position: "relative" }, children: custModalProps.children }) }), isHide === false ? (jsx("footer", { className: "legacy-modal-footer", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: custModalProps.onSaveModal, form: custModalProps.formSaveModal, hidden: custModalProps.HideBtnModal, type: custModalProps.HtmlSubmitModal }) })) : (jsx("div", { style: { display: "none" } }))] }) })] })) }));
|
|
1143
1206
|
}
|
|
1144
1207
|
|
|
1145
|
-
var styles$
|
|
1208
|
+
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"};
|
|
1146
1209
|
|
|
1147
1210
|
function CwConfirmationPopup(props) {
|
|
1148
1211
|
const { isOpen, onConfirm, onCancel, message = "Are you sure you want to proceed?", confirmText = "Confirm", cancelText = "Cancel", placement = 'bottom', children } = props;
|
|
@@ -1206,15 +1269,15 @@ function CwConfirmationPopup(props) {
|
|
|
1206
1269
|
onCancel();
|
|
1207
1270
|
}
|
|
1208
1271
|
};
|
|
1209
|
-
return (jsxs(Fragment, { children: [renderChildren(), isOpen && (jsx("div", { className: styles$
|
|
1272
|
+
return (jsxs(Fragment, { children: [renderChildren(), isOpen && (jsx("div", { className: styles$s.overlayPositioned, onClick: handleOverlayClick, children: jsxs("div", { ref: popupRef, className: styles$s.popup, style: {
|
|
1210
1273
|
position: 'absolute',
|
|
1211
1274
|
top: `${position.top}px`,
|
|
1212
1275
|
left: `${position.left}px`,
|
|
1213
1276
|
transform: 'none'
|
|
1214
|
-
}, children: [jsx("p", { className: styles$
|
|
1277
|
+
}, children: [jsx("p", { className: styles$s.message, children: message }), jsxs("div", { className: styles$s.buttons, children: [jsx("button", { className: `${styles$s.button} ${styles$s.confirmButton}`, onClick: onConfirm, children: confirmText }), jsx("button", { className: `${styles$s.button} ${styles$s.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
|
|
1215
1278
|
}
|
|
1216
1279
|
|
|
1217
|
-
var styles$
|
|
1280
|
+
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"};
|
|
1218
1281
|
|
|
1219
1282
|
// Helper function to parse size values
|
|
1220
1283
|
const parseSize = (size) => {
|
|
@@ -1487,7 +1550,7 @@ const CwDialog = props => {
|
|
|
1487
1550
|
}
|
|
1488
1551
|
}
|
|
1489
1552
|
}, [open]);
|
|
1490
|
-
const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$
|
|
1553
|
+
const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$r["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
|
|
1491
1554
|
const content = useMemo(() => (jsx("section", { children: children })), [children]);
|
|
1492
1555
|
const footer = useMemo(() => (jsx("footer", { children: customFooter || (jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: onSave, tooltipPosition: "top", disabled: disableSave, "data-testid": "cw-dialog-save" })) })), [customFooter, onSave, disableSave]);
|
|
1493
1556
|
const resizeHandles = useMemo(() => size.autoHeight
|
|
@@ -1514,7 +1577,7 @@ const CwDialog = props => {
|
|
|
1514
1577
|
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
1515
1578
|
return { displayWidth, displayHeight };
|
|
1516
1579
|
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
1517
|
-
const dialogContent = (jsx("div", { "data-has-scrim": hasScrim, className: styles$
|
|
1580
|
+
const dialogContent = (jsx("div", { "data-has-scrim": hasScrim, className: styles$r["cw-dialog-main"], onMouseDown: handleScrimMouseDown, onMouseUp: handleScrimMouseUpOrLeave, onMouseLeave: handleScrimMouseUpOrLeave, "data-pressing": isPressingScrim, children: jsxs("dialog", { ...domProps, ref: dialogRef, style: {
|
|
1518
1581
|
left: `${position.x}px`,
|
|
1519
1582
|
top: `${position.y}px`,
|
|
1520
1583
|
width: displayDimensions.displayWidth,
|
|
@@ -1675,7 +1738,7 @@ function CwAlign(props) {
|
|
|
1675
1738
|
}, children: props.children }));
|
|
1676
1739
|
}
|
|
1677
1740
|
|
|
1678
|
-
var styles$
|
|
1741
|
+
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"};
|
|
1679
1742
|
|
|
1680
1743
|
/**
|
|
1681
1744
|
* CwCard - A simple card component for displaying content in a contained format
|
|
@@ -1701,11 +1764,11 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1701
1764
|
// Construct class names using CSS modules
|
|
1702
1765
|
const cardClassNames = [
|
|
1703
1766
|
'cw-card',
|
|
1704
|
-
styles$
|
|
1767
|
+
styles$q.card,
|
|
1705
1768
|
className,
|
|
1706
|
-
clickable ? styles$
|
|
1707
|
-
disabled ? styles$
|
|
1708
|
-
isLoading ? styles$
|
|
1769
|
+
clickable ? styles$q.clickable : '',
|
|
1770
|
+
disabled ? styles$q.disabled : '',
|
|
1771
|
+
isLoading ? styles$q.loading : '',
|
|
1709
1772
|
].filter(Boolean).join(' ');
|
|
1710
1773
|
// Handle click event when card is clickable
|
|
1711
1774
|
const handleClick = () => {
|
|
@@ -1722,15 +1785,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1722
1785
|
// Determine if footer should be rendered
|
|
1723
1786
|
const hasFooter = hasChips || footer || (hasActions && resolvedDirection === "row");
|
|
1724
1787
|
// Actions component to reuse
|
|
1725
|
-
const ActionsComponent = hasActions && !disabled ? (jsxs("div", { className: styles$
|
|
1788
|
+
const ActionsComponent = hasActions && !disabled ? (jsxs("div", { className: styles$q.actions, children: [extraActions ?? null, onEdit && jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) : null;
|
|
1726
1789
|
return (jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && {
|
|
1727
1790
|
role: 'button',
|
|
1728
1791
|
tabIndex: 0,
|
|
1729
1792
|
onClick: handleClick,
|
|
1730
|
-
}), "data-variant": variant, "data-direction": resolvedDirection, children: [hasHeader && (jsxs("header", { children: [(title || subtitle) && (jsxs("div", { className: styles$
|
|
1793
|
+
}), "data-variant": variant, "data-direction": resolvedDirection, children: [hasHeader && (jsxs("header", { children: [(title || subtitle) && (jsxs("div", { className: styles$q.headerContent, "data-align": resolvedAlign, children: [title && jsx("h5", { children: title }), subtitle && jsx("strong", { children: subtitle })] })), resolvedDirection === "column" && ActionsComponent] })), jsx("div", { className: styles$q.content, children: children }), hasFooter && (jsxs("footer", { children: [hasChips && (jsx("div", { className: styles$q.footerTags, children: chips.map((chip, index) => (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 && (jsx("div", { className: styles$q.footerContent, children: footer }))] })), resolvedDirection === "row" && ActionsComponent, isLoading && (jsx("div", { className: styles$q.loadingOverlay, children: jsx(CwLoading, { isLoading: isLoading, size: "small" }) }))] }));
|
|
1731
1794
|
};
|
|
1732
1795
|
|
|
1733
|
-
var styles$
|
|
1796
|
+
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"};
|
|
1734
1797
|
|
|
1735
1798
|
/**
|
|
1736
1799
|
* Option to display in the CwSelect
|
|
@@ -1825,10 +1888,10 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
|
|
|
1825
1888
|
icon: sortDirection === 'asc' ? 'arrow-up' : 'arrow-down',
|
|
1826
1889
|
onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'),
|
|
1827
1890
|
title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}`,
|
|
1828
|
-
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsx("div", { className: styles$
|
|
1891
|
+
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsx("div", { className: styles$p.loading, children: jsx(CwLoading, { isLoading: isLoading }) })) : sortedItems.length === 0 ? (jsx("div", { className: styles$p.emptyState, children: emptyState || jsx("p", { children: "No items to display" }) })) : (jsxs(Fragment, { children: [jsx("div", { className: `${styles$p.cardContainer}`, "data-layout": layout, style: gridStyle, children: visibleItems.map((item, index) => (jsx(React__default.Fragment, { children: renderCard(item, index) }, keyExtractor ? keyExtractor(item, index) : index))) }), totalPages > 1 && (jsxs("div", { className: styles$p.pagination, children: [jsx(CwButton, { variant: "icon", icon: "chevron-left", disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)) }), jsxs("span", { className: styles$p.pageInfo, children: [currentPage, " / ", totalPages] }), jsx(CwButton, { variant: "icon", icon: "chevron-right", disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)) })] }))] }))] }));
|
|
1829
1892
|
}
|
|
1830
1893
|
|
|
1831
|
-
var styles$
|
|
1894
|
+
var styles$o = {"cw-accordion":"cw-accordion-module__cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module__cw-accordion-body__xlI8b"};
|
|
1832
1895
|
|
|
1833
1896
|
/**
|
|
1834
1897
|
*
|
|
@@ -1845,7 +1908,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
1845
1908
|
setVisible_accordionBody(!isVisible_accordionBody);
|
|
1846
1909
|
};
|
|
1847
1910
|
// #endregion
|
|
1848
|
-
return (jsxs("div", { className: styles$
|
|
1911
|
+
return (jsxs("div", { className: styles$o["cw-accordion"], style: CwelltAccordionContainerProps.style, "data-open": isVisible_accordionBody, children: [jsxs("header", { onClick: () => showAccordionBody(), children: [jsx("div", { children: CwelltAccordionContainerProps.desc_text }), jsx("button", { className: "cw-button-icon" })] }), jsx("div", { className: styles$o["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
|
|
1849
1912
|
}
|
|
1850
1913
|
|
|
1851
1914
|
/**
|
|
@@ -2103,7 +2166,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2103
2166
|
}, min: 1, max: totalPages }), jsx("span", { children: "/" }), jsx("span", { children: totalPages }), jsx(CwButton, { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: currentPage === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2104
2167
|
}
|
|
2105
2168
|
|
|
2106
|
-
var styles$
|
|
2169
|
+
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"};
|
|
2107
2170
|
|
|
2108
2171
|
/**
|
|
2109
2172
|
* Hook that provides state management for CwSortableTable.
|
|
@@ -2166,9 +2229,9 @@ function useSortableTable(initialItems) {
|
|
|
2166
2229
|
}
|
|
2167
2230
|
|
|
2168
2231
|
// ─── Drop indicator row ───────────────────────────────────────────────────────
|
|
2169
|
-
const DropIndicatorRow = ({ colSpan }) => (jsx("tr", { className: styles$
|
|
2232
|
+
const DropIndicatorRow = ({ colSpan }) => (jsx("tr", { className: styles$n.dropIndicator, "aria-hidden": true, children: jsx("td", { colSpan: colSpan, children: jsx("div", {}) }) }));
|
|
2170
2233
|
// ─── Loading skeleton ─────────────────────────────────────────────────────────
|
|
2171
|
-
const LoadingRows = ({ colSpan }) => (jsx(Fragment, { children: Array.from({ length: 4 }).map((_, i) => (jsx("tr", { className: styles$
|
|
2234
|
+
const LoadingRows = ({ colSpan }) => (jsx(Fragment, { children: Array.from({ length: 4 }).map((_, i) => (jsx("tr", { className: styles$n.skeletonRow, children: jsx("td", { colSpan: colSpan, children: jsx("div", { className: styles$n.skeleton }) }) }, i))) }));
|
|
2172
2235
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
2173
2236
|
/**
|
|
2174
2237
|
* CwSortableTable
|
|
@@ -2255,11 +2318,11 @@ function CwSortableTable({ columns, data, rowKey = "key", onReorder, loading = f
|
|
|
2255
2318
|
return items.map((item, index) => {
|
|
2256
2319
|
const key = item[rowKey];
|
|
2257
2320
|
const isDragging = draggedItem?.[rowKey] === key;
|
|
2258
|
-
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && (jsx(DropIndicatorRow, { colSpan: totalCols })), jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$
|
|
2321
|
+
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && (jsx(DropIndicatorRow, { colSpan: totalCols })), jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$n.dragging : "", children: [showHandle && (jsx("td", { className: "cw-table-col-action", children: jsx(CwIcon, { iconId: "grip-dots", color: "neutral", style: { opacity: 0.75 } }) })), columns.map(col => (jsx("td", { className: col.className ?? "", style: col.width ? { width: col.width } : undefined, children: renderCell(item, col) }, `${String(key)}_${col.key}`)))] }), index === items.length - 1 && dropIndicatorIndex === items.length && (jsx(DropIndicatorRow, { colSpan: totalCols }))] }, String(key)));
|
|
2259
2322
|
});
|
|
2260
2323
|
};
|
|
2261
2324
|
// ── Render ──────────────────────────────────────────────────────────────
|
|
2262
|
-
return (jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, children: [jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { children: jsxs("tr", { children: [showHandle && jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsx("tbody", { children: renderBody() })] }), hasChanges && (jsxs("footer", { className: styles$
|
|
2325
|
+
return (jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, children: [jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { children: jsxs("tr", { children: [showHandle && jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsx("tbody", { children: renderBody() })] }), hasChanges && (jsxs("footer", { className: styles$n.saveBar, children: [jsx(CwButton, { variant: "outline", color: "neutral", icon: "undo", text: discardLabel, onClick: handleDiscard }), jsx(CwButton, { variant: "solid", color: "primary", icon: "save", text: saveLabel, onClick: () => handleSave(onReorder) })] }))] }));
|
|
2263
2326
|
}
|
|
2264
2327
|
|
|
2265
2328
|
/**
|
|
@@ -2458,7 +2521,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
2458
2521
|
}, min: 1, max: totalPages }), jsx("span", { children: "/" }), jsx("span", { children: totalPages }), jsx(CwButton, { onClick: () => handlePageChange(state.page + 1), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2459
2522
|
}
|
|
2460
2523
|
|
|
2461
|
-
var styles$
|
|
2524
|
+
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"};
|
|
2462
2525
|
|
|
2463
2526
|
const TabIcon = ({ icon }) => {
|
|
2464
2527
|
if (!icon)
|
|
@@ -2508,7 +2571,7 @@ function CwTabs(CwTabsProps) {
|
|
|
2508
2571
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
2509
2572
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
2510
2573
|
: undefined;
|
|
2511
|
-
return (jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$
|
|
2574
|
+
return (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: [jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, "data-tab-key": tab.key, children: [jsx(TabIcon, { icon: tab.icon }), tab.title, (tab.badge !== undefined || tab.badgeColor) && (jsx("span", { className: styles$m['badge'], style: tab.badgeColor ? { backgroundColor: tab.badgeColor, color: getContrastColor(tab.badgeColor) } : undefined, children: tab.badge }))] }, tab.key))) }), 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 })] }));
|
|
2512
2575
|
}
|
|
2513
2576
|
|
|
2514
2577
|
/**
|
|
@@ -2535,7 +2598,7 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
2535
2598
|
return (jsxs("details", { ref: myRef, ...detailsProps, className: "cw-expandable", children: [jsx("summary", { children: briefing }), children && jsx("section", { children: children })] }));
|
|
2536
2599
|
};
|
|
2537
2600
|
|
|
2538
|
-
var styles$
|
|
2601
|
+
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"};
|
|
2539
2602
|
|
|
2540
2603
|
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, }) => {
|
|
2541
2604
|
const [masterWidth, setMasterWidth] = useState(initialWidth);
|
|
@@ -2571,10 +2634,10 @@ const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, de
|
|
|
2571
2634
|
document.body.style.userSelect = '';
|
|
2572
2635
|
};
|
|
2573
2636
|
}, [isResizing, minMasterWidth, maxMasterWidth]);
|
|
2574
|
-
const rootClassName = [styles$
|
|
2575
|
-
return (jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, children: [jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsx("search", { children: jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsx("header", { children: masterHeader })), jsx("ul", { children: items.map((item) => (jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsx("footer", { children: masterFooter }))] }), resizable && (jsx("div", { className: styles$
|
|
2637
|
+
const rootClassName = [styles$l['cw-master-detail'], className].filter(Boolean).join(' ');
|
|
2638
|
+
return (jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, children: [jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsx("search", { children: jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsx("header", { children: masterHeader })), jsx("ul", { children: items.map((item) => (jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsx("footer", { children: masterFooter }))] }), resizable && (jsx("div", { className: styles$l.resizer, "data-resizing": isResizing, onMouseDown: handleMouseDown })), jsx("section", { className: styles$l.detail, children: selectedKey && detailContent
|
|
2576
2639
|
? detailContent
|
|
2577
|
-
: (jsx("div", { className: styles$
|
|
2640
|
+
: (jsx("div", { className: styles$l['detail-empty'], children: emptyDetail ?? 'Select an item to view details' })) })] }));
|
|
2578
2641
|
};
|
|
2579
2642
|
|
|
2580
2643
|
/**
|
|
@@ -2599,7 +2662,7 @@ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "
|
|
|
2599
2662
|
: emptyValue })] }, item.key))) }));
|
|
2600
2663
|
};
|
|
2601
2664
|
|
|
2602
|
-
var styles$
|
|
2665
|
+
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"};
|
|
2603
2666
|
|
|
2604
2667
|
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, maxHeight = "300px", }) {
|
|
2605
2668
|
const [draggedItem, setDraggedItem] = useState(null);
|
|
@@ -2662,15 +2725,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
|
|
|
2662
2725
|
}
|
|
2663
2726
|
};
|
|
2664
2727
|
if (items.length === 0) {
|
|
2665
|
-
return (jsx("div", { className: `${styles$
|
|
2728
|
+
return (jsx("div", { className: `${styles$k.sortableList} ${styles$k.emptyState} ${className}`, children: jsx("div", { className: styles$k.emptyMessage, children: emptyMessage }) }));
|
|
2666
2729
|
}
|
|
2667
|
-
return (jsx("div", { className: `${styles$
|
|
2730
|
+
return (jsx("div", { className: `${styles$k.sortableList} ${className}`, style: { maxHeight }, children: items.map((item, index) => {
|
|
2668
2731
|
const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
|
|
2669
2732
|
const isDragging = draggedItem?.id === item.id;
|
|
2670
2733
|
const isMoved = movedItems.has(item.id);
|
|
2671
2734
|
const canExpand = Boolean(expandedContent);
|
|
2672
2735
|
const isExpanded = expandedItems.has(item.id);
|
|
2673
|
-
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && jsx("div", { className: styles$
|
|
2736
|
+
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && jsx("div", { className: styles$k.dropIndicator }), 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: [jsxs("header", { children: [canExpand ? (jsx(CwButton, { variant: "icon", onClick: () => toggleExpanded(item.id), type: "button", title: isExpanded ? "Collapse" : "Expand", icon: isExpanded ? "chevron-up" : "chevron-down" })) : showHandle ? (jsx("div", { className: styles$k.sortableHandle, children: jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxs("div", { className: styles$k.sortableContent, children: [jsx("div", { className: styles$k.sortableTitle, children: title }), extraContent && jsx("div", { className: styles$k.sortableExtraContent, children: extraContent })] }), jsx("div", { className: styles$k.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsx("div", { className: styles$k.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsx("div", { className: styles$k.dropIndicator }))] }, item.id));
|
|
2674
2737
|
}) }));
|
|
2675
2738
|
}
|
|
2676
2739
|
|
|
@@ -2847,7 +2910,7 @@ function CwFileUpload(fileUploadProps) {
|
|
|
2847
2910
|
return (jsxs("div", { children: [jsxs("div", { className: "row", children: [jsx("input", { className: "cw-button", type: "file", accept: fileUploadProps.accept, readOnly: true, placeholder: "No file selected...", onChange: handleFileChange }), previewURL && (jsx("div", { className: "row", children: jsx("img", { src: previewURL, alt: "Preview", style: { maxWidth: "200px", maxHeight: "200px" } }) }))] }), error && jsx("div", { className: "row error", children: error }), jsx("div", { className: "row", children: jsxs("label", { children: ["Please note: File/image has to be in ", fileUploadProps.acceptString, " format", fileUploadProps.sizeString && `, ${fileUploadProps.sizeString}`] }) })] }));
|
|
2848
2911
|
}
|
|
2849
2912
|
|
|
2850
|
-
var styles$
|
|
2913
|
+
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"};
|
|
2851
2914
|
|
|
2852
2915
|
const DEFAULT_LABELS = {
|
|
2853
2916
|
uploadDisabled: 'Upload disabled',
|
|
@@ -3014,12 +3077,12 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3014
3077
|
}
|
|
3015
3078
|
}
|
|
3016
3079
|
};
|
|
3017
|
-
return (jsxs("div", { className: `${styles$
|
|
3080
|
+
return (jsxs("div", { className: `${styles$j.fileUploadContainer} ${fileUploadProps.className}`, children: [jsx("input", { ref: fileInputRef, type: "file", name: fileUploadProps.name, accept: fileUploadProps.accept, multiple: fileUploadProps.multiple, onChange: handleFileSelectInternal, disabled: fileUploadProps.disabled, "aria-label": "files", className: styles$j.hiddenInput }), selectedFiles.length === 0 && !existingFile ? (jsxs("div", { className: `${styles$j.uploadArea} ${fileUploadProps.disabled ? styles$j.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsx(CwIcon, { iconId: "upload" }), jsx("p", { className: `${styles$j.uploadTitle}`, children: fileUploadProps.disabled ? labels.uploadDisabled : labels.clickToUpload }), jsxs("p", { className: `${styles$j.uploadSubtitle}`, children: [fileUploadProps.accept ? labels.acceptedFiles(fileUploadProps.accept) : labels.allTypesAccepted, !fileUploadProps.multiple && ` ${labels.singleFileOnly}`] })] })) : selectedFiles.length === 0 && existingFile ? (jsxs("div", { className: styles$j.filesContainer, children: [jsxs("div", { className: styles$j.fileItem, children: [jsxs("div", { className: styles$j.fileIcon, children: [jsx(CwIcon, { iconId: "page" }), jsx("span", { className: styles$j.fileExtension, children: getFileExtension(existingFile) })] }), jsx("div", { className: styles$j.fileInfo, children: jsx("p", { className: styles$j.fileName, children: existingFile }) }), jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => {
|
|
3018
3081
|
setExistingFile(undefined);
|
|
3019
3082
|
if (fileUploadProps.onSelect) {
|
|
3020
3083
|
fileUploadProps.onSelect(null);
|
|
3021
3084
|
}
|
|
3022
|
-
}, disabled: fileUploadProps.disabled, className: styles$
|
|
3085
|
+
}, disabled: fileUploadProps.disabled, className: styles$j.smallButton })] }), jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled })] })) : (jsxs("div", { className: styles$j.filesContainer, children: [jsxs("div", { className: "cw-flex-row cw-align-between-center", children: [jsx("small", { className: styles$j.filesCount, children: labels.filesSelected(selectedFiles.length) }), !fileUploadProps.hideClearAll && (jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] }), selectedFiles.map((file, index) => (jsxs("div", { className: styles$j.fileItem, children: [jsxs("div", { className: styles$j.fileIcon, children: [jsx(CwIcon, { iconId: "page" }), jsx("span", { className: styles$j.fileExtension, children: getFileExtension(file.name) })] }), jsxs("div", { className: styles$j.fileInfo, children: [jsx("p", { className: styles$j.fileName, children: file.name }), jsxs("p", { className: styles$j.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$j.smallButton })] }, index))), fileUploadProps.multiple && (jsx(CwButton, { text: labels.addMoreFiles, icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
|
|
3023
3086
|
}
|
|
3024
3087
|
|
|
3025
3088
|
function CwInput(CwInputProps) {
|
|
@@ -3060,7 +3123,7 @@ function CwDigit(props) {
|
|
|
3060
3123
|
return (jsx("div", { className: "cw-input-text", children: jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("input", { type: "number", ...inputProps }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
3061
3124
|
}
|
|
3062
3125
|
|
|
3063
|
-
var styles$
|
|
3126
|
+
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"};
|
|
3064
3127
|
|
|
3065
3128
|
const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
|
|
3066
3129
|
const [rgb, setRgb] = useState({ r: 255, g: 255, b: 255 });
|
|
@@ -3263,13 +3326,13 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
|
|
|
3263
3326
|
// Calculate background color for the main area based on current hue
|
|
3264
3327
|
const hueColor = hsvToRgb(hsv.h, 100, 100);
|
|
3265
3328
|
const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
|
|
3266
|
-
return (jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsx("div", { className: styles$
|
|
3329
|
+
return (jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsx("div", { className: styles$i.colorPreview, style: { backgroundColor: hexColor, color: getContrastColor(hexColor) }, children: previewText }), jsx("button", { type: "button", className: "cw-button", onClick: toggleInputMode, style: { minWidth: "3ch" }, children: inputMode === 'hex' ? 'RGB' : 'HEX' })] }), jsx("div", { className: "color-inputs-row", children: inputMode === 'hex' ? (jsx("input", { type: "text", value: hexColor, onChange: handleHexChange })) : (jsxs("div", { className: "cw-grid-base-3 cw-gap-small", children: [jsxs("div", { children: [jsx("label", { children: "R:" }), jsx("input", { type: "number", name: "r", min: "0", max: "255", value: rgb.r, onChange: handleRgbChange })] }), jsxs("div", { children: [jsx("label", { children: "G:" }), jsx("input", { type: "number", name: "g", min: "0", max: "255", value: rgb.g, onChange: handleRgbChange })] }), jsxs("div", { children: [jsx("label", { children: "B:" }), jsx("input", { type: "number", name: "b", min: "0", max: "255", value: rgb.b, onChange: handleRgbChange })] })] })) }), jsxs("div", { className: styles$i.colorPickerInteractiveArea, children: [jsx("div", { className: styles$i.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsx("div", { className: styles$i.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxs("div", { className: styles$i.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxs("div", { className: styles$i.colorAreaOverlay, children: [jsx("div", { className: styles$i.hueBackground, style: { backgroundColor: hueHex } }), jsx("div", { className: styles$i.whiteGradient }), jsx("div", { className: styles$i.blackGradient })] }), jsx("div", { className: styles$i.colorAreaCursor, style: {
|
|
3267
3330
|
left: `${hsv.s}%`,
|
|
3268
3331
|
top: `${100 - hsv.v}%`
|
|
3269
3332
|
} })] })] })] }));
|
|
3270
3333
|
};
|
|
3271
3334
|
|
|
3272
|
-
var styles$
|
|
3335
|
+
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"};
|
|
3273
3336
|
|
|
3274
3337
|
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, readOnly = false, width = '4rem', height = '2rem', labelProps, layoutProps, }) => {
|
|
3275
3338
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -3402,11 +3465,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
3402
3465
|
break;
|
|
3403
3466
|
}
|
|
3404
3467
|
};
|
|
3405
|
-
return (jsxs("div", { className: `cw-input-color ${styles$
|
|
3468
|
+
return (jsxs("div", { className: `cw-input-color ${styles$h.container}`, "data-direction": layoutProps?.direction ?? "row", "data-align": layoutProps?.align, children: [labelProps && (jsx(CwLabel, { ...labelProps })), jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$h.selectColor} ${disabled ? styles$h.disabled : ''} ${readOnly ? styles$h.readOnly : ''}`, style: {
|
|
3406
3469
|
width,
|
|
3407
3470
|
height,
|
|
3408
3471
|
backgroundColor: value,
|
|
3409
|
-
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && createPortal(jsx("div", { ref: dropdownRef, className: styles$
|
|
3472
|
+
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && createPortal(jsx("div", { ref: dropdownRef, className: styles$h.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
|
|
3410
3473
|
};
|
|
3411
3474
|
|
|
3412
3475
|
/**
|
|
@@ -3656,7 +3719,7 @@ function CwInputDateText(props) {
|
|
|
3656
3719
|
return (jsx("div", { className: "cw-input-date-text", children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { children: [jsx("input", { type: "text", disabled: disabled, maxLength: 10, onChange: onChangeInputText, pattern: "^$ --|[.0-9\\/\\-]{10}", placeholder: format.toLowerCase(), readOnly: readOnly, ref: textInputRef, required: required, size: width, tabIndex: tabIndex, value: displayedDate }), jsxs("span", { children: [jsx(CwIcon, { iconId: "calendar" }), jsx("input", { type: "date", disabled: disabled, onChange: onChangeInputDate, readOnly: readOnly, ref: dateInputRef, tabIndex: -1, value: date, ...inputProps })] })] }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
3657
3720
|
}
|
|
3658
3721
|
|
|
3659
|
-
var styles$
|
|
3722
|
+
var styles$g = {"dropZone":"cw-input-image-module__dropZone__ygrGu"};
|
|
3660
3723
|
|
|
3661
3724
|
function CwInputImage(props) {
|
|
3662
3725
|
const [_uploadedImage, setUploadedImage] = useState(null);
|
|
@@ -3704,7 +3767,7 @@ function CwInputImage(props) {
|
|
|
3704
3767
|
const file = e.target.files?.[0];
|
|
3705
3768
|
handleFile(file ?? null);
|
|
3706
3769
|
};
|
|
3707
|
-
return (jsxs("div", { className: "cw-input-image", children: [jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, className: styles$
|
|
3770
|
+
return (jsxs("div", { className: "cw-input-image", children: [jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, className: styles$g.dropZone, children: [jsx("p", { children: "Drop image here" }), jsxs("small", { children: ["(", allowedFormats.join(", ").replace(/image\//g, ""), ")"] })] }), jsxs("div", { className: "cw-flex-row cw-align-center-center cw-gap-small", children: [jsx(CwButton, { onClick: onPasteButtonClick, icon: "paste", text: "Paste" }), jsx(CwButton, { onClick: () => inputRef.current?.click(), icon: "folder-open", text: "Browse" })] }), jsx("input", { ref: inputRef, type: "file", accept: allowedFormats.join(","), onChange: handleFileChange, style: { display: "none" }, ...inputProps })] }));
|
|
3708
3771
|
}
|
|
3709
3772
|
|
|
3710
3773
|
/**
|
|
@@ -3836,7 +3899,7 @@ const CwImageArea = forwardRef((props, ref) => {
|
|
|
3836
3899
|
});
|
|
3837
3900
|
CwImageArea.displayName = "CwImageArea";
|
|
3838
3901
|
|
|
3839
|
-
var styles$
|
|
3902
|
+
var styles$f = {"cw-weekday-selector":"cw-weekday-selector-module__cw-weekday-selector__Iz4GZ"};
|
|
3840
3903
|
|
|
3841
3904
|
/**
|
|
3842
3905
|
* This class represents a week where days can be selected or unselected
|
|
@@ -3976,15 +4039,16 @@ const CwWeekdaySelector = ({ value = "", onChange, disabled = false }) => {
|
|
|
3976
4039
|
setSelectedDays(newWeekdays);
|
|
3977
4040
|
onChange?.(newWeekdays.toString());
|
|
3978
4041
|
};
|
|
3979
|
-
return (jsx("div", { className: styles$
|
|
4042
|
+
return (jsx("div", { className: styles$f["cw-weekday-selector"], children: Weekdays.getFullWeek().map(day => (jsx("input", { type: "checkbox", "data-day": day, checked: selectedDays.toArray().includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }));
|
|
3980
4043
|
};
|
|
3981
4044
|
|
|
3982
|
-
var styles$
|
|
4045
|
+
var styles$e = {"check-container":"cw-check-module__check-container__4nscZ","group":"cw-check-module__group__6JCQo","options":"cw-check-module__options__-g9LF"};
|
|
3983
4046
|
|
|
3984
4047
|
function CwCheck(props) {
|
|
3985
|
-
const { labelProps, labelText,
|
|
3986
|
-
const
|
|
3987
|
-
|
|
4048
|
+
const { labelProps, labelText, direction, alignment, className, ...inputProps } = props;
|
|
4049
|
+
const resolvedDirection = direction ?? alignment ?? "row";
|
|
4050
|
+
const displayText = labelProps?.text ?? labelText;
|
|
4051
|
+
return (jsx("div", { className: `cw-check ${styles$e["check-container"]}${className ? ` ${className}` : ''}`, children: jsxs("label", { "data-direction": resolvedDirection, children: [jsx("input", { type: "checkbox", ...inputProps }), displayText && (jsx("span", { className: "cw-icon-text", children: displayText }))] }) }));
|
|
3988
4052
|
}
|
|
3989
4053
|
|
|
3990
4054
|
function CwCheckbox(CwCheckboxProps) {
|
|
@@ -4002,7 +4066,16 @@ function CwCheckbox(CwCheckboxProps) {
|
|
|
4002
4066
|
: "cw_checkboxContent cwellt_flex_row" + " " + CwCheckboxProps.classNameContainer, style: CwCheckboxProps.styleContainer, children: [inputElement, CwCheckboxProps.labelName ? (jsx("label", { htmlFor: CwCheckboxProps.id, className: CwCheckboxProps.labelClassName, children: CwCheckboxProps.labelName })) : null] }));
|
|
4003
4067
|
}
|
|
4004
4068
|
|
|
4005
|
-
|
|
4069
|
+
/**
|
|
4070
|
+
* CwCheckboxGroup - Multi-select group of native checkbox inputs.
|
|
4071
|
+
*
|
|
4072
|
+
* Use for selecting any number of values from a list of options. Layout follows the
|
|
4073
|
+
* CwKeyValueList / CwRadioGroup convention with two nested {@link CwLayoutProps} axes applied as
|
|
4074
|
+
* `data-*` attributes: `groupLayout` positions the label relative to the group block (root grid),
|
|
4075
|
+
* `itemLayout` controls how the checkboxes flow among themselves (options container) and, on the
|
|
4076
|
+
* opposite axis, each checkbox's own box-to-text layout.
|
|
4077
|
+
*/
|
|
4078
|
+
function CwCheckboxGroup({ options, value = [], onChange, labelProps, groupLayout, itemLayout, required, disabled, className, feedback, alignProps, optionsAlignment, "data-testid": dataTestId, }) {
|
|
4006
4079
|
const handleChange = (optionValue, checked) => {
|
|
4007
4080
|
if (checked) {
|
|
4008
4081
|
onChange([...value, optionValue]);
|
|
@@ -4014,15 +4087,57 @@ function CwCheckboxGroup({ options, value = [], onChange, labelProps, alignProps
|
|
|
4014
4087
|
const feedbackMessages = feedback
|
|
4015
4088
|
? Array.isArray(feedback) ? feedback : [feedback]
|
|
4016
4089
|
: [];
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4090
|
+
// Effective layout — precedence: new `groupLayout`/`itemLayout` > legacy-derived > default.
|
|
4091
|
+
// Legacy `alignProps.flexDirection` drove the label-vs-options axis (default "row" = label
|
|
4092
|
+
// beside the options); map it to `groupLayout.direction`.
|
|
4093
|
+
const groupDirection = groupLayout?.direction
|
|
4094
|
+
?? (alignProps?.flexDirection === "column" ? "column" : "row");
|
|
4095
|
+
// Legacy `optionsAlignment` is inverted relative to the options flow: "row" stacked the options
|
|
4096
|
+
// (column flow) with each check internally row; "column" laid them inline (row flow) with each
|
|
4097
|
+
// check internally column. Default reproduces the legacy `optionsAlignment="row"` case.
|
|
4098
|
+
const itemDirection = itemLayout?.direction
|
|
4099
|
+
?? (optionsAlignment === "column" ? "row" : "column");
|
|
4100
|
+
// Each checkbox's box-to-text layout is the opposite of the options flow, mirroring CwRadioGroup.
|
|
4101
|
+
const checkDirection = itemDirection === "row" ? "column" : "row";
|
|
4102
|
+
return (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 && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), 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) => (jsx(CwCheck, { labelProps: { text: option.label }, checked: value.includes(option.value), disabled: disabled || option.disabled, direction: checkDirection, onChange: (e) => handleChange(option.value, e.currentTarget.checked) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { className: "cw-input-info", "data-color": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
4103
|
+
}
|
|
4104
|
+
|
|
4105
|
+
var styles$d = {"radio":"cw-radio-module__radio__5sh7a","group":"cw-radio-module__group__br-HM","options":"cw-radio-module__options__LSw7M"};
|
|
4106
|
+
|
|
4107
|
+
/** Single native radio input. Building block for CwRadioGroup. */
|
|
4108
|
+
function CwRadio({ label, direction = "row", className, ...inputProps }) {
|
|
4109
|
+
return (jsxs("label", { className: `cw-radio ${styles$d.radio}${className ? ` ${className}` : ""}`, "data-direction": direction, children: [jsx("input", { type: "radio", ...inputProps }), label && jsx("span", { children: label })] }));
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
/**
|
|
4113
|
+
* CwRadioGroup - Single-select group of native radio inputs.
|
|
4114
|
+
*
|
|
4115
|
+
* Built on `<input type="radio">` sharing one `name`, so the browser provides radio-group
|
|
4116
|
+
* semantics (roving tabindex, arrow-key navigation) natively. Use for a single choice from a
|
|
4117
|
+
* list of options; for 2–3 options shown as a strip use CwButtonSwitch.
|
|
4118
|
+
*
|
|
4119
|
+
* Layout follows the CwKeyValueList convention with two nested {@link CwLayoutProps} axes
|
|
4120
|
+
* applied as `data-*` attributes: `groupLayout` positions the label relative to the radiogroup
|
|
4121
|
+
* block (root grid), `itemLayout` controls how the radios flow among themselves (options
|
|
4122
|
+
* container) and, on the opposite axis, each radio's own circle-to-text layout.
|
|
4123
|
+
*/
|
|
4124
|
+
function CwRadioGroup({ options, value, onChange, labelProps, groupLayout, itemLayout, required, disabled, className, feedback, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "data-testid": dataTestId, }) {
|
|
4125
|
+
const groupName = useId();
|
|
4126
|
+
const feedbackMessages = feedback
|
|
4127
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
4128
|
+
: [];
|
|
4129
|
+
// Each radio's circle-to-text layout is the opposite of the options flow: a stacked list
|
|
4130
|
+
// (itemLayout column) reads best with the circle beside the text; a side-by-side row reads
|
|
4131
|
+
// best with the circle above the text.
|
|
4132
|
+
const radioDirection = itemLayout?.direction === "row" ? "column" : "row";
|
|
4133
|
+
return (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 && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), 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) => (jsx(CwRadio, { name: groupName, label: option.label, direction: radioDirection, checked: value === option.value, required: required, disabled: disabled || option.disabled, onChange: () => onChange(option.value) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { className: "cw-input-info", "data-color": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
4020
4134
|
}
|
|
4021
4135
|
|
|
4022
4136
|
function CwToggle(props) {
|
|
4023
|
-
const { labelProps, labelText,
|
|
4024
|
-
const
|
|
4025
|
-
|
|
4137
|
+
const { labelProps, labelText, direction, alignment, className, style, ...inputProps } = props;
|
|
4138
|
+
const resolvedDirection = direction ?? alignment ?? "row";
|
|
4139
|
+
const displayText = labelProps?.text ?? labelText;
|
|
4140
|
+
return (jsx("div", { className: `cw-toggle ${className ? ` ${className}` : ''}`, style: style, children: jsxs("label", { className: "cw-toggle-label", "data-direction": resolvedDirection, children: [displayText && (jsx("span", { className: "cw-icon-text", children: displayText })), jsx("input", {
|
|
4026
4141
|
//data-color={color}
|
|
4027
4142
|
type: "checkbox", ...inputProps })] }) }));
|
|
4028
4143
|
}
|
|
@@ -4281,7 +4396,7 @@ function CwDropdownFilter(props) {
|
|
|
4281
4396
|
return (jsxs("div", { id: props.IdContent, className: containerClassName, children: [props.children, isVisible && (jsx("nav", { className: "cw-dropdown-menu", style: inlineStyles, onMouseLeave: props.onMouseLeave, id: props.idDropDownFilter, role: "menu", children: jsx("ul", { role: "none", children: props.DataSourceDropDownItem?.map((item) => (jsx("li", { id: item.IdDropDown_filter, role: "menuitem", children: item.dropDownFilter_desc }, item.IdDropDown_filter))) }) }))] }));
|
|
4282
4397
|
}
|
|
4283
4398
|
|
|
4284
|
-
var styles$
|
|
4399
|
+
var styles$c = {"container":"cw-popover-button-module__container__YSWQU","panel":"cw-popover-button-module__panel__C-BTn"};
|
|
4285
4400
|
|
|
4286
4401
|
/**
|
|
4287
4402
|
* Button that toggles a floating panel with arbitrary children.
|
|
@@ -4360,7 +4475,7 @@ function CwPopoverButton({ children, panelWidth = "auto", placement = "bottom-st
|
|
|
4360
4475
|
}
|
|
4361
4476
|
panel.showPopover();
|
|
4362
4477
|
}, [placement]);
|
|
4363
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
4478
|
+
return (jsxs("div", { ref: containerRef, className: styles$c.container, children: [jsx(CwButton, { ...buttonProps, onClick: handleClick }), jsx("div", { ref: panelCallbackRef, className: `${styles$c.panel}${panelClassName ? ` ${panelClassName}` : ""}`, style: { width: panelWidth }, children: children })] }));
|
|
4364
4479
|
}
|
|
4365
4480
|
|
|
4366
4481
|
function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor, onPrimaryColor) {
|
|
@@ -4378,13 +4493,13 @@ function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor
|
|
|
4378
4493
|
return result;
|
|
4379
4494
|
}
|
|
4380
4495
|
|
|
4381
|
-
var styles$
|
|
4496
|
+
var styles$b = {"cw-multifilter-tag":"cw-multi-filter-tag-module__cw-multifilter-tag__Epda-"};
|
|
4382
4497
|
|
|
4383
4498
|
const CwMultiFilterTag = props => {
|
|
4384
4499
|
const { ID, Name, Value, Category, Removable, PrimaryColor, Selectable, Selected } = props;
|
|
4385
4500
|
const backgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
|
|
4386
4501
|
const isOutlineMode = Selected && !Removable;
|
|
4387
|
-
return (jsx("li", { className: styles$
|
|
4502
|
+
return (jsx("li", { className: styles$b["cw-multifilter-tag"], id: ID, "data-value": Value, "data-category": Category, "data-selected": !!Selected, title: props.tooltip ?? Name, onClick: () => {
|
|
4388
4503
|
if (Selectable)
|
|
4389
4504
|
props.OnSelect?.(props);
|
|
4390
4505
|
}, children: jsx(CwChip, { label: Name, colorScheme: "custom", customColor: backgroundColor, variant: isOutlineMode ? "outline" : "soft", closable: Removable, onClose: () => props.OnRemove?.(props),
|
|
@@ -4394,7 +4509,7 @@ const CwMultiFilterTag = props => {
|
|
|
4394
4509
|
} : undefined }) }));
|
|
4395
4510
|
};
|
|
4396
4511
|
|
|
4397
|
-
var styles$
|
|
4512
|
+
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"};
|
|
4398
4513
|
|
|
4399
4514
|
/**
|
|
4400
4515
|
* A multiple filter selector, a MULTI-SELECT even. Allows users to select and filter items based on tags.
|
|
@@ -4621,9 +4736,9 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4621
4736
|
inputRef.current?.focus();
|
|
4622
4737
|
}
|
|
4623
4738
|
};
|
|
4624
|
-
return (jsxs("form", { ref: componentRef, id: id, className: `${styles$
|
|
4739
|
+
return (jsxs("form", { ref: componentRef, id: id, className: `${styles$a["cw-multi-filter"]}${className ? ` ${className}` : ""}`, style: style, onSubmit: (e) => {
|
|
4625
4740
|
e.preventDefault();
|
|
4626
|
-
}, children: [jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$
|
|
4741
|
+
}, children: [jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$a["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-color-outline-variant)" } : {}, children: [jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.currentTarget.value), autoComplete: "off", placeholder: selectedTags.size === 0 ? placeholder : "", onKeyDown: e => {
|
|
4627
4742
|
switch (e.key) {
|
|
4628
4743
|
case "Enter":
|
|
4629
4744
|
case "Tab": {
|
|
@@ -4650,7 +4765,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4650
4765
|
break;
|
|
4651
4766
|
}
|
|
4652
4767
|
}
|
|
4653
|
-
} })] }), selectedTags.size > 0 && (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(jsxs("section", { ref: panelRef, className: styles$
|
|
4768
|
+
} })] }), selectedTags.size > 0 && (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(jsxs("section", { ref: panelRef, className: styles$a["cw-multi-filter-catalog-container"], style: panelStyle, children: [jsxs("nav", { children: [jsx("button", { className: selectedCategory === "All" ? styles$a["category-selected"] : undefined, onClick: () => handleClickCategory("All"), children: allCategoriesLabel }), Array.from(categoriesMappedToTags().keys()).map(category => (jsx("button", { className: selectedCategory === category ? styles$a["category-selected"] : undefined, style: {
|
|
4654
4769
|
backgroundColor: getColor(category).primary,
|
|
4655
4770
|
color: getColor(category).onPrimary,
|
|
4656
4771
|
}, onClick: () => handleClickCategory(category), children: category }, category)))] }), jsx("ul", { children: displayTags
|
|
@@ -4676,7 +4791,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
4676
4791
|
} }, props.ID))) })] }))] }));
|
|
4677
4792
|
};
|
|
4678
4793
|
|
|
4679
|
-
var styles$
|
|
4794
|
+
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"};
|
|
4680
4795
|
|
|
4681
4796
|
/**
|
|
4682
4797
|
* Multi-select input with chip tags and searchable dropdown.
|
|
@@ -4811,11 +4926,11 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
4811
4926
|
// Keeping containerRef for any other potential use
|
|
4812
4927
|
const direction = alignProps?.flexDirection ?? "row";
|
|
4813
4928
|
const feedbackMessages = feedback ? (Array.isArray(feedback) ? feedback : [feedback]) : [];
|
|
4814
|
-
return (jsxs("div", { ref: containerRef, className: `${styles$
|
|
4815
|
-
inputRef.current?.focus(); }, children: [selectedOptions.map(opt => (jsx(CwChip, { label: opt.label, colorScheme: opt.color ? "custom" : "info", customColor: opt.color, closable: !disabled, onClose: () => handleRemove(opt.value) }, opt.value))), 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 && (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) => (jsx("p", { className: "cw-input-info", "data-color": fb.type, children: fb.message }, i))), renderPanel((showSelectAll || filtered.length > 0) ? (jsxs("div", { ref: panelRef, className: styles$
|
|
4929
|
+
return (jsxs("div", { ref: containerRef, className: `${styles$9.container}${className ? ` ${className}` : ""}`, style: style, id: id, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { className: `${styles$9.inputBox}${disabled ? ` ${styles$9.disabled}` : ""}`, ref: inputBoxRef, onClick: () => { if (!disabled)
|
|
4930
|
+
inputRef.current?.focus(); }, children: [selectedOptions.map(opt => (jsx(CwChip, { label: opt.label, colorScheme: opt.color ? "custom" : "info", customColor: opt.color, closable: !disabled, onClose: () => handleRemove(opt.value) }, opt.value))), 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 && (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) => (jsx("p", { className: "cw-input-info", "data-color": fb.type, children: fb.message }, i))), renderPanel((showSelectAll || filtered.length > 0) ? (jsxs("div", { ref: panelRef, className: styles$9.dropdown, style: panelStyle, children: [showSelectAll && !search && (jsxs("div", { className: styles$9.selectAll, onMouseDown: (e) => e.preventDefault(), onClick: handleToggleAll, children: [jsx("input", { type: "checkbox", checked: allSelected, readOnly: true, tabIndex: -1 }), allSelected ? "Deselect all" : "Select all"] })), jsx("ul", { ref: listRef, children: filtered.map((opt, idx) => (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 && jsx("span", { className: styles$9.optionDot, style: { backgroundColor: opt.color } }), opt.label] }, opt.value))) })] })) : null)] }));
|
|
4816
4931
|
}
|
|
4817
4932
|
|
|
4818
|
-
var styles$
|
|
4933
|
+
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"};
|
|
4819
4934
|
|
|
4820
4935
|
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null }) {
|
|
4821
4936
|
const [expanded, setExpanded] = useState(new Set());
|
|
@@ -4882,10 +4997,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4882
4997
|
const isLeaf = !hasChildren;
|
|
4883
4998
|
const isSelected = selectedId?.toString().toLowerCase() === node.id.toString().toLowerCase();
|
|
4884
4999
|
const selectable = allowParentSelection || isLeaf;
|
|
4885
|
-
return (jsxs("div", { className: styles$
|
|
4886
|
-
styles$
|
|
4887
|
-
isSelected && styles$
|
|
4888
|
-
!selectable && styles$
|
|
5000
|
+
return (jsxs("div", { className: styles$8["tree-item"], children: [jsxs("div", { className: [
|
|
5001
|
+
styles$8["tree-node"],
|
|
5002
|
+
isSelected && styles$8["selected"],
|
|
5003
|
+
!selectable && styles$8["non-selectable"]
|
|
4889
5004
|
].filter(Boolean).join(' '), style: { paddingLeft: `${depth * 24 + 8}px` }, onClick: () => {
|
|
4890
5005
|
if (selectable) {
|
|
4891
5006
|
setSelectedId(node.id);
|
|
@@ -4894,7 +5009,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4894
5009
|
else {
|
|
4895
5010
|
toggleExpand(node.id);
|
|
4896
5011
|
}
|
|
4897
|
-
}, children: [hasChildren && (jsx(CwIcon, { size: "large", iconId: isExpanded ? "chevron-down" : "chevron-right" })), jsx("div", { className: `${styles$
|
|
5012
|
+
}, children: [hasChildren && (jsx(CwIcon, { size: "large", iconId: isExpanded ? "chevron-down" : "chevron-right" })), jsx("div", { className: `${styles$8["tree-label"]} ${!hasChildren ? styles$8["tree-spacer"] : ''}`, children: node.label })] }), hasChildren && isExpanded && (jsx("div", { className: styles$8["tree-children"], children: node.children.map((child) => renderNode(child, depth + 1)) }))] }, node.id));
|
|
4898
5013
|
};
|
|
4899
5014
|
// Function to search for nodes that match the search term
|
|
4900
5015
|
const searchInTree = (nodes, searchTerm) => {
|
|
@@ -4918,7 +5033,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
4918
5033
|
return results;
|
|
4919
5034
|
};
|
|
4920
5035
|
const filteredData = searchInTree(data, search);
|
|
4921
|
-
return (jsxs("div", { className: `cw-tree-view ${styles$
|
|
5036
|
+
return (jsxs("div", { className: `cw-tree-view ${styles$8["tree-container"]}`, children: [jsxs("header", { children: [jsx("input", { type: "text", placeholder: "Search in tree...", value: search, onChange: (e) => setSearch(e.target.value) }), search && (jsx(CwButton, { onClick: () => setSearch(""), type: "button", icon: "close", variant: "icon", color: "neutral" }))] }), jsx("div", { className: styles$8["tree-wrapper"], children: filteredData.length > 0 ? (filteredData.map((node) => renderNode(node))) : (jsxs("div", { className: styles$8["empty-state"], children: [jsx(CwIcon, { iconId: "comment" }), search ? "No results found" : "There are no items"] })) })] }));
|
|
4922
5037
|
}
|
|
4923
5038
|
|
|
4924
5039
|
/**
|
|
@@ -5276,7 +5391,7 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5276
5391
|
}, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [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) && (jsx("div", { className: "cw-search-input-loading", children: jsx(CwIcon, { iconId: "spinner" }) })), jsx("div", { className: "cw-search-input-icons", children: inputValue && !disabled && !isInitialLoading ? (jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selection", variant: "icon", icon: "close", color: "neutral" })) : (icon ? jsx(CwIcon, { ...icon }) : jsx(CwIcon, { iconId: "search" })) })] })] }), renderPanel(jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsx("ul", { children: options.map((option, index) => (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 ? (jsxs("span", { className: "cw-search-async-option-lines", children: [jsx("span", { children: option.label }), jsx("span", { className: "cw-search-async-option-sub", children: option.subLabel })] })) : (option.label) }, option.id))) }) }))] }));
|
|
5277
5392
|
};
|
|
5278
5393
|
|
|
5279
|
-
var styles$
|
|
5394
|
+
var styles$7 = {"menu":"cw-context-menu-module__menu__tXmun","item":"cw-context-menu-module__item__-ko8L","arrow":"cw-context-menu-module__arrow__LHZmQ"};
|
|
5280
5395
|
|
|
5281
5396
|
const ARROW_SIZE = 8;
|
|
5282
5397
|
const SAFETY_MARGIN = 8;
|
|
@@ -5417,14 +5532,14 @@ const CwAnchoredMenu = ({ children, options, onSelect, placement = 'bottom', ope
|
|
|
5417
5532
|
document.removeEventListener("keydown", handleEscape);
|
|
5418
5533
|
};
|
|
5419
5534
|
}, [isOpen]);
|
|
5420
|
-
return (jsxs(Fragment, { children: [jsx("div", { ref: triggerRef, onContextMenu: handleContextMenu, style: { display: "contents" }, children: children }), isOpen && normalizedOptions.length > 0 && createPortal(jsxs("div", { ref: menuRef, className: styles$
|
|
5535
|
+
return (jsxs(Fragment, { children: [jsx("div", { ref: triggerRef, onContextMenu: handleContextMenu, style: { display: "contents" }, children: children }), isOpen && normalizedOptions.length > 0 && createPortal(jsxs("div", { ref: menuRef, className: styles$7["menu"], style: {
|
|
5421
5536
|
top: `${position.y}px`,
|
|
5422
5537
|
left: `${position.x}px`,
|
|
5423
|
-
}, "data-has-arrow": "true", children: [jsx("div", { ref: arrowRef, className: styles$
|
|
5538
|
+
}, "data-has-arrow": "true", children: [jsx("div", { ref: arrowRef, className: styles$7["arrow"], "data-placement": placement }), normalizedOptions.map(option => (jsxs("div", { onClick: (e) => {
|
|
5424
5539
|
e.stopPropagation();
|
|
5425
5540
|
e.preventDefault();
|
|
5426
5541
|
handleOptionClick(option);
|
|
5427
|
-
}, className: `${styles$
|
|
5542
|
+
}, className: `${styles$7["item"]} ${option.disabled ? styles$7["disabled"] : ""}`, "data-disabled": option.disabled, children: [option.icon && jsx("span", { className: styles$7["icon"], children: option.icon }), option.label] }, option.key)))] }), document.body)] }));
|
|
5428
5543
|
};
|
|
5429
5544
|
|
|
5430
5545
|
/**
|
|
@@ -5497,12 +5612,143 @@ const CwContextMenu = ({ children, options, offset = DEFAULT_OFFSET, onSelect })
|
|
|
5497
5612
|
document.removeEventListener("keydown", handleEscape);
|
|
5498
5613
|
};
|
|
5499
5614
|
}, [isOpen]);
|
|
5500
|
-
return (jsxs(Fragment, { children: [jsx("div", { onContextMenu: handleContextMenu, children: children }), isOpen && createPortal(jsx("div", { ref: menuRef, className: styles$
|
|
5615
|
+
return (jsxs(Fragment, { children: [jsx("div", { onContextMenu: handleContextMenu, children: children }), isOpen && createPortal(jsx("div", { ref: menuRef, className: styles$7["menu"], style: {
|
|
5501
5616
|
top: `${position.y}px`,
|
|
5502
5617
|
left: `${position.x}px`,
|
|
5503
|
-
}, children: options.map(option => (jsx("div", { onClick: () => handleOptionClick(option), className: styles$
|
|
5618
|
+
}, children: options.map(option => (jsx("div", { onClick: () => handleOptionClick(option), className: styles$7["item"], children: option }, option))) }), document.body)] }));
|
|
5504
5619
|
};
|
|
5505
5620
|
|
|
5621
|
+
var styles$6 = {"split":"cw-button-split-module__split__B2KbU","menu":"cw-button-split-module__menu__mKDlt","item":"cw-button-split-module__item__Aqw6f"};
|
|
5622
|
+
|
|
5623
|
+
/**
|
|
5624
|
+
* CwButtonSplit - A primary action joined to a dropdown of alternative actions.
|
|
5625
|
+
*
|
|
5626
|
+
* Composes a main {@link CwButton} with a {@link CwPopoverButton} chevron whose
|
|
5627
|
+
* panel holds a vertical menu of alternatives (rendered as `variant="ghost"` rows).
|
|
5628
|
+
* Both parts share variant, color and size and read as one joined control.
|
|
5629
|
+
*
|
|
5630
|
+
* @example
|
|
5631
|
+
* <CwButtonSplit
|
|
5632
|
+
* text="Save"
|
|
5633
|
+
* icon="save"
|
|
5634
|
+
* onClick={handleSave}
|
|
5635
|
+
* actions={[
|
|
5636
|
+
* { key: "saveAs", label: "Save as…", icon: "copy" },
|
|
5637
|
+
* { key: "saveAndClose", label: "Save and close" },
|
|
5638
|
+
* ]}
|
|
5639
|
+
* onSelect={handleSelect}
|
|
5640
|
+
* />
|
|
5641
|
+
*/
|
|
5642
|
+
function CwButtonSplit({ text, icon, onClick, actions, onSelect, variant = "solid", color = "primary", size = "medium", disabled = false, placement = "bottom-end", "data-testid": dataTestId, }) {
|
|
5643
|
+
const handleSelect = (action) => (event) => {
|
|
5644
|
+
onSelect(action.key);
|
|
5645
|
+
event.currentTarget.closest("[popover]")?.hidePopover();
|
|
5646
|
+
};
|
|
5647
|
+
return (jsxs("div", { className: styles$6.split, "data-variant": variant, "data-testid": dataTestId, children: [jsx(CwButton, { text: text, icon: icon, variant: variant, color: color, size: size, onClick: onClick, disabled: disabled }), jsx(CwPopoverButton, { icon: "chevron-down", title: "More actions", variant: variant, color: color, size: size, disabled: disabled, placement: placement, children: jsx("div", { className: styles$6.menu, children: actions.map((action) => (jsx(CwButton, { variant: "ghost", color: "neutral", text: action.label, icon: action.icon, disabled: action.disabled, className: styles$6.item, onClick: handleSelect(action) }, action.key))) }) })] }));
|
|
5648
|
+
}
|
|
5649
|
+
|
|
5650
|
+
/**
|
|
5651
|
+
* Roving-tabindex single-select behaviour for a custom radio group (e.g. a segmented
|
|
5652
|
+
* button strip that has no native grouping). The active segment is the selected one,
|
|
5653
|
+
* or the first enabled option when nothing is selected. Arrow keys (Right/Down = next,
|
|
5654
|
+
* Left/Up = previous) move focus and select, wrapping around and skipping disabled
|
|
5655
|
+
* options; Space/Enter selects the focused segment.
|
|
5656
|
+
*
|
|
5657
|
+
* Native form controls (e.g. `<input type="radio">` sharing a name) already get this
|
|
5658
|
+
* behaviour from the browser — use this hook only for non-native custom groups.
|
|
5659
|
+
*/
|
|
5660
|
+
function useRovingSingleSelect(options, value, onChange) {
|
|
5661
|
+
const elementRefs = useRef([]);
|
|
5662
|
+
const selectedIndex = options.findIndex((option) => option.value === value);
|
|
5663
|
+
const firstEnabledIndex = options.findIndex((option) => !option.disabled);
|
|
5664
|
+
// If the selected option is disabled it cannot hold the tab stop (disabled elements are out of
|
|
5665
|
+
// the tab order), so fall back to the first enabled option to keep the group reachable by Tab.
|
|
5666
|
+
const activeIndex = selectedIndex >= 0 && !options[selectedIndex]?.disabled ? selectedIndex : firstEnabledIndex;
|
|
5667
|
+
const focusAndSelect = useCallback((index) => {
|
|
5668
|
+
const option = options[index];
|
|
5669
|
+
if (!option || option.disabled)
|
|
5670
|
+
return;
|
|
5671
|
+
onChange(option.value);
|
|
5672
|
+
elementRefs.current[index]?.focus();
|
|
5673
|
+
}, [options, onChange]);
|
|
5674
|
+
const moveFocus = useCallback((fromIndex, direction) => {
|
|
5675
|
+
const count = options.length;
|
|
5676
|
+
if (count === 0)
|
|
5677
|
+
return;
|
|
5678
|
+
let nextIndex = fromIndex;
|
|
5679
|
+
for (let step = 0; step < count; step++) {
|
|
5680
|
+
nextIndex = (nextIndex + direction + count) % count;
|
|
5681
|
+
if (!options[nextIndex]?.disabled) {
|
|
5682
|
+
focusAndSelect(nextIndex);
|
|
5683
|
+
return;
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
5686
|
+
}, [options, focusAndSelect]);
|
|
5687
|
+
const getSegmentProps = useCallback((index) => ({
|
|
5688
|
+
tabIndex: index === activeIndex ? 0 : -1,
|
|
5689
|
+
ref: (element) => {
|
|
5690
|
+
elementRefs.current[index] = element;
|
|
5691
|
+
},
|
|
5692
|
+
onKeyDown: (event) => {
|
|
5693
|
+
switch (event.key) {
|
|
5694
|
+
case "ArrowRight":
|
|
5695
|
+
case "ArrowDown":
|
|
5696
|
+
event.preventDefault();
|
|
5697
|
+
moveFocus(index, 1);
|
|
5698
|
+
break;
|
|
5699
|
+
case "ArrowLeft":
|
|
5700
|
+
case "ArrowUp":
|
|
5701
|
+
event.preventDefault();
|
|
5702
|
+
moveFocus(index, -1);
|
|
5703
|
+
break;
|
|
5704
|
+
case " ":
|
|
5705
|
+
case "Enter":
|
|
5706
|
+
event.preventDefault();
|
|
5707
|
+
focusAndSelect(index);
|
|
5708
|
+
break;
|
|
5709
|
+
}
|
|
5710
|
+
},
|
|
5711
|
+
}), [activeIndex, moveFocus, focusAndSelect]);
|
|
5712
|
+
return { activeIndex, getSegmentProps };
|
|
5713
|
+
}
|
|
5714
|
+
|
|
5715
|
+
var styles$5 = {"switch":"cw-button-switch-module__switch__vdWV-","segment":"cw-button-switch-module__segment__JmVla","iconOnly":"cw-button-switch-module__iconOnly__-kCwj"};
|
|
5716
|
+
|
|
5717
|
+
/**
|
|
5718
|
+
* CwButtonSwitch - Segmented single-select control: a strip of joined CwButtons.
|
|
5719
|
+
*
|
|
5720
|
+
* The selected segment renders `solid`, the others `outline`, both sharing the `color`
|
|
5721
|
+
* theme (`primary` default, `danger`, or `neutral`). It is a proper ARIA radiogroup with
|
|
5722
|
+
* roving tabindex (one tab stop) and arrow-key navigation, provided by
|
|
5723
|
+
* {@link useRovingSingleSelect}. Use for 2–3 mutually-exclusive options that benefit from
|
|
5724
|
+
* being shown side by side; for a longer list use CwRadioGroup.
|
|
5725
|
+
*
|
|
5726
|
+
* `direction="column"` renders the strip vertically (stacked, full-width segments) instead of
|
|
5727
|
+
* the default horizontal `row`; arrow-key navigation handles both orientations.
|
|
5728
|
+
*
|
|
5729
|
+
* Set `iconOnly` to render just each option's icon; the option's `label` is still required
|
|
5730
|
+
* and is passed as the segment title, so it becomes the tooltip and the accessible name.
|
|
5731
|
+
*
|
|
5732
|
+
* It is an inline control with no form label — if a caption is needed, place it next to the
|
|
5733
|
+
* control at the call site, and pass `aria-label` (or `aria-labelledby`) to name the radiogroup
|
|
5734
|
+
* for screen readers.
|
|
5735
|
+
*
|
|
5736
|
+
* @example
|
|
5737
|
+
* <CwButtonSwitch
|
|
5738
|
+
* options={[{ value: "list", label: "List", icon: "list" }, { value: "grid", label: "Grid", icon: "grid" }]}
|
|
5739
|
+
* value={view}
|
|
5740
|
+
* onChange={setView}
|
|
5741
|
+
* />
|
|
5742
|
+
*/
|
|
5743
|
+
function CwButtonSwitch({ options, value, onChange, size = "medium", color = "primary", iconOnly = false, direction = "row", disabled = false, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "data-testid": dataTestId, }) {
|
|
5744
|
+
const { getSegmentProps } = useRovingSingleSelect(options, value, onChange);
|
|
5745
|
+
return (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) => {
|
|
5746
|
+
const selected = option.value === value;
|
|
5747
|
+
const segmentProps = getSegmentProps(index);
|
|
5748
|
+
return (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));
|
|
5749
|
+
}) }));
|
|
5750
|
+
}
|
|
5751
|
+
|
|
5506
5752
|
/**
|
|
5507
5753
|
* Save button wrapper (6 uses pending delete)
|
|
5508
5754
|
* @deprecated Use <CwButton variant="icon" icon="save" onClick={...} /> instead
|
|
@@ -8427,7 +8673,7 @@ crewAssignmentSchedulerContextMenu, }) => {
|
|
|
8427
8673
|
};
|
|
8428
8674
|
|
|
8429
8675
|
const TimeLine$1 = ({ id, toolTipTitle, marginLeft, color = "rgba(255,0,0,.6)", pixels = 2, height = "100%", zIndex = 1, }) => {
|
|
8430
|
-
return (jsx(
|
|
8676
|
+
return (jsx(CwTooltipNew, { content: toolTipTitle, position: "top", children: jsx("div", { id: id, style: {
|
|
8431
8677
|
borderLeft: `${pixels}px solid ${color}`,
|
|
8432
8678
|
marginLeft: marginLeft,
|
|
8433
8679
|
width: "0px",
|
|
@@ -11046,4 +11292,4 @@ const CwFindCrewmember = ({ handleChange, placeHolder = "Search crew…", requir
|
|
|
11046
11292
|
}, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: isInitialLoading ? "Loading…" : placeHolder, disabled: disabled, required: required, autoComplete: "off", "aria-expanded": showDropdown, "aria-haspopup": "listbox", role: "combobox", title: tooltipText }), (isLoading || isInitialLoading) && (jsx("div", { className: "cw-search-input-loading", children: jsx(CwIcon, { iconId: "spinner" }) })), jsx("div", { className: "cw-search-input-icons", children: inputValue && !disabled && !isInitialLoading ? (jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selected crewmember", variant: "icon", icon: "close", color: "neutral" })) : (jsx(CwIcon, { iconId: "person" })) })] })] }), renderPanel(jsx("div", { ref: panelRef, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsx("ul", { children: options.map((option, index) => (jsx("li", { className: `${dropdownStyles.option}${index === highlightedIndex ? ` ${dropdownStyles.optionFocused}` : ""}`, onClick: () => handleOptionSelect(option.value), onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: option.text }, option.value))) }) }))] }));
|
|
11047
11293
|
};
|
|
11048
11294
|
|
|
11049
|
-
export { CblDragAndDrop, CwAccordionContainer, CwAlign, CwAnchoredMenu, CwBtnApprove, CwBtnCancel, CwBtnDelete, CwBtnEdit, CwBtnSave, CwButton, CwCard, CwCardList, CwCheck, CwCheckbox, CwCheckboxGroup, CwChip, CwColorPicker, CwConfirmationPopup, CwContextMenu, CwDatePicker, CwDatePickerTemporal, CwDateRangePicker, CwDateRangePickerTemporal, CwDateTimePicker, CwDateTimePickerCompact, CwDateTimePickerTemporal, CwDialog, CwDigit, CwDisplayMessage, CwDropdown, CwDropdownFilter, CwExpandable, CwFileUpload, CwFileUploadMultiple, CwFindAirport, CwFindCrewmember, CwGenericTooltip, CwHeadingMain, CwHeadingSecond, CwIcon, CwImageArea, CwImageGallery, CwImageZoom, CwInput, CwInputColor, CwInputDateText, CwInputDatetime, CwInputImage, CwInputNumber, CwInputPhone, CwInputText, CwKeyValueList, CwLabel, CwLoading, CwLoadingSmall, CwMasterDetail, CwMessage, CwMessageManager, CwMessageType, CwModal, CwModalHover, CwModalReportFunctional, CwMultiFilter, CwMultiFilterTag, CwNote, CwOption, CwPopoverButton, CwReportModal, CwScheduler, CwSearchAsync, CwSearchInput, CwSelect, CwSelectList, CwSelectListItems, CwSortableList, CwSortableTable, CwSuperScheduler, CwTable, CwTableGrouped, CwTableServerSide, CwTabs, CwTagSelector, CwTextArea, CwTime, CwTimePicker, CwToggle, CwTooltipManager, CwTooltipNew, CwTreeView, CwWeekdaySelector, DefaultRowHeader, OnClearPinned, OnClickContextMenu, OnClickEvent, OnClickRowEvent, OnClickRowHeader, OnClickUtc, OnDoubleClickEvent, OnDoubleClickRowEvent, OnDragEvent, OnDropCtrlEvent, OnDropEvent, OnEndClickHeaderEvent, OnLeftDragStart, OnMultiClickEvent, OnPinRow, OnRangeClickEvent, OnRightClickEvent, OnRightClickRow, OnRightDragStart, OnStartClickHeaderEvent, OnUnpinRow, PRESET_LIBRARY_TEMPORAL, PinRowHeader, Resource, Scheduler, SchedulerEvent, SuperScheduler, TooltipConstraintContext, UiEvent, Weekdays, cblEvent, eventIsVisible, filterVisibleEvents, getDefaultDivisions, getEventSizes, getPresetsByKeysTemporal, itemsToMultiFilterTags, useCwMessage, useSortableList, useSortableTable, useTooltipConstraint };
|
|
11295
|
+
export { CblDragAndDrop, CwAccordionContainer, CwAlign, CwAnchoredMenu, CwBtnApprove, CwBtnCancel, CwBtnDelete, CwBtnEdit, CwBtnSave, CwButton, CwButtonSplit, CwButtonSwitch, CwCard, CwCardList, CwCheck, CwCheckbox, CwCheckboxGroup, CwChip, CwColorPicker, CwConfirmationPopup, CwContextMenu, CwDatePicker, CwDatePickerTemporal, CwDateRangePicker, CwDateRangePickerTemporal, CwDateTimePicker, CwDateTimePickerCompact, CwDateTimePickerTemporal, CwDialog, CwDigit, CwDisplayMessage, CwDropdown, CwDropdownFilter, CwExpandable, CwFileUpload, CwFileUploadMultiple, CwFindAirport, CwFindCrewmember, CwGenericTooltip, CwHeadingMain, CwHeadingSecond, CwIcon, CwImageArea, CwImageGallery, CwImageZoom, CwInput, CwInputColor, CwInputDateText, CwInputDatetime, CwInputImage, CwInputNumber, CwInputPhone, CwInputText, CwKeyValueList, CwLabel, CwLoading, CwLoadingSmall, CwMasterDetail, CwMessage, CwMessageManager, CwMessageType, CwModal, CwModalHover, CwModalReportFunctional, CwMultiFilter, CwMultiFilterTag, CwNote, CwOption, CwPopoverButton, CwRadioGroup, CwReportModal, CwScheduler, CwSearchAsync, CwSearchInput, CwSelect, CwSelectList, CwSelectListItems, CwSortableList, CwSortableTable, CwSuperScheduler, CwTable, CwTableGrouped, CwTableServerSide, CwTabs, CwTagSelector, CwTextArea, CwTime, CwTimePicker, CwToggle, CwTooltipManager, CwTooltipNew, CwTreeView, CwWeekdaySelector, DefaultRowHeader, OnClearPinned, OnClickContextMenu, OnClickEvent, OnClickRowEvent, OnClickRowHeader, OnClickUtc, OnDoubleClickEvent, OnDoubleClickRowEvent, OnDragEvent, OnDropCtrlEvent, OnDropEvent, OnEndClickHeaderEvent, OnLeftDragStart, OnMultiClickEvent, OnPinRow, OnRangeClickEvent, OnRightClickEvent, OnRightClickRow, OnRightDragStart, OnStartClickHeaderEvent, OnUnpinRow, PRESET_LIBRARY_TEMPORAL, PinRowHeader, Resource, Scheduler, SchedulerEvent, SuperScheduler, TooltipConstraintContext, UiEvent, Weekdays, cblEvent, eventIsVisible, filterVisibleEvents, getDefaultDivisions, getEventSizes, getPresetsByKeysTemporal, itemsToMultiFilterTags, useCwMessage, useSortableList, useSortableTable, useTooltipConstraint };
|