vueless 0.0.207 → 0.0.209

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.
Files changed (45) hide show
  1. package/composable.ui/index.js +1 -0
  2. package/package.json +1 -1
  3. package/service.storybook/index.js +9 -0
  4. package/ui.button/index.stories.js +6 -18
  5. package/ui.button/index.vue +6 -1
  6. package/ui.container-accordion/composables/attrs.composable.js +10 -11
  7. package/ui.container-accordion/index.vue +8 -2
  8. package/ui.container-card/composable/attrs.composable.js +36 -43
  9. package/ui.container-card/configs/default.config.js +2 -2
  10. package/ui.container-card/index.vue +1 -1
  11. package/ui.container-divider/composables/attrs.composable.js +22 -49
  12. package/ui.container-divider/index.vue +1 -1
  13. package/ui.container-group/composables/attrs.composable.js +23 -39
  14. package/ui.container-group/configs/default.config.js +3 -3
  15. package/ui.container-group/index.vue +4 -4
  16. package/ui.container-groups/composables/attrs.composable.js +20 -16
  17. package/ui.container-groups/index.vue +1 -1
  18. package/ui.container-modal/composables/attrs.composable.js +43 -66
  19. package/ui.container-modal/configs/default.config.js +6 -6
  20. package/ui.container-modal/index.vue +13 -2
  21. package/ui.container-modal-confirm/composable/attrs.composable.js +21 -40
  22. package/ui.container-modal-confirm/configs/default.config.js +3 -3
  23. package/ui.container-modal-confirm/index.vue +18 -2
  24. package/ui.container-page/composables/attrs.composable.js +48 -83
  25. package/ui.container-page/configs/default.config.js +3 -3
  26. package/ui.container-page/index.vue +1 -1
  27. package/ui.container-row/composables/attrs.composable.js +20 -17
  28. package/ui.container-row/index.vue +1 -1
  29. package/ui.form-date-picker-range/configs/default.config.js +2 -6
  30. package/ui.form-date-picker-range/index.vue +29 -12
  31. package/ui.form-input/index.stories.js +2 -5
  32. package/ui.form-radio-group/index.stories.js +19 -28
  33. package/ui.form-radio-group/index.vue +2 -2
  34. package/ui.form-select/composables/attrs.composable.js +16 -16
  35. package/ui.form-select/configs/default.config.js +39 -39
  36. package/ui.form-select/index.vue +19 -19
  37. package/ui.image-avatar/composables/attrs.composable.js +28 -24
  38. package/ui.image-avatar/configs/default.config.js +1 -1
  39. package/ui.image-avatar/index.vue +7 -2
  40. package/ui.image-icon/composables/attrs.composable.js +24 -49
  41. package/ui.image-icon/index.vue +17 -2
  42. package/ui.loader/index.stories.js +32 -2
  43. package/ui.navigation-progress/index.stories.js +48 -106
  44. package/ui.navigation-progress/index.vue +9 -1
  45. package/web-types.json +61 -18
@@ -91,6 +91,7 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
91
91
 
92
92
  watch(config, updateVuelessAttrs, { immediate: true });
93
93
  watch(props, updateVuelessAttrs);
94
+ options?.classes && watch(options?.classes, updateVuelessAttrs);
94
95
 
95
96
  function updateVuelessAttrs() {
96
97
  const configKeyValue = config.value[configKey];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.207",
3
+ "version": "0.0.209",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -96,6 +96,15 @@ export function getArgTypes(componentName) {
96
96
  control: "text",
97
97
  table: { category: "slots" },
98
98
  };
99
+
100
+ // Hide autogenerated slot docs, but keep props with the same name
101
+ if (!component.attributes?.map((item) => item.name)?.includes(slot.name)) {
102
+ types[slot.name] = {
103
+ table: {
104
+ disable: true,
105
+ },
106
+ };
107
+ }
99
108
  });
100
109
 
101
110
  component.events?.forEach((event) => {
@@ -29,19 +29,7 @@ const DefaultTemplate = (args) => ({
29
29
  },
30
30
  template: `
31
31
  <UButton v-bind="args">
32
- ${allSlotsFragment}
33
- </UButton>
34
- `,
35
- });
36
-
37
- const SlotTemplate = (args) => ({
38
- components: { UButton, UIcon },
39
- setup() {
40
- return { args };
41
- },
42
- template: `
43
- <UButton v-bind="args">
44
- ${args.slotTemplate}
32
+ ${args.slotTemplate || allSlotsFragment}
45
33
  </UButton>
46
34
  `,
47
35
  });
@@ -141,7 +129,7 @@ iconRight.args = {
141
129
  iconRight: "star",
142
130
  };
143
131
 
144
- export const slotDefault = SlotTemplate.bind({});
132
+ export const slotDefault = DefaultTemplate.bind({});
145
133
  slotDefault.args = {
146
134
  slotTemplate: `
147
135
  <template #default>
@@ -150,7 +138,7 @@ slotDefault.args = {
150
138
  `,
151
139
  };
152
140
 
153
- export const iconLeftSlot = SlotTemplate.bind({});
141
+ export const iconLeftSlot = DefaultTemplate.bind({});
154
142
  iconLeftSlot.args = {
155
143
  slotTemplate: `
156
144
  <template #icon-left>
@@ -162,7 +150,7 @@ iconLeftSlot.args = {
162
150
  `,
163
151
  };
164
152
 
165
- export const iconRightSlot = SlotTemplate.bind({});
153
+ export const iconRightSlot = DefaultTemplate.bind({});
166
154
  iconRightSlot.args = {
167
155
  slotTemplate: `
168
156
  <template #icon-right>
@@ -174,7 +162,7 @@ iconRightSlot.args = {
174
162
  `,
175
163
  };
176
164
 
177
- export const leftSlot = SlotTemplate.bind({});
165
+ export const leftSlot = DefaultTemplate.bind({});
178
166
  leftSlot.args = {
179
167
  slotTemplate: `
180
168
  <template #left>
@@ -186,7 +174,7 @@ leftSlot.args = {
186
174
  `,
187
175
  };
188
176
 
189
- export const rightSlot = SlotTemplate.bind({});
177
+ export const rightSlot = DefaultTemplate.bind({});
190
178
  rightSlot.args = {
191
179
  slotTemplate: `
192
180
  <template #right>
@@ -36,7 +36,12 @@
36
36
 
37
37
  <!-- @slot Use it to add something instead of the text. -->
38
38
  <slot />
39
- <div v-if="label" v-bind="textAttrs" tabindex="-1" v-text="label" />
39
+ <div
40
+ v-if="label && !hasSlotContent($slots['default'])"
41
+ v-bind="textAttrs"
42
+ tabindex="-1"
43
+ v-text="label"
44
+ />
40
45
 
41
46
  <!-- @slot Use it to add something after the text. -->
42
47
  <slot name="right" />
@@ -3,7 +3,7 @@ import useUI from "../../composable.ui";
3
3
  import { cva } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
 
6
- export function useAttrs(props, { isOpened }) {
6
+ export default function useAttrs(props, { isOpened }) {
7
7
  const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
8
8
  defaultConfig,
9
9
  () => props.config,
@@ -13,19 +13,18 @@ export function useAttrs(props, { isOpened }) {
13
13
  for (const key in defaultConfig) {
14
14
  if (isSystemKey(key)) continue;
15
15
 
16
- let classes = "";
17
- let value = config.value[key];
16
+ const classes = computed(() => {
17
+ const value = config.value[key];
18
18
 
19
- if (value.variants || value.compoundVariants) {
20
- const getCVA = cva(value);
21
-
22
- classes = computed(() =>
23
- getCVA({
19
+ if (value.variants || value.compoundVariants) {
20
+ return cva(value)({
24
21
  ...props,
25
22
  isOpened: isOpened.value,
26
- }),
27
- );
28
- }
23
+ });
24
+ }
25
+
26
+ return "";
27
+ });
29
28
 
30
29
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
31
30
  }
@@ -28,7 +28,7 @@ import UIService, { getRandomId } from "../service.ui";
28
28
 
29
29
  import { UAccordion } from "./constants/index";
30
30
  import defaultConfig from "./configs/default.config";
31
- import { useAttrs } from "./composables/attrs.composable";
31
+ import useAttrs from "./composables/attrs.composable";
32
32
 
33
33
  /* Should be a string for correct web-types gen */
34
34
  defineOptions({ name: "UAccordion", inheritAttrs: false });
@@ -85,7 +85,13 @@ const props = defineProps({
85
85
  },
86
86
  });
87
87
 
88
- const emit = defineEmits(["click"]);
88
+ const emit = defineEmits([
89
+ /**
90
+ * Triggers when the accordion item is toggled.
91
+ * @property {string} name
92
+ */
93
+ "click",
94
+ ]);
89
95
 
90
96
  const isOpened = ref(false);
91
97
 
@@ -4,53 +4,46 @@ import { cva, cx } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
- export function useAttrs(props, { isMobileBreakpoint }) {
8
- const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
9
- const { wrapper } = config.value;
10
-
11
- const cvaWrapper = cva({
12
- base: wrapper.base,
13
- variants: wrapper.variants,
14
- compoundVariants: wrapper.compoundVariants,
15
- });
16
-
17
- const wrapperClasses = computed(() =>
18
- cvaWrapper({
19
- padding: props.padding,
20
- rounded: props.rounded,
21
- }),
7
+ export default function useAttrs(props, { isMobileBreakpoint }) {
8
+ const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
22
11
  );
12
+ const attrs = {};
23
13
 
24
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
25
- const headerAttrs = getAttrs("header");
26
- const headerLeftAttrs = getAttrs("headerLeft");
27
- const headerLeftFallbackAttrs = getAttrs("headerLeftFallback");
28
- const titleAttrs = getAttrs("title", { isComponent: true });
29
- const descriptionAttrs = getAttrs("description");
30
- const contentAttrs = getAttrs("content");
31
- const dividerAttrs = getAttrs("divider", { isComponent: true });
32
- const footerAttrsRaw = getAttrs("footer");
33
-
34
- const footerAttrs = computed(() => {
35
- const footerMobileReverseClasses =
36
- props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse;
37
-
38
- return {
39
- ...footerAttrsRaw.value,
40
- class: cx([footerAttrsRaw.value.class, footerMobileReverseClasses]),
41
- };
42
- });
14
+ for (const key in defaultConfig) {
15
+ if (isSystemKey(key)) continue;
16
+
17
+ const classes = computed(() => {
18
+ const value = config.value[key];
19
+
20
+ if (value.variants || value.compoundVariants) {
21
+ return cva(value)({
22
+ ...props,
23
+ });
24
+ }
25
+
26
+ return "";
27
+ });
28
+
29
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
30
+
31
+ if (key === "footer") {
32
+ const footerAttrs = attrs[`${key}Attrs`];
33
+
34
+ attrs[`${key}Attrs`] = computed(() => ({
35
+ ...footerAttrs.value,
36
+ class: cx([
37
+ footerAttrs.value.class,
38
+ props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse,
39
+ ]),
40
+ }));
41
+ }
42
+ }
43
43
 
44
44
  return {
45
+ ...attrs,
46
+ config,
45
47
  hasSlotContent,
46
- wrapperAttrs,
47
- titleAttrs,
48
- dividerAttrs,
49
- headerAttrs,
50
- headerLeftAttrs,
51
- headerLeftFallbackAttrs,
52
- descriptionAttrs,
53
- contentAttrs,
54
- footerAttrs,
55
48
  };
56
49
  }
@@ -17,10 +17,10 @@ export default /*tw*/ {
17
17
  header: "flex justify-between",
18
18
  headerLeft: "flex items-center space-x-4 w-full",
19
19
  headerLeftFallback: "flex flex-col w-full",
20
- title: "",
20
+ title: "{UHeader}",
21
21
  description: "mt-1.5 text-base font-normal text-gray-500",
22
22
  content: "",
23
- divider: "",
23
+ divider: "{UDivider}",
24
24
  footer: "flex justify-between",
25
25
  footerMobileReverse: "flex flex-col-reverse space-y-reverse",
26
26
  defaultVariants: {
@@ -47,7 +47,7 @@ import UDivider from "../ui.container-divider";
47
47
 
48
48
  import { UCard } from "./constants";
49
49
  import defaultConfig from "./configs/default.config";
50
- import { useAttrs } from "./composable/attrs.composable";
50
+ import useAttrs from "./composable/attrs.composable";
51
51
  import useBreakpoint from "../composable.breakpoint";
52
52
 
53
53
  /* Should be a string for correct web-types gen */
@@ -4,62 +4,35 @@ import { cva } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
- export function useAttrs(props) {
8
- const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
9
- const { wrapper, divider, label } = config.value;
10
-
11
- const cvaWrapper = cva({
12
- base: wrapper.base,
13
- variants: wrapper.variants,
14
- compoundVariants: wrapper.compoundVariants,
15
- });
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
11
+ );
12
+ const attrs = {};
16
13
 
17
- const cvaDivider = cva({
18
- base: divider.base,
19
- variants: divider.variants,
20
- compoundVariants: divider.compoundVariants,
21
- });
14
+ for (const key in defaultConfig) {
15
+ if (isSystemKey(key)) continue;
22
16
 
23
- const cvaLabel = cva({
24
- base: label.base,
25
- variants: label.variants,
26
- compoundVariants: label.compoundVariants,
27
- });
17
+ const classes = computed(() => {
18
+ const value = config.value[key];
28
19
 
29
- const wrapperClasses = computed(() =>
30
- cvaWrapper({
31
- size: props.size,
32
- vertical: props.vertical,
33
- noPadding: props.noPadding,
34
- noTopPadding: props.noTopPadding,
35
- noBottomPadding: props.noBottomPadding,
36
- noLeftPadding: props.noLeftPadding,
37
- noRightPadding: props.noRightPadding,
38
- label: Boolean(props.label),
39
- }),
40
- );
41
-
42
- const dividerClasses = computed(() =>
43
- cvaDivider({
44
- variant: props.variant,
45
- dashed: props.dashed,
46
- dotted: props.dotted,
47
- vertical: props.vertical,
48
- noBorder: props.noBorder,
49
- label: Boolean(props.label),
50
- }),
51
- );
20
+ if (value.variants || value.compoundVariants) {
21
+ return cva(value)({
22
+ ...props,
23
+ label: Boolean(props.label),
24
+ });
25
+ }
52
26
 
53
- const labelClasses = computed(() => cvaLabel({ variant: props.variant }));
27
+ return "";
28
+ });
54
29
 
55
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
56
- const dividerAttrs = getAttrs("divider", { classes: dividerClasses });
57
- const labelAttrs = getAttrs("label", { classes: labelClasses });
30
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
31
+ }
58
32
 
59
33
  return {
34
+ ...attrs,
35
+ config,
60
36
  hasSlotContent,
61
- wrapperAttrs,
62
- dividerAttrs,
63
- labelAttrs,
64
37
  };
65
38
  }
@@ -13,7 +13,7 @@ import UIService from "../service.ui";
13
13
 
14
14
  import { UDivider } from "./constants";
15
15
  import defaultConfig from "./configs/default.config";
16
- import { useAttrs } from "./composables/attrs.composable";
16
+ import useAttrs from "./composables/attrs.composable";
17
17
 
18
18
  /* Should be a string for correct web-types gen */
19
19
  defineOptions({ name: "UDivider", inheritAttrs: false });
@@ -4,46 +4,30 @@ import { cva } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
  import { computed } from "vue";
6
6
 
7
- export function useAttrs(props) {
8
- const { config, getAttrs } = useUI(defaultConfig, () => props.config);
9
- const { content, header } = config.value;
10
-
11
- const cvaContent = cva({
12
- base: content.base,
13
- variants: content.variants,
14
- compoundVariants: content.compoundVariants,
15
- });
16
-
17
- const cvaHeader = cva({
18
- base: header.base,
19
- variants: header.variants,
20
- compoundVariants: header.compoundVariants,
21
- });
22
-
23
- const contentClasses = computed(() =>
24
- cvaContent({
25
- gap: props.gap,
26
- align: props.align,
27
- }),
28
- );
29
-
30
- const headerClasses = computed(() => cvaHeader({ underlined: props.underlined }));
31
-
32
- const wrapperAttrs = getAttrs("wrapper");
33
- const upperlineAttrs = getAttrs("upperline", { isComponent: true });
34
- const headerAttrs = getAttrs("header", { classes: headerClasses });
35
- const headerFallbackAttrs = getAttrs("headerFallback");
36
- const titleAttrs = getAttrs("title", { isComponent: true });
37
- const underlineAttrs = getAttrs("underline", { isComponent: true });
38
- const contentAttrs = getAttrs("content", { classes: contentClasses });
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
9
+ const attrs = {};
10
+
11
+ for (const key in defaultConfig) {
12
+ if (isSystemKey(key)) continue;
13
+
14
+ const classes = computed(() => {
15
+ const value = config.value[key];
16
+
17
+ if (value.variants || value.compoundVariants) {
18
+ return cva(value)({
19
+ ...props,
20
+ });
21
+ }
22
+
23
+ return "";
24
+ });
25
+
26
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
27
+ }
39
28
 
40
29
  return {
41
- contentAttrs,
42
- headerAttrs,
43
- wrapperAttrs,
44
- headerFallbackAttrs,
45
- titleAttrs,
46
- upperlineAttrs,
47
- underlineAttrs,
30
+ ...attrs,
31
+ config,
48
32
  };
49
33
  }
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "w-full",
3
- upperline: "",
3
+ upperline: "{UDivider}",
4
4
  header: {
5
5
  base: "flex items-center justify-between",
6
6
  variants: {
@@ -10,8 +10,8 @@ export default /*tw*/ {
10
10
  },
11
11
  },
12
12
  headerFallback: "flex items-center",
13
- title: "pr-2",
14
- underline: "pt-1.5",
13
+ title: "{UHeader} pr-2",
14
+ underline: "{UDivider} pt-1.5",
15
15
  content: {
16
16
  base: "flex flex-col",
17
17
  variants: {
@@ -7,12 +7,12 @@
7
7
  <!-- @slot Use it to add something left side of the header. -->
8
8
  <slot name="left">
9
9
  <div v-bind="headerFallbackAttrs">
10
- <!-- @slot Use it to add something before title. -->
10
+ <!-- @slot Use it to add something before the title. -->
11
11
  <slot name="before-title" />
12
12
 
13
13
  <UHeader :label="title" size="xs" v-bind="titleAttrs" />
14
14
 
15
- <!-- @slot Use it to add something after title. -->
15
+ <!-- @slot Use it to add something after the title. -->
16
16
  <slot name="after-title" />
17
17
  </div>
18
18
  </slot>
@@ -25,7 +25,7 @@
25
25
  </template>
26
26
 
27
27
  <div v-bind="contentAttrs">
28
- <!-- @slot Use it to add something instead form. -->
28
+ <!-- @slot Use it to add something inside. -->
29
29
  <slot />
30
30
  </div>
31
31
  </div>
@@ -38,7 +38,7 @@ import UHeader from "../ui.text-header";
38
38
 
39
39
  import { UGroup } from "./constants";
40
40
  import defaultConfig from "./configs/default.config";
41
- import { useAttrs } from "./composables/attrs.composable";
41
+ import useAttrs from "./composables/attrs.composable";
42
42
 
43
43
  /* Should be a string for correct web-types gen */
44
44
  defineOptions({ name: "UGroup", inheritAttrs: false });
@@ -4,26 +4,30 @@ import { cva } from "../../service.ui";
4
4
  import useUI from "../../composable.ui";
5
5
  import defaultConfig from "../configs/default.config";
6
6
 
7
- export function useAttrs(props) {
8
- const { config, getAttrs } = useUI(defaultConfig, () => props.config);
9
- const { wrapper } = config.value;
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
9
+ const attrs = {};
10
10
 
11
- const cvaWrapper = cva({
12
- base: wrapper.base,
13
- variants: wrapper.variants,
14
- compoundVariants: wrapper.compoundVariants,
15
- });
11
+ for (const key in defaultConfig) {
12
+ if (isSystemKey(key)) continue;
16
13
 
17
- const wrapperClasses = computed(() =>
18
- cvaWrapper({
19
- gap: props.gap,
20
- align: props.align,
21
- }),
22
- );
14
+ const classes = computed(() => {
15
+ const value = config.value[key];
23
16
 
24
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
17
+ if (value.variants || value.compoundVariants) {
18
+ return cva(value)({
19
+ ...props,
20
+ });
21
+ }
22
+
23
+ return "";
24
+ });
25
+
26
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
27
+ }
25
28
 
26
29
  return {
27
- wrapperAttrs,
30
+ ...attrs,
31
+ config,
28
32
  };
29
33
  }
@@ -10,7 +10,7 @@ import UIService from "../service.ui";
10
10
 
11
11
  import { UGroups } from "./constants";
12
12
  import defaultConfig from "./configs/default.config";
13
- import { useAttrs } from "./composables/attrs.composable";
13
+ import useAttrs from "./composables/attrs.composable";
14
14
 
15
15
  /* Should be a string for correct web-types gen */
16
16
  defineOptions({ name: "UGroups", inheritAttrs: false });