@povio/ui 3.3.0-rc.3 → 3.3.0-rc.4
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/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +5 -1
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +234 -201
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +142 -127
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +2 -17
- package/dist/components/inputs/DateTime/shared/DateField.js +92 -87
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +2 -0
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +144 -134
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +33 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +2 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +2 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +56 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +69 -15
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +1 -0
- package/dist/components/inputs/Selection/shared/select.context.js +19 -9
- package/dist/components/inputs/shared/input.cva.js +1 -1
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/config/uiConfig.context.d.ts +1 -0
- package/dist/config/uiConfig.context.js +2 -1
- package/dist/helpers/dynamicColumns.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/utils/date-time.utils.d.ts +0 -1
- package/dist/utils/date-time.utils.js +21 -45
- package/dist/utils/intl.utils.d.ts +7 -0
- package/dist/utils/intl.utils.js +38 -0
- package/dist/utils/intl.utils.spec.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4,17 +4,19 @@ import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
|
4
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
5
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
6
6
|
import { inputBaseDefinition, inputSizeDefinition } from "../../shared/input.cva.js";
|
|
7
|
+
import { useFirefoxDateSegmentSelectionGuard } from "./useFirefoxDateSegmentSelectionGuard.js";
|
|
7
8
|
import { InputClear } from "../../shared/InputClear.js";
|
|
8
9
|
import { TimeField } from "./TimeField.js";
|
|
9
10
|
import { c } from "react/compiler-runtime";
|
|
10
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
12
|
import { clsx } from "clsx";
|
|
12
|
-
import { useState } from "react";
|
|
13
|
+
import { useRef, useState } from "react";
|
|
13
14
|
import { Button } from "react-aria-components";
|
|
14
15
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
16
|
+
import { mergeRefs } from "@react-aria/utils";
|
|
15
17
|
//#region src/components/inputs/DateTime/shared/TimePickerInput.tsx
|
|
16
18
|
var TimePickerInput = (t0) => {
|
|
17
|
-
const $ = c(
|
|
19
|
+
const $ = c(69);
|
|
18
20
|
const { ref, as, fieldProps, state, isDisabled, isDirty, isRequired, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, onClear, fireBlurOnChange, ...props } = t0;
|
|
19
21
|
const uiConfig = UIConfig.useConfig();
|
|
20
22
|
const inputBaseCva = UIOverrides.useCva("input.baseCva", inputBaseDefinition);
|
|
@@ -34,6 +36,8 @@ var TimePickerInput = (t0) => {
|
|
|
34
36
|
} else t2 = $[2];
|
|
35
37
|
const { focusWithinProps } = useFocusWithin(t2);
|
|
36
38
|
const { isFocusVisible } = useFocusVisible();
|
|
39
|
+
const containerRef = useRef(null);
|
|
40
|
+
useFirefoxDateSegmentSelectionGuard(containerRef);
|
|
37
41
|
const hidePlaceholder = as === "floating" && !state.value && !isFocused;
|
|
38
42
|
let t3;
|
|
39
43
|
if ($[3] !== state.segments) {
|
|
@@ -42,56 +46,62 @@ var TimePickerInput = (t0) => {
|
|
|
42
46
|
$[4] = t3;
|
|
43
47
|
} else t3 = $[4];
|
|
44
48
|
const canClear = t3;
|
|
45
|
-
|
|
49
|
+
let t4;
|
|
50
|
+
if ($[5] !== ref) {
|
|
51
|
+
t4 = mergeRefs(ref, containerRef);
|
|
52
|
+
$[5] = ref;
|
|
53
|
+
$[6] = t4;
|
|
54
|
+
} else t4 = $[6];
|
|
55
|
+
const t5 = clsx(inputBaseCva({
|
|
46
56
|
variant,
|
|
47
57
|
as,
|
|
48
58
|
...props
|
|
49
59
|
}), "group/date-picker-content relative min-w-input-width-min-width", "flex items-center justify-between gap-input-gap-input-text-to-elements", className);
|
|
50
|
-
const
|
|
51
|
-
const t6 = isDisabled || void 0;
|
|
60
|
+
const t6 = isHovered || void 0;
|
|
52
61
|
const t7 = isDisabled || void 0;
|
|
53
|
-
const t8 =
|
|
54
|
-
const t9 =
|
|
55
|
-
const t10 =
|
|
56
|
-
const t11 = isFocused
|
|
57
|
-
const t12 =
|
|
58
|
-
const t13 =
|
|
59
|
-
const t14 =
|
|
60
|
-
const t15 =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const t8 = isDisabled || void 0;
|
|
63
|
+
const t9 = isInvalid || void 0;
|
|
64
|
+
const t10 = state.value === null || void 0;
|
|
65
|
+
const t11 = isFocused || void 0;
|
|
66
|
+
const t12 = isFocused && isFocusVisible || void 0;
|
|
67
|
+
const t13 = state.value !== null || void 0;
|
|
68
|
+
const t14 = isDirty || void 0;
|
|
69
|
+
const t15 = isRequired || void 0;
|
|
70
|
+
const t16 = state.value !== null || void 0;
|
|
71
|
+
let t17;
|
|
72
|
+
if ($[7] !== as || $[8] !== inputSizeCva || $[9] !== size) {
|
|
73
|
+
t17 = clsx(inputSizeCva({
|
|
64
74
|
size,
|
|
65
75
|
as
|
|
66
76
|
}), "flex w-full items-center gap-input-gap-input-text-to-elements pr-0!");
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
} else
|
|
72
|
-
let
|
|
73
|
-
if ($[
|
|
74
|
-
|
|
77
|
+
$[7] = as;
|
|
78
|
+
$[8] = inputSizeCva;
|
|
79
|
+
$[9] = size;
|
|
80
|
+
$[10] = t17;
|
|
81
|
+
} else t17 = $[10];
|
|
82
|
+
let t18;
|
|
83
|
+
if ($[11] !== disableManualEntry || $[12] !== onPress) {
|
|
84
|
+
t18 = disableManualEntry && /* @__PURE__ */ jsx(Button, {
|
|
75
85
|
onPress,
|
|
76
86
|
className: "absolute inset-0 z-base"
|
|
77
87
|
});
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
} else
|
|
82
|
-
let
|
|
83
|
-
if ($[
|
|
84
|
-
|
|
88
|
+
$[11] = disableManualEntry;
|
|
89
|
+
$[12] = onPress;
|
|
90
|
+
$[13] = t18;
|
|
91
|
+
} else t18 = $[13];
|
|
92
|
+
let t19;
|
|
93
|
+
if ($[14] !== as || $[15] !== headerProps) {
|
|
94
|
+
t19 = as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
85
95
|
as,
|
|
86
96
|
...headerProps
|
|
87
97
|
});
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
} else
|
|
92
|
-
let
|
|
93
|
-
if ($[
|
|
94
|
-
|
|
98
|
+
$[14] = as;
|
|
99
|
+
$[15] = headerProps;
|
|
100
|
+
$[16] = t19;
|
|
101
|
+
} else t19 = $[16];
|
|
102
|
+
let t20;
|
|
103
|
+
if ($[17] !== disableManualEntry || $[18] !== fieldProps || $[19] !== hidePlaceholder || $[20] !== isDisabled || $[21] !== placeholder || $[22] !== state) {
|
|
104
|
+
t20 = /* @__PURE__ */ jsx("div", { children: disableManualEntry && placeholder && !state.value ? /* @__PURE__ */ jsx(Typography, {
|
|
95
105
|
size: "label-1",
|
|
96
106
|
className: "text-text-default-3",
|
|
97
107
|
children: placeholder
|
|
@@ -101,44 +111,44 @@ var TimePickerInput = (t0) => {
|
|
|
101
111
|
isDisabled,
|
|
102
112
|
hidePlaceholder
|
|
103
113
|
}) });
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
} else
|
|
112
|
-
let
|
|
113
|
-
if ($[
|
|
114
|
-
|
|
115
|
-
className:
|
|
114
|
+
$[17] = disableManualEntry;
|
|
115
|
+
$[18] = fieldProps;
|
|
116
|
+
$[19] = hidePlaceholder;
|
|
117
|
+
$[20] = isDisabled;
|
|
118
|
+
$[21] = placeholder;
|
|
119
|
+
$[22] = state;
|
|
120
|
+
$[23] = t20;
|
|
121
|
+
} else t20 = $[23];
|
|
122
|
+
let t21;
|
|
123
|
+
if ($[24] !== t17 || $[25] !== t18 || $[26] !== t19 || $[27] !== t20) {
|
|
124
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
125
|
+
className: t17,
|
|
116
126
|
children: [
|
|
117
|
-
t17,
|
|
118
127
|
t18,
|
|
119
|
-
t19
|
|
128
|
+
t19,
|
|
129
|
+
t20
|
|
120
130
|
]
|
|
121
131
|
});
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
} else
|
|
128
|
-
let
|
|
129
|
-
if ($[
|
|
130
|
-
|
|
132
|
+
$[24] = t17;
|
|
133
|
+
$[25] = t18;
|
|
134
|
+
$[26] = t19;
|
|
135
|
+
$[27] = t20;
|
|
136
|
+
$[28] = t21;
|
|
137
|
+
} else t21 = $[28];
|
|
138
|
+
let t22;
|
|
139
|
+
if ($[29] !== as || $[30] !== inputSizeCva || $[31] !== size) {
|
|
140
|
+
t22 = clsx(inputSizeCva({
|
|
131
141
|
size,
|
|
132
142
|
as
|
|
133
143
|
}), "flex items-center gap-input-gap-trailing-elements py-0! pl-0!");
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
} else
|
|
139
|
-
let
|
|
140
|
-
if ($[
|
|
141
|
-
|
|
144
|
+
$[29] = as;
|
|
145
|
+
$[30] = inputSizeCva;
|
|
146
|
+
$[31] = size;
|
|
147
|
+
$[32] = t22;
|
|
148
|
+
} else t22 = $[32];
|
|
149
|
+
let t23;
|
|
150
|
+
if ($[33] !== canClear || $[34] !== fieldProps || $[35] !== fireBlurOnChange || $[36] !== isClearable || $[37] !== onClear || $[38] !== state) {
|
|
151
|
+
t23 = isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
142
152
|
onClear: () => {
|
|
143
153
|
state.setValue(null);
|
|
144
154
|
onClear?.();
|
|
@@ -146,17 +156,17 @@ var TimePickerInput = (t0) => {
|
|
|
146
156
|
},
|
|
147
157
|
show: canClear
|
|
148
158
|
});
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
} else
|
|
157
|
-
let
|
|
158
|
-
if ($[
|
|
159
|
-
|
|
159
|
+
$[33] = canClear;
|
|
160
|
+
$[34] = fieldProps;
|
|
161
|
+
$[35] = fireBlurOnChange;
|
|
162
|
+
$[36] = isClearable;
|
|
163
|
+
$[37] = onClear;
|
|
164
|
+
$[38] = state;
|
|
165
|
+
$[39] = t23;
|
|
166
|
+
} else t23 = $[39];
|
|
167
|
+
let t24;
|
|
168
|
+
if ($[40] !== disableDropdown || $[41] !== disableManualEntry || $[42] !== isDisabled || $[43] !== onPress || $[44] !== uiConfig) {
|
|
169
|
+
t24 = (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
160
170
|
label: "",
|
|
161
171
|
color: "secondary",
|
|
162
172
|
onPress,
|
|
@@ -165,68 +175,68 @@ var TimePickerInput = (t0) => {
|
|
|
165
175
|
className: "border-0!",
|
|
166
176
|
"data-static-press-action": ""
|
|
167
177
|
});
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
} else
|
|
175
|
-
let t24;
|
|
176
|
-
if ($[44] !== t21 || $[45] !== t22 || $[46] !== t23) {
|
|
177
|
-
t24 = /* @__PURE__ */ jsxs("div", {
|
|
178
|
-
className: t21,
|
|
179
|
-
children: [t22, t23]
|
|
180
|
-
});
|
|
181
|
-
$[44] = t21;
|
|
182
|
-
$[45] = t22;
|
|
183
|
-
$[46] = t23;
|
|
184
|
-
$[47] = t24;
|
|
185
|
-
} else t24 = $[47];
|
|
178
|
+
$[40] = disableDropdown;
|
|
179
|
+
$[41] = disableManualEntry;
|
|
180
|
+
$[42] = isDisabled;
|
|
181
|
+
$[43] = onPress;
|
|
182
|
+
$[44] = uiConfig;
|
|
183
|
+
$[45] = t24;
|
|
184
|
+
} else t24 = $[45];
|
|
186
185
|
let t25;
|
|
187
|
-
if ($[
|
|
186
|
+
if ($[46] !== t22 || $[47] !== t23 || $[48] !== t24) {
|
|
188
187
|
t25 = /* @__PURE__ */ jsxs("div", {
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
className: t22,
|
|
189
|
+
children: [t23, t24]
|
|
190
|
+
});
|
|
191
|
+
$[46] = t22;
|
|
192
|
+
$[47] = t23;
|
|
193
|
+
$[48] = t24;
|
|
194
|
+
$[49] = t25;
|
|
195
|
+
} else t25 = $[49];
|
|
196
|
+
let t26;
|
|
197
|
+
if ($[50] !== fieldProps || $[51] !== focusWithinProps || $[52] !== hoverProps || $[53] !== t10 || $[54] !== t11 || $[55] !== t12 || $[56] !== t13 || $[57] !== t14 || $[58] !== t15 || $[59] !== t16 || $[60] !== t21 || $[61] !== t25 || $[62] !== t4 || $[63] !== t5 || $[64] !== t6 || $[65] !== t7 || $[66] !== t8 || $[67] !== t9) {
|
|
198
|
+
t26 = /* @__PURE__ */ jsxs("div", {
|
|
199
|
+
ref: t4,
|
|
200
|
+
className: t5,
|
|
191
201
|
"data-rac": "",
|
|
192
202
|
"data-datetime-input": "",
|
|
193
|
-
"data-hovered":
|
|
194
|
-
"data-disabled":
|
|
195
|
-
"data-is-disabled":
|
|
196
|
-
"data-invalid":
|
|
197
|
-
"data-is-empty":
|
|
198
|
-
"data-focus-within":
|
|
199
|
-
"data-focus-visible":
|
|
200
|
-
"data-has-selection":
|
|
201
|
-
"data-is-dirty":
|
|
202
|
-
"data-is-required":
|
|
203
|
-
"data-is-filled":
|
|
203
|
+
"data-hovered": t6,
|
|
204
|
+
"data-disabled": t7,
|
|
205
|
+
"data-is-disabled": t8,
|
|
206
|
+
"data-invalid": t9,
|
|
207
|
+
"data-is-empty": t10,
|
|
208
|
+
"data-focus-within": t11,
|
|
209
|
+
"data-focus-visible": t12,
|
|
210
|
+
"data-has-selection": t13,
|
|
211
|
+
"data-is-dirty": t14,
|
|
212
|
+
"data-is-required": t15,
|
|
213
|
+
"data-is-filled": t16,
|
|
204
214
|
...fieldProps,
|
|
205
215
|
...focusWithinProps,
|
|
206
216
|
...hoverProps,
|
|
207
|
-
children: [
|
|
217
|
+
children: [t21, t25]
|
|
208
218
|
});
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
} else
|
|
229
|
-
return
|
|
219
|
+
$[50] = fieldProps;
|
|
220
|
+
$[51] = focusWithinProps;
|
|
221
|
+
$[52] = hoverProps;
|
|
222
|
+
$[53] = t10;
|
|
223
|
+
$[54] = t11;
|
|
224
|
+
$[55] = t12;
|
|
225
|
+
$[56] = t13;
|
|
226
|
+
$[57] = t14;
|
|
227
|
+
$[58] = t15;
|
|
228
|
+
$[59] = t16;
|
|
229
|
+
$[60] = t21;
|
|
230
|
+
$[61] = t25;
|
|
231
|
+
$[62] = t4;
|
|
232
|
+
$[63] = t5;
|
|
233
|
+
$[64] = t6;
|
|
234
|
+
$[65] = t7;
|
|
235
|
+
$[66] = t8;
|
|
236
|
+
$[67] = t9;
|
|
237
|
+
$[68] = t26;
|
|
238
|
+
} else t26 = $[68];
|
|
239
|
+
return t26;
|
|
230
240
|
};
|
|
231
241
|
function _temp(segment) {
|
|
232
242
|
return segment.type !== "literal" && segment.isPlaceholder === false;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { useLayoutEffect } from "react";
|
|
3
|
+
import { isFirefox } from "@react-aria/utils";
|
|
4
|
+
//#region src/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.ts
|
|
5
|
+
var isEditableElement = (element) => element instanceof HTMLElement && (element.matches("input, textarea") || element.isContentEditable);
|
|
6
|
+
var useFirefoxDateSegmentSelectionGuard = (containerRef) => {
|
|
7
|
+
const $ = c(3);
|
|
8
|
+
let t0;
|
|
9
|
+
let t1;
|
|
10
|
+
if ($[0] !== containerRef) {
|
|
11
|
+
t0 = () => {
|
|
12
|
+
const container = containerRef.current;
|
|
13
|
+
if (!container || !isFirefox()) return;
|
|
14
|
+
const onSelectionChange = (event) => {
|
|
15
|
+
const activeElement = document.activeElement;
|
|
16
|
+
const selection = window.getSelection();
|
|
17
|
+
if (isEditableElement(activeElement) && !container.contains(activeElement) && selection?.anchorNode && container.contains(selection.anchorNode)) event.stopImmediatePropagation();
|
|
18
|
+
};
|
|
19
|
+
document.addEventListener("selectionchange", onSelectionChange, true);
|
|
20
|
+
return () => document.removeEventListener("selectionchange", onSelectionChange, true);
|
|
21
|
+
};
|
|
22
|
+
t1 = [containerRef];
|
|
23
|
+
$[0] = containerRef;
|
|
24
|
+
$[1] = t0;
|
|
25
|
+
$[2] = t1;
|
|
26
|
+
} else {
|
|
27
|
+
t0 = $[1];
|
|
28
|
+
t1 = $[2];
|
|
29
|
+
}
|
|
30
|
+
useLayoutEffect(t0, t1);
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { useFirefoxDateSegmentSelectionGuard };
|
|
@@ -2,6 +2,7 @@ import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
|
2
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
3
|
import { FormField } from "../../FormField/FormField.js";
|
|
4
4
|
import { inputBaseDefinition } from "../../shared/input.cva.js";
|
|
5
|
+
import { IntlUtils } from "../../../../utils/intl.utils.js";
|
|
5
6
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
6
7
|
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
7
8
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
@@ -338,7 +339,7 @@ var NumberInputInner = (t0) => {
|
|
|
338
339
|
if (!renderInput) {
|
|
339
340
|
const staticValue = props.value ?? props.defaultValue;
|
|
340
341
|
const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
|
|
341
|
-
const displayValue = getStaticNumberDisplayValue(staticValue,
|
|
342
|
+
const displayValue = getStaticNumberDisplayValue(staticValue, IntlUtils.getNumberFormatter(locale, formatOptions)) ?? "";
|
|
342
343
|
const hasValue = displayValue !== "";
|
|
343
344
|
const as = props.as ?? ui.input.as;
|
|
344
345
|
let isDisabled = !!props.isDisabled;
|
|
@@ -2,6 +2,7 @@ import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
|
2
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
3
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
4
4
|
import { inputBaseDefinition, inputSizeDefinition } from "../../shared/input.cva.js";
|
|
5
|
+
import { IntlUtils } from "../../../../utils/intl.utils.js";
|
|
5
6
|
import { InputClear } from "../../shared/InputClear.js";
|
|
6
7
|
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
7
8
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
@@ -381,7 +382,7 @@ var NumberRangeInputInner = (t0) => {
|
|
|
381
382
|
if (!renderInput) {
|
|
382
383
|
const staticValue = normalizeRangeValue(props.value, props.minValue, props.maxValue);
|
|
383
384
|
const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
|
|
384
|
-
const formatter =
|
|
385
|
+
const formatter = IntlUtils.getNumberFormatter(locale, formatOptions);
|
|
385
386
|
const minDisplay = getStaticNumberDisplayValue(staticValue.min, formatter);
|
|
386
387
|
const maxDisplay = getStaticNumberDisplayValue(staticValue.max, formatter);
|
|
387
388
|
const hasValue = minDisplay !== null || maxDisplay !== null;
|
|
@@ -8,7 +8,7 @@ import { useState } from "react";
|
|
|
8
8
|
import { mergeRefs } from "@react-aria/utils";
|
|
9
9
|
import { Controller } from "react-hook-form";
|
|
10
10
|
//#region src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx
|
|
11
|
-
var
|
|
11
|
+
var LoadedQueryAutocompleteContent = ({ query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds, isQueryEnabledInitially = false, leadingContent, ...props }) => {
|
|
12
12
|
"use no memo";
|
|
13
13
|
const ui = UIConfig.useConfig();
|
|
14
14
|
const [search, setSearch] = useState("");
|
|
@@ -20,6 +20,8 @@ var QueryAutocompleteContent = ({ query, queryParams, queryOptions, queryMap, re
|
|
|
20
20
|
mapInitialToSelectItem: props.mapInitialToSelectItem
|
|
21
21
|
});
|
|
22
22
|
const shouldEnableInitialQuery = selectedIdsToResolve.count > 0;
|
|
23
|
+
const isInitialQueryDisabled = props.isInitialQueryDisabled ?? ui.queryAutocomplete?.isInitialQueryDisabled;
|
|
24
|
+
const shouldDisableInitialQuery = !isQueryEnabledInitially && !shouldEnableInitialQuery && (selectedIdsToResolve.isResolvedByInitialSelection || isInitialQueryDisabled);
|
|
23
25
|
const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
|
|
24
26
|
query,
|
|
25
27
|
queryParams,
|
|
@@ -27,7 +29,7 @@ var QueryAutocompleteContent = ({ query, queryParams, queryOptions, queryMap, re
|
|
|
27
29
|
mapItems: (data) => getQueryItems(data, queryMap),
|
|
28
30
|
resolveSelectedItemsWithIds: resolveSelectedItemsWithIds ?? ui.queryAutocomplete?.resolveSelectedItemsWithIds,
|
|
29
31
|
search,
|
|
30
|
-
initialQueryState:
|
|
32
|
+
initialQueryState: shouldDisableInitialQuery,
|
|
31
33
|
selectedIdsToResolve: selectedIdsToResolve.items
|
|
32
34
|
});
|
|
33
35
|
const handleChange = (value_0) => {
|
|
@@ -55,6 +57,58 @@ var QueryAutocompleteContent = ({ query, queryParams, queryOptions, queryMap, re
|
|
|
55
57
|
onLoadMore: fetchNextPage
|
|
56
58
|
});
|
|
57
59
|
};
|
|
60
|
+
var QueryAutocompleteContent = (props) => {
|
|
61
|
+
const $ = c(9);
|
|
62
|
+
const [isQueryMounted, setIsQueryMounted] = useState(false);
|
|
63
|
+
const value = "value" in props ? props.value : void 0;
|
|
64
|
+
if (!getSelectionIdsToResolve({
|
|
65
|
+
initialSelection: props.initialSelection,
|
|
66
|
+
value,
|
|
67
|
+
mapInitialToSelectItem: props.mapInitialToSelectItem
|
|
68
|
+
}).isResolvedByInitialSelection || isQueryMounted) {
|
|
69
|
+
let t0;
|
|
70
|
+
if ($[0] !== isQueryMounted || $[1] !== props) {
|
|
71
|
+
t0 = /* @__PURE__ */ jsx(LoadedQueryAutocompleteContent, {
|
|
72
|
+
...props,
|
|
73
|
+
isQueryEnabledInitially: isQueryMounted
|
|
74
|
+
});
|
|
75
|
+
$[0] = isQueryMounted;
|
|
76
|
+
$[1] = props;
|
|
77
|
+
$[2] = t0;
|
|
78
|
+
} else t0 = $[2];
|
|
79
|
+
return t0;
|
|
80
|
+
}
|
|
81
|
+
let autocompleteProps;
|
|
82
|
+
if ($[3] !== props) {
|
|
83
|
+
const { query: _, queryParams: _queryParams, queryOptions: _queryOptions, queryMap: _queryMap, resolveSelectedItemsWithIds: _resolveSelectedItemsWithIds, isInitialQueryDisabled: _isInitialQueryDisabled, ...t0 } = props;
|
|
84
|
+
autocompleteProps = t0;
|
|
85
|
+
$[3] = props;
|
|
86
|
+
$[4] = autocompleteProps;
|
|
87
|
+
} else autocompleteProps = $[4];
|
|
88
|
+
let t0;
|
|
89
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
90
|
+
t0 = () => setIsQueryMounted(true);
|
|
91
|
+
$[5] = t0;
|
|
92
|
+
} else t0 = $[5];
|
|
93
|
+
const mountQuery = t0;
|
|
94
|
+
let t1;
|
|
95
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
96
|
+
t1 = [];
|
|
97
|
+
$[6] = t1;
|
|
98
|
+
} else t1 = $[6];
|
|
99
|
+
let t2;
|
|
100
|
+
if ($[7] !== autocompleteProps) {
|
|
101
|
+
t2 = /* @__PURE__ */ jsx(Autocomplete, {
|
|
102
|
+
...autocompleteProps,
|
|
103
|
+
items: t1,
|
|
104
|
+
onMouseEnter: mountQuery,
|
|
105
|
+
onFocusCapture: mountQuery
|
|
106
|
+
});
|
|
107
|
+
$[7] = autocompleteProps;
|
|
108
|
+
$[8] = t2;
|
|
109
|
+
} else t2 = $[8];
|
|
110
|
+
return t2;
|
|
111
|
+
};
|
|
58
112
|
var QueryAutocomplete = (props) => {
|
|
59
113
|
const $ = c(16);
|
|
60
114
|
if ("formControl" in props && props.formControl) {
|
|
@@ -8,9 +8,10 @@ import { useState } from "react";
|
|
|
8
8
|
import { mergeRefs } from "@react-aria/utils";
|
|
9
9
|
import { Controller } from "react-hook-form";
|
|
10
10
|
//#region src/components/inputs/Selection/Select/QuerySelect.tsx
|
|
11
|
-
var
|
|
11
|
+
var LoadedQuerySelectContent = (t0) => {
|
|
12
12
|
const $ = c(31);
|
|
13
|
-
const { query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds, ...props } = t0;
|
|
13
|
+
const { query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds, isQueryEnabledInitially: t1, ...props } = t0;
|
|
14
|
+
const isQueryEnabledInitially = t1 === void 0 ? false : t1;
|
|
14
15
|
const ui = UIConfig.useConfig();
|
|
15
16
|
const [search, setSearch] = useState("");
|
|
16
17
|
const isSearchable = props.isSearchable ?? ui.select.isSearchable;
|
|
@@ -21,32 +22,33 @@ var QuerySelectContent = (t0) => {
|
|
|
21
22
|
mapInitialToSelectItem: props.mapInitialToSelectItem
|
|
22
23
|
});
|
|
23
24
|
const shouldEnableInitialQuery = selectedIdsToResolve.count > 0;
|
|
24
|
-
|
|
25
|
+
const isInitialQueryDisabled = props.isInitialQueryDisabled ?? ui.querySelect?.isInitialQueryDisabled;
|
|
26
|
+
const shouldDisableInitialQuery = !isQueryEnabledInitially && !shouldEnableInitialQuery && (selectedIdsToResolve.isResolvedByInitialSelection || isInitialQueryDisabled);
|
|
27
|
+
let t2;
|
|
25
28
|
if ($[0] !== queryMap) {
|
|
26
|
-
|
|
29
|
+
t2 = (data) => getQueryItems(data, queryMap);
|
|
27
30
|
$[0] = queryMap;
|
|
28
|
-
$[1] =
|
|
29
|
-
} else
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const t4 = shouldEnableInitialQuery ? false : props.isInitialQueryDisabled ?? ui.querySelect?.isInitialQueryDisabled;
|
|
31
|
+
$[1] = t2;
|
|
32
|
+
} else t2 = $[1];
|
|
33
|
+
const t3 = resolveSelectedItemsWithIds ?? ui.querySelect?.resolveSelectedItemsWithIds;
|
|
34
|
+
const t4 = isSearchable ? search : void 0;
|
|
33
35
|
let t5;
|
|
34
|
-
if ($[2] !== query || $[3] !== queryOptions || $[4] !== queryParams || $[5] !== selectedIdsToResolve.items || $[6] !==
|
|
36
|
+
if ($[2] !== query || $[3] !== queryOptions || $[4] !== queryParams || $[5] !== selectedIdsToResolve.items || $[6] !== shouldDisableInitialQuery || $[7] !== t2 || $[8] !== t3 || $[9] !== t4) {
|
|
35
37
|
t5 = {
|
|
36
38
|
query,
|
|
37
39
|
queryParams,
|
|
38
40
|
queryOptions,
|
|
39
|
-
mapItems:
|
|
40
|
-
resolveSelectedItemsWithIds:
|
|
41
|
-
search:
|
|
42
|
-
initialQueryState:
|
|
41
|
+
mapItems: t2,
|
|
42
|
+
resolveSelectedItemsWithIds: t3,
|
|
43
|
+
search: t4,
|
|
44
|
+
initialQueryState: shouldDisableInitialQuery,
|
|
43
45
|
selectedIdsToResolve: selectedIdsToResolve.items
|
|
44
46
|
};
|
|
45
47
|
$[2] = query;
|
|
46
48
|
$[3] = queryOptions;
|
|
47
49
|
$[4] = queryParams;
|
|
48
50
|
$[5] = selectedIdsToResolve.items;
|
|
49
|
-
$[6] =
|
|
51
|
+
$[6] = shouldDisableInitialQuery;
|
|
50
52
|
$[7] = t2;
|
|
51
53
|
$[8] = t3;
|
|
52
54
|
$[9] = t4;
|
|
@@ -117,6 +119,58 @@ var QuerySelectContent = (t0) => {
|
|
|
117
119
|
} else t9 = $[30];
|
|
118
120
|
return t9;
|
|
119
121
|
};
|
|
122
|
+
var QuerySelectContent = (props) => {
|
|
123
|
+
const $ = c(9);
|
|
124
|
+
const [isQueryMounted, setIsQueryMounted] = useState(false);
|
|
125
|
+
const value = "value" in props ? props.value : void 0;
|
|
126
|
+
if (!getSelectionIdsToResolve({
|
|
127
|
+
initialSelection: props.initialSelection,
|
|
128
|
+
value,
|
|
129
|
+
mapInitialToSelectItem: props.mapInitialToSelectItem
|
|
130
|
+
}).isResolvedByInitialSelection || isQueryMounted) {
|
|
131
|
+
let t0;
|
|
132
|
+
if ($[0] !== isQueryMounted || $[1] !== props) {
|
|
133
|
+
t0 = /* @__PURE__ */ jsx(LoadedQuerySelectContent, {
|
|
134
|
+
...props,
|
|
135
|
+
isQueryEnabledInitially: isQueryMounted
|
|
136
|
+
});
|
|
137
|
+
$[0] = isQueryMounted;
|
|
138
|
+
$[1] = props;
|
|
139
|
+
$[2] = t0;
|
|
140
|
+
} else t0 = $[2];
|
|
141
|
+
return t0;
|
|
142
|
+
}
|
|
143
|
+
let selectProps;
|
|
144
|
+
if ($[3] !== props) {
|
|
145
|
+
const { query: _, queryParams: _queryParams, queryOptions: _queryOptions, queryMap: _queryMap, resolveSelectedItemsWithIds: _resolveSelectedItemsWithIds, isInitialQueryDisabled: _isInitialQueryDisabled, ...t0 } = props;
|
|
146
|
+
selectProps = t0;
|
|
147
|
+
$[3] = props;
|
|
148
|
+
$[4] = selectProps;
|
|
149
|
+
} else selectProps = $[4];
|
|
150
|
+
let t0;
|
|
151
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
152
|
+
t0 = () => setIsQueryMounted(true);
|
|
153
|
+
$[5] = t0;
|
|
154
|
+
} else t0 = $[5];
|
|
155
|
+
const mountQuery = t0;
|
|
156
|
+
let t1;
|
|
157
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
158
|
+
t1 = [];
|
|
159
|
+
$[6] = t1;
|
|
160
|
+
} else t1 = $[6];
|
|
161
|
+
let t2;
|
|
162
|
+
if ($[7] !== selectProps) {
|
|
163
|
+
t2 = /* @__PURE__ */ jsx(Select, {
|
|
164
|
+
...selectProps,
|
|
165
|
+
items: t1,
|
|
166
|
+
onMouseEnter: mountQuery,
|
|
167
|
+
onFocusCapture: mountQuery
|
|
168
|
+
});
|
|
169
|
+
$[7] = selectProps;
|
|
170
|
+
$[8] = t2;
|
|
171
|
+
} else t2 = $[8];
|
|
172
|
+
return t2;
|
|
173
|
+
};
|
|
120
174
|
var QuerySelect = (props) => {
|
|
121
175
|
const $ = c(16);
|
|
122
176
|
if ("formControl" in props && props.formControl) {
|
|
@@ -9,6 +9,7 @@ export declare const getSelectionIdsToResolve: <TInitialSelectItem, TKey extends
|
|
|
9
9
|
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
10
10
|
}) => {
|
|
11
11
|
count: number;
|
|
12
|
+
isResolvedByInitialSelection: boolean;
|
|
12
13
|
items: TKey[];
|
|
13
14
|
};
|
|
14
15
|
export declare const getQueryItems: <TQueryFn extends QueryFn, TKey extends Key = Key>(data: QueryDataType<TQueryFn> | undefined, queryMap?: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[]) => SelectItem<TKey>[];
|
|
@@ -26,6 +26,7 @@ var getSelectionIdsToResolve = ({ initialSelection, value, mapInitialToSelectIte
|
|
|
26
26
|
const items = Array.from(new Set([...missingLabelInitialSelectionIds, ...values.filter((id) => !labeledInitialSelectionIds.has(id))]));
|
|
27
27
|
return {
|
|
28
28
|
count: items.length,
|
|
29
|
+
isResolvedByInitialSelection: values.length > 0 && values.every((id) => labeledInitialSelectionIds.has(id)),
|
|
29
30
|
items
|
|
30
31
|
};
|
|
31
32
|
};
|