@twintag/twintag-form 1.5.0 → 1.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.
- package/.turbo/turbo-build.log +9 -10
- package/CHANGELOG.md +6 -0
- package/dist/common/button.d.ts +5 -86
- package/dist/common/calendar.d.ts +3 -81
- package/dist/common/form.d.ts +11 -91
- package/dist/common/input.d.ts +4 -149
- package/dist/common/label.d.ts +2 -23
- package/dist/common/textarea.d.ts +2 -75
- package/dist/components/containers/accordion.d.ts +1 -1
- package/dist/components/fields/date-picker.d.ts +1 -2
- package/dist/components/form.d.ts +2 -2
- package/dist/components/provider.d.ts +4 -4
- package/dist/index.cjs +1 -0
- package/dist/index.js +4456 -0
- package/dist/webcomponent.cjs +1 -1
- package/dist/webcomponent.js +123 -3711
- package/lib/common/calendar.tsx +1 -1
- package/lib/components/containers/accordion.tsx +1 -1
- package/lib/components/fields/date-picker.tsx +2 -2
- package/lib/components/fields/radiogroup.tsx +1 -1
- package/lib/utils/data.ts +5 -3
- package/lib/utils/string.ts +3 -3
- package/lib/webcomponent.ts +0 -1
- package/package.json +8 -9
- package/tailwind.config.ts +2 -2
- package/tsconfig.json +0 -1
- package/vite.config.ts +13 -2
- package/.eslintrc.cjs +0 -9
- package/dist/react.cjs +0 -89
- package/dist/react.d.ts +0 -1
- package/dist/react.js +0 -22662
package/lib/common/calendar.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
1
2
|
import type { VariantProps } from 'tailwind-variants';
|
|
2
3
|
|
|
3
|
-
import * as React from 'react';
|
|
4
4
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
5
5
|
import { DayPicker } from 'react-day-picker';
|
|
6
6
|
import { tv } from 'tailwind-variants';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
1
2
|
import type { Props } from '@twintag/twintag-form/types';
|
|
2
3
|
|
|
3
|
-
import * as React from 'react';
|
|
4
4
|
import { format } from 'date-fns';
|
|
5
5
|
import { AsteriskIcon, Calendar as CalendarIcon } from 'lucide-react';
|
|
6
6
|
import { useFormContext } from 'react-hook-form';
|
|
@@ -137,7 +137,7 @@ export const DatePicker: React.FC<Props<'input'>> = ({
|
|
|
137
137
|
mode='single'
|
|
138
138
|
size={size}
|
|
139
139
|
selected={
|
|
140
|
-
!isNaN(new Date(field.value as Date).getTime())
|
|
140
|
+
!Number.isNaN(new Date(field.value as Date).getTime())
|
|
141
141
|
? new Date(field.value as Date)
|
|
142
142
|
: undefined
|
|
143
143
|
}
|
package/lib/utils/data.ts
CHANGED
|
@@ -6,16 +6,18 @@ type Items = (Props<'input'> & {
|
|
|
6
6
|
export const getBindSetFromItems = (items: Items): Set<string> => {
|
|
7
7
|
const binds = new Set<string>();
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
for (const item of items) {
|
|
10
10
|
if (item.bind) {
|
|
11
11
|
binds.add(item.bind);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
if (item.items) {
|
|
15
15
|
const subBinds = getBindSetFromItems(item.items as unknown as Items);
|
|
16
|
-
|
|
16
|
+
for (const bind of subBinds) {
|
|
17
|
+
binds.add(bind);
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
|
-
}
|
|
20
|
+
}
|
|
19
21
|
|
|
20
22
|
return binds;
|
|
21
23
|
};
|
package/lib/utils/string.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export const camelize = (str: string) => {
|
|
2
2
|
return str
|
|
3
|
-
.replace(/(?:^\w|[A-Z]|\b\w)/g,
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) =>
|
|
4
|
+
index === 0 ? word.toLowerCase() : word.toUpperCase(),
|
|
5
|
+
)
|
|
6
6
|
.replace(/\s+/g, '');
|
|
7
7
|
};
|
|
8
8
|
|
package/lib/webcomponent.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twintag/twintag-form",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"author": "Twintag",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
10
11
|
},
|
|
11
12
|
"./webcomponent": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
13
|
+
"types": "./dist/webcomponent.d.ts",
|
|
14
|
+
"import": "./dist/webcomponent.js",
|
|
15
|
+
"require": "./dist/webcomponent.cjs"
|
|
14
16
|
}
|
|
15
17
|
},
|
|
16
18
|
"dependencies": {
|
|
@@ -43,12 +45,10 @@
|
|
|
43
45
|
"@twind/with-react": "^1.1.3",
|
|
44
46
|
"@types/uuid": "^9.0.7",
|
|
45
47
|
"@vitejs/plugin-react-swc": "^3.6.0",
|
|
46
|
-
"tailwindcss": "^3.3.6",
|
|
47
48
|
"vite": "^5.2.11",
|
|
48
49
|
"vite-plugin-dts": "^3.9.1",
|
|
49
50
|
"tsconfig": "0.0.0",
|
|
50
|
-
"twintag-types": "0.
|
|
51
|
-
"eslint-config-custom": "1.0.0"
|
|
51
|
+
"twintag-types": "0.4.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
|
-
"lint": "eslint . --ext .ts,.tsx",
|
|
60
59
|
"format": "prettier --write \"**/*.{ts,md,tsx,cjs,mjs,json,html}\" --ignore-path ../../.gitignore",
|
|
61
60
|
"format:check": "prettier --check \"**/*.{ts,md,tsx,cjs,mjs,json,html}\" --ignore-path ../../.gitignore"
|
|
62
61
|
}
|
package/tailwind.config.ts
CHANGED
|
@@ -34,8 +34,8 @@ const config = {
|
|
|
34
34
|
ring: 'hsl(var(--tf-ring) / <alpha-value>)',
|
|
35
35
|
},
|
|
36
36
|
borderRadius: {
|
|
37
|
-
lg:
|
|
38
|
-
md:
|
|
37
|
+
lg: 'var(--tf-radius)',
|
|
38
|
+
md: 'calc(var(--tf-radius) - 2px)',
|
|
39
39
|
sm: 'calc(var(--tf-radius) - 4px)',
|
|
40
40
|
},
|
|
41
41
|
fontFamily: {
|
package/tsconfig.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -3,8 +3,19 @@ import { dirname, resolve } from 'pathe';
|
|
|
3
3
|
import { defineConfig } from 'vite';
|
|
4
4
|
import dts from 'vite-plugin-dts';
|
|
5
5
|
|
|
6
|
+
import { dependencies, devDependencies } from './package.json';
|
|
7
|
+
|
|
6
8
|
export const __dirname = dirname(new URL(import.meta.url).pathname);
|
|
7
9
|
|
|
10
|
+
const externalPackages = [
|
|
11
|
+
...Object.keys(dependencies || {}),
|
|
12
|
+
...Object.keys(devDependencies || {}),
|
|
13
|
+
].filter((packageName) => packageName !== 'twintag-types');
|
|
14
|
+
|
|
15
|
+
const regexesOfPackages = externalPackages.map(
|
|
16
|
+
(packageName) => new RegExp(`^${packageName}(/.*)?`),
|
|
17
|
+
);
|
|
18
|
+
|
|
8
19
|
// https://vitejs.dev/config/
|
|
9
20
|
export default defineConfig({
|
|
10
21
|
resolve: {
|
|
@@ -16,14 +27,14 @@ export default defineConfig({
|
|
|
16
27
|
lib: {
|
|
17
28
|
// Could also be a dictionary or array of multiple entry points
|
|
18
29
|
entry: {
|
|
19
|
-
|
|
30
|
+
index: resolve(__dirname, './lib/index.tsx'),
|
|
20
31
|
webcomponent: resolve(__dirname, './lib/webcomponent.ts'),
|
|
21
32
|
},
|
|
22
33
|
},
|
|
23
34
|
rollupOptions: {
|
|
24
35
|
// make sure to externalize deps that shouldn't be bundled
|
|
25
36
|
// into your library
|
|
26
|
-
external:
|
|
37
|
+
external: regexesOfPackages,
|
|
27
38
|
preserveEntrySignatures: 'strict',
|
|
28
39
|
output: {
|
|
29
40
|
preserveModules: false,
|