@dpa-id-components/dpa-shared-components 22.0.0-next.9 → 22.0.0
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/dist/assets/icons/bot.vue.d.ts +3 -0
- package/dist/bot-C103nFwL.js +19 -0
- package/dist/components/UiCheckbox/UiCheckbox.vue.d.ts +1 -1
- package/dist/components/UiIcon/icons.d.ts +1 -0
- package/dist/components/UiInput/UiInput.vue.d.ts +1 -1
- package/dist/components/UiMenu/UiMenu.vue.d.ts +1 -1
- package/dist/components/index.d.ts +1 -18
- package/dist/dpa-shared-components.js +3326 -3978
- package/dist/eslint.base.config.js +1 -4
- package/dist/src/assets/icons/bot.vue +14 -0
- package/dist/src/components/UiChip/UiChip.spec.ts +1 -1
- package/dist/src/components/UiChip/UiChip.vue +2 -2
- package/dist/src/components/UiDatePicker/UiDatePicker.vue +11 -8
- package/dist/src/components/UiDialog/UiDialog.vue +10 -7
- package/dist/src/components/UiFilterBadge/UiFilterBadge.stories.ts +1 -3
- package/dist/src/components/UiIcon/UiIcon.stories.ts +1 -1
- package/dist/src/components/UiIcon/icons.ts +1 -0
- package/dist/src/components/UiListItem/README.md +13 -12
- package/dist/src/components/UiListItem/UiListItem.stories.ts +0 -26
- package/dist/src/components/UiListItem/UiListItem.vue +1 -1
- package/dist/src/components/UiMediaTypeIcon/UiMediaTypeIcon.stories.ts +1 -1
- package/dist/src/components/UiMenu/UiMenu.stories.ts +85 -2
- package/dist/src/components/UiMenu/UiMenu.vue +7 -8
- package/dist/src/components/UiSelect/UiSelect.vue +1 -1
- package/dist/src/components/index.ts +0 -33
- package/dist/src/tailwindPreset.css +70 -62
- package/dist/style.css +2 -2
- package/dist/tailwindPreset.css +70 -62
- package/package.json +19 -19
- package/src/assets/icons/bot.vue +14 -0
- package/src/components/UiChip/UiChip.vue +2 -2
- package/src/components/UiDatePicker/UiDatePicker.vue +11 -8
- package/src/components/UiDialog/UiDialog.vue +10 -7
- package/src/components/UiIcon/icons.ts +1 -0
- package/src/components/UiListItem/README.md +13 -12
- package/src/components/UiListItem/UiListItem.vue +1 -1
- package/src/components/UiMenu/UiMenu.vue +7 -8
- package/src/components/UiSelect/UiSelect.vue +1 -1
- package/src/tailwindPreset.css +70 -62
- package/dist/components/DpaMediaItem/DpaMediaItem.vue.d.ts +0 -43
- package/dist/components/UiButtonGroup/UiButtonGroup.vue.d.ts +0 -7
- package/dist/components/UiCard/UiCard.vue.d.ts +0 -7
- package/dist/components/UiCheckBoxGroup/UiCheckBoxGroup.vue.d.ts +0 -33
- package/dist/components/UiCollapseNavigation/UiCollapseNavigation.vue.d.ts +0 -28
- package/dist/components/UiFilterButton/UiFilterButton.vue.d.ts +0 -54
- package/dist/components/UiIconButton/UiIconButton.vue.d.ts +0 -30
- package/dist/components/UiList/UiList.vue.d.ts +0 -7
- package/dist/components/UiMenu/UiMenuItem.vue.d.ts +0 -35
- package/dist/components/UiMenu/UiMenuList.vue.d.ts +0 -20
- package/dist/components/UiOverlay/UiOverlay.vue.d.ts +0 -18
- package/dist/components/UiOverlayMenu/UiOverlayMenu.vue.d.ts +0 -24
- package/dist/components/UiRadioInputGroup/UiRadioInputGroup.vue.d.ts +0 -35
- package/dist/components/UiSection/UiSection.vue.d.ts +0 -29
- package/dist/components/UiSectionDivider/UiSectionDivider.vue.d.ts +0 -16
- package/dist/components/UiTextButton/UiTextButton.vue.d.ts +0 -42
- package/dist/src/components/DpaMediaItem/DpaMediaItem.spec.ts +0 -123
- package/dist/src/components/DpaMediaItem/DpaMediaItem.stories.ts +0 -140
- package/dist/src/components/DpaMediaItem/DpaMediaItem.vue +0 -146
- package/dist/src/components/DpaMediaItem/README.md +0 -42
- package/dist/src/components/UiButtonGroup/README.md +0 -29
- package/dist/src/components/UiButtonGroup/UiButtonGroup.spec.ts +0 -16
- package/dist/src/components/UiButtonGroup/UiButtonGroup.stories.ts +0 -53
- package/dist/src/components/UiButtonGroup/UiButtonGroup.vue +0 -29
- package/dist/src/components/UiCard/README.md +0 -32
- package/dist/src/components/UiCard/UiCard.spec.ts +0 -16
- package/dist/src/components/UiCard/UiCard.stories.ts +0 -30
- package/dist/src/components/UiCard/UiCard.vue +0 -28
- package/dist/src/components/UiCheckBoxGroup/README.md +0 -35
- package/dist/src/components/UiCheckBoxGroup/UiCheckBoxGroup.spec.ts +0 -70
- package/dist/src/components/UiCheckBoxGroup/UiCheckBoxGroup.stories.ts +0 -59
- package/dist/src/components/UiCheckBoxGroup/UiCheckBoxGroup.vue +0 -106
- package/dist/src/components/UiCollapseNavigation/README.md +0 -37
- package/dist/src/components/UiCollapseNavigation/UiCollapseNavigation.spec.ts +0 -21
- package/dist/src/components/UiCollapseNavigation/UiCollapseNavigation.stories.ts +0 -67
- package/dist/src/components/UiCollapseNavigation/UiCollapseNavigation.vue +0 -79
- package/dist/src/components/UiFilterButton/README.md +0 -37
- package/dist/src/components/UiFilterButton/UiFilterButton.spec.ts +0 -79
- package/dist/src/components/UiFilterButton/UiFilterButton.stories.ts +0 -90
- package/dist/src/components/UiFilterButton/UiFilterButton.vue +0 -170
- package/dist/src/components/UiIconButton/README.md +0 -31
- package/dist/src/components/UiIconButton/UiIconButton.spec.ts +0 -78
- package/dist/src/components/UiIconButton/UiIconButton.stories.ts +0 -65
- package/dist/src/components/UiIconButton/UiIconButton.vue +0 -112
- package/dist/src/components/UiList/README.md +0 -31
- package/dist/src/components/UiList/UiList.spec.ts +0 -23
- package/dist/src/components/UiList/UiList.stories.ts +0 -66
- package/dist/src/components/UiList/UiList.vue +0 -29
- package/dist/src/components/UiMenu/UiMenuItem.vue +0 -71
- package/dist/src/components/UiMenu/UiMenuList.vue +0 -40
- package/dist/src/components/UiOverlay/README.md +0 -38
- package/dist/src/components/UiOverlay/UiOverlay.spec.ts +0 -16
- package/dist/src/components/UiOverlay/UiOverlay.stories.ts +0 -22
- package/dist/src/components/UiOverlay/UiOverlay.vue +0 -36
- package/dist/src/components/UiOverlayMenu/README.md +0 -40
- package/dist/src/components/UiOverlayMenu/UiOverlayMenu.spec.ts +0 -33
- package/dist/src/components/UiOverlayMenu/UiOverlayMenu.stories.ts +0 -40
- package/dist/src/components/UiOverlayMenu/UiOverlayMenu.vue +0 -51
- package/dist/src/components/UiRadioInputGroup/README.md +0 -51
- package/dist/src/components/UiRadioInputGroup/UiRadioInputGroup.spec.ts +0 -66
- package/dist/src/components/UiRadioInputGroup/UiRadioInputGroup.stories.ts +0 -45
- package/dist/src/components/UiRadioInputGroup/UiRadioInputGroup.vue +0 -76
- package/dist/src/components/UiSection/README.md +0 -33
- package/dist/src/components/UiSection/UiSection.spec.ts +0 -49
- package/dist/src/components/UiSection/UiSection.stories.ts +0 -61
- package/dist/src/components/UiSection/UiSection.vue +0 -63
- package/dist/src/components/UiSectionDivider/README.md +0 -29
- package/dist/src/components/UiSectionDivider/UiSectionDivider.spec.ts +0 -19
- package/dist/src/components/UiSectionDivider/UiSectionDivider.stories.ts +0 -49
- package/dist/src/components/UiSectionDivider/UiSectionDivider.vue +0 -44
- package/dist/src/components/UiTextButton/README.md +0 -41
- package/dist/src/components/UiTextButton/UiTextButton.spec.ts +0 -99
- package/dist/src/components/UiTextButton/UiTextButton.stories.ts +0 -62
- package/dist/src/components/UiTextButton/UiTextButton.vue +0 -173
- package/src/components/DpaMediaItem/DpaMediaItem.vue +0 -146
- package/src/components/DpaMediaItem/README.md +0 -42
- package/src/components/UiButtonGroup/README.md +0 -29
- package/src/components/UiButtonGroup/UiButtonGroup.vue +0 -29
- package/src/components/UiCard/README.md +0 -32
- package/src/components/UiCard/UiCard.vue +0 -28
- package/src/components/UiCheckBoxGroup/README.md +0 -35
- package/src/components/UiCheckBoxGroup/UiCheckBoxGroup.vue +0 -106
- package/src/components/UiCollapseNavigation/README.md +0 -37
- package/src/components/UiCollapseNavigation/UiCollapseNavigation.vue +0 -79
- package/src/components/UiFilterButton/README.md +0 -37
- package/src/components/UiFilterButton/UiFilterButton.vue +0 -170
- package/src/components/UiIconButton/README.md +0 -31
- package/src/components/UiIconButton/UiIconButton.vue +0 -112
- package/src/components/UiList/README.md +0 -31
- package/src/components/UiList/UiList.vue +0 -29
- package/src/components/UiMenu/UiMenuItem.vue +0 -71
- package/src/components/UiMenu/UiMenuList.vue +0 -40
- package/src/components/UiOverlay/README.md +0 -38
- package/src/components/UiOverlay/UiOverlay.vue +0 -36
- package/src/components/UiOverlayMenu/README.md +0 -40
- package/src/components/UiOverlayMenu/UiOverlayMenu.vue +0 -51
- package/src/components/UiRadioInputGroup/README.md +0 -51
- package/src/components/UiRadioInputGroup/UiRadioInputGroup.vue +0 -76
- package/src/components/UiSection/README.md +0 -33
- package/src/components/UiSection/UiSection.vue +0 -63
- package/src/components/UiSectionDivider/README.md +0 -29
- package/src/components/UiSectionDivider/UiSectionDivider.vue +0 -44
- package/src/components/UiTextButton/README.md +0 -41
- package/src/components/UiTextButton/UiTextButton.vue +0 -173
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
|
|
3
|
-
import { icons } from "../UiIcon/icons.ts";
|
|
4
|
-
|
|
5
|
-
import UiFilterButton from "./UiFilterButton.vue";
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
tags: ["deprecated"],
|
|
9
|
-
title: "Ui/UiFilterButton",
|
|
10
|
-
component: UiFilterButton,
|
|
11
|
-
argTypes: {
|
|
12
|
-
title: {
|
|
13
|
-
control: "text",
|
|
14
|
-
},
|
|
15
|
-
variant: {
|
|
16
|
-
control: "select",
|
|
17
|
-
options: [
|
|
18
|
-
"blue-rounded",
|
|
19
|
-
"white-rounded",
|
|
20
|
-
"blank",
|
|
21
|
-
"blue-blank",
|
|
22
|
-
"transparent-rounded",
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
buttonWidth: {
|
|
26
|
-
control: "select",
|
|
27
|
-
options: ["max", "full"],
|
|
28
|
-
},
|
|
29
|
-
chevronIcon: {
|
|
30
|
-
control: "select",
|
|
31
|
-
options: Object.keys(icons),
|
|
32
|
-
},
|
|
33
|
-
rotateIcon: {
|
|
34
|
-
control: "boolean",
|
|
35
|
-
},
|
|
36
|
-
disabled: {
|
|
37
|
-
control: "boolean",
|
|
38
|
-
},
|
|
39
|
-
active: {
|
|
40
|
-
control: "boolean",
|
|
41
|
-
},
|
|
42
|
-
hasIcon: {
|
|
43
|
-
control: "boolean",
|
|
44
|
-
},
|
|
45
|
-
iconLeft: {
|
|
46
|
-
control: "select",
|
|
47
|
-
options: Object.keys(icons),
|
|
48
|
-
},
|
|
49
|
-
iconSize: {
|
|
50
|
-
control: "select",
|
|
51
|
-
options: ["xs", "small", "large"],
|
|
52
|
-
},
|
|
53
|
-
size: {
|
|
54
|
-
control: "select",
|
|
55
|
-
options: ["xs", "small"],
|
|
56
|
-
},
|
|
57
|
-
iconLeftClass: {
|
|
58
|
-
control: "text",
|
|
59
|
-
},
|
|
60
|
-
iconRightClass: {
|
|
61
|
-
control: "text",
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
args: {
|
|
65
|
-
title: "Filter",
|
|
66
|
-
variant: "white-rounded",
|
|
67
|
-
buttonWidth: "max",
|
|
68
|
-
chevronIcon: "chevron-down",
|
|
69
|
-
rotateIcon: false,
|
|
70
|
-
disabled: false,
|
|
71
|
-
active: false,
|
|
72
|
-
hasIcon: true,
|
|
73
|
-
iconSize: "xs",
|
|
74
|
-
iconLeft: undefined,
|
|
75
|
-
iconLeftClass: undefined,
|
|
76
|
-
iconRightClass: undefined,
|
|
77
|
-
},
|
|
78
|
-
render: (args) => ({
|
|
79
|
-
setup() {
|
|
80
|
-
return { args };
|
|
81
|
-
},
|
|
82
|
-
components: { UiFilterButton },
|
|
83
|
-
template: "<UiFilterButton v-bind='args'>Slot</UiFilterButton>",
|
|
84
|
-
}),
|
|
85
|
-
} satisfies Meta<typeof UiFilterButton>;
|
|
86
|
-
|
|
87
|
-
export default meta;
|
|
88
|
-
type Story = StoryObj<typeof meta>;
|
|
89
|
-
|
|
90
|
-
export const Default: Story = {};
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="
|
|
4
|
-
cn(
|
|
5
|
-
'w-full px-3',
|
|
6
|
-
$attrs.class,
|
|
7
|
-
'flex cursor-pointer items-center rounded-full select-none',
|
|
8
|
-
variantClasses,
|
|
9
|
-
buttonWidth === 'full' ? 'w-full' : 'max-w-max',
|
|
10
|
-
props.size === 'xs' ? 'py-0.5' : 'py-1.5',
|
|
11
|
-
)
|
|
12
|
-
"
|
|
13
|
-
@click="onClick"
|
|
14
|
-
>
|
|
15
|
-
<button
|
|
16
|
-
class="w-full rounded-full focus:outline-hidden focus-visible:focus-outline"
|
|
17
|
-
:disabled="disabled"
|
|
18
|
-
type="button"
|
|
19
|
-
data-testid="filter-button"
|
|
20
|
-
>
|
|
21
|
-
<span
|
|
22
|
-
data-testid="filterbutton-title"
|
|
23
|
-
class="flex w-full items-center justify-between text-left text-sm/normal font-medium"
|
|
24
|
-
:class="`${textColorClass} ${props.size === 'xs' ? 'text-xs' : 'text-sm'}`"
|
|
25
|
-
>
|
|
26
|
-
<UiIcon
|
|
27
|
-
v-if="hasIcon && iconLeft"
|
|
28
|
-
:name="iconLeft"
|
|
29
|
-
:size="iconSize"
|
|
30
|
-
class="flex-none"
|
|
31
|
-
:class="
|
|
32
|
-
cn(
|
|
33
|
-
{
|
|
34
|
-
'mr-2': title.length !== 0,
|
|
35
|
-
},
|
|
36
|
-
iconLeftClass,
|
|
37
|
-
)
|
|
38
|
-
"
|
|
39
|
-
/>
|
|
40
|
-
<span class="w-full grow truncate">
|
|
41
|
-
{{ title }}
|
|
42
|
-
</span>
|
|
43
|
-
<UiIcon
|
|
44
|
-
v-if="hasIcon"
|
|
45
|
-
:name="chevronIcon"
|
|
46
|
-
:class="
|
|
47
|
-
cn(
|
|
48
|
-
{
|
|
49
|
-
'origin-center rotate-180': rotateIcon,
|
|
50
|
-
'ml-2': title.length !== 0,
|
|
51
|
-
},
|
|
52
|
-
iconRightClass,
|
|
53
|
-
)
|
|
54
|
-
"
|
|
55
|
-
:size="iconSize"
|
|
56
|
-
class="flex-none"
|
|
57
|
-
/>
|
|
58
|
-
</span>
|
|
59
|
-
</button>
|
|
60
|
-
</div>
|
|
61
|
-
</template>
|
|
62
|
-
|
|
63
|
-
<script lang="ts">
|
|
64
|
-
/**
|
|
65
|
-
* @deprecated Use `UiButton` instead
|
|
66
|
-
*/
|
|
67
|
-
export default {
|
|
68
|
-
name: "UiFilterButton",
|
|
69
|
-
};
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<script setup lang="ts">
|
|
73
|
-
import type { ClassValue } from "clsx";
|
|
74
|
-
import { computed } from "vue";
|
|
75
|
-
|
|
76
|
-
import { cn } from "../../utils/cn.ts";
|
|
77
|
-
import UiIcon, { type UiIconName } from "../UiIcon/UiIcon.vue";
|
|
78
|
-
|
|
79
|
-
const emit = defineEmits<{
|
|
80
|
-
click: [];
|
|
81
|
-
}>();
|
|
82
|
-
|
|
83
|
-
const props = withDefaults(
|
|
84
|
-
defineProps<{
|
|
85
|
-
title?: string;
|
|
86
|
-
variant?:
|
|
87
|
-
| "blue-rounded"
|
|
88
|
-
| "white-rounded"
|
|
89
|
-
| "transparent-rounded"
|
|
90
|
-
| "blank"
|
|
91
|
-
| "blue-blank";
|
|
92
|
-
buttonWidth?: "full" | "max";
|
|
93
|
-
chevronIcon?: UiIconName;
|
|
94
|
-
rotateIcon?: boolean;
|
|
95
|
-
iconSize?: "xs" | "sm" | "lg";
|
|
96
|
-
size?: "xs" | "small";
|
|
97
|
-
disabled?: boolean;
|
|
98
|
-
active?: boolean;
|
|
99
|
-
hasIcon?: boolean;
|
|
100
|
-
iconLeft?: UiIconName;
|
|
101
|
-
iconLeftClass?: ClassValue | ClassValue[];
|
|
102
|
-
iconRightClass?: ClassValue | ClassValue[];
|
|
103
|
-
}>(),
|
|
104
|
-
{
|
|
105
|
-
title: "",
|
|
106
|
-
variant: "white-rounded",
|
|
107
|
-
buttonWidth: "max",
|
|
108
|
-
chevronIcon: "chevron-down",
|
|
109
|
-
rotateIcon: false,
|
|
110
|
-
iconSize: "xs",
|
|
111
|
-
size: "small",
|
|
112
|
-
disabled: false,
|
|
113
|
-
active: false,
|
|
114
|
-
hasIcon: true,
|
|
115
|
-
iconLeft: undefined,
|
|
116
|
-
iconLeftClass: undefined,
|
|
117
|
-
iconRightClass: undefined,
|
|
118
|
-
},
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
const variants = {
|
|
122
|
-
"blue-rounded": "bg-primary hover:bg-primary-dark",
|
|
123
|
-
"white-rounded":
|
|
124
|
-
"bg-neutral hover:border-neutral-subtle border border-neutral-soft",
|
|
125
|
-
blank: "bg-transparent hover:bg-neutral-faint",
|
|
126
|
-
"blue-blank": "bg-transparent hover:bg-neutral-faint",
|
|
127
|
-
"transparent-rounded":
|
|
128
|
-
"bg-transparent border border-neutral-soft hover:border-neutral-subtle",
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const textColors = {
|
|
132
|
-
"blue-rounded": "text-neutral",
|
|
133
|
-
"white-rounded": "text-neutral-emphasis hover:text-neutral-primary",
|
|
134
|
-
blank: "text-neutral-emphasis hover:text-neutral-primary",
|
|
135
|
-
"blue-blank": "text-primary hover:text-primary-dark",
|
|
136
|
-
"transparent-rounded": "text-neutral-emphasis",
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const variantClasses = computed(() => {
|
|
140
|
-
if (props.disabled) {
|
|
141
|
-
if (props.variant === "blank") {
|
|
142
|
-
return "border border-transparent";
|
|
143
|
-
}
|
|
144
|
-
return "bg-neutral border border-neutral-soft";
|
|
145
|
-
}
|
|
146
|
-
if (props.active) {
|
|
147
|
-
if (variants[props.variant as keyof typeof variants].includes("border")) {
|
|
148
|
-
return "bg-primary hover:bg-primary-dark border border-primary hover:border-primary-dark";
|
|
149
|
-
}
|
|
150
|
-
return "bg-primary hover:bg-primary-dark";
|
|
151
|
-
}
|
|
152
|
-
return variants[props.variant as keyof typeof variants];
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
const textColorClass = computed(() => {
|
|
156
|
-
if (props.disabled) {
|
|
157
|
-
return "text-neutral-soft";
|
|
158
|
-
}
|
|
159
|
-
if (props.active) {
|
|
160
|
-
return "text-neutral";
|
|
161
|
-
}
|
|
162
|
-
return textColors[props.variant as keyof typeof textColors];
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
const onClick = () => {
|
|
166
|
-
if (!props.disabled) {
|
|
167
|
-
emit("click");
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
</script>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# @dpa-shared-components/UiIconButton
|
|
2
|
-
|
|
3
|
-
## Usage
|
|
4
|
-
|
|
5
|
-
Color is set by text color:
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- SomeComponent.vue using UiIconButton -->
|
|
9
|
-
<template>
|
|
10
|
-
<UiIconButtonIcon iconName="alert"></UiIconButtonIcon>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import { UiIconButton } from "@dpa-id-components/dpa-shared-components";
|
|
15
|
-
</script>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## API
|
|
19
|
-
|
|
20
|
-
### Props
|
|
21
|
-
|
|
22
|
-
| Name | Type | Default | Description |
|
|
23
|
-
|-------------------|------------------------------------------------------|----------|---------------------------------------------------------------------------------------|
|
|
24
|
-
| `iconName` | `UiIconName` | required | Sets the `name`, which determines which svg is used as icon. |
|
|
25
|
-
| `size` | `"small" | "medium" | "large" | "xl"` | `large` | Sets the `size` attribute of the iconButton. |
|
|
26
|
-
| `backgroundColor` | `"blue" | "none" "gray-hover"` | `blue` | Sets the `color` of the button background including hover, active and disable states. |
|
|
27
|
-
| `iconColor` | `"blue" | "white" | "gray` | `white` | Sets the `color` of the button icon including hover, active and disable states. |
|
|
28
|
-
| `disabled` | `boolean` | `false` | Disables the button. |
|
|
29
|
-
| `title` | `string` | `""` | Sets the aria label of the button. |
|
|
30
|
-
|
|
31
|
-
### Slots
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { type ComponentMountingOptions, mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
3
|
-
|
|
4
|
-
import UiIconButton from "./UiIconButton.vue";
|
|
5
|
-
|
|
6
|
-
function createWrapper(
|
|
7
|
-
options: ComponentMountingOptions<typeof UiIconButton> = {},
|
|
8
|
-
) {
|
|
9
|
-
return mount(UiIconButton, {
|
|
10
|
-
...options,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
describe("UiIconButton", () => {
|
|
15
|
-
test("should have no background when color none is taken ", () => {
|
|
16
|
-
const wrapper = createWrapper({
|
|
17
|
-
props: {
|
|
18
|
-
title: "Title",
|
|
19
|
-
iconName: "alert",
|
|
20
|
-
backgroundColor: "none",
|
|
21
|
-
iconColor: "gray",
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
expect(wrapper.classes("bg-primary")).toBe(false);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test("should render small sized button by default", () => {
|
|
29
|
-
const wrapper = createWrapper({
|
|
30
|
-
props: {
|
|
31
|
-
iconName: "alert",
|
|
32
|
-
size: "medium",
|
|
33
|
-
title: "Foo",
|
|
34
|
-
backgroundColor: "none",
|
|
35
|
-
iconColor: "gray",
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
expect(wrapper.classes("h-8")).toBe(true);
|
|
39
|
-
expect(wrapper.classes("w-8")).toBe(true);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test("should emit a click event when clicked", async () => {
|
|
43
|
-
const wrapper = createWrapper({
|
|
44
|
-
props: {
|
|
45
|
-
title: "Title",
|
|
46
|
-
iconName: "alert",
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
await wrapper.trigger("click");
|
|
51
|
-
|
|
52
|
-
expect(wrapper.emitted().click).toBeTruthy();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test("should not emit click event when disabled", async () => {
|
|
56
|
-
const wrapper = createWrapper({
|
|
57
|
-
props: {
|
|
58
|
-
title: "Title",
|
|
59
|
-
iconName: "alert",
|
|
60
|
-
disabled: true,
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
await wrapper.trigger("click");
|
|
65
|
-
expect(wrapper.emitted().click).toBeFalsy();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test("should have no hover effect when disabled", async () => {
|
|
69
|
-
const wrapper = createWrapper({
|
|
70
|
-
props: {
|
|
71
|
-
title: "Title",
|
|
72
|
-
iconName: "alert",
|
|
73
|
-
disabled: true,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
expect(wrapper.classes("disabled:hover:bg-none")).toBe(true);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
import { action } from "storybook/actions";
|
|
3
|
-
|
|
4
|
-
import { icons } from "../UiIcon/icons.ts";
|
|
5
|
-
|
|
6
|
-
import UiIconButton from "./UiIconButton.vue";
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
tags: ["deprecated"],
|
|
10
|
-
title: "Ui/UiIconButton",
|
|
11
|
-
component: UiIconButton,
|
|
12
|
-
argTypes: {
|
|
13
|
-
title: {
|
|
14
|
-
control: "text",
|
|
15
|
-
},
|
|
16
|
-
iconName: {
|
|
17
|
-
control: "select",
|
|
18
|
-
options: Object.keys(icons),
|
|
19
|
-
},
|
|
20
|
-
size: {
|
|
21
|
-
control: "select",
|
|
22
|
-
options: ["small", "medium", "large", "xl"],
|
|
23
|
-
},
|
|
24
|
-
backgroundColor: {
|
|
25
|
-
control: "select",
|
|
26
|
-
options: ["blue", "gray-hover", "none"],
|
|
27
|
-
},
|
|
28
|
-
iconColor: {
|
|
29
|
-
control: "select",
|
|
30
|
-
options: ["blue", "white", "gray"],
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
args: {
|
|
34
|
-
title: "Title",
|
|
35
|
-
iconName: "alert",
|
|
36
|
-
size: "large",
|
|
37
|
-
backgroundColor: "blue",
|
|
38
|
-
iconColor: "white",
|
|
39
|
-
},
|
|
40
|
-
render: (args) => ({
|
|
41
|
-
setup() {
|
|
42
|
-
return { args };
|
|
43
|
-
},
|
|
44
|
-
components: { UiIconButton },
|
|
45
|
-
template: "<UiIconButton v-bind='args' @click='action'></UiIconButton>",
|
|
46
|
-
methods: { action: action("click") },
|
|
47
|
-
}),
|
|
48
|
-
} satisfies Meta<typeof UiIconButton>;
|
|
49
|
-
|
|
50
|
-
export default meta;
|
|
51
|
-
type Story = StoryObj<typeof meta>;
|
|
52
|
-
|
|
53
|
-
export const Default: Story = {};
|
|
54
|
-
|
|
55
|
-
export const Menu: Story = {
|
|
56
|
-
args: {
|
|
57
|
-
backgroundColor: "none",
|
|
58
|
-
iconColor: "gray",
|
|
59
|
-
iconName: "more-horizontal",
|
|
60
|
-
size: "large",
|
|
61
|
-
},
|
|
62
|
-
parameters: {
|
|
63
|
-
backgrounds: { default: "white" },
|
|
64
|
-
},
|
|
65
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button
|
|
3
|
-
:disabled="disabled"
|
|
4
|
-
:aria-label="title"
|
|
5
|
-
class="group flex flex-none items-center justify-center rounded-full focus:outline-hidden focus-visible:focus-outline"
|
|
6
|
-
:class="[colorClass, backgroundClass, buttonSizeClass]"
|
|
7
|
-
type="button"
|
|
8
|
-
@click="($event) => emit('click', $event)"
|
|
9
|
-
>
|
|
10
|
-
<UiIcon
|
|
11
|
-
class="flex items-center justify-center"
|
|
12
|
-
:name="iconName"
|
|
13
|
-
:size="iconSize"
|
|
14
|
-
/>
|
|
15
|
-
</button>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script lang="ts">
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use `UiButton` instead
|
|
21
|
-
*/
|
|
22
|
-
export default {
|
|
23
|
-
name: "UiIconButton",
|
|
24
|
-
};
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<script lang="ts" setup>
|
|
28
|
-
import { computed, onMounted } from "vue";
|
|
29
|
-
|
|
30
|
-
import UiIcon, { type UiIconName } from "../UiIcon/UiIcon.vue";
|
|
31
|
-
|
|
32
|
-
const emit = defineEmits<{
|
|
33
|
-
click: [MouseEvent];
|
|
34
|
-
}>();
|
|
35
|
-
|
|
36
|
-
const props = withDefaults(
|
|
37
|
-
defineProps<{
|
|
38
|
-
iconName: UiIconName;
|
|
39
|
-
title: string;
|
|
40
|
-
disabled?: boolean;
|
|
41
|
-
backgroundColor?: "blue" | "none" | "gray-hover";
|
|
42
|
-
iconColor?: "blue" | "gray" | "white";
|
|
43
|
-
size?: "small" | "medium" | "large" | "xl";
|
|
44
|
-
}>(),
|
|
45
|
-
{
|
|
46
|
-
disabled: false,
|
|
47
|
-
backgroundColor: "blue",
|
|
48
|
-
iconColor: "white",
|
|
49
|
-
size: "small",
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const backgroundColorVariants = {
|
|
54
|
-
blue: "hover:bg-primary-dark active:bg-primary-dark bg-primary disabled:bg-neutral-faint disabled:hover:bg-none",
|
|
55
|
-
none: "hover:bg-neutral-whisper active:bg-primary disabled:hover:bg-transparent",
|
|
56
|
-
"gray-hover": "hover:bg-neutral-faint disabled:hover:bg-none",
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const iconColorVariants = {
|
|
60
|
-
blue: "text-primary hover:text-primary-dark disabled:text-neutral-soft active:text-neutral",
|
|
61
|
-
gray: "text-neutral-emphasis hover:text-neutral-primary active:text-neutral-primary disabled:text-neutral-soft",
|
|
62
|
-
white: "text-neutral disabled:text-neutral-soft",
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const sizeVariants = {
|
|
66
|
-
small: {
|
|
67
|
-
iconSize: "small",
|
|
68
|
-
buttonSize: "h-6 w-6",
|
|
69
|
-
},
|
|
70
|
-
medium: {
|
|
71
|
-
iconSize: "large",
|
|
72
|
-
buttonSize: "h-8 w-8",
|
|
73
|
-
},
|
|
74
|
-
large: {
|
|
75
|
-
iconSize: "large",
|
|
76
|
-
buttonSize: "h-12 w-12",
|
|
77
|
-
},
|
|
78
|
-
xl: {
|
|
79
|
-
iconSize: "large",
|
|
80
|
-
buttonSize: "h-16 w-16",
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const backgroundClass = computed(() => {
|
|
85
|
-
return backgroundColorVariants[
|
|
86
|
-
props.backgroundColor as keyof typeof backgroundColorVariants
|
|
87
|
-
];
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const colorClass = computed(() => {
|
|
91
|
-
return iconColorVariants[props.iconColor as keyof typeof iconColorVariants];
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const buttonSizeClass = computed(() => {
|
|
95
|
-
return sizeVariants[props.size as keyof typeof sizeVariants].buttonSize;
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const iconSize = computed(() => {
|
|
99
|
-
return sizeVariants[props.size as keyof typeof sizeVariants].iconSize as
|
|
100
|
-
| "lg"
|
|
101
|
-
| "sm";
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
onMounted(() => {
|
|
105
|
-
if (window.location.origin.includes("local")) {
|
|
106
|
-
// eslint-disable-next-line no-console
|
|
107
|
-
console.warn(
|
|
108
|
-
"Component is deprecated. It will be removed in a future update.",
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
</script>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# @dpa-shared-components/UiList
|
|
2
|
-
|
|
3
|
-
## Usage
|
|
4
|
-
|
|
5
|
-
```html
|
|
6
|
-
<!-- SomeComponent.vue using UiList -->
|
|
7
|
-
<template>
|
|
8
|
-
<UiList>
|
|
9
|
-
<UiListItem>Item 1</UiListItem>
|
|
10
|
-
<UiListItem>Item 2</UiListItem>
|
|
11
|
-
<UiListItem>Item 3</UiListItem>
|
|
12
|
-
</UiList>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup lang="ts">
|
|
16
|
-
import {UiList, UiListItem} from "@dpa-id-components/dpa-shared-components";
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## API
|
|
22
|
-
|
|
23
|
-
### Props
|
|
24
|
-
|
|
25
|
-
This component has no properties.
|
|
26
|
-
|
|
27
|
-
### Slots
|
|
28
|
-
|
|
29
|
-
| Name | Description |
|
|
30
|
-
|-----------|------------------------------------------------------------------|
|
|
31
|
-
| `default` | Slot for the rendering the list's content (probably UiListItems) |
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
3
|
-
|
|
4
|
-
import UiListItem from "../UiListItem/UiListItem.vue";
|
|
5
|
-
|
|
6
|
-
import UiList from "./UiList.vue";
|
|
7
|
-
|
|
8
|
-
describe("UiList", () => {
|
|
9
|
-
test("renders with slot content", () => {
|
|
10
|
-
const wrapper = mount(UiList, {
|
|
11
|
-
slots: {
|
|
12
|
-
default: UiListItem,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
expect(wrapper.classes("border")).toBe(true);
|
|
16
|
-
expect(wrapper.classes("text-base/6")).toBe(true);
|
|
17
|
-
expect(wrapper.classes("focus:outline-hidden")).toBe(true);
|
|
18
|
-
expect(wrapper.classes("sm:text-sm/5")).toBe(true);
|
|
19
|
-
|
|
20
|
-
const listItem = wrapper.findComponent(UiListItem);
|
|
21
|
-
expect(listItem.exists()).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
|
|
3
|
-
import UiListItem from "../UiListItem/UiListItem.vue";
|
|
4
|
-
|
|
5
|
-
import UiList from "./UiList.vue";
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
tags: ["deprecated"],
|
|
9
|
-
title: "Ui/UiList",
|
|
10
|
-
component: UiList,
|
|
11
|
-
subcomponents: { UiListItem },
|
|
12
|
-
parameters: {
|
|
13
|
-
backgrounds: { default: "white" },
|
|
14
|
-
},
|
|
15
|
-
} satisfies Meta<typeof UiList>;
|
|
16
|
-
|
|
17
|
-
export default meta;
|
|
18
|
-
type Story = StoryObj<typeof meta>;
|
|
19
|
-
|
|
20
|
-
export const Default: Story = {
|
|
21
|
-
render: (args) => ({
|
|
22
|
-
setup() {
|
|
23
|
-
return { args };
|
|
24
|
-
},
|
|
25
|
-
components: { UiList, UiListItem },
|
|
26
|
-
template:
|
|
27
|
-
"<UiList v-bind='args'>" +
|
|
28
|
-
"<UiListItem>Test 1</UiListItem>" +
|
|
29
|
-
"<UiListItem>Test 2</UiListItem>" +
|
|
30
|
-
"<UiListItem>Test 3</UiListItem>" +
|
|
31
|
-
"<UiListItem>Test 4</UiListItem>" +
|
|
32
|
-
"</UiList>",
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const WithCheckboxes: Story = {
|
|
37
|
-
render: (args) => ({
|
|
38
|
-
setup() {
|
|
39
|
-
return { args };
|
|
40
|
-
},
|
|
41
|
-
components: { UiList, UiListItem },
|
|
42
|
-
template:
|
|
43
|
-
"<UiList v-bind='args'>" +
|
|
44
|
-
"<UiListItem checkBoxMenu>Test 1</UiListItem>" +
|
|
45
|
-
"<UiListItem checkBoxMenu>Test 2</UiListItem>" +
|
|
46
|
-
"<UiListItem checkBoxMenu>Test 3</UiListItem>" +
|
|
47
|
-
"<UiListItem checkBoxMenu>Test 4</UiListItem>" +
|
|
48
|
-
"</UiList>",
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const WithCheckmark: Story = {
|
|
53
|
-
render: (args) => ({
|
|
54
|
-
setup() {
|
|
55
|
-
return { args };
|
|
56
|
-
},
|
|
57
|
-
components: { UiList, UiListItem },
|
|
58
|
-
template:
|
|
59
|
-
"<UiList v-bind='args'>" +
|
|
60
|
-
"<UiListItem selectable selected>Test 1</UiListItem>" +
|
|
61
|
-
"<UiListItem selectable selected>Test 2</UiListItem>" +
|
|
62
|
-
"<UiListItem selectable selected>Test 3</UiListItem>" +
|
|
63
|
-
"<UiListItem selectable selected>Test 4</UiListItem>" +
|
|
64
|
-
"</UiList>",
|
|
65
|
-
}),
|
|
66
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul
|
|
3
|
-
class="rounded-sm border text-base/6 shadow-lg focus:outline-hidden sm:text-sm/5"
|
|
4
|
-
>
|
|
5
|
-
<slot />
|
|
6
|
-
</ul>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script lang="ts">
|
|
10
|
-
import { onMounted } from "vue";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated
|
|
14
|
-
* Please replace with your own component
|
|
15
|
-
*/
|
|
16
|
-
export default {
|
|
17
|
-
name: "UiList",
|
|
18
|
-
setup() {
|
|
19
|
-
onMounted(() => {
|
|
20
|
-
if (window.location.origin.includes("local")) {
|
|
21
|
-
// eslint-disable-next-line no-console
|
|
22
|
-
console.warn(
|
|
23
|
-
"Component is deprecated. It will be removed in a future update.",
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
</script>
|