@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.es.js
CHANGED
|
@@ -174,7 +174,7 @@ function getContrastColor(color) {
|
|
|
174
174
|
return `hsl(${hsl.h}, ${contrastS}%, ${targetL}%)`;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
var styles$
|
|
177
|
+
var styles$A = {"cw-tooltip-content":"cw-tooltip-module__cw-tooltip-content__RZczd","cw-tooltip":"cw-tooltip-module__cw-tooltip__1KYig"};
|
|
178
178
|
|
|
179
179
|
// Constants
|
|
180
180
|
const margin$1 = 16;
|
|
@@ -464,7 +464,7 @@ const CwTooltipManager = () => {
|
|
|
464
464
|
if (!state.isVisible || !state.content) {
|
|
465
465
|
return null;
|
|
466
466
|
}
|
|
467
|
-
return createPortal(jsx("div", { ref: tooltipRef, className: styles$
|
|
467
|
+
return createPortal(jsx("div", { ref: tooltipRef, className: styles$A["cw-tooltip-content"], "data-position": actualPosition, "data-visible": state.isVisible, "data-inline": state.displayInline, style: {
|
|
468
468
|
top: `${tooltipPosition.top}px`,
|
|
469
469
|
left: `${tooltipPosition.left}px`,
|
|
470
470
|
opacity: (isPositioned && !isMeasuring) ? 1 : 0,
|
|
@@ -545,7 +545,7 @@ const CwTooltipNew = ({ children, content = null, position = "right", dissapears
|
|
|
545
545
|
useEffect(() => {
|
|
546
546
|
ensureTooltipManager();
|
|
547
547
|
}, []);
|
|
548
|
-
return (jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$
|
|
548
|
+
return (jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$A["cw-tooltip"], children: children }));
|
|
549
549
|
};
|
|
550
550
|
|
|
551
551
|
const SVG_ICONS = {
|
|
@@ -665,7 +665,7 @@ function resolveBadgeAria(label, loading, hasText) {
|
|
|
665
665
|
return hasText ? {} : { 'aria-hidden': 'true' };
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
-
var styles$
|
|
668
|
+
var styles$z = {"badge":"cw-badge-module__badge__PKlak"};
|
|
669
669
|
|
|
670
670
|
/**
|
|
671
671
|
* CwBadge - the small coloured circle with a number, used for alert and notification counts.
|
|
@@ -677,6 +677,13 @@ var styles$y = {"badge":"cw-badge-module__badge__PKlak"};
|
|
|
677
677
|
* Precedence: `loading` > `content` > `count` > dot. While loading the badge renders regardless
|
|
678
678
|
* of `showZero`, and the spinner replaces it - circle, background and padding come off.
|
|
679
679
|
*
|
|
680
|
+
* Overlaid on a `CwButton` (its `badge` prop), the corner offset is a public custom-property API,
|
|
681
|
+
* settable on the button, an ancestor, or the badge's own `style`:
|
|
682
|
+
* - `--badge-offset-x` - distance from the button's right edge (`right`). Default
|
|
683
|
+
* `calc(var(--cw-spacing-small) * -1)`.
|
|
684
|
+
* - `--badge-offset-y` - distance from the button's top edge (`top`). Default
|
|
685
|
+
* `calc(var(--cw-spacing-tiny) * -1)`, `-0.125rem` on a large icon button.
|
|
686
|
+
*
|
|
680
687
|
* @example
|
|
681
688
|
* <CwBadge count={3} color="danger" />
|
|
682
689
|
* <CwBadge count={0} showZero={false} />
|
|
@@ -684,7 +691,7 @@ var styles$y = {"badge":"cw-badge-module__badge__PKlak"};
|
|
|
684
691
|
* <CwBadge color="warning" label="Unresolved findings" />
|
|
685
692
|
* <CwBadge count={0} loading />
|
|
686
693
|
*/
|
|
687
|
-
const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'small', showZero = true, loading = false, max = 99, label, className = '', style, }) => {
|
|
694
|
+
const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'small', showZero = true, loading = false, max = 99, label, className = '', style, ...dataAttributes }) => {
|
|
688
695
|
// null counts as absent, so `content={null}` still renders a dot rather than an empty pill.
|
|
689
696
|
const hasContent = content !== undefined && content !== null;
|
|
690
697
|
if (!loading && !hasContent && count !== undefined && !showZero && normalizeBadgeCount(count) === 0) {
|
|
@@ -694,8 +701,8 @@ const CwBadge = ({ count, content, color = 'info', variant = 'solid', size = 'sm
|
|
|
694
701
|
? formatBadgeCount(count, max)
|
|
695
702
|
: undefined;
|
|
696
703
|
const isDot = !loading && !hasContent && count === undefined;
|
|
697
|
-
const badgeClassNames = ['cw-badge', styles$
|
|
698
|
-
return (jsx("span", { className: badgeClassNames, "data-color": color, "data-variant": variant, "data-size": size, "data-loading": loading ? 'true' : undefined, "data-dot": isDot ? 'true' : undefined, ...resolveBadgeAria(label, loading, !loading && (hasContent || countText !== undefined)), style: style, children: loading ? jsx(CwIcon, { iconId: "spinner", size: "small" }) : hasContent ? content : countText }));
|
|
704
|
+
const badgeClassNames = ['cw-badge', styles$z.badge, className].filter(Boolean).join(' ');
|
|
705
|
+
return (jsx("span", { ...dataAttributes, className: badgeClassNames, "data-color": color, "data-variant": variant, "data-size": size, "data-loading": loading ? 'true' : undefined, "data-dot": isDot ? 'true' : undefined, ...resolveBadgeAria(label, loading, !loading && (hasContent || countText !== undefined)), style: style, children: loading ? jsx(CwIcon, { iconId: "spinner", size: "small" }) : hasContent ? content : countText }));
|
|
699
706
|
};
|
|
700
707
|
|
|
701
708
|
const CW_DEFAULT_MESSAGE_DURATION = 2000;
|
|
@@ -1082,7 +1089,7 @@ function CwLoading({ isLoading = false, text = '', size = 'regular', iconPositio
|
|
|
1082
1089
|
return (jsxs("div", { "aria-busy": isLoading, className: "cw-loading-container", "data-children": !!children, children: [overlay, jsx("div", { className: "cw-loading-disabled-content", children: children })] }));
|
|
1083
1090
|
}
|
|
1084
1091
|
|
|
1085
|
-
var styles$
|
|
1092
|
+
var styles$y = {"skeleton":"cw-skeleton-module__skeleton__Jvx2x","group":"cw-skeleton-module__group__Cm8AU"};
|
|
1086
1093
|
|
|
1087
1094
|
/*
|
|
1088
1095
|
* Internal helper for skeleton allocations (CwSkeleton, tables, cards).
|
|
@@ -1124,8 +1131,8 @@ function CwSkeleton({ variant = 'text', width, height, count = 1, radius, gap })
|
|
|
1124
1131
|
};
|
|
1125
1132
|
// The un-hashed cw-skeleton / cw-skeleton-group classes carry no styles in the
|
|
1126
1133
|
// library - they are stable public hooks for exceptional external overrides.
|
|
1127
|
-
const skeletonClassName = ['cw-skeleton', styles$
|
|
1128
|
-
const groupClassName = ['cw-skeleton-group', styles$
|
|
1134
|
+
const skeletonClassName = ['cw-skeleton', styles$y.skeleton].filter(Boolean).join(' ');
|
|
1135
|
+
const groupClassName = ['cw-skeleton-group', styles$y.group].filter(Boolean).join(' ');
|
|
1129
1136
|
const lineCount = normalizeSkeletonCount(count, 1);
|
|
1130
1137
|
if (lineCount <= 1) {
|
|
1131
1138
|
return (jsx("span", { className: skeletonClassName, "data-variant": variant, "aria-hidden": "true", style: style }));
|
|
@@ -1137,7 +1144,7 @@ function CwSkeleton({ variant = 'text', width, height, count = 1, radius, gap })
|
|
|
1137
1144
|
return (jsx("span", { className: groupClassName, "aria-hidden": "true", style: groupStyle, children: skeletonElements }));
|
|
1138
1145
|
}
|
|
1139
1146
|
|
|
1140
|
-
var styles$
|
|
1147
|
+
var styles$x = {"progress":"cw-progress-module__progress__d-g2-","value":"cw-progress-module__value__Q-DrH","label":"cw-progress-module__label__jwOWp","track":"cw-progress-module__track__572-3","footer":"cw-progress-module__footer__0Wo4G","header":"cw-progress-module__header__mv5ct","fill":"cw-progress-module__fill__fX1UA"};
|
|
1141
1148
|
|
|
1142
1149
|
/**
|
|
1143
1150
|
* CwProgress - a determinate or indeterminate progress bar.
|
|
@@ -1149,7 +1156,7 @@ var styles$w = {"progress":"cw-progress-module__progress__d-g2-","value":"cw-pro
|
|
|
1149
1156
|
* <CwProgress value={62} label="Import" color="success" />
|
|
1150
1157
|
* <CwProgress indeterminate label="Uploading" />
|
|
1151
1158
|
*/
|
|
1152
|
-
function CwProgress({ value, indeterminate = false, label, rightLabel, size = 'regular', layout = 'row', color = 'primary', monoValue = false, prominent = false, className }) {
|
|
1159
|
+
function CwProgress({ value, indeterminate = false, label, rightLabel, footer, size = 'regular', layout = 'row', color = 'primary', monoValue = false, prominent = false, className, style, ...dataAttributes }) {
|
|
1153
1160
|
const labelId = React__default.useId();
|
|
1154
1161
|
// Determinate: a missing or non-finite value is treated as 0 (never NaN), then
|
|
1155
1162
|
// clamped to [0,100] for aria-valuenow and the fill width. Indeterminate has no value.
|
|
@@ -1157,21 +1164,21 @@ function CwProgress({ value, indeterminate = false, label, rightLabel, size = 'r
|
|
|
1157
1164
|
? undefined
|
|
1158
1165
|
: Math.min(Math.max(Number.isFinite(value) ? value : 0, 0), 100);
|
|
1159
1166
|
const percent = clamped !== undefined ? Math.round(clamped) : undefined;
|
|
1160
|
-
const showValue = rightLabel
|
|
1161
|
-
const
|
|
1167
|
+
const showValue = rightLabel != null || (!indeterminate && percent !== undefined);
|
|
1168
|
+
const valueContent = rightLabel ?? (percent !== undefined ? `${percent}%` : '');
|
|
1162
1169
|
// The un-hashed cw-progress class carries no styles in the library - a stable
|
|
1163
1170
|
// public hook for exceptional external overrides only.
|
|
1164
|
-
const rootClassName = ['cw-progress', styles$
|
|
1165
|
-
const labelSpan = label ? jsx("span", { className: styles$
|
|
1166
|
-
const valueLabel = showValue ? (jsx("span", { className: styles$
|
|
1167
|
-
return (jsxs("div", { className: rootClassName, "data-layout": layout, "data-size": size, "data-color": color, "data-prominent": prominent || undefined, "data-indeterminate": indeterminate || undefined, children: [layout === 'column' && (labelSpan || valueLabel) && (jsxs("header", { className: styles$
|
|
1171
|
+
const rootClassName = ['cw-progress', styles$x.progress, className].filter(Boolean).join(' ');
|
|
1172
|
+
const labelSpan = label ? jsx("span", { className: styles$x.label, id: labelId, children: label }) : null;
|
|
1173
|
+
const valueLabel = showValue ? (jsx("span", { className: styles$x.value, "data-mono": monoValue || undefined, children: valueContent })) : null;
|
|
1174
|
+
return (jsxs("div", { ...dataAttributes, className: rootClassName, style: style, "data-layout": layout, "data-size": size, "data-color": color, "data-prominent": prominent || undefined, "data-indeterminate": indeterminate || undefined, children: [layout === 'column' && (labelSpan || valueLabel) && (jsxs("header", { className: styles$x.header, children: [labelSpan, valueLabel] })), layout === 'row' && labelSpan, jsx("div", { className: styles$x.track, role: "progressbar", ...(label && { 'aria-labelledby': labelId }), ...(!indeterminate && percent !== undefined && {
|
|
1168
1175
|
'aria-valuenow': percent,
|
|
1169
1176
|
'aria-valuemin': 0,
|
|
1170
1177
|
'aria-valuemax': 100
|
|
1171
|
-
}), children: jsx("div", { className: styles$
|
|
1178
|
+
}), children: jsx("div", { className: styles$x.fill, style: !indeterminate && clamped !== undefined ? { width: `${clamped}%` } : undefined }) }), layout === 'row' && valueLabel, footer != null && jsx("footer", { className: styles$x.footer, children: footer })] }));
|
|
1172
1179
|
}
|
|
1173
1180
|
|
|
1174
|
-
var styles$
|
|
1181
|
+
var styles$w = {"cw-generic-tooltip-content":"cw-generic-tooltip-module__cw-generic-tooltip-content__la-Si","cw-generic-tooltip":"cw-generic-tooltip-module__cw-generic-tooltip__Ij76M"};
|
|
1175
1182
|
|
|
1176
1183
|
// Constants moved outside to prevent recreation
|
|
1177
1184
|
const margin = 16;
|
|
@@ -1298,12 +1305,12 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1298
1305
|
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
|
|
1299
1306
|
setIsVisible(true);
|
|
1300
1307
|
}, showDelay);
|
|
1301
|
-
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$
|
|
1308
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$w["cw-generic-tooltip-content"]);
|
|
1302
1309
|
// Memoize tooltip content creation
|
|
1303
1310
|
const tooltipContent = useMemo(() => {
|
|
1304
1311
|
if (hide || !isVisible || !content)
|
|
1305
1312
|
return null;
|
|
1306
|
-
return createPortal(jsx("div", { className: styles$
|
|
1313
|
+
return createPortal(jsx("div", { className: styles$w["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, "data-inline": displayInline, style: {
|
|
1307
1314
|
position: 'fixed',
|
|
1308
1315
|
top: `${tooltipPosition.top}px`,
|
|
1309
1316
|
left: `${tooltipPosition.left}px`,
|
|
@@ -1318,7 +1325,7 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
1318
1325
|
clearTooltipTimeout();
|
|
1319
1326
|
setIsVisible(false);
|
|
1320
1327
|
}, [clearTooltipTimeout]);
|
|
1321
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
1328
|
+
return (jsxs("div", { ref: containerRef, className: styles$w["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, children: [tooltipContent, children] }));
|
|
1322
1329
|
};
|
|
1323
1330
|
|
|
1324
1331
|
const CwButton = React__default.forwardRef(function CwButton({ text, variant = 'solid', color = 'primary', size = 'medium', iconPosition = 'left', pressed, className = '', icon = "", title, tooltipPosition = "bottom", badge, children, ...buttonProps }, ref) {
|
|
@@ -1386,7 +1393,7 @@ function CwModal(custModalProps) {
|
|
|
1386
1393
|
return (jsx("div", { children: custModalProps.modalState && (jsxs("div", { className: custModalProps.classNameModalOverlay + " cwelltModalOverlay", children: [jsx("div", { className: "cwelltModalOverlayBg", onClick: custModalProps.onCloseModal }), jsx(Draggable, { disabled: isModalDisabled, axis: "both", nodeRef: draggableRef, children: jsxs("div", { className: custModalProps.classNameModal + " cwelltContainerModal", ref: draggableRef, style: widthModalDef !== "40em" ? modalStyle.widthCustomStyle : modalStyle.widthDefStyle, children: [jsxs("div", { className: "cwelltModalHeader", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsx("div", { className: "cwelltModalTitle", children: custModalProps.titleModal }), jsx("button", { className: "cwelltBtnCloseModal", onClick: custModalProps.onCloseModal, children: jsx("span", { className: "cwelltCloseIcon" }) })] }), jsx("div", { className: "cwelltModalBody", children: jsx("div", { className: "cwelltContainerModalBody", style: { position: "relative" }, children: custModalProps.children }) }), isHide === false ? (jsx("footer", { className: "legacy-modal-footer", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: custModalProps.onSaveModal, form: custModalProps.formSaveModal, hidden: custModalProps.HideBtnModal, type: custModalProps.HtmlSubmitModal }) })) : (jsx("div", { style: { display: "none" } }))] }) })] })) }));
|
|
1387
1394
|
}
|
|
1388
1395
|
|
|
1389
|
-
var styles$
|
|
1396
|
+
var styles$v = {"overlayPositioned":"CwConfirmationPopup-module__overlayPositioned__11qYB","popup":"CwConfirmationPopup-module__popup__ahPjM","message":"CwConfirmationPopup-module__message__MnNL4","buttons":"CwConfirmationPopup-module__buttons__fGYYE","button":"CwConfirmationPopup-module__button__ugYQE","confirmButton":"CwConfirmationPopup-module__confirmButton__rTP4S","cancelButton":"CwConfirmationPopup-module__cancelButton__Ry694"};
|
|
1390
1397
|
|
|
1391
1398
|
/**
|
|
1392
1399
|
* Small anchored confirmation for a destructive action.
|
|
@@ -1455,15 +1462,15 @@ function CwConfirmationPopup(props) {
|
|
|
1455
1462
|
onCancel();
|
|
1456
1463
|
}
|
|
1457
1464
|
};
|
|
1458
|
-
return (jsxs(Fragment, { children: [renderChildren(), isOpen && (jsx("div", { className: styles$
|
|
1465
|
+
return (jsxs(Fragment, { children: [renderChildren(), isOpen && (jsx("div", { className: styles$v.overlayPositioned, onClick: handleOverlayClick, children: jsxs("div", { ref: popupRef, className: styles$v.popup, style: {
|
|
1459
1466
|
position: 'absolute',
|
|
1460
1467
|
top: `${position.top}px`,
|
|
1461
1468
|
left: `${position.left}px`,
|
|
1462
1469
|
transform: 'none'
|
|
1463
|
-
}, children: [jsx("p", { className: styles$
|
|
1470
|
+
}, children: [jsx("p", { className: styles$v.message, children: message }), jsxs("div", { className: styles$v.buttons, children: [jsx("button", { className: `${styles$v.button} ${styles$v.confirmButton}`, onClick: onConfirm, children: confirmText }), jsx("button", { className: `${styles$v.button} ${styles$v.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
|
|
1464
1471
|
}
|
|
1465
1472
|
|
|
1466
|
-
var styles$
|
|
1473
|
+
var styles$u = {"cw-dialog-main":"cw-dialog-module__cw-dialog-main__cHxHt","cw-dialog-button-close":"cw-dialog-module__cw-dialog-button-close__9GRd8"};
|
|
1467
1474
|
|
|
1468
1475
|
// Helper function to parse size values
|
|
1469
1476
|
const parseSize = (size) => {
|
|
@@ -1736,7 +1743,7 @@ const CwDialog = props => {
|
|
|
1736
1743
|
}
|
|
1737
1744
|
}
|
|
1738
1745
|
}, [open]);
|
|
1739
|
-
const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$
|
|
1746
|
+
const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$u["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
|
|
1740
1747
|
const content = useMemo(() => (jsx("section", { children: children })), [children]);
|
|
1741
1748
|
const footer = useMemo(() => (jsx("footer", { children: customFooter || (jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: onSave, tooltipPosition: "top", disabled: disableSave, "data-testid": "cw-dialog-save" })) })), [customFooter, onSave, disableSave]);
|
|
1742
1749
|
const resizeHandles = useMemo(() => size.autoHeight
|
|
@@ -1763,7 +1770,7 @@ const CwDialog = props => {
|
|
|
1763
1770
|
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
1764
1771
|
return { displayWidth, displayHeight };
|
|
1765
1772
|
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
1766
|
-
const dialogContent = (jsx("div", { "data-has-scrim": hasScrim, className: styles$
|
|
1773
|
+
const dialogContent = (jsx("div", { "data-has-scrim": hasScrim, className: styles$u["cw-dialog-main"], onMouseDown: handleScrimMouseDown, onMouseUp: handleScrimMouseUpOrLeave, onMouseLeave: handleScrimMouseUpOrLeave, "data-pressing": isPressingScrim, children: jsxs("dialog", { ...domProps, ref: dialogRef, style: {
|
|
1767
1774
|
left: `${position.x}px`,
|
|
1768
1775
|
top: `${position.y}px`,
|
|
1769
1776
|
width: displayDimensions.displayWidth,
|
|
@@ -1925,7 +1932,7 @@ function CwAlign(props) {
|
|
|
1925
1932
|
}, children: props.children }));
|
|
1926
1933
|
}
|
|
1927
1934
|
|
|
1928
|
-
var styles$
|
|
1935
|
+
var styles$t = {"card":"cw-card-module__card__HJUT0","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"};
|
|
1929
1936
|
|
|
1930
1937
|
/**
|
|
1931
1938
|
* CwCard - A simple card component for displaying content in a contained format
|
|
@@ -1938,8 +1945,8 @@ var styles$s = {"card":"cw-card-module__card__HJUT0","clickable":"cw-card-module
|
|
|
1938
1945
|
* onDelete={confirmDeletion}
|
|
1939
1946
|
* footer="Last updated: 2 days ago"
|
|
1940
1947
|
* chips={[
|
|
1941
|
-
* { label: 'Important',
|
|
1942
|
-
* { label: 'Custom',
|
|
1948
|
+
* { label: 'Important', color: 'danger' },
|
|
1949
|
+
* { label: 'Custom', color: 'custom', customColor: '#8a2be2' }
|
|
1943
1950
|
* ]}
|
|
1944
1951
|
* >
|
|
1945
1952
|
* <p>This is the main content of the card.</p>
|
|
@@ -1951,10 +1958,10 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1951
1958
|
// Construct class names using CSS modules
|
|
1952
1959
|
const cardClassNames = [
|
|
1953
1960
|
'cw-card',
|
|
1954
|
-
styles$
|
|
1961
|
+
styles$t.card,
|
|
1955
1962
|
className,
|
|
1956
|
-
clickable ? styles$
|
|
1957
|
-
disabled ? styles$
|
|
1963
|
+
clickable ? styles$t.clickable : '',
|
|
1964
|
+
disabled ? styles$t.disabled : '',
|
|
1958
1965
|
].filter(Boolean).join(' ');
|
|
1959
1966
|
// Handle click event when card is clickable
|
|
1960
1967
|
const handleClick = () => {
|
|
@@ -1972,15 +1979,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1972
1979
|
const hasFooter = hasChips || footer || (hasActions && resolvedDirection === "row");
|
|
1973
1980
|
// Actions component to reuse. While loading, each provided action renders a circular
|
|
1974
1981
|
// ghost sized to the CwButton icon footprint (2rem) - no interactive buttons.
|
|
1975
|
-
const ActionsComponent = hasActions && !disabled ? (jsx("div", { className: styles$
|
|
1982
|
+
const ActionsComponent = hasActions && !disabled ? (jsx("div", { className: styles$t.actions, children: isLoading ? (jsxs(Fragment, { children: [extraActions && jsx(CwSkeleton, { variant: "circle", height: "2rem" }), onEdit && jsx(CwSkeleton, { variant: "circle", height: "2rem" }), onDelete && jsx(CwSkeleton, { variant: "circle", height: "2rem" })] })) : (jsxs(Fragment, { children: [extraActions ?? null, onEdit && jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) })) : null;
|
|
1976
1983
|
return (jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && !isLoading && {
|
|
1977
1984
|
role: 'button',
|
|
1978
1985
|
tabIndex: 0,
|
|
1979
1986
|
onClick: handleClick,
|
|
1980
|
-
}), "data-variant": variant, "data-direction": resolvedDirection, "aria-busy": isLoading || undefined, children: [isLoading ? (jsxs("header", { children: [jsx("div", { className: styles$
|
|
1987
|
+
}), "data-variant": variant, "data-direction": resolvedDirection, "aria-busy": isLoading || undefined, children: [isLoading ? (jsxs("header", { children: [jsx("div", { className: styles$t.headerContent, "data-align": resolvedAlign, children: jsx(CwSkeleton, { width: "8rem", height: "1.5em" }) }), resolvedDirection === "column" && ActionsComponent] })) : (hasHeader && (jsxs("header", { children: [(title || subtitle) && (jsxs("div", { className: styles$t.headerContent, "data-align": resolvedAlign, children: [title && jsx("h5", { children: title }), subtitle && jsx("strong", { children: subtitle })] })), resolvedDirection === "column" && ActionsComponent] }))), jsx("div", { className: styles$t.content, children: isLoading ? jsx(CwSkeleton, { count: normalizeSkeletonCount(skeletonLines, 3) }) : children }), hasFooter && (isLoading ? (jsx("footer", { children: jsx("div", { className: styles$t.footerTags, children: jsx(CwSkeleton, { variant: "rect", width: "4rem", height: "1.5em", radius: "1rem" }) }) })) : (jsxs("footer", { children: [hasChips && (jsx("div", { className: styles$t.footerTags, children: chips.map((chip, index) => (jsx(CwChip, { label: chip.label, 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 && (jsx("div", { className: styles$t.footerContent, children: footer }))] }))), resolvedDirection === "row" && ActionsComponent] }));
|
|
1981
1988
|
};
|
|
1982
1989
|
|
|
1983
|
-
var styles$
|
|
1990
|
+
var styles$s = {"cardContainer":"cw-card-list-module__cardContainer__l3YEh","pagination":"cw-card-list-module__pagination__5Ay78","pageInfo":"cw-card-list-module__pageInfo__uiMel","emptyState":"cw-card-list-module__emptyState__RlqiS"};
|
|
1984
1991
|
|
|
1985
1992
|
/**
|
|
1986
1993
|
* Option to display in the CwSelect
|
|
@@ -2075,10 +2082,10 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
|
|
|
2075
2082
|
icon: sortDirection === 'asc' ? 'arrow-up' : 'arrow-down',
|
|
2076
2083
|
onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'),
|
|
2077
2084
|
title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}`,
|
|
2078
|
-
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsx("div", { className: `${styles$
|
|
2085
|
+
}, value: sortKey, onChange: (e) => handleSortChange(e.target.value), children: sortOptions.map(option => (jsx(CwOption, { value: option.key, children: option.label }, option.key))) }) })), isLoading ? (jsx("div", { className: `${styles$s.cardContainer}`, "data-layout": layout, style: gridStyle, "aria-busy": true, children: Array.from({ length: normalizeSkeletonCount(skeletonCards, 6) }, (_, index) => (jsx(CwCard, { isLoading: true, children: null }, `skeleton_${index}`))) })) : sortedItems.length === 0 ? (jsx("div", { className: styles$s.emptyState, children: emptyState || jsx("p", { children: "No items to display" }) })) : (jsxs(Fragment, { children: [jsx("div", { className: `${styles$s.cardContainer}`, "data-layout": layout, style: gridStyle, children: visibleItems.map((item, index) => (jsx(React__default.Fragment, { children: renderCard(item, index) }, keyExtractor ? keyExtractor(item, index) : index))) }), totalPages > 1 && (jsxs("div", { className: styles$s.pagination, children: [jsx(CwButton, { variant: "icon", icon: "chevron-left", disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)) }), jsxs("span", { className: styles$s.pageInfo, children: [currentPage, " / ", totalPages] }), jsx(CwButton, { variant: "icon", icon: "chevron-right", disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)) })] }))] }))] }));
|
|
2079
2086
|
}
|
|
2080
2087
|
|
|
2081
|
-
var styles$
|
|
2088
|
+
var styles$r = {"cw-accordion":"cw-accordion-module__cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module__cw-accordion-body__xlI8b"};
|
|
2082
2089
|
|
|
2083
2090
|
/**
|
|
2084
2091
|
* Legacy collapsible section with its own header markup.
|
|
@@ -2093,7 +2100,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
2093
2100
|
setVisible_accordionBody(!isVisible_accordionBody);
|
|
2094
2101
|
};
|
|
2095
2102
|
// #endregion
|
|
2096
|
-
return (jsxs("div", { className: styles$
|
|
2103
|
+
return (jsxs("div", { className: styles$r["cw-accordion"], style: CwelltAccordionContainerProps.style, "data-open": isVisible_accordionBody, children: [jsxs("header", { onClick: () => showAccordionBody(), children: [jsx("div", { children: CwelltAccordionContainerProps.desc_text }), jsx("button", { className: "cw-button-icon" })] }), jsx("div", { className: styles$r["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
|
|
2097
2104
|
}
|
|
2098
2105
|
|
|
2099
2106
|
/*
|
|
@@ -2194,9 +2201,6 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2194
2201
|
return acc;
|
|
2195
2202
|
}, {}));
|
|
2196
2203
|
const [selectedKeys, setSelectedKeys] = useState(new Set(rowSelection?.selectedRowKeys || []));
|
|
2197
|
-
useEffect(() => {
|
|
2198
|
-
setCurrentPage(1);
|
|
2199
|
-
}, [data]);
|
|
2200
2204
|
useEffect(() => {
|
|
2201
2205
|
setSelectedKeys(new Set(rowSelection?.selectedRowKeys || []));
|
|
2202
2206
|
}, [rowSelection?.selectedRowKeys]);
|
|
@@ -2282,20 +2286,27 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2282
2286
|
return newSet;
|
|
2283
2287
|
});
|
|
2284
2288
|
}, [rowSelection, rowKey, sortedData]);
|
|
2289
|
+
const totalPages = useMemo(() => {
|
|
2290
|
+
return pagination ? Math.ceil(sortedData.length / localItemsPerPage) : 1;
|
|
2291
|
+
}, [sortedData, localItemsPerPage, pagination]);
|
|
2292
|
+
// Keep the page when data changes (e.g. a row was edited); only clamp it when it no longer exists.
|
|
2293
|
+
// Derived in render so a shrunk data set never shows an empty page for a frame.
|
|
2294
|
+
const page = Math.min(currentPage, Math.max(1, totalPages));
|
|
2295
|
+
useEffect(() => {
|
|
2296
|
+
if (page !== currentPage)
|
|
2297
|
+
setCurrentPage(page);
|
|
2298
|
+
}, [page, currentPage]);
|
|
2285
2299
|
const paginatedData = useMemo(() => {
|
|
2286
2300
|
if (!sortedData)
|
|
2287
2301
|
return [];
|
|
2288
2302
|
if (!pagination)
|
|
2289
2303
|
return sortedData;
|
|
2290
|
-
const start = (
|
|
2304
|
+
const start = (page - 1) * localItemsPerPage;
|
|
2291
2305
|
return sortedData.slice(start, start + localItemsPerPage);
|
|
2292
|
-
}, [sortedData,
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
const handlePageChange = (page) => {
|
|
2297
|
-
if (page >= 1 && page <= totalPages)
|
|
2298
|
-
setCurrentPage(page);
|
|
2306
|
+
}, [sortedData, page, localItemsPerPage, pagination]);
|
|
2307
|
+
const handlePageChange = (target) => {
|
|
2308
|
+
if (target >= 1 && target <= totalPages)
|
|
2309
|
+
setCurrentPage(target);
|
|
2299
2310
|
};
|
|
2300
2311
|
const startResize = (e, key) => {
|
|
2301
2312
|
e.preventDefault();
|
|
@@ -2356,7 +2367,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2356
2367
|
? "sortable"
|
|
2357
2368
|
: sortConfig.direction === "asc"
|
|
2358
2369
|
? "sortable-asc"
|
|
2359
|
-
: "sortable-desc" }))] }), jsx("span", { onMouseDown: (e) => startResize(e, col.key), className: "th-column-resizer" })] }, col.key)))] }) }), jsx("tbody", { children: renderTableBody() })] }), pagination && data.length > pageSizeOptions[0] && (jsxs("footer", { className: "cw-table-pagination", children: [jsxs("div", { className: "cw-table-pagination-size", children: [jsx(CwIcon, { iconId: "list" }), jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, children: pageSizeOptions.map(size => (jsx("option", { value: size, children: pageLabel ? `${size} / ${pageLabel}` : size }, size))) })] }), jsxs("div", { className: "cw-table-pagination-nav", children: [jsx(CwButton, { onClick: () => handlePageChange(1), disabled:
|
|
2370
|
+
: "sortable-desc" }))] }), jsx("span", { onMouseDown: (e) => startResize(e, col.key), className: "th-column-resizer" })] }, col.key)))] }) }), jsx("tbody", { children: renderTableBody() })] }), pagination && data.length > pageSizeOptions[0] && (jsxs("footer", { className: "cw-table-pagination", children: [jsxs("div", { className: "cw-table-pagination-size", children: [jsx(CwIcon, { iconId: "list" }), jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, children: pageSizeOptions.map(size => (jsx("option", { value: size, children: pageLabel ? `${size} / ${pageLabel}` : size }, size))) })] }), jsxs("div", { className: "cw-table-pagination-nav", children: [jsx(CwButton, { onClick: () => handlePageChange(1), disabled: page === 1 || totalPages <= 1, variant: "icon", icon: "chevron-left-double" }), jsx(CwButton, { onClick: () => handlePageChange(page - 1), disabled: page === 1 || totalPages <= 1, variant: "icon", icon: "chevron-left" }), jsx("input", { type: "text", inputMode: "numeric", value: totalPages === 0 ? 0 : page, disabled: totalPages === 0, onChange: (e) => {
|
|
2360
2371
|
const value = parseInt(e.target.value, 10);
|
|
2361
2372
|
if (!isNaN(value))
|
|
2362
2373
|
handlePageChange(value);
|
|
@@ -2365,10 +2376,10 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
2365
2376
|
if (isNaN(value) || value < 1 || value > totalPages) {
|
|
2366
2377
|
handlePageChange(1);
|
|
2367
2378
|
}
|
|
2368
|
-
}, min: 1, max: totalPages }), jsx("span", { children: "/" }), jsx("span", { children: totalPages }), jsx(CwButton, { onClick: () => handlePageChange(
|
|
2379
|
+
}, min: 1, max: totalPages }), jsx("span", { children: "/" }), jsx("span", { children: totalPages }), jsx(CwButton, { onClick: () => handlePageChange(page + 1), disabled: page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2369
2380
|
}
|
|
2370
2381
|
|
|
2371
|
-
var styles$
|
|
2382
|
+
var styles$q = {"dropIndicator":"cw-sortable-table-module__dropIndicator__ov-Jz","dragging":"cw-sortable-table-module__dragging__MrLrz","saveBar":"cw-sortable-table-module__saveBar__3OdoZ cw-flex-row cw-align-center-center cw-gap-small"};
|
|
2372
2383
|
|
|
2373
2384
|
/**
|
|
2374
2385
|
* Hook that provides state management for CwSortableTable.
|
|
@@ -2431,7 +2442,7 @@ function useSortableTable(initialItems) {
|
|
|
2431
2442
|
}
|
|
2432
2443
|
|
|
2433
2444
|
// ─── Drop indicator row ───────────────────────────────────────────────────────
|
|
2434
|
-
const DropIndicatorRow = ({ colSpan }) => (jsx("tr", { className: styles$
|
|
2445
|
+
const DropIndicatorRow = ({ colSpan }) => (jsx("tr", { className: styles$q.dropIndicator, "aria-hidden": true, children: jsx("td", { colSpan: colSpan, children: jsx("div", {}) }) }));
|
|
2435
2446
|
// ─── Loading skeleton ─────────────────────────────────────────────────────────
|
|
2436
2447
|
// Plain td cells (no local class): the ghost cells get the same global cw-table
|
|
2437
2448
|
// padding as real body cells, so row heights match the loaded rows exactly.
|
|
@@ -2534,11 +2545,11 @@ function CwSortableTable({ columns, data, rowKey = "key", onReorder, loading = f
|
|
|
2534
2545
|
return items.map((item, index) => {
|
|
2535
2546
|
const key = item[rowKey];
|
|
2536
2547
|
const isDragging = draggedItem?.[rowKey] === key;
|
|
2537
|
-
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && (jsx(DropIndicatorRow, { colSpan: totalCols })), jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$
|
|
2548
|
+
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && (jsx(DropIndicatorRow, { colSpan: totalCols })), jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$q.dragging : "", children: [showHandle && (jsx("td", { className: "cw-table-col-action", children: jsx(CwIcon, { iconId: "grip-dots", color: "neutral", style: { opacity: 0.75 } }) })), columns.map(col => (jsx("td", { className: col.className ?? "", style: col.width ? { width: col.width } : undefined, children: renderCell(item, col) }, `${String(key)}_${col.key}`)))] }), index === items.length - 1 && dropIndicatorIndex === items.length && (jsx(DropIndicatorRow, { colSpan: totalCols }))] }, String(key)));
|
|
2538
2549
|
});
|
|
2539
2550
|
};
|
|
2540
2551
|
// ── Render ──────────────────────────────────────────────────────────────
|
|
2541
|
-
return (jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, "aria-busy": loading || undefined, children: [jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { children: jsxs("tr", { children: [showHandle && jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsx("tbody", { children: renderBody() })] }), !loading && hasChanges && (jsxs("footer", { className: styles$
|
|
2552
|
+
return (jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, "aria-busy": loading || undefined, children: [jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { children: jsxs("tr", { children: [showHandle && jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsx("tbody", { children: renderBody() })] }), !loading && hasChanges && (jsxs("footer", { className: styles$q.saveBar, children: [jsx(CwButton, { variant: "outline", color: "neutral", icon: "undo", text: discardLabel, onClick: handleDiscard }), jsx(CwButton, { variant: "solid", color: "primary", icon: "save", text: saveLabel, onClick: () => handleSave(onReorder) })] }))] }));
|
|
2542
2553
|
}
|
|
2543
2554
|
|
|
2544
2555
|
/**
|
|
@@ -2739,7 +2750,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
2739
2750
|
}, min: 1, max: totalPages }), jsx("span", { children: "/" }), jsx("span", { children: totalPages }), jsx(CwButton, { onClick: () => handlePageChange(state.page + 1), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right" }), jsx(CwButton, { onClick: () => handlePageChange(totalPages), disabled: state.page === totalPages || totalPages <= 1, variant: "icon", icon: "chevron-right-double" })] })] }))] }));
|
|
2740
2751
|
}
|
|
2741
2752
|
|
|
2742
|
-
var styles$
|
|
2753
|
+
var styles$p = {"cw-tabs":"cw-tabs-module__cw-tabs__1pmji","cw-tabs-content":"cw-tabs-module__cw-tabs-content__HTp8d"};
|
|
2743
2754
|
|
|
2744
2755
|
const BADGE_COLOR_SCHEMES = ['primary', 'danger', 'warning', 'success', 'info', 'neutral'];
|
|
2745
2756
|
function isBadgeColorScheme(value) {
|
|
@@ -2793,11 +2804,11 @@ function CwTabs(CwTabsProps) {
|
|
|
2793
2804
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
2794
2805
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
2795
2806
|
: undefined;
|
|
2796
|
-
return (jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$
|
|
2807
|
+
return (jsxs("div", { id: CwTabsProps.id, "data-testid": CwTabsProps.testId, className: styles$p['cw-tabs'] + (CwTabsProps.className ? ` ${CwTabsProps.className}` : "") + "", style: CwTabsProps.style, "data-tabs-position": position, children: [jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => {
|
|
2797
2808
|
const badgeScheme = tab.badgeColor && isBadgeColorScheme(tab.badgeColor) ? tab.badgeColor : undefined;
|
|
2798
2809
|
const rawBadgeColor = tab.badgeColor && !badgeScheme ? tab.badgeColor : undefined;
|
|
2799
2810
|
return (jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, "data-tab-key": tab.key, "data-badge-themed": tab.badgeColor ? "true" : undefined, children: [jsx(TabIcon, { icon: tab.icon }), tab.title, (tab.badge !== undefined || tab.badgeColor) && (jsx(CwBadge, { count: typeof tab.badge === 'number' ? tab.badge : undefined, content: typeof tab.badge === 'string' ? tab.badge : undefined, size: "medium", color: badgeScheme ?? 'primary', variant: badgeScheme ? 'solid' : 'soft', style: rawBadgeColor ? { backgroundColor: rawBadgeColor, color: getContrastColor(rawBadgeColor) } : undefined }))] }, tab.key));
|
|
2800
|
-
}) }), jsx("div", { className: styles$
|
|
2811
|
+
}) }), jsx("div", { className: styles$p['cw-tabs-content'], "data-active-tab-key": activeTab ?? undefined, style: CwTabsProps.contentHeight ? { '--tabs-height': CwTabsProps.contentHeight } : undefined, children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
|
|
2801
2812
|
}
|
|
2802
2813
|
|
|
2803
2814
|
/**
|
|
@@ -2825,7 +2836,7 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
2825
2836
|
return (jsxs("details", { ref: myRef, ...detailsProps, className: "cw-expandable", children: [jsx("summary", { children: briefing }), children && jsx("section", { children: children })] }));
|
|
2826
2837
|
};
|
|
2827
2838
|
|
|
2828
|
-
var styles$
|
|
2839
|
+
var styles$o = {"cw-master-detail":"cw-master-detail-module__cw-master-detail__O8-FA","resizer":"cw-master-detail-module__resizer__hvGhL","detail":"cw-master-detail-module__detail__BG4Dm","skeletonRow":"cw-master-detail-module__skeletonRow__6BUgt","detailSkeleton":"cw-master-detail-module__detailSkeleton__GcDS4","detail-empty":"cw-master-detail-module__detail-empty__KFScK"};
|
|
2829
2840
|
|
|
2830
2841
|
/*
|
|
2831
2842
|
* Fixed rem widths for the ghosts: the master rows and detail panel size their
|
|
@@ -2869,12 +2880,12 @@ const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, de
|
|
|
2869
2880
|
document.body.style.userSelect = '';
|
|
2870
2881
|
};
|
|
2871
2882
|
}, [isResizing, minMasterWidth, maxMasterWidth]);
|
|
2872
|
-
const rootClassName = [styles$
|
|
2883
|
+
const rootClassName = [styles$o['cw-master-detail'], className].filter(Boolean).join(' ');
|
|
2873
2884
|
return (jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, "aria-busy": loading || undefined, children: [jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsx("search", { children: jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsx("header", { children: masterHeader })), jsx("ul", { children: loading
|
|
2874
|
-
? Array.from({ length: skeletonRows }, (_unused, rowIndex) => (jsxs("li", { "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "circle", height: "2rem" }), jsxs("div", { className: styles$
|
|
2875
|
-
: items.map((item) => (jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsx("footer", { children: masterFooter }))] }), resizable && (jsx("div", { className: styles$
|
|
2885
|
+
? Array.from({ length: skeletonRows }, (_unused, rowIndex) => (jsxs("li", { "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "circle", height: "2rem" }), jsxs("div", { className: styles$o.skeletonRow, children: [jsx(CwSkeleton, { variant: "text", width: MASTER_TITLE_WIDTHS[rowIndex % MASTER_TITLE_WIDTHS.length] }), jsx(CwSkeleton, { variant: "text", width: MASTER_SUBTITLE_WIDTH })] })] }, `skeleton_${rowIndex}`)))
|
|
2886
|
+
: items.map((item) => (jsx("li", { "data-master-key": item.key, "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsx("footer", { children: masterFooter }))] }), resizable && (jsx("div", { className: styles$o.resizer, "data-resizing": isResizing, onMouseDown: handleMouseDown })), jsx("section", { className: styles$o.detail, children: loading ? (jsxs("div", { className: styles$o.detailSkeleton, "aria-hidden": "true", children: [jsx(CwSkeleton, { variant: "text", width: "14rem", height: "1.5em" }), jsx(CwSkeleton, { variant: "text", width: "22rem" }), jsx(CwSkeleton, { variant: "text", width: "18rem" }), jsx(CwSkeleton, { variant: "text", width: "20rem" })] })) : selectedKey && detailContent
|
|
2876
2887
|
? detailContent
|
|
2877
|
-
: (jsx("div", { className: styles$
|
|
2888
|
+
: (jsx("div", { className: styles$o['detail-empty'], children: emptyDetail ?? 'Select an item to view details' })) })] }));
|
|
2878
2889
|
};
|
|
2879
2890
|
|
|
2880
2891
|
/*
|
|
@@ -2914,7 +2925,7 @@ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "
|
|
|
2914
2925
|
return (jsx("dl", { className: `cw-keyvalue-list ${className}`, "data-direction": groupLayout?.direction, "data-align": groupLayout?.align, "data-justify": groupLayout?.justify, "data-gap": groupLayout?.gap, "aria-busy": loading || undefined, ...htmlProps, children: renderItems() }));
|
|
2915
2926
|
};
|
|
2916
2927
|
|
|
2917
|
-
var styles$
|
|
2928
|
+
var styles$n = {"sortableList":"cw-sortable-list-module__sortableList__PyLO-","sortableItem":"cw-sortable-list-module__sortableItem__FAnn2","readOnly":"cw-sortable-list-module__readOnly__r7GcH","dragging":"cw-sortable-list-module__dragging__MD715","moved":"cw-sortable-list-module__moved__sE6-N","expandedContent":"cw-sortable-list-module__expandedContent__Kocna","sortableHandle":"cw-sortable-list-module__sortableHandle__HvYBK","sortableContent":"cw-sortable-list-module__sortableContent__C6JhR","sortableTitle":"cw-sortable-list-module__sortableTitle__EgWXr","sortableExtraContent":"cw-sortable-list-module__sortableExtraContent__s4LSv","sortableActions":"cw-sortable-list-module__sortableActions__gwQOU","dropIndicator":"cw-sortable-list-module__dropIndicator__MNSF-","emptyMessage":"cw-sortable-list-module__emptyMessage__gMpaL"};
|
|
2918
2929
|
|
|
2919
2930
|
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, maxHeight = "300px", }) {
|
|
2920
2931
|
const [draggedItem, setDraggedItem] = useState(null);
|
|
@@ -2977,15 +2988,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
|
|
|
2977
2988
|
}
|
|
2978
2989
|
};
|
|
2979
2990
|
if (items.length === 0) {
|
|
2980
|
-
return (jsx("div", { className: `${styles$
|
|
2991
|
+
return (jsx("div", { className: `${styles$n.sortableList} ${styles$n.emptyState} ${className}`, children: jsx("div", { className: styles$n.emptyMessage, children: emptyMessage }) }));
|
|
2981
2992
|
}
|
|
2982
|
-
return (jsx("div", { className: `${styles$
|
|
2993
|
+
return (jsx("div", { className: `${styles$n.sortableList} ${className}`, style: { maxHeight }, children: items.map((item, index) => {
|
|
2983
2994
|
const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
|
|
2984
2995
|
const isDragging = draggedItem?.id === item.id;
|
|
2985
2996
|
const isMoved = movedItems.has(item.id);
|
|
2986
2997
|
const canExpand = Boolean(expandedContent);
|
|
2987
2998
|
const isExpanded = expandedItems.has(item.id);
|
|
2988
|
-
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && jsx("div", { className: styles$
|
|
2999
|
+
return (jsxs(React__default.Fragment, { children: [dropIndicatorIndex === index && jsx("div", { className: styles$n.dropIndicator }), jsxs("div", { className: `${styles$n.sortableItem} ${isDragging ? styles$n.dragging : ''} ${isMoved ? styles$n.moved : ''} ${readOnly ? styles$n.readOnly : ''}`, draggable: !readOnly, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, children: [jsxs("header", { children: [canExpand ? (jsx(CwButton, { variant: "icon", onClick: () => toggleExpanded(item.id), type: "button", title: isExpanded ? "Collapse" : "Expand", icon: isExpanded ? "chevron-up" : "chevron-down" })) : showHandle ? (jsx("div", { className: styles$n.sortableHandle, children: jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxs("div", { className: styles$n.sortableContent, children: [jsx("div", { className: styles$n.sortableTitle, children: title }), extraContent && jsx("div", { className: styles$n.sortableExtraContent, children: extraContent })] }), jsx("div", { className: styles$n.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsx("div", { className: styles$n.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsx("div", { className: styles$n.dropIndicator }))] }, item.id));
|
|
2989
3000
|
}) }));
|
|
2990
3001
|
}
|
|
2991
3002
|
|
|
@@ -3112,7 +3123,7 @@ const CwTableGrouped = props => {
|
|
|
3112
3123
|
group.rows.map((child, j) => (jsx("tr", { "data-row": true, "data-row-last-of-group": j == group.rows.length - 1, children: child.cells.map((cell, k) => (jsx("td", { children: cell.content }, k))) }, j)))] }, i))) }), jsx("tfoot", {})] }) }));
|
|
3113
3124
|
};
|
|
3114
3125
|
|
|
3115
|
-
var styles$
|
|
3126
|
+
var styles$m = {"fileUploadContainer":"cw-file-upload-multiple-module__fileUploadContainer__liEc1","hiddenInput":"cw-file-upload-multiple-module__hiddenInput__TZBBI","uploadArea":"cw-file-upload-multiple-module__uploadArea__DdOhs","uploadAreaDisabled":"cw-file-upload-multiple-module__uploadAreaDisabled__VWeFX","uploadTitle":"cw-file-upload-multiple-module__uploadTitle__gjRk8","uploadSubtitle":"cw-file-upload-multiple-module__uploadSubtitle__Z0S5t","filesContainer":"cw-file-upload-multiple-module__filesContainer__g44PY","fileItem":"cw-file-upload-multiple-module__fileItem__w27Dg","fileIcon":"cw-file-upload-multiple-module__fileIcon__iJJUX","fileExtension":"cw-file-upload-multiple-module__fileExtension__vOuHv","fileInfo":"cw-file-upload-multiple-module__fileInfo__R5ZTv","fileName":"cw-file-upload-multiple-module__fileName__DjepK","fileSize":"cw-file-upload-multiple-module__fileSize__b8GSm","smallButton":"cw-file-upload-multiple-module__smallButton__siUAh"};
|
|
3116
3127
|
|
|
3117
3128
|
const DEFAULT_LABELS$1 = {
|
|
3118
3129
|
uploadDisabled: 'Upload disabled',
|
|
@@ -3298,12 +3309,12 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3298
3309
|
}
|
|
3299
3310
|
}
|
|
3300
3311
|
};
|
|
3301
|
-
return (jsxs("div", { className: `${styles$
|
|
3312
|
+
return (jsxs("div", { className: `${styles$m.fileUploadContainer} ${fileUploadProps.className}`, children: [jsx("input", { ref: fileInputRef, type: "file", name: fileUploadProps.name, accept: fileUploadProps.accept, multiple: fileUploadProps.multiple, onChange: handleFileSelectInternal, disabled: fileUploadProps.disabled, "aria-label": "files", className: styles$m.hiddenInput }), selectedFiles.length === 0 && !existingFile ? (jsxs("div", { className: `${styles$m.uploadArea} ${fileUploadProps.disabled ? styles$m.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsx(CwIcon, { iconId: "upload" }), jsx("p", { className: `${styles$m.uploadTitle}`, children: fileUploadProps.disabled ? labels.uploadDisabled : labels.clickToUpload }), jsxs("p", { className: `${styles$m.uploadSubtitle}`, children: [fileUploadProps.accept ? labels.acceptedFiles(fileUploadProps.accept) : labels.allTypesAccepted, !fileUploadProps.multiple && ` ${labels.singleFileOnly}`] })] })) : selectedFiles.length === 0 && existingFile ? (jsxs("div", { className: styles$m.filesContainer, children: [jsxs("div", { className: styles$m.fileItem, children: [jsxs("div", { className: styles$m.fileIcon, children: [jsx(CwIcon, { iconId: "page" }), jsx("span", { className: styles$m.fileExtension, children: getFileExtension(existingFile) })] }), jsx("div", { className: styles$m.fileInfo, children: jsx("p", { className: styles$m.fileName, children: existingFile }) }), jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => {
|
|
3302
3313
|
setExistingFile(undefined);
|
|
3303
3314
|
if (fileUploadProps.onSelect) {
|
|
3304
3315
|
fileUploadProps.onSelect(null);
|
|
3305
3316
|
}
|
|
3306
|
-
}, disabled: fileUploadProps.disabled, className: styles$
|
|
3317
|
+
}, disabled: fileUploadProps.disabled, className: styles$m.smallButton })] }), jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled })] })) : (jsxs("div", { className: styles$m.filesContainer, children: [jsxs("header", { className: "cw-flex-row cw-align-between-center cw-flex-wrap", children: [jsx("small", { className: styles$m.filesCount, children: fileUploadProps.statusText ?? labels.filesSelected(selectedFiles.length) }), jsxs("div", { className: "cw-flex-row", children: [fileUploadProps.onConfirm && selectedFiles.length > 0 && (jsx(CwButton, { onClick: () => {
|
|
3307
3318
|
let files = fileInputRef.current?.files ?? null;
|
|
3308
3319
|
if (!files) {
|
|
3309
3320
|
const dataTransfer = new DataTransfer();
|
|
@@ -3311,7 +3322,7 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
3311
3322
|
files = dataTransfer.files;
|
|
3312
3323
|
}
|
|
3313
3324
|
fileUploadProps.onConfirm?.(files);
|
|
3314
|
-
}, disabled: fileUploadProps.disabled || fileUploadProps.confirmDisabled, icon: "upload", text: fileUploadProps.confirmLabel ?? labels.upload })), !fileUploadProps.hideClearAll && (jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] })] }), selectedFiles.map((file, index) => (jsxs("div", { className: styles$
|
|
3325
|
+
}, disabled: fileUploadProps.disabled || fileUploadProps.confirmDisabled, icon: "upload", text: fileUploadProps.confirmLabel ?? labels.upload })), !fileUploadProps.hideClearAll && (jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: labels.clearAll }))] })] }), selectedFiles.map((file, index) => (jsxs("div", { className: styles$m.fileItem, children: [jsxs("div", { className: styles$m.fileIcon, children: [jsx(CwIcon, { iconId: "page" }), jsx("span", { className: styles$m.fileExtension, children: getFileExtension(file.name) })] }), jsxs("div", { className: styles$m.fileInfo, children: [jsx("p", { className: styles$m.fileName, children: file.name }), jsxs("p", { className: styles$m.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$m.smallButton })] }, `${file.name}-${file.size}`))), fileUploadProps.multiple && (jsx(CwButton, { text: labels.addMoreFiles, icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsx(CwButton, { text: labels.changeFile, icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
|
|
3315
3326
|
}
|
|
3316
3327
|
|
|
3317
3328
|
/**
|
|
@@ -3364,7 +3375,7 @@ function CwDigit(props) {
|
|
|
3364
3375
|
return (jsxs("div", { className: "cw-input-text", "data-direction": labelProps ? flexDirection : "column", "data-feedback-position": feedbackPosition, children: [jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { className: "cw-input-button", children: [jsx("input", { type: "number", ...inputProps, "aria-describedby": describedBy }), buttonProps && jsx(CwButton, { ...buttonProps })] })] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-info", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
3365
3376
|
}
|
|
3366
3377
|
|
|
3367
|
-
var styles$
|
|
3378
|
+
var styles$l = {"colorPreview":"cw-color-picker-module__colorPreview__ylJcD","hueBar":"cw-color-picker-module__hueBar__bFhyC","hueBarSlider":"cw-color-picker-module__hueBarSlider__D53IV","colorPickerInteractiveArea":"cw-color-picker-module__colorPickerInteractiveArea__KZFR1","colorArea":"cw-color-picker-module__colorArea__xgpSE","colorAreaOverlay":"cw-color-picker-module__colorAreaOverlay__pmgOc","hueBackground":"cw-color-picker-module__hueBackground__Mks78","whiteGradient":"cw-color-picker-module__whiteGradient__Bt-fU","blackGradient":"cw-color-picker-module__blackGradient__VnEKJ","colorAreaCursor":"cw-color-picker-module__colorAreaCursor__lotg3"};
|
|
3368
3379
|
|
|
3369
3380
|
const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
|
|
3370
3381
|
const [rgb, setRgb] = useState({ r: 255, g: 255, b: 255 });
|
|
@@ -3567,13 +3578,13 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
|
|
|
3567
3578
|
// Calculate background color for the main area based on current hue
|
|
3568
3579
|
const hueColor = hsvToRgb(hsv.h, 100, 100);
|
|
3569
3580
|
const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
|
|
3570
|
-
return (jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsx("div", { className: styles$
|
|
3581
|
+
return (jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsx("div", { className: styles$l.colorPreview, style: { backgroundColor: hexColor, color: getContrastColor(hexColor) }, children: previewText }), jsx("button", { type: "button", className: "cw-button", onClick: toggleInputMode, style: { minWidth: "3ch" }, children: inputMode === 'hex' ? 'RGB' : 'HEX' })] }), jsx("div", { className: "color-inputs-row", children: inputMode === 'hex' ? (jsx("input", { type: "text", value: hexColor, onChange: handleHexChange })) : (jsxs("div", { className: "cw-grid-base-3 cw-gap-small", children: [jsxs("div", { children: [jsx("label", { children: "R:" }), jsx("input", { type: "number", name: "r", min: "0", max: "255", value: rgb.r, onChange: handleRgbChange })] }), jsxs("div", { children: [jsx("label", { children: "G:" }), jsx("input", { type: "number", name: "g", min: "0", max: "255", value: rgb.g, onChange: handleRgbChange })] }), jsxs("div", { children: [jsx("label", { children: "B:" }), jsx("input", { type: "number", name: "b", min: "0", max: "255", value: rgb.b, onChange: handleRgbChange })] })] })) }), jsxs("div", { className: styles$l.colorPickerInteractiveArea, children: [jsx("div", { className: styles$l.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsx("div", { className: styles$l.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxs("div", { className: styles$l.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxs("div", { className: styles$l.colorAreaOverlay, children: [jsx("div", { className: styles$l.hueBackground, style: { backgroundColor: hueHex } }), jsx("div", { className: styles$l.whiteGradient }), jsx("div", { className: styles$l.blackGradient })] }), jsx("div", { className: styles$l.colorAreaCursor, style: {
|
|
3571
3582
|
left: `${hsv.s}%`,
|
|
3572
3583
|
top: `${100 - hsv.v}%`
|
|
3573
3584
|
} })] })] })] }));
|
|
3574
3585
|
};
|
|
3575
3586
|
|
|
3576
|
-
var styles$
|
|
3587
|
+
var styles$k = {"container":"cw-input-color-module__container__x7gpk","selectColor":"cw-input-color-module__selectColor__DTo3V","disabled":"cw-input-color-module__disabled__O1fK5","readOnly":"cw-input-color-module__readOnly__HL-Bz","colorDropdown":"cw-input-color-module__colorDropdown__pX2bc"};
|
|
3577
3588
|
|
|
3578
3589
|
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, readOnly = false, width = '4rem', height = '2rem', labelProps, layoutProps, className, style, }) => {
|
|
3579
3590
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -3706,11 +3717,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
3706
3717
|
break;
|
|
3707
3718
|
}
|
|
3708
3719
|
};
|
|
3709
|
-
return (jsxs("div", { className: `cw-input-color ${styles$
|
|
3720
|
+
return (jsxs("div", { className: `cw-input-color ${styles$k.container}${className ? ` ${className}` : ''}`, style: style, "data-direction": layoutProps?.direction ?? "row", "data-align": layoutProps?.align, children: [labelProps && (jsx(CwLabel, { ...labelProps })), jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$k.selectColor} ${disabled ? styles$k.disabled : ''} ${readOnly ? styles$k.readOnly : ''}`, style: {
|
|
3710
3721
|
width,
|
|
3711
3722
|
height,
|
|
3712
3723
|
backgroundColor: value,
|
|
3713
|
-
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && createPortal(jsx("div", { ref: dropdownRef, className: styles$
|
|
3724
|
+
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && createPortal(jsx("div", { ref: dropdownRef, className: styles$k.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
|
|
3714
3725
|
};
|
|
3715
3726
|
|
|
3716
3727
|
/**
|
|
@@ -3965,7 +3976,7 @@ function CwInputDateText(props) {
|
|
|
3965
3976
|
return (jsx("div", { className: "cw-input-date-text", children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { children: [jsx("input", { type: "text", disabled: disabled, maxLength: 10, onChange: onChangeInputText, pattern: "^$ --|[.0-9\\/\\-]{10}", placeholder: format.toLowerCase(), readOnly: readOnly, ref: textInputRef, required: required, size: width, tabIndex: tabIndex, value: displayedDate }), jsxs("span", { children: [jsx(CwIcon, { iconId: "calendar" }), jsx("input", { type: "date", disabled: disabled, onChange: onChangeInputDate, readOnly: readOnly, ref: dateInputRef, tabIndex: -1, value: date, ...inputProps })] })] }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
3966
3977
|
}
|
|
3967
3978
|
|
|
3968
|
-
var styles$
|
|
3979
|
+
var styles$j = {"hiddenInput":"cw-input-image-module__hiddenInput__pS7hb","dropZone":"cw-input-image-module__dropZone__ygrGu","title":"cw-input-image-module__title__Rji5M","subtitle":"cw-input-image-module__subtitle__djYYu","container":"cw-input-image-module__container__qh7Tm"};
|
|
3969
3980
|
|
|
3970
3981
|
const DEFAULT_LABELS = {
|
|
3971
3982
|
dropImageHere: "Drop image here",
|
|
@@ -4044,7 +4055,7 @@ function CwInputImage(props) {
|
|
|
4044
4055
|
const file = e.currentTarget.files?.[0];
|
|
4045
4056
|
void handleFile(file ?? null);
|
|
4046
4057
|
};
|
|
4047
|
-
return (jsxs("div", { className: `cw-input-image ${styles$
|
|
4058
|
+
return (jsxs("div", { className: `cw-input-image ${styles$j.container}`, "data-size": size, children: [jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, className: styles$j.dropZone, children: [jsx(CwIcon, { iconId: "upload" }), jsxs("div", { className: "cw-flex-column cw-gap-tiny", children: [jsx("p", { className: styles$j.title, children: labels.dropImageHere }), jsx("p", { className: styles$j.subtitle, children: labels.acceptedFormats(allowedFormats.join(", ").replace(/image\//g, "")) })] })] }), jsxs("div", { className: "cw-flex-row cw-align-center-center cw-gap-small", children: [jsx(CwButton, { onClick: onPasteButtonClick, icon: "paste", text: labels.paste, size: size }), jsx(CwButton, { onClick: () => inputRef.current?.click(), icon: "folder-open", text: labels.browse, size: size })] }), jsx("input", { ref: inputRef, type: "file", accept: allowedFormats.join(","), onChange: handleFileChange, className: styles$j.hiddenInput, ...inputProps })] }));
|
|
4048
4059
|
}
|
|
4049
4060
|
|
|
4050
4061
|
/**
|
|
@@ -4176,7 +4187,7 @@ const CwImageArea = forwardRef((props, ref) => {
|
|
|
4176
4187
|
});
|
|
4177
4188
|
CwImageArea.displayName = "CwImageArea";
|
|
4178
4189
|
|
|
4179
|
-
var styles$
|
|
4190
|
+
var styles$i = {"container":"cw-weekday-selector-module__container__pwcvx","days":"cw-weekday-selector-module__days__Dd3RH"};
|
|
4180
4191
|
|
|
4181
4192
|
/* 2024-01-01 was a Monday. Formatted in UTC so a negative browser offset cannot shift a day. */
|
|
4182
4193
|
const MONDAY_UTC = Date.UTC(2024, 0, 1);
|
|
@@ -4357,7 +4368,7 @@ class Weekdays {
|
|
|
4357
4368
|
}
|
|
4358
4369
|
}
|
|
4359
4370
|
|
|
4360
|
-
const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labelProps, layout, feedback, locale = "en-GB", className }) => {
|
|
4371
|
+
const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labelProps, layout, feedback, locale = "en-GB", className, ...dataAttributes }) => {
|
|
4361
4372
|
const selectedDays = Weekdays.tryFromString(value).toArray();
|
|
4362
4373
|
const dayNames = useMemo(() => getWeekdayNames(locale), [locale]);
|
|
4363
4374
|
const handleChange = (day, checked) => {
|
|
@@ -4374,16 +4385,16 @@ const CwWeekdaySelector = ({ value = "mtwrfsu", onChange, disabled = false, labe
|
|
|
4374
4385
|
// Points at the label element rather than copying its text, which also covers a labelProps that
|
|
4375
4386
|
// carries children instead of `text`.
|
|
4376
4387
|
const labelId = labelProps?.id ?? `${feedbackId}-label`;
|
|
4377
|
-
return (jsxs("div", { className: `cw-weekday-selector ${styles$
|
|
4388
|
+
return (jsxs("div", { ...dataAttributes, className: `cw-weekday-selector ${styles$i.container}${className ? ` ${className}` : ""}`, "data-direction": labelProps ? layout?.direction ?? "row" : "column", "data-align": layout?.align, "data-gap": layout?.gap, children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsx("div", { role: "group", className: styles$i.days, "aria-labelledby": labelProps ? labelId : undefined, "aria-describedby": describedBy, children: Weekdays.getFullWeek().map(day => (jsx("input", { type: "checkbox", "data-day": day, "data-letter": dayNames[day].letter, "aria-label": dayNames[day].full, title: dayNames[day].full, checked: selectedDays.includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4378
4389
|
};
|
|
4379
4390
|
|
|
4380
|
-
var styles$
|
|
4391
|
+
var styles$h = {"check-container":"cw-check-module__check-container__4nscZ","group":"cw-check-module__group__6JCQo","options":"cw-check-module__options__-g9LF"};
|
|
4381
4392
|
|
|
4382
4393
|
function CwCheck(props) {
|
|
4383
4394
|
const { labelProps, labelText, direction, alignment, className, ...inputProps } = props;
|
|
4384
4395
|
const resolvedDirection = direction ?? alignment ?? "row";
|
|
4385
4396
|
const displayText = labelProps?.text ?? labelText;
|
|
4386
|
-
return (jsx("div", { className: `cw-check ${styles$
|
|
4397
|
+
return (jsx("div", { className: `cw-check ${styles$h["check-container"]}${className ? ` ${className}` : ''}`, children: jsxs("label", { "data-direction": resolvedDirection, children: [jsx("input", { type: "checkbox", ...inputProps }), displayText && (jsx("span", { className: "cw-icon-text", children: displayText }))] }) }));
|
|
4387
4398
|
}
|
|
4388
4399
|
|
|
4389
4400
|
function CwCheckbox(CwCheckboxProps) {
|
|
@@ -4437,14 +4448,14 @@ function CwCheckboxGroup({ options, value = [], onChange, labelProps, groupLayou
|
|
|
4437
4448
|
?? (optionsAlignment === "column" ? "row" : "column");
|
|
4438
4449
|
// Each checkbox's box-to-text layout is the opposite of the options flow, mirroring CwRadioGroup.
|
|
4439
4450
|
const checkDirection = itemDirection === "row" ? "column" : "row";
|
|
4440
|
-
return (jsxs("div", { className: `cw-checkbox-group ${styles$
|
|
4451
|
+
return (jsxs("div", { className: `cw-checkbox-group ${styles$h.group}${className ? ` ${className}` : ""}`, "data-testid": dataTestId, "data-direction": labelProps ? groupDirection : "column", "data-align": groupLayout?.align, "data-gap": groupLayout?.gap, children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsx("div", { className: styles$h.options, role: "group", "aria-label": labelProps?.text, "aria-describedby": describedBy, "aria-required": required || undefined, "data-direction": itemDirection, "data-gap": itemLayout?.gap, children: options.map((option) => (jsx(CwCheck, { labelProps: { text: option.label }, checked: value.includes(option.value), disabled: disabled || option.disabled, direction: checkDirection, onChange: (e) => handleChange(option.value, e.currentTarget.checked) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4441
4452
|
}
|
|
4442
4453
|
|
|
4443
|
-
var styles$
|
|
4454
|
+
var styles$g = {"radio":"cw-radio-module__radio__5sh7a","group":"cw-radio-module__group__br-HM","options":"cw-radio-module__options__LSw7M"};
|
|
4444
4455
|
|
|
4445
4456
|
/** Single native radio input. Building block for CwRadioGroup. */
|
|
4446
4457
|
function CwRadio({ label, direction = "row", className, ...inputProps }) {
|
|
4447
|
-
return (jsxs("label", { className: `cw-radio ${styles$
|
|
4458
|
+
return (jsxs("label", { className: `cw-radio ${styles$g.radio}${className ? ` ${className}` : ""}`, "data-direction": direction, children: [jsx("input", { type: "radio", ...inputProps }), label && jsx("span", { children: label })] }));
|
|
4448
4459
|
}
|
|
4449
4460
|
|
|
4450
4461
|
/**
|
|
@@ -4471,7 +4482,7 @@ function CwRadioGroup({ options, value, onChange, labelProps, groupLayout, itemL
|
|
|
4471
4482
|
// (itemLayout column) reads best with the circle beside the text; a side-by-side row reads
|
|
4472
4483
|
// best with the circle above the text.
|
|
4473
4484
|
const radioDirection = itemLayout?.direction === "row" ? "column" : "row";
|
|
4474
|
-
return (jsxs("div", { className: `cw-radio-group ${styles$
|
|
4485
|
+
return (jsxs("div", { className: `cw-radio-group ${styles$g.group}${className ? ` ${className}` : ""}`, "data-testid": dataTestId, "data-direction": labelProps ? (groupLayout?.direction ?? "column") : "column", "data-align": groupLayout?.align, "data-gap": groupLayout?.gap, children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsx("div", { className: styles$g.options, role: "radiogroup", "aria-describedby": describedBy, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : (ariaLabel ?? labelProps?.text), "aria-required": required || undefined, "data-direction": itemLayout?.direction ?? "column", "data-gap": itemLayout?.gap, children: options.map((option) => (jsx(CwRadio, { name: groupName, label: option.label, direction: radioDirection, checked: value === option.value, required: required, disabled: disabled || option.disabled, onChange: () => onChange(option.value) }, option.value))) }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] }));
|
|
4475
4486
|
}
|
|
4476
4487
|
|
|
4477
4488
|
function CwToggle(props) {
|
|
@@ -4612,7 +4623,7 @@ function useDropdownPortal({ anchorRef, isOpen, onClose, positionStrategy = defa
|
|
|
4612
4623
|
return { panelRef, panelStyle: style, renderPanel };
|
|
4613
4624
|
}
|
|
4614
4625
|
|
|
4615
|
-
var styles$
|
|
4626
|
+
var styles$f = {"dropdown":"cw-dropdown-module__dropdown__EFZ9M cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-dropdown-module__option__TuMdI cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-dropdown-module__optionFocused__7LGaC cw-choice-dropdown-module__optionFocused__BYMxj","optionSelected":"cw-dropdown-module__optionSelected__OiXIc cw-choice-dropdown-module__optionSelected__Lt8Xg","optionDisabled":"cw-dropdown-module__optionDisabled__lYM6w cw-choice-dropdown-module__optionDisabled__n3scM","emptyState":"cw-dropdown-module__emptyState__gp8KT cw-choice-dropdown-module__emptyState__HO0Y7","searchBox":"cw-dropdown-module__searchBox__Bx0JE cw-choice-dropdown-module__searchBox__0gox7","searchInput":"cw-dropdown-module__searchInput__JrxCK cw-choice-dropdown-module__searchInput__G5oRs","value":"cw-dropdown-module__value__i-7IN","colorCircle":"cw-dropdown-module__colorCircle__5kgiT cw-choice-dropdown-module__colorCircle__x7mI9"};
|
|
4616
4627
|
|
|
4617
4628
|
/**
|
|
4618
4629
|
* Custom dropdown component with colour-coded options, optional search filter, and full
|
|
@@ -4726,12 +4737,12 @@ function CwDropdown({ options, value, onChange, labelProps, alignProps, placehol
|
|
|
4726
4737
|
}
|
|
4727
4738
|
}, [isOpen, highlightedIndex, filteredOptions, handleOptionSelect]);
|
|
4728
4739
|
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
4729
|
-
return (jsx("div", { ref: containerRef, className: `cw-dropdown${className ? ` ${className}` : ""}`, "data-direction": flexDirection, style: style, ...otherProps, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsxs("div", { className: styles$
|
|
4730
|
-
styles$
|
|
4731
|
-
value === option.value ? styles$
|
|
4732
|
-
highlightedIndex === index ? styles$
|
|
4733
|
-
option.disabled ? styles$
|
|
4734
|
-
].filter(Boolean).join(" "), onClick: () => !option.disabled && handleOptionSelect(option.value), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": value === option.value, "aria-disabled": option.disabled, children: [option.color && (jsx("span", { className: styles$
|
|
4740
|
+
return (jsx("div", { ref: containerRef, className: `cw-dropdown${className ? ` ${className}` : ""}`, "data-direction": flexDirection, style: style, ...otherProps, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && jsx(CwLabel, { id: labelId, ...labelProps }), jsxs("div", { className: styles$f.value, children: [jsxs("div", { className: "cw-dropdown-wrapper", ref: wrapperRef, children: [jsxs("button", { type: "button", className: "cw-dropdown-trigger", onClick: handleTriggerClick, onKeyDown: handleKeyDown, disabled: disabled, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-labelledby": labelProps ? `${labelId} ${valueId}` : undefined, "aria-label": labelProps ? undefined : (selectedOption?.label || placeholder), "aria-describedby": describedBy, children: [jsx("div", { className: "cw-dropdown-trigger-content", id: valueId, children: selectedOption ? (jsxs(Fragment, { children: [selectedOption.color && (jsx("span", { className: styles$f.colorCircle, style: { backgroundColor: selectedOption.color } })), jsx("span", { children: selectedOption.label })] })) : (jsx("span", { className: "cw-dropdown-placeholder", children: placeholder })) }), jsx(CwIcon, { iconId: "chevron-down", size: "small" })] }), renderPanel(jsxs("div", { ref: panelRef, className: styles$f.dropdown, style: panelStyle, role: "listbox", onKeyDown: handleKeyDown, children: [allowSearch && (jsx("div", { className: styles$f.searchBox, children: jsx("input", { ref: inputRef, type: "text", placeholder: "Search...", value: searchText, onChange: handleSearchChange, onKeyDown: handleKeyDown, className: styles$f.searchInput, autoComplete: "off" }) })), jsx("ul", { children: filteredOptions.length > 0 ? (filteredOptions.map((option, index) => (jsxs("li", { ref: highlightedIndex === index ? highlightedItemRef : null, className: [
|
|
4741
|
+
styles$f.option,
|
|
4742
|
+
value === option.value ? styles$f.optionSelected : "",
|
|
4743
|
+
highlightedIndex === index ? styles$f.optionFocused : "",
|
|
4744
|
+
option.disabled ? styles$f.optionDisabled : "",
|
|
4745
|
+
].filter(Boolean).join(" "), onClick: () => !option.disabled && handleOptionSelect(option.value), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": value === option.value, "aria-disabled": option.disabled, children: [option.color && (jsx("span", { className: styles$f.colorCircle, style: { backgroundColor: option.color } })), jsx("span", { children: option.label })] }, option.value)))) : (jsx("li", { className: styles$f.emptyState, children: "No options available" })) })] }))] }), feedbackMessages.map((item, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": item.type, "aria-live": "polite", children: item.message }, index)))] })] }) }));
|
|
4735
4746
|
}
|
|
4736
4747
|
|
|
4737
4748
|
/**
|
|
@@ -4748,7 +4759,7 @@ function CwDropdownFilter(props) {
|
|
|
4748
4759
|
return (jsxs("div", { id: props.IdContent, className: containerClassName, children: [props.children, isVisible && (jsx("nav", { className: "cw-dropdown-menu", style: inlineStyles, onMouseLeave: props.onMouseLeave, id: props.idDropDownFilter, role: "menu", children: jsx("ul", { role: "none", children: props.DataSourceDropDownItem?.map((item) => (jsx("li", { id: item.IdDropDown_filter, role: "menuitem", children: item.dropDownFilter_desc }, item.IdDropDown_filter))) }) }))] }));
|
|
4749
4760
|
}
|
|
4750
4761
|
|
|
4751
|
-
var styles$
|
|
4762
|
+
var styles$e = {"container":"cw-popover-button-module__container__YSWQU","panel":"cw-popover-button-module__panel__C-BTn"};
|
|
4752
4763
|
|
|
4753
4764
|
/**
|
|
4754
4765
|
* Button that toggles a floating panel with arbitrary children.
|
|
@@ -4827,7 +4838,7 @@ function CwPopoverButton({ children, panelWidth = "auto", placement = "bottom-st
|
|
|
4827
4838
|
}
|
|
4828
4839
|
panel.showPopover();
|
|
4829
4840
|
}, [placement]);
|
|
4830
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
4841
|
+
return (jsxs("div", { ref: containerRef, className: styles$e.container, children: [jsx(CwButton, { ...buttonProps, onClick: handleClick }), jsx("div", { ref: panelCallbackRef, className: `${styles$e.panel}${panelClassName ? ` ${panelClassName}` : ""}`, style: { width: panelWidth }, children: children })] }));
|
|
4831
4842
|
}
|
|
4832
4843
|
|
|
4833
4844
|
function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor, onPrimaryColor) {
|
|
@@ -4845,13 +4856,13 @@ function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor
|
|
|
4845
4856
|
return result;
|
|
4846
4857
|
}
|
|
4847
4858
|
|
|
4848
|
-
var styles$
|
|
4859
|
+
var styles$d = {"cw-multifilter-tag":"cw-multi-filter-tag-module__cw-multifilter-tag__Epda-"};
|
|
4849
4860
|
|
|
4850
4861
|
const CwMultiFilterTag = props => {
|
|
4851
4862
|
const { ID, Name, Value, Category, Removable, PrimaryColor, Selectable, Selected } = props;
|
|
4852
4863
|
const backgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
|
|
4853
4864
|
const isOutlineMode = Selected && !Removable;
|
|
4854
|
-
return (jsx("li", { className: styles$
|
|
4865
|
+
return (jsx("li", { className: styles$d["cw-multifilter-tag"], id: ID, "data-value": Value, "data-category": Category, "data-selected": !!Selected, title: props.tooltip ?? Name, onClick: () => {
|
|
4855
4866
|
if (Selectable)
|
|
4856
4867
|
props.OnSelect?.(props);
|
|
4857
4868
|
}, children: jsx(CwChip, { label: Name, colorScheme: "custom", customColor: backgroundColor, variant: isOutlineMode ? "outline" : "soft", closable: Removable, onClose: () => props.OnRemove?.(props),
|
|
@@ -4861,7 +4872,7 @@ const CwMultiFilterTag = props => {
|
|
|
4861
4872
|
} : undefined }) }));
|
|
4862
4873
|
};
|
|
4863
4874
|
|
|
4864
|
-
var styles$
|
|
4875
|
+
var styles$c = {"cw-multi-filter-catalog-container":"cw-multi-filter-module__cw-multi-filter-catalog-container__S3nsq","cw-multi-filter":"cw-multi-filter-module__cw-multi-filter__zipBK","category-selected":"cw-multi-filter-module__category-selected__eYbes","cw-multi-filter-search":"cw-multi-filter-module__cw-multi-filter-search__eyHr0 cw-choice-input-box-module__inputBox__gHY9d"};
|
|
4865
4876
|
|
|
4866
4877
|
/**
|
|
4867
4878
|
* A multiple filter selector, a MULTI-SELECT even. Allows users to select and filter items based on tags.
|
|
@@ -5102,9 +5113,9 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5102
5113
|
inputRef.current?.focus();
|
|
5103
5114
|
}
|
|
5104
5115
|
};
|
|
5105
|
-
return (jsxs("form", { ref: componentRef, id: id, "data-testid": testId, className: `${styles$
|
|
5116
|
+
return (jsxs("form", { ref: componentRef, id: id, "data-testid": testId, className: `${styles$c["cw-multi-filter"]}${className ? ` ${className}` : ""}`, style: style, onSubmit: (e) => {
|
|
5106
5117
|
e.preventDefault();
|
|
5107
|
-
}, children: [jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$
|
|
5118
|
+
}, children: [jsxs("div", { onClick: handleDivClick, ref: wrapperRef, className: styles$c["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-outline-variant)" } : {}, children: [jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.currentTarget.value), autoComplete: "off", placeholder: selectedTags.size === 0 ? placeholder : "", onKeyDown: e => {
|
|
5108
5119
|
switch (e.key) {
|
|
5109
5120
|
case "Enter":
|
|
5110
5121
|
case "Tab": {
|
|
@@ -5131,7 +5142,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5131
5142
|
break;
|
|
5132
5143
|
}
|
|
5133
5144
|
}
|
|
5134
|
-
} })] }), selectedTags.size > 0 && (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: e => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChangeSelectedTags(new Set()); setIsPanelOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), renderPanel(jsxs("section", { ref: panelRef, className: styles$
|
|
5145
|
+
} })] }), selectedTags.size > 0 && (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: e => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChangeSelectedTags(new Set()); setIsPanelOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), renderPanel(jsxs("section", { ref: panelRef, className: styles$c["cw-multi-filter-catalog-container"], style: panelStyle, children: [jsxs("nav", { children: [jsx("button", { className: selectedCategory === "All" ? styles$c["category-selected"] : undefined, onClick: () => handleClickCategory("All"), children: allCategoriesLabel }), Array.from(categoriesMappedToTags().keys()).map(category => (jsx("button", { className: selectedCategory === category ? styles$c["category-selected"] : undefined, style: {
|
|
5135
5146
|
backgroundColor: getColor(category).primary,
|
|
5136
5147
|
color: getColor(category).onPrimary,
|
|
5137
5148
|
}, onClick: () => handleClickCategory(category), children: category }, category)))] }), jsx("ul", { children: displayTags
|
|
@@ -5157,7 +5168,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, placeh
|
|
|
5157
5168
|
} }, props.ID))) })] }))] }));
|
|
5158
5169
|
};
|
|
5159
5170
|
|
|
5160
|
-
var styles$
|
|
5171
|
+
var styles$b = {"container":"cw-tag-selector-module__container__-do8i","value":"cw-tag-selector-module__value__TDAy3","inputBox":"cw-tag-selector-module__inputBox__3NGz9 cw-choice-input-box-module__inputBox__gHY9d","disabled":"cw-tag-selector-module__disabled__vbud9 cw-choice-input-box-module__disabled__TFAnC","dropdown":"cw-tag-selector-module__dropdown__X6Dob cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-tag-selector-module__option__2UQ7g cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-tag-selector-module__optionFocused__8-lv8 cw-choice-dropdown-module__optionFocused__BYMxj","optionDot":"cw-tag-selector-module__optionDot__CdFlG cw-choice-dropdown-module__colorCircle__x7mI9","selectAll":"cw-tag-selector-module__selectAll__HyvMA"};
|
|
5161
5172
|
|
|
5162
5173
|
/**
|
|
5163
5174
|
* Multi-select input with chip tags and searchable dropdown.
|
|
@@ -5195,6 +5206,11 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5195
5206
|
isOpen: open,
|
|
5196
5207
|
onClose: () => { setOpen(false); setFocusedIndex(-1); },
|
|
5197
5208
|
});
|
|
5209
|
+
// Disabling while the panel is open closes it (state adjusted during render, no effect pass).
|
|
5210
|
+
if (disabled && open) {
|
|
5211
|
+
setOpen(false);
|
|
5212
|
+
setFocusedIndex(-1);
|
|
5213
|
+
}
|
|
5198
5214
|
const selectedSet = useMemo(() => new Set(value), [value]);
|
|
5199
5215
|
const filtered = useMemo(() => {
|
|
5200
5216
|
if (!search)
|
|
@@ -5204,17 +5220,23 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5204
5220
|
}, [options, selectedSet, search]);
|
|
5205
5221
|
const selectedOptions = useMemo(() => value.map(v => options.find(o => o.value === v)).filter(Boolean), [value, options]);
|
|
5206
5222
|
const handleSelect = useCallback((optionValue) => {
|
|
5223
|
+
if (disabled)
|
|
5224
|
+
return;
|
|
5207
5225
|
onChange([...value, optionValue]);
|
|
5208
5226
|
setSearch("");
|
|
5209
5227
|
setFocusedIndex(-1);
|
|
5210
5228
|
inputRef.current?.focus();
|
|
5211
|
-
}, [value, onChange]);
|
|
5229
|
+
}, [disabled, value, onChange]);
|
|
5212
5230
|
const handleRemove = useCallback((optionValue) => {
|
|
5231
|
+
if (disabled)
|
|
5232
|
+
return;
|
|
5213
5233
|
onChange(value.filter(v => v !== optionValue));
|
|
5214
5234
|
inputRef.current?.focus();
|
|
5215
|
-
}, [value, onChange]);
|
|
5235
|
+
}, [disabled, value, onChange]);
|
|
5216
5236
|
const allSelected = options.length > 0 && options.every(o => selectedSet.has(o.value));
|
|
5217
5237
|
const handleToggleAll = useCallback(() => {
|
|
5238
|
+
if (disabled)
|
|
5239
|
+
return;
|
|
5218
5240
|
if (allSelected) {
|
|
5219
5241
|
onChange([]);
|
|
5220
5242
|
}
|
|
@@ -5224,7 +5246,7 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5224
5246
|
setSearch("");
|
|
5225
5247
|
setFocusedIndex(-1);
|
|
5226
5248
|
inputRef.current?.focus();
|
|
5227
|
-
}, [allSelected, options, onChange]);
|
|
5249
|
+
}, [disabled, allSelected, options, onChange]);
|
|
5228
5250
|
const handleInputChange = useCallback((e) => {
|
|
5229
5251
|
setSearch(e.currentTarget.value);
|
|
5230
5252
|
if (!open)
|
|
@@ -5236,6 +5258,8 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5236
5258
|
setOpen(true);
|
|
5237
5259
|
}, [disabled]);
|
|
5238
5260
|
const handleKeyDown = useCallback((e) => {
|
|
5261
|
+
if (disabled)
|
|
5262
|
+
return;
|
|
5239
5263
|
if (e.key === "Backspace" && !search && value.length > 0) {
|
|
5240
5264
|
onChange(value.slice(0, -1));
|
|
5241
5265
|
return;
|
|
@@ -5280,7 +5304,7 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5280
5304
|
e.preventDefault();
|
|
5281
5305
|
setFocusedIndex(prev => (prev > 0 ? prev - 1 : 0));
|
|
5282
5306
|
}
|
|
5283
|
-
}, [open, search, value, filtered, focusedIndex, onChange, handleSelect]);
|
|
5307
|
+
}, [disabled, open, search, value, filtered, focusedIndex, onChange, handleSelect]);
|
|
5284
5308
|
// Scroll focused item into view
|
|
5285
5309
|
useEffect(() => {
|
|
5286
5310
|
if (focusedIndex >= 0 && listRef.current) {
|
|
@@ -5295,13 +5319,13 @@ function CwTagSelector({ id, options, value, onChange, labelProps, iconProps, al
|
|
|
5295
5319
|
const feedbackId = useId();
|
|
5296
5320
|
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
5297
5321
|
const describedBy = feedbackIds.join(" ") || undefined;
|
|
5298
|
-
return (jsxs("div", { ref: containerRef, className: `${styles$
|
|
5299
|
-
inputRef.current?.focus(); }, children: [selectedOptions.map(opt => (jsx(CwChip, { label: opt.label, colorScheme: opt.color ? "custom" : "info", customColor: opt.color, closable: !disabled, onClose: () => handleRemove(opt.value) }, opt.value))), jsx("input", { ref: inputRef, type: "text", value: search, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: selectedOptions.length === 0 ? placeholder : "", disabled: disabled, autoComplete: "off", "aria-describedby": describedBy }), value.length > 0 && !disabled && (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: (e) => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChange([]); setSearch(""); setOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), feedbackMessages.map((fb, i) => (jsx("p", { id: feedbackIds[i], className: "cw-input-feedback", "data-color": fb.type, "aria-live": "polite", children: fb.message }, i)))] })] }), renderPanel((showSelectAll || filtered.length > 0) ? (jsxs("div", { ref: panelRef, className: styles$
|
|
5322
|
+
return (jsxs("div", { ref: containerRef, className: `${styles$b.container}${className ? ` ${className}` : ""}`, style: style, id: id, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { className: styles$b.value, children: [jsxs("div", { className: `${styles$b.inputBox}${disabled ? ` ${styles$b.disabled}` : ""}`, ref: inputBoxRef, onClick: () => { if (!disabled)
|
|
5323
|
+
inputRef.current?.focus(); }, children: [selectedOptions.map(opt => (jsx(CwChip, { label: opt.label, colorScheme: opt.color ? "custom" : "info", customColor: opt.color, closable: !disabled, onClose: () => handleRemove(opt.value) }, opt.value))), jsx("input", { ref: inputRef, type: "text", value: search, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: selectedOptions.length === 0 ? placeholder : "", disabled: disabled, autoComplete: "off", "aria-describedby": describedBy }), value.length > 0 && !disabled && (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onMouseDown: (e) => e.preventDefault(), onClick: (e) => { e.stopPropagation(); onChange([]); setSearch(""); setOpen(false); }, tabIndex: -1, "aria-label": "Clear all" }))] }), feedbackMessages.map((fb, i) => (jsx("p", { id: feedbackIds[i], className: "cw-input-feedback", "data-color": fb.type, "aria-live": "polite", children: fb.message }, i)))] })] }), renderPanel((showSelectAll || filtered.length > 0) ? (jsxs("div", { ref: panelRef, className: styles$b.dropdown, style: panelStyle, children: [showSelectAll && !search && (jsxs("div", { className: styles$b.selectAll, onMouseDown: (e) => e.preventDefault(), onClick: handleToggleAll, children: [jsx("input", { type: "checkbox", checked: allSelected, readOnly: true, tabIndex: -1 }), allSelected ? "Deselect all" : "Select all"] })), jsx("ul", { ref: listRef, children: filtered.map((opt, idx) => (jsxs("li", { className: `${styles$b.option}${idx === focusedIndex ? ` ${styles$b.optionFocused}` : ""}`, onMouseDown: (e) => e.preventDefault(), onClick: () => handleSelect(opt.value), onMouseEnter: () => setFocusedIndex(idx), title: opt.tooltip, children: [opt.color && jsx("span", { className: styles$b.optionDot, style: { backgroundColor: opt.color } }), opt.label] }, opt.value))) })] })) : null)] }));
|
|
5300
5324
|
}
|
|
5301
5325
|
|
|
5302
|
-
var styles$
|
|
5326
|
+
var styles$a = {"tree-container":"cw-tree-view-module__tree-container__NN-HJ","tree-wrapper":"cw-tree-view-module__tree-wrapper__keBZI","tree-item":"cw-tree-view-module__tree-item__prE9N","tree-node":"cw-tree-view-module__tree-node__wfro9","selected":"cw-tree-view-module__selected__XJQ0w","non-selectable":"cw-tree-view-module__non-selectable__YuPSx","tree-children":"cw-tree-view-module__tree-children__ji8CZ","empty-state":"cw-tree-view-module__empty-state__yvRjo","tree-label":"cw-tree-view-module__tree-label__ss3Nf","tree-spacer":"cw-tree-view-module__tree-spacer__E9Ud2"};
|
|
5303
5327
|
|
|
5304
|
-
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null }) {
|
|
5328
|
+
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null, ...dataAttributes }) {
|
|
5305
5329
|
const [expanded, setExpanded] = useState(new Set());
|
|
5306
5330
|
// const [selectedId, setSelectedId] = useState<string | number | null>(initialSelectedId);
|
|
5307
5331
|
const [selectedId, setSelectedId] = useState(null);
|
|
@@ -5366,10 +5390,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5366
5390
|
const isLeaf = !hasChildren;
|
|
5367
5391
|
const isSelected = selectedId?.toString().toLowerCase() === node.id.toString().toLowerCase();
|
|
5368
5392
|
const selectable = allowParentSelection || isLeaf;
|
|
5369
|
-
return (jsxs("div", { className: styles$
|
|
5370
|
-
styles$
|
|
5371
|
-
isSelected && styles$
|
|
5372
|
-
!selectable && styles$
|
|
5393
|
+
return (jsxs("div", { className: styles$a["tree-item"], children: [jsxs("div", { className: [
|
|
5394
|
+
styles$a["tree-node"],
|
|
5395
|
+
isSelected && styles$a["selected"],
|
|
5396
|
+
!selectable && styles$a["non-selectable"]
|
|
5373
5397
|
].filter(Boolean).join(' '), style: { paddingLeft: `${depth * 24 + 8}px` }, onClick: () => {
|
|
5374
5398
|
if (selectable) {
|
|
5375
5399
|
setSelectedId(node.id);
|
|
@@ -5378,7 +5402,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5378
5402
|
else {
|
|
5379
5403
|
toggleExpand(node.id);
|
|
5380
5404
|
}
|
|
5381
|
-
}, children: [hasChildren && (jsx(
|
|
5405
|
+
}, children: [hasChildren && (jsx(CwButton, { variant: "icon", color: "neutral", icon: isExpanded ? "chevron-down" : "chevron-right", "aria-expanded": isExpanded, "aria-label": `${isExpanded ? "Collapse" : "Expand"} ${node.label}`, onClick: (event) => {
|
|
5406
|
+
event.stopPropagation();
|
|
5407
|
+
toggleExpand(node.id);
|
|
5408
|
+
} })), jsx("div", { className: `${styles$a["tree-label"]} ${!hasChildren ? styles$a["tree-spacer"] : ''}`, children: node.label })] }), hasChildren && isExpanded && (jsx("div", { className: styles$a["tree-children"], children: node.children.map((child) => renderNode(child, depth + 1)) }))] }, node.id));
|
|
5382
5409
|
};
|
|
5383
5410
|
// Function to search for nodes that match the search term
|
|
5384
5411
|
const searchInTree = (nodes, searchTerm) => {
|
|
@@ -5402,7 +5429,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
|
|
|
5402
5429
|
return results;
|
|
5403
5430
|
};
|
|
5404
5431
|
const filteredData = searchInTree(data, search);
|
|
5405
|
-
return (jsxs("div", { className: `cw-tree-view ${styles$
|
|
5432
|
+
return (jsxs("div", { ...dataAttributes, className: `cw-tree-view ${styles$a["tree-container"]}`, children: [jsxs("header", { children: [jsx("input", { type: "text", placeholder: "Search in tree...", value: search, onChange: (e) => setSearch(e.target.value) }), search && (jsx(CwButton, { onClick: () => setSearch(""), type: "button", icon: "close", variant: "icon", color: "neutral" }))] }), jsx("div", { className: styles$a["tree-wrapper"], children: filteredData.length > 0 ? (filteredData.map((node) => renderNode(node))) : (jsxs("div", { className: styles$a["empty-state"], children: [jsx(CwIcon, { iconId: "comment" }), search ? "No results found" : "There are no items"] })) })] }));
|
|
5406
5433
|
}
|
|
5407
5434
|
|
|
5408
5435
|
const EXACT_PHRASE = /"([^"]+)"/g;
|
|
@@ -5470,7 +5497,7 @@ function sortNavItems(items, alphabetically) {
|
|
|
5470
5497
|
return [...items].sort((first, second) => first.label.localeCompare(second.label));
|
|
5471
5498
|
}
|
|
5472
5499
|
|
|
5473
|
-
var styles$
|
|
5500
|
+
var styles$9 = {"menu":"cw-nav-menu-module__menu__LmeQg","expandIndicator":"cw-nav-menu-module__expandIndicator__TBSdQ","favorites":"cw-nav-menu-module__favorites__Esaqd","favoritesContent":"cw-nav-menu-module__favoritesContent__l5DGG","favoriteStar":"cw-nav-menu-module__favoriteStar__J-jzg","emptyMessage":"cw-nav-menu-module__emptyMessage__-CQNd","skeleton":"cw-nav-menu-module__skeleton__INQqF"};
|
|
5474
5501
|
|
|
5475
5502
|
const SKELETON_ROW_COUNT = 5;
|
|
5476
5503
|
const defaultRenderLink = (item, children) => (jsx("a", { href: item.href, children: children }));
|
|
@@ -5482,13 +5509,13 @@ function CwNavMenu({ items, loading = false, isActive, renderLink = defaultRende
|
|
|
5482
5509
|
const renderItem = (item, level) => {
|
|
5483
5510
|
const children = item.children;
|
|
5484
5511
|
if (children && children.length > 0) {
|
|
5485
|
-
return (jsx("li", { children: jsxs("details", { "data-level": level, open: hasActiveDescendant(item) || undefined, children: [jsxs("summary", { children: [item.icon && jsx(CwIcon, { iconId: item.icon, size: level >= 2 ? "small" : "medium" }), item.label, (showExpandIndicator || level >= 2) && (jsx(CwIcon, { iconId: "chevron-down", size: "small", className: styles$
|
|
5512
|
+
return (jsx("li", { children: jsxs("details", { "data-level": level, open: hasActiveDescendant(item) || undefined, children: [jsxs("summary", { children: [item.icon && jsx(CwIcon, { iconId: item.icon, size: level >= 2 ? "small" : "medium" }), item.label, (showExpandIndicator || level >= 2) && (jsx(CwIcon, { iconId: "chevron-down", size: "small", className: styles$9.expandIndicator }))] }), jsx("ul", { children: children.map(child => renderItem(child, level + 1)) })] }) }, item.id));
|
|
5486
5513
|
}
|
|
5487
|
-
return (jsx("li", { "data-active": isActive?.(item) ? "true" : undefined, children: renderLink(item, jsxs(Fragment, { children: [item.icon && jsx(CwIcon, { iconId: item.icon, size: "medium" }), item.label, isFavorite?.(item) && jsx(CwIcon, { iconId: "star", size: "small", className: styles$
|
|
5514
|
+
return (jsx("li", { "data-active": isActive?.(item) ? "true" : undefined, children: renderLink(item, jsxs(Fragment, { children: [item.icon && jsx(CwIcon, { iconId: item.icon, size: "medium" }), item.label, isFavorite?.(item) && jsx(CwIcon, { iconId: "star", size: "small", className: styles$9.favoriteStar })] })) }, item.id));
|
|
5488
5515
|
};
|
|
5489
|
-
return (jsxs("nav", { ...navProps, className: [styles$
|
|
5490
|
-
? Array.from({ length: SKELETON_ROW_COUNT }, (_unused, index) => (jsx("li", { className: styles$
|
|
5491
|
-
: visibleItems.map(item => renderItem(item, 1)) }), showEmptyMessage && jsx("p", { className: styles$
|
|
5516
|
+
return (jsxs("nav", { ...navProps, className: [styles$9.menu, className].filter(Boolean).join(" "), "aria-busy": loading || undefined, children: [favoritesSlot && (jsxs("details", { open: true, ...favoritesProps, className: [styles$9.favorites, favoritesProps?.className].filter(Boolean).join(" "), children: [jsxs("summary", { children: [jsx(CwIcon, { iconId: "star", size: "medium" }), favoritesLabel] }), jsx("div", { className: styles$9.favoritesContent, children: favoritesSlot })] })), beforeTreeSlot, jsx("ul", { children: loading
|
|
5517
|
+
? Array.from({ length: SKELETON_ROW_COUNT }, (_unused, index) => (jsx("li", { className: styles$9.skeleton, children: jsx(CwSkeleton, { height: "var(--cw-size-small)", radius: "var(--cw-border-radius-small)" }) }, index)))
|
|
5518
|
+
: visibleItems.map(item => renderItem(item, 1)) }), showEmptyMessage && jsx("p", { className: styles$9.emptyMessage, children: emptyMessage })] }));
|
|
5492
5519
|
}
|
|
5493
5520
|
|
|
5494
5521
|
var dropdownStyles = {"dropdown":"cw-choice-dropdown-module__dropdown__P0b4j","option":"cw-choice-dropdown-module__option__uR-ro","optionFocused":"cw-choice-dropdown-module__optionFocused__BYMxj"};
|
|
@@ -5654,6 +5681,8 @@ function CwSearchInput(optionsProps) {
|
|
|
5654
5681
|
return (jsxs("div", { className: `cw-search-input ${className || ""}`, style: style, ...otherProps, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsx("input", { ref: inputRef, id: id, type: "text", value: searchText, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, onBlur: handleInputBlur, placeholder: placeholder, className: "cw-input-search", disabled: disabled, autoFocus: autoFocus, autoComplete: "off", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": showDropdown && filteredOptions.length > 0, "aria-controls": listboxId, "aria-activedescendant": highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined }), isLoading && (jsx("div", { className: "cw-search-input-loading", children: jsx(CwIcon, { iconId: "spinner" }) })), jsx("div", { className: "cw-search-input-icons", children: searchText && !disabled && !isLoading ? (jsx(CwButton, { type: "button", onClick: handleClearClick, "aria-label": "Clear search", variant: "icon", icon: "close", color: "neutral" })) : (iconProps ? jsx(CwIcon, { ...iconProps }) : jsx(CwIcon, { iconId: "search" })) })] })] }), renderPanel(jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsx("ul", { children: filteredOptions.map((option, index) => (jsx("li", { id: optionId(index), className: `${dropdownStyles.option}${index === highlightedIndex ? ` ${dropdownStyles.optionFocused}` : ""}`, onClick: () => handleOptionSelect(option), onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: renderOption ? renderOption(option) : option.description }, option.id))) }) }))] }));
|
|
5655
5682
|
}
|
|
5656
5683
|
|
|
5684
|
+
var styles$8 = {"value":"cw-search-async-module__value__z53xT"};
|
|
5685
|
+
|
|
5657
5686
|
/**
|
|
5658
5687
|
* Generic API-backed search input. Fetches matching options from a caller-supplied `onSearch`
|
|
5659
5688
|
* callback as the user types (debounced), renders them in a portal-based dropdown with keyboard
|
|
@@ -5675,7 +5704,7 @@ function CwSearchInput(optionsProps) {
|
|
|
5675
5704
|
* icon={{ iconId: 'control-tower' }}
|
|
5676
5705
|
* />
|
|
5677
5706
|
*/
|
|
5678
|
-
const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveSelection, icon, placeholder = "Search…", minChars = 2, debounceMs = 300, disabled = false, required = false, initialDisplayText, searchTrigger, labelProps, alignProps, width, className = "", }) => {
|
|
5707
|
+
const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveSelection, icon, placeholder = "Search…", minChars = 2, debounceMs = 300, disabled = false, required = false, initialDisplayText, searchTrigger, labelProps, alignProps, width, className = "", feedback, ...dataAttributes }) => {
|
|
5679
5708
|
// State
|
|
5680
5709
|
const [inputValue, setInputValue] = useState("");
|
|
5681
5710
|
const [options, setOptions] = useState([]);
|
|
@@ -5696,6 +5725,12 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5696
5725
|
// Stable ids wiring the combobox input to its listbox popup for assistive tech.
|
|
5697
5726
|
const listboxId = useId();
|
|
5698
5727
|
const optionId = (index) => `${listboxId}-opt-${index}`;
|
|
5728
|
+
const feedbackMessages = feedback
|
|
5729
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
5730
|
+
: [];
|
|
5731
|
+
const feedbackId = useId();
|
|
5732
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
5733
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
5699
5734
|
// Cancel a pending initial-value resolve when the user takes over (typing / clearing / reset),
|
|
5700
5735
|
// so a slow resolve can't overwrite newer input and the loading flag never sticks.
|
|
5701
5736
|
const cancelInitialResolve = useCallback(() => {
|
|
@@ -5907,10 +5942,10 @@ const CwSearchAsync = ({ onSearch, onChange, value, onResolveInitial, onResolveS
|
|
|
5907
5942
|
abortRef.current?.abort();
|
|
5908
5943
|
}, []);
|
|
5909
5944
|
const direction = alignProps?.flexDirection || "row";
|
|
5910
|
-
return (jsxs("div", { className: `cw-search-input ${className}`, style: {
|
|
5945
|
+
return (jsxs("div", { ...dataAttributes, className: `cw-search-input ${className}`, style: {
|
|
5911
5946
|
...(width ? { width } : {}),
|
|
5912
5947
|
...(labelProps?.labelWidth ? { "--label-width": labelProps.labelWidth } : {}),
|
|
5913
|
-
}, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: isInitialLoading ? "Loading…" : placeholder, disabled: disabled, required: required, autoComplete: "off", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": showDropdown, "aria-controls": listboxId, "aria-activedescendant": highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined, title: tooltipText }), (isLoading || isInitialLoading) && (jsx("div", { className: "cw-search-input-loading", children: jsx(CwIcon, { iconId: "spinner" }) })), jsx("div", { className: "cw-search-input-icons", children: inputValue && !disabled && !isInitialLoading ? (jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selection", variant: "icon", icon: "close", color: "neutral" })) : (icon ? jsx(CwIcon, { ...icon }) : jsx(CwIcon, { iconId: "search" })) })] })] }), renderPanel(jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsx("ul", { children: options.map((option, index) => (jsx("li", { id: optionId(index), className: `${dropdownStyles.option}${index === highlightedIndex ? ` ${dropdownStyles.optionFocused}` : ""}`, onClick: () => handleOptionSelect(option.id), onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: option.subLabel ? (jsxs("span", { className: "cw-search-async-option-lines", children: [jsx("span", { children: option.label }), jsx("span", { className: "cw-search-async-option-sub", children: option.subLabel })] })) : (option.label) }, option.id))) }) }))] }));
|
|
5948
|
+
}, "data-direction": direction, children: [jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$8.value, children: [jsxs("div", { className: "cw-search-input-wrapper", ref: wrapperRef, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: isInitialLoading ? "Loading…" : placeholder, disabled: disabled, required: required, autoComplete: "off", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": showDropdown, "aria-controls": listboxId, "aria-activedescendant": highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined, "aria-describedby": describedBy, title: tooltipText }), (isLoading || isInitialLoading) && (jsx("div", { className: "cw-search-input-loading", children: jsx(CwIcon, { iconId: "spinner" }) })), jsx("div", { className: "cw-search-input-icons", children: inputValue && !disabled && !isInitialLoading ? (jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selection", variant: "icon", icon: "close", color: "neutral" })) : (icon ? jsx(CwIcon, { ...icon }) : jsx(CwIcon, { iconId: "search" })) })] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }), renderPanel(jsx("div", { ref: panelRef, id: listboxId, className: dropdownStyles.dropdown, style: panelStyle, role: "listbox", children: jsx("ul", { children: options.map((option, index) => (jsx("li", { id: optionId(index), className: `${dropdownStyles.option}${index === highlightedIndex ? ` ${dropdownStyles.optionFocused}` : ""}`, onClick: () => handleOptionSelect(option.id), onMouseDown: (e) => e.preventDefault(), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: option.subLabel ? (jsxs("span", { className: "cw-search-async-option-lines", children: [jsx("span", { children: option.label }), jsx("span", { className: "cw-search-async-option-sub", children: option.subLabel })] })) : (option.label) }, option.id))) }) }))] }));
|
|
5914
5949
|
};
|
|
5915
5950
|
|
|
5916
5951
|
var styles$7 = {"menu":"cw-context-menu-module__menu__tXmun","item":"cw-context-menu-module__item__-ko8L","arrow":"cw-context-menu-module__arrow__LHZmQ"};
|
|
@@ -6262,9 +6297,9 @@ var styles$5 = {"switch":"cw-button-switch-module__switch__vdWV-","segment":"cw-
|
|
|
6262
6297
|
* onChange={setView}
|
|
6263
6298
|
* />
|
|
6264
6299
|
*/
|
|
6265
|
-
function CwButtonSwitch({ options, value, onChange, size = "medium", color = "primary", iconOnly = false, direction = "row", disabled = false, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby,
|
|
6300
|
+
function CwButtonSwitch({ options, value, onChange, size = "medium", color = "primary", iconOnly = false, direction = "row", disabled = false, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...dataAttributes }) {
|
|
6266
6301
|
const { getSegmentProps } = useRovingSingleSelect(options, value, onChange);
|
|
6267
|
-
return (jsx("div", { className: `cw-button-switch ${styles$5.switch}`, role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : ariaLabel, "data-direction": direction,
|
|
6302
|
+
return (jsx("div", { ...dataAttributes, className: `cw-button-switch ${styles$5.switch}`, role: "radiogroup", "aria-labelledby": ariaLabelledby, "aria-label": ariaLabelledby ? undefined : ariaLabel, "data-direction": direction, children: options.map((option, index) => {
|
|
6268
6303
|
const selected = option.value === value;
|
|
6269
6304
|
const segmentProps = getSegmentProps(index);
|
|
6270
6305
|
return (jsx(CwButton, { text: iconOnly ? undefined : option.label, title: iconOnly ? option.label : undefined, icon: option.icon, size: size, color: color, variant: selected ? "solid" : "outline", role: "radio", "aria-checked": selected, disabled: disabled || option.disabled, onClick: () => onChange(option.value), className: `${styles$5.segment}${iconOnly ? ` ${styles$5.iconOnly}` : ""}`, tabIndex: segmentProps.tabIndex, ref: segmentProps.ref, onKeyDown: segmentProps.onKeyDown }, option.value));
|
|
@@ -6359,7 +6394,7 @@ function usePickerPopup({ anchorRef, isOpen, onClose, position = "left-bottom" }
|
|
|
6359
6394
|
return { popupRef: panelRef, popupStyle: panelStyle, renderPopup: renderPanel };
|
|
6360
6395
|
}
|
|
6361
6396
|
|
|
6362
|
-
function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, locale = enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, }) {
|
|
6397
|
+
function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, locale = enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
6363
6398
|
const [isOpen, setIsOpen] = useState(false);
|
|
6364
6399
|
const [inputValue, setInputValue] = useState("");
|
|
6365
6400
|
const containerRef = useRef(null);
|
|
@@ -6549,7 +6584,7 @@ function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabl
|
|
|
6549
6584
|
...(maxDate ? [{ after: maxDate }] : []),
|
|
6550
6585
|
...(disabledMatcher ? [disabledMatcher] : []),
|
|
6551
6586
|
], [disabledDates, minDate, maxDate, disabledMatcher]);
|
|
6552
|
-
return (jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsx(DayPicker, { mode: "single", selected: value || undefined, defaultMonth: defaultMonth || value || undefined, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
6587
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsx(DayPicker, { mode: "single", selected: value || undefined, defaultMonth: defaultMonth || value || undefined, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
6553
6588
|
today: new Date(),
|
|
6554
6589
|
}, modifiersClassNames: {
|
|
6555
6590
|
today: "rdp-day-today",
|
|
@@ -6827,8 +6862,14 @@ const getPresetsByKeys = (keys) => {
|
|
|
6827
6862
|
.filter(preset => preset !== undefined);
|
|
6828
6863
|
};
|
|
6829
6864
|
|
|
6830
|
-
function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, maxRangeDays, defaultMonth, labelProps, alignProps, placeholderFrom = "From date", placeholderTo = "To date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 2, showPresets = false, presetKeys, customPresets, }) {
|
|
6865
|
+
function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, maxRangeDays, defaultMonth, labelProps, alignProps, placeholderFrom = "From date", placeholderTo = "To date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 2, showPresets = false, presetKeys, customPresets, feedback, ...dataAttributes }) {
|
|
6831
6866
|
const [isOpen, setIsOpen] = useState(false);
|
|
6867
|
+
const feedbackMessages = feedback
|
|
6868
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
6869
|
+
: [];
|
|
6870
|
+
const feedbackId = useId();
|
|
6871
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
6872
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
6832
6873
|
const [inputFromValue, setInputFromValue] = useState("");
|
|
6833
6874
|
const [inputToValue, setInputToValue] = useState("");
|
|
6834
6875
|
const [rangeErrorMessage, setRangeErrorMessage] = useState(null);
|
|
@@ -7192,11 +7233,11 @@ function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, d
|
|
|
7192
7233
|
}
|
|
7193
7234
|
return undefined;
|
|
7194
7235
|
}, [value]);
|
|
7195
|
-
return (jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, required: required, size: displayFormat.length, "data-focused": focusedInput === 'from' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, required: required, size: displayFormat.length, "data-focused": focusedInput === 'to' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsx(DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonth || value?.from || undefined, modifiers: {
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7236
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length, "data-focused": focusedInput === 'from' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length, "data-focused": focusedInput === 'to' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsx(DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonth || value?.from || undefined, modifiers: {
|
|
7237
|
+
today: new Date(),
|
|
7238
|
+
}, modifiersClassNames: {
|
|
7239
|
+
today: "rdp-day-today",
|
|
7240
|
+
} })] }), jsx("div", { role: "alert", "aria-live": "polite", className: rangeStyles.rangeError, children: rangeErrorMessage })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
7200
7241
|
}
|
|
7201
7242
|
|
|
7202
7243
|
var timeStyles = {"timePickerPopup":"cw-time-picker-module__timePickerPopup__BN63t","timePickerList":"cw-time-picker-module__timePickerList__E88pr","selected":"cw-time-picker-module__selected__qVnfL","field":"cw-time-picker-module__field__kPvGN","narrow":"cw-time-picker-module__narrow__Z7lCI"};
|
|
@@ -7204,9 +7245,16 @@ var timeStyles = {"timePickerPopup":"cw-time-picker-module__timePickerPopup__BN6
|
|
|
7204
7245
|
const isMobileDevice = () => {
|
|
7205
7246
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
7206
7247
|
};
|
|
7207
|
-
function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", useNative = isMobileDevice(), }) {
|
|
7248
|
+
function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", useNative = isMobileDevice(), feedback, ...dataAttributes }) {
|
|
7208
7249
|
const [isOpen, setIsOpen] = useState(false);
|
|
7209
7250
|
const [inputValue, setInputValue] = useState("");
|
|
7251
|
+
const feedbackMessages = feedback
|
|
7252
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7253
|
+
: [];
|
|
7254
|
+
const feedbackId = useId();
|
|
7255
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7256
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
7257
|
+
const feedbackElements = feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)));
|
|
7210
7258
|
const containerRef = useRef(null);
|
|
7211
7259
|
const wrapperRef = useRef(null);
|
|
7212
7260
|
const inputRef = useRef(null);
|
|
@@ -7358,13 +7406,13 @@ function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelP
|
|
|
7358
7406
|
const displayValue = inputValue;
|
|
7359
7407
|
// If using native time input
|
|
7360
7408
|
if (useNative) {
|
|
7361
|
-
return (jsx("div", { className: `cw-timepicker cw-timepicker-native ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsx("div", { className: styles$4.pickerWrapper, children: jsx("input", { type: "time", value: displayValue, onChange: handleNativeChange, min: minTime, max: maxTime, step: interval * 60, disabled: disabled, required: required, placeholder: placeholder, className: "cw-timepicker-native" }) })] }) }));
|
|
7409
|
+
return (jsx("div", { ...dataAttributes, className: `cw-timepicker cw-timepicker-native ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsx("div", { className: styles$4.pickerWrapper, children: jsx("input", { type: "time", value: displayValue, onChange: handleNativeChange, min: minTime, max: maxTime, step: interval * 60, disabled: disabled, required: required, placeholder: placeholder, "aria-describedby": describedBy, className: "cw-timepicker-native" }) }), feedbackElements] })] }) }));
|
|
7362
7410
|
}
|
|
7363
7411
|
// Custom time picker
|
|
7364
|
-
return (jsx("div", { ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { ref: wrapperRef, className: `${styles$4.pickerWrapper} ${timeStyles.field}${showClear ? "" : ` ${timeStyles.narrow}`}`, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 5 }), showClear && (jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsx(CwIcon, { iconId: "clock" })) })), renderPopup(jsx("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${timeStyles.timePickerPopup}`, style: popupStyle, children: jsx("div", { className: timeStyles.timePickerList, children: timeOptions.map((time) => {
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7412
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: `${styles$4.pickerWrapper} ${timeStyles.field}${showClear ? "" : ` ${timeStyles.narrow}`}`, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, maxLength: 5 }), showClear && (jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsx(CwIcon, { iconId: "clock" })) })), renderPopup(jsx("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${timeStyles.timePickerPopup}`, style: popupStyle, children: jsx("div", { className: timeStyles.timePickerList, children: timeOptions.map((time) => {
|
|
7413
|
+
const isSelected = time === value;
|
|
7414
|
+
return (jsx("button", { ref: isSelected ? selectedItemRef : null, type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
7415
|
+
}) }) }))] }), feedbackElements] })] }) }));
|
|
7368
7416
|
}
|
|
7369
7417
|
|
|
7370
7418
|
/**
|
|
@@ -7424,7 +7472,12 @@ function combineDateTimeInOffset(date, hours, minutes, timezoneOffset) {
|
|
|
7424
7472
|
return new Date(zdt.epochMilliseconds);
|
|
7425
7473
|
}
|
|
7426
7474
|
|
|
7427
|
-
function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, nowLabel = "Now", locale = enGB, timezoneOffset, }) {
|
|
7475
|
+
function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, nowLabel = "Now", locale = enGB, timezoneOffset, feedback, ...dataAttributes }) {
|
|
7476
|
+
const feedbackMessages = feedback
|
|
7477
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7478
|
+
: [];
|
|
7479
|
+
const feedbackId = useId();
|
|
7480
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7428
7481
|
// ========================================
|
|
7429
7482
|
// PROPS NORMALIZATION
|
|
7430
7483
|
// ========================================
|
|
@@ -7664,13 +7717,19 @@ function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledD
|
|
|
7664
7717
|
const displayMaxDate = useMemo(() => normalizedMaxDateTime && timezoneOffset !== undefined
|
|
7665
7718
|
? getDateInOffset(normalizedMaxDateTime, timezoneOffset)
|
|
7666
7719
|
: normalizedMaxDateTime, [normalizedMaxDateTime, timezoneOffset]);
|
|
7667
|
-
return jsx("div", { className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsx(CwDatePicker, { value: selectedDate, onChange: handleDateChange, minDate: displayMinDate, maxDate: displayMaxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition, locale: locale }), jsx(CwTimePicker, { value: selectedTime, onChange: handleTimeChange, interval: timeInterval, minTime: timeRestrictions.minTime, maxTime: timeRestrictions.maxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsx(CwButton, { type: "button", variant: "outline", onClick: handleNowClick, disabled: disabled, text: nowLabel }))] })] }) });
|
|
7720
|
+
return jsx("div", { ...dataAttributes, className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsx(CwDatePicker, { value: selectedDate, onChange: handleDateChange, minDate: displayMinDate, maxDate: displayMaxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition, locale: locale }), jsx(CwTimePicker, { value: selectedTime, onChange: handleTimeChange, interval: timeInterval, minTime: timeRestrictions.minTime, maxTime: timeRestrictions.maxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsx(CwButton, { type: "button", variant: "outline", onClick: handleNowClick, disabled: disabled, text: nowLabel }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) });
|
|
7668
7721
|
}
|
|
7669
7722
|
|
|
7670
7723
|
var compactStyles = {"compactPopup":"cw-datetime-compact-module__compactPopup__GiuNY","calendarWrapper":"cw-datetime-compact-module__calendarWrapper__P4Nlq","timeWrapper":"cw-datetime-compact-module__timeWrapper__uMe-A","compactTimeList":"cw-datetime-compact-module__compactTimeList__MzSQT"};
|
|
7671
7724
|
|
|
7672
|
-
function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "dd.mm.yyyy HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, nowLabel = "Now", timeLabel = "Time", locale = enGB, yearRangeStart, yearRangeEnd, }) {
|
|
7725
|
+
function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "dd.mm.yyyy HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, nowLabel = "Now", timeLabel = "Time", locale = enGB, yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
7673
7726
|
const [isOpen, setIsOpen] = useState(false);
|
|
7727
|
+
const feedbackMessages = feedback
|
|
7728
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
7729
|
+
: [];
|
|
7730
|
+
const feedbackId = useId();
|
|
7731
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
7732
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
7674
7733
|
const [inputValue, setInputValue] = useState("");
|
|
7675
7734
|
const [selectedDate, setSelectedDate] = useState(value);
|
|
7676
7735
|
const [selectedTime, setSelectedTime] = useState("");
|
|
@@ -7914,14 +7973,14 @@ function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, di
|
|
|
7914
7973
|
...(maxDateTime ? [{ after: maxDateTime }] : []),
|
|
7915
7974
|
...(disabledMatcher ? [disabledMatcher] : []),
|
|
7916
7975
|
], [disabledDates, minDateTime, maxDateTime, disabledMatcher]);
|
|
7917
|
-
return (jsx("div", { ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 16 }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsx(CwIcon, { iconId: "calendar-time" })) }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, style: popupStyle, children: [jsxs("div", { className: compactStyles.calendarWrapper, children: [jsx(DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7976
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, maxLength: 16 }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsx(CwIcon, { iconId: "calendar-time" })) }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, style: popupStyle, children: [jsxs("div", { className: compactStyles.calendarWrapper, children: [jsx(DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
7977
|
+
today: new Date(),
|
|
7978
|
+
}, modifiersClassNames: {
|
|
7979
|
+
today: "rdp-day-today",
|
|
7980
|
+
} }), showTodayButton && (jsx("footer", { className: "cw-flex-row cw-align-center-center", children: jsx(CwButton, { type: "button", variant: "outline", icon: "check-big", onClick: handleNowClick, text: nowLabel }) }))] }), jsxs("div", { className: compactStyles.timeWrapper, children: [jsxs("header", { children: [jsx(CwIcon, { iconId: "clock", size: "medium" }), jsx("span", { children: timeLabel })] }), jsx("div", { ref: timeListRef, className: `${timeStyles.timePickerList} ${compactStyles.compactTimeList}`, children: timeOptions.map((time) => {
|
|
7981
|
+
const isSelected = time === selectedTime;
|
|
7982
|
+
return (jsx("button", { type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
7983
|
+
}) })] })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
7925
7984
|
}
|
|
7926
7985
|
|
|
7927
7986
|
/**
|
|
@@ -7946,14 +8005,11 @@ function resolveTwoDigitYear(twoDigitYear, currentYear) {
|
|
|
7946
8005
|
}
|
|
7947
8006
|
const parseDate = (dateString, formatStr) => {
|
|
7948
8007
|
try {
|
|
7949
|
-
if (dateString.length < 10) {
|
|
7950
|
-
return undefined;
|
|
7951
|
-
}
|
|
7952
8008
|
const cleanString = dateString.trim();
|
|
7953
8009
|
if (!cleanString)
|
|
7954
8010
|
return undefined;
|
|
7955
8011
|
const parts = cleanString.split(/[\/\-.]/);
|
|
7956
|
-
if (parts.length !== 3)
|
|
8012
|
+
if (parts.length !== 3 || parts.some(part => !/^\d{1,4}$/.test(part)))
|
|
7957
8013
|
return undefined;
|
|
7958
8014
|
let day;
|
|
7959
8015
|
let month;
|
|
@@ -7985,7 +8041,7 @@ const parseDate = (dateString, formatStr) => {
|
|
|
7985
8041
|
if (year < 100) {
|
|
7986
8042
|
year = resolveTwoDigitYear(year);
|
|
7987
8043
|
}
|
|
7988
|
-
return Temporal.PlainDate.from({ year, month, day });
|
|
8044
|
+
return Temporal.PlainDate.from({ year, month, day }, { overflow: "reject" });
|
|
7989
8045
|
}
|
|
7990
8046
|
catch {
|
|
7991
8047
|
return undefined;
|
|
@@ -7998,6 +8054,17 @@ const validate = (parsed, minDate, maxDate) => {
|
|
|
7998
8054
|
&& (!maxDate || Temporal.PlainDate.compare(parsed, maxDate) <= 0);
|
|
7999
8055
|
return parsed && isValid;
|
|
8000
8056
|
};
|
|
8057
|
+
/** Same keystroke rule as the Date-valued pickers: shorter text (5.5.2000) only commits on blur. */
|
|
8058
|
+
const TYPED_DATE_MIN_LENGTH = 10;
|
|
8059
|
+
/** What a keystroke in the date input emits: a valid in-range date, a clear on empty text, or nothing while typing. */
|
|
8060
|
+
function resolveTypedDate(text, displayFormat, minDate, maxDate) {
|
|
8061
|
+
if (text === "")
|
|
8062
|
+
return { emit: true, date: undefined };
|
|
8063
|
+
if (text.length < TYPED_DATE_MIN_LENGTH)
|
|
8064
|
+
return { emit: false };
|
|
8065
|
+
const parsed = parseDate(text, displayFormat);
|
|
8066
|
+
return parsed && validate(parsed, minDate, maxDate) ? { emit: true, date: parsed } : { emit: false };
|
|
8067
|
+
}
|
|
8001
8068
|
/** Temporal.PlainDate -> JS Date (for DayPicker interop) */
|
|
8002
8069
|
function plainDateToJsDate(pd) {
|
|
8003
8070
|
return new Date(pd.year, pd.month - 1, pd.day);
|
|
@@ -8019,7 +8086,7 @@ function formatPlainDate(pd, fmt) {
|
|
|
8019
8086
|
.replace("dd", String(pd.day).padStart(2, "0"));
|
|
8020
8087
|
}
|
|
8021
8088
|
|
|
8022
|
-
function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, locale = enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, }) {
|
|
8089
|
+
function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, locale = enGB, todayLabel = "Today", yearRangeStart, yearRangeEnd, feedback, ...dataAttributes }) {
|
|
8023
8090
|
const [isOpen, setIsOpen] = useState(false);
|
|
8024
8091
|
// Initialize with the formatted value so the input is controlled from the first render
|
|
8025
8092
|
const [inputValue, setInputValue] = useState(() => value ? formatPlainDate(value, displayFormat) : "");
|
|
@@ -8044,14 +8111,17 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8044
8111
|
onClose: handleClose,
|
|
8045
8112
|
position: popupPosition,
|
|
8046
8113
|
});
|
|
8047
|
-
// Sync input value with prop value
|
|
8114
|
+
// Sync input value with prop value; not while focused, so text is never rewritten under the cursor (blur reformats)
|
|
8048
8115
|
useEffect(() => {
|
|
8049
8116
|
const currentStr = value?.toString();
|
|
8050
8117
|
const prevStr = prevValueRef.current?.toString();
|
|
8051
8118
|
if (currentStr !== prevStr || prevDisplayFormatRef.current !== displayFormat) {
|
|
8052
8119
|
prevValueRef.current = value;
|
|
8053
8120
|
prevDisplayFormatRef.current = displayFormat;
|
|
8054
|
-
|
|
8121
|
+
const isTyping = inputRef.current !== null && inputRef.current === document.activeElement;
|
|
8122
|
+
if (!isTyping) {
|
|
8123
|
+
setInputValue(formatInputValue(value));
|
|
8124
|
+
}
|
|
8055
8125
|
}
|
|
8056
8126
|
}, [value, displayFormat, formatInputValue]);
|
|
8057
8127
|
const handleDaySelect = useCallback((date) => {
|
|
@@ -8075,11 +8145,12 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8075
8145
|
}
|
|
8076
8146
|
}, [disabled]);
|
|
8077
8147
|
const handleInputChange = useCallback((e) => {
|
|
8078
|
-
const newValue = e.
|
|
8148
|
+
const newValue = e.currentTarget.value;
|
|
8079
8149
|
setInputValue(newValue);
|
|
8080
|
-
const
|
|
8081
|
-
|
|
8082
|
-
|
|
8150
|
+
const change = resolveTypedDate(newValue, displayFormat, minDate, maxDate);
|
|
8151
|
+
if (change.emit) {
|
|
8152
|
+
onChange(change.date);
|
|
8153
|
+
}
|
|
8083
8154
|
}, [displayFormat, minDate, maxDate, onChange]);
|
|
8084
8155
|
const handleInputBlur = useCallback(() => {
|
|
8085
8156
|
const trimmedValue = inputValue?.trim();
|
|
@@ -8109,9 +8180,10 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8109
8180
|
const isTodayValid = validate(today, minDate, maxDate);
|
|
8110
8181
|
if (isTodayValid) {
|
|
8111
8182
|
onChange(today);
|
|
8183
|
+
setInputValue(formatInputValue(today));
|
|
8112
8184
|
setIsOpen(false);
|
|
8113
8185
|
}
|
|
8114
|
-
}, [minDate, maxDate, onChange]);
|
|
8186
|
+
}, [formatInputValue, minDate, maxDate, onChange]);
|
|
8115
8187
|
// Derive start/end months for the year dropdown range, guarding against inverted yearRange props
|
|
8116
8188
|
const dropdownStartMonth = useMemo(() => {
|
|
8117
8189
|
const inferredStart = minDate ? minDate.year : Temporal.Now.plainDateISO().year - 10;
|
|
@@ -8136,7 +8208,7 @@ function CwDatePickerTemporal({ value, onChange, minDate, maxDate, disabledDates
|
|
|
8136
8208
|
const defaultMonthJsDate = defaultMonth
|
|
8137
8209
|
? new Date(defaultMonth.year, defaultMonth.month - 1, 1)
|
|
8138
8210
|
: selectedJsDate;
|
|
8139
|
-
return (jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsx(DayPicker, { mode: "single", selected: selectedJsDate, defaultMonth: defaultMonthJsDate, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8211
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsx(DayPicker, { mode: "single", selected: selectedJsDate, defaultMonth: defaultMonthJsDate, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8140
8212
|
today: new Date(),
|
|
8141
8213
|
}, modifiersClassNames: {
|
|
8142
8214
|
today: "rdp-day-today",
|
|
@@ -8423,7 +8495,12 @@ function useCwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime
|
|
|
8423
8495
|
};
|
|
8424
8496
|
}
|
|
8425
8497
|
|
|
8426
|
-
function CwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, nowLabel = "Now", locale = enGB, }) {
|
|
8498
|
+
function CwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, nowLabel = "Now", locale = enGB, feedback, ...dataAttributes }) {
|
|
8499
|
+
const feedbackMessages = feedback
|
|
8500
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
8501
|
+
: [];
|
|
8502
|
+
const feedbackId = useId();
|
|
8503
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
8427
8504
|
const picker = useCwDateTimePickerTemporal({
|
|
8428
8505
|
value,
|
|
8429
8506
|
onChange,
|
|
@@ -8432,7 +8509,7 @@ function CwDateTimePickerTemporal({ value, onChange, minDateTime, maxDateTime, d
|
|
|
8432
8509
|
minTime,
|
|
8433
8510
|
maxTime,
|
|
8434
8511
|
});
|
|
8435
|
-
return jsx("div", { className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsx(CwDatePickerTemporal, { value: picker.date, onChange: picker.selectDate, minDate: picker.minDate, maxDate: picker.maxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition, locale: locale }), jsx(CwTimePicker, { value: picker.time, onChange: picker.selectTime, interval: timeInterval, minTime: picker.effectiveMinTime, maxTime: picker.effectiveMaxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsx(CwButton, { type: "button", variant: "outline", onClick: picker.selectNow, disabled: disabled, text: nowLabel }))] })] }) });
|
|
8512
|
+
return jsx("div", { ...dataAttributes, className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsx(CwDatePickerTemporal, { value: picker.date, onChange: picker.selectDate, minDate: picker.minDate, maxDate: picker.maxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition, locale: locale }), jsx(CwTimePicker, { value: picker.time, onChange: picker.selectTime, interval: timeInterval, minTime: picker.effectiveMinTime, maxTime: picker.effectiveMaxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsx(CwButton, { type: "button", variant: "outline", onClick: picker.selectNow, disabled: disabled, text: nowLabel }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) });
|
|
8436
8513
|
}
|
|
8437
8514
|
|
|
8438
8515
|
// dateRangePresetsTemporal.ts
|
|
@@ -8575,8 +8652,14 @@ const PRESET_LIBRARY_TEMPORAL = {
|
|
|
8575
8652
|
*/
|
|
8576
8653
|
const getPresetsByKeysTemporal = (keys) => keys.map((key) => PRESET_LIBRARY_TEMPORAL[key]).filter((preset) => preset !== undefined);
|
|
8577
8654
|
|
|
8578
|
-
function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, maxRangeDays, defaultMonth, labelProps, alignProps, placeholderFrom = "From date", placeholderTo = "To date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 2, locale = enGB, yearRangeStart, yearRangeEnd, showPresets = false, presetKeys, customPresets, }) {
|
|
8655
|
+
function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, maxRangeDays, defaultMonth, labelProps, alignProps, placeholderFrom = "From date", placeholderTo = "To date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 2, locale = enGB, yearRangeStart, yearRangeEnd, showPresets = false, presetKeys, customPresets, feedback, ...dataAttributes }) {
|
|
8579
8656
|
const [isOpen, setIsOpen] = useState(false);
|
|
8657
|
+
const feedbackMessages = feedback
|
|
8658
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
8659
|
+
: [];
|
|
8660
|
+
const feedbackId = useId();
|
|
8661
|
+
const feedbackIds = feedbackMessages.map((_, index) => `${feedbackId}-${index}`);
|
|
8662
|
+
const describedBy = feedbackIds.join(" ") || undefined;
|
|
8580
8663
|
const [inputFromValue, setInputFromValue] = useState("");
|
|
8581
8664
|
const [inputToValue, setInputToValue] = useState("");
|
|
8582
8665
|
const [rangeErrorMessage, setRangeErrorMessage] = useState(null);
|
|
@@ -8736,7 +8819,7 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8736
8819
|
const handleInputFromChange = useCallback((e) => {
|
|
8737
8820
|
const newValue = e.currentTarget.value;
|
|
8738
8821
|
setInputFromValue(newValue);
|
|
8739
|
-
const parsed = parseDate(newValue, displayFormat);
|
|
8822
|
+
const parsed = newValue.length >= TYPED_DATE_MIN_LENGTH ? parseDate(newValue, displayFormat) : undefined;
|
|
8740
8823
|
if (parsed) {
|
|
8741
8824
|
if (validate(parsed, minDate, maxDate) && validateRange(parsed, value?.to)) {
|
|
8742
8825
|
onChange({ from: parsed, to: value?.to });
|
|
@@ -8749,7 +8832,7 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8749
8832
|
const handleInputToChange = useCallback((e) => {
|
|
8750
8833
|
const newValue = e.currentTarget.value;
|
|
8751
8834
|
setInputToValue(newValue);
|
|
8752
|
-
const parsed = parseDate(newValue, displayFormat);
|
|
8835
|
+
const parsed = newValue.length >= TYPED_DATE_MIN_LENGTH ? parseDate(newValue, displayFormat) : undefined;
|
|
8753
8836
|
if (parsed) {
|
|
8754
8837
|
if (validate(parsed, minDate, maxDate) && validateRange(value?.from, parsed)) {
|
|
8755
8838
|
onChange({ from: value?.from, to: parsed });
|
|
@@ -8878,11 +8961,11 @@ function CwDateRangePickerTemporal({ value, onChange, minDate, maxDate, disabled
|
|
|
8878
8961
|
const defaultMonthJsDate = defaultMonth
|
|
8879
8962
|
? new Date(defaultMonth.year, defaultMonth.month - 1, 1)
|
|
8880
8963
|
: (value?.from ? plainDateToJsDate(value.from) : undefined);
|
|
8881
|
-
return (jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, required: required, size: displayFormat.length, "data-focused": focusedInput === 'from' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, required: required, size: displayFormat.length, "data-focused": focusedInput === 'to' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsx(DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonthJsDate, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8964
|
+
return (jsx("div", { ...dataAttributes, ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxs("div", { className: styles$4.value, children: [jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length, "data-focused": focusedInput === 'from' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxs("div", { className: styles$4.pickerWrapper, children: [jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, "aria-describedby": describedBy, required: required, size: displayFormat.length, "data-focused": focusedInput === 'to' }), jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [jsxs("div", { className: rangeStyles.rangeCalendarRow, children: [showPresets && presetsToRender.length > 0 && (jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsx(DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonthJsDate, locale: locale, captionLayout: "dropdown", startMonth: dropdownStartMonth, endMonth: dropdownEndMonth, modifiers: {
|
|
8965
|
+
today: new Date(),
|
|
8966
|
+
}, modifiersClassNames: {
|
|
8967
|
+
today: "rdp-day-today",
|
|
8968
|
+
} })] }), jsx("div", { role: "alert", "aria-live": "polite", className: rangeStyles.rangeError, children: rangeErrorMessage })] }))] }), feedbackMessages.map((feedbackItem, index) => (jsx("p", { id: feedbackIds[index], className: "cw-input-feedback", "data-color": feedbackItem.type, "aria-live": "polite", children: feedbackItem.message }, index)))] })] }) }));
|
|
8886
8969
|
}
|
|
8887
8970
|
|
|
8888
8971
|
function dateFromPercentage(startDate, visibleDays, percentage) {
|
|
@@ -9025,7 +9108,7 @@ class OnClickContextMenu {
|
|
|
9025
9108
|
}
|
|
9026
9109
|
}
|
|
9027
9110
|
|
|
9028
|
-
var styles$3 = {"scheduler-header":"scheduler-header-module__scheduler-header__Y7SNV","scheduler-header-divisions":"scheduler-header-module__scheduler-header-divisions__1JrNe","scheduler-timeline-now":"scheduler-header-module__scheduler-timeline-now__naREv","scheduler-timeline-label":"scheduler-header-module__scheduler-timeline-label__mLVAp","scheduler-header-title":"scheduler-header-module__scheduler-header-title__Jzy94","scheduler-dates":"scheduler-header-module__scheduler-dates__O7ePQ","current-day":"scheduler-header-module__current-day__FpHiv","scheduler-hours":"scheduler-header-module__scheduler-hours__ZDCVj"};
|
|
9111
|
+
var styles$3 = {"scheduler-header":"scheduler-header-module__scheduler-header__Y7SNV","scheduler-header-divisions":"scheduler-header-module__scheduler-header-divisions__1JrNe","scheduler-timeline-now":"scheduler-header-module__scheduler-timeline-now__naREv","scheduler-timeline-label":"scheduler-header-module__scheduler-timeline-label__mLVAp","scheduler-header-title":"scheduler-header-module__scheduler-header-title__Jzy94","title-cell":"scheduler-header-module__title-cell__mz7Ki","title":"scheduler-header-module__title__TuJVn","scheduler-dates":"scheduler-header-module__scheduler-dates__O7ePQ","current-day":"scheduler-header-module__current-day__FpHiv","scheduler-hours":"scheduler-header-module__scheduler-hours__ZDCVj"};
|
|
9029
9112
|
|
|
9030
9113
|
const getNow$1 = (isUtc) => {
|
|
9031
9114
|
let now = new Date();
|
|
@@ -9087,7 +9170,7 @@ const SchedulerHeaderDivision = ({ topDivisions, bottomDivisions, classification
|
|
|
9087
9170
|
};
|
|
9088
9171
|
|
|
9089
9172
|
const HeaderTitle = ({ title, dividerText, width }) => {
|
|
9090
|
-
return (jsxs("div", { className: styles$3["scheduler-header-title"], style: { width: width }, children: [jsx("div", { children: jsx("
|
|
9173
|
+
return (jsxs("div", { className: styles$3["scheduler-header-title"], style: { width: width }, children: [jsx("div", { className: styles$3["title-cell"], children: jsx("span", { className: styles$3.title, children: title }) }), jsx("div", { children: jsx("span", { children: dividerText }) })] }));
|
|
9091
9174
|
};
|
|
9092
9175
|
|
|
9093
9176
|
const SchedulerHeader = ({ content, divisions, visibleDays, selectedDate, width, onEvent, timeLinePercentage, isUtc }) => {
|
|
@@ -9125,7 +9208,7 @@ function getStartEnd(day) {
|
|
|
9125
9208
|
};
|
|
9126
9209
|
}
|
|
9127
9210
|
|
|
9128
|
-
var styles$2 = {"hide-scrollbar":"new-scheduler-module__hide-scrollbar__33GG9","scheduler-event":"new-scheduler-module__scheduler-event__gphwn","scheduler-event-container":"new-scheduler-module__scheduler-event-container__-h1xm","time-marker":"new-scheduler-module__time-marker__2BejU","scheduler-event-text":"new-scheduler-module__scheduler-event-text__zjvd7"};
|
|
9211
|
+
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"};
|
|
9129
9212
|
|
|
9130
9213
|
const BackgroundEvent = ({ value, heightRem }) => {
|
|
9131
9214
|
const backColor = getHSLColor(value.color, value.alpha ?? 0.5);
|
|
@@ -9326,7 +9409,7 @@ const DefaultRowHeader = ({ value, width, onEvent }) => {
|
|
|
9326
9409
|
return (jsxs("div", { style: {
|
|
9327
9410
|
width: width,
|
|
9328
9411
|
flexShrink: 0,
|
|
9329
|
-
|
|
9412
|
+
background: value.highlightColor,
|
|
9330
9413
|
}, onClick: (_) => {
|
|
9331
9414
|
onEvent(new OnClickRowHeader(value.rowId));
|
|
9332
9415
|
}, className: styles$1["scheduler-row-header"], children: [jsxs("div", { children: [jsx("strong", { children: value.title }), value.title2 && jsxs("span", { children: ["-", value.title2] }), " ", jsx("strong", { children: value.subtitle })] }), value.subtitle && jsxs("div", { style: { opacity: 0.5 }, children: [value.title3 && jsxs("span", { className: styles$1["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] }), value.subtitle2 && jsxs("span", { children: ["-", value.subtitle2] })] })] }));
|
|
@@ -9419,7 +9502,7 @@ const SchedulerEvent = ({ value, heightRem, onEvent, maxEventHeightRem }) => {
|
|
|
9419
9502
|
height: `calc(${effectiveHeight}rem - 4px)`,
|
|
9420
9503
|
opacity: eventTransparent ? 0.5 : 1,
|
|
9421
9504
|
...value.style,
|
|
9422
|
-
}, className: styles$2["scheduler-event"], children: [jsxs("div", { style: {
|
|
9505
|
+
}, className: styles$2["scheduler-event"], "data-underlay": value.underlay ? true : undefined, children: [value.underlay && jsx("div", { className: styles$2["underlay"], children: value.underlay }), jsxs("div", { style: {
|
|
9423
9506
|
display: "flex",
|
|
9424
9507
|
flexDirection: "row",
|
|
9425
9508
|
alignItems: "stretch",
|
|
@@ -9436,29 +9519,26 @@ const SchedulerEvent = ({ value, heightRem, onEvent, maxEventHeightRem }) => {
|
|
|
9436
9519
|
alignItems: "center",
|
|
9437
9520
|
whiteSpace: "nowrap",
|
|
9438
9521
|
color: textColor,
|
|
9439
|
-
}, children: value.icons }), jsx("span", { style: {
|
|
9522
|
+
}, children: value.icons }), jsx("span", { className: value.underlay ? styles$2["label-halo"] : undefined, style: {
|
|
9440
9523
|
padding: "0.1rem",
|
|
9441
9524
|
color: textColor,
|
|
9442
9525
|
display: "flex",
|
|
9443
9526
|
flex: 1,
|
|
9444
9527
|
alignItems: "center",
|
|
9445
9528
|
width: "100%",
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
width: "100%",
|
|
9449
|
-
}, children: value.rectangleColors.map((item, i) => (jsx("div", { className: "cwellt_rectangle_indicator", style: {
|
|
9450
|
-
backgroundColor: item,
|
|
9451
|
-
flex: 1,
|
|
9452
|
-
height: "8px",
|
|
9453
|
-
margin: 0,
|
|
9454
|
-
padding: 0,
|
|
9455
|
-
} }, value.id + "_" + i))) })) : (value.name) })] }), value.isResizable && (jsx(EventSideDrag, { heightRem: effectiveHeight * 0.7, onStartEvent: () => {
|
|
9529
|
+
...(value.underlay && { "--label-halo-color": backColor }),
|
|
9530
|
+
}, children: value.rectangleColors && value.rectangleColors.length > 0 ? (jsx("div", { className: styles$2["color-bars"], children: value.rectangleColors.map((item, i) => (jsx("div", { style: { backgroundColor: item } }, value.id + "_" + i))) })) : (value.label ?? value.name) })] }), value.isResizable && (jsx(EventSideDrag, { heightRem: effectiveHeight * 0.7, onStartEvent: () => {
|
|
9456
9531
|
onEvent(new OnRightDragStart(value.id));
|
|
9457
9532
|
} }))] }), value.primaryTimeMarkerColor && (jsx("div", { className: styles$2["time-marker"], style: {
|
|
9458
9533
|
backgroundColor: value.primaryTimeMarkerColor,
|
|
9459
9534
|
} })), value.secondaryTimeMarkerColor && (jsx("div", { className: styles$2["time-marker"], style: {
|
|
9460
9535
|
backgroundColor: value.secondaryTimeMarkerColor,
|
|
9461
|
-
} }))] }) }) }, value.id) })]
|
|
9536
|
+
} }))] }) }) }, value.id) }), value.cornerMarker && (jsx("div", { className: styles$2["corner-marker"], style: {
|
|
9537
|
+
top: `${topOffsetPx}px`,
|
|
9538
|
+
left: `${value.left}%`,
|
|
9539
|
+
width: `${value.width}%`,
|
|
9540
|
+
height: `calc(${effectiveHeight}rem - 4px)`,
|
|
9541
|
+
}, children: jsx("span", { "data-interactive": value.cornerMarker.tooltip ? true : undefined, "data-pulse": value.cornerMarker.pulse ? true : undefined, children: value.cornerMarker.tooltip ? (jsx(CwTooltipNew, { content: value.cornerMarker.tooltip, position: "top", showDelay: 200, hide: isOnDrag, displayInline: true, children: jsx(CwBadge, { color: value.cornerMarker.color, size: "medium" }) })) : (jsx(CwBadge, { color: value.cornerMarker.color, size: "medium" })) }) }))] }));
|
|
9462
9542
|
};
|
|
9463
9543
|
|
|
9464
9544
|
const SchedulerRow = memo((props) => {
|
|
@@ -9850,6 +9930,8 @@ const groupByRowIdStable = (items, prev) => {
|
|
|
9850
9930
|
const Scheduler = (props) => {
|
|
9851
9931
|
const { header: headerContent, id, events: eventsState, backgroundEvents, indicatorRows: allIndicatorRows = [], contextMenuItems, EventComp, RowTitleComp, orderCategories = ["title"], useOrderCategory, onEvent, groupRowColors, rowHeaderWidth = 180, rowHeightRem = 1.75, maxEventHeightRem, } = props;
|
|
9852
9932
|
const BackgroundEventComp = props.BackgroundEventComp ?? BackgroundEvent;
|
|
9933
|
+
// Picked by prefix: a rest spread would also put every non-destructured prop on the DOM.
|
|
9934
|
+
const dataAttributes = Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith("data-")));
|
|
9853
9935
|
const [constraintElement, setConstraintElement] = useState(null);
|
|
9854
9936
|
const rows = useOrderCategory === false
|
|
9855
9937
|
? props.rows
|
|
@@ -9858,9 +9940,10 @@ const Scheduler = (props) => {
|
|
|
9858
9940
|
// const rowHeaderWidth = "180px";
|
|
9859
9941
|
const { selectedDate, visibleDays, isUtc, isHeaderVisible, visibleRows: stateVisibleRows } = props.state;
|
|
9860
9942
|
const events = useMemo(() => filterVisibleEvents(eventsState, selectedDate, visibleDays), [eventsState, selectedDate, visibleDays]);
|
|
9943
|
+
// The virtual list caches row sizes: anything getItemSize depends on must reset them.
|
|
9861
9944
|
useEffect(() => {
|
|
9862
9945
|
instanceRef.current?.resetAfterIndex(0);
|
|
9863
|
-
}, [orderCategories, props.rows.length, events, allIndicatorRows]);
|
|
9946
|
+
}, [orderCategories, props.rows.length, events, allIndicatorRows, rowHeightRem]);
|
|
9864
9947
|
// Bucket events / backgroundEvents / indicatorRows by rowId once per render
|
|
9865
9948
|
// instead of running events.filter() per row inside the row renderer.
|
|
9866
9949
|
// Reuse previous bucket arrays when their contents are unchanged so the
|
|
@@ -9975,7 +10058,7 @@ const Scheduler = (props) => {
|
|
|
9975
10058
|
return rowsNumber * effectiveRowHeight * pixelsInRem + indicatorPixels;
|
|
9976
10059
|
}, [rows, eventsByRow, indicatorRowsByRow, rowHeightRem]);
|
|
9977
10060
|
// Render
|
|
9978
|
-
return (jsx(TooltipConstraintContext.Provider, { value: constraintElement, children: jsxs("div", { ref: setConstraintElement, id: id, style: {
|
|
10061
|
+
return (jsx(TooltipConstraintContext.Provider, { value: constraintElement, children: jsxs("div", { ...dataAttributes, ref: setConstraintElement, id: id, style: {
|
|
9979
10062
|
position: "relative",
|
|
9980
10063
|
height: `${schedulerContentHeight + 4}rem`,
|
|
9981
10064
|
overflowY: "auto",
|