vueless 0.0.396 → 0.0.398

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.396",
3
+ "version": "0.0.398",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div :data-test="dataTest" v-bind="wrapperAttrs" @click="onClickItem">
3
3
  <div v-bind="bodyAttrs">
4
- <div v-bind="labelAttrs">
5
- {{ label }}
4
+ <div v-bind="titleAttrs">
5
+ {{ title }}
6
6
  <!--
7
7
  @slot Use it to add something instead of the toggle icon.
8
8
  @binding {string} icon-name
@@ -36,9 +36,9 @@ defineOptions({ inheritAttrs: false });
36
36
 
37
37
  const props = defineProps({
38
38
  /**
39
- * Accordion label.
39
+ * Accordion title.
40
40
  */
41
- label: {
41
+ title: {
42
42
  type: String,
43
43
  required: true,
44
44
  },
@@ -95,7 +95,7 @@ const {
95
95
  wrapperAttrs,
96
96
  descriptionAttrs,
97
97
  bodyAttrs,
98
- labelAttrs,
98
+ titleAttrs,
99
99
  toggleIconAttrs,
100
100
  dividerAttrs,
101
101
  } = useAttrs(props, { isOpened });
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "group cursor-pointer",
3
3
  body: "",
4
- label: {
4
+ title: {
5
5
  base: "flex items-center justify-between font-medium text-gray-900",
6
6
  variants: {
7
7
  size: {
@@ -14,19 +14,19 @@ export default {
14
14
  accordions: [
15
15
  {
16
16
  name: "Excellence",
17
- label: "Excellence by necessity",
17
+ title: "Excellence by necessity",
18
18
  description: `As creators and maintainers of the technologies you are using,
19
19
  our services are here to showcase the full power of our softwares.`,
20
20
  },
21
21
  {
22
22
  name: "Innovation",
23
- label: "Driving innovation forward",
23
+ title: "Driving innovation forward",
24
24
  description: `All the people that will be involved in delivering your project are contributing
25
25
  to the technologies you are using, when they are not the creators themselves.`,
26
26
  },
27
27
  {
28
28
  name: "Collaboration",
29
- label: "Fostering collaboration",
29
+ title: "Fostering collaboration",
30
30
  description: `By working with us, you are directly supporting the open source community,
31
31
  ensuring the ecosystem continuity and enabling Nuxt development.`,
32
32
  },
@@ -46,7 +46,7 @@ const props = defineProps({
46
46
  * @values none, before, after, all
47
47
  */
48
48
  padding: {
49
- type: Boolean,
49
+ type: String,
50
50
  default: getDefault(defaultConfig, UDivider).padding,
51
51
  },
52
52
 
@@ -9,9 +9,6 @@ export default /*tw*/ {
9
9
  label: {
10
10
  true: "items-center justify-center",
11
11
  },
12
- padding: {
13
- none: "p-0",
14
- },
15
12
  },
16
13
  compoundVariants: [
17
14
  { vertical: false, size: "xs", class: "py-2" },
@@ -28,6 +25,7 @@ export default /*tw*/ {
28
25
  { vertical: true, size: "xl", class: "px-6" },
29
26
  { vertical: true, padding: "after", class: "pl-0" },
30
27
  { vertical: true, padding: "before", class: "pr-0" },
28
+ { padding: "none", class: "p-0" },
31
29
  ],
32
30
  },
33
31
  divider: {
@@ -4,9 +4,9 @@
4
4
  <UDivider v-if="upperlined" size="xl" padding="after" v-bind="upperlineAttrs" />
5
5
 
6
6
  <div v-bind="headerAttrs">
7
- <!-- @slot Use it to add something left side of the header. -->
8
- <slot name="left">
9
- <div v-bind="headerFallbackAttrs">
7
+ <!-- @slot Use it to add something on the left side of the header. -->
8
+ <slot name="header-left">
9
+ <div v-bind="headerLeftFallbackAttrs">
10
10
  <!-- @slot Use it to add something before the title. -->
11
11
  <slot name="before-title" />
12
12
 
@@ -17,11 +17,11 @@
17
17
  </div>
18
18
  </slot>
19
19
 
20
- <!-- @slot Use it to add something right side of the header. -->
21
- <slot name="right" />
20
+ <!-- @slot Use it to add something on the right side of the header. -->
21
+ <slot name="header-right" />
22
22
  </div>
23
23
 
24
- <UDivider v-if="underlined" size="xl" v-bind="underlineAttrs" />
24
+ <UDivider size="xl" padding="after" :no-border="!underlined" v-bind="underlineAttrs" />
25
25
  </template>
26
26
 
27
27
  <div v-bind="contentAttrs">
@@ -44,7 +44,7 @@ defineOptions({ inheritAttrs: false });
44
44
 
45
45
  const props = defineProps({
46
46
  /**
47
- * Header title.
47
+ * Group title.
48
48
  */
49
49
  title: {
50
50
  type: String,
@@ -77,7 +77,7 @@ const props = defineProps({
77
77
  },
78
78
 
79
79
  /**
80
- *Component config object.
80
+ * Component config object.
81
81
  */
82
82
  config: {
83
83
  type: Object,
@@ -96,7 +96,7 @@ const props = defineProps({
96
96
  const {
97
97
  headerAttrs,
98
98
  wrapperAttrs,
99
- headerFallbackAttrs,
99
+ headerLeftFallbackAttrs,
100
100
  titleAttrs,
101
101
  upperlineAttrs,
102
102
  underlineAttrs,
@@ -1,17 +1,17 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "w-full",
3
3
  upperline: "{UDivider}",
4
- header: {
5
- base: "flex items-center justify-between",
4
+ underline: {
5
+ component: "{UDivider}",
6
6
  variants: {
7
7
  underlined: {
8
- false: "pb-6",
8
+ true: "pt-1.5",
9
9
  },
10
10
  },
11
11
  },
12
- headerFallback: "flex items-center",
12
+ header: "flex items-center justify-between",
13
+ headerLeftFallback: "flex items-center",
13
14
  title: "{UHeader} pr-2",
14
- underline: "{UDivider} pt-1.5",
15
15
  content: {
16
16
  base: "flex flex-col items-stretch",
17
17
  variants: {
@@ -9,49 +9,51 @@
9
9
  :id="elementId"
10
10
  ref="wrapperRef"
11
11
  tabindex="0"
12
- :data-test="dataTest"
13
12
  v-bind="wrapperAttrs"
13
+ :data-test="dataTest"
14
14
  @keydown.self.esc="onKeydownEsc"
15
15
  >
16
16
  <div v-bind="innerWrapperAttrs" @click.self="onClickOutside">
17
17
  <div v-bind="modalAttrs">
18
18
  <div v-if="isExistHeader" v-bind="headerAttrs">
19
19
  <div v-bind="headerLeftAttrs">
20
- <!-- @slot Use it to add something before the left part of the header. -->
21
- <slot name="header-left-before" />
22
-
23
- <!-- @slot Use it to add something to the left part of the header.. -->
20
+ <!-- @slot Use it to add something to the left side of the header. -->
24
21
  <slot name="header-left">
22
+ <!-- @slot Use it to add something before the header title. -->
23
+ <slot name="before-title" />
24
+
25
25
  <div v-bind="headerLeftFallbackAttrs">
26
26
  <ULink
27
27
  v-if="isShownArrowButton"
28
28
  size="sm"
29
29
  color="gray"
30
- :to="backRoute"
30
+ :to="backTo"
31
+ :label="backLabel"
31
32
  v-bind="backLinkAttrs"
32
33
  @click="onClickBackLink"
33
34
  >
34
- <UIcon
35
- internal
36
- size="xs"
37
- color="gray"
38
- :name="config.defaults.backIcon"
39
- v-bind="backLinkIconAttrs"
40
- />
41
- {{ backRoute.title }}
35
+ <template #left>
36
+ <UIcon
37
+ internal
38
+ size="xs"
39
+ color="gray"
40
+ :name="config.defaults.backIcon"
41
+ v-bind="backLinkIconAttrs"
42
+ />
43
+ </template>
42
44
  </ULink>
43
45
 
44
- <UHeader :label="title" v-bind="titleAttrs" />
46
+ <UHeader :label="title" size="sm" v-bind="titleAttrs" />
45
47
  <div v-if="description" v-bind="descriptionAttrs" v-text="description" />
46
48
  </div>
47
- </slot>
48
49
 
49
- <!-- @slot Use it to add something after the left part of the header. -->
50
- <slot name="header-left-after" />
50
+ <!-- @slot Use it to add something after the header title. -->
51
+ <slot name="after-title" />
52
+ </slot>
51
53
  </div>
52
54
 
53
55
  <div v-bind="headerRightAttrs">
54
- <!-- @slot Use it to add something to the right part of the header. -->
56
+ <!-- @slot Use it to add something to the right side of the header. -->
55
57
  <slot name="header-right" />
56
58
  </div>
57
59
 
@@ -62,12 +64,13 @@
62
64
  -->
63
65
  <slot name="close-button" :icon-name="config.defaults.closeIcon">
64
66
  <UIcon
65
- v-if="closeButton"
67
+ v-if="closeOnCross"
66
68
  internal
67
69
  interactive
70
+ size="sm"
68
71
  :name="config.defaults.closeIcon"
69
- :data-test="`${dataTest}-close`"
70
72
  v-bind="closeIconAttrs"
73
+ :data-test="`${dataTest}-close`"
71
74
  @click="onClickCloseModal"
72
75
  />
73
76
  </slot>
@@ -75,7 +78,7 @@
75
78
  </div>
76
79
 
77
80
  <div v-bind="bodyAttrs">
78
- <!-- @slot Use it to add something to the modal body. -->
81
+ <!-- @slot Use it to add something into the modal body. -->
79
82
  <slot />
80
83
  </div>
81
84
 
@@ -86,12 +89,12 @@
86
89
 
87
90
  <div v-bind="footerAttrs">
88
91
  <div v-if="hasSlotContent($slots['footer-left'])" v-bind="footerLeftAttrs">
89
- <!-- @slot Use it to add something to the left part of the footer. -->
92
+ <!-- @slot Use it to add something to the left side of the footer. -->
90
93
  <slot name="footer-left" />
91
94
  </div>
92
95
 
93
96
  <div v-if="hasSlotContent($slots['footer-right'])" v-bind="footerRightAttrs">
94
- <!-- @slot Use it to add something to the right part of the footer. -->
97
+ <!-- @slot Use it to add something to the right side of the footer. -->
95
98
  <slot name="footer-right" />
96
99
  </div>
97
100
  </div>
@@ -123,7 +126,7 @@ const wrapperRef = ref(null);
123
126
 
124
127
  const props = defineProps({
125
128
  /**
126
- * Change modal state (hidden / shown).
129
+ * Set modal state (hidden / shown).
127
130
  */
128
131
  modelValue: {
129
132
  type: Boolean,
@@ -131,7 +134,7 @@ const props = defineProps({
131
134
  },
132
135
 
133
136
  /**
134
- * Set modal title.
137
+ * Modal title.
135
138
  */
136
139
  title: {
137
140
  type: String,
@@ -139,7 +142,7 @@ const props = defineProps({
139
142
  },
140
143
 
141
144
  /**
142
- * Sets modal description.
145
+ * Modal description.
143
146
  */
144
147
  description: {
145
148
  type: String,
@@ -147,44 +150,52 @@ const props = defineProps({
147
150
  },
148
151
 
149
152
  /**
150
- * Set back link route.
153
+ * Modal size (width).
154
+ * @values xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl
151
155
  */
152
- backRoute: {
156
+ size: {
157
+ type: String,
158
+ default: getDefault(defaultConfig, UModal).size,
159
+ },
160
+
161
+ /**
162
+ * Back link vue-router route object.
163
+ */
164
+ backTo: {
153
165
  type: Object,
154
166
  default: () => ({}),
155
167
  },
156
168
 
157
169
  /**
158
- * Set width for modal.
159
- * @values xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl
170
+ * Back link label.
160
171
  */
161
- width: {
172
+ backLabel: {
162
173
  type: String,
163
- default: getDefault(defaultConfig, UModal).width,
174
+ default: "",
164
175
  },
165
176
 
166
177
  /**
167
- * Allow closing modal by clicking on overlay.
178
+ * Allow closing modal by clicking on close cross.
168
179
  */
169
- clickToClose: {
180
+ closeOnCross: {
170
181
  type: Boolean,
171
- default: getDefault(defaultConfig, UModal).clickToClose,
182
+ default: getDefault(defaultConfig, UModal).closeOnCross,
172
183
  },
173
184
 
174
185
  /**
175
- * Allow closing modal by clicking on close icon.
186
+ * Allow closing modal by clicking on overlay.
176
187
  */
177
- closeButton: {
188
+ closeOnOverlay: {
178
189
  type: Boolean,
179
- default: getDefault(defaultConfig, UModal).closeButton,
190
+ default: getDefault(defaultConfig, UModal).closeOnOverlay,
180
191
  },
181
192
 
182
193
  /**
183
- * Allow closing modal by pressing escape (esc) key.
194
+ * Allow closing modal by pressing escape (esc) on the keyboard.
184
195
  */
185
- escToClose: {
196
+ closeOnEsc: {
186
197
  type: Boolean,
187
- default: getDefault(defaultConfig, UModal).escToClose,
198
+ default: getDefault(defaultConfig, UModal).closeOnEsc,
188
199
  },
189
200
 
190
201
  /**
@@ -204,19 +215,19 @@ const props = defineProps({
204
215
  },
205
216
 
206
217
  /**
207
- * Reverse left and right footer blocks (mobile version only).
218
+ * Attach small modal to the bottom of the screen (mobile version only).
208
219
  */
209
- mobileFooterReverse: {
220
+ mobileStickBottom: {
210
221
  type: Boolean,
211
- default: getDefault(defaultConfig, UModal).mobileFooterReverse,
222
+ default: getDefault(defaultConfig, UModal).mobileStickBottom,
212
223
  },
213
224
 
214
225
  /**
215
- * Attach small modal to the bottom of the screen (mobile version only).
226
+ * Unique element id.
216
227
  */
217
- mobileBottomAlign: {
218
- type: Boolean,
219
- default: getDefault(defaultConfig, UModal).mobileBottomAlign,
228
+ id: {
229
+ type: String,
230
+ default: "",
220
231
  },
221
232
 
222
233
  /**
@@ -227,14 +238,6 @@ const props = defineProps({
227
238
  default: () => ({}),
228
239
  },
229
240
 
230
- /**
231
- * Unique element id.
232
- */
233
- id: {
234
- type: String,
235
- default: "",
236
- },
237
-
238
241
  /**
239
242
  * Set data-test attribute for automated testing.
240
243
  */
@@ -289,16 +292,16 @@ const isShownModal = computed({
289
292
  });
290
293
 
291
294
  const isShownArrowButton = computed(() => {
292
- return !!Object.keys(props.backRoute).length;
295
+ return !!Object.keys(props.backTo).length;
293
296
  });
294
297
 
295
298
  const isExistHeader = computed(() => {
296
299
  return (
300
+ props.title ||
297
301
  hasSlotContent(slots["header-left"]) ||
298
- hasSlotContent(slots["header-left-before"]) ||
299
- hasSlotContent(slots["header-left-after"]) ||
300
- hasSlotContent(slots["header-right"]) ||
301
- props.title
302
+ hasSlotContent(slots["before-title"]) ||
303
+ hasSlotContent(slots["after-title"]) ||
304
+ hasSlotContent(slots["header-right"])
302
305
  );
303
306
  });
304
307
 
@@ -325,15 +328,15 @@ function onClickBackLink() {
325
328
  }
326
329
 
327
330
  function onClickOutside() {
328
- props.clickToClose && closeModal();
331
+ props.closeOnOverlay && closeModal();
329
332
  }
330
333
 
331
334
  function onKeydownEsc() {
332
- props.escToClose && closeModal();
335
+ props.closeOnEsc && closeModal();
333
336
  }
334
337
 
335
338
  function onClickCloseModal() {
336
- props.closeButton && closeModal();
339
+ props.closeOnCross && closeModal();
337
340
  }
338
341
 
339
342
  function closeModal() {
@@ -24,20 +24,19 @@ export default /*tw*/ {
24
24
  backLink: "{ULink} flex items-center gap-0.5",
25
25
  backLinkIcon: "{UIcon}",
26
26
  title: "{UHeader}",
27
- description: "mt-1.5 text-base font-normal text-gray-500",
27
+ description: "mt-1.5 text-sm font-normal text-gray-500",
28
28
  headerRight: "",
29
29
  closeIcon: "{UIcon}",
30
- body: "space-y-4 px-4 md:px-8",
30
+ body: "space-y-4 px-4 md:px-8 text-sm",
31
31
  divider: "{UDivider}",
32
32
  dividerSpacing: "{UDivider}",
33
33
  footer: "flex justify-between px-4 md:px-8 py-8 max-md:flex-col max-md:gap-4",
34
34
  footerLeft: "flex flex-col md:flex-row space-y-4 md:space-x-4 md:space-y-0 w-full",
35
35
  footerRight: "flex flex-col md:flex-row space-y-4 md:space-x-4 md:space-y-0 w-full justify-end",
36
- footerMobileReverse: "flex flex-col-reverse space-y-reverse group/reversed-footer",
37
36
  modal: {
38
37
  base: "mx-auto rounded-2xl bg-white",
39
38
  variants: {
40
- width: {
39
+ size: {
41
40
  xs: "md:w-[25rem]",
42
41
  sm: "md:w-[31.25rem]",
43
42
  md: "md:w-[37.5rem]",
@@ -54,14 +53,13 @@ export default /*tw*/ {
54
53
  },
55
54
  },
56
55
  defaults: {
57
- width: "sm",
56
+ size: "sm",
58
57
  inner: false,
59
- closeButton: true,
60
- escToClose: true,
61
- clickToClose: true,
62
58
  noDivider: false,
63
- mobileBottomAlign: false,
64
- mobileFooterReverse: false,
59
+ closeOnEsc: true,
60
+ closeOnCross: true,
61
+ closeOnOverlay: true,
62
+ mobileStickBottom: false,
65
63
  /* icons */
66
64
  backIcon: "arrow_back",
67
65
  closeIcon: "close",
@@ -66,7 +66,7 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
66
66
  components: { UModal, UButton, URow, UInput, UTextarea },
67
67
  setup() {
68
68
  function onClick(value) {
69
- args.width = value;
69
+ args.size = value;
70
70
  args.modelValue = true;
71
71
  }
72
72
 
@@ -98,10 +98,16 @@ export const Default = DefaultTemplate.bind({});
98
98
  Default.args = {};
99
99
 
100
100
  export const Sizes = EnumVariantTemplate.bind({});
101
- Sizes.args = { enum: "width", text: "" };
102
-
103
- export const BackRoute = DefaultTemplate.bind({});
104
- BackRoute.args = { backRoute: { title: "route title" } };
101
+ Sizes.args = { enum: "size" };
102
+
103
+ export const BackLink = DefaultTemplate.bind({});
104
+ BackLink.args = {
105
+ backLabel: "back",
106
+ backTo: {
107
+ path: "/",
108
+ params: {},
109
+ },
110
+ };
105
111
 
106
112
  export const SlotDefault = DefaultTemplate.bind({});
107
113
  SlotDefault.args = {
@@ -112,37 +118,31 @@ SlotDefault.args = {
112
118
  `,
113
119
  };
114
120
 
115
- export const SlotHeaderLeftBefore = DefaultTemplate.bind({});
116
- SlotHeaderLeftBefore.args = {
121
+ export const SlotBeforeTitle = DefaultTemplate.bind({});
122
+ SlotBeforeTitle.args = {
117
123
  slotTemplate: `
118
- <template #header-left-before>
119
- <UIcon
120
- name="star"
121
- color="gray"
122
- />
124
+ <template #before-title>
125
+ <UIcon name="star" color="gray" />
123
126
  </template>
124
127
  ${defaultTemplate}
125
128
  `,
126
129
  };
127
130
 
128
- export const SlotHeaderLeft = DefaultTemplate.bind({});
129
- SlotHeaderLeft.args = {
131
+ export const SlotAfterTitle = DefaultTemplate.bind({});
132
+ SlotAfterTitle.args = {
130
133
  slotTemplate: `
131
- <template #header-left>
132
- <UHeader size="lg" label="Large title" />
134
+ <template #after-title>
135
+ <UIcon name="star" color="gray" />
133
136
  </template>
134
137
  ${defaultTemplate}
135
138
  `,
136
139
  };
137
140
 
138
- export const SlotHeaderLeftAfter = DefaultTemplate.bind({});
139
- SlotHeaderLeftAfter.args = {
141
+ export const SlotHeaderLeft = DefaultTemplate.bind({});
142
+ SlotHeaderLeft.args = {
140
143
  slotTemplate: `
141
- <template #header-left-after>
142
- <UIcon
143
- name="star"
144
- color="gray"
145
- />
144
+ <template #header-left>
145
+ <UHeader size="lg" label="Large title" />
146
146
  </template>
147
147
  ${defaultTemplate}
148
148
  `,
@@ -1,29 +1,15 @@
1
- import { computed } from "vue";
2
1
  import useUI from "../composables/useUI.js";
3
2
 
4
3
  import defaultConfig from "./config.js";
5
4
 
6
- import useBreakpoint from "../composables/useBreakpoint.js";
7
-
8
5
  export default function useAttrs(props) {
9
- const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
6
+ const { config, getKeysAttrs, hasSlotContent } = useUI(
10
7
  defaultConfig,
11
8
  () => props.config,
9
+ "wrapper",
12
10
  );
13
- const { isMobileBreakpoint } = useBreakpoint();
14
-
15
- const extendingKeys = ["footerMobileReverse"];
16
- const extendingKeysClasses = getExtendingKeysClasses(extendingKeys);
17
11
 
18
- const keysAttrs = getKeysAttrs({}, extendingKeys, {
19
- footer: {
20
- extend: computed(() => [
21
- props.mobileFooterReverse &&
22
- isMobileBreakpoint.value &&
23
- extendingKeysClasses.footerMobileReverse.value,
24
- ]),
25
- },
26
- });
12
+ const keysAttrs = getKeysAttrs();
27
13
 
28
14
  return {
29
15
  config,