@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,30 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
|
|
3
|
-
import UiCard from "./UiCard.vue";
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: "UI/UiCard",
|
|
7
|
-
tags: ["deprecated"],
|
|
8
|
-
component: UiCard,
|
|
9
|
-
} satisfies Meta<typeof UiCard>;
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof meta>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
render: (args) => ({
|
|
16
|
-
components: { UiCard },
|
|
17
|
-
setup() {
|
|
18
|
-
return { args };
|
|
19
|
-
},
|
|
20
|
-
template: `
|
|
21
|
-
<div class="w-full pt-12 pb-12 lg:mx-auto lg:w-5/6">
|
|
22
|
-
<h4 class="text-base mb-4">Kontakte</h4>
|
|
23
|
-
<ul class="w-full flex-wrap flex">
|
|
24
|
-
<UiCard v-bind="args">Autor: Max Mustermann (Berlin), +49 30 1234-56478, max.mustermann@dpa.com</UiCard>
|
|
25
|
-
<UiCard v-bind="args">Autor: Max Mustermann (Berlin), +49 30 1234-56478, max.mustermann@dpa.com</UiCard>
|
|
26
|
-
<UiCard v-bind="args">Autor: Max Mustermann (Berlin), +49 30 1234-56478, max.mustermann@dpa.com</UiCard>
|
|
27
|
-
</ul>
|
|
28
|
-
</div>`,
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<li
|
|
3
|
-
class="mb-4 rounded-2xl bg-neutral-whisper px-8 py-4 text-sm font-medium sm:w-full md:mr-7 md:w-[45.5%] lg:mr-8 lg:w-[46.5%]"
|
|
4
|
-
>
|
|
5
|
-
<slot></slot>
|
|
6
|
-
</li>
|
|
7
|
-
</template>
|
|
8
|
-
<script lang="ts">
|
|
9
|
-
import { onMounted } from "vue";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated
|
|
13
|
-
* Please replace with your own component
|
|
14
|
-
*/
|
|
15
|
-
export default {
|
|
16
|
-
name: "UiCard",
|
|
17
|
-
setup() {
|
|
18
|
-
onMounted(() => {
|
|
19
|
-
if (window.location.origin.includes("local")) {
|
|
20
|
-
// eslint-disable-next-line no-console
|
|
21
|
-
console.warn(
|
|
22
|
-
"Component is deprecated. It will be removed in a future update.",
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# @deprecated
|
|
2
|
-
Component will be removed in a future update
|
|
3
|
-
# @dpa-shared-components/UiCheckBoxGroup
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- SomeComponent.vue using UiCheckBoxGroup -->
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<UiCheckBoxGroup :item="checkboxes" :first-entry-checks-all="true" @item-checked="handleEvent"
|
|
12
|
-
@checked-all="handleEvent" />
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup lang="ts">
|
|
16
|
-
import { UiCheckBoxGroup } from "@dpa-id-components/dpa-shared-components";
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
### Props
|
|
21
|
-
|
|
22
|
-
The "CheckboxItem"-Type is used. Consisting of "name", "isChecked" and "iconName"
|
|
23
|
-
|
|
24
|
-
| Name | Type | Default | Description |
|
|
25
|
-
|-----------------------|----------------|---------|--------------------------------------------------------------------------------------------------|
|
|
26
|
-
| `item` | `CheckboxItem` | `` | Adds the value to the checkbox, consiting of name, isChecked and iconName ("CheckboxItem"-Type) |
|
|
27
|
-
| `firstEntryChecksAll` | `Boolean` | `false` | Wether the first item checks all the boxes |
|
|
28
|
-
|
|
29
|
-
### Events
|
|
30
|
-
|
|
31
|
-
| Name | Type | Description |
|
|
32
|
-
|----------------|------|----------------------------------------------|
|
|
33
|
-
| `checked-all` | `boolean` | Emitted when all items are selected |
|
|
34
|
-
| `input` | `CheckboxItem[]` | |
|
|
35
|
-
| `item-checked` | `CheckboxItem` | Emitted when each individual item is checked |
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { randomInt } from "node:crypto";
|
|
2
|
-
|
|
3
|
-
import { mount } from "@vue/test-utils";
|
|
4
|
-
import { describe, expect, test } from "vitest";
|
|
5
|
-
|
|
6
|
-
import UiCheckBoxGroup, { type CheckboxItem } from "./UiCheckBoxGroup.vue";
|
|
7
|
-
|
|
8
|
-
const entries = [
|
|
9
|
-
{
|
|
10
|
-
name: "alle wählen",
|
|
11
|
-
isChecked: false,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: "Wissenschaft",
|
|
15
|
-
isChecked: false,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "Kultur",
|
|
19
|
-
isChecked: false,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "Sport",
|
|
23
|
-
isChecked: false,
|
|
24
|
-
},
|
|
25
|
-
] as CheckboxItem[];
|
|
26
|
-
|
|
27
|
-
describe("UiCheckBoxGroup", () => {
|
|
28
|
-
test("renders menu with prop values", async () => {
|
|
29
|
-
const wrapper = mount(UiCheckBoxGroup, {
|
|
30
|
-
props: {
|
|
31
|
-
item: entries,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const listElements = wrapper.findAll("li");
|
|
36
|
-
|
|
37
|
-
listElements.forEach((entry) => {
|
|
38
|
-
expect(entries.some((item) => entry.text().includes(item.name))).toBe(
|
|
39
|
-
true,
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test("emits checked-all when first item is clicked", async () => {
|
|
45
|
-
const wrapper = mount(UiCheckBoxGroup, {
|
|
46
|
-
props: {
|
|
47
|
-
item: entries,
|
|
48
|
-
firstEntryChecksAll: true,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const firstListElement = wrapper.findAll("li")[0];
|
|
53
|
-
|
|
54
|
-
await firstListElement.trigger("click");
|
|
55
|
-
expect(wrapper.emitted()).toHaveProperty("checked-all");
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test("emits item-checked when one item is clicked", async () => {
|
|
59
|
-
const wrapper = mount(UiCheckBoxGroup, {
|
|
60
|
-
props: {
|
|
61
|
-
item: entries,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const randomListElement = wrapper.findAll("li")[randomInt(0, 3)];
|
|
66
|
-
|
|
67
|
-
await randomListElement.trigger("click");
|
|
68
|
-
expect(wrapper.emitted()).toHaveProperty("item-checked");
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
|
|
3
|
-
import UiCheckBoxGroup from "./UiCheckBoxGroup.vue";
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: "forms/UiCheckboxGroup",
|
|
7
|
-
component: UiCheckBoxGroup,
|
|
8
|
-
argTypes: {
|
|
9
|
-
firstEntryChecksAll: { control: "boolean" },
|
|
10
|
-
disabled: { control: "boolean" },
|
|
11
|
-
},
|
|
12
|
-
args: {
|
|
13
|
-
firstEntryChecksAll: true,
|
|
14
|
-
disabled: false,
|
|
15
|
-
},
|
|
16
|
-
tags: ["deprecated"],
|
|
17
|
-
} satisfies Meta<typeof UiCheckBoxGroup>;
|
|
18
|
-
|
|
19
|
-
export default meta;
|
|
20
|
-
type Story = StoryObj<typeof meta>;
|
|
21
|
-
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
render: (args) => ({
|
|
24
|
-
setup() {
|
|
25
|
-
return { args };
|
|
26
|
-
},
|
|
27
|
-
components: { UiCheckBoxGroup },
|
|
28
|
-
template: "<UiCheckBoxGroup v-bind='args'/>",
|
|
29
|
-
}),
|
|
30
|
-
args: {
|
|
31
|
-
item: [
|
|
32
|
-
{
|
|
33
|
-
name: "alle Ressorts",
|
|
34
|
-
isChecked: false,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "Wirtschaft",
|
|
38
|
-
isChecked: false,
|
|
39
|
-
iconName: "clock",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: "Panorama",
|
|
43
|
-
isChecked: false,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "Wissenschaft",
|
|
47
|
-
isChecked: false,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: "Kultur",
|
|
51
|
-
isChecked: false,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "Sport",
|
|
55
|
-
isChecked: false,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<UiList class="grid grid-cols-2 flex-wrap border-none pt-2 lg:flex lg:pt-0">
|
|
3
|
-
<UiListItem
|
|
4
|
-
v-for="(entry, index) in checkboxItems"
|
|
5
|
-
:key="entry.name"
|
|
6
|
-
:is-checked="entry.isChecked"
|
|
7
|
-
class="flex h-8 items-center border-none py-2 text-sm shadow-none lg:py-3"
|
|
8
|
-
check-box-menu
|
|
9
|
-
:disabled="disabled"
|
|
10
|
-
:icon-name="entry.iconName"
|
|
11
|
-
@list-item-click="toggle(index)"
|
|
12
|
-
>{{ entry.name }}
|
|
13
|
-
</UiListItem>
|
|
14
|
-
</UiList>
|
|
15
|
-
</template>
|
|
16
|
-
<script lang="ts">
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
* Please replace with your own component
|
|
20
|
-
*/
|
|
21
|
-
export default {
|
|
22
|
-
name: "UiCheckBoxGroup",
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type CheckboxItem = {
|
|
26
|
-
name: string;
|
|
27
|
-
isChecked: boolean;
|
|
28
|
-
iconName?: UiIconName;
|
|
29
|
-
};
|
|
30
|
-
</script>
|
|
31
|
-
<script setup lang="ts">
|
|
32
|
-
import { computed, onMounted, ref, watchEffect } from "vue";
|
|
33
|
-
|
|
34
|
-
import type { UiIconName } from "../UiIcon/UiIcon.vue";
|
|
35
|
-
import UiList from "../UiList/UiList.vue";
|
|
36
|
-
import UiListItem from "../UiListItem/UiListItem.vue";
|
|
37
|
-
|
|
38
|
-
const emit = defineEmits<{
|
|
39
|
-
"checked-all": [boolean];
|
|
40
|
-
input: [CheckboxItem[]];
|
|
41
|
-
"item-checked": [CheckboxItem];
|
|
42
|
-
}>();
|
|
43
|
-
|
|
44
|
-
const props = withDefaults(
|
|
45
|
-
defineProps<{
|
|
46
|
-
item?: CheckboxItem[];
|
|
47
|
-
firstEntryChecksAll?: boolean;
|
|
48
|
-
disabled?: boolean;
|
|
49
|
-
}>(),
|
|
50
|
-
{
|
|
51
|
-
item: () => [],
|
|
52
|
-
firstEntryChecksAll: false,
|
|
53
|
-
disabled: false,
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const checkboxItems = ref<CheckboxItem[]>(props.item);
|
|
58
|
-
|
|
59
|
-
watchEffect(() => {
|
|
60
|
-
checkboxItems.value = props.item;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const areAllChecked = computed(() => {
|
|
64
|
-
const checkboxEntries = checkboxItems.value.slice(1);
|
|
65
|
-
return checkboxEntries.every((entry: CheckboxItem) => entry.isChecked);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const toggleAll = () => {
|
|
69
|
-
checkboxItems.value = checkboxItems.value.map((entry: CheckboxItem) => {
|
|
70
|
-
const isChecked = !checkboxItems.value[0].isChecked;
|
|
71
|
-
return {
|
|
72
|
-
...entry,
|
|
73
|
-
isChecked,
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
emit("checked-all", checkboxItems.value[0].isChecked);
|
|
77
|
-
emit("input", checkboxItems.value);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const toggle = (index: number) => {
|
|
81
|
-
// With List Item Click we are overriding the normal checkbox `input` event, hence the disabled attribute has no effect
|
|
82
|
-
if (props.disabled) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (index === 0 && props.firstEntryChecksAll) {
|
|
86
|
-
toggleAll();
|
|
87
|
-
} else {
|
|
88
|
-
checkboxItems.value[index].isChecked =
|
|
89
|
-
!checkboxItems.value[index].isChecked;
|
|
90
|
-
if (props.firstEntryChecksAll) {
|
|
91
|
-
checkboxItems.value[0].isChecked = areAllChecked.value;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
emit("item-checked", checkboxItems.value[index]);
|
|
95
|
-
emit("input", checkboxItems.value);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
onMounted(() => {
|
|
99
|
-
if (window.location.origin.includes("local")) {
|
|
100
|
-
// eslint-disable-next-line no-console
|
|
101
|
-
console.warn(
|
|
102
|
-
"Component is deprecated. It will be removed in a future update.",
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
</script>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# @deprecated
|
|
2
|
-
Component will be removed in a future update
|
|
3
|
-
# @dpa-shared-components/UiCollapseNavigation
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- SomeComponent.vue using UiCollapseNavigation -->
|
|
9
|
-
<template>
|
|
10
|
-
<UiCollapseNavigation headline="Menu eins">
|
|
11
|
-
<UiButton> test eins </UiButton>
|
|
12
|
-
<UiButton> test zwei </UiButton>
|
|
13
|
-
<UiButton> test drei </UiButton>
|
|
14
|
-
</UiCollapseNavigation>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script>
|
|
18
|
-
import UiCollapseNavigation from "./UiCollapseNavigation.vue";
|
|
19
|
-
</script>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## API
|
|
23
|
-
|
|
24
|
-
### Props
|
|
25
|
-
|
|
26
|
-
| Name | Type | Default | Description |
|
|
27
|
-
|-----------------|---------|---------|-----------------------------------|
|
|
28
|
-
| `headline` | string | '' | Headline of the menu |
|
|
29
|
-
| `borderTop` | boolean | true | Has top border |
|
|
30
|
-
| `openAsDefault` | boolean | true | defines default state of the menu |
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Slots
|
|
34
|
-
|
|
35
|
-
| Name | Description |
|
|
36
|
-
|-----------|----------------------------|
|
|
37
|
-
| `default` | slot for the menus content |
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { shallowMount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
3
|
-
|
|
4
|
-
import UiCollapseNavigation from "./UiCollapseNavigation.vue";
|
|
5
|
-
|
|
6
|
-
describe("UiCollapseNavigation", () => {
|
|
7
|
-
test("should toggle the menu when the button is clicked", async () => {
|
|
8
|
-
const wrapper = shallowMount(UiCollapseNavigation);
|
|
9
|
-
const button = wrapper.findComponent({ name: "UiButton" });
|
|
10
|
-
|
|
11
|
-
expect(wrapper.vm.openMenu).toBe(true);
|
|
12
|
-
|
|
13
|
-
await button.trigger("click");
|
|
14
|
-
|
|
15
|
-
expect(wrapper.vm.openMenu).toBe(false);
|
|
16
|
-
|
|
17
|
-
await button.trigger("click");
|
|
18
|
-
|
|
19
|
-
expect(wrapper.vm.openMenu).toBe(true);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
|
|
3
|
-
import UiButton from "../UiButton/UiButton.vue";
|
|
4
|
-
|
|
5
|
-
import UiCollapseNavigation from "./UiCollapseNavigation.vue";
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
title: "Ui/UiCollapseNavigation",
|
|
9
|
-
component: UiCollapseNavigation,
|
|
10
|
-
argTypes: {
|
|
11
|
-
headline: {
|
|
12
|
-
control: "text",
|
|
13
|
-
},
|
|
14
|
-
hasBorderTop: {
|
|
15
|
-
control: "boolean",
|
|
16
|
-
},
|
|
17
|
-
openAsDefault: {
|
|
18
|
-
control: "boolean",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
args: {
|
|
22
|
-
headline: "Gespeicherte Suchen",
|
|
23
|
-
hasBorderTop: true,
|
|
24
|
-
openAsDefault: true,
|
|
25
|
-
},
|
|
26
|
-
tags: ["deprecated"],
|
|
27
|
-
} satisfies Meta<typeof UiCollapseNavigation>;
|
|
28
|
-
|
|
29
|
-
export default meta;
|
|
30
|
-
type Story = StoryObj<typeof meta>;
|
|
31
|
-
|
|
32
|
-
export const Default: Story = {
|
|
33
|
-
render: (args) => ({
|
|
34
|
-
setup() {
|
|
35
|
-
return { args };
|
|
36
|
-
},
|
|
37
|
-
components: { UiCollapseNavigation, UiButton },
|
|
38
|
-
template: `
|
|
39
|
-
<UiCollapseNavigation v-bind='args' >
|
|
40
|
-
<UiButton> test eins </UiButton>
|
|
41
|
-
<UiButton> test zwei </UiButton>
|
|
42
|
-
<UiButton> test drei </UiButton>
|
|
43
|
-
</UiCollapseNavigation>
|
|
44
|
-
`,
|
|
45
|
-
}),
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const MultipleMenus: Story = {
|
|
49
|
-
render: (args) => ({
|
|
50
|
-
setup() {
|
|
51
|
-
return { args };
|
|
52
|
-
},
|
|
53
|
-
components: { UiCollapseNavigation, UiButton },
|
|
54
|
-
template: `
|
|
55
|
-
<UiCollapseNavigation headline="Menu eins">
|
|
56
|
-
<UiButton> test eins </UiButton>
|
|
57
|
-
<UiButton> test zwei </UiButton>
|
|
58
|
-
<UiButton> test drei </UiButton>
|
|
59
|
-
</UiCollapseNavigation>
|
|
60
|
-
<UiCollapseNavigation headline="Menu zwei">
|
|
61
|
-
<UiButton> test vier </UiButton>
|
|
62
|
-
<UiButton> test fünf </UiButton>
|
|
63
|
-
<UiButton> test sechs </UiButton>
|
|
64
|
-
</UiCollapseNavigation>
|
|
65
|
-
`,
|
|
66
|
-
}),
|
|
67
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="hasBorderTop ? 'border-t border-t-neutral-faint' : ''" />
|
|
3
|
-
<UiButton
|
|
4
|
-
appearance="outline-emphasis"
|
|
5
|
-
class="flex w-full justify-between border-none"
|
|
6
|
-
@click="toggleMenuHandler"
|
|
7
|
-
>
|
|
8
|
-
<h3
|
|
9
|
-
class="text-xs font-semibold tracking-widest text-neutral-subtle uppercase"
|
|
10
|
-
>
|
|
11
|
-
{{ headline }}
|
|
12
|
-
</h3>
|
|
13
|
-
<UiIcon
|
|
14
|
-
name="chevron-down"
|
|
15
|
-
class="rounded-full text-neutral-subtle transition-transform duration-500 hover:bg-neutral-faint"
|
|
16
|
-
:class="{ 'rotate-180': openMenu }"
|
|
17
|
-
/>
|
|
18
|
-
</UiButton>
|
|
19
|
-
<transition
|
|
20
|
-
enter-active-class="duration-200"
|
|
21
|
-
enter-from-class="transform -translate-y-[20px] opacity-0"
|
|
22
|
-
enter-to-class="transform translate-y-0 opacity-1"
|
|
23
|
-
leave-active-class="duration-200"
|
|
24
|
-
leave-from-class="transform translate-y-0 opacity-1"
|
|
25
|
-
leave-to-class="transform -translate-y-[20px] opacity-0"
|
|
26
|
-
>
|
|
27
|
-
<div v-if="openMenu">
|
|
28
|
-
<slot />
|
|
29
|
-
</div>
|
|
30
|
-
</transition>
|
|
31
|
-
</template>
|
|
32
|
-
<script lang="ts">
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated
|
|
35
|
-
* Please replace with your own component
|
|
36
|
-
*/
|
|
37
|
-
export default {
|
|
38
|
-
name: "UiCollapseNavigation",
|
|
39
|
-
};
|
|
40
|
-
</script>
|
|
41
|
-
<script setup lang="ts">
|
|
42
|
-
import { onMounted, ref, watchEffect } from "vue";
|
|
43
|
-
|
|
44
|
-
import UiButton from "../UiButton/UiButton.vue";
|
|
45
|
-
import UiIcon from "../UiIcon/UiIcon.vue";
|
|
46
|
-
|
|
47
|
-
const props = withDefaults(
|
|
48
|
-
defineProps<{
|
|
49
|
-
headline?: string;
|
|
50
|
-
hasBorderTop?: boolean;
|
|
51
|
-
openAsDefault?: boolean;
|
|
52
|
-
}>(),
|
|
53
|
-
{
|
|
54
|
-
headline: "",
|
|
55
|
-
hasBorderTop: true,
|
|
56
|
-
openAsDefault: true,
|
|
57
|
-
},
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const openMenu = ref();
|
|
61
|
-
|
|
62
|
-
watchEffect(() => {
|
|
63
|
-
openMenu.value = props.openAsDefault;
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const toggleMenuHandler = () => {
|
|
67
|
-
openMenu.value = !openMenu.value;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
onMounted(() => {
|
|
71
|
-
if (window.location.origin.includes("local")) {
|
|
72
|
-
// eslint-disable-next-line no-console
|
|
73
|
-
console.warn(
|
|
74
|
-
"Component is deprecated. It will be removed in a future update.",
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
defineExpose({ openMenu });
|
|
79
|
-
</script>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# @deprecated
|
|
2
|
-
Component will be removed in a future update
|
|
3
|
-
# @dpa-shared-components/UiFilterButton
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- SomeComponent.vue using UiFilterBadge -->
|
|
9
|
-
<template>
|
|
10
|
-
<UiFilterButton title="Filter" @click="doSomething" />
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import { UiFilterButton } from "@dpa-id-components/dpa-shared-components";
|
|
15
|
-
</script>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## API
|
|
19
|
-
|
|
20
|
-
### Props
|
|
21
|
-
|
|
22
|
-
| Name | Type | Default | Description |
|
|
23
|
-
|---------------|-------------------------------------------------------------------------------------|-------------------|---------------------------------------------------------------------------------------|
|
|
24
|
-
| `title` | `String` | `` | Sets the label of the Button. |
|
|
25
|
-
| `variant` | `"white-rounded" | "blue-rounded" | "transparent-rounded" | "blank"` | `"white-rounded"` | Visual variants of the button |
|
|
26
|
-
| `chevronIcon` | `UiIconName` | `"chevron-down"` | If the Icon should change when the Component is in dirty state put in Icon name here. |
|
|
27
|
-
| `iconLeft` | `UiIconName` | null | If you want an icon left of the title put in icon name here. |
|
|
28
|
-
| `rotateIcon` | `Boolean` | `false` | Rotates the icon. |
|
|
29
|
-
| `iconSize` | `"small" | "medium" | "large"` | `"small"` | Icon size. |
|
|
30
|
-
| `disabled` | `Boolean` | `false` | Disables the button. |
|
|
31
|
-
| `active` | `Boolean` | `false` | Sets active style for the button. |
|
|
32
|
-
|
|
33
|
-
### Events
|
|
34
|
-
|
|
35
|
-
| Name | Type | Description |
|
|
36
|
-
|---------|---------|-------------|
|
|
37
|
-
| `click` | none | |
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { type ComponentMountingOptions, mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
3
|
-
|
|
4
|
-
import UiFilterButton from "./UiFilterButton.vue";
|
|
5
|
-
|
|
6
|
-
function createWrapper(
|
|
7
|
-
options: ComponentMountingOptions<typeof UiFilterButton> = {},
|
|
8
|
-
) {
|
|
9
|
-
return mount(UiFilterButton, {
|
|
10
|
-
...options,
|
|
11
|
-
props: {
|
|
12
|
-
title: "Foo Bar",
|
|
13
|
-
...options.props,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe("UiFilterBadge", () => {
|
|
19
|
-
test("renders attributes on correct element", () => {
|
|
20
|
-
const wrapper = createWrapper({
|
|
21
|
-
props: {
|
|
22
|
-
id: "id",
|
|
23
|
-
class: "testClass",
|
|
24
|
-
"data-testid": "testId",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const root = wrapper.find(":first-child");
|
|
29
|
-
expect(root.element.classList.contains("testClass")).toBe(true);
|
|
30
|
-
expect(root.element.getAttribute("data-testid")).toBe("testId");
|
|
31
|
-
expect(root.element.getAttribute("id")).toBe("id");
|
|
32
|
-
|
|
33
|
-
const button = wrapper.find('[data-testid="filter-button"]');
|
|
34
|
-
expect(button.element.classList.contains("testClass")).toBe(false);
|
|
35
|
-
expect(button.element.getAttribute("data-testid")).not.toBe("testId");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test("renders with given Title", () => {
|
|
39
|
-
const wrapper = createWrapper();
|
|
40
|
-
expect(wrapper.text()).toBe("Foo Bar");
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test("changes colour according to prop change", () => {
|
|
44
|
-
const wrapper = createWrapper({
|
|
45
|
-
props: {
|
|
46
|
-
variant: "blue-rounded",
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
expect(wrapper.classes("bg-primary")).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test("emits click event", async () => {
|
|
53
|
-
const wrapper = createWrapper();
|
|
54
|
-
const button = wrapper.find('[data-testid="filter-button"]');
|
|
55
|
-
await button.trigger("click");
|
|
56
|
-
|
|
57
|
-
const lastEvent = (wrapper.emitted("click") ?? []).at(-1);
|
|
58
|
-
expect(lastEvent).toEqual([]);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test("renders attributes on correct element", () => {
|
|
62
|
-
const wrapper = mount(UiFilterButton, {
|
|
63
|
-
props: {
|
|
64
|
-
options: [],
|
|
65
|
-
groupName: "",
|
|
66
|
-
id: "id",
|
|
67
|
-
class: "testClass pr-8",
|
|
68
|
-
"data-testid": "testId",
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const root = wrapper.find(":first-child");
|
|
73
|
-
expect(root.attributes("id")).toBe("id");
|
|
74
|
-
expect(root.element.classList.contains("testClass")).toBe(true);
|
|
75
|
-
expect(root.element.classList.contains("pr-4")).toBe(false);
|
|
76
|
-
expect(root.element.classList.contains("pr-8")).toBe(true);
|
|
77
|
-
expect(root.attributes("data-testid")).toBe("testId");
|
|
78
|
-
});
|
|
79
|
-
});
|