@vcita/design-system 0.2.0 → 0.2.4

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 (33) hide show
  1. package/CHANGELOG.MD +19 -0
  2. package/config/locales/ds.en.yml +2 -0
  3. package/dist/@vcita/design-system.esm.js +1141 -588
  4. package/dist/@vcita/design-system.min.js +1 -1
  5. package/dist/@vcita/design-system.ssr.js +1046 -526
  6. package/init/DesignSystem.js +13 -3
  7. package/init/initI18n.js +5 -1
  8. package/init/svgImages.js +11 -0
  9. package/init/vuetify.config.js +6 -6
  10. package/package.json +1 -1
  11. package/src/components/VcEmptyState/VcEmptyState.vue +22 -4
  12. package/src/components/VcFilterPanel/VcFilterPanel.spec.js +1 -1
  13. package/src/components/VcProgressCircular/VcProgressCircular.spec.js +109 -0
  14. package/src/components/VcProgressCircular/VcProgressCircular.stories.js +58 -0
  15. package/src/components/VcProgressCircular/VcProgressCircular.vue +88 -0
  16. package/{init → src/components}/VcSvg/VcSvg.stories.js +5 -1
  17. package/{init → src/components}/VcSvg/VcSvg.vue +0 -0
  18. package/src/components/VcTextField/VcTextField.spec.js +13 -95
  19. package/src/components/VcTextField/VcTextField.stories.js +60 -41
  20. package/src/components/VcTextField/VcTextField.vue +78 -155
  21. package/src/components/VcTooltip/VcTooltip.spec.js +3 -3
  22. package/src/components/Wizard/VcMobileWizardProgress/VcMobileWizardProgress.spec.js +109 -0
  23. package/src/components/Wizard/VcMobileWizardProgress/VcMobileWizardProgress.stories.js +58 -0
  24. package/src/components/Wizard/VcMobileWizardProgress/VcMobileWizardProgress.vue +85 -0
  25. package/src/components/Wizard/VcSteperContant/VcStepperContent.spec.js +163 -0
  26. package/src/components/Wizard/VcSteperContant/VcStepperContent.stories.js +118 -0
  27. package/src/components/Wizard/VcSteperContant/VcStepperContent.vue +153 -0
  28. package/src/components/Wizard/VcStepsBar/VcStepsBar.spec.js +122 -0
  29. package/src/components/Wizard/VcStepsBar/VcStepsBar.stories.js +56 -0
  30. package/src/components/Wizard/VcStepsBar/VcStepsBar.vue +190 -0
  31. package/src/components/index.js +5 -1
  32. package/src/components/list/VcListItem/VcListItem.vue +1 -3
  33. package/src/.DS_Store +0 -0
@@ -28,18 +28,20 @@ describe("VcTextField.vue", () => {
28
28
 
29
29
  it("mounts", () => {
30
30
  // Queries: https://testing-library.com/docs/queries/about#types-of-queries
31
- const {container} = renderWithVuetify(VcTextField, {
31
+ const {container,getByTestId} = renderWithVuetify(VcTextField, {
32
32
  props: {}
33
33
  })
34
34
 
35
35
  // Expect options: https://github.com/testing-library/jest-dom
36
36
  expect(container).toHaveAttribute('data-app', 'true')
37
+ const textField = getByTestId('vc-text-field')
38
+ expect(textField).toBeInTheDocument()
37
39
  });
38
40
 
39
41
  it("receives initial value", () => {
40
42
  // Queries: https://testing-library.com/docs/queries/about#types-of-queries
41
- const labelText = "initial label";
42
- const inputText = "initial value";
43
+ const labelText = "label";
44
+ const inputText = "Text";
43
45
  const {getByLabelText} = renderWithVuetify(VcTextField, {
44
46
  props: {
45
47
  label: labelText,
@@ -68,103 +70,19 @@ describe("VcTextField.vue", () => {
68
70
  expect(item).toHaveValue(newValue);
69
71
  });
70
72
 
71
- it("used as number stepper and click down", async () => {
72
- const labelText = "initial label";
73
- const {getByLabelText, getByTestId, emitted} = renderWithVuetify(VcTextField, {
74
- props: {
75
- label: labelText,
76
- type: 'number',
77
- value: 2,
78
- }
79
- })
80
-
81
- const item = getByLabelText(labelText);
82
- expect(item).toHaveValue(2);
83
- const buttonUp = getByTestId('VcTextFieldButtonUp');
84
- const buttonDown = getByTestId('VcTextFieldButtonDown');
85
-
86
- expect(buttonUp).toBeInTheDocument();
87
- expect(buttonDown).toBeInTheDocument();
88
-
89
- await userEvent.click(buttonDown);
90
- expect(emitted().input.length).toBe(1);
91
- const newValue = emitted().input[0][0];
92
- expect(newValue).toBe("1");
93
- });
94
-
95
- it("used as number stepper and click up", async () => {
96
- const labelText = "initial label";
97
- const {getByLabelText, getByTestId, emitted} = renderWithVuetify(VcTextField, {
98
- props: {
99
- label: labelText,
100
- type: 'number',
101
- value: 2,
102
- }
103
- })
104
-
105
- const item = getByLabelText(labelText);
106
- expect(item).toHaveValue(2);
107
- const buttonUp = getByTestId('VcTextFieldButtonUp');
108
- const buttonDown = getByTestId('VcTextFieldButtonDown');
109
-
110
- expect(buttonUp).toBeInTheDocument();
111
- expect(buttonDown).toBeInTheDocument();
112
-
113
- await userEvent.click(buttonUp);
114
- expect(emitted().input.length).toBe(1);
115
- const newValue = emitted().input[0][0];
116
- expect(newValue).toBe("3");
117
- });
118
-
119
- it("used as number stepper with max limit", async () => {
120
- const labelText = "initial label";
121
- const startingValue = 3;
122
- const {getByLabelText, getByTestId, emitted} = renderWithVuetify(VcTextField, {
123
- props: {
124
- label: labelText,
125
- type: 'number',
126
- value: startingValue,
127
- min: 1,
128
- max: 3,
129
- }
130
- })
131
-
132
- const item = getByLabelText(labelText);
133
- expect(item).toHaveValue(startingValue);
134
- const buttonUp = getByTestId('VcTextFieldButtonUp');
135
- const buttonDown = getByTestId('VcTextFieldButtonDown');
136
-
137
- expect(buttonUp).toBeInTheDocument();
138
- expect(buttonDown).toBeInTheDocument();
139
-
140
- await userEvent.click(buttonUp);
141
- expect(emitted().input).toBe(undefined);
142
- expect(item).toHaveValue(startingValue);
143
- });
144
-
145
- it("used as number stepper with min limit", async () => {
73
+ it("receive user input over the length limit", () => {
146
74
  const labelText = "initial label";
147
- const startingValue = 1;
148
- const {getByLabelText, getByTestId, emitted} = renderWithVuetify(VcTextField, {
75
+ const {getByLabelText} = renderWithVuetify(VcTextField, {
149
76
  props: {
150
77
  label: labelText,
151
- type: 'number',
152
- value: startingValue,
153
- min: 1,
154
- max: 3,
78
+ counter: true,
79
+ maxlength: 10
155
80
  }
156
81
  })
157
-
82
+ const newValue = 'Hello world';
83
+ const newValueMaxLength = 'Hello worl';
158
84
  const item = getByLabelText(labelText);
159
- expect(item).toHaveValue(startingValue);
160
- const buttonUp = getByTestId('VcTextFieldButtonUp');
161
- const buttonDown = getByTestId('VcTextFieldButtonDown');
162
-
163
- expect(buttonUp).toBeInTheDocument();
164
- expect(buttonDown).toBeInTheDocument();
165
-
166
- await userEvent.click(buttonDown);
167
- expect(emitted().input).toBe(undefined);
168
- expect(item).toHaveValue(startingValue);
85
+ userEvent.type(item, newValue);
86
+ expect(item).toHaveValue(newValueMaxLength);
169
87
  });
170
88
  });
@@ -1,65 +1,84 @@
1
1
  import VcTextFieldCmp from './VcTextField';
2
2
  import {action} from "@storybook/addon-actions";
3
3
 
4
- const StringTemplate = (args, {argTypes}) => ({
4
+ const TextFieldTemplate = (args, {argTypes}) => ({
5
5
  components: {VcTextField: VcTextFieldCmp},
6
6
  props: Object.keys(argTypes),
7
- data() {
8
- return {
9
- title: 'initial value',
10
- }
11
- },
12
- template: '<VcTextField v-model="title" :label="label" type="text" :step="step" ' +
13
- '@input="onInput"/>',
7
+ template: '<VcTextField :value="value" :maxlength="maxlength" :hint="hint" :counter="counter" :disabled="disabled" :rules="rules" :label="label" :type="type" @input="onInput"/>',
14
8
  })
15
9
 
16
- export const Playground = StringTemplate.bind({});
17
-
18
- // Set default values
10
+ export const Playground = TextFieldTemplate.bind({});
19
11
  Playground.args = {
20
12
  onInput: action("onInput"),
21
- label: "some label text",
13
+ label: "Label",
14
+ type: 'text'
22
15
  }
23
16
 
24
- // const NumberTemplate = (args, {argTypes}) => ({
25
- // components: {VcTextField: VcTextFieldCmp},
26
- // props: Object.keys(argTypes),
27
- // data() {
28
- // return {
29
- // curValue: 3,
30
- // }
31
- // },
32
- // template: '<VcTextField v-model="curValue" :label="label" type="number" :step="step" :min="min" :max="max"' +
33
- // '@input="onInput"/>',
34
- // })
35
-
36
- // export const NumberField = NumberTemplate.bind({});
37
-
38
- // // Set default values
39
- // NumberField.args = {
40
- // label: "some label text",
41
- // onInput: action("onInput"),
42
- // step: '1',
43
- // }
17
+ export const Disabled = TextFieldTemplate.bind({});
18
+ Disabled.args = {
19
+ onInput: action("onInput"),
20
+ label: "Label",
21
+ type: 'text',
22
+ disabled: true
23
+ }
24
+ export const Hint = TextFieldTemplate.bind({});
25
+ Hint.args = {
26
+ onInput: action("onInput"),
27
+ label: "Label",
28
+ type: 'text',
29
+ hint: "Help text"
30
+ }
31
+ export const Error = TextFieldTemplate.bind({});
32
+ Error.args = {
33
+ onInput: action("onInput"),
34
+ label: "Email",
35
+ type: 'text',
36
+ rules: [value => !!value || 'Required.',value => {
37
+ const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
38
+ return pattern.test(value) || 'Invalid e-mail.'
39
+ }]
40
+ }
41
+ export const Counter = TextFieldTemplate.bind({});
42
+ Counter.args = {
43
+ onInput: action("onInput"),
44
+ label: "Email",
45
+ type: 'text',
46
+ counter: true,
47
+ maxlength: 100
48
+ }
44
49
 
45
50
  export default {
46
51
  title: 'Form / VcTextField',
47
52
  id: 'VcTextField',
48
53
  component: VcTextFieldCmp,
49
- // argTypes: {
50
- // type: {
51
- // options: ['number', 'text'],
52
- // control: {type: 'radio'}
53
- // },
54
- // },
54
+ argTypes: {
55
+ type: {
56
+ options: ['number', 'text'],
57
+ control: {type: 'radio'}
58
+ },
59
+ disabled: {
60
+ options: [true, false],
61
+ control: {type: 'boolean'}
62
+ },
63
+ counter: {
64
+ options: [true, false],
65
+ control: {type: 'boolean'}
66
+ },
67
+ maxlength: {
68
+ control: {type: 'number'}
69
+ },
70
+ value: {
71
+ control: {type: 'text'}
72
+ }
73
+ },
55
74
  parameters: {
56
75
  design: {
57
76
  type: 'figma',
58
- url: 'https://www.figma.com',
77
+ url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita---ui-library?node-id=634%3A1645',
59
78
  },
60
79
  status: {
61
- type: 'beta', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
62
- url: 'http://www.url.com/status', // will make the tag a link
80
+ type: 'stable', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
81
+ url: 'https://vuetifyjs.com/en/components/text-fields/', // will make the tag a link
63
82
  },
64
83
  },
65
84
  };
@@ -1,213 +1,136 @@
1
1
  <template>
2
2
  <v-text-field class="VcTextInput"
3
3
  dense
4
+ :data-qa="dataQa"
4
5
  :label="label"
5
6
  :rules="rules"
7
+ :disabled="disabled"
6
8
  :type="type"
9
+ :error="counter && maxlength && value.length > maxlength"
7
10
  :value="value"
8
- :color="color"
9
- :step="step"
11
+ :hint="hint"
12
+ :counter="counter"
13
+ :maxlength="maxlength"
14
+ persistent-hint
10
15
  hide-details="auto"
11
16
  @input="(data) => $emit('input',data)">
12
- <template v-slot:append v-if="type === 'number'">
13
- <VcLayout class="number-counter" column>
14
- <VcButton icon
15
- data-qa="VcTextFieldButtonUp"
16
- :ripple="false"
17
- min-width="44px"
18
- max-height="25px"
19
- @click="updateValue(parseFloat(step))">
20
- <VcIcon>icon-caret-down fa-rotate-180</VcIcon>
21
- </VcButton>
22
- <VcButton icon
23
- data-qa="VcTextFieldButtonDown"
24
- :ripple="false"
25
- min-width="44px"
26
- max-height="25px"
27
- @click="updateValue(-parseFloat(step))">
28
- <VcIcon>icon-caret-down</VcIcon>
29
- </VcButton>
30
- </VcLayout>
31
- </template>
32
- <slot/>
33
17
  </v-text-field>
34
18
  </template>
35
19
 
36
20
  <script>
37
- import VcIcon from "@/components/VcIcon/VcIcon.vue";
38
- import VcButton from "@/components/VcButton/VcButton.vue";
39
- import VcLayout from "@/components/VcLayout/VcLayout.vue";
40
21
 
41
22
  export default {
42
23
  name: 'VcTextField',
43
- components: {VcLayout, VcButton, VcIcon},
44
24
  props: {
45
25
  type: {
46
26
  type: String,
47
27
  default: 'text',
48
28
  validator: prop => ['text', 'number'].includes(prop)
49
29
  },
50
- label: {
30
+ dataQa: {
51
31
  type: String,
52
- default: '',
32
+ default: 'vc-text-field'
53
33
  },
54
- step: {
34
+ label: {
55
35
  type: String,
56
- default: '1',
36
+ default: '',
57
37
  },
58
38
  value: {
59
39
  type: [Number, String],
60
40
  default: '',
61
41
  },
62
- min: {
63
- type: Number,
64
- default: -Infinity,
42
+ counter: {
43
+ type: [Number, Boolean],
44
+ default: false,
65
45
  },
66
- max: {
46
+ maxlength: {
67
47
  type: Number,
68
- default: Infinity,
48
+ default: 100,
69
49
  },
70
50
  rules: {
71
51
  type: Array
72
52
  },
73
- color: {
53
+ disabled: {
54
+ type: Boolean,
55
+ default: false,
56
+ },
57
+ hint: {
74
58
  type: String,
75
- default: 'Primary',
59
+ default: '',
76
60
  }
77
- },
78
- methods: {
79
- updateValue(num) {
80
- let currVal = parseFloat(this.value)
81
- currVal = parseFloat((currVal + num).toPrecision(this.step.length + 1))
82
- if (currVal < parseFloat(this.min) || currVal > parseFloat(this.max)) {
83
- return;
84
- }
85
- this.$emit('input', currVal.toString())
86
- },
87
- },
61
+ }
88
62
  }
89
63
  </script>
90
64
 
91
65
  <style lang="scss" scoped>
92
- @import "../../scss/_i18n-mixins.scss";
93
-
94
- .number-counter {
95
- @include i-border-left(1px solid rgba(0, 0, 0, 0.12));
96
- }
97
- </style>
98
-
99
- <style lang="scss">
100
- @import "../../scss/_i18n-mixins.scss";
101
-
102
- .VcTextInput.v-text-field {
103
- margin: 0;
104
- padding: 0;
105
-
106
- label {
107
- letter-spacing: -0.3px;
108
- font-size: 15px;
109
- color: rgba(0, 0, 0, 0.4);
110
- }
111
-
112
- .v-text-field__slot:first-child {
113
- margin: 0 12px;
114
- }
115
-
116
- &[prepend-inner-icon] {
117
- .v-text-field__slot {
118
- padding: 0;
66
+ .VcTextInput.v-text-field::v-deep {
67
+ font-family: var(--primary-font-family);
68
+ .v-input__slot {
69
+ padding: 0px var(--size-value3);
70
+ height: var(--size-value13);
71
+ background: #FFFFFF;
72
+ border: 1px solid var(--gray-lighten-1);
73
+ box-sizing: border-box;
74
+ border-radius: 6px;
75
+ label{
76
+ font-size: var(--font-size-small2);
77
+ line-height: var(--size-value5);
78
+ color: var(--gray-darken-3);
79
+ font-weight: var(--font-weight-medium);
119
80
  }
120
- }
121
-
122
- &.v-input--is-label-active, &.v-input--is-focused {
123
-
124
- label {
125
- font-size: 14px;
126
- font-weight: normal;
127
- font-stretch: normal;
128
- font-style: normal;
129
- line-height: 1.17;
130
- letter-spacing: -0.3px;
131
- color: rgba(0, 0, 0, 0.62) !important;
132
- transform: translateY(-100%) scale(0.85);
133
- top: 8px;
81
+ input {
82
+ font-weight: var(--font-weight-medium2);
83
+ font-size: var(--font-size-small2);
84
+ line-height: var(--size-value5);
85
+ color: var(--gray-darken-5);
134
86
  }
135
- }
136
-
137
- &:not(.v-text-field--outlined) {
138
- .v-text-field__slot {
139
- transition: margin-bottom 0.1s;
87
+ &:before, &:after{
88
+ display: none;
140
89
  }
141
-
142
- &.v-input--is-label-active, &.v-input--is-focused {
143
- .v-text-field__slot {
144
- margin-bottom: -20px;
90
+ &:hover{
91
+ border-color: var(--gray-darken-3);
92
+ }
93
+ &:focus, &:active, &:focus-within{
94
+ border: 1px solid var(--v-secondary-base);
95
+ box-shadow: 0px 0px 0px 3px var(--v-secondary-lighten1);
96
+ input{
97
+ color: var(--gray-darken-3);
145
98
  }
146
99
  }
147
100
  }
148
-
149
- &.v-input--is-focused {
150
- .v-input__slot {
151
- border-color: currentColor;
152
- }
101
+ &.error--text .v-input__slot{
102
+ border-color: var(--red);
103
+ color: unset;
104
+ box-shadow: unset;
105
+ font-size: var(--font-size-xx-small);
106
+ line-height: var(--size-value4);
153
107
  }
154
-
155
- .v-input__slot {
156
- min-height: 52px !important;
157
- border-radius: 6px;
158
- background-color: #fff !important;
159
- position: relative !important;
160
- border: solid 1px rgba(0, 0, 0, 0.12);
161
- transition: border-color, background-color 0.1s !important;
162
-
163
- &:hover {
164
- border-color: currentColor;
108
+ &.v-input--is-label-active , &.v-input--is-focused{
109
+ label{
110
+ font-size: var(--font-size-small);
111
+ line-height: 1.17;
112
+ letter-spacing: -0.3px;
113
+ color: var(--gray-darken-4) !important;
114
+ transform: translateY(-100%) scale(0.85);
115
+ top: var(--size-value2);
165
116
  }
166
-
167
- &:before, &:after {
168
- display: none;
117
+ .v-text-field__slot {
118
+ margin-bottom: -14px;
169
119
  }
170
120
  }
171
-
172
- &.v-input--is-disabled {
121
+ &.v-input--is-disabled{
173
122
  .v-input__slot {
174
- background-color: rgba(0, 0, 0, 0.03) !important;
123
+ background: var(--gray-lighten-3);
124
+ border: 1px solid var(--gray-lighten-1);
125
+ label, input{
126
+ color: var(--gray-darken-2);
127
+ }
175
128
  }
176
129
  }
177
-
178
- input {
179
- font-size: 15px !important;
180
- font-weight: 500;
181
- }
182
-
183
- .v-text-field__prefix {
184
- color: rgba(0, 0, 0, 0.54) !important;
185
- }
186
-
187
- .v-input__prepend-inner, .v-input__append-inner {
188
- color: rgba(0, 0, 0, 0.4);
189
- margin: auto 12px auto 12px !important;
190
- max-width: 20px;
191
- max-height: 20px;
192
- padding: 0 !important;
193
-
194
- .v-input__icon {
195
- height: 100%;
196
- max-width: 100%;
197
- min-width: 100%;
198
- max-height: 100%;
199
- min-height: 100%;
200
- }
201
-
202
- i {
203
- color: rgba(0, 0, 0, 0.4);
204
- }
130
+ &:not(.v-input--is-label-active):not(.v-input--is-focused) input {padding: var(--size-value2) 0}
131
+ .v-messages__message{
132
+ line-height: var(--size-value4);
205
133
  }
206
134
 
207
- &.error--text {
208
- .v-input__slot {
209
- border: 1px solid #F2514A;
210
- }
211
- }
212
135
  }
213
- </style>
136
+ </style>
@@ -1,5 +1,5 @@
1
1
  import '@testing-library/jest-dom'
2
- import VcAlert from "./VcTooltip.vue";
2
+ import VcTooltip from "./VcTooltip.vue";
3
3
  import Vuetify from 'vuetify'
4
4
  import {render} from "@testing-library/vue";
5
5
  import init from "../../../testing-library.config";
@@ -27,7 +27,7 @@ describe("VcTooltip.vue", () => {
27
27
 
28
28
  it("With normal tooltip", async () => {
29
29
  // Queries: https://testing-library.com/docs/queries/about#types-of-queries
30
- const {container, getByTestId} = renderWithVuetify(VcAlert, {
30
+ const {container, getByTestId} = renderWithVuetify(VcTooltip, {
31
31
  props: {
32
32
  content: 'content text',
33
33
  dataQa: 'infoTooltip'
@@ -42,7 +42,7 @@ describe("VcTooltip.vue", () => {
42
42
  });
43
43
 
44
44
  it("With dark tooltip", async () => {
45
- const {container, getByTestId} = renderWithVuetify(VcAlert, {
45
+ const {container, getByTestId} = renderWithVuetify(VcTooltip, {
46
46
  props: {
47
47
  dark: true,
48
48
  content: 'content text',