vueless 0.0.579 → 0.0.581
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 +48 -59
- 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,24 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, inject, onMounted, ref, useId } from "vue";
|
|
2
|
+
import { computed, inject, onMounted, ref, useId, toValue } from "vue";
|
|
3
3
|
|
|
4
4
|
import UButton from "../ui.button/UButton.vue";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import useUI from "../composables/useUI.ts";
|
|
7
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
6
8
|
|
|
7
9
|
import { TYPE_RADIO } from "../ui.button-toggle/constants.ts";
|
|
8
10
|
|
|
9
|
-
import useAttrs from "./useAttrs.ts";
|
|
10
11
|
import defaultConfig from "./config.ts";
|
|
11
12
|
import { UToggleItem } from "./constants.ts";
|
|
12
13
|
|
|
13
|
-
import type {
|
|
14
|
+
import type { Props, ToggleInjectValues, ToggleContextType, Config } from "./types.ts";
|
|
14
15
|
|
|
15
16
|
type ButtonSize = "2xs" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
16
17
|
|
|
17
18
|
defineOptions({ inheritAttrs: false });
|
|
18
19
|
|
|
19
|
-
const props = withDefaults(defineProps<
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
21
|
+
...getDefaults<Props, Config>(defaultConfig, UToggleItem),
|
|
22
|
+
modelValue: "",
|
|
23
|
+
label: "",
|
|
22
24
|
});
|
|
23
25
|
|
|
24
26
|
const emit = defineEmits([
|
|
@@ -32,26 +34,26 @@ const emit = defineEmits([
|
|
|
32
34
|
/* eslint-disable prettier/prettier */
|
|
33
35
|
const getToggleName = inject<() => string>("getToggleName", () => "toggle");
|
|
34
36
|
const getToggleType = inject<() => string>("getToggleType", () =>
|
|
35
|
-
|
|
37
|
+
getDefaults<ToggleInjectValues, Config>(defaultConfig, UToggleItem).type || TYPE_RADIO
|
|
36
38
|
);
|
|
37
39
|
const getToggleSize = inject<() => ButtonSize>("getToggleSize", () =>
|
|
38
|
-
(
|
|
40
|
+
(getDefaults<ToggleInjectValues, Config>(defaultConfig, UToggleItem).size || "md") as ButtonSize
|
|
39
41
|
);
|
|
40
42
|
const getToggleRound = inject<() => boolean>("getToggleRound", () =>
|
|
41
|
-
|
|
43
|
+
getDefaults<ToggleInjectValues, Config>(defaultConfig, UToggleItem).round || false
|
|
42
44
|
);
|
|
43
45
|
const getToggleBlock = inject<() => boolean>("getToggleBlock", () =>
|
|
44
|
-
|
|
46
|
+
getDefaults<ToggleInjectValues, Config>(defaultConfig, UToggleItem).block || false
|
|
45
47
|
);
|
|
46
48
|
const getToggleSquare = inject<() => boolean>("getToggleSquare", () =>
|
|
47
|
-
|
|
49
|
+
getDefaults<ToggleInjectValues, Config>(defaultConfig, UToggleItem).square || false
|
|
48
50
|
);
|
|
49
51
|
const getToggleVariant = inject<string>("getToggleVariant",
|
|
50
|
-
|
|
52
|
+
getDefaults<ToggleInjectValues, Config>(defaultConfig, UToggleItem).variant || "secondary"
|
|
51
53
|
);
|
|
52
54
|
const getToggleSeparated = inject<boolean>("getToggleSeparated", true);
|
|
53
55
|
const getToggleDisabled = inject<() => boolean>("getToggleDisabled", () =>
|
|
54
|
-
props.disabled ||
|
|
56
|
+
props.disabled || getDefaults<ToggleInjectValues, Config>(defaultConfig, UToggleItem).disabled || false
|
|
55
57
|
);
|
|
56
58
|
/* eslint-enable prettier/prettier */
|
|
57
59
|
|
|
@@ -70,12 +72,6 @@ const isSelected = computed(() => {
|
|
|
70
72
|
: selectedValue?.value === props.value;
|
|
71
73
|
});
|
|
72
74
|
|
|
73
|
-
const { toggleButtonAttrs, toggleInputAttrs } = useAttrs(props, {
|
|
74
|
-
isSelected,
|
|
75
|
-
separated: getToggleSeparated,
|
|
76
|
-
variant: getToggleVariant,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
75
|
onMounted(() => {
|
|
80
76
|
const propValueString = props.value?.toString() ?? "";
|
|
81
77
|
|
|
@@ -97,6 +93,19 @@ function onClickSetValue() {
|
|
|
97
93
|
|
|
98
94
|
emit("update:modelValue", props.value);
|
|
99
95
|
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get element / nested component attributes for each config token ✨
|
|
99
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
100
|
+
*/
|
|
101
|
+
const mutatedProps = computed(() => ({
|
|
102
|
+
variant: toValue(getToggleVariant),
|
|
103
|
+
separated: toValue(getToggleSeparated),
|
|
104
|
+
/* component state, not a props */
|
|
105
|
+
selected: isSelected.value,
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
const { toggleButtonAttrs, toggleInputAttrs } = useUI<Config>(defaultConfig, mutatedProps);
|
|
100
109
|
</script>
|
|
101
110
|
|
|
102
111
|
<template>
|
|
@@ -9,9 +9,9 @@ import UToggleItem from "../../ui.button-toggle-item/UToggleItem.vue";
|
|
|
9
9
|
import UIcon from "../../ui.image-icon/UIcon.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 UToggleItemArgs extends
|
|
14
|
+
interface UToggleItemArgs extends Props {
|
|
15
15
|
slotTemplate?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
3
|
import type { Ref } from "vue";
|
|
4
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
5
|
|
|
5
6
|
type UpdateSelectedValue = (value: string | number, checked: boolean) => void;
|
|
6
7
|
|
|
7
|
-
export type Config =
|
|
8
|
+
export type Config = typeof defaultConfig;
|
|
8
9
|
|
|
9
10
|
export interface ToggleInjectValues {
|
|
10
11
|
type?: string;
|
|
@@ -21,11 +22,11 @@ export interface ToggleContextType {
|
|
|
21
22
|
updateSelectedValue: UpdateSelectedValue;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export interface
|
|
25
|
+
export interface Props {
|
|
25
26
|
/**
|
|
26
27
|
* Selected value.
|
|
27
28
|
*/
|
|
28
|
-
modelValue?: string | number |
|
|
29
|
+
modelValue?: string | number | (string | number)[];
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Value for checkbox state.
|
|
@@ -50,7 +51,7 @@ export interface UToggleItemProps {
|
|
|
50
51
|
/**
|
|
51
52
|
* Component config object.
|
|
52
53
|
*/
|
|
53
|
-
config?: Config
|
|
54
|
+
config?: ComponentConfig<Config>;
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* Data-test attribute for automated testing.
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref, useId } 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 UDivider from "../ui.container-divider/UDivider.vue";
|
|
6
|
-
import { getDefault } from "../utils/ui.ts";
|
|
7
9
|
|
|
8
10
|
import { UAccordion } from "./constants.ts";
|
|
9
11
|
import defaultConfig from "./config.ts";
|
|
10
|
-
import useAttrs from "./useAttrs.ts";
|
|
11
12
|
|
|
12
|
-
import type {
|
|
13
|
+
import type { Props, DividerSize, Config } from "./types.ts";
|
|
13
14
|
|
|
14
15
|
defineOptions({ inheritAttrs: false });
|
|
15
16
|
|
|
16
|
-
const props = withDefaults(defineProps<
|
|
17
|
-
|
|
18
|
-
dataTest: "",
|
|
17
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
+
...getDefaults<Props, Config>(defaultConfig, UAccordion),
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const emit = defineEmits([
|
|
@@ -31,18 +31,8 @@ const isOpened = ref(false);
|
|
|
31
31
|
|
|
32
32
|
const elementId = props.id || useId();
|
|
33
33
|
|
|
34
|
-
const {
|
|
35
|
-
config,
|
|
36
|
-
wrapperAttrs,
|
|
37
|
-
descriptionAttrs,
|
|
38
|
-
bodyAttrs,
|
|
39
|
-
titleAttrs,
|
|
40
|
-
toggleIconAttrs,
|
|
41
|
-
dividerAttrs,
|
|
42
|
-
} = useAttrs(props, { isOpened });
|
|
43
|
-
|
|
44
34
|
const toggleIcon = computed(() =>
|
|
45
|
-
isOpened.value ? config.value
|
|
35
|
+
isOpened.value ? config.value.defaults.collapseIcon : config.value.defaults.expandIcon,
|
|
46
36
|
);
|
|
47
37
|
|
|
48
38
|
const dividerSize = computed(() => {
|
|
@@ -60,6 +50,21 @@ function onClickItem() {
|
|
|
60
50
|
|
|
61
51
|
emit("click", elementId, isOpened.value);
|
|
62
52
|
}
|
|
53
|
+
|
|
54
|
+
const mutatedProps = computed(() => ({
|
|
55
|
+
/* component state, not a props */
|
|
56
|
+
opened: isOpened.value,
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
const {
|
|
60
|
+
config,
|
|
61
|
+
wrapperAttrs,
|
|
62
|
+
descriptionAttrs,
|
|
63
|
+
bodyAttrs,
|
|
64
|
+
titleAttrs,
|
|
65
|
+
toggleIconAttrs,
|
|
66
|
+
dividerAttrs,
|
|
67
|
+
} = useUI<Config>(defaultConfig, mutatedProps);
|
|
63
68
|
</script>
|
|
64
69
|
|
|
65
70
|
<template>
|
|
@@ -9,9 +9,9 @@ import UAccordion from "../../ui.container-accordion/UAccordion.vue";
|
|
|
9
9
|
import UButton from "../../ui.button/UButton.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 UAccordionArgs extends
|
|
14
|
+
interface UAccordionArgs extends Props {
|
|
15
15
|
slotTemplate?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
|
+
import type { ComponentConfig } from "../types.ts";
|
|
2
3
|
|
|
3
|
-
export type Config =
|
|
4
|
-
|
|
4
|
+
export type Config = typeof defaultConfig;
|
|
5
5
|
export type DividerSize = "md" | "lg" | "xl";
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
export interface Props {
|
|
7
8
|
/**
|
|
8
9
|
* Accordion title.
|
|
9
10
|
*/
|
|
@@ -27,7 +28,7 @@ export interface UAccordionProps {
|
|
|
27
28
|
/**
|
|
28
29
|
* Component config object.
|
|
29
30
|
*/
|
|
30
|
-
config?: Config
|
|
31
|
+
config?: ComponentConfig<Config>;
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* Data-test attribute for automated testing.
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useSlots } from "vue";
|
|
3
3
|
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
4
5
|
import { hasSlotContent } from "../utils/helper.ts";
|
|
6
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
5
7
|
|
|
6
8
|
import UHeader from "../ui.text-header/UHeader.vue";
|
|
7
9
|
import UDivider from "../ui.container-divider/UDivider.vue";
|
|
8
10
|
|
|
9
|
-
import
|
|
11
|
+
import defaultConfig from "./config.ts";
|
|
12
|
+
import { UCard } from "./constants.ts";
|
|
10
13
|
|
|
11
|
-
import type {
|
|
14
|
+
import type { Props, Config } from "./types.ts";
|
|
12
15
|
|
|
13
16
|
defineOptions({ inheritAttrs: false });
|
|
14
17
|
|
|
15
|
-
const props = withDefaults(defineProps<
|
|
16
|
-
|
|
18
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
19
|
+
...getDefaults<Props, Config>(defaultConfig, UCard),
|
|
17
20
|
});
|
|
18
21
|
|
|
19
22
|
const slots = useSlots();
|
|
@@ -29,6 +32,10 @@ const isShownFooter = computed(() => {
|
|
|
29
32
|
return hasSlotContent(slots["footer-left"]) || hasSlotContent(slots["footer-right"]);
|
|
30
33
|
});
|
|
31
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Get element / nested component attributes for each config token ✨
|
|
37
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
38
|
+
*/
|
|
32
39
|
const {
|
|
33
40
|
wrapperAttrs,
|
|
34
41
|
titleAttrs,
|
|
@@ -39,7 +46,7 @@ const {
|
|
|
39
46
|
descriptionAttrs,
|
|
40
47
|
contentAttrs,
|
|
41
48
|
footerAttrs,
|
|
42
|
-
} =
|
|
49
|
+
} = useUI<Config>(defaultConfig);
|
|
43
50
|
</script>
|
|
44
51
|
|
|
45
52
|
<template>
|
|
@@ -12,9 +12,9 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
12
12
|
import UHeader from "../../ui.text-header/UHeader.vue";
|
|
13
13
|
|
|
14
14
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
15
|
-
import type {
|
|
15
|
+
import type { Props } from "../types.ts";
|
|
16
16
|
|
|
17
|
-
interface UCardArgs extends
|
|
17
|
+
interface UCardArgs extends Props {
|
|
18
18
|
slotTemplate?: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
|
+
import type { ComponentConfig } from "../types.ts";
|
|
2
3
|
|
|
3
|
-
export type Config =
|
|
4
|
+
export type Config = typeof defaultConfig;
|
|
4
5
|
|
|
5
|
-
export interface
|
|
6
|
+
export interface Props {
|
|
6
7
|
/**
|
|
7
8
|
* Card title.
|
|
8
9
|
*/
|
|
@@ -16,7 +17,7 @@ export interface UCardProps {
|
|
|
16
17
|
/**
|
|
17
18
|
* Component config object.
|
|
18
19
|
*/
|
|
19
|
-
config?: Config
|
|
20
|
+
config?: ComponentConfig<Config>;
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Data-test attribute for automated testing.
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import useUI from "../composables/useUI.ts";
|
|
3
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
3
4
|
|
|
4
5
|
import { UCol } from "./constants.ts";
|
|
5
6
|
import defaultConfig from "./config.ts";
|
|
6
|
-
import useAttrs from "./useAttrs.ts";
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { Props, Config } from "./types.ts";
|
|
9
9
|
|
|
10
10
|
defineOptions({ inheritAttrs: false });
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
align: getDefault<UColProps>(defaultConfig, UCol).align,
|
|
15
|
-
content: getDefault<UColProps>(defaultConfig, UCol).content,
|
|
16
|
-
justify: getDefault<UColProps>(defaultConfig, UCol).justify,
|
|
17
|
-
reverse: getDefault<UColProps>(defaultConfig, UCol).reverse,
|
|
18
|
-
wrap: getDefault<UColProps>(defaultConfig, UCol).wrap,
|
|
19
|
-
dataTest: "",
|
|
12
|
+
withDefaults(defineProps<Props>(), {
|
|
13
|
+
...getDefaults<Props, Config>(defaultConfig, UCol),
|
|
20
14
|
});
|
|
21
15
|
|
|
22
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Get element / nested component attributes for each config token ✨
|
|
18
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const { wrapperAttrs } = useUI<Config>(defaultConfig);
|
|
23
22
|
</script>
|
|
24
23
|
|
|
25
24
|
<template>
|
|
@@ -10,9 +10,9 @@ import UInput from "../../ui.form-input/UInput.vue";
|
|
|
10
10
|
import UButton from "../../ui.button/UButton.vue";
|
|
11
11
|
|
|
12
12
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
13
|
-
import type {
|
|
13
|
+
import type { Props } from "../types.ts";
|
|
14
14
|
|
|
15
|
-
interface UColArgs extends
|
|
15
|
+
interface UColArgs extends Props {
|
|
16
16
|
slotTemplate?: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -1,8 +1,10 @@
|
|
|
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
|
* The distance between nested elements.
|
|
8
10
|
*/
|
|
@@ -45,7 +47,7 @@ export interface UColProps {
|
|
|
45
47
|
/**
|
|
46
48
|
* Component config object.
|
|
47
49
|
*/
|
|
48
|
-
config?: Config
|
|
50
|
+
config?: ComponentConfig<Config>;
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
53
|
* Data-test attribute for automated testing.
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
5
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
3
6
|
|
|
4
7
|
import { UDivider } from "./constants.ts";
|
|
5
8
|
import defaultConfig from "./config.ts";
|
|
6
|
-
import useAttrs from "./useAttrs.ts";
|
|
7
9
|
|
|
8
|
-
import type {
|
|
10
|
+
import type { Props, Config } from "./types.ts";
|
|
9
11
|
|
|
10
12
|
defineOptions({ inheritAttrs: false });
|
|
11
13
|
|
|
12
|
-
const props = withDefaults(defineProps<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
padding: getDefault<UDividerProps>(defaultConfig, UDivider).padding,
|
|
16
|
-
dashed: getDefault<UDividerProps>(defaultConfig, UDivider).dashed,
|
|
17
|
-
dotted: getDefault<UDividerProps>(defaultConfig, UDivider).dotted,
|
|
18
|
-
vertical: getDefault<UDividerProps>(defaultConfig, UDivider).vertical,
|
|
19
|
-
noBorder: getDefault<UDividerProps>(defaultConfig, UDivider).noBorder,
|
|
20
|
-
dataTest: "",
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
...getDefaults<Props, Config>(defaultConfig, UDivider),
|
|
16
|
+
label: "",
|
|
21
17
|
});
|
|
22
18
|
|
|
23
|
-
const
|
|
19
|
+
const mutatedProps = computed(() => ({
|
|
20
|
+
label: Boolean(props.label),
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const { wrapperAttrs, dividerAttrs, labelAttrs } = useUI<Config>(defaultConfig, mutatedProps);
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<template>
|
|
@@ -9,9 +9,9 @@ import URow from "../../ui.container-row/URow.vue";
|
|
|
9
9
|
import UDivider from "../../ui.container-divider/UDivider.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 UDividerArgs extends
|
|
14
|
+
interface UDividerArgs extends Props {
|
|
15
15
|
slotTemplate?: string;
|
|
16
16
|
enum: "variant" | "size" | "padding";
|
|
17
17
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
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
|
* Divider label.
|
|
8
10
|
*/
|
|
@@ -46,7 +48,7 @@ export interface UDividerProps {
|
|
|
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.
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import useUI from "../composables/useUI.ts";
|
|
3
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
3
4
|
import UDivider from "../ui.container-divider/UDivider.vue";
|
|
4
5
|
import UHeader from "../ui.text-header/UHeader.vue";
|
|
5
6
|
|
|
6
7
|
import { UGroup } from "./constants.ts";
|
|
7
8
|
import defaultConfig from "./config.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
|
-
|
|
15
|
-
|
|
16
|
-
underlined: getDefault<UGroupProps>(defaultConfig, UGroup).underlined,
|
|
17
|
-
dataTest: "",
|
|
14
|
+
withDefaults(defineProps<Props>(), {
|
|
15
|
+
...getDefaults<Props, Config>(defaultConfig, UGroup),
|
|
18
16
|
});
|
|
19
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Get element / nested component attributes for each config token ✨
|
|
20
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
21
|
+
*/
|
|
20
22
|
const {
|
|
21
23
|
headerAttrs,
|
|
22
24
|
wrapperAttrs,
|
|
@@ -25,7 +27,7 @@ const {
|
|
|
25
27
|
upperlineAttrs,
|
|
26
28
|
underlineAttrs,
|
|
27
29
|
contentAttrs,
|
|
28
|
-
} =
|
|
30
|
+
} = useUI<Config>(defaultConfig);
|
|
29
31
|
</script>
|
|
30
32
|
|
|
31
33
|
<template>
|
|
@@ -11,9 +11,9 @@ import UInput from "../../ui.form-input/UInput.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 UGroupArgs extends
|
|
16
|
+
interface UGroupArgs extends Props {
|
|
17
17
|
slotTemplate?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -1,8 +1,10 @@
|
|
|
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
|
* Group title.
|
|
8
10
|
*/
|
|
@@ -21,7 +23,7 @@ export interface UGroupProps {
|
|
|
21
23
|
/**
|
|
22
24
|
* Component config object.
|
|
23
25
|
*/
|
|
24
|
-
config?: Config
|
|
26
|
+
config?: ComponentConfig<Config>;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Data-test attribute for automated testing.
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import useUI from "../composables/useUI.ts";
|
|
3
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
3
4
|
|
|
4
5
|
import { UGroups } from "./constants.ts";
|
|
5
6
|
import defaultConfig from "./config.ts";
|
|
6
|
-
import useAttrs from "./useAttrs.ts";
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { Props, Config } from "./types.ts";
|
|
9
9
|
|
|
10
10
|
defineOptions({ inheritAttrs: false });
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
dataTest: "",
|
|
12
|
+
withDefaults(defineProps<Props>(), {
|
|
13
|
+
...getDefaults<Props, Config>(defaultConfig, UGroups),
|
|
15
14
|
});
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Get element / nested component attributes for each config token ✨
|
|
18
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
19
|
+
*/
|
|
20
|
+
const { wrapperAttrs } = useUI<Config>(defaultConfig);
|
|
18
21
|
</script>
|
|
19
22
|
|
|
20
23
|
<template>
|
|
@@ -6,9 +6,9 @@ import UCol from "../../ui.container-col/UCol.vue";
|
|
|
6
6
|
import UInput from "../../ui.form-input/UInput.vue";
|
|
7
7
|
|
|
8
8
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
9
|
-
import type {
|
|
9
|
+
import type { Props } from "../types.ts";
|
|
10
10
|
|
|
11
|
-
interface UGroupsArgs extends
|
|
11
|
+
interface UGroupsArgs extends Props {
|
|
12
12
|
slotTemplate?: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -1,8 +1,10 @@
|
|
|
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
|
* The distance between nested elements.
|
|
8
10
|
*/
|
|
@@ -11,7 +13,7 @@ export interface UGroupsProps {
|
|
|
11
13
|
/**
|
|
12
14
|
* Component config object.
|
|
13
15
|
*/
|
|
14
|
-
config?: Config
|
|
16
|
+
config?: ComponentConfig<Config>;
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Data-test attribute for automated testing.
|