@avakhula/ui 0.0.207 → 0.0.208

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.207",
3
+ "version": "0.0.208",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
@@ -29,16 +29,16 @@
29
29
  "@babel/core": "^7.20.7",
30
30
  "@babel/preset-env": "^7.21.4",
31
31
  "@rushstack/eslint-patch": "^1.1.4",
32
- "@storybook/addon-a11y": "^7.1.0",
33
- "@storybook/addon-actions": "^7.1.0",
34
- "@storybook/addon-docs": "^7.1.0",
35
- "@storybook/addon-essentials": "^7.1.0",
36
- "@storybook/addon-interactions": "^7.1.0",
37
- "@storybook/addon-links": "^7.1.0",
38
- "@storybook/addon-mdx-gfm": "^7.1.0",
32
+ "@storybook/addon-a11y": "^7.3.2",
33
+ "@storybook/addon-actions": "^7.3.2",
34
+ "@storybook/addon-docs": "^7.3.2",
35
+ "@storybook/addon-essentials": "^7.3.2",
36
+ "@storybook/addon-interactions": "^7.3.2",
37
+ "@storybook/addon-links": "^7.3.2",
38
+ "@storybook/addon-mdx-gfm": "^7.3.2",
39
39
  "@storybook/testing-library": "^0.2.0",
40
- "@storybook/vue3": "^7.1.0",
41
- "@storybook/vue3-vite": "^7.1.0",
40
+ "@storybook/vue3": "^7.3.2",
41
+ "@storybook/vue3-vite": "^7.3.2",
42
42
  "@vitejs/plugin-vue": "^4.0.0",
43
43
  "@vitest/coverage-c8": "^0.28.4",
44
44
  "@vue/eslint-config-prettier": "^7.0.0",
@@ -56,7 +56,7 @@
56
56
  "react-dom": "^18.2.0",
57
57
  "sass": "^1.57.1",
58
58
  "sass-loader": "^13.2.0",
59
- "storybook": "^7.1.0",
59
+ "storybook": "^7.3.2",
60
60
  "vite": "^4.0.0",
61
61
  "vitest": "^0.28.4",
62
62
  "vue-loader": "^16.8.3",
package/src/App.vue CHANGED
@@ -1,30 +1,131 @@
1
1
  <template>
2
- <div style="padding-left: 200px;padding-top: 200px;">
2
+ <ib-select :options="opt"/>
3
3
 
4
- <ib-sorting
5
- title="'test'"
6
- class="table-sorting"
7
- view="table-sorting"
8
- table-name="user-list-table"
9
- toggle-tip-title="some title"
10
- >
11
- <template #toggleTipBody>
12
- hello
13
- </template>
14
-
15
- <template #toggleTipButtons>
16
- some buttons
17
- </template>
18
- </ib-sorting>
19
- </div>
20
4
  </template>
21
5
 
22
6
  <script>
23
- import IbSorting from "./components/Sorting/Sorting.vue";
7
+ import IbSelect from "./components/TreeSelect/Select.vue";
8
+ const testData1 = [
9
+ {
10
+ id: "1",
11
+ title: "A Education",
12
+ is_category: true,
13
+ initiallyVisible: true,
14
+ visible: true,
15
+ isDisabled: false,
16
+ checked: true,
17
+ isChildrenVisible: true,
18
+ },
19
+ {
20
+ id: "2",
21
+ title: "Education 2",
22
+ is_category: true,
23
+ initiallyVisible: true,
24
+ visible: true,
25
+ isDisabled: false,
26
+ checked: false,
27
+ isChildrenVisible: true,
28
+ },
29
+ {
30
+ id: "3",
31
+ title: "Education 3",
32
+ is_category: true,
33
+ initiallyVisible: true,
34
+ visible: true,
35
+ isDisabled: false,
36
+ checked: false,
37
+ isChildrenVisible: true,
38
+ },
39
+ {
40
+ id: "4",
41
+ title: "Education 4",
42
+ is_category: true,
43
+ initiallyVisible: true,
44
+ visible: true,
45
+ isDisabled: false,
46
+ checked: false,
47
+ isChildrenVisible: true,
48
+ },
49
+ {
50
+ id: "5",
51
+ title: "Education 5",
52
+ is_category: true,
53
+ initiallyVisible: true,
54
+ visible: true,
55
+ isDisabled: false,
56
+ checked: false,
57
+ isChildrenVisible: true,
58
+ },
59
+
60
+ {
61
+ id: "6",
62
+ title: "Education 6",
63
+ is_category: true,
64
+ initiallyVisible: true,
65
+ visible: true,
66
+ isDisabled: false,
67
+ checked: false,
68
+ isChildrenVisible: true,
69
+ },
70
+
71
+ {
72
+ id: "7",
73
+ title: "Education 7",
74
+ is_category: true,
75
+ initiallyVisible: true,
76
+ visible: true,
77
+ isDisabled: false,
78
+ checked: false,
79
+ isChildrenVisible: true,
80
+ },
24
81
 
82
+ {
83
+ id: "8",
84
+ title: "Education 8",
85
+ is_category: true,
86
+ initiallyVisible: true,
87
+ visible: true,
88
+ isDisabled: false,
89
+ checked: false,
90
+ isChildrenVisible: true,
91
+ },
92
+ {
93
+ id: "9",
94
+ title: "Education 9",
95
+ is_category: true,
96
+ initiallyVisible: true,
97
+ visible: true,
98
+ isDisabled: false,
99
+ checked: false,
100
+ isChildrenVisible: true,
101
+ },
102
+ {
103
+ id: "10",
104
+ title: "Education 10",
105
+ is_category: true,
106
+ initiallyVisible: true,
107
+ visible: true,
108
+ isDisabled: false,
109
+ checked: false,
110
+ isChildrenVisible: true,
111
+ },
112
+ {
113
+ id: "11",
114
+ title: "Education 11",
115
+ is_category: true,
116
+ initiallyVisible: true,
117
+ visible: true,
118
+ isDisabled: false,
119
+ checked: false,
120
+ isChildrenVisible: true,
121
+ },
122
+ ];
25
123
  export default {
26
- components: {
27
- IbSorting,
28
- }
124
+ data() {
125
+ return {
126
+ opt: testData1,
127
+ }
128
+ },
129
+ components: {IbSelect}
29
130
  }
30
131
  </script>
@@ -76,13 +76,10 @@ $content-bg: $gray-50;
76
76
  .accordion-content {
77
77
  border-radius: 0 0 4px 4px;
78
78
  border: 1px solid $content-border-color;
79
+ padding:10px 15px 15px;
79
80
  overflow: hidden;
80
81
  transition: height 0.3s, padding-top 0.3s, padding-bottom 0.3s;
81
82
  background-color: $content-bg;
82
-
83
- .accordion-content-wrapper {
84
- padding: 10px 15px 15px;
85
- }
86
83
  }
87
84
 
88
85
  &.active {
@@ -1,6 +1,12 @@
1
1
  <template>
2
2
  <div class="ib-accordion" :class="{ active: isActive }">
3
- <button class="accordion-title" @click="onClick">
3
+ <button
4
+ class="accordion-title"
5
+ :id="'accordion' + uuid"
6
+ :aria-controls="'accordion-section-' + uuid"
7
+ :aria-expanded="isActive"
8
+ @click="onClick"
9
+ >
4
10
  <slot name="title"></slot>
5
11
 
6
12
  <ib-icon class="chevron-icon" name="chevron-down-outline" />
@@ -12,16 +18,21 @@
12
18
  @after-enter="afterEnter"
13
19
  @leave="leave"
14
20
  >
15
- <div v-show="isActive" class="accordion-content">
16
- <div class="accordion-content-wrapper">
17
- <slot name="content"></slot>
18
- </div>
21
+ <div
22
+ v-show="isActive"
23
+ role="region"
24
+ class="accordion-content"
25
+ :id="'accordion-section-' + uuid"
26
+ :aria-labelledby="'accordion' + uuid"
27
+ >
28
+ <slot name="content"></slot>
19
29
  </div>
20
30
  </Transition>
21
31
  </div>
22
32
  </template>
23
33
 
24
34
  <script>
35
+ import generateUID from "../../helpers/generateUID";
25
36
  import expandAnimation from "../../mixins/expandAnimation";
26
37
  import IbIcon from "../Icon.vue";
27
38
 
@@ -42,6 +53,7 @@ export default {
42
53
  data() {
43
54
  return {
44
55
  isActive: this.isOpen,
56
+ uuid: generateUID(),
45
57
  };
46
58
  },
47
59
  methods: {
@@ -147,7 +147,6 @@ $alert-success-secondary-color: $green-50;
147
147
  margin-right: 5px;
148
148
  }
149
149
 
150
- &-error,
151
150
  &-alert {
152
151
  border-left-color: $alert-alert-primary-color;
153
152
  background-color: $alert-alert-secondary-color;
@@ -1,6 +1,5 @@
1
1
  export const alertTypeOptions = {
2
2
  alert: "alert",
3
- error: "error",
4
3
  warning: "warning",
5
4
  info: "info",
6
5
  success: "success",
@@ -1,10 +1,5 @@
1
1
  <template>
2
- <img
3
- v-if="src && !userAvatar"
4
- :class="classList"
5
- :src="src"
6
- :alt="firstName + '' + lastName"
7
- />
2
+ <img v-if="src && !userAvatar" :class="classList" :src="src" :alt="name" />
8
3
 
9
4
  <div
10
5
  v-else-if="src && userAvatar"
@@ -15,7 +10,7 @@
15
10
  }"
16
11
  ></div>
17
12
 
18
- <div v-else-if="!validateName" class="empty-avatar" :class="classList">
13
+ <div v-else-if="validateName" class="empty-avatar" :class="classList">
19
14
  <ib-icon name="camera-outline" />
20
15
  </div>
21
16
 
@@ -31,11 +26,7 @@ import { avatarSizes } from "./constants";
31
26
  export default {
32
27
  name: "IbAvatar",
33
28
  props: {
34
- firstName: {
35
- type: String,
36
- default: "",
37
- },
38
- lastName: {
29
+ name: {
39
30
  type: String,
40
31
  default: "",
41
32
  },
@@ -58,13 +49,14 @@ export default {
58
49
  return classList;
59
50
  },
60
51
  validateName() {
61
- return (
62
- this.firstName?.trim().length !== 0 &&
63
- this.lastName?.trim().length !== 0
64
- );
52
+ return this.name?.trim().split(" ").length < 2;
65
53
  },
66
54
  initials() {
67
- return this.firstName[0].toUpperCase() + this.lastName[0].toUpperCase();
55
+ const words = this.name.split(" ");
56
+
57
+ return words.length === 1
58
+ ? (words[0][0] + words[0][1]).toUpperCase()
59
+ : (words[0][0] + words[1][0]).toUpperCase();
68
60
  },
69
61
  },
70
62
  components: {
@@ -2,8 +2,10 @@
2
2
  <div class="ib-dropdown" v-outside="close">
3
3
  <span
4
4
  class="dropdown-trigger"
5
- :class="triggerClasses"
6
5
  ref="dropdown"
6
+ aria-haspopup="true"
7
+ :class="triggerClasses"
8
+ :aria-expanded="isOpenedState ? true : false"
7
9
  @keydown="onKeydown"
8
10
  @click.prevent.stop="toggle"
9
11
  v-if="hasTrigger && triggerType === 'click'"
@@ -23,6 +25,7 @@
23
25
 
24
26
  <div
25
27
  ref="body"
28
+ role="menu"
26
29
  :class="'ib-dropdown-menu ' + classes"
27
30
  v-if="!destroyOnHide || isOpenedState"
28
31
  v-show="isOpenedState"
@@ -35,7 +38,7 @@
35
38
  </span>
36
39
  </div>
37
40
  <div class="footer-slot">
38
- <slot name="footerslot"></slot>
41
+ <slot name="footer"></slot>
39
42
  </div>
40
43
  </div>
41
44
 
@@ -1,49 +1,51 @@
1
1
  <template>
2
- <label
3
- v-bind="attrs"
4
- :for="id"
5
- :tabindex="disabled ? -1 : 0"
6
- @keypress.prevent="onChange"
7
- >
8
- <input
9
- tabindex="-1"
10
- type="checkbox"
11
- :name="name"
12
- :id="id"
13
- :value="value"
14
- :checked="checked"
15
- :disabled="disabled"
16
- :required="required"
17
- @click="onChange"
18
- />
19
- <div class="ib-checkbox-body">
20
- <span
21
- v-if="labelPosition === 'left' && label.length"
22
- class="ib-checkbox-label"
23
- :class="{ 'ib-checkbox-label-left': labelPosition === 'left' }"
24
- >
25
- <span v-if="required" class="required">*</span>
26
- {{ label }}
27
- </span>
2
+ <div role="checkbox" :aria-checked="checked ? true : false">
3
+ <label
4
+ v-bind="attrs"
5
+ :for="id"
6
+ :tabindex="disabled | disableFocus ? -1 : 0"
7
+ @keypress.prevent="onChange"
8
+ >
9
+ <input
10
+ tabindex="-1"
11
+ type="checkbox"
12
+ :name="name"
13
+ :id="id"
14
+ :value="value"
15
+ :checked="checked"
16
+ :disabled="disabled"
17
+ :required="required"
18
+ @click="onChange"
19
+ />
20
+ <div class="ib-checkbox-body">
21
+ <span
22
+ v-if="labelPosition === 'left' && label.length"
23
+ class="ib-checkbox-label"
24
+ :class="{ 'ib-checkbox-label-left': labelPosition === 'left' }"
25
+ >
26
+ <span v-if="required" class="required">*</span>
27
+ {{ label }}
28
+ </span>
28
29
 
29
- <span class="ib-checkbox-input">
30
- <ib-icon name="checkmark-sharp" v-show="checked && !indeterminate" />
31
- <ib-icon
32
- :class="'checkbox-undeterminate-icon'"
33
- name="remove-sharp"
34
- v-show="indeterminate"
35
- />
36
- </span>
30
+ <span class="ib-checkbox-input">
31
+ <ib-icon name="checkmark-sharp" v-show="checked && !indeterminate" />
32
+ <ib-icon
33
+ :class="'checkbox-undeterminate-icon'"
34
+ name="remove-sharp"
35
+ v-show="indeterminate"
36
+ />
37
+ </span>
37
38
 
38
- <span
39
- v-if="labelPosition === 'right' && label?.length"
40
- class="ib-checkbox-label"
41
- >
42
- <span v-if="required" class="required">*</span>
43
- {{ label }}
44
- </span>
45
- </div>
46
- </label>
39
+ <span
40
+ v-if="labelPosition === 'right' && label?.length"
41
+ class="ib-checkbox-label"
42
+ >
43
+ <span v-if="required" class="required">*</span>
44
+ {{ label }}
45
+ </span>
46
+ </div>
47
+ </label>
48
+ </div>
47
49
  </template>
48
50
  <script>
49
51
  import generateUID from "../../../helpers/generateUID";
@@ -82,6 +84,10 @@ export default {
82
84
  type: Boolean,
83
85
  default: false,
84
86
  },
87
+ disableFocus: {
88
+ type: Boolean,
89
+ default: false,
90
+ },
85
91
  required: {
86
92
  type: Boolean,
87
93
  default: false,
@@ -232,7 +232,7 @@ export default {
232
232
  return classList;
233
233
  },
234
234
  attrs() {
235
- let attrs = removeEvents({ ...this.$attrs });
235
+ let attrs = removeEvents({ ...this.$attrs }, ['onInput', 'onBlur']);
236
236
 
237
237
  attrs.type =
238
238
  this.type === inputTypeOptions.password
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <label :class="classes" :for="id" @click.prevent="onClick">
2
+ <label
3
+ role="radio"
4
+ :class="classes"
5
+ :for="id"
6
+ :aria-checked="checked"
7
+ @click.prevent="onClick"
8
+ >
3
9
  <input
4
10
  type="radio"
5
11
  :name="name"
@@ -1,8 +1,11 @@
1
1
  <template>
2
2
  <label
3
+ role="switch"
4
+ :aria-checked="checked"
5
+ :tabindex="disabled ? -1 : 0"
3
6
  :class="classes"
4
7
  @keypress.space.prevent="onChange"
5
- :tabindex="disabled ? -1 : 0"
8
+ @keypress.enter.prevent="onChange"
6
9
  >
7
10
  <div class="toggle-wrapper" ref="wrapper">
8
11
  <div class="toggle" ref="toggle">
@@ -100,11 +100,7 @@ export default {
100
100
  }
101
101
  );
102
102
 
103
- document.addEventListener("keydown", (e) => {
104
- if (e.keyCode === ESC_KEY_CODE && !this.stopPropagation && this.active) {
105
- this.close();
106
- }
107
- });
103
+ document.addEventListener("keydown", this.onKeydown);
108
104
  },
109
105
  data() {
110
106
  return {
@@ -142,6 +138,11 @@ export default {
142
138
  this.close();
143
139
  }
144
140
  },
141
+ onKeydown(e) {
142
+ if (e.keyCode === ESC_KEY_CODE && !this.stopPropagation && this.isActive) {
143
+ this.close();
144
+ }
145
+ }
145
146
  },
146
147
  computed: {
147
148
  bodyStyles() {
@@ -209,6 +210,8 @@ export default {
209
210
  if (this.isActive) {
210
211
  this.close();
211
212
  }
213
+
214
+ document.removeEventListener("keydown", this.onKeydown);
212
215
  },
213
216
  };
214
217
  </script>
@@ -1,7 +1,14 @@
1
1
  <template>
2
2
  <div class="ib-progress-bar-wrapper">
3
3
  <div :class="classes">
4
- <div class="progress" :style="{ width: progress + '%' }">
4
+ <div
5
+ class="progress"
6
+ role="meter"
7
+ aria-valuemin="0"
8
+ aria-valuemax="100"
9
+ :aria-valuenow="progress"
10
+ :style="{ width: progress + '%' }"
11
+ >
5
12
  <div class="gradient"></div>
6
13
  </div>
7
14
  <div></div>
@@ -16,7 +16,7 @@ export default {
16
16
  },
17
17
  tooltipPosition: {
18
18
  control: { type: "select" },
19
- options: Object.keys(popoverPosition),
19
+ options: Object.values(popoverPosition),
20
20
  },
21
21
  },
22
22
  };