@avakhula/ui 0.0.238 → 0.0.239

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakhula/ui",
3
- "version": "0.0.238",
3
+ "version": "0.0.239",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
package/src/App.vue CHANGED
@@ -1,243 +1,34 @@
1
1
  <template>
2
- {{ selectedRoles }}
2
+ <div style="width: 200px;height: 200px;display: flex;align-items: center;justify-content: center;">
3
+ <ib-dropdown-list
4
+ >
5
+ <template #trigger>
6
+ <ib-icon-button
7
+ kind="ghost"
8
+ v-tooltip="'test'"
9
+ >
10
+ X
11
+ </ib-icon-button>
12
+ </template>
3
13
 
4
- <ib-select
5
- :options="opt"
6
- />
14
+ <template #body>
15
+ test
16
+ </template>
17
+ </ib-dropdown-list>
18
+ </div>
7
19
 
8
- <button @click="selectedRoles = []">resset</button>
9
20
  </template>
10
21
 
11
22
  <script>
12
- import IbSelect from "./components/TreeSelect/Select.vue";
13
- const testData1 = [
14
- {
15
- id: "1",
16
- title: "A Education",
17
- is_category: true,
18
- isDisabled: false,
19
- checked: true,
20
- isChildrenVisible: true,
21
- },
22
- {
23
- id: "2",
24
- title: "Education 2",
25
- is_category: true,
26
- isDisabled: false,
27
- checked: false,
28
- isChildrenVisible: true,
29
- },
30
- {
31
- id: "3",
32
- title: "Education 3",
33
- is_category: true,
34
- isDisabled: false,
35
- checked: false,
36
- isChildrenVisible: true,
37
- },
38
- {
39
- id: "4",
40
- title: "Education 4",
41
- is_category: true,
42
- isDisabled: false,
43
- checked: false,
44
- isChildrenVisible: true,
45
- },
46
- {
47
- id: "5",
48
- title: "Education 5",
49
- is_category: true,
50
- isDisabled: false,
51
- checked: false,
52
- isChildrenVisible: true,
53
- },
54
-
55
- {
56
- id: "6",
57
- title: "Education 6",
58
- is_category: true,
59
- isDisabled: false,
60
- checked: false,
61
- isChildrenVisible: true,
62
- },
63
-
64
- {
65
- id: "7",
66
- title: "Education 7",
67
- is_category: true,
68
- isDisabled: false,
69
- checked: false,
70
- isChildrenVisible: true,
71
- },
72
-
73
- {
74
- id: "8",
75
- title: "Education 8",
76
- is_category: true,
77
- isDisabled: false,
78
- checked: false,
79
- isChildrenVisible: true,
80
- },
81
- {
82
- id: "9",
83
- title: "Education 9",
84
- is_category: true,
85
- isDisabled: false,
86
- checked: false,
87
- isChildrenVisible: true,
88
- },
89
- {
90
- id: "10",
91
- title: "Education 10",
92
- is_category: true,
93
- isDisabled: false,
94
- checked: false,
95
- isChildrenVisible: true,
96
- },
97
- {
98
- id: "11",
99
- title: "Education 11",
100
- is_category: true,
101
- isDisabled: false,
102
- checked: false,
103
- isChildrenVisible: true,
104
- },
105
- ];
23
+ import IbIconButton from "./components/IconButton/IconButton.vue";
24
+ import IbDropdownList from "./components/Dropdown/DropdownList.vue"
25
+ import { TooltipDirective as Tooltip } from "./directives/tooltip/tooltip"
106
26
 
107
- const testData = [
108
- {
109
- id: "category_id_2",
110
- title: "Education",
111
- is_category: true,
112
- children: [
113
- {
114
- id: "category_id_19",
115
- title: "Test1",
116
- is_category: true,
117
- children: [
118
- {
119
- id: 139,
120
- title: "Test Course 1",
121
- selected: false,
122
- isDisabled: false,
123
- checked: false,
124
- },
125
- {
126
- id: 300,
127
- title: "Course for unenrollmemt test",
128
- selected: false,
129
- isDisabled: false,
130
- checked: false,
131
- },
132
- ],
133
- isDisabled: false,
134
- checked: false,
135
- isChildrenVisible: true,
136
- },
137
- {
138
- id: 15,
139
- title: "History",
140
- selected: false,
141
- isDisabled: false,
142
- checked: false,
143
- },
144
- {
145
- id: 17,
146
- title: "Algebra 101",
147
- selected: false,
148
- isDisabled: false,
149
- checked: false,
150
- },
151
- {
152
- id: 29,
153
- title: "Music",
154
- selected: false,
155
- isDisabled: false,
156
- checked: false,
157
- },
158
- {
159
- id: 30,
160
- title: "Astronomy",
161
- selected: false,
162
- isDisabled: false,
163
- checked: false,
164
- },
165
- {
166
- id: 31,
167
- title: "Pharmacology",
168
- selected: false,
169
- isDisabled: false,
170
- checked: false,
171
- },
172
- {
173
- id: 32,
174
- title: "German Basics",
175
- selected: false,
176
- isDisabled: false,
177
- checked: false,
178
- },
179
- ],
180
- isDisabled: false,
181
- checked: false,
182
- isChildrenVisible: true,
183
- },
184
- {
185
- id: 43234,
186
- title: "German Basics 1",
187
- selected: false,
188
- isDisabled: false,
189
- checked: false,
190
- },
191
- {
192
- id: 434,
193
- title: "German Basics 2",
194
- selected: false,
195
- isDisabled: false,
196
- checked: false,
197
- },
198
- {
199
- id: 4324,
200
- title: "German Basics 3",
201
- selected: false,
202
- isDisabled: false,
203
- checked: false,
204
- },
205
- {
206
- id: 41224,
207
- title: "German Basics 4",
208
- selected: false,
209
- isDisabled: false,
210
- checked: false,
211
- },
212
- {
213
- id: 990,
214
- title: "German Basics 5",
215
- selected: false,
216
- isDisabled: false,
217
- checked: false,
218
- },
219
- {
220
- id: 122324,
221
- title: "German Basics 6",
222
- selected: false,
223
- isDisabled: false,
224
- checked: false,
225
- },
226
- {
227
- id: 9123123,
228
- title: "German Basics 7",
229
- selected: false,
230
- isDisabled: false,
231
- checked: false,
232
- },
233
- ];
234
27
  export default {
235
- data() {
236
- return {
237
- opt: testData,
238
- selectedRolesVal: []
239
- }
28
+ components: {
29
+ IbDropdownList,
30
+ IbIconButton,
240
31
  },
241
- components: {IbSelect}
32
+ directives: { Tooltip },
242
33
  }
243
34
  </script>
@@ -29,9 +29,7 @@ const Template = (args) => ({
29
29
  },
30
30
  template: `
31
31
  <ib-modal v-bind="args">
32
- <template #trigger>
33
- <ib-button>Show modal</ib-button>
34
- </template>
32
+
35
33
  <template #header>
36
34
  Remove
37
35
  </template>
@@ -47,7 +45,11 @@ const Template = (args) => ({
47
45
  </ib-button-group>
48
46
  </template>
49
47
  </ib-modal>
48
+
49
+ <ib-button>Show modal</ib-button>
50
50
  `,
51
51
  });
52
52
 
53
- export const Default = Template.bind({});
53
+ export const Default = Template.bind({
54
+ active: true,
55
+ });
@@ -101,6 +101,7 @@ export default {
101
101
  );
102
102
 
103
103
  document.addEventListener("keydown", this.onKeydown);
104
+ document.addEventListener("blur", this.setFocusOnModal, true);
104
105
  },
105
106
  data() {
106
107
  return {
@@ -129,6 +130,13 @@ export default {
129
130
  document.body.classList.remove("modal-open");
130
131
  this.$emit("close");
131
132
  },
133
+ setFocusOnModal(e) {
134
+ if(!this.$refs.modal?.contains(e.target) && this.isActive) {
135
+ this.$refs.modal.querySelector(
136
+ "[tabindex], a, button, input, select, textarea"
137
+ ).focus();
138
+ }
139
+ },
132
140
  clickOutside(e) {
133
141
  if (this.stopPropagation) {
134
142
  return;
@@ -212,6 +220,7 @@ export default {
212
220
  }
213
221
 
214
222
  document.removeEventListener("keydown", this.onKeydown);
223
+ document.removeEventListener("blur", this.setFocusOnModal, true);
215
224
  },
216
225
  };
217
226
  </script>
@@ -658,6 +658,7 @@ export default {
658
658
  this.allOptionsIsChecked = false;
659
659
  this.selected = [];
660
660
  this.$emit("update:modelValue", null);
661
+ this.$emit("input", null);
661
662
  },
662
663
  clearValue() {
663
664
  this.clear();
@@ -43,7 +43,7 @@ const attachTooltipListeners = (el, binding) => {
43
43
  };
44
44
 
45
45
  const removeTooltipListeners = (el) => {
46
- tooltip.destroyTooltip();
46
+ tooltip.destroyTooltip(el);
47
47
  el.removeEventListener("mouseenter", el.__tooltip_create);
48
48
  document.removeEventListener("mousemove", el.__tooltip_destroy);
49
49
  };