vueless 0.0.282 → 0.0.284

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": "vueless",
3
- "version": "0.0.282",
3
+ "version": "0.0.284",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -22,8 +22,8 @@ export default function useAttrs(props) {
22
22
  ...props,
23
23
  color: getColor(props.color),
24
24
  square: props.loading || props.square,
25
- iconLeft: Boolean(props.iconLeft) || hasSlotContent(slots["icon-left"]),
26
- iconRight: Boolean(props.iconRight) || hasSlotContent(slots["icon-right"]),
25
+ leftIcon: Boolean(props.iconLeft) || hasSlotContent(slots["left-icon"]),
26
+ rightIcon: Boolean(props.iconRight) || hasSlotContent(slots["right-icon"]),
27
27
  });
28
28
  }
29
29
 
@@ -124,18 +124,18 @@ export default /*tw*/ {
124
124
  { filled: true, variant: "thirdary", class: "bg-{color}-600/10" },
125
125
  { filled: true, variant: "thirdary", color: "grayscale", class: "bg-gray-900/10" },
126
126
  { filled: true, variant: "thirdary", color: "white", class: "bg-gray-50" },
127
- { iconLeft: true, size: "2xs", class: "pl-1" },
128
- { iconLeft: true, size: "xs", class: "pl-2" },
129
- { iconLeft: true, size: "sm", class: "pl-3" },
130
- { iconLeft: true, size: "md", class: "pl-4" },
131
- { iconLeft: true, size: "lg", class: "pl-5" },
132
- { iconLeft: true, size: "xl", class: "pl-6" },
133
- { iconRight: true, size: "2xs", class: "pr-1" },
134
- { iconRight: true, size: "xs", class: "pr-2" },
135
- { iconRight: true, size: "sm", class: "pr-3" },
136
- { iconRight: true, size: "md", class: "pr-4" },
137
- { iconRight: true, size: "lg", class: "pr-5" },
138
- { iconRight: true, size: "xl", class: "pr-6" },
127
+ { leftIcon: true, size: "2xs", class: "pl-1" },
128
+ { leftIcon: true, size: "xs", class: "pl-2" },
129
+ { leftIcon: true, size: "sm", class: "pl-3" },
130
+ { leftIcon: true, size: "md", class: "pl-4" },
131
+ { leftIcon: true, size: "lg", class: "pl-5" },
132
+ { leftIcon: true, size: "xl", class: "pl-6" },
133
+ { rightIcon: true, size: "2xs", class: "pr-1" },
134
+ { rightIcon: true, size: "xs", class: "pr-2" },
135
+ { rightIcon: true, size: "sm", class: "pr-3" },
136
+ { rightIcon: true, size: "md", class: "pr-4" },
137
+ { rightIcon: true, size: "lg", class: "pr-5" },
138
+ { rightIcon: true, size: "xl", class: "pr-6" },
139
139
  { square: true, size: "2xs", class: "p-1" },
140
140
  { square: true, size: "xs", class: "p-1.5" },
141
141
  { square: true, size: "sm", class: "p-2" },
@@ -145,8 +145,8 @@ export default /*tw*/ {
145
145
  ],
146
146
  },
147
147
  text: "whitespace-nowrap focus-visible:outline-none",
148
- iconLeft: "{UIcon}",
149
- iconRight: "{UIcon}",
148
+ leftIcon: "{UIcon}",
149
+ rightIcon: "{UIcon}",
150
150
  defaultVariants: {
151
151
  color: "brand",
152
152
  variant: "primary",
@@ -100,14 +100,14 @@ noRing.args = { noRing: true };
100
100
  export const colors = ColorTemplate.bind({});
101
101
  colors.args = {};
102
102
 
103
- export const iconLeft = DefaultTemplate.bind({});
104
- iconLeft.args = {
105
- iconLeft: "star",
103
+ export const leftIcon = DefaultTemplate.bind({});
104
+ leftIcon.args = {
105
+ leftIcon: "star",
106
106
  };
107
107
 
108
- export const iconRight = DefaultTemplate.bind({});
109
- iconRight.args = {
110
- iconRight: "star",
108
+ export const rightIcon = DefaultTemplate.bind({});
109
+ rightIcon.args = {
110
+ rightIcon: "star",
111
111
  };
112
112
 
113
113
  export const slotDefault = DefaultTemplate.bind({});
@@ -119,10 +119,10 @@ slotDefault.args = {
119
119
  `,
120
120
  };
121
121
 
122
- export const iconLeftSlot = DefaultTemplate.bind({});
123
- iconLeftSlot.args = {
122
+ export const leftIconSlot = DefaultTemplate.bind({});
123
+ leftIconSlot.args = {
124
124
  slotTemplate: `
125
- <template #icon-left>
125
+ <template #left-icon>
126
126
  <UIcon
127
127
  name="star"
128
128
  color="green"
@@ -131,10 +131,10 @@ iconLeftSlot.args = {
131
131
  `,
132
132
  };
133
133
 
134
- export const iconRightSlot = DefaultTemplate.bind({});
135
- iconRightSlot.args = {
134
+ export const rightIconSlot = DefaultTemplate.bind({});
135
+ rightIconSlot.args = {
136
136
  slotTemplate: `
137
- <template #icon-right>
137
+ <template #right-icon>
138
138
  <UIcon
139
139
  name="star"
140
140
  color="green"
@@ -14,7 +14,7 @@
14
14
  </template>
15
15
 
16
16
  <template v-else>
17
- <div v-if="hasSlotContent($slots['icon-left']) || iconLeft">
17
+ <div v-if="hasSlotContent($slots['left-icon']) || leftIcon">
18
18
  <!--
19
19
  @slot Use it to add icon before the text.
20
20
  @binding {string} icon-name
@@ -22,18 +22,18 @@
22
22
  @binding {string} icon-color
23
23
  -->
24
24
  <slot
25
- name="icon-left"
26
- :icon-name="iconLeft"
25
+ name="left-icon"
26
+ :icon-name="leftIcon"
27
27
  :icon-size="iconSize"
28
28
  :icon-color="componentColor"
29
29
  >
30
30
  <UIcon
31
- v-if="iconLeft"
32
- :name="iconLeft"
31
+ v-if="leftIcon"
32
+ :name="leftIcon"
33
33
  :size="iconSize"
34
34
  :color="componentColor"
35
35
  internal
36
- v-bind="iconLeftAttrs"
36
+ v-bind="leftIconAttrs"
37
37
  />
38
38
  </slot>
39
39
  </div>
@@ -53,7 +53,7 @@
53
53
  <!-- @slot Use it to add something after the text. -->
54
54
  <slot name="right" />
55
55
 
56
- <div v-if="hasSlotContent($slots['icon-right']) || iconRight">
56
+ <div v-if="hasSlotContent($slots['right-icon']) || rightIcon">
57
57
  <!--
58
58
  @slot Use it to add icon after the text.
59
59
  @binding {string} icon-name
@@ -61,18 +61,18 @@
61
61
  @binding {string} icon-color
62
62
  -->
63
63
  <slot
64
- name="icon-right"
65
- :icon-name="iconRight"
64
+ name="right-icon"
65
+ :icon-name="rightIcon"
66
66
  :icon-size="iconSize"
67
67
  :icon-color="componentColor"
68
68
  >
69
69
  <UIcon
70
- v-if="iconRight"
71
- :name="iconRight"
70
+ v-if="rightIcon"
71
+ :name="rightIcon"
72
72
  :size="iconSize"
73
73
  :color="componentColor"
74
74
  internal
75
- v-bind="iconRightAttrs"
75
+ v-bind="rightIconAttrs"
76
76
  />
77
77
  </slot>
78
78
  </div>
@@ -125,7 +125,7 @@ const props = defineProps({
125
125
  /**
126
126
  * Left side icon name.
127
127
  */
128
- iconLeft: {
128
+ leftIcon: {
129
129
  type: String,
130
130
  default: "",
131
131
  },
@@ -133,7 +133,7 @@ const props = defineProps({
133
133
  /**
134
134
  * Right side icon name.
135
135
  */
136
- iconRight: {
136
+ rightIcon: {
137
137
  type: String,
138
138
  default: "",
139
139
  },
@@ -236,7 +236,7 @@ const props = defineProps({
236
236
  },
237
237
  });
238
238
 
239
- const { buttonAttrs, loaderAttrs, textAttrs, iconLeftAttrs, iconRightAttrs, hasSlotContent } =
239
+ const { buttonAttrs, loaderAttrs, textAttrs, leftIconAttrs, rightIconAttrs, hasSlotContent } =
240
240
  useAttrs(props);
241
241
 
242
242
  const buttonRef = ref(null);
@@ -14,7 +14,7 @@
14
14
  v-bind="buttonAttrs"
15
15
  @click="onClickButton"
16
16
  >
17
- <template #icon-right>
17
+ <template #right-icon>
18
18
  <UIcon
19
19
  v-if="!noIcon"
20
20
  internal
@@ -11,7 +11,7 @@
11
11
  no-ring
12
12
  size="sm"
13
13
  variant="thirdary"
14
- :icon-right="config.dayViewSwitchLabelIconName"
14
+ :right-icon="config.dayViewSwitchLabelIconName"
15
15
  v-bind="navigationSwitchViewButtonAttrs"
16
16
  @mousedown.prevent.capture
17
17
  @click="onClickViewSwitch"
@@ -31,7 +31,7 @@
31
31
  no-ring
32
32
  size="sm"
33
33
  variant="thirdary"
34
- :icon-left="config.prevIconName"
34
+ :left-icon="config.prevIconName"
35
35
  v-bind="nextPrevButtonAttrs"
36
36
  @mousedown.prevent.capture
37
37
  @click="onClickPrevButton"
@@ -44,7 +44,7 @@
44
44
  no-ring
45
45
  size="sm"
46
46
  variant="thirdary"
47
- :icon-left="config.nextIconName"
47
+ :left-icon="config.nextIconName"
48
48
  v-bind="nextPrevButtonAttrs"
49
49
  @mousedown.prevent.capture
50
50
  @click="onClickNextButton"
@@ -19,8 +19,8 @@
19
19
  <slot name="left" />
20
20
  </template>
21
21
 
22
- <template #icon-right>
23
- <slot name="icon-right" />
22
+ <template #right-icon>
23
+ <slot name="right-icon" />
24
24
  </template>
25
25
 
26
26
  <template #right>
@@ -37,7 +37,7 @@
37
37
  :size="size"
38
38
  :disabled="disabled"
39
39
  variant="thirdary"
40
- :icon-left="config.prevIconName"
40
+ :left-icon="config.prevIconName"
41
41
  v-bind="shiftRangeButtonAttrs"
42
42
  @click="onClickShiftRange('prev')"
43
43
  />
@@ -64,7 +64,7 @@
64
64
  :size="size"
65
65
  :disabled="disabled"
66
66
  variant="thirdary"
67
- :icon-left="config.nextIconName"
67
+ :left-icon="config.nextIconName"
68
68
  v-bind="shiftRangeButtonAttrs"
69
69
  @click="onClickShiftRange('next')"
70
70
  />
@@ -116,7 +116,7 @@
116
116
  size="xs"
117
117
  variant="thirdary"
118
118
  :label="locale.ownRange"
119
- :icon-left="config.periodButtonIconName"
119
+ :left-icon="config.periodButtonIconName"
120
120
  v-bind="periodButtonAttrs(getPeriodButtonsClasses(PERIOD.ownRange))"
121
121
  @click="onClickOwnRange"
122
122
  />
@@ -130,7 +130,7 @@
130
130
  size="xs"
131
131
  color="gray"
132
132
  variant="thirdary"
133
- :icon-left="config.prevIconName"
133
+ :left-icon="config.prevIconName"
134
134
  v-bind="rangeSwitchButtonAttrs"
135
135
  @click="onClickShiftDatesList('prev')"
136
136
  />
@@ -145,7 +145,7 @@
145
145
  size="xs"
146
146
  color="gray"
147
147
  variant="thirdary"
148
- :icon-left="config.nextIconName"
148
+ :left-icon="config.nextIconName"
149
149
  v-bind="rangeSwitchButtonAttrs"
150
150
  @click="onClickShiftDatesList('next')"
151
151
  />
@@ -3,8 +3,8 @@ export default /*tw*/ {
3
3
  inputWrapper: "flex relative w-full",
4
4
  rightIconSlot: "flex items-center justify-end whitespace-nowrap pr-2 gap-1 rounded-dynamic rounded-l-none",
5
5
  leftIconSlot: "flex items-center justify-end whitespace-nowrap pl-2 gap-1 rounded-dynamic rounded-r-none",
6
- iconLeft: "{UIcon}",
7
- iconRight: "{UIcon}",
6
+ leftIcon: "{UIcon}",
7
+ rightIcon: "{UIcon}",
8
8
  passwordIcon: "",
9
9
  passwordVisibleIconName: "visibility-fill",
10
10
  passwordHiddenIconName: "visibility_off-fill",
@@ -89,20 +89,20 @@ sizes.args = { enum: "size" };
89
89
  export const validationRules = EnumVariantTemplate.bind({});
90
90
  validationRules.args = { enum: "validationRule" };
91
91
 
92
- export const iconLeft = DefaultTemplate.bind({});
93
- iconLeft.args = {
94
- iconLeft: "star",
92
+ export const leftIcon = DefaultTemplate.bind({});
93
+ leftIcon.args = {
94
+ leftIcon: "star",
95
95
  };
96
96
 
97
- export const iconRight = DefaultTemplate.bind({});
98
- iconRight.args = {
99
- iconRight: "star",
97
+ export const rightIcon = DefaultTemplate.bind({});
98
+ rightIcon.args = {
99
+ rightIcon: "star",
100
100
  };
101
101
 
102
- export const iconLeftSlot = DefaultTemplate.bind({});
103
- iconLeftSlot.args = {
102
+ export const leftIconSlot = DefaultTemplate.bind({});
103
+ leftIconSlot.args = {
104
104
  slotTemplate: `
105
- <template #icon-left>
105
+ <template #left-icon>
106
106
  <UIcon
107
107
  name="star"
108
108
  color="green"
@@ -111,10 +111,10 @@ iconLeftSlot.args = {
111
111
  `,
112
112
  };
113
113
 
114
- export const iconRightSlot = DefaultTemplate.bind({});
115
- iconRightSlot.args = {
114
+ export const rightIconSlot = DefaultTemplate.bind({});
115
+ rightIconSlot.args = {
116
116
  slotTemplate: `
117
- <template #icon-right>
117
+ <template #right-icon>
118
118
  <UIcon
119
119
  name="star"
120
120
  color="green"
@@ -18,7 +18,7 @@
18
18
  </span>
19
19
 
20
20
  <span
21
- v-if="hasSlotContent($slots['icon-left']) || iconLeft"
21
+ v-if="hasSlotContent($slots['left-icon']) || leftIcon"
22
22
  ref="leftSlotWrapperRef"
23
23
  v-bind="leftIconSlotAttrs"
24
24
  >
@@ -27,8 +27,14 @@
27
27
  @binding {string} icon-name
28
28
  @binding {string} icon-size
29
29
  -->
30
- <slot name="icon-left" :icon-name="iconLeft" :icon-size="iconSize">
31
- <UIcon v-if="iconLeft" :name="iconLeft" :size="iconSize" internal />
30
+ <slot name="left-icon" :icon-name="leftIcon" :icon-size="iconSize">
31
+ <UIcon
32
+ v-if="leftIcon"
33
+ :name="leftIcon"
34
+ :size="iconSize"
35
+ internal
36
+ v-bind="leftIconAttrs"
37
+ />
32
38
  </slot>
33
39
  </span>
34
40
 
@@ -67,14 +73,20 @@
67
73
  />
68
74
  </label>
69
75
 
70
- <span v-if="hasSlotContent($slots['icon-right']) || iconRight" v-bind="rightIconSlotAttrs">
76
+ <span v-if="hasSlotContent($slots['right-icon']) || rightIcon" v-bind="rightIconSlotAttrs">
71
77
  <!--
72
78
  @slot Use it to add icon after the text.
73
79
  @binding {string} icon-name
74
80
  @binding {string} icon-size
75
81
  -->
76
- <slot name="icon-right" :icon-name="iconLeft" :icon-size="iconSize">
77
- <UIcon v-if="iconRight" :name="iconRight" :size="iconSize" internal />
82
+ <slot name="right-icon" :icon-name="rightIcon" :icon-size="iconSize">
83
+ <UIcon
84
+ v-if="rightIcon"
85
+ :name="rightIcon"
86
+ :size="iconSize"
87
+ internal
88
+ v-bind="rightIconAttrs"
89
+ />
78
90
  </slot>
79
91
  </span>
80
92
 
@@ -211,7 +223,7 @@ const props = defineProps({
211
223
  /**
212
224
  * Left side icon name.
213
225
  */
214
- iconLeft: {
226
+ leftIcon: {
215
227
  type: String,
216
228
  default: "",
217
229
  },
@@ -219,7 +231,7 @@ const props = defineProps({
219
231
  /**
220
232
  * Right side icon name.
221
233
  */
222
- iconRight: {
234
+ rightIcon: {
223
235
  type: String,
224
236
  default: "",
225
237
  },
@@ -340,7 +352,9 @@ const {
340
352
  labelAttrs,
341
353
  passwordIconAttrs,
342
354
  leftIconSlotAttrs,
355
+ leftIconAttrs,
343
356
  inputWrapperAttrs,
357
+ rightIconAttrs,
344
358
  rightIconSlotAttrs,
345
359
  hasSlotContent,
346
360
  } = useAttrs(props, { isTypePassword, inputPasswordClasses });
@@ -433,7 +447,7 @@ function transformValue(value, exp) {
433
447
 
434
448
  function setLabelPosition() {
435
449
  const shouldAlignLabelOnTop =
436
- !hasSlotContent(slots["icon-left"]) && !hasSlotContent(slots["left"]) && !props.iconLeft;
450
+ !hasSlotContent(slots["left-icon"]) && !hasSlotContent(slots["left"]) && !props.leftIcon;
437
451
 
438
452
  if (props.labelAlign === "top" || shouldAlignLabelOnTop) {
439
453
  return;
@@ -47,7 +47,7 @@
47
47
  tag="label"
48
48
  variant="thirdary"
49
49
  :size="buttonSize"
50
- :icon-right="config.chooseFileIconName"
50
+ :right-icon="config.chooseFileIconName"
51
51
  :label="currentLocale.uploadFile"
52
52
  :disabled="disabled"
53
53
  v-bind="chooseFileButtonAttrs"
@@ -74,7 +74,7 @@
74
74
  variant="thirdary"
75
75
  :size="buttonSize"
76
76
  :disabled="disabled"
77
- :icon-left="config.clearIconName"
77
+ :left-icon="config.clearIconName"
78
78
  v-bind="clearButtonAttrs"
79
79
  :data-cy="`${dataCy}-clear`"
80
80
  @click="onClickResetFiles"
@@ -21,12 +21,12 @@
21
21
  <slot name="left" />
22
22
  </template>
23
23
 
24
- <template #icon-left>
24
+ <template #left-icon>
25
25
  <!-- @slot Use it to add icon before the text. -->
26
- <slot name="icon-left" />
26
+ <slot name="left-icon" />
27
27
  </template>
28
28
 
29
- <template #icon-right>
29
+ <template #right-icon>
30
30
  <UIcon
31
31
  v-if="modelValue"
32
32
  internal
@@ -41,7 +41,7 @@
41
41
 
42
42
  <!-- @slot Use it to add icon after the text. -->
43
43
  <slot
44
- name="icon-right"
44
+ name="right-icon"
45
45
  :icon-name="config.searchIconName"
46
46
  :icon-size="iconSize"
47
47
  :search-button-label="searchButtonLabel"
@@ -66,8 +66,8 @@ export default /*tw*/ {
66
66
  },
67
67
  leftIconWrapper: "pr-3 flex items-center",
68
68
  rightIconWrapper: "pl-3 flex items-center",
69
- iconLeft: "{UIcon}",
70
- iconRight: "{UIcon}",
69
+ leftIcon: "{UIcon}",
70
+ rightIcon: "{UIcon}",
71
71
  beforeCaret: "",
72
72
  afterCaret: "mr-3",
73
73
  caret: {
@@ -234,29 +234,29 @@ slotBeforeOption.args = {
234
234
  `,
235
235
  };
236
236
 
237
- export const iconLeft = DefaultTemplate.bind({});
238
- iconLeft.args = {
239
- iconLeft: "star",
237
+ export const leftIcon = DefaultTemplate.bind({});
238
+ leftIcon.args = {
239
+ leftIcon: "star",
240
240
  };
241
241
 
242
- export const iconRight = DefaultTemplate.bind({});
243
- iconRight.args = {
244
- iconRight: "star",
242
+ export const rightIcon = DefaultTemplate.bind({});
243
+ rightIcon.args = {
244
+ rightIcon: "star",
245
245
  };
246
246
 
247
- export const iconLeftSlot = DefaultTemplate.bind({});
248
- iconLeftSlot.args = {
247
+ export const leftIconSlot = DefaultTemplate.bind({});
248
+ leftIconSlot.args = {
249
249
  slotTemplate: `
250
- <template #icon-left>
250
+ <template #left-icon>
251
251
  <UIcon name="star" color="green" />
252
252
  </template>
253
253
  `,
254
254
  };
255
255
 
256
- export const iconRightSlot = DefaultTemplate.bind({});
257
- iconRightSlot.args = {
256
+ export const rightIconSlot = DefaultTemplate.bind({});
257
+ rightIconSlot.args = {
258
258
  slotTemplate: `
259
- <template #icon-right>
259
+ <template #right-icon>
260
260
  <UIcon name="star" color="green" />
261
261
  </template>
262
262
  `,
@@ -76,7 +76,7 @@
76
76
 
77
77
  <div ref="innerWrapperRef" v-bind="innerWrapperAttrs">
78
78
  <span
79
- v-if="hasSlotContent($slots['icon-left']) || iconLeft"
79
+ v-if="hasSlotContent($slots['left-icon']) || leftIcon"
80
80
  ref="leftSlotWrapperRef"
81
81
  v-bind="leftIconWrapperAttrs"
82
82
  >
@@ -85,13 +85,13 @@
85
85
  @binding {string} icon-name
86
86
  @binding {string} icon-size
87
87
  -->
88
- <slot name="icon-left" :icon-name="iconLeft" :icon-size="iconSize">
88
+ <slot name="left-icon" :icon-name="leftIcon" :icon-size="iconSize">
89
89
  <UIcon
90
- v-if="iconLeft"
91
- :name="iconLeft"
90
+ v-if="leftIcon"
91
+ :name="leftIcon"
92
92
  :size="iconSize"
93
93
  internal
94
- v-bind="iconLeftAttrs"
94
+ v-bind="leftIconAttrs"
95
95
  />
96
96
  </slot>
97
97
  </span>
@@ -197,7 +197,7 @@
197
197
  <slot name="right" />
198
198
 
199
199
  <span
200
- v-if="hasSlotContent($slots['icon-right']) || iconRight"
200
+ v-if="hasSlotContent($slots['right-icon']) || rightIcon"
201
201
  v-bind="rightIconWrapperAttrs"
202
202
  >
203
203
  <!--
@@ -205,13 +205,13 @@
205
205
  @binding {string} icon-name
206
206
  @binding {string} icon-size
207
207
  -->
208
- <slot name="icon-right" :icon-name="iconRight" :icon-size="iconSize">
208
+ <slot name="right-icon" :icon-name="rightIcon" :icon-size="iconSize">
209
209
  <UIcon
210
- v-if="iconRight"
211
- :name="iconRight"
210
+ v-if="rightIcon"
211
+ :name="rightIcon"
212
212
  :size="iconSize"
213
213
  internal
214
- v-bind="iconRightAttrs"
214
+ v-bind="rightIconAttrs"
215
215
  />
216
216
  </slot>
217
217
  </span>
@@ -363,7 +363,7 @@ const props = defineProps({
363
363
  /**
364
364
  * Left side icon name.
365
365
  */
366
- iconLeft: {
366
+ leftIcon: {
367
367
  type: String,
368
368
  default: "",
369
369
  },
@@ -371,7 +371,7 @@ const props = defineProps({
371
371
  /**
372
372
  * Right side icon name.
373
373
  */
374
- iconRight: {
374
+ rightIcon: {
375
375
  type: String,
376
376
  default: "",
377
377
  },
@@ -583,8 +583,8 @@ const {
583
583
  innerWrapperAttrs,
584
584
  leftIconWrapperAttrs,
585
585
  rightIconWrapperAttrs,
586
- iconLeftAttrs,
587
- iconRightAttrs,
586
+ leftIconAttrs,
587
+ rightIconAttrs,
588
588
  beforeCaretAttrs,
589
589
  afterCaretAttrs,
590
590
  toggleAttrs,
@@ -824,7 +824,7 @@ function setLabelPosition() {
824
824
  if (
825
825
  props.labelAlign === "top" ||
826
826
  !hasSlotContent(slots["left"]) ||
827
- (!hasSlotContent(slots["icon-left"]) && !props.iconLeft)
827
+ (!hasSlotContent(slots["left-icon"]) && !props.leftIcon)
828
828
  ) {
829
829
  return;
830
830
  }
@@ -37,6 +37,8 @@ export default /*tw*/ {
37
37
  },
38
38
  },
39
39
  },
40
+ leftIcon: "{UIcon}",
41
+ rightIcon: "{UIcon}",
40
42
  defaultVariants: {
41
43
  color: "brand",
42
44
  size: "md",
@@ -96,28 +96,54 @@ Weight.args = { enum: "weight" };
96
96
  export const Colors = ColorsTemplate.bind({});
97
97
  Colors.args = {};
98
98
 
99
- export const slotRight = DefaultTemplate.bind({});
100
- slotRight.args = {
99
+ export const leftIcon = DefaultTemplate.bind({});
100
+ leftIcon.args = {
101
+ leftIcon: "star",
102
+ };
103
+
104
+ export const rightIcon = DefaultTemplate.bind({});
105
+ rightIcon.args = {
106
+ rightIcon: "star",
107
+ };
108
+
109
+ export const leftIconSlot = DefaultTemplate.bind({});
110
+ leftIconSlot.args = {
101
111
  slotTemplate: `
102
- <template #right>
112
+ <template #left-icon>
103
113
  <UIcon
104
- tooltip="tooltip text"
105
114
  name="info"
106
- size="xs"
115
+ color="red"
107
116
  />
108
117
  </template>
109
118
  `,
110
119
  };
111
120
 
112
- export const slotLeft = DefaultTemplate.bind({});
113
- slotLeft.args = {
121
+ export const rightIconSlot = DefaultTemplate.bind({});
122
+ rightIconSlot.args = {
114
123
  slotTemplate: `
115
- <template #left>
124
+ <template #right-icon>
116
125
  <UIcon
117
- tooltip="tooltip text"
118
126
  name="info"
119
- size="xs"
127
+ color="red"
120
128
  />
121
129
  </template>
122
130
  `,
123
131
  };
132
+
133
+ export const slotLeft = DefaultTemplate.bind({});
134
+ slotLeft.args = {
135
+ slotTemplate: `
136
+ <template #left>
137
+ 🤘
138
+ </template>
139
+ `,
140
+ };
141
+
142
+ export const slotRight = DefaultTemplate.bind({});
143
+ slotRight.args = {
144
+ slotTemplate: `
145
+ <template #right>
146
+ 🤘
147
+ </template>
148
+ `,
149
+ };
@@ -13,6 +13,25 @@
13
13
  <!-- @slot Use it to add something before text. -->
14
14
  <slot name="left" />
15
15
 
16
+ <div v-if="hasSlotContent($slots['left-icon']) || leftIcon">
17
+ <!--
18
+ @slot Use it to add icon before the text.
19
+ @binding {string} icon-name
20
+ @binding {string} icon-size
21
+ @binding {string} icon-color
22
+ -->
23
+ <slot name="left-icon" :icon-name="leftIcon" :icon-size="iconSize" :icon-color="color">
24
+ <UIcon
25
+ v-if="leftIcon"
26
+ :name="leftIcon"
27
+ :size="iconSize"
28
+ :color="color"
29
+ internal
30
+ v-bind="leftIconAttrs"
31
+ />
32
+ </slot>
33
+ </div>
34
+
16
35
  <!-- @slot Use it to add something instead of text. -->
17
36
  <slot>
18
37
  <div v-if="!hasSlotContent($slots['default'])">
@@ -20,6 +39,25 @@
20
39
  </div>
21
40
  </slot>
22
41
 
42
+ <div v-if="hasSlotContent($slots['right-icon']) || rightIcon">
43
+ <!--
44
+ @slot Use it to add icon after the text.
45
+ @binding {string} icon-name
46
+ @binding {string} icon-size
47
+ @binding {string} icon-color
48
+ -->
49
+ <slot name="right-icon" :icon-name="rightIcon" :icon-size="iconSize" :icon-color="color">
50
+ <UIcon
51
+ v-if="rightIcon"
52
+ :name="rightIcon"
53
+ :size="iconSize"
54
+ :color="color"
55
+ internal
56
+ v-bind="rightIconAttrs"
57
+ />
58
+ </slot>
59
+ </div>
60
+
23
61
  <!-- @slot Use it to add something after text. -->
24
62
  <slot name="right" />
25
63
  </div>
@@ -27,9 +65,10 @@
27
65
  </template>
28
66
 
29
67
  <script setup>
30
- import { ref } from "vue";
68
+ import { ref, computed } from "vue";
31
69
 
32
70
  import { getDefault } from "../service.ui";
71
+ import UIcon from "../ui.image-icon";
33
72
 
34
73
  import { UBadge } from "./constants";
35
74
  import useAttrs from "./composables/attrs.composable";
@@ -66,6 +105,22 @@ const props = defineProps({
66
105
  default: getDefault(defaultConfig, UBadge).size,
67
106
  },
68
107
 
108
+ /**
109
+ * Left side icon name.
110
+ */
111
+ leftIcon: {
112
+ type: String,
113
+ default: "",
114
+ },
115
+
116
+ /**
117
+ * Right side icon name.
118
+ */
119
+ rightIcon: {
120
+ type: String,
121
+ default: "",
122
+ },
123
+
69
124
  /**
70
125
  * Badge font weight.
71
126
  * @values regular, medium, bold
@@ -123,12 +178,22 @@ const emit = defineEmits([
123
178
  "click",
124
179
  ]);
125
180
 
126
- const { bodyAttrs, wrapperAttrs, hasSlotContent } = useAttrs(props);
181
+ const { bodyAttrs, wrapperAttrs, leftIconAttrs, rightIconAttrs, hasSlotContent } = useAttrs(props);
127
182
 
128
183
  const wrapperRef = ref(null);
129
184
 
130
185
  defineExpose({ wrapperRef });
131
186
 
187
+ const iconSize = computed(() => {
188
+ const sizes = {
189
+ sm: "xs",
190
+ md: "sm",
191
+ lg: "md",
192
+ };
193
+
194
+ return sizes[props.size];
195
+ });
196
+
132
197
  function onFocus() {
133
198
  emit("focus");
134
199
  }
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.282",
4
+ "version": "0.0.284",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -686,6 +686,24 @@
686
686
  },
687
687
  "default": "md"
688
688
  },
689
+ {
690
+ "name": "leftIcon",
691
+ "description": "Left side icon name.",
692
+ "value": {
693
+ "kind": "expression",
694
+ "type": "string"
695
+ },
696
+ "default": "\"\""
697
+ },
698
+ {
699
+ "name": "rightIcon",
700
+ "description": "Right side icon name.",
701
+ "value": {
702
+ "kind": "expression",
703
+ "type": "string"
704
+ },
705
+ "default": "\"\""
706
+ },
689
707
  {
690
708
  "name": "weight",
691
709
  "description": "Badge font weight.",
@@ -746,10 +764,48 @@
746
764
  "name": "left",
747
765
  "description": "Use it to add something before text."
748
766
  },
767
+ {
768
+ "name": "left-icon",
769
+ "scoped": true,
770
+ "description": "Use it to add icon before the text.",
771
+ "bindings": [
772
+ {
773
+ "type": "string",
774
+ "name": "icon-name"
775
+ },
776
+ {
777
+ "type": "string",
778
+ "name": "icon-size"
779
+ },
780
+ {
781
+ "type": "string",
782
+ "name": "icon-color"
783
+ }
784
+ ]
785
+ },
749
786
  {
750
787
  "name": "default",
751
788
  "description": "Use it to add something instead of text."
752
789
  },
790
+ {
791
+ "name": "right-icon",
792
+ "scoped": true,
793
+ "description": "Use it to add icon after the text.",
794
+ "bindings": [
795
+ {
796
+ "type": "string",
797
+ "name": "icon-name"
798
+ },
799
+ {
800
+ "type": "string",
801
+ "name": "icon-size"
802
+ },
803
+ {
804
+ "type": "string",
805
+ "name": "icon-color"
806
+ }
807
+ ]
808
+ },
753
809
  {
754
810
  "name": "right",
755
811
  "description": "Use it to add something after text."
@@ -792,7 +848,7 @@
792
848
  "default": "md"
793
849
  },
794
850
  {
795
- "name": "iconLeft",
851
+ "name": "leftIcon",
796
852
  "description": "Left side icon name.",
797
853
  "value": {
798
854
  "kind": "expression",
@@ -801,7 +857,7 @@
801
857
  "default": "\"\""
802
858
  },
803
859
  {
804
- "name": "iconRight",
860
+ "name": "rightIcon",
805
861
  "description": "Right side icon name.",
806
862
  "value": {
807
863
  "kind": "expression",
@@ -920,7 +976,7 @@
920
976
  ],
921
977
  "slots": [
922
978
  {
923
- "name": "icon-left",
979
+ "name": "left-icon",
924
980
  "scoped": true,
925
981
  "description": "Use it to add icon before the text.",
926
982
  "bindings": [
@@ -951,7 +1007,7 @@
951
1007
  "description": "Use it to add something after the text."
952
1008
  },
953
1009
  {
954
- "name": "icon-right",
1010
+ "name": "right-icon",
955
1011
  "scoped": true,
956
1012
  "description": "Use it to add icon after the text.",
957
1013
  "bindings": [
@@ -2438,7 +2494,7 @@
2438
2494
  "name": "left"
2439
2495
  },
2440
2496
  {
2441
- "name": "icon-right"
2497
+ "name": "right-icon"
2442
2498
  },
2443
2499
  {
2444
2500
  "name": "right"
@@ -4023,7 +4079,7 @@
4023
4079
  "default": "md"
4024
4080
  },
4025
4081
  {
4026
- "name": "iconLeft",
4082
+ "name": "leftIcon",
4027
4083
  "description": "Left side icon name.",
4028
4084
  "value": {
4029
4085
  "kind": "expression",
@@ -4032,7 +4088,7 @@
4032
4088
  "default": "\"\""
4033
4089
  },
4034
4090
  {
4035
- "name": "iconRight",
4091
+ "name": "rightIcon",
4036
4092
  "description": "Right side icon name.",
4037
4093
  "value": {
4038
4094
  "kind": "expression",
@@ -4189,7 +4245,7 @@
4189
4245
  "description": "Use it to add something before the text."
4190
4246
  },
4191
4247
  {
4192
- "name": "icon-left",
4248
+ "name": "left-icon",
4193
4249
  "scoped": true,
4194
4250
  "description": "Use it to add icon before the text.",
4195
4251
  "bindings": [
@@ -4204,7 +4260,7 @@
4204
4260
  ]
4205
4261
  },
4206
4262
  {
4207
- "name": "icon-right",
4263
+ "name": "right-icon",
4208
4264
  "scoped": true,
4209
4265
  "description": "Use it to add icon after the text.",
4210
4266
  "bindings": [
@@ -5029,11 +5085,11 @@
5029
5085
  "description": "Use it to add something before the text."
5030
5086
  },
5031
5087
  {
5032
- "name": "icon-left",
5088
+ "name": "left-icon",
5033
5089
  "description": "Use it to add icon before the text."
5034
5090
  },
5035
5091
  {
5036
- "name": "icon-right",
5092
+ "name": "right-icon",
5037
5093
  "scoped": true,
5038
5094
  "description": "Use it to add icon after the text.",
5039
5095
  "bindings": [
@@ -6931,7 +6987,7 @@
6931
6987
  "default": "md"
6932
6988
  },
6933
6989
  {
6934
- "name": "iconLeft",
6990
+ "name": "leftIcon",
6935
6991
  "description": "Left side icon name.",
6936
6992
  "value": {
6937
6993
  "kind": "expression",
@@ -6940,7 +6996,7 @@
6940
6996
  "default": "\"\""
6941
6997
  },
6942
6998
  {
6943
- "name": "iconRight",
6999
+ "name": "rightIcon",
6944
7000
  "description": "Right side icon name.",
6945
7001
  "value": {
6946
7002
  "kind": "expression",
@@ -7176,7 +7232,7 @@
7176
7232
  ]
7177
7233
  },
7178
7234
  {
7179
- "name": "icon-left",
7235
+ "name": "left-icon",
7180
7236
  "scoped": true,
7181
7237
  "description": "Use it to add icon before option.",
7182
7238
  "bindings": [
@@ -7225,7 +7281,7 @@
7225
7281
  "description": "Use it to add something after input."
7226
7282
  },
7227
7283
  {
7228
- "name": "icon-right",
7284
+ "name": "right-icon",
7229
7285
  "scoped": true,
7230
7286
  "description": "Use it to add icon after option.",
7231
7287
  "bindings": [