@cwellt_software/cwellt-reactjs-lib 1.1.6 → 1.2.0

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.
Files changed (637) hide show
  1. package/dist/content/icons/new-cw-icons/NewCwIcons.html +13 -3
  2. package/dist/content/icons/new-cw-icons/NewCwIcons.json +10 -1
  3. package/dist/content/icons/new-cw-icons/css/new-cw-icons.css +39 -2
  4. package/dist/content/icons/new-cw-icons/fonts/NewCwIcons.woff +0 -0
  5. package/dist/index.cjs.js +2169 -1653
  6. package/dist/index.css +1 -7
  7. package/dist/index.d.ts +446 -327
  8. package/dist/index.es.js +2167 -1607
  9. package/dist/src/common/classes/CwSelectList.js +12 -0
  10. package/dist/src/common/classes/CwSelectListItems.js +14 -0
  11. package/dist/src/common/functions/collections.js +18 -0
  12. package/dist/src/common/functions/colorManipulation.js +76 -0
  13. package/dist/src/common/functions/dsl/UiEventDSL.js +20 -0
  14. package/dist/src/common/functions/useSingleAndDoubleClicks.js +28 -0
  15. package/dist/src/components/control/action/button/CwButton.d.ts +5 -2
  16. package/dist/src/components/control/action/button/CwButton.d.ts.map +1 -1
  17. package/dist/src/components/control/action/button/CwButton.js +13 -0
  18. package/dist/src/components/control/action/buttons/CwButtons.d.ts +24 -54
  19. package/dist/src/components/control/action/buttons/CwButtons.d.ts.map +1 -1
  20. package/dist/src/components/control/action/buttons/CwButtons.js +188 -0
  21. package/dist/src/components/control/action/contextmenu/CwAnchoredMenu.d.ts +80 -0
  22. package/dist/src/components/control/action/contextmenu/CwAnchoredMenu.d.ts.map +1 -0
  23. package/dist/src/components/control/action/contextmenu/CwContextMenu.d.ts +0 -11
  24. package/dist/src/components/control/action/contextmenu/CwContextMenu.d.ts.map +1 -1
  25. package/dist/src/components/control/action/contextmenu/CwContextMenu.js +43 -0
  26. package/dist/src/components/control/action/contextual-menu/CwContextualMenu.js +55 -0
  27. package/dist/src/components/control/action/search/CwSearch.d.ts +6 -2
  28. package/dist/src/components/control/action/search/CwSearch.d.ts.map +1 -1
  29. package/dist/src/components/control/action/search/CwSearch.js +67 -0
  30. package/dist/src/components/control/action/tooltip-dialog/CwTooltipDialog.js +11 -0
  31. package/dist/src/components/control/choice/checkbox/CwCheckbox.js +15 -0
  32. package/dist/src/components/control/choice/deprecated/MultiSelect_deprecated_.js +99 -0
  33. package/dist/src/components/control/choice/dropdown/CwDropdown.js +27 -0
  34. package/dist/src/components/control/choice/dropdown/CwDropdownContainer.js +30 -0
  35. package/dist/src/components/control/choice/dropdown/CwDropdownFilter.js +10 -0
  36. package/dist/src/components/control/choice/multi-filter/CwMultiFilter.d.ts +1 -5
  37. package/dist/src/components/control/choice/multi-filter/CwMultiFilter.d.ts.map +1 -1
  38. package/dist/src/components/control/choice/multi-filter/CwMultiFilter.js +298 -0
  39. package/dist/src/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.d.ts +2 -2
  40. package/dist/src/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.d.ts.map +1 -1
  41. package/dist/src/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.js +17 -0
  42. package/dist/src/components/control/choice/multiselect/CwHeadFilter.js +80 -0
  43. package/dist/src/components/control/choice/multiselect/CwMultiselect.js +393 -0
  44. package/dist/src/components/control/choice/multiselect/CwOptionList.js +36 -0
  45. package/dist/src/components/control/choice/option/CwOption.js +16 -0
  46. package/dist/src/components/control/choice/select/CwSelect.js +36 -0
  47. package/dist/src/components/control/choice/toggle/CwToggle.d.ts.map +1 -1
  48. package/dist/src/components/control/choice/toggle/CwToggle.js +9 -0
  49. package/dist/src/components/control/input/any/CwInput.js +16 -0
  50. package/dist/src/components/control/input/color/CwColorPicker.js +210 -0
  51. package/dist/src/components/control/input/color/CwInputColor.js +142 -0
  52. package/dist/src/components/control/input/date/CwInputDate.js +29 -0
  53. package/dist/src/components/control/input/date-picker/CwInputDatePicker.js +109 -0
  54. package/dist/src/components/control/input/date-text/CwInputDateText.js +90 -0
  55. package/dist/src/components/control/input/datetime/CwInputDatetime.js +29 -0
  56. package/dist/src/components/control/input/digit/CwDigit.js +28 -0
  57. package/dist/src/components/control/input/file/CwFileUpload.js +52 -0
  58. package/dist/src/components/control/input/file/CwFileUploadMultiple.d.ts +1 -0
  59. package/dist/src/components/control/input/file/CwFileUploadMultiple.d.ts.map +1 -1
  60. package/dist/src/components/control/input/file/CwFileUploadMultiple.js +148 -0
  61. package/dist/src/components/control/input/image/CwInputImage.js +52 -0
  62. package/dist/src/components/control/input/image-area/CwImageArea.js +113 -0
  63. package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts +44 -0
  64. package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts.map +1 -0
  65. package/dist/src/components/control/input/new-dates/CwDateRangePicker.d.ts +65 -0
  66. package/dist/src/components/control/input/new-dates/CwDateRangePicker.d.ts.map +1 -0
  67. package/dist/src/components/control/input/new-dates/CwDateTimePicker.d.ts +47 -0
  68. package/dist/src/components/control/input/new-dates/CwDateTimePicker.d.ts.map +1 -0
  69. package/dist/src/components/control/input/new-dates/CwDateTimePickerCompact.d.ts +46 -0
  70. package/dist/src/components/control/input/new-dates/CwDateTimePickerCompact.d.ts.map +1 -0
  71. package/dist/src/components/control/input/new-dates/CwTimePicker.d.ts +38 -0
  72. package/dist/src/components/control/input/new-dates/CwTimePicker.d.ts.map +1 -0
  73. package/dist/src/components/control/input/new-dates/dateRangePresets.d.ts +19 -0
  74. package/dist/src/components/control/input/new-dates/dateRangePresets.d.ts.map +1 -0
  75. package/dist/src/components/control/input/number/CwInputNumber.js +11 -0
  76. package/dist/src/components/control/input/phone/CwInputPhone.js +24 -0
  77. package/dist/src/components/control/input/text/CwInputText.d.ts.map +1 -1
  78. package/dist/src/components/control/input/text/CwInputText.js +31 -0
  79. package/dist/src/components/control/input/text-area/CwTextArea.js +9 -0
  80. package/dist/src/components/control/input/time/CwTime.js +29 -0
  81. package/dist/src/components/control/input/weekday/CwWeekdaySelector.js +143 -0
  82. package/dist/src/components/custom/find-airport/CwFindAirportComp.d.ts +4 -1
  83. package/dist/src/components/custom/find-airport/CwFindAirportComp.d.ts.map +1 -1
  84. package/dist/src/components/custom/find-airport/CwFindAirportComp.js +240 -0
  85. package/dist/src/components/custom/scheduler/CwSchedulerComp.js +211 -0
  86. package/dist/src/components/custom/scheduler/CwSuperSchedulerComp.js +269 -0
  87. package/dist/src/components/custom/scheduler/components/EventRender.js +142 -0
  88. package/dist/src/components/custom/scheduler/components/ResourceListRender.d.ts +1 -1
  89. package/dist/src/components/custom/scheduler/components/ResourceListRender.d.ts.map +1 -1
  90. package/dist/src/components/custom/scheduler/components/ResourceListRender.js +12 -0
  91. package/dist/src/components/custom/scheduler/components/ResourceRender.js +26 -0
  92. package/dist/src/components/custom/scheduler/components/day_headers/DayHeader.js +13 -0
  93. package/dist/src/components/custom/scheduler/components/day_headers/MonthHeader.js +12 -0
  94. package/dist/src/components/custom/scheduler/components/day_headers/MyDaysHeader.js +62 -0
  95. package/dist/src/components/custom/scheduler/components/day_headers/WeekHeader.js +13 -0
  96. package/dist/src/components/custom/scheduler/components/resources_title_list/ResourcesTitleList.js +24 -0
  97. package/dist/src/components/custom/scheduler/components/scheduler_content_area/SchedulerContentArea.js +17 -0
  98. package/dist/src/components/custom/scheduler/components/scheduler_header/SchedulerHeader.js +26 -0
  99. package/dist/src/components/custom/scheduler/components/scheduler_timeline/SchedulerTimeLine.js +23 -0
  100. package/dist/src/components/custom/scheduler/components/time_headers/TimeHeader.js +31 -0
  101. package/dist/src/components/custom/scheduler/components/time_headers/TimeHeaderRow.js +16 -0
  102. package/dist/src/components/custom/scheduler/components/time_line/TimeLine.js +12 -0
  103. package/dist/src/components/custom/scheduler/logic/dates/addMinutesToDateFromPx.js +5 -0
  104. package/dist/src/components/custom/scheduler/logic/dates/daysBetweenTwoDates.js +15 -0
  105. package/dist/src/components/custom/scheduler/logic/dates/daysBetweenTwoDatesWithoutCeil.js +5 -0
  106. package/dist/src/components/custom/scheduler/logic/dates/getFormatedTimeForHeader.js +43 -0
  107. package/dist/src/components/custom/scheduler/logic/dates/getMonthHeaderData.js +35 -0
  108. package/dist/src/components/custom/scheduler/logic/dates/getUtcToday.js +6 -0
  109. package/dist/src/components/custom/scheduler/logic/dates/getWeekHeaderDataFromWeekRange.js +20 -0
  110. package/dist/src/components/custom/scheduler/logic/dates/listOfDatesToWeeks.js +55 -0
  111. package/dist/src/components/custom/scheduler/logic/divisions/calculateDivisionType.js +13 -0
  112. package/dist/src/components/custom/scheduler/logic/divisions/calculateDivisions.js +16 -0
  113. package/dist/src/components/custom/scheduler/logic/filtering/filterEvents.js +33 -0
  114. package/dist/src/components/custom/scheduler/logic/filtering/filterResources.js +14 -0
  115. package/dist/src/components/custom/scheduler/logic/filtering/hasSameProperties.js +10 -0
  116. package/dist/src/components/custom/scheduler/logic/onDrop/OnDrop.js +45 -0
  117. package/dist/src/components/custom/scheduler/logic/pixels/getHeightLineScheduler.js +14 -0
  118. package/dist/src/components/custom/scheduler/logic/pixels/getPixelsForEvent.js +32 -0
  119. package/dist/src/components/custom/scheduler/logic/pixels/heightScheduler.js +14 -0
  120. package/dist/src/components/custom/scheduler/logic/pixels/heightSchedulerPinned.js +9 -0
  121. package/dist/src/components/custom/scheduler/logic/state_handle/doubleClickOnResource.js +5 -0
  122. package/dist/src/components/custom/scheduler/logic/state_handle/handleResourceChange.js +11 -0
  123. package/dist/src/components/custom/scheduler/logic/state_handle/onDragOver.js +9 -0
  124. package/dist/src/components/custom/scheduler/logic/state_handle/onDropEventToResource.js +3 -0
  125. package/dist/src/components/custom/scheduler/logic/strings/compareStrings.js +7 -0
  126. package/dist/src/components/custom/scheduler/logic/strings/getGUID.js +7 -0
  127. package/dist/src/components/custom/scheduler/logic/ui/checkIfSlotAvailable.js +8 -0
  128. package/dist/src/components/custom/scheduler/logic/ui/getEventsOfResource.js +45 -0
  129. package/dist/src/components/custom/scheduler/logic/ui/getTimeHeaders.js +35 -0
  130. package/dist/src/components/custom/scheduler/logic/ui/isAllowedToMove.js +19 -0
  131. package/dist/src/components/custom/scheduler/logic/ui/updateResourceVisibility.js +15 -0
  132. package/dist/src/components/custom/scheduler/state/CblDragAndDrop.js +18 -0
  133. package/dist/src/components/custom/scheduler/state/CwSchedulerProps.js +1 -0
  134. package/dist/src/components/custom/scheduler/state/Resource.js +18 -0
  135. package/dist/src/components/custom/scheduler/state/State.js +1 -0
  136. package/dist/src/components/custom/scheduler/state/cblEvent.js +28 -0
  137. package/dist/src/components/custom/scheduler/state/cblEventCompProps.js +1 -0
  138. package/dist/src/components/custom/scheduler/state/resourceCompProps2.js +1 -0
  139. package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts +3 -4
  140. package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts.map +1 -1
  141. package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.js +123 -0
  142. package/dist/src/components/custom/scheduler-new/presentation/NewSchedulerUiEvents.d.ts +2 -1
  143. package/dist/src/components/custom/scheduler-new/presentation/NewSchedulerUiEvents.d.ts.map +1 -1
  144. package/dist/src/components/custom/scheduler-new/presentation/NewSchedulerUiEvents.js +118 -0
  145. package/dist/src/components/custom/scheduler-new/presentation/SchedulerPresenter.js +166 -0
  146. package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderDivision.js +26 -0
  147. package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderTitle.js +8 -0
  148. package/dist/src/components/custom/scheduler-new/presentation/components/header/SchedulerHeader.js +86 -0
  149. package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgroundEvent.js +60 -0
  150. package/dist/src/components/custom/scheduler-new/presentation/components/row/DefaultRowHeader.d.ts.map +1 -1
  151. package/dist/src/components/custom/scheduler-new/presentation/components/row/DefaultRowHeader.js +24 -0
  152. package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts +2 -2
  153. package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts.map +1 -1
  154. package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.js +150 -0
  155. package/dist/src/components/custom/scheduler-new/presentation/components/row/EventSideDrag.js +11 -0
  156. package/dist/src/components/custom/scheduler-new/presentation/components/row/SchedulerRow.d.ts +2 -2
  157. package/dist/src/components/custom/scheduler-new/presentation/components/row/SchedulerRow.d.ts.map +1 -1
  158. package/dist/src/components/custom/scheduler-new/presentation/components/row/SchedulerRow.js +176 -0
  159. package/dist/src/components/custom/scheduler-new/presentation/components/timeline/DivisionLine.js +8 -0
  160. package/dist/src/components/custom/scheduler-new/presentation/components/timeline/TimeLine.js +39 -0
  161. package/dist/src/components/custom/scheduler-new/presentation/components/timeline/WeekEndLine.js +8 -0
  162. package/dist/src/components/custom/scheduler-new/presentation/helpers.js +43 -0
  163. package/dist/src/components/custom/scheduler-new/presentation/logic/WeekendCalc.js +24 -0
  164. package/dist/src/components/custom/scheduler-new/presentation/logic/dateFromPercentage.js +7 -0
  165. package/dist/src/components/custom/scheduler-new/presentation/logic/eventIsVisible.js +7 -0
  166. package/dist/src/components/custom/scheduler-new/presentation/logic/getDefaultDivisions.js +113 -0
  167. package/dist/src/components/custom/scheduler-new/presentation/logic/getDivisions.js +21 -0
  168. package/dist/src/components/custom/scheduler-new/presentation/logic/getEventSizes.js +30 -0
  169. package/dist/src/components/custom/scheduler-new/presentation/logic/getLinesByDivisions.js +13 -0
  170. package/dist/src/components/custom/scheduler-new/presentation/logic/getPercentageFromMouseEvent.d.ts +1 -0
  171. package/dist/src/components/custom/scheduler-new/presentation/logic/getPercentageFromMouseEvent.d.ts.map +1 -1
  172. package/dist/src/components/custom/scheduler-new/presentation/logic/getPercentageFromMouseEvent.js +7 -0
  173. package/dist/src/components/custom/scheduler-new/presentation/logic/separateEventsToInnerRows.js +32 -0
  174. package/dist/src/components/custom/scheduler-new/presentation/logic/sortByCategoryAndTitle.js +12 -0
  175. package/dist/src/components/custom/scheduler-temporal/CwSchedulerComp2.js +267 -0
  176. package/dist/src/components/custom/scheduler-temporal/CwSuperSchedulerComp.js +269 -0
  177. package/dist/src/components/custom/scheduler-temporal/components/EventRender.js +142 -0
  178. package/dist/src/components/custom/scheduler-temporal/components/ResourceListRender.js +12 -0
  179. package/dist/src/components/custom/scheduler-temporal/components/ResourceRender.js +26 -0
  180. package/dist/src/components/custom/scheduler-temporal/components/day_headers/DayHeader.js +13 -0
  181. package/dist/src/components/custom/scheduler-temporal/components/day_headers/MonthHeader.js +12 -0
  182. package/dist/src/components/custom/scheduler-temporal/components/day_headers/MyDaysHeader.js +62 -0
  183. package/dist/src/components/custom/scheduler-temporal/components/day_headers/WeekHeader.js +13 -0
  184. package/dist/src/components/custom/scheduler-temporal/components/resources_title_list/ResourcesTitleList.js +22 -0
  185. package/dist/src/components/custom/scheduler-temporal/components/scheduler_content_area/SchedulerContentArea.js +17 -0
  186. package/dist/src/components/custom/scheduler-temporal/components/scheduler_header/SchedulerHeader.js +26 -0
  187. package/dist/src/components/custom/scheduler-temporal/components/scheduler_timeline/SchedulerTimeLine.js +23 -0
  188. package/dist/src/components/custom/scheduler-temporal/components/time_headers/TimeHeader.js +31 -0
  189. package/dist/src/components/custom/scheduler-temporal/components/time_headers/TimeHeaderRow.js +16 -0
  190. package/dist/src/components/custom/scheduler-temporal/components/time_line/TimeLine.js +12 -0
  191. package/dist/src/components/custom/scheduler-temporal/logic/dates/addMinutesToDateFromPx.js +5 -0
  192. package/dist/src/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDates.js +15 -0
  193. package/dist/src/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDatesWithoutCeil.js +5 -0
  194. package/dist/src/components/custom/scheduler-temporal/logic/dates/getFormatedTimeForHeader.js +43 -0
  195. package/dist/src/components/custom/scheduler-temporal/logic/dates/getMonthHeaderData.js +35 -0
  196. package/dist/src/components/custom/scheduler-temporal/logic/dates/getUtcToday.js +6 -0
  197. package/dist/src/components/custom/scheduler-temporal/logic/dates/getWeekHeaderDataFromWeekRange.js +20 -0
  198. package/dist/src/components/custom/scheduler-temporal/logic/dates/listOfDatesToWeeks.js +55 -0
  199. package/dist/src/components/custom/scheduler-temporal/logic/divisions/calculateDivisionType.js +13 -0
  200. package/dist/src/components/custom/scheduler-temporal/logic/divisions/calculateDivisions.js +16 -0
  201. package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterAndProcessResources.js +10 -0
  202. package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterEvents.js +34 -0
  203. package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterResources.js +14 -0
  204. package/dist/src/components/custom/scheduler-temporal/logic/filtering/hasSameProperties.js +10 -0
  205. package/dist/src/components/custom/scheduler-temporal/logic/onDrop/OnDrop.js +36 -0
  206. package/dist/src/components/custom/scheduler-temporal/logic/pixels/getHeightLineScheduler.js +14 -0
  207. package/dist/src/components/custom/scheduler-temporal/logic/pixels/getPixelsForEvent.js +32 -0
  208. package/dist/src/components/custom/scheduler-temporal/logic/pixels/heightScheduler.js +14 -0
  209. package/dist/src/components/custom/scheduler-temporal/logic/pixels/heightSchedulerPinned.js +9 -0
  210. package/dist/src/components/custom/scheduler-temporal/logic/state_handle/doubleClickOnResource.js +5 -0
  211. package/dist/src/components/custom/scheduler-temporal/logic/state_handle/handlePropChanges.js +178 -0
  212. package/dist/src/components/custom/scheduler-temporal/logic/state_handle/handleResourceChange.js +11 -0
  213. package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onDragOver.js +9 -0
  214. package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onDropEventToResource.js +3 -0
  215. package/dist/src/components/custom/scheduler-temporal/logic/state_handle/onResizeEvent.js +3 -0
  216. package/dist/src/components/custom/scheduler-temporal/logic/strings/compareStrings.js +7 -0
  217. package/dist/src/components/custom/scheduler-temporal/logic/strings/getGUID.js +7 -0
  218. package/dist/src/components/custom/scheduler-temporal/logic/ui/checkIfSlotAvailable.js +9 -0
  219. package/dist/src/components/custom/scheduler-temporal/logic/ui/getEventsOfResource.js +92 -0
  220. package/dist/src/components/custom/scheduler-temporal/logic/ui/getHasPropsChanged.js +242 -0
  221. package/dist/src/components/custom/scheduler-temporal/logic/ui/getTimeHeaders.js +35 -0
  222. package/dist/src/components/custom/scheduler-temporal/logic/ui/isAllowedToMove.js +19 -0
  223. package/dist/src/components/custom/scheduler-temporal/logic/ui/shouldTriggerScroll.js +241 -0
  224. package/dist/src/components/custom/scheduler-temporal/logic/ui/updateResourceVisibility.js +15 -0
  225. package/dist/src/components/custom/scheduler-temporal/state/CblDragAndDrop.js +18 -0
  226. package/dist/src/components/custom/scheduler-temporal/state/Resource.js +18 -0
  227. package/dist/src/components/custom/scheduler-temporal/state/cblEvent.js +28 -0
  228. package/dist/src/components/custom/scheduler-temporal/state/cblEventCompProps.js +1 -0
  229. package/dist/src/components/custom/scheduler-temporal/state/resourceCompProps2.js +1 -0
  230. package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts +2 -2
  231. package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts.map +1 -1
  232. package/dist/src/components/custom/super-scheduler/PinRowHeader.js +53 -0
  233. package/dist/src/components/custom/super-scheduler/SuperScheduler.d.ts +2 -2
  234. package/dist/src/components/custom/super-scheduler/SuperScheduler.d.ts.map +1 -1
  235. package/dist/src/components/custom/super-scheduler/SuperScheduler.js +23 -0
  236. package/dist/src/components/custom/super-scheduler/SuperSchedulerEvents.js +15 -0
  237. package/dist/src/components/custom/super-scheduler/SuperSchedulerPresenter.js +45 -0
  238. package/dist/src/components/display/data/accordion/CwAccordionContainer.js +20 -0
  239. package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts +1 -0
  240. package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts.map +1 -1
  241. package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.js +138 -0
  242. package/dist/src/components/display/data/table/CwTable.d.ts +25 -20
  243. package/dist/src/components/display/data/table/CwTable.d.ts.map +1 -1
  244. package/dist/src/components/display/data/table/CwTable.js +203 -0
  245. package/dist/src/components/display/graphics/icon/CwIcon.d.ts.map +1 -1
  246. package/dist/src/components/display/graphics/icon/CwIcon.js +23 -0
  247. package/dist/src/components/display/graphics/icon/svg-icons.d.ts +6 -0
  248. package/dist/src/components/display/graphics/icon/svg-icons.d.ts.map +1 -0
  249. package/dist/src/components/display/graphics/loading/CwLoading.js +27 -0
  250. package/dist/src/components/display/graphics/loading-small/CwLoadingSmall.js +20 -0
  251. package/dist/src/components/display/text/heading/CwHeadingMain.js +5 -0
  252. package/dist/src/components/display/text/heading/CwHeadingSecond.js +5 -0
  253. package/dist/src/components/display/text/label/CwLabel.d.ts +1 -4
  254. package/dist/src/components/display/text/label/CwLabel.d.ts.map +1 -1
  255. package/dist/src/components/display/text/label/CwLabel.js +13 -0
  256. package/dist/src/components/display/text/message/CwMessage.js +75 -0
  257. package/dist/src/components/display/text/note/CwNote.js +78 -0
  258. package/dist/src/components/display/text/tag/CwChip.d.ts.map +1 -1
  259. package/dist/src/components/display/text/tag/CwChip.js +57 -0
  260. package/dist/src/components/display/text/tag/CwTag.js +21 -0
  261. package/dist/src/components/display/text/tooltip/CwTooltip.js +4 -0
  262. package/dist/src/components/layout/align/CwAlign.js +54 -0
  263. package/dist/src/components/layout/card/CwCard.js +55 -0
  264. package/dist/src/components/layout/card/CwCardList.js +38 -0
  265. package/dist/src/components/layout/dialog/CwDialog.d.ts.map +1 -1
  266. package/dist/src/components/layout/dialog/CwDialog.js +255 -0
  267. package/dist/src/components/layout/dialog/CwDialogManager.js +44 -0
  268. package/dist/src/components/layout/list/details/CwExpandable.js +28 -0
  269. package/dist/src/components/layout/list/key-value/CwKeyValueList.d.ts +2 -3
  270. package/dist/src/components/layout/list/key-value/CwKeyValueList.d.ts.map +1 -1
  271. package/dist/src/components/layout/list/key-value/CwKeyValueList.js +23 -0
  272. package/dist/src/components/layout/list/sortable/CwSortableList.js +73 -0
  273. package/dist/src/components/layout/list/sortable/useSortableList.js +53 -0
  274. package/dist/src/components/layout/modal/CwModalReportFunctional.d.ts.map +1 -1
  275. package/dist/src/components/layout/modal/CwModalReportFunctional.js +23 -0
  276. package/dist/src/components/layout/modal/hover/CwModalHover.js +61 -0
  277. package/dist/src/components/layout/modal/legacy/cw_modal.d.ts +4 -0
  278. package/dist/src/components/layout/modal/legacy/cw_modal.d.ts.map +1 -1
  279. package/dist/src/components/layout/modal/legacy/cw_modal.js +44 -0
  280. package/dist/src/components/layout/modal/legacy/cw_modal_confirm.js +39 -0
  281. package/dist/src/components/layout/modal/legacy/cw_modal_iframe.js +44 -0
  282. package/dist/src/components/layout/modal/legacy/cw_modal_report.js +26 -0
  283. package/dist/src/components/layout/table/grouped/CwTableGrouped.js +70 -0
  284. package/dist/src/components/layout/tabs/CwTabs.d.ts +2 -0
  285. package/dist/src/components/layout/tabs/CwTabs.d.ts.map +1 -1
  286. package/dist/src/components/layout/tabs/CwTabs.js +53 -0
  287. package/dist/src/dev/palette.d.ts +1 -1
  288. package/dist/src/dev/palette.d.ts.map +1 -1
  289. package/dist/src/index.d.ts +8 -12
  290. package/dist/src/index.d.ts.map +1 -1
  291. package/dist/src/index.js +187 -0
  292. package/dist/test/components/custom/new-scheduler/presentation/logic/getDefaultDivisions.test.js +48 -0
  293. package/dist/test/components/custom/new-scheduler/presentation/logic/hoursBetween.test.js +15 -0
  294. package/dist/test/components/custom/new-scheduler/presentation/logic/monthDivisions.test.js +42 -0
  295. package/dist/test/components/custom/new-scheduler/presentation/logic/weekendCalc.test.js +30 -0
  296. package/dist/test/components/custom/scheduler/addMinutesToDateFromPx.test.js +43 -0
  297. package/dist/test/components/custom/scheduler/checkIfSlotAvailable.test.js +30 -0
  298. package/dist/test/components/custom/scheduler/daysBetweenTwoDates.test.js +61 -0
  299. package/dist/test/components/custom/scheduler/daysBetweenTwoDatesWithoutCeilForEvent.test.js +27 -0
  300. package/dist/test/components/custom/scheduler/getGUID.test.js +30 -0
  301. package/dist/test/components/custom/scheduler/getPixelsForEvent.test.js +38 -0
  302. package/dist/test/components/custom/scheduler/getTimeHeaders.test.js +35 -0
  303. package/dist/test/components/custom/scheduler/hasSameProperties.test.js +51 -0
  304. package/dist/test/components/custom/scheduler/isAllowedToMove.test.js +28 -0
  305. package/dist/test/components/custom/scheduler/listOfDatesToWeeks.test.js +72 -0
  306. package/dist/test/jest.setup.js +1 -0
  307. package/package.json +11 -12
  308. package/dist/assets/asset-DnHaq7m- +0 -50
  309. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-full-normal.woff2 +0 -0
  310. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-grad-normal.woff2 +0 -0
  311. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-opsz-normal.woff2 +0 -0
  312. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-slnt-normal.woff2 +0 -0
  313. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-standard-normal.woff2 +0 -0
  314. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-wdth-normal.woff2 +0 -0
  315. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-wght-normal.woff2 +0 -0
  316. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-xopq-normal.woff2 +0 -0
  317. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-xtra-normal.woff2 +0 -0
  318. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-yopq-normal.woff2 +0 -0
  319. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-ytas-normal.woff2 +0 -0
  320. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-ytde-normal.woff2 +0 -0
  321. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-ytfi-normal.woff2 +0 -0
  322. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-ytlc-normal.woff2 +0 -0
  323. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ext-ytuc-normal.woff2 +0 -0
  324. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-full-normal.woff2 +0 -0
  325. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-grad-normal.woff2 +0 -0
  326. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-opsz-normal.woff2 +0 -0
  327. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-slnt-normal.woff2 +0 -0
  328. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-standard-normal.woff2 +0 -0
  329. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-wdth-normal.woff2 +0 -0
  330. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-wght-normal.woff2 +0 -0
  331. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-xopq-normal.woff2 +0 -0
  332. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-xtra-normal.woff2 +0 -0
  333. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-yopq-normal.woff2 +0 -0
  334. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ytas-normal.woff2 +0 -0
  335. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ytde-normal.woff2 +0 -0
  336. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ytfi-normal.woff2 +0 -0
  337. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ytlc-normal.woff2 +0 -0
  338. package/dist/content/fonts/roboto-flex/files/roboto-flex-cyrillic-ytuc-normal.woff2 +0 -0
  339. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-full-normal.woff2 +0 -0
  340. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-grad-normal.woff2 +0 -0
  341. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-opsz-normal.woff2 +0 -0
  342. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-slnt-normal.woff2 +0 -0
  343. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-standard-normal.woff2 +0 -0
  344. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-wdth-normal.woff2 +0 -0
  345. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-wght-normal.woff2 +0 -0
  346. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-xopq-normal.woff2 +0 -0
  347. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-xtra-normal.woff2 +0 -0
  348. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-yopq-normal.woff2 +0 -0
  349. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-ytas-normal.woff2 +0 -0
  350. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-ytde-normal.woff2 +0 -0
  351. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-ytfi-normal.woff2 +0 -0
  352. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-ytlc-normal.woff2 +0 -0
  353. package/dist/content/fonts/roboto-flex/files/roboto-flex-greek-ytuc-normal.woff2 +0 -0
  354. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-full-normal.woff2 +0 -0
  355. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-grad-normal.woff2 +0 -0
  356. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-opsz-normal.woff2 +0 -0
  357. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-slnt-normal.woff2 +0 -0
  358. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-standard-normal.woff2 +0 -0
  359. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-wdth-normal.woff2 +0 -0
  360. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-wght-normal.woff2 +0 -0
  361. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-xopq-normal.woff2 +0 -0
  362. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-xtra-normal.woff2 +0 -0
  363. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-yopq-normal.woff2 +0 -0
  364. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-ytas-normal.woff2 +0 -0
  365. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-ytde-normal.woff2 +0 -0
  366. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-ytfi-normal.woff2 +0 -0
  367. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-ytlc-normal.woff2 +0 -0
  368. package/dist/content/fonts/roboto-flex/files/roboto-flex-vietnamese-ytuc-normal.woff2 +0 -0
  369. package/dist/content/icons/cw-icons/css/cw-icons.css +0 -2784
  370. package/dist/content/icons/cw-icons/fonts/cwAvinodeFont/CblAvinodeIcon.eot +0 -0
  371. package/dist/content/icons/cw-icons/fonts/cwAvinodeFont/CblAvinodeIcon.svg +0 -11
  372. package/dist/content/icons/cw-icons/fonts/cwAvinodeFont/CblAvinodeIcon.ttf +0 -0
  373. package/dist/content/icons/cw-icons/fonts/cwAvinodeFont/CblAvinodeIcon.woff +0 -0
  374. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/CblCrewControl.eot +0 -0
  375. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/CblCrewControl.svg +0 -38
  376. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/CblCrewControl.ttf +0 -0
  377. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/CblCrewControl.woff +0 -0
  378. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/CblCrewControl.woff2 +0 -0
  379. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/Crew Control.eot +0 -0
  380. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/Crew Control.svg +0 -29
  381. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/Crew Control.ttf +0 -0
  382. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/Crew Control.woff +0 -0
  383. package/dist/content/icons/cw-icons/fonts/cwCrewControlFont/Crew Control.woff2 +0 -0
  384. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/CblCrewControlReact.eot +0 -0
  385. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/CblCrewControlReact.svg +0 -12
  386. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/CblCrewControlReact.ttf +0 -0
  387. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/CblCrewControlReact.woff +0 -0
  388. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/CblDutyIcon.eot +0 -0
  389. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/CblDutyIcon.svg +0 -11
  390. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/CblDutyIcon.ttf +0 -0
  391. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/CblDutyIcon.woff +0 -0
  392. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/SessionWarning.eot +0 -0
  393. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/SessionWarning.svg +0 -12
  394. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/SessionWarning.ttf +0 -0
  395. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/SessionWarning.woff +0 -0
  396. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblDuty.eot +0 -0
  397. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblDuty.svg +0 -26
  398. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblDuty.ttf +0 -0
  399. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblDuty.woff +0 -0
  400. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblDuty.woff2 +0 -0
  401. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrol.eot +0 -0
  402. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrol.svg +0 -13
  403. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrol.ttf +0 -0
  404. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrol.woff +0 -0
  405. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrolfont.eot +0 -0
  406. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrolfont.svg +0 -29
  407. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrolfont.ttf +0 -0
  408. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrolfont.woff +0 -0
  409. package/dist/content/icons/cw-icons/fonts/cwCrewControlNewIcon/cblcrewcontrolfont.woff2 +0 -0
  410. package/dist/content/icons/cw-icons/fonts/cwCrewFont/Crew.eot +0 -0
  411. package/dist/content/icons/cw-icons/fonts/cwCrewFont/Crew.svg +0 -29
  412. package/dist/content/icons/cw-icons/fonts/cwCrewFont/Crew.ttf +0 -0
  413. package/dist/content/icons/cw-icons/fonts/cwCrewFont/Crew.woff +0 -0
  414. package/dist/content/icons/cw-icons/fonts/cwCrewFont/Crew.woff2 +0 -0
  415. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/Crew Planning.eot +0 -0
  416. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/Crew Planning.svg +0 -17
  417. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/Crew Planning.ttf +0 -0
  418. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/Crew Planning.woff +0 -0
  419. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/Crew Planning.woff2 +0 -0
  420. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewPlanningFont.eot +0 -0
  421. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewPlanningFont.svg +0 -20
  422. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewPlanningFont.ttf +0 -0
  423. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewPlanningFont.woff +0 -0
  424. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewPlanningFont.woff2 +0 -0
  425. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewSchedulingFont.eot +0 -0
  426. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewSchedulingFont.svg +0 -12
  427. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewSchedulingFont.ttf +0 -0
  428. package/dist/content/icons/cw-icons/fonts/cwCrewPlanningFont/CrewSchedulingFont.woff +0 -0
  429. package/dist/content/icons/cw-icons/fonts/cwDispatchFont/Dispatch.eot +0 -0
  430. package/dist/content/icons/cw-icons/fonts/cwDispatchFont/Dispatch.svg +0 -20
  431. package/dist/content/icons/cw-icons/fonts/cwDispatchFont/Dispatch.ttf +0 -0
  432. package/dist/content/icons/cw-icons/fonts/cwDispatchFont/Dispatch.woff +0 -0
  433. package/dist/content/icons/cw-icons/fonts/cwDispatchFont/Dispatch.woff2 +0 -0
  434. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/ArchiveEmanual.eot +0 -0
  435. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/ArchiveEmanual.svg +0 -12
  436. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/ArchiveEmanual.ttf +0 -0
  437. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/ArchiveEmanual.woff +0 -0
  438. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/CblEmanualNewIcons.eot +0 -0
  439. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/CblEmanualNewIcons.svg +0 -14
  440. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/CblEmanualNewIcons.ttf +0 -0
  441. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/CblEmanualNewIcons.woff +0 -0
  442. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/Emanual.eot +0 -0
  443. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/Emanual.svg +0 -38
  444. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/Emanual.ttf +0 -0
  445. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/Emanual.woff +0 -0
  446. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/Emanual.woff2 +0 -0
  447. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualApprovedFile.eot +0 -0
  448. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualApprovedFile.svg +0 -11
  449. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualApprovedFile.ttf +0 -0
  450. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualApprovedFile.woff +0 -0
  451. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMark.eot +0 -0
  452. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMark.svg +0 -17
  453. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMark.ttf +0 -0
  454. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMark.woff +0 -0
  455. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMark.woff2 +0 -0
  456. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMarkLink.eot +0 -0
  457. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMarkLink.svg +0 -11
  458. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMarkLink.ttf +0 -0
  459. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualBookMarkLink.woff +0 -0
  460. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFolder.eot +0 -0
  461. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFolder.svg +0 -11
  462. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFolder.ttf +0 -0
  463. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFolder.woff +0 -0
  464. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFont.eot +0 -0
  465. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFont.svg +0 -13
  466. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFont.ttf +0 -0
  467. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFont.woff +0 -0
  468. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFontNew.eot +0 -0
  469. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFontNew.svg +0 -32
  470. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFontNew.ttf +0 -0
  471. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFontNew.woff +0 -0
  472. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualFontNew.woff2 +0 -0
  473. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPendingIcon.eot +0 -0
  474. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPendingIcon.svg +0 -11
  475. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPendingIcon.ttf +0 -0
  476. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPendingIcon.woff +0 -0
  477. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPublishFile.eot +0 -0
  478. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPublishFile.svg +0 -11
  479. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPublishFile.ttf +0 -0
  480. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPublishFile.woff +0 -0
  481. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPublishIconFile.eot +0 -0
  482. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPublishIconFile.svg +0 -11
  483. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPublishIconFile.ttf +0 -0
  484. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualPublishIconFile.woff +0 -0
  485. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualRestoreTrash.eot +0 -0
  486. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualRestoreTrash.svg +0 -11
  487. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualRestoreTrash.ttf +0 -0
  488. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualRestoreTrash.woff +0 -0
  489. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualRestoreTrashRight.eot +0 -0
  490. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualRestoreTrashRight.svg +0 -11
  491. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualRestoreTrashRight.ttf +0 -0
  492. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/EmanualRestoreTrashRight.woff +0 -0
  493. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/LibraryIcon.eot +0 -0
  494. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/LibraryIcon.svg +0 -12
  495. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/LibraryIcon.ttf +0 -0
  496. package/dist/content/icons/cw-icons/fonts/cwEmanualFont/LibraryIcon.woff +0 -0
  497. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/Favorites.eot +0 -0
  498. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/Favorites.svg +0 -158
  499. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/Favorites.ttf +0 -0
  500. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/Favorites.woff +0 -0
  501. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/Favorites.woff2 +0 -0
  502. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/cwellt_icon.eot +0 -0
  503. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/cwellt_icon.svg +0 -18
  504. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/cwellt_icon.ttf +0 -0
  505. package/dist/content/icons/cw-icons/fonts/cwFavoritesElement/cwellt_icon.woff +0 -0
  506. package/dist/content/icons/cw-icons/fonts/cwFavoritesFont/Favorites.eot +0 -0
  507. package/dist/content/icons/cw-icons/fonts/cwFavoritesFont/Favorites.svg +0 -62
  508. package/dist/content/icons/cw-icons/fonts/cwFavoritesFont/Favorites.ttf +0 -0
  509. package/dist/content/icons/cw-icons/fonts/cwFavoritesFont/Favorites.woff +0 -0
  510. package/dist/content/icons/cw-icons/fonts/cwFavoritesFont/Favorites.woff2 +0 -0
  511. package/dist/content/icons/cw-icons/fonts/cwFavoritesIcons/CblFavoritesIcons.eot +0 -0
  512. package/dist/content/icons/cw-icons/fonts/cwFavoritesIcons/CblFavoritesIcons.svg +0 -43
  513. package/dist/content/icons/cw-icons/fonts/cwFavoritesIcons/CblFavoritesIcons.ttf +0 -0
  514. package/dist/content/icons/cw-icons/fonts/cwFavoritesIcons/CblFavoritesIcons.woff +0 -0
  515. package/dist/content/icons/cw-icons/fonts/cwFgIconsFonts/CblFigIcons.eot +0 -0
  516. package/dist/content/icons/cw-icons/fonts/cwFgIconsFonts/CblFigIcons.svg +0 -49
  517. package/dist/content/icons/cw-icons/fonts/cwFgIconsFonts/CblFigIcons.ttf +0 -0
  518. package/dist/content/icons/cw-icons/fonts/cwFgIconsFonts/CblFigIcons.woff +0 -0
  519. package/dist/content/icons/cw-icons/fonts/cwFlightOpsFont/FlightOps.eot +0 -0
  520. package/dist/content/icons/cw-icons/fonts/cwFlightOpsFont/FlightOps.svg +0 -41
  521. package/dist/content/icons/cw-icons/fonts/cwFlightOpsFont/FlightOps.ttf +0 -0
  522. package/dist/content/icons/cw-icons/fonts/cwFlightOpsFont/FlightOps.woff +0 -0
  523. package/dist/content/icons/cw-icons/fonts/cwFlightOpsFont/FlightOps.woff2 +0 -0
  524. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/CblUndoIcon.eot +0 -0
  525. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/CblUndoIcon.svg +0 -11
  526. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/CblUndoIcon.ttf +0 -0
  527. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/CblUndoIcon.woff +0 -0
  528. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/FlightWatchOnTimeIcon.eot +0 -0
  529. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/FlightWatchOnTimeIcon.svg +0 -11
  530. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/FlightWatchOnTimeIcon.ttf +0 -0
  531. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/FlightWatchOnTimeIcon.woff +0 -0
  532. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/General.eot +0 -0
  533. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/General.svg +0 -41
  534. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/General.ttf +0 -0
  535. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/General.woff +0 -0
  536. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/General.woff2 +0 -0
  537. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/IDCardStatusIcon.eot +0 -0
  538. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/IDCardStatusIcon.svg +0 -12
  539. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/IDCardStatusIcon.ttf +0 -0
  540. package/dist/content/icons/cw-icons/fonts/cwGeneralFont/IDCardStatusIcon.woff +0 -0
  541. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/Favorites.eot +0 -0
  542. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/Favorites.svg +0 -17
  543. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/Favorites.ttf +0 -0
  544. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/Favorites.woff +0 -0
  545. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/Favorites.woff2 +0 -0
  546. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/calculator.eot +0 -0
  547. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/calculator.svg +0 -11
  548. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/calculator.ttf +0 -0
  549. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/calculator.woff +0 -0
  550. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/icons_cwellt.eot +0 -0
  551. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/icons_cwellt.svg +0 -11
  552. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/icons_cwellt.ttf +0 -0
  553. package/dist/content/icons/cw-icons/fonts/cwNewGeneralFontIcon/icons_cwellt.woff +0 -0
  554. package/dist/content/icons/cw-icons/fonts/cwOpstoolReactFont/opstoolReactIcons.eot +0 -0
  555. package/dist/content/icons/cw-icons/fonts/cwOpstoolReactFont/opstoolReactIcons.svg +0 -12
  556. package/dist/content/icons/cw-icons/fonts/cwOpstoolReactFont/opstoolReactIcons.ttf +0 -0
  557. package/dist/content/icons/cw-icons/fonts/cwOpstoolReactFont/opstoolReactIcons.woff +0 -0
  558. package/dist/content/icons/cw-icons/fonts/cwPaxRelationsFont/Pax Relations.eot +0 -0
  559. package/dist/content/icons/cw-icons/fonts/cwPaxRelationsFont/Pax Relations.svg +0 -17
  560. package/dist/content/icons/cw-icons/fonts/cwPaxRelationsFont/Pax Relations.ttf +0 -0
  561. package/dist/content/icons/cw-icons/fonts/cwPaxRelationsFont/Pax Relations.woff +0 -0
  562. package/dist/content/icons/cw-icons/fonts/cwPaxRelationsFont/Pax Relations.woff2 +0 -0
  563. package/dist/content/icons/cw-icons/fonts/cwSalesFont/Sales.eot +0 -0
  564. package/dist/content/icons/cw-icons/fonts/cwSalesFont/Sales.svg +0 -50
  565. package/dist/content/icons/cw-icons/fonts/cwSalesFont/Sales.ttf +0 -0
  566. package/dist/content/icons/cw-icons/fonts/cwSalesFont/Sales.woff +0 -0
  567. package/dist/content/icons/cw-icons/fonts/cwSalesFont/Sales.woff2 +0 -0
  568. package/dist/content/icons/cw-icons/fonts/cwTrainingFont/Training.eot +0 -0
  569. package/dist/content/icons/cw-icons/fonts/cwTrainingFont/Training.svg +0 -17
  570. package/dist/content/icons/cw-icons/fonts/cwTrainingFont/Training.ttf +0 -0
  571. package/dist/content/icons/cw-icons/fonts/cwTrainingFont/Training.woff +0 -0
  572. package/dist/content/icons/cw-icons/fonts/cwTrainingFont/Training.woff2 +0 -0
  573. package/dist/content/icons/font-awesome/webfonts/fa-brands-400.ttf +0 -0
  574. package/dist/content/icons/font-awesome/webfonts/fa-regular-400.ttf +0 -0
  575. package/dist/content/icons/font-awesome/webfonts/fa-solid-900.ttf +0 -0
  576. package/dist/content/icons/font-awesome/webfonts/fa-v4compatibility.ttf +0 -0
  577. package/dist/index.cjs.js.map +0 -1
  578. package/dist/index.css.map +0 -1
  579. package/dist/index.d.ts.map +0 -1
  580. package/dist/index.esm.js +0 -4836
  581. package/dist/src/common/functions/reactor.d.ts +0 -2
  582. package/dist/src/common/functions/reactor.d.ts.map +0 -1
  583. package/dist/src/components/control/input/chipper/CwChip.d.ts +0 -12
  584. package/dist/src/components/control/input/chipper/CwChip.d.ts.map +0 -1
  585. package/dist/src/components/custom/scheduler/components/ClearSchedulerButton.d.ts +0 -8
  586. package/dist/src/components/custom/scheduler/components/ClearSchedulerButton.d.ts.map +0 -1
  587. package/dist/src/components/custom/scheduler/logic/filtering/filterAndProcessResources.d.ts +0 -14
  588. package/dist/src/components/custom/scheduler/logic/filtering/filterAndProcessResources.d.ts.map +0 -1
  589. package/dist/src/components/custom/scheduler/logic/pixels/calculateMaxPxFromDateRange.d.ts +0 -2
  590. package/dist/src/components/custom/scheduler/logic/pixels/calculateMaxPxFromDateRange.d.ts.map +0 -1
  591. package/dist/src/components/custom/scheduler/logic/state_handle/handleDateChange.d.ts +0 -5
  592. package/dist/src/components/custom/scheduler/logic/state_handle/handleDateChange.d.ts.map +0 -1
  593. package/dist/src/components/custom/scheduler/logic/state_handle/handlePropChanges.d.ts +0 -5
  594. package/dist/src/components/custom/scheduler/logic/state_handle/handlePropChanges.d.ts.map +0 -1
  595. package/dist/src/components/custom/scheduler/logic/state_handle/onResizeEvent.d.ts +0 -3
  596. package/dist/src/components/custom/scheduler/logic/state_handle/onResizeEvent.d.ts.map +0 -1
  597. package/dist/src/components/custom/scheduler/logic/ui/getHasPropsChanged.d.ts +0 -3
  598. package/dist/src/components/custom/scheduler/logic/ui/getHasPropsChanged.d.ts.map +0 -1
  599. package/dist/src/components/custom/scheduler/logic/ui/shouldTriggerScroll.d.ts +0 -3
  600. package/dist/src/components/custom/scheduler/logic/ui/shouldTriggerScroll.d.ts.map +0 -1
  601. package/dist/src/components/custom/scheduler/state/EventProps.d.ts +0 -7
  602. package/dist/src/components/custom/scheduler/state/EventProps.d.ts.map +0 -1
  603. package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgrounEvent.d.ts +0 -1
  604. package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgrounEvent.d.ts.map +0 -1
  605. package/dist/src/components/custom/scheduler-new/presentation/components/row/cancellablePromise.d.ts +0 -7
  606. package/dist/src/components/custom/scheduler-new/presentation/components/row/cancellablePromise.d.ts.map +0 -1
  607. package/dist/src/components/custom/scheduler-new/presentation/components/row/useCancellablePromise.d.ts +0 -7
  608. package/dist/src/components/custom/scheduler-new/presentation/components/row/useCancellablePromise.d.ts.map +0 -1
  609. package/dist/src/components/custom/scheduler-new/presentation/logic/separateEventsByResource.d.ts +0 -5
  610. package/dist/src/components/custom/scheduler-new/presentation/logic/separateEventsByResource.d.ts.map +0 -1
  611. package/dist/src/components/custom/scheduler-new/presentation/state/external/Event.d.ts +0 -9
  612. package/dist/src/components/custom/scheduler-new/presentation/state/external/Event.d.ts.map +0 -1
  613. package/dist/src/components/custom/scheduler-new/presentation/state/external/Row.d.ts +0 -5
  614. package/dist/src/components/custom/scheduler-new/presentation/state/external/Row.d.ts.map +0 -1
  615. package/dist/src/components/custom/scheduler-new/presentation/state/ui/EventSideDragState.d.ts +0 -6
  616. package/dist/src/components/custom/scheduler-new/presentation/state/ui/EventSideDragState.d.ts.map +0 -1
  617. package/dist/src/components/custom/scheduler-new/presentation/state/ui/HeaderDivision.d.ts +0 -5
  618. package/dist/src/components/custom/scheduler-new/presentation/state/ui/HeaderDivision.d.ts.map +0 -1
  619. package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerEventState.d.ts +0 -14
  620. package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerEventState.d.ts.map +0 -1
  621. package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerHeaderState.d.ts +0 -11
  622. package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerHeaderState.d.ts.map +0 -1
  623. package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerRow.d.ts +0 -8
  624. package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerRow.d.ts.map +0 -1
  625. package/dist/test/components/custom/newScheduler/presentation/logic/getDefaultDivisions.test.d.ts.map +0 -1
  626. package/dist/test/components/custom/scheduler/calculateMaxPxFromDateRange.test.d.ts +0 -2
  627. package/dist/test/components/custom/scheduler/calculateMaxPxFromDateRange.test.d.ts.map +0 -1
  628. package/dist/test/components/custom/scheduler/filterEvents.test.d.ts.map +0 -1
  629. package/dist/test/components/custom/scheduler/shouldTriggerScroll.test.d.ts.map +0 -1
  630. package/dist/test/example.test.d.ts +0 -1
  631. package/dist/test/example.test.d.ts.map +0 -1
  632. /package/dist/src/{components/custom/scheduler-new/presentation/TestScheduler.d.ts → common/interfaces/CwSelectListProps.js} +0 -0
  633. /package/dist/{test/components/custom/newScheduler/presentation/logic/getDefaultDivisions.test.d.ts → src/components/custom/scheduler-new/presentation/components/header/SchedulerHeaderState.js} +0 -0
  634. /package/dist/{test/components/custom/newScheduler/presentation/logic/hoursBetween.test.d.ts → src/components/custom/scheduler-new/presentation/state/ui/SchedulerState.js} +0 -0
  635. /package/dist/{test/components/custom/newScheduler/presentation/logic/weekendCalc.test.d.ts → src/components/custom/scheduler-new/presentation/state/ui/WeekRange.js} +0 -0
  636. /package/dist/{test/components/custom/scheduler/filterEvents.test.d.ts → src/components/custom/scheduler-temporal/state/CwSchedulerProps.js} +0 -0
  637. /package/dist/{test/components/custom/scheduler/shouldTriggerScroll.test.d.ts → src/components/custom/scheduler-temporal/state/State.js} +0 -0
package/dist/index.cjs.js CHANGED
@@ -7,9 +7,12 @@ var reactDom = require('react-dom');
7
7
  var antd = require('antd');
8
8
  var Draggable = require('react-draggable');
9
9
  var moment = require('moment');
10
- var lodash = require('lodash');
10
+ var dateFns = require('date-fns');
11
+ var locale = require('date-fns/locale');
12
+ var reactDayPicker = require('react-day-picker');
13
+ require('react-day-picker/dist/style.css');
14
+ var lodashEs = require('lodash-es');
11
15
  var reactWindow = require('react-window');
12
- var ideToolbox = require('@react-buddy/ide-toolbox');
13
16
 
14
17
  function _interopNamespaceDefault(e) {
15
18
  var n = Object.create(null);
@@ -68,70 +71,16 @@ function CwHeadingSecond(props) {
68
71
  return (jsxRuntime.jsx("div", { className: "cw-heading", children: jsxRuntime.jsx("h3", { className: "cwHeading_desc", ...headingProps, children: children }) }));
69
72
  }
70
73
 
71
- /**
72
- * General purpose aligner flex container, useful for column or row view.
73
- * @remarks
74
- * ```txt
75
- * flexDirection="row" (default):
76
- *
77
- * <Row A> | - item 1 - item 2 - item 3 |
78
- * <Row B> | - item 1 - item 2 - item 3 |
79
- *
80
- * flexDirection="column":
81
- *
82
- * <Col A> <Col B>
83
- * | - item 1 | - item 1 |
84
- * | - item 2 | - item 2 |
85
- * | - item 3 | - item 3 |
86
- *
87
- * ```
88
- * @example
89
- * <CwAlign flexDirection="column">
90
- * <div>
91
- * <h2>ColumnA</h2>
92
- * </div>
93
- * <div>
94
- * <h2>ColumnB</h2>
95
- * </div>
96
- * </CwAlign>
97
- */
98
- function CwAlign(props) {
99
- const { alignContent, alignItems, alignSelf, bottom, display, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, cssHeight, justifyContent, left, margin, order, padding, position, right, top, cssWidth, gap, ...divProps } = props;
100
- return (jsxRuntime.jsx("div", { className: "cw-align", ...divProps, style: {
101
- alignContent: alignContent,
102
- alignItems: alignItems,
103
- alignSelf: alignSelf,
104
- bottom: bottom,
105
- display: display ?? "flex",
106
- flexBasis: flexBasis,
107
- flexDirection: flexDirection,
108
- flexGrow: flexGrow,
109
- flexShrink: flexShrink,
110
- flexWrap: flexWrap,
111
- height: cssHeight,
112
- justifyContent: justifyContent,
113
- left: left,
114
- margin: margin,
115
- order: order,
116
- padding: padding,
117
- position: position,
118
- right: right,
119
- top: top,
120
- width: cssWidth,
121
- gap: gap
122
- }, children: props.children }));
123
- }
124
-
125
74
  /**
126
75
  * Label for form controls.
127
76
  * @example
128
77
  * ```tsx
129
- * <CwLabelForm justify="right" >Username:</CwLabelForm>
78
+ * <CwLabel justify="right" >Username:</CwLabel>
130
79
  * ```
131
80
  */
132
81
  function CwLabel(props) {
133
- const { justify, text, labelHeight, labelWidth, alignProps, margin, ...labelProps } = props;
134
- return (jsxRuntime.jsx("span", { className: "cw-label", children: jsxRuntime.jsx(CwAlign, { ...alignProps, children: jsxRuntime.jsx("label", { style: { textAlign: justify, width: labelWidth, height: labelHeight, margin: margin ?? "1px 0 0 0" }, ...labelProps, children: labelProps.children ?? text }) }) }));
82
+ const { justify, text, labelHeight, labelWidth, margin, ...labelProps } = props;
83
+ return (jsxRuntime.jsx("label", { className: "cw-label", style: { textAlign: justify, width: labelWidth, height: labelHeight, margin: margin ?? "1px 0 0 0" }, ...labelProps, children: labelProps.children ?? text }));
135
84
  }
136
85
 
137
86
  function CwTooltip(CwelltTooltipProps) {
@@ -215,6 +164,11 @@ function getContrastColor(color) {
215
164
  return `hsl(${hsl.h}, ${contrastS}%, ${contrastL}%)`;
216
165
  }
217
166
 
167
+ const SVG_ICONS = {
168
+ 'sortable-asc': (jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 128 128", fill: "currentColor", children: [jsxRuntime.jsx("path", { d: "M93.1675 73.1739C94.5691 74.5758 94.7323 76.7924 93.5515 78.3846L93.1675 78.8326L63.6741 108.326L34.1755 78.8326C32.6908 77.3518 32.6014 74.9761 33.9708 73.3881C35.3401 71.8001 37.7033 71.5391 39.3861 72.7899L39.8341 73.1739L63.6741 97.0137L87.5088 73.1739C88.9104 71.7726 91.1274 71.6092 92.7194 72.7899L93.1674 73.1739H93.1675Z", opacity: "0.3" }), jsxRuntime.jsx("path", { d: "M34.1714 55.1518C32.7697 53.7499 32.6066 51.5333 33.7874 49.9411L34.1714 49.4931L63.6647 20L93.1634 49.4931C94.6481 50.9739 94.7375 53.3496 93.3681 54.9376C91.9987 56.5256 89.6356 56.7866 87.9527 55.5358L87.5047 55.1517L63.6647 31.312L39.8301 55.1518C38.4285 56.5531 36.2115 56.7165 34.6195 55.5358L34.1715 55.1518L34.1714 55.1518Z", opacity: "1" })] })),
169
+ 'sortable-desc': (jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 128 128", fill: "currentColor", children: [jsxRuntime.jsx("path", { d: "M93.1675 73.1739C94.5691 74.5758 94.7323 76.7924 93.5515 78.3846L93.1675 78.8326L63.6741 108.326L34.1755 78.8326C32.6908 77.3518 32.6014 74.9761 33.9708 73.3881C35.3401 71.8001 37.7033 71.5391 39.3861 72.7899L39.8341 73.1739L63.6741 97.0137L87.5088 73.1739C88.9104 71.7726 91.1274 71.6092 92.7194 72.7899L93.1674 73.1739H93.1675Z", opacity: "1" }), jsxRuntime.jsx("path", { d: "M34.1714 55.1518C32.7697 53.7499 32.6066 51.5333 33.7874 49.9411L34.1714 49.4931L63.6647 20L93.1634 49.4931C94.6481 50.9739 94.7375 53.3496 93.3681 54.9376C91.9987 56.5256 89.6356 56.7866 87.9527 55.5358L87.5047 55.1517L63.6647 31.312L39.8301 55.1518C38.4285 56.5531 36.2115 56.7165 34.6195 55.5358L34.1715 55.1518L34.1714 55.1518Z", opacity: "0.3" })] })),
170
+ };
171
+
218
172
  /**
219
173
  * Icon component that supports both FontAwesome 4 and cwellt icon font
220
174
  * @example
@@ -230,6 +184,12 @@ function CwIcon(props) {
230
184
  size && `cw-font-size-${size}`
231
185
  ].filter(Boolean).join(' ');
232
186
  };
187
+ // Check if it's a special SVG icon
188
+ if (iconId in SVG_ICONS) {
189
+ const svgElement = SVG_ICONS[iconId];
190
+ const className = getClassName('cw-icon-svg');
191
+ return React.cloneElement(svgElement, { className });
192
+ }
233
193
  // Return appropriate icon based on source
234
194
  if (source === 'fontawesome') {
235
195
  return jsxRuntime.jsx("span", { ...iconProps, className: getClassName(`fa fa-${iconId}`) });
@@ -256,25 +216,15 @@ const CwChip = ({ label, colorScheme = 'info', customColor, variant = 'soft', cl
256
216
  // Calculate styles based on colorScheme, customColor and variant
257
217
  const chipStyle = React.useMemo(() => {
258
218
  if (customColor) {
259
- if (variant === 'outline') {
260
- // For outline, customColor is used for border and text
261
- return {
262
- color: customColor,
263
- borderColor: customColor,
264
- ...style
265
- };
266
- }
267
- else {
268
- // For soft/solid, customColor is used for background and we calculate contrast
269
- return {
270
- backgroundColor: customColor,
271
- color: getContrastColor(customColor),
272
- ...style
273
- };
274
- }
219
+ // Simply set the CSS custom properties, CSS handles the rest
220
+ return {
221
+ '--chip-accent': customColor,
222
+ '--chip-text': getContrastColor(customColor),
223
+ ...style
224
+ };
275
225
  }
276
226
  return style;
277
- }, [colorScheme, customColor, variant, style]);
227
+ }, [customColor, style]);
278
228
  // Handle click on close icon
279
229
  const handleClose = (e) => {
280
230
  e.stopPropagation();
@@ -288,29 +238,9 @@ const CwChip = ({ label, colorScheme = 'info', customColor, variant = 'soft', cl
288
238
  className,
289
239
  closable ? 'cw-chip-closable' : '',
290
240
  ].filter(Boolean).join(' ');
291
- return (jsxRuntime.jsxs("span", { className: chipClassNames, "data-color-scheme": colorScheme, "data-variant": variant, style: chipStyle, children: [icon && jsxRuntime.jsx(CwIcon, { iconId: icon }), label, closable && (jsxRuntime.jsx("button", { className: "cw-chip-close-button", onClick: handleClose, "aria-label": "Remove", type: "button", children: jsxRuntime.jsx("span", { className: "cwi-icons cwi-close" }) }))] }));
241
+ return (jsxRuntime.jsxs("span", { className: chipClassNames, "data-color-scheme": colorScheme, "data-variant": variant, style: chipStyle, children: [icon && jsxRuntime.jsx(CwIcon, { iconId: icon }), jsxRuntime.jsx("span", { children: label }), closable && (jsxRuntime.jsx("button", { className: "cw-chip-close-button", onClick: handleClose, "aria-label": "Remove", type: "button", children: jsxRuntime.jsx("span", { className: "cwi-icons cwi-close" }) }))] }));
292
242
  };
293
243
 
294
- function CwTag(tagProps) {
295
- const hideTag = (event_clickTag) => {
296
- const tag = event_clickTag.currentTarget.parentElement;
297
- tag?.classList.add("tag-hidden");
298
- };
299
- const onClickClosableCustomTag = (event_clickClosableT) => {
300
- hideTag(event_clickClosableT);
301
- if (tagProps.onClickClosableTag != undefined) {
302
- tagProps.onClickClosableTag(event_clickClosableT);
303
- }
304
- };
305
- const onClickCustomTag = (event_clickTag) => {
306
- // click option interface
307
- if (tagProps.onClickTag !== undefined) {
308
- tagProps.onClickTag(event_clickTag);
309
- }
310
- };
311
- return (jsxRuntime.jsxs("div", { className: "cw-tag", style: tagProps.styleTag, onClick: event_clickTag => onClickCustomTag(event_clickTag), id: tagProps.idTag, ref: tagProps.ref, children: [jsxRuntime.jsx("strong", { style: tagProps.styleTag_description, children: tagProps.children }), tagProps.closableTag && (jsxRuntime.jsx(CwIcon, { iconId: "close", onClick: event_clickClosableT => onClickClosableCustomTag(event_clickClosableT) }))] }));
312
- }
313
-
314
244
  const CW_DEFAULT_MESSAGE_DURATION = 2000;
315
245
  exports.CwMessageType = void 0;
316
246
  (function (CwMessageType) {
@@ -709,7 +639,7 @@ function CwLoadingSmall(CwelltLoadingAppointements) {
709
639
  jsxRuntime.jsx("div", {})) }));
710
640
  }
711
641
 
712
- var styles$j = {"cw-generic-tooltip-content":"cw-generic-tooltip-module_cw-generic-tooltip-content__la-Si"};
642
+ var styles$k = {"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"};
713
643
 
714
644
  // Constants moved outside to prevent recreation
715
645
  const margin = 16;
@@ -814,18 +744,18 @@ const useTooltipPosition = (isVisible, containerRef, preferredPosition, tooltipC
814
744
  return tooltipState;
815
745
  };
816
746
  // Main component with optimizations
817
- const CwGenericTooltip = ({ children, content = null, position = defaultPosition, dissapearsWhenHover = false, hide = false, overlayStyle = {}, showDelay = 0, }) => {
747
+ const CwGenericTooltip = ({ children, content = null, position = defaultPosition, dissapearsWhenHover = false, hide = false, overlayStyle = {}, showDelay = 0, displayInline = false, }) => {
818
748
  const [isVisible, setIsVisible] = React.useState(false);
819
749
  const containerRef = React.useRef(null);
820
750
  const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
821
751
  setIsVisible(true);
822
752
  }, showDelay);
823
- const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$j["cw-generic-tooltip-content"]);
753
+ const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$k["cw-generic-tooltip-content"]);
824
754
  // Memoize tooltip content creation
825
755
  const tooltipContent = React.useMemo(() => {
826
756
  if (hide || !isVisible || !content)
827
757
  return null;
828
- return reactDom.createPortal(jsxRuntime.jsx("div", { className: styles$j["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, style: {
758
+ return reactDom.createPortal(jsxRuntime.jsx("div", { className: styles$k["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, "data-inline": displayInline, style: {
829
759
  position: 'fixed',
830
760
  top: `${tooltipPosition.top}px`,
831
761
  left: `${tooltipPosition.left}px`,
@@ -840,10 +770,14 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
840
770
  clearTooltipTimeout();
841
771
  setIsVisible(false);
842
772
  }, [clearTooltipTimeout]);
843
- return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$j["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, children: [tooltipContent, children] }));
773
+ return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$k["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, children: [tooltipContent, children] }));
844
774
  };
845
775
 
846
776
  // Reference for draggable modal
777
+ /**
778
+ * **Note:** For new development, we recommend using {@link CwDialog} instead. CwModal remains supported for existing code.
779
+ * @see {@link CwDialog}
780
+ */
847
781
  function CwModal(custModalProps) {
848
782
  const draggableRef = React.useRef(null);
849
783
  // Hooks [ modal draggable ]
@@ -877,13 +811,13 @@ function CwModal(custModalProps) {
877
811
  };
878
812
  return (jsxRuntime.jsx("div", { children: custModalProps.modalState && (jsxRuntime.jsxs("div", { className: custModalProps.classNameModalOverlay + " cwelltModalOverlay", children: [jsxRuntime.jsx("div", { className: "cwelltModalOverlayBg", onClick: custModalProps.onCloseModal }), jsxRuntime.jsx(Draggable, { disabled: isModalDisabled, axis: "both", nodeRef: draggableRef, children: jsxRuntime.jsxs("div", { className: custModalProps.classNameModal + " cwelltContainerModal", ref: draggableRef, style: widthModalDef !== "40em" ? modalStyle.widthCustomStyle : modalStyle.widthDefStyle, children: [jsxRuntime.jsxs("div", { className: "cwelltModalHeader", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsxRuntime.jsx("div", { className: "cwelltModalTitle", children: custModalProps.titleModal }), jsxRuntime.jsx("button", { className: "cwelltBtnCloseModal", onClick: custModalProps.onCloseModal, children: jsxRuntime.jsx("span", { className: "cwelltCloseIcon" }) })] }), jsxRuntime.jsx("div", { className: "cwelltModalBody", children: jsxRuntime.jsx("div", { className: "cwelltContainerModalBody", style: { position: "relative" }, children: custModalProps.children }) }), isHide === false ? (
879
813
  // [ false : show modal ]
880
- jsxRuntime.jsxs("div", { className: "cwelltModalFooter", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsxRuntime.jsx(antd.Tooltip, { placement: "bottom", title: "Save", color: "#368ee0", children: jsxRuntime.jsx("div", { className: "cwellt_flex cwellt_justify_center cwelltModalFooterContButton", style: { width: "2em" }, children: jsxRuntime.jsx("button", { className: "btnModalFooterAction cwellt_btn_act cwellt_btn_act_df cwellt_btn_Nbg cwellt_btn_save ", onClick: custModalProps.onSaveModal, form: custModalProps.formSaveModal, hidden: custModalProps.HideBtnModal, type: custModalProps.HtmlSubmitModal }) }) }), isShowcustButton === true ? (jsxRuntime.jsx(antd.Tooltip, { placement: "bottom", title: custModalProps.custButtonTitle, color: custModalProps.custColorButtonTooltip, children: jsxRuntime.jsx("div", { className: "cwellt_flex cwellt_justify_center cwelltModalFooterContButton", style: { width: "2em" }, children: jsxRuntime.jsx("button", { className: "btnModalFooterAction cwellt_btn_act cwellt_btn_act_df cwellt_btn_Nbg " +
814
+ jsxRuntime.jsxs("div", { className: "cwelltModalFooter", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsxRuntime.jsx(antd.Tooltip, { placement: "bottom", title: "Save", color: "#368ee0", children: jsxRuntime.jsx("div", { className: "cwellt_flex cwellt_justify_center ", style: { width: "2em" }, children: jsxRuntime.jsx("button", { className: "cw-button-icon cwi-save", onClick: custModalProps.onSaveModal, form: custModalProps.formSaveModal, hidden: custModalProps.HideBtnModal, type: custModalProps.HtmlSubmitModal }) }) }), isShowcustButton === true ? (jsxRuntime.jsx(antd.Tooltip, { placement: "bottom", title: custModalProps.custButtonTitle, color: custModalProps.custColorButtonTooltip, children: jsxRuntime.jsx("div", { className: "cwellt_flex cwellt_justify_center", style: { width: "2em" }, children: jsxRuntime.jsx("button", { className: "cw-button-icon " +
881
815
  custModalProps.custButtonClassName, onClick: custModalProps.custButtonClick }) }) })) : (jsxRuntime.jsx("div", {}))] })) : (
882
816
  // true [ do not show the modal ]
883
817
  jsxRuntime.jsx("div", { style: { display: "none" } }))] }) })] })) }));
884
818
  }
885
819
 
886
- var styles$i = {"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"};
820
+ var styles$j = {"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"};
887
821
 
888
822
  function CwConfirmationPopup(props) {
889
823
  const { isOpen, onConfirm, onCancel, message = "Are you sure you want to proceed?", confirmText = "Confirm", cancelText = "Cancel", placement = 'bottom', children } = props;
@@ -947,91 +881,30 @@ function CwConfirmationPopup(props) {
947
881
  onCancel();
948
882
  }
949
883
  };
950
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderChildren(), isOpen && (jsxRuntime.jsx("div", { className: styles$i.overlayPositioned, onClick: handleOverlayClick, children: jsxRuntime.jsxs("div", { ref: popupRef, className: styles$i.popup, style: {
884
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderChildren(), isOpen && (jsxRuntime.jsx("div", { className: styles$j.overlayPositioned, onClick: handleOverlayClick, children: jsxRuntime.jsxs("div", { ref: popupRef, className: styles$j.popup, style: {
951
885
  position: 'absolute',
952
886
  top: `${position.top}px`,
953
887
  left: `${position.left}px`,
954
888
  transform: 'none'
955
- }, children: [jsxRuntime.jsx("p", { className: styles$i.message, children: message }), jsxRuntime.jsxs("div", { className: styles$i.buttons, children: [jsxRuntime.jsx("button", { className: `${styles$i.button} ${styles$i.confirmButton}`, onClick: onConfirm, children: confirmText }), jsxRuntime.jsx("button", { className: `${styles$i.button} ${styles$i.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
956
- }
957
-
958
- // Reference for draggable modal
959
- const draggableRef = React.createRef();
960
- function CwModalConfirm(custModalProps) {
961
- const classNameOverlay = custModalProps.classNameModalOverlay !== null || custModalProps.classNameModalOverlay !== undefined
962
- ? ""
963
- : custModalProps.classNameModalOverlay;
964
- // Default size of modal
965
- const widthModalDef = custModalProps.widthModalConfirm !== null && custModalProps.widthModalConfirm !== undefined
966
- ? custModalProps.widthModalConfirm
967
- : "17em";
968
- const modalStyle = {
969
- // width default
970
- widthDefStyle: {
971
- width: "17em"
972
- },
973
- // width customizable
974
- widthCustomStyle: {
975
- width: custModalProps.widthModalConfirm
976
- }
977
- };
978
- // Hooks [ modal draggable ]
979
- const [ismodalDisabled, setModalDisabled] = React.useState(true);
980
- // [ onMouseOver ]
981
- const cwelltOnMouseOverModal = () => {
982
- setModalDisabled(false);
983
- };
984
- // [ OnMouseOut ]
985
- const cwelltOnMouseOutModal = () => {
986
- setModalDisabled(true);
987
- // finding parent element
988
- };
989
- return (jsxRuntime.jsx("div", { children: custModalProps.modalStateConfirm && (jsxRuntime.jsx("div", { className: classNameOverlay !== undefined ? custModalProps.classNameModalOverlay + " cwelltModalOverlay" : "", children: jsxRuntime.jsx(Draggable, { disabled: ismodalDisabled, children: jsxRuntime.jsxs("div", { className: " cwelltContainerModal", ref: draggableRef, style: widthModalDef !== "17em" ? modalStyle.widthCustomStyle : modalStyle.widthDefStyle, children: [jsxRuntime.jsxs("div", { className: "cwelltModalHeader", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsxRuntime.jsx("div", { className: "cwelltModalTitle", children: custModalProps.headerTextConfirm }), jsxRuntime.jsx("button", { className: "cwelltBtnCloseModal", onClick: custModalProps.onCloseModalConfirm, children: jsxRuntime.jsx("span", { className: "cwelltCloseIcon" }) })] }), jsxRuntime.jsx("div", { className: "cwelltModalBody", children: jsxRuntime.jsxs("div", { className: "cwelltContainerModalBody", children: [jsxRuntime.jsx("div", { className: "cwellt_content_r_df_align", children: jsxRuntime.jsx("label", { className: "cwellt_modalConfirmDesc", children: custModalProps.descriptionModalConfirm }) }), jsxRuntime.jsx("div", { style: { display: "none" }, children: custModalProps.children })] }) }), jsxRuntime.jsx("div", { className: "cwelltModalFooter", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: jsxRuntime.jsx(antd.Tooltip, { placement: "bottom", title: custModalProps.confirmText, color: "#368ee0", children: jsxRuntime.jsx("div", { className: "cwellt_flex cwellt_justify_center", style: { width: "2em" }, children: jsxRuntime.jsx("button", { className: "btnModalFooterAction cwellt_btn_act cwellt_btn_act_df cwellt_btn_Nbg " +
990
- custModalProps.confirmClassName, onClick: custModalProps.onClickActionModalConfirm }) }) }) })] }) }) })) }));
889
+ }, children: [jsxRuntime.jsx("p", { className: styles$j.message, children: message }), jsxRuntime.jsxs("div", { className: styles$j.buttons, children: [jsxRuntime.jsx("button", { className: `${styles$j.button} ${styles$j.confirmButton}`, onClick: onConfirm, children: confirmText }), jsxRuntime.jsx("button", { className: `${styles$j.button} ${styles$j.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
991
890
  }
992
891
 
993
- class CwModalIframe extends React__namespace.Component {
994
- constructor(Props) {
995
- super(Props);
996
- this.state = {
997
- disabled: true
998
- };
892
+ function CwButton({ text, variant = 'solid', color = 'primary', className = '', icon = "", title, tooltipPosition = "bottom", children, ...buttonProps }) {
893
+ // Build CSS classes based on variant and props
894
+ let buttonClass = `cw-button-${variant}`;
895
+ // Add icon class only for icon variant without children
896
+ if (variant === 'icon' && icon && !children) {
897
+ buttonClass += ` cwi-${icon}`;
999
898
  }
1000
- // For draggable modal
1001
- draggableRef = React__namespace.createRef();
1002
- handleCancel = () => {
1003
- this.props.SET_IFRAME_VISIBLE(false);
1004
- };
1005
- render() {
1006
- const { disabled } = this.state;
1007
- return (jsxRuntime.jsx(antd.Modal
1008
- // title={this.props.title}
1009
- , {
1010
- // title={this.props.title}
1011
- title: jsxRuntime.jsx("div", { style: {
1012
- width: "100%",
1013
- cursor: "move"
1014
- }, onMouseOver: () => {
1015
- if (this.state.disabled) {
1016
- this.setState({
1017
- disabled: false
1018
- });
1019
- }
1020
- }, onMouseOut: () => {
1021
- this.setState({
1022
- disabled: true
1023
- });
1024
- }, children: this.props.title }), visible: this.props.visible, width: this.props.width, footer: null, bodyStyle: {
1025
- padding: 0,
1026
- width: this.props.width + "px",
1027
- height: this.props.height + "px"
1028
- }, onCancel: () => {
1029
- this.handleCancel();
1030
- }, destroyOnClose: true, modalRender: modal => (jsxRuntime.jsx(Draggable, { disabled: disabled, children: jsxRuntime.jsxs("div", { ref: this.draggableRef, children: [" ", modal] }) })), children: jsxRuntime.jsx("div", { className: "videoWrapper", children: jsxRuntime.jsx("iframe", { id: "iframeAspx", title: this.props.title, src: this.props.cblConfig + "/SSO/SSORedirect?url=" + encodeURIComponent(this.props.url) }) }) }));
899
+ if (className) {
900
+ buttonClass += ` ${className}`;
1031
901
  }
902
+ const tooltipContent = title || (variant === 'icon' && text ? text : undefined);
903
+ const buttonElement = (jsxRuntime.jsx("button", { type: "button", className: buttonClass, ...buttonProps, "data-color": color, "aria-label": tooltipContent, children: variant === 'icon' ? null : (children ?? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon && jsxRuntime.jsx(CwIcon, { iconId: icon }), text && jsxRuntime.jsx("strong", { children: text })] }))) }));
904
+ return tooltipContent ? (jsxRuntime.jsx(CwGenericTooltip, { content: tooltipContent, position: tooltipPosition, displayInline: true, children: buttonElement })) : (buttonElement);
1032
905
  }
1033
906
 
1034
- var styles$h = {"cw-dialog-main":"cw-dialog-module_cw-dialog-main__cHxHt","cw-dialog-button-close":"cw-dialog-module_cw-dialog-button-close__9GRd8"};
907
+ var styles$i = {"cw-dialog-main":"cw-dialog-module_cw-dialog-main__cHxHt","cw-dialog-button-close":"cw-dialog-module_cw-dialog-button-close__9GRd8"};
1035
908
 
1036
909
  // Helper function to parse size values
1037
910
  const parseSize = (size) => {
@@ -1072,6 +945,8 @@ const convertFromPx = (px, unit) => {
1072
945
  const CwDialog = props => {
1073
946
  const { customFooter, customHeader, headline, width, height, dialogSize, scrim, onSave, onClose, hideFooter, children, open, autoReposition = false, ...domProps } = props;
1074
947
  const dialogRef = React.useRef(null);
948
+ const [isPressingScrim, setIsPressingScrim] = React.useState(false);
949
+ const pressTimerRef = React.useRef(0);
1075
950
  const initialSetup = React.useMemo(() => {
1076
951
  // Default width and height with units
1077
952
  const defaultWidth = 800;
@@ -1242,14 +1117,34 @@ const CwDialog = props => {
1242
1117
  e.stopPropagation();
1243
1118
  setResizeDirection(direction);
1244
1119
  }, []);
1245
- const handleScrimClick = React.useCallback((e) => {
1246
- if (e.target === e.currentTarget && onClose) {
1247
- onClose();
1248
- }
1120
+ // Click on scrim
1121
+ const handleScrimMouseDown = React.useCallback((e) => {
1122
+ if (e.target !== e.currentTarget)
1123
+ return;
1124
+ setIsPressingScrim(true);
1125
+ pressTimerRef.current = window.setTimeout(() => {
1126
+ if (onClose) {
1127
+ onClose();
1128
+ }
1129
+ }, 500);
1249
1130
  }, [onClose]);
1250
- const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$h["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
1131
+ const handleScrimMouseUpOrLeave = React.useCallback(() => {
1132
+ if (pressTimerRef.current) {
1133
+ window.clearTimeout(pressTimerRef.current);
1134
+ }
1135
+ setIsPressingScrim(false);
1136
+ }, []);
1137
+ React.useEffect(() => {
1138
+ if (!open) {
1139
+ setIsPressingScrim(false);
1140
+ if (pressTimerRef.current) {
1141
+ window.clearTimeout(pressTimerRef.current);
1142
+ }
1143
+ }
1144
+ }, [open]);
1145
+ const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$i["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
1251
1146
  const content = React.useMemo(() => (jsxRuntime.jsx("section", { children: children })), [children]);
1252
- const footer = React.useMemo(() => (jsxRuntime.jsx("footer", { children: customFooter || (jsxRuntime.jsx("button", { className: "cw-button-icon cwi-save", onClick: onSave })) })), [customFooter, onSave]);
1147
+ const footer = React.useMemo(() => (jsxRuntime.jsx("footer", { children: customFooter || (jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: onSave, tooltipPosition: "top" })) })), [customFooter, onSave]);
1253
1148
  const resizeHandles = React.useMemo(() => size.autoHeight
1254
1149
  ? [
1255
1150
  // Only horizontal handles if autoHeight is true
@@ -1276,7 +1171,7 @@ const CwDialog = props => {
1276
1171
  : `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
1277
1172
  return { displayWidth, displayHeight };
1278
1173
  }, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
1279
- const dialogContent = (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$h["cw-dialog-main"], onClick: handleScrimClick, children: jsxRuntime.jsxs("dialog", { ...domProps, ref: dialogRef, style: {
1174
+ const dialogContent = (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$i["cw-dialog-main"], onMouseDown: handleScrimMouseDown, onMouseUp: handleScrimMouseUpOrLeave, onMouseLeave: handleScrimMouseUpOrLeave, "data-pressing": isPressingScrim, children: jsxRuntime.jsxs("dialog", { ...domProps, ref: dialogRef, style: {
1280
1175
  left: `${position.x}px`,
1281
1176
  top: `${position.y}px`,
1282
1177
  width: displayDimensions.displayWidth,
@@ -1303,7 +1198,7 @@ const CwModalReportFunctional = (props) => {
1303
1198
  return (jsxRuntime.jsxs("div", { children: ["Please add a(n) ", props.reportName, " report in ", props.moduleSettings, " Settings"] }));
1304
1199
  }
1305
1200
  };
1306
- return (jsxRuntime.jsx("div", { id: "cwelltModalReportContent", children: isModal ? (jsxRuntime.jsx(CwDialog, { open: props.visible, width: props.width, height: props.height, headline: props.title, onClose: props.onCloseModal, hideFooter: true, children: renderContentModal() })) : (jsxRuntime.jsx("div", { children: renderContentNotModal() })) }));
1201
+ return (jsxRuntime.jsx("div", { id: "modal-report-content", children: isModal ? (jsxRuntime.jsx(CwDialog, { open: props.visible, width: props.width, height: props.height, headline: props.title, onClose: props.onCloseModal, hideFooter: true, className: "modal-report-content", children: renderContentModal() })) : (jsxRuntime.jsx("div", { children: renderContentNotModal() })) }));
1307
1202
  };
1308
1203
 
1309
1204
  class CwReportModal extends React__namespace.Component {
@@ -1323,10 +1218,10 @@ class CwReportModal extends React__namespace.Component {
1323
1218
  };
1324
1219
  }
1325
1220
  render() {
1326
- return (jsxRuntime.jsx("div", { id: "cwelltModalReportContent", children: this.state.isModal === true ? (jsxRuntime.jsxs(CwDialog, { open: this.props.visible, width: this.props.width, headline: this.props.title, customFooter: new Array(jsxRuntime.jsx("div", {})), onClose: () => {
1221
+ return (jsxRuntime.jsx("div", { id: "modal-report-content", children: this.state.isModal === true ? (jsxRuntime.jsxs(CwDialog, { open: this.props.visible, width: this.props.width, height: this.props.height, headline: this.props.title, onClose: () => {
1327
1222
  this.formRef?.current?.resetFields();
1328
1223
  this.props.SET_MODAL_REPORT_VISIBLE(false);
1329
- }, hideFooter: true, children: [this.props.name !== "Empty.pdf" && (jsxRuntime.jsx("div", { style: { width: "100%", height: "100%", overflowX: "auto", overflowY: "auto" }, children: jsxRuntime.jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", style: { width: "100%", height: "100%", display: "block" } }) })), this.props.name === "Empty.pdf" && (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("h1", { style: { marginLeft: "2em" }, children: [" ", "Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }) }))] })) : (jsxRuntime.jsxs("div", { children: [this.props.name !== "Empty.pdf" && (jsxRuntime.jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", width: "100%", height: "600px" })), this.props.name === "Empty.pdf" && (jsxRuntime.jsxs("div", { children: ["Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }))] })) }));
1224
+ }, hideFooter: true, className: "modal-report-content", children: [this.props.name !== "Empty.pdf" && (jsxRuntime.jsx("div", { style: { width: "100%", height: "100%", overflowX: "auto", overflowY: "auto" }, children: jsxRuntime.jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", style: { width: "100%", height: "100%", display: "block" } }) })), this.props.name === "Empty.pdf" && (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("h1", { style: { marginLeft: "2em" }, children: [" ", "Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }) }))] })) : (jsxRuntime.jsxs("div", { children: [this.props.name !== "Empty.pdf" && (jsxRuntime.jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", width: "100%", height: "800px" })), this.props.name === "Empty.pdf" && (jsxRuntime.jsxs("div", { children: ["Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }))] })) }));
1330
1225
  }
1331
1226
  }
1332
1227
 
@@ -1427,20 +1322,61 @@ class CwDialogManager {
1427
1322
  }
1428
1323
  }
1429
1324
 
1430
- function CwButton({ text, variant = 'solid', color = 'primary', className = '', icon = "", children, ...buttonProps }) {
1431
- // Build CSS classes based on variant and props
1432
- let buttonClass = `cw-button-${variant}`;
1433
- // Add icon class only for icon variant without children
1434
- if (variant === 'icon' && icon && !children) {
1435
- buttonClass += ` cwi-${icon}`;
1436
- }
1437
- if (className) {
1438
- buttonClass += ` ${className}`;
1439
- }
1440
- return (jsxRuntime.jsx("button", { type: "button", className: buttonClass, ...buttonProps, "data-color": color, children: variant === 'icon' ? null : (children ?? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon && jsxRuntime.jsx("span", { className: `cwi-icons cwi-${icon}` }), text && jsxRuntime.jsx("strong", { children: text })] }))) }));
1325
+ /**
1326
+ * General purpose aligner flex container, useful for column or row view.
1327
+ * @remarks
1328
+ * ```txt
1329
+ * flexDirection="row" (default):
1330
+ *
1331
+ * <Row A> | - item 1 - item 2 - item 3 |
1332
+ * <Row B> | - item 1 - item 2 - item 3 |
1333
+ *
1334
+ * flexDirection="column":
1335
+ *
1336
+ * <Col A> <Col B>
1337
+ * | - item 1 | - item 1 |
1338
+ * | - item 2 | - item 2 |
1339
+ * | - item 3 | - item 3 |
1340
+ *
1341
+ * ```
1342
+ * @example
1343
+ * <CwAlign flexDirection="column">
1344
+ * <div>
1345
+ * <h2>ColumnA</h2>
1346
+ * </div>
1347
+ * <div>
1348
+ * <h2>ColumnB</h2>
1349
+ * </div>
1350
+ * </CwAlign>
1351
+ */
1352
+ function CwAlign(props) {
1353
+ const { alignContent, alignItems, alignSelf, bottom, display, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, cssHeight, justifyContent, left, margin, order, padding, position, right, top, cssWidth, gap, ...divProps } = props;
1354
+ return (jsxRuntime.jsx("div", { className: "cw-align", ...divProps, style: {
1355
+ alignContent: alignContent,
1356
+ alignItems: alignItems,
1357
+ alignSelf: alignSelf,
1358
+ bottom: bottom,
1359
+ display: display ?? "flex",
1360
+ flexBasis: flexBasis,
1361
+ flexDirection: flexDirection,
1362
+ flexGrow: flexGrow,
1363
+ flexShrink: flexShrink,
1364
+ flexWrap: flexWrap,
1365
+ height: cssHeight,
1366
+ justifyContent: justifyContent,
1367
+ left: left,
1368
+ margin: margin,
1369
+ order: order,
1370
+ padding: padding,
1371
+ position: position,
1372
+ right: right,
1373
+ top: top,
1374
+ width: cssWidth,
1375
+ gap: gap
1376
+ }, children: props.children }));
1441
1377
  }
1442
1378
 
1443
- var styles$g = {"card":"cw-card-module_card__HJUT0","clickable":"cw-card-module_clickable__Y-V3X","disabled":"cw-card-module_disabled__0wHh1","loading":"cw-card-module_loading__-fzlx","content":"cw-card-module_content__ma9qy","headerContent":"cw-card-module_headerContent__x4Jfl","footerTags":"cw-card-module_footerTags__80sSW","loadingOverlay":"cw-card-module_loadingOverlay__8-zVV"};
1379
+ var styles$h = {"card":"cw-card-module_card__HJUT0","clickable":"cw-card-module_clickable__Y-V3X","disabled":"cw-card-module_disabled__0wHh1","loading":"cw-card-module_loading__-fzlx","content":"cw-card-module_content__ma9qy","headerContent":"cw-card-module_headerContent__x4Jfl","footerTags":"cw-card-module_footerTags__80sSW","loadingOverlay":"cw-card-module_loadingOverlay__8-zVV"};
1444
1380
 
1445
1381
  /**
1446
1382
  * CwCard - A simple card component for displaying content in a contained format
@@ -1464,11 +1400,11 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
1464
1400
  // Construct class names using CSS modules
1465
1401
  const cardClassNames = [
1466
1402
  'cw-card',
1467
- styles$g.card,
1403
+ styles$h.card,
1468
1404
  className,
1469
- clickable ? styles$g.clickable : '',
1470
- disabled ? styles$g.disabled : '',
1471
- isLoading ? styles$g.loading : '',
1405
+ clickable ? styles$h.clickable : '',
1406
+ disabled ? styles$h.disabled : '',
1407
+ isLoading ? styles$h.loading : '',
1472
1408
  ].filter(Boolean).join(' ');
1473
1409
  // Handle click event when card is clickable
1474
1410
  const handleClick = () => {
@@ -1485,15 +1421,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
1485
1421
  // Determine if footer should be rendered
1486
1422
  const hasFooter = hasChips || footer || (hasActions && direction === "row");
1487
1423
  // Actions component to reuse
1488
- const ActionsComponent = hasActions && !disabled ? (jsxRuntime.jsxs("div", { className: styles$g.actions, children: [extraActions ?? null, onEdit && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) : null;
1424
+ const ActionsComponent = hasActions && !disabled ? (jsxRuntime.jsxs("div", { className: styles$h.actions, children: [extraActions ?? null, onEdit && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) : null;
1489
1425
  return (jsxRuntime.jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && {
1490
1426
  role: 'button',
1491
1427
  tabIndex: 0,
1492
1428
  onClick: handleClick,
1493
- }), "data-variant": variant, "data-direction": direction, children: [hasHeader && (jsxRuntime.jsxs("header", { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: styles$g.headerContent, "data-alignment": alignment, children: [title && jsxRuntime.jsx("h5", { children: title }), subtitle && jsxRuntime.jsx("strong", { children: subtitle })] })), direction === "column" && ActionsComponent] })), jsxRuntime.jsx("div", { className: styles$g.content, children: children }), hasFooter && (jsxRuntime.jsxs("footer", { children: [hasChips && (jsxRuntime.jsx("div", { className: styles$g.footerTags, children: chips.map((chip, index) => (jsxRuntime.jsx(CwChip, { label: chip.label, colorScheme: chip.colorScheme, className: styles$g.chip, ...(chip.customColor && { customColor: chip.customColor }), ...(chip.variant && { variant: chip.variant }), ...(chip.icon && { icon: chip.icon }) }, index))) })), footer && (jsxRuntime.jsx("div", { className: styles$g.footerContent, children: footer }))] })), direction === "row" && ActionsComponent, isLoading && (jsxRuntime.jsx("div", { className: styles$g.loadingOverlay, children: jsxRuntime.jsx(CwLoading, { isLoading: isLoading, size: "small" }) }))] }));
1429
+ }), "data-variant": variant, "data-direction": direction, children: [hasHeader && (jsxRuntime.jsxs("header", { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: styles$h.headerContent, "data-alignment": alignment, children: [title && jsxRuntime.jsx("h5", { children: title }), subtitle && jsxRuntime.jsx("strong", { children: subtitle })] })), direction === "column" && ActionsComponent] })), jsxRuntime.jsx("div", { className: styles$h.content, children: children }), hasFooter && (jsxRuntime.jsxs("footer", { children: [hasChips && (jsxRuntime.jsx("div", { className: styles$h.footerTags, children: chips.map((chip, index) => (jsxRuntime.jsx(CwChip, { label: chip.label, colorScheme: chip.colorScheme, className: styles$h.chip, ...(chip.customColor && { customColor: chip.customColor }), ...(chip.variant && { variant: chip.variant }), ...(chip.icon && { icon: chip.icon }) }, index))) })), footer && (jsxRuntime.jsx("div", { className: styles$h.footerContent, children: footer }))] })), direction === "row" && ActionsComponent, isLoading && (jsxRuntime.jsx("div", { className: styles$h.loadingOverlay, children: jsxRuntime.jsx(CwLoading, { isLoading: isLoading, size: "small" }) }))] }));
1494
1430
  };
1495
1431
 
1496
- var styles$f = {"cardContainer":"cw-card-list-module_cardContainer__l3YEh","pagination":"cw-card-list-module_pagination__5Ay78","pageInfo":"cw-card-list-module_pageInfo__uiMel","loading":"cw-card-list-module_loading__cYpND","emptyState":"cw-card-list-module_emptyState__RlqiS","sortControls":"cw-card-list-module_sortControls__mWgZA"};
1432
+ var styles$g = {"cardContainer":"cw-card-list-module_cardContainer__l3YEh","pagination":"cw-card-list-module_pagination__5Ay78","pageInfo":"cw-card-list-module_pageInfo__uiMel","loading":"cw-card-list-module_loading__cYpND","emptyState":"cw-card-list-module_emptyState__RlqiS","sortControls":"cw-card-list-module_sortControls__mWgZA"};
1497
1433
 
1498
1434
  function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', defaultCardWidth = 320, cardGap = 16, isLoading = false, emptyState, sortOptions = [], defaultSortKey, ...htmlProps }) {
1499
1435
  const [currentPage, setCurrentPage] = React.useState(1);
@@ -1527,10 +1463,10 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
1527
1463
  '--card-width': `${defaultCardWidth}px`,
1528
1464
  '--card-gap': `${cardGap}px`
1529
1465
  };
1530
- return (jsxRuntime.jsxs("div", { ...htmlProps, children: [sortOptions.length > 0 && (jsxRuntime.jsxs("div", { className: styles$f.sortControls, children: [jsxRuntime.jsx("label", { htmlFor: "cardlist-sort-select", children: "Sort by:" }), jsxRuntime.jsx("select", { id: "cardlist-sort-select", value: sortKey, onChange: (e) => handleSortChange(e.target.value), className: styles$f.sortSelect, children: sortOptions.map(option => (jsxRuntime.jsx("option", { value: option.key, children: option.label }, option.key))) }), jsxRuntime.jsx("button", { onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'), className: `cw-button-icon ${sortDirection === 'asc' ? 'cwi-arrow-up' : 'cwi-arrow-down'}`, title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}` })] })), isLoading ? (jsxRuntime.jsx("div", { className: styles$f.loading, children: jsxRuntime.jsx(CwLoading, { isLoading: isLoading }) })) : sortedItems.length === 0 ? (jsxRuntime.jsx("div", { className: styles$f.emptyState, children: emptyState || jsxRuntime.jsx("p", { children: "No items to display" }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `${styles$f.cardContainer}`, "data-layout": layout, style: gridStyle, children: visibleItems.map((item, index) => (jsxRuntime.jsx("div", { className: styles$f.cardWrapper, children: renderCard(item, index) }, index))) }), totalPages > 1 && (jsxRuntime.jsxs("div", { className: styles$f.pagination, children: [jsxRuntime.jsx("button", { disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)), className: "cw-button-icon cwi-chevron-left" }), jsxRuntime.jsxs("span", { className: styles$f.pageInfo, children: [currentPage, " of ", totalPages] }), jsxRuntime.jsx("button", { disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)), className: "cw-button-icon cwi-chevron-right" })] }))] }))] }));
1466
+ return (jsxRuntime.jsxs("div", { ...htmlProps, children: [sortOptions.length > 0 && (jsxRuntime.jsxs("div", { className: styles$g.sortControls, children: [jsxRuntime.jsx("label", { htmlFor: "cardlist-sort-select", children: "Sort by:" }), jsxRuntime.jsx("select", { id: "cardlist-sort-select", value: sortKey, onChange: (e) => handleSortChange(e.target.value), className: styles$g.sortSelect, children: sortOptions.map(option => (jsxRuntime.jsx("option", { value: option.key, children: option.label }, option.key))) }), jsxRuntime.jsx("button", { onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'), className: `cw-button-icon ${sortDirection === 'asc' ? 'cwi-arrow-up' : 'cwi-arrow-down'}`, title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}` })] })), isLoading ? (jsxRuntime.jsx("div", { className: styles$g.loading, children: jsxRuntime.jsx(CwLoading, { isLoading: isLoading }) })) : sortedItems.length === 0 ? (jsxRuntime.jsx("div", { className: styles$g.emptyState, children: emptyState || jsxRuntime.jsx("p", { children: "No items to display" }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `${styles$g.cardContainer}`, "data-layout": layout, style: gridStyle, children: visibleItems.map((item, index) => (jsxRuntime.jsx("div", { className: styles$g.cardWrapper, children: renderCard(item, index) }, index))) }), totalPages > 1 && (jsxRuntime.jsxs("div", { className: styles$g.pagination, children: [jsxRuntime.jsx("button", { disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)), className: "cw-button-icon cwi-chevron-left" }), jsxRuntime.jsxs("span", { className: styles$g.pageInfo, children: [currentPage, " of ", totalPages] }), jsxRuntime.jsx("button", { disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)), className: "cw-button-icon cwi-chevron-right" })] }))] }))] }));
1531
1467
  }
1532
1468
 
1533
- var styles$e = {"cw-accordion":"cw-accordion-module_cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module_cw-accordion-body__xlI8b"};
1469
+ var styles$f = {"cw-accordion":"cw-accordion-module_cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module_cw-accordion-body__xlI8b"};
1534
1470
 
1535
1471
  /**
1536
1472
  *
@@ -1547,7 +1483,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
1547
1483
  setVisible_accordionBody(!isVisible_accordionBody);
1548
1484
  };
1549
1485
  // #endregion
1550
- return (jsxRuntime.jsxs("div", { className: styles$e["cw-accordion"], style: CwelltAccordionContainerProps.style, "data-open": isVisible_accordionBody, children: [jsxRuntime.jsxs("header", { onClick: () => showAccordionBody(), children: [jsxRuntime.jsx("div", { children: CwelltAccordionContainerProps.desc_text }), jsxRuntime.jsx("button", { className: "cw-button-icon" })] }), jsxRuntime.jsx("div", { className: styles$e["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
1486
+ return (jsxRuntime.jsxs("div", { className: styles$f["cw-accordion"], style: CwelltAccordionContainerProps.style, "data-open": isVisible_accordionBody, children: [jsxRuntime.jsxs("header", { onClick: () => showAccordionBody(), children: [jsxRuntime.jsx("div", { children: CwelltAccordionContainerProps.desc_text }), jsxRuntime.jsx("button", { className: "cw-button-icon" })] }), jsxRuntime.jsx("div", { className: styles$f["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
1551
1487
  }
1552
1488
 
1553
1489
  /**
@@ -1558,23 +1494,23 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
1558
1494
  * @example
1559
1495
  * const columns: Column<User>[] = [
1560
1496
  * {
1561
- * title: 'Name',
1562
- * dataIndex: 'name',
1563
- * key: 'name',
1497
+ * title: "Name",
1498
+ * dataIndex: "name",
1499
+ * key: "name",
1564
1500
  * sortable: true, // Column is sortable
1565
1501
  * width: 100 // You can define the width of the column
1566
1502
  * },
1567
1503
  * {
1568
- * title: 'Age',
1569
- * dataIndex: 'age',
1570
- * key: 'age',
1504
+ * title: "Age",
1505
+ * dataIndex: "age",
1506
+ * key: "age",
1571
1507
  * sortable: true,
1572
1508
  * render: (item) => <span>{item.age} years</span> // Custom rendering
1573
1509
  * },
1574
1510
  * {
1575
- * title: 'Address',
1576
- * dataIndex: 'address',
1577
- * key: 'address',
1511
+ * title: "Address",
1512
+ * dataIndex: "address",
1513
+ * key: "address",
1578
1514
  * render: (item) => (
1579
1515
  * <a href={`https://maps.google.com/?q=${encodeURIComponent(item.address)}`} target="_blank" rel="noreferrer">
1580
1516
  * {item.address}
@@ -1584,12 +1520,12 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
1584
1520
  * ];
1585
1521
  *
1586
1522
  * const data:User[] = [
1587
- * { key: '1', name: 'Mike', age: 32, address: '10 Downing Street' },
1588
- * { key: '2', name: 'John', age: 42, address: '11 Downing Street' },
1589
- * { key: '3', name: 'Andres', age: 33, address: '12 Downing Street' },
1590
- * { key: '4', name: 'Gabriel', age: 22, address: '13 Downing Street' },
1591
- * { key: '5', name: 'Sergio', age: 47, address: '14 Downing Street' },
1592
- * { key: '6', name: 'Zacarias', age: 61, address: '15 Downing Street' }
1523
+ * { key: "1", name: "Mike", age: 32, address: "10 Downing Street" },
1524
+ * { key: "2", name: "John", age: 42, address: "11 Downing Street" },
1525
+ * { key: "3", name: "Andres", age: 33, address: "12 Downing Street" },
1526
+ * { key: "4", name: "Gabriel", age: 22, address: "13 Downing Street" },
1527
+ * { key: "5", name: "Sergio", age: 47, address: "14 Downing Street" },
1528
+ * { key: "6", name: "Zacarias", age: 61, address: "15 Downing Street" }
1593
1529
  * ];
1594
1530
  *
1595
1531
  * const generateExpandedContent = (record) => (
@@ -1604,8 +1540,8 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
1604
1540
  * pagination={true}
1605
1541
  * pageSizeOptions={[3, 5, 10]} // Optional, defaults to [5, 10, 20, 50]
1606
1542
  * expandedRowRender={generateExpandedContent}
1607
- * onExpand={(item) => console.log('Expanded:', item)}
1608
- * rowKey="key" // Optional, defaults to 'key'
1543
+ * onExpand={(item) => console.log("Expanded:", item)}
1544
+ * rowKey="key" // Optional, defaults to "key"
1609
1545
  * textNoData="No data available" // Optional message when no data
1610
1546
  * loading={false} // Optional, shows loading indicator
1611
1547
  * scrollHeight={300} // Optional scroll height, defaults to 300
@@ -1614,12 +1550,12 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
1614
1550
  * className="my-table" // Optional table class
1615
1551
  * classNameRow="my-table-row" // Optional class for each row
1616
1552
  * id="custom-table-id" // Optional ID for the container
1617
- * style={{ border: '1px solid #ccc' }} // Optional inline styles
1553
+ * style={{ border: "1px solid #ccc" }} // Optional inline styles
1618
1554
  * />
1619
1555
  *
1620
1556
  * @returns React component
1621
1557
  */
1622
- function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10, 20, 50], expandedRowRender, onExpand, className, classNameRow, style, classNameContainer, id, textNoData = "No data available at the moment", rowKey = "key", loading = false, scrollHeight, stickyHeader = false, }) {
1558
+ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10, 20, 50], expandedRowRender, onExpand, className, classNameRow, style, classNameContainer, id, textNoData = "No data available at the moment", rowKey = "key", loading = false, scrollHeight, stickyHeader = false, rowSelection }) {
1623
1559
  const [currentPage, setCurrentPage] = React.useState(1);
1624
1560
  const [expandedRowKey, setExpandedRowKey] = React.useState(null);
1625
1561
  const [sortConfig, setSortConfig] = React.useState({
@@ -1632,6 +1568,13 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
1632
1568
  acc[col.key] = col.width;
1633
1569
  return acc;
1634
1570
  }, {}));
1571
+ const [selectedKeys, setSelectedKeys] = React.useState(new Set(rowSelection?.selectedRowKeys || []));
1572
+ React.useEffect(() => {
1573
+ setCurrentPage(1);
1574
+ }, [data]);
1575
+ React.useEffect(() => {
1576
+ setSelectedKeys(new Set(rowSelection?.selectedRowKeys || []));
1577
+ }, [rowSelection?.selectedRowKeys]);
1635
1578
  const handleItemsPerPageChange = React.useCallback((e) => {
1636
1579
  setLocalItemsPerPage(parseInt(e.target.value, 10));
1637
1580
  setCurrentPage(1);
@@ -1658,11 +1601,62 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
1658
1601
  dataCopy.sort((a, b) => {
1659
1602
  const aVal = a[sortConfig.key];
1660
1603
  const bVal = b[sortConfig.key];
1604
+ // Handle null/undefined
1605
+ if (aVal == null && bVal == null)
1606
+ return 0;
1607
+ if (aVal == null)
1608
+ return 1;
1609
+ if (bVal == null)
1610
+ return -1;
1611
+ // Handle strings (case-insensitive)
1612
+ if (typeof aVal === "string" && typeof bVal === "string") {
1613
+ const comparison = aVal.localeCompare(bVal, undefined, {
1614
+ sensitivity: "base",
1615
+ numeric: true
1616
+ });
1617
+ return comparison * (sortConfig.direction === "asc" ? 1 : -1);
1618
+ }
1619
+ // Handle numbers and other types
1661
1620
  return (aVal < bVal ? -1 : aVal > bVal ? 1 : 0) * (sortConfig.direction === "asc" ? 1 : -1);
1662
1621
  });
1663
1622
  }
1664
1623
  return dataCopy;
1665
1624
  }, [data, sortConfig]);
1625
+ const handleRowClick = React.useCallback((item, e) => {
1626
+ // Prevent selection if the expand button is clicked
1627
+ if (e.target.closest(".cw-table-col-expand")) {
1628
+ return;
1629
+ }
1630
+ const itemKey = item[rowKey];
1631
+ setSelectedKeys(prev => {
1632
+ const newSet = new Set(prev);
1633
+ if (rowSelection?.type === "single") {
1634
+ // Single mode: only one row selected
1635
+ if (newSet.has(itemKey)) {
1636
+ newSet.clear(); // Deselect if already selected
1637
+ }
1638
+ else {
1639
+ newSet.clear();
1640
+ newSet.add(itemKey);
1641
+ }
1642
+ }
1643
+ else {
1644
+ // Multiple mode: several rows
1645
+ if (newSet.has(itemKey)) {
1646
+ newSet.delete(itemKey);
1647
+ }
1648
+ else {
1649
+ newSet.add(itemKey);
1650
+ }
1651
+ }
1652
+ const selectedRows = sortedData.filter(item => newSet.has(item[rowKey]));
1653
+ // Run after render to avoid "Cannot update a component while rendering another component"
1654
+ setTimeout(() => {
1655
+ rowSelection?.onChange?.(Array.from(newSet), selectedRows);
1656
+ }, 0);
1657
+ return newSet;
1658
+ });
1659
+ }, [rowSelection, rowKey, sortedData]);
1666
1660
  const paginatedData = React.useMemo(() => {
1667
1661
  if (!sortedData)
1668
1662
  return [];
@@ -1704,7 +1698,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
1704
1698
  }, [stickyHeader, scrollHeight]);
1705
1699
  const getColSpan = () => columns.length + (expandedRowRender ? 1 : 0);
1706
1700
  const hasClassNameRow = (item) => {
1707
- return typeof item === 'object' && item !== null && 'classNameRow' in item;
1701
+ return typeof item === "object" && item !== null && "classNameRow" in item;
1708
1702
  };
1709
1703
  const renderTableBody = () => {
1710
1704
  if (loading) {
@@ -1717,7 +1711,15 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
1717
1711
  const itemKey = item[rowKey];
1718
1712
  if (!itemKey)
1719
1713
  console.warn("Missing row key for item", item);
1720
- return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsxs("tr", { className: `${classNameRow ?? ""} ${hasClassNameRow(item) ? item.classNameRow : ""}`, children: [expandedRowRender && (jsxRuntime.jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsxRuntime.jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === itemKey
1714
+ const isSelected = selectedKeys.has(itemKey);
1715
+ const dynamicClassName = typeof classNameRow === "function"
1716
+ ? classNameRow(item)
1717
+ : classNameRow ?? "";
1718
+ return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsxs("tr", { className: `${dynamicClassName} ${hasClassNameRow(item) ? item.classNameRow : ""} ${isSelected ? "cw-table-row-selected" : ""}`, onClick: (e) => rowSelection && handleRowClick(item, e), style: {
1719
+ cursor: rowSelection ? "pointer" : "default",
1720
+ backgroundColor: isSelected ? "var(--cw-color-info-container)" : undefined,
1721
+ transition: "background-color 0.2s ease",
1722
+ }, children: [expandedRowRender && (jsxRuntime.jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsxRuntime.jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === itemKey
1721
1723
  ? "cwi-chevron-down"
1722
1724
  : "cwi-chevron-right"}` }) })), columns.map(col => (jsxRuntime.jsx("td", { className: col.className ?? "", children: col.render ? col.render(item) : col.dataIndex ? String(item[col.dataIndex]) : "" }, `${itemKey}_${col.key}`)))] }), expandedRowRender && expandedRowKey === itemKey && (jsxRuntime.jsx("tr", { className: "cw-table-row-expanded", children: jsxRuntime.jsx("td", { colSpan: getColSpan(), children: expandedRowRender(item) }) }))] }, String(itemKey)));
1723
1725
  });
@@ -1734,9 +1736,11 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
1734
1736
  minWidth: 50,
1735
1737
  maxWidth: columnWidths[col.key] ?? col.width
1736
1738
  }),
1737
- }, children: [jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { children: col.title }), col.sortable && col.dataIndex && (jsxRuntime.jsx("span", { style: { fontSize: "12px", marginLeft: "6px" }, children: sortConfig.key !== col.dataIndex ? "↕" : sortConfig.direction === "asc"
1738
- ? ""
1739
- : "↓" }))] }), jsxRuntime.jsx("span", { onMouseDown: (e) => startResize(e, col.key), className: "th-column-resizer" })] }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderTableBody() })] }) }), pagination && totalPages > 1 && (jsxRuntime.jsxs("footer", { className: "cw-table-pagination", children: [jsxRuntime.jsx("button", { onClick: () => handlePageChange(1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left-double", title: "First" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(currentPage - 1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left", title: "Previous" }), jsxRuntime.jsx("input", { type: "text", inputMode: "numeric", value: currentPage, onChange: (e) => {
1739
+ }, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center", children: [jsxRuntime.jsx("span", { children: col.title }), col.sortable && col.dataIndex && (jsxRuntime.jsx(CwIcon, { size: "large", iconId: sortConfig.key !== col.dataIndex
1740
+ ? "sortable"
1741
+ : sortConfig.direction === "asc"
1742
+ ? "sortable-asc"
1743
+ : "sortable-desc" }))] }), jsxRuntime.jsx("span", { onMouseDown: (e) => startResize(e, col.key), className: "th-column-resizer" })] }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderTableBody() })] }) }), pagination && totalPages > 1 && (jsxRuntime.jsxs("footer", { className: "cw-table-pagination", children: [jsxRuntime.jsx("button", { onClick: () => handlePageChange(1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left-double", title: "First" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(currentPage - 1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left", title: "Previous" }), jsxRuntime.jsx("input", { type: "text", inputMode: "numeric", value: currentPage, onChange: (e) => {
1740
1744
  const value = parseInt(e.target.value, 10);
1741
1745
  if (!isNaN(value))
1742
1746
  handlePageChange(value);
@@ -1748,7 +1752,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
1748
1752
  }, min: 1, max: totalPages }), jsxRuntime.jsxs("span", { children: ["of ", totalPages] }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right", title: "Next" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(totalPages), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right-double", title: "Last" }), jsxRuntime.jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, children: pageSizeOptions.map(size => (jsxRuntime.jsxs("option", { value: size, children: [size, " / page"] }, size))) })] }))] }));
1749
1753
  }
1750
1754
 
1751
- var styles$d = {"cw-tabs":"cw-tabs-module_cw-tabs__1pmji","cw-tabs-content":"cw-tabs-module_cw-tabs-content__HTp8d"};
1755
+ var styles$e = {"cw-tabs":"cw-tabs-module_cw-tabs__1pmji","badge":"cw-tabs-module_badge__AmVxW","cw-tabs-content":"cw-tabs-module_cw-tabs-content__HTp8d"};
1752
1756
 
1753
1757
  const TabIcon = ({ icon }) => {
1754
1758
  if (!icon)
@@ -1798,7 +1802,7 @@ function CwTabs(CwTabsProps) {
1798
1802
  const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
1799
1803
  ? { minWidth: CwTabsProps.tabsListWidth }
1800
1804
  : undefined;
1801
- return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, className: styles$d['cw-tabs'], style: CwTabsProps.style, "data-tabs-position": position, children: [jsxRuntime.jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxRuntime.jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, children: [jsxRuntime.jsx(TabIcon, { icon: tab.icon }), tab.title] }, tab.key))) }), jsxRuntime.jsx("div", { className: styles$d['cw-tabs-content'], children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
1805
+ return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, className: styles$e['cw-tabs'], style: CwTabsProps.style, "data-tabs-position": position, children: [jsxRuntime.jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxRuntime.jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, children: [jsxRuntime.jsx(TabIcon, { icon: tab.icon }), tab.title, tab.badge !== undefined && (jsxRuntime.jsx("span", { className: styles$e['badge'], style: tab.badgeColor ? { backgroundColor: tab.badgeColor, color: getContrastColor(tab.badgeColor) } : undefined, children: tab.badge }))] }, tab.key))) }), jsxRuntime.jsx("div", { className: styles$e['cw-tabs-content'], children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
1802
1806
  }
1803
1807
 
1804
1808
  /**
@@ -1838,15 +1842,15 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
1838
1842
  * emptyValue="N/A"
1839
1843
  * />
1840
1844
  */
1841
- const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "row" }) => {
1842
- return (jsxRuntime.jsx("dl", { className: `cw-keyvalue-list ${className}`, children: items.map(item => (jsxRuntime.jsxs("div", { className: `cw-keyvalue-list-item cw-flex-${direction}`, children: [jsxRuntime.jsx("dt", { children: item.label }), jsxRuntime.jsx("dd", { children: item.value !== undefined && item.value !== null && item.value !== ""
1845
+ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "row", ...htmlProps }) => {
1846
+ return (jsxRuntime.jsx("dl", { className: `cw-keyvalue-list ${className}`, ...htmlProps, children: items.map(item => (jsxRuntime.jsxs("div", { className: `cw-keyvalue-list-item cw-flex-${direction}`, children: [jsxRuntime.jsx("dt", { children: item.label }), jsxRuntime.jsx("dd", { children: item.value !== undefined && item.value !== null && item.value !== ""
1843
1847
  ? (React.isValidElement(item.value)
1844
1848
  ? item.value
1845
1849
  : `${item.value}${item.suffix ? ` ${item.suffix}` : ''}`)
1846
1850
  : emptyValue })] }, item.key))) }));
1847
1851
  };
1848
1852
 
1849
- var styles$c = {"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"};
1853
+ var styles$d = {"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"};
1850
1854
 
1851
1855
  function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, }) {
1852
1856
  const [draggedItem, setDraggedItem] = React.useState(null);
@@ -1909,15 +1913,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
1909
1913
  }
1910
1914
  };
1911
1915
  if (items.length === 0) {
1912
- return (jsxRuntime.jsx("div", { className: `${styles$c.sortableList} ${styles$c.emptyState} ${className}`, children: jsxRuntime.jsx("div", { className: styles$c.emptyMessage, children: emptyMessage }) }));
1916
+ return (jsxRuntime.jsx("div", { className: `${styles$d.sortableList} ${styles$d.emptyState} ${className}`, children: jsxRuntime.jsx("div", { className: styles$d.emptyMessage, children: emptyMessage }) }));
1913
1917
  }
1914
- return (jsxRuntime.jsx("div", { className: `${styles$c.sortableList} ${className}`, children: items.map((item, index) => {
1918
+ return (jsxRuntime.jsx("div", { className: `${styles$d.sortableList} ${className}`, children: items.map((item, index) => {
1915
1919
  const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
1916
1920
  const isDragging = draggedItem?.id === item.id;
1917
1921
  const isMoved = movedItems.has(item.id);
1918
1922
  const canExpand = Boolean(expandedContent);
1919
1923
  const isExpanded = expandedItems.has(item.id);
1920
- return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && jsxRuntime.jsx("div", { className: styles$c.dropIndicator }), jsxRuntime.jsxs("div", { className: `${styles$c.sortableItem} ${isDragging ? styles$c.dragging : ''} ${isMoved ? styles$c.moved : ''} ${readOnly ? styles$c.readOnly : ''}`, draggable: !readOnly, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, children: [jsxRuntime.jsxs("header", { children: [canExpand ? (jsxRuntime.jsx(CwButton, { variant: "icon", onClick: () => toggleExpanded(item.id), type: "button", title: isExpanded ? "Collapse" : "Expand", icon: isExpanded ? "chevron-up" : "chevron-down" })) : showHandle ? (jsxRuntime.jsx("div", { className: styles$c.sortableHandle, children: jsxRuntime.jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxRuntime.jsxs("div", { className: styles$c.sortableContent, children: [jsxRuntime.jsx("div", { className: styles$c.sortableTitle, children: title }), extraContent && jsxRuntime.jsx("div", { className: styles$c.sortableExtraContent, children: extraContent })] }), jsxRuntime.jsx("div", { className: styles$c.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsxRuntime.jsx("div", { className: styles$c.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsxRuntime.jsx("div", { className: styles$c.dropIndicator }))] }, item.id));
1924
+ return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && jsxRuntime.jsx("div", { className: styles$d.dropIndicator }), jsxRuntime.jsxs("div", { className: `${styles$d.sortableItem} ${isDragging ? styles$d.dragging : ''} ${isMoved ? styles$d.moved : ''} ${readOnly ? styles$d.readOnly : ''}`, draggable: !readOnly, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, children: [jsxRuntime.jsxs("header", { children: [canExpand ? (jsxRuntime.jsx(CwButton, { variant: "icon", onClick: () => toggleExpanded(item.id), type: "button", title: isExpanded ? "Collapse" : "Expand", icon: isExpanded ? "chevron-up" : "chevron-down" })) : showHandle ? (jsxRuntime.jsx("div", { className: styles$d.sortableHandle, children: jsxRuntime.jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxRuntime.jsxs("div", { className: styles$d.sortableContent, children: [jsxRuntime.jsx("div", { className: styles$d.sortableTitle, children: title }), extraContent && jsxRuntime.jsx("div", { className: styles$d.sortableExtraContent, children: extraContent })] }), jsxRuntime.jsx("div", { className: styles$d.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsxRuntime.jsx("div", { className: styles$d.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsxRuntime.jsx("div", { className: styles$d.dropIndicator }))] }, item.id));
1921
1925
  }) }));
1922
1926
  }
1923
1927
 
@@ -2094,11 +2098,15 @@ function CwFileUpload(fileUploadProps) {
2094
2098
  return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "row", children: [jsxRuntime.jsx("input", { className: "cw-button", type: "file", accept: fileUploadProps.accept, readOnly: true, placeholder: "No file selected...", onChange: handleFileChange }), previewURL && (jsxRuntime.jsx("div", { className: "row", children: jsxRuntime.jsx("img", { src: previewURL, alt: "Preview", style: { maxWidth: "200px", maxHeight: "200px" } }) }))] }), error && jsxRuntime.jsx("div", { className: "row error", children: error }), jsxRuntime.jsx("div", { className: "row", children: jsxRuntime.jsxs("label", { children: ["Please note: File/image has to be in ", fileUploadProps.acceptString, " format", fileUploadProps.sizeString && `, ${fileUploadProps.sizeString}`] }) })] }));
2095
2099
  }
2096
2100
 
2097
- var styles$b = {"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"};
2101
+ var styles$c = {"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"};
2098
2102
 
2099
2103
  function CwFileUploadMultiple(fileUploadProps) {
2100
2104
  const fileInputRef = React.useRef(null);
2101
2105
  const [selectedFiles, setSelectedFiles] = React.useState([]);
2106
+ const [existingFile, setExistingFile] = React.useState(fileUploadProps.initialFileName);
2107
+ React.useEffect(() => {
2108
+ setExistingFile(fileUploadProps.initialFileName);
2109
+ }, [fileUploadProps.initialFileName]);
2102
2110
  const getFileExtension = (filename) => {
2103
2111
  return filename.split('.').pop()?.toUpperCase() || '';
2104
2112
  };
@@ -2203,6 +2211,10 @@ function CwFileUploadMultiple(fileUploadProps) {
2203
2211
  }
2204
2212
  }
2205
2213
  };
2214
+ const handleFileSelectInternal = (event) => {
2215
+ setExistingFile(undefined);
2216
+ handleFileSelect(event);
2217
+ };
2206
2218
  const removeFile = (indexToRemove) => {
2207
2219
  const newFiles = selectedFiles.filter((_, index) => index !== indexToRemove);
2208
2220
  setSelectedFiles(newFiles);
@@ -2229,6 +2241,7 @@ function CwFileUploadMultiple(fileUploadProps) {
2229
2241
  event.stopPropagation();
2230
2242
  const files = event.dataTransfer.files;
2231
2243
  if (files && files.length > 0) {
2244
+ setExistingFile(undefined);
2232
2245
  const updatedFiles = processFiles(files, selectedFiles);
2233
2246
  if (updatedFiles.length > selectedFiles.length || !fileUploadProps.multiple) {
2234
2247
  setSelectedFiles(updatedFiles);
@@ -2236,7 +2249,12 @@ function CwFileUploadMultiple(fileUploadProps) {
2236
2249
  }
2237
2250
  }
2238
2251
  };
2239
- return (jsxRuntime.jsxs("div", { className: `${styles$b.fileUploadContainer} ${fileUploadProps.className}`, children: [jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", name: fileUploadProps.name, accept: fileUploadProps.accept, multiple: fileUploadProps.multiple, onChange: handleFileSelect, disabled: fileUploadProps.disabled, "aria-label": "files", className: styles$b.hiddenInput }), selectedFiles.length === 0 ? (jsxRuntime.jsxs("div", { className: `${styles$b.uploadArea} ${fileUploadProps.disabled ? styles$b.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsxRuntime.jsx(CwIcon, { iconId: "upload" }), jsxRuntime.jsx("p", { className: `${styles$b.uploadTitle}`, children: fileUploadProps.disabled ? 'Upload disabled' : 'Click to upload or drag and drop' }), jsxRuntime.jsxs("p", { className: `${styles$b.uploadSubtitle}`, children: [fileUploadProps.accept ? `Accepted files: ${fileUploadProps.accept}` : 'All file types accepted', !fileUploadProps.multiple && ' (Single file only)'] })] })) : (jsxRuntime.jsxs("div", { className: styles$b.filesContainer, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center", children: [jsxRuntime.jsxs("small", { className: styles$b.filesCount, children: [selectedFiles.length, " file", selectedFiles.length !== 1 ? 's' : '', " selected"] }), jsxRuntime.jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: "Clear all" })] }), selectedFiles.map((file, index) => (jsxRuntime.jsxs("div", { className: styles$b.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$b.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$b.fileExtension, children: getFileExtension(file.name) })] }), jsxRuntime.jsxs("div", { className: styles$b.fileInfo, children: [jsxRuntime.jsx("p", { className: styles$b.fileName, children: file.name }), jsxRuntime.jsxs("p", { className: styles$b.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$b.smallButton })] }, index))), fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: "Add More Files", icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: "Change File", icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
2252
+ return (jsxRuntime.jsxs("div", { className: `${styles$c.fileUploadContainer} ${fileUploadProps.className}`, children: [jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", name: fileUploadProps.name, accept: fileUploadProps.accept, multiple: fileUploadProps.multiple, onChange: handleFileSelectInternal, disabled: fileUploadProps.disabled, "aria-label": "files", className: styles$c.hiddenInput }), selectedFiles.length === 0 && !existingFile ? (jsxRuntime.jsxs("div", { className: `${styles$c.uploadArea} ${fileUploadProps.disabled ? styles$c.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsxRuntime.jsx(CwIcon, { iconId: "upload" }), jsxRuntime.jsx("p", { className: `${styles$c.uploadTitle}`, children: fileUploadProps.disabled ? 'Upload disabled' : 'Click to upload or drag and drop' }), jsxRuntime.jsxs("p", { className: `${styles$c.uploadSubtitle}`, children: [fileUploadProps.accept ? `Accepted files: ${fileUploadProps.accept}` : 'All file types accepted', !fileUploadProps.multiple && ' (Single file only)'] })] })) : selectedFiles.length === 0 && existingFile ? (jsxRuntime.jsxs("div", { className: styles$c.filesContainer, children: [jsxRuntime.jsxs("div", { className: styles$c.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$c.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$c.fileExtension, children: getFileExtension(existingFile) })] }), jsxRuntime.jsx("div", { className: styles$c.fileInfo, children: jsxRuntime.jsx("p", { className: styles$c.fileName, children: existingFile }) }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => {
2253
+ setExistingFile(undefined);
2254
+ if (fileUploadProps.onSelect) {
2255
+ fileUploadProps.onSelect(null);
2256
+ }
2257
+ }, disabled: fileUploadProps.disabled, className: styles$c.smallButton })] }), jsxRuntime.jsx(CwButton, { text: "Change File", icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled })] })) : (jsxRuntime.jsxs("div", { className: styles$c.filesContainer, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center", children: [jsxRuntime.jsxs("small", { className: styles$c.filesCount, children: [selectedFiles.length, " file", selectedFiles.length !== 1 ? 's' : '', " selected"] }), jsxRuntime.jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: "Clear all" })] }), selectedFiles.map((file, index) => (jsxRuntime.jsxs("div", { className: styles$c.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$c.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$c.fileExtension, children: getFileExtension(file.name) })] }), jsxRuntime.jsxs("div", { className: styles$c.fileInfo, children: [jsxRuntime.jsx("p", { className: styles$c.fileName, children: file.name }), jsxRuntime.jsxs("p", { className: styles$c.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$c.smallButton })] }, index))), fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: "Add More Files", icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: "Change File", icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
2240
2258
  }
2241
2259
 
2242
2260
  function CwInput(CwInputProps) {
@@ -2279,7 +2297,7 @@ function CwDigit(props) {
2279
2297
  return (jsxRuntime.jsx("div", { className: "cw-input-text", children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsx("input", { type: "number", ...inputProps }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
2280
2298
  }
2281
2299
 
2282
- var styles$a = {"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"};
2300
+ var styles$b = {"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"};
2283
2301
 
2284
2302
  const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
2285
2303
  const [rgb, setRgb] = React.useState({ r: 255, g: 255, b: 255 });
@@ -2482,13 +2500,13 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
2482
2500
  // Calculate background color for the main area based on current hue
2483
2501
  const hueColor = hsvToRgb(hsv.h, 100, 100);
2484
2502
  const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
2485
- return (jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsxRuntime.jsx("div", { className: styles$a.colorPreview, style: { backgroundColor: hexColor, color: getContrastColor(hexColor) }, children: previewText }), jsxRuntime.jsx("button", { type: "button", className: "cw-button", onClick: toggleInputMode, style: { minWidth: "3ch" }, children: inputMode === 'hex' ? 'RGB' : 'HEX' })] }), jsxRuntime.jsx("div", { className: "color-inputs-row", children: inputMode === 'hex' ? (jsxRuntime.jsx("input", { type: "text", value: hexColor, onChange: handleHexChange })) : (jsxRuntime.jsxs("div", { className: "cw-grid-base-3 cw-gap-small", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "R:" }), jsxRuntime.jsx("input", { type: "number", name: "r", min: "0", max: "255", value: rgb.r, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "G:" }), jsxRuntime.jsx("input", { type: "number", name: "g", min: "0", max: "255", value: rgb.g, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "B:" }), jsxRuntime.jsx("input", { type: "number", name: "b", min: "0", max: "255", value: rgb.b, onChange: handleRgbChange })] })] })) }), jsxRuntime.jsxs("div", { className: styles$a.colorPickerInteractiveArea, children: [jsxRuntime.jsx("div", { className: styles$a.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsxRuntime.jsx("div", { className: styles$a.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxRuntime.jsxs("div", { className: styles$a.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxRuntime.jsxs("div", { className: styles$a.colorAreaOverlay, children: [jsxRuntime.jsx("div", { className: styles$a.hueBackground, style: { backgroundColor: hueHex } }), jsxRuntime.jsx("div", { className: styles$a.whiteGradient }), jsxRuntime.jsx("div", { className: styles$a.blackGradient })] }), jsxRuntime.jsx("div", { className: styles$a.colorAreaCursor, style: {
2503
+ return (jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsxRuntime.jsx("div", { className: styles$b.colorPreview, style: { backgroundColor: hexColor, color: getContrastColor(hexColor) }, children: previewText }), jsxRuntime.jsx("button", { type: "button", className: "cw-button", onClick: toggleInputMode, style: { minWidth: "3ch" }, children: inputMode === 'hex' ? 'RGB' : 'HEX' })] }), jsxRuntime.jsx("div", { className: "color-inputs-row", children: inputMode === 'hex' ? (jsxRuntime.jsx("input", { type: "text", value: hexColor, onChange: handleHexChange })) : (jsxRuntime.jsxs("div", { className: "cw-grid-base-3 cw-gap-small", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "R:" }), jsxRuntime.jsx("input", { type: "number", name: "r", min: "0", max: "255", value: rgb.r, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "G:" }), jsxRuntime.jsx("input", { type: "number", name: "g", min: "0", max: "255", value: rgb.g, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "B:" }), jsxRuntime.jsx("input", { type: "number", name: "b", min: "0", max: "255", value: rgb.b, onChange: handleRgbChange })] })] })) }), jsxRuntime.jsxs("div", { className: styles$b.colorPickerInteractiveArea, children: [jsxRuntime.jsx("div", { className: styles$b.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsxRuntime.jsx("div", { className: styles$b.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxRuntime.jsxs("div", { className: styles$b.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxRuntime.jsxs("div", { className: styles$b.colorAreaOverlay, children: [jsxRuntime.jsx("div", { className: styles$b.hueBackground, style: { backgroundColor: hueHex } }), jsxRuntime.jsx("div", { className: styles$b.whiteGradient }), jsxRuntime.jsx("div", { className: styles$b.blackGradient })] }), jsxRuntime.jsx("div", { className: styles$b.colorAreaCursor, style: {
2486
2504
  left: `${hsv.s}%`,
2487
2505
  top: `${100 - hsv.v}%`
2488
2506
  } })] })] })] }));
2489
2507
  };
2490
2508
 
2491
- var styles$9 = {"selectColor":"cw-input-color-module_selectColor__DTo3V","disabled":"cw-input-color-module_disabled__O1fK5","colorDropdown":"cw-input-color-module_colorDropdown__pX2bc"};
2509
+ var styles$a = {"selectColor":"cw-input-color-module_selectColor__DTo3V","disabled":"cw-input-color-module_disabled__O1fK5","colorDropdown":"cw-input-color-module_colorDropdown__pX2bc"};
2492
2510
 
2493
2511
  const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, width = '4rem', height = '2rem' }) => {
2494
2512
  const [isOpen, setIsOpen] = React.useState(false);
@@ -2621,11 +2639,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
2621
2639
  break;
2622
2640
  }
2623
2641
  };
2624
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$9.selectColor} ${disabled ? styles$9.disabled : ''}`, style: {
2642
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$a.selectColor} ${disabled ? styles$a.disabled : ''}`, style: {
2625
2643
  width,
2626
2644
  height,
2627
2645
  backgroundColor: value,
2628
- }, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: dropdownRef, className: styles$9.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsxRuntime.jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
2646
+ }, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: dropdownRef, className: styles$a.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsxRuntime.jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
2629
2647
  };
2630
2648
 
2631
2649
  /**
@@ -2652,7 +2670,7 @@ function CwInputText(props) {
2652
2670
  const containerClassName = className
2653
2671
  ? `cw-input-text ${className}`
2654
2672
  : "cw-input-text";
2655
- return (jsxRuntime.jsx("div", { className: containerClassName, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsx("input", { type: props.type ?? "text", ...inputProps }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
2673
+ return (jsxRuntime.jsx("div", { className: containerClassName, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("div", { className: "cw-input-button", children: [jsxRuntime.jsx("input", { type: props.type ?? "text", ...inputProps }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] })] }) }));
2656
2674
  }
2657
2675
 
2658
2676
  /**
@@ -3118,7 +3136,7 @@ const CwImageArea = React.forwardRef((props, ref) => {
3118
3136
  });
3119
3137
  CwImageArea.displayName = "CwImageArea";
3120
3138
 
3121
- var styles$8 = {"cw-weekday-selector":"cw-weekday-selector-module_cw-weekday-selector__Iz4GZ"};
3139
+ var styles$9 = {"cw-weekday-selector":"cw-weekday-selector-module_cw-weekday-selector__Iz4GZ"};
3122
3140
 
3123
3141
  /**
3124
3142
  * This class represents a week where days can be selected or unselected
@@ -3258,7 +3276,7 @@ const CwWeekdaySelector = ({ value = "", onChange, disabled = false }) => {
3258
3276
  setSelectedDays(newWeekdays);
3259
3277
  onChange?.(newWeekdays.toString());
3260
3278
  };
3261
- return (jsxRuntime.jsx("div", { className: styles$8["cw-weekday-selector"], children: Weekdays.getFullWeek().map(day => (jsxRuntime.jsx("input", { type: "checkbox", "data-day": day, checked: selectedDays.toArray().includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }));
3279
+ return (jsxRuntime.jsx("div", { className: styles$9["cw-weekday-selector"], children: Weekdays.getFullWeek().map(day => (jsxRuntime.jsx("input", { type: "checkbox", "data-day": day, checked: selectedDays.toArray().includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }));
3262
3280
  };
3263
3281
 
3264
3282
  function CwCheckbox(CwCheckboxProps) {
@@ -3277,9 +3295,9 @@ function CwCheckbox(CwCheckboxProps) {
3277
3295
  }
3278
3296
 
3279
3297
  function CwToggle(props) {
3280
- const { labelProps, labelText, iconProps, alignment = "row", className, ...inputProps } = props;
3298
+ const { labelProps, labelText, iconProps, alignment = "row", className, style, ...inputProps } = props;
3281
3299
  const displayText = labelText || labelProps?.text;
3282
- return (jsxRuntime.jsx("div", { className: `cw-toggle${className ? ` ${className}` : ''}`, children: jsxRuntime.jsxs("label", { className: "cw-toggle-label", "data-direction": alignment, children: [displayText && (jsxRuntime.jsxs("span", { className: "cw-icon-text", children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), displayText] })), jsxRuntime.jsx("input", {
3300
+ return (jsxRuntime.jsx("div", { className: `cw-toggle ${className ? ` ${className}` : ''}`, style: style, children: jsxRuntime.jsxs("label", { className: "cw-toggle-label", "data-direction": alignment, children: [displayText && (jsxRuntime.jsxs("span", { className: "cw-icon-text", children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), displayText] })), jsxRuntime.jsx("input", {
3283
3301
  //data-color={color}
3284
3302
  type: "checkbox", ...inputProps })] }) }));
3285
3303
  }
@@ -3325,64 +3343,10 @@ function CwOption(props) {
3325
3343
  * </CwSelect>
3326
3344
  */
3327
3345
  function CwSelect(props) {
3328
- const { alignProps, labelProps, buttonProps, iconProps, placeholder, children, ...selectProps } = props;
3346
+ const { alignProps, labelProps, buttonProps, iconProps, placeholder, children, style, ...selectProps } = props;
3329
3347
  const flexDirection = alignProps?.flexDirection;
3330
3348
  const dataDirection = flexDirection ? { 'data-direction': flexDirection } : {};
3331
- return (jsxRuntime.jsx("div", { className: "cw-select", ...dataDirection, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: selectProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("select", { ...selectProps, children: [placeholder && jsxRuntime.jsx(CwOption, { value: "", children: placeholder }), children] }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
3332
- }
3333
-
3334
- function CwDropdown(optionsProps) {
3335
- const [selectedOption, setSelectedOption] = React.useState(optionsProps.defaultSelected || "");
3336
- React.useEffect(() => {
3337
- if (optionsProps.defaultSelected !== undefined && optionsProps.defaultSelected !== selectedOption) {
3338
- setSelectedOption(optionsProps.defaultSelected);
3339
- if (optionsProps.handleChange) {
3340
- optionsProps.handleChange(optionsProps.defaultSelected);
3341
- }
3342
- }
3343
- }, [optionsProps.defaultSelected, selectedOption, optionsProps.handleChange]);
3344
- const handleOptionSelect = (event) => {
3345
- const selectedValue = event.target.value;
3346
- setSelectedOption(selectedValue);
3347
- if (optionsProps.handleChange) {
3348
- optionsProps.handleChange(selectedValue);
3349
- }
3350
- };
3351
- return (jsxRuntime.jsxs("div", { className: optionsProps.labelPosition === "inline"
3352
- ? "cwellt_flex cwellt_flex_row cwellt_align_items_center cwDropDownComp" + " " + optionsProps.className
3353
- : optionsProps.labelPosition === "column"
3354
- ? "cwellt_flex cwellt_flex_column cwellt_align-items_baseline cwDropDownComp" + " " + optionsProps.className
3355
- : "cwellt_flex cwellt_flex_row cwellt_align_items_center cwDropDownComp" + " " + optionsProps.className, style: optionsProps.style, id: optionsProps.id, children: [jsxRuntime.jsx("label", { className: optionsProps.disabled === true
3356
- ? "cw_label_text cw_label_text_disabled" + " " + optionsProps.labelClassName
3357
- : "cw_label_text" + " " + optionsProps.labelClassName, children: optionsProps.labelName }), jsxRuntime.jsx("select", { value: selectedOption, onChange: handleOptionSelect, className: "cw_select", style: optionsProps.styleSelect, disabled: optionsProps.disabled || optionsProps.selectList.length === 0, children: optionsProps.selectList.length === 0 ? (jsxRuntime.jsx("option", { value: "", className: "cw_option", disabled: true, children: "No data" })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("option", { value: "", className: "cw_option", children: optionsProps.placeholder }), optionsProps.selectList.map(option => (jsxRuntime.jsx("option", { value: option.id, className: "cw_option", style: optionsProps.styleOption, children: option.description }, option.id)))] })) })] }));
3358
- }
3359
-
3360
- function CwDropdownContainer(dropDownContainerProps) {
3361
- // #region
3362
- // - Ref dropDownContainer
3363
- const dropDownContainer_ref = React__namespace.createRef();
3364
- // - Ref list container
3365
- const dropDown_listContainer = React__namespace.createRef();
3366
- // #endregion
3367
- // #region Functions
3368
- const onKeyPressDropDownContainer = (event_keyDown) => {
3369
- dropDownContainerProps.onKeyDownDropDownContainer(event_keyDown);
3370
- };
3371
- const onMouseLeaveDropDownContainer = (event_onMouseLeave) => {
3372
- if (typeof dropDownContainerProps.onMouseLeaveDropDownContainer === "function") {
3373
- dropDownContainerProps.onMouseLeaveDropDownContainer(event_onMouseLeave);
3374
- }
3375
- };
3376
- // #endregion
3377
- // #region UseEffect
3378
- React.useEffect(() => {
3379
- window.addEventListener("keydown", onKeyPressDropDownContainer);
3380
- return () => {
3381
- window.removeEventListener("keydown", onKeyPressDropDownContainer);
3382
- };
3383
- }, []);
3384
- // #endregion
3385
- return (jsxRuntime.jsx("div", { className: `cw-dropdown-container ${dropDownContainerProps.className || ''}`, onKeyDown: onKeyPressDropDownContainer, onMouseLeave: onMouseLeaveDropDownContainer, tabIndex: 0, hidden: !dropDownContainerProps.dropDownState, children: jsxRuntime.jsx("div", { className: "cw-dropdown-list", id: dropDownContainerProps.idDropDownContainer, ref: dropDownContainer_ref, children: jsxRuntime.jsx("div", { ref: dropDown_listContainer, children: dropDownContainerProps.children }) }) }));
3349
+ return (jsxRuntime.jsx("div", { className: "cw-select", ...dataDirection, style: style, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: selectProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("select", { ...selectProps, children: [placeholder && jsxRuntime.jsx(CwOption, { value: "", children: placeholder }), children] }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
3386
3350
  }
3387
3351
 
3388
3352
  function CwDropdownFilter(props) {
@@ -3395,634 +3359,38 @@ function CwDropdownFilter(props) {
3395
3359
  return (jsxRuntime.jsxs("div", { id: props.IdContent, className: containerClassName, children: [props.children, isVisible && (jsxRuntime.jsx("nav", { className: "cw-dropdown-menu", style: inlineStyles, onMouseLeave: props.onMouseLeave, id: props.idDropDownFilter, role: "menu", children: jsxRuntime.jsx("ul", { role: "none", children: props.DataSourceDropDownItem?.map((item) => (jsxRuntime.jsx("li", { id: item.IdDropDown_filter, role: "menuitem", children: item.dropDownFilter_desc }, item.IdDropDown_filter))) }) }))] }));
3396
3360
  }
3397
3361
 
3398
- const { Option, OptGroup } = antd.Select;
3399
- class MultiSelect extends React__namespace.Component {
3400
- constructor(Props) {
3401
- super(Props);
3402
- this.state = {
3403
- selected: null,
3404
- isVisibleDropDown: false,
3405
- activeClassName: ""
3406
- };
3407
- }
3408
- componentDidMount() {
3409
- this.setState({
3410
- selected: this.props.selectedItems?.map((s) => ({
3411
- type: s.type,
3412
- id: s.id,
3413
- despription: s.despription,
3414
- color: s.color
3415
- }))
3416
- });
3417
- this.onClickSelect = this.onClickSelect.bind(this);
3418
- }
3419
- onClickSelect = () => {
3420
- this.setState({
3421
- isVisibleDropDown: !this.state.isVisibleDropDown
3422
- });
3423
- this.setState({
3424
- activeClassName: "cwelltSelectDropDown_active"
3425
- });
3426
- };
3427
- handleOnDropDownVisibleChange = () => {
3428
- const dropDown_content = document.getElementsByClassName("cwelltSelectDropDown");
3429
- for (let i = 0; i <= dropDown_content.length; i++) {
3430
- dropDown_content[i]?.addEventListener("mouseleave", () => {
3431
- this.setState({
3432
- isVisibleDropDown: false
3433
- });
3434
- });
3435
- }
3436
- };
3437
- onKeyUpSelect = (e_KeyUp_select) => {
3438
- if (e_KeyUp_select.key === "Enter" || e_KeyUp_select.key === "Escape") {
3439
- this.setState({
3440
- isVisibleDropDown: false
3441
- });
3442
- }
3443
- else {
3444
- this.setState({
3445
- isVisibleDropDown: true
3446
- });
3447
- }
3448
- };
3449
- // mouseHover dropDown active
3450
- onMouseHoverDropDownActive = () => {
3451
- const dropDown_active = document.getElementsByClassName("cwelltSelectDropDown_active");
3452
- const itemArray = () => {
3453
- Array.from(dropDown_active).forEach(index => {
3454
- const dropDown = index;
3455
- dropDown.addEventListener("mouseover", () => { });
3456
- });
3457
- return true;
3458
- };
3459
- if (dropDown_active.length > 0 && itemArray()) {
3460
- return true;
3461
- }
3462
- else {
3463
- return false;
3464
- }
3465
- };
3466
- // clicl cwelltDropDown
3467
- onMouseLeaveMultiSelect = (event_mouseLeave) => {
3468
- const post = event_mouseLeave.currentTarget.getBoundingClientRect();
3469
- const posCursorY = event_mouseLeave.clientY;
3470
- if (posCursorY > post.bottom && this.state.isVisibleDropDown === true) {
3471
- this.setState({
3472
- isVisibleDropDown: true
3473
- });
3474
- }
3475
- else {
3476
- this.setState({
3477
- isVisibleDropDown: false
3478
- });
3479
- }
3480
- };
3481
- render() {
3482
- return (jsxRuntime.jsx("div", { style: {
3483
- display: "flex",
3484
- flexDirection: "row",
3485
- alignItems: "flexStart",
3486
- width: "100%"
3487
- }, id: "contentMultiSelect", onMouseLeave: e => this.onMouseLeaveMultiSelect(e), children: jsxRuntime.jsx("div", { style: { flex: 1 }, children: jsxRuntime.jsx(antd.Select, { autoClearSearchValue: true, mode: "multiple", allowClear: true, style: { width: "100%" }, onChange: this.props.handleChange, optionFilterProp: "description", virtual: true, showArrow: true, size: "middle", className: this.props.selectedItems?.length === 0
3488
- ? "cwelltMultiSelect cwelltSelect cwelltSelectSimple cwelltMultiSelect_searchIcon"
3489
- : "cwelltMultiSelect cwelltSelect cwelltSelectSimple", placeholder: "Search or filter...", dropdownClassName: this.state.isVisibleDropDown
3490
- ? " cwelltSelectDropDown cwelltSelectDropDown_active"
3491
- : "cwelltSelectDropDown", value: this.props.selectedItems?.map(s => s.type + "_" + s.id), onClick: () => this.onClickSelect(), open: this.state.isVisibleDropDown, onDropdownVisibleChange: () => this.handleOnDropDownVisibleChange(), onKeyUp: e_KeyUp_select => this.onKeyUpSelect(e_KeyUp_select), children: this.props.selectLists.map((slArray, i) => (jsxRuntime.jsx(OptGroup, { label: slArray.length > 0 ? slArray[0]?.type : "", children: slArray.map(sl => (jsxRuntime.jsx(Option, { value: sl.type + "_" + sl.id, type: sl.type, description: sl.description, val: sl.id, children: jsxRuntime.jsx(antd.Tag, { color: sl.color, children: sl.description }) }, sl.type + "_" + sl.id))) }, "_" + i))) }) }) }));
3492
- }
3493
- }
3494
-
3495
- function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor, onPrimaryColor) {
3496
- const result = new Set();
3497
- items.forEach((item, index) => {
3498
- result.add({
3499
- ID: `${category}_${index}`,
3500
- Name: item[nameKey] || index,
3501
- Value: item[valueKey] || index,
3502
- Category: category || "Missing Category",
3503
- PrimaryColor: primaryColor || { r: 0, g: 0, b: 0 },
3504
- OnPrimaryColor: onPrimaryColor || { r: 255, g: 255, b: 255 }
3362
+ function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor, onPrimaryColor) {
3363
+ const result = new Set();
3364
+ items.forEach((item, index) => {
3365
+ result.add({
3366
+ ID: `${category}_${index}`,
3367
+ Name: item[nameKey] || index,
3368
+ Value: item[valueKey] || index,
3369
+ Category: category || "Missing Category",
3370
+ PrimaryColor: primaryColor || { r: 0, g: 0, b: 0 },
3371
+ OnPrimaryColor: onPrimaryColor || { r: 255, g: 255, b: 255 }
3505
3372
  });
3506
3373
  });
3507
3374
  return result;
3508
3375
  }
3509
3376
 
3510
- function CwHeadFilter(cwelltFilterTabMultiSelectProps) {
3511
- // - Reference div content input search
3512
- const headContent_ref = React__namespace.createRef();
3513
- const optionList = document.getElementsByClassName("cw-multiselect-option-list");
3514
- const refContent = React.useRef(null);
3515
- // - Hooks show clear button
3516
- const [_isShowClearButton, setShowClearButton] = React.useState(false);
3517
- // - Hooks value of input search
3518
- const [inputValue, setInputValue] = React.useState("");
3519
- // Ref [ input ] ( cwellt_headFilterTab )
3520
- const headInputFitlerTab_ref = React.useRef(null);
3521
- const headFilter_content_tags_ref = React.useRef(null);
3522
- // cwellt_headFilterTab [ onclick ( show dropDown and enable input .focus() )]
3523
- const onClickHeaderFilterTab = () => {
3524
- // Show and hide dropDownContainer - onShowDropDown [ interface ]
3525
- cwelltFilterTabMultiSelectProps.onShowDropDown();
3526
- // Click on dropDown enable input - [ ref : headFitlerTab_ref ] and evaluating not null
3527
- if (headInputFitlerTab_ref.current) {
3528
- headInputFitlerTab_ref.current.focus();
3529
- }
3530
- };
3531
- // - on change input search
3532
- const onChangeInputSearch = (event_onChangeInput) => {
3533
- // let searchInput_length = event_onChangeInput.currentTarget.value.length;
3534
- // if (searchInput_length > 0) {
3535
- // setShowClearButton(true);
3536
- // } else {
3537
- // setShowClearButton(false);
3538
- // }
3539
- setInputValue(event_onChangeInput.currentTarget.value);
3540
- // - onChangeSearch
3541
- cwelltFilterTabMultiSelectProps.onChangeSearch(event_onChangeInput);
3542
- };
3543
- // - clear input value
3544
- const onClearInputValue = (e) => {
3545
- setInputValue("");
3546
- setShowClearButton(false);
3547
- // onClearValue
3548
- cwelltFilterTabMultiSelectProps.onClearValue(e);
3549
- };
3550
- // - onKeyPress
3551
- const onKeyPressInput = (event_keyPress) => {
3552
- if (typeof cwelltFilterTabMultiSelectProps.onKeypressInput === "function") {
3553
- cwelltFilterTabMultiSelectProps.onKeypressInput(event_keyPress);
3554
- // clear input field
3555
- if (event_keyPress.key === "Enter") {
3556
- setInputValue("");
3557
- }
3558
- }
3559
- };
3560
- const handleBlur = (event) => {
3561
- if (typeof cwelltFilterTabMultiSelectProps.onBlur === "function") {
3562
- cwelltFilterTabMultiSelectProps.onBlur(event);
3563
- }
3564
- };
3565
- const clickOptionList = () => {
3566
- if (optionList.length > 0) {
3567
- Array.from(optionList).forEach(index => {
3568
- const optionListItem = index;
3569
- optionListItem.addEventListener("click", () => {
3570
- setInputValue("");
3571
- });
3572
- });
3573
- }
3574
- };
3575
- //#region useEffect
3576
- React.useEffect(() => {
3577
- window.addEventListener("keypress", onKeyPressInput);
3578
- clickOptionList();
3579
- return () => {
3580
- window.removeEventListener("keypress", onKeyPressInput);
3581
- };
3582
- });
3583
- //#endregion
3584
- return (jsxRuntime.jsxs("div", { className: cwelltFilterTabMultiSelectProps.className + " cw-headfilter", style: cwelltFilterTabMultiSelectProps.style, id: cwelltFilterTabMultiSelectProps.Id, onMouseLeave: cwelltFilterTabMultiSelectProps.onMouseLeave, ref: refContent, children: [jsxRuntime.jsxs("div", { className: "cw-headfilter-wrapper", onClick: () => onClickHeaderFilterTab(), children: [jsxRuntime.jsx(CwIcon, { iconId: "search", size: "large" }), jsxRuntime.jsxs("div", { className: "cw-headfilter-content", children: [jsxRuntime.jsx("div", { className: "cw-flex-row cw-gap-small cw-align-left-center cw-flex-wrap", ref: headFilter_content_tags_ref, children: cwelltFilterTabMultiSelectProps.tagValueContent }), jsxRuntime.jsx("div", { className: "headFilter_search_content", ref: headContent_ref, children: jsxRuntime.jsx("input", { id: "headFilter_inputSearch", value: inputValue, onKeyPress: event_keyPress => onKeyPressInput(event_keyPress), onBlur: handleBlur, type: "search", onChange: event_onChangeInput => onChangeInputSearch(event_onChangeInput), placeholder: cwelltFilterTabMultiSelectProps.placeholder_desc, ref: headInputFitlerTab_ref }) })] }), jsxRuntime.jsx(CwIcon, { iconId: "close-circle", onClick: (e) => onClearInputValue(e) })] }), cwelltFilterTabMultiSelectProps.children] }));
3585
- }
3586
-
3587
- function CwOptionList(optionListProps) {
3588
- //#region References
3589
- // - Ref : optionList
3590
- const optionListSelected_ref = React__namespace.createRef();
3591
- const optionListSelected_input_ref = React__namespace.createRef();
3592
- //#endregion
3593
- //#region Hooks
3594
- // - Hooks : selected optionList
3595
- // const [isSelectedOptionList, setIsSelectedOptionList] = useState(optionListProps.isSelected || false);
3596
- //#endregion
3597
- //#region Functions
3598
- const onClickSelectOptionList = (event_click) => {
3599
- // - click of custom component
3600
- // onSelectedOptionList();
3601
- // - click of property interface
3602
- optionListProps.onClick(event_click);
3603
- };
3604
- const onKeyPressOptionList = (event_onKeyPress) => {
3605
- if (typeof optionListProps.onKeyPress === "function") {
3606
- optionListProps.onKeyPress(event_onKeyPress);
3607
- }
3608
- };
3609
- //#endregion
3610
- //#region Useffect
3611
- React.useEffect(() => {
3612
- window.addEventListener("keypress", onKeyPressOptionList);
3613
- return () => {
3614
- window.removeEventListener("keypress", onKeyPressOptionList);
3615
- };
3616
- }, []);
3617
- //#endregion
3618
- return (jsxRuntime.jsxs("div", { className: `cw-multiselect-option-list${optionListProps.isSelected ? ' option-active' : ''}`, onClick: event_click => onClickSelectOptionList(event_click), id: optionListProps.idOptionList, ref: optionListSelected_ref, "aria-value-text": optionListProps.value, onKeyPress: event_onKeyPress => onKeyPressOptionList(event_onKeyPress), style: optionListProps.style, children: [jsxRuntime.jsx("label", { htmlFor: optionListProps.idOptionList, children: optionListProps.children }), jsxRuntime.jsx("input", { type: "checkbox", value: optionListProps.value, ref: optionListSelected_input_ref, id: optionListProps.idOptionList, onClick: optionListProps.onChangeOptionList })] }));
3619
- }
3620
-
3621
- //#endregion
3622
- function CwMultiselect(CwelltCustomFilterTabProps) {
3623
- //#region Reference
3624
- const refOptionListContent = React.useRef(null);
3625
- const containerRef = React.useRef(null);
3626
- //#endregion
3627
- //#region Hooks
3628
- const [isShowDropDownfiltered, setShowDropDownfiltered] = React.useState(false);
3629
- // const [tagValue, setTagValue] = useState<{
3630
- // tagDesc: string;
3631
- // bgContent: string;
3632
- // bgTag: string;
3633
- // color: string;
3634
- // }[]>([]);
3635
- // Hook active label filter item tab [ All ]
3636
- const [isActive_filter_item_all, setActive_filter_item_all] = React.useState(true);
3637
- // Hook active laberl fitler item tab [ e.g.: Duty ]
3638
- const [isActive_filter_item, setActive_filter_item] = React.useState(null);
3639
- // Hook isSelected option list
3640
- //const [isSelected_optionList, setSelected_optionList] = useState<{ [key: string]: boolean }>({});
3641
- //#endregion
3642
- //#region Functions
3643
- //#region CwelltFilterTabMultiSelect [ properties functions ]
3644
- //#region onClearValue
3645
- const clearValue = (e_clear) => {
3646
- // List items to remove class and be visible
3647
- // Item searched
3648
- const itemSearched = document.getElementsByClassName("item-search");
3649
- // Item hidden
3650
- const itemHidden = document.getElementsByClassName("hidden-item");
3651
- // Item searcched
3652
- if (itemSearched.length > 0) {
3653
- for (let i = 0; i <= itemSearched.length; i++) {
3654
- itemSearched[i]?.classList.remove("item-search");
3655
- }
3656
- }
3657
- // Item hidden
3658
- if (itemHidden.length > 0) {
3659
- for (let i = 0; i <= itemHidden.length; i++) {
3660
- itemHidden[i]?.classList.remove("hidden-item");
3661
- }
3662
- }
3663
- // optionList [ disbaled active className according their text ]
3664
- const parent = e_clear.currentTarget.parentElement.parentElement;
3665
- const optionActive = parent.getElementsByClassName("option-active");
3666
- const valueIds = [];
3667
- const resultList = [];
3668
- if (optionActive.length > 0) {
3669
- CwelltCustomFilterTabProps.onclickHandleChange(valueIds, resultList);
3670
- Array.from(optionActive).forEach(index => {
3671
- const optionActive_array = index;
3672
- optionActive_array.classList.remove("option-active");
3673
- });
3674
- }
3675
- };
3676
- //#endregion
3677
- //#region onChangeSearch
3678
- const onChangeSearch = (e_onchange) => {
3679
- const filterText_lowerCase = e_onchange.currentTarget.value.toLowerCase();
3680
- // Tags for filtering
3681
- const listTag = document.getElementsByClassName("cw-multiselect-option-list");
3682
- for (let i = 0; i <= listTag.length; i++) {
3683
- if (listTag[i] !== undefined) {
3684
- const textTagValue = listTag[i].textContent;
3685
- // Writting
3686
- if (textTagValue?.toLowerCase().includes(filterText_lowerCase)) {
3687
- listTag[i].classList.add("item-search");
3688
- }
3689
- else {
3690
- listTag[i].classList.add("hidden-item");
3691
- }
3692
- // remove written
3693
- if (!textTagValue?.toLowerCase().includes(filterText_lowerCase)) {
3694
- listTag[i].classList.remove("item-search");
3695
- }
3696
- else {
3697
- listTag[i].classList.remove("hidden-item");
3698
- }
3699
- if (filterText_lowerCase === "") {
3700
- listTag[i].classList.remove("item-search");
3701
- }
3702
- }
3703
- }
3704
- // Length of string > 0 show dropDownContainerComp
3705
- if (e_onchange.currentTarget.value.length > 0) {
3706
- setShowDropDownfiltered(true);
3707
- }
3708
- };
3709
- //#endregion
3710
- //#region onKeyPressInput
3711
- const onKeyPressSearch = (event_onKeypress) => {
3712
- //#region Variables
3713
- const keyPressed = event_onKeypress.key;
3714
- const optionSearched = document.getElementsByClassName("item-search");
3715
- //#endregion
3716
- // first item selected or same text
3717
- const optionArray = Array.from(optionSearched);
3718
- if (optionArray.length > 0 && keyPressed === "Enter" && event_onKeypress.currentTarget.value !== "") {
3719
- const firstElement_optionList = optionArray[0];
3720
- const textContent = firstElement_optionList.textContent;
3721
- const elementList = CwelltCustomFilterTabProps.selectListsItems?.find(e => e.find(el => el.description === textContent));
3722
- const element = elementList?.find(el => el.description === textContent);
3723
- if (element !== undefined) {
3724
- const exist = CwelltCustomFilterTabProps.selectedListsItems?.some(s => s.description === textContent);
3725
- if (exist === false) {
3726
- handleClickTag(element);
3727
- }
3728
- }
3729
- const optionList_item_hidden = document.getElementsByClassName("hidden-item");
3730
- if (optionList_item_hidden.length > 0) {
3731
- Array.from(optionList_item_hidden).forEach(index => {
3732
- const optionList_hidden_array = index;
3733
- if (optionList_hidden_array.classList.contains("hidden-item")) {
3734
- optionList_hidden_array.classList.remove("hidden-item");
3735
- }
3736
- });
3737
- }
3738
- }
3739
- };
3740
- //#endregion
3741
- //#region ShowDropDownFilter
3742
- const showDropDownfiltered = () => {
3743
- setShowDropDownfiltered(!isShowDropDownfiltered);
3744
- };
3745
- //#endregion
3746
- class SelectListTest {
3747
- description;
3748
- key;
3749
- type;
3750
- typeName;
3751
- val;
3752
- value;
3753
- active;
3754
- }
3755
- const handleClickTag = (e) => {
3756
- const preList = CwelltCustomFilterTabProps.selectedListsItems || [];
3757
- const valueIds = [];
3758
- const resultList = preList?.map(s => {
3759
- const item = new SelectListTest();
3760
- item.description = s.description;
3761
- item.key = s.type + "_" + s.id;
3762
- item.type = s.type;
3763
- item.val = s.id;
3764
- item.value = item.key;
3765
- item.active = s.active ?? false;
3766
- valueIds.push(item.key);
3767
- return item;
3768
- });
3769
- const a = new SelectListTest();
3770
- a.description = e.description;
3771
- a.key = e.type + "_" + e.id;
3772
- a.type = e.type;
3773
- a.val = e.id;
3774
- a.value = a.key;
3775
- a.active = e.active;
3776
- const exist = resultList?.some(item => item.key === a.key);
3777
- if (exist) {
3778
- a.active = false;
3779
- const list = resultList?.filter(item => item.key !== a.key);
3780
- const values = valueIds.filter(v => v !== a.key);
3781
- CwelltCustomFilterTabProps.onclickHandleChange(values, list);
3782
- }
3783
- else {
3784
- a.active = true;
3785
- resultList?.push(a);
3786
- valueIds.push(a.key);
3787
- CwelltCustomFilterTabProps.onclickHandleChange(valueIds, resultList);
3788
- }
3789
- // // Selected item option list
3790
- // setSelected_optionList((prevSelectedStates) => ({
3791
- // ...prevSelectedStates,
3792
- // [a.key]: !prevSelectedStates[a.key],
3793
- // }));
3794
- // clear filter by text after clicked in option list
3795
- const optionList_item_hidden = document.getElementsByClassName("hidden-item");
3796
- if (optionList_item_hidden.length > 0) {
3797
- Array.from(optionList_item_hidden).forEach(index => {
3798
- const optionList_hidden_array = index;
3799
- if (optionList_hidden_array.classList.contains("hidden-item")) {
3800
- optionList_hidden_array.classList.remove("hidden-item");
3801
- }
3802
- });
3803
- }
3804
- // Check click from option list has custom tag header of custom filter tab
3805
- const tagActive = document.getElementsByClassName("multiselect-active-tag");
3806
- const optionList = document.getElementsByClassName("cw-multiselect-option-list");
3807
- if (tagActive.length > 0 && optionList.length > 0) {
3808
- Array.from(tagActive).forEach(_index => {
3809
- Array.from(optionList).forEach(index => {
3810
- const optionList_array = index;
3811
- const optionId = optionList_array.getAttribute('data-id');
3812
- if (optionId === (e.type + "_" + e.id)) {
3813
- optionList_array.classList.remove("option-active");
3814
- }
3815
- });
3816
- });
3817
- }
3818
- const optionList_desc = document.getElementsByClassName("option-active");
3819
- if (optionList_desc.length > 0) {
3820
- Array.from(optionList_desc).forEach(index => {
3821
- const optionList_desc_array = index;
3822
- if (optionList_desc_array.innerText === a.description) {
3823
- optionList_desc_array.classList.remove("option-active");
3824
- }
3825
- });
3826
- }
3827
- // Click to hide dropDownContainer
3828
- setShowDropDownfiltered(false);
3829
- };
3830
- // [ click custom tag ]
3831
- const closeTagHandle = (e) => {
3832
- const preList = CwelltCustomFilterTabProps.selectedListsItems;
3833
- const valueIds = [];
3834
- const resultList = preList?.map(s => {
3835
- const item = new SelectListTest();
3836
- item.description = s.description;
3837
- item.key = s.type + "_" + s.id;
3838
- item.type = s.type;
3839
- item.val = s.id;
3840
- item.value = item.key;
3841
- valueIds.push(item.key);
3842
- return item;
3843
- });
3844
- const a = new SelectListTest();
3845
- a.description = e.description;
3846
- a.key = e.type + "_" + e.id;
3847
- a.type = e.type;
3848
- a.val = e.id;
3849
- a.value = a.key;
3850
- const resultListFilter = resultList?.filter(item => item.key !== a.key);
3851
- const valueIdsFilter = valueIds.filter(item => item !== a.key);
3852
- CwelltCustomFilterTabProps.onclickHandleChange(valueIdsFilter, resultListFilter);
3853
- // // Selected item option list - remove active option list
3854
- // setSelected_optionList((prevSelectedStates) => ({
3855
- // ...prevSelectedStates,
3856
- // [a.key]: false[a.key],
3857
- // }));
3858
- const optionList_active = document.getElementsByClassName("option-active");
3859
- if (optionList_active.length > 0) {
3860
- Array.from(optionList_active).forEach(index => {
3861
- const optionList_active_array = index;
3862
- const optionId = optionList_active_array.getAttribute('data-id');
3863
- if (optionId === (e.type + "_" + e.id)) {
3864
- optionList_active_array.classList.remove("option-active");
3865
- }
3866
- });
3867
- }
3868
- };
3869
- //#endregion
3870
- //#region DropDownContainer [ properties functions ]
3871
- //#region onKeyDownDropDownContainer [ press ESC dropDownContainer dissapear - ArrowUp && ArrowDown ]
3872
- const onKeyDownDropDownContent = (event_onKeyDown) => {
3873
- const items = document.querySelectorAll(".cw-multiselect-option-list");
3874
- let optionIndex = Array.from(items).findIndex(item => item.classList.contains("keyboard-focus"));
3875
- if (event_onKeyDown.key === "Escape") {
3876
- // DropDown disappear
3877
- setShowDropDownfiltered(false);
3878
- }
3879
- // KeyDown
3880
- if (event_onKeyDown.key === "ArrowDown") {
3881
- event_onKeyDown.preventDefault();
3882
- removeHighlight();
3883
- optionIndex = getNextIndex(optionIndex, items.length);
3884
- highlightOption(optionIndex);
3885
- }
3886
- // KeyUp
3887
- if (event_onKeyDown.key === "ArrowUp") {
3888
- event_onKeyDown.preventDefault();
3889
- removeHighlight();
3890
- optionIndex = getPreviousIndex(optionIndex, items.length);
3891
- highlightOption(optionIndex);
3892
- }
3893
- };
3894
- const removeHighlight = () => {
3895
- const highlightedItem = document.querySelector(".keyboard-focus");
3896
- if (highlightedItem) {
3897
- highlightedItem.classList.remove("keyboard-focus");
3898
- }
3899
- };
3900
- const getNextIndex = (currentIndex, length) => {
3901
- return (currentIndex + 1) % length;
3902
- };
3903
- const getPreviousIndex = (currentIndex, length) => {
3904
- return (currentIndex - 1 + length) % length;
3905
- };
3906
- const highlightOption = (index) => {
3907
- const items = document.querySelectorAll(".cw-multiselect-option-list");
3908
- const item = items[index];
3909
- item.classList.add("keyboard-focus");
3910
- };
3911
- //#endregion
3912
- //#region onMouseLeave
3913
- const handleInputBlur = () => {
3914
- setTimeout(() => {
3915
- if (!containerRef.current?.contains(document.activeElement)) {
3916
- setShowDropDownfiltered(false);
3917
- }
3918
- }, 150);
3919
- };
3920
- React.useEffect(() => {
3921
- const handleClickOutside = (event) => {
3922
- if (containerRef.current && !containerRef.current.contains(event.target)) {
3923
- setShowDropDownfiltered(false);
3924
- }
3925
- };
3926
- document.addEventListener('mousedown', handleClickOutside);
3927
- return () => {
3928
- document.removeEventListener('mousedown', handleClickOutside);
3929
- };
3930
- }, []);
3931
- //#endregion
3932
- // Click filter item button
3933
- const clickFilter_item = (id) => {
3934
- // content items - looking for className by it - corresponded by their current group
3935
- const contentItems = document.getElementsByClassName(id);
3936
- const contentAll = document.getElementsByClassName("multiselect-tag-group");
3937
- if (contentAll.length > 0) {
3938
- Array.from(contentAll).forEach(index => {
3939
- const contentAll_array = index;
3940
- contentAll_array.classList.add("hidden-group");
3941
- });
3942
- }
3943
- if (contentItems.length > 0) {
3944
- Array.from(contentItems).forEach(index => {
3945
- const contentItems_array = index;
3946
- contentItems_array.classList.remove("hidden-group");
3947
- });
3948
- }
3949
- // Adding custom className acitive
3950
- setActive_filter_item(id);
3951
- // Remove active className [ label tab : ( ALL ) ]
3952
- setActive_filter_item_all(false);
3953
- };
3954
- const showAllItem = () => {
3955
- //let currentBtn = e.currentTarget;
3956
- const contentAll = document.getElementsByClassName("multiselect-tag-group");
3957
- if (contentAll.length > 0) {
3958
- Array.from(contentAll).forEach(index => {
3959
- const contentAll_array = index;
3960
- contentAll_array.classList.remove("hidden-group");
3961
- // active className - all
3962
- setActive_filter_item_all(true);
3963
- setActive_filter_item("");
3964
- });
3965
- }
3966
- };
3967
- //#endregion
3968
- React.useEffect(() => {
3969
- if (CwelltCustomFilterTabProps.selectedListsItems) {
3970
- const allOptions = document.getElementsByClassName("cw-multiselect-option-list");
3971
- Array.from(allOptions).forEach(option => {
3972
- option.classList.remove("option-active");
3973
- });
3974
- CwelltCustomFilterTabProps.selectedListsItems.forEach(selectedItem => {
3975
- Array.from(allOptions).forEach(option => {
3976
- const optionElement = option;
3977
- if (optionElement.innerText === selectedItem.description) {
3978
- optionElement.classList.add("option-active");
3979
- }
3980
- });
3981
- });
3982
- }
3983
- }, [CwelltCustomFilterTabProps.selectedListsItems]);
3984
- return (jsxRuntime.jsx("div", { ref: containerRef, children: jsxRuntime.jsx(CwHeadFilter, { Id: CwelltCustomFilterTabProps.id, onChangeSearch: (e_onchange) => onChangeSearch(e_onchange), onClearValue: (e_clear) => clearValue(e_clear), onKeypressInput: onKeyPressSearch, onShowDropDown: showDropDownfiltered, placeholder_desc: CwelltCustomFilterTabProps.placeholder, style: CwelltCustomFilterTabProps.style, onBlur: handleInputBlur,
3985
- // onMouseLeave={onMouseLeave_dropDownContainer}
3986
- className: CwelltCustomFilterTabProps.selectedListsItems?.length === 0
3987
- ? "cw-filter-tab-multi-select-show-icon"
3988
- : "cw-filter-tab-multi-select-hidden-icon", tagValueContent: jsxRuntime.jsx("div", { className: "cw-flex-row cw-gap-small", children: CwelltCustomFilterTabProps.selectedListsItems?.map((s, index) => {
3989
- return s.type !== undefined ? (jsxRuntime.jsx(CwTag, { styleTag: {
3990
- background: s.color,
3991
- color: getContrastColor(s.color),
3992
- }, idTag: s.type + "_" + s.id, closableTag: true, onClickClosableTag: () => closeTagHandle(s), "data-id": s.type + "_" + s.id, className: "multiselect-active-tag", children: s.description }, index)) : (jsxRuntime.jsx("div", {}));
3993
- }) }), children: jsxRuntime.jsx(CwDropdownContainer, { dropDownState: isShowDropDownfiltered, idDropDownContainer: CwelltCustomFilterTabProps.idDropDownContainer, onKeyDownDropDownContainer: (event_onKeyDown) => onKeyDownDropDownContent(event_onKeyDown), children: jsxRuntime.jsxs("div", { className: "cw-multiselect-dropdown", children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx("label", { "data-active": isActive_filter_item_all, onClick: showAllItem, children: "ALL" }), CwelltCustomFilterTabProps.selectListsItems?.map((slArray, i) => (jsxRuntime.jsx("label", { "data-active": isActive_filter_item === 'content_' + i,
3994
- // todo : giving parameter by id to search by their corresponding group it list options and className content with their id in this case key ( i ) by .map function
3995
- onClick: () => clickFilter_item("content_" + i), id: "content_" + i, children: slArray.length > 0 && slArray[0].typeName !== undefined
3996
- ? slArray[0].typeName
3997
- : slArray.length > 0
3998
- ? slArray[0].type
3999
- : "" }, i)))] }), jsxRuntime.jsx("div", { className: "cw-multiselect-tags-container", children: CwelltCustomFilterTabProps.selectListsItems?.map((slArray, i) => (jsxRuntime.jsx("div", { id: "content_" + i, className: `multiselect-tag-group content_${i}`, ref: refOptionListContent, children: slArray.map(sl => {
4000
- const isSelected = CwelltCustomFilterTabProps.selectedListsItems?.some(selected => selected.type === sl.type && selected.id === sl.id) || false;
4001
- return (jsxRuntime.jsx(CwOptionList, { idOptionList: sl.type + "_" + sl.id, value: sl.type + "_" + sl.id, title: sl.description, onClick: () => handleClickTag(sl), isSelected: sl.active, "data-id": sl.type + "_" + sl.id, children: jsxRuntime.jsx(CwTag, { styleTag: {
4002
- background: sl.color,
4003
- color: getContrastColor(sl.color),
4004
- }, closableTag: isSelected, children: sl.description }) }, sl.type + "_" + sl.id));
4005
- }) }, "group" + i))) })] }) }) }) }));
4006
- }
4007
-
4008
- var styles$7 = {"cw-multifilter-tag":"cw-multi-filter-tag-module_cw-multifilter-tag__Epda-"};
3377
+ var styles$8 = {"cw-multifilter-tag":"cw-multi-filter-tag-module_cw-multifilter-tag__Epda-"};
4009
3378
 
4010
3379
  const CwMultiFilterTag = props => {
4011
- const { ID, Name, Value, Category, Removable, PrimaryColor, OnPrimaryColor, Selectable, Selected, OnSelect } = props;
4012
- const BackgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
4013
- const TextColor = `rgb(${OnPrimaryColor.r},${OnPrimaryColor.g},${OnPrimaryColor.b})`;
4014
- return (jsxRuntime.jsxs("li", { className: styles$7["cw-multifilter-tag"], "data-selected": !!props.Selected, "data-removable": !!props.Removable, style: {
4015
- color: TextColor,
4016
- backgroundColor: BackgroundColor,
4017
- opacity: Selected && !Removable ? "0.5" : "1",
4018
- outlineColor: TextColor
4019
- }, onClick: () => {
3380
+ const { ID, Name, Value, Category, Removable, PrimaryColor, Selectable, Selected } = props;
3381
+ const backgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
3382
+ const isOutlineMode = Selected && !Removable;
3383
+ return (jsxRuntime.jsx("li", { className: styles$8["cw-multifilter-tag"], id: ID, "data-value": Value, "data-category": Category, "data-selected": !!Selected, title: Name, onClick: () => {
4020
3384
  if (Selectable)
4021
- OnSelect?.(props);
4022
- }, children: [jsxRuntime.jsx("span", { id: ID, "data-value": Value, "data-category": Category, children: Name }), Removable && (jsxRuntime.jsx("span", { onClick: () => props.OnRemove?.(props), children: jsxRuntime.jsx(CwIcon, { iconId: "close" }) }))] }));
3385
+ props.OnSelect?.(props);
3386
+ }, children: jsxRuntime.jsx(CwChip, { label: Name, colorScheme: "custom", customColor: backgroundColor, variant: isOutlineMode ? "outline" : "soft", closable: Removable, onClose: () => props.OnRemove?.(props),
3387
+ // This style ensures the chip color is accessible over white background
3388
+ style: isOutlineMode ? {
3389
+ '--chip-accent': `hsl(from ${backgroundColor} h s 40)`
3390
+ } : undefined }) }));
4023
3391
  };
4024
3392
 
4025
- var styles$6 = {"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","cw-multi-filter-search":"cw-multi-filter-module_cw-multi-filter-search__eyHr0"};
3393
+ var styles$7 = {"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","cw-multi-filter-search":"cw-multi-filter-module_cw-multi-filter-search__eyHr0"};
4026
3394
 
4027
3395
  /**
4028
3396
  * A multiple filter selector, a MULTI-SELECT even. Allows users to select and filter items based on tags.
@@ -4037,7 +3405,7 @@ var styles$6 = {"cw-multi-filter-catalog-container":"cw-multi-filter-module_cw-m
4037
3405
  * - `Category`: Group the filter belongs to
4038
3406
  * - `ID`: Unique identifier for the filter
4039
3407
  * - `PrimaryColor`: Background color of the tag
4040
- * - `OnPrimaryColor`: Text color of the tag
3408
+ * - `OnPrimaryColor`: (Optional, deprecated) Text color of the tag - contrast is now calculated automatically
4041
3409
  *
4042
3410
  * ```
4043
3411
  * ╭───────────────────────────────────────────────────────────────╮
@@ -4079,7 +3447,6 @@ var styles$6 = {"cw-multi-filter-catalog-container":"cw-multi-filter-module_cw-m
4079
3447
  * Value: "admin",
4080
3448
  * Category: "Roles",
4081
3449
  * ID: "Roles_admin",
4082
- * OnPrimaryColor: hexToRGB("#2050a8"),
4083
3450
  * PrimaryColor: hexToRGB("#cedcff")
4084
3451
  * },
4085
3452
  * {
@@ -4087,7 +3454,6 @@ var styles$6 = {"cw-multi-filter-catalog-container":"cw-multi-filter-module_cw-m
4087
3454
  * Value: "user",
4088
3455
  * Category: "Roles",
4089
3456
  * ID: "Roles_user",
4090
- * OnPrimaryColor: hexToRGB("#2050a8"),
4091
3457
  * PrimaryColor: hexToRGB("#cedcff")
4092
3458
  * },
4093
3459
  * {
@@ -4095,7 +3461,6 @@ var styles$6 = {"cw-multi-filter-catalog-container":"cw-multi-filter-module_cw-m
4095
3461
  * Value: "IT",
4096
3462
  * Category: "Departments",
4097
3463
  * ID: "Departments_IT",
4098
- * OnPrimaryColor: hexToRGB("#a82037"),
4099
3464
  * PrimaryColor: hexToRGB("#ffceda")
4100
3465
  * },
4101
3466
  * {
@@ -4103,7 +3468,6 @@ var styles$6 = {"cw-multi-filter-catalog-container":"cw-multi-filter-module_cw-m
4103
3468
  * Value: "HR",
4104
3469
  * Category: "Departments",
4105
3470
  * ID: "Departments_HR",
4106
- * OnPrimaryColor: hexToRGB("#a82037"),
4107
3471
  * PrimaryColor: hexToRGB("#ffceda")
4108
3472
  * }
4109
3473
  * ]);
@@ -4207,9 +3571,10 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
4207
3571
  const getColor = (category) => {
4208
3572
  const test = categoriesMappedToTags().get(category)?.values().next().value;
4209
3573
  if (test !== undefined) {
3574
+ const primaryColor = rgbAString(test.PrimaryColor.r, test.PrimaryColor.g, test.PrimaryColor.b);
4210
3575
  return {
4211
- onPrimary: rgbAString(test.OnPrimaryColor.r, test.OnPrimaryColor.g, test.OnPrimaryColor.b),
4212
- primary: rgbAString(test.PrimaryColor.r, test.PrimaryColor.g, test.PrimaryColor.b),
3576
+ onPrimary: getContrastColor(primaryColor),
3577
+ primary: primaryColor,
4213
3578
  };
4214
3579
  }
4215
3580
  else {
@@ -4268,9 +3633,9 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
4268
3633
  inputRef.current?.focus();
4269
3634
  }
4270
3635
  };
4271
- return (jsxRuntime.jsxs("form", { ref: componentRef, id: id, className: styles$6["cw-multi-filter"], style: style, onSubmit: (e) => {
3636
+ return (jsxRuntime.jsxs("form", { ref: componentRef, id: id, className: styles$7["cw-multi-filter"], style: style, onSubmit: (e) => {
4272
3637
  e.preventDefault();
4273
- }, children: [jsxRuntime.jsxs("div", { onClick: handleDivClick, className: styles$6["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-color-primary)", outlineOffset: "-2px" } : {}, children: [jsxRuntime.jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (React.createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsxRuntime.jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.target.value), autoComplete: "off", placeholder: "Write to filter", onKeyDown: e => {
3638
+ }, children: [jsxRuntime.jsxs("div", { onClick: handleDivClick, className: styles$7["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-color-primary)", outlineOffset: "-2px" } : {}, children: [jsxRuntime.jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (React.createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsxRuntime.jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.target.value), autoComplete: "off", placeholder: "Write to filter", onKeyDown: e => {
4274
3639
  switch (e.key) {
4275
3640
  case "Enter":
4276
3641
  case "Tab":
@@ -4291,7 +3656,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
4291
3656
  } })] }), selectedTags.size > 0 ? (jsxRuntime.jsx("input", { type: "reset", value: "\u00D7", onClick: e => {
4292
3657
  e.preventDefault();
4293
3658
  onChangeSelectedTags(new Set());
4294
- } })) : null] }), jsxRuntime.jsxs("section", { className: styles$6["cw-multi-filter-catalog-container"], "data-display-none": !isPanelOpen, children: [jsxRuntime.jsxs("nav", { children: [jsxRuntime.jsx("button", { style: selectedCategory === "All"
3659
+ } })) : null] }), jsxRuntime.jsxs("section", { className: styles$7["cw-multi-filter-catalog-container"], "data-display-none": !isPanelOpen, children: [jsxRuntime.jsxs("nav", { children: [jsxRuntime.jsx("button", { style: selectedCategory === "All"
4295
3660
  ? {
4296
3661
  backgroundColor: "var(--cw-color-primary-container)",
4297
3662
  color: "var(--cw-color-primary)",
@@ -4318,7 +3683,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
4318
3683
  } }, props.ID))) })] })] }));
4319
3684
  };
4320
3685
 
4321
- var styles$5 = {"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"};
3686
+ var styles$6 = {"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"};
4322
3687
 
4323
3688
  function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null }) {
4324
3689
  const [expanded, setExpanded] = React.useState(new Set());
@@ -4385,10 +3750,10 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
4385
3750
  const isLeaf = !hasChildren;
4386
3751
  const isSelected = selectedId?.toString().toLowerCase() === node.id.toString().toLowerCase();
4387
3752
  const selectable = allowParentSelection || isLeaf;
4388
- return (jsxRuntime.jsxs("div", { className: styles$5["tree-item"], children: [jsxRuntime.jsxs("div", { className: [
4389
- styles$5["tree-node"],
4390
- isSelected && styles$5["selected"],
4391
- !selectable && styles$5["non-selectable"]
3753
+ return (jsxRuntime.jsxs("div", { className: styles$6["tree-item"], children: [jsxRuntime.jsxs("div", { className: [
3754
+ styles$6["tree-node"],
3755
+ isSelected && styles$6["selected"],
3756
+ !selectable && styles$6["non-selectable"]
4392
3757
  ].filter(Boolean).join(' '), style: { paddingLeft: `${depth * 24 + 8}px` }, onClick: () => {
4393
3758
  if (selectable) {
4394
3759
  setSelectedId(node.id);
@@ -4397,7 +3762,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
4397
3762
  else {
4398
3763
  toggleExpand(node.id);
4399
3764
  }
4400
- }, children: [hasChildren && (jsxRuntime.jsx(CwIcon, { size: "large", iconId: isExpanded ? "chevron-down" : "chevron-right" })), jsxRuntime.jsx("div", { className: `${styles$5["tree-label"]} ${!hasChildren ? styles$5["tree-spacer"] : ''}`, children: node.label })] }), hasChildren && isExpanded && (jsxRuntime.jsx("div", { className: styles$5["tree-children"], children: node.children.map((child) => renderNode(child, depth + 1)) }))] }, node.id));
3765
+ }, children: [hasChildren && (jsxRuntime.jsx(CwIcon, { size: "large", iconId: isExpanded ? "chevron-down" : "chevron-right" })), jsxRuntime.jsx("div", { className: `${styles$6["tree-label"]} ${!hasChildren ? styles$6["tree-spacer"] : ''}`, children: node.label })] }), hasChildren && isExpanded && (jsxRuntime.jsx("div", { className: styles$6["tree-children"], children: node.children.map((child) => renderNode(child, depth + 1)) }))] }, node.id));
4401
3766
  };
4402
3767
  // Function to search for nodes that match the search term
4403
3768
  const searchInTree = (nodes, searchTerm) => {
@@ -4421,7 +3786,7 @@ function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId:
4421
3786
  return results;
4422
3787
  };
4423
3788
  const filteredData = searchInTree(data, search);
4424
- return (jsxRuntime.jsxs("div", { className: `cw-tree-view ${styles$5["tree-container"]}`, children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx("input", { type: "text", placeholder: "Search in tree...", value: search, onChange: (e) => setSearch(e.target.value) }), search && (jsxRuntime.jsx(CwButton, { onClick: () => setSearch(""), type: "button", icon: "close", variant: "icon", color: "neutral" }))] }), jsxRuntime.jsx("div", { className: styles$5["tree-wrapper"], children: filteredData.length > 0 ? (filteredData.map((node) => renderNode(node))) : (jsxRuntime.jsxs("div", { className: styles$5["empty-state"], children: [jsxRuntime.jsx(CwIcon, { iconId: "comment" }), search ? "No results found" : "There are no items"] })) })] }));
3789
+ return (jsxRuntime.jsxs("div", { className: `cw-tree-view ${styles$6["tree-container"]}`, children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx("input", { type: "text", placeholder: "Search in tree...", value: search, onChange: (e) => setSearch(e.target.value) }), search && (jsxRuntime.jsx(CwButton, { onClick: () => setSearch(""), type: "button", icon: "close", variant: "icon", color: "neutral" }))] }), jsxRuntime.jsx("div", { className: styles$6["tree-wrapper"], children: filteredData.length > 0 ? (filteredData.map((node) => renderNode(node))) : (jsxRuntime.jsxs("div", { className: styles$6["empty-state"], children: [jsxRuntime.jsx(CwIcon, { iconId: "comment" }), search ? "No results found" : "There are no items"] })) })] }));
4425
3790
  }
4426
3791
 
4427
3792
  function CwSearchInput(optionsProps) {
@@ -4429,363 +3794,1810 @@ function CwSearchInput(optionsProps) {
4429
3794
  const [filteredOptions, setFilteredOptions] = React.useState([]);
4430
3795
  const [_selectedOption, setSelectedOption] = React.useState(null);
4431
3796
  const [showDropdown, setShowDropdown] = React.useState(false);
3797
+ const [isLoading, setIsLoading] = React.useState(false);
3798
+ // Extract props
3799
+ const { labelProps, iconProps, alignProps, selectList, handleChange, placeholder = "Search…", disabled, renderOption, style, id, className, defaultValue, ...otherProps } = optionsProps;
3800
+ // Get direction for data attribute
3801
+ const direction = alignProps?.flexDirection || "row";
4432
3802
  // Make default value selection when loading the component
4433
3803
  React.useEffect(() => {
4434
- if (optionsProps.defaultValue && optionsProps.selectList && optionsProps.selectList.length > 0) {
4435
- const defaultOption = optionsProps.selectList.find(option => option.id === optionsProps.defaultValue?.toString());
3804
+ if (defaultValue && selectList && selectList.length > 0) {
3805
+ setIsLoading(true);
3806
+ const defaultOption = selectList.find(option => option.id === defaultValue?.toString());
4436
3807
  if (defaultOption) {
4437
3808
  setSearchText(defaultOption.description);
4438
3809
  setSelectedOption(defaultOption);
4439
- // Notify the parent component if there is a handleChange
4440
- if (optionsProps.handleChange) {
4441
- optionsProps.handleChange(defaultOption.id);
3810
+ if (handleChange) {
3811
+ handleChange(defaultOption.id);
4442
3812
  }
4443
3813
  }
3814
+ setIsLoading(false);
4444
3815
  }
4445
- }, [optionsProps.defaultValue, optionsProps.selectList]);
3816
+ }, [defaultValue, selectList]);
4446
3817
  const handleInputChange = (event) => {
4447
3818
  const text = event.target.value;
4448
3819
  setSearchText(text);
4449
3820
  setShowDropdown(true);
4450
3821
  if (text === "") {
4451
- setFilteredOptions(optionsProps.selectList);
3822
+ setFilteredOptions(selectList);
4452
3823
  setSelectedOption(null);
4453
- // Notify that there is no selection
4454
- if (optionsProps.handleChange) {
4455
- optionsProps.handleChange("");
3824
+ if (handleChange) {
3825
+ handleChange("");
3826
+ }
3827
+ }
3828
+ else {
3829
+ setIsLoading(true);
3830
+ const filtered = selectList.filter((option) => {
3831
+ return Object.keys(option).some(key => {
3832
+ const value = option[key];
3833
+ return (typeof value === 'string' || typeof value === 'number') &&
3834
+ String(value).toLowerCase().includes(text.toLowerCase());
3835
+ });
3836
+ });
3837
+ setFilteredOptions(filtered);
3838
+ setIsLoading(false);
3839
+ }
3840
+ };
3841
+ const handleInputFocus = () => {
3842
+ setShowDropdown(true);
3843
+ if (searchText === "") {
3844
+ setFilteredOptions(selectList);
3845
+ }
3846
+ };
3847
+ const handleInputBlur = () => {
3848
+ setTimeout(() => {
3849
+ setShowDropdown(false);
3850
+ }, 150);
3851
+ };
3852
+ const handleOptionSelect = (option) => {
3853
+ setSearchText(option.description);
3854
+ setSelectedOption(option);
3855
+ if (handleChange) {
3856
+ handleChange(option.id);
3857
+ }
3858
+ setFilteredOptions([]);
3859
+ };
3860
+ const handleClearClick = () => {
3861
+ setSearchText("");
3862
+ setFilteredOptions([]);
3863
+ setSelectedOption(null);
3864
+ if (handleChange) {
3865
+ handleChange("");
3866
+ }
3867
+ };
3868
+ return (jsxRuntime.jsxs("div", { className: `cw-search-input ${className || ""}`, style: style, id: id, ...otherProps, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-search-input-wrapper", children: [jsxRuntime.jsx("input", { type: "text", value: searchText, onChange: handleInputChange, onFocus: handleInputFocus, onBlur: handleInputBlur, placeholder: placeholder, className: "cw-input-search", disabled: disabled }), isLoading && (jsxRuntime.jsx("div", { className: "cw-search-input-loading", children: jsxRuntime.jsx(CwIcon, { iconId: "spinner" }) })), jsxRuntime.jsx("div", { className: "cw-search-input-icons", children: searchText && !disabled && !isLoading ? (jsxRuntime.jsx(CwButton, { type: "button", onClick: handleClearClick, "aria-label": "Clear search", variant: "icon", icon: "close", color: "neutral" })) : (iconProps ? jsxRuntime.jsx(CwIcon, { ...iconProps }) : jsxRuntime.jsx(CwIcon, { iconId: "search" })) })] })] }), showDropdown && filteredOptions.length > 0 && (jsxRuntime.jsx("div", { className: "cw-input-search-dropdown", children: jsxRuntime.jsx("ul", { children: filteredOptions.map((option) => (jsxRuntime.jsx("li", { onClick: () => handleOptionSelect(option), onMouseDown: (e) => e.preventDefault(), children: renderOption ? renderOption(option) : option.description }, option.id))) }) }))] }));
3869
+ }
3870
+
3871
+ var styles$5 = {"menu":"cw-context-menu-module_menu__tXmun","item":"cw-context-menu-module_item__-ko8L","arrow":"cw-context-menu-module_arrow__LHZmQ"};
3872
+
3873
+ const ARROW_SIZE = 8;
3874
+ const SAFETY_MARGIN = 8;
3875
+ const VIEWPORT_PADDING = 10;
3876
+ const CwAnchoredMenu = ({ children, options, onSelect, placement = 'bottom', open: controlledOpen, onOpenChange, onContextMenu: onContextMenuCallback }) => {
3877
+ const [internalOpen, setInternalOpen] = React.useState(false);
3878
+ const [position, setPosition] = React.useState({ x: 0, y: 0 });
3879
+ const menuRef = React.useRef(null);
3880
+ const triggerRef = React.useRef(null);
3881
+ const arrowRef = React.useRef(null);
3882
+ const isControlled = controlledOpen !== undefined;
3883
+ const isOpen = isControlled ? controlledOpen : internalOpen;
3884
+ const setIsOpen = (value) => {
3885
+ isControlled ? onOpenChange?.(value) : setInternalOpen(value);
3886
+ };
3887
+ const normalizedOptions = options.map(opt => typeof opt === 'string' ? { key: opt, label: opt } : opt);
3888
+ const getActualTriggerElement = () => {
3889
+ let element = triggerRef.current;
3890
+ if (element.offsetHeight === 0 && element.children.length > 0) {
3891
+ element = element.children[0];
3892
+ }
3893
+ return element;
3894
+ };
3895
+ const calculateInitialPosition = (event, rect) => {
3896
+ const totalOffset = ARROW_SIZE + SAFETY_MARGIN;
3897
+ switch (placement) {
3898
+ case 'bottom':
3899
+ return { x: event.clientX, y: rect.bottom + totalOffset };
3900
+ case 'top':
3901
+ return { x: event.clientX, y: rect.top - totalOffset };
3902
+ case 'right':
3903
+ return { x: rect.right + totalOffset, y: event.clientY };
3904
+ case 'left':
3905
+ return { x: rect.left - totalOffset, y: event.clientY };
3906
+ }
3907
+ };
3908
+ const shouldFlipVertical = (currentPlacement, rect, menuHeight) => {
3909
+ const totalOffset = ARROW_SIZE + SAFETY_MARGIN;
3910
+ if (currentPlacement === 'bottom') {
3911
+ const spaceBelow = window.innerHeight - rect.bottom - totalOffset;
3912
+ const spaceAbove = rect.top - totalOffset;
3913
+ return spaceBelow < menuHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
3914
+ }
3915
+ else {
3916
+ const spaceAbove = rect.top - totalOffset;
3917
+ const spaceBelow = window.innerHeight - rect.bottom - totalOffset;
3918
+ return spaceAbove < menuHeight && spaceBelow > spaceAbove ? 'bottom' : 'top';
3919
+ }
3920
+ };
3921
+ const shouldFlipHorizontal = (currentPlacement, rect, menuWidth) => {
3922
+ const totalOffset = ARROW_SIZE + SAFETY_MARGIN;
3923
+ if (currentPlacement === 'right') {
3924
+ const spaceRight = window.innerWidth - rect.right - totalOffset;
3925
+ const spaceLeft = rect.left - totalOffset;
3926
+ return spaceRight < menuWidth && spaceLeft > spaceRight ? 'left' : 'right';
3927
+ }
3928
+ else {
3929
+ const spaceLeft = rect.left - totalOffset;
3930
+ const spaceRight = window.innerWidth - rect.right - totalOffset;
3931
+ return spaceLeft < menuWidth && spaceRight > spaceLeft ? 'right' : 'left';
3932
+ }
3933
+ };
3934
+ const handleContextMenu = (event) => {
3935
+ event.preventDefault();
3936
+ event.stopPropagation();
3937
+ onContextMenuCallback?.(event);
3938
+ setIsOpen(true);
3939
+ const actualElement = getActualTriggerElement();
3940
+ const rect = actualElement.getBoundingClientRect();
3941
+ const pos = calculateInitialPosition(event, rect);
3942
+ setPosition(pos);
3943
+ };
3944
+ const handleOptionClick = (option) => {
3945
+ if (option.disabled)
3946
+ return;
3947
+ onSelect(option.key);
3948
+ setIsOpen(false);
3949
+ };
3950
+ // Calculate position before the browser paints the element
3951
+ React.useLayoutEffect(() => {
3952
+ if (!isOpen || !menuRef.current || !triggerRef.current)
3953
+ return;
3954
+ const actualElement = getActualTriggerElement();
3955
+ const rect = actualElement.getBoundingClientRect();
3956
+ const menuRect = menuRef.current.getBoundingClientRect();
3957
+ let { x, y } = position;
3958
+ let finalPlacement = placement;
3959
+ const totalOffset = ARROW_SIZE + SAFETY_MARGIN;
3960
+ // Calculate position based on placement and check for flips
3961
+ if (placement === 'bottom' || placement === 'top') {
3962
+ x = x - (menuRect.width / 2); // Center on click
3963
+ finalPlacement = shouldFlipVertical(placement, rect, menuRect.height);
3964
+ if (finalPlacement === 'top') {
3965
+ y = rect.top - totalOffset - menuRect.height;
3966
+ }
3967
+ else {
3968
+ y = rect.bottom + totalOffset;
3969
+ }
3970
+ }
3971
+ else { // left or right
3972
+ y = y - (menuRect.height / 2); // Center on click
3973
+ finalPlacement = shouldFlipHorizontal(placement, rect, menuRect.width);
3974
+ if (finalPlacement === 'left') {
3975
+ x = rect.left - totalOffset - menuRect.width;
3976
+ }
3977
+ else {
3978
+ x = rect.right + totalOffset;
3979
+ }
3980
+ }
3981
+ // Keep in viewport (fallback)
3982
+ x = Math.max(VIEWPORT_PADDING, Math.min(x, window.innerWidth - menuRect.width - VIEWPORT_PADDING));
3983
+ y = Math.max(VIEWPORT_PADDING, Math.min(y, window.innerHeight - menuRect.height - VIEWPORT_PADDING));
3984
+ // Position arrow
3985
+ if (arrowRef.current) {
3986
+ arrowRef.current.setAttribute('data-placement', finalPlacement);
3987
+ }
3988
+ if (x !== position.x || y !== position.y) {
3989
+ setPosition({ x, y });
3990
+ }
3991
+ }, [isOpen]);
3992
+ // Close handlers
3993
+ React.useEffect(() => {
3994
+ if (!isOpen)
3995
+ return;
3996
+ const handleOutsideClick = (event) => {
3997
+ if (menuRef.current && !menuRef.current.contains(event.target)) {
3998
+ setIsOpen(false);
3999
+ }
4000
+ };
4001
+ const handleEscape = (event) => {
4002
+ if (event.key === "Escape")
4003
+ setIsOpen(false);
4004
+ };
4005
+ document.addEventListener("mousedown", handleOutsideClick);
4006
+ document.addEventListener("keydown", handleEscape);
4007
+ return () => {
4008
+ document.removeEventListener("mousedown", handleOutsideClick);
4009
+ document.removeEventListener("keydown", handleEscape);
4010
+ };
4011
+ }, [isOpen]);
4012
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: triggerRef, onContextMenu: handleContextMenu, style: { display: "contents" }, children: children }), isOpen && normalizedOptions.length > 0 && reactDom.createPortal(jsxRuntime.jsxs("div", { ref: menuRef, className: styles$5["menu"], style: {
4013
+ top: `${position.y}px`,
4014
+ left: `${position.x}px`,
4015
+ }, "data-has-arrow": "true", children: [jsxRuntime.jsx("div", { ref: arrowRef, className: styles$5["arrow"], "data-placement": placement }), normalizedOptions.map(option => (jsxRuntime.jsxs("div", { onClick: (e) => {
4016
+ e.stopPropagation();
4017
+ e.preventDefault();
4018
+ handleOptionClick(option);
4019
+ }, className: `${styles$5["item"]} ${option.disabled ? styles$5["disabled"] : ""}`, "data-disabled": option.disabled, children: [option.icon && jsxRuntime.jsx("span", { className: styles$5["icon"], children: option.icon }), option.label] }, option.key)))] }), document.body)] }));
4020
+ };
4021
+
4022
+ /**
4023
+ * A context menu that is rendered when the user clicks on a button.
4024
+ * @author NVS
4025
+ * @example
4026
+ * <ContextMenu
4027
+ * options={['Option 1', 'Option 2', 'Option 3']}
4028
+ * onSelect={(option) => console.log(`Selected: ${option}`)}
4029
+ * >
4030
+ * <div>Right-click me!</div>
4031
+ * </ContextMenu>
4032
+ */
4033
+ const DEFAULT_OFFSET = { x: 4, y: 4 };
4034
+ const CwContextMenu = ({ children, options, offset = DEFAULT_OFFSET, onSelect }) => {
4035
+ const [isOpen, setIsOpen] = React.useState(false);
4036
+ const [position, setPosition] = React.useState({ x: 0, y: 0 });
4037
+ const menuRef = React.useRef(null);
4038
+ const handleContextMenu = (event) => {
4039
+ event.preventDefault();
4040
+ setIsOpen(true);
4041
+ const x = event.clientX + offset.x;
4042
+ const y = event.clientY + offset.y;
4043
+ setPosition({ x, y });
4044
+ };
4045
+ const handleOptionClick = (option) => {
4046
+ onSelect(option);
4047
+ setIsOpen(false);
4048
+ };
4049
+ // Position handler for when is too close to window edges
4050
+ React.useEffect(() => {
4051
+ if (isOpen && menuRef.current) {
4052
+ const rect = menuRef.current.getBoundingClientRect();
4053
+ const padding = 16;
4054
+ let { x, y } = position;
4055
+ if (rect.right > window.innerWidth) {
4056
+ x = window.innerWidth - rect.width - padding;
4057
+ }
4058
+ if (rect.bottom > window.innerHeight) {
4059
+ y = window.innerHeight - rect.height - padding;
4060
+ }
4061
+ if (x < padding) {
4062
+ x = padding;
4063
+ }
4064
+ if (y < padding) {
4065
+ y = padding;
4066
+ }
4067
+ if (x !== position.x || y !== position.y) {
4068
+ setPosition({ x, y });
4069
+ }
4070
+ }
4071
+ }, [isOpen, position.x, position.y]);
4072
+ React.useEffect(() => {
4073
+ const handleOutsideClick = (event) => {
4074
+ if (menuRef.current && !menuRef.current.contains(event.target)) {
4075
+ setIsOpen(false);
4076
+ }
4077
+ };
4078
+ const handleEscape = (event) => {
4079
+ if (event.key === "Escape") {
4080
+ setIsOpen(false);
4081
+ }
4082
+ };
4083
+ if (isOpen) {
4084
+ document.addEventListener("mousedown", handleOutsideClick);
4085
+ document.addEventListener("keydown", handleEscape);
4086
+ }
4087
+ return () => {
4088
+ document.removeEventListener("mousedown", handleOutsideClick);
4089
+ document.removeEventListener("keydown", handleEscape);
4090
+ };
4091
+ }, [isOpen]);
4092
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { onContextMenu: handleContextMenu, children: children }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: menuRef, className: styles$5["menu"], style: {
4093
+ top: `${position.y}px`,
4094
+ left: `${position.x}px`,
4095
+ }, children: options.map(option => (jsxRuntime.jsx("div", { onClick: () => handleOptionClick(option), className: styles$5["item"], children: option }, option))) }), document.body)] }));
4096
+ };
4097
+
4098
+ /**
4099
+ * Save button wrapper
4100
+ * @deprecated Use <CwButton variant="icon" icon="save" onClick={...} /> instead
4101
+ */
4102
+ function CwBtnSave({ cw_btnOnclick, cw_btn_disabled, onClick, disabled, ...rest }) {
4103
+ return (jsxRuntime.jsx(CwButton, { ...rest, variant: "icon", icon: "save", onClick: onClick ?? cw_btnOnclick, disabled: disabled ?? cw_btn_disabled }));
4104
+ }
4105
+ /**
4106
+ * Edit button wrapper
4107
+ * @deprecated Use <CwButton variant="icon" icon="edit" onClick={...} /> instead
4108
+ */
4109
+ function CwBtnEdit({ cw_btnOnclick, cw_btn_disabled, onClick, disabled, ...rest }) {
4110
+ return (jsxRuntime.jsx(CwButton, { ...rest, variant: "icon", icon: "edit", onClick: onClick ?? cw_btnOnclick, disabled: disabled ?? cw_btn_disabled }));
4111
+ }
4112
+ /**
4113
+ * Delete button wrapper
4114
+ * @deprecated Use <CwButton variant="icon" icon="delete" color="danger" onClick={...} /> instead
4115
+ */
4116
+ function CwBtnDelete({ cw_btnOnclick, cw_btn_disabled, onClick, disabled, ...rest }) {
4117
+ return (jsxRuntime.jsx(CwButton, { ...rest, variant: "icon", icon: "delete", color: "danger", onClick: onClick ?? cw_btnOnclick, disabled: disabled ?? cw_btn_disabled }));
4118
+ }
4119
+
4120
+ var styles$4 = {"pickerWrapper":"cw-pickers-base-module_pickerWrapper__Fb9Zo","pickerIcons":"cw-pickers-base-module_pickerIcons__dyd2-","pickerPopup":"cw-pickers-base-module_pickerPopup__dkxJo","title":"cw-pickers-base-module_title__cE7qI"};
4121
+
4122
+ function CustomCaption$2({ displayMonth }) {
4123
+ const { goToMonth, nextMonth, previousMonth } = reactDayPicker.useNavigation();
4124
+ return (jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "chevron-left", onClick: () => previousMonth && goToMonth(previousMonth), disabled: !previousMonth, "aria-label": "Previous month" }), jsxRuntime.jsx("div", { className: styles$4.title, children: dateFns.format(displayMonth, "MMMM yyyy", { locale: locale.enGB }) }), jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "chevron-right", onClick: () => nextMonth && goToMonth(nextMonth), disabled: !nextMonth, "aria-label": "Next month" })] }));
4125
+ }
4126
+ 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, }) {
4127
+ const [isOpen, setIsOpen] = React.useState(false);
4128
+ const [inputValue, setInputValue] = React.useState("");
4129
+ const containerRef = React.useRef(null);
4130
+ const inputRef = React.useRef(null);
4131
+ const prevValueRef = React.useRef(undefined);
4132
+ // Parse date from string based on format
4133
+ const parseDate = React.useCallback((dateString, formatStr) => {
4134
+ try {
4135
+ const cleanString = dateString.trim();
4136
+ const parts = cleanString.split(/[\/\-\.]/);
4137
+ if (parts.length !== 3)
4138
+ return undefined;
4139
+ let day;
4140
+ let month;
4141
+ let year;
4142
+ const formatLower = formatStr.toLowerCase();
4143
+ const dayIndex = formatLower.indexOf('dd');
4144
+ const monthIndex = formatLower.indexOf('mm');
4145
+ const yearIndex = formatLower.indexOf('yyyy') !== -1
4146
+ ? formatLower.indexOf('yyyy')
4147
+ : formatLower.indexOf('yy');
4148
+ const positions = [
4149
+ { type: 'day', index: dayIndex },
4150
+ { type: 'month', index: monthIndex },
4151
+ { type: 'year', index: yearIndex }
4152
+ ].sort((a, b) => a.index - b.index);
4153
+ positions.forEach((pos, idx) => {
4154
+ const value = parseInt(parts[idx], 10);
4155
+ if (pos.type === 'day')
4156
+ day = value;
4157
+ else if (pos.type === 'month')
4158
+ month = value - 1;
4159
+ else if (pos.type === 'year')
4160
+ year = value;
4161
+ });
4162
+ if (day === undefined || month === undefined || year === undefined)
4163
+ return undefined;
4164
+ if (isNaN(day) || isNaN(month) || isNaN(year))
4165
+ return undefined;
4166
+ if (year < 100) {
4167
+ year = year < 50 ? 2000 + year : 1900 + year;
4168
+ }
4169
+ const parsed = new Date(year, month, day);
4170
+ if (parsed.getDate() === day &&
4171
+ parsed.getMonth() === month &&
4172
+ parsed.getFullYear() === year) {
4173
+ return parsed;
4174
+ }
4175
+ return undefined;
4176
+ }
4177
+ catch {
4178
+ return undefined;
4179
+ }
4180
+ }, []);
4181
+ const normalizeDateForComparison = React.useCallback((date) => {
4182
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
4183
+ }, []);
4184
+ // Validate and set date - shared logic
4185
+ const validateAndSetDate = React.useCallback((dateString) => {
4186
+ const parsed = parseDate(dateString, displayFormat);
4187
+ if (parsed && !isNaN(parsed.getTime())) {
4188
+ const normalizedParsed = normalizeDateForComparison(parsed);
4189
+ const normalizedMin = minDate ? normalizeDateForComparison(minDate) : undefined;
4190
+ const normalizedMax = maxDate ? normalizeDateForComparison(maxDate) : undefined;
4191
+ const isValid = (!normalizedMin || normalizedParsed >= normalizedMin) &&
4192
+ (!normalizedMax || normalizedParsed <= normalizedMax);
4193
+ if (isValid) {
4194
+ onChange(parsed);
4195
+ return true;
4196
+ }
4197
+ }
4198
+ return false;
4199
+ }, [parseDate, displayFormat, minDate, maxDate, onChange, normalizeDateForComparison]);
4200
+ // Sync input value with prop value - only when changed externally
4201
+ React.useEffect(() => {
4202
+ const currentTime = value?.getTime();
4203
+ const prevTime = prevValueRef.current?.getTime();
4204
+ if (currentTime !== prevTime) {
4205
+ prevValueRef.current = value;
4206
+ if (value) {
4207
+ setInputValue(dateFns.format(value, displayFormat, { locale: locale.enGB }));
4208
+ }
4209
+ else {
4210
+ setInputValue("");
4211
+ }
4212
+ }
4213
+ }, [value, displayFormat]);
4214
+ // Close calendar when clicking outside
4215
+ React.useEffect(() => {
4216
+ const handleClickOutside = (event) => {
4217
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
4218
+ setIsOpen(false);
4219
+ }
4220
+ };
4221
+ if (isOpen) {
4222
+ document.addEventListener("mousedown", handleClickOutside);
4223
+ }
4224
+ return () => {
4225
+ document.removeEventListener("mousedown", handleClickOutside);
4226
+ };
4227
+ }, [isOpen]);
4228
+ const handleDaySelect = React.useCallback((date) => {
4229
+ onChange(date);
4230
+ setIsOpen(false);
4231
+ inputRef.current?.blur();
4232
+ }, [onChange]);
4233
+ const handleClear = React.useCallback((e) => {
4234
+ e.stopPropagation();
4235
+ onChange(undefined);
4236
+ setInputValue("");
4237
+ }, [onChange]);
4238
+ const handleInputClick = React.useCallback(() => {
4239
+ if (!disabled) {
4240
+ setIsOpen(true);
4241
+ }
4242
+ }, [disabled]);
4243
+ const handleInputChange = React.useCallback((e) => {
4244
+ const newValue = e.target.value;
4245
+ setInputValue(newValue);
4246
+ if (newValue.length >= 10) {
4247
+ validateAndSetDate(newValue);
4248
+ }
4249
+ else if (newValue === "") {
4250
+ onChange(undefined);
4251
+ }
4252
+ }, [validateAndSetDate, onChange]);
4253
+ const handleInputBlur = React.useCallback(() => {
4254
+ if (inputValue && inputValue.trim() !== "") {
4255
+ const parsed = parseDate(inputValue, displayFormat);
4256
+ if (parsed && !isNaN(parsed.getTime())) {
4257
+ const normalizedParsed = normalizeDateForComparison(parsed);
4258
+ const normalizedMin = minDate ? normalizeDateForComparison(minDate) : undefined;
4259
+ const normalizedMax = maxDate ? normalizeDateForComparison(maxDate) : undefined;
4260
+ const isValid = (!normalizedMin || normalizedParsed >= normalizedMin) &&
4261
+ (!normalizedMax || normalizedParsed <= normalizedMax);
4262
+ if (isValid) {
4263
+ onChange(parsed);
4264
+ setInputValue(dateFns.format(parsed, displayFormat, { locale: locale.enGB }));
4265
+ return;
4266
+ }
4267
+ }
4268
+ }
4269
+ if (!value) {
4270
+ setInputValue("");
4271
+ }
4272
+ else {
4273
+ setInputValue(dateFns.format(value, displayFormat, { locale: locale.enGB }));
4274
+ }
4275
+ }, [inputValue, parseDate, displayFormat, minDate, maxDate, onChange, value, normalizeDateForComparison]);
4276
+ const handleInputKeyDown = React.useCallback((e) => {
4277
+ if (e.key === "Enter") {
4278
+ e.preventDefault();
4279
+ inputRef.current?.blur();
4280
+ setIsOpen(false);
4281
+ }
4282
+ else if (e.key === "Escape") {
4283
+ setIsOpen(false);
4284
+ inputRef.current?.blur();
4285
+ }
4286
+ }, []);
4287
+ const handleTodayClick = React.useCallback(() => {
4288
+ const today = new Date();
4289
+ const isTodayValid = (!minDate || today >= minDate) &&
4290
+ (!maxDate || today <= maxDate);
4291
+ if (isTodayValid) {
4292
+ onChange(today);
4293
+ setIsOpen(false);
4294
+ }
4295
+ }, [minDate, maxDate, onChange]);
4296
+ // Memoize formatters
4297
+ const formatters = React.useMemo(() => ({
4298
+ formatCaption: (date) => dateFns.format(date, "MMMM yyyy", { locale: locale.enGB }),
4299
+ formatWeekdayName: (date) => dateFns.format(date, "EEEEEE", { locale: locale.enGB })
4300
+ }), []);
4301
+ // Memoize disabled days
4302
+ const disabledDays = React.useMemo(() => [
4303
+ ...(disabledDates || []),
4304
+ ...(minDate ? [{ before: minDate }] : []),
4305
+ ...(maxDate ? [{ after: maxDate }] : []),
4306
+ ...(disabledMatcher ? [disabledMatcher] : []),
4307
+ ], [disabledDates, minDate, maxDate, disabledMatcher]);
4308
+ return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) }), isOpen && (jsxRuntime.jsxs("div", { className: styles$4.pickerPopup, "data-position": popupPosition, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: value || undefined, defaultMonth: defaultMonth || value || undefined, onSelect: handleDaySelect, disabled: disabledDays, locale: locale.enGB, numberOfMonths: numberOfMonths, formatters: formatters, components: {
4309
+ Caption: (props) => (jsxRuntime.jsx(CustomCaption$2, { ...props })),
4310
+ }, modifiers: {
4311
+ today: new Date(),
4312
+ }, modifiersClassNames: {
4313
+ today: "rdp-day_today",
4314
+ } }), showTodayButton && (jsxRuntime.jsx("footer", { className: "cw-flex-row cw-align-right-center", children: jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", onClick: handleTodayClick, text: "Today" }) }))] }))] })] }) }));
4315
+ }
4316
+
4317
+ var rangeStyles = {"rangeWrapper":"cw-range-picker-module_rangeWrapper__1nIVs","rangePopup":"cw-range-picker-module_rangePopup__E5jd1","presetList":"cw-range-picker-module_presetList__INiLo"};
4318
+
4319
+ const PRESET_LIBRARY = {
4320
+ // === PAST DAYS ===
4321
+ today: {
4322
+ key: 'today',
4323
+ label: 'Today',
4324
+ getValue: () => {
4325
+ const from = new Date();
4326
+ from.setHours(0, 0, 0, 0);
4327
+ const to = new Date();
4328
+ to.setHours(23, 59, 59, 999);
4329
+ return { from, to };
4330
+ }
4331
+ },
4332
+ yesterday: {
4333
+ key: 'yesterday',
4334
+ label: 'Yesterday',
4335
+ getValue: () => {
4336
+ const from = new Date();
4337
+ from.setDate(from.getDate() - 1);
4338
+ from.setHours(0, 0, 0, 0);
4339
+ const to = new Date();
4340
+ to.setDate(to.getDate() - 1);
4341
+ to.setHours(23, 59, 59, 999);
4342
+ return { from, to };
4343
+ }
4344
+ },
4345
+ past2Days: {
4346
+ key: 'past2Days',
4347
+ label: 'Past 2 Days',
4348
+ getValue: () => {
4349
+ const today = new Date();
4350
+ today.setHours(23, 59, 59, 999);
4351
+ const twoDaysAgo = new Date();
4352
+ twoDaysAgo.setDate(today.getDate() - 2);
4353
+ twoDaysAgo.setHours(0, 0, 0, 0);
4354
+ return { from: twoDaysAgo, to: today };
4355
+ }
4356
+ },
4357
+ past3Days: {
4358
+ key: 'past3Days',
4359
+ label: 'Past 3 Days',
4360
+ getValue: () => {
4361
+ const today = new Date();
4362
+ today.setHours(23, 59, 59, 999);
4363
+ const threeDaysAgo = new Date();
4364
+ threeDaysAgo.setDate(today.getDate() - 3);
4365
+ threeDaysAgo.setHours(0, 0, 0, 0);
4366
+ return { from: threeDaysAgo, to: today };
4367
+ }
4368
+ },
4369
+ past7Days: {
4370
+ key: 'past7Days',
4371
+ label: 'Past 7 days',
4372
+ getValue: () => {
4373
+ const today = new Date();
4374
+ const past = new Date(today);
4375
+ past.setDate(today.getDate() - 7);
4376
+ return { from: past, to: today };
4377
+ }
4378
+ },
4379
+ past14Days: {
4380
+ key: 'past14Days',
4381
+ label: 'Past 14 days',
4382
+ getValue: () => {
4383
+ const today = new Date();
4384
+ const past = new Date(today);
4385
+ past.setDate(today.getDate() - 14);
4386
+ return { from: past, to: today };
4387
+ }
4388
+ },
4389
+ past30Days: {
4390
+ key: 'past30Days',
4391
+ label: 'Past 30 days',
4392
+ getValue: () => {
4393
+ const today = new Date();
4394
+ const past = new Date(today);
4395
+ past.setDate(today.getDate() - 30);
4396
+ return { from: past, to: today };
4397
+ }
4398
+ },
4399
+ past90Days: {
4400
+ key: 'past90Days',
4401
+ label: 'Past 90 days',
4402
+ getValue: () => {
4403
+ const today = new Date();
4404
+ const past = new Date(today);
4405
+ past.setDate(today.getDate() - 90);
4406
+ return { from: past, to: today };
4407
+ }
4408
+ },
4409
+ // === NEXT DAYS ===
4410
+ next7Days: {
4411
+ key: 'next7Days',
4412
+ label: 'Next 7 days',
4413
+ getValue: () => {
4414
+ const today = new Date();
4415
+ const next = new Date(today);
4416
+ next.setDate(today.getDate() + 7);
4417
+ return { from: today, to: next };
4418
+ }
4419
+ },
4420
+ next14Days: {
4421
+ key: 'next14Days',
4422
+ label: 'Next 14 days',
4423
+ getValue: () => {
4424
+ const today = new Date();
4425
+ const next = new Date(today);
4426
+ next.setDate(today.getDate() + 14);
4427
+ return { from: today, to: next };
4428
+ }
4429
+ },
4430
+ next30Days: {
4431
+ key: 'next30Days',
4432
+ label: 'Next 30 days',
4433
+ getValue: () => {
4434
+ const today = new Date();
4435
+ const next = new Date(today);
4436
+ next.setDate(today.getDate() + 30);
4437
+ return { from: today, to: next };
4438
+ }
4439
+ },
4440
+ // === WEEKS ===
4441
+ thisWeek: {
4442
+ key: 'thisWeek',
4443
+ label: 'This week',
4444
+ getValue: () => {
4445
+ const today = new Date();
4446
+ const firstDay = new Date(today);
4447
+ const lastDay = new Date(today);
4448
+ const day = today.getDay();
4449
+ const diff = day === 0 ? -6 : 1 - day; // Monday as first day
4450
+ firstDay.setDate(today.getDate() + diff);
4451
+ lastDay.setDate(firstDay.getDate() + 6); // Sunday
4452
+ return { from: firstDay, to: lastDay };
4453
+ }
4454
+ },
4455
+ lastWeek: {
4456
+ key: 'lastWeek',
4457
+ label: 'Last week',
4458
+ getValue: () => {
4459
+ const today = new Date();
4460
+ const lastWeekEnd = new Date(today);
4461
+ const day = today.getDay();
4462
+ const diff = day === 0 ? -6 : 1 - day;
4463
+ lastWeekEnd.setDate(today.getDate() + diff - 1);
4464
+ const lastWeekStart = new Date(lastWeekEnd);
4465
+ lastWeekStart.setDate(lastWeekEnd.getDate() - 6);
4466
+ return { from: lastWeekStart, to: lastWeekEnd };
4467
+ }
4468
+ },
4469
+ nextWeek: {
4470
+ key: 'nextWeek',
4471
+ label: 'Next week',
4472
+ getValue: () => {
4473
+ const today = new Date();
4474
+ const nextWeekStart = new Date(today);
4475
+ const day = today.getDay();
4476
+ const diff = day === 0 ? 1 : 8 - day;
4477
+ nextWeekStart.setDate(today.getDate() + diff);
4478
+ const nextWeekEnd = new Date(nextWeekStart);
4479
+ nextWeekEnd.setDate(nextWeekStart.getDate() + 6);
4480
+ return { from: nextWeekStart, to: nextWeekEnd };
4481
+ }
4482
+ },
4483
+ // === MONTHS ===
4484
+ thisMonth: {
4485
+ key: 'thisMonth',
4486
+ label: 'This month',
4487
+ getValue: () => {
4488
+ const today = new Date();
4489
+ const firstDay = new Date(today.getFullYear(), today.getMonth(), 1);
4490
+ const lastDay = new Date(today.getFullYear(), today.getMonth() + 1, 0);
4491
+ return { from: firstDay, to: lastDay };
4492
+ }
4493
+ },
4494
+ lastMonth: {
4495
+ key: 'lastMonth',
4496
+ label: 'Last month',
4497
+ getValue: () => {
4498
+ const today = new Date();
4499
+ const firstDay = new Date(today.getFullYear(), today.getMonth() - 1, 1);
4500
+ const lastDay = new Date(today.getFullYear(), today.getMonth(), 0);
4501
+ return { from: firstDay, to: lastDay };
4502
+ }
4503
+ },
4504
+ nextMonth: {
4505
+ key: 'nextMonth',
4506
+ label: 'Next month',
4507
+ getValue: () => {
4508
+ const today = new Date();
4509
+ const firstDay = new Date(today.getFullYear(), today.getMonth() + 1, 1);
4510
+ const lastDay = new Date(today.getFullYear(), today.getMonth() + 2, 0);
4511
+ return { from: firstDay, to: lastDay };
4512
+ }
4513
+ },
4514
+ // === QUARTERS ===
4515
+ thisQuarter: {
4516
+ key: 'thisQuarter',
4517
+ label: 'This quarter',
4518
+ getValue: () => {
4519
+ const today = new Date();
4520
+ const quarter = Math.floor(today.getMonth() / 3);
4521
+ const firstDay = new Date(today.getFullYear(), quarter * 3, 1);
4522
+ const lastDay = new Date(today.getFullYear(), quarter * 3 + 3, 0);
4523
+ return { from: firstDay, to: lastDay };
4524
+ }
4525
+ },
4526
+ lastQuarter: {
4527
+ key: 'lastQuarter',
4528
+ label: 'Last quarter',
4529
+ getValue: () => {
4530
+ const today = new Date();
4531
+ const currentQuarter = Math.floor(today.getMonth() / 3);
4532
+ const lastQuarter = currentQuarter === 0 ? 3 : currentQuarter - 1;
4533
+ const year = currentQuarter === 0 ? today.getFullYear() - 1 : today.getFullYear();
4534
+ const firstDay = new Date(year, lastQuarter * 3, 1);
4535
+ const lastDay = new Date(year, lastQuarter * 3 + 3, 0);
4536
+ return { from: firstDay, to: lastDay };
4537
+ }
4538
+ },
4539
+ nextQuarter: {
4540
+ key: 'nextQuarter',
4541
+ label: 'Next quarter',
4542
+ getValue: () => {
4543
+ const today = new Date();
4544
+ const currentQuarter = Math.floor(today.getMonth() / 3);
4545
+ const nextQuarter = (currentQuarter + 1) % 4;
4546
+ const year = nextQuarter === 0 ? today.getFullYear() + 1 : today.getFullYear();
4547
+ const firstDay = new Date(year, nextQuarter * 3, 1);
4548
+ const lastDay = new Date(year, nextQuarter * 3 + 3, 0);
4549
+ return { from: firstDay, to: lastDay };
4550
+ }
4551
+ },
4552
+ // === YEAR ===
4553
+ thisYear: {
4554
+ key: 'thisYear',
4555
+ label: 'This year',
4556
+ getValue: () => {
4557
+ const today = new Date();
4558
+ const firstDay = new Date(today.getFullYear(), 0, 1);
4559
+ const lastDay = new Date(today.getFullYear(), 11, 31);
4560
+ return { from: firstDay, to: lastDay };
4561
+ }
4562
+ },
4563
+ lastYear: {
4564
+ key: 'lastYear',
4565
+ label: 'Last year',
4566
+ getValue: () => {
4567
+ const today = new Date();
4568
+ const firstDay = new Date(today.getFullYear() - 1, 0, 1);
4569
+ const lastDay = new Date(today.getFullYear() - 1, 11, 31);
4570
+ return { from: firstDay, to: lastDay };
4571
+ }
4572
+ }
4573
+ };
4574
+ /**
4575
+ * Helper function to get presets by their keys
4576
+ * @param keys - Array of preset keys from PRESET_LIBRARY
4577
+ * @returns Array of DateRangePreset objects
4578
+ *
4579
+ * @example
4580
+ * const presets = getPresetsByKeys(['thisWeek', 'past7Days', 'past30Days']);
4581
+ */
4582
+ const getPresetsByKeys = (keys) => {
4583
+ return keys
4584
+ .map(key => PRESET_LIBRARY[key])
4585
+ .filter(preset => preset !== undefined);
4586
+ };
4587
+
4588
+ function CustomCaption$1({ displayMonth }) {
4589
+ const { goToMonth, nextMonth, previousMonth } = reactDayPicker.useNavigation();
4590
+ return (jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "chevron-left", onClick: () => previousMonth && goToMonth(previousMonth), disabled: !previousMonth, "aria-label": "Previous month" }), jsxRuntime.jsx("div", { className: styles$4.title, children: dateFns.format(displayMonth, "MMMM yyyy", { locale: locale.enGB }) }), jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "chevron-right", onClick: () => nextMonth && goToMonth(nextMonth), disabled: !nextMonth, "aria-label": "Next month" })] }));
4591
+ }
4592
+ 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, }) {
4593
+ const [isOpen, setIsOpen] = React.useState(false);
4594
+ const [inputFromValue, setInputFromValue] = React.useState("");
4595
+ const [inputToValue, setInputToValue] = React.useState("");
4596
+ const [focusedInput, setFocusedInput] = React.useState();
4597
+ const containerRef = React.useRef(null);
4598
+ const inputFromRef = React.useRef(null);
4599
+ const inputToRef = React.useRef(null);
4600
+ const prevValueRef = React.useRef(undefined);
4601
+ // Calculate presets to render
4602
+ const presetsToRender = React.useMemo(() => {
4603
+ let presets = [];
4604
+ // If presetKeys provided, use those from library
4605
+ if (presetKeys && presetKeys.length > 0) {
4606
+ presets = getPresetsByKeys(presetKeys);
4607
+ }
4608
+ // Add custom presets if provided
4609
+ if (customPresets && customPresets.length > 0) {
4610
+ presets = [...presets, ...customPresets];
4611
+ }
4612
+ return presets;
4613
+ }, [presetKeys, customPresets]);
4614
+ // Parse date from string based on format
4615
+ const parseDate = React.useCallback((dateString, formatStr) => {
4616
+ try {
4617
+ const cleanString = dateString.trim();
4618
+ const parts = cleanString.split(/[\/\-\.]/);
4619
+ if (parts.length !== 3)
4620
+ return undefined;
4621
+ let day;
4622
+ let month;
4623
+ let year;
4624
+ const formatLower = formatStr.toLowerCase();
4625
+ const dayIndex = formatLower.indexOf('dd');
4626
+ const monthIndex = formatLower.indexOf('mm');
4627
+ const yearIndex = formatLower.indexOf('yyyy') !== -1
4628
+ ? formatLower.indexOf('yyyy')
4629
+ : formatLower.indexOf('yy');
4630
+ const positions = [
4631
+ { type: 'day', index: dayIndex },
4632
+ { type: 'month', index: monthIndex },
4633
+ { type: 'year', index: yearIndex }
4634
+ ].sort((a, b) => a.index - b.index);
4635
+ positions.forEach((pos, idx) => {
4636
+ const value = parseInt(parts[idx], 10);
4637
+ if (pos.type === 'day')
4638
+ day = value;
4639
+ else if (pos.type === 'month')
4640
+ month = value - 1;
4641
+ else if (pos.type === 'year')
4642
+ year = value;
4643
+ });
4644
+ if (day === undefined || month === undefined || year === undefined)
4645
+ return undefined;
4646
+ if (isNaN(day) || isNaN(month) || isNaN(year))
4647
+ return undefined;
4648
+ if (year < 100) {
4649
+ year = year < 50 ? 2000 + year : 1900 + year;
4650
+ }
4651
+ const parsed = new Date(year, month, day);
4652
+ if (parsed.getDate() === day &&
4653
+ parsed.getMonth() === month &&
4654
+ parsed.getFullYear() === year) {
4655
+ return parsed;
4656
+ }
4657
+ return undefined;
4658
+ }
4659
+ catch {
4660
+ return undefined;
4661
+ }
4662
+ }, []);
4663
+ const normalizeDateForComparison = React.useCallback((date) => {
4664
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
4665
+ }, []);
4666
+ // Validate date range
4667
+ const validateRange = React.useCallback((from, to) => {
4668
+ if (!from || !to)
4669
+ return true; // Partial ranges are OK during selection
4670
+ // Check if "from" is before "to"
4671
+ if (from > to)
4672
+ return false;
4673
+ // Check max range days
4674
+ if (maxRangeDays) {
4675
+ const daysDiff = Math.floor((to.getTime() - from.getTime()) / (1000 * 60 * 60 * 24));
4676
+ if (daysDiff > maxRangeDays)
4677
+ return false;
4678
+ }
4679
+ return true;
4680
+ }, [maxRangeDays]);
4681
+ // Sync input values with prop value
4682
+ React.useEffect(() => {
4683
+ const currentFromTime = value?.from?.getTime();
4684
+ const currentToTime = value?.to?.getTime();
4685
+ const prevFromTime = prevValueRef.current?.fromTime;
4686
+ const prevToTime = prevValueRef.current?.toTime;
4687
+ // Only update if times have actually changed
4688
+ if (currentFromTime !== prevFromTime || currentToTime !== prevToTime) {
4689
+ prevValueRef.current = {
4690
+ fromTime: currentFromTime,
4691
+ toTime: currentToTime
4692
+ };
4693
+ // Update "from" input
4694
+ if (value?.from) {
4695
+ setInputFromValue(dateFns.format(value.from, displayFormat, { locale: locale.enGB }));
4696
+ }
4697
+ else {
4698
+ setInputFromValue("");
4699
+ }
4700
+ // Update "to" input
4701
+ if (value?.to) {
4702
+ setInputToValue(dateFns.format(value.to, displayFormat, { locale: locale.enGB }));
4703
+ }
4704
+ else {
4705
+ setInputToValue("");
4706
+ }
4707
+ }
4708
+ }, [value, displayFormat]);
4709
+ // Close calendar when clicking outside
4710
+ React.useEffect(() => {
4711
+ const handleClickOutside = (event) => {
4712
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
4713
+ setIsOpen(false);
4714
+ setFocusedInput(undefined);
4715
+ }
4716
+ };
4717
+ if (isOpen) {
4718
+ document.addEventListener("mousedown", handleClickOutside);
4719
+ }
4720
+ return () => {
4721
+ document.removeEventListener("mousedown", handleClickOutside);
4722
+ };
4723
+ }, [isOpen]);
4724
+ const handleRangeSelect = React.useCallback((range, // El rango sugerido por react-day-picker
4725
+ selectedDay) => {
4726
+ let newRange;
4727
+ if (focusedInput === 'from') {
4728
+ newRange = { from: selectedDay, to: value?.to };
4729
+ if (newRange.to && selectedDay > newRange.to) {
4730
+ newRange.to = undefined;
4731
+ setFocusedInput('to');
4732
+ }
4733
+ else if (newRange.to) {
4734
+ setIsOpen(false);
4735
+ setFocusedInput(undefined);
4736
+ }
4737
+ else {
4738
+ setFocusedInput('to');
4739
+ }
4740
+ }
4741
+ else if (focusedInput === 'to') {
4742
+ newRange = { from: value?.from, to: selectedDay };
4743
+ if (newRange.from && selectedDay < newRange.from) {
4744
+ newRange.from = undefined;
4745
+ setFocusedInput('from');
4746
+ }
4747
+ else if (newRange.from) {
4748
+ setIsOpen(false);
4749
+ setFocusedInput(undefined);
4750
+ }
4751
+ else {
4752
+ setFocusedInput('from');
4753
+ }
4754
+ }
4755
+ else {
4756
+ if (!range) {
4757
+ onChange(undefined);
4758
+ return;
4759
+ }
4760
+ newRange = { from: range.from, to: range.to };
4761
+ if (range.from && range.to) {
4762
+ setIsOpen(false);
4763
+ setFocusedInput(undefined);
4764
+ }
4765
+ else if (range.from) {
4766
+ setFocusedInput('to');
4767
+ }
4768
+ else {
4769
+ setFocusedInput('from');
4770
+ }
4771
+ }
4772
+ // Validate range before sending
4773
+ if (newRange.from && newRange.to && !validateRange(newRange.from, newRange.to)) {
4774
+ return;
4775
+ }
4776
+ onChange(newRange);
4777
+ }, [onChange, validateRange, value, focusedInput]);
4778
+ const handleClearFrom = React.useCallback((e) => {
4779
+ e.stopPropagation();
4780
+ onChange({ from: undefined, to: value?.to });
4781
+ setInputFromValue("");
4782
+ }, [onChange, value]);
4783
+ const handleClearTo = React.useCallback((e) => {
4784
+ e.stopPropagation();
4785
+ onChange({ from: value?.from, to: undefined });
4786
+ setInputToValue("");
4787
+ }, [onChange, value]);
4788
+ const handleInputFromClick = React.useCallback(() => {
4789
+ if (!disabled) {
4790
+ setIsOpen(true);
4791
+ setFocusedInput('from');
4792
+ }
4793
+ }, [disabled]);
4794
+ const handleInputToClick = React.useCallback(() => {
4795
+ if (!disabled) {
4796
+ setIsOpen(true);
4797
+ setFocusedInput('to');
4798
+ }
4799
+ }, [disabled]);
4800
+ const handleInputFromChange = React.useCallback((e) => {
4801
+ const newValue = e.target.value;
4802
+ setInputFromValue(newValue);
4803
+ if (newValue.length >= 10) {
4804
+ const parsed = parseDate(newValue, displayFormat);
4805
+ if (parsed && !isNaN(parsed.getTime())) {
4806
+ const normalizedParsed = normalizeDateForComparison(parsed);
4807
+ const normalizedMin = minDate ? normalizeDateForComparison(minDate) : undefined;
4808
+ const normalizedMax = maxDate ? normalizeDateForComparison(maxDate) : undefined;
4809
+ const isValid = (!normalizedMin || normalizedParsed >= normalizedMin) &&
4810
+ (!normalizedMax || normalizedParsed <= normalizedMax);
4811
+ if (isValid) {
4812
+ onChange({ from: parsed, to: value?.to });
4813
+ }
4814
+ }
4815
+ }
4816
+ else if (newValue === "") {
4817
+ onChange({ from: undefined, to: value?.to });
4818
+ }
4819
+ }, [parseDate, displayFormat, minDate, maxDate, normalizeDateForComparison, onChange, value]);
4820
+ const handleInputToChange = React.useCallback((e) => {
4821
+ const newValue = e.target.value;
4822
+ setInputToValue(newValue);
4823
+ if (newValue.length >= 10) {
4824
+ const parsed = parseDate(newValue, displayFormat);
4825
+ if (parsed && !isNaN(parsed.getTime())) {
4826
+ const normalizedParsed = normalizeDateForComparison(parsed);
4827
+ const normalizedMin = minDate ? normalizeDateForComparison(minDate) : undefined;
4828
+ const normalizedMax = maxDate ? normalizeDateForComparison(maxDate) : undefined;
4829
+ const isValid = (!normalizedMin || normalizedParsed >= normalizedMin) &&
4830
+ (!normalizedMax || normalizedParsed <= normalizedMax);
4831
+ if (isValid && validateRange(value?.from, parsed)) {
4832
+ onChange({ from: value?.from, to: parsed });
4833
+ }
4834
+ }
4835
+ }
4836
+ else if (newValue === "") {
4837
+ onChange({ from: value?.from, to: undefined });
4838
+ }
4839
+ }, [parseDate, displayFormat, minDate, maxDate, normalizeDateForComparison, validateRange, onChange, value]);
4840
+ const handleInputBlur = React.useCallback((type) => {
4841
+ const inputValue = type === 'from' ? inputFromValue : inputToValue;
4842
+ const currentValue = type === 'from' ? value?.from : value?.to;
4843
+ if (inputValue && inputValue.trim() !== "") {
4844
+ const parsed = parseDate(inputValue, displayFormat);
4845
+ if (parsed && !isNaN(parsed.getTime())) {
4846
+ const normalizedParsed = normalizeDateForComparison(parsed);
4847
+ const normalizedMin = minDate ? normalizeDateForComparison(minDate) : undefined;
4848
+ const normalizedMax = maxDate ? normalizeDateForComparison(maxDate) : undefined;
4849
+ const isValid = (!normalizedMin || normalizedParsed >= normalizedMin) &&
4850
+ (!normalizedMax || normalizedParsed <= normalizedMax);
4851
+ if (isValid) {
4852
+ const newRange = type === 'from'
4853
+ ? { from: parsed, to: value?.to }
4854
+ : { from: value?.from, to: parsed };
4855
+ if (validateRange(newRange.from, newRange.to)) {
4856
+ onChange(newRange);
4857
+ if (type === 'from') {
4858
+ setInputFromValue(dateFns.format(parsed, displayFormat, { locale: locale.enGB }));
4859
+ }
4860
+ else {
4861
+ setInputToValue(dateFns.format(parsed, displayFormat, { locale: locale.enGB }));
4862
+ }
4863
+ return;
4864
+ }
4865
+ }
4866
+ }
4867
+ }
4868
+ // Reset to current value if invalid
4869
+ if (type === 'from') {
4870
+ setInputFromValue(currentValue ? dateFns.format(currentValue, displayFormat, { locale: locale.enGB }) : "");
4871
+ }
4872
+ else {
4873
+ setInputToValue(currentValue ? dateFns.format(currentValue, displayFormat, { locale: locale.enGB }) : "");
4874
+ }
4875
+ }, [inputFromValue, inputToValue, value, parseDate, displayFormat, minDate, maxDate, normalizeDateForComparison, validateRange, onChange]);
4876
+ const handleInputKeyDown = React.useCallback((e, type) => {
4877
+ if (e.key === "Enter") {
4878
+ e.preventDefault();
4879
+ if (type === 'from') {
4880
+ inputFromRef.current?.blur();
4881
+ inputToRef.current?.focus();
4882
+ }
4883
+ else {
4884
+ inputToRef.current?.blur();
4885
+ setIsOpen(false);
4886
+ }
4887
+ }
4888
+ else if (e.key === "Escape") {
4889
+ setIsOpen(false);
4890
+ if (type === 'from') {
4891
+ inputFromRef.current?.blur();
4892
+ }
4893
+ else {
4894
+ inputToRef.current?.blur();
4895
+ }
4896
+ }
4897
+ }, []);
4898
+ // Handle preset click
4899
+ const handlePresetClick = React.useCallback((preset, e) => {
4900
+ e.preventDefault();
4901
+ e.stopPropagation();
4902
+ onChange(preset.getValue());
4903
+ setIsOpen(false);
4904
+ }, [onChange]);
4905
+ // Memoize formatters
4906
+ const formatters = React.useMemo(() => ({
4907
+ formatCaption: (date) => dateFns.format(date, "MMMM yyyy", { locale: locale.enGB }),
4908
+ formatWeekdayName: (date) => dateFns.format(date, "EEEEEE", { locale: locale.enGB })
4909
+ }), []);
4910
+ // Memoize disabled days
4911
+ const disabledDays = React.useMemo(() => {
4912
+ const baseDisabled = [
4913
+ ...(disabledDates || []),
4914
+ ...(minDate ? [{ before: minDate }] : []),
4915
+ ...(maxDate ? [{ after: maxDate }] : []),
4916
+ ...(disabledMatcher ? [disabledMatcher] : []),
4917
+ ];
4918
+ // If maxRangeDays is set and we have a "from" date, disable dates beyond the range
4919
+ if (maxRangeDays) {
4920
+ if (value?.from) {
4921
+ const maxAllowedDate = new Date(value.from);
4922
+ maxAllowedDate.setDate(maxAllowedDate.getDate() + maxRangeDays);
4923
+ if (focusedInput !== 'from') {
4924
+ baseDisabled.push({ after: maxAllowedDate });
4925
+ }
4926
+ if (focusedInput === 'to' && !value?.to) {
4927
+ const minAllowedDate = new Date(value.from);
4928
+ minAllowedDate.setDate(minAllowedDate.getDate() - maxRangeDays);
4929
+ baseDisabled.push({ before: minAllowedDate });
4930
+ }
4931
+ }
4932
+ if (value?.to && !value?.from && focusedInput === 'from') {
4933
+ const minAllowedDate = new Date(value.to);
4934
+ minAllowedDate.setDate(minAllowedDate.getDate() - maxRangeDays);
4935
+ baseDisabled.push({ before: minAllowedDate });
4936
+ }
4937
+ }
4938
+ return baseDisabled;
4939
+ }, [disabledDates, minDate, maxDate, disabledMatcher, maxRangeDays, value]);
4940
+ const selectedRange = React.useMemo(() => {
4941
+ if (value?.from || value?.to) {
4942
+ return {
4943
+ from: value?.from || undefined,
4944
+ to: value?.to || undefined
4945
+ };
4946
+ }
4947
+ return undefined;
4948
+ }, [value]);
4949
+ return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: rangeStyles.rangeWrapper, children: [jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, required: required, "data-focused": focusedInput === 'from' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), jsxRuntime.jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, required: required, "data-focused": focusedInput === 'to' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), isOpen && (jsxRuntime.jsxs("div", { className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, "data-position": popupPosition, children: [showPresets && presetsToRender.length > 0 && (jsxRuntime.jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsxRuntime.jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, locale: locale.enGB, numberOfMonths: numberOfMonths, defaultMonth: defaultMonth || value?.from || undefined, formatters: formatters, components: {
4950
+ Caption: (props) => jsxRuntime.jsx(CustomCaption$1, { ...props }),
4951
+ }, modifiers: {
4952
+ today: new Date(),
4953
+ }, modifiersClassNames: {
4954
+ today: "rdp-day_today",
4955
+ } })] }))] })] }) }));
4956
+ }
4957
+
4958
+ var timeStyles = {"timePickerPopup":"cw-time-picker-module_timePickerPopup__BN63t","timePickerList":"cw-time-picker-module_timePickerList__E88pr","selected":"cw-time-picker-module_selected__qVnfL","hasIcons":"cw-time-picker-module_hasIcons__ZiGUf","notIcons":"cw-time-picker-module_notIcons__3icu1"};
4959
+
4960
+ const isMobileDevice = () => {
4961
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
4962
+ };
4963
+ function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", useNative = isMobileDevice(), }) {
4964
+ const [isOpen, setIsOpen] = React.useState(false);
4965
+ const [inputValue, setInputValue] = React.useState("");
4966
+ const containerRef = React.useRef(null);
4967
+ const inputRef = React.useRef(null);
4968
+ const selectedItemRef = React.useRef(null);
4969
+ // Sync input value with prop value
4970
+ React.useEffect(() => {
4971
+ if (value) {
4972
+ setInputValue(value);
4973
+ }
4974
+ else {
4975
+ setInputValue("");
4976
+ }
4977
+ }, [value]);
4978
+ // Generate time options based on interval
4979
+ const generateTimeOptions = () => {
4980
+ const options = [];
4981
+ const totalMinutes = 24 * 60; // Total minutes in a day
4982
+ for (let minutes = 0; minutes < totalMinutes; minutes += interval) {
4983
+ const hours = Math.floor(minutes / 60);
4984
+ const mins = minutes % 60;
4985
+ const timeString = `${hours.toString().padStart(2, "0")}:${mins.toString().padStart(2, "0")}`;
4986
+ // Filter by min/max time if provided
4987
+ if (minTime && timeString < minTime)
4988
+ continue;
4989
+ if (maxTime && timeString > maxTime)
4990
+ continue;
4991
+ options.push(timeString);
4992
+ }
4993
+ return options;
4994
+ };
4995
+ const timeOptions = generateTimeOptions();
4996
+ // Close dropdown when clicking outside
4997
+ React.useEffect(() => {
4998
+ const handleClickOutside = (event) => {
4999
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
5000
+ setIsOpen(false);
5001
+ }
5002
+ };
5003
+ if (isOpen) {
5004
+ document.addEventListener("mousedown", handleClickOutside);
5005
+ }
5006
+ return () => {
5007
+ document.removeEventListener("mousedown", handleClickOutside);
5008
+ };
5009
+ }, [isOpen]);
5010
+ // Scroll to selected time when opening dropdown
5011
+ React.useEffect(() => {
5012
+ if (isOpen && selectedItemRef.current) {
5013
+ selectedItemRef.current.scrollIntoView({
5014
+ block: "center",
5015
+ behavior: "smooth",
5016
+ });
5017
+ }
5018
+ }, [isOpen]);
5019
+ const handleTimeSelect = (time) => {
5020
+ onChange(time);
5021
+ setInputValue(time);
5022
+ setIsOpen(false);
5023
+ inputRef.current?.blur();
5024
+ };
5025
+ const handleClear = (e) => {
5026
+ e.stopPropagation();
5027
+ onChange(undefined);
5028
+ setInputValue("");
5029
+ };
5030
+ const handleInputClick = () => {
5031
+ if (!disabled) {
5032
+ setIsOpen(true);
5033
+ }
5034
+ };
5035
+ const handleInputChange = (e) => {
5036
+ let newValue = e.target.value;
5037
+ setInputValue(newValue);
5038
+ // Auto-format as user types
5039
+ // Remove non-numeric characters except colon
5040
+ newValue = newValue.replace(/[^\d:]/g, "");
5041
+ // Auto-add colon after 2 digits
5042
+ if (newValue.length === 2 && !newValue.includes(":")) {
5043
+ newValue = newValue + ":";
5044
+ setInputValue(newValue);
5045
+ }
5046
+ // Limit to HH:mm format
5047
+ if (newValue.length > 5) {
5048
+ newValue = newValue.slice(0, 5);
5049
+ setInputValue(newValue);
5050
+ }
5051
+ // Validate and set time when complete
5052
+ if (newValue.length === 5 && newValue.includes(":")) {
5053
+ const [hours, minutes] = newValue.split(":");
5054
+ const h = parseInt(hours, 10);
5055
+ const m = parseInt(minutes, 10);
5056
+ if (h >= 0 && h <= 23 && m >= 0 && m <= 59) {
5057
+ const formattedTime = `${hours.padStart(2, "0")}:${minutes.padStart(2, "0")}`;
5058
+ // Check min/max time restrictions
5059
+ const isValid = (!minTime || formattedTime >= minTime) &&
5060
+ (!maxTime || formattedTime <= maxTime);
5061
+ if (isValid) {
5062
+ onChange(formattedTime);
5063
+ setInputValue(formattedTime);
5064
+ }
5065
+ }
5066
+ }
5067
+ else if (newValue === "") {
5068
+ onChange(undefined);
5069
+ }
5070
+ };
5071
+ const handleInputBlur = () => {
5072
+ // On blur, sync input with actual value or clear if invalid
5073
+ if (value) {
5074
+ setInputValue(value);
5075
+ }
5076
+ else if (inputValue && inputValue.length === 5) {
5077
+ // Try to validate one more time
5078
+ const [hours, minutes] = inputValue.split(":");
5079
+ const h = parseInt(hours, 10);
5080
+ const m = parseInt(minutes, 10);
5081
+ if (h >= 0 && h <= 23 && m >= 0 && m <= 59) {
5082
+ const formattedTime = `${hours.padStart(2, "0")}:${minutes.padStart(2, "0")}`;
5083
+ onChange(formattedTime);
5084
+ setInputValue(formattedTime);
5085
+ }
5086
+ else {
5087
+ setInputValue("");
5088
+ }
5089
+ }
5090
+ else {
5091
+ setInputValue("");
5092
+ }
5093
+ };
5094
+ const handleInputKeyDown = (e) => {
5095
+ if (e.key === "Enter") {
5096
+ setIsOpen(!isOpen);
5097
+ }
5098
+ else if (e.key === "Escape") {
5099
+ setIsOpen(false);
5100
+ }
5101
+ else if (e.key === "ArrowDown" && isOpen && timeOptions.length > 0) {
5102
+ e.preventDefault();
5103
+ // Focus first option in dropdown
5104
+ const firstOption = document.querySelector(".cw-timepicker-option");
5105
+ firstOption?.focus();
5106
+ }
5107
+ };
5108
+ const handleNativeChange = (e) => {
5109
+ const newValue = e.target.value;
5110
+ onChange(newValue);
5111
+ setInputValue(newValue);
5112
+ };
5113
+ // Format time for display (optional: could add 12h format here)
5114
+ const displayValue = inputValue;
5115
+ // If using native time input
5116
+ if (useNative) {
5117
+ return (jsxRuntime.jsx("div", { className: `cw-timepicker cw-timepicker-native ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsx("div", { className: styles$4.pickerWrapper, children: jsxRuntime.jsx("input", { type: "time", value: displayValue, onChange: handleNativeChange, min: minTime, max: maxTime, step: interval * 60, disabled: disabled, required: required, placeholder: placeholder, className: "cw-timepicker-native" }) })] }) }));
5118
+ }
5119
+ // Custom time picker
5120
+ return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 5, className: showClear ? timeStyles.hasIcons : timeStyles.notIcons }), showClear && (jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsxRuntime.jsx(CwIcon, { iconId: "clock" })) })), isOpen && (jsxRuntime.jsx("div", { className: `${styles$4.pickerPopup} ${timeStyles.timePickerPopup}`, "data-position": popupPosition, children: jsxRuntime.jsx("div", { className: timeStyles.timePickerList, children: timeOptions.map((time) => {
5121
+ const isSelected = time === value;
5122
+ return (jsxRuntime.jsx("button", { ref: isSelected ? selectedItemRef : null, type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
5123
+ }) }) }))] })] }) }));
5124
+ }
5125
+
5126
+ 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, }) {
5127
+ // ========================================
5128
+ // PROPS NORMALIZATION
5129
+ // ========================================
5130
+ /**
5131
+ * Normalize datetime prop to valid Date object
5132
+ * @returns Valid Date object or undefined if invalid
5133
+ */
5134
+ const normalizeDateTime = React.useCallback((dateTime, propName) => {
5135
+ if (!dateTime)
5136
+ return undefined;
5137
+ try {
5138
+ // Convert to Date object if not already
5139
+ const date = dateTime instanceof Date
5140
+ ? dateTime
5141
+ : new Date(dateTime);
5142
+ // Validate the Date object is valid
5143
+ if (isNaN(date.getTime())) {
5144
+ console.warn(`[CwDateTimePicker] Invalid ${propName} provided:`, dateTime);
5145
+ return undefined;
5146
+ }
5147
+ return date;
5148
+ }
5149
+ catch (error) {
5150
+ console.warn(`[CwDateTimePicker] Error parsing ${propName}:`, dateTime, error);
5151
+ return undefined;
5152
+ }
5153
+ }, []);
5154
+ // Normalize min/max datetime props using the helper
5155
+ const normalizedMinDateTime = React.useMemo(() => normalizeDateTime(minDateTime, 'minDateTime'), [minDateTime, normalizeDateTime]);
5156
+ const normalizedMaxDateTime = React.useMemo(() => normalizeDateTime(maxDateTime, 'maxDateTime'), [maxDateTime, normalizeDateTime]);
5157
+ // ========================================
5158
+ // INTERNAL STATE
5159
+ // ========================================
5160
+ const [selectedDate, setSelectedDate] = React.useState(value);
5161
+ const [selectedTime, setSelectedTime] = React.useState(value ? `${value.getHours().toString().padStart(2, "0")}:${value.getMinutes().toString().padStart(2, "0")}` : undefined);
5162
+ // Track previous value to detect external changes
5163
+ const prevValueRef = React.useRef(undefined);
5164
+ // ========================================
5165
+ // COMBINATION AND VALIDATION LOGIC
5166
+ // ========================================
5167
+ /**
5168
+ * Combine date and time into a single Date object
5169
+ * Validates the combined datetime against min/max constraints
5170
+ *
5171
+ * @returns Combined Date object or undefined if invalid
5172
+ */
5173
+ const combineDateTime = React.useCallback((date, time) => {
5174
+ if (!date)
5175
+ return undefined;
5176
+ // If no time is selected, use 00:00
5177
+ if (!time) {
5178
+ const combined = new Date(date);
5179
+ combined.setHours(0, 0, 0, 0);
5180
+ // Validate against min/max datetime
5181
+ if (normalizedMinDateTime && combined < normalizedMinDateTime)
5182
+ return undefined;
5183
+ if (normalizedMaxDateTime && combined > normalizedMaxDateTime)
5184
+ return undefined;
5185
+ return combined;
5186
+ }
5187
+ // Parse time and combine with date
5188
+ const [hours, minutes] = time.split(':').map(Number);
5189
+ const combined = new Date(date);
5190
+ combined.setHours(hours, minutes, 0, 0);
5191
+ // Validate against min/max datetime
5192
+ if (normalizedMinDateTime && combined < normalizedMinDateTime)
5193
+ return undefined;
5194
+ if (normalizedMaxDateTime && combined > normalizedMaxDateTime)
5195
+ return undefined;
5196
+ return combined;
5197
+ }, [normalizedMinDateTime, normalizedMaxDateTime]);
5198
+ /**
5199
+ * Calculate dynamic time restrictions based on selected date
5200
+ *
5201
+ * If the selected date matches the min/max date boundary, restrict times accordingly.
5202
+ * Allows users to manually type any valid time, not just interval-aligned times.
5203
+ * The timeInterval prop only affects the dropdown options, not manual input validation.
5204
+ *
5205
+ * @param selectedDate - Currently selected date
5206
+ * @returns Object with minTime and maxTime strings in "HH:mm" format
5207
+ */
5208
+ const calculateTimeRestrictions = React.useCallback((selectedDate) => {
5209
+ if (!selectedDate)
5210
+ return { minTime, maxTime };
5211
+ // Normalize selected date to date-only (ignore time component)
5212
+ const selectedDateOnly = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate());
5213
+ let calculatedMinTime = minTime;
5214
+ let calculatedMaxTime = maxTime;
5215
+ // If selected date matches minDateTime date, restrict minimum time
5216
+ if (normalizedMinDateTime) {
5217
+ const minDateOnly = new Date(normalizedMinDateTime.getFullYear(), normalizedMinDateTime.getMonth(), normalizedMinDateTime.getDate());
5218
+ if (selectedDateOnly.getTime() === minDateOnly.getTime()) {
5219
+ const hours = normalizedMinDateTime.getHours().toString().padStart(2, "0");
5220
+ const minutes = normalizedMinDateTime.getMinutes().toString().padStart(2, "0");
5221
+ calculatedMinTime = `${hours}:${minutes}`;
5222
+ }
5223
+ }
5224
+ // If selected date matches maxDateTime date, restrict maximum time
5225
+ if (normalizedMaxDateTime) {
5226
+ const maxDateOnly = new Date(normalizedMaxDateTime.getFullYear(), normalizedMaxDateTime.getMonth(), normalizedMaxDateTime.getDate());
5227
+ if (selectedDateOnly.getTime() === maxDateOnly.getTime()) {
5228
+ const hours = normalizedMaxDateTime.getHours().toString().padStart(2, "0");
5229
+ const minutes = normalizedMaxDateTime.getMinutes().toString().padStart(2, "0");
5230
+ calculatedMaxTime = `${hours}:${minutes}`;
5231
+ }
5232
+ }
5233
+ return {
5234
+ minTime: calculatedMinTime,
5235
+ maxTime: calculatedMaxTime
5236
+ };
5237
+ }, [normalizedMinDateTime, normalizedMaxDateTime, minTime, maxTime]);
5238
+ // Calculate current time restrictions based on selected date
5239
+ // Recalculates whenever selectedDate or the calculation function changes
5240
+ const timeRestrictions = React.useMemo(() => calculateTimeRestrictions(selectedDate), [selectedDate, calculateTimeRestrictions]);
5241
+ // ========================================
5242
+ // SYNC WITH EXTERNAL VALUE PROP
5243
+ // ========================================
5244
+ /**
5245
+ * Sync internal state with prop value - only when changed externally
5246
+ * Uses prevValueRef to detect if the change came from outside
5247
+ * (e.g., parent component updated the value programmatically)
5248
+ * vs. internal changes (user interaction)
5249
+ */
5250
+ React.useEffect(() => {
5251
+ const currentTime = value?.getTime();
5252
+ const prevTime = prevValueRef.current?.getTime();
5253
+ // Only update if value actually changed
5254
+ if (currentTime !== prevTime) {
5255
+ prevValueRef.current = value;
5256
+ if (value) {
5257
+ setSelectedDate(value);
5258
+ setSelectedTime(`${value.getHours().toString().padStart(2, "0")}:${value.getMinutes().toString().padStart(2, "0")}`);
5259
+ }
5260
+ else {
5261
+ setSelectedDate(undefined);
5262
+ setSelectedTime(undefined);
5263
+ }
5264
+ }
5265
+ }, [value]);
5266
+ // ========================================
5267
+ // EVENT HANDLERS
5268
+ // ========================================
5269
+ /**
5270
+ * Handle date selection change
5271
+ *
5272
+ * When date changes, validates if the currently selected time is still valid.
5273
+ * If time becomes invalid (e.g., user switched from Mar 14 to Mar 15 with maxTime=16:27,
5274
+ * and had 18:00 selected), it resets the time to undefined.
5275
+ */
5276
+ const handleDateChange = React.useCallback((date) => {
5277
+ setSelectedDate(date);
5278
+ if (date && selectedTime) {
5279
+ const combined = combineDateTime(date, selectedTime);
5280
+ if (!combined) {
5281
+ // Time is no longer valid for this date
5282
+ // Auto-set to first valid time (minTime)
5283
+ const restrictions = calculateTimeRestrictions(date);
5284
+ const newTime = restrictions.minTime || undefined;
5285
+ setSelectedTime(newTime);
5286
+ onChange(combineDateTime(date, newTime));
5287
+ return;
5288
+ }
5289
+ onChange(combined);
5290
+ }
5291
+ else if (date) {
5292
+ // Just date selected, no time yet
5293
+ // Auto-set to minTime if available for better UX
5294
+ const restrictions = calculateTimeRestrictions(date);
5295
+ if (restrictions.minTime) {
5296
+ setSelectedTime(restrictions.minTime);
5297
+ onChange(combineDateTime(date, restrictions.minTime));
5298
+ }
5299
+ else {
5300
+ onChange(undefined);
5301
+ }
5302
+ }
5303
+ else {
5304
+ onChange(undefined);
5305
+ }
5306
+ }, [selectedTime, combineDateTime, onChange, calculateTimeRestrictions]);
5307
+ /**
5308
+ * Handle time selection change
5309
+ *
5310
+ * Combines the new time with the selected date and validates.
5311
+ * Only calls onChange if the combination is valid.
5312
+ */
5313
+ const handleTimeChange = React.useCallback((time) => {
5314
+ setSelectedTime(time);
5315
+ const combined = combineDateTime(selectedDate, time);
5316
+ // Only update if the combination is valid
5317
+ if (combined !== undefined || !time) {
5318
+ onChange(combined);
5319
+ }
5320
+ }, [selectedDate, combineDateTime, onChange]);
5321
+ /**
5322
+ * Handle "Now" button click
5323
+ * Sets the datetime to the current moment, if it's within the allowed min/max datetime range.
5324
+ */
5325
+ const handleNowClick = React.useCallback(() => {
5326
+ const now = new Date();
5327
+ // Check if now is within allowed range
5328
+ const isNowValid = (!normalizedMinDateTime || now >= normalizedMinDateTime) &&
5329
+ (!normalizedMaxDateTime || now <= normalizedMaxDateTime);
5330
+ if (isNowValid) {
5331
+ onChange(now);
5332
+ }
5333
+ }, [normalizedMinDateTime, normalizedMaxDateTime, onChange]);
5334
+ // Extract min/max date from normalized datetime for DatePicker
5335
+ const minDate = normalizedMinDateTime;
5336
+ const maxDate = normalizedMaxDateTime;
5337
+ // ========================================
5338
+ // RENDER
5339
+ // ========================================
5340
+ return (jsxRuntime.jsx("div", { className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsxRuntime.jsx(CwDatePicker, { value: selectedDate, onChange: handleDateChange, minDate: minDate, maxDate: maxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition }), jsxRuntime.jsx(CwTimePicker, { value: selectedTime, onChange: handleTimeChange, interval: timeInterval, minTime: timeRestrictions.minTime, maxTime: timeRestrictions.maxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", onClick: handleNowClick, disabled: disabled, title: "Set to current date and time", text: "Now" }))] })] }) }));
5341
+ }
5342
+
5343
+ 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"};
5344
+
5345
+ function CustomCaption({ displayMonth }) {
5346
+ const { goToMonth, nextMonth, previousMonth } = reactDayPicker.useNavigation();
5347
+ return (jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "chevron-left", onClick: () => previousMonth && goToMonth(previousMonth), disabled: !previousMonth, "aria-label": "Previous month" }), jsxRuntime.jsx("div", { className: styles$4.title, children: dateFns.format(displayMonth, "MMMM yyyy", { locale: locale.enGB }) }), jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "chevron-right", onClick: () => nextMonth && goToMonth(nextMonth), disabled: !nextMonth, "aria-label": "Next month" })] }));
5348
+ }
5349
+ 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, }) {
5350
+ const [isOpen, setIsOpen] = React.useState(false);
5351
+ const [inputValue, setInputValue] = React.useState("");
5352
+ const [selectedDate, setSelectedDate] = React.useState(value);
5353
+ const [selectedTime, setSelectedTime] = React.useState("");
5354
+ const containerRef = React.useRef(null);
5355
+ const inputRef = React.useRef(null);
5356
+ const timeListRef = React.useRef(null);
5357
+ const prevValueRef = React.useRef(value);
5358
+ // Generate time options based on interval - memoized
5359
+ const timeOptions = React.useMemo(() => {
5360
+ const options = [];
5361
+ const totalMinutes = 24 * 60;
5362
+ for (let minutes = 0; minutes < totalMinutes; minutes += timeInterval) {
5363
+ const hours = Math.floor(minutes / 60);
5364
+ const mins = minutes % 60;
5365
+ const timeString = `${hours.toString().padStart(2, "0")}:${mins.toString().padStart(2, "0")}`;
5366
+ if (minTime && timeString < minTime)
5367
+ continue;
5368
+ if (maxTime && timeString > maxTime)
5369
+ continue;
5370
+ options.push(timeString);
5371
+ }
5372
+ return options;
5373
+ }, [timeInterval, minTime, maxTime]);
5374
+ // Parse datetime from string: dd.MM.yyyy HH:mm
5375
+ const parseDateTime = React.useCallback((dateTimeString) => {
5376
+ try {
5377
+ const parts = dateTimeString.trim().split(' ');
5378
+ if (parts.length !== 2)
5379
+ return undefined;
5380
+ const [dateStr, timeStr] = parts;
5381
+ // Parse date part
5382
+ const dateParts = dateStr.split(/[\/\-\.]/);
5383
+ if (dateParts.length !== 3)
5384
+ return undefined;
5385
+ const day = parseInt(dateParts[0], 10);
5386
+ const month = parseInt(dateParts[1], 10) - 1;
5387
+ const year = parseInt(dateParts[2], 10);
5388
+ // Parse time part
5389
+ const timeParts = timeStr.split(':');
5390
+ if (timeParts.length !== 2)
5391
+ return undefined;
5392
+ const hours = parseInt(timeParts[0], 10);
5393
+ const minutes = parseInt(timeParts[1], 10);
5394
+ // Validate ranges
5395
+ if (isNaN(day) || isNaN(month) || isNaN(year) ||
5396
+ isNaN(hours) || isNaN(minutes) ||
5397
+ hours < 0 || hours > 23 ||
5398
+ minutes < 0 || minutes > 59) {
5399
+ return undefined;
4456
5400
  }
5401
+ const parsed = new Date(year, month, day, hours, minutes, 0, 0);
5402
+ // Validate the date is real
5403
+ if (parsed.getDate() === day &&
5404
+ parsed.getMonth() === month &&
5405
+ parsed.getFullYear() === year &&
5406
+ parsed.getHours() === hours &&
5407
+ parsed.getMinutes() === minutes) {
5408
+ return parsed;
5409
+ }
5410
+ return undefined;
4457
5411
  }
4458
- else {
4459
- // Filter options based on search text in any text property
4460
- const filtered = optionsProps.selectList.filter((option) => {
4461
- // Search all properties of the object
4462
- return Object.keys(option).some(key => {
4463
- const value = option[key];
4464
- // Verify that the value is a string or number and contains the search text
4465
- return (typeof value === 'string' || typeof value === 'number') &&
4466
- String(value).toLowerCase().includes(text.toLowerCase());
4467
- });
4468
- });
4469
- setFilteredOptions(filtered);
5412
+ catch {
5413
+ return undefined;
4470
5414
  }
4471
- };
4472
- const handleInputFocus = () => {
4473
- setShowDropdown(true);
4474
- if (searchText === "") {
4475
- setFilteredOptions(optionsProps.selectList);
5415
+ }, []);
5416
+ // Validate and set datetime - with proper datetime comparison
5417
+ const validateAndSetDateTime = React.useCallback((dateTimeString) => {
5418
+ const parsed = parseDateTime(dateTimeString);
5419
+ if (parsed && !isNaN(parsed.getTime())) {
5420
+ const isValid = (!minDateTime || parsed >= minDateTime) &&
5421
+ (!maxDateTime || parsed <= maxDateTime);
5422
+ if (isValid) {
5423
+ onChange(parsed);
5424
+ setSelectedDate(parsed);
5425
+ setSelectedTime(dateFns.format(parsed, "HH:mm"));
5426
+ return true;
5427
+ }
4476
5428
  }
4477
- };
4478
- const handleInputBlur = () => {
4479
- setTimeout(() => {
4480
- setShowDropdown(false);
4481
- }, 150);
4482
- };
4483
- const handleOptionSelect = (option) => {
4484
- setSearchText(option.description);
4485
- setSelectedOption(option);
4486
- if (optionsProps.handleChange) {
4487
- optionsProps.handleChange(option.id);
5429
+ return false;
5430
+ }, [parseDateTime, minDateTime, maxDateTime, onChange]);
5431
+ // Sync input value with prop value - only when changed externally
5432
+ React.useEffect(() => {
5433
+ const currentValue = value;
5434
+ if (currentValue !== prevValueRef.current) {
5435
+ prevValueRef.current = currentValue;
5436
+ if (currentValue) {
5437
+ const dateStr = dateFns.format(currentValue, "dd.MM.yyyy", { locale: locale.enGB });
5438
+ const timeStr = dateFns.format(currentValue, "HH:mm", { locale: locale.enGB });
5439
+ setInputValue(`${dateStr} ${timeStr}`);
5440
+ setSelectedDate(currentValue);
5441
+ setSelectedTime(timeStr);
5442
+ }
5443
+ else {
5444
+ setInputValue("");
5445
+ setSelectedDate(undefined);
5446
+ setSelectedTime("");
5447
+ }
4488
5448
  }
4489
- // Remove the filtered options when selecting one
4490
- setFilteredOptions([]);
4491
- };
4492
- const handleClearClick = () => {
4493
- setSearchText("");
4494
- setFilteredOptions([]);
4495
- setSelectedOption(null);
4496
- };
4497
- return (jsxRuntime.jsxs("div", { className: "cwSearchInputComp", style: optionsProps.style, id: optionsProps.id, children: [jsxRuntime.jsxs("div", { className: optionsProps.labelPosition === "inline"
4498
- ? "cw-flex-row cw-align-left-center"
4499
- : optionsProps.labelPosition === "column"
4500
- ? "cw-label-input-column"
4501
- : "cw-flex-row cw-align-left-center", children: [optionsProps.labelName && (jsxRuntime.jsx("label", { children: optionsProps.labelName })), jsxRuntime.jsx("input", { type: "text", value: searchText, onChange: handleInputChange, onFocus: handleInputFocus, onBlur: handleInputBlur, placeholder: "Search...", className: "cw_input_search", disabled: optionsProps.disabled }), searchText && (jsxRuntime.jsx("button", { className: "cw-button-icon cwi-close cw-input-search-clear", onClick: handleClearClick }))] }), showDropdown && filteredOptions.length > 0 && (jsxRuntime.jsx("div", { className: "cw-input-search-dropdown", children: jsxRuntime.jsx("ul", { children: filteredOptions.map((option) => (jsxRuntime.jsx("li", { onClick: () => handleOptionSelect(option), onMouseDown: (e) => e.preventDefault(), children: optionsProps.renderOption
4502
- ? optionsProps.renderOption(option)
4503
- : option.description }, option.id))) }) }))] }));
4504
- }
4505
-
4506
- var styles$4 = {"context-menu":"cw-context-menu-module_context-menu__dbxnO","context-menu-item":"cw-context-menu-module_context-menu-item__B2W-Q"};
4507
-
4508
- /**
4509
- * A context menu that is rendered when the user clicks on a button.
4510
- * @author NVS
4511
- * @example
4512
- * <ContextMenu
4513
- * options={['Option 1', 'Option 2', 'Option 3']}
4514
- * onSelect={(option) => console.log(`Selected: ${option}`)}
4515
- * >
4516
- * <div>Right-click me!</div>
4517
- * </ContextMenu>
4518
- */
4519
- const CwContextMenu = ({ children, options, offset, onSelect }) => {
4520
- const [isOpen, setIsOpen] = React.useState(false);
4521
- const [position, setPosition] = React.useState({ x: 0, y: 0 });
4522
- const menuRef = React.useRef(null);
4523
- const handleContextMenu = (event) => {
4524
- event.preventDefault();
4525
- setIsOpen(true);
4526
- setPosition({ x: event.clientX, y: event.clientY });
4527
- };
4528
- const handleOptionClick = (option) => {
4529
- onSelect(option);
4530
- setIsOpen(false);
4531
- };
5449
+ }, [value]);
5450
+ // Close popup when clicking outside
4532
5451
  React.useEffect(() => {
4533
- const handleOutsideClick = (event) => {
4534
- if (menuRef.current && !menuRef.current.contains(event.target)) {
5452
+ const handleClickOutside = (event) => {
5453
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
4535
5454
  setIsOpen(false);
4536
5455
  }
4537
5456
  };
4538
- document.addEventListener("mousedown", handleOutsideClick);
5457
+ if (isOpen) {
5458
+ document.addEventListener("mousedown", handleClickOutside);
5459
+ }
4539
5460
  return () => {
4540
- document.removeEventListener("mousedown", handleOutsideClick);
5461
+ document.removeEventListener("mousedown", handleClickOutside);
4541
5462
  };
5463
+ }, [isOpen]);
5464
+ // Scroll to selected time when opening
5465
+ React.useEffect(() => {
5466
+ if (isOpen && selectedTime && timeListRef.current) {
5467
+ const selectedElement = timeListRef.current.querySelector('.selected');
5468
+ if (selectedElement) {
5469
+ selectedElement.scrollIntoView({ block: 'center', behavior: 'smooth' });
5470
+ }
5471
+ }
5472
+ }, [isOpen, selectedTime]);
5473
+ const combineDateTime = React.useCallback((date, time) => {
5474
+ if (!date || !time)
5475
+ return undefined;
5476
+ const [hours, minutes] = time.split(':').map(Number);
5477
+ const combined = new Date(date);
5478
+ combined.setHours(hours, minutes, 0, 0);
5479
+ return combined;
4542
5480
  }, []);
4543
- return (jsxRuntime.jsxs("div", { onContextMenu: handleContextMenu, children: [children, isOpen && (jsxRuntime.jsx("div", { ref: menuRef, className: styles$4["context-menu"], style: {
4544
- top: position.y + (offset?.y || 0),
4545
- left: position.x + (offset?.x || 0),
4546
- }, children: options.map(option => (jsxRuntime.jsx("div", { onClick: () => handleOptionClick(option), className: styles$4["context-menu-item"], children: option }, option))) }))] }));
4547
- };
4548
-
4549
- function CwDataItem(cwBoxItemsProps) {
4550
- return (jsxRuntime.jsx("div", { id: cwBoxItemsProps.id, className: "cwelltBoxItems", style: cwBoxItemsProps.style, children: jsxRuntime.jsx("span", { className: "cwelltBoxItemsText cwelltFont1em_required", style: cwBoxItemsProps.styleDataItem, children: cwBoxItemsProps.children }) }));
4551
- }
4552
- function CwContextualMenu(CwelltRightClickProps) {
4553
- //#region Hooks
4554
- const [isVisibleContextMenu, setVisibleContextMenu] = React.useState(false);
4555
- const [resetClassName, setResetClassName] = React.useState("");
4556
- const [positionRightClick, setpositionRightClick] = React.useState({ x: 0, y: 0 });
4557
- //#endregion
4558
- //#region Functions
4559
- const onShowContextMenu = (e) => {
4560
- e.preventDefault();
4561
- setVisibleContextMenu(true);
4562
- const newPosition = {
4563
- x: e.clientX - e.currentTarget.getBoundingClientRect().left,
4564
- y: e.clientY - e.currentTarget.getBoundingClientRect().top
4565
- };
4566
- setpositionRightClick(newPosition);
4567
- toggleClassName();
4568
- };
4569
- const toggleClassName = () => {
4570
- setTimeout(() => {
4571
- setResetClassName("cwellt_fade_out");
4572
- });
4573
- setTimeout(() => {
4574
- setResetClassName("cwellt_fade_in");
4575
- }, 500);
4576
- };
4577
- const onMouseLeaveContextMenuContainer = () => {
4578
- setVisibleContextMenu(false);
4579
- };
4580
- const onClickContextMenuContainer = () => {
4581
- setVisibleContextMenu(false);
4582
- CwelltRightClickProps.onClick;
4583
- };
4584
- const onKeyUpContextMenu = (e) => {
4585
- if (e.key === "Escape") {
4586
- // context menu dissapear
4587
- setVisibleContextMenu(false);
5481
+ const handleDaySelect = React.useCallback((date) => {
5482
+ if (!date)
5483
+ return;
5484
+ setSelectedDate(date);
5485
+ // If time is already selected, combine and update
5486
+ if (selectedTime) {
5487
+ const combined = combineDateTime(date, selectedTime);
5488
+ if (combined) {
5489
+ onChange(combined);
5490
+ }
5491
+ }
5492
+ }, [selectedTime, combineDateTime, onChange]);
5493
+ const handleTimeSelect = React.useCallback((time) => {
5494
+ setSelectedTime(time);
5495
+ // If date is already selected, combine and update
5496
+ if (selectedDate) {
5497
+ const combined = combineDateTime(selectedDate, time);
5498
+ if (combined) {
5499
+ onChange(combined);
5500
+ setIsOpen(false);
5501
+ inputRef.current?.blur();
5502
+ }
5503
+ }
5504
+ }, [selectedDate, combineDateTime, onChange]);
5505
+ const handleClear = React.useCallback((e) => {
5506
+ e.stopPropagation();
5507
+ onChange(undefined);
5508
+ setInputValue("");
5509
+ setSelectedDate(undefined);
5510
+ setSelectedTime("");
5511
+ }, [onChange]);
5512
+ const handleInputClick = React.useCallback(() => {
5513
+ if (!disabled) {
5514
+ setIsOpen(true);
5515
+ }
5516
+ }, [disabled]);
5517
+ const handleInputChange = React.useCallback((e) => {
5518
+ const newValue = e.target.value;
5519
+ setInputValue(newValue);
5520
+ // Try to parse the full datetime string: dd.MM.yyyy HH:mm
5521
+ if (newValue.length >= 16) {
5522
+ validateAndSetDateTime(newValue);
5523
+ }
5524
+ else if (newValue === "") {
5525
+ onChange(undefined);
5526
+ setSelectedDate(undefined);
5527
+ setSelectedTime("");
5528
+ }
5529
+ }, [validateAndSetDateTime, onChange]);
5530
+ const handleInputBlur = React.useCallback(() => {
5531
+ // Try to parse if there's text
5532
+ if (inputValue && inputValue.trim() !== "") {
5533
+ const parsed = parseDateTime(inputValue);
5534
+ if (parsed && !isNaN(parsed.getTime())) {
5535
+ const isValid = (!minDateTime || parsed >= minDateTime) &&
5536
+ (!maxDateTime || parsed <= maxDateTime);
5537
+ if (isValid) {
5538
+ onChange(parsed);
5539
+ const dateStr = dateFns.format(parsed, "dd.MM.yyyy", { locale: locale.enGB });
5540
+ const timeStr = dateFns.format(parsed, "HH:mm", { locale: locale.enGB });
5541
+ setInputValue(`${dateStr} ${timeStr}`);
5542
+ setSelectedDate(parsed);
5543
+ setSelectedTime(timeStr);
5544
+ return;
5545
+ }
5546
+ }
5547
+ }
5548
+ // Sync with current value
5549
+ if (value) {
5550
+ const dateStr = dateFns.format(value, "dd.MM.yyyy", { locale: locale.enGB });
5551
+ const timeStr = dateFns.format(value, "HH:mm", { locale: locale.enGB });
5552
+ setInputValue(`${dateStr} ${timeStr}`);
5553
+ }
5554
+ else {
5555
+ setInputValue("");
4588
5556
  }
5557
+ }, [inputValue, parseDateTime, minDateTime, maxDateTime, onChange, value]);
5558
+ const handleInputKeyDown = React.useCallback((e) => {
4589
5559
  if (e.key === "Enter") {
4590
- // context menu dissapear
4591
- setVisibleContextMenu(false);
5560
+ e.preventDefault();
5561
+ inputRef.current?.blur();
5562
+ setIsOpen(false);
4592
5563
  }
4593
- };
4594
- //#endregion
4595
- return (jsxRuntime.jsxs("div", { className: "cwelltContextMenu_container", onContextMenu: onShowContextMenu, onMouseLeave: onMouseLeaveContextMenuContainer, onClick: onClickContextMenuContainer, style: { position: "relative" }, onKeyUp: e => onKeyUpContextMenu(e), tabIndex: 0, children: [CwelltRightClickProps.children, jsxRuntime.jsx("div", { id: "contextMenu", className: isVisibleContextMenu ? "cwelltContextMenu " + resetClassName : "cwelltContextMenuHide " + resetClassName, style: {
4596
- top: positionRightClick.y,
4597
- left: positionRightClick.x
4598
- }, children: CwelltRightClickProps.dataSourceContextMenu?.map(indexDataItem => {
4599
- return (jsxRuntime.jsx(CwDataItem, { id: indexDataItem.idDataItem, style: indexDataItem.style, styleDataItem: indexDataItem.styleDataItem, children: indexDataItem.dataItemContent }));
4600
- }) })] }));
4601
- }
4602
-
4603
- // Buttons components
4604
- /**
4605
- * A floating button.
4606
- * @identifier cw_btnFloatingButton
4607
- * @classes cw_btnFloatingButtonActive
4608
- * @dependencies #CwScheduler #CwSchedulerActive #cwelltContentDuty #cwelltContentDutyActive
4609
- */
4610
- // Floating button
4611
- function CwFloatingButton() {
4612
- const cwShowElement = () => {
4613
- // Content of List Duties
4614
- const cwContentDuty = document.getElementById("cwelltContentDuty");
4615
- cwContentDuty?.classList.toggle("cwelltContentDutyActive");
4616
- // Floating button
4617
- const cw_btnFloatingButton = document.getElementById("cw_btnFloatingButton");
4618
- cw_btnFloatingButton?.classList.toggle("cw_btnFloatingButtonActive");
4619
- // #CwScheduler [ scheduler container]
4620
- const cwScheduler = document.getElementById("CwelltScheduler");
4621
- cwScheduler?.classList.toggle("CwelltSchedulerActive");
4622
- };
4623
- return jsxRuntime.jsx("button", { className: "cw_btnFloatingButton", onClick: cwShowElement, id: "cw_btnFloatingButton" });
4624
- }
4625
- // Primary button => CwButtonDef
4626
- // CwButtonDef
4627
- function CwButtonDef({ cw_btn_desc, cw_btnOnclick, cw_btn_disabled }) {
4628
- return (jsxRuntime.jsx("button", { className: "cw-button cw_btn_primary", onClick: cw_btnOnclick, disabled: cw_btn_disabled, children: cw_btn_desc }));
4629
- }
4630
- // Cw add button
4631
- function CwBtnAdd({ cw_btnOnclick, cw_btn_disabled }) {
4632
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-plus", disabled: cw_btn_disabled });
4633
- }
4634
- // Cw Save button
4635
- function CwBtnSave({ cw_btnOnclick, cw_btn_disabled }) {
4636
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-save", disabled: cw_btn_disabled });
4637
- }
4638
- // Cw edit button
4639
- function CwBtnEdit({ cw_btnOnclick, cw_btn_disabled }) {
4640
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-edit", disabled: cw_btn_disabled });
4641
- }
4642
- // Cw search button
4643
- function CwBtnSearch({ cw_btnOnclick, cw_btn_disabled }) {
4644
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-search", disabled: cw_btn_disabled });
4645
- }
4646
- // Cw download button
4647
- function CwBtnDownload({ cw_btnOnclick, cw_btn_disabled }) {
4648
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-download", disabled: cw_btn_disabled });
4649
- }
4650
- // Cw view button
4651
- function CwBtnView({ cw_btnOnclick, cw_btn_disabled }) {
4652
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-eye-show", disabled: cw_btn_disabled });
4653
- }
4654
- // Cw Print button
4655
- function CwBtnPrint({ cw_btnOnclick, cw_btn_disabled }) {
4656
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-print", disabled: cw_btn_disabled });
4657
- }
4658
- // Cw cancel button
4659
- function CwBtnCancel({ cw_btnOnclick, cw_btn_disabled }) {
4660
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-cancel", disabled: cw_btn_disabled, "data-color": "danger" });
4661
- }
4662
- // Cw Delete button
4663
- function CwBtnDelete({ cw_btnOnclick, cw_btn_disabled }) {
4664
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-delete", disabled: cw_btn_disabled, "data-color": "danger" });
4665
- }
4666
- // CwRefresh
4667
- function CwBtnRefresh({ cw_btnOnclick, cw_btn_disabled }) {
4668
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-refresh", disabled: cw_btn_disabled });
4669
- }
4670
- // Cw hide
4671
- function CwBtnHide({ cw_btnOnclick, cw_btn_disabled }) {
4672
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-eye-hide", disabled: cw_btn_disabled });
4673
- }
4674
- // Cw Select
4675
- function CwBtnSelect({ cw_btnOnclick, cw_btn_disabled }) {
4676
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btn_select", disabled: cw_btn_disabled });
4677
- }
4678
- // Cw Share
4679
- function CwBtnShare({ cw_btnOnclick, cw_btn_disabled }) {
4680
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-share", disabled: cw_btn_disabled });
4681
- }
4682
- // Cw Files
4683
- function CwBtnFiles({ cw_btnOnclick, cw_btn_disabled }) {
4684
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btn_files", disabled: cw_btn_disabled });
4685
- }
4686
- // Cw Airport
4687
- function CwBtnAirport({ cw_btnOnclick, cw_btn_disabled }) {
4688
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btn_airport", disabled: cw_btn_disabled });
4689
- }
4690
- // DownLoadAllInfo
4691
- function CwBtnDownLoadAllInfo({ cw_btnOnclick, cw_btn_disabled }) {
4692
- return (jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-folder-download", disabled: cw_btn_disabled }));
4693
- }
4694
- // PropertyFolder
4695
- function CwBtnPropertyFolder({ cw_btnOnclick, cw_btn_disabled }) {
4696
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-directory", disabled: cw_btn_disabled });
4697
- }
4698
- // AddFolder
4699
- function CwBtnAddFolder({ cw_btnOnclick, cw_btn_disabled }) {
4700
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-folder-add", disabled: cw_btn_disabled });
4701
- }
4702
- // EditFolder
4703
- function CwBtnEditFolder({ cw_btnOnclick, cw_btn_disabled }) {
4704
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-folder-edit", disabled: cw_btn_disabled });
4705
- }
4706
- // UploadFiles
4707
- function CwBtnUploadFiles({ cw_btnOnclick, cw_btn_disabled }) {
4708
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-upload", disabled: cw_btn_disabled });
4709
- }
4710
- // GoBackSection [ Emanual ]
4711
- function CwBtnGoBackFolder({ cw_btnOnclick, cw_btn_disabled }) {
4712
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cwBtnGoBackFolder", disabled: cw_btn_disabled });
4713
- }
4714
- // BookMark [ Emanual ]
4715
- function CwBtnBookMark({ cw_btnOnclick, cw_btn_disabled }) {
4716
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-star", disabled: cw_btn_disabled });
4717
- }
4718
- // Publish
4719
- function CwBtnPublish({ cw_btnOnclick, cw_btn_disabled }) {
4720
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnPublish", disabled: cw_btn_disabled });
4721
- }
4722
- // Approve
4723
- function CwBtnApprove({ cw_btnOnclick, cw_btn_disabled }) {
4724
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnApprove", disabled: cw_btn_disabled });
4725
- }
4726
- // Bulk duty
4727
- function CwBtnBulkDuty({ cw_btnOnclick, cw_btn_disabled }) {
4728
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnBulkDuty", disabled: cw_btn_disabled });
4729
- }
4730
- // DropDownButtonCrewControl
4731
- function CwBtnDropDownMenu({ cw_btnOnclick, cw_btn_disabled }) {
4732
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnDropDownMenu", disabled: cw_btn_disabled });
4733
- }
4734
- // DropDownButtonCrewControl
4735
- function CwBtnAlert({ cw_btnOnclick, cw_btn_disabled, cw_name }) {
4736
- return (jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-alert", disabled: cw_btn_disabled, id: cw_name }));
4737
- }
4738
- // BtnNavFirstItemView
4739
- function CwBtnNavFirstItemView({ cw_btnOnclick, cw_btn_disabled }) {
4740
- return (jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnNavFirstItemView", disabled: cw_btn_disabled }));
4741
- }
4742
- // BtnNavLastItemView
4743
- function CwBtnNavLastItemView({ cw_btnOnclick, cw_btn_disabled }) {
4744
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnNavLastItemView", disabled: cw_btn_disabled });
4745
- }
4746
- // BtnNavbreviewItem
4747
- function CwBtnNavPreviewItem({ cw_btnOnclick, cw_btn_disabled }) {
4748
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnNavPreviewItem", disabled: cw_btn_disabled });
4749
- }
4750
- // BtnNavNextDay
4751
- function CwBtnNavNextDay({ cw_btnOnclick, cw_btn_disabled }) {
4752
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnNavNextDay", disabled: cw_btn_disabled });
4753
- }
4754
- // BtnNavNextDay
4755
- function CwBtnStatistic({ cw_btnOnclick, cw_btn_disabled }) {
4756
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-file-report", disabled: cw_btn_disabled });
4757
- }
4758
- // BtnNavNextDay
4759
- function CwBtnCrewPlanning({ cw_btnOnclick, cw_btn_disabled }) {
4760
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-calendar-view", disabled: cw_btn_disabled });
4761
- }
4762
- // BtnReleasePeriod
4763
- function CwBtnReleasePeriod({ cw_btnOnclick, cw_btn_disabled }) {
4764
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnReleasePeriod", disabled: cw_btn_disabled });
4765
- }
4766
- // BtnReleasePeriod
4767
- function CwBtnGeneratePairing({ cw_btnOnclick, cw_btn_disabled }) {
4768
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-plane-pairing", disabled: cw_btn_disabled });
4769
- }
4770
- // BtnImportRequests
4771
- function CwBtnImportRequests({ cw_btnOnclick, cw_btn_disabled }) {
4772
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnImportRequests", disabled: cw_btn_disabled });
4773
- }
4774
- // BtnPairing
4775
- function CwBtnPairing({ cw_btnOnclick, cw_btn_disabled }) {
4776
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-calendar-plane", disabled: cw_btn_disabled });
4777
- }
4778
- // BtnVacations
4779
- function CwBtnVacations({ cw_btnOnclick, cw_btn_disabled }) {
4780
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-luggage", disabled: cw_btn_disabled });
4781
- }
4782
- // BtnMVT
4783
- function CwBtnMVT({ cw_btnOnclick, cw_btn_disabled }) {
4784
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-plane-movement", disabled: cw_btn_disabled });
4785
- }
4786
- // BtnDelay
4787
- function CwBtnDelay({ cw_btnOnclick, cw_btn_disabled }) {
4788
- return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-plane-delay", disabled: cw_btn_disabled });
5564
+ else if (e.key === "Escape") {
5565
+ setIsOpen(false);
5566
+ inputRef.current?.blur();
5567
+ }
5568
+ }, []);
5569
+ const handleNowClick = React.useCallback(() => {
5570
+ const now = new Date();
5571
+ // Check if now is within allowed range
5572
+ const isNowValid = (!minDateTime || now >= minDateTime) &&
5573
+ (!maxDateTime || now <= maxDateTime);
5574
+ if (isNowValid) {
5575
+ onChange(now);
5576
+ setIsOpen(false);
5577
+ }
5578
+ }, [minDateTime, maxDateTime, onChange]);
5579
+ // Memoize formatters
5580
+ const formatters = React.useMemo(() => ({
5581
+ formatCaption: (date) => dateFns.format(date, "MMMM yyyy", { locale: locale.enGB }),
5582
+ formatWeekdayName: (date) => dateFns.format(date, "EEEEEE", { locale: locale.enGB })
5583
+ }), []);
5584
+ // Memoize disabled days
5585
+ const disabledDays = React.useMemo(() => [
5586
+ ...(disabledDates || []),
5587
+ ...(minDateTime ? [{ before: minDateTime }] : []),
5588
+ ...(maxDateTime ? [{ after: maxDateTime }] : []),
5589
+ ...(disabledMatcher ? [disabledMatcher] : []),
5590
+ ], [disabledDates, minDateTime, maxDateTime, disabledMatcher]);
5591
+ return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 16, style: { width: "24ch" } }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar-time" })) }), isOpen && (jsxRuntime.jsxs("div", { className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, "data-position": popupPosition, children: [jsxRuntime.jsxs("div", { className: compactStyles.calendarWrapper, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, locale: locale.enGB, numberOfMonths: numberOfMonths, formatters: formatters, components: {
5592
+ Caption: (props) => jsxRuntime.jsx(CustomCaption, { ...props }),
5593
+ }, modifiers: {
5594
+ today: new Date(),
5595
+ }, modifiersClassNames: {
5596
+ today: "rdp-day_today",
5597
+ } }), showTodayButton && (jsxRuntime.jsx("footer", { className: "cw-flex-row cw-align-center-center", children: jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", icon: "check-big", onClick: handleNowClick, text: "Now" }) }))] }), jsxRuntime.jsxs("div", { className: compactStyles.timeWrapper, children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx(CwIcon, { iconId: "clock", size: "medium" }), jsxRuntime.jsx("span", { children: "Time" })] }), jsxRuntime.jsx("div", { ref: timeListRef, className: `${timeStyles.timePickerList} ${compactStyles.compactTimeList}`, children: timeOptions.map((time) => {
5598
+ const isSelected = time === selectedTime;
5599
+ return (jsxRuntime.jsx("button", { type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
5600
+ }) })] })] }))] })] }) }));
4789
5601
  }
4790
5602
 
4791
5603
  const ResourcesTitleList$1 = ({ resources, canBePinned, includesPinned, onCrewPinning, onClickResourceContextMenu, ResourceTitleComponent }) => {
@@ -5830,8 +6642,8 @@ class CwScheduler2 extends React.Component {
5830
6642
  this.handleResize();
5831
6643
  }
5832
6644
  if (dateChange) {
5833
- const events = lodash.cloneDeep(this.props.events);
5834
- const resources = lodash.cloneDeep(this.props.resources);
6645
+ const events = lodashEs.cloneDeep(this.props.events);
6646
+ const resources = lodashEs.cloneDeep(this.props.resources);
5835
6647
  this.initOutside(events, resources, _nextProps, _nextProps.startDate, _nextProps.endDate);
5836
6648
  if (this.state.showConsoleLogs) {
5837
6649
  console.log("Schedule - componentWillReceiveProps - print on schedule, end: ", moment(new Date()).toString());
@@ -5954,6 +6766,12 @@ const PinButton = ({ canBePinned, resource, onCrewPinning }) => {
5954
6766
  return jsxRuntime.jsx("button", { className: "cw-button-icon cw-icon-pin", ...buttonProps });
5955
6767
  };
5956
6768
 
6769
+ const addMinutesToDateFromPx = (originalDate, leftPx, minutesPerPx) => {
6770
+ const minutes = leftPx / minutesPerPx;
6771
+ const datePlusMinutes = new Date(originalDate.getTime() + minutes * 60000);
6772
+ return datePlusMinutes;
6773
+ };
6774
+
5957
6775
  const doubleClickOnResource = (props, resource) => {
5958
6776
  if (props.scheduler_handleDblClickOnResourceInScheduler) {
5959
6777
  props.scheduler_handleDblClickOnResourceInScheduler(resource);
@@ -6120,12 +6938,6 @@ const EventRender = ({ event, schedulerProps }) => {
6120
6938
  return render;
6121
6939
  };
6122
6940
 
6123
- const addMinutesToDateFromPx = (originalDate, leftPx, minutesPerPx) => {
6124
- const minutes = leftPx / minutesPerPx;
6125
- const datePlusMinutes = new Date(originalDate.getTime() + minutes * 60000);
6126
- return datePlusMinutes;
6127
- };
6128
-
6129
6941
  const onDropEventToResource = (props, cblDragNDrop, resource) => {
6130
6942
  props.scheduler_handleOnDropCblEventsOnResource.call(props.parent, cblDragNDrop, resource);
6131
6943
  };
@@ -6225,12 +7037,25 @@ const ResourceRender = React.memo(({ res, schedulerProps, contentArea, state })
6225
7037
  }, className: "cwellt_divRow_schContent", children: res.events.map((evnt) => (jsxRuntime.jsx(EventRender, { event: evnt, schedulerProps: schedulerProps }, evnt.id))) }, res.id));
6226
7038
  }, arePropsEqual);
6227
7039
 
6228
- const ResourceListRender = ({ resources, schedulerProps, state, contentArea, onClickContextMenu, crewAssignmentSchedulerContextMenu, }) => {
6229
- return (jsxRuntime.jsx(React.Fragment, { children: resources.map((r, _i) => (jsxRuntime.jsx(antd.Dropdown, { placement: "topLeft", dropdownRender: () => {
6230
- return (jsxRuntime.jsx(antd.Menu, { style: { pointerEvents: "auto" }, onClick: (e) => {
6231
- onClickContextMenu(e, r);
6232
- }, children: crewAssignmentSchedulerContextMenu?.map((m) => (jsxRuntime.jsxs(antd.Menu.Item, { children: [jsxRuntime.jsx("span", { className: m.icon, style: { color: m.color } }), jsxRuntime.jsx("span", { className: "cwellt_contextMenu", children: m.text })] }, m.key))) }));
6233
- }, trigger: ["contextMenu"], children: jsxRuntime.jsx("span", { onDoubleClick: () => doubleClickOnResource(schedulerProps, r), id: schedulerProps.id + "_" + r.id, children: jsxRuntime.jsx(ResourceRender, { res: r, schedulerProps: schedulerProps, contentArea: contentArea, state: state, isInViewport: r.isInViewport }, r.id) }) }, r.id))) }));
7040
+ const ResourceListRender = ({ resources, schedulerProps, state, contentArea,
7041
+ // onClickContextMenu,
7042
+ crewAssignmentSchedulerContextMenu, }) => {
7043
+ return (jsxRuntime.jsx(React.Fragment, { children: resources.map((r, _i) => (jsxRuntime.jsx(CwAnchoredMenu, { placement: "bottom", onContextMenu: (e) => {
7044
+ // Dirty temporal solution to remove ANT design, this can be killed when this scheduler is deprecated
7045
+ const leftPos = e.currentTarget.getBoundingClientRect().left -
7046
+ (contentArea?.getBoundingClientRect()?.left ?? 0) -
7047
+ window.scrollX;
7048
+ const calculatedDatetime = addMinutesToDateFromPx(schedulerProps.startDate, leftPos, state.minutePx);
7049
+ r.__contextMenuDatetime = calculatedDatetime;
7050
+ }, options: crewAssignmentSchedulerContextMenu?.map(m => ({
7051
+ key: m.key,
7052
+ label: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: m.icon, style: { color: m.color } }), jsxRuntime.jsx("span", { children: m.text })] }))
7053
+ })) ?? [], onSelect: (key) => {
7054
+ const datetime = r.__contextMenuDatetime ?? new Date();
7055
+ if (schedulerProps.scheduler_handleOnClickContextMenuResource) {
7056
+ schedulerProps.scheduler_handleOnClickContextMenuResource(datetime, r, key, schedulerProps.id);
7057
+ }
7058
+ }, children: jsxRuntime.jsx("span", { onDoubleClick: () => doubleClickOnResource(schedulerProps, r), id: schedulerProps.id + "_" + r.id, children: jsxRuntime.jsx(ResourceRender, { res: r, schedulerProps: schedulerProps, contentArea: contentArea, state: state, isInViewport: r.isInViewport }, r.id) }) }, r.id))) }));
6234
7059
  };
6235
7060
 
6236
7061
  const TimeLine$1 = ({ id, toolTipTitle, marginLeft, color = "rgba(255,0,0,.6)", pixels = 2, height = "100%", zIndex = 1, }) => {
@@ -6985,6 +7810,13 @@ function getPercentageFromMouseEvent(event) {
6985
7810
  const clickPercentage = x / totalWidth;
6986
7811
  return clickPercentage;
6987
7812
  }
7813
+ function getPercentageFromElement(clientX, element) {
7814
+ const rect = element.getBoundingClientRect();
7815
+ const x = clientX - rect.left;
7816
+ const totalWidth = rect.width;
7817
+ const clickPercentage = x / totalWidth;
7818
+ return clickPercentage;
7819
+ }
6988
7820
 
6989
7821
  class OnClickEvent {
6990
7822
  id;
@@ -7012,8 +7844,10 @@ class OnDoubleClickEvent {
7012
7844
  }
7013
7845
  class OnDragEvent {
7014
7846
  id;
7015
- constructor(id) {
7847
+ crewId;
7848
+ constructor(id, crewId) {
7016
7849
  this.id = id;
7850
+ this.crewId = crewId;
7017
7851
  }
7018
7852
  }
7019
7853
  class OnDropEvent {
@@ -7088,10 +7922,6 @@ class OnClickRowHeader {
7088
7922
  this.id = id;
7089
7923
  }
7090
7924
  }
7091
- class UpdateApi {
7092
- constructor() {
7093
- }
7094
- }
7095
7925
  class OnClickUtc {
7096
7926
  constructor() {
7097
7927
  }
@@ -7223,15 +8053,13 @@ const BackgroundEvent = ({ value, heightRem }) => {
7223
8053
 
7224
8054
  var styles$1 = {"scheduler-row-header":"scheduler-row-module_scheduler-row-header__S-iv4"};
7225
8055
 
7226
- var styles = {"super-scheduler-row-header":"super-scheduler-module_super-scheduler-row-header__TTs4e","indicators":"super-scheduler-module_indicators__f4lIT","scheduler-crewmember-functions":"super-scheduler-module_scheduler-crewmember-functions__BS2hs"};
7227
-
7228
8056
  const DefaultRowHeader = ({ value, width, onEvent }) => {
7229
8057
  return (jsxRuntime.jsxs("div", { style: {
7230
8058
  width: width,
7231
8059
  // background: color,
7232
8060
  }, onClick: (_) => {
7233
8061
  onEvent(new OnClickRowHeader(value.rowId));
7234
- }, className: styles$1["scheduler-row-header"], children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: value.title }), value.title2 && jsxRuntime.jsxs("span", { children: ["-", value.title2] }), " ", jsxRuntime.jsx("strong", { children: value.subtitle })] }), value.subtitle && jsxRuntime.jsxs("div", { style: { opacity: 0.5 }, children: [value.title3 && jsxRuntime.jsxs("span", { className: styles["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] }), value.subtitle2 && jsxRuntime.jsxs("span", { children: ["-", value.subtitle2] })] })] }));
8062
+ }, className: styles$1["scheduler-row-header"], children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: value.title }), value.title2 && jsxRuntime.jsxs("span", { children: ["-", value.title2] }), " ", jsxRuntime.jsx("strong", { children: value.subtitle })] }), value.subtitle && jsxRuntime.jsxs("div", { style: { opacity: 0.5 }, children: [value.title3 && jsxRuntime.jsxs("span", { className: styles$1["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] }), value.subtitle2 && jsxRuntime.jsxs("span", { children: ["-", value.subtitle2] })] })] }));
7235
8063
  };
7236
8064
 
7237
8065
  function useSingleAndDoubleClicks(onClick, onDoubleClick) {
@@ -7276,7 +8104,7 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
7276
8104
  const [isOnDrag, setIsOnDrag] = React.useState(false);
7277
8105
  const [isContextMenuOpen, setIsContextMenuOpen] = React.useState(false);
7278
8106
  // Calculate colors of the event
7279
- const backColor = getHSLColor(value.color, value.alpha ?? 0.75);
8107
+ const backColor = getHSLColor(value.color, value.alpha ?? 1);
7280
8108
  const textColor = getContrastColor(value.color);
7281
8109
  const eventTransparent = value.alpha ? value.alpha < 0.7 : false;
7282
8110
  const canClick = value.isDraggable || value.isClickable === true;
@@ -7304,18 +8132,12 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
7304
8132
  e.preventDefault();
7305
8133
  onEvent(new OnDoubleClickEvent(value.id));
7306
8134
  });
7307
- return (jsxRuntime.jsx(antd.Dropdown, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "bottom", menu: {
7308
- items: value.contextMenuItems,
7309
- onClick: (e) => {
7310
- e.domEvent.nativeEvent.preventDefault();
7311
- e.domEvent.nativeEvent.stopPropagation();
7312
- e.domEvent.nativeEvent.stopImmediatePropagation();
7313
- e.domEvent.preventDefault();
7314
- e.domEvent.stopPropagation();
7315
- onEvent(new OnClickContextMenu(value.id, e.key));
7316
- },
7317
- onMouseLeave: () => setIsContextMenuOpen(false),
7318
- }, trigger: ["contextMenu"], overlayStyle: { animationDuration: "0" }, arrow: (value.contextMenuItems?.length ?? 0) > 0, children: jsxRuntime.jsx("div", { style: {
8135
+ return (jsxRuntime.jsx(CwAnchoredMenu, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, onContextMenu: (e) => {
8136
+ e.stopPropagation();
8137
+ // onEvent(new OnRightClickEvent(value.id));
8138
+ }, placement: "bottom", options: value.contextMenuItems ?? [], onSelect: (key) => {
8139
+ onEvent(new OnClickContextMenu(value.id, key));
8140
+ }, children: jsxRuntime.jsx("div", { style: {
7319
8141
  top: "2px",
7320
8142
  left: `${value.left}%`,
7321
8143
  width: `${value.width}%`,
@@ -7331,14 +8153,10 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
7331
8153
  setIsOnDrag(false);
7332
8154
  }, onDragStart: (_) => {
7333
8155
  if (value.isDraggable)
7334
- onEvent(new OnDragEvent(value.id));
8156
+ onEvent(new OnDragEvent(value.id, value.rowId));
7335
8157
  }, onDragEnd: (_) => {
7336
8158
  if (value.isDraggable)
7337
8159
  setIsOnDrag(false);
7338
- }, onContextMenu: (e) => {
7339
- e.stopPropagation();
7340
- e.preventDefault();
7341
- onEvent(new OnRightClickEvent(value.id));
7342
8160
  }, children: jsxRuntime.jsx(CwGenericTooltip, { content: value.tooltip, position: "bottom", hide: isOnDrag, dissapearsWhenHover: true, showDelay: 200, children: jsxRuntime.jsxs("div", { style: {
7343
8161
  border: value.selected ? "2px solid black" : "none",
7344
8162
  backgroundColor: backColor,
@@ -7381,7 +8199,7 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
7381
8199
  backgroundColor: value.primaryTimeMarkerColor,
7382
8200
  } })), value.secondaryTimeMarkerColor && (jsxRuntime.jsx("div", { className: styles$2["time-marker"], style: {
7383
8201
  backgroundColor: value.secondaryTimeMarkerColor,
7384
- } }))] }) }) }, value.id) }, value.id));
8202
+ } }))] }) }) }, value.id) }));
7385
8203
  };
7386
8204
 
7387
8205
  const eventsCollide = (event1, event2) => {
@@ -7425,18 +8243,11 @@ const WeekEndLine = ({ left, top = "0px", height, widthPercentage }) => {
7425
8243
  return (jsxRuntime.jsx(TimeLine, { color: "rgba(0,0,0,0.05)", left: left + "%", height: height, width: widthPercentage + "%", top: top }));
7426
8244
  };
7427
8245
 
7428
- const onClickMenuItem$1 = (e, event) => {
7429
- e.domEvent.nativeEvent.preventDefault();
7430
- e.domEvent.nativeEvent.stopPropagation();
7431
- e.domEvent.nativeEvent.stopImmediatePropagation();
7432
- e.domEvent.preventDefault();
7433
- e.domEvent.stopPropagation();
7434
- event();
7435
- };
7436
8246
  const SchedulerRow = React.memo((props) => {
7437
8247
  const [isContextMenuOpen, setIsContextMenuOpen] = React.useState(false);
7438
8248
  const { events, backgroundEvents, rowHeader, contextMenuItems, RowTitleComp, EventComp, BackgroundEventComp, weekendLines, divisionLines, timeLinePercentage, selectedDate, visibleDays, onEvent, } = props;
7439
8249
  const internalRows = separateEventsToInnerRows(events);
8250
+ const schedulerDivRef = React.useRef(null);
7440
8251
  const { handleClick, handleDoubleClick } = useSingleAndDoubleClicks((e) => {
7441
8252
  e.stopPropagation();
7442
8253
  e.preventDefault();
@@ -7449,15 +8260,17 @@ const SchedulerRow = React.memo((props) => {
7449
8260
  return (jsxRuntime.jsxs("div", { style: {
7450
8261
  display: "flex",
7451
8262
  minHeight: props.rowHeightInRem + "rem",
7452
- }, children: [jsxRuntime.jsx(RowTitleComp, { ...rowHeader }), jsxRuntime.jsx(antd.Dropdown, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "bottom", menu: {
7453
- items: contextMenuItems,
7454
- onClick: (e) => {
7455
- onClickMenuItem$1(e, () => {
7456
- onEvent(new OnClickContextMenu(rowHeader.value.rowId, e.key));
7457
- });
7458
- },
7459
- onMouseLeave: () => setIsContextMenuOpen(false),
7460
- }, trigger: ["contextMenu"], overlayStyle: { animationDuration: "0" }, arrow: (contextMenuItems?.length ?? 0) > 0, children: jsxRuntime.jsxs("div", { style: {
8263
+ }, "data-name": "scheduler-row", children: [jsxRuntime.jsx(RowTitleComp, { ...rowHeader }), jsxRuntime.jsx(CwAnchoredMenu, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "bottom", options: contextMenuItems ?? [], onSelect: (key) => {
8264
+ onEvent(new OnClickContextMenu(rowHeader.value.rowId, key));
8265
+ }, onContextMenu: (e) => {
8266
+ // e.preventDefault();
8267
+ e.stopPropagation();
8268
+ if (!schedulerDivRef.current)
8269
+ return;
8270
+ const percentage = getPercentageFromElement(e.clientX, schedulerDivRef.current);
8271
+ const date = dateFromPercentage(selectedDate, visibleDays, percentage);
8272
+ onEvent(new OnRightClickRow(rowHeader.value.rowId, date));
8273
+ }, children: jsxRuntime.jsxs("div", { ref: schedulerDivRef, style: {
7461
8274
  flex: 1,
7462
8275
  display: "flex",
7463
8276
  flexDirection: "column",
@@ -7466,8 +8279,6 @@ const SchedulerRow = React.memo((props) => {
7466
8279
  e.preventDefault();
7467
8280
  const percentage = getPercentageFromMouseEvent(e);
7468
8281
  const date = dateFromPercentage(selectedDate, visibleDays, percentage);
7469
- // https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/platform
7470
- // change for navigator.userAgentData.platform when acepted in all browsers
7471
8282
  const isMac = navigator.platform.toUpperCase().includes("MAC");
7472
8283
  const isCtrlOrAltPressed = isMac ? e.altKey : e.ctrlKey;
7473
8284
  if (isCtrlOrAltPressed) {
@@ -7478,13 +8289,7 @@ const SchedulerRow = React.memo((props) => {
7478
8289
  }
7479
8290
  }, onDragOver: (e) => {
7480
8291
  e.preventDefault();
7481
- }, onClick: handleClick, onDoubleClick: handleDoubleClick, onContextMenu: (e) => {
7482
- e.preventDefault();
7483
- e.stopPropagation();
7484
- const percentage = getPercentageFromMouseEvent(e);
7485
- const date = dateFromPercentage(selectedDate, visibleDays, percentage);
7486
- onEvent(new OnRightClickRow(rowHeader.value.rowId, date));
7487
- }, children: [weekendLines.map((weekend) => (jsxRuntime.jsx(WeekEndLine, { height: "100%", left: weekend.left, widthPercentage: weekend.width }, weekend.left))), divisionLines.map((division) => (jsxRuntime.jsx(DivisionLine, { height: "100%", left: division.left }, division.left))), backgroundEvents.length > 0 && backgroundEvents.some((e) => e.isVisible) && (jsxRuntime.jsx("div", { style: {
8292
+ }, onClick: handleClick, onDoubleClick: handleDoubleClick, children: [weekendLines.map((weekend) => (jsxRuntime.jsx(WeekEndLine, { height: "100%", left: weekend.left, widthPercentage: weekend.width }, weekend.left))), divisionLines.map((division) => (jsxRuntime.jsx(DivisionLine, { height: "100%", left: division.left }, division.left))), backgroundEvents.length > 0 && backgroundEvents.some((e) => e.isVisible) && (jsxRuntime.jsx("div", { style: {
7488
8293
  height: "100%",
7489
8294
  position: internalRows.length > 0 ? "absolute" : "relative",
7490
8295
  width: "100%",
@@ -7497,7 +8302,7 @@ const SchedulerRow = React.memo((props) => {
7497
8302
  height: props.rowHeightInRem + "rem",
7498
8303
  pointerEvents: "none"
7499
8304
  }, children: internalRow.map((event) => (jsxRuntime.jsx(EventComp, { value: event, heightRem: props.rowHeightInRem, onEvent: onEvent }, event.id))) }, index));
7500
- }), !(timeLinePercentage < 0 || timeLinePercentage > 100) && (jsxRuntime.jsx(TimeLine, { color: "red", left: `${timeLinePercentage}%`, top: "0px", height: `100%` }))] }) }, rowHeader.value.rowId)] }));
8305
+ }), !(timeLinePercentage < 0 || timeLinePercentage > 100) && (jsxRuntime.jsx(TimeLine, { color: "red", left: `${timeLinePercentage}%`, top: "0px", height: `100%` }))] }) })] }));
7501
8306
  }, (prevProps, nextProps) => {
7502
8307
  // This memo is necessary to prevent re-render all the rows when a user makes drag and drop
7503
8308
  const getEventKey = (event) => {
@@ -7748,205 +8553,6 @@ const getWeekendsDaysInDateRange = (initialDate, visibleDays) => {
7748
8553
 
7749
8554
  class UiEvent {
7750
8555
  }
7751
- function when(event) {
7752
- let found = false;
7753
- const actions = {
7754
- case(eventType, action) {
7755
- if (!found && event instanceof eventType) {
7756
- action(event);
7757
- found = true;
7758
- }
7759
- return actions;
7760
- },
7761
- else(action) {
7762
- if (!found) {
7763
- action(event);
7764
- }
7765
- }
7766
- };
7767
- return actions;
7768
- }
7769
-
7770
- const getListOfNumbers = (len) => Array(len)
7771
- .fill(0)
7772
- .map((_, idx) => idx);
7773
- const getRandomColor = () => {
7774
- return "#" + (0x1000000 + Math.random() * 0xffffff).toString(16).substr(1, 6);
7775
- };
7776
- const getRandomEvents = (date, visibleDays, resourceId) => {
7777
- return getListOfNumbers(visibleDays).map((e) => {
7778
- const len1 = Math.floor(Math.random() * 24) + 1;
7779
- const moment1 = moment(date).add(e, "days").add(e, "minutes");
7780
- const len2 = Math.floor(Math.random() * 25) + 1;
7781
- return {
7782
- id: crypto.randomUUID(),
7783
- rowId: resourceId.toString(),
7784
- name: "API Design",
7785
- color: getRandomColor(),
7786
- startDate: moment1.add(-len1, "hour").toDate(),
7787
- endDate: moment1.add(len2, "hour").toDate(),
7788
- };
7789
- });
7790
- };
7791
-
7792
- const eventToUiState = (it, selectedDate, visibleDays, tooltip) => {
7793
- const { left, width } = getEventSizes(selectedDate, visibleDays, it.startDate, it.endDate);
7794
- const eventState = {
7795
- ...it,
7796
- left,
7797
- width,
7798
- tooltip: tooltip,
7799
- selected: false,
7800
- isResizable: false,
7801
- isDraggable: false,
7802
- };
7803
- return eventState;
7804
- };
7805
- const SchedulerPresenter = () => {
7806
- const [events, setEvents] = React.useState([]);
7807
- const [backgroundEvents, setBackgroundEvents] = React.useState([]);
7808
- const [uiState, setUiState] = React.useState(() => {
7809
- const visibleDays = 1;
7810
- const selectedDate = new Date("2024-12-03");
7811
- const isHeaderVisible = true;
7812
- return {
7813
- isUtc: false,
7814
- selectedDate: selectedDate,
7815
- isHeaderVisible: isHeaderVisible,
7816
- visibleDays: visibleDays,
7817
- rowsHeight: 2,
7818
- visibleRows: 8,
7819
- };
7820
- });
7821
- const [resources, setResources] = React.useState([]);
7822
- const selectedEventRef = React.useRef("");
7823
- React.useEffect(() => {
7824
- updateDataFromApi();
7825
- }, []);
7826
- const updateDataFromApi = () => {
7827
- const rows = 1;
7828
- // api call here to events
7829
- const apiEvents = getListOfNumbers(rows).flatMap((e) => {
7830
- return getRandomEvents(uiState.selectedDate, uiState.visibleDays * 3, e);
7831
- });
7832
- const eventsWithSizes = apiEvents.map((it) => {
7833
- return eventToUiState(it, uiState.selectedDate, uiState.visibleDays, jsxRuntime.jsxs("div", { children: [it.startDate.getHours() + ":" + it.startDate.getMinutes(), " -", it.endDate.getHours() + ":" + it.endDate.getMinutes()] }));
7834
- });
7835
- const visibleEvents = eventsWithSizes.filter((event) => {
7836
- return eventIsVisible(event.startDate, event.endDate, uiState.selectedDate, uiState.visibleDays);
7837
- });
7838
- setEvents(visibleEvents);
7839
- const apiBackgroundEvents = getListOfNumbers(1).map((e) => {
7840
- const backgroundEvent = {
7841
- id: e.toString(),
7842
- rowId: e.toString(),
7843
- color: "orange",
7844
- isResizable: false,
7845
- isDraggable: false,
7846
- width: 100 / uiState.visibleDays,
7847
- name: "Birthday",
7848
- icons: jsxRuntime.jsx(CwIcon, { iconId: "house", style: { padding: "0.5rem" } }, "cosa"),
7849
- startDate: new Date(),
7850
- left: 0,
7851
- endDate: new Date(),
7852
- isVisible: true,
7853
- selected: false,
7854
- };
7855
- return backgroundEvent;
7856
- });
7857
- setBackgroundEvents(apiBackgroundEvents);
7858
- // api call here to rows
7859
- const apiRows = getListOfNumbers(rows).map((e) => {
7860
- return {
7861
- resourceId: e.toString(),
7862
- title: "JAC" + e,
7863
- };
7864
- });
7865
- const headerProps = apiRows.map((row) => {
7866
- return {
7867
- rowId: row.resourceId,
7868
- title: row.title,
7869
- };
7870
- });
7871
- setResources(headerProps);
7872
- };
7873
- const onEvent = (event) => {
7874
- when(event)
7875
- .case(OnClickEvent, (event) => {
7876
- console.log("onClick event: " + event.id);
7877
- })
7878
- .case(OnDoubleClickEvent, (event) => {
7879
- const eventData = resources
7880
- .map((resource) => {
7881
- const element = events
7882
- .filter((it) => {
7883
- return it.rowId === resource.rowId;
7884
- })
7885
- .find((it) => it.id == event.id);
7886
- return element;
7887
- })
7888
- .filter((it) => it !== undefined)[0];
7889
- console.log("found", eventData?.startDate, eventData?.endDate);
7890
- })
7891
- .case(OnDragEvent, (event) => {
7892
- console.log("onDrag event: " + event.id);
7893
- selectedEventRef.current = event.id;
7894
- console.log("selectedEvent set to: " + selectedEventRef.current);
7895
- })
7896
- .case(OnDropEvent, (event) => {
7897
- console.log("onDrop event: " + selectedEventRef.current + " to row: " + event.id);
7898
- setEvents((prevEvents) => {
7899
- // Find the index of the event to be updated
7900
- const eventIndex = prevEvents.findIndex((e) => e.id === selectedEventRef.current);
7901
- // If event is found, create a new array with the updated event
7902
- const updatedEvents = [...prevEvents];
7903
- updatedEvents[eventIndex] = {
7904
- ...updatedEvents[eventIndex],
7905
- rowId: event.id,
7906
- };
7907
- return updatedEvents;
7908
- });
7909
- console.log("drop on");
7910
- selectedEventRef.current = ""; // Reset the selected event ref
7911
- })
7912
- .case(OnDropCtrlEvent, (event) => {
7913
- alert(`Clicked row is ${event.id}`);
7914
- })
7915
- .case(OnClickRowEvent, (event) => {
7916
- alert(`Clicked row is ${event.id}`);
7917
- })
7918
- .case(OnRightClickEvent, (event) => {
7919
- alert(`RightClick event ${event.id}`);
7920
- })
7921
- .case(OnRightClickRow, (event) => {
7922
- alert(`RightClick row ${event.id}`);
7923
- })
7924
- .case(OnLeftDragStart, (event) => {
7925
- alert(`Start left Drag ${event.id}`);
7926
- })
7927
- .case(OnRightDragStart, (event) => {
7928
- alert(`Start Right Drag ${event.id}`);
7929
- })
7930
- .case(UpdateApi, () => {
7931
- updateDataFromApi();
7932
- })
7933
- .case(OnClickRowHeader, (event) => {
7934
- console.log(`Clicked row ${event.id}`);
7935
- })
7936
- .case(OnClickUtc, () => {
7937
- setUiState((old) => {
7938
- return { ...old, isUtc: !old.isUtc };
7939
- });
7940
- });
7941
- };
7942
- return {
7943
- state: uiState,
7944
- resources: resources,
7945
- events,
7946
- backgroundEvents,
7947
- onEvent: onEvent,
7948
- };
7949
- };
7950
8556
 
7951
8557
  const getNow = (isUtc) => {
7952
8558
  let now = new Date();
@@ -7956,6 +8562,8 @@ const getNow = (isUtc) => {
7956
8562
  return now;
7957
8563
  };
7958
8564
  const rowsHeight = 1.75; // rem
8565
+ const milliSecondsInSecond = 1000;
8566
+ const refreshMilliSeconds = 45 * milliSecondsInSecond;
7959
8567
  const Scheduler = (props) => {
7960
8568
  const { header: headerContent, id, events: eventsState, backgroundEvents, contextMenuItems, EventComp, RowTitleComp, orderCategories = ["title"], useOrderCategory, onEvent, groupRowColors, rowHeaderWidth = 180, } = props;
7961
8569
  const BackgroundEventComp = props.BackgroundEventComp ?? BackgroundEvent;
@@ -7999,7 +8607,7 @@ const Scheduler = (props) => {
7999
8607
  setTimeLinePercentage(percentage);
8000
8608
  };
8001
8609
  updateTimeLinePercentage();
8002
- const interval = setInterval(updateTimeLinePercentage, 10_000);
8610
+ const interval = setInterval(updateTimeLinePercentage, refreshMilliSeconds);
8003
8611
  return () => clearInterval(interval);
8004
8612
  }, [selectedDate, isUtc, totalHours]);
8005
8613
  // Memoized Row Component
@@ -8047,10 +8655,6 @@ const height = (events, rows, rowsNumber) => {
8047
8655
  });
8048
8656
  return flatMapped.length;
8049
8657
  };
8050
- const SchedulerPreview = () => {
8051
- const { state, resources, events, backgroundEvents, onEvent } = SchedulerPresenter();
8052
- return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("button", { onClick: (_) => onEvent(new UpdateApi()), children: "update" }), jsxRuntime.jsx("button", { onClick: (_) => onEvent(new OnClickUtc()), children: state.isUtc ? "set Local" : "set UTC" }), jsxRuntime.jsx(Scheduler, { id: "test", state: state, header: { title: "Flights", classification: "ACFT" }, rows: resources, onEvent: onEvent, EventComp: SchedulerEvent, RowTitleComp: DefaultRowHeader, events: events, backgroundEvents: backgroundEvents, contextMenuItems: [] })] }));
8053
- };
8054
8658
 
8055
8659
  let topsCounter = 0;
8056
8660
  class CwSuperScheduler extends React__namespace.Component {
@@ -8371,6 +8975,8 @@ class Resource {
8371
8975
  }
8372
8976
  }
8373
8977
 
8978
+ var styles = {"super-scheduler-row-header":"super-scheduler-module_super-scheduler-row-header__TTs4e","indicators":"super-scheduler-module_indicators__f4lIT","scheduler-crewmember-functions":"super-scheduler-module_scheduler-crewmember-functions__BS2hs"};
8979
+
8374
8980
  class OnPinRow {
8375
8981
  id;
8376
8982
  constructor(id) {
@@ -8387,26 +8993,12 @@ class OnClearPinned {
8387
8993
  constructor() { }
8388
8994
  }
8389
8995
 
8390
- const onClickMenuItem = (e, event) => {
8391
- e.domEvent.nativeEvent.preventDefault();
8392
- e.domEvent.nativeEvent.stopPropagation();
8393
- e.domEvent.nativeEvent.stopImmediatePropagation();
8394
- e.domEvent.preventDefault();
8395
- e.domEvent.stopPropagation();
8396
- event();
8397
- };
8398
8996
  const PinRowHeader = ({ value, width, onEvent }) => {
8399
8997
  const [isContextMenuOpen, setIsContextMenuOpen] = React.useState(false);
8400
8998
  const { highlightColor, isLoading } = value;
8401
- return (jsxRuntime.jsx(antd.Dropdown, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "bottom", menu: {
8402
- items: value.contextMenuItems,
8403
- onClick: (e) => {
8404
- onClickMenuItem(e, () => {
8405
- onEvent(new OnClickContextMenu(value.rowId, e.key));
8406
- });
8407
- },
8408
- onMouseLeave: () => setIsContextMenuOpen(false),
8409
- }, trigger: ["contextMenu"], overlayStyle: { animationDuration: "0" }, arrow: (value.contextMenuItems?.length ?? 0) > 0, children: jsxRuntime.jsx(CwGenericTooltip, { content: value.tooltip, position: "right", dissapearsWhenHover: true, overlayStyle: value.overlayTooltipStyle, children: jsxRuntime.jsxs("div", { style: {
8999
+ return (jsxRuntime.jsx(CwAnchoredMenu, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "right", options: value.contextMenuItems ?? [], onSelect: (key) => {
9000
+ onEvent(new OnClickContextMenu(value.rowId, key));
9001
+ }, children: jsxRuntime.jsx(CwGenericTooltip, { content: value.tooltip, position: "right", dissapearsWhenHover: true, overlayStyle: value.overlayTooltipStyle, children: jsxRuntime.jsxs("div", { style: {
8410
9002
  width: width,
8411
9003
  background: highlightColor,
8412
9004
  }, className: styles["super-scheduler-row-header"], children: [jsxRuntime.jsx("button", { className: "cw-button-icon cwi-pin", "data-pinned": value.isPinned, onClick: (_) => {
@@ -8429,7 +9021,7 @@ const SuperScheduler = ({ id, state, header, rows, events, pinnedOrderCategory,
8429
9021
  }, children: "Clear pinned" }) })] })), jsxRuntime.jsx(Scheduler, { id: `${id}-notPinned`, state: { ...state, isHeaderVisible: !isFirstVisible }, header: header, rows: notPinnedRows, events: events, backgroundEvents: backgroundEvents, contextMenuItems: contextMenuItems, orderCategories: unPinnedOrderCategory, onEvent: onEvent, EventComp: SchedulerEvent, RowTitleComp: PinRowHeader })] }));
8430
9022
  };
8431
9023
 
8432
- const CwFindAirport = ({ handleChange, searchType = "OnlyDatabase", placeHolder = "Search airport…", required = false, cblConfig, className = "", value, disabled = false, displayMode, width }) => {
9024
+ const CwFindAirport = ({ handleChange, searchType = "OnlyDatabase", placeHolder = "Search airport…", required = false, cblConfig, className = "", value, disabled = false, displayMode, labelProps, alignProps, width }) => {
8433
9025
  // State
8434
9026
  const [inputValue, setInputValue] = React.useState("");
8435
9027
  const [options, setOptions] = React.useState([]);
@@ -8662,91 +9254,22 @@ const CwFindAirport = ({ handleChange, searchType = "OnlyDatabase", placeHolder
8662
9254
  handleChange(0); // or -1, depending on API expectations
8663
9255
  inputRef.current?.focus();
8664
9256
  };
8665
- return (jsxRuntime.jsxs("div", { className: `cw-find-airport ${className}`, style: width ? { width } : undefined, children: [jsxRuntime.jsxs("div", { className: "cw-find-airport-input-wrapper", children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: isInitialLoading ? "Loading…" : placeHolder, disabled: disabled, required: required, autoComplete: "off", "aria-expanded": showDropdown, "aria-haspopup": "listbox", role: "combobox", title: tooltipText }), (isLoading || isInitialLoading) && (jsxRuntime.jsx("div", { className: "cw-find-airport-loading", children: jsxRuntime.jsx(CwIcon, { iconId: "spinner" }) })), inputValue && !disabled && !isInitialLoading && (jsxRuntime.jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selected airport", variant: "icon", icon: "close", color: "neutral" }))] }), showDropdown && options.length > 0 && (jsxRuntime.jsx("div", { ref: dropdownRef, className: "cw-find-airport-dropdown", role: "listbox", children: options.map((option, index) => (jsxRuntime.jsx("div", { className: `cw-find-airport-option ${index === highlightedIndex ? "highlighted" : ""}`, onClick: () => handleOptionSelect(option.value), role: "option", "aria-selected": index === highlightedIndex, children: option.text }, option.value))) }))] }));
8666
- };
8667
-
8668
- const CwPaletteTree = () => (jsxRuntime.jsxs(ideToolbox.Palette, { children: [jsxRuntime.jsx(ideToolbox.Category, { name: "buttons", children: jsxRuntime.jsxs(ideToolbox.Component, { name: "CwButton", children: [jsxRuntime.jsx(ideToolbox.Variant, { name: "solid", children: jsxRuntime.jsx(CwButton, { variant: "solid", text: "Button" }) }), jsxRuntime.jsx(ideToolbox.Variant, { name: "outline", children: jsxRuntime.jsx(CwButton, { variant: "outline", text: "Button" }) }), jsxRuntime.jsx(ideToolbox.Variant, { name: "Icon", children: jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save" }) }), jsxRuntime.jsx(ideToolbox.Variant, { name: "Example", children: jsxRuntime.jsxs(CwButton, { variant: "solid", color: "danger", children: [jsxRuntime.jsx("span", { children: "Example" }), jsxRuntime.jsx("span", { children: "texmple 2" })] }) })] }) }), jsxRuntime.jsx(ideToolbox.Category, { name: "search", children: jsxRuntime.jsx(ideToolbox.Component, { name: "CwSearchInput", children: jsxRuntime.jsx(ideToolbox.Variant, { children: jsxRuntime.jsx(CwSearchInput, { placeholder: "Search", selectList: [
8669
- new CwSelectList("Search", "1", "Search something", "red")
8670
- ] }) }) }) }), jsxRuntime.jsxs(ideToolbox.Category, { name: "Scheduler-headers", children: [jsxRuntime.jsx(ideToolbox.Component, { name: "DefaultRowHeader", children: jsxRuntime.jsx(ideToolbox.Variant, { children: jsxRuntime.jsx(DefaultRowHeader, { value: {
8671
- rowId: "1",
8672
- title: "JAC",
8673
- title2: "CMD",
8674
- subtitle: "ICAO",
8675
- subtitle2: "IATA"
8676
- },
8677
- // color={"red"}
8678
- width: 180, onEvent: () => {
8679
- } }) }) }), jsxRuntime.jsxs(ideToolbox.Component, { name: "PinRowHeader", children: [jsxRuntime.jsx(ideToolbox.Variant, { children: jsxRuntime.jsx(PinRowHeader, { value: {
8680
- rowId: "1",
8681
- title: "JAC",
8682
- title2: "CMD",
8683
- subtitle: "ICAO",
8684
- subtitle2: "IATA",
8685
- isPinned: true,
8686
- contextMenuItems: [],
8687
- isLoading: false,
8688
- },
8689
- // color={"red"}
8690
- width: 180, onEvent: () => {
8691
- } }) }), jsxRuntime.jsx(ideToolbox.Variant, { name: "pinned", children: jsxRuntime.jsx(PinRowHeader, { value: {
8692
- rowId: "1",
8693
- title: "JAC",
8694
- title2: "CMD",
8695
- subtitle: "ICAO",
8696
- subtitle2: "IATA",
8697
- isPinned: true,
8698
- contextMenuItems: [],
8699
- isLoading: false,
8700
- },
8701
- // color={"red"}
8702
- width: 180, onEvent: () => {
8703
- } }) })] })] }), jsxRuntime.jsx(ideToolbox.Category, { name: "Scheduler", children: jsxRuntime.jsx(ideToolbox.Component, { name: "Scheduler", children: jsxRuntime.jsx(ideToolbox.Variant, { children: jsxRuntime.jsx(SchedulerPreview, {}) }) }) })] }));
9257
+ // Get direction for data attribute
9258
+ const direction = alignProps?.flexDirection || "row";
9259
+ return (jsxRuntime.jsxs("div", { className: `cw-search-input ${className}`, style: {
9260
+ ...(width ? { width } : {}),
9261
+ ...(labelProps?.labelWidth ? { '--label-width': labelProps.labelWidth } : {})
9262
+ }, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-search-input-wrapper", children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: isInitialLoading ? "Loading…" : placeHolder, disabled: disabled, required: required, autoComplete: "off", "aria-expanded": showDropdown, "aria-haspopup": "listbox", role: "combobox", title: tooltipText }), (isLoading || isInitialLoading) && (jsxRuntime.jsx("div", { className: "cw-search-input-loading", children: jsxRuntime.jsx(CwIcon, { iconId: "spinner" }) })), jsxRuntime.jsx("div", { className: "cw-search-input-icons", children: inputValue && !disabled && !isInitialLoading ? (jsxRuntime.jsx(CwButton, { type: "button", onClick: handleClear, "aria-label": "Clear selected airport", variant: "icon", icon: "close", color: "neutral" })) : (jsxRuntime.jsx(CwIcon, { iconId: "control-tower" })) })] })] }), showDropdown && options.length > 0 && (jsxRuntime.jsx("div", { ref: dropdownRef, className: "cw-input-search-dropdown", role: "listbox", children: jsxRuntime.jsx("ul", { children: options.map((option, index) => (jsxRuntime.jsx("li", { className: index === highlightedIndex ? "highlighted" : "", onClick: () => handleOptionSelect(option.value), onMouseDown: (e) => e.preventDefault(), role: "option", "aria-selected": index === highlightedIndex, children: option.text }, option.value))) }) }))] }));
9263
+ };
8704
9264
 
8705
9265
  exports.CblDragAndDrop = CblDragAndDrop;
8706
9266
  exports.CwAccordionContainer = CwAccordionContainer;
8707
9267
  exports.CwAlign = CwAlign;
8708
- exports.CwBtnAdd = CwBtnAdd;
8709
- exports.CwBtnAddFolder = CwBtnAddFolder;
8710
- exports.CwBtnAirport = CwBtnAirport;
8711
- exports.CwBtnAlert = CwBtnAlert;
8712
- exports.CwBtnApprove = CwBtnApprove;
8713
- exports.CwBtnBookMark = CwBtnBookMark;
8714
- exports.CwBtnBulkDuty = CwBtnBulkDuty;
8715
- exports.CwBtnCancel = CwBtnCancel;
8716
- exports.CwBtnCrewPlanning = CwBtnCrewPlanning;
8717
- exports.CwBtnDelay = CwBtnDelay;
9268
+ exports.CwAnchoredMenu = CwAnchoredMenu;
8718
9269
  exports.CwBtnDelete = CwBtnDelete;
8719
- exports.CwBtnDownLoadAllInfo = CwBtnDownLoadAllInfo;
8720
- exports.CwBtnDownload = CwBtnDownload;
8721
- exports.CwBtnDropDownMenu = CwBtnDropDownMenu;
8722
9270
  exports.CwBtnEdit = CwBtnEdit;
8723
- exports.CwBtnEditFolder = CwBtnEditFolder;
8724
- exports.CwBtnFiles = CwBtnFiles;
8725
- exports.CwBtnGeneratePairing = CwBtnGeneratePairing;
8726
- exports.CwBtnGoBackFolder = CwBtnGoBackFolder;
8727
- exports.CwBtnHide = CwBtnHide;
8728
- exports.CwBtnImportRequests = CwBtnImportRequests;
8729
- exports.CwBtnMVT = CwBtnMVT;
8730
- exports.CwBtnNavFirstItemView = CwBtnNavFirstItemView;
8731
- exports.CwBtnNavLastItemView = CwBtnNavLastItemView;
8732
- exports.CwBtnNavNextDay = CwBtnNavNextDay;
8733
- exports.CwBtnNavPreviewItem = CwBtnNavPreviewItem;
8734
- exports.CwBtnPairing = CwBtnPairing;
8735
- exports.CwBtnPrint = CwBtnPrint;
8736
- exports.CwBtnPropertyFolder = CwBtnPropertyFolder;
8737
- exports.CwBtnPublish = CwBtnPublish;
8738
- exports.CwBtnRefresh = CwBtnRefresh;
8739
- exports.CwBtnReleasePeriod = CwBtnReleasePeriod;
8740
9271
  exports.CwBtnSave = CwBtnSave;
8741
- exports.CwBtnSearch = CwBtnSearch;
8742
- exports.CwBtnSelect = CwBtnSelect;
8743
- exports.CwBtnShare = CwBtnShare;
8744
- exports.CwBtnStatistic = CwBtnStatistic;
8745
- exports.CwBtnUploadFiles = CwBtnUploadFiles;
8746
- exports.CwBtnVacations = CwBtnVacations;
8747
- exports.CwBtnView = CwBtnView;
8748
9272
  exports.CwButton = CwButton;
8749
- exports.CwButtonDef = CwButtonDef;
8750
9273
  exports.CwCard = CwCard;
8751
9274
  exports.CwCardList = CwCardList;
8752
9275
  exports.CwCheckbox = CwCheckbox;
@@ -8754,21 +9277,20 @@ exports.CwChip = CwChip;
8754
9277
  exports.CwColorPicker = CwColorPicker;
8755
9278
  exports.CwConfirmationPopup = CwConfirmationPopup;
8756
9279
  exports.CwContextMenu = CwContextMenu;
8757
- exports.CwContextualMenu = CwContextualMenu;
9280
+ exports.CwDatePicker = CwDatePicker;
9281
+ exports.CwDateRangePicker = CwDateRangePicker;
9282
+ exports.CwDateTimePicker = CwDateTimePicker;
9283
+ exports.CwDateTimePickerCompact = CwDateTimePickerCompact;
8758
9284
  exports.CwDialog = CwDialog;
8759
9285
  exports.CwDialogManager = CwDialogManager;
8760
9286
  exports.CwDigit = CwDigit;
8761
9287
  exports.CwDisplayMessage = CwDisplayMessage;
8762
- exports.CwDropdown = CwDropdown;
8763
- exports.CwDropdownContainer = CwDropdownContainer;
8764
9288
  exports.CwDropdownFilter = CwDropdownFilter;
8765
9289
  exports.CwExpandable = CwExpandable;
8766
9290
  exports.CwFileUpload = CwFileUpload;
8767
9291
  exports.CwFileUploadMultiple = CwFileUploadMultiple;
8768
9292
  exports.CwFindAirport = CwFindAirport;
8769
- exports.CwFloatingButton = CwFloatingButton;
8770
9293
  exports.CwGenericTooltip = CwGenericTooltip;
8771
- exports.CwHeadFilter = CwHeadFilter;
8772
9294
  exports.CwHeadingMain = CwHeadingMain;
8773
9295
  exports.CwHeadingSecond = CwHeadingSecond;
8774
9296
  exports.CwIcon = CwIcon;
@@ -8792,17 +9314,12 @@ exports.CwLoadingSmall = CwLoadingSmall;
8792
9314
  exports.CwMessage = CwMessage;
8793
9315
  exports.CwMessageManager = CwMessageManager;
8794
9316
  exports.CwModal = CwModal;
8795
- exports.CwModalConfirm = CwModalConfirm;
8796
9317
  exports.CwModalHover = CwModalHover;
8797
- exports.CwModalIframe = CwModalIframe;
8798
9318
  exports.CwModalReportFunctional = CwModalReportFunctional;
8799
9319
  exports.CwMultiFilter = CwMultiFilter;
8800
9320
  exports.CwMultiFilterTag = CwMultiFilterTag;
8801
- exports.CwMultiselect = CwMultiselect;
8802
9321
  exports.CwNote = CwNote;
8803
9322
  exports.CwOption = CwOption;
8804
- exports.CwOptionList = CwOptionList;
8805
- exports.CwPaletteTree = CwPaletteTree;
8806
9323
  exports.CwReportModal = CwReportModal;
8807
9324
  exports.CwScheduler = CwScheduler;
8808
9325
  exports.CwScheduler2 = CwScheduler2;
@@ -8815,15 +9332,14 @@ exports.CwSuperScheduler = CwSuperScheduler;
8815
9332
  exports.CwTable = CwTable;
8816
9333
  exports.CwTableGrouped = CwTableGrouped;
8817
9334
  exports.CwTabs = CwTabs;
8818
- exports.CwTag = CwTag;
8819
9335
  exports.CwTextArea = CwTextArea;
8820
9336
  exports.CwTime = CwTime;
9337
+ exports.CwTimePicker = CwTimePicker;
8821
9338
  exports.CwToggle = CwToggle;
8822
9339
  exports.CwTooltip = CwTooltip;
8823
9340
  exports.CwTreeView = CwTreeView;
8824
9341
  exports.CwWeekdaySelector = CwWeekdaySelector;
8825
9342
  exports.DefaultRowHeader = DefaultRowHeader;
8826
- exports.MultiSelect = MultiSelect;
8827
9343
  exports.OnClearPinned = OnClearPinned;
8828
9344
  exports.OnClickContextMenu = OnClickContextMenu;
8829
9345
  exports.OnClickEvent = OnClickEvent;