@nolwenture/formik-jsonschema-form 1.2.1 → 1.2.2

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.
@@ -1,42 +1,23 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
38
5
  Object.defineProperty(exports, "__esModule", { value: true });
39
6
  exports.ErrorMessage = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
40
8
  const styled_components_1 = __importDefault(require("styled-components"));
41
- const formik = __importStar(require("formik"));
42
- exports.ErrorMessage = (0, styled_components_1.default)(formik.ErrorMessage) ``;
9
+ const formik_1 = require("formik");
10
+ const ErrorText = styled_components_1.default.div `
11
+ color: ${(props) => props.theme.color.intent.default.danger};
12
+ font-family: ${(props) => props.theme.typography.fontFamily.base};
13
+ font-size: ${(props) => props.theme.typography.size.base};
14
+ margin-top: ${(props) => props.theme.spacing.xs};
15
+ `;
16
+ const ErrorMessage = ({ name }) => {
17
+ const [, meta] = (0, formik_1.useField)(name);
18
+ if (!meta.touched || !meta.error) {
19
+ return null;
20
+ }
21
+ return (0, jsx_runtime_1.jsx)(ErrorText, { children: meta.error });
22
+ };
23
+ exports.ErrorMessage = ErrorMessage;
@@ -62,6 +62,7 @@ exports.FieldDescription = styled_components_1.styled.p `
62
62
  margin: 0;
63
63
  font-family: ${(props) => props.theme.typography.fontFamily.base};
64
64
  font-size: ${(props) => props.theme.typography.size.base};
65
+ font-weight: ${(props) => (props.$isReadOnly ? props.theme.typography.weight.bold : props.theme.typography.weight.normal)};
65
66
  `;
66
67
  exports.FieldHelp = styled_components_1.styled.p `
67
68
  color: ${(props) => props.theme.color.text.default};
@@ -9,15 +9,18 @@ const FormRegistry_1 = require("../../FormRegistry");
9
9
  const common_1 = require("../../styles/common");
10
10
  const DateInput_1 = require("./DateInput");
11
11
  const DateField = (props) => {
12
- const { templates } = (0, react_1.useContext)(FormRegistry_1.FormRegistry);
12
+ const { templates, formLocalization } = (0, react_1.useContext)(FormRegistry_1.FormRegistry);
13
+ const {} = (0, react_1.useContext)(FormRegistry_1.FormRegistry);
13
14
  (0, hooks_1.useSetDefault)(props);
14
15
  const { name, uiSchema, schema } = props;
15
16
  const { props: inputProps } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
16
17
  const SelectedFieldTemplate = (props.uiSchema?.["ui:template"] &&
17
18
  templates[props.uiSchema?.["ui:template"]]) ??
18
19
  templates.FieldTemplate;
19
- const { label, placeholder, min, max, locale, helpText, disabled, errorMessages } = inputProps || {};
20
+ const { label, placeholder, min, max, locale, helpText, disabled, errorMessages, } = inputProps || {};
20
21
  const readOnly = schema.readOnly === true;
21
- return ((0, jsx_runtime_1.jsx)(SelectedFieldTemplate, { ...props, "data-fjsf-string": name, children: (0, jsx_runtime_1.jsx)(common_1.CommonFieldWrapper, { children: (0, jsx_runtime_1.jsx)(DateInput_1.DateInput, { name: name, label: label, placeholder: placeholder, min: min, max: max, locale: locale, helpText: helpText, disabled: disabled, readOnly: readOnly, errorMessages: errorMessages }) }) }));
22
+ return ((0, jsx_runtime_1.jsx)(SelectedFieldTemplate, { ...props, "data-fjsf-string": name, children: (0, jsx_runtime_1.jsx)(common_1.CommonFieldWrapper, { children: (0, jsx_runtime_1.jsx)(DateInput_1.DateInput, { name: name, label: label, placeholder: placeholder, min: min, max: max, locale: locale ??
23
+ formLocalization?.fields?.DateField?.locale ??
24
+ navigator.language, helpText: helpText, disabled: disabled, readOnly: readOnly, errorMessages: errorMessages }) }) }));
22
25
  };
23
26
  exports.DateField = DateField;
@@ -7,13 +7,10 @@ const formik_1 = require("formik");
7
7
  const styledComponents_1 = require("./styledComponents");
8
8
  const dateParsing_1 = require("./dateParsing");
9
9
  const fa_1 = require("react-icons/fa");
10
- const FormRegistry_1 = require("../../FormRegistry");
11
10
  const DateInput = ({ name, label, placeholder, min, max, locale, helpText, disabled, readOnly, errorMessages, }) => {
12
- const { formLocalization } = (0, react_1.useContext)(FormRegistry_1.FormRegistry);
13
- const effectiveLocale = locale ?? formLocalization?.fields?.DateField?.locale ?? navigator.language;
14
- const firstDatePart = new Intl.DateTimeFormat(effectiveLocale)
11
+ const firstDatePart = new Intl.DateTimeFormat(locale)
15
12
  .formatToParts(new Date(Date.UTC(2000, 0, 2)))
16
- .find(p => p.type === "day" || p.type === "month" || p.type === "year");
13
+ .find((p) => p.type === "day" || p.type === "month" || p.type === "year");
17
14
  const preferOrder = firstDatePart?.type === "month" ? "MDY" : "DMY";
18
15
  const { setFieldTouched } = (0, formik_1.useFormikContext)();
19
16
  const [field, meta, helpers] = (0, formik_1.useField)(name);
@@ -26,16 +23,15 @@ const DateInput = ({ name, label, placeholder, min, max, locale, helpText, disab
26
23
  if (!/^\d{4}-\d{2}-\d{2}$/.test(iso)) {
27
24
  if (iso === "now") {
28
25
  const today = new Date();
29
- return new Intl.DateTimeFormat(effectiveLocale, { timeZone: "UTC" })
30
- .format(new Date(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate())));
26
+ return new Intl.DateTimeFormat(locale, { timeZone: "UTC" }).format(new Date(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate())));
31
27
  }
32
28
  return "";
33
29
  }
34
30
  const dt = new Date(`${iso}T00:00:00Z`);
35
31
  if (Number.isNaN(dt.getTime()))
36
32
  return "";
37
- return new Intl.DateTimeFormat(effectiveLocale, { timeZone: "UTC" }).format(dt);
38
- }, [effectiveLocale]);
33
+ return new Intl.DateTimeFormat(locale, { timeZone: "UTC" }).format(dt);
34
+ }, [locale]);
39
35
  const [displayValue, setDisplayValue] = (0, react_1.useState)(formatForDisplay(value));
40
36
  (0, react_1.useEffect)(() => {
41
37
  if (!value)
@@ -55,7 +51,10 @@ const DateInput = ({ name, label, placeholder, min, max, locale, helpText, disab
55
51
  "Date is out of range.";
56
52
  const raw = errorMessages?.outOfRange;
57
53
  if (typeof raw === "function") {
58
- return raw({ min, max });
54
+ return raw({
55
+ min,
56
+ max,
57
+ });
59
58
  }
60
59
  const s = typeof raw === "string" ? raw : fallback;
61
60
  return s.replace(/\{min\}/g, min ?? "").replace(/\{max\}/g, max ?? "");
@@ -98,7 +97,16 @@ const DateInput = ({ name, label, placeholder, min, max, locale, helpText, disab
98
97
  else {
99
98
  setError(invalidMessage);
100
99
  }
101
- }, [disabled, readOnly, preferOrder, name, onValueChange, setError, setFieldTouched, invalidMessage]);
100
+ }, [
101
+ disabled,
102
+ readOnly,
103
+ preferOrder,
104
+ name,
105
+ onValueChange,
106
+ setError,
107
+ setFieldTouched,
108
+ invalidMessage,
109
+ ]);
102
110
  const handlePaste = (0, react_1.useCallback)((e) => {
103
111
  if (readOnly || disabled)
104
112
  return;
@@ -106,8 +114,8 @@ const DateInput = ({ name, label, placeholder, min, max, locale, helpText, disab
106
114
  const text = e.clipboardData.getData("text")?.trim();
107
115
  handleParseOrError(text ?? "");
108
116
  }, [readOnly, disabled, handleParseOrError]);
109
- return ((0, jsx_runtime_1.jsxs)(styledComponents_1.Wrapper, { children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: `${name}-display`, children: label }), (0, jsx_runtime_1.jsxs)(styledComponents_1.Row, { children: [(0, jsx_runtime_1.jsx)(styledComponents_1.DisplayInput, { id: `${name}-display`, type: "text", placeholder: placeholder, autoComplete: "off", inputMode: "numeric", "aria-describedby": helpText ? `${name}-help` : undefined, "aria-invalid": hasExternalError, value: displayValue, onChange: (e) => setDisplayValue(e.target.value), onBlur: (e) => handleParseOrError(e.target.value), onPaste: handlePaste, disabled: disabled || readOnly, readOnly: readOnly }), !readOnly && ((0, jsx_runtime_1.jsx)(styledComponents_1.HiddenNative, { ref: nativeRef, id: `${name}-native`, type: "date", min: min, max: max, value: value ?? "", onChange: (e) => {
117
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: `${name}-display`, children: label }), (0, jsx_runtime_1.jsxs)(styledComponents_1.Row, { children: [(0, jsx_runtime_1.jsx)(styledComponents_1.DisplayInput, { id: `${name}-display`, type: "text", placeholder: placeholder, autoComplete: "off", inputMode: "numeric", "aria-describedby": helpText ? `${name}-help` : undefined, "aria-invalid": hasExternalError, value: displayValue, onChange: (e) => setDisplayValue(e.target.value), onBlur: (e) => handleParseOrError(e.target.value), onPaste: handlePaste, disabled: disabled, readOnly: readOnly }), !readOnly && ((0, jsx_runtime_1.jsx)(styledComponents_1.HiddenNative, { ref: nativeRef, id: `${name}-native`, type: "date", min: min, max: max, value: value ?? "", onChange: (e) => {
110
118
  onValueChange(e.target.value);
111
- }, tabIndex: -1, "aria-hidden": "true" })), (0, jsx_runtime_1.jsx)(styledComponents_1.PickerButton, { type: "button", onClick: openPicker, "aria-label": "Date picker", title: "Date picker", disabled: disabled || readOnly, children: (0, jsx_runtime_1.jsx)(fa_1.FaCalendar, {}) })] })] }));
119
+ }, tabIndex: -1, "aria-hidden": "true" })), !readOnly && ((0, jsx_runtime_1.jsx)(styledComponents_1.PickerButton, { type: "button", onClick: openPicker, "aria-label": "Date picker", title: "Date picker", disabled: disabled, children: (0, jsx_runtime_1.jsx)(fa_1.FaCalendar, {}) }))] })] }));
112
120
  };
113
121
  exports.DateInput = DateInput;
@@ -3,20 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PickerButton = exports.HiddenNative = exports.DisplayInput = exports.Row = exports.Wrapper = void 0;
6
+ exports.PickerButton = exports.HiddenNative = exports.DisplayInput = exports.Row = void 0;
7
7
  const styled_components_1 = __importDefault(require("styled-components"));
8
- exports.Wrapper = styled_components_1.default.div `
9
- display: inline-flex;
10
- flex-direction: column;
11
- max-width: 360px;
12
- `;
13
8
  exports.Row = styled_components_1.default.div `
14
- position: relative;
15
9
  display: flex;
16
- align-items: center;
10
+ flex-direction: row;
11
+ font-family: ${(props) => props.theme.typography.fontFamily.base};
12
+ position: relative;
17
13
  `;
18
14
  exports.DisplayInput = styled_components_1.default.input `
19
- flex: 1;
15
+ display: flex;
16
+ flex-grow: 1;
17
+ padding-right: ${(props) => props.theme.spacing.xxxl} !important;
18
+
19
+ &:disabled {
20
+ background-color: transparent;
21
+ border: none;
22
+ }
23
+
24
+ &:read-only {
25
+ &:focus, &:focus-visible {
26
+ border: none;
27
+ stroke: none;
28
+ box-shadow: none;
29
+ }
30
+ }
20
31
  `;
21
32
  exports.HiddenNative = styled_components_1.default.input `
22
33
  position: absolute;
@@ -26,20 +37,24 @@ exports.HiddenNative = styled_components_1.default.input `
26
37
  height: 0;
27
38
  `;
28
39
  exports.PickerButton = styled_components_1.default.button `
29
- position: relative;
30
- left: -40px;
40
+ position: absolute;
41
+ right: 0;
42
+ top: 0;
43
+ height: 100%;
44
+ left: auto;
31
45
  border: none;
32
46
  background: inherit;
33
47
  cursor: pointer;
34
48
  font: inherit;
35
- &:focus {
36
- box-shadow: none;;
37
- }
38
- &:disabled {
39
- cursor: not-allowed;
40
- opacity: 0.6;
41
- }
42
- svg {
43
- display: flex;
44
- }
49
+ &:focus, &:focus-visible {
50
+ ${(props) => props.theme.focus.default};
51
+ }
52
+ &:disabled {
53
+ cursor: not-allowed;
54
+ opacity: 0.6;
55
+ }
56
+ svg {
57
+ display: flex;
58
+ color: ${(props) => props.theme.color.intent.default.primary};
59
+ }
45
60
  `;
@@ -30,6 +30,12 @@ exports.CommonFieldWrapper = styled_components_1.styled.div `
30
30
  &::placeholder {
31
31
  color: ${(props) => props.theme.color.text.default};
32
32
  }
33
+
34
+ &:focus, &:focus-visible {
35
+ border: none;
36
+ stroke: none;
37
+ box-shadow: none;
38
+ }
33
39
  }
34
40
 
35
41
  &:disabled {
@@ -41,20 +47,19 @@ exports.CommonFieldWrapper = styled_components_1.styled.div `
41
47
  &::placeholder {
42
48
  color: ${(props) => props.theme.color.text.muted};
43
49
  }
50
+
51
+ &:focus, &:focus-visible {
52
+ border: none;
53
+ stroke: none;
54
+ box-shadow: none;
55
+ }
44
56
  }
45
57
 
46
- &:focus {
58
+ &:focus, &:focus-visible {
47
59
  ${(props) => props.theme.focus.default};
48
60
  }
49
61
  }
50
62
 
51
- ::-webkit-calendar-picker-indicator {
52
- background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 24 24"><path fill="${(props) => props.theme.color.text
53
- .default}" d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z"/></svg>');
54
-
55
- cursor: pointer;
56
- }
57
-
58
63
  select {
59
64
  appearance: none;
60
65
  -webkit-appearance: none;
@@ -23,6 +23,6 @@ const FieldTemplate = (props) => {
23
23
  ...wrapperProps,
24
24
  ...dataAttributes, // This will only include data-* attributes
25
25
  };
26
- return ((0, jsx_runtime_1.jsxs)(FieldWrapper, { ...mergedWrapperProps, "$isDisabled": isDisabled, children: [(0, jsx_runtime_1.jsxs)(FieldTitleInfoWrapper, { children: [title && ((0, jsx_runtime_1.jsxs)(FieldTitle, { ...titleProps, htmlFor: name, children: [title, props.required && (0, jsx_runtime_1.jsx)(RequiredIndicator, {})] })), info && (0, jsx_runtime_1.jsx)(FieldInfo, { ...info })] }), description && ((0, jsx_runtime_1.jsx)(FieldDescription, { ...descriptionProps, children: description })), children, help && (0, jsx_runtime_1.jsx)(FieldHelp, { ...helpProps, children: help }), (0, jsx_runtime_1.jsx)(ErrorMessage, { ...errorProps, name: name })] }));
26
+ return ((0, jsx_runtime_1.jsxs)(FieldWrapper, { ...mergedWrapperProps, "$isDisabled": isDisabled, children: [(0, jsx_runtime_1.jsxs)(FieldTitleInfoWrapper, { children: [title && ((0, jsx_runtime_1.jsxs)(FieldTitle, { ...titleProps, htmlFor: name, children: [title, props.required && (0, jsx_runtime_1.jsx)(RequiredIndicator, {})] })), info && (0, jsx_runtime_1.jsx)(FieldInfo, { ...info })] }), description && ((0, jsx_runtime_1.jsx)(FieldDescription, { ...descriptionProps, "$isReadOnly": isReadOnly, children: description })), children, help && (0, jsx_runtime_1.jsx)(FieldHelp, { ...helpProps, children: help }), (0, jsx_runtime_1.jsx)(ErrorMessage, { ...errorProps, name: name })] }));
27
27
  };
28
28
  exports.FieldTemplate = FieldTemplate;
@@ -1,3 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import styled from "styled-components";
2
- import * as formik from "formik";
3
- export const ErrorMessage = styled(formik.ErrorMessage) ``;
3
+ import { useField } from 'formik';
4
+ const ErrorText = styled.div `
5
+ color: ${(props) => props.theme.color.intent.default.danger};
6
+ font-family: ${(props) => props.theme.typography.fontFamily.base};
7
+ font-size: ${(props) => props.theme.typography.size.base};
8
+ margin-top: ${(props) => props.theme.spacing.xs};
9
+ `;
10
+ export const ErrorMessage = ({ name }) => {
11
+ const [, meta] = useField(name);
12
+ if (!meta.touched || !meta.error) {
13
+ return null;
14
+ }
15
+ return _jsx(ErrorText, { children: meta.error });
16
+ };
@@ -26,6 +26,7 @@ export const FieldDescription = styled.p `
26
26
  margin: 0;
27
27
  font-family: ${(props) => props.theme.typography.fontFamily.base};
28
28
  font-size: ${(props) => props.theme.typography.size.base};
29
+ font-weight: ${(props) => (props.$isReadOnly ? props.theme.typography.weight.bold : props.theme.typography.weight.normal)};
29
30
  `;
30
31
  export const FieldHelp = styled.p `
31
32
  color: ${(props) => props.theme.color.text.default};
@@ -6,14 +6,17 @@ import { FormRegistry } from "../../FormRegistry";
6
6
  import { CommonFieldWrapper as DateFieldWrapper } from "../../styles/common";
7
7
  import { DateInput } from "./DateInput";
8
8
  export const DateField = (props) => {
9
- const { templates } = useContext(FormRegistry);
9
+ const { templates, formLocalization } = useContext(FormRegistry);
10
+ const {} = useContext(FormRegistry);
10
11
  useSetDefault(props);
11
12
  const { name, uiSchema, schema } = props;
12
13
  const { props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
13
14
  const SelectedFieldTemplate = (props.uiSchema?.["ui:template"] &&
14
15
  templates[props.uiSchema?.["ui:template"]]) ??
15
16
  templates.FieldTemplate;
16
- const { label, placeholder, min, max, locale, helpText, disabled, errorMessages } = inputProps || {};
17
+ const { label, placeholder, min, max, locale, helpText, disabled, errorMessages, } = inputProps || {};
17
18
  const readOnly = schema.readOnly === true;
18
- return (_jsx(SelectedFieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(DateFieldWrapper, { children: _jsx(DateInput, { name: name, label: label, placeholder: placeholder, min: min, max: max, locale: locale, helpText: helpText, disabled: disabled, readOnly: readOnly, errorMessages: errorMessages }) }) }));
19
+ return (_jsx(SelectedFieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(DateFieldWrapper, { children: _jsx(DateInput, { name: name, label: label, placeholder: placeholder, min: min, max: max, locale: locale ??
20
+ formLocalization?.fields?.DateField?.locale ??
21
+ navigator.language, helpText: helpText, disabled: disabled, readOnly: readOnly, errorMessages: errorMessages }) }) }));
19
22
  };
@@ -1,16 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useContext, useEffect, useRef, useState, } from "react";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
3
  import { useField, useFormikContext } from "formik";
4
- import { Wrapper, Row, DisplayInput, HiddenNative, PickerButton, } from "./styledComponents";
4
+ import { Row, DisplayInput, HiddenNative, PickerButton, } from "./styledComponents";
5
5
  import { parseDateString, toIsoDateString } from "./dateParsing";
6
6
  import { FaCalendar } from "react-icons/fa";
7
- import { FormRegistry } from "../../FormRegistry";
8
7
  export const DateInput = ({ name, label, placeholder, min, max, locale, helpText, disabled, readOnly, errorMessages, }) => {
9
- const { formLocalization } = useContext(FormRegistry);
10
- const effectiveLocale = locale ?? formLocalization?.fields?.DateField?.locale ?? navigator.language;
11
- const firstDatePart = new Intl.DateTimeFormat(effectiveLocale)
8
+ const firstDatePart = new Intl.DateTimeFormat(locale)
12
9
  .formatToParts(new Date(Date.UTC(2000, 0, 2)))
13
- .find(p => p.type === "day" || p.type === "month" || p.type === "year");
10
+ .find((p) => p.type === "day" || p.type === "month" || p.type === "year");
14
11
  const preferOrder = firstDatePart?.type === "month" ? "MDY" : "DMY";
15
12
  const { setFieldTouched } = useFormikContext();
16
13
  const [field, meta, helpers] = useField(name);
@@ -23,16 +20,15 @@ export const DateInput = ({ name, label, placeholder, min, max, locale, helpText
23
20
  if (!/^\d{4}-\d{2}-\d{2}$/.test(iso)) {
24
21
  if (iso === "now") {
25
22
  const today = new Date();
26
- return new Intl.DateTimeFormat(effectiveLocale, { timeZone: "UTC" })
27
- .format(new Date(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate())));
23
+ return new Intl.DateTimeFormat(locale, { timeZone: "UTC" }).format(new Date(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate())));
28
24
  }
29
25
  return "";
30
26
  }
31
27
  const dt = new Date(`${iso}T00:00:00Z`);
32
28
  if (Number.isNaN(dt.getTime()))
33
29
  return "";
34
- return new Intl.DateTimeFormat(effectiveLocale, { timeZone: "UTC" }).format(dt);
35
- }, [effectiveLocale]);
30
+ return new Intl.DateTimeFormat(locale, { timeZone: "UTC" }).format(dt);
31
+ }, [locale]);
36
32
  const [displayValue, setDisplayValue] = useState(formatForDisplay(value));
37
33
  useEffect(() => {
38
34
  if (!value)
@@ -52,7 +48,10 @@ export const DateInput = ({ name, label, placeholder, min, max, locale, helpText
52
48
  "Date is out of range.";
53
49
  const raw = errorMessages?.outOfRange;
54
50
  if (typeof raw === "function") {
55
- return raw({ min, max });
51
+ return raw({
52
+ min,
53
+ max,
54
+ });
56
55
  }
57
56
  const s = typeof raw === "string" ? raw : fallback;
58
57
  return s.replace(/\{min\}/g, min ?? "").replace(/\{max\}/g, max ?? "");
@@ -95,7 +94,16 @@ export const DateInput = ({ name, label, placeholder, min, max, locale, helpText
95
94
  else {
96
95
  setError(invalidMessage);
97
96
  }
98
- }, [disabled, readOnly, preferOrder, name, onValueChange, setError, setFieldTouched, invalidMessage]);
97
+ }, [
98
+ disabled,
99
+ readOnly,
100
+ preferOrder,
101
+ name,
102
+ onValueChange,
103
+ setError,
104
+ setFieldTouched,
105
+ invalidMessage,
106
+ ]);
99
107
  const handlePaste = useCallback((e) => {
100
108
  if (readOnly || disabled)
101
109
  return;
@@ -103,7 +111,7 @@ export const DateInput = ({ name, label, placeholder, min, max, locale, helpText
103
111
  const text = e.clipboardData.getData("text")?.trim();
104
112
  handleParseOrError(text ?? "");
105
113
  }, [readOnly, disabled, handleParseOrError]);
106
- return (_jsxs(Wrapper, { children: [_jsx("label", { htmlFor: `${name}-display`, children: label }), _jsxs(Row, { children: [_jsx(DisplayInput, { id: `${name}-display`, type: "text", placeholder: placeholder, autoComplete: "off", inputMode: "numeric", "aria-describedby": helpText ? `${name}-help` : undefined, "aria-invalid": hasExternalError, value: displayValue, onChange: (e) => setDisplayValue(e.target.value), onBlur: (e) => handleParseOrError(e.target.value), onPaste: handlePaste, disabled: disabled || readOnly, readOnly: readOnly }), !readOnly && (_jsx(HiddenNative, { ref: nativeRef, id: `${name}-native`, type: "date", min: min, max: max, value: value ?? "", onChange: (e) => {
114
+ return (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: `${name}-display`, children: label }), _jsxs(Row, { children: [_jsx(DisplayInput, { id: `${name}-display`, type: "text", placeholder: placeholder, autoComplete: "off", inputMode: "numeric", "aria-describedby": helpText ? `${name}-help` : undefined, "aria-invalid": hasExternalError, value: displayValue, onChange: (e) => setDisplayValue(e.target.value), onBlur: (e) => handleParseOrError(e.target.value), onPaste: handlePaste, disabled: disabled, readOnly: readOnly }), !readOnly && (_jsx(HiddenNative, { ref: nativeRef, id: `${name}-native`, type: "date", min: min, max: max, value: value ?? "", onChange: (e) => {
107
115
  onValueChange(e.target.value);
108
- }, tabIndex: -1, "aria-hidden": "true" })), _jsx(PickerButton, { type: "button", onClick: openPicker, "aria-label": "Date picker", title: "Date picker", disabled: disabled || readOnly, children: _jsx(FaCalendar, {}) })] })] }));
116
+ }, tabIndex: -1, "aria-hidden": "true" })), !readOnly && (_jsx(PickerButton, { type: "button", onClick: openPicker, "aria-label": "Date picker", title: "Date picker", disabled: disabled, children: _jsx(FaCalendar, {}) }))] })] }));
109
117
  };
@@ -1,16 +1,27 @@
1
1
  import styled from "styled-components";
2
- export const Wrapper = styled.div `
3
- display: inline-flex;
4
- flex-direction: column;
5
- max-width: 360px;
6
- `;
7
2
  export const Row = styled.div `
8
- position: relative;
9
3
  display: flex;
10
- align-items: center;
4
+ flex-direction: row;
5
+ font-family: ${(props) => props.theme.typography.fontFamily.base};
6
+ position: relative;
11
7
  `;
12
8
  export const DisplayInput = styled.input `
13
- flex: 1;
9
+ display: flex;
10
+ flex-grow: 1;
11
+ padding-right: ${(props) => props.theme.spacing.xxxl} !important;
12
+
13
+ &:disabled {
14
+ background-color: transparent;
15
+ border: none;
16
+ }
17
+
18
+ &:read-only {
19
+ &:focus, &:focus-visible {
20
+ border: none;
21
+ stroke: none;
22
+ box-shadow: none;
23
+ }
24
+ }
14
25
  `;
15
26
  export const HiddenNative = styled.input `
16
27
  position: absolute;
@@ -20,20 +31,24 @@ export const HiddenNative = styled.input `
20
31
  height: 0;
21
32
  `;
22
33
  export const PickerButton = styled.button `
23
- position: relative;
24
- left: -40px;
34
+ position: absolute;
35
+ right: 0;
36
+ top: 0;
37
+ height: 100%;
38
+ left: auto;
25
39
  border: none;
26
40
  background: inherit;
27
41
  cursor: pointer;
28
42
  font: inherit;
29
- &:focus {
30
- box-shadow: none;;
31
- }
32
- &:disabled {
33
- cursor: not-allowed;
34
- opacity: 0.6;
35
- }
36
- svg {
37
- display: flex;
38
- }
43
+ &:focus, &:focus-visible {
44
+ ${(props) => props.theme.focus.default};
45
+ }
46
+ &:disabled {
47
+ cursor: not-allowed;
48
+ opacity: 0.6;
49
+ }
50
+ svg {
51
+ display: flex;
52
+ color: ${(props) => props.theme.color.intent.default.primary};
53
+ }
39
54
  `;
@@ -27,6 +27,12 @@ export const CommonFieldWrapper = styled.div `
27
27
  &::placeholder {
28
28
  color: ${(props) => props.theme.color.text.default};
29
29
  }
30
+
31
+ &:focus, &:focus-visible {
32
+ border: none;
33
+ stroke: none;
34
+ box-shadow: none;
35
+ }
30
36
  }
31
37
 
32
38
  &:disabled {
@@ -38,20 +44,19 @@ export const CommonFieldWrapper = styled.div `
38
44
  &::placeholder {
39
45
  color: ${(props) => props.theme.color.text.muted};
40
46
  }
47
+
48
+ &:focus, &:focus-visible {
49
+ border: none;
50
+ stroke: none;
51
+ box-shadow: none;
52
+ }
41
53
  }
42
54
 
43
- &:focus {
55
+ &:focus, &:focus-visible {
44
56
  ${(props) => props.theme.focus.default};
45
57
  }
46
58
  }
47
59
 
48
- ::-webkit-calendar-picker-indicator {
49
- background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 24 24"><path fill="${(props) => props.theme.color.text
50
- .default}" d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z"/></svg>');
51
-
52
- cursor: pointer;
53
- }
54
-
55
60
  select {
56
61
  appearance: none;
57
62
  -webkit-appearance: none;
@@ -20,5 +20,5 @@ export const FieldTemplate = (props) => {
20
20
  ...wrapperProps,
21
21
  ...dataAttributes, // This will only include data-* attributes
22
22
  };
23
- return (_jsxs(FieldWrapper, { ...mergedWrapperProps, "$isDisabled": isDisabled, children: [_jsxs(FieldTitleInfoWrapper, { children: [title && (_jsxs(FieldTitle, { ...titleProps, htmlFor: name, children: [title, props.required && _jsx(RequiredIndicator, {})] })), info && _jsx(FieldInfo, { ...info })] }), description && (_jsx(FieldDescription, { ...descriptionProps, children: description })), children, help && _jsx(FieldHelp, { ...helpProps, children: help }), _jsx(ErrorMessage, { ...errorProps, name: name })] }));
23
+ return (_jsxs(FieldWrapper, { ...mergedWrapperProps, "$isDisabled": isDisabled, children: [_jsxs(FieldTitleInfoWrapper, { children: [title && (_jsxs(FieldTitle, { ...titleProps, htmlFor: name, children: [title, props.required && _jsx(RequiredIndicator, {})] })), info && _jsx(FieldInfo, { ...info })] }), description && (_jsx(FieldDescription, { ...descriptionProps, "$isReadOnly": isReadOnly, children: description })), children, help && _jsx(FieldHelp, { ...helpProps, children: help }), _jsx(ErrorMessage, { ...errorProps, name: name })] }));
24
24
  };
@@ -1,6 +1,3 @@
1
- import * as formik from "formik";
2
- export declare const ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<formik.ErrorMessageProps, never>> & string & Omit<import("react").FC<formik.ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<import("react").ComponentClass<formik.ErrorMessageProps & {
3
- formik: formik.FormikContextType<formik.ErrorMessageProps & {
4
- formik: formik.FormikContextType<any>;
5
- }>;
6
- }, any>, {}>, keyof import("react").Component<any, {}, any>>;
1
+ export declare const ErrorMessage: ({ name }: {
2
+ name: string;
3
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -5,7 +5,9 @@ export declare const FieldWrapper: import("styled-components/dist/types").IStyle
5
5
  }>> & string;
6
6
  export declare const FieldTitleInfoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
7
  export declare const FieldTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
8
- export declare const FieldDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
8
+ export declare const FieldDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
9
+ $isReadOnly: boolean;
10
+ }>> & string;
9
11
  export declare const FieldHelp: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
10
12
  export declare const FieldInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
11
13
  ref?: unknown;
@@ -17,7 +17,9 @@ export declare const components: {
17
17
  }>> & string;
18
18
  FieldTitleInfoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
19
19
  FieldTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
20
- FieldDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
20
+ FieldDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
21
+ $isReadOnly: boolean;
22
+ }>> & string;
21
23
  FieldHelp: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
22
24
  FieldInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
23
25
  ref?: unknown;
@@ -35,26 +37,24 @@ export declare const components: {
35
37
  FieldInfoLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
36
38
  InlineFieldInfoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
37
39
  FieldInfo: React.FC<import("../../common/types/FieldInfo").FieldInfoProps>;
38
- ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("formik").ErrorMessageProps, never>> & string & Omit<import("react").FC<import("formik").ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<import("react").ComponentClass<import("formik").ErrorMessageProps & {
39
- formik: import("formik").FormikContextType<import("formik").ErrorMessageProps & {
40
- formik: import("formik").FormikContextType<any>;
41
- }>;
42
- }, any>, {}>, keyof import("react").Component<any, {}, any>>;
40
+ ErrorMessage: ({ name }: {
41
+ name: string;
42
+ }) => import("react/jsx-runtime").JSX.Element | null;
43
43
  ClickableEl: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
44
44
  Clickable: React.FC<Clickable.ClickableProps>;
45
45
  getComponents(components: ComponentsType): {
46
46
  Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
47
47
  Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>> & string;
48
48
  TitleInfoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
49
- Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
49
+ Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
50
+ $isReadOnly: boolean;
51
+ }>> & string;
50
52
  Help: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
51
53
  Info: import("react").FC<import("../../common/types/FieldInfo").FieldInfoProps>;
52
54
  RequiredIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
53
- ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("formik").ErrorMessageProps, never>> & string & Omit<import("react").FC<import("formik").ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<import("react").ComponentClass<import("formik").ErrorMessageProps & {
54
- formik: import("formik").FormikContextType<import("formik").ErrorMessageProps & {
55
- formik: import("formik").FormikContextType<any>;
56
- }>;
57
- }, any>, {}>, keyof import("react").Component<any, {}, any>>;
55
+ ErrorMessage: ({ name }: {
56
+ name: string;
57
+ }) => import("react/jsx-runtime").JSX.Element | null;
58
58
  };
59
59
  ObjectFieldTemplateWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
60
60
  ObjectFieldTemplateTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>> & string;
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
  export type DateInputProps = {
3
3
  name: string;
4
+ locale: string;
4
5
  label?: string;
5
6
  placeholder?: string;
6
7
  min?: string;
7
8
  max?: string;
8
- locale?: string;
9
9
  helpText?: string;
10
10
  disabled?: boolean;
11
11
  readOnly?: boolean;
@@ -1,4 +1,3 @@
1
- export declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
1
  export declare const Row: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
2
  export declare const DisplayInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
4
3
  export declare const HiddenNative: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
@@ -18,13 +18,13 @@ export declare function getComponents(components: ComponentsType): {
18
18
  Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
19
19
  TitleInfoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
20
20
  Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>> & string;
21
- Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
21
+ Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
22
+ $isReadOnly: boolean;
23
+ }>> & string;
22
24
  Help: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
23
25
  Info: import("react").FC<import("../../../common/types/FieldInfo").FieldInfoProps>;
24
26
  RequiredIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
25
- ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("formik").ErrorMessageProps, never>> & string & Omit<import("react").FC<import("formik").ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<import("react").ComponentClass<import("formik").ErrorMessageProps & {
26
- formik: import("formik").FormikContextType<import("formik").ErrorMessageProps & {
27
- formik: import("formik").FormikContextType<any>;
28
- }>;
29
- }, any>, {}>, keyof import("react").Component<any, {}, any>>;
27
+ ErrorMessage: ({ name }: {
28
+ name: string;
29
+ }) => import("react/jsx-runtime").JSX.Element | null;
30
30
  };
@@ -22,15 +22,15 @@ export declare function getComponents(components: ComponentsType): {
22
22
  Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>, "ref"> & {
23
23
  ref?: ((instance: HTMLLegendElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLLegendElement> | null | undefined;
24
24
  }, never>> & string;
25
- Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
25
+ Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
26
+ $isReadOnly: boolean;
27
+ }>> & string;
26
28
  Help: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
27
29
  Info: import("react").FC<import("../../../common/types/FieldInfo").FieldInfoProps>;
28
30
  RequiredIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
29
- ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("formik").ErrorMessageProps, never>> & string & Omit<import("react").FC<import("formik").ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<import("react").ComponentClass<import("formik").ErrorMessageProps & {
30
- formik: import("formik").FormikContextType<import("formik").ErrorMessageProps & {
31
- formik: import("formik").FormikContextType<any>;
32
- }>;
33
- }, any>, {}>, keyof import("react").Component<any, {}, any>>;
31
+ ErrorMessage: ({ name }: {
32
+ name: string;
33
+ }) => import("react/jsx-runtime").JSX.Element | null;
34
34
  Toggle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Readonly<import("@nolwenture/component-library").ButtonProps>, never>> & string & Omit<typeof Button, keyof import("react").Component<any, {}, any>>;
35
35
  ChildrenWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
36
36
  };
@@ -15,13 +15,13 @@ export declare function getComponents(components: ComponentsType): {
15
15
  Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
16
16
  Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>> & string;
17
17
  TitleInfoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
18
- Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
18
+ Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
19
+ $isReadOnly: boolean;
20
+ }>> & string;
19
21
  Help: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
20
22
  Info: import("react").FC<import("../../../common/types/FieldInfo").FieldInfoProps>;
21
23
  RequiredIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
22
- ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("formik").ErrorMessageProps, never>> & string & Omit<import("react").FC<import("formik").ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<import("react").ComponentClass<import("formik").ErrorMessageProps & {
23
- formik: import("formik").FormikContextType<import("formik").ErrorMessageProps & {
24
- formik: import("formik").FormikContextType<any>;
25
- }>;
26
- }, any>, {}>, keyof import("react").Component<any, {}, any>>;
24
+ ErrorMessage: ({ name }: {
25
+ name: string;
26
+ }) => import("react/jsx-runtime").JSX.Element | null;
27
27
  };
@@ -5,15 +5,15 @@ export declare const templateComponents: {
5
5
  Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
6
6
  Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>> & string;
7
7
  TitleInfoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
8
- Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
8
+ Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
9
+ $isReadOnly: boolean;
10
+ }>> & string;
9
11
  Help: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
10
12
  Info: import("react").FC<import("../../common/types/FieldInfo").FieldInfoProps>;
11
13
  RequiredIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
12
- ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("formik").ErrorMessageProps, never>> & string & Omit<import("react").FC<import("formik").ErrorMessageProps> & import("hoist-non-react-statics").NonReactStatics<import("react").ComponentClass<import("formik").ErrorMessageProps & {
13
- formik: import("formik").FormikContextType<import("formik").ErrorMessageProps & {
14
- formik: import("formik").FormikContextType<any>;
15
- }>;
16
- }, any>, {}>, keyof import("react").Component<any, {}, any>>;
14
+ ErrorMessage: ({ name }: {
15
+ name: string;
16
+ }) => import("react/jsx-runtime").JSX.Element | null;
17
17
  };
18
18
  ObjectFieldTemplateWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
19
19
  ObjectFieldTemplateTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>> & string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolwenture/formik-jsonschema-form",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Formik form generation from json schema",
5
5
  "author": "anttivikman <antti.vikman@nolwenture.com>",
6
6
  "contributors": [