@carbon/vue 1.0.0 → 1.1.1

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 (59) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +9 -156
  3. package/dist/carbon-data-viz-vue.common.js +6 -6
  4. package/dist/carbon-data-viz-vue.common.js.map +1 -1
  5. package/dist/carbon-data-viz-vue.css +1 -1
  6. package/dist/carbon-data-viz-vue.umd.js +6 -6
  7. package/dist/carbon-data-viz-vue.umd.js.map +1 -1
  8. package/dist/carbon-data-viz-vue.umd.min.js.map +1 -1
  9. package/dist/carbon-vue.common.js +8807 -4866
  10. package/dist/carbon-vue.common.js.map +1 -1
  11. package/dist/carbon-vue.umd.js +8807 -4866
  12. package/dist/carbon-vue.umd.js.map +1 -1
  13. package/dist/carbon-vue.umd.min.js +4 -4
  14. package/dist/carbon-vue.umd.min.js.map +1 -1
  15. package/dist/demo.html +2 -2
  16. package/package.json +21 -8
  17. package/src/_internal/_feature-flags.js +42 -0
  18. package/src/components/cv-accordion/_cv-accordion-item-skeleton.vue +10 -0
  19. package/src/components/cv-accordion/cv-accordion-item.vue +6 -0
  20. package/src/components/cv-button/cv-button.vue +32 -3
  21. package/src/components/cv-checkbox/_cv-checkbox-inner-form-item.vue +1 -1
  22. package/src/components/cv-checkbox/_cv-checkbox-inner.vue +1 -0
  23. package/src/components/cv-checkbox/cv-checkbox-skeleton.vue +13 -0
  24. package/src/components/cv-code-snippet/_cv-code-snippet-multiline.vue +10 -0
  25. package/src/components/cv-code-snippet/_cv-code-snippet-oneline.vue +10 -0
  26. package/src/components/cv-code-snippet/cv-code-snippet-skeleton.vue +29 -0
  27. package/src/components/cv-code-snippet/cv-code-snippet.vue +1 -1
  28. package/src/components/cv-content-switcher/cv-content-switcher-button.vue +28 -1
  29. package/src/components/cv-content-switcher/cv-content-switcher.vue +1 -1
  30. package/src/components/cv-data-table/cv-data-table.vue +54 -18
  31. package/src/components/cv-date-picker/_cv-date-picker-inner-c10.vue +220 -0
  32. package/src/components/cv-date-picker/_cv-date-picker-inner.vue +231 -0
  33. package/src/components/cv-date-picker/cv-date-picker.vue +17 -216
  34. package/src/components/cv-dropdown/_cv-dropdown-inner-c10.vue +201 -0
  35. package/src/components/cv-dropdown/_cv-dropdown-inner-form-item.vue +22 -0
  36. package/src/components/cv-dropdown/_cv-dropdown-inner.vue +213 -0
  37. package/src/components/cv-dropdown/cv-dropdown-item.vue +4 -0
  38. package/src/components/cv-dropdown/cv-dropdown-skeleton.vue +18 -0
  39. package/src/components/cv-dropdown/cv-dropdown.vue +20 -167
  40. package/src/components/cv-file-uploader/cv-file-uploader-skeleton.vue +22 -0
  41. package/src/components/cv-file-uploader/cv-file-uploader.vue +48 -8
  42. package/src/components/cv-inline-loader/cv-inline-loader.vue +42 -0
  43. package/src/components/cv-inline-notification/cv-inline-notification.vue +25 -7
  44. package/src/components/cv-loading/cv-loading.vue +18 -1
  45. package/src/components/cv-modal/cv-modal.vue +17 -6
  46. package/src/components/cv-number-input/cv-number-input.vue +9 -2
  47. package/src/components/cv-overflow-menu/cv-overflow-menu.vue +17 -15
  48. package/src/components/cv-pagination/cv-pagination.vue +2 -2
  49. package/src/components/cv-radio-button/cv-radio-button.vue +1 -0
  50. package/src/components/cv-slider/cv-slider.vue +6 -6
  51. package/src/components/cv-structured-list/_cv-structured-list-item-selectable.vue +1 -0
  52. package/src/components/cv-tabs/cv-tabs.vue +22 -11
  53. package/src/components/cv-text-input/cv-text-input.vue +70 -0
  54. package/src/components/cv-toast-notification/cv-toast-notification.vue +35 -0
  55. package/src/components/cv-tooltip/cv-interactive-tooltip.vue +4 -4
  56. package/src/data-viz/cv-bar-graph/cv-bar-graph.vue +7 -4
  57. package/src/data-viz/cv-gauge/cv-gauge.vue +1 -1
  58. package/src/data-viz/cv-pie-chart/cv-pie-chart.vue +8 -7
  59. package/src/components/cv-data-table/_cv-data-table-temp.vue +0 -669
@@ -22,7 +22,42 @@
22
22
  :value="value"
23
23
  v-on="inputListeners"
24
24
  :data-invalid="isInvalid"
25
+ :data-toggle-password-visibility="isPassword"
26
+ :type="dataType"
27
+ ref="input"
25
28
  />
29
+ <button
30
+ v-if="isPassword"
31
+ class="bx--text-input--password__visibility bx--tooltip__trigger bx--tooltip--icon__bottom"
32
+ :aria-label="isPasswordVisible ? 'Hide password' : 'Show password'"
33
+ @click="togglePasswordVisibility"
34
+ >
35
+ <svg
36
+ v-if="isPasswordVisible"
37
+ class="icon--visibility-off"
38
+ width="16"
39
+ height="16"
40
+ viewBox="0 0 16 16"
41
+ >
42
+ <path
43
+ d="M11.846 3.45L15.293.007 16 .714l-3.284 3.281c1.261.902 2.377 2.212 3.347 3.93C14.02 11.642 11.333 13.5 8 13.5c-1.392 0-2.667-.324-3.822-.973L.703 16l-.706-.708 3.323-3.32C2.071 11.042.976 9.694.035 7.924 2.012 4.308 4.667 2.5 8 2.5c1.395 0 2.677.317 3.846.95zm-6.928 8.338c.944.477 1.97.712 3.082.712 2.795 0 5.076-1.483 6.907-4.568-.866-1.417-1.833-2.486-2.91-3.219l-1.55 1.55a3 3 0 0 1-4.185 4.182l-1.344 1.343zm-.882-.533l1.518-1.517A3 3 0 0 1 9.74 5.556l1.364-1.363A7.02 7.02 0 0 0 8 3.5c-2.798 0-5.047 1.439-6.819 4.432.842 1.465 1.792 2.568 2.855 3.323zm2.948-1.532a2 2 0 0 0 2.74-2.738l-2.74 2.738zm-.707-.707l2.74-2.738a2 2 0 0 0-2.74 2.738z"
44
+ ></path>
45
+ </svg>
46
+ <svg
47
+ v-else
48
+ class="icon--visibility-on"
49
+ width="16"
50
+ height="16"
51
+ viewBox="0 0 16 11"
52
+ >
53
+ <path
54
+ d="M8 7.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 1c-1.7 0-3-1.3-3-3s1.3-3 3-3 3 1.3 3 3-1.3 3-3 3z"
55
+ ></path>
56
+ <path
57
+ d="M8 10c2.8 0 5.1-1.5 6.9-4.6C13.1 2.5 10.8 1 8 1 5.2 1 3 2.4 1.2 5.4 2.9 8.6 5.2 10 8 10zM8 0c3.3 0 6 1.8 8.1 5.4C14 9.2 11.3 11 8 11S2 9.2 0 5.5C2 1.9 4.6 0 8 0z"
58
+ ></path>
59
+ </svg>
60
+ </button>
26
61
  <div class="bx--form-requirement" v-if="isInvalid">
27
62
  <slot name="invalid-message">{{ invalidMessage }}</slot>
28
63
  </div>
@@ -41,9 +76,27 @@ export default {
41
76
  helperText: { type: String, default: null },
42
77
  invalidMessage: { type: String, default: null },
43
78
  label: String,
79
+ passwordVisible: Boolean,
44
80
  theme: String,
81
+ type: String,
45
82
  value: String,
46
83
  },
84
+ data() {
85
+ return {
86
+ dataPasswordVisible: this.isPassword && this.passwordVisible,
87
+ dataType: this.type,
88
+ };
89
+ },
90
+ watch: {
91
+ passwordVisible() {
92
+ if (this.passwordVisible !== this.dataPasswordVisible) {
93
+ this.togglePasswordVisibility();
94
+ }
95
+ },
96
+ type() {
97
+ this.dataType = this.type;
98
+ },
99
+ },
47
100
  computed: {
48
101
  // Bind listeners at the component level to the embedded input element and
49
102
  // add our own input listener to service the v-model. See:
@@ -66,6 +119,23 @@ export default {
66
119
  (this.helperText && this.helperText.length)
67
120
  );
68
121
  },
122
+ isPassword() {
123
+ return this.type === 'password';
124
+ },
125
+ isPasswordVisible() {
126
+ return this.isPassword && this.dataPasswordVisible;
127
+ },
128
+ },
129
+ methods: {
130
+ togglePasswordVisibility() {
131
+ const currentValue = this.$refs.input.value;
132
+ this.dataPasswordVisible = !this.dataPasswordVisible;
133
+ this.dataType = this.dataPasswordVisible ? 'text' : 'password';
134
+
135
+ this.$nextTick(() => {
136
+ this.$refs.input.value = currentValue;
137
+ });
138
+ },
69
139
  },
70
140
  };
71
141
  </script>
@@ -7,6 +7,11 @@
7
7
  :aria-role="isAlert ? 'alert' : false"
8
8
  :aria-live="!isAlert ? 'polite' : false"
9
9
  >
10
+ <component
11
+ v-if="componentsX"
12
+ :is="icon"
13
+ class="bx--toast-notification__icon"
14
+ />
10
15
  <div class="bx--toast-notification__details">
11
16
  <h3 class="bx--toast-notification__title">{{ title }}</h3>
12
17
  <p class="bx--toast-notification__subtitle">{{ subTitle }}</p>
@@ -18,7 +23,9 @@
18
23
  class="bx--toast-notification__close-button"
19
24
  @click="$emit('close')"
20
25
  >
26
+ <Close16 v-if="componentsX" class="bx--toast-notification__close-icon" />
21
27
  <svg
28
+ v-else
22
29
  class="bx--toast-notification-icon"
23
30
  aria-label="close"
24
31
  width="10"
@@ -37,9 +44,20 @@
37
44
 
38
45
  <script>
39
46
  import notificationMixin from '../../mixins/notification-mixin';
47
+ import { componentsX } from '../../_internal/_feature-flags';
48
+ import ErrorFilled16 from '@carbon/icons-vue/lib/error--filled/16';
49
+ import CheckmarkFilled16 from '@carbon/icons-vue/lib/checkmark--filled/16';
50
+ import WarningAltFilled16 from '@carbon/icons-vue/lib/warning--alt--filled/16';
51
+ import Close16 from '@carbon/icons-vue/lib/close/16';
40
52
 
41
53
  export default {
42
54
  name: 'CvToastNotification',
55
+ components: { Close16 },
56
+ data() {
57
+ return {
58
+ componentsX,
59
+ };
60
+ },
43
61
  mixins: [notificationMixin],
44
62
  props: {
45
63
  caption: String,
@@ -49,6 +67,23 @@ export default {
49
67
  validator: val => ['error', 'info', 'warning', 'success'].includes(val),
50
68
  },
51
69
  },
70
+ computed: {
71
+ icon() {
72
+ if (this.componentsX) {
73
+ switch (this.kind) {
74
+ case 'error':
75
+ return ErrorFilled16;
76
+ case 'warning':
77
+ return WarningAltFilled16;
78
+ case 'success':
79
+ return CheckmarkFilled16;
80
+ default:
81
+ return null;
82
+ }
83
+ }
84
+ return null;
85
+ },
86
+ },
52
87
  };
53
88
  </script>
54
89
 
@@ -51,7 +51,7 @@
51
51
  class="cv-interactive-tooltip__before-content"
52
52
  ref="beforeContent"
53
53
  tabindex="0"
54
- style="position: absolute; height: 1px; width: 1px; left: -9999px"
54
+ style="position: absolute; height: 1px; width: 1px; left: -9999px;"
55
55
  @focus="focusBeforeContent"
56
56
  />
57
57
  <span class="bx--tooltip__caret"></span>
@@ -60,7 +60,7 @@
60
60
  class="cv-interactive-tooltip__after-content"
61
61
  ref="afterContent"
62
62
  tabindex="0"
63
- style="position: absolute; height: 1px; width: 1px; left: -9999px"
63
+ style="position: absolute; height: 1px; width: 1px; left: -9999px;"
64
64
  @focus="focusAfterContent"
65
65
  />
66
66
  </div>
@@ -168,10 +168,10 @@ export default {
168
168
  this.dataVisible = true;
169
169
  this.positionListen(true);
170
170
 
171
- setTimeout(() => {
171
+ this.$nextTick(() => {
172
172
  this.position();
173
173
  this.$refs.trigger.focus();
174
- }, 1);
174
+ });
175
175
  },
176
176
  hide() {
177
177
  this.dataVisible = false;
@@ -399,10 +399,12 @@ $color-text: #5a6872;
399
399
  .cv-bar-graph__y-axis {
400
400
  font-family: 'ibm-plex-sans';
401
401
 
402
+ /* stylelint-disable-next-line selector-max-type */
402
403
  .tick line {
403
404
  stroke: $color-text;
404
405
  }
405
406
 
407
+ /* stylelint-disable-next-line selector-max-type */
406
408
  .tick text {
407
409
  fill: $color-text;
408
410
  font-size: 10px;
@@ -413,6 +415,7 @@ $color-text: #5a6872;
413
415
  .cv-bar-graph__y-axis {
414
416
  stroke-dasharray: 4;
415
417
 
418
+ /* stylelint-disable-next-line selector-max-type */
416
419
  path {
417
420
  display: none;
418
421
  }
@@ -474,12 +477,12 @@ $color-text: #5a6872;
474
477
  padding: 0.25rem 0.5rem;
475
478
  transform: translate(-50%, -100%);
476
479
  border: 1px solid $color__gray-1;
477
- font-weight: 700;
478
480
  background-color: #fff;
479
481
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
482
+ font-weight: 700;
480
483
  pointer-events: none;
481
484
 
482
- &:after {
485
+ &::after {
483
486
  content: '';
484
487
  position: absolute;
485
488
  top: 100%;
@@ -487,9 +490,9 @@ $color-text: #5a6872;
487
490
  width: 0;
488
491
  height: 0;
489
492
  transform: translateX(-50%);
490
- border-left: 5px solid transparent;
491
- border-right: 5px solid transparent;
492
493
  border-top: 5px solid #fff;
494
+ border-right: 5px solid transparent;
495
+ border-left: 5px solid transparent;
493
496
  }
494
497
  }
495
498
  </style>
@@ -161,8 +161,8 @@ export default {
161
161
 
162
162
  <style lang="scss">
163
163
  .bx--graph-header {
164
- font-weight: 300;
165
164
  font-size: 24px;
165
+ font-weight: 300;
166
166
  }
167
167
 
168
168
  .cv-gauge__container {
@@ -155,8 +155,8 @@ export default {
155
155
 
156
156
  <style lang="scss">
157
157
  .bx--graph-header {
158
- font-weight: 300;
159
158
  font-size: 24px;
159
+ font-weight: 300;
160
160
  }
161
161
 
162
162
  .cv-pie-chart__container {
@@ -165,30 +165,31 @@ export default {
165
165
  }
166
166
 
167
167
  .cv-pie-chart__tooltip {
168
+ display: flex;
168
169
  position: absolute;
169
170
  top: 50%;
170
171
  left: 50%;
171
- transform: translate(-50%, -50%);
172
- display: flex;
173
172
  flex-direction: column;
174
173
  justify-content: center;
175
- pointer-events: none;
176
174
  width: 100%;
175
+ transform: translate(-50%, -50%);
176
+ pointer-events: none;
177
177
 
178
+ /* stylelint-disable-next-line selector-max-type */
178
179
  p {
179
180
  text-align: center;
180
181
  }
181
182
 
182
183
  .cv-pie-chart__amount {
183
184
  font-size: 29px;
184
- line-height: 1;
185
185
  font-weight: 300;
186
+ line-height: 1;
186
187
  }
187
188
 
188
189
  .cv-pie-chart__item {
189
- font-weight: 400;
190
- font-size: 14px;
191
190
  color: #5a6872;
191
+ font-size: 14px;
192
+ font-weight: 400;
192
193
  }
193
194
  }
194
195
  </style>