@react-foundry/form 0.1.8 → 0.2.0

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/Form.js CHANGED
@@ -1,82 +1,23 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.withField = exports.withForm = exports.withControl = exports.validator = exports.url = exports.required = exports.range = exports.past = exports.numeric = exports.minWords = exports.minLength = exports.minimum = exports.maxWords = exports.maxLength = exports.maximum = exports.integer = exports.future = exports.exactLength = exports.email = exports.date = exports.before = exports.after = exports.Form = exports.FormComponent = void 0;
37
- const react_1 = require("react");
38
- const forms_1 = __importStar(require("@react-foundry/forms"));
39
- const controls_1 = require("./controls");
40
- const fields_1 = require("./fields");
41
- require("../assets/Form.scss");
42
- const FormComponent = ({ classBlock, ...props }) => (0, react_1.createElement)(forms_1.default, {
1
+ import { createElement as h } from 'react';
2
+ import WTForm, { Fork, Page } from '@react-foundry/forms';
3
+ import { Submit } from './controls';
4
+ import { Checkboxes, DateInput, Input, Radios, Select, Textarea, TextInput } from './fields';
5
+ import '../assets/Form.scss';
6
+ export const FormComponent = ({ classBlock, ...props }) => h(WTForm, {
43
7
  ...props,
44
8
  classBlock: classBlock || 'react-foundry-form'
45
9
  });
46
- exports.FormComponent = FormComponent;
47
- exports.Form = Object.assign(exports.FormComponent, {
48
- Checkboxes: fields_1.Checkboxes,
49
- DateInput: fields_1.DateInput,
50
- Fork: forms_1.Fork,
51
- Input: fields_1.Input,
52
- Page: forms_1.Page,
53
- Radios: fields_1.Radios,
54
- Select: fields_1.Select,
55
- Submit: controls_1.Submit,
56
- Textarea: fields_1.Textarea,
57
- TextInput: fields_1.TextInput
10
+ export const Form = Object.assign(FormComponent, {
11
+ Checkboxes,
12
+ DateInput,
13
+ Fork,
14
+ Input,
15
+ Page,
16
+ Radios,
17
+ Select,
18
+ Submit,
19
+ Textarea,
20
+ TextInput
58
21
  });
59
- exports.default = exports.Form;
60
- var forms_2 = require("@react-foundry/forms");
61
- Object.defineProperty(exports, "after", { enumerable: true, get: function () { return forms_2.after; } });
62
- Object.defineProperty(exports, "before", { enumerable: true, get: function () { return forms_2.before; } });
63
- Object.defineProperty(exports, "date", { enumerable: true, get: function () { return forms_2.date; } });
64
- Object.defineProperty(exports, "email", { enumerable: true, get: function () { return forms_2.email; } });
65
- Object.defineProperty(exports, "exactLength", { enumerable: true, get: function () { return forms_2.exactLength; } });
66
- Object.defineProperty(exports, "future", { enumerable: true, get: function () { return forms_2.future; } });
67
- Object.defineProperty(exports, "integer", { enumerable: true, get: function () { return forms_2.integer; } });
68
- Object.defineProperty(exports, "maximum", { enumerable: true, get: function () { return forms_2.maximum; } });
69
- Object.defineProperty(exports, "maxLength", { enumerable: true, get: function () { return forms_2.maxLength; } });
70
- Object.defineProperty(exports, "maxWords", { enumerable: true, get: function () { return forms_2.maxWords; } });
71
- Object.defineProperty(exports, "minimum", { enumerable: true, get: function () { return forms_2.minimum; } });
72
- Object.defineProperty(exports, "minLength", { enumerable: true, get: function () { return forms_2.minLength; } });
73
- Object.defineProperty(exports, "minWords", { enumerable: true, get: function () { return forms_2.minWords; } });
74
- Object.defineProperty(exports, "numeric", { enumerable: true, get: function () { return forms_2.numeric; } });
75
- Object.defineProperty(exports, "past", { enumerable: true, get: function () { return forms_2.past; } });
76
- Object.defineProperty(exports, "range", { enumerable: true, get: function () { return forms_2.range; } });
77
- Object.defineProperty(exports, "required", { enumerable: true, get: function () { return forms_2.required; } });
78
- Object.defineProperty(exports, "url", { enumerable: true, get: function () { return forms_2.url; } });
79
- Object.defineProperty(exports, "validator", { enumerable: true, get: function () { return forms_2.validator; } });
80
- Object.defineProperty(exports, "withControl", { enumerable: true, get: function () { return forms_2.withControl; } });
81
- Object.defineProperty(exports, "withForm", { enumerable: true, get: function () { return forms_2.withForm; } });
82
- Object.defineProperty(exports, "withField", { enumerable: true, get: function () { return forms_2.withField; } });
22
+ export default Form;
23
+ export { after, before, date, email, exactLength, future, integer, maximum, maxLength, maxWords, minimum, minLength, minWords, numeric, past, range, required, url, validator, withControl, withForm, withField } from '@react-foundry/forms';
package/dist/controls.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Submit = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const forms_1 = require("@react-foundry/forms");
6
- const SubmitButton = ({ children, ...props }) => ((0, jsx_runtime_1.jsx)("button", { ...props, type: "submit", children: children }));
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { withControl } from '@react-foundry/forms';
3
+ const SubmitButton = ({ children, ...props }) => (_jsx("button", { ...props, type: "submit", children: children }));
7
4
  SubmitButton.displayName = 'Submit';
8
- exports.Submit = (0, forms_1.withControl)(SubmitButton);
5
+ export const Submit = withControl(SubmitButton);
package/dist/fields.js CHANGED
@@ -1,23 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Radios = exports.Checkboxes = exports.Textarea = exports.Select = exports.DateInput = exports.TextInput = exports.Input = void 0;
4
- const react_1 = require("react");
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const forms_1 = require("@react-foundry/forms");
7
- const _Input = ({ ...props }) => ((0, jsx_runtime_1.jsx)("input", { ...props }));
8
- const _TextInput = ({ ...props }) => ((0, jsx_runtime_1.jsx)("input", { type: "text", ...props }));
9
- const _DateInput = ({ ...props }) => ((0, jsx_runtime_1.jsx)("input", { type: "date", ...props }));
10
- const _Select = ({ options, ...props }) => ((0, jsx_runtime_1.jsx)("select", { ...props, children: options.map(({ label, selected, ...attrs }, i) => ((0, react_1.createElement)("option", { ...attrs, key: i }, label))) }));
11
- const _Textarea = ({ ...props }) => ((0, jsx_runtime_1.jsx)("textarea", { ...props }));
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { withForm } from '@react-foundry/forms';
4
+ const _Input = ({ ...props }) => (_jsx("input", { ...props }));
5
+ const _TextInput = ({ ...props }) => (_jsx("input", { type: "text", ...props }));
6
+ const _DateInput = ({ ...props }) => (_jsx("input", { type: "date", ...props }));
7
+ const _Select = ({ options, ...props }) => (_jsx("select", { ...props, children: options.map(({ label, selected, ...attrs }, i) => (_createElement("option", { ...attrs, key: i }, label))) }));
8
+ const _Textarea = ({ ...props }) => (_jsx("textarea", { ...props }));
12
9
  _Input.displayName = 'Input';
13
10
  _TextInput.displayName = 'TextInput';
14
11
  _DateInput.displayName = 'DateInput';
15
12
  _Select.displayName = 'Select';
16
13
  _Textarea.displayName = 'Textarea';
17
- exports.Input = (0, forms_1.withForm)(_Input);
18
- exports.TextInput = (0, forms_1.withForm)(_TextInput);
19
- exports.DateInput = (0, forms_1.withForm)(_DateInput);
20
- exports.Select = (0, forms_1.withForm)(_Select);
21
- exports.Checkboxes = exports.Select;
22
- exports.Radios = exports.Select;
23
- exports.Textarea = (0, forms_1.withForm)(_Textarea);
14
+ export const Input = withForm(_Input);
15
+ export const TextInput = withForm(_TextInput);
16
+ export const DateInput = withForm(_DateInput);
17
+ export const Select = withForm(_Select);
18
+ export const Textarea = withForm(_Textarea);
19
+ export { Select as Checkboxes, Select as Radios };
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@react-foundry/form",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "A component to collect information from the user.",
5
+ "type": "module",
5
6
  "main": "dist/Form.js",
6
7
  "sass": "assets/Form.scss",
7
8
  "exports": {
8
9
  ".": {
9
10
  "sass": "./assets/Form.scss",
10
11
  "types": "./dist/Form.d.ts",
11
- "import": "./dist/Form.mjs",
12
- "require": "./dist/Form.js",
13
- "default": "./dist/Form.mjs"
12
+ "import": "./dist/Form.js",
13
+ "default": "./dist/Form.js"
14
14
  }
15
15
  },
16
16
  "files": [
@@ -23,10 +23,10 @@
23
23
  "react-components"
24
24
  ],
25
25
  "dependencies": {
26
- "@react-foundry/forms": "^0.1.8"
26
+ "@react-foundry/forms": "^0.2.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "@react-foundry/docs-components": "^0.1.8",
29
+ "@react-foundry/docs-components": "^0.2.0",
30
30
  "@storybook/addon-docs": "^9.1.20",
31
31
  "react": "^19.2.4"
32
32
  },
@@ -42,17 +42,15 @@
42
42
  "@types/react": "19.2.14",
43
43
  "jest": "30.3.0",
44
44
  "jest-environment-jsdom": "30.3.0",
45
- "ts-jest": "29.4.6",
45
+ "ts-jest": "29.4.9",
46
46
  "typescript": "5.9.3",
47
- "@react-foundry/component-test-helpers": "0.1.8"
47
+ "@react-foundry/component-test-helpers": "0.2.0"
48
48
  },
49
49
  "scripts": {
50
50
  "test": "NODE_OPTIONS=--experimental-vm-modules jest",
51
- "build": "npm run build:esm && npm run build:cjs",
52
- "build:esm": "tsc -m es2022 && find dist -name '*.js' -exec sh -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\;",
53
- "build:cjs": "tsc",
51
+ "build": "tsc",
54
52
  "clean": "rm -rf dist tsconfig.tsbuildinfo"
55
53
  },
56
- "module": "dist/Form.mjs",
54
+ "module": "dist/Form.js",
57
55
  "typings": "dist/Form.d.ts"
58
56
  }
package/dist/Form.mjs DELETED
@@ -1,23 +0,0 @@
1
- import { createElement as h } from 'react';
2
- import WTForm, { Fork, Page } from '@react-foundry/forms';
3
- import { Submit } from './controls';
4
- import { Checkboxes, DateInput, Input, Radios, Select, Textarea, TextInput } from './fields';
5
- import '../assets/Form.scss';
6
- export const FormComponent = ({ classBlock, ...props }) => h(WTForm, {
7
- ...props,
8
- classBlock: classBlock || 'react-foundry-form'
9
- });
10
- export const Form = Object.assign(FormComponent, {
11
- Checkboxes,
12
- DateInput,
13
- Fork,
14
- Input,
15
- Page,
16
- Radios,
17
- Select,
18
- Submit,
19
- Textarea,
20
- TextInput
21
- });
22
- export default Form;
23
- export { after, before, date, email, exactLength, future, integer, maximum, maxLength, maxWords, minimum, minLength, minWords, numeric, past, range, required, url, validator, withControl, withForm, withField } from '@react-foundry/forms';
package/dist/controls.mjs DELETED
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { withControl } from '@react-foundry/forms';
3
- const SubmitButton = ({ children, ...props }) => (_jsx("button", { ...props, type: "submit", children: children }));
4
- SubmitButton.displayName = 'Submit';
5
- export const Submit = withControl(SubmitButton);
package/dist/fields.mjs DELETED
@@ -1,19 +0,0 @@
1
- import { createElement as _createElement } from "react";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { withForm } from '@react-foundry/forms';
4
- const _Input = ({ ...props }) => (_jsx("input", { ...props }));
5
- const _TextInput = ({ ...props }) => (_jsx("input", { type: "text", ...props }));
6
- const _DateInput = ({ ...props }) => (_jsx("input", { type: "date", ...props }));
7
- const _Select = ({ options, ...props }) => (_jsx("select", { ...props, children: options.map(({ label, selected, ...attrs }, i) => (_createElement("option", { ...attrs, key: i }, label))) }));
8
- const _Textarea = ({ ...props }) => (_jsx("textarea", { ...props }));
9
- _Input.displayName = 'Input';
10
- _TextInput.displayName = 'TextInput';
11
- _DateInput.displayName = 'DateInput';
12
- _Select.displayName = 'Select';
13
- _Textarea.displayName = 'Textarea';
14
- export const Input = withForm(_Input);
15
- export const TextInput = withForm(_TextInput);
16
- export const DateInput = withForm(_DateInput);
17
- export const Select = withForm(_Select);
18
- export const Textarea = withForm(_Textarea);
19
- export { Select as Checkboxes, Select as Radios };