@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,2329 @@
|
|
|
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/components/table/index.ts
|
|
30
|
+
var table_exports = {};
|
|
31
|
+
__export(table_exports, {
|
|
32
|
+
FillerRowElement: () => FillerRowElement,
|
|
33
|
+
Table: () => Table,
|
|
34
|
+
TableCell: () => TableCell,
|
|
35
|
+
TableFilterButton: () => TableFilterButton,
|
|
36
|
+
TableFilters: () => TableFilters,
|
|
37
|
+
TableSortButton: () => TableSortButton,
|
|
38
|
+
TableUncontrolled: () => TableUncontrolled,
|
|
39
|
+
TableWithSelection: () => TableWithSelection
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(table_exports);
|
|
42
|
+
|
|
43
|
+
// src/components/table/FillerRowElement.tsx
|
|
44
|
+
var import_clsx = require("clsx");
|
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
+
var FillerRowElement = ({
|
|
47
|
+
className
|
|
48
|
+
}) => {
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_clsx.clsx)("flex flex-row items-center w-1/2 h-4 text-disabled-text font-bold", className), children: "-" });
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/components/table/Filter.ts
|
|
53
|
+
var dateRange = (row, columnId, filterValue) => {
|
|
54
|
+
const [min, max] = filterValue;
|
|
55
|
+
const value = row.getValue(columnId);
|
|
56
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
57
|
+
if (isNaN(date.getTime())) return false;
|
|
58
|
+
if (min && date < min) return false;
|
|
59
|
+
if (max && date > max) return false;
|
|
60
|
+
return true;
|
|
61
|
+
};
|
|
62
|
+
var TableFilters = {
|
|
63
|
+
dateRange
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/components/table/Table.tsx
|
|
67
|
+
var import_react14 = require("react");
|
|
68
|
+
var import_clsx9 = __toESM(require("clsx"));
|
|
69
|
+
var import_react_table = require("@tanstack/react-table");
|
|
70
|
+
|
|
71
|
+
// src/utils/array.ts
|
|
72
|
+
var defaultRangeOptions = {
|
|
73
|
+
allowEmptyRange: false,
|
|
74
|
+
stepSize: 1,
|
|
75
|
+
exclusiveStart: false,
|
|
76
|
+
exclusiveEnd: true
|
|
77
|
+
};
|
|
78
|
+
var range = (endOrRange, options) => {
|
|
79
|
+
const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options };
|
|
80
|
+
let start = 0;
|
|
81
|
+
let end;
|
|
82
|
+
if (typeof endOrRange === "number") {
|
|
83
|
+
end = endOrRange;
|
|
84
|
+
} else {
|
|
85
|
+
start = endOrRange[0];
|
|
86
|
+
end = endOrRange[1];
|
|
87
|
+
}
|
|
88
|
+
if (!exclusiveEnd) {
|
|
89
|
+
end -= 1;
|
|
90
|
+
}
|
|
91
|
+
if (exclusiveStart) {
|
|
92
|
+
start += 1;
|
|
93
|
+
}
|
|
94
|
+
if (end - 1 < start) {
|
|
95
|
+
if (!allowEmptyRange) {
|
|
96
|
+
console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`);
|
|
97
|
+
}
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
return Array.from({ length: end - start }, (_, index) => index * stepSize + start);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/components/table/Table.tsx
|
|
104
|
+
var import_react_custom_scrollbars_2 = require("react-custom-scrollbars-2");
|
|
105
|
+
|
|
106
|
+
// src/utils/math.ts
|
|
107
|
+
var clamp = (value, range2 = [0, 1]) => {
|
|
108
|
+
const [min, max] = range2;
|
|
109
|
+
return Math.min(Math.max(value, min), max);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/utils/noop.ts
|
|
113
|
+
var noop = () => void 0;
|
|
114
|
+
|
|
115
|
+
// src/components/table/TableCell.tsx
|
|
116
|
+
var import_clsx2 = require("clsx");
|
|
117
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
118
|
+
var TableCell = ({
|
|
119
|
+
children,
|
|
120
|
+
className
|
|
121
|
+
}) => {
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: (0, import_clsx2.clsx)("block max-w-full overflow-ellipsis truncate", className), children });
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// src/hooks/useResizeCallbackWrapper.ts
|
|
126
|
+
var import_react = require("react");
|
|
127
|
+
var useResizeCallbackWrapper = (callback) => {
|
|
128
|
+
(0, import_react.useEffect)(() => {
|
|
129
|
+
window.addEventListener("resize", callback);
|
|
130
|
+
return () => {
|
|
131
|
+
window.removeEventListener("resize", callback);
|
|
132
|
+
};
|
|
133
|
+
}, [callback]);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/components/table/TableSortButton.tsx
|
|
137
|
+
var import_lucide_react = require("lucide-react");
|
|
138
|
+
|
|
139
|
+
// src/components/user-action/Button.tsx
|
|
140
|
+
var import_react2 = require("react");
|
|
141
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
142
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
143
|
+
var ButtonColorUtil = {
|
|
144
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
145
|
+
text: ["primary", "negative", "neutral"],
|
|
146
|
+
outline: ["primary"]
|
|
147
|
+
};
|
|
148
|
+
var IconButtonUtil = {
|
|
149
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
150
|
+
};
|
|
151
|
+
var paddingMapping = {
|
|
152
|
+
small: "btn-sm",
|
|
153
|
+
medium: "btn-md",
|
|
154
|
+
large: "btn-lg"
|
|
155
|
+
};
|
|
156
|
+
var iconPaddingMapping = {
|
|
157
|
+
tiny: "icon-btn-xs",
|
|
158
|
+
small: "icon-btn-sm",
|
|
159
|
+
medium: "icon-btn-md",
|
|
160
|
+
large: "icon-btn-lg"
|
|
161
|
+
};
|
|
162
|
+
var ButtonUtil = {
|
|
163
|
+
paddingMapping,
|
|
164
|
+
iconPaddingMapping
|
|
165
|
+
};
|
|
166
|
+
var SolidButton = (0, import_react2.forwardRef)(function SolidButton2({
|
|
167
|
+
children,
|
|
168
|
+
color = "primary",
|
|
169
|
+
size = "medium",
|
|
170
|
+
startIcon,
|
|
171
|
+
endIcon,
|
|
172
|
+
onClick,
|
|
173
|
+
className,
|
|
174
|
+
...restProps
|
|
175
|
+
}, ref) {
|
|
176
|
+
const colorClasses = {
|
|
177
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
178
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
179
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
180
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
181
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
182
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
183
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text"
|
|
184
|
+
}[color];
|
|
185
|
+
const iconColorClasses = {
|
|
186
|
+
primary: "not-group-disabled:text-button-solid-primary-icon",
|
|
187
|
+
secondary: "not-group-disabled:text-button-solid-secondary-icon",
|
|
188
|
+
tertiary: "not-group-disabled:text-button-solid-tertiary-icon",
|
|
189
|
+
positive: "not-group-disabled:text-button-solid-positive-icon",
|
|
190
|
+
warning: "not-group-disabled:text-button-solid-warning-icon",
|
|
191
|
+
negative: "not-group-disabled:text-button-solid-negative-icon",
|
|
192
|
+
neutral: "not-group-disabled:text-button-solid-neutral-icon"
|
|
193
|
+
}[color];
|
|
194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
195
|
+
"button",
|
|
196
|
+
{
|
|
197
|
+
ref,
|
|
198
|
+
onClick,
|
|
199
|
+
className: (0, import_clsx3.default)(
|
|
200
|
+
"group font-semibold",
|
|
201
|
+
colorClasses,
|
|
202
|
+
"not-disabled:hover:brightness-90",
|
|
203
|
+
"disabled:text-disabled-text disabled:bg-disabled-background",
|
|
204
|
+
ButtonUtil.paddingMapping[size],
|
|
205
|
+
className
|
|
206
|
+
),
|
|
207
|
+
...restProps,
|
|
208
|
+
children: [
|
|
209
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
210
|
+
"span",
|
|
211
|
+
{
|
|
212
|
+
className: (0, import_clsx3.default)(
|
|
213
|
+
iconColorClasses,
|
|
214
|
+
"group-disabled:text-disabled-icon"
|
|
215
|
+
),
|
|
216
|
+
children: startIcon
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
children,
|
|
220
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
221
|
+
"span",
|
|
222
|
+
{
|
|
223
|
+
className: (0, import_clsx3.default)(
|
|
224
|
+
iconColorClasses,
|
|
225
|
+
"group-disabled:text-disabled-icon"
|
|
226
|
+
),
|
|
227
|
+
children: endIcon
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
});
|
|
234
|
+
var IconButton = (0, import_react2.forwardRef)(function IconButton2({
|
|
235
|
+
children,
|
|
236
|
+
color = "primary",
|
|
237
|
+
size = "medium",
|
|
238
|
+
className,
|
|
239
|
+
...restProps
|
|
240
|
+
}, ref) {
|
|
241
|
+
const colorClasses = {
|
|
242
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
243
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
244
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
245
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
246
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
247
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
248
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
|
|
249
|
+
transparent: "not-disabled:bg-transparent"
|
|
250
|
+
}[color];
|
|
251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
252
|
+
"button",
|
|
253
|
+
{
|
|
254
|
+
ref,
|
|
255
|
+
className: (0, import_clsx3.default)(
|
|
256
|
+
colorClasses,
|
|
257
|
+
"not-disabled:hover:brightness-90",
|
|
258
|
+
"disabled:text-disabled-text",
|
|
259
|
+
{
|
|
260
|
+
"disabled:bg-disabled-background": color !== "transparent",
|
|
261
|
+
"disabled:opacity-70": color === "transparent",
|
|
262
|
+
"not-disabled:hover:bg-button-text-hover-background": color === "transparent"
|
|
263
|
+
},
|
|
264
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
265
|
+
className
|
|
266
|
+
),
|
|
267
|
+
...restProps,
|
|
268
|
+
children
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
// src/components/table/TableSortButton.tsx
|
|
274
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
275
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
276
|
+
var TableSortButton = ({
|
|
277
|
+
sortDirection,
|
|
278
|
+
invert = false,
|
|
279
|
+
color = "neutral",
|
|
280
|
+
className,
|
|
281
|
+
...buttonProps
|
|
282
|
+
}) => {
|
|
283
|
+
let icon = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronsUpDown, { className: "w-full h-full" });
|
|
284
|
+
if (sortDirection) {
|
|
285
|
+
let usedSortDirection = sortDirection;
|
|
286
|
+
if (invert) {
|
|
287
|
+
usedSortDirection = usedSortDirection === "desc" ? "asc" : "desc";
|
|
288
|
+
}
|
|
289
|
+
icon = usedSortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronUp, { className: "w-full h-full" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronDown, { className: "w-full h-full" });
|
|
290
|
+
}
|
|
291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
292
|
+
IconButton,
|
|
293
|
+
{
|
|
294
|
+
size: "tiny",
|
|
295
|
+
color,
|
|
296
|
+
className: (0, import_clsx4.default)(className),
|
|
297
|
+
...buttonProps,
|
|
298
|
+
children: icon
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// src/components/user-action/input/Input.tsx
|
|
304
|
+
var import_react5 = require("react");
|
|
305
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
306
|
+
|
|
307
|
+
// src/hooks/useDelay.ts
|
|
308
|
+
var import_react3 = require("react");
|
|
309
|
+
var defaultOptions = {
|
|
310
|
+
delay: 3e3,
|
|
311
|
+
disabled: false
|
|
312
|
+
};
|
|
313
|
+
function useDelay(options) {
|
|
314
|
+
const [timer, setTimer] = (0, import_react3.useState)(void 0);
|
|
315
|
+
const { delay, disabled } = {
|
|
316
|
+
...defaultOptions,
|
|
317
|
+
...options
|
|
318
|
+
};
|
|
319
|
+
const clearTimer = () => {
|
|
320
|
+
clearTimeout(timer);
|
|
321
|
+
setTimer(void 0);
|
|
322
|
+
};
|
|
323
|
+
const restartTimer = (onDelayFinish) => {
|
|
324
|
+
if (disabled) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
clearTimeout(timer);
|
|
328
|
+
setTimer(setTimeout(() => {
|
|
329
|
+
onDelayFinish();
|
|
330
|
+
setTimer(void 0);
|
|
331
|
+
}, delay));
|
|
332
|
+
};
|
|
333
|
+
(0, import_react3.useEffect)(() => {
|
|
334
|
+
return () => {
|
|
335
|
+
clearTimeout(timer);
|
|
336
|
+
};
|
|
337
|
+
}, [timer]);
|
|
338
|
+
(0, import_react3.useEffect)(() => {
|
|
339
|
+
if (disabled) {
|
|
340
|
+
clearTimeout(timer);
|
|
341
|
+
setTimer(void 0);
|
|
342
|
+
}
|
|
343
|
+
}, [disabled, timer]);
|
|
344
|
+
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// src/hooks/focus/useFocusManagement.ts
|
|
348
|
+
var import_react4 = require("react");
|
|
349
|
+
function useFocusManagement() {
|
|
350
|
+
const getFocusableElements = (0, import_react4.useCallback)(() => {
|
|
351
|
+
return Array.from(
|
|
352
|
+
document.querySelectorAll(
|
|
353
|
+
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
354
|
+
)
|
|
355
|
+
).filter(
|
|
356
|
+
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
357
|
+
);
|
|
358
|
+
}, []);
|
|
359
|
+
const getNextFocusElement = (0, import_react4.useCallback)(() => {
|
|
360
|
+
const elements = getFocusableElements();
|
|
361
|
+
if (elements.length === 0) {
|
|
362
|
+
return void 0;
|
|
363
|
+
}
|
|
364
|
+
let nextElement = elements[0];
|
|
365
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
366
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
367
|
+
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
368
|
+
}
|
|
369
|
+
return nextElement;
|
|
370
|
+
}, [getFocusableElements]);
|
|
371
|
+
const focusNext = (0, import_react4.useCallback)(() => {
|
|
372
|
+
const nextElement = getNextFocusElement();
|
|
373
|
+
nextElement?.focus();
|
|
374
|
+
}, [getNextFocusElement]);
|
|
375
|
+
const getPreviousFocusElement = (0, import_react4.useCallback)(() => {
|
|
376
|
+
const elements = getFocusableElements();
|
|
377
|
+
if (elements.length === 0) {
|
|
378
|
+
return void 0;
|
|
379
|
+
}
|
|
380
|
+
let previousElement = elements[0];
|
|
381
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
382
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
383
|
+
if (currentIndex === 0) {
|
|
384
|
+
previousElement = elements[elements.length - 1];
|
|
385
|
+
} else {
|
|
386
|
+
previousElement = elements[currentIndex - 1];
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return previousElement;
|
|
390
|
+
}, [getFocusableElements]);
|
|
391
|
+
const focusPrevious = (0, import_react4.useCallback)(() => {
|
|
392
|
+
const previousElement = getPreviousFocusElement();
|
|
393
|
+
if (previousElement) previousElement.focus();
|
|
394
|
+
}, [getPreviousFocusElement]);
|
|
395
|
+
return {
|
|
396
|
+
getFocusableElements,
|
|
397
|
+
getNextFocusElement,
|
|
398
|
+
getPreviousFocusElement,
|
|
399
|
+
focusNext,
|
|
400
|
+
focusPrevious
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// src/components/user-action/input/Input.tsx
|
|
405
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
406
|
+
var defaultEditCompleteOptions = {
|
|
407
|
+
allowEnterComplete: false,
|
|
408
|
+
onBlur: true,
|
|
409
|
+
afterDelay: true,
|
|
410
|
+
delay: 2500
|
|
411
|
+
};
|
|
412
|
+
var Input = (0, import_react5.forwardRef)(function Input2({
|
|
413
|
+
value,
|
|
414
|
+
onChange,
|
|
415
|
+
onChangeText,
|
|
416
|
+
onEditCompleted,
|
|
417
|
+
editCompleteOptions,
|
|
418
|
+
disabled = false,
|
|
419
|
+
invalid = false,
|
|
420
|
+
defaultStyle = true,
|
|
421
|
+
className,
|
|
422
|
+
...props
|
|
423
|
+
}, forwardedRef) {
|
|
424
|
+
const {
|
|
425
|
+
onBlur: allowEditCompleteOnBlur,
|
|
426
|
+
afterDelay,
|
|
427
|
+
delay,
|
|
428
|
+
allowEnterComplete
|
|
429
|
+
} = { ...defaultEditCompleteOptions, ...editCompleteOptions };
|
|
430
|
+
const {
|
|
431
|
+
restartTimer,
|
|
432
|
+
clearTimer
|
|
433
|
+
} = useDelay({ delay, disabled: !afterDelay });
|
|
434
|
+
const innerRef = (0, import_react5.useRef)(null);
|
|
435
|
+
(0, import_react5.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
436
|
+
const { focusNext } = useFocusManagement();
|
|
437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
438
|
+
"input",
|
|
439
|
+
{
|
|
440
|
+
...props,
|
|
441
|
+
ref: innerRef,
|
|
442
|
+
value,
|
|
443
|
+
disabled,
|
|
444
|
+
className: defaultStyle ? (0, import_clsx5.default)(
|
|
445
|
+
"px-2.5 py-1.75 rounded-md border-1 text-sm",
|
|
446
|
+
{
|
|
447
|
+
"bg-input-background text-input-text hover:border-primary focus:border-primary": !disabled && !invalid,
|
|
448
|
+
"bg-on-negative text-negative border-negative-border hover:border-negative-border-hover focus-visible:ring-negative-border": !disabled && invalid,
|
|
449
|
+
"bg-disabled-background text-disabled-text border-disabled-border": disabled
|
|
450
|
+
},
|
|
451
|
+
className
|
|
452
|
+
) : className,
|
|
453
|
+
onKeyDown: (event) => {
|
|
454
|
+
props.onKeyDown?.(event);
|
|
455
|
+
if (!allowEnterComplete) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
459
|
+
event.preventDefault();
|
|
460
|
+
innerRef.current?.blur();
|
|
461
|
+
onEditCompleted?.(event.target.value);
|
|
462
|
+
focusNext();
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
onBlur: (event) => {
|
|
466
|
+
props.onBlur?.(event);
|
|
467
|
+
if (allowEditCompleteOnBlur) {
|
|
468
|
+
onEditCompleted?.(event.target.value);
|
|
469
|
+
clearTimer();
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
onChange: (event) => {
|
|
473
|
+
onChange?.(event);
|
|
474
|
+
const value2 = event.target.value;
|
|
475
|
+
restartTimer(() => {
|
|
476
|
+
innerRef.current?.blur();
|
|
477
|
+
onEditCompleted?.(value2);
|
|
478
|
+
});
|
|
479
|
+
onChangeText?.(value2);
|
|
480
|
+
},
|
|
481
|
+
"aria-invalid": props["aria-invalid"] ?? invalid,
|
|
482
|
+
"aria-disabled": props["aria-disabled"] ?? disabled
|
|
483
|
+
}
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
// src/components/table/TableFilterButton.tsx
|
|
488
|
+
var import_lucide_react2 = require("lucide-react");
|
|
489
|
+
|
|
490
|
+
// src/components/user-action/Menu.tsx
|
|
491
|
+
var import_react8 = require("react");
|
|
492
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
493
|
+
|
|
494
|
+
// src/hooks/useOutsideClick.ts
|
|
495
|
+
var import_react6 = require("react");
|
|
496
|
+
var useOutsideClick = (refs, handler) => {
|
|
497
|
+
(0, import_react6.useEffect)(() => {
|
|
498
|
+
const listener = (event) => {
|
|
499
|
+
if (event.target === null) return;
|
|
500
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
handler();
|
|
504
|
+
};
|
|
505
|
+
document.addEventListener("mousedown", listener);
|
|
506
|
+
document.addEventListener("touchstart", listener);
|
|
507
|
+
return () => {
|
|
508
|
+
document.removeEventListener("mousedown", listener);
|
|
509
|
+
document.removeEventListener("touchstart", listener);
|
|
510
|
+
};
|
|
511
|
+
}, [refs, handler]);
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
// src/hooks/useHoverState.ts
|
|
515
|
+
var import_react7 = require("react");
|
|
516
|
+
var defaultUseHoverStateProps = {
|
|
517
|
+
closingDelay: 200,
|
|
518
|
+
isDisabled: false
|
|
519
|
+
};
|
|
520
|
+
var useHoverState = (props = void 0) => {
|
|
521
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
522
|
+
const [isHovered, setIsHovered] = (0, import_react7.useState)(false);
|
|
523
|
+
const [timer, setTimer] = (0, import_react7.useState)();
|
|
524
|
+
const onMouseEnter = () => {
|
|
525
|
+
if (isDisabled) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
clearTimeout(timer);
|
|
529
|
+
setIsHovered(true);
|
|
530
|
+
};
|
|
531
|
+
const onMouseLeave = () => {
|
|
532
|
+
if (isDisabled) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
setTimer(setTimeout(() => {
|
|
536
|
+
setIsHovered(false);
|
|
537
|
+
}, closingDelay));
|
|
538
|
+
};
|
|
539
|
+
(0, import_react7.useEffect)(() => {
|
|
540
|
+
if (timer) {
|
|
541
|
+
return () => {
|
|
542
|
+
clearTimeout(timer);
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
(0, import_react7.useEffect)(() => {
|
|
547
|
+
if (timer) {
|
|
548
|
+
clearTimeout(timer);
|
|
549
|
+
}
|
|
550
|
+
}, [isDisabled]);
|
|
551
|
+
return {
|
|
552
|
+
isHovered,
|
|
553
|
+
setIsHovered,
|
|
554
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
// src/utils/bagFunctions.ts
|
|
559
|
+
var resolve = (children, bag) => {
|
|
560
|
+
if (typeof children === "function") {
|
|
561
|
+
return children(bag);
|
|
562
|
+
}
|
|
563
|
+
return children ?? void 0;
|
|
564
|
+
};
|
|
565
|
+
var BagFunctionUtil = {
|
|
566
|
+
resolve
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
// src/hooks/usePopoverPosition.ts
|
|
570
|
+
var defaultPopoverPositionOptions = {
|
|
571
|
+
edgePadding: 16,
|
|
572
|
+
outerGap: 4,
|
|
573
|
+
horizontalAlignment: "leftInside",
|
|
574
|
+
verticalAlignment: "bottomOutside",
|
|
575
|
+
disabled: false
|
|
576
|
+
};
|
|
577
|
+
var usePopoverPosition = (trigger, options) => {
|
|
578
|
+
const {
|
|
579
|
+
edgePadding,
|
|
580
|
+
outerGap,
|
|
581
|
+
verticalAlignment,
|
|
582
|
+
horizontalAlignment,
|
|
583
|
+
disabled
|
|
584
|
+
} = { ...defaultPopoverPositionOptions, ...options };
|
|
585
|
+
if (disabled || !trigger) {
|
|
586
|
+
return {};
|
|
587
|
+
}
|
|
588
|
+
const left = {
|
|
589
|
+
leftOutside: trigger.left - outerGap,
|
|
590
|
+
leftInside: trigger.left,
|
|
591
|
+
rightOutside: trigger.right + outerGap,
|
|
592
|
+
rightInside: trigger.right,
|
|
593
|
+
center: trigger.left + trigger.width / 2
|
|
594
|
+
}[horizontalAlignment];
|
|
595
|
+
const top = {
|
|
596
|
+
topOutside: trigger.top - outerGap,
|
|
597
|
+
topInside: trigger.top,
|
|
598
|
+
bottomOutside: trigger.bottom + outerGap,
|
|
599
|
+
bottomInside: trigger.bottom,
|
|
600
|
+
center: trigger.top + trigger.height / 2
|
|
601
|
+
}[verticalAlignment];
|
|
602
|
+
const translateX = {
|
|
603
|
+
leftOutside: "-100%",
|
|
604
|
+
leftInside: void 0,
|
|
605
|
+
rightOutside: void 0,
|
|
606
|
+
rightInside: "-100%",
|
|
607
|
+
center: "-50%"
|
|
608
|
+
}[horizontalAlignment];
|
|
609
|
+
const translateY = {
|
|
610
|
+
topOutside: "-100%",
|
|
611
|
+
topInside: void 0,
|
|
612
|
+
bottomOutside: void 0,
|
|
613
|
+
bottomInside: "-100%",
|
|
614
|
+
center: "-50%"
|
|
615
|
+
}[verticalAlignment];
|
|
616
|
+
return {
|
|
617
|
+
left: Math.max(left, edgePadding),
|
|
618
|
+
top: Math.max(top, edgePadding),
|
|
619
|
+
translate: [translateX ?? "0", translateY ?? "0"].join(" ")
|
|
620
|
+
};
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
// src/components/user-action/Menu.tsx
|
|
624
|
+
var import_react_dom = require("react-dom");
|
|
625
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
626
|
+
function getScrollableParents(element) {
|
|
627
|
+
const scrollables = [];
|
|
628
|
+
let parent = element.parentElement;
|
|
629
|
+
while (parent) {
|
|
630
|
+
scrollables.push(parent);
|
|
631
|
+
parent = parent.parentElement;
|
|
632
|
+
}
|
|
633
|
+
return scrollables;
|
|
634
|
+
}
|
|
635
|
+
var Menu = ({
|
|
636
|
+
trigger,
|
|
637
|
+
children,
|
|
638
|
+
alignmentHorizontal = "leftInside",
|
|
639
|
+
alignmentVertical = "bottomOutside",
|
|
640
|
+
showOnHover = false,
|
|
641
|
+
disabled = false,
|
|
642
|
+
menuClassName = ""
|
|
643
|
+
}) => {
|
|
644
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
|
|
645
|
+
const triggerRef = (0, import_react8.useRef)(null);
|
|
646
|
+
const menuRef = (0, import_react8.useRef)(null);
|
|
647
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
648
|
+
const [isHidden, setIsHidden] = (0, import_react8.useState)(true);
|
|
649
|
+
const bag = {
|
|
650
|
+
isOpen,
|
|
651
|
+
close: () => setIsOpen(false),
|
|
652
|
+
toggleOpen: () => setIsOpen((prevState) => !prevState),
|
|
653
|
+
disabled
|
|
654
|
+
};
|
|
655
|
+
const menuPosition = usePopoverPosition(
|
|
656
|
+
triggerRef.current?.getBoundingClientRect(),
|
|
657
|
+
{ verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
|
|
658
|
+
);
|
|
659
|
+
(0, import_react8.useEffect)(() => {
|
|
660
|
+
if (!isOpen) return;
|
|
661
|
+
const triggerEl = triggerRef.current;
|
|
662
|
+
if (!triggerEl) return;
|
|
663
|
+
const scrollableParents = getScrollableParents(triggerEl);
|
|
664
|
+
const close = () => setIsOpen(false);
|
|
665
|
+
scrollableParents.forEach((parent) => {
|
|
666
|
+
parent.addEventListener("scroll", close);
|
|
667
|
+
});
|
|
668
|
+
window.addEventListener("resize", close);
|
|
669
|
+
return () => {
|
|
670
|
+
scrollableParents.forEach((parent) => {
|
|
671
|
+
parent.removeEventListener("scroll", close);
|
|
672
|
+
});
|
|
673
|
+
window.removeEventListener("resize", close);
|
|
674
|
+
};
|
|
675
|
+
}, [isOpen, setIsOpen]);
|
|
676
|
+
(0, import_react8.useEffect)(() => {
|
|
677
|
+
if (isOpen) {
|
|
678
|
+
setIsHidden(false);
|
|
679
|
+
}
|
|
680
|
+
}, [isOpen]);
|
|
681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
682
|
+
trigger(bag, triggerRef),
|
|
683
|
+
(0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
684
|
+
"div",
|
|
685
|
+
{
|
|
686
|
+
ref: menuRef,
|
|
687
|
+
onClick: (e) => e.stopPropagation(),
|
|
688
|
+
className: (0, import_clsx6.default)(
|
|
689
|
+
"absolute rounded-md bg-menu-background text-menu-text shadow-around-lg shadow-strong z-[300]",
|
|
690
|
+
{
|
|
691
|
+
"animate-pop-in": isOpen,
|
|
692
|
+
"animate-pop-out": !isOpen,
|
|
693
|
+
"hidden": isHidden
|
|
694
|
+
},
|
|
695
|
+
menuClassName
|
|
696
|
+
),
|
|
697
|
+
onAnimationEnd: () => {
|
|
698
|
+
if (!isOpen) {
|
|
699
|
+
setIsHidden(true);
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
style: {
|
|
703
|
+
...menuPosition
|
|
704
|
+
},
|
|
705
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
706
|
+
}
|
|
707
|
+
), document.body)
|
|
708
|
+
] });
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// src/localization/LanguageProvider.tsx
|
|
712
|
+
var import_react10 = require("react");
|
|
713
|
+
|
|
714
|
+
// src/hooks/useLocalStorage.ts
|
|
715
|
+
var import_react9 = require("react");
|
|
716
|
+
|
|
717
|
+
// src/localization/util.ts
|
|
718
|
+
var languages = ["en", "de"];
|
|
719
|
+
var languagesLocalNames = {
|
|
720
|
+
en: "English",
|
|
721
|
+
de: "Deutsch"
|
|
722
|
+
};
|
|
723
|
+
var DEFAULT_LANGUAGE = "en";
|
|
724
|
+
var LanguageUtil = {
|
|
725
|
+
languages,
|
|
726
|
+
DEFAULT_LANGUAGE,
|
|
727
|
+
languagesLocalNames
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
// src/localization/LanguageProvider.tsx
|
|
731
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
732
|
+
var LanguageContext = (0, import_react10.createContext)({
|
|
733
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
734
|
+
setLanguage: (v) => v
|
|
735
|
+
});
|
|
736
|
+
var useLanguage = () => (0, import_react10.useContext)(LanguageContext);
|
|
737
|
+
|
|
738
|
+
// src/localization/useTranslation.ts
|
|
739
|
+
var TranslationPluralCount = {
|
|
740
|
+
zero: 0,
|
|
741
|
+
one: 1,
|
|
742
|
+
two: 2,
|
|
743
|
+
few: 3,
|
|
744
|
+
many: 11,
|
|
745
|
+
other: -1
|
|
746
|
+
};
|
|
747
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
748
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
749
|
+
const { language: inferredLanguage } = useLanguage();
|
|
750
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
751
|
+
const usedTranslations = [...translations];
|
|
752
|
+
if (overwrite) {
|
|
753
|
+
usedTranslations.push(overwrite);
|
|
754
|
+
}
|
|
755
|
+
return (key, options) => {
|
|
756
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
757
|
+
try {
|
|
758
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
759
|
+
const translation = translations[i];
|
|
760
|
+
const localizedTranslation = translation[usedLanguage];
|
|
761
|
+
if (!localizedTranslation) {
|
|
762
|
+
continue;
|
|
763
|
+
}
|
|
764
|
+
const value = localizedTranslation[key];
|
|
765
|
+
if (!value) {
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
let forProcessing;
|
|
769
|
+
if (typeof value !== "string") {
|
|
770
|
+
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
771
|
+
forProcessing = value.zero;
|
|
772
|
+
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
773
|
+
forProcessing = value.one;
|
|
774
|
+
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
775
|
+
forProcessing = value.two;
|
|
776
|
+
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
777
|
+
forProcessing = value.few;
|
|
778
|
+
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
779
|
+
forProcessing = value.many;
|
|
780
|
+
} else {
|
|
781
|
+
forProcessing = value.other;
|
|
782
|
+
}
|
|
783
|
+
} else {
|
|
784
|
+
forProcessing = value;
|
|
785
|
+
}
|
|
786
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
787
|
+
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
788
|
+
});
|
|
789
|
+
return forProcessing;
|
|
790
|
+
}
|
|
791
|
+
} catch (e) {
|
|
792
|
+
console.error(e);
|
|
793
|
+
}
|
|
794
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
795
|
+
};
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
// src/localization/defaults/form.ts
|
|
799
|
+
var formTranslation = {
|
|
800
|
+
en: {
|
|
801
|
+
add: "Add",
|
|
802
|
+
all: "All",
|
|
803
|
+
apply: "Apply",
|
|
804
|
+
back: "Back",
|
|
805
|
+
cancel: "Cancel",
|
|
806
|
+
change: "Change",
|
|
807
|
+
clear: "Clear",
|
|
808
|
+
click: "Click",
|
|
809
|
+
clickToCopy: "Click to Copy",
|
|
810
|
+
close: "Close",
|
|
811
|
+
confirm: "Confirm",
|
|
812
|
+
copy: "Copy",
|
|
813
|
+
copied: "Copied",
|
|
814
|
+
create: "Create",
|
|
815
|
+
decline: "Decline",
|
|
816
|
+
delete: "Delete",
|
|
817
|
+
discard: "Discard",
|
|
818
|
+
discardChanges: "Discard Changes",
|
|
819
|
+
done: "Done",
|
|
820
|
+
edit: "Edit",
|
|
821
|
+
enterText: "Enter text here",
|
|
822
|
+
error: "Error",
|
|
823
|
+
exit: "Exit",
|
|
824
|
+
fieldRequiredError: "This field is required.",
|
|
825
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
826
|
+
less: "Less",
|
|
827
|
+
loading: "Loading",
|
|
828
|
+
maxLengthError: "Maximum length exceeded.",
|
|
829
|
+
minLengthError: "Minimum length not met.",
|
|
830
|
+
more: "More",
|
|
831
|
+
next: "Next",
|
|
832
|
+
no: "No",
|
|
833
|
+
none: "None",
|
|
834
|
+
nothingFound: "Nothing found",
|
|
835
|
+
of: "of",
|
|
836
|
+
optional: "Optional",
|
|
837
|
+
pleaseWait: "Please wait...",
|
|
838
|
+
previous: "Previous",
|
|
839
|
+
remove: "Remove",
|
|
840
|
+
required: "Required",
|
|
841
|
+
reset: "Reset",
|
|
842
|
+
save: "Save",
|
|
843
|
+
saved: "Saved",
|
|
844
|
+
search: "Search",
|
|
845
|
+
select: "Select",
|
|
846
|
+
selectOption: "Select an option",
|
|
847
|
+
show: "Show",
|
|
848
|
+
showMore: "Show more",
|
|
849
|
+
showLess: "Show less",
|
|
850
|
+
submit: "Submit",
|
|
851
|
+
success: "Success",
|
|
852
|
+
update: "Update",
|
|
853
|
+
unsavedChanges: "Unsaved Changes",
|
|
854
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
855
|
+
yes: "Yes"
|
|
856
|
+
},
|
|
857
|
+
de: {
|
|
858
|
+
add: "Hinzuf\xFCgen",
|
|
859
|
+
all: "Alle",
|
|
860
|
+
apply: "Anwenden",
|
|
861
|
+
back: "Zur\xFCck",
|
|
862
|
+
cancel: "Abbrechen",
|
|
863
|
+
change: "\xC4ndern",
|
|
864
|
+
clear: "L\xF6schen",
|
|
865
|
+
click: "Klicken",
|
|
866
|
+
clickToCopy: "Zum kopieren klicken",
|
|
867
|
+
close: "Schlie\xDFen",
|
|
868
|
+
confirm: "Best\xE4tigen",
|
|
869
|
+
copy: "Kopieren",
|
|
870
|
+
copied: "Kopiert",
|
|
871
|
+
create: "Erstellen",
|
|
872
|
+
decline: "Ablehnen",
|
|
873
|
+
delete: "L\xF6schen",
|
|
874
|
+
discard: "Verwerfen",
|
|
875
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
876
|
+
done: "Fertig",
|
|
877
|
+
edit: "Bearbeiten",
|
|
878
|
+
enterText: "Text hier eingeben",
|
|
879
|
+
error: "Fehler",
|
|
880
|
+
exit: "Beenden",
|
|
881
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
882
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
883
|
+
less: "Weniger",
|
|
884
|
+
loading: "L\xE4dt",
|
|
885
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
886
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
887
|
+
more: "Mehr",
|
|
888
|
+
next: "Weiter",
|
|
889
|
+
no: "Nein",
|
|
890
|
+
none: "Nichts",
|
|
891
|
+
nothingFound: "Nichts gefunden",
|
|
892
|
+
of: "von",
|
|
893
|
+
optional: "Optional",
|
|
894
|
+
pleaseWait: "Bitte warten...",
|
|
895
|
+
previous: "Vorherige",
|
|
896
|
+
remove: "Entfernen",
|
|
897
|
+
required: "Erforderlich",
|
|
898
|
+
reset: "Zur\xFCcksetzen",
|
|
899
|
+
save: "Speichern",
|
|
900
|
+
saved: "Gespeichert",
|
|
901
|
+
search: "Suche",
|
|
902
|
+
select: "Select",
|
|
903
|
+
selectOption: "Option ausw\xE4hlen",
|
|
904
|
+
show: "Anzeigen",
|
|
905
|
+
showMore: "Mehr anzeigen",
|
|
906
|
+
showLess: "Weniger anzeigen",
|
|
907
|
+
submit: "Abschicken",
|
|
908
|
+
success: "Erfolg",
|
|
909
|
+
update: "Update",
|
|
910
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
911
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
912
|
+
yes: "Ja"
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
// src/components/table/TableFilterButton.tsx
|
|
917
|
+
var import_react11 = require("react");
|
|
918
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
919
|
+
var defaultTableFilterTranslation = {
|
|
920
|
+
en: {
|
|
921
|
+
filter: "Filter",
|
|
922
|
+
min: "Min",
|
|
923
|
+
max: "Max",
|
|
924
|
+
startDate: "Start",
|
|
925
|
+
endDate: "End",
|
|
926
|
+
text: "Text..."
|
|
927
|
+
},
|
|
928
|
+
de: {
|
|
929
|
+
filter: "Filter",
|
|
930
|
+
min: "Min",
|
|
931
|
+
max: "Max",
|
|
932
|
+
startDate: "Start",
|
|
933
|
+
endDate: "Ende",
|
|
934
|
+
text: "Text..."
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
var TableFilterButton = ({
|
|
938
|
+
filterType,
|
|
939
|
+
column
|
|
940
|
+
}) => {
|
|
941
|
+
const translation = useTranslation([formTranslation, defaultTableFilterTranslation]);
|
|
942
|
+
const columnFilterValue = column.getFilterValue();
|
|
943
|
+
const [filterValue, setFilterValue] = (0, import_react11.useState)(columnFilterValue);
|
|
944
|
+
const hasFilter = !!filterValue;
|
|
945
|
+
(0, import_react11.useEffect)(() => {
|
|
946
|
+
setFilterValue(columnFilterValue);
|
|
947
|
+
}, [columnFilterValue]);
|
|
948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
949
|
+
Menu,
|
|
950
|
+
{
|
|
951
|
+
trigger: ({ toggleOpen }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref, className: "relative", children: [
|
|
952
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconButton, { color: "neutral", size: "tiny", onClick: toggleOpen, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.FilterIcon, {}) }),
|
|
953
|
+
hasFilter && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
954
|
+
"div",
|
|
955
|
+
{
|
|
956
|
+
className: "absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-primary pointer-events-none",
|
|
957
|
+
"aria-hidden": true
|
|
958
|
+
}
|
|
959
|
+
)
|
|
960
|
+
] }),
|
|
961
|
+
children: ({ close }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex-col-1 p-2 items-start font-normal text-menu-text", children: [
|
|
962
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h4", { className: "typography-label-md-semibold", children: translation("filter") }),
|
|
963
|
+
filterType === "text" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
964
|
+
Input,
|
|
965
|
+
{
|
|
966
|
+
value: filterValue ?? "",
|
|
967
|
+
autoFocus: true,
|
|
968
|
+
placeholder: translation("text"),
|
|
969
|
+
onChangeText: setFilterValue,
|
|
970
|
+
className: "h-10"
|
|
971
|
+
}
|
|
972
|
+
),
|
|
973
|
+
filterType === "range" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex-row-2 items-center", children: [
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
975
|
+
Input,
|
|
976
|
+
{
|
|
977
|
+
value: filterValue?.[0] ?? "",
|
|
978
|
+
type: "number",
|
|
979
|
+
placeholder: translation("min"),
|
|
980
|
+
onChangeText: (text) => {
|
|
981
|
+
const num = Number(text);
|
|
982
|
+
setFilterValue((old) => [num, old?.[1]]);
|
|
983
|
+
},
|
|
984
|
+
className: "h-10 input-indicator-hidden w-40"
|
|
985
|
+
}
|
|
986
|
+
),
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-bold", children: "-" }),
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
989
|
+
Input,
|
|
990
|
+
{
|
|
991
|
+
value: filterValue?.[1] ?? "",
|
|
992
|
+
type: "number",
|
|
993
|
+
placeholder: translation("max"),
|
|
994
|
+
onChangeText: (text) => {
|
|
995
|
+
const num = Number(text);
|
|
996
|
+
setFilterValue((old) => [old?.[0], num]);
|
|
997
|
+
},
|
|
998
|
+
className: "h-10 input-indicator-hidden w-40"
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] }),
|
|
1002
|
+
filterType === "dateRange" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1004
|
+
Input,
|
|
1005
|
+
{
|
|
1006
|
+
value: filterValue?.[0] ? filterValue?.[0].toISOString().slice(0, 16) : "",
|
|
1007
|
+
type: "datetime-local",
|
|
1008
|
+
placeholder: translation("startDate"),
|
|
1009
|
+
onChangeText: (text) => {
|
|
1010
|
+
const value = new Date(text);
|
|
1011
|
+
setFilterValue((old) => [value, old?.[1]]);
|
|
1012
|
+
},
|
|
1013
|
+
className: "h-10 w-50"
|
|
1014
|
+
}
|
|
1015
|
+
),
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1017
|
+
Input,
|
|
1018
|
+
{
|
|
1019
|
+
value: filterValue?.[1] ? filterValue?.[1].toISOString().slice(0, 16) : "",
|
|
1020
|
+
type: "datetime-local",
|
|
1021
|
+
placeholder: translation("endDate"),
|
|
1022
|
+
onChangeText: (text) => {
|
|
1023
|
+
const value = new Date(text);
|
|
1024
|
+
setFilterValue((old) => [old?.[0], value]);
|
|
1025
|
+
},
|
|
1026
|
+
className: "h-10 w-50"
|
|
1027
|
+
}
|
|
1028
|
+
)
|
|
1029
|
+
] }),
|
|
1030
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex-row-2 justify-end w-full", children: [
|
|
1031
|
+
hasFilter && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SolidButton, { color: "negative", size: "small", onClick: () => {
|
|
1032
|
+
column.setFilterValue(void 0);
|
|
1033
|
+
close();
|
|
1034
|
+
}, children: translation("remove") }),
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SolidButton, { size: "small", onClick: () => {
|
|
1036
|
+
column.setFilterValue(filterValue);
|
|
1037
|
+
close();
|
|
1038
|
+
}, children: translation("apply") })
|
|
1039
|
+
] })
|
|
1040
|
+
] })
|
|
1041
|
+
}
|
|
1042
|
+
);
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1045
|
+
// src/components/navigation/Pagination.tsx
|
|
1046
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1047
|
+
var import_clsx7 = __toESM(require("clsx"));
|
|
1048
|
+
var import_react12 = require("react");
|
|
1049
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1050
|
+
var Pagination = ({
|
|
1051
|
+
overwriteTranslation,
|
|
1052
|
+
pageIndex,
|
|
1053
|
+
pageCount,
|
|
1054
|
+
onPageChanged,
|
|
1055
|
+
className,
|
|
1056
|
+
style
|
|
1057
|
+
}) => {
|
|
1058
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1059
|
+
const [value, setValue] = (0, import_react12.useState)((pageIndex + 1).toString());
|
|
1060
|
+
const noPages = pageCount === 0;
|
|
1061
|
+
const onFirstPage = pageIndex === 0 && !noPages;
|
|
1062
|
+
const onLastPage = pageIndex === pageCount - 1;
|
|
1063
|
+
(0, import_react12.useEffect)(() => {
|
|
1064
|
+
if (noPages) {
|
|
1065
|
+
setValue("0");
|
|
1066
|
+
} else {
|
|
1067
|
+
setValue((pageIndex + 1).toString());
|
|
1068
|
+
}
|
|
1069
|
+
}, [pageIndex, noPages]);
|
|
1070
|
+
const changePage = (page) => {
|
|
1071
|
+
onPageChanged(page);
|
|
1072
|
+
};
|
|
1073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_clsx7.default)("flex-row-1", className), style, children: [
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { color: "transparent", onClick: () => changePage(0), disabled: onFirstPage || noPages, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronFirst, {}) }),
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { color: "transparent", onClick: () => changePage(pageIndex - 1), disabled: onFirstPage || noPages, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronLeft, {}) }),
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-row-2 min-w-56 items-center justify-center mx-2 text-center", children: [
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1078
|
+
Input,
|
|
1079
|
+
{
|
|
1080
|
+
value,
|
|
1081
|
+
className: (0, import_clsx7.default)(
|
|
1082
|
+
"w-full text-center font-bold input-indicator-hidden h-10"
|
|
1083
|
+
),
|
|
1084
|
+
type: "number",
|
|
1085
|
+
min: 1,
|
|
1086
|
+
max: pageCount,
|
|
1087
|
+
disabled: noPages,
|
|
1088
|
+
onChangeText: (value2) => {
|
|
1089
|
+
if (value2) {
|
|
1090
|
+
setValue(clamp(Number(value2), [1, pageCount]).toString());
|
|
1091
|
+
} else {
|
|
1092
|
+
setValue(value2);
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
onEditCompleted: (value2) => {
|
|
1096
|
+
changePage(clamp(Number(value2) - 1, [0, pageCount - 1]));
|
|
1097
|
+
},
|
|
1098
|
+
editCompleteOptions: { delay: 800 }
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "select-none w-10", children: translation("of") }),
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1103
|
+
"span",
|
|
1104
|
+
{
|
|
1105
|
+
className: "flex-row-2 flex-1 items-center justify-center select-none h-10 bg-input-background text-input-text rounded-md font-bold",
|
|
1106
|
+
children: pageCount
|
|
1107
|
+
}
|
|
1108
|
+
)
|
|
1109
|
+
] }),
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { color: "transparent", onClick: () => changePage(pageIndex + 1), disabled: onLastPage || noPages, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronRight, {}) }),
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { color: "transparent", onClick: () => changePage(pageCount - 1), disabled: onLastPage || noPages, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronLast, {}) })
|
|
1112
|
+
] });
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
// src/components/user-action/Checkbox.tsx
|
|
1116
|
+
var import_react13 = require("react");
|
|
1117
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1118
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
1119
|
+
|
|
1120
|
+
// node_modules/@radix-ui/react-checkbox/dist/index.mjs
|
|
1121
|
+
var React11 = __toESM(require("react"), 1);
|
|
1122
|
+
|
|
1123
|
+
// node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
1124
|
+
var React2 = __toESM(require("react"), 1);
|
|
1125
|
+
function setRef(ref, value) {
|
|
1126
|
+
if (typeof ref === "function") {
|
|
1127
|
+
return ref(value);
|
|
1128
|
+
} else if (ref !== null && ref !== void 0) {
|
|
1129
|
+
ref.current = value;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
function composeRefs(...refs) {
|
|
1133
|
+
return (node) => {
|
|
1134
|
+
let hasCleanup = false;
|
|
1135
|
+
const cleanups = refs.map((ref) => {
|
|
1136
|
+
const cleanup = setRef(ref, node);
|
|
1137
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
1138
|
+
hasCleanup = true;
|
|
1139
|
+
}
|
|
1140
|
+
return cleanup;
|
|
1141
|
+
});
|
|
1142
|
+
if (hasCleanup) {
|
|
1143
|
+
return () => {
|
|
1144
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
1145
|
+
const cleanup = cleanups[i];
|
|
1146
|
+
if (typeof cleanup == "function") {
|
|
1147
|
+
cleanup();
|
|
1148
|
+
} else {
|
|
1149
|
+
setRef(refs[i], null);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
function useComposedRefs(...refs) {
|
|
1157
|
+
return React2.useCallback(composeRefs(...refs), refs);
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
// node_modules/@radix-ui/react-context/dist/index.mjs
|
|
1161
|
+
var React3 = __toESM(require("react"), 1);
|
|
1162
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1163
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1164
|
+
let defaultContexts = [];
|
|
1165
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
1166
|
+
const BaseContext = React3.createContext(defaultContext);
|
|
1167
|
+
const index = defaultContexts.length;
|
|
1168
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
1169
|
+
const Provider = (props) => {
|
|
1170
|
+
const { scope, children, ...context } = props;
|
|
1171
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1172
|
+
const value = React3.useMemo(() => context, Object.values(context));
|
|
1173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Context.Provider, { value, children });
|
|
1174
|
+
};
|
|
1175
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
1176
|
+
function useContext22(consumerName, scope) {
|
|
1177
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1178
|
+
const context = React3.useContext(Context);
|
|
1179
|
+
if (context) return context;
|
|
1180
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
1181
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1182
|
+
}
|
|
1183
|
+
return [Provider, useContext22];
|
|
1184
|
+
}
|
|
1185
|
+
const createScope = () => {
|
|
1186
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
1187
|
+
return React3.createContext(defaultContext);
|
|
1188
|
+
});
|
|
1189
|
+
return function useScope(scope) {
|
|
1190
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
1191
|
+
return React3.useMemo(
|
|
1192
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
1193
|
+
[scope, contexts]
|
|
1194
|
+
);
|
|
1195
|
+
};
|
|
1196
|
+
};
|
|
1197
|
+
createScope.scopeName = scopeName;
|
|
1198
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
1199
|
+
}
|
|
1200
|
+
function composeContextScopes(...scopes) {
|
|
1201
|
+
const baseScope = scopes[0];
|
|
1202
|
+
if (scopes.length === 1) return baseScope;
|
|
1203
|
+
const createScope = () => {
|
|
1204
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
1205
|
+
useScope: createScope2(),
|
|
1206
|
+
scopeName: createScope2.scopeName
|
|
1207
|
+
}));
|
|
1208
|
+
return function useComposedScopes(overrideScopes) {
|
|
1209
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
1210
|
+
const scopeProps = useScope(overrideScopes);
|
|
1211
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
1212
|
+
return { ...nextScopes2, ...currentScope };
|
|
1213
|
+
}, {});
|
|
1214
|
+
return React3.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
1215
|
+
};
|
|
1216
|
+
};
|
|
1217
|
+
createScope.scopeName = baseScope.scopeName;
|
|
1218
|
+
return createScope;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
// node_modules/@radix-ui/primitive/dist/index.mjs
|
|
1222
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
1223
|
+
return function handleEvent(event) {
|
|
1224
|
+
originalEventHandler?.(event);
|
|
1225
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
1226
|
+
return ourEventHandler?.(event);
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
1232
|
+
var React5 = __toESM(require("react"), 1);
|
|
1233
|
+
|
|
1234
|
+
// node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
1235
|
+
var React4 = __toESM(require("react"), 1);
|
|
1236
|
+
var useLayoutEffect2 = globalThis?.document ? React4.useLayoutEffect : () => {
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1239
|
+
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
1240
|
+
var React22 = __toESM(require("react"), 1);
|
|
1241
|
+
var useInsertionEffect = React5[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
1242
|
+
function useControllableState({
|
|
1243
|
+
prop,
|
|
1244
|
+
defaultProp,
|
|
1245
|
+
onChange = () => {
|
|
1246
|
+
},
|
|
1247
|
+
caller
|
|
1248
|
+
}) {
|
|
1249
|
+
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
1250
|
+
defaultProp,
|
|
1251
|
+
onChange
|
|
1252
|
+
});
|
|
1253
|
+
const isControlled = prop !== void 0;
|
|
1254
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
1255
|
+
if (true) {
|
|
1256
|
+
const isControlledRef = React5.useRef(prop !== void 0);
|
|
1257
|
+
React5.useEffect(() => {
|
|
1258
|
+
const wasControlled = isControlledRef.current;
|
|
1259
|
+
if (wasControlled !== isControlled) {
|
|
1260
|
+
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
1261
|
+
const to = isControlled ? "controlled" : "uncontrolled";
|
|
1262
|
+
console.warn(
|
|
1263
|
+
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
isControlledRef.current = isControlled;
|
|
1267
|
+
}, [isControlled, caller]);
|
|
1268
|
+
}
|
|
1269
|
+
const setValue = React5.useCallback(
|
|
1270
|
+
(nextValue) => {
|
|
1271
|
+
if (isControlled) {
|
|
1272
|
+
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
1273
|
+
if (value2 !== prop) {
|
|
1274
|
+
onChangeRef.current?.(value2);
|
|
1275
|
+
}
|
|
1276
|
+
} else {
|
|
1277
|
+
setUncontrolledProp(nextValue);
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1280
|
+
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
1281
|
+
);
|
|
1282
|
+
return [value, setValue];
|
|
1283
|
+
}
|
|
1284
|
+
function useUncontrolledState({
|
|
1285
|
+
defaultProp,
|
|
1286
|
+
onChange
|
|
1287
|
+
}) {
|
|
1288
|
+
const [value, setValue] = React5.useState(defaultProp);
|
|
1289
|
+
const prevValueRef = React5.useRef(value);
|
|
1290
|
+
const onChangeRef = React5.useRef(onChange);
|
|
1291
|
+
useInsertionEffect(() => {
|
|
1292
|
+
onChangeRef.current = onChange;
|
|
1293
|
+
}, [onChange]);
|
|
1294
|
+
React5.useEffect(() => {
|
|
1295
|
+
if (prevValueRef.current !== value) {
|
|
1296
|
+
onChangeRef.current?.(value);
|
|
1297
|
+
prevValueRef.current = value;
|
|
1298
|
+
}
|
|
1299
|
+
}, [value, prevValueRef]);
|
|
1300
|
+
return [value, setValue, onChangeRef];
|
|
1301
|
+
}
|
|
1302
|
+
function isFunction(value) {
|
|
1303
|
+
return typeof value === "function";
|
|
1304
|
+
}
|
|
1305
|
+
var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
|
|
1306
|
+
|
|
1307
|
+
// node_modules/@radix-ui/react-use-previous/dist/index.mjs
|
|
1308
|
+
var React6 = __toESM(require("react"), 1);
|
|
1309
|
+
function usePrevious(value) {
|
|
1310
|
+
const ref = React6.useRef({ value, previous: value });
|
|
1311
|
+
return React6.useMemo(() => {
|
|
1312
|
+
if (ref.current.value !== value) {
|
|
1313
|
+
ref.current.previous = ref.current.value;
|
|
1314
|
+
ref.current.value = value;
|
|
1315
|
+
}
|
|
1316
|
+
return ref.current.previous;
|
|
1317
|
+
}, [value]);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
// node_modules/@radix-ui/react-use-size/dist/index.mjs
|
|
1321
|
+
var React7 = __toESM(require("react"), 1);
|
|
1322
|
+
function useSize(element) {
|
|
1323
|
+
const [size, setSize] = React7.useState(void 0);
|
|
1324
|
+
useLayoutEffect2(() => {
|
|
1325
|
+
if (element) {
|
|
1326
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
1327
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
1328
|
+
if (!Array.isArray(entries)) {
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
if (!entries.length) {
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
const entry = entries[0];
|
|
1335
|
+
let width;
|
|
1336
|
+
let height;
|
|
1337
|
+
if ("borderBoxSize" in entry) {
|
|
1338
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
1339
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
1340
|
+
width = borderSize["inlineSize"];
|
|
1341
|
+
height = borderSize["blockSize"];
|
|
1342
|
+
} else {
|
|
1343
|
+
width = element.offsetWidth;
|
|
1344
|
+
height = element.offsetHeight;
|
|
1345
|
+
}
|
|
1346
|
+
setSize({ width, height });
|
|
1347
|
+
});
|
|
1348
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
1349
|
+
return () => resizeObserver.unobserve(element);
|
|
1350
|
+
} else {
|
|
1351
|
+
setSize(void 0);
|
|
1352
|
+
}
|
|
1353
|
+
}, [element]);
|
|
1354
|
+
return size;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
// node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
1358
|
+
var React23 = __toESM(require("react"), 1);
|
|
1359
|
+
var React8 = __toESM(require("react"), 1);
|
|
1360
|
+
function useStateMachine(initialState, machine) {
|
|
1361
|
+
return React8.useReducer((state, event) => {
|
|
1362
|
+
const nextState = machine[state][event];
|
|
1363
|
+
return nextState ?? state;
|
|
1364
|
+
}, initialState);
|
|
1365
|
+
}
|
|
1366
|
+
var Presence = (props) => {
|
|
1367
|
+
const { present, children } = props;
|
|
1368
|
+
const presence = usePresence(present);
|
|
1369
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React23.Children.only(children);
|
|
1370
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
1371
|
+
const forceMount = typeof children === "function";
|
|
1372
|
+
return forceMount || presence.isPresent ? React23.cloneElement(child, { ref }) : null;
|
|
1373
|
+
};
|
|
1374
|
+
Presence.displayName = "Presence";
|
|
1375
|
+
function usePresence(present) {
|
|
1376
|
+
const [node, setNode] = React23.useState();
|
|
1377
|
+
const stylesRef = React23.useRef(null);
|
|
1378
|
+
const prevPresentRef = React23.useRef(present);
|
|
1379
|
+
const prevAnimationNameRef = React23.useRef("none");
|
|
1380
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
1381
|
+
const [state, send] = useStateMachine(initialState, {
|
|
1382
|
+
mounted: {
|
|
1383
|
+
UNMOUNT: "unmounted",
|
|
1384
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
1385
|
+
},
|
|
1386
|
+
unmountSuspended: {
|
|
1387
|
+
MOUNT: "mounted",
|
|
1388
|
+
ANIMATION_END: "unmounted"
|
|
1389
|
+
},
|
|
1390
|
+
unmounted: {
|
|
1391
|
+
MOUNT: "mounted"
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
React23.useEffect(() => {
|
|
1395
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1396
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
1397
|
+
}, [state]);
|
|
1398
|
+
useLayoutEffect2(() => {
|
|
1399
|
+
const styles = stylesRef.current;
|
|
1400
|
+
const wasPresent = prevPresentRef.current;
|
|
1401
|
+
const hasPresentChanged = wasPresent !== present;
|
|
1402
|
+
if (hasPresentChanged) {
|
|
1403
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
1404
|
+
const currentAnimationName = getAnimationName(styles);
|
|
1405
|
+
if (present) {
|
|
1406
|
+
send("MOUNT");
|
|
1407
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
1408
|
+
send("UNMOUNT");
|
|
1409
|
+
} else {
|
|
1410
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
1411
|
+
if (wasPresent && isAnimating) {
|
|
1412
|
+
send("ANIMATION_OUT");
|
|
1413
|
+
} else {
|
|
1414
|
+
send("UNMOUNT");
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
prevPresentRef.current = present;
|
|
1418
|
+
}
|
|
1419
|
+
}, [present, send]);
|
|
1420
|
+
useLayoutEffect2(() => {
|
|
1421
|
+
if (node) {
|
|
1422
|
+
let timeoutId;
|
|
1423
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
1424
|
+
const handleAnimationEnd = (event) => {
|
|
1425
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1426
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
1427
|
+
if (event.target === node && isCurrentAnimation) {
|
|
1428
|
+
send("ANIMATION_END");
|
|
1429
|
+
if (!prevPresentRef.current) {
|
|
1430
|
+
const currentFillMode = node.style.animationFillMode;
|
|
1431
|
+
node.style.animationFillMode = "forwards";
|
|
1432
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
1433
|
+
if (node.style.animationFillMode === "forwards") {
|
|
1434
|
+
node.style.animationFillMode = currentFillMode;
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
const handleAnimationStart = (event) => {
|
|
1441
|
+
if (event.target === node) {
|
|
1442
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1445
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
1446
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
1447
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
1448
|
+
return () => {
|
|
1449
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
1450
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
1451
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
1452
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
1453
|
+
};
|
|
1454
|
+
} else {
|
|
1455
|
+
send("ANIMATION_END");
|
|
1456
|
+
}
|
|
1457
|
+
}, [node, send]);
|
|
1458
|
+
return {
|
|
1459
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
1460
|
+
ref: React23.useCallback((node2) => {
|
|
1461
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
1462
|
+
setNode(node2);
|
|
1463
|
+
}, [])
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
function getAnimationName(styles) {
|
|
1467
|
+
return styles?.animationName || "none";
|
|
1468
|
+
}
|
|
1469
|
+
function getElementRef(element) {
|
|
1470
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1471
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1472
|
+
if (mayWarn) {
|
|
1473
|
+
return element.ref;
|
|
1474
|
+
}
|
|
1475
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1476
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1477
|
+
if (mayWarn) {
|
|
1478
|
+
return element.props.ref;
|
|
1479
|
+
}
|
|
1480
|
+
return element.props.ref || element.ref;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
1484
|
+
var React10 = __toESM(require("react"), 1);
|
|
1485
|
+
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
1486
|
+
|
|
1487
|
+
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
1488
|
+
var React9 = __toESM(require("react"), 1);
|
|
1489
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1490
|
+
// @__NO_SIDE_EFFECTS__
|
|
1491
|
+
function createSlot(ownerName) {
|
|
1492
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
1493
|
+
const Slot2 = React9.forwardRef((props, forwardedRef) => {
|
|
1494
|
+
const { children, ...slotProps } = props;
|
|
1495
|
+
const childrenArray = React9.Children.toArray(children);
|
|
1496
|
+
const slottable = childrenArray.find(isSlottable);
|
|
1497
|
+
if (slottable) {
|
|
1498
|
+
const newElement = slottable.props.children;
|
|
1499
|
+
const newChildren = childrenArray.map((child) => {
|
|
1500
|
+
if (child === slottable) {
|
|
1501
|
+
if (React9.Children.count(newElement) > 1) return React9.Children.only(null);
|
|
1502
|
+
return React9.isValidElement(newElement) ? newElement.props.children : null;
|
|
1503
|
+
} else {
|
|
1504
|
+
return child;
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React9.isValidElement(newElement) ? React9.cloneElement(newElement, void 0, newChildren) : null });
|
|
1508
|
+
}
|
|
1509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
1510
|
+
});
|
|
1511
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
1512
|
+
return Slot2;
|
|
1513
|
+
}
|
|
1514
|
+
// @__NO_SIDE_EFFECTS__
|
|
1515
|
+
function createSlotClone(ownerName) {
|
|
1516
|
+
const SlotClone = React9.forwardRef((props, forwardedRef) => {
|
|
1517
|
+
const { children, ...slotProps } = props;
|
|
1518
|
+
if (React9.isValidElement(children)) {
|
|
1519
|
+
const childrenRef = getElementRef2(children);
|
|
1520
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
1521
|
+
if (children.type !== React9.Fragment) {
|
|
1522
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
1523
|
+
}
|
|
1524
|
+
return React9.cloneElement(children, props2);
|
|
1525
|
+
}
|
|
1526
|
+
return React9.Children.count(children) > 1 ? React9.Children.only(null) : null;
|
|
1527
|
+
});
|
|
1528
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
1529
|
+
return SlotClone;
|
|
1530
|
+
}
|
|
1531
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
1532
|
+
function isSlottable(child) {
|
|
1533
|
+
return React9.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
1534
|
+
}
|
|
1535
|
+
function mergeProps(slotProps, childProps) {
|
|
1536
|
+
const overrideProps = { ...childProps };
|
|
1537
|
+
for (const propName in childProps) {
|
|
1538
|
+
const slotPropValue = slotProps[propName];
|
|
1539
|
+
const childPropValue = childProps[propName];
|
|
1540
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
1541
|
+
if (isHandler) {
|
|
1542
|
+
if (slotPropValue && childPropValue) {
|
|
1543
|
+
overrideProps[propName] = (...args) => {
|
|
1544
|
+
const result = childPropValue(...args);
|
|
1545
|
+
slotPropValue(...args);
|
|
1546
|
+
return result;
|
|
1547
|
+
};
|
|
1548
|
+
} else if (slotPropValue) {
|
|
1549
|
+
overrideProps[propName] = slotPropValue;
|
|
1550
|
+
}
|
|
1551
|
+
} else if (propName === "style") {
|
|
1552
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
1553
|
+
} else if (propName === "className") {
|
|
1554
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
return { ...slotProps, ...overrideProps };
|
|
1558
|
+
}
|
|
1559
|
+
function getElementRef2(element) {
|
|
1560
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1561
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1562
|
+
if (mayWarn) {
|
|
1563
|
+
return element.ref;
|
|
1564
|
+
}
|
|
1565
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1566
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1567
|
+
if (mayWarn) {
|
|
1568
|
+
return element.props.ref;
|
|
1569
|
+
}
|
|
1570
|
+
return element.props.ref || element.ref;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
1574
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1575
|
+
var NODES = [
|
|
1576
|
+
"a",
|
|
1577
|
+
"button",
|
|
1578
|
+
"div",
|
|
1579
|
+
"form",
|
|
1580
|
+
"h2",
|
|
1581
|
+
"h3",
|
|
1582
|
+
"img",
|
|
1583
|
+
"input",
|
|
1584
|
+
"label",
|
|
1585
|
+
"li",
|
|
1586
|
+
"nav",
|
|
1587
|
+
"ol",
|
|
1588
|
+
"p",
|
|
1589
|
+
"select",
|
|
1590
|
+
"span",
|
|
1591
|
+
"svg",
|
|
1592
|
+
"ul"
|
|
1593
|
+
];
|
|
1594
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
1595
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
1596
|
+
const Node = React10.forwardRef((props, forwardedRef) => {
|
|
1597
|
+
const { asChild, ...primitiveProps } = props;
|
|
1598
|
+
const Comp = asChild ? Slot : node;
|
|
1599
|
+
if (typeof window !== "undefined") {
|
|
1600
|
+
window[Symbol.for("radix-ui")] = true;
|
|
1601
|
+
}
|
|
1602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
1603
|
+
});
|
|
1604
|
+
Node.displayName = `Primitive.${node}`;
|
|
1605
|
+
return { ...primitive, [node]: Node };
|
|
1606
|
+
}, {});
|
|
1607
|
+
|
|
1608
|
+
// node_modules/@radix-ui/react-checkbox/dist/index.mjs
|
|
1609
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1610
|
+
var CHECKBOX_NAME = "Checkbox";
|
|
1611
|
+
var [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);
|
|
1612
|
+
var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
|
|
1613
|
+
function CheckboxProvider(props) {
|
|
1614
|
+
const {
|
|
1615
|
+
__scopeCheckbox,
|
|
1616
|
+
checked: checkedProp,
|
|
1617
|
+
children,
|
|
1618
|
+
defaultChecked,
|
|
1619
|
+
disabled,
|
|
1620
|
+
form,
|
|
1621
|
+
name,
|
|
1622
|
+
onCheckedChange,
|
|
1623
|
+
required,
|
|
1624
|
+
value = "on",
|
|
1625
|
+
// @ts-expect-error
|
|
1626
|
+
internal_do_not_use_render
|
|
1627
|
+
} = props;
|
|
1628
|
+
const [checked, setChecked] = useControllableState({
|
|
1629
|
+
prop: checkedProp,
|
|
1630
|
+
defaultProp: defaultChecked ?? false,
|
|
1631
|
+
onChange: onCheckedChange,
|
|
1632
|
+
caller: CHECKBOX_NAME
|
|
1633
|
+
});
|
|
1634
|
+
const [control, setControl] = React11.useState(null);
|
|
1635
|
+
const [bubbleInput, setBubbleInput] = React11.useState(null);
|
|
1636
|
+
const hasConsumerStoppedPropagationRef = React11.useRef(false);
|
|
1637
|
+
const isFormControl = control ? !!form || !!control.closest("form") : (
|
|
1638
|
+
// We set this to true by default so that events bubble to forms without JS (SSR)
|
|
1639
|
+
true
|
|
1640
|
+
);
|
|
1641
|
+
const context = {
|
|
1642
|
+
checked,
|
|
1643
|
+
disabled,
|
|
1644
|
+
setChecked,
|
|
1645
|
+
control,
|
|
1646
|
+
setControl,
|
|
1647
|
+
name,
|
|
1648
|
+
form,
|
|
1649
|
+
value,
|
|
1650
|
+
hasConsumerStoppedPropagationRef,
|
|
1651
|
+
required,
|
|
1652
|
+
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
|
|
1653
|
+
isFormControl,
|
|
1654
|
+
bubbleInput,
|
|
1655
|
+
setBubbleInput
|
|
1656
|
+
};
|
|
1657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1658
|
+
CheckboxProviderImpl,
|
|
1659
|
+
{
|
|
1660
|
+
scope: __scopeCheckbox,
|
|
1661
|
+
...context,
|
|
1662
|
+
children: isFunction2(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
|
|
1663
|
+
}
|
|
1664
|
+
);
|
|
1665
|
+
}
|
|
1666
|
+
var TRIGGER_NAME = "CheckboxTrigger";
|
|
1667
|
+
var CheckboxTrigger = React11.forwardRef(
|
|
1668
|
+
({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) => {
|
|
1669
|
+
const {
|
|
1670
|
+
control,
|
|
1671
|
+
value,
|
|
1672
|
+
disabled,
|
|
1673
|
+
checked,
|
|
1674
|
+
required,
|
|
1675
|
+
setControl,
|
|
1676
|
+
setChecked,
|
|
1677
|
+
hasConsumerStoppedPropagationRef,
|
|
1678
|
+
isFormControl,
|
|
1679
|
+
bubbleInput
|
|
1680
|
+
} = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
|
|
1681
|
+
const composedRefs = useComposedRefs(forwardedRef, setControl);
|
|
1682
|
+
const initialCheckedStateRef = React11.useRef(checked);
|
|
1683
|
+
React11.useEffect(() => {
|
|
1684
|
+
const form = control?.form;
|
|
1685
|
+
if (form) {
|
|
1686
|
+
const reset = () => setChecked(initialCheckedStateRef.current);
|
|
1687
|
+
form.addEventListener("reset", reset);
|
|
1688
|
+
return () => form.removeEventListener("reset", reset);
|
|
1689
|
+
}
|
|
1690
|
+
}, [control, setChecked]);
|
|
1691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1692
|
+
Primitive.button,
|
|
1693
|
+
{
|
|
1694
|
+
type: "button",
|
|
1695
|
+
role: "checkbox",
|
|
1696
|
+
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
|
|
1697
|
+
"aria-required": required,
|
|
1698
|
+
"data-state": getState(checked),
|
|
1699
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1700
|
+
disabled,
|
|
1701
|
+
value,
|
|
1702
|
+
...checkboxProps,
|
|
1703
|
+
ref: composedRefs,
|
|
1704
|
+
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
1705
|
+
if (event.key === "Enter") event.preventDefault();
|
|
1706
|
+
}),
|
|
1707
|
+
onClick: composeEventHandlers(onClick, (event) => {
|
|
1708
|
+
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
|
|
1709
|
+
if (bubbleInput && isFormControl) {
|
|
1710
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
1711
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
1712
|
+
}
|
|
1713
|
+
})
|
|
1714
|
+
}
|
|
1715
|
+
);
|
|
1716
|
+
}
|
|
1717
|
+
);
|
|
1718
|
+
CheckboxTrigger.displayName = TRIGGER_NAME;
|
|
1719
|
+
var Checkbox = React11.forwardRef(
|
|
1720
|
+
(props, forwardedRef) => {
|
|
1721
|
+
const {
|
|
1722
|
+
__scopeCheckbox,
|
|
1723
|
+
name,
|
|
1724
|
+
checked,
|
|
1725
|
+
defaultChecked,
|
|
1726
|
+
required,
|
|
1727
|
+
disabled,
|
|
1728
|
+
value,
|
|
1729
|
+
onCheckedChange,
|
|
1730
|
+
form,
|
|
1731
|
+
...checkboxProps
|
|
1732
|
+
} = props;
|
|
1733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1734
|
+
CheckboxProvider,
|
|
1735
|
+
{
|
|
1736
|
+
__scopeCheckbox,
|
|
1737
|
+
checked,
|
|
1738
|
+
defaultChecked,
|
|
1739
|
+
disabled,
|
|
1740
|
+
required,
|
|
1741
|
+
onCheckedChange,
|
|
1742
|
+
name,
|
|
1743
|
+
form,
|
|
1744
|
+
value,
|
|
1745
|
+
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1747
|
+
CheckboxTrigger,
|
|
1748
|
+
{
|
|
1749
|
+
...checkboxProps,
|
|
1750
|
+
ref: forwardedRef,
|
|
1751
|
+
__scopeCheckbox
|
|
1752
|
+
}
|
|
1753
|
+
),
|
|
1754
|
+
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1755
|
+
CheckboxBubbleInput,
|
|
1756
|
+
{
|
|
1757
|
+
__scopeCheckbox
|
|
1758
|
+
}
|
|
1759
|
+
)
|
|
1760
|
+
] })
|
|
1761
|
+
}
|
|
1762
|
+
);
|
|
1763
|
+
}
|
|
1764
|
+
);
|
|
1765
|
+
Checkbox.displayName = CHECKBOX_NAME;
|
|
1766
|
+
var INDICATOR_NAME = "CheckboxIndicator";
|
|
1767
|
+
var CheckboxIndicator = React11.forwardRef(
|
|
1768
|
+
(props, forwardedRef) => {
|
|
1769
|
+
const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
|
|
1770
|
+
const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
|
|
1771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1772
|
+
Presence,
|
|
1773
|
+
{
|
|
1774
|
+
present: forceMount || isIndeterminate(context.checked) || context.checked === true,
|
|
1775
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1776
|
+
Primitive.span,
|
|
1777
|
+
{
|
|
1778
|
+
"data-state": getState(context.checked),
|
|
1779
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
1780
|
+
...indicatorProps,
|
|
1781
|
+
ref: forwardedRef,
|
|
1782
|
+
style: { pointerEvents: "none", ...props.style }
|
|
1783
|
+
}
|
|
1784
|
+
)
|
|
1785
|
+
}
|
|
1786
|
+
);
|
|
1787
|
+
}
|
|
1788
|
+
);
|
|
1789
|
+
CheckboxIndicator.displayName = INDICATOR_NAME;
|
|
1790
|
+
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
|
|
1791
|
+
var CheckboxBubbleInput = React11.forwardRef(
|
|
1792
|
+
({ __scopeCheckbox, ...props }, forwardedRef) => {
|
|
1793
|
+
const {
|
|
1794
|
+
control,
|
|
1795
|
+
hasConsumerStoppedPropagationRef,
|
|
1796
|
+
checked,
|
|
1797
|
+
defaultChecked,
|
|
1798
|
+
required,
|
|
1799
|
+
disabled,
|
|
1800
|
+
name,
|
|
1801
|
+
value,
|
|
1802
|
+
form,
|
|
1803
|
+
bubbleInput,
|
|
1804
|
+
setBubbleInput
|
|
1805
|
+
} = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
|
|
1806
|
+
const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
|
|
1807
|
+
const prevChecked = usePrevious(checked);
|
|
1808
|
+
const controlSize = useSize(control);
|
|
1809
|
+
React11.useEffect(() => {
|
|
1810
|
+
const input = bubbleInput;
|
|
1811
|
+
if (!input) return;
|
|
1812
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
1813
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
1814
|
+
inputProto,
|
|
1815
|
+
"checked"
|
|
1816
|
+
);
|
|
1817
|
+
const setChecked = descriptor.set;
|
|
1818
|
+
const bubbles = !hasConsumerStoppedPropagationRef.current;
|
|
1819
|
+
if (prevChecked !== checked && setChecked) {
|
|
1820
|
+
const event = new Event("click", { bubbles });
|
|
1821
|
+
input.indeterminate = isIndeterminate(checked);
|
|
1822
|
+
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
|
1823
|
+
input.dispatchEvent(event);
|
|
1824
|
+
}
|
|
1825
|
+
}, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
|
|
1826
|
+
const defaultCheckedRef = React11.useRef(isIndeterminate(checked) ? false : checked);
|
|
1827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1828
|
+
Primitive.input,
|
|
1829
|
+
{
|
|
1830
|
+
type: "checkbox",
|
|
1831
|
+
"aria-hidden": true,
|
|
1832
|
+
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
|
|
1833
|
+
required,
|
|
1834
|
+
disabled,
|
|
1835
|
+
name,
|
|
1836
|
+
value,
|
|
1837
|
+
form,
|
|
1838
|
+
...props,
|
|
1839
|
+
tabIndex: -1,
|
|
1840
|
+
ref: composedRefs,
|
|
1841
|
+
style: {
|
|
1842
|
+
...props.style,
|
|
1843
|
+
...controlSize,
|
|
1844
|
+
position: "absolute",
|
|
1845
|
+
pointerEvents: "none",
|
|
1846
|
+
opacity: 0,
|
|
1847
|
+
margin: 0,
|
|
1848
|
+
// We transform because the input is absolutely positioned but we have
|
|
1849
|
+
// rendered it **after** the button. This pulls it back to sit on top
|
|
1850
|
+
// of the button.
|
|
1851
|
+
transform: "translateX(-100%)"
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
);
|
|
1855
|
+
}
|
|
1856
|
+
);
|
|
1857
|
+
CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
1858
|
+
function isFunction2(value) {
|
|
1859
|
+
return typeof value === "function";
|
|
1860
|
+
}
|
|
1861
|
+
function isIndeterminate(checked) {
|
|
1862
|
+
return checked === "indeterminate";
|
|
1863
|
+
}
|
|
1864
|
+
function getState(checked) {
|
|
1865
|
+
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
// src/components/user-action/Checkbox.tsx
|
|
1869
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1870
|
+
var checkboxSizeMapping = {
|
|
1871
|
+
sm: "size-5 border-1",
|
|
1872
|
+
md: "size-6 border-1",
|
|
1873
|
+
lg: "size-8 border-2"
|
|
1874
|
+
};
|
|
1875
|
+
var checkboxIconSizeMapping = {
|
|
1876
|
+
sm: "size-4 stroke-3",
|
|
1877
|
+
md: "size-5 stroke-3",
|
|
1878
|
+
lg: "size-7 stroke-3"
|
|
1879
|
+
};
|
|
1880
|
+
var Checkbox2 = ({
|
|
1881
|
+
disabled,
|
|
1882
|
+
checked = false,
|
|
1883
|
+
indeterminate = false,
|
|
1884
|
+
onChange,
|
|
1885
|
+
size = "md",
|
|
1886
|
+
className = "",
|
|
1887
|
+
...props
|
|
1888
|
+
}) => {
|
|
1889
|
+
const usedSizeClass = checkboxSizeMapping[size];
|
|
1890
|
+
const innerIconSize = checkboxIconSizeMapping[size];
|
|
1891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1892
|
+
Checkbox,
|
|
1893
|
+
{
|
|
1894
|
+
...props,
|
|
1895
|
+
disabled,
|
|
1896
|
+
checked: indeterminate ? "indeterminate" : checked,
|
|
1897
|
+
onCheckedChange: onChange,
|
|
1898
|
+
className: (0, import_clsx8.default)(
|
|
1899
|
+
usedSizeClass,
|
|
1900
|
+
`flex-col-0 items-center justify-center rounded outline-none`,
|
|
1901
|
+
{
|
|
1902
|
+
"text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
|
|
1903
|
+
"hover:border-primary": !disabled,
|
|
1904
|
+
"bg-input-background": !disabled && !checked,
|
|
1905
|
+
"bg-primary/30 border-primary text-primary": !disabled && (checked || indeterminate)
|
|
1906
|
+
},
|
|
1907
|
+
className
|
|
1908
|
+
),
|
|
1909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(CheckboxIndicator, { children: [
|
|
1910
|
+
!checked && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_clsx8.default)("bg-input-background", innerIconSize) }),
|
|
1911
|
+
checked && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react4.Check, { className: innerIconSize }),
|
|
1912
|
+
indeterminate && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react4.Minus, { className: innerIconSize })
|
|
1913
|
+
] })
|
|
1914
|
+
}
|
|
1915
|
+
);
|
|
1916
|
+
};
|
|
1917
|
+
|
|
1918
|
+
// src/components/table/Table.tsx
|
|
1919
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1920
|
+
var Table = ({
|
|
1921
|
+
data,
|
|
1922
|
+
fillerRow,
|
|
1923
|
+
initialState,
|
|
1924
|
+
onRowClick = noop,
|
|
1925
|
+
className,
|
|
1926
|
+
tableClassName,
|
|
1927
|
+
defaultColumn,
|
|
1928
|
+
state,
|
|
1929
|
+
columns,
|
|
1930
|
+
...tableOptions
|
|
1931
|
+
}) => {
|
|
1932
|
+
const ref = (0, import_react14.useRef)(null);
|
|
1933
|
+
const tableRef = (0, import_react14.useRef)(null);
|
|
1934
|
+
const [columnSizing, setColumnSizing] = (0, import_react14.useState)(columns.reduce((previousValue, currentValue) => {
|
|
1935
|
+
return {
|
|
1936
|
+
...previousValue,
|
|
1937
|
+
[currentValue.id]: currentValue.minSize ?? defaultColumn.minSize
|
|
1938
|
+
};
|
|
1939
|
+
}, {}));
|
|
1940
|
+
const [columnSizingInfo, setColumnSizingInfo] = (0, import_react14.useState)();
|
|
1941
|
+
const [pagination, setPagination] = (0, import_react14.useState)({
|
|
1942
|
+
pageSize: 10,
|
|
1943
|
+
pageIndex: 0,
|
|
1944
|
+
...initialState?.pagination
|
|
1945
|
+
});
|
|
1946
|
+
const [columnFilters, setColumnFilters] = (0, import_react14.useState)(initialState?.columnFilters);
|
|
1947
|
+
const computedColumnMinWidths = (0, import_react14.useMemo)(() => {
|
|
1948
|
+
return columns.reduce((previousValue, column) => {
|
|
1949
|
+
return {
|
|
1950
|
+
...previousValue,
|
|
1951
|
+
// every column is at least 12px wide
|
|
1952
|
+
[column.id]: column.minSize ?? defaultColumn?.minSize ?? 12
|
|
1953
|
+
};
|
|
1954
|
+
}, {});
|
|
1955
|
+
}, [columns, defaultColumn]);
|
|
1956
|
+
const computedColumnMaxWidths = (0, import_react14.useMemo)(() => {
|
|
1957
|
+
return columns.reduce((previousValue, column) => {
|
|
1958
|
+
return {
|
|
1959
|
+
...previousValue,
|
|
1960
|
+
[column.id]: column.maxSize ?? defaultColumn?.maxSize
|
|
1961
|
+
};
|
|
1962
|
+
}, {});
|
|
1963
|
+
}, [columns, defaultColumn]);
|
|
1964
|
+
const tableMinWidth = (0, import_react14.useMemo)(() => {
|
|
1965
|
+
return columns.reduce((sum, column) => {
|
|
1966
|
+
return sum + computedColumnMinWidths[column.id];
|
|
1967
|
+
}, 0);
|
|
1968
|
+
}, [columns, computedColumnMinWidths]);
|
|
1969
|
+
const updateColumnSizes = (0, import_react14.useMemo)(() => {
|
|
1970
|
+
return (previous) => {
|
|
1971
|
+
const updateSizing = {
|
|
1972
|
+
...columnSizing,
|
|
1973
|
+
...previous
|
|
1974
|
+
};
|
|
1975
|
+
const containerWidth = ref.current.offsetWidth;
|
|
1976
|
+
columns.forEach((column) => {
|
|
1977
|
+
updateSizing[column.id] = clamp(updateSizing[column.id], [computedColumnMinWidths[column.id], computedColumnMaxWidths[column.id] ?? containerWidth]);
|
|
1978
|
+
});
|
|
1979
|
+
const width = columns.reduce((previousValue, currentValue) => previousValue + updateSizing[currentValue.id], 0);
|
|
1980
|
+
if (width > containerWidth) {
|
|
1981
|
+
if (tableMinWidth >= containerWidth) {
|
|
1982
|
+
return columns.reduce((previousValue, currentValue) => ({
|
|
1983
|
+
...previousValue,
|
|
1984
|
+
[currentValue.id]: computedColumnMinWidths[currentValue.id]
|
|
1985
|
+
}), {});
|
|
1986
|
+
}
|
|
1987
|
+
let reduceableColumns = columns.map((value) => value.id).filter((id) => updateSizing[id] - computedColumnMinWidths[id] > 0);
|
|
1988
|
+
let spaceToReduce = width - containerWidth;
|
|
1989
|
+
while (spaceToReduce > 0 && reduceableColumns.length > 0) {
|
|
1990
|
+
let maxReduceAmount = reduceableColumns.reduce((previousValue, id) => Math.max(previousValue, updateSizing[id] - computedColumnMinWidths[id]), 0);
|
|
1991
|
+
if (maxReduceAmount * reduceableColumns.length > spaceToReduce) {
|
|
1992
|
+
maxReduceAmount = spaceToReduce / reduceableColumns.length;
|
|
1993
|
+
}
|
|
1994
|
+
reduceableColumns.forEach((id) => {
|
|
1995
|
+
updateSizing[id] -= maxReduceAmount;
|
|
1996
|
+
});
|
|
1997
|
+
spaceToReduce -= maxReduceAmount * reduceableColumns.length;
|
|
1998
|
+
reduceableColumns = reduceableColumns.filter((id) => updateSizing[id] - computedColumnMinWidths[id] > 0);
|
|
1999
|
+
}
|
|
2000
|
+
} else if (width <= containerWidth) {
|
|
2001
|
+
let distributableWidth = containerWidth - width;
|
|
2002
|
+
const violatingColumns = columns.filter((value) => computedColumnMaxWidths[value.id] && updateSizing[value.id] > computedColumnMaxWidths[value.id]);
|
|
2003
|
+
const violationColumnsAmount = violatingColumns.reduce(
|
|
2004
|
+
(previousValue, column) => previousValue + updateSizing[column.id] - computedColumnMaxWidths[column.id],
|
|
2005
|
+
0
|
|
2006
|
+
);
|
|
2007
|
+
distributableWidth += violationColumnsAmount;
|
|
2008
|
+
let enlargeableColumns = columns.filter((col) => !computedColumnMaxWidths[col.id] || updateSizing[col.id] < computedColumnMaxWidths[col.id]).map((value) => value.id);
|
|
2009
|
+
while (distributableWidth > 0 && enlargeableColumns.length > 0) {
|
|
2010
|
+
let minEnlargeableAmount = enlargeableColumns.reduce((previousValue, id) => Math.min(previousValue, computedColumnMaxWidths[id] ? computedColumnMaxWidths[id] - updateSizing[id] : distributableWidth), distributableWidth);
|
|
2011
|
+
if (minEnlargeableAmount * enlargeableColumns.length > distributableWidth) {
|
|
2012
|
+
minEnlargeableAmount = distributableWidth / enlargeableColumns.length;
|
|
2013
|
+
}
|
|
2014
|
+
enlargeableColumns.forEach((id) => {
|
|
2015
|
+
updateSizing[id] += minEnlargeableAmount;
|
|
2016
|
+
});
|
|
2017
|
+
distributableWidth -= minEnlargeableAmount * enlargeableColumns.length;
|
|
2018
|
+
enlargeableColumns = enlargeableColumns.filter((id) => !computedColumnMaxWidths[id] || updateSizing[id] < computedColumnMaxWidths[id]);
|
|
2019
|
+
}
|
|
2020
|
+
if (distributableWidth > 0) {
|
|
2021
|
+
updateSizing[columns[columns.length - 1].id] += distributableWidth;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
return updateSizing;
|
|
2025
|
+
};
|
|
2026
|
+
}, [columns, computedColumnMaxWidths, computedColumnMinWidths, tableMinWidth]);
|
|
2027
|
+
const table = (0, import_react_table.useReactTable)({
|
|
2028
|
+
data,
|
|
2029
|
+
getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
|
|
2030
|
+
getFilteredRowModel: (0, import_react_table.getFilteredRowModel)(),
|
|
2031
|
+
getSortedRowModel: (0, import_react_table.getSortedRowModel)(),
|
|
2032
|
+
getPaginationRowModel: (0, import_react_table.getPaginationRowModel)(),
|
|
2033
|
+
initialState,
|
|
2034
|
+
defaultColumn: {
|
|
2035
|
+
minSize: 60,
|
|
2036
|
+
maxSize: 700,
|
|
2037
|
+
cell: ({ cell }) => {
|
|
2038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TableCell, { children: cell.getValue() });
|
|
2039
|
+
},
|
|
2040
|
+
...defaultColumn
|
|
2041
|
+
},
|
|
2042
|
+
columns,
|
|
2043
|
+
state: {
|
|
2044
|
+
columnSizing,
|
|
2045
|
+
columnSizingInfo,
|
|
2046
|
+
pagination,
|
|
2047
|
+
columnFilters,
|
|
2048
|
+
...state
|
|
2049
|
+
},
|
|
2050
|
+
filterFns: {
|
|
2051
|
+
...tableOptions?.filterFns,
|
|
2052
|
+
dateRange: TableFilters.dateRange
|
|
2053
|
+
},
|
|
2054
|
+
onColumnSizingInfoChange: (updaterOrValue) => {
|
|
2055
|
+
setColumnSizingInfo(updaterOrValue);
|
|
2056
|
+
if (tableOptions.onColumnSizingInfoChange) {
|
|
2057
|
+
tableOptions?.onColumnSizingInfoChange(updaterOrValue);
|
|
2058
|
+
}
|
|
2059
|
+
},
|
|
2060
|
+
onColumnSizingChange: (updaterOrValue) => {
|
|
2061
|
+
setColumnSizing((previous) => {
|
|
2062
|
+
const newSizing = typeof updaterOrValue === "function" ? updaterOrValue(previous) : updaterOrValue;
|
|
2063
|
+
return updateColumnSizes(newSizing);
|
|
2064
|
+
});
|
|
2065
|
+
if (tableOptions.onColumnSizingChange) {
|
|
2066
|
+
tableOptions.onColumnSizingChange(updaterOrValue);
|
|
2067
|
+
}
|
|
2068
|
+
},
|
|
2069
|
+
onPaginationChange: (updaterOrValue) => {
|
|
2070
|
+
setPagination(updaterOrValue);
|
|
2071
|
+
if (tableOptions.onPaginationChange) {
|
|
2072
|
+
tableOptions.onPaginationChange(updaterOrValue);
|
|
2073
|
+
}
|
|
2074
|
+
},
|
|
2075
|
+
onColumnFiltersChange: (updaterOrValue) => {
|
|
2076
|
+
setColumnFilters(updaterOrValue);
|
|
2077
|
+
table.toggleAllRowsSelected(false);
|
|
2078
|
+
if (tableOptions.onColumnFiltersChange) {
|
|
2079
|
+
tableOptions.onColumnFiltersChange(updaterOrValue);
|
|
2080
|
+
}
|
|
2081
|
+
},
|
|
2082
|
+
autoResetPageIndex: false,
|
|
2083
|
+
columnResizeMode: "onChange",
|
|
2084
|
+
...tableOptions
|
|
2085
|
+
});
|
|
2086
|
+
const [hasInitializedSizing, setHasInitializedSizing] = (0, import_react14.useState)(false);
|
|
2087
|
+
(0, import_react14.useEffect)(() => {
|
|
2088
|
+
if (!hasInitializedSizing && ref.current) {
|
|
2089
|
+
setHasInitializedSizing(true);
|
|
2090
|
+
table.setColumnSizing(updateColumnSizes(columnSizing));
|
|
2091
|
+
}
|
|
2092
|
+
}, [columnSizing, hasInitializedSizing]);
|
|
2093
|
+
useResizeCallbackWrapper((0, import_react14.useCallback)(() => {
|
|
2094
|
+
table.setColumnSizing(updateColumnSizes);
|
|
2095
|
+
}, [updateColumnSizes]));
|
|
2096
|
+
const pageCount = table.getPageCount();
|
|
2097
|
+
(0, import_react14.useEffect)(() => {
|
|
2098
|
+
const totalPages = pageCount;
|
|
2099
|
+
if (totalPages === 0) {
|
|
2100
|
+
if (pagination.pageIndex !== 0) {
|
|
2101
|
+
table.setPagination((prevState) => ({
|
|
2102
|
+
...prevState,
|
|
2103
|
+
pageIndex: 0
|
|
2104
|
+
}));
|
|
2105
|
+
}
|
|
2106
|
+
} else if (pagination.pageIndex >= totalPages) {
|
|
2107
|
+
table.setPagination((prev) => ({
|
|
2108
|
+
...prev,
|
|
2109
|
+
pageIndex: totalPages - 1
|
|
2110
|
+
}));
|
|
2111
|
+
}
|
|
2112
|
+
}, [data, pageCount, pagination.pageSize, pagination.pageIndex]);
|
|
2113
|
+
const columnSizeVars = (0, import_react14.useMemo)(() => {
|
|
2114
|
+
const headers = table.getFlatHeaders();
|
|
2115
|
+
const colSizes = {};
|
|
2116
|
+
for (let i = 0; i < headers.length; i++) {
|
|
2117
|
+
const header = headers[i];
|
|
2118
|
+
colSizes[`--header-${header.id}-size`] = Math.floor(header.getSize());
|
|
2119
|
+
colSizes[`--col-${header.column.id}-size`] = Math.floor(header.column.getSize());
|
|
2120
|
+
}
|
|
2121
|
+
return colSizes;
|
|
2122
|
+
}, [table.getState().columnSizingInfo, table.getState().columnSizing]);
|
|
2123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref, className: (0, import_clsx9.default)("flex-col-4", className), children: [
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2125
|
+
import_react_custom_scrollbars_2.Scrollbars,
|
|
2126
|
+
{
|
|
2127
|
+
autoHeight: true,
|
|
2128
|
+
autoHeightMax: tableRef.current?.offsetHeight ? tableRef.current?.offsetHeight + 2 : void 0,
|
|
2129
|
+
autoHide: true,
|
|
2130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2131
|
+
"table",
|
|
2132
|
+
{
|
|
2133
|
+
ref: tableRef,
|
|
2134
|
+
className: (0, import_clsx9.default)(tableClassName),
|
|
2135
|
+
style: {
|
|
2136
|
+
...columnSizeVars,
|
|
2137
|
+
width: Math.floor(Math.max(table.getTotalSize() - columns.length, ref.current?.offsetWidth ?? table.getTotalSize()))
|
|
2138
|
+
},
|
|
2139
|
+
children: [
|
|
2140
|
+
table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("colgroup", { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2141
|
+
"col",
|
|
2142
|
+
{
|
|
2143
|
+
style: {
|
|
2144
|
+
width: `calc(var(--header-${header?.id}-size) * 1px)`,
|
|
2145
|
+
minWidth: header.column.columnDef.minSize,
|
|
2146
|
+
maxWidth: header.column.columnDef.maxSize
|
|
2147
|
+
}
|
|
2148
|
+
},
|
|
2149
|
+
header.id
|
|
2150
|
+
)) }, headerGroup.id)),
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: table.options.meta?.headerRowClassName, children: headerGroup.headers.map((header) => {
|
|
2152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2153
|
+
"th",
|
|
2154
|
+
{
|
|
2155
|
+
colSpan: header.colSpan,
|
|
2156
|
+
className: (0, import_clsx9.default)("relative group", header.column.columnDef.meta?.className),
|
|
2157
|
+
children: [
|
|
2158
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex-row-2 w-full", children: header.isPlaceholder ? null : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex-row-1 items-center", children: [
|
|
2159
|
+
header.column.getCanSort() && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2160
|
+
TableSortButton,
|
|
2161
|
+
{
|
|
2162
|
+
sortDirection: header.column.getIsSorted(),
|
|
2163
|
+
onClick: () => header.column.toggleSorting()
|
|
2164
|
+
}
|
|
2165
|
+
),
|
|
2166
|
+
header.column.getCanFilter() && header.column.columnDef.meta?.filterType ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2167
|
+
TableFilterButton,
|
|
2168
|
+
{
|
|
2169
|
+
column: header.column,
|
|
2170
|
+
filterType: header.column.columnDef.meta.filterType
|
|
2171
|
+
}
|
|
2172
|
+
) : null,
|
|
2173
|
+
(0, import_react_table.flexRender)(
|
|
2174
|
+
header.column.columnDef.header,
|
|
2175
|
+
header.getContext()
|
|
2176
|
+
)
|
|
2177
|
+
] }) }),
|
|
2178
|
+
header.column.getCanResize() && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2179
|
+
"div",
|
|
2180
|
+
{
|
|
2181
|
+
onMouseDown: header.getResizeHandler(),
|
|
2182
|
+
onTouchStart: header.getResizeHandler(),
|
|
2183
|
+
onDoubleClick: () => {
|
|
2184
|
+
header.column.resetSize();
|
|
2185
|
+
},
|
|
2186
|
+
className: "table-resize-indicator w-2 rounded bg-primary cursor-col-resize select-none touch-none opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2187
|
+
style: {
|
|
2188
|
+
opacity: !columnSizingInfo?.columnSizingStart ? void 0 : columnSizingInfo?.columnSizingStart?.findIndex(([id, _]) => id === header.column.id) !== -1 ? 1 : columnSizingInfo?.columnSizingStart?.length !== 0 ? 0 : void 0
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
)
|
|
2192
|
+
]
|
|
2193
|
+
},
|
|
2194
|
+
header.id
|
|
2195
|
+
);
|
|
2196
|
+
}) }, headerGroup.id)) }),
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("tbody", { children: [
|
|
2198
|
+
table.getRowModel().rows.map((row) => {
|
|
2199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { onClick: () => onRowClick(row, table), className: table.options.meta?.bodyRowClassName, children: row.getVisibleCells().map((cell) => {
|
|
2200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { children: (0, import_react_table.flexRender)(
|
|
2201
|
+
cell.column.columnDef.cell,
|
|
2202
|
+
cell.getContext()
|
|
2203
|
+
) }, cell.id);
|
|
2204
|
+
}) }, row.id);
|
|
2205
|
+
}),
|
|
2206
|
+
range(table.getState().pagination.pageSize - table.getRowModel().rows.length, { allowEmptyRange: true }).map((row, index) => {
|
|
2207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { children: columns.map((column) => {
|
|
2208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { children: fillerRow ? fillerRow(column.id, table) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FillerRowElement, {}) }, column.id);
|
|
2209
|
+
}) }, "filler-row-" + index);
|
|
2210
|
+
})
|
|
2211
|
+
] })
|
|
2212
|
+
]
|
|
2213
|
+
}
|
|
2214
|
+
)
|
|
2215
|
+
}
|
|
2216
|
+
),
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex-row-2 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2218
|
+
Pagination,
|
|
2219
|
+
{
|
|
2220
|
+
pageIndex: table.getState().pagination.pageIndex,
|
|
2221
|
+
pageCount: table.getPageCount(),
|
|
2222
|
+
onPageChanged: (page) => table.setPageIndex(page)
|
|
2223
|
+
}
|
|
2224
|
+
) })
|
|
2225
|
+
] });
|
|
2226
|
+
};
|
|
2227
|
+
var TableUncontrolled = ({ data, ...props }) => {
|
|
2228
|
+
const [usedDate, setUsedData] = (0, import_react14.useState)(data);
|
|
2229
|
+
(0, import_react14.useEffect)(() => {
|
|
2230
|
+
setUsedData(data);
|
|
2231
|
+
}, [data]);
|
|
2232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2233
|
+
Table,
|
|
2234
|
+
{
|
|
2235
|
+
...props,
|
|
2236
|
+
data: usedDate
|
|
2237
|
+
}
|
|
2238
|
+
);
|
|
2239
|
+
};
|
|
2240
|
+
var TableWithSelection = ({
|
|
2241
|
+
columns,
|
|
2242
|
+
state,
|
|
2243
|
+
fillerRow,
|
|
2244
|
+
rowSelection,
|
|
2245
|
+
disableClickRowClickSelection = false,
|
|
2246
|
+
selectionRowId = "selection",
|
|
2247
|
+
onRowClick = noop,
|
|
2248
|
+
meta,
|
|
2249
|
+
...props
|
|
2250
|
+
}) => {
|
|
2251
|
+
const columnsWithSelection = (0, import_react14.useMemo)(() => {
|
|
2252
|
+
return [
|
|
2253
|
+
{
|
|
2254
|
+
id: selectionRowId,
|
|
2255
|
+
header: ({ table }) => {
|
|
2256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2257
|
+
Checkbox2,
|
|
2258
|
+
{
|
|
2259
|
+
checked: table.getIsAllRowsSelected(),
|
|
2260
|
+
indeterminate: table.getIsSomeRowsSelected(),
|
|
2261
|
+
onChange: (value) => {
|
|
2262
|
+
const newValue = !!value;
|
|
2263
|
+
table.toggleAllRowsSelected(newValue);
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
);
|
|
2267
|
+
},
|
|
2268
|
+
cell: ({ row }) => {
|
|
2269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2270
|
+
Checkbox2,
|
|
2271
|
+
{
|
|
2272
|
+
disabled: !row.getCanSelect(),
|
|
2273
|
+
checked: row.getIsSelected(),
|
|
2274
|
+
onChange: row.getToggleSelectedHandler()
|
|
2275
|
+
}
|
|
2276
|
+
);
|
|
2277
|
+
},
|
|
2278
|
+
size: 60,
|
|
2279
|
+
minSize: 60,
|
|
2280
|
+
maxSize: 60,
|
|
2281
|
+
enableResizing: false,
|
|
2282
|
+
enableSorting: false
|
|
2283
|
+
},
|
|
2284
|
+
...columns
|
|
2285
|
+
];
|
|
2286
|
+
}, [columns, selectionRowId]);
|
|
2287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2288
|
+
Table,
|
|
2289
|
+
{
|
|
2290
|
+
columns: columnsWithSelection,
|
|
2291
|
+
fillerRow: (columnId, table) => {
|
|
2292
|
+
if (columnId === selectionRowId) {
|
|
2293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Checkbox2, { checked: false, disabled: true, className: "max-w-6" });
|
|
2294
|
+
}
|
|
2295
|
+
return fillerRow ? fillerRow(columnId, table) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FillerRowElement, {});
|
|
2296
|
+
},
|
|
2297
|
+
state: {
|
|
2298
|
+
rowSelection,
|
|
2299
|
+
...state
|
|
2300
|
+
},
|
|
2301
|
+
onRowClick: (row, table) => {
|
|
2302
|
+
if (!disableClickRowClickSelection) {
|
|
2303
|
+
row.toggleSelected();
|
|
2304
|
+
}
|
|
2305
|
+
onRowClick(row, table);
|
|
2306
|
+
},
|
|
2307
|
+
meta: {
|
|
2308
|
+
...meta,
|
|
2309
|
+
bodyRowClassName: (0, import_clsx9.default)(
|
|
2310
|
+
{ "cursor-pointer": !disableClickRowClickSelection },
|
|
2311
|
+
meta?.bodyRowClassName
|
|
2312
|
+
)
|
|
2313
|
+
},
|
|
2314
|
+
...props
|
|
2315
|
+
}
|
|
2316
|
+
);
|
|
2317
|
+
};
|
|
2318
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2319
|
+
0 && (module.exports = {
|
|
2320
|
+
FillerRowElement,
|
|
2321
|
+
Table,
|
|
2322
|
+
TableCell,
|
|
2323
|
+
TableFilterButton,
|
|
2324
|
+
TableFilters,
|
|
2325
|
+
TableSortButton,
|
|
2326
|
+
TableUncontrolled,
|
|
2327
|
+
TableWithSelection
|
|
2328
|
+
});
|
|
2329
|
+
//# sourceMappingURL=index.js.map
|