@twintag/twintag-form 1.1.1 → 1.2.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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +12 -0
- package/dev/main.tsx +24 -0
- package/dist/components/form.d.ts +8 -8
- package/dist/index.d.ts +2 -3
- package/dist/twintag-form.react.js +2293 -2286
- package/dist/twintag-form.webcomponent.js +1 -0
- package/index.html +26 -15
- package/lib/components/form.tsx +82 -69
- package/lib/index.tsx +18 -14
- package/lib/webcomponent.ts +1 -0
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @twintag/twintag-form@1.
|
|
2
|
+
> @twintag/twintag-form@1.2.1 build C:\Users\daryl\Desktop\twintag-projects\twintag-admin\packages\twintag-form
|
|
3
3
|
> tsc && vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v4.4.9 [32mbuilding for production...[36m[39m
|
|
@@ -14,8 +14,8 @@ computing gzip size...
|
|
|
14
14
|
[vite:dts] Outside emitted: C:/Users/daryl/Desktop/twintag-projects/twintag-admin/packages/twintag-form/prettier.config.d.mts
|
|
15
15
|
[vite:dts] Outside emitted: C:/Users/daryl/Desktop/twintag-projects/twintag-admin/packages/twintag-form/dev/main.d.ts
|
|
16
16
|
[vite:dts] Outside emitted: C:/Users/daryl/Desktop/twintag-projects/twintag-admin/packages/twintag-form/vite.config.d.ts
|
|
17
|
-
[vite:dts] Declaration files built in
|
|
17
|
+
[vite:dts] Declaration files built in 4789ms.
|
|
18
18
|
|
|
19
|
-
[2mdist/[22m[36mtwintag-form.webcomponent.js [39m[1m[2m119.
|
|
20
|
-
[2mdist/[22m[36mtwintag-form.react.js [39m[1m[
|
|
21
|
-
[32m✓ built in 10.
|
|
19
|
+
[2mdist/[22m[36mtwintag-form.webcomponent.js [39m[1m[2m119.76 kB[22m[1m[22m[2m │ gzip: 33.52 kB[22m
|
|
20
|
+
[2mdist/[22m[36mtwintag-form.react.js [39m[1m[33m688.05 kB[39m[22m[2m │ gzip: 139.98 kB[22m
|
|
21
|
+
[32m✓ built in 10.27s[39m
|
package/CHANGELOG.md
CHANGED
package/dev/main.tsx
CHANGED
|
@@ -184,3 +184,27 @@ const form = document.querySelector('twintag-form');
|
|
|
184
184
|
|
|
185
185
|
form?.setAttribute('config', JSON.stringify(config));
|
|
186
186
|
form?.setAttribute('options', JSON.stringify(options));
|
|
187
|
+
|
|
188
|
+
form?.addEventListener('twintag-form-values', (event) => {
|
|
189
|
+
console.log('form values', (event as CustomEvent).detail);
|
|
190
|
+
});
|
|
191
|
+
form?.addEventListener('twintag-form-valid', (e) => {
|
|
192
|
+
console.log('form valid', (e as CustomEvent).detail);
|
|
193
|
+
});
|
|
194
|
+
form?.addEventListener('twintag-form-invalid', (e) => {
|
|
195
|
+
console.log('form invalid', (e as CustomEvent).detail);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const getValues = document.getElementById('get-values');
|
|
199
|
+
getValues?.addEventListener('click', () => {
|
|
200
|
+
form?.shadowRoot
|
|
201
|
+
?.querySelector('form')
|
|
202
|
+
?.dispatchEvent(new CustomEvent('twintag-form-get_values'));
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const submit = document.getElementById('submit');
|
|
206
|
+
submit?.addEventListener('click', () => {
|
|
207
|
+
form?.shadowRoot
|
|
208
|
+
?.querySelector('form')
|
|
209
|
+
?.dispatchEvent(new CustomEvent('twintag-form-validate'));
|
|
210
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
2
3
|
import type { FieldValues } from 'react-hook-form';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {};
|
|
4
|
+
export declare const TwintagForm: ForwardRefExoticComponent<{
|
|
5
|
+
defaultValues?: FieldValues | undefined;
|
|
6
|
+
resetOnSubmit?: boolean | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
} & RefAttributes<HTMLFormElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ComponentProps } from 'react';
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes, ComponentProps } from 'react';
|
|
3
2
|
import type { RawJsonComponent } from './types';
|
|
4
3
|
import { TwintagForm } from './components/form';
|
|
5
4
|
import { TwintagFormProvider } from './provider';
|
|
@@ -11,5 +10,5 @@ type Props = {
|
|
|
11
10
|
resetOnSubmit?: boolean;
|
|
12
11
|
}>;
|
|
13
12
|
};
|
|
14
|
-
export declare const Form:
|
|
13
|
+
export declare const Form: ForwardRefExoticComponent<Props & RefAttributes<HTMLFormElement>>;
|
|
15
14
|
export {};
|