vueless 0.0.210 → 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 (71) 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.navigation-pagination/composables/attrs.composable.js +41 -31
  55. package/ui.navigation-pagination/configs/default.config.js +2 -2
  56. package/ui.navigation-pagination/index.vue +22 -6
  57. package/ui.navigation-progress/components/StepperProgress.vue +1 -1
  58. package/ui.navigation-progress/composables/attrs.composable.js +19 -22
  59. package/ui.navigation-progress/index.vue +14 -1
  60. package/ui.navigation-tab/composables/attrs.composable.js +25 -20
  61. package/ui.navigation-tab/index.vue +1 -1
  62. package/ui.navigation-tabs/composables/attrs.composable.js +19 -13
  63. package/ui.navigation-tabs/configs/default.config.js +1 -1
  64. package/ui.navigation-tabs/index.vue +9 -2
  65. package/ui.text-file/configs/default.config.js +3 -0
  66. package/ui.text-file/index.vue +36 -25
  67. package/ui.text-files/index.vue +8 -0
  68. package/ui.text-header/configs/default.config.js +1 -0
  69. package/ui.text-header/index.stories.js +2 -2
  70. package/ui.text-header/index.vue +16 -12
  71. package/web-types.json +383 -62
@@ -4,54 +4,39 @@ import { cva } from "../../service.ui";
4
4
 
5
5
  import defaultConfig from "../configs/default.config";
6
6
 
7
- export function useAttrs(props, { checkboxColor, checkboxSize }) {
8
- const { config, getAttrs, getColor, setColor } = useUI(defaultConfig, () => props.config);
9
- const { checkbox, iconWrapper } = config.value;
10
-
11
- const cvaCheckbox = cva({
12
- base: checkbox.base,
13
- variants: checkbox.variants,
14
- compoundVariants: checkbox.compoundVariants,
15
- });
16
-
17
- const cvaIconWrapper = cva({
18
- base: iconWrapper.base,
19
- variants: iconWrapper.variants,
20
- compoundVariants: iconWrapper.compoundVariants,
21
- });
22
-
23
- const checkboxClasses = computed(() =>
24
- setColor(
25
- cvaCheckbox({
26
- size: checkboxSize.value,
27
- label: Boolean(props.label),
28
- color: getColor(checkboxColor.value),
29
- disabled: props.disabled,
30
- }),
31
- checkboxColor.value,
32
- ),
7
+ export default function useAttrs(props, { checkboxColor, checkboxSize }) {
8
+ const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
33
11
  );
12
+ const attrs = {};
34
13
 
35
- const iconWrapperClasses = computed(() =>
36
- setColor(
37
- cvaIconWrapper({
38
- size: checkboxSize.value,
39
- color: getColor(checkboxColor.value),
40
- }),
41
- checkboxColor.value,
42
- ),
43
- );
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
+ size: checkboxSize.value,
25
+ label: Boolean(props.label),
26
+ color: getColor(checkboxColor.value),
27
+ }),
28
+ checkboxColor.value,
29
+ );
30
+ }
31
+
32
+ return "";
33
+ });
44
34
 
45
- const labelAttrs = getAttrs("label", { isComponent: true });
46
- const iconWrapperCellAttrs = getAttrs("iconWrapper", { classes: iconWrapperClasses });
47
- const iconAttrs = getAttrs("icon", { isComponent: true });
48
- const checkboxAttrs = getAttrs("checkbox", { classes: checkboxClasses });
35
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
36
+ }
49
37
 
50
38
  return {
39
+ ...attrs,
51
40
  config,
52
- checkboxAttrs,
53
- iconWrapperCellAttrs,
54
- labelAttrs,
55
- iconAttrs,
56
41
  };
57
42
  }
@@ -1,5 +1,5 @@
1
1
  export default /*tw*/ {
2
- label: "w-auto max-w-max relative", // TODO: label classes should be defined in ULabel component
2
+ label: "{ULabel} w-auto max-w-max relative", // TODO: label classes should be defined in ULabel component
3
3
  partialIconName: "remove",
4
4
  selectedIconName: "check",
5
5
  iconWrapper: {
@@ -17,7 +17,7 @@ export default /*tw*/ {
17
17
  },
18
18
  },
19
19
  },
20
- icon: "",
20
+ icon: "{UIcon}",
21
21
  checkbox: {
22
22
  base: `
23
23
  border border-solid rounded border-gray-300 bg-white hover:transition
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UCheckbox from "../ui.form-checkbox";
4
4
  import UCheckboxGroup from "../ui.form-checkbox-group";
@@ -30,9 +30,7 @@ const DefaultTemplate = (args) => ({
30
30
  },
31
31
  template: `
32
32
  <UCheckbox v-bind="args" v-model="args.value">
33
- <template v-for="(slot, index) of slots" :key="index" v-slot:[slot]>
34
- <template v-if="args[slot]">{{ args[slot] }}</template>
35
- </template>
33
+ ${allSlotsFragment}
36
34
  </UCheckbox>
37
35
  `,
38
36
  });
@@ -22,7 +22,7 @@
22
22
  @change="onChange"
23
23
  />
24
24
 
25
- <label v-if="isChecked" v-bind="iconWrapperCellAttrs" :for="id">
25
+ <label v-if="isChecked" v-bind="iconWrapperAttrs" :for="id">
26
26
  <UIcon
27
27
  internal
28
28
  :name="partial ? config.partialIconName : config.selectedIconName"
@@ -49,7 +49,7 @@ import UIService, { getRandomId } from "../service.ui";
49
49
 
50
50
  import defaultConfig from "./configs/default.config";
51
51
  import { UCheckbox } from "./constants";
52
- import { useAttrs } from "./composables/attrs.composable";
52
+ import useAttrs from "./composables/attrs.composable";
53
53
 
54
54
  /* Should be a string for correct web-types gen */
55
55
  defineOptions({ name: "UCheckbox", inheritAttrs: false });
@@ -186,13 +186,25 @@ const props = defineProps({
186
186
  },
187
187
  });
188
188
 
189
- const emit = defineEmits(["update:modelValue", "input"]);
189
+ const emit = defineEmits([
190
+ /**
191
+ * Triggers when checkbox is toggled.
192
+ * @property {Boolean} newModelValue
193
+ */
194
+ "update:modelValue",
195
+
196
+ /**
197
+ * Triggers when checkbox is toggled.
198
+ * @property {Boolean} newModelValue
199
+ */
200
+ "input",
201
+ ]);
190
202
 
191
203
  const checkboxName = ref("");
192
204
  const checkboxSize = ref(props.size);
193
205
  const checkboxColor = ref(props.color);
194
206
 
195
- const { config, checkboxAttrs, iconWrapperCellAttrs, labelAttrs, iconAttrs } = useAttrs(props, {
207
+ const { config, checkboxAttrs, iconWrapperAttrs, labelAttrs, iconAttrs } = useAttrs(props, {
196
208
  checkboxColor,
197
209
  checkboxSize,
198
210
  });
@@ -1,17 +1,32 @@
1
1
  import useUI from "../../composable.ui";
2
-
2
+ import { computed } from "vue";
3
+ import { cva } from "../../service.ui";
3
4
  import defaultConfig from "../configs/default.config";
4
5
 
5
- export function useAttrs(props) {
6
- const { getAttrs } = useUI(defaultConfig, () => props.config);
6
+ export default function useAttrs(props) {
7
+ const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
8
+ const attrs = {};
9
+
10
+ for (const key in defaultConfig) {
11
+ if (isSystemKey(key)) continue;
12
+
13
+ const classes = computed(() => {
14
+ const value = config.value[key];
15
+
16
+ if (value.variants || value.compoundVariants) {
17
+ return cva(value)({
18
+ ...props,
19
+ });
20
+ }
21
+
22
+ return "";
23
+ });
7
24
 
8
- const labelAttrs = getAttrs("label", { isComponent: true });
9
- const listAttrs = getAttrs("list");
10
- const checkboxAttrs = getAttrs("checkbox", { isComponent: true });
25
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
26
+ }
11
27
 
12
28
  return {
13
- labelAttrs,
14
- checkboxAttrs,
15
- listAttrs,
29
+ ...attrs,
30
+ config,
16
31
  };
17
32
  }
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
- label: "",
2
+ label: "{ULabel}",
3
3
  list: "ml-4 flex flex-col gap-4 relative",
4
- checkbox: "",
4
+ checkbox: "{UCheckbox}",
5
5
  defaultVariants: {
6
6
  color: "brand",
7
7
  size: "md",
@@ -40,7 +40,7 @@ import UCheckbox from "../ui.form-checkbox";
40
40
 
41
41
  import { UCheckboxGroup } from "./constants";
42
42
  import defaultConfig from "./configs/default.config";
43
- import { useAttrs } from "./composables/attrs.composable";
43
+ import useAttrs from "./composables/attrs.composable";
44
44
 
45
45
  /* Should be a string for correct web-types gen */
46
46
  defineOptions({ name: "UCheckboxGroup", inheritAttrs: false });
@@ -137,7 +137,13 @@ const props = defineProps({
137
137
  },
138
138
  });
139
139
 
140
- const emit = defineEmits(["update:modelValue"]);
140
+ const emit = defineEmits([
141
+ /**
142
+ * Triggers when checkbox value changes.
143
+ * @property {object} value
144
+ */
145
+ "update:modelValue",
146
+ ]);
141
147
 
142
148
  const checkedItems = ref([]);
143
149
 
@@ -1,24 +1,46 @@
1
1
  import useUI from "../../composable.ui";
2
-
2
+ import { cva } from "../../service.ui";
3
3
  import defaultConfig from "../configs/default.config";
4
4
  import { computed } from "vue";
5
5
 
6
- export function useAttrs(props, { selected }) {
7
- const { getAttrs } = useUI(defaultConfig, () => props.config);
6
+ export default function useAttrs(props, { selected }) {
7
+ const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
8
+ const attrs = {};
8
9
 
9
- const checkboxAttrsRaw = getAttrs("checkbox", { isComponent: true });
10
+ for (const key in defaultConfig) {
11
+ if (isSystemKey(key)) continue;
10
12
 
11
- const checkboxAttrs = computed(() => {
12
- if (!checkboxAttrsRaw.value.config) {
13
- checkboxAttrsRaw.value.config = {};
14
- }
13
+ const classes = computed(() => {
14
+ const value = config.value[key];
15
+
16
+ if (value.variants || value.compoundVariants) {
17
+ return cva(value)({
18
+ ...props,
19
+ });
20
+ }
21
+
22
+ return "";
23
+ });
15
24
 
16
- checkboxAttrsRaw.value.config.selectedIconName = selected.value.icon;
25
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
17
26
 
18
- return checkboxAttrsRaw.value;
19
- });
27
+ if (key === "checkbox") {
28
+ const checkboxAttrs = attrs[`${key}Attrs`];
29
+
30
+ attrs[`${key}Attrs`] = computed(() => {
31
+ if (!checkboxAttrs.value.config) {
32
+ checkboxAttrs.value.config = {};
33
+ }
34
+
35
+ checkboxAttrs.value.config.selectedIconName = selected.value.icon;
36
+
37
+ return checkboxAttrs.value;
38
+ });
39
+ }
40
+ }
20
41
 
21
42
  return {
22
- checkboxAttrs,
43
+ ...attrs,
44
+ config,
23
45
  };
24
46
  }
@@ -1,5 +1,5 @@
1
1
  export default /*tw*/ {
2
- checkbox: "",
2
+ checkbox: "{UCheckbox}",
3
3
  defaultVariants: {
4
4
  color: "brand",
5
5
  size: "md",
@@ -20,7 +20,7 @@ import UCheckbox from "../ui.form-checkbox";
20
20
 
21
21
  import defaultConfig from "./configs/default.config";
22
22
  import { UCheckboxMultiState } from "./constants";
23
- import { useAttrs } from "./composables/attrs.composable";
23
+ import useAttrs from "./composables/attrs.composable";
24
24
 
25
25
  /* Should be a string for correct web-types gen */
26
26
  defineOptions({ name: "UCheckboxMultiState", inheritAttrs: false });
@@ -102,7 +102,13 @@ const props = defineProps({
102
102
  },
103
103
  });
104
104
 
105
- const emit = defineEmits(["update:modelValue"]);
105
+ const emit = defineEmits([
106
+ /**
107
+ * Triggers when checkbox value changes.
108
+ * @property {number} value
109
+ */
110
+ "update:modelValue",
111
+ ]);
106
112
 
107
113
  const index = ref(0);
108
114
  const isChecked = ref(false);
@@ -4,75 +4,32 @@ import { cva } from "../../service.ui";
4
4
 
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 { dropzoneWrapper, placeholder, contentWrapper } = config.value;
7
+ export default function useAttrs(props) {
8
+ const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
9
+ const attrs = {};
10
10
 
11
- const cvaDropzoneWrapper = cva({
12
- base: dropzoneWrapper.base,
13
- variants: dropzoneWrapper.variants,
14
- compoundVariants: dropzoneWrapper.compoundVariants,
15
- });
11
+ for (const key in defaultConfig) {
12
+ if (isSystemKey(key)) continue;
16
13
 
17
- const cvaPlaceholder = cva({
18
- base: placeholder.base,
19
- variants: placeholder.variants,
20
- compoundVariants: placeholder.compoundVariants,
21
- });
14
+ const classes = computed(() => {
15
+ const value = config.value[key];
22
16
 
23
- const cvaContentWrapper = cva({
24
- base: contentWrapper.base,
25
- variants: contentWrapper.variants,
26
- compoundVariants: contentWrapper.compoundVariants,
27
- });
17
+ if (value.variants || value.compoundVariants) {
18
+ return cva(value)({
19
+ ...props,
20
+ error: Boolean(props.error),
21
+ label: Boolean(props.label),
22
+ });
23
+ }
28
24
 
29
- const dropzoneWrapperClasses = computed(() =>
30
- cvaDropzoneWrapper({
31
- error: Boolean(props.error),
32
- label: Boolean(props.label),
33
- labelAlign: props.labelAlign,
34
- size: props.size,
35
- }),
36
- );
25
+ return "";
26
+ });
37
27
 
38
- const placeholderClasses = computed(() =>
39
- cvaPlaceholder({
40
- size: props.size,
41
- }),
42
- );
43
-
44
- const contentWrapperClasses = computed(() =>
45
- cvaContentWrapper({
46
- multiple: props.multiple,
47
- }),
48
- );
49
-
50
- const labelAttrs = getAttrs("label", { isComponent: true });
51
- const buttonAttrs = getAttrs("button", { isComponent: true });
52
- const dropzoneWrapperAttrs = getAttrs("dropzoneWrapper", { classes: dropzoneWrapperClasses });
53
- const descriptionAttrs = getAttrs("description", { isComponent: true });
54
- const buttonWrapperAttrs = getAttrs("buttonWrapper");
55
- const placeholderAttrs = getAttrs("placeholder", { classes: placeholderClasses });
56
- const clearIconAttrs = getAttrs("clearIcon", { isComponent: true });
57
- const removeItemIconAttrs = getAttrs("removeItemIcon", { isComponent: true });
58
- const chooseFileIconAttrs = getAttrs("chooseFileIcon", { isComponent: true });
59
- const inputAttrs = getAttrs("input");
60
- const fileListAttrs = getAttrs("fileList", { isComponent: true });
61
- const contentWrapperAttrs = getAttrs("contentWrapper", { classes: contentWrapperClasses });
28
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
29
+ }
62
30
 
63
31
  return {
32
+ ...attrs,
64
33
  config,
65
- inputAttrs,
66
- labelAttrs,
67
- buttonAttrs,
68
- dropzoneWrapperAttrs,
69
- descriptionAttrs,
70
- contentWrapperAttrs,
71
- clearIconAttrs,
72
- placeholderAttrs,
73
- fileListAttrs,
74
- buttonWrapperAttrs,
75
- chooseFileIconAttrs,
76
- removeItemIconAttrs,
77
34
  };
78
35
  }
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  label: {
3
- wrapper: "relative w-full",
3
+ wrapper: "{ULabel} relative w-full",
4
4
  label: {
5
5
  compoundVariants: [
6
6
  { align: "topInside", size: "sm", class: "left-5 top-4" },
@@ -25,7 +25,7 @@ export default /*tw*/ {
25
25
  { labelAlign: "topInside", label: true, size: "lg", class: "pt-12" },
26
26
  ],
27
27
  },
28
- description: "text-gray-700",
28
+ description: "{UText} text-gray-700",
29
29
  contentWrapper: {
30
30
  base: "relative mt-3 flex w-full gap-6 justify-between items-start rounded bg-brand-50 p-3",
31
31
  variants: {
@@ -44,18 +44,18 @@ export default /*tw*/ {
44
44
  },
45
45
  },
46
46
  },
47
- button: "hover:cursor-pointer",
48
- chooseFileIcon: "",
47
+ button: "{UButton} hover:cursor-pointer",
48
+ chooseFileIcon: "{UIcon}",
49
49
  chooseFileIconName: "attach_file",
50
- clearIcon: "",
50
+ clearIcon: "{UIcon}",
51
51
  clearIconName: "close",
52
- removeItemIcon: "ml-2",
52
+ removeItemIcon: "{UIcon} ml-2",
53
53
  removeItemIconName: "close",
54
54
  dropzoneWrapperHover: "border-gray-400 border-dashed",
55
55
  dropzoneWrapperError: "hover:border-red-400 border-dashed border-red-300",
56
56
  input: "sr-only pointer-events-none size-0 opacity-0",
57
57
  buttonWrapper: "flex gap-4 items-center",
58
- fileList: "w-full",
58
+ fileList: "{UFiles} w-full",
59
59
  i18n: {
60
60
  sizeError: "File size is too big.",
61
61
  formatError: "Format is not supported.",
@@ -4,7 +4,7 @@
4
4
  <UText :size="nestedComponentSize" :html="description" v-bind="descriptionAttrs" />
5
5
 
6
6
  <div v-bind="contentWrapperAttrs">
7
- <!-- @slot Use it to add something before placeholder. -->
7
+ <!-- @slot Use it to add something before the placeholder. -->
8
8
  <slot name="left" />
9
9
 
10
10
  <span v-if="!isValue" v-bind="placeholderAttrs" v-text="currentLocale.noFile" />
@@ -88,7 +88,7 @@ import UFiles from "../ui.text-files";
88
88
  import UIService, { getRandomId } from "../service.ui";
89
89
  import { getFileMbSize } from "./services/fileForm.service";
90
90
 
91
- import { useAttrs } from "./composables/attrs.composable";
91
+ import useAttrs from "./composables/attrs.composable";
92
92
  import { useLocale } from "../composable.locale";
93
93
 
94
94
  import { UInputFile } from "./constants";
@@ -194,7 +194,19 @@ const props = defineProps({
194
194
  },
195
195
  });
196
196
 
197
- const emit = defineEmits(["update:modelValue", "update:error"]);
197
+ const emit = defineEmits([
198
+ /**
199
+ * Triggers when a file is updated.
200
+ * @property {array} value
201
+ */
202
+ "update:modelValue",
203
+
204
+ /**
205
+ * Triggers when the input has not passed validation.
206
+ * @property {string} value
207
+ */
208
+ "update:error",
209
+ ]);
198
210
 
199
211
  const { tm } = useLocale();
200
212
 
@@ -1,13 +1,32 @@
1
1
  import useUI from "../../composable.ui";
2
-
2
+ import { computed } from "vue";
3
+ import { cva } from "../../service.ui";
3
4
  import defaultConfig from "../configs/default.config";
4
5
 
5
6
  export default function useAttrs(props) {
6
- const { getAttrs } = useUI(defaultConfig, () => props.config);
7
+ const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
8
+ const attrs = {};
9
+
10
+ for (const key in defaultConfig) {
11
+ if (isSystemKey(key)) continue;
12
+
13
+ const classes = computed(() => {
14
+ const value = config.value[key];
15
+
16
+ if (value.variants || value.compoundVariants) {
17
+ return cva(value)({
18
+ ...props,
19
+ });
20
+ }
21
+
22
+ return "";
23
+ });
7
24
 
8
- const inputAttrs = getAttrs("input", { isComponent: true });
25
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
26
+ }
9
27
 
10
28
  return {
11
- inputAttrs,
29
+ ...attrs,
30
+ config,
12
31
  };
13
32
  }
@@ -1,5 +1,5 @@
1
1
  export default /*tw*/ {
2
- input: "",
2
+ input: "{UInput}",
3
3
  defaultVariants: {
4
4
  symbol: "$",
5
5
  size: "md",
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UInputMoney from "../ui.form-input-money";
4
4
  import URow from "../ui.container-row";
@@ -32,9 +32,7 @@ const DefaultTemplate = (args) => ({
32
32
  v-bind="args"
33
33
  v-model="args.inputValue"
34
34
  >
35
- <template v-for="(slot, index) of slots" :key="index" v-slot:[slot]>
36
- <template v-if="args[slot]">{{ args[slot] }}</template>
37
- </template>
35
+ ${allSlotsFragment}
38
36
  </UInputMoney>
39
37
  `,
40
38
  });
@@ -4,44 +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 { value, text } = config.value;
10
-
11
- const cvaValue = cva({
12
- base: value.base,
13
- variants: value.variants,
14
- compoundVariants: value.compoundVariants,
15
- });
16
-
17
- const cvaText = cva({
18
- base: text.base,
19
- variants: text.variants,
20
- compoundVariants: text.compoundVariants,
21
- });
22
-
23
- const textClasses = computed(() => cvaText({ size: props.size }));
24
-
25
- const valueClasses = computed(() => cvaValue({ size: props.size }));
26
-
27
- const wrapperAttrs = getAttrs("wrapper");
28
- const numberAttrs = getAttrs("number");
29
- const removeButtonAttrs = getAttrs("removeButton", { isComponent: true });
30
- const removeIconAttrs = getAttrs("removeIcon", { isComponent: true });
31
- const addButtonAttrs = getAttrs("addButton", { isComponent: true });
32
- const addIconAttrs = getAttrs("addIcon", { isComponent: true });
33
- const valueAttrs = getAttrs("value", { classes: valueClasses });
34
- const textAttrs = getAttrs("text", { classes: textClasses });
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
+ }
35
28
 
36
29
  return {
30
+ ...attrs,
37
31
  config,
38
- valueAttrs,
39
- textAttrs,
40
- removeButtonAttrs,
41
- removeIconAttrs,
42
- addButtonAttrs,
43
- addIconAttrs,
44
- wrapperAttrs,
45
- numberAttrs,
46
32
  };
47
33
  }
@@ -1,11 +1,11 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "flex items-center space-x-6",
3
3
  number: "flex items-center flex-col",
4
- removeButton: "",
5
- removeIcon: "",
4
+ removeButton: "{UButton}",
5
+ removeIcon: "{UIcon}",
6
6
  removeIconName: "remove",
7
- addButton: "",
8
- addIcon: "",
7
+ addButton: "{UButton}",
8
+ addIcon: "{UIcon}",
9
9
  addIconName: "add",
10
10
  value: {
11
11
  base: "font-bold select-none !leading-none",