@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
|
@@ -48,10 +48,12 @@ type Orientation = 'vertical' | 'horizontal';
|
|
|
48
48
|
type SelectContentProps = HTMLAttributes<HTMLUListElement> & {
|
|
49
49
|
alignment?: Pick<UseFloatingElementOptions, 'gap' | 'horizontalAlignment' | 'verticalAlignment'>;
|
|
50
50
|
orientation?: Orientation;
|
|
51
|
+
containerClassName?: string;
|
|
51
52
|
};
|
|
52
53
|
declare const SelectContent: React__default.ForwardRefExoticComponent<HTMLAttributes<HTMLUListElement> & {
|
|
53
54
|
alignment?: Pick<UseFloatingElementOptions, "gap" | "horizontalAlignment" | "verticalAlignment">;
|
|
54
55
|
orientation?: Orientation;
|
|
56
|
+
containerClassName?: string;
|
|
55
57
|
} & React__default.RefAttributes<HTMLUListElement>>;
|
|
56
58
|
type SelectProps = Omit<SelectRootProps, 'isMultiSelect' | 'values' | 'onValuesChanged'> & {
|
|
57
59
|
contentPanelProps?: SelectContentProps;
|
|
@@ -48,10 +48,12 @@ type Orientation = 'vertical' | 'horizontal';
|
|
|
48
48
|
type SelectContentProps = HTMLAttributes<HTMLUListElement> & {
|
|
49
49
|
alignment?: Pick<UseFloatingElementOptions, 'gap' | 'horizontalAlignment' | 'verticalAlignment'>;
|
|
50
50
|
orientation?: Orientation;
|
|
51
|
+
containerClassName?: string;
|
|
51
52
|
};
|
|
52
53
|
declare const SelectContent: React__default.ForwardRefExoticComponent<HTMLAttributes<HTMLUListElement> & {
|
|
53
54
|
alignment?: Pick<UseFloatingElementOptions, "gap" | "horizontalAlignment" | "verticalAlignment">;
|
|
54
55
|
orientation?: Orientation;
|
|
56
|
+
containerClassName?: string;
|
|
55
57
|
} & React__default.RefAttributes<HTMLUListElement>>;
|
|
56
58
|
type SelectProps = Omit<SelectRootProps, 'isMultiSelect' | 'values' | 'onValuesChanged'> & {
|
|
57
59
|
contentPanelProps?: SelectContentProps;
|
|
@@ -869,7 +869,7 @@ function useFloatingElement({
|
|
|
869
869
|
var import_react_dom = require("react-dom");
|
|
870
870
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
871
871
|
var defaultToggleOpenOptions = {
|
|
872
|
-
|
|
872
|
+
highlightStartPositionBehavior: "first"
|
|
873
873
|
};
|
|
874
874
|
var SelectContext = (0, import_react9.createContext)(null);
|
|
875
875
|
function useSelectContext() {
|
|
@@ -892,47 +892,62 @@ var SelectRoot = ({
|
|
|
892
892
|
isMultiSelect = false,
|
|
893
893
|
iconAppearance = "left"
|
|
894
894
|
}) => {
|
|
895
|
-
const [options, setOptions] = (0, import_react9.useState)([]);
|
|
896
895
|
const triggerRef = (0, import_react9.useRef)(null);
|
|
897
896
|
const generatedId = (0, import_react9.useId)();
|
|
898
897
|
const usedId = id ?? generatedId;
|
|
899
898
|
const [internalState, setInternalState] = (0, import_react9.useState)({
|
|
900
|
-
isOpen
|
|
899
|
+
isOpen,
|
|
900
|
+
options: []
|
|
901
901
|
});
|
|
902
|
-
const selectedValues =
|
|
902
|
+
const selectedValues = (0, import_react9.useMemo)(
|
|
903
|
+
() => isMultiSelect ? values ?? [] : [value].filter(Boolean),
|
|
904
|
+
[isMultiSelect, value, values]
|
|
905
|
+
);
|
|
906
|
+
const selectedOptions = (0, import_react9.useMemo)(
|
|
907
|
+
() => selectedValues.map((value2) => internalState.options.find((option) => value2 === option.value)).filter(Boolean),
|
|
908
|
+
[selectedValues, internalState.options]
|
|
909
|
+
);
|
|
903
910
|
const state = {
|
|
904
911
|
...internalState,
|
|
905
912
|
id: usedId,
|
|
906
913
|
disabled,
|
|
907
914
|
invalid,
|
|
908
915
|
value: selectedValues,
|
|
909
|
-
|
|
910
|
-
selectedOptions: selectedValues.map((value2) => options.find((option) => value2 === option.value)).filter(Boolean)
|
|
916
|
+
selectedOptions
|
|
911
917
|
};
|
|
912
918
|
const config = {
|
|
913
919
|
isMultiSelect,
|
|
914
920
|
iconAppearance
|
|
915
921
|
};
|
|
916
922
|
const registerItem = (0, import_react9.useCallback)((item) => {
|
|
917
|
-
|
|
918
|
-
const
|
|
919
|
-
|
|
923
|
+
setInternalState((prev) => {
|
|
924
|
+
const updatedOptions = [...prev.options, item];
|
|
925
|
+
updatedOptions.sort((a, b) => {
|
|
920
926
|
const aEl = a.ref.current;
|
|
921
927
|
const bEl = b.ref.current;
|
|
922
928
|
if (!aEl || !bEl) return 0;
|
|
923
929
|
return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
924
930
|
});
|
|
925
|
-
return
|
|
931
|
+
return {
|
|
932
|
+
...prev,
|
|
933
|
+
options: updatedOptions
|
|
934
|
+
};
|
|
926
935
|
});
|
|
927
936
|
}, []);
|
|
928
937
|
const unregisterItem = (0, import_react9.useCallback)((value2) => {
|
|
929
|
-
|
|
938
|
+
setInternalState((prev) => {
|
|
939
|
+
const updatedOptions = prev.options.filter((i) => i.value !== value2);
|
|
940
|
+
return {
|
|
941
|
+
...prev,
|
|
942
|
+
options: updatedOptions
|
|
943
|
+
};
|
|
944
|
+
});
|
|
930
945
|
}, []);
|
|
931
946
|
const toggleSelection = (value2, isSelected) => {
|
|
932
947
|
if (disabled) {
|
|
933
948
|
return;
|
|
934
949
|
}
|
|
935
|
-
const option = options.find((i) => i.value === value2);
|
|
950
|
+
const option = state.options.find((i) => i.value === value2);
|
|
936
951
|
if (!option) {
|
|
937
952
|
console.error(`SelectOption with value: ${value2} not found`);
|
|
938
953
|
return;
|
|
@@ -975,35 +990,40 @@ var SelectRoot = ({
|
|
|
975
990
|
triggerRef.current = null;
|
|
976
991
|
}, []);
|
|
977
992
|
const toggleOpen = (isOpen2, toggleOpenOptions) => {
|
|
978
|
-
const {
|
|
979
|
-
let
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
993
|
+
const { highlightStartPositionBehavior } = { ...defaultToggleOpenOptions, ...toggleOpenOptions };
|
|
994
|
+
let firstSelectedValue;
|
|
995
|
+
let firstEnabledValue;
|
|
996
|
+
for (let i = 0; i < state.options.length; i++) {
|
|
997
|
+
const currentOption = state.options[highlightStartPositionBehavior === "first" ? i : state.options.length - i - 1];
|
|
998
|
+
if (!currentOption.disabled) {
|
|
999
|
+
if (!firstEnabledValue) {
|
|
1000
|
+
firstEnabledValue = currentOption.value;
|
|
1001
|
+
}
|
|
1002
|
+
if (selectedValues.includes(currentOption.value)) {
|
|
1003
|
+
firstSelectedValue = currentOption.value;
|
|
1004
|
+
break;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
987
1007
|
}
|
|
988
1008
|
setInternalState((prevState) => ({
|
|
989
1009
|
...prevState,
|
|
990
1010
|
isOpen: isOpen2 ?? !prevState.isOpen,
|
|
991
|
-
highlightedValue:
|
|
1011
|
+
highlightedValue: firstSelectedValue ?? firstEnabledValue
|
|
992
1012
|
}));
|
|
993
1013
|
};
|
|
994
1014
|
const moveHighlightedIndex = (delta) => {
|
|
995
|
-
let highlightedIndex = options.findIndex((value2) => value2.value === internalState.highlightedValue);
|
|
1015
|
+
let highlightedIndex = state.options.findIndex((value2) => value2.value === internalState.highlightedValue);
|
|
996
1016
|
if (highlightedIndex === -1) {
|
|
997
1017
|
highlightedIndex = 0;
|
|
998
1018
|
}
|
|
999
|
-
const optionLength = options.length;
|
|
1019
|
+
const optionLength = state.options.length;
|
|
1000
1020
|
const startIndex = (highlightedIndex + delta % optionLength + optionLength) % optionLength;
|
|
1001
1021
|
const isForward = delta >= 0;
|
|
1002
|
-
let highlightedValue = options[startIndex].value;
|
|
1003
|
-
for (let i = 0; i < options.length; i++) {
|
|
1022
|
+
let highlightedValue = state.options[startIndex].value;
|
|
1023
|
+
for (let i = 0; i < state.options.length; i++) {
|
|
1004
1024
|
const index = (startIndex + (isForward ? i : -i) + optionLength) % optionLength;
|
|
1005
|
-
if (!options[index].disabled) {
|
|
1006
|
-
highlightedValue = options[index].value;
|
|
1025
|
+
if (!state.options[index].disabled) {
|
|
1026
|
+
highlightedValue = state.options[index].value;
|
|
1007
1027
|
break;
|
|
1008
1028
|
}
|
|
1009
1029
|
}
|
|
@@ -1014,9 +1034,9 @@ var SelectRoot = ({
|
|
|
1014
1034
|
};
|
|
1015
1035
|
(0, import_react9.useEffect)(() => {
|
|
1016
1036
|
if (!internalState.highlightedValue) return;
|
|
1017
|
-
const highlighted = options.find((value2) => value2.value === internalState.highlightedValue);
|
|
1037
|
+
const highlighted = internalState.options.find((value2) => value2.value === internalState.highlightedValue);
|
|
1018
1038
|
if (highlighted) {
|
|
1019
|
-
highlighted.ref.current
|
|
1039
|
+
highlighted.ref.current?.scrollIntoView({ behavior: "instant", block: "nearest" });
|
|
1020
1040
|
} else {
|
|
1021
1041
|
console.error(`SelectRoot: Could not find highlighted value (${internalState.highlightedValue})`);
|
|
1022
1042
|
}
|
|
@@ -1153,12 +1173,12 @@ var SelectButton = (0, import_react9.forwardRef)(function SelectButton2({ placeh
|
|
|
1153
1173
|
props.onKeyDown?.(event);
|
|
1154
1174
|
switch (event.key) {
|
|
1155
1175
|
case "ArrowDown":
|
|
1156
|
-
toggleOpen(true, {
|
|
1176
|
+
toggleOpen(true, { highlightStartPositionBehavior: "first" });
|
|
1157
1177
|
event.preventDefault();
|
|
1158
1178
|
event.stopPropagation();
|
|
1159
1179
|
break;
|
|
1160
1180
|
case "ArrowUp":
|
|
1161
|
-
toggleOpen(true, {
|
|
1181
|
+
toggleOpen(true, { highlightStartPositionBehavior: "last" });
|
|
1162
1182
|
event.preventDefault();
|
|
1163
1183
|
event.stopPropagation();
|
|
1164
1184
|
break;
|
|
@@ -1252,10 +1272,10 @@ var SelectChipDisplay = (0, import_react9.forwardRef)(function SelectChipDisplay
|
|
|
1252
1272
|
onKeyDown: (event) => {
|
|
1253
1273
|
switch (event.key) {
|
|
1254
1274
|
case "ArrowDown":
|
|
1255
|
-
toggleOpen(true, {
|
|
1275
|
+
toggleOpen(true, { highlightStartPositionBehavior: "first" });
|
|
1256
1276
|
break;
|
|
1257
1277
|
case "ArrowUp":
|
|
1258
|
-
toggleOpen(true, {
|
|
1278
|
+
toggleOpen(true, { highlightStartPositionBehavior: "last" });
|
|
1259
1279
|
}
|
|
1260
1280
|
},
|
|
1261
1281
|
size: "small",
|
|
@@ -1276,6 +1296,7 @@ var SelectContent = (0, import_react9.forwardRef)(
|
|
|
1276
1296
|
function SelectContent2({
|
|
1277
1297
|
alignment,
|
|
1278
1298
|
orientation = "vertical",
|
|
1299
|
+
containerClassName,
|
|
1279
1300
|
...props
|
|
1280
1301
|
}, ref) {
|
|
1281
1302
|
const innerRef = (0, import_react9.useRef)(null);
|
|
@@ -1292,76 +1313,83 @@ var SelectContent = (0, import_react9.forwardRef)(
|
|
|
1292
1313
|
active: state.isOpen && !!position
|
|
1293
1314
|
});
|
|
1294
1315
|
return (0, import_react_dom.createPortal)(
|
|
1295
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
{
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
vertical: "ArrowDown",
|
|
1320
|
-
horizontal: "ArrowUp"
|
|
1321
|
-
}):
|
|
1322
|
-
item.moveHighlightedIndex(1);
|
|
1323
|
-
event.preventDefault();
|
|
1324
|
-
break;
|
|
1325
|
-
case match(orientation, {
|
|
1326
|
-
vertical: "ArrowUp",
|
|
1327
|
-
horizontal: "ArrowDown"
|
|
1328
|
-
}):
|
|
1329
|
-
item.moveHighlightedIndex(-1);
|
|
1330
|
-
event.preventDefault();
|
|
1331
|
-
break;
|
|
1332
|
-
case "Home":
|
|
1333
|
-
event.preventDefault();
|
|
1334
|
-
break;
|
|
1335
|
-
case "End":
|
|
1336
|
-
event.preventDefault();
|
|
1337
|
-
break;
|
|
1338
|
-
case "Enter":
|
|
1339
|
-
// Fall through
|
|
1340
|
-
case " ":
|
|
1341
|
-
if (state.highlightedValue) {
|
|
1342
|
-
item.toggleSelection(state.highlightedValue);
|
|
1343
|
-
if (!config.isMultiSelect) {
|
|
1316
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1317
|
+
"div",
|
|
1318
|
+
{
|
|
1319
|
+
id: `select-container-${state.id}`,
|
|
1320
|
+
className: (0, import_clsx4.default)("fixed inset-0 w-screen h-screen", containerClassName),
|
|
1321
|
+
hidden: !state.isOpen,
|
|
1322
|
+
children: [
|
|
1323
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1324
|
+
"div",
|
|
1325
|
+
{
|
|
1326
|
+
id: `select-background-${state.id}`,
|
|
1327
|
+
onClick: () => trigger.toggleOpen(false),
|
|
1328
|
+
className: (0, import_clsx4.default)("fixed inset-0 w-screen h-screen")
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1332
|
+
"ul",
|
|
1333
|
+
{
|
|
1334
|
+
...props,
|
|
1335
|
+
id: `${state.id}-listbox`,
|
|
1336
|
+
ref: innerRef,
|
|
1337
|
+
onKeyDown: (event) => {
|
|
1338
|
+
switch (event.key) {
|
|
1339
|
+
case "Escape":
|
|
1344
1340
|
trigger.toggleOpen(false);
|
|
1345
|
-
|
|
1346
|
-
|
|
1341
|
+
event.preventDefault();
|
|
1342
|
+
event.stopPropagation();
|
|
1343
|
+
break;
|
|
1344
|
+
case match(orientation, {
|
|
1345
|
+
vertical: "ArrowDown",
|
|
1346
|
+
horizontal: "ArrowUp"
|
|
1347
|
+
}):
|
|
1348
|
+
item.moveHighlightedIndex(1);
|
|
1349
|
+
event.preventDefault();
|
|
1350
|
+
break;
|
|
1351
|
+
case match(orientation, {
|
|
1352
|
+
vertical: "ArrowUp",
|
|
1353
|
+
horizontal: "ArrowDown"
|
|
1354
|
+
}):
|
|
1355
|
+
item.moveHighlightedIndex(-1);
|
|
1356
|
+
event.preventDefault();
|
|
1357
|
+
break;
|
|
1358
|
+
case "Home":
|
|
1359
|
+
event.preventDefault();
|
|
1360
|
+
break;
|
|
1361
|
+
case "End":
|
|
1362
|
+
event.preventDefault();
|
|
1363
|
+
break;
|
|
1364
|
+
case "Enter":
|
|
1365
|
+
// Fall through
|
|
1366
|
+
case " ":
|
|
1367
|
+
if (state.highlightedValue) {
|
|
1368
|
+
item.toggleSelection(state.highlightedValue);
|
|
1369
|
+
if (!config.isMultiSelect) {
|
|
1370
|
+
trigger.toggleOpen(false);
|
|
1371
|
+
}
|
|
1372
|
+
event.preventDefault();
|
|
1373
|
+
}
|
|
1374
|
+
break;
|
|
1347
1375
|
}
|
|
1348
|
-
|
|
1376
|
+
},
|
|
1377
|
+
className: (0, import_clsx4.default)("flex-col-0 p-2 bg-menu-background text-menu-text rounded-md shadow-hw-bottom focus-style-within overflow-auto", props.className),
|
|
1378
|
+
style: {
|
|
1379
|
+
opacity: position ? void 0 : 0,
|
|
1380
|
+
position: "fixed",
|
|
1381
|
+
...position
|
|
1382
|
+
},
|
|
1383
|
+
role: "listbox",
|
|
1384
|
+
"aria-multiselectable": config.isMultiSelect,
|
|
1385
|
+
"aria-orientation": orientation,
|
|
1386
|
+
tabIndex: position ? 0 : void 0,
|
|
1387
|
+
children: props.children
|
|
1349
1388
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
position: "fixed",
|
|
1355
|
-
...position
|
|
1356
|
-
},
|
|
1357
|
-
role: "listbox",
|
|
1358
|
-
"aria-multiselectable": config.isMultiSelect,
|
|
1359
|
-
"aria-orientation": orientation,
|
|
1360
|
-
tabIndex: position ? 0 : void 0,
|
|
1361
|
-
children: props.children
|
|
1362
|
-
}
|
|
1363
|
-
)
|
|
1364
|
-
] }),
|
|
1389
|
+
)
|
|
1390
|
+
]
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1365
1393
|
document.body
|
|
1366
1394
|
);
|
|
1367
1395
|
}
|