@cwellt_software/cwellt-reactjs-lib 1.6.1 → 1.6.3
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 +282 -199
- package/dist/index.css +2 -2
- package/dist/index.d.ts +96 -38
- package/dist/index.es.js +282 -199
- 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/tag-selector/CwTagSelector.d.ts.map +1 -1
- package/dist/src/components/control/choice/tag-selector/CwTagSelector.stories.d.ts +2 -0
- package/dist/src/components/control/choice/tag-selector/CwTagSelector.stories.d.ts.map +1 -1
- 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 +22 -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/DefaultRowHeader.d.ts +2 -0
- package/dist/src/components/custom/scheduler-new/presentation/components/row/DefaultRowHeader.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts +15 -0
- 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/custom/super-scheduler/PinRowHeader.d.ts +0 -1
- package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/src/components/display/data/table/CwTable.stories.d.ts +4 -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/card/CwCard.d.ts +2 -2
- package/dist/src/components/layout/card/CwCard.d.ts.map +1 -1
- package/dist/src/components/layout/card/CwCard.stories.d.ts +4 -2
- package/dist/src/components/layout/card/CwCard.stories.d.ts.map +1 -1
- 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 +3 -2
- 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 +89 -89
- package/dist/src/common/functions/lazy.d.ts +0 -13
- package/dist/src/common/functions/lazy.d.ts.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -194,7 +194,7 @@ function getContrastColor(color) {
|
|
|
194
194
|
return `hsl(${hsl.h}, ${contrastS}%, ${targetL}%)`;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
var styles$
|
|
197
|
+
var styles$A = {"cw-tooltip-content":"cw-tooltip-module__cw-tooltip-content__RZczd","cw-tooltip":"cw-tooltip-module__cw-tooltip__1KYig"};
|
|
198
198
|
|
|
199
199
|
// Constants
|
|
200
200
|
const margin$1 = 16;
|
|
@@ -484,7 +484,7 @@ const CwTooltipManager = () => {
|
|
|
484
484
|
if (!state.isVisible || !state.content) {
|
|
485
485
|
return null;
|
|
486
486
|
}
|
|
487
|
-
return reactDom.createPortal(jsxRuntime.jsx("div", { ref: tooltipRef, className: styles$
|
|
487
|
+
return reactDom.createPortal(jsxRuntime.jsx("div", { ref: tooltipRef, className: styles$A["cw-tooltip-content"], "data-position": actualPosition, "data-visible": state.isVisible, "data-inline": state.displayInline, style: {
|
|
488
488
|
top: `${tooltipPosition.top}px`,
|
|
489
489
|
left: `${tooltipPosition.left}px`,
|
|
490
490
|
opacity: (isPositioned && !isMeasuring) ? 1 : 0,
|
|
@@ -565,7 +565,7 @@ const CwTooltipNew = ({ children, content = null, position = "right", dissapears
|
|
|
565
565
|
React.useEffect(() => {
|
|
566
566
|
ensureTooltipManager();
|
|
567
567
|
}, []);
|
|
568
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$
|
|
568
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$A["cw-tooltip"], children: children }));
|
|
569
569
|
};
|
|
570
570
|
|
|
571
571
|
const SVG_ICONS = {
|
|
@@ -685,7 +685,7 @@ function resolveBadgeAria(label, loading, hasText) {
|
|
|
685
685
|
return hasText ? {} : { 'aria-hidden': 'true' };
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
-
var styles$
|
|
688
|
+
var styles$z = {"badge":"cw-badge-module__badge__PKlak"};
|
|
689
689
|
|
|
690
690
|
/**
|
|
691
691
|
* CwBadge - the small coloured circle with a number, used for alert and notification counts.
|
|
@@ -697,6 +697,13 @@ var styles$y = {"badge":"cw-badge-module__badge__PKlak"};
|
|
|
697
697
|
* Precedence: `loading` > `content` > `count` > dot. While loading the badge renders regardless
|
|
698
698
|
* of `showZero`, and the spinner replaces it - circle, background and padding come off.
|
|
699
699
|
*
|
|
700
|
+
* Overlaid on a `CwButton` (its `badge` prop), the corner offset is a public custom-property API,
|
|
701
|
+
* settable on the button, an ancestor, or the badge's own `style`:
|
|
702
|
+
* - `--badge-offset-x` - distance from the button's right edge (`right`). Default
|
|
703
|
+
* `calc(var(--cw-spacing-small) * -1)`.
|
|
704
|
+
* - `--badge-offset-y` - distance from the button's top edge (`top`). Default
|
|
705
|
+
* `calc(var(--cw-spacing-tiny) * -1)`, `-0.125rem` on a large icon button.
|
|
706
|
+
*
|
|
700
707
|
* @example
|
|
701
708
|
* <CwBadge count={3} color="danger" />
|
|
702
709
|
* <CwBadge count={0} showZero={false} />
|
|
@@ -704,7 +711,7 @@ var styles$y = {"badge":"cw-badge-module__badge__PKlak"};
|
|
|
704
711
|
* <CwBadge color="warning" label="Unresolved findings" />
|
|
705
712
|
* <CwBadge count={0} loading />
|
|
706
713
|
*/
|
|
707
|
-
const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'small', showZero = true, loading = false, max = 99, label, className = '', style, }) => {
|
|
714
|
+
const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'small', showZero = true, loading = false, max = 99, label, className = '', style, ...dataAttributes }) => {
|
|
708
715
|
// null counts as absent, so `content={null}` still renders a dot rather than an empty pill.
|
|
709
716
|
const hasContent = content !== undefined && content !== null;
|
|
710
717
|
if (!loading && !hasContent && count !== undefined && !showZero && normalizeBadgeCount(count) === 0) {
|
|
@@ -714,8 +721,8 @@ const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'sm
|
|
|
714
721
|
? formatBadgeCount(count, max)
|
|
715
722
|
: undefined;
|
|
716
723
|
const isDot = !loading && !hasContent && count === undefined;
|
|
717
|
-
const badgeClassNames = ['cw-badge', styles$
|
|
718
|
-
return (jsxRuntime.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 ? jsxRuntime.jsx(CwIcon, { iconId: "spinner", size: "small" }) : hasContent ? content : countText }));
|
|
724
|
+
const badgeClassNames = ['cw-badge', styles$z.badge, className].filter(Boolean).join(' ');
|
|
725
|
+
return (jsxRuntime.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 ? jsxRuntime.jsx(CwIcon, { iconId: "spinner", size: "small" }) : hasContent ? content : countText }));
|
|
719
726
|
};
|
|
720
727
|
|
|
721
728
|
const CW_DEFAULT_MESSAGE_DURATION = 2000;
|
|
@@ -1102,7 +1109,7 @@ function CwLoading({ isLoading = false, text = '', size = 'regular', iconPositio
|
|
|
1102
1109
|
return (jsxRuntime.jsxs("div", { "aria-busy": isLoading, className: "cw-loading-container", "data-children": !!children, children: [overlay, jsxRuntime.jsx("div", { className: "cw-loading-disabled-content", children: children })] }));
|
|
1103
1110
|
}
|
|
1104
1111
|
|
|
1105
|
-
var styles$
|
|
1112
|
+
var styles$y = {"skeleton":"cw-skeleton-module__skeleton__Jvx2x","group":"cw-skeleton-module__group__Cm8AU"};
|
|
1106
1113
|
|
|
1107
1114
|
/*
|
|
1108
1115
|
* Internal helper for skeleton allocations (CwSkeleton, tables, cards).
|
|
@@ -1144,8 +1151,8 @@ function CwSkeleton({ variant = 'text', width, height, count = 1, radius, gap })
|
|
|
1144
1151
|
};
|
|
1145
1152
|
// The un-hashed cw-skeleton / cw-skeleton-group classes carry no styles in the
|
|
1146
1153
|
// library - they are stable public hooks for exceptional external overrides.
|
|
1147
|
-
const skeletonClassName = ['cw-skeleton', styles$
|
|
1148
|
-
const groupClassName = ['cw-skeleton-group', styles$
|
|
1154
|
+
const skeletonClassName = ['cw-skeleton', styles$y.skeleton].filter(Boolean).join(' ');
|
|
1155
|
+
const groupClassName = ['cw-skeleton-group', styles$y.group].filter(Boolean).join(' ');
|
|
1149
1156
|
const lineCount = normalizeSkeletonCount(count, 1);
|
|
1150
1157
|
if (lineCount <= 1) {
|
|
1151
1158
|
return (jsxRuntime.jsx("span", { className: skeletonClassName, "data-variant": variant, "aria-hidden": "true", style: style }));
|
|
@@ -1157,7 +1164,7 @@ function CwSkeleton({ variant = 'text', width, height, count = 1, radius, gap })
|
|
|
1157
1164
|
return (jsxRuntime.jsx("span", { className: groupClassName, "aria-hidden": "true", style: groupStyle, children: skeletonElements }));
|
|
1158
1165
|
}
|
|
1159
1166
|
|
|
1160
|
-
var styles$
|
|
1167
|
+
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"};
|
|
1161
1168
|
|
|
1162
1169
|
/**
|
|
1163
1170
|
* CwProgress - a determinate or indeterminate progress bar.
|
|
@@ -1169,7 +1176,7 @@ var styles$w = {"progress":"cw-progress-module__progress__d-g2-","value":"cw-pro
|
|
|
1169
1176
|
* <CwProgress value={62} label="Import" color="success" />
|
|
1170
1177
|
* <CwProgress indeterminate label="Uploading" />
|
|
1171
1178
|
*/
|
|
1172
|
-
function CwProgress({ value, indeterminate = false, label, rightLabel, size = 'regular', layout = 'row', color = 'primary', monoValue = false, prominent = false, className }) {
|
|
1179
|
+
function CwProgress({ value, indeterminate = false, label, rightLabel, footer, size = 'regular', layout = 'row', color = 'primary', monoValue = false, prominent = false, className, style, ...dataAttributes }) {
|
|
1173
1180
|
const labelId = React.useId();
|
|
1174
1181
|
// Determinate: a missing or non-finite value is treated as 0 (never NaN), then
|
|
1175
1182
|
// clamped to [0,100] for aria-valuenow and the fill width. Indeterminate has no value.
|
|
@@ -1177,21 +1184,21 @@ function CwProgress({ value, indeterminate = false, label, rightLabel, size = 'r
|
|
|
1177
1184
|
? undefined
|
|
1178
1185
|
: Math.min(Math.max(Number.isFinite(value) ? value : 0, 0), 100);
|
|
1179
1186
|
const percent = clamped !== undefined ? Math.round(clamped) : undefined;
|
|
1180
|
-
const showValue = rightLabel
|
|
1181
|
-
const
|
|
1187
|
+
const showValue = rightLabel != null || (!indeterminate && percent !== undefined);
|
|
1188
|
+
const valueContent = rightLabel ?? (percent !== undefined ? `${percent}%` : '');
|
|
1182
1189
|
// The un-hashed cw-progress class carries no styles in the library - a stable
|
|
1183
1190
|
// public hook for exceptional external overrides only.
|
|
1184
|
-
const rootClassName = ['cw-progress', styles$
|
|
1185
|
-
const labelSpan = label ? jsxRuntime.jsx("span", { className: styles$
|
|
1186
|
-
const valueLabel = showValue ? (jsxRuntime.jsx("span", { className: styles$
|
|
1187
|
-
return (jsxRuntime.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) && (jsxRuntime.jsxs("header", { className: styles$
|
|
1191
|
+
const rootClassName = ['cw-progress', styles$x.progress, className].filter(Boolean).join(' ');
|
|
1192
|
+
const labelSpan = label ? jsxRuntime.jsx("span", { className: styles$x.label, id: labelId, children: label }) : null;
|
|
1193
|
+
const valueLabel = showValue ? (jsxRuntime.jsx("span", { className: styles$x.value, "data-mono": monoValue || undefined, children: valueContent })) : null;
|
|
1194
|
+
return (jsxRuntime.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) && (jsxRuntime.jsxs("header", { className: styles$x.header, children: [labelSpan, valueLabel] })), layout === 'row' && labelSpan, jsxRuntime.jsx("div", { className: styles$x.track, role: "progressbar", ...(label && { 'aria-labelledby': labelId }), ...(!indeterminate && percent !== undefined && {
|
|
1188
1195
|
'aria-valuenow': percent,
|
|
1189
1196
|
'aria-valuemin': 0,
|
|
1190
1197
|
'aria-valuemax': 100
|
|
1191
|
-
}), children: jsxRuntime.jsx("div", { className: styles$
|
|
1198
|
+
}), children: jsxRuntime.jsx("div", { className: styles$x.fill, style: !indeterminate && clamped !== undefined ? { width: `${clamped}%` } : undefined }) }), layout === 'row' && valueLabel, footer != null && jsxRuntime.jsx("footer", { className: styles$x.footer, children: footer })] }));
|
|
1192
1199
|
}
|
|
1193
1200
|
|
|
1194
|
-
var styles$
|
|
1201
|
+
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"};
|
|
1195
1202
|
|
|
1196
1203
|
// Constants moved outside to prevent recreation
|
|
1197
1204
|
const margin = 16;
|
|
@@ -1318,12 +1325,12 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1318
1325
|
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
|
|
1319
1326
|
setIsVisible(true);
|
|
1320
1327
|
}, showDelay);
|
|
1321
|
-
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$
|
|
1328
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$w["cw-generic-tooltip-content"]);
|
|
1322
1329
|
// Memoize tooltip content creation
|
|
1323
1330
|
const tooltipContent = React.useMemo(() => {
|
|
1324
1331
|
if (hide || !isVisible || !content)
|
|
1325
1332
|
return null;
|
|
1326
|
-
return reactDom.createPortal(jsxRuntime.jsx("div", { className: styles$
|
|
1333
|
+
return reactDom.createPortal(jsxRuntime.jsx("div", { className: styles$w["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, "data-inline": displayInline, style: {
|
|
1327
1334
|
position: 'fixed',
|
|
1328
1335
|
top: `${tooltipPosition.top}px`,
|
|
1329
1336
|
left: `${tooltipPosition.left}px`,
|
|
@@ -1338,7 +1345,7 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1338
1345
|
clearTooltipTimeout();
|
|
1339
1346
|
setIsVisible(false);
|
|
1340
1347
|
}, [clearTooltipTimeout]);
|
|
1341
|
-
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$
|
|
1348
|
+
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$w["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, children: [tooltipContent, children] }));
|
|
1342
1349
|
};
|
|
1343
1350
|
|
|
1344
1351
|
const CwButton = React.forwardRef(function CwButton({ text, variant = 'solid', color = 'primary', size = 'medium', iconPosition = 'left', pressed, className = '', icon = "", title, tooltipPosition = "bottom", badge, children, ...buttonProps }, ref) {
|
|
@@ -1406,7 +1413,7 @@ function CwModal(custModalProps) {
|
|
|
1406
1413
|
return (jsxRuntime.jsx("div", { children: custModalProps.modalState && (jsxRuntime.jsxs("div", { className: custModalProps.classNameModalOverlay + " cwelltModalOverlay", children: [jsxRuntime.jsx("div", { className: "cwelltModalOverlayBg", onClick: custModalProps.onCloseModal }), jsxRuntime.jsx(Draggable, { disabled: isModalDisabled, axis: "both", nodeRef: draggableRef, children: jsxRuntime.jsxs("div", { className: custModalProps.classNameModal + " cwelltContainerModal", ref: draggableRef, style: widthModalDef !== "40em" ? modalStyle.widthCustomStyle : modalStyle.widthDefStyle, children: [jsxRuntime.jsxs("div", { className: "cwelltModalHeader", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsxRuntime.jsx("div", { className: "cwelltModalTitle", children: custModalProps.titleModal }), jsxRuntime.jsx("button", { className: "cwelltBtnCloseModal", onClick: custModalProps.onCloseModal, children: jsxRuntime.jsx("span", { className: "cwelltCloseIcon" }) })] }), jsxRuntime.jsx("div", { className: "cwelltModalBody", children: jsxRuntime.jsx("div", { className: "cwelltContainerModalBody", style: { position: "relative" }, children: custModalProps.children }) }), isHide === false ? (jsxRuntime.jsx("footer", { className: "legacy-modal-footer", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: custModalProps.onSaveModal, form: custModalProps.formSaveModal, hidden: custModalProps.HideBtnModal, type: custModalProps.HtmlSubmitModal }) })) : (jsxRuntime.jsx("div", { style: { display: "none" } }))] }) })] })) }));
|
|
1407
1414
|
}
|
|
1408
1415
|
|
|
1409
|
-
var styles$
|
|
1416
|
+
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"};
|
|
1410
1417
|
|
|
1411
1418
|
/**
|
|
1412
1419
|
* Small anchored confirmation for a destructive action.
|
|
@@ -1475,15 +1482,15 @@ function CwConfirmationPopup(props) {
|
|
|
1475
1482
|
onCancel();
|
|
1476
1483
|
}
|
|
1477
1484
|
};
|
|
1478
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderChildren(), isOpen && (jsxRuntime.jsx("div", { className: styles$
|
|
1485
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderChildren(), isOpen && (jsxRuntime.jsx("div", { className: styles$v.overlayPositioned, onClick: handleOverlayClick, children: jsxRuntime.jsxs("div", { ref: popupRef, className: styles$v.popup, style: {
|
|
1479
1486
|
position: 'absolute',
|
|
1480
1487
|
top: `${position.top}px`,
|
|
1481
1488
|
left: `${position.left}px`,
|
|
1482
1489
|
transform: 'none'
|
|
1483
|
-
}, children: [jsxRuntime.jsx("p", { className: styles$
|
|
1490
|
+
}, children: [jsxRuntime.jsx("p", { className: styles$v.message, children: message }), jsxRuntime.jsxs("div", { className: styles$v.buttons, children: [jsxRuntime.jsx("button", { className: `${styles$v.button} ${styles$v.confirmButton}`, onClick: onConfirm, children: confirmText }), jsxRuntime.jsx("button", { className: `${styles$v.button} ${styles$v.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
|
|
1484
1491
|
}
|
|
1485
1492
|
|
|
1486
|
-
var styles$
|
|
1493
|
+
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"};
|
|
1487
1494
|
|
|
1488
1495
|
// Helper function to parse size values
|
|
1489
1496
|
const parseSize = (size) => {
|
|
@@ -1756,7 +1763,7 @@ const CwDialog = props => {
|
|
|
1756
1763
|
}
|
|
1757
1764
|
}
|
|
1758
1765
|
}, [open]);
|
|
1759
|
-
const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$
|
|
1766
|
+
const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$u["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
|
|
1760
1767
|
const content = React.useMemo(() => (jsxRuntime.jsx("section", { children: children })), [children]);
|
|
1761
1768
|
const footer = React.useMemo(() => (jsxRuntime.jsx("footer", { children: customFooter || (jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: onSave, tooltipPosition: "top", disabled: disableSave, "data-testid": "cw-dialog-save" })) })), [customFooter, onSave, disableSave]);
|
|
1762
1769
|
const resizeHandles = React.useMemo(() => size.autoHeight
|
|
@@ -1783,7 +1790,7 @@ const CwDialog = props => {
|
|
|
1783
1790
|
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
1784
1791
|
return { displayWidth, displayHeight };
|
|
1785
1792
|
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
1786
|
-
const dialogContent = (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$
|
|
1793
|
+
const dialogContent = (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$u["cw-dialog-main"], onMouseDown: handleScrimMouseDown, onMouseUp: handleScrimMouseUpOrLeave, onMouseLeave: handleScrimMouseUpOrLeave, "data-pressing": isPressingScrim, children: jsxRuntime.jsxs("dialog", { ...domProps, ref: dialogRef, style: {
|
|
1787
1794
|
left: `${position.x}px`,
|
|
1788
1795
|
top: `${position.y}px`,
|
|
1789
1796
|
width: displayDimensions.displayWidth,
|
|
@@ -1945,7 +1952,7 @@ function CwAlign(props) {
|
|
|
1945
1952
|
}, children: props.children }));
|
|
1946
1953
|
}
|
|
1947
1954
|
|
|
1948
|
-
var styles$
|
|
1955
|
+
var styles$t = {"card":"cw-card-module__card__HJUT0","content":"cw-card-module__content__ma9qy","clickable":"cw-card-module__clickable__Y-V3X","disabled":"cw-card-module__disabled__0wHh1","headerContent":"cw-card-module__headerContent__x4Jfl","footerTags":"cw-card-module__footerTags__80sSW"};
|
|
1949
1956
|
|
|
1950
1957
|
/**
|
|
1951
1958
|
* CwCard - A simple card component for displaying content in a contained format
|
|
@@ -1958,8 +1965,8 @@ var styles$s = {"card":"cw-card-module__card__HJUT0","clickable":"cw-card-module
|
|
|
1958
1965
|
* onDelete={confirmDeletion}
|
|
1959
1966
|
* footer="Last updated: 2 days ago"
|
|
1960
1967
|
* chips={[
|
|
1961
|
-
* { label: 'Important',
|
|
1962
|
-
* { label: 'Custom',
|
|
1968
|
+
* { label: 'Important', color: 'danger' },
|
|
1969
|
+
* { label: 'Custom', color: 'custom', customColor: '#8a2be2' }
|
|
1963
1970
|
* ]}
|
|
1964
1971
|
* >
|
|
1965
1972
|
* <p>This is the main content of the card.</p>
|
|
@@ -1971,10 +1978,10 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1971
1978
|
// Construct class names using CSS modules
|
|
1972
1979
|
const cardClassNames = [
|
|
1973
1980
|
'cw-card',
|
|
1974
|
-
styles$
|
|
1981
|
+
styles$t.card,
|
|
1975
1982
|
className,
|
|
1976
|
-
clickable ? styles$
|
|
1977
|
-
disabled ? styles$
|
|
1983
|
+
clickable ? styles$t.clickable : '',
|
|
1984
|
+
disabled ? styles$t.disabled : '',
|
|
1978
1985
|
].filter(Boolean).join(' ');
|
|
1979
1986
|
// Handle click event when card is clickable
|
|
1980
1987
|
const handleClick = () => {
|
|
@@ -1992,15 +1999,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1992
1999
|
const hasFooter = hasChips || footer || (hasActions && resolvedDirection === "row");
|
|
1993
2000
|
// Actions component to reuse. While loading, each provided action renders a circular
|
|
1994
2001
|
// ghost sized to the CwButton icon footprint (2rem) - no interactive buttons.
|
|
1995
|
-
const ActionsComponent = hasActions && !disabled ? (jsxRuntime.jsx("div", { className: styles$
|
|
2002
|
+
const ActionsComponent = hasActions && !disabled ? (jsxRuntime.jsx("div", { className: styles$t.actions, children: isLoading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [extraActions && jsxRuntime.jsx(CwSkeleton, { variant: "circle", height: "2rem" }), onEdit && jsxRuntime.jsx(CwSkeleton, { variant: "circle", height: "2rem" }), onDelete && jsxRuntime.jsx(CwSkeleton, { variant: "circle", height: "2rem" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [extraActions ?? null, onEdit && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) })) : null;
|
|
1996
2003
|
return (jsxRuntime.jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && !isLoading && {
|
|
1997
2004
|
role: 'button',
|
|
1998
2005
|
tabIndex: 0,
|
|
1999
2006
|
onClick: handleClick,
|
|
2000
|
-
}), "data-variant": variant, "data-direction": resolvedDirection, "aria-busy": isLoading || undefined, children: [isLoading ? (jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx("div", { className: styles$
|
|
2007
|
+
}), "data-variant": variant, "data-direction": resolvedDirection, "aria-busy": isLoading || undefined, children: [isLoading ? (jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx("div", { className: styles$t.headerContent, "data-align": resolvedAlign, children: jsxRuntime.jsx(CwSkeleton, { width: "8rem", height: "1.5em" }) }), resolvedDirection === "column" && ActionsComponent] })) : (hasHeader && (jsxRuntime.jsxs("header", { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: styles$t.headerContent, "data-align": resolvedAlign, children: [title && jsxRuntime.jsx("h5", { children: title }), subtitle && jsxRuntime.jsx("strong", { children: subtitle })] })), resolvedDirection === "column" && ActionsComponent] }))), jsxRuntime.jsx("div", { className: styles$t.content, children: isLoading ? jsxRuntime.jsx(CwSkeleton, { count: normalizeSkeletonCount(skeletonLines, 3) }) : children }), hasFooter && (isLoading ? (jsxRuntime.jsx("footer", { children: jsxRuntime.jsx("div", { className: styles$t.footerTags, children: jsxRuntime.jsx(CwSkeleton, { variant: "rect", width: "4rem", height: "1.5em", radius: "1rem" }) }) })) : (jsxRuntime.jsxs("footer", { children: [hasChips && (jsxRuntime.jsx("div", { className: styles$t.footerTags, children: chips.map((chip, index) => (jsxRuntime.jsx(CwChip, { label: chip.label, color: chip.color, colorScheme: chip.colorScheme, className: styles$t.chip, ...(chip.customColor && { customColor: chip.customColor }), ...(chip.variant && { variant: chip.variant }), ...(chip.icon && { icon: chip.icon }) }, index))) })), footer && (jsxRuntime.jsx("div", { className: styles$t.footerContent, children: footer }))] }))), resolvedDirection === "row" && ActionsComponent] }));
|
|
2001
2008
|
};
|
|
2002
2009
|
|
|
2003
|
-
var styles$
|
|
2010
|
+
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"};
|
|
2004
2011
|
|
|
2005
2012
|
/**
|
|
2006
2013
|
* Option to display in the CwSelect
|
|
@@ -2095,10 +2102,10 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
|
|
|
2095
2102
|
icon: sortDirection === 'asc' ? 'arrow-up' : 'arrow-down',
|
|
2096
2103
|
onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'),
|
|
2097
2104
|
title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}`,
|
|
2098
|
-
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsxRuntime.jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsxRuntime.jsx("div", { className: `${styles$
|
|
2105
|
+
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsxRuntime.jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsxRuntime.jsx("div", { className: `${styles$s.cardContainer}`, "data-layout": layout, style: gridStyle, "aria-busy": true, children: Array.from({ length: normalizeSkeletonCount(skeletonCards, 6) }, (_, index) => (jsxRuntime.jsx(CwCard, { isLoading: true, children: null }, `skeleton_${index}`))) })) : sortedItems.length === 0 ? (jsxRuntime.jsx("div", { className: styles$s.emptyState, children: emptyState || jsxRuntime.jsx("p", { children: "No items to display" }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `${styles$s.cardContainer}`, "data-layout": layout, style: gridStyle, children: visibleItems.map((item, index) => (jsxRuntime.jsx(React.Fragment, { children: renderCard(item, index) }, keyExtractor ? keyExtractor(item, index) : index))) }), totalPages > 1 && (jsxRuntime.jsxs("div", { className: styles$s.pagination, children: [jsxRuntime.jsx(CwButton, { variant: "icon", icon: "chevron-left", disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)) }), jsxRuntime.jsxs("span", { className: styles$s.pageInfo, children: [currentPage, " / ", totalPages] }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "chevron-right", disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)) })] }))] }))] }));
|
|
2099
2106
|
}
|
|
2100
2107
|
|
|
2101
|
-
var styles$
|
|
2108
|
+
var styles$r = {"cw-accordion":"cw-accordion-module__cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module__cw-accordion-body__xlI8b"};
|
|
2102
2109
|
|
|
2103
2110
|
/**
|
|
2104
2111
|
* Legacy collapsible section with its own header markup.
|
|
@@ -2113,7 +2120,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
2113
2120
|
setVisible_accordionBody(!isVisible_accordionBody);
|
|
2114
2121
|
};
|
|
2115
2122
|
// #endregion
|
|
2116
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
2123
|
+
return (jsxRuntime.jsxs("div", { className: styles$r["cw-accordion"], style: CwelltAccordionContainerProps.style, "data-open": isVisible_accordionBody, children: [jsxRuntime.jsxs("header", { onClick: () => showAccordionBody(), children: [jsxRuntime.jsx("div", { children: CwelltAccordionContainerProps.desc_text }), jsxRuntime.jsx("button", { className: "cw-button-icon" })] }), jsxRuntime.jsx("div", { className: styles$r["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
|
|
2117
2124
|
}
|
|
2118
2125
|
|
|
2119
2126
|
/*
|
|
@@ -2214,9 +2221,6 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2214
2221
|
return acc;
|
|
2215
2222
|
}, {}));
|
|
2216
2223
|
const [selectedKeys, setSelectedKeys] = React.useState(new Set(rowSelection?.selectedRowKeys || []));
|
|
2217
|
-
React.useEffect(() => {
|
|
2218
|
-
setCurrentPage(1);
|
|
2219
|
-
}, [data]);
|
|
2220
2224
|
React.useEffect(() => {
|
|
2221
2225
|
setSelectedKeys(new Set(rowSelection?.selectedRowKeys || []));
|
|
2222
2226
|
}, [rowSelection?.selectedRowKeys]);
|
|
@@ -2302,20 +2306,27 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2302
2306
|
return newSet;
|
|
2303
2307
|
});
|
|
2304
2308
|
}, [rowSelection, rowKey, sortedData]);
|
|
2309
|
+
const totalPages = React.useMemo(() => {
|
|
2310
|
+
return pagination ? Math.ceil(sortedData.length / localItemsPerPage) : 1;
|
|
2311
|
+
}, [sortedData, localItemsPerPage, pagination]);
|
|
2312
|
+
// Keep the page when data changes (e.g. a row was edited); only clamp it when it no longer exists.
|
|
2313
|
+
// Derived in render so a shrunk data set never shows an empty page for a frame.
|
|
2314
|
+
const page = Math.min(currentPage, Math.max(1, totalPages));
|
|
2315
|
+
React.useEffect(() => {
|
|
2316
|
+
if (page !== currentPage)
|
|
2317
|
+
setCurrentPage(page);
|
|
2318
|
+
}, [page, currentPage]);
|
|
2305
2319
|
const paginatedData = React.useMemo(() => {
|
|
2306
2320
|
if (!sortedData)
|
|
2307
2321
|
return [];
|
|
2308
2322
|
if (!pagination)
|
|
2309
2323
|
return sortedData;
|
|
2310
|
-
const start = (
|
|
2324
|
+
const start = (page - 1) * localItemsPerPage;
|
|
2311
2325
|
return sortedData.slice(start, start + localItemsPerPage);
|
|
2312
|
-
}, [sortedData,
|
|
2313
|
-
const
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
const handlePageChange = (page) => {
|
|
2317
|
-
if (page >= 1 && page <= totalPages)
|
|
2318
|
-
setCurrentPage(page);
|
|
2326
|
+
}, [sortedData, page, localItemsPerPage, pagination]);
|
|
2327
|
+
const handlePageChange = (target) => {
|
|
2328
|
+
if (target >= 1 && target <= totalPages)
|
|
2329
|
+
setCurrentPage(target);
|
|
2319
2330
|
};
|
|
2320
2331
|
const startResize = (e, key) => {
|
|
2321
2332
|
e.preventDefault();
|
|
@@ -2376,7 +2387,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2376
2387
|
? "sortable"
|
|
2377
2388
|
: sortConfig.direction === "asc"
|
|
2378
2389
|
? "sortable-asc"
|
|
2379
|
-
: "sortable-desc" }))] }), jsxRuntime.jsx("span", { onMouseDown: (e) => startResize(e, col.key), className: "th-column-resizer" })] }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderTableBody() })] }), pagination && data.length > pageSizeOptions[0] && (jsxRuntime.jsxs("footer", { className: "cw-table-pagination", children: [jsxRuntime.jsxs("div", { className: "cw-table-pagination-size", children: [jsxRuntime.jsx(CwIcon, { iconId: "list" }), jsxRuntime.jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, children: pageSizeOptions.map(size => (jsxRuntime.jsx("option", { value: size, children: pageLabel ? `${size} / ${pageLabel}` : size }, size))) })] }), jsxRuntime.jsxs("div", { className: "cw-table-pagination-nav", children: [jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(1), disabled:
|
|
2390
|
+
: "sortable-desc" }))] }), jsxRuntime.jsx("span", { onMouseDown: (e) => startResize(e, col.key), className: "th-column-resizer" })] }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderTableBody() })] }), pagination && data.length > pageSizeOptions[0] && (jsxRuntime.jsxs("footer", { className: "cw-table-pagination", children: [jsxRuntime.jsxs("div", { className: "cw-table-pagination-size", children: [jsxRuntime.jsx(CwIcon, { iconId: "list" }), jsxRuntime.jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, children: pageSizeOptions.map(size => (jsxRuntime.jsx("option", { value: size, children: pageLabel ? `${size} / ${pageLabel}` : size }, size))) })] }), jsxRuntime.jsxs("div", { className: "cw-table-pagination-nav", children: [jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(1), disabled: page === 1 || totalPages <= 1, variant: "icon", icon: "chevron-left-double" }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(page - 1), disabled: page === 1 || totalPages <= 1, variant: "icon", icon: "chevron-left" }), jsxRuntime.jsx("input", { type: "text", inputMode: "numeric", value: totalPages === 0 ? 0 : page, disabled: totalPages === 0, onChange: (e) => {
|
|
2380
2391
|
const value = parseInt(e.target.value, 10);
|
|
2381
2392
|
if (!isNaN(value))
|
|
2382
2393
|
handlePageChange(value);
|
|
@@ -2385,10 +2396,10 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2385
2396
|
if (isNaN(value) || value < 1 || value > totalPages) {
|
|
2386
2397
|
handlePageChange(1);
|
|
2387
2398
|
}
|
|
2388
|
-
}, min: 1, max: totalPages }), jsxRuntime.jsx("span", { children: "/" }), jsxRuntime.jsx("span", { children: totalPages }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(
|
|
2399
|
+
}, min: 1, max: totalPages }), jsxRuntime.jsx("span", { children: "/" }), jsxRuntime.jsx("span", { children: totalPages }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(page + 1), disabled: page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2389
2400
|
}
|
|
2390
2401
|
|
|
2391
|
-
var styles$
|
|
2402
|
+
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"};
|
|
2392
2403
|
|
|
2393
2404
|
/**
|
|
2394
2405
|
* Hook that provides state management for CwSortableTable.
|
|
@@ -2451,7 +2462,7 @@ function useSortableTable(initialItems) {
|
|
|
2451
2462
|
}
|
|
2452
2463
|
|
|
2453
2464
|
// ─── Drop indicator row ───────────────────────────────────────────────────────
|
|
2454
|
-
const DropIndicatorRow = ({ colSpan }) => (jsxRuntime.jsx("tr", { className: styles$
|
|
2465
|
+
const DropIndicatorRow = ({ colSpan }) => (jsxRuntime.jsx("tr", { className: styles$q.dropIndicator, "aria-hidden": true, children: jsxRuntime.jsx("td", { colSpan: colSpan, children: jsxRuntime.jsx("div", {}) }) }));
|
|
2455
2466
|
// ─── Loading skeleton ─────────────────────────────────────────────────────────
|
|
2456
2467
|
// Plain td cells (no local class): the ghost cells get the same global cw-table
|
|
2457
2468
|
// padding as real body cells, so row heights match the loaded rows exactly.
|
|
@@ -2554,11 +2565,11 @@ function CwSortableTable({ columns, data, rowKey = "key", onReorder, loading = f
|
|
|
2554
2565
|
return items.map((item, index) => {
|
|
2555
2566
|
const key = item[rowKey];
|
|
2556
2567
|
const isDragging = draggedItem?.[rowKey] === key;
|
|
2557
|
-
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && (jsxRuntime.jsx(DropIndicatorRow, { colSpan: totalCols })), jsxRuntime.jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$
|
|
2568
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && (jsxRuntime.jsx(DropIndicatorRow, { colSpan: totalCols })), jsxRuntime.jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$q.dragging : "", children: [showHandle && (jsxRuntime.jsx("td", { className: "cw-table-col-action", children: jsxRuntime.jsx(CwIcon, { iconId: "grip-dots", color: "neutral", style: { opacity: 0.75 } }) })), columns.map(col => (jsxRuntime.jsx("td", { className: col.className ?? "", style: col.width ? { width: col.width } : undefined, children: renderCell(item, col) }, `${String(key)}_${col.key}`)))] }), index === items.length - 1 && dropIndicatorIndex === items.length && (jsxRuntime.jsx(DropIndicatorRow, { colSpan: totalCols }))] }, String(key)));
|
|
2558
2569
|
});
|
|
2559
2570
|
};
|
|
2560
2571
|
// ── Render ──────────────────────────────────────────────────────────────
|
|
2561
|
-
return (jsxRuntime.jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, "aria-busy": loading || undefined, children: [jsxRuntime.jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsxRuntime.jsx("thead", { children: jsxRuntime.jsxs("tr", { children: [showHandle && jsxRuntime.jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsxRuntime.jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderBody() })] }), !loading && hasChanges && (jsxRuntime.jsxs("footer", { className: styles$
|
|
2572
|
+
return (jsxRuntime.jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, "aria-busy": loading || undefined, children: [jsxRuntime.jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsxRuntime.jsx("thead", { children: jsxRuntime.jsxs("tr", { children: [showHandle && jsxRuntime.jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsxRuntime.jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderBody() })] }), !loading && hasChanges && (jsxRuntime.jsxs("footer", { className: styles$q.saveBar, children: [jsxRuntime.jsx(CwButton, { variant: "outline", color: "neutral", icon: "undo", text: discardLabel, onClick: handleDiscard }), jsxRuntime.jsx(CwButton, { variant: "solid", color: "primary", icon: "save", text: saveLabel, onClick: () => handleSave(onReorder) })] }))] }));
|
|
2562
2573
|
}
|
|
2563
2574
|
|
|
2564
2575
|
/**
|
|
@@ -2759,7 +2770,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
2759
2770
|
}, min: 1, max: totalPages }), jsxRuntime.jsx("span", { children: "/" }), jsxRuntime.jsx("span", { children: totalPages }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(state.page + 1), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsxRuntime.jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2760
2771
|
}
|
|
2761
2772
|
|
|
2762
|
-
var styles$
|
|
2773
|
+
var styles$p = {"cw-tabs":"cw-tabs-module__cw-tabs__1pmji","cw-tabs-content":"cw-tabs-module__cw-tabs-content__HTp8d"};
|
|
2763
2774
|
|
|
2764
2775
|
const BADGE_COLOR_SCHEMES = ['primary', 'danger', 'warning', 'success', 'info', 'neutral'];
|
|
2765
2776
|
function isBadgeColorScheme(value) {
|
|
@@ -2813,11 +2824,11 @@ function CwTabs(CwTabsProps) {
|
|
|
2813
2824
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
2814
2825
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
2815
2826
|
: undefined;
|
|
2816
|
-
return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$
|
|
2827
|
+
return (jsxRuntime.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: [jsxRuntime.jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => {
|
|
2817
2828
|
const badgeScheme = tab.badgeColor && isBadgeColorScheme(tab.badgeColor) ? tab.badgeColor : undefined;
|
|
2818
2829
|
const rawBadgeColor = tab.badgeColor && !badgeScheme ? tab.badgeColor : undefined;
|
|
2819
2830
|
return (jsxRuntime.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: [jsxRuntime.jsx(TabIcon, { icon: tab.icon }), tab.title, (tab.badge !== undefined || tab.badgeColor) && (jsxRuntime.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));
|
|
2820
|
-
}) }), jsxRuntime.jsx("div", { className: styles$
|
|
2831
|
+
}) }), jsxRuntime.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 })] }));
|
|
2821
2832
|
}
|
|
2822
2833
|
|
|
2823
2834
|
/**
|
|
@@ -2845,7 +2856,7 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
2845
2856
|
return (jsxRuntime.jsxs("details", { ref: myRef, ...detailsProps, className: "cw-expandable", children: [jsxRuntime.jsx("summary", { children: briefing }), children && jsxRuntime.jsx("section", { children: children })] }));
|
|
2846
2857
|
};
|
|
2847
2858
|
|
|
2848
|
-
var styles$
|
|
2859
|
+
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"};
|
|
2849
2860
|
|
|
2850
2861
|
/*
|
|
2851
2862
|
* Fixed rem widths for the ghosts: the master rows and detail panel size their
|
|
@@ -2889,12 +2900,12 @@ const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, de
|
|
|
2889
2900
|
document.body.style.userSelect = '';
|
|
2890
2901
|
};
|
|
2891
2902
|
}, [isResizing, minMasterWidth, maxMasterWidth]);
|
|
2892
|
-
const rootClassName = [styles$
|
|
2903
|
+
const rootClassName = [styles$o['cw-master-detail'], className].filter(Boolean).join(' ');
|
|
2893
2904
|
return (jsxRuntime.jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, "aria-busy": loading || undefined, children: [jsxRuntime.jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsxRuntime.jsx("search", { children: jsxRuntime.jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsxRuntime.jsx("header", { children: masterHeader })), jsxRuntime.jsx("ul", { children: loading
|
|
2894
|
-
? Array.from({ length: skeletonRows }, (_unused, rowIndex) => (jsxRuntime.jsxs("li", { "aria-hidden": "true", children: [jsxRuntime.jsx(CwSkeleton, { variant: "circle", height: "2rem" }), jsxRuntime.jsxs("div", { className: styles$
|
|
2895
|
-
: items.map((item) => (jsxRuntime.jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsxRuntime.jsx("footer", { children: masterFooter }))] }), resizable && (jsxRuntime.jsx("div", { className: styles$
|
|
2905
|
+
? Array.from({ length: skeletonRows }, (_unused, rowIndex) => (jsxRuntime.jsxs("li", { "aria-hidden": "true", children: [jsxRuntime.jsx(CwSkeleton, { variant: "circle", height: "2rem" }), jsxRuntime.jsxs("div", { className: styles$o.skeletonRow, children: [jsxRuntime.jsx(CwSkeleton, { variant: "text", width: MASTER_TITLE_WIDTHS[rowIndex % MASTER_TITLE_WIDTHS.length] }), jsxRuntime.jsx(CwSkeleton, { variant: "text", width: MASTER_SUBTITLE_WIDTH })] })] }, `skeleton_${rowIndex}`)))
|
|
2906
|
+
: items.map((item) => (jsxRuntime.jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsxRuntime.jsx("footer", { children: masterFooter }))] }), resizable && (jsxRuntime.jsx("div", { className: styles$o.resizer, "data-resizing": isResizing, onMouseDown: handleMouseDown })), jsxRuntime.jsx("section", { className: styles$o.detail, children: loading ? (jsxRuntime.jsxs("div", { className: styles$o.detailSkeleton, "aria-hidden": "true", children: [jsxRuntime.jsx(CwSkeleton, { variant: "text", width: "14rem", height: "1.5em" }), jsxRuntime.jsx(CwSkeleton, { variant: "text", width: "22rem" }), jsxRuntime.jsx(CwSkeleton, { variant: "text", width: "18rem" }), jsxRuntime.jsx(CwSkeleton, { variant: "text", width: "20rem" })] })) : selectedKey && detailContent
|
|
2896
2907
|
? detailContent
|
|
2897
|
-
: (jsxRuntime.jsx("div", { className: styles$
|
|
2908
|
+
: (jsxRuntime.jsx("div", { className: styles$o['detail-empty'], children: emptyDetail ?? 'Select an item to view details' })) })] }));
|
|
2898
2909
|
};
|
|
2899
2910
|
|
|
2900
2911
|
/*
|
|
@@ -2934,7 +2945,7 @@ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "
|
|
|
2934
2945
|
return (jsxRuntime.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() }));
|
|
2935
2946
|
};
|
|
2936
2947
|
|
|
2937
|
-
var styles$
|
|
2948
|
+
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"};
|
|
2938
2949
|
|
|
2939
2950
|
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, maxHeight = "300px", }) {
|
|
2940
2951
|
const [draggedItem, setDraggedItem] = React.useState(null);
|
|
@@ -2997,15 +3008,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
|
|
|
2997
3008
|
}
|
|
2998
3009
|
};
|
|
2999
3010
|
if (items.length === 0) {
|
|
3000
|
-
return (jsxRuntime.jsx("div", { className: `${styles$
|
|
3011
|
+
return (jsxRuntime.jsx("div", { className: `${styles$n.sortableList} ${styles$n.emptyState} ${className}`, children: jsxRuntime.jsx("div", { className: styles$n.emptyMessage, children: emptyMessage }) }));
|
|
3001
3012
|
}
|
|
3002
|
-
return (jsxRuntime.jsx("div", { className: `${styles$
|
|
3013
|
+
return (jsxRuntime.jsx("div", { className: `${styles$n.sortableList} ${className}`, style: { maxHeight }, children: items.map((item, index) => {
|
|
3003
3014
|
const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
|
|
3004
3015
|
const isDragging = draggedItem?.id === item.id;
|
|
3005
3016
|
const isMoved = movedItems.has(item.id);
|
|
3006
3017
|
const canExpand = Boolean(expandedContent);
|
|
3007
3018
|
const isExpanded = expandedItems.has(item.id);
|
|
3008
|
-
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && jsxRuntime.jsx("div", { className: styles$
|
|
3019
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && jsxRuntime.jsx("div", { className: styles$n.dropIndicator }), jsxRuntime.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: [jsxRuntime.jsxs("header", { children: [canExpand ? (jsxRuntime.jsx(CwButton, { variant: "icon", onClick: () => toggleExpanded(item.id), type: "button", title: isExpanded ? "Collapse" : "Expand", icon: isExpanded ? "chevron-up" : "chevron-down" })) : showHandle ? (jsxRuntime.jsx("div", { className: styles$n.sortableHandle, children: jsxRuntime.jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxRuntime.jsxs("div", { className: styles$n.sortableContent, children: [jsxRuntime.jsx("div", { className: styles$n.sortableTitle, children: title }), extraContent && jsxRuntime.jsx("div", { className: styles$n.sortableExtraContent, children: extraContent })] }), jsxRuntime.jsx("div", { className: styles$n.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsxRuntime.jsx("div", { className: styles$n.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsxRuntime.jsx("div", { className: styles$n.dropIndicator }))] }, item.id));
|
|
3009
3020
|
}) }));
|
|
3010
3021
|
}
|
|
3011
3022
|
|
|
@@ -3132,7 +3143,7 @@ const CwTableGrouped = props => {
|
|
|
3132
3143
|
group.rows.map((child, j) => (jsxRuntime.jsx("tr", { "data-row": true, "data-row-last-of-group": j == group.rows.length - 1, children: child.cells.map((cell, k) => (jsxRuntime.jsx("td", { children: cell.content }, k))) }, j)))] }, i))) }), jsxRuntime.jsx("tfoot", {})] }) }));
|
|
3133
3144
|
};
|
|
3134
3145
|
|
|
3135
|
-
var styles$
|
|
3146
|
+
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"};
|
|
3136
3147
|
|
|
3137
3148
|
const DEFAULT_LABELS$1 = {
|
|
3138
3149
|
uploadDisabled: 'Upload disabled',
|
|
@@ -3318,12 +3329,12 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3318
3329
|
}
|
|
3319
3330
|
}
|
|
3320
3331
|
};
|
|
3321
|
-
return (jsxRuntime.jsxs("div", { className: `${styles$
|
|
3332
|
+
return (jsxRuntime.jsxs("div", { className: `${styles$m.fileUploadContainer} ${fileUploadProps.className}`, children: [jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", name: fileUploadProps.name, accept: fileUploadProps.accept, multiple: fileUploadProps.multiple, onChange: handleFileSelectInternal, disabled: fileUploadProps.disabled, "aria-label": "files", className: styles$m.hiddenInput }), selectedFiles.length === 0 && !existingFile ? (jsxRuntime.jsxs("div", { className: `${styles$m.uploadArea} ${fileUploadProps.disabled ? styles$m.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsxRuntime.jsx(CwIcon, { iconId: "upload" }), jsxRuntime.jsx("p", { className: `${styles$m.uploadTitle}`, children: fileUploadProps.disabled ? labels.uploadDisabled : labels.clickToUpload }), jsxRuntime.jsxs("p", { className: `${styles$m.uploadSubtitle}`, children: [fileUploadProps.accept ? labels.acceptedFiles(fileUploadProps.accept) : labels.allTypesAccepted, !fileUploadProps.multiple && ` ${labels.singleFileOnly}`] })] })) : selectedFiles.length === 0 && existingFile ? (jsxRuntime.jsxs("div", { className: styles$m.filesContainer, children: [jsxRuntime.jsxs("div", { className: styles$m.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$m.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$m.fileExtension, children: getFileExtension(existingFile) })] }), jsxRuntime.jsx("div", { className: styles$m.fileInfo, children: jsxRuntime.jsx("p", { className: styles$m.fileName, children: existingFile }) }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => {
|
|
3322
3333
|
setExistingFile(undefined);
|
|
3323
3334
|
if (fileUploadProps.onSelect) {
|
|
3324
3335
|
fileUploadProps.onSelect(null);
|
|
3325
3336
|
}
|
|
3326
|
-
}, disabled: fileUploadProps.disabled, className: styles$
|
|
3337
|
+
}, disabled: fileUploadProps.disabled, className: styles$m.smallButton })] }), jsxRuntime.jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled })] })) : (jsxRuntime.jsxs("div", { className: styles$m.filesContainer, children: [jsxRuntime.jsxs("header", { className: "cw-flex-row cw-align-between-center cw-flex-wrap", children: [jsxRuntime.jsx("small", { className: styles$m.filesCount, children: fileUploadProps.statusText ?? labels.filesSelected(selectedFiles.length) }), jsxRuntime.jsxs("div", { className: "cw-flex-row", children: [fileUploadProps.onConfirm && selectedFiles.length > 0 && (jsxRuntime.jsx(CwButton, { onClick: () => {
|
|
3327
3338
|
let files = fileInputRef.current?.files ?? null;
|
|
3328
3339
|
if (!files) {
|
|
3329
3340
|
const dataTransfer = new DataTransfer();
|
|
@@ -3331,7 +3342,7 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3331
3342
|
files = dataTransfer.files;
|
|
3332
3343
|
}
|
|
3333
3344
|
fileUploadProps.onConfirm?.(files);
|
|
3334
|
-
}, disabled: fileUploadProps.disabled || fileUploadProps.confirmDisabled, icon: "upload", text: fileUploadProps.confirmLabel ?? labels.upload })), !fileUploadProps.hideClearAll && (jsxRuntime.jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] })] }), selectedFiles.map((file, index) => (jsxRuntime.jsxs("div", { className: styles$
|
|
3345
|
+
}, disabled: fileUploadProps.disabled || fileUploadProps.confirmDisabled, icon: "upload", text: fileUploadProps.confirmLabel ?? labels.upload })), !fileUploadProps.hideClearAll && (jsxRuntime.jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] })] }), selectedFiles.map((file, index) => (jsxRuntime.jsxs("div", { className: styles$m.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$m.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$m.fileExtension, children: getFileExtension(file.name) })] }), jsxRuntime.jsxs("div", { className: styles$m.fileInfo, children: [jsxRuntime.jsx("p", { className: styles$m.fileName, children: file.name }), jsxRuntime.jsxs("p", { className: styles$m.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$m.smallButton })] }, `${file.name}-${file.size}`))), fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: labels.addMoreFiles, icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
|
|
3335
3346
|
}
|
|
3336
3347
|
|
|
3337
3348
|
/**
|
|
@@ -3384,7 +3395,7 @@ function CwDigit(props) {
|
|
|
3384
3395
|
return (jsxRuntime.jsxs("div", { className: "cw-input-text", "data-direction": labelProps ? flexDirection : "column", "data-feedback-position": feedbackPosition, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("div", { className: "cw-input-button", children: [jsxRuntime.jsx("input", { type: "number", ...inputProps, "aria-describedby": describedBy }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] })] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-info", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
3385
3396
|
}
|
|
3386
3397
|
|
|
3387
|
-
var styles$
|
|
3398
|
+
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"};
|
|
3388
3399
|
|
|
3389
3400
|
const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
|
|
3390
3401
|
const [rgb, setRgb] = React.useState({ r: 255, g: 255, b: 255 });
|
|
@@ -3587,13 +3598,13 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
|
|
|
3587
3598
|
// Calculate background color for the main area based on current hue
|
|
3588
3599
|
const hueColor = hsvToRgb(hsv.h, 100, 100);
|
|
3589
3600
|
const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
|
|
3590
|
-
return (jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsxRuntime.jsx("div", { className: styles$
|
|
3601
|
+
return (jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsxRuntime.jsx("div", { className: styles$l.colorPreview, style: { backgroundColor: hexColor, color: getContrastColor(hexColor) }, children: previewText }), jsxRuntime.jsx("button", { type: "button", className: "cw-button", onClick: toggleInputMode, style: { minWidth: "3ch" }, children: inputMode === 'hex' ? 'RGB' : 'HEX' })] }), jsxRuntime.jsx("div", { className: "color-inputs-row", children: inputMode === 'hex' ? (jsxRuntime.jsx("input", { type: "text", value: hexColor, onChange: handleHexChange })) : (jsxRuntime.jsxs("div", { className: "cw-grid-base-3 cw-gap-small", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "R:" }), jsxRuntime.jsx("input", { type: "number", name: "r", min: "0", max: "255", value: rgb.r, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "G:" }), jsxRuntime.jsx("input", { type: "number", name: "g", min: "0", max: "255", value: rgb.g, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "B:" }), jsxRuntime.jsx("input", { type: "number", name: "b", min: "0", max: "255", value: rgb.b, onChange: handleRgbChange })] })] })) }), jsxRuntime.jsxs("div", { className: styles$l.colorPickerInteractiveArea, children: [jsxRuntime.jsx("div", { className: styles$l.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsxRuntime.jsx("div", { className: styles$l.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxRuntime.jsxs("div", { className: styles$l.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxRuntime.jsxs("div", { className: styles$l.colorAreaOverlay, children: [jsxRuntime.jsx("div", { className: styles$l.hueBackground, style: { backgroundColor: hueHex } }), jsxRuntime.jsx("div", { className: styles$l.whiteGradient }), jsxRuntime.jsx("div", { className: styles$l.blackGradient })] }), jsxRuntime.jsx("div", { className: styles$l.colorAreaCursor, style: {
|
|
3591
3602
|
left: `${hsv.s}%`,
|
|
3592
3603
|
top: `${100 - hsv.v}%`
|
|
3593
3604
|
} })] })] })] }));
|
|
3594
3605
|
};
|
|
3595
3606
|
|
|
3596
|
-
var styles$
|
|
3607
|
+
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"};
|
|
3597
3608
|
|
|
3598
3609
|
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, readOnly = false, width = '4rem', height = '2rem', labelProps, layoutProps, className, style, }) => {
|
|
3599
3610
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -3726,11 +3737,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
3726
3737
|
break;
|
|
3727
3738
|
}
|
|
3728
3739
|
};
|
|
3729
|
-
return (jsxRuntime.jsxs("div", { className: `cw-input-color ${styles$
|
|
3740
|
+
return (jsxRuntime.jsxs("div", { className: `cw-input-color ${styles$k.container}${className ? ` ${className}` : ''}`, style: style, "data-direction": layoutProps?.direction ?? "row", "data-align": layoutProps?.align, children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps })), jsxRuntime.jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$k.selectColor} ${disabled ? styles$k.disabled : ''} ${readOnly ? styles$k.readOnly : ''}`, style: {
|
|
3730
3741
|
width,
|
|
3731
3742
|
height,
|
|
3732
3743
|
backgroundColor: value,
|
|
3733
|
-
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: dropdownRef, className: styles$
|
|
3744
|
+
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: dropdownRef, className: styles$k.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsxRuntime.jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
|
|
3734
3745
|
};
|
|
3735
3746
|
|
|
3736
3747
|
/**
|
|
@@ -3985,7 +3996,7 @@ function CwInputDateText(props) {
|
|
|
3985
3996
|
return (jsxRuntime.jsx("div", { className: "cw-input-date-text", children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("input", { type: "text", disabled: disabled, maxLength: 10, onChange: onChangeInputText, pattern: "^$ --|[.0-9\\/\\-]{10}", placeholder: format.toLowerCase(), readOnly: readOnly, ref: textInputRef, required: required, size: width, tabIndex: tabIndex, value: displayedDate }), jsxRuntime.jsxs("span", { children: [jsxRuntime.jsx(CwIcon, { iconId: "calendar" }), jsxRuntime.jsx("input", { type: "date", disabled: disabled, onChange: onChangeInputDate, readOnly: readOnly, ref: dateInputRef, tabIndex: -1, value: date, ...inputProps })] })] }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
|
|
3986
3997
|
}
|
|
3987
3998
|
|
|
3988
|
-
var styles$
|
|
3999
|
+
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"};
|
|
3989
4000
|
|
|
3990
4001
|
const DEFAULT_LABELS = {
|
|
3991
4002
|
dropImageHere: "Drop image here",
|
|
@@ -4064,7 +4075,7 @@ function CwInputImage(props) {
|
|
|
4064
4075
|
const file = e.currentTarget.files?.[0];
|
|
4065
4076
|
void handleFile(file ?? null);
|
|
4066
4077
|
};
|
|
4067
|
-
return (jsxRuntime.jsxs("div", { className: `cw-input-image ${styles$
|
|
4078
|
+
return (jsxRuntime.jsxs("div", { className: `cw-input-image ${styles$j.container}`, "data-size": size, children: [jsxRuntime.jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, className: styles$j.dropZone, children: [jsxRuntime.jsx(CwIcon, { iconId: "upload" }), jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-tiny", children: [jsxRuntime.jsx("p", { className: styles$j.title, children: labels.dropImageHere }), jsxRuntime.jsx("p", { className: styles$j.subtitle, children: labels.acceptedFormats(allowedFormats.join(", ").replace(/image\//g, "")) })] })] }), jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-center-center cw-gap-small", children: [jsxRuntime.jsx(CwButton, { onClick: onPasteButtonClick, icon: "paste", text: labels.paste, size: size }), jsxRuntime.jsx(CwButton, { onClick: () => inputRef.current?.click(), icon: "folder-open", text: labels.browse, size: size })] }), jsxRuntime.jsx("input", { ref: inputRef, type: "file", accept: allowedFormats.join(","), onChange: handleFileChange, className: styles$j.hiddenInput, ...inputProps })] }));
|
|
4068
4079
|
}
|
|
4069
4080
|
|
|
4070
4081
|
/**
|
|
@@ -4196,7 +4207,7 @@ const CwImageArea = React.forwardRef((props, ref) => {
|
|
|
4196
4207
|
});
|
|
4197
4208
|
CwImageArea.displayName = "CwImageArea";
|
|
4198
4209
|
|
|
4199
|
-
var styles$
|
|
4210
|
+
var styles$i = {"container":"cw-weekday-selector-module__container__pwcvx","days":"cw-weekday-selector-module__days__Dd3RH"};
|
|
4200
4211
|
|
|
4201
4212
|
/* 2024-01-01 was a Monday. Formatted in UTC so a negative browser offset cannot shift a day. */
|
|
4202
4213
|
const MONDAY_UTC = Date.UTC(2024, 0, 1);
|
|
@@ -4377,7 +4388,7 @@ class Weekdays {
|
|
|
4377
4388
|
}
|
|
4378
4389
|
}
|
|
4379
4390
|
|
|
4380
|
-
const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labelProps, layout, feedback, locale = "en-GB", className }) => {
|
|
4391
|
+
const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labelProps, layout, feedback, locale = "en-GB", className, ...dataAttributes }) => {
|
|
4381
4392
|
const selectedDays = Weekdays.tryFromString(value).toArray();
|
|
4382
4393
|
const dayNames = React.useMemo(() => getWeekdayNames(locale), [locale]);
|
|
4383
4394
|
const handleChange = (day, checked) => {
|
|
@@ -4394,16 +4405,16 @@ const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labe
|
|
|
4394
4405
|
// Points at the label element rather than copying its text, which also covers a labelProps that
|
|
4395
4406
|
// carries children instead of `text`.
|
|
4396
4407
|
const labelId = labelProps?.id ?? `${feedbackId}-label`;
|
|
4397
|
-
return (jsxRuntime.jsxs("div", { className: `cw-weekday-selector ${styles$
|
|
4408
|
+
return (jsxRuntime.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 && jsxRuntime.jsx(CwLabel, { id: labelId, ...labelProps }), jsxRuntime.jsx("div", { role: "group", className: styles$i.days, "aria-labelledby": labelProps ? labelId : undefined, "aria-describedby": describedBy, children: Weekdays.getFullWeek().map(day => (jsxRuntime.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) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4398
4409
|
};
|
|
4399
4410
|
|
|
4400
|
-
var styles$
|
|
4411
|
+
var styles$h = {"check-container":"cw-check-module__check-container__4nscZ","group":"cw-check-module__group__6JCQo","options":"cw-check-module__options__-g9LF"};
|
|
4401
4412
|
|
|
4402
4413
|
function CwCheck(props) {
|
|
4403
4414
|
const { labelProps, labelText, direction, alignment, className, ...inputProps } = props;
|
|
4404
4415
|
const resolvedDirection = direction ?? alignment ?? "row";
|
|
4405
4416
|
const displayText = labelProps?.text ?? labelText;
|
|
4406
|
-
return (jsxRuntime.jsx("div", { className: `cw-check ${styles$
|
|
4417
|
+
return (jsxRuntime.jsx("div", { className: `cw-check ${styles$h["check-container"]}${className ? ` ${className}` : ''}`, children: jsxRuntime.jsxs("label", { "data-direction": resolvedDirection, children: [jsxRuntime.jsx("input", { type: "checkbox", ...inputProps }), displayText && (jsxRuntime.jsx("span", { className: "cw-icon-text", children: displayText }))] }) }));
|
|
4407
4418
|
}
|
|
4408
4419
|
|
|
4409
4420
|
function CwCheckbox(CwCheckboxProps) {
|
|
@@ -4457,14 +4468,14 @@ function CwCheckboxGroup({ options, value = [], onChange, labelProps, groupLayou
|
|
|
4457
4468
|
?? (optionsAlignment === "column" ? "row" : "column");
|
|
4458
4469
|
// Each checkbox's box-to-text layout is the opposite of the options flow, mirroring CwRadioGroup.
|
|
4459
4470
|
const checkDirection = itemDirection === "row" ? "column" : "row";
|
|
4460
|
-
return (jsxRuntime.jsxs("div", { className: `cw-checkbox-group ${styles$
|
|
4471
|
+
return (jsxRuntime.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 && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.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) => (jsxRuntime.jsx(CwCheck, { labelProps: { text: option.label }, checked: value.includes(option.value), disabled: disabled || option.disabled, direction: checkDirection, onChange: (e) => handleChange(option.value, e.currentTarget.checked) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4461
4472
|
}
|
|
4462
4473
|
|
|
4463
|
-
var styles$
|
|
4474
|
+
var styles$g = {"radio":"cw-radio-module__radio__5sh7a","group":"cw-radio-module__group__br-HM","options":"cw-radio-module__options__LSw7M"};
|
|
4464
4475
|
|
|
4465
4476
|
/** Single native radio input. Building block for CwRadioGroup. */
|
|
4466
4477
|
function CwRadio({ label, direction = "row", className, ...inputProps }) {
|
|
4467
|
-
return (jsxRuntime.jsxs("label", { className: `cw-radio ${styles$
|
|
4478
|
+
return (jsxRuntime.jsxs("label", { className: `cw-radio ${styles$g.radio}${className ? ` ${className}` : ""}`, "data-direction": direction, children: [jsxRuntime.jsx("input", { type: "radio", ...inputProps }), label && jsxRuntime.jsx("span", { children: label })] }));
|
|
4468
4479
|
}
|
|
4469
4480
|
|
|
4470
4481
|
/**
|
|
@@ -4491,7 +4502,7 @@ function CwRadioGroup({ options, value, onChange, labelProps, groupLayout, itemL
|
|
|
4491
4502
|
// (itemLayout column) reads best with the circle beside the text; a side-by-side row reads
|
|
4492
4503
|
// best with the circle above the text.
|
|
4493
4504
|
const radioDirection = itemLayout?.direction === "row" ? "column" : "row";
|
|
4494
|
-
return (jsxRuntime.jsxs("div", { className: `cw-radio-group ${styles$
|
|
4505
|
+
return (jsxRuntime.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 && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.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) => (jsxRuntime.jsx(CwRadio, { name: groupName, label: option.label, direction: radioDirection, checked: value === option.value, required: required, disabled: disabled || option.disabled, onChange: () => onChange(option.value) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4495
4506
|
}
|
|
4496
4507
|
|
|
4497
4508
|
function CwToggle(props) {
|
|
@@ -4632,7 +4643,7 @@ function useDropdownPortal({ anchorRef, isOpen, onClose, positionStrategy = defa
|
|
|
4632
4643
|
return { panelRef, panelStyle: style, renderPanel };
|
|
4633
4644
|
}
|
|
4634
4645
|
|
|
4635
|
-
var styles$
|
|
4646
|
+
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"};
|
|
4636
4647
|
|
|
4637
4648
|
/**
|
|
4638
4649
|
* Custom dropdown component with colour-coded options, optional search filter, and full
|
|
@@ -4746,12 +4757,12 @@ function CwDropdown({ options, value, onChange, labelProps, alignProps, placehol
|
|
|
4746
4757
|
}
|
|
4747
4758
|
}, [isOpen, highlightedIndex, filteredOptions, handleOptionSelect]);
|
|
4748
4759
|
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
4749
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-dropdown${className ? ` ${className}` : ""}`, "data-direction": flexDirection, style: style, ...otherProps, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && jsxRuntime.jsx(CwLabel, { id: labelId, ...labelProps }), jsxRuntime.jsxs("div", { className: styles$
|
|
4750
|
-
styles$
|
|
4751
|
-
value === option.value ? styles$
|
|
4752
|
-
highlightedIndex === index ? styles$
|
|
4753
|
-
option.disabled ? styles$
|
|
4754
|
-
].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 && (jsxRuntime.jsx("span", { className: styles$
|
|
4760
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-dropdown${className ? ` ${className}` : ""}`, "data-direction": flexDirection, style: style, ...otherProps, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && jsxRuntime.jsx(CwLabel, { id: labelId, ...labelProps }), jsxRuntime.jsxs("div", { className: styles$f.value, children: [jsxRuntime.jsxs("div", { className: "cw-dropdown-wrapper", ref: wrapperRef, children: [jsxRuntime.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: [jsxRuntime.jsx("div", { className: "cw-dropdown-trigger-content", id: valueId, children: selectedOption ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [selectedOption.color && (jsxRuntime.jsx("span", { className: styles$f.colorCircle, style: { backgroundColor: selectedOption.color } })), jsxRuntime.jsx("span", { children: selectedOption.label })] })) : (jsxRuntime.jsx("span", { className: "cw-dropdown-placeholder", children: placeholder })) }), jsxRuntime.jsx(CwIcon, { iconId: "chevron-down", size: "small" })] }), renderPanel(jsxRuntime.jsxs("div", { ref: panelRef, className: styles$f.dropdown, style: panelStyle, role: "listbox", onKeyDown: handleKeyDown, children: [allowSearch && (jsxRuntime.jsx("div", { className: styles$f.searchBox, children: jsxRuntime.jsx("input", { ref: inputRef, type: "text", placeholder: "Search...", value: searchText, onChange: handleSearchChange, onKeyDown: handleKeyDown, className: styles$f.searchInput, autoComplete: "off" }) })), jsxRuntime.jsx("ul", { children: filteredOptions.length > 0 ? (filteredOptions.map((option, index) => (jsxRuntime.jsxs("li", { ref: highlightedIndex === index ? highlightedItemRef : null, className: [
|
|
4761
|
+
styles$f.option,
|
|
4762
|
+
value === option.value ? styles$f.optionSelected : "",
|
|
4763
|
+
highlightedIndex === index ? styles$f.optionFocused : "",
|
|
4764
|
+
option.disabled ? styles$f.optionDisabled : "",
|
|
4765
|
+
].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 && (jsxRuntime.jsx("span", { className: styles$f.colorCircle, style: { backgroundColor: option.color } })), jsxRuntime.jsx("span", { children: option.label })] }, option.value)))) : (jsxRuntime.jsx("li", { className: styles$f.emptyState, children: "No options available" })) })] }))] }), feedbackMessages.map((item, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": item.type, "aria-live": "polite", children: item.message }, index)))] })] }) }));
|
|
4755
4766
|
}
|
|
4756
4767
|
|
|
4757
4768
|
/**
|
|
@@ -4768,7 +4779,7 @@ function CwDropdownFilter(props) {
|
|
|
4768
4779
|
return (jsxRuntime.jsxs("div", { id: props.IdContent, className: containerClassName, children: [props.children, isVisible && (jsxRuntime.jsx("nav", { className: "cw-dropdown-menu", style: inlineStyles, onMouseLeave: props.onMouseLeave, id: props.idDropDownFilter, role: "menu", children: jsxRuntime.jsx("ul", { role: "none", children: props.DataSourceDropDownItem?.map((item) => (jsxRuntime.jsx("li", { id: item.IdDropDown_filter, role: "menuitem", children: item.dropDownFilter_desc }, item.IdDropDown_filter))) }) }))] }));
|
|
4769
4780
|
}
|
|
4770
4781
|
|
|
4771
|
-
var styles$
|
|
4782
|
+
var styles$e = {"container":"cw-popover-button-module__container__YSWQU","panel":"cw-popover-button-module__panel__C-BTn"};
|
|
4772
4783
|
|
|
4773
4784
|
/**
|
|
4774
4785
|
* Button that toggles a floating panel with arbitrary children.
|
|
@@ -4847,7 +4858,7 @@ function CwPopoverButton({ children, panelWidth = "auto", placement = "bottom-st
|
|
|
4847
4858
|
}
|
|
4848
4859
|
panel.showPopover();
|
|
4849
4860
|
}, [placement]);
|
|
4850
|
-
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$
|
|
4861
|
+
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$e.container, children: [jsxRuntime.jsx(CwButton, { ...buttonProps, onClick: handleClick }), jsxRuntime.jsx("div", { ref: panelCallbackRef, className: `${styles$e.panel}${panelClassName ? ` ${panelClassName}` : ""}`, style: { width: panelWidth }, children: children })] }));
|
|
4851
4862
|
}
|
|
4852
4863
|
|
|
4853
4864
|
function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor, onPrimaryColor) {
|
|
@@ -4865,13 +4876,13 @@ function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor
|
|
|
4865
4876
|
return result;
|
|
4866
4877
|
}
|
|
4867
4878
|
|
|
4868
|
-
var styles$
|
|
4879
|
+
var styles$d = {"cw-multifilter-tag":"cw-multi-filter-tag-module__cw-multifilter-tag__Epda-"};
|
|
4869
4880
|
|
|
4870
4881
|
const CwMultiFilterTag = props => {
|
|
4871
4882
|
const { ID, Name, Value, Category, Removable, PrimaryColor, Selectable, Selected } = props;
|
|
4872
4883
|
const backgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
|
|
4873
4884
|
const isOutlineMode = Selected && !Removable;
|
|
4874
|
-
return (jsxRuntime.jsx("li", { className: styles$
|
|
4885
|
+
return (jsxRuntime.jsx("li", { className: styles$d["cw-multifilter-tag"], id: ID, "data-value": Value, "data-category": Category, "data-selected": !!Selected, title: props.tooltip ?? Name, onClick: () => {
|
|
4875
4886
|
if (Selectable)
|
|
4876
4887
|
props.OnSelect?.(props);
|
|
4877
4888
|
}, children: jsxRuntime.jsx(CwChip, { label: Name, colorScheme: "custom", customColor: backgroundColor, variant: isOutlineMode ? "outline" : "soft", closable: Removable, onClose: () => props.OnRemove?.(props),
|
|
@@ -4881,7 +4892,7 @@ const CwMultiFilterTag = props => {
|
|
|
4881
4892
|
} : undefined }) }));
|
|
4882
4893
|
};
|
|
4883
4894
|
|
|
4884
|
-
var styles$
|
|
4895
|
+
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"};
|
|
4885
4896
|
|
|
4886
4897
|
/**
|
|
4887
4898
|
* A multiple filter selector, a MULTI-SELECT even. Allows users to select and filter items based on tags.
|
|
@@ -5122,9 +5133,9 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5122
5133
|
inputRef.current?.focus();
|
|
5123
5134
|
}
|
|
5124
5135
|
};
|
|
5125
|
-
return (jsxRuntime.jsxs("form", { ref: componentRef, id: id, "data-testid": testId, className: `${styles$
|
|
5136
|
+
return (jsxRuntime.jsxs("form", { ref: componentRef, id: id, "data-testid": testId, className: `${styles$c["cw-multi-filter"]}${className ? ` ${className}` : ""}`, style: style, onSubmit: (e) => {
|
|
5126
5137
|
e.preventDefault();
|
|
5127
|
-
}, children: [jsxRuntime.jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$
|
|
5138
|
+
}, children: [jsxRuntime.jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$c["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-outline-variant)" } : {}, children: [jsxRuntime.jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (React.createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsxRuntime.jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.currentTarget.value), autoComplete: "off", placeholder: selectedTags.size === 0 ? placeholder : "", onKeyDown: e => {
|
|
5128
5139
|
switch (e.key) {
|
|
5129
5140
|
case "Enter":
|
|
5130
5141
|
case "Tab": {
|
|
@@ -5151,7 +5162,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5151
5162
|
break;
|
|
5152
5163
|
}
|
|
5153
5164
|
}
|
|
5154
|
-
} })] }), selectedTags.size > 0 && (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: e => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChangeSelectedTags(new Set()); setIsPanelOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), renderPanel(jsxRuntime.jsxs("section", { ref: panelRef, className: styles$
|
|
5165
|
+
} })] }), selectedTags.size > 0 && (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: e => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChangeSelectedTags(new Set()); setIsPanelOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), renderPanel(jsxRuntime.jsxs("section", { ref: panelRef, className: styles$c["cw-multi-filter-catalog-container"], style: panelStyle, children: [jsxRuntime.jsxs("nav", { children: [jsxRuntime.jsx("button", { className: selectedCategory === "All" ? styles$c["category-selected"] : undefined, onClick: () => handleClickCategory("All"), children: allCategoriesLabel }), Array.from(categoriesMappedToTags().keys()).map(category => (jsxRuntime.jsx("button", { className: selectedCategory === category ? styles$c["category-selected"] : undefined, style: {
|
|
5155
5166
|
backgroundColor: getColor(category).primary,
|
|
5156
5167
|
color: getColor(category).onPrimary,
|
|
5157
5168
|
}, onClick: () => handleClickCategory(category), children: category }, category)))] }), jsxRuntime.jsx("ul", { children: displayTags
|
|
@@ -5177,7 +5188,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5177
5188
|
} }, props.ID))) })] }))] }));
|
|
5178
5189
|
};
|
|
5179
5190
|
|
|
5180
|
-
var styles$
|
|
5191
|
+
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"};
|
|
5181
5192
|
|
|
5182
5193
|
/**
|
|
5183
5194
|
* Multi-select input with chip tags and searchable dropdown.
|
|
@@ -5215,6 +5226,11 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5215
5226
|
isOpen: open,
|
|
5216
5227
|
onClose: () => { setOpen(false); setFocusedIndex(-1); },
|
|
5217
5228
|
});
|
|
5229
|
+
// Disabling while the panel is open closes it (state adjusted during render, no effect pass).
|
|
5230
|
+
if (disabled && open) {
|
|
5231
|
+
setOpen(false);
|
|
5232
|
+
setFocusedIndex(-1);
|
|
5233
|
+
}
|
|
5218
5234
|
const selectedSet = React.useMemo(() => new Set(value), [value]);
|
|
5219
5235
|
const filtered = React.useMemo(() => {
|
|
5220
5236
|
if (!search)
|
|
@@ -5224,17 +5240,23 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5224
5240
|
}, [options, selectedSet, search]);
|
|
5225
5241
|
const selectedOptions = React.useMemo(() => value.map(v => options.find(o => o.value === v)).filter(Boolean), [value, options]);
|
|
5226
5242
|
const handleSelect = React.useCallback((optionValue) => {
|
|
5243
|
+
if (disabled)
|
|
5244
|
+
return;
|
|
5227
5245
|
onChange([...value, optionValue]);
|
|
5228
5246
|
setSearch("");
|
|
5229
5247
|
setFocusedIndex(-1);
|
|
5230
5248
|
inputRef.current?.focus();
|
|
5231
|
-
}, [value, onChange]);
|
|
5249
|
+
}, [disabled, value, onChange]);
|
|
5232
5250
|
const handleRemove = React.useCallback((optionValue) => {
|
|
5251
|
+
if (disabled)
|
|
5252
|
+
return;
|
|
5233
5253
|
onChange(value.filter(v => v !== optionValue));
|
|
5234
5254
|
inputRef.current?.focus();
|
|
5235
|
-
}, [value, onChange]);
|
|
5255
|
+
}, [disabled, value, onChange]);
|
|
5236
5256
|
const allSelected = options.length > 0 && options.every(o => selectedSet.has(o.value));
|
|
5237
5257
|
const handleToggleAll = React.useCallback(() => {
|
|
5258
|
+
if (disabled)
|
|
5259
|
+
return;
|
|
5238
5260
|
if (allSelected) {
|
|
5239
5261
|
onChange([]);
|
|
5240
5262
|
}
|
|
@@ -5244,7 +5266,7 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5244
5266
|
setSearch("");
|
|
5245
5267
|
setFocusedIndex(-1);
|
|
5246
5268
|
inputRef.current?.focus();
|
|
5247
|
-
}, [allSelected, options, onChange]);
|
|
5269
|
+
}, [disabled, allSelected, options, onChange]);
|
|
5248
5270
|
const handleInputChange = React.useCallback((e) => {
|
|
5249
5271
|
setSearch(e.currentTarget.value);
|
|
5250
5272
|
if (!open)
|
|
@@ -5256,6 +5278,8 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5256
5278
|
setOpen(true);
|
|
5257
5279
|
}, [disabled]);
|
|
5258
5280
|
const handleKeyDown = React.useCallback((e) => {
|
|
5281
|
+
if (disabled)
|
|
5282
|
+
return;
|
|
5259
5283
|
if (e.key === "Backspace" && !search && value.length > 0) {
|
|
5260
5284
|
onChange(value.slice(0, -1));
|
|
5261
5285
|
return;
|
|
@@ -5300,7 +5324,7 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5300
5324
|
e.preventDefault();
|
|
5301
5325
|
setFocusedIndex(prev => (prev > 0 ? prev - 1 : 0));
|
|
5302
5326
|
}
|
|
5303
|
-
}, [open, search, value, filtered, focusedIndex, onChange, handleSelect]);
|
|
5327
|
+
}, [disabled, open, search, value, filtered, focusedIndex, onChange, handleSelect]);
|
|
5304
5328
|
// Scroll focused item into view
|
|
5305
5329
|
React.useEffect(() => {
|
|
5306
5330
|
if (focusedIndex >= 0 && listRef.current) {
|
|
@@ -5315,13 +5339,13 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5315
5339
|
const feedbackId = React.useId();
|
|
5316
5340
|
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
5317
5341
|
const describedBy = feedbackIds.join(" ") || undefined;
|
|
5318
|
-
return (jsxRuntime.jsxs("div", { ref: containerRef, className: `${styles$
|
|
5319
|
-
inputRef.current?.focus(); }, children: [selectedOptions.map(opt => (jsxRuntime.jsx(CwChip, { label: opt.label, colorScheme: opt.color ? "custom" : "info", customColor: opt.color, closable: !disabled, onClose: () => handleRemove(opt.value) }, opt.value))), jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: search, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: selectedOptions.length === 0 ? placeholder : "", disabled: disabled, autoComplete: "off", "aria-describedby": describedBy }), value.length > 0 && !disabled && (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: (e) => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChange([]); setSearch(""); setOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), feedbackMessages.map((fb, i) => (jsxRuntime.jsx("p", { id: feedbackIds[i], className: "cw-input-feedback", "data-color": fb.type, "aria-live": "polite", children: fb.message }, i)))] })] }), renderPanel((showSelectAll || filtered.length > 0) ? (jsxRuntime.jsxs("div", { ref: panelRef, className: styles$
|
|
5342
|
+
return (jsxRuntime.jsxs("div", { ref: containerRef, className: `${styles$b.container}${className ? ` ${className}` : ""}`, style: style, id: id, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("div", { className: styles$b.value, children: [jsxRuntime.jsxs("div", { className: `${styles$b.inputBox}${disabled ? ` ${styles$b.disabled}` : ""}`, ref: inputBoxRef, onClick: () => { if (!disabled)
|
|
5343
|
+
inputRef.current?.focus(); }, children: [selectedOptions.map(opt => (jsxRuntime.jsx(CwChip, { label: opt.label, colorScheme: opt.color ? "custom" : "info", customColor: opt.color, closable: !disabled, onClose: () => handleRemove(opt.value) }, opt.value))), jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: search, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: selectedOptions.length === 0 ? placeholder : "", disabled: disabled, autoComplete: "off", "aria-describedby": describedBy }), value.length > 0 && !disabled && (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: (e) => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChange([]); setSearch(""); setOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), feedbackMessages.map((fb, i) => (jsxRuntime.jsx("p", { id: feedbackIds[i], className: "cw-input-feedback", "data-color": fb.type, "aria-live": "polite", children: fb.message }, i)))] })] }), renderPanel((showSelectAll || filtered.length > 0) ? (jsxRuntime.jsxs("div", { ref: panelRef, className: styles$b.dropdown, style: panelStyle, children: [showSelectAll && !search && (jsxRuntime.jsxs("div", { className: styles$b.selectAll, onMouseDown: (e) => e.preventDefault(), onClick: handleToggleAll, children: [jsxRuntime.jsx("input", { type: "checkbox", checked: allSelected, readOnly: true, tabIndex: -1 }), allSelected ? "Deselect all" : "Select all"] })), jsxRuntime.jsx("ul", { ref: listRef, children: filtered.map((opt, idx) => (jsxRuntime.jsxs("li", { className: `${styles$b.option}${idx === focusedIndex ? ` ${styles$b.optionFocused}` : ""}`, onMouseDown: (e) => e.preventDefault(), onClick: () => handleSelect(opt.value), onMouseEnter: () => setFocusedIndex(idx), title: opt.tooltip, children: [opt.color && jsxRuntime.jsx("span", { className: styles$b.optionDot, style: { backgroundColor: opt.color } }), opt.label] }, opt.value))) })] })) : null)] }));
|
|
5320
5344
|
}
|
|
5321
5345
|
|
|
5322
|
-
var styles$
|
|
5346
|
+
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"};
|
|
5323
5347
|
|
|
5324
|
-
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null }) {
|
|
5348
|
+
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null, ...dataAttributes }) {
|
|
5325
5349
|
const [expanded, setExpanded] = React.useState(new Set());
|
|
5326
5350
|
// const [selectedId, setSelectedId] = useState<string | number | null>(initialSelectedId);
|
|
5327
5351
|
const [selectedId, setSelectedId] = React.useState(null);
|
|
@@ -5386,10 +5410,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5386
5410
|
const isLeaf = !hasChildren;
|
|
5387
5411
|
const isSelected = selectedId?.toString().toLowerCase() === node.id.toString().toLowerCase();
|
|
5388
5412
|
const selectable = allowParentSelection || isLeaf;
|
|
5389
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
5390
|
-
styles$
|
|
5391
|
-
isSelected && styles$
|
|
5392
|
-
!selectable && styles$
|
|
5413
|
+
return (jsxRuntime.jsxs("div", { className: styles$a["tree-item"], children: [jsxRuntime.jsxs("div", { className: [
|
|
5414
|
+
styles$a["tree-node"],
|
|
5415
|
+
isSelected && styles$a["selected"],
|
|
5416
|
+
!selectable && styles$a["non-selectable"]
|
|
5393
5417
|
].filter(Boolean).join(' '), style: { paddingLeft: `${depth * 24 + 8}px` }, onClick: () => {
|
|
5394
5418
|
if (selectable) {
|
|
5395
5419
|
setSelectedId(node.id);
|
|
@@ -5398,7 +5422,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5398
5422
|
else {
|
|
5399
5423
|
toggleExpand(node.id);
|
|
5400
5424
|
}
|
|
5401
|
-
}, children: [hasChildren && (jsxRuntime.jsx(
|
|
5425
|
+
}, children: [hasChildren && (jsxRuntime.jsx(CwButton, { variant: "icon", color: "neutral", icon: isExpanded ? "chevron-down" : "chevron-right", "aria-expanded": isExpanded, "aria-label": `${isExpanded ? "Collapse" : "Expand"} ${node.label}`, onClick: (event) => {
|
|
5426
|
+
event.stopPropagation();
|
|
5427
|
+
toggleExpand(node.id);
|
|
5428
|
+
} })), jsxRuntime.jsx("div", { className: `${styles$a["tree-label"]} ${!hasChildren ? styles$a["tree-spacer"] : ''}`, children: node.label })] }), hasChildren && isExpanded && (jsxRuntime.jsx("div", { className: styles$a["tree-children"], children: node.children.map((child) => renderNode(child, depth + 1)) }))] }, node.id));
|
|
5402
5429
|
};
|
|
5403
5430
|
// Function to search for nodes that match the search term
|
|
5404
5431
|
const searchInTree = (nodes, searchTerm) => {
|
|
@@ -5422,7 +5449,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5422
5449
|
return results;
|
|
5423
5450
|
};
|
|
5424
5451
|
const filteredData = searchInTree(data, search);
|
|
5425
|
-
return (jsxRuntime.jsxs("div", { className: `cw-tree-view ${styles$
|
|
5452
|
+
return (jsxRuntime.jsxs("div", { ...dataAttributes, className: `cw-tree-view ${styles$a["tree-container"]}`, children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx("input", { type: "text", placeholder: "Search in tree...", value: search, onChange: (e) => setSearch(e.target.value) }), search && (jsxRuntime.jsx(CwButton, { onClick: () => setSearch(""), type: "button", icon: "close", variant: "icon", color: "neutral" }))] }), jsxRuntime.jsx("div", { className: styles$a["tree-wrapper"], children: filteredData.length > 0 ? (filteredData.map((node) => renderNode(node))) : (jsxRuntime.jsxs("div", { className: styles$a["empty-state"], children: [jsxRuntime.jsx(CwIcon, { iconId: "comment" }), search ? "No results found" : "There are no items"] })) })] }));
|
|
5426
5453
|
}
|
|
5427
5454
|
|
|
5428
5455
|
const EXACT_PHRASE = /"([^"]+)"/g;
|
|
@@ -5490,7 +5517,7 @@ function sortNavItems(items, alphabetically) {
|
|
|
5490
5517
|
return [...items].sort((first, second) => first.label.localeCompare(second.label));
|
|
5491
5518
|
}
|
|
5492
5519
|
|
|
5493
|
-
var styles$
|
|
5520
|
+
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"};
|
|
5494
5521
|
|
|
5495
5522
|
const SKELETON_ROW_COUNT = 5;
|
|
5496
5523
|
const defaultRenderLink = (item, children) => (jsxRuntime.jsx("a", { href: item.href, children: children }));
|
|
@@ -5502,13 +5529,13 @@ function CwNavMenu({ items, loading = false, isActive, renderLink = defaultRende
|
|
|
5502
5529
|
const renderItem = (item, level) => {
|
|
5503
5530
|
const children = item.children;
|
|
5504
5531
|
if (children && children.length > 0) {
|
|
5505
|
-
return (jsxRuntime.jsx("li", { children: jsxRuntime.jsxs("details", { "data-level": level, open: hasActiveDescendant(item) || undefined, children: [jsxRuntime.jsxs("summary", { children: [item.icon && jsxRuntime.jsx(CwIcon, { iconId: item.icon, size: level >= 2 ? "small" : "medium" }), item.label, (showExpandIndicator || level >= 2) && (jsxRuntime.jsx(CwIcon, { iconId: "chevron-down", size: "small", className: styles$
|
|
5532
|
+
return (jsxRuntime.jsx("li", { children: jsxRuntime.jsxs("details", { "data-level": level, open: hasActiveDescendant(item) || undefined, children: [jsxRuntime.jsxs("summary", { children: [item.icon && jsxRuntime.jsx(CwIcon, { iconId: item.icon, size: level >= 2 ? "small" : "medium" }), item.label, (showExpandIndicator || level >= 2) && (jsxRuntime.jsx(CwIcon, { iconId: "chevron-down", size: "small", className: styles$9.expandIndicator }))] }), jsxRuntime.jsx("ul", { children: children.map(child => renderItem(child, level + 1)) })] }) }, item.id));
|
|
5506
5533
|
}
|
|
5507
|
-
return (jsxRuntime.jsx("li", { "data-active": isActive?.(item) ? "true" : undefined, children: renderLink(item, jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.icon && jsxRuntime.jsx(CwIcon, { iconId: item.icon, size: "medium" }), item.label, isFavorite?.(item) && jsxRuntime.jsx(CwIcon, { iconId: "star", size: "small", className: styles$
|
|
5534
|
+
return (jsxRuntime.jsx("li", { "data-active": isActive?.(item) ? "true" : undefined, children: renderLink(item, jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.icon && jsxRuntime.jsx(CwIcon, { iconId: item.icon, size: "medium" }), item.label, isFavorite?.(item) && jsxRuntime.jsx(CwIcon, { iconId: "star", size: "small", className: styles$9.favoriteStar })] })) }, item.id));
|
|
5508
5535
|
};
|
|
5509
|
-
return (jsxRuntime.jsxs("nav", { ...navProps, className: [styles$
|
|
5510
|
-
? Array.from({ length: SKELETON_ROW_COUNT }, (_unused, index) => (jsxRuntime.jsx("li", { className: styles$
|
|
5511
|
-
: visibleItems.map(item => renderItem(item, 1)) }), showEmptyMessage && jsxRuntime.jsx("p", { className: styles$
|
|
5536
|
+
return (jsxRuntime.jsxs("nav", { ...navProps, className: [styles$9.menu, className].filter(Boolean).join(" "), "aria-busy": loading || undefined, children: [favoritesSlot && (jsxRuntime.jsxs("details", { open: true, ...favoritesProps, className: [styles$9.favorites, favoritesProps?.className].filter(Boolean).join(" "), children: [jsxRuntime.jsxs("summary", { children: [jsxRuntime.jsx(CwIcon, { iconId: "star", size: "medium" }), favoritesLabel] }), jsxRuntime.jsx("div", { className: styles$9.favoritesContent, children: favoritesSlot })] })), beforeTreeSlot, jsxRuntime.jsx("ul", { children: loading
|
|
5537
|
+
? Array.from({ length: SKELETON_ROW_COUNT }, (_unused, index) => (jsxRuntime.jsx("li", { className: styles$9.skeleton, children: jsxRuntime.jsx(CwSkeleton, { height: "var(--cw-size-small)", radius: "var(--cw-border-radius-small)" }) }, index)))
|
|
5538
|
+
: visibleItems.map(item => renderItem(item, 1)) }), showEmptyMessage && jsxRuntime.jsx("p", { className: styles$9.emptyMessage, children: emptyMessage })] }));
|
|
5512
5539
|
}
|
|
5513
5540
|
|
|
5514
5541
|
var dropdownStyles = {"dropdown":"cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-choice-dropdown-module__optionFocused__BYMxj"};
|
|
@@ -5674,6 +5701,8 @@ function CwSearchInput(optionsProps) {
|
|
|
5674
5701
|
return (jsxRuntime.jsxs("div", { className: `cw-search-input ${className || ""}`, style: style, ...otherProps, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsxRuntime.jsx("input", { ref: inputRef, 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 && (jsxRuntime.jsx("div", { className: "cw-search-input-loading", children: jsxRuntime.jsx(CwIcon, { iconId: "spinner" }) })), jsxRuntime.jsx("div", { className: "cw-search-input-icons", children: searchText && !disabled && !isLoading ? (jsxRuntime.jsx(CwButton, { type: "button", onClick: handleClearClick, "aria-label": "Clear search", variant: "icon", icon: "close", color: "neutral" })) : (iconProps ? jsxRuntime.jsx(CwIcon, { ...iconProps }) : jsxRuntime.jsx(CwIcon, { iconId: "search" })) })] })] }), renderPanel(jsxRuntime.jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsxRuntime.jsx("ul", { children: filteredOptions.map((option, index) => (jsxRuntime.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))) }) }))] }));
|
|
5675
5702
|
}
|
|
5676
5703
|
|
|
5704
|
+
var styles$8 = {"value":"cw-search-async-module__value__z53xT"};
|
|
5705
|
+
|
|
5677
5706
|
/**
|
|
5678
5707
|
* Generic API-backed search input. Fetches matching options from a caller-supplied `onSearch`
|
|
5679
5708
|
* callback as the user types (debounced), renders them in a portal-based dropdown with keyboard
|
|
@@ -5695,7 +5724,7 @@ function CwSearchInput(optionsProps) {
|
|
|
5695
5724
|
* icon={{ iconId: 'control-tower' }}
|
|
5696
5725
|
* />
|
|
5697
5726
|
*/
|
|
5698
|
-
const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveSelection, icon, placeholder = "Search…", minChars = 2, debounceMs = 300, disabled = false, required = false, initialDisplayText, searchTrigger, labelProps, alignProps, width, className = "", }) => {
|
|
5727
|
+
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 }) => {
|
|
5699
5728
|
// State
|
|
5700
5729
|
const [inputValue, setInputValue] = React.useState("");
|
|
5701
5730
|
const [options, setOptions] = React.useState([]);
|
|
@@ -5716,6 +5745,12 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5716
5745
|
// Stable ids wiring the combobox input to its listbox popup for assistive tech.
|
|
5717
5746
|
const listboxId = React.useId();
|
|
5718
5747
|
const optionId = (index) => `${listboxId}-opt-${index}`;
|
|
5748
|
+
const feedbackMessages = feedback
|
|
5749
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
5750
|
+
: [];
|
|
5751
|
+
const feedbackId = React.useId();
|
|
5752
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
5753
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
5719
5754
|
// Cancel a pending initial-value resolve when the user takes over (typing / clearing / reset),
|
|
5720
5755
|
// so a slow resolve can't overwrite newer input and the loading flag never sticks.
|
|
5721
5756
|
const cancelInitialResolve = React.useCallback(() => {
|
|
@@ -5927,10 +5962,10 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5927
5962
|
abortRef.current?.abort();
|
|
5928
5963
|
}, []);
|
|
5929
5964
|
const direction = alignProps?.flexDirection || "row";
|
|
5930
|
-
return (jsxRuntime.jsxs("div", { className: `cw-search-input ${className}`, style: {
|
|
5965
|
+
return (jsxRuntime.jsxs("div", { ...dataAttributes, className: `cw-search-input ${className}`, style: {
|
|
5931
5966
|
...(width ? { width } : {}),
|
|
5932
5967
|
...(labelProps?.labelWidth ? { "--label-width": labelProps.labelWidth } : {}),
|
|
5933
|
-
}, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: isInitialLoading ? "Loading…" : placeholder, disabled: disabled, required: required, autoComplete: "off", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": showDropdown, "aria-controls": listboxId, "aria-activedescendant": highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined, title: tooltipText }), (isLoading || isInitialLoading) && (jsxRuntime.jsx("div", { className: "cw-search-input-loading", children: jsxRuntime.jsx(CwIcon, { iconId: "spinner" }) })), jsxRuntime.jsx("div", { className: "cw-search-input-icons", children: inputValue && !disabled && !isInitialLoading ? (jsxRuntime.jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selection", variant: "icon", icon: "close", color: "neutral" })) : (icon ? jsxRuntime.jsx(CwIcon, { ...icon }) : jsxRuntime.jsx(CwIcon, { iconId: "search" })) })] })] }), renderPanel(jsxRuntime.jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsxRuntime.jsx("ul", { children: options.map((option, index) => (jsxRuntime.jsx("li", { id: optionId(index), className: `${dropdownStyles.option}${index === highlightedIndex ? ` ${dropdownStyles.optionFocused}` : ""}`, onClick: () => handleOptionSelect(option.id), onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: option.subLabel ? (jsxRuntime.jsxs("span", { className: "cw-search-async-option-lines", children: [jsxRuntime.jsx("span", { children: option.label }), jsxRuntime.jsx("span", { className: "cw-search-async-option-sub", children: option.subLabel })] })) : (option.label) }, option.id))) }) }))] }));
|
|
5968
|
+
}, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$8.value, children: [jsxRuntime.jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: isInitialLoading ? "Loading…" : placeholder, disabled: disabled, required: required, autoComplete: "off", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": showDropdown, "aria-controls": listboxId, "aria-activedescendant": highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined, "aria-describedby": describedBy, title: tooltipText }), (isLoading || isInitialLoading) && (jsxRuntime.jsx("div", { className: "cw-search-input-loading", children: jsxRuntime.jsx(CwIcon, { iconId: "spinner" }) })), jsxRuntime.jsx("div", { className: "cw-search-input-icons", children: inputValue && !disabled && !isInitialLoading ? (jsxRuntime.jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selection", variant: "icon", icon: "close", color: "neutral" })) : (icon ? jsxRuntime.jsx(CwIcon, { ...icon }) : jsxRuntime.jsx(CwIcon, { iconId: "search" })) })] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }), renderPanel(jsxRuntime.jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsxRuntime.jsx("ul", { children: options.map((option, index) => (jsxRuntime.jsx("li", { id: optionId(index), className: `${dropdownStyles.option}${index === highlightedIndex ? ` ${dropdownStyles.optionFocused}` : ""}`, onClick: () => handleOptionSelect(option.id), onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: option.subLabel ? (jsxRuntime.jsxs("span", { className: "cw-search-async-option-lines", children: [jsxRuntime.jsx("span", { children: option.label }), jsxRuntime.jsx("span", { className: "cw-search-async-option-sub", children: option.subLabel })] })) : (option.label) }, option.id))) }) }))] }));
|
|
5934
5969
|
};
|
|
5935
5970
|
|
|
5936
5971
|
var styles$7 = {"menu":"cw-context-menu-module__menu__tXmun","item":"cw-context-menu-module__item__-ko8L","arrow":"cw-context-menu-module__arrow__LHZmQ"};
|
|
@@ -6282,9 +6317,9 @@ var styles$5 = {"switch":"cw-button-switch-module__switch__vdWV-","segment":"cw-
|
|
|
6282
6317
|
* onChange={setView}
|
|
6283
6318
|
* />
|
|
6284
6319
|
*/
|
|
6285
|
-
function CwButtonSwitch({ options, value, onChange, size = "medium", color = "primary", iconOnly = false, direction = "row", disabled = false, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby,
|
|
6320
|
+
function CwButtonSwitch({ options, value, onChange, size = "medium", color = "primary", iconOnly = false, direction = "row", disabled = false, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...dataAttributes }) {
|
|
6286
6321
|
const { getSegmentProps } = useRovingSingleSelect(options, value, onChange);
|
|
6287
|
-
return (jsxRuntime.jsx("div", { className: `cw-button-switch ${styles$5.switch}`, role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : ariaLabel, "data-direction": direction,
|
|
6322
|
+
return (jsxRuntime.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) => {
|
|
6288
6323
|
const selected = option.value === value;
|
|
6289
6324
|
const segmentProps = getSegmentProps(index);
|
|
6290
6325
|
return (jsxRuntime.jsx(CwButton, { text: iconOnly ? undefined : option.label, title: iconOnly ? option.label : undefined, icon: option.icon, size: size, color: color, variant: selected ? "solid" : "outline", role: "radio", "aria-checked": selected, disabled: disabled || option.disabled, onClick: () => onChange(option.value), className: `${styles$5.segment}${iconOnly ? ` ${styles$5.iconOnly}` : ""}`, tabIndex: segmentProps.tabIndex, ref: segmentProps.ref, onKeyDown: segmentProps.onKeyDown }, option.value));
|
|
@@ -6379,7 +6414,7 @@ function usePickerPopup({ anchorRef, isOpen, onClose, position = "left-bottom" }
|
|
|
6379
6414
|
return { popupRef: panelRef, popupStyle: panelStyle, renderPopup: renderPanel };
|
|
6380
6415
|
}
|
|
6381
6416
|
|
|
6382
|
-
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: locale$1 = locale.enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, }) {
|
|
6417
|
+
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: locale$1 = locale.enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
6383
6418
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
6384
6419
|
const [inputValue, setInputValue] = React.useState("");
|
|
6385
6420
|
const containerRef = React.useRef(null);
|
|
@@ -6569,7 +6604,7 @@ function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabl
|
|
|
6569
6604
|
...(maxDate ? [{ after: maxDate }] : []),
|
|
6570
6605
|
...(disabledMatcher ? [disabledMatcher] : []),
|
|
6571
6606
|
], [disabledDates, minDate, maxDate, disabledMatcher]);
|
|
6572
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.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 }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: value || undefined, defaultMonth: defaultMonth || value || undefined, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale$1, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
6607
|
+
return (jsxRuntime.jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.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 }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: value || undefined, defaultMonth: defaultMonth || value || undefined, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale$1, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
6573
6608
|
today: new Date(),
|
|
6574
6609
|
}, modifiersClassNames: {
|
|
6575
6610
|
today: "rdp-day-today",
|
|
@@ -6847,8 +6882,14 @@ const getPresetsByKeys = (keys) => {
|
|
|
6847
6882
|
.filter(preset => preset !== undefined);
|
|
6848
6883
|
};
|
|
6849
6884
|
|
|
6850
|
-
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, }) {
|
|
6885
|
+
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 }) {
|
|
6851
6886
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
6887
|
+
const feedbackMessages = feedback
|
|
6888
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
6889
|
+
: [];
|
|
6890
|
+
const feedbackId = React.useId();
|
|
6891
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
6892
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
6852
6893
|
const [inputFromValue, setInputFromValue] = React.useState("");
|
|
6853
6894
|
const [inputToValue, setInputToValue] = React.useState("");
|
|
6854
6895
|
const [rangeErrorMessage, setRangeErrorMessage] = React.useState(null);
|
|
@@ -7212,11 +7253,11 @@ function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, d
|
|
|
7212
7253
|
}
|
|
7213
7254
|
return undefined;
|
|
7214
7255
|
}, [value]);
|
|
7215
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.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' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), jsxRuntime.jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.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' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxRuntime.jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsxRuntime.jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsxRuntime.jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonth || value?.from || undefined, modifiers: {
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7256
|
+
return (jsxRuntime.jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.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' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), jsxRuntime.jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.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' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxRuntime.jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsxRuntime.jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsxRuntime.jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonth || value?.from || undefined, modifiers: {
|
|
7257
|
+
today: new Date(),
|
|
7258
|
+
}, modifiersClassNames: {
|
|
7259
|
+
today: "rdp-day-today",
|
|
7260
|
+
} })] }), jsxRuntime.jsx("div", { role: "alert", "aria-live": "polite", className: rangeStyles.rangeError, children: rangeErrorMessage })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
7220
7261
|
}
|
|
7221
7262
|
|
|
7222
7263
|
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"};
|
|
@@ -7224,9 +7265,16 @@ var timeStyles = {"timePickerPopup":"cw-time-picker-module__timePickerPopup__BN6
|
|
|
7224
7265
|
const isMobileDevice = () => {
|
|
7225
7266
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
7226
7267
|
};
|
|
7227
|
-
function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", useNative = isMobileDevice(), }) {
|
|
7268
|
+
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 }) {
|
|
7228
7269
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
7229
7270
|
const [inputValue, setInputValue] = React.useState("");
|
|
7271
|
+
const feedbackMessages = feedback
|
|
7272
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7273
|
+
: [];
|
|
7274
|
+
const feedbackId = React.useId();
|
|
7275
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7276
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
7277
|
+
const feedbackElements = feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)));
|
|
7230
7278
|
const containerRef = React.useRef(null);
|
|
7231
7279
|
const wrapperRef = React.useRef(null);
|
|
7232
7280
|
const inputRef = React.useRef(null);
|
|
@@ -7378,13 +7426,13 @@ function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelP
|
|
|
7378
7426
|
const displayValue = inputValue;
|
|
7379
7427
|
// If using native time input
|
|
7380
7428
|
if (useNative) {
|
|
7381
|
-
return (jsxRuntime.jsx("div", { className: `cw-timepicker cw-timepicker-native ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsx("div", { className: styles$4.pickerWrapper, children: jsxRuntime.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" }) })] }) }));
|
|
7429
|
+
return (jsxRuntime.jsx("div", { ...dataAttributes, className: `cw-timepicker cw-timepicker-native ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsx("div", { className: styles$4.pickerWrapper, children: jsxRuntime.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] })] }) }));
|
|
7382
7430
|
}
|
|
7383
7431
|
// Custom time picker
|
|
7384
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { ref: wrapperRef, className: `${styles$4.pickerWrapper} ${timeStyles.field}${showClear ? "" : ` ${timeStyles.narrow}`}`, children: [jsxRuntime.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 && (jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsxRuntime.jsx(CwIcon, { iconId: "clock" })) })), renderPopup(jsxRuntime.jsx("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${timeStyles.timePickerPopup}`, style: popupStyle, children: jsxRuntime.jsx("div", { className: timeStyles.timePickerList, children: timeOptions.map((time) => {
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7432
|
+
return (jsxRuntime.jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { ref: wrapperRef, className: `${styles$4.pickerWrapper} ${timeStyles.field}${showClear ? "" : ` ${timeStyles.narrow}`}`, children: [jsxRuntime.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 && (jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsxRuntime.jsx(CwIcon, { iconId: "clock" })) })), renderPopup(jsxRuntime.jsx("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${timeStyles.timePickerPopup}`, style: popupStyle, children: jsxRuntime.jsx("div", { className: timeStyles.timePickerList, children: timeOptions.map((time) => {
|
|
7433
|
+
const isSelected = time === value;
|
|
7434
|
+
return (jsxRuntime.jsx("button", { ref: isSelected ? selectedItemRef : null, type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
7435
|
+
}) }) }))] }), feedbackElements] })] }) }));
|
|
7388
7436
|
}
|
|
7389
7437
|
|
|
7390
7438
|
/**
|
|
@@ -7444,7 +7492,12 @@ function combineDateTimeInOffset(date, hours, minutes, timezoneOffset) {
|
|
|
7444
7492
|
return new Date(zdt.epochMilliseconds);
|
|
7445
7493
|
}
|
|
7446
7494
|
|
|
7447
|
-
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: locale$1 = locale.enGB, timezoneOffset, }) {
|
|
7495
|
+
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: locale$1 = locale.enGB, timezoneOffset, feedback, ...dataAttributes }) {
|
|
7496
|
+
const feedbackMessages = feedback
|
|
7497
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7498
|
+
: [];
|
|
7499
|
+
const feedbackId = React.useId();
|
|
7500
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7448
7501
|
// ========================================
|
|
7449
7502
|
// PROPS NORMALIZATION
|
|
7450
7503
|
// ========================================
|
|
@@ -7684,13 +7737,19 @@ function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledD
|
|
|
7684
7737
|
const displayMaxDate = React.useMemo(() => normalizedMaxDateTime && timezoneOffset !== undefined
|
|
7685
7738
|
? getDateInOffset(normalizedMaxDateTime, timezoneOffset)
|
|
7686
7739
|
: normalizedMaxDateTime, [normalizedMaxDateTime, timezoneOffset]);
|
|
7687
|
-
return jsxRuntime.jsx("div", { className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsxRuntime.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$1 }), jsxRuntime.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 && (jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", onClick: handleNowClick, disabled: disabled, text: nowLabel }))] })] }) });
|
|
7740
|
+
return jsxRuntime.jsx("div", { ...dataAttributes, className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsxRuntime.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$1 }), jsxRuntime.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 && (jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", onClick: handleNowClick, disabled: disabled, text: nowLabel }))] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) });
|
|
7688
7741
|
}
|
|
7689
7742
|
|
|
7690
7743
|
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"};
|
|
7691
7744
|
|
|
7692
|
-
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: locale$1 = locale.enGB, yearRangeStart, yearRangeEnd, }) {
|
|
7745
|
+
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: locale$1 = locale.enGB, yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
7693
7746
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
7747
|
+
const feedbackMessages = feedback
|
|
7748
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7749
|
+
: [];
|
|
7750
|
+
const feedbackId = React.useId();
|
|
7751
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7752
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
7694
7753
|
const [inputValue, setInputValue] = React.useState("");
|
|
7695
7754
|
const [selectedDate, setSelectedDate] = React.useState(value);
|
|
7696
7755
|
const [selectedTime, setSelectedTime] = React.useState("");
|
|
@@ -7934,14 +7993,14 @@ function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, di
|
|
|
7934
7993
|
...(maxDateTime ? [{ after: maxDateTime }] : []),
|
|
7935
7994
|
...(disabledMatcher ? [disabledMatcher] : []),
|
|
7936
7995
|
], [disabledDates, minDateTime, maxDateTime, disabledMatcher]);
|
|
7937
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 16 }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar-time" })) }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, style: popupStyle, children: [jsxRuntime.jsxs("div", { className: compactStyles.calendarWrapper, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale$1, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7996
|
+
return (jsxRuntime.jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.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 }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar-time" })) }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, style: popupStyle, children: [jsxRuntime.jsxs("div", { className: compactStyles.calendarWrapper, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale$1, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
7997
|
+
today: new Date(),
|
|
7998
|
+
}, modifiersClassNames: {
|
|
7999
|
+
today: "rdp-day-today",
|
|
8000
|
+
} }), showTodayButton && (jsxRuntime.jsx("footer", { className: "cw-flex-row cw-align-center-center", children: jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", icon: "check-big", onClick: handleNowClick, text: nowLabel }) }))] }), jsxRuntime.jsxs("div", { className: compactStyles.timeWrapper, children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx(CwIcon, { iconId: "clock", size: "medium" }), jsxRuntime.jsx("span", { children: timeLabel })] }), jsxRuntime.jsx("div", { ref: timeListRef, className: `${timeStyles.timePickerList} ${compactStyles.compactTimeList}`, children: timeOptions.map((time) => {
|
|
8001
|
+
const isSelected = time === selectedTime;
|
|
8002
|
+
return (jsxRuntime.jsx("button", { type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
8003
|
+
}) })] })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
7945
8004
|
}
|
|
7946
8005
|
|
|
7947
8006
|
/**
|
|
@@ -7966,14 +8025,11 @@ function resolveTwoDigitYear(twoDigitYear, currentYear) {
|
|
|
7966
8025
|
}
|
|
7967
8026
|
const parseDate = (dateString, formatStr) => {
|
|
7968
8027
|
try {
|
|
7969
|
-
if (dateString.length < 10) {
|
|
7970
|
-
return undefined;
|
|
7971
|
-
}
|
|
7972
8028
|
const cleanString = dateString.trim();
|
|
7973
8029
|
if (!cleanString)
|
|
7974
8030
|
return undefined;
|
|
7975
8031
|
const parts = cleanString.split(/[\/\-.]/);
|
|
7976
|
-
if (parts.length !== 3)
|
|
8032
|
+
if (parts.length !== 3 || parts.some(part => !/^\d{1,4}$/.test(part)))
|
|
7977
8033
|
return undefined;
|
|
7978
8034
|
let day;
|
|
7979
8035
|
let month;
|
|
@@ -8005,7 +8061,7 @@ const parseDate = (dateString, formatStr) => {
|
|
|
8005
8061
|
if (year < 100) {
|
|
8006
8062
|
year = resolveTwoDigitYear(year);
|
|
8007
8063
|
}
|
|
8008
|
-
return Temporal.PlainDate.from({ year, month, day });
|
|
8064
|
+
return Temporal.PlainDate.from({ year, month, day }, { overflow: "reject" });
|
|
8009
8065
|
}
|
|
8010
8066
|
catch {
|
|
8011
8067
|
return undefined;
|
|
@@ -8018,6 +8074,17 @@ const validate = (parsed, minDate, maxDate) => {
|
|
|
8018
8074
|
&& (!maxDate || Temporal.PlainDate.compare(parsed, maxDate) <= 0);
|
|
8019
8075
|
return parsed && isValid;
|
|
8020
8076
|
};
|
|
8077
|
+
/** Same keystroke rule as the Date-valued pickers: shorter text (5.5.2000) only commits on blur. */
|
|
8078
|
+
const TYPED_DATE_MIN_LENGTH = 10;
|
|
8079
|
+
/** What a keystroke in the date input emits: a valid in-range date, a clear on empty text, or nothing while typing. */
|
|
8080
|
+
function resolveTypedDate(text, displayFormat, minDate, maxDate) {
|
|
8081
|
+
if (text === "")
|
|
8082
|
+
return { emit: true, date: undefined };
|
|
8083
|
+
if (text.length < TYPED_DATE_MIN_LENGTH)
|
|
8084
|
+
return { emit: false };
|
|
8085
|
+
const parsed = parseDate(text, displayFormat);
|
|
8086
|
+
return parsed && validate(parsed, minDate, maxDate) ? { emit: true, date: parsed } : { emit: false };
|
|
8087
|
+
}
|
|
8021
8088
|
/** Temporal.PlainDate -> JS Date (for DayPicker interop) */
|
|
8022
8089
|
function plainDateToJsDate(pd) {
|
|
8023
8090
|
return new Date(pd.year, pd.month - 1, pd.day);
|
|
@@ -8039,7 +8106,7 @@ function formatPlainDate(pd, fmt) {
|
|
|
8039
8106
|
.replace("dd", String(pd.day).padStart(2, "0"));
|
|
8040
8107
|
}
|
|
8041
8108
|
|
|
8042
|
-
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: locale$1 = locale.enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, }) {
|
|
8109
|
+
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: locale$1 = locale.enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
8043
8110
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
8044
8111
|
// Initialize with the formatted value so the input is controlled from the first render
|
|
8045
8112
|
const [inputValue, setInputValue] = React.useState(() => value ? formatPlainDate(value, displayFormat) : "");
|
|
@@ -8064,14 +8131,17 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8064
8131
|
onClose: handleClose,
|
|
8065
8132
|
position: popupPosition,
|
|
8066
8133
|
});
|
|
8067
|
-
// Sync input value with prop value
|
|
8134
|
+
// Sync input value with prop value; not while focused, so text is never rewritten under the cursor (blur reformats)
|
|
8068
8135
|
React.useEffect(() => {
|
|
8069
8136
|
const currentStr = value?.toString();
|
|
8070
8137
|
const prevStr = prevValueRef.current?.toString();
|
|
8071
8138
|
if (currentStr !== prevStr || prevDisplayFormatRef.current !== displayFormat) {
|
|
8072
8139
|
prevValueRef.current = value;
|
|
8073
8140
|
prevDisplayFormatRef.current = displayFormat;
|
|
8074
|
-
|
|
8141
|
+
const isTyping = inputRef.current !== null && inputRef.current === document.activeElement;
|
|
8142
|
+
if (!isTyping) {
|
|
8143
|
+
setInputValue(formatInputValue(value));
|
|
8144
|
+
}
|
|
8075
8145
|
}
|
|
8076
8146
|
}, [value, displayFormat, formatInputValue]);
|
|
8077
8147
|
const handleDaySelect = React.useCallback((date) => {
|
|
@@ -8095,11 +8165,12 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8095
8165
|
}
|
|
8096
8166
|
}, [disabled]);
|
|
8097
8167
|
const handleInputChange = React.useCallback((e) => {
|
|
8098
|
-
const newValue = e.
|
|
8168
|
+
const newValue = e.currentTarget.value;
|
|
8099
8169
|
setInputValue(newValue);
|
|
8100
|
-
const
|
|
8101
|
-
|
|
8102
|
-
|
|
8170
|
+
const change = resolveTypedDate(newValue, displayFormat, minDate, maxDate);
|
|
8171
|
+
if (change.emit) {
|
|
8172
|
+
onChange(change.date);
|
|
8173
|
+
}
|
|
8103
8174
|
}, [displayFormat, minDate, maxDate, onChange]);
|
|
8104
8175
|
const handleInputBlur = React.useCallback(() => {
|
|
8105
8176
|
const trimmedValue = inputValue?.trim();
|
|
@@ -8129,9 +8200,10 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8129
8200
|
const isTodayValid = validate(today, minDate, maxDate);
|
|
8130
8201
|
if (isTodayValid) {
|
|
8131
8202
|
onChange(today);
|
|
8203
|
+
setInputValue(formatInputValue(today));
|
|
8132
8204
|
setIsOpen(false);
|
|
8133
8205
|
}
|
|
8134
|
-
}, [minDate, maxDate, onChange]);
|
|
8206
|
+
}, [formatInputValue, minDate, maxDate, onChange]);
|
|
8135
8207
|
// Derive start/end months for the year dropdown range, guarding against inverted yearRange props
|
|
8136
8208
|
const dropdownStartMonth = React.useMemo(() => {
|
|
8137
8209
|
const inferredStart = minDate ? minDate.year : Temporal.Now.plainDateISO().year - 10;
|
|
@@ -8156,7 +8228,7 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8156
8228
|
const defaultMonthJsDate = defaultMonth
|
|
8157
8229
|
? new Date(defaultMonth.year, defaultMonth.month - 1, 1)
|
|
8158
8230
|
: selectedJsDate;
|
|
8159
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.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 }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: selectedJsDate, defaultMonth: defaultMonthJsDate, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale$1, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8231
|
+
return (jsxRuntime.jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.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 }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: selectedJsDate, defaultMonth: defaultMonthJsDate, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale$1, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8160
8232
|
today: new Date(),
|
|
8161
8233
|
}, modifiersClassNames: {
|
|
8162
8234
|
today: "rdp-day-today",
|
|
@@ -8443,7 +8515,12 @@ function useCwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime
|
|
|
8443
8515
|
};
|
|
8444
8516
|
}
|
|
8445
8517
|
|
|
8446
|
-
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: locale$1 = locale.enGB, }) {
|
|
8518
|
+
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: locale$1 = locale.enGB, feedback, ...dataAttributes }) {
|
|
8519
|
+
const feedbackMessages = feedback
|
|
8520
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
8521
|
+
: [];
|
|
8522
|
+
const feedbackId = React.useId();
|
|
8523
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
8447
8524
|
const picker = useCwDateTimePickerTemporal({
|
|
8448
8525
|
value,
|
|
8449
8526
|
onChange,
|
|
@@ -8452,7 +8529,7 @@ function CwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime, d
|
|
|
8452
8529
|
minTime,
|
|
8453
8530
|
maxTime,
|
|
8454
8531
|
});
|
|
8455
|
-
return jsxRuntime.jsx("div", { className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsxRuntime.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$1 }), jsxRuntime.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 && (jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", onClick: picker.selectNow, disabled: disabled, text: nowLabel }))] })] }) });
|
|
8532
|
+
return jsxRuntime.jsx("div", { ...dataAttributes, className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsxRuntime.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$1 }), jsxRuntime.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 && (jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", onClick: picker.selectNow, disabled: disabled, text: nowLabel }))] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) });
|
|
8456
8533
|
}
|
|
8457
8534
|
|
|
8458
8535
|
// dateRangePresetsTemporal.ts
|
|
@@ -8595,8 +8672,14 @@ const PRESET_LIBRARY_TEMPORAL = {
|
|
|
8595
8672
|
*/
|
|
8596
8673
|
const getPresetsByKeysTemporal = (keys) => keys.map((key) => PRESET_LIBRARY_TEMPORAL[key]).filter((preset) => preset !== undefined);
|
|
8597
8674
|
|
|
8598
|
-
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: locale$1 = locale.enGB, yearRangeStart, yearRangeEnd, showPresets = false, presetKeys, customPresets, }) {
|
|
8675
|
+
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: locale$1 = locale.enGB, yearRangeStart, yearRangeEnd, showPresets = false, presetKeys, customPresets, feedback, ...dataAttributes }) {
|
|
8599
8676
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
8677
|
+
const feedbackMessages = feedback
|
|
8678
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
8679
|
+
: [];
|
|
8680
|
+
const feedbackId = React.useId();
|
|
8681
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
8682
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
8600
8683
|
const [inputFromValue, setInputFromValue] = React.useState("");
|
|
8601
8684
|
const [inputToValue, setInputToValue] = React.useState("");
|
|
8602
8685
|
const [rangeErrorMessage, setRangeErrorMessage] = React.useState(null);
|
|
@@ -8756,7 +8839,7 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8756
8839
|
const handleInputFromChange = React.useCallback((e) => {
|
|
8757
8840
|
const newValue = e.currentTarget.value;
|
|
8758
8841
|
setInputFromValue(newValue);
|
|
8759
|
-
const parsed = parseDate(newValue, displayFormat);
|
|
8842
|
+
const parsed = newValue.length >= TYPED_DATE_MIN_LENGTH ? parseDate(newValue, displayFormat) : undefined;
|
|
8760
8843
|
if (parsed) {
|
|
8761
8844
|
if (validate(parsed, minDate, maxDate) && validateRange(parsed, value?.to)) {
|
|
8762
8845
|
onChange({ from: parsed, to: value?.to });
|
|
@@ -8769,7 +8852,7 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8769
8852
|
const handleInputToChange = React.useCallback((e) => {
|
|
8770
8853
|
const newValue = e.currentTarget.value;
|
|
8771
8854
|
setInputToValue(newValue);
|
|
8772
|
-
const parsed = parseDate(newValue, displayFormat);
|
|
8855
|
+
const parsed = newValue.length >= TYPED_DATE_MIN_LENGTH ? parseDate(newValue, displayFormat) : undefined;
|
|
8773
8856
|
if (parsed) {
|
|
8774
8857
|
if (validate(parsed, minDate, maxDate) && validateRange(value?.from, parsed)) {
|
|
8775
8858
|
onChange({ from: value?.from, to: parsed });
|
|
@@ -8898,11 +8981,11 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8898
8981
|
const defaultMonthJsDate = defaultMonth
|
|
8899
8982
|
? new Date(defaultMonth.year, defaultMonth.month - 1, 1)
|
|
8900
8983
|
: (value?.from ? plainDateToJsDate(value.from) : undefined);
|
|
8901
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.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' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), jsxRuntime.jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.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' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxRuntime.jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsxRuntime.jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsxRuntime.jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonthJsDate, locale: locale$1, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8984
|
+
return (jsxRuntime.jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.value, children: [jsxRuntime.jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.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' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), jsxRuntime.jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.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' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxRuntime.jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsxRuntime.jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsxRuntime.jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonthJsDate, locale: locale$1, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8985
|
+
today: new Date(),
|
|
8986
|
+
}, modifiersClassNames: {
|
|
8987
|
+
today: "rdp-day-today",
|
|
8988
|
+
} })] }), jsxRuntime.jsx("div", { role: "alert", "aria-live": "polite", className: rangeStyles.rangeError, children: rangeErrorMessage })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
8906
8989
|
}
|
|
8907
8990
|
|
|
8908
8991
|
function dateFromPercentage(startDate, visibleDays, percentage) {
|
|
@@ -9045,7 +9128,7 @@ class OnClickContextMenu {
|
|
|
9045
9128
|
}
|
|
9046
9129
|
}
|
|
9047
9130
|
|
|
9048
|
-
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"};
|
|
9131
|
+
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"};
|
|
9049
9132
|
|
|
9050
9133
|
const getNow$1 = (isUtc) => {
|
|
9051
9134
|
let now = new Date();
|
|
@@ -9107,7 +9190,7 @@ const SchedulerHeaderDivision = ({ topDivisions, bottomDivisions, classification
|
|
|
9107
9190
|
};
|
|
9108
9191
|
|
|
9109
9192
|
const HeaderTitle = ({ title, dividerText, width }) => {
|
|
9110
|
-
return (jsxRuntime.jsxs("div", { className: styles$3["scheduler-header-title"], style: { width: width }, children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx("
|
|
9193
|
+
return (jsxRuntime.jsxs("div", { className: styles$3["scheduler-header-title"], style: { width: width }, children: [jsxRuntime.jsx("div", { className: styles$3["title-cell"], children: jsxRuntime.jsx("span", { className: styles$3.title, children: title }) }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("span", { children: dividerText }) })] }));
|
|
9111
9194
|
};
|
|
9112
9195
|
|
|
9113
9196
|
const SchedulerHeader = ({ content, divisions, visibleDays, selectedDate, width, onEvent, timeLinePercentage, isUtc }) => {
|
|
@@ -9145,7 +9228,7 @@ function getStartEnd(day) {
|
|
|
9145
9228
|
};
|
|
9146
9229
|
}
|
|
9147
9230
|
|
|
9148
|
-
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"};
|
|
9231
|
+
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","underlay":"new-scheduler-module__underlay__RVCnV","label-halo":"new-scheduler-module__label-halo__84c7e","corner-marker":"new-scheduler-module__corner-marker__w7o90","color-bars":"new-scheduler-module__color-bars__MhMF7","scheduler-event-text":"new-scheduler-module__scheduler-event-text__zjvd7"};
|
|
9149
9232
|
|
|
9150
9233
|
const BackgroundEvent = ({ value, heightRem }) => {
|
|
9151
9234
|
const backColor = getHSLColor(value.color, value.alpha ?? 0.5);
|
|
@@ -9346,7 +9429,7 @@ const DefaultRowHeader = ({ value, width, onEvent }) => {
|
|
|
9346
9429
|
return (jsxRuntime.jsxs("div", { style: {
|
|
9347
9430
|
width: width,
|
|
9348
9431
|
flexShrink: 0,
|
|
9349
|
-
|
|
9432
|
+
background: value.highlightColor,
|
|
9350
9433
|
}, onClick: (_) => {
|
|
9351
9434
|
onEvent(new OnClickRowHeader(value.rowId));
|
|
9352
9435
|
}, className: styles$1["scheduler-row-header"], children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: value.title }), value.title2 && jsxRuntime.jsxs("span", { children: ["-", value.title2] }), " ", jsxRuntime.jsx("strong", { children: value.subtitle })] }), value.subtitle && jsxRuntime.jsxs("div", { style: { opacity: 0.5 }, children: [value.title3 && jsxRuntime.jsxs("span", { className: styles$1["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] }), value.subtitle2 && jsxRuntime.jsxs("span", { children: ["-", value.subtitle2] })] })] }));
|
|
@@ -9439,7 +9522,7 @@ const SchedulerEvent = ({ value, heightRem, onEvent, maxEventHeightRem }) => {
|
|
|
9439
9522
|
height: `calc(${effectiveHeight}rem - 4px)`,
|
|
9440
9523
|
opacity: eventTransparent ? 0.5 : 1,
|
|
9441
9524
|
...value.style,
|
|
9442
|
-
}, className: styles$2["scheduler-event"], children: [jsxRuntime.jsxs("div", { style: {
|
|
9525
|
+
}, className: styles$2["scheduler-event"], "data-underlay": value.underlay ? true : undefined, children: [value.underlay && jsxRuntime.jsx("div", { className: styles$2["underlay"], children: value.underlay }), jsxRuntime.jsxs("div", { style: {
|
|
9443
9526
|
display: "flex",
|
|
9444
9527
|
flexDirection: "row",
|
|
9445
9528
|
alignItems: "stretch",
|
|
@@ -9456,29 +9539,26 @@ const SchedulerEvent = ({ value, heightRem, onEvent, maxEventHeightRem }) => {
|
|
|
9456
9539
|
alignItems: "center",
|
|
9457
9540
|
whiteSpace: "nowrap",
|
|
9458
9541
|
color: textColor,
|
|
9459
|
-
}, children: value.icons }), jsxRuntime.jsx("span", { style: {
|
|
9542
|
+
}, children: value.icons }), jsxRuntime.jsx("span", { className: value.underlay ? styles$2["label-halo"] : undefined, style: {
|
|
9460
9543
|
padding: "0.1rem",
|
|
9461
9544
|
color: textColor,
|
|
9462
9545
|
display: "flex",
|
|
9463
9546
|
flex: 1,
|
|
9464
9547
|
alignItems: "center",
|
|
9465
9548
|
width: "100%",
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
width: "100%",
|
|
9469
|
-
}, children: value.rectangleColors.map((item, i) => (jsxRuntime.jsx("div", { className: "cwellt_rectangle_indicator", style: {
|
|
9470
|
-
backgroundColor: item,
|
|
9471
|
-
flex: 1,
|
|
9472
|
-
height: "8px",
|
|
9473
|
-
margin: 0,
|
|
9474
|
-
padding: 0,
|
|
9475
|
-
} }, value.id + "_" + i))) })) : (value.name) })] }), value.isResizable && (jsxRuntime.jsx(EventSideDrag, { heightRem: effectiveHeight * 0.7, onStartEvent: () => {
|
|
9549
|
+
...(value.underlay && { "--label-halo-color": backColor }),
|
|
9550
|
+
}, children: value.rectangleColors && value.rectangleColors.length > 0 ? (jsxRuntime.jsx("div", { className: styles$2["color-bars"], children: value.rectangleColors.map((item, i) => (jsxRuntime.jsx("div", { style: { backgroundColor: item } }, value.id + "_" + i))) })) : (value.label ?? value.name) })] }), value.isResizable && (jsxRuntime.jsx(EventSideDrag, { heightRem: effectiveHeight * 0.7, onStartEvent: () => {
|
|
9476
9551
|
onEvent(new OnRightDragStart(value.id));
|
|
9477
9552
|
} }))] }), value.primaryTimeMarkerColor && (jsxRuntime.jsx("div", { className: styles$2["time-marker"], style: {
|
|
9478
9553
|
backgroundColor: value.primaryTimeMarkerColor,
|
|
9479
9554
|
} })), value.secondaryTimeMarkerColor && (jsxRuntime.jsx("div", { className: styles$2["time-marker"], style: {
|
|
9480
9555
|
backgroundColor: value.secondaryTimeMarkerColor,
|
|
9481
|
-
} }))] }) }) }, value.id) })]
|
|
9556
|
+
} }))] }) }) }, value.id) }), value.cornerMarker && (jsxRuntime.jsx("div", { className: styles$2["corner-marker"], style: {
|
|
9557
|
+
top: `${topOffsetPx}px`,
|
|
9558
|
+
left: `${value.left}%`,
|
|
9559
|
+
width: `${value.width}%`,
|
|
9560
|
+
height: `calc(${effectiveHeight}rem - 4px)`,
|
|
9561
|
+
}, children: jsxRuntime.jsx("span", { "data-interactive": value.cornerMarker.tooltip ? true : undefined, "data-pulse": value.cornerMarker.pulse ? true : undefined, children: value.cornerMarker.tooltip ? (jsxRuntime.jsx(CwTooltipNew, { content: value.cornerMarker.tooltip, position: "top", showDelay: 200, hide: isOnDrag, displayInline: true, children: jsxRuntime.jsx(CwBadge, { color: value.cornerMarker.color, size: "medium" }) })) : (jsxRuntime.jsx(CwBadge, { color: value.cornerMarker.color, size: "medium" })) }) }))] }));
|
|
9482
9562
|
};
|
|
9483
9563
|
|
|
9484
9564
|
const SchedulerRow = React.memo((props) => {
|
|
@@ -9870,6 +9950,8 @@ const groupByRowIdStable = (items, prev) => {
|
|
|
9870
9950
|
const Scheduler = (props) => {
|
|
9871
9951
|
const { header: headerContent, id, events: eventsState, backgroundEvents, indicatorRows: allIndicatorRows = [], contextMenuItems, EventComp, RowTitleComp, orderCategories = ["title"], useOrderCategory, onEvent, groupRowColors, rowHeaderWidth = 180, rowHeightRem = 1.75, maxEventHeightRem, } = props;
|
|
9872
9952
|
const BackgroundEventComp = props.BackgroundEventComp ?? BackgroundEvent;
|
|
9953
|
+
// Picked by prefix: a rest spread would also put every non-destructured prop on the DOM.
|
|
9954
|
+
const dataAttributes = Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith("data-")));
|
|
9873
9955
|
const [constraintElement, setConstraintElement] = React.useState(null);
|
|
9874
9956
|
const rows = useOrderCategory === false
|
|
9875
9957
|
? props.rows
|
|
@@ -9878,9 +9960,10 @@ const Scheduler = (props) => {
|
|
|
9878
9960
|
// const rowHeaderWidth = "180px";
|
|
9879
9961
|
const { selectedDate, visibleDays, isUtc, isHeaderVisible, visibleRows: stateVisibleRows } = props.state;
|
|
9880
9962
|
const events = React.useMemo(() => filterVisibleEvents(eventsState, selectedDate, visibleDays), [eventsState, selectedDate, visibleDays]);
|
|
9963
|
+
// The virtual list caches row sizes: anything getItemSize depends on must reset them.
|
|
9881
9964
|
React.useEffect(() => {
|
|
9882
9965
|
instanceRef.current?.resetAfterIndex(0);
|
|
9883
|
-
}, [orderCategories, props.rows.length, events, allIndicatorRows]);
|
|
9966
|
+
}, [orderCategories, props.rows.length, events, allIndicatorRows, rowHeightRem]);
|
|
9884
9967
|
// Bucket events / backgroundEvents / indicatorRows by rowId once per render
|
|
9885
9968
|
// instead of running events.filter() per row inside the row renderer.
|
|
9886
9969
|
// Reuse previous bucket arrays when their contents are unchanged so the
|
|
@@ -9995,7 +10078,7 @@ const Scheduler = (props) => {
|
|
|
9995
10078
|
return rowsNumber * effectiveRowHeight * pixelsInRem + indicatorPixels;
|
|
9996
10079
|
}, [rows, eventsByRow, indicatorRowsByRow, rowHeightRem]);
|
|
9997
10080
|
// Render
|
|
9998
|
-
return (jsxRuntime.jsx(TooltipConstraintContext.Provider, { value: constraintElement, children: jsxRuntime.jsxs("div", { ref: setConstraintElement, id: id, style: {
|
|
10081
|
+
return (jsxRuntime.jsx(TooltipConstraintContext.Provider, { value: constraintElement, children: jsxRuntime.jsxs("div", { ...dataAttributes, ref: setConstraintElement, id: id, style: {
|
|
9999
10082
|
position: "relative",
|
|
10000
10083
|
height: `${schedulerContentHeight + 4}rem`,
|
|
10001
10084
|
overflowY: "auto",
|