vueless 0.0.512 → 0.0.514

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 (78) hide show
  1. package/package.json +1 -1
  2. package/types.ts +18 -0
  3. package/ui.button-link/types.ts +3 -1
  4. package/ui.container-accordion/UAccordion.vue +33 -69
  5. package/ui.container-accordion/storybook/Docs.mdx +2 -2
  6. package/ui.container-accordion/storybook/{stories.js → stories.ts} +10 -3
  7. package/ui.container-accordion/types.ts +35 -0
  8. package/ui.container-accordion/{useAttrs.js → useAttrs.ts} +14 -3
  9. package/ui.container-card/UCard.vue +43 -71
  10. package/ui.container-card/storybook/Docs.mdx +2 -2
  11. package/ui.container-card/storybook/{stories.js → stories.ts} +9 -2
  12. package/ui.container-card/types.ts +25 -0
  13. package/ui.container-card/useAttrs.ts +18 -0
  14. package/ui.container-col/UCol.vue +21 -79
  15. package/ui.container-col/storybook/Docs.mdx +2 -2
  16. package/ui.container-col/storybook/{stories.js → stories.ts} +9 -2
  17. package/ui.container-col/types.ts +54 -0
  18. package/ui.container-col/useAttrs.ts +18 -0
  19. package/ui.container-divider/UDivider.vue +22 -94
  20. package/ui.container-divider/storybook/Docs.mdx +2 -2
  21. package/ui.container-divider/storybook/{stories.js → stories.ts} +13 -5
  22. package/ui.container-divider/types.ts +55 -0
  23. package/ui.container-divider/useAttrs.ts +23 -0
  24. package/ui.container-group/UGroup.vue +31 -73
  25. package/ui.container-group/storybook/Docs.mdx +2 -2
  26. package/ui.container-group/storybook/{stories.js → stories.ts} +9 -2
  27. package/ui.container-group/types.ts +36 -0
  28. package/ui.container-group/useAttrs.ts +18 -0
  29. package/ui.container-modal/UModal.vue +122 -232
  30. package/ui.container-modal/storybook/Docs.mdx +2 -2
  31. package/ui.container-modal/storybook/{stories.js → stories.ts} +16 -6
  32. package/ui.container-modal/types.ts +82 -0
  33. package/ui.container-modal/useAttrs.ts +22 -0
  34. package/ui.container-modal-confirm/UModalConfirm.vue +82 -199
  35. package/ui.container-modal-confirm/storybook/Docs.mdx +2 -2
  36. package/ui.container-modal-confirm/storybook/{stories.js → stories.ts} +14 -3
  37. package/ui.container-modal-confirm/types.ts +106 -0
  38. package/ui.container-modal-confirm/useAttrs.ts +18 -0
  39. package/ui.container-page/UPage.vue +79 -153
  40. package/ui.container-page/storybook/Docs.mdx +2 -2
  41. package/ui.container-page/storybook/{stories.js → stories.ts} +9 -2
  42. package/ui.container-page/types.ts +57 -0
  43. package/ui.container-page/{useAttrs.js → useAttrs.ts} +14 -3
  44. package/ui.container-row/URow.vue +22 -87
  45. package/ui.container-row/storybook/Docs.mdx +2 -2
  46. package/ui.container-row/storybook/{stories.js → stories.ts} +11 -3
  47. package/ui.container-row/types.ts +59 -0
  48. package/ui.container-row/useAttrs.ts +18 -0
  49. package/ui.form-input/config.js +3 -3
  50. package/ui.form-label/config.js +1 -1
  51. package/ui.form-select/config.js +3 -0
  52. package/ui.form-textarea/config.js +5 -2
  53. package/web-types.json +182 -92
  54. package/ui.container-card/useAttrs.js +0 -15
  55. package/ui.container-col/useAttrs.js +0 -15
  56. package/ui.container-divider/useAttrs.js +0 -20
  57. package/ui.container-group/useAttrs.js +0 -15
  58. package/ui.container-modal/useAttrs.js +0 -19
  59. package/ui.container-modal-confirm/useAttrs.js +0 -15
  60. package/ui.container-row/useAttrs.js +0 -15
  61. /package/ui.container-accordion/{config.js → config.ts} +0 -0
  62. /package/ui.container-accordion/{constants.js → constants.ts} +0 -0
  63. /package/ui.container-card/{config.js → config.ts} +0 -0
  64. /package/ui.container-card/{constants.js → constants.ts} +0 -0
  65. /package/ui.container-col/{config.js → config.ts} +0 -0
  66. /package/ui.container-col/{constants.js → constants.ts} +0 -0
  67. /package/ui.container-divider/{config.js → config.ts} +0 -0
  68. /package/ui.container-divider/{constants.js → constants.ts} +0 -0
  69. /package/ui.container-group/{config.js → config.ts} +0 -0
  70. /package/ui.container-group/{constants.js → constants.ts} +0 -0
  71. /package/ui.container-modal/{config.js → config.ts} +0 -0
  72. /package/ui.container-modal/{constants.js → constants.ts} +0 -0
  73. /package/ui.container-modal-confirm/{config.js → config.ts} +0 -0
  74. /package/ui.container-modal-confirm/{constants.js → constants.ts} +0 -0
  75. /package/ui.container-page/{config.js → config.ts} +0 -0
  76. /package/ui.container-page/{constants.js → constants.ts} +0 -0
  77. /package/ui.container-row/{config.js → config.ts} +0 -0
  78. /package/ui.container-row/{constants.js → constants.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.512",
3
+ "version": "0.0.514",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
package/types.ts CHANGED
@@ -19,6 +19,15 @@ import UCalendarDefaultConfig from "./ui.form-calendar/config.ts";
19
19
  import UDatePickerConfig from "./ui.form-date-picker/config.ts";
20
20
  import UDatePickerRangeConfig from "./ui.form-date-picker-range/config.ts";
21
21
  import UDataTableConfig from "./ui.data-table/config.ts";
22
+ import UAccordionConfig from "./ui.container-accordion/config.ts";
23
+ import UCardConfig from "./ui.container-card/config.ts";
24
+ import UColConfig from "./ui.container-col/config.ts";
25
+ import UDividerConfig from "./ui.container-divider/config.ts";
26
+ import UGroupConfig from "./ui.container-group/config.ts";
27
+ import UModalConfig from "./ui.container-modal/config.ts";
28
+ import UModalConfirmConfig from "./ui.container-modal-confirm/config.ts";
29
+ import UPageConfig from "./ui.container-page/config.ts";
30
+ import URowConfig from "./ui.container-row/config.ts";
22
31
 
23
32
  import type { ComputedRef, MaybeRef, Ref } from "vue";
24
33
  import type { Props } from "tippy.js";
@@ -143,6 +152,15 @@ export interface Components {
143
152
  UDatePicker?: Partial<typeof UDatePickerConfig>;
144
153
  UDatePickerRange?: Partial<typeof UDatePickerRangeConfig>;
145
154
  UTable?: Partial<typeof UDataTableConfig>;
155
+ UAccordion?: Partial<typeof UAccordionConfig>;
156
+ UCard?: Partial<typeof UCardConfig>;
157
+ UCol?: Partial<typeof UColConfig>;
158
+ UDivider?: Partial<typeof UDividerConfig>;
159
+ UGroup?: Partial<typeof UGroupConfig>;
160
+ UModal?: Partial<typeof UModalConfig>;
161
+ UModalConfirm?: Partial<typeof UModalConfirmConfig>;
162
+ UPage?: Partial<typeof UPageConfig>;
163
+ URow?: Partial<typeof URowConfig>;
146
164
  }
147
165
 
148
166
  export interface Directives {
@@ -1,5 +1,7 @@
1
1
  import defaultConfig from "./config.ts";
2
2
 
3
+ import type { RouteLocationRaw } from "vue-router";
4
+
3
5
  export type Config = Partial<typeof defaultConfig>;
4
6
 
5
7
  export interface ULinkProps {
@@ -16,7 +18,7 @@ export interface ULinkProps {
16
18
  /**
17
19
  * Vue-router route object.
18
20
  */
19
- to?: object;
21
+ to?: RouteLocationRaw;
20
22
 
21
23
  /**
22
24
  * Link size.
@@ -1,80 +1,21 @@
1
- <template>
2
- <div :data-test="dataTest" v-bind="wrapperAttrs" @click="onClickItem">
3
- <div v-bind="bodyAttrs">
4
- <div v-bind="titleAttrs">
5
- {{ title }}
6
- <!--
7
- @slot Use it to add something instead of the toggle icon.
8
- @binding {string} icon-name
9
- @binding {string} icon-size
10
- @binding {boolean} opened
11
- -->
12
- <slot name="toggle" :icon-name="toggleIcon" :icon-size="size" :opened="isOpened">
13
- <UIcon :name="toggleIcon" :size="size" color="gray" internal v-bind="toggleIconAttrs" />
14
- </slot>
15
- </div>
16
-
17
- <div :id="`description-${elementId}`" v-bind="descriptionAttrs" v-text="description" />
18
- </div>
19
-
20
- <UDivider :size="dividerSize" v-bind="dividerAttrs" />
21
- </div>
22
- </template>
23
-
24
- <script setup>
1
+ <script lang="ts" setup>
25
2
  import { computed, ref, useId } from "vue";
26
3
 
27
4
  import UIcon from "../ui.image-icon/UIcon.vue";
28
5
  import UDivider from "../ui.container-divider/UDivider.vue";
29
6
  import { getDefault } from "../utils/ui.ts";
30
7
 
31
- import { UAccordion } from "./constants.js";
32
- import defaultConfig from "./config.js";
33
- import useAttrs from "./useAttrs.js";
8
+ import { UAccordion } from "./constants.ts";
9
+ import defaultConfig from "./config.ts";
10
+ import useAttrs from "./useAttrs.ts";
34
11
 
35
- defineOptions({ inheritAttrs: false });
12
+ import type { UAccordionProps } from "./types.ts";
36
13
 
37
- const props = defineProps({
38
- /**
39
- * Accordion title.
40
- */
41
- title: {
42
- type: String,
43
- required: true,
44
- },
45
-
46
- /**
47
- * Accordion description.
48
- */
49
- description: {
50
- type: String,
51
- required: true,
52
- },
53
-
54
- /**
55
- * Accordion size.
56
- * @values sm, md, lg
57
- */
58
- size: {
59
- type: String,
60
- default: getDefault(defaultConfig, UAccordion).size,
61
- },
62
-
63
- /**
64
- * Unique element id.
65
- */
66
- id: {
67
- type: String,
68
- default: "",
69
- },
14
+ defineOptions({ inheritAttrs: false });
70
15
 
71
- /**
72
- * Data-test attribute for automated testing.
73
- */
74
- dataTest: {
75
- type: String,
76
- default: "",
77
- },
16
+ const props = withDefaults(defineProps<UAccordionProps>(), {
17
+ size: getDefault<UAccordionProps>(defaultConfig, UAccordion).size,
18
+ dataTest: "",
78
19
  });
79
20
 
80
21
  const emit = defineEmits([
@@ -101,7 +42,7 @@ const {
101
42
  } = useAttrs(props, { isOpened });
102
43
 
103
44
  const toggleIcon = computed(() =>
104
- isOpened.value ? config.value.defaults.collapseIcon : config.value.defaults.expandIcon,
45
+ isOpened.value ? config.value?.defaults?.collapseIcon : config.value?.defaults?.expandIcon,
105
46
  );
106
47
 
107
48
  const dividerSize = computed(() => {
@@ -120,3 +61,26 @@ function onClickItem() {
120
61
  emit("click", elementId, isOpened.value);
121
62
  }
122
63
  </script>
64
+
65
+ <template>
66
+ <div :data-test="dataTest" v-bind="wrapperAttrs" @click="onClickItem">
67
+ <div v-bind="bodyAttrs">
68
+ <div v-bind="titleAttrs">
69
+ {{ title }}
70
+ <!--
71
+ @slot Use it to add something instead of the toggle icon.
72
+ @binding {string} icon-name
73
+ @binding {string} icon-size
74
+ @binding {boolean} opened
75
+ -->
76
+ <slot name="toggle" :icon-name="toggleIcon" :icon-size="size" :opened="isOpened">
77
+ <UIcon :name="toggleIcon" :size="size" color="gray" internal v-bind="toggleIconAttrs" />
78
+ </slot>
79
+ </div>
80
+
81
+ <div :id="`description-${elementId}`" v-bind="descriptionAttrs" v-text="description" />
82
+ </div>
83
+
84
+ <UDivider :size="dividerSize" v-bind="dividerAttrs" />
85
+ </div>
86
+ </template>
@@ -1,8 +1,8 @@
1
1
  import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
  import { getSource } from "../../utils/storybook.ts";
3
3
 
4
- import * as stories from "./stories.js";
5
- import defaultConfig from "../config.js?raw"
4
+ import * as stories from "./stories.ts";
5
+ import defaultConfig from "../config.ts?raw"
6
6
 
7
7
  <Meta of={stories} />
8
8
  <Title of={stories} />
@@ -3,6 +3,13 @@ import { getArgTypes, getSlotNames, getSlotsFragment } from "../../utils/storybo
3
3
  import UAccordion from "../../ui.container-accordion/UAccordion.vue";
4
4
  import UButton from "../../ui.button/UButton.vue";
5
5
 
6
+ import type { Meta, StoryFn } from "@storybook/vue3";
7
+ import type { UAccordionProps } from "../types.ts";
8
+
9
+ interface UAccordionArgs extends UAccordionProps {
10
+ slotTemplate?: string;
11
+ }
12
+
6
13
  /**
7
14
  * The `UAccordion` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-accordion)
8
15
  */
@@ -35,9 +42,9 @@ export default {
35
42
  argTypes: {
36
43
  ...getArgTypes(UAccordion.__name),
37
44
  },
38
- };
45
+ } as Meta;
39
46
 
40
- const DefaultTemplate = (args) => ({
47
+ const DefaultTemplate: StoryFn<UAccordionArgs> = (args: UAccordionArgs) => ({
41
48
  components: { UAccordion, UButton },
42
49
  setup() {
43
50
  const slots = getSlotNames(UAccordion.__name);
@@ -50,7 +57,7 @@ const DefaultTemplate = (args) => ({
50
57
  :key="index"
51
58
  v-bind="accordion"
52
59
  >
53
- ${args.slotTemplate || getSlotsFragment()}
60
+ ${args.slotTemplate || getSlotsFragment("")}
54
61
  </UAccordion>
55
62
  `,
56
63
  });
@@ -0,0 +1,35 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface UAccordionProps {
6
+ /**
7
+ * Accordion title.
8
+ */
9
+ title?: string;
10
+
11
+ /**
12
+ * Accordion description.
13
+ */
14
+ description?: string;
15
+
16
+ /**
17
+ * Accordion size.
18
+ */
19
+ size?: "sm" | "md" | "lg";
20
+
21
+ /**
22
+ * Unique element id.
23
+ */
24
+ id?: string;
25
+
26
+ /**
27
+ * Component config object.
28
+ */
29
+ config?: Partial<typeof defaultConfig>;
30
+
31
+ /**
32
+ * Data-test attribute for automated testing.
33
+ */
34
+ dataTest?: string;
35
+ }
@@ -1,10 +1,21 @@
1
1
  import { computed } from "vue";
2
2
  import useUI from "../composables/useUI.ts";
3
3
 
4
- import defaultConfig from "./config.js";
4
+ import defaultConfig from "./config.ts";
5
5
 
6
- export default function useAttrs(props, { isOpened }) {
7
- const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
6
+ import type { Ref } from "vue";
7
+ import type { UseAttrs } from "../types.ts";
8
+ import type { UAccordionProps, Config } from "./types.ts";
9
+
10
+ type ComponentState = {
11
+ isOpened: Ref<boolean>;
12
+ };
13
+
14
+ export default function useAttrs(
15
+ props: UAccordionProps,
16
+ { isOpened }: ComponentState,
17
+ ): UseAttrs<Config> {
18
+ const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI<Config>(
8
19
  defaultConfig,
9
20
  () => props.config,
10
21
  );
@@ -1,3 +1,46 @@
1
+ <script lang="ts" setup>
2
+ import { computed, useSlots } from "vue";
3
+
4
+ import UHeader from "../ui.text-header/UHeader.vue";
5
+ import UDivider from "../ui.container-divider/UDivider.vue";
6
+
7
+ import useAttrs from "./useAttrs.ts";
8
+
9
+ import type { UCardProps } from "./types.ts";
10
+
11
+ defineOptions({ inheritAttrs: false });
12
+
13
+ const props = withDefaults(defineProps<UCardProps>(), {
14
+ dataTest: "",
15
+ });
16
+
17
+ const slots = useSlots();
18
+
19
+ const isShownHeader = computed(() => {
20
+ const isHeaderLeftSlot = hasSlotContent(slots["header-left"]);
21
+ const isHeaderRightSlot = hasSlotContent(slots["header-left"]);
22
+
23
+ return props.title || isHeaderLeftSlot || isHeaderRightSlot;
24
+ });
25
+
26
+ const isShownFooter = computed(() => {
27
+ return hasSlotContent(slots["footer-left"]) || hasSlotContent(slots["footer-right"]);
28
+ });
29
+
30
+ const {
31
+ hasSlotContent,
32
+ wrapperAttrs,
33
+ titleAttrs,
34
+ dividerAttrs,
35
+ headerAttrs,
36
+ headerLeftAttrs,
37
+ headerLeftFallbackAttrs,
38
+ descriptionAttrs,
39
+ contentAttrs,
40
+ footerAttrs,
41
+ } = useAttrs(props);
42
+ </script>
43
+
1
44
  <template>
2
45
  <div :data-test="dataTest" v-bind="wrapperAttrs">
3
46
  <div v-if="isShownHeader" v-bind="headerAttrs">
@@ -37,74 +80,3 @@
37
80
  </div>
38
81
  </div>
39
82
  </template>
40
-
41
- <script setup>
42
- import { computed, useSlots } from "vue";
43
-
44
- import UHeader from "../ui.text-header/UHeader.vue";
45
- import UDivider from "../ui.container-divider/UDivider.vue";
46
-
47
- import useAttrs from "./useAttrs.js";
48
-
49
- defineOptions({ inheritAttrs: false });
50
-
51
- const slots = useSlots();
52
-
53
- const props = defineProps({
54
- /**
55
- * Card title.
56
- */
57
- title: {
58
- type: String,
59
- default: "",
60
- },
61
-
62
- /**
63
- * Card description.
64
- */
65
- description: {
66
- type: String,
67
- default: "",
68
- },
69
-
70
- /**
71
- * Component config object.
72
- */
73
- config: {
74
- type: Object,
75
- default: () => ({}),
76
- },
77
-
78
- /**
79
- * Data-test attribute for automated testing.
80
- */
81
- dataTest: {
82
- type: String,
83
- default: "",
84
- },
85
- });
86
-
87
- const isShownHeader = computed(() => {
88
- const isHeaderLeftSlot = hasSlotContent(slots["header-left"]);
89
- const isHeaderRightSlot = hasSlotContent(slots["header-left"]);
90
-
91
- return props.title || isHeaderLeftSlot || isHeaderRightSlot;
92
- });
93
-
94
- const isShownFooter = computed(() => {
95
- return hasSlotContent(slots["footer-left"]) || hasSlotContent(slots["footer-right"]);
96
- });
97
-
98
- const {
99
- hasSlotContent,
100
- wrapperAttrs,
101
- titleAttrs,
102
- dividerAttrs,
103
- headerAttrs,
104
- headerLeftAttrs,
105
- headerLeftFallbackAttrs,
106
- descriptionAttrs,
107
- contentAttrs,
108
- footerAttrs,
109
- } = useAttrs(props);
110
- </script>
@@ -1,8 +1,8 @@
1
1
  import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
  import { getSource } from "../../utils/storybook.ts";
3
3
 
4
- import * as stories from "./stories.js";
5
- import defaultConfig from "../config.js?raw"
4
+ import * as stories from "./stories.ts";
5
+ import defaultConfig from "../config.ts?raw"
6
6
 
7
7
  <Meta of={stories} />
8
8
  <Title of={stories} />
@@ -6,6 +6,13 @@ import UButton from "../../ui.button/UButton.vue";
6
6
  import UIcon from "../../ui.image-icon/UIcon.vue";
7
7
  import UHeader from "../../ui.text-header/UHeader.vue";
8
8
 
9
+ import type { Meta, StoryFn } from "@storybook/vue3";
10
+ import type { UCardProps } from "../types.ts";
11
+
12
+ interface UCardArgs extends UCardProps {
13
+ slotTemplate?: string;
14
+ }
15
+
9
16
  /**
10
17
  * The `UCard` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-card)
11
18
  */
@@ -19,7 +26,7 @@ export default {
19
26
  argTypes: {
20
27
  ...getArgTypes(UCard.__name),
21
28
  },
22
- };
29
+ } as Meta;
23
30
 
24
31
  const defaultTemplate = `
25
32
  <p>
@@ -34,7 +41,7 @@ const defaultTemplate = `
34
41
  </p>
35
42
  `;
36
43
 
37
- const DefaultTemplate = (args) => ({
44
+ const DefaultTemplate: StoryFn<UCardArgs> = (args: UCardArgs) => ({
38
45
  components: { UCard, UButton, UInput, UIcon, UHeader },
39
46
  setup() {
40
47
  const slots = getSlotNames(UCard.__name);
@@ -0,0 +1,25 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface UCardProps {
6
+ /**
7
+ * Card title.
8
+ */
9
+ title?: string;
10
+
11
+ /**
12
+ * Card description.
13
+ */
14
+ description?: string;
15
+
16
+ /**
17
+ * Component config object.
18
+ */
19
+ config?: Partial<typeof defaultConfig>;
20
+
21
+ /**
22
+ * Data-test attribute for automated testing.
23
+ */
24
+ dataTest?: string;
25
+ }
@@ -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 { UCardProps, Config } from "./types.ts";
7
+
8
+ export default function useAttrs(props: UCardProps): 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
+ }
@@ -1,88 +1,30 @@
1
- <template>
2
- <div v-bind="wrapperAttrs" :data-test="dataTest">
3
- <!-- @slot Use it to add something inside. -->
4
- <slot />
5
- </div>
6
- </template>
7
-
8
- <script setup>
1
+ <script lang="ts" setup>
9
2
  import { getDefault } from "../utils/ui.ts";
10
3
 
11
- import { UCol } from "./constants.js";
12
- import defaultConfig from "./config.js";
13
- import useAttrs from "./useAttrs.js";
14
-
15
- defineOptions({ inheritAttrs: false });
16
-
17
- const props = defineProps({
18
- /**
19
- * The distance between nested elements.
20
- * @values none, 3xs, 2xs, xs, sm, md, lg, xl, 2xl, 3xl
21
- */
22
- gap: {
23
- type: String,
24
- default: getDefault(defaultConfig, UCol).gap,
25
- },
26
-
27
- /**
28
- * Items horizontal align (align-items).
29
- * @values start, end, center, stretch, baseline
30
- */
31
- align: {
32
- type: String,
33
- default: getDefault(defaultConfig, UCol).align,
34
- },
4
+ import { UCol } from "./constants.ts";
5
+ import defaultConfig from "./config.ts";
6
+ import useAttrs from "./useAttrs.ts";
35
7
 
36
- /**
37
- * Items horizontal align for multi-row flex containers (align-content).
38
- * @values start, end, center, around, evenly, between, normal, stretch, baseline
39
- */
40
- content: {
41
- type: String,
42
- default: getDefault(defaultConfig, UCol).content,
43
- },
8
+ import type { UColProps } from "./types.ts";
44
9
 
45
- /**
46
- * Items vertical align (justify-content).
47
- * @values start, end, center, around, evenly, between
48
- */
49
- justify: {
50
- type: String,
51
- default: getDefault(defaultConfig, UCol).justify,
52
- },
53
-
54
- /**
55
- * Reverse nested items order.
56
- */
57
- reverse: {
58
- type: Boolean,
59
- default: getDefault(defaultConfig, UCol).reverse,
60
- },
61
-
62
- /**
63
- * Allow items to wrap (flex flex-wrap).
64
- */
65
- wrap: {
66
- type: Boolean,
67
- default: getDefault(defaultConfig, UCol).wrap,
68
- },
69
-
70
- /**
71
- * Component config object.
72
- */
73
- config: {
74
- type: Object,
75
- default: () => ({}),
76
- },
10
+ defineOptions({ inheritAttrs: false });
77
11
 
78
- /**
79
- * Data-test attribute for automated testing.
80
- */
81
- dataTest: {
82
- type: String,
83
- default: "",
84
- },
12
+ const props = withDefaults(defineProps<UColProps>(), {
13
+ gap: getDefault<UColProps>(defaultConfig, UCol).gap,
14
+ align: getDefault<UColProps>(defaultConfig, UCol).align,
15
+ content: getDefault<UColProps>(defaultConfig, UCol).content,
16
+ justify: getDefault<UColProps>(defaultConfig, UCol).justify,
17
+ reverse: getDefault<UColProps>(defaultConfig, UCol).reverse,
18
+ wrap: getDefault<UColProps>(defaultConfig, UCol).wrap,
19
+ dataTest: "",
85
20
  });
86
21
 
87
22
  const { wrapperAttrs } = useAttrs(props);
88
23
  </script>
24
+
25
+ <template>
26
+ <div v-bind="wrapperAttrs" :data-test="dataTest">
27
+ <!-- @slot Use it to add something inside. -->
28
+ <slot />
29
+ </div>
30
+ </template>
@@ -1,8 +1,8 @@
1
1
  import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
  import { getSource } from "../../utils/storybook.ts";
3
3
 
4
- import * as stories from "./stories.js";
5
- import defaultConfig from "../config.js?raw"
4
+ import * as stories from "./stories.ts";
5
+ import defaultConfig from "../config.ts?raw"
6
6
 
7
7
  <Meta of={stories} />
8
8
  <Title of={stories} />
@@ -4,6 +4,13 @@ import UCol from "../../ui.container-col/UCol.vue";
4
4
  import UInput from "../../ui.form-input/UInput.vue";
5
5
  import UButton from "../../ui.button/UButton.vue";
6
6
 
7
+ import type { Meta, StoryFn } from "@storybook/vue3";
8
+ import type { UColProps } from "../types.ts";
9
+
10
+ interface UColArgs extends UColProps {
11
+ slotTemplate?: string;
12
+ }
13
+
7
14
  /**
8
15
  * The `UCol` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-col)
9
16
  */
@@ -22,7 +29,7 @@ export default {
22
29
  },
23
30
  },
24
31
  },
25
- };
32
+ } as Meta;
26
33
 
27
34
  const defaultTemplate = `
28
35
  <UInput placeholder="Vasyl" label="Name" />
@@ -30,7 +37,7 @@ const defaultTemplate = `
30
37
  <UInput placeholder="Kyiv" label="Town" />
31
38
  `;
32
39
 
33
- const DefaultTemplate = (args) => ({
40
+ const DefaultTemplate: StoryFn<UColArgs> = (args: UColArgs) => ({
34
41
  components: { UCol, UInput, UButton },
35
42
  setup() {
36
43
  const slots = getSlotNames(UCol.__name);