@avakhula/ui 0.0.350 → 0.0.352

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.350",
3
+ "version": "0.0.352",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
@@ -1,5 +1,5 @@
1
1
  import Avatar from "./Avatar.vue";
2
- import { avatarSizes } from "./constants";
2
+ import { avatarSizes, avatarTypes } from "./constants";
3
3
 
4
4
  export default {
5
5
  title: "Avatar",
@@ -9,6 +9,10 @@ export default {
9
9
  control: { type: "select" },
10
10
  options: Object.values(avatarSizes),
11
11
  },
12
+ type: {
13
+ control: { type: "select" },
14
+ options: Object.values(avatarTypes),
15
+ },
12
16
  },
13
17
  };
14
18
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  <script>
28
28
  import IbIcon from "../Icon.vue";
29
- import { avatarSizes } from "./constants";
29
+ import { avatarSizes, avatarTypes } from "./constants";
30
30
 
31
31
  export default {
32
32
  name: "IbAvatar",
@@ -51,10 +51,14 @@ export default {
51
51
  type: String,
52
52
  default: avatarSizes.M,
53
53
  },
54
+ type: {
55
+ type: String,
56
+ default: avatarTypes.CIRCLE,
57
+ },
54
58
  },
55
59
  computed: {
56
60
  classList() {
57
- const classList = ["avatar", `avatar-size-${this.size}`];
61
+ const classList = ["avatar", `avatar-size-${this.size}`, `avatar-type-${this.type}`];
58
62
  return classList;
59
63
  },
60
64
  validateName() {
@@ -86,15 +90,34 @@ $avatar-border: $blue-200;
86
90
  justify-content: center;
87
91
  object-fit: cover;
88
92
 
93
+ &.avatar-type-circle {
94
+ border-radius: 100%;
95
+ }
96
+
97
+ &.avatar-type-square {
98
+ border-radius: 4px;
99
+ }
100
+
89
101
  &.avatar-size {
90
102
  &-m {
91
103
  width: 34px;
104
+ min-width: 34px;
92
105
  height: 34px;
106
+ min-height: 34px;
93
107
  }
94
108
 
95
109
  &-l {
96
110
  width: 74px;
111
+ min-width: 74px;
97
112
  height: 74px;
113
+ min-height: 74px;
114
+ }
115
+
116
+ &-xl {
117
+ width: 87px;
118
+ min-width: 87px;
119
+ height: 87px;
120
+ min-height: 87px;
98
121
  }
99
122
  }
100
123
 
@@ -1,4 +1,10 @@
1
1
  export const avatarSizes = {
2
2
  M: "m",
3
3
  L: "l",
4
+ XL: "xl",
4
5
  };
6
+
7
+ export const avatarTypes = {
8
+ SQUARE: "square",
9
+ CIRCLE: "circle",
10
+ };
@@ -12,12 +12,22 @@
12
12
  type="checkbox"
13
13
  :name="name"
14
14
  :id="id"
15
- :value="value"
15
+ :value="value ?? 1"
16
16
  :disabled="disabled"
17
17
  :required="required"
18
18
  v-model="checked"
19
19
  @click="onChange"
20
20
  />
21
+
22
+ <input
23
+ v-if="!value && !checked"
24
+ value="0"
25
+ type="hidden"
26
+ :name="name"
27
+ :disabled="disabled"
28
+ :required="required"
29
+ />
30
+
21
31
  <div class="ib-checkbox-body">
22
32
  <span
23
33
  v-if="labelPosition === 'left' && label.length"
@@ -72,10 +82,10 @@ export default {
72
82
  },
73
83
  },
74
84
  value: {
75
- default: 1,
85
+ type: [String, Number],
76
86
  },
77
87
  modelValue: {
78
- type: Boolean,
88
+ type: [Boolean, String],
79
89
  },
80
90
  isChecked: {
81
91
  type: Boolean,
@@ -108,12 +118,16 @@ export default {
108
118
  },
109
119
  modelValue(value) {
110
120
  this.$emit("update:modelValue", this.modelValue);
111
- this.checked = value;
121
+ this.checked = value === "0" ? false : Boolean(value);
112
122
  },
113
123
  },
114
124
  data() {
125
+ const value = this.modelValue
126
+ ? (this.modelValue === "0" ? false : Boolean(this.modelValue))
127
+ : this.isChecked;
128
+
115
129
  return {
116
- checked: this.modelValue ? this.modelValue : this.isChecked,
130
+ checked: value,
117
131
  };
118
132
  },
119
133
  methods: {
@@ -48,7 +48,7 @@
48
48
  >
49
49
  <input
50
50
  class="date-picker-input"
51
- :placeholder="placeholder"
51
+ :placeholder="endDatePlaceholder"
52
52
  ref="toDate"
53
53
  />
54
54
 
@@ -90,6 +90,10 @@ export default {
90
90
  type: String,
91
91
  default: "",
92
92
  },
93
+ endDatePlaceholder: {
94
+ type: String,
95
+ default: "",
96
+ },
93
97
  required: {
94
98
  type: Boolean,
95
99
  default: false,
@@ -138,7 +142,8 @@ export default {
138
142
  this.initFlatpickr();
139
143
  },
140
144
  modelValue() {
141
- this.initFlatpickr();
145
+ const value = this.modelValue[0] && this.modelValue[1] ? this.modelValue : [];
146
+ this.flat?.setDate(value, true);
142
147
  },
143
148
  },
144
149
  data() {
@@ -196,7 +201,7 @@ export default {
196
201
  if (this.mode === RANGE_MODE) {
197
202
  defaultConfig.defaultDate = this.modelValue.length
198
203
  ? [this.modelValue[0], this.modelValue[1]]
199
- : [this.value[0], this.value[1]];
204
+ : [this.value?.[0], this.value?.[1]];
200
205
  } else {
201
206
  defaultConfig.defaultDate = this.modelValue
202
207
  ? this.modelValue
@@ -277,6 +282,7 @@ export default {
277
282
  IbLabel,
278
283
  IbAlert,
279
284
  },
285
+ emits: ["input", "update:modelValue"],
280
286
  };
281
287
  </script>
282
288
  <style lang="scss">
@@ -30,7 +30,7 @@
30
30
  @click="clearInput"
31
31
  @keypress.enter="clearInput"
32
32
  v-if="type !== 'password' && showClearButton"
33
- v-show="actualValue?.length"
33
+ v-show="actualValue?.toString().length"
34
34
  >
35
35
  <ib-icon name="close-outline"></ib-icon>
36
36
  </ib-icon-button>
@@ -1,5 +1,5 @@
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
 
@@ -57,10 +57,22 @@ export default {
57
57
  type: String,
58
58
  default: "",
59
59
  },
60
+ value: {
61
+ type: String,
62
+ default: "",
63
+ },
64
+ },
65
+ watch: {
66
+ value() {
67
+ this.val = this.value;
68
+ },
69
+ val() {
70
+ this.$emit("update:value", this.val);
71
+ },
60
72
  },
61
73
  data() {
62
74
  return {
63
- val: "",
75
+ val: this.value,
64
76
  };
65
77
  },
66
78
  methods: {
@@ -93,6 +105,7 @@ export default {
93
105
  IbAlert,
94
106
  IbCharacterCount,
95
107
  },
108
+ emits: ["input", "blur", "update:value"],
96
109
  inheritAttrs: false,
97
110
  };
98
111
  </script>
@@ -1,6 +1,10 @@
1
1
  @import "../../assets/scss/variables/colors.scss";
2
2
  @import "../../assets/scss/mixins.scss";
3
3
 
4
+ // Disabled button colors
5
+ $disabled-btn-background: $gray-100;
6
+ $disabled-btn-color: $neutral-500;
7
+
4
8
  .ib-icon-button {
5
9
  padding: 0;
6
10
  display: flex;
@@ -93,6 +97,13 @@
93
97
  color: $blue-900;
94
98
  background-color: $blue-200;
95
99
  }
100
+
101
+ &:disabled {
102
+ background: $disabled-btn-background;
103
+ color: $disabled-btn-color;
104
+ cursor: auto;
105
+ border-color: transparent;
106
+ }
96
107
  }
97
108
  }
98
109
  }
@@ -8,6 +8,19 @@
8
8
  <div class="head-content">
9
9
  <slot name="head-content" />
10
10
  </div>
11
+
12
+ <icon-button
13
+ v-if="showOpenButton"
14
+ :class="{
15
+ 'toggle-visible-button': true,
16
+ 'active': isOpenVal,
17
+ }"
18
+ kind="ghost"
19
+ type="button"
20
+ @click="isOpenVal = !isOpenVal"
21
+ >
22
+ <icon name="chevron-down-outline" />
23
+ </icon-button>
11
24
  </div>
12
25
  <Transition
13
26
  name="expand"
@@ -15,7 +28,7 @@
15
28
  @after-enter="afterEnter"
16
29
  @leave="leave"
17
30
  >
18
- <div v-show="isOpen" class="panel-body">
31
+ <div v-show="isOpenVal" class="panel-body">
19
32
  <slot name="body"></slot>
20
33
  </div>
21
34
  </Transition>
@@ -23,12 +36,18 @@
23
36
  </template>
24
37
 
25
38
  <script>
39
+ import IconButton from "../IconButton/IconButton.vue";
40
+ import Icon from "../Icon.vue";
26
41
  import expandAnimation from "../../mixins/expandAnimation";
27
42
 
28
43
  export default {
29
44
  name: "IbPanel",
30
45
  mixins: [expandAnimation],
31
46
  props: {
47
+ showOpenButton: {
48
+ type: Boolean,
49
+ default: false,
50
+ },
32
51
  isOpen: {
33
52
  type: Boolean,
34
53
  default: true,
@@ -38,6 +57,24 @@ export default {
38
57
  default: false,
39
58
  },
40
59
  },
60
+ watch: {
61
+ isOpen() {
62
+ this.isOpenVal = this.isOpen;
63
+ },
64
+ isOpenVal() {
65
+ this.$emit("update:isOpen", this.isOpenVal);
66
+ },
67
+ },
68
+ data() {
69
+ return {
70
+ isOpenVal: this.isOpen,
71
+ };
72
+ },
73
+ components: {
74
+ IconButton,
75
+ Icon,
76
+ },
77
+ emits: ["update:isOpen"],
41
78
  };
42
79
  </script>
43
80
 
@@ -69,6 +106,20 @@ $panel-divider-color: $gray-300;
69
106
  outline: 2px solid $panel-error-outline-color;
70
107
  }
71
108
 
109
+ .toggle-visible-button {
110
+ margin-left: 10px;
111
+
112
+ ion-icon {
113
+ transition: transform 0.5s;
114
+ }
115
+
116
+ &.active {
117
+ ion-icon {
118
+ transform: rotate(180deg);
119
+ }
120
+ }
121
+ }
122
+
72
123
  .panel-head {
73
124
  display: inline-flex;
74
125
  width: 100%;
@@ -53,7 +53,7 @@ export default {
53
53
  padding: 10px;
54
54
  max-width: 240px;
55
55
  box-shadow: $ib-shadow-1;
56
- z-index: 10002;
56
+ z-index: 10051;
57
57
 
58
58
  &.ib-tooltip-large {
59
59
  box-shadow: $ib-shadow-2;