vueless 0.0.209 → 0.0.211

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 (80) hide show
  1. package/package.json +1 -1
  2. package/ui.container-group/configs/default.config.js +19 -1
  3. package/ui.container-group/index.vue +26 -1
  4. package/ui.container-row/configs/default.config.js +21 -3
  5. package/ui.container-row/index.vue +27 -2
  6. package/ui.data-list/composables/attrs.composable.js +39 -36
  7. package/ui.data-list/configs/default.config.js +6 -4
  8. package/ui.data-list/index.stories.js +2 -4
  9. package/ui.data-list/index.vue +34 -5
  10. package/ui.data-table/composables/attrs.composable.js +180 -245
  11. package/ui.data-table/configs/default.config.js +10 -10
  12. package/ui.data-table/index.vue +52 -12
  13. package/ui.form-checkbox/composables/attrs.composable.js +28 -43
  14. package/ui.form-checkbox/configs/default.config.js +2 -2
  15. package/ui.form-checkbox/index.stories.js +2 -4
  16. package/ui.form-checkbox/index.vue +16 -4
  17. package/ui.form-checkbox-group/composables/attrs.composable.js +24 -9
  18. package/ui.form-checkbox-group/configs/default.config.js +2 -2
  19. package/ui.form-checkbox-group/index.vue +8 -2
  20. package/ui.form-checkbox-multi-state/composables/attrs.composable.js +34 -12
  21. package/ui.form-checkbox-multi-state/configs/default.config.js +1 -1
  22. package/ui.form-checkbox-multi-state/index.vue +8 -2
  23. package/ui.form-input-file/composables/attrs.composable.js +19 -62
  24. package/ui.form-input-file/configs/default.config.js +7 -7
  25. package/ui.form-input-file/index.vue +15 -3
  26. package/ui.form-input-money/composables/attrs.composable.js +23 -4
  27. package/ui.form-input-money/configs/default.config.js +1 -1
  28. package/ui.form-input-money/index.stories.js +2 -4
  29. package/ui.form-input-number/composables/attrs.composable.js +22 -36
  30. package/ui.form-input-number/configs/default.config.js +4 -4
  31. package/ui.form-input-number/index.vue +8 -2
  32. package/ui.form-input-rating/composables/attrs.composable.js +10 -11
  33. package/ui.form-input-rating/index.vue +2 -2
  34. package/ui.form-input-search/composables/attrs.composable.js +26 -11
  35. package/ui.form-input-search/configs/default.config.js +4 -4
  36. package/ui.form-input-search/index.stories.js +2 -4
  37. package/ui.form-input-search/index.vue +21 -4
  38. package/ui.form-label/composables/attrs.composable.js +22 -49
  39. package/ui.form-label/index.vue +9 -2
  40. package/ui.form-radio/composables/attrs.composable.js +29 -22
  41. package/ui.form-radio/configs/default.config.js +1 -1
  42. package/ui.form-radio/index.stories.js +2 -4
  43. package/ui.form-radio/index.vue +8 -2
  44. package/ui.form-radio-group/composables/attrs.composable.js +20 -15
  45. package/ui.form-radio-group/configs/default.config.js +2 -1
  46. package/ui.form-radio-group/index.vue +8 -2
  47. package/ui.form-switch/composables/attrs.composable.js +25 -61
  48. package/ui.form-switch/configs/default.config.js +2 -2
  49. package/ui.form-switch/index.vue +8 -2
  50. package/ui.form-textarea/composables/attrs.composable.js +25 -36
  51. package/ui.form-textarea/configs/default.config.js +1 -1
  52. package/ui.form-textarea/index.stories.js +3 -5
  53. package/ui.form-textarea/index.vue +35 -4
  54. package/ui.loader/composables/attrs.composable.js +34 -37
  55. package/ui.loader/index.vue +1 -1
  56. package/ui.loader-rendering/composables/attrs.composable.js +27 -19
  57. package/ui.loader-rendering/configs/default.config.js +1 -0
  58. package/ui.loader-rendering/index.vue +8 -3
  59. package/ui.loader-top/composables/attrs.composable.js +28 -19
  60. package/ui.loader-top/index.vue +1 -1
  61. package/ui.navigation-pagination/composables/attrs.composable.js +41 -31
  62. package/ui.navigation-pagination/configs/default.config.js +2 -2
  63. package/ui.navigation-pagination/index.vue +22 -6
  64. package/ui.navigation-progress/components/StepperProgress.vue +1 -1
  65. package/ui.navigation-progress/composables/attrs.composable.js +19 -22
  66. package/ui.navigation-progress/index.vue +14 -1
  67. package/ui.navigation-tab/composables/attrs.composable.js +25 -20
  68. package/ui.navigation-tab/index.vue +1 -1
  69. package/ui.navigation-tabs/composables/attrs.composable.js +19 -13
  70. package/ui.navigation-tabs/configs/default.config.js +1 -1
  71. package/ui.navigation-tabs/index.vue +9 -2
  72. package/ui.other-dot/composables/attrs.composable.js +28 -20
  73. package/ui.other-dot/index.vue +1 -1
  74. package/ui.text-file/configs/default.config.js +3 -0
  75. package/ui.text-file/index.vue +36 -25
  76. package/ui.text-files/index.vue +8 -0
  77. package/ui.text-header/configs/default.config.js +1 -0
  78. package/ui.text-header/index.stories.js +2 -2
  79. package/ui.text-header/index.vue +16 -12
  80. package/web-types.json +383 -62
@@ -4,45 +4,42 @@ 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) {
7
+ export default function useAttrs(props) {
8
8
  const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
9
9
  defaultConfig,
10
10
  () => props.config,
11
11
  );
12
+
12
13
  const attrs = {};
13
14
 
14
15
  for (const key in defaultConfig) {
15
16
  if (isSystemKey(key)) continue;
16
17
 
17
- let classes = "";
18
- let value = config.value[key];
19
-
20
- const isVariants = value.variants || value.compoundVariants;
21
- const excludeKeys = ["progress", "indicator", "step"];
18
+ const classes = computed(() => {
19
+ const value = config.value[key];
22
20
 
23
- if (isVariants && !excludeKeys.includes(key)) {
24
- const getCVA = cva(value);
21
+ if (value.variants || value.compoundVariants) {
22
+ return setColor(
23
+ cva(value)({
24
+ ...props,
25
+ color: getColor(props.color),
26
+ }),
27
+ props.color,
28
+ );
29
+ }
25
30
 
26
- classes = computed(() => getCVA({ ...props }));
27
- }
31
+ return "";
32
+ });
28
33
 
29
- if (isVariants && excludeKeys.includes(key)) {
30
- const getCVA = cva(value);
31
-
32
- classes = computed(() =>
33
- setColor(getCVA({ ...props, color: getColor(props.color) }), props.color),
34
- );
35
- }
34
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
36
35
 
37
36
  if (key === "step") {
38
- const stepAttrsRaw = getAttrs("step", { classes });
37
+ const stepAttrs = attrs[`${key}Attrs`];
39
38
 
40
39
  attrs[`${key}Attrs`] = computed(() => (classes) => ({
41
- ...stepAttrsRaw.value,
42
- class: cx([stepAttrsRaw.value.class, classes]),
40
+ ...stepAttrs,
41
+ class: cx([stepAttrs.value.class, classes]),
43
42
  }));
44
- } else {
45
- attrs[`${key}Attrs`] = getAttrs(key, { classes });
46
43
  }
47
44
  }
48
45
 
@@ -2,6 +2,12 @@
2
2
  <div v-bind="wrapperAttrs">
3
3
  <template v-if="isVariant.progress">
4
4
  <div v-if="indicator" v-bind="indicatorAttrs" :style="{ width: progressPercent }">
5
+ <!--
6
+ @slot Use it to add something instead of the progress indicator.
7
+ @binding {number} percent
8
+ @binding {number} value
9
+ @binding {number} max
10
+ -->
5
11
  <slot name="indicator" :percent="progressPercent" :value="value" :max="realMax">
6
12
  {{ progressPercent }}
7
13
  </slot>
@@ -12,6 +18,13 @@
12
18
 
13
19
  <div v-if="isSteps" v-bind="stepAttrs(!value && config.firstStep)">
14
20
  <template v-for="(step, index) in max" :key="index">
21
+ <!--
22
+ @slot Use it to add something instead of the progress step label.
23
+ @binding {string} name
24
+ @binding {number} step
25
+ @binding {number} value
26
+ @binding {number} max
27
+ -->
15
28
  <slot
16
29
  v-if="isActiveStep(index)"
17
30
  :name="`step-${index}`"
@@ -40,7 +53,7 @@
40
53
  import { computed } from "vue";
41
54
 
42
55
  import UIService from "../service.ui";
43
- import { useAttrs } from "./composables/attrs.composable";
56
+ import useAttrs from "./composables/attrs.composable";
44
57
 
45
58
  import defaultConfig from "./configs/default.config";
46
59
  import { UProgress, VARIANT } from "./constants";
@@ -4,27 +4,32 @@ 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, { selected, size }) {
8
- const { config, getAttrs } = 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
- disabled: props.disabled,
20
- size: size.value,
21
- selected: selected.value,
22
- }),
23
- );
24
-
25
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
7
+ export default function useAttrs(props, { selected, size }) {
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
+ size: size.value,
21
+ selected: selected.value,
22
+ });
23
+ }
24
+
25
+ return "";
26
+ });
27
+
28
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
29
+ }
26
30
 
27
31
  return {
28
- wrapperAttrs,
32
+ ...attrs,
33
+ config,
29
34
  };
30
35
  }
@@ -14,7 +14,7 @@ import UIService from "../service.ui";
14
14
 
15
15
  import { UTab } from "./constants";
16
16
  import defaultConfig from "./configs/default.config";
17
- import { useAttrs } from "./composables/attrs.composable";
17
+ import useAttrs from "./composables/attrs.composable";
18
18
 
19
19
  /* Should be a string for correct web-types gen */
20
20
  defineOptions({ name: "UTab", inheritAttrs: false });
@@ -4,24 +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 { 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(() => cvaWrapper({ underlined: props.underlined }));
14
+ const classes = computed(() => {
15
+ const value = config.value[key];
18
16
 
19
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
17
+ if (value.variants || value.compoundVariants) {
18
+ return cva(value)({
19
+ ...props,
20
+ });
21
+ }
20
22
 
21
- const tabAttrs = getAttrs("tab", { isComponent: true });
23
+ return "";
24
+ });
25
+
26
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
27
+ }
22
28
 
23
29
  return {
24
- wrapperAttrs,
25
- tabAttrs,
30
+ ...attrs,
31
+ config,
26
32
  };
27
33
  }
@@ -7,7 +7,7 @@ export default /*tw*/ {
7
7
  },
8
8
  },
9
9
  },
10
- tab: "",
10
+ tab: "{UTab}",
11
11
  defaultVariants: {
12
12
  size: "md",
13
13
  underlined: false,
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <div :data-cy="dataCy" v-bind="wrapperAttrs">
3
+ <!-- @slot Use it to add the UTab component. -->
3
4
  <slot>
4
5
  <UTab
5
6
  v-for="(item, index) in options"
@@ -23,7 +24,7 @@ import UIService from "../service.ui";
23
24
 
24
25
  import { UTabs } from "./constants";
25
26
  import defaultConfig from "./configs/default.config";
26
- import { useAttrs } from "./composables/attrs.composable";
27
+ import useAttrs from "./composables/attrs.composable";
27
28
 
28
29
  /* Should be a string for correct web-types gen */
29
30
  defineOptions({ name: "UTabs", inheritAttrs: false });
@@ -85,7 +86,13 @@ const props = defineProps({
85
86
  },
86
87
  });
87
88
 
88
- const emit = defineEmits(["update:modelValue"]);
89
+ const emit = defineEmits([
90
+ /**
91
+ * Triggers when the selected tab changes.
92
+ * @property {string} modelValue
93
+ */
94
+ "update:modelValue",
95
+ ]);
89
96
 
90
97
  const selectedItem = computed({
91
98
  get: () => props.modelValue,
@@ -4,29 +4,37 @@ 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, getColor, setColor } = 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
- setColor(
19
- cvaWrapper({
20
- size: props.size,
21
- color: getColor(props.color),
22
- }),
23
- props.color,
24
- ),
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
25
11
  );
12
+ const attrs = {};
26
13
 
27
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
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 setColor(
22
+ cva(value)({
23
+ ...props,
24
+ color: getColor(props.color),
25
+ }),
26
+ props.color,
27
+ );
28
+ }
29
+
30
+ return "";
31
+ });
32
+
33
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
34
+ }
28
35
 
29
36
  return {
30
- wrapperAttrs,
37
+ ...attrs,
38
+ config,
31
39
  };
32
40
  }
@@ -7,7 +7,7 @@ import UIService from "../service.ui";
7
7
 
8
8
  import { UDot } from "./constants";
9
9
  import defaultConfig from "./configs/default.config";
10
- import { useAttrs } from "./composables/attrs.composable";
10
+ import useAttrs from "./composables/attrs.composable";
11
11
 
12
12
  /* Should be a string for correct web-types gen */
13
13
  defineOptions({ name: "UDot", inheritAttrs: false });
@@ -17,4 +17,7 @@ export default /*tw*/ {
17
17
  },
18
18
  },
19
19
  },
20
+ defaultVariants: {
21
+ size: "md",
22
+ },
20
23
  };
@@ -2,22 +2,25 @@
2
2
  <ULink :url="url" no-ring target-blank :data-cy="dataCy" v-bind="fileAttrs">
3
3
  <slot name="left" :file="{ id, label, url, imageUrl }" />
4
4
 
5
- <div v-bind="infoAttrs">
6
- <img v-if="imageUrl" :src="imageUrl" v-bind="imageAttrs" />
7
-
8
- <UIcon
9
- v-else
10
- internal
11
- interactive
12
- color="gray"
13
- :name="config.iconName"
14
- v-bind="iconAttrs"
15
- @focus="onFocus"
16
- @blur="onBlur"
17
- />
18
-
19
- <span v-bind="labelAttrs" v-text="label" />
20
- </div>
5
+ <slot :file="{ id, label, url, imageUrl, iconName: config.iconName }">
6
+ <div v-bind="infoAttrs">
7
+ <img v-if="imageUrl" :src="imageUrl" v-bind="imageAttrs" />
8
+
9
+ <UIcon
10
+ v-else
11
+ internal
12
+ interactive
13
+ color="gray"
14
+ :size="size"
15
+ :name="config.iconName"
16
+ v-bind="iconAttrs"
17
+ @focus="onFocus"
18
+ @blur="onBlur"
19
+ />
20
+
21
+ <span v-bind="labelAttrs" v-text="label" />
22
+ </div>
23
+ </slot>
21
24
 
22
25
  <slot name="right" :file="{ id, label, url, imageUrl }" />
23
26
  </ULink>
@@ -40,7 +43,7 @@ defineOptions({ name: "UFile", inheritAttrs: false });
40
43
 
41
44
  const props = defineProps({
42
45
  /**
43
- * Set url link for the file.
46
+ * File url.
44
47
  */
45
48
  url: {
46
49
  type: String,
@@ -48,7 +51,7 @@ const props = defineProps({
48
51
  },
49
52
 
50
53
  /**
51
- * Set image url.
54
+ * Image url.
52
55
  */
53
56
  imageUrl: {
54
57
  type: String,
@@ -56,13 +59,22 @@ const props = defineProps({
56
59
  },
57
60
 
58
61
  /**
59
- * Set label.
62
+ * File label.
60
63
  */
61
64
  label: {
62
65
  type: String,
63
66
  default: "",
64
67
  },
65
68
 
69
+ /**
70
+ * File size.
71
+ * @values sm, md, lg
72
+ */
73
+ size: {
74
+ type: String,
75
+ default: UIService.get(defaultConfig, UFile).default.size,
76
+ },
77
+
66
78
  /**
67
79
  * Generates unique element id.
68
80
  * @ignore
@@ -73,16 +85,15 @@ const props = defineProps({
73
85
  },
74
86
 
75
87
  /**
76
- * Set size.
77
- * @values sm, md, lg
88
+ * Component ui config object.
78
89
  */
79
- size: {
80
- type: String,
81
- default: UIService.get(defaultConfig, UFile).default.size,
90
+ config: {
91
+ type: Object,
92
+ default: () => ({}),
82
93
  },
83
94
 
84
95
  /**
85
- * Sets data-cy attribute for automated testing.
96
+ * Data-cy attribute for automated testing.
86
97
  */
87
98
  dataCy: {
88
99
  type: String,
@@ -88,6 +88,14 @@ const props = defineProps({
88
88
  default: UIService.get(defaultConfig, UFiles).default.size,
89
89
  },
90
90
 
91
+ /**
92
+ * Component ui config object.
93
+ */
94
+ config: {
95
+ type: Object,
96
+ default: () => ({}),
97
+ },
98
+
91
99
  /**
92
100
  * Sets data-cy attribute for automated testing.
93
101
  */
@@ -42,6 +42,7 @@ export default /*tw*/ {
42
42
  color: "grayscale",
43
43
  weight: "medium",
44
44
  size: "md",
45
+ tag: "div",
45
46
  multiline: false,
46
47
  underlined: false,
47
48
  },
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames } from "../service.storybook";
1
+ import { allSlotsFragment, getArgTypes, getSlotNames } from "../service.storybook";
2
2
 
3
3
  import UHeader from "../ui.text-header";
4
4
  import UGroup from "../ui.container-group";
@@ -26,7 +26,7 @@ const DefaultTemplate = (args) => ({
26
26
  return { args, slots };
27
27
  },
28
28
  template: `
29
- <UHeader v-bind="args" />
29
+ <UHeader v-bind="args">${allSlotsFragment}</UHeader>
30
30
  `,
31
31
  });
32
32
 
@@ -1,11 +1,7 @@
1
1
  <template>
2
- <div :data-cy="dataCy" v-bind="wrapperAttrs">
3
- <template v-if="label">
4
- {{ label }}
5
- </template>
6
-
7
- <slot />
8
- </div>
2
+ <component :is="tag" v-bind="wrapperAttrs" :data-cy="dataCy">
3
+ <slot>{{ label }}</slot>
4
+ </component>
9
5
  </template>
10
6
 
11
7
  <script setup>
@@ -20,7 +16,7 @@ defineOptions({ name: "UHeader", inheritAttrs: false });
20
16
 
21
17
  const props = defineProps({
22
18
  /**
23
- * Set label.
19
+ * Header label.
24
20
  */
25
21
  label: {
26
22
  type: String,
@@ -28,7 +24,7 @@ const props = defineProps({
28
24
  },
29
25
 
30
26
  /**
31
- * Set size.
27
+ * Header size.
32
28
  * @values xs, sm, md, lg, xl, 2xl
33
29
  */
34
30
  size: {
@@ -37,7 +33,7 @@ const props = defineProps({
37
33
  },
38
34
 
39
35
  /**
40
- * Set weight.
36
+ * Header weight.
41
37
  * @values regular, medium, bold
42
38
  */
43
39
  weight: {
@@ -54,6 +50,14 @@ const props = defineProps({
54
50
  default: UIService.get(defaultConfig, UHeader).default.color,
55
51
  },
56
52
 
53
+ /**
54
+ * Allows changing button html tag.
55
+ */
56
+ tag: {
57
+ type: String,
58
+ default: UIService.get(defaultConfig, UHeader).default.tag,
59
+ },
60
+
57
61
  /**
58
62
  * Return default line height to the component (it may be useful for multiline headers).
59
63
  */
@@ -71,7 +75,7 @@ const props = defineProps({
71
75
  },
72
76
 
73
77
  /**
74
- * Sets component ui config object.
78
+ * Component ui config object.
75
79
  */
76
80
  config: {
77
81
  type: Object,
@@ -79,7 +83,7 @@ const props = defineProps({
79
83
  },
80
84
 
81
85
  /**
82
- * Sets data-cy attribute for automated testing.
86
+ * Data-cy attribute for automated testing.
83
87
  */
84
88
  dataCy: {
85
89
  type: String,