@volverjs/ui-vue 0.0.10-beta.12 → 0.0.10-beta.13

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 (43) hide show
  1. package/auto-imports.d.ts +1 -0
  2. package/dist/components/VvInputFile/VvInputFile.es.js +1529 -0
  3. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -0
  4. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +141 -0
  5. package/dist/components/VvInputFile/index.d.ts +52 -0
  6. package/dist/components/index.d.ts +1 -0
  7. package/dist/components/index.es.js +633 -310
  8. package/dist/components/index.umd.js +1 -1
  9. package/dist/composables/index.d.ts +1 -0
  10. package/dist/composables/index.es.js +77 -1
  11. package/dist/composables/index.umd.js +1 -1
  12. package/dist/composables/useBlurhash.d.ts +7 -0
  13. package/dist/icons.es.js +3 -3
  14. package/dist/icons.umd.js +1 -1
  15. package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +1 -1
  16. package/dist/stories/Blurhash/BlurhashComposable.stories.d.ts +4 -0
  17. package/dist/stories/InputFile/InputFile.settings.d.ts +56 -0
  18. package/dist/stories/InputFile/InputFile.stories.d.ts +12 -0
  19. package/dist/stories/InputFile/InputFileModifiers.stories.d.ts +9 -0
  20. package/dist/stories/InputFile/InputFileSlots.stories.d.ts +6 -0
  21. package/dist/types/blurhash.d.ts +12 -0
  22. package/dist/types/index.d.ts +2 -0
  23. package/dist/types/input-file.d.ts +14 -0
  24. package/dist/workers/blurhash.d.ts +1 -0
  25. package/package.json +13 -1
  26. package/src/assets/icons/detailed.json +1 -1
  27. package/src/assets/icons/normal.json +1 -1
  28. package/src/assets/icons/simple.json +1 -1
  29. package/src/components/VvInputFile/VvInputFile.vue +274 -0
  30. package/src/components/VvInputFile/index.ts +36 -0
  31. package/src/components/index.ts +1 -0
  32. package/src/composables/index.ts +1 -0
  33. package/src/composables/useBlurhash.ts +76 -0
  34. package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +2 -2
  35. package/src/stories/Blurhash/BlurhashComposable.stories.ts +195 -0
  36. package/src/stories/InputFile/InputFile.settings.ts +36 -0
  37. package/src/stories/InputFile/InputFile.stories.ts +90 -0
  38. package/src/stories/InputFile/InputFileModifiers.stories.ts +51 -0
  39. package/src/stories/InputFile/InputFileSlots.stories.ts +25 -0
  40. package/src/types/blurhash.ts +21 -0
  41. package/src/types/index.ts +2 -0
  42. package/src/types/input-file.ts +16 -0
  43. package/src/workers/blurhash.ts +9 -0
@@ -0,0 +1,90 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import VvInputFile from '@/components/VvInputFile/VvInputFile.vue'
3
+ import { defaultArgs, argTypes } from './InputFile.settings'
4
+
5
+ const meta: Meta = {
6
+ title: 'Components/InputFile',
7
+ component: VvInputFile,
8
+ args: defaultArgs,
9
+ argTypes,
10
+ tags: ['autodocs'],
11
+ }
12
+
13
+ export default meta
14
+
15
+ type Story = StoryObj<typeof VvInputFile>
16
+
17
+ export const Default: Story = {
18
+ args: {
19
+ ...defaultArgs,
20
+ },
21
+ render: (args) => ({
22
+ components: { VvInputFile },
23
+ setup() {
24
+ const files = ref([])
25
+ return {
26
+ args,
27
+ files,
28
+ }
29
+ },
30
+ template: /* html */ `
31
+ <div class="w-1/4">
32
+ <vv-input-file v-bind="args" v-model="files">
33
+ <template #drop-area v-if="args['drop-area']"><div v-html="args['drop-area']"></div></template>
34
+ <template #hint v-if="args['hint']"><div v-html="args['hint']"></div></template>
35
+ </vv-input-file>
36
+ </div>
37
+ `,
38
+ }),
39
+ }
40
+
41
+ export const Valid: Story = {
42
+ ...Default,
43
+ args: {
44
+ ...defaultArgs,
45
+ valid: true,
46
+ validLabel: 'The field is valid.',
47
+ },
48
+ }
49
+
50
+ export const Invalid: Story = {
51
+ ...Default,
52
+ args: {
53
+ ...defaultArgs,
54
+ invalid: true,
55
+ invalidLabel: 'The field is required.',
56
+ },
57
+ }
58
+
59
+ export const Hint: Story = {
60
+ ...Default,
61
+ args: {
62
+ ...defaultArgs,
63
+ hintLabel: 'Please upload a file.',
64
+ },
65
+ }
66
+
67
+ export const Loading: Story = {
68
+ ...Default,
69
+ args: {
70
+ ...defaultArgs,
71
+ loading: true,
72
+ loadingLabel: 'Loading...',
73
+ },
74
+ }
75
+
76
+ export const IconLeft: Story = {
77
+ ...Default,
78
+ args: {
79
+ ...defaultArgs,
80
+ iconLeft: 'material-symbols:cloud-outline',
81
+ },
82
+ }
83
+
84
+ export const IconRight: Story = {
85
+ ...Default,
86
+ args: {
87
+ ...defaultArgs,
88
+ iconRight: 'akar-icons:heart',
89
+ },
90
+ }
@@ -0,0 +1,51 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import VvInputFile from '@/components/VvInputFile/VvInputFile.vue'
3
+ import { Default } from './InputFile.stories'
4
+ import { argTypes, defaultArgs } from './InputFile.settings'
5
+
6
+ const meta: Meta<typeof VvInputFile> = {
7
+ title: 'Components/InputFile/Modifiers',
8
+ component: VvInputFile,
9
+ args: defaultArgs,
10
+ argTypes,
11
+ }
12
+
13
+ export default meta
14
+
15
+ type Story = StoryObj<typeof VvInputFile>
16
+
17
+ export const DropArea: Story = {
18
+ ...Default,
19
+ args: {
20
+ ...Default.args,
21
+ label: 'Drop area',
22
+ modifiers: 'drop-area',
23
+ },
24
+ }
25
+
26
+ export const DropAreaHidden: Story = {
27
+ ...Default,
28
+ args: {
29
+ ...Default.args,
30
+ label: 'Drop area hidden',
31
+ modifiers: 'drop-area hidden',
32
+ },
33
+ }
34
+
35
+ export const DropAreaSquare: Story = {
36
+ ...Default,
37
+ args: {
38
+ ...Default.args,
39
+ label: 'Drop area square',
40
+ modifiers: 'drop-area square hidden',
41
+ },
42
+ }
43
+
44
+ export const DropAreaCircle: Story = {
45
+ ...Default,
46
+ args: {
47
+ ...Default.args,
48
+ label: 'Drop area circle',
49
+ modifiers: 'drop-area circle hidden',
50
+ },
51
+ }
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import VvInputFile from '@/components/VvInputFile/VvInputFile.vue'
3
+ import { Default as DefaultStory } from './InputFile.stories'
4
+ import { argTypes, defaultArgs } from './InputFile.settings'
5
+
6
+ const meta: Meta<typeof VvInputFile> = {
7
+ title: 'Components/InputFile/Slots',
8
+ component: VvInputFile,
9
+ args: defaultArgs,
10
+ argTypes,
11
+ }
12
+
13
+ export default meta
14
+
15
+ type Story = StoryObj<typeof VvInputFile>
16
+
17
+ export const DropArea: Story = {
18
+ ...DefaultStory,
19
+ args: {
20
+ ...DefaultStory.args,
21
+ 'drop-area':
22
+ '<div class="text-20 font-weight">Drop here your file</div>',
23
+ modifiers: 'drop-area hidden square',
24
+ },
25
+ }
@@ -0,0 +1,21 @@
1
+ class ValidationError extends Error {}
2
+ export type BlurhashWorkerType = {
3
+ encode: (
4
+ pixels: Uint8ClampedArray,
5
+ width: number,
6
+ height: number,
7
+ componentX: number,
8
+ componentY: number,
9
+ ) => string
10
+ decode: (
11
+ blurhash: string,
12
+ width: number,
13
+ height: number,
14
+ punch?: number,
15
+ ) => Uint8ClampedArray
16
+ isBlurhashValid: (blurhash: string) => {
17
+ result: boolean
18
+ errorReason?: string
19
+ }
20
+ ValidationError: ValidationError
21
+ }
@@ -3,3 +3,5 @@ export * from './floating-ui'
3
3
  export * from './generic'
4
4
  export * from './group'
5
5
  export * from './nav'
6
+ export * from './blurhash'
7
+ export * from './input-file'
@@ -0,0 +1,16 @@
1
+ export type UploadedFile<Source = undefined> = Source extends undefined
2
+ ? {
3
+ name: string
4
+ size: number
5
+ type: string
6
+ url: string
7
+ lastModified?: number
8
+ }
9
+ : {
10
+ name: string
11
+ size: number
12
+ type: string
13
+ url: string
14
+ lastModified?: number
15
+ source: Source
16
+ }
@@ -0,0 +1,9 @@
1
+ import { expose } from 'comlink'
2
+ import { ValidationError, encode, decode, isBlurhashValid } from 'blurhash'
3
+
4
+ expose({
5
+ ValidationError,
6
+ encode,
7
+ decode,
8
+ isBlurhashValid,
9
+ })