@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @twintag/twintag-form@1.1.1 build C:\Users\daryl\Desktop\twintag-projects\twintag-admin\packages\twintag-form
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
  vite v4.4.9 building for production...
@@ -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 4729ms.
17
+ [vite:dts] Declaration files built in 4789ms.
18
18
 
19
- dist/twintag-form.webcomponent.js 119.72 kB │ gzip: 33.42 kB
20
- dist/twintag-form.react.js 687.57 kB │ gzip: 139.88 kB
21
- ✓ built in 10.13s
19
+ dist/twintag-form.webcomponent.js 119.76 kB │ gzip: 33.52 kB
20
+ dist/twintag-form.react.js 688.05 kB │ gzip: 139.98 kB
21
+ ✓ built in 10.27s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @twintag/twintag-form
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 2a66cb3: fix: allow `ref` for React usage
8
+
9
+ ## 1.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - feat: get-values implemented
14
+
3
15
  ## 1.1.1
4
16
 
5
17
  ### Patch Changes
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 { JSX } from 'react/jsx-runtime';
1
+ import { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
2
+ /// <reference types="react" />
2
3
  import type { FieldValues } from 'react-hook-form';
3
- import type { WithChildren } from 'twintag-types/dom';
4
- type Props = {
5
- defaultValues?: FieldValues;
6
- resetOnSubmit?: boolean;
7
- } & WithChildren;
8
- export declare const TwintagForm: ({ defaultValues, resetOnSubmit, children, }: Props) => JSX.Element;
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 { JSX } from 'react/jsx-runtime';
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: ({ config, options }: Props) => JSX.Element;
13
+ export declare const Form: ForwardRefExoticComponent<Props & RefAttributes<HTMLFormElement>>;
15
14
  export {};