srcdev-nuxt-forms 2.1.12 → 2.1.14

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 (51) hide show
  1. package/assets/styles/forms/themes/_error.css +14 -0
  2. package/assets/styles/forms/themes/_ghost.css +24 -10
  3. package/assets/styles/forms/themes/_primary.css +15 -1
  4. package/assets/styles/forms/themes/_secondary.css +14 -0
  5. package/assets/styles/forms/themes/_success.css +14 -0
  6. package/assets/styles/forms/themes/_tertiary.css +14 -0
  7. package/assets/styles/forms/themes/_warning.css +14 -0
  8. package/assets/styles/forms/variables/_theme.css +3 -0
  9. package/assets/styles/main.css +1 -0
  10. package/assets/styles/typography/index.css +2 -0
  11. package/assets/styles/{variables/_typography.css → typography/utils/_classes.css} +0 -16
  12. package/assets/styles/typography/utils/_weights.css +69 -0
  13. package/assets/styles/typography/utils/index.css +2 -0
  14. package/assets/styles/typography/variables/_reponsive-font-size.css +10 -0
  15. package/assets/styles/typography/variables/index.css +2 -0
  16. package/assets/styles/variables/index.css +1 -3
  17. package/components/forms/c12/prop-validators/index.ts +24 -1
  18. package/components/forms/form-errors/InputError.vue +7 -3
  19. package/components/forms/form-errors/stories/InputError.stories.ts +36 -0
  20. package/components/forms/form-errors/tests/InputError.spec.ts +67 -0
  21. package/components/forms/input-button/InputButtonCore.vue +7 -5
  22. package/components/forms/input-button/stories/InputButtonCore.mdx +8 -0
  23. package/components/forms/input-button/stories/InputButtonCore.stories.ts +65 -0
  24. package/components/forms/input-button/variants/InputButtonConfirm.vue +5 -5
  25. package/components/forms/input-button/variants/InputButtonSubmit.vue +4 -16
  26. package/components/forms/input-checkbox/variants/MultipleCheckboxes.vue +39 -6
  27. package/components/forms/input-checkbox/variants/SingleCheckbox.vue +3 -3
  28. package/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +130 -0
  29. package/components/forms/{input-checkbox/InputCheckboxCore.vue → input-checkbox-radio/InputCheckboxRadioCore.vue} +46 -14
  30. package/components/forms/{input-checkbox/InputCheckboxWithLabel.vue → input-checkbox-radio/InputCheckboxRadioWithLabel.vue} +12 -8
  31. package/components/forms/input-number/variants/InputNumberDefault.vue +1 -1
  32. package/components/forms/input-radio/variants/MultipleRadiobuttons.vue +39 -4
  33. package/components/forms/input-range/InputRangeCore.vue +32 -0
  34. package/components/forms/input-range/variants/InputRangeDefault.vue +1 -1
  35. package/components/forms/input-range-fancy/InputRangeFancyCore.vue +462 -0
  36. package/components/forms/input-range-fancy/InputRangeFancyWithLabel.vue +124 -0
  37. package/components/forms/input-text/InputTextCore.vue +5 -1
  38. package/components/forms/input-text/stories/InputTextCore.mdx +8 -0
  39. package/components/forms/input-text/stories/InputTextCore.stories.ts +59 -0
  40. package/components/forms/input-text/variants/{material/InputPasswordWithLabel.vue → InputPasswordWithLabel.vue} +1 -1
  41. package/components/forms/input-text/variants/{material/InputTextAsNumberWithLabel.vue → InputTextAsNumberWithLabel.vue} +2 -2
  42. package/components/forms/input-text/variants/{material/InputTextWithLabel.vue → InputTextWithLabel.vue} +2 -2
  43. package/components/forms/input-text/variants/stories/InputPasswordWithLabel.mdx +8 -0
  44. package/components/forms/input-text/variants/stories/InputPasswordWithLabel.stories.ts +60 -0
  45. package/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +1 -1
  46. package/nuxt.config.ts +11 -4
  47. package/package.json +17 -4
  48. package/components/forms/input-radio/InputRadiobuttonCore.vue +0 -170
  49. package/components/forms/input-radio/InputRadiobuttonWithLabel.vue +0 -93
  50. /package/assets/styles/{variables/_default.css → typography/variables/_colors.css} +0 -0
  51. /package/assets/styles/variables/colors/{index.css → colors.css} +0 -0
@@ -26,6 +26,20 @@
26
26
  --theme-form-radio-symbol: var(--red-12);
27
27
 
28
28
  --theme-form-range-accent-color: light-dark(var(--red-12), var(--red-3));
29
+
30
+ /*
31
+ * Checkbox as button
32
+ **/
33
+
34
+ --theme-checkbox-radio-button-bg-default: light-dark(var(--red-4), var(--red-4));
35
+
36
+ --theme-checkbox-radio-button-border-default: light-dark(var(--red-12), var(--red-12));
37
+ --theme-checkbox-radio-button-border-width: 1px;
38
+
39
+ --theme-checkbox-radio-button-outline-default: light-dark(var(--red-5), var(--red-5));
40
+ --theme-checkbox-radio-button-outline-width: 1px;
41
+
42
+ --theme-checkbox-radio-button-label-default: light-dark(var(--red-12), var(--red-12));
29
43
  }
30
44
 
31
45
  [data-btn-theme='error'] {
@@ -26,23 +26,37 @@
26
26
  --theme-form-radio-symbol: var(--gray-12);
27
27
 
28
28
  --theme-form-range-accent-color: light-dark(var(--gray-12), var(--gray-3));
29
+
30
+ /*
31
+ * Checkbox as button
32
+ **/
33
+
34
+ --theme-checkbox-radio-button-bg-default: light-dark(var(--gray-4), var(--gray-4));
35
+
36
+ --theme-checkbox-radio-button-border-default: light-dark(var(--gray-12), var(--gray-12));
37
+ --theme-checkbox-radio-button-border-width: 1px;
38
+
39
+ --theme-checkbox-radio-button-outline-default: light-dark(var(--gray-5), var(--gray-5));
40
+ --theme-checkbox-radio-button-outline-width: 1px;
41
+
42
+ --theme-checkbox-radio-button-label-default: light-dark(var(--gray-12), var(--gray-12));
29
43
  }
30
44
 
31
45
  [data-btn-theme='ghost'] {
32
- --theme-btn-bg: var(--gray-12);
46
+ --theme-btn-bg: transparent;
33
47
  --theme-btn-border: var(--gray-0);
34
48
  --theme-btn-outline: var(--gray-12);
35
- --theme-btn-text: var(--gray-0);
49
+ --theme-btn-text: light-dark(var(--gray-12), var(--gray-0));
36
50
 
37
- --theme-btn-bg-hover: var(--gray-0);
38
- --theme-btn-border-hover: var(--gray-12);
39
- --theme-btn-outline-hover: var(--gray-0);
40
- --theme-btn-text-hover: var(--gray-12);
51
+ --theme-btn-bg-hover: light-dark(var(--gray-2), var(--gray-8));
52
+ --theme-btn-border-hover: light-dark(var(--gray-12), var(--gray-0));
53
+ --theme-btn-outline-hover: light-dark(var(--gray-12), var(--gray-0));
54
+ --theme-btn-text-hover: light-dark(var(--gray-12), var(--gray-0));
41
55
 
42
- --theme-btn-bg-focus: var(--gray-0);
43
- --theme-btn-border-focus: var(--gray-12);
44
- --theme-btn-outline-focus: var(--gray-0);
45
- --theme-btn-text-focus: var(--gray-12);
56
+ --theme-btn-bg-focus: light-dark(var(--gray-2), var(--gray-8));
57
+ --theme-btn-border-focus: light-dark(var(--gray-12), var(--gray-0));
58
+ --theme-btn-outline-focus: light-dark(var(--gray-12), var(--gray-0));
59
+ --theme-btn-text-focus: light-dark(var(--gray-12), var(--gray-0));
46
60
 
47
61
  --theme-form-focus-box-shadow: 1px 1px 8px 1px light-dark(var(--gray-12), var(--gray-2));
48
62
  }
@@ -25,7 +25,21 @@
25
25
  --theme-form-radio-shadow-focus: var(--blue-6);
26
26
  --theme-form-radio-symbol: var(--blue-12);
27
27
 
28
- --theme-form-range-accent-color: light-dark(var(--blue-12), var(--blue-3));
28
+ --theme-form-range-accent-color: light-dark(var(--blue-12), var(--blue-));
29
+
30
+ /*
31
+ * Checkbox as button
32
+ **/
33
+
34
+ --theme-checkbox-radio-button-bg-default: light-dark(var(--blue-4), var(--blue-4));
35
+
36
+ --theme-checkbox-radio-button-border-default: light-dark(var(--blue-12), var(--blue-12));
37
+ --theme-checkbox-radio-button-border-width: 1px;
38
+
39
+ --theme-checkbox-radio-button-outline-default: light-dark(var(--blue-5), var(--blue-5));
40
+ --theme-checkbox-radio-button-outline-width: 1px;
41
+
42
+ --theme-checkbox-radio-button-label-default: light-dark(var(--blue-12), var(--blue-12));
29
43
  }
30
44
 
31
45
  [data-btn-theme='primary'] {
@@ -26,6 +26,20 @@
26
26
  --theme-form-radio-symbol: var(--gray-12);
27
27
 
28
28
  --theme-form-range-accent-color: light-dark(var(--gray-12), var(--gray-3));
29
+
30
+ /*
31
+ * Checkbox as button
32
+ **/
33
+
34
+ --theme-checkbox-radio-button-bg-default: light-dark(var(--gray-4), var(--gray-4));
35
+
36
+ --theme-checkbox-radio-button-border-default: light-dark(var(--gray-12), var(--gray-12));
37
+ --theme-checkbox-radio-button-border-width: 1px;
38
+
39
+ --theme-checkbox-radio-button-outline-default: light-dark(var(--gray-5), var(--gray-5));
40
+ --theme-checkbox-radio-button-outline-width: 1px;
41
+
42
+ --theme-checkbox-radio-button-label-default: light-dark(var(--gray-12), var(--gray-12));
29
43
  }
30
44
 
31
45
  [data-btn-theme='secondary'] {
@@ -26,6 +26,20 @@
26
26
  --theme-form-radio-symbol: var(--green-12);
27
27
 
28
28
  --theme-form-range-accent-color: light-dark(var(--green-12), var(--green-3));
29
+
30
+ /*
31
+ * Checkbox as button
32
+ **/
33
+
34
+ --theme-checkbox-radio-button-bg-default: light-dark(var(--green-4), var(--green-4));
35
+
36
+ --theme-checkbox-radio-button-border-default: light-dark(var(--green-12), var(--green-12));
37
+ --theme-checkbox-radio-button-border-width: 1px;
38
+
39
+ --theme-checkbox-radio-button-outline-default: light-dark(var(--green-5), var(--green-5));
40
+ --theme-checkbox-radio-button-outline-width: 1px;
41
+
42
+ --theme-checkbox-radio-button-label-default: light-dark(var(--green-12), var(--green-12));
29
43
  }
30
44
 
31
45
  [data-btn-theme='success'] {
@@ -26,6 +26,20 @@
26
26
  --theme-form-radio-symbol: var(--gray-12);
27
27
 
28
28
  --theme-form-range-accent-color: light-dark(var(--gray-12), var(--gray-3));
29
+
30
+ /*
31
+ * Checkbox as button
32
+ **/
33
+
34
+ --theme-checkbox-radio-button-bg-default: light-dark(var(--green-4), var(--green-4));
35
+
36
+ --theme-checkbox-radio-button-border-default: light-dark(var(--green-12), var(--green-12));
37
+ --theme-checkbox-radio-button-border-width: 1px;
38
+
39
+ --theme-checkbox-radio-button-outline-default: light-dark(var(--green-5), var(--green-5));
40
+ --theme-checkbox-radio-button-outline-width: 1px;
41
+
42
+ --theme-checkbox-radio-button-label-default: light-dark(var(--green-12), var(--green-12));
29
43
  }
30
44
 
31
45
  [data-btn-theme='tertiary'] {
@@ -26,6 +26,20 @@
26
26
  --theme-form-radio-symbol: var(--orange-12);
27
27
 
28
28
  --theme-form-range-accent-color: light-dark(var(--orange-12), var(--orange-3));
29
+
30
+ /*
31
+ * Checkbox as button
32
+ **/
33
+
34
+ --theme-checkbox-radio-button-bg-default: light-dark(var(--orange-4), var(--orange-4));
35
+
36
+ --theme-checkbox-radio-button-border-default: light-dark(var(--orange-12), var(--orange-12));
37
+ --theme-checkbox-radio-button-border-width: 1px;
38
+
39
+ --theme-checkbox-radio-button-outline-default: light-dark(var(--orange-5), var(--orange-5));
40
+ --theme-checkbox-radio-button-outline-width: 1px;
41
+
42
+ --theme-checkbox-radio-button-label-default: light-dark(var(--orange-12), var(--orange-12));
29
43
  }
30
44
 
31
45
  [data-btn-theme='warning'] {
@@ -14,6 +14,9 @@
14
14
 
15
15
  --font-family: futura-pt, Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif;
16
16
 
17
+ --theme-error-surface: var(--red-12);
18
+ --theme-error-text: var(--red-0);
19
+
17
20
  --theme-form-button-font-size-x-small: 14px;
18
21
  --theme-form-button-font-size-small: 14px;
19
22
  --theme-form-button-font-size-normal: 16px;
@@ -1,3 +1,4 @@
1
1
  @import './variables';
2
2
  @import './forms';
3
3
  @import './scaffolding';
4
+ @import './typography';
@@ -0,0 +1,2 @@
1
+ @import './utils';
2
+ @import './variables';
@@ -1,18 +1,3 @@
1
- :root {
2
- --step-5: clamp(2.7994rem, 2.4462rem + 1.7658vw, 3.8147rem);
3
- --step-4: clamp(2.3328rem, 2.0827rem + 1.2504vw, 3.0518rem);
4
- --step-3: clamp(1.944rem, 1.771rem + 0.8651vw, 2.4414rem);
5
- --step-2: clamp(1.62rem, 1.5041rem + 0.5793vw, 1.9531rem);
6
- --step-1: clamp(1.35rem, 1.2761rem + 0.3696vw, 1.5625rem);
7
- --step-0: clamp(1.125rem, 1.0815rem + 0.2174vw, 1.25rem);
8
- --step--1: clamp(0.9375rem, 0.9158rem + 0.1087vw, 1rem);
9
- --step--2: clamp(0.7813rem, 0.7747rem + 0.0326vw, 0.8rem);
10
- }
11
-
12
- /* .typography { */
13
- /* font-family: 'Poppins', Sans-serif; */
14
- /* font-family: var(--font-family); */
15
-
16
1
  .heading-1 {
17
2
  font-size: var(--step-5);
18
3
  font-weight: bold;
@@ -173,4 +158,3 @@
173
158
  color: var(--theme-link-default);
174
159
  }
175
160
  }
176
- /* } */
@@ -0,0 +1,69 @@
1
+ /* By numeric step */
2
+ .wght-100 {
3
+ font-weight: 100;
4
+ }
5
+ .wght-200 {
6
+ font-weight: 200;
7
+ }
8
+ .wght-300 {
9
+ font-weight: 300;
10
+ }
11
+ .wght-400 {
12
+ font-weight: 400;
13
+ }
14
+ .wght-500 {
15
+ font-weight: 500;
16
+ }
17
+ .wght-600 {
18
+ font-weight: 600;
19
+ }
20
+ .wght-700 {
21
+ font-weight: 700;
22
+ }
23
+ .wght-800 {
24
+ font-weight: 800;
25
+ }
26
+ .wght-900 {
27
+ font-weight: 900;
28
+ }
29
+
30
+ /* By named weight */
31
+ .light {
32
+ font-weight: light;
33
+ }
34
+ .normal {
35
+ font-weight: normal;
36
+ }
37
+ .bold {
38
+ font-weight: bold;
39
+ }
40
+
41
+ /* Using the font-variation-settings property. */
42
+
43
+ .fvs-wght-100 {
44
+ font-variation-settings: 'wght' 100;
45
+ }
46
+ .fvs-wght-200 {
47
+ font-variation-settings: 'wght' 200;
48
+ }
49
+ .fvs-wght-300 {
50
+ font-variation-settings: 'wght' 300;
51
+ }
52
+ .fvs-wght-400 {
53
+ font-variation-settings: 'wght' 400;
54
+ }
55
+ .fvs-wght-500 {
56
+ font-variation-settings: 'wght' 500;
57
+ }
58
+ .fvs-wght-600 {
59
+ font-variation-settings: 'wght' 600;
60
+ }
61
+ .fvs-wght-700 {
62
+ font-variation-settings: 'wght' 700;
63
+ }
64
+ .fvs-wght-800 {
65
+ font-variation-settings: 'wght' 800;
66
+ }
67
+ .fvs-wght-900 {
68
+ font-variation-settings: 'wght' 900;
69
+ }
@@ -0,0 +1,2 @@
1
+ @import './_classes.css';
2
+ @import './_weights.css';
@@ -0,0 +1,10 @@
1
+ :root {
2
+ --step-5: clamp(2.7994rem, 2.4462rem + 1.7658vw, 3.8147rem);
3
+ --step-4: clamp(2.3328rem, 2.0827rem + 1.2504vw, 3.0518rem);
4
+ --step-3: clamp(1.944rem, 1.771rem + 0.8651vw, 2.4414rem);
5
+ --step-2: clamp(1.62rem, 1.5041rem + 0.5793vw, 1.9531rem);
6
+ --step-1: clamp(1.35rem, 1.2761rem + 0.3696vw, 1.5625rem);
7
+ --step-0: clamp(1.125rem, 1.0815rem + 0.2174vw, 1.25rem);
8
+ --step--1: clamp(0.9375rem, 0.9158rem + 0.1087vw, 1rem);
9
+ --step--2: clamp(0.7813rem, 0.7747rem + 0.0326vw, 0.8rem);
10
+ }
@@ -0,0 +1,2 @@
1
+ @import './_colors.css';
2
+ @import './_reponsive-font-size.css';
@@ -1,3 +1 @@
1
- @import './colors/index.css';
2
- @import './_default.css';
3
- @import './_typography.css';
1
+ @import './colors/colors.css';
@@ -1,6 +1,28 @@
1
1
  export const propValidators = {
2
2
  size: ['x-small', 'small', 'normal', 'medium', 'large'],
3
- weight: ['wght-100', 'wght-200', 'wght-300', 'wght-400', 'wght-500', 'wght-600', 'wght-700', 'wght-800', 'wght-900'],
3
+ weight: [
4
+ 'wght-100',
5
+ 'wght-200',
6
+ 'wght-300',
7
+ 'wght-400',
8
+ 'wght-500',
9
+ 'wght-600',
10
+ 'wght-700',
11
+ 'wght-800',
12
+ 'wght-900',
13
+ 'light',
14
+ 'normal',
15
+ 'bold',
16
+ 'fvs-wght-100',
17
+ 'fvs-wght-200',
18
+ 'fvs-wght-300',
19
+ 'fvs-wght-400',
20
+ 'fvs-wght-500',
21
+ 'fvs-wght-600',
22
+ 'fvs-wght-700',
23
+ 'fvs-wght-800',
24
+ 'fvs-wght-900',
25
+ ],
4
26
  theme: ['primary', 'secondary', 'tertiary', 'ghost', 'error', 'success', 'warning'],
5
27
  checkboxAppearance: [null, 'with-decorator'],
6
28
  checkboxStyle: ['check', 'cross'],
@@ -8,6 +30,7 @@ export const propValidators = {
8
30
  optionsLayout: ['block', 'inline', 'equal-widths'],
9
31
  inputTypesButton: ['button', 'cancel', 'reset', 'submit'],
10
32
  inputTypesText: ['text', 'email', 'password', 'number', 'tel', 'url'],
33
+ inputMode: ['text', 'email', 'tel', 'url', 'search', 'numeric', 'none', 'decimal'],
11
34
  };
12
35
 
13
36
  export default propValidators;
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="input-error-message" :class="[elementClasses, { show: fieldHasError }, { detached: isDetached }, { hide: !fieldHasError }]">
3
- <div class="inner" :class="[{ show: fieldHasError }]">
2
+ <div class="input-error-message" :class="[elementClasses, { show: showError }, { detached: isDetached }, { hide: !showError }]" :data-Testid>
3
+ <div class="inner" :class="[{ show: showError }]">
4
4
  <div class="inner-content">
5
5
  <div class="inner-icon">
6
6
  <Icon name="radix-icons:circle-backslash" class="icon" />
@@ -20,11 +20,15 @@
20
20
 
21
21
  <script setup lang="ts">
22
22
  const props = defineProps({
23
+ dataTestid: {
24
+ type: String,
25
+ default: 'inputError',
26
+ },
23
27
  errorMessage: {
24
28
  type: [Array, Object, String],
25
29
  required: true,
26
30
  },
27
- fieldHasError: {
31
+ showError: {
28
32
  type: Boolean,
29
33
  required: true,
30
34
  },
@@ -0,0 +1,36 @@
1
+ import type { Meta, StoryFn } from '@nuxtjs/storybook';
2
+ // import { Suspense } from 'vue';
3
+ import InputError from '../InputError.vue';
4
+
5
+ export default {
6
+ title: 'Components/UI/InputError',
7
+ component: InputError,
8
+ } as Meta<typeof InputError>;
9
+
10
+ const Template: StoryFn<typeof InputError> = (args) => ({
11
+ components: { InputError },
12
+ setup() {
13
+ return { args };
14
+ },
15
+ template: `
16
+ <Suspense>
17
+ <template #default>
18
+ <InputError v-bind="args" />
19
+ </template>
20
+ <template #fallback>
21
+ <div>Loading...</div>
22
+ </template>
23
+ </Suspense>
24
+ `,
25
+ });
26
+
27
+ export const SingleErrorMessage = Template.bind({});
28
+ SingleErrorMessage.args = {
29
+ dataTestid: 'inputError',
30
+ errorMessage: 'Hello World',
31
+ showError: true,
32
+ id: 'testId',
33
+ styleClassPassthrough: ['testClass'],
34
+ compact: false,
35
+ isDetached: true,
36
+ };
@@ -0,0 +1,67 @@
1
+ // https://nuxt.com/docs/getting-started/testing#unit-testing
2
+ import { describe, it, expect } from 'vitest';
3
+ import { VueWrapper } from '@vue/test-utils';
4
+ import { mountSuspended } from '@nuxt/test-utils/runtime';
5
+ import ComponentUnderTest from '../InputError.vue';
6
+
7
+ let initialPropsData = {
8
+ dataTestid: 'inputError',
9
+ errorMessage: 'Hello World',
10
+ fieldHasError: true,
11
+ id: 'testId',
12
+ styleClassPassthrough: ['testClass'],
13
+ compact: false,
14
+ isDetached: true,
15
+ };
16
+
17
+ let wrapper: VueWrapper<InstanceType<typeof ComponentUnderTest>>;
18
+ const wrapperFactory = (propsData = {}) => {
19
+ const mockPropsData = { ...initialPropsData, ...propsData };
20
+
21
+ return mountSuspended(ComponentUnderTest, {
22
+ props: mockPropsData,
23
+ });
24
+ };
25
+
26
+ describe('InputError Component', () => {
27
+ it('renders properly', async () => {
28
+ wrapper = await wrapperFactory();
29
+
30
+ // Check the value of the data-testid attribute
31
+ const dataTestIdValue = wrapper.attributes('data-testid');
32
+ expect(dataTestIdValue).toBe('inputError');
33
+
34
+ expect(wrapper.find('[data-testid]').classes()).toContain('testClass');
35
+ expect(wrapper.find('[data-testid]').classes()).toContain('show');
36
+ });
37
+
38
+ it('is not displayed by default', async () => {
39
+ const propData = {
40
+ fieldHasError: false,
41
+ };
42
+ wrapper = await wrapperFactory(propData);
43
+
44
+ expect(wrapper.find('[data-testid]').classes()).not.toContain('show');
45
+ });
46
+
47
+ it('is displays a single error message', async () => {
48
+ const propData = {
49
+ fieldHasError: true,
50
+ };
51
+ wrapper = await wrapperFactory(propData);
52
+
53
+ expect(wrapper.find('.message-list').exists()).toBe(false);
54
+ expect(wrapper.find('.message-single').text()).toContain('Hello World');
55
+ });
56
+
57
+ it('is displays a single error message', async () => {
58
+ const propData = {
59
+ errorMessage: ['Hello World', 'Hello World 2'],
60
+ };
61
+ wrapper = await wrapperFactory(propData);
62
+
63
+ expect(wrapper.find('.message-single').exists()).toBe(false);
64
+ expect(wrapper.find('.message-list .message-list-item:first-child').text()).toEqual('Hello World');
65
+ expect(wrapper.find('.message-list .message-list-item:last-child').text()).toEqual('Hello World 2');
66
+ });
67
+ });
@@ -3,10 +3,10 @@
3
3
  :type
4
4
  :readonly
5
5
  :aria-disabled="readonly"
6
- :data-test-id="dataTestId"
6
+ :data-testid="dataTestid"
7
7
  :data-btn-theme="theme"
8
8
  class="input-button-core btn"
9
- :class="[`btn-${type}`, size, effectClass, styleClassPassthrough, { 'icon-only': isIconOnly }]"
9
+ :class="[`btn-${type}`, size, effectClass, elementClasses, { 'icon-only': isIconOnly }]"
10
10
  >
11
11
  <span v-if="useEffect && effect == 'fancy'" class="fancy"></span>
12
12
  <template v-if="hasLeftContent && !isIconOnly">
@@ -64,13 +64,13 @@ const props = defineProps({
64
64
  type: String,
65
65
  required: true,
66
66
  },
67
- dataTestId: {
67
+ dataTestid: {
68
68
  type: String,
69
69
  default: '',
70
70
  },
71
71
  styleClassPassthrough: {
72
- type: String,
73
- default: '',
72
+ type: Array as PropType<string[]>,
73
+ default: () => [],
74
74
  },
75
75
  useEffect: {
76
76
  type: Boolean,
@@ -106,6 +106,8 @@ const slots = useSlots();
106
106
  const hasLeftContent = computed(() => slots.left !== undefined);
107
107
  const hasRightContent = computed(() => slots.right !== undefined);
108
108
  const isIconOnly = computed(() => slots.iconOnly !== undefined);
109
+
110
+ const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
109
111
  </script>
110
112
 
111
113
  <style lang="css">
@@ -0,0 +1,8 @@
1
+ import { Meta, Canvas, Controls } from '@storybook/blocks';
2
+ import * as InputButtonCoreStories from './InputButtonCore.stories'
3
+
4
+ <Meta of={InputButtonCoreStories} />
5
+
6
+ <Canvas of={InputButtonCoreStories.Primary} />
7
+
8
+ <Controls of={InputButtonCoreStories.Primary} />
@@ -0,0 +1,65 @@
1
+ import type { Meta, StoryFn } from '@nuxtjs/storybook';
2
+ import InputButtonCore from '../InputButtonCore.vue';
3
+ import propValidators from '../../c12/prop-validators';
4
+
5
+ export default {
6
+ title: 'Components/Forms/Buttons/Core',
7
+ component: InputButtonCore,
8
+ argTypes: {
9
+ size: {
10
+ options: propValidators.size,
11
+ control: { type: 'select' },
12
+ },
13
+ weight: {
14
+ options: propValidators.weight,
15
+ control: { type: 'select' },
16
+ },
17
+ theme: {
18
+ options: propValidators.theme,
19
+ control: { type: 'select' },
20
+ default: 'primary',
21
+ },
22
+ effect: {
23
+ options: ['fancy', 'pulse'],
24
+ control: { type: 'select' },
25
+ },
26
+ },
27
+ } as Meta<typeof InputButtonCore>;
28
+
29
+ const Template: StoryFn<typeof InputButtonCore> = (args) => ({
30
+ components: { InputButtonCore },
31
+ setup() {
32
+ return { args };
33
+ },
34
+ template: `
35
+ <Suspense>
36
+ <template #default>
37
+ <InputButtonCore v-bind="args">
38
+ <template v-if="${'left' in args}" v-slot:title>${args.left}</template>
39
+ <template v-if="${'right' in args}" v-slot:content>${args.right}</template>
40
+ <template v-if="${'iconOnly' in args}" v-slot:content>${args.iconOnly}</template>
41
+ </InputButtonCore>
42
+ </template>
43
+ <template #fallback>
44
+ <div>Loading...</div>
45
+ </template>
46
+ </Suspense>
47
+ `,
48
+ // template: '<InputButtonCore v-bind="args" />',
49
+ });
50
+
51
+ export const Primary = Template.bind({});
52
+ Primary.args = {
53
+ size: 'medium',
54
+ weight: 'wght-400',
55
+ theme: 'primary',
56
+ useEffect: false,
57
+ effect: 'pulse',
58
+ buttonText: 'Button text prop',
59
+ dataTestid: 'buttonTestId',
60
+ styleClassPassthrough: ['testClass', 'testClass2'],
61
+ isPending: false,
62
+ readonly: false,
63
+ left: 'Left',
64
+ right: 'Right',
65
+ };
@@ -5,11 +5,11 @@
5
5
  :isPending="isPending"
6
6
  :readonly
7
7
  :effect="effect"
8
- :data-test-id="dataTestId"
8
+ :data-testid="dataTestid"
9
9
  :size
10
10
  :weight
11
11
  :button-text="buttonText"
12
- :style-class-passthrough="styleClassPassthrough"
12
+ :style-class-passthrough
13
13
  :theme
14
14
  >
15
15
  <template #left>
@@ -58,13 +58,13 @@ const props = defineProps({
58
58
  type: String,
59
59
  required: true,
60
60
  },
61
- dataTestId: {
61
+ dataTestid: {
62
62
  type: String,
63
63
  default: '',
64
64
  },
65
65
  styleClassPassthrough: {
66
- type: String,
67
- default: '',
66
+ type: Array as PropType<string[]>,
67
+ default: () => [],
68
68
  },
69
69
  isPending: {
70
70
  type: Boolean,
@@ -1,17 +1,5 @@
1
1
  <template>
2
- <InputButtonCore
3
- type="button"
4
- :use-effect="useEffect"
5
- :isPending="isPending"
6
- :readonly
7
- :effect="effect"
8
- :data-test-id="dataTestId"
9
- :size
10
- :weight
11
- :button-text="buttonText"
12
- :style-class-passthrough="styleClassPassthrough"
13
- :theme
14
- />
2
+ <InputButtonCore type="button" :use-effect="useEffect" :isPending="isPending" :readonly :effect="effect" :data-testid :size :weight :button-text :style-class-passthrough :theme />
15
3
  </template>
16
4
 
17
5
  <script setup lang="ts">
@@ -54,13 +42,13 @@ const props = defineProps({
54
42
  type: String,
55
43
  required: true,
56
44
  },
57
- dataTestId: {
45
+ dataTestid: {
58
46
  type: String,
59
47
  default: '',
60
48
  },
61
49
  styleClassPassthrough: {
62
- type: String,
63
- default: '',
50
+ type: Array as PropType<string[]>,
51
+ default: () => [],
64
52
  },
65
53
  isPending: {
66
54
  type: Boolean,