@povio/ui 2.2.9-rc.3 → 2.2.9-rc.30
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.d.ts +2 -1
- package/dist/components/buttons/Button/Button.js +41 -32
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +2 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +6 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +8 -3
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +88 -6
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +7 -2
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +91 -6
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +8 -2
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +91 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +73 -4
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +23 -6
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +3 -3
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +3 -10
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +65 -55
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +19 -6
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +4 -2
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.js +9 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +35 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
- package/dist/components/inputs/File/FileUpload.js +1 -0
- package/dist/components/inputs/File/shared/InputUploadContent.js +1 -0
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +85 -7
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +38 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +318 -0
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +88 -7
- package/dist/components/inputs/Input/shared/InputContent.js +7 -6
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/InputItem.d.ts +15 -18
- package/dist/components/inputs/Inputs/InputItem.js +2 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.js +17 -9
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +3 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +2 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +104 -6
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +15 -10
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -19
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +3 -4
- package/dist/components/inputs/Selection/Select/QuerySelect.js +8 -35
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +119 -4
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +4 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +3 -2
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +8 -4
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +13 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +3 -3
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -3
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +27 -4
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +68 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +171 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +6 -1
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +3 -4
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +13 -1
- package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
- package/dist/components/inputs/shared/StaticInput.js +104 -0
- package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
- package/dist/components/inputs/shared/input.cva.d.ts +10 -0
- package/dist/components/inputs/shared/input.cva.js +19 -1
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/config/uiConfig.context.d.ts +8 -2
- package/dist/config/uiConfig.context.js +12 -1
- package/dist/config/uiStyle.context.d.ts +20 -3
- package/dist/helpers/dynamicInputs.d.ts +1 -1
- package/dist/helpers/dynamicInputs.js +3 -0
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +29 -10
- package/dist/hooks/useQueryAutocomplete.d.ts +5 -16
- package/dist/hooks/useQueryAutocomplete.js +13 -3
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -2
- package/dist/utils/date-time.utils.d.ts +30 -9
- package/dist/utils/date-time.utils.js +113 -1
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
|
+
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
|
+
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
4
|
+
import { InputClear } from "../../shared/InputClear.js";
|
|
5
|
+
import { inputBase, inputSize } from "../../shared/input.cva.js";
|
|
6
|
+
import { FormField } from "../../FormField/FormField.js";
|
|
7
|
+
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
8
|
+
import { getStaticNumberDisplayValue } from "../shared/numberStatic.utils.js";
|
|
9
|
+
import { StaticInput } from "../../shared/StaticInput.js";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { clsx } from "clsx";
|
|
12
|
+
import { useEffect, useRef, useState } from "react";
|
|
13
|
+
import { Input, useLocale } from "react-aria-components";
|
|
14
|
+
import { useFocusVisible, useFocusWithin, useHover, useNumberField } from "react-aria";
|
|
15
|
+
import { mergeRefs } from "@react-aria/utils";
|
|
16
|
+
import { Controller, useWatch } from "react-hook-form";
|
|
17
|
+
import { useNumberFieldState } from "react-stately";
|
|
18
|
+
//#region src/components/inputs/Input/NumberRangeInput/NumberRangeInput.tsx
|
|
19
|
+
var EMPTY_RANGE = {
|
|
20
|
+
min: null,
|
|
21
|
+
max: null
|
|
22
|
+
};
|
|
23
|
+
var normalizeRangeValue = (value, minValue, maxValue) => {
|
|
24
|
+
if (value) return value;
|
|
25
|
+
return {
|
|
26
|
+
min: minValue ?? null,
|
|
27
|
+
max: maxValue ?? null
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
var NumberRangeField = ({ label, value, placeholder, isDisabled, isInvalid, isRequired, formatOptions, hideInnerLabels, autoFocusOnMount, isClearable, className, onChange, onClear, onBlur, ...rest }) => {
|
|
31
|
+
const ui = UIConfig.useConfig();
|
|
32
|
+
const { locale } = useLocale();
|
|
33
|
+
const { isFocusVisible } = useFocusVisible();
|
|
34
|
+
const inputRef = useRef(null);
|
|
35
|
+
const numberFieldRef = useRef(null);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!autoFocusOnMount || isDisabled) return;
|
|
38
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
39
|
+
}, [autoFocusOnMount, isDisabled]);
|
|
40
|
+
const numberProps = {
|
|
41
|
+
...rest,
|
|
42
|
+
label,
|
|
43
|
+
value: value ?? NaN,
|
|
44
|
+
placeholder,
|
|
45
|
+
isDisabled,
|
|
46
|
+
isInvalid,
|
|
47
|
+
isRequired,
|
|
48
|
+
onChange,
|
|
49
|
+
onBlur: (e) => onBlur?.({ target: e.target }),
|
|
50
|
+
locale,
|
|
51
|
+
formatOptions: formatOptions ?? ui.numberInput.formatOptions
|
|
52
|
+
};
|
|
53
|
+
const { labelProps, inputProps } = useNumberField(numberProps, useNumberFieldState(numberProps), numberFieldRef);
|
|
54
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: "min-w-0 flex-1",
|
|
56
|
+
children: [/* @__PURE__ */ jsx(FormFieldLabel, {
|
|
57
|
+
label,
|
|
58
|
+
labelProps,
|
|
59
|
+
isRequired,
|
|
60
|
+
isDisabled,
|
|
61
|
+
className: clsx(hideInnerLabels && "sr-only")
|
|
62
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
63
|
+
className: "flex items-center gap-input-gap-trailing-elements",
|
|
64
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
65
|
+
...inputProps,
|
|
66
|
+
ref: mergeRefs(inputRef, numberFieldRef),
|
|
67
|
+
placeholder: inputProps.placeholder,
|
|
68
|
+
className: clsx("w-full min-w-0 bg-transparent outline-none", className),
|
|
69
|
+
onFocus: (e) => {
|
|
70
|
+
inputProps.onFocus?.(e);
|
|
71
|
+
if (isFocusVisible) e.target.select();
|
|
72
|
+
}
|
|
73
|
+
}), isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
74
|
+
onClear,
|
|
75
|
+
show: value !== null && !isDisabled
|
|
76
|
+
})]
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
var NumberRangeInputBase = (props) => {
|
|
81
|
+
const ui = UIConfig.useConfig();
|
|
82
|
+
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
83
|
+
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
84
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, inputClassName, minInputClassName, maxInputClassName, value, minValue, maxValue, minPlaceholder = "Min", maxPlaceholder = "Max", minLabel = "Minimum", maxLabel = "Maximum", invalidRangeError = "Minimum cannot be greater than maximum", hideInnerLabels = true, isDirty, autoFocusOnMount, onChange, onMinChange, onMaxChange, onBlur, isClearable: isClearableProps, as: asProp, variant: variantProps, size: sizeProps, hideLabel: hideLabelProps, ...rest } = props;
|
|
85
|
+
const isClearable = isClearableProps ?? ui.input.isClearable;
|
|
86
|
+
const as = asProp ?? ui.input.as;
|
|
87
|
+
const variant = variantProps ?? ui.input.variant;
|
|
88
|
+
const size = sizeProps ?? ui.input.size;
|
|
89
|
+
const hideLabel = hideLabelProps ?? ui.input.hideLabel;
|
|
90
|
+
const rangeValue = normalizeRangeValue(value, minValue, maxValue);
|
|
91
|
+
const isEmpty = rangeValue.min === null && rangeValue.max === null;
|
|
92
|
+
const rangeError = rangeValue.min !== null && rangeValue.max !== null && rangeValue.min > rangeValue.max ? invalidRangeError : void 0;
|
|
93
|
+
const effectiveError = error || rangeError;
|
|
94
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
95
|
+
const { isFocusVisible } = useFocusVisible();
|
|
96
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
97
|
+
const { focusWithinProps } = useFocusWithin({ onFocusWithinChange: setIsFocused });
|
|
98
|
+
const formFieldProps = {
|
|
99
|
+
error: effectiveError,
|
|
100
|
+
label,
|
|
101
|
+
tooltipText,
|
|
102
|
+
helperText,
|
|
103
|
+
isRequired,
|
|
104
|
+
rightContent,
|
|
105
|
+
isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
|
|
106
|
+
hideLabel,
|
|
107
|
+
isDisabled,
|
|
108
|
+
headerClassName,
|
|
109
|
+
errorClassName
|
|
110
|
+
};
|
|
111
|
+
const headerProps = {
|
|
112
|
+
label,
|
|
113
|
+
tooltipText,
|
|
114
|
+
helperText,
|
|
115
|
+
isRequired,
|
|
116
|
+
rightContent,
|
|
117
|
+
isHeaderHidden: hideLabel || isHeaderHidden,
|
|
118
|
+
isDisabled,
|
|
119
|
+
className: headerClassName
|
|
120
|
+
};
|
|
121
|
+
const updateRange = (side, nextValue) => {
|
|
122
|
+
const nextRange = {
|
|
123
|
+
...rangeValue,
|
|
124
|
+
[side]: nextValue
|
|
125
|
+
};
|
|
126
|
+
onChange?.(nextRange);
|
|
127
|
+
if (side === "min") onMinChange?.(nextValue);
|
|
128
|
+
else onMaxChange?.(nextValue);
|
|
129
|
+
};
|
|
130
|
+
const clearRangeSide = (side) => {
|
|
131
|
+
updateRange(side, null);
|
|
132
|
+
onBlur?.({ target: { value: "" } });
|
|
133
|
+
};
|
|
134
|
+
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
135
|
+
as,
|
|
136
|
+
error: effectiveError,
|
|
137
|
+
triggerTabIndex: as === "inline" ? -1 : void 0,
|
|
138
|
+
children: /* @__PURE__ */ jsx(FormField, {
|
|
139
|
+
...formFieldProps,
|
|
140
|
+
ref,
|
|
141
|
+
as,
|
|
142
|
+
className: clsx("group w-full", className),
|
|
143
|
+
tabIndex: as === "inline" ? -1 : void 0,
|
|
144
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
145
|
+
className: clsx(inputBaseCva({
|
|
146
|
+
variant,
|
|
147
|
+
as
|
|
148
|
+
}), "group/date-picker-content relative flex min-w-input-width-min-width items-center justify-between gap-2", inputClassName),
|
|
149
|
+
"data-rac": "",
|
|
150
|
+
"data-hovered": isHovered || void 0,
|
|
151
|
+
"data-disabled": isDisabled || void 0,
|
|
152
|
+
"data-is-disabled": isDisabled || void 0,
|
|
153
|
+
"data-invalid": !!effectiveError || void 0,
|
|
154
|
+
"data-is-empty": isEmpty || void 0,
|
|
155
|
+
"data-focus-within": isFocused || void 0,
|
|
156
|
+
"data-focus-visible": isFocused && isFocusVisible || void 0,
|
|
157
|
+
"data-has-selection": !isEmpty || void 0,
|
|
158
|
+
"data-is-dirty": isDirty || void 0,
|
|
159
|
+
"data-is-required": isRequired || void 0,
|
|
160
|
+
"data-is-filled": !isEmpty || void 0,
|
|
161
|
+
...focusWithinProps,
|
|
162
|
+
...hoverProps,
|
|
163
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
164
|
+
className: clsx("flex w-full items-center gap-input-gap-input-text-to-elements pr-0!", inputSizeCva({
|
|
165
|
+
size,
|
|
166
|
+
as
|
|
167
|
+
})),
|
|
168
|
+
children: [
|
|
169
|
+
as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
170
|
+
as,
|
|
171
|
+
...headerProps
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ jsx(NumberRangeField, {
|
|
174
|
+
...rest,
|
|
175
|
+
label: minLabel,
|
|
176
|
+
placeholder: minPlaceholder,
|
|
177
|
+
value: rangeValue.min,
|
|
178
|
+
onChange: (nextValue) => {
|
|
179
|
+
updateRange("min", nextValue);
|
|
180
|
+
},
|
|
181
|
+
onBlur,
|
|
182
|
+
isDisabled,
|
|
183
|
+
isInvalid: !!effectiveError,
|
|
184
|
+
isRequired,
|
|
185
|
+
hideInnerLabels,
|
|
186
|
+
autoFocusOnMount,
|
|
187
|
+
isClearable,
|
|
188
|
+
onClear: () => {
|
|
189
|
+
clearRangeSide("min");
|
|
190
|
+
},
|
|
191
|
+
className: minInputClassName
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ jsx("span", {
|
|
194
|
+
className: clsx("pointer-events-none shrink-0 select-none text-label-2 text-text-default-3", isDisabled && "text-interactive-text-secondary-disabled"),
|
|
195
|
+
children: "-"
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ jsx(NumberRangeField, {
|
|
198
|
+
...rest,
|
|
199
|
+
label: maxLabel,
|
|
200
|
+
placeholder: maxPlaceholder,
|
|
201
|
+
value: rangeValue.max,
|
|
202
|
+
onChange: (nextValue) => {
|
|
203
|
+
updateRange("max", nextValue);
|
|
204
|
+
},
|
|
205
|
+
onBlur,
|
|
206
|
+
isDisabled,
|
|
207
|
+
isInvalid: !!effectiveError,
|
|
208
|
+
isRequired,
|
|
209
|
+
hideInnerLabels,
|
|
210
|
+
isClearable,
|
|
211
|
+
onClear: () => {
|
|
212
|
+
clearRangeSide("max");
|
|
213
|
+
},
|
|
214
|
+
className: maxInputClassName
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
var NumberRangeInput = ({ renderStaticInput, ...props }) => {
|
|
223
|
+
const ui = UIConfig.useConfig();
|
|
224
|
+
const { locale } = useLocale();
|
|
225
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
226
|
+
const [shouldFocus, setShouldFocus] = useState(false);
|
|
227
|
+
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
228
|
+
control: props.formControl.control,
|
|
229
|
+
name: props.formControl.name
|
|
230
|
+
}) : props.value;
|
|
231
|
+
let isFormControlDisabled = false;
|
|
232
|
+
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
if (!renderInput || !shouldFocus) return;
|
|
235
|
+
setShouldFocus(false);
|
|
236
|
+
}, [renderInput, shouldFocus]);
|
|
237
|
+
if (!renderInput) {
|
|
238
|
+
const staticValue = normalizeRangeValue(watchedValue, props.minValue, props.maxValue);
|
|
239
|
+
const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
|
|
240
|
+
const formatter = new Intl.NumberFormat(locale, formatOptions);
|
|
241
|
+
const minDisplay = getStaticNumberDisplayValue(staticValue.min, formatter);
|
|
242
|
+
const maxDisplay = getStaticNumberDisplayValue(staticValue.max, formatter);
|
|
243
|
+
const hasValue = minDisplay !== null || maxDisplay !== null;
|
|
244
|
+
const displayValue = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
245
|
+
/* @__PURE__ */ jsx("span", {
|
|
246
|
+
className: clsx("w-full bg-transparent outline-none", minDisplay ? props.minInputClassName : "text-text-default-3"),
|
|
247
|
+
children: minDisplay ?? props.minPlaceholder ?? "Min"
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ jsx("span", {
|
|
250
|
+
className: "pointer-events-none shrink-0 select-none text-label-2 text-text-default-3",
|
|
251
|
+
children: "-"
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ jsx("span", {
|
|
254
|
+
className: clsx("w-full bg-transparent outline-none", maxDisplay ? props.maxInputClassName : "text-text-default-3"),
|
|
255
|
+
children: maxDisplay ?? props.maxPlaceholder ?? "Max"
|
|
256
|
+
})
|
|
257
|
+
] });
|
|
258
|
+
const rangeError = staticValue.min !== null && staticValue.max !== null && staticValue.min > staticValue.max ? props.invalidRangeError ?? "Minimum cannot be greater than maximum" : void 0;
|
|
259
|
+
const effectiveError = props.error || rangeError;
|
|
260
|
+
const as = props.as ?? ui.input.as;
|
|
261
|
+
const size = props.size ?? ui.input.size;
|
|
262
|
+
const variant = props.variant ?? ui.input.variant;
|
|
263
|
+
const hideLabel = props.hideLabel ?? ui.input.hideLabel;
|
|
264
|
+
const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
265
|
+
let isDisabled = !!props.isDisabled;
|
|
266
|
+
if (isFormControlDisabled) isDisabled = true;
|
|
267
|
+
return /* @__PURE__ */ jsx(StaticInput, {
|
|
268
|
+
...props,
|
|
269
|
+
error: effectiveError,
|
|
270
|
+
onInteract: (focus) => {
|
|
271
|
+
setShouldFocus(focus);
|
|
272
|
+
setRenderInput(true);
|
|
273
|
+
},
|
|
274
|
+
as,
|
|
275
|
+
size,
|
|
276
|
+
variant,
|
|
277
|
+
hideLabel,
|
|
278
|
+
isHeaderHidden,
|
|
279
|
+
isDisabled,
|
|
280
|
+
className: clsx("group w-full", as === "inline" && "h-full", props.className),
|
|
281
|
+
inputClassName: props.inputClassName,
|
|
282
|
+
displayValue,
|
|
283
|
+
dataAttributes: {
|
|
284
|
+
dataIsEmpty: !hasValue,
|
|
285
|
+
dataIsFilled: hasValue,
|
|
286
|
+
dataIsDirty: props.isDirty,
|
|
287
|
+
dataIsRequired: props.isRequired,
|
|
288
|
+
dataIsDisabled: isDisabled,
|
|
289
|
+
dataDisabled: isDisabled,
|
|
290
|
+
dataInvalid: !!effectiveError,
|
|
291
|
+
dataHasSelection: hasValue
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
if ("formControl" in props && props.formControl) {
|
|
296
|
+
const { formControl, ref, ...innerProps } = props;
|
|
297
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
298
|
+
control: formControl.control,
|
|
299
|
+
name: formControl.name,
|
|
300
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(NumberRangeInputBase, {
|
|
301
|
+
...innerProps,
|
|
302
|
+
ref,
|
|
303
|
+
value: field.value ?? EMPTY_RANGE,
|
|
304
|
+
onChange: field.onChange,
|
|
305
|
+
onBlur: field.onBlur,
|
|
306
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
307
|
+
error: props.error ?? error?.message,
|
|
308
|
+
autoFocusOnMount: shouldFocus
|
|
309
|
+
})
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return /* @__PURE__ */ jsx(NumberRangeInputBase, {
|
|
313
|
+
...props,
|
|
314
|
+
autoFocusOnMount: shouldFocus
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
//#endregion
|
|
318
|
+
export { NumberRangeInput };
|
|
@@ -13,9 +13,11 @@ interface TextInputBaseProps extends FormFieldProps, InputVariantProps, Omit<Inp
|
|
|
13
13
|
type?: AllowedHTMLInputTypeAttribute;
|
|
14
14
|
todayIcon?: boolean;
|
|
15
15
|
isDirty?: boolean;
|
|
16
|
+
autoFocusOnMount?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export interface TextInputProps extends TextInputBaseProps {
|
|
19
|
+
renderStaticInput?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export type ControlledTextInputProps<TFieldValues extends FieldValues> = ControlProps<TextInputProps, TFieldValues>;
|
|
20
|
-
export declare const TextInput: <TFieldValues extends FieldValues>(props: ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const TextInput: <TFieldValues extends FieldValues>({ renderStaticInput, ...props }: ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
export {};
|
|
@@ -3,20 +3,21 @@ import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
|
3
3
|
import { inputBase } from "../../shared/input.cva.js";
|
|
4
4
|
import { FormField } from "../../FormField/FormField.js";
|
|
5
5
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
6
|
+
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
6
7
|
import { InputContent } from "../shared/InputContent.js";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
8
9
|
import { clsx } from "clsx";
|
|
9
|
-
import { useRef } from "react";
|
|
10
|
+
import { useEffect, useRef, useState } from "react";
|
|
10
11
|
import { Input } from "react-aria-components";
|
|
11
12
|
import { useFocusVisible, useTextField } from "react-aria";
|
|
12
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
|
-
import { Controller } from "react-hook-form";
|
|
14
|
+
import { Controller, useWatch } from "react-hook-form";
|
|
14
15
|
//#region src/components/inputs/Input/TextInput/TextInput.tsx
|
|
15
16
|
var TextInputBase = (props) => {
|
|
16
17
|
const ui = UIConfig.useConfig();
|
|
17
18
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
18
19
|
const inputRef = useRef(null);
|
|
19
|
-
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, ...rest } = props;
|
|
20
|
+
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, autoFocusOnMount, ...rest } = props;
|
|
20
21
|
const textFieldRef = useRef(null);
|
|
21
22
|
const { isFocusVisible } = useFocusVisible();
|
|
22
23
|
const { labelProps, inputProps } = useTextField({
|
|
@@ -29,6 +30,10 @@ var TextInputBase = (props) => {
|
|
|
29
30
|
onChange,
|
|
30
31
|
onBlur
|
|
31
32
|
}, textFieldRef);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!autoFocusOnMount || isDisabled) return;
|
|
35
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
36
|
+
}, [autoFocusOnMount, isDisabled]);
|
|
32
37
|
const formFieldProps = {
|
|
33
38
|
error,
|
|
34
39
|
label,
|
|
@@ -84,6 +89,8 @@ var TextInputBase = (props) => {
|
|
|
84
89
|
...rest
|
|
85
90
|
}), inputClassName),
|
|
86
91
|
onClick: () => inputRef.current?.focus(),
|
|
92
|
+
"data-is-empty": value === "" || value === null || value === void 0 || void 0,
|
|
93
|
+
"data-is-required": isRequired || void 0,
|
|
87
94
|
children: /* @__PURE__ */ jsx(InputContent, {
|
|
88
95
|
...inputContentProps,
|
|
89
96
|
headerProps,
|
|
@@ -109,7 +116,76 @@ var TextInputBase = (props) => {
|
|
|
109
116
|
})
|
|
110
117
|
});
|
|
111
118
|
};
|
|
112
|
-
var TextInput = (props) => {
|
|
119
|
+
var TextInput = ({ renderStaticInput, ...props }) => {
|
|
120
|
+
const ui = UIConfig.useConfig();
|
|
121
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
122
|
+
const [shouldFocus, setShouldFocus] = useState(false);
|
|
123
|
+
const inputRef = useRef(null);
|
|
124
|
+
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
125
|
+
control: props.formControl.control,
|
|
126
|
+
name: props.formControl.name
|
|
127
|
+
}) : props.value;
|
|
128
|
+
let isFormControlDisabled = false;
|
|
129
|
+
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
130
|
+
const staticValue = watchedValue ?? props.value ?? props.defaultValue ?? "";
|
|
131
|
+
const inputType = props.type;
|
|
132
|
+
if (!renderInput && inputType === "password" && `${staticValue}`.length > 0) setRenderInput(true);
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (!renderInput || !shouldFocus) return;
|
|
135
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
136
|
+
setShouldFocus(false);
|
|
137
|
+
}, [renderInput, shouldFocus]);
|
|
138
|
+
if (!renderInput) {
|
|
139
|
+
const as = props.as ?? ui.input.as;
|
|
140
|
+
const size = props.size ?? ui.input.size;
|
|
141
|
+
const variant = props.variant ?? ui.input.variant;
|
|
142
|
+
const hideLabel = props.hideLabel ?? ui.input.hideLabel;
|
|
143
|
+
const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
144
|
+
let isDisabled = !!props.isDisabled;
|
|
145
|
+
if (isFormControlDisabled) isDisabled = true;
|
|
146
|
+
const maskedPasswordValue = inputType === "password" && `${staticValue}`.length > 0 ? "•".repeat(`${staticValue}`.length) : staticValue;
|
|
147
|
+
const displayValue = maskedPasswordValue == null ? "" : `${maskedPasswordValue}`;
|
|
148
|
+
const hasValue = displayValue !== "";
|
|
149
|
+
const dataAttributes = {
|
|
150
|
+
dataIsEmpty: !hasValue,
|
|
151
|
+
dataIsFilled: hasValue,
|
|
152
|
+
dataIsDirty: props.isDirty,
|
|
153
|
+
dataIsRequired: props.isRequired,
|
|
154
|
+
dataIsDisabled: isDisabled,
|
|
155
|
+
dataDisabled: isDisabled,
|
|
156
|
+
dataInvalid: !!props.error,
|
|
157
|
+
dataHasSelection: hasValue
|
|
158
|
+
};
|
|
159
|
+
return /* @__PURE__ */ jsx(InputFrame, {
|
|
160
|
+
...props,
|
|
161
|
+
isHeaderHidden,
|
|
162
|
+
hideLabel,
|
|
163
|
+
isDisabled,
|
|
164
|
+
className: clsx("group w-full", as === "inline" && "h-full", props.className),
|
|
165
|
+
dataAttributes,
|
|
166
|
+
renderStatic: true,
|
|
167
|
+
onStaticInteract: (focus) => {
|
|
168
|
+
setShouldFocus(focus);
|
|
169
|
+
setRenderInput(true);
|
|
170
|
+
},
|
|
171
|
+
inputClassName: props.inputClassName,
|
|
172
|
+
as,
|
|
173
|
+
size,
|
|
174
|
+
variant,
|
|
175
|
+
children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
|
|
176
|
+
ref: inputRef,
|
|
177
|
+
type: inputType === "hidden" ? "password" : inputType,
|
|
178
|
+
readOnly: true,
|
|
179
|
+
disabled: isDisabled,
|
|
180
|
+
tabIndex: -1,
|
|
181
|
+
value: displayValue,
|
|
182
|
+
placeholder: as === "floating" ? "" : props.placeholder,
|
|
183
|
+
className: "w-full bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled",
|
|
184
|
+
...dataAttributeProps,
|
|
185
|
+
"data-rac": true
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
}
|
|
113
189
|
if ("formControl" in props && props.formControl) {
|
|
114
190
|
const { formControl, ref, ...innerProps } = props;
|
|
115
191
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -117,17 +193,22 @@ var TextInput = (props) => {
|
|
|
117
193
|
name: formControl.name,
|
|
118
194
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(TextInputBase, {
|
|
119
195
|
...innerProps,
|
|
120
|
-
ref: mergeRefs(ref, field.ref),
|
|
196
|
+
ref: mergeRefs(ref, field.ref, inputRef),
|
|
121
197
|
value: field.value,
|
|
122
198
|
onChange: field.onChange,
|
|
123
199
|
onBlur: field.onBlur,
|
|
124
200
|
isDirty,
|
|
125
201
|
isDisabled: field.disabled || props.isDisabled,
|
|
126
|
-
error: props.error ?? error?.message
|
|
202
|
+
error: props.error ?? error?.message,
|
|
203
|
+
autoFocusOnMount: shouldFocus
|
|
127
204
|
})
|
|
128
205
|
});
|
|
129
206
|
}
|
|
130
|
-
return /* @__PURE__ */ jsx(TextInputBase, {
|
|
207
|
+
return /* @__PURE__ */ jsx(TextInputBase, {
|
|
208
|
+
...props,
|
|
209
|
+
ref: mergeRefs(props.ref, inputRef),
|
|
210
|
+
autoFocusOnMount: shouldFocus
|
|
211
|
+
});
|
|
131
212
|
};
|
|
132
213
|
//#endregion
|
|
133
214
|
export { TextInput };
|
|
@@ -4,7 +4,7 @@ import { Loader } from "../../../status/Loader/Loader.js";
|
|
|
4
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
5
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
6
6
|
import { InputClear } from "../../shared/InputClear.js";
|
|
7
|
-
import { inputSize } from "../../shared/input.cva.js";
|
|
7
|
+
import { inputContentWrapper, inputSize } from "../../shared/input.cva.js";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { clsx } from "clsx";
|
|
10
10
|
import { isValidElement } from "react";
|
|
@@ -12,21 +12,22 @@ import { isValidElement } from "react";
|
|
|
12
12
|
var InputContent = ({ leadingIcon: LeadingIcon, trailingIcon: TrailingIcon, unit, isLoading, isDisabled, action, isClearable, value, onChange, onBlur, children, headerProps, as, size }) => {
|
|
13
13
|
const typographyCva = UIStyle.useCva("typography.cva", typography);
|
|
14
14
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
15
|
+
const inputContentWrapperCva = UIStyle.useCva("input.contentWrapperCva", inputContentWrapper);
|
|
15
16
|
const isLeadingIconElement = LeadingIcon && isValidElement(LeadingIcon);
|
|
16
17
|
const isTrailingIconElement = TrailingIcon && isValidElement(TrailingIcon);
|
|
17
18
|
const showClear = value != null && value !== "" && !isDisabled;
|
|
18
19
|
return /* @__PURE__ */ jsxs("div", {
|
|
19
20
|
className: "flex w-full items-center gap-input-gap-input-text-to-elements",
|
|
20
21
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
21
|
-
className: clsx(inputSizeCva({
|
|
22
|
+
className: clsx("group/input-content flex w-full items-center gap-input-gap-input-text-to-elements pr-0!", as === "inline" && "h-full", inputSizeCva({
|
|
22
23
|
size,
|
|
23
24
|
as
|
|
24
|
-
})
|
|
25
|
+
})),
|
|
25
26
|
children: [LeadingIcon && /* @__PURE__ */ jsx("div", {
|
|
26
27
|
className: clsx(!isLeadingIconElement && "pointer-events-none"),
|
|
27
28
|
children: isLeadingIconElement ? LeadingIcon : /* @__PURE__ */ jsx(LeadingIcon, { className: "size-6 text-interactive-text-secondary-idle" })
|
|
28
29
|
}), /* @__PURE__ */ jsxs("div", {
|
|
29
|
-
className:
|
|
30
|
+
className: inputContentWrapperCva({ as }),
|
|
30
31
|
children: [as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
31
32
|
as,
|
|
32
33
|
size,
|
|
@@ -34,10 +35,10 @@ var InputContent = ({ leadingIcon: LeadingIcon, trailingIcon: TrailingIcon, unit
|
|
|
34
35
|
}), children]
|
|
35
36
|
})]
|
|
36
37
|
}), /* @__PURE__ */ jsxs("div", {
|
|
37
|
-
className: clsx(inputSizeCva({
|
|
38
|
+
className: clsx("flex items-center gap-input-gap-trailing-elements py-0! pl-0!", inputSizeCva({
|
|
38
39
|
size,
|
|
39
40
|
as
|
|
40
|
-
}),
|
|
41
|
+
}), !isTrailingIconElement && !action && !(isClearable && showClear) && "pointer-events-none"),
|
|
41
42
|
children: [
|
|
42
43
|
isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
43
44
|
onClear: () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getStaticNumberDisplayValue: (value: unknown, formatter: Intl.NumberFormat) => string | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/components/inputs/Input/shared/numberStatic.utils.ts
|
|
2
|
+
var getStaticNumberDisplayValue = (value, formatter) => {
|
|
3
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
4
|
+
return formatter.format(value);
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { getStaticNumberDisplayValue };
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { ComponentProps, JSXElementConstructor, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { Control, UseFormReturn } from 'react-hook-form';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { Autocomplete } from '../Selection/Autocomplete/Autocomplete';
|
|
5
|
+
import { Select } from '../Selection/Select/Select';
|
|
4
6
|
import { HasRequiredProperty } from '../../../types/common';
|
|
5
7
|
declare const componentRegistry: {
|
|
6
8
|
readonly toggle: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Toggle/Toggle').ControlledToggleProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
readonly checkbox: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Checkbox/Checkbox').ControlledCheckboxProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
readonly numberInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/NumberInput/NumberInput').ControlledNumberInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
readonly numberInput: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../Input/NumberInput/NumberInput').ControlledNumberInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
readonly numberRangeInput: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../Input/NumberRangeInput/NumberRangeInput').ControlledNumberRangeInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
readonly slider: <TFieldValues extends import('react-hook-form').FieldValues, IsRange extends boolean = false>(props: import('../Slider/Slider').ControlledSliderProps<TFieldValues, IsRange>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
readonly textInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/TextInput/TextInput').ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
readonly textInput: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../Input/TextInput/TextInput').ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
11
14
|
readonly passwordInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/PasswordInput/PasswordInput').ControlledPasswordInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
readonly textArea: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/TextArea/TextArea').ControlledTextAreaProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
readonly select:
|
|
14
|
-
readonly querySelect: <TFieldValues extends import('react-hook-form').FieldValues, TQueryFn extends import('../Selection/shared/querySelect.utils').QueryFn, TKey extends import('react-aria').Key = import('react-aria').Key>({ query, queryParams, queryOptions, queryMap, ...props }: import('
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
queryOptions?: Parameters<TQueryFn>[1] | undefined;
|
|
18
|
-
queryMap?: ((data: Exclude<ReturnType<TQueryFn>["data"], undefined>) => import('../Selection/shared/select.types').SelectItem<TKey>[]) | undefined;
|
|
19
|
-
isInitialQueryDisabled?: boolean;
|
|
20
|
-
})) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
readonly autocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key, TInitialSelectItem = import('../Selection/shared/select.types').DefaultInitialSelectItem<TKey>>(props: import('../Selection/Autocomplete/Autocomplete').ControlledAutocompleteProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
readonly queryAutocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TSelectItem extends import('../Selection/shared/select.types').SelectItem<any>, TQueryFn extends import('../Selection/Autocomplete/queryAutocomplete.types').QueryFn<TSelectItem>>({ query, queryParams, queryOptions, queryMap, ...props }: import('../Selection/Autocomplete/queryAutocomplete.types').QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
readonly select: typeof Select;
|
|
17
|
+
readonly querySelect: <TFieldValues extends import('react-hook-form').FieldValues, TQueryFn extends import('../Selection/shared/querySelect.utils').QueryFn, TKey extends import('react-aria').Key = import('react-aria').Key>({ query, queryParams, queryOptions, queryMap, ...props }: import('../Selection/Select/QuerySelect.js').QuerySelectProps<TFieldValues, TQueryFn, TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
readonly autocomplete: typeof Autocomplete;
|
|
19
|
+
readonly queryAutocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TSelectItem extends import('../../..').SelectItem<any>, TQueryFn extends import('../Selection/Autocomplete/queryAutocomplete.types').QueryFn>({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }: import('../Selection/Autocomplete/queryAutocomplete.types').QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
|
|
23
20
|
readonly segment: <TFieldValues extends import('react-hook-form').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key>(props: import('../../..').ControlledSegmentProps<TFieldValues, TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
readonly datePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, ...props }: import('../DateTime/DatePicker/DatePicker').ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
readonly dateTimePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
readonly timePicker: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
readonly dateRangePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, ...props }: import('../DateTime/DateRangePicker/DateRangePicker').ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
readonly datePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, renderStaticInput, ...props }: import('../DateTime/DatePicker/DatePicker').ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
readonly dateTimePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, renderStaticInput, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
readonly timePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
readonly dateRangePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, renderStaticInput, ...props }: import('../DateTime/DateRangePicker/DateRangePicker').ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
28
25
|
readonly textEditor: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../../../text-editor.js').ControlledTextEditorProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
29
26
|
readonly unknown: null;
|
|
30
27
|
};
|
|
@@ -54,8 +51,8 @@ type TypeBasedInputDef<TSchemaType extends Record<string, any>, T extends InputC
|
|
|
54
51
|
interface RenderBasedInputDef<TSchemaType extends Record<string, any>, K extends keyof TSchemaType> {
|
|
55
52
|
type?: never;
|
|
56
53
|
name: K;
|
|
57
|
-
label?:
|
|
58
|
-
placeholder?:
|
|
54
|
+
label?: string;
|
|
55
|
+
placeholder?: string;
|
|
59
56
|
props?: never;
|
|
60
57
|
inputWrapper?: never;
|
|
61
58
|
render: (formControl: {
|
|
@@ -6,6 +6,7 @@ import { DateRangePicker } from "../DateTime/DateRangePicker/DateRangePicker.js"
|
|
|
6
6
|
import { DateTimePicker } from "../DateTime/DateTimePicker/DateTimePicker.js";
|
|
7
7
|
import { TimePicker } from "../DateTime/TimePicker/TimePicker.js";
|
|
8
8
|
import { NumberInput } from "../Input/NumberInput/NumberInput.js";
|
|
9
|
+
import { NumberRangeInput } from "../Input/NumberRangeInput/NumberRangeInput.js";
|
|
9
10
|
import { PasswordInput } from "../Input/PasswordInput/PasswordInput.js";
|
|
10
11
|
import { TextArea } from "../Input/TextArea/TextArea.js";
|
|
11
12
|
import { Autocomplete } from "../Selection/Autocomplete/Autocomplete.js";
|
|
@@ -21,6 +22,7 @@ var componentRegistry = {
|
|
|
21
22
|
toggle: Toggle,
|
|
22
23
|
checkbox: Checkbox,
|
|
23
24
|
numberInput: NumberInput,
|
|
25
|
+
numberRangeInput: NumberRangeInput,
|
|
24
26
|
slider: Slider,
|
|
25
27
|
textInput: TextInput,
|
|
26
28
|
passwordInput: PasswordInput,
|