@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(LanguageDialog_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 }),
|
|
@@ -814,19 +820,19 @@ var Dialog = ({
|
|
|
814
820
|
};
|
|
815
821
|
|
|
816
822
|
// src/components/user-action/select/Select.tsx
|
|
817
|
-
var
|
|
823
|
+
var import_react12 = require("react");
|
|
818
824
|
var import_clsx5 = __toESM(require("clsx"));
|
|
819
825
|
|
|
820
826
|
// src/components/layout/Expandable.tsx
|
|
821
|
-
var
|
|
827
|
+
var import_react10 = require("react");
|
|
822
828
|
var import_lucide_react2 = require("lucide-react");
|
|
823
829
|
var import_clsx3 = __toESM(require("clsx"));
|
|
824
830
|
|
|
825
831
|
// src/hooks/useOverwritableState.ts
|
|
826
|
-
var
|
|
832
|
+
var import_react9 = require("react");
|
|
827
833
|
var useOverwritableState = (initialValue, onChange) => {
|
|
828
|
-
const [state, setState] = (0,
|
|
829
|
-
(0,
|
|
834
|
+
const [state, setState] = (0, import_react9.useState)(initialValue);
|
|
835
|
+
(0, import_react9.useEffect)(() => {
|
|
830
836
|
setState(initialValue);
|
|
831
837
|
}, [initialValue]);
|
|
832
838
|
const onChangeWrapper = (action) => {
|
|
@@ -852,7 +858,7 @@ var ExpansionIcon = ({ isExpanded, className }) => {
|
|
|
852
858
|
}
|
|
853
859
|
);
|
|
854
860
|
};
|
|
855
|
-
var Expandable = (0,
|
|
861
|
+
var Expandable = (0, import_react10.forwardRef)(function Expandable2({
|
|
856
862
|
children,
|
|
857
863
|
id: providedId,
|
|
858
864
|
label,
|
|
@@ -866,9 +872,9 @@ var Expandable = (0, import_react11.forwardRef)(function Expandable2({
|
|
|
866
872
|
contentClassName,
|
|
867
873
|
contentExpandedClassName
|
|
868
874
|
}, ref) {
|
|
869
|
-
const defaultIcon = (0,
|
|
875
|
+
const defaultIcon = (0, import_react10.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
|
|
870
876
|
icon ??= defaultIcon;
|
|
871
|
-
const generatedId = (0,
|
|
877
|
+
const generatedId = (0, import_react10.useId)();
|
|
872
878
|
const id = providedId ?? generatedId;
|
|
873
879
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
874
880
|
"div",
|
|
@@ -923,7 +929,7 @@ var Expandable = (0, import_react11.forwardRef)(function Expandable2({
|
|
|
923
929
|
}
|
|
924
930
|
);
|
|
925
931
|
});
|
|
926
|
-
var ExpandableUncontrolled = (0,
|
|
932
|
+
var ExpandableUncontrolled = (0, import_react10.forwardRef)(function ExpandableUncontrolled2({
|
|
927
933
|
isExpanded,
|
|
928
934
|
onChange,
|
|
929
935
|
...props
|
|
@@ -1012,7 +1018,7 @@ var Chip = ({
|
|
|
1012
1018
|
};
|
|
1013
1019
|
|
|
1014
1020
|
// src/hooks/useFloatingElement.ts
|
|
1015
|
-
var
|
|
1021
|
+
var import_react11 = require("react");
|
|
1016
1022
|
|
|
1017
1023
|
// src/utils/math.ts
|
|
1018
1024
|
var clamp = (value, range = [0, 1]) => {
|
|
@@ -1075,9 +1081,9 @@ function useFloatingElement({
|
|
|
1075
1081
|
screenPadding = 16,
|
|
1076
1082
|
gap = 4
|
|
1077
1083
|
}) {
|
|
1078
|
-
const [style, setStyle] = (0,
|
|
1084
|
+
const [style, setStyle] = (0, import_react11.useState)();
|
|
1079
1085
|
const isMounted = useIsMounted();
|
|
1080
|
-
const calculate = (0,
|
|
1086
|
+
const calculate = (0, import_react11.useCallback)(() => {
|
|
1081
1087
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
1082
1088
|
const windowRect = windowRef?.current.getBoundingClientRect() ?? {
|
|
1083
1089
|
top: 0,
|
|
@@ -1107,14 +1113,14 @@ function useFloatingElement({
|
|
|
1107
1113
|
}, [anchorRef, containerRef, gap, horizontalAlignment, screenPadding, verticalAlignment, windowRef]);
|
|
1108
1114
|
const height = containerRef.current?.getBoundingClientRect().height;
|
|
1109
1115
|
const width = containerRef.current?.getBoundingClientRect().width;
|
|
1110
|
-
(0,
|
|
1116
|
+
(0, import_react11.useEffect)(() => {
|
|
1111
1117
|
if (active && isMounted) {
|
|
1112
1118
|
calculate();
|
|
1113
1119
|
} else {
|
|
1114
1120
|
setStyle(void 0);
|
|
1115
1121
|
}
|
|
1116
1122
|
}, [calculate, active, isMounted, height, width]);
|
|
1117
|
-
(0,
|
|
1123
|
+
(0, import_react11.useEffect)(() => {
|
|
1118
1124
|
window.addEventListener("resize", calculate);
|
|
1119
1125
|
let timeout;
|
|
1120
1126
|
if (isPolling) {
|
|
@@ -1134,11 +1140,11 @@ function useFloatingElement({
|
|
|
1134
1140
|
var import_react_dom2 = require("react-dom");
|
|
1135
1141
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1136
1142
|
var defaultToggleOpenOptions = {
|
|
1137
|
-
|
|
1143
|
+
highlightStartPositionBehavior: "first"
|
|
1138
1144
|
};
|
|
1139
|
-
var SelectContext = (0,
|
|
1145
|
+
var SelectContext = (0, import_react12.createContext)(null);
|
|
1140
1146
|
function useSelectContext() {
|
|
1141
|
-
const ctx = (0,
|
|
1147
|
+
const ctx = (0, import_react12.useContext)(SelectContext);
|
|
1142
1148
|
if (!ctx) {
|
|
1143
1149
|
throw new Error("SelectContext must be used within a ListBoxPrimitive");
|
|
1144
1150
|
}
|
|
@@ -1157,47 +1163,62 @@ var SelectRoot = ({
|
|
|
1157
1163
|
isMultiSelect = false,
|
|
1158
1164
|
iconAppearance = "left"
|
|
1159
1165
|
}) => {
|
|
1160
|
-
const
|
|
1161
|
-
const
|
|
1162
|
-
const generatedId = (0, import_react13.useId)();
|
|
1166
|
+
const triggerRef = (0, import_react12.useRef)(null);
|
|
1167
|
+
const generatedId = (0, import_react12.useId)();
|
|
1163
1168
|
const usedId = id ?? generatedId;
|
|
1164
|
-
const [internalState, setInternalState] = (0,
|
|
1165
|
-
isOpen
|
|
1169
|
+
const [internalState, setInternalState] = (0, import_react12.useState)({
|
|
1170
|
+
isOpen,
|
|
1171
|
+
options: []
|
|
1166
1172
|
});
|
|
1167
|
-
const selectedValues =
|
|
1173
|
+
const selectedValues = (0, import_react12.useMemo)(
|
|
1174
|
+
() => isMultiSelect ? values ?? [] : [value].filter(Boolean),
|
|
1175
|
+
[isMultiSelect, value, values]
|
|
1176
|
+
);
|
|
1177
|
+
const selectedOptions = (0, import_react12.useMemo)(
|
|
1178
|
+
() => selectedValues.map((value2) => internalState.options.find((option) => value2 === option.value)).filter(Boolean),
|
|
1179
|
+
[selectedValues, internalState.options]
|
|
1180
|
+
);
|
|
1168
1181
|
const state = {
|
|
1169
1182
|
...internalState,
|
|
1170
1183
|
id: usedId,
|
|
1171
1184
|
disabled,
|
|
1172
1185
|
invalid,
|
|
1173
1186
|
value: selectedValues,
|
|
1174
|
-
|
|
1175
|
-
selectedOptions: selectedValues.map((value2) => options.find((option) => value2 === option.value)).filter(Boolean)
|
|
1187
|
+
selectedOptions
|
|
1176
1188
|
};
|
|
1177
1189
|
const config = {
|
|
1178
1190
|
isMultiSelect,
|
|
1179
1191
|
iconAppearance
|
|
1180
1192
|
};
|
|
1181
|
-
const registerItem = (0,
|
|
1182
|
-
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1193
|
+
const registerItem = (0, import_react12.useCallback)((item) => {
|
|
1194
|
+
setInternalState((prev) => {
|
|
1195
|
+
const updatedOptions = [...prev.options, item];
|
|
1196
|
+
updatedOptions.sort((a, b) => {
|
|
1185
1197
|
const aEl = a.ref.current;
|
|
1186
1198
|
const bEl = b.ref.current;
|
|
1187
1199
|
if (!aEl || !bEl) return 0;
|
|
1188
1200
|
return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
1189
1201
|
});
|
|
1190
|
-
return
|
|
1202
|
+
return {
|
|
1203
|
+
...prev,
|
|
1204
|
+
options: updatedOptions
|
|
1205
|
+
};
|
|
1191
1206
|
});
|
|
1192
1207
|
}, []);
|
|
1193
|
-
const unregisterItem = (0,
|
|
1194
|
-
|
|
1208
|
+
const unregisterItem = (0, import_react12.useCallback)((value2) => {
|
|
1209
|
+
setInternalState((prev) => {
|
|
1210
|
+
const updatedOptions = prev.options.filter((i) => i.value !== value2);
|
|
1211
|
+
return {
|
|
1212
|
+
...prev,
|
|
1213
|
+
options: updatedOptions
|
|
1214
|
+
};
|
|
1215
|
+
});
|
|
1195
1216
|
}, []);
|
|
1196
1217
|
const toggleSelection = (value2, isSelected) => {
|
|
1197
1218
|
if (disabled) {
|
|
1198
1219
|
return;
|
|
1199
1220
|
}
|
|
1200
|
-
const option = options.find((i) => i.value === value2);
|
|
1221
|
+
const option = state.options.find((i) => i.value === value2);
|
|
1201
1222
|
if (!option) {
|
|
1202
1223
|
console.error(`SelectOption with value: ${value2} not found`);
|
|
1203
1224
|
return;
|
|
@@ -1233,42 +1254,47 @@ var SelectRoot = ({
|
|
|
1233
1254
|
highlightedValue: value2
|
|
1234
1255
|
}));
|
|
1235
1256
|
};
|
|
1236
|
-
const registerTrigger = (0,
|
|
1257
|
+
const registerTrigger = (0, import_react12.useCallback)((ref) => {
|
|
1237
1258
|
triggerRef.current = ref.current;
|
|
1238
1259
|
}, []);
|
|
1239
|
-
const unregisterTrigger = (0,
|
|
1260
|
+
const unregisterTrigger = (0, import_react12.useCallback)(() => {
|
|
1240
1261
|
triggerRef.current = null;
|
|
1241
1262
|
}, []);
|
|
1242
1263
|
const toggleOpen = (isOpen2, toggleOpenOptions) => {
|
|
1243
|
-
const {
|
|
1244
|
-
let
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1264
|
+
const { highlightStartPositionBehavior } = { ...defaultToggleOpenOptions, ...toggleOpenOptions };
|
|
1265
|
+
let firstSelectedValue;
|
|
1266
|
+
let firstEnabledValue;
|
|
1267
|
+
for (let i = 0; i < state.options.length; i++) {
|
|
1268
|
+
const currentOption = state.options[highlightStartPositionBehavior === "first" ? i : state.options.length - i - 1];
|
|
1269
|
+
if (!currentOption.disabled) {
|
|
1270
|
+
if (!firstEnabledValue) {
|
|
1271
|
+
firstEnabledValue = currentOption.value;
|
|
1272
|
+
}
|
|
1273
|
+
if (selectedValues.includes(currentOption.value)) {
|
|
1274
|
+
firstSelectedValue = currentOption.value;
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1252
1278
|
}
|
|
1253
1279
|
setInternalState((prevState) => ({
|
|
1254
1280
|
...prevState,
|
|
1255
1281
|
isOpen: isOpen2 ?? !prevState.isOpen,
|
|
1256
|
-
highlightedValue:
|
|
1282
|
+
highlightedValue: firstSelectedValue ?? firstEnabledValue
|
|
1257
1283
|
}));
|
|
1258
1284
|
};
|
|
1259
1285
|
const moveHighlightedIndex = (delta) => {
|
|
1260
|
-
let highlightedIndex = options.findIndex((value2) => value2.value === internalState.highlightedValue);
|
|
1286
|
+
let highlightedIndex = state.options.findIndex((value2) => value2.value === internalState.highlightedValue);
|
|
1261
1287
|
if (highlightedIndex === -1) {
|
|
1262
1288
|
highlightedIndex = 0;
|
|
1263
1289
|
}
|
|
1264
|
-
const optionLength = options.length;
|
|
1290
|
+
const optionLength = state.options.length;
|
|
1265
1291
|
const startIndex = (highlightedIndex + delta % optionLength + optionLength) % optionLength;
|
|
1266
1292
|
const isForward = delta >= 0;
|
|
1267
|
-
let highlightedValue = options[startIndex].value;
|
|
1268
|
-
for (let i = 0; i < options.length; i++) {
|
|
1293
|
+
let highlightedValue = state.options[startIndex].value;
|
|
1294
|
+
for (let i = 0; i < state.options.length; i++) {
|
|
1269
1295
|
const index = (startIndex + (isForward ? i : -i) + optionLength) % optionLength;
|
|
1270
|
-
if (!options[index].disabled) {
|
|
1271
|
-
highlightedValue = options[index].value;
|
|
1296
|
+
if (!state.options[index].disabled) {
|
|
1297
|
+
highlightedValue = state.options[index].value;
|
|
1272
1298
|
break;
|
|
1273
1299
|
}
|
|
1274
1300
|
}
|
|
@@ -1277,11 +1303,11 @@ var SelectRoot = ({
|
|
|
1277
1303
|
highlightedValue
|
|
1278
1304
|
}));
|
|
1279
1305
|
};
|
|
1280
|
-
(0,
|
|
1306
|
+
(0, import_react12.useEffect)(() => {
|
|
1281
1307
|
if (!internalState.highlightedValue) return;
|
|
1282
|
-
const highlighted = options.find((value2) => value2.value === internalState.highlightedValue);
|
|
1308
|
+
const highlighted = internalState.options.find((value2) => value2.value === internalState.highlightedValue);
|
|
1283
1309
|
if (highlighted) {
|
|
1284
|
-
highlighted.ref.current
|
|
1310
|
+
highlighted.ref.current?.scrollIntoView({ behavior: "instant", block: "nearest" });
|
|
1285
1311
|
} else {
|
|
1286
1312
|
console.error(`SelectRoot: Could not find highlighted value (${internalState.highlightedValue})`);
|
|
1287
1313
|
}
|
|
@@ -1305,14 +1331,14 @@ var SelectRoot = ({
|
|
|
1305
1331
|
};
|
|
1306
1332
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectContext.Provider, { value: contextValue, children });
|
|
1307
1333
|
};
|
|
1308
|
-
var SelectOption = (0,
|
|
1334
|
+
var SelectOption = (0, import_react12.forwardRef)(
|
|
1309
1335
|
function SelectOption2({ children, value, disabled = false, iconAppearance, className, ...restProps }, ref) {
|
|
1310
1336
|
const { state, config, item, trigger } = useSelectContext();
|
|
1311
1337
|
const { register, unregister, toggleSelection, highlightItem } = item;
|
|
1312
|
-
const itemRef = (0,
|
|
1338
|
+
const itemRef = (0, import_react12.useRef)(null);
|
|
1313
1339
|
iconAppearance ??= config.iconAppearance;
|
|
1314
1340
|
const label = children ?? value;
|
|
1315
|
-
(0,
|
|
1341
|
+
(0, import_react12.useEffect)(() => {
|
|
1316
1342
|
register({
|
|
1317
1343
|
value,
|
|
1318
1344
|
label,
|
|
@@ -1390,13 +1416,13 @@ var defaultSelectButtonTranslation = {
|
|
|
1390
1416
|
clickToSelect: "Zum ausw\xE4hlen dr\xFCcken"
|
|
1391
1417
|
}
|
|
1392
1418
|
};
|
|
1393
|
-
var SelectButton = (0,
|
|
1419
|
+
var SelectButton = (0, import_react12.forwardRef)(function SelectButton2({ placeholder, selectedDisplay, ...props }, ref) {
|
|
1394
1420
|
const translation = useTranslation([defaultSelectButtonTranslation]);
|
|
1395
1421
|
const { state, trigger } = useSelectContext();
|
|
1396
1422
|
const { register, unregister, toggleOpen } = trigger;
|
|
1397
|
-
const innerRef = (0,
|
|
1398
|
-
(0,
|
|
1399
|
-
(0,
|
|
1423
|
+
const innerRef = (0, import_react12.useRef)(null);
|
|
1424
|
+
(0, import_react12.useImperativeHandle)(ref, () => innerRef.current);
|
|
1425
|
+
(0, import_react12.useEffect)(() => {
|
|
1400
1426
|
register(innerRef);
|
|
1401
1427
|
return () => unregister();
|
|
1402
1428
|
}, [register, unregister]);
|
|
@@ -1418,12 +1444,12 @@ var SelectButton = (0, import_react13.forwardRef)(function SelectButton2({ place
|
|
|
1418
1444
|
props.onKeyDown?.(event);
|
|
1419
1445
|
switch (event.key) {
|
|
1420
1446
|
case "ArrowDown":
|
|
1421
|
-
toggleOpen(true, {
|
|
1447
|
+
toggleOpen(true, { highlightStartPositionBehavior: "first" });
|
|
1422
1448
|
event.preventDefault();
|
|
1423
1449
|
event.stopPropagation();
|
|
1424
1450
|
break;
|
|
1425
1451
|
case "ArrowUp":
|
|
1426
|
-
toggleOpen(true, {
|
|
1452
|
+
toggleOpen(true, { highlightStartPositionBehavior: "last" });
|
|
1427
1453
|
event.preventDefault();
|
|
1428
1454
|
event.stopPropagation();
|
|
1429
1455
|
break;
|
|
@@ -1469,12 +1495,12 @@ var SelectButton = (0, import_react13.forwardRef)(function SelectButton2({ place
|
|
|
1469
1495
|
}
|
|
1470
1496
|
);
|
|
1471
1497
|
});
|
|
1472
|
-
var SelectChipDisplay = (0,
|
|
1498
|
+
var SelectChipDisplay = (0, import_react12.forwardRef)(function SelectChipDisplay2({ ...props }, ref) {
|
|
1473
1499
|
const { state, trigger, item } = useSelectContext();
|
|
1474
1500
|
const { register, unregister, toggleOpen } = trigger;
|
|
1475
|
-
const innerRef = (0,
|
|
1476
|
-
(0,
|
|
1477
|
-
(0,
|
|
1501
|
+
const innerRef = (0, import_react12.useRef)(null);
|
|
1502
|
+
(0, import_react12.useImperativeHandle)(ref, () => innerRef.current);
|
|
1503
|
+
(0, import_react12.useEffect)(() => {
|
|
1478
1504
|
register(innerRef);
|
|
1479
1505
|
return () => unregister();
|
|
1480
1506
|
}, [register, unregister]);
|
|
@@ -1517,10 +1543,10 @@ var SelectChipDisplay = (0, import_react13.forwardRef)(function SelectChipDispla
|
|
|
1517
1543
|
onKeyDown: (event) => {
|
|
1518
1544
|
switch (event.key) {
|
|
1519
1545
|
case "ArrowDown":
|
|
1520
|
-
toggleOpen(true, {
|
|
1546
|
+
toggleOpen(true, { highlightStartPositionBehavior: "first" });
|
|
1521
1547
|
break;
|
|
1522
1548
|
case "ArrowUp":
|
|
1523
|
-
toggleOpen(true, {
|
|
1549
|
+
toggleOpen(true, { highlightStartPositionBehavior: "last" });
|
|
1524
1550
|
}
|
|
1525
1551
|
},
|
|
1526
1552
|
size: "small",
|
|
@@ -1537,14 +1563,15 @@ var SelectChipDisplay = (0, import_react13.forwardRef)(function SelectChipDispla
|
|
|
1537
1563
|
}
|
|
1538
1564
|
);
|
|
1539
1565
|
});
|
|
1540
|
-
var SelectContent = (0,
|
|
1566
|
+
var SelectContent = (0, import_react12.forwardRef)(
|
|
1541
1567
|
function SelectContent2({
|
|
1542
1568
|
alignment,
|
|
1543
1569
|
orientation = "vertical",
|
|
1570
|
+
containerClassName,
|
|
1544
1571
|
...props
|
|
1545
1572
|
}, ref) {
|
|
1546
|
-
const innerRef = (0,
|
|
1547
|
-
(0,
|
|
1573
|
+
const innerRef = (0, import_react12.useRef)(null);
|
|
1574
|
+
(0, import_react12.useImperativeHandle)(ref, () => innerRef.current);
|
|
1548
1575
|
const { trigger, state, config, item } = useSelectContext();
|
|
1549
1576
|
const position = useFloatingElement({
|
|
1550
1577
|
active: state.isOpen,
|
|
@@ -1557,81 +1584,88 @@ var SelectContent = (0, import_react13.forwardRef)(
|
|
|
1557
1584
|
active: state.isOpen && !!position
|
|
1558
1585
|
});
|
|
1559
1586
|
return (0, import_react_dom2.createPortal)(
|
|
1560
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
{
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
vertical: "ArrowDown",
|
|
1585
|
-
horizontal: "ArrowUp"
|
|
1586
|
-
}):
|
|
1587
|
-
item.moveHighlightedIndex(1);
|
|
1588
|
-
event.preventDefault();
|
|
1589
|
-
break;
|
|
1590
|
-
case match(orientation, {
|
|
1591
|
-
vertical: "ArrowUp",
|
|
1592
|
-
horizontal: "ArrowDown"
|
|
1593
|
-
}):
|
|
1594
|
-
item.moveHighlightedIndex(-1);
|
|
1595
|
-
event.preventDefault();
|
|
1596
|
-
break;
|
|
1597
|
-
case "Home":
|
|
1598
|
-
event.preventDefault();
|
|
1599
|
-
break;
|
|
1600
|
-
case "End":
|
|
1601
|
-
event.preventDefault();
|
|
1602
|
-
break;
|
|
1603
|
-
case "Enter":
|
|
1604
|
-
// Fall through
|
|
1605
|
-
case " ":
|
|
1606
|
-
if (state.highlightedValue) {
|
|
1607
|
-
item.toggleSelection(state.highlightedValue);
|
|
1608
|
-
if (!config.isMultiSelect) {
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1588
|
+
"div",
|
|
1589
|
+
{
|
|
1590
|
+
id: `select-container-${state.id}`,
|
|
1591
|
+
className: (0, import_clsx5.default)("fixed inset-0 w-screen h-screen", containerClassName),
|
|
1592
|
+
hidden: !state.isOpen,
|
|
1593
|
+
children: [
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1595
|
+
"div",
|
|
1596
|
+
{
|
|
1597
|
+
id: `select-background-${state.id}`,
|
|
1598
|
+
onClick: () => trigger.toggleOpen(false),
|
|
1599
|
+
className: (0, import_clsx5.default)("fixed inset-0 w-screen h-screen")
|
|
1600
|
+
}
|
|
1601
|
+
),
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1603
|
+
"ul",
|
|
1604
|
+
{
|
|
1605
|
+
...props,
|
|
1606
|
+
id: `${state.id}-listbox`,
|
|
1607
|
+
ref: innerRef,
|
|
1608
|
+
onKeyDown: (event) => {
|
|
1609
|
+
switch (event.key) {
|
|
1610
|
+
case "Escape":
|
|
1609
1611
|
trigger.toggleOpen(false);
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
+
event.preventDefault();
|
|
1613
|
+
event.stopPropagation();
|
|
1614
|
+
break;
|
|
1615
|
+
case match(orientation, {
|
|
1616
|
+
vertical: "ArrowDown",
|
|
1617
|
+
horizontal: "ArrowUp"
|
|
1618
|
+
}):
|
|
1619
|
+
item.moveHighlightedIndex(1);
|
|
1620
|
+
event.preventDefault();
|
|
1621
|
+
break;
|
|
1622
|
+
case match(orientation, {
|
|
1623
|
+
vertical: "ArrowUp",
|
|
1624
|
+
horizontal: "ArrowDown"
|
|
1625
|
+
}):
|
|
1626
|
+
item.moveHighlightedIndex(-1);
|
|
1627
|
+
event.preventDefault();
|
|
1628
|
+
break;
|
|
1629
|
+
case "Home":
|
|
1630
|
+
event.preventDefault();
|
|
1631
|
+
break;
|
|
1632
|
+
case "End":
|
|
1633
|
+
event.preventDefault();
|
|
1634
|
+
break;
|
|
1635
|
+
case "Enter":
|
|
1636
|
+
// Fall through
|
|
1637
|
+
case " ":
|
|
1638
|
+
if (state.highlightedValue) {
|
|
1639
|
+
item.toggleSelection(state.highlightedValue);
|
|
1640
|
+
if (!config.isMultiSelect) {
|
|
1641
|
+
trigger.toggleOpen(false);
|
|
1642
|
+
}
|
|
1643
|
+
event.preventDefault();
|
|
1644
|
+
}
|
|
1645
|
+
break;
|
|
1612
1646
|
}
|
|
1613
|
-
|
|
1647
|
+
},
|
|
1648
|
+
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),
|
|
1649
|
+
style: {
|
|
1650
|
+
opacity: position ? void 0 : 0,
|
|
1651
|
+
position: "fixed",
|
|
1652
|
+
...position
|
|
1653
|
+
},
|
|
1654
|
+
role: "listbox",
|
|
1655
|
+
"aria-multiselectable": config.isMultiSelect,
|
|
1656
|
+
"aria-orientation": orientation,
|
|
1657
|
+
tabIndex: position ? 0 : void 0,
|
|
1658
|
+
children: props.children
|
|
1614
1659
|
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
position: "fixed",
|
|
1620
|
-
...position
|
|
1621
|
-
},
|
|
1622
|
-
role: "listbox",
|
|
1623
|
-
"aria-multiselectable": config.isMultiSelect,
|
|
1624
|
-
"aria-orientation": orientation,
|
|
1625
|
-
tabIndex: position ? 0 : void 0,
|
|
1626
|
-
children: props.children
|
|
1627
|
-
}
|
|
1628
|
-
)
|
|
1629
|
-
] }),
|
|
1660
|
+
)
|
|
1661
|
+
]
|
|
1662
|
+
}
|
|
1663
|
+
),
|
|
1630
1664
|
document.body
|
|
1631
1665
|
);
|
|
1632
1666
|
}
|
|
1633
1667
|
);
|
|
1634
|
-
var Select = (0,
|
|
1668
|
+
var Select = (0, import_react12.forwardRef)(function Select2({
|
|
1635
1669
|
children,
|
|
1636
1670
|
contentPanelProps,
|
|
1637
1671
|
buttonProps,
|
|
@@ -1653,7 +1687,7 @@ var Select = (0, import_react13.forwardRef)(function Select2({
|
|
|
1653
1687
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
1654
1688
|
] });
|
|
1655
1689
|
});
|
|
1656
|
-
var SelectUncontrolled = (0,
|
|
1690
|
+
var SelectUncontrolled = (0, import_react12.forwardRef)(function SelectUncontrolled2({
|
|
1657
1691
|
value: initialValue,
|
|
1658
1692
|
onValueChanged,
|
|
1659
1693
|
...props
|
|
@@ -1669,7 +1703,7 @@ var SelectUncontrolled = (0, import_react13.forwardRef)(function SelectUncontrol
|
|
|
1669
1703
|
}
|
|
1670
1704
|
);
|
|
1671
1705
|
});
|
|
1672
|
-
var MultiSelect = (0,
|
|
1706
|
+
var MultiSelect = (0, import_react12.forwardRef)(function MultiSelect2({
|
|
1673
1707
|
children,
|
|
1674
1708
|
contentPanelProps,
|
|
1675
1709
|
buttonProps,
|
|
@@ -1680,7 +1714,7 @@ var MultiSelect = (0, import_react13.forwardRef)(function MultiSelect2({
|
|
|
1680
1714
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
1681
1715
|
] });
|
|
1682
1716
|
});
|
|
1683
|
-
var MultiSelectUncontrolled = (0,
|
|
1717
|
+
var MultiSelectUncontrolled = (0, import_react12.forwardRef)(function MultiSelectUncontrolled2({
|
|
1684
1718
|
values: initialValues,
|
|
1685
1719
|
onValuesChanged,
|
|
1686
1720
|
...props
|
|
@@ -1696,7 +1730,7 @@ var MultiSelectUncontrolled = (0, import_react13.forwardRef)(function MultiSelec
|
|
|
1696
1730
|
}
|
|
1697
1731
|
);
|
|
1698
1732
|
});
|
|
1699
|
-
var MultiSelectChipDisplay = (0,
|
|
1733
|
+
var MultiSelectChipDisplay = (0, import_react12.forwardRef)(function MultiSelectChipDisplay2({
|
|
1700
1734
|
children,
|
|
1701
1735
|
contentPanelProps,
|
|
1702
1736
|
chipDisplayProps,
|
|
@@ -1707,7 +1741,7 @@ var MultiSelectChipDisplay = (0, import_react13.forwardRef)(function MultiSelect
|
|
|
1707
1741
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
1708
1742
|
] });
|
|
1709
1743
|
});
|
|
1710
|
-
var MultiSelectChipDisplayUncontrolled = (0,
|
|
1744
|
+
var MultiSelectChipDisplayUncontrolled = (0, import_react12.forwardRef)(function MultiSelectChipDisplayUncontrolled2({
|
|
1711
1745
|
values: initialValues,
|
|
1712
1746
|
onValuesChanged,
|
|
1713
1747
|
...props
|