@wix/site-ui 1.347.0 → 1.349.0
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/{6706.js → 1093.js} +3 -3
- package/dist/{8724.js → 1219.js} +2 -2
- package/dist/{7373.js → 1288.js} +8 -2
- package/dist/{5299.js → 1381.js} +98 -127
- package/dist/{3056.js → 1607.js} +32 -34
- package/dist/1629.js +2 -0
- package/dist/1669.js +75 -0
- package/dist/1718.js +26 -0
- package/dist/{1477.js → 201.js} +17 -26
- package/dist/2221.js +9 -0
- package/dist/{2445.js → 226.js} +12 -48
- package/dist/2387.js +7 -0
- package/dist/2580.js +6 -0
- package/dist/{1500.js → 2859.js} +10 -34
- package/dist/3014.js +178 -0
- package/dist/{6247.js → 3054.js} +3 -3
- package/dist/{7642.js → 3093.js} +1 -1
- package/dist/3189.js +5 -0
- package/dist/{7564.js → 331.js} +2 -2
- package/dist/3357.js +7 -0
- package/dist/{487.js → 3398.js} +38 -39
- package/dist/3502.js +224 -0
- package/dist/3695.js +50 -0
- package/dist/3829.js +1 -1
- package/dist/{6588.js → 3859.js} +115 -92
- package/dist/{3670.js → 3910.js} +28 -21
- package/dist/392.js +7 -0
- package/dist/{4549.js → 4155.js} +11 -3
- package/dist/4226.js +7 -0
- package/dist/{6329.js → 4229.js} +1 -1
- package/dist/4293.js +3 -0
- package/dist/4346.js +853 -2
- package/dist/{285.js → 4472.js} +3 -3
- package/dist/4605.js +207 -0
- package/dist/{7366.js → 488.js} +60 -7
- package/dist/{8750.js → 497.js} +190 -375
- package/dist/4989.js +35 -0
- package/dist/{6270.js → 510.js} +157 -196
- package/dist/5258.js +26 -0
- package/dist/{5036.js → 5275.js} +0 -3
- package/dist/{8171.js → 5298.js} +90 -102
- package/dist/5473.js +11 -0
- package/dist/{4745.js → 5490.js} +3 -1
- package/dist/{6089.js → 5561.js} +869 -786
- package/dist/{8996.js → 5595.js} +4 -3
- package/dist/5890.js +25 -0
- package/dist/{6046.js → 5969.js} +1 -1
- package/dist/5984.js +38 -0
- package/dist/{8527.js → 6006.js} +3 -3
- package/dist/6040.js +97 -0
- package/dist/{8758.js → 6137.js} +10 -8
- package/dist/{4281.js → 6140.js} +18 -10
- package/dist/{8960.js → 6191.js} +2 -2
- package/dist/6240.js +121 -0
- package/dist/{4490.js → 6373.js} +7 -5
- package/dist/{904.js → 6487.js} +19 -17
- package/dist/{9635.js → 6498.js} +1 -1
- package/dist/6499.js +4 -7
- package/dist/6508.js +7 -0
- package/dist/{8225.js → 6540.js} +1 -0
- package/dist/6551.js +46 -0
- package/dist/{9369.js → 6620.js} +35 -34
- package/dist/{4143.js → 6838.js} +19 -10
- package/dist/6902.js +48 -0
- package/dist/6904.js +51 -0
- package/dist/70.js +24 -0
- package/dist/7024.js +39 -0
- package/dist/{6882.js → 721.js} +737 -362
- package/dist/{951.js → 7270.js} +4 -4
- package/dist/{3485.js → 7323.js} +143 -111
- package/dist/{7541.js → 7488.js} +2 -2
- package/dist/{4863.js → 7542.js} +7 -6
- package/dist/7551.js +28 -0
- package/dist/{7021.js → 7640.js} +1 -1
- package/dist/{353.js → 7692.js} +3 -7
- package/dist/{4707.js → 7930.js} +2 -2
- package/dist/{8052.js → 8.js} +80 -64
- package/dist/{6914.js → 8129.js} +3 -15
- package/dist/{3319.js → 8358.js} +62 -63
- package/dist/{5864.js → 8407.js} +13 -13
- package/dist/8488.js +15 -0
- package/dist/{4768.js → 8495.js} +1 -1
- package/dist/8734.js +171 -0
- package/dist/{1763.js → 9018.js} +205 -331
- package/dist/9053.js +29 -0
- package/dist/9067.js +41 -0
- package/dist/{2861.js → 9120.js} +2 -2
- package/dist/{42.js → 9197.js} +2 -2
- package/dist/{9189.js → 9248.js} +36 -17
- package/dist/{2801.js → 9252.js} +4 -9
- package/dist/9295.js +7 -0
- package/dist/9303.js +8 -0
- package/dist/{167.js → 9374.js} +1 -1
- package/dist/{9352.js → 9540.js} +17 -47
- package/dist/9576.js +51 -0
- package/dist/{8272.js → 9591.js} +36 -46
- package/dist/{6107.js → 9770.js} +2 -2
- package/dist/{5085.js → 9880.js} +6 -3
- package/dist/Accordion/index.d.ts +207 -41
- package/dist/Accordion/index.js +75 -177
- package/dist/AlertDialog/index.d.ts +440 -140
- package/dist/AlertDialog/index.js +3 -13
- package/dist/Autocomplete/index.d.ts +722 -150
- package/dist/Autocomplete/index.js +16 -29
- package/dist/Avatar/index.d.ts +38 -3
- package/dist/Avatar/index.js +82 -28
- package/dist/Breadcrumbs/index.d.ts +63 -91
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/Button/index.d.ts +11 -0
- package/dist/Button/index.js +2 -2
- package/dist/Checkbox/index.d.ts +206 -36
- package/dist/Checkbox/index.js +293 -8
- package/dist/CheckboxField/index.css +1 -1
- package/dist/CheckboxField/index.d.ts +40 -36
- package/dist/CheckboxGroup/index.d.ts +50 -36
- package/dist/CheckboxGroup/index.js +87 -58
- package/dist/CheckboxGroupField/index.css +1 -1
- package/dist/Collapsible/index.d.ts +128 -36
- package/dist/Collapsible/index.js +21 -25
- package/dist/Combobox/index.d.ts +801 -158
- package/dist/Combobox/index.js +70 -114
- package/dist/ContextMenu/index.d.ts +1162 -195
- package/dist/ContextMenu/index.js +46 -36
- package/dist/Dialog/index.d.ts +425 -133
- package/dist/Dialog/index.js +8 -4
- package/dist/Drawer/index.d.ts +589 -144
- package/dist/Drawer/index.js +482 -562
- package/dist/Field/index.css +1 -1
- package/dist/Field/index.d.ts +341 -42
- package/dist/Field/index.js +123 -273
- package/dist/Fieldset/index.d.ts +11 -0
- package/dist/Fieldset/index.js +10 -17
- package/dist/Form/index.d.ts +43 -39
- package/dist/Form/index.js +58 -50
- package/dist/Input/index.css +1 -1
- package/dist/Input/index.d.ts +94 -42
- package/dist/Input/index.js +1 -1
- package/dist/Menu/index.d.ts +1140 -175
- package/dist/Menu/index.js +51 -67
- package/dist/Menubar/index.d.ts +651 -173
- package/dist/Menubar/index.js +12 -16
- package/dist/Meter/index.js +21 -18
- package/dist/NavigationMenu/index.d.ts +370 -86
- package/dist/NavigationMenu/index.js +144 -178
- package/dist/NumberField/index.css +1 -1
- package/dist/NumberField/index.d.ts +507 -47
- package/dist/NumberField/index.js +434 -718
- package/dist/Popover/index.d.ts +561 -142
- package/dist/Popover/index.js +181 -252
- package/dist/PreviewCard/index.d.ts +507 -143
- package/dist/PreviewCard/index.js +97 -151
- package/dist/Progress/index.d.ts +117 -3
- package/dist/Progress/index.js +37 -36
- package/dist/Radio/index.d.ts +177 -7
- package/dist/Radio/index.js +54 -70
- package/dist/RadioField/index.css +1 -1
- package/dist/RadioField/index.d.ts +23 -7
- package/dist/RadioGroup/index.d.ts +51 -37
- package/dist/RadioGroup/index.js +60 -51
- package/dist/RadioGroupField/index.css +1 -1
- package/dist/RadioGroupField/index.d.ts +40 -37
- package/dist/ScrollArea/index.d.ts +295 -1
- package/dist/ScrollArea/index.js +256 -324
- package/dist/Select/index.d.ts +516 -123
- package/dist/Select/index.js +513 -635
- package/dist/SelectField/index.css +1 -1
- package/dist/SelectField/index.d.ts +109 -134
- package/dist/SelectField/index.js +5 -1
- package/dist/Separator/index.d.ts +12 -0
- package/dist/Separator/index.js +1 -1
- package/dist/Slider/index.d.ts +383 -64
- package/dist/Slider/index.js +298 -374
- package/dist/Switch/index.d.ts +184 -37
- package/dist/Switch/index.js +44 -58
- package/dist/Tabs/index.d.ts +220 -35
- package/dist/Tabs/index.js +199 -193
- package/dist/Toast/index.d.ts +280 -64
- package/dist/Toast/index.js +299 -374
- package/dist/Toggle/index.d.ts +55 -35
- package/dist/Toggle/index.js +19 -13
- package/dist/ToggleGroup/index.d.ts +62 -35
- package/dist/ToggleGroup/index.js +13 -31
- package/dist/Toolbar/index.d.ts +117 -2
- package/dist/Toolbar/index.js +31 -43
- package/dist/Tooltip/index.d.ts +507 -150
- package/dist/Tooltip/index.js +163 -213
- package/dist/index.d.ts +12912 -5382
- package/package.json +3 -3
- package/dist/2205.js +0 -26
- package/dist/2274.js +0 -34
- package/dist/2287.js +0 -17
- package/dist/3020.js +0 -7
- package/dist/3021.js +0 -72
- package/dist/3140.js +0 -4
- package/dist/3248.js +0 -307
- package/dist/4026.js +0 -12
- package/dist/4922.js +0 -15
- package/dist/5659.js +0 -4
- package/dist/5992.js +0 -447
- package/dist/6330.js +0 -30
- package/dist/6535.js +0 -72
- package/dist/6917.js +0 -55
- package/dist/7725.js +0 -10
- package/dist/7871.js +0 -38
- package/dist/8106.js +0 -239
- package/dist/8685.js +0 -102
- package/dist/8935.js +0 -8
- package/dist/8971.js +0 -40
- package/dist/8979.js +0 -10
- package/dist/9048.js +0 -52
- package/dist/9087.js +0 -256
- package/dist/9255.js +0 -136
- /package/dist/{1457.js → 1068.js} +0 -0
- /package/dist/{6003.js → 1234.js} +0 -0
- /package/dist/{4723.js → 1282.js} +0 -0
- /package/dist/{6825.js → 1876.js} +0 -0
- /package/dist/{5778.js → 1885.js} +0 -0
- /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
- /package/dist/{1279.js → 3278.js} +0 -0
- /package/dist/{3296.js → 5568.js} +0 -0
- /package/dist/{8685.css → 6240.css} +0 -0
- /package/dist/{9829.js → 6488.js} +0 -0
- /package/dist/{9863.js → 6534.js} +0 -0
- /package/dist/{4495.js → 7718.js} +0 -0
- /package/dist/{3395.js → 8866.js} +0 -0
- /package/dist/{2418.js → 9837.js} +0 -0
package/dist/Fieldset/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useIsoLayoutEffect } from "../6499.js";
|
|
2
|
+
import { useFieldsetRootContext, FieldsetRootContext } from "../7692.js";
|
|
3
|
+
import { useRenderElement } from "../9591.js";
|
|
4
|
+
import { useRegisteredLabelId } from "../1093.js";
|
|
6
5
|
import * as __rspack_external_react from "react";
|
|
7
6
|
const FieldsetRoot_FieldsetRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
8
|
-
const { render, className, style, disabled = false, ...elementProps } = componentProps;
|
|
7
|
+
const { render, className, style, disabled: disabledProp = false, ...elementProps } = componentProps;
|
|
9
8
|
const [legendId, setLegendId] = __rspack_external_react.useState(void 0);
|
|
9
|
+
const parentDisabled = useFieldsetRootContext(true)?.disabled;
|
|
10
|
+
const disabled = parentDisabled || disabledProp;
|
|
10
11
|
const state = {
|
|
11
12
|
disabled
|
|
12
13
|
};
|
|
@@ -15,7 +16,8 @@ const FieldsetRoot_FieldsetRoot = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
15
16
|
state,
|
|
16
17
|
props: [
|
|
17
18
|
{
|
|
18
|
-
'aria-labelledby': legendId
|
|
19
|
+
'aria-labelledby': legendId,
|
|
20
|
+
disabled
|
|
19
21
|
},
|
|
20
22
|
elementProps
|
|
21
23
|
]
|
|
@@ -38,18 +40,9 @@ if ("production" !== process.env.NODE_ENV) FieldsetRoot_FieldsetRoot.displayName
|
|
|
38
40
|
const FieldsetLegend_FieldsetLegend = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
39
41
|
const { render, className, style, id: idProp, ...elementProps } = componentProps;
|
|
40
42
|
const { disabled, setLegendId } = useFieldsetRootContext();
|
|
41
|
-
const id =
|
|
42
|
-
useIsoLayoutEffect(()=>{
|
|
43
|
-
setLegendId(id);
|
|
44
|
-
return ()=>{
|
|
45
|
-
setLegendId(void 0);
|
|
46
|
-
};
|
|
47
|
-
}, [
|
|
48
|
-
setLegendId,
|
|
49
|
-
id
|
|
50
|
-
]);
|
|
43
|
+
const id = useRegisteredLabelId(idProp, setLegendId);
|
|
51
44
|
const state = {
|
|
52
|
-
disabled
|
|
45
|
+
disabled
|
|
53
46
|
};
|
|
54
47
|
const element = useRenderElement('div', componentProps, {
|
|
55
48
|
state,
|
package/dist/Form/index.d.ts
CHANGED
|
@@ -45,15 +45,15 @@ declare type BaseUIGenericEventDetail<Reason extends string, CustomProperties ex
|
|
|
45
45
|
|
|
46
46
|
declare type BaseUIGenericEventDetails<Reason extends string, CustomProperties extends object = {}> = Reason extends string ? BaseUIGenericEventDetail<Reason, CustomProperties> & {} : never;
|
|
47
47
|
|
|
48
|
-
declare const cancelOpen:
|
|
48
|
+
declare const cancelOpen: 'cancel-open';
|
|
49
49
|
|
|
50
|
-
declare const chipRemovePress:
|
|
50
|
+
declare const chipRemovePress: 'chip-remove-press';
|
|
51
51
|
|
|
52
|
-
declare const clearPress:
|
|
52
|
+
declare const clearPress: 'clear-press';
|
|
53
53
|
|
|
54
|
-
declare const closePress:
|
|
54
|
+
declare const closePress: 'close-press';
|
|
55
55
|
|
|
56
|
-
declare const closeWatcher:
|
|
56
|
+
declare const closeWatcher: 'close-watcher';
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Shape of the render prop: a function that takes props to be spread on the element and component's state and returns a React element.
|
|
@@ -63,15 +63,15 @@ declare const closeWatcher: "close-watcher";
|
|
|
63
63
|
*/
|
|
64
64
|
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
65
65
|
|
|
66
|
-
declare const decrementPress:
|
|
66
|
+
declare const decrementPress: 'decrement-press';
|
|
67
67
|
|
|
68
|
-
declare const disabled:
|
|
68
|
+
declare const disabled: 'disabled';
|
|
69
69
|
|
|
70
|
-
declare const drag:
|
|
70
|
+
declare const drag: 'drag';
|
|
71
71
|
|
|
72
72
|
declare type Errors = Record<string, string | string[]>;
|
|
73
73
|
|
|
74
|
-
declare const escapeKey:
|
|
74
|
+
declare const escapeKey: 'escape-key';
|
|
75
75
|
|
|
76
76
|
declare interface FieldValidityData {
|
|
77
77
|
state: {
|
|
@@ -93,7 +93,7 @@ declare interface FieldValidityData {
|
|
|
93
93
|
initialValue: unknown;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
declare const focusOut:
|
|
96
|
+
declare const focusOut: 'focus-out';
|
|
97
97
|
|
|
98
98
|
export declare const Form: React_2.ForwardRefExoticComponent<Omit<Omit<Form_2.Props<Record<string, any>> & {
|
|
99
99
|
ref?: React_2.Ref<HTMLFormElement> | undefined;
|
|
@@ -130,6 +130,7 @@ export declare interface FormActions {
|
|
|
130
130
|
declare interface FormContext {
|
|
131
131
|
errors: Errors;
|
|
132
132
|
clearErrors: (name: string | undefined) => void;
|
|
133
|
+
elementRef: React_2.RefObject<HTMLFormElement | null>;
|
|
133
134
|
formRef: React_2.RefObject<{
|
|
134
135
|
fields: Map<string, {
|
|
135
136
|
name: string | undefined;
|
|
@@ -144,12 +145,12 @@ declare interface FormContext {
|
|
|
144
145
|
}>;
|
|
145
146
|
}>;
|
|
146
147
|
validationMode: Form_2.ValidationMode;
|
|
147
|
-
|
|
148
|
+
submitCountRef: React_2.RefObject<number>;
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
declare const FormContext: React_2.Context<FormContext>;
|
|
151
152
|
|
|
152
|
-
export declare interface FormProps<FormValues extends Record<string, any> = Record<string, any>> extends BaseUIComponentProps<'form', FormState
|
|
153
|
+
export declare interface FormProps<FormValues extends Record<string, any> = Record<string, any>> extends BaseUIComponentProps<'form', FormState, React_2.ComponentPropsWithRef<'form'>> {
|
|
153
154
|
/**
|
|
154
155
|
* Determines when the form should be validated.
|
|
155
156
|
* The `validationMode` prop on `<Field.Root>` takes precedence over this.
|
|
@@ -178,10 +179,10 @@ export declare interface FormProps<FormValues extends Record<string, any> = Reco
|
|
|
178
179
|
* @example
|
|
179
180
|
* ```tsx
|
|
180
181
|
* // validate all fields
|
|
181
|
-
* actionsRef.current
|
|
182
|
+
* actionsRef.current?.validate();
|
|
182
183
|
*
|
|
183
184
|
* // validate one field
|
|
184
|
-
* actionsRef.current
|
|
185
|
+
* actionsRef.current?.validate('email');
|
|
185
186
|
* ```
|
|
186
187
|
*/
|
|
187
188
|
actionsRef?: React_2.RefObject<Form_2.Actions | null> | undefined;
|
|
@@ -199,37 +200,39 @@ declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
|
199
200
|
ref?: React_2.Ref<T> | undefined;
|
|
200
201
|
};
|
|
201
202
|
|
|
202
|
-
declare const imperativeAction:
|
|
203
|
+
declare const imperativeAction: 'imperative-action';
|
|
203
204
|
|
|
204
|
-
declare const incrementPress:
|
|
205
|
+
declare const incrementPress: 'increment-press';
|
|
205
206
|
|
|
206
|
-
declare const initial:
|
|
207
|
+
declare const initial: 'initial';
|
|
207
208
|
|
|
208
|
-
declare const inputBlur:
|
|
209
|
+
declare const inputBlur: 'input-blur';
|
|
209
210
|
|
|
210
|
-
declare const inputChange:
|
|
211
|
+
declare const inputChange: 'input-change';
|
|
211
212
|
|
|
212
|
-
declare const inputClear:
|
|
213
|
+
declare const inputClear: 'input-clear';
|
|
213
214
|
|
|
214
|
-
declare const inputPaste:
|
|
215
|
+
declare const inputPaste: 'input-paste';
|
|
215
216
|
|
|
216
|
-
declare const inputPress:
|
|
217
|
+
declare const inputPress: 'input-press';
|
|
217
218
|
|
|
218
|
-
declare const itemPress:
|
|
219
|
+
declare const itemPress: 'item-press';
|
|
219
220
|
|
|
220
|
-
declare const keyboard:
|
|
221
|
+
declare const keyboard: 'keyboard';
|
|
221
222
|
|
|
222
|
-
declare const linkPress:
|
|
223
|
+
declare const linkPress: 'link-press';
|
|
223
224
|
|
|
224
|
-
declare const listNavigation:
|
|
225
|
+
declare const listNavigation: 'list-navigation';
|
|
225
226
|
|
|
226
|
-
declare const missing:
|
|
227
|
+
declare const missing: 'missing';
|
|
227
228
|
|
|
228
|
-
declare const none:
|
|
229
|
+
declare const none: 'none';
|
|
229
230
|
|
|
230
|
-
declare const outsidePress:
|
|
231
|
+
declare const outsidePress: 'outside-press';
|
|
231
232
|
|
|
232
|
-
declare const pointer:
|
|
233
|
+
declare const pointer: 'pointer';
|
|
234
|
+
|
|
235
|
+
declare const popupClose: 'popup-close';
|
|
233
236
|
|
|
234
237
|
declare namespace REASONS {
|
|
235
238
|
export {
|
|
@@ -260,6 +263,7 @@ declare namespace REASONS {
|
|
|
260
263
|
drag,
|
|
261
264
|
wheel,
|
|
262
265
|
scrub,
|
|
266
|
+
popupClose,
|
|
263
267
|
cancelOpen,
|
|
264
268
|
siblingOpen,
|
|
265
269
|
disabled,
|
|
@@ -314,23 +318,23 @@ declare interface ReasonToEventMap {
|
|
|
314
318
|
[REASONS.windowResize]: UIEvent;
|
|
315
319
|
}
|
|
316
320
|
|
|
317
|
-
declare const scrub:
|
|
321
|
+
declare const scrub: 'scrub';
|
|
318
322
|
|
|
319
|
-
declare const siblingOpen:
|
|
323
|
+
declare const siblingOpen: 'sibling-open';
|
|
320
324
|
|
|
321
|
-
declare const swipe:
|
|
325
|
+
declare const swipe: 'swipe';
|
|
322
326
|
|
|
323
|
-
declare const trackPress:
|
|
327
|
+
declare const trackPress: 'track-press';
|
|
324
328
|
|
|
325
|
-
declare const triggerFocus:
|
|
329
|
+
declare const triggerFocus: 'trigger-focus';
|
|
326
330
|
|
|
327
|
-
declare const triggerHover:
|
|
331
|
+
declare const triggerHover: 'trigger-hover';
|
|
328
332
|
|
|
329
|
-
declare const triggerPress:
|
|
333
|
+
declare const triggerPress: 'trigger-press';
|
|
330
334
|
|
|
331
|
-
declare const wheel:
|
|
335
|
+
declare const wheel: 'wheel';
|
|
332
336
|
|
|
333
|
-
declare const windowResize:
|
|
337
|
+
declare const windowResize: 'window-resize';
|
|
334
338
|
|
|
335
339
|
/**
|
|
336
340
|
* Adds a `preventBaseUIHandler` method to all event handlers.
|
package/dist/Form/index.js
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useStableCallback } from "../
|
|
3
|
-
import { useValueChanged } from "../
|
|
4
|
-
import { useRenderElement, EMPTY_OBJECT } from "../
|
|
5
|
-
import { createGenericEventDetails } from "../
|
|
6
|
-
import { FormContext } from "../
|
|
2
|
+
import { useStableCallback } from "../7488.js";
|
|
3
|
+
import { useValueChanged } from "../9252.js";
|
|
4
|
+
import { useRenderElement, EMPTY_OBJECT } from "../9591.js";
|
|
5
|
+
import { createGenericEventDetails } from "../8495.js";
|
|
6
|
+
import { FormContext } from "../9880.js";
|
|
7
7
|
import * as __rspack_external_react from "react";
|
|
8
8
|
const Form_Form = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
9
9
|
const { render, className, validationMode = 'onSubmit', errors: externalErrors, onSubmit, onFormSubmit, actionsRef, style, ...elementProps } = componentProps;
|
|
10
10
|
const formRef = __rspack_external_react.useRef({
|
|
11
11
|
fields: new Map()
|
|
12
12
|
});
|
|
13
|
+
const elementRef = __rspack_external_react.useRef(null);
|
|
13
14
|
const submittedRef = __rspack_external_react.useRef(false);
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const submitCountRef = __rspack_external_react.useRef(0);
|
|
16
|
+
const focusFirstInvalid = useStableCallback(()=>{
|
|
17
|
+
let hasInvalid = false;
|
|
18
|
+
let firstControl = null;
|
|
19
|
+
for (const field of formRef.current.fields.values()){
|
|
20
|
+
if (false !== field.validityData.state.valid) continue;
|
|
21
|
+
hasInvalid = true;
|
|
22
|
+
const control = field.controlRef.current;
|
|
23
|
+
if (control && (!firstControl || comesBeforeInSameTree(control, firstControl))) firstControl = control;
|
|
24
|
+
}
|
|
25
|
+
if (firstControl) {
|
|
26
|
+
firstControl.focus();
|
|
27
|
+
if ('INPUT' === firstControl.tagName) firstControl.select();
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return hasInvalid;
|
|
19
31
|
});
|
|
20
32
|
const [errors, setErrors] = __rspack_external_react.useState(externalErrors);
|
|
21
33
|
useValueChanged(externalErrors, ()=>{
|
|
@@ -24,53 +36,42 @@ const Form_Form = /*#__PURE__*/ __rspack_external_react.forwardRef(function(comp
|
|
|
24
36
|
__rspack_external_react.useEffect(()=>{
|
|
25
37
|
if (!submittedRef.current) return;
|
|
26
38
|
submittedRef.current = false;
|
|
27
|
-
|
|
28
|
-
if (invalidFields.length) focusControl(invalidFields[0].controlRef.current);
|
|
39
|
+
focusFirstInvalid();
|
|
29
40
|
}, [
|
|
30
41
|
errors,
|
|
31
|
-
|
|
42
|
+
focusFirstInvalid
|
|
32
43
|
]);
|
|
33
|
-
const handleImperativeValidate = __rspack_external_react.useCallback((fieldName)=>{
|
|
34
|
-
const values = Array.from(formRef.current.fields.values());
|
|
35
|
-
if (fieldName) {
|
|
36
|
-
const namedField = values.find((field)=>field.name === fieldName);
|
|
37
|
-
if (namedField) namedField.validate();
|
|
38
|
-
} else values.forEach((field)=>{
|
|
39
|
-
field.validate();
|
|
40
|
-
});
|
|
41
|
-
}, []);
|
|
42
44
|
__rspack_external_react.useImperativeHandle(actionsRef, ()=>({
|
|
43
|
-
validate
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
validate (fieldName) {
|
|
46
|
+
if (fieldName) Array.from(formRef.current.fields.values()).find((field)=>field.name === fieldName)?.validate();
|
|
47
|
+
else formRef.current.fields.forEach((field)=>{
|
|
48
|
+
field.validate();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}), []);
|
|
47
52
|
const element = useRenderElement('form', componentProps, {
|
|
48
|
-
ref:
|
|
53
|
+
ref: [
|
|
54
|
+
forwardedRef,
|
|
55
|
+
elementRef
|
|
56
|
+
],
|
|
49
57
|
props: [
|
|
50
58
|
{
|
|
51
59
|
noValidate: true,
|
|
52
60
|
onSubmit (event) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
values.forEach((field)=>{
|
|
61
|
+
submitCountRef.current += 1;
|
|
62
|
+
formRef.current.fields.forEach((field)=>{
|
|
56
63
|
field.validate();
|
|
57
64
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
if (focusFirstInvalid()) return void event.preventDefault();
|
|
66
|
+
submittedRef.current = true;
|
|
67
|
+
onSubmit?.(event);
|
|
68
|
+
if (onFormSubmit) {
|
|
61
69
|
event.preventDefault();
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
event.preventDefault();
|
|
68
|
-
const formValues = values.reduce((acc, field)=>{
|
|
69
|
-
if (field.name) acc[field.name] = field.getValue();
|
|
70
|
-
return acc;
|
|
71
|
-
}, {});
|
|
72
|
-
onFormSubmit(formValues, createGenericEventDetails("none", event.nativeEvent));
|
|
73
|
-
}
|
|
70
|
+
const formValues = {};
|
|
71
|
+
formRef.current.fields.forEach((field)=>{
|
|
72
|
+
if (field.name) formValues[field.name] = field.getValue();
|
|
73
|
+
});
|
|
74
|
+
onFormSubmit(formValues, createGenericEventDetails("none", event.nativeEvent));
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
},
|
|
@@ -78,20 +79,23 @@ const Form_Form = /*#__PURE__*/ __rspack_external_react.forwardRef(function(comp
|
|
|
78
79
|
]
|
|
79
80
|
});
|
|
80
81
|
const clearErrors = useStableCallback((name)=>{
|
|
81
|
-
if (name
|
|
82
|
+
if (!name) return;
|
|
83
|
+
setErrors((previousErrors)=>{
|
|
84
|
+
if (!previousErrors || !Object.hasOwn(previousErrors, name)) return previousErrors;
|
|
82
85
|
const nextErrors = {
|
|
83
|
-
...
|
|
86
|
+
...previousErrors
|
|
84
87
|
};
|
|
85
88
|
delete nextErrors[name];
|
|
86
|
-
|
|
87
|
-
}
|
|
89
|
+
return nextErrors;
|
|
90
|
+
});
|
|
88
91
|
});
|
|
89
92
|
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
93
|
+
elementRef,
|
|
90
94
|
formRef,
|
|
91
95
|
validationMode,
|
|
92
96
|
errors: errors ?? EMPTY_OBJECT,
|
|
93
97
|
clearErrors,
|
|
94
|
-
|
|
98
|
+
submitCountRef
|
|
95
99
|
}), [
|
|
96
100
|
formRef,
|
|
97
101
|
validationMode,
|
|
@@ -104,6 +108,10 @@ const Form_Form = /*#__PURE__*/ __rspack_external_react.forwardRef(function(comp
|
|
|
104
108
|
});
|
|
105
109
|
});
|
|
106
110
|
if ("production" !== process.env.NODE_ENV) Form_Form.displayName = "Form";
|
|
111
|
+
function comesBeforeInSameTree(element, reference) {
|
|
112
|
+
const position = element.compareDocumentPosition(reference);
|
|
113
|
+
return (position & Node.DOCUMENT_POSITION_DISCONNECTED) === 0 && (position & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
|
|
114
|
+
}
|
|
107
115
|
const Form_Form_Form = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Form_Form, {
|
|
108
116
|
ref: ref,
|
|
109
117
|
className: className,
|
package/dist/Input/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "../
|
|
1
|
+
@import "../6240.css";
|
package/dist/Input/index.d.ts
CHANGED
|
@@ -82,15 +82,15 @@ declare type BaseUIGenericEventDetail<Reason extends string, CustomProperties ex
|
|
|
82
82
|
|
|
83
83
|
declare type BaseUIGenericEventDetails<Reason extends string, CustomProperties extends object = {}> = Reason extends string ? BaseUIGenericEventDetail<Reason, CustomProperties> & {} : never;
|
|
84
84
|
|
|
85
|
-
declare const cancelOpen:
|
|
85
|
+
declare const cancelOpen: 'cancel-open';
|
|
86
86
|
|
|
87
|
-
declare const chipRemovePress:
|
|
87
|
+
declare const chipRemovePress: 'chip-remove-press';
|
|
88
88
|
|
|
89
|
-
declare const clearPress:
|
|
89
|
+
declare const clearPress: 'clear-press';
|
|
90
90
|
|
|
91
|
-
declare const closePress:
|
|
91
|
+
declare const closePress: 'close-press';
|
|
92
92
|
|
|
93
|
-
declare const closeWatcher:
|
|
93
|
+
declare const closeWatcher: 'close-watcher';
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Shape of the render prop: a function that takes props to be spread on the element and component's state and returns a React element.
|
|
@@ -100,15 +100,25 @@ declare const closeWatcher: "close-watcher";
|
|
|
100
100
|
*/
|
|
101
101
|
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
102
102
|
|
|
103
|
-
declare const decrementPress:
|
|
103
|
+
declare const decrementPress: 'decrement-press';
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Present when the input's value has changed (when wrapped in Field.Root).
|
|
107
|
+
*/
|
|
108
|
+
declare const dirty = "data-dirty";
|
|
106
109
|
|
|
107
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Present when the input is disabled.
|
|
112
|
+
*/
|
|
113
|
+
declare const disabled = "data-disabled";
|
|
114
|
+
|
|
115
|
+
declare const disabled_2: 'disabled';
|
|
116
|
+
|
|
117
|
+
declare const drag: 'drag';
|
|
108
118
|
|
|
109
119
|
declare type Errors = Record<string, string | string[]>;
|
|
110
120
|
|
|
111
|
-
declare const escapeKey:
|
|
121
|
+
declare const escapeKey: 'escape-key';
|
|
112
122
|
|
|
113
123
|
export declare namespace Field {
|
|
114
124
|
export {
|
|
@@ -285,11 +295,12 @@ declare interface FieldRootProps extends BaseUIComponentProps<'div', FieldRootSt
|
|
|
285
295
|
name?: string | undefined;
|
|
286
296
|
/**
|
|
287
297
|
* A function for custom validation. Return a string or an array of strings with
|
|
288
|
-
* the error message(s) if the value is invalid,
|
|
298
|
+
* the error message(s) if the value is invalid. Returning nothing, `null`, an empty
|
|
299
|
+
* string, or an empty array means the value is valid.
|
|
289
300
|
* Asynchronous functions are supported, but they do not prevent form submission
|
|
290
301
|
* when using `validationMode="onSubmit"`.
|
|
291
302
|
*/
|
|
292
|
-
validate?: ((value: unknown, formValues: Form.Values) => string | string[] | null | Promise<string | string[] | null>) | undefined;
|
|
303
|
+
validate?: ((value: unknown, formValues: Form.Values) => string | string[] | null | void | Promise<string | string[] | null | void>) | undefined;
|
|
293
304
|
/**
|
|
294
305
|
* Determines when the field should be validated.
|
|
295
306
|
* This takes precedence over the `validationMode` prop on `<Form>`.
|
|
@@ -415,7 +426,17 @@ declare interface FieldValidityState extends Omit<FieldValidityData, 'state'> {
|
|
|
415
426
|
transitionStatus: TransitionStatus;
|
|
416
427
|
}
|
|
417
428
|
|
|
418
|
-
|
|
429
|
+
/**
|
|
430
|
+
* Present when the input is filled (when wrapped in Field.Root).
|
|
431
|
+
*/
|
|
432
|
+
declare const filled = "data-filled";
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Present when the input is focused (when wrapped in Field.Root).
|
|
436
|
+
*/
|
|
437
|
+
declare const focused = "data-focused";
|
|
438
|
+
|
|
439
|
+
declare const focusOut: 'focus-out';
|
|
419
440
|
|
|
420
441
|
/**
|
|
421
442
|
* A native form element with consolidated error handling.
|
|
@@ -446,6 +467,7 @@ declare interface FormActions {
|
|
|
446
467
|
declare interface FormContext {
|
|
447
468
|
errors: Errors;
|
|
448
469
|
clearErrors: (name: string | undefined) => void;
|
|
470
|
+
elementRef: React_2.RefObject<HTMLFormElement | null>;
|
|
449
471
|
formRef: React_2.RefObject<{
|
|
450
472
|
fields: Map<string, {
|
|
451
473
|
name: string | undefined;
|
|
@@ -460,12 +482,12 @@ declare interface FormContext {
|
|
|
460
482
|
}>;
|
|
461
483
|
}>;
|
|
462
484
|
validationMode: Form.ValidationMode;
|
|
463
|
-
|
|
485
|
+
submitCountRef: React_2.RefObject<number>;
|
|
464
486
|
}
|
|
465
487
|
|
|
466
488
|
declare const FormContext: React_2.Context<FormContext>;
|
|
467
489
|
|
|
468
|
-
declare interface FormProps<FormValues extends Record<string, any> = Record<string, any>> extends BaseUIComponentProps<'form', FormState
|
|
490
|
+
declare interface FormProps<FormValues extends Record<string, any> = Record<string, any>> extends BaseUIComponentProps<'form', FormState, React_2.ComponentPropsWithRef<'form'>> {
|
|
469
491
|
/**
|
|
470
492
|
* Determines when the form should be validated.
|
|
471
493
|
* The `validationMode` prop on `<Field.Root>` takes precedence over this.
|
|
@@ -494,10 +516,10 @@ declare interface FormProps<FormValues extends Record<string, any> = Record<stri
|
|
|
494
516
|
* @example
|
|
495
517
|
* ```tsx
|
|
496
518
|
* // validate all fields
|
|
497
|
-
* actionsRef.current
|
|
519
|
+
* actionsRef.current?.validate();
|
|
498
520
|
*
|
|
499
521
|
* // validate one field
|
|
500
|
-
* actionsRef.current
|
|
522
|
+
* actionsRef.current?.validate('email');
|
|
501
523
|
* ```
|
|
502
524
|
*/
|
|
503
525
|
actionsRef?: React_2.RefObject<Form.Actions | null> | undefined;
|
|
@@ -515,11 +537,11 @@ declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
|
515
537
|
ref?: React_2.Ref<T> | undefined;
|
|
516
538
|
};
|
|
517
539
|
|
|
518
|
-
declare const imperativeAction:
|
|
540
|
+
declare const imperativeAction: 'imperative-action';
|
|
519
541
|
|
|
520
|
-
declare const incrementPress:
|
|
542
|
+
declare const incrementPress: 'increment-press';
|
|
521
543
|
|
|
522
|
-
declare const initial:
|
|
544
|
+
declare const initial: 'initial';
|
|
523
545
|
|
|
524
546
|
export declare const Input: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<InputProps_2, "ref"> & React_2.RefAttributes<HTMLElement>, "ref">, "className"> & {
|
|
525
547
|
className?: string;
|
|
@@ -540,19 +562,31 @@ declare namespace Input_2 {
|
|
|
540
562
|
type ChangeEventDetails = InputChangeEventDetails;
|
|
541
563
|
}
|
|
542
564
|
|
|
543
|
-
declare const inputBlur:
|
|
565
|
+
declare const inputBlur: 'input-blur';
|
|
544
566
|
|
|
545
|
-
declare const inputChange:
|
|
567
|
+
declare const inputChange: 'input-change';
|
|
546
568
|
|
|
547
569
|
export declare type InputChangeEventDetails = Field.Control.ChangeEventDetails;
|
|
548
570
|
|
|
549
571
|
export declare type InputChangeEventReason = Field.Control.ChangeEventReason;
|
|
550
572
|
|
|
551
|
-
declare const inputClear:
|
|
573
|
+
declare const inputClear: 'input-clear';
|
|
574
|
+
|
|
575
|
+
export declare namespace InputDataAttributes {
|
|
576
|
+
export {
|
|
577
|
+
disabled,
|
|
578
|
+
valid,
|
|
579
|
+
invalid,
|
|
580
|
+
touched,
|
|
581
|
+
dirty,
|
|
582
|
+
filled,
|
|
583
|
+
focused
|
|
584
|
+
}
|
|
585
|
+
}
|
|
552
586
|
|
|
553
|
-
declare const inputPaste:
|
|
587
|
+
declare const inputPaste: 'input-paste';
|
|
554
588
|
|
|
555
|
-
declare const inputPress:
|
|
589
|
+
declare const inputPress: 'input-press';
|
|
556
590
|
|
|
557
591
|
export declare interface InputProps extends BaseUIComponentProps<'input', InputState> {
|
|
558
592
|
/**
|
|
@@ -571,21 +605,28 @@ export declare interface InputProps extends BaseUIComponentProps<'input', InputS
|
|
|
571
605
|
|
|
572
606
|
export declare interface InputState extends FieldControlState {}
|
|
573
607
|
|
|
574
|
-
|
|
608
|
+
/**
|
|
609
|
+
* Present when the input is in an invalid state (when wrapped in Field.Root).
|
|
610
|
+
*/
|
|
611
|
+
declare const invalid = "data-invalid";
|
|
612
|
+
|
|
613
|
+
declare const itemPress: 'item-press';
|
|
614
|
+
|
|
615
|
+
declare const keyboard: 'keyboard';
|
|
575
616
|
|
|
576
|
-
declare const
|
|
617
|
+
declare const linkPress: 'link-press';
|
|
577
618
|
|
|
578
|
-
declare const
|
|
619
|
+
declare const listNavigation: 'list-navigation';
|
|
579
620
|
|
|
580
|
-
declare const
|
|
621
|
+
declare const missing: 'missing';
|
|
581
622
|
|
|
582
|
-
declare const
|
|
623
|
+
declare const none: 'none';
|
|
583
624
|
|
|
584
|
-
declare const
|
|
625
|
+
declare const outsidePress: 'outside-press';
|
|
585
626
|
|
|
586
|
-
declare const
|
|
627
|
+
declare const pointer: 'pointer';
|
|
587
628
|
|
|
588
|
-
declare const
|
|
629
|
+
declare const popupClose: 'popup-close';
|
|
589
630
|
|
|
590
631
|
declare namespace REASONS {
|
|
591
632
|
export {
|
|
@@ -616,9 +657,10 @@ declare namespace REASONS {
|
|
|
616
657
|
drag,
|
|
617
658
|
wheel,
|
|
618
659
|
scrub,
|
|
660
|
+
popupClose,
|
|
619
661
|
cancelOpen,
|
|
620
662
|
siblingOpen,
|
|
621
|
-
disabled,
|
|
663
|
+
disabled_2 as disabled,
|
|
622
664
|
missing,
|
|
623
665
|
initial,
|
|
624
666
|
imperativeAction,
|
|
@@ -670,25 +712,35 @@ declare interface ReasonToEventMap {
|
|
|
670
712
|
[REASONS.windowResize]: UIEvent;
|
|
671
713
|
}
|
|
672
714
|
|
|
673
|
-
declare const scrub:
|
|
715
|
+
declare const scrub: 'scrub';
|
|
716
|
+
|
|
717
|
+
declare const siblingOpen: 'sibling-open';
|
|
674
718
|
|
|
675
|
-
declare const
|
|
719
|
+
declare const swipe: 'swipe';
|
|
676
720
|
|
|
677
|
-
|
|
721
|
+
/**
|
|
722
|
+
* Present when the input has been touched (when wrapped in Field.Root).
|
|
723
|
+
*/
|
|
724
|
+
declare const touched = "data-touched";
|
|
678
725
|
|
|
679
|
-
declare const trackPress:
|
|
726
|
+
declare const trackPress: 'track-press';
|
|
680
727
|
|
|
681
728
|
declare type TransitionStatus = 'starting' | 'ending' | 'idle' | undefined;
|
|
682
729
|
|
|
683
|
-
declare const triggerFocus:
|
|
730
|
+
declare const triggerFocus: 'trigger-focus';
|
|
684
731
|
|
|
685
|
-
declare const triggerHover:
|
|
732
|
+
declare const triggerHover: 'trigger-hover';
|
|
686
733
|
|
|
687
|
-
declare const triggerPress:
|
|
734
|
+
declare const triggerPress: 'trigger-press';
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Present when the input is in a valid state (when wrapped in Field.Root).
|
|
738
|
+
*/
|
|
739
|
+
declare const valid = "data-valid";
|
|
688
740
|
|
|
689
|
-
declare const wheel:
|
|
741
|
+
declare const wheel: 'wheel';
|
|
690
742
|
|
|
691
|
-
declare const windowResize:
|
|
743
|
+
declare const windowResize: 'window-resize';
|
|
692
744
|
|
|
693
745
|
/**
|
|
694
746
|
* Adds a `preventBaseUIHandler` method to all event handlers.
|
package/dist/Input/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import { Input_module, FieldControl_FieldControl } from "../
|
|
3
|
+
import { Input_module, FieldControl_FieldControl } from "../6240.js";
|
|
4
4
|
import * as __rspack_external_react from "react";
|
|
5
5
|
const Input_Input = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
6
6
|
return /*#__PURE__*/ jsx(FieldControl_FieldControl, {
|