@carbon/vue 1.0.2 → 1.1.3

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 (89) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +156 -211
  3. package/dist/carbon-vue.common.js +10567 -12509
  4. package/dist/carbon-vue.common.js.map +1 -1
  5. package/dist/carbon-vue.umd.js +10567 -12509
  6. package/dist/carbon-vue.umd.js.map +1 -1
  7. package/dist/carbon-vue.umd.min.js +31 -7
  8. package/dist/carbon-vue.umd.min.js.map +1 -1
  9. package/dist/demo.html +2 -2
  10. package/package.json +17 -157
  11. package/src/components/cv-accordion/_cv-accordion-item-skeleton.vue +3 -13
  12. package/src/components/cv-accordion/cv-accordion-item.vue +2 -9
  13. package/src/components/cv-breadcrumb/cv-breadcrumb-item.vue +3 -1
  14. package/src/components/cv-button/cv-button-skeleton.vue +1 -6
  15. package/src/components/cv-button/cv-button.vue +15 -37
  16. package/src/components/cv-checkbox/cv-checkbox.vue +42 -26
  17. package/src/components/cv-code-snippet/_cv-code-snippet-multiline.vue +13 -23
  18. package/src/components/cv-code-snippet/_cv-code-snippet-oneline.vue +11 -5
  19. package/src/components/cv-code-snippet/_cv-feedback-button.vue +1 -3
  20. package/src/components/cv-code-snippet/cv-code-snippet.vue +2 -7
  21. package/src/components/cv-content-switcher/cv-content-switcher-button.vue +20 -4
  22. package/src/components/cv-content-switcher/cv-content-switcher.vue +3 -10
  23. package/src/components/cv-data-table/cv-data-table-row.vue +15 -11
  24. package/src/components/cv-data-table/cv-data-table.vue +30 -28
  25. package/src/components/cv-date-picker/cv-date-picker.vue +53 -47
  26. package/src/components/cv-dropdown/_cv-dropdown-inner-c10.vue +226 -0
  27. package/src/components/cv-dropdown/_cv-dropdown-inner.vue +201 -0
  28. package/src/components/cv-dropdown/cv-dropdown-item.vue +6 -8
  29. package/src/components/cv-dropdown/cv-dropdown-skeleton.vue +1 -5
  30. package/src/components/cv-dropdown/cv-dropdown.vue +22 -169
  31. package/src/components/cv-file-uploader/cv-file-uploader.vue +44 -22
  32. package/src/components/cv-inline-loading/cv-inline-loading.vue +37 -0
  33. package/src/components/cv-inline-notification/cv-inline-notification.vue +22 -19
  34. package/src/components/cv-link/cv-link.vue +1 -6
  35. package/src/components/cv-loading/cv-loading.vue +13 -4
  36. package/src/components/cv-modal/cv-modal.vue +17 -15
  37. package/src/components/cv-number-input/cv-number-input.vue +20 -32
  38. package/src/components/cv-overflow-menu/cv-overflow-menu.vue +13 -19
  39. package/src/components/cv-pagination/cv-pagination.vue +61 -42
  40. package/src/components/cv-progress/_cv-progress-step-complete.vue +3 -12
  41. package/src/components/cv-progress/cv-progress-step.vue +97 -0
  42. package/src/components/cv-progress/cv-progress.vue +68 -13
  43. package/src/components/cv-radio-button/cv-radio-button.vue +1 -0
  44. package/src/components/cv-search/cv-search.vue +144 -15
  45. package/src/components/cv-select/cv-select-option.vue +3 -1
  46. package/src/components/cv-select/cv-select.vue +147 -15
  47. package/src/components/cv-slider/cv-slider.vue +14 -43
  48. package/src/components/cv-structured-list/_cv-structured-list-item-selectable.vue +18 -6
  49. package/src/components/cv-structured-list/cv-structured-list-item.vue +1 -3
  50. package/src/components/cv-structured-list/cv-structured-list.vue +10 -2
  51. package/src/components/cv-tabs/cv-tabs.vue +31 -15
  52. package/src/components/cv-tag/cv-tag.vue +23 -13
  53. package/src/components/cv-text-area/cv-text-area.vue +23 -10
  54. package/src/components/cv-text-input/cv-text-input.vue +80 -10
  55. package/src/components/cv-tile/_cv-tile-clickable.vue +1 -5
  56. package/src/components/cv-tile/_cv-tile-expandable.vue +11 -15
  57. package/src/components/cv-tile/_cv-tile-selectable.vue +14 -3
  58. package/src/components/cv-tile/cv-tile.vue +1 -4
  59. package/src/components/cv-time-picker/cv-time-picker.vue +27 -29
  60. package/src/components/cv-toast-notification/cv-toast-notification.vue +32 -6
  61. package/src/components/cv-toggle/cv-toggle.vue +3 -7
  62. package/src/components/cv-toolbar/cv-toolbar-option.vue +1 -4
  63. package/src/components/cv-toolbar/cv-toolbar-search.vue +5 -0
  64. package/src/components/cv-tooltip/cv-definition-tooltip.vue +1 -3
  65. package/src/components/cv-tooltip/cv-interactive-tooltip.vue +13 -28
  66. package/src/components/cv-tooltip/cv-tooltip.vue +11 -15
  67. package/src/components/cv-wrapper/_cv-wrapper.js +33 -0
  68. package/src/index-components-vue.js +1 -3
  69. package/src/index.js +1 -5
  70. package/src/{_internal/_feature-flags.js → internal/feature-flags.js} +30 -2
  71. package/dist/carbon-data-viz-vue.common.js +0 -23907
  72. package/dist/carbon-data-viz-vue.common.js.map +0 -1
  73. package/dist/carbon-data-viz-vue.css +0 -1
  74. package/dist/carbon-data-viz-vue.umd.js +0 -23917
  75. package/dist/carbon-data-viz-vue.umd.js.map +0 -1
  76. package/dist/carbon-data-viz-vue.umd.min.js +0 -2
  77. package/dist/carbon-data-viz-vue.umd.min.js.map +0 -1
  78. package/src/assets/styles/_carbon-helpers.scss +0 -8
  79. package/src/components/cv-checkbox/_cv-checkbox-inner-form-item.vue +0 -19
  80. package/src/components/cv-checkbox/_cv-checkbox-inner.vue +0 -59
  81. package/src/components/cv-progress/_cv-progress-step.vue +0 -51
  82. package/src/components/cv-search/_cv-search-inner-form-item.vue +0 -22
  83. package/src/components/cv-search/_cv-search-inner.vue +0 -162
  84. package/src/components/cv-select/_cv-select-inner-form-item.vue +0 -22
  85. package/src/components/cv-select/_cv-select-inner.vue +0 -78
  86. package/src/data-viz/cv-bar-graph/cv-bar-graph.vue +0 -495
  87. package/src/data-viz/cv-gauge/cv-gauge.vue +0 -196
  88. package/src/data-viz/cv-pie-chart/cv-pie-chart.vue +0 -194
  89. package/src/index-data-viz.js +0 -29
@@ -1,194 +0,0 @@
1
- <!--
2
- Carbon Style Pie Chart
3
-
4
- Attributes:
5
- dataArray: array of arrays in the following form [['label1', value1], ['label2', value2], ..., ['labelN', valueN]]
6
- colors: array of colors that are used for pie chart parts
7
- header: text that will appear on top of this pie chart (optional)
8
-
9
- Usage:
10
- <cv-pie-chart
11
- :dataArray="[['Gryffindor', 23],['Slytherin', 12],['Ravenclaw', 19],['Hufflepuff', 15],['Teachers', 5]]"
12
- :colors="['#3b1a40', '#473793', '#3c6df0', '#00a68f', '#56D2BB']"
13
- header="Example Pie Chart">
14
- </cv-pie-chart>
15
-
16
- -->
17
-
18
- <template>
19
- <div class="cv-pie-chart">
20
- <h2 class="bx--graph-header">{{ header }}</h2>
21
- <div class="cv-pie-chart__container">
22
- <svg :width="width" :height="height">
23
- <g></g>
24
- </svg>
25
- <div class="cv-pie-chart__tooltip">
26
- <p class="cv-pie-chart__amount"></p>
27
- <p class="cv-pie-chart__item"></p>
28
- </div>
29
- </div>
30
- </div>
31
- </template>
32
-
33
- <script>
34
- import * as d3 from 'd3';
35
-
36
- const radius = 96;
37
-
38
- const pie = d3
39
- .pie()
40
- .sort(null)
41
- .value(d => d[1]);
42
-
43
- const path = d3
44
- .arc()
45
- .outerRadius(radius - 10)
46
- .innerRadius(radius - 40);
47
-
48
- const pathTwo = d3
49
- .arc()
50
- .outerRadius(radius)
51
- .innerRadius(radius - 40);
52
-
53
- export default {
54
- name: 'CvPieChart',
55
- props: {
56
- dataArray: {
57
- type: Array,
58
- default: () => [
59
- ['Gryffindor', 23],
60
- ['Slytherin', 12],
61
- ['Ravenclaw', 19],
62
- ['Hufflepuff', 15],
63
- ['Teachers', 5],
64
- ],
65
- },
66
- colors: {
67
- type: Array,
68
- default: () => ['#3b1a40', '#473793', '#3c6df0', '#00a68f', '#56D2BB'],
69
- },
70
- header: {
71
- type: String,
72
- default: '',
73
- },
74
- },
75
- data: function() {
76
- return {
77
- g: null,
78
- scaledColors: null,
79
- width: radius * 2, // TODO
80
- height: radius * 2, // TODO
81
- };
82
- },
83
- watch: {
84
- dataArray(newVal) {
85
- this.dataArray = newVal;
86
- this.$nextTick(() => {
87
- this.visualizePieChart();
88
- });
89
- },
90
- colors(newVal) {
91
- this.colors = newVal;
92
- this.scaledColors = d3.scaleOrdinal(newVal);
93
- this.$nextTick(() => {
94
- this.visualizePieChart();
95
- });
96
- },
97
- },
98
- methods: {
99
- visualizePieChart() {
100
- this.g.selectAll('*').remove();
101
-
102
- const arc = this.g
103
- .selectAll('.arc')
104
- .data(pie(this.dataArray))
105
- .enter()
106
- .append('g')
107
- .attr('class', 'arc');
108
-
109
- arc
110
- .append('path')
111
- .attr('d', path)
112
- .attr('fill', (d, i) => this.scaledColors(i))
113
- .attr('stroke-width', 2)
114
- .attr('stroke', '#FFFFFF')
115
- .on('mouseover', function(d) {
116
- d3.select(this)
117
- .transition()
118
- .style('cursor', 'pointer')
119
- .attr('d', pathTwo);
120
-
121
- d3.select('.cv-pie-chart__tooltip').style('display', 'inherit');
122
-
123
- const amount = d3.select('.cv-pie-chart__amount');
124
- const item = d3.select('.cv-pie-chart__item');
125
-
126
- amount.text(`${d.data[1]}`);
127
-
128
- item.text(`${d.data[0]}`);
129
- })
130
- .on('mouseout', function() {
131
- d3.select('.cv-pie-chart__tooltip').style('display', 'none');
132
-
133
- d3.select(this)
134
- .transition()
135
- .attr('d', path);
136
- });
137
- },
138
- },
139
- mounted() {
140
- console.warn(
141
- `${
142
- this.$vnode.componentOptions.Ctor.extendOptions.name
143
- } - Under review. This component isn't quite ready. Hopefully no features will get broken but this cannot be guarenteed.`
144
- );
145
-
146
- this.g = d3
147
- .select('g')
148
- .attr('transform', `translate(${this.width / 2}, ${this.height / 2})`);
149
-
150
- this.scaledColors = d3.scaleOrdinal(this.colors);
151
- this.visualizePieChart();
152
- },
153
- };
154
- </script>
155
-
156
- <style lang="scss">
157
- .bx--graph-header {
158
- font-weight: 300;
159
- font-size: 24px;
160
- }
161
-
162
- .cv-pie-chart__container {
163
- display: inline-block;
164
- position: relative;
165
- }
166
-
167
- .cv-pie-chart__tooltip {
168
- position: absolute;
169
- top: 50%;
170
- left: 50%;
171
- transform: translate(-50%, -50%);
172
- display: flex;
173
- flex-direction: column;
174
- justify-content: center;
175
- pointer-events: none;
176
- width: 100%;
177
-
178
- p {
179
- text-align: center;
180
- }
181
-
182
- .cv-pie-chart__amount {
183
- font-size: 29px;
184
- line-height: 1;
185
- font-weight: 300;
186
- }
187
-
188
- .cv-pie-chart__item {
189
- font-weight: 400;
190
- font-size: 14px;
191
- color: #5a6872;
192
- }
193
- }
194
- </style>
@@ -1,29 +0,0 @@
1
- const ctx = require.context(
2
- './data-viz/',
3
- true,
4
- /^(?!.*(?:\/_|-story\.vue|-test\.vue)).*\.vue$/
5
- );
6
- const components = ctx.keys().map(ctx);
7
-
8
- export default {
9
- // options is an array of components to be registered
10
- // e.g. ['c-button', 'c-modal']
11
- install(Vue, options) {
12
- if (typeof options === 'undefined') {
13
- for (let c of components) {
14
- Vue.component(c.default.name, c.default);
15
- }
16
- } else {
17
- if (!(options instanceof Array)) {
18
- throw new TypeError('options must be an array');
19
- }
20
-
21
- for (let c of components) {
22
- // register only components specified in the options
23
- if (options.includes(c.default.name)) {
24
- Vue.component(c.default.name, c.default);
25
- }
26
- }
27
- }
28
- },
29
- };