vueless 0.0.224 → 0.0.225

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.
@@ -92,7 +92,7 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
92
92
 
93
93
  watch(config, updateVuelessAttrs, { immediate: true });
94
94
  watch(props, updateVuelessAttrs);
95
- options?.classes && watch(options?.classes, updateVuelessAttrs);
95
+ options?.classes?.value && watch(options?.classes, updateVuelessAttrs);
96
96
 
97
97
  function updateVuelessAttrs() {
98
98
  const configKeyValue = config.value[configKey];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.224",
3
+ "version": "0.0.225",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -1,4 +1,13 @@
1
1
  export default /*tw*/ {
2
+ label: {
3
+ component: "{ULabel}",
4
+ base: "flex flex-wrap",
5
+ variants: {
6
+ block: {
7
+ true: "w-full",
8
+ },
9
+ },
10
+ },
2
11
  items: {
3
12
  base: "flex flex-wrap",
4
13
  variants: {
@@ -13,8 +22,8 @@ export default /*tw*/ {
13
22
  separated: {
14
23
  false: `
15
24
  flex-nowrap -space-x-px gap-0
16
- [&>:first-child]:rounded-l-lg [&>:last-child]:rounded-r-lg
17
- [&>:first-child>*>*]:rounded-l-lg [&>:last-child>*>*]:rounded-r-lg
25
+ [&>:first-child]:rounded-l-lg [&>:last-child]:rounded-r-lg
26
+ [&>:first-child>*>*]:rounded-l-lg [&>:last-child>*>*]:rounded-r-lg
18
27
  `,
19
28
  },
20
29
  },
@@ -23,14 +32,6 @@ export default /*tw*/ {
23
32
  { separated: false, multiple: true, class: "space-x-px" },
24
33
  ],
25
34
  },
26
- label: {
27
- base: "{ULabel} flex flex-wrap",
28
- variants: {
29
- block: {
30
- true: "w-full",
31
- },
32
- },
33
- },
34
35
  item: "{UToggleItem}",
35
36
  defaultVariants: {
36
37
  variant: "primary",
@@ -5,8 +5,9 @@
5
5
  :description="description"
6
6
  :align="labelAlign"
7
7
  :disabled="disabled"
8
- :data-cy="dataCy"
8
+ centred
9
9
  v-bind="labelAttrs"
10
+ :data-cy="dataCy"
10
11
  >
11
12
  <div v-bind="itemsAttrs">
12
13
  <!-- @slot Use it to add UToggleItem directly. -->
@@ -9,12 +9,10 @@ export default function useAttrs(props, { isSelected, separated, variant }) {
9
9
  () => props.config,
10
10
  );
11
11
 
12
- const skipKeys = ["selected"];
13
-
14
12
  const attrs = {};
15
13
 
16
14
  for (const key in defaultConfig) {
17
- if (isSystemKey(key) || skipKeys.includes(key)) continue;
15
+ if (isSystemKey(key)) continue;
18
16
 
19
17
  const classes = computed(() => {
20
18
  const value = config.value[key];
@@ -1,7 +1,8 @@
1
1
  export default /*tw*/ {
2
2
  button: {
3
+ component: "{UButton}",
3
4
  base: `
4
- {UButton} border-gray-300 font-normal
5
+ border-gray-300 font-normal
5
6
  hover:text-brand-600 hover:border-brand-600 hover:relative hover:z-10
6
7
  focus:text-brand-600 focus:border-brand-600 focus:relative focus:z-10 focus:ring-brand-600 focus-within:ring-brand-600
7
8
  active:text-brand-700 active:border-brand-700 active:relative active:z-10
@@ -45,6 +45,7 @@ export default function useAttrs(props) {
45
45
  }
46
46
 
47
47
  // TODO: Need to find other solution
48
+ // classes is not reactive here, which may cause problems in styling by `config` prop
48
49
  if (key === "day") {
49
50
  attrs[`${key}Attrs`] = (classes) => {
50
51
  return getAttrs("day", { classes }).value;
@@ -1,5 +1,5 @@
1
1
  import useUI from "../../composable.ui";
2
- import { cva, cx } from "../../service.ui";
2
+ import { cva } from "../../service.ui";
3
3
  import { computed, watchEffect } from "vue";
4
4
 
5
5
  import defaultConfig from "../configs/default.config";
@@ -18,6 +18,8 @@ export default function useAttrs(props, { isShownCalendar, isTop, isRight }) {
18
18
  if (value.variants || value.compoundVariants) {
19
19
  return cva(value)({
20
20
  ...props,
21
+ openDirectionY: isTop.value ? POSITION.top : POSITION.bottom,
22
+ openDirectionX: isRight.value ? POSITION.right : POSITION.left,
21
23
  });
22
24
  }
23
25
 
@@ -31,24 +33,14 @@ export default function useAttrs(props, { isShownCalendar, isTop, isRight }) {
31
33
 
32
34
  attrs[`${key}Attrs`] = computed(() => ({
33
35
  ...inputAttrs.value,
34
- class: cx([inputAttrs.value.class, isShownCalendar.value && config.value.inputFocus]),
36
+ config: {
37
+ ...inputAttrs.value.config,
38
+ ...(isShownCalendar.value ? config.value.inputFocused : {}),
39
+ },
35
40
  }));
36
41
  }
37
42
 
38
43
  if (key === "calendar") {
39
- const calendarAttrs = attrs[`${key}Attrs`];
40
-
41
- attrs[`${key}Attrs`] = computed(() => ({
42
- ...calendarAttrs.value,
43
- class: cx([
44
- cva(config.value.calendar.wrapper)({
45
- openDirectionY: isTop.value ? POSITION.top : POSITION.bottom,
46
- openDirectionX: isRight.value ? POSITION.right : POSITION.left,
47
- }),
48
- calendarAttrs.value.class,
49
- ]),
50
- }));
51
-
52
44
  // This watcher rewrites default calendar locales with datepicker range locales
53
45
  // Watcher will not rewrite custom calendar locales
54
46
  watchEffect(() => {
@@ -1,20 +1,20 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "relative",
3
- input: "",
4
- inputFocus: {
3
+ input: "{UInput}",
4
+ inputFocused: {
5
+ component: "{UInput}",
5
6
  block: "ring-4 ring-brand-600/[.15] border-brand-500 hover:border-brand-500",
6
7
  },
7
8
  calendar: {
8
- wrapper: {
9
- base: "{UCalendar} absolute z-40 my-2",
10
- variants: {
11
- openDirectionX: {
12
- left: "left-0",
13
- right: "right-0",
14
- },
15
- openDirectionY: {
16
- top: "bottom-full mt-0",
17
- },
9
+ component: "{UCalendar}",
10
+ base: "absolute z-40 my-2",
11
+ variants: {
12
+ openDirectionX: {
13
+ left: "left-0",
14
+ right: "right-0",
15
+ },
16
+ openDirectionY: {
17
+ top: "bottom-full mt-0",
18
18
  },
19
19
  },
20
20
  },
@@ -251,14 +251,8 @@ const calendarWrapperRef = computed(() => calendarRef?.value?.wrapperRef);
251
251
  const { isTop, isRight, adjustPositionY, adjustPositionX } = useAdjustElementPosition(
252
252
  wrapperRef,
253
253
  calendarWrapperRef,
254
- {
255
- x: props.openDirectionX,
256
- y: props.openDirectionY,
257
- },
258
- {
259
- x: "left",
260
- y: "bottom",
261
- },
254
+ { x: props.openDirectionX, y: props.openDirectionY },
255
+ { x: "left", y: "bottom" },
262
256
  );
263
257
 
264
258
  defineExpose({
@@ -1,7 +1,8 @@
1
1
  export default /*tw*/ {
2
2
  input: {
3
+ component: "{UInput}",
3
4
  wrapper: "relative flex items-center justify-between w-full rounded-lg bg-gray-900 bg-opacity-5",
4
- input: "{UInput} w-full",
5
+ input: "w-full",
5
6
  label: "w-full",
6
7
  rightSlot: "pr-0",
7
8
  leftSlot: "pl-0",
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.224",
4
+ "version": "0.0.225",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",