@weni/unnnic-system 2.13.0 → 2.13.1

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 (41) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +56 -19
  3. package/dist/style.css +1 -1
  4. package/dist/unnnic.mjs +4546 -4471
  5. package/dist/unnnic.umd.js +19 -19
  6. package/package.json +1 -1
  7. package/src/components/Alert/Alert.vue +2 -0
  8. package/src/components/Alert/AlertBanner.vue +2 -0
  9. package/src/components/Alert/Version1dot1.vue +1 -0
  10. package/src/components/Alert/__tests__/Alert.spec.js +84 -0
  11. package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
  12. package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
  13. package/src/components/Alert/__tests__/Version1dot1.spec.js +124 -0
  14. package/src/components/AudioRecorder/AudioRecorder.vue +30 -1
  15. package/src/components/AvatarIcon/__tests__/AvatarIcon.spec.js +84 -0
  16. package/src/components/AvatarIcon/__tests__/__snapshots__/AvatarIcon.spec.js.snap +7 -0
  17. package/src/components/Breadcrumb/Breadcrumb.vue +4 -0
  18. package/src/components/Breadcrumb/__tests__/Breadcrumb.spec.js +68 -0
  19. package/src/components/FormElement/FormElement.vue +101 -28
  20. package/src/components/Input/BaseInput.vue +30 -38
  21. package/src/components/Input/Input.scss +43 -0
  22. package/src/components/Input/TextInput.vue +24 -25
  23. package/src/components/Input/__test__/TextInput.spec.js +2 -2
  24. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +1 -1
  25. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
  26. package/src/components/Pagination/Pagination.vue +23 -4
  27. package/src/components/Pagination/__tests__/Pagination.spec.js +208 -0
  28. package/src/components/SelectSmart/SelectSmart.vue +16 -44
  29. package/src/components/SelectSmart/SelectSmartMultipleHeader.vue +5 -13
  30. package/src/components/SelectSmart/SelectSmartOption.vue +13 -9
  31. package/src/components/SkeletonLoading/SkeletonLoading.vue +17 -11
  32. package/src/components/SkeletonLoading/__tests__/SkeletonLoading.spec.js +125 -0
  33. package/src/components/TextArea/TextArea.vue +45 -128
  34. package/src/components/TextArea/__test__/TextArea.spec.js +26 -24
  35. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +4 -4
  36. package/src/stories/Input.mdx +76 -0
  37. package/src/stories/Input.stories.js +82 -8
  38. package/src/stories/SelectSmart.mdx +15 -17
  39. package/src/stories/SelectSmart.stories.js +72 -6
  40. package/src/stories/TextArea.mdx +68 -0
  41. package/src/stories/TextArea.stories.js +68 -6
@@ -1,14 +1,18 @@
1
1
  <template>
2
- <div :class="['unnnic-text-area', { disabled }, size, type]">
3
- <div
4
- v-if="label"
5
- class="label"
6
- >
7
- {{ label }}
8
- </div>
9
-
2
+ <UnnnicFormElement
3
+ :label="label"
4
+ :size="size"
5
+ :disabled="disabled"
6
+ :message="message"
7
+ :error="errors.join(', ') || type === 'error'"
8
+ >
10
9
  <textarea
11
10
  ref="textarea"
11
+ class="unnnic-text-area__textarea"
12
+ :class="[
13
+ `unnnic-text-area__textarea--size-${size}`,
14
+ `unnnic-text-area__textarea--type-${type}`,
15
+ ]"
12
16
  :placeholder="placeholder"
13
17
  :maxlength="maxLength"
14
18
  :disabled="disabled"
@@ -16,28 +20,22 @@
16
20
  @input="$emit('update:modelValue', $event.target.value)"
17
21
  ></textarea>
18
22
 
19
- <div
20
- v-if="maxLength && type === 'normal'"
21
- class="helper"
23
+ <template
24
+ v-if="maxLength"
25
+ #rightMessage
26
+ >{{ modelValue.length }}/{{ maxLength }}</template
22
27
  >
23
- {{ modelValue.length }}/{{ maxLength }}
24
- </div>
25
- <div
26
- v-if="type === 'error'"
27
- class="error-list"
28
- >
29
- <span
30
- v-for="(error, index) in errors"
31
- :key="index"
32
- >
33
- {{ error }}
34
- </span>
35
- </div>
36
- </div>
28
+ </UnnnicFormElement>
37
29
  </template>
38
30
 
39
31
  <script>
32
+ import UnnnicFormElement from '../FormElement/FormElement.vue';
33
+
40
34
  export default {
35
+ components: {
36
+ UnnnicFormElement,
37
+ },
38
+
41
39
  props: {
42
40
  size: {
43
41
  type: String,
@@ -60,6 +58,11 @@ export default {
60
58
  type: Number,
61
59
  },
62
60
 
61
+ message: {
62
+ type: String,
63
+ default: '',
64
+ },
65
+
63
66
  disabled: {
64
67
  type: Boolean,
65
68
  },
@@ -89,123 +92,37 @@ export default {
89
92
 
90
93
  <style lang="scss" scoped>
91
94
  @import '../../assets/scss/unnnic.scss';
95
+ @import '../Input/Input.scss';
92
96
 
93
97
  .unnnic-text-area {
94
- .label {
95
- color: $unnnic-color-neutral-cloudy;
96
- font-family: $unnnic-font-family-secondary;
97
- font-weight: $unnnic-font-weight-regular;
98
- margin-bottom: $unnnic-spacing-stack-nano;
99
- }
100
-
101
- &.md {
102
- .label {
103
- font-size: $unnnic-font-size-body-gt;
104
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
105
- }
106
-
107
- textarea {
108
- font-size: $unnnic-font-size-body-gt;
109
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
110
-
111
- &::placeholder {
112
- font-size: $unnnic-font-size-body-gt;
113
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
114
- }
115
- }
116
- }
117
-
118
- &.sm {
119
- .label {
120
- font-size: $unnnic-font-size-body-md;
121
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
122
- }
123
-
124
- textarea {
125
- font-size: $unnnic-font-size-body-md;
126
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
127
-
128
- &::placeholder {
129
- font-size: $unnnic-font-size-body-md;
130
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
131
- }
132
- }
133
- }
98
+ &__textarea {
99
+ @include input-base;
134
100
 
135
- textarea {
136
- outline: none;
137
- min-height: 6.5 * $unnnic-font-size;
101
+ display: block;
138
102
  width: 100%;
139
103
  resize: vertical;
140
104
  box-sizing: border-box;
141
- padding: $unnnic-spacing-inset-nano;
142
- border-radius: $unnnic-border-radius-sm;
143
- border: $unnnic-border-width-thinner solid $unnnic-color-neutral-cleanest;
144
- background-color: $unnnic-color-neutral-snow;
145
-
146
- color: $unnnic-color-neutral-dark;
147
- font-family: $unnnic-font-family-secondary;
148
- font-weight: $unnnic-font-weight-regular;
149
-
150
- &::placeholder {
151
- color: $unnnic-color-neutral-cleanest;
152
- font-family: $unnnic-font-family-secondary;
153
- font-size: $unnnic-font-size-body-gt;
154
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
155
- font-weight: $unnnic-font-weight-regular;
156
- }
157
105
 
158
- &:focus {
159
- border-color: $unnnic-color-neutral-clean;
160
- }
161
- }
106
+ scrollbar-width: thin;
162
107
 
163
- .helper {
164
- text-align: right;
165
- color: $unnnic-color-neutral-cloudy;
166
- font-family: $unnnic-font-family-secondary;
167
- font-size: $unnnic-font-size-body-md;
168
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
169
- font-weight: $unnnic-font-weight-regular;
170
- margin-top: $unnnic-spacing-stack-nano;
171
- }
108
+ &--size-md {
109
+ @include input-md-font;
172
110
 
173
- &.disabled {
174
- textarea::placeholder {
175
- color: $unnnic-color-neutral-clean;
111
+ min-height: 6.25 * $unnnic-font-size;
112
+ padding: ($unnnic-spacing-ant - $unnnic-border-width-thinner)
113
+ ($unnnic-spacing-sm - $unnnic-border-width-thinner);
176
114
  }
177
- }
178
115
 
179
- &.error {
180
- .label {
181
- color: $unnnic-color-feedback-red;
182
- }
116
+ &--size-sm {
117
+ @include input-sm-font;
183
118
 
184
- textarea {
185
- border-color: $unnnic-color-feedback-red;
186
- &::placeholder {
187
- color: $unnnic-color-feedback-red;
188
- }
119
+ min-height: 5 * $unnnic-font-size;
120
+ padding: ($unnnic-spacing-xs)
121
+ ($unnnic-spacing-sm - $unnnic-border-width-thinner);
189
122
  }
190
123
 
191
- .error-list {
192
- display: flex;
193
- flex-direction: column;
194
- align-items: flex-end;
195
- width: 100%;
196
-
197
- color: $unnnic-color-feedback-red;
198
- font-family: $unnnic-font-family-secondary;
199
- font-size: $unnnic-font-size-body-md;
200
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
201
- font-weight: $unnnic-font-weight-regular;
202
- margin-top: $unnnic-spacing-stack-nano;
203
-
204
- span {
205
- max-width: 100%;
206
- word-wrap: break-word;
207
- text-align: right;
208
- }
124
+ &.unnnic-text-area__textarea--type-error {
125
+ @include input-error;
209
126
  }
210
127
  }
211
128
  }
@@ -29,9 +29,9 @@ describe('TextArea.vue', () => {
29
29
  });
30
30
 
31
31
  test('renders label when provided', () => {
32
- const label = wrapper.find('.label');
33
- expect(label.exists()).toBe(true);
34
- expect(label.text()).toBe('Description');
32
+ expect(
33
+ wrapper.findComponent({ name: 'UnnnicFormElement' }).props('label'),
34
+ ).toBe('Description');
35
35
  });
36
36
 
37
37
  test('renders textarea with correct props', () => {
@@ -42,9 +42,7 @@ describe('TextArea.vue', () => {
42
42
  });
43
43
 
44
44
  test('renders character count when maxLength and type are normal', () => {
45
- const helper = wrapper.find('.helper');
46
- expect(helper.exists()).toBe(true);
47
- expect(helper.text()).toBe('0/200');
45
+ expect(wrapper.text()).contains('0/200');
48
46
  });
49
47
 
50
48
  test('does not render character count when maxLength is not provided', async () => {
@@ -61,22 +59,25 @@ describe('TextArea.vue', () => {
61
59
 
62
60
  test('displays errors when type is error', async () => {
63
61
  await wrapper.setProps({ type: 'error', errors: ['Error 1', 'Error 2'] });
64
- const errorList = wrapper.findAll('.error-list span');
65
- expect(errorList.length).toBe(2);
66
- expect(errorList[0].text()).toBe('Error 1');
67
- expect(errorList[1].text()).toBe('Error 2');
62
+ expect(
63
+ wrapper.findComponent({ name: 'UnnnicFormElement' }).props('error'),
64
+ ).toBe('Error 1, Error 2');
68
65
  });
69
66
 
70
67
  test('applies disabled class and disables textarea when disabled is true', async () => {
71
68
  await wrapper.setProps({ disabled: true });
72
- expect(wrapper.classes()).toContain('disabled');
69
+ expect(
70
+ wrapper.findComponent({ name: 'UnnnicFormElement' }).props('disabled'),
71
+ ).toBe(true);
73
72
  const textarea = wrapper.find('textarea');
74
73
  expect(textarea.element.disabled).toBe(true);
75
74
  });
76
75
 
77
76
  test('applies the correct size class', async () => {
78
77
  await wrapper.setProps({ size: 'sm' });
79
- expect(wrapper.classes()).toContain('sm');
78
+ expect(wrapper.find('textarea').classes()).toContain(
79
+ 'unnnic-text-area__textarea--size-sm',
80
+ );
80
81
  });
81
82
 
82
83
  test('focus method focuses the textarea element', () => {
@@ -97,8 +98,7 @@ describe('TextArea.vue', () => {
97
98
 
98
99
  test('updates character count on input when maxLength is provided', async () => {
99
100
  await wrapper.setProps({ modelValue: 'Hello' });
100
- const helper = wrapper.find('.helper');
101
- expect(helper.text()).toBe('5/200');
101
+ expect(wrapper.text()).contains('5/200');
102
102
  });
103
103
 
104
104
  test('does not render label when not provided', async () => {
@@ -109,7 +109,9 @@ describe('TextArea.vue', () => {
109
109
 
110
110
  test('applies correct class when type is "error"', async () => {
111
111
  await wrapper.setProps({ type: 'error' });
112
- expect(wrapper.classes()).toContain('error');
112
+ expect(wrapper.find('textarea').classes()).toContain(
113
+ 'unnnic-text-area__textarea--type-error',
114
+ );
113
115
  });
114
116
 
115
117
  test('does not emit input when disabled', async () => {
@@ -128,11 +130,15 @@ describe('TextArea.vue', () => {
128
130
 
129
131
  test('applies correct class when size is "sm"', async () => {
130
132
  await wrapper.setProps({ size: 'sm' });
131
- expect(wrapper.classes()).toContain('sm');
133
+ expect(wrapper.find('textarea').classes()).toContain(
134
+ 'unnnic-text-area__textarea--size-sm',
135
+ );
132
136
  });
133
137
 
134
138
  test('applies correct class when size is "md"', () => {
135
- expect(wrapper.classes()).toContain('md');
139
+ expect(wrapper.find('textarea').classes()).toContain(
140
+ 'unnnic-text-area__textarea--size-md',
141
+ );
136
142
  });
137
143
 
138
144
  test('validates type prop', () => {
@@ -181,11 +187,8 @@ describe('TextArea.vue', () => {
181
187
  test('renders all error messages when type is error', async () => {
182
188
  const errors = ['Error 1', 'Error 2', 'Error 3'];
183
189
  await wrapper.setProps({ type: 'error', errors });
184
- const errorMessages = wrapper.findAll('.error-list span');
185
- expect(errorMessages).toHaveLength(errors.length);
186
- errorMessages.forEach((msg, index) => {
187
- expect(msg.text()).toBe(errors[index]);
188
- });
190
+ const formElement = wrapper.findComponent({ name: 'UnnnicFormElement' });
191
+ expect(formElement.props('error')).toBe('Error 1, Error 2, Error 3');
189
192
  });
190
193
 
191
194
  test('does not render error list when type is normal', () => {
@@ -195,8 +198,7 @@ describe('TextArea.vue', () => {
195
198
 
196
199
  test('updates character count correctly', async () => {
197
200
  await wrapper.setProps({ modelValue: 'Hello, world!' });
198
- const helper = wrapper.find('.helper');
199
- expect(helper.text()).toBe('13/200');
201
+ expect(wrapper.text()).contains('13/200');
200
202
  });
201
203
 
202
204
  test('focus method focuses the textarea', async () => {
@@ -1,9 +1,9 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`TextArea.vue > matches the snapshot 1`] = `
4
- "<div data-v-735b3c51="" class="unnnic-text-area md normal">
5
- <div data-v-735b3c51="" class="label">Description</div><textarea data-v-735b3c51="" placeholder="Enter text" maxlength="200"></textarea>
6
- <div data-v-735b3c51="" class="helper">0/200</div>
4
+ "<section data-v-9f8d6c86="" data-v-735b3c51="" class="unnnic-form-element">
5
+ <p data-v-9f8d6c86="" class="unnnic-form-element__label">Description</p><textarea data-v-735b3c51="" class="unnnic-text-area__textarea unnnic-text-area__textarea--size-md unnnic-text-area__textarea--type-normal" placeholder="Enter text" maxlength="200"></textarea>
7
6
  <!--v-if-->
8
- </div>"
7
+ <p data-v-9f8d6c86="" class="unnnic-form-element__message"> <span data-v-9f8d6c86="" class="unnnic-form-element__right-message">0/200</span></p>
8
+ </section>"
9
9
  `;
@@ -0,0 +1,76 @@
1
+ import { Meta, Source, Story } from '@storybook/blocks';
2
+
3
+ import * as InputStories from './Input.stories';
4
+
5
+ <Meta of={InputStories}/>
6
+
7
+ # Input
8
+
9
+ The `Input` component is designed to provide an input field for users to enter texts or passwords.
10
+
11
+ <Source
12
+ language='html'
13
+ dark
14
+ code={`<UnnnicFormElement
15
+ label="Label"
16
+ message="Helper text" | error="Error text"
17
+ :disabled="false | true"
18
+ >
19
+ <UnnnicInput
20
+ v-model="value"
21
+ size="md"
22
+ type="normal"
23
+ nativeType="normal"
24
+ placeholder="Placeholder"
25
+ iconLeft="storefront"
26
+ iconRight="storefront"
27
+ />
28
+ </UnnnicFormElement>`}
29
+ />
30
+
31
+
32
+ ---
33
+
34
+ #### **Props Options:**
35
+
36
+ | Key | Description | Values | Default |
37
+ |-------------|------------------------------------------|--------------------------|-------------|
38
+ | v-model | `String` of the input content | `''` | `''` |
39
+ | size | `String` of the size | `'md'` \| `'sm'` | `md` |
40
+ | type | `String` of the input type | `'normal'` \| `'error'` | `'normal'` |
41
+ | nativeType | `String` of the native input type | `'text'` \| `'password'` | `'text'` |
42
+ | placeholder | `String` of the native input placeholder | `String` | `''` |
43
+ | iconLeft | `String` of the left icon | `String` | `undefined` |
44
+ | iconRight | `String` of the right icon | `String` | `false` |
45
+
46
+ ## Example
47
+ Some examples of uses of the `UnnnicInput`
48
+
49
+ ### Normal
50
+
51
+ <Story of={InputStories.Normal} />
52
+
53
+
54
+ ### Error
55
+
56
+ <Story of={InputStories.Error} />
57
+
58
+
59
+ ### Disabled
60
+
61
+ <Story of={InputStories.Disabled} />
62
+
63
+
64
+ ### Normal (small size)
65
+
66
+ <Story of={InputStories.NormalSm} />
67
+
68
+
69
+ ### Error (small size)
70
+
71
+ <Story of={InputStories.ErrorSm} />
72
+
73
+
74
+ ### Disabled (small size)
75
+
76
+ <Story of={InputStories.DisabledSm} />
@@ -1,3 +1,4 @@
1
+ import unnnicFormElement from '../components/FormElement/FormElement.vue';
1
2
  import unnnicInput from '../components/Input/Input.vue';
2
3
  import iconList from '../utils/iconList';
3
4
 
@@ -18,6 +19,7 @@ export default {
18
19
  render: (args) => ({
19
20
  components: {
20
21
  unnnicInput,
22
+ unnnicFormElement,
21
23
  },
22
24
  setup() {
23
25
  return { args };
@@ -33,11 +35,63 @@ export default {
33
35
  },
34
36
  },
35
37
  template: `
36
- <div><pre>v-model: {{ value }}</pre><unnnic-input v-model="value" @icon-right-click="click" v-bind="args" /></div>
38
+ <unnnic-form-element label="Label" message="Helper text">
39
+ <unnnic-input v-model="value" @icon-right-click="click" v-bind="args" />
40
+ </unnnic-form-element>
37
41
  `,
38
42
  }),
39
43
  };
40
44
 
45
+ const TemplateError = (args, { argTypes }) => ({
46
+ props: Object.keys(argTypes),
47
+
48
+ components: {
49
+ unnnicFormElement,
50
+ unnnicInput,
51
+ },
52
+
53
+ setup() {
54
+ return { args };
55
+ },
56
+
57
+ data() {
58
+ return {
59
+ value: '',
60
+ };
61
+ },
62
+
63
+ template: `
64
+ <unnnic-form-element label="Label" error="Error text">
65
+ <unnnic-input v-model="value" v-bind="args"/>
66
+ </unnnic-form-element>
67
+ `,
68
+ });
69
+
70
+ const TemplateDisabled = (args, { argTypes }) => ({
71
+ props: Object.keys(argTypes),
72
+
73
+ components: {
74
+ unnnicFormElement,
75
+ unnnicInput,
76
+ },
77
+
78
+ setup() {
79
+ return { args };
80
+ },
81
+
82
+ data() {
83
+ return {
84
+ value: '',
85
+ };
86
+ },
87
+
88
+ template: `
89
+ <unnnic-form-element label="Label" message="Helper text" disabled>
90
+ <unnnic-input v-model="value" v-bind="args"/>
91
+ </unnnic-form-element>
92
+ `,
93
+ });
94
+
41
95
  export const Normal = {
42
96
  args: {
43
97
  type: 'normal',
@@ -45,18 +99,38 @@ export const Normal = {
45
99
  },
46
100
  };
47
101
 
48
- export const Error = {
102
+ export const NormalSm = {
49
103
  args: {
50
- type: 'error',
104
+ size: 'sm',
105
+ type: 'normal',
51
106
  placeholder: 'Placeholder',
52
107
  },
53
108
  };
54
109
 
55
- export const Disabled = {
56
- args: {
57
- disabled: true,
58
- placeholder: 'Placeholder',
59
- },
110
+ export const Error = TemplateError.bind({});
111
+ Error.args = {
112
+ type: 'error',
113
+ placeholder: 'Placeholder',
114
+ };
115
+
116
+ export const ErrorSm = TemplateError.bind({});
117
+ ErrorSm.args = {
118
+ size: 'sm',
119
+ type: 'error',
120
+ placeholder: 'Placeholder',
121
+ };
122
+
123
+ export const Disabled = TemplateDisabled.bind({});
124
+ Disabled.args = {
125
+ disabled: true,
126
+ placeholder: 'Placeholder',
127
+ };
128
+
129
+ export const DisabledSm = TemplateDisabled.bind({});
130
+ DisabledSm.args = {
131
+ size: 'sm',
132
+ disabled: true,
133
+ placeholder: 'Placeholder',
60
134
  };
61
135
 
62
136
  export const Password = {
@@ -43,23 +43,21 @@ The other one required property is `options`, which requires an array of objects
43
43
  <Source
44
44
  language='json'
45
45
  dark
46
- code={`
47
- [
48
- {
49
- "value": "",
50
- "label": "Select some option" <---- Since the value of this object is empty, this will be the placeholder
51
- },
52
- {
53
- "value": "1",
54
- "label": "Option 1",
55
- },
56
- {
57
- "value": "2",
58
- "label": "Option 2",
59
- "description": "This is the first option"
60
- },
61
- ]
62
- `}
46
+ code={`[
47
+ {
48
+ "value": "",
49
+ "label": "Select some option" <---- Since the value of this object is empty, this will be the placeholder
50
+ },
51
+ {
52
+ "value": "1",
53
+ "label": "Option 1",
54
+ },
55
+ {
56
+ "value": "2",
57
+ "label": "Option 2",
58
+ "description": "This is the first option"
59
+ },
60
+ ]`}
63
61
  />
64
62
 
65
63
  > The options will be presented in alphabetical order, following the value of each `label`,
@@ -1,3 +1,4 @@
1
+ import unnnicFormElement from '../components/FormElement/FormElement.vue';
1
2
  import unnnicSelectSmart from '../components/SelectSmart/SelectSmart.vue';
2
3
 
3
4
  export default {
@@ -6,6 +7,7 @@ export default {
6
7
  argTypes: {},
7
8
  render: (args) => ({
8
9
  components: {
10
+ unnnicFormElement,
9
11
  unnnicSelectSmart,
10
12
  },
11
13
  setup() {
@@ -17,11 +19,61 @@ export default {
17
19
  };
18
20
  },
19
21
  template: `
20
- <unnnicSelectSmart v-bind="args" v-model="exampleValue"/>
22
+ <unnnicFormElement label="Label" message="Helper text">
23
+ <unnnicSelectSmart v-bind="args" v-model="exampleValue"/>
24
+ </unnnicFormElement>
21
25
  `,
22
26
  }),
23
27
  };
24
28
 
29
+ const TemplateError = (args, { argTypes }) => ({
30
+ props: Object.keys(argTypes),
31
+
32
+ components: {
33
+ unnnicFormElement,
34
+ unnnicSelectSmart,
35
+ },
36
+
37
+ setup() {
38
+ return { args };
39
+ },
40
+ data() {
41
+ return {
42
+ exampleValue: [],
43
+ };
44
+ },
45
+
46
+ template: `
47
+ <unnnicFormElement label="Label" error="Error text">
48
+ <unnnicSelectSmart v-bind="args" v-model="exampleValue"/>
49
+ </unnnicFormElement>
50
+ `,
51
+ });
52
+
53
+ const TemplateDisabled = (args, { argTypes }) => ({
54
+ props: Object.keys(argTypes),
55
+
56
+ components: {
57
+ unnnicFormElement,
58
+ unnnicSelectSmart,
59
+ },
60
+
61
+ setup() {
62
+ return { args };
63
+ },
64
+ data() {
65
+ return {
66
+ exampleValue: [],
67
+ };
68
+ },
69
+
70
+ template: `
71
+ <unnnicFormElement label="Label" message="Helper text" disabled>
72
+ <unnnicSelectSmart v-bind="args" v-model="exampleValue"/>
73
+ </unnnicFormElement>
74
+ `,
75
+ });
76
+
25
77
  export const Default = {
26
78
  args: {
27
79
  options: [
@@ -62,11 +114,25 @@ export const OrderedByIndex = {
62
114
  },
63
115
  };
64
116
 
65
- export const Disabled = {
66
- args: {
67
- options: [{ value: '', label: 'Select some option' }],
68
- disabled: true,
69
- },
117
+ export const Error = TemplateError.bind({});
118
+ Error.args = {
119
+ type: 'error',
120
+ options: [
121
+ { value: '', label: 'Select some option' },
122
+ { value: '5', label: 'Option 5' },
123
+ { value: '3', label: 'Option 3' },
124
+ { value: '1', label: 'Option 1' },
125
+ { value: '4', label: 'Option 4' },
126
+ { value: '2', label: 'Option 2' },
127
+ { value: '6', label: 'Option 6' },
128
+ { value: '7', label: 'Option 7' },
129
+ ],
130
+ };
131
+
132
+ export const Disabled = TemplateDisabled.bind({});
133
+ Disabled.args = {
134
+ options: [{ value: '', label: 'Select some option' }],
135
+ disabled: true,
70
136
  };
71
137
 
72
138
  export const WithDescriptions = {