vueless 0.0.579 → 0.0.580
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/composables/useUI.ts +46 -60
- package/constants.js +3 -0
- package/package.json +1 -1
- package/types.ts +39 -48
- package/ui.button/UButton.vue +2 -3
- package/ui.button/types.ts +2 -2
- package/ui.button-link/ULink.vue +23 -24
- package/ui.button-link/storybook/stories.ts +2 -2
- package/ui.button-link/types.ts +7 -6
- package/ui.button-toggle/UToggle.vue +15 -16
- package/ui.button-toggle/storybook/stories.ts +2 -2
- package/ui.button-toggle/types.ts +6 -4
- package/ui.button-toggle-item/UToggleItem.vue +29 -20
- package/ui.button-toggle-item/storybook/stories.ts +2 -2
- package/ui.button-toggle-item/types.ts +5 -4
- package/ui.container-accordion/UAccordion.vue +22 -17
- package/ui.container-accordion/storybook/stories.ts +2 -2
- package/ui.container-accordion/types.ts +5 -4
- package/ui.container-card/UCard.vue +12 -5
- package/ui.container-card/storybook/stories.ts +2 -2
- package/ui.container-card/types.ts +4 -3
- package/ui.container-col/UCol.vue +11 -12
- package/ui.container-col/storybook/stories.ts +2 -2
- package/ui.container-col/types.ts +5 -3
- package/ui.container-divider/UDivider.vue +13 -13
- package/ui.container-divider/storybook/stories.ts +2 -2
- package/ui.container-divider/types.ts +5 -3
- package/ui.container-group/UGroup.vue +10 -8
- package/ui.container-group/storybook/stories.ts +2 -2
- package/ui.container-group/types.ts +5 -3
- package/ui.container-groups/UGroups.vue +10 -7
- package/ui.container-groups/storybook/stories.ts +2 -2
- package/ui.container-groups/types.ts +5 -3
- package/ui.container-modal/UModal.vue +43 -43
- package/ui.container-modal/storybook/stories.ts +2 -3
- package/ui.container-modal/types.ts +5 -3
- package/ui.container-modal-confirm/UModalConfirm.vue +14 -17
- package/ui.container-modal-confirm/storybook/stories.ts +8 -6
- package/ui.container-modal-confirm/types.ts +5 -3
- package/ui.container-page/UPage.vue +32 -31
- package/ui.container-page/storybook/stories.ts +2 -2
- package/ui.container-page/types.ts +4 -3
- package/ui.container-row/URow.vue +10 -13
- package/ui.container-row/storybook/stories.ts +2 -2
- package/ui.container-row/types.ts +5 -3
- package/ui.data-list/UDataList.vue +40 -51
- package/ui.data-list/storybook/stories.ts +2 -2
- package/ui.data-list/types.ts +4 -4
- package/ui.data-table/UTable.vue +61 -60
- package/ui.data-table/types.ts +4 -3
- package/ui.dropdown-badge/UDropdownBadge.vue +21 -25
- package/ui.dropdown-badge/storybook/stories.ts +3 -3
- package/ui.dropdown-badge/types.ts +4 -3
- package/ui.dropdown-button/UDropdownButton.vue +20 -23
- package/ui.dropdown-button/storybook/stories.ts +3 -3
- package/ui.dropdown-button/types.ts +4 -3
- package/ui.dropdown-link/UDropdownLink.vue +20 -23
- package/ui.dropdown-link/storybook/stories.ts +3 -3
- package/ui.dropdown-link/types.ts +4 -3
- package/ui.dropdown-list/UDropdownList.vue +28 -32
- package/ui.dropdown-list/storybook/stories.ts +4 -4
- package/ui.dropdown-list/types.ts +4 -4
- package/ui.form-calendar/UCalendar.vue +36 -34
- package/ui.form-calendar/UCalendarDayView.vue +28 -23
- package/ui.form-calendar/UCalendarMonthView.vue +24 -19
- package/ui.form-calendar/UCalendarYearView.vue +24 -19
- package/ui.form-calendar/config.ts +2 -2
- package/ui.form-calendar/storybook/stories.ts +2 -2
- package/ui.form-calendar/types.ts +8 -7
- package/ui.form-checkbox/UCheckbox.vue +23 -21
- package/ui.form-checkbox/storybook/stories.ts +2 -2
- package/ui.form-checkbox/types.ts +7 -5
- package/ui.form-checkbox-group/UCheckboxGroup.vue +17 -14
- package/ui.form-checkbox-group/storybook/stories.ts +2 -2
- package/ui.form-checkbox-group/types.ts +6 -6
- package/ui.form-checkbox-multi-state/UCheckboxMultiState.vue +33 -14
- package/ui.form-checkbox-multi-state/storybook/stories.ts +2 -2
- package/ui.form-checkbox-multi-state/types.ts +4 -4
- package/ui.form-color-picker/UColorPicker.vue +23 -21
- package/ui.form-color-picker/storybook/stories.ts +2 -2
- package/ui.form-color-picker/types.ts +5 -5
- package/ui.form-date-picker/UDatePicker.vue +42 -27
- package/ui.form-date-picker/config.ts +5 -5
- package/ui.form-date-picker/types.ts +5 -2
- package/ui.form-date-picker-range/UDatePickerRange.vue +80 -53
- package/ui.form-date-picker-range/types.ts +7 -4
- package/ui.form-input/UInput.vue +32 -28
- package/ui.form-input/storybook/stories.ts +2 -2
- package/ui.form-input/types.ts +5 -3
- package/ui.form-input-file/UInputFile.vue +37 -32
- package/ui.form-input-file/storybook/stories.ts +2 -2
- package/ui.form-input-file/types.ts +6 -4
- package/ui.form-input-money/UInputMoney.vue +13 -18
- package/ui.form-input-money/storybook/stories.ts +2 -2
- package/ui.form-input-money/types.ts +5 -3
- package/ui.form-input-number/UInputNumber.vue +23 -24
- package/ui.form-input-number/types.ts +4 -2
- package/ui.form-input-rating/UInputRating.vue +24 -19
- package/ui.form-input-rating/storybook/stories.ts +2 -2
- package/ui.form-input-rating/types.ts +5 -3
- package/ui.form-input-search/UInputSearch.vue +22 -20
- package/ui.form-input-search/storybook/stories.ts +2 -2
- package/ui.form-input-search/types.ts +5 -3
- package/ui.form-label/ULabel.vue +19 -11
- package/ui.form-label/config.ts +0 -1
- package/ui.form-label/storybook/stories.ts +2 -2
- package/ui.form-label/types.ts +10 -8
- package/ui.form-radio/URadio.vue +22 -12
- package/ui.form-radio/storybook/stories.ts +2 -2
- package/ui.form-radio/types.ts +5 -5
- package/ui.form-radio-group/URadioGroup.vue +16 -12
- package/ui.form-radio-group/storybook/stories.ts +2 -2
- package/ui.form-radio-group/types.ts +7 -7
- package/ui.form-select/USelect.vue +53 -39
- package/ui.form-switch/USwitch.vue +30 -23
- package/ui.form-switch/storybook/stories.ts +2 -2
- package/ui.form-switch/types.ts +5 -3
- package/ui.form-textarea/UTextarea.vue +19 -15
- package/ui.form-textarea/storybook/stories.ts +2 -2
- package/ui.form-textarea/types.ts +5 -3
- package/ui.image-avatar/UAvatar.vue +12 -11
- package/ui.image-avatar/types.ts +4 -2
- package/ui.image-icon/UIcon.vue +31 -18
- package/ui.image-icon/storybook/stories.ts +2 -2
- package/ui.image-icon/types.ts +12 -5
- package/ui.loader/ULoader.vue +11 -9
- package/ui.loader/storybook/stories.ts +2 -2
- package/ui.loader/types.ts +10 -3
- package/ui.loader-overlay/ULoaderOverlay.vue +11 -7
- package/ui.loader-overlay/storybook/stories.ts +2 -2
- package/ui.loader-overlay/types.ts +4 -3
- package/ui.loader-progress/ULoaderProgress.vue +14 -10
- package/ui.loader-progress/storybook/stories.ts +2 -2
- package/ui.loader-progress/types.ts +4 -3
- package/ui.navigation-pagination/UPagination.vue +34 -33
- package/ui.navigation-pagination/storybook/stories.ts +2 -2
- package/ui.navigation-pagination/types.ts +4 -3
- package/ui.navigation-progress/StepperProgress.vue +25 -12
- package/ui.navigation-progress/UProgress.vue +12 -12
- package/ui.navigation-progress/types.ts +4 -3
- package/ui.navigation-tab/UTab.vue +18 -9
- package/ui.navigation-tab/storybook/stories.ts +2 -2
- package/ui.navigation-tab/types.ts +4 -3
- package/ui.navigation-tabs/UTabs.vue +13 -8
- package/ui.navigation-tabs/storybook/stories.ts +2 -2
- package/ui.navigation-tabs/types.ts +5 -5
- package/ui.other-dot/UDot.vue +10 -8
- package/ui.other-dot/storybook/stories.ts +2 -2
- package/ui.other-dot/types.ts +4 -3
- package/ui.text-alert/UAlert.vue +24 -27
- package/ui.text-alert/storybook/stories.ts +2 -2
- package/ui.text-alert/types.ts +4 -3
- package/ui.text-badge/UBadge.vue +25 -13
- package/ui.text-badge/storybook/stories.ts +2 -2
- package/ui.text-badge/types.ts +4 -3
- package/ui.text-block/UText.vue +10 -9
- package/ui.text-block/storybook/stories.ts +2 -2
- package/ui.text-block/types.ts +4 -3
- package/ui.text-empty/UEmpty.vue +22 -19
- package/ui.text-empty/storybook/stories.ts +2 -2
- package/ui.text-empty/types.ts +4 -3
- package/ui.text-file/UFile.vue +23 -20
- package/ui.text-file/storybook/stories.ts +2 -2
- package/ui.text-file/types.ts +4 -3
- package/ui.text-files/UFiles.vue +16 -10
- package/ui.text-files/storybook/stories.ts +2 -2
- package/ui.text-files/types.ts +4 -3
- package/ui.text-header/UHeader.vue +11 -11
- package/ui.text-header/storybook/stories.ts +2 -2
- package/ui.text-header/types.ts +4 -3
- package/ui.text-money/UMoney.vue +20 -27
- package/ui.text-money/storybook/stories.ts +2 -2
- package/ui.text-money/types.ts +4 -3
- package/ui.text-notify/UNotify.vue +58 -41
- package/ui.text-notify/config.ts +3 -3
- package/ui.text-notify/constants.ts +18 -20
- package/ui.text-notify/storybook/stories.ts +2 -2
- package/ui.text-notify/types.ts +10 -5
- package/ui.text-notify/utilNotify.ts +17 -11
- package/utils/helper.ts +5 -5
- package/utils/storybook.ts +11 -1
- package/utils/ui.ts +19 -9
- package/web-types.json +521 -368
- package/ui.button-link/useAttrs.ts +0 -20
- package/ui.button-toggle/useAttrs.ts +0 -12
- package/ui.button-toggle-item/useAttrs.ts +0 -29
- package/ui.container-accordion/useAttrs.ts +0 -26
- package/ui.container-card/useAttrs.ts +0 -12
- package/ui.container-col/useAttrs.ts +0 -12
- package/ui.container-divider/useAttrs.ts +0 -17
- package/ui.container-group/useAttrs.ts +0 -12
- package/ui.container-groups/useAttrs.ts +0 -12
- package/ui.container-modal/useAttrs.ts +0 -12
- package/ui.container-modal-confirm/useAttrs.ts +0 -12
- package/ui.container-page/useAttrs.ts +0 -12
- package/ui.container-row/useAttrs.ts +0 -12
- package/ui.data-list/useAttrs.ts +0 -12
- package/ui.data-table/useAttrs.ts +0 -31
- package/ui.dropdown-badge/useAttrs.ts +0 -26
- package/ui.dropdown-button/useAttrs.ts +0 -26
- package/ui.dropdown-link/useAttrs.ts +0 -26
- package/ui.dropdown-list/useAttrs.ts +0 -12
- package/ui.form-calendar/useAttrs.ts +0 -12
- package/ui.form-checkbox/useAttrs.ts +0 -29
- package/ui.form-checkbox-group/useAttrs.ts +0 -12
- package/ui.form-checkbox-multi-state/useAttrs.ts +0 -37
- package/ui.form-color-picker/useAttrs.ts +0 -15
- package/ui.form-date-picker/useAttrs.ts +0 -43
- package/ui.form-date-picker-range/useAttrs.ts +0 -53
- package/ui.form-input/useAttrs.ts +0 -31
- package/ui.form-input-file/useAttrs.ts +0 -21
- package/ui.form-input-money/useAttrs.ts +0 -15
- package/ui.form-input-number/useAttrs.ts +0 -15
- package/ui.form-input-rating/useAttrs.ts +0 -14
- package/ui.form-input-search/useAttrs.ts +0 -15
- package/ui.form-label/useAttrs.ts +0 -20
- package/ui.form-radio/useAttrs.ts +0 -29
- package/ui.form-radio-group/useAttrs.ts +0 -12
- package/ui.form-select/useAttrs.js +0 -19
- package/ui.form-switch/useAttrs.ts +0 -28
- package/ui.form-textarea/useAttrs.ts +0 -21
- package/ui.image-avatar/useAttrs.ts +0 -12
- package/ui.image-icon/useAttrs.ts +0 -12
- package/ui.loader/useAttrs.ts +0 -12
- package/ui.loader-overlay/useAttrs.ts +0 -12
- package/ui.loader-progress/useAttrs.ts +0 -12
- package/ui.navigation-pagination/useAttrs.ts +0 -12
- package/ui.navigation-progress/useAttrs.ts +0 -17
- package/ui.navigation-tab/useAttrs.ts +0 -28
- package/ui.navigation-tabs/useAttrs.ts +0 -12
- package/ui.other-dot/useAttrs.ts +0 -12
- package/ui.text-alert/useAttrs.ts +0 -12
- package/ui.text-badge/useAttrs.ts +0 -21
- package/ui.text-block/useAttrs.ts +0 -12
- package/ui.text-empty/useAttrs.ts +0 -12
- package/ui.text-file/useAttrs.ts +0 -12
- package/ui.text-files/useAttrs.ts +0 -12
- package/ui.text-header/useAttrs.ts +0 -12
- package/ui.text-money/useAttrs.ts +0 -12
- package/ui.text-notify/useAttrs.ts +0 -12
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
|
+
|
|
5
|
+
export type Config = typeof defaultConfig;
|
|
4
6
|
|
|
5
7
|
export type ButtonSize = "xs" | "sm" | "md";
|
|
6
8
|
|
|
7
|
-
export interface
|
|
9
|
+
export interface Props {
|
|
8
10
|
/**
|
|
9
11
|
* Input value.
|
|
10
12
|
*/
|
|
11
|
-
modelValue?: File
|
|
13
|
+
modelValue?: File[];
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Input label.
|
|
@@ -63,7 +65,7 @@ export interface UInputFileProps {
|
|
|
63
65
|
/**
|
|
64
66
|
* Component config object.
|
|
65
67
|
*/
|
|
66
|
-
config?: Config
|
|
68
|
+
config?: ComponentConfig<Config>;
|
|
67
69
|
|
|
68
70
|
/**
|
|
69
71
|
* Data-test attribute for automated testing.
|
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref, watch, onMounted, nextTick, useId } from "vue";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
5
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
5
6
|
|
|
6
7
|
import UInput from "../ui.form-input/UInput.vue";
|
|
7
8
|
|
|
8
9
|
import defaultConfig from "./config.ts";
|
|
9
|
-
import useAttrs from "./useAttrs.ts";
|
|
10
10
|
import useFormatCurrency from "./useFormatCurrency.ts";
|
|
11
11
|
import { UInputMoney } from "./constants.ts";
|
|
12
12
|
|
|
13
|
-
import type {
|
|
13
|
+
import type { Props, Config } from "./types.ts";
|
|
14
14
|
|
|
15
15
|
defineOptions({ inheritAttrs: false });
|
|
16
16
|
|
|
17
|
-
const props = withDefaults(defineProps<
|
|
18
|
-
|
|
19
|
-
symbol: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).symbol,
|
|
20
|
-
size: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).size,
|
|
21
|
-
minFractionDigits: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).minFractionDigits,
|
|
22
|
-
maxFractionDigits: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).maxFractionDigits,
|
|
23
|
-
decimalSeparator: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).decimalSeparator,
|
|
24
|
-
thousandsSeparator: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).thousandsSeparator,
|
|
25
|
-
positiveOnly: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).positiveOnly,
|
|
26
|
-
prefix: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).prefix,
|
|
27
|
-
readonly: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).readonly,
|
|
28
|
-
disabled: getDefault<UInputMoneyProps>(defaultConfig, UInputMoney).disabled,
|
|
17
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
+
...getDefaults<Props, Config>(defaultConfig, UInputMoney),
|
|
29
19
|
modelValue: "",
|
|
30
|
-
|
|
20
|
+
label: "",
|
|
21
|
+
placeholder: "",
|
|
31
22
|
});
|
|
32
23
|
|
|
33
24
|
const emit = defineEmits(["update:modelValue", "keyup", "blur", "input"]);
|
|
@@ -36,8 +27,6 @@ const moneyInputRef = ref<{ inputRef: HTMLInputElement } | null>(null);
|
|
|
36
27
|
|
|
37
28
|
const elementId = props.id || useId();
|
|
38
29
|
|
|
39
|
-
const { moneyInputAttrs } = useAttrs(props);
|
|
40
|
-
|
|
41
30
|
const { formattedValue, rawValue, setValue } = useFormatCurrency(elementId, () => ({
|
|
42
31
|
minFractionDigits: props.minFractionDigits,
|
|
43
32
|
maxFractionDigits: props.maxFractionDigits,
|
|
@@ -111,6 +100,12 @@ defineExpose({
|
|
|
111
100
|
*/
|
|
112
101
|
formattedValue,
|
|
113
102
|
});
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get element / nested component attributes for each config token ✨
|
|
106
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
107
|
+
*/
|
|
108
|
+
const { moneyInputAttrs } = useUI<Config>(defaultConfig);
|
|
114
109
|
</script>
|
|
115
110
|
|
|
116
111
|
<template>
|
|
@@ -11,9 +11,9 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
11
11
|
import UButton from "../../ui.button/UButton.vue";
|
|
12
12
|
|
|
13
13
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
14
|
-
import type {
|
|
14
|
+
import type { Props } from "../types.ts";
|
|
15
15
|
|
|
16
|
-
interface UInputMoneyArgs extends
|
|
16
|
+
interface UInputMoneyArgs extends Props {
|
|
17
17
|
slotTemplate?: string;
|
|
18
18
|
enum: "labelAlign" | "size";
|
|
19
19
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
|
+
|
|
5
|
+
export type Config = typeof defaultConfig;
|
|
4
6
|
|
|
5
7
|
export interface FormatOptions {
|
|
6
8
|
minFractionDigits: number;
|
|
@@ -11,7 +13,7 @@ export interface FormatOptions {
|
|
|
11
13
|
prefix: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
export interface
|
|
16
|
+
export interface Props {
|
|
15
17
|
/**
|
|
16
18
|
* Input value.
|
|
17
19
|
*/
|
|
@@ -109,7 +111,7 @@ export interface UInputMoneyProps {
|
|
|
109
111
|
/**
|
|
110
112
|
* Component config object.
|
|
111
113
|
*/
|
|
112
|
-
config?: Config
|
|
114
|
+
config?: ComponentConfig<Config>;
|
|
113
115
|
|
|
114
116
|
/**
|
|
115
117
|
* Data-test attribute for automated testing.
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
5
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
6
|
+
|
|
4
7
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
5
8
|
import UButton from "../ui.button/UButton.vue";
|
|
6
9
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
7
|
-
import { getDefault } from "../utils/ui.ts";
|
|
8
10
|
|
|
9
11
|
import defaultConfig from "./config.ts";
|
|
10
12
|
import { UInputNumber } from "./constants.ts";
|
|
11
|
-
import useAttrs from "./useAttrs.ts";
|
|
12
13
|
|
|
13
|
-
import type { UInputNumberProps } from "./types.ts";
|
|
14
|
+
import type { UInputNumberProps, Config } from "./types.ts";
|
|
14
15
|
|
|
15
16
|
defineOptions({ inheritAttrs: false });
|
|
16
17
|
|
|
17
18
|
const props = withDefaults(defineProps<UInputNumberProps>(), {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
max: getDefault<UInputNumberProps>(defaultConfig, UInputNumber).max,
|
|
21
|
-
labelAlign: getDefault<UInputNumberProps>(defaultConfig, UInputNumber).labelAlign,
|
|
22
|
-
size: getDefault<UInputNumberProps>(defaultConfig, UInputNumber).size,
|
|
23
|
-
disabled: getDefault<UInputNumberProps>(defaultConfig, UInputNumber).disabled,
|
|
24
|
-
dataTest: "",
|
|
25
|
-
config: () => ({}),
|
|
19
|
+
...getDefaults<UInputNumberProps, Config>(defaultConfig, UInputNumber),
|
|
20
|
+
label: "",
|
|
26
21
|
});
|
|
27
22
|
|
|
28
23
|
const emit = defineEmits([
|
|
@@ -33,17 +28,6 @@ const emit = defineEmits([
|
|
|
33
28
|
"update:modelValue",
|
|
34
29
|
]);
|
|
35
30
|
|
|
36
|
-
const {
|
|
37
|
-
config,
|
|
38
|
-
valueAttrs,
|
|
39
|
-
labelAttrs,
|
|
40
|
-
removeButtonAttrs,
|
|
41
|
-
removeIconAttrs,
|
|
42
|
-
addButtonAttrs,
|
|
43
|
-
addIconAttrs,
|
|
44
|
-
numberAttrs,
|
|
45
|
-
} = useAttrs(props);
|
|
46
|
-
|
|
47
31
|
const count = computed({
|
|
48
32
|
get: () => props.modelValue,
|
|
49
33
|
set: (value) => emit("update:modelValue", value),
|
|
@@ -63,6 +47,21 @@ function onClickAdd() {
|
|
|
63
47
|
|
|
64
48
|
count.value = newCount <= props.max ? newCount : count.value;
|
|
65
49
|
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get element / nested component attributes for each config token ✨
|
|
53
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
54
|
+
*/
|
|
55
|
+
const {
|
|
56
|
+
config,
|
|
57
|
+
valueAttrs,
|
|
58
|
+
labelAttrs,
|
|
59
|
+
removeButtonAttrs,
|
|
60
|
+
removeIconAttrs,
|
|
61
|
+
addButtonAttrs,
|
|
62
|
+
addIconAttrs,
|
|
63
|
+
numberAttrs,
|
|
64
|
+
} = useUI<Config>(defaultConfig);
|
|
66
65
|
</script>
|
|
67
66
|
|
|
68
67
|
<template>
|
|
@@ -91,7 +90,7 @@ function onClickAdd() {
|
|
|
91
90
|
<UIcon
|
|
92
91
|
internal
|
|
93
92
|
:size="size"
|
|
94
|
-
:name="config.defaults
|
|
93
|
+
:name="config.defaults.removeIcon"
|
|
95
94
|
:color="isRemoveButtonDisabled ? 'gray' : 'grayscale'"
|
|
96
95
|
v-bind="removeIconAttrs"
|
|
97
96
|
/>
|
|
@@ -115,7 +114,7 @@ function onClickAdd() {
|
|
|
115
114
|
<UIcon
|
|
116
115
|
internal
|
|
117
116
|
:size="size"
|
|
118
|
-
:name="config.defaults
|
|
117
|
+
:name="config.defaults.addIcon"
|
|
119
118
|
:color="isAddButtonDisabled ? 'gray' : 'grayscale'"
|
|
120
119
|
v-bind="addIconAttrs"
|
|
121
120
|
/>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
|
+
|
|
5
|
+
export type Config = typeof defaultConfig;
|
|
4
6
|
|
|
5
7
|
export interface UInputNumberProps {
|
|
6
8
|
/**
|
|
@@ -56,7 +58,7 @@ export interface UInputNumberProps {
|
|
|
56
58
|
/**
|
|
57
59
|
* Component config object.
|
|
58
60
|
*/
|
|
59
|
-
config?: Config
|
|
61
|
+
config?: ComponentConfig<Config>;
|
|
60
62
|
|
|
61
63
|
/**
|
|
62
64
|
* Data-test attribute for automated testing.
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
3
|
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
5
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
6
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
7
|
+
|
|
4
8
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
5
9
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
6
|
-
import { hasSlotContent } from "../utils/helper.ts";
|
|
7
|
-
import { getDefault } from "../utils/ui.ts";
|
|
8
10
|
|
|
9
11
|
import { UInputRating } from "./constants.ts";
|
|
10
12
|
import defaultConfig from "./config.ts";
|
|
11
|
-
import useAttrs from "./useAttrs.ts";
|
|
12
13
|
|
|
13
|
-
import type {
|
|
14
|
+
import type { Props, IconSize, Config } from "./types.ts";
|
|
14
15
|
|
|
15
16
|
defineOptions({ inheritAttrs: false });
|
|
16
17
|
|
|
17
|
-
const props = withDefaults(defineProps<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
labelAlign: getDefault<UInputRatingProps>(defaultConfig, UInputRating).labelAlign,
|
|
21
|
-
counter: getDefault<UInputRatingProps>(defaultConfig, UInputRating).counter,
|
|
22
|
-
selectable: getDefault<UInputRatingProps>(defaultConfig, UInputRating).selectable,
|
|
23
|
-
modelValue: 0,
|
|
24
|
-
dataTest: "",
|
|
25
|
-
config: () => ({}),
|
|
18
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
19
|
+
...getDefaults<Props, Config>(defaultConfig, UInputRating),
|
|
20
|
+
label: "",
|
|
26
21
|
});
|
|
27
22
|
|
|
28
23
|
const emit = defineEmits([
|
|
@@ -35,9 +30,6 @@ const emit = defineEmits([
|
|
|
35
30
|
|
|
36
31
|
const hovered = ref<number | null>(null);
|
|
37
32
|
|
|
38
|
-
const { config, inputLabelAttrs, containerAttrs, counterAttrs, totalAttrs, starsAttrs, starAttrs } =
|
|
39
|
-
useAttrs(props);
|
|
40
|
-
|
|
41
33
|
const iconSize = computed(() => {
|
|
42
34
|
const sizes = {
|
|
43
35
|
sm: "xs",
|
|
@@ -52,6 +44,14 @@ const counterValue = computed(() => {
|
|
|
52
44
|
return hovered.value || props.modelValue;
|
|
53
45
|
});
|
|
54
46
|
|
|
47
|
+
const starIcon = computed(() => {
|
|
48
|
+
return (star: number): string => {
|
|
49
|
+
return star <= counterValue.value
|
|
50
|
+
? config.value.defaults.selectedIcon
|
|
51
|
+
: config.value.defaults.unselectedIcon;
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
|
|
55
55
|
function onClickStar(newValue: number) {
|
|
56
56
|
if (props.selectable) {
|
|
57
57
|
const selected = newValue !== props.modelValue ? newValue : 0;
|
|
@@ -65,6 +65,13 @@ function onClickStar(newValue: number) {
|
|
|
65
65
|
function onMouseHover(overStar: number | null = null) {
|
|
66
66
|
if (props.selectable) hovered.value = overStar;
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get element / nested component attributes for each config token ✨
|
|
71
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
72
|
+
*/
|
|
73
|
+
const { config, inputLabelAttrs, containerAttrs, counterAttrs, totalAttrs, starsAttrs, starAttrs } =
|
|
74
|
+
useUI<Config>(defaultConfig);
|
|
68
75
|
</script>
|
|
69
76
|
|
|
70
77
|
<template>
|
|
@@ -97,9 +104,7 @@ function onMouseHover(overStar: number | null = null) {
|
|
|
97
104
|
:color="error ? 'red' : 'brand'"
|
|
98
105
|
:size="iconSize"
|
|
99
106
|
:interactive="selectable"
|
|
100
|
-
:name="
|
|
101
|
-
star <= counterValue ? config.defaults?.selectedIcon : config.defaults?.unselectedIcon
|
|
102
|
-
"
|
|
107
|
+
:name="starIcon(star)"
|
|
103
108
|
v-bind="starAttrs"
|
|
104
109
|
:data-test="`${dataTest}-rating-star-${star}`"
|
|
105
110
|
@click="onClickStar(star)"
|
|
@@ -9,9 +9,9 @@ import UInputRating from "../../ui.form-input-rating/UInputRating.vue";
|
|
|
9
9
|
import URow from "../../ui.container-row/URow.vue";
|
|
10
10
|
|
|
11
11
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
12
|
-
import type {
|
|
12
|
+
import type { Props } from "../types.ts";
|
|
13
13
|
|
|
14
|
-
interface UInputRatingArgs extends
|
|
14
|
+
interface UInputRatingArgs extends Props {
|
|
15
15
|
slotTemplate?: string;
|
|
16
16
|
enum: "size";
|
|
17
17
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
|
+
|
|
5
|
+
export type Config = typeof defaultConfig;
|
|
4
6
|
|
|
5
7
|
export type IconSize = "xs" | "sm" | "md";
|
|
6
8
|
|
|
7
|
-
export interface
|
|
9
|
+
export interface Props {
|
|
8
10
|
/**
|
|
9
11
|
* Rating value.
|
|
10
12
|
*/
|
|
@@ -58,7 +60,7 @@ export interface UInputRatingProps {
|
|
|
58
60
|
/**
|
|
59
61
|
* Component config object.
|
|
60
62
|
*/
|
|
61
|
-
config?: Config
|
|
63
|
+
config?: ComponentConfig<Config>;
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
* Data-test attribute for automated testing.
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useId, ref, watchEffect } from "vue";
|
|
3
3
|
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
5
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
6
|
+
import { createDebounce } from "../utils/helper.ts";
|
|
7
|
+
|
|
4
8
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
5
9
|
import UInput from "../ui.form-input/UInput.vue";
|
|
6
10
|
import UButton from "../ui.button/UButton.vue";
|
|
7
|
-
import { getDefault } from "../utils/ui.ts";
|
|
8
|
-
import { createDebounce } from "../utils/helper.ts";
|
|
9
11
|
|
|
10
12
|
import { UInputSearch } from "./constants.ts";
|
|
11
13
|
import defaultConfig from "./config.ts";
|
|
12
|
-
import useAttrs from "./useAttrs.ts";
|
|
13
14
|
|
|
14
|
-
import type {
|
|
15
|
+
import type { Props, IconSize, ButtonSize, Config } from "./types.ts";
|
|
15
16
|
|
|
16
17
|
defineOptions({ inheritAttrs: false });
|
|
17
18
|
|
|
18
|
-
const props = withDefaults(defineProps<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly: getDefault<UInputSearchProps>(defaultConfig, UInputSearch).readonly,
|
|
24
|
-
disabled: getDefault<UInputSearchProps>(defaultConfig, UInputSearch).disabled,
|
|
25
|
-
dataTest: "",
|
|
26
|
-
config: () => ({}),
|
|
19
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
+
...getDefaults<Props, Config>(defaultConfig, UInputSearch),
|
|
21
|
+
modelValue: "",
|
|
22
|
+
label: "",
|
|
23
|
+
placeholder: "",
|
|
27
24
|
});
|
|
28
25
|
|
|
29
26
|
const emit = defineEmits([
|
|
@@ -54,9 +51,6 @@ const inputRef = ref(null);
|
|
|
54
51
|
|
|
55
52
|
const elementId = props.id || useId();
|
|
56
53
|
|
|
57
|
-
const { config, searchInputAttrs, searchIconAttrs, clearIconAttrs, searchButtonAttrs } =
|
|
58
|
-
useAttrs(props);
|
|
59
|
-
|
|
60
54
|
const iconSize = computed(() => {
|
|
61
55
|
const sizes = {
|
|
62
56
|
sm: "xs",
|
|
@@ -83,7 +77,7 @@ watchEffect(() => {
|
|
|
83
77
|
}, Number(props.debounce));
|
|
84
78
|
});
|
|
85
79
|
|
|
86
|
-
function onUpdateValue(value) {
|
|
80
|
+
function onUpdateValue(value: string) {
|
|
87
81
|
localValue.value = value;
|
|
88
82
|
|
|
89
83
|
if (!value) {
|
|
@@ -125,6 +119,14 @@ defineExpose({
|
|
|
125
119
|
*/
|
|
126
120
|
inputRef,
|
|
127
121
|
});
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Get element / nested component attributes for each config token ✨
|
|
125
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
const { config, searchInputAttrs, searchIconAttrs, clearIconAttrs, searchButtonAttrs } =
|
|
129
|
+
useUI<Config>(defaultConfig);
|
|
128
130
|
</script>
|
|
129
131
|
|
|
130
132
|
<template>
|
|
@@ -163,7 +165,7 @@ defineExpose({
|
|
|
163
165
|
internal
|
|
164
166
|
interactive
|
|
165
167
|
color="gray"
|
|
166
|
-
:name="config.defaults
|
|
168
|
+
:name="config.defaults.clearIcon"
|
|
167
169
|
:size="iconSize"
|
|
168
170
|
v-bind="clearIconAttrs"
|
|
169
171
|
:data-test="`${dataTest}-clear`"
|
|
@@ -173,7 +175,7 @@ defineExpose({
|
|
|
173
175
|
<!-- @slot Use it to add icon after the text. -->
|
|
174
176
|
<slot
|
|
175
177
|
name="right-icon"
|
|
176
|
-
:icon-name="config.defaults
|
|
178
|
+
:icon-name="config.defaults.searchIcon"
|
|
177
179
|
:icon-size="iconSize"
|
|
178
180
|
:search-button-label="searchButtonLabel"
|
|
179
181
|
>
|
|
@@ -182,7 +184,7 @@ defineExpose({
|
|
|
182
184
|
internal
|
|
183
185
|
interactive
|
|
184
186
|
:size="iconSize"
|
|
185
|
-
:name="rightIcon || config.defaults
|
|
187
|
+
:name="rightIcon || config.defaults.searchIcon"
|
|
186
188
|
v-bind="searchIconAttrs"
|
|
187
189
|
:data-test="`${dataTest}-search-icon`"
|
|
188
190
|
@click="onClickSearch"
|
|
@@ -11,9 +11,9 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
11
11
|
import URow from "../../ui.container-row/URow.vue";
|
|
12
12
|
|
|
13
13
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
14
|
-
import type {
|
|
14
|
+
import type { Props } from "../types.ts";
|
|
15
15
|
|
|
16
|
-
interface UInputSearchArgs extends
|
|
16
|
+
interface UInputSearchArgs extends Props {
|
|
17
17
|
slotTemplate?: string;
|
|
18
18
|
enum: "size";
|
|
19
19
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
|
+
|
|
5
|
+
export type Config = typeof defaultConfig;
|
|
4
6
|
|
|
5
7
|
export type IconSize = "xs" | "sm" | "md";
|
|
6
8
|
export type ButtonSize = "xs" | "md" | "lg";
|
|
7
9
|
|
|
8
|
-
export interface
|
|
10
|
+
export interface Props {
|
|
9
11
|
/**
|
|
10
12
|
* Search input value.
|
|
11
13
|
*/
|
|
@@ -84,7 +86,7 @@ export interface UInputSearchProps {
|
|
|
84
86
|
/**
|
|
85
87
|
* Component config object.
|
|
86
88
|
*/
|
|
87
|
-
config?: Config
|
|
89
|
+
config?: ComponentConfig<Config>;
|
|
88
90
|
|
|
89
91
|
/**
|
|
90
92
|
* Data-test attribute for automated testing.
|
package/ui.form-label/ULabel.vue
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
5
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
5
6
|
|
|
6
7
|
import defaultConfig from "./config.ts";
|
|
7
8
|
import { ULabel, PLACEMENT } from "./constants.ts";
|
|
8
|
-
import useAttrs from "./useAttrs.ts";
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { Props, Config } from "./types.ts";
|
|
11
11
|
|
|
12
12
|
defineOptions({ inheritAttrs: false });
|
|
13
13
|
|
|
14
|
-
const props = withDefaults(defineProps<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
disabled: getDefault<ULabelProps>(defaultConfig, ULabel).disabled,
|
|
18
|
-
centred: getDefault<ULabelProps>(defaultConfig, ULabel).centred,
|
|
19
|
-
dataTest: "",
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
...getDefaults<Props, Config>(defaultConfig, ULabel),
|
|
16
|
+
label: "",
|
|
20
17
|
});
|
|
21
18
|
|
|
22
19
|
const emit = defineEmits([
|
|
@@ -29,8 +26,6 @@ const emit = defineEmits([
|
|
|
29
26
|
const labelRef = ref(null);
|
|
30
27
|
const wrapperRef = ref(null);
|
|
31
28
|
|
|
32
|
-
const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useAttrs(props);
|
|
33
|
-
|
|
34
29
|
const isHorizontalPlacement = computed(() => {
|
|
35
30
|
return props.align === PLACEMENT.left || props.align === PLACEMENT.right;
|
|
36
31
|
});
|
|
@@ -64,6 +59,19 @@ defineExpose({
|
|
|
64
59
|
*/
|
|
65
60
|
wrapperElement,
|
|
66
61
|
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get element / nested component attributes for each config token ✨
|
|
65
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
66
|
+
*/
|
|
67
|
+
const mutatedProps = computed(() => ({
|
|
68
|
+
error: Boolean(props.error),
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Config>(
|
|
72
|
+
defaultConfig,
|
|
73
|
+
mutatedProps,
|
|
74
|
+
);
|
|
67
75
|
</script>
|
|
68
76
|
|
|
69
77
|
<template>
|
package/ui.form-label/config.ts
CHANGED
|
@@ -11,9 +11,9 @@ import UText from "../../ui.text-block/UText.vue";
|
|
|
11
11
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
12
12
|
|
|
13
13
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
14
|
-
import type {
|
|
14
|
+
import type { Props } from "../types.ts";
|
|
15
15
|
|
|
16
|
-
interface ULabelArgs extends
|
|
16
|
+
interface ULabelArgs extends Props {
|
|
17
17
|
slotTemplate?: string;
|
|
18
18
|
enum: "align" | "size";
|
|
19
19
|
}
|
package/ui.form-label/types.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export type Config = typeof defaultConfig;
|
|
6
|
+
|
|
7
|
+
export interface Props {
|
|
6
8
|
/**
|
|
7
9
|
* Label text.
|
|
8
10
|
*/
|
|
9
11
|
label?: string;
|
|
10
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Set input id for label `for` attribute.
|
|
15
|
+
*/
|
|
16
|
+
for?: string;
|
|
17
|
+
|
|
11
18
|
/**
|
|
12
19
|
* Label description.
|
|
13
20
|
*/
|
|
@@ -38,15 +45,10 @@ export interface ULabelProps {
|
|
|
38
45
|
*/
|
|
39
46
|
centred?: boolean;
|
|
40
47
|
|
|
41
|
-
/**
|
|
42
|
-
* Set input id for label `for` attribute.
|
|
43
|
-
*/
|
|
44
|
-
for?: string;
|
|
45
|
-
|
|
46
48
|
/**
|
|
47
49
|
* Component config object.
|
|
48
50
|
*/
|
|
49
|
-
config?: Config
|
|
51
|
+
config?: ComponentConfig<Config>;
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* Data-test attribute for automated testing.
|