@avakhula/ui 0.1.6 → 0.1.8

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.1.6",
3
+ "version": "0.1.8",
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,36 +1,135 @@
1
1
  <template>
2
- <div class="page">
2
+ <ib-select :options="opt">
3
+ <template v-slot:triggerContent="{ selectedCount }">
4
+ {{ selectedCount }}
5
+ </template>
6
+ </ib-select>
3
7
 
4
- <sorting view="table-sorting" toggle-tip-title="hello" :table-name="'table'" :title="'test'">
5
-
6
- <!-- <template #toggleTipBody>
7
- <p>
8
- test
9
- </p>
10
- </template>
8
+ </template>
11
9
 
12
- <template #toggleTipButtons>
13
- <p>
14
- test
15
- </p>
16
- </template> -->
10
+ <script>
11
+ import IbSelect from "./components/TreeSelect/Select.vue";
12
+ const testData1 = [
13
+ {
14
+ id: "1",
15
+ title: "A Education",
16
+ is_category: true,
17
+ initiallyVisible: true,
18
+ visible: true,
19
+ isDisabled: false,
20
+ checked: true,
21
+ isChildrenVisible: true,
22
+ },
23
+ {
24
+ id: "2",
25
+ title: "Education 2",
26
+ is_category: true,
27
+ initiallyVisible: true,
28
+ visible: true,
29
+ isDisabled: false,
30
+ checked: false,
31
+ isChildrenVisible: true,
32
+ },
33
+ {
34
+ id: "3",
35
+ title: "Education 3",
36
+ is_category: true,
37
+ initiallyVisible: true,
38
+ visible: true,
39
+ isDisabled: false,
40
+ checked: false,
41
+ isChildrenVisible: true,
42
+ },
43
+ {
44
+ id: "4",
45
+ title: "Education 4",
46
+ is_category: true,
47
+ initiallyVisible: true,
48
+ visible: true,
49
+ isDisabled: false,
50
+ checked: false,
51
+ isChildrenVisible: true,
52
+ },
53
+ {
54
+ id: "5",
55
+ title: "Education 5",
56
+ is_category: true,
57
+ initiallyVisible: true,
58
+ visible: true,
59
+ isDisabled: false,
60
+ checked: false,
61
+ isChildrenVisible: true,
62
+ },
17
63
 
64
+ {
65
+ id: "6",
66
+ title: "Education 6",
67
+ is_category: true,
68
+ initiallyVisible: true,
69
+ visible: true,
70
+ isDisabled: false,
71
+ checked: false,
72
+ isChildrenVisible: true,
73
+ },
18
74
 
19
- </sorting>
20
- </div>
21
- </template>
75
+ {
76
+ id: "7",
77
+ title: "Education 7",
78
+ is_category: true,
79
+ initiallyVisible: true,
80
+ visible: true,
81
+ isDisabled: false,
82
+ checked: false,
83
+ isChildrenVisible: true,
84
+ },
22
85
 
23
- <script>
24
- import Sorting from './components/Sorting/Sorting.vue';
86
+ {
87
+ id: "8",
88
+ title: "Education 8",
89
+ is_category: true,
90
+ initiallyVisible: true,
91
+ visible: true,
92
+ isDisabled: false,
93
+ checked: false,
94
+ isChildrenVisible: true,
95
+ },
96
+ {
97
+ id: "9",
98
+ title: "Education 9",
99
+ is_category: true,
100
+ initiallyVisible: true,
101
+ visible: true,
102
+ isDisabled: false,
103
+ checked: false,
104
+ isChildrenVisible: true,
105
+ },
106
+ {
107
+ id: "10",
108
+ title: "Education 10",
109
+ is_category: true,
110
+ initiallyVisible: true,
111
+ visible: true,
112
+ isDisabled: false,
113
+ checked: false,
114
+ isChildrenVisible: true,
115
+ },
116
+ {
117
+ id: "11",
118
+ title: "Education 11",
119
+ is_category: true,
120
+ initiallyVisible: true,
121
+ visible: true,
122
+ isDisabled: false,
123
+ checked: false,
124
+ isChildrenVisible: true,
125
+ },
126
+ ];
25
127
  export default {
26
- components: {
27
- Sorting
28
- }
29
- }
30
- </script>
31
-
32
- <style lang="scss">
33
- .page {
34
- padding: 200px;
128
+ data() {
129
+ return {
130
+ opt: testData1,
131
+ }
132
+ },
133
+ components: {IbSelect}
35
134
  }
36
- </style>
135
+ </script>
@@ -5,13 +5,13 @@
5
5
  $checkbox-bg-disabled: $gray-100;
6
6
  $checkbox-filed-bg-disabled: $neutral-500;
7
7
  $checkbox-border-disabled: $neutral-500;
8
- $checkbox-border: $gray-500;
8
+ $checkbox-border: $gray-600;
9
9
  $checkbox-bg: transparent;
10
10
  $checkbox-checkmark: $neutral-900;
11
11
  $checkbox-border-hover: $blue-300;
12
12
  $checkbox-bg-hover: $blue-100;
13
13
  $checkbox-border-active: transparent;
14
- $checkbox-bg-active: $blue-300;
14
+ $checkbox-bg-active: $blue-200;
15
15
  $checkbox-text-color-disabled: $neutral-500;
16
16
  $checkbox-bg-error: transparent;
17
17
  $checkbox-border-error: $red-800;
@@ -184,6 +184,7 @@ export default {
184
184
  this.actualValue = "";
185
185
  this.$emit("update:modelValue", this.actualValue);
186
186
  this.$emit("input", this.actualValue);
187
+ this.$emit("clear");
187
188
  },
188
189
  onBlur() {
189
190
  this.$emit("blur", this.actualValue);
@@ -261,6 +262,7 @@ export default {
261
262
  "input",
262
263
  "blur",
263
264
  "focus",
265
+ "clear",
264
266
  "update:modelValue",
265
267
  `label:disabled:${this?.id}`,
266
268
  ],
@@ -11,7 +11,7 @@ $radio-bg-hover: $blue-100;
11
11
  $radio-bg-active: $blue-200;
12
12
  $radio-bg-disabled: $gray-100;
13
13
  $radio-bg-error: transparent;
14
- $radio-border: $gray-500;
14
+ $radio-border: $gray-600;
15
15
  $radio-border-hover: $blue-300;
16
16
  $radio-border-active: $blue-200;
17
17
  $radio-border-disabled: $neutral-500;
@@ -3,7 +3,12 @@
3
3
  {{ errorMessage }}
4
4
  </ib-alert>
5
5
 
6
- <div class="tree-select" :class="classList">
6
+ <div
7
+ class="tree-select"
8
+ :class="{
9
+ ...classList, 'tree-select-custom-trigger-content': hasTriggerContent
10
+ }"
11
+ >
7
12
  <ib-dropdown
8
13
  :disabled="isLoading"
9
14
  :is-resizable="isResizable"
@@ -30,40 +35,49 @@
30
35
  :aria-activedescendant="focusedOptionId"
31
36
  :class="{
32
37
  'tree-choice-opened': isOpened,
33
- 'has-clear-button': !showClearButton,
38
+ 'has-clear-button': showClearButton,
34
39
  'tree-choice-error': errorMessage,
35
40
  }"
36
41
  >
37
- <template v-if="htmlOptionTitle">
38
- <span
39
- :class="{ placeholder: !selectStatus }"
40
- v-html="selectStatus || placeholder"
41
- ></span>
42
+
43
+ <template v-if="hasTriggerContent">
44
+ <slot v-bind:selected-count="selectedKeys.length" name="triggerContent"></slot>
42
45
  </template>
46
+
43
47
  <template v-else>
44
- <span :class="{ placeholder: !selectStatus }">
45
- {{ selectStatus || placeholder }}
46
- </span>
48
+ <template v-if="htmlOptionTitle">
49
+ <span
50
+ :class="{ placeholder: !selectStatus }"
51
+ v-html="selectStatus || placeholder"
52
+ ></span>
53
+ </template>
54
+ <template v-else>
55
+ <span :class="{ placeholder: !selectStatus }">
56
+ {{ selectStatus || placeholder }}
57
+ </span>
58
+ </template>
47
59
  </template>
48
- </div>
49
- <ib-icon-button
50
- v-if="showClearButton"
51
- kind="ghost"
52
- class="button-clear"
53
- @click.prevent="clearValue"
54
- @keypress.enter.stop.prevent
55
- @keydown.enter.stop.prevent
56
- @keyup.enter.prevent="clearValue"
57
- :help-text="clearButtonMessage"
58
- v-show="Object.keys(selected).length"
59
- >
60
- <ib-icon name="close-outline"></ib-icon>
61
- </ib-icon-button>
62
60
 
63
- <ib-icon
64
- :name="isOpened ? 'chevron-up-outline' : 'chevron-down-outline'"
65
- :classes="'tree-select-caret'"
66
- />
61
+ <ib-icon-button
62
+ v-if="showClearButton"
63
+ kind="ghost"
64
+ class="button-clear"
65
+ @click.prevent="clearValue"
66
+ @keypress.enter.stop.prevent
67
+ @keydown.enter.stop.prevent
68
+ @keyup.enter.prevent="clearValue"
69
+ :help-text="clearButtonMessage"
70
+ v-show="Object.keys(selected).length"
71
+ >
72
+ <ib-icon name="close-outline"></ib-icon>
73
+ </ib-icon-button>
74
+
75
+ <ib-icon
76
+ :name="isOpened ? 'chevron-up-outline' : 'chevron-down-outline'"
77
+ :classes="'tree-select-caret'"
78
+ />
79
+ </div>
80
+
67
81
  </template>
68
82
 
69
83
  <template v-slot:body>
@@ -930,6 +944,9 @@ export default {
930
944
  hasTrigger() {
931
945
  return !!this.$slots.trigger;
932
946
  },
947
+ hasTriggerContent() {
948
+ return !!this.$slots.triggerContent;
949
+ },
933
950
  hasEmptyMessage() {
934
951
  return !!this.$slots.emptyMessage;
935
952
  },
@@ -27,6 +27,10 @@ $tree-search-border-color: $gray-600;
27
27
  .tree-select {
28
28
  width: 100%;
29
29
 
30
+ &.tree-select-custom-trigger-content {
31
+ width: fit-content;
32
+ }
33
+
30
34
  .ib-dropdown {
31
35
  width: 100%;
32
36
  }
@@ -51,6 +55,7 @@ $tree-search-border-color: $gray-600;
51
55
  display: flex;
52
56
  align-items: center;
53
57
  justify-content: center;
58
+ font-size: 16px;
54
59
  }
55
60
 
56
61
  &:hover {
@@ -77,12 +82,16 @@ $tree-search-border-color: $gray-600;
77
82
  justify-content: space-between;
78
83
  overflow: hidden;
79
84
  position: relative;
80
- padding-right: 40px;
85
+ padding-right: 30px;
81
86
  border-bottom: 1px solid $choice-border-color;
82
87
  transition: background-color 0.3s, border-color 0.3s, border-radius 0.3s;
83
88
 
84
89
  &.has-clear-button {
85
- padding-right: 30px;
90
+ padding-right: 60px;
91
+ }
92
+
93
+ &.tree-choice-custom-content {
94
+ width: fit-content;
86
95
  }
87
96
 
88
97
  span {