vueless 0.0.537 → 0.0.538

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.537",
3
+ "version": "0.0.538",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -12,7 +12,6 @@ import type { UGroupProps } from "./types.ts";
12
12
  defineOptions({ inheritAttrs: false });
13
13
 
14
14
  const props = withDefaults(defineProps<UGroupProps>(), {
15
- gap: getDefault<UGroupProps>(defaultConfig, UGroup).gap,
16
15
  upperlined: getDefault<UGroupProps>(defaultConfig, UGroup).upperlined,
17
16
  underlined: getDefault<UGroupProps>(defaultConfig, UGroup).underlined,
18
17
  dataTest: "",
@@ -12,21 +12,8 @@ export default /*tw*/ {
12
12
  header: "flex items-center justify-between",
13
13
  headerLeftFallback: "flex items-center",
14
14
  title: "{UHeader} pr-2",
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
+ content: "",
28
16
  defaults: {
29
- gap: "md",
30
17
  upperlined: false,
31
18
  underlined: false,
32
19
  },
@@ -8,11 +8,6 @@ export interface UGroupProps {
8
8
  */
9
9
  title?: string;
10
10
 
11
- /**
12
- * The distance between nested elements.
13
- */
14
- gap?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
15
-
16
11
  /**
17
12
  * Show line above the header.
18
13
  */
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+ import { getDefault } from "../utils/ui.ts";
3
+
4
+ import { UGroups } from "./constants.ts";
5
+ import defaultConfig from "./config.ts";
6
+ import useAttrs from "./useAttrs.ts";
7
+
8
+ import type { UGroupsProps } from "./types.ts";
9
+
10
+ defineOptions({ inheritAttrs: false });
11
+
12
+ const props = withDefaults(defineProps<UGroupsProps>(), {
13
+ gap: getDefault<UGroupsProps>(defaultConfig, UGroups).gap,
14
+ dataTest: "",
15
+ });
16
+
17
+ const { wrapperAttrs } = useAttrs(props);
18
+ </script>
19
+
20
+ <template>
21
+ <div v-bind="wrapperAttrs" :data-test="dataTest">
22
+ <!-- @slot Use it to add something inside. -->
23
+ <slot />
24
+ </div>
25
+ </template>
@@ -0,0 +1,18 @@
1
+ export default /*tw*/ {
2
+ wrapper: {
3
+ base: "flex flex-col items-stretch",
4
+ variants: {
5
+ gap: {
6
+ none: "gap-0",
7
+ xs: "gap-8",
8
+ sm: "gap-10",
9
+ md: "gap-12",
10
+ lg: "gap-14",
11
+ xl: "gap-16",
12
+ },
13
+ },
14
+ },
15
+ defaults: {
16
+ gap: "md",
17
+ },
18
+ };
@@ -0,0 +1,5 @@
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 = "UGroup";
@@ -0,0 +1,16 @@
1
+ import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
+ import { getSource } from "../../utils/storybook.ts";
3
+
4
+ import * as stories from "./stories.ts";
5
+ import defaultConfig from "../config.ts?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 />
@@ -0,0 +1,59 @@
1
+ import { getArgTypes, getSlotNames } from "../../utils/storybook.ts";
2
+
3
+ import UGroups from "../../ui.container-groups/UGroups.vue";
4
+ import UGroup from "../../ui.container-group/UGroup.vue";
5
+ import UCol from "../../ui.container-col/UCol.vue";
6
+ import UInput from "../../ui.form-input/UInput.vue";
7
+
8
+ import type { Meta, StoryFn } from "@storybook/vue3";
9
+ import type { UGroupsProps } from "../types.ts";
10
+
11
+ interface UGroupsArgs extends UGroupsProps {
12
+ slotTemplate?: string;
13
+ }
14
+
15
+ /**
16
+ * The `UGroups` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-groups)
17
+ */
18
+ export default {
19
+ id: "5035",
20
+ title: "Containers / Groups",
21
+ component: UGroups,
22
+ args: {},
23
+ argTypes: {
24
+ ...getArgTypes(UGroups.__name),
25
+ },
26
+ parameters: {
27
+ docs: {
28
+ story: {
29
+ iframeHeight: 360,
30
+ },
31
+ },
32
+ },
33
+ } as Meta;
34
+
35
+ const DefaultTemplate: StoryFn<UGroupsArgs> = (args: UGroupsArgs) => ({
36
+ components: { UGroups, UGroup, UCol, UInput },
37
+ setup() {
38
+ const slots = getSlotNames(UGroups.__name);
39
+
40
+ return { args, slots };
41
+ },
42
+ template: `
43
+ <UGroups v-bind="args">
44
+ ${args.slotTemplate}
45
+ </UGroups>
46
+ `,
47
+ });
48
+
49
+ export const Default = DefaultTemplate.bind({});
50
+ Default.args = {
51
+ slotTemplate: `
52
+ <UGroup :upperlined="n !== 1" :title="'Group '+n" v-for="n in 3">
53
+ <UCol>
54
+ <UInput placeholder="input" label="Label" />
55
+ <UInput placeholder="input" label="Label" />
56
+ </UCol>
57
+ </UGroup>
58
+ `,
59
+ };
@@ -0,0 +1,20 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface UGroupsProps {
6
+ /**
7
+ * The distance between nested elements.
8
+ */
9
+ gap?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
10
+
11
+ /**
12
+ * Component config object.
13
+ */
14
+ config?: Config;
15
+
16
+ /**
17
+ * Data-test attribute for automated testing.
18
+ */
19
+ dataTest?: string;
20
+ }
@@ -0,0 +1,18 @@
1
+ import useUI from "../composables/useUI.ts";
2
+
3
+ import defaultConfig from "./config.ts";
4
+
5
+ import type { UseAttrs } from "../types.ts";
6
+ import type { UGroupsProps, Config } from "./types.ts";
7
+
8
+ export default function useAttrs(props: UGroupsProps): UseAttrs<Config> {
9
+ const { config, getKeysAttrs, hasSlotContent } = useUI<Config>(defaultConfig, () => props.config);
10
+
11
+ const keysAttrs = getKeysAttrs();
12
+
13
+ return {
14
+ config,
15
+ ...keysAttrs,
16
+ hasSlotContent,
17
+ };
18
+ }
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.537",
4
+ "version": "0.0.538",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -5132,24 +5132,6 @@
5132
5132
  "type": "string"
5133
5133
  }
5134
5134
  },
5135
- {
5136
- "name": "gap",
5137
- "required": false,
5138
- "description": "The distance between nested elements.",
5139
- "enum": [
5140
- "none",
5141
- "xs",
5142
- "sm",
5143
- "md",
5144
- "lg",
5145
- "xl"
5146
- ],
5147
- "value": {
5148
- "kind": "expression",
5149
- "type": "union"
5150
- },
5151
- "default": "md"
5152
- },
5153
5135
  {
5154
5136
  "name": "upperlined",
5155
5137
  "required": false,
@@ -5217,6 +5199,59 @@
5217
5199
  "symbol": "default"
5218
5200
  }
5219
5201
  },
5202
+ {
5203
+ "name": "UGroups",
5204
+ "description": "",
5205
+ "attributes": [
5206
+ {
5207
+ "name": "gap",
5208
+ "required": false,
5209
+ "description": "The distance between nested elements.",
5210
+ "enum": [
5211
+ "none",
5212
+ "xs",
5213
+ "sm",
5214
+ "md",
5215
+ "lg",
5216
+ "xl"
5217
+ ],
5218
+ "value": {
5219
+ "kind": "expression",
5220
+ "type": "union"
5221
+ },
5222
+ "default": "md"
5223
+ },
5224
+ {
5225
+ "name": "config",
5226
+ "required": false,
5227
+ "description": "Component config object.",
5228
+ "value": {
5229
+ "kind": "expression",
5230
+ "type": "Config"
5231
+ }
5232
+ },
5233
+ {
5234
+ "name": "dataTest",
5235
+ "required": false,
5236
+ "description": "Data-test attribute for automated testing.",
5237
+ "value": {
5238
+ "kind": "expression",
5239
+ "type": "string"
5240
+ },
5241
+ "default": "\"\""
5242
+ }
5243
+ ],
5244
+ "slots": [
5245
+ {
5246
+ "name": "default",
5247
+ "description": "Use it to add something inside."
5248
+ }
5249
+ ],
5250
+ "source": {
5251
+ "module": "./src/ui.container-groups/UGroups.vue",
5252
+ "symbol": "default"
5253
+ }
5254
+ },
5220
5255
  {
5221
5256
  "name": "UHeader",
5222
5257
  "description": "",