@avakhula/ui 0.0.10

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 (194) hide show
  1. package/.babelrc.json +14 -0
  2. package/.eslintrc.cjs +15 -0
  3. package/.nvmrc +1 -0
  4. package/.prettierrc.json +1 -0
  5. package/.storybook/intelliboardTheme.js +10 -0
  6. package/.storybook/main.js +25 -0
  7. package/.storybook/manager.js +7 -0
  8. package/.storybook/preview-head.html +11 -0
  9. package/.storybook/preview.js +24 -0
  10. package/.storybook/scss-loader.scss +6 -0
  11. package/.storybook/withSource.js +97 -0
  12. package/README.md +35 -0
  13. package/dist/favicon.ico +0 -0
  14. package/dist/index.mjs +19366 -0
  15. package/dist/index.umd.js +209 -0
  16. package/dist/style.css +1 -0
  17. package/index.html +21 -0
  18. package/package.json +63 -0
  19. package/public/favicon.ico +0 -0
  20. package/src/App.vue +37 -0
  21. package/src/EventEmmiter.js +19 -0
  22. package/src/assets/scss/mixins/dropdown-list-item.scss +45 -0
  23. package/src/assets/scss/mixins/tooltip-position.scss +147 -0
  24. package/src/assets/scss/mixins.scss +21 -0
  25. package/src/assets/scss/reset.scss +12 -0
  26. package/src/assets/scss/style.scss +73 -0
  27. package/src/assets/scss/typography.scss +155 -0
  28. package/src/assets/scss/variables/colors.scss +115 -0
  29. package/src/assets/scss/variables/shadows.scss +17 -0
  30. package/src/components/Accordion/Accordion.scss +94 -0
  31. package/src/components/Accordion/Accordion.stories.js +41 -0
  32. package/src/components/Accordion/Accordion.vue +104 -0
  33. package/src/components/Accordion/readme.mdx +38 -0
  34. package/src/components/Alert/Alert.stories.js +69 -0
  35. package/src/components/Alert/Alert.vue +131 -0
  36. package/src/components/Alert/alert.scss +166 -0
  37. package/src/components/Alert/constants.js +6 -0
  38. package/src/components/Alert/readme.mdx +63 -0
  39. package/src/components/Badge/Badge.stories.js +53 -0
  40. package/src/components/Badge/Badge.vue +58 -0
  41. package/src/components/Badge/readme.mdx +38 -0
  42. package/src/components/Breadcrumbs/Breadcrumbs.vue +98 -0
  43. package/src/components/Breadcrumbs/breadcrumbs.scss +77 -0
  44. package/src/components/Breadcrumbs/breadcrumbs.stories.js +37 -0
  45. package/src/components/Button/Button.stories.js +124 -0
  46. package/src/components/Button/Button.vue +165 -0
  47. package/src/components/Button/button.scss +217 -0
  48. package/src/components/Button/constants.js +8 -0
  49. package/src/components/Button/readme.mdx +118 -0
  50. package/src/components/ButtonGroup/ButtonGroup.stories.js +27 -0
  51. package/src/components/ButtonGroup/ButtonGroup.vue +24 -0
  52. package/src/components/ButtonGroup/readme.mdx +10 -0
  53. package/src/components/Dropdown/Dropdown.spec.js +90 -0
  54. package/src/components/Dropdown/Dropdown.stories.js +48 -0
  55. package/src/components/Dropdown/Dropdown.vue +313 -0
  56. package/src/components/Dropdown/DropdownDivider.vue +15 -0
  57. package/src/components/Dropdown/DropdownItem.vue +59 -0
  58. package/src/components/Dropdown/DropdownList.stories.js +174 -0
  59. package/src/components/Dropdown/DropdownList.vue +93 -0
  60. package/src/components/Dropdown/constants.js +10 -0
  61. package/src/components/Dropdown/readme.mdx +88 -0
  62. package/src/components/Form/CharactersCount.vue +55 -0
  63. package/src/components/Form/Checkbox/Checkbox.scss +226 -0
  64. package/src/components/Form/Checkbox/Checkbox.stories.js +63 -0
  65. package/src/components/Form/Checkbox/Checkbox.vue +128 -0
  66. package/src/components/Form/Checkbox/readme.mdx +69 -0
  67. package/src/components/Form/CheckboxGroup/CheckboxGroup.stories.js +64 -0
  68. package/src/components/Form/CheckboxGroup/CheckboxGroup.vue +87 -0
  69. package/src/components/Form/CheckboxGroup/readme.mdx +56 -0
  70. package/src/components/Form/DatePicker/DatePicker.scss +479 -0
  71. package/src/components/Form/DatePicker/DatePicker.stories.js +78 -0
  72. package/src/components/Form/DatePicker/DatePicker.vue +284 -0
  73. package/src/components/Form/DatePicker/Icons/chevron-back.js +5 -0
  74. package/src/components/Form/DatePicker/Icons/chevron-forward.js +5 -0
  75. package/src/components/Form/DatePicker/readme.mdx +115 -0
  76. package/src/components/Form/FormGroup/FormGroup.stories.js +48 -0
  77. package/src/components/Form/FormGroup/FormGroup.vue +61 -0
  78. package/src/components/Form/FormGroup/FormGroupSet.stories.js +32 -0
  79. package/src/components/Form/FormGroup/FormGroupSet.vue +75 -0
  80. package/src/components/Form/Input/Input.stories.js +137 -0
  81. package/src/components/Form/Input/Input.vue +231 -0
  82. package/src/components/Form/Input/constants.js +5 -0
  83. package/src/components/Form/Input/input.scss +133 -0
  84. package/src/components/Form/Input/readme.mdx +68 -0
  85. package/src/components/Form/Label/Label.stories.js +29 -0
  86. package/src/components/Form/Label/Label.vue +87 -0
  87. package/src/components/Form/Label/readme.mdx +25 -0
  88. package/src/components/Form/PhoneInput/PhoneInput.stories.js +43 -0
  89. package/src/components/Form/PhoneInput/PhoneInput.vue +105 -0
  90. package/src/components/Form/PhoneInput/phoneInput.scss +197 -0
  91. package/src/components/Form/PhoneInput/readme.mdx +37 -0
  92. package/src/components/Form/Radio/Radio.stories.js +34 -0
  93. package/src/components/Form/Radio/Radio.vue +109 -0
  94. package/src/components/Form/Radio/radio.scss +187 -0
  95. package/src/components/Form/Radio/readme.mdx +48 -0
  96. package/src/components/Form/TextEditor/TextEditor.stories.js +58 -0
  97. package/src/components/Form/TextEditor/TextEditor.vue +305 -0
  98. package/src/components/Form/TextEditor/icons/svg/chevron-down.svg +3 -0
  99. package/src/components/Form/TextEditor/icons/toolbarIcons.js +111 -0
  100. package/src/components/Form/TextEditor/plugins/alphabetList.js +43 -0
  101. package/src/components/Form/TextEditor/readme.mdx +59 -0
  102. package/src/components/Form/TextEditor/textEditor.scss +684 -0
  103. package/src/components/Form/Textarea/Textarea.spec.js +107 -0
  104. package/src/components/Form/Textarea/Textarea.stories.js +68 -0
  105. package/src/components/Form/Textarea/Textarea.vue +102 -0
  106. package/src/components/Form/Textarea/readme.mdx +45 -0
  107. package/src/components/Form/Textarea/textarea.scss +84 -0
  108. package/src/components/Form/Toggle/Toggle.stories.js +44 -0
  109. package/src/components/Form/Toggle/Toggle.vue +122 -0
  110. package/src/components/Form/Toggle/readme.mdx +39 -0
  111. package/src/components/Form/Toggle/toggle.scss +166 -0
  112. package/src/components/Icon.vue +41 -0
  113. package/src/components/IconButton/IconButton.scss +91 -0
  114. package/src/components/IconButton/IconButton.stories.js +115 -0
  115. package/src/components/IconButton/IconButton.vue +100 -0
  116. package/src/components/IconButton/constants.js +14 -0
  117. package/src/components/IconButton/readme.mdx +66 -0
  118. package/src/components/List.vue +150 -0
  119. package/src/components/Modal/Modal.stories.js +48 -0
  120. package/src/components/Modal/Modal.vue +231 -0
  121. package/src/components/Modal/readme.mdx +76 -0
  122. package/src/components/Pagination/LimitSelector.vue +73 -0
  123. package/src/components/Pagination/Pagination.stories.js +54 -0
  124. package/src/components/Pagination/Pagination.vue +227 -0
  125. package/src/components/Pagination/pagination.scss +189 -0
  126. package/src/components/Popover/Popover.stories.js +46 -0
  127. package/src/components/Popover/Popover.vue +81 -0
  128. package/src/components/Popover/constants.js +14 -0
  129. package/src/components/Popover/popover.scss +26 -0
  130. package/src/components/Popover/readme.mdx +42 -0
  131. package/src/components/ProgressBar/ProgressBar.stories.js +90 -0
  132. package/src/components/ProgressBar/ProgressBar.vue +58 -0
  133. package/src/components/ProgressBar/constants.js +6 -0
  134. package/src/components/ProgressBar/progressBar.scss +116 -0
  135. package/src/components/ProgressBar/readme.mdx +67 -0
  136. package/src/components/Sorting/Sorting.stories.js +35 -0
  137. package/src/components/Sorting/Sorting.vue +128 -0
  138. package/src/components/Sorting/constants.js +10 -0
  139. package/src/components/Sorting/sorting.scss +87 -0
  140. package/src/components/SplitButton/SplitButton.stories.js +39 -0
  141. package/src/components/SplitButton/SplitButton.vue +132 -0
  142. package/src/components/SplitButton/SplitButtonItem.vue +34 -0
  143. package/src/components/SplitButton/constants.js +4 -0
  144. package/src/components/SplitButton/readme.mdx +77 -0
  145. package/src/components/SplitButton/splitButton.scss +161 -0
  146. package/src/components/StatusIndicator/StatusIndicator.stories.js +40 -0
  147. package/src/components/StatusIndicator/StatusIndicator.vue +52 -0
  148. package/src/components/StatusIndicator/constants.js +10 -0
  149. package/src/components/StatusIndicator/icons.js +48 -0
  150. package/src/components/StatusIndicator/readme.mdx +21 -0
  151. package/src/components/Table/Cells/Cell.vue +71 -0
  152. package/src/components/Table/Cells/CheckboxCell.vue +48 -0
  153. package/src/components/Table/Row.vue +26 -0
  154. package/src/components/Table/Table.stories.js +59 -0
  155. package/src/components/Table/Table.vue +36 -0
  156. package/src/components/Tabs/Tab.vue +37 -0
  157. package/src/components/Tabs/TabDropdown.vue +93 -0
  158. package/src/components/Tabs/Tabs.stories.js +57 -0
  159. package/src/components/Tabs/Tabs.vue +94 -0
  160. package/src/components/Tabs/tabs.scss +157 -0
  161. package/src/components/TagPill/TagPill.stories.js +30 -0
  162. package/src/components/TagPill/TagPill.vue +133 -0
  163. package/src/components/TagPill/constants.js +9 -0
  164. package/src/components/TagPill/readme.mdx +37 -0
  165. package/src/components/ToggleTip/ToggleTip.stories.js +98 -0
  166. package/src/components/ToggleTip/ToggleTip.vue +112 -0
  167. package/src/components/ToggleTip/constants.js +14 -0
  168. package/src/components/ToggleTip/readme.mdx +46 -0
  169. package/src/components/ToggleTip/toggleTip.scss +55 -0
  170. package/src/components/Tooltip/Tooltip.stories.js +56 -0
  171. package/src/components/Tooltip/Tooltip.vue +49 -0
  172. package/src/components/Tooltip/readme.mdx +43 -0
  173. package/src/components/TreeSelect/Option.vue +325 -0
  174. package/src/components/TreeSelect/Select.stories.js +349 -0
  175. package/src/components/TreeSelect/Select.vue +909 -0
  176. package/src/components/TreeSelect/TreeSelect.stories.js +270 -0
  177. package/src/components/TreeSelect/scss/option.scss +204 -0
  178. package/src/components/TreeSelect/scss/select.scss +166 -0
  179. package/src/constants/events.js +2 -0
  180. package/src/constants/keyCodes.js +8 -0
  181. package/src/directives/outside/outside.js +81 -0
  182. package/src/directives/outside/outside.stories.js +29 -0
  183. package/src/directives/outside/readme.mdx +24 -0
  184. package/src/helpers/generateUID.js +3 -0
  185. package/src/helpers/getHrefFromID.js +3 -0
  186. package/src/helpers/multiLineOverflows.js +3 -0
  187. package/src/helpers/removeEvents.js +9 -0
  188. package/src/index.js +49 -0
  189. package/src/main.js +12 -0
  190. package/src/stories/link.readme.mdx +57 -0
  191. package/src/stories/link.stories.js +59 -0
  192. package/static/Logo.svg +25 -0
  193. package/static/docks/button.pdf +147566 -0
  194. package/vite.config.js +47 -0
@@ -0,0 +1,325 @@
1
+ <template>
2
+ <li>
3
+ <div
4
+ class="tree-select-option"
5
+ :class="{
6
+ 'tree-select-option-checked': isChecked,
7
+ 'tree-select-option-margin': hasVisibleChildren,
8
+ active: option.isChildrenVisible,
9
+ 'is-multiple': isMultiple,
10
+ 'is-not-multiple': !isMultiple,
11
+ 'tree-select-option-toggle': this.isToggle && this.isMultiple,
12
+ }"
13
+ tabindex="0"
14
+ @keydown.self="onKeydown"
15
+ >
16
+ <ib-tooltip v-if="showTooltip" :text="option.title"></ib-tooltip>
17
+
18
+ <ib-icon-button
19
+ :disabled-focus="true"
20
+ kind="ghost"
21
+ class="toggle-children"
22
+ @click="toggleChildrenVisibility"
23
+ v-show="hasVisibleChildren"
24
+ >
25
+ <ib-icon :name="iconName"></ib-icon>
26
+ </ib-icon-button>
27
+ <div
28
+ @click.prevent="onChange"
29
+ :class="{
30
+ disabled: option.isDisabled,
31
+ 'tree-select-option-label': true,
32
+ 'tree-select-option-has-children': hasVisibleChildren,
33
+ active: !showInput && option.checked,
34
+ }"
35
+ >
36
+ <component
37
+ ref="component"
38
+ tabindex="-1"
39
+ v-show="showInput"
40
+ :is="component"
41
+ :name="actualName"
42
+ :value="option.id"
43
+ :id="'input' + id"
44
+ :is-checked="isChecked"
45
+ :disabled="option.isDisabled"
46
+ autocomplete="off"
47
+ autocorrect="off"
48
+ autocapitalize="off"
49
+ spellcheck="false"
50
+ @input="toggle"
51
+ ></component>
52
+
53
+ <template v-if="isBookmarkable">
54
+ <span
55
+ :class="
56
+ 'bookmarkable-option-title ' + (isBookmarked ? 'bookmarked' : '')
57
+ "
58
+ >
59
+ <span class="option-label" v-if="!hasChildren">
60
+ {{ option.title }}
61
+ <ib-icon
62
+ name="star"
63
+ @click.stop.prevent="$emit('toggle-bookmark', option)"
64
+ ></ib-icon>
65
+ </span>
66
+
67
+ <span class="option-label" v-else>{{ option.title }}</span>
68
+ </span>
69
+ </template>
70
+ <template v-else-if="htmlTitle">
71
+ <span
72
+ class="option-label"
73
+ v-if="!hasChildren"
74
+ v-html="option.title"
75
+ ></span>
76
+ <span class="option-label" v-else v-html="option.title"></span>
77
+ </template>
78
+
79
+ <template v-else>
80
+ <span class="option-label">{{ option.title }}</span>
81
+ </template>
82
+ </div>
83
+
84
+ <list
85
+ v-if="hasChildren"
86
+ v-show="hasVisibleChildren && option.isChildrenVisible"
87
+ >
88
+ <select-option
89
+ v-for="childOption in option.children"
90
+ :key="childOption.value"
91
+ v-show="childOption.visible"
92
+ :option="childOption"
93
+ :name="name"
94
+ :parent-auto-check="parentAutoCheck"
95
+ :is-multiple="isMultiple"
96
+ :show-input="showInput"
97
+ @check="checkChildren"
98
+ @toggle-bookmark="$emit('toggle-bookmark', $event)"
99
+ :uid="uid"
100
+ :is-bookmarkable="isBookmarkable"
101
+ ></select-option>
102
+ </list>
103
+ </div>
104
+ </li>
105
+ </template>
106
+
107
+ <script>
108
+ import Checkbox from "../Form/Checkbox/Checkbox.vue";
109
+ import Toggle from "../Form/Toggle/Toggle.vue";
110
+ import List from "../List.vue";
111
+ import IbIcon from "../Icon.vue";
112
+ import IbIconButton from "../IconButton/IconButton.vue";
113
+ import IbTooltip from "../Tooltip/Tooltip.vue";
114
+ import multiLineOverflows from "../../helpers/multiLineOverflows";
115
+ import {
116
+ SPACE_KEY_CODE,
117
+ ARROW_RIGHT_KEY_CODE,
118
+ ARROW_LEFT_KEY_CODE,
119
+ } from "../../constants/keyCodes";
120
+
121
+ export default {
122
+ name: "select-option",
123
+ props: {
124
+ option: {
125
+ type: Object,
126
+ },
127
+ name: String,
128
+ parentAutoCheck: {
129
+ type: Boolean,
130
+ default: false,
131
+ },
132
+ isMultiple: {
133
+ type: Boolean,
134
+ default: true,
135
+ },
136
+ uid: {
137
+ type: String,
138
+ default: "",
139
+ },
140
+ onlyEndNodes: {
141
+ type: Boolean,
142
+ default: false,
143
+ },
144
+ htmlTitle: {
145
+ type: Boolean,
146
+ default: false,
147
+ },
148
+ showInput: {
149
+ type: Boolean,
150
+ default: true,
151
+ },
152
+ isBookmarkable: {
153
+ type: Boolean,
154
+ default: false,
155
+ },
156
+ isBookmarked: {
157
+ type: Boolean,
158
+ default: false,
159
+ },
160
+ isToggle: {
161
+ type: Boolean,
162
+ default: false,
163
+ },
164
+ },
165
+ mounted() {
166
+ // eslint-disable-next-line no-prototype-builtins
167
+ if (this.option.hasOwnProperty("children") && this.option.children) {
168
+ this.checkParent();
169
+ }
170
+ },
171
+ updated() {
172
+ this.$nextTick(() => {
173
+ if (multiLineOverflows(this.$el.querySelector(".option-label"))) {
174
+ this.showTooltip = true;
175
+ }
176
+ });
177
+ },
178
+ data() {
179
+ return {
180
+ showTooltip: false,
181
+ };
182
+ },
183
+ methods: {
184
+ onKeydown(e) {
185
+ if (e.keyCode === SPACE_KEY_CODE) {
186
+ e.preventDefault();
187
+ this.onChange();
188
+ }
189
+
190
+ if (this.hasVisibleChildren) {
191
+ if (e.keyCode === ARROW_RIGHT_KEY_CODE) {
192
+ // eslint-disable-next-line vue/no-mutating-props
193
+ this.option.isChildrenVisible = true;
194
+ }
195
+
196
+ if (e.keyCode === ARROW_LEFT_KEY_CODE) {
197
+ // eslint-disable-next-line vue/no-mutating-props
198
+ this.option.isChildrenVisible = false;
199
+ }
200
+ }
201
+ },
202
+ onChange() {
203
+ this.$refs.component?.onChange();
204
+ },
205
+ toggle(value, checkChildren = true) {
206
+ this.check(this.option, value, true, checkChildren);
207
+ },
208
+ check(option, checkStatus, isDirectChild, checkChildren) {
209
+ this.$emit("check", option, checkStatus, isDirectChild);
210
+ if (checkChildren) {
211
+ option.children &&
212
+ option.children.forEach((childOption) => {
213
+ this.check(childOption, checkStatus, false, true);
214
+ });
215
+ }
216
+ },
217
+ toggleChildrenVisibility() {
218
+ // eslint-disable-next-line vue/no-mutating-props
219
+ this.option.isChildrenVisible = !this.option.isChildrenVisible;
220
+ },
221
+ checkChildren(option, isChecked, isDirectChild) {
222
+ if (isDirectChild && this.isMultiple) {
223
+ this.$nextTick(() => {
224
+ this.checkParent();
225
+ });
226
+ }
227
+ this.$emit("check", option, isChecked, false);
228
+ },
229
+ checkParent() {
230
+ const childrenSelectedCount = this.option.children.filter(
231
+ (child) => child.checked
232
+ ).length,
233
+ allChildrenSelected =
234
+ childrenSelectedCount >= this.option.children.length;
235
+
236
+ if (
237
+ (!this.option.checked && allChildrenSelected && this.parentAutoCheck) ||
238
+ (this.option.checked && !allChildrenSelected)
239
+ ) {
240
+ this.toggle(!this.option.checked, false);
241
+ }
242
+ },
243
+ calculateChildren(option, filter, checkNested = false) {
244
+ let count = 0;
245
+
246
+ option.children &&
247
+ option.children.forEach((child) => {
248
+ if (!filter || filter(child)) {
249
+ count++;
250
+ }
251
+
252
+ if (checkNested) {
253
+ count += this.calculateChildren(child, filter, checkNested);
254
+ }
255
+ });
256
+
257
+ return count;
258
+ },
259
+ },
260
+ computed: {
261
+ component() {
262
+ if (this.isMultiple && this.isToggle) return Toggle;
263
+ else return Checkbox;
264
+ },
265
+ isChecked() {
266
+ if (this.option.checked) {
267
+ return true;
268
+ }
269
+
270
+ if (this.option.isIndeterminate) {
271
+ return null; //null will trigger indeterminate stage
272
+ }
273
+
274
+ if (!this.childrenSelectedCount) {
275
+ return false;
276
+ } else if (
277
+ this.childrenSelectedCount > 0 &&
278
+ this.countOfAllChildren > this.childrenSelectedCount
279
+ ) {
280
+ return null; //null will trigger indeterminate stage
281
+ }
282
+
283
+ return true;
284
+ },
285
+ hasChildren() {
286
+ return this.option.children && this.option.children.length;
287
+ },
288
+ hasVisibleChildren() {
289
+ return this.calculateChildren(this.option, (item) => item.visible);
290
+ },
291
+ iconName() {
292
+ return this.option.isChildrenVisible ? "chevron-down" : "chevron-forward";
293
+ },
294
+ id() {
295
+ return this.uid + "_" + this.option.id;
296
+ },
297
+ actualName() {
298
+ return this.onlyEndNodes &&
299
+ this.option.children &&
300
+ this.option.children.length
301
+ ? ""
302
+ : this.name;
303
+ },
304
+ childrenSelectedCount() {
305
+ return this.calculateChildren(
306
+ this.option,
307
+ (child) => child.checked,
308
+ true
309
+ );
310
+ },
311
+ countOfAllChildren() {
312
+ return this.calculateChildren(this.option, () => true, true);
313
+ },
314
+ },
315
+ components: {
316
+ IbIcon,
317
+ List,
318
+ IbIconButton,
319
+ IbTooltip,
320
+ },
321
+ };
322
+ </script>
323
+ <style lang="scss">
324
+ @import "./scss/option.scss";
325
+ </style>
@@ -0,0 +1,349 @@
1
+ import IbSelect from "./Select.vue";
2
+ import IbButton from "../Button/Button.vue";
3
+ import IbIcon from "../Icon.vue";
4
+
5
+ export default {
6
+ title: "Form/Select",
7
+ components: IbSelect,
8
+ argTypes: {
9
+ onResize: { action: "resize" },
10
+ onSearch: { action: "search" },
11
+ onSubmit: { action: "submit" },
12
+ onInput: { action: "input" },
13
+ placeholder: {
14
+ control: { type: "text" },
15
+ },
16
+ searchPlaceholderText: {
17
+ control: { type: "text" },
18
+ },
19
+ clearButtonMessage: {
20
+ control: { type: "text" },
21
+ },
22
+ showClearButton: {
23
+ control: { type: "boolean" },
24
+ },
25
+ isResizable: {
26
+ control: { type: "boolean" },
27
+ },
28
+ name: {
29
+ control: { type: "text" },
30
+ },
31
+ maxSelectedNames: {
32
+ control: { type: "number" },
33
+ },
34
+ isMultiple: {
35
+ control: { type: "boolean" },
36
+ },
37
+ parentAutoCheck: {
38
+ control: { type: "boolean" },
39
+ },
40
+ strings: {
41
+ control: { type: "object" },
42
+ },
43
+ onlyEndNodes: {
44
+ control: { type: "boolean" },
45
+ },
46
+ isRequired: {
47
+ control: { type: "boolean" },
48
+ },
49
+ htmlOptionTitle: {
50
+ control: { type: "boolean" },
51
+ },
52
+ showInputs: {
53
+ control: { type: "boolean" },
54
+ },
55
+ dependency: {
56
+ control: { type: "text" },
57
+ },
58
+ filterId: {
59
+ control: { type: "text" },
60
+ },
61
+ staticPlaceholder: {
62
+ control: { type: "boolean" },
63
+ },
64
+ useSearch: {
65
+ control: { type: "boolean" },
66
+ },
67
+ isWatching: {
68
+ control: { type: "boolean" },
69
+ },
70
+ vertical: {
71
+ control: { type: "text" },
72
+ },
73
+ emptyMessage: {
74
+ control: { type: "text" },
75
+ },
76
+ allOptions: {
77
+ control: { type: "boolean" },
78
+ },
79
+ watchClearValue: {
80
+ control: { type: "boolean" },
81
+ },
82
+ isToggle: {
83
+ control: { type: "boolean" },
84
+ },
85
+ },
86
+ };
87
+
88
+ const testData = [
89
+ {
90
+ id: "1",
91
+ title: "Education",
92
+ is_category: true,
93
+ initiallyVisible: true,
94
+ visible: true,
95
+ isDisabled: false,
96
+ checked: true,
97
+ isChildrenVisible: true,
98
+ },
99
+ {
100
+ id: "2",
101
+ title: "Education 2",
102
+ is_category: true,
103
+ initiallyVisible: true,
104
+ visible: true,
105
+ isDisabled: false,
106
+ checked: false,
107
+ isChildrenVisible: true,
108
+ },
109
+ {
110
+ id: "3",
111
+ title: "Education 3",
112
+ is_category: true,
113
+ initiallyVisible: true,
114
+ visible: true,
115
+ isDisabled: false,
116
+ checked: false,
117
+ isChildrenVisible: true,
118
+ },
119
+ {
120
+ id: "4",
121
+ title: "Education 4",
122
+ is_category: true,
123
+ initiallyVisible: true,
124
+ visible: true,
125
+ isDisabled: false,
126
+ checked: false,
127
+ isChildrenVisible: true,
128
+ },
129
+ ];
130
+
131
+ const testData1 = [
132
+ {
133
+ id: "1",
134
+ title: "Education",
135
+ is_category: true,
136
+ initiallyVisible: true,
137
+ visible: true,
138
+ isDisabled: false,
139
+ checked: true,
140
+ isChildrenVisible: true,
141
+ },
142
+ {
143
+ id: "2",
144
+ title: "Education 2",
145
+ is_category: true,
146
+ initiallyVisible: true,
147
+ visible: true,
148
+ isDisabled: false,
149
+ checked: false,
150
+ isChildrenVisible: true,
151
+ },
152
+ {
153
+ id: "3",
154
+ title: "Education 3",
155
+ is_category: true,
156
+ initiallyVisible: true,
157
+ visible: true,
158
+ isDisabled: false,
159
+ checked: false,
160
+ isChildrenVisible: true,
161
+ },
162
+ {
163
+ id: "4",
164
+ title: "Education 4",
165
+ is_category: true,
166
+ initiallyVisible: true,
167
+ visible: true,
168
+ isDisabled: false,
169
+ checked: false,
170
+ isChildrenVisible: true,
171
+ },
172
+ {
173
+ id: "5",
174
+ title: "Education 5",
175
+ is_category: true,
176
+ initiallyVisible: true,
177
+ visible: true,
178
+ isDisabled: false,
179
+ checked: false,
180
+ isChildrenVisible: true,
181
+ },
182
+
183
+ {
184
+ id: "6",
185
+ title: "Education 6",
186
+ is_category: true,
187
+ initiallyVisible: true,
188
+ visible: true,
189
+ isDisabled: false,
190
+ checked: false,
191
+ isChildrenVisible: true,
192
+ },
193
+
194
+ {
195
+ id: "7",
196
+ title: "Education 7",
197
+ is_category: true,
198
+ initiallyVisible: true,
199
+ visible: true,
200
+ isDisabled: false,
201
+ checked: false,
202
+ isChildrenVisible: true,
203
+ },
204
+
205
+ {
206
+ id: "8",
207
+ title: "Education 8",
208
+ is_category: true,
209
+ initiallyVisible: true,
210
+ visible: true,
211
+ isDisabled: false,
212
+ checked: false,
213
+ isChildrenVisible: true,
214
+ },
215
+ {
216
+ id: "9",
217
+ title: "Education 9",
218
+ is_category: true,
219
+ initiallyVisible: true,
220
+ visible: true,
221
+ isDisabled: false,
222
+ checked: false,
223
+ isChildrenVisible: true,
224
+ },
225
+ {
226
+ id: "10",
227
+ title: "Education 10",
228
+ is_category: true,
229
+ initiallyVisible: true,
230
+ visible: true,
231
+ isDisabled: false,
232
+ checked: false,
233
+ isChildrenVisible: true,
234
+ },
235
+ {
236
+ id: "11",
237
+ title: "Education 11",
238
+ is_category: true,
239
+ initiallyVisible: true,
240
+ visible: true,
241
+ isDisabled: false,
242
+ checked: false,
243
+ isChildrenVisible: true,
244
+ },
245
+ ];
246
+
247
+ const Template = (args) => ({
248
+ components: { IbSelect },
249
+ setup() {
250
+ return { args };
251
+ },
252
+ template: "<ib-select v-bind='args' />",
253
+ });
254
+
255
+ export const Default = Template.bind({});
256
+ Default.args = {
257
+ initialSize: {
258
+ left: 0,
259
+ right: 0,
260
+ },
261
+ ariaLabel: "Search",
262
+ options: testData,
263
+ clearButtonMessage: "Clear",
264
+ placeholder: "Please select",
265
+ };
266
+
267
+ export const Multiple = Template.bind({});
268
+ Multiple.args = {
269
+ initialSize: {
270
+ left: 0,
271
+ right: 0,
272
+ },
273
+ ariaLabel: "Search",
274
+ options: testData1,
275
+ clearButtonMessage: "Clear",
276
+ placeholder: "Please select",
277
+ };
278
+
279
+ Multiple.decorators = [
280
+ () => ({
281
+ template: '<div style="padding-top: 50px"><story /></div>',
282
+ }),
283
+ ];
284
+
285
+ export const Single = Template.bind({});
286
+ Single.args = {
287
+ initialSize: {
288
+ left: 0,
289
+ right: 0,
290
+ },
291
+ ariaLabel: "Search",
292
+ isMultiple: false,
293
+ options: testData,
294
+ clearButtonMessage: "Clear",
295
+ placeholder: "Please select",
296
+ };
297
+ Single.decorators = [
298
+ () => ({
299
+ template: '<div style="padding-top: 50px"><story /></div>',
300
+ }),
301
+ ];
302
+
303
+ export const Toggles = Template.bind({});
304
+ Toggles.args = {
305
+ useSearch: true,
306
+ ariaLabel: "Search",
307
+ placeholder: "Please select",
308
+ clearButtonMessage: "Clear",
309
+ isToggle: true,
310
+ options: testData1,
311
+ };
312
+ Toggles.decorators = [
313
+ () => ({
314
+ template: '<div style="padding-top: 50px"><story /></div>',
315
+ }),
316
+ ];
317
+
318
+ const TemplateCustomTrigger = (args) => ({
319
+ components: { IbSelect, IbButton, IbIcon },
320
+ setup() {
321
+ return { args };
322
+ },
323
+ template: `<ib-select v-bind='args'>
324
+ <template v-slot:trigger="{ selectedCount }">
325
+ <ib-button kind="secondary">
326
+ Selected ({{ selectedCount }})
327
+ <ib-icon style="paddingLeft: 5px" name="chevron-down-outline"></ib-icon>
328
+ </ib-button>
329
+ </template>
330
+ </ib-select>`,
331
+ });
332
+
333
+ export const CustomTrigger = TemplateCustomTrigger.bind({});
334
+ CustomTrigger.args = {
335
+ useSearch: true,
336
+ placeholder: "Please select",
337
+ ariaLabel: "Search",
338
+ clearButtonMessage: "Clear",
339
+ options: testData1,
340
+ initialSize: {
341
+ left: 0,
342
+ right: 100,
343
+ },
344
+ };
345
+ Toggles.decorators = [
346
+ () => ({
347
+ template: '<div style="padding-top: 50px"><story /></div>',
348
+ }),
349
+ ];