@axenstudio/axen-form 0.1.4 → 0.1.5
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 +54 -7
- package/dist/react/AxenForm.d.ts.map +1 -1
- package/dist/react/AxenForm.js +54 -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
|
@@ -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 AutocompleteField_module = require("./AutocompleteField.module.css.cjs");
|
|
8
9
|
const DEBOUNCE_MS = 400;
|
|
9
10
|
function AutocompleteField({
|
|
@@ -21,6 +22,7 @@ function AutocompleteField({
|
|
|
21
22
|
options: staticOptions,
|
|
22
23
|
fetchOptions,
|
|
23
24
|
optionLabel,
|
|
25
|
+
icon,
|
|
24
26
|
form
|
|
25
27
|
}) {
|
|
26
28
|
const [inputText, setInputText] = react.useState("");
|
|
@@ -156,6 +158,7 @@ function AutocompleteField({
|
|
|
156
158
|
}, []);
|
|
157
159
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
158
160
|
const listboxId = `${name}-listbox`;
|
|
161
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "autocomplete");
|
|
159
162
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, ref: wrapperRef, children: [
|
|
160
163
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
161
164
|
"label",
|
|
@@ -166,7 +169,8 @@ function AutocompleteField({
|
|
|
166
169
|
children: label
|
|
167
170
|
}
|
|
168
171
|
),
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: AutocompleteField_module.default.inputWrap, children: [
|
|
172
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldUtils.cx(AutocompleteField_module.default.inputWrap, resolvedIcon && fieldBase_module.default.inputIconWrapper), children: [
|
|
173
|
+
resolvedIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
170
174
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
171
175
|
"input",
|
|
172
176
|
{
|
|
@@ -192,7 +196,11 @@ function AutocompleteField({
|
|
|
192
196
|
"aria-activedescendant": activeIndex >= 0 ? `${name}-opt-${activeIndex}` : void 0,
|
|
193
197
|
"aria-autocomplete": "list",
|
|
194
198
|
autoComplete: "off",
|
|
195
|
-
className: fieldUtils.cx(
|
|
199
|
+
className: fieldUtils.cx(
|
|
200
|
+
fieldBase_module.default.input,
|
|
201
|
+
resolvedIcon && fieldBase_module.default.inputWithIcon,
|
|
202
|
+
error && fieldBase_module.default.inputError
|
|
203
|
+
)
|
|
196
204
|
}
|
|
197
205
|
),
|
|
198
206
|
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: AutocompleteField_module.default.spinner, "aria-hidden": "true" })
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutocompleteOption, FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function AutocompleteField({ name, value, onChange: _onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, options: staticOptions, fetchOptions, optionLabel, form, }: FieldComponentProps & {
|
|
2
|
+
export declare function AutocompleteField({ name, value, onChange: _onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, options: staticOptions, fetchOptions, optionLabel, icon, form, }: FieldComponentProps & {
|
|
3
3
|
fetchOptions?: (query: string, signal?: AbortSignal) => Promise<AutocompleteOption[]>;
|
|
4
4
|
optionLabel?: string;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteField.d.ts","sourceRoot":"","sources":["../../../src/fields/AutocompleteField/AutocompleteField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"AutocompleteField.d.ts","sourceRoot":"","sources":["../../../src/fields/AutocompleteField/AutocompleteField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQ3E,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,QAAQ,EAAE,SAAS,EACnB,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EAAE,aAAa,EACtB,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,IAAI,GACL,EAAE,mBAAmB,GAAG;IACvB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAsPA"}
|
|
@@ -2,6 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useRef, useCallback, useEffect } 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 "./AutocompleteField.module.css.js";
|
|
6
7
|
const DEBOUNCE_MS = 400;
|
|
7
8
|
function AutocompleteField({
|
|
@@ -19,6 +20,7 @@ function AutocompleteField({
|
|
|
19
20
|
options: staticOptions,
|
|
20
21
|
fetchOptions,
|
|
21
22
|
optionLabel,
|
|
23
|
+
icon,
|
|
22
24
|
form
|
|
23
25
|
}) {
|
|
24
26
|
const [inputText, setInputText] = useState("");
|
|
@@ -154,6 +156,7 @@ function AutocompleteField({
|
|
|
154
156
|
}, []);
|
|
155
157
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
156
158
|
const listboxId = `${name}-listbox`;
|
|
159
|
+
const resolvedIcon = resolveFieldIcon(icon, "autocomplete");
|
|
157
160
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, ref: wrapperRef, children: [
|
|
158
161
|
label && /* @__PURE__ */ jsx(
|
|
159
162
|
"label",
|
|
@@ -164,7 +167,8 @@ function AutocompleteField({
|
|
|
164
167
|
children: label
|
|
165
168
|
}
|
|
166
169
|
),
|
|
167
|
-
/* @__PURE__ */ jsxs("div", { className: localStyles.inputWrap, children: [
|
|
170
|
+
/* @__PURE__ */ jsxs("div", { className: cx(localStyles.inputWrap, resolvedIcon && styles.inputIconWrapper), children: [
|
|
171
|
+
resolvedIcon && /* @__PURE__ */ jsx("span", { className: styles.fieldIcon, children: resolvedIcon }),
|
|
168
172
|
/* @__PURE__ */ jsx(
|
|
169
173
|
"input",
|
|
170
174
|
{
|
|
@@ -190,7 +194,11 @@ function AutocompleteField({
|
|
|
190
194
|
"aria-activedescendant": activeIndex >= 0 ? `${name}-opt-${activeIndex}` : void 0,
|
|
191
195
|
"aria-autocomplete": "list",
|
|
192
196
|
autoComplete: "off",
|
|
193
|
-
className: cx(
|
|
197
|
+
className: cx(
|
|
198
|
+
styles.input,
|
|
199
|
+
resolvedIcon && styles.inputWithIcon,
|
|
200
|
+
error && styles.inputError
|
|
201
|
+
)
|
|
194
202
|
}
|
|
195
203
|
),
|
|
196
204
|
loading && /* @__PURE__ */ jsx("span", { className: localStyles.spinner, "aria-hidden": "true" })
|
|
@@ -5,6 +5,7 @@ const react = require("react");
|
|
|
5
5
|
const AutocompleteField_module = require("../AutocompleteField/AutocompleteField.module.css.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
|
const DEBOUNCE_MS = 400;
|
|
9
10
|
function AutocompleteMultiField({
|
|
10
11
|
name,
|
|
@@ -21,6 +22,7 @@ function AutocompleteMultiField({
|
|
|
21
22
|
options: staticOptions,
|
|
22
23
|
fetchOptions,
|
|
23
24
|
optionLabel,
|
|
25
|
+
icon,
|
|
24
26
|
form
|
|
25
27
|
}) {
|
|
26
28
|
const [inputText, setInputText] = react.useState("");
|
|
@@ -172,6 +174,7 @@ function AutocompleteMultiField({
|
|
|
172
174
|
}, []);
|
|
173
175
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
174
176
|
const listboxId = `${name}-listbox`;
|
|
177
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "autocomplete-multi");
|
|
175
178
|
const allPool = staticOptions ?? knownPoolRef.current;
|
|
176
179
|
const resolveLabel = (val) => {
|
|
177
180
|
const opt = allPool.find((o) => o.value === val);
|
|
@@ -193,6 +196,14 @@ function AutocompleteMultiField({
|
|
|
193
196
|
className: fieldUtils.cx(fieldBase_module.default.input, error && fieldBase_module.default.inputError),
|
|
194
197
|
style: { height: "auto", padding: 0 },
|
|
195
198
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: AutocompleteField_module.default.chipWrap, children: [
|
|
199
|
+
resolvedIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
200
|
+
"span",
|
|
201
|
+
{
|
|
202
|
+
className: fieldBase_module.default.fieldIcon,
|
|
203
|
+
style: { position: "static", transform: "none", flexShrink: 0 },
|
|
204
|
+
children: resolvedIcon
|
|
205
|
+
}
|
|
206
|
+
),
|
|
196
207
|
selectedValues.map((val) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: AutocompleteField_module.default.chip, children: [
|
|
197
208
|
resolveLabel(val),
|
|
198
209
|
!disabled && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutocompleteOption, FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function AutocompleteMultiField({ name, value, onChange: _onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, options: staticOptions, fetchOptions, optionLabel, form, }: FieldComponentProps & {
|
|
2
|
+
export declare function AutocompleteMultiField({ name, value, onChange: _onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, options: staticOptions, fetchOptions, optionLabel, icon, form, }: FieldComponentProps & {
|
|
3
3
|
fetchOptions?: (query: string, signal?: AbortSignal) => Promise<AutocompleteOption[]>;
|
|
4
4
|
optionLabel?: string;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteMultiField.d.ts","sourceRoot":"","sources":["../../../src/fields/AutocompleteMultiField/AutocompleteMultiField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"AutocompleteMultiField.d.ts","sourceRoot":"","sources":["../../../src/fields/AutocompleteMultiField/AutocompleteMultiField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQ3E,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,KAAK,EACL,QAAQ,EAAE,SAAS,EACnB,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EAAE,aAAa,EACtB,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,IAAI,GACL,EAAE,mBAAmB,GAAG;IACvB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CA+RA"}
|
|
@@ -3,6 +3,7 @@ import { useState, useRef, useCallback, useEffect } from "react";
|
|
|
3
3
|
import localStyles from "../AutocompleteField/AutocompleteField.module.css.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
|
const DEBOUNCE_MS = 400;
|
|
7
8
|
function AutocompleteMultiField({
|
|
8
9
|
name,
|
|
@@ -19,6 +20,7 @@ function AutocompleteMultiField({
|
|
|
19
20
|
options: staticOptions,
|
|
20
21
|
fetchOptions,
|
|
21
22
|
optionLabel,
|
|
23
|
+
icon,
|
|
22
24
|
form
|
|
23
25
|
}) {
|
|
24
26
|
const [inputText, setInputText] = useState("");
|
|
@@ -170,6 +172,7 @@ function AutocompleteMultiField({
|
|
|
170
172
|
}, []);
|
|
171
173
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
172
174
|
const listboxId = `${name}-listbox`;
|
|
175
|
+
const resolvedIcon = resolveFieldIcon(icon, "autocomplete-multi");
|
|
173
176
|
const allPool = staticOptions ?? knownPoolRef.current;
|
|
174
177
|
const resolveLabel = (val) => {
|
|
175
178
|
const opt = allPool.find((o) => o.value === val);
|
|
@@ -191,6 +194,14 @@ function AutocompleteMultiField({
|
|
|
191
194
|
className: cx(styles.input, error && styles.inputError),
|
|
192
195
|
style: { height: "auto", padding: 0 },
|
|
193
196
|
children: /* @__PURE__ */ jsxs("div", { className: localStyles.chipWrap, children: [
|
|
197
|
+
resolvedIcon && /* @__PURE__ */ jsx(
|
|
198
|
+
"span",
|
|
199
|
+
{
|
|
200
|
+
className: styles.fieldIcon,
|
|
201
|
+
style: { position: "static", transform: "none", flexShrink: 0 },
|
|
202
|
+
children: resolvedIcon
|
|
203
|
+
}
|
|
204
|
+
),
|
|
194
205
|
selectedValues.map((val) => /* @__PURE__ */ jsxs("span", { className: localStyles.chip, children: [
|
|
195
206
|
resolveLabel(val),
|
|
196
207
|
!disabled && !readOnly && /* @__PURE__ */ jsx(
|
|
@@ -5,6 +5,7 @@ const react = require("react");
|
|
|
5
5
|
const AutocompleteField_module = require("../AutocompleteField/AutocompleteField.module.css.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
|
const DEBOUNCE_MS = 400;
|
|
9
10
|
function AutocompletePredictField({
|
|
10
11
|
name,
|
|
@@ -21,6 +22,7 @@ function AutocompletePredictField({
|
|
|
21
22
|
options: staticOptions,
|
|
22
23
|
fetchOptions,
|
|
23
24
|
optionLabel,
|
|
25
|
+
icon,
|
|
24
26
|
form
|
|
25
27
|
}) {
|
|
26
28
|
const [inputText, setInputText] = react.useState("");
|
|
@@ -202,6 +204,7 @@ function AutocompletePredictField({
|
|
|
202
204
|
}, []);
|
|
203
205
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
204
206
|
const listboxId = `${name}-listbox`;
|
|
207
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "autocomplete-predict");
|
|
205
208
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, ref: wrapperRef, children: [
|
|
206
209
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
207
210
|
"label",
|
|
@@ -212,7 +215,8 @@ function AutocompletePredictField({
|
|
|
212
215
|
children: label
|
|
213
216
|
}
|
|
214
217
|
),
|
|
215
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: AutocompleteField_module.default.predictWrap, children: [
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldUtils.cx(AutocompleteField_module.default.predictWrap, resolvedIcon && fieldBase_module.default.inputIconWrapper), children: [
|
|
219
|
+
resolvedIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
216
220
|
ghostText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: AutocompleteField_module.default.ghostText, "aria-hidden": "true", children: ghostText }),
|
|
217
221
|
/* @__PURE__ */ jsxRuntime.jsx("span", { ref: measureRef, className: AutocompleteField_module.default.ghostHidden, "aria-hidden": "true", children: inputText }),
|
|
218
222
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -240,7 +244,11 @@ function AutocompletePredictField({
|
|
|
240
244
|
"aria-activedescendant": activeIndex >= 0 ? `${name}-opt-${activeIndex}` : void 0,
|
|
241
245
|
"aria-autocomplete": "both",
|
|
242
246
|
autoComplete: "off",
|
|
243
|
-
className: fieldUtils.cx(
|
|
247
|
+
className: fieldUtils.cx(
|
|
248
|
+
fieldBase_module.default.input,
|
|
249
|
+
resolvedIcon && fieldBase_module.default.inputWithIcon,
|
|
250
|
+
error && fieldBase_module.default.inputError
|
|
251
|
+
),
|
|
244
252
|
style: { background: "transparent", position: "relative", zIndex: 1 }
|
|
245
253
|
}
|
|
246
254
|
),
|
|
@@ -3,7 +3,7 @@ import { AutocompleteOption, FieldComponentProps } from '../../types';
|
|
|
3
3
|
* Autocomplete with predictive ghost text.
|
|
4
4
|
* Shows a faded suggestion that can be accepted with Tab.
|
|
5
5
|
*/
|
|
6
|
-
export declare function AutocompletePredictField({ name, value, onChange: _onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, options: staticOptions, fetchOptions, optionLabel, form, }: FieldComponentProps & {
|
|
6
|
+
export declare function AutocompletePredictField({ name, value, onChange: _onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, options: staticOptions, fetchOptions, optionLabel, icon, form, }: FieldComponentProps & {
|
|
7
7
|
fetchOptions?: (query: string, signal?: AbortSignal) => Promise<AutocompleteOption[]>;
|
|
8
8
|
optionLabel?: string;
|
|
9
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompletePredictField.d.ts","sourceRoot":"","sources":["../../../src/fields/AutocompletePredictField/AutocompletePredictField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"AutocompletePredictField.d.ts","sourceRoot":"","sources":["../../../src/fields/AutocompletePredictField/AutocompletePredictField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQ3E;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,KAAK,EACL,QAAQ,EAAE,SAAS,EACnB,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EAAE,aAAa,EACtB,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,IAAI,GACL,EAAE,mBAAmB,GAAG;IACvB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAuSA"}
|
|
@@ -3,6 +3,7 @@ import { useState, useRef, useCallback, useEffect } from "react";
|
|
|
3
3
|
import localStyles from "../AutocompleteField/AutocompleteField.module.css.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
|
const DEBOUNCE_MS = 400;
|
|
7
8
|
function AutocompletePredictField({
|
|
8
9
|
name,
|
|
@@ -19,6 +20,7 @@ function AutocompletePredictField({
|
|
|
19
20
|
options: staticOptions,
|
|
20
21
|
fetchOptions,
|
|
21
22
|
optionLabel,
|
|
23
|
+
icon,
|
|
22
24
|
form
|
|
23
25
|
}) {
|
|
24
26
|
const [inputText, setInputText] = useState("");
|
|
@@ -200,6 +202,7 @@ function AutocompletePredictField({
|
|
|
200
202
|
}, []);
|
|
201
203
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
202
204
|
const listboxId = `${name}-listbox`;
|
|
205
|
+
const resolvedIcon = resolveFieldIcon(icon, "autocomplete-predict");
|
|
203
206
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, ref: wrapperRef, children: [
|
|
204
207
|
label && /* @__PURE__ */ jsx(
|
|
205
208
|
"label",
|
|
@@ -210,7 +213,8 @@ function AutocompletePredictField({
|
|
|
210
213
|
children: label
|
|
211
214
|
}
|
|
212
215
|
),
|
|
213
|
-
/* @__PURE__ */ jsxs("div", { className: localStyles.predictWrap, children: [
|
|
216
|
+
/* @__PURE__ */ jsxs("div", { className: cx(localStyles.predictWrap, resolvedIcon && styles.inputIconWrapper), children: [
|
|
217
|
+
resolvedIcon && /* @__PURE__ */ jsx("span", { className: styles.fieldIcon, children: resolvedIcon }),
|
|
214
218
|
ghostText && /* @__PURE__ */ jsx("span", { className: localStyles.ghostText, "aria-hidden": "true", children: ghostText }),
|
|
215
219
|
/* @__PURE__ */ jsx("span", { ref: measureRef, className: localStyles.ghostHidden, "aria-hidden": "true", children: inputText }),
|
|
216
220
|
/* @__PURE__ */ jsx(
|
|
@@ -238,7 +242,11 @@ function AutocompletePredictField({
|
|
|
238
242
|
"aria-activedescendant": activeIndex >= 0 ? `${name}-opt-${activeIndex}` : void 0,
|
|
239
243
|
"aria-autocomplete": "both",
|
|
240
244
|
autoComplete: "off",
|
|
241
|
-
className: cx(
|
|
245
|
+
className: cx(
|
|
246
|
+
styles.input,
|
|
247
|
+
resolvedIcon && styles.inputWithIcon,
|
|
248
|
+
error && styles.inputError
|
|
249
|
+
),
|
|
242
250
|
style: { background: "transparent", position: "relative", zIndex: 1 }
|
|
243
251
|
}
|
|
244
252
|
),
|
|
@@ -4,6 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const dateUtils = require("../../core/dateUtils.cjs");
|
|
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
|
function DateField({
|
|
8
9
|
name,
|
|
9
10
|
value,
|
|
@@ -18,15 +19,35 @@ function DateField({
|
|
|
18
19
|
required,
|
|
19
20
|
min,
|
|
20
21
|
max,
|
|
21
|
-
locale
|
|
22
|
+
locale,
|
|
23
|
+
icon
|
|
22
24
|
}) {
|
|
23
25
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
24
26
|
const resolvedLocale = locale ?? dateUtils.getDefaultLocale();
|
|
27
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "date");
|
|
25
28
|
const dateValue = typeof value === "string" ? value : "";
|
|
26
29
|
const displayText = dateValue ? dateUtils.formatDateLocale(dateValue, resolvedLocale) : "";
|
|
27
30
|
const handleChange = (e) => {
|
|
28
31
|
onChange(e);
|
|
29
32
|
};
|
|
33
|
+
const inputEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
+
"input",
|
|
35
|
+
{
|
|
36
|
+
...aria,
|
|
37
|
+
type: "date",
|
|
38
|
+
name,
|
|
39
|
+
value: dateValue,
|
|
40
|
+
onChange: handleChange,
|
|
41
|
+
onBlur,
|
|
42
|
+
placeholder,
|
|
43
|
+
disabled,
|
|
44
|
+
readOnly,
|
|
45
|
+
min,
|
|
46
|
+
max,
|
|
47
|
+
lang: resolvedLocale,
|
|
48
|
+
className: fieldUtils.cx(fieldBase_module.default.input, resolvedIcon && fieldBase_module.default.inputWithIcon, error && fieldBase_module.default.inputError)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
30
51
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, children: [
|
|
31
52
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
53
|
"label",
|
|
@@ -37,24 +58,10 @@ function DateField({
|
|
|
37
58
|
children: label
|
|
38
59
|
}
|
|
39
60
|
),
|
|
40
|
-
/* @__PURE__ */ jsxRuntime.
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
type: "date",
|
|
45
|
-
name,
|
|
46
|
-
value: dateValue,
|
|
47
|
-
onChange: handleChange,
|
|
48
|
-
onBlur,
|
|
49
|
-
placeholder,
|
|
50
|
-
disabled,
|
|
51
|
-
readOnly,
|
|
52
|
-
min,
|
|
53
|
-
max,
|
|
54
|
-
lang: resolvedLocale,
|
|
55
|
-
className: fieldUtils.cx(fieldBase_module.default.input, error && fieldBase_module.default.inputError)
|
|
56
|
-
}
|
|
57
|
-
),
|
|
61
|
+
resolvedIcon ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.inputIconWrapper, children: [
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
63
|
+
inputEl
|
|
64
|
+
] }) : inputEl,
|
|
58
65
|
displayText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.helperText, "aria-hidden": "true", children: displayText }),
|
|
59
66
|
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
67
|
"span",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function DateField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, min, max, locale, }: Readonly<FieldComponentProps & {
|
|
2
|
+
export declare function DateField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, min, max, locale, icon, }: Readonly<FieldComponentProps & {
|
|
3
3
|
min?: string;
|
|
4
4
|
max?: string;
|
|
5
5
|
locale?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../../src/fields/DateField/DateField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../../src/fields/DateField/DateField.tsx"],"names":[],"mappings":"AAEA,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,GAAG,EACH,GAAG,EACH,MAAM,EACN,IAAI,GACL,EAAE,QAAQ,CAAC,mBAAmB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,2CAoEjF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { formatDateLocale, getDefaultLocale } from "../../core/dateUtils.js";
|
|
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
|
function DateField({
|
|
6
7
|
name,
|
|
7
8
|
value,
|
|
@@ -16,15 +17,35 @@ function DateField({
|
|
|
16
17
|
required,
|
|
17
18
|
min,
|
|
18
19
|
max,
|
|
19
|
-
locale
|
|
20
|
+
locale,
|
|
21
|
+
icon
|
|
20
22
|
}) {
|
|
21
23
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
22
24
|
const resolvedLocale = locale ?? getDefaultLocale();
|
|
25
|
+
const resolvedIcon = resolveFieldIcon(icon, "date");
|
|
23
26
|
const dateValue = typeof value === "string" ? value : "";
|
|
24
27
|
const displayText = dateValue ? formatDateLocale(dateValue, resolvedLocale) : "";
|
|
25
28
|
const handleChange = (e) => {
|
|
26
29
|
onChange(e);
|
|
27
30
|
};
|
|
31
|
+
const inputEl = /* @__PURE__ */ jsx(
|
|
32
|
+
"input",
|
|
33
|
+
{
|
|
34
|
+
...aria,
|
|
35
|
+
type: "date",
|
|
36
|
+
name,
|
|
37
|
+
value: dateValue,
|
|
38
|
+
onChange: handleChange,
|
|
39
|
+
onBlur,
|
|
40
|
+
placeholder,
|
|
41
|
+
disabled,
|
|
42
|
+
readOnly,
|
|
43
|
+
min,
|
|
44
|
+
max,
|
|
45
|
+
lang: resolvedLocale,
|
|
46
|
+
className: cx(styles.input, resolvedIcon && styles.inputWithIcon, error && styles.inputError)
|
|
47
|
+
}
|
|
48
|
+
);
|
|
28
49
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
|
|
29
50
|
label && /* @__PURE__ */ jsx(
|
|
30
51
|
"label",
|
|
@@ -35,24 +56,10 @@ function DateField({
|
|
|
35
56
|
children: label
|
|
36
57
|
}
|
|
37
58
|
),
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
type: "date",
|
|
43
|
-
name,
|
|
44
|
-
value: dateValue,
|
|
45
|
-
onChange: handleChange,
|
|
46
|
-
onBlur,
|
|
47
|
-
placeholder,
|
|
48
|
-
disabled,
|
|
49
|
-
readOnly,
|
|
50
|
-
min,
|
|
51
|
-
max,
|
|
52
|
-
lang: resolvedLocale,
|
|
53
|
-
className: cx(styles.input, error && styles.inputError)
|
|
54
|
-
}
|
|
55
|
-
),
|
|
59
|
+
resolvedIcon ? /* @__PURE__ */ jsxs("div", { className: styles.inputIconWrapper, children: [
|
|
60
|
+
/* @__PURE__ */ jsx("span", { className: styles.fieldIcon, children: resolvedIcon }),
|
|
61
|
+
inputEl
|
|
62
|
+
] }) : inputEl,
|
|
56
63
|
displayText && /* @__PURE__ */ jsx("span", { className: styles.helperText, "aria-hidden": "true", children: displayText }),
|
|
57
64
|
helperText && /* @__PURE__ */ jsx(
|
|
58
65
|
"span",
|
|
@@ -4,6 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const dateUtils = require("../../core/dateUtils.cjs");
|
|
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
|
function DateTimeField({
|
|
8
9
|
name,
|
|
9
10
|
value,
|
|
@@ -19,15 +20,35 @@ function DateTimeField({
|
|
|
19
20
|
min,
|
|
20
21
|
max,
|
|
21
22
|
locale,
|
|
22
|
-
ampm
|
|
23
|
+
ampm,
|
|
24
|
+
icon
|
|
23
25
|
}) {
|
|
24
26
|
const aria = fieldUtils.ariaProps(name, { error, helperText, required, label });
|
|
25
27
|
const resolvedLocale = locale ?? dateUtils.getDefaultLocale();
|
|
28
|
+
const resolvedIcon = iconUtils.resolveFieldIcon(icon, "datetime");
|
|
26
29
|
const dtValue = typeof value === "string" ? value : "";
|
|
27
30
|
const displayText = dtValue ? dateUtils.formatDateTimeLocale(dtValue, resolvedLocale, ampm) : "";
|
|
28
31
|
const handleChange = (e) => {
|
|
29
32
|
onChange(e);
|
|
30
33
|
};
|
|
34
|
+
const inputEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
35
|
+
"input",
|
|
36
|
+
{
|
|
37
|
+
...aria,
|
|
38
|
+
type: "datetime-local",
|
|
39
|
+
name,
|
|
40
|
+
value: dtValue,
|
|
41
|
+
onChange: handleChange,
|
|
42
|
+
onBlur,
|
|
43
|
+
placeholder,
|
|
44
|
+
disabled,
|
|
45
|
+
readOnly,
|
|
46
|
+
min,
|
|
47
|
+
max,
|
|
48
|
+
lang: resolvedLocale,
|
|
49
|
+
className: fieldUtils.cx(fieldBase_module.default.input, resolvedIcon && fieldBase_module.default.inputWithIcon, error && fieldBase_module.default.inputError)
|
|
50
|
+
}
|
|
51
|
+
);
|
|
31
52
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.wrapper, children: [
|
|
32
53
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
54
|
"label",
|
|
@@ -38,24 +59,10 @@ function DateTimeField({
|
|
|
38
59
|
children: label
|
|
39
60
|
}
|
|
40
61
|
),
|
|
41
|
-
/* @__PURE__ */ jsxRuntime.
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
type: "datetime-local",
|
|
46
|
-
name,
|
|
47
|
-
value: dtValue,
|
|
48
|
-
onChange: handleChange,
|
|
49
|
-
onBlur,
|
|
50
|
-
placeholder,
|
|
51
|
-
disabled,
|
|
52
|
-
readOnly,
|
|
53
|
-
min,
|
|
54
|
-
max,
|
|
55
|
-
lang: resolvedLocale,
|
|
56
|
-
className: fieldUtils.cx(fieldBase_module.default.input, error && fieldBase_module.default.inputError)
|
|
57
|
-
}
|
|
58
|
-
),
|
|
62
|
+
resolvedIcon ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldBase_module.default.inputIconWrapper, children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.fieldIcon, children: resolvedIcon }),
|
|
64
|
+
inputEl
|
|
65
|
+
] }) : inputEl,
|
|
59
66
|
displayText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: fieldBase_module.default.helperText, "aria-hidden": "true", children: displayText }),
|
|
60
67
|
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
68
|
"span",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldComponentProps } from '../../types';
|
|
2
|
-
export declare function DateTimeField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, min, max, locale, ampm, }: Readonly<FieldComponentProps & {
|
|
2
|
+
export declare function DateTimeField({ name, value, onChange, onBlur, error, helperText, label, placeholder, disabled, readOnly, required, min, max, locale, ampm, icon, }: Readonly<FieldComponentProps & {
|
|
3
3
|
min?: string;
|
|
4
4
|
max?: string;
|
|
5
5
|
locale?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeField.d.ts","sourceRoot":"","sources":["../../../src/fields/DateTimeField/DateTimeField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DateTimeField.d.ts","sourceRoot":"","sources":["../../../src/fields/DateTimeField/DateTimeField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKvD,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,GAAG,EACH,GAAG,EACH,MAAM,EACN,IAAI,EACJ,IAAI,GACL,EAAE,QAAQ,CACT,mBAAmB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CACtF,2CAiEA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { formatDateTimeLocale, getDefaultLocale } from "../../core/dateUtils.js";
|
|
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
|
function DateTimeField({
|
|
6
7
|
name,
|
|
7
8
|
value,
|
|
@@ -17,15 +18,35 @@ function DateTimeField({
|
|
|
17
18
|
min,
|
|
18
19
|
max,
|
|
19
20
|
locale,
|
|
20
|
-
ampm
|
|
21
|
+
ampm,
|
|
22
|
+
icon
|
|
21
23
|
}) {
|
|
22
24
|
const aria = ariaProps(name, { error, helperText, required, label });
|
|
23
25
|
const resolvedLocale = locale ?? getDefaultLocale();
|
|
26
|
+
const resolvedIcon = resolveFieldIcon(icon, "datetime");
|
|
24
27
|
const dtValue = typeof value === "string" ? value : "";
|
|
25
28
|
const displayText = dtValue ? formatDateTimeLocale(dtValue, resolvedLocale, ampm) : "";
|
|
26
29
|
const handleChange = (e) => {
|
|
27
30
|
onChange(e);
|
|
28
31
|
};
|
|
32
|
+
const inputEl = /* @__PURE__ */ jsx(
|
|
33
|
+
"input",
|
|
34
|
+
{
|
|
35
|
+
...aria,
|
|
36
|
+
type: "datetime-local",
|
|
37
|
+
name,
|
|
38
|
+
value: dtValue,
|
|
39
|
+
onChange: handleChange,
|
|
40
|
+
onBlur,
|
|
41
|
+
placeholder,
|
|
42
|
+
disabled,
|
|
43
|
+
readOnly,
|
|
44
|
+
min,
|
|
45
|
+
max,
|
|
46
|
+
lang: resolvedLocale,
|
|
47
|
+
className: cx(styles.input, resolvedIcon && styles.inputWithIcon, error && styles.inputError)
|
|
48
|
+
}
|
|
49
|
+
);
|
|
29
50
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
|
|
30
51
|
label && /* @__PURE__ */ jsx(
|
|
31
52
|
"label",
|
|
@@ -36,24 +57,10 @@ function DateTimeField({
|
|
|
36
57
|
children: label
|
|
37
58
|
}
|
|
38
59
|
),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
type: "datetime-local",
|
|
44
|
-
name,
|
|
45
|
-
value: dtValue,
|
|
46
|
-
onChange: handleChange,
|
|
47
|
-
onBlur,
|
|
48
|
-
placeholder,
|
|
49
|
-
disabled,
|
|
50
|
-
readOnly,
|
|
51
|
-
min,
|
|
52
|
-
max,
|
|
53
|
-
lang: resolvedLocale,
|
|
54
|
-
className: cx(styles.input, error && styles.inputError)
|
|
55
|
-
}
|
|
56
|
-
),
|
|
60
|
+
resolvedIcon ? /* @__PURE__ */ jsxs("div", { className: styles.inputIconWrapper, children: [
|
|
61
|
+
/* @__PURE__ */ jsx("span", { className: styles.fieldIcon, children: resolvedIcon }),
|
|
62
|
+
inputEl
|
|
63
|
+
] }) : inputEl,
|
|
57
64
|
displayText && /* @__PURE__ */ jsx("span", { className: styles.helperText, "aria-hidden": "true", children: displayText }),
|
|
58
65
|
helperText && /* @__PURE__ */ jsx(
|
|
59
66
|
"span",
|