@volverjs/ui-vue 0.0.9-beta.9 → 0.0.9
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/auto-imports.d.ts +2 -2
- package/dist/components/VvAccordion/VvAccordion.es.js +8 -7
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +8 -7
- package/dist/components/VvAction/VvAction.es.js +8 -7
- package/dist/components/VvAlert/VvAlert.es.js +8 -7
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +8 -7
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +6 -6
- package/dist/components/VvAlertGroup/index.d.ts +2 -2
- package/dist/components/VvAvatar/VvAvatar.es.js +8 -7
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +8 -7
- package/dist/components/VvBadge/VvBadge.es.js +8 -7
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +8 -7
- package/dist/components/VvButton/VvButton.es.js +8 -7
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +8 -7
- package/dist/components/VvCard/VvCard.es.js +8 -7
- package/dist/components/VvCheckbox/VvCheckbox.es.js +8 -7
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +8 -7
- package/dist/components/VvCombobox/VvCombobox.es.js +145 -116
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +306 -90
- package/dist/components/VvCombobox/index.d.ts +108 -31
- package/dist/components/VvDialog/VvDialog.es.js +16 -11
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +19 -16
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +299 -91
- package/dist/components/VvDropdown/index.d.ts +99 -30
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +8 -7
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +8 -7
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +8 -7
- package/dist/components/VvInputText/VvInputText.es.js +193 -103
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +19 -37
- package/dist/components/VvInputText/index.d.ts +15 -33
- package/dist/components/VvNav/VvNav.es.js +8 -7
- package/dist/components/VvProgress/VvProgress.es.js +8 -7
- package/dist/components/VvRadio/VvRadio.es.js +8 -7
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +8 -7
- package/dist/components/VvSelect/VvSelect.es.js +8 -7
- package/dist/components/VvSelect/VvSelect.vue.d.ts +1 -1
- package/dist/components/VvTab/VvTab.es.js +8 -7
- package/dist/components/VvTextarea/VvTextarea.es.js +16 -12
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +8 -7
- package/dist/components/index.es.js +346 -221
- package/dist/components/index.umd.js +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/directives/index.es.js +8 -7
- package/dist/directives/v-tooltip.es.js +8 -7
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +100 -31
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +18 -18
- package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
- package/dist/stories/InputText/InputText.settings.d.ts +31 -9
- package/dist/stories/InputText/InputText.stories.d.ts +0 -1
- package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
- package/package.json +60 -59
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +40 -19
- package/src/components/VvCombobox/index.ts +13 -0
- package/src/components/VvDialog/VvDialog.vue +6 -2
- package/src/components/VvDropdown/VvDropdown.vue +18 -16
- package/src/components/VvInputText/VvInputText.vue +170 -55
- package/src/components/VvInputText/index.ts +32 -34
- package/src/components/VvTextarea/VvTextarea.vue +8 -5
- package/src/constants.ts +5 -0
- package/src/props/index.ts +7 -11
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Combobox/Combobox.test.ts +1 -1
- package/src/stories/InputText/InputText.settings.ts +36 -15
- package/src/stories/InputText/InputText.stories.ts +4 -12
- package/src/stories/InputText/InputText.test.ts +31 -15
- package/src/stories/InputText/InputTextMask.stories.ts +122 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue'
|
|
2
|
-
import type {
|
|
2
|
+
import type { FactoryOpts } from 'imask'
|
|
3
3
|
import { InputTextareaProps } from '../../props'
|
|
4
4
|
|
|
5
5
|
export const INPUT_TYPES = {
|
|
@@ -28,7 +28,23 @@ export const TYPES_ICON = {
|
|
|
28
28
|
SEARCH: 'close',
|
|
29
29
|
} as const
|
|
30
30
|
|
|
31
|
-
export const VvInputTextEvents = [
|
|
31
|
+
export const VvInputTextEvents = [
|
|
32
|
+
'update:modelValue',
|
|
33
|
+
'update:masked',
|
|
34
|
+
'accept',
|
|
35
|
+
'accept:typed',
|
|
36
|
+
'accept:masked',
|
|
37
|
+
'accept:unmasked',
|
|
38
|
+
'complete',
|
|
39
|
+
'complete:typed',
|
|
40
|
+
'complete:masked',
|
|
41
|
+
'complete:unmasked',
|
|
42
|
+
'focus',
|
|
43
|
+
'blur',
|
|
44
|
+
'keyup',
|
|
45
|
+
'keydown',
|
|
46
|
+
'keypress',
|
|
47
|
+
]
|
|
32
48
|
|
|
33
49
|
export const VvInputTextProps = {
|
|
34
50
|
...InputTextareaProps,
|
|
@@ -137,45 +153,20 @@ export const VvInputTextProps = {
|
|
|
137
153
|
default: 'Clear',
|
|
138
154
|
},
|
|
139
155
|
/**
|
|
140
|
-
*
|
|
141
|
-
* @see https://
|
|
156
|
+
* iMask options
|
|
157
|
+
* @see https://imask.js.org/guide.html
|
|
142
158
|
*/
|
|
143
|
-
|
|
144
|
-
type:
|
|
159
|
+
iMask: {
|
|
160
|
+
type: Object as PropType<FactoryOpts>,
|
|
145
161
|
default: undefined,
|
|
146
162
|
},
|
|
147
163
|
/**
|
|
148
|
-
*
|
|
149
|
-
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
150
|
-
*/
|
|
151
|
-
maskEager: {
|
|
152
|
-
type: Boolean,
|
|
153
|
-
default: false,
|
|
154
|
-
},
|
|
155
|
-
/**
|
|
156
|
-
* Write values reverse (ex. for numbers)
|
|
157
|
-
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
158
|
-
*/
|
|
159
|
-
maskReversed: {
|
|
160
|
-
type: Boolean,
|
|
161
|
-
default: false,
|
|
162
|
-
},
|
|
163
|
-
/**
|
|
164
|
-
* Add mask custom tokens
|
|
165
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
164
|
+
* Masked value
|
|
166
165
|
*/
|
|
167
|
-
|
|
168
|
-
type:
|
|
166
|
+
masked: {
|
|
167
|
+
type: String,
|
|
169
168
|
default: undefined,
|
|
170
169
|
},
|
|
171
|
-
/**
|
|
172
|
-
* Replace default tokens
|
|
173
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
174
|
-
*/
|
|
175
|
-
maskTokensReplace: {
|
|
176
|
-
type: Boolean,
|
|
177
|
-
default: false,
|
|
178
|
-
},
|
|
179
170
|
/**
|
|
180
171
|
* Adjust input width to content
|
|
181
172
|
*/
|
|
@@ -196,6 +187,13 @@ export const VvInputTextProps = {
|
|
|
196
187
|
unit: {
|
|
197
188
|
type: String,
|
|
198
189
|
},
|
|
190
|
+
/**
|
|
191
|
+
* Select input text on focus
|
|
192
|
+
*/
|
|
193
|
+
selectOnFocus: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: false,
|
|
196
|
+
},
|
|
199
197
|
}
|
|
200
198
|
|
|
201
199
|
export type VvInputTextPropsTypes = ExtractPropTypes<typeof VvInputTextProps>
|
|
@@ -37,6 +37,9 @@
|
|
|
37
37
|
invalid,
|
|
38
38
|
loading,
|
|
39
39
|
modifiers,
|
|
40
|
+
debounce,
|
|
41
|
+
minlength,
|
|
42
|
+
maxlength,
|
|
40
43
|
} = toRefs(props)
|
|
41
44
|
const hasId = useUniqueId(id)
|
|
42
45
|
const hasHintId = computed(() => `${hasId.value}-hint`)
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
)
|
|
47
50
|
|
|
48
51
|
// debounce
|
|
49
|
-
const localModelValue = useDebouncedInput(modelValue, emit,
|
|
52
|
+
const localModelValue = useDebouncedInput(modelValue, emit, debounce?.value)
|
|
50
53
|
|
|
51
54
|
// icons
|
|
52
55
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
@@ -67,9 +70,9 @@
|
|
|
67
70
|
|
|
68
71
|
// count
|
|
69
72
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
70
|
-
mode:
|
|
71
|
-
upperLimit: Number(
|
|
72
|
-
lowerLimit: Number(
|
|
73
|
+
mode: count?.value,
|
|
74
|
+
upperLimit: Number(maxlength?.value),
|
|
75
|
+
lowerLimit: Number(minlength?.value),
|
|
73
76
|
})
|
|
74
77
|
|
|
75
78
|
// tabindex
|
|
@@ -143,7 +146,7 @@
|
|
|
143
146
|
'aria-errormessage': hasInvalidLabelOrSlot.value
|
|
144
147
|
? hasHintId.value
|
|
145
148
|
: undefined,
|
|
146
|
-
} as TextareaHTMLAttributes
|
|
149
|
+
}) as TextareaHTMLAttributes,
|
|
147
150
|
)
|
|
148
151
|
|
|
149
152
|
// slots props
|
package/src/constants.ts
CHANGED
package/src/props/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
} from '../types/floating-ui'
|
|
10
10
|
import {
|
|
11
11
|
Placement,
|
|
12
|
+
Strategy,
|
|
12
13
|
Position,
|
|
13
14
|
Side,
|
|
14
15
|
AnchorTarget,
|
|
@@ -228,22 +229,17 @@ export const DropdownProps = {
|
|
|
228
229
|
placement: {
|
|
229
230
|
type: String as PropType<`${Side}` | `${Placement}`>,
|
|
230
231
|
default: Side.bottom,
|
|
231
|
-
validator: (value: Side & Placement) =>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
Object.values(Placement).includes(value)
|
|
235
|
-
)
|
|
236
|
-
},
|
|
232
|
+
validator: (value: Side & Placement) =>
|
|
233
|
+
Object.values(Side).includes(value) ||
|
|
234
|
+
Object.values(Placement).includes(value),
|
|
237
235
|
},
|
|
238
236
|
/**
|
|
239
237
|
* Dropdown strategy
|
|
240
238
|
*/
|
|
241
239
|
strategy: {
|
|
242
|
-
type: String as PropType
|
|
243
|
-
default:
|
|
244
|
-
validator: (value:
|
|
245
|
-
return ['fixed', 'absolute'].includes(value)
|
|
246
|
-
},
|
|
240
|
+
type: String as PropType<`${Strategy}`>,
|
|
241
|
+
default: undefined,
|
|
242
|
+
validator: (value: Strategy) => Object.values(Strategy).includes(value),
|
|
247
243
|
},
|
|
248
244
|
/**
|
|
249
245
|
* Dropdown show / hide transition name
|
|
@@ -187,6 +187,14 @@ export const argTypes = {
|
|
|
187
187
|
},
|
|
188
188
|
},
|
|
189
189
|
},
|
|
190
|
+
searchFunction: {
|
|
191
|
+
description: 'Search function to filter options',
|
|
192
|
+
table: {
|
|
193
|
+
defaultValue: {
|
|
194
|
+
summary: undefined,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
190
198
|
searchPlaceholder: {
|
|
191
199
|
description:
|
|
192
200
|
'Text that appears in the in the search input when it has no value set..',
|
|
@@ -62,7 +62,7 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// select second value
|
|
65
|
-
if (args.options.length > 1) {
|
|
65
|
+
if (args.options && args.options.length > 1) {
|
|
66
66
|
await expect(dropdownSecondItem).toBeClicked()
|
|
67
67
|
await sleep()
|
|
68
68
|
const secondValue = getOptionValue(
|
|
@@ -174,43 +174,64 @@ export const argTypes = {
|
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
176
|
},
|
|
177
|
-
|
|
178
|
-
description: '
|
|
179
|
-
|
|
177
|
+
iMask: {
|
|
178
|
+
description: '[iMask](https://imask.js.org/guide.html) options',
|
|
179
|
+
control: {
|
|
180
|
+
type: 'object',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
masked: {
|
|
184
|
+
description: 'Masked input',
|
|
180
185
|
control: {
|
|
181
186
|
type: 'text',
|
|
182
187
|
},
|
|
183
188
|
},
|
|
184
|
-
|
|
185
|
-
description: '
|
|
189
|
+
autoWidth: {
|
|
190
|
+
description: 'Adjust input width to content',
|
|
191
|
+
control: {
|
|
192
|
+
type: 'boolean',
|
|
193
|
+
},
|
|
186
194
|
table: {
|
|
187
195
|
defaultValue: {
|
|
188
196
|
summary: false,
|
|
189
197
|
},
|
|
198
|
+
type: {
|
|
199
|
+
summary: 'boolean',
|
|
200
|
+
},
|
|
190
201
|
},
|
|
191
202
|
},
|
|
192
|
-
|
|
193
|
-
description: '
|
|
203
|
+
hideActions: {
|
|
204
|
+
description: 'Hide type number, password and search actions',
|
|
205
|
+
control: {
|
|
206
|
+
type: 'boolean',
|
|
207
|
+
},
|
|
194
208
|
table: {
|
|
195
209
|
defaultValue: {
|
|
196
210
|
summary: false,
|
|
197
211
|
},
|
|
212
|
+
type: {
|
|
213
|
+
summary: 'boolean',
|
|
214
|
+
},
|
|
198
215
|
},
|
|
199
216
|
},
|
|
200
|
-
|
|
201
|
-
description: 'Add
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
summary: 'undefined',
|
|
205
|
-
},
|
|
217
|
+
unit: {
|
|
218
|
+
description: 'Add unit label to input',
|
|
219
|
+
control: {
|
|
220
|
+
type: 'text',
|
|
206
221
|
},
|
|
207
222
|
},
|
|
208
|
-
|
|
209
|
-
description: '
|
|
223
|
+
selectOnFocus: {
|
|
224
|
+
description: 'Select input text on focus',
|
|
225
|
+
control: {
|
|
226
|
+
type: 'boolean',
|
|
227
|
+
},
|
|
210
228
|
table: {
|
|
211
229
|
defaultValue: {
|
|
212
230
|
summary: false,
|
|
213
231
|
},
|
|
232
|
+
type: {
|
|
233
|
+
summary: 'boolean',
|
|
234
|
+
},
|
|
214
235
|
},
|
|
215
236
|
},
|
|
216
237
|
before: {
|
|
@@ -25,14 +25,15 @@ export const Default: Story = {
|
|
|
25
25
|
setup() {
|
|
26
26
|
return { args }
|
|
27
27
|
},
|
|
28
|
-
data: () => ({ inputValue: undefined }),
|
|
28
|
+
data: () => ({ inputValue: undefined, maskedInputValue: undefined }),
|
|
29
29
|
template: /* html */ `
|
|
30
|
-
<vv-input-text v-bind="args" v-model="inputValue" :data-testData="inputValue" data-testId="element">
|
|
30
|
+
<vv-input-text v-bind="args" v-model="inputValue" v-model:masked="maskedInputValue" :data-testData="inputValue" data-testId="element">
|
|
31
31
|
<template #before v-if="args.before"><div class="flex" v-html="args.before"></div></template>
|
|
32
32
|
<template #after v-if="args.after"><div class="flex" v-html="args.after"></div></template>
|
|
33
33
|
<template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
|
|
34
34
|
</vv-input-text>
|
|
35
|
-
<div>Value: <span data-testId="value">{{inputValue}}</span></div>
|
|
35
|
+
<div>Value: <span data-testId="value">{{ inputValue }}</span></div>
|
|
36
|
+
<div v-if="args.iMask" class="mt-sm">Masked Value: <span data-testId="masked-value">{{ maskedInputValue }}</span></div>
|
|
36
37
|
`,
|
|
37
38
|
}),
|
|
38
39
|
play: defaultTest,
|
|
@@ -82,7 +83,6 @@ export const Hint: Story = {
|
|
|
82
83
|
...defaultArgs,
|
|
83
84
|
hintLabel: 'Please enter your name.',
|
|
84
85
|
},
|
|
85
|
-
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export const Loading: Story = {
|
|
@@ -102,14 +102,6 @@ export const Floating: Story = {
|
|
|
102
102
|
},
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
export const Mask: Story = {
|
|
106
|
-
...Default,
|
|
107
|
-
args: {
|
|
108
|
-
...defaultArgs,
|
|
109
|
-
mask: '##-###-##',
|
|
110
|
-
},
|
|
111
|
-
}
|
|
112
|
-
|
|
113
105
|
export const Unit: Story = {
|
|
114
106
|
...Default,
|
|
115
107
|
args: {
|
|
@@ -4,32 +4,48 @@ import { sleep } from '@/test/sleep'
|
|
|
4
4
|
import { within, userEvent } from '@storybook/testing-library'
|
|
5
5
|
import { INPUT_TYPES, type InputType } from '@/components/VvInputText'
|
|
6
6
|
|
|
7
|
-
const valueByType = (type: InputType, mask?: string) => {
|
|
7
|
+
const valueByType = (type: InputType, mask?: string, id?: string) => {
|
|
8
8
|
if (mask) {
|
|
9
|
-
|
|
9
|
+
switch (id) {
|
|
10
|
+
case 'phone-number':
|
|
11
|
+
return { toType: '393923847556' }
|
|
12
|
+
case 'date-placeholder':
|
|
13
|
+
return { toType: '01011970', toCheck: '1970-01-01' }
|
|
14
|
+
case 'phone-or-email':
|
|
15
|
+
return {
|
|
16
|
+
toType:
|
|
17
|
+
Math.random() < 0.5 ? '393923847556' : 'test@test.com',
|
|
18
|
+
}
|
|
19
|
+
case 'intl-number':
|
|
20
|
+
return { toType: '1234567890.22' }
|
|
21
|
+
case 'currency':
|
|
22
|
+
return { toType: '1234567890.22' }
|
|
23
|
+
default:
|
|
24
|
+
return { toType: '1234567890' }
|
|
25
|
+
}
|
|
10
26
|
}
|
|
11
27
|
switch (type) {
|
|
12
28
|
case INPUT_TYPES.TEXT:
|
|
13
29
|
case INPUT_TYPES.PASSWORD:
|
|
14
30
|
case INPUT_TYPES.SEARCH:
|
|
15
|
-
return 'Lorem ipsum'
|
|
31
|
+
return { toType: 'Lorem ipsum' }
|
|
16
32
|
case INPUT_TYPES.NUMBER:
|
|
17
|
-
return '1'
|
|
33
|
+
return { toType: '1' }
|
|
18
34
|
case INPUT_TYPES.EMAIL:
|
|
19
|
-
return 'test@test.com'
|
|
35
|
+
return { toType: 'test@test.com' }
|
|
20
36
|
case INPUT_TYPES.TEL:
|
|
21
|
-
return '+1234567890'
|
|
37
|
+
return { toType: '+1234567890' }
|
|
22
38
|
case INPUT_TYPES.URL:
|
|
23
|
-
return 'https://www.test.com'
|
|
39
|
+
return { toType: 'https://www.test.com' }
|
|
24
40
|
case INPUT_TYPES.DATE:
|
|
25
|
-
return new Date().toISOString().split('T')[0]
|
|
41
|
+
return { toType: new Date().toISOString().split('T')[0] }
|
|
26
42
|
case INPUT_TYPES.TIME:
|
|
27
|
-
return '12:00'
|
|
43
|
+
return { toType: '12:00' }
|
|
28
44
|
case INPUT_TYPES.COLOR:
|
|
29
45
|
case INPUT_TYPES.DATETIME_LOCAL:
|
|
30
46
|
case INPUT_TYPES.MONTH:
|
|
31
47
|
case INPUT_TYPES.WEEK:
|
|
32
|
-
return undefined
|
|
48
|
+
return { toType: undefined }
|
|
33
49
|
}
|
|
34
50
|
}
|
|
35
51
|
|
|
@@ -45,17 +61,17 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
|
45
61
|
|
|
46
62
|
// value
|
|
47
63
|
if (!args.invalid && !args.disabled && !args.readonly) {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
64
|
+
const { toType, toCheck } = valueByType(args.type, args.iMask, args.id)
|
|
65
|
+
if (toType) {
|
|
50
66
|
await expect(input).toBeClicked()
|
|
51
|
-
await userEvent.keyboard(
|
|
67
|
+
await userEvent.keyboard(toType)
|
|
52
68
|
await sleep()
|
|
53
69
|
if (args.maxlength) {
|
|
54
70
|
await expect(value.innerHTML).toEqual(
|
|
55
|
-
|
|
71
|
+
toType.slice(0, args.maxlength),
|
|
56
72
|
)
|
|
57
73
|
} else {
|
|
58
|
-
await expect(value.innerHTML).toEqual(
|
|
74
|
+
await expect(value.innerHTML).toEqual(toCheck ?? toType)
|
|
59
75
|
}
|
|
60
76
|
}
|
|
61
77
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import VvInputText from '@/components/VvInputText/VvInputText.vue'
|
|
3
|
+
import { Default } from './InputText.stories'
|
|
4
|
+
import { defaultArgs, argTypes } from './InputText.settings'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof VvInputText> = {
|
|
7
|
+
title: 'Components/InputText/Mask',
|
|
8
|
+
component: VvInputText,
|
|
9
|
+
args: defaultArgs,
|
|
10
|
+
argTypes,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof VvInputText>
|
|
16
|
+
|
|
17
|
+
export const RegExp: Story = {
|
|
18
|
+
...Default,
|
|
19
|
+
args: {
|
|
20
|
+
...defaultArgs,
|
|
21
|
+
id: 'regexp',
|
|
22
|
+
iMask: {
|
|
23
|
+
mask: /^\d+$/,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const PhoneNumber: Story = {
|
|
29
|
+
...Default,
|
|
30
|
+
args: {
|
|
31
|
+
...defaultArgs,
|
|
32
|
+
id: 'phone-number',
|
|
33
|
+
iMask: {
|
|
34
|
+
mask: '+{39}(000)000-00-00',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Pattern: Story = {
|
|
40
|
+
...Default,
|
|
41
|
+
args: {
|
|
42
|
+
...defaultArgs,
|
|
43
|
+
id: 'pattern',
|
|
44
|
+
iMask: {
|
|
45
|
+
mask: 'XXX-XX-00000',
|
|
46
|
+
definitions: {
|
|
47
|
+
X: {
|
|
48
|
+
mask: '0',
|
|
49
|
+
displayChar: 'X',
|
|
50
|
+
placeholderChar: '#',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
lazy: false,
|
|
54
|
+
overwrite: 'shift',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const IntlNumber: Story = {
|
|
60
|
+
...Default,
|
|
61
|
+
args: {
|
|
62
|
+
...defaultArgs,
|
|
63
|
+
id: 'intl-number',
|
|
64
|
+
type: 'number',
|
|
65
|
+
iMask: {
|
|
66
|
+
mask: Number,
|
|
67
|
+
thousandsSeparator: '.',
|
|
68
|
+
radix: ',',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const DatePlaceholder: Story = {
|
|
74
|
+
...Default,
|
|
75
|
+
args: {
|
|
76
|
+
...defaultArgs,
|
|
77
|
+
id: 'date-placeholder',
|
|
78
|
+
type: 'date',
|
|
79
|
+
iMask: {
|
|
80
|
+
mask: Date,
|
|
81
|
+
pattern: 'd.m.Y',
|
|
82
|
+
lazy: false,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const PhoneOrEmail: Story = {
|
|
88
|
+
...Default,
|
|
89
|
+
args: {
|
|
90
|
+
...defaultArgs,
|
|
91
|
+
id: 'phone-or-email',
|
|
92
|
+
iMask: {
|
|
93
|
+
mask: [
|
|
94
|
+
{
|
|
95
|
+
mask: '+{39}(000)000-00-00',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
mask: /^\S*@?\S*$/,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const Currency: Story = {
|
|
106
|
+
...Default,
|
|
107
|
+
args: {
|
|
108
|
+
...defaultArgs,
|
|
109
|
+
id: 'currency',
|
|
110
|
+
type: 'number',
|
|
111
|
+
iMask: {
|
|
112
|
+
mask: '€ num',
|
|
113
|
+
blocks: {
|
|
114
|
+
num: {
|
|
115
|
+
mask: Number,
|
|
116
|
+
thousandsSeparator: '.',
|
|
117
|
+
radix: ',',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
}
|