@helpwave/hightide 0.1.37 → 0.1.39
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/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimeDisplay.js.map +1 -1
- package/dist/components/date/TimeDisplay.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/date/index.js.map +1 -1
- package/dist/components/date/index.mjs.map +1 -1
- package/dist/components/dialog/ConfirmDialog.js +15 -9
- package/dist/components/dialog/ConfirmDialog.js.map +1 -1
- package/dist/components/dialog/ConfirmDialog.mjs +16 -10
- package/dist/components/dialog/ConfirmDialog.mjs.map +1 -1
- package/dist/components/dialog/Dialog.d.mts +4 -5
- package/dist/components/dialog/Dialog.d.ts +4 -5
- package/dist/components/dialog/Dialog.js +15 -9
- package/dist/components/dialog/Dialog.js.map +1 -1
- package/dist/components/dialog/Dialog.mjs +16 -10
- package/dist/components/dialog/Dialog.mjs.map +1 -1
- package/dist/components/dialog/DiscardChangesDialog.js +15 -9
- package/dist/components/dialog/DiscardChangesDialog.js.map +1 -1
- package/dist/components/dialog/DiscardChangesDialog.mjs +16 -10
- package/dist/components/dialog/DiscardChangesDialog.mjs.map +1 -1
- package/dist/components/dialog/InputDialog.js +15 -9
- package/dist/components/dialog/InputDialog.js.map +1 -1
- package/dist/components/dialog/InputDialog.mjs +16 -10
- package/dist/components/dialog/InputDialog.mjs.map +1 -1
- package/dist/components/dialog/LanguageDialog.js +188 -154
- package/dist/components/dialog/LanguageDialog.js.map +1 -1
- package/dist/components/dialog/LanguageDialog.mjs +151 -116
- package/dist/components/dialog/LanguageDialog.mjs.map +1 -1
- package/dist/components/dialog/ThemeDialog.js +191 -157
- package/dist/components/dialog/ThemeDialog.js.map +1 -1
- package/dist/components/dialog/ThemeDialog.mjs +151 -116
- package/dist/components/dialog/ThemeDialog.mjs.map +1 -1
- package/dist/components/dialog/index.js +205 -171
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/index.mjs +152 -117
- package/dist/components/dialog/index.mjs.map +1 -1
- package/dist/components/index.js +337 -299
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +198 -159
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/layout/Carousel.d.mts +2 -1
- package/dist/components/layout/Carousel.d.ts +2 -1
- package/dist/components/layout/Carousel.js +4 -0
- package/dist/components/layout/Carousel.js.map +1 -1
- package/dist/components/layout/Carousel.mjs +4 -0
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/TextImage.js.map +1 -1
- package/dist/components/layout/TextImage.mjs.map +1 -1
- package/dist/components/layout/index.js +4 -0
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +4 -0
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/index.js.map +1 -1
- package/dist/components/loading-states/index.mjs.map +1 -1
- package/dist/components/navigation/Pagination.js.map +1 -1
- package/dist/components/navigation/Pagination.mjs.map +1 -1
- package/dist/components/navigation/StepperBar.js.map +1 -1
- package/dist/components/navigation/StepperBar.mjs.map +1 -1
- package/dist/components/navigation/index.js.map +1 -1
- package/dist/components/navigation/index.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.js +129 -101
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +131 -102
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.js +129 -101
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +131 -102
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/properties/index.js +129 -101
- package/dist/components/properties/index.js.map +1 -1
- package/dist/components/properties/index.mjs +131 -102
- package/dist/components/properties/index.mjs.map +1 -1
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.js.map +1 -1
- package/dist/components/user-action/SearchBar.mjs.map +1 -1
- package/dist/components/user-action/index.js +129 -101
- package/dist/components/user-action/index.js.map +1 -1
- package/dist/components/user-action/index.mjs +131 -102
- package/dist/components/user-action/index.mjs.map +1 -1
- package/dist/components/user-action/select/Select.d.mts +2 -0
- package/dist/components/user-action/select/Select.d.ts +2 -0
- package/dist/components/user-action/select/Select.js +129 -101
- package/dist/components/user-action/select/Select.js.map +1 -1
- package/dist/components/user-action/select/Select.mjs +131 -102
- package/dist/components/user-action/select/Select.mjs.map +1 -1
- package/dist/components/user-action/select/index.js +129 -101
- package/dist/components/user-action/select/index.js.map +1 -1
- package/dist/components/user-action/select/index.mjs +131 -102
- package/dist/components/user-action/select/index.mjs.map +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/useValidators.js.map +1 -1
- package/dist/hooks/useValidators.mjs.map +1 -1
- package/dist/index.js +362 -324
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -167
- package/dist/index.mjs.map +1 -1
- package/dist/localization/LanguageProvider.js +1 -1
- package/dist/localization/LanguageProvider.js.map +1 -1
- package/dist/localization/LanguageProvider.mjs +1 -1
- package/dist/localization/LanguageProvider.mjs.map +1 -1
- package/dist/localization/index.js +1 -1
- package/dist/localization/index.js.map +1 -1
- package/dist/localization/index.mjs +1 -1
- package/dist/localization/index.mjs.map +1 -1
- package/dist/localization/useTranslation.js.map +1 -1
- package/dist/localization/useTranslation.mjs.map +1 -1
- package/dist/style/globals.css +0 -3
- package/dist/theming/index.js +1 -1
- package/dist/theming/index.js.map +1 -1
- package/dist/theming/index.mjs +1 -1
- package/dist/theming/index.mjs.map +1 -1
- package/dist/theming/useTheme.js +1 -1
- package/dist/theming/useTheme.js.map +1 -1
- package/dist/theming/useTheme.mjs +1 -1
- package/dist/theming/useTheme.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -36,7 +36,6 @@ module.exports = __toCommonJS(ThemeDialog_exports);
|
|
|
36
36
|
// src/components/dialog/Dialog.tsx
|
|
37
37
|
var import_react7 = require("react");
|
|
38
38
|
var import_react8 = require("react");
|
|
39
|
-
var import_react9 = require("react");
|
|
40
39
|
var import_clsx2 = __toESM(require("clsx"));
|
|
41
40
|
var import_lucide_react = require("lucide-react");
|
|
42
41
|
|
|
@@ -701,15 +700,18 @@ var Dialog = ({
|
|
|
701
700
|
description,
|
|
702
701
|
isModal = true,
|
|
703
702
|
onClose,
|
|
704
|
-
className,
|
|
705
703
|
backgroundClassName,
|
|
706
704
|
position = "center",
|
|
707
|
-
isAnimated = true
|
|
705
|
+
isAnimated = true,
|
|
706
|
+
containerClassName,
|
|
707
|
+
...props
|
|
708
708
|
}) => {
|
|
709
709
|
const translation = useTranslation([formTranslation]);
|
|
710
710
|
const [visible, setVisible] = (0, import_react8.useState)(isOpen);
|
|
711
|
-
const
|
|
712
|
-
|
|
711
|
+
const generatedId = (0, import_react7.useId)();
|
|
712
|
+
const id = props.id ?? generatedId;
|
|
713
|
+
const ref = (0, import_react8.useRef)(null);
|
|
714
|
+
(0, import_react8.useEffect)(() => {
|
|
713
715
|
if (isOpen) {
|
|
714
716
|
setVisible(true);
|
|
715
717
|
} else {
|
|
@@ -734,14 +736,16 @@ var Dialog = ({
|
|
|
734
736
|
none: ""
|
|
735
737
|
};
|
|
736
738
|
const positionStyle = positionMap[position];
|
|
739
|
+
if (!visible) return;
|
|
737
740
|
return (0, import_react_dom.createPortal)(
|
|
738
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { id: `dialog-container-${id}`, className: (0, import_clsx2.default)("fixed inset-0 h-screen w-screen", containerClassName), children: [
|
|
739
742
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
740
743
|
"div",
|
|
741
744
|
{
|
|
745
|
+
id: `dialog-background-${id}`,
|
|
742
746
|
hidden: !visible,
|
|
743
747
|
className: (0, import_clsx2.default)(
|
|
744
|
-
"fixed inset-0 h-screen w-screen bg-overlay-shadow
|
|
748
|
+
"fixed inset-0 h-screen w-screen bg-overlay-shadow",
|
|
745
749
|
{
|
|
746
750
|
"motion-safe:animate-fade-in": isOpen,
|
|
747
751
|
"motion-safe:animate-fade-out": !isOpen
|
|
@@ -760,6 +764,8 @@ var Dialog = ({
|
|
|
760
764
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
761
765
|
"div",
|
|
762
766
|
{
|
|
767
|
+
...props,
|
|
768
|
+
id: `dialog-${id}`,
|
|
763
769
|
ref,
|
|
764
770
|
hidden: !visible,
|
|
765
771
|
onKeyDown: (event) => {
|
|
@@ -773,13 +779,13 @@ var Dialog = ({
|
|
|
773
779
|
}
|
|
774
780
|
},
|
|
775
781
|
className: (0, import_clsx2.default)(
|
|
776
|
-
"flex-col-2 p-4 bg-overlay-background text-overlay-text rounded-xl shadow-hw-bottom max-w-[calc(100vw_-_2rem)] max-h-[calc(100vh_-_2rem)]
|
|
782
|
+
"flex-col-2 p-4 bg-overlay-background text-overlay-text rounded-xl shadow-hw-bottom max-w-[calc(100vw_-_2rem)] max-h-[calc(100vh_-_2rem)]",
|
|
777
783
|
{
|
|
778
784
|
"motion-safe:animate-pop-in": isOpen,
|
|
779
785
|
"motion-safe:animate-pop-out": !isOpen
|
|
780
786
|
},
|
|
781
787
|
positionStyle,
|
|
782
|
-
className
|
|
788
|
+
props.className
|
|
783
789
|
),
|
|
784
790
|
children: [
|
|
785
791
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "typography-title-lg mr-8", children: titleElement }),
|
|
@@ -818,7 +824,7 @@ var import_lucide_react4 = require("lucide-react");
|
|
|
818
824
|
var import_clsx6 = __toESM(require("clsx"));
|
|
819
825
|
|
|
820
826
|
// src/theming/useTheme.tsx
|
|
821
|
-
var
|
|
827
|
+
var import_react9 = require("react");
|
|
822
828
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
823
829
|
var themes = ["light", "dark", "system"];
|
|
824
830
|
var defaultThemeTypeTranslation = {
|
|
@@ -845,9 +851,9 @@ var ThemeUtil = {
|
|
|
845
851
|
themes,
|
|
846
852
|
translation: defaultThemeTypeTranslation
|
|
847
853
|
};
|
|
848
|
-
var ThemeContext = (0,
|
|
854
|
+
var ThemeContext = (0, import_react9.createContext)(null);
|
|
849
855
|
var useTheme = () => {
|
|
850
|
-
const context = (0,
|
|
856
|
+
const context = (0, import_react9.useContext)(ThemeContext);
|
|
851
857
|
if (!context) {
|
|
852
858
|
throw new Error("useTheme must be used within ThemeContext. Try adding a ThemeProvider around your app.");
|
|
853
859
|
}
|
|
@@ -855,19 +861,19 @@ var useTheme = () => {
|
|
|
855
861
|
};
|
|
856
862
|
|
|
857
863
|
// src/components/user-action/select/Select.tsx
|
|
858
|
-
var
|
|
864
|
+
var import_react13 = require("react");
|
|
859
865
|
var import_clsx5 = __toESM(require("clsx"));
|
|
860
866
|
|
|
861
867
|
// src/components/layout/Expandable.tsx
|
|
862
|
-
var
|
|
868
|
+
var import_react11 = require("react");
|
|
863
869
|
var import_lucide_react2 = require("lucide-react");
|
|
864
870
|
var import_clsx3 = __toESM(require("clsx"));
|
|
865
871
|
|
|
866
872
|
// src/hooks/useOverwritableState.ts
|
|
867
|
-
var
|
|
873
|
+
var import_react10 = require("react");
|
|
868
874
|
var useOverwritableState = (initialValue, onChange) => {
|
|
869
|
-
const [state, setState] = (0,
|
|
870
|
-
(0,
|
|
875
|
+
const [state, setState] = (0, import_react10.useState)(initialValue);
|
|
876
|
+
(0, import_react10.useEffect)(() => {
|
|
871
877
|
setState(initialValue);
|
|
872
878
|
}, [initialValue]);
|
|
873
879
|
const onChangeWrapper = (action) => {
|
|
@@ -893,7 +899,7 @@ var ExpansionIcon = ({ isExpanded, className }) => {
|
|
|
893
899
|
}
|
|
894
900
|
);
|
|
895
901
|
};
|
|
896
|
-
var Expandable = (0,
|
|
902
|
+
var Expandable = (0, import_react11.forwardRef)(function Expandable2({
|
|
897
903
|
children,
|
|
898
904
|
id: providedId,
|
|
899
905
|
label,
|
|
@@ -907,9 +913,9 @@ var Expandable = (0, import_react12.forwardRef)(function Expandable2({
|
|
|
907
913
|
contentClassName,
|
|
908
914
|
contentExpandedClassName
|
|
909
915
|
}, ref) {
|
|
910
|
-
const defaultIcon = (0,
|
|
916
|
+
const defaultIcon = (0, import_react11.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
|
|
911
917
|
icon ??= defaultIcon;
|
|
912
|
-
const generatedId = (0,
|
|
918
|
+
const generatedId = (0, import_react11.useId)();
|
|
913
919
|
const id = providedId ?? generatedId;
|
|
914
920
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
915
921
|
"div",
|
|
@@ -964,7 +970,7 @@ var Expandable = (0, import_react12.forwardRef)(function Expandable2({
|
|
|
964
970
|
}
|
|
965
971
|
);
|
|
966
972
|
});
|
|
967
|
-
var ExpandableUncontrolled = (0,
|
|
973
|
+
var ExpandableUncontrolled = (0, import_react11.forwardRef)(function ExpandableUncontrolled2({
|
|
968
974
|
isExpanded,
|
|
969
975
|
onChange,
|
|
970
976
|
...props
|
|
@@ -1053,7 +1059,7 @@ var Chip = ({
|
|
|
1053
1059
|
};
|
|
1054
1060
|
|
|
1055
1061
|
// src/hooks/useFloatingElement.ts
|
|
1056
|
-
var
|
|
1062
|
+
var import_react12 = require("react");
|
|
1057
1063
|
|
|
1058
1064
|
// src/utils/math.ts
|
|
1059
1065
|
var clamp = (value, range = [0, 1]) => {
|
|
@@ -1116,9 +1122,9 @@ function useFloatingElement({
|
|
|
1116
1122
|
screenPadding = 16,
|
|
1117
1123
|
gap = 4
|
|
1118
1124
|
}) {
|
|
1119
|
-
const [style, setStyle] = (0,
|
|
1125
|
+
const [style, setStyle] = (0, import_react12.useState)();
|
|
1120
1126
|
const isMounted = useIsMounted();
|
|
1121
|
-
const calculate = (0,
|
|
1127
|
+
const calculate = (0, import_react12.useCallback)(() => {
|
|
1122
1128
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
1123
1129
|
const windowRect = windowRef?.current.getBoundingClientRect() ?? {
|
|
1124
1130
|
top: 0,
|
|
@@ -1148,14 +1154,14 @@ function useFloatingElement({
|
|
|
1148
1154
|
}, [anchorRef, containerRef, gap, horizontalAlignment, screenPadding, verticalAlignment, windowRef]);
|
|
1149
1155
|
const height = containerRef.current?.getBoundingClientRect().height;
|
|
1150
1156
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
1151
|
-
(0,
|
|
1157
|
+
(0, import_react12.useEffect)(() => {
|
|
1152
1158
|
if (active && isMounted) {
|
|
1153
1159
|
calculate();
|
|
1154
1160
|
} else {
|
|
1155
1161
|
setStyle(void 0);
|
|
1156
1162
|
}
|
|
1157
1163
|
}, [calculate, active, isMounted, height, width]);
|
|
1158
|
-
(0,
|
|
1164
|
+
(0, import_react12.useEffect)(() => {
|
|
1159
1165
|
window.addEventListener("resize", calculate);
|
|
1160
1166
|
let timeout;
|
|
1161
1167
|
if (isPolling) {
|
|
@@ -1175,11 +1181,11 @@ function useFloatingElement({
|
|
|
1175
1181
|
var import_react_dom2 = require("react-dom");
|
|
1176
1182
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1177
1183
|
var defaultToggleOpenOptions = {
|
|
1178
|
-
|
|
1184
|
+
highlightStartPositionBehavior: "first"
|
|
1179
1185
|
};
|
|
1180
|
-
var SelectContext = (0,
|
|
1186
|
+
var SelectContext = (0, import_react13.createContext)(null);
|
|
1181
1187
|
function useSelectContext() {
|
|
1182
|
-
const ctx = (0,
|
|
1188
|
+
const ctx = (0, import_react13.useContext)(SelectContext);
|
|
1183
1189
|
if (!ctx) {
|
|
1184
1190
|
throw new Error("SelectContext must be used within a ListBoxPrimitive");
|
|
1185
1191
|
}
|
|
@@ -1198,47 +1204,62 @@ var SelectRoot = ({
|
|
|
1198
1204
|
isMultiSelect = false,
|
|
1199
1205
|
iconAppearance = "left"
|
|
1200
1206
|
}) => {
|
|
1201
|
-
const
|
|
1202
|
-
const
|
|
1203
|
-
const generatedId = (0, import_react14.useId)();
|
|
1207
|
+
const triggerRef = (0, import_react13.useRef)(null);
|
|
1208
|
+
const generatedId = (0, import_react13.useId)();
|
|
1204
1209
|
const usedId = id ?? generatedId;
|
|
1205
|
-
const [internalState, setInternalState] = (0,
|
|
1206
|
-
isOpen
|
|
1210
|
+
const [internalState, setInternalState] = (0, import_react13.useState)({
|
|
1211
|
+
isOpen,
|
|
1212
|
+
options: []
|
|
1207
1213
|
});
|
|
1208
|
-
const selectedValues =
|
|
1214
|
+
const selectedValues = (0, import_react13.useMemo)(
|
|
1215
|
+
() => isMultiSelect ? values ?? [] : [value].filter(Boolean),
|
|
1216
|
+
[isMultiSelect, value, values]
|
|
1217
|
+
);
|
|
1218
|
+
const selectedOptions = (0, import_react13.useMemo)(
|
|
1219
|
+
() => selectedValues.map((value2) => internalState.options.find((option) => value2 === option.value)).filter(Boolean),
|
|
1220
|
+
[selectedValues, internalState.options]
|
|
1221
|
+
);
|
|
1209
1222
|
const state = {
|
|
1210
1223
|
...internalState,
|
|
1211
1224
|
id: usedId,
|
|
1212
1225
|
disabled,
|
|
1213
1226
|
invalid,
|
|
1214
1227
|
value: selectedValues,
|
|
1215
|
-
|
|
1216
|
-
selectedOptions: selectedValues.map((value2) => options.find((option) => value2 === option.value)).filter(Boolean)
|
|
1228
|
+
selectedOptions
|
|
1217
1229
|
};
|
|
1218
1230
|
const config = {
|
|
1219
1231
|
isMultiSelect,
|
|
1220
1232
|
iconAppearance
|
|
1221
1233
|
};
|
|
1222
|
-
const registerItem = (0,
|
|
1223
|
-
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1234
|
+
const registerItem = (0, import_react13.useCallback)((item) => {
|
|
1235
|
+
setInternalState((prev) => {
|
|
1236
|
+
const updatedOptions = [...prev.options, item];
|
|
1237
|
+
updatedOptions.sort((a, b) => {
|
|
1226
1238
|
const aEl = a.ref.current;
|
|
1227
1239
|
const bEl = b.ref.current;
|
|
1228
1240
|
if (!aEl || !bEl) return 0;
|
|
1229
1241
|
return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
1230
1242
|
});
|
|
1231
|
-
return
|
|
1243
|
+
return {
|
|
1244
|
+
...prev,
|
|
1245
|
+
options: updatedOptions
|
|
1246
|
+
};
|
|
1232
1247
|
});
|
|
1233
1248
|
}, []);
|
|
1234
|
-
const unregisterItem = (0,
|
|
1235
|
-
|
|
1249
|
+
const unregisterItem = (0, import_react13.useCallback)((value2) => {
|
|
1250
|
+
setInternalState((prev) => {
|
|
1251
|
+
const updatedOptions = prev.options.filter((i) => i.value !== value2);
|
|
1252
|
+
return {
|
|
1253
|
+
...prev,
|
|
1254
|
+
options: updatedOptions
|
|
1255
|
+
};
|
|
1256
|
+
});
|
|
1236
1257
|
}, []);
|
|
1237
1258
|
const toggleSelection = (value2, isSelected) => {
|
|
1238
1259
|
if (disabled) {
|
|
1239
1260
|
return;
|
|
1240
1261
|
}
|
|
1241
|
-
const option = options.find((i) => i.value === value2);
|
|
1262
|
+
const option = state.options.find((i) => i.value === value2);
|
|
1242
1263
|
if (!option) {
|
|
1243
1264
|
console.error(`SelectOption with value: ${value2} not found`);
|
|
1244
1265
|
return;
|
|
@@ -1274,42 +1295,47 @@ var SelectRoot = ({
|
|
|
1274
1295
|
highlightedValue: value2
|
|
1275
1296
|
}));
|
|
1276
1297
|
};
|
|
1277
|
-
const registerTrigger = (0,
|
|
1298
|
+
const registerTrigger = (0, import_react13.useCallback)((ref) => {
|
|
1278
1299
|
triggerRef.current = ref.current;
|
|
1279
1300
|
}, []);
|
|
1280
|
-
const unregisterTrigger = (0,
|
|
1301
|
+
const unregisterTrigger = (0, import_react13.useCallback)(() => {
|
|
1281
1302
|
triggerRef.current = null;
|
|
1282
1303
|
}, []);
|
|
1283
1304
|
const toggleOpen = (isOpen2, toggleOpenOptions) => {
|
|
1284
|
-
const {
|
|
1285
|
-
let
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1305
|
+
const { highlightStartPositionBehavior } = { ...defaultToggleOpenOptions, ...toggleOpenOptions };
|
|
1306
|
+
let firstSelectedValue;
|
|
1307
|
+
let firstEnabledValue;
|
|
1308
|
+
for (let i = 0; i < state.options.length; i++) {
|
|
1309
|
+
const currentOption = state.options[highlightStartPositionBehavior === "first" ? i : state.options.length - i - 1];
|
|
1310
|
+
if (!currentOption.disabled) {
|
|
1311
|
+
if (!firstEnabledValue) {
|
|
1312
|
+
firstEnabledValue = currentOption.value;
|
|
1313
|
+
}
|
|
1314
|
+
if (selectedValues.includes(currentOption.value)) {
|
|
1315
|
+
firstSelectedValue = currentOption.value;
|
|
1316
|
+
break;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1293
1319
|
}
|
|
1294
1320
|
setInternalState((prevState) => ({
|
|
1295
1321
|
...prevState,
|
|
1296
1322
|
isOpen: isOpen2 ?? !prevState.isOpen,
|
|
1297
|
-
highlightedValue:
|
|
1323
|
+
highlightedValue: firstSelectedValue ?? firstEnabledValue
|
|
1298
1324
|
}));
|
|
1299
1325
|
};
|
|
1300
1326
|
const moveHighlightedIndex = (delta) => {
|
|
1301
|
-
let highlightedIndex = options.findIndex((value2) => value2.value === internalState.highlightedValue);
|
|
1327
|
+
let highlightedIndex = state.options.findIndex((value2) => value2.value === internalState.highlightedValue);
|
|
1302
1328
|
if (highlightedIndex === -1) {
|
|
1303
1329
|
highlightedIndex = 0;
|
|
1304
1330
|
}
|
|
1305
|
-
const optionLength = options.length;
|
|
1331
|
+
const optionLength = state.options.length;
|
|
1306
1332
|
const startIndex = (highlightedIndex + delta % optionLength + optionLength) % optionLength;
|
|
1307
1333
|
const isForward = delta >= 0;
|
|
1308
|
-
let highlightedValue = options[startIndex].value;
|
|
1309
|
-
for (let i = 0; i < options.length; i++) {
|
|
1334
|
+
let highlightedValue = state.options[startIndex].value;
|
|
1335
|
+
for (let i = 0; i < state.options.length; i++) {
|
|
1310
1336
|
const index = (startIndex + (isForward ? i : -i) + optionLength) % optionLength;
|
|
1311
|
-
if (!options[index].disabled) {
|
|
1312
|
-
highlightedValue = options[index].value;
|
|
1337
|
+
if (!state.options[index].disabled) {
|
|
1338
|
+
highlightedValue = state.options[index].value;
|
|
1313
1339
|
break;
|
|
1314
1340
|
}
|
|
1315
1341
|
}
|
|
@@ -1318,11 +1344,11 @@ var SelectRoot = ({
|
|
|
1318
1344
|
highlightedValue
|
|
1319
1345
|
}));
|
|
1320
1346
|
};
|
|
1321
|
-
(0,
|
|
1347
|
+
(0, import_react13.useEffect)(() => {
|
|
1322
1348
|
if (!internalState.highlightedValue) return;
|
|
1323
|
-
const highlighted = options.find((value2) => value2.value === internalState.highlightedValue);
|
|
1349
|
+
const highlighted = internalState.options.find((value2) => value2.value === internalState.highlightedValue);
|
|
1324
1350
|
if (highlighted) {
|
|
1325
|
-
highlighted.ref.current
|
|
1351
|
+
highlighted.ref.current?.scrollIntoView({ behavior: "instant", block: "nearest" });
|
|
1326
1352
|
} else {
|
|
1327
1353
|
console.error(`SelectRoot: Could not find highlighted value (${internalState.highlightedValue})`);
|
|
1328
1354
|
}
|
|
@@ -1346,14 +1372,14 @@ var SelectRoot = ({
|
|
|
1346
1372
|
};
|
|
1347
1373
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectContext.Provider, { value: contextValue, children });
|
|
1348
1374
|
};
|
|
1349
|
-
var SelectOption = (0,
|
|
1375
|
+
var SelectOption = (0, import_react13.forwardRef)(
|
|
1350
1376
|
function SelectOption2({ children, value, disabled = false, iconAppearance, className, ...restProps }, ref) {
|
|
1351
1377
|
const { state, config, item, trigger } = useSelectContext();
|
|
1352
1378
|
const { register, unregister, toggleSelection, highlightItem } = item;
|
|
1353
|
-
const itemRef = (0,
|
|
1379
|
+
const itemRef = (0, import_react13.useRef)(null);
|
|
1354
1380
|
iconAppearance ??= config.iconAppearance;
|
|
1355
1381
|
const label = children ?? value;
|
|
1356
|
-
(0,
|
|
1382
|
+
(0, import_react13.useEffect)(() => {
|
|
1357
1383
|
register({
|
|
1358
1384
|
value,
|
|
1359
1385
|
label,
|
|
@@ -1431,13 +1457,13 @@ var defaultSelectButtonTranslation = {
|
|
|
1431
1457
|
clickToSelect: "Zum ausw\xE4hlen dr\xFCcken"
|
|
1432
1458
|
}
|
|
1433
1459
|
};
|
|
1434
|
-
var SelectButton = (0,
|
|
1460
|
+
var SelectButton = (0, import_react13.forwardRef)(function SelectButton2({ placeholder, selectedDisplay, ...props }, ref) {
|
|
1435
1461
|
const translation = useTranslation([defaultSelectButtonTranslation]);
|
|
1436
1462
|
const { state, trigger } = useSelectContext();
|
|
1437
1463
|
const { register, unregister, toggleOpen } = trigger;
|
|
1438
|
-
const innerRef = (0,
|
|
1439
|
-
(0,
|
|
1440
|
-
(0,
|
|
1464
|
+
const innerRef = (0, import_react13.useRef)(null);
|
|
1465
|
+
(0, import_react13.useImperativeHandle)(ref, () => innerRef.current);
|
|
1466
|
+
(0, import_react13.useEffect)(() => {
|
|
1441
1467
|
register(innerRef);
|
|
1442
1468
|
return () => unregister();
|
|
1443
1469
|
}, [register, unregister]);
|
|
@@ -1459,12 +1485,12 @@ var SelectButton = (0, import_react14.forwardRef)(function SelectButton2({ place
|
|
|
1459
1485
|
props.onKeyDown?.(event);
|
|
1460
1486
|
switch (event.key) {
|
|
1461
1487
|
case "ArrowDown":
|
|
1462
|
-
toggleOpen(true, {
|
|
1488
|
+
toggleOpen(true, { highlightStartPositionBehavior: "first" });
|
|
1463
1489
|
event.preventDefault();
|
|
1464
1490
|
event.stopPropagation();
|
|
1465
1491
|
break;
|
|
1466
1492
|
case "ArrowUp":
|
|
1467
|
-
toggleOpen(true, {
|
|
1493
|
+
toggleOpen(true, { highlightStartPositionBehavior: "last" });
|
|
1468
1494
|
event.preventDefault();
|
|
1469
1495
|
event.stopPropagation();
|
|
1470
1496
|
break;
|
|
@@ -1510,12 +1536,12 @@ var SelectButton = (0, import_react14.forwardRef)(function SelectButton2({ place
|
|
|
1510
1536
|
}
|
|
1511
1537
|
);
|
|
1512
1538
|
});
|
|
1513
|
-
var SelectChipDisplay = (0,
|
|
1539
|
+
var SelectChipDisplay = (0, import_react13.forwardRef)(function SelectChipDisplay2({ ...props }, ref) {
|
|
1514
1540
|
const { state, trigger, item } = useSelectContext();
|
|
1515
1541
|
const { register, unregister, toggleOpen } = trigger;
|
|
1516
|
-
const innerRef = (0,
|
|
1517
|
-
(0,
|
|
1518
|
-
(0,
|
|
1542
|
+
const innerRef = (0, import_react13.useRef)(null);
|
|
1543
|
+
(0, import_react13.useImperativeHandle)(ref, () => innerRef.current);
|
|
1544
|
+
(0, import_react13.useEffect)(() => {
|
|
1519
1545
|
register(innerRef);
|
|
1520
1546
|
return () => unregister();
|
|
1521
1547
|
}, [register, unregister]);
|
|
@@ -1558,10 +1584,10 @@ var SelectChipDisplay = (0, import_react14.forwardRef)(function SelectChipDispla
|
|
|
1558
1584
|
onKeyDown: (event) => {
|
|
1559
1585
|
switch (event.key) {
|
|
1560
1586
|
case "ArrowDown":
|
|
1561
|
-
toggleOpen(true, {
|
|
1587
|
+
toggleOpen(true, { highlightStartPositionBehavior: "first" });
|
|
1562
1588
|
break;
|
|
1563
1589
|
case "ArrowUp":
|
|
1564
|
-
toggleOpen(true, {
|
|
1590
|
+
toggleOpen(true, { highlightStartPositionBehavior: "last" });
|
|
1565
1591
|
}
|
|
1566
1592
|
},
|
|
1567
1593
|
size: "small",
|
|
@@ -1578,14 +1604,15 @@ var SelectChipDisplay = (0, import_react14.forwardRef)(function SelectChipDispla
|
|
|
1578
1604
|
}
|
|
1579
1605
|
);
|
|
1580
1606
|
});
|
|
1581
|
-
var SelectContent = (0,
|
|
1607
|
+
var SelectContent = (0, import_react13.forwardRef)(
|
|
1582
1608
|
function SelectContent2({
|
|
1583
1609
|
alignment,
|
|
1584
1610
|
orientation = "vertical",
|
|
1611
|
+
containerClassName,
|
|
1585
1612
|
...props
|
|
1586
1613
|
}, ref) {
|
|
1587
|
-
const innerRef = (0,
|
|
1588
|
-
(0,
|
|
1614
|
+
const innerRef = (0, import_react13.useRef)(null);
|
|
1615
|
+
(0, import_react13.useImperativeHandle)(ref, () => innerRef.current);
|
|
1589
1616
|
const { trigger, state, config, item } = useSelectContext();
|
|
1590
1617
|
const position = useFloatingElement({
|
|
1591
1618
|
active: state.isOpen,
|
|
@@ -1598,81 +1625,88 @@ var SelectContent = (0, import_react14.forwardRef)(
|
|
|
1598
1625
|
active: state.isOpen && !!position
|
|
1599
1626
|
});
|
|
1600
1627
|
return (0, import_react_dom2.createPortal)(
|
|
1601
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
{
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
vertical: "ArrowDown",
|
|
1626
|
-
horizontal: "ArrowUp"
|
|
1627
|
-
}):
|
|
1628
|
-
item.moveHighlightedIndex(1);
|
|
1629
|
-
event.preventDefault();
|
|
1630
|
-
break;
|
|
1631
|
-
case match(orientation, {
|
|
1632
|
-
vertical: "ArrowUp",
|
|
1633
|
-
horizontal: "ArrowDown"
|
|
1634
|
-
}):
|
|
1635
|
-
item.moveHighlightedIndex(-1);
|
|
1636
|
-
event.preventDefault();
|
|
1637
|
-
break;
|
|
1638
|
-
case "Home":
|
|
1639
|
-
event.preventDefault();
|
|
1640
|
-
break;
|
|
1641
|
-
case "End":
|
|
1642
|
-
event.preventDefault();
|
|
1643
|
-
break;
|
|
1644
|
-
case "Enter":
|
|
1645
|
-
// Fall through
|
|
1646
|
-
case " ":
|
|
1647
|
-
if (state.highlightedValue) {
|
|
1648
|
-
item.toggleSelection(state.highlightedValue);
|
|
1649
|
-
if (!config.isMultiSelect) {
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1629
|
+
"div",
|
|
1630
|
+
{
|
|
1631
|
+
id: `select-container-${state.id}`,
|
|
1632
|
+
className: (0, import_clsx5.default)("fixed inset-0 w-screen h-screen", containerClassName),
|
|
1633
|
+
hidden: !state.isOpen,
|
|
1634
|
+
children: [
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1636
|
+
"div",
|
|
1637
|
+
{
|
|
1638
|
+
id: `select-background-${state.id}`,
|
|
1639
|
+
onClick: () => trigger.toggleOpen(false),
|
|
1640
|
+
className: (0, import_clsx5.default)("fixed inset-0 w-screen h-screen")
|
|
1641
|
+
}
|
|
1642
|
+
),
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1644
|
+
"ul",
|
|
1645
|
+
{
|
|
1646
|
+
...props,
|
|
1647
|
+
id: `${state.id}-listbox`,
|
|
1648
|
+
ref: innerRef,
|
|
1649
|
+
onKeyDown: (event) => {
|
|
1650
|
+
switch (event.key) {
|
|
1651
|
+
case "Escape":
|
|
1650
1652
|
trigger.toggleOpen(false);
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
+
event.preventDefault();
|
|
1654
|
+
event.stopPropagation();
|
|
1655
|
+
break;
|
|
1656
|
+
case match(orientation, {
|
|
1657
|
+
vertical: "ArrowDown",
|
|
1658
|
+
horizontal: "ArrowUp"
|
|
1659
|
+
}):
|
|
1660
|
+
item.moveHighlightedIndex(1);
|
|
1661
|
+
event.preventDefault();
|
|
1662
|
+
break;
|
|
1663
|
+
case match(orientation, {
|
|
1664
|
+
vertical: "ArrowUp",
|
|
1665
|
+
horizontal: "ArrowDown"
|
|
1666
|
+
}):
|
|
1667
|
+
item.moveHighlightedIndex(-1);
|
|
1668
|
+
event.preventDefault();
|
|
1669
|
+
break;
|
|
1670
|
+
case "Home":
|
|
1671
|
+
event.preventDefault();
|
|
1672
|
+
break;
|
|
1673
|
+
case "End":
|
|
1674
|
+
event.preventDefault();
|
|
1675
|
+
break;
|
|
1676
|
+
case "Enter":
|
|
1677
|
+
// Fall through
|
|
1678
|
+
case " ":
|
|
1679
|
+
if (state.highlightedValue) {
|
|
1680
|
+
item.toggleSelection(state.highlightedValue);
|
|
1681
|
+
if (!config.isMultiSelect) {
|
|
1682
|
+
trigger.toggleOpen(false);
|
|
1683
|
+
}
|
|
1684
|
+
event.preventDefault();
|
|
1685
|
+
}
|
|
1686
|
+
break;
|
|
1653
1687
|
}
|
|
1654
|
-
|
|
1688
|
+
},
|
|
1689
|
+
className: (0, import_clsx5.default)("flex-col-0 p-2 bg-menu-background text-menu-text rounded-md shadow-hw-bottom focus-style-within overflow-auto", props.className),
|
|
1690
|
+
style: {
|
|
1691
|
+
opacity: position ? void 0 : 0,
|
|
1692
|
+
position: "fixed",
|
|
1693
|
+
...position
|
|
1694
|
+
},
|
|
1695
|
+
role: "listbox",
|
|
1696
|
+
"aria-multiselectable": config.isMultiSelect,
|
|
1697
|
+
"aria-orientation": orientation,
|
|
1698
|
+
tabIndex: position ? 0 : void 0,
|
|
1699
|
+
children: props.children
|
|
1655
1700
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
position: "fixed",
|
|
1661
|
-
...position
|
|
1662
|
-
},
|
|
1663
|
-
role: "listbox",
|
|
1664
|
-
"aria-multiselectable": config.isMultiSelect,
|
|
1665
|
-
"aria-orientation": orientation,
|
|
1666
|
-
tabIndex: position ? 0 : void 0,
|
|
1667
|
-
children: props.children
|
|
1668
|
-
}
|
|
1669
|
-
)
|
|
1670
|
-
] }),
|
|
1701
|
+
)
|
|
1702
|
+
]
|
|
1703
|
+
}
|
|
1704
|
+
),
|
|
1671
1705
|
document.body
|
|
1672
1706
|
);
|
|
1673
1707
|
}
|
|
1674
1708
|
);
|
|
1675
|
-
var Select = (0,
|
|
1709
|
+
var Select = (0, import_react13.forwardRef)(function Select2({
|
|
1676
1710
|
children,
|
|
1677
1711
|
contentPanelProps,
|
|
1678
1712
|
buttonProps,
|
|
@@ -1694,7 +1728,7 @@ var Select = (0, import_react14.forwardRef)(function Select2({
|
|
|
1694
1728
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
1695
1729
|
] });
|
|
1696
1730
|
});
|
|
1697
|
-
var SelectUncontrolled = (0,
|
|
1731
|
+
var SelectUncontrolled = (0, import_react13.forwardRef)(function SelectUncontrolled2({
|
|
1698
1732
|
value: initialValue,
|
|
1699
1733
|
onValueChanged,
|
|
1700
1734
|
...props
|
|
@@ -1710,7 +1744,7 @@ var SelectUncontrolled = (0, import_react14.forwardRef)(function SelectUncontrol
|
|
|
1710
1744
|
}
|
|
1711
1745
|
);
|
|
1712
1746
|
});
|
|
1713
|
-
var MultiSelect = (0,
|
|
1747
|
+
var MultiSelect = (0, import_react13.forwardRef)(function MultiSelect2({
|
|
1714
1748
|
children,
|
|
1715
1749
|
contentPanelProps,
|
|
1716
1750
|
buttonProps,
|
|
@@ -1721,7 +1755,7 @@ var MultiSelect = (0, import_react14.forwardRef)(function MultiSelect2({
|
|
|
1721
1755
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
1722
1756
|
] });
|
|
1723
1757
|
});
|
|
1724
|
-
var MultiSelectUncontrolled = (0,
|
|
1758
|
+
var MultiSelectUncontrolled = (0, import_react13.forwardRef)(function MultiSelectUncontrolled2({
|
|
1725
1759
|
values: initialValues,
|
|
1726
1760
|
onValuesChanged,
|
|
1727
1761
|
...props
|
|
@@ -1737,7 +1771,7 @@ var MultiSelectUncontrolled = (0, import_react14.forwardRef)(function MultiSelec
|
|
|
1737
1771
|
}
|
|
1738
1772
|
);
|
|
1739
1773
|
});
|
|
1740
|
-
var MultiSelectChipDisplay = (0,
|
|
1774
|
+
var MultiSelectChipDisplay = (0, import_react13.forwardRef)(function MultiSelectChipDisplay2({
|
|
1741
1775
|
children,
|
|
1742
1776
|
contentPanelProps,
|
|
1743
1777
|
chipDisplayProps,
|
|
@@ -1748,7 +1782,7 @@ var MultiSelectChipDisplay = (0, import_react14.forwardRef)(function MultiSelect
|
|
|
1748
1782
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
1749
1783
|
] });
|
|
1750
1784
|
});
|
|
1751
|
-
var MultiSelectChipDisplayUncontrolled = (0,
|
|
1785
|
+
var MultiSelectChipDisplayUncontrolled = (0, import_react13.forwardRef)(function MultiSelectChipDisplayUncontrolled2({
|
|
1752
1786
|
values: initialValues,
|
|
1753
1787
|
onValuesChanged,
|
|
1754
1788
|
...props
|