vueless 0.0.815 → 0.0.817

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.815",
3
+ "version": "0.0.817",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -7,10 +7,10 @@ Each character in the table below can be used in `dateFormat` and `userFormat` o
7
7
  {`
8
8
  | Token | Description | Example |
9
9
  | ----- | --------------------------------------------------------- | ------------------------------------------------------------- |
10
- | r | Relative representation of the day | Today, tomorrow, yesterday
11
10
  | d | Day of the month, 2 digits with leading zeros | 01 to 31 |
12
11
  | D | A textual representation of a day | Mon through Sun |
13
- | l | A full textual representation of the day of the week | Sunday through Saturday |
12
+ | l | A full textual representation of the day of the week | Sunday Saturday |
13
+ | r | A full textual representation of the day of the week with relative representation of the day | Today, Tomorrow, Yesterday, Sunday – Saturday |
14
14
  | j | Day of the month without leading zeros | 1 to 31 |
15
15
  | w | Numeric representation of the day of the week | 0 (for Sunday) through 6 (for Saturday) |
16
16
  | W | Numeric representation of the week | 0 (first week of the year) through 52 (last week of the year) |
@@ -76,14 +76,14 @@ const LoadingTemplate: StoryFn<ULoaderArgs> = (args: ULoaderArgs) => ({
76
76
  isLoading.value = !isLoading.value;
77
77
  }
78
78
 
79
- const isLoading = ref(false);
79
+ const isLoading = ref(true);
80
80
 
81
81
  return { args, isLoading, toggleLoader };
82
82
  },
83
83
  template: `
84
84
  <URow align="center">
85
+ <UButton @click="toggleLoader" size="sm">Toggle Loader</UButton>
85
86
  <ULoader v-bind="args" :loading="isLoading" />
86
- <UButton @click="toggleLoader" size="sm">ToggleLoader</UButton>
87
87
  </URow>
88
88
  `,
89
89
  });
@@ -99,3 +99,13 @@ Colors.args = { enum: "color" };
99
99
 
100
100
  export const Loading = LoadingTemplate.bind({});
101
101
  Loading.args = {};
102
+
103
+ export const SlotDefault = DefaultTemplate.bind({});
104
+ SlotDefault.args = {
105
+ size: "lg",
106
+ slotTemplate: `
107
+ <template #default>
108
+ <img src="https://media.tenor.com/9zmtHZ0tIjkAAAAi/nyancat-rainbow-cat.gif" alt="Cat" />
109
+ </template>
110
+ `,
111
+ };
@@ -1,3 +1,4 @@
1
+ import { ref, computed } from "vue";
1
2
  import {
2
3
  getArgTypes,
3
4
  getSlotNames,
@@ -7,7 +8,7 @@ import {
7
8
 
8
9
  import ULoaderOverlay from "../ULoaderOverlay.vue";
9
10
  import UButton from "../../ui.button/UButton.vue";
10
- import UCol from "../../ui.container-col/UCol.vue";
11
+ import USelect from "../../ui.form-select/USelect.vue";
11
12
 
12
13
  import { useLoaderOverlay } from "../useLoaderOverlay.ts";
13
14
 
@@ -16,6 +17,7 @@ import type { Props } from "../types.ts";
16
17
 
17
18
  interface ULoaderOverlayArgs extends Props {
18
19
  slotTemplate?: string;
20
+ enum: "color";
19
21
  }
20
22
 
21
23
  export default {
@@ -43,42 +45,95 @@ const DefaultTemplate: StoryFn<ULoaderOverlayArgs> = (args: ULoaderOverlayArgs)
43
45
  return { args, slots };
44
46
  },
45
47
  template: `
46
- <ULoaderOverlay v-bind="args" class="w-full h-full">
48
+ <ULoaderOverlay v-bind="args" :config="{ overlay: 'h-full w-full' }">
47
49
  ${args.slotTemplate || getSlotsFragment("")}
48
50
  </ULoaderOverlay>
49
51
  `,
50
52
  });
51
53
 
54
+ const EnumVariantTemplate: StoryFn<ULoaderOverlayArgs> = (
55
+ args: ULoaderOverlayArgs,
56
+ { argTypes },
57
+ ) => ({
58
+ components: { ULoaderOverlay, USelect },
59
+ setup() {
60
+ const selectModel = ref(null);
61
+ const options = computed(() =>
62
+ argTypes?.[args.enum]?.options?.map((label, id) => ({ label, id })),
63
+ );
64
+ const selectedValue = computed(
65
+ () => options.value?.find((option) => option.id === selectModel.value)?.label,
66
+ );
67
+
68
+ return {
69
+ args,
70
+ selectModel,
71
+ selectedValue,
72
+ options,
73
+ };
74
+ },
75
+ template: `
76
+ <USelect
77
+ v-model="selectModel"
78
+ :options="options"
79
+ placeholder="Select loader color..."
80
+ open-direction="bottom"
81
+ class="max-w-60 absolute z-50"
82
+ />
83
+
84
+ <ULoaderOverlay
85
+ v-bind="args"
86
+ :[args.enum]="selectedValue"
87
+ :config="{ overlay: 'h-full w-full z-10' }"
88
+ />
89
+ `,
90
+ });
91
+
52
92
  const LoadingTemplate: StoryFn<ULoaderOverlayArgs> = (args: ULoaderOverlayArgs) => ({
53
- components: { ULoaderOverlay, UButton, UCol },
93
+ components: { ULoaderOverlay, UButton },
54
94
  setup() {
55
95
  const loaderOverlay = useLoaderOverlay();
56
96
 
57
- const loaderOverlayOn = loaderOverlay?.loaderOverlayOn || (() => {});
58
- const loaderOverlayOff = loaderOverlay?.loaderOverlayOff || (() => {});
59
- const isLoading = loaderOverlay?.isLoading || { value: false };
97
+ const loaderOverlayOn = loaderOverlay.loaderOverlayOn;
98
+ const loaderOverlayOff = loaderOverlay.loaderOverlayOff;
99
+ const isLoading = loaderOverlay.isLoading;
60
100
 
61
101
  function toggleLoading() {
62
- if (isLoading.value) {
63
- loaderOverlayOff();
64
- } else {
65
- loaderOverlayOn();
66
- }
102
+ isLoading.value ? loaderOverlayOff() : loaderOverlayOn();
67
103
  }
68
104
 
69
- return { args, loaderOverlayOn, loaderOverlayOff, isLoading, toggleLoading };
105
+ return { args, isLoading, toggleLoading };
70
106
  },
71
107
  template: `
72
- <UCol align="center" class="pb-4">
73
- <UButton label="Toggle loading" size="sm" @click="toggleLoading"/>
74
- </UCol>
108
+ <UButton
109
+ label="Toggle loading"
110
+ size="sm"
111
+ class="absolute z-50"
112
+ @click="toggleLoading"
113
+ />
75
114
 
76
- <ULoaderOverlay v-bind="args" class="!static w-full h-96" />
115
+ <ULoaderOverlay
116
+ v-bind="args"
117
+ :loading="isLoading"
118
+ :config="{ overlay: 'h-full w-full z-10' }"
119
+ />
77
120
  `,
78
121
  });
79
122
 
80
123
  export const Default = DefaultTemplate.bind({});
81
124
  Default.args = {};
82
125
 
83
- export const LoadingToggling = LoadingTemplate.bind({});
84
- LoadingToggling.args = {};
126
+ export const Loading = LoadingTemplate.bind({});
127
+ Loading.args = {};
128
+
129
+ export const Color = EnumVariantTemplate.bind({});
130
+ Color.args = { enum: "color" };
131
+
132
+ export const SlotDefault = DefaultTemplate.bind({});
133
+ SlotDefault.args = {
134
+ slotTemplate: `
135
+ <template #default>
136
+ <img src="https://media.tenor.com/9zmtHZ0tIjkAAAAi/nyancat-rainbow-cat.gif" alt="Cat" />
137
+ </template>
138
+ `,
139
+ };
@@ -1,3 +1,4 @@
1
+ import { ref } from "vue";
1
2
  import { getArgTypes, getSlotNames, getDocsDescription } from "../../utils/storybook.ts";
2
3
 
3
4
  import ULoaderProgress from "../ULoaderProgress.vue";
@@ -14,7 +15,7 @@ import type { Props } from "../types.ts";
14
15
 
15
16
  interface ULoaderProgressArgs extends Props {
16
17
  slotTemplate?: string;
17
- enum: "color";
18
+ enum: "color" | "size";
18
19
  }
19
20
 
20
21
  export default {
@@ -82,7 +83,7 @@ const EnumVariantTemplate: StoryFn<ULoaderProgressArgs> = (
82
83
  >
83
84
  <UBadge
84
85
  :label="option"
85
- :[args.enum]="option"
86
+ :[args.enum]="args.enum !== 'size' ? option : undefined"
86
87
  />
87
88
  <ULoaderProgress
88
89
  resources="https://api.publicapis.org/images"
@@ -96,8 +97,33 @@ const EnumVariantTemplate: StoryFn<ULoaderProgressArgs> = (
96
97
  `,
97
98
  });
98
99
 
100
+ const LoadingTemplate: StoryFn<ULoaderProgressArgs> = (args: ULoaderProgressArgs) => ({
101
+ components: { ULoaderProgress, UButton, URow },
102
+ setup() {
103
+ function toggleLoader() {
104
+ isLoading.value = !isLoading.value;
105
+ }
106
+
107
+ const isLoading = ref(false);
108
+
109
+ return { args, isLoading, toggleLoader };
110
+ },
111
+ template: `
112
+ <URow align="center">
113
+ <UButton @click="toggleLoader" size="sm">Toggle Loader</UButton>
114
+ <ULoaderProgress v-bind="args" :loading="isLoading" />
115
+ </URow>
116
+ `,
117
+ });
118
+
99
119
  export const Default = DefaultTemplate.bind({});
100
120
  Default.args = {};
101
121
 
122
+ export const Size = EnumVariantTemplate.bind({});
123
+ Size.args = { enum: "size" };
124
+
102
125
  export const Color = EnumVariantTemplate.bind({});
103
126
  Color.args = { enum: "color" };
127
+
128
+ export const Loading = LoadingTemplate.bind({});
129
+ Loading.args = {};