@helpwave/hightide 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/branding/HelpwaveBadge.d.mts +4 -5
- package/dist/components/branding/HelpwaveBadge.d.ts +4 -5
- package/dist/components/branding/HelpwaveBadge.js +46 -87
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +46 -89
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.d.mts +1 -1
- package/dist/components/date/DatePicker.d.ts +1 -1
- package/dist/components/date/DatePicker.js +64 -13
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +65 -14
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.d.mts +1 -1
- package/dist/components/date/DayPicker.d.ts +1 -1
- package/dist/components/date/DayPicker.js +3 -3
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs +3 -3
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimeDisplay.js.map +1 -1
- package/dist/components/date/TimeDisplay.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +2 -2
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +2 -2
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +58 -7
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +59 -8
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/{dialogs → dialog}/ConfirmDialog.d.mts +9 -8
- package/dist/components/{dialogs → dialog}/ConfirmDialog.d.ts +9 -8
- package/dist/components/dialog/ConfirmDialog.js +938 -0
- package/dist/components/dialog/ConfirmDialog.js.map +1 -0
- package/dist/components/dialog/ConfirmDialog.mjs +902 -0
- package/dist/components/dialog/ConfirmDialog.mjs.map +1 -0
- package/dist/components/dialog/Dialog.d.mts +27 -0
- package/dist/components/dialog/Dialog.d.ts +27 -0
- package/dist/components/dialog/Dialog.js +879 -0
- package/dist/components/dialog/Dialog.js.map +1 -0
- package/dist/components/dialog/Dialog.mjs +845 -0
- package/dist/components/dialog/Dialog.mjs.map +1 -0
- package/dist/components/dialog/DiscardChangesDialog.d.mts +24 -0
- package/dist/components/dialog/DiscardChangesDialog.d.ts +24 -0
- package/dist/components/dialog/DiscardChangesDialog.js +966 -0
- package/dist/components/dialog/DiscardChangesDialog.js.map +1 -0
- package/dist/components/dialog/DiscardChangesDialog.mjs +930 -0
- package/dist/components/dialog/DiscardChangesDialog.mjs.map +1 -0
- package/dist/components/dialog/InputDialog.d.mts +22 -0
- package/dist/components/dialog/InputDialog.d.ts +22 -0
- package/dist/components/dialog/InputDialog.js +1139 -0
- package/dist/components/dialog/InputDialog.js.map +1 -0
- package/dist/components/dialog/InputDialog.mjs +1103 -0
- package/dist/components/dialog/InputDialog.mjs.map +1 -0
- package/dist/components/dialog/LanguageDialog.d.mts +25 -0
- package/dist/components/dialog/LanguageDialog.d.ts +25 -0
- package/dist/components/dialog/LanguageDialog.js +1684 -0
- package/dist/components/dialog/LanguageDialog.js.map +1 -0
- package/dist/components/dialog/LanguageDialog.mjs +1658 -0
- package/dist/components/dialog/LanguageDialog.mjs.map +1 -0
- package/dist/components/dialog/ThemeDialog.d.mts +26 -0
- package/dist/components/dialog/ThemeDialog.d.ts +26 -0
- package/dist/components/dialog/ThemeDialog.js +1715 -0
- package/dist/components/dialog/ThemeDialog.js.map +1 -0
- package/dist/components/dialog/ThemeDialog.mjs +1689 -0
- package/dist/components/dialog/ThemeDialog.mjs.map +1 -0
- package/dist/components/dialog/index.d.mts +17 -0
- package/dist/components/dialog/index.d.ts +17 -0
- package/dist/components/dialog/index.js +2062 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/dialog/index.mjs +2031 -0
- package/dist/components/dialog/index.mjs.map +1 -0
- package/dist/components/form/FormElementWrapper.d.mts +29 -0
- package/dist/components/form/FormElementWrapper.d.ts +29 -0
- package/dist/components/form/FormElementWrapper.js +98 -0
- package/dist/components/form/FormElementWrapper.js.map +1 -0
- package/dist/components/form/FormElementWrapper.mjs +64 -0
- package/dist/components/form/FormElementWrapper.mjs.map +1 -0
- package/dist/components/icons-and-geometry/Avatar.js +498 -2886
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +490 -2878
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/icons-and-geometry/{Helpwave.d.mts → HelpwaveLogo.d.mts} +3 -3
- package/dist/components/icons-and-geometry/{Helpwave.d.ts → HelpwaveLogo.d.ts} +3 -3
- package/dist/components/icons-and-geometry/{Helpwave.js → HelpwaveLogo.js} +21 -22
- package/dist/components/icons-and-geometry/HelpwaveLogo.js.map +1 -0
- package/dist/components/icons-and-geometry/{Helpwave.mjs → HelpwaveLogo.mjs} +17 -18
- package/dist/components/icons-and-geometry/HelpwaveLogo.mjs.map +1 -0
- package/dist/components/icons-and-geometry/Ring.js +1 -1
- package/dist/components/icons-and-geometry/Ring.js.map +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs +1 -1
- package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Tag.js +8 -20
- package/dist/components/icons-and-geometry/Tag.js.map +1 -1
- package/dist/components/icons-and-geometry/Tag.mjs +8 -20
- package/dist/components/icons-and-geometry/Tag.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +667 -22
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +667 -22
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +12 -10
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +12 -10
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.d.mts +8 -5
- package/dist/components/layout-and-navigation/Chip.d.ts +8 -5
- package/dist/components/layout-and-navigation/Chip.js +17 -4
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +17 -4
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.d.mts +13 -10
- package/dist/components/layout-and-navigation/Expandable.d.ts +13 -10
- package/dist/components/layout-and-navigation/Expandable.js +18 -5
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +19 -6
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +21 -8
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +22 -9
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FloatingContainer.d.mts +38 -0
- package/dist/components/layout-and-navigation/FloatingContainer.d.ts +38 -0
- package/dist/components/layout-and-navigation/FloatingContainer.js +219 -0
- package/dist/components/layout-and-navigation/FloatingContainer.js.map +1 -0
- package/dist/components/layout-and-navigation/FloatingContainer.mjs +195 -0
- package/dist/components/layout-and-navigation/FloatingContainer.mjs.map +1 -0
- package/dist/components/layout-and-navigation/ListBox.d.mts +44 -0
- package/dist/components/layout-and-navigation/ListBox.d.ts +44 -0
- package/dist/components/layout-and-navigation/ListBox.js +329 -0
- package/dist/components/layout-and-navigation/ListBox.js.map +1 -0
- package/dist/components/layout-and-navigation/ListBox.mjs +290 -0
- package/dist/components/layout-and-navigation/ListBox.mjs.map +1 -0
- package/dist/components/layout-and-navigation/Pagination.js +104 -189
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +99 -184
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/ScrollArea.d.mts +15 -0
- package/dist/components/layout-and-navigation/ScrollArea.d.ts +15 -0
- package/dist/components/layout-and-navigation/ScrollArea.js +1252 -0
- package/dist/components/layout-and-navigation/ScrollArea.js.map +1 -0
- package/dist/components/layout-and-navigation/ScrollArea.mjs +1216 -0
- package/dist/components/layout-and-navigation/ScrollArea.mjs.map +1 -0
- package/dist/components/layout-and-navigation/StepperBar.js +41 -1
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +41 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +3 -1
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +3 -1
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.d.mts +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.d.ts +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +18 -17
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +18 -17
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +55 -18
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +55 -18
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +890 -135
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +897 -142
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +153 -198
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +146 -191
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +5 -10
- package/dist/components/properties/MultiSelectProperty.d.ts +5 -10
- package/dist/components/properties/MultiSelectProperty.js +1143 -1160
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +1156 -1163
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +155 -201
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +148 -194
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +49 -9
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +49 -9
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +5 -8
- package/dist/components/properties/SelectProperty.d.ts +5 -8
- package/dist/components/properties/SelectProperty.js +1047 -834
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +1063 -840
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +97 -100
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +100 -103
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +1618 -993
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +1625 -1000
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +116 -201
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +105 -190
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +4 -3
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +4 -3
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +15 -11
- package/dist/components/user-action/Button.d.ts +15 -11
- package/dist/components/user-action/Button.js +10 -9
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +10 -9
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.d.mts +9 -25
- package/dist/components/user-action/Checkbox.d.ts +9 -25
- package/dist/components/user-action/Checkbox.js +793 -103
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +794 -104
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js +3 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs +3 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.d.mts +1 -1
- package/dist/components/user-action/DateAndTimePicker.d.ts +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +66 -13
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +67 -14
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Label.d.mts +6 -8
- package/dist/components/user-action/Label.d.ts +6 -8
- package/dist/components/user-action/Label.js +4 -6
- package/dist/components/user-action/Label.js.map +1 -1
- package/dist/components/user-action/Label.mjs +4 -6
- package/dist/components/user-action/Label.mjs.map +1 -1
- package/dist/components/user-action/Menu.d.mts +2 -2
- package/dist/components/user-action/Menu.d.ts +2 -2
- package/dist/components/user-action/Menu.js +1 -1
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +1 -1
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +8 -6
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +8 -6
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.d.mts +1 -2
- package/dist/components/user-action/SearchBar.d.ts +1 -2
- package/dist/components/user-action/SearchBar.js +93 -178
- package/dist/components/user-action/SearchBar.js.map +1 -1
- package/dist/components/user-action/SearchBar.mjs +86 -171
- package/dist/components/user-action/SearchBar.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +22 -11
- package/dist/components/user-action/Textarea.d.ts +22 -11
- package/dist/components/user-action/Textarea.js +101 -92
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +100 -92
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/input/Input.d.mts +37 -0
- package/dist/components/user-action/input/Input.d.ts +37 -0
- package/dist/components/user-action/input/Input.js +244 -0
- package/dist/components/user-action/input/Input.js.map +1 -0
- package/dist/components/user-action/input/Input.mjs +209 -0
- package/dist/components/user-action/input/Input.mjs.map +1 -0
- package/dist/components/user-action/input/InsideLabelInput.d.mts +20 -0
- package/dist/components/user-action/input/InsideLabelInput.d.ts +20 -0
- package/dist/components/user-action/input/InsideLabelInput.js +295 -0
- package/dist/components/user-action/input/InsideLabelInput.js.map +1 -0
- package/dist/components/user-action/input/InsideLabelInput.mjs +260 -0
- package/dist/components/user-action/input/InsideLabelInput.mjs.map +1 -0
- package/dist/components/user-action/input/ToggleableInput.d.mts +22 -0
- package/dist/components/user-action/input/ToggleableInput.d.ts +22 -0
- package/dist/components/user-action/{Input.js → input/ToggleableInput.js} +136 -171
- package/dist/components/user-action/input/ToggleableInput.js.map +1 -0
- package/dist/components/user-action/input/ToggleableInput.mjs +264 -0
- package/dist/components/user-action/input/ToggleableInput.mjs.map +1 -0
- package/dist/components/user-action/select/Select.d.mts +98 -0
- package/dist/components/user-action/select/Select.d.ts +98 -0
- package/dist/components/user-action/select/Select.js +1354 -0
- package/dist/components/user-action/select/Select.js.map +1 -0
- package/dist/components/user-action/select/Select.mjs +1320 -0
- package/dist/components/user-action/select/Select.mjs.map +1 -0
- package/dist/components/utils/FocusTrap.d.mts +28 -0
- package/dist/components/utils/FocusTrap.d.ts +28 -0
- package/dist/components/utils/FocusTrap.js +252 -0
- package/dist/components/utils/FocusTrap.js.map +1 -0
- package/dist/components/utils/FocusTrap.mjs +229 -0
- package/dist/components/utils/FocusTrap.mjs.map +1 -0
- package/dist/components/utils/Transition.d.mts +26 -0
- package/dist/components/utils/Transition.d.ts +26 -0
- package/dist/components/utils/Transition.js +74 -0
- package/dist/components/utils/Transition.js.map +1 -0
- package/dist/components/utils/Transition.mjs +50 -0
- package/dist/components/utils/Transition.mjs.map +1 -0
- package/dist/hooks/focus/useFocusGuards.d.mts +3 -0
- package/dist/hooks/focus/useFocusGuards.d.ts +3 -0
- package/dist/hooks/focus/useFocusGuards.js +74 -0
- package/dist/hooks/focus/useFocusGuards.js.map +1 -0
- package/dist/hooks/focus/useFocusGuards.mjs +50 -0
- package/dist/hooks/focus/useFocusGuards.mjs.map +1 -0
- package/dist/hooks/{useFocusManagement.js → focus/useFocusManagement.js} +1 -1
- package/dist/hooks/focus/useFocusManagement.js.map +1 -0
- package/dist/hooks/{useFocusManagement.mjs → focus/useFocusManagement.mjs} +1 -1
- package/dist/hooks/focus/useFocusManagement.mjs.map +1 -0
- package/dist/hooks/{useFocusOnceVisible.js → focus/useFocusOnceVisible.js} +1 -1
- package/dist/hooks/focus/useFocusOnceVisible.js.map +1 -0
- package/dist/hooks/{useFocusOnceVisible.mjs → focus/useFocusOnceVisible.mjs} +1 -1
- package/dist/hooks/focus/useFocusOnceVisible.mjs.map +1 -0
- package/dist/hooks/focus/useFocusTrap.d.mts +16 -0
- package/dist/hooks/focus/useFocusTrap.d.ts +16 -0
- package/dist/hooks/focus/useFocusTrap.js +233 -0
- package/dist/hooks/focus/useFocusTrap.js.map +1 -0
- package/dist/hooks/focus/useFocusTrap.mjs +210 -0
- package/dist/hooks/focus/useFocusTrap.mjs.map +1 -0
- package/dist/hooks/focus/useIsMounted.d.mts +3 -0
- package/dist/hooks/focus/useIsMounted.d.ts +3 -0
- package/dist/hooks/focus/useIsMounted.js +43 -0
- package/dist/hooks/focus/useIsMounted.js.map +1 -0
- package/dist/hooks/focus/useIsMounted.mjs +20 -0
- package/dist/hooks/focus/useIsMounted.mjs.map +1 -0
- package/dist/hooks/useFloatingElement.d.mts +22 -0
- package/dist/hooks/useFloatingElement.d.ts +22 -0
- package/dist/hooks/useFloatingElement.js +162 -0
- package/dist/hooks/useFloatingElement.js.map +1 -0
- package/dist/hooks/useFloatingElement.mjs +139 -0
- package/dist/hooks/useFloatingElement.mjs.map +1 -0
- package/dist/hooks/useLocalStorage.js +2 -2
- package/dist/hooks/useLocalStorage.js.map +1 -1
- package/dist/hooks/useLocalStorage.mjs +2 -2
- package/dist/hooks/useLocalStorage.mjs.map +1 -1
- package/dist/hooks/useLogOnce.d.mts +3 -4
- package/dist/hooks/useLogOnce.d.ts +3 -4
- package/dist/hooks/useLogOnce.js +5 -5
- package/dist/hooks/useLogOnce.js.map +1 -1
- package/dist/hooks/useLogOnce.mjs +5 -5
- package/dist/hooks/useLogOnce.mjs.map +1 -1
- package/dist/hooks/useRerender.d.mts +2 -2
- package/dist/hooks/useRerender.d.ts +2 -2
- package/dist/hooks/useSearch.d.mts +2 -2
- package/dist/hooks/useSearch.d.ts +2 -2
- package/dist/hooks/useSearch.js +1 -1
- package/dist/hooks/useSearch.js.map +1 -1
- package/dist/hooks/useSearch.mjs +1 -1
- package/dist/hooks/useSearch.mjs.map +1 -1
- package/dist/localization/LanguageProvider.d.mts +2 -2
- package/dist/localization/LanguageProvider.d.ts +2 -2
- package/dist/localization/LanguageProvider.js +2 -2
- package/dist/localization/LanguageProvider.js.map +1 -1
- package/dist/localization/LanguageProvider.mjs +2 -2
- package/dist/localization/LanguageProvider.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +1 -0
- package/dist/localization/defaults/form.d.ts +1 -0
- package/dist/localization/defaults/form.js +2 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +2 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/localization/useTranslation.js.map +1 -1
- package/dist/localization/useTranslation.mjs.map +1 -1
- package/dist/storybook/helper.d.mts +17 -0
- package/dist/storybook/helper.d.ts +17 -0
- package/dist/storybook/helper.js +61 -0
- package/dist/storybook/helper.js.map +1 -0
- package/dist/storybook/helper.mjs +37 -0
- package/dist/storybook/helper.mjs.map +1 -0
- package/dist/{css → style}/globals.css +779 -374
- package/dist/{css → style}/uncompiled/globals.css +75 -13
- package/dist/{css → style}/uncompiled/theme/colors-component.css +18 -4
- package/dist/{css → style}/uncompiled/theme/colors-semantic.css +2 -9
- package/dist/style/uncompiled/typography.css +171 -0
- package/dist/{css → style}/uncompiled/utitlity/animation.css +54 -42
- package/dist/{css → style}/uncompiled/utitlity/index.css +2 -1
- package/dist/{css → style}/uncompiled/utitlity/shadow.css +5 -1
- package/dist/style/uncompiled/utitlity/sizing.css +29 -0
- package/dist/theming/useTheme.d.mts +2 -2
- package/dist/theming/useTheme.d.ts +2 -2
- package/dist/theming/useTheme.js +3 -3
- package/dist/theming/useTheme.js.map +1 -1
- package/dist/theming/useTheme.mjs +3 -3
- package/dist/theming/useTheme.mjs.map +1 -1
- package/dist/{util → utils}/array.d.mts +1 -0
- package/dist/{util → utils}/array.d.ts +1 -0
- package/dist/{util → utils}/array.js +15 -2
- package/dist/utils/array.js.map +1 -0
- package/dist/{util → utils}/array.mjs +15 -2
- package/dist/utils/array.mjs.map +1 -0
- package/dist/utils/bagFunctions.d.mts +15 -0
- package/dist/utils/bagFunctions.d.ts +15 -0
- package/dist/{util/PropsWithFunctionChildren.js → utils/bagFunctions.js} +5 -5
- package/dist/utils/bagFunctions.js.map +1 -0
- package/dist/{util/PropsWithFunctionChildren.mjs → utils/bagFunctions.mjs} +2 -2
- package/dist/utils/bagFunctions.mjs.map +1 -0
- package/dist/{util → utils}/builder.js +1 -1
- package/dist/utils/builder.js.map +1 -0
- package/dist/{util → utils}/builder.mjs +1 -1
- package/dist/utils/builder.mjs.map +1 -0
- package/dist/{util → utils}/date.js +3 -3
- package/dist/utils/date.js.map +1 -0
- package/dist/{util → utils}/date.mjs +2 -2
- package/dist/utils/date.mjs.map +1 -0
- package/dist/{util → utils}/easeFunctions.js +5 -4
- package/dist/utils/easeFunctions.js.map +1 -0
- package/dist/{util → utils}/easeFunctions.mjs +4 -3
- package/dist/utils/easeFunctions.mjs.map +1 -0
- package/dist/{util → utils}/emailValidation.js +1 -1
- package/dist/utils/emailValidation.js.map +1 -0
- package/dist/{util → utils}/emailValidation.mjs +1 -1
- package/dist/utils/emailValidation.mjs.map +1 -0
- package/dist/{util → utils}/loopingArray.js +1 -1
- package/dist/utils/loopingArray.js.map +1 -0
- package/dist/{util → utils}/loopingArray.mjs +1 -1
- package/dist/utils/loopingArray.mjs.map +1 -0
- package/dist/utils/match.d.mts +3 -0
- package/dist/utils/match.d.ts +3 -0
- package/dist/utils/match.js +32 -0
- package/dist/utils/match.js.map +1 -0
- package/dist/utils/match.mjs +8 -0
- package/dist/utils/match.mjs.map +1 -0
- package/dist/utils/math.d.mts +3 -0
- package/dist/utils/math.d.ts +3 -0
- package/dist/{util → utils}/math.js +3 -2
- package/dist/utils/math.js.map +1 -0
- package/dist/utils/math.mjs +9 -0
- package/dist/utils/math.mjs.map +1 -0
- package/dist/{util → utils}/noop.js +1 -1
- package/dist/utils/noop.js.map +1 -0
- package/dist/utils/noop.mjs +6 -0
- package/dist/utils/noop.mjs.map +1 -0
- package/dist/{util → utils}/resolveSetState.js +1 -1
- package/dist/utils/resolveSetState.js.map +1 -0
- package/dist/{util → utils}/resolveSetState.mjs +1 -1
- package/dist/utils/resolveSetState.mjs.map +1 -0
- package/dist/{util → utils}/simpleSearch.js +1 -1
- package/dist/utils/simpleSearch.js.map +1 -0
- package/dist/{util → utils}/simpleSearch.mjs +1 -1
- package/dist/utils/simpleSearch.mjs.map +1 -0
- package/dist/{util → utils}/storage.js +1 -1
- package/dist/utils/storage.js.map +1 -0
- package/dist/{util → utils}/storage.mjs +1 -1
- package/dist/utils/storage.mjs.map +1 -0
- package/dist/{util → utils}/writeToClipboard.js +2 -1
- package/dist/utils/writeToClipboard.js.map +1 -0
- package/dist/{util → utils}/writeToClipboard.mjs +3 -1
- package/dist/utils/writeToClipboard.mjs.map +1 -0
- package/package.json +8 -8
- package/dist/components/dialogs/ConfirmDialog.js +0 -674
- package/dist/components/dialogs/ConfirmDialog.js.map +0 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +0 -638
- package/dist/components/dialogs/ConfirmDialog.mjs.map +0 -1
- package/dist/components/icons-and-geometry/Helpwave.js.map +0 -1
- package/dist/components/icons-and-geometry/Helpwave.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Overlay.d.mts +0 -67
- package/dist/components/layout-and-navigation/Overlay.d.ts +0 -67
- package/dist/components/layout-and-navigation/Overlay.js +0 -702
- package/dist/components/layout-and-navigation/Overlay.js.map +0 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +0 -665
- package/dist/components/layout-and-navigation/Overlay.mjs.map +0 -1
- package/dist/components/layout-and-navigation/SearchableList.d.mts +0 -24
- package/dist/components/layout-and-navigation/SearchableList.d.ts +0 -24
- package/dist/components/layout-and-navigation/SearchableList.js +0 -758
- package/dist/components/layout-and-navigation/SearchableList.js.map +0 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +0 -724
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +0 -27
- package/dist/components/layout-and-navigation/Tile.d.ts +0 -27
- package/dist/components/layout-and-navigation/Tile.js +0 -96
- package/dist/components/layout-and-navigation/Tile.js.map +0 -1
- package/dist/components/layout-and-navigation/Tile.mjs +0 -61
- package/dist/components/layout-and-navigation/Tile.mjs.map +0 -1
- package/dist/components/modals/ConfirmModal.d.mts +0 -33
- package/dist/components/modals/ConfirmModal.d.ts +0 -33
- package/dist/components/modals/ConfirmModal.js +0 -687
- package/dist/components/modals/ConfirmModal.js.map +0 -1
- package/dist/components/modals/ConfirmModal.mjs +0 -651
- package/dist/components/modals/ConfirmModal.mjs.map +0 -1
- package/dist/components/modals/DiscardChangesModal.d.mts +0 -20
- package/dist/components/modals/DiscardChangesModal.d.ts +0 -20
- package/dist/components/modals/DiscardChangesModal.js +0 -717
- package/dist/components/modals/DiscardChangesModal.js.map +0 -1
- package/dist/components/modals/DiscardChangesModal.mjs +0 -681
- package/dist/components/modals/DiscardChangesModal.mjs.map +0 -1
- package/dist/components/modals/InputModal.d.mts +0 -21
- package/dist/components/modals/InputModal.d.ts +0 -21
- package/dist/components/modals/InputModal.js +0 -976
- package/dist/components/modals/InputModal.js.map +0 -1
- package/dist/components/modals/InputModal.mjs +0 -940
- package/dist/components/modals/InputModal.mjs.map +0 -1
- package/dist/components/modals/LanguageModal.d.mts +0 -21
- package/dist/components/modals/LanguageModal.d.ts +0 -21
- package/dist/components/modals/LanguageModal.js +0 -1468
- package/dist/components/modals/LanguageModal.js.map +0 -1
- package/dist/components/modals/LanguageModal.mjs +0 -1432
- package/dist/components/modals/LanguageModal.mjs.map +0 -1
- package/dist/components/modals/ThemeModal.d.mts +0 -21
- package/dist/components/modals/ThemeModal.d.ts +0 -21
- package/dist/components/modals/ThemeModal.js +0 -1497
- package/dist/components/modals/ThemeModal.js.map +0 -1
- package/dist/components/modals/ThemeModal.mjs +0 -1461
- package/dist/components/modals/ThemeModal.mjs.map +0 -1
- package/dist/components/user-action/Input.d.mts +0 -77
- package/dist/components/user-action/Input.d.ts +0 -77
- package/dist/components/user-action/Input.js.map +0 -1
- package/dist/components/user-action/Input.mjs +0 -298
- package/dist/components/user-action/Input.mjs.map +0 -1
- package/dist/components/user-action/MultiSelect.d.mts +0 -42
- package/dist/components/user-action/MultiSelect.d.ts +0 -42
- package/dist/components/user-action/MultiSelect.js +0 -1468
- package/dist/components/user-action/MultiSelect.js.map +0 -1
- package/dist/components/user-action/MultiSelect.mjs +0 -1433
- package/dist/components/user-action/MultiSelect.mjs.map +0 -1
- package/dist/components/user-action/Select.d.mts +0 -41
- package/dist/components/user-action/Select.d.ts +0 -41
- package/dist/components/user-action/Select.js +0 -1236
- package/dist/components/user-action/Select.js.map +0 -1
- package/dist/components/user-action/Select.mjs +0 -1201
- package/dist/components/user-action/Select.mjs.map +0 -1
- package/dist/components/user-action/ToggleableInput.d.mts +0 -37
- package/dist/components/user-action/ToggleableInput.d.ts +0 -37
- package/dist/components/user-action/ToggleableInput.js +0 -192
- package/dist/components/user-action/ToggleableInput.js.map +0 -1
- package/dist/components/user-action/ToggleableInput.mjs +0 -157
- package/dist/components/user-action/ToggleableInput.mjs.map +0 -1
- package/dist/css/uncompiled/textstyles.css +0 -69
- package/dist/hooks/useFocusManagement.js.map +0 -1
- package/dist/hooks/useFocusManagement.mjs.map +0 -1
- package/dist/hooks/useFocusOnceVisible.js.map +0 -1
- package/dist/hooks/useFocusOnceVisible.mjs.map +0 -1
- package/dist/index.d.mts +0 -103
- package/dist/index.d.ts +0 -103
- package/dist/index.js +0 -12610
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -12447
- package/dist/index.mjs.map +0 -1
- package/dist/util/PropsWithFunctionChildren.d.mts +0 -14
- package/dist/util/PropsWithFunctionChildren.d.ts +0 -14
- package/dist/util/PropsWithFunctionChildren.js.map +0 -1
- package/dist/util/PropsWithFunctionChildren.mjs.map +0 -1
- package/dist/util/array.js.map +0 -1
- package/dist/util/array.mjs.map +0 -1
- package/dist/util/builder.js.map +0 -1
- package/dist/util/builder.mjs.map +0 -1
- package/dist/util/date.js.map +0 -1
- package/dist/util/date.mjs.map +0 -1
- package/dist/util/easeFunctions.js.map +0 -1
- package/dist/util/easeFunctions.mjs.map +0 -1
- package/dist/util/emailValidation.js.map +0 -1
- package/dist/util/emailValidation.mjs.map +0 -1
- package/dist/util/loopingArray.js.map +0 -1
- package/dist/util/loopingArray.mjs.map +0 -1
- package/dist/util/math.d.mts +0 -3
- package/dist/util/math.d.ts +0 -3
- package/dist/util/math.js.map +0 -1
- package/dist/util/math.mjs +0 -8
- package/dist/util/math.mjs.map +0 -1
- package/dist/util/news.d.mts +0 -101
- package/dist/util/news.d.ts +0 -101
- package/dist/util/news.js +0 -76
- package/dist/util/news.js.map +0 -1
- package/dist/util/news.mjs +0 -49
- package/dist/util/news.mjs.map +0 -1
- package/dist/util/noop.js.map +0 -1
- package/dist/util/noop.mjs +0 -6
- package/dist/util/noop.mjs.map +0 -1
- package/dist/util/resolveSetState.js.map +0 -1
- package/dist/util/resolveSetState.mjs.map +0 -1
- package/dist/util/simpleSearch.js.map +0 -1
- package/dist/util/simpleSearch.mjs.map +0 -1
- package/dist/util/storage.js.map +0 -1
- package/dist/util/storage.mjs.map +0 -1
- package/dist/util/types.d.mts +0 -3
- package/dist/util/types.d.ts +0 -3
- package/dist/util/types.js +0 -18
- package/dist/util/types.js.map +0 -1
- package/dist/util/types.mjs +0 -1
- package/dist/util/types.mjs.map +0 -1
- package/dist/util/writeToClipboard.js.map +0 -1
- package/dist/util/writeToClipboard.mjs.map +0 -1
- /package/dist/hooks/{useFocusManagement.d.mts → focus/useFocusManagement.d.mts} +0 -0
- /package/dist/hooks/{useFocusManagement.d.ts → focus/useFocusManagement.d.ts} +0 -0
- /package/dist/hooks/{useFocusOnceVisible.d.mts → focus/useFocusOnceVisible.d.mts} +0 -0
- /package/dist/hooks/{useFocusOnceVisible.d.ts → focus/useFocusOnceVisible.d.ts} +0 -0
- /package/dist/{css → style}/uncompiled/theme/colors-basic.css +0 -0
- /package/dist/{css → style}/uncompiled/theme/index.css +0 -0
- /package/dist/{css → style}/uncompiled/theme/variants.css +0 -0
- /package/dist/{css → style}/uncompiled/utitlity/borderradius.css +0 -0
- /package/dist/{css → style}/uncompiled/utitlity/general.css +0 -0
- /package/dist/{util → utils}/builder.d.mts +0 -0
- /package/dist/{util → utils}/builder.d.ts +0 -0
- /package/dist/{util → utils}/date.d.mts +0 -0
- /package/dist/{util → utils}/date.d.ts +0 -0
- /package/dist/{util → utils}/easeFunctions.d.mts +0 -0
- /package/dist/{util → utils}/easeFunctions.d.ts +0 -0
- /package/dist/{util → utils}/emailValidation.d.mts +0 -0
- /package/dist/{util → utils}/emailValidation.d.ts +0 -0
- /package/dist/{util → utils}/loopingArray.d.mts +0 -0
- /package/dist/{util → utils}/loopingArray.d.ts +0 -0
- /package/dist/{util → utils}/noop.d.mts +0 -0
- /package/dist/{util → utils}/noop.d.ts +0 -0
- /package/dist/{util → utils}/resolveSetState.d.mts +0 -0
- /package/dist/{util → utils}/resolveSetState.d.ts +0 -0
- /package/dist/{util → utils}/simpleSearch.d.mts +0 -0
- /package/dist/{util → utils}/simpleSearch.d.ts +0 -0
- /package/dist/{util → utils}/storage.d.mts +0 -0
- /package/dist/{util → utils}/storage.d.ts +0 -0
- /package/dist/{util → utils}/writeToClipboard.d.mts +0 -0
- /package/dist/{util → utils}/writeToClipboard.d.ts +0 -0
|
@@ -1,93 +1,6 @@
|
|
|
1
1
|
// src/components/properties/SelectProperty.tsx
|
|
2
|
-
import { List
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
// src/localization/LanguageProvider.tsx
|
|
6
|
-
import { createContext, useContext, useEffect, useState as useState2 } from "react";
|
|
7
|
-
|
|
8
|
-
// src/hooks/useLocalStorage.ts
|
|
9
|
-
import { useCallback, useState } from "react";
|
|
10
|
-
|
|
11
|
-
// src/localization/util.ts
|
|
12
|
-
var languages = ["en", "de"];
|
|
13
|
-
var languagesLocalNames = {
|
|
14
|
-
en: "English",
|
|
15
|
-
de: "Deutsch"
|
|
16
|
-
};
|
|
17
|
-
var DEFAULT_LANGUAGE = "en";
|
|
18
|
-
var LanguageUtil = {
|
|
19
|
-
languages,
|
|
20
|
-
DEFAULT_LANGUAGE,
|
|
21
|
-
languagesLocalNames
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// src/localization/LanguageProvider.tsx
|
|
25
|
-
import { jsx } from "react/jsx-runtime";
|
|
26
|
-
var LanguageContext = createContext({
|
|
27
|
-
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
28
|
-
setLanguage: (v) => v
|
|
29
|
-
});
|
|
30
|
-
var useLanguage = () => useContext(LanguageContext);
|
|
31
|
-
|
|
32
|
-
// src/localization/useTranslation.ts
|
|
33
|
-
var TranslationPluralCount = {
|
|
34
|
-
zero: 0,
|
|
35
|
-
one: 1,
|
|
36
|
-
two: 2,
|
|
37
|
-
few: 3,
|
|
38
|
-
many: 11,
|
|
39
|
-
other: -1
|
|
40
|
-
};
|
|
41
|
-
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
42
|
-
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
43
|
-
const { language: inferredLanguage } = useLanguage();
|
|
44
|
-
const usedLanguage = languageProp ?? inferredLanguage;
|
|
45
|
-
const usedTranslations = [...translations];
|
|
46
|
-
if (overwrite) {
|
|
47
|
-
usedTranslations.push(overwrite);
|
|
48
|
-
}
|
|
49
|
-
return (key, options) => {
|
|
50
|
-
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
51
|
-
try {
|
|
52
|
-
for (let i = translations.length - 1; i >= 0; i--) {
|
|
53
|
-
const translation = translations[i];
|
|
54
|
-
const localizedTranslation = translation[usedLanguage];
|
|
55
|
-
if (!localizedTranslation) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
const value = localizedTranslation[key];
|
|
59
|
-
if (!value) {
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
let forProcessing;
|
|
63
|
-
if (typeof value !== "string") {
|
|
64
|
-
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
65
|
-
forProcessing = value.zero;
|
|
66
|
-
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
67
|
-
forProcessing = value.one;
|
|
68
|
-
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
69
|
-
forProcessing = value.two;
|
|
70
|
-
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
71
|
-
forProcessing = value.few;
|
|
72
|
-
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
73
|
-
forProcessing = value.many;
|
|
74
|
-
} else {
|
|
75
|
-
forProcessing = value.other;
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
forProcessing = value;
|
|
79
|
-
}
|
|
80
|
-
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
81
|
-
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
82
|
-
});
|
|
83
|
-
return forProcessing;
|
|
84
|
-
}
|
|
85
|
-
} catch (e) {
|
|
86
|
-
console.error(e);
|
|
87
|
-
}
|
|
88
|
-
return `{{${usedLanguage}:${key}}}`;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
2
|
+
import { List } from "lucide-react";
|
|
3
|
+
import clsx6 from "clsx";
|
|
91
4
|
|
|
92
5
|
// src/components/properties/PropertyBase.tsx
|
|
93
6
|
import { AlertTriangle } from "lucide-react";
|
|
@@ -96,7 +9,7 @@ import clsx2 from "clsx";
|
|
|
96
9
|
// src/components/user-action/Button.tsx
|
|
97
10
|
import { forwardRef } from "react";
|
|
98
11
|
import clsx from "clsx";
|
|
99
|
-
import { jsx
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
100
13
|
var ButtonColorUtil = {
|
|
101
14
|
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
102
15
|
text: ["primary", "negative", "neutral"],
|
|
@@ -163,7 +76,7 @@ var SolidButton = forwardRef(function SolidButton2({
|
|
|
163
76
|
),
|
|
164
77
|
...restProps,
|
|
165
78
|
children: [
|
|
166
|
-
startIcon && /* @__PURE__ */
|
|
79
|
+
startIcon && /* @__PURE__ */ jsx(
|
|
167
80
|
"span",
|
|
168
81
|
{
|
|
169
82
|
className: clsx(
|
|
@@ -174,7 +87,7 @@ var SolidButton = forwardRef(function SolidButton2({
|
|
|
174
87
|
}
|
|
175
88
|
),
|
|
176
89
|
children,
|
|
177
|
-
endIcon && /* @__PURE__ */
|
|
90
|
+
endIcon && /* @__PURE__ */ jsx(
|
|
178
91
|
"span",
|
|
179
92
|
{
|
|
180
93
|
className: clsx(
|
|
@@ -200,14 +113,14 @@ var TextButton = ({
|
|
|
200
113
|
...restProps
|
|
201
114
|
}) => {
|
|
202
115
|
const colorClasses = {
|
|
203
|
-
primary: "not-disabled:bg-transparent not-disabled:text-button-text-primary-text",
|
|
204
|
-
negative: "not-disabled:bg-transparent not-disabled:text-button-text-negative-text",
|
|
205
|
-
neutral: "not-disabled:bg-transparent not-disabled:text-button-text-neutral-text"
|
|
116
|
+
primary: "not-disabled:bg-transparent not-disabled:text-button-text-primary-text focus-style-none focus-visible:ring-2 not-disabled:focus-visible:ring-button-text-primary-text",
|
|
117
|
+
negative: "not-disabled:bg-transparent not-disabled:text-button-text-negative-text focus-style-none focus-visible:ring-2 not-disabled:focus-visible:ring-button-text-negative-text",
|
|
118
|
+
neutral: "not-disabled:bg-transparent not-disabled:text-button-text-neutral-text focus-style-none focus-visible:ring-2 not-disabled:focus-visible:ring-button-text-neutral-text"
|
|
206
119
|
}[color];
|
|
207
120
|
const backgroundColor = {
|
|
208
|
-
primary: "not-disabled:hover:bg-button-text-primary-text/20",
|
|
209
|
-
negative: "not-disabled:hover:bg-button-text-negative-text/20",
|
|
210
|
-
neutral: "not-disabled:hover:bg-button-text-neutral-text/20"
|
|
121
|
+
primary: "not-disabled:hover:bg-button-text-primary-text/20 not-disabled:focus-visible:bg-button-text-primary-text/20",
|
|
122
|
+
negative: "not-disabled:hover:bg-button-text-negative-text/20 not-disabled:focus-visible:bg-button-text-negative-text/20",
|
|
123
|
+
neutral: "not-disabled:hover:bg-button-text-neutral-text/20 not-disabled:focus-visible:bg-button-text-neutral-text/20"
|
|
211
124
|
}[color];
|
|
212
125
|
const iconColorClasses = {
|
|
213
126
|
primary: "not-group-disabled:text-button-text-primary-icon",
|
|
@@ -231,7 +144,7 @@ var TextButton = ({
|
|
|
231
144
|
),
|
|
232
145
|
...restProps,
|
|
233
146
|
children: [
|
|
234
|
-
startIcon && /* @__PURE__ */
|
|
147
|
+
startIcon && /* @__PURE__ */ jsx(
|
|
235
148
|
"span",
|
|
236
149
|
{
|
|
237
150
|
className: clsx(
|
|
@@ -242,7 +155,7 @@ var TextButton = ({
|
|
|
242
155
|
}
|
|
243
156
|
),
|
|
244
157
|
children,
|
|
245
|
-
endIcon && /* @__PURE__ */
|
|
158
|
+
endIcon && /* @__PURE__ */ jsx(
|
|
246
159
|
"span",
|
|
247
160
|
{
|
|
248
161
|
className: clsx(
|
|
@@ -256,13 +169,13 @@ var TextButton = ({
|
|
|
256
169
|
}
|
|
257
170
|
);
|
|
258
171
|
};
|
|
259
|
-
var IconButton = ({
|
|
172
|
+
var IconButton = forwardRef(function IconButton2({
|
|
260
173
|
children,
|
|
261
174
|
color = "primary",
|
|
262
175
|
size = "medium",
|
|
263
176
|
className,
|
|
264
177
|
...restProps
|
|
265
|
-
})
|
|
178
|
+
}, ref) {
|
|
266
179
|
const colorClasses = {
|
|
267
180
|
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
268
181
|
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
@@ -273,9 +186,10 @@ var IconButton = ({
|
|
|
273
186
|
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
|
|
274
187
|
transparent: "not-disabled:bg-transparent"
|
|
275
188
|
}[color];
|
|
276
|
-
return /* @__PURE__ */
|
|
189
|
+
return /* @__PURE__ */ jsx(
|
|
277
190
|
"button",
|
|
278
191
|
{
|
|
192
|
+
ref,
|
|
279
193
|
className: clsx(
|
|
280
194
|
colorClasses,
|
|
281
195
|
"not-disabled:hover:brightness-90",
|
|
@@ -292,6 +206,93 @@ var IconButton = ({
|
|
|
292
206
|
children
|
|
293
207
|
}
|
|
294
208
|
);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// src/localization/LanguageProvider.tsx
|
|
212
|
+
import { createContext, useContext, useEffect, useState as useState2 } from "react";
|
|
213
|
+
|
|
214
|
+
// src/hooks/useLocalStorage.ts
|
|
215
|
+
import { useCallback, useState } from "react";
|
|
216
|
+
|
|
217
|
+
// src/localization/util.ts
|
|
218
|
+
var languages = ["en", "de"];
|
|
219
|
+
var languagesLocalNames = {
|
|
220
|
+
en: "English",
|
|
221
|
+
de: "Deutsch"
|
|
222
|
+
};
|
|
223
|
+
var DEFAULT_LANGUAGE = "en";
|
|
224
|
+
var LanguageUtil = {
|
|
225
|
+
languages,
|
|
226
|
+
DEFAULT_LANGUAGE,
|
|
227
|
+
languagesLocalNames
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// src/localization/LanguageProvider.tsx
|
|
231
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
232
|
+
var LanguageContext = createContext({
|
|
233
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
234
|
+
setLanguage: (v) => v
|
|
235
|
+
});
|
|
236
|
+
var useLanguage = () => useContext(LanguageContext);
|
|
237
|
+
|
|
238
|
+
// src/localization/useTranslation.ts
|
|
239
|
+
var TranslationPluralCount = {
|
|
240
|
+
zero: 0,
|
|
241
|
+
one: 1,
|
|
242
|
+
two: 2,
|
|
243
|
+
few: 3,
|
|
244
|
+
many: 11,
|
|
245
|
+
other: -1
|
|
246
|
+
};
|
|
247
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
248
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
249
|
+
const { language: inferredLanguage } = useLanguage();
|
|
250
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
251
|
+
const usedTranslations = [...translations];
|
|
252
|
+
if (overwrite) {
|
|
253
|
+
usedTranslations.push(overwrite);
|
|
254
|
+
}
|
|
255
|
+
return (key, options) => {
|
|
256
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
257
|
+
try {
|
|
258
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
259
|
+
const translation = translations[i];
|
|
260
|
+
const localizedTranslation = translation[usedLanguage];
|
|
261
|
+
if (!localizedTranslation) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const value = localizedTranslation[key];
|
|
265
|
+
if (!value) {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
let forProcessing;
|
|
269
|
+
if (typeof value !== "string") {
|
|
270
|
+
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
271
|
+
forProcessing = value.zero;
|
|
272
|
+
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
273
|
+
forProcessing = value.one;
|
|
274
|
+
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
275
|
+
forProcessing = value.two;
|
|
276
|
+
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
277
|
+
forProcessing = value.few;
|
|
278
|
+
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
279
|
+
forProcessing = value.many;
|
|
280
|
+
} else {
|
|
281
|
+
forProcessing = value.other;
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
forProcessing = value;
|
|
285
|
+
}
|
|
286
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
287
|
+
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
288
|
+
});
|
|
289
|
+
return forProcessing;
|
|
290
|
+
}
|
|
291
|
+
} catch (e) {
|
|
292
|
+
console.error(e);
|
|
293
|
+
}
|
|
294
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
295
|
+
};
|
|
295
296
|
};
|
|
296
297
|
|
|
297
298
|
// src/localization/defaults/form.ts
|
|
@@ -330,6 +331,7 @@ var formTranslation = {
|
|
|
330
331
|
next: "Next",
|
|
331
332
|
no: "No",
|
|
332
333
|
none: "None",
|
|
334
|
+
nothingFound: "Nothing found",
|
|
333
335
|
of: "of",
|
|
334
336
|
optional: "Optional",
|
|
335
337
|
pleaseWait: "Please wait...",
|
|
@@ -386,6 +388,7 @@ var formTranslation = {
|
|
|
386
388
|
next: "Weiter",
|
|
387
389
|
no: "Nein",
|
|
388
390
|
none: "Nichts",
|
|
391
|
+
nothingFound: "Nichts gefunden",
|
|
389
392
|
of: "von",
|
|
390
393
|
optional: "Optional",
|
|
391
394
|
pleaseWait: "Bitte warten...",
|
|
@@ -457,13 +460,13 @@ var PropertyBase = ({
|
|
|
457
460
|
children: [
|
|
458
461
|
input({ softRequired, hasValue }),
|
|
459
462
|
requiredAndNoValue && /* @__PURE__ */ jsx3("div", { className: "text-warning", children: /* @__PURE__ */ jsx3(AlertTriangle, { size: 24 }) }),
|
|
460
|
-
onRemove &&
|
|
463
|
+
onRemove && !readOnly && /* @__PURE__ */ jsx3(
|
|
461
464
|
TextButton,
|
|
462
465
|
{
|
|
463
466
|
onClick: onRemove,
|
|
464
467
|
color: "negative",
|
|
465
|
-
className: clsx2("items-center"
|
|
466
|
-
disabled: !hasValue
|
|
468
|
+
className: clsx2("items-center"),
|
|
469
|
+
disabled: !hasValue,
|
|
467
470
|
children: translation("remove")
|
|
468
471
|
}
|
|
469
472
|
)
|
|
@@ -473,102 +476,37 @@ var PropertyBase = ({
|
|
|
473
476
|
] });
|
|
474
477
|
};
|
|
475
478
|
|
|
476
|
-
// src/components/user-action/Select.tsx
|
|
477
|
-
import {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
var Label = ({
|
|
490
|
-
children,
|
|
491
|
-
name,
|
|
492
|
-
labelType = "labelSmall",
|
|
493
|
-
className,
|
|
494
|
-
...props
|
|
495
|
-
}) => {
|
|
496
|
-
return /* @__PURE__ */ jsx4("label", { ...props, className: clsx3(styleMapping[labelType], className), children: children ? children : name });
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
// src/components/layout-and-navigation/Tile.tsx
|
|
500
|
-
import clsx4 from "clsx";
|
|
501
|
-
import { Check } from "lucide-react";
|
|
502
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
503
|
-
var Tile = ({
|
|
504
|
-
title,
|
|
505
|
-
titleClassName,
|
|
506
|
-
description,
|
|
507
|
-
descriptionClassName,
|
|
508
|
-
onClick,
|
|
509
|
-
isSelected = false,
|
|
510
|
-
disabled = false,
|
|
511
|
-
prefix,
|
|
512
|
-
suffix,
|
|
513
|
-
normalClassName = "hover:bg-primary/40 cursor-pointer",
|
|
514
|
-
selectedClassName = "bg-primary/20",
|
|
515
|
-
disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
|
|
516
|
-
className
|
|
517
|
-
}) => {
|
|
518
|
-
return /* @__PURE__ */ jsxs3(
|
|
519
|
-
"div",
|
|
520
|
-
{
|
|
521
|
-
className: clsx4(
|
|
522
|
-
"flex-row-2 w-full items-center",
|
|
523
|
-
{
|
|
524
|
-
[normalClassName]: onClick && !disabled,
|
|
525
|
-
[selectedClassName]: isSelected && !disabled,
|
|
526
|
-
[disabledClassName]: disabled
|
|
527
|
-
},
|
|
528
|
-
className
|
|
529
|
-
),
|
|
530
|
-
onClick: disabled ? void 0 : onClick,
|
|
531
|
-
children: [
|
|
532
|
-
prefix,
|
|
533
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex-col-0 w-full", children: [
|
|
534
|
-
/* @__PURE__ */ jsx5("span", { className: clsx4(titleClassName ?? "textstyle-title-normal"), children: title }),
|
|
535
|
-
!!description && /* @__PURE__ */ jsx5("span", { className: clsx4(descriptionClassName ?? "textstyle-description"), children: description })
|
|
536
|
-
] }),
|
|
537
|
-
suffix ?? (isSelected ? /* @__PURE__ */ jsx5(Check, { size: 24 }) : void 0)
|
|
538
|
-
]
|
|
539
|
-
}
|
|
540
|
-
);
|
|
541
|
-
};
|
|
542
|
-
var ListTile = ({
|
|
543
|
-
...props
|
|
544
|
-
}) => {
|
|
545
|
-
return /* @__PURE__ */ jsx5(
|
|
546
|
-
Tile,
|
|
547
|
-
{
|
|
548
|
-
...props,
|
|
549
|
-
titleClassName: props.titleClassName ?? "font-semibold",
|
|
550
|
-
className: clsx4("px-2 py-1 rounded-md", props.className),
|
|
551
|
-
disabledClassName: props.disabledClassName ?? "text-disabled-text cursor-not-allowed"
|
|
552
|
-
}
|
|
553
|
-
);
|
|
554
|
-
};
|
|
479
|
+
// src/components/user-action/select/Select.tsx
|
|
480
|
+
import {
|
|
481
|
+
createContext as createContext2,
|
|
482
|
+
forwardRef as forwardRef3,
|
|
483
|
+
useCallback as useCallback5,
|
|
484
|
+
useContext as useContext2,
|
|
485
|
+
useEffect as useEffect6,
|
|
486
|
+
useId as useId3,
|
|
487
|
+
useImperativeHandle,
|
|
488
|
+
useRef as useRef2,
|
|
489
|
+
useState as useState7
|
|
490
|
+
} from "react";
|
|
491
|
+
import clsx5 from "clsx";
|
|
555
492
|
|
|
556
493
|
// src/components/layout-and-navigation/Expandable.tsx
|
|
557
|
-
import { forwardRef as forwardRef2, useCallback as useCallback2, useEffect as useEffect2, useState as useState3 } from "react";
|
|
494
|
+
import { forwardRef as forwardRef2, useCallback as useCallback2, useEffect as useEffect2, useId, useState as useState3 } from "react";
|
|
558
495
|
import { ChevronDown } from "lucide-react";
|
|
559
|
-
import
|
|
496
|
+
import clsx3 from "clsx";
|
|
560
497
|
|
|
561
|
-
// src/
|
|
498
|
+
// src/utils/noop.ts
|
|
562
499
|
var noop = () => void 0;
|
|
563
500
|
|
|
564
501
|
// src/components/layout-and-navigation/Expandable.tsx
|
|
565
|
-
import { jsx as
|
|
502
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
566
503
|
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
567
|
-
return /* @__PURE__ */
|
|
504
|
+
return /* @__PURE__ */ jsx4(
|
|
568
505
|
ChevronDown,
|
|
569
506
|
{
|
|
570
|
-
|
|
571
|
-
|
|
507
|
+
"aria-hidden": true,
|
|
508
|
+
className: clsx3(
|
|
509
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform motion-safe:duration-200 motion-reduce:duration-0 ease-in-out",
|
|
572
510
|
{ "rotate-180": isExpanded },
|
|
573
511
|
className
|
|
574
512
|
)
|
|
@@ -577,6 +515,7 @@ var ExpansionIcon = ({ isExpanded, className }) => {
|
|
|
577
515
|
};
|
|
578
516
|
var Expandable = forwardRef2(function Expandable2({
|
|
579
517
|
children,
|
|
518
|
+
id: providedId,
|
|
580
519
|
label,
|
|
581
520
|
icon,
|
|
582
521
|
isExpanded = false,
|
|
@@ -588,19 +527,26 @@ var Expandable = forwardRef2(function Expandable2({
|
|
|
588
527
|
contentClassName,
|
|
589
528
|
contentExpandedClassName
|
|
590
529
|
}, ref) {
|
|
591
|
-
const defaultIcon = useCallback2((expanded) => /* @__PURE__ */
|
|
530
|
+
const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx4(ExpansionIcon, { isExpanded: expanded }), []);
|
|
592
531
|
icon ??= defaultIcon;
|
|
593
|
-
|
|
532
|
+
const generatedId = useId();
|
|
533
|
+
const id = providedId ?? generatedId;
|
|
534
|
+
return /* @__PURE__ */ jsxs3(
|
|
594
535
|
"div",
|
|
595
536
|
{
|
|
596
537
|
ref,
|
|
597
|
-
className: clsx5("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
|
|
598
538
|
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
539
|
+
className: clsx3(
|
|
540
|
+
"flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm",
|
|
541
|
+
{ "cursor-pointer": !clickOnlyOnHeader && !disabled },
|
|
542
|
+
className
|
|
543
|
+
),
|
|
599
544
|
children: [
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
"
|
|
545
|
+
/* @__PURE__ */ jsxs3(
|
|
546
|
+
"button",
|
|
602
547
|
{
|
|
603
|
-
|
|
548
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
549
|
+
className: clsx3(
|
|
604
550
|
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
605
551
|
{
|
|
606
552
|
"group-hover:brightness-97": !isExpanded,
|
|
@@ -609,24 +555,28 @@ var Expandable = forwardRef2(function Expandable2({
|
|
|
609
555
|
},
|
|
610
556
|
headerClassName
|
|
611
557
|
),
|
|
612
|
-
|
|
558
|
+
"aria-expanded": isExpanded,
|
|
559
|
+
"aria-controls": `${id}-content`,
|
|
560
|
+
"aria-disabled": disabled ?? void 0,
|
|
613
561
|
children: [
|
|
614
562
|
label,
|
|
615
563
|
icon(isExpanded)
|
|
616
564
|
]
|
|
617
565
|
}
|
|
618
566
|
),
|
|
619
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ jsx4(
|
|
620
568
|
"div",
|
|
621
569
|
{
|
|
622
|
-
|
|
570
|
+
id: `${id}-content`,
|
|
571
|
+
className: clsx3(
|
|
623
572
|
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
624
573
|
{
|
|
625
|
-
[
|
|
574
|
+
[clsx3("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
|
|
626
575
|
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
627
576
|
},
|
|
628
577
|
contentClassName
|
|
629
578
|
),
|
|
579
|
+
role: "region",
|
|
630
580
|
children
|
|
631
581
|
}
|
|
632
582
|
)
|
|
@@ -643,7 +593,7 @@ var ExpandableUncontrolled = forwardRef2(function ExpandableUncontrolled2({
|
|
|
643
593
|
useEffect2(() => {
|
|
644
594
|
setUsedIsExpanded(isExpanded);
|
|
645
595
|
}, [isExpanded]);
|
|
646
|
-
return /* @__PURE__ */
|
|
596
|
+
return /* @__PURE__ */ jsx4(
|
|
647
597
|
Expandable,
|
|
648
598
|
{
|
|
649
599
|
...props,
|
|
@@ -657,718 +607,991 @@ var ExpandableUncontrolled = forwardRef2(function ExpandableUncontrolled2({
|
|
|
657
607
|
);
|
|
658
608
|
});
|
|
659
609
|
|
|
660
|
-
// src/
|
|
661
|
-
import { useEffect as
|
|
662
|
-
import clsx6 from "clsx";
|
|
610
|
+
// src/hooks/focus/useFocusTrap.ts
|
|
611
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useId as useId2, useRef, useState as useState5 } from "react";
|
|
663
612
|
|
|
664
|
-
// src/hooks/
|
|
665
|
-
import { useEffect as useEffect3 } from "react";
|
|
666
|
-
var
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
handler();
|
|
674
|
-
};
|
|
675
|
-
document.addEventListener("mousedown", listener);
|
|
676
|
-
document.addEventListener("touchstart", listener);
|
|
613
|
+
// src/hooks/focus/useIsMounted.ts
|
|
614
|
+
import { useEffect as useEffect3, useLayoutEffect, useState as useState4 } from "react";
|
|
615
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
616
|
+
var useIsomorphicEffect = isClient ? useLayoutEffect : useEffect3;
|
|
617
|
+
var useIsMounted = () => {
|
|
618
|
+
const [isMounted, setIsMounted] = useState4(false);
|
|
619
|
+
useIsomorphicEffect(() => {
|
|
620
|
+
setIsMounted(true);
|
|
677
621
|
return () => {
|
|
678
|
-
|
|
679
|
-
document.removeEventListener("touchstart", listener);
|
|
622
|
+
setIsMounted(false);
|
|
680
623
|
};
|
|
681
|
-
}, [
|
|
624
|
+
}, []);
|
|
625
|
+
return isMounted;
|
|
682
626
|
};
|
|
683
627
|
|
|
684
|
-
// src/hooks/
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
const onMouseEnter = () => {
|
|
695
|
-
if (isDisabled) {
|
|
696
|
-
return;
|
|
697
|
-
}
|
|
698
|
-
clearTimeout(timer);
|
|
699
|
-
setIsHovered(true);
|
|
700
|
-
};
|
|
701
|
-
const onMouseLeave = () => {
|
|
702
|
-
if (isDisabled) {
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
setTimer(setTimeout(() => {
|
|
706
|
-
setIsHovered(false);
|
|
707
|
-
}, closingDelay));
|
|
708
|
-
};
|
|
709
|
-
useEffect4(() => {
|
|
710
|
-
if (timer) {
|
|
711
|
-
return () => {
|
|
712
|
-
clearTimeout(timer);
|
|
713
|
-
};
|
|
714
|
-
}
|
|
628
|
+
// src/hooks/focus/useFocusTrap.ts
|
|
629
|
+
var createFocusGuard = () => {
|
|
630
|
+
const div = document.createElement("div");
|
|
631
|
+
Object.assign(div.style, {
|
|
632
|
+
opacity: "0",
|
|
633
|
+
outline: "none",
|
|
634
|
+
boxShadow: "none",
|
|
635
|
+
position: "fixed",
|
|
636
|
+
pointerEvents: "none",
|
|
637
|
+
touchAction: "none"
|
|
715
638
|
});
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}, [isDisabled]);
|
|
721
|
-
return {
|
|
722
|
-
isHovered,
|
|
723
|
-
setIsHovered,
|
|
724
|
-
handlers: { onMouseEnter, onMouseLeave }
|
|
725
|
-
};
|
|
639
|
+
div.tabIndex = 0;
|
|
640
|
+
div.setAttribute("data-hw-focus-guard", "");
|
|
641
|
+
document.body.appendChild(div);
|
|
642
|
+
return div;
|
|
726
643
|
};
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
644
|
+
function getContainedFocusableElements(element) {
|
|
645
|
+
return element?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
646
|
+
}
|
|
647
|
+
var FocusTrapService = class {
|
|
648
|
+
constructor() {
|
|
649
|
+
// The last entry is always the active one
|
|
650
|
+
this.listeners = [];
|
|
651
|
+
this.onFocusIn = (event) => {
|
|
652
|
+
const active = this.getActive();
|
|
653
|
+
if (!active || !active.container.current) return;
|
|
654
|
+
const { container } = active;
|
|
655
|
+
if (!container.current.contains(event.target)) {
|
|
656
|
+
this.focusElement();
|
|
657
|
+
}
|
|
658
|
+
};
|
|
732
659
|
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
resolve
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
// src/hooks/usePopoverPosition.ts
|
|
740
|
-
var defaultPopoverPositionOptions = {
|
|
741
|
-
edgePadding: 16,
|
|
742
|
-
outerGap: 4,
|
|
743
|
-
horizontalAlignment: "leftInside",
|
|
744
|
-
verticalAlignment: "bottomOutside",
|
|
745
|
-
disabled: false
|
|
746
|
-
};
|
|
747
|
-
var usePopoverPosition = (trigger, options) => {
|
|
748
|
-
const {
|
|
749
|
-
edgePadding,
|
|
750
|
-
outerGap,
|
|
751
|
-
verticalAlignment,
|
|
752
|
-
horizontalAlignment,
|
|
753
|
-
disabled
|
|
754
|
-
} = { ...defaultPopoverPositionOptions, ...options };
|
|
755
|
-
if (disabled || !trigger) {
|
|
756
|
-
return {};
|
|
660
|
+
getActive() {
|
|
661
|
+
if (this.listeners.length === 0) return void 0;
|
|
662
|
+
return this.listeners[this.listeners.length - 1];
|
|
757
663
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
664
|
+
focusElement() {
|
|
665
|
+
const active = this.getActive();
|
|
666
|
+
if (!active) return;
|
|
667
|
+
const { container, initialFocusElement } = active;
|
|
668
|
+
const containerElement = container.current;
|
|
669
|
+
if (initialFocusElement?.current) {
|
|
670
|
+
initialFocusElement.current.focus();
|
|
671
|
+
} else {
|
|
672
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
673
|
+
if (elements && elements.length > 0) {
|
|
674
|
+
const first = elements.item(0);
|
|
675
|
+
first.focus();
|
|
676
|
+
} else {
|
|
677
|
+
containerElement.focus();
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
removeGuards() {
|
|
682
|
+
document.querySelectorAll("[data-hw-focus-guard]").forEach((node) => node.remove());
|
|
683
|
+
}
|
|
684
|
+
addGuards() {
|
|
685
|
+
document.body.insertAdjacentElement("afterbegin", createFocusGuard());
|
|
686
|
+
document.body.insertAdjacentElement("beforeend", createFocusGuard());
|
|
687
|
+
}
|
|
688
|
+
activate() {
|
|
689
|
+
document.addEventListener("focusin", this.onFocusIn);
|
|
690
|
+
this.addGuards();
|
|
691
|
+
}
|
|
692
|
+
deactivate() {
|
|
693
|
+
document.removeEventListener("focusin", this.onFocusIn);
|
|
694
|
+
this.removeGuards();
|
|
695
|
+
}
|
|
696
|
+
register(listener) {
|
|
697
|
+
this.listeners.push(listener);
|
|
698
|
+
if (this.listeners.length === 1) {
|
|
699
|
+
this.activate();
|
|
700
|
+
}
|
|
701
|
+
const active = listener;
|
|
702
|
+
this.listeners.forEach((listener2) => {
|
|
703
|
+
const { focus, pause } = listener2;
|
|
704
|
+
if (listener2 === active) {
|
|
705
|
+
focus();
|
|
706
|
+
} else {
|
|
707
|
+
pause();
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
unregister(id) {
|
|
712
|
+
const index = this.listeners.findIndex((trap) => trap.id === id);
|
|
713
|
+
if (index !== -1) {
|
|
714
|
+
const isActive = index === this.listeners.length - 1;
|
|
715
|
+
const listener = this.listeners[index];
|
|
716
|
+
this.listeners = this.listeners.filter((listener2) => listener2.id !== id);
|
|
717
|
+
if (isActive) {
|
|
718
|
+
this.deactivate();
|
|
719
|
+
listener.focusLast();
|
|
720
|
+
const active = this.getActive();
|
|
721
|
+
this.listeners.forEach((listener2) => {
|
|
722
|
+
const { pause, unpause } = listener2;
|
|
723
|
+
if (listener2 === active) {
|
|
724
|
+
unpause();
|
|
725
|
+
} else {
|
|
726
|
+
pause();
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
if (this.listeners.length > 0) {
|
|
730
|
+
this.activate();
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
} else {
|
|
734
|
+
console.warn(`Unable to unregister id ${id}: not found`);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
var service = new FocusTrapService();
|
|
739
|
+
var useFocusTrap = ({
|
|
740
|
+
container,
|
|
741
|
+
active = true,
|
|
742
|
+
initialFocus,
|
|
743
|
+
focusFirst = true
|
|
744
|
+
}) => {
|
|
745
|
+
const lastFocusRef = useRef(null);
|
|
746
|
+
const [paused, setPaused] = useState5(false);
|
|
747
|
+
const isMounted = useIsMounted();
|
|
748
|
+
const id = useId2();
|
|
749
|
+
const focusElement = useCallback3(() => {
|
|
750
|
+
const containerElement = container.current;
|
|
751
|
+
if (initialFocus?.current) {
|
|
752
|
+
initialFocus.current.focus();
|
|
753
|
+
} else {
|
|
754
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
755
|
+
if (elements && elements.length > 0) {
|
|
756
|
+
const first = elements.item(0);
|
|
757
|
+
first.focus();
|
|
758
|
+
} else {
|
|
759
|
+
containerElement.focus();
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
}, [container, initialFocus]);
|
|
763
|
+
useEffect4(() => {
|
|
764
|
+
if (active && isMounted) {
|
|
765
|
+
let pause = function() {
|
|
766
|
+
setPaused(true);
|
|
767
|
+
}, unpause = function() {
|
|
768
|
+
setPaused(false);
|
|
769
|
+
if (!container.current.contains(document.activeElement)) {
|
|
770
|
+
focusElement();
|
|
771
|
+
}
|
|
772
|
+
}, focus = function() {
|
|
773
|
+
focusElement();
|
|
774
|
+
setPaused(false);
|
|
775
|
+
}, focusLast = function() {
|
|
776
|
+
lastFocusRef.current?.focus();
|
|
777
|
+
};
|
|
778
|
+
if (!lastFocusRef.current) {
|
|
779
|
+
lastFocusRef.current = document.activeElement;
|
|
780
|
+
}
|
|
781
|
+
service.register({ id, pause, focus, focusLast, unpause, container, initialFocusElement: initialFocus });
|
|
782
|
+
return () => {
|
|
783
|
+
service.unregister(id);
|
|
784
|
+
lastFocusRef.current = void 0;
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
}, [active, container, focusElement, id, initialFocus, isMounted]);
|
|
788
|
+
useEffect4(() => {
|
|
789
|
+
if (active && !paused && isMounted) {
|
|
790
|
+
let onKeyDown = function(event) {
|
|
791
|
+
const key = event.key;
|
|
792
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
793
|
+
const active2 = document.activeElement;
|
|
794
|
+
const index = [...elements].findIndex((value) => value === active2);
|
|
795
|
+
if (index === -1 || event.altKey || event.ctrlKey || event.metaKey) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
if (key === "Tab") {
|
|
799
|
+
const next = event.shiftKey ? -1 : 1;
|
|
800
|
+
const nextIndex = (index + next + elements.length) % elements.length;
|
|
801
|
+
const nextElement = elements[nextIndex];
|
|
802
|
+
nextElement.focus();
|
|
803
|
+
event.preventDefault();
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
const containerElement = container.current;
|
|
807
|
+
containerElement.addEventListener("keydown", onKeyDown);
|
|
808
|
+
return () => {
|
|
809
|
+
containerElement.removeEventListener("keydown", onKeyDown);
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
}, [active, paused, isMounted, container, initialFocus, focusFirst, focusElement]);
|
|
791
813
|
};
|
|
792
814
|
|
|
793
|
-
// src/
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
var Menu = ({
|
|
806
|
-
trigger,
|
|
815
|
+
// src/utils/match.ts
|
|
816
|
+
var match = (key, values) => {
|
|
817
|
+
return values[key];
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
// src/components/user-action/select/Select.tsx
|
|
821
|
+
import { CheckIcon, Plus, XIcon } from "lucide-react";
|
|
822
|
+
|
|
823
|
+
// src/components/layout-and-navigation/Chip.tsx
|
|
824
|
+
import clsx4 from "clsx";
|
|
825
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
826
|
+
var Chip = ({
|
|
807
827
|
children,
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
828
|
+
trailingIcon,
|
|
829
|
+
color = "default",
|
|
830
|
+
size = "md",
|
|
831
|
+
icon = false,
|
|
832
|
+
variant = "normal",
|
|
833
|
+
className = "",
|
|
834
|
+
...restProps
|
|
813
835
|
}) => {
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}
|
|
850
|
-
}, [isOpen]);
|
|
851
|
-
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
852
|
-
trigger(bag, triggerRef),
|
|
853
|
-
createPortal(/* @__PURE__ */ jsx7(
|
|
854
|
-
"div",
|
|
855
|
-
{
|
|
856
|
-
ref: menuRef,
|
|
857
|
-
onClick: (e) => e.stopPropagation(),
|
|
858
|
-
className: clsx6(
|
|
859
|
-
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg shadow-strong z-[300]",
|
|
860
|
-
{
|
|
861
|
-
"animate-pop-in": isOpen,
|
|
862
|
-
"animate-pop-out": !isOpen,
|
|
863
|
-
"hidden": isHidden
|
|
864
|
-
},
|
|
865
|
-
menuClassName
|
|
866
|
-
),
|
|
867
|
-
onAnimationEnd: () => {
|
|
868
|
-
if (!isOpen) {
|
|
869
|
-
setIsHidden(true);
|
|
870
|
-
}
|
|
836
|
+
const colorMapping = {
|
|
837
|
+
default: "text-tag-default-text bg-tag-default-background",
|
|
838
|
+
dark: "text-tag-dark-text bg-tag-dark-background",
|
|
839
|
+
red: "text-tag-red-text bg-tag-red-background",
|
|
840
|
+
yellow: "text-tag-yellow-text bg-tag-yellow-background",
|
|
841
|
+
green: "text-tag-green-text bg-tag-green-background",
|
|
842
|
+
blue: "text-tag-blue-text bg-tag-blue-background",
|
|
843
|
+
pink: "text-tag-pink-text bg-tag-pink-background",
|
|
844
|
+
orange: "text-tag-orange-text bg-tag-orange-background"
|
|
845
|
+
}[color];
|
|
846
|
+
const colorMappingIcon = {
|
|
847
|
+
default: "text-tag-default-icon",
|
|
848
|
+
dark: "text-tag-dark-icon",
|
|
849
|
+
red: "text-tag-red-icon",
|
|
850
|
+
yellow: "text-tag-yellow-icon",
|
|
851
|
+
green: "text-tag-green-icon",
|
|
852
|
+
blue: "text-tag-blue-icon",
|
|
853
|
+
pink: "text-tag-pink-icon",
|
|
854
|
+
orange: "text-tag-orange-icon"
|
|
855
|
+
}[color];
|
|
856
|
+
return /* @__PURE__ */ jsxs4(
|
|
857
|
+
"div",
|
|
858
|
+
{
|
|
859
|
+
...restProps,
|
|
860
|
+
className: clsx4(
|
|
861
|
+
`flex-row-0 w-fit font-semibold`,
|
|
862
|
+
colorMapping,
|
|
863
|
+
!icon ? {
|
|
864
|
+
"px-1 py-0.5": size === "sm",
|
|
865
|
+
"px-2 py-1": size === "md",
|
|
866
|
+
"px-4 py-2": size === "lg"
|
|
867
|
+
} : {
|
|
868
|
+
"p-0.5": size === "sm",
|
|
869
|
+
"p-1": size === "md",
|
|
870
|
+
"p-2": size === "lg"
|
|
871
871
|
},
|
|
872
|
-
|
|
873
|
-
|
|
872
|
+
{
|
|
873
|
+
"rounded-md": variant === "normal",
|
|
874
|
+
"rounded-full": variant === "fullyRounded"
|
|
874
875
|
},
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
876
|
+
className
|
|
877
|
+
),
|
|
878
|
+
children: [
|
|
879
|
+
children,
|
|
880
|
+
trailingIcon && /* @__PURE__ */ jsx5("span", { className: colorMappingIcon, children: trailingIcon })
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
);
|
|
879
884
|
};
|
|
880
885
|
|
|
881
|
-
// src/
|
|
882
|
-
import {
|
|
883
|
-
import clsx7 from "clsx";
|
|
886
|
+
// src/hooks/useFloatingElement.ts
|
|
887
|
+
import { useCallback as useCallback4, useEffect as useEffect5, useState as useState6 } from "react";
|
|
884
888
|
|
|
885
|
-
// src/
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
disabled: false
|
|
889
|
+
// src/utils/math.ts
|
|
890
|
+
var clamp = (value, range = [0, 1]) => {
|
|
891
|
+
const [min, max] = range;
|
|
892
|
+
return Math.min(Math.max(value, min), max);
|
|
890
893
|
};
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
894
|
+
|
|
895
|
+
// src/hooks/useFloatingElement.ts
|
|
896
|
+
function calculatePosition({
|
|
897
|
+
windowRect,
|
|
898
|
+
containerRect,
|
|
899
|
+
anchorRect,
|
|
900
|
+
options
|
|
901
|
+
}) {
|
|
902
|
+
const { verticalAlignment, horizontalAlignment, gap, screenPadding } = options;
|
|
903
|
+
const windowWidth = windowRect.width;
|
|
904
|
+
const windowHeight = windowRect.height;
|
|
905
|
+
const maxWidth = windowWidth - 2 * screenPadding;
|
|
906
|
+
const maxHeight = windowHeight - 2 * screenPadding;
|
|
907
|
+
const width = Math.min(containerRect.width, maxWidth);
|
|
908
|
+
const height = Math.min(containerRect.height, maxHeight);
|
|
909
|
+
const leftSuggestion = {
|
|
910
|
+
beforeStart: anchorRect.left - width - gap,
|
|
911
|
+
afterStart: anchorRect.left,
|
|
912
|
+
center: anchorRect.left + anchorRect.width / 2 - width / 2,
|
|
913
|
+
beforeEnd: anchorRect.right - width,
|
|
914
|
+
afterEnd: anchorRect.right + gap
|
|
915
|
+
}[horizontalAlignment];
|
|
916
|
+
const topSuggestion = {
|
|
917
|
+
beforeStart: anchorRect.top - height - gap,
|
|
918
|
+
afterStart: anchorRect.top,
|
|
919
|
+
center: anchorRect.top + anchorRect.height / 2 - height / 2,
|
|
920
|
+
beforeEnd: anchorRect.bottom - height,
|
|
921
|
+
afterEnd: anchorRect.bottom + gap
|
|
922
|
+
}[verticalAlignment];
|
|
923
|
+
const left = clamp(leftSuggestion, [
|
|
924
|
+
screenPadding,
|
|
925
|
+
windowWidth - screenPadding - width
|
|
926
|
+
]);
|
|
927
|
+
const top = clamp(topSuggestion, [
|
|
928
|
+
screenPadding,
|
|
929
|
+
windowHeight - screenPadding - height
|
|
930
|
+
]);
|
|
931
|
+
return {
|
|
932
|
+
left,
|
|
933
|
+
top,
|
|
934
|
+
maxWidth,
|
|
935
|
+
maxHeight
|
|
900
936
|
};
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
937
|
+
}
|
|
938
|
+
function useFloatingElement({
|
|
939
|
+
active = true,
|
|
940
|
+
windowRef,
|
|
941
|
+
anchorRef,
|
|
942
|
+
containerRef,
|
|
943
|
+
isPolling = false,
|
|
944
|
+
pollingInterval = 100,
|
|
945
|
+
verticalAlignment = "afterEnd",
|
|
946
|
+
horizontalAlignment = "afterStart",
|
|
947
|
+
screenPadding = 16,
|
|
948
|
+
gap = 4
|
|
949
|
+
}) {
|
|
950
|
+
const [style, setStyle] = useState6();
|
|
951
|
+
const isMounted = useIsMounted();
|
|
952
|
+
const calculate = useCallback4(() => {
|
|
953
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
954
|
+
const windowRect = windowRef?.current.getBoundingClientRect() ?? {
|
|
955
|
+
top: 0,
|
|
956
|
+
bottom: window.innerHeight,
|
|
957
|
+
left: 0,
|
|
958
|
+
right: window.innerWidth,
|
|
959
|
+
width: window.innerWidth,
|
|
960
|
+
height: window.innerHeight
|
|
961
|
+
};
|
|
962
|
+
const anchorElement = anchorRef?.current;
|
|
963
|
+
if (anchorRef && !anchorElement) {
|
|
964
|
+
console.warn("FloatingContainer anchor provided, but its value is undefined");
|
|
904
965
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
966
|
+
const anchorRect = anchorElement?.getBoundingClientRect() ?? windowRect;
|
|
967
|
+
const calculateProps = {
|
|
968
|
+
windowRect,
|
|
969
|
+
anchorRect,
|
|
970
|
+
containerRect,
|
|
971
|
+
options: {
|
|
972
|
+
horizontalAlignment,
|
|
973
|
+
verticalAlignment,
|
|
974
|
+
screenPadding,
|
|
975
|
+
gap
|
|
976
|
+
}
|
|
914
977
|
};
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
978
|
+
setStyle(calculatePosition(calculateProps));
|
|
979
|
+
}, [anchorRef, containerRef, gap, horizontalAlignment, screenPadding, verticalAlignment, windowRef]);
|
|
980
|
+
const height = containerRef.current?.getBoundingClientRect().height;
|
|
981
|
+
const width = containerRef.current?.getBoundingClientRect().width;
|
|
982
|
+
useEffect5(() => {
|
|
983
|
+
if (active && isMounted) {
|
|
984
|
+
calculate();
|
|
985
|
+
} else {
|
|
986
|
+
setStyle(void 0);
|
|
987
|
+
}
|
|
988
|
+
}, [calculate, active, isMounted, height, width]);
|
|
989
|
+
useEffect5(() => {
|
|
990
|
+
window.addEventListener("resize", calculate);
|
|
991
|
+
let timeout;
|
|
992
|
+
if (isPolling) {
|
|
993
|
+
timeout = setInterval(calculate, pollingInterval);
|
|
920
994
|
}
|
|
921
|
-
|
|
922
|
-
|
|
995
|
+
return () => {
|
|
996
|
+
window.removeEventListener("resize", calculate);
|
|
997
|
+
if (timeout) {
|
|
998
|
+
clearInterval(timeout);
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
}, [calculate, isPolling, pollingInterval]);
|
|
1002
|
+
return style;
|
|
923
1003
|
}
|
|
924
1004
|
|
|
925
|
-
// src/
|
|
926
|
-
import {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
);
|
|
1005
|
+
// src/components/user-action/select/Select.tsx
|
|
1006
|
+
import { createPortal } from "react-dom";
|
|
1007
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1008
|
+
var defaultToggleOpenOptions = {
|
|
1009
|
+
highlightStartPosition: "first"
|
|
1010
|
+
};
|
|
1011
|
+
var SelectContext = createContext2(null);
|
|
1012
|
+
function useSelectContext() {
|
|
1013
|
+
const ctx = useContext2(SelectContext);
|
|
1014
|
+
if (!ctx) {
|
|
1015
|
+
throw new Error("SelectContext must be used within a ListBoxPrimitive");
|
|
1016
|
+
}
|
|
1017
|
+
return ctx;
|
|
1018
|
+
}
|
|
1019
|
+
var SelectRoot = ({
|
|
1020
|
+
children,
|
|
1021
|
+
id,
|
|
1022
|
+
value,
|
|
1023
|
+
onValueChanged,
|
|
1024
|
+
values,
|
|
1025
|
+
onValuesChanged,
|
|
1026
|
+
isOpen = false,
|
|
1027
|
+
disabled = false,
|
|
1028
|
+
invalid = false,
|
|
1029
|
+
isMultiSelect = false
|
|
1030
|
+
}) => {
|
|
1031
|
+
const optionsRef = useRef2([]);
|
|
1032
|
+
const triggerRef = useRef2(null);
|
|
1033
|
+
const generatedId = useId3();
|
|
1034
|
+
const usedId = id ?? generatedId;
|
|
1035
|
+
const [internalState, setInternalState] = useState7({
|
|
1036
|
+
isOpen
|
|
1037
|
+
});
|
|
1038
|
+
const state = {
|
|
1039
|
+
...internalState,
|
|
1040
|
+
id: usedId,
|
|
1041
|
+
disabled,
|
|
1042
|
+
invalid,
|
|
1043
|
+
value: isMultiSelect ? values ?? [] : [value].filter(Boolean),
|
|
1044
|
+
isMultiSelect
|
|
1045
|
+
};
|
|
1046
|
+
const registerItem = useCallback5((item) => {
|
|
1047
|
+
optionsRef.current.push(item);
|
|
1048
|
+
optionsRef.current.sort((a, b) => {
|
|
1049
|
+
const aEl = a.ref.current;
|
|
1050
|
+
const bEl = b.ref.current;
|
|
1051
|
+
if (!aEl || !bEl) return 0;
|
|
1052
|
+
return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
1053
|
+
});
|
|
936
1054
|
}, []);
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
944
|
-
const currentIndex = elements.indexOf(document.activeElement);
|
|
945
|
-
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
1055
|
+
const unregisterItem = useCallback5((value2) => {
|
|
1056
|
+
optionsRef.current = optionsRef.current.filter((i) => i.value !== value2);
|
|
1057
|
+
}, []);
|
|
1058
|
+
const toggleSelection = (value2, isSelected) => {
|
|
1059
|
+
if (disabled) {
|
|
1060
|
+
return;
|
|
946
1061
|
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
nextElement?.focus();
|
|
952
|
-
}, [getNextFocusElement]);
|
|
953
|
-
const getPreviousFocusElement = useCallback3(() => {
|
|
954
|
-
const elements = getFocusableElements();
|
|
955
|
-
if (elements.length === 0) {
|
|
956
|
-
return void 0;
|
|
1062
|
+
const option = optionsRef.current.find((i) => i.value === value2);
|
|
1063
|
+
if (!option) {
|
|
1064
|
+
console.error(`SelectOption with value: ${value2} not found`);
|
|
1065
|
+
return;
|
|
957
1066
|
}
|
|
958
|
-
let
|
|
959
|
-
if (
|
|
960
|
-
const
|
|
961
|
-
|
|
962
|
-
|
|
1067
|
+
let newValue;
|
|
1068
|
+
if (isMultiSelect) {
|
|
1069
|
+
const isSelectedBefore = state.value.includes(value2);
|
|
1070
|
+
const isSelectedAfter = isSelected ?? !isSelectedBefore;
|
|
1071
|
+
if (!isSelectedAfter) {
|
|
1072
|
+
newValue = state.value.filter((v) => v !== value2);
|
|
963
1073
|
} else {
|
|
964
|
-
|
|
1074
|
+
newValue = [...state.value, value2];
|
|
965
1075
|
}
|
|
1076
|
+
} else {
|
|
1077
|
+
newValue = [value2];
|
|
966
1078
|
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
getPreviousFocusElement,
|
|
977
|
-
focusNext,
|
|
978
|
-
focusPrevious
|
|
1079
|
+
if (!isMultiSelect) {
|
|
1080
|
+
onValueChanged?.(newValue[0]);
|
|
1081
|
+
} else {
|
|
1082
|
+
onValuesChanged?.(newValue);
|
|
1083
|
+
}
|
|
1084
|
+
setInternalState((prevState) => ({
|
|
1085
|
+
...prevState,
|
|
1086
|
+
highlightedValue: value2
|
|
1087
|
+
}));
|
|
979
1088
|
};
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
// src/hooks/useFocusOnceVisible.ts
|
|
983
|
-
import React, { useEffect as useEffect7 } from "react";
|
|
984
|
-
var useFocusOnceVisible = (ref, disable = false) => {
|
|
985
|
-
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
986
|
-
useEffect7(() => {
|
|
987
|
-
if (disable || hasUsedFocus) {
|
|
1089
|
+
const highlightItem = (value2) => {
|
|
1090
|
+
if (disabled) {
|
|
988
1091
|
return;
|
|
989
1092
|
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1093
|
+
setInternalState((prevState) => ({
|
|
1094
|
+
...prevState,
|
|
1095
|
+
highlightedValue: value2
|
|
1096
|
+
}));
|
|
1097
|
+
};
|
|
1098
|
+
const registerTrigger = useCallback5((ref) => {
|
|
1099
|
+
triggerRef.current = ref.current;
|
|
1100
|
+
}, []);
|
|
1101
|
+
const unregisterTrigger = useCallback5(() => {
|
|
1102
|
+
triggerRef.current = null;
|
|
1103
|
+
}, []);
|
|
1104
|
+
const toggleOpen = (isOpen2, options) => {
|
|
1105
|
+
const { highlightStartPosition } = { ...defaultToggleOpenOptions, ...options };
|
|
1106
|
+
let highlightedIndex;
|
|
1107
|
+
if (highlightStartPosition === "first") {
|
|
1108
|
+
highlightedIndex = optionsRef.current.findIndex((option) => !option.disabled);
|
|
1109
|
+
} else {
|
|
1110
|
+
highlightedIndex = optionsRef.current.length - 1 - [...optionsRef.current].reverse().findIndex((option) => !option.disabled);
|
|
1111
|
+
}
|
|
1112
|
+
if (highlightedIndex === -1 || highlightedIndex === optionsRef.current.length) {
|
|
1113
|
+
highlightedIndex = 0;
|
|
1114
|
+
}
|
|
1115
|
+
setInternalState((prevState) => ({
|
|
1116
|
+
...prevState,
|
|
1117
|
+
isOpen: isOpen2 ?? !prevState.isOpen,
|
|
1118
|
+
highlightedValue: optionsRef.current[highlightedIndex].value
|
|
1119
|
+
}));
|
|
1120
|
+
};
|
|
1121
|
+
const moveHighlightedIndex = (delta) => {
|
|
1122
|
+
let highlightedIndex = optionsRef.current.findIndex((value2) => value2.value === internalState.highlightedValue);
|
|
1123
|
+
if (highlightedIndex === -1) {
|
|
1124
|
+
highlightedIndex = 0;
|
|
1125
|
+
}
|
|
1126
|
+
const optionLength = optionsRef.current.length;
|
|
1127
|
+
const startIndex = (highlightedIndex + delta % optionLength + optionLength) % optionLength;
|
|
1128
|
+
const isForward = delta >= 0;
|
|
1129
|
+
let highlightedValue = optionsRef.current[startIndex].value;
|
|
1130
|
+
for (let i = 0; i < optionsRef.current.length; i++) {
|
|
1131
|
+
const index = (startIndex + (isForward ? i : -i) + optionLength) % optionLength;
|
|
1132
|
+
if (!optionsRef.current[index].disabled) {
|
|
1133
|
+
highlightedValue = optionsRef.current[index].value;
|
|
1134
|
+
break;
|
|
994
1135
|
}
|
|
995
|
-
}, {
|
|
996
|
-
threshold: 0.1
|
|
997
|
-
});
|
|
998
|
-
if (ref.current) {
|
|
999
|
-
observer.observe(ref.current);
|
|
1000
1136
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
"bg-disabled-background text-disabled-text border-disabled-border": disabled
|
|
1137
|
+
setInternalState((prevState) => ({
|
|
1138
|
+
...prevState,
|
|
1139
|
+
highlightedValue
|
|
1140
|
+
}));
|
|
1141
|
+
};
|
|
1142
|
+
useEffect6(() => {
|
|
1143
|
+
if (!internalState.highlightedValue) return;
|
|
1144
|
+
const highlighted = optionsRef.current.find((value2) => value2.value === internalState.highlightedValue);
|
|
1145
|
+
if (highlighted) {
|
|
1146
|
+
highlighted.ref.current.scrollIntoView({ behavior: "instant", block: "nearest" });
|
|
1147
|
+
} else {
|
|
1148
|
+
console.error(`SelectRoot: Could not find highlighted value (${internalState.highlightedValue})`);
|
|
1014
1149
|
}
|
|
1015
|
-
);
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
className = "",
|
|
1031
|
-
allowEnterComplete = true,
|
|
1032
|
-
expanded = true,
|
|
1033
|
-
autoFocus = false,
|
|
1034
|
-
onBlur,
|
|
1035
|
-
editCompleteOptions,
|
|
1036
|
-
containerClassName,
|
|
1037
|
-
disabled,
|
|
1038
|
-
...restProps
|
|
1039
|
-
}, forwardedRef) {
|
|
1040
|
-
const { onBlur: allowEditCompleteOnBlur, afterDelay, delay } = { ...defaultEditCompleteOptions, ...editCompleteOptions };
|
|
1041
|
-
const {
|
|
1042
|
-
restartTimer,
|
|
1043
|
-
clearTimer
|
|
1044
|
-
} = useDelay({ delay, disabled: !afterDelay });
|
|
1045
|
-
const innerRef = useRef2(null);
|
|
1046
|
-
const { focusNext } = useFocusManagement();
|
|
1047
|
-
useFocusOnceVisible(innerRef, !autoFocus);
|
|
1048
|
-
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
1049
|
-
const handleKeyDown = (e) => {
|
|
1050
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
1051
|
-
e.preventDefault();
|
|
1052
|
-
innerRef.current?.blur();
|
|
1053
|
-
focusNext();
|
|
1150
|
+
}, [internalState.highlightedValue]);
|
|
1151
|
+
const contextValue = {
|
|
1152
|
+
state,
|
|
1153
|
+
item: {
|
|
1154
|
+
register: registerItem,
|
|
1155
|
+
unregister: unregisterItem,
|
|
1156
|
+
toggleSelection,
|
|
1157
|
+
highlightItem,
|
|
1158
|
+
moveHighlightedIndex
|
|
1159
|
+
},
|
|
1160
|
+
trigger: {
|
|
1161
|
+
ref: triggerRef,
|
|
1162
|
+
register: registerTrigger,
|
|
1163
|
+
unregister: unregisterTrigger,
|
|
1164
|
+
toggleOpen
|
|
1054
1165
|
}
|
|
1055
1166
|
};
|
|
1056
|
-
return /* @__PURE__ */
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1167
|
+
return /* @__PURE__ */ jsx6(SelectContext.Provider, { value: contextValue, children });
|
|
1168
|
+
};
|
|
1169
|
+
var SelectOption = forwardRef3(
|
|
1170
|
+
function SelectOption2({ value, disabled = false, children, className, ...restProps }, ref) {
|
|
1171
|
+
const { state, item, trigger } = useSelectContext();
|
|
1172
|
+
const { register, unregister, toggleSelection, highlightItem } = item;
|
|
1173
|
+
const itemRef = useRef2(null);
|
|
1174
|
+
useEffect6(() => {
|
|
1175
|
+
register({
|
|
1063
1176
|
value,
|
|
1064
|
-
id,
|
|
1065
|
-
type,
|
|
1066
1177
|
disabled,
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1178
|
+
ref: itemRef
|
|
1179
|
+
});
|
|
1180
|
+
return () => unregister(value);
|
|
1181
|
+
}, [value, disabled, register, unregister, children]);
|
|
1182
|
+
const isHighlighted = state.highlightedValue === value;
|
|
1183
|
+
const isSelected = state.value.includes(value);
|
|
1184
|
+
return /* @__PURE__ */ jsxs5(
|
|
1185
|
+
"li",
|
|
1186
|
+
{
|
|
1187
|
+
...restProps,
|
|
1188
|
+
ref: (node) => {
|
|
1189
|
+
itemRef.current = node;
|
|
1190
|
+
if (typeof ref === "function") ref(node);
|
|
1191
|
+
else if (ref) ref.current = node;
|
|
1192
|
+
},
|
|
1193
|
+
id: value,
|
|
1194
|
+
role: "option",
|
|
1195
|
+
"aria-disabled": disabled,
|
|
1196
|
+
"aria-selected": isSelected,
|
|
1197
|
+
"data-highlighted": isHighlighted ? "" : void 0,
|
|
1198
|
+
"data-selected": isSelected ? "" : void 0,
|
|
1199
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1200
|
+
className: clsx5(
|
|
1201
|
+
"flex-row-1 items-center px-2 py-1 rounded-md",
|
|
1202
|
+
"data-highlighted:bg-primary/20",
|
|
1203
|
+
"data-disabled:text-disabled data-disabled:cursor-not-allowed",
|
|
1204
|
+
"not-data-disabled:cursor-pointer",
|
|
1205
|
+
className
|
|
1206
|
+
),
|
|
1207
|
+
onClick: (event) => {
|
|
1208
|
+
if (!disabled) {
|
|
1209
|
+
toggleSelection(value);
|
|
1210
|
+
if (!state.isMultiSelect) {
|
|
1211
|
+
trigger.toggleOpen(false);
|
|
1212
|
+
}
|
|
1213
|
+
restProps.onClick?.(event);
|
|
1074
1214
|
}
|
|
1075
1215
|
},
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1216
|
+
onMouseEnter: (event) => {
|
|
1217
|
+
if (!disabled) {
|
|
1218
|
+
highlightItem(value);
|
|
1219
|
+
restProps.onMouseEnter?.(event);
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
children: [
|
|
1223
|
+
/* @__PURE__ */ jsx6(
|
|
1224
|
+
CheckIcon,
|
|
1225
|
+
{
|
|
1226
|
+
className: clsx5("w-4 h-4", { "opacity-0": !isSelected || disabled }),
|
|
1227
|
+
"aria-hidden": true
|
|
1228
|
+
}
|
|
1229
|
+
),
|
|
1230
|
+
children ?? value
|
|
1231
|
+
]
|
|
1232
|
+
}
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
1235
|
+
);
|
|
1236
|
+
var defaultSelectButtonTranslation = {
|
|
1237
|
+
en: {
|
|
1238
|
+
clickToSelect: "Click to select"
|
|
1239
|
+
},
|
|
1240
|
+
de: {
|
|
1241
|
+
clickToSelect: "Zum ausw\xE4hlen dr\xFCcken"
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
var SelectButton = forwardRef3(function SelectButton2({ placeholder, selectedDisplay, ...props }, ref) {
|
|
1245
|
+
const translation = useTranslation([defaultSelectButtonTranslation]);
|
|
1246
|
+
const { state, trigger } = useSelectContext();
|
|
1247
|
+
const { register, unregister, toggleOpen } = trigger;
|
|
1248
|
+
const innerRef = useRef2(null);
|
|
1249
|
+
useImperativeHandle(ref, () => innerRef.current);
|
|
1250
|
+
useEffect6(() => {
|
|
1251
|
+
register(innerRef);
|
|
1252
|
+
return () => unregister();
|
|
1253
|
+
}, [register, unregister]);
|
|
1254
|
+
const disabled = !!props?.disabled || !!state.disabled;
|
|
1255
|
+
const invalid = state.invalid;
|
|
1256
|
+
const hasValue = state.value.length > 0;
|
|
1257
|
+
return /* @__PURE__ */ jsxs5(
|
|
1258
|
+
"button",
|
|
1259
|
+
{
|
|
1260
|
+
...props,
|
|
1261
|
+
ref: innerRef,
|
|
1262
|
+
id: state.id,
|
|
1263
|
+
className: clsx5(
|
|
1264
|
+
"flex-row-2 items-center justify-between bg-input-background text-input-text rounded-md px-2.5 py-2.5",
|
|
1265
|
+
"data-placeholder:text-description",
|
|
1266
|
+
props.className
|
|
1267
|
+
),
|
|
1268
|
+
onClick: () => toggleOpen(!state.isOpen),
|
|
1269
|
+
onKeyDown: (event) => {
|
|
1270
|
+
switch (event.key) {
|
|
1271
|
+
case "ArrowDown":
|
|
1272
|
+
toggleOpen(true, { highlightStartPosition: "first" });
|
|
1273
|
+
break;
|
|
1274
|
+
case "ArrowUp":
|
|
1275
|
+
toggleOpen(true, { highlightStartPosition: "last" });
|
|
1276
|
+
break;
|
|
1277
|
+
}
|
|
1278
|
+
},
|
|
1279
|
+
"data-placeholder": !hasValue ? "" : void 0,
|
|
1280
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1281
|
+
"data-invalid": invalid ? "" : void 0,
|
|
1282
|
+
"aria-invalid": invalid,
|
|
1283
|
+
"aria-disabled": disabled,
|
|
1284
|
+
"aria-haspopup": "listbox",
|
|
1285
|
+
"aria-expanded": state.isOpen,
|
|
1286
|
+
"aria-controls": state.isOpen ? `${state.id}-listbox` : void 0,
|
|
1287
|
+
children: [
|
|
1288
|
+
hasValue ? selectedDisplay?.(state.value) ?? state.value.join(", ") : placeholder ?? translation("clickToSelect"),
|
|
1289
|
+
/* @__PURE__ */ jsx6(ExpansionIcon, { isExpanded: state.isOpen })
|
|
1290
|
+
]
|
|
1291
|
+
}
|
|
1292
|
+
);
|
|
1293
|
+
});
|
|
1294
|
+
var SelectChipDisplay = forwardRef3(function SelectChipDisplay2({ ...props }, ref) {
|
|
1295
|
+
const { state, trigger, item } = useSelectContext();
|
|
1296
|
+
const { register, unregister, toggleOpen } = trigger;
|
|
1297
|
+
const innerRef = useRef2(null);
|
|
1298
|
+
useImperativeHandle(ref, () => innerRef.current);
|
|
1299
|
+
useEffect6(() => {
|
|
1300
|
+
register(innerRef);
|
|
1301
|
+
return () => unregister();
|
|
1302
|
+
}, [register, unregister]);
|
|
1303
|
+
const disabled = !!props?.disabled || !!state.disabled;
|
|
1304
|
+
const invalid = state.invalid;
|
|
1305
|
+
return /* @__PURE__ */ jsxs5(
|
|
1306
|
+
"div",
|
|
1307
|
+
{
|
|
1308
|
+
...props,
|
|
1309
|
+
ref: innerRef,
|
|
1310
|
+
className: clsx5(
|
|
1311
|
+
"flex flex-wrap flex-row gap-2 items-center bg-input-background text-input-text rounded-md px-2.5 py-2.5",
|
|
1312
|
+
props.className
|
|
1313
|
+
),
|
|
1314
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1315
|
+
"data-invalid": invalid ? "" : void 0,
|
|
1316
|
+
"aria-invalid": invalid,
|
|
1317
|
+
"aria-disabled": disabled,
|
|
1318
|
+
children: [
|
|
1319
|
+
state.value.map((value) => /* @__PURE__ */ jsxs5(Chip, { className: "gap-x-2", children: [
|
|
1320
|
+
value,
|
|
1321
|
+
/* @__PURE__ */ jsx6(
|
|
1322
|
+
"button",
|
|
1323
|
+
{
|
|
1324
|
+
onClick: () => {
|
|
1325
|
+
item.toggleSelection(value, false);
|
|
1326
|
+
},
|
|
1327
|
+
className: "focus-within:text-negative hover:bg-negative/20 hover:text-negative rounded-md focus-style-none focus-visible:ring-2 focus-visible:ring-negative focus-visible:bg-negative/20",
|
|
1328
|
+
children: /* @__PURE__ */ jsx6(XIcon, {})
|
|
1329
|
+
}
|
|
1330
|
+
)
|
|
1331
|
+
] }, value)),
|
|
1332
|
+
/* @__PURE__ */ jsx6(
|
|
1333
|
+
IconButton,
|
|
1334
|
+
{
|
|
1335
|
+
id: state.id,
|
|
1336
|
+
onClick: () => toggleOpen(),
|
|
1337
|
+
onKeyDown: (event) => {
|
|
1338
|
+
switch (event.key) {
|
|
1339
|
+
case "ArrowDown":
|
|
1340
|
+
toggleOpen(true, { highlightStartPosition: "first" });
|
|
1341
|
+
break;
|
|
1342
|
+
case "ArrowUp":
|
|
1343
|
+
toggleOpen(true, { highlightStartPosition: "last" });
|
|
1344
|
+
}
|
|
1345
|
+
},
|
|
1346
|
+
size: "small",
|
|
1347
|
+
color: "neutral",
|
|
1348
|
+
"aria-invalid": invalid,
|
|
1349
|
+
"aria-disabled": disabled,
|
|
1350
|
+
"aria-haspopup": "listbox",
|
|
1351
|
+
"aria-expanded": state.isOpen,
|
|
1352
|
+
"aria-controls": state.isOpen ? `${state.id}-listbox` : void 0,
|
|
1353
|
+
children: /* @__PURE__ */ jsx6(Plus, {})
|
|
1354
|
+
}
|
|
1355
|
+
)
|
|
1356
|
+
]
|
|
1357
|
+
}
|
|
1358
|
+
);
|
|
1359
|
+
});
|
|
1360
|
+
var SelectContent = forwardRef3(
|
|
1361
|
+
function SelectContent2({
|
|
1362
|
+
alignment,
|
|
1363
|
+
orientation = "vertical",
|
|
1364
|
+
...props
|
|
1365
|
+
}, ref) {
|
|
1366
|
+
const innerRef = useRef2(null);
|
|
1367
|
+
useImperativeHandle(ref, () => innerRef.current);
|
|
1368
|
+
const { trigger, state, item } = useSelectContext();
|
|
1369
|
+
const position = useFloatingElement({
|
|
1370
|
+
active: state.isOpen,
|
|
1371
|
+
anchorRef: trigger.ref,
|
|
1372
|
+
containerRef: innerRef,
|
|
1373
|
+
...alignment
|
|
1374
|
+
});
|
|
1375
|
+
useFocusTrap({
|
|
1376
|
+
container: innerRef,
|
|
1377
|
+
active: state.isOpen && !!position
|
|
1378
|
+
});
|
|
1379
|
+
return createPortal(
|
|
1380
|
+
/* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1381
|
+
/* @__PURE__ */ jsx6(
|
|
1382
|
+
"div",
|
|
1383
|
+
{
|
|
1384
|
+
hidden: !state.isOpen,
|
|
1385
|
+
onClick: () => trigger.toggleOpen(false),
|
|
1386
|
+
className: clsx5("fixed w-screen h-screen inset-0")
|
|
1387
|
+
}
|
|
1388
|
+
),
|
|
1389
|
+
/* @__PURE__ */ jsx6(
|
|
1390
|
+
"ul",
|
|
1391
|
+
{
|
|
1392
|
+
...props,
|
|
1393
|
+
id: `${state.id}-listbox`,
|
|
1394
|
+
ref: innerRef,
|
|
1395
|
+
hidden: !state.isOpen,
|
|
1396
|
+
onKeyDown: (event) => {
|
|
1397
|
+
switch (event.key) {
|
|
1398
|
+
case "Escape":
|
|
1399
|
+
trigger.toggleOpen(false);
|
|
1400
|
+
event.preventDefault();
|
|
1401
|
+
event.stopPropagation();
|
|
1402
|
+
break;
|
|
1403
|
+
case match(orientation, {
|
|
1404
|
+
vertical: "ArrowDown",
|
|
1405
|
+
horizontal: "ArrowUp"
|
|
1406
|
+
}):
|
|
1407
|
+
item.moveHighlightedIndex(1);
|
|
1408
|
+
event.preventDefault();
|
|
1409
|
+
break;
|
|
1410
|
+
case match(orientation, {
|
|
1411
|
+
vertical: "ArrowUp",
|
|
1412
|
+
horizontal: "ArrowDown"
|
|
1413
|
+
}):
|
|
1414
|
+
item.moveHighlightedIndex(-1);
|
|
1415
|
+
event.preventDefault();
|
|
1416
|
+
break;
|
|
1417
|
+
case "Home":
|
|
1418
|
+
event.preventDefault();
|
|
1419
|
+
break;
|
|
1420
|
+
case "End":
|
|
1421
|
+
event.preventDefault();
|
|
1422
|
+
break;
|
|
1423
|
+
case "Enter":
|
|
1424
|
+
// Fall through
|
|
1425
|
+
case " ":
|
|
1426
|
+
if (state.highlightedValue) {
|
|
1427
|
+
item.toggleSelection(state.highlightedValue);
|
|
1428
|
+
if (!state.isMultiSelect) {
|
|
1429
|
+
trigger.toggleOpen(false);
|
|
1430
|
+
}
|
|
1431
|
+
event.preventDefault();
|
|
1432
|
+
}
|
|
1433
|
+
break;
|
|
1087
1434
|
}
|
|
1088
|
-
}
|
|
1435
|
+
},
|
|
1436
|
+
className: clsx5("flex-col-0 p-2 bg-menu-background text-menu-text rounded-md shadow-hw-bottom focus-style-within overflow-auto", props.className),
|
|
1437
|
+
style: {
|
|
1438
|
+
opacity: position ? void 0 : 0,
|
|
1439
|
+
position: "fixed",
|
|
1440
|
+
...position
|
|
1441
|
+
},
|
|
1442
|
+
role: "listbox",
|
|
1443
|
+
"aria-multiselectable": state.isMultiSelect,
|
|
1444
|
+
"aria-orientation": orientation,
|
|
1445
|
+
tabIndex: position ? 0 : void 0,
|
|
1446
|
+
children: props.children
|
|
1089
1447
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1448
|
+
)
|
|
1449
|
+
] }),
|
|
1450
|
+
document.body
|
|
1451
|
+
);
|
|
1452
|
+
}
|
|
1453
|
+
);
|
|
1454
|
+
var Select = forwardRef3(function Select2({
|
|
1455
|
+
children,
|
|
1456
|
+
contentPanelProps,
|
|
1457
|
+
buttonProps,
|
|
1458
|
+
...props
|
|
1459
|
+
}, ref) {
|
|
1460
|
+
return /* @__PURE__ */ jsxs5(SelectRoot, { ...props, isMultiSelect: false, children: [
|
|
1461
|
+
/* @__PURE__ */ jsx6(
|
|
1462
|
+
SelectButton,
|
|
1463
|
+
{
|
|
1464
|
+
ref,
|
|
1465
|
+
...buttonProps,
|
|
1466
|
+
selectedDisplay: (values) => {
|
|
1467
|
+
const value = values[0];
|
|
1468
|
+
if (!buttonProps?.selectedDisplay) return void 0;
|
|
1469
|
+
return buttonProps.selectedDisplay(value);
|
|
1092
1470
|
}
|
|
1093
1471
|
}
|
|
1094
|
-
)
|
|
1472
|
+
),
|
|
1473
|
+
/* @__PURE__ */ jsx6(SelectContent, { ...contentPanelProps, children })
|
|
1095
1474
|
] });
|
|
1096
1475
|
});
|
|
1097
|
-
var
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
className,
|
|
1102
|
-
labelClassName,
|
|
1103
|
-
errorClassName,
|
|
1104
|
-
containerClassName,
|
|
1105
|
-
required,
|
|
1106
|
-
disabled,
|
|
1107
|
-
...restProps
|
|
1476
|
+
var SelectUncontrolled = forwardRef3(function SelectUncontrolled2({
|
|
1477
|
+
value: initialValue,
|
|
1478
|
+
onValueChanged,
|
|
1479
|
+
...props
|
|
1108
1480
|
}, ref) {
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1481
|
+
const [value, setValue] = useState7(initialValue);
|
|
1482
|
+
useEffect6(() => {
|
|
1483
|
+
setValue(initialValue);
|
|
1484
|
+
}, [initialValue]);
|
|
1485
|
+
return /* @__PURE__ */ jsx6(
|
|
1486
|
+
Select,
|
|
1111
1487
|
{
|
|
1112
|
-
...
|
|
1488
|
+
...props,
|
|
1113
1489
|
ref,
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
)
|
|
1490
|
+
value,
|
|
1491
|
+
onValueChanged: (value2) => {
|
|
1492
|
+
setValue(value2);
|
|
1493
|
+
onValueChanged?.(value2);
|
|
1494
|
+
}
|
|
1120
1495
|
}
|
|
1121
1496
|
);
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1497
|
+
});
|
|
1498
|
+
var MultiSelect = forwardRef3(function MultiSelect2({
|
|
1499
|
+
children,
|
|
1500
|
+
contentPanelProps,
|
|
1501
|
+
buttonProps,
|
|
1502
|
+
...props
|
|
1503
|
+
}, ref) {
|
|
1504
|
+
return /* @__PURE__ */ jsxs5(SelectRoot, { ...props, isMultiSelect: true, children: [
|
|
1505
|
+
/* @__PURE__ */ jsx6(SelectButton, { ref, ...buttonProps }),
|
|
1506
|
+
/* @__PURE__ */ jsx6(SelectContent, { ...contentPanelProps, children })
|
|
1129
1507
|
] });
|
|
1130
1508
|
});
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
placeholder: placeholder ?? translation("search")
|
|
1509
|
+
var MultiSelectUncontrolled = forwardRef3(function MultiSelectUncontrolled2({
|
|
1510
|
+
values: initialValues,
|
|
1511
|
+
onValuesChanged,
|
|
1512
|
+
...props
|
|
1513
|
+
}, ref) {
|
|
1514
|
+
const [values, setValues] = useState7(initialValues);
|
|
1515
|
+
useEffect6(() => {
|
|
1516
|
+
setValues(initialValues);
|
|
1517
|
+
}, [initialValues]);
|
|
1518
|
+
return /* @__PURE__ */ jsx6(
|
|
1519
|
+
MultiSelect,
|
|
1520
|
+
{
|
|
1521
|
+
...props,
|
|
1522
|
+
ref,
|
|
1523
|
+
values,
|
|
1524
|
+
onValuesChanged: (value) => {
|
|
1525
|
+
setValues(value);
|
|
1526
|
+
onValuesChanged?.(value);
|
|
1150
1527
|
}
|
|
1151
|
-
),
|
|
1152
|
-
onSearch && /* @__PURE__ */ jsx9(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx9(Search, { className: "w-full h-full" }) })
|
|
1153
|
-
] });
|
|
1154
|
-
};
|
|
1155
|
-
|
|
1156
|
-
// src/hooks/useSearch.ts
|
|
1157
|
-
import { useCallback as useCallback4, useEffect as useEffect9, useMemo, useState as useState8 } from "react";
|
|
1158
|
-
|
|
1159
|
-
// src/util/simpleSearch.ts
|
|
1160
|
-
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
1161
|
-
return objects.filter((object) => {
|
|
1162
|
-
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
1163
|
-
if (!mappedSearchKeywords) {
|
|
1164
|
-
return true;
|
|
1165
|
-
}
|
|
1166
|
-
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
1167
|
-
});
|
|
1168
|
-
};
|
|
1169
|
-
|
|
1170
|
-
// src/hooks/useSearch.ts
|
|
1171
|
-
var useSearch = ({
|
|
1172
|
-
list,
|
|
1173
|
-
initialSearch,
|
|
1174
|
-
searchMapping,
|
|
1175
|
-
additionalSearchTags,
|
|
1176
|
-
isSearchInstant = true,
|
|
1177
|
-
sortingFunction,
|
|
1178
|
-
filter,
|
|
1179
|
-
disabled = false
|
|
1180
|
-
}) => {
|
|
1181
|
-
const [search, setSearch] = useState8(initialSearch ?? "");
|
|
1182
|
-
const [result, setResult] = useState8(list);
|
|
1183
|
-
const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
1184
|
-
const updateSearch = useCallback4((newSearch) => {
|
|
1185
|
-
const usedSearch = newSearch ?? search;
|
|
1186
|
-
if (newSearch) {
|
|
1187
|
-
setSearch(search);
|
|
1188
|
-
}
|
|
1189
|
-
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
1190
|
-
}, [searchTags, list, search, searchMapping]);
|
|
1191
|
-
useEffect9(() => {
|
|
1192
|
-
if (isSearchInstant) {
|
|
1193
|
-
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
1194
|
-
}
|
|
1195
|
-
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
1196
|
-
const filteredResult = useMemo(() => {
|
|
1197
|
-
if (!filter) {
|
|
1198
|
-
return result;
|
|
1199
|
-
}
|
|
1200
|
-
return result.filter(filter);
|
|
1201
|
-
}, [result, filter]);
|
|
1202
|
-
const sortedAndFilteredResult = useMemo(() => {
|
|
1203
|
-
if (!sortingFunction) {
|
|
1204
|
-
return filteredResult;
|
|
1205
1528
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
return {
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
allItems: list,
|
|
1218
|
-
updateSearch,
|
|
1219
|
-
search,
|
|
1220
|
-
setSearch
|
|
1221
|
-
};
|
|
1222
|
-
};
|
|
1223
|
-
|
|
1224
|
-
// src/components/user-action/Select.tsx
|
|
1225
|
-
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1226
|
-
var Select = ({
|
|
1227
|
-
value,
|
|
1228
|
-
label,
|
|
1229
|
-
options,
|
|
1230
|
-
onChange,
|
|
1231
|
-
hintText = "",
|
|
1232
|
-
selectedDisplayOverwrite,
|
|
1233
|
-
searchOptions,
|
|
1234
|
-
additionalItems,
|
|
1235
|
-
className,
|
|
1236
|
-
triggerClassName,
|
|
1237
|
-
hintTextClassName,
|
|
1238
|
-
...menuProps
|
|
1239
|
-
}) => {
|
|
1240
|
-
const selectedOption = options.find((option) => option.value === value);
|
|
1241
|
-
if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
|
|
1242
|
-
console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
|
|
1243
|
-
}
|
|
1244
|
-
const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
|
|
1245
|
-
const { result, search, setSearch } = useSearch({
|
|
1246
|
-
list: options,
|
|
1247
|
-
searchMapping: useCallback5((item) => item.searchTags, []),
|
|
1248
|
-
...searchOptions
|
|
1249
|
-
});
|
|
1250
|
-
return /* @__PURE__ */ jsxs8("div", { className: clsx9(className), children: [
|
|
1251
|
-
label && /* @__PURE__ */ jsx10(Label, { ...label, labelType: label.labelType ?? "labelSmall", className: clsx9("mb-1", label.className) }),
|
|
1252
|
-
/* @__PURE__ */ jsx10(
|
|
1253
|
-
Menu,
|
|
1254
|
-
{
|
|
1255
|
-
...menuProps,
|
|
1256
|
-
trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsxs8(
|
|
1257
|
-
"button",
|
|
1258
|
-
{
|
|
1259
|
-
ref,
|
|
1260
|
-
className: clsx9(
|
|
1261
|
-
"btn-md justify-between w-full border-2",
|
|
1262
|
-
"not-disabled:bg-input-background not-disabled:text-input-text not-disabled:hover:border-primary",
|
|
1263
|
-
"disabled:bg-disabled-background disabled:text-disabled-text disabled:border-disabled-border",
|
|
1264
|
-
triggerClassName
|
|
1265
|
-
),
|
|
1266
|
-
onClick: toggleOpen,
|
|
1267
|
-
disabled,
|
|
1268
|
-
children: [
|
|
1269
|
-
!isShowingHint && /* @__PURE__ */ jsx10("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
|
|
1270
|
-
isShowingHint && /* @__PURE__ */ jsx10("span", { className: clsx9("textstyle-description", hintTextClassName), children: hintText }),
|
|
1271
|
-
/* @__PURE__ */ jsx10(ExpansionIcon, { isExpanded: isOpen })
|
|
1272
|
-
]
|
|
1273
|
-
}
|
|
1274
|
-
),
|
|
1275
|
-
menuClassName: clsx9("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
|
|
1276
|
-
children: (bag) => {
|
|
1277
|
-
const { close } = bag;
|
|
1278
|
-
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1279
|
-
!searchOptions?.disabled && /* @__PURE__ */ jsx10(
|
|
1280
|
-
SearchBar,
|
|
1281
|
-
{
|
|
1282
|
-
value: search,
|
|
1283
|
-
onChangeText: setSearch,
|
|
1284
|
-
autoFocus: true
|
|
1285
|
-
}
|
|
1286
|
-
),
|
|
1287
|
-
/* @__PURE__ */ jsxs8("div", { className: "flex-col-2 overflow-y-auto", children: [
|
|
1288
|
-
result.map((option, index) => /* @__PURE__ */ jsx10(
|
|
1289
|
-
ListTile,
|
|
1290
|
-
{
|
|
1291
|
-
isSelected: option === selectedOption,
|
|
1292
|
-
title: option.label,
|
|
1293
|
-
onClick: () => {
|
|
1294
|
-
onChange(option.value);
|
|
1295
|
-
close();
|
|
1296
|
-
},
|
|
1297
|
-
disabled: option.disabled
|
|
1298
|
-
},
|
|
1299
|
-
index
|
|
1300
|
-
)),
|
|
1301
|
-
additionalItems && additionalItems({ ...bag, search, selected: value })
|
|
1302
|
-
] })
|
|
1303
|
-
] });
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
)
|
|
1529
|
+
);
|
|
1530
|
+
});
|
|
1531
|
+
var MultiSelectChipDisplay = forwardRef3(function MultiSelectChipDisplay2({
|
|
1532
|
+
children,
|
|
1533
|
+
contentPanelProps,
|
|
1534
|
+
chipDisplayProps,
|
|
1535
|
+
...props
|
|
1536
|
+
}, ref) {
|
|
1537
|
+
return /* @__PURE__ */ jsxs5(SelectRoot, { ...props, isMultiSelect: true, children: [
|
|
1538
|
+
/* @__PURE__ */ jsx6(SelectChipDisplay, { ref, ...chipDisplayProps }),
|
|
1539
|
+
/* @__PURE__ */ jsx6(SelectContent, { ...contentPanelProps, children })
|
|
1307
1540
|
] });
|
|
1308
|
-
};
|
|
1541
|
+
});
|
|
1542
|
+
var MultiSelectChipDisplayUncontrolled = forwardRef3(function MultiSelectChipDisplayUncontrolled2({
|
|
1543
|
+
values: initialValues,
|
|
1544
|
+
onValuesChanged,
|
|
1545
|
+
...props
|
|
1546
|
+
}, ref) {
|
|
1547
|
+
const [values, setValues] = useState7(initialValues);
|
|
1548
|
+
useEffect6(() => {
|
|
1549
|
+
setValues(initialValues);
|
|
1550
|
+
}, [initialValues]);
|
|
1551
|
+
return /* @__PURE__ */ jsx6(
|
|
1552
|
+
MultiSelectChipDisplay,
|
|
1553
|
+
{
|
|
1554
|
+
...props,
|
|
1555
|
+
ref,
|
|
1556
|
+
values,
|
|
1557
|
+
onValuesChanged: (value) => {
|
|
1558
|
+
setValues(value);
|
|
1559
|
+
onValuesChanged?.(value);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
);
|
|
1563
|
+
});
|
|
1309
1564
|
|
|
1310
1565
|
// src/components/properties/SelectProperty.tsx
|
|
1311
|
-
import { jsx as
|
|
1566
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1312
1567
|
var SingleSelectProperty = ({
|
|
1313
|
-
overwriteTranslation,
|
|
1314
1568
|
value,
|
|
1315
1569
|
options,
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
softRequired,
|
|
1319
|
-
onRemove,
|
|
1320
|
-
onAddNew,
|
|
1321
|
-
...selectProps
|
|
1570
|
+
onValueChanged,
|
|
1571
|
+
...props
|
|
1322
1572
|
}) => {
|
|
1323
|
-
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1324
1573
|
const hasValue = value !== void 0;
|
|
1325
|
-
return /* @__PURE__ */
|
|
1574
|
+
return /* @__PURE__ */ jsx7(
|
|
1326
1575
|
PropertyBase,
|
|
1327
1576
|
{
|
|
1328
|
-
|
|
1329
|
-
onRemove,
|
|
1330
|
-
readOnly,
|
|
1331
|
-
softRequired,
|
|
1577
|
+
...props,
|
|
1332
1578
|
hasValue,
|
|
1333
|
-
icon: /* @__PURE__ */
|
|
1334
|
-
input: ({ softRequired
|
|
1579
|
+
icon: /* @__PURE__ */ jsx7(List, { size: 24 }),
|
|
1580
|
+
input: ({ softRequired }) => /* @__PURE__ */ jsx7(
|
|
1335
1581
|
Select,
|
|
1336
1582
|
{
|
|
1337
|
-
...selectProps,
|
|
1338
1583
|
value,
|
|
1339
|
-
|
|
1340
|
-
disabled: readOnly,
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
sortingFunction: (a, b) => a.value.localeCompare(b.value),
|
|
1345
|
-
...selectProps?.searchOptions
|
|
1346
|
-
},
|
|
1347
|
-
additionalItems: ({ close, search }) => {
|
|
1348
|
-
if (!onAddNew && !search.trim()) {
|
|
1349
|
-
return void 0;
|
|
1350
|
-
}
|
|
1351
|
-
return /* @__PURE__ */ jsx11(
|
|
1352
|
-
ListTile,
|
|
1584
|
+
onValueChanged,
|
|
1585
|
+
disabled: props.readOnly,
|
|
1586
|
+
buttonProps: {
|
|
1587
|
+
className: clsx6(
|
|
1588
|
+
"border-none w-full",
|
|
1353
1589
|
{
|
|
1354
|
-
|
|
1355
|
-
title: `${translation("add")} ${search.trim()}`,
|
|
1356
|
-
onClick: () => {
|
|
1357
|
-
onAddNew(search);
|
|
1358
|
-
close();
|
|
1359
|
-
},
|
|
1360
|
-
disabled: options.some((value2) => value2.value === search.trim())
|
|
1590
|
+
"!bg-warning !text-surface-warning": softRequired && !hasValue
|
|
1361
1591
|
}
|
|
1362
|
-
)
|
|
1592
|
+
)
|
|
1363
1593
|
},
|
|
1364
|
-
|
|
1365
|
-
"!border-none",
|
|
1366
|
-
{
|
|
1367
|
-
"!bg-warning !text-surface-warning": softRequired2 && !hasValue,
|
|
1368
|
-
"!bg-property-title-background": !softRequired2 || hasValue
|
|
1369
|
-
}
|
|
1370
|
-
),
|
|
1371
|
-
hintTextClassName: softRequired2 && !hasValue ? "text-surface-warning" : void 0
|
|
1594
|
+
children: options.map((value2) => /* @__PURE__ */ jsx7(SelectOption, { value: value2 }, value2))
|
|
1372
1595
|
}
|
|
1373
1596
|
)
|
|
1374
1597
|
}
|