@conform-to/react 1.4.0 → 1.5.1

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/README.md ADDED
@@ -0,0 +1,36 @@
1
+ ```
2
+ ███████╗ ██████╗ ███╗ ██╗ ████████╗ ██████╗ ███████╗ ███╗ ███╗
3
+ ██╔═════╝ ██╔═══██╗ ████╗ ██║ ██╔═════╝ ██╔═══██╗ ██╔═══██╗ ████████║
4
+ ██║ ██║ ██║ ██╔██╗██║ ███████╗ ██║ ██║ ███████╔╝ ██╔██╔██║
5
+ ██║ ██║ ██║ ██║╚████║ ██╔════╝ ██║ ██║ ██╔═══██╗ ██║╚═╝██║
6
+ ╚███████╗ ╚██████╔╝ ██║ ╚███║ ██║ ╚██████╔╝ ██║ ██║ ██║ ██║
7
+ ╚══════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
8
+ ```
9
+
10
+ Version 1.5.1 / License MIT / Copyright (c) 2024 Edmund Hung
11
+
12
+ A type-safe form validation library utilizing web fundamentals to progressively enhance HTML Forms with full support for server frameworks like Remix and Next.js.
13
+
14
+ # Getting Started
15
+
16
+ Check out the overview and tutorial at our website https://conform.guide
17
+
18
+ # Features
19
+
20
+ - Progressive enhancement first APIs
21
+ - Type-safe field inference
22
+ - Fine-grained subscription
23
+ - Built-in accessibility helpers
24
+ - Automatic type coercion with Zod
25
+
26
+ # Documentation
27
+
28
+ - Validation: https://conform.guide/validation
29
+ - Nested object and Array: https://conform.guide/complex-structures
30
+ - UI Integrations: https://conform.guide/integration/ui-libraries
31
+ - Intent button: https://conform.guide/intent-button
32
+ - Accessibility Guide: https://conform.guide/accessibility
33
+
34
+ # Support
35
+
36
+ To report a bug, please open an issue on the repository at https://github.com/edmundhung/conform. For feature requests and questions, you can post them in the Discussions section.
package/integrations.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type Key, type RefCallback } from 'react';
2
2
  export declare function getFormElement(formId: string): HTMLFormElement | null;
3
3
  export declare function getFieldElements(form: HTMLFormElement | null, name: string): Array<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
4
4
  export declare function getEventTarget(form: HTMLFormElement | null, name: string, value?: string | string[]): HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null;
5
- export declare function createDummySelect(form: HTMLFormElement, name: string, value?: string | string[] | undefined): HTMLSelectElement;
5
+ export declare function createDummySelect(form: HTMLFormElement, name: string, value: string | string[]): HTMLSelectElement;
6
6
  export declare function isDummySelect(element: HTMLElement): element is HTMLSelectElement;
7
7
  export declare function getInputValue(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): string | string[] | null;
8
8
  export declare function useInputEvent(onUpdate: React.Dispatch<React.SetStateAction<string | string[] | undefined>>): {
package/integrations.js CHANGED
@@ -31,7 +31,7 @@ function createDummySelect(form, name, value) {
31
31
  var select = document.createElement('select');
32
32
  var options = typeof value === 'string' ? [value] : value !== null && value !== void 0 ? value : [];
33
33
  select.name = name;
34
- select.multiple = true;
34
+ select.multiple = Array.isArray(value);
35
35
  select.dataset.conform = 'true';
36
36
 
37
37
  // To make sure the input is hidden but still focusable
package/integrations.mjs CHANGED
@@ -27,7 +27,7 @@ function createDummySelect(form, name, value) {
27
27
  var select = document.createElement('select');
28
28
  var options = typeof value === 'string' ? [value] : value !== null && value !== void 0 ? value : [];
29
29
  select.name = name;
30
- select.multiple = true;
30
+ select.multiple = Array.isArray(value);
31
31
  select.dataset.conform = 'true';
32
32
 
33
33
  // To make sure the input is hidden but still focusable
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Conform view adapter for react",
4
4
  "homepage": "https://conform.guide",
5
5
  "license": "MIT",
6
- "version": "1.4.0",
6
+ "version": "1.5.1",
7
7
  "main": "index.js",
8
8
  "module": "index.mjs",
9
9
  "types": "index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "url": "https://github.com/edmundhung/conform/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@conform-to/dom": "1.4.0"
33
+ "@conform-to/dom": "1.5.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.17.8",