@dpa-id-components/dpa-shared-components 22.0.0-next.9 → 22.0.1
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 +4 -2
- 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 +22 -22
- 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 +4 -2
- 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,49 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
3
|
-
|
|
4
|
-
import UiSection from "./UiSection.vue";
|
|
5
|
-
|
|
6
|
-
describe("UiSection", () => {
|
|
7
|
-
const wrapper = mount(UiSection, {
|
|
8
|
-
slots: {
|
|
9
|
-
default: "Slot text",
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test("renders with slot content", () => {
|
|
14
|
-
const inner = wrapper.find('[data-testid="inner"]');
|
|
15
|
-
|
|
16
|
-
expect(inner.text()).toBe("Slot text");
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test("renders with border classes", async () => {
|
|
20
|
-
await wrapper.setProps({
|
|
21
|
-
borderTop: true,
|
|
22
|
-
borderBottom: true,
|
|
23
|
-
});
|
|
24
|
-
expect(wrapper.classes("border-t")).toBe(true);
|
|
25
|
-
expect(wrapper.classes("border-b")).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test("renders with padding classes", async () => {
|
|
29
|
-
await wrapper.setProps({
|
|
30
|
-
verticalPadding: "small",
|
|
31
|
-
});
|
|
32
|
-
const inner = wrapper.find('[data-testid="inner"]');
|
|
33
|
-
|
|
34
|
-
expect(inner.classes("lg:py-12")).toBe(true);
|
|
35
|
-
expect(inner.classes("pt-8")).toBe(true);
|
|
36
|
-
expect(inner.classes("pb-12")).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("renders with size classes", async () => {
|
|
40
|
-
await wrapper.setProps({
|
|
41
|
-
size: "small",
|
|
42
|
-
});
|
|
43
|
-
const inner = wrapper.find('[data-testid="inner"]');
|
|
44
|
-
|
|
45
|
-
expect(inner.classes("w-full")).toBe(true);
|
|
46
|
-
expect(inner.classes("lg:mx-auto")).toBe(true);
|
|
47
|
-
expect(inner.classes("lg:w-2/3")).toBe(true);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
|
|
3
|
-
import UiSection from "./UiSection.vue";
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: "Ui/UiSection",
|
|
7
|
-
component: UiSection,
|
|
8
|
-
argTypes: {
|
|
9
|
-
size: {
|
|
10
|
-
control: "select",
|
|
11
|
-
options: ["wide", "small"],
|
|
12
|
-
},
|
|
13
|
-
verticalPadding: {
|
|
14
|
-
control: "select",
|
|
15
|
-
options: ["small", "large", "none"],
|
|
16
|
-
},
|
|
17
|
-
borderTop: {
|
|
18
|
-
control: "boolean",
|
|
19
|
-
},
|
|
20
|
-
borderBottom: {
|
|
21
|
-
control: "boolean",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
args: {
|
|
25
|
-
size: "small",
|
|
26
|
-
verticalPadding: "large",
|
|
27
|
-
borderTop: false,
|
|
28
|
-
borderBottom: false,
|
|
29
|
-
},
|
|
30
|
-
parameters: {
|
|
31
|
-
backgrounds: { default: "gray-100" },
|
|
32
|
-
},
|
|
33
|
-
tags: ["deprecated"],
|
|
34
|
-
} satisfies Meta<typeof UiSection>;
|
|
35
|
-
|
|
36
|
-
export default meta;
|
|
37
|
-
type Story = StoryObj<typeof meta>;
|
|
38
|
-
|
|
39
|
-
export const Default: Story = {
|
|
40
|
-
render: (args) => ({
|
|
41
|
-
setup() {
|
|
42
|
-
return { args };
|
|
43
|
-
},
|
|
44
|
-
components: { UiSection },
|
|
45
|
-
template: "<UiSection v-bind='args'>Slot</UiSection>",
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const Multiple: Story = {
|
|
50
|
-
render: (args) => ({
|
|
51
|
-
setup() {
|
|
52
|
-
return { args };
|
|
53
|
-
},
|
|
54
|
-
components: { UiSection },
|
|
55
|
-
template:
|
|
56
|
-
"<UiSection v-bind='args'>Slot1</UiSection>" +
|
|
57
|
-
"<UiSection v-bind='args'>Slot2</UiSection>" +
|
|
58
|
-
"<UiSection v-bind='args'>Slot3</UiSection>" +
|
|
59
|
-
"<UiSection v-bind='args'>Slot4</UiSection>",
|
|
60
|
-
}),
|
|
61
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section :class="borderClass" class="w-full border-neutral-pale bg-neutral">
|
|
3
|
-
<div
|
|
4
|
-
:class="[sizeClasses[size], paddingClasses[verticalPadding]]"
|
|
5
|
-
data-testid="inner"
|
|
6
|
-
>
|
|
7
|
-
<slot></slot>
|
|
8
|
-
</div>
|
|
9
|
-
</section>
|
|
10
|
-
</template>
|
|
11
|
-
<script lang="ts">
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated
|
|
14
|
-
* Please replace with your own component
|
|
15
|
-
*/
|
|
16
|
-
export default {
|
|
17
|
-
name: "UiSection",
|
|
18
|
-
};
|
|
19
|
-
</script>
|
|
20
|
-
<script setup lang="ts">
|
|
21
|
-
import { computed, onMounted } from "vue";
|
|
22
|
-
|
|
23
|
-
const props = withDefaults(
|
|
24
|
-
defineProps<{
|
|
25
|
-
size?: "wide" | "small";
|
|
26
|
-
verticalPadding?: "small" | "large" | "none";
|
|
27
|
-
borderTop?: boolean;
|
|
28
|
-
borderBottom?: boolean;
|
|
29
|
-
}>(),
|
|
30
|
-
{
|
|
31
|
-
size: "wide",
|
|
32
|
-
verticalPadding: "large",
|
|
33
|
-
borderTop: false,
|
|
34
|
-
borderBottom: false,
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const sizeClasses: Record<string, string> = {
|
|
39
|
-
wide: "w-full md:px-28 text-neutral-primary lg:flex",
|
|
40
|
-
small: "w-full lg:mx-auto lg:w-2/3",
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const paddingClasses: Record<string, string> = {
|
|
44
|
-
small: "lg:py-12 pt-8 pb-12",
|
|
45
|
-
large: "py-24",
|
|
46
|
-
none: "py-0",
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const borderClass = computed(() => {
|
|
50
|
-
const borderTopClass = props.borderTop ? "border-t" : "";
|
|
51
|
-
const borderBottomClass = props.borderBottom ? "border-b" : "";
|
|
52
|
-
return `${borderTopClass} ${borderBottomClass}`;
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
onMounted(() => {
|
|
56
|
-
if (window.location.origin.includes("local")) {
|
|
57
|
-
// eslint-disable-next-line no-console
|
|
58
|
-
console.warn(
|
|
59
|
-
"Component is deprecated. It will be removed in a future update.",
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
</script>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# @deprecated
|
|
2
|
-
Component will be removed in a future update
|
|
3
|
-
# @dpa-shared-components/UiSectionDivider
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- SomeComponent.vue using UiSectionDivider -->
|
|
9
|
-
<template>
|
|
10
|
-
<UiSectionDivider></UiSectionDivider>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import {UiSectionDivider} from "@dpa-id-components/dpa-shared-components";
|
|
15
|
-
</script>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## API
|
|
19
|
-
|
|
20
|
-
### Props
|
|
21
|
-
|
|
22
|
-
| Name | Type | Default | Description |
|
|
23
|
-
|-----------------|--------------------------|-----------|------------------------|
|
|
24
|
-
| `size` | `"large" | "small"` | `"large"` | Determines the height. |
|
|
25
|
-
| `customClasses` | `String` | `""` | Custom class string. |
|
|
26
|
-
|
|
27
|
-
### Slots
|
|
28
|
-
|
|
29
|
-
This component has no slot
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
3
|
-
|
|
4
|
-
import UiSectionDivider from "./UiSectionDivider.vue";
|
|
5
|
-
|
|
6
|
-
describe("UiSectionDivider", () => {
|
|
7
|
-
const wrapper = mount(UiSectionDivider);
|
|
8
|
-
|
|
9
|
-
test("renders default size class", () => {
|
|
10
|
-
expect(wrapper.classes("h-4")).toBe(true);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test("renders small size class", async () => {
|
|
14
|
-
await wrapper.setProps({
|
|
15
|
-
size: "small",
|
|
16
|
-
});
|
|
17
|
-
expect(wrapper.classes("h-px")).toBe(true);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
|
|
3
|
-
import UiSection from "../UiSection/UiSection.vue";
|
|
4
|
-
|
|
5
|
-
import UiSectionDivider from "./UiSectionDivider.vue";
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
title: "Ui/UiSectionDivider",
|
|
9
|
-
component: UiSectionDivider,
|
|
10
|
-
subcomponents: { UiSection },
|
|
11
|
-
argTypes: {
|
|
12
|
-
size: {
|
|
13
|
-
control: "select",
|
|
14
|
-
options: ["large", "small"],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
args: {
|
|
18
|
-
size: "large",
|
|
19
|
-
},
|
|
20
|
-
tags: ["deprecated"],
|
|
21
|
-
} satisfies Meta<typeof UiSectionDivider>;
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
type Story = StoryObj<typeof meta>;
|
|
25
|
-
|
|
26
|
-
export const Default: Story = {
|
|
27
|
-
render: (args) => ({
|
|
28
|
-
setup() {
|
|
29
|
-
return { args };
|
|
30
|
-
},
|
|
31
|
-
components: { UiSectionDivider },
|
|
32
|
-
template: "<UiSectionDivider v-bind='args'>Slot</UiSectionDivider>",
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const WithSection: Story = {
|
|
37
|
-
render: (args) => ({
|
|
38
|
-
setup() {
|
|
39
|
-
return { args };
|
|
40
|
-
},
|
|
41
|
-
components: { UiSectionDivider, UiSection },
|
|
42
|
-
template:
|
|
43
|
-
"<UiSection>Section 1</UiSection>" +
|
|
44
|
-
"<UiSectionDivider v-bind='args'></UiSectionDivider>" +
|
|
45
|
-
"<UiSection>Section 2</UiSection>" +
|
|
46
|
-
"<UiSectionDivider v-bind='args'>Slot4</UiSectionDivider>" +
|
|
47
|
-
"<UiSection>Section 3</UiSection>",
|
|
48
|
-
}),
|
|
49
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="[sizeClass, customClasses]" class="bg-neutral-whisper" />
|
|
3
|
-
</template>
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
* Please replace with your own component
|
|
8
|
-
*/
|
|
9
|
-
export default {
|
|
10
|
-
name: "UiSectionDivider",
|
|
11
|
-
};
|
|
12
|
-
</script>
|
|
13
|
-
<script lang="ts" setup>
|
|
14
|
-
import { computed, onMounted } from "vue";
|
|
15
|
-
|
|
16
|
-
const props = withDefaults(
|
|
17
|
-
defineProps<{
|
|
18
|
-
size?: "small" | "large";
|
|
19
|
-
customClasses?: string[] | string;
|
|
20
|
-
}>(),
|
|
21
|
-
{
|
|
22
|
-
customClasses: "",
|
|
23
|
-
size: "large",
|
|
24
|
-
},
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
const sizeClasses: Record<string, string> = {
|
|
28
|
-
small: "h-px",
|
|
29
|
-
large: "h-4",
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const sizeClass = computed(() => {
|
|
33
|
-
return sizeClasses[props.size];
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
onMounted(() => {
|
|
37
|
-
if (window.location.origin.includes("local")) {
|
|
38
|
-
// eslint-disable-next-line no-console
|
|
39
|
-
console.warn(
|
|
40
|
-
"Component is deprecated. It will be removed in a future update.",
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
</script>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# @dpa-id-components/UiTextButton
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
yarn add @dpa-id-components/UiTextButton
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<!-- SomeComponent.vue using UiTextButton -->
|
|
13
|
-
<template>
|
|
14
|
-
<UiTextButton>Link</UiTextButton>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup lang="ts">
|
|
18
|
-
import UiTextButton from "@dpa-id-components/UiSnackbar";
|
|
19
|
-
</script>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## API
|
|
23
|
-
|
|
24
|
-
### Props
|
|
25
|
-
|
|
26
|
-
| Name | Type | Default | Description |
|
|
27
|
-
|-------------|------------------------------------------|-------------|-------------------------------------------------------------------------------------|
|
|
28
|
-
| color? | "blue" | "gray"; | "blue" | The text color |
|
|
29
|
-
| href? | string; | undefined | The link target, if set the component will render as <a> tag |
|
|
30
|
-
| iconLeft? | `UiIconName` | undefined | The name of the icon that should be rendered left of the link text |
|
|
31
|
-
| iconRight? | `UiIconName` | undefined | The name of the icon that should be rendered right of the link text |
|
|
32
|
-
| placement? | "onsurface" | "oncanvas"; | "onsurface" | The 'placement' of the link. Renders a higher contrast version if "oncanvas" is set |
|
|
33
|
-
| size? | "xsmall" | "small" | "medium"; | "medium" | The text size of the link, also affects icons size. |
|
|
34
|
-
| weight? | "regular" | "semibold"; | "regular" | The font weight of the link. |
|
|
35
|
-
| linkTarget? | string; | "_self" | Used to modify the a tag's target property if href is set. |
|
|
36
|
-
|
|
37
|
-
### Slots
|
|
38
|
-
|
|
39
|
-
| Name | Description |
|
|
40
|
-
| --------- | ---------------------------------------- |
|
|
41
|
-
| `default` | Default slot for text of the text button |
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, test } from "vitest";
|
|
3
|
-
|
|
4
|
-
import UiTextButton from "./UiTextButton.vue";
|
|
5
|
-
|
|
6
|
-
describe("UiTextButton", () => {
|
|
7
|
-
test("should render defaults", () => {
|
|
8
|
-
const wrapper = mount(UiTextButton);
|
|
9
|
-
expect(wrapper.classes("font-normal")).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test("should render semibold font-weight", () => {
|
|
13
|
-
const wrapper = mount(UiTextButton, {
|
|
14
|
-
props: {
|
|
15
|
-
weight: "semibold",
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
expect(wrapper.classes("font-semibold")).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("should render xsmall font-size", () => {
|
|
22
|
-
const wrapper = mount(UiTextButton, {
|
|
23
|
-
props: {
|
|
24
|
-
size: "xsmall",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
expect(wrapper.classes("text-xs")).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test("should render small font-size", () => {
|
|
31
|
-
const wrapper = mount(UiTextButton, {
|
|
32
|
-
props: {
|
|
33
|
-
size: "small",
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
expect(wrapper.classes("text-sm")).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("should render medium font-size", () => {
|
|
40
|
-
const wrapper = mount(UiTextButton, {
|
|
41
|
-
props: {
|
|
42
|
-
size: "medium",
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
expect(wrapper.classes("text-base")).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test("should render blue text color", () => {
|
|
49
|
-
const wrapper = mount(UiTextButton, {
|
|
50
|
-
props: {
|
|
51
|
-
color: "blue",
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
expect(wrapper.classes("text-primary")).toBe(true);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test("should render gray text color", () => {
|
|
58
|
-
const wrapper = mount(UiTextButton, {
|
|
59
|
-
props: {
|
|
60
|
-
color: "gray",
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
expect(wrapper.classes("text-neutral-subtle")).toBe(true);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test("should render iconLeft", () => {
|
|
67
|
-
const iconLeft = "alert";
|
|
68
|
-
const wrapper = mount(UiTextButton, {
|
|
69
|
-
props: {
|
|
70
|
-
iconLeft,
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
expect(wrapper.findComponent({ name: "UiIcon" }).props()).toMatchObject({
|
|
74
|
-
name: iconLeft,
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test("should render iconRight", () => {
|
|
79
|
-
const iconRight = "alert";
|
|
80
|
-
const wrapper = mount(UiTextButton, {
|
|
81
|
-
props: {
|
|
82
|
-
iconRight,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
expect(wrapper.findComponent({ name: "UiIcon" }).props()).toMatchObject({
|
|
86
|
-
name: iconRight,
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test("should change gray text color when placement is oncanvas", () => {
|
|
91
|
-
const wrapper = mount(UiTextButton, {
|
|
92
|
-
props: {
|
|
93
|
-
color: "gray",
|
|
94
|
-
placement: "oncanvas",
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
expect(wrapper.classes("text-neutral-emphasis")).toBe(true);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
-
|
|
3
|
-
import { icons } from "../UiIcon/icons.ts";
|
|
4
|
-
|
|
5
|
-
import UiTextButton from "./UiTextButton.vue";
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
tags: ["deprecated"],
|
|
9
|
-
title: "Ui/UiTextButton",
|
|
10
|
-
component: UiTextButton,
|
|
11
|
-
argTypes: {
|
|
12
|
-
color: {
|
|
13
|
-
control: "select",
|
|
14
|
-
options: ["blue", "gray"],
|
|
15
|
-
},
|
|
16
|
-
href: { control: "text" },
|
|
17
|
-
linkTarget: { control: "text" },
|
|
18
|
-
iconLeft: {
|
|
19
|
-
control: "select",
|
|
20
|
-
options: Object.keys(icons),
|
|
21
|
-
},
|
|
22
|
-
iconRight: {
|
|
23
|
-
control: "select",
|
|
24
|
-
options: Object.keys(icons),
|
|
25
|
-
},
|
|
26
|
-
placement: {
|
|
27
|
-
control: "select",
|
|
28
|
-
options: ["onsurface", "oncanvas"],
|
|
29
|
-
},
|
|
30
|
-
size: {
|
|
31
|
-
control: "select",
|
|
32
|
-
options: ["xsmall", "small", "medium"],
|
|
33
|
-
},
|
|
34
|
-
weight: {
|
|
35
|
-
control: "select",
|
|
36
|
-
options: ["regular", "semibold"],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
args: {
|
|
40
|
-
color: "blue",
|
|
41
|
-
href: undefined,
|
|
42
|
-
iconLeft: undefined,
|
|
43
|
-
iconRight: undefined,
|
|
44
|
-
placement: "onsurface",
|
|
45
|
-
size: "medium",
|
|
46
|
-
weight: "regular",
|
|
47
|
-
linkTarget: undefined,
|
|
48
|
-
},
|
|
49
|
-
} satisfies Meta<typeof UiTextButton>;
|
|
50
|
-
|
|
51
|
-
export default meta;
|
|
52
|
-
type Story = StoryObj<typeof meta>;
|
|
53
|
-
|
|
54
|
-
export const Default: Story = {
|
|
55
|
-
render: (args) => ({
|
|
56
|
-
setup() {
|
|
57
|
-
return { args };
|
|
58
|
-
},
|
|
59
|
-
components: { UiTextButton },
|
|
60
|
-
template: "<UiTextButton v-bind='args'>Link</UiTextButton>",
|
|
61
|
-
}),
|
|
62
|
-
};
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="tagName"
|
|
4
|
-
:href="href"
|
|
5
|
-
:class="classNames"
|
|
6
|
-
class="inline-flex items-center"
|
|
7
|
-
:target="target"
|
|
8
|
-
>
|
|
9
|
-
<UiIcon
|
|
10
|
-
v-if="iconLeft"
|
|
11
|
-
:class="iconLeftMarginClass"
|
|
12
|
-
:name="iconLeft"
|
|
13
|
-
:size="iconSize"
|
|
14
|
-
/>
|
|
15
|
-
<slot />
|
|
16
|
-
<UiIcon
|
|
17
|
-
v-if="iconRight"
|
|
18
|
-
:class="iconRightMarginClass"
|
|
19
|
-
:name="iconRight"
|
|
20
|
-
:size="iconSize"
|
|
21
|
-
/>
|
|
22
|
-
</component>
|
|
23
|
-
</template>
|
|
24
|
-
<script lang="ts">
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated
|
|
27
|
-
* Please replace with your own component
|
|
28
|
-
*/
|
|
29
|
-
export default {
|
|
30
|
-
name: "UiTextButton",
|
|
31
|
-
setup() {
|
|
32
|
-
onMounted(() => {
|
|
33
|
-
if (window.location.origin.includes("local")) {
|
|
34
|
-
// eslint-disable-next-line no-console
|
|
35
|
-
console.warn(
|
|
36
|
-
"Component is deprecated. It will be removed in a future update.",
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
</script>
|
|
43
|
-
<script setup lang="ts">
|
|
44
|
-
import { computed, onMounted } from "vue";
|
|
45
|
-
|
|
46
|
-
import UiIcon, { type UiIconName } from "../UiIcon/UiIcon.vue";
|
|
47
|
-
|
|
48
|
-
const props = withDefaults(
|
|
49
|
-
defineProps<{
|
|
50
|
-
color?: "blue" | "gray";
|
|
51
|
-
href?: string;
|
|
52
|
-
iconLeft?: UiIconName;
|
|
53
|
-
iconRight?: UiIconName;
|
|
54
|
-
placement?: "onsurface" | "oncanvas";
|
|
55
|
-
size?: "xsmall" | "small" | "medium";
|
|
56
|
-
weight?: "regular" | "semibold";
|
|
57
|
-
linkTarget?: string;
|
|
58
|
-
}>(),
|
|
59
|
-
{
|
|
60
|
-
color: "blue",
|
|
61
|
-
href: undefined,
|
|
62
|
-
iconLeft: undefined,
|
|
63
|
-
iconRight: undefined,
|
|
64
|
-
placement: "onsurface",
|
|
65
|
-
size: "medium",
|
|
66
|
-
weight: "regular",
|
|
67
|
-
linkTarget: "_self",
|
|
68
|
-
},
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const tagName = computed((): string => {
|
|
72
|
-
if (props.href?.length) {
|
|
73
|
-
return "a";
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return "button";
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const target = computed((): string => {
|
|
80
|
-
if (props.href?.length) {
|
|
81
|
-
return props.linkTarget;
|
|
82
|
-
}
|
|
83
|
-
return "";
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const weightClassName = computed((): string => {
|
|
87
|
-
let fontClass, hoverClass;
|
|
88
|
-
|
|
89
|
-
if (props.weight === "regular") {
|
|
90
|
-
fontClass = "font-normal";
|
|
91
|
-
hoverClass = "hover:underline";
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (props.weight === "semibold") {
|
|
95
|
-
fontClass = "font-semibold rounded-lg";
|
|
96
|
-
|
|
97
|
-
if (props.placement === "onsurface") {
|
|
98
|
-
hoverClass = "hover:bg-neutral-whisper";
|
|
99
|
-
} else if (props.placement === "oncanvas") {
|
|
100
|
-
hoverClass = "hover:bg-neutral-pale";
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return `${fontClass} ${hoverClass}`;
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const paddingClass = computed((): string => {
|
|
108
|
-
if (props.weight === "semibold") {
|
|
109
|
-
if (props.size === "medium") {
|
|
110
|
-
return "px-2 -mx-2";
|
|
111
|
-
} else if (props.size === "small" || props.size === "xsmall") {
|
|
112
|
-
return "px-1 -mx-1";
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return "";
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
const textClassName = computed((): string => {
|
|
119
|
-
if (props.size === "xsmall") {
|
|
120
|
-
return "text-xs";
|
|
121
|
-
} else if (props.size === "small") {
|
|
122
|
-
return "text-sm";
|
|
123
|
-
} else {
|
|
124
|
-
return "text-base";
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const colorClass = computed((): string => {
|
|
129
|
-
if (props.color === "blue") {
|
|
130
|
-
return "text-primary";
|
|
131
|
-
} else if (props.color === "gray") {
|
|
132
|
-
if (props.placement === "onsurface") {
|
|
133
|
-
return "text-neutral-subtle";
|
|
134
|
-
} else if (props.placement === "oncanvas") {
|
|
135
|
-
return "text-neutral-emphasis";
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return "";
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
const iconSize = computed((): "sm" | "md" => {
|
|
142
|
-
if (props.size === "xsmall") {
|
|
143
|
-
return "sm";
|
|
144
|
-
} else {
|
|
145
|
-
return "md";
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
const iconLeftMarginClass = computed((): string => {
|
|
150
|
-
if (props.size === "xsmall") {
|
|
151
|
-
return "mr-1";
|
|
152
|
-
} else {
|
|
153
|
-
return "mr-2";
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
const iconRightMarginClass = computed((): string => {
|
|
158
|
-
if (props.size === "xsmall") {
|
|
159
|
-
return "ml-1";
|
|
160
|
-
} else {
|
|
161
|
-
return "ml-2";
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
const classNames = computed((): string[] => {
|
|
166
|
-
return [
|
|
167
|
-
paddingClass.value,
|
|
168
|
-
textClassName.value,
|
|
169
|
-
weightClassName.value,
|
|
170
|
-
colorClass.value,
|
|
171
|
-
];
|
|
172
|
-
});
|
|
173
|
-
</script>
|