vueless 0.0.594 → 0.0.596

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.594",
3
+ "version": "0.0.596",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -2,7 +2,6 @@
2
2
  import { computed, ref, watchEffect, useId, watch, useSlots } from "vue";
3
3
 
4
4
  import useUI from "../composables/useUI.ts";
5
- import { useDarkMode } from "../composables/useDarkMode.ts";
6
5
  import { hasSlotContent } from "../utils/helper.ts";
7
6
  import { getDefaults } from "../utils/ui.ts";
8
7
 
@@ -10,20 +9,19 @@ import ULoader from "../ui.loader/ULoader.vue";
10
9
  import UIcon from "../ui.image-icon/UIcon.vue";
11
10
 
12
11
  import defaultConfig from "./config.ts";
13
- import { UButton } from "./constants.ts";
12
+ import { COMPONENT_NAME } from "./constants.ts";
14
13
 
15
14
  import type { Props, LoaderSize, IconSize, Config } from "./types.ts";
16
15
 
17
16
  defineOptions({ inheritAttrs: false });
18
17
 
19
18
  const props = withDefaults(defineProps<Props>(), {
20
- ...getDefaults<Props, Config>(defaultConfig, UButton),
19
+ ...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
21
20
  label: "",
22
21
  });
23
22
 
24
23
  const slots = useSlots();
25
24
  const elementId = props.id || useId();
26
- const { isDarkMode } = useDarkMode();
27
25
 
28
26
  const buttonRef = ref<HTMLElement | null>(null);
29
27
  const buttonStyle = ref({});
@@ -55,12 +53,6 @@ const iconSize = computed(() => {
55
53
  return sizes[props.size] as IconSize;
56
54
  });
57
55
 
58
- const iconColor = computed(() => {
59
- const primaryColor = isDarkMode.value ? "black" : "white";
60
-
61
- return props.variant === "primary" ? primaryColor : props.color;
62
- });
63
-
64
56
  watch(
65
57
  () => props.loading,
66
58
  (newValue, oldValue) => {
@@ -119,7 +111,7 @@ const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs
119
111
  :data-test="dataTest"
120
112
  >
121
113
  <template v-if="loading">
122
- <ULoader :loading="loading" :size="loaderSize" :color="iconColor" v-bind="loaderAttrs" />
114
+ <ULoader :loading="loading" :size="loaderSize" color="inherit" v-bind="loaderAttrs" />
123
115
  </template>
124
116
 
125
117
  <template v-else>
@@ -127,15 +119,14 @@ const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs
127
119
  @slot Use it to add something before the label.
128
120
  @binding {string} icon-name
129
121
  @binding {string} icon-size
130
- @binding {string} icon-color
131
122
  -->
132
- <slot name="left" :icon-name="leftIcon" :icon-size="iconSize" :icon-color="iconColor">
123
+ <slot name="left" :icon-name="leftIcon" :icon-size="iconSize">
133
124
  <UIcon
134
125
  v-if="leftIcon"
135
126
  internal
127
+ color="inherit"
136
128
  :name="leftIcon"
137
129
  :size="iconSize"
138
- :color="iconColor"
139
130
  v-bind="leftIconAttrs"
140
131
  />
141
132
  </slot>
@@ -145,21 +136,14 @@ const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs
145
136
  @binding {string} label
146
137
  @binding {string} icon-name
147
138
  @binding {string} icon-size
148
- @binding {string} icon-color
149
139
  -->
150
- <slot
151
- name="default"
152
- :label="label"
153
- :icon-name="icon"
154
- :icon-size="iconSize"
155
- :icon-color="iconColor"
156
- >
140
+ <slot name="default" :label="label" :icon-name="icon" :icon-size="iconSize">
157
141
  <UIcon
158
142
  v-if="icon"
159
143
  internal
144
+ color="inherit"
160
145
  :name="icon"
161
146
  :size="iconSize"
162
- :color="iconColor"
163
147
  v-bind="centerIconAttrs"
164
148
  />
165
149
  <template v-else>
@@ -171,15 +155,14 @@ const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs
171
155
  @slot Use it to add something after the label.
172
156
  @binding {string} icon-name
173
157
  @binding {string} icon-size
174
- @binding {string} icon-color
175
158
  -->
176
- <slot name="right" :icon-name="rightIcon" :icon-size="iconSize" :icon-color="iconColor">
159
+ <slot name="right" :icon-name="rightIcon" :icon-size="iconSize">
177
160
  <UIcon
178
161
  v-if="rightIcon"
179
162
  internal
163
+ color="inherit"
180
164
  :name="rightIcon"
181
165
  :size="iconSize"
182
- :color="iconColor"
183
166
  v-bind="rightIconAttrs"
184
167
  />
185
168
  </slot>
@@ -2,4 +2,4 @@
2
2
  This const is needed to prevent the issue in script setup:
3
3
  `defineProps` is referencing locally declared variables. (vue/valid-define-props)
4
4
  */
5
- export const UButton = "UButton";
5
+ export const COMPONENT_NAME = "UButton";
@@ -11,7 +11,7 @@ import UDropdownList from "../ui.dropdown-list/UDropdownList.vue";
11
11
  import { vClickOutside } from "../directives";
12
12
 
13
13
  import defaultConfig from "./config.ts";
14
- import { UDropdownButton, BUTTON_VARIANT } from "./constants.ts";
14
+ import { UDropdownButton } from "./constants.ts";
15
15
 
16
16
  import type { Props, IconSize, DropdownSize, Config } from "./types.ts";
17
17
  import type { Option } from "../ui.dropdown-list/types.ts";
@@ -41,10 +41,6 @@ const dropdownListRef = useTemplateRef<UDropdownListRef>("dropdown-list");
41
41
 
42
42
  const elementId = props.id || useId();
43
43
 
44
- const iconColor = computed(() => {
45
- return props.variant === BUTTON_VARIANT.primary ? "white" : props.color;
46
- });
47
-
48
44
  const iconSize = computed(() => {
49
45
  const sizes = {
50
46
  "2xs": "xs",
@@ -146,8 +142,8 @@ const { config, dropdownButtonAttrs, dropdownListAttrs, dropdownIconAttrs, wrapp
146
142
  <UIcon
147
143
  v-if="!noIcon"
148
144
  internal
145
+ color="inherit"
149
146
  :size="iconSize"
150
- :color="iconColor"
151
147
  :name="config.defaults.dropdownIcon"
152
148
  v-bind="dropdownIconAttrs"
153
149
  :data-test="`${dataTest}-dropdown`"
@@ -3,7 +3,3 @@
3
3
  `defineProps` is referencing locally declared variables. (vue/valid-define-props)
4
4
  */
5
5
  export const UDropdownButton = "UDropdownButton";
6
-
7
- export const BUTTON_VARIANT = {
8
- primary: "primary",
9
- };
@@ -288,7 +288,7 @@ watchEffect(() => {
288
288
  :disabled="disabled"
289
289
  :size="size"
290
290
  :left-icon="leftIcon"
291
- :right-icon="rightIcon"
291
+ :right-icon="rightIcon || config.defaults.calendarIcon"
292
292
  v-bind="isShownCalendar ? datepickerInputActiveAttrs : datepickerInputAttrs"
293
293
  @input="onTextInput"
294
294
  @focus="activate"
@@ -306,7 +306,7 @@ watchEffect(() => {
306
306
  <!--
307
307
  @slot Use it add an icon before the date.
308
308
  @binding {string} icon-name
309
- @binding {string} icon-nize
309
+ @binding {string} icon-size
310
310
  -->
311
311
  <slot name="left-icon" :icon-name="iconName" :icon-size="iconSize" />
312
312
  </template>
@@ -130,6 +130,6 @@ export default /*tw*/ {
130
130
  timepicker: false,
131
131
  disabled: false,
132
132
  /* icons */
133
- rightIcon: "calendar_month-fill",
133
+ calendarIcon: "calendar_month-fill",
134
134
  },
135
135
  };
@@ -92,8 +92,8 @@ type UButtonRef = InstanceType<typeof UButton>;
92
92
  type UInputRef = InstanceType<typeof UInput>;
93
93
 
94
94
  const isShownMenu = ref(false);
95
- const wrapperRef = useTemplateRef("wrapper");
96
- const menuRef = useTemplateRef("menu");
95
+ const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
96
+ const menuRef = useTemplateRef<HTMLDivElement>("menu");
97
97
  const buttonRef = useTemplateRef<UButtonRef>("button");
98
98
  const buttonPrevRef = useTemplateRef<UButtonRef>("button-prev");
99
99
  const buttonNextRef = useTemplateRef<UButtonRef>("button-next");
@@ -594,7 +594,7 @@ watchEffect(() => {
594
594
  :error="error"
595
595
  readonly
596
596
  :left-icon="leftIcon"
597
- :right-icon="rightIcon"
597
+ :right-icon="rightIcon || config.defaults.calendarIcon"
598
598
  v-bind="isShownMenu ? datepickerActiveInputAttrs : datepickerInputAttrs"
599
599
  @focus="activate"
600
600
  >
@@ -217,7 +217,7 @@ export default /*tw*/ {
217
217
  maxDate: undefined,
218
218
  minDate: undefined,
219
219
  /* icons */
220
- rightIcon: "calendar_month-fill",
220
+ calendarIcon: "calendar_month-fill",
221
221
  nextIcon: "keyboard_arrow_right",
222
222
  prevIcon: "keyboard_arrow_left",
223
223
  ownRangeIcon: "apps",
@@ -11,6 +11,7 @@ export default /*tw*/ {
11
11
  white: "text-white",
12
12
  black: "text-gray-900",
13
13
  grayscale: "text-gray-900 dark:text-white",
14
+ inherit: "text-inherit",
14
15
  },
15
16
  interactive: {
16
17
  true: "cursor-pointer",
@@ -50,6 +50,7 @@ export interface Props {
50
50
  | "gray"
51
51
  | "black"
52
52
  | "white"
53
+ | "inherit"
53
54
  | "brand";
54
55
 
55
56
  /**
@@ -22,6 +22,7 @@ export default /*tw*/ {
22
22
  white: "bg-white",
23
23
  black: "bg-gray-900",
24
24
  grayscale: "bg-gray-900 dark:bg-white",
25
+ inherit: "bg-current",
25
26
  },
26
27
  size: {
27
28
  sm: `
@@ -35,6 +35,7 @@ export interface Props {
35
35
  | "gray"
36
36
  | "black"
37
37
  | "white"
38
+ | "inherit"
38
39
  | "brand";
39
40
 
40
41
  /**
@@ -69,12 +69,6 @@ const closeButtonColor = computed(() => {
69
69
  return props.color;
70
70
  });
71
71
 
72
- const iconColor = computed(() => {
73
- if (props.color === "white") return "gray";
74
-
75
- return props.variant === "primary" ? "white" : props.color;
76
- });
77
-
78
72
  /**
79
73
  * Get element / nested component attributes for each config token ✨
80
74
  * Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
@@ -146,19 +140,14 @@ const {
146
140
  >
147
141
  <!--
148
142
  @slot Use it to add something instead of the close button.
143
+ @binding {string} icon-name
149
144
  @binding {string} icon-size
150
- @binding {string} icon-color
151
145
  -->
152
- <slot
153
- name="close"
154
- :icon-name="config.defaults.closeIcon"
155
- :icon-size="closeIconSize"
156
- :icon-color="iconColor"
157
- >
146
+ <slot name="close" :icon-name="config.defaults.closeIcon" :icon-size="closeIconSize">
158
147
  <UIcon
159
148
  internal
149
+ color="inherit"
160
150
  :size="closeIconSize"
161
- :color="iconColor"
162
151
  :name="config.defaults.closeIcon"
163
152
  v-bind="closeIconAttrs"
164
153
  :data-test="`${dataTest}-button`"
@@ -55,10 +55,6 @@ const iconSize = computed(() => {
55
55
  return sizes[props.size] as IconSize;
56
56
  });
57
57
 
58
- const iconColor = computed(() => {
59
- return props.variant === "primary" ? "white" : props.color;
60
- });
61
-
62
58
  function onFocus() {
63
59
  emit("focus");
64
60
  }
@@ -115,15 +111,14 @@ const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs }
115
111
  @slot Use it to add icon before the text.
116
112
  @binding {string} icon-name
117
113
  @binding {string} icon-size
118
- @binding {string} icon-color
119
114
  -->
120
- <slot name="left" :icon-name="leftIcon" :icon-size="iconSize" :icon-color="iconColor">
115
+ <slot name="left" :icon-name="leftIcon" :icon-size="iconSize">
121
116
  <UIcon
122
117
  v-if="leftIcon"
123
118
  internal
124
119
  :name="leftIcon"
125
120
  :size="iconSize"
126
- :color="iconColor"
121
+ color="inherit"
127
122
  v-bind="leftIconAttrs"
128
123
  />
129
124
  </slot>
@@ -133,21 +128,14 @@ const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs }
133
128
  @binding {string} label
134
129
  @binding {string} icon-name
135
130
  @binding {string} icon-size
136
- @binding {string} icon-color
137
131
  -->
138
- <slot
139
- name="default"
140
- :label="label"
141
- :icon-name="icon"
142
- :icon-size="iconSize"
143
- :icon-color="iconColor"
144
- >
132
+ <slot name="default" :label="label" :icon-name="icon" :icon-size="iconSize">
145
133
  <UIcon
146
134
  v-if="icon"
147
135
  internal
148
136
  :name="icon"
149
137
  :size="iconSize"
150
- :color="iconColor"
138
+ color="inherit"
151
139
  v-bind="centerIconAttrs"
152
140
  />
153
141
  <template v-else>
@@ -159,14 +147,13 @@ const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs }
159
147
  @slot Use it to add icon after the text.
160
148
  @binding {string} icon-name
161
149
  @binding {string} icon-size
162
- @binding {string} icon-color
163
150
  -->
164
- <slot name="right" :icon-name="rightIcon" :icon-size="iconSize" :icon-color="iconColor">
151
+ <slot name="right" :icon-name="rightIcon" :icon-size="iconSize">
165
152
  <UIcon
166
153
  v-if="rightIcon"
167
154
  :name="rightIcon"
168
155
  :size="iconSize"
169
- :color="iconColor"
156
+ color="inherit"
170
157
  internal
171
158
  v-bind="rightIconAttrs"
172
159
  />
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.594",
4
+ "version": "0.0.596",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -310,15 +310,12 @@
310
310
  "description": "Use it to add something instead of the close button.",
311
311
  "bindings": [
312
312
  {
313
+ "type": "string",
313
314
  "name": "icon-name"
314
315
  },
315
316
  {
316
317
  "type": "string",
317
318
  "name": "icon-size"
318
- },
319
- {
320
- "type": "string",
321
- "name": "icon-color"
322
319
  }
323
320
  ]
324
321
  },
@@ -688,10 +685,6 @@
688
685
  {
689
686
  "type": "string",
690
687
  "name": "icon-size"
691
- },
692
- {
693
- "type": "string",
694
- "name": "icon-color"
695
688
  }
696
689
  ]
697
690
  },
@@ -711,10 +704,6 @@
711
704
  {
712
705
  "type": "string",
713
706
  "name": "icon-size"
714
- },
715
- {
716
- "type": "string",
717
- "name": "icon-color"
718
707
  }
719
708
  ]
720
709
  },
@@ -730,10 +719,6 @@
730
719
  {
731
720
  "type": "string",
732
721
  "name": "icon-size"
733
- },
734
- {
735
- "type": "string",
736
- "name": "icon-color"
737
722
  }
738
723
  ]
739
724
  }
@@ -999,10 +984,6 @@
999
984
  {
1000
985
  "type": "string",
1001
986
  "name": "icon-size"
1002
- },
1003
- {
1004
- "type": "string",
1005
- "name": "icon-color"
1006
987
  }
1007
988
  ]
1008
989
  },
@@ -1022,10 +1003,6 @@
1022
1003
  {
1023
1004
  "type": "string",
1024
1005
  "name": "icon-size"
1025
- },
1026
- {
1027
- "type": "string",
1028
- "name": "icon-color"
1029
1006
  }
1030
1007
  ]
1031
1008
  },
@@ -1041,10 +1018,6 @@
1041
1018
  {
1042
1019
  "type": "string",
1043
1020
  "name": "icon-size"
1044
- },
1045
- {
1046
- "type": "string",
1047
- "name": "icon-color"
1048
1021
  }
1049
1022
  ]
1050
1023
  }
@@ -3075,8 +3048,7 @@
3075
3048
  "value": {
3076
3049
  "kind": "expression",
3077
3050
  "type": "string"
3078
- },
3079
- "default": "calendar_month-fill"
3051
+ }
3080
3052
  },
3081
3053
  {
3082
3054
  "name": "disabled",
@@ -3160,6 +3132,7 @@
3160
3132
  "name": "icon-name"
3161
3133
  },
3162
3134
  {
3135
+ "type": "string",
3163
3136
  "name": "icon-size"
3164
3137
  }
3165
3138
  ]
@@ -3371,8 +3344,7 @@
3371
3344
  "value": {
3372
3345
  "kind": "expression",
3373
3346
  "type": "string"
3374
- },
3375
- "default": "calendar_month-fill"
3347
+ }
3376
3348
  },
3377
3349
  {
3378
3350
  "name": "label",
@@ -5601,6 +5573,7 @@
5601
5573
  "gray",
5602
5574
  "black",
5603
5575
  "white",
5576
+ "inherit",
5604
5577
  "brand"
5605
5578
  ],
5606
5579
  "value": {
@@ -7671,6 +7644,7 @@
7671
7644
  "gray",
7672
7645
  "black",
7673
7646
  "white",
7647
+ "inherit",
7674
7648
  "brand"
7675
7649
  ],
7676
7650
  "value": {