@cwellt_software/cwellt-reactjs-lib 1.6.1 → 1.6.2
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/deprecated/components/MultiSelect_deprecated_.d.ts +24 -0
- package/dist/deprecated/components/MultiSelect_deprecated_.d.ts.map +1 -0
- package/dist/deprecated/components/dropdown/CwDropdownContainer.d.ts +17 -0
- package/dist/deprecated/components/dropdown/CwDropdownContainer.d.ts.map +1 -0
- package/dist/deprecated/components/multiselect/CwHeadFilter.d.ts +17 -0
- package/dist/deprecated/components/multiselect/CwHeadFilter.d.ts.map +1 -0
- package/dist/deprecated/components/multiselect/CwMultiselect.d.ts +13 -0
- package/dist/deprecated/components/multiselect/CwMultiselect.d.ts.map +1 -0
- package/dist/deprecated/components/multiselect/CwOptionList.d.ts +14 -0
- package/dist/deprecated/components/multiselect/CwOptionList.d.ts.map +1 -0
- package/dist/deprecated/components/tag/CwTag.d.ts +15 -0
- package/dist/deprecated/components/tag/CwTag.d.ts.map +1 -0
- package/dist/index.cjs.js +236 -176
- package/dist/index.css +2 -2
- package/dist/index.d.ts +78 -35
- package/dist/index.es.js +236 -176
- package/dist/playground/main.d.ts +4 -0
- package/dist/playground/main.d.ts.map +1 -0
- package/dist/src/common/interfaces/CwDataAttributes.d.ts +5 -0
- package/dist/src/common/interfaces/CwDataAttributes.d.ts.map +1 -0
- package/dist/src/components/control/action/button/CwButtonBadge.d.ts +63 -0
- package/dist/src/components/control/action/button/CwButtonBadge.d.ts.map +1 -0
- package/dist/src/components/control/action/button/CwButtonSwitch.d.ts +3 -3
- package/dist/src/components/control/action/button/CwButtonSwitch.d.ts.map +1 -1
- package/dist/src/components/control/action/button/CwPopoverButton.d.ts +33 -0
- package/dist/src/components/control/action/button/CwPopoverButton.d.ts.map +1 -0
- package/dist/src/components/control/action/contextual-menu/CwContextualMenu.d.ts +29 -0
- package/dist/src/components/control/action/contextual-menu/CwContextualMenu.d.ts.map +1 -0
- package/dist/src/components/control/action/search/CwAsyncSearch.d.ts +102 -0
- package/dist/src/components/control/action/search/CwAsyncSearch.d.ts.map +1 -0
- package/dist/src/components/control/action/search/CwSearchAsync.d.ts +7 -1
- package/dist/src/components/control/action/search/CwSearchAsync.d.ts.map +1 -1
- package/dist/src/components/control/action/search/CwSearchAsync.stories.d.ts +28 -0
- package/dist/src/components/control/action/search/CwSearchAsync.stories.d.ts.map +1 -1
- package/dist/src/components/control/action/tooltip-dialog/CwTooltipDialog.d.ts +19 -0
- package/dist/src/components/control/action/tooltip-dialog/CwTooltipDialog.d.ts.map +1 -0
- package/dist/src/components/control/choice/deprecated/CwDropdown.d.ts +19 -0
- package/dist/src/components/control/choice/deprecated/CwDropdown.d.ts.map +1 -0
- package/dist/src/components/control/choice/deprecated/CwDropdownNavigation.d.ts +21 -0
- package/dist/src/components/control/choice/deprecated/CwDropdownNavigation.d.ts.map +1 -0
- package/dist/src/components/control/choice/deprecated/MultiSelect_deprecated_.d.ts +24 -0
- package/dist/src/components/control/choice/deprecated/MultiSelect_deprecated_.d.ts.map +1 -0
- package/dist/src/components/control/choice/dropdown/CwDropdown.d.ts +19 -0
- package/dist/src/components/control/choice/dropdown/CwDropdown.d.ts.map +1 -0
- package/dist/src/components/control/choice/dropdown/CwDropdownContainer.d.ts +17 -0
- package/dist/src/components/control/choice/dropdown/CwDropdownContainer.d.ts.map +1 -0
- package/dist/src/components/control/choice/dropdown/CwDropdownNavigation.d.ts +21 -0
- package/dist/src/components/control/choice/dropdown/CwDropdownNavigation.d.ts.map +1 -0
- package/dist/src/components/control/choice/multiselect/CwHeadFilter.d.ts +17 -0
- package/dist/src/components/control/choice/multiselect/CwHeadFilter.d.ts.map +1 -0
- package/dist/src/components/control/choice/multiselect/CwMultiselect.d.ts +13 -0
- package/dist/src/components/control/choice/multiselect/CwMultiselect.d.ts.map +1 -0
- package/dist/src/components/control/choice/multiselect/CwOptionList.d.ts +14 -0
- package/dist/src/components/control/choice/multiselect/CwOptionList.d.ts.map +1 -0
- package/dist/src/components/control/choice/tree-view/CwTreeView.d.ts +4 -4
- package/dist/src/components/control/choice/tree-view/CwTreeView.d.ts.map +1 -1
- package/dist/src/components/control/choice/tree-view/CwTreeView.stories.d.ts +5 -7
- package/dist/src/components/control/choice/tree-view/CwTreeView.stories.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts +3 -2
- package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDatePicker.stories.d.ts +5 -1
- package/dist/src/components/control/input/new-dates/CwDatePicker.stories.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDatePickerTemporal.d.ts +3 -2
- 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 +8 -2
- package/dist/src/components/control/input/new-dates/CwDateRangePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePicker.stories.d.ts +10 -12
- package/dist/src/components/control/input/new-dates/CwDateRangePicker.stories.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePickerTemporal.d.ts +8 -2
- 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 +8 -2
- package/dist/src/components/control/input/new-dates/CwDateTimePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePicker.stories.d.ts +12 -12
- package/dist/src/components/control/input/new-dates/CwDateTimePicker.stories.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePicker2.d.ts +47 -0
- package/dist/src/components/control/input/new-dates/CwDateTimePicker2.d.ts.map +1 -0
- package/dist/src/components/control/input/new-dates/CwDateTimePickerCompact.d.ts +8 -2
- 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 +8 -2
- 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 +8 -2
- package/dist/src/components/control/input/new-dates/CwTimePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwTimePicker.stories.d.ts +15 -13
- package/dist/src/components/control/input/new-dates/CwTimePicker.stories.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/datePickerHelpers.d.ts +10 -0
- package/dist/src/components/control/input/new-dates/datePickerHelpers.d.ts.map +1 -1
- package/dist/src/components/control/input/weekday/CwWeekdaySelector.d.ts +2 -1
- package/dist/src/components/control/input/weekday/CwWeekdaySelector.d.ts.map +1 -1
- package/dist/src/components/control/input/weekday/CwWeekdaySelector.stories.d.ts +3 -0
- package/dist/src/components/control/input/weekday/CwWeekdaySelector.stories.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts +2 -1
- package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/Scheduler.stories.d.ts +5 -1
- package/dist/src/components/custom/scheduler-new/presentation/Scheduler.stories.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-temporal/CwSchedulerComp2.d.ts +24 -0
- package/dist/src/components/custom/scheduler-temporal/CwSchedulerComp2.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/CwSuperSchedulerComp.d.ts +86 -0
- package/dist/src/components/custom/scheduler-temporal/CwSuperSchedulerComp.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/EventRender.d.ts +10 -0
- package/dist/src/components/custom/scheduler-temporal/components/EventRender.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/ResourceListRender.d.ts +20 -0
- package/dist/src/components/custom/scheduler-temporal/components/ResourceListRender.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/ResourceRender.d.ts +14 -0
- package/dist/src/components/custom/scheduler-temporal/components/ResourceRender.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/day_headers/DayHeader.d.ts +11 -0
- package/dist/src/components/custom/scheduler-temporal/components/day_headers/DayHeader.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/day_headers/MonthHeader.d.ts +11 -0
- package/dist/src/components/custom/scheduler-temporal/components/day_headers/MonthHeader.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/day_headers/MyDaysHeader.d.ts +13 -0
- package/dist/src/components/custom/scheduler-temporal/components/day_headers/MyDaysHeader.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/day_headers/WeekHeader.d.ts +11 -0
- package/dist/src/components/custom/scheduler-temporal/components/day_headers/WeekHeader.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/resources_title_list/ResourcesTitleList.d.ts +14 -0
- package/dist/src/components/custom/scheduler-temporal/components/resources_title_list/ResourcesTitleList.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/scheduler_content_area/SchedulerContentArea.d.ts +23 -0
- package/dist/src/components/custom/scheduler-temporal/components/scheduler_content_area/SchedulerContentArea.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/scheduler_header/SchedulerHeader.d.ts +8 -0
- package/dist/src/components/custom/scheduler-temporal/components/scheduler_header/SchedulerHeader.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/scheduler_timeline/SchedulerTimeLine.d.ts +12 -0
- package/dist/src/components/custom/scheduler-temporal/components/scheduler_timeline/SchedulerTimeLine.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/time_headers/TimeHeader.d.ts +12 -0
- package/dist/src/components/custom/scheduler-temporal/components/time_headers/TimeHeader.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/time_headers/TimeHeaderRow.d.ts +10 -0
- package/dist/src/components/custom/scheduler-temporal/components/time_headers/TimeHeaderRow.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/components/time_line/TimeLine.d.ts +12 -0
- package/dist/src/components/custom/scheduler-temporal/components/time_line/TimeLine.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/addMinutesToDateFromPx.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/addMinutesToDateFromPx.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDates.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDates.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/getFormatedTimeForHeader.d.ts +7 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/getFormatedTimeForHeader.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/getMonthHeaderData.d.ts +10 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/getMonthHeaderData.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/getUtcToday.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/getUtcToday.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/getWeekHeaderDataFromWeekRange.d.ts +7 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/getWeekHeaderDataFromWeekRange.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/listOfDatesToWeeks.d.ts +8 -0
- package/dist/src/components/custom/scheduler-temporal/logic/dates/listOfDatesToWeeks.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/divisions/calculateDivisionType.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/divisions/calculateDivisionType.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/divisions/calculateDivisions.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/divisions/calculateDivisions.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterAndProcessResources.d.ts +4 -0
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterAndProcessResources.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterEvents.d.ts +3 -0
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterEvents.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterResources.d.ts +3 -0
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterResources.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/hasSameProperties.d.ts +3 -0
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/hasSameProperties.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/onDrop/OnDrop.d.ts +13 -0
- package/dist/src/components/custom/scheduler-temporal/logic/onDrop/OnDrop.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/getHeightLineScheduler.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/getHeightLineScheduler.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/getPixelsForEvent.d.ts +7 -0
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/getPixelsForEvent.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/heightScheduler.d.ts +3 -0
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/heightScheduler.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/heightSchedulerPinned.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/heightSchedulerPinned.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/doubleClickOnResource.d.ts +4 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/doubleClickOnResource.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/handlePropChanges.d.ts +6 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/handlePropChanges.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/handleResourceChange.d.ts +5 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/handleResourceChange.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onDragOver.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onDragOver.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onDropEventToResource.d.ts +5 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onDropEventToResource.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onResizeEvent.d.ts +4 -0
- package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onResizeEvent.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/strings/compareStrings.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/strings/compareStrings.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/strings/getGUID.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/strings/getGUID.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/checkIfSlotAvailable.d.ts +3 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/checkIfSlotAvailable.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/getEventsOfResource.d.ts +6 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/getEventsOfResource.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/getHasPropsChanged.d.ts +4 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/getHasPropsChanged.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/getTimeHeaders.d.ts +2 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/getTimeHeaders.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/isAllowedToMove.d.ts +3 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/isAllowedToMove.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/shouldTriggerScroll.d.ts +4 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/shouldTriggerScroll.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/updateResourceVisibility.d.ts +3 -0
- package/dist/src/components/custom/scheduler-temporal/logic/ui/updateResourceVisibility.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/state/CblDragAndDrop.d.ts +11 -0
- package/dist/src/components/custom/scheduler-temporal/state/CblDragAndDrop.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/state/CwSchedulerProps.d.ts +43 -0
- package/dist/src/components/custom/scheduler-temporal/state/CwSchedulerProps.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/state/Resource.d.ts +14 -0
- package/dist/src/components/custom/scheduler-temporal/state/Resource.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/state/State.d.ts +25 -0
- package/dist/src/components/custom/scheduler-temporal/state/State.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/state/cblEvent.d.ts +18 -0
- package/dist/src/components/custom/scheduler-temporal/state/cblEvent.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/state/cblEventCompProps.d.ts +7 -0
- package/dist/src/components/custom/scheduler-temporal/state/cblEventCompProps.d.ts.map +1 -0
- package/dist/src/components/custom/scheduler-temporal/state/resourceCompProps2.d.ts +6 -0
- package/dist/src/components/custom/scheduler-temporal/state/resourceCompProps2.d.ts.map +1 -0
- package/dist/src/components/display/data/accordion/CwAccordionContainer.stories.d.ts +27 -0
- package/dist/src/components/display/data/accordion/CwAccordionContainer.stories.d.ts.map +1 -0
- package/dist/src/components/display/data/table/CwTable.stories.d.ts +2 -0
- package/dist/src/components/display/data/table/CwTable.stories.d.ts.map +1 -1
- package/dist/src/components/display/graphics/progress/CwProgress.d.ts +13 -8
- package/dist/src/components/display/graphics/progress/CwProgress.d.ts.map +1 -1
- package/dist/src/components/display/graphics/progress/CwProgress.stories.d.ts +21 -5
- package/dist/src/components/display/graphics/progress/CwProgress.stories.d.ts.map +1 -1
- package/dist/src/components/display/graphics/skeleton/CwSkeletonCard.d.ts +21 -0
- package/dist/src/components/display/graphics/skeleton/CwSkeletonCard.d.ts.map +1 -0
- package/dist/src/components/display/text/badge/CwBadge.d.ts +9 -1
- package/dist/src/components/display/text/badge/CwBadge.d.ts.map +1 -1
- package/dist/src/components/display/text/badge/CwBadge.stories.d.ts +5 -0
- package/dist/src/components/display/text/badge/CwBadge.stories.d.ts.map +1 -1
- package/dist/src/components/display/text/tag/CwTag.d.ts +15 -0
- package/dist/src/components/display/text/tag/CwTag.d.ts.map +1 -0
- package/dist/src/components/display/text/tooltip/CwTooltip.d.ts +11 -0
- package/dist/src/components/display/text/tooltip/CwTooltip.d.ts.map +1 -0
- package/dist/src/components/layout/align/CwAlign.stories.d.ts +439 -0
- package/dist/src/components/layout/align/CwAlign.stories.d.ts.map +1 -0
- package/dist/src/components/layout/modal/legacy/cw_modal_confirm.d.ts +16 -0
- package/dist/src/components/layout/modal/legacy/cw_modal_confirm.d.ts.map +1 -0
- package/dist/src/components/layout/modal/legacy/cw_modal_iframe.d.ts +21 -0
- package/dist/src/components/layout/modal/legacy/cw_modal_iframe.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/playground/pages/ShadowRecipesPage.d.ts +3 -0
- package/dist/src/playground/pages/ShadowRecipesPage.d.ts.map +1 -0
- package/dist/src/storybook/componentMappings.d.ts +5 -15
- package/dist/src/storybook/componentMappings.d.ts.map +1 -1
- package/dist/src/storybook/pickerStoryArgs.d.ts +2 -18
- package/dist/src/storybook/pickerStoryArgs.d.ts.map +1 -1
- package/dist/test/components/display/graphics/skeleton/CwSkeletonCard.test.d.ts +2 -0
- package/dist/test/components/display/graphics/skeleton/CwSkeletonCard.test.d.ts.map +1 -0
- package/dist/test/jest.setup.d.ts +2 -0
- package/dist/test/jest.setup.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/src/common/functions/lazy.d.ts +0 -13
- package/dist/src/common/functions/lazy.d.ts.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -174,7 +174,7 @@ function getContrastColor(color) {
|
|
|
174
174
|
return `hsl(${hsl.h}, ${contrastS}%, ${targetL}%)`;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
var styles$
|
|
177
|
+
var styles$A = {"cw-tooltip-content":"cw-tooltip-module__cw-tooltip-content__RZczd","cw-tooltip":"cw-tooltip-module__cw-tooltip__1KYig"};
|
|
178
178
|
|
|
179
179
|
// Constants
|
|
180
180
|
const margin$1 = 16;
|
|
@@ -464,7 +464,7 @@ const CwTooltipManager = () => {
|
|
|
464
464
|
if (!state.isVisible || !state.content) {
|
|
465
465
|
return null;
|
|
466
466
|
}
|
|
467
|
-
return createPortal(jsx("div", { ref: tooltipRef, className: styles$
|
|
467
|
+
return createPortal(jsx("div", { ref: tooltipRef, className: styles$A["cw-tooltip-content"], "data-position": actualPosition, "data-visible": state.isVisible, "data-inline": state.displayInline, style: {
|
|
468
468
|
top: `${tooltipPosition.top}px`,
|
|
469
469
|
left: `${tooltipPosition.left}px`,
|
|
470
470
|
opacity: (isPositioned && !isMeasuring) ? 1 : 0,
|
|
@@ -545,7 +545,7 @@ const CwTooltipNew = ({ children, content = null, position = "right", dissapears
|
|
|
545
545
|
useEffect(() => {
|
|
546
546
|
ensureTooltipManager();
|
|
547
547
|
}, []);
|
|
548
|
-
return (jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$
|
|
548
|
+
return (jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$A["cw-tooltip"], children: children }));
|
|
549
549
|
};
|
|
550
550
|
|
|
551
551
|
const SVG_ICONS = {
|
|
@@ -665,7 +665,7 @@ function resolveBadgeAria(label, loading, hasText) {
|
|
|
665
665
|
return hasText ? {} : { 'aria-hidden': 'true' };
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
-
var styles$
|
|
668
|
+
var styles$z = {"badge":"cw-badge-module__badge__PKlak"};
|
|
669
669
|
|
|
670
670
|
/**
|
|
671
671
|
* CwBadge - the small coloured circle with a number, used for alert and notification counts.
|
|
@@ -677,6 +677,13 @@ var styles$y = {"badge":"cw-badge-module__badge__PKlak"};
|
|
|
677
677
|
* Precedence: `loading` > `content` > `count` > dot. While loading the badge renders regardless
|
|
678
678
|
* of `showZero`, and the spinner replaces it - circle, background and padding come off.
|
|
679
679
|
*
|
|
680
|
+
* Overlaid on a `CwButton` (its `badge` prop), the corner offset is a public custom-property API,
|
|
681
|
+
* settable on the button, an ancestor, or the badge's own `style`:
|
|
682
|
+
* - `--badge-offset-x` - distance from the button's right edge (`right`). Default
|
|
683
|
+
* `calc(var(--cw-spacing-small) * -1)`.
|
|
684
|
+
* - `--badge-offset-y` - distance from the button's top edge (`top`). Default
|
|
685
|
+
* `calc(var(--cw-spacing-tiny) * -1)`, `-0.125rem` on a large icon button.
|
|
686
|
+
*
|
|
680
687
|
* @example
|
|
681
688
|
* <CwBadge count={3} color="danger" />
|
|
682
689
|
* <CwBadge count={0} showZero={false} />
|
|
@@ -684,7 +691,7 @@ var styles$y = {"badge":"cw-badge-module__badge__PKlak"};
|
|
|
684
691
|
* <CwBadge color="warning" label="Unresolved findings" />
|
|
685
692
|
* <CwBadge count={0} loading />
|
|
686
693
|
*/
|
|
687
|
-
const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'small', showZero = true, loading = false, max = 99, label, className = '', style, }) => {
|
|
694
|
+
const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'small', showZero = true, loading = false, max = 99, label, className = '', style, ...dataAttributes }) => {
|
|
688
695
|
// null counts as absent, so `content={null}` still renders a dot rather than an empty pill.
|
|
689
696
|
const hasContent = content !== undefined && content !== null;
|
|
690
697
|
if (!loading && !hasContent && count !== undefined && !showZero && normalizeBadgeCount(count) === 0) {
|
|
@@ -694,8 +701,8 @@ const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'sm
|
|
|
694
701
|
? formatBadgeCount(count, max)
|
|
695
702
|
: undefined;
|
|
696
703
|
const isDot = !loading && !hasContent && count === undefined;
|
|
697
|
-
const badgeClassNames = ['cw-badge', styles$
|
|
698
|
-
return (jsx("span", { className: badgeClassNames, "data-color": color, "data-variant": variant, "data-size": size, "data-loading": loading ? 'true' : undefined, "data-dot": isDot ? 'true' : undefined, ...resolveBadgeAria(label, loading, !loading && (hasContent || countText !== undefined)), style: style, children: loading ? jsx(CwIcon, { iconId: "spinner", size: "small" }) : hasContent ? content : countText }));
|
|
704
|
+
const badgeClassNames = ['cw-badge', styles$z.badge, className].filter(Boolean).join(' ');
|
|
705
|
+
return (jsx("span", { ...dataAttributes, className: badgeClassNames, "data-color": color, "data-variant": variant, "data-size": size, "data-loading": loading ? 'true' : undefined, "data-dot": isDot ? 'true' : undefined, ...resolveBadgeAria(label, loading, !loading && (hasContent || countText !== undefined)), style: style, children: loading ? jsx(CwIcon, { iconId: "spinner", size: "small" }) : hasContent ? content : countText }));
|
|
699
706
|
};
|
|
700
707
|
|
|
701
708
|
const CW_DEFAULT_MESSAGE_DURATION = 2000;
|
|
@@ -1082,7 +1089,7 @@ function CwLoading({ isLoading = false, text = '', size = 'regular', iconPositio
|
|
|
1082
1089
|
return (jsxs("div", { "aria-busy": isLoading, className: "cw-loading-container", "data-children": !!children, children: [overlay, jsx("div", { className: "cw-loading-disabled-content", children: children })] }));
|
|
1083
1090
|
}
|
|
1084
1091
|
|
|
1085
|
-
var styles$
|
|
1092
|
+
var styles$y = {"skeleton":"cw-skeleton-module__skeleton__Jvx2x","group":"cw-skeleton-module__group__Cm8AU"};
|
|
1086
1093
|
|
|
1087
1094
|
/*
|
|
1088
1095
|
* Internal helper for skeleton allocations (CwSkeleton, tables, cards).
|
|
@@ -1124,8 +1131,8 @@ function CwSkeleton({ variant = 'text', width, height, count = 1, radius, gap })
|
|
|
1124
1131
|
};
|
|
1125
1132
|
// The un-hashed cw-skeleton / cw-skeleton-group classes carry no styles in the
|
|
1126
1133
|
// library - they are stable public hooks for exceptional external overrides.
|
|
1127
|
-
const skeletonClassName = ['cw-skeleton', styles$
|
|
1128
|
-
const groupClassName = ['cw-skeleton-group', styles$
|
|
1134
|
+
const skeletonClassName = ['cw-skeleton', styles$y.skeleton].filter(Boolean).join(' ');
|
|
1135
|
+
const groupClassName = ['cw-skeleton-group', styles$y.group].filter(Boolean).join(' ');
|
|
1129
1136
|
const lineCount = normalizeSkeletonCount(count, 1);
|
|
1130
1137
|
if (lineCount <= 1) {
|
|
1131
1138
|
return (jsx("span", { className: skeletonClassName, "data-variant": variant, "aria-hidden": "true", style: style }));
|
|
@@ -1137,7 +1144,7 @@ function CwSkeleton({ variant = 'text', width, height, count = 1, radius, gap })
|
|
|
1137
1144
|
return (jsx("span", { className: groupClassName, "aria-hidden": "true", style: groupStyle, children: skeletonElements }));
|
|
1138
1145
|
}
|
|
1139
1146
|
|
|
1140
|
-
var styles$
|
|
1147
|
+
var styles$x = {"progress":"cw-progress-module__progress__d-g2-","value":"cw-progress-module__value__Q-DrH","label":"cw-progress-module__label__jwOWp","track":"cw-progress-module__track__572-3","footer":"cw-progress-module__footer__0Wo4G","header":"cw-progress-module__header__mv5ct","fill":"cw-progress-module__fill__fX1UA"};
|
|
1141
1148
|
|
|
1142
1149
|
/**
|
|
1143
1150
|
* CwProgress - a determinate or indeterminate progress bar.
|
|
@@ -1149,7 +1156,7 @@ var styles$w = {"progress":"cw-progress-module__progress__d-g2-","value":"cw-pro
|
|
|
1149
1156
|
* <CwProgress value={62} label="Import" color="success" />
|
|
1150
1157
|
* <CwProgress indeterminate label="Uploading" />
|
|
1151
1158
|
*/
|
|
1152
|
-
function CwProgress({ value, indeterminate = false, label, rightLabel, size = 'regular', layout = 'row', color = 'primary', monoValue = false, prominent = false, className }) {
|
|
1159
|
+
function CwProgress({ value, indeterminate = false, label, rightLabel, footer, size = 'regular', layout = 'row', color = 'primary', monoValue = false, prominent = false, className, style, ...dataAttributes }) {
|
|
1153
1160
|
const labelId = React__default.useId();
|
|
1154
1161
|
// Determinate: a missing or non-finite value is treated as 0 (never NaN), then
|
|
1155
1162
|
// clamped to [0,100] for aria-valuenow and the fill width. Indeterminate has no value.
|
|
@@ -1157,21 +1164,21 @@ function CwProgress({ value, indeterminate = false, label, rightLabel, size = 'r
|
|
|
1157
1164
|
? undefined
|
|
1158
1165
|
: Math.min(Math.max(Number.isFinite(value) ? value : 0, 0), 100);
|
|
1159
1166
|
const percent = clamped !== undefined ? Math.round(clamped) : undefined;
|
|
1160
|
-
const showValue = rightLabel
|
|
1161
|
-
const
|
|
1167
|
+
const showValue = rightLabel != null || (!indeterminate && percent !== undefined);
|
|
1168
|
+
const valueContent = rightLabel ?? (percent !== undefined ? `${percent}%` : '');
|
|
1162
1169
|
// The un-hashed cw-progress class carries no styles in the library - a stable
|
|
1163
1170
|
// public hook for exceptional external overrides only.
|
|
1164
|
-
const rootClassName = ['cw-progress', styles$
|
|
1165
|
-
const labelSpan = label ? jsx("span", { className: styles$
|
|
1166
|
-
const valueLabel = showValue ? (jsx("span", { className: styles$
|
|
1167
|
-
return (jsxs("div", { className: rootClassName, "data-layout": layout, "data-size": size, "data-color": color, "data-prominent": prominent || undefined, "data-indeterminate": indeterminate || undefined, children: [layout === 'column' && (labelSpan || valueLabel) && (jsxs("header", { className: styles$
|
|
1171
|
+
const rootClassName = ['cw-progress', styles$x.progress, className].filter(Boolean).join(' ');
|
|
1172
|
+
const labelSpan = label ? jsx("span", { className: styles$x.label, id: labelId, children: label }) : null;
|
|
1173
|
+
const valueLabel = showValue ? (jsx("span", { className: styles$x.value, "data-mono": monoValue || undefined, children: valueContent })) : null;
|
|
1174
|
+
return (jsxs("div", { ...dataAttributes, className: rootClassName, style: style, "data-layout": layout, "data-size": size, "data-color": color, "data-prominent": prominent || undefined, "data-indeterminate": indeterminate || undefined, children: [layout === 'column' && (labelSpan || valueLabel) && (jsxs("header", { className: styles$x.header, children: [labelSpan, valueLabel] })), layout === 'row' && labelSpan, jsx("div", { className: styles$x.track, role: "progressbar", ...(label && { 'aria-labelledby': labelId }), ...(!indeterminate && percent !== undefined && {
|
|
1168
1175
|
'aria-valuenow': percent,
|
|
1169
1176
|
'aria-valuemin': 0,
|
|
1170
1177
|
'aria-valuemax': 100
|
|
1171
|
-
}), children: jsx("div", { className: styles$
|
|
1178
|
+
}), children: jsx("div", { className: styles$x.fill, style: !indeterminate && clamped !== undefined ? { width: `${clamped}%` } : undefined }) }), layout === 'row' && valueLabel, footer != null && jsx("footer", { className: styles$x.footer, children: footer })] }));
|
|
1172
1179
|
}
|
|
1173
1180
|
|
|
1174
|
-
var styles$
|
|
1181
|
+
var styles$w = {"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"};
|
|
1175
1182
|
|
|
1176
1183
|
// Constants moved outside to prevent recreation
|
|
1177
1184
|
const margin = 16;
|
|
@@ -1298,12 +1305,12 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1298
1305
|
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
|
|
1299
1306
|
setIsVisible(true);
|
|
1300
1307
|
}, showDelay);
|
|
1301
|
-
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$
|
|
1308
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$w["cw-generic-tooltip-content"]);
|
|
1302
1309
|
// Memoize tooltip content creation
|
|
1303
1310
|
const tooltipContent = useMemo(() => {
|
|
1304
1311
|
if (hide || !isVisible || !content)
|
|
1305
1312
|
return null;
|
|
1306
|
-
return createPortal(jsx("div", { className: styles$
|
|
1313
|
+
return createPortal(jsx("div", { className: styles$w["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, "data-inline": displayInline, style: {
|
|
1307
1314
|
position: 'fixed',
|
|
1308
1315
|
top: `${tooltipPosition.top}px`,
|
|
1309
1316
|
left: `${tooltipPosition.left}px`,
|
|
@@ -1318,7 +1325,7 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1318
1325
|
clearTooltipTimeout();
|
|
1319
1326
|
setIsVisible(false);
|
|
1320
1327
|
}, [clearTooltipTimeout]);
|
|
1321
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
1328
|
+
return (jsxs("div", { ref: containerRef, className: styles$w["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, children: [tooltipContent, children] }));
|
|
1322
1329
|
};
|
|
1323
1330
|
|
|
1324
1331
|
const CwButton = React__default.forwardRef(function CwButton({ text, variant = 'solid', color = 'primary', size = 'medium', iconPosition = 'left', pressed, className = '', icon = "", title, tooltipPosition = "bottom", badge, children, ...buttonProps }, ref) {
|
|
@@ -1386,7 +1393,7 @@ function CwModal(custModalProps) {
|
|
|
1386
1393
|
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" } }))] }) })] })) }));
|
|
1387
1394
|
}
|
|
1388
1395
|
|
|
1389
|
-
var styles$
|
|
1396
|
+
var styles$v = {"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"};
|
|
1390
1397
|
|
|
1391
1398
|
/**
|
|
1392
1399
|
* Small anchored confirmation for a destructive action.
|
|
@@ -1455,15 +1462,15 @@ function CwConfirmationPopup(props) {
|
|
|
1455
1462
|
onCancel();
|
|
1456
1463
|
}
|
|
1457
1464
|
};
|
|
1458
|
-
return (jsxs(Fragment, { children: [renderChildren(), isOpen && (jsx("div", { className: styles$
|
|
1465
|
+
return (jsxs(Fragment, { children: [renderChildren(), isOpen && (jsx("div", { className: styles$v.overlayPositioned, onClick: handleOverlayClick, children: jsxs("div", { ref: popupRef, className: styles$v.popup, style: {
|
|
1459
1466
|
position: 'absolute',
|
|
1460
1467
|
top: `${position.top}px`,
|
|
1461
1468
|
left: `${position.left}px`,
|
|
1462
1469
|
transform: 'none'
|
|
1463
|
-
}, children: [jsx("p", { className: styles$
|
|
1470
|
+
}, children: [jsx("p", { className: styles$v.message, children: message }), jsxs("div", { className: styles$v.buttons, children: [jsx("button", { className: `${styles$v.button} ${styles$v.confirmButton}`, onClick: onConfirm, children: confirmText }), jsx("button", { className: `${styles$v.button} ${styles$v.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
|
|
1464
1471
|
}
|
|
1465
1472
|
|
|
1466
|
-
var styles$
|
|
1473
|
+
var styles$u = {"cw-dialog-main":"cw-dialog-module__cw-dialog-main__cHxHt","cw-dialog-button-close":"cw-dialog-module__cw-dialog-button-close__9GRd8"};
|
|
1467
1474
|
|
|
1468
1475
|
// Helper function to parse size values
|
|
1469
1476
|
const parseSize = (size) => {
|
|
@@ -1736,7 +1743,7 @@ const CwDialog = props => {
|
|
|
1736
1743
|
}
|
|
1737
1744
|
}
|
|
1738
1745
|
}, [open]);
|
|
1739
|
-
const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$
|
|
1746
|
+
const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$u["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
|
|
1740
1747
|
const content = useMemo(() => (jsx("section", { children: children })), [children]);
|
|
1741
1748
|
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]);
|
|
1742
1749
|
const resizeHandles = useMemo(() => size.autoHeight
|
|
@@ -1763,7 +1770,7 @@ const CwDialog = props => {
|
|
|
1763
1770
|
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
1764
1771
|
return { displayWidth, displayHeight };
|
|
1765
1772
|
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
1766
|
-
const dialogContent = (jsx("div", { "data-has-scrim": hasScrim, className: styles$
|
|
1773
|
+
const dialogContent = (jsx("div", { "data-has-scrim": hasScrim, className: styles$u["cw-dialog-main"], onMouseDown: handleScrimMouseDown, onMouseUp: handleScrimMouseUpOrLeave, onMouseLeave: handleScrimMouseUpOrLeave, "data-pressing": isPressingScrim, children: jsxs("dialog", { ...domProps, ref: dialogRef, style: {
|
|
1767
1774
|
left: `${position.x}px`,
|
|
1768
1775
|
top: `${position.y}px`,
|
|
1769
1776
|
width: displayDimensions.displayWidth,
|
|
@@ -1925,7 +1932,7 @@ function CwAlign(props) {
|
|
|
1925
1932
|
}, children: props.children }));
|
|
1926
1933
|
}
|
|
1927
1934
|
|
|
1928
|
-
var styles$
|
|
1935
|
+
var styles$t = {"card":"cw-card-module__card__HJUT0","clickable":"cw-card-module__clickable__Y-V3X","disabled":"cw-card-module__disabled__0wHh1","content":"cw-card-module__content__ma9qy","headerContent":"cw-card-module__headerContent__x4Jfl","footerTags":"cw-card-module__footerTags__80sSW"};
|
|
1929
1936
|
|
|
1930
1937
|
/**
|
|
1931
1938
|
* CwCard - A simple card component for displaying content in a contained format
|
|
@@ -1951,10 +1958,10 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1951
1958
|
// Construct class names using CSS modules
|
|
1952
1959
|
const cardClassNames = [
|
|
1953
1960
|
'cw-card',
|
|
1954
|
-
styles$
|
|
1961
|
+
styles$t.card,
|
|
1955
1962
|
className,
|
|
1956
|
-
clickable ? styles$
|
|
1957
|
-
disabled ? styles$
|
|
1963
|
+
clickable ? styles$t.clickable : '',
|
|
1964
|
+
disabled ? styles$t.disabled : '',
|
|
1958
1965
|
].filter(Boolean).join(' ');
|
|
1959
1966
|
// Handle click event when card is clickable
|
|
1960
1967
|
const handleClick = () => {
|
|
@@ -1972,15 +1979,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1972
1979
|
const hasFooter = hasChips || footer || (hasActions && resolvedDirection === "row");
|
|
1973
1980
|
// Actions component to reuse. While loading, each provided action renders a circular
|
|
1974
1981
|
// ghost sized to the CwButton icon footprint (2rem) - no interactive buttons.
|
|
1975
|
-
const ActionsComponent = hasActions && !disabled ? (jsx("div", { className: styles$
|
|
1982
|
+
const ActionsComponent = hasActions && !disabled ? (jsx("div", { className: styles$t.actions, children: isLoading ? (jsxs(Fragment, { children: [extraActions && jsx(CwSkeleton, { variant: "circle", height: "2rem" }), onEdit && jsx(CwSkeleton, { variant: "circle", height: "2rem" }), onDelete && jsx(CwSkeleton, { variant: "circle", height: "2rem" })] })) : (jsxs(Fragment, { children: [extraActions ?? null, onEdit && jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) })) : null;
|
|
1976
1983
|
return (jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && !isLoading && {
|
|
1977
1984
|
role: 'button',
|
|
1978
1985
|
tabIndex: 0,
|
|
1979
1986
|
onClick: handleClick,
|
|
1980
|
-
}), "data-variant": variant, "data-direction": resolvedDirection, "aria-busy": isLoading || undefined, children: [isLoading ? (jsxs("header", { children: [jsx("div", { className: styles$
|
|
1987
|
+
}), "data-variant": variant, "data-direction": resolvedDirection, "aria-busy": isLoading || undefined, children: [isLoading ? (jsxs("header", { children: [jsx("div", { className: styles$t.headerContent, "data-align": resolvedAlign, children: jsx(CwSkeleton, { width: "8rem", height: "1.5em" }) }), resolvedDirection === "column" && ActionsComponent] })) : (hasHeader && (jsxs("header", { children: [(title || subtitle) && (jsxs("div", { className: styles$t.headerContent, "data-align": resolvedAlign, children: [title && jsx("h5", { children: title }), subtitle && jsx("strong", { children: subtitle })] })), resolvedDirection === "column" && ActionsComponent] }))), jsx("div", { className: styles$t.content, children: isLoading ? jsx(CwSkeleton, { count: normalizeSkeletonCount(skeletonLines, 3) }) : children }), hasFooter && (isLoading ? (jsx("footer", { children: jsx("div", { className: styles$t.footerTags, children: jsx(CwSkeleton, { variant: "rect", width: "4rem", height: "1.5em", radius: "1rem" }) }) })) : (jsxs("footer", { children: [hasChips && (jsx("div", { className: styles$t.footerTags, children: chips.map((chip, index) => (jsx(CwChip, { label: chip.label, colorScheme: chip.colorScheme, className: styles$t.chip, ...(chip.customColor && { customColor: chip.customColor }), ...(chip.variant && { variant: chip.variant }), ...(chip.icon && { icon: chip.icon }) }, index))) })), footer && (jsx("div", { className: styles$t.footerContent, children: footer }))] }))), resolvedDirection === "row" && ActionsComponent] }));
|
|
1981
1988
|
};
|
|
1982
1989
|
|
|
1983
|
-
var styles$
|
|
1990
|
+
var styles$s = {"cardContainer":"cw-card-list-module__cardContainer__l3YEh","pagination":"cw-card-list-module__pagination__5Ay78","pageInfo":"cw-card-list-module__pageInfo__uiMel","emptyState":"cw-card-list-module__emptyState__RlqiS"};
|
|
1984
1991
|
|
|
1985
1992
|
/**
|
|
1986
1993
|
* Option to display in the CwSelect
|
|
@@ -2075,10 +2082,10 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
|
|
|
2075
2082
|
icon: sortDirection === 'asc' ? 'arrow-up' : 'arrow-down',
|
|
2076
2083
|
onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'),
|
|
2077
2084
|
title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}`,
|
|
2078
|
-
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsx("div", { className: `${styles$
|
|
2085
|
+
}, 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$s.cardContainer}`, "data-layout": layout, style: gridStyle, "aria-busy": true, children: Array.from({ length: normalizeSkeletonCount(skeletonCards, 6) }, (_, index) => (jsx(CwCard, { isLoading: true, children: null }, `skeleton_${index}`))) })) : sortedItems.length === 0 ? (jsx("div", { className: styles$s.emptyState, children: emptyState || jsx("p", { children: "No items to display" }) })) : (jsxs(Fragment, { children: [jsx("div", { className: `${styles$s.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$s.pagination, children: [jsx(CwButton, { variant: "icon", icon: "chevron-left", disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)) }), jsxs("span", { className: styles$s.pageInfo, children: [currentPage, " / ", totalPages] }), jsx(CwButton, { variant: "icon", icon: "chevron-right", disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)) })] }))] }))] }));
|
|
2079
2086
|
}
|
|
2080
2087
|
|
|
2081
|
-
var styles$
|
|
2088
|
+
var styles$r = {"cw-accordion":"cw-accordion-module__cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module__cw-accordion-body__xlI8b"};
|
|
2082
2089
|
|
|
2083
2090
|
/**
|
|
2084
2091
|
* Legacy collapsible section with its own header markup.
|
|
@@ -2093,7 +2100,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
2093
2100
|
setVisible_accordionBody(!isVisible_accordionBody);
|
|
2094
2101
|
};
|
|
2095
2102
|
// #endregion
|
|
2096
|
-
return (jsxs("div", { className: styles$
|
|
2103
|
+
return (jsxs("div", { className: styles$r["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$r["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
|
|
2097
2104
|
}
|
|
2098
2105
|
|
|
2099
2106
|
/*
|
|
@@ -2368,7 +2375,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2368
2375
|
}, 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" })] })] }))] }));
|
|
2369
2376
|
}
|
|
2370
2377
|
|
|
2371
|
-
var styles$
|
|
2378
|
+
var styles$q = {"dropIndicator":"cw-sortable-table-module__dropIndicator__ov-Jz","dragging":"cw-sortable-table-module__dragging__MrLrz","saveBar":"cw-sortable-table-module__saveBar__3OdoZ cw-flex-row cw-align-center-center cw-gap-small"};
|
|
2372
2379
|
|
|
2373
2380
|
/**
|
|
2374
2381
|
* Hook that provides state management for CwSortableTable.
|
|
@@ -2431,7 +2438,7 @@ function useSortableTable(initialItems) {
|
|
|
2431
2438
|
}
|
|
2432
2439
|
|
|
2433
2440
|
// ─── Drop indicator row ───────────────────────────────────────────────────────
|
|
2434
|
-
const DropIndicatorRow = ({ colSpan }) => (jsx("tr", { className: styles$
|
|
2441
|
+
const DropIndicatorRow = ({ colSpan }) => (jsx("tr", { className: styles$q.dropIndicator, "aria-hidden": true, children: jsx("td", { colSpan: colSpan, children: jsx("div", {}) }) }));
|
|
2435
2442
|
// ─── Loading skeleton ─────────────────────────────────────────────────────────
|
|
2436
2443
|
// Plain td cells (no local class): the ghost cells get the same global cw-table
|
|
2437
2444
|
// padding as real body cells, so row heights match the loaded rows exactly.
|
|
@@ -2534,11 +2541,11 @@ function CwSortableTable({ columns, data, rowKey = "key", onReorder, loading = f
|
|
|
2534
2541
|
return items.map((item, index) => {
|
|
2535
2542
|
const key = item[rowKey];
|
|
2536
2543
|
const isDragging = draggedItem?.[rowKey] === key;
|
|
2537
|
-
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && (jsx(DropIndicatorRow, { colSpan: totalCols })), jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$
|
|
2544
|
+
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$q.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)));
|
|
2538
2545
|
});
|
|
2539
2546
|
};
|
|
2540
2547
|
// ── Render ──────────────────────────────────────────────────────────────
|
|
2541
|
-
return (jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, "aria-busy": loading || undefined, children: [jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { children: jsxs("tr", { children: [showHandle && jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsx("tbody", { children: renderBody() })] }), !loading && hasChanges && (jsxs("footer", { className: styles$
|
|
2548
|
+
return (jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, "aria-busy": loading || undefined, children: [jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { children: jsxs("tr", { children: [showHandle && jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsx("tbody", { children: renderBody() })] }), !loading && hasChanges && (jsxs("footer", { className: styles$q.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) })] }))] }));
|
|
2542
2549
|
}
|
|
2543
2550
|
|
|
2544
2551
|
/**
|
|
@@ -2739,7 +2746,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
2739
2746
|
}, 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" })] })] }))] }));
|
|
2740
2747
|
}
|
|
2741
2748
|
|
|
2742
|
-
var styles$
|
|
2749
|
+
var styles$p = {"cw-tabs":"cw-tabs-module__cw-tabs__1pmji","cw-tabs-content":"cw-tabs-module__cw-tabs-content__HTp8d"};
|
|
2743
2750
|
|
|
2744
2751
|
const BADGE_COLOR_SCHEMES = ['primary', 'danger', 'warning', 'success', 'info', 'neutral'];
|
|
2745
2752
|
function isBadgeColorScheme(value) {
|
|
@@ -2793,11 +2800,11 @@ function CwTabs(CwTabsProps) {
|
|
|
2793
2800
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
2794
2801
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
2795
2802
|
: undefined;
|
|
2796
|
-
return (jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$
|
|
2803
|
+
return (jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$p['cw-tabs'] + (CwTabsProps.className ? ` ${CwTabsProps.className}` : "") + "", style: CwTabsProps.style, "data-tabs-position": position, children: [jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => {
|
|
2797
2804
|
const badgeScheme = tab.badgeColor && isBadgeColorScheme(tab.badgeColor) ? tab.badgeColor : undefined;
|
|
2798
2805
|
const rawBadgeColor = tab.badgeColor && !badgeScheme ? tab.badgeColor : undefined;
|
|
2799
2806
|
return (jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, "data-tab-key": tab.key, "data-badge-themed": tab.badgeColor ? "true" : undefined, children: [jsx(TabIcon, { icon: tab.icon }), tab.title, (tab.badge !== undefined || tab.badgeColor) && (jsx(CwBadge, { count: typeof tab.badge === 'number' ? tab.badge : undefined, content: typeof tab.badge === 'string' ? tab.badge : undefined, size: "medium", color: badgeScheme ?? 'primary', variant: badgeScheme ? 'solid' : 'soft', style: rawBadgeColor ? { backgroundColor: rawBadgeColor, color: getContrastColor(rawBadgeColor) } : undefined }))] }, tab.key));
|
|
2800
|
-
}) }), jsx("div", { className: styles$
|
|
2807
|
+
}) }), jsx("div", { className: styles$p['cw-tabs-content'], "data-active-tab-key": activeTab ?? undefined, style: CwTabsProps.contentHeight ? { '--tabs-height': CwTabsProps.contentHeight } : undefined, children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
|
|
2801
2808
|
}
|
|
2802
2809
|
|
|
2803
2810
|
/**
|
|
@@ -2825,7 +2832,7 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
2825
2832
|
return (jsxs("details", { ref: myRef, ...detailsProps, className: "cw-expandable", children: [jsx("summary", { children: briefing }), children && jsx("section", { children: children })] }));
|
|
2826
2833
|
};
|
|
2827
2834
|
|
|
2828
|
-
var styles$
|
|
2835
|
+
var styles$o = {"cw-master-detail":"cw-master-detail-module__cw-master-detail__O8-FA","resizer":"cw-master-detail-module__resizer__hvGhL","detail":"cw-master-detail-module__detail__BG4Dm","skeletonRow":"cw-master-detail-module__skeletonRow__6BUgt","detailSkeleton":"cw-master-detail-module__detailSkeleton__GcDS4","detail-empty":"cw-master-detail-module__detail-empty__KFScK"};
|
|
2829
2836
|
|
|
2830
2837
|
/*
|
|
2831
2838
|
* Fixed rem widths for the ghosts: the master rows and detail panel size their
|
|
@@ -2869,12 +2876,12 @@ const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, de
|
|
|
2869
2876
|
document.body.style.userSelect = '';
|
|
2870
2877
|
};
|
|
2871
2878
|
}, [isResizing, minMasterWidth, maxMasterWidth]);
|
|
2872
|
-
const rootClassName = [styles$
|
|
2879
|
+
const rootClassName = [styles$o['cw-master-detail'], className].filter(Boolean).join(' ');
|
|
2873
2880
|
return (jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, "aria-busy": loading || undefined, children: [jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsx("search", { children: jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsx("header", { children: masterHeader })), jsx("ul", { children: loading
|
|
2874
|
-
? Array.from({ length: skeletonRows }, (_unused, rowIndex) => (jsxs("li", { "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "circle", height: "2rem" }), jsxs("div", { className: styles$
|
|
2875
|
-
: items.map((item) => (jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsx("footer", { children: masterFooter }))] }), resizable && (jsx("div", { className: styles$
|
|
2881
|
+
? Array.from({ length: skeletonRows }, (_unused, rowIndex) => (jsxs("li", { "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "circle", height: "2rem" }), jsxs("div", { className: styles$o.skeletonRow, children: [jsx(CwSkeleton, { variant: "text", width: MASTER_TITLE_WIDTHS[rowIndex % MASTER_TITLE_WIDTHS.length] }), jsx(CwSkeleton, { variant: "text", width: MASTER_SUBTITLE_WIDTH })] })] }, `skeleton_${rowIndex}`)))
|
|
2882
|
+
: 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$o.resizer, "data-resizing": isResizing, onMouseDown: handleMouseDown })), jsx("section", { className: styles$o.detail, children: loading ? (jsxs("div", { className: styles$o.detailSkeleton, "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "text", width: "14rem", height: "1.5em" }), jsx(CwSkeleton, { variant: "text", width: "22rem" }), jsx(CwSkeleton, { variant: "text", width: "18rem" }), jsx(CwSkeleton, { variant: "text", width: "20rem" })] })) : selectedKey && detailContent
|
|
2876
2883
|
? detailContent
|
|
2877
|
-
: (jsx("div", { className: styles$
|
|
2884
|
+
: (jsx("div", { className: styles$o['detail-empty'], children: emptyDetail ?? 'Select an item to view details' })) })] }));
|
|
2878
2885
|
};
|
|
2879
2886
|
|
|
2880
2887
|
/*
|
|
@@ -2914,7 +2921,7 @@ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "
|
|
|
2914
2921
|
return (jsx("dl", { className: `cw-keyvalue-list ${className}`, "data-direction": groupLayout?.direction, "data-align": groupLayout?.align, "data-justify": groupLayout?.justify, "data-gap": groupLayout?.gap, "aria-busy": loading || undefined, ...htmlProps, children: renderItems() }));
|
|
2915
2922
|
};
|
|
2916
2923
|
|
|
2917
|
-
var styles$
|
|
2924
|
+
var styles$n = {"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"};
|
|
2918
2925
|
|
|
2919
2926
|
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, maxHeight = "300px", }) {
|
|
2920
2927
|
const [draggedItem, setDraggedItem] = useState(null);
|
|
@@ -2977,15 +2984,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
|
|
|
2977
2984
|
}
|
|
2978
2985
|
};
|
|
2979
2986
|
if (items.length === 0) {
|
|
2980
|
-
return (jsx("div", { className: `${styles$
|
|
2987
|
+
return (jsx("div", { className: `${styles$n.sortableList} ${styles$n.emptyState} ${className}`, children: jsx("div", { className: styles$n.emptyMessage, children: emptyMessage }) }));
|
|
2981
2988
|
}
|
|
2982
|
-
return (jsx("div", { className: `${styles$
|
|
2989
|
+
return (jsx("div", { className: `${styles$n.sortableList} ${className}`, style: { maxHeight }, children: items.map((item, index) => {
|
|
2983
2990
|
const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
|
|
2984
2991
|
const isDragging = draggedItem?.id === item.id;
|
|
2985
2992
|
const isMoved = movedItems.has(item.id);
|
|
2986
2993
|
const canExpand = Boolean(expandedContent);
|
|
2987
2994
|
const isExpanded = expandedItems.has(item.id);
|
|
2988
|
-
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && jsx("div", { className: styles$
|
|
2995
|
+
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && jsx("div", { className: styles$n.dropIndicator }), jsxs("div", { className: `${styles$n.sortableItem} ${isDragging ? styles$n.dragging : ''} ${isMoved ? styles$n.moved : ''} ${readOnly ? styles$n.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$n.sortableHandle, children: jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxs("div", { className: styles$n.sortableContent, children: [jsx("div", { className: styles$n.sortableTitle, children: title }), extraContent && jsx("div", { className: styles$n.sortableExtraContent, children: extraContent })] }), jsx("div", { className: styles$n.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsx("div", { className: styles$n.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsx("div", { className: styles$n.dropIndicator }))] }, item.id));
|
|
2989
2996
|
}) }));
|
|
2990
2997
|
}
|
|
2991
2998
|
|
|
@@ -3112,7 +3119,7 @@ const CwTableGrouped = props => {
|
|
|
3112
3119
|
group.rows.map((child, j) => (jsx("tr", { "data-row": true, "data-row-last-of-group": j == group.rows.length - 1, children: child.cells.map((cell, k) => (jsx("td", { children: cell.content }, k))) }, j)))] }, i))) }), jsx("tfoot", {})] }) }));
|
|
3113
3120
|
};
|
|
3114
3121
|
|
|
3115
|
-
var styles$
|
|
3122
|
+
var styles$m = {"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"};
|
|
3116
3123
|
|
|
3117
3124
|
const DEFAULT_LABELS$1 = {
|
|
3118
3125
|
uploadDisabled: 'Upload disabled',
|
|
@@ -3298,12 +3305,12 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3298
3305
|
}
|
|
3299
3306
|
}
|
|
3300
3307
|
};
|
|
3301
|
-
return (jsxs("div", { className: `${styles$
|
|
3308
|
+
return (jsxs("div", { className: `${styles$m.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$m.hiddenInput }), selectedFiles.length === 0 && !existingFile ? (jsxs("div", { className: `${styles$m.uploadArea} ${fileUploadProps.disabled ? styles$m.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsx(CwIcon, { iconId: "upload" }), jsx("p", { className: `${styles$m.uploadTitle}`, children: fileUploadProps.disabled ? labels.uploadDisabled : labels.clickToUpload }), jsxs("p", { className: `${styles$m.uploadSubtitle}`, children: [fileUploadProps.accept ? labels.acceptedFiles(fileUploadProps.accept) : labels.allTypesAccepted, !fileUploadProps.multiple && ` ${labels.singleFileOnly}`] })] })) : selectedFiles.length === 0 && existingFile ? (jsxs("div", { className: styles$m.filesContainer, children: [jsxs("div", { className: styles$m.fileItem, children: [jsxs("div", { className: styles$m.fileIcon, children: [jsx(CwIcon, { iconId: "page" }), jsx("span", { className: styles$m.fileExtension, children: getFileExtension(existingFile) })] }), jsx("div", { className: styles$m.fileInfo, children: jsx("p", { className: styles$m.fileName, children: existingFile }) }), jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => {
|
|
3302
3309
|
setExistingFile(undefined);
|
|
3303
3310
|
if (fileUploadProps.onSelect) {
|
|
3304
3311
|
fileUploadProps.onSelect(null);
|
|
3305
3312
|
}
|
|
3306
|
-
}, disabled: fileUploadProps.disabled, className: styles$
|
|
3313
|
+
}, disabled: fileUploadProps.disabled, className: styles$m.smallButton })] }), jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled })] })) : (jsxs("div", { className: styles$m.filesContainer, children: [jsxs("header", { className: "cw-flex-row cw-align-between-center cw-flex-wrap", children: [jsx("small", { className: styles$m.filesCount, children: fileUploadProps.statusText ?? labels.filesSelected(selectedFiles.length) }), jsxs("div", { className: "cw-flex-row", children: [fileUploadProps.onConfirm && selectedFiles.length > 0 && (jsx(CwButton, { onClick: () => {
|
|
3307
3314
|
let files = fileInputRef.current?.files ?? null;
|
|
3308
3315
|
if (!files) {
|
|
3309
3316
|
const dataTransfer = new DataTransfer();
|
|
@@ -3311,7 +3318,7 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3311
3318
|
files = dataTransfer.files;
|
|
3312
3319
|
}
|
|
3313
3320
|
fileUploadProps.onConfirm?.(files);
|
|
3314
|
-
}, disabled: fileUploadProps.disabled || fileUploadProps.confirmDisabled, icon: "upload", text: fileUploadProps.confirmLabel ?? labels.upload })), !fileUploadProps.hideClearAll && (jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] })] }), selectedFiles.map((file, index) => (jsxs("div", { className: styles$
|
|
3321
|
+
}, disabled: fileUploadProps.disabled || fileUploadProps.confirmDisabled, icon: "upload", text: fileUploadProps.confirmLabel ?? labels.upload })), !fileUploadProps.hideClearAll && (jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] })] }), selectedFiles.map((file, index) => (jsxs("div", { className: styles$m.fileItem, children: [jsxs("div", { className: styles$m.fileIcon, children: [jsx(CwIcon, { iconId: "page" }), jsx("span", { className: styles$m.fileExtension, children: getFileExtension(file.name) })] }), jsxs("div", { className: styles$m.fileInfo, children: [jsx("p", { className: styles$m.fileName, children: file.name }), jsxs("p", { className: styles$m.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$m.smallButton })] }, `${file.name}-${file.size}`))), fileUploadProps.multiple && (jsx(CwButton, { text: labels.addMoreFiles, icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
|
|
3315
3322
|
}
|
|
3316
3323
|
|
|
3317
3324
|
/**
|
|
@@ -3364,7 +3371,7 @@ function CwDigit(props) {
|
|
|
3364
3371
|
return (jsxs("div", { className: "cw-input-text", "data-direction": labelProps ? flexDirection : "column", "data-feedback-position": feedbackPosition, children: [jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { className: "cw-input-button", children: [jsx("input", { type: "number", ...inputProps, "aria-describedby": describedBy }), buttonProps && jsx(CwButton, { ...buttonProps })] })] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-info", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
3365
3372
|
}
|
|
3366
3373
|
|
|
3367
|
-
var styles$
|
|
3374
|
+
var styles$l = {"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"};
|
|
3368
3375
|
|
|
3369
3376
|
const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
|
|
3370
3377
|
const [rgb, setRgb] = useState({ r: 255, g: 255, b: 255 });
|
|
@@ -3567,13 +3574,13 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
|
|
|
3567
3574
|
// Calculate background color for the main area based on current hue
|
|
3568
3575
|
const hueColor = hsvToRgb(hsv.h, 100, 100);
|
|
3569
3576
|
const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
|
|
3570
|
-
return (jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsx("div", { className: styles$
|
|
3577
|
+
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$l.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$l.colorPickerInteractiveArea, children: [jsx("div", { className: styles$l.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsx("div", { className: styles$l.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxs("div", { className: styles$l.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxs("div", { className: styles$l.colorAreaOverlay, children: [jsx("div", { className: styles$l.hueBackground, style: { backgroundColor: hueHex } }), jsx("div", { className: styles$l.whiteGradient }), jsx("div", { className: styles$l.blackGradient })] }), jsx("div", { className: styles$l.colorAreaCursor, style: {
|
|
3571
3578
|
left: `${hsv.s}%`,
|
|
3572
3579
|
top: `${100 - hsv.v}%`
|
|
3573
3580
|
} })] })] })] }));
|
|
3574
3581
|
};
|
|
3575
3582
|
|
|
3576
|
-
var styles$
|
|
3583
|
+
var styles$k = {"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"};
|
|
3577
3584
|
|
|
3578
3585
|
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, readOnly = false, width = '4rem', height = '2rem', labelProps, layoutProps, className, style, }) => {
|
|
3579
3586
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -3706,11 +3713,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
3706
3713
|
break;
|
|
3707
3714
|
}
|
|
3708
3715
|
};
|
|
3709
|
-
return (jsxs("div", { className: `cw-input-color ${styles$
|
|
3716
|
+
return (jsxs("div", { className: `cw-input-color ${styles$k.container}${className ? ` ${className}` : ''}`, style: style, "data-direction": layoutProps?.direction ?? "row", "data-align": layoutProps?.align, children: [labelProps && (jsx(CwLabel, { ...labelProps })), jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$k.selectColor} ${disabled ? styles$k.disabled : ''} ${readOnly ? styles$k.readOnly : ''}`, style: {
|
|
3710
3717
|
width,
|
|
3711
3718
|
height,
|
|
3712
3719
|
backgroundColor: value,
|
|
3713
|
-
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && createPortal(jsx("div", { ref: dropdownRef, className: styles$
|
|
3720
|
+
}, "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$k.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
|
|
3714
3721
|
};
|
|
3715
3722
|
|
|
3716
3723
|
/**
|
|
@@ -3965,7 +3972,7 @@ function CwInputDateText(props) {
|
|
|
3965
3972
|
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 })] }) }));
|
|
3966
3973
|
}
|
|
3967
3974
|
|
|
3968
|
-
var styles$
|
|
3975
|
+
var styles$j = {"hiddenInput":"cw-input-image-module__hiddenInput__pS7hb","dropZone":"cw-input-image-module__dropZone__ygrGu","title":"cw-input-image-module__title__Rji5M","subtitle":"cw-input-image-module__subtitle__djYYu","container":"cw-input-image-module__container__qh7Tm"};
|
|
3969
3976
|
|
|
3970
3977
|
const DEFAULT_LABELS = {
|
|
3971
3978
|
dropImageHere: "Drop image here",
|
|
@@ -4044,7 +4051,7 @@ function CwInputImage(props) {
|
|
|
4044
4051
|
const file = e.currentTarget.files?.[0];
|
|
4045
4052
|
void handleFile(file ?? null);
|
|
4046
4053
|
};
|
|
4047
|
-
return (jsxs("div", { className: `cw-input-image ${styles$
|
|
4054
|
+
return (jsxs("div", { className: `cw-input-image ${styles$j.container}`, "data-size": size, children: [jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, className: styles$j.dropZone, children: [jsx(CwIcon, { iconId: "upload" }), jsxs("div", { className: "cw-flex-column cw-gap-tiny", children: [jsx("p", { className: styles$j.title, children: labels.dropImageHere }), jsx("p", { className: styles$j.subtitle, children: labels.acceptedFormats(allowedFormats.join(", ").replace(/image\//g, "")) })] })] }), jsxs("div", { className: "cw-flex-row cw-align-center-center cw-gap-small", children: [jsx(CwButton, { onClick: onPasteButtonClick, icon: "paste", text: labels.paste, size: size }), jsx(CwButton, { onClick: () => inputRef.current?.click(), icon: "folder-open", text: labels.browse, size: size })] }), jsx("input", { ref: inputRef, type: "file", accept: allowedFormats.join(","), onChange: handleFileChange, className: styles$j.hiddenInput, ...inputProps })] }));
|
|
4048
4055
|
}
|
|
4049
4056
|
|
|
4050
4057
|
/**
|
|
@@ -4176,7 +4183,7 @@ const CwImageArea = forwardRef((props, ref) => {
|
|
|
4176
4183
|
});
|
|
4177
4184
|
CwImageArea.displayName = "CwImageArea";
|
|
4178
4185
|
|
|
4179
|
-
var styles$
|
|
4186
|
+
var styles$i = {"container":"cw-weekday-selector-module__container__pwcvx","days":"cw-weekday-selector-module__days__Dd3RH"};
|
|
4180
4187
|
|
|
4181
4188
|
/* 2024-01-01 was a Monday. Formatted in UTC so a negative browser offset cannot shift a day. */
|
|
4182
4189
|
const MONDAY_UTC = Date.UTC(2024, 0, 1);
|
|
@@ -4357,7 +4364,7 @@ class Weekdays {
|
|
|
4357
4364
|
}
|
|
4358
4365
|
}
|
|
4359
4366
|
|
|
4360
|
-
const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labelProps, layout, feedback, locale = "en-GB", className }) => {
|
|
4367
|
+
const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labelProps, layout, feedback, locale = "en-GB", className, ...dataAttributes }) => {
|
|
4361
4368
|
const selectedDays = Weekdays.tryFromString(value).toArray();
|
|
4362
4369
|
const dayNames = useMemo(() => getWeekdayNames(locale), [locale]);
|
|
4363
4370
|
const handleChange = (day, checked) => {
|
|
@@ -4374,16 +4381,16 @@ const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labe
|
|
|
4374
4381
|
// Points at the label element rather than copying its text, which also covers a labelProps that
|
|
4375
4382
|
// carries children instead of `text`.
|
|
4376
4383
|
const labelId = labelProps?.id ?? `${feedbackId}-label`;
|
|
4377
|
-
return (jsxs("div", { className: `cw-weekday-selector ${styles$
|
|
4384
|
+
return (jsxs("div", { ...dataAttributes, className: `cw-weekday-selector ${styles$i.container}${className ? ` ${className}` : ""}`, "data-direction": labelProps ? layout?.direction ?? "row" : "column", "data-align": layout?.align, "data-gap": layout?.gap, children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsx("div", { role: "group", className: styles$i.days, "aria-labelledby": labelProps ? labelId : undefined, "aria-describedby": describedBy, children: Weekdays.getFullWeek().map(day => (jsx("input", { type: "checkbox", "data-day": day, "data-letter": dayNames[day].letter, "aria-label": dayNames[day].full, title: dayNames[day].full, checked: selectedDays.includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4378
4385
|
};
|
|
4379
4386
|
|
|
4380
|
-
var styles$
|
|
4387
|
+
var styles$h = {"check-container":"cw-check-module__check-container__4nscZ","group":"cw-check-module__group__6JCQo","options":"cw-check-module__options__-g9LF"};
|
|
4381
4388
|
|
|
4382
4389
|
function CwCheck(props) {
|
|
4383
4390
|
const { labelProps, labelText, direction, alignment, className, ...inputProps } = props;
|
|
4384
4391
|
const resolvedDirection = direction ?? alignment ?? "row";
|
|
4385
4392
|
const displayText = labelProps?.text ?? labelText;
|
|
4386
|
-
return (jsx("div", { className: `cw-check ${styles$
|
|
4393
|
+
return (jsx("div", { className: `cw-check ${styles$h["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 }))] }) }));
|
|
4387
4394
|
}
|
|
4388
4395
|
|
|
4389
4396
|
function CwCheckbox(CwCheckboxProps) {
|
|
@@ -4437,14 +4444,14 @@ function CwCheckboxGroup({ options, value = [], onChange, labelProps, groupLayou
|
|
|
4437
4444
|
?? (optionsAlignment === "column" ? "row" : "column");
|
|
4438
4445
|
// Each checkbox's box-to-text layout is the opposite of the options flow, mirroring CwRadioGroup.
|
|
4439
4446
|
const checkDirection = itemDirection === "row" ? "column" : "row";
|
|
4440
|
-
return (jsxs("div", { className: `cw-checkbox-group ${styles$
|
|
4447
|
+
return (jsxs("div", { className: `cw-checkbox-group ${styles$h.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$h.options, role: "group", "aria-label": labelProps?.text, "aria-describedby": describedBy, "aria-required": required || undefined, "data-direction": itemDirection, "data-gap": itemLayout?.gap, children: options.map((option) => (jsx(CwCheck, { labelProps: { text: option.label }, checked: value.includes(option.value), disabled: disabled || option.disabled, direction: checkDirection, onChange: (e) => handleChange(option.value, e.currentTarget.checked) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4441
4448
|
}
|
|
4442
4449
|
|
|
4443
|
-
var styles$
|
|
4450
|
+
var styles$g = {"radio":"cw-radio-module__radio__5sh7a","group":"cw-radio-module__group__br-HM","options":"cw-radio-module__options__LSw7M"};
|
|
4444
4451
|
|
|
4445
4452
|
/** Single native radio input. Building block for CwRadioGroup. */
|
|
4446
4453
|
function CwRadio({ label, direction = "row", className, ...inputProps }) {
|
|
4447
|
-
return (jsxs("label", { className: `cw-radio ${styles$
|
|
4454
|
+
return (jsxs("label", { className: `cw-radio ${styles$g.radio}${className ? ` ${className}` : ""}`, "data-direction": direction, children: [jsx("input", { type: "radio", ...inputProps }), label && jsx("span", { children: label })] }));
|
|
4448
4455
|
}
|
|
4449
4456
|
|
|
4450
4457
|
/**
|
|
@@ -4471,7 +4478,7 @@ function CwRadioGroup({ options, value, onChange, labelProps, groupLayout, itemL
|
|
|
4471
4478
|
// (itemLayout column) reads best with the circle beside the text; a side-by-side row reads
|
|
4472
4479
|
// best with the circle above the text.
|
|
4473
4480
|
const radioDirection = itemLayout?.direction === "row" ? "column" : "row";
|
|
4474
|
-
return (jsxs("div", { className: `cw-radio-group ${styles$
|
|
4481
|
+
return (jsxs("div", { className: `cw-radio-group ${styles$g.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$g.options, role: "radiogroup", "aria-describedby": describedBy, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : (ariaLabel ?? labelProps?.text), "aria-required": required || undefined, "data-direction": itemLayout?.direction ?? "column", "data-gap": itemLayout?.gap, children: options.map((option) => (jsx(CwRadio, { name: groupName, label: option.label, direction: radioDirection, checked: value === option.value, required: required, disabled: disabled || option.disabled, onChange: () => onChange(option.value) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4475
4482
|
}
|
|
4476
4483
|
|
|
4477
4484
|
function CwToggle(props) {
|
|
@@ -4612,7 +4619,7 @@ function useDropdownPortal({ anchorRef, isOpen, onClose, positionStrategy = defa
|
|
|
4612
4619
|
return { panelRef, panelStyle: style, renderPanel };
|
|
4613
4620
|
}
|
|
4614
4621
|
|
|
4615
|
-
var styles$
|
|
4622
|
+
var styles$f = {"dropdown":"cw-dropdown-module__dropdown__EFZ9M cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-dropdown-module__option__TuMdI cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-dropdown-module__optionFocused__7LGaC cw-choice-dropdown-module__optionFocused__BYMxj","optionSelected":"cw-dropdown-module__optionSelected__OiXIc cw-choice-dropdown-module__optionSelected__Lt8Xg","optionDisabled":"cw-dropdown-module__optionDisabled__lYM6w cw-choice-dropdown-module__optionDisabled__n3scM","emptyState":"cw-dropdown-module__emptyState__gp8KT cw-choice-dropdown-module__emptyState__HO0Y7","searchBox":"cw-dropdown-module__searchBox__Bx0JE cw-choice-dropdown-module__searchBox__0gox7","searchInput":"cw-dropdown-module__searchInput__JrxCK cw-choice-dropdown-module__searchInput__G5oRs","value":"cw-dropdown-module__value__i-7IN","colorCircle":"cw-dropdown-module__colorCircle__5kgiT cw-choice-dropdown-module__colorCircle__x7mI9"};
|
|
4616
4623
|
|
|
4617
4624
|
/**
|
|
4618
4625
|
* Custom dropdown component with colour-coded options, optional search filter, and full
|
|
@@ -4726,12 +4733,12 @@ function CwDropdown({ options, value, onChange, labelProps, alignProps, placehol
|
|
|
4726
4733
|
}
|
|
4727
4734
|
}, [isOpen, highlightedIndex, filteredOptions, handleOptionSelect]);
|
|
4728
4735
|
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
4729
|
-
return (jsx("div", { ref: containerRef, className: `cw-dropdown${className ? ` ${className}` : ""}`, "data-direction": flexDirection, style: style, ...otherProps, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsxs("div", { className: styles$
|
|
4730
|
-
styles$
|
|
4731
|
-
value === option.value ? styles$
|
|
4732
|
-
highlightedIndex === index ? styles$
|
|
4733
|
-
option.disabled ? styles$
|
|
4734
|
-
].filter(Boolean).join(" "), onClick: () => !option.disabled && handleOptionSelect(option.value), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": value === option.value, "aria-disabled": option.disabled, children: [option.color && (jsx("span", { className: styles$
|
|
4736
|
+
return (jsx("div", { ref: containerRef, className: `cw-dropdown${className ? ` ${className}` : ""}`, "data-direction": flexDirection, style: style, ...otherProps, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsxs("div", { className: styles$f.value, children: [jsxs("div", { className: "cw-dropdown-wrapper", ref: wrapperRef, children: [jsxs("button", { type: "button", className: "cw-dropdown-trigger", onClick: handleTriggerClick, onKeyDown: handleKeyDown, disabled: disabled, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-labelledby": labelProps ? `${labelId} ${valueId}` : undefined, "aria-label": labelProps ? undefined : (selectedOption?.label || placeholder), "aria-describedby": describedBy, children: [jsx("div", { className: "cw-dropdown-trigger-content", id: valueId, children: selectedOption ? (jsxs(Fragment, { children: [selectedOption.color && (jsx("span", { className: styles$f.colorCircle, style: { backgroundColor: selectedOption.color } })), jsx("span", { children: selectedOption.label })] })) : (jsx("span", { className: "cw-dropdown-placeholder", children: placeholder })) }), jsx(CwIcon, { iconId: "chevron-down", size: "small" })] }), renderPanel(jsxs("div", { ref: panelRef, className: styles$f.dropdown, style: panelStyle, role: "listbox", onKeyDown: handleKeyDown, children: [allowSearch && (jsx("div", { className: styles$f.searchBox, children: jsx("input", { ref: inputRef, type: "text", placeholder: "Search...", value: searchText, onChange: handleSearchChange, onKeyDown: handleKeyDown, className: styles$f.searchInput, autoComplete: "off" }) })), jsx("ul", { children: filteredOptions.length > 0 ? (filteredOptions.map((option, index) => (jsxs("li", { ref: highlightedIndex === index ? highlightedItemRef : null, className: [
|
|
4737
|
+
styles$f.option,
|
|
4738
|
+
value === option.value ? styles$f.optionSelected : "",
|
|
4739
|
+
highlightedIndex === index ? styles$f.optionFocused : "",
|
|
4740
|
+
option.disabled ? styles$f.optionDisabled : "",
|
|
4741
|
+
].filter(Boolean).join(" "), onClick: () => !option.disabled && handleOptionSelect(option.value), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": value === option.value, "aria-disabled": option.disabled, children: [option.color && (jsx("span", { className: styles$f.colorCircle, style: { backgroundColor: option.color } })), jsx("span", { children: option.label })] }, option.value)))) : (jsx("li", { className: styles$f.emptyState, children: "No options available" })) })] }))] }), feedbackMessages.map((item, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": item.type, "aria-live": "polite", children: item.message }, index)))] })] }) }));
|
|
4735
4742
|
}
|
|
4736
4743
|
|
|
4737
4744
|
/**
|
|
@@ -4748,7 +4755,7 @@ function CwDropdownFilter(props) {
|
|
|
4748
4755
|
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))) }) }))] }));
|
|
4749
4756
|
}
|
|
4750
4757
|
|
|
4751
|
-
var styles$
|
|
4758
|
+
var styles$e = {"container":"cw-popover-button-module__container__YSWQU","panel":"cw-popover-button-module__panel__C-BTn"};
|
|
4752
4759
|
|
|
4753
4760
|
/**
|
|
4754
4761
|
* Button that toggles a floating panel with arbitrary children.
|
|
@@ -4827,7 +4834,7 @@ function CwPopoverButton({ children, panelWidth = "auto", placement = "bottom-st
|
|
|
4827
4834
|
}
|
|
4828
4835
|
panel.showPopover();
|
|
4829
4836
|
}, [placement]);
|
|
4830
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
4837
|
+
return (jsxs("div", { ref: containerRef, className: styles$e.container, children: [jsx(CwButton, { ...buttonProps, onClick: handleClick }), jsx("div", { ref: panelCallbackRef, className: `${styles$e.panel}${panelClassName ? ` ${panelClassName}` : ""}`, style: { width: panelWidth }, children: children })] }));
|
|
4831
4838
|
}
|
|
4832
4839
|
|
|
4833
4840
|
function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor, onPrimaryColor) {
|
|
@@ -4845,13 +4852,13 @@ function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor
|
|
|
4845
4852
|
return result;
|
|
4846
4853
|
}
|
|
4847
4854
|
|
|
4848
|
-
var styles$
|
|
4855
|
+
var styles$d = {"cw-multifilter-tag":"cw-multi-filter-tag-module__cw-multifilter-tag__Epda-"};
|
|
4849
4856
|
|
|
4850
4857
|
const CwMultiFilterTag = props => {
|
|
4851
4858
|
const { ID, Name, Value, Category, Removable, PrimaryColor, Selectable, Selected } = props;
|
|
4852
4859
|
const backgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
|
|
4853
4860
|
const isOutlineMode = Selected && !Removable;
|
|
4854
|
-
return (jsx("li", { className: styles$
|
|
4861
|
+
return (jsx("li", { className: styles$d["cw-multifilter-tag"], id: ID, "data-value": Value, "data-category": Category, "data-selected": !!Selected, title: props.tooltip ?? Name, onClick: () => {
|
|
4855
4862
|
if (Selectable)
|
|
4856
4863
|
props.OnSelect?.(props);
|
|
4857
4864
|
}, children: jsx(CwChip, { label: Name, colorScheme: "custom", customColor: backgroundColor, variant: isOutlineMode ? "outline" : "soft", closable: Removable, onClose: () => props.OnRemove?.(props),
|
|
@@ -4861,7 +4868,7 @@ const CwMultiFilterTag = props => {
|
|
|
4861
4868
|
} : undefined }) }));
|
|
4862
4869
|
};
|
|
4863
4870
|
|
|
4864
|
-
var styles$
|
|
4871
|
+
var styles$c = {"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"};
|
|
4865
4872
|
|
|
4866
4873
|
/**
|
|
4867
4874
|
* A multiple filter selector, a MULTI-SELECT even. Allows users to select and filter items based on tags.
|
|
@@ -5102,9 +5109,9 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5102
5109
|
inputRef.current?.focus();
|
|
5103
5110
|
}
|
|
5104
5111
|
};
|
|
5105
|
-
return (jsxs("form", { ref: componentRef, id: id, "data-testid": testId, className: `${styles$
|
|
5112
|
+
return (jsxs("form", { ref: componentRef, id: id, "data-testid": testId, className: `${styles$c["cw-multi-filter"]}${className ? ` ${className}` : ""}`, style: style, onSubmit: (e) => {
|
|
5106
5113
|
e.preventDefault();
|
|
5107
|
-
}, children: [jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$
|
|
5114
|
+
}, children: [jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$c["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-outline-variant)" } : {}, children: [jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.currentTarget.value), autoComplete: "off", placeholder: selectedTags.size === 0 ? placeholder : "", onKeyDown: e => {
|
|
5108
5115
|
switch (e.key) {
|
|
5109
5116
|
case "Enter":
|
|
5110
5117
|
case "Tab": {
|
|
@@ -5131,7 +5138,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5131
5138
|
break;
|
|
5132
5139
|
}
|
|
5133
5140
|
}
|
|
5134
|
-
} })] }), 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$
|
|
5141
|
+
} })] }), 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$c["cw-multi-filter-catalog-container"], style: panelStyle, children: [jsxs("nav", { children: [jsx("button", { className: selectedCategory === "All" ? styles$c["category-selected"] : undefined, onClick: () => handleClickCategory("All"), children: allCategoriesLabel }), Array.from(categoriesMappedToTags().keys()).map(category => (jsx("button", { className: selectedCategory === category ? styles$c["category-selected"] : undefined, style: {
|
|
5135
5142
|
backgroundColor: getColor(category).primary,
|
|
5136
5143
|
color: getColor(category).onPrimary,
|
|
5137
5144
|
}, onClick: () => handleClickCategory(category), children: category }, category)))] }), jsx("ul", { children: displayTags
|
|
@@ -5157,7 +5164,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5157
5164
|
} }, props.ID))) })] }))] }));
|
|
5158
5165
|
};
|
|
5159
5166
|
|
|
5160
|
-
var styles$
|
|
5167
|
+
var styles$b = {"container":"cw-tag-selector-module__container__-do8i","value":"cw-tag-selector-module__value__TDAy3","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"};
|
|
5161
5168
|
|
|
5162
5169
|
/**
|
|
5163
5170
|
* Multi-select input with chip tags and searchable dropdown.
|
|
@@ -5295,13 +5302,13 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5295
5302
|
const feedbackId = useId();
|
|
5296
5303
|
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
5297
5304
|
const describedBy = feedbackIds.join(" ") || undefined;
|
|
5298
|
-
return (jsxs("div", { ref: containerRef, className: `${styles$
|
|
5299
|
-
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", "aria-describedby": describedBy }), 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", { id: feedbackIds[i], className: "cw-input-feedback", "data-color": fb.type, "aria-live": "polite", children: fb.message }, i)))] })] }), renderPanel((showSelectAll || filtered.length > 0) ? (jsxs("div", { ref: panelRef, className: styles$
|
|
5305
|
+
return (jsxs("div", { ref: containerRef, className: `${styles$b.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$b.value, children: [jsxs("div", { className: `${styles$b.inputBox}${disabled ? ` ${styles$b.disabled}` : ""}`, ref: inputBoxRef, onClick: () => { if (!disabled)
|
|
5306
|
+
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", "aria-describedby": describedBy }), 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", { id: feedbackIds[i], className: "cw-input-feedback", "data-color": fb.type, "aria-live": "polite", children: fb.message }, i)))] })] }), renderPanel((showSelectAll || filtered.length > 0) ? (jsxs("div", { ref: panelRef, className: styles$b.dropdown, style: panelStyle, children: [showSelectAll && !search && (jsxs("div", { className: styles$b.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$b.option}${idx === focusedIndex ? ` ${styles$b.optionFocused}` : ""}`, onMouseDown: (e) => e.preventDefault(), onClick: () => handleSelect(opt.value), onMouseEnter: () => setFocusedIndex(idx), title: opt.tooltip, children: [opt.color && jsx("span", { className: styles$b.optionDot, style: { backgroundColor: opt.color } }), opt.label] }, opt.value))) })] })) : null)] }));
|
|
5300
5307
|
}
|
|
5301
5308
|
|
|
5302
|
-
var styles$
|
|
5309
|
+
var styles$a = {"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"};
|
|
5303
5310
|
|
|
5304
|
-
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null }) {
|
|
5311
|
+
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null, ...dataAttributes }) {
|
|
5305
5312
|
const [expanded, setExpanded] = useState(new Set());
|
|
5306
5313
|
// const [selectedId, setSelectedId] = useState<string | number | null>(initialSelectedId);
|
|
5307
5314
|
const [selectedId, setSelectedId] = useState(null);
|
|
@@ -5366,10 +5373,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5366
5373
|
const isLeaf = !hasChildren;
|
|
5367
5374
|
const isSelected = selectedId?.toString().toLowerCase() === node.id.toString().toLowerCase();
|
|
5368
5375
|
const selectable = allowParentSelection || isLeaf;
|
|
5369
|
-
return (jsxs("div", { className: styles$
|
|
5370
|
-
styles$
|
|
5371
|
-
isSelected && styles$
|
|
5372
|
-
!selectable && styles$
|
|
5376
|
+
return (jsxs("div", { className: styles$a["tree-item"], children: [jsxs("div", { className: [
|
|
5377
|
+
styles$a["tree-node"],
|
|
5378
|
+
isSelected && styles$a["selected"],
|
|
5379
|
+
!selectable && styles$a["non-selectable"]
|
|
5373
5380
|
].filter(Boolean).join(' '), style: { paddingLeft: `${depth * 24 + 8}px` }, onClick: () => {
|
|
5374
5381
|
if (selectable) {
|
|
5375
5382
|
setSelectedId(node.id);
|
|
@@ -5378,7 +5385,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5378
5385
|
else {
|
|
5379
5386
|
toggleExpand(node.id);
|
|
5380
5387
|
}
|
|
5381
|
-
}, children: [hasChildren && (jsx(
|
|
5388
|
+
}, children: [hasChildren && (jsx(CwButton, { variant: "icon", color: "neutral", icon: isExpanded ? "chevron-down" : "chevron-right", "aria-expanded": isExpanded, "aria-label": `${isExpanded ? "Collapse" : "Expand"} ${node.label}`, onClick: (event) => {
|
|
5389
|
+
event.stopPropagation();
|
|
5390
|
+
toggleExpand(node.id);
|
|
5391
|
+
} })), jsx("div", { className: `${styles$a["tree-label"]} ${!hasChildren ? styles$a["tree-spacer"] : ''}`, children: node.label })] }), hasChildren && isExpanded && (jsx("div", { className: styles$a["tree-children"], children: node.children.map((child) => renderNode(child, depth + 1)) }))] }, node.id));
|
|
5382
5392
|
};
|
|
5383
5393
|
// Function to search for nodes that match the search term
|
|
5384
5394
|
const searchInTree = (nodes, searchTerm) => {
|
|
@@ -5402,7 +5412,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5402
5412
|
return results;
|
|
5403
5413
|
};
|
|
5404
5414
|
const filteredData = searchInTree(data, search);
|
|
5405
|
-
return (jsxs("div", { className: `cw-tree-view ${styles$
|
|
5415
|
+
return (jsxs("div", { ...dataAttributes, className: `cw-tree-view ${styles$a["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$a["tree-wrapper"], children: filteredData.length > 0 ? (filteredData.map((node) => renderNode(node))) : (jsxs("div", { className: styles$a["empty-state"], children: [jsx(CwIcon, { iconId: "comment" }), search ? "No results found" : "There are no items"] })) })] }));
|
|
5406
5416
|
}
|
|
5407
5417
|
|
|
5408
5418
|
const EXACT_PHRASE = /"([^"]+)"/g;
|
|
@@ -5470,7 +5480,7 @@ function sortNavItems(items, alphabetically) {
|
|
|
5470
5480
|
return [...items].sort((first, second) => first.label.localeCompare(second.label));
|
|
5471
5481
|
}
|
|
5472
5482
|
|
|
5473
|
-
var styles$
|
|
5483
|
+
var styles$9 = {"menu":"cw-nav-menu-module__menu__LmeQg","expandIndicator":"cw-nav-menu-module__expandIndicator__TBSdQ","favorites":"cw-nav-menu-module__favorites__Esaqd","favoritesContent":"cw-nav-menu-module__favoritesContent__l5DGG","favoriteStar":"cw-nav-menu-module__favoriteStar__J-jzg","emptyMessage":"cw-nav-menu-module__emptyMessage__-CQNd","skeleton":"cw-nav-menu-module__skeleton__INQqF"};
|
|
5474
5484
|
|
|
5475
5485
|
const SKELETON_ROW_COUNT = 5;
|
|
5476
5486
|
const defaultRenderLink = (item, children) => (jsx("a", { href: item.href, children: children }));
|
|
@@ -5482,13 +5492,13 @@ function CwNavMenu({ items, loading = false, isActive, renderLink = defaultRende
|
|
|
5482
5492
|
const renderItem = (item, level) => {
|
|
5483
5493
|
const children = item.children;
|
|
5484
5494
|
if (children && children.length > 0) {
|
|
5485
|
-
return (jsx("li", { children: jsxs("details", { "data-level": level, open: hasActiveDescendant(item) || undefined, children: [jsxs("summary", { children: [item.icon && jsx(CwIcon, { iconId: item.icon, size: level >= 2 ? "small" : "medium" }), item.label, (showExpandIndicator || level >= 2) && (jsx(CwIcon, { iconId: "chevron-down", size: "small", className: styles$
|
|
5495
|
+
return (jsx("li", { children: jsxs("details", { "data-level": level, open: hasActiveDescendant(item) || undefined, children: [jsxs("summary", { children: [item.icon && jsx(CwIcon, { iconId: item.icon, size: level >= 2 ? "small" : "medium" }), item.label, (showExpandIndicator || level >= 2) && (jsx(CwIcon, { iconId: "chevron-down", size: "small", className: styles$9.expandIndicator }))] }), jsx("ul", { children: children.map(child => renderItem(child, level + 1)) })] }) }, item.id));
|
|
5486
5496
|
}
|
|
5487
|
-
return (jsx("li", { "data-active": isActive?.(item) ? "true" : undefined, children: renderLink(item, jsxs(Fragment, { children: [item.icon && jsx(CwIcon, { iconId: item.icon, size: "medium" }), item.label, isFavorite?.(item) && jsx(CwIcon, { iconId: "star", size: "small", className: styles$
|
|
5497
|
+
return (jsx("li", { "data-active": isActive?.(item) ? "true" : undefined, children: renderLink(item, jsxs(Fragment, { children: [item.icon && jsx(CwIcon, { iconId: item.icon, size: "medium" }), item.label, isFavorite?.(item) && jsx(CwIcon, { iconId: "star", size: "small", className: styles$9.favoriteStar })] })) }, item.id));
|
|
5488
5498
|
};
|
|
5489
|
-
return (jsxs("nav", { ...navProps, className: [styles$
|
|
5490
|
-
? Array.from({ length: SKELETON_ROW_COUNT }, (_unused, index) => (jsx("li", { className: styles$
|
|
5491
|
-
: visibleItems.map(item => renderItem(item, 1)) }), showEmptyMessage && jsx("p", { className: styles$
|
|
5499
|
+
return (jsxs("nav", { ...navProps, className: [styles$9.menu, className].filter(Boolean).join(" "), "aria-busy": loading || undefined, children: [favoritesSlot && (jsxs("details", { open: true, ...favoritesProps, className: [styles$9.favorites, favoritesProps?.className].filter(Boolean).join(" "), children: [jsxs("summary", { children: [jsx(CwIcon, { iconId: "star", size: "medium" }), favoritesLabel] }), jsx("div", { className: styles$9.favoritesContent, children: favoritesSlot })] })), beforeTreeSlot, jsx("ul", { children: loading
|
|
5500
|
+
? Array.from({ length: SKELETON_ROW_COUNT }, (_unused, index) => (jsx("li", { className: styles$9.skeleton, children: jsx(CwSkeleton, { height: "var(--cw-size-small)", radius: "var(--cw-border-radius-small)" }) }, index)))
|
|
5501
|
+
: visibleItems.map(item => renderItem(item, 1)) }), showEmptyMessage && jsx("p", { className: styles$9.emptyMessage, children: emptyMessage })] }));
|
|
5492
5502
|
}
|
|
5493
5503
|
|
|
5494
5504
|
var dropdownStyles = {"dropdown":"cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-choice-dropdown-module__optionFocused__BYMxj"};
|
|
@@ -5654,6 +5664,8 @@ function CwSearchInput(optionsProps) {
|
|
|
5654
5664
|
return (jsxs("div", { className: `cw-search-input ${className || ""}`, style: style, ...otherProps, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsx("input", { ref: inputRef, id: id, type: "text", value: searchText, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, onBlur: handleInputBlur, placeholder: placeholder, className: "cw-input-search", disabled: disabled, autoFocus: autoFocus, autoComplete: "off", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": showDropdown && filteredOptions.length > 0, "aria-controls": listboxId, "aria-activedescendant": highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined }), isLoading && (jsx("div", { className: "cw-search-input-loading", children: jsx(CwIcon, { iconId: "spinner" }) })), jsx("div", { className: "cw-search-input-icons", children: searchText && !disabled && !isLoading ? (jsx(CwButton, { type: "button", onClick: handleClearClick, "aria-label": "Clear search", variant: "icon", icon: "close", color: "neutral" })) : (iconProps ? jsx(CwIcon, { ...iconProps }) : jsx(CwIcon, { iconId: "search" })) })] })] }), renderPanel(jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsx("ul", { children: filteredOptions.map((option, index) => (jsx("li", { id: optionId(index), className: `${dropdownStyles.option}${index === highlightedIndex ? ` ${dropdownStyles.optionFocused}` : ""}`, onClick: () => handleOptionSelect(option), onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: renderOption ? renderOption(option) : option.description }, option.id))) }) }))] }));
|
|
5655
5665
|
}
|
|
5656
5666
|
|
|
5667
|
+
var styles$8 = {"value":"cw-search-async-module__value__z53xT"};
|
|
5668
|
+
|
|
5657
5669
|
/**
|
|
5658
5670
|
* Generic API-backed search input. Fetches matching options from a caller-supplied `onSearch`
|
|
5659
5671
|
* callback as the user types (debounced), renders them in a portal-based dropdown with keyboard
|
|
@@ -5675,7 +5687,7 @@ function CwSearchInput(optionsProps) {
|
|
|
5675
5687
|
* icon={{ iconId: 'control-tower' }}
|
|
5676
5688
|
* />
|
|
5677
5689
|
*/
|
|
5678
|
-
const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveSelection, icon, placeholder = "Search…", minChars = 2, debounceMs = 300, disabled = false, required = false, initialDisplayText, searchTrigger, labelProps, alignProps, width, className = "", }) => {
|
|
5690
|
+
const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveSelection, icon, placeholder = "Search…", minChars = 2, debounceMs = 300, disabled = false, required = false, initialDisplayText, searchTrigger, labelProps, alignProps, width, className = "", feedback, ...dataAttributes }) => {
|
|
5679
5691
|
// State
|
|
5680
5692
|
const [inputValue, setInputValue] = useState("");
|
|
5681
5693
|
const [options, setOptions] = useState([]);
|
|
@@ -5696,6 +5708,12 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5696
5708
|
// Stable ids wiring the combobox input to its listbox popup for assistive tech.
|
|
5697
5709
|
const listboxId = useId();
|
|
5698
5710
|
const optionId = (index) => `${listboxId}-opt-${index}`;
|
|
5711
|
+
const feedbackMessages = feedback
|
|
5712
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
5713
|
+
: [];
|
|
5714
|
+
const feedbackId = useId();
|
|
5715
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
5716
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
5699
5717
|
// Cancel a pending initial-value resolve when the user takes over (typing / clearing / reset),
|
|
5700
5718
|
// so a slow resolve can't overwrite newer input and the loading flag never sticks.
|
|
5701
5719
|
const cancelInitialResolve = useCallback(() => {
|
|
@@ -5907,10 +5925,10 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5907
5925
|
abortRef.current?.abort();
|
|
5908
5926
|
}, []);
|
|
5909
5927
|
const direction = alignProps?.flexDirection || "row";
|
|
5910
|
-
return (jsxs("div", { className: `cw-search-input ${className}`, style: {
|
|
5928
|
+
return (jsxs("div", { ...dataAttributes, className: `cw-search-input ${className}`, style: {
|
|
5911
5929
|
...(width ? { width } : {}),
|
|
5912
5930
|
...(labelProps?.labelWidth ? { "--label-width": labelProps.labelWidth } : {}),
|
|
5913
|
-
}, "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))) }) }))] }));
|
|
5931
|
+
}, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$8.value, children: [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, "aria-describedby": describedBy, 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" })) })] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }), 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))) }) }))] }));
|
|
5914
5932
|
};
|
|
5915
5933
|
|
|
5916
5934
|
var styles$7 = {"menu":"cw-context-menu-module__menu__tXmun","item":"cw-context-menu-module__item__-ko8L","arrow":"cw-context-menu-module__arrow__LHZmQ"};
|
|
@@ -6262,9 +6280,9 @@ var styles$5 = {"switch":"cw-button-switch-module__switch__vdWV-","segment":"cw-
|
|
|
6262
6280
|
* onChange={setView}
|
|
6263
6281
|
* />
|
|
6264
6282
|
*/
|
|
6265
|
-
function CwButtonSwitch({ options, value, onChange, size = "medium", color = "primary", iconOnly = false, direction = "row", disabled = false, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby,
|
|
6283
|
+
function CwButtonSwitch({ options, value, onChange, size = "medium", color = "primary", iconOnly = false, direction = "row", disabled = false, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...dataAttributes }) {
|
|
6266
6284
|
const { getSegmentProps } = useRovingSingleSelect(options, value, onChange);
|
|
6267
|
-
return (jsx("div", { className: `cw-button-switch ${styles$5.switch}`, role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : ariaLabel, "data-direction": direction,
|
|
6285
|
+
return (jsx("div", { ...dataAttributes, className: `cw-button-switch ${styles$5.switch}`, role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : ariaLabel, "data-direction": direction, children: options.map((option, index) => {
|
|
6268
6286
|
const selected = option.value === value;
|
|
6269
6287
|
const segmentProps = getSegmentProps(index);
|
|
6270
6288
|
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));
|
|
@@ -6359,7 +6377,7 @@ function usePickerPopup({ anchorRef, isOpen, onClose, position = "left-bottom" }
|
|
|
6359
6377
|
return { popupRef: panelRef, popupStyle: panelStyle, renderPopup: renderPanel };
|
|
6360
6378
|
}
|
|
6361
6379
|
|
|
6362
|
-
function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, locale = enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, }) {
|
|
6380
|
+
function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, locale = enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
6363
6381
|
const [isOpen, setIsOpen] = useState(false);
|
|
6364
6382
|
const [inputValue, setInputValue] = useState("");
|
|
6365
6383
|
const containerRef = useRef(null);
|
|
@@ -6549,7 +6567,7 @@ function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabl
|
|
|
6549
6567
|
...(maxDate ? [{ after: maxDate }] : []),
|
|
6550
6568
|
...(disabledMatcher ? [disabledMatcher] : []),
|
|
6551
6569
|
], [disabledDates, minDate, maxDate, disabledMatcher]);
|
|
6552
|
-
return (jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsx(DayPicker, { mode: "single", selected: value || undefined, defaultMonth: defaultMonth || value || undefined, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
6570
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsx(DayPicker, { mode: "single", selected: value || undefined, defaultMonth: defaultMonth || value || undefined, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
6553
6571
|
today: new Date(),
|
|
6554
6572
|
}, modifiersClassNames: {
|
|
6555
6573
|
today: "rdp-day-today",
|
|
@@ -6827,8 +6845,14 @@ const getPresetsByKeys = (keys) => {
|
|
|
6827
6845
|
.filter(preset => preset !== undefined);
|
|
6828
6846
|
};
|
|
6829
6847
|
|
|
6830
|
-
function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, maxRangeDays, defaultMonth, labelProps, alignProps, placeholderFrom = "From date", placeholderTo = "To date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 2, showPresets = false, presetKeys, customPresets, }) {
|
|
6848
|
+
function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, maxRangeDays, defaultMonth, labelProps, alignProps, placeholderFrom = "From date", placeholderTo = "To date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 2, showPresets = false, presetKeys, customPresets, feedback, ...dataAttributes }) {
|
|
6831
6849
|
const [isOpen, setIsOpen] = useState(false);
|
|
6850
|
+
const feedbackMessages = feedback
|
|
6851
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
6852
|
+
: [];
|
|
6853
|
+
const feedbackId = useId();
|
|
6854
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
6855
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
6832
6856
|
const [inputFromValue, setInputFromValue] = useState("");
|
|
6833
6857
|
const [inputToValue, setInputToValue] = useState("");
|
|
6834
6858
|
const [rangeErrorMessage, setRangeErrorMessage] = useState(null);
|
|
@@ -7192,11 +7216,11 @@ function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, d
|
|
|
7192
7216
|
}
|
|
7193
7217
|
return undefined;
|
|
7194
7218
|
}, [value]);
|
|
7195
|
-
return (jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, required: required, size: displayFormat.length, "data-focused": focusedInput === 'from' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, required: required, size: displayFormat.length, "data-focused": focusedInput === 'to' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsx(DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonth || value?.from || undefined, modifiers: {
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7219
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length, "data-focused": focusedInput === 'from' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length, "data-focused": focusedInput === 'to' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsx(DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonth || value?.from || undefined, modifiers: {
|
|
7220
|
+
today: new Date(),
|
|
7221
|
+
}, modifiersClassNames: {
|
|
7222
|
+
today: "rdp-day-today",
|
|
7223
|
+
} })] }), jsx("div", { role: "alert", "aria-live": "polite", className: rangeStyles.rangeError, children: rangeErrorMessage })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
7200
7224
|
}
|
|
7201
7225
|
|
|
7202
7226
|
var timeStyles = {"timePickerPopup":"cw-time-picker-module__timePickerPopup__BN63t","timePickerList":"cw-time-picker-module__timePickerList__E88pr","selected":"cw-time-picker-module__selected__qVnfL","field":"cw-time-picker-module__field__kPvGN","narrow":"cw-time-picker-module__narrow__Z7lCI"};
|
|
@@ -7204,9 +7228,16 @@ var timeStyles = {"timePickerPopup":"cw-time-picker-module__timePickerPopup__BN6
|
|
|
7204
7228
|
const isMobileDevice = () => {
|
|
7205
7229
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
7206
7230
|
};
|
|
7207
|
-
function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", useNative = isMobileDevice(), }) {
|
|
7231
|
+
function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", useNative = isMobileDevice(), feedback, ...dataAttributes }) {
|
|
7208
7232
|
const [isOpen, setIsOpen] = useState(false);
|
|
7209
7233
|
const [inputValue, setInputValue] = useState("");
|
|
7234
|
+
const feedbackMessages = feedback
|
|
7235
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7236
|
+
: [];
|
|
7237
|
+
const feedbackId = useId();
|
|
7238
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7239
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
7240
|
+
const feedbackElements = feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)));
|
|
7210
7241
|
const containerRef = useRef(null);
|
|
7211
7242
|
const wrapperRef = useRef(null);
|
|
7212
7243
|
const inputRef = useRef(null);
|
|
@@ -7358,13 +7389,13 @@ function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelP
|
|
|
7358
7389
|
const displayValue = inputValue;
|
|
7359
7390
|
// If using native time input
|
|
7360
7391
|
if (useNative) {
|
|
7361
|
-
return (jsx("div", { className: `cw-timepicker cw-timepicker-native ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsx("div", { className: styles$4.pickerWrapper, children: jsx("input", { type: "time", value: displayValue, onChange: handleNativeChange, min: minTime, max: maxTime, step: interval * 60, disabled: disabled, required: required, placeholder: placeholder, className: "cw-timepicker-native" }) })] }) }));
|
|
7392
|
+
return (jsx("div", { ...dataAttributes, className: `cw-timepicker cw-timepicker-native ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsx("div", { className: styles$4.pickerWrapper, children: jsx("input", { type: "time", value: displayValue, onChange: handleNativeChange, min: minTime, max: maxTime, step: interval * 60, disabled: disabled, required: required, placeholder: placeholder, "aria-describedby": describedBy, className: "cw-timepicker-native" }) }), feedbackElements] })] }) }));
|
|
7362
7393
|
}
|
|
7363
7394
|
// Custom time picker
|
|
7364
|
-
return (jsx("div", { ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { ref: wrapperRef, className: `${styles$4.pickerWrapper} ${timeStyles.field}${showClear ? "" : ` ${timeStyles.narrow}`}`, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 5 }), showClear && (jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsx(CwIcon, { iconId: "clock" })) })), renderPopup(jsx("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${timeStyles.timePickerPopup}`, style: popupStyle, children: jsx("div", { className: timeStyles.timePickerList, children: timeOptions.map((time) => {
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7395
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: `${styles$4.pickerWrapper} ${timeStyles.field}${showClear ? "" : ` ${timeStyles.narrow}`}`, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, maxLength: 5 }), showClear && (jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsx(CwIcon, { iconId: "clock" })) })), renderPopup(jsx("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${timeStyles.timePickerPopup}`, style: popupStyle, children: jsx("div", { className: timeStyles.timePickerList, children: timeOptions.map((time) => {
|
|
7396
|
+
const isSelected = time === value;
|
|
7397
|
+
return (jsx("button", { ref: isSelected ? selectedItemRef : null, type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
7398
|
+
}) }) }))] }), feedbackElements] })] }) }));
|
|
7368
7399
|
}
|
|
7369
7400
|
|
|
7370
7401
|
/**
|
|
@@ -7424,7 +7455,12 @@ function combineDateTimeInOffset(date, hours, minutes, timezoneOffset) {
|
|
|
7424
7455
|
return new Date(zdt.epochMilliseconds);
|
|
7425
7456
|
}
|
|
7426
7457
|
|
|
7427
|
-
function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, nowLabel = "Now", locale = enGB, timezoneOffset, }) {
|
|
7458
|
+
function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, nowLabel = "Now", locale = enGB, timezoneOffset, feedback, ...dataAttributes }) {
|
|
7459
|
+
const feedbackMessages = feedback
|
|
7460
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7461
|
+
: [];
|
|
7462
|
+
const feedbackId = useId();
|
|
7463
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7428
7464
|
// ========================================
|
|
7429
7465
|
// PROPS NORMALIZATION
|
|
7430
7466
|
// ========================================
|
|
@@ -7664,13 +7700,19 @@ function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledD
|
|
|
7664
7700
|
const displayMaxDate = useMemo(() => normalizedMaxDateTime && timezoneOffset !== undefined
|
|
7665
7701
|
? getDateInOffset(normalizedMaxDateTime, timezoneOffset)
|
|
7666
7702
|
: normalizedMaxDateTime, [normalizedMaxDateTime, timezoneOffset]);
|
|
7667
|
-
return jsx("div", { className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsx(CwDatePicker, { value: selectedDate, onChange: handleDateChange, minDate: displayMinDate, maxDate: displayMaxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition, locale: locale }), jsx(CwTimePicker, { value: selectedTime, onChange: handleTimeChange, interval: timeInterval, minTime: timeRestrictions.minTime, maxTime: timeRestrictions.maxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsx(CwButton, { type: "button", variant: "outline", onClick: handleNowClick, disabled: disabled, text: nowLabel }))] })] }) });
|
|
7703
|
+
return jsx("div", { ...dataAttributes, className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsx(CwDatePicker, { value: selectedDate, onChange: handleDateChange, minDate: displayMinDate, maxDate: displayMaxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition, locale: locale }), jsx(CwTimePicker, { value: selectedTime, onChange: handleTimeChange, interval: timeInterval, minTime: timeRestrictions.minTime, maxTime: timeRestrictions.maxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsx(CwButton, { type: "button", variant: "outline", onClick: handleNowClick, disabled: disabled, text: nowLabel }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) });
|
|
7668
7704
|
}
|
|
7669
7705
|
|
|
7670
7706
|
var compactStyles = {"compactPopup":"cw-datetime-compact-module__compactPopup__GiuNY","calendarWrapper":"cw-datetime-compact-module__calendarWrapper__P4Nlq","timeWrapper":"cw-datetime-compact-module__timeWrapper__uMe-A","compactTimeList":"cw-datetime-compact-module__compactTimeList__MzSQT"};
|
|
7671
7707
|
|
|
7672
|
-
function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "dd.mm.yyyy HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, nowLabel = "Now", timeLabel = "Time", locale = enGB, yearRangeStart, yearRangeEnd, }) {
|
|
7708
|
+
function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "dd.mm.yyyy HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, nowLabel = "Now", timeLabel = "Time", locale = enGB, yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
7673
7709
|
const [isOpen, setIsOpen] = useState(false);
|
|
7710
|
+
const feedbackMessages = feedback
|
|
7711
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7712
|
+
: [];
|
|
7713
|
+
const feedbackId = useId();
|
|
7714
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7715
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
7674
7716
|
const [inputValue, setInputValue] = useState("");
|
|
7675
7717
|
const [selectedDate, setSelectedDate] = useState(value);
|
|
7676
7718
|
const [selectedTime, setSelectedTime] = useState("");
|
|
@@ -7914,14 +7956,14 @@ function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, di
|
|
|
7914
7956
|
...(maxDateTime ? [{ after: maxDateTime }] : []),
|
|
7915
7957
|
...(disabledMatcher ? [disabledMatcher] : []),
|
|
7916
7958
|
], [disabledDates, minDateTime, maxDateTime, disabledMatcher]);
|
|
7917
|
-
return (jsx("div", { ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 16 }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsx(CwIcon, { iconId: "calendar-time" })) }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, style: popupStyle, children: [jsxs("div", { className: compactStyles.calendarWrapper, children: [jsx(DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7959
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, maxLength: 16 }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsx(CwIcon, { iconId: "calendar-time" })) }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, style: popupStyle, children: [jsxs("div", { className: compactStyles.calendarWrapper, children: [jsx(DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
7960
|
+
today: new Date(),
|
|
7961
|
+
}, modifiersClassNames: {
|
|
7962
|
+
today: "rdp-day-today",
|
|
7963
|
+
} }), showTodayButton && (jsx("footer", { className: "cw-flex-row cw-align-center-center", children: jsx(CwButton, { type: "button", variant: "outline", icon: "check-big", onClick: handleNowClick, text: nowLabel }) }))] }), jsxs("div", { className: compactStyles.timeWrapper, children: [jsxs("header", { children: [jsx(CwIcon, { iconId: "clock", size: "medium" }), jsx("span", { children: timeLabel })] }), jsx("div", { ref: timeListRef, className: `${timeStyles.timePickerList} ${compactStyles.compactTimeList}`, children: timeOptions.map((time) => {
|
|
7964
|
+
const isSelected = time === selectedTime;
|
|
7965
|
+
return (jsx("button", { type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
7966
|
+
}) })] })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
7925
7967
|
}
|
|
7926
7968
|
|
|
7927
7969
|
/**
|
|
@@ -7946,14 +7988,11 @@ function resolveTwoDigitYear(twoDigitYear, currentYear) {
|
|
|
7946
7988
|
}
|
|
7947
7989
|
const parseDate = (dateString, formatStr) => {
|
|
7948
7990
|
try {
|
|
7949
|
-
if (dateString.length < 10) {
|
|
7950
|
-
return undefined;
|
|
7951
|
-
}
|
|
7952
7991
|
const cleanString = dateString.trim();
|
|
7953
7992
|
if (!cleanString)
|
|
7954
7993
|
return undefined;
|
|
7955
7994
|
const parts = cleanString.split(/[\/\-.]/);
|
|
7956
|
-
if (parts.length !== 3)
|
|
7995
|
+
if (parts.length !== 3 || parts.some(part => !/^\d{1,4}$/.test(part)))
|
|
7957
7996
|
return undefined;
|
|
7958
7997
|
let day;
|
|
7959
7998
|
let month;
|
|
@@ -7985,7 +8024,7 @@ const parseDate = (dateString, formatStr) => {
|
|
|
7985
8024
|
if (year < 100) {
|
|
7986
8025
|
year = resolveTwoDigitYear(year);
|
|
7987
8026
|
}
|
|
7988
|
-
return Temporal.PlainDate.from({ year, month, day });
|
|
8027
|
+
return Temporal.PlainDate.from({ year, month, day }, { overflow: "reject" });
|
|
7989
8028
|
}
|
|
7990
8029
|
catch {
|
|
7991
8030
|
return undefined;
|
|
@@ -7998,6 +8037,17 @@ const validate = (parsed, minDate, maxDate) => {
|
|
|
7998
8037
|
&& (!maxDate || Temporal.PlainDate.compare(parsed, maxDate) <= 0);
|
|
7999
8038
|
return parsed && isValid;
|
|
8000
8039
|
};
|
|
8040
|
+
/** Same keystroke rule as the Date-valued pickers: shorter text (5.5.2000) only commits on blur. */
|
|
8041
|
+
const TYPED_DATE_MIN_LENGTH = 10;
|
|
8042
|
+
/** What a keystroke in the date input emits: a valid in-range date, a clear on empty text, or nothing while typing. */
|
|
8043
|
+
function resolveTypedDate(text, displayFormat, minDate, maxDate) {
|
|
8044
|
+
if (text === "")
|
|
8045
|
+
return { emit: true, date: undefined };
|
|
8046
|
+
if (text.length < TYPED_DATE_MIN_LENGTH)
|
|
8047
|
+
return { emit: false };
|
|
8048
|
+
const parsed = parseDate(text, displayFormat);
|
|
8049
|
+
return parsed && validate(parsed, minDate, maxDate) ? { emit: true, date: parsed } : { emit: false };
|
|
8050
|
+
}
|
|
8001
8051
|
/** Temporal.PlainDate -> JS Date (for DayPicker interop) */
|
|
8002
8052
|
function plainDateToJsDate(pd) {
|
|
8003
8053
|
return new Date(pd.year, pd.month - 1, pd.day);
|
|
@@ -8019,7 +8069,7 @@ function formatPlainDate(pd, fmt) {
|
|
|
8019
8069
|
.replace("dd", String(pd.day).padStart(2, "0"));
|
|
8020
8070
|
}
|
|
8021
8071
|
|
|
8022
|
-
function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, locale = enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, }) {
|
|
8072
|
+
function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, locale = enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
8023
8073
|
const [isOpen, setIsOpen] = useState(false);
|
|
8024
8074
|
// Initialize with the formatted value so the input is controlled from the first render
|
|
8025
8075
|
const [inputValue, setInputValue] = useState(() => value ? formatPlainDate(value, displayFormat) : "");
|
|
@@ -8044,14 +8094,17 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8044
8094
|
onClose: handleClose,
|
|
8045
8095
|
position: popupPosition,
|
|
8046
8096
|
});
|
|
8047
|
-
// Sync input value with prop value
|
|
8097
|
+
// Sync input value with prop value; not while focused, so text is never rewritten under the cursor (blur reformats)
|
|
8048
8098
|
useEffect(() => {
|
|
8049
8099
|
const currentStr = value?.toString();
|
|
8050
8100
|
const prevStr = prevValueRef.current?.toString();
|
|
8051
8101
|
if (currentStr !== prevStr || prevDisplayFormatRef.current !== displayFormat) {
|
|
8052
8102
|
prevValueRef.current = value;
|
|
8053
8103
|
prevDisplayFormatRef.current = displayFormat;
|
|
8054
|
-
|
|
8104
|
+
const isTyping = inputRef.current !== null && inputRef.current === document.activeElement;
|
|
8105
|
+
if (!isTyping) {
|
|
8106
|
+
setInputValue(formatInputValue(value));
|
|
8107
|
+
}
|
|
8055
8108
|
}
|
|
8056
8109
|
}, [value, displayFormat, formatInputValue]);
|
|
8057
8110
|
const handleDaySelect = useCallback((date) => {
|
|
@@ -8075,11 +8128,12 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8075
8128
|
}
|
|
8076
8129
|
}, [disabled]);
|
|
8077
8130
|
const handleInputChange = useCallback((e) => {
|
|
8078
|
-
const newValue = e.
|
|
8131
|
+
const newValue = e.currentTarget.value;
|
|
8079
8132
|
setInputValue(newValue);
|
|
8080
|
-
const
|
|
8081
|
-
|
|
8082
|
-
|
|
8133
|
+
const change = resolveTypedDate(newValue, displayFormat, minDate, maxDate);
|
|
8134
|
+
if (change.emit) {
|
|
8135
|
+
onChange(change.date);
|
|
8136
|
+
}
|
|
8083
8137
|
}, [displayFormat, minDate, maxDate, onChange]);
|
|
8084
8138
|
const handleInputBlur = useCallback(() => {
|
|
8085
8139
|
const trimmedValue = inputValue?.trim();
|
|
@@ -8109,9 +8163,10 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8109
8163
|
const isTodayValid = validate(today, minDate, maxDate);
|
|
8110
8164
|
if (isTodayValid) {
|
|
8111
8165
|
onChange(today);
|
|
8166
|
+
setInputValue(formatInputValue(today));
|
|
8112
8167
|
setIsOpen(false);
|
|
8113
8168
|
}
|
|
8114
|
-
}, [minDate, maxDate, onChange]);
|
|
8169
|
+
}, [formatInputValue, minDate, maxDate, onChange]);
|
|
8115
8170
|
// Derive start/end months for the year dropdown range, guarding against inverted yearRange props
|
|
8116
8171
|
const dropdownStartMonth = useMemo(() => {
|
|
8117
8172
|
const inferredStart = minDate ? minDate.year : Temporal.Now.plainDateISO().year - 10;
|
|
@@ -8136,7 +8191,7 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8136
8191
|
const defaultMonthJsDate = defaultMonth
|
|
8137
8192
|
? new Date(defaultMonth.year, defaultMonth.month - 1, 1)
|
|
8138
8193
|
: selectedJsDate;
|
|
8139
|
-
return (jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsx(DayPicker, { mode: "single", selected: selectedJsDate, defaultMonth: defaultMonthJsDate, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8194
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsx(DayPicker, { mode: "single", selected: selectedJsDate, defaultMonth: defaultMonthJsDate, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8140
8195
|
today: new Date(),
|
|
8141
8196
|
}, modifiersClassNames: {
|
|
8142
8197
|
today: "rdp-day-today",
|
|
@@ -8423,7 +8478,12 @@ function useCwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime
|
|
|
8423
8478
|
};
|
|
8424
8479
|
}
|
|
8425
8480
|
|
|
8426
|
-
function CwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, nowLabel = "Now", locale = enGB, }) {
|
|
8481
|
+
function CwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, nowLabel = "Now", locale = enGB, feedback, ...dataAttributes }) {
|
|
8482
|
+
const feedbackMessages = feedback
|
|
8483
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
8484
|
+
: [];
|
|
8485
|
+
const feedbackId = useId();
|
|
8486
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
8427
8487
|
const picker = useCwDateTimePickerTemporal({
|
|
8428
8488
|
value,
|
|
8429
8489
|
onChange,
|
|
@@ -8432,7 +8492,7 @@ function CwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime, d
|
|
|
8432
8492
|
minTime,
|
|
8433
8493
|
maxTime,
|
|
8434
8494
|
});
|
|
8435
|
-
return jsx("div", { className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsx(CwDatePickerTemporal, { value: picker.date, onChange: picker.selectDate, minDate: picker.minDate, maxDate: picker.maxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition, locale: locale }), jsx(CwTimePicker, { value: picker.time, onChange: picker.selectTime, interval: timeInterval, minTime: picker.effectiveMinTime, maxTime: picker.effectiveMaxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsx(CwButton, { type: "button", variant: "outline", onClick: picker.selectNow, disabled: disabled, text: nowLabel }))] })] }) });
|
|
8495
|
+
return jsx("div", { ...dataAttributes, className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsx(CwDatePickerTemporal, { value: picker.date, onChange: picker.selectDate, minDate: picker.minDate, maxDate: picker.maxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition, locale: locale }), jsx(CwTimePicker, { value: picker.time, onChange: picker.selectTime, interval: timeInterval, minTime: picker.effectiveMinTime, maxTime: picker.effectiveMaxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsx(CwButton, { type: "button", variant: "outline", onClick: picker.selectNow, disabled: disabled, text: nowLabel }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) });
|
|
8436
8496
|
}
|
|
8437
8497
|
|
|
8438
8498
|
// dateRangePresetsTemporal.ts
|
|
@@ -8575,8 +8635,14 @@ const PRESET_LIBRARY_TEMPORAL = {
|
|
|
8575
8635
|
*/
|
|
8576
8636
|
const getPresetsByKeysTemporal = (keys) => keys.map((key) => PRESET_LIBRARY_TEMPORAL[key]).filter((preset) => preset !== undefined);
|
|
8577
8637
|
|
|
8578
|
-
function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, maxRangeDays, defaultMonth, labelProps, alignProps, placeholderFrom = "From date", placeholderTo = "To date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 2, locale = enGB, yearRangeStart, yearRangeEnd, showPresets = false, presetKeys, customPresets, }) {
|
|
8638
|
+
function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, maxRangeDays, defaultMonth, labelProps, alignProps, placeholderFrom = "From date", placeholderTo = "To date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 2, locale = enGB, yearRangeStart, yearRangeEnd, showPresets = false, presetKeys, customPresets, feedback, ...dataAttributes }) {
|
|
8579
8639
|
const [isOpen, setIsOpen] = useState(false);
|
|
8640
|
+
const feedbackMessages = feedback
|
|
8641
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
8642
|
+
: [];
|
|
8643
|
+
const feedbackId = useId();
|
|
8644
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
8645
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
8580
8646
|
const [inputFromValue, setInputFromValue] = useState("");
|
|
8581
8647
|
const [inputToValue, setInputToValue] = useState("");
|
|
8582
8648
|
const [rangeErrorMessage, setRangeErrorMessage] = useState(null);
|
|
@@ -8736,7 +8802,7 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8736
8802
|
const handleInputFromChange = useCallback((e) => {
|
|
8737
8803
|
const newValue = e.currentTarget.value;
|
|
8738
8804
|
setInputFromValue(newValue);
|
|
8739
|
-
const parsed = parseDate(newValue, displayFormat);
|
|
8805
|
+
const parsed = newValue.length >= TYPED_DATE_MIN_LENGTH ? parseDate(newValue, displayFormat) : undefined;
|
|
8740
8806
|
if (parsed) {
|
|
8741
8807
|
if (validate(parsed, minDate, maxDate) && validateRange(parsed, value?.to)) {
|
|
8742
8808
|
onChange({ from: parsed, to: value?.to });
|
|
@@ -8749,7 +8815,7 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8749
8815
|
const handleInputToChange = useCallback((e) => {
|
|
8750
8816
|
const newValue = e.currentTarget.value;
|
|
8751
8817
|
setInputToValue(newValue);
|
|
8752
|
-
const parsed = parseDate(newValue, displayFormat);
|
|
8818
|
+
const parsed = newValue.length >= TYPED_DATE_MIN_LENGTH ? parseDate(newValue, displayFormat) : undefined;
|
|
8753
8819
|
if (parsed) {
|
|
8754
8820
|
if (validate(parsed, minDate, maxDate) && validateRange(value?.from, parsed)) {
|
|
8755
8821
|
onChange({ from: value?.from, to: parsed });
|
|
@@ -8878,11 +8944,11 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8878
8944
|
const defaultMonthJsDate = defaultMonth
|
|
8879
8945
|
? new Date(defaultMonth.year, defaultMonth.month - 1, 1)
|
|
8880
8946
|
: (value?.from ? plainDateToJsDate(value.from) : undefined);
|
|
8881
|
-
return (jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, required: required, size: displayFormat.length, "data-focused": focusedInput === 'from' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, required: required, size: displayFormat.length, "data-focused": focusedInput === 'to' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsx(DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonthJsDate, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8947
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length, "data-focused": focusedInput === 'from' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length, "data-focused": focusedInput === 'to' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsx(DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonthJsDate, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8948
|
+
today: new Date(),
|
|
8949
|
+
}, modifiersClassNames: {
|
|
8950
|
+
today: "rdp-day-today",
|
|
8951
|
+
} })] }), jsx("div", { role: "alert", "aria-live": "polite", className: rangeStyles.rangeError, children: rangeErrorMessage })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
8886
8952
|
}
|
|
8887
8953
|
|
|
8888
8954
|
function dateFromPercentage(startDate, visibleDays, percentage) {
|
|
@@ -9025,7 +9091,7 @@ class OnClickContextMenu {
|
|
|
9025
9091
|
}
|
|
9026
9092
|
}
|
|
9027
9093
|
|
|
9028
|
-
var styles$3 = {"scheduler-header":"scheduler-header-module__scheduler-header__Y7SNV","scheduler-header-divisions":"scheduler-header-module__scheduler-header-divisions__1JrNe","scheduler-timeline-now":"scheduler-header-module__scheduler-timeline-now__naREv","scheduler-timeline-label":"scheduler-header-module__scheduler-timeline-label__mLVAp","scheduler-header-title":"scheduler-header-module__scheduler-header-title__Jzy94","scheduler-dates":"scheduler-header-module__scheduler-dates__O7ePQ","current-day":"scheduler-header-module__current-day__FpHiv","scheduler-hours":"scheduler-header-module__scheduler-hours__ZDCVj"};
|
|
9094
|
+
var styles$3 = {"scheduler-header":"scheduler-header-module__scheduler-header__Y7SNV","scheduler-header-divisions":"scheduler-header-module__scheduler-header-divisions__1JrNe","scheduler-timeline-now":"scheduler-header-module__scheduler-timeline-now__naREv","scheduler-timeline-label":"scheduler-header-module__scheduler-timeline-label__mLVAp","scheduler-header-title":"scheduler-header-module__scheduler-header-title__Jzy94","title-cell":"scheduler-header-module__title-cell__mz7Ki","title":"scheduler-header-module__title__TuJVn","scheduler-dates":"scheduler-header-module__scheduler-dates__O7ePQ","current-day":"scheduler-header-module__current-day__FpHiv","scheduler-hours":"scheduler-header-module__scheduler-hours__ZDCVj"};
|
|
9029
9095
|
|
|
9030
9096
|
const getNow$1 = (isUtc) => {
|
|
9031
9097
|
let now = new Date();
|
|
@@ -9087,7 +9153,7 @@ const SchedulerHeaderDivision = ({ topDivisions, bottomDivisions, classification
|
|
|
9087
9153
|
};
|
|
9088
9154
|
|
|
9089
9155
|
const HeaderTitle = ({ title, dividerText, width }) => {
|
|
9090
|
-
return (jsxs("div", { className: styles$3["scheduler-header-title"], style: { width: width }, children: [jsx("div", { children: jsx("
|
|
9156
|
+
return (jsxs("div", { className: styles$3["scheduler-header-title"], style: { width: width }, children: [jsx("div", { className: styles$3["title-cell"], children: jsx("span", { className: styles$3.title, children: title }) }), jsx("div", { children: jsx("span", { children: dividerText }) })] }));
|
|
9091
9157
|
};
|
|
9092
9158
|
|
|
9093
9159
|
const SchedulerHeader = ({ content, divisions, visibleDays, selectedDate, width, onEvent, timeLinePercentage, isUtc }) => {
|
|
@@ -9125,7 +9191,7 @@ function getStartEnd(day) {
|
|
|
9125
9191
|
};
|
|
9126
9192
|
}
|
|
9127
9193
|
|
|
9128
|
-
var styles$2 = {"hide-scrollbar":"new-scheduler-module__hide-scrollbar__33GG9","scheduler-event":"new-scheduler-module__scheduler-event__gphwn","scheduler-event-container":"new-scheduler-module__scheduler-event-container__-h1xm","time-marker":"new-scheduler-module__time-marker__2BejU","scheduler-event-text":"new-scheduler-module__scheduler-event-text__zjvd7"};
|
|
9194
|
+
var styles$2 = {"hide-scrollbar":"new-scheduler-module__hide-scrollbar__33GG9","scheduler-event":"new-scheduler-module__scheduler-event__gphwn","scheduler-event-container":"new-scheduler-module__scheduler-event-container__-h1xm","time-marker":"new-scheduler-module__time-marker__2BejU","color-bars":"new-scheduler-module__color-bars__MhMF7","scheduler-event-text":"new-scheduler-module__scheduler-event-text__zjvd7"};
|
|
9129
9195
|
|
|
9130
9196
|
const BackgroundEvent = ({ value, heightRem }) => {
|
|
9131
9197
|
const backColor = getHSLColor(value.color, value.alpha ?? 0.5);
|
|
@@ -9443,16 +9509,7 @@ const SchedulerEvent = ({ value, heightRem, onEvent, maxEventHeightRem }) => {
|
|
|
9443
9509
|
flex: 1,
|
|
9444
9510
|
alignItems: "center",
|
|
9445
9511
|
width: "100%",
|
|
9446
|
-
}, children: value.rectangleColors && value.rectangleColors.length > 0 ? (jsx("div", { style: {
|
|
9447
|
-
display: "flex",
|
|
9448
|
-
width: "100%",
|
|
9449
|
-
}, children: value.rectangleColors.map((item, i) => (jsx("div", { className: "cwellt_rectangle_indicator", style: {
|
|
9450
|
-
backgroundColor: item,
|
|
9451
|
-
flex: 1,
|
|
9452
|
-
height: "8px",
|
|
9453
|
-
margin: 0,
|
|
9454
|
-
padding: 0,
|
|
9455
|
-
} }, value.id + "_" + i))) })) : (value.name) })] }), value.isResizable && (jsx(EventSideDrag, { heightRem: effectiveHeight * 0.7, onStartEvent: () => {
|
|
9512
|
+
}, children: value.rectangleColors && value.rectangleColors.length > 0 ? (jsx("div", { className: styles$2["color-bars"], children: value.rectangleColors.map((item, i) => (jsx("div", { style: { backgroundColor: item } }, value.id + "_" + i))) })) : (value.name) })] }), value.isResizable && (jsx(EventSideDrag, { heightRem: effectiveHeight * 0.7, onStartEvent: () => {
|
|
9456
9513
|
onEvent(new OnRightDragStart(value.id));
|
|
9457
9514
|
} }))] }), value.primaryTimeMarkerColor && (jsx("div", { className: styles$2["time-marker"], style: {
|
|
9458
9515
|
backgroundColor: value.primaryTimeMarkerColor,
|
|
@@ -9850,6 +9907,8 @@ const groupByRowIdStable = (items, prev) => {
|
|
|
9850
9907
|
const Scheduler = (props) => {
|
|
9851
9908
|
const { header: headerContent, id, events: eventsState, backgroundEvents, indicatorRows: allIndicatorRows = [], contextMenuItems, EventComp, RowTitleComp, orderCategories = ["title"], useOrderCategory, onEvent, groupRowColors, rowHeaderWidth = 180, rowHeightRem = 1.75, maxEventHeightRem, } = props;
|
|
9852
9909
|
const BackgroundEventComp = props.BackgroundEventComp ?? BackgroundEvent;
|
|
9910
|
+
// Picked by prefix: a rest spread would also put every non-destructured prop on the DOM.
|
|
9911
|
+
const dataAttributes = Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith("data-")));
|
|
9853
9912
|
const [constraintElement, setConstraintElement] = useState(null);
|
|
9854
9913
|
const rows = useOrderCategory === false
|
|
9855
9914
|
? props.rows
|
|
@@ -9858,9 +9917,10 @@ const Scheduler = (props) => {
|
|
|
9858
9917
|
// const rowHeaderWidth = "180px";
|
|
9859
9918
|
const { selectedDate, visibleDays, isUtc, isHeaderVisible, visibleRows: stateVisibleRows } = props.state;
|
|
9860
9919
|
const events = useMemo(() => filterVisibleEvents(eventsState, selectedDate, visibleDays), [eventsState, selectedDate, visibleDays]);
|
|
9920
|
+
// The virtual list caches row sizes: anything getItemSize depends on must reset them.
|
|
9861
9921
|
useEffect(() => {
|
|
9862
9922
|
instanceRef.current?.resetAfterIndex(0);
|
|
9863
|
-
}, [orderCategories, props.rows.length, events, allIndicatorRows]);
|
|
9923
|
+
}, [orderCategories, props.rows.length, events, allIndicatorRows, rowHeightRem]);
|
|
9864
9924
|
// Bucket events / backgroundEvents / indicatorRows by rowId once per render
|
|
9865
9925
|
// instead of running events.filter() per row inside the row renderer.
|
|
9866
9926
|
// Reuse previous bucket arrays when their contents are unchanged so the
|
|
@@ -9975,7 +10035,7 @@ const Scheduler = (props) => {
|
|
|
9975
10035
|
return rowsNumber * effectiveRowHeight * pixelsInRem + indicatorPixels;
|
|
9976
10036
|
}, [rows, eventsByRow, indicatorRowsByRow, rowHeightRem]);
|
|
9977
10037
|
// Render
|
|
9978
|
-
return (jsx(TooltipConstraintContext.Provider, { value: constraintElement, children: jsxs("div", { ref: setConstraintElement, id: id, style: {
|
|
10038
|
+
return (jsx(TooltipConstraintContext.Provider, { value: constraintElement, children: jsxs("div", { ...dataAttributes, ref: setConstraintElement, id: id, style: {
|
|
9979
10039
|
position: "relative",
|
|
9980
10040
|
height: `${schedulerContentHeight + 4}rem`,
|
|
9981
10041
|
overflowY: "auto",
|