@axenstudio/axen-form 0.1.4 → 0.1.6
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/fields/AutocompleteField/AutocompleteField.cjs +10 -2
- package/dist/fields/AutocompleteField/AutocompleteField.d.ts +1 -1
- package/dist/fields/AutocompleteField/AutocompleteField.d.ts.map +1 -1
- package/dist/fields/AutocompleteField/AutocompleteField.js +10 -2
- package/dist/fields/AutocompleteMultiField/AutocompleteMultiField.cjs +11 -0
- package/dist/fields/AutocompleteMultiField/AutocompleteMultiField.d.ts +1 -1
- package/dist/fields/AutocompleteMultiField/AutocompleteMultiField.d.ts.map +1 -1
- package/dist/fields/AutocompleteMultiField/AutocompleteMultiField.js +11 -0
- package/dist/fields/AutocompletePredictField/AutocompletePredictField.cjs +10 -2
- package/dist/fields/AutocompletePredictField/AutocompletePredictField.d.ts +1 -1
- package/dist/fields/AutocompletePredictField/AutocompletePredictField.d.ts.map +1 -1
- package/dist/fields/AutocompletePredictField/AutocompletePredictField.js +10 -2
- package/dist/fields/DateField/DateField.cjs +26 -19
- package/dist/fields/DateField/DateField.d.ts +1 -1
- package/dist/fields/DateField/DateField.d.ts.map +1 -1
- package/dist/fields/DateField/DateField.js +27 -20
- package/dist/fields/DateTimeField/DateTimeField.cjs +26 -19
- package/dist/fields/DateTimeField/DateTimeField.d.ts +1 -1
- package/dist/fields/DateTimeField/DateTimeField.d.ts.map +1 -1
- package/dist/fields/DateTimeField/DateTimeField.js +27 -20
- package/dist/fields/EmailField/EmailField.cjs +24 -39
- package/dist/fields/EmailField/EmailField.d.ts +1 -1
- package/dist/fields/EmailField/EmailField.d.ts.map +1 -1
- package/dist/fields/EmailField/EmailField.js +25 -40
- package/dist/fields/NumberField/NumberField.cjs +21 -5
- package/dist/fields/NumberField/NumberField.d.ts +1 -1
- package/dist/fields/NumberField/NumberField.d.ts.map +1 -1
- package/dist/fields/NumberField/NumberField.js +21 -5
- package/dist/fields/PasswordField/PasswordField.cjs +12 -3
- package/dist/fields/PasswordField/PasswordField.d.ts +1 -1
- package/dist/fields/PasswordField/PasswordField.d.ts.map +1 -1
- package/dist/fields/PasswordField/PasswordField.js +12 -3
- package/dist/fields/PhoneField/PhoneField.cjs +25 -18
- package/dist/fields/PhoneField/PhoneField.d.ts +1 -1
- package/dist/fields/PhoneField/PhoneField.d.ts.map +1 -1
- package/dist/fields/PhoneField/PhoneField.js +26 -19
- package/dist/fields/TextField/TextField.cjs +23 -16
- package/dist/fields/TextField/TextField.d.ts +1 -1
- package/dist/fields/TextField/TextField.d.ts.map +1 -1
- package/dist/fields/TextField/TextField.js +24 -17
- package/dist/fields/TimeField/TimeField.cjs +24 -17
- package/dist/fields/TimeField/TimeField.d.ts +1 -1
- package/dist/fields/TimeField/TimeField.d.ts.map +1 -1
- package/dist/fields/TimeField/TimeField.js +25 -18
- package/dist/fields/defaultPlaceholders.cjs +19 -0
- package/dist/fields/defaultPlaceholders.d.ts +3 -0
- package/dist/fields/defaultPlaceholders.d.ts.map +1 -0
- package/dist/fields/defaultPlaceholders.js +19 -0
- package/dist/fields/fieldBase.module.css +60 -36
- package/dist/fields/fieldBase.module.css.cjs +24 -15
- package/dist/fields/fieldBase.module.css.js +24 -15
- package/dist/fields/fieldUtils.d.ts +1 -1
- package/dist/fields/fieldUtils.d.ts.map +1 -1
- package/dist/fields/iconUtils.cjs +9 -0
- package/dist/fields/iconUtils.d.ts +9 -0
- package/dist/fields/iconUtils.d.ts.map +1 -0
- package/dist/fields/iconUtils.js +9 -0
- package/dist/fields/icons.cjs +111 -0
- package/dist/fields/icons.d.ts +6 -0
- package/dist/fields/icons.d.ts.map +1 -0
- package/dist/fields/icons.js +111 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/react/AxenForm.cjs +55 -7
- package/dist/react/AxenForm.d.ts.map +1 -1
- package/dist/react/AxenForm.js +55 -7
- package/dist/react/fieldGroup.module.css +22 -0
- package/dist/react/fieldGroup.module.css.cjs +11 -0
- package/dist/react/fieldGroup.module.css.js +11 -0
- package/dist/tokens/themes.css +31 -0
- package/dist/tokens/tokens.css +6 -4
- package/dist/types.cjs +6 -0
- package/dist/types.d.ts +22 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -0
- package/package.json +1 -1
|
@@ -3,25 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const fieldBase_module = require("../fieldBase.module.css.cjs");
|
|
5
5
|
const fieldUtils = require("../fieldUtils.cjs");
|
|
6
|
-
const
|
|
7
|
-
"svg",
|
|
8
|
-
{
|
|
9
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
-
width: "16",
|
|
11
|
-
height: "16",
|
|
12
|
-
viewBox: "0 0 24 24",
|
|
13
|
-
fill: "none",
|
|
14
|
-
stroke: "currentColor",
|
|
15
|
-
strokeWidth: "2",
|
|
16
|
-
strokeLinecap: "round",
|
|
17
|
-
strokeLinejoin: "round",
|
|
18
|
-
"aria-hidden": "true",
|
|
19
|
-
children: [
|
|
20
|
-
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "4", width: "20", height: "16", rx: "2" }),
|
|
21
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7" })
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
);
|
|
6
|
+
const iconUtils = require("../iconUtils.cjs");
|
|
25
7
|
function EmailField({
|
|
26
8
|
name,
|
|
27
9
|
value,
|
|
@@ -33,9 +15,27 @@ function EmailField({
|
|
|
33
15
|
placeholder,
|
|
34
16
|
disabled,
|
|
35
17
|
readOnly,
|
|
36
|
-
required
|
|
18
|
+
required,
|
|
19
|
+
icon
|
|
37
20
|
}) {
|
|
38
21
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
22
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "email");
|
|
23
|
+
const inputEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
+
"input",
|
|
25
|
+
{
|
|
26
|
+
...aria,
|
|
27
|
+
type: "email",
|
|
28
|
+
name,
|
|
29
|
+
value: value ?? "",
|
|
30
|
+
onChange,
|
|
31
|
+
onBlur,
|
|
32
|
+
placeholder,
|
|
33
|
+
disabled,
|
|
34
|
+
readOnly,
|
|
35
|
+
autoComplete: "email",
|
|
36
|
+
className: fieldUtils.cx(fieldBase_module.default.input, resolvedIcon && fieldBase_module.default.inputWithIcon, error && fieldBase_module.default.inputError)
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
39
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, children: [
|
|
40
40
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
41
41
|
"label",
|
|
@@ -46,25 +46,10 @@ function EmailField({
|
|
|
46
46
|
children: label
|
|
47
47
|
}
|
|
48
48
|
),
|
|
49
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.
|
|
50
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
...aria,
|
|
55
|
-
type: "email",
|
|
56
|
-
name,
|
|
57
|
-
value: value ?? "",
|
|
58
|
-
onChange,
|
|
59
|
-
onBlur,
|
|
60
|
-
placeholder: placeholder ?? "user@example.com",
|
|
61
|
-
disabled,
|
|
62
|
-
readOnly,
|
|
63
|
-
autoComplete: "email",
|
|
64
|
-
className: fieldUtils.cx(fieldBase_module.default.input, fieldBase_module.default.inputGroupInput, error && fieldBase_module.default.inputError)
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
] }),
|
|
49
|
+
resolvedIcon ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.inputIconWrapper, children: [
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
51
|
+
inputEl
|
|
52
|
+
] }) : inputEl,
|
|
68
53
|
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
54
|
"span",
|
|
70
55
|
{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function EmailField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function EmailField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, icon, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=EmailField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailField.d.ts","sourceRoot":"","sources":["../../../src/fields/EmailField/EmailField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"EmailField.d.ts","sourceRoot":"","sources":["../../../src/fields/EmailField/EmailField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKvD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,GACL,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CAkD/B"}
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styles from "../fieldBase.module.css.js";
|
|
3
3
|
import { ariaProps, cx, labelId, helperId } from "../fieldUtils.js";
|
|
4
|
-
|
|
5
|
-
"svg",
|
|
6
|
-
{
|
|
7
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
-
width: "16",
|
|
9
|
-
height: "16",
|
|
10
|
-
viewBox: "0 0 24 24",
|
|
11
|
-
fill: "none",
|
|
12
|
-
stroke: "currentColor",
|
|
13
|
-
strokeWidth: "2",
|
|
14
|
-
strokeLinecap: "round",
|
|
15
|
-
strokeLinejoin: "round",
|
|
16
|
-
"aria-hidden": "true",
|
|
17
|
-
children: [
|
|
18
|
-
/* @__PURE__ */ jsx("rect", { x: "2", y: "4", width: "20", height: "16", rx: "2" }),
|
|
19
|
-
/* @__PURE__ */ jsx("path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7" })
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
);
|
|
4
|
+
import { resolveFieldIcon } from "../iconUtils.js";
|
|
23
5
|
function EmailField({
|
|
24
6
|
name,
|
|
25
7
|
value,
|
|
@@ -31,9 +13,27 @@ function EmailField({
|
|
|
31
13
|
placeholder,
|
|
32
14
|
disabled,
|
|
33
15
|
readOnly,
|
|
34
|
-
required
|
|
16
|
+
required,
|
|
17
|
+
icon
|
|
35
18
|
}) {
|
|
36
19
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
20
|
+
const resolvedIcon = resolveFieldIcon(icon, "email");
|
|
21
|
+
const inputEl = /* @__PURE__ */ jsx(
|
|
22
|
+
"input",
|
|
23
|
+
{
|
|
24
|
+
...aria,
|
|
25
|
+
type: "email",
|
|
26
|
+
name,
|
|
27
|
+
value: value ?? "",
|
|
28
|
+
onChange,
|
|
29
|
+
onBlur,
|
|
30
|
+
placeholder,
|
|
31
|
+
disabled,
|
|
32
|
+
readOnly,
|
|
33
|
+
autoComplete: "email",
|
|
34
|
+
className: cx(styles.input, resolvedIcon && styles.inputWithIcon, error && styles.inputError)
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
37
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
|
|
38
38
|
label && /* @__PURE__ */ jsx(
|
|
39
39
|
"label",
|
|
@@ -44,25 +44,10 @@ function EmailField({
|
|
|
44
44
|
children: label
|
|
45
45
|
}
|
|
46
46
|
),
|
|
47
|
-
/* @__PURE__ */ jsxs("div", { className: styles.
|
|
48
|
-
/* @__PURE__ */ jsx("span", { className: styles.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
...aria,
|
|
53
|
-
type: "email",
|
|
54
|
-
name,
|
|
55
|
-
value: value ?? "",
|
|
56
|
-
onChange,
|
|
57
|
-
onBlur,
|
|
58
|
-
placeholder: placeholder ?? "user@example.com",
|
|
59
|
-
disabled,
|
|
60
|
-
readOnly,
|
|
61
|
-
autoComplete: "email",
|
|
62
|
-
className: cx(styles.input, styles.inputGroupInput, error && styles.inputError)
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
] }),
|
|
47
|
+
resolvedIcon ? /* @__PURE__ */ jsxs("div", { className: styles.inputIconWrapper, children: [
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: styles.fieldIcon, children: resolvedIcon }),
|
|
49
|
+
inputEl
|
|
50
|
+
] }) : inputEl,
|
|
66
51
|
helperText && /* @__PURE__ */ jsx(
|
|
67
52
|
"span",
|
|
68
53
|
{
|
|
@@ -5,6 +5,7 @@ const react = require("react");
|
|
|
5
5
|
const numberUtils = require("../../core/numberUtils.cjs");
|
|
6
6
|
const fieldBase_module = require("../fieldBase.module.css.cjs");
|
|
7
7
|
const fieldUtils = require("../fieldUtils.cjs");
|
|
8
|
+
const iconUtils = require("../iconUtils.cjs");
|
|
8
9
|
function NumberField({
|
|
9
10
|
name,
|
|
10
11
|
value,
|
|
@@ -23,6 +24,7 @@ function NumberField({
|
|
|
23
24
|
prefix,
|
|
24
25
|
suffix,
|
|
25
26
|
locale,
|
|
27
|
+
icon,
|
|
26
28
|
form
|
|
27
29
|
}) {
|
|
28
30
|
const inputRef = react.useRef(null);
|
|
@@ -60,6 +62,7 @@ function NumberField({
|
|
|
60
62
|
}
|
|
61
63
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
62
64
|
const hasAdornment = prefix || suffix;
|
|
65
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "number");
|
|
63
66
|
const inputEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
67
|
"input",
|
|
65
68
|
{
|
|
@@ -77,10 +80,27 @@ function NumberField({
|
|
|
77
80
|
step,
|
|
78
81
|
className: fieldUtils.cx(
|
|
79
82
|
hasAdornment ? fieldUtils.cx(fieldBase_module.default.input, fieldBase_module.default.inputGroupInput) : fieldBase_module.default.input,
|
|
83
|
+
!hasAdornment && resolvedIcon && fieldBase_module.default.inputWithIcon,
|
|
80
84
|
error && fieldBase_module.default.inputError
|
|
81
85
|
)
|
|
82
86
|
}
|
|
83
87
|
);
|
|
88
|
+
const renderInput = () => {
|
|
89
|
+
if (hasAdornment) {
|
|
90
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.inputGroup, children: [
|
|
91
|
+
prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.inputPrefix, children: prefix }),
|
|
92
|
+
inputEl,
|
|
93
|
+
suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.inputSuffix, children: suffix })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
if (resolvedIcon) {
|
|
97
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.inputIconWrapper, children: [
|
|
98
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
99
|
+
inputEl
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
return inputEl;
|
|
103
|
+
};
|
|
84
104
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, children: [
|
|
85
105
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
86
106
|
"label",
|
|
@@ -91,11 +111,7 @@ function NumberField({
|
|
|
91
111
|
children: label
|
|
92
112
|
}
|
|
93
113
|
),
|
|
94
|
-
|
|
95
|
-
prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.inputPrefix, children: prefix }),
|
|
96
|
-
inputEl,
|
|
97
|
-
suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.inputSuffix, children: suffix })
|
|
98
|
-
] }) : inputEl,
|
|
114
|
+
renderInput(),
|
|
99
115
|
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
100
116
|
"span",
|
|
101
117
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function NumberField({ name, value, onChange: _onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, min, max, step, prefix, suffix, locale, form, }: FieldComponentProps & {
|
|
2
|
+
export declare function NumberField({ name, value, onChange: _onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, min, max, step, prefix, suffix, locale, icon, form, }: FieldComponentProps & {
|
|
3
3
|
min?: number;
|
|
4
4
|
max?: number;
|
|
5
5
|
step?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberField.d.ts","sourceRoot":"","sources":["../../../src/fields/NumberField/NumberField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"NumberField.d.ts","sourceRoot":"","sources":["../../../src/fields/NumberField/NumberField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKvD,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,KAAK,EACL,QAAQ,EAAE,SAAS,EACnB,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,GAAG,EACH,IAAI,EACJ,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACJ,IAAI,GACL,EAAE,mBAAmB,GAAG;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,2CAyHA"}
|
|
@@ -3,6 +3,7 @@ import { useRef, useLayoutEffect, useCallback } from "react";
|
|
|
3
3
|
import { stripNonNumeric, formatNumber, calculateCursorPosition } from "../../core/numberUtils.js";
|
|
4
4
|
import styles from "../fieldBase.module.css.js";
|
|
5
5
|
import { ariaProps, cx, labelId, helperId } from "../fieldUtils.js";
|
|
6
|
+
import { resolveFieldIcon } from "../iconUtils.js";
|
|
6
7
|
function NumberField({
|
|
7
8
|
name,
|
|
8
9
|
value,
|
|
@@ -21,6 +22,7 @@ function NumberField({
|
|
|
21
22
|
prefix,
|
|
22
23
|
suffix,
|
|
23
24
|
locale,
|
|
25
|
+
icon,
|
|
24
26
|
form
|
|
25
27
|
}) {
|
|
26
28
|
const inputRef = useRef(null);
|
|
@@ -58,6 +60,7 @@ function NumberField({
|
|
|
58
60
|
}
|
|
59
61
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
60
62
|
const hasAdornment = prefix || suffix;
|
|
63
|
+
const resolvedIcon = resolveFieldIcon(icon, "number");
|
|
61
64
|
const inputEl = /* @__PURE__ */ jsx(
|
|
62
65
|
"input",
|
|
63
66
|
{
|
|
@@ -75,10 +78,27 @@ function NumberField({
|
|
|
75
78
|
step,
|
|
76
79
|
className: cx(
|
|
77
80
|
hasAdornment ? cx(styles.input, styles.inputGroupInput) : styles.input,
|
|
81
|
+
!hasAdornment && resolvedIcon && styles.inputWithIcon,
|
|
78
82
|
error && styles.inputError
|
|
79
83
|
)
|
|
80
84
|
}
|
|
81
85
|
);
|
|
86
|
+
const renderInput = () => {
|
|
87
|
+
if (hasAdornment) {
|
|
88
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.inputGroup, children: [
|
|
89
|
+
prefix && /* @__PURE__ */ jsx("span", { className: styles.inputPrefix, children: prefix }),
|
|
90
|
+
inputEl,
|
|
91
|
+
suffix && /* @__PURE__ */ jsx("span", { className: styles.inputSuffix, children: suffix })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
if (resolvedIcon) {
|
|
95
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.inputIconWrapper, children: [
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: styles.fieldIcon, children: resolvedIcon }),
|
|
97
|
+
inputEl
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
return inputEl;
|
|
101
|
+
};
|
|
82
102
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
|
|
83
103
|
label && /* @__PURE__ */ jsx(
|
|
84
104
|
"label",
|
|
@@ -89,11 +109,7 @@ function NumberField({
|
|
|
89
109
|
children: label
|
|
90
110
|
}
|
|
91
111
|
),
|
|
92
|
-
|
|
93
|
-
prefix && /* @__PURE__ */ jsx("span", { className: styles.inputPrefix, children: prefix }),
|
|
94
|
-
inputEl,
|
|
95
|
-
suffix && /* @__PURE__ */ jsx("span", { className: styles.inputSuffix, children: suffix })
|
|
96
|
-
] }) : inputEl,
|
|
112
|
+
renderInput(),
|
|
97
113
|
helperText && /* @__PURE__ */ jsx(
|
|
98
114
|
"span",
|
|
99
115
|
{
|
|
@@ -4,6 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const react = require("react");
|
|
5
5
|
const fieldBase_module = require("../fieldBase.module.css.cjs");
|
|
6
6
|
const fieldUtils = require("../fieldUtils.cjs");
|
|
7
|
+
const iconUtils = require("../iconUtils.cjs");
|
|
7
8
|
const PasswordField_module = require("./PasswordField.module.css.cjs");
|
|
8
9
|
function PasswordField({
|
|
9
10
|
name,
|
|
@@ -16,10 +17,12 @@ function PasswordField({
|
|
|
16
17
|
placeholder,
|
|
17
18
|
disabled,
|
|
18
19
|
readOnly,
|
|
19
|
-
required
|
|
20
|
+
required,
|
|
21
|
+
icon
|
|
20
22
|
}) {
|
|
21
23
|
const [visible, setVisible] = react.useState(false);
|
|
22
24
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
25
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "password");
|
|
23
26
|
const toggleVisible = react.useCallback(() => {
|
|
24
27
|
setVisible((v) => !v);
|
|
25
28
|
}, []);
|
|
@@ -33,7 +36,8 @@ function PasswordField({
|
|
|
33
36
|
children: label
|
|
34
37
|
}
|
|
35
38
|
),
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: PasswordField_module.default.inputWrap, children: [
|
|
39
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldUtils.cx(PasswordField_module.default.inputWrap, resolvedIcon && fieldBase_module.default.inputIconWrapper), children: [
|
|
40
|
+
resolvedIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
37
41
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
38
42
|
"input",
|
|
39
43
|
{
|
|
@@ -47,7 +51,12 @@ function PasswordField({
|
|
|
47
51
|
disabled,
|
|
48
52
|
readOnly,
|
|
49
53
|
autoComplete: "current-password",
|
|
50
|
-
className: fieldUtils.cx(
|
|
54
|
+
className: fieldUtils.cx(
|
|
55
|
+
fieldBase_module.default.input,
|
|
56
|
+
error && fieldBase_module.default.inputError,
|
|
57
|
+
PasswordField_module.default.passwordInput,
|
|
58
|
+
resolvedIcon && fieldBase_module.default.inputWithIcon
|
|
59
|
+
)
|
|
51
60
|
}
|
|
52
61
|
),
|
|
53
62
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function PasswordField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function PasswordField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, icon, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=PasswordField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordField.d.ts","sourceRoot":"","sources":["../../../src/fields/PasswordField/PasswordField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"PasswordField.d.ts","sourceRoot":"","sources":["../../../src/fields/PasswordField/PasswordField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAMvD,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,GACL,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CA8D/B"}
|
|
@@ -2,6 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
3
|
import styles from "../fieldBase.module.css.js";
|
|
4
4
|
import { ariaProps, cx, labelId, helperId } from "../fieldUtils.js";
|
|
5
|
+
import { resolveFieldIcon } from "../iconUtils.js";
|
|
5
6
|
import localStyles from "./PasswordField.module.css.js";
|
|
6
7
|
function PasswordField({
|
|
7
8
|
name,
|
|
@@ -14,10 +15,12 @@ function PasswordField({
|
|
|
14
15
|
placeholder,
|
|
15
16
|
disabled,
|
|
16
17
|
readOnly,
|
|
17
|
-
required
|
|
18
|
+
required,
|
|
19
|
+
icon
|
|
18
20
|
}) {
|
|
19
21
|
const [visible, setVisible] = useState(false);
|
|
20
22
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
23
|
+
const resolvedIcon = resolveFieldIcon(icon, "password");
|
|
21
24
|
const toggleVisible = useCallback(() => {
|
|
22
25
|
setVisible((v) => !v);
|
|
23
26
|
}, []);
|
|
@@ -31,7 +34,8 @@ function PasswordField({
|
|
|
31
34
|
children: label
|
|
32
35
|
}
|
|
33
36
|
),
|
|
34
|
-
/* @__PURE__ */ jsxs("div", { className: localStyles.inputWrap, children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("div", { className: cx(localStyles.inputWrap, resolvedIcon && styles.inputIconWrapper), children: [
|
|
38
|
+
resolvedIcon && /* @__PURE__ */ jsx("span", { className: styles.fieldIcon, children: resolvedIcon }),
|
|
35
39
|
/* @__PURE__ */ jsx(
|
|
36
40
|
"input",
|
|
37
41
|
{
|
|
@@ -45,7 +49,12 @@ function PasswordField({
|
|
|
45
49
|
disabled,
|
|
46
50
|
readOnly,
|
|
47
51
|
autoComplete: "current-password",
|
|
48
|
-
className: cx(
|
|
52
|
+
className: cx(
|
|
53
|
+
styles.input,
|
|
54
|
+
error && styles.inputError,
|
|
55
|
+
localStyles.passwordInput,
|
|
56
|
+
resolvedIcon && styles.inputWithIcon
|
|
57
|
+
)
|
|
49
58
|
}
|
|
50
59
|
),
|
|
51
60
|
/* @__PURE__ */ jsx(
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const fieldBase_module = require("../fieldBase.module.css.cjs");
|
|
5
5
|
const fieldUtils = require("../fieldUtils.cjs");
|
|
6
|
+
const iconUtils = require("../iconUtils.cjs");
|
|
6
7
|
function PhoneField({
|
|
7
8
|
name,
|
|
8
9
|
value,
|
|
@@ -14,9 +15,28 @@ function PhoneField({
|
|
|
14
15
|
placeholder,
|
|
15
16
|
disabled,
|
|
16
17
|
readOnly,
|
|
17
|
-
required
|
|
18
|
+
required,
|
|
19
|
+
icon
|
|
18
20
|
}) {
|
|
19
21
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
22
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "phone");
|
|
23
|
+
const inputEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
+
"input",
|
|
25
|
+
{
|
|
26
|
+
...aria,
|
|
27
|
+
type: "tel",
|
|
28
|
+
name,
|
|
29
|
+
value: value ?? "",
|
|
30
|
+
onChange,
|
|
31
|
+
onBlur,
|
|
32
|
+
placeholder,
|
|
33
|
+
disabled,
|
|
34
|
+
readOnly,
|
|
35
|
+
autoComplete: "tel",
|
|
36
|
+
inputMode: "tel",
|
|
37
|
+
className: fieldUtils.cx(fieldBase_module.default.input, resolvedIcon && fieldBase_module.default.inputWithIcon, error && fieldBase_module.default.inputError)
|
|
38
|
+
}
|
|
39
|
+
);
|
|
20
40
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, children: [
|
|
21
41
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
42
|
"label",
|
|
@@ -27,23 +47,10 @@ function PhoneField({
|
|
|
27
47
|
children: label
|
|
28
48
|
}
|
|
29
49
|
),
|
|
30
|
-
/* @__PURE__ */ jsxRuntime.
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
type: "tel",
|
|
35
|
-
name,
|
|
36
|
-
value: value ?? "",
|
|
37
|
-
onChange,
|
|
38
|
-
onBlur,
|
|
39
|
-
placeholder: placeholder ?? "+1 (555) 000-0000",
|
|
40
|
-
disabled,
|
|
41
|
-
readOnly,
|
|
42
|
-
autoComplete: "tel",
|
|
43
|
-
inputMode: "tel",
|
|
44
|
-
className: fieldUtils.cx(fieldBase_module.default.input, error && fieldBase_module.default.inputError)
|
|
45
|
-
}
|
|
46
|
-
),
|
|
50
|
+
resolvedIcon ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.inputIconWrapper, children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
52
|
+
inputEl
|
|
53
|
+
] }) : inputEl,
|
|
47
54
|
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
55
|
"span",
|
|
49
56
|
{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function PhoneField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function PhoneField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, icon, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=PhoneField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneField.d.ts","sourceRoot":"","sources":["../../../src/fields/PhoneField/PhoneField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"PhoneField.d.ts","sourceRoot":"","sources":["../../../src/fields/PhoneField/PhoneField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKvD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,GACL,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CAmD/B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styles from "../fieldBase.module.css.js";
|
|
3
3
|
import { ariaProps, cx, labelId, helperId } from "../fieldUtils.js";
|
|
4
|
+
import { resolveFieldIcon } from "../iconUtils.js";
|
|
4
5
|
function PhoneField({
|
|
5
6
|
name,
|
|
6
7
|
value,
|
|
@@ -12,9 +13,28 @@ function PhoneField({
|
|
|
12
13
|
placeholder,
|
|
13
14
|
disabled,
|
|
14
15
|
readOnly,
|
|
15
|
-
required
|
|
16
|
+
required,
|
|
17
|
+
icon
|
|
16
18
|
}) {
|
|
17
19
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
20
|
+
const resolvedIcon = resolveFieldIcon(icon, "phone");
|
|
21
|
+
const inputEl = /* @__PURE__ */ jsx(
|
|
22
|
+
"input",
|
|
23
|
+
{
|
|
24
|
+
...aria,
|
|
25
|
+
type: "tel",
|
|
26
|
+
name,
|
|
27
|
+
value: value ?? "",
|
|
28
|
+
onChange,
|
|
29
|
+
onBlur,
|
|
30
|
+
placeholder,
|
|
31
|
+
disabled,
|
|
32
|
+
readOnly,
|
|
33
|
+
autoComplete: "tel",
|
|
34
|
+
inputMode: "tel",
|
|
35
|
+
className: cx(styles.input, resolvedIcon && styles.inputWithIcon, error && styles.inputError)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
18
38
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
|
|
19
39
|
label && /* @__PURE__ */ jsx(
|
|
20
40
|
"label",
|
|
@@ -25,23 +45,10 @@ function PhoneField({
|
|
|
25
45
|
children: label
|
|
26
46
|
}
|
|
27
47
|
),
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: "tel",
|
|
33
|
-
name,
|
|
34
|
-
value: value ?? "",
|
|
35
|
-
onChange,
|
|
36
|
-
onBlur,
|
|
37
|
-
placeholder: placeholder ?? "+1 (555) 000-0000",
|
|
38
|
-
disabled,
|
|
39
|
-
readOnly,
|
|
40
|
-
autoComplete: "tel",
|
|
41
|
-
inputMode: "tel",
|
|
42
|
-
className: cx(styles.input, error && styles.inputError)
|
|
43
|
-
}
|
|
44
|
-
),
|
|
48
|
+
resolvedIcon ? /* @__PURE__ */ jsxs("div", { className: styles.inputIconWrapper, children: [
|
|
49
|
+
/* @__PURE__ */ jsx("span", { className: styles.fieldIcon, children: resolvedIcon }),
|
|
50
|
+
inputEl
|
|
51
|
+
] }) : inputEl,
|
|
45
52
|
helperText && /* @__PURE__ */ jsx(
|
|
46
53
|
"span",
|
|
47
54
|
{
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const fieldBase_module = require("../fieldBase.module.css.cjs");
|
|
5
5
|
const fieldUtils = require("../fieldUtils.cjs");
|
|
6
|
+
const iconUtils = require("../iconUtils.cjs");
|
|
6
7
|
function TextField({
|
|
7
8
|
name,
|
|
8
9
|
value,
|
|
@@ -14,9 +15,26 @@ function TextField({
|
|
|
14
15
|
placeholder,
|
|
15
16
|
disabled,
|
|
16
17
|
readOnly,
|
|
17
|
-
required
|
|
18
|
+
required,
|
|
19
|
+
icon
|
|
18
20
|
}) {
|
|
19
21
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
22
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "text");
|
|
23
|
+
const inputEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
+
"input",
|
|
25
|
+
{
|
|
26
|
+
...aria,
|
|
27
|
+
type: "text",
|
|
28
|
+
name,
|
|
29
|
+
value: value ?? "",
|
|
30
|
+
onChange,
|
|
31
|
+
onBlur,
|
|
32
|
+
placeholder,
|
|
33
|
+
disabled,
|
|
34
|
+
readOnly,
|
|
35
|
+
className: fieldUtils.cx(fieldBase_module.default.input, resolvedIcon && fieldBase_module.default.inputWithIcon, error && fieldBase_module.default.inputError)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
20
38
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, children: [
|
|
21
39
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
40
|
"label",
|
|
@@ -27,21 +45,10 @@ function TextField({
|
|
|
27
45
|
children: label
|
|
28
46
|
}
|
|
29
47
|
),
|
|
30
|
-
/* @__PURE__ */ jsxRuntime.
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
type: "text",
|
|
35
|
-
name,
|
|
36
|
-
value: value ?? "",
|
|
37
|
-
onChange,
|
|
38
|
-
onBlur,
|
|
39
|
-
placeholder,
|
|
40
|
-
disabled,
|
|
41
|
-
readOnly,
|
|
42
|
-
className: fieldUtils.cx(fieldBase_module.default.input, error && fieldBase_module.default.inputError)
|
|
43
|
-
}
|
|
44
|
-
),
|
|
48
|
+
resolvedIcon ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.inputIconWrapper, children: [
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
50
|
+
inputEl
|
|
51
|
+
] }) : inputEl,
|
|
45
52
|
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
46
53
|
"span",
|
|
47
54
|
{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function TextField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function TextField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, icon, }: Readonly<FieldComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/fields/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/fields/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKvD,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,GACL,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CAiD/B"}
|