vueless 0.0.13 → 0.0.15

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.
Files changed (45) hide show
  1. package/README.md +33 -152
  2. package/package.json +2 -5
  3. package/preset.tailwind/index.js +95 -0
  4. package/service.storybook/index.js +1 -1
  5. package/service.ui/index.js +1 -1
  6. package/ui.button/index.vue +16 -3
  7. package/ui.button-link/index.vue +6 -3
  8. package/ui.container-page/configs/default.config.js +1 -1
  9. package/ui.data-table-cell/configs/default.config.js +2 -2
  10. package/ui.dropdown-badge/index.vue +11 -1
  11. package/ui.dropdown-button/index.vue +14 -2
  12. package/ui.dropdown-link/index.vue +11 -1
  13. package/ui.form-calendar/configs/default.config.js +1 -1
  14. package/ui.form-checkbox/index.vue +1 -1
  15. package/ui.form-color-picker/index.vue +1 -1
  16. package/ui.form-date-picker-range/configs/default.config.js +4 -4
  17. package/ui.form-input/configs/default.config.js +1 -1
  18. package/ui.form-input/index.vue +5 -8
  19. package/ui.form-input-file/configs/default.config.js +1 -1
  20. package/ui.form-input-file/index.vue +4 -8
  21. package/ui.form-input-rating/configs/default.config.js +1 -1
  22. package/ui.form-input-rating/index.vue +3 -7
  23. package/ui.form-label/configs/default.config.js +2 -0
  24. package/ui.form-label/index.vue +3 -3
  25. package/ui.form-radio/index.vue +5 -3
  26. package/ui.form-radio-card/composables/attrs.composable.js +3 -1
  27. package/ui.form-radio-card/configs/default.config.js +8 -2
  28. package/ui.form-radio-card/index.vue +26 -40
  29. package/ui.form-select/configs/default.config.js +3 -3
  30. package/ui.form-select/index.vue +7 -18
  31. package/ui.form-switch/index.vue +1 -1
  32. package/ui.form-textarea/index.vue +2 -2
  33. package/ui.navigation-stepper/index.vue +1 -1
  34. package/ui.notify/index.vue +3 -3
  35. package/ui.other-loader-top/composables/attrs.composable.js +32 -0
  36. package/ui.other-loader-top/configs/default.config.js +20 -0
  37. package/ui.other-loader-top/constants/index.js +8 -0
  38. package/ui.other-loader-top/index.vue +230 -0
  39. package/ui.other-loader-top/services/loaderTop.service.js +31 -0
  40. package/ui.text-badge/index.vue +7 -0
  41. package/web-types.json +36 -132
  42. package/service.tailwind/index.js +0 -103
  43. package/ui.loader-top/components/TopProgress.vue +0 -277
  44. package/ui.loader-top/index.vue +0 -221
  45. /package/{ui.loader-top → ui.other-loader-top}/store/index.js +0 -0
@@ -49,7 +49,7 @@ export default /*tw*/ {
49
49
  },
50
50
  defaultVariants: {
51
51
  size: "md",
52
- labelOutside: false,
52
+ labelAlign: "topInside",
53
53
  allowedFileTypes: [".png", ".jpg", ".jpeg", ".pdf", ".txt", ".doc", ".docx", "xls", ".xlsx"],
54
54
  maxFileSize: 1,
55
55
  maxFiles: 3,
@@ -100,11 +100,11 @@ const props = defineProps({
100
100
 
101
101
  /**
102
102
  * Set label placement related from the default slot.
103
- * @values topInside, top, left, right
103
+ * @values top, topInside, topWithDesc, bottom, left, right
104
104
  */
105
- labelOutside: {
106
- type: Boolean,
107
- default: UIService.get(defaultConfig, UInputFile).default.labelOutside,
105
+ labelAlign: {
106
+ type: String,
107
+ default: UIService.get(defaultConfig, UInputFile).default.labelAlign,
108
108
  },
109
109
 
110
110
  /**
@@ -226,10 +226,6 @@ const filesList = computed(() => {
226
226
  });
227
227
  });
228
228
 
229
- const labelAlign = computed(() => {
230
- return props.labelOutside ? "top" : "topInside";
231
- });
232
-
233
229
  const fileId = computed(() => {
234
230
  return `file-${props.id}`;
235
231
  });
@@ -20,6 +20,6 @@ export default /*tw*/ {
20
20
  starsNumber: 5,
21
21
  selectable: false,
22
22
  noCounter: false,
23
- labelOutside: false,
23
+ labelAlign: "topInside",
24
24
  },
25
25
  };
@@ -97,11 +97,11 @@ const props = defineProps({
97
97
 
98
98
  /**
99
99
  * Set label placement related from the default slot.
100
- * @values topInside, top, left, right
100
+ * @values top, topInside, topWithDesc, bottom, left, right
101
101
  */
102
- labelOutside: {
102
+ labelAlign: {
103
103
  type: String,
104
- default: UIService.get(defaultConfig, UInputRating).default.placement,
104
+ default: UIService.get(defaultConfig, UInputRating).default.labelAlign,
105
105
  },
106
106
 
107
107
  /**
@@ -152,10 +152,6 @@ const hovered = ref(null);
152
152
  const { counterAttrs, ratingAttrs, wrapperAttrs, iconsAttrs, iconsContainerAttrs, labelAttrs } =
153
153
  useAttrs(props);
154
154
 
155
- const labelAlign = computed(() => {
156
- return props.labelOutside ? "top" : "topInside";
157
- });
158
-
159
155
  const iconSize = computed(() => {
160
156
  const sizes = {
161
157
  sm: "xs",
@@ -13,6 +13,7 @@ export default /*tw*/ {
13
13
  topWithDesc: "flex-col-reverse w-fit",
14
14
  left: "flex-row w-fit",
15
15
  right: "flex-row-reverse w-fit",
16
+ bottom: "flex-col-reverse w-fit",
16
17
  },
17
18
  },
18
19
  compoundVariants: [
@@ -72,6 +73,7 @@ export default /*tw*/ {
72
73
  top: "pl-0",
73
74
  left: "pl-0",
74
75
  right: "pl-0",
76
+ bottom: "-order-1",
75
77
  },
76
78
  error: {
77
79
  true: "text-red-500",
@@ -91,7 +91,7 @@ const props = defineProps({
91
91
 
92
92
  /**
93
93
  * Set label placement related from the default slot.
94
- * @values topInside, top, topWithDesc, left, right
94
+ * @values top, topInside, topWithDesc, bottom, left, right
95
95
  */
96
96
  align: {
97
97
  type: String,
@@ -154,10 +154,10 @@ const wrapperRef = ref(null);
154
154
  const { wrapperAttrs, labelWrapperAttrs, labelAttrs, descriptionAttrs } = useAttrs(props);
155
155
 
156
156
  const isHorizontalPlacement = computed(
157
- () => props.placement === PLACEMENT.left || props.placement === PLACEMENT.right,
157
+ () => props.align === PLACEMENT.left || props.align === PLACEMENT.right,
158
158
  );
159
159
 
160
- const isTopWithDescPlacement = computed(() => props.placement === PLACEMENT.topWithDesc);
160
+ const isTopWithDescPlacement = computed(() => props.align === PLACEMENT.topWithDesc);
161
161
 
162
162
  const labelElement = computed(() => labelRef.value);
163
163
  const wrapperElement = computed(() => wrapperRef.value);
@@ -21,6 +21,8 @@
21
21
  @focus="onFocus"
22
22
  />
23
23
 
24
+ <slot />
25
+
24
26
  <template #footer>
25
27
  <slot name="footer" />
26
28
  </template>
@@ -93,7 +95,7 @@ const props = defineProps({
93
95
 
94
96
  /**
95
97
  * Set label placement related from the default slot.
96
- * @values left, right
98
+ * @values top, topInside, topWithDesc, bottom, left, right
97
99
  */
98
100
  labelAlign: {
99
101
  type: String,
@@ -142,7 +144,7 @@ const props = defineProps({
142
144
  },
143
145
  });
144
146
 
145
- const emit = defineEmits(["update:value"]);
147
+ const emit = defineEmits(["update:modelValue"]);
146
148
 
147
149
  const setRadioGroupSelectedItem = inject("setRadioGroupSelectedItem", null);
148
150
  const getRadioGroupName = inject("getRadioGroupName", null);
@@ -165,6 +167,6 @@ watchEffect(() => (radioSize.value = getRadioGroupSize ? getRadioGroupSize() : p
165
167
  function onFocus(event) {
166
168
  setRadioGroupSelectedItem && setRadioGroupSelectedItem(props.value);
167
169
 
168
- emit("update:value", event.target.value);
170
+ emit("update:modelValue", event.target.value);
169
171
  }
170
172
  </script>
@@ -17,8 +17,9 @@ export function useAttrs(props) {
17
17
  const radioClasses = computed(() => setColor(cvaRadio({ color: props.color }), props.color));
18
18
 
19
19
  const wrapperAttrsRaw = getAttrs("wrapper");
20
+ const itemsAttrs = getAttrs("items");
21
+ const labelAttrs = getAttrs("label");
20
22
  const radioAttrs = getAttrs("radio", { isComponent: true, classes: radioClasses });
21
- const labelAttrs = getAttrs("label", { isComponent: true });
22
23
  const iconAttrs = getAttrs("icon", { isComponent: true });
23
24
 
24
25
  const wrapperAttrs = computed(() => (classes) => ({
@@ -31,5 +32,6 @@ export function useAttrs(props) {
31
32
  iconAttrs,
32
33
  wrapperAttrs,
33
34
  labelAttrs,
35
+ itemsAttrs,
34
36
  };
35
37
  }
@@ -3,12 +3,18 @@ export default /*tw*/ {
3
3
  title: "text-base font-normal text-gray-900 mb-1 mt-3",
4
4
  description: "text-xs font-normal text-gray-500/[85]",
5
5
  radio: {
6
- base: "absolute right-4 top-2 !gap-0",
7
- label: "mr-1",
6
+ base: "w-full right-4 top-2 !gap-0",
7
+ radio: "absolute right-6 top-4",
8
8
  },
9
+ label: "size-full cursor-pointer",
10
+ items: `
11
+ relative mr-1 w-full cursor-pointer rounded-lg border border-solid border-gray-300 px-6 py-4
12
+ focus-within:border-gray-500 focus-within:ring-4 focus-within:ring-gray-600/[.15] hover:border-gray-400
13
+ `,
9
14
  icon: "mb-3 flex justify-center",
10
15
  defaultVariants: {
11
16
  color: "brand",
17
+ labelAlign: "top",
12
18
  gridCols: 2,
13
19
  withIcon: true,
14
20
  },
@@ -1,20 +1,25 @@
1
1
  <template>
2
2
  <div v-bind="wrapperAttrs(gridColsClass)">
3
- <template v-for="(item, index) in options" :key="id + index">
4
- <URadio
5
- :id="id + index"
6
- v-model="selectedItem"
7
- :value="item.value"
8
- :name="name"
9
- v-bind="radioAttrs"
10
- :label="item.label"
11
- :description="item.description"
12
- />
13
- <!-- @slot Use it to add icon. -->
14
- <slot v-if="withIcon" name="icon" :item="item">
15
- <UIcon :name="item.iconName" size="xl" :color="color" v-bind="iconAttrs" />
16
- </slot>
17
- </template>
3
+ <div v-for="(item, index) in options" :key="id + index" v-bind="itemsAttrs">
4
+ <label :for="id + index" v-bind="labelAttrs">
5
+ <URadio
6
+ :id="id + index"
7
+ v-model="selectedItem"
8
+ :value="item.value"
9
+ :name="name"
10
+ :label="item.label"
11
+ :checked="item.value === selectedItem"
12
+ :description="item.description"
13
+ :label-align="labelAlign"
14
+ v-bind="radioAttrs"
15
+ >
16
+ <!-- @slot Use it to add icon. -->
17
+ <slot v-if="withIcon" name="icon" :item="item">
18
+ <UIcon :name="item.iconName" size="xl" :color="color" v-bind="iconAttrs" />
19
+ </slot>
20
+ </URadio>
21
+ </label>
22
+ </div>
18
23
  </div>
19
24
  </template>
20
25
 
@@ -95,6 +100,11 @@ const props = defineProps({
95
100
  default: () => getRandomId(),
96
101
  },
97
102
 
103
+ labelAlign: {
104
+ type: String,
105
+ default: UIService.get(defaultConfig, URadioCard).default.labelAlign,
106
+ },
107
+
98
108
  /**
99
109
  * Sets component ui config object.
100
110
  */
@@ -112,33 +122,9 @@ const props = defineProps({
112
122
  },
113
123
  });
114
124
 
115
- // const labelConfig = {
116
- // wrapper: {
117
- // base: `
118
- // rounded-lg border border-solid border-gray-300 cursor-pointer relative w-full
119
- // hover:border-gray-400 focus-within:border-gray-500 focus-within:ring-4 focus-within:ring-gray-600/[.15]
120
- // px-6 py-4`,
121
- // },
122
- // label: {
123
- // base: "h-full w-full cursor-pointer",
124
- // variants: {
125
- // placement: {
126
- // topInside: "left-0 !top-0",
127
- // },
128
- // },
129
- // },
130
- // description: {
131
- // variants: {
132
- // placement: {
133
- // topInside: "pl-0",
134
- // },
135
- // },
136
- // },
137
- // };
138
-
139
125
  const emit = defineEmits(["update:modelValue"]);
140
126
 
141
- const { radioAttrs, iconAttrs, wrapperAttrs /* labelAttrs */ } = useAttrs(props);
127
+ const { radioAttrs, iconAttrs, wrapperAttrs, labelAttrs, itemsAttrs } = useAttrs(props);
142
128
 
143
129
  const isMobileDevice = computed(() => {
144
130
  return store.getters["breakpoint/isMobileDevice"];
@@ -1,8 +1,8 @@
1
1
  export default /*tw*/ {
2
- label: "relative w-full",
2
+ label: "w-full relative",
3
3
  wrapper: {
4
4
  base: `
5
- pb-2 flex flex-row-reverse justify-between w-full min-h-full static box-border
5
+ pb-2 flex flex-row-reverse justify-between w-full min-h-full box-border relative
6
6
  rounded-lg border border-gray-300 bg-white
7
7
  hover:border-gray-400 hover:transition hover:duration-100 hover:ease-in-out hover:focus-within:border-gray-500
8
8
  focus-within:border-gray-500 focus-within:ring-4 focus-within:ring-gray-600/[.15] focus-within:outline-none
@@ -133,6 +133,6 @@ export default /*tw*/ {
133
133
  searchable: true,
134
134
  noClear: false,
135
135
  addOption: false,
136
- labelOutside: false,
136
+ labelAlign: "topInside",
137
137
  },
138
138
  };
@@ -4,8 +4,8 @@
4
4
  :for="id"
5
5
  :size="size"
6
6
  :label="label"
7
- :error="errorMessage"
8
- :description="descriptionMessage"
7
+ :error="error"
8
+ :description="description"
9
9
  :align="labelAlign"
10
10
  :disabled="disabled"
11
11
  :data-cy="dataCy"
@@ -244,11 +244,12 @@ const props = defineProps({
244
244
  },
245
245
 
246
246
  /**
247
- * Show label outside the select block.
247
+ * Set label placement related from the default slot.
248
+ * @values top, topInside, topWithDesc, bottom, left, right
248
249
  */
249
- labelOutside: {
250
- type: Boolean,
251
- default: UIService.get(defaultConfig, USelect).default.labelOutside,
250
+ labelAlign: {
251
+ type: String,
252
+ default: UIService.get(defaultConfig, USelect).default.labelAlign,
252
253
  },
253
254
 
254
255
  /**
@@ -506,10 +507,6 @@ const isSelectedValueLabelVisible = computed(() => {
506
507
  return !props.multiple && isLocalValue.value && (!isOpen.value || !props.searchable);
507
508
  });
508
509
 
509
- const labelAlign = computed(() => {
510
- return props.labelOutside ? "top" : "topInside";
511
- });
512
-
513
510
  const filteredOptions = computed(() => {
514
511
  const normalizedSearch = search.value.toLowerCase().trim();
515
512
 
@@ -561,14 +558,6 @@ const isLocalValue = computed(() => {
561
558
  : Boolean(String(localValue.value));
562
559
  });
563
560
 
564
- const errorMessage = computed(() => {
565
- return !isOpen.value && props.error ? props.error : "";
566
- });
567
-
568
- const descriptionMessage = computed(() => {
569
- return !isOpen.value && props.description ? props.description : "";
570
- });
571
-
572
561
  watch(search, () => onSearchChange);
573
562
  watch(
574
563
  localValue,
@@ -61,7 +61,7 @@ const props = defineProps({
61
61
 
62
62
  /**
63
63
  * Label alignment.
64
- * @values left, right
64
+ * @values top, topInside, topWithDesc, bottom, left, right
65
65
  */
66
66
  labelAlign: {
67
67
  type: String,
@@ -99,8 +99,8 @@ const props = defineProps({
99
99
  },
100
100
 
101
101
  /**
102
- * Input label place (above the input box or inside of it).
103
- * @values topInside, top
102
+ * Set label placement related from the default slot.
103
+ * @values top, topInside, topWithDesc, bottom, left, right
104
104
  */
105
105
  labelAlign: {
106
106
  type: String,
@@ -46,7 +46,7 @@ import colors from "tailwindcss/colors";
46
46
 
47
47
  import UHeader from "../ui.text-header";
48
48
  import UIService from "../service.ui";
49
- import { grayColors } from "../service.tailwind";
49
+ import { grayColors } from "../preset.tailwind";
50
50
 
51
51
  import { UStepper } from "./constants/index";
52
52
  import defaultConfig from "./configs/default.config";
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <notifications
3
3
  group="notify"
4
- class="vueless-notify !top-3 mt-safe-top !w-full px-3 max-md:!left-0 md:!w-[22rem] md:px-0 lg:!top-4 lg:!mt-0"
4
+ class="vueless-notify mt-safe-top !top-3 !w-full px-3 max-md:!left-0 md:!w-[22rem] md:px-0 lg:!top-4 lg:!mt-0"
5
5
  :position="position"
6
6
  >
7
7
  <template #body="{ item, close: onClickClose }">
@@ -145,8 +145,8 @@ export default {
145
145
 
146
146
  const NOTIFY_CLASS = "vueless-notify";
147
147
  const classes = globalComponentConfig.UNotify?.positionClasses;
148
- const pageWidth = getOffsetWidth(classes.page);
149
- const asideWidth = getOffsetWidth(classes.aside);
148
+ const pageWidth = getOffsetWidth(classes.page || "UNotifyPage");
149
+ const asideWidth = getOffsetWidth(classes.aside || "UNotifyAside");
150
150
  const notifyWidth = getOffsetWidth(NOTIFY_CLASS);
151
151
 
152
152
  if (!pageWidth) return;
@@ -0,0 +1,32 @@
1
+ import useUI from "vueless/composable.ui";
2
+ import { cva } from "vueless/service.ui";
3
+
4
+ import defaultConfig from "../configs/default.config";
5
+ import { computed } from "vue";
6
+
7
+ export function useAttrs(props) {
8
+ const { config, getAttrs, setColor } = useUI(defaultConfig, () => props.config);
9
+ const { progress } = config.value;
10
+
11
+ const cvaProgress = cva({
12
+ base: progress.base,
13
+ variants: progress.variants,
14
+ compoundVariants: progress.compoundVariants,
15
+ });
16
+
17
+ const progressClasses = computed(() =>
18
+ setColor(
19
+ cvaProgress({
20
+ position: props.position,
21
+ color: props.color,
22
+ }),
23
+ props.color,
24
+ ),
25
+ );
26
+
27
+ const progressAttrs = getAttrs("progress", { classes: progressClasses.value });
28
+
29
+ return {
30
+ progressAttrs,
31
+ };
32
+ }
@@ -0,0 +1,20 @@
1
+ export default /*tw*/ {
2
+ progress: {
3
+ base: "top-0 left-0 right-0 fixed h-[3px] transition-all ease-linear bg-{color}-500",
4
+ variants: {
5
+ position: {
6
+ fixed: "fixed",
7
+ absolute: "absolute",
8
+ },
9
+ error: {
10
+ true: "bg-red-500",
11
+ },
12
+ },
13
+ },
14
+ progressMobile: "mt-safe-top mx-3 rounded max-w-[calc(100%-1.5rem)]",
15
+ defaultVariants: {
16
+ color: "blue",
17
+ position: "fixed",
18
+ },
19
+ safelist: (colors) => [{ pattern: `bg-(${colors})-500` }],
20
+ };
@@ -0,0 +1,8 @@
1
+ /*
2
+ This const is needed to prevent the issue in script setup:
3
+ `defineProps` is referencing locally declared variables. (vue/valid-define-props)
4
+ */
5
+ export const ULoaderTop = "ULoaderTop";
6
+
7
+ export const MAXIMUM = 97.5;
8
+ export const SPEED = 150;