@volverjs/ui-vue 0.0.10-beta.53 → 0.0.10-beta.54

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 (39) hide show
  1. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +13 -1
  2. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  3. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -0
  4. package/dist/components/VvCheckboxGroup/index.d.ts +4 -0
  5. package/dist/components/VvInputFile/VvInputFile.es.js +17 -3
  6. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  7. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +9 -0
  8. package/dist/components/VvInputFile/index.d.ts +4 -0
  9. package/dist/components/VvInputText/VvInputText.es.js +1 -1
  10. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  11. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +13 -1
  12. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  13. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -0
  14. package/dist/components/VvRadioGroup/index.d.ts +4 -0
  15. package/dist/components/VvTextarea/VvTextarea.es.js +290 -290
  16. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  17. package/dist/components/index.es.js +16 -6
  18. package/dist/components/index.umd.js +1 -1
  19. package/dist/icons.es.js +3 -3
  20. package/dist/icons.umd.js +1 -1
  21. package/dist/props/index.d.ts +8 -1
  22. package/dist/stories/InputText/InputText.stories.d.ts +2 -0
  23. package/dist/stories/InputText/InputText.test.d.ts +2 -0
  24. package/package.json +3 -3
  25. package/src/assets/icons/detailed.json +1 -1
  26. package/src/assets/icons/normal.json +1 -1
  27. package/src/assets/icons/simple.json +1 -1
  28. package/src/components/VvCheckbox/VvCheckbox.vue +2 -2
  29. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +2 -0
  30. package/src/components/VvInputFile/VvInputFile.vue +12 -8
  31. package/src/components/VvInputFile/index.ts +2 -0
  32. package/src/components/VvInputText/VvInputText.vue +2 -2
  33. package/src/components/VvRadio/VvRadio.vue +2 -2
  34. package/src/components/VvRadioGroup/VvRadioGroup.vue +2 -0
  35. package/src/components/VvTextarea/VvTextarea.vue +1 -1
  36. package/src/props/index.ts +2 -1
  37. package/src/stories/InputText/InputText.stories.ts +37 -1
  38. package/src/stories/InputText/InputText.test.ts +18 -0
  39. package/src/stories/Textarea/Textarea.stories.ts +1 -1
@@ -170,10 +170,10 @@ export default {
170
170
  v-model="localModelValue"
171
171
  type="checkbox"
172
172
  class="vv-checkbox__input"
173
- :name="name"
173
+ :name
174
174
  :disabled="isDisabled"
175
175
  :value="hasValue"
176
- :tabindex="tabindex"
176
+ :tabindex
177
177
  :aria-invalid="isInvalid"
178
178
  :aria-describedby="hasHintLabelOrSlot ? hasHintId : undefined"
179
179
  :aria-errormessage="hasInvalidLabelOrSlot ? hasHintId : undefined"
@@ -43,6 +43,7 @@ const bemCssClasses = useModifiers(
43
43
  computed(() => ({
44
44
  disabled: disabled.value,
45
45
  readonly: readonly.value,
46
+ required: props.required,
46
47
  horizontal: !vertical.value,
47
48
  valid: valid.value,
48
49
  invalid: invalid.value,
@@ -56,6 +57,7 @@ function getOptionProps(option: string | Option, index: number) {
56
57
  name: props.name,
57
58
  label: getOptionLabel(option),
58
59
  value: getOptionValue(option),
60
+ required: props.required,
59
61
  }
60
62
  }
61
63
  const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots)
@@ -43,10 +43,13 @@ const bemCssClasses = useModifiers(
43
43
  'vv-input-file',
44
44
  modifiers,
45
45
  computed(() => ({
46
- 'dragging': isDragging.value,
47
- 'loading': props.loading && !hasProgress.value,
48
46
  'valid': props.valid === true,
49
47
  'invalid': props.invalid === true,
48
+ 'loading': props.loading && !hasProgress.value,
49
+ 'disabled': props.disabled,
50
+ 'required': props.required,
51
+ 'readonly': props.readonly,
52
+ 'dragging': isDragging.value,
50
53
  'icon-before': !!hasIconBefore.value,
51
54
  'icon-after': !!hasIconAfter.value,
52
55
  'drop-area': hasDropArea.value,
@@ -325,18 +328,19 @@ export default {
325
328
  :id="hasId"
326
329
  ref="inputEl"
327
330
  type="file"
328
- :readonly="readonly"
329
- :disabled="disabled"
330
- :placeholder="placeholder"
331
+ :readonly
332
+ :disabled
333
+ :required
334
+ :placeholder
331
335
  :aria-describedby="hasHintLabelOrSlot ? hasHintId : undefined"
332
336
  :aria-invalid="invalid"
333
337
  :aria-errormessage="
334
338
  hasInvalidLabelOrSlot ? hasHintId : undefined
335
339
  "
336
340
  :multiple="isMultiple"
337
- :accept="accept"
338
- :capture="capture"
339
- :name="name"
341
+ :accept
342
+ :capture
343
+ :name
340
344
  @change="onChange"
341
345
  >
342
346
  <progress
@@ -9,6 +9,7 @@ import {
9
9
  LoadingProps,
10
10
  ModifiersProps,
11
11
  ReadonlyProps,
12
+ RequiredProps,
12
13
  ValidProps,
13
14
  } from '../../props'
14
15
  import { ACTION_ICONS, type VvIconProps } from '../VvIcon'
@@ -35,6 +36,7 @@ export const VvInputFileProps = {
35
36
  ...LoadingProps,
36
37
  ...ReadonlyProps,
37
38
  ...DisabledProps,
39
+ ...RequiredProps,
38
40
  ...IconProps,
39
41
  /**
40
42
  * Input value
@@ -174,8 +174,8 @@ const { el, mask, typed, masked, unmasked } = useIMask(
174
174
  },
175
175
  },
176
176
  )
177
- function updateMaskValue(newValue: string | number | undefined) {
178
- if (newValue === undefined) {
177
+ function updateMaskValue(newValue: string | number | undefined | null) {
178
+ if (newValue === undefined || newValue === null) {
179
179
  typed.value = ''
180
180
  unmasked.value = ''
181
181
  return
@@ -98,10 +98,10 @@ export default {
98
98
  v-model="localModelValue"
99
99
  type="radio"
100
100
  class="vv-radio__input"
101
- :name="name"
101
+ :name
102
102
  :disabled="isDisabled"
103
103
  :value="hasValue"
104
- :tabindex="tabindex"
104
+ :tabindex
105
105
  :aria-invalid="isInvalid"
106
106
  :aria-describedby="hasHintLabelOrSlot ? hasHintId : undefined"
107
107
  :aria-errormessage="hasInvalidLabelOrSlot ? hasHintId : undefined"
@@ -43,6 +43,7 @@ const bemCssClasses = useModifiers(
43
43
  computed(() => ({
44
44
  disabled: disabled.value,
45
45
  readonly: readonly.value,
46
+ required: props.required,
46
47
  horizontal: !vertical.value,
47
48
  valid: valid.value,
48
49
  invalid: invalid.value,
@@ -56,6 +57,7 @@ function getOptionProps(option: string | Option, index: number) {
56
57
  name: props.name,
57
58
  label: getOptionLabel(option),
58
59
  value: getOptionValue(option),
60
+ required: props.required,
59
61
  }
60
62
  }
61
63
 
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import type { TextareaHTMLAttributes } from 'vue'
3
+ import { VvTextareaEvents, VvTextareaProps } from '.'
3
4
  import HintSlotFactory from '../common/HintSlot'
4
5
  import VvIcon from '../VvIcon/VvIcon.vue'
5
- import { VvTextareaEvents, VvTextareaProps } from '.'
6
6
 
7
7
  // props, emit and slots
8
8
  const props = defineProps(VvTextareaProps)
@@ -1,4 +1,3 @@
1
- import type { PropType } from 'vue'
2
1
  import type { VvIconProps } from '@/components/VvIcon'
3
2
  import type {
4
3
  AutoPlacementOptions,
@@ -9,6 +8,7 @@ import type {
9
8
  } from '@/types/floating-ui'
10
9
  import type { Option } from '@/types/generic'
11
10
  import type { NavItem } from '@/types/nav'
11
+ import type { PropType } from 'vue'
12
12
  import {
13
13
  ActionTag,
14
14
  ButtonType,
@@ -493,6 +493,7 @@ export const CheckboxRadioGroupProps = {
493
493
  ...ModifiersProps,
494
494
  ...LabelProps,
495
495
  ...LoadingProps,
496
+ ...RequiredProps,
496
497
  /**
497
498
  * Input value
498
499
  */
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import VvInputText from '@/components/VvInputText/VvInputText.vue'
3
3
  import { Position } from '@/constants'
4
4
  import { argTypes, defaultArgs } from './InputText.settings'
5
- import { defaultTest } from './InputText.test'
5
+ import { checkNullTest, checkUndefinedTest, defaultTest } from './InputText.test'
6
6
 
7
7
  const meta: Meta<typeof VvInputText> = {
8
8
  title: 'Components/InputText',
@@ -39,6 +39,42 @@ export const Default: Story = {
39
39
  play: defaultTest,
40
40
  }
41
41
 
42
+ export const Null: Story = {
43
+ args: {
44
+ ...defaultArgs,
45
+ },
46
+ render: args => ({
47
+ components: { VvInputText },
48
+ setup() {
49
+ return { args }
50
+ },
51
+ data: () => ({ inputValue: null, maskedInputValue: undefined }),
52
+ template: /* html */ `
53
+ <vv-input-text v-bind="args" v-model="inputValue" v-model:masked="maskedInputValue" :data-testData="inputValue" data-testId="element" />
54
+ <div>Value: <span data-testId="value">{{ JSON.stringify(inputValue) }}</span></div>
55
+ `,
56
+ }),
57
+ play: checkNullTest,
58
+ }
59
+
60
+ export const Undefined: Story = {
61
+ args: {
62
+ ...defaultArgs,
63
+ },
64
+ render: args => ({
65
+ components: { VvInputText },
66
+ setup() {
67
+ return { args }
68
+ },
69
+ data: () => ({ inputValue: undefined, maskedInputValue: undefined }),
70
+ template: /* html */ `
71
+ <vv-input-text v-bind="args" v-model="inputValue" v-model:masked="maskedInputValue" :data-testData="inputValue" data-testId="element" />
72
+ <div>Value: <span data-testId="value">{{ inputValue === undefined ? 'undefined' : inputValue }}</span></div>
73
+ `,
74
+ }),
75
+ play: checkUndefinedTest,
76
+ }
77
+
42
78
  export const Disabled: Story = {
43
79
  ...Default,
44
80
  args: {
@@ -49,6 +49,24 @@ function valueByType(type: InputType, mask?: string, id?: string) {
49
49
  }
50
50
  }
51
51
 
52
+ export async function checkNullTest({ canvasElement }: PlayAttributes) {
53
+ const element = await within(canvasElement).findByTestId('element')
54
+ const value = await within(canvasElement).findByTestId('value')
55
+ const input = element.getElementsByTagName('input')[0]
56
+
57
+ await expect(input).toHaveProperty('value', '')
58
+ await expect(value.innerHTML).toEqual('null')
59
+ }
60
+
61
+ export async function checkUndefinedTest({ canvasElement }: PlayAttributes) {
62
+ const element = await within(canvasElement).findByTestId('element')
63
+ const value = await within(canvasElement).findByTestId('value')
64
+ const input = element.getElementsByTagName('input')[0]
65
+
66
+ await expect(input).toHaveProperty('value', '')
67
+ await expect(value.innerHTML).toEqual('undefined')
68
+ }
69
+
52
70
  export async function defaultTest({ canvasElement, args }: PlayAttributes) {
53
71
  const element = await within(canvasElement).findByTestId('element')
54
72
  const value = await within(canvasElement).findByTestId('value')
@@ -31,7 +31,7 @@ export const Default: Story = {
31
31
  <template #after v-if="args.after"><div class="flex" v-html="args.after"></div></template>
32
32
  <template #hint v-if="args.hint"><span v-html="args.hint"></span></template>
33
33
  </vv-textarea>
34
- <div>Value: <span data-testId="value">{{inputValue}}</span></div>
34
+ <div>Value: <span data-testId="value">{{ inputValue }}</span></div>
35
35
  `,
36
36
  }),
37
37
  play: defaultTest,