vueless 0.0.185 → 0.0.187

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 (30) hide show
  1. package/package.json +1 -1
  2. package/ui.button/configs/default.config.js +1 -1
  3. package/ui.button-link/configs/default.config.js +2 -2
  4. package/ui.container-accordion/configs/default.config.js +1 -1
  5. package/ui.data-table/configs/default.config.js +1 -1
  6. package/ui.dropdown-badge/configs/default.config.js +1 -1
  7. package/ui.dropdown-button/configs/default.config.js +1 -1
  8. package/ui.dropdown-link/configs/default.config.js +1 -1
  9. package/ui.dropdown-list/composables/usePointer.js +23 -14
  10. package/ui.dropdown-list/configs/default.config.js +2 -2
  11. package/ui.dropdown-list/index.vue +29 -30
  12. package/ui.form-checkbox/configs/default.config.js +1 -1
  13. package/ui.form-input/configs/default.config.js +3 -3
  14. package/ui.form-input/index.vue +10 -8
  15. package/ui.form-input-file/configs/default.config.js +1 -1
  16. package/ui.form-input-search/configs/default.config.js +2 -2
  17. package/ui.form-input-search/index.stories.js +3 -2
  18. package/ui.form-input-search/index.vue +71 -75
  19. package/ui.form-select/configs/default.config.js +5 -6
  20. package/ui.form-select/index.stories.js +4 -4
  21. package/ui.form-select/index.vue +18 -43
  22. package/ui.form-select/services/select.service.js +22 -20
  23. package/ui.form-switch/configs/default.config.js +3 -3
  24. package/ui.form-textarea/configs/default.config.js +2 -2
  25. package/ui.form-textarea/index.vue +8 -15
  26. package/ui.loader-rendering/configs/default.config.js +1 -1
  27. package/ui.loader-top/configs/default.config.js +1 -1
  28. package/ui.navigation-progress/configs/default.config.js +3 -3
  29. package/ui.text-notify/configs/default.config.js +3 -3
  30. package/web-types.json +42 -86
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.185",
3
+ "version": "0.0.187",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -3,7 +3,7 @@ export default /*tw*/ {
3
3
  base: `
4
4
  flex items-center justify-center
5
5
  text-base font-medium outline-none
6
- border border-solid transition-all
6
+ border border-solid transition
7
7
  focus:ring-opacity-20 focus:ring-4 focus:ring-{color}-700
8
8
  focus-within:ring-opacity-20 focus-within:ring-4 focus-within:ring-{color}-700
9
9
  disabled:ring-0 disabled:cursor-no-drop
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: {
3
3
  base: `
4
- w-fit inline-flex rounded transition-all
4
+ w-fit inline-flex rounded transition
5
5
  focus-within:ring-4 focus-within:ring-{color}-500 focus-within:ring-opacity-15 focus-visible:outline-none
6
6
  `,
7
7
  variants: {
@@ -28,7 +28,7 @@ export default /*tw*/ {
28
28
  },
29
29
  link: {
30
30
  base: `
31
- w-full inline-block !leading-none transition-all
31
+ w-full inline-block !leading-none transition
32
32
  text-{color}-500 decoration-{color}-500 underline-offset-4
33
33
  hover:text-opacity-80
34
34
  active:text-opacity-70
@@ -20,7 +20,7 @@ export default /*tw*/ {
20
20
  lg: "text-base",
21
21
  },
22
22
  isOpened: {
23
- true: "h-full pt-3 opacity-100 transition-all",
23
+ true: "h-full pt-3 opacity-100 transition",
24
24
  },
25
25
  },
26
26
  },
@@ -43,7 +43,7 @@ export default /*tw*/ {
43
43
  headerLoader: "absolute !top-auto",
44
44
  body: "group/body divide-none",
45
45
  bodyRow: "hover:bg-gray-50",
46
- bodyRowChecked: "bg-gray-100 transition-all",
46
+ bodyRowChecked: "bg-gray-100 transition",
47
47
  bodyRowBefore: "!p-0",
48
48
  bodyRowBeforeCell: "py-1",
49
49
  bodyRowAfter: "!p-0",
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "relative inline-block",
3
3
  badge: "cursor-pointer",
4
- icon: "transition-all duration-300",
4
+ icon: "transition duration-300",
5
5
  iconName: "keyboard_arrow_down",
6
6
  iconRotate: "rotate-180",
7
7
  listWrapper: {
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "relative inline-block",
3
3
  button: "",
4
- icon: "transition-all duration-300",
4
+ icon: "transition duration-300",
5
5
  iconName: "keyboard_arrow_down",
6
6
  iconRotate: "rotate-180",
7
7
  listWrapper: {
@@ -2,7 +2,7 @@ export default /*tw*/ {
2
2
  wrapper: "relative inline-block",
3
3
  trigger: "flex items-center relative space-x-0.5",
4
4
  link: "",
5
- icon: "block transition-all duration-300",
5
+ icon: "block transition duration-300",
6
6
  iconName: "keyboard_arrow_down",
7
7
  iconRotate: "rotate-180",
8
8
  listWrapper: {
@@ -1,17 +1,32 @@
1
- import { ref, computed } from "vue";
1
+ import { ref, computed, toValue } from "vue";
2
2
 
3
- export default function usePointer(options, optionHeight, listWrapperElement) {
3
+ export default function usePointer(options, optionElements, listWrapperElement) {
4
4
  const pointer = ref(null);
5
5
  const pointerDirty = ref(false);
6
6
 
7
+ const activeElementHeight = computed(() => {
8
+ const isGroupLabel = toValue(optionElements).at(pointer.value).dataset.groupLabel;
9
+ const groupIndex = 2;
10
+
11
+ if (isGroupLabel) {
12
+ return toValue(optionElements)
13
+ .at(pointer.value - groupIndex)
14
+ .getBoundingClientRect().height;
15
+ }
16
+
17
+ return toValue(optionElements).at(pointer.value).getBoundingClientRect().height;
18
+ });
19
+
7
20
  const pointerPosition = computed(() => {
8
- return pointer.value * optionHeight || 0;
21
+ return pointer.value * activeElementHeight.value || 0;
9
22
  });
10
23
 
11
24
  function scrollWrapperToElement() {
12
- const visibleElements = listWrapperElement.value.getBoundingClientRect().height / optionHeight;
25
+ const visibleElements =
26
+ listWrapperElement.value.getBoundingClientRect().height / activeElementHeight.value;
13
27
  const currentElement = visibleElements - 1;
14
- const currentPointerPosition = pointerPosition.value - currentElement * optionHeight;
28
+ const currentPointerPosition =
29
+ pointerPosition.value - currentElement * activeElementHeight.value;
15
30
 
16
31
  if (listWrapperElement.value.scrollTop <= currentPointerPosition) {
17
32
  listWrapperElement.value.scrollTop = currentPointerPosition;
@@ -22,10 +37,7 @@ export default function usePointer(options, optionHeight, listWrapperElement) {
22
37
  if (pointer.value < options.length - 1) {
23
38
  pointer.value++;
24
39
 
25
- const isGroup =
26
- options[pointer.value].$isLabel ||
27
- options[pointer.value].isSubGroup ||
28
- options[pointer.value].$groupLabel;
40
+ const isGroup = options[pointer.value].isSubGroup || options[pointer.value].groupLabel;
29
41
 
30
42
  if (listWrapperElement) scrollWrapperToElement();
31
43
 
@@ -41,10 +53,7 @@ export default function usePointer(options, optionHeight, listWrapperElement) {
41
53
  if (pointer.value > 0) {
42
54
  pointer.value--;
43
55
 
44
- const isGroup =
45
- options[pointer.value].$isLabel ||
46
- options[pointer.value].isSubGroup ||
47
- options[pointer.value].$groupLabel;
56
+ const isGroup = options[pointer.value].isSubGroup || options[pointer.value].groupLabel;
48
57
 
49
58
  if (listWrapperElement && listWrapperElement.value.scrollTop >= pointerPosition.value) {
50
59
  listWrapperElement.value.scrollTop = pointerPosition.value;
@@ -54,7 +63,7 @@ export default function usePointer(options, optionHeight, listWrapperElement) {
54
63
  pointerBackward();
55
64
  }
56
65
  } else {
57
- if (options[pointer.value] && options[0].$isLabel) {
66
+ if (options[pointer.value] && options[0].groupLabel) {
58
67
  pointerForward();
59
68
  }
60
69
  }
@@ -5,7 +5,7 @@ export default /*tw*/ {
5
5
  overflow-auto [-webkit-overflow-scrolling:touch]
6
6
  focus:outline-none
7
7
  `,
8
- list: "inline-block list-none align-top m-0 min-w-full p-0 bg-white opacity-1 hover:transition-all",
8
+ list: "inline-block list-none align-top m-0 min-w-full p-0 bg-white opacity-1 hover:transition",
9
9
  subGroupLabel: {
10
10
  base: "pointer-events-none bg-transparent !font-medium !leading-none !uppercase !text-gray-500/[85] pt-1",
11
11
  variants: {
@@ -66,7 +66,7 @@ export default /*tw*/ {
66
66
  labelKey: "label",
67
67
  valueKey: "id",
68
68
  optionHeight: 40,
69
- maxHeight: undefined,
69
+ visibleOptions: undefined,
70
70
  disabled: false,
71
71
  addOption: false,
72
72
  },
@@ -13,15 +13,14 @@
13
13
  v-for="(option, index) of options"
14
14
  :id="`${id}-${index}`"
15
15
  :key="index"
16
- :role="!(option && (option.$isLabel || option.$isDisabled)) ? 'option' : null"
17
16
  v-bind="optionItemAttrs"
17
+ ref="optionsRef"
18
+ :role="!(option && option.groupLabel) ? 'option' : null"
19
+ :data-group-label="Boolean(option.groupLabel)"
18
20
  >
19
21
  <!-- option title -->
20
22
  <span
21
- v-if="
22
- !(option && (option.$isLabel || option.$isDisabled || option.isSubGroup)) &&
23
- !option.isHidden
24
- "
23
+ v-if="!(option && (option.groupLabel || option.isSubGroup)) && !option.isHidden"
25
24
  v-bind="optionAttrs(optionHighlight(index, option))"
26
25
  @click.stop="select(option)"
27
26
  @mouseenter.self="pointerSet(index)"
@@ -42,14 +41,8 @@
42
41
  </span>
43
42
 
44
43
  <!-- group title -->
45
- <div
46
- v-if="
47
- option &&
48
- (option.$isLabel || option.$isDisabled || option.isSubGroup) &&
49
- !option.isHidden
50
- "
51
- >
52
- <div v-if="option.$groupLabel" v-bind="groupLabelAttrs" v-text="option.$groupLabel" />
44
+ <div v-if="option && (option.groupLabel || option.isSubGroup) && !option.isHidden">
45
+ <div v-if="option.groupLabel" v-bind="groupLabelAttrs" v-text="option.groupLabel" />
53
46
 
54
47
  <div
55
48
  v-else-if="option.isSubGroup"
@@ -180,19 +173,11 @@ const props = defineProps({
180
173
  },
181
174
 
182
175
  /**
183
- * List max height in pixels.
176
+ * Amount of options you can see without scroll.
184
177
  */
185
- maxHeight: {
178
+ visibleOptions: {
186
179
  type: Number,
187
- default: UIService.get(defaultConfig, UDropdownList).default.maxHeight,
188
- },
189
-
190
- /**
191
- * List option height in pixels.
192
- */
193
- optionHeight: {
194
- type: Number,
195
- default: UIService.get(defaultConfig, UDropdownList).default.optionHeight,
180
+ default: UIService.get(defaultConfig, UDropdownList).default.visibleOptions,
196
181
  },
197
182
 
198
183
  /**
@@ -216,9 +201,10 @@ const props = defineProps({
216
201
  const emit = defineEmits(["update:modelValue", "addOption"]);
217
202
 
218
203
  const wrapperRef = ref(null);
204
+ const optionsRef = ref([]);
219
205
 
220
206
  const { pointer, pointerDirty, pointerSet, pointerBackward, pointerForward, pointerReset } =
221
- usePointer(props.options, props.optionHeight, wrapperRef);
207
+ usePointer(props.options, optionsRef, wrapperRef);
222
208
 
223
209
  const {
224
210
  config,
@@ -240,7 +226,15 @@ const {
240
226
 
241
227
  const { tm } = useLocale();
242
228
 
243
- defineExpose({ pointerSet, pointerBackward, pointerForward, pointerReset, addPointerElement });
229
+ defineExpose({
230
+ pointerSet,
231
+ pointerBackward,
232
+ pointerForward,
233
+ pointerReset,
234
+ addPointerElement,
235
+ optionsRef,
236
+ wrapperRef,
237
+ });
244
238
 
245
239
  const i18nGlobal = tm(UDropdownList);
246
240
  const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
@@ -249,16 +243,21 @@ const addOptionKeyCombination = computed(() => {
249
243
  return isMac ? "(⌘ + Enter)" : "(Ctrl + Enter)";
250
244
  });
251
245
 
252
- const wrapperHeight = computed(() =>
253
- props.maxHeight === undefined ? "auto" : `${props.maxHeight}px`,
254
- );
246
+ const wrapperHeight = computed(() => {
247
+ const maxHeight = optionsRef.value
248
+ .slice(0, props.visibleOptions)
249
+ .map((el) => el.getBoundingClientRect().height)
250
+ .reduce((acc, cur) => acc + cur, 0);
251
+
252
+ return props.visibleOptions === undefined ? "auto" : `${maxHeight}px`;
253
+ });
255
254
 
256
255
  function onClickAddOption() {
257
256
  emit("addOption");
258
257
  }
259
258
 
260
259
  function select(option, key) {
261
- if (props.disabled || option.$isDisabled || option.$isLabel) {
260
+ if (props.disabled || option.groupLabel) {
262
261
  return;
263
262
  }
264
263
 
@@ -20,7 +20,7 @@ export default /*tw*/ {
20
20
  icon: "",
21
21
  checkbox: {
22
22
  base: `
23
- border border-solid rounded border-gray-300 bg-white hover:transition-all
23
+ border border-solid rounded border-gray-300 bg-white hover:transition
24
24
  hover:border-gray-400
25
25
  focus:border-{color}-500 focus:ring-4 focus:ring-opacity-20 focus:ring-offset-0 focus:ring-{color}-500
26
26
  active:border-{color}-500 active:bg-{color}-500
@@ -8,7 +8,7 @@ export default /*tw*/ {
8
8
  passwordHiddenIconName: "visibility_off-fill",
9
9
  block: {
10
10
  base: `
11
- rounded-lg border border-solid border-gray-300 bg-white !opacity-100 relative flex transition-all
11
+ rounded-lg border border-solid border-gray-300 bg-white !opacity-100 relative flex transition
12
12
  hover:border-gray-400 hover:focus-within:border-brand-500
13
13
  focus-within:border-brand-500 focus-within:ring-4 focus-within:ring-brand-600/[.15]
14
14
  `,
@@ -31,7 +31,7 @@ export default /*tw*/ {
31
31
  input: {
32
32
  base: `
33
33
  block w-full pb-2 px-4 font-normal leading-none text-gray-900 placeholder:font-normal placeholder-gray-400
34
- transition-all bg-white border-none border-gray-300 rounded-lg shadow-none
34
+ transition bg-white border-none border-gray-300 rounded-lg shadow-none
35
35
  focus:outline-none focus:ring-0 disabled:opacity-50
36
36
  disabled:cursor-not-allowed disabled:text-gray-900 disabled:border-gray-100
37
37
  read-only:border-gray-300 read-only:ring-0
@@ -56,7 +56,7 @@ export default /*tw*/ {
56
56
  defaultVariants: {
57
57
  size: "md",
58
58
  type: "text",
59
- inputMode: "text",
59
+ inputmode: "text",
60
60
  error: false,
61
61
  readonly: false,
62
62
  disabled: false,
@@ -32,7 +32,7 @@
32
32
  :readonly="readonly"
33
33
  :disabled="disabled"
34
34
  :maxlength="maxLength"
35
- :inputmode="inputMode"
35
+ :inputmode="inputmode"
36
36
  :data-cy="dataCy"
37
37
  v-bind="inputAttrs"
38
38
  @focus="onFocus"
@@ -181,8 +181,8 @@ const props = defineProps({
181
181
  },
182
182
 
183
183
  /**
184
- * Input type.
185
- * @values text, number, email, tel, password, url
184
+ * Input type
185
+ * @values text, number, tel, email, url, search, password
186
186
  */
187
187
  type: {
188
188
  type: String,
@@ -191,12 +191,12 @@ const props = defineProps({
191
191
  },
192
192
 
193
193
  /**
194
- * Input mode (to show different mobile keyboard).
195
- * @values none, text, decimal, numeric, tel, email, url
194
+ * Set proper keyboard on mobile devices.
195
+ * @values text, decimal, numeric, tel, email, url, search, none
196
196
  */
197
- inputMode: {
197
+ inputmode: {
198
198
  type: String,
199
- default: UIService.get(defaultConfig, UInput).default.inputMode,
199
+ default: UIService.get(defaultConfig, UInput).default.inputmode,
200
200
  },
201
201
 
202
202
  /**
@@ -392,7 +392,9 @@ function setLabelPosition() {
392
392
  }
393
393
  }
394
394
 
395
- labelComponent.value.labelElement.style.left = `${leftSlotOrIconWidth}px`;
395
+ if (labelComponent.value.labelElement) {
396
+ labelComponent.value.labelElement.style.left = `${leftSlotOrIconWidth}px`;
397
+ }
396
398
  }
397
399
  </script>
398
400
 
@@ -12,7 +12,7 @@ export default /*tw*/ {
12
12
  dropzoneWrapper: {
13
13
  base: `
14
14
  size-auto w-full rounded-lg border border-solid border-gray-300 bg-white
15
- p-4 px-5 py-6 transition-all hover:border-gray-400
15
+ p-4 px-5 py-6 transition hover:border-gray-400
16
16
  `,
17
17
  variants: {
18
18
  error: {
@@ -8,9 +8,9 @@ export default /*tw*/ {
8
8
  },
9
9
  closeIcon: "flex h-full items-center mr-2",
10
10
  closeIconName: "close",
11
- searchIcon: "mr-2",
11
+ searchIcon: "mr-3",
12
12
  searchIconName: "search",
13
- button: "",
13
+ button: "rounded-l-none ml-1 !ring-0 outline outline-1 outline-gray-900",
14
14
  defaultVariants: {
15
15
  size: "md",
16
16
  labelAlign: "topInside",
@@ -44,7 +44,7 @@ const SlotTemplate = (args) => ({
44
44
  },
45
45
  template: `
46
46
  <UInputSearch v-bind="args">
47
- ${args.slotTemplate}
47
+ ${args.slotTemplate || ""}
48
48
  </UInputSearch>
49
49
  `,
50
50
  });
@@ -74,7 +74,7 @@ export const Default = DefaultTemplate.bind({});
74
74
  Default.args = {};
75
75
 
76
76
  export const searchButton = DefaultTemplate.bind({});
77
- searchButton.args = { searchButton: true, text: "Search" };
77
+ searchButton.args = { searchButtonLabel: "Search" };
78
78
 
79
79
  export const sizes = SizesTemplate.bind({});
80
80
  sizes.args = {};
@@ -87,6 +87,7 @@ slotLeft.args = {
87
87
  label="filter"
88
88
  variant="thirdary"
89
89
  filled
90
+ class="rounded-r-none !ring-0"
90
91
  />
91
92
  </template>
92
93
  `,