@povio/ui 3.3.0 → 3.4.0-rc.1
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/inputs/Checkbox/Checkbox.d.ts +1 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +93 -100
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +1 -2
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +109 -113
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +14 -21
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +14 -22
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +14 -21
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -2
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +275 -294
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +1 -10
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +43 -46
- package/dist/components/inputs/File/FileUpload.d.ts +1 -1
- package/dist/components/inputs/File/FileUpload.js +17 -17
- package/dist/components/inputs/File/InputUpload.d.ts +1 -1
- package/dist/components/inputs/File/InputUpload.js +17 -17
- package/dist/components/inputs/File/fileUpload.types.d.ts +1 -1
- package/dist/components/inputs/File/inputUpload.types.d.ts +1 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +1 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +19 -19
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +1 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +18 -18
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.js +18 -18
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -2
- package/dist/components/inputs/Input/TextInput/TextInput.js +36 -38
- package/dist/components/inputs/Inputs/Form.d.ts +4 -4
- package/dist/components/inputs/Inputs/InputItem.d.ts +22 -22
- package/dist/components/inputs/Inputs/InputItem.js +35 -36
- package/dist/components/inputs/Inputs/Inputs.d.ts +2 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.js +107 -111
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +13 -13
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +19 -19
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/QuerySelect.js +19 -19
- package/dist/components/inputs/Selection/Select/Select.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/Select.js +19 -19
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +34 -37
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +4 -8
- package/dist/components/inputs/Selection/shared/select.types.d.ts +1 -1
- package/dist/components/inputs/Slider/Slider.d.ts +1 -1
- package/dist/components/inputs/Slider/Slider.js +18 -18
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +18 -18
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -2
- package/dist/components/inputs/Toggle/Toggle.js +59 -63
- package/dist/components/inputs/shared/form.binding.d.ts +27 -0
- package/dist/components/inputs/shared/form.binding.js +57 -0
- package/dist/components/inputs/shared/form.types.d.ts +9 -8
- package/dist/components/inputs/shared/form.types.js +8 -0
- package/dist/components/segment/Segment.d.ts +1 -1
- package/dist/components/segment/Segment.js +17 -17
- package/dist/components/segment/segment.types.d.ts +1 -1
- package/dist/config/uiConfig.context.d.ts +5 -5
- package/dist/config/uiConfig.context.js +3 -12
- package/dist/helpers/dynamicColumns.d.ts +1 -1
- package/dist/helpers/dynamicInputs.d.ts +7 -7
- package/dist/hooks/useAutosave.d.ts +4 -4
- package/dist/hooks/useAutosave.js +64 -49
- package/dist/hooks/useForm.d.ts +39 -15
- package/dist/hooks/useForm.js +96 -43
- package/dist/hooks/useFormAutosave.d.ts +8 -9
- package/dist/hooks/useFormAutosave.js +23 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/package.json +2 -3
- package/dist/hooks/useAutosave.spec.d.ts +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
2
2
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
3
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
4
|
+
import { FieldController } from "../../shared/form.binding.js";
|
|
4
5
|
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
5
6
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
6
7
|
import { selectInputTagsContentWrapperDefinition } from "../shared/selectInput.cva.js";
|
|
@@ -12,7 +13,6 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
12
13
|
import { clsx } from "clsx";
|
|
13
14
|
import { useRef, useState } from "react";
|
|
14
15
|
import { mergeRefs } from "@react-aria/utils";
|
|
15
|
-
import { Controller } from "react-hook-form";
|
|
16
16
|
//#region src/components/inputs/Selection/Select/Select.tsx
|
|
17
17
|
function SelectInner(t0) {
|
|
18
18
|
const $ = c(6);
|
|
@@ -163,35 +163,35 @@ function Select(t0) {
|
|
|
163
163
|
props = $[1];
|
|
164
164
|
renderStaticInput = $[2];
|
|
165
165
|
}
|
|
166
|
-
if ("
|
|
167
|
-
let
|
|
166
|
+
if ("field" in props && props.field) {
|
|
167
|
+
let field;
|
|
168
168
|
let innerProps;
|
|
169
169
|
let ref;
|
|
170
170
|
if ($[3] !== props) {
|
|
171
|
-
({
|
|
171
|
+
({field, ref, ...innerProps} = props);
|
|
172
172
|
$[3] = props;
|
|
173
|
-
$[4] =
|
|
173
|
+
$[4] = field;
|
|
174
174
|
$[5] = innerProps;
|
|
175
175
|
$[6] = ref;
|
|
176
176
|
} else {
|
|
177
|
-
|
|
177
|
+
field = $[4];
|
|
178
178
|
innerProps = $[5];
|
|
179
179
|
ref = $[6];
|
|
180
180
|
}
|
|
181
|
-
const controlWithOptions =
|
|
181
|
+
const controlWithOptions = field.form;
|
|
182
182
|
let t1;
|
|
183
183
|
if ($[7] !== controlWithOptions._options?.disabled || $[8] !== innerProps || $[9] !== props.error || $[10] !== props.isDisabled || $[11] !== ref || $[12] !== renderStaticInput) {
|
|
184
184
|
t1 = (t2) => {
|
|
185
|
-
const { field, fieldState: t3 } = t2;
|
|
185
|
+
const { field: field_0, fieldState: t3 } = t2;
|
|
186
186
|
const { error, isDirty } = t3;
|
|
187
187
|
return /* @__PURE__ */ jsx(SelectInner, {
|
|
188
188
|
...innerProps,
|
|
189
|
-
ref: mergeRefs(ref,
|
|
190
|
-
value:
|
|
191
|
-
onChange:
|
|
192
|
-
onBlur:
|
|
189
|
+
ref: mergeRefs(ref, field_0.ref),
|
|
190
|
+
value: field_0.value,
|
|
191
|
+
onChange: field_0.onChange,
|
|
192
|
+
onBlur: field_0.onBlur,
|
|
193
193
|
isDirty,
|
|
194
|
-
isDisabled:
|
|
194
|
+
isDisabled: field_0.disabled || props.isDisabled,
|
|
195
195
|
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
196
196
|
error: props.error ?? error?.message,
|
|
197
197
|
renderStaticInput
|
|
@@ -206,14 +206,14 @@ function Select(t0) {
|
|
|
206
206
|
$[13] = t1;
|
|
207
207
|
} else t1 = $[13];
|
|
208
208
|
let t2;
|
|
209
|
-
if ($[14] !==
|
|
210
|
-
t2 = /* @__PURE__ */ jsx(
|
|
211
|
-
control:
|
|
212
|
-
name:
|
|
209
|
+
if ($[14] !== field.form || $[15] !== field.name || $[16] !== t1) {
|
|
210
|
+
t2 = /* @__PURE__ */ jsx(FieldController, {
|
|
211
|
+
control: field.form,
|
|
212
|
+
name: field.name,
|
|
213
213
|
render: t1
|
|
214
214
|
});
|
|
215
|
-
$[14] =
|
|
216
|
-
$[15] =
|
|
215
|
+
$[14] = field.form;
|
|
216
|
+
$[15] = field.name;
|
|
217
217
|
$[16] = t1;
|
|
218
218
|
$[17] = t2;
|
|
219
219
|
} else t2 = $[17];
|
|
@@ -25,7 +25,6 @@ export type SelectBaseProps<TKey extends Key = Key, TInitialSelectItem = Default
|
|
|
25
25
|
customTrigger?: ReactElement;
|
|
26
26
|
selectedTagsType?: "tags" | "list";
|
|
27
27
|
collapseAfter?: number;
|
|
28
|
-
fireBlurOnChange?: boolean;
|
|
29
28
|
searchDebounceDelay?: number;
|
|
30
29
|
multiSelectAutoConfirm?: boolean;
|
|
31
30
|
onInputChange?: (value: string) => void;
|
|
@@ -7,7 +7,7 @@ import { c } from "react/compiler-runtime";
|
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/inputs/Selection/shared/SelectBase.tsx
|
|
9
9
|
var SelectBase = (dProps) => {
|
|
10
|
-
const $ = c(
|
|
10
|
+
const $ = c(21);
|
|
11
11
|
const ui = UIConfig.useConfig();
|
|
12
12
|
const t0 = dProps.selectionMode ?? ui.select.selectionMode;
|
|
13
13
|
const t1 = dProps.variant ?? ui.input.variant;
|
|
@@ -20,12 +20,11 @@ var SelectBase = (dProps) => {
|
|
|
20
20
|
const t8 = dProps.virtualizerOptions || (dProps.totalItems ?? 0) > 100 || dProps.hasLoadMore ? false : dProps.ignoreTriggerWidth ?? false;
|
|
21
21
|
const t9 = dProps.collapseAfter ?? ui.select.collapseAfter;
|
|
22
22
|
const t10 = dProps.hideSearchIcon ?? ui.select.hideSearchIcon;
|
|
23
|
-
const t11 = dProps.
|
|
24
|
-
const t12 = dProps.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
t14 = {
|
|
23
|
+
const t11 = dProps.multiSelectAutoConfirm ?? ui.select.multiSelectAutoConfirm;
|
|
24
|
+
const t12 = dProps.ignoreInputValueFiltering ?? dProps.isClientSearchDisabled;
|
|
25
|
+
let t13;
|
|
26
|
+
if ($[0] !== dProps || $[1] !== t0 || $[2] !== t1 || $[3] !== t10 || $[4] !== t11 || $[5] !== t12 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== t6 || $[11] !== t7 || $[12] !== t8 || $[13] !== t9) {
|
|
27
|
+
t13 = {
|
|
29
28
|
...dProps,
|
|
30
29
|
selectionMode: t0,
|
|
31
30
|
variant: t1,
|
|
@@ -38,9 +37,8 @@ var SelectBase = (dProps) => {
|
|
|
38
37
|
ignoreTriggerWidth: t8,
|
|
39
38
|
collapseAfter: t9,
|
|
40
39
|
hideSearchIcon: t10,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
isClientSearchDisabled: t13
|
|
40
|
+
multiSelectAutoConfirm: t11,
|
|
41
|
+
isClientSearchDisabled: t12
|
|
44
42
|
};
|
|
45
43
|
$[0] = dProps;
|
|
46
44
|
$[1] = t0;
|
|
@@ -48,38 +46,37 @@ var SelectBase = (dProps) => {
|
|
|
48
46
|
$[3] = t10;
|
|
49
47
|
$[4] = t11;
|
|
50
48
|
$[5] = t12;
|
|
51
|
-
$[6] =
|
|
52
|
-
$[7] =
|
|
53
|
-
$[8] =
|
|
54
|
-
$[9] =
|
|
55
|
-
$[10] =
|
|
56
|
-
$[11] =
|
|
57
|
-
$[12] =
|
|
58
|
-
$[13] =
|
|
59
|
-
$[14] =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const props = t14;
|
|
49
|
+
$[6] = t2;
|
|
50
|
+
$[7] = t3;
|
|
51
|
+
$[8] = t4;
|
|
52
|
+
$[9] = t5;
|
|
53
|
+
$[10] = t6;
|
|
54
|
+
$[11] = t7;
|
|
55
|
+
$[12] = t8;
|
|
56
|
+
$[13] = t9;
|
|
57
|
+
$[14] = t13;
|
|
58
|
+
} else t13 = $[14];
|
|
59
|
+
const props = t13;
|
|
63
60
|
const isDesktop = useBreakpoint("md");
|
|
64
|
-
const
|
|
61
|
+
const t14 = props;
|
|
62
|
+
let t15;
|
|
63
|
+
if ($[15] !== isDesktop || $[16] !== props) {
|
|
64
|
+
t15 = isDesktop ? /* @__PURE__ */ jsx(SelectDesktop, { ...props }) : /* @__PURE__ */ jsx(SelectMobile, { ...props });
|
|
65
|
+
$[15] = isDesktop;
|
|
66
|
+
$[16] = props;
|
|
67
|
+
$[17] = t15;
|
|
68
|
+
} else t15 = $[17];
|
|
65
69
|
let t16;
|
|
66
|
-
if ($[
|
|
67
|
-
t16 =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
$[18] = t16;
|
|
71
|
-
} else t16 = $[18];
|
|
72
|
-
let t17;
|
|
73
|
-
if ($[19] !== t15 || $[20] !== t16) {
|
|
74
|
-
t17 = /* @__PURE__ */ jsx(SelectContext.Provider, {
|
|
75
|
-
...t15,
|
|
76
|
-
children: t16
|
|
70
|
+
if ($[18] !== t14 || $[19] !== t15) {
|
|
71
|
+
t16 = /* @__PURE__ */ jsx(SelectContext.Provider, {
|
|
72
|
+
...t14,
|
|
73
|
+
children: t15
|
|
77
74
|
});
|
|
75
|
+
$[18] = t14;
|
|
78
76
|
$[19] = t15;
|
|
79
77
|
$[20] = t16;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return t17;
|
|
78
|
+
} else t16 = $[20];
|
|
79
|
+
return t16;
|
|
83
80
|
};
|
|
84
81
|
//#endregion
|
|
85
82
|
export { SelectBase };
|
|
@@ -25,8 +25,8 @@ export declare namespace SelectContext {
|
|
|
25
25
|
isMultiple: boolean;
|
|
26
26
|
multiSelectAutoConfirm: boolean;
|
|
27
27
|
} & Pick<SelectBaseProps, "onInputChange" | "isLoading" | "hasLoadMore">;
|
|
28
|
-
export type ProviderProps = GroupedSelectProps & Pick<SelectBaseProps, "items" | "onInputChange" | "onSearchChange" | "showSelectAllOption" | "showNewItemOption" | "newItemMinLength" | "onNewItemOption" | "isLoading" | "hasLoadMore" | "mapInitialToSelectItem" | "isSearchable" | "isClientSearchDisabled" | "ignoreInputValueFiltering" | "
|
|
29
|
-
export const Provider: ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering,
|
|
28
|
+
export type ProviderProps = GroupedSelectProps & Pick<SelectBaseProps, "items" | "onInputChange" | "onSearchChange" | "showSelectAllOption" | "showNewItemOption" | "newItemMinLength" | "onNewItemOption" | "isLoading" | "hasLoadMore" | "mapInitialToSelectItem" | "isSearchable" | "isClientSearchDisabled" | "ignoreInputValueFiltering" | "searchDebounceDelay" | "multiSelectAutoConfirm" | "onBlur">;
|
|
29
|
+
export const Provider: ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, searchDebounceDelay, multiSelectAutoConfirm, onBlur: fieldOnBlur, children, mapInitialToSelectItem, ...props }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
export const useSelect: () => Type;
|
|
31
31
|
export {};
|
|
32
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
2
1
|
import { useSelectItems } from "./useSelectItems.js";
|
|
2
|
+
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
//#region src/components/inputs/Selection/shared/select.context.tsx
|
|
@@ -10,7 +10,7 @@ var SelectContext;
|
|
|
10
10
|
id: item.id,
|
|
11
11
|
label: item.label ?? item.name ?? ""
|
|
12
12
|
});
|
|
13
|
-
_SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering,
|
|
13
|
+
_SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, searchDebounceDelay, multiSelectAutoConfirm = false, onBlur: fieldOnBlur, children, mapInitialToSelectItem = defaultMapInitialToSelectItem, ...props }) => {
|
|
14
14
|
const isMultiple = props.selectionMode === "multiple";
|
|
15
15
|
const initialSelectedItems = useMemo(() => {
|
|
16
16
|
if (!props.initialSelection) return null;
|
|
@@ -75,9 +75,6 @@ var SelectContext;
|
|
|
75
75
|
onSearchChangeDebounced,
|
|
76
76
|
updateValue
|
|
77
77
|
]);
|
|
78
|
-
const triggerBlurOnChange = useCallback(() => {
|
|
79
|
-
if (fireBlurOnChange) fieldOnBlur?.({});
|
|
80
|
-
}, [fireBlurOnChange, fieldOnBlur]);
|
|
81
78
|
const syncFieldState = (value_1) => {
|
|
82
79
|
const newFieldState = {
|
|
83
80
|
value: value_1,
|
|
@@ -120,7 +117,7 @@ var SelectContext;
|
|
|
120
117
|
searchValue: ""
|
|
121
118
|
};
|
|
122
119
|
setFieldState(newFieldState_1);
|
|
123
|
-
|
|
120
|
+
emitStateChanges(newFieldState_1);
|
|
124
121
|
}
|
|
125
122
|
if (!isMultiple) {
|
|
126
123
|
setIsOpen(false);
|
|
@@ -131,8 +128,7 @@ var SelectContext;
|
|
|
131
128
|
onNewItemOption,
|
|
132
129
|
fieldState.inputValue,
|
|
133
130
|
getItem_0,
|
|
134
|
-
isMultiple
|
|
135
|
-
triggerBlurOnChange
|
|
131
|
+
isMultiple
|
|
136
132
|
]);
|
|
137
133
|
const onClear = useCallback(() => {
|
|
138
134
|
if (selectedIds.length === 0) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { Key } from 'react-aria-components';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from '../../shared/form.binding';
|
|
4
4
|
import { ControlProps } from '../../shared/form.types';
|
|
5
5
|
export interface SelectItem<TKey extends Key = Key> {
|
|
6
6
|
id: TKey;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FocusEvent, Ref } from 'react';
|
|
2
2
|
import { SliderProps as AriaSliderProps } from 'react-aria-components';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from '../shared/form.binding';
|
|
4
4
|
import { FormFieldProps } from '../FormField/FormField';
|
|
5
5
|
import { ControlProps } from '../shared/form.types';
|
|
6
6
|
type SliderValue<IsRange extends boolean = false> = IsRange extends false ? number : number[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Typography } from "../../text/Typography/Typography.js";
|
|
2
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
3
3
|
import { uiOutlineClass } from "../../outline.clsx.js";
|
|
4
|
+
import { FieldController } from "../shared/form.binding.js";
|
|
4
5
|
import { FormField } from "../FormField/FormField.js";
|
|
5
6
|
import { c } from "react/compiler-runtime";
|
|
6
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { clsx } from "clsx";
|
|
8
9
|
import { Slider, SliderThumb, SliderTrack } from "react-aria-components";
|
|
9
10
|
import { mergeRefs } from "@react-aria/utils";
|
|
10
|
-
import { Controller } from "react-hook-form";
|
|
11
11
|
//#region src/components/inputs/Slider/Slider.tsx
|
|
12
12
|
var SliderBase = (props) => {
|
|
13
13
|
const $ = c(61);
|
|
@@ -223,33 +223,33 @@ var SliderBase = (props) => {
|
|
|
223
223
|
};
|
|
224
224
|
var Slider$1 = (props) => {
|
|
225
225
|
const $ = c(15);
|
|
226
|
-
if ("
|
|
227
|
-
let
|
|
226
|
+
if ("field" in props && props.field) {
|
|
227
|
+
let field;
|
|
228
228
|
let innerProps;
|
|
229
229
|
let ref;
|
|
230
230
|
if ($[0] !== props) {
|
|
231
|
-
({
|
|
231
|
+
({field, ref, ...innerProps} = props);
|
|
232
232
|
$[0] = props;
|
|
233
|
-
$[1] =
|
|
233
|
+
$[1] = field;
|
|
234
234
|
$[2] = innerProps;
|
|
235
235
|
$[3] = ref;
|
|
236
236
|
} else {
|
|
237
|
-
|
|
237
|
+
field = $[1];
|
|
238
238
|
innerProps = $[2];
|
|
239
239
|
ref = $[3];
|
|
240
240
|
}
|
|
241
241
|
let t0;
|
|
242
242
|
if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
|
|
243
243
|
t0 = (t1) => {
|
|
244
|
-
const { field, fieldState: t2 } = t1;
|
|
244
|
+
const { field: field_0, fieldState: t2 } = t1;
|
|
245
245
|
const { error } = t2;
|
|
246
246
|
return /* @__PURE__ */ jsx(SliderBase, {
|
|
247
247
|
...innerProps,
|
|
248
|
-
ref: mergeRefs(ref,
|
|
249
|
-
value:
|
|
250
|
-
onBlur:
|
|
251
|
-
onChange:
|
|
252
|
-
isDisabled:
|
|
248
|
+
ref: mergeRefs(ref, field_0.ref),
|
|
249
|
+
value: field_0.value,
|
|
250
|
+
onBlur: field_0.onBlur,
|
|
251
|
+
onChange: field_0.onChange,
|
|
252
|
+
isDisabled: field_0.disabled || props.isDisabled,
|
|
253
253
|
error: props.error ?? error?.message
|
|
254
254
|
});
|
|
255
255
|
};
|
|
@@ -260,14 +260,14 @@ var Slider$1 = (props) => {
|
|
|
260
260
|
$[8] = t0;
|
|
261
261
|
} else t0 = $[8];
|
|
262
262
|
let t1;
|
|
263
|
-
if ($[9] !==
|
|
264
|
-
t1 = /* @__PURE__ */ jsx(
|
|
265
|
-
control:
|
|
266
|
-
name:
|
|
263
|
+
if ($[9] !== field.form || $[10] !== field.name || $[11] !== t0) {
|
|
264
|
+
t1 = /* @__PURE__ */ jsx(FieldController, {
|
|
265
|
+
control: field.form,
|
|
266
|
+
name: field.name,
|
|
267
267
|
render: t0
|
|
268
268
|
});
|
|
269
|
-
$[9] =
|
|
270
|
-
$[10] =
|
|
269
|
+
$[9] = field.form;
|
|
270
|
+
$[10] = field.name;
|
|
271
271
|
$[11] = t0;
|
|
272
272
|
$[12] = t1;
|
|
273
273
|
} else t1 = $[12];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSONContent } from '@tiptap/react';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from '../shared/form.binding';
|
|
4
4
|
import { FormFieldProps } from '../FormField/FormField';
|
|
5
5
|
import { ControlProps } from '../shared/form.types';
|
|
6
6
|
export interface TextEditorValue {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UIOverrides } from "../../../config/uiOverrides.context.js";
|
|
2
2
|
import { isEqual } from "../../../utils/isEqual.js";
|
|
3
3
|
import { uiOutlineClass } from "../../outline.clsx.js";
|
|
4
|
+
import { FieldController } from "../shared/form.binding.js";
|
|
4
5
|
import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
|
|
5
6
|
import { FormField } from "../FormField/FormField.js";
|
|
6
7
|
import { inputSideDefinition } from "../shared/input.cva.js";
|
|
@@ -11,7 +12,6 @@ import { clsx } from "clsx";
|
|
|
11
12
|
import { useEffect, useRef, useState } from "react";
|
|
12
13
|
import { useFocusVisible, useFocusWithin, useHover, useLabel } from "react-aria";
|
|
13
14
|
import { mergeRefs } from "@react-aria/utils";
|
|
14
|
-
import { Controller } from "react-hook-form";
|
|
15
15
|
import { Color } from "@tiptap/extension-color";
|
|
16
16
|
import { Highlight } from "@tiptap/extension-highlight";
|
|
17
17
|
import { Link } from "@tiptap/extension-link";
|
|
@@ -136,34 +136,34 @@ var TextEditorBase = ({ ref, as = "default", placeholder, label, hideLabel, tool
|
|
|
136
136
|
};
|
|
137
137
|
var TextEditor = (props) => {
|
|
138
138
|
const $ = c(15);
|
|
139
|
-
if ("
|
|
140
|
-
let
|
|
139
|
+
if ("field" in props && props.field) {
|
|
140
|
+
let field;
|
|
141
141
|
let innerProps;
|
|
142
142
|
let ref;
|
|
143
143
|
if ($[0] !== props) {
|
|
144
|
-
({
|
|
144
|
+
({field, ref, ...innerProps} = props);
|
|
145
145
|
$[0] = props;
|
|
146
|
-
$[1] =
|
|
146
|
+
$[1] = field;
|
|
147
147
|
$[2] = innerProps;
|
|
148
148
|
$[3] = ref;
|
|
149
149
|
} else {
|
|
150
|
-
|
|
150
|
+
field = $[1];
|
|
151
151
|
innerProps = $[2];
|
|
152
152
|
ref = $[3];
|
|
153
153
|
}
|
|
154
154
|
let t0;
|
|
155
155
|
if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
|
|
156
156
|
t0 = (t1) => {
|
|
157
|
-
const { field, fieldState: t2 } = t1;
|
|
157
|
+
const { field: field_0, fieldState: t2 } = t1;
|
|
158
158
|
const { error, isDirty } = t2;
|
|
159
159
|
return /* @__PURE__ */ jsx(TextEditorBase, {
|
|
160
160
|
...innerProps,
|
|
161
|
-
ref: mergeRefs(ref,
|
|
162
|
-
value:
|
|
163
|
-
onChange:
|
|
164
|
-
onBlur:
|
|
161
|
+
ref: mergeRefs(ref, field_0.ref),
|
|
162
|
+
value: field_0.value,
|
|
163
|
+
onChange: field_0.onChange,
|
|
164
|
+
onBlur: field_0.onBlur,
|
|
165
165
|
isDirty,
|
|
166
|
-
isDisabled:
|
|
166
|
+
isDisabled: field_0.disabled || props.isDisabled,
|
|
167
167
|
error: props.error ?? error?.message
|
|
168
168
|
});
|
|
169
169
|
};
|
|
@@ -174,14 +174,14 @@ var TextEditor = (props) => {
|
|
|
174
174
|
$[8] = t0;
|
|
175
175
|
} else t0 = $[8];
|
|
176
176
|
let t1;
|
|
177
|
-
if ($[9] !==
|
|
178
|
-
t1 = /* @__PURE__ */ jsx(
|
|
179
|
-
control:
|
|
180
|
-
name:
|
|
177
|
+
if ($[9] !== field.form || $[10] !== field.name || $[11] !== t0) {
|
|
178
|
+
t1 = /* @__PURE__ */ jsx(FieldController, {
|
|
179
|
+
control: field.form,
|
|
180
|
+
name: field.name,
|
|
181
181
|
render: t0
|
|
182
182
|
});
|
|
183
|
-
$[9] =
|
|
184
|
-
$[10] =
|
|
183
|
+
$[9] = field.form;
|
|
184
|
+
$[10] = field.name;
|
|
185
185
|
$[11] = t0;
|
|
186
186
|
$[12] = t1;
|
|
187
187
|
} else t1 = $[12];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { SwitchProps as AriaSwitchProps } from 'react-aria-components';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from '../shared/form.binding';
|
|
4
4
|
import { FormFieldErrorProps } from '../FormField/FormFieldError';
|
|
5
5
|
import { ControlProps } from '../shared/form.types';
|
|
6
6
|
import { ToggleVariantProps } from './toggle.cva';
|
|
@@ -9,7 +9,6 @@ interface ToggleBaseProps extends FormFieldErrorProps, ToggleVariantProps, Omit<
|
|
|
9
9
|
children?: string;
|
|
10
10
|
isDirty?: boolean;
|
|
11
11
|
isRequired?: boolean;
|
|
12
|
-
fireBlurOnChange?: boolean;
|
|
13
12
|
}
|
|
14
13
|
export type ToggleProps = ToggleBaseProps;
|
|
15
14
|
export type ControlledToggleProps<TFieldValues extends FieldValues> = ControlProps<ToggleProps, TFieldValues, "isSelected">;
|