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,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useSlots, watch, ref, useId } from "vue";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
5
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
5
6
|
import { hasSlotContent } from "../utils/helper.ts";
|
|
6
7
|
|
|
7
8
|
import ULink from "../ui.button-link/ULink.vue";
|
|
@@ -11,22 +12,17 @@ import UDivider from "../ui.container-divider/UDivider.vue";
|
|
|
11
12
|
|
|
12
13
|
import defaultConfig from "./config.ts";
|
|
13
14
|
import { UModal } from "./constants.ts";
|
|
14
|
-
import useAttrs from "./useAttrs.ts";
|
|
15
15
|
|
|
16
|
-
import type {
|
|
16
|
+
import type { Props, Config } from "./types.ts";
|
|
17
|
+
import type { Transition } from "../types.ts";
|
|
17
18
|
|
|
18
19
|
defineOptions({ inheritAttrs: false });
|
|
19
20
|
|
|
20
|
-
const props = withDefaults(defineProps<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
inner: getDefault<UModalProps>(defaultConfig, UModal).inner,
|
|
26
|
-
noDivider: getDefault<UModalProps>(defaultConfig, UModal).noDivider,
|
|
27
|
-
mobileStickBottom: getDefault<UModalProps>(defaultConfig, UModal).mobileStickBottom,
|
|
28
|
-
dataTest: "",
|
|
29
|
-
config: () => ({}),
|
|
21
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
22
|
+
...getDefaults<Props, Config>(defaultConfig, UModal),
|
|
23
|
+
modelValue: false,
|
|
24
|
+
backTo: "",
|
|
25
|
+
backLabel: "",
|
|
30
26
|
});
|
|
31
27
|
|
|
32
28
|
const emit = defineEmits([
|
|
@@ -44,29 +40,6 @@ const emit = defineEmits([
|
|
|
44
40
|
|
|
45
41
|
const elementId = props.id || useId();
|
|
46
42
|
|
|
47
|
-
const {
|
|
48
|
-
config,
|
|
49
|
-
modalAttrs,
|
|
50
|
-
titleAttrs,
|
|
51
|
-
backLinkAttrs,
|
|
52
|
-
backLinkIconAttrs,
|
|
53
|
-
closeIconAttrs,
|
|
54
|
-
dividerAttrs,
|
|
55
|
-
dividerSpacingAttrs,
|
|
56
|
-
overlayAttrs,
|
|
57
|
-
wrapperAttrs,
|
|
58
|
-
innerWrapperAttrs,
|
|
59
|
-
headerAttrs,
|
|
60
|
-
headerLeftAttrs,
|
|
61
|
-
headerLeftFallbackAttrs,
|
|
62
|
-
descriptionAttrs,
|
|
63
|
-
headerRightAttrs,
|
|
64
|
-
bodyAttrs,
|
|
65
|
-
footerLeftAttrs,
|
|
66
|
-
footerAttrs,
|
|
67
|
-
footerRightAttrs,
|
|
68
|
-
} = useAttrs(props);
|
|
69
|
-
|
|
70
43
|
const slots = useSlots();
|
|
71
44
|
|
|
72
45
|
const wrapperRef = ref<HTMLElement | null>(null);
|
|
@@ -132,14 +105,41 @@ function onClickCloseModal() {
|
|
|
132
105
|
function closeModal() {
|
|
133
106
|
isShownModal.value = false;
|
|
134
107
|
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get element / nested component attributes for each config token ✨
|
|
111
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
112
|
+
*/
|
|
113
|
+
const {
|
|
114
|
+
config,
|
|
115
|
+
modalAttrs,
|
|
116
|
+
titleAttrs,
|
|
117
|
+
backLinkAttrs,
|
|
118
|
+
backLinkIconAttrs,
|
|
119
|
+
closeIconAttrs,
|
|
120
|
+
dividerAttrs,
|
|
121
|
+
dividerSpacingAttrs,
|
|
122
|
+
overlayAttrs,
|
|
123
|
+
wrapperAttrs,
|
|
124
|
+
innerWrapperAttrs,
|
|
125
|
+
headerAttrs,
|
|
126
|
+
headerLeftAttrs,
|
|
127
|
+
headerLeftFallbackAttrs,
|
|
128
|
+
descriptionAttrs,
|
|
129
|
+
headerRightAttrs,
|
|
130
|
+
bodyAttrs,
|
|
131
|
+
footerLeftAttrs,
|
|
132
|
+
footerAttrs,
|
|
133
|
+
footerRightAttrs,
|
|
134
|
+
} = useUI<Config>(defaultConfig);
|
|
135
135
|
</script>
|
|
136
136
|
|
|
137
137
|
<template>
|
|
138
|
-
<
|
|
138
|
+
<Transition v-bind="config.overlayTransition as Transition">
|
|
139
139
|
<div v-if="isShownModal" v-bind="overlayAttrs" />
|
|
140
|
-
</
|
|
140
|
+
</Transition>
|
|
141
141
|
|
|
142
|
-
<
|
|
142
|
+
<Transition v-bind="config.wrapperTransition as Transition">
|
|
143
143
|
<div
|
|
144
144
|
v-if="isShownModal"
|
|
145
145
|
:id="elementId"
|
|
@@ -173,7 +173,7 @@ function closeModal() {
|
|
|
173
173
|
internal
|
|
174
174
|
size="xs"
|
|
175
175
|
color="gray"
|
|
176
|
-
:name="config.defaults
|
|
176
|
+
:name="config.defaults.backIcon"
|
|
177
177
|
v-bind="backLinkIconAttrs"
|
|
178
178
|
/>
|
|
179
179
|
</template>
|
|
@@ -198,12 +198,12 @@ function closeModal() {
|
|
|
198
198
|
@slot Use it to add something instead of the close button.
|
|
199
199
|
@binding {string} icon-name
|
|
200
200
|
-->
|
|
201
|
-
<slot name="close-button" :icon-name="config.defaults
|
|
201
|
+
<slot name="close-button" :icon-name="config.defaults.closeIcon">
|
|
202
202
|
<UIcon
|
|
203
203
|
internal
|
|
204
204
|
interactive
|
|
205
205
|
size="sm"
|
|
206
|
-
:name="config.defaults
|
|
206
|
+
:name="config.defaults.closeIcon"
|
|
207
207
|
v-bind="closeIconAttrs"
|
|
208
208
|
:data-test="`${dataTest}-close`"
|
|
209
209
|
@click="onClickCloseModal"
|
|
@@ -237,5 +237,5 @@ function closeModal() {
|
|
|
237
237
|
</div>
|
|
238
238
|
</div>
|
|
239
239
|
</div>
|
|
240
|
-
</
|
|
240
|
+
</Transition>
|
|
241
241
|
</template>
|
|
@@ -14,9 +14,9 @@ import UTextarea from "../../ui.form-textarea/UTextarea.vue";
|
|
|
14
14
|
import URow from "../../ui.container-row/URow.vue";
|
|
15
15
|
|
|
16
16
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
17
|
-
import type {
|
|
17
|
+
import type { Props } from "../types.ts";
|
|
18
18
|
|
|
19
|
-
interface UModalArgs extends
|
|
19
|
+
interface UModalArgs extends Props {
|
|
20
20
|
slotTemplate?: string;
|
|
21
21
|
enum: "size";
|
|
22
22
|
}
|
|
@@ -118,7 +118,6 @@ BackLink.args = {
|
|
|
118
118
|
backLabel: "back",
|
|
119
119
|
backTo: {
|
|
120
120
|
path: "/",
|
|
121
|
-
query: {},
|
|
122
121
|
},
|
|
123
122
|
};
|
|
124
123
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
|
+
|
|
3
5
|
import type { RouteLocationRaw } from "vue-router";
|
|
4
6
|
|
|
5
|
-
export type Config =
|
|
7
|
+
export type Config = typeof defaultConfig;
|
|
6
8
|
|
|
7
|
-
export interface
|
|
9
|
+
export interface Props {
|
|
8
10
|
/**
|
|
9
11
|
* Modal state (shown / hidden).
|
|
10
12
|
*/
|
|
@@ -73,7 +75,7 @@ export interface UModalProps {
|
|
|
73
75
|
/**
|
|
74
76
|
* Component config object.
|
|
75
77
|
*/
|
|
76
|
-
config?: Config
|
|
78
|
+
config?: ComponentConfig<Config>;
|
|
77
79
|
|
|
78
80
|
/**
|
|
79
81
|
* Data-test attribute for automated testing.
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { merge } from "lodash-es";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import useUI from "../composables/useUI.ts";
|
|
6
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
6
7
|
import { hasSlotContent } from "../utils/helper.ts";
|
|
7
8
|
|
|
8
9
|
import UButton from "../ui.button/UButton.vue";
|
|
@@ -10,24 +11,16 @@ import UModal from "../ui.container-modal/UModal.vue";
|
|
|
10
11
|
|
|
11
12
|
import defaultConfig from "./config.ts";
|
|
12
13
|
import { UModalConfirm } from "./constants.ts";
|
|
13
|
-
import useAttrs from "./useAttrs.ts";
|
|
14
14
|
import { useLocale } from "../composables/useLocale.ts";
|
|
15
15
|
|
|
16
|
-
import type {
|
|
16
|
+
import type { Props, Config } from "./types.ts";
|
|
17
17
|
|
|
18
18
|
defineOptions({ inheritAttrs: false });
|
|
19
19
|
|
|
20
|
-
const props = withDefaults(defineProps<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
size: getDefault<UModalConfirmProps>(defaultConfig, UModalConfirm).size,
|
|
25
|
-
closeOnCross: getDefault<UModalConfirmProps>(defaultConfig, UModalConfirm).closeOnCross,
|
|
26
|
-
closeOnOverlay: getDefault<UModalConfirmProps>(defaultConfig, UModalConfirm).closeOnOverlay,
|
|
27
|
-
closeOnEsc: getDefault<UModalConfirmProps>(defaultConfig, UModalConfirm).closeOnEsc,
|
|
28
|
-
inner: getDefault<UModalConfirmProps>(defaultConfig, UModalConfirm).inner,
|
|
29
|
-
mobileStickBottom: getDefault<UModalConfirmProps>(defaultConfig, UModalConfirm).mobileStickBottom,
|
|
30
|
-
dataTest: "",
|
|
20
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
21
|
+
...getDefaults<Props, Config>(defaultConfig, UModalConfirm),
|
|
22
|
+
modelValue: false,
|
|
23
|
+
confirmLabel: "",
|
|
31
24
|
});
|
|
32
25
|
|
|
33
26
|
const emit = defineEmits([
|
|
@@ -50,9 +43,6 @@ const emit = defineEmits([
|
|
|
50
43
|
|
|
51
44
|
const { tm } = useLocale();
|
|
52
45
|
|
|
53
|
-
const { footerLeftFallbackAttrs, confirmModalAttrs, confirmButtonAttrs, cancelButtonAttrs } =
|
|
54
|
-
useAttrs(props);
|
|
55
|
-
|
|
56
46
|
const isShownModal = computed({
|
|
57
47
|
get: () => props.modelValue,
|
|
58
48
|
set: (value) => emit("update:modelValue", value),
|
|
@@ -74,6 +64,13 @@ function emitConfirmAction() {
|
|
|
74
64
|
emit("confirm");
|
|
75
65
|
closeModal();
|
|
76
66
|
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get element / nested component attributes for each config token ✨
|
|
70
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
71
|
+
*/
|
|
72
|
+
const { footerLeftFallbackAttrs, confirmModalAttrs, confirmButtonAttrs, cancelButtonAttrs } =
|
|
73
|
+
useUI<Config>(defaultConfig);
|
|
77
74
|
</script>
|
|
78
75
|
|
|
79
76
|
<template>
|
|
@@ -12,9 +12,11 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
12
12
|
import URow from "../../ui.container-row/URow.vue";
|
|
13
13
|
|
|
14
14
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
15
|
-
import type {
|
|
15
|
+
import type { Props } from "../types.ts";
|
|
16
|
+
import type { BrandColors } from "../../types.ts";
|
|
16
17
|
|
|
17
|
-
interface UModalConfirmArgs extends
|
|
18
|
+
interface UModalConfirmArgs extends Props {
|
|
19
|
+
width: string;
|
|
18
20
|
slotTemplate?: string;
|
|
19
21
|
enum: "size" | "confirmColor";
|
|
20
22
|
}
|
|
@@ -74,9 +76,9 @@ const EnumVariantTemplate: StoryFn<UModalConfirmArgs> = (
|
|
|
74
76
|
) => ({
|
|
75
77
|
components: { UModalConfirm, UButton, URow },
|
|
76
78
|
setup() {
|
|
77
|
-
function onClick(value) {
|
|
78
|
-
argTypes[args.enum]
|
|
79
|
-
? (args.confirmColor = value)
|
|
79
|
+
function onClick(value: string) {
|
|
80
|
+
argTypes?.[args.enum]?.name === "confirmColor"
|
|
81
|
+
? (args.confirmColor = value as BrandColors)
|
|
80
82
|
: (args.width = value);
|
|
81
83
|
|
|
82
84
|
args.modelValue = true;
|
|
@@ -85,7 +87,7 @@ const EnumVariantTemplate: StoryFn<UModalConfirmArgs> = (
|
|
|
85
87
|
return {
|
|
86
88
|
args,
|
|
87
89
|
onClick,
|
|
88
|
-
options: argTypes[args.enum]
|
|
90
|
+
options: argTypes?.[args.enum]?.options,
|
|
89
91
|
};
|
|
90
92
|
},
|
|
91
93
|
template: `
|
|
@@ -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
|
* Modal state (shown / hidden).
|
|
8
10
|
*/
|
|
@@ -97,7 +99,7 @@ export interface UModalConfirmProps {
|
|
|
97
99
|
/**
|
|
98
100
|
* Component config object.
|
|
99
101
|
*/
|
|
100
|
-
config?: Config
|
|
102
|
+
config?: ComponentConfig<Config>;
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
105
|
* Data-test attribute for automated testing.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useSlots, onMounted } from "vue";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import useUI from "../composables/useUI.ts";
|
|
5
|
+
import { getDefaults } from "../utils/ui.ts";
|
|
5
6
|
import { hasSlotContent } from "../utils/helper.ts";
|
|
6
7
|
import useBreakpoint from "../composables/useBreakpoint.ts";
|
|
7
8
|
|
|
@@ -11,45 +12,21 @@ import UHeader from "../ui.text-header/UHeader.vue";
|
|
|
11
12
|
|
|
12
13
|
import defaultConfig from "./config.ts";
|
|
13
14
|
import { UPage } from "./constants.ts";
|
|
14
|
-
import useAttrs from "./useAttrs.ts";
|
|
15
15
|
|
|
16
|
-
import type {
|
|
16
|
+
import type { Props, Config } from "./types.ts";
|
|
17
17
|
|
|
18
18
|
const slots = useSlots();
|
|
19
19
|
|
|
20
20
|
defineOptions({ inheritAttrs: false });
|
|
21
21
|
|
|
22
|
-
const props = withDefaults(defineProps<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
fixedRounding: getDefault<UPageProps>(defaultConfig, UPage).fixedRounding,
|
|
27
|
-
dataTest: "",
|
|
28
|
-
config: () => ({}),
|
|
22
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
23
|
+
...getDefaults<Props, Config>(defaultConfig, UPage),
|
|
24
|
+
backTo: "",
|
|
25
|
+
backLabel: "",
|
|
29
26
|
});
|
|
30
27
|
|
|
31
28
|
const { isMobileBreakpoint } = useBreakpoint();
|
|
32
29
|
|
|
33
|
-
const {
|
|
34
|
-
config,
|
|
35
|
-
wrapperAttrs,
|
|
36
|
-
pageAttrs,
|
|
37
|
-
rightRoundingAttrs,
|
|
38
|
-
titleAttrs,
|
|
39
|
-
backLinkAttrs,
|
|
40
|
-
backLinkIconAttrs,
|
|
41
|
-
headerAttrs,
|
|
42
|
-
headerLeftFallbackAttrs,
|
|
43
|
-
descriptionAttrs,
|
|
44
|
-
headerLeftAttrs,
|
|
45
|
-
headerRightAttrs,
|
|
46
|
-
bodyAttrs,
|
|
47
|
-
footerAttrs,
|
|
48
|
-
footerLeftAttrs,
|
|
49
|
-
footerRightAttrs,
|
|
50
|
-
rightRoundingWrapperAttrs,
|
|
51
|
-
} = useAttrs(props);
|
|
52
|
-
|
|
53
30
|
const isExistHeader = computed(() => {
|
|
54
31
|
return (
|
|
55
32
|
props.title ||
|
|
@@ -78,6 +55,30 @@ onMounted(() => {
|
|
|
78
55
|
document.body.classList.add(...classes);
|
|
79
56
|
}
|
|
80
57
|
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get element / nested component attributes for each config token ✨
|
|
61
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
62
|
+
*/
|
|
63
|
+
const {
|
|
64
|
+
config,
|
|
65
|
+
wrapperAttrs,
|
|
66
|
+
pageAttrs,
|
|
67
|
+
rightRoundingAttrs,
|
|
68
|
+
titleAttrs,
|
|
69
|
+
backLinkAttrs,
|
|
70
|
+
backLinkIconAttrs,
|
|
71
|
+
headerAttrs,
|
|
72
|
+
headerLeftFallbackAttrs,
|
|
73
|
+
descriptionAttrs,
|
|
74
|
+
headerLeftAttrs,
|
|
75
|
+
headerRightAttrs,
|
|
76
|
+
bodyAttrs,
|
|
77
|
+
footerAttrs,
|
|
78
|
+
footerLeftAttrs,
|
|
79
|
+
footerRightAttrs,
|
|
80
|
+
rightRoundingWrapperAttrs,
|
|
81
|
+
} = useUI<Config>(defaultConfig);
|
|
81
82
|
</script>
|
|
82
83
|
|
|
83
84
|
<template>
|
|
@@ -108,7 +109,7 @@ onMounted(() => {
|
|
|
108
109
|
internal
|
|
109
110
|
size="2xs"
|
|
110
111
|
color="gray"
|
|
111
|
-
:name="config.defaults
|
|
112
|
+
:name="config.defaults.backIcon"
|
|
112
113
|
v-bind="backLinkIconAttrs"
|
|
113
114
|
/>
|
|
114
115
|
</template>
|
|
@@ -15,9 +15,9 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
15
15
|
import UHeader from "../../ui.text-header/UHeader.vue";
|
|
16
16
|
|
|
17
17
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
18
|
-
import type {
|
|
18
|
+
import type { Props } from "../types.ts";
|
|
19
19
|
|
|
20
|
-
interface UPageArgs extends
|
|
20
|
+
interface UPageArgs extends Props {
|
|
21
21
|
slotTemplate?: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import defaultConfig from "./config.ts";
|
|
2
2
|
|
|
3
3
|
import type { RouteLocationRaw } from "vue-router";
|
|
4
|
+
import type { ComponentConfig } from "../types.ts";
|
|
4
5
|
|
|
5
|
-
export type Config =
|
|
6
|
+
export type Config = typeof defaultConfig;
|
|
6
7
|
|
|
7
|
-
export interface
|
|
8
|
+
export interface Props {
|
|
8
9
|
/**
|
|
9
10
|
* Page size (width).
|
|
10
11
|
*/
|
|
@@ -48,7 +49,7 @@ export interface UPageProps {
|
|
|
48
49
|
/**
|
|
49
50
|
* Component config object.
|
|
50
51
|
*/
|
|
51
|
-
config?: Config
|
|
52
|
+
config?: ComponentConfig<Config>;
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
55
|
* Data-test attribute for automated testing.
|
|
@@ -1,26 +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 { URow } 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<URowProps>(defaultConfig, URow).align,
|
|
15
|
-
content: getDefault<URowProps>(defaultConfig, URow).content,
|
|
16
|
-
justify: getDefault<URowProps>(defaultConfig, URow).justify,
|
|
17
|
-
reverse: getDefault<URowProps>(defaultConfig, URow).reverse,
|
|
18
|
-
wrap: getDefault<URowProps>(defaultConfig, URow).wrap,
|
|
19
|
-
noMobile: getDefault<URowProps>(defaultConfig, URow).noMobile,
|
|
20
|
-
dataTest: "",
|
|
12
|
+
withDefaults(defineProps<Props>(), {
|
|
13
|
+
...getDefaults<Props, Config>(defaultConfig, URow),
|
|
21
14
|
});
|
|
22
15
|
|
|
23
|
-
|
|
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);
|
|
24
21
|
</script>
|
|
25
22
|
|
|
26
23
|
<template>
|
|
@@ -11,9 +11,9 @@ import UCol from "../../ui.container-col/UCol.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 URowArgs extends
|
|
16
|
+
interface URowArgs extends Props {
|
|
17
17
|
slotTemplate?: string;
|
|
18
18
|
enum: "gap" | "align";
|
|
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
|
* The distance between nested elements.
|
|
8
10
|
*/
|
|
@@ -50,7 +52,7 @@ export interface URowProps {
|
|
|
50
52
|
/**
|
|
51
53
|
* Component config object.
|
|
52
54
|
*/
|
|
53
|
-
config?: Config
|
|
55
|
+
config?: ComponentConfig<Config>;
|
|
54
56
|
|
|
55
57
|
/**
|
|
56
58
|
* Data-test attribute for automated testing.
|