vueless 0.0.224 → 0.0.226

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.226",
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",
@@ -9,6 +9,9 @@ export default /*tw*/ {
9
9
  right: "flex-row w-fit",
10
10
  left: "flex-row-reverse w-fit",
11
11
  },
12
+ error: {
13
+ true: "text-red-500",
14
+ },
12
15
  },
13
16
  compoundVariants: [
14
17
  { align: "left", size: "sm", class: "gap-2" },
@@ -1,7 +1,8 @@
1
1
  import ULabel from "../ui.form-label";
2
2
  import URow from "../ui.container-row";
3
- import UButton from "../ui.button/index";
4
- import UBadge from "../ui.text-badge";
3
+ import UGroup from "../ui.container-group";
4
+ import UText from "../ui.text-block";
5
+ import UIcon from "../ui.image-icon";
5
6
 
6
7
  import { getArgTypes } from "../service.storybook";
7
8
 
@@ -21,30 +22,35 @@ export default {
21
22
  },
22
23
  };
23
24
 
25
+ const message = "This is plain text";
26
+
24
27
  const DefaultTemplate = (args) => ({
25
- components: { ULabel },
28
+ components: { ULabel, UText },
26
29
  setup() {
27
30
  return { args };
28
31
  },
29
32
  template: `
30
- <ULabel v-bind="args" />
33
+ <ULabel v-bind="args">
34
+ <UText v-bind="args">${message}</UText>
35
+ </ULabel>
31
36
  `,
32
37
  });
33
38
 
34
39
  const SlotTemplate = (args) => ({
35
- components: { ULabel, UBadge },
40
+ components: { ULabel, UText, UIcon },
36
41
  setup() {
37
42
  return { args };
38
43
  },
39
44
  template: `
40
45
  <ULabel v-bind="args">
46
+ <UText v-bind="args">${message}</UText>
41
47
  ${args.slotTemplate}
42
48
  </ULabel>
43
49
  `,
44
50
  });
45
51
 
46
52
  const SizesTemplate = (args, { argTypes } = {}) => ({
47
- components: { ULabel, URow },
53
+ components: { ULabel, URow, UText },
48
54
  setup() {
49
55
  return {
50
56
  args,
@@ -58,30 +64,33 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
58
64
  v-bind="args"
59
65
  :size="size"
60
66
  :key="index"
61
- />
67
+ >
68
+ <UText :size="size">This is <b>"{{ size }}"</b> size.</UText>
69
+ </ULabel>
62
70
  </URow>
63
71
  `,
64
72
  });
65
73
 
66
- const placementTemplate = (args, { argTypes } = {}) => ({
67
- components: { ULabel, URow, UButton },
74
+ const LabelPlacementTemplate = (args, { argTypes } = {}) => ({
75
+ components: { ULabel, UGroup, UText },
68
76
  setup() {
69
77
  return {
70
78
  args,
71
- placements: argTypes.placement.options,
79
+ placements: argTypes.align.options,
72
80
  };
73
81
  },
74
82
  template: `
75
- <URow>
83
+ <UGroup>
76
84
  <ULabel
77
- v-for="(placement, index) in placements"
85
+ v-for="(align, index) in placements"
78
86
  v-bind="args"
79
- :align="placement"
87
+ :align="align"
80
88
  :key="index"
89
+ class="border border-gray-200 rounded p-4"
81
90
  >
82
- <UButton text="Button"/>
91
+ <UText>This is <b>"{{ align }}"</b> label placement.</UText>
83
92
  </ULabel>
84
- </URow>
93
+ </UGroup>
85
94
  `,
86
95
  });
87
96
 
@@ -91,11 +100,11 @@ Default.args = {};
91
100
  export const Sizes = SizesTemplate.bind({});
92
101
  Sizes.args = {};
93
102
 
94
- export const Placement = placementTemplate.bind({});
95
- Placement.args = {};
103
+ export const LabelPlacement = LabelPlacementTemplate.bind({});
104
+ LabelPlacement.args = {};
96
105
 
97
106
  export const Error = DefaultTemplate.bind({});
98
- Error.args = { error: "some error" };
107
+ Error.args = { error: "Error description" };
99
108
 
100
109
  export const Disabled = DefaultTemplate.bind({});
101
110
  Disabled.args = { disabled: true };
@@ -104,7 +113,7 @@ export const slotFooter = SlotTemplate.bind({});
104
113
  slotFooter.args = {
105
114
  slotTemplate: `
106
115
  <template #footer>
107
- <UBadge label="favourite" color="green" size="sm" />
116
+ <UIcon name="star" color="green" />
108
117
  </template>
109
118
  `,
110
119
  };
@@ -5,6 +5,7 @@
5
5
  v-bind="wrapperAttrs"
6
6
  @click="onClick"
7
7
  >
8
+ <!-- @slot Use it to wrap something into the label. -->
8
9
  <slot />
9
10
 
10
11
  <div v-if="label || error || description" v-bind="labelWrapperAttrs">
@@ -25,7 +26,7 @@
25
26
  v-text="description"
26
27
  />
27
28
 
28
- <!-- @slot Use it to add something to the label's footer -->
29
+ <!-- @slot Use it to add something to the label's footer. -->
29
30
  <slot name="footer" />
30
31
  </div>
31
32
  </div>
@@ -40,6 +41,7 @@
40
41
  v-text="label"
41
42
  />
42
43
 
44
+ <!-- @slot Use it to wrap something into the label. -->
43
45
  <slot />
44
46
 
45
47
  <div v-if="error" :data-cy="`${dataCy}-error`" v-bind="descriptionAttrs" v-text="error" />
@@ -51,7 +53,7 @@
51
53
  v-text="description"
52
54
  />
53
55
 
54
- <!-- @slot Use it to add something to the label's footer -->
56
+ <!-- @slot Use it to add something to the label's footer. -->
55
57
  <slot name="footer" />
56
58
  </div>
57
59
  </template>
@@ -86,7 +88,7 @@ const props = defineProps({
86
88
 
87
89
  /**
88
90
  * Set label size.
89
- * @values xs, sm, md, lg, xl
91
+ * @values sm, md, lg
90
92
  */
91
93
  size: {
92
94
  type: String,
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.226",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -5049,7 +5049,7 @@
5049
5049
  "description": "Set label size.",
5050
5050
  "value": {
5051
5051
  "kind": "expression",
5052
- "type": "'xs' | 'sm' | 'md' | 'lg' | 'xl'"
5052
+ "type": "'sm' | 'md' | 'lg'"
5053
5053
  },
5054
5054
  "default": "md"
5055
5055
  },
@@ -5134,11 +5134,12 @@
5134
5134
  ],
5135
5135
  "slots": [
5136
5136
  {
5137
- "name": "default"
5137
+ "name": "default",
5138
+ "description": "Use it to wrap something into the label."
5138
5139
  },
5139
5140
  {
5140
5141
  "name": "footer",
5141
- "description": "Use it to add something to the label's footer"
5142
+ "description": "Use it to add something to the label's footer."
5142
5143
  }
5143
5144
  ],
5144
5145
  "source": {