vueless 0.0.220 → 0.0.221

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.220",
3
+ "version": "0.0.221",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -247,11 +247,11 @@ const loaderSize = computed(() => {
247
247
 
248
248
  const iconSize = computed(() => {
249
249
  const sizes = {
250
- "2xs": "sm",
251
- xs: "sm",
252
- sm: "md",
253
- md: "md",
254
- lg: "lg",
250
+ "2xs": "3xs",
251
+ xs: "2xs",
252
+ sm: "xs",
253
+ md: "sm",
254
+ lg: "md",
255
255
  xl: "lg",
256
256
  };
257
257
 
@@ -28,7 +28,7 @@ export default /*tw*/ {
28
28
  },
29
29
  option: {
30
30
  base: `
31
- rounded px-3 py-2.5 flex items-center align-middle whitespace-nowrap cursor-pointer
31
+ rounded px-2 py-2.5 flex items-center align-middle whitespace-nowrap cursor-pointer
32
32
  font-normal !leading-none normal-case text-gray-900
33
33
  hover:bg-gray-100
34
34
  overflow-hidden text-ellipsis
@@ -1,8 +1,8 @@
1
1
  export default /*tw*/ {
2
2
  label: "{ULabel}",
3
3
  inputWrapper: "flex relative w-full",
4
- rightIconSlot: "flex items-center justify-end whitespace-nowrap pr-3 rounded-r-lg rounded-l-none",
5
- leftIconSlot: "flex items-center justify-end whitespace-nowrap pl-3 rounded-l-lg rounded-r-none",
4
+ rightIconSlot: "flex items-center justify-end whitespace-nowrap pr-3 gap-1 rounded-r-lg rounded-l-none",
5
+ leftIconSlot: "flex items-center justify-end whitespace-nowrap pl-3 gap-1 rounded-l-lg rounded-r-none",
6
6
  passwordIcon: "",
7
7
  passwordVisibleIconName: "visibility-fill",
8
8
  passwordHiddenIconName: "visibility_off-fill",
@@ -348,9 +348,9 @@ const {
348
348
 
349
349
  const iconSize = computed(() => {
350
350
  const sizes = {
351
- sm: "sm",
352
- md: "md",
353
- lg: "lg",
351
+ sm: "xs",
352
+ md: "sm",
353
+ lg: "md",
354
354
  };
355
355
 
356
356
  return sizes[props.size];
@@ -5,7 +5,10 @@ import { cva } from "../../service.ui";
5
5
  import defaultConfig from "../configs/default.config";
6
6
 
7
7
  export default function useAttrs(props) {
8
- const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
8
+ const { config, getAttrs, isSystemKey, hasSlotContent } = useUI(
9
+ defaultConfig,
10
+ () => props.config,
11
+ );
9
12
  const attrs = {};
10
13
 
11
14
  for (const key in defaultConfig) {
@@ -31,5 +34,6 @@ export default function useAttrs(props) {
31
34
  return {
32
35
  ...attrs,
33
36
  config,
37
+ hasSlotContent,
34
38
  };
35
39
  }
@@ -2,8 +2,8 @@ export default /*tw*/ {
2
2
  label: "{ULabel} w-full",
3
3
  dropzoneWrapper: {
4
4
  base: `
5
- size-auto w-full rounded-lg border border-solid border-gray-300 bg-white
6
- p-3 transition hover:border-gray-400
5
+ p-3 size-auto w-full bg-white transition
6
+ rounded-lg border border-solid border-gray-300 hover:border-gray-400
7
7
  `,
8
8
  variants: {
9
9
  error: {
@@ -16,13 +16,17 @@ export default /*tw*/ {
16
16
  { labelAlign: "topInside", label: true, size: "lg", class: "pt-9" },
17
17
  ],
18
18
  },
19
- description: "{UText} text-gray-700",
19
+ descriptionTop: "{UText} text-gray-700 mb-2",
20
+ descriptionBottom: "{UText} text-gray-700 mt-2",
20
21
  contentWrapper: {
21
- base: "relative flex w-full gap-6 justify-between items-start rounded-lg bg-brand-50 p-3",
22
+ base: "p-3 gap-6 w-full rounded-lg bg-brand-50 relative flex justify-between items-start",
22
23
  variants: {
23
24
  multiple: {
24
25
  false: "items-center",
25
26
  },
27
+ error: {
28
+ true: "bg-red-50",
29
+ },
26
30
  },
27
31
  },
28
32
  placeholder: {
@@ -36,16 +40,15 @@ export default /*tw*/ {
36
40
  },
37
41
  },
38
42
  button: "{UButton} hover:cursor-pointer",
39
- chooseFileIcon: "{UIcon}",
40
43
  chooseFileIconName: "attach_file",
41
- clearIcon: "{UIcon}",
44
+ clearButton: "{UButton}",
42
45
  clearIconName: "close",
43
46
  removeItemIcon: "{UIcon} ml-2",
44
47
  removeItemIconName: "close",
45
48
  dropzoneWrapperHover: "border-gray-400 border-dashed",
46
49
  dropzoneWrapperError: "hover:border-red-400 border-dashed border-red-300",
47
50
  input: "sr-only pointer-events-none size-0 opacity-0",
48
- buttonWrapper: "flex gap-4 items-center",
51
+ buttonWrapper: "flex gap-3 items-center",
49
52
  fileList: "{UFiles} w-full",
50
53
  i18n: {
51
54
  sizeError: "File size is too big.",
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, allSlotsFragment, getSlotNames } from "../service.storybook";
2
2
 
3
3
  import UInputFile from "../ui.form-input-file";
4
4
  import URow from "../ui.container-row";
@@ -19,9 +19,11 @@ export default {
19
19
  };
20
20
 
21
21
  const DefaultTemplate = (args) => ({
22
- components: { UInputFile, URow },
22
+ components: { UInputFile },
23
23
  setup() {
24
- return { args };
24
+ const slots = getSlotNames(UInputFile.name);
25
+
26
+ return { args, slots };
25
27
  },
26
28
  data() {
27
29
  return {
@@ -30,13 +32,13 @@ const DefaultTemplate = (args) => ({
30
32
  };
31
33
  },
32
34
  template: `
33
- <URow>
34
- <UInputFile
35
- v-bind="args"
36
- v-model="files"
37
- v-model:error="error"
38
- />
39
- </URow>
35
+ <UInputFile
36
+ v-bind="args"
37
+ v-model="files"
38
+ v-model:error="error"
39
+ >
40
+ ${allSlotsFragment}
41
+ </UInputFile>
40
42
  `,
41
43
  });
42
44
 
@@ -52,7 +54,7 @@ const SlotTemplate = (args) => ({
52
54
  };
53
55
  },
54
56
  template: `
55
- <UInputFile
57
+ <UInputFile
56
58
  v-bind="args"
57
59
  v-model="files"
58
60
  v-model:error="error"
@@ -1,7 +1,18 @@
1
1
  <template>
2
- <ULabel :label="label" :align="labelAlign" :error="error" :size="size" v-bind="labelAttrs">
2
+ <ULabel
3
+ :for="id"
4
+ :size="size"
5
+ :label="label"
6
+ :error="error"
7
+ :align="labelAlign"
8
+ :description="description"
9
+ v-bind="labelAttrs"
10
+ >
3
11
  <div ref="dropZoneRef" :ondrop="onDrop" v-bind="dropzoneWrapperAttrs">
4
- <UText :size="nestedComponentSize" :html="description" v-bind="descriptionAttrs" />
12
+ <UText v-if="hasSlotContent($slots['top'])" :size="size" v-bind="descriptionTopAttrs">
13
+ <!-- @slot Use it to add something at the top of the file block. -->
14
+ <slot name="top" />
15
+ </UText>
5
16
 
6
17
  <div v-bind="contentWrapperAttrs">
7
18
  <!-- @slot Use it to add something before the placeholder. -->
@@ -16,7 +27,7 @@
16
27
  pill
17
28
  internal
18
29
  interactive
19
- size="2xs"
30
+ :size="removeItemIconSize"
20
31
  :name="config.removeItemIconName"
21
32
  :data-cy="`${dataCy}-remove-item`"
22
33
  v-bind="removeItemIconAttrs"
@@ -29,23 +40,15 @@
29
40
  <template v-if="Array.isArray(currentFiles) || !currentFiles">
30
41
  <UButton
31
42
  filled
32
- tag="label"
33
43
  :for="id"
44
+ tag="label"
34
45
  variant="thirdary"
35
- :size="nestedComponentSize"
46
+ :size="buttonSize"
47
+ :icon-right="config.chooseFileIconName"
36
48
  :label="currentLocale.uploadFile"
37
49
  :data-cy="`${dataCy}-upload`"
38
50
  v-bind="buttonAttrs"
39
- >
40
- <template #right>
41
- <UIcon
42
- internal
43
- :size="nestedComponentSize"
44
- :name="config.chooseFileIconName"
45
- v-bind="chooseFileIconAttrs"
46
- />
47
- </template>
48
- </UButton>
51
+ />
49
52
 
50
53
  <input
51
54
  :id="id"
@@ -58,19 +61,25 @@
58
61
  />
59
62
  </template>
60
63
 
61
- <UIcon
64
+ <UButton
62
65
  v-if="isValue"
63
66
  pill
64
- internal
65
- interactive
66
- :size="nestedComponentSize"
67
- :name="config.clearIconName"
67
+ square
68
+ filled
69
+ variant="thirdary"
70
+ :size="buttonSize"
71
+ :icon-left="config.clearIconName"
72
+ v-bind="clearButtonAttrs"
68
73
  :data-cy="`${dataCy}-clear`"
69
- v-bind="clearIconAttrs"
70
74
  @click="onClickResetFiles"
71
75
  />
72
76
  </div>
73
77
  </div>
78
+
79
+ <UText v-if="hasSlotContent($slots['bottom'])" :size="size" v-bind="descriptionBottomAttrs">
80
+ <!-- @slot Use it to add something at the bottom of the file block. -->
81
+ <slot name="bottom" />
82
+ </UText>
74
83
  </div>
75
84
  </ULabel>
76
85
  </template>
@@ -116,7 +125,7 @@ const props = defineProps({
116
125
 
117
126
  /**
118
127
  * Set label placement related from the default slot.
119
- * @values top, topInside, topWithDesc, left, right
128
+ * @values top, topInside, topWithDesc
120
129
  */
121
130
  labelAlign: {
122
131
  type: String,
@@ -218,15 +227,16 @@ const {
218
227
  labelAttrs,
219
228
  buttonAttrs,
220
229
  dropzoneWrapperAttrs,
221
- descriptionAttrs,
230
+ descriptionTopAttrs,
231
+ descriptionBottomAttrs,
222
232
  contentWrapperAttrs,
223
- clearIconAttrs,
224
- chooseFileIconAttrs,
233
+ clearButtonAttrs,
225
234
  placeholderAttrs,
226
235
  inputAttrs,
227
236
  fileListAttrs,
228
237
  buttonWrapperAttrs,
229
238
  removeItemIconAttrs,
239
+ hasSlotContent,
230
240
  } = useAttrs(props);
231
241
 
232
242
  const i18nGlobal = tm(UInputFile);
@@ -265,16 +275,6 @@ const isValue = computed(() => {
265
275
  );
266
276
  });
267
277
 
268
- const nestedComponentSize = computed(() => {
269
- let size = "sm";
270
-
271
- if (props.size === "sm") size = "xs";
272
- if (props.size === "md") size = "sm";
273
- if (props.size === "lg") size = "md";
274
-
275
- return size;
276
- });
277
-
278
278
  const fileList = computed(() => {
279
279
  if (Array.isArray(currentFiles.value)) {
280
280
  return currentFiles.value;
@@ -283,6 +283,26 @@ const fileList = computed(() => {
283
283
  return currentFiles.value ? [currentFiles.value] : [];
284
284
  });
285
285
 
286
+ const removeItemIconSize = computed(() => {
287
+ const sizes = {
288
+ sm: "4xs",
289
+ md: "3xs",
290
+ lg: "2xs",
291
+ };
292
+
293
+ return sizes[props.size];
294
+ });
295
+
296
+ const buttonSize = computed(() => {
297
+ const sizes = {
298
+ sm: "xs",
299
+ md: "sm",
300
+ lg: "md",
301
+ };
302
+
303
+ return sizes[props.size];
304
+ });
305
+
286
306
  onMounted(() => {
287
307
  dropZoneRef.value.addEventListener("dragover", onDragOver);
288
308
  dropZoneRef.value.addEventListener("dragleave", onDragLeave);
@@ -6,9 +6,9 @@ export default /*tw*/ {
6
6
  rightSlot: "pr-0",
7
7
  leftSlot: "pl-0",
8
8
  },
9
- closeIcon: "{UIcon} flex h-full items-center mr-2",
9
+ closeIcon: "{UIcon} flex h-full items-center",
10
10
  closeIconName: "close",
11
- searchIcon: "{UIcon} mr-3",
11
+ searchIcon: "{UIcon}",
12
12
  searchIconName: "search",
13
13
  button: "{UButton} rounded-l-none ml-1 !ring-0 outline outline-1 outline-gray-900",
14
14
  defaultVariants: {
@@ -27,7 +27,7 @@ const DefaultTemplate = (args) => ({
27
27
  };
28
28
  },
29
29
  template: `
30
- <UInputSearch v-bind="args">
30
+ <UInputSearch v-bind="args" v-model="args.modelValue">
31
31
  ${allSlotsFragment}
32
32
  </UInputSearch>
33
33
  `,
@@ -41,7 +41,7 @@ const SlotTemplate = (args) => ({
41
41
  };
42
42
  },
43
43
  template: `
44
- <UInputSearch v-bind="args">
44
+ <UInputSearch v-bind="args" v-model="args.modelValue">
45
45
  ${args.slotTemplate || ""}
46
46
  </UInputSearch>
47
47
  `,
@@ -60,6 +60,7 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
60
60
  <UInputSearch
61
61
  v-for="(size, index) in sizes"
62
62
  v-bind="args"
63
+ v-model="args.modelValue"
63
64
  :size="size"
64
65
  :key="index"
65
66
  >
@@ -20,22 +20,46 @@
20
20
  <slot name="left" />
21
21
  </template>
22
22
 
23
- <template #right>
24
- <!-- @slot Use it to add something after the text. -->
25
- <slot name="right" />
23
+ <template #icon-left>
24
+ <!-- @slot Use it to add icon before the text. -->
25
+ <slot name="icon-left" />
26
+ </template>
26
27
 
27
- <template v-if="!hasSlotContent($slots['right'])">
28
+ <template #icon-right>
29
+ <UIcon
30
+ internal
31
+ interactive
32
+ color="gray"
33
+ :name="config.closeIconName"
34
+ :data-cy="`${dataCy}-close`"
35
+ :size="iconSize"
36
+ v-bind="closeIconAttrs"
37
+ @click="onClickClear"
38
+ />
39
+
40
+ <!-- @slot Use it to add icon after the text. -->
41
+ <slot
42
+ name="icon-right"
43
+ :icon-name="config.searchIconName"
44
+ :icon-size="iconSize"
45
+ :search-button-label="searchButtonLabel"
46
+ >
28
47
  <UIcon
48
+ v-if="!searchButtonLabel"
29
49
  internal
30
50
  interactive
31
- color="gray"
32
- :name="config.closeIconName"
33
- :data-cy="`${dataCy}-close`"
34
51
  :size="iconSize"
35
- v-bind="closeIconAttrs"
36
- @click="onClickClear"
52
+ :name="config.searchIconName"
53
+ :data-cy="`${dataCy}-search`"
54
+ v-bind="searchIconAttrs"
55
+ @click="onClickSearch"
37
56
  />
57
+ </slot>
58
+ </template>
38
59
 
60
+ <template #right>
61
+ <!-- @slot Use it to add something after the text. -->
62
+ <slot name="right">
39
63
  <UButton
40
64
  v-if="searchButtonLabel"
41
65
  :label="searchButtonLabel"
@@ -43,19 +67,7 @@
43
67
  :data-cy="`${dataCy}-right`"
44
68
  @click="onClickSearch"
45
69
  />
46
-
47
- <UIcon
48
- v-else
49
- internal
50
- interactive
51
- :size="iconSize"
52
- color="grayscale"
53
- :name="config.searchIconName"
54
- :data-cy="`${dataCy}-search`"
55
- v-bind="searchIconAttrs"
56
- @click="onClickSearch"
57
- />
58
- </template>
70
+ </slot>
59
71
  </template>
60
72
  </UInput>
61
73
  </template>
@@ -197,8 +209,7 @@ const emit = defineEmits([
197
209
 
198
210
  const localValue = ref("");
199
211
 
200
- const { config, inputAttrs, searchIconAttrs, closeIconAttrs, buttonAttrs, hasSlotContent } =
201
- useAttrs(props);
212
+ const { config, inputAttrs, searchIconAttrs, closeIconAttrs, buttonAttrs } = useAttrs(props);
202
213
 
203
214
  const search = computed({
204
215
  get: () => props.modelValue,
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: {
3
- base: "flex gap-2",
3
+ base: "flex gap-2 w-auto",
4
4
  variants: {
5
5
  align: {
6
6
  top: "flex-col",
@@ -17,13 +17,13 @@ export default /*tw*/ {
17
17
  { align: "right", size: "sm", class: "gap-2.5" },
18
18
  { align: "right", size: "md", class: "gap-3" },
19
19
  { align: "right", size: "lg", class: "gap-3.5" },
20
- { align: "left", centred: true, class: "items-center" },
21
- { align: "right", centred: true, class: "items-center" },
20
+ { align: "left", centred: true, class: "items-center w-auto" },
21
+ { align: "right", centred: true, class: "items-center w-auto" },
22
22
  ],
23
23
  },
24
24
  labelWrapper: "",
25
25
  label: {
26
- base: "text-gray-900 z-10 block !leading-none",
26
+ base: "text-gray-900 z-10 block !leading-none w-max",
27
27
  variants: {
28
28
  size: {
29
29
  sm: "text-xs",
@@ -5,7 +5,7 @@ export default /*tw*/ {
5
5
  wrapper: {
6
6
  base: `
7
7
  py-2 flex flex-row-reverse justify-between w-full min-h-full box-border relative
8
- rounded-lg border border-gray-300 bg-white
8
+ rounded-md border border-gray-300 bg-white
9
9
  hover:border-gray-400 hover:transition hover:focus-within:border-brand-500
10
10
  focus-within:border-brand-500 focus-within:ring-4 focus-within:ring-brand-600/[.15] focus-within:outline-none
11
11
  `,
@@ -24,6 +24,7 @@ export default /*tw*/ {
24
24
  },
25
25
  },
26
26
  compoundVariants: [
27
+ { labelAlign: "topInside", label: true, class: "rounded-lg" },
27
28
  { labelAlign: "topInside", label: true, size: "sm", class: "pt-5" },
28
29
  { labelAlign: "topInside", label: true, size: "md", class: "pt-6" },
29
30
  { labelAlign: "topInside", label: true, size: "lg", class: "pt-7" },
@@ -8,8 +8,9 @@
8
8
  :description="description"
9
9
  :align="labelAlign"
10
10
  :disabled="disabled"
11
- :data-cy="dataCy"
11
+ centred
12
12
  v-bind="labelAttrs"
13
+ :data-cy="dataCy"
13
14
  >
14
15
  <div
15
16
  ref="wrapperRef"
@@ -587,7 +588,7 @@ const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props
587
588
 
588
589
  const iconSize = computed(() => {
589
590
  const sizes = {
590
- sm: "sm",
591
+ sm: "xs",
591
592
  md: "sm",
592
593
  lg: "md",
593
594
  };
@@ -7,6 +7,7 @@ export default /*tw*/ {
7
7
  },
8
8
  },
9
9
  compoundVariants: [
10
+ { pill: true, size: "4xs", class: "p-0.5" },
10
11
  { pill: true, size: "3xs", class: "p-1" },
11
12
  { pill: true, size: "2xs", class: "p-1" },
12
13
  { pill: true, size: "xs", class: "p-2" },
@@ -26,6 +27,7 @@ export default /*tw*/ {
26
27
  base: "fill-current outline-0",
27
28
  variants: {
28
29
  size: {
30
+ "4xs": "size-2.5",
29
31
  "3xs": "size-3",
30
32
  "2xs": "size-3.5",
31
33
  xs: "size-4",
@@ -55,6 +57,7 @@ export default /*tw*/ {
55
57
  icon: {
56
58
  variants: {
57
59
  size: {
60
+ "4xs": "size-2.5",
58
61
  "3xs": "size-3",
59
62
  "2xs": "size-3.5",
60
63
  xs: "size-4",
@@ -57,7 +57,7 @@ const props = defineProps({
57
57
 
58
58
  /**
59
59
  * Icon size.
60
- * @values 3xs, 2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl
60
+ * @values 4xs, 3xs, 2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl
61
61
  */
62
62
  size: {
63
63
  type: String,
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.220",
4
+ "version": "0.0.221",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -3858,7 +3858,7 @@
3858
3858
  "description": "Icon size.",
3859
3859
  "value": {
3860
3860
  "kind": "expression",
3861
- "type": "'3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl'"
3861
+ "type": "'4xs' | '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl'"
3862
3862
  },
3863
3863
  "default": "md"
3864
3864
  },
@@ -4254,7 +4254,7 @@
4254
4254
  "description": "Set label placement related from the default slot.",
4255
4255
  "value": {
4256
4256
  "kind": "expression",
4257
- "type": "'top' | 'topInside' | 'topWithDesc' | 'left' | 'right'"
4257
+ "type": "'top' | 'topInside' | 'topWithDesc'"
4258
4258
  },
4259
4259
  "default": "topInside"
4260
4260
  },
@@ -4366,9 +4366,17 @@
4366
4366
  }
4367
4367
  ],
4368
4368
  "slots": [
4369
+ {
4370
+ "name": "top",
4371
+ "description": "Use it to add something at the top of the file block."
4372
+ },
4369
4373
  {
4370
4374
  "name": "left",
4371
4375
  "description": "Use it to add something before the placeholder."
4376
+ },
4377
+ {
4378
+ "name": "bottom",
4379
+ "description": "Use it to add something at the bottom of the file block."
4372
4380
  }
4373
4381
  ],
4374
4382
  "source": {
@@ -4993,6 +5001,26 @@
4993
5001
  "name": "left",
4994
5002
  "description": "Use it to add something before the text."
4995
5003
  },
5004
+ {
5005
+ "name": "icon-left",
5006
+ "description": "Use it to add icon before the text."
5007
+ },
5008
+ {
5009
+ "name": "icon-right",
5010
+ "scoped": true,
5011
+ "description": "Use it to add icon after the text.",
5012
+ "bindings": [
5013
+ {
5014
+ "name": "icon-name"
5015
+ },
5016
+ {
5017
+ "name": "icon-size"
5018
+ },
5019
+ {
5020
+ "name": "search-button-label"
5021
+ }
5022
+ ]
5023
+ },
4996
5024
  {
4997
5025
  "name": "right",
4998
5026
  "description": "Use it to add something after the text."