@dpa-id-components/dpa-shared-components 22.0.0-next.8 → 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/UiButton/UiButton.vue.d.ts +1 -1
- 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 +2 -2
- package/dist/components/index.d.ts +1 -18
- package/dist/dpa-shared-components.js +3109 -4830
- package/dist/eslint.base.config.js +1 -4
- package/dist/src/assets/icons/bot.vue +14 -0
- package/dist/src/components/UiButton/README.md +8 -8
- package/dist/src/components/UiButton/UiButton.stories.ts +1 -1
- package/dist/src/components/UiButton/UiButton.vue +11 -6
- 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 +12 -9
- 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 +87 -4
- package/dist/src/components/UiMenu/UiMenu.vue +16 -12
- package/dist/src/components/UiSearchBar/UiSearchBar.vue +1 -1
- 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 +21 -26
- package/src/assets/icons/bot.vue +14 -0
- package/src/components/UiButton/README.md +8 -8
- package/src/components/UiButton/UiButton.vue +11 -6
- package/src/components/UiChip/UiChip.vue +2 -2
- package/src/components/UiDatePicker/UiDatePicker.vue +12 -9
- 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 +16 -12
- package/src/components/UiSearchBar/UiSearchBar.vue +1 -1
- 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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M12 3C12.5523 3 13 3.44772 13 4V7H18C19.6569 7 21 8.34315 21 10V13H22C22.5523 13 23 13.4477 23 14C23 14.5523 22.5523 15 22 15H21V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V15H2C1.44772 15 1 14.5523 1 14C1 13.4477 1.44772 13 2 13H3V10C3 8.34315 4.34315 7 6 7H11V5H8C7.44772 5 7 4.55228 7 4C7 3.44772 7.44772 3 8 3H12ZM6 9C5.44772 9 5 9.44772 5 10V18C5 18.5523 5.44772 19 6 19H18C18.5523 19 19 18.5523 19 18V10C19 9.44772 18.5523 9 18 9H6ZM9 12C9.55228 12 10 12.4477 10 13V15C10 15.5523 9.55228 16 9 16C8.44772 16 8 15.5523 8 15V13C8 12.4477 8.44772 12 9 12ZM15 12C15.5523 12 16 12.4477 16 13V15C16 15.5523 15.5523 16 15 16C14.4477 16 14 15.5523 14 15V13C14 12.4477 14.4477 12 15 12Z"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
</template>
|
|
@@ -40,15 +40,15 @@ import { UiButton } from "@dpa-id-components/dpa-shared-components";
|
|
|
40
40
|
|
|
41
41
|
### Props
|
|
42
42
|
|
|
43
|
-
| Name
|
|
44
|
-
|
|
45
|
-
| `to`
|
|
46
|
-
| `size`
|
|
47
|
-
| `appearance` | `"
|
|
48
|
-
| `disabled`
|
|
43
|
+
| Name | Type | Default | Description |
|
|
44
|
+
|--------------|--------------------------------------------------------------------------------------------|-------------|----------------------------------|
|
|
45
|
+
| `to` | `RouteLocationRaw` | `undefined` | `RouterLink` `to` prop |
|
|
46
|
+
| `size` | `"xs"`, `"sm"`, `"md"`, or `"lg"` | `"md"` | |
|
|
47
|
+
| `appearance` | `"fill-emphasis"`, `"fill-subtle"`, `"outline-emphasis"`, `"outline-subtle"`, or `"ghost"` | `"primary"` | |
|
|
48
|
+
| `disabled` | `boolean` | `false` | Whether the `button` is disabled |
|
|
49
49
|
|
|
50
50
|
### Slots
|
|
51
51
|
|
|
52
|
-
| Name | Description
|
|
53
|
-
|
|
52
|
+
| Name | Description |
|
|
53
|
+
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
54
54
|
| `default` | Button content. Note, that text nodes are wrapped in a `span` element to ensure they can be detected using the CSS selectors responsible for applying icon-only-specific styles. |
|
|
@@ -42,12 +42,17 @@ defineSlots<{
|
|
|
42
42
|
const {
|
|
43
43
|
to = undefined,
|
|
44
44
|
size = "md",
|
|
45
|
-
appearance = "
|
|
45
|
+
appearance = "fill-emphasis",
|
|
46
46
|
disabled = false,
|
|
47
47
|
} = defineProps<{
|
|
48
48
|
to?: RouteLocationRaw;
|
|
49
49
|
size?: keyof typeof BUTTON_SIZE_CLASSES;
|
|
50
|
-
appearance?:
|
|
50
|
+
appearance?:
|
|
51
|
+
| "fill-emphasis"
|
|
52
|
+
| "fill-subtle"
|
|
53
|
+
| "outline-emphasis"
|
|
54
|
+
| "outline-subtle"
|
|
55
|
+
| "ghost";
|
|
51
56
|
disabled?: boolean;
|
|
52
57
|
}>();
|
|
53
58
|
|
|
@@ -69,13 +74,13 @@ const attributes = computed(() => {
|
|
|
69
74
|
const appearanceClasses = computed(
|
|
70
75
|
() =>
|
|
71
76
|
({
|
|
72
|
-
|
|
77
|
+
"fill-emphasis":
|
|
73
78
|
"border-transparent bg-primary text-neutral not-disabled:hover:bg-primary-hover disabled:bg-neutral-faint disabled:text-neutral-soft",
|
|
74
|
-
|
|
79
|
+
"outline-emphasis":
|
|
75
80
|
"border-neutral-faint bg-transparent text-primary-emphasis not-disabled:hover:border-neutral-subtle not-disabled:hover:text-primary-hover disabled:text-neutral-faint",
|
|
76
|
-
"
|
|
81
|
+
"outline-subtle":
|
|
77
82
|
"border-neutral-faint bg-transparent text-neutral-emphasis not-disabled:hover:border-neutral-subtle not-disabled:hover:text-neutral-primary disabled:text-neutral-faint",
|
|
78
|
-
|
|
83
|
+
"fill-subtle":
|
|
79
84
|
"border-transparent bg-neutral-subtle text-neutral not-disabled:hover:bg-neutral-emphasis disabled:bg-neutral-faint disabled:text-neutral-soft",
|
|
80
85
|
ghost:
|
|
81
86
|
"border-transparent bg-transparent text-neutral-emphasis not-disabled:hover:border-neutral-subtle not-disabled:hover:text-neutral-primary disabled:text-neutral-faint",
|
|
@@ -6,7 +6,7 @@ import UiChip from "./UiChip.vue";
|
|
|
6
6
|
describe("UiChip", () => {
|
|
7
7
|
test("renders sm size by default", () => {
|
|
8
8
|
const wrapper = mount(UiChip);
|
|
9
|
-
expect(wrapper.classes("text-sm/
|
|
9
|
+
expect(wrapper.classes("text-sm/6")).toBe(true);
|
|
10
10
|
});
|
|
11
11
|
test("renders md size", () => {
|
|
12
12
|
const wrapper = mount(UiChip, {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
'w-full min-w-0': triggerWidth === 'full',
|
|
71
71
|
'flex-none': triggerWidth === 'fit',
|
|
72
72
|
}"
|
|
73
|
-
:appearance="value ? '
|
|
73
|
+
:appearance="value ? 'fill-emphasis' : 'outline-subtle'"
|
|
74
74
|
:disabled
|
|
75
75
|
size="sm"
|
|
76
76
|
data-testid="datepicker-trigger"
|
|
@@ -152,10 +152,7 @@ export interface PresetRange {
|
|
|
152
152
|
name?: string;
|
|
153
153
|
}
|
|
154
154
|
export type DateType =
|
|
155
|
-
| Date
|
|
156
|
-
| [Date, Date]
|
|
157
|
-
| string
|
|
158
|
-
| { month: number; year: number };
|
|
155
|
+
Date | [Date, Date] | string | { month: number; year: number };
|
|
159
156
|
|
|
160
157
|
const datePicker =
|
|
161
158
|
useTemplateRef<InstanceType<typeof VueDatePicker>>("datePicker");
|
|
@@ -405,11 +402,17 @@ function formatInput(date: Date | [Date, Date]): string {
|
|
|
405
402
|
--dp-hover-icon-color: var(--color-neutral);
|
|
406
403
|
--dp-primary-disabled-color: var(--color-neutral-soft);
|
|
407
404
|
--dp-primary-text-color: var(--color-neutral);
|
|
408
|
-
--dp-secondary-color:
|
|
405
|
+
--dp-secondary-color: oklch(0.82 0.012 264.559);
|
|
409
406
|
--dp-border-color: var(--color-neutral-pale);
|
|
410
407
|
--dp-menu-border-color: var(--color-neutral-pale);
|
|
411
|
-
--dp-range-between-dates-background-color: var(
|
|
412
|
-
|
|
413
|
-
|
|
408
|
+
--dp-range-between-dates-background-color: var(
|
|
409
|
+
--dp-hover-color,
|
|
410
|
+
oklch(0.964 0 0)
|
|
411
|
+
);
|
|
412
|
+
--dp-range-between-dates-text-color: var(
|
|
413
|
+
--dp-hover-text-color,
|
|
414
|
+
var(--color-neutral-primary)
|
|
415
|
+
);
|
|
416
|
+
--dp-range-between-border-color: var(--dp-hover-color, oklch(0.964 0 0));
|
|
414
417
|
}
|
|
415
418
|
</style>
|
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
>
|
|
14
14
|
<header
|
|
15
15
|
v-if="$slots.header || hasCloseButton"
|
|
16
|
-
class="flex flex-wrap items-center justify-between gap-4 rounded-t-2xl bg-neutral-whisper
|
|
16
|
+
class="flex flex-wrap items-center justify-between gap-4 rounded-t-2xl bg-neutral-whisper py-2 pr-2 pl-4"
|
|
17
17
|
>
|
|
18
|
-
<div
|
|
18
|
+
<div
|
|
19
|
+
v-if="$slots.header"
|
|
20
|
+
class="text-lg font-medium text-neutral-primary"
|
|
21
|
+
>
|
|
19
22
|
<slot name="header" v-bind="{ close, requestClose }" />
|
|
20
23
|
</div>
|
|
21
24
|
|
|
@@ -31,13 +34,13 @@
|
|
|
31
34
|
</UiButton>
|
|
32
35
|
</header>
|
|
33
36
|
|
|
34
|
-
<div v-if="$slots.default" class="space-y-2
|
|
37
|
+
<div v-if="$slots.default" class="space-y-2 p-6">
|
|
35
38
|
<slot />
|
|
36
39
|
</div>
|
|
37
40
|
|
|
38
41
|
<footer
|
|
39
42
|
v-if="$slots.footer"
|
|
40
|
-
class="flex flex-wrap items-center justify-between gap-2 px-4
|
|
43
|
+
class="flex flex-wrap items-center justify-between gap-2 px-4 pt-2 pb-4"
|
|
41
44
|
>
|
|
42
45
|
<slot name="footer" v-bind="{ close, requestClose }" />
|
|
43
46
|
</footer>
|
|
@@ -98,7 +101,7 @@ defineExpose({
|
|
|
98
101
|
@media (prefers-reduced-motion: no-preference) {
|
|
99
102
|
/* Backdrop */
|
|
100
103
|
.animate::backdrop {
|
|
101
|
-
background:
|
|
104
|
+
background: oklch(0 0 0 / 0);
|
|
102
105
|
transition:
|
|
103
106
|
background 0.3s ease,
|
|
104
107
|
display 0.2s ease allow-discrete,
|
|
@@ -106,10 +109,10 @@ defineExpose({
|
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
.animate[open]::backdrop {
|
|
109
|
-
background:
|
|
112
|
+
background: oklch(0 0 0 / 0.5);
|
|
110
113
|
|
|
111
114
|
@starting-style {
|
|
112
|
-
background:
|
|
115
|
+
background: oklch(0 0 0 / 0);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
2
|
|
|
3
|
-
import UiIconButton from "../UiIconButton/UiIconButton.vue";
|
|
4
|
-
|
|
5
3
|
import UiFilterBadge from "./UiFilterBadge.vue";
|
|
6
4
|
|
|
7
5
|
const meta = {
|
|
@@ -17,7 +15,7 @@ const meta = {
|
|
|
17
15
|
setup() {
|
|
18
16
|
return { args };
|
|
19
17
|
},
|
|
20
|
-
components: { UiFilterBadge
|
|
18
|
+
components: { UiFilterBadge },
|
|
21
19
|
template: "<UiFilterBadge v-bind='args'> slot </UiFilterBadge>",
|
|
22
20
|
}),
|
|
23
21
|
} satisfies Meta<typeof UiFilterBadge>;
|
|
@@ -25,6 +25,7 @@ export const icons = {
|
|
|
25
25
|
"book": () => import("../../assets/icons/book.vue"),
|
|
26
26
|
"bookmark": () => import("../../assets/icons/bookmark.vue"),
|
|
27
27
|
"bookmark-filled": () => import("../../assets/icons/bookmark-filled.vue"),
|
|
28
|
+
"bot": () => import('../../assets/icons/bot.vue'),
|
|
28
29
|
"box": () => import("../../assets/icons/box.vue"),
|
|
29
30
|
"bulb": () => import("../../assets/icons/bulb.vue"),
|
|
30
31
|
"call": () => import("../../assets/icons/call.vue"),
|
|
@@ -19,18 +19,19 @@
|
|
|
19
19
|
|
|
20
20
|
### Props
|
|
21
21
|
|
|
22
|
-
| Name | Type | Default | Description
|
|
23
|
-
|
|
24
|
-
| `value` | `string` | `""` | Sets the value which gets emitted with the click event
|
|
25
|
-
| `checkBoxMenu` | `Boolean` | `false` | Displays checkbox on the beginning of list item
|
|
26
|
-
| `isChecked` | `Boolean` | `false` | Checked attribute of checkbox, if displayed
|
|
27
|
-
| `selectable` | `Boolean` | `false` | Makes the list item selectable
|
|
28
|
-
| `selected` | `Boolean` | `false` | Displays checkmark at the end of the list item
|
|
29
|
-
| `overrideClasses` | `String` | `false` | Adds classes to the inner of the list item
|
|
30
|
-
| `iconName` | `UiIconName` | | Icon to be displayed at the beginning of the list item
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
22
|
+
| Name | Type | Default | Description |
|
|
23
|
+
|-------------------|-----------------------------|------------|---------------------------------------------------------------------|
|
|
24
|
+
| `value` | `string` | `""` | Sets the value which gets emitted with the click event |
|
|
25
|
+
| `checkBoxMenu` | `Boolean` | `false` | Displays checkbox on the beginning of list item |
|
|
26
|
+
| `isChecked` | `Boolean` | `false` | Checked attribute of checkbox, if displayed |
|
|
27
|
+
| `selectable` | `Boolean` | `false` | Makes the list item selectable |
|
|
28
|
+
| `selected` | `Boolean` | `false` | Displays checkmark at the end of the list item |
|
|
29
|
+
| `overrideClasses` | `String` | `false` | Adds classes to the inner of the list item |
|
|
30
|
+
| `iconName` | `UiIconName` | | Icon to be displayed at the beginning of the list item |
|
|
31
|
+
| `iconSize` | `sm` `md` `lg` | | Size of the checkmark icon when selected and selectable is set true |
|
|
32
|
+
| `imageSrc` | `String` | `""` | Image to be displayed at the beginning of the list item. |
|
|
33
|
+
| `imageShape` | `"rounded" | "square"` | `"square"` | Shape pf the image to be displayed. |
|
|
34
|
+
| `checkboxColor` | `"blue" | "gray"` | `"blue"` | Checkbox color style. |
|
|
34
35
|
|
|
35
36
|
### Events
|
|
36
37
|
|
|
@@ -1,36 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
2
|
|
|
3
|
-
import { icons } from "../UiIcon/icons.ts";
|
|
4
|
-
|
|
5
3
|
import UiListItem from "./UiListItem.vue";
|
|
6
4
|
|
|
7
5
|
const meta = {
|
|
8
6
|
title: "Ui/UiListItem",
|
|
9
7
|
component: UiListItem,
|
|
10
|
-
argTypes: {
|
|
11
|
-
iconName: {
|
|
12
|
-
control: "select",
|
|
13
|
-
options: Object.keys(icons),
|
|
14
|
-
},
|
|
15
|
-
iconSize: {
|
|
16
|
-
control: "select",
|
|
17
|
-
options: ["small", "medium", "large"],
|
|
18
|
-
},
|
|
19
|
-
imageSrc: {
|
|
20
|
-
control: "text",
|
|
21
|
-
},
|
|
22
|
-
imageShape: {
|
|
23
|
-
control: "select",
|
|
24
|
-
options: ["rounded", "square"],
|
|
25
|
-
},
|
|
26
|
-
value: { control: false },
|
|
27
|
-
checkBoxMenu: { control: "boolean" },
|
|
28
|
-
isChecked: { control: "boolean" },
|
|
29
|
-
selected: { control: "boolean" },
|
|
30
|
-
selectable: { control: "boolean" },
|
|
31
|
-
disabled: { control: "boolean" },
|
|
32
|
-
overrideClasses: { control: "text" },
|
|
33
|
-
},
|
|
34
8
|
args: {
|
|
35
9
|
iconName: undefined,
|
|
36
10
|
iconSize: "md",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<li
|
|
3
3
|
:class="
|
|
4
4
|
cn(
|
|
5
|
-
'flex cursor-pointer list-none items-center gap-2
|
|
5
|
+
'flex cursor-pointer list-none items-center gap-2 p-2 text-sm/4 text-neutral-primary select-none hover:bg-neutral-whisper hover:text-primary focus:bg-neutral-faint focus:outline-hidden focus-visible:focus-outline focus-visible:-outline-offset-2',
|
|
6
6
|
{
|
|
7
7
|
'cursor-default text-neutral-medium': disabled,
|
|
8
8
|
'is-selected': selected,
|
|
@@ -31,7 +31,7 @@ const meta = {
|
|
|
31
31
|
disabled: false,
|
|
32
32
|
active: false,
|
|
33
33
|
iconLeft: undefined,
|
|
34
|
-
buttonAppearance: "
|
|
34
|
+
buttonAppearance: "outline-subtle",
|
|
35
35
|
filterButtonSize: undefined,
|
|
36
36
|
defaultTitle: "Default Title",
|
|
37
37
|
multiLabel: "selected options",
|
|
@@ -57,6 +57,9 @@ export default meta;
|
|
|
57
57
|
type Story = StoryObj<typeof meta>;
|
|
58
58
|
|
|
59
59
|
export const Default: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
buttonAppearance: "fill-emphasis",
|
|
62
|
+
},
|
|
60
63
|
render: (args) => ({
|
|
61
64
|
setup() {
|
|
62
65
|
const options = ref<UiMenuOptionType<string>[]>([
|
|
@@ -111,7 +114,7 @@ export const Default: Story = {
|
|
|
111
114
|
},
|
|
112
115
|
components: { UiMenu },
|
|
113
116
|
template: /*html*/ `
|
|
114
|
-
<aside
|
|
117
|
+
<aside>
|
|
115
118
|
<UiMenu
|
|
116
119
|
v-bind="args"
|
|
117
120
|
v-model:query="args.query"
|
|
@@ -128,13 +131,94 @@ export const Default: Story = {
|
|
|
128
131
|
}),
|
|
129
132
|
};
|
|
130
133
|
|
|
134
|
+
export const WidthOverride: Story = {
|
|
135
|
+
args: {
|
|
136
|
+
buttonAppearance: "fill-emphasis",
|
|
137
|
+
},
|
|
138
|
+
render: (args) => ({
|
|
139
|
+
setup() {
|
|
140
|
+
const options = ref<UiMenuOptionType<string>[]>([
|
|
141
|
+
{
|
|
142
|
+
label: "Option 1",
|
|
143
|
+
value: "value 1",
|
|
144
|
+
selected: true,
|
|
145
|
+
iconName: "info",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: "Option 2 is really long, much longer than the rest",
|
|
149
|
+
value: "value 2",
|
|
150
|
+
selected: false,
|
|
151
|
+
iconName: "alert",
|
|
152
|
+
hasDividerAbove: true,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: "Option 3",
|
|
156
|
+
value: "value 3",
|
|
157
|
+
selected: false,
|
|
158
|
+
iconName: "bulb",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: "Option 4",
|
|
162
|
+
value: "value 4",
|
|
163
|
+
selected: false,
|
|
164
|
+
iconName: "language",
|
|
165
|
+
},
|
|
166
|
+
]);
|
|
167
|
+
const filteredOptions = ref(Array.from(options.value));
|
|
168
|
+
|
|
169
|
+
const onSelect = (selectedOption: UiMenuSelectedOption<string>) => {
|
|
170
|
+
for (const option of filteredOptions.value) {
|
|
171
|
+
option.selected =
|
|
172
|
+
option.value === selectedOption.value ? true : false;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const onUpdateQuery = (value: string) => {
|
|
177
|
+
filteredOptions.value = options.value.filter((option) =>
|
|
178
|
+
option.label.toLowerCase().includes(value.toLowerCase()),
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
args,
|
|
184
|
+
onSelect,
|
|
185
|
+
onUpdateQuery,
|
|
186
|
+
filteredOptions,
|
|
187
|
+
options,
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
components: { UiMenu },
|
|
191
|
+
template: /*html*/ `
|
|
192
|
+
<aside class="w-70 h-200 p-4 bg-neutral-pale space-y-4">
|
|
193
|
+
<UiMenu
|
|
194
|
+
class="w-full"
|
|
195
|
+
v-bind="args"
|
|
196
|
+
v-model:query="args.query"
|
|
197
|
+
:options="filteredOptions"
|
|
198
|
+
@option-selected="(option)=> { onSelect(option); optionSelected(option); }"
|
|
199
|
+
@update:query="(value) => { onUpdateQuery(value); updateQuery(value); }"
|
|
200
|
+
/>
|
|
201
|
+
<UiMenu
|
|
202
|
+
class="w-full"
|
|
203
|
+
v-bind="args"
|
|
204
|
+
:disabled="true"
|
|
205
|
+
/>
|
|
206
|
+
</aside>
|
|
207
|
+
`,
|
|
208
|
+
methods: {
|
|
209
|
+
optionSelected: action("option-selected"),
|
|
210
|
+
updateQuery: action("update:query"),
|
|
211
|
+
},
|
|
212
|
+
}),
|
|
213
|
+
};
|
|
214
|
+
|
|
131
215
|
export const GroupedOptions: Story = {
|
|
132
216
|
args: {
|
|
133
217
|
hasResetOption: true,
|
|
134
218
|
hasSearch: true,
|
|
135
219
|
resetLabel: "Zurücksetzen",
|
|
136
220
|
searchPlaceholder: "Suchen",
|
|
137
|
-
buttonAppearance: "
|
|
221
|
+
buttonAppearance: "outline-subtle",
|
|
138
222
|
listVariant: "checkbox",
|
|
139
223
|
defaultTitle: "Optionen",
|
|
140
224
|
hasAutoFocus: true,
|
|
@@ -251,7 +335,6 @@ export const GroupedOptions: Story = {
|
|
|
251
335
|
v-bind="args"
|
|
252
336
|
v-model:query="args.query"
|
|
253
337
|
:grouped-options="filteredOptions"
|
|
254
|
-
has-search
|
|
255
338
|
@option-selected="(option)=> { onSelect(option); optionSelected(option); }"
|
|
256
339
|
@update:query="(value) => { onUpdateQuery(value); updateQuery(value); }"
|
|
257
340
|
/>
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
:class="{
|
|
12
12
|
'border-neutral-subtle': isPopoverOpen,
|
|
13
13
|
}"
|
|
14
|
-
:appearance="active ? '
|
|
14
|
+
:appearance="active ? 'fill-emphasis' : buttonAppearance"
|
|
15
15
|
:disabled
|
|
16
16
|
:size="filterButtonSize"
|
|
17
17
|
data-testid="menu-button"
|
|
18
18
|
@click="toggle"
|
|
19
19
|
>
|
|
20
|
-
<div class="flex items-center gap-2">
|
|
21
|
-
<UiIcon v-if="iconLeft" :name="iconLeft" size="sm" />
|
|
22
|
-
{{ selectedOptionLabel }}
|
|
20
|
+
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
|
21
|
+
<UiIcon v-if="iconLeft" class="shrink-0" :name="iconLeft" size="sm" />
|
|
22
|
+
<span class="truncate">{{ selectedOptionLabel }}</span>
|
|
23
23
|
</div>
|
|
24
|
-
<UiIcon name="chevron-down" size="sm" />
|
|
24
|
+
<UiIcon class="shrink-0" name="chevron-down" size="sm" />
|
|
25
25
|
</UiButton>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
>
|
|
31
31
|
<div
|
|
32
32
|
v-if="hasSearch"
|
|
33
|
-
class="flex items-center gap-2 rounded-t-lg
|
|
33
|
+
class="flex items-center gap-2 rounded-t-lg p-2 text-neutral-primary [&:has(>input:focus-visible)]:focus-outline [&:has(>input:focus-visible)]:-outline-offset-2"
|
|
34
34
|
>
|
|
35
35
|
<UiIcon
|
|
36
36
|
class="shrink-0 text-neutral-emphasis"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
v-model="queryModel"
|
|
43
43
|
type="text"
|
|
44
44
|
spellcheck="false"
|
|
45
|
-
class="w-full text-sm focus:outline-hidden"
|
|
45
|
+
class="w-full text-sm/4 focus:outline-hidden"
|
|
46
46
|
:placeholder="searchPlaceholder"
|
|
47
47
|
data-testid="menu-search-input"
|
|
48
48
|
/>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
<template v-if="group.options.length > 0">
|
|
71
71
|
<li
|
|
72
72
|
v-if="group.groupLabel"
|
|
73
|
-
class="flex h-6 items-center bg-neutral-faint px-
|
|
73
|
+
class="flex h-6 items-center bg-neutral-faint px-2 text-xs font-semibold tracking-wider text-neutral-subtle uppercase"
|
|
74
74
|
>
|
|
75
75
|
{{ group.groupLabel }}
|
|
76
76
|
</li>
|
|
@@ -87,7 +87,6 @@
|
|
|
87
87
|
:image-src="option.imageSrc"
|
|
88
88
|
:icon-name="option.iconName"
|
|
89
89
|
:checkbox-appearance="checkboxAppearance"
|
|
90
|
-
class="hover:bg-neutral-whisper focus:bg-neutral-faint"
|
|
91
90
|
:class="{
|
|
92
91
|
'border-t': option.hasDividerAbove,
|
|
93
92
|
}"
|
|
@@ -102,7 +101,7 @@
|
|
|
102
101
|
|
|
103
102
|
<div v-if="hasResetOption" class="px-2 pt-1.5 pb-2 text-neutral-primary">
|
|
104
103
|
<UiButton
|
|
105
|
-
appearance="
|
|
104
|
+
appearance="outline-emphasis"
|
|
106
105
|
:disabled="disabledReset"
|
|
107
106
|
icon-name="reset"
|
|
108
107
|
size="xs"
|
|
@@ -173,7 +172,7 @@ const {
|
|
|
173
172
|
disabled = false,
|
|
174
173
|
active = false,
|
|
175
174
|
iconLeft = null,
|
|
176
|
-
buttonAppearance = "
|
|
175
|
+
buttonAppearance = "outline-subtle",
|
|
177
176
|
filterButtonSize = "sm",
|
|
178
177
|
defaultTitle = "",
|
|
179
178
|
multiLabel = "",
|
|
@@ -202,7 +201,12 @@ const {
|
|
|
202
201
|
disabled?: boolean;
|
|
203
202
|
active?: boolean;
|
|
204
203
|
iconLeft?: UiIconName;
|
|
205
|
-
buttonAppearance?:
|
|
204
|
+
buttonAppearance?:
|
|
205
|
+
| "fill-emphasis"
|
|
206
|
+
| "fill-subtle"
|
|
207
|
+
| "outline-emphasis"
|
|
208
|
+
| "outline-subtle"
|
|
209
|
+
| "ghost";
|
|
206
210
|
filterButtonSize?: "sm" | "xs";
|
|
207
211
|
defaultTitle?: string;
|
|
208
212
|
multiLabel?: string;
|