@saas-ui/forms 1.5.3 → 2.0.0-next.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +19 -2
- package/dist/ajv/index.d.ts +21 -2
- package/dist/ajv/index.js +31 -2
- package/dist/ajv/index.js.map +1 -1
- package/dist/ajv/index.mjs +25 -0
- package/dist/ajv/index.mjs.map +1 -0
- package/dist/index.d.ts +606 -18
- package/dist/index.js +1251 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1140 -0
- package/dist/index.mjs.map +1 -0
- package/dist/yup/index.d.ts +41 -2
- package/dist/yup/index.js +95 -2
- package/dist/yup/index.js.map +1 -1
- package/dist/yup/index.mjs +86 -0
- package/dist/yup/index.mjs.map +1 -0
- package/dist/zod/index.d.ts +38 -2
- package/dist/zod/index.js +95 -2
- package/dist/zod/index.js.map +1 -1
- package/dist/zod/index.mjs +85 -0
- package/dist/zod/index.mjs.map +1 -0
- package/package.json +23 -33
- package/src/array-field.tsx +20 -13
- package/src/auto-form.tsx +13 -19
- package/src/field-resolver.ts +1 -1
- package/src/field.tsx +4 -9
- package/src/fields.tsx +1 -3
- package/src/form.tsx +69 -25
- package/src/index.ts +3 -0
- package/src/input-right-button/index.ts +1 -0
- package/src/input-right-button/input-right-button.stories.tsx +47 -0
- package/src/input-right-button/input-right-button.test.tsx +12 -0
- package/src/input-right-button/input-right-button.tsx +26 -0
- package/src/layout.tsx +1 -1
- package/src/number-input/index.ts +1 -0
- package/src/number-input/number-input.stories.tsx +39 -0
- package/src/number-input/number-input.test.tsx +6 -0
- package/src/number-input/number-input.tsx +56 -0
- package/src/object-field.tsx +1 -1
- package/src/password-input/index.ts +1 -0
- package/src/password-input/password-input.stories.tsx +50 -0
- package/src/password-input/password-input.test.tsx +20 -0
- package/src/password-input/password-input.tsx +69 -0
- package/src/pin-input/index.ts +1 -0
- package/src/pin-input/pin-input.stories.tsx +38 -0
- package/src/pin-input/pin-input.test.tsx +6 -0
- package/src/pin-input/pin-input.tsx +50 -0
- package/src/radio/index.ts +1 -0
- package/src/radio/radio-input.stories.tsx +45 -0
- package/src/radio/radio-input.tsx +58 -0
- package/src/radio/radio.test.tsx +6 -0
- package/src/select/index.ts +2 -0
- package/src/select/native-select.tsx +42 -0
- package/src/select/select.stories.tsx +144 -0
- package/src/select/select.test.tsx +8 -0
- package/src/select/select.tsx +185 -0
- package/src/step-form.tsx +24 -13
- package/src/submit-button.tsx +32 -38
- package/src/use-step-form.tsx +1 -1
- package/ajv/package.json +0 -28
- package/dist/ajv/ajv-resolver.d.ts +0 -11
- package/dist/ajv/ajv-resolver.d.ts.map +0 -1
- package/dist/ajv/index.d.ts.map +0 -1
- package/dist/ajv/index.modern.mjs +0 -2
- package/dist/ajv/index.modern.mjs.map +0 -1
- package/dist/array-field.d.ts +0 -64
- package/dist/array-field.d.ts.map +0 -1
- package/dist/auto-form.d.ts +0 -32
- package/dist/auto-form.d.ts.map +0 -1
- package/dist/display-field.d.ts +0 -10
- package/dist/display-field.d.ts.map +0 -1
- package/dist/display-if.d.ts +0 -15
- package/dist/display-if.d.ts.map +0 -1
- package/dist/field-resolver.d.ts +0 -13
- package/dist/field-resolver.d.ts.map +0 -1
- package/dist/field.d.ts +0 -147
- package/dist/field.d.ts.map +0 -1
- package/dist/fields.d.ts +0 -9
- package/dist/fields.d.ts.map +0 -1
- package/dist/form.d.ts +0 -44
- package/dist/form.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.modern.mjs +0 -2
- package/dist/index.modern.mjs.map +0 -1
- package/dist/layout.d.ts +0 -14
- package/dist/layout.d.ts.map +0 -1
- package/dist/object-field.d.ts +0 -12
- package/dist/object-field.d.ts.map +0 -1
- package/dist/step-form.d.ts +0 -38
- package/dist/step-form.d.ts.map +0 -1
- package/dist/submit-button.d.ts +0 -20
- package/dist/submit-button.d.ts.map +0 -1
- package/dist/use-array-field.d.ts +0 -95
- package/dist/use-array-field.d.ts.map +0 -1
- package/dist/use-step-form.d.ts +0 -40
- package/dist/use-step-form.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -3
- package/dist/utils.d.ts.map +0 -1
- package/dist/watch-field.d.ts +0 -11
- package/dist/watch-field.d.ts.map +0 -1
- package/dist/yup/index.d.ts.map +0 -1
- package/dist/yup/index.modern.mjs +0 -2
- package/dist/yup/index.modern.mjs.map +0 -1
- package/dist/yup/yup-resolver.d.ts +0 -29
- package/dist/yup/yup-resolver.d.ts.map +0 -1
- package/dist/zod/index.d.ts.map +0 -1
- package/dist/zod/index.modern.mjs +0 -2
- package/dist/zod/index.modern.mjs.map +0 -1
- package/dist/zod/zod-resolver.d.ts +0 -35
- package/dist/zod/zod-resolver.d.ts.map +0 -1
- package/yup/package.json +0 -26
- package/zod/package.json +0 -27
package/CHANGELOG.md
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
# @saas-ui/forms
|
2
2
|
|
3
|
-
##
|
3
|
+
## 2.0.0-next.1
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
-
-
|
7
|
+
- 166978bd: Fix esm bundle filename.
|
8
|
+
- Updated dependencies [166978bd]
|
9
|
+
- @saas-ui/core@2.0.0-next.1
|
10
|
+
|
11
|
+
## 2.0.0-next.0
|
12
|
+
|
13
|
+
### Major Changes
|
14
|
+
|
15
|
+
- d7c87a31: Moved form resolvers into a separate package.
|
16
|
+
- 8b82d945: Removed button package.
|
17
|
+
- f1e99198: Restructured packages.
|
18
|
+
|
19
|
+
### Patch Changes
|
20
|
+
|
21
|
+
- f1e99198: Migrated from microbundle to tsup for builds
|
22
|
+
- Updated dependencies [e94ca3c0]
|
23
|
+
- Updated dependencies [3a15e8c8]
|
24
|
+
- @saas-ui/core@2.0.0-next.0
|
8
25
|
|
9
26
|
## 1.5.2
|
10
27
|
|
package/dist/ajv/index.d.ts
CHANGED
@@ -1,2 +1,21 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { ajvResolver } from '@hookform/resolvers/ajv';
|
2
|
+
export { ajvResolver } from '@hookform/resolvers/ajv';
|
3
|
+
import { FieldResolver, CreateFormProps } from '@saas-ui/forms';
|
4
|
+
import { JSONSchemaType } from 'ajv';
|
5
|
+
export { JTDDataType, JTDSchemaType } from 'ajv/dist/jtd';
|
6
|
+
|
7
|
+
interface JsonSchemaFormReturn {
|
8
|
+
schema: JSONSchemaType<unknown>;
|
9
|
+
fieldResolver: FieldResolver;
|
10
|
+
resolver: ReturnType<typeof ajvResolver>;
|
11
|
+
}
|
12
|
+
declare const jsonSchemaForm: (schema: JSONSchemaType<unknown>) => JsonSchemaFormReturn;
|
13
|
+
|
14
|
+
type ResolverArgs = Parameters<typeof ajvResolver>;
|
15
|
+
interface CreateAjvFormProps extends CreateFormProps {
|
16
|
+
schemaOptions?: ResolverArgs[1];
|
17
|
+
resolverOptions?: ResolverArgs[2];
|
18
|
+
}
|
19
|
+
declare function createAjvForm(options?: CreateAjvFormProps): any;
|
20
|
+
|
21
|
+
export { CreateAjvFormProps, createAjvForm, jsonSchemaForm };
|
package/dist/ajv/index.js
CHANGED
@@ -1,2 +1,31 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var ajv = require('@hookform/resolvers/ajv');
|
4
|
+
var forms = require('@saas-ui/forms');
|
5
|
+
|
6
|
+
// ajv/src/ajv-resolver.ts
|
7
|
+
var jsonSchemaFieldResolver = (schema) => {
|
8
|
+
return forms.objectFieldResolver(schema.properties);
|
9
|
+
};
|
10
|
+
var jsonSchemaForm = (schema) => {
|
11
|
+
return {
|
12
|
+
schema,
|
13
|
+
fieldResolver: jsonSchemaFieldResolver(schema),
|
14
|
+
resolver: ajv.ajvResolver(schema)
|
15
|
+
};
|
16
|
+
};
|
17
|
+
function createAjvForm(options) {
|
18
|
+
return forms.createForm({
|
19
|
+
resolver: (schema) => ajv.ajvResolver(schema, options == null ? void 0 : options.schemaOptions, options == null ? void 0 : options.resolverOptions),
|
20
|
+
...options
|
21
|
+
});
|
22
|
+
}
|
23
|
+
|
24
|
+
Object.defineProperty(exports, 'ajvResolver', {
|
25
|
+
enumerable: true,
|
26
|
+
get: function () { return ajv.ajvResolver; }
|
27
|
+
});
|
28
|
+
exports.createAjvForm = createAjvForm;
|
29
|
+
exports.jsonSchemaForm = jsonSchemaForm;
|
30
|
+
//# sourceMappingURL=out.js.map
|
31
|
+
//# sourceMappingURL=index.js.map
|
package/dist/ajv/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../ajv/src/ajv-resolver.ts","../../ajv/src/create-ajv-form.ts"],"names":[],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,2BAA0C;AAMnD,IAAM,0BAA0B,CAAC,WAAoC;AACnE,SAAO,oBAAoB,OAAO,UAAU;AAC9C;AAQO,IAAM,iBAAiB,CAC5B,WACyB;AACzB,SAAO;AAAA,IACL;AAAA,IACA,eAAe,wBAAwB,MAAM;AAAA,IAC7C,UAAU,YAAY,MAAM;AAAA,EAC9B;AACF;;;ACzBA;AAAA,EACE;AAAA,OAIK;AAWA,SAAS,cAAc,SAAmC;AAC/D,SAAO,WAAW;AAAA,IAChB,UAAU,CAAC,WACT,YAAY,QAAQ,mCAAS,eAAe,mCAAS,eAAe;AAAA,IACtE,GAAG;AAAA,EACL,CAAC;AAOH","sourcesContent":["import { ajvResolver } from '@hookform/resolvers/ajv'\nimport { objectFieldResolver, FieldResolver } from '@saas-ui/forms'\n\nimport { JSONSchemaType } from 'ajv'\n\nexport { ajvResolver }\n\nconst jsonSchemaFieldResolver = (schema: JSONSchemaType<unknown>) => {\n return objectFieldResolver(schema.properties)\n}\n\ninterface JsonSchemaFormReturn {\n schema: JSONSchemaType<unknown>\n fieldResolver: FieldResolver\n resolver: ReturnType<typeof ajvResolver>\n}\n\nexport const jsonSchemaForm = (\n schema: JSONSchemaType<unknown>\n): JsonSchemaFormReturn => {\n return {\n schema,\n fieldResolver: jsonSchemaFieldResolver(schema),\n resolver: ajvResolver(schema),\n }\n}\n","import {\n createForm,\n CreateFormProps,\n FieldValues,\n FormProps,\n} from '@saas-ui/forms'\nimport { ajvResolver } from './ajv-resolver'\nimport { JSONSchemaType } from 'ajv'\n\ntype ResolverArgs = Parameters<typeof ajvResolver>\n\nexport interface CreateAjvFormProps extends CreateFormProps {\n schemaOptions?: ResolverArgs[1]\n resolverOptions?: ResolverArgs[2]\n}\n\nexport function createAjvForm(options?: CreateAjvFormProps): any {\n return createForm({\n resolver: (schema) =>\n ajvResolver(schema, options?.schemaOptions, options?.resolverOptions),\n ...options,\n }) as <\n TFieldValues extends FieldValues = FieldValues,\n TSchema extends JSONSchemaType<TFieldValues> = JSONSchemaType<TFieldValues>,\n TContext extends object = object\n >(\n props: FormProps<TFieldValues, TContext, TSchema>\n ) => React.ReactElement\n}\n"]}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { ajvResolver } from '@hookform/resolvers/ajv';
|
2
|
+
export { ajvResolver } from '@hookform/resolvers/ajv';
|
3
|
+
import { createForm, objectFieldResolver } from '@saas-ui/forms';
|
4
|
+
|
5
|
+
// ajv/src/ajv-resolver.ts
|
6
|
+
var jsonSchemaFieldResolver = (schema) => {
|
7
|
+
return objectFieldResolver(schema.properties);
|
8
|
+
};
|
9
|
+
var jsonSchemaForm = (schema) => {
|
10
|
+
return {
|
11
|
+
schema,
|
12
|
+
fieldResolver: jsonSchemaFieldResolver(schema),
|
13
|
+
resolver: ajvResolver(schema)
|
14
|
+
};
|
15
|
+
};
|
16
|
+
function createAjvForm(options) {
|
17
|
+
return createForm({
|
18
|
+
resolver: (schema) => ajvResolver(schema, options == null ? void 0 : options.schemaOptions, options == null ? void 0 : options.resolverOptions),
|
19
|
+
...options
|
20
|
+
});
|
21
|
+
}
|
22
|
+
|
23
|
+
export { createAjvForm, jsonSchemaForm };
|
24
|
+
//# sourceMappingURL=out.js.map
|
25
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../ajv/src/ajv-resolver.ts","../../ajv/src/create-ajv-form.ts"],"names":[],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,2BAA0C;AAMnD,IAAM,0BAA0B,CAAC,WAAoC;AACnE,SAAO,oBAAoB,OAAO,UAAU;AAC9C;AAQO,IAAM,iBAAiB,CAC5B,WACyB;AACzB,SAAO;AAAA,IACL;AAAA,IACA,eAAe,wBAAwB,MAAM;AAAA,IAC7C,UAAU,YAAY,MAAM;AAAA,EAC9B;AACF;;;ACzBA;AAAA,EACE;AAAA,OAIK;AAWA,SAAS,cAAc,SAAmC;AAC/D,SAAO,WAAW;AAAA,IAChB,UAAU,CAAC,WACT,YAAY,QAAQ,mCAAS,eAAe,mCAAS,eAAe;AAAA,IACtE,GAAG;AAAA,EACL,CAAC;AAOH","sourcesContent":["import { ajvResolver } from '@hookform/resolvers/ajv'\nimport { objectFieldResolver, FieldResolver } from '@saas-ui/forms'\n\nimport { JSONSchemaType } from 'ajv'\n\nexport { ajvResolver }\n\nconst jsonSchemaFieldResolver = (schema: JSONSchemaType<unknown>) => {\n return objectFieldResolver(schema.properties)\n}\n\ninterface JsonSchemaFormReturn {\n schema: JSONSchemaType<unknown>\n fieldResolver: FieldResolver\n resolver: ReturnType<typeof ajvResolver>\n}\n\nexport const jsonSchemaForm = (\n schema: JSONSchemaType<unknown>\n): JsonSchemaFormReturn => {\n return {\n schema,\n fieldResolver: jsonSchemaFieldResolver(schema),\n resolver: ajvResolver(schema),\n }\n}\n","import {\n createForm,\n CreateFormProps,\n FieldValues,\n FormProps,\n} from '@saas-ui/forms'\nimport { ajvResolver } from './ajv-resolver'\nimport { JSONSchemaType } from 'ajv'\n\ntype ResolverArgs = Parameters<typeof ajvResolver>\n\nexport interface CreateAjvFormProps extends CreateFormProps {\n schemaOptions?: ResolverArgs[1]\n resolverOptions?: ResolverArgs[2]\n}\n\nexport function createAjvForm(options?: CreateAjvFormProps): any {\n return createForm({\n resolver: (schema) =>\n ajvResolver(schema, options?.schemaOptions, options?.resolverOptions),\n ...options,\n }) as <\n TFieldValues extends FieldValues = FieldValues,\n TSchema extends JSONSchemaType<TFieldValues> = JSONSchemaType<TFieldValues>,\n TContext extends object = object\n >(\n props: FormProps<TFieldValues, TContext, TSchema>\n ) => React.ReactElement\n}\n"]}
|