vueless 0.0.210 → 0.0.212

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 +3 -3
  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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.210",
3
+ "version": "0.0.212",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -37,8 +37,8 @@
37
37
  "@release-it/bumper": "^6.0.1",
38
38
  "@vitejs/plugin-vue": "^5.0.5",
39
39
  "@vue/eslint-config-prettier": "^9.0.0",
40
- "@vueless/plugin-vite": "^0.0.36",
41
- "@vueless/storybook": "^0.0.33",
40
+ "@vueless/plugin-vite": "^0.0.37",
41
+ "@vueless/storybook": "^0.0.34",
42
42
  "@vueless/web-types": "^0.0.13",
43
43
  "autoprefixer": "^10.4.19",
44
44
  "cssnano": "^6.1.2",
@@ -15,6 +15,13 @@ export default /*tw*/ {
15
15
  content: {
16
16
  base: "flex flex-col",
17
17
  variants: {
18
+ reverse: {
19
+ false: "flex-col",
20
+ true: "flex-col-reverse",
21
+ },
22
+ wrap: {
23
+ true: "flex-wrap",
24
+ },
18
25
  gap: {
19
26
  none: "gap-0",
20
27
  "2xs": "gap-1",
@@ -32,11 +39,22 @@ export default /*tw*/ {
32
39
  stretch: "items-stretch",
33
40
  baseline: "items-baseline",
34
41
  },
42
+ justify: {
43
+ end: "justify-end",
44
+ start: "justify-start",
45
+ center: "justify-center",
46
+ around: "justify-around",
47
+ evenly: "justify-evenly",
48
+ between: "justify-between",
49
+ },
35
50
  },
36
51
  },
37
52
  defaultVariants: {
38
53
  gap: "md",
39
- align: "stretch",
54
+ align: "start",
55
+ justify: "start",
56
+ wrap: false,
57
+ reverse: false,
40
58
  upperlined: true,
41
59
  underlined: false,
42
60
  },
@@ -45,7 +45,7 @@ defineOptions({ name: "UGroup", inheritAttrs: false });
45
45
 
46
46
  const props = defineProps({
47
47
  /**
48
- * Set header title.
48
+ * Header title.
49
49
  */
50
50
  title: {
51
51
  type: String,
@@ -70,6 +70,31 @@ const props = defineProps({
70
70
  default: UIService.get(defaultConfig, UGroup).default.align,
71
71
  },
72
72
 
73
+ /**
74
+ * Nested items horizontally align (flex justify-content).
75
+ * @values start, end, center, around, evenly, between
76
+ */
77
+ justify: {
78
+ type: String,
79
+ default: UIService.get(defaultConfig, UGroup).default.justify,
80
+ },
81
+
82
+ /**
83
+ * Reverse nested items order.
84
+ */
85
+ reverse: {
86
+ type: Boolean,
87
+ default: UIService.get(defaultConfig, UGroup).default.reverse,
88
+ },
89
+
90
+ /**
91
+ * Allow items to wrap (flex flex-wrap).
92
+ */
93
+ wrap: {
94
+ type: Boolean,
95
+ default: UIService.get(defaultConfig, UGroup).default.wrap,
96
+ },
97
+
73
98
  /**
74
99
  * Show line above the header.
75
100
  */
@@ -1,7 +1,17 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: {
3
- base: "flex flex-col md:flex-row w-full",
3
+ base: "flex w-full",
4
4
  variants: {
5
+ reverse: {
6
+ false: "flex-col md:flex-row",
7
+ true: "flex-col-reverse md:flex-row-reverse",
8
+ },
9
+ wrap: {
10
+ true: "flex-wrap",
11
+ },
12
+ noMobile: {
13
+ true: "flex-row",
14
+ },
5
15
  gap: {
6
16
  none: "gap-0",
7
17
  "2xs": "gap-1",
@@ -19,14 +29,22 @@ export default /*tw*/ {
19
29
  stretch: "items-stretch",
20
30
  baseline: "items-baseline",
21
31
  },
22
- noMobile: {
23
- true: "flex-row",
32
+ justify: {
33
+ end: "justify-end",
34
+ start: "justify-start",
35
+ center: "justify-center",
36
+ around: "justify-around",
37
+ evenly: "justify-evenly",
38
+ between: "justify-between",
24
39
  },
25
40
  },
26
41
  },
27
42
  defaultVariants: {
28
43
  gap: "md",
29
44
  align: "start",
45
+ justify: "start",
46
+ wrap: false,
47
+ reverse: false,
30
48
  noMobile: false,
31
49
  },
32
50
  };
@@ -17,7 +17,7 @@ defineOptions({ name: "URow", inheritAttrs: false });
17
17
 
18
18
  const props = defineProps({
19
19
  /**
20
- * Row spacing between nested elements.
20
+ * The distance between nested elements.
21
21
  * @values none, 2xs, xs, sm, md, lg, xl, 2xl
22
22
  */
23
23
  gap: {
@@ -26,7 +26,7 @@ const props = defineProps({
26
26
  },
27
27
 
28
28
  /**
29
- * Nested items align (flex align-items).
29
+ * Nested items vertical align (flex align-items).
30
30
  * @values start, end, center, stretch, baseline
31
31
  */
32
32
  align: {
@@ -34,6 +34,31 @@ const props = defineProps({
34
34
  default: UIService.get(defaultConfig, URow).default.align,
35
35
  },
36
36
 
37
+ /**
38
+ * Nested items horizontally align (flex justify-content).
39
+ * @values start, end, center, around, evenly, between
40
+ */
41
+ justify: {
42
+ type: String,
43
+ default: UIService.get(defaultConfig, URow).default.justify,
44
+ },
45
+
46
+ /**
47
+ * Reverse nested items order.
48
+ */
49
+ reverse: {
50
+ type: Boolean,
51
+ default: UIService.get(defaultConfig, URow).default.reverse,
52
+ },
53
+
54
+ /**
55
+ * Allow items to wrap (flex flex-wrap).
56
+ */
57
+ wrap: {
58
+ type: Boolean,
59
+ default: UIService.get(defaultConfig, URow).default.wrap,
60
+ },
61
+
37
62
  /**
38
63
  * Disables mobile adaptivity.
39
64
  */
@@ -1,45 +1,48 @@
1
1
  import useUI from "../../composable.ui";
2
2
  import defaultConfig from "../configs/default.config";
3
3
  import { computed } from "vue";
4
- import { cx } from "../../service.ui";
5
-
6
- export function useAttrs(props) {
7
- const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
8
- const { labelCrossed } = config.value;
9
-
10
- const wrapperAttrs = getAttrs("wrapper");
11
- const dividerAttrs = getAttrs("divider", { isComponent: true });
12
- const emptyAttrs = getAttrs("empty", { isComponent: true });
13
- const draggableAttrs = getAttrs("draggable");
14
- const itemWrapperAttrs = getAttrs("itemWrapper");
15
- const itemAttrs = getAttrs("item");
16
- const customActionsAttrs = getAttrs("customActions");
17
- const deleteIconAttrs = getAttrs("deleteIcon", { isComponent: true });
18
- const editIconAttrs = getAttrs("editIcon", { isComponent: true });
19
- const dragIconAttrs = getAttrs("dragIcon", { isComponent: true });
20
- const nestedAttrs = getAttrs("nested", { isComponent: true });
21
-
22
- const labelAttrsRaw = getAttrs("label");
23
-
24
- const labelAttrs = computed(() => (isActive) => ({
25
- ...labelAttrsRaw,
26
- class: cx([labelAttrsRaw.value.class, isActive !== undefined && !isActive ? labelCrossed : ""]),
27
- }));
4
+ import { cva, cx } from "../../service.ui";
5
+
6
+ export default function useAttrs(props) {
7
+ const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
8
+ defaultConfig,
9
+ () => props.config,
10
+ );
11
+ const attrs = {};
12
+
13
+ for (const key in defaultConfig) {
14
+ if (isSystemKey(key)) continue;
15
+
16
+ const classes = computed(() => {
17
+ const value = config.value[key];
18
+
19
+ if (value.variants || value.compoundVariants) {
20
+ return cva(value)({
21
+ ...props,
22
+ });
23
+ }
24
+
25
+ return "";
26
+ });
27
+
28
+ attrs[`${key}Attrs`] = getAttrs(key, { classes });
29
+
30
+ if (key === "label") {
31
+ const labelAttrs = attrs[`${key}Attrs`];
32
+
33
+ attrs[`${key}Attrs`] = computed(() => (isActive) => ({
34
+ ...labelAttrs,
35
+ class: cx([
36
+ labelAttrs.value.class,
37
+ isActive !== undefined && !isActive ? config.value.labelCrossed : "",
38
+ ]),
39
+ }));
40
+ }
41
+ }
28
42
 
29
43
  return {
44
+ ...attrs,
30
45
  config,
31
46
  hasSlotContent,
32
- wrapperAttrs,
33
- dividerAttrs,
34
- emptyAttrs,
35
- draggableAttrs,
36
- nestedAttrs,
37
- itemWrapperAttrs,
38
- itemAttrs,
39
- labelAttrs,
40
- customActionsAttrs,
41
- deleteIconAttrs,
42
- editIconAttrs,
43
- dragIconAttrs,
44
47
  };
45
48
  }
@@ -10,7 +10,7 @@ export default /*tw*/ {
10
10
  group-last/item-wrapper:border-b-0 group-[]/nested:group-last/item-wrapper:border-b
11
11
  py-4 space-x-4 flex flex-auto items-center justify-between
12
12
  `,
13
- dragIcon: "icon-drag cursor-move opacity-100 fill-gray-400 md:fill-gray-500",
13
+ dragIcon: "{UIcon} icon-drag cursor-move opacity-100 fill-gray-400 md:fill-gray-500",
14
14
  dragIconName: "drag_indicator",
15
15
  label: "text-base font-normal text-gray-900 flex-auto pt-px",
16
16
  labelCrossed: "line-through",
@@ -18,11 +18,13 @@ export default /*tw*/ {
18
18
  space-x-5 opacity-50 md:flex md:items-center md:opacity-0
19
19
  group-hover/item:md:block group-hover/item:opacity-100
20
20
  `,
21
- deleteIcon: "hidden md:block md:opacity-0 group-hover/item:md:opacity-100",
21
+ deleteIcon: "{UIcon} hidden md:block md:opacity-0 group-hover/item:md:opacity-100",
22
22
  deleteIconName: "delete",
23
- editIcon: "fill-gray-500 opacity-50",
23
+ editIcon: "{UIcon} fill-gray-500 opacity-50",
24
24
  editIconName: "edit_note",
25
- nested: "group/nested ml-6",
25
+ divider: "{UDivider}",
26
+ empty: "{UEmpty}",
27
+ nested: "{UDataList} group/nested ml-6",
26
28
  i18n: {
27
29
  edit: "Edit",
28
30
  delete: "Delete",
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UDataList from "../ui.data-list";
4
4
  import UIcon from "../ui.image-icon";
@@ -50,9 +50,7 @@ const DefaultTemplate = (args) => ({
50
50
  },
51
51
  template: `
52
52
  <UDataList v-bind="args" @dragSort="onDragSort">
53
- <template v-for="(slot, index) of slots" :key="index" v-slot:[slot]>
54
- <template v-if="args[slot]">{{ args[slot] }}</template>
55
- </template>
53
+ ${allSlotsFragment}
56
54
  </UDataList>
57
55
  `,
58
56
  methods: {
@@ -28,7 +28,10 @@
28
28
  <UIcon internal :name="config.dragIconName" color="gray" v-bind="dragIconAttrs" />
29
29
 
30
30
  <div v-bind="labelAttrs(element.isActive)">
31
- <!-- @slot Use it to modify label. -->
31
+ <!--
32
+ @slot Use it to modify label.
33
+ @binding {object} item
34
+ -->
32
35
  <slot name="label" :item="element">
33
36
  {{ element[labelKey] }}
34
37
  </slot>
@@ -39,7 +42,10 @@
39
42
  v-if="hasSlotContent($slots['actions']) && !element.isHiddenCustomActions"
40
43
  v-bind="customActionsAttrs"
41
44
  >
42
- <!-- @slot Use it to add custom actions. -->
45
+ <!--
46
+ @slot Use it to add custom actions.
47
+ @binding {object} item
48
+ -->
43
49
  <slot name="actions" :item="element" />
44
50
  </div>
45
51
 
@@ -88,7 +94,10 @@
88
94
  </template>
89
95
 
90
96
  <template #actions="{ item }">
91
- <!-- @slot Use it to add custom actions. -->
97
+ <!--
98
+ @slot Use it to add custom actions.
99
+ @binding {object} item
100
+ -->
92
101
  <slot name="actions" :item="item" />
93
102
  </template>
94
103
  </UDataList>
@@ -110,7 +119,7 @@ import UIService from "../service.ui";
110
119
 
111
120
  import { UDataList as UDataListName } from "./constants";
112
121
  import defaultConfig from "./configs/default.config";
113
- import { useAttrs } from "./composables/attrs.composable";
122
+ import useAttrs from "./composables/attrs.composable";
114
123
  import { useLocale } from "../composable.locale";
115
124
 
116
125
  /* Should be a string for correct web-types gen */
@@ -215,7 +224,27 @@ const props = defineProps({
215
224
  },
216
225
  });
217
226
 
218
- const emit = defineEmits(["dragSort", "clickEdit", "clickDelete"]);
227
+ const emit = defineEmits([
228
+ /**
229
+ * Triggers when item is sorted (after drag).
230
+ * @property {array} sortData
231
+ */
232
+ "dragSort",
233
+
234
+ /**
235
+ * Triggers when edit button is clicked.
236
+ * @property {number} value
237
+ * @property {string} label
238
+ */
239
+ "clickEdit",
240
+
241
+ /**
242
+ * Triggers when delete button is clicked.
243
+ * @property {number} value
244
+ * @property {string} label
245
+ */
246
+ "clickDelete",
247
+ ]);
219
248
 
220
249
  const {
221
250
  config,