@fiscozen/checkbox 0.1.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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/checkbox.js +301 -0
- package/dist/checkbox.umd.cjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/src/FzCheckbox.vue.d.ts +95 -0
- package/dist/src/FzCheckboxGroup.vue.d.ts +70 -0
- package/dist/src/__test__/FzCheckbox.test.d.ts +1 -0
- package/dist/src/__test__/FzCheckboxGroup.test.d.ts +1 -0
- package/dist/src/common.d.ts +4 -0
- package/dist/src/components/FzCheckboxErrorText.vue.d.ts +24 -0
- package/dist/src/components/FzCheckboxGroupOption.vue.d.ts +82 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/types.d.ts +76 -0
- package/dist/style.css +1 -0
- package/package.json +49 -0
- package/src/FzCheckbox.vue +139 -0
- package/src/FzCheckboxGroup.vue +74 -0
- package/src/__test__/FzCheckbox.test.ts +88 -0
- package/src/__test__/FzCheckboxGroup.test.ts +100 -0
- package/src/__test__/__snapshots__/FzCheckbox.test.ts.snap +21 -0
- package/src/common.ts +4 -0
- package/src/components/FzCheckboxErrorText.vue +20 -0
- package/src/components/FzCheckboxGroupOption.vue +96 -0
- package/src/index.ts +3 -0
- package/src/types.ts +75 -0
- package/tsconfig.json +4 -0
- package/vite.config.ts +33 -0
- package/vitest.config.ts +19 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export type FzCheckboxProps = {
|
|
2
|
+
/**
|
|
3
|
+
* The label of the checkbox
|
|
4
|
+
*/
|
|
5
|
+
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* The value of the checkbox. If not provided, the value will be the label
|
|
8
|
+
*/
|
|
9
|
+
value?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The size of the checkbox
|
|
12
|
+
*/
|
|
13
|
+
size: "sm" | "md";
|
|
14
|
+
/**
|
|
15
|
+
* If the checkbox is checked
|
|
16
|
+
*/
|
|
17
|
+
checked?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* if the checkbox is indeterminate
|
|
20
|
+
*/
|
|
21
|
+
indeterminate?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* If true, the checkbox will be emphasized
|
|
24
|
+
*/
|
|
25
|
+
emphasis?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If true, the checkbox will be disabled
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* If true, the checkbox will be in an error state
|
|
32
|
+
*/
|
|
33
|
+
error?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* If the checkbox is required
|
|
36
|
+
*/
|
|
37
|
+
required?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* If the checkbox is standalone
|
|
40
|
+
*/
|
|
41
|
+
standalone?: boolean;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type FzCheckboxGroupProps = {
|
|
45
|
+
/**
|
|
46
|
+
* The label of the checkbox group
|
|
47
|
+
*/
|
|
48
|
+
label: string;
|
|
49
|
+
/**
|
|
50
|
+
* The size of the checkbox
|
|
51
|
+
*/
|
|
52
|
+
size: "sm" | "md";
|
|
53
|
+
/**
|
|
54
|
+
* The checkbox to render
|
|
55
|
+
*/
|
|
56
|
+
options: ParentCheckbox[];
|
|
57
|
+
/**
|
|
58
|
+
* If true, the checkbox will be emphasized
|
|
59
|
+
*/
|
|
60
|
+
emphasis?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* If true, the checkbox will be disabled
|
|
63
|
+
*/
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* If true, the checkbox will be in an error state
|
|
67
|
+
*/
|
|
68
|
+
error?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* If the checkbox group is required
|
|
71
|
+
*/
|
|
72
|
+
required?: boolean;
|
|
73
|
+
};
|
|
74
|
+
export type ParentCheckbox = ChildCheckbox & { children?: ChildCheckbox[] };
|
|
75
|
+
export type ChildCheckbox = Omit<FzCheckboxProps, "size">;
|
package/tsconfig.json
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { defineConfig } from 'vite'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import dts from 'vite-plugin-dts'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [
|
|
9
|
+
vue(),
|
|
10
|
+
dts({
|
|
11
|
+
insertTypesEntry: true,
|
|
12
|
+
})
|
|
13
|
+
],
|
|
14
|
+
resolve: {
|
|
15
|
+
alias: {
|
|
16
|
+
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
build: {
|
|
20
|
+
lib: {
|
|
21
|
+
entry: resolve(__dirname, './src/index.ts'),
|
|
22
|
+
name: 'FzCheckbox',
|
|
23
|
+
},
|
|
24
|
+
rollupOptions: {
|
|
25
|
+
external: ['vue', "@fiscozen/icons"],
|
|
26
|
+
output: {
|
|
27
|
+
globals: {
|
|
28
|
+
vue: 'Vue',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { mergeConfig, defineConfig, configDefaults } from 'vitest/config'
|
|
3
|
+
import viteConfig from './vite.config'
|
|
4
|
+
|
|
5
|
+
export default mergeConfig(
|
|
6
|
+
viteConfig,
|
|
7
|
+
defineConfig({
|
|
8
|
+
test: {
|
|
9
|
+
environment: 'jsdom',
|
|
10
|
+
exclude: [...configDefaults.exclude, 'e2e/*'],
|
|
11
|
+
root: fileURLToPath(new URL('./', import.meta.url)),
|
|
12
|
+
coverage: {
|
|
13
|
+
provider: 'v8',
|
|
14
|
+
include: ['**/src/**'],
|
|
15
|
+
exclude: ['**/index.ts']
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
)
|