@micromerce/formbuilder-react 1.0.1007 → 1.0.1009

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.
@@ -87,7 +87,7 @@ export interface GroupFormControl extends ControlCommons {
87
87
  }
88
88
  export interface InputFormControl extends ControlCommons {
89
89
  control: "input";
90
- type: "plain" | "html" | "hex" | "color" | "mrn" | "url" | "date" | "time" | "datetime" | "number" | "email" | "password" | "geolocation";
90
+ type: "plain" | "html" | "hex" | "color" | "mrn" | "url" | "date" | "time" | "datetime" | "number" | "email" | "tel" | "password" | "geolocation";
91
91
  placeholder?: string;
92
92
  pattern?: string;
93
93
  minLength?: number;
@@ -131,7 +131,7 @@ export interface ListFormControl extends ControlCommons {
131
131
  template: FormControls;
132
132
  }
133
133
  export type Control = "input" | "textarea" | "checkbox" | "select" | "list";
134
- export type ControlType = "plain" | "html" | "hex" | "color" | "mrn" | "url" | "date" | "time" | "datetime" | "number" | "email" | "password" | "geolocation" | "json";
134
+ export type ControlType = "plain" | "html" | "hex" | "color" | "mrn" | "url" | "date" | "time" | "datetime" | "number" | "email" | "tel" | "password" | "geolocation" | "json";
135
135
  export type FormControl = InputFormControl | TextareaFormControl | CheckboxFormControl | SelectFormControl | MultiSelectFormControl | ListFormControl | GroupFormControl;
136
136
  export interface FormControls {
137
137
  [key: string]: FormControl;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `custom-attributes.subtype` (COP-4585) — formbuilder-react's copy of the register
3
+ * form-xhtmlform/src/main/resources/com/micromerce/xhtmlform/form/control/subtypes.json; index.test.ts
4
+ * keeps the two in step. A subtype works on any input, inside or outside any group, independent of
5
+ * the input type; an unknown subtype is ignored. Only the server refuses a value (Subtypes in
6
+ * form-xhtmlform) and words the reason, localized, at the field; the editor uses `isValid` for the
7
+ * positive case only (a check mark) and never blocks a submit.
8
+ */
9
+ import { compactBic } from "../../components/controls/SubtypeInput/bankAccount";
10
+ export type Normalize = "compact-upper" | "upper" | "e164";
11
+ export interface ISubtype {
12
+ /** The server refuses a value that fails `check`. */
13
+ checked: boolean;
14
+ /** The shape a plain HTML form checks: the input's `pattern` when the form sets none. */
15
+ htmlPattern?: string;
16
+ /** What the editor stores when the field is left. */
17
+ normalize?: Normalize;
18
+ /** Whether a non-empty value passes — for the check mark only; the server decides and words the reason. */
19
+ isValid?: (value: string) => boolean;
20
+ /** How a valid value reads while the field is not being edited (the stored value is not changed). */
21
+ display?: (value: string) => string;
22
+ /** An example, shown as the placeholder of an empty field when the form sets none. */
23
+ example?: string;
24
+ /** How wide the field is: as wide as its longest value, in characters (`ch`). */
25
+ width?: number;
26
+ }
27
+ export declare const SUBTYPES: Record<string, ISubtype>;
28
+ /** The registered subtype name of an input's custom attributes, or undefined. */
29
+ export declare const subtypeOf: (customAttributes: unknown) => string | undefined;
30
+ /** The registered subtype of an input's custom attributes, or undefined. */
31
+ export declare const subtypeFor: (customAttributes: unknown) => ISubtype | undefined;
32
+ /** The `pattern` of a subtype, for an input whose form sets none. */
33
+ export declare const subtypePattern: (subtype: unknown) => string | undefined;
34
+ export declare const normalizeValue: (value: string, normalize: Normalize | undefined) => string;
35
+ export { compactBic };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromerce/formbuilder-react",
3
- "version": "1.0.1007",
3
+ "version": "1.0.1009",
4
4
  "description": "creates a form based on configuration",
5
5
  "main": "dist/formbuilder.js",
6
6
  "types": "dist/index.d.ts",
@@ -81,6 +81,7 @@
81
81
  "qs": "^6.16.0",
82
82
  "react-date-range": "2.0.1",
83
83
  "react-lite-youtube-embed": "^2.6.0",
84
+ "react-phone-number-input": "^3.4.18",
84
85
  "react-quill": "^2.0.0",
85
86
  "showdown": "^2.1.0",
86
87
  "styled-components": "^6.6.0",
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- import { IProps as InputProps } from "../Input/Input";
3
- /** The subtype that makes an input an IBAN or a BIC field, or undefined. */
4
- export declare const bankCodeSubtype: (customAttributes: unknown) => "iban" | "bic" | undefined;
5
- /**
6
- * An input with `custom-attributes.subtype` "iban" or "bic" (COP-4581). The behaviour belongs to the
7
- * field, wherever it stands — on its own or in a bank-account group:
8
- * - monospaced, read digit by digit;
9
- * - leaving the field stores the value compact and upper case ("DE89370400440532013000"); a valid
10
- * IBAN then reads in groups of four, focusing shows the compact value again for editing — only the
11
- * shown copy is formatted, the form state stays compact;
12
- * - a value that fails its check shows the reason below the field once the field was left, and
13
- * blocks the submit through the input's custom validity (FormBuilder's checkValidity()).
14
- * The server checks the same, like every field check (`BankAccountFormats` in form-xhtmlform); the input keeps
15
- * its `type` and gets a shape `pattern` (README, "HTML compatibility").
16
- */
17
- declare const BankCodeInput: (props: InputProps) => React.JSX.Element;
18
- export default BankCodeInput;
@@ -1 +0,0 @@
1
- export { default } from "./BankCodeInput";
@@ -1 +0,0 @@
1
- export declare const subtypePattern: (subtype: unknown) => string | undefined;