vueless 0.0.672 → 0.0.673

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.
@@ -22,8 +22,8 @@ import type {
22
22
  MutatedProps,
23
23
  UnknownObject,
24
24
  ComponentNames,
25
- ComponentConfig,
26
25
  NestedComponent,
26
+ ComponentConfigFull,
27
27
  VuelessComponentInstance,
28
28
  } from "../types.ts";
29
29
 
@@ -45,25 +45,25 @@ export default function useUI<T>(
45
45
  ? (parent?.type.__name as ComponentNames)
46
46
  : (type.__name as ComponentNames);
47
47
 
48
- const globalConfig = (vuelessConfig.component?.[componentName] || {}) as ComponentConfig<T>;
48
+ const globalConfig = (vuelessConfig.component?.[componentName] || {}) as ComponentConfigFull<T>;
49
49
 
50
50
  const vuelessStrategy = Object.values(STRATEGY_TYPE).includes(vuelessConfig.strategy || "")
51
51
  ? (vuelessConfig.strategy as Strategies)
52
52
  : (STRATEGY_TYPE.merge as Strategies);
53
53
 
54
54
  const firstClassKey = Object.keys(defaultConfig || {})[0];
55
- const config = ref({}) as Ref<ComponentConfig<T>>;
55
+ const config = ref({}) as Ref<ComponentConfigFull<T>>;
56
56
  const attrs = useAttrs();
57
57
 
58
58
  watchEffect(() => {
59
- const propsConfig = props.config as ComponentConfig<T>;
59
+ const propsConfig = props.config as ComponentConfigFull<T>;
60
60
 
61
61
  config.value = getMergedConfig({
62
62
  defaultConfig,
63
63
  globalConfig,
64
64
  propsConfig,
65
65
  vuelessStrategy,
66
- }) as ComponentConfig<T>;
66
+ }) as ComponentConfigFull<T>;
67
67
  });
68
68
 
69
69
  /**
@@ -73,7 +73,7 @@ export default function useUI<T>(
73
73
  return computed(() => {
74
74
  const mutatedPropsValue = toValue(mutatedProps);
75
75
  const color = (toValue(mutatedProps || {}).color || props.color) as BrandColors;
76
- const value = (config.value as ComponentConfig<T>)[key];
76
+ const value = (config.value as ComponentConfigFull<T>)[key];
77
77
 
78
78
  let classes = "";
79
79
 
@@ -203,7 +203,7 @@ export default function useUI<T>(
203
203
  function getExtendsKeyConfig(configKey: string) {
204
204
  let extendsKeyConfig: NestedComponent = {};
205
205
 
206
- const propsConfig = props.config as ComponentConfig<T>;
206
+ const propsConfig = props.config as ComponentConfigFull<T>;
207
207
  const extendsKeys = getExtendsKeys(config.value[configKey]);
208
208
 
209
209
  if (extendsKeys.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.672",
3
+ "version": "0.0.673",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
package/types.ts CHANGED
@@ -255,8 +255,9 @@ export type ComponentConfig<T> = Partial<{
255
255
  ? T[K]
256
256
  : T[K] | string | UnknownObject
257
257
  : never;
258
- }> &
259
- NestedComponent;
258
+ }> & { [key: string]: unknown };
259
+
260
+ export type ComponentConfigFull<T> = ComponentConfig<T> & NestedComponent;
260
261
 
261
262
  export interface NestedComponent {
262
263
  base?: string;
@@ -270,6 +270,7 @@ const {
270
270
  tabindex="1"
271
271
  :style="{ maxHeight: wrapperMaxHeight }"
272
272
  v-bind="wrapperAttrs"
273
+ :data-test="`${dataTest}-list`"
273
274
  @keydown.self.down.prevent="pointerForward"
274
275
  @keydown.self.up.prevent="pointerBackward"
275
276
  @keydown.enter.stop.self="addPointerElement('Enter')"
@@ -288,6 +289,7 @@ const {
288
289
  <span
289
290
  v-if="!(option && (option.groupLabel || option.isSubGroup)) && !option.isHidden"
290
291
  v-bind="isSelectedOption(option) ? optionActiveAttrs : optionAttrs"
292
+ :data-test="`${dataTest}-option`"
291
293
  :class="optionHighlight(index, option)"
292
294
  @click="select(option), onClickOption(option)"
293
295
  @mouseenter.self="pointerSet(index)"
@@ -353,6 +355,7 @@ const {
353
355
  ref="add-option"
354
356
  role="option"
355
357
  v-bind="addOptionLabelWrapperAttrs"
358
+ :data-test="`${dataTest}-add`"
356
359
  @click="onClickAddOption"
357
360
  @mouseenter.self="pointerSet(options.length + 1)"
358
361
  >
@@ -362,7 +365,13 @@ const {
362
365
  </span>
363
366
  </li>
364
367
 
365
- <UButton round square v-bind="addOptionButtonAttrs" @click="onClickAddOption">
368
+ <UButton
369
+ round
370
+ square
371
+ v-bind="addOptionButtonAttrs"
372
+ :data-test="`${dataTest}-add-button`"
373
+ @click="onClickAddOption"
374
+ >
366
375
  <UIcon
367
376
  internal
368
377
  color="white"
@@ -80,9 +80,10 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
80
80
  v-if="isHorizontalPlacement || isTopWithDescPlacement"
81
81
  ref="wrapperRef"
82
82
  v-bind="wrapperAttrs"
83
+ :data-test="dataTest"
83
84
  @click="onClick"
84
85
  >
85
- <div v-bind="contentAttrs">
86
+ <div v-bind="contentAttrs" :data-test="`${dataTest}-content`">
86
87
  <!-- @slot Use it to add label content. -->
87
88
  <slot />
88
89
  </div>
@@ -136,7 +137,7 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
136
137
  </slot>
137
138
  </label>
138
139
 
139
- <div v-bind="contentAttrs">
140
+ <div v-bind="contentAttrs" :data-test="`${dataTest}-content`">
140
141
  <!-- @slot Use it to add label content. -->
141
142
  <slot />
142
143
  </div>
@@ -517,6 +517,7 @@ const {
517
517
  color="gray"
518
518
  :name="config.defaults.dropdownIcon"
519
519
  v-bind="toggleIconAttrs"
520
+ :data-test="`${dataTest}-toggle`"
520
521
  :tabindex="-1"
521
522
  />
522
523
  </slot>
@@ -538,6 +539,7 @@ const {
538
539
  color="gray"
539
540
  :name="config.defaults.clearIcon"
540
541
  v-bind="clearIconAttrs"
542
+ :data-test="`${dataTest}-clear`"
541
543
  />
542
544
  </slot>
543
545
  </div>
@@ -612,6 +614,7 @@ const {
612
614
  color="gray"
613
615
  :name="config.defaults.clearMultipleIcon"
614
616
  v-bind="clearMultipleIconAttrs"
617
+ :data-test="`${dataTest}-clear-all`"
615
618
  />
616
619
  </slot>
617
620
  </div>
@@ -631,6 +634,7 @@ const {
631
634
  :disabled="disabled"
632
635
  :aria-controls="'listbox-' + elementId"
633
636
  v-bind="searchInputAttrs"
637
+ :data-test="`${dataTest}-search`"
634
638
  @focus="activate"
635
639
  @blur.prevent="deactivate"
636
640
  @keyup.esc="deactivate"
@@ -689,6 +693,7 @@ const {
689
693
  :add-option="addOption"
690
694
  tabindex="-1"
691
695
  v-bind="dropdownListAttrs as KeyAttrsWithConfig<UDropdownListConfig>"
696
+ :data-test="dataTest"
692
697
  @add="onAddOption"
693
698
  @focus="activate"
694
699
  @mousedown.prevent.capture
@@ -7,7 +7,8 @@ export default /*tw*/ {
7
7
  {
8
8
  filled: true,
9
9
  variant: "thirdary",
10
- class: "!bg-gray-800/10 dark:!bg-gray-200/10",
10
+ color: "grayscale",
11
+ class: "bg-gray-800/10 dark:bg-gray-200/10",
11
12
  },
12
13
  ],
13
14
  },