@avakhula/ui 0.1.13 → 0.1.15

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 (116) hide show
  1. package/.prettierrc.json +0 -0
  2. package/.storybook/intelliboardTheme.js +0 -0
  3. package/.storybook/manager.js +0 -0
  4. package/.storybook/scss-loader.scss +0 -0
  5. package/.storybook/withSource.js +0 -0
  6. package/README.md +0 -0
  7. package/dist/index.js +9028 -7513
  8. package/dist/index.umd.cjs +76 -73
  9. package/dist/style.css +1 -1
  10. package/index.html +0 -0
  11. package/package.json +4 -3
  12. package/src/App.vue +5 -128
  13. package/src/EventEmmiter.js +0 -0
  14. package/src/assets/scss/mixins/dropdown-list-item.scss +13 -1
  15. package/src/assets/scss/mixins.scss +0 -0
  16. package/src/assets/scss/reset.scss +0 -0
  17. package/src/assets/scss/style.scss +0 -0
  18. package/src/assets/scss/typography.scss +0 -0
  19. package/src/components/Alert/Alert.vue +5 -0
  20. package/src/components/Alert/alert.scss +6 -1
  21. package/src/components/Avatar/Avatar.stories.js +5 -1
  22. package/src/components/Avatar/Avatar.vue +25 -2
  23. package/src/components/Avatar/constants.js +6 -0
  24. package/src/components/Badge/Badge.stories.js +0 -0
  25. package/src/components/Breadcrumbs/Breadcrumbs.vue +17 -7
  26. package/src/components/Button/Button.stories.js +0 -0
  27. package/src/components/Button/Button.vue +19 -3
  28. package/src/components/Button/button.scss +5 -0
  29. package/src/components/Button/constants.js +0 -0
  30. package/src/components/ButtonGroup/ButtonGroup.vue +0 -0
  31. package/src/components/Chips/Chips.stories.js +30 -0
  32. package/src/components/Chips/Chips.vue +125 -0
  33. package/src/components/Dropdown/Dropdown.spec.js +0 -0
  34. package/src/components/Dropdown/DropdownDivider.vue +0 -0
  35. package/src/components/Dropdown/DropdownItem.vue +26 -4
  36. package/src/components/Dropdown/DropdownList.vue +0 -0
  37. package/src/components/Dropdown/constants.js +0 -0
  38. package/src/components/Form/CharactersCount.vue +10 -7
  39. package/src/components/Form/Checkbox/Checkbox.vue +25 -11
  40. package/src/components/Form/CheckboxGroup/CheckboxGroup.vue +15 -0
  41. package/src/components/Form/CheckboxGroup/readme.mdx +2 -0
  42. package/src/components/Form/DatePicker/DatePicker.scss +352 -261
  43. package/src/components/Form/DatePicker/DatePicker.vue +72 -17
  44. package/src/components/Form/DatePicker/Icons/chevron-back.js +0 -0
  45. package/src/components/Form/DatePicker/Icons/chevron-forward.js +0 -0
  46. package/src/components/Form/FormGroup/FormGroup.stories.js +0 -0
  47. package/src/components/Form/FormGroup/FormGroup.vue +3 -3
  48. package/src/components/Form/FormGroup/FormGroupSet.stories.js +0 -0
  49. package/src/components/Form/FormGroup/FormGroupSet.vue +0 -0
  50. package/src/components/Form/Input/Input.vue +116 -13
  51. package/src/components/Form/Input/input.scss +61 -2
  52. package/src/components/Form/Label/Label.vue +22 -10
  53. package/src/components/Form/PhoneInput/PhoneInput.vue +26 -12
  54. package/src/components/Form/PhoneInput/phoneInput.scss +38 -6
  55. package/src/components/Form/Radio/Radio.vue +16 -44
  56. package/src/components/Form/Radio/radio.scss +5 -2
  57. package/src/components/Form/TextEditor/TextEditor.vue +117 -22
  58. package/src/components/Form/TextEditor/icons/svg/chevron-down.svg +0 -0
  59. package/src/components/Form/TextEditor/icons/toolbarIcons.js +0 -0
  60. package/src/components/Form/TextEditor/plugins/alphabetList.js +0 -0
  61. package/src/components/Form/TextEditor/textEditor.scss +56 -32
  62. package/src/components/Form/Textarea/Textarea.spec.js +0 -0
  63. package/src/components/Form/Textarea/Textarea.vue +19 -6
  64. package/src/components/Form/Textarea/textarea.scss +30 -2
  65. package/src/components/Icon.vue +0 -0
  66. package/src/components/IconButton/IconButton.scss +11 -0
  67. package/src/components/IconButton/IconButton.stories.js +0 -0
  68. package/src/components/IconButton/IconButton.vue +6 -9
  69. package/src/components/IconButton/constants.js +0 -0
  70. package/src/components/Modal/Modal.vue +42 -9
  71. package/src/components/Pagination/LimitSelector.vue +5 -0
  72. package/src/components/Pagination/Pagination.stories.js +0 -0
  73. package/src/components/Pagination/Pagination.vue +9 -2
  74. package/src/components/Panel/Panel.vue +87 -6
  75. package/src/components/Popover/Popover.stories.js +0 -0
  76. package/src/components/Popover/Popover.vue +47 -19
  77. package/src/components/Popover/popover.scss +27 -7
  78. package/src/components/ProgressBar/ProgressBar.stories.js +0 -0
  79. package/src/components/Sorting/Sorting.vue +24 -26
  80. package/src/components/Sorting/constants.js +0 -0
  81. package/src/components/SplitButton/SplitButton.vue +51 -8
  82. package/src/components/SplitButton/SplitButtonItem.vue +13 -1
  83. package/src/components/SplitButton/constants.js +0 -0
  84. package/src/components/Table/Cells/Cell.vue +0 -0
  85. package/src/components/Table/Cells/CheckboxCell.vue +0 -0
  86. package/src/components/Table/Row.vue +0 -0
  87. package/src/components/Table/Table.stories.js +0 -0
  88. package/src/components/Table/Table.vue +0 -0
  89. package/src/components/Tabs/Tab.vue +4 -0
  90. package/src/components/Tabs/Tabs.vue +5 -0
  91. package/src/components/Tabs/tabs.scss +8 -2
  92. package/src/components/TagPill/TagPill.vue +6 -0
  93. package/src/components/TagPill/constants.js +0 -0
  94. package/src/components/ToggleTip/ToggleTip.stories.js +0 -0
  95. package/src/components/ToggleTip/ToggleTip.vue +0 -0
  96. package/src/components/Tooltip/Tooltip.stories.js +0 -0
  97. package/src/components/Tooltip/Tooltip.vue +1 -1
  98. package/src/components/TreeSelect/Option.vue +48 -16
  99. package/src/components/TreeSelect/Select.vue +101 -39
  100. package/src/components/TreeSelect/mixins/InfinityLoaderMixin.js +40 -0
  101. package/src/components/TreeSelect/scss/option.scss +31 -0
  102. package/src/components/TreeSelect/scss/select.scss +48 -2
  103. package/src/constants/events.js +0 -0
  104. package/src/constants/keyCodes.js +1 -0
  105. package/src/directives/outside/outside.js +0 -0
  106. package/src/directives/tooltip/TooltipController.js +2 -0
  107. package/src/directives/tooltip/textOverflowTooltip.js +3 -1
  108. package/src/directives/tooltip/tooltip.js +15 -0
  109. package/src/helpers/generateUID.js +0 -0
  110. package/src/helpers/getHrefFromID.js +0 -0
  111. package/src/helpers/multiLineOverflows.js +0 -0
  112. package/src/helpers/stripHtml.js +4 -0
  113. package/src/index.js +2 -0
  114. package/src/stories/link.stories.js +0 -0
  115. package/static/Logo.svg +0 -0
  116. package/vite.config.js +0 -0
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <div
3
- class="flatpickr-wrapper"
3
+ class="ib-flatpickr-wrapper"
4
4
  :class="{
5
5
  'has-labels': label.length || endDateLabel.length,
6
6
  'has-label': label.length,
7
7
  'has-error': errorMessage.length,
8
+ 'is-disabled': disabled,
8
9
  'is-range': mode === 'range',
9
10
  }"
10
11
  >
@@ -12,17 +13,22 @@
12
13
  errorMessage
13
14
  }}</ib-alert>
14
15
 
15
- <div class="inputs-wrapper">
16
+ <div ref="inputsWrapper" class="inputs-wrapper">
16
17
  <div class="input-group-wrapper">
17
18
  <ib-label class="label" v-if="label.length" :required="required">
18
19
  {{ label }}
19
20
  </ib-label>
20
21
  <div class="input-wrapper" @click="open" :class="{ active: isOpen }">
21
- <input
22
- :placeholder="placeholder"
23
- ref="date"
24
- class="date-picker-input"
25
- />
22
+ <label :aria-label="ariaLabel">
23
+ <input
24
+ :placeholder="placeholder"
25
+ :name="name"
26
+ ref="date"
27
+ id="date"
28
+ :disabled="disabled"
29
+ class="date-picker-input"
30
+ />
31
+ </label>
26
32
 
27
33
  <ib-icon name="today-outline" class="calendar-icon" />
28
34
  </div>
@@ -46,12 +52,14 @@
46
52
  @click="openEndDate"
47
53
  :class="{ active: isOpenEndDate }"
48
54
  >
49
- <input
50
- class="date-picker-input"
51
- :placeholder="placeholder"
52
- ref="toDate"
53
- />
54
-
55
+ <label :aria-label="endDateAriaLabel">
56
+ <input
57
+ class="date-picker-input"
58
+ :placeholder="endDatePlaceholder"
59
+ ref="toDate"
60
+ @keydown="onKeydownEndField"
61
+ />
62
+ </label>
55
63
  <ib-icon name="today-outline" class="calendar-icon" />
56
64
  </div>
57
65
 
@@ -73,7 +81,7 @@ import "flatpickr/dist/flatpickr.css";
73
81
  import rangePlugin from "flatpickr/dist/plugins/rangePlugin";
74
82
  import chevronBackIcon from "./Icons/chevron-back";
75
83
  import chevronForwardIcon from "./Icons/chevron-forward";
76
- import { ESC_KEY_CODE } from "../../../constants/keyCodes";
84
+ import { ESC_KEY_CODE, BACKSPACE_KEY_CODE } from "../../../constants/keyCodes";
77
85
 
78
86
  export const SINGLE_MODE = "single";
79
87
  export const RANGE_MODE = "range";
@@ -90,6 +98,10 @@ export default {
90
98
  type: String,
91
99
  default: "",
92
100
  },
101
+ endDatePlaceholder: {
102
+ type: String,
103
+ default: "",
104
+ },
93
105
  required: {
94
106
  type: Boolean,
95
107
  default: false,
@@ -102,6 +114,14 @@ export default {
102
114
  type: String,
103
115
  default: SINGLE_MODE,
104
116
  },
117
+ ariaLabel: {
118
+ type: String,
119
+ default: "",
120
+ },
121
+ endDateAriaLabel: {
122
+ type: String,
123
+ default: "",
124
+ },
105
125
  label: {
106
126
  type: String,
107
127
  default: "",
@@ -122,9 +142,14 @@ export default {
122
142
  type: String,
123
143
  default: "",
124
144
  },
145
+ disabled: {
146
+ type: Boolean,
147
+ default: false,
148
+ }
125
149
  },
126
150
  mounted() {
127
151
  document.addEventListener("keyup", this.onDocumentKeyDown, true);
152
+ this.$refs.inputsWrapper.addEventListener("keyup", this.backspaceHandler);
128
153
 
129
154
  this.$nextTick(() => {
130
155
  this.initFlatpickr();
@@ -137,8 +162,22 @@ export default {
137
162
  value() {
138
163
  this.initFlatpickr();
139
164
  },
165
+ disabled() {
166
+ this.$nextTick(() => {
167
+ this.initFlatpickr();
168
+ });
169
+ },
140
170
  modelValue() {
141
- this.initFlatpickr();
171
+ if (JSON.stringify(this.modelValue) === JSON.stringify(this.data)) return;
172
+
173
+ let value;
174
+ if (Array.isArray(this.modelValue)) {
175
+ value = this.modelValue[0] && this.modelValue[1] ? this.modelValue : [];
176
+ } else {
177
+ value = this.modelValue;
178
+ }
179
+
180
+ this.flat?.setDate(value, true);
142
181
  },
143
182
  },
144
183
  data() {
@@ -196,7 +235,7 @@ export default {
196
235
  if (this.mode === RANGE_MODE) {
197
236
  defaultConfig.defaultDate = this.modelValue.length
198
237
  ? [this.modelValue[0], this.modelValue[1]]
199
- : [this.value[0], this.value[1]];
238
+ : [this.value?.[0], this.value?.[1]];
200
239
  } else {
201
240
  defaultConfig.defaultDate = this.modelValue
202
241
  ? this.modelValue
@@ -213,6 +252,7 @@ export default {
213
252
  this.$nextTick(() => {
214
253
  this.isOpen = false;
215
254
  this.isOpenEndDate = false;
255
+ this.$emit("blur");
216
256
  });
217
257
  },
218
258
  onChange(value) {
@@ -224,7 +264,18 @@ export default {
224
264
  },
225
265
  onDocumentKeyDown(e) {
226
266
  if (e.keyCode === ESC_KEY_CODE) {
227
- this.close();
267
+ this.onClose();
268
+ }
269
+ },
270
+ onKeydownEndField(e) {
271
+ if (e.key === "ArrowDown") {
272
+ this.flat.selectedDateElem.focus();
273
+ }
274
+ },
275
+ backspaceHandler(e) {
276
+ if(e.keyCode === BACKSPACE_KEY_CODE) {
277
+ this.$emit("input", "");
278
+ this.$emit("update:modelValue", '');
228
279
  }
229
280
  },
230
281
  triggerChange() {
@@ -247,6 +298,8 @@ export default {
247
298
  this.$emit("input", this.data);
248
299
  this.$emit("update:modelValue", this.data);
249
300
  }
301
+
302
+ this.$emit("blur");
250
303
  }
251
304
  });
252
305
  },
@@ -271,12 +324,14 @@ export default {
271
324
  },
272
325
  beforeUnmount() {
273
326
  document.removeEventListener("keyup", this.onDocumentKeyDown);
327
+ this.$refs.inputsWrapper.removeEventListener("keyup", this.backspaceHandler);
274
328
  },
275
329
  components: {
276
330
  IbIcon,
277
331
  IbLabel,
278
332
  IbAlert,
279
333
  },
334
+ emits: ["input", "update:modelValue"],
280
335
  };
281
336
  </script>
282
337
  <style lang="scss">
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="ib-form-group" :class="{ disable: disable }">
2
+ <div class="ib-form-group" :class="{ disabled: disabled }">
3
3
  <slot></slot>
4
4
  <p class="support-text" v-if="supportText.length">{{ supportText }}</p>
5
5
  </div>
@@ -13,7 +13,7 @@ export default {
13
13
  type: String,
14
14
  default: "",
15
15
  },
16
- disable: {
16
+ disabled: {
17
17
  type: Boolean,
18
18
  default: false,
19
19
  },
@@ -34,7 +34,7 @@ export default {
34
34
  margin-top: 5px;
35
35
  }
36
36
 
37
- &.disable {
37
+ &.disabled {
38
38
  .support-text {
39
39
  color: $neutral-500;
40
40
  }
File without changes
@@ -2,18 +2,29 @@
2
2
  <div>
3
3
  <ib-alert v-if="errorMessage">{{ errorMessage }}</ib-alert>
4
4
 
5
- <div class="ib-input-wrapper" :class="{ 'has-settings': hasSettings }">
5
+ <div
6
+ class="ib-input-wrapper"
7
+ :class="{
8
+ 'has-settings': hasSettings,
9
+ 'success': isSuccess,
10
+ 'numbers-type': type === 'number' && !hideNumberActions,
11
+ }"
12
+ >
6
13
  <ib-icon v-if="showIcon" class="icon-search" name="search-outline" />
7
14
 
8
15
  <input
9
16
  v-bind="attrs"
10
- v-model="actualValue"
17
+ v-model.trim="actualValue"
11
18
  ref="field"
12
19
  :aria-invalid="hasErrorState ? true : false"
13
20
  :readonly="readonly"
14
21
  :disabled="disabled"
15
22
  :id="id"
23
+ :autocomplete="autocomplete"
16
24
  :class="classes"
25
+ :min="min"
26
+ :max="max"
27
+ :step="step"
17
28
  @input="onInput($event)"
18
29
  @blur="onBlur($event)"
19
30
  @focus="onFocus($event)"
@@ -29,21 +40,56 @@
29
40
  @click="clearInput"
30
41
  @keypress.enter="clearInput"
31
42
  v-if="type !== 'password' && showClearButton"
32
- v-show="actualValue?.length"
43
+ v-show="hasValue"
33
44
  >
34
45
  <ib-icon name="close-outline"></ib-icon>
35
46
  </ib-icon-button>
36
47
 
48
+ <ib-icon v-if="isSuccess" class="succes-checkmark" name="checkmark-circle" />
49
+ <div v-if="type === 'number' && !hideNumberActions" class="number-button-group">
50
+ <div v-show="hasValue" class="divider"></div>
51
+
52
+ <ib-icon-button
53
+ kind="ghost"
54
+ class="button-decrement"
55
+ :disabled="readonly || disabled"
56
+ prevent-default
57
+ type="button"
58
+ aria-label="Decrement value"
59
+ v-tooltip="decrementButtonMessage"
60
+ @blur="onBlur"
61
+ @click="decrement"
62
+ @keypress.enter="decrement"
63
+ >
64
+ <ib-icon name="remove-outline"></ib-icon>
65
+ </ib-icon-button>
66
+
67
+ <ib-icon-button
68
+ kind="ghost"
69
+ class="button-increment"
70
+ :disabled="readonly || disabled"
71
+ prevent-default
72
+ type="button"
73
+ aria-label="Increment value"
74
+ v-tooltip="incrementButtonMessage"
75
+ @blur="onBlur"
76
+ @click="increment"
77
+ @keypress.enter="increment"
78
+ >
79
+ <ib-icon name="add-outline"></ib-icon>
80
+ </ib-icon-button>
81
+ </div>
82
+
37
83
  <ib-icon-button
38
84
  kind="ghost"
39
85
  class="toggle-password"
40
86
  prevent-default
41
87
  type="button"
42
- :disabled="readonly || disabled"
88
+ :disabled="disabled"
43
89
  :help-text="showPassword ? hidePasswordMessage : showPasswordMessage"
44
90
  @click.prevent="toggleShowPassword"
45
91
  v-if="type === 'password'"
46
- v-show="actualValue?.length"
92
+ v-show="hasValue"
47
93
  >
48
94
  <ib-icon
49
95
  :name="showPassword ? 'eye-off-outline' : 'eye-outline'"
@@ -85,6 +131,7 @@ import IbDropdown from "../../Dropdown/Dropdown.vue";
85
131
  import { inputTypeOptions } from "./constants";
86
132
  import generateUID from "../../../helpers/generateUID";
87
133
  import removeEvents from "../../../helpers/removeEvents";
134
+ import { TooltipDirective as Tooltip } from "../../../directives/tooltip/tooltip"
88
135
 
89
136
  import {
90
137
  verticalPosition,
@@ -164,6 +211,37 @@ export default {
164
211
  type: Boolean,
165
212
  default: false,
166
213
  },
214
+ autocomplete: {
215
+ type: String
216
+ },
217
+ isSuccess: {
218
+ type: Boolean,
219
+ default: false,
220
+ },
221
+ hideNumberActions: {
222
+ type: Boolean,
223
+ default: false,
224
+ },
225
+ decrementButtonMessage: {
226
+ type: String,
227
+ default: "Decrement"
228
+ },
229
+ incrementButtonMessage: {
230
+ type: String,
231
+ default: "Increment"
232
+ },
233
+ step: {
234
+ type: Number,
235
+ default: 1
236
+ },
237
+ min: {
238
+ type: Number,
239
+ default: 0,
240
+ },
241
+ max: {
242
+ type: Number,
243
+ default: Infinity,
244
+ },
167
245
  },
168
246
  data() {
169
247
  return {
@@ -181,10 +259,10 @@ export default {
181
259
  this.showPassword = !this.showPassword;
182
260
  },
183
261
  clearInput() {
184
- this.actualValue = "";
185
- this.$emit("update:modelValue", this.actualValue);
186
- this.$emit("input", this.actualValue);
187
- this.$emit("clear");
262
+ this.actualValue = "";
263
+ this.$emit("update:modelValue", this.actualValue);
264
+ this.$emit("input", this.actualValue);
265
+ this.$emit("clear");
188
266
  },
189
267
  onBlur() {
190
268
  this.$emit("blur", this.actualValue);
@@ -193,12 +271,31 @@ export default {
193
271
  this.$emit("focus", this.actualValue);
194
272
  },
195
273
  onInput() {
196
- if (this.debounce) {
197
- this.delayedInput(this.actualValue);
198
- } else {
274
+ if (this.debounce) {
275
+ this.delayedInput(this.actualValue);
276
+ } else {
277
+ this.$emit("update:modelValue", this.actualValue);
278
+ this.$emit("input", this.actualValue);
279
+ }
280
+ },
281
+ decrement() {
282
+ if (this.actualValue > this.min) {
283
+ this.actualValue = +this.actualValue - this.step;
284
+ }
285
+
199
286
  this.$emit("update:modelValue", this.actualValue);
200
287
  this.$emit("input", this.actualValue);
201
- }
288
+ this.$emit("blur", this.actualValue);
289
+ },
290
+ increment() {
291
+ if (this.actualValue < this.max) {
292
+
293
+ this.actualValue = +this.actualValue + this.step;
294
+ }
295
+
296
+ this.$emit("update:modelValue", this.actualValue);
297
+ this.$emit("input", this.actualValue);
298
+ this.$emit("blur", this.actualValue);
202
299
  },
203
300
  delayedInput(value) {
204
301
  if (this.timer) {
@@ -219,6 +316,9 @@ export default {
219
316
  hasSettings() {
220
317
  return !!this.$slots.settings;
221
318
  },
319
+ hasValue() {
320
+ return this.actualValue?.toString().length;
321
+ },
222
322
  classes() {
223
323
  const classList = ["ib-input"];
224
324
 
@@ -272,6 +372,9 @@ export default {
272
372
  IbIcon,
273
373
  IbDropdown,
274
374
  },
375
+ directives: {
376
+ Tooltip,
377
+ },
275
378
  inheritAttrs: false,
276
379
  };
277
380
  </script>
@@ -28,6 +28,36 @@ $input-border-error-color: $red-800;
28
28
  z-index: 11;
29
29
  }
30
30
 
31
+ .number-button-group {
32
+ display: flex;
33
+ position: absolute;
34
+ align-items: center;
35
+ right: 5px;
36
+ top: 50%;
37
+ transform: translateY(-50%);
38
+
39
+ .divider {
40
+ width: 1px;
41
+ height: 16px;
42
+ background-color: $gray-500;
43
+ margin-right: 5px;
44
+ }
45
+
46
+ .button-decrement {
47
+ margin-right: 5px;
48
+ }
49
+ }
50
+
51
+ &.numbers-type {
52
+ .button-clear {
53
+ right: 67px;
54
+ }
55
+
56
+ input[type="number"] {
57
+ padding-right: 90px;
58
+ }
59
+ }
60
+
31
61
  .icon-search {
32
62
  font-size: 12px;
33
63
  position: absolute;
@@ -71,6 +101,24 @@ $input-border-error-color: $red-800;
71
101
  }
72
102
  }
73
103
 
104
+ &.success {
105
+ .ib-input {
106
+ border-radius: 4px;
107
+ border-bottom: 0px;
108
+ @include outline(0px, $green-800);
109
+ padding-right: 60px;
110
+ }
111
+
112
+ .succes-checkmark {
113
+ position: absolute;
114
+ right: 35px;
115
+ top: 50%;
116
+ transform: translateY(-50%);
117
+ z-index: 11;
118
+ color: $green-800;
119
+ }
120
+ }
121
+
74
122
  .ib-input {
75
123
  width: 100%;
76
124
  @include Ib-H4-regular;
@@ -114,14 +162,25 @@ $input-border-error-color: $red-800;
114
162
  display: none;
115
163
  }
116
164
 
165
+ &::-webkit-outer-spin-button,
166
+ &::-webkit-inner-spin-button {
167
+ -webkit-appearance: none;
168
+ margin: 0;
169
+ }
170
+
171
+ &[type="number"] {
172
+ -moz-appearance:textfield;
173
+ }
174
+
175
+
117
176
  &:disabled {
118
177
  color: $input-disabled-color;
119
178
  background-color: $input-disabled-bg;
120
179
  border-bottom-color: $input-disabled-border-color;
121
180
 
122
181
  &:-webkit-autofill,
123
- &:-webkit-autofill:hover,
124
- &:-webkit-autofill:focus,
182
+ &:-webkit-autofill:hover,
183
+ &:-webkit-autofill:focus,
125
184
  &:-webkit-autofill:active {
126
185
  -webkit-box-shadow: 0 0 0 30px $input-disabled-bg inset !important;
127
186
  -webkit-text-fill-color: $input-disabled-color;
@@ -1,26 +1,25 @@
1
1
  <template>
2
- <label :class="classes" :for="for">
2
+ <label :class="classes" :for>
3
3
  <span v-if="required" class="required">* </span>
4
4
  <slot></slot>
5
5
 
6
6
  <ib-icon-button
7
- v-if="infoText.length"
7
+ v-if="infoText.length || Object.keys(infoText).length"
8
8
  size="xs"
9
9
  class="info-button"
10
10
  kind="ghost"
11
11
  type="button"
12
+ v-tooltip:[tooltipPosition]="infoText"
12
13
  >
13
14
  <ib-icon name="information-circle-outline" />
14
-
15
- <ib-tooltip :text="infoText" :position="tooltipPosition"></ib-tooltip>
16
15
  </ib-icon-button>
17
16
  </label>
18
17
  </template>
19
18
 
20
19
  <script>
21
20
  import IbIconButton from "../../IconButton/IconButton.vue";
22
- import IbTooltip from "../../Tooltip/Tooltip.vue";
23
21
  import IbIcon from "../../Icon.vue";
22
+ import { TooltipDirective as Tooltip } from "../../../directives/tooltip/tooltip";
24
23
 
25
24
  export default {
26
25
  name: "IbLabel",
@@ -33,23 +32,32 @@ export default {
33
32
  default: false,
34
33
  },
35
34
  infoText: {
36
- type: String,
35
+ type: [String, Object],
37
36
  default: "",
38
37
  },
39
38
  tooltipPosition: {
40
39
  type: String,
41
40
  },
41
+ disabled: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
42
45
  },
43
46
  mounted() {
44
47
  this.$globalEvents.$on(`label:disabled:${this.for}`, (value) => {
45
- this.disabled = value;
48
+ this.idDisabled = value;
46
49
  });
47
50
  },
48
51
  data() {
49
52
  return {
50
- disabled: false,
53
+ idDisabled: this.disabled,
51
54
  };
52
55
  },
56
+ watch: {
57
+ disabled(value) {
58
+ this.idDisabled = value;
59
+ },
60
+ },
53
61
  computed: {
54
62
  classes() {
55
63
  const classList = ["ib-label"];
@@ -58,7 +66,7 @@ export default {
58
66
  classList.push("has-info-text");
59
67
  }
60
68
 
61
- if (this.disabled) {
69
+ if (this.idDisabled) {
62
70
  classList.push("label-disabled");
63
71
  }
64
72
 
@@ -68,7 +76,9 @@ export default {
68
76
  components: {
69
77
  IbIconButton,
70
78
  IbIcon,
71
- IbTooltip,
79
+ },
80
+ directives: {
81
+ Tooltip,
72
82
  },
73
83
  };
74
84
  </script>
@@ -109,6 +119,8 @@ export default {
109
119
  .info-button {
110
120
  display: inline-block;
111
121
  margin-left: 3px;
122
+ position: relative;
123
+
112
124
  .ib-icon {
113
125
  color: $gray-600;
114
126
  font-size: 16px;