vueless 0.0.681 → 0.0.682

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.681",
3
+ "version": "0.0.682",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -43,9 +43,11 @@ const DefaultTemplate: StoryFn<ULinkArgs> = (args: ULinkArgs) => ({
43
43
  return { args, slots };
44
44
  },
45
45
  template: `
46
- <ULink v-if="args.block" v-bind="args" :config="{ wrapper: 'border-2 border-dashed border-green-500 p-2' }">
47
- ${args.slotTemplate || getSlotsFragment("")}
48
- </ULink>
46
+ <div v-if="args.block" class="border-2 border-dashed border-green-500 p-2 rounded-dynamic">
47
+ <ULink v-bind="args">
48
+ ${args.slotTemplate || getSlotsFragment("")}
49
+ </ULink>
50
+ </div>
49
51
  <ULink v-else v-bind="args">
50
52
  ${args.slotTemplate || getSlotsFragment("")}
51
53
  </ULink>
@@ -151,8 +153,9 @@ export const UnderlineVariants: StoryFn<ULinkArgs> = (args: ULinkArgs, { argType
151
153
  setup() {
152
154
  const variants = [
153
155
  { name: "Default", props: {} },
154
- { name: "Underlined", props: { underlined: true } },
155
156
  { name: "Dashed", props: { dashed: true } },
157
+ { name: "Underlined", props: { underlined: true } },
158
+ { name: "No underline", props: { underlined: false } },
156
159
  ];
157
160
 
158
161
  const colors = argTypes?.color?.options;
@@ -179,7 +179,7 @@ DefaultSlot.args = {
179
179
  <UBadge label="Download" color="green" right-icon="download" />
180
180
  </UToggleItem>
181
181
  <UToggleItem value="2">
182
- <UBadge label="Edit" color="amber" right-icon="edit" />
182
+ <UBadge label="Edit" color="amber" right-icon="edit_note" />
183
183
  </UToggleItem>
184
184
  <UToggleItem value="3">
185
185
  <UBadge label="Delete" color="red" right-icon="delete" />
@@ -89,7 +89,7 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
89
89
  <template #left>
90
90
  <!--
91
91
  @slot Use it to add something before the label.
92
- @binding {string} label
92
+ @binding {boolean} opened
93
93
  -->
94
94
  <slot name="left" :opened="isShownOptions" />
95
95
  </template>
@@ -105,10 +105,10 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
105
105
 
106
106
  <template #right>
107
107
  <!--
108
- @slot Use it to add something after the label.
108
+ @slot Use it to add something instead of the toggle icon.
109
109
  @binding {boolean} opened
110
110
  -->
111
- <slot v-if="!noIcon" name="right" :opened="isShownOptions">
111
+ <slot v-if="!noIcon" name="toggle" :opened="isShownOptions">
112
112
  <UIcon
113
113
  internal
114
114
  color="inherit"
@@ -7,7 +7,9 @@ import {
7
7
 
8
8
  import UDropdownBadge from "../../ui.dropdown-badge/UDropdownBadge.vue";
9
9
  import URow from "../../ui.container-row/URow.vue";
10
+ import UCol from "../../ui.container-col/UCol.vue";
10
11
  import UIcon from "../../ui.image-icon/UIcon.vue";
12
+ import ULink from "../../ui.button-link/ULink.vue";
11
13
 
12
14
  import type { Meta, StoryFn } from "@storybook/vue3";
13
15
  import type { Props } from "../types.ts";
@@ -17,7 +19,7 @@ interface DefaultUDropdownBadgeArgs extends Props {
17
19
  }
18
20
 
19
21
  interface EnumUDropdownBadgeArgs extends DefaultUDropdownBadgeArgs {
20
- enum: keyof Pick<Props, "color" | "size">;
22
+ enum: keyof Pick<Props, "color" | "size" | "variant" | "xPosition" | "yPosition">;
21
23
  }
22
24
 
23
25
  export default {
@@ -42,7 +44,7 @@ export default {
42
44
  } as Meta;
43
45
 
44
46
  const DefaultTemplate: StoryFn<DefaultUDropdownBadgeArgs> = (args: DefaultUDropdownBadgeArgs) => ({
45
- components: { UDropdownBadge, UIcon },
47
+ components: { UDropdownBadge, UIcon, ULink },
46
48
  setup() {
47
49
  const slots = getSlotNames(UDropdownBadge.__name);
48
50
 
@@ -81,48 +83,106 @@ const EnumVariantTemplate: StoryFn<EnumUDropdownBadgeArgs> = (
81
83
  `,
82
84
  });
83
85
 
86
+ const VariantColorsTemplate: StoryFn<EnumUDropdownBadgeArgs> = (
87
+ args: EnumUDropdownBadgeArgs,
88
+ { argTypes },
89
+ ) => ({
90
+ components: { UDropdownBadge, URow, UCol },
91
+ setup() {
92
+ return {
93
+ args,
94
+ variants: argTypes.variant?.options,
95
+ colors: argTypes.color?.options,
96
+ };
97
+ },
98
+ template: `
99
+ <UCol>
100
+ <URow v-for="(variant, index) in variants" :key="index">
101
+ <UDropdownBadge
102
+ v-for="(color, index) in colors"
103
+ :key="index"
104
+ v-bind="args"
105
+ :color="color"
106
+ :variant="variant"
107
+ :label="color"
108
+ />
109
+ </URow>
110
+ </UCol>
111
+ `,
112
+ });
113
+
84
114
  export const Default = DefaultTemplate.bind({});
85
115
  Default.args = {};
86
116
 
117
+ export const Variants = EnumVariantTemplate.bind({});
118
+ Variants.args = { enum: "variant" };
119
+
87
120
  export const Sizes = EnumVariantTemplate.bind({});
88
121
  Sizes.args = { enum: "size" };
89
122
 
90
- export const Colors = EnumVariantTemplate.bind({});
91
- Colors.args = { enum: "color" };
123
+ export const DropdownListXPosition = EnumVariantTemplate.bind({});
124
+ DropdownListXPosition.args = { enum: "xPosition" };
125
+
126
+ export const DropdownListYPosition = EnumVariantTemplate.bind({});
127
+ DropdownListYPosition.args = { enum: "yPosition" };
128
+
129
+ export const VariantColors = VariantColorsTemplate.bind({});
130
+ VariantColors.args = {};
92
131
 
93
132
  export const WithoutDropdownIcon = DefaultTemplate.bind({});
94
133
  WithoutDropdownIcon.args = { noIcon: true };
95
134
 
96
- export const DefaultSlot = DefaultTemplate.bind({});
97
- DefaultSlot.args = {
98
- slotTemplate: `
99
- <template #default>
100
- Custom label
101
- </template>
102
- `,
135
+ export const CustomDropdownIcon = DefaultTemplate.bind({});
136
+ CustomDropdownIcon.args = {
137
+ config: {
138
+ dropdownIcon: {
139
+ defaults: {
140
+ size: "sm",
141
+ },
142
+ },
143
+ defaults: {
144
+ dropdownIcon: "expand_circle_down",
145
+ },
146
+ },
103
147
  };
104
148
 
105
- export const LeftSlot = DefaultTemplate.bind({});
106
- LeftSlot.args = {
107
- slotTemplate: `
108
- <template #left>
109
- <UIcon
110
- name="archive"
111
- color="red"
112
- size="sm"
113
- />
114
- </template>
149
+ export const Slots: StoryFn<DefaultUDropdownBadgeArgs> = (args) => ({
150
+ components: { UDropdownBadge, UIcon, URow },
151
+ setup() {
152
+ return { args };
153
+ },
154
+ template: `
155
+ <URow no-mobile>
156
+ <UDropdownBadge v-bind="args" label="Add to favorite">
157
+ <template #left>
158
+ <UIcon
159
+ name="heart_plus"
160
+ size="xs"
161
+ color="green"
162
+ class="mx-1"
163
+ />
164
+ </template>
165
+ </UDropdownBadge>
166
+
167
+ <UDropdownBadge v-bind="args" no-icon>
168
+ <template #default>
169
+ <UIcon name="unfold_more" color="white" />
170
+ </template>
171
+ </UDropdownBadge>
172
+ </URow>
115
173
  `,
116
- };
174
+ });
117
175
 
118
- export const RightSlot = DefaultTemplate.bind({});
119
- RightSlot.args = {
176
+ export const SlotToggle = DefaultTemplate.bind({});
177
+ SlotToggle.args = {
120
178
  slotTemplate: `
121
- <template #right>
122
- <UIcon
123
- name="archive"
124
- color="red"
179
+ <template #toggle="{ opened }">
180
+ <ULink
181
+ :label="opened ? 'collapse' : 'expand'"
182
+ color="green"
125
183
  size="sm"
184
+ :ring=false
185
+ class="mx-1"
126
186
  />
127
187
  </template>
128
188
  `,
@@ -107,7 +107,7 @@ const { config, dropdownButtonAttrs, dropdownListAttrs, dropdownIconAttrs, wrapp
107
107
 
108
108
  <template #right>
109
109
  <!--
110
- @slot Use it to add something after the label.
110
+ @slot Use it to add something instead of the toggle icon.
111
111
  @binding {boolean} opened
112
112
  -->
113
113
  <slot v-if="!noIcon" name="toggle" :opened="isShownOptions">
@@ -152,6 +152,7 @@ DefaultSlot.args = {
152
152
  </template>
153
153
  `,
154
154
  noIcon: true,
155
+ square: true,
155
156
  };
156
157
 
157
158
  export const LeftSlot = DefaultTemplate.bind({});
@@ -106,10 +106,10 @@ const { config, getDataTest, wrapperAttrs, dropdownLinkAttrs, dropdownListAttrs,
106
106
  </ULink>
107
107
 
108
108
  <!--
109
- @slot Use it to add something after the label.
109
+ @slot Use it to add something instead of the toggle icon.
110
110
  @binding {boolean} opened
111
111
  -->
112
- <slot name="right" :opened="isShownOptions">
112
+ <slot name="toggle" :opened="isShownOptions">
113
113
  <UIcon
114
114
  v-if="!noIcon"
115
115
  internal
@@ -1,15 +1,23 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: {
3
- base: "relative inline-flex",
3
+ base: "relative inline-flex items-center rounded",
4
4
  variants: {
5
5
  opened: {
6
6
  true: "group",
7
7
  },
8
+ ring: {
9
+ true: "focus-within:ring-dynamic focus-within:ring-offset-4 focus-within:ring-{color}-700/15",
10
+ },
8
11
  },
9
12
  },
10
- dropdownLink: "{ULink}",
13
+ dropdownLink: "{ULink} focus:ring-0 focus:ring-offset-0",
11
14
  toggleIcon: {
12
15
  base: "{UIcon} block transition duration-300 group-[]:rotate-180",
16
+ variants: {
17
+ disabled: {
18
+ true: "text-gray-400 pointer-events-none",
19
+ },
20
+ },
13
21
  defaults: {
14
22
  size: {
15
23
  sm: "2xs",
@@ -8,6 +8,8 @@ import {
8
8
  import UDropdownLink from "../../ui.dropdown-link/UDropdownLink.vue";
9
9
  import URow from "../../ui.container-row/URow.vue";
10
10
  import UIcon from "../../ui.image-icon/UIcon.vue";
11
+ import UBadge from "../../ui.text-badge/UBadge.vue";
12
+ import ULink from "../../ui.button-link/ULink.vue";
11
13
 
12
14
  import type { Meta, StoryFn } from "@storybook/vue3";
13
15
  import type { Props } from "../types.ts";
@@ -17,7 +19,7 @@ interface DefaultUDropdownLinkArgs extends Props {
17
19
  }
18
20
 
19
21
  interface EnumUDropdownLinkArgs extends DefaultUDropdownLinkArgs {
20
- enum: keyof Pick<Props, "size" | "color">;
22
+ enum: keyof Pick<Props, "size" | "color" | "xPosition" | "yPosition">;
21
23
  }
22
24
 
23
25
  export default {
@@ -46,7 +48,7 @@ export default {
46
48
  } as Meta;
47
49
 
48
50
  const DefaultTemplate: StoryFn<DefaultUDropdownLinkArgs> = (args: DefaultUDropdownLinkArgs) => ({
49
- components: { UDropdownLink, UIcon },
51
+ components: { UDropdownLink, UIcon, ULink },
50
52
  setup() {
51
53
  const slots = getSlotNames(UDropdownLink.__name);
52
54
 
@@ -96,42 +98,97 @@ Default.args = {};
96
98
  export const Sizes = EnumVariantTemplate.bind({});
97
99
  Sizes.args = { enum: "size" };
98
100
 
101
+ export const DropdownListXPosition = EnumVariantTemplate.bind({});
102
+ DropdownListXPosition.args = { enum: "xPosition" };
103
+
104
+ export const DropdownListYPosition = EnumVariantTemplate.bind({});
105
+ DropdownListYPosition.args = { enum: "yPosition" };
106
+
107
+ export const Disabled = DefaultTemplate.bind({});
108
+ Disabled.args = { disabled: true };
109
+
110
+ export const Ring = DefaultTemplate.bind({});
111
+ Ring.args = { ring: true };
112
+
99
113
  export const Colors = EnumVariantTemplate.bind({});
100
114
  Colors.args = { enum: "color" };
101
115
 
116
+ export const UnderlineVariants: StoryFn<EnumUDropdownLinkArgs> = (
117
+ args: EnumUDropdownLinkArgs,
118
+ { argTypes },
119
+ ) => ({
120
+ components: { UDropdownLink, URow },
121
+ setup() {
122
+ const variants = [
123
+ { name: "Default", props: {} },
124
+ { name: "Underlined (on hover)", props: { underlined: undefined, dashed: false } },
125
+ { name: "Underlined", props: { underlined: true, dashed: false } },
126
+ { name: "No underline", props: { underlined: false } },
127
+ ];
128
+
129
+ const colors = argTypes?.color?.options;
130
+
131
+ return {
132
+ args,
133
+ variants,
134
+ colors,
135
+ };
136
+ },
137
+ template: `
138
+ <div v-for="variant in variants" :key="variant.name" class="mb-8">
139
+ <div class="text-sm font-medium mb-2">{{ variant.name }}</div>
140
+ <URow no-mobile>
141
+ <UDropdownLink
142
+ v-for="color in colors"
143
+ :key="color"
144
+ v-bind="variant.props"
145
+ :color="color"
146
+ :label="color"
147
+ />
148
+ </URow>
149
+ </div>
150
+ `,
151
+ });
152
+
102
153
  export const WithoutDropdownIcon = DefaultTemplate.bind({});
103
154
  WithoutDropdownIcon.args = { noIcon: true };
104
155
 
105
- export const DefaultSlot = DefaultTemplate.bind({});
106
- DefaultSlot.args = {
107
- slotTemplate: `
108
- <template #default>
109
- Custom label
110
- </template>
111
- `,
112
- };
113
-
114
- export const LeftSlot = DefaultTemplate.bind({});
115
- LeftSlot.args = {
116
- slotTemplate: `
117
- <template #left>
118
- <UIcon
119
- name="archive"
120
- color="red"
121
- size="sm"
122
- />
123
- </template>
156
+ export const Slots: StoryFn<DefaultUDropdownLinkArgs> = (args) => ({
157
+ components: { UDropdownLink, UIcon, URow, UBadge },
158
+ setup() {
159
+ return { args };
160
+ },
161
+ template: `
162
+ <URow no-mobile>
163
+ <UDropdownLink v-bind="args" label="Add to favorite">
164
+ <template #left>
165
+ <UIcon
166
+ name="heart_plus"
167
+ size="sm"
168
+ color="green"
169
+ class="mx-1"
170
+ />
171
+ </template>
172
+ </UDropdownLink>
173
+
174
+ <UDropdownLink v-bind="args">
175
+ <template #default>
176
+ <UBadge label="Dropdown" color="green" variant="thirdary" />
177
+ </template>
178
+ </UDropdownLink>
179
+ </URow>
124
180
  `,
125
- };
181
+ });
126
182
 
127
- export const RightSlot = DefaultTemplate.bind({});
128
- RightSlot.args = {
183
+ export const SlotToggle = DefaultTemplate.bind({});
184
+ SlotToggle.args = {
129
185
  slotTemplate: `
130
- <template #right>
186
+ <template #toggle="{ opened }">
131
187
  <UIcon
132
- name="archive"
133
- color="red"
134
- size="sm"
188
+ name="expand_circle_down"
189
+ color="green"
190
+ class="mx-1"
191
+ :class="{ 'rotate-180' : opened }"
135
192
  />
136
193
  </template>
137
194
  `,