vueless 0.0.774 → 0.0.776

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.774",
3
+ "version": "0.0.776",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -79,8 +79,8 @@ export default /*tw*/ {
79
79
  variant: "thirdary",
80
80
  class: `
81
81
  text-gray-900 dark:text-gray-100
82
- hover:text-gray-800 hover:bg-gray-800/5 dark:hover:text-gray-200 dark:hover:bg-gray-200/5
83
- active:text-gray-700 active:bg-gray-700/10 dark:active:text-gray-300 dark:active:bg-gray-300/10
82
+ hover:text-gray-800 hover:bg-gray-800/10 dark:hover:text-gray-200 dark:hover:bg-gray-200/10
83
+ active:text-gray-700 active:bg-gray-700/15 dark:active:text-gray-300 dark:active:bg-gray-300/15
84
84
  `,
85
85
  },
86
86
  {
@@ -110,7 +110,7 @@ export default /*tw*/ {
110
110
  variant: "thirdary",
111
111
  class: "hover:bg-white/10 active:bg-white/15",
112
112
  },
113
- { filled: true, variant: "thirdary", class: "bg-{color}-700/10 dark:bg-{color}-500/10" },
113
+ { filled: true, variant: "thirdary", class: "bg-{color}-700/5 dark:bg-{color}-500/5" },
114
114
  { filled: true, variant: "thirdary", color: ["grayscale", "white"], class: "bg-gray-800/5 dark:bg-gray-200/5" },
115
115
  { rightIcon: true, size: "2xs", class: "pr-1" },
116
116
  { rightIcon: true, size: "xs", class: "pr-2" },
@@ -97,32 +97,32 @@ const { getDataTest, optionsAttrs, toggleButtonInactiveAttrs, toggleButtonActive
97
97
  >
98
98
  <template #left="{ iconName }">
99
99
  <!--
100
- @slot Use it to add something before the label.
101
- @binding {object} option
102
- @binding {string} icon-name
103
- @binding {number} index
104
- -->
100
+ @slot Use it to add something before the label.
101
+ @binding {object} option
102
+ @binding {string} icon-name
103
+ @binding {number} index
104
+ -->
105
105
  <slot name="left" :option="option" :icon-name="iconName" :index="index" />
106
106
  </template>
107
107
 
108
108
  <template #default="{ label, iconName }">
109
109
  <!--
110
- @slot Use it to add something instead of the toggle option label.
111
- @binding {object} option
112
- @binding {string} label
113
- @binding {string} icon-name
114
- @binding {number} index
115
- -->
110
+ @slot Use it to add something instead of the toggle option label.
111
+ @binding {object} option
112
+ @binding {string} label
113
+ @binding {string} icon-name
114
+ @binding {number} index
115
+ -->
116
116
  <slot name="option" :option="option" :label="label" :icon-name="iconName" :index="index" />
117
117
  </template>
118
118
 
119
119
  <template #right="{ iconName }">
120
120
  <!--
121
- @slot Use it to add something after the label.
122
- @binding {object} option
123
- @binding {string} icon-name
124
- @binding {number} index
125
- -->
121
+ @slot Use it to add something after the label.
122
+ @binding {object} option
123
+ @binding {string} icon-name
124
+ @binding {number} index
125
+ -->
126
126
  <slot name="right" :option="option" :icon-name="iconName" :index="index" />
127
127
  </template>
128
128
  </UButton>
@@ -5,7 +5,7 @@ export default /*tw*/ {
5
5
  base: "fixed top-0 flex items-center z-30 overflow-hidden border rounded-none",
6
6
  variants: {
7
7
  actionsHeader: {
8
- true: "rounded-t-dynamic border-blue-200 bg-blue-50",
8
+ true: "rounded-t-dynamic border-brand-200 bg-brand-50",
9
9
  },
10
10
  },
11
11
  compoundVariants: [
@@ -373,14 +373,14 @@ SlotHeaderActions.args = {
373
373
  <UButton
374
374
  label="Edit"
375
375
  variant="thirdary"
376
- color="blue"
376
+ color="brand"
377
377
  size="sm"
378
378
  />
379
379
 
380
380
  <UButton
381
381
  label="Delete"
382
382
  variant="thirdary"
383
- color="blue"
383
+ color="brand"
384
384
  size="sm"
385
385
  />
386
386
  </URow>
@@ -1,4 +1,4 @@
1
- import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
1
+ import { Markdown, Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
  import { getSource } from "../../utils/storybook.ts";
3
3
 
4
4
  import * as stories from "./stories.ts";
@@ -12,5 +12,21 @@ import defaultConfig from "../config.ts?raw"
12
12
  <Controls of={stories.Default} />
13
13
  <Stories of={stories} />
14
14
 
15
+ ## Option meta keys
16
+ Keys you may/have to provide to component in an option object.
17
+
18
+ <Markdown>
19
+ {`
20
+ | Key name | Description | Type |
21
+ | ------------------| ---------------------------------------| ---------------------------------------|
22
+ | value | Native value attribute | Boolean, String, Number, Array, Object |
23
+ | trueValue | Own value for checkbox checked state | Boolean, String, Number, Array, Object |
24
+ | falseValue | Own value for checkbox unchecked state | Boolean, String, Number, Array, Object |
25
+ | label | Option label | String |
26
+ | icon | Option icon | String |
27
+ | description | Option description | Number |
28
+ `}
29
+ </Markdown>
30
+
15
31
  ## Default config
16
32
  <Source code={getSource(defaultConfig)} language="jsx" dark />
@@ -12,10 +12,11 @@ import UCol from "../../ui.container-col/UCol.vue";
12
12
 
13
13
  import type { Meta, StoryFn } from "@storybook/vue3";
14
14
  import type { Props } from "../types.ts";
15
+ import { computed } from "vue";
15
16
 
16
17
  interface UCheckboxArgs extends Props {
17
18
  slotTemplate?: string;
18
- enum: "size";
19
+ enum: "size" | "labelAlign" | "color";
19
20
  }
20
21
 
21
22
  export default {
@@ -23,7 +24,7 @@ export default {
23
24
  title: "Form Inputs & Controls / Checkbox",
24
25
  component: UCheckbox,
25
26
  args: {
26
- label: "Label",
27
+ label: "Subscribe to the newsletter",
27
28
  },
28
29
  argTypes: {
29
30
  ...getArgTypes(UCheckbox.__name),
@@ -106,19 +107,23 @@ const ValueTypesTemplate: StoryFn<UCheckboxArgs> = (args: UCheckboxArgs) => ({
106
107
  const EnumVariantTemplate: StoryFn<UCheckboxArgs> = (args: UCheckboxArgs, { argTypes }) => ({
107
108
  components: { UCheckbox, UCol },
108
109
  setup() {
110
+ const isColorStory = computed(() => args.enum === "color");
111
+
109
112
  return {
110
113
  args,
111
114
  options: argTypes?.[args.enum]?.options,
115
+ isColorStory,
112
116
  };
113
117
  },
114
118
  template: `
115
- <UCol gap="xl">
119
+ <UCol gap="xl" :class="{ 'flex-row': isColorStory }">
116
120
  <UCheckbox
117
121
  v-for="(option, index) in options"
118
122
  :key="index"
119
123
  v-bind="args"
120
124
  :[args.enum]="option"
121
- :label="option"
125
+ :label="isColorStory ? option : args.label"
126
+ :description="isColorStory ? '' : option"
122
127
  />
123
128
  </UCol>
124
129
  `,
@@ -127,23 +132,60 @@ const EnumVariantTemplate: StoryFn<UCheckboxArgs> = (args: UCheckboxArgs, { argT
127
132
  export const Default = DefaultTemplate.bind({});
128
133
  Default.args = {};
129
134
 
135
+ export const Description = DefaultTemplate.bind({});
136
+ Description.args = { description: "Receive updates and exclusive offers directly to your inbox." };
137
+
138
+ export const Error = DefaultTemplate.bind({});
139
+ Error.args = { error: "Please agree to the Terms and Conditions before proceeding." };
140
+
141
+ export const Disabled = DefaultTemplate.bind({});
142
+ Disabled.args = { disabled: true };
143
+
130
144
  export const CustomValues = ValueTypesTemplate.bind({});
131
145
  CustomValues.args = {};
146
+ CustomValues.parameters = {
147
+ docs: {
148
+ description: {
149
+ story:
150
+ // eslint-disable-next-line vue/max-len
151
+ "You can pass custom `trueValue` and `falseValue` props, that can be of different types (see object meta keys table below).",
152
+ },
153
+ },
154
+ };
132
155
 
133
156
  export const Sizes = EnumVariantTemplate.bind({});
134
157
  Sizes.args = { enum: "size" };
135
158
 
136
- export const Disabled = DefaultTemplate.bind({});
137
- Disabled.args = { disabled: true };
159
+ export const LabelPlacement = EnumVariantTemplate.bind({});
160
+ LabelPlacement.args = { enum: "labelAlign" };
138
161
 
139
- export const Description = DefaultTemplate.bind({});
140
- Description.args = { description: "Some description" };
162
+ export const Color = EnumVariantTemplate.bind({});
163
+ Color.args = { enum: "color", modelValue: true };
164
+
165
+ export const Partial = DefaultTemplate.bind({});
166
+ Partial.args = { partial: true };
167
+ Partial.parameters = {
168
+ docs: {
169
+ description: {
170
+ story: "Make checkbox partially checked (change the checked tick to a minus).",
171
+ },
172
+ },
173
+ };
174
+
175
+ export const SlotLabel = DefaultTemplate.bind({});
176
+ SlotLabel.args = {
177
+ slotTemplate: `
178
+ <template #label>
179
+ <UBadge label="This option is required" color="red" size="sm" />
180
+ </template>
181
+ `,
182
+ };
141
183
 
142
- export const SlotFooter = DefaultTemplate.bind({});
143
- SlotFooter.args = {
184
+ export const SlotBottom = DefaultTemplate.bind({});
185
+ SlotBottom.args = {
144
186
  slotTemplate: `
145
- <template #footer>
146
- <UBadge label="favourite" color="green" size="sm" />
187
+ <template #bottom>
188
+ <UBadge label="Subscription is optional" color="green" size="sm" />
147
189
  </template>
148
190
  `,
149
191
  };
@@ -12,5 +12,8 @@ import defaultConfig from "../config.ts?raw"
12
12
  <Controls of={stories.Default} />
13
13
  <Stories of={stories} />
14
14
 
15
+ ## Option meta keys
16
+ Full list of keys you may/have to provide to component in an option object can be found here: [UCheckbox docs](https://ui.vueless.com/?path=/docs/3100--docs).
17
+
15
18
  ## Default config
16
19
  <Source code={getSource(defaultConfig)} language="jsx" dark />
@@ -10,6 +10,7 @@ import UCheckbox from "../../ui.form-checkbox/UCheckbox.vue";
10
10
  import UAlert from "../../ui.text-alert/UAlert.vue";
11
11
  import UCol from "../../ui.container-col/UCol.vue";
12
12
  import URow from "../../ui.container-row/URow.vue";
13
+ import UBadge from "../../ui.text-badge/UBadge.vue";
13
14
 
14
15
  import type { Meta, StoryFn } from "@storybook/vue3";
15
16
  import type { Props } from "../types.ts";
@@ -26,13 +27,13 @@ export default {
26
27
  title: "Form Inputs & Controls / Checkbox Group",
27
28
  component: UCheckboxGroup,
28
29
  args: {
29
- label: "Label",
30
+ label: "Select your preferred communication methods:",
30
31
  options: [
31
- { label: "checkbox 1", value: "1" },
32
- { label: "checkbox 2", value: "2" },
33
- { label: "checkbox 3", value: "3" },
32
+ { label: "Email Notifications", value: "email" },
33
+ { label: "SMS Alerts", value: "sms" },
34
+ { label: "Push Notifications", value: "push" },
34
35
  ],
35
- value: ["One"],
36
+ value: [],
36
37
  },
37
38
  argTypes: {
38
39
  ...getArgTypes(UCheckboxGroup.__name),
@@ -45,7 +46,7 @@ export default {
45
46
  } as Meta;
46
47
 
47
48
  const DefaultTemplate: StoryFn<UCheckboxGroupArgs> = (args: UCheckboxGroupArgs) => ({
48
- components: { UCheckboxGroup, UCheckbox, UAlert, URow, UCol },
49
+ components: { UCheckboxGroup, UCheckbox, UAlert, URow, UCol, UBadge },
49
50
  setup() {
50
51
  const slots = getSlotNames(UCheckboxGroup.__name);
51
52
 
@@ -63,7 +64,7 @@ const DefaultTemplate: StoryFn<UCheckboxGroupArgs> = (args: UCheckboxGroupArgs)
63
64
  </UCheckboxGroup>
64
65
 
65
66
  <URow>
66
- <UAlert size="sm" color="gray">
67
+ <UAlert size="sm" variant="thirdary" color="green" bordered>
67
68
  <p>Selected value: {{ value }}</p>
68
69
  </UAlert>
69
70
  </URow>
@@ -102,50 +103,52 @@ const EnumVariantTemplate: StoryFn<UCheckboxGroupArgs> = (
102
103
  });
103
104
 
104
105
  export const Default = DefaultTemplate.bind({});
105
- Default.args = {
106
- name: "Default",
107
- slotTemplate: `
108
- <template v-for="(radio, index) in args.options" :key="index">
109
- <UCheckbox v-bind="radio"/>
110
- </template>
111
- `,
112
- options: [
113
- { name: "Default", label: "String", value: "One" },
114
- { name: "Default", label: "Boolean", value: false },
115
- {
116
- name: "Default",
117
- label: "Object",
106
+ Default.args = { name: "Default" };
118
107
 
119
- value: { key: "value" },
120
- },
121
- {
122
- name: "Default",
123
- label: "Array",
124
- value: ["Array", 1],
125
- },
126
- ],
108
+ export const Description = DefaultTemplate.bind({});
109
+ Description.args = {
110
+ name: "Description",
111
+ description: "You may select multiple options that best fit your preferences.",
127
112
  };
128
113
 
114
+ export const Error = DefaultTemplate.bind({});
115
+ Error.args = { name: "Error", error: "some error" };
116
+
117
+ export const Disabled = DefaultTemplate.bind({});
118
+ Disabled.args = { name: "Disabled", disabled: true };
119
+
129
120
  export const Options = DefaultTemplate.bind({});
130
121
  Options.args = {
131
122
  name: "Options",
132
123
  options: [
133
- { name: "Options", label: "Boolean", value: false },
134
- { name: "Options", label: "String", value: "One" },
135
- { name: "Options", label: "Number", value: 3 },
136
- { name: "Options", label: "Object", value: { key: "value" } },
137
- { name: "Options", label: "Array", value: ["Array", 1] },
124
+ { label: "String", value: "Subscribed" },
125
+ { label: "Number", value: 42 },
126
+ { label: "Boolean", value: true },
127
+ { label: "Object", value: { id: 101, status: "active" } },
128
+ { label: "Array", value: ["Admin", "Editor"] },
138
129
  ],
139
130
  };
140
-
141
- export const Disabled = DefaultTemplate.bind({});
142
- Disabled.args = { name: "Disabled", disabled: true };
143
-
144
- export const Error = DefaultTemplate.bind({});
145
- Error.args = { name: "Error", error: "some error" };
131
+ Options.parameters = {
132
+ docs: {
133
+ description: {
134
+ story:
135
+ // eslint-disable-next-line vue/max-len
136
+ "Every option you pass via the `options` prop can be of different type (`Boolean` | `String` | `Number` | `Array` | `Object`).",
137
+ },
138
+ },
139
+ };
146
140
 
147
141
  export const Colors = EnumVariantTemplate.bind({});
148
142
  Colors.args = { enum: "color", name: "Colors" };
149
143
 
150
144
  export const Sizes = EnumVariantTemplate.bind({});
151
145
  Sizes.args = { enum: "size", name: "Sizes" };
146
+
147
+ export const SlotLabel = DefaultTemplate.bind({});
148
+ SlotLabel.args = {
149
+ slotTemplate: `
150
+ <template #label>
151
+ <UBadge label="At least one option is required" color="green" />
152
+ </template>
153
+ `,
154
+ };
@@ -90,7 +90,8 @@ const multiStateCheckboxAttrs = computed(() => {
90
90
  :name="name"
91
91
  :size="size"
92
92
  :color="color"
93
- :placement="placement"
93
+ :label-align="labelAlign"
94
+ :disabled="disabled"
94
95
  v-bind="multiStateCheckboxAttrs"
95
96
  @input="onClickCheckbox"
96
97
  />
@@ -3,7 +3,7 @@ export default /*tw*/ {
3
3
  defaults: {
4
4
  color: "brand",
5
5
  size: "md",
6
- placement: "left",
6
+ labelAlign: "right",
7
7
  disabled: false,
8
8
  },
9
9
  };
@@ -6,14 +6,14 @@ import {
6
6
  } from "../../utils/storybook.ts";
7
7
 
8
8
  import UCheckboxMultiState from "../../ui.form-checkbox-multi-state/UCheckboxMultiState.vue";
9
- import URow from "../../ui.container-row/URow.vue";
9
+ import UCol from "../../ui.container-col/UCol.vue";
10
10
 
11
11
  import type { Meta, StoryFn } from "@storybook/vue3";
12
12
  import type { Props } from "../types.ts";
13
13
 
14
14
  interface UCheckboxMultiStateArgs extends Props {
15
15
  slotTemplate?: string;
16
- enum: "size";
16
+ enum: "size" | "color" | "labelAlign";
17
17
  }
18
18
 
19
19
  export default {
@@ -22,9 +22,24 @@ export default {
22
22
  component: UCheckboxMultiState,
23
23
  args: {
24
24
  options: [
25
- { value: false, label: "empty", icon: "", description: "checkbox empty" },
26
- { value: true, label: "selected", icon: "check", description: "checkbox selected" },
27
- { value: null, label: "not selected", icon: "remove", description: "checkbox unselected" },
25
+ {
26
+ value: false,
27
+ label: "Not Selected",
28
+ icon: "",
29
+ description: "The checkbox is currently not selected.",
30
+ },
31
+ {
32
+ value: true,
33
+ label: "Selected",
34
+ icon: "check",
35
+ description: "The checkbox has been selected.",
36
+ },
37
+ {
38
+ value: null,
39
+ label: "Indeterminate",
40
+ icon: "remove",
41
+ description: "The checkbox is in an indeterminate state.",
42
+ },
28
43
  ],
29
44
  },
30
45
  argTypes: {
@@ -55,7 +70,7 @@ const EnumVariantTemplate: StoryFn<UCheckboxMultiStateArgs> = (
55
70
  args: UCheckboxMultiStateArgs,
56
71
  { argTypes },
57
72
  ) => ({
58
- components: { UCheckboxMultiState, URow },
73
+ components: { UCheckboxMultiState, UCol },
59
74
  setup() {
60
75
  return {
61
76
  args,
@@ -63,7 +78,7 @@ const EnumVariantTemplate: StoryFn<UCheckboxMultiStateArgs> = (
63
78
  };
64
79
  },
65
80
  template: `
66
- <URow>
81
+ <UCol>
67
82
  <UCheckboxMultiState
68
83
  v-for="(option, index) in options"
69
84
  :key="index"
@@ -72,12 +87,21 @@ const EnumVariantTemplate: StoryFn<UCheckboxMultiStateArgs> = (
72
87
  :[args.enum]="option"
73
88
  :label="option"
74
89
  />
75
- </URow>
90
+ </UCol>
76
91
  `,
77
92
  });
78
93
 
79
94
  export const Default = DefaultTemplate.bind({});
80
95
  Default.args = {};
81
96
 
97
+ export const Disabled = DefaultTemplate.bind({});
98
+ Disabled.args = { disabled: true };
99
+
100
+ export const LabelPlacement = EnumVariantTemplate.bind({});
101
+ LabelPlacement.args = { enum: "labelAlign" };
102
+
82
103
  export const Sizes = EnumVariantTemplate.bind({});
83
104
  Sizes.args = { enum: "size" };
105
+
106
+ export const Color = EnumVariantTemplate.bind({});
107
+ Color.args = { enum: "color" };
@@ -54,7 +54,7 @@ export interface Props {
54
54
  /**
55
55
  * Label placement.
56
56
  */
57
- placement?: "left" | "right";
57
+ labelAlign?: "left" | "right";
58
58
 
59
59
  /**
60
60
  * Make checkbox disabled.
@@ -8,7 +8,7 @@ export default /*tw*/ {
8
8
  filled: true,
9
9
  variant: "thirdary",
10
10
  color: "grayscale",
11
- class: "focus:bg-gray-800/10 bg-gray-800/10 dark:focus:bg-gray-200/10 dark:bg-gray-200/10",
11
+ class: "bg-gray-800/10 dark:bg-gray-200/10",
12
12
  },
13
13
  ],
14
14
  },
@@ -26,7 +26,7 @@ export default {
26
26
  component: UInput,
27
27
  args: {
28
28
  label: "Full Name",
29
- modelValue: "Satoshi Nakamoto",
29
+ modelValue: "John Doe",
30
30
  },
31
31
  argTypes: {
32
32
  ...getArgTypes(UInput.__name),
@@ -1,4 +1,4 @@
1
- import { inject, onBeforeUnmount, readonly, ref } from "vue";
1
+ import { inject, onBeforeMount, onBeforeUnmount, readonly, ref } from "vue";
2
2
 
3
3
  import type { Ref } from "vue";
4
4
 
@@ -49,8 +49,10 @@ export function createLoaderProgress(): LoaderProgress {
49
49
  export function useLoaderProgress(): LoaderProgress {
50
50
  const loaderProgress = inject<LoaderProgress>(LoaderProgressSymbol);
51
51
 
52
- window.addEventListener("loaderProgressOn", setLoaderOnHandler as EventListener);
53
- window.addEventListener("loaderProgressOff", setLoaderOffHandler as EventListener);
52
+ onBeforeMount(() => {
53
+ window.addEventListener("loaderProgressOn", setLoaderOnHandler as EventListener);
54
+ window.addEventListener("loaderProgressOff", setLoaderOffHandler as EventListener);
55
+ });
54
56
 
55
57
  onBeforeUnmount(() => {
56
58
  window.removeEventListener("loaderProgressOn", setLoaderOnHandler as EventListener);
@@ -72,7 +72,7 @@ export function getDocsDescription(componentName: string | undefined) {
72
72
  let viewOnGitHub = "";
73
73
 
74
74
  if (COMPONENTS[componentName as ComponentNames]) {
75
- viewOnGitHub = `| [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/${COMPONENTS[componentName as ComponentNames]})`;
75
+ viewOnGitHub = `| <a href="https://github.com/vuelessjs/vueless/tree/main/src/${COMPONENTS[componentName as ComponentNames]}" target="_blank">View on GitHub</a>`;
76
76
  }
77
77
 
78
78
  return {