@carbon/vue 3.0.19 → 3.0.20

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "@carbon/vue",
4
- "version": "3.0.18",
4
+ "version": "3.0.19",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -4728,6 +4728,7 @@
4728
4728
  "attributes": [
4729
4729
  {
4730
4730
  "name": "clearAriaLabel",
4731
+ "description": "aria label to use for the x icon for the filter tag",
4731
4732
  "value": {
4732
4733
  "kind": "expression",
4733
4734
  "type": "string"
@@ -4762,7 +4763,7 @@
4762
4763
  },
4763
4764
  {
4764
4765
  "name": "filter",
4765
- "description": "If filter is true, the CvTag will include a remove button on the right side, which on a click, will emit the 'remove' event.",
4766
+ "description": "If filter is true, the CvTag will include a remove button on the right side, which on a click, will emit the\n'remove' event.",
4766
4767
  "value": {
4767
4768
  "kind": "expression",
4768
4769
  "type": "boolean"
@@ -4784,6 +4785,15 @@
4784
4785
  "kind": "expression",
4785
4786
  "type": "boolean"
4786
4787
  }
4788
+ },
4789
+ {
4790
+ "name": "renderIcon",
4791
+ "description": "Optional prop to render a custom icon. \\@carbon/icons-vue icon, href, svg or symbol",
4792
+ "value": {
4793
+ "kind": "expression",
4794
+ "type": "string|object"
4795
+ },
4796
+ "default": "undefined"
4787
4797
  }
4788
4798
  ],
4789
4799
  "events": [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/vue",
3
3
  "license": "Apache-2.0",
4
- "version": "3.0.19",
4
+ "version": "3.0.20",
5
5
  "description": "A collection of components for the Carbon Design System built using Vue.js",
6
6
  "packageManager": "yarn@3.2.0",
7
7
  "main": "dist/carbon-vue-3.umd.min.js",
@@ -177,6 +177,5 @@
177
177
  "type": "git",
178
178
  "url": "git+https://github.com/carbon-design-system/carbon-components-vue.git"
179
179
  },
180
- "sideEffects": true,
181
- "gitHead": "c0f3985156cde83b216fd96f56c000c56b561ac4"
180
+ "sideEffects": true
182
181
  }
@@ -121,12 +121,22 @@
121
121
  </slot>
122
122
  </ul>
123
123
  </div>
124
- <div v-if="data.isInvalid" :class="`${carbonPrefix}--form-requirement`">
124
+ <p
125
+ v-if="data.isInvalid"
126
+ :class="`${carbonPrefix}--form-requirement`"
127
+ role="alert"
128
+ aria-atomic="true"
129
+ >
125
130
  <slot name="invalid-message">{{ invalidMessage }}</slot>
126
- </div>
127
- <div v-else-if="isWarning" :class="`${carbonPrefix}--form-requirement`">
131
+ </p>
132
+ <p
133
+ v-else-if="isWarning"
134
+ :class="`${carbonPrefix}--form-requirement`"
135
+ role="alert"
136
+ aria-atomic="true"
137
+ >
128
138
  <slot name="warning-message">{{ warningMessage }}</slot>
129
- </div>
139
+ </p>
130
140
  <div
131
141
  v-else-if="data.isHelper"
132
142
  :aria-disabled="disabled || null"
@@ -5,17 +5,39 @@ import {
5
5
  sbCompPrefix,
6
6
  storyParametersObject,
7
7
  } from '../../global/storybook-utils';
8
+ import {
9
+ DataDefinition20,
10
+ Bee20,
11
+ Carbon20,
12
+ Watson20,
13
+ IbmCloud20,
14
+ EdtLoop20,
15
+ IbmSecurity20,
16
+ } from '@carbon/icons-vue';
17
+
18
+ const icons = {
19
+ DataDefinition20,
20
+ Bee20,
21
+ Carbon20,
22
+ Watson20,
23
+ IbmCloud20,
24
+ EdtLoop20,
25
+ IbmSecurity20,
26
+ undefined,
27
+ };
8
28
 
9
29
  export default {
10
30
  title: `${sbCompPrefix}/CvTag`,
11
31
  component: CvTag,
12
32
  argTypes: {
13
33
  kind: { control: 'select', options: tagKinds },
34
+ renderIcon: { control: { type: 'select', options: Object.keys(icons) } },
14
35
  },
15
36
  };
16
37
 
17
38
  const template = `<cv-tag @remove="onRemove" v-bind="args" />`;
18
- const Template = (args, { argTypes }) => {
39
+ const Template = (argsIn, { argTypes }) => {
40
+ let args = { ...argsIn, renderIcon: icons[argsIn.renderIcon] };
19
41
  return {
20
42
  props: Object.keys(argTypes),
21
43
  components: { CvTag },
@@ -31,9 +53,14 @@ const Template = (args, { argTypes }) => {
31
53
 
32
54
  export const Default = Template.bind({});
33
55
  Default.args = {
34
- label: 'This is a tag',
56
+ label: 'Hugo Award winner',
35
57
  filter: false,
36
58
  };
59
+ Default.parameters = {
60
+ controls: {
61
+ exclude: ['remove'],
62
+ },
63
+ };
37
64
  Default.parameters = storyParametersObject(
38
65
  Default.parameters,
39
66
  template,
@@ -42,8 +69,14 @@ Default.parameters = storyParametersObject(
42
69
 
43
70
  export const Filter = Template.bind({});
44
71
  Filter.args = {
45
- label: 'This is a tag',
72
+ label: 'Filter House',
46
73
  filter: true,
74
+ kind: 'high-contrast',
75
+ };
76
+ Filter.parameters = {
77
+ controls: {
78
+ exclude: ['remove'],
79
+ },
47
80
  };
48
81
  Filter.parameters = storyParametersObject(
49
82
  Filter.parameters,
@@ -56,8 +89,29 @@ Skeleton.args = {
56
89
  skeleton: true,
57
90
  label: '',
58
91
  };
92
+ Skeleton.parameters = {
93
+ controls: {
94
+ include: ['small'],
95
+ },
96
+ };
59
97
  Skeleton.parameters = storyParametersObject(
60
98
  Skeleton.parameters,
61
99
  template,
62
100
  Skeleton.args
63
101
  );
102
+
103
+ export const TagIcon = Template.bind({});
104
+ TagIcon.args = {
105
+ renderIcon: 'DataDefinition20',
106
+ label: 'Steampunk',
107
+ };
108
+ TagIcon.parameters = {
109
+ controls: {
110
+ include: ['renderIcon'],
111
+ },
112
+ };
113
+ TagIcon.parameters = storyParametersObject(
114
+ TagIcon.parameters,
115
+ template,
116
+ TagIcon.args
117
+ );
@@ -1,6 +1,11 @@
1
1
  <template>
2
2
  <div v-if="skeleton" :class="tagClasses"></div>
3
3
  <div v-else :class="tagClasses" role="listitem" :title="title">
4
+ <cv-svg
5
+ v-if="!skeleton && renderIcon"
6
+ :svg="renderIcon"
7
+ :class="`${carbonPrefix}--tag__custom-icon`"
8
+ />
4
9
  <span :class="`${carbonPrefix}--tag__label`">
5
10
  {{ label }}
6
11
  </span>
@@ -21,23 +26,19 @@ import { computed } from 'vue';
21
26
  import { carbonPrefix } from '../../global/settings';
22
27
  import { tagKinds } from './consts';
23
28
  import Close16 from '@carbon/icons-vue/es/close/16';
29
+ import CvSvg from '../CvSvg/_CvSvg.vue';
24
30
 
25
31
  export default {
26
32
  name: 'CvTag',
27
- components: { Close16 },
33
+ components: { CvSvg, Close16 },
28
34
  props: {
35
+ /** aria label to use for the x icon for the filter tag */
29
36
  clearAriaLabel: { type: String, default: 'Clear filter' },
30
- /**
31
- * disabled by property or if skeleton
32
- */
37
+ /** disabled by property or if skeleton */
33
38
  disabled: Boolean,
34
- /**
35
- * label to be used in the CvTag component
36
- */
39
+ /** label to be used in the CvTag component */
37
40
  label: { type: String, required: true },
38
- /**
39
- * kind of the CvTag
40
- */
41
+ /** kind of the CvTag */
41
42
  kind: {
42
43
  type: String,
43
44
  default: undefined,
@@ -46,20 +47,22 @@ export default {
46
47
  },
47
48
  },
48
49
  /**
49
- * If filter is true, the CvTag will include a remove button on the right side, which on a click, will emit the 'remove' event.
50
+ * If filter is true, the CvTag will include a remove button on the right side, which on a click, will emit the
51
+ * 'remove' event.
50
52
  */
51
53
  filter: {
52
54
  type: Boolean,
53
55
  default: false,
54
56
  },
55
- /**
56
- * skeleton used when loading
57
- */
57
+ /** skeleton used when loading */
58
58
  skeleton: Boolean,
59
- /**
60
- * tag size small
61
- */
59
+ /** tag size small */
62
60
  small: Boolean,
61
+ /** Optional prop to render a custom icon. \@carbon/icons-vue icon, href, svg or symbol */
62
+ renderIcon: {
63
+ type: [String, Object],
64
+ default: undefined,
65
+ },
63
66
  },
64
67
  emits: [
65
68
  /**
package/src/index.js CHANGED
@@ -43,6 +43,8 @@ export default {
43
43
  }
44
44
  },
45
45
  };
46
+
47
+ // AUTO-GENERATED EXPORTS - DO NOT EDIT BELOW
46
48
  export { default as CvAccordion } from './components/CvAccordion/CvAccordion.vue';
47
49
  export { default as CvAccordionItem } from './components/CvAccordion/CvAccordionItem.vue';
48
50
  export { default as CvAccordionSkeleton } from './components/CvAccordion/CvAccordionSkeleton.vue';