vueless 0.0.244 → 0.0.246

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.244",
3
+ "version": "0.0.246",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -37,7 +37,7 @@
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.44",
40
+ "@vueless/plugin-vite": "^0.0.45",
41
41
  "@vueless/storybook": "^0.0.34",
42
42
  "@vueless/web-types": "^0.0.13",
43
43
  "autoprefixer": "^10.4.19",
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UButton from "../ui.button";
4
4
  import UIcon from "../ui.image-icon";
@@ -29,50 +29,28 @@ const DefaultTemplate = (args) => ({
29
29
  },
30
30
  template: `
31
31
  <UButton v-bind="args">
32
- ${args.slotTemplate || allSlotsFragment}
32
+ ${args.slotTemplate || getSlotsFragment()}
33
33
  </UButton>
34
34
  `,
35
35
  });
36
36
 
37
- const VariantsTemplate = (args, { argTypes } = {}) => ({
38
- components: { UButton, URow },
37
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
38
+ components: { UButton, URow, UCol },
39
39
  setup() {
40
- return {
41
- args,
42
- variants: argTypes.variant.options,
43
- };
40
+ return { args, options: argTypes[args.enum].options };
44
41
  },
45
42
  template: `
46
- <URow>
47
- <UButton
48
- v-for="(variant, index) in variants"
49
- v-bind="args"
50
- :variant="variant"
51
- :label="variant"
52
- :key="index"
53
- />
54
- </URow>
55
- `,
56
- });
57
-
58
- const SizesTemplate = (args, { argTypes } = {}) => ({
59
- components: { UButton, URow },
60
- setup() {
61
- return {
62
- args,
63
- sizes: argTypes.size.options,
64
- };
65
- },
66
- template: `
67
- <URow>
68
- <UButton
69
- v-for="(size, index) in sizes"
70
- v-bind="args"
71
- :size="size"
72
- :label="size"
73
- :key="index"
74
- />
75
- </URow>
43
+ <UCol>
44
+ <URow>
45
+ <UButton
46
+ v-for="(option, index) in options"
47
+ v-bind="args"
48
+ :[args.enum]="option"
49
+ :label="option"
50
+ :key="index"
51
+ />
52
+ </URow>
53
+ </UCol>
76
54
  `,
77
55
  });
78
56
 
@@ -104,17 +82,17 @@ const ColorTemplate = (args, { argTypes } = {}) => ({
104
82
  export const Default = DefaultTemplate.bind({});
105
83
  Default.args = {};
106
84
 
107
- export const variants = VariantsTemplate.bind({});
108
- variants.args = {};
85
+ export const variants = EnumVariantTemplate.bind({});
86
+ variants.args = { enum: "variant" };
109
87
 
110
- export const sizes = SizesTemplate.bind({});
111
- sizes.args = {};
88
+ export const sizes = EnumVariantTemplate.bind({});
89
+ sizes.args = { enum: "size" };
112
90
 
113
- export const pilled = VariantsTemplate.bind({});
114
- pilled.args = { pill: true };
91
+ export const pilled = EnumVariantTemplate.bind({});
92
+ pilled.args = { enum: "variant", pill: true };
115
93
 
116
- export const disabled = VariantsTemplate.bind({});
117
- disabled.args = { disabled: true };
94
+ export const disabled = EnumVariantTemplate.bind({});
95
+ disabled.args = { enum: "variant", disabled: true };
118
96
 
119
97
  export const noRing = DefaultTemplate.bind({});
120
98
  noRing.args = { noRing: true };
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import ULink from "../ui.button-link";
4
4
  import UButton from "../ui.button";
@@ -21,7 +21,7 @@ export default {
21
21
  };
22
22
 
23
23
  const DefaultTemplate = (args) => ({
24
- components: { ULink },
24
+ components: { ULink, UButton },
25
25
  setup() {
26
26
  const slots = getSlotNames(ULink.name);
27
27
 
@@ -29,108 +29,56 @@ const DefaultTemplate = (args) => ({
29
29
  },
30
30
  template: `
31
31
  <ULink v-bind="args">
32
- ${allSlotsFragment}
32
+ ${args.slotTemplate || getSlotsFragment()}
33
33
  </ULink>
34
34
  `,
35
35
  });
36
36
 
37
- const ColorsTemplate = (args, { argTypes } = {}) => ({
37
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
38
38
  components: { ULink, URow },
39
39
  setup() {
40
- return {
41
- args,
42
- colors: argTypes.color.options,
43
- };
44
- },
45
- template: `
46
- <URow>
47
- <ULink
48
- v-for="(color, index) in colors"
49
- v-bind="args"
50
- :color="color"
51
- :label="color"
52
- :key="index"
53
- />
54
- </URow>
55
- `,
56
- });
40
+ function getText(value) {
41
+ return `Link ${value}`;
42
+ }
57
43
 
58
- const TypesTemplate = (args, { argTypes } = {}) => ({
59
- components: { ULink, URow },
60
- setup() {
61
- return {
62
- args,
63
- types: argTypes.type.options,
64
- };
65
- },
66
- template: `
67
- <URow>
68
- <ULink
69
- v-for="(type, index) in types"
70
- v-bind="args"
71
- :label="type"
72
- :type="type"
73
- :key="index"
74
- />
75
- </URow>
76
- `,
77
- });
44
+ let prefixedOptions = argTypes[args.enum].options;
78
45
 
79
- const SizesTemplate = (args, { argTypes } = {}) => ({
80
- components: { ULink, URow },
81
- setup() {
82
- return {
83
- args,
84
- sizes: argTypes.size.options,
85
- };
46
+ if (argTypes[args.enum].name === "size") {
47
+ prefixedOptions = prefixedOptions.map((option) => getText(option));
48
+ }
49
+
50
+ return { args, options: argTypes[args.enum].options, prefixedOptions };
86
51
  },
87
52
  template: `
88
53
  <URow>
89
54
  <ULink
90
- v-for="(size, index) in sizes"
55
+ v-for="(option, index) in options"
91
56
  v-bind="args"
92
- :size="size"
93
- :label="getText(size)"
57
+ :[args.enum]="option"
58
+ :label="prefixedOptions[index]"
94
59
  :key="index"
95
60
  />
96
61
  </URow>
97
62
  `,
98
- methods: {
99
- getText(value) {
100
- return `Link ${value}`;
101
- },
102
- },
103
- });
104
-
105
- const SlotTemplate = (args) => ({
106
- components: { UButton, ULink },
107
- setup() {
108
- return { args };
109
- },
110
- template: `
111
- <ULink>
112
- ${args.slotTemplate}
113
- </ULink>
114
- `,
115
63
  });
116
64
 
117
65
  export const Default = DefaultTemplate.bind({});
118
66
  Default.args = {};
119
67
 
120
- export const sizes = SizesTemplate.bind({});
121
- sizes.args = {};
68
+ export const sizes = EnumVariantTemplate.bind({});
69
+ sizes.args = { enum: "size" };
122
70
 
123
- export const colors = ColorsTemplate.bind({});
124
- colors.args = {};
71
+ export const colors = EnumVariantTemplate.bind({});
72
+ colors.args = { enum: "color" };
125
73
 
126
- export const types = TypesTemplate.bind({});
127
- types.args = {};
74
+ export const types = EnumVariantTemplate.bind({});
75
+ types.args = { enum: "type" };
128
76
 
129
- export const underlined = ColorsTemplate.bind({});
130
- underlined.args = { underlined: true, dashed: false };
77
+ export const underlined = EnumVariantTemplate.bind({});
78
+ underlined.args = { enum: "color", underlined: true, dashed: false };
131
79
 
132
- export const dashed = ColorsTemplate.bind({});
133
- dashed.args = { dashed: true };
80
+ export const dashed = EnumVariantTemplate.bind({});
81
+ dashed.args = { enum: "color", dashed: true };
134
82
 
135
83
  export const url = DefaultTemplate.bind({});
136
84
  url.args = { url: "https://storybook.js.org/docs/react/get-started/introduction" };
@@ -150,7 +98,7 @@ disabled.args = { disabled: true };
150
98
  export const noRing = DefaultTemplate.bind({});
151
99
  noRing.args = { noRing: true };
152
100
 
153
- export const slotDefault = SlotTemplate.bind({});
101
+ export const slotDefault = DefaultTemplate.bind({});
154
102
  slotDefault.args = {
155
103
  slotTemplate: `
156
104
  <template #default>
@@ -1,5 +1,5 @@
1
1
  import { ref } from "vue";
2
- import { getArgTypes } from "../service.storybook";
2
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
3
3
 
4
4
  import UToggle from "../ui.button-toggle";
5
5
  import UIcon from "../ui.image-icon";
@@ -27,76 +27,26 @@ export default {
27
27
  };
28
28
 
29
29
  const DefaultTemplate = (args) => ({
30
- components: { UToggle },
31
- data() {
32
- return {
33
- value: "",
34
- };
35
- },
30
+ components: { UToggle, UIcon, UToggleItem },
36
31
  setup() {
37
- return { args, OPTIONS };
38
- },
39
- template: `
40
- <UToggle
41
- v-model="value"
42
- v-bind="args"
43
- :options="OPTIONS"
44
- />
45
- `,
46
- });
32
+ const value = ref("");
47
33
 
48
- const multipleTemplate = (args) => ({
49
- components: { UToggle },
50
- data() {
51
- return {
52
- value: [],
53
- };
54
- },
55
- setup() {
56
- return { args, OPTIONS };
34
+ const slots = getSlotNames(UToggle.name);
35
+
36
+ return { args, slots, value, OPTIONS };
57
37
  },
58
38
  template: `
59
39
  <UToggle
60
40
  v-model="value"
61
41
  v-bind="args"
62
- multiple
63
42
  :options="OPTIONS"
64
- name="multipleTemplate"
65
- />
66
- `,
67
- });
68
-
69
- const SizesTemplate = (args, { argTypes } = {}) => ({
70
- components: { UToggle, URow },
71
- setup() {
72
- const value = ref("");
73
-
74
- return {
75
- args,
76
- value,
77
- sizes: argTypes.size.options,
78
- };
79
- },
80
- template: `
81
- <URow>
82
- <UToggle
83
- v-for="(size, index) in sizes"
84
- :key="index"
85
- name="sizeTemplate"
86
- v-model="value"
87
- v-bind="args"
88
- :size="size"
89
- :label="size"
90
- :options="[
91
- { value: size + 1, label: size },
92
- { value: size + 2, label: size },
93
- ]"
94
- />
95
- </URow>
43
+ >
44
+ ${args.slotTemplate || getSlotsFragment()}
45
+ </UToggle>
96
46
  `,
97
47
  });
98
48
 
99
- const VariantsTemplate = (args, { argTypes } = {}) => ({
49
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
100
50
  components: { UToggle, URow },
101
51
  setup() {
102
52
  const value = ref("");
@@ -104,45 +54,27 @@ const VariantsTemplate = (args, { argTypes } = {}) => ({
104
54
  return {
105
55
  args,
106
56
  value,
107
- variants: argTypes.variant.options,
57
+ options: argTypes[args.enum].options,
108
58
  };
109
59
  },
110
60
  template: `
111
61
  <URow>
112
62
  <UToggle
113
- v-for="(variant, index) in variants"
63
+ v-for="(option, index) in options"
114
64
  :key="index"
115
- name="sizeTemplate"
116
65
  v-model="value"
117
66
  v-bind="args"
118
- :variant="variant"
119
- :label="variant"
67
+ :[args.enum]="option"
68
+ :label="option"
120
69
  :options="[
121
- { value: variant + 1, label: variant },
122
- { value: variant + 2, label: variant },
70
+ { value: option + 1, label: option },
71
+ { value: option + 2, label: option },
123
72
  ]"
124
73
  />
125
74
  </URow>
126
75
  `,
127
76
  });
128
77
 
129
- const SlotTemplate = (args) => ({
130
- components: { UToggle, UIcon, UToggleItem },
131
- setup() {
132
- const selected = ref("");
133
-
134
- return {
135
- args,
136
- selected,
137
- };
138
- },
139
- template: `
140
- <UToggle v-bind="args" name="slotTemplate" v-model="selected">
141
- ${args.slotTemplate}
142
- </UToggle>
143
- `,
144
- });
145
-
146
78
  export const Default = DefaultTemplate.bind({});
147
79
  Default.args = {
148
80
  name: "Default",
@@ -161,19 +93,22 @@ label.args = {
161
93
  description: "description",
162
94
  };
163
95
 
164
- export const sizes = SizesTemplate.bind({});
96
+ export const sizes = EnumVariantTemplate.bind({});
165
97
  sizes.args = {
166
- name: "sizes",
98
+ name: "sizeTemplate",
99
+ enum: "size",
167
100
  };
168
101
 
169
- export const variants = VariantsTemplate.bind({});
102
+ export const variants = EnumVariantTemplate.bind({});
170
103
  variants.args = {
171
- name: "variants",
104
+ name: "sizeTemplate",
105
+ enum: "variant",
172
106
  };
173
107
 
174
- export const multiple = multipleTemplate.bind({});
108
+ export const multiple = DefaultTemplate.bind({});
175
109
  multiple.args = {
176
- name: "multiple",
110
+ name: "multipleTemplate",
111
+ multiple: true,
177
112
  };
178
113
 
179
114
  export const block = DefaultTemplate.bind({});
@@ -195,7 +130,7 @@ pill.args = {
195
130
  separated: true,
196
131
  };
197
132
 
198
- export const square = SlotTemplate.bind({});
133
+ export const square = DefaultTemplate.bind({});
199
134
  square.args = {
200
135
  name: "square",
201
136
  variant: "secondary",
@@ -217,7 +152,7 @@ square.args = {
217
152
  `,
218
153
  };
219
154
 
220
- export const slotDefault = SlotTemplate.bind({});
155
+ export const slotDefault = DefaultTemplate.bind({});
221
156
  slotDefault.args = {
222
157
  name: "slotDefault",
223
158
  slotTemplate: `
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UToggleItem from "../ui.button-toggle-item";
4
4
  import UIcon from "../ui.image-icon";
@@ -21,27 +21,15 @@ export default {
21
21
  };
22
22
 
23
23
  const DefaultTemplate = (args) => ({
24
- components: { UToggleItem },
24
+ components: { UToggleItem, UIcon },
25
25
  setup() {
26
26
  const slots = getSlotNames(UToggleItem.name);
27
27
 
28
28
  return { args, slots };
29
29
  },
30
30
  template: `
31
- <UToggleItem v-bind="args" name="toggle">
32
- ${allSlotsFragment}
33
- </UToggleItem>
34
- `,
35
- });
36
-
37
- const SlotTemplate = (args) => ({
38
- components: { UToggleItem, UIcon },
39
- setup() {
40
- return { args };
41
- },
42
- template: `
43
- <UToggleItem v-bind="args" >
44
- ${args.slotTemplate}
31
+ <UToggleItem v-bind="args" name="toggle" v-model="args.modelValue">
32
+ ${args.slotTemplate || getSlotsFragment()}
45
33
  </UToggleItem>
46
34
  `,
47
35
  });
@@ -52,7 +40,7 @@ Default.args = {};
52
40
  export const disabled = DefaultTemplate.bind({});
53
41
  disabled.args = { disabled: true };
54
42
 
55
- export const slotLeft = SlotTemplate.bind({});
43
+ export const slotLeft = DefaultTemplate.bind({});
56
44
  slotLeft.args = {
57
45
  slotTemplate: `
58
46
  <template #left>
@@ -64,14 +52,14 @@ slotLeft.args = {
64
52
  `,
65
53
  };
66
54
 
67
- export const slotRight = SlotTemplate.bind({});
55
+ export const slotRight = DefaultTemplate.bind({});
68
56
  slotRight.args = {
69
57
  slotTemplate: `
70
58
  <template #right>
71
59
  <UIcon
72
60
  name="star"
73
61
  color="green"
74
- />
62
+ />
75
63
  </template>
76
64
  `,
77
65
  };
@@ -12,8 +12,22 @@ export default /*tw*/ {
12
12
  headerFallback: "flex items-center",
13
13
  title: "{UHeader} pr-2",
14
14
  underline: "{UDivider} pt-1.5",
15
+ content: {
16
+ base: "flex flex-col items-stretch",
17
+ variants: {
18
+ gap: {
19
+ none: "gap-0",
20
+ xs: "gap-8",
21
+ sm: "gap-10",
22
+ md: "gap-12",
23
+ lg: "gap-14",
24
+ xl: "gap-16",
25
+ },
26
+ },
27
+ },
15
28
  defaultVariants: {
16
- upperlined: true,
29
+ gap: "md",
30
+ upperlined: false,
17
31
  underlined: false,
18
32
  },
19
33
  };
@@ -60,12 +60,23 @@ upperlined.args = { upperlined: false, underlined: true };
60
60
  export const underlined = DefaultTemplate.bind({});
61
61
  underlined.args = { upperlined: true, underlined: false };
62
62
 
63
+ export const nestedGroups = DefaultTemplate.bind({});
64
+ nestedGroups.args = {
65
+ title: "",
66
+ slotTemplate: `
67
+ <UGroup :upperlined="n !== 1" :title="'Group '+n" v-for="n in 3">
68
+ <UCol>
69
+ <UInput placeholder="input" label="Label" />
70
+ <UInput placeholder="input" label="Label" />
71
+ </UCol>
72
+ </UGroup>
73
+ `,
74
+ };
75
+
63
76
  export const slotDefault = DefaultTemplate.bind({});
64
77
  slotDefault.args = {
65
78
  slotTemplate: `
66
- <template #default>
67
- <UInput placeholder="placeholder" label="Label" />
68
- </template>
79
+ <UInput placeholder="placeholder" label="Label" />
69
80
  `,
70
81
  };
71
82
  slotDefault.parameters = {
@@ -79,10 +90,10 @@ slotDefault.parameters = {
79
90
  export const slotRight = DefaultTemplate.bind({});
80
91
  slotRight.args = {
81
92
  slotTemplate: `
82
- ${defaultTemplate}
83
93
  <template #right>
84
94
  <UButton size="sm" label="Edit"/>
85
95
  </template>
96
+ ${defaultTemplate}
86
97
  `,
87
98
  };
88
99
  slotRight.parameters = {
@@ -24,8 +24,10 @@
24
24
  <UDivider v-if="underlined" size="xl" v-bind="underlineAttrs" />
25
25
  </template>
26
26
 
27
- <!-- @slot Use it to add something inside. -->
28
- <slot />
27
+ <div v-bind="contentAttrs">
28
+ <!-- @slot Use it to add something inside. -->
29
+ <slot />
30
+ </div>
29
31
  </div>
30
32
  </template>
31
33
 
@@ -50,6 +52,15 @@ const props = defineProps({
50
52
  default: "",
51
53
  },
52
54
 
55
+ /**
56
+ * The distance between nested elements.
57
+ * @values none, xs, sm, md, lg, xl
58
+ */
59
+ gap: {
60
+ type: String,
61
+ default: UIService.get(defaultConfig, UGroup).default.gap,
62
+ },
63
+
53
64
  /**
54
65
  * Show line above the header.
55
66
  */
@@ -90,5 +101,6 @@ const {
90
101
  titleAttrs,
91
102
  upperlineAttrs,
92
103
  underlineAttrs,
104
+ contentAttrs,
93
105
  } = useAttrs(props);
94
106
  </script>
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.244",
4
+ "version": "0.0.246",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -3645,6 +3645,15 @@
3645
3645
  },
3646
3646
  "default": "\"\""
3647
3647
  },
3648
+ {
3649
+ "name": "gap",
3650
+ "description": "The distance between nested elements.",
3651
+ "value": {
3652
+ "kind": "expression",
3653
+ "type": "'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'"
3654
+ },
3655
+ "default": "md"
3656
+ },
3648
3657
  {
3649
3658
  "name": "upperlined",
3650
3659
  "description": "Show line above the header.",
@@ -3652,7 +3661,7 @@
3652
3661
  "kind": "expression",
3653
3662
  "type": "boolean"
3654
3663
  },
3655
- "default": "true"
3664
+ "default": "false"
3656
3665
  },
3657
3666
  {
3658
3667
  "name": "underlined",
@@ -3709,58 +3718,6 @@
3709
3718
  "symbol": "default"
3710
3719
  }
3711
3720
  },
3712
- {
3713
- "name": "UGroups",
3714
- "description": "",
3715
- "attributes": [
3716
- {
3717
- "name": "gap",
3718
- "description": "The distance between nested elements.",
3719
- "value": {
3720
- "kind": "expression",
3721
- "type": "'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'"
3722
- },
3723
- "default": "md"
3724
- },
3725
- {
3726
- "name": "align",
3727
- "description": "Nested items align (flex align-items).",
3728
- "value": {
3729
- "kind": "expression",
3730
- "type": "'start' | 'end' | 'center' | 'stretch' | 'baseline'"
3731
- },
3732
- "default": "start"
3733
- },
3734
- {
3735
- "name": "config",
3736
- "description": "Component ui config object.",
3737
- "value": {
3738
- "kind": "expression",
3739
- "type": "object"
3740
- },
3741
- "default": "{}"
3742
- },
3743
- {
3744
- "name": "dataCy",
3745
- "description": "Data-cy attribute for automated testing.",
3746
- "value": {
3747
- "kind": "expression",
3748
- "type": "string"
3749
- },
3750
- "default": "\"\""
3751
- }
3752
- ],
3753
- "slots": [
3754
- {
3755
- "name": "default",
3756
- "description": "Use it to add something inside."
3757
- }
3758
- ],
3759
- "source": {
3760
- "module": "./src/ui.container-groups/index.vue",
3761
- "symbol": "default"
3762
- }
3763
- },
3764
3721
  {
3765
3722
  "name": "UHeader",
3766
3723
  "description": "",
@@ -1,16 +0,0 @@
1
- import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
- import { getSource } from "../service.storybook";
3
-
4
- import * as stories from "./index.stories";
5
- import defaultConfig from "./configs/default.config?raw"
6
-
7
- <Meta of={stories} />
8
- <Title of={stories} />
9
- <Subtitle of={stories} />
10
- <Description of={stories} />
11
- <Primary of={stories} />
12
- <Controls of={stories.Default} />
13
- <Stories of={stories} />
14
-
15
- ## Default config
16
- <Source code={getSource(defaultConfig)} language="jsx" dark />
@@ -1,33 +0,0 @@
1
- import { computed } from "vue";
2
-
3
- import { cva } from "../../service.ui";
4
- import useUI from "../../composable.ui";
5
- import defaultConfig from "../configs/default.config";
6
-
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
- }
28
-
29
- return {
30
- ...attrs,
31
- config,
32
- };
33
- }
@@ -1,26 +0,0 @@
1
- export default /*tw*/ {
2
- wrapper: {
3
- base: "flex flex-col",
4
- variants: {
5
- gap: {
6
- none: "space-y-0",
7
- xs: "space-y-10",
8
- sm: "space-y-12",
9
- md: "space-y-14",
10
- lg: "space-y-16",
11
- xl: "space-y-20",
12
- },
13
- align: {
14
- end: "items-end",
15
- start: "items-start",
16
- center: "items-center",
17
- stretch: "items-stretch",
18
- baseline: "items-baseline",
19
- },
20
- },
21
- },
22
- defaultVariants: {
23
- gap: "md",
24
- align: "start",
25
- },
26
- };
@@ -1,5 +0,0 @@
1
- /*
2
- This const is needed to prevent the issue in script setup:
3
- `defineProps` is referencing locally declared variables. (vue/valid-define-props)
4
- */
5
- export const UGroups = "UGroups";
@@ -1,52 +0,0 @@
1
- import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
-
3
- import UGroups from "../ui.container-groups";
4
- import UGroup from "../ui.container-group";
5
- import UCol from "../ui.container-col";
6
- import UInput from "../ui.form-input";
7
-
8
- /**
9
- * The `UGroups` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-groups)
10
- */
11
- export default {
12
- id: "5040",
13
- title: "Containers / Groups",
14
- component: UGroups,
15
- args: {},
16
- argTypes: {
17
- ...getArgTypes(UGroups.name),
18
- },
19
- parameters: {
20
- docs: {
21
- story: {
22
- iframeHeight: 760,
23
- },
24
- },
25
- },
26
- };
27
-
28
- const defaultTemplate = `
29
- <UGroup :upperlined="n !== 1" :title="'Group '+n" v-for="n in 3">
30
- <UCol>
31
- <UInput placeholder="input" label="Label" />
32
- <UInput placeholder="input" label="Label" />
33
- </UCol>
34
- </UGroup>
35
- `;
36
-
37
- const DefaultTemplate = (args) => ({
38
- components: { UGroups, UGroup, UCol, UInput },
39
- setup() {
40
- const slots = getSlotNames(UGroups.name);
41
-
42
- return { args, slots };
43
- },
44
- template: `
45
- <UGroups v-bind="args">
46
- ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
47
- </UGroups>
48
- `,
49
- });
50
-
51
- export const Default = DefaultTemplate.bind({});
52
- Default.args = {};
@@ -1,55 +0,0 @@
1
- <template>
2
- <div :data-cy="dataCy" v-bind="wrapperAttrs">
3
- <!-- @slot Use it to add something inside. -->
4
- <slot />
5
- </div>
6
- </template>
7
-
8
- <script setup>
9
- import UIService from "../service.ui";
10
-
11
- import { UGroups } from "./constants";
12
- import defaultConfig from "./configs/default.config";
13
- import useAttrs from "./composables/attrs.composable";
14
-
15
- /* Should be a string for correct web-types gen */
16
- defineOptions({ name: "UGroups", inheritAttrs: false });
17
-
18
- const props = defineProps({
19
- /**
20
- * The distance between nested elements.
21
- * @values none, xs, sm, md, lg, xl
22
- */
23
- gap: {
24
- type: String,
25
- default: UIService.get(defaultConfig, UGroups).default.gap,
26
- },
27
-
28
- /**
29
- * Nested items align (flex align-items).
30
- * @values start, end, center, stretch, baseline
31
- */
32
- align: {
33
- type: String,
34
- default: UIService.get(defaultConfig, UGroups).default.align,
35
- },
36
-
37
- /**
38
- * Component ui config object.
39
- */
40
- config: {
41
- type: Object,
42
- default: () => ({}),
43
- },
44
-
45
- /**
46
- * Data-cy attribute for automated testing.
47
- */
48
- dataCy: {
49
- type: String,
50
- default: "",
51
- },
52
- });
53
-
54
- const { wrapperAttrs } = useAttrs(props);
55
- </script>