@helpwave/hightide 0.1.26 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coloring/index.d.mts +2 -0
- package/dist/coloring/index.d.ts +2 -0
- package/dist/coloring/index.js +85 -0
- package/dist/coloring/index.js.map +1 -0
- package/dist/coloring/index.mjs +48 -0
- package/dist/coloring/index.mjs.map +1 -0
- package/dist/components/branding/index.d.mts +3 -0
- package/dist/components/branding/index.d.ts +3 -0
- package/dist/components/branding/index.js +140 -0
- package/dist/components/branding/index.js.map +1 -0
- package/dist/components/branding/index.mjs +104 -0
- package/dist/components/branding/index.mjs.map +1 -0
- package/dist/components/date/DatePicker.js +1 -1
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +1 -1
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +1 -1
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +1 -1
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/date/index.d.mts +10 -0
- package/dist/components/date/index.d.ts +10 -0
- package/dist/components/date/index.js +1168 -0
- package/dist/components/date/index.js.map +1 -0
- package/dist/components/date/index.mjs +1124 -0
- package/dist/components/date/index.mjs.map +1 -0
- package/dist/components/dialog/ConfirmDialog.d.mts +1 -1
- package/dist/components/dialog/ConfirmDialog.d.ts +1 -1
- package/dist/components/dialog/ConfirmDialog.js +2 -2
- package/dist/components/dialog/ConfirmDialog.js.map +1 -1
- package/dist/components/dialog/ConfirmDialog.mjs +2 -2
- package/dist/components/dialog/ConfirmDialog.mjs.map +1 -1
- package/dist/components/dialog/Dialog.d.mts +1 -1
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/Dialog.js +2 -2
- package/dist/components/dialog/Dialog.js.map +1 -1
- package/dist/components/dialog/Dialog.mjs +2 -2
- package/dist/components/dialog/Dialog.mjs.map +1 -1
- package/dist/components/dialog/DiscardChangesDialog.d.mts +1 -1
- package/dist/components/dialog/DiscardChangesDialog.d.ts +1 -1
- package/dist/components/dialog/DiscardChangesDialog.js +2 -2
- package/dist/components/dialog/DiscardChangesDialog.js.map +1 -1
- package/dist/components/dialog/DiscardChangesDialog.mjs +2 -2
- package/dist/components/dialog/DiscardChangesDialog.mjs.map +1 -1
- package/dist/components/dialog/InputDialog.d.mts +1 -1
- package/dist/components/dialog/InputDialog.d.ts +1 -1
- package/dist/components/dialog/InputDialog.js +2 -2
- package/dist/components/dialog/InputDialog.js.map +1 -1
- package/dist/components/dialog/InputDialog.mjs +2 -2
- package/dist/components/dialog/InputDialog.mjs.map +1 -1
- package/dist/components/dialog/LanguageDialog.d.mts +1 -1
- package/dist/components/dialog/LanguageDialog.d.ts +1 -1
- package/dist/components/dialog/LanguageDialog.js +28 -15
- package/dist/components/dialog/LanguageDialog.js.map +1 -1
- package/dist/components/dialog/LanguageDialog.mjs +28 -15
- package/dist/components/dialog/LanguageDialog.mjs.map +1 -1
- package/dist/components/dialog/ThemeDialog.d.mts +1 -1
- package/dist/components/dialog/ThemeDialog.d.ts +1 -1
- package/dist/components/dialog/ThemeDialog.js +69 -33
- package/dist/components/dialog/ThemeDialog.js.map +1 -1
- package/dist/components/dialog/ThemeDialog.mjs +60 -24
- package/dist/components/dialog/ThemeDialog.mjs.map +1 -1
- package/dist/components/dialog/index.d.mts +1 -1
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/index.js +61 -25
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/index.mjs +61 -25
- package/dist/components/dialog/index.mjs.map +1 -1
- package/dist/components/form/index.d.mts +5 -0
- package/dist/components/form/index.d.ts +5 -0
- package/dist/components/form/index.js +100 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/form/index.mjs +64 -0
- package/dist/components/form/index.mjs.map +1 -0
- package/dist/components/icons-and-geometry/index.d.mts +7 -0
- package/dist/components/icons-and-geometry/index.d.ts +7 -0
- package/dist/components/icons-and-geometry/index.js +3955 -0
- package/dist/components/icons-and-geometry/index.js.map +1 -0
- package/dist/components/icons-and-geometry/index.mjs +3939 -0
- package/dist/components/icons-and-geometry/index.mjs.map +1 -0
- package/dist/components/index.d.mts +83 -0
- package/dist/components/index.d.ts +83 -0
- package/dist/components/index.js +15471 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +15377 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/layout/Carousel.d.mts +33 -0
- package/dist/components/layout/Carousel.d.ts +33 -0
- package/dist/components/layout/Carousel.js +684 -0
- package/dist/components/layout/Carousel.js.map +1 -0
- package/dist/components/layout/Carousel.mjs +659 -0
- package/dist/components/layout/Carousel.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/Chip.js +1 -1
- package/dist/components/layout/Chip.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/Chip.mjs +1 -1
- package/dist/components/layout/Chip.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/DividerInserter.js +1 -1
- package/dist/components/layout/DividerInserter.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/DividerInserter.mjs +1 -1
- package/dist/components/layout/DividerInserter.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/Expandable.js +2 -2
- package/dist/components/layout/Expandable.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/Expandable.mjs +2 -2
- package/dist/components/layout/Expandable.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/FAQSection.js +5 -5
- package/dist/components/layout/FAQSection.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/FAQSection.mjs +5 -5
- package/dist/components/layout/FAQSection.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/FloatingContainer.js +2 -2
- package/dist/components/layout/FloatingContainer.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/FloatingContainer.mjs +2 -2
- package/dist/components/layout/FloatingContainer.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/ListBox.js +2 -2
- package/dist/components/layout/ListBox.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/ListBox.mjs +2 -2
- package/dist/components/layout/ListBox.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/MarkdownInterpreter.js +1 -1
- package/dist/components/layout/MarkdownInterpreter.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/MarkdownInterpreter.mjs +1 -1
- package/dist/components/layout/MarkdownInterpreter.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/ScrollArea.js +2 -2
- package/dist/components/layout/ScrollArea.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/ScrollArea.mjs +1 -1
- package/dist/components/layout/ScrollArea.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/TextImage.js +3 -3
- package/dist/components/layout/TextImage.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/TextImage.mjs +2 -2
- package/dist/components/layout/TextImage.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/VerticalDivider.js +1 -1
- package/dist/components/layout/VerticalDivider.js.map +1 -0
- package/dist/components/{layout-and-navigation → layout}/VerticalDivider.mjs +1 -1
- package/dist/components/layout/VerticalDivider.mjs.map +1 -0
- package/dist/components/layout/index.d.mts +18 -0
- package/dist/components/layout/index.d.ts +18 -0
- package/dist/components/layout/index.js +3111 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/layout/index.mjs +3064 -0
- package/dist/components/layout/index.mjs.map +1 -0
- package/dist/components/loading-states/index.d.mts +12 -0
- package/dist/components/loading-states/index.d.ts +12 -0
- package/dist/components/loading-states/index.js +614 -0
- package/dist/components/loading-states/index.js.map +1 -0
- package/dist/components/loading-states/index.mjs +573 -0
- package/dist/components/loading-states/index.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/BreadCrumb.js +1 -1
- package/dist/components/navigation/BreadCrumb.js.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/BreadCrumb.mjs +1 -1
- package/dist/components/navigation/BreadCrumb.mjs.map +1 -0
- package/dist/components/navigation/Navigation.d.mts +21 -0
- package/dist/components/navigation/Navigation.d.ts +21 -0
- package/dist/components/navigation/Navigation.js +4018 -0
- package/dist/components/navigation/Navigation.js.map +1 -0
- package/dist/components/navigation/Navigation.mjs +4012 -0
- package/dist/components/navigation/Navigation.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/Pagination.js +3 -3
- package/dist/components/navigation/Pagination.js.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/Pagination.mjs +3 -3
- package/dist/components/navigation/Pagination.mjs.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/StepperBar.js +3 -3
- package/dist/components/navigation/StepperBar.js.map +1 -0
- package/dist/components/{layout-and-navigation → navigation}/StepperBar.mjs +3 -3
- package/dist/components/navigation/StepperBar.mjs.map +1 -0
- package/dist/components/navigation/index.d.mts +9 -0
- package/dist/components/navigation/index.d.ts +9 -0
- package/dist/components/navigation/index.js +4660 -0
- package/dist/components/navigation/index.js.map +1 -0
- package/dist/components/navigation/index.mjs +4648 -0
- package/dist/components/navigation/index.mjs.map +1 -0
- package/dist/components/properties/MultiSelectProperty.js +27 -14
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +27 -14
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.js +27 -14
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +27 -14
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/index.d.mts +12 -0
- package/dist/components/properties/index.d.ts +12 -0
- package/dist/components/properties/index.js +2983 -0
- package/dist/components/properties/index.js.map +1 -0
- package/dist/components/properties/index.mjs +2951 -0
- package/dist/components/properties/index.mjs.map +1 -0
- package/dist/components/table/Table.js +1 -1
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +1 -1
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/index.d.mts +10 -0
- package/dist/components/table/index.d.ts +10 -0
- package/dist/components/table/index.js +2329 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/index.mjs +2293 -0
- package/dist/components/table/index.mjs.map +1 -0
- package/dist/components/user-action/DateAndTimePicker.js +1 -1
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/index.d.mts +30 -0
- package/dist/components/user-action/index.d.ts +30 -0
- package/dist/components/user-action/index.js +4257 -0
- package/dist/components/user-action/index.js.map +1 -0
- package/dist/components/user-action/index.mjs +4195 -0
- package/dist/components/user-action/index.mjs.map +1 -0
- package/dist/components/user-action/input/index.d.mts +6 -0
- package/dist/components/user-action/input/index.d.ts +6 -0
- package/dist/components/user-action/input/index.js +398 -0
- package/dist/components/user-action/input/index.js.map +1 -0
- package/dist/components/user-action/input/index.mjs +357 -0
- package/dist/components/user-action/input/index.mjs.map +1 -0
- package/dist/components/user-action/select/Select.d.mts +5 -1
- package/dist/components/user-action/select/Select.d.ts +5 -1
- package/dist/components/user-action/select/Select.js +27 -14
- package/dist/components/user-action/select/Select.js.map +1 -1
- package/dist/components/user-action/select/Select.mjs +27 -14
- package/dist/components/user-action/select/Select.mjs.map +1 -1
- package/dist/components/user-action/select/index.d.mts +4 -0
- package/dist/components/user-action/select/index.d.ts +4 -0
- package/dist/components/user-action/select/index.js +1369 -0
- package/dist/components/user-action/select/index.js.map +1 -0
- package/dist/components/user-action/select/index.mjs +1333 -0
- package/dist/components/user-action/select/index.mjs.map +1 -0
- package/dist/components/utils/index.d.mts +4 -0
- package/dist/components/utils/index.d.ts +4 -0
- package/dist/components/utils/index.js +302 -0
- package/dist/components/utils/index.js.map +1 -0
- package/dist/components/utils/index.mjs +275 -0
- package/dist/components/utils/index.mjs.map +1 -0
- package/dist/hooks/focus/index.d.mts +6 -0
- package/dist/hooks/focus/index.d.ts +6 -0
- package/dist/hooks/focus/index.js +379 -0
- package/dist/hooks/focus/index.js.map +1 -0
- package/dist/hooks/focus/index.mjs +339 -0
- package/dist/hooks/focus/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +16 -0
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/index.js +844 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +794 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +110 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +16101 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +15941 -0
- package/dist/index.mjs.map +1 -0
- package/dist/localization/defaults/index.d.mts +4 -0
- package/dist/localization/defaults/index.d.ts +4 -0
- package/dist/localization/defaults/index.js +223 -0
- package/dist/localization/defaults/index.js.map +1 -0
- package/dist/localization/defaults/index.mjs +195 -0
- package/dist/localization/defaults/index.mjs.map +1 -0
- package/dist/localization/index.d.mts +7 -0
- package/dist/localization/index.d.ts +7 -0
- package/dist/localization/index.js +415 -0
- package/dist/localization/index.js.map +1 -0
- package/dist/localization/index.mjs +380 -0
- package/dist/localization/index.mjs.map +1 -0
- package/dist/style/globals.css +63 -10
- package/dist/style/uncompiled/globals.css +5 -4
- package/dist/style/uncompiled/utitlity/shadow.css +4 -0
- package/dist/theming/index.d.mts +5 -0
- package/dist/theming/index.d.ts +5 -0
- package/dist/theming/index.js +174 -0
- package/dist/theming/index.js.map +1 -0
- package/dist/theming/index.mjs +145 -0
- package/dist/theming/index.mjs.map +1 -0
- package/dist/theming/useTheme.d.mts +3 -1
- package/dist/theming/useTheme.d.ts +3 -1
- package/dist/theming/useTheme.js +40 -17
- package/dist/theming/useTheme.js.map +1 -1
- package/dist/theming/useTheme.mjs +38 -15
- package/dist/theming/useTheme.mjs.map +1 -1
- package/dist/utils/index.d.mts +15 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +553 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +493 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +25 -24
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +0 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Carousel.d.mts +0 -25
- package/dist/components/layout-and-navigation/Carousel.d.ts +0 -25
- package/dist/components/layout-and-navigation/Carousel.js +0 -643
- package/dist/components/layout-and-navigation/Carousel.js.map +0 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +0 -609
- package/dist/components/layout-and-navigation/Carousel.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Chip.js.map +0 -1
- package/dist/components/layout-and-navigation/Chip.mjs.map +0 -1
- package/dist/components/layout-and-navigation/DividerInserter.js.map +0 -1
- package/dist/components/layout-and-navigation/DividerInserter.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Expandable.js.map +0 -1
- package/dist/components/layout-and-navigation/Expandable.mjs.map +0 -1
- package/dist/components/layout-and-navigation/FAQSection.js.map +0 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +0 -1
- package/dist/components/layout-and-navigation/FloatingContainer.js.map +0 -1
- package/dist/components/layout-and-navigation/FloatingContainer.mjs.map +0 -1
- package/dist/components/layout-and-navigation/ListBox.js.map +0 -1
- package/dist/components/layout-and-navigation/ListBox.mjs.map +0 -1
- package/dist/components/layout-and-navigation/MarkdownInterpreter.js.map +0 -1
- package/dist/components/layout-and-navigation/MarkdownInterpreter.mjs.map +0 -1
- package/dist/components/layout-and-navigation/Pagination.js.map +0 -1
- package/dist/components/layout-and-navigation/Pagination.mjs.map +0 -1
- package/dist/components/layout-and-navigation/ScrollArea.js.map +0 -1
- package/dist/components/layout-and-navigation/ScrollArea.mjs.map +0 -1
- package/dist/components/layout-and-navigation/StepperBar.js.map +0 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +0 -1
- package/dist/components/layout-and-navigation/TextImage.js.map +0 -1
- package/dist/components/layout-and-navigation/TextImage.mjs.map +0 -1
- package/dist/components/layout-and-navigation/VerticalDivider.js.map +0 -1
- package/dist/components/layout-and-navigation/VerticalDivider.mjs.map +0 -1
- /package/dist/components/{layout-and-navigation → layout}/Chip.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/Chip.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/DividerInserter.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/DividerInserter.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/Expandable.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/Expandable.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/FAQSection.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/FAQSection.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/FloatingContainer.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/FloatingContainer.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/ListBox.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/ListBox.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/MarkdownInterpreter.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/MarkdownInterpreter.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/ScrollArea.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/ScrollArea.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/TextImage.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/TextImage.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/VerticalDivider.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → layout}/VerticalDivider.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/BreadCrumb.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/BreadCrumb.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/Pagination.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/Pagination.d.ts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/StepperBar.d.mts +0 -0
- /package/dist/components/{layout-and-navigation → navigation}/StepperBar.d.ts +0 -0
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/hooks/index.ts
|
|
30
|
+
var hooks_exports = {};
|
|
31
|
+
__export(hooks_exports, {
|
|
32
|
+
useDelay: () => useDelay,
|
|
33
|
+
useFloatingElement: () => useFloatingElement,
|
|
34
|
+
useFocusGuards: () => useFocusGuards,
|
|
35
|
+
useFocusManagement: () => useFocusManagement,
|
|
36
|
+
useFocusOnceVisible: () => useFocusOnceVisible,
|
|
37
|
+
useFocusTrap: () => useFocusTrap,
|
|
38
|
+
useHoverState: () => useHoverState,
|
|
39
|
+
useIsMounted: () => useIsMounted,
|
|
40
|
+
useLocalStorage: () => useLocalStorage,
|
|
41
|
+
useLogOnce: () => useLogOnce,
|
|
42
|
+
useOutsideClick: () => useOutsideClick,
|
|
43
|
+
usePopoverPosition: () => usePopoverPosition,
|
|
44
|
+
useRerender: () => useRerender,
|
|
45
|
+
useResizeCallbackWrapper: () => useResizeCallbackWrapper,
|
|
46
|
+
useSearch: () => useSearch
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
49
|
+
|
|
50
|
+
// src/hooks/focus/useFocusGuards.ts
|
|
51
|
+
var import_react = require("react");
|
|
52
|
+
var selectorName = "data-hw-focus-guard";
|
|
53
|
+
function FocusGuard() {
|
|
54
|
+
const element = document.createElement("div");
|
|
55
|
+
element.setAttribute(selectorName, "");
|
|
56
|
+
element.tabIndex = 0;
|
|
57
|
+
element.style.border = "none";
|
|
58
|
+
element.style.outline = "none";
|
|
59
|
+
element.style.boxShadow = "none";
|
|
60
|
+
element.style.opacity = "0";
|
|
61
|
+
element.style.position = "fixed";
|
|
62
|
+
element.style.pointerEvents = "none";
|
|
63
|
+
return element;
|
|
64
|
+
}
|
|
65
|
+
var FocusGuardsService = class _FocusGuardsService {
|
|
66
|
+
constructor() {
|
|
67
|
+
this.count = 0;
|
|
68
|
+
}
|
|
69
|
+
static getInstance() {
|
|
70
|
+
if (!_FocusGuardsService.instance) {
|
|
71
|
+
_FocusGuardsService.instance = new _FocusGuardsService();
|
|
72
|
+
}
|
|
73
|
+
return _FocusGuardsService.instance;
|
|
74
|
+
}
|
|
75
|
+
add() {
|
|
76
|
+
const edgeGuards = document.querySelectorAll(`[${selectorName}]`);
|
|
77
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? FocusGuard());
|
|
78
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? FocusGuard());
|
|
79
|
+
this.count++;
|
|
80
|
+
}
|
|
81
|
+
remove() {
|
|
82
|
+
if (this.count === 1) {
|
|
83
|
+
document.querySelectorAll(`[${selectorName}]`).forEach((node) => node.remove());
|
|
84
|
+
}
|
|
85
|
+
this.count--;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var useFocusGuards = () => {
|
|
89
|
+
(0, import_react.useEffect)(() => {
|
|
90
|
+
FocusGuardsService.getInstance().add();
|
|
91
|
+
return () => {
|
|
92
|
+
FocusGuardsService.getInstance().remove();
|
|
93
|
+
};
|
|
94
|
+
}, []);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/hooks/focus/useFocusManagement.ts
|
|
98
|
+
var import_react2 = require("react");
|
|
99
|
+
function useFocusManagement() {
|
|
100
|
+
const getFocusableElements = (0, import_react2.useCallback)(() => {
|
|
101
|
+
return Array.from(
|
|
102
|
+
document.querySelectorAll(
|
|
103
|
+
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
104
|
+
)
|
|
105
|
+
).filter(
|
|
106
|
+
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
107
|
+
);
|
|
108
|
+
}, []);
|
|
109
|
+
const getNextFocusElement = (0, import_react2.useCallback)(() => {
|
|
110
|
+
const elements = getFocusableElements();
|
|
111
|
+
if (elements.length === 0) {
|
|
112
|
+
return void 0;
|
|
113
|
+
}
|
|
114
|
+
let nextElement = elements[0];
|
|
115
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
116
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
117
|
+
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
118
|
+
}
|
|
119
|
+
return nextElement;
|
|
120
|
+
}, [getFocusableElements]);
|
|
121
|
+
const focusNext = (0, import_react2.useCallback)(() => {
|
|
122
|
+
const nextElement = getNextFocusElement();
|
|
123
|
+
nextElement?.focus();
|
|
124
|
+
}, [getNextFocusElement]);
|
|
125
|
+
const getPreviousFocusElement = (0, import_react2.useCallback)(() => {
|
|
126
|
+
const elements = getFocusableElements();
|
|
127
|
+
if (elements.length === 0) {
|
|
128
|
+
return void 0;
|
|
129
|
+
}
|
|
130
|
+
let previousElement = elements[0];
|
|
131
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
132
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
133
|
+
if (currentIndex === 0) {
|
|
134
|
+
previousElement = elements[elements.length - 1];
|
|
135
|
+
} else {
|
|
136
|
+
previousElement = elements[currentIndex - 1];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return previousElement;
|
|
140
|
+
}, [getFocusableElements]);
|
|
141
|
+
const focusPrevious = (0, import_react2.useCallback)(() => {
|
|
142
|
+
const previousElement = getPreviousFocusElement();
|
|
143
|
+
if (previousElement) previousElement.focus();
|
|
144
|
+
}, [getPreviousFocusElement]);
|
|
145
|
+
return {
|
|
146
|
+
getFocusableElements,
|
|
147
|
+
getNextFocusElement,
|
|
148
|
+
getPreviousFocusElement,
|
|
149
|
+
focusNext,
|
|
150
|
+
focusPrevious
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/hooks/focus/useFocusOnceVisible.ts
|
|
155
|
+
var import_react3 = __toESM(require("react"));
|
|
156
|
+
var useFocusOnceVisible = (ref, disable = false) => {
|
|
157
|
+
const [hasUsedFocus, setHasUsedFocus] = import_react3.default.useState(false);
|
|
158
|
+
(0, import_react3.useEffect)(() => {
|
|
159
|
+
if (disable || hasUsedFocus) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
163
|
+
if (entry.isIntersecting && !hasUsedFocus) {
|
|
164
|
+
ref.current?.focus();
|
|
165
|
+
setHasUsedFocus(hasUsedFocus);
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
threshold: 0.1
|
|
169
|
+
});
|
|
170
|
+
if (ref.current) {
|
|
171
|
+
observer.observe(ref.current);
|
|
172
|
+
}
|
|
173
|
+
return () => observer.disconnect();
|
|
174
|
+
}, [disable, hasUsedFocus, ref]);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// src/hooks/focus/useFocusTrap.ts
|
|
178
|
+
var import_react5 = require("react");
|
|
179
|
+
|
|
180
|
+
// src/hooks/focus/useIsMounted.ts
|
|
181
|
+
var import_react4 = require("react");
|
|
182
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
183
|
+
var useIsomorphicEffect = isClient ? import_react4.useLayoutEffect : import_react4.useEffect;
|
|
184
|
+
var useIsMounted = () => {
|
|
185
|
+
const [isMounted, setIsMounted] = (0, import_react4.useState)(false);
|
|
186
|
+
useIsomorphicEffect(() => {
|
|
187
|
+
setIsMounted(true);
|
|
188
|
+
return () => {
|
|
189
|
+
setIsMounted(false);
|
|
190
|
+
};
|
|
191
|
+
}, []);
|
|
192
|
+
return isMounted;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// src/hooks/focus/useFocusTrap.ts
|
|
196
|
+
var createFocusGuard = () => {
|
|
197
|
+
const div = document.createElement("div");
|
|
198
|
+
Object.assign(div.style, {
|
|
199
|
+
opacity: "0",
|
|
200
|
+
outline: "none",
|
|
201
|
+
boxShadow: "none",
|
|
202
|
+
position: "fixed",
|
|
203
|
+
pointerEvents: "none",
|
|
204
|
+
touchAction: "none"
|
|
205
|
+
});
|
|
206
|
+
div.tabIndex = 0;
|
|
207
|
+
div.setAttribute("data-hw-focus-guard", "");
|
|
208
|
+
document.body.appendChild(div);
|
|
209
|
+
return div;
|
|
210
|
+
};
|
|
211
|
+
function getContainedFocusableElements(element) {
|
|
212
|
+
return element?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
213
|
+
}
|
|
214
|
+
var FocusTrapService = class {
|
|
215
|
+
constructor() {
|
|
216
|
+
// The last entry is always the active one
|
|
217
|
+
this.listeners = [];
|
|
218
|
+
this.onFocusIn = (event) => {
|
|
219
|
+
const active = this.getActive();
|
|
220
|
+
if (!active || !active.container.current) return;
|
|
221
|
+
const { container } = active;
|
|
222
|
+
if (!container.current.contains(event.target)) {
|
|
223
|
+
this.focusElement();
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
getActive() {
|
|
228
|
+
if (this.listeners.length === 0) return void 0;
|
|
229
|
+
return this.listeners[this.listeners.length - 1];
|
|
230
|
+
}
|
|
231
|
+
focusElement() {
|
|
232
|
+
const active = this.getActive();
|
|
233
|
+
if (!active) return;
|
|
234
|
+
const { container, initialFocusElement } = active;
|
|
235
|
+
const containerElement = container.current;
|
|
236
|
+
if (initialFocusElement?.current) {
|
|
237
|
+
initialFocusElement.current.focus();
|
|
238
|
+
} else {
|
|
239
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
240
|
+
if (elements && elements.length > 0) {
|
|
241
|
+
const first = elements.item(0);
|
|
242
|
+
first.focus();
|
|
243
|
+
} else {
|
|
244
|
+
containerElement.focus();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
removeGuards() {
|
|
249
|
+
document.querySelectorAll("[data-hw-focus-guard]").forEach((node) => node.remove());
|
|
250
|
+
}
|
|
251
|
+
addGuards() {
|
|
252
|
+
document.body.insertAdjacentElement("afterbegin", createFocusGuard());
|
|
253
|
+
document.body.insertAdjacentElement("beforeend", createFocusGuard());
|
|
254
|
+
}
|
|
255
|
+
activate() {
|
|
256
|
+
document.addEventListener("focusin", this.onFocusIn);
|
|
257
|
+
this.addGuards();
|
|
258
|
+
}
|
|
259
|
+
deactivate() {
|
|
260
|
+
document.removeEventListener("focusin", this.onFocusIn);
|
|
261
|
+
this.removeGuards();
|
|
262
|
+
}
|
|
263
|
+
register(listener) {
|
|
264
|
+
this.listeners.push(listener);
|
|
265
|
+
if (this.listeners.length === 1) {
|
|
266
|
+
this.activate();
|
|
267
|
+
}
|
|
268
|
+
const active = listener;
|
|
269
|
+
this.listeners.forEach((listener2) => {
|
|
270
|
+
const { focus, pause } = listener2;
|
|
271
|
+
if (listener2 === active) {
|
|
272
|
+
focus();
|
|
273
|
+
} else {
|
|
274
|
+
pause();
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
unregister(id) {
|
|
279
|
+
const index = this.listeners.findIndex((trap) => trap.id === id);
|
|
280
|
+
if (index !== -1) {
|
|
281
|
+
const isActive = index === this.listeners.length - 1;
|
|
282
|
+
const listener = this.listeners[index];
|
|
283
|
+
this.listeners = this.listeners.filter((listener2) => listener2.id !== id);
|
|
284
|
+
if (isActive) {
|
|
285
|
+
this.deactivate();
|
|
286
|
+
listener.focusLast();
|
|
287
|
+
const active = this.getActive();
|
|
288
|
+
this.listeners.forEach((listener2) => {
|
|
289
|
+
const { pause, unpause } = listener2;
|
|
290
|
+
if (listener2 === active) {
|
|
291
|
+
unpause();
|
|
292
|
+
} else {
|
|
293
|
+
pause();
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
if (this.listeners.length > 0) {
|
|
297
|
+
this.activate();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
console.warn(`Unable to unregister id ${id}: not found`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
var service = new FocusTrapService();
|
|
306
|
+
var useFocusTrap = ({
|
|
307
|
+
container,
|
|
308
|
+
active = true,
|
|
309
|
+
initialFocus,
|
|
310
|
+
focusFirst = true
|
|
311
|
+
}) => {
|
|
312
|
+
const lastFocusRef = (0, import_react5.useRef)(null);
|
|
313
|
+
const [paused, setPaused] = (0, import_react5.useState)(false);
|
|
314
|
+
const isMounted = useIsMounted();
|
|
315
|
+
const id = (0, import_react5.useId)();
|
|
316
|
+
const focusElement = (0, import_react5.useCallback)(() => {
|
|
317
|
+
const containerElement = container.current;
|
|
318
|
+
if (initialFocus?.current) {
|
|
319
|
+
initialFocus.current.focus();
|
|
320
|
+
} else {
|
|
321
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
322
|
+
if (elements && elements.length > 0) {
|
|
323
|
+
const first = elements.item(0);
|
|
324
|
+
first.focus();
|
|
325
|
+
} else {
|
|
326
|
+
containerElement.focus();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}, [container, initialFocus]);
|
|
330
|
+
(0, import_react5.useEffect)(() => {
|
|
331
|
+
if (active && isMounted) {
|
|
332
|
+
let pause = function() {
|
|
333
|
+
setPaused(true);
|
|
334
|
+
}, unpause = function() {
|
|
335
|
+
setPaused(false);
|
|
336
|
+
if (!container.current.contains(document.activeElement)) {
|
|
337
|
+
focusElement();
|
|
338
|
+
}
|
|
339
|
+
}, focus = function() {
|
|
340
|
+
focusElement();
|
|
341
|
+
setPaused(false);
|
|
342
|
+
}, focusLast = function() {
|
|
343
|
+
lastFocusRef.current?.focus();
|
|
344
|
+
};
|
|
345
|
+
if (!lastFocusRef.current) {
|
|
346
|
+
lastFocusRef.current = document.activeElement;
|
|
347
|
+
}
|
|
348
|
+
service.register({ id, pause, focus, focusLast, unpause, container, initialFocusElement: initialFocus });
|
|
349
|
+
return () => {
|
|
350
|
+
service.unregister(id);
|
|
351
|
+
lastFocusRef.current = void 0;
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}, [active, container, focusElement, id, initialFocus, isMounted]);
|
|
355
|
+
(0, import_react5.useEffect)(() => {
|
|
356
|
+
if (active && !paused && isMounted) {
|
|
357
|
+
let onKeyDown = function(event) {
|
|
358
|
+
const key = event.key;
|
|
359
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
360
|
+
const active2 = document.activeElement;
|
|
361
|
+
const index = [...elements].findIndex((value) => value === active2);
|
|
362
|
+
if (index === -1 || event.altKey || event.ctrlKey || event.metaKey) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (key === "Tab") {
|
|
366
|
+
const next = event.shiftKey ? -1 : 1;
|
|
367
|
+
const nextIndex = (index + next + elements.length) % elements.length;
|
|
368
|
+
const nextElement = elements[nextIndex];
|
|
369
|
+
nextElement.focus();
|
|
370
|
+
event.preventDefault();
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
const containerElement = container.current;
|
|
374
|
+
containerElement.addEventListener("keydown", onKeyDown);
|
|
375
|
+
return () => {
|
|
376
|
+
containerElement.removeEventListener("keydown", onKeyDown);
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
}, [active, paused, isMounted, container, initialFocus, focusFirst, focusElement]);
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
// src/hooks/useDelay.ts
|
|
383
|
+
var import_react6 = require("react");
|
|
384
|
+
var defaultOptions = {
|
|
385
|
+
delay: 3e3,
|
|
386
|
+
disabled: false
|
|
387
|
+
};
|
|
388
|
+
function useDelay(options) {
|
|
389
|
+
const [timer, setTimer] = (0, import_react6.useState)(void 0);
|
|
390
|
+
const { delay, disabled } = {
|
|
391
|
+
...defaultOptions,
|
|
392
|
+
...options
|
|
393
|
+
};
|
|
394
|
+
const clearTimer = () => {
|
|
395
|
+
clearTimeout(timer);
|
|
396
|
+
setTimer(void 0);
|
|
397
|
+
};
|
|
398
|
+
const restartTimer = (onDelayFinish) => {
|
|
399
|
+
if (disabled) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
clearTimeout(timer);
|
|
403
|
+
setTimer(setTimeout(() => {
|
|
404
|
+
onDelayFinish();
|
|
405
|
+
setTimer(void 0);
|
|
406
|
+
}, delay));
|
|
407
|
+
};
|
|
408
|
+
(0, import_react6.useEffect)(() => {
|
|
409
|
+
return () => {
|
|
410
|
+
clearTimeout(timer);
|
|
411
|
+
};
|
|
412
|
+
}, [timer]);
|
|
413
|
+
(0, import_react6.useEffect)(() => {
|
|
414
|
+
if (disabled) {
|
|
415
|
+
clearTimeout(timer);
|
|
416
|
+
setTimer(void 0);
|
|
417
|
+
}
|
|
418
|
+
}, [disabled, timer]);
|
|
419
|
+
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// src/hooks/useFloatingElement.ts
|
|
423
|
+
var import_react7 = require("react");
|
|
424
|
+
|
|
425
|
+
// src/utils/math.ts
|
|
426
|
+
var clamp = (value, range = [0, 1]) => {
|
|
427
|
+
const [min, max] = range;
|
|
428
|
+
return Math.min(Math.max(value, min), max);
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// src/hooks/useFloatingElement.ts
|
|
432
|
+
function calculatePosition({
|
|
433
|
+
windowRect,
|
|
434
|
+
containerRect,
|
|
435
|
+
anchorRect,
|
|
436
|
+
options
|
|
437
|
+
}) {
|
|
438
|
+
const { verticalAlignment, horizontalAlignment, gap, screenPadding } = options;
|
|
439
|
+
const windowWidth = windowRect.width;
|
|
440
|
+
const windowHeight = windowRect.height;
|
|
441
|
+
const maxWidth = windowWidth - 2 * screenPadding;
|
|
442
|
+
const maxHeight = windowHeight - 2 * screenPadding;
|
|
443
|
+
const width = Math.min(containerRect.width, maxWidth);
|
|
444
|
+
const height = Math.min(containerRect.height, maxHeight);
|
|
445
|
+
const leftSuggestion = {
|
|
446
|
+
beforeStart: anchorRect.left - width - gap,
|
|
447
|
+
afterStart: anchorRect.left,
|
|
448
|
+
center: anchorRect.left + anchorRect.width / 2 - width / 2,
|
|
449
|
+
beforeEnd: anchorRect.right - width,
|
|
450
|
+
afterEnd: anchorRect.right + gap
|
|
451
|
+
}[horizontalAlignment];
|
|
452
|
+
const topSuggestion = {
|
|
453
|
+
beforeStart: anchorRect.top - height - gap,
|
|
454
|
+
afterStart: anchorRect.top,
|
|
455
|
+
center: anchorRect.top + anchorRect.height / 2 - height / 2,
|
|
456
|
+
beforeEnd: anchorRect.bottom - height,
|
|
457
|
+
afterEnd: anchorRect.bottom + gap
|
|
458
|
+
}[verticalAlignment];
|
|
459
|
+
const left = clamp(leftSuggestion, [
|
|
460
|
+
screenPadding,
|
|
461
|
+
windowWidth - screenPadding - width
|
|
462
|
+
]);
|
|
463
|
+
const top = clamp(topSuggestion, [
|
|
464
|
+
screenPadding,
|
|
465
|
+
windowHeight - screenPadding - height
|
|
466
|
+
]);
|
|
467
|
+
return {
|
|
468
|
+
left,
|
|
469
|
+
top,
|
|
470
|
+
maxWidth,
|
|
471
|
+
maxHeight
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function useFloatingElement({
|
|
475
|
+
active = true,
|
|
476
|
+
windowRef,
|
|
477
|
+
anchorRef,
|
|
478
|
+
containerRef,
|
|
479
|
+
isPolling = false,
|
|
480
|
+
pollingInterval = 100,
|
|
481
|
+
verticalAlignment = "afterEnd",
|
|
482
|
+
horizontalAlignment = "afterStart",
|
|
483
|
+
screenPadding = 16,
|
|
484
|
+
gap = 4
|
|
485
|
+
}) {
|
|
486
|
+
const [style, setStyle] = (0, import_react7.useState)();
|
|
487
|
+
const isMounted = useIsMounted();
|
|
488
|
+
const calculate = (0, import_react7.useCallback)(() => {
|
|
489
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
490
|
+
const windowRect = windowRef?.current.getBoundingClientRect() ?? {
|
|
491
|
+
top: 0,
|
|
492
|
+
bottom: window.innerHeight,
|
|
493
|
+
left: 0,
|
|
494
|
+
right: window.innerWidth,
|
|
495
|
+
width: window.innerWidth,
|
|
496
|
+
height: window.innerHeight
|
|
497
|
+
};
|
|
498
|
+
const anchorElement = anchorRef?.current;
|
|
499
|
+
if (anchorRef && !anchorElement) {
|
|
500
|
+
console.warn("FloatingContainer anchor provided, but its value is undefined");
|
|
501
|
+
}
|
|
502
|
+
const anchorRect = anchorElement?.getBoundingClientRect() ?? windowRect;
|
|
503
|
+
const calculateProps = {
|
|
504
|
+
windowRect,
|
|
505
|
+
anchorRect,
|
|
506
|
+
containerRect,
|
|
507
|
+
options: {
|
|
508
|
+
horizontalAlignment,
|
|
509
|
+
verticalAlignment,
|
|
510
|
+
screenPadding,
|
|
511
|
+
gap
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
setStyle(calculatePosition(calculateProps));
|
|
515
|
+
}, [anchorRef, containerRef, gap, horizontalAlignment, screenPadding, verticalAlignment, windowRef]);
|
|
516
|
+
const height = containerRef.current?.getBoundingClientRect().height;
|
|
517
|
+
const width = containerRef.current?.getBoundingClientRect().width;
|
|
518
|
+
(0, import_react7.useEffect)(() => {
|
|
519
|
+
if (active && isMounted) {
|
|
520
|
+
calculate();
|
|
521
|
+
} else {
|
|
522
|
+
setStyle(void 0);
|
|
523
|
+
}
|
|
524
|
+
}, [calculate, active, isMounted, height, width]);
|
|
525
|
+
(0, import_react7.useEffect)(() => {
|
|
526
|
+
window.addEventListener("resize", calculate);
|
|
527
|
+
let timeout;
|
|
528
|
+
if (isPolling) {
|
|
529
|
+
timeout = setInterval(calculate, pollingInterval);
|
|
530
|
+
}
|
|
531
|
+
return () => {
|
|
532
|
+
window.removeEventListener("resize", calculate);
|
|
533
|
+
if (timeout) {
|
|
534
|
+
clearInterval(timeout);
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
}, [calculate, isPolling, pollingInterval]);
|
|
538
|
+
return style;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// src/hooks/useHoverState.ts
|
|
542
|
+
var import_react8 = require("react");
|
|
543
|
+
var defaultUseHoverStateProps = {
|
|
544
|
+
closingDelay: 200,
|
|
545
|
+
isDisabled: false
|
|
546
|
+
};
|
|
547
|
+
var useHoverState = (props = void 0) => {
|
|
548
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
549
|
+
const [isHovered, setIsHovered] = (0, import_react8.useState)(false);
|
|
550
|
+
const [timer, setTimer] = (0, import_react8.useState)();
|
|
551
|
+
const onMouseEnter = () => {
|
|
552
|
+
if (isDisabled) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
clearTimeout(timer);
|
|
556
|
+
setIsHovered(true);
|
|
557
|
+
};
|
|
558
|
+
const onMouseLeave = () => {
|
|
559
|
+
if (isDisabled) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
setTimer(setTimeout(() => {
|
|
563
|
+
setIsHovered(false);
|
|
564
|
+
}, closingDelay));
|
|
565
|
+
};
|
|
566
|
+
(0, import_react8.useEffect)(() => {
|
|
567
|
+
if (timer) {
|
|
568
|
+
return () => {
|
|
569
|
+
clearTimeout(timer);
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
(0, import_react8.useEffect)(() => {
|
|
574
|
+
if (timer) {
|
|
575
|
+
clearTimeout(timer);
|
|
576
|
+
}
|
|
577
|
+
}, [isDisabled]);
|
|
578
|
+
return {
|
|
579
|
+
isHovered,
|
|
580
|
+
setIsHovered,
|
|
581
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
// src/hooks/useLocalStorage.ts
|
|
586
|
+
var import_react9 = require("react");
|
|
587
|
+
|
|
588
|
+
// src/utils/storage.ts
|
|
589
|
+
var StorageService = class {
|
|
590
|
+
// this seems to be a bug in eslint as 'paramter-properties' is a special syntax of typescript
|
|
591
|
+
constructor(storage) {
|
|
592
|
+
this.storage = storage;
|
|
593
|
+
}
|
|
594
|
+
get(key) {
|
|
595
|
+
const value = this.storage.getItem(key);
|
|
596
|
+
if (value === null) {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
return JSON.parse(value);
|
|
600
|
+
}
|
|
601
|
+
set(key, value) {
|
|
602
|
+
this.storage.setItem(key, JSON.stringify(value));
|
|
603
|
+
}
|
|
604
|
+
delete(key) {
|
|
605
|
+
this.storage.removeItem(key);
|
|
606
|
+
}
|
|
607
|
+
deleteAll() {
|
|
608
|
+
this.storage.clear();
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
var LocalStorageService = class extends StorageService {
|
|
612
|
+
constructor() {
|
|
613
|
+
super(window.localStorage);
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// src/utils/resolveSetState.ts
|
|
618
|
+
function resolveSetState(action, prev) {
|
|
619
|
+
return typeof action === "function" ? action(prev) : action;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// src/hooks/useLocalStorage.ts
|
|
623
|
+
var useLocalStorage = (key, initValue) => {
|
|
624
|
+
const get = (0, import_react9.useCallback)(() => {
|
|
625
|
+
if (typeof window === "undefined") {
|
|
626
|
+
return initValue;
|
|
627
|
+
}
|
|
628
|
+
const storageService = new LocalStorageService();
|
|
629
|
+
const value = storageService.get(key);
|
|
630
|
+
return value || initValue;
|
|
631
|
+
}, [initValue, key]);
|
|
632
|
+
const [storedValue, setStoredValue] = (0, import_react9.useState)(get);
|
|
633
|
+
const setValue = (0, import_react9.useCallback)((action) => {
|
|
634
|
+
const newValue = resolveSetState(action, storedValue);
|
|
635
|
+
const storageService = new LocalStorageService();
|
|
636
|
+
storageService.set(key, newValue);
|
|
637
|
+
setStoredValue(newValue);
|
|
638
|
+
}, [storedValue, setStoredValue, key]);
|
|
639
|
+
return [storedValue, setValue];
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
// src/hooks/useLogOnce.ts
|
|
643
|
+
var import_react10 = require("react");
|
|
644
|
+
var defaultOptions2 = {
|
|
645
|
+
type: "warning"
|
|
646
|
+
};
|
|
647
|
+
var useLogOnce = (message, condition, options) => {
|
|
648
|
+
const [hasLogged, setHasLogged] = (0, import_react10.useState)(false);
|
|
649
|
+
const { type } = { ...defaultOptions2, ...options };
|
|
650
|
+
(0, import_react10.useEffect)(() => {
|
|
651
|
+
if (!hasLogged && condition) {
|
|
652
|
+
switch (type) {
|
|
653
|
+
case "info":
|
|
654
|
+
console.info(message);
|
|
655
|
+
break;
|
|
656
|
+
case "error":
|
|
657
|
+
console.error(message);
|
|
658
|
+
break;
|
|
659
|
+
case "warning":
|
|
660
|
+
console.warn(message);
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
setHasLogged(true);
|
|
664
|
+
}
|
|
665
|
+
}, [condition]);
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
// src/hooks/useOutsideClick.ts
|
|
669
|
+
var import_react11 = require("react");
|
|
670
|
+
var useOutsideClick = (refs, handler) => {
|
|
671
|
+
(0, import_react11.useEffect)(() => {
|
|
672
|
+
const listener = (event) => {
|
|
673
|
+
if (event.target === null) return;
|
|
674
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
handler();
|
|
678
|
+
};
|
|
679
|
+
document.addEventListener("mousedown", listener);
|
|
680
|
+
document.addEventListener("touchstart", listener);
|
|
681
|
+
return () => {
|
|
682
|
+
document.removeEventListener("mousedown", listener);
|
|
683
|
+
document.removeEventListener("touchstart", listener);
|
|
684
|
+
};
|
|
685
|
+
}, [refs, handler]);
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
// src/hooks/usePopoverPosition.ts
|
|
689
|
+
var defaultPopoverPositionOptions = {
|
|
690
|
+
edgePadding: 16,
|
|
691
|
+
outerGap: 4,
|
|
692
|
+
horizontalAlignment: "leftInside",
|
|
693
|
+
verticalAlignment: "bottomOutside",
|
|
694
|
+
disabled: false
|
|
695
|
+
};
|
|
696
|
+
var usePopoverPosition = (trigger, options) => {
|
|
697
|
+
const {
|
|
698
|
+
edgePadding,
|
|
699
|
+
outerGap,
|
|
700
|
+
verticalAlignment,
|
|
701
|
+
horizontalAlignment,
|
|
702
|
+
disabled
|
|
703
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
704
|
+
if (disabled || !trigger) {
|
|
705
|
+
return {};
|
|
706
|
+
}
|
|
707
|
+
const left = {
|
|
708
|
+
leftOutside: trigger.left - outerGap,
|
|
709
|
+
leftInside: trigger.left,
|
|
710
|
+
rightOutside: trigger.right + outerGap,
|
|
711
|
+
rightInside: trigger.right,
|
|
712
|
+
center: trigger.left + trigger.width / 2
|
|
713
|
+
}[horizontalAlignment];
|
|
714
|
+
const top = {
|
|
715
|
+
topOutside: trigger.top - outerGap,
|
|
716
|
+
topInside: trigger.top,
|
|
717
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
718
|
+
bottomInside: trigger.bottom,
|
|
719
|
+
center: trigger.top + trigger.height / 2
|
|
720
|
+
}[verticalAlignment];
|
|
721
|
+
const translateX = {
|
|
722
|
+
leftOutside: "-100%",
|
|
723
|
+
leftInside: void 0,
|
|
724
|
+
rightOutside: void 0,
|
|
725
|
+
rightInside: "-100%",
|
|
726
|
+
center: "-50%"
|
|
727
|
+
}[horizontalAlignment];
|
|
728
|
+
const translateY = {
|
|
729
|
+
topOutside: "-100%",
|
|
730
|
+
topInside: void 0,
|
|
731
|
+
bottomOutside: void 0,
|
|
732
|
+
bottomInside: "-100%",
|
|
733
|
+
center: "-50%"
|
|
734
|
+
}[verticalAlignment];
|
|
735
|
+
return {
|
|
736
|
+
left: Math.max(left, edgePadding),
|
|
737
|
+
top: Math.max(top, edgePadding),
|
|
738
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
739
|
+
};
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
// src/hooks/useRerender.ts
|
|
743
|
+
var import_react12 = require("react");
|
|
744
|
+
var useRerender = () => {
|
|
745
|
+
return (0, import_react12.useReducer)(() => ({}), {})[1];
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
// src/hooks/useResizeCallbackWrapper.ts
|
|
749
|
+
var import_react13 = require("react");
|
|
750
|
+
var useResizeCallbackWrapper = (callback) => {
|
|
751
|
+
(0, import_react13.useEffect)(() => {
|
|
752
|
+
window.addEventListener("resize", callback);
|
|
753
|
+
return () => {
|
|
754
|
+
window.removeEventListener("resize", callback);
|
|
755
|
+
};
|
|
756
|
+
}, [callback]);
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
// src/hooks/useSearch.ts
|
|
760
|
+
var import_react14 = require("react");
|
|
761
|
+
|
|
762
|
+
// src/utils/simpleSearch.ts
|
|
763
|
+
var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
|
|
764
|
+
return objects.filter((object) => {
|
|
765
|
+
const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
|
|
766
|
+
if (!mappedSearchKeywords) {
|
|
767
|
+
return true;
|
|
768
|
+
}
|
|
769
|
+
return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
|
|
770
|
+
});
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
// src/hooks/useSearch.ts
|
|
774
|
+
var useSearch = ({
|
|
775
|
+
list,
|
|
776
|
+
initialSearch,
|
|
777
|
+
searchMapping,
|
|
778
|
+
additionalSearchTags,
|
|
779
|
+
isSearchInstant = true,
|
|
780
|
+
sortingFunction,
|
|
781
|
+
filter,
|
|
782
|
+
disabled = false
|
|
783
|
+
}) => {
|
|
784
|
+
const [search, setSearch] = (0, import_react14.useState)(initialSearch ?? "");
|
|
785
|
+
const [result, setResult] = (0, import_react14.useState)(list);
|
|
786
|
+
const searchTags = (0, import_react14.useMemo)(() => additionalSearchTags ?? [], [additionalSearchTags]);
|
|
787
|
+
const updateSearch = (0, import_react14.useCallback)((newSearch) => {
|
|
788
|
+
const usedSearch = newSearch ?? search;
|
|
789
|
+
if (newSearch) {
|
|
790
|
+
setSearch(search);
|
|
791
|
+
}
|
|
792
|
+
setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
|
|
793
|
+
}, [searchTags, list, search, searchMapping]);
|
|
794
|
+
(0, import_react14.useEffect)(() => {
|
|
795
|
+
if (isSearchInstant) {
|
|
796
|
+
setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
|
|
797
|
+
}
|
|
798
|
+
}, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
|
|
799
|
+
const filteredResult = (0, import_react14.useMemo)(() => {
|
|
800
|
+
if (!filter) {
|
|
801
|
+
return result;
|
|
802
|
+
}
|
|
803
|
+
return result.filter(filter);
|
|
804
|
+
}, [result, filter]);
|
|
805
|
+
const sortedAndFilteredResult = (0, import_react14.useMemo)(() => {
|
|
806
|
+
if (!sortingFunction) {
|
|
807
|
+
return filteredResult;
|
|
808
|
+
}
|
|
809
|
+
return filteredResult.sort(sortingFunction);
|
|
810
|
+
}, [filteredResult, sortingFunction]);
|
|
811
|
+
const usedResult = (0, import_react14.useMemo)(() => {
|
|
812
|
+
if (!disabled) {
|
|
813
|
+
return sortedAndFilteredResult;
|
|
814
|
+
}
|
|
815
|
+
return list;
|
|
816
|
+
}, [disabled, list, sortedAndFilteredResult]);
|
|
817
|
+
return {
|
|
818
|
+
result: usedResult,
|
|
819
|
+
hasResult: usedResult.length > 0,
|
|
820
|
+
allItems: list,
|
|
821
|
+
updateSearch,
|
|
822
|
+
search,
|
|
823
|
+
setSearch
|
|
824
|
+
};
|
|
825
|
+
};
|
|
826
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
827
|
+
0 && (module.exports = {
|
|
828
|
+
useDelay,
|
|
829
|
+
useFloatingElement,
|
|
830
|
+
useFocusGuards,
|
|
831
|
+
useFocusManagement,
|
|
832
|
+
useFocusOnceVisible,
|
|
833
|
+
useFocusTrap,
|
|
834
|
+
useHoverState,
|
|
835
|
+
useIsMounted,
|
|
836
|
+
useLocalStorage,
|
|
837
|
+
useLogOnce,
|
|
838
|
+
useOutsideClick,
|
|
839
|
+
usePopoverPosition,
|
|
840
|
+
useRerender,
|
|
841
|
+
useResizeCallbackWrapper,
|
|
842
|
+
useSearch
|
|
843
|
+
});
|
|
844
|
+
//# sourceMappingURL=index.js.map
|