@vcita/design-system 1.11.11 → 1.11.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcita/design-system",
3
- "version": "1.11.11",
3
+ "version": "1.11.13",
4
4
  "description": "vcita design system",
5
5
  "author": "vcita",
6
6
  "scripts": {
@@ -156,4 +156,20 @@ describe("VcChip.vue", () => {
156
156
  expect(chip).toHaveClass('VcChip--small')
157
157
  })
158
158
 
159
+ it('Chip width', async () => {
160
+ const {getByTestId, updateProps} = renderWithVuetify(VcChip, {
161
+ props: {
162
+ label: 'James Howlett',
163
+ }
164
+ })
165
+
166
+ const chip = getByTestId('vc-chip')
167
+ expect(chip).toHaveStyle('min-width: 20px');
168
+ expect(chip).toHaveStyle('max-width: 116px');
169
+
170
+ await updateProps({minWidth: 50, maxWidth: 100});
171
+ expect(chip).toHaveStyle('min-width: 50px');
172
+ expect(chip).toHaveStyle('max-width: 100px');
173
+ })
174
+
159
175
  });
@@ -15,6 +15,8 @@ const baseProps = {
15
15
  selected: false,
16
16
  small: false,
17
17
  subLabel: '',
18
+ maxWidth: 116,
19
+ minWidth: 20,
18
20
  }
19
21
 
20
22
  const GeneralTemplate = (args, {argTypes}) => ({
@@ -37,6 +39,8 @@ const GeneralTemplate = (args, {argTypes}) => ({
37
39
  :is-ripple="isRipple"
38
40
  :small="small"
39
41
  :subLabel="subLabel"
42
+ :max-width="maxWidth"
43
+ :min-width="minWidth"
40
44
  @onChipClick="onChipClick"
41
45
  @input="onClose">
42
46
  </VcChip>`,
@@ -5,6 +5,7 @@
5
5
  :ripple="isRipple"
6
6
  close-icon="$close"
7
7
  :disabled="disabled"
8
+ :style="{maxWidth: `${maxWidth}px`, minWidth: `${minWidth}px`}"
8
9
  :class="{
9
10
  'vc-invalid': invalid,
10
11
  'vc-avatar': !!avatar,
@@ -82,6 +83,14 @@ export default {
82
83
  type: Boolean,
83
84
  default: false
84
85
  },
86
+ maxWidth: {
87
+ type: Number,
88
+ default: 116,
89
+ },
90
+ minWidth: {
91
+ type: Number,
92
+ default: 20,
93
+ },
85
94
  }
86
95
  };
87
96
  </script>
@@ -90,11 +99,13 @@ export default {
90
99
  @import '@/../styles/variables.scss';
91
100
 
92
101
  .VcChip {
93
- max-width: fit-content;
94
102
  border: 1px solid var(--neutral-lighten-1);
95
103
 
96
- &__label-wrap {
104
+ .label-wrap {
97
105
  padding-inline: var(--size-value2);
106
+ white-space: nowrap;
107
+ overflow: hidden;
108
+ text-overflow: ellipsis;
98
109
  }
99
110
 
100
111
  .v-chip__content__avatar {
@@ -28,6 +28,8 @@
28
28
  :is-ripple="false"
29
29
  :close-button="showCloseButton"
30
30
  :small="isSmall"
31
+ :max-width="maxChipWidth"
32
+ :min-width="minChipWidth"
31
33
  data-qa="vc-chip-item-more"/>
32
34
  <span v-else
33
35
  v-show="hiddenChips.length"
@@ -81,7 +83,13 @@ export default {
81
83
  type: String,
82
84
  default: 'text',
83
85
  validator: value => ['text', 'chip'].includes(value)
84
- }
86
+ },
87
+ maxChipWidth: {
88
+ type: Number,
89
+ },
90
+ minChipWidth: {
91
+ type: Number,
92
+ },
85
93
  },
86
94
  data() {
87
95
  return {
@@ -103,4 +103,51 @@ describe("VcPoweredBy.vue", () => {
103
103
  expect(powered).toBeInTheDocument();
104
104
  });
105
105
 
106
+ it("mounts with reverse", () => {
107
+ // Queries: https://testing-library.com/docs/queries/about#types-of-queries
108
+ const {getByText} = renderWithVuetify(VcPoweredBy, {
109
+ props: {
110
+ poweredByText: 'powered by',
111
+ reverse: true,
112
+ image: require('@/stories/assets/vc_logo.svg')
113
+ }
114
+ })
115
+
116
+ // Make sure the component has the data-qa attribute
117
+ const powered = getByText('powered by');
118
+ expect(powered).toBeInTheDocument();
119
+ });
120
+
121
+ it("has class of reverse", () => {
122
+ // Queries: https://testing-library.com/docs/queries/about#types-of-queries
123
+ const {getByTestId} = renderWithVuetify(VcPoweredBy, {
124
+ props: {
125
+ poweredByText: 'powered by',
126
+ reverse: true,
127
+ image: require('@/stories/assets/vc_logo.svg')
128
+ }
129
+ })
130
+
131
+ // Make sure the component has the data-qa attribute
132
+ const container = getByTestId('VcPoweredBy');
133
+ expect(container).toHaveClass('alignment-direction-reverse');
134
+ expect(container).not.toHaveClass('alignment-direction-row');
135
+ });
136
+
137
+ it("has class of row", () => {
138
+ // Queries: https://testing-library.com/docs/queries/about#types-of-queries
139
+ const {getByTestId} = renderWithVuetify(VcPoweredBy, {
140
+ props: {
141
+ poweredByText: 'powered by',
142
+ reverse: false,
143
+ image: require('@/stories/assets/vc_logo.svg')
144
+ }
145
+ })
146
+
147
+ // Make sure the component has the data-qa attribute
148
+ const container = getByTestId('VcPoweredBy');
149
+ expect(container).toHaveClass('alignment-direction-row');
150
+ expect(container).not.toHaveClass('alignment-direction-reverse');
151
+ });
152
+
106
153
  });
@@ -4,7 +4,7 @@ const Template = (args, {argTypes}) => ({
4
4
  components: {VcPoweredBy: VcPoweredByCmp},
5
5
  props: Object.keys(argTypes),
6
6
  template: `<div><span v-if="!dark">Black background is only to show non dark mode </span><div :class="{'background-color: black': !dark}">
7
- <VcPoweredBy :poweredByText="poweredByText" :dark="dark" :size="size" :image="image"/>
7
+ <VcPoweredBy :poweredByText="poweredByText" :dark="dark" :size="size" :image="image" :reverse="reverse"/>
8
8
  </div></div>`,
9
9
  })
10
10
  export const Playground = Template.bind({});
@@ -40,6 +40,16 @@ MediumSizeDark.args = {
40
40
  size:'md'
41
41
  }
42
42
 
43
+ export const AlignDirectionReverse = Template.bind({});
44
+
45
+ AlignDirectionReverse.args = {
46
+ poweredByText: 'Powered by vcita',
47
+ dark:true,
48
+ image: require('@/stories/assets/vc_logo.svg'),
49
+ size:'md',
50
+ reverse: true
51
+ }
52
+
43
53
 
44
54
  export default {
45
55
  title: 'Content Display / VcPoweredBy', // This will control the story sidebar position
@@ -48,7 +58,8 @@ export default {
48
58
  argTypes: {
49
59
  poweredByText: String,
50
60
  dark: Boolean,
51
- size:{ options:['sm', 'md']}
61
+ size:{ options:['sm', 'md']},
62
+ reverse: Boolean,
52
63
  },
53
64
  parameters: {
54
65
  design: {
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <VcLayout justify-center align-center :data-qa="dataQa">
3
- <VcLayout class="vcita-logo-image-container" :class="`${size}`">
4
- <VcImage :image="image"></VcImage>
2
+ <VcLayout justify-center align-center :class="reverse ? 'alignment-direction-reverse' : 'alignment-direction-row'" :data-qa="dataQa">
3
+ <VcLayout class="vcita-logo-image-container" :class="`${size}`">
4
+ <VcImage :image="image"></VcImage>
5
+ </VcLayout>
6
+ <span class="vc-powered-by-text mx-2" :class="computedClasses">{{ poweredByText }}</span>
5
7
  </VcLayout>
6
- <span class="vc-powered-by" :class="computedClasses">{{ poweredByText }}</span>
7
- </VcLayout>
8
8
  </template>
9
9
 
10
10
  <script>
@@ -15,6 +15,10 @@ export default {
15
15
  name: "VcPoweredBy",
16
16
  components: {VcImage, VcLayout},
17
17
  props: {
18
+ reverse: {
19
+ type: Boolean,
20
+ default: false
21
+ },
18
22
  poweredByText: {
19
23
  type: String,
20
24
  required: true
@@ -52,10 +56,17 @@ export default {
52
56
  @import "../../scss/mixins.scss";
53
57
  @import "../../scss/_i18n-mixins.scss";
54
58
 
55
- .vc-powered-by {
59
+ .vc-powered-by-text {
56
60
  font-weight: var(--font-weight-medium);
57
61
  color: var(--modal-bg-color);
58
- margin-inline-start: var(--size-value2);
62
+ }
63
+
64
+ .alignment-direction-reverse {
65
+ flex-direction: row-reverse;
66
+ }
67
+
68
+ .alignment-direction-row {
69
+ flex-direction: row;
59
70
  }
60
71
 
61
72
  .vcita-logo-image-container {
@@ -110,9 +110,9 @@ export default {
110
110
  .VcColumnHeader {
111
111
  height: var(--size-value9);
112
112
  padding: 0 var(--size-value4);
113
- color: var(--gray-darken-4);
113
+ color: var(--gray-darken-5);
114
114
  font-size: 10px;
115
- font-weight: var(--font-weight-medium2);
115
+ font-weight: var(--font-weight-large);
116
116
  background-color: var(--gray-lighten-4);
117
117
  border-bottom: var(--gray-lighten-2) solid 1px;
118
118
 
@@ -244,6 +244,7 @@ export default {
244
244
  position: sticky;
245
245
  padding: var(--size-value3) 0;
246
246
  margin-bottom: var(--size-value3);
247
+ margin-left: var(--size-value1);
247
248
  }
248
249
 
249
250
  &--header {
@@ -23,6 +23,8 @@
23
23
  :lines="1"
24
24
  hidden-item-display="chip"
25
25
  :data-qa="`${dataQa}-tags`"
26
+ :max-chip-width="116"
27
+ :min-chip-width="20"
26
28
  @onHiddenChipsChange="newValue => hiddenChips = newValue"/>
27
29
  <VcButton ghost v-else-if="type === 'tag' && showAddTagButton" :data-qa="`${dataQa}-addTagsButton`"
28
30
  @click="$emit('onClickToAddTag', $props)">