@helpwave/hightide 0.0.18 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -2
- package/dist/coloring/shading.cjs +556 -0
- package/dist/coloring/shading.cjs.map +1 -0
- package/dist/coloring/{shading.d.mts → shading.d.cts} +1 -1
- package/dist/coloring/shading.js +476 -37
- package/dist/coloring/shading.js.map +1 -1
- package/dist/coloring/types.cjs +31 -0
- package/dist/coloring/{types.mjs.map → types.cjs.map} +1 -1
- package/dist/coloring/types.js +2 -27
- package/dist/coloring/types.js.map +1 -1
- package/dist/components/{HelpwaveBadge.js → branding/HelpwaveBadge.cjs} +65 -33
- package/dist/components/branding/HelpwaveBadge.cjs.map +1 -0
- package/dist/components/branding/HelpwaveBadge.js +123 -0
- package/dist/components/branding/HelpwaveBadge.js.map +1 -0
- package/dist/components/date/{DatePicker.mjs → DatePicker.cjs} +158 -94
- package/dist/components/date/DatePicker.cjs.map +1 -0
- package/dist/components/date/{DatePicker.d.mts → DatePicker.d.cts} +7 -8
- package/dist/components/date/DatePicker.d.ts +4 -5
- package/dist/components/date/DatePicker.js +121 -129
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/{DayPicker.mjs → DayPicker.cjs} +77 -24
- package/dist/components/date/DayPicker.cjs.map +1 -0
- package/dist/components/date/{DayPicker.d.mts → DayPicker.d.cts} +3 -3
- package/dist/components/date/DayPicker.d.ts +2 -2
- package/dist/components/date/DayPicker.js +38 -61
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/{TimeDisplay.js → date/TimeDisplay.cjs} +24 -9
- package/dist/components/date/TimeDisplay.cjs.map +1 -0
- package/dist/components/{TimeDisplay.d.mts → date/TimeDisplay.d.cts} +2 -3
- package/dist/components/{TimeDisplay.d.ts → date/TimeDisplay.d.ts} +2 -3
- package/dist/components/{TimeDisplay.mjs → date/TimeDisplay.js} +23 -8
- package/dist/components/date/TimeDisplay.js.map +1 -0
- package/dist/components/date/{TimePicker.mjs → TimePicker.cjs} +62 -26
- package/dist/components/date/TimePicker.cjs.map +1 -0
- package/dist/components/date/{TimePicker.d.mts → TimePicker.d.cts} +2 -2
- package/dist/components/date/TimePicker.d.ts +2 -2
- package/dist/components/date/TimePicker.js +25 -61
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/{YearMonthPicker.mjs → YearMonthPicker.cjs} +93 -42
- package/dist/components/date/YearMonthPicker.cjs.map +1 -0
- package/dist/components/date/{YearMonthPicker.d.mts → YearMonthPicker.d.cts} +2 -2
- package/dist/components/date/YearMonthPicker.d.ts +2 -2
- package/dist/components/date/YearMonthPicker.js +56 -77
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/{AvatarGroup.js → icons-and-geometry/Avatar.cjs} +23 -19
- package/dist/components/icons-and-geometry/Avatar.cjs.map +1 -0
- package/dist/components/icons-and-geometry/Avatar.d.cts +30 -0
- package/dist/components/icons-and-geometry/Avatar.d.ts +30 -0
- package/dist/components/{AvatarGroup.mjs → icons-and-geometry/Avatar.js} +13 -10
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -0
- package/dist/components/{Circle.js → icons-and-geometry/Circle.cjs} +3 -3
- package/dist/components/icons-and-geometry/Circle.cjs.map +1 -0
- package/dist/components/{Circle.mjs → icons-and-geometry/Circle.js} +2 -2
- package/dist/components/icons-and-geometry/Circle.js.map +1 -0
- package/dist/components/{icons/Helpwave.js → icons-and-geometry/Helpwave.cjs} +38 -6
- package/dist/components/icons-and-geometry/Helpwave.cjs.map +1 -0
- package/dist/components/icons-and-geometry/Helpwave.js +75 -0
- package/dist/components/icons-and-geometry/Helpwave.js.map +1 -0
- package/dist/components/{Ring.js → icons-and-geometry/Ring.cjs} +6 -6
- package/dist/components/icons-and-geometry/Ring.cjs.map +1 -0
- package/dist/components/{Ring.mjs → icons-and-geometry/Ring.js} +4 -4
- package/dist/components/icons-and-geometry/Ring.js.map +1 -0
- package/dist/components/{icons/Tag.js → icons-and-geometry/Tag.cjs} +3 -3
- package/dist/components/icons-and-geometry/Tag.cjs.map +1 -0
- package/dist/components/{icons/Tag.mjs → icons-and-geometry/Tag.js} +2 -2
- package/dist/components/icons-and-geometry/Tag.js.map +1 -0
- package/dist/components/{BreadCrumb.js → layout-and-navigation/BreadCrumb.cjs} +12 -5
- package/dist/components/layout-and-navigation/BreadCrumb.cjs.map +1 -0
- package/dist/components/{BreadCrumb.mjs → layout-and-navigation/BreadCrumb.js} +10 -3
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -0
- package/dist/components/{layout/Carousel.js → layout-and-navigation/Carousel.cjs} +4 -4
- package/dist/components/layout-and-navigation/Carousel.cjs.map +1 -0
- package/dist/components/{layout/Carousel.mjs → layout-and-navigation/Carousel.js} +4 -4
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -0
- package/dist/components/{ChipList.js → layout-and-navigation/Chip.cjs} +6 -6
- package/dist/components/layout-and-navigation/Chip.cjs.map +1 -0
- package/dist/components/{ChipList.mjs → layout-and-navigation/Chip.js} +2 -2
- package/dist/components/layout-and-navigation/Chip.js.map +1 -0
- package/dist/components/{layout/DividerInserter.js → layout-and-navigation/DividerInserter.cjs} +3 -3
- package/dist/components/layout-and-navigation/DividerInserter.cjs.map +1 -0
- package/dist/components/{layout/DividerInserter.mjs → layout-and-navigation/DividerInserter.js} +2 -2
- package/dist/components/layout-and-navigation/DividerInserter.js.map +1 -0
- package/dist/components/{Expandable.js → layout-and-navigation/Expandable.cjs} +3 -3
- package/dist/components/layout-and-navigation/Expandable.cjs.map +1 -0
- package/dist/components/{Expandable.mjs → layout-and-navigation/Expandable.js} +2 -2
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -0
- package/dist/components/{layout/FAQSection.js → layout-and-navigation/FAQSection.cjs} +7 -7
- package/dist/components/layout-and-navigation/FAQSection.cjs.map +1 -0
- package/dist/components/{layout/FAQSection.d.mts → layout-and-navigation/FAQSection.d.cts} +1 -1
- package/dist/components/{layout → layout-and-navigation}/FAQSection.d.ts +1 -1
- package/dist/components/{layout/FAQSection.mjs → layout-and-navigation/FAQSection.js} +5 -5
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -0
- package/dist/components/{MarkdownInterpreter.js → layout-and-navigation/MarkdownInterpreter.cjs} +2 -2
- package/dist/components/layout-and-navigation/MarkdownInterpreter.cjs.map +1 -0
- package/dist/components/{MarkdownInterpreter.mjs → layout-and-navigation/MarkdownInterpreter.js} +2 -2
- package/dist/components/layout-and-navigation/MarkdownInterpreter.js.map +1 -0
- package/dist/components/layout-and-navigation/Overlay.cjs +467 -0
- package/dist/components/layout-and-navigation/Overlay.cjs.map +1 -0
- package/dist/components/layout-and-navigation/Overlay.d.cts +63 -0
- package/dist/components/layout-and-navigation/Overlay.d.ts +63 -0
- package/dist/components/layout-and-navigation/Overlay.js +429 -0
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -0
- package/dist/components/{Pagination.js → layout-and-navigation/Pagination.cjs} +25 -10
- package/dist/components/layout-and-navigation/Pagination.cjs.map +1 -0
- package/dist/components/{Pagination.d.mts → layout-and-navigation/Pagination.d.cts} +2 -3
- package/dist/components/{Pagination.d.ts → layout-and-navigation/Pagination.d.ts} +2 -3
- package/dist/components/{Pagination.mjs → layout-and-navigation/Pagination.js} +25 -10
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -0
- package/dist/components/{SearchableList.js → layout-and-navigation/SearchableList.cjs} +51 -34
- package/dist/components/layout-and-navigation/SearchableList.cjs.map +1 -0
- package/dist/components/{SearchableList.d.mts → layout-and-navigation/SearchableList.d.cts} +2 -2
- package/dist/components/{SearchableList.d.ts → layout-and-navigation/SearchableList.d.ts} +2 -2
- package/dist/components/{SearchableList.mjs → layout-and-navigation/SearchableList.js} +52 -40
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -0
- package/dist/components/{StepperBar.js → layout-and-navigation/StepperBar.cjs} +42 -16
- package/dist/components/layout-and-navigation/StepperBar.cjs.map +1 -0
- package/dist/components/{StepperBar.d.mts → layout-and-navigation/StepperBar.d.cts} +2 -3
- package/dist/components/{StepperBar.d.ts → layout-and-navigation/StepperBar.d.ts} +2 -3
- package/dist/components/{StepperBar.mjs → layout-and-navigation/StepperBar.js} +40 -14
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -0
- package/dist/components/{Table.js → layout-and-navigation/Table.cjs} +176 -40
- package/dist/components/layout-and-navigation/Table.cjs.map +1 -0
- package/dist/components/{Table.d.mts → layout-and-navigation/Table.d.cts} +10 -1
- package/dist/components/{Table.d.ts → layout-and-navigation/Table.d.ts} +10 -1
- package/dist/components/{Table.mjs → layout-and-navigation/Table.js} +175 -40
- package/dist/components/layout-and-navigation/Table.js.map +1 -0
- package/dist/components/{TextImage.js → layout-and-navigation/TextImage.cjs} +25 -10
- package/dist/components/layout-and-navigation/TextImage.cjs.map +1 -0
- package/dist/components/{TextImage.d.mts → layout-and-navigation/TextImage.d.cts} +2 -3
- package/dist/components/{TextImage.d.ts → layout-and-navigation/TextImage.d.ts} +2 -3
- package/dist/components/{TextImage.mjs → layout-and-navigation/TextImage.js} +23 -8
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -0
- package/dist/components/{layout/Tile.js → layout-and-navigation/Tile.cjs} +4 -4
- package/dist/components/layout-and-navigation/Tile.cjs.map +1 -0
- package/dist/components/{layout/Tile.mjs → layout-and-navigation/Tile.js} +2 -2
- package/dist/components/layout-and-navigation/Tile.js.map +1 -0
- package/dist/components/{VerticalDivider.js → layout-and-navigation/VerticalDivider.cjs} +2 -2
- package/dist/components/layout-and-navigation/VerticalDivider.cjs.map +1 -0
- package/dist/components/{VerticalDivider.mjs → layout-and-navigation/VerticalDivider.js} +2 -2
- package/dist/components/layout-and-navigation/VerticalDivider.js.map +1 -0
- package/dist/components/{ErrorComponent.js → loading-states/ErrorComponent.cjs} +25 -10
- package/dist/components/loading-states/ErrorComponent.cjs.map +1 -0
- package/dist/components/{ErrorComponent.d.mts → loading-states/ErrorComponent.d.cts} +2 -3
- package/dist/components/{ErrorComponent.d.ts → loading-states/ErrorComponent.d.ts} +2 -3
- package/dist/components/{ErrorComponent.mjs → loading-states/ErrorComponent.js} +24 -9
- package/dist/components/loading-states/ErrorComponent.js.map +1 -0
- package/dist/components/{LoadingAndErrorComponent.js → loading-states/LoadingAndErrorComponent.cjs} +67 -18
- package/dist/components/loading-states/LoadingAndErrorComponent.cjs.map +1 -0
- package/dist/components/{LoadingAndErrorComponent.d.mts → loading-states/LoadingAndErrorComponent.d.cts} +6 -6
- package/dist/components/{LoadingAndErrorComponent.d.ts → loading-states/LoadingAndErrorComponent.d.ts} +4 -4
- package/dist/components/{LoadingAndErrorComponent.mjs → loading-states/LoadingAndErrorComponent.js} +66 -17
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -0
- package/dist/components/{LoadingAnimation.js → loading-states/LoadingAnimation.cjs} +64 -15
- package/dist/components/loading-states/LoadingAnimation.cjs.map +1 -0
- package/dist/components/{LoadingAnimation.d.mts → loading-states/LoadingAnimation.d.cts} +2 -3
- package/dist/components/{LoadingAnimation.d.ts → loading-states/LoadingAnimation.d.ts} +2 -3
- package/dist/components/{LoadingAnimation.mjs → loading-states/LoadingAnimation.js} +63 -14
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -0
- package/dist/components/{LoadingButton.js → loading-states/LoadingButton.cjs} +101 -58
- package/dist/components/loading-states/LoadingButton.cjs.map +1 -0
- package/dist/components/{LoadingButton.d.mts → loading-states/LoadingButton.d.cts} +1 -1
- package/dist/components/{LoadingButton.d.ts → loading-states/LoadingButton.d.ts} +1 -1
- package/dist/components/{LoadingButton.mjs → loading-states/LoadingButton.js} +100 -57
- package/dist/components/loading-states/LoadingButton.js.map +1 -0
- package/dist/components/{ProgressIndicator.js → loading-states/ProgressIndicator.cjs} +2 -2
- package/dist/components/loading-states/ProgressIndicator.cjs.map +1 -0
- package/dist/components/{ProgressIndicator.mjs → loading-states/ProgressIndicator.js} +2 -2
- package/dist/components/loading-states/ProgressIndicator.js.map +1 -0
- package/dist/components/modals/ConfirmDialog.cjs +353 -0
- package/dist/components/modals/ConfirmDialog.cjs.map +1 -0
- package/dist/components/modals/{ConfirmDialog.d.mts → ConfirmDialog.d.cts} +6 -6
- package/dist/components/modals/ConfirmDialog.d.ts +6 -6
- package/dist/components/modals/ConfirmDialog.js +157 -266
- package/dist/components/modals/ConfirmDialog.js.map +1 -1
- package/dist/components/modals/{DiscardChangesDialog.js → DiscardChangesModal.cjs} +213 -117
- package/dist/components/modals/DiscardChangesModal.cjs.map +1 -0
- package/dist/components/modals/DiscardChangesModal.d.cts +23 -0
- package/dist/components/modals/DiscardChangesModal.d.ts +23 -0
- package/dist/components/modals/{DiscardChangesDialog.mjs → DiscardChangesModal.js} +202 -106
- package/dist/components/modals/DiscardChangesModal.js.map +1 -0
- package/dist/components/modals/InputModal.cjs +533 -0
- package/dist/components/modals/InputModal.cjs.map +1 -0
- package/dist/components/modals/{InputModal.d.mts → InputModal.d.cts} +7 -7
- package/dist/components/modals/InputModal.d.ts +6 -6
- package/dist/components/modals/InputModal.js +197 -299
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.cjs +667 -0
- package/dist/components/modals/LanguageModal.cjs.map +1 -0
- package/dist/components/modals/LanguageModal.d.cts +20 -0
- package/dist/components/modals/LanguageModal.d.ts +7 -8
- package/dist/components/modals/LanguageModal.js +308 -204
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.cjs +694 -0
- package/dist/components/modals/ThemeModal.cjs.map +1 -0
- package/dist/components/modals/ThemeModal.d.cts +21 -0
- package/dist/components/modals/ThemeModal.d.ts +21 -0
- package/dist/components/modals/ThemeModal.js +657 -0
- package/dist/components/modals/ThemeModal.js.map +1 -0
- package/dist/components/properties/CheckboxProperty.cjs +362 -0
- package/dist/components/properties/CheckboxProperty.cjs.map +1 -0
- package/dist/components/properties/{CheckboxProperty.d.mts → CheckboxProperty.d.cts} +3 -3
- package/dist/components/properties/CheckboxProperty.d.ts +2 -2
- package/dist/components/properties/CheckboxProperty.js +94 -93
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.cjs +451 -0
- package/dist/components/properties/DateProperty.cjs.map +1 -0
- package/dist/components/properties/{DateProperty.d.mts → DateProperty.d.cts} +3 -3
- package/dist/components/properties/DateProperty.d.ts +2 -2
- package/dist/components/properties/DateProperty.js +110 -116
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/{MultiSelectProperty.mjs → MultiSelectProperty.cjs} +216 -155
- package/dist/components/properties/MultiSelectProperty.cjs.map +1 -0
- package/dist/components/properties/{MultiSelectProperty.d.mts → MultiSelectProperty.d.cts} +5 -5
- package/dist/components/properties/MultiSelectProperty.d.ts +4 -4
- package/dist/components/properties/MultiSelectProperty.js +180 -184
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.cjs +459 -0
- package/dist/components/properties/NumberProperty.cjs.map +1 -0
- package/dist/components/properties/{NumberProperty.d.mts → NumberProperty.d.cts} +3 -3
- package/dist/components/properties/NumberProperty.d.ts +2 -2
- package/dist/components/properties/NumberProperty.js +109 -116
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/PropertyBase.cjs +223 -0
- package/dist/components/properties/PropertyBase.cjs.map +1 -0
- package/dist/components/properties/{PropertyBase.d.mts → PropertyBase.d.cts} +2 -2
- package/dist/components/properties/PropertyBase.d.ts +2 -2
- package/dist/components/properties/PropertyBase.js +60 -69
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/{SelectProperty.mjs → SelectProperty.cjs} +251 -199
- package/dist/components/properties/SelectProperty.cjs.map +1 -0
- package/dist/components/properties/{SelectProperty.d.mts → SelectProperty.d.cts} +5 -6
- package/dist/components/properties/SelectProperty.d.ts +4 -5
- package/dist/components/properties/SelectProperty.js +215 -228
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.cjs +428 -0
- package/dist/components/properties/TextProperty.cjs.map +1 -0
- package/dist/components/properties/{TextProperty.d.mts → TextProperty.d.cts} +3 -3
- package/dist/components/properties/TextProperty.d.ts +2 -2
- package/dist/components/properties/TextProperty.js +134 -121
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/{Button.js → user-action/Button.cjs} +70 -12
- package/dist/components/user-action/Button.cjs.map +1 -0
- package/dist/components/{Button.d.mts → user-action/Button.d.cts} +32 -5
- package/dist/components/{Button.d.ts → user-action/Button.d.ts} +32 -5
- package/dist/components/{Button.mjs → user-action/Button.js} +66 -10
- package/dist/components/user-action/Button.js.map +1 -0
- package/dist/components/{user-input/Checkbox.js → user-action/Checkbox.cjs} +26 -16
- package/dist/components/user-action/Checkbox.cjs.map +1 -0
- package/dist/components/{user-input/Checkbox.d.mts → user-action/Checkbox.d.cts} +5 -5
- package/dist/components/{user-input → user-action}/Checkbox.d.ts +4 -4
- package/dist/components/{user-input/Checkbox.mjs → user-action/Checkbox.js} +24 -14
- package/dist/components/user-action/Checkbox.js.map +1 -0
- package/dist/components/{user-input/DateAndTimePicker.js → user-action/DateAndTimePicker.cjs} +51 -23
- package/dist/components/user-action/DateAndTimePicker.cjs.map +1 -0
- package/dist/components/{user-input/DateAndTimePicker.d.mts → user-action/DateAndTimePicker.d.cts} +7 -8
- package/dist/components/{user-input → user-action}/DateAndTimePicker.d.ts +2 -3
- package/dist/components/{user-input/DateAndTimePicker.mjs → user-action/DateAndTimePicker.js} +44 -16
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -0
- package/dist/components/{user-input/Input.js → user-action/Input.cjs} +35 -34
- package/dist/components/user-action/Input.cjs.map +1 -0
- package/dist/components/{user-input/Input.d.mts → user-action/Input.d.cts} +9 -16
- package/dist/components/{user-input → user-action}/Input.d.ts +8 -15
- package/dist/components/{user-input/Input.mjs → user-action/Input.js} +35 -39
- package/dist/components/user-action/Input.js.map +1 -0
- package/dist/components/{user-input/Label.js → user-action/Label.cjs} +15 -3
- package/dist/components/user-action/Label.cjs.map +1 -0
- package/dist/components/{user-input/Label.d.mts → user-action/Label.d.cts} +1 -1
- package/dist/components/{user-input → user-action}/Label.d.ts +1 -1
- package/dist/components/{user-input/Label.mjs → user-action/Label.js} +5 -3
- package/dist/components/user-action/Label.js.map +1 -0
- package/dist/components/{user-input/Menu.js → user-action/Menu.cjs} +4 -4
- package/dist/components/user-action/Menu.cjs.map +1 -0
- package/dist/components/{user-input/Menu.mjs → user-action/Menu.js} +3 -3
- package/dist/components/user-action/Menu.js.map +1 -0
- package/dist/components/{user-input/MultiSelect.js → user-action/MultiSelect.cjs} +76 -51
- package/dist/components/user-action/MultiSelect.cjs.map +1 -0
- package/dist/components/{user-input/MultiSelect.d.mts → user-action/MultiSelect.d.cts} +3 -3
- package/dist/components/{user-input → user-action}/MultiSelect.d.ts +2 -2
- package/dist/components/{user-input/MultiSelect.mjs → user-action/MultiSelect.js} +75 -55
- package/dist/components/user-action/MultiSelect.js.map +1 -0
- package/dist/components/{user-input/ScrollPicker.js → user-action/ScrollPicker.cjs} +4 -4
- package/dist/components/user-action/ScrollPicker.cjs.map +1 -0
- package/dist/components/{user-input/ScrollPicker.mjs → user-action/ScrollPicker.js} +3 -3
- package/dist/components/user-action/ScrollPicker.js.map +1 -0
- package/dist/components/{user-input/SearchableSelect.js → user-action/Select.cjs} +181 -152
- package/dist/components/user-action/Select.cjs.map +1 -0
- package/dist/components/user-action/Select.d.cts +49 -0
- package/dist/components/user-action/Select.d.ts +49 -0
- package/dist/components/{user-input/SearchableSelect.mjs → user-action/Select.js} +167 -145
- package/dist/components/user-action/Select.js.map +1 -0
- package/dist/components/{user-input/Textarea.js → user-action/Textarea.cjs} +80 -35
- package/dist/components/user-action/Textarea.cjs.map +1 -0
- package/dist/components/user-action/Textarea.d.cts +28 -0
- package/dist/components/{user-input → user-action}/Textarea.d.ts +9 -5
- package/dist/components/user-action/Textarea.js +163 -0
- package/dist/components/user-action/Textarea.js.map +1 -0
- package/dist/components/{user-input/ToggleableInput.js → user-action/ToggleableInput.cjs} +9 -15
- package/dist/components/user-action/ToggleableInput.cjs.map +1 -0
- package/dist/components/{user-input/ToggleableInput.mjs → user-action/ToggleableInput.js} +8 -14
- package/dist/components/user-action/ToggleableInput.js.map +1 -0
- package/dist/components/{Tooltip.js → user-action/Tooltip.cjs} +13 -9
- package/dist/components/user-action/Tooltip.cjs.map +1 -0
- package/dist/components/{Tooltip.d.mts → user-action/Tooltip.d.cts} +1 -1
- package/dist/components/{Tooltip.d.ts → user-action/Tooltip.d.ts} +1 -1
- package/dist/components/{Tooltip.mjs → user-action/Tooltip.js} +12 -8
- package/dist/components/user-action/Tooltip.js.map +1 -0
- package/dist/css/globals.css +178 -126
- package/dist/css/uncompiled/globals.css +65 -29
- package/dist/hooks/useHoverState.cjs +72 -0
- package/dist/hooks/{useHoverState.mjs.map → useHoverState.cjs.map} +1 -1
- package/dist/hooks/useHoverState.js +7 -32
- package/dist/hooks/useHoverState.js.map +1 -1
- package/dist/hooks/useLocalStorage.cjs +83 -0
- package/dist/hooks/useLocalStorage.cjs.map +1 -0
- package/dist/hooks/useLocalStorage.js +9 -34
- package/dist/hooks/useLocalStorage.js.map +1 -1
- package/dist/hooks/useOutsideClick.cjs +48 -0
- package/dist/hooks/{useOutsideClick.mjs.map → useOutsideClick.cjs.map} +1 -1
- package/dist/hooks/useOutsideClick.js +4 -29
- package/dist/hooks/useOutsideClick.js.map +1 -1
- package/dist/hooks/useSaveDelay.cjs +68 -0
- package/dist/hooks/{useSaveDelay.mjs.map → useSaveDelay.cjs.map} +1 -1
- package/dist/hooks/useSaveDelay.js +6 -31
- package/dist/hooks/useSaveDelay.js.map +1 -1
- package/dist/{index.mjs → index.cjs} +4008 -3882
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +82 -0
- package/dist/index.d.ts +49 -55
- package/dist/index.js +3825 -4056
- package/dist/index.js.map +1 -1
- package/dist/{hooks/useLanguage.js → localization/LanguageProvider.cjs} +30 -26
- package/dist/localization/LanguageProvider.cjs.map +1 -0
- package/dist/localization/LanguageProvider.d.cts +18 -0
- package/dist/localization/LanguageProvider.d.ts +18 -0
- package/dist/{hooks/useLanguage.mjs → localization/LanguageProvider.js} +26 -19
- package/dist/localization/LanguageProvider.js.map +1 -0
- package/dist/{hooks/useTranslation.js → localization/useTranslation.cjs} +23 -8
- package/dist/localization/useTranslation.cjs.map +1 -0
- package/dist/{hooks/useTranslation.d.mts → localization/useTranslation.d.cts} +5 -7
- package/dist/{hooks → localization}/useTranslation.d.ts +5 -7
- package/dist/{hooks/useTranslation.mjs → localization/useTranslation.js} +22 -7
- package/dist/localization/useTranslation.js.map +1 -0
- package/dist/localization/util.cjs +41 -0
- package/dist/localization/util.cjs.map +1 -0
- package/dist/localization/util.d.cts +18 -0
- package/dist/localization/util.d.ts +18 -0
- package/dist/localization/util.js +16 -0
- package/dist/localization/util.js.map +1 -0
- package/dist/{hooks/useTheme.js → theming/useTheme.cjs} +19 -11
- package/dist/theming/useTheme.cjs.map +1 -0
- package/dist/{hooks/useTheme.d.mts → theming/useTheme.d.cts} +9 -5
- package/dist/{hooks → theming}/useTheme.d.ts +9 -5
- package/dist/{hooks/useTheme.mjs → theming/useTheme.js} +15 -7
- package/dist/theming/useTheme.js.map +1 -0
- package/dist/util/{array.mjs → array.cjs} +34 -3
- package/dist/util/array.cjs.map +1 -0
- package/dist/util/array.js +2 -33
- package/dist/util/array.js.map +1 -1
- package/dist/util/builder.cjs +34 -0
- package/dist/util/{builder.mjs.map → builder.cjs.map} +1 -1
- package/dist/util/builder.js +2 -27
- package/dist/util/builder.js.map +1 -1
- package/dist/util/{date.mjs → date.cjs} +41 -3
- package/dist/util/date.cjs.map +1 -0
- package/dist/util/date.js +2 -40
- package/dist/util/date.js.map +1 -1
- package/dist/util/easeFunctions.cjs +63 -0
- package/dist/util/easeFunctions.cjs.map +1 -0
- package/dist/util/easeFunctions.js +2 -29
- package/dist/util/easeFunctions.js.map +1 -1
- package/dist/util/emailValidation.cjs +33 -0
- package/dist/util/{emailValidation.mjs.map → emailValidation.cjs.map} +1 -1
- package/dist/util/emailValidation.js +2 -27
- package/dist/util/emailValidation.js.map +1 -1
- package/dist/util/{loopingArray.mjs → loopingArray.cjs} +28 -3
- package/dist/util/{loopingArray.mjs.map → loopingArray.cjs.map} +1 -1
- package/dist/util/loopingArray.js +2 -27
- package/dist/util/loopingArray.js.map +1 -1
- package/dist/util/math.cjs +33 -0
- package/dist/util/{math.mjs.map → math.cjs.map} +1 -1
- package/dist/util/math.js +2 -27
- package/dist/util/math.js.map +1 -1
- package/dist/util/news.cjs +77 -0
- package/dist/util/news.cjs.map +1 -0
- package/dist/util/{news.d.mts → news.d.cts} +11 -13
- package/dist/util/news.d.ts +11 -13
- package/dist/util/news.js +22 -49
- package/dist/util/news.js.map +1 -1
- package/dist/util/noop.cjs +31 -0
- package/dist/util/noop.cjs.map +1 -0
- package/dist/util/noop.js +2 -27
- package/dist/util/noop.js.map +1 -1
- package/dist/util/simpleSearch.cjs +54 -0
- package/dist/util/simpleSearch.cjs.map +1 -0
- package/dist/util/simpleSearch.js +2 -30
- package/dist/util/simpleSearch.js.map +1 -1
- package/dist/util/storage.cjs +64 -0
- package/dist/util/storage.cjs.map +1 -0
- package/dist/util/storage.js +2 -28
- package/dist/util/storage.js.map +1 -1
- package/dist/util/types.cjs +19 -0
- package/dist/util/types.cjs.map +1 -0
- package/dist/util/types.js +0 -18
- package/dist/util/types.js.map +1 -1
- package/package.json +9 -12
- package/dist/coloring/shading.mjs +0 -47
- package/dist/coloring/shading.mjs.map +0 -1
- package/dist/coloring/types.mjs +0 -6
- package/dist/components/Avatar.d.mts +0 -17
- package/dist/components/Avatar.d.ts +0 -17
- package/dist/components/Avatar.js +0 -85
- package/dist/components/Avatar.js.map +0 -1
- package/dist/components/Avatar.mjs +0 -48
- package/dist/components/Avatar.mjs.map +0 -1
- package/dist/components/AvatarGroup.d.mts +0 -14
- package/dist/components/AvatarGroup.d.ts +0 -14
- package/dist/components/AvatarGroup.js.map +0 -1
- package/dist/components/AvatarGroup.mjs.map +0 -1
- package/dist/components/BreadCrumb.js.map +0 -1
- package/dist/components/BreadCrumb.mjs.map +0 -1
- package/dist/components/Button.js.map +0 -1
- package/dist/components/Button.mjs.map +0 -1
- package/dist/components/ChipList.js.map +0 -1
- package/dist/components/ChipList.mjs.map +0 -1
- package/dist/components/Circle.js.map +0 -1
- package/dist/components/Circle.mjs.map +0 -1
- package/dist/components/ErrorComponent.js.map +0 -1
- package/dist/components/ErrorComponent.mjs.map +0 -1
- package/dist/components/Expandable.js.map +0 -1
- package/dist/components/Expandable.mjs.map +0 -1
- package/dist/components/HelpwaveBadge.js.map +0 -1
- package/dist/components/HelpwaveBadge.mjs +0 -91
- package/dist/components/HelpwaveBadge.mjs.map +0 -1
- package/dist/components/HideableContentSection.d.mts +0 -14
- package/dist/components/HideableContentSection.d.ts +0 -14
- package/dist/components/HideableContentSection.js +0 -70
- package/dist/components/HideableContentSection.js.map +0 -1
- package/dist/components/HideableContentSection.mjs +0 -35
- package/dist/components/HideableContentSection.mjs.map +0 -1
- package/dist/components/InputGroup.d.mts +0 -17
- package/dist/components/InputGroup.d.ts +0 -17
- package/dist/components/InputGroup.js +0 -97
- package/dist/components/InputGroup.js.map +0 -1
- package/dist/components/InputGroup.mjs +0 -62
- package/dist/components/InputGroup.mjs.map +0 -1
- package/dist/components/LoadingAndErrorComponent.js.map +0 -1
- package/dist/components/LoadingAndErrorComponent.mjs.map +0 -1
- package/dist/components/LoadingAnimation.js.map +0 -1
- package/dist/components/LoadingAnimation.mjs.map +0 -1
- package/dist/components/LoadingButton.js.map +0 -1
- package/dist/components/LoadingButton.mjs.map +0 -1
- package/dist/components/MarkdownInterpreter.js.map +0 -1
- package/dist/components/MarkdownInterpreter.mjs.map +0 -1
- package/dist/components/Pagination.js.map +0 -1
- package/dist/components/Pagination.mjs.map +0 -1
- package/dist/components/Profile.d.mts +0 -31
- package/dist/components/Profile.d.ts +0 -31
- package/dist/components/Profile.js +0 -197
- package/dist/components/Profile.js.map +0 -1
- package/dist/components/Profile.mjs +0 -162
- package/dist/components/Profile.mjs.map +0 -1
- package/dist/components/ProgressIndicator.js.map +0 -1
- package/dist/components/ProgressIndicator.mjs.map +0 -1
- package/dist/components/Ring.js.map +0 -1
- package/dist/components/Ring.mjs.map +0 -1
- package/dist/components/SearchableList.js.map +0 -1
- package/dist/components/SearchableList.mjs.map +0 -1
- package/dist/components/SortButton.d.mts +0 -15
- package/dist/components/SortButton.d.ts +0 -15
- package/dist/components/SortButton.js +0 -132
- package/dist/components/SortButton.js.map +0 -1
- package/dist/components/SortButton.mjs +0 -97
- package/dist/components/SortButton.mjs.map +0 -1
- package/dist/components/StepperBar.js.map +0 -1
- package/dist/components/StepperBar.mjs.map +0 -1
- package/dist/components/Table.js.map +0 -1
- package/dist/components/Table.mjs.map +0 -1
- package/dist/components/TechRadar.d.mts +0 -39
- package/dist/components/TechRadar.d.ts +0 -39
- package/dist/components/TechRadar.js +0 -243
- package/dist/components/TechRadar.js.map +0 -1
- package/dist/components/TechRadar.mjs +0 -208
- package/dist/components/TechRadar.mjs.map +0 -1
- package/dist/components/TextImage.js.map +0 -1
- package/dist/components/TextImage.mjs.map +0 -1
- package/dist/components/TimeDisplay.js.map +0 -1
- package/dist/components/TimeDisplay.mjs.map +0 -1
- package/dist/components/Tooltip.js.map +0 -1
- package/dist/components/Tooltip.mjs.map +0 -1
- package/dist/components/VerticalDivider.js.map +0 -1
- package/dist/components/VerticalDivider.mjs.map +0 -1
- package/dist/components/date/DatePicker.mjs.map +0 -1
- package/dist/components/date/DayPicker.mjs.map +0 -1
- package/dist/components/date/TimePicker.mjs.map +0 -1
- package/dist/components/date/YearMonthPicker.mjs.map +0 -1
- package/dist/components/icons/Helpwave.js.map +0 -1
- package/dist/components/icons/Helpwave.mjs +0 -43
- package/dist/components/icons/Helpwave.mjs.map +0 -1
- package/dist/components/icons/Tag.js.map +0 -1
- package/dist/components/icons/Tag.mjs.map +0 -1
- package/dist/components/layout/Carousel.js.map +0 -1
- package/dist/components/layout/Carousel.mjs.map +0 -1
- package/dist/components/layout/DividerInserter.js.map +0 -1
- package/dist/components/layout/DividerInserter.mjs.map +0 -1
- package/dist/components/layout/FAQSection.js.map +0 -1
- package/dist/components/layout/FAQSection.mjs.map +0 -1
- package/dist/components/layout/Tile.js.map +0 -1
- package/dist/components/layout/Tile.mjs.map +0 -1
- package/dist/components/modals/ConfirmDialog.mjs +0 -388
- package/dist/components/modals/ConfirmDialog.mjs.map +0 -1
- package/dist/components/modals/DiscardChangesDialog.d.mts +0 -23
- package/dist/components/modals/DiscardChangesDialog.d.ts +0 -23
- package/dist/components/modals/DiscardChangesDialog.js.map +0 -1
- package/dist/components/modals/DiscardChangesDialog.mjs.map +0 -1
- package/dist/components/modals/InputModal.mjs +0 -566
- package/dist/components/modals/InputModal.mjs.map +0 -1
- package/dist/components/modals/LanguageModal.d.mts +0 -21
- package/dist/components/modals/LanguageModal.mjs +0 -489
- package/dist/components/modals/LanguageModal.mjs.map +0 -1
- package/dist/components/modals/Modal.d.mts +0 -43
- package/dist/components/modals/Modal.d.ts +0 -43
- package/dist/components/modals/Modal.js +0 -286
- package/dist/components/modals/Modal.js.map +0 -1
- package/dist/components/modals/Modal.mjs +0 -249
- package/dist/components/modals/Modal.mjs.map +0 -1
- package/dist/components/modals/ModalRegister.d.mts +0 -16
- package/dist/components/modals/ModalRegister.d.ts +0 -16
- package/dist/components/modals/ModalRegister.js +0 -63
- package/dist/components/modals/ModalRegister.js.map +0 -1
- package/dist/components/modals/ModalRegister.mjs +0 -37
- package/dist/components/modals/ModalRegister.mjs.map +0 -1
- package/dist/components/properties/CheckboxProperty.mjs +0 -291
- package/dist/components/properties/CheckboxProperty.mjs.map +0 -1
- package/dist/components/properties/DateProperty.mjs +0 -392
- package/dist/components/properties/DateProperty.mjs.map +0 -1
- package/dist/components/properties/MultiSelectProperty.mjs.map +0 -1
- package/dist/components/properties/NumberProperty.mjs +0 -401
- package/dist/components/properties/NumberProperty.mjs.map +0 -1
- package/dist/components/properties/PropertyBase.mjs +0 -162
- package/dist/components/properties/PropertyBase.mjs.map +0 -1
- package/dist/components/properties/SelectProperty.mjs.map +0 -1
- package/dist/components/properties/TextProperty.mjs +0 -345
- package/dist/components/properties/TextProperty.mjs.map +0 -1
- package/dist/components/user-input/Checkbox.js.map +0 -1
- package/dist/components/user-input/Checkbox.mjs.map +0 -1
- package/dist/components/user-input/DateAndTimePicker.js.map +0 -1
- package/dist/components/user-input/DateAndTimePicker.mjs.map +0 -1
- package/dist/components/user-input/Input.js.map +0 -1
- package/dist/components/user-input/Input.mjs.map +0 -1
- package/dist/components/user-input/Label.js.map +0 -1
- package/dist/components/user-input/Label.mjs.map +0 -1
- package/dist/components/user-input/Menu.js.map +0 -1
- package/dist/components/user-input/Menu.mjs.map +0 -1
- package/dist/components/user-input/MultiSelect.js.map +0 -1
- package/dist/components/user-input/MultiSelect.mjs.map +0 -1
- package/dist/components/user-input/ScrollPicker.js.map +0 -1
- package/dist/components/user-input/ScrollPicker.mjs.map +0 -1
- package/dist/components/user-input/SearchableSelect.d.mts +0 -14
- package/dist/components/user-input/SearchableSelect.d.ts +0 -14
- package/dist/components/user-input/SearchableSelect.js.map +0 -1
- package/dist/components/user-input/SearchableSelect.mjs.map +0 -1
- package/dist/components/user-input/Select.d.mts +0 -36
- package/dist/components/user-input/Select.d.ts +0 -36
- package/dist/components/user-input/Select.js +0 -153
- package/dist/components/user-input/Select.js.map +0 -1
- package/dist/components/user-input/Select.mjs +0 -118
- package/dist/components/user-input/Select.mjs.map +0 -1
- package/dist/components/user-input/Textarea.d.mts +0 -24
- package/dist/components/user-input/Textarea.js.map +0 -1
- package/dist/components/user-input/Textarea.mjs +0 -119
- package/dist/components/user-input/Textarea.mjs.map +0 -1
- package/dist/components/user-input/ToggleableInput.js.map +0 -1
- package/dist/components/user-input/ToggleableInput.mjs.map +0 -1
- package/dist/hooks/useHoverState.mjs +0 -47
- package/dist/hooks/useLanguage.d.mts +0 -21
- package/dist/hooks/useLanguage.d.ts +0 -21
- package/dist/hooks/useLanguage.js.map +0 -1
- package/dist/hooks/useLanguage.mjs.map +0 -1
- package/dist/hooks/useLocalStorage.mjs +0 -58
- package/dist/hooks/useLocalStorage.mjs.map +0 -1
- package/dist/hooks/useOutsideClick.mjs +0 -23
- package/dist/hooks/useSaveDelay.mjs +0 -43
- package/dist/hooks/useTheme.js.map +0 -1
- package/dist/hooks/useTheme.mjs.map +0 -1
- package/dist/hooks/useTranslation.js.map +0 -1
- package/dist/hooks/useTranslation.mjs.map +0 -1
- package/dist/index.d.mts +0 -88
- package/dist/index.mjs.map +0 -1
- package/dist/util/array.mjs.map +0 -1
- package/dist/util/builder.mjs +0 -9
- package/dist/util/date.mjs.map +0 -1
- package/dist/util/easeFunctions.mjs +0 -36
- package/dist/util/easeFunctions.mjs.map +0 -1
- package/dist/util/emailValidation.mjs +0 -8
- package/dist/util/math.mjs +0 -8
- package/dist/util/news.mjs +0 -48
- package/dist/util/news.mjs.map +0 -1
- package/dist/util/noop.mjs +0 -6
- package/dist/util/noop.mjs.map +0 -1
- package/dist/util/simpleSearch.mjs +0 -26
- package/dist/util/simpleSearch.mjs.map +0 -1
- package/dist/util/storage.mjs +0 -38
- package/dist/util/storage.mjs.map +0 -1
- package/dist/util/types.mjs +0 -1
- package/dist/util/types.mjs.map +0 -1
- /package/dist/coloring/{types.d.mts → types.d.cts} +0 -0
- /package/dist/components/{HelpwaveBadge.d.mts → branding/HelpwaveBadge.d.cts} +0 -0
- /package/dist/components/{HelpwaveBadge.d.ts → branding/HelpwaveBadge.d.ts} +0 -0
- /package/dist/components/{Circle.d.mts → icons-and-geometry/Circle.d.cts} +0 -0
- /package/dist/components/{Circle.d.ts → icons-and-geometry/Circle.d.ts} +0 -0
- /package/dist/components/{icons/Helpwave.d.mts → icons-and-geometry/Helpwave.d.cts} +0 -0
- /package/dist/components/{icons → icons-and-geometry}/Helpwave.d.ts +0 -0
- /package/dist/components/{Ring.d.mts → icons-and-geometry/Ring.d.cts} +0 -0
- /package/dist/components/{Ring.d.ts → icons-and-geometry/Ring.d.ts} +0 -0
- /package/dist/components/{icons/Tag.d.mts → icons-and-geometry/Tag.d.cts} +0 -0
- /package/dist/components/{icons → icons-and-geometry}/Tag.d.ts +0 -0
- /package/dist/components/{BreadCrumb.d.mts → layout-and-navigation/BreadCrumb.d.cts} +0 -0
- /package/dist/components/{BreadCrumb.d.ts → layout-and-navigation/BreadCrumb.d.ts} +0 -0
- /package/dist/components/{layout/Carousel.d.mts → layout-and-navigation/Carousel.d.cts} +0 -0
- /package/dist/components/{layout → layout-and-navigation}/Carousel.d.ts +0 -0
- /package/dist/components/{ChipList.d.mts → layout-and-navigation/Chip.d.cts} +0 -0
- /package/dist/components/{ChipList.d.ts → layout-and-navigation/Chip.d.ts} +0 -0
- /package/dist/components/{layout/DividerInserter.d.mts → layout-and-navigation/DividerInserter.d.cts} +0 -0
- /package/dist/components/{layout → layout-and-navigation}/DividerInserter.d.ts +0 -0
- /package/dist/components/{Expandable.d.mts → layout-and-navigation/Expandable.d.cts} +0 -0
- /package/dist/components/{Expandable.d.ts → layout-and-navigation/Expandable.d.ts} +0 -0
- /package/dist/components/{MarkdownInterpreter.d.mts → layout-and-navigation/MarkdownInterpreter.d.cts} +0 -0
- /package/dist/components/{MarkdownInterpreter.d.ts → layout-and-navigation/MarkdownInterpreter.d.ts} +0 -0
- /package/dist/components/{layout/Tile.d.mts → layout-and-navigation/Tile.d.cts} +0 -0
- /package/dist/components/{layout → layout-and-navigation}/Tile.d.ts +0 -0
- /package/dist/components/{VerticalDivider.d.mts → layout-and-navigation/VerticalDivider.d.cts} +0 -0
- /package/dist/components/{VerticalDivider.d.ts → layout-and-navigation/VerticalDivider.d.ts} +0 -0
- /package/dist/components/{ProgressIndicator.d.mts → loading-states/ProgressIndicator.d.cts} +0 -0
- /package/dist/components/{ProgressIndicator.d.ts → loading-states/ProgressIndicator.d.ts} +0 -0
- /package/dist/components/{user-input/Menu.d.mts → user-action/Menu.d.cts} +0 -0
- /package/dist/components/{user-input → user-action}/Menu.d.ts +0 -0
- /package/dist/components/{user-input/ScrollPicker.d.mts → user-action/ScrollPicker.d.cts} +0 -0
- /package/dist/components/{user-input → user-action}/ScrollPicker.d.ts +0 -0
- /package/dist/components/{user-input/ToggleableInput.d.mts → user-action/ToggleableInput.d.cts} +0 -0
- /package/dist/components/{user-input → user-action}/ToggleableInput.d.ts +0 -0
- /package/dist/hooks/{useHoverState.d.mts → useHoverState.d.cts} +0 -0
- /package/dist/hooks/{useLocalStorage.d.mts → useLocalStorage.d.cts} +0 -0
- /package/dist/hooks/{useOutsideClick.d.mts → useOutsideClick.d.cts} +0 -0
- /package/dist/hooks/{useSaveDelay.d.mts → useSaveDelay.d.cts} +0 -0
- /package/dist/util/{array.d.mts → array.d.cts} +0 -0
- /package/dist/util/{builder.d.mts → builder.d.cts} +0 -0
- /package/dist/util/{date.d.mts → date.d.cts} +0 -0
- /package/dist/util/{easeFunctions.d.mts → easeFunctions.d.cts} +0 -0
- /package/dist/util/{emailValidation.d.mts → emailValidation.d.cts} +0 -0
- /package/dist/util/{loopingArray.d.mts → loopingArray.d.cts} +0 -0
- /package/dist/util/{math.d.mts → math.d.cts} +0 -0
- /package/dist/util/{noop.d.mts → noop.d.cts} +0 -0
- /package/dist/util/{simpleSearch.d.mts → simpleSearch.d.cts} +0 -0
- /package/dist/util/{storage.d.mts → storage.d.cts} +0 -0
- /package/dist/util/{types.d.mts → types.d.cts} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TextareaHTMLAttributes } from 'react';
|
|
3
|
+
import { LabelProps } from './Label.cjs';
|
|
4
|
+
|
|
5
|
+
type TextareaProps = {
|
|
6
|
+
/** Outside the area */
|
|
7
|
+
label?: Omit<LabelProps, 'id'>;
|
|
8
|
+
/** Inside the area */
|
|
9
|
+
headline?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
resizable?: boolean;
|
|
12
|
+
onChangeText?: (text: string) => void;
|
|
13
|
+
disclaimer?: string;
|
|
14
|
+
onEditCompleted?: (text: string) => void;
|
|
15
|
+
defaultStyle?: boolean;
|
|
16
|
+
} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value'>;
|
|
17
|
+
/**
|
|
18
|
+
* A Textarea component for inputting longer texts
|
|
19
|
+
*
|
|
20
|
+
* The State is managed by the parent
|
|
21
|
+
*/
|
|
22
|
+
declare const Textarea: ({ label, headline, id, resizable, onChange, onChangeText, disclaimer, onBlur, onEditCompleted, defaultStyle, className, ...props }: TextareaProps) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* A Textarea component that is not controlled by its parent
|
|
25
|
+
*/
|
|
26
|
+
declare const TextareaUncontrolled: ({ value, onChangeText, ...props }: TextareaProps) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
|
|
28
|
+
export { Textarea, type TextareaProps, TextareaUncontrolled };
|
|
@@ -7,18 +7,22 @@ type TextareaProps = {
|
|
|
7
7
|
label?: Omit<LabelProps, 'id'>;
|
|
8
8
|
/** Inside the area */
|
|
9
9
|
headline?: string;
|
|
10
|
-
|
|
10
|
+
value?: string;
|
|
11
11
|
resizable?: boolean;
|
|
12
|
-
|
|
12
|
+
onChangeText?: (text: string) => void;
|
|
13
13
|
disclaimer?: string;
|
|
14
14
|
onEditCompleted?: (text: string) => void;
|
|
15
15
|
defaultStyle?: boolean;
|
|
16
|
-
} & Omit<TextareaHTMLAttributes<
|
|
16
|
+
} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value'>;
|
|
17
17
|
/**
|
|
18
18
|
* A Textarea component for inputting longer texts
|
|
19
19
|
*
|
|
20
20
|
* The State is managed by the parent
|
|
21
21
|
*/
|
|
22
|
-
declare const Textarea: ({ label, headline, id, resizable, onChange, disclaimer, onBlur, onEditCompleted, defaultStyle, className, ...props }: TextareaProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare const Textarea: ({ label, headline, id, resizable, onChange, onChangeText, disclaimer, onBlur, onEditCompleted, defaultStyle, className, ...props }: TextareaProps) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* A Textarea component that is not controlled by its parent
|
|
25
|
+
*/
|
|
26
|
+
declare const TextareaUncontrolled: ({ value, onChangeText, ...props }: TextareaProps) => react_jsx_runtime.JSX.Element;
|
|
23
27
|
|
|
24
|
-
export { Textarea, type TextareaProps };
|
|
28
|
+
export { Textarea, type TextareaProps, TextareaUncontrolled };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// src/components/user-action/Textarea.tsx
|
|
2
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
3
|
+
import clsx2 from "clsx";
|
|
4
|
+
|
|
5
|
+
// src/hooks/useSaveDelay.ts
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
function useSaveDelay(setNotificationStatus, delay) {
|
|
8
|
+
const [updateTimer, setUpdateTimer] = useState(void 0);
|
|
9
|
+
const [notificationTimer, setNotificationTimer] = useState(void 0);
|
|
10
|
+
const restartTimer = (onSave) => {
|
|
11
|
+
clearTimeout(updateTimer);
|
|
12
|
+
setUpdateTimer(setTimeout(() => {
|
|
13
|
+
onSave();
|
|
14
|
+
setNotificationStatus(true);
|
|
15
|
+
clearTimeout(notificationTimer);
|
|
16
|
+
setNotificationTimer(setTimeout(() => {
|
|
17
|
+
setNotificationStatus(false);
|
|
18
|
+
clearTimeout(notificationTimer);
|
|
19
|
+
}, delay));
|
|
20
|
+
clearTimeout(updateTimer);
|
|
21
|
+
}, delay));
|
|
22
|
+
};
|
|
23
|
+
const clearUpdateTimer = (hasSaved = true) => {
|
|
24
|
+
clearTimeout(updateTimer);
|
|
25
|
+
if (hasSaved) {
|
|
26
|
+
setNotificationStatus(true);
|
|
27
|
+
clearTimeout(notificationTimer);
|
|
28
|
+
setNotificationTimer(setTimeout(() => {
|
|
29
|
+
setNotificationStatus(false);
|
|
30
|
+
clearTimeout(notificationTimer);
|
|
31
|
+
}, delay));
|
|
32
|
+
} else {
|
|
33
|
+
setNotificationStatus(false);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
return () => {
|
|
38
|
+
clearTimeout(updateTimer);
|
|
39
|
+
clearTimeout(notificationTimer);
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
return { restartTimer, clearUpdateTimer };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/util/noop.ts
|
|
46
|
+
var noop = () => void 0;
|
|
47
|
+
|
|
48
|
+
// src/components/user-action/Label.tsx
|
|
49
|
+
import clsx from "clsx";
|
|
50
|
+
import { jsx } from "react/jsx-runtime";
|
|
51
|
+
var styleMapping = {
|
|
52
|
+
labelSmall: "textstyle-label-sm",
|
|
53
|
+
labelMedium: "textstyle-label-md",
|
|
54
|
+
labelBig: "textstyle-label-lg"
|
|
55
|
+
};
|
|
56
|
+
var Label = ({
|
|
57
|
+
children,
|
|
58
|
+
name,
|
|
59
|
+
labelType = "labelSmall",
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}) => {
|
|
63
|
+
return /* @__PURE__ */ jsx("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/components/user-action/Textarea.tsx
|
|
67
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
68
|
+
var Textarea = ({
|
|
69
|
+
label,
|
|
70
|
+
headline,
|
|
71
|
+
id,
|
|
72
|
+
resizable = false,
|
|
73
|
+
onChange = noop,
|
|
74
|
+
onChangeText = noop,
|
|
75
|
+
disclaimer,
|
|
76
|
+
onBlur = noop,
|
|
77
|
+
onEditCompleted = noop,
|
|
78
|
+
defaultStyle = true,
|
|
79
|
+
className,
|
|
80
|
+
...props
|
|
81
|
+
}) => {
|
|
82
|
+
const [hasFocus, setHasFocus] = useState2(false);
|
|
83
|
+
const { restartTimer, clearUpdateTimer } = useSaveDelay(() => void 0, 3e3);
|
|
84
|
+
const onEditCompletedWrapper = (text) => {
|
|
85
|
+
onEditCompleted(text);
|
|
86
|
+
clearUpdateTimer();
|
|
87
|
+
};
|
|
88
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
89
|
+
label && /* @__PURE__ */ jsx2(
|
|
90
|
+
Label,
|
|
91
|
+
{
|
|
92
|
+
...label,
|
|
93
|
+
htmlFor: id,
|
|
94
|
+
className: clsx2("mb-1", label.className),
|
|
95
|
+
labelType: label.labelType ?? "labelSmall"
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsxs(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: `${clsx2(" bg-surface text-on-surface focus-within:border-primary relative", { "shadow border-2 border-gray-300 hover:border-primary rounded-lg": defaultStyle })}`,
|
|
102
|
+
children: [
|
|
103
|
+
headline && /* @__PURE__ */ jsx2("span", { className: "mx-3 mt-3 block text-gray-700 font-bold", children: headline }),
|
|
104
|
+
/* @__PURE__ */ jsx2(
|
|
105
|
+
"textarea",
|
|
106
|
+
{
|
|
107
|
+
id,
|
|
108
|
+
className: clsx2("pt-0 px-3 border-transparent focus:border-transparent focus:ring-0 appearance-none border w-full leading-tight focus:outline-none", {
|
|
109
|
+
"resize-none": !resizable,
|
|
110
|
+
"h-32": defaultStyle,
|
|
111
|
+
"mt-3": !headline
|
|
112
|
+
}, className),
|
|
113
|
+
onChange: (event) => {
|
|
114
|
+
const value = event.target.value;
|
|
115
|
+
restartTimer(() => {
|
|
116
|
+
onEditCompletedWrapper(value);
|
|
117
|
+
});
|
|
118
|
+
onChange(event);
|
|
119
|
+
onChangeText(value);
|
|
120
|
+
},
|
|
121
|
+
onFocus: () => {
|
|
122
|
+
setHasFocus(true);
|
|
123
|
+
},
|
|
124
|
+
onBlur: (event) => {
|
|
125
|
+
onBlur(event);
|
|
126
|
+
onEditCompletedWrapper(event.target.value);
|
|
127
|
+
setHasFocus(false);
|
|
128
|
+
},
|
|
129
|
+
...props
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
hasFocus && disclaimer && /* @__PURE__ */ jsx2("label", { className: "text-negative", children: disclaimer })
|
|
136
|
+
] });
|
|
137
|
+
};
|
|
138
|
+
var TextareaUncontrolled = ({
|
|
139
|
+
value = "",
|
|
140
|
+
onChangeText = noop,
|
|
141
|
+
...props
|
|
142
|
+
}) => {
|
|
143
|
+
const [text, setText] = useState2(value);
|
|
144
|
+
useEffect2(() => {
|
|
145
|
+
setText(value);
|
|
146
|
+
}, [value]);
|
|
147
|
+
return /* @__PURE__ */ jsx2(
|
|
148
|
+
Textarea,
|
|
149
|
+
{
|
|
150
|
+
...props,
|
|
151
|
+
value: text,
|
|
152
|
+
onChangeText: (text2) => {
|
|
153
|
+
setText(text2);
|
|
154
|
+
onChangeText(text2);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
export {
|
|
160
|
+
Textarea,
|
|
161
|
+
TextareaUncontrolled
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=Textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/user-action/Textarea.tsx","../../../src/hooks/useSaveDelay.ts","../../../src/util/noop.ts","../../../src/components/user-action/Label.tsx"],"sourcesContent":["import type { TextareaHTMLAttributes } from 'react'\nimport { useEffect, useState } from 'react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\nexport type TextareaProps = {\n /** Outside the area */\n label?: Omit<LabelProps, 'id'>,\n /** Inside the area */\n headline?: string,\n value?: string,\n resizable?: boolean,\n onChangeText?: (text: string) => void,\n disclaimer?: string,\n onEditCompleted?: (text: string) => void,\n defaultStyle?: boolean,\n} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value'>\n\n/**\n * A Textarea component for inputting longer texts\n *\n * The State is managed by the parent\n */\nexport const Textarea = ({\n label,\n headline,\n id,\n resizable = false,\n onChange = noop,\n onChangeText = noop,\n disclaimer,\n onBlur = noop,\n onEditCompleted = noop,\n defaultStyle = true,\n className,\n ...props\n }: TextareaProps) => {\n const [hasFocus, setHasFocus] = useState(false)\n const { restartTimer, clearUpdateTimer } = useSaveDelay(() => undefined, 3000)\n\n const onEditCompletedWrapper = (text: string) => {\n onEditCompleted(text)\n clearUpdateTimer()\n }\n\n return (\n <div className=\"w-full\">\n {label && (\n <Label {...label} htmlFor={id} className={clsx('mb-1', label.className)}\n labelType={label.labelType ?? 'labelSmall'}/>\n )}\n <div\n className={`${clsx(' bg-surface text-on-surface focus-within:border-primary relative', { 'shadow border-2 border-gray-300 hover:border-primary rounded-lg': defaultStyle })}`}>\n {headline && (\n <span className=\"mx-3 mt-3 block text-gray-700 font-bold\">\n {headline}\n </span>\n )}\n <textarea\n id={id}\n className={clsx('pt-0 px-3 border-transparent focus:border-transparent focus:ring-0 appearance-none border w-full leading-tight focus:outline-none', {\n 'resize-none': !resizable,\n 'h-32': defaultStyle,\n 'mt-3': !headline\n }, className)}\n onChange={(event) => {\n const value = event.target.value\n restartTimer(() => {\n onEditCompletedWrapper(value)\n })\n onChange(event)\n onChangeText(value)\n }}\n onFocus={() => {\n setHasFocus(true)\n }}\n onBlur={(event) => {\n onBlur(event)\n onEditCompletedWrapper(event.target.value)\n setHasFocus(false)\n }}\n {...props}\n >\n </textarea>\n </div>\n {(hasFocus && disclaimer) && (\n <label className=\"text-negative\">\n {disclaimer}\n </label>\n )}\n </div>\n )\n}\n\n/**\n * A Textarea component that is not controlled by its parent\n */\nexport const TextareaUncontrolled = ({\n value = '',\n onChangeText = noop,\n ...props\n }: TextareaProps) => {\n const [text, setText] = useState<string>(value)\n\n useEffect(() => {\n setText(value)\n }, [value])\n\n return (\n <Textarea\n {...props}\n value={text}\n onChangeText={text => {\n setText(text)\n onChangeText(text)\n }}\n />\n )\n}","import { useEffect, useState } from 'react'\n\nexport function useSaveDelay(setNotificationStatus: (isShowing: boolean) => void, delay: number) {\n const [updateTimer, setUpdateTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n const [notificationTimer, setNotificationTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n\n const restartTimer = (onSave: () => void) => {\n clearTimeout(updateTimer)\n setUpdateTimer(setTimeout(() => {\n onSave()\n setNotificationStatus(true)\n // Show Saved Notification for fade animation duration\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n clearTimeout(updateTimer)\n }, delay))\n }\n\n const clearUpdateTimer = (hasSaved = true) => {\n clearTimeout(updateTimer)\n if (hasSaved) {\n setNotificationStatus(true)\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n } else {\n setNotificationStatus(false)\n }\n }\n\n useEffect(() => {\n return () => {\n clearTimeout(updateTimer)\n clearTimeout(notificationTimer)\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { restartTimer, clearUpdateTimer }\n}","export const noop = () => undefined\n","import type { LabelHTMLAttributes } from 'react'\nimport clsx from 'clsx'\n\nexport type LabelType = 'labelSmall' | 'labelMedium' | 'labelBig'\n\nconst styleMapping: Record<LabelType, string> = {\n labelSmall: 'textstyle-label-sm',\n labelMedium: 'textstyle-label-md',\n labelBig: 'textstyle-label-lg',\n}\n\nexport type LabelProps = {\n /** The text for the label */\n name?: string,\n /** The styling for the label */\n labelType?: LabelType,\n} & LabelHTMLAttributes<HTMLLabelElement>\n\n/**\n * A Label component\n */\nexport const Label = ({\n children,\n name,\n labelType = 'labelSmall',\n className,\n ...props\n }: LabelProps) => {\n return (\n <label {...props} className={clsx(styleMapping[labelType], className)}>\n {children ? children : name}\n </label>\n )\n}\n"],"mappings":";AACA,SAAS,aAAAA,YAAW,YAAAC,iBAAgB;AACpC,OAAOC,WAAU;;;ACFjB,SAAS,WAAW,gBAAgB;AAE7B,SAAS,aAAa,uBAAqD,OAAe;AAC/F,QAAM,CAAC,aAAa,cAAc,IAAI,SAAqC,MAAS;AACpF,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAAqC,MAAS;AAEhG,QAAM,eAAe,CAAC,WAAuB;AAC3C,iBAAa,WAAW;AACxB,mBAAe,WAAW,MAAM;AAC9B,aAAO;AACP,4BAAsB,IAAI;AAE1B,mBAAa,iBAAiB;AAC9B,2BAAqB,WAAW,MAAM;AACpC,8BAAsB,KAAK;AAC3B,qBAAa,iBAAiB;AAAA,MAChC,GAAG,KAAK,CAAC;AACT,mBAAa,WAAW;AAAA,IAC1B,GAAG,KAAK,CAAC;AAAA,EACX;AAEA,QAAM,mBAAmB,CAAC,WAAW,SAAS;AAC5C,iBAAa,WAAW;AACxB,QAAI,UAAU;AACZ,4BAAsB,IAAI;AAC1B,mBAAa,iBAAiB;AAC9B,2BAAqB,WAAW,MAAM;AACpC,8BAAsB,KAAK;AAC3B,qBAAa,iBAAiB;AAAA,MAChC,GAAG,KAAK,CAAC;AAAA,IACX,OAAO;AACL,4BAAsB,KAAK;AAAA,IAC7B;AAAA,EACF;AAEA,YAAU,MAAM;AACd,WAAO,MAAM;AACX,mBAAa,WAAW;AACxB,mBAAa,iBAAiB;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,cAAc,iBAAiB;AAC1C;;;AC3CO,IAAM,OAAO,MAAM;;;ACC1B,OAAO,UAAU;AA4Bb;AAxBJ,IAAM,eAA0C;AAAA,EAC9C,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,UAAU;AACZ;AAYO,IAAM,QAAQ,CAAC;AAA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AAC3B,6BAAa,MAAM;AACjB,yCAAuB,KAAK;AAAA,gBAC9B,CAAC;AACD,yBAAS,KAAK;AACd,6BAAa,KAAK;AAAA,cACpB;AAAA,cACA,SAAS,MAAM;AACb,4BAAY,IAAI;AAAA,cAClB;AAAA,cACA,QAAQ,CAAC,UAAU;AACjB,uBAAO,KAAK;AACZ,uCAAuB,MAAM,OAAO,KAAK;AACzC,4BAAY,KAAK;AAAA,cACnB;AAAA,cACC,GAAG;AAAA;AAAA,UAER;AAAA;AAAA;AAAA,IACA;AAAA,IACE,YAAY,cACZ,gBAAAF,KAAC,WAAM,WAAU,iBACd,sBACH;AAAA,KAEJ;AAEJ;AAKO,IAAM,uBAAuB,CAAC;AAAA,EACE,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,GAAG;AACL,MAAqB;AACxD,QAAM,CAAC,MAAM,OAAO,IAAIC,UAAiB,KAAK;AAE9C,EAAAE,WAAU,MAAM;AACd,YAAQ,KAAK;AAAA,EACf,GAAG,CAAC,KAAK,CAAC;AAEV,SACE,gBAAAH;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,MACP,cAAc,CAAAI,UAAQ;AACpB,gBAAQA,KAAI;AACZ,qBAAaA,KAAI;AAAA,MACnB;AAAA;AAAA,EACF;AAEJ;","names":["useEffect","useState","clsx","jsx","useState","clsx","useEffect","text"]}
|
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
|
-
// src/components/user-
|
|
30
|
+
// src/components/user-action/ToggleableInput.tsx
|
|
31
31
|
var ToggleableInput_exports = {};
|
|
32
32
|
__export(ToggleableInput_exports, {
|
|
33
33
|
ToggleableInput: () => ToggleableInput,
|
|
@@ -36,7 +36,7 @@ __export(ToggleableInput_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(ToggleableInput_exports);
|
|
37
37
|
var import_react2 = require("react");
|
|
38
38
|
var import_lucide_react = require("lucide-react");
|
|
39
|
-
var import_clsx = __toESM(require("clsx"));
|
|
39
|
+
var import_clsx = __toESM(require("clsx"), 1);
|
|
40
40
|
|
|
41
41
|
// src/hooks/useSaveDelay.ts
|
|
42
42
|
var import_react = require("react");
|
|
@@ -81,7 +81,7 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
81
81
|
// src/util/noop.ts
|
|
82
82
|
var noop = () => void 0;
|
|
83
83
|
|
|
84
|
-
// src/components/user-
|
|
84
|
+
// src/components/user-action/ToggleableInput.tsx
|
|
85
85
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
86
86
|
var ToggleableInput = ({
|
|
87
87
|
type = "text",
|
|
@@ -91,7 +91,7 @@ var ToggleableInput = ({
|
|
|
91
91
|
onEditCompleted = noop,
|
|
92
92
|
labelClassName = "",
|
|
93
93
|
initialState = "display",
|
|
94
|
-
size =
|
|
94
|
+
size = 16,
|
|
95
95
|
disclaimer,
|
|
96
96
|
onBlur,
|
|
97
97
|
...restProps
|
|
@@ -112,7 +112,7 @@ var ToggleableInput = ({
|
|
|
112
112
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
113
113
|
"div",
|
|
114
114
|
{
|
|
115
|
-
className: "row items-center w-full gap-x-2 overflow-hidden",
|
|
115
|
+
className: (0, import_clsx.default)("row items-center w-full gap-x-2 overflow-hidden", { "cursor-pointer": !isEditing }),
|
|
116
116
|
onClick: () => !isEditing ? setIsEditing(!isEditing) : void 0,
|
|
117
117
|
children: [
|
|
118
118
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_clsx.default)("row overflow-hidden", { "flex-1": isEditing }), children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -143,18 +143,12 @@ var ToggleableInput = ({
|
|
|
143
143
|
onEditCompletedWrapper(value);
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
|
-
className: (0, import_clsx.default)(
|
|
146
|
+
className: (0, import_clsx.default)(`w-full border-none rounded-none ring-0 outline-0 text-inherit bg-inherit shadow-transparent decoration-primary p-0 underline-offset-4`, {
|
|
147
147
|
underline: isEditing
|
|
148
|
-
}),
|
|
148
|
+
}, labelClassName),
|
|
149
149
|
onFocus: (event) => event.target.select()
|
|
150
150
|
}
|
|
151
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
152
|
-
"span",
|
|
153
|
-
{
|
|
154
|
-
className: (0, import_clsx.default)(labelClassName, "max-w-xs break-words overflow-hidden"),
|
|
155
|
-
children: value
|
|
156
|
-
}
|
|
157
|
-
) }),
|
|
151
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_clsx.default)("max-w-xs break-words overflow-hidden", labelClassName), children: value }) }),
|
|
158
152
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
159
153
|
import_lucide_react.Pencil,
|
|
160
154
|
{
|
|
@@ -195,4 +189,4 @@ var ToggleableInputUncontrolled = ({
|
|
|
195
189
|
ToggleableInput,
|
|
196
190
|
ToggleableInputUncontrolled
|
|
197
191
|
});
|
|
198
|
-
//# sourceMappingURL=ToggleableInput.
|
|
192
|
+
//# sourceMappingURL=ToggleableInput.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/user-action/ToggleableInput.tsx","../../../src/hooks/useSaveDelay.ts","../../../src/util/noop.ts"],"sourcesContent":["import type { HTMLInputTypeAttribute, InputHTMLAttributes } from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { Pencil } from 'lucide-react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\n\ntype InputProps = {\n /**\n * The value\n */\n value: string,\n /**\n * @default 'text'\n */\n type?: HTMLInputTypeAttribute,\n /**\n * Callback for when the input's value changes\n * This is pretty much required but made optional for the rare cases where it actually isn't need such as when used with disabled\n * That could be enforced through a union type but that seems a bit overkill\n * @default noop\n */\n onChangeText?: (text: string) => void,\n onEditCompleted?: (text: string) => void,\n labelClassName?: string,\n initialState?: 'editing' | 'display',\n size?: number,\n disclaimer?: string,\n} & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'label' | 'type' | 'crossOrigin'>\n\n/**\n * A Text input component for inputting text. It changes appearance upon entering the edit mode and switches\n * back to display mode on loss of focus or on enter\n *\n * The State is managed by the parent\n */\nexport const ToggleableInput = ({\n type = 'text',\n value,\n onChange = noop,\n onChangeText = noop,\n onEditCompleted = noop,\n labelClassName = '',\n initialState = 'display',\n size = 16,\n disclaimer,\n onBlur,\n ...restProps\n }: InputProps) => {\n const [isEditing, setIsEditing] = useState(initialState !== 'display')\n const { restartTimer, clearUpdateTimer } = useSaveDelay(() => undefined, 3000)\n const ref = useRef<HTMLInputElement>(null)\n\n const onEditCompletedWrapper = (text: string) => {\n onEditCompleted(text)\n clearUpdateTimer()\n }\n\n useEffect(() => {\n if (isEditing) {\n ref.current?.focus()\n }\n }, [isEditing])\n\n return (\n <div>\n <div\n className={clsx('row items-center w-full gap-x-2 overflow-hidden', { 'cursor-pointer': !isEditing })}\n onClick={() => !isEditing ? setIsEditing(!isEditing) : undefined}\n >\n <div className={clsx('row overflow-hidden', { 'flex-1': isEditing })}>\n {isEditing ? (\n <input\n ref={ref}\n {...restProps}\n value={value}\n type={type}\n onChange={event => {\n const value = event.target.value\n restartTimer(() => {\n onEditCompletedWrapper(value)\n })\n onChangeText(value)\n onChange(event)\n }}\n onBlur={(event) => {\n if (onBlur) {\n onBlur(event)\n }\n onEditCompletedWrapper(value)\n setIsEditing(false)\n }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n setIsEditing(false)\n onEditCompletedWrapper(value)\n }\n }}\n className={clsx(`w-full border-none rounded-none ring-0 outline-0 text-inherit bg-inherit shadow-transparent decoration-primary p-0 underline-offset-4`, {\n underline: isEditing\n }, labelClassName)}\n onFocus={event => event.target.select()}\n />\n ) : (\n <span className={clsx('max-w-xs break-words overflow-hidden', labelClassName)}>\n {value}\n </span>\n )}\n </div>\n <Pencil\n className={clsx(`cursor-pointer`, { 'text-transparent': isEditing })}\n size={size}\n style={{ minWidth: `${size}px` }}\n />\n </div>\n {(isEditing && disclaimer) && (\n <label className=\"text-negative\">\n {disclaimer}\n </label>\n )}\n </div>\n )\n}\n\nexport const ToggleableInputUncontrolled = ({\n value: initialValue,\n onChangeText = noop,\n ...restProps\n }: InputProps) => {\n const [value, setValue] = useState(initialValue)\n\n useEffect(() => {\n setValue(initialValue)\n }, [initialValue])\n\n return (\n <ToggleableInput\n value={value}\n onChangeText={text => {\n setValue(text)\n onChangeText(text)\n }}\n {...restProps}\n />\n )\n}\n","import { useEffect, useState } from 'react'\n\nexport function useSaveDelay(setNotificationStatus: (isShowing: boolean) => void, delay: number) {\n const [updateTimer, setUpdateTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n const [notificationTimer, setNotificationTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n\n const restartTimer = (onSave: () => void) => {\n clearTimeout(updateTimer)\n setUpdateTimer(setTimeout(() => {\n onSave()\n setNotificationStatus(true)\n // Show Saved Notification for fade animation duration\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n clearTimeout(updateTimer)\n }, delay))\n }\n\n const clearUpdateTimer = (hasSaved = true) => {\n clearTimeout(updateTimer)\n if (hasSaved) {\n setNotificationStatus(true)\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n } else {\n setNotificationStatus(false)\n }\n }\n\n useEffect(() => {\n return () => {\n clearTimeout(updateTimer)\n clearTimeout(notificationTimer)\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { restartTimer, clearUpdateTimer }\n}","export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b,GAAG,cAAc;AAAA,cACjB,SAAS,WAAS,MAAM,OAAO,OAAO;AAAA;AAAA,UACxC,IAEA,4CAAC,UAAK,eAAW,YAAAA,SAAK,wCAAwC,cAAc,GACzE,iBACH,GAEJ;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW,YAAAA,SAAK,kBAAkB,EAAE,oBAAoB,UAAU,CAAC;AAAA,cACnE;AAAA,cACA,OAAO,EAAE,UAAU,GAAG,IAAI,KAAK;AAAA;AAAA,UACjC;AAAA;AAAA;AAAA,IACF;AAAA,IACE,aAAa,cACb,4CAAC,WAAM,WAAU,iBACd,sBACH;AAAA,KAEJ;AAEJ;AAEO,IAAM,8BAA8B,CAAC;AAAA,EACE,OAAO;AAAA,EACP,eAAe;AAAA,EACf,GAAG;AACL,MAAkB;AAC5D,QAAM,CAAC,OAAO,QAAQ,QAAI,wBAAS,YAAY;AAE/C,+BAAU,MAAM;AACd,aAAS,YAAY;AAAA,EACvB,GAAG,CAAC,YAAY,CAAC;AAEjB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,cAAc,UAAQ;AACpB,iBAAS,IAAI;AACb,qBAAa,IAAI;AAAA,MACnB;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":["import_react","clsx","value"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/components/user-
|
|
1
|
+
// src/components/user-action/ToggleableInput.tsx
|
|
2
2
|
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
3
3
|
import { Pencil } from "lucide-react";
|
|
4
4
|
import clsx from "clsx";
|
|
@@ -46,7 +46,7 @@ function useSaveDelay(setNotificationStatus, delay) {
|
|
|
46
46
|
// src/util/noop.ts
|
|
47
47
|
var noop = () => void 0;
|
|
48
48
|
|
|
49
|
-
// src/components/user-
|
|
49
|
+
// src/components/user-action/ToggleableInput.tsx
|
|
50
50
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
51
51
|
var ToggleableInput = ({
|
|
52
52
|
type = "text",
|
|
@@ -56,7 +56,7 @@ var ToggleableInput = ({
|
|
|
56
56
|
onEditCompleted = noop,
|
|
57
57
|
labelClassName = "",
|
|
58
58
|
initialState = "display",
|
|
59
|
-
size =
|
|
59
|
+
size = 16,
|
|
60
60
|
disclaimer,
|
|
61
61
|
onBlur,
|
|
62
62
|
...restProps
|
|
@@ -77,7 +77,7 @@ var ToggleableInput = ({
|
|
|
77
77
|
/* @__PURE__ */ jsxs(
|
|
78
78
|
"div",
|
|
79
79
|
{
|
|
80
|
-
className: "row items-center w-full gap-x-2 overflow-hidden",
|
|
80
|
+
className: clsx("row items-center w-full gap-x-2 overflow-hidden", { "cursor-pointer": !isEditing }),
|
|
81
81
|
onClick: () => !isEditing ? setIsEditing(!isEditing) : void 0,
|
|
82
82
|
children: [
|
|
83
83
|
/* @__PURE__ */ jsx("div", { className: clsx("row overflow-hidden", { "flex-1": isEditing }), children: isEditing ? /* @__PURE__ */ jsx(
|
|
@@ -108,18 +108,12 @@ var ToggleableInput = ({
|
|
|
108
108
|
onEditCompletedWrapper(value);
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
className: clsx(
|
|
111
|
+
className: clsx(`w-full border-none rounded-none ring-0 outline-0 text-inherit bg-inherit shadow-transparent decoration-primary p-0 underline-offset-4`, {
|
|
112
112
|
underline: isEditing
|
|
113
|
-
}),
|
|
113
|
+
}, labelClassName),
|
|
114
114
|
onFocus: (event) => event.target.select()
|
|
115
115
|
}
|
|
116
|
-
) : /* @__PURE__ */ jsx(
|
|
117
|
-
"span",
|
|
118
|
-
{
|
|
119
|
-
className: clsx(labelClassName, "max-w-xs break-words overflow-hidden"),
|
|
120
|
-
children: value
|
|
121
|
-
}
|
|
122
|
-
) }),
|
|
116
|
+
) : /* @__PURE__ */ jsx("span", { className: clsx("max-w-xs break-words overflow-hidden", labelClassName), children: value }) }),
|
|
123
117
|
/* @__PURE__ */ jsx(
|
|
124
118
|
Pencil,
|
|
125
119
|
{
|
|
@@ -159,4 +153,4 @@ export {
|
|
|
159
153
|
ToggleableInput,
|
|
160
154
|
ToggleableInputUncontrolled
|
|
161
155
|
};
|
|
162
|
-
//# sourceMappingURL=ToggleableInput.
|
|
156
|
+
//# sourceMappingURL=ToggleableInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/user-action/ToggleableInput.tsx","../../../src/hooks/useSaveDelay.ts","../../../src/util/noop.ts"],"sourcesContent":["import type { HTMLInputTypeAttribute, InputHTMLAttributes } from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { Pencil } from 'lucide-react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\n\ntype InputProps = {\n /**\n * The value\n */\n value: string,\n /**\n * @default 'text'\n */\n type?: HTMLInputTypeAttribute,\n /**\n * Callback for when the input's value changes\n * This is pretty much required but made optional for the rare cases where it actually isn't need such as when used with disabled\n * That could be enforced through a union type but that seems a bit overkill\n * @default noop\n */\n onChangeText?: (text: string) => void,\n onEditCompleted?: (text: string) => void,\n labelClassName?: string,\n initialState?: 'editing' | 'display',\n size?: number,\n disclaimer?: string,\n} & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'label' | 'type' | 'crossOrigin'>\n\n/**\n * A Text input component for inputting text. It changes appearance upon entering the edit mode and switches\n * back to display mode on loss of focus or on enter\n *\n * The State is managed by the parent\n */\nexport const ToggleableInput = ({\n type = 'text',\n value,\n onChange = noop,\n onChangeText = noop,\n onEditCompleted = noop,\n labelClassName = '',\n initialState = 'display',\n size = 16,\n disclaimer,\n onBlur,\n ...restProps\n }: InputProps) => {\n const [isEditing, setIsEditing] = useState(initialState !== 'display')\n const { restartTimer, clearUpdateTimer } = useSaveDelay(() => undefined, 3000)\n const ref = useRef<HTMLInputElement>(null)\n\n const onEditCompletedWrapper = (text: string) => {\n onEditCompleted(text)\n clearUpdateTimer()\n }\n\n useEffect(() => {\n if (isEditing) {\n ref.current?.focus()\n }\n }, [isEditing])\n\n return (\n <div>\n <div\n className={clsx('row items-center w-full gap-x-2 overflow-hidden', { 'cursor-pointer': !isEditing })}\n onClick={() => !isEditing ? setIsEditing(!isEditing) : undefined}\n >\n <div className={clsx('row overflow-hidden', { 'flex-1': isEditing })}>\n {isEditing ? (\n <input\n ref={ref}\n {...restProps}\n value={value}\n type={type}\n onChange={event => {\n const value = event.target.value\n restartTimer(() => {\n onEditCompletedWrapper(value)\n })\n onChangeText(value)\n onChange(event)\n }}\n onBlur={(event) => {\n if (onBlur) {\n onBlur(event)\n }\n onEditCompletedWrapper(value)\n setIsEditing(false)\n }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n setIsEditing(false)\n onEditCompletedWrapper(value)\n }\n }}\n className={clsx(`w-full border-none rounded-none ring-0 outline-0 text-inherit bg-inherit shadow-transparent decoration-primary p-0 underline-offset-4`, {\n underline: isEditing\n }, labelClassName)}\n onFocus={event => event.target.select()}\n />\n ) : (\n <span className={clsx('max-w-xs break-words overflow-hidden', labelClassName)}>\n {value}\n </span>\n )}\n </div>\n <Pencil\n className={clsx(`cursor-pointer`, { 'text-transparent': isEditing })}\n size={size}\n style={{ minWidth: `${size}px` }}\n />\n </div>\n {(isEditing && disclaimer) && (\n <label className=\"text-negative\">\n {disclaimer}\n </label>\n )}\n </div>\n )\n}\n\nexport const ToggleableInputUncontrolled = ({\n value: initialValue,\n onChangeText = noop,\n ...restProps\n }: InputProps) => {\n const [value, setValue] = useState(initialValue)\n\n useEffect(() => {\n setValue(initialValue)\n }, [initialValue])\n\n return (\n <ToggleableInput\n value={value}\n onChangeText={text => {\n setValue(text)\n onChangeText(text)\n }}\n {...restProps}\n />\n )\n}\n","import { useEffect, useState } from 'react'\n\nexport function useSaveDelay(setNotificationStatus: (isShowing: boolean) => void, delay: number) {\n const [updateTimer, setUpdateTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n const [notificationTimer, setNotificationTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n\n const restartTimer = (onSave: () => void) => {\n clearTimeout(updateTimer)\n setUpdateTimer(setTimeout(() => {\n onSave()\n setNotificationStatus(true)\n // Show Saved Notification for fade animation duration\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n clearTimeout(updateTimer)\n }, delay))\n }\n\n const clearUpdateTimer = (hasSaved = true) => {\n clearTimeout(updateTimer)\n if (hasSaved) {\n setNotificationStatus(true)\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n } else {\n setNotificationStatus(false)\n }\n }\n\n useEffect(() => {\n return () => {\n clearTimeout(updateTimer)\n clearTimeout(notificationTimer)\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { restartTimer, clearUpdateTimer }\n}","export const noop = () => undefined\n"],"mappings":";AACA,SAAS,aAAAA,YAAW,QAAQ,YAAAC,iBAAgB;AAC5C,SAAS,cAAc;AACvB,OAAO,UAAU;;;ACHjB,SAAS,WAAW,gBAAgB;AAE7B,SAAS,aAAa,uBAAqD,OAAe;AAC/F,QAAM,CAAC,aAAa,cAAc,IAAI,SAAqC,MAAS;AACpF,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAAqC,MAAS;AAEhG,QAAM,eAAe,CAAC,WAAuB;AAC3C,iBAAa,WAAW;AACxB,mBAAe,WAAW,MAAM;AAC9B,aAAO;AACP,4BAAsB,IAAI;AAE1B,mBAAa,iBAAiB;AAC9B,2BAAqB,WAAW,MAAM;AACpC,8BAAsB,KAAK;AAC3B,qBAAa,iBAAiB;AAAA,MAChC,GAAG,KAAK,CAAC;AACT,mBAAa,WAAW;AAAA,IAC1B,GAAG,KAAK,CAAC;AAAA,EACX;AAEA,QAAM,mBAAmB,CAAC,WAAW,SAAS;AAC5C,iBAAa,WAAW;AACxB,QAAI,UAAU;AACZ,4BAAsB,I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IAAI;AACb,qBAAa,IAAI;AAAA,MACnB;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":["useEffect","useState","useState","useEffect","value"]}
|
|
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/components/Tooltip.tsx
|
|
20
|
+
// src/components/user-action/Tooltip.tsx
|
|
21
21
|
var Tooltip_exports = {};
|
|
22
22
|
__export(Tooltip_exports, {
|
|
23
23
|
Tooltip: () => Tooltip
|
|
@@ -68,7 +68,7 @@ var useHoverState = (props = void 0) => {
|
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
// src/components/Tooltip.tsx
|
|
71
|
+
// src/components/user-action/Tooltip.tsx
|
|
72
72
|
var import_clsx = require("clsx");
|
|
73
73
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
74
74
|
var Tooltip = ({
|
|
@@ -89,10 +89,10 @@ var Tooltip = ({
|
|
|
89
89
|
};
|
|
90
90
|
const triangleSize = 6;
|
|
91
91
|
const triangleClasses = {
|
|
92
|
-
top: `top-full left-1/2 -translate-x-1/2 border-t-
|
|
93
|
-
bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-
|
|
94
|
-
left: `left-full top-1/2 -translate-y-1/2 border-l-
|
|
95
|
-
right: `right-full top-1/2 -translate-y-1/2 border-r-
|
|
92
|
+
top: `top-full left-1/2 -translate-x-1/2 border-t-tooltip-background border-l-transparent border-r-transparent`,
|
|
93
|
+
bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-tooltip-background border-l-transparent border-r-transparent`,
|
|
94
|
+
left: `left-full top-1/2 -translate-y-1/2 border-l-tooltip-background border-t-transparent border-b-transparent`,
|
|
95
|
+
right: `right-full top-1/2 -translate-y-1/2 border-r-tooltip-background border-t-transparent border-b-transparent`
|
|
96
96
|
};
|
|
97
97
|
const triangleStyle = {
|
|
98
98
|
top: { borderWidth: `${triangleSize}px ${triangleSize}px 0 ${triangleSize}px` },
|
|
@@ -110,8 +110,12 @@ var Tooltip = ({
|
|
|
110
110
|
isHovered && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
111
111
|
"div",
|
|
112
112
|
{
|
|
113
|
-
className: (0, import_clsx.clsx)(
|
|
114
|
-
|
|
113
|
+
className: (0, import_clsx.clsx)(
|
|
114
|
+
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
115
|
+
animate-tooltip-fade-in shadow-lg bg-tooltip-background`,
|
|
116
|
+
positionClasses[position],
|
|
117
|
+
tooltipClassName
|
|
118
|
+
),
|
|
115
119
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
116
120
|
children: [
|
|
117
121
|
tooltip,
|
|
@@ -133,4 +137,4 @@ var Tooltip = ({
|
|
|
133
137
|
0 && (module.exports = {
|
|
134
138
|
Tooltip
|
|
135
139
|
});
|
|
136
|
-
//# sourceMappingURL=Tooltip.
|
|
140
|
+
//# sourceMappingURL=Tooltip.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/user-action/Tooltip.tsx","../../../src/hooks/useHoverState.ts"],"sourcesContent":["import type { CSSProperties, PropsWithChildren, ReactNode } from 'react'\nimport { useHoverState } from '@/hooks/useHoverState'\nimport { clsx } from 'clsx'\n\ntype Position = 'top' | 'bottom' | 'left' | 'right'\n\nexport type TooltipProps = PropsWithChildren<{\n tooltip: string | ReactNode,\n /**\n * Number of milliseconds until the tooltip appears\n *\n * defaults to 1000ms\n */\n animationDelay?: number,\n /**\n * Class names of additional styling properties for the tooltip\n */\n tooltipClassName?: string,\n /**\n * Class names of additional styling properties for the container from which the tooltip will be created\n */\n containerClassName?: string,\n position?: Position,\n zIndex?: number,\n}>\n\n/**\n * A Component for showing a tooltip when hovering over Content\n * @param tooltip The tooltip to show can be a text or any ReactNode\n * @param children The Content for which the tooltip should be created\n * @param animationDelay The delay before the tooltip appears\n * @param tooltipClassName Additional ClassNames for the Container of the tooltip\n * @param containerClassName Additional ClassNames for the Container holding the content\n * @param position The direction of the tooltip relative to the Container\n * @param zIndex The z Index of the tooltip (you may require this when stacking modal)\n * @constructor\n */\nexport const Tooltip = ({\n tooltip,\n children,\n animationDelay = 650,\n tooltipClassName = '',\n containerClassName = '',\n position = 'bottom',\n zIndex = 10,\n }: TooltipProps) => {\n const { isHovered, handlers } = useHoverState()\n\n const positionClasses = {\n top: `bottom-full left-1/2 -translate-x-1/2 mb-[6px]`,\n bottom: `top-full left-1/2 -translate-x-1/2 mt-[6px]`,\n left: `right-full top-1/2 -translate-y-1/2 mr-[6px]`,\n right: `left-full top-1/2 -translate-y-1/2 ml-[6px]`\n }\n\n const triangleSize = 6\n const triangleClasses = {\n top: `top-full left-1/2 -translate-x-1/2 border-t-tooltip-background border-l-transparent border-r-transparent`,\n bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-tooltip-background border-l-transparent border-r-transparent`,\n left: `left-full top-1/2 -translate-y-1/2 border-l-tooltip-background border-t-transparent border-b-transparent`,\n right: `right-full top-1/2 -translate-y-1/2 border-r-tooltip-background border-t-transparent border-b-transparent`\n }\n\n const triangleStyle: Record<Position, CSSProperties> = {\n top: { borderWidth: `${triangleSize}px ${triangleSize}px 0 ${triangleSize}px` },\n bottom: { borderWidth: `0 ${triangleSize}px ${triangleSize}px ${triangleSize}px` },\n left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },\n right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }\n }\n\n return (\n <div\n className={clsx('relative inline-block', containerClassName)}\n {...handlers}\n >\n {children}\n {isHovered && (\n <div\n className={clsx(\n `opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap\n animate-tooltip-fade-in shadow-lg bg-tooltip-background`,\n positionClasses[position], tooltipClassName\n )}\n style={{ zIndex, animationDelay: animationDelay + 'ms' }}\n >\n {tooltip}\n <div\n className={clsx(`absolute w-0 h-0`, triangleClasses[position])}\n style={{ ...triangleStyle[position], zIndex }}\n />\n </div>\n )}\n </div>\n )\n}\n","import type { Dispatch, SetStateAction } from 'react'\nimport { useEffect, useState } from 'react'\n\ntype UseHoverStateProps = {\n /**\n * The delay after which the menu is closed in milliseconds\n *\n * default: 200ms\n */\n closingDelay: number,\n /**\n * Whether the hover state management should be disabled\n *\n * default: false\n */\n isDisabled: boolean,\n}\n\ntype UseHoverStateReturnType = {\n /**\n * Whether the element is hovered\n */\n isHovered: boolean,\n /**\n * Function to change the current hover status\n */\n setIsHovered: Dispatch<SetStateAction<boolean>>,\n /**\n * Handlers to pass on to the component that should be hovered\n */\n handlers: {\n onMouseEnter: () => void,\n onMouseLeave: () => void,\n },\n}\n\nconst defaultUseHoverStateProps: UseHoverStateProps = {\n closingDelay: 200,\n isDisabled: false,\n}\n\n/**\n * @param props See UseHoverStateProps\n *\n * A react hook for managing the hover state of a component. The handlers provided should be\n * forwarded to the component which should be hovered over\n */\nexport const useHoverState = (props: Partial<UseHoverStateProps> | undefined = undefined): UseHoverStateReturnType => {\n const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props }\n\n const [isHovered, setIsHovered] = useState(false)\n const [timer, setTimer] = useState<NodeJS.Timeout>()\n\n const onMouseEnter = () => {\n if (isDisabled) {\n return\n }\n clearTimeout(timer)\n setIsHovered(true)\n }\n\n const onMouseLeave = () => {\n if (isDisabled) {\n return\n }\n setTimer(setTimeout(() => {\n setIsHovered(false)\n }, closingDelay))\n }\n\n useEffect(() => {\n if (timer) {\n return () => {\n clearTimeout(timer)\n }\n }\n })\n\n useEffect(() => {\n if (timer) {\n clearTimeout(timer)\n }\n }, [isDisabled]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return {\n isHovered, setIsHovered, handlers: { onMouseEnter, onMouseLeave }\n }\n}\n"],"mappings":";;;;;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QAAM,kBAAkB;AAAA,IACtB,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAEA,QAAM,gBAAiD;AAAA,IACrD,KAAK,EAAE,aAAa,GAAG,YAAY,MAAM,YAAY,QAAQ,YAAY,KAAK;AAAA,IAC9E,QAAQ,EAAE,aAAa,KAAK,YAAY,MAAM,YAAY,MAAM,YAAY,KAAK;AAAA,IACjF,MAAM,EAAE,aAAa,GAAG,YAAY,QAAQ,YAAY,MAAM,YAAY,KAAK;AAAA,IAC/E,OAAO,EAAE,aAAa,GAAG,YAAY,MAAM,YAAY,MAAM,YAAY,OAAO;AAAA,EAClF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,kBAAK,yBAAyB,kBAAkB;AAAA,MAC1D,GAAG;AAAA,MAEH;AAAA;AAAA,QACA,aACC;AAAA,UAAC;AAAA;AAAA,YACC,eAAW;AAAA,cACT;AAAA;AAAA,cAEA,gBAAgB,QAAQ;AAAA,cAAG;AAAA,YAC7B;AAAA,YACA,OAAO,EAAE,QAAQ,gBAAgB,iBAAiB,KAAK;AAAA,YAEtD;AAAA;AAAA,cACD;AAAA,gBAAC;AAAA;AAAA,kBACC,eAAW,kBAAK,oBAAoB,gBAAgB,QAAQ,CAAC;AAAA,kBAC7D,OAAO,EAAE,GAAG,cAAc,QAAQ,GAAG,OAAO;AAAA;AAAA,cAC9C;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -29,7 +29,7 @@ type TooltipProps = PropsWithChildren<{
|
|
|
29
29
|
* @param tooltipClassName Additional ClassNames for the Container of the tooltip
|
|
30
30
|
* @param containerClassName Additional ClassNames for the Container holding the content
|
|
31
31
|
* @param position The direction of the tooltip relative to the Container
|
|
32
|
-
* @param zIndex The z Index of the tooltip (you may require this when stacking
|
|
32
|
+
* @param zIndex The z Index of the tooltip (you may require this when stacking modal)
|
|
33
33
|
* @constructor
|
|
34
34
|
*/
|
|
35
35
|
declare const Tooltip: ({ tooltip, children, animationDelay, tooltipClassName, containerClassName, position, zIndex, }: TooltipProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -29,7 +29,7 @@ type TooltipProps = PropsWithChildren<{
|
|
|
29
29
|
* @param tooltipClassName Additional ClassNames for the Container of the tooltip
|
|
30
30
|
* @param containerClassName Additional ClassNames for the Container holding the content
|
|
31
31
|
* @param position The direction of the tooltip relative to the Container
|
|
32
|
-
* @param zIndex The z Index of the tooltip (you may require this when stacking
|
|
32
|
+
* @param zIndex The z Index of the tooltip (you may require this when stacking modal)
|
|
33
33
|
* @constructor
|
|
34
34
|
*/
|
|
35
35
|
declare const Tooltip: ({ tooltip, children, animationDelay, tooltipClassName, containerClassName, position, zIndex, }: TooltipProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -42,7 +42,7 @@ var useHoverState = (props = void 0) => {
|
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
// src/components/Tooltip.tsx
|
|
45
|
+
// src/components/user-action/Tooltip.tsx
|
|
46
46
|
import { clsx } from "clsx";
|
|
47
47
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
48
48
|
var Tooltip = ({
|
|
@@ -63,10 +63,10 @@ var Tooltip = ({
|
|
|
63
63
|
};
|
|
64
64
|
const triangleSize = 6;
|
|
65
65
|
const triangleClasses = {
|
|
66
|
-
top: `top-full left-1/2 -translate-x-1/2 border-t-
|
|
67
|
-
bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-
|
|
68
|
-
left: `left-full top-1/2 -translate-y-1/2 border-l-
|
|
69
|
-
right: `right-full top-1/2 -translate-y-1/2 border-r-
|
|
66
|
+
top: `top-full left-1/2 -translate-x-1/2 border-t-tooltip-background border-l-transparent border-r-transparent`,
|
|
67
|
+
bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-tooltip-background border-l-transparent border-r-transparent`,
|
|
68
|
+
left: `left-full top-1/2 -translate-y-1/2 border-l-tooltip-background border-t-transparent border-b-transparent`,
|
|
69
|
+
right: `right-full top-1/2 -translate-y-1/2 border-r-tooltip-background border-t-transparent border-b-transparent`
|
|
70
70
|
};
|
|
71
71
|
const triangleStyle = {
|
|
72
72
|
top: { borderWidth: `${triangleSize}px ${triangleSize}px 0 ${triangleSize}px` },
|
|
@@ -84,8 +84,12 @@ var Tooltip = ({
|
|
|
84
84
|
isHovered && /* @__PURE__ */ jsxs(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
|
-
className: clsx(
|
|
88
|
-
|
|
87
|
+
className: clsx(
|
|
88
|
+
`opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
|
|
89
|
+
animate-tooltip-fade-in shadow-lg bg-tooltip-background`,
|
|
90
|
+
positionClasses[position],
|
|
91
|
+
tooltipClassName
|
|
92
|
+
),
|
|
89
93
|
style: { zIndex, animationDelay: animationDelay + "ms" },
|
|
90
94
|
children: [
|
|
91
95
|
tooltip,
|
|
@@ -106,4 +110,4 @@ var Tooltip = ({
|
|
|
106
110
|
export {
|
|
107
111
|
Tooltip
|
|
108
112
|
};
|
|
109
|
-
//# sourceMappingURL=Tooltip.
|
|
113
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/useHoverState.ts","../../../src/components/user-action/Tooltip.tsx"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react'\nimport { useEffect, useState } from 'react'\n\ntype UseHoverStateProps = {\n /**\n * The delay after which the menu is closed in milliseconds\n *\n * default: 200ms\n */\n closingDelay: number,\n /**\n * Whether the hover state management should be disabled\n *\n * default: false\n */\n isDisabled: boolean,\n}\n\ntype UseHoverStateReturnType = {\n /**\n * Whether the element is hovered\n */\n isHovered: boolean,\n /**\n * Function to change the current hover status\n */\n setIsHovered: Dispatch<SetStateAction<boolean>>,\n /**\n * Handlers to pass on to the component that should be hovered\n */\n handlers: {\n onMouseEnter: () => void,\n onMouseLeave: () => void,\n },\n}\n\nconst defaultUseHoverStateProps: UseHoverStateProps = {\n closingDelay: 200,\n isDisabled: false,\n}\n\n/**\n * @param props See UseHoverStateProps\n *\n * A react hook for managing the hover state of a component. The handlers provided should be\n * forwarded to the component which should be hovered over\n */\nexport const useHoverState = (props: Partial<UseHoverStateProps> | undefined = undefined): UseHoverStateReturnType => {\n const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props }\n\n const [isHovered, setIsHovered] = useState(false)\n const [timer, setTimer] = useState<NodeJS.Timeout>()\n\n const onMouseEnter = () => {\n if (isDisabled) {\n return\n }\n clearTimeout(timer)\n setIsHovered(true)\n }\n\n const onMouseLeave = () => {\n if (isDisabled) {\n return\n }\n setTimer(setTimeout(() => {\n setIsHovered(false)\n }, closingDelay))\n }\n\n useEffect(() => {\n if (timer) {\n return () => {\n clearTimeout(timer)\n }\n }\n })\n\n useEffect(() => {\n if (timer) {\n clearTimeout(timer)\n }\n }, [isDisabled]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return {\n isHovered, setIsHovered, handlers: { onMouseEnter, onMouseLeave }\n }\n}\n","import type { CSSProperties, PropsWithChildren, ReactNode } from 'react'\nimport { useHoverState } from '@/hooks/useHoverState'\nimport { clsx } from 'clsx'\n\ntype Position = 'top' | 'bottom' | 'left' | 'right'\n\nexport type TooltipProps = PropsWithChildren<{\n tooltip: string | ReactNode,\n /**\n * Number of milliseconds until the tooltip appears\n *\n * defaults to 1000ms\n */\n animationDelay?: number,\n /**\n * Class names of additional styling properties for the tooltip\n */\n tooltipClassName?: string,\n /**\n * Class names of additional styling properties for the container from which the tooltip will be created\n */\n containerClassName?: string,\n position?: Position,\n zIndex?: number,\n}>\n\n/**\n * A Component for showing a tooltip when hovering over Content\n * @param tooltip The tooltip to show can be a text or any ReactNode\n * @param children The Content for which the tooltip should be created\n * @param animationDelay The delay before the tooltip appears\n * @param tooltipClassName Additional ClassNames for the Container of the tooltip\n * @param containerClassName Additional ClassNames for the Container holding the content\n * @param position The direction of the tooltip relative to the Container\n * @param zIndex The z Index of the tooltip (you may require this when stacking modal)\n * @constructor\n */\nexport const Tooltip = ({\n tooltip,\n children,\n animationDelay = 650,\n tooltipClassName = '',\n containerClassName = '',\n position = 'bottom',\n zIndex = 10,\n }: TooltipProps) => {\n const { isHovered, handlers } = useHoverState()\n\n const positionClasses = {\n top: `bottom-full left-1/2 -translate-x-1/2 mb-[6px]`,\n bottom: `top-full left-1/2 -translate-x-1/2 mt-[6px]`,\n left: `right-full top-1/2 -translate-y-1/2 mr-[6px]`,\n right: `left-full top-1/2 -translate-y-1/2 ml-[6px]`\n }\n\n const triangleSize = 6\n const triangleClasses = {\n top: `top-full left-1/2 -translate-x-1/2 border-t-tooltip-background border-l-transparent border-r-transparent`,\n bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-tooltip-background border-l-transparent border-r-transparent`,\n left: `left-full top-1/2 -translate-y-1/2 border-l-tooltip-background border-t-transparent border-b-transparent`,\n right: `right-full top-1/2 -translate-y-1/2 border-r-tooltip-background border-t-transparent border-b-transparent`\n }\n\n const triangleStyle: Record<Position, CSSProperties> = {\n top: { borderWidth: `${triangleSize}px ${triangleSize}px 0 ${triangleSize}px` },\n bottom: { borderWidth: `0 ${triangleSize}px ${triangleSize}px ${triangleSize}px` },\n left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },\n right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }\n }\n\n return (\n <div\n className={clsx('relative inline-block', containerClassName)}\n {...handlers}\n >\n {children}\n {isHovered && (\n <div\n className={clsx(\n `opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap\n animate-tooltip-fade-in shadow-lg bg-tooltip-background`,\n positionClasses[position], tooltipClassName\n )}\n style={{ zIndex, animationDelay: animationDelay + 'ms' }}\n >\n {tooltip}\n <div\n className={clsx(`absolute w-0 h-0`, triangleClasses[position])}\n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