@iress-oss/ids-components 6.0.0-alpha.3 → 6.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.js +1 -1
- package/dist/index.esm-BiUTGNH8.js +1080 -0
- package/dist/patterns/Form/Form.js +8 -11
- package/dist/patterns/Form/FormField/FormField.js +10 -10
- package/dist/patterns/Form/FormField/FormFieldset.js +5 -5
- package/dist/patterns/Form/HookForm/HookForm.js +54 -56
- package/dist/patterns/Form/components/LongForm.js +5 -5
- package/dist/patterns/Form/components/ShortForm.js +5 -5
- package/dist/patterns/Shadow/Shadow.js +82 -423
- package/dist/src/patterns/Form/Form.d.ts +2 -4
- package/dist/src/patterns/Form/HookForm/HookForm.d.ts +2 -34
- package/dist/style.css +1 -1
- package/package.json +25 -10
- package/dist/index.esm-B6vzbp0e.js +0 -1215
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
r.useForm = a;
|
|
9
|
-
r.useFormContext = u;
|
|
10
|
-
r.useWatch = n;
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as i } from "react";
|
|
3
|
+
import { LongForm as n } from "./components/LongForm.js";
|
|
4
|
+
import { ShortForm as s } from "./components/ShortForm.js";
|
|
5
|
+
const t = ({ pattern: f, ...r }, o) => f === "long" ? /* @__PURE__ */ m(n, { ...r, ref: o }) : /* @__PURE__ */ m(s, { ...r, ref: o });
|
|
6
|
+
t.displayName = "IressForm";
|
|
7
|
+
const c = i(t);
|
|
11
8
|
export {
|
|
12
|
-
|
|
9
|
+
c as IressForm
|
|
13
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as I, useRef as M, useMemo as
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as I, useRef as M, useMemo as d, useEffect as E } from "react";
|
|
3
|
+
import { a as x } from "../../../index.esm-BiUTGNH8.js";
|
|
4
4
|
import { getErrorTypeMessage as _ } from "./helpers/getErrorTypeMessage.js";
|
|
5
5
|
import { FormContext as $ } from "../FormContext.js";
|
|
6
6
|
import { transformCustomRulesToValidateRule as v } from "./helpers/transformCustomRulesToValidateRule.js";
|
|
@@ -25,16 +25,16 @@ const G = ({
|
|
|
25
25
|
throw new Error(
|
|
26
26
|
"IressFormField must be used inside an IressForm. If you need a standalone field, use IressField instead."
|
|
27
27
|
);
|
|
28
|
-
const
|
|
28
|
+
const m = d(() => {
|
|
29
29
|
if (!e)
|
|
30
30
|
return s ? v(s) : void 0;
|
|
31
31
|
}, [e, s]), { field: c, fieldState: t } = x({
|
|
32
32
|
control: f,
|
|
33
33
|
defaultValue: p,
|
|
34
34
|
name: r,
|
|
35
|
-
rules:
|
|
35
|
+
rules: m,
|
|
36
36
|
shouldUnregister: l
|
|
37
|
-
}), i =
|
|
37
|
+
}), i = d(
|
|
38
38
|
() => t.error ? _(
|
|
39
39
|
t.error?.message,
|
|
40
40
|
t.error?.type,
|
|
@@ -45,17 +45,17 @@ const G = ({
|
|
|
45
45
|
E(() => {
|
|
46
46
|
e ? o.setErrorMessage(r, "") : o.setErrorMessage(r, i);
|
|
47
47
|
}, [i, o, r, e]);
|
|
48
|
-
const
|
|
49
|
-
return /* @__PURE__ */
|
|
48
|
+
const a = T(c, F);
|
|
49
|
+
return /* @__PURE__ */ g(
|
|
50
50
|
q,
|
|
51
51
|
{
|
|
52
52
|
errorMessages: i && !e ? [{ message: i }] : void 0,
|
|
53
53
|
readOnly: e,
|
|
54
|
-
required: !!
|
|
54
|
+
required: !!m?.required,
|
|
55
55
|
htmlFor: `${o.id}__${r}`,
|
|
56
56
|
...u,
|
|
57
57
|
children: n({
|
|
58
|
-
...
|
|
58
|
+
...a,
|
|
59
59
|
id: `${o.id}__${r}`
|
|
60
60
|
})
|
|
61
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as F } from "react/jsx-runtime";
|
|
2
2
|
import { useContext as c, useRef as g, useMemo as I, useEffect as M } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { a as x } from "../../../index.esm-BiUTGNH8.js";
|
|
4
4
|
import { getErrorTypeMessage as E } from "./helpers/getErrorTypeMessage.js";
|
|
5
5
|
import "../../../components/Label/Label.styles.js";
|
|
6
6
|
import "../../../components/Field/Field.styles.js";
|
|
@@ -12,8 +12,8 @@ import { FormContext as q } from "../FormContext.js";
|
|
|
12
12
|
import { transformCustomRulesToValidateRule as v } from "./helpers/transformCustomRulesToValidateRule.js";
|
|
13
13
|
import { useFieldRenderProps as G } from "./hooks/useFieldRenderProps.js";
|
|
14
14
|
const B = ({
|
|
15
|
-
control:
|
|
16
|
-
defaultValue:
|
|
15
|
+
control: m,
|
|
16
|
+
defaultValue: d,
|
|
17
17
|
name: r,
|
|
18
18
|
render: f,
|
|
19
19
|
rules: e,
|
|
@@ -26,8 +26,8 @@ const B = ({
|
|
|
26
26
|
"IressFormFieldset must be used inside an IressForm. If you need a standalone field, use IressFieldGroup instead."
|
|
27
27
|
);
|
|
28
28
|
const i = e ? v(e) : void 0, { field: u, fieldState: s } = x({
|
|
29
|
-
control:
|
|
30
|
-
defaultValue:
|
|
29
|
+
control: m,
|
|
30
|
+
defaultValue: d,
|
|
31
31
|
name: r,
|
|
32
32
|
rules: i,
|
|
33
33
|
shouldUnregister: n
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import { useIdIfNeeded as
|
|
5
|
-
import { IressFormValidationSummary as
|
|
6
|
-
import { s as
|
|
7
|
-
import { FormContext as
|
|
8
|
-
import { c as
|
|
9
|
-
import { GlobalCSSClass as
|
|
10
|
-
import { propagateTestid as
|
|
11
|
-
const
|
|
12
|
-
alert:
|
|
13
|
-
children:
|
|
14
|
-
className:
|
|
1
|
+
import { jsx as f, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as J, useState as U, useRef as m, useCallback as n, useImperativeHandle as K, useEffect as V, useMemo as L } from "react";
|
|
3
|
+
import { F as W } from "../../../index.esm-BiUTGNH8.js";
|
|
4
|
+
import { useIdIfNeeded as X } from "../../../hooks/useIdIfNeeded.js";
|
|
5
|
+
import { IressFormValidationSummary as Y } from "../FormValidationSummary/FormValidationSummary.js";
|
|
6
|
+
import { s as Z } from "../../../factory-oPXoMw9H.js";
|
|
7
|
+
import { FormContext as $ } from "../FormContext.js";
|
|
8
|
+
import { c as y } from "../../../cx-DN21T1EH.js";
|
|
9
|
+
import { GlobalCSSClass as O } from "../../../enums.js";
|
|
10
|
+
import { propagateTestid as S } from "../../../helpers/utility/propagateTestid.js";
|
|
11
|
+
const _ = ({
|
|
12
|
+
alert: G,
|
|
13
|
+
children: T,
|
|
14
|
+
className: b,
|
|
15
15
|
"data-testid": d,
|
|
16
16
|
form: o,
|
|
17
|
-
onSubmit:
|
|
17
|
+
onSubmit: u,
|
|
18
18
|
onValidChange: p,
|
|
19
|
-
onError:
|
|
19
|
+
onError: F,
|
|
20
20
|
updateErrorSummaryOnSubmit: s,
|
|
21
21
|
...g
|
|
22
|
-
},
|
|
23
|
-
const
|
|
22
|
+
}, h) => {
|
|
23
|
+
const a = X({ id: g.id }), [r, i] = U({}), c = m({}), v = m(null), M = m(null), { handleSubmit: x, reset: q, formState: z } = o, { isValid: H, isSubmitted: I } = z, [C, N] = U(!1), R = n(
|
|
24
24
|
(e) => {
|
|
25
|
-
|
|
25
|
+
F?.(e), v.current?.focus(), s && N(!0);
|
|
26
26
|
},
|
|
27
|
-
[
|
|
27
|
+
[F, s]
|
|
28
28
|
), j = n(
|
|
29
29
|
(e) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
30
|
+
x((t) => {
|
|
31
|
+
u?.(t), i({}), c.current = {};
|
|
32
|
+
}, R)(e);
|
|
33
33
|
},
|
|
34
|
-
[
|
|
34
|
+
[R, x, u]
|
|
35
35
|
), k = n(
|
|
36
36
|
(e) => {
|
|
37
37
|
c.current = e();
|
|
38
38
|
},
|
|
39
39
|
[]
|
|
40
|
-
),
|
|
40
|
+
), w = n(
|
|
41
41
|
(e) => {
|
|
42
42
|
v.current = e;
|
|
43
43
|
},
|
|
44
44
|
[]
|
|
45
|
-
),
|
|
45
|
+
), P = n(
|
|
46
46
|
(e, t) => {
|
|
47
47
|
if (t === r[e] || !t && !r[e])
|
|
48
48
|
return;
|
|
49
|
-
const
|
|
50
|
-
(
|
|
51
|
-
...
|
|
52
|
-
[l]: l === e ? t :
|
|
49
|
+
const B = s ? c.current : r, Q = [...o.control._names.mount.values()].reduce(
|
|
50
|
+
(D, l) => ({
|
|
51
|
+
...D,
|
|
52
|
+
[l]: l === e ? t : B[l]
|
|
53
53
|
}),
|
|
54
54
|
{}
|
|
55
55
|
);
|
|
56
|
-
s ? k(() =>
|
|
56
|
+
s ? k(() => Q) : i(() => Q);
|
|
57
57
|
},
|
|
58
58
|
[
|
|
59
59
|
r,
|
|
@@ -62,52 +62,50 @@ const te = ({
|
|
|
62
62
|
s
|
|
63
63
|
]
|
|
64
64
|
);
|
|
65
|
-
|
|
65
|
+
K(h, () => ({
|
|
66
66
|
element: M?.current ?? void 0,
|
|
67
67
|
api: o,
|
|
68
68
|
submit: () => j(),
|
|
69
|
-
reset: (e) =>
|
|
70
|
-
})),
|
|
69
|
+
reset: (e) => q(e)
|
|
70
|
+
})), V(() => {
|
|
71
71
|
p?.(H);
|
|
72
|
-
}, [H, p]),
|
|
73
|
-
s &&
|
|
74
|
-
}, [s,
|
|
75
|
-
const
|
|
72
|
+
}, [H, p]), V(() => {
|
|
73
|
+
s && C && I && (i(() => c.current), N(!1));
|
|
74
|
+
}, [s, C, I]);
|
|
75
|
+
const A = L(
|
|
76
76
|
() => ({
|
|
77
|
-
id:
|
|
77
|
+
id: a,
|
|
78
78
|
errorMessages: r,
|
|
79
|
-
setErrorMessage:
|
|
80
|
-
setFocusOnError:
|
|
79
|
+
setErrorMessage: P,
|
|
80
|
+
setFocusOnError: w
|
|
81
81
|
}),
|
|
82
|
-
[r,
|
|
82
|
+
[r, a, P, w]
|
|
83
83
|
);
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
-
|
|
84
|
+
return /* @__PURE__ */ f($.Provider, { value: A, children: /* @__PURE__ */ f(W, { ...o, children: /* @__PURE__ */ E(
|
|
85
|
+
Z.form,
|
|
86
86
|
{
|
|
87
87
|
...g,
|
|
88
|
-
className:
|
|
88
|
+
className: y(b, O.Form),
|
|
89
89
|
"data-testid": d,
|
|
90
|
-
id:
|
|
90
|
+
id: a,
|
|
91
91
|
noValidate: !0,
|
|
92
92
|
onSubmit: j,
|
|
93
93
|
ref: M,
|
|
94
94
|
children: [
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
G ?? /* @__PURE__ */ f(
|
|
96
|
+
Y,
|
|
97
97
|
{
|
|
98
|
-
"data-testid":
|
|
98
|
+
"data-testid": S(d, "error-summary"),
|
|
99
99
|
srOnly: !0
|
|
100
100
|
}
|
|
101
101
|
),
|
|
102
|
-
|
|
102
|
+
T
|
|
103
103
|
]
|
|
104
104
|
}
|
|
105
105
|
) }) });
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
a.useFormContext = Y;
|
|
110
|
-
a.useWatch = Z;
|
|
106
|
+
};
|
|
107
|
+
_.displayName = "IressHookForm";
|
|
108
|
+
const fe = J(_);
|
|
111
109
|
export {
|
|
112
|
-
|
|
110
|
+
fe as IressHookForm
|
|
113
111
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { u as L } from "../../../index.esm-BiUTGNH8.js";
|
|
3
3
|
import { forwardRef as y, useMemo as z } from "react";
|
|
4
4
|
import { IressText as B } from "../../../components/Text/Text.js";
|
|
5
5
|
import { form as C } from "../Form.styles.js";
|
|
@@ -20,9 +20,9 @@ const T = ({
|
|
|
20
20
|
delayError: p,
|
|
21
21
|
footer: t,
|
|
22
22
|
heading: o,
|
|
23
|
-
mode:
|
|
23
|
+
mode: u = "onBlur",
|
|
24
24
|
panelStyle: n = { bg: "alt" },
|
|
25
|
-
progressive:
|
|
25
|
+
progressive: g,
|
|
26
26
|
resetOptions: F,
|
|
27
27
|
resolver: N,
|
|
28
28
|
reValidateMode: x = "onChange",
|
|
@@ -37,8 +37,8 @@ const T = ({
|
|
|
37
37
|
context: d,
|
|
38
38
|
defaultValues: h,
|
|
39
39
|
delayError: p,
|
|
40
|
-
mode:
|
|
41
|
-
progressive:
|
|
40
|
+
mode: u,
|
|
41
|
+
progressive: g,
|
|
42
42
|
resetOptions: F,
|
|
43
43
|
resolver: N,
|
|
44
44
|
reValidateMode: x,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as H, jsxs as I } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { u as b } from "../../../index.esm-BiUTGNH8.js";
|
|
3
3
|
import { forwardRef as g, useMemo as w } from "react";
|
|
4
4
|
import { form as C } from "../Form.styles.js";
|
|
5
5
|
import { IressHookForm as E } from "../HookForm/HookForm.js";
|
|
@@ -16,8 +16,8 @@ const R = ({
|
|
|
16
16
|
delayError: c,
|
|
17
17
|
heading: o,
|
|
18
18
|
mode: i = "onSubmit",
|
|
19
|
-
progressive:
|
|
20
|
-
resetOptions:
|
|
19
|
+
progressive: u,
|
|
20
|
+
resetOptions: a,
|
|
21
21
|
resolver: h,
|
|
22
22
|
reValidateMode: p = "onChange",
|
|
23
23
|
shouldUseNativeValidation: F,
|
|
@@ -31,8 +31,8 @@ const R = ({
|
|
|
31
31
|
defaultValues: f,
|
|
32
32
|
delayError: c,
|
|
33
33
|
mode: i,
|
|
34
|
-
progressive:
|
|
35
|
-
resetOptions:
|
|
34
|
+
progressive: u,
|
|
35
|
+
resetOptions: a,
|
|
36
36
|
resolver: h,
|
|
37
37
|
reValidateMode: p,
|
|
38
38
|
shouldFocusError: !r,
|