autoforma 1.0.0 → 1.0.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/dist/index.cjs.js +70 -0
- package/dist/index.es.js +13532 -0
- package/dist/src/components/AutoForm.d.ts +18 -0
- package/dist/src/components/FieldRender.d.ts +16 -0
- package/dist/src/components/fields/ArrayField.d.ts +13 -0
- package/dist/src/components/fields/CheckField.d.ts +7 -0
- package/dist/src/components/fields/DateField.d.ts +6 -0
- package/dist/src/components/fields/DateTimeField.d.ts +6 -0
- package/dist/src/components/fields/NumberField.d.ts +6 -0
- package/dist/src/components/fields/ObjectField.d.ts +9 -0
- package/dist/src/components/fields/SelectField.d.ts +10 -0
- package/dist/src/components/fields/TextAreaField.d.ts +6 -0
- package/dist/src/components/fields/TextField.d.ts +6 -0
- package/dist/src/components/fields/TimeField.d.ts +6 -0
- package/{src/index.ts → dist/src/index.d.ts} +2 -3
- package/dist/src/stories/AutoForm.stories.d.ts +9 -0
- package/dist/src/stories/Fields.stories.d.ts +12 -0
- package/dist/src/theme.d.ts +141 -0
- package/dist/src/types/custom-render.d.ts +11 -0
- package/dist/src/types/field.d.ts +30 -0
- package/dist/src/types/form.d.ts +7 -0
- package/{test-utils/index.ts → dist/test-utils/index.d.ts} +1 -2
- package/dist/test-utils/render.d.ts +1 -0
- package/package.json +9 -3
- package/.github/workflows/npm_test.yml +0 -27
- package/.nvmrc +0 -1
- package/.prettierrc.mjs +0 -35
- package/.storybook/main.ts +0 -17
- package/.storybook/preview.tsx +0 -18
- package/.storybook/vitest.setup.ts +0 -9
- package/.stylelintignore +0 -1
- package/.stylelintrc.json +0 -28
- package/.yarn/releases/yarn-4.9.1.cjs +0 -948
- package/.yarnrc.yml +0 -3
- package/eslint.config.js +0 -11
- package/index.html +0 -16
- package/postcss.config.cjs +0 -14
- package/src/favicon.svg +0 -1
- package/src/stories/AutoForm.stories.tsx +0 -473
- package/src/stories/Fields.stories.tsx +0 -190
- package/src/theme.ts +0 -5
- package/src/vite-env.d.ts +0 -1
- package/storybook-static/assets/AutoForm-CEr4m2za.js +0 -53
- package/storybook-static/assets/AutoForm.stories-CtOmRKOV.js +0 -164
- package/storybook-static/assets/Color-YHDXOIA2-pc5-Ao7n.js +0 -1
- package/storybook-static/assets/DocsRenderer-CFRXHY34-D-_1VvMG.js +0 -575
- package/storybook-static/assets/Fields.stories-CoRkpMbJ.js +0 -29
- package/storybook-static/assets/chunk-XP5HYGXS-BpfKkqn7.js +0 -1
- package/storybook-static/assets/entry-preview-CkHoqRUh.js +0 -2
- package/storybook-static/assets/entry-preview-docs-hFR7sEJd.js +0 -46
- package/storybook-static/assets/get-contrast-color-Db6nT3bs.js +0 -1
- package/storybook-static/assets/iframe-CzpwBD2i.js +0 -211
- package/storybook-static/assets/index-B8rYRX2K.js +0 -1
- package/storybook-static/assets/index-BQQLSK9g.js +0 -1
- package/storybook-static/assets/index-CXQShRbs.js +0 -8
- package/storybook-static/assets/index-D4lIrffr.js +0 -9
- package/storybook-static/assets/index-Domkg0jQ.js +0 -240
- package/storybook-static/assets/index-DrFu-skq.js +0 -6
- package/storybook-static/assets/index-DsJinFGm.js +0 -9
- package/storybook-static/assets/jsx-runtime-D_zvdyIk.js +0 -9
- package/storybook-static/assets/preview-B8lJiyuQ.js +0 -34
- package/storybook-static/assets/preview-BBWR9nbA.js +0 -1
- package/storybook-static/assets/preview-BOfrPh1e.js +0 -2
- package/storybook-static/assets/preview-BWzBA1C2.js +0 -396
- package/storybook-static/assets/preview-C2Qr78FS.js +0 -4
- package/storybook-static/assets/preview-CvbIS5ZJ.js +0 -1
- package/storybook-static/assets/preview-DD_OYowb.js +0 -1
- package/storybook-static/assets/preview-DGUiP6tS.js +0 -7
- package/storybook-static/assets/preview-DioFdWiE.css +0 -1
- package/storybook-static/assets/preview-Dyg8NwXV.js +0 -1
- package/storybook-static/assets/react-18-Dhjvimrl.js +0 -25
- package/storybook-static/assets/test-utils--_O2wM1y.js +0 -9
- package/storybook-static/favicon.svg +0 -1
- package/storybook-static/iframe.html +0 -666
- package/storybook-static/index.html +0 -181
- package/storybook-static/index.json +0 -1
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +0 -1
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +0 -331
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +0 -51
- package/storybook-static/sb-addons/docs-11/manager-bundle.js +0 -242
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js +0 -12
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +0 -402
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/onboarding-8/manager-bundle.js +0 -127
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
- package/storybook-static/sb-addons/storybook-experimental-addon-test-10/manager-bundle.js +0 -223
- package/storybook-static/sb-common-assets/favicon.svg +0 -1
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +0 -1051
- package/storybook-static/sb-manager/globals-runtime.js +0 -41591
- package/storybook-static/sb-manager/globals.js +0 -48
- package/storybook-static/sb-manager/runtime.js +0 -12048
- package/test-utils/render.tsx +0 -11
- package/text +0 -64
- package/tsconfig.json +0 -25
- package/vite.config.mjs +0 -19
- package/vitest.setup.mjs +0 -29
- package/vitest.shims.d.ts +0 -1
- package/vitest.workspace.js +0 -30
package/test-utils/render.tsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { render as testingLibraryRender } from '@testing-library/react';
|
|
2
|
-
import { MantineProvider } from '@mantine/core';
|
|
3
|
-
import { theme } from '../src/theme';
|
|
4
|
-
|
|
5
|
-
export function render(ui: React.ReactNode) {
|
|
6
|
-
return testingLibraryRender(ui, {
|
|
7
|
-
wrapper: ({ children }: { children: React.ReactNode }) => (
|
|
8
|
-
<MantineProvider theme={theme}>{children}</MantineProvider>
|
|
9
|
-
),
|
|
10
|
-
});
|
|
11
|
-
}
|
package/text
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
customRender={(field, value, error, onParentChange, formValues, options) => {
|
|
2
|
-
if (field.type === 'object' && field?.fields) {
|
|
3
|
-
const onChange = (name: string, value: any) => {
|
|
4
|
-
onParentChange(`${field.name}.${name}`, value);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const parentName = field.name;
|
|
8
|
-
|
|
9
|
-
const fieldError: Record<string, React.ReactNode> =
|
|
10
|
-
error &&
|
|
11
|
-
typeof error === 'object' &&
|
|
12
|
-
!React.isValidElement(error) &&
|
|
13
|
-
!Array.isArray(error) &&
|
|
14
|
-
!(error instanceof Promise)
|
|
15
|
-
? (error as Record<string, React.ReactNode>)
|
|
16
|
-
: {};
|
|
17
|
-
|
|
18
|
-
const content = field?.fields.map((field, index) => (
|
|
19
|
-
<Grid.Col key={index} span={{ base: 12, md: 6 }}>
|
|
20
|
-
<FieldRender
|
|
21
|
-
key={index}
|
|
22
|
-
field={field}
|
|
23
|
-
formValues={formValues}
|
|
24
|
-
onChange={onChange}
|
|
25
|
-
error={fieldError[`${parentName}.${field.name}`]}
|
|
26
|
-
value={value[field.name]}
|
|
27
|
-
/>
|
|
28
|
-
</Grid.Col>
|
|
29
|
-
));
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<>
|
|
33
|
-
<Accordion
|
|
34
|
-
defaultValue={field.name}
|
|
35
|
-
variant="contained"
|
|
36
|
-
styles={{
|
|
37
|
-
root: {
|
|
38
|
-
border:
|
|
39
|
-
typeof error === 'object' && Object.keys(fieldError).length
|
|
40
|
-
? 'red 1px solid'
|
|
41
|
-
: undefined,
|
|
42
|
-
},
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<Accordion.Item value={field.name}>
|
|
46
|
-
<Accordion.Control
|
|
47
|
-
styles={{
|
|
48
|
-
label: {
|
|
49
|
-
visibility: 'hidden',
|
|
50
|
-
},
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
{field.label}
|
|
54
|
-
</Accordion.Control>
|
|
55
|
-
<Accordion.Panel>
|
|
56
|
-
<Grid>{content}</Grid>
|
|
57
|
-
</Accordion.Panel>
|
|
58
|
-
</Accordion.Item>
|
|
59
|
-
</Accordion>
|
|
60
|
-
</>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}}
|
package/tsconfig.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"types": ["node", "@testing-library/jest-dom", "vitest/globals"],
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"useDefineForClassFields": true,
|
|
6
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
7
|
-
"allowJs": false,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"esModuleInterop": false,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"module": "ESNext",
|
|
14
|
-
"moduleResolution": "Node",
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"isolatedModules": true,
|
|
17
|
-
"noEmit": true,
|
|
18
|
-
"jsx": "react-jsx",
|
|
19
|
-
"paths": {
|
|
20
|
-
"@/*": ["./src/*"],
|
|
21
|
-
"@test-utils": ["./test-utils"]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"include": ["src", "test-utils"]
|
|
25
|
-
}
|
package/vite.config.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import react from '@vitejs/plugin-react';
|
|
3
|
-
import dts from 'vite-plugin-dts';
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
build: {
|
|
7
|
-
lib: {
|
|
8
|
-
entry: 'src/index.ts',
|
|
9
|
-
name: 'AutoForma',
|
|
10
|
-
formats: ['es', 'cjs'],
|
|
11
|
-
fileName: (format) => `index.${format}.js`,
|
|
12
|
-
},
|
|
13
|
-
rollupOptions: {
|
|
14
|
-
external: ['react', 'react-dom'],
|
|
15
|
-
},
|
|
16
|
-
outDir: 'dist',
|
|
17
|
-
},
|
|
18
|
-
plugins: [react(), dts()],
|
|
19
|
-
});
|
package/vitest.setup.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom/vitest';
|
|
2
|
-
|
|
3
|
-
import { vi } from 'vitest';
|
|
4
|
-
|
|
5
|
-
const { getComputedStyle } = window;
|
|
6
|
-
window.getComputedStyle = (elt) => getComputedStyle(elt);
|
|
7
|
-
window.HTMLElement.prototype.scrollIntoView = () => {};
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(window, 'matchMedia', {
|
|
10
|
-
writable: true,
|
|
11
|
-
value: vi.fn().mockImplementation((query) => ({
|
|
12
|
-
matches: false,
|
|
13
|
-
media: query,
|
|
14
|
-
onchange: null,
|
|
15
|
-
addListener: vi.fn(),
|
|
16
|
-
removeListener: vi.fn(),
|
|
17
|
-
addEventListener: vi.fn(),
|
|
18
|
-
removeEventListener: vi.fn(),
|
|
19
|
-
dispatchEvent: vi.fn(),
|
|
20
|
-
})),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
class ResizeObserver {
|
|
24
|
-
observe() {}
|
|
25
|
-
unobserve() {}
|
|
26
|
-
disconnect() {}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
window.ResizeObserver = ResizeObserver;
|
package/vitest.shims.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@vitest/browser/providers/playwright" />
|
package/vitest.workspace.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { storybookTest } from '@storybook/experimental-addon-test/vitest-plugin';
|
|
4
|
-
import { defineWorkspace } from 'vitest/config';
|
|
5
|
-
|
|
6
|
-
const dirname =
|
|
7
|
-
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
|
|
9
|
-
// More info at: https://storybook.js.org/docs/writing-tests/test-addon
|
|
10
|
-
export default defineWorkspace([
|
|
11
|
-
'vite.config.mjs',
|
|
12
|
-
{
|
|
13
|
-
extends: 'vite.config.mjs',
|
|
14
|
-
plugins: [
|
|
15
|
-
// The plugin will run tests for the stories defined in your Storybook config
|
|
16
|
-
// See options at: https://storybook.js.org/docs/writing-tests/test-addon#storybooktest
|
|
17
|
-
storybookTest({ configDir: path.join(dirname, '.storybook') }),
|
|
18
|
-
],
|
|
19
|
-
test: {
|
|
20
|
-
name: 'storybook',
|
|
21
|
-
browser: {
|
|
22
|
-
enabled: true,
|
|
23
|
-
headless: true,
|
|
24
|
-
provider: 'playwright',
|
|
25
|
-
instances: [{ browser: 'chromium' }],
|
|
26
|
-
},
|
|
27
|
-
setupFiles: ['.storybook/vitest.setup.ts'],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
]);
|