@twintag/twintag-form 0.4.2 → 0.6.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 (77) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/.turbo/turbo-build.log +11 -55
  3. package/CHANGELOG.md +28 -0
  4. package/README.md +9 -9
  5. package/dist/components/Category/__styles.d.ts +29 -0
  6. package/dist/{lib/components → components}/Category/index.d.ts +2 -3
  7. package/dist/components/Form/index.d.ts +12 -0
  8. package/dist/{lib/types/index.d.ts → components/Input/__props.d.ts} +0 -6
  9. package/dist/components/Input/__styles.d.ts +460 -0
  10. package/dist/{lib/components → components}/Input/checkbox.d.ts +2 -3
  11. package/dist/{lib/components → components}/Input/file.d.ts +2 -3
  12. package/dist/{lib/components → components}/Input/index.d.ts +0 -1
  13. package/dist/{lib/components → components}/Input/simple.d.ts +2 -3
  14. package/dist/{lib/components → components}/Input/submit.d.ts +2 -3
  15. package/dist/{lib/components → components}/Input/textarea.d.ts +2 -3
  16. package/dist/{lib/components → components}/Input/toggle.d.ts +2 -3
  17. package/dist/{lib/components → components}/Label/index.d.ts +0 -1
  18. package/dist/components/index.d.ts +4 -0
  19. package/dist/index.d.ts +14 -0
  20. package/dist/react.d.ts +1 -0
  21. package/dist/styles.d.ts +487 -0
  22. package/dist/twintag-form.react.js +8726 -0
  23. package/dist/twintag-form.webcomponent.js +4503 -0
  24. package/dist/webcomponent.d.ts +1 -0
  25. package/lib/__stories__/Form.stories.tsx +104 -12
  26. package/lib/components/Category/__styles.ts +12 -0
  27. package/lib/components/Category/index.tsx +5 -8
  28. package/lib/components/Form/index.tsx +33 -34
  29. package/lib/{types/index.ts → components/Input/__props.ts} +0 -6
  30. package/lib/components/Input/__styles.ts +132 -0
  31. package/lib/components/Input/checkbox.tsx +9 -12
  32. package/lib/components/Input/file.tsx +10 -13
  33. package/lib/components/Input/simple.tsx +9 -11
  34. package/lib/components/Input/submit.tsx +3 -9
  35. package/lib/components/Input/textarea.tsx +9 -11
  36. package/lib/components/Input/toggle.tsx +11 -12
  37. package/lib/components/Label/index.tsx +3 -2
  38. package/lib/components/index.tsx +4 -6
  39. package/lib/index.tsx +39 -161
  40. package/lib/styles.ts +19 -18
  41. package/lib/webcomponent.ts +3 -3
  42. package/package.json +14 -17
  43. package/tsconfig.json +12 -3
  44. package/twind.config.ts +7 -7
  45. package/vite.config.ts +47 -0
  46. package/dist/index.es.js +0 -27362
  47. package/dist/index.umd.js +0 -196
  48. package/dist/lib/__stories__/Form.stories.d.ts +0 -7
  49. package/dist/lib/__stories__/Form.stories.d.ts.map +0 -1
  50. package/dist/lib/components/Category/index.d.ts.map +0 -1
  51. package/dist/lib/components/Form/index.d.ts +0 -10
  52. package/dist/lib/components/Form/index.d.ts.map +0 -1
  53. package/dist/lib/components/Form/register.d.ts +0 -12
  54. package/dist/lib/components/Form/register.d.ts.map +0 -1
  55. package/dist/lib/components/Input/checkbox.d.ts.map +0 -1
  56. package/dist/lib/components/Input/file.d.ts.map +0 -1
  57. package/dist/lib/components/Input/index.d.ts.map +0 -1
  58. package/dist/lib/components/Input/simple.d.ts.map +0 -1
  59. package/dist/lib/components/Input/submit.d.ts.map +0 -1
  60. package/dist/lib/components/Input/textarea.d.ts.map +0 -1
  61. package/dist/lib/components/Input/toggle.d.ts.map +0 -1
  62. package/dist/lib/components/Label/index.d.ts.map +0 -1
  63. package/dist/lib/components/index.d.ts +0 -6
  64. package/dist/lib/components/index.d.ts.map +0 -1
  65. package/dist/lib/index.d.ts +0 -20
  66. package/dist/lib/index.d.ts.map +0 -1
  67. package/dist/lib/styles.d.ts +0 -131
  68. package/dist/lib/styles.d.ts.map +0 -1
  69. package/dist/lib/types/index.d.ts.map +0 -1
  70. package/dist/lib/webcomponent.d.ts +0 -2
  71. package/dist/lib/webcomponent.d.ts.map +0 -1
  72. package/dist/twind.config.d.ts +0 -5
  73. package/dist/twind.config.d.ts.map +0 -1
  74. package/dist/webcomponent.es.js +0 -31726
  75. package/dist/webcomponent.umd.js +0 -196
  76. package/lib/components/Form/register.tsx +0 -69
  77. package/scripts/build.js +0 -60
@@ -1,7 +1,7 @@
1
1
  import type { FC } from 'react';
2
2
  import type { WithChildren } from 'twintag-types/dom';
3
3
 
4
- import { labelStyle } from '@twintag-form/styles';
4
+ import { labelStyle } from '@twintag/twintag-form/styles';
5
5
 
6
6
  type Props = {
7
7
  required?: boolean;
@@ -15,7 +15,8 @@ const Label: FC<Props> = ({ className, required, children }) => {
15
15
 
16
16
  return (
17
17
  <span className={style}>
18
- {children} {required ? '*' : ''}
18
+ {children}{' '}
19
+ {required ? <span className='text-xs text-red-500'>*</span> : <></>}
19
20
  </span>
20
21
  );
21
22
  };
@@ -1,6 +1,4 @@
1
- import Form from './Form';
2
- import Input from './Input';
3
- import Label from './Label';
4
- import Category from './Category';
5
-
6
- export { Form, Input, Label, Category };
1
+ export { default as Form } from './Form';
2
+ export { default as Input } from './Input';
3
+ export { default as Label } from './Label';
4
+ export { default as Category } from './Category';
package/lib/index.tsx CHANGED
@@ -1,178 +1,56 @@
1
- import type { FC, ReactNode } from 'react';
1
+ import type { ComponentRef, Ref } from 'react';
2
+ import type { RawJsonComponent } from '@twintag/twintag-json-renderer/types';
2
3
 
3
- import { LabelToString } from 'twintag-types/dom';
4
+ import { forwardRef } from 'react';
4
5
 
5
- import Form from '@twintag-form/components/Form';
6
- import Input from '@twintag-form/components/Input';
7
- import Category from '@twintag-form/components/Category';
6
+ import Form from '@twintag/twintag-form//components/Form';
7
+ import Input from '@twintag/twintag-form//components/Input';
8
+ import Category from '@twintag/twintag-form//components/Category';
8
9
 
9
- type Config = {
10
- key?: number;
11
- type?: any;
12
- subtype?: string;
13
- label?: string;
14
- items?: any[];
15
- bind?: string;
16
- options?: Record<string, any>;
17
- };
18
-
19
- type Component = {
20
- subtype?: string;
21
- label?: string;
22
- bind?: string;
23
- children?: ReactNode;
24
- options?: Record<string, any>;
25
- };
26
-
27
- type Format = {
28
- $config: Config;
29
- $blocks?: Map<string, FC<Component>>;
30
- $containers?: Map<string, FC<Component>>;
31
- $available?: Map<string, FC<Component>>;
32
- };
33
-
34
- const format = ({ $config, $blocks, $containers, $available }: Format) => {
35
- const config: Config & {
36
- block?: FC<Component>;
37
- container?: FC<Component>;
38
- } = { ...$config };
39
-
40
- const typeLength = config.type.length;
41
- const colonIndex = config.type.indexOf(':');
42
-
43
- const typeFiltered = config.type.substring(
44
- 0,
45
- colonIndex > 0 ? config.type.lastIndexOf(':') : typeLength + 1
46
- );
47
- const subtypeFiltered =
48
- colonIndex > 0 && colonIndex + 1 !== typeLength
49
- ? config.type.substring(colonIndex + 1, typeLength + 1)
50
- : undefined;
51
-
52
- const isTypeAvailable = $available?.has(typeFiltered);
53
-
54
- if (isTypeAvailable) {
55
- const block = $blocks?.get(typeFiltered);
56
- const container = $containers?.get(typeFiltered);
57
-
58
- config.type = typeFiltered;
59
- config.subtype = config.subtype ? config.subtype : subtypeFiltered;
60
- config.block = block;
61
- config.container = container;
62
- }
63
-
64
- if (config.label) config.label = LabelToString.parse(config.label);
65
-
66
- if (config.items && Array.isArray(config.items))
67
- config.items = config.items.map((item) =>
68
- format({
69
- $config: item,
70
- $available,
71
- $blocks,
72
- $containers,
73
- })
74
- );
75
-
76
- return config;
77
- };
78
-
79
- type Params = {
80
- $config: Config;
81
- $blocks?: Map<string, FC<Component>>;
82
- $containers?: Map<string, FC<Component>>;
83
- };
84
-
85
- const useConfig = (params: Params) => {
86
- const available = new Map([
87
- ...new Map(params.$blocks),
88
- ...new Map(params.$containers),
89
- ]);
90
-
91
- return format({
92
- ...params,
93
- $available: available,
94
- });
95
- };
10
+ import {
11
+ TwintagJsonRenderer,
12
+ TwintagJsonRegisterProvider,
13
+ } from '@twintag/twintag-json-renderer';
96
14
 
97
15
  const blocks = new Map().set('input', Input);
98
- const containers = new Map().set('form', Form).set('category', Category);
16
+ const containers = new Map().set('category', Category);
99
17
 
100
- type RendererProps = {
101
- config: Config & {
102
- block?: FC<Component>;
103
- container?: FC<Component>;
18
+ type Props = {
19
+ config: RawJsonComponent[];
20
+ options?: {
21
+ variant?: string;
22
+ resetOnSubmit?: boolean;
104
23
  };
105
24
  };
106
25
 
107
- const FormRenderer: FC<RendererProps> = ({ config }) => {
108
- const { key, type, subtype, label, bind, items, block, container, ...rest } =
109
- config;
110
-
111
- if (!type) return null;
112
-
113
- if (container) {
114
- const Component = container;
115
-
26
+ export const TwintagForm = forwardRef(
27
+ ({ config, options }: Props, ref: Ref<ComponentRef<typeof Form>>) => {
116
28
  return (
117
- <Component key={key} subtype={subtype} label={label} {...rest}>
118
- {items && Array.isArray(items) ? (
119
- items.map((item, idx) => (
120
- <FormRenderer
29
+ <TwintagJsonRegisterProvider
30
+ register={{
31
+ blocks,
32
+ containers,
33
+ custom: new Map(),
34
+ }}
35
+ >
36
+ <Form ref={ref} options={options}>
37
+ {config.map((item, idx) => (
38
+ <TwintagJsonRenderer
121
39
  key={idx}
122
40
  config={{
123
- ...rest,
124
41
  ...item,
125
- options: {
126
- ...item.options,
127
- variant: rest.options?.variant,
42
+ props: {
43
+ ...item.props,
44
+ options: {
45
+ ...item.props.options,
46
+ variant: options?.variant,
47
+ },
128
48
  },
129
49
  }}
130
50
  />
131
- ))
132
- ) : (
133
- <></>
134
- )}
135
- </Component>
51
+ ))}
52
+ </Form>
53
+ </TwintagJsonRegisterProvider>
136
54
  );
137
- }
138
-
139
- if (block) {
140
- const Component = block;
141
-
142
- return (
143
- <Component
144
- key={key}
145
- subtype={subtype}
146
- label={label}
147
- bind={bind}
148
- {...rest}
149
- />
150
- );
151
- }
152
-
153
- return null;
154
- };
155
-
156
- type Props = {
157
- config: Config[];
158
- options?: {
159
- variant?: string;
160
- resetOnSubmit?: boolean;
161
- };
162
- };
163
-
164
- const TwintagForm: FC<Props> = ({ config, options }) => {
165
- const __config = useConfig({
166
- $blocks: blocks,
167
- $containers: containers,
168
- $config: {
169
- type: 'form',
170
- items: config ? config : [],
171
- options,
172
- },
173
- });
174
-
175
- return <FormRenderer config={__config} />;
176
- };
177
-
178
- export default TwintagForm;
55
+ },
56
+ );
package/lib/styles.ts CHANGED
@@ -10,9 +10,9 @@ export const containerStyle = tv({
10
10
 
11
11
  export const categoryStyle = tv({
12
12
  slots: {
13
- container: 'w-full grid mt-4 first:mt-0',
13
+ container: 'mt-4 grid w-full first:mt-0',
14
14
  span: 'text-category-label',
15
- items: 'grid mt-2 mb-4 empty:mb-0',
15
+ items: 'mb-4 mt-2 grid empty:mb-0',
16
16
  },
17
17
  variants: {
18
18
  variant: {},
@@ -22,10 +22,10 @@ export const categoryStyle = tv({
22
22
  export const checkboxStyle = tv({
23
23
  slots: {
24
24
  container: containerStyle({
25
- className: 'flex gap-4 items-center w-full',
25
+ className: 'flex w-full items-center gap-4',
26
26
  }),
27
27
  checkbox:
28
- 'flex appearance-none items-center justify-center bg-white outline-none ring-0 border-2 border-primary focus:ring-0 focus:border-accent',
28
+ 'border-primary focus:border-accent flex appearance-none items-center justify-center border-2 bg-white outline-none ring-0 focus:ring-0',
29
29
  },
30
30
  variants: {
31
31
  variant: {
@@ -45,23 +45,23 @@ export const checkboxStyle = tv({
45
45
  export const fileStyle = tv({
46
46
  slots: {
47
47
  container: containerStyle({
48
- className: 'w-full block',
48
+ className: 'block w-full',
49
49
  }),
50
50
  span: '',
51
51
  input:
52
- 'w-full cursor-pointer ring-0 focus:ring-0 border-2 border-transparent',
52
+ 'w-full cursor-pointer border-2 border-transparent ring-0 focus:ring-0',
53
53
  },
54
54
  variants: {
55
55
  variant: {
56
56
  alpha: {
57
57
  container: 'grid gap-1.5',
58
58
  input:
59
- 'flex items-center justify-between gap-4 rounded-md px-3 py-2 border-slate-700/10 peer-focus:border-accent',
59
+ 'peer-focus:border-accent flex items-center justify-between gap-4 rounded-md border-slate-700/10 px-3 py-2',
60
60
  },
61
61
  beta: {
62
62
  container: 'grid gap-0',
63
63
  input:
64
- 'flex items-center justify-between gap-4 py-2 border-b-slate-700/10 peer-focus:border-b-accent',
64
+ 'peer-focus:border-b-accent flex items-center justify-between gap-4 border-b-slate-700/10 py-2',
65
65
  },
66
66
  },
67
67
  },
@@ -76,18 +76,19 @@ export const simpleStyle = tv({
76
76
  className: 'w-full',
77
77
  }),
78
78
  span: '',
79
- input: 'w-full ring-0 placeholder:text-placeholder focus:ring-0 border-2 border-transparent text-input',
79
+ input:
80
+ 'placeholder:text-placeholder text-input w-full border-2 border-transparent ring-0 focus:ring-0',
80
81
  },
81
82
  variants: {
82
83
  variant: {
83
84
  alpha: {
84
85
  container: 'grid gap-1.5',
85
- input: 'rounded-md border-slate-700/10 focus:border-accent',
86
+ input: 'focus:border-accent rounded-md border-slate-700/10',
86
87
  },
87
88
  beta: {
88
89
  container: 'grid gap-0',
89
90
  input:
90
- 'px-0 focus:border-transparent focus:border-b-accent border-b-slate-700/10',
91
+ 'focus:border-b-accent border-b-slate-700/10 px-0 focus:border-transparent',
91
92
  },
92
93
  },
93
94
  },
@@ -110,16 +111,16 @@ export const toggleStyle = tv({
110
111
  alpha: {
111
112
  container: 'flex justify-between',
112
113
  input:
113
- 'h-6 w-9 rounded-full bg-primary border border-black ring-2 focus:border-transparent focus:ring-accent data-[state=checked]:bg-white',
114
+ 'bg-primary focus:ring-accent h-6 w-9 rounded-full border border-black ring-2 focus:border-transparent data-[state=checked]:bg-white',
114
115
  thumb:
115
- 'h-4 w-4 translate-x-0.5 rounded-full bg-white data-[state=checked]:translate-x-4 data-[state=checked]:bg-primary',
116
+ 'data-[state=checked]:bg-primary h-4 w-4 translate-x-0.5 rounded-full bg-white data-[state=checked]:translate-x-4',
116
117
  },
117
118
  beta: {
118
119
  container: 'flex justify-between',
119
120
  input:
120
- 'h-6 w-9 rounded-full bg-primary border border-black ring-2 focus:border-transparent focus:ring-accent data-[state=checked]:bg-white',
121
+ 'bg-primary focus:ring-accent h-6 w-9 rounded-full border border-black ring-2 focus:border-transparent data-[state=checked]:bg-white',
121
122
  thumb:
122
- 'h-4 w-4 translate-x-0.5 rounded-full bg-white data-[state=checked]:translate-x-4 data-[state=checked]:bg-primary',
123
+ 'data-[state=checked]:bg-primary h-4 w-4 translate-x-0.5 rounded-full bg-white data-[state=checked]:translate-x-4',
123
124
  },
124
125
  },
125
126
  },
@@ -129,11 +130,11 @@ export const toggleStyle = tv({
129
130
  });
130
131
 
131
132
  export const submitStyle = tv({
132
- base: 'w-max max-w-full mt-2',
133
+ base: 'mt-2 w-max max-w-full',
133
134
  variants: {
134
135
  variant: {
135
- alpha: 'bg-primary text-white px-4 py-2 rounded-md',
136
- beta: 'bg-primary text-white px-4 py-2',
136
+ alpha: 'bg-primary rounded-md px-4 py-2 text-white',
137
+ beta: 'bg-primary px-4 py-2 text-white',
137
138
  },
138
139
  },
139
140
  defaultVariants: {
@@ -3,15 +3,15 @@ import r2wc from '@r2wc/react-to-web-component';
3
3
 
4
4
  import config from '../twind.config';
5
5
 
6
- import TwintagForm from './index';
6
+ import { TwintagForm } from '@twintag/twintag-form/index';
7
7
 
8
8
  const withTwind = install(config);
9
9
 
10
10
  const TwintagFormElement = r2wc(TwintagForm, {
11
- props: {
11
+ props: Object.create({
12
12
  config: 'json',
13
13
  options: 'json',
14
- },
14
+ }),
15
15
  shadow: 'open',
16
16
  });
17
17
 
package/package.json CHANGED
@@ -1,23 +1,21 @@
1
1
  {
2
2
  "name": "@twintag/twintag-form",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "author": "Twintag",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
- "import": "./dist/index.es.js",
9
- "require": "./dist/index.umd.js",
10
- "types": "./dist/index.d.ts"
8
+ "import": "./dist/twintag-form.react.js",
9
+ "types": "./dist/react.d.ts"
11
10
  },
12
11
  "./webcomponent": {
13
- "import": "./dist/webcomponent.es.js",
14
- "require": "./dist/webcomponent.umd.js",
12
+ "import": "./dist/twintag-form.webcomponent.js",
15
13
  "types": "./dist/webcomponent.d.ts"
16
14
  }
17
15
  },
18
16
  "dependencies": {
19
17
  "@heroicons/react": "^2.0.16",
20
- "@r2wc/react-to-web-component": "^2.0.2",
18
+ "@r2wc/react-to-web-component": "^2.0.3",
21
19
  "@radix-ui/react-checkbox": "^1.0.4",
22
20
  "@radix-ui/react-switch": "^1.0.2",
23
21
  "@storybook/react": "7.0.2",
@@ -29,27 +27,26 @@
29
27
  "@twind/with-web-components": "^1.1.3",
30
28
  "react": "^18.2.0",
31
29
  "react-dom": "^18.2.0",
32
- "react-hook-form": "^7.43.1"
30
+ "react-hook-form": "^7.43.1",
31
+ "@twintag/twintag-json-renderer": "0.2.0"
33
32
  },
34
33
  "devDependencies": {
35
34
  "@rollup/plugin-typescript": "^11.1.1",
36
35
  "@storybook/addon-actions": "^7.0.20",
37
- "@types/react": "^18.0.28",
38
- "@types/react-dom": "^18.0.11",
36
+ "@vitejs/plugin-react-swc": "^3.4.0",
39
37
  "eslint": "^8.38.0",
40
38
  "rollup": "^3.18.0",
41
- "vite-plugin-dts": "^2.1.0",
42
- "tailwind-config": "0.0.1",
39
+ "vite-plugin-dts": "^3.0.3",
40
+ "vite": "^4.4.9",
41
+ "tailwind-config": "0.2.0",
43
42
  "tsconfig": "0.0.0",
44
- "twintag-types": "0.0.0"
43
+ "twintag-types": "0.2.0"
45
44
  },
46
45
  "publishConfig": {
47
46
  "access": "public"
48
47
  },
49
48
  "scripts": {
50
- "dev": "vite",
51
- "build": "tsc && node ./scripts/build.js",
52
- "lint": "eslint lib --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
53
- "preview": "vite preview"
49
+ "build": "tsc && vite build",
50
+ "lint": "eslint lib --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
54
51
  }
55
52
  }
package/tsconfig.json CHANGED
@@ -5,9 +5,18 @@
5
5
  "compilerOptions": {
6
6
  "baseUrl": ".",
7
7
  "paths": {
8
- "@twintag-form/*": ["./lib/*"]
8
+ "@twintag/twintag-form/*": ["./lib/*"]
9
9
  },
10
- "outDir": "./dist",
11
- "declaration": true
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "declaration": false,
14
+ "declarationMap": false,
15
+
16
+ /* Linting */
17
+ "strict": true,
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "noFallthroughCasesInSwitch": true
12
21
  }
13
22
  }
package/twind.config.ts CHANGED
@@ -8,15 +8,15 @@ export default defineConfig({
8
8
  theme: {
9
9
  extend: {
10
10
  colors: {
11
- primary: 'var(--clr-primary,black)',
12
- accent: 'var(--clr-accent,blue)',
13
- label: 'var(--clr-label,black)',
14
- input: 'var(--clr-input,black)',
15
- placeholder: 'var(--clr-placeholder,#94a3b8)',
16
- 'category-label': 'var(--clr-category-label,black)',
11
+ primary: 'var(--tt-clr-primary,black)',
12
+ accent: 'var(--tt-clr-accent,blue)',
13
+ label: 'var(--tt-clr-label,black)',
14
+ input: 'var(--tt-clr-input,black)',
15
+ placeholder: 'var(--tt-clr-placeholder,#94a3b8)',
16
+ 'category-label': 'var(--tt-clr-category-label,black)',
17
17
  },
18
18
  fontFamily: {
19
- 'ff-text': ['var(--ff-text)', 'Helvetica', 'Arial', 'sans-serif'],
19
+ 'ff-text': ['var(--tt-ff-text)', 'Helvetica', 'Arial', 'sans-serif'],
20
20
  },
21
21
  },
22
22
  },
package/vite.config.ts ADDED
@@ -0,0 +1,47 @@
1
+ import { resolve } from 'pathe';
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react-swc';
4
+ import dts from 'vite-plugin-dts';
5
+
6
+ // https://vitejs.dev/config/
7
+ export default defineConfig({
8
+ resolve: {
9
+ alias: {
10
+ '@twintag/twintag-form': resolve(__dirname, './lib'),
11
+ },
12
+ },
13
+ build: {
14
+ lib: {
15
+ // Could also be a dictionary or array of multiple entry points
16
+ entry: {
17
+ react: resolve(__dirname, './lib/index.tsx'),
18
+ webcomponent: resolve(__dirname, './lib/webcomponent.ts'),
19
+ },
20
+ name: 'twintag-form',
21
+ formats: ['es'],
22
+ // the proper extensions will be added
23
+ fileName: (_, entryName) => `twintag-form.${entryName}.js`,
24
+ },
25
+ rollupOptions: {
26
+ // make sure to externalize deps that shouldn't be bundled
27
+ // into your library
28
+ external: ['react', 'react-dom'],
29
+ output: {
30
+ // Provide global variables to use in the UMD build
31
+ // for externalized deps
32
+ globals: {
33
+ react: 'React',
34
+ },
35
+ },
36
+ },
37
+ },
38
+ plugins: [
39
+ react(),
40
+ dts({
41
+ entryRoot: resolve(__dirname, 'lib'),
42
+ insertTypesEntry: true,
43
+ staticImport: true,
44
+ exclude: ['**/__tests__/**', '**/__stories__/**'],
45
+ }),
46
+ ],
47
+ });