@twintag/twintag-form 1.6.2 → 1.7.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.
Files changed (53) hide show
  1. package/.turbo/turbo-build.log +16 -16
  2. package/CHANGELOG.md +12 -0
  3. package/dev/index.css +2 -2
  4. package/dev/main.tsx +1 -0
  5. package/dist/common/button.d.ts +0 -1
  6. package/dist/common/form.d.ts +0 -1
  7. package/dist/common/icon.d.ts +0 -1
  8. package/dist/common/input.d.ts +0 -1
  9. package/dist/common/label.d.ts +0 -1
  10. package/dist/common/textarea.d.ts +0 -1
  11. package/dist/components/config.d.ts +0 -1
  12. package/dist/components/containers/accordion.d.ts +1 -2
  13. package/dist/components/containers/category.d.ts +0 -1
  14. package/dist/components/fields/checkbox.d.ts +0 -1
  15. package/dist/components/fields/file.d.ts +0 -1
  16. package/dist/components/fields/input.d.ts +0 -1
  17. package/dist/components/fields/radiogroup.d.ts +0 -1
  18. package/dist/components/fields/submit.d.ts +0 -1
  19. package/dist/components/fields/textarea.d.ts +0 -1
  20. package/dist/components/fields/toggle.d.ts +0 -1
  21. package/dist/components/fields/tri-toggle.d.ts +0 -1
  22. package/dist/components/form.d.ts +0 -1
  23. package/dist/components/input.d.ts +0 -1
  24. package/dist/components/label.d.ts +0 -1
  25. package/dist/components/provider.d.ts +1 -2
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.ts +0 -1
  28. package/dist/index.js +1437 -1601
  29. package/dist/types/index.d.ts +0 -1
  30. package/dist/utils/data.d.ts +0 -1
  31. package/dist/utils/style.d.ts +0 -1
  32. package/dist/webcomponent.cjs +1 -1
  33. package/dist/webcomponent.js +1118 -1104
  34. package/lib/common/icon.tsx +2 -1
  35. package/lib/components/config.tsx +1 -0
  36. package/lib/components/containers/accordion.tsx +3 -2
  37. package/lib/components/containers/category.tsx +1 -1
  38. package/lib/components/fields/checkbox.tsx +3 -6
  39. package/lib/components/fields/date-picker.tsx +3 -6
  40. package/lib/components/fields/file.tsx +3 -6
  41. package/lib/components/fields/input.tsx +3 -6
  42. package/lib/components/fields/radiogroup.tsx +3 -6
  43. package/lib/components/fields/submit.tsx +1 -0
  44. package/lib/components/fields/textarea.tsx +3 -6
  45. package/lib/components/fields/toggle.tsx +3 -6
  46. package/lib/components/fields/tri-toggle.tsx +3 -4
  47. package/lib/components/input.tsx +2 -1
  48. package/lib/components/label.tsx +1 -0
  49. package/lib/components/provider.tsx +2 -1
  50. package/lib/components/renderer.tsx +2 -1
  51. package/lib/index.tsx +1 -0
  52. package/package.json +9 -10
  53. package/prettier.config.mjs +1 -17
@@ -19,9 +19,10 @@ export const Icon: FC<Props> = ({ name, className, ...props }) => {
19
19
  [name],
20
20
  );
21
21
 
22
+ // biome-ignore lint/performance/noDynamicNamespaceImportAccess: ignore for now
22
23
  const Comp = icons[camel];
23
24
 
24
- if (!Comp) return <></>;
25
+ if (!Comp) return null;
25
26
 
26
27
  return (
27
28
  <Comp
@@ -1,4 +1,5 @@
1
1
  import type { ElementType } from 'react';
2
+
2
3
  import type { InputCompConfig } from '../types';
3
4
 
4
5
  import { Accordion } from './containers/accordion';
@@ -1,7 +1,8 @@
1
1
  import type { FC } from 'react';
2
- import type { Props } from '@twintag/twintag-form/types';
3
2
  import type { WithChildren } from 'twintag-types/dom';
4
3
 
4
+ import type { Props } from '@twintag/twintag-form/types';
5
+
5
6
  import { tv } from 'tailwind-variants';
6
7
 
7
8
  import {
@@ -114,7 +115,7 @@ const AccordionItem: FC<AccordionItemProps> = ({
114
115
  >
115
116
  <AccordionTrigger className='text-category'>
116
117
  <span className={trigger()}>
117
- {icon ? <Icon name={icon} className={iconVariants()} /> : <></>}
118
+ {icon ? <Icon name={icon} className={iconVariants()} /> : null}
118
119
  {label}
119
120
  </span>
120
121
  </AccordionTrigger>
@@ -46,7 +46,7 @@ const Category: FC<Props> = ({ label, children }) => {
46
46
 
47
47
  return (
48
48
  <section className={container()}>
49
- {label ? <h3 className={heading()}>{label}</h3> : <></>}
49
+ {label ? <h3 className={heading()}>{label}</h3> : null}
50
50
 
51
51
  <div className={content()}>{children}</div>
52
52
  </section>
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { AsteriskIcon } from 'lucide-react';
@@ -50,17 +51,13 @@ export const Checkbox: FC<Props<'input'>> = ({ label, bind, options }) => {
50
51
  <span className='ml-0.5 inline-block'>
51
52
  <AsteriskIcon className='h-3 w-3 text-tf-destructive' />
52
53
  </span>
53
- ) : (
54
- <></>
55
- )}
54
+ ) : null}
56
55
  </FormLabel>
57
56
  {options?.description ? (
58
57
  <FormDescription size={size}>
59
58
  {options.description}
60
59
  </FormDescription>
61
- ) : (
62
- <></>
63
- )}
60
+ ) : null}
64
61
  <FormMessage size={size} />
65
62
  </div>
66
63
  </div>
@@ -1,4 +1,5 @@
1
1
  import type * as React from 'react';
2
+
2
3
  import type { Props } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { format } from 'date-fns';
@@ -97,17 +98,13 @@ export const DatePicker: React.FC<Props<'input', 'datepicker'>> = ({
97
98
  <span className='ml-0.5 inline-block'>
98
99
  <AsteriskIcon className='h-3 w-3 text-tf-destructive' />
99
100
  </span>
100
- ) : (
101
- <></>
102
- )}
101
+ ) : null}
103
102
  </FormLabel>
104
103
  {options?.description ? (
105
104
  <FormDescription size={size}>
106
105
  {options.description}
107
106
  </FormDescription>
108
- ) : (
109
- <></>
110
- )}
107
+ ) : null}
111
108
  </div>
112
109
  <Popover>
113
110
  <PopoverTrigger asChild>
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { AsteriskIcon } from 'lucide-react';
@@ -40,17 +41,13 @@ export const File: FC<Props<'input', 'file'>> = ({ label, bind, options }) => {
40
41
  <span className='ml-0.5 inline-block'>
41
42
  <AsteriskIcon className='h-3 w-3 text-tf-destructive' />
42
43
  </span>
43
- ) : (
44
- <></>
45
- )}
44
+ ) : null}
46
45
  </FormLabel>
47
46
  {options?.description ? (
48
47
  <FormDescription size={size}>
49
48
  {options.description}
50
49
  </FormDescription>
51
- ) : (
52
- <></>
53
- )}
50
+ ) : null}
54
51
  </div>
55
52
  <FormControl>
56
53
  <Input
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { AsteriskIcon } from 'lucide-react';
@@ -41,17 +42,13 @@ export const Input: FC<Props<'input', 'text'>> = ({ label, bind, options }) => {
41
42
  <span className='ml-0.5 inline-block'>
42
43
  <AsteriskIcon className='h-3 w-3 text-tf-destructive' />
43
44
  </span>
44
- ) : (
45
- <></>
46
- )}
45
+ ) : null}
47
46
  </FormLabel>
48
47
  {options?.description ? (
49
48
  <FormDescription size={size}>
50
49
  {options.description}
51
50
  </FormDescription>
52
- ) : (
53
- <></>
54
- )}
51
+ ) : null}
55
52
  </div>
56
53
  <FormControl>
57
54
  <InputPrimitive
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { AsteriskIcon } from 'lucide-react';
@@ -47,17 +48,13 @@ export const RadioGroup: FC<
47
48
  <span className='ml-0.5 inline-block'>
48
49
  <AsteriskIcon className='h-3 w-3 text-tf-destructive' />
49
50
  </span>
50
- ) : (
51
- <></>
52
- )}
51
+ ) : null}
53
52
  </FormLabel>
54
53
  {options?.description ? (
55
54
  <FormDescription size={size}>
56
55
  {options.description}
57
56
  </FormDescription>
58
- ) : (
59
- <></>
60
- )}
57
+ ) : null}
61
58
  </div>
62
59
  <FormControl>
63
60
  <CommonRadioGroup
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { Button } from '@twintag/twintag-form/common/button';
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { AsteriskIcon } from 'lucide-react';
@@ -44,17 +45,13 @@ export const Textarea: FC<Props<'input', 'text'>> = ({
44
45
  <span className='ml-0.5 inline-block'>
45
46
  <AsteriskIcon className='h-3 w-3 text-tf-destructive' />
46
47
  </span>
47
- ) : (
48
- <></>
49
- )}
48
+ ) : null}
50
49
  </FormLabel>
51
50
  {options?.description ? (
52
51
  <FormDescription size={size}>
53
52
  {options.description}
54
53
  </FormDescription>
55
- ) : (
56
- <></>
57
- )}
54
+ ) : null}
58
55
  </div>
59
56
  <FormControl>
60
57
  <CommonTextarea
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { AsteriskIcon } from 'lucide-react';
@@ -41,17 +42,13 @@ export const Toggle: FC<Props<'input'>> = ({ label, bind, options }) => {
41
42
  <span className='ml-0.5 inline-block'>
42
43
  <AsteriskIcon className='h-3 w-3 text-tf-destructive' />
43
44
  </span>
44
- ) : (
45
- <></>
46
- )}
45
+ ) : null}
47
46
  </FormLabel>
48
47
  {options?.description ? (
49
48
  <FormDescription size={size}>
50
49
  {options.description}
51
50
  </FormDescription>
52
- ) : (
53
- <></>
54
- )}
51
+ ) : null}
55
52
  </div>
56
53
  <FormControl>
57
54
  <Switch
@@ -1,7 +1,8 @@
1
1
  import type { FC } from 'react';
2
- import type { Props } from '@twintag/twintag-form/types';
3
2
  import type { VariantProps } from 'tailwind-variants';
4
3
 
4
+ import type { Props } from '@twintag/twintag-form/types';
5
+
5
6
  import * as React from 'react';
6
7
  import * as SliderPrimitive from '@radix-ui/react-slider';
7
8
  import { useFormContext } from 'react-hook-form';
@@ -111,9 +112,7 @@ export const TriToggle: FC<Props<'input'>> = ({ label, bind, options }) => {
111
112
  <FormDescription size={size}>
112
113
  {options.description}
113
114
  </FormDescription>
114
- ) : (
115
- <></>
116
- )}
115
+ ) : null}
117
116
  </div>
118
117
  <FormControl>
119
118
  <Slider
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '../types';
3
4
 
4
5
  import { Inputs } from './config';
@@ -6,7 +7,7 @@ import { Inputs } from './config';
6
7
  export const Input: FC<Props<'input'>> = ({ subtype, ...rest }) => {
7
8
  const Comp = Inputs.get(subtype!)?.component;
8
9
 
9
- if (!Comp) return <></>;
10
+ if (!Comp) return null;
10
11
 
11
12
  return <Comp {...rest} />;
12
13
  };
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { Props } from '../types';
3
4
 
4
5
  import { Label as LabelComp } from '../common/label';
@@ -1,9 +1,10 @@
1
+ import type { WithChildren } from 'twintag-types/dom';
2
+
1
3
  import type {
2
4
  ParsedJsonComponent,
3
5
  RawJsonComponent,
4
6
  TwintagFormContext,
5
7
  } from '@twintag/twintag-form/types';
6
- import type { WithChildren } from 'twintag-types/dom';
7
8
 
8
9
  import { createContext, useContext, useMemo } from 'react';
9
10
  import { LabelToString } from 'twintag-types/dom';
@@ -1,4 +1,5 @@
1
1
  import type { FC } from 'react';
2
+
2
3
  import type { ParsedJsonComponent } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { Containers } from '@twintag/twintag-form/components/config';
@@ -11,7 +12,7 @@ type Props = {
11
12
  const RecursiveRenderer: FC<Props> = ({ config }) => {
12
13
  const { id, type, items, comp, ...rest } = config;
13
14
 
14
- if (!type || !comp) return <></>;
15
+ if (!type || !comp) return null;
15
16
 
16
17
  const Component = comp;
17
18
 
package/lib/index.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ComponentProps } from 'react';
2
+
2
3
  import type { RawJsonComponent } from '@twintag/twintag-form/types';
3
4
 
4
5
  import { forwardRef } from 'react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twintag/twintag-form",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "author": "Twintag",
5
5
  "type": "module",
6
6
  "exports": {
@@ -33,10 +33,10 @@
33
33
  "@twind/with-web-components": "^1.1.3",
34
34
  "clsx": "^2.1.0",
35
35
  "date-fns": "^3.3.1",
36
- "lucide-react": "^0.269.0",
37
- "react": "^18.2.0",
36
+ "lucide-react": "0.543.0",
37
+ "react": "^19.2.4",
38
38
  "react-day-picker": "^8.10.0",
39
- "react-dom": "^18.2.0",
39
+ "react-dom": "^19.2.4",
40
40
  "react-hook-form": "^7.50.1",
41
41
  "tailwind-merge": "^2.2.1",
42
42
  "uuid": "^9.0.1"
@@ -44,11 +44,11 @@
44
44
  "devDependencies": {
45
45
  "@twind/with-react": "^1.1.3",
46
46
  "@types/uuid": "^9.0.7",
47
- "@vitejs/plugin-react-swc": "^3.6.0",
48
- "vite": "^5.2.11",
49
- "vite-plugin-dts": "^3.9.1",
47
+ "@vitejs/plugin-react-swc": "^4.1.0",
48
+ "vite": "^7.3.2",
49
+ "vite-plugin-dts": "^4.5.4",
50
50
  "tsconfig": "0.0.0",
51
- "twintag-types": "0.4.0"
51
+ "twintag-types": "0.6.0"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
@@ -56,7 +56,6 @@
56
56
  "scripts": {
57
57
  "dev": "vite",
58
58
  "build": "tsc && vite build",
59
- "format": "prettier --write \"**/*.{ts,md,tsx,cjs,mjs,json,html}\" --ignore-path ../../.gitignore",
60
- "format:check": "prettier --check \"**/*.{ts,md,tsx,cjs,mjs,json,html}\" --ignore-path ../../.gitignore"
59
+ "format": "prettier --write \"**/*.{ts,md,tsx,cjs,mjs,json,html}\" --ignore-path ../../.gitignore"
61
60
  }
62
61
  }
@@ -1,26 +1,10 @@
1
1
  import baseConfig from '../../prettier.config.mjs';
2
2
 
3
3
  /**
4
- * @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions &
5
- * import("@ianvs/prettier-plugin-sort-imports").PluginConfig}
4
+ * @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions
6
5
  */
7
6
  const config = {
8
7
  ...baseConfig,
9
- importOrder: [
10
- '<TYPES>^react$',
11
- '<TYPES>',
12
- '<TYPES>^@/.*$',
13
- '<TYPES>^[./]',
14
- '',
15
- '^zod$',
16
- '^react$',
17
- '<THIRD_PARTY_MODULES>',
18
- '',
19
- '^@twintag/twintag-form/.*$',
20
- '^@/.*$',
21
- '',
22
- '^[./]',
23
- ],
24
8
  };
25
9
 
26
10
  export default config;