@dpa-id-components/dpa-shared-components 23.0.0 → 23.1.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/package.json +7 -7
- package/src/components/UiBadge/README.md +0 -15
- package/src/components/UiBadge/UiBadge.vue +14 -0
- package/src/components/UiButton/README.md +3 -18
- package/src/components/UiButton/UiButton.vue +13 -0
- package/src/components/UiCheckbox/README.md +2 -24
- package/src/components/UiCheckbox/UiCheckbox.vue +11 -0
- package/src/components/UiChip/README.md +0 -21
- package/src/components/UiChip/UiChip.vue +13 -0
- package/src/components/UiColorPicker/README.md +1 -15
- package/src/components/UiColorPicker/UiColorPicker.vue +4 -0
- package/src/components/UiDatePicker/README.md +5 -57
- package/src/components/UiDatePicker/UiDatePicker.vue +117 -0
- package/src/components/UiDialog/README.md +2 -27
- package/src/components/UiDialog/UiDialog.vue +32 -0
- package/src/components/UiFilterBadge/README.md +2 -17
- package/src/components/UiFilterBadge/UiFilterBadge.vue +23 -0
- package/src/components/UiIcon/README.md +2 -18
- package/src/components/UiIcon/UiIcon.vue +10 -0
- package/src/components/UiInfoContent/README.md +2 -17
- package/src/components/UiInfoContent/UiInfoContent.vue +22 -0
- package/src/components/UiInput/README.md +4 -32
- package/src/components/UiInput/UiInput.vue +25 -1
- package/src/components/UiLabel/README.md +2 -2
- package/src/components/UiListItem/README.md +0 -30
- package/src/components/UiListItem/UiListItem.vue +56 -0
- package/src/components/UiMediaTypeIcon/README.md +1 -10
- package/src/components/UiMediaTypeIcon/UiMediaTypeIcon.vue +7 -0
- package/src/components/UiMenu/README.md +4 -51
- package/src/components/UiMenu/UiMenu.vue +112 -0
- package/src/components/UiPopover/README.md +1 -34
- package/src/components/UiPopover/UiPopover.vue +20 -1
- package/src/components/UiRadioButton/README.md +1 -23
- package/src/components/UiRadioButton/UiRadioButton.vue +11 -0
- package/src/components/UiSearchBar/README.md +0 -29
- package/src/components/UiSearchBar/UiSearchBar.vue +42 -0
- package/src/components/UiSearchInput/README.md +1 -23
- package/src/components/UiSearchInput/UiSearchInput.vue +31 -0
- package/src/components/UiSelect/README.md +2 -28
- package/src/components/UiSelect/UiSelect.vue +7 -1
- package/src/components/UiSkeletonBox/README.md +0 -14
- package/src/components/UiSkeletonBox/UiSkeletonBox.vue +12 -0
- package/src/components/UiSnackbar/README.md +0 -26
- package/src/components/UiSnackbar/UiSnackbar.vue +38 -0
- package/src/components/UiSpinner/README.md +0 -14
- package/src/components/UiSpinner/UiSpinner.vue +9 -0
- package/src/components/UiTShirtSizeIcon/README.md +13 -0
- package/src/components/UiTShirtSizeIcon/UiTShirtSizeIcon.vue +42 -0
- package/src/components/UiTShirtSizeIcon/UiTShirtSizeIconLoading.vue +8 -0
- package/src/components/UiTShirtSizeIcon/icons/l.vue +18 -0
- package/src/components/UiTShirtSizeIcon/icons/m.vue +18 -0
- package/src/components/UiTShirtSizeIcon/icons/xl.vue +18 -0
- package/src/components/UiTShirtSizeIcon/icons.ts +5 -0
- package/src/components/UiToggleButton/README.md +0 -26
- package/src/components/UiToggleButton/UiToggleButton.vue +16 -0
- package/src/components/UiTooltip/README.md +1 -26
- package/src/components/UiTooltip/UiTooltip.vue +32 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dpa-id-components/dpa-shared-components",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.1.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": "dpa Deutsche Presse-Agentur GmbH",
|
|
6
6
|
"description": "Shared Vue component library for dpa projects",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"devEngines": {
|
|
26
26
|
"runtime": {
|
|
27
27
|
"name": "node",
|
|
28
|
-
"version": "24.
|
|
28
|
+
"version": "24.21.0"
|
|
29
29
|
},
|
|
30
30
|
"packageManager": {
|
|
31
31
|
"name": "pnpm",
|
|
32
|
-
"version": "11.
|
|
32
|
+
"version": "11.26.0",
|
|
33
33
|
"onFail": "download"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@tailwindcss/vite": "4.3.3",
|
|
42
42
|
"@tsconfig/node24": "24.0.5",
|
|
43
43
|
"@types/jsdom": "30.0.0",
|
|
44
|
-
"@types/node": "25.9.
|
|
44
|
+
"@types/node": "25.9.6",
|
|
45
45
|
"@vitejs/plugin-vue": "6.0.8",
|
|
46
46
|
"@vue/test-utils": "2.5.0",
|
|
47
47
|
"@vue/tsconfig": "0.9.1",
|
|
48
48
|
"ajv": "8.20.0",
|
|
49
|
-
"commit-and-tag-version": "13.
|
|
50
|
-
"eslint": "10.
|
|
49
|
+
"commit-and-tag-version": "13.2.0",
|
|
50
|
+
"eslint": "10.10.0",
|
|
51
51
|
"eslint-plugin-storybook": "10.6.0",
|
|
52
52
|
"husky": "9.1.7",
|
|
53
53
|
"jsdom": "30.0.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"storybook": "10.6.0",
|
|
58
58
|
"tailwindcss": "4.3.3",
|
|
59
59
|
"typescript": "6.0.3",
|
|
60
|
-
"vite": "8.
|
|
60
|
+
"vite": "8.3.0",
|
|
61
61
|
"vitest": "5.0.0",
|
|
62
62
|
"vue": "3.5.42",
|
|
63
63
|
"vue-router": "5.3.1",
|
|
@@ -12,18 +12,3 @@
|
|
|
12
12
|
import { UiBadge } from "@dpa-id-components/dpa-shared-components";
|
|
13
13
|
</script>
|
|
14
14
|
```
|
|
15
|
-
|
|
16
|
-
## API
|
|
17
|
-
|
|
18
|
-
### Props
|
|
19
|
-
|
|
20
|
-
| Name | Type | Default | Description |
|
|
21
|
-
|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|------------------------------------------------------------------------|
|
|
22
|
-
| `appearance` | `"accent-red" \| "accent-red-dark" \| "accent-orange" \| "accent-purple" \| "accent-green" \| "primary" \| "neutral-primary" \| "neutral-emphasis" \| "neutral-medium" \| "neutral-faint"` | `"accent-red"` | Color variant of the badge |
|
|
23
|
-
| `iconName` | `UiIconName` | `undefined` | Optional icon displayed to the left of the text |
|
|
24
|
-
|
|
25
|
-
### Slots
|
|
26
|
-
|
|
27
|
-
| Name | Description |
|
|
28
|
-
|-----------|--------------------------------------------|
|
|
29
|
-
| `default` | Slot for the rendering the badge's content |
|
|
@@ -14,6 +14,10 @@ import { computed } from "vue";
|
|
|
14
14
|
import UiIcon, { type UiIconName } from "../UiIcon/UiIcon.vue";
|
|
15
15
|
|
|
16
16
|
const { appearance = "accent-red", iconName = undefined } = defineProps<{
|
|
17
|
+
/**
|
|
18
|
+
* The color variant of the badge.
|
|
19
|
+
* @default "accent-red"
|
|
20
|
+
*/
|
|
17
21
|
appearance?:
|
|
18
22
|
| "accent-red"
|
|
19
23
|
| "accent-orange"
|
|
@@ -23,9 +27,19 @@ const { appearance = "accent-red", iconName = undefined } = defineProps<{
|
|
|
23
27
|
| "neutral-primary"
|
|
24
28
|
| "neutral-medium"
|
|
25
29
|
| "neutral-faint";
|
|
30
|
+
/**
|
|
31
|
+
* The name of an icon to show to the left of the badge content.
|
|
32
|
+
*/
|
|
26
33
|
iconName?: UiIconName;
|
|
27
34
|
}>();
|
|
28
35
|
|
|
36
|
+
defineSlots<{
|
|
37
|
+
/**
|
|
38
|
+
* The content of the badge.
|
|
39
|
+
*/
|
|
40
|
+
default: () => any;
|
|
41
|
+
}>();
|
|
42
|
+
|
|
29
43
|
const colorClass = computed(() => {
|
|
30
44
|
return {
|
|
31
45
|
"accent-red": "bg-accent-red text-neutral",
|
|
@@ -6,7 +6,9 @@ This component transparently wraps `RouterLink` and `button` and toggles between
|
|
|
6
6
|
|
|
7
7
|
**Important**: Always implement direct navigation interactions using the `to` prop rather than attaching a `click` event listener to `UiButton` to ensure a properly accessible and usable link is created.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
This component binds all non-prop attributes on its principal element (either a `button` or an `a` element). This allows you to add arbitrary HTML attributes (and event listeners) on the principal element without them being explicitly supported by the component.
|
|
10
|
+
|
|
11
|
+
```html
|
|
10
12
|
<template>
|
|
11
13
|
<UiButton size="lg" appearance="secondary" @click="save">
|
|
12
14
|
Save
|
|
@@ -35,20 +37,3 @@ This component transparently wraps `RouterLink` and `button` and toggles between
|
|
|
35
37
|
import { UiButton } from "@dpa-id-components/dpa-shared-components";
|
|
36
38
|
</script>
|
|
37
39
|
```
|
|
38
|
-
|
|
39
|
-
## API
|
|
40
|
-
|
|
41
|
-
### Props
|
|
42
|
-
Note: This component binds all non-prop attributes on its principal element (either a button or a element). This allows you to add arbitrary HTML attributes (and event listeners) on the principal element without them being explicitly supported by the component.
|
|
43
|
-
|
|
44
|
-
| Name | Type | Default | Description |
|
|
45
|
-
|--------------|--------------------------------------------------------------------------------------------|-------------|----------------------------------|
|
|
46
|
-
| `to` | `RouteLocationRaw` | `undefined` | `RouterLink` `to` prop |
|
|
47
|
-
| `size` | `"xs"`, `"sm"`, `"md"`, or `"lg"` | `"md"` | |
|
|
48
|
-
| `appearance` | `"fill-emphasis"`, `"fill-subtle"`, `"outline-emphasis"`, `"outline-subtle"`, or `"ghost"` | `"primary"` | |
|
|
49
|
-
|
|
50
|
-
### Slots
|
|
51
|
-
|
|
52
|
-
| Name | Description |
|
|
53
|
-
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
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. |
|
|
@@ -44,8 +44,21 @@ const {
|
|
|
44
44
|
size = "md",
|
|
45
45
|
appearance = "fill-emphasis",
|
|
46
46
|
} = defineProps<{
|
|
47
|
+
/**
|
|
48
|
+
* `RouterLink`'s `to` prop. Providing this prop renders the button as a
|
|
49
|
+
* `RouterLink` (or a plain anchor element for absolute URLs) instead of a
|
|
50
|
+
* `button` element.
|
|
51
|
+
*/
|
|
47
52
|
to?: RouteLocationRaw;
|
|
53
|
+
/**
|
|
54
|
+
* Size of the button.
|
|
55
|
+
* @default "md"
|
|
56
|
+
*/
|
|
48
57
|
size?: keyof typeof BUTTON_SIZE_CLASSES;
|
|
58
|
+
/**
|
|
59
|
+
* Visual style of the button.
|
|
60
|
+
* @default "fill-emphasis"
|
|
61
|
+
*/
|
|
49
62
|
appearance?:
|
|
50
63
|
| "fill-emphasis"
|
|
51
64
|
| "fill-subtle"
|
|
@@ -2,32 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Usage
|
|
4
4
|
|
|
5
|
-
```
|
|
5
|
+
```html
|
|
6
6
|
<UiCheckbox required name="terms" appearance="secondary">
|
|
7
7
|
Accept terms and conditions
|
|
8
8
|
</UiCheckbox>
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Models
|
|
14
|
-
|
|
15
|
-
| Name | Type | Default | Description |
|
|
16
|
-
|-----------|--------------------|-------------|----------------------|
|
|
17
|
-
| _default_ | `string[] \| string \| boolean` | `undefined` | Sets the input value |
|
|
18
|
-
|
|
19
|
-
### Props
|
|
20
|
-
|
|
21
|
-
**Note**: This component binds all non-prop attributes (apart from `class`) on its principal element (`input[type="checkbox"]`) instead of the root element. This allows you to add arbitrary HTML attributes (and event listeners) on the principal element without them being explicitly supported by the component.
|
|
22
|
-
|
|
23
|
-
| Name | Type | Default | Description |
|
|
24
|
-
|----------------|-----------|------------|---------------------------------------------|
|
|
25
|
-
| `appearance` | `"primary"`, `"secondary"` | `"primary"` | |
|
|
26
|
-
| `size` | `"sm"`, `"md"` | `"md"` | |
|
|
27
|
-
|
|
28
|
-
### Slots
|
|
29
|
-
|
|
30
|
-
| Name | Description |
|
|
31
|
-
|-----------|---------------------------------------------|
|
|
32
|
-
| `default` | Checkbox label |
|
|
33
|
-
| `errors` | For validation error content that's associated with the form control via `aria-errormessage` |
|
|
11
|
+
This component binds all non-prop attributes (apart from `class`) on its principal element (`input[type="checkbox"]`) instead of the root element. This allows you to add arbitrary HTML attributes (and event listeners) on the principal element without them being explicitly supported by the component.
|
|
@@ -75,10 +75,21 @@ const {
|
|
|
75
75
|
* ID of the `input` element. Used for the `label`'s `for` attribute.
|
|
76
76
|
*/
|
|
77
77
|
id?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Visual style of the checkbox.
|
|
80
|
+
* @default "primary"
|
|
81
|
+
*/
|
|
78
82
|
appearance?: "primary" | "secondary";
|
|
83
|
+
/**
|
|
84
|
+
* Size of the checkbox and label text.
|
|
85
|
+
* @default "md"
|
|
86
|
+
*/
|
|
79
87
|
size?: "sm" | "md";
|
|
80
88
|
}>();
|
|
81
89
|
|
|
90
|
+
/**
|
|
91
|
+
* The value of the checkbox.
|
|
92
|
+
*/
|
|
82
93
|
const model = defineModel<ModelValue>();
|
|
83
94
|
|
|
84
95
|
const defaultId = useId();
|
|
@@ -12,24 +12,3 @@
|
|
|
12
12
|
import {UiChip} from "@dpa-id-components/dpa-shared-components";
|
|
13
13
|
</script>
|
|
14
14
|
```
|
|
15
|
-
|
|
16
|
-
## API
|
|
17
|
-
|
|
18
|
-
### Props
|
|
19
|
-
|
|
20
|
-
| Name | Type | Default | Description |
|
|
21
|
-
|---------------|------------------------|---------|--------------------------------------------------------------|
|
|
22
|
-
| `size` | `"xs" \| "sm" \| "md"` | `sm` | Determines the font-size and line-height of the chip content |
|
|
23
|
-
| `closeButton` | `boolean` | `false` | renders optional close button |
|
|
24
|
-
|
|
25
|
-
### Events
|
|
26
|
-
|
|
27
|
-
| Name | Payload | Description |
|
|
28
|
-
|---------|---------|--------------------------------------|
|
|
29
|
-
| `close` | `[]` | Emitted when close button is clicked |
|
|
30
|
-
|
|
31
|
-
### Slots
|
|
32
|
-
|
|
33
|
-
| Name | Description |
|
|
34
|
-
|-----------|-------------------------------------------|
|
|
35
|
-
| `default` | slot for the rendering the chip's content |
|
|
@@ -23,10 +23,16 @@ import type { Size } from "../../types";
|
|
|
23
23
|
import UiIcon from "../UiIcon/UiIcon.vue";
|
|
24
24
|
|
|
25
25
|
defineSlots<{
|
|
26
|
+
/**
|
|
27
|
+
* Slot for rendering the chip's content.
|
|
28
|
+
*/
|
|
26
29
|
default: () => any;
|
|
27
30
|
}>();
|
|
28
31
|
|
|
29
32
|
defineEmits<{
|
|
33
|
+
/**
|
|
34
|
+
* Emitted when the close button is clicked.
|
|
35
|
+
*/
|
|
30
36
|
close: [];
|
|
31
37
|
}>();
|
|
32
38
|
|
|
@@ -37,7 +43,14 @@ const CHIP_SIZES: Record<Extract<Size, "xs" | "sm" | "md">, string> = {
|
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
const { size = "sm", closeButton = undefined } = defineProps<{
|
|
46
|
+
/**
|
|
47
|
+
* Renders an optional close button.
|
|
48
|
+
*/
|
|
40
49
|
closeButton?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Determines the font-size and line-height of the chip content.
|
|
52
|
+
* @default "sm"
|
|
53
|
+
*/
|
|
41
54
|
size?: Extract<Size, "xs" | "sm" | "md">;
|
|
42
55
|
}>();
|
|
43
56
|
</script>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Usage
|
|
4
4
|
|
|
5
|
-
```
|
|
5
|
+
```html
|
|
6
6
|
<template>
|
|
7
7
|
<UiLabel for="colorPicker">Farbe wählen</UiLabel>
|
|
8
8
|
<UiColorPicker id="colorPicker" v-model="colorValue" />
|
|
@@ -15,17 +15,3 @@ import { UiColorPicker, UiLabel } from "@dpa-id-components/dpa-shared-components
|
|
|
15
15
|
const colorValue = ref("");
|
|
16
16
|
</script>
|
|
17
17
|
```
|
|
18
|
-
|
|
19
|
-
## API
|
|
20
|
-
|
|
21
|
-
### Props
|
|
22
|
-
|
|
23
|
-
| Name | Type | Default | Description |
|
|
24
|
-
|---------------|-------------|--------------------------------------|-----------------------------------------------------|
|
|
25
|
-
| `modelValue` | `String` | `"#e53935"` (see `./lib/colors.ts`) | Color code in hexadecimal syntax |
|
|
26
|
-
|
|
27
|
-
### Events
|
|
28
|
-
|
|
29
|
-
| Name | Type | Description |
|
|
30
|
-
|---------------------|---------------------------------------------|---------------------------------------------------|
|
|
31
|
-
| `update:modelValue` | `string` (color code in hexadecimal syntax) | Emitted when a color has been selected or entered |
|
|
@@ -54,6 +54,10 @@ import UiIcon from "../UiIcon/UiIcon.vue";
|
|
|
54
54
|
|
|
55
55
|
import { COLORS } from "./lib/colors.ts";
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* The selected color code in hexadecimal syntax.
|
|
59
|
+
* @default "#e53935"
|
|
60
|
+
*/
|
|
57
61
|
const model = defineModel<string>({ default: COLORS[0] });
|
|
58
62
|
|
|
59
63
|
const checkmarkIconColor = computed(() => {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# @dpa-shared-components/UiDatePicker
|
|
2
2
|
|
|
3
|
+
A date input wrapping the [`@vuepic/vue-datepicker`](https://vue3datepicker.com/) library. Supports single-date, date-range (via an array `v-model`), and month-only (`monthPicker`) selection modes, an optional time picker, multiple side-by-side calendar months (`multiCalendars`), and an optional quick filter sidebar (`leftSidebar` + `quickFilterRanges`) for jumping to preset ranges.
|
|
4
|
+
|
|
3
5
|
## Usage
|
|
4
6
|
|
|
5
|
-
```
|
|
7
|
+
```html
|
|
6
8
|
<template>
|
|
7
9
|
<UiDatePicker v-model="date" />
|
|
8
10
|
</template>
|
|
@@ -16,64 +18,10 @@
|
|
|
16
18
|
</script>
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
## API
|
|
20
|
-
|
|
21
|
-
### Props
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
| Name | Type | Default | Description |
|
|
25
|
-
|--------------------------|------------------------------------------|--------------------------|-------------------------------------------------------------------------------------------------------------|
|
|
26
|
-
| `autoApply` | `boolean` | `true` | Clicking a date immediately selects it without requiring confirmation |
|
|
27
|
-
| `closeOnAutoApply` | `boolean` | `true` | Close the datepicker menu after auto-applying a selection |
|
|
28
|
-
| `inline` | `boolean` | `false` | Renders the datepicker inline instead of as a popup |
|
|
29
|
-
| `disabled` | `boolean` | `false` | Disables the datepicker and applies disabled styling |
|
|
30
|
-
| `locale` | `Locale` | `de` | date-fns locale used for formatting and translations |
|
|
31
|
-
| `utc` | `boolean` | `false` | Sets Timezone to utc or not |
|
|
32
|
-
| `teleport` | `boolean \| string \| HTMLElement` | `false` | Teleports the datepicker menu to the body or a provided selector. Useful for solving hidden overflow issues |
|
|
33
|
-
| `minDate` | `Date \| string \| number` | `new Date("1948-01-01")` | Minimum selectable date |
|
|
34
|
-
| `maxDate` | `Date \| string \| number` | `undefined` | Maximum selectable date |
|
|
35
|
-
| `multiCalendars` | `boolean` | `false` | Shows multiple calendar months side by side |
|
|
36
|
-
| `monthPicker` | `boolean` | `false` | Switches to month-only picker mode. Disables range selection |
|
|
37
|
-
| `enableTimePicker` | `boolean` | `false` | Enables a time picker alongside the date picker |
|
|
38
|
-
| `autoPosition` | `boolean` | `true` | Automatically repositions the menu based on viewport (flip & shift) |
|
|
39
|
-
| `autoRange` | `string \| number` | `undefined` | Automatically selects a range of N days from the clicked date |
|
|
40
|
-
| `maxRange` | `string \| number` | `undefined` | Maximum number of days allowed in a selected range |
|
|
41
|
-
| `triggerWidth` | `full \| fit` | `full` | Trigger button has either w-full applied ot w-fit |
|
|
42
|
-
| `triggerPlaceholderText` | `string` | `undefined` | Placeholder text shown in the trigger button when no date is selected |
|
|
43
|
-
| `customFormatCallback` | `(date: Date \| [Date, Date]) => string` | `undefined` | Custom callback for formatting the displayed date string in the input |
|
|
44
|
-
| `leftTriggerIcon` | `UiIconName` | `undefined` | Icon displayed to the left of the label in the trigger button |
|
|
45
|
-
| `leftSidebar` | `boolean` | `false` | Enables the quick filter sidebar |
|
|
46
|
-
| `quickFilterHeadline` | `string` | `undefined` | Headline text for the quick filter sidebar |
|
|
47
|
-
| `quickFilterRanges` | `PresetRange[]` | `[]` | Preset date ranges displayed as buttons in the quick filter sidebar |
|
|
48
|
-
| `actionExtraContent` | `string` | `undefined` | Text content displayed at the bottom of the datepicker. Overridden when the `action-extra` slot is used |
|
|
49
|
-
|
|
50
|
-
### Model
|
|
51
|
-
|
|
52
|
-
| Name | Type | Description |
|
|
53
|
-
|--------------|------------|----------------------------------------------------------------------------------------------------|
|
|
54
|
-
| `modelValue` | `DateType` | The selected date. Supports `Date`, `[Date, Date]`, `string`, or `{ month: number; year: number }` |
|
|
55
|
-
|
|
56
|
-
### Events
|
|
57
|
-
|
|
58
|
-
| Name | Payload | Description |
|
|
59
|
-
|------------------------|---------------|------------------------------------------------|
|
|
60
|
-
| `update:modelValue` | `DateType` | Emitted when a date or date range is selected |
|
|
61
|
-
| `quick-filter-changed` | `PresetRange` | Emitted when a quick filter preset is selected |
|
|
62
|
-
| `open` | — | Emitted when the datepicker menu opens |
|
|
63
|
-
| `closed` | — | Emitted when the datepicker menu closes |
|
|
64
|
-
| `start-range` | `Date` | Emitted when first date of range is selected |
|
|
65
|
-
| `end-range` | `Date` | Emitted when last date of range is selected |
|
|
66
|
-
|
|
67
|
-
### Slots
|
|
68
|
-
|
|
69
|
-
| Name | Slot Props | Description |
|
|
70
|
-
|----------------|--------------------------------------------------------|--------------------------------------------------------------------------------------------------|
|
|
71
|
-
| `action-row` | `ActionRowSlotProps` | Custom action row at the bottom of the datepicker (e.g. confirm/cancel buttons) |
|
|
72
|
-
| `action-extra` | `{ selectCurrentDate: () => void, reset: () => void }` | Additional content above the action row. Falls back to `actionExtraContent` prop if not provided |
|
|
73
|
-
|
|
74
|
-
|
|
75
21
|
### Types
|
|
76
22
|
|
|
23
|
+
The `quickFilterRanges` prop and `quick-filter-changed` event use `PresetRange`; `v-model` accepts/emits `DateType`. Storybook's generated API tables show these as opaque type names, so their shapes are documented here instead:
|
|
24
|
+
|
|
77
25
|
```typescript
|
|
78
26
|
export interface PresetRange {
|
|
79
27
|
label: string;
|
|
@@ -146,11 +146,28 @@ import { computed, ref, type ShallowRef, useTemplateRef } from "vue";
|
|
|
146
146
|
import UiButton from "../UiButton/UiButton.vue";
|
|
147
147
|
import UiIcon, { type UiIconName } from "../UiIcon/UiIcon.vue";
|
|
148
148
|
|
|
149
|
+
/**
|
|
150
|
+
* A preset date range displayed as a button in the quick filter sidebar
|
|
151
|
+
* (see the `leftSidebar` and `quickFilterRanges` props).
|
|
152
|
+
*/
|
|
149
153
|
export interface PresetRange {
|
|
154
|
+
/** Label displayed on the quick filter button. */
|
|
150
155
|
label: string;
|
|
156
|
+
/**
|
|
157
|
+
* The date range (or month/year) selected when this preset is clicked.
|
|
158
|
+
* Use a `[Date, Date]` tuple for a day range, or `{ year, month }` when
|
|
159
|
+
* `monthPicker` is enabled.
|
|
160
|
+
*/
|
|
151
161
|
range: [Date, Date] | { year: number; month: number };
|
|
162
|
+
/** Optional internal identifier for the preset. */
|
|
152
163
|
name?: string;
|
|
153
164
|
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The value of `UiDatePicker`'s `v-model`. A single `Date` when selecting one
|
|
168
|
+
* date, a `[Date, Date]` tuple when selecting a range, a `string` for raw
|
|
169
|
+
* input, or `{ month, year }` when `monthPicker` is enabled.
|
|
170
|
+
*/
|
|
154
171
|
export type DateType =
|
|
155
172
|
Date | [Date, Date] | string | { month: number; year: number };
|
|
156
173
|
|
|
@@ -161,20 +178,38 @@ const menuArrow =
|
|
|
161
178
|
useTemplateRef<Readonly<ShallowRef<HTMLDivElement>>>("menuArrow");
|
|
162
179
|
|
|
163
180
|
defineSlots<{
|
|
181
|
+
/**
|
|
182
|
+
* Custom action row at the bottom of the datepicker (e.g. confirm/cancel
|
|
183
|
+
* buttons), replacing the default one. Receives the underlying date
|
|
184
|
+
* picker's current `modelValue` and `disabled` state, plus `selectDate`
|
|
185
|
+
* and `closePicker` functions to confirm or dismiss the menu.
|
|
186
|
+
*/
|
|
164
187
|
"action-row"?: (props: ActionRowSlotProps) => any;
|
|
188
|
+
/**
|
|
189
|
+
* Additional content rendered above the action row. Falls back to the
|
|
190
|
+
* `actionExtraContent` prop when not provided. Receives
|
|
191
|
+
* `selectCurrentDate` (selects today's date) and `reset` (clears the
|
|
192
|
+
* selection and closes the menu) functions.
|
|
193
|
+
*/
|
|
165
194
|
"action-extra"?: (props: {
|
|
166
195
|
selectCurrentDate: () => void;
|
|
167
196
|
reset: () => void;
|
|
168
197
|
}) => any;
|
|
169
198
|
}>();
|
|
170
199
|
|
|
200
|
+
/** The selected date, range, or month. See {@link DateType}. */
|
|
171
201
|
const date = defineModel<DateType>();
|
|
172
202
|
|
|
173
203
|
const emit = defineEmits<{
|
|
204
|
+
/** Emitted when the datepicker menu closes. */
|
|
174
205
|
closed: [];
|
|
206
|
+
/** Emitted when the datepicker menu opens. */
|
|
175
207
|
open: [];
|
|
208
|
+
/** Emitted with the first selected date when a range selection starts. */
|
|
176
209
|
"range-start": [Date];
|
|
210
|
+
/** Emitted with the last selected date when a range selection ends. */
|
|
177
211
|
"range-end": [Date];
|
|
212
|
+
/** Emitted when a quick filter preset is selected. */
|
|
178
213
|
"quick-filter-changed": [PresetRange];
|
|
179
214
|
}>();
|
|
180
215
|
|
|
@@ -203,38 +238,120 @@ const {
|
|
|
203
238
|
quickFilterRanges = [],
|
|
204
239
|
actionExtraContent = undefined,
|
|
205
240
|
} = defineProps<{
|
|
241
|
+
/**
|
|
242
|
+
* Clicking a date immediately selects it without requiring a separate
|
|
243
|
+
* confirmation step (i.e. hides/bypasses the action row).
|
|
244
|
+
* @default true
|
|
245
|
+
*/
|
|
206
246
|
autoApply?: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* date-fns locale used for formatting dates and translating internal
|
|
249
|
+
* labels.
|
|
250
|
+
* @default de
|
|
251
|
+
*/
|
|
207
252
|
locale?: Locale;
|
|
253
|
+
/**
|
|
254
|
+
* Disables the datepicker trigger and applies disabled styling.
|
|
255
|
+
* @default false
|
|
256
|
+
*/
|
|
208
257
|
disabled?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Minimum selectable date.
|
|
260
|
+
* @default new Date("1948-01-01")
|
|
261
|
+
*/
|
|
209
262
|
minDate?: Date | string | number;
|
|
263
|
+
/** Maximum selectable date. */
|
|
210
264
|
maxDate?: Date | string | number;
|
|
265
|
+
/**
|
|
266
|
+
* Renders the datepicker inline instead of as a popup.
|
|
267
|
+
* @default false
|
|
268
|
+
*/
|
|
211
269
|
inline?: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* Teleports the datepicker menu to the given target (or to `<body>` when
|
|
272
|
+
* `true`). Useful for avoiding clipping by an ancestor's `overflow:
|
|
273
|
+
* hidden`.
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
212
276
|
teleport?: string | boolean | HTMLElement;
|
|
277
|
+
/**
|
|
278
|
+
* Switches to a month-only picker mode (selecting `{ month, year }`
|
|
279
|
+
* instead of a day). Disables range selection.
|
|
280
|
+
* @default false
|
|
281
|
+
*/
|
|
213
282
|
monthPicker?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Shows multiple calendar months side by side.
|
|
285
|
+
* @default false
|
|
286
|
+
*/
|
|
214
287
|
multiCalendars?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Interprets and displays the selected date(s) in UTC instead of the
|
|
290
|
+
* local timezone.
|
|
291
|
+
*/
|
|
215
292
|
utc?: boolean;
|
|
216
293
|
|
|
217
294
|
// Time Config
|
|
295
|
+
/**
|
|
296
|
+
* Enables a time picker alongside the date picker.
|
|
297
|
+
* @default false
|
|
298
|
+
*/
|
|
218
299
|
enableTimePicker?: boolean;
|
|
219
300
|
|
|
220
301
|
// Floating Config
|
|
302
|
+
/**
|
|
303
|
+
* Automatically repositions the menu to stay within the viewport (flip &
|
|
304
|
+
* shift).
|
|
305
|
+
* @default true
|
|
306
|
+
*/
|
|
221
307
|
autoPosition?: boolean;
|
|
222
308
|
|
|
223
309
|
// Range Config
|
|
310
|
+
/** Automatically selects a range of N days starting from the clicked date. */
|
|
224
311
|
autoRange?: string | number;
|
|
312
|
+
/** Maximum number of days allowed in a selected range. */
|
|
225
313
|
maxRange?: string | number;
|
|
226
314
|
|
|
227
315
|
// General Config
|
|
316
|
+
/**
|
|
317
|
+
* Closes the datepicker menu automatically after auto-applying a
|
|
318
|
+
* selection (only relevant when `autoApply` is `true`).
|
|
319
|
+
* @default true
|
|
320
|
+
*/
|
|
228
321
|
closeOnAutoApply?: boolean;
|
|
229
322
|
|
|
230
323
|
// Slots
|
|
324
|
+
/** Placeholder text shown in the trigger button when no date is selected. */
|
|
231
325
|
triggerPlaceholderText?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Whether the trigger button spans the full width of its container
|
|
328
|
+
* (`"full"`) or only as wide as its content (`"fit"`).
|
|
329
|
+
* @default "fit"
|
|
330
|
+
*/
|
|
232
331
|
triggerWidth?: "full" | "fit";
|
|
332
|
+
/**
|
|
333
|
+
* Custom callback for formatting the displayed date (or range) string in
|
|
334
|
+
* the trigger button. Overrides the built-in `dd.MM.yyyy` formatting.
|
|
335
|
+
*/
|
|
233
336
|
customFormatCallback?: (date: Date | [Date, Date]) => string;
|
|
337
|
+
/** Icon displayed to the left of the label in the trigger button. */
|
|
234
338
|
leftTriggerIcon?: UiIconName;
|
|
339
|
+
/**
|
|
340
|
+
* Enables the quick filter sidebar showing buttons for `quickFilterRanges`.
|
|
341
|
+
* @default false
|
|
342
|
+
*/
|
|
235
343
|
leftSidebar?: boolean;
|
|
344
|
+
/** Headline text for the quick filter sidebar. */
|
|
236
345
|
quickFilterHeadline?: string;
|
|
346
|
+
/**
|
|
347
|
+
* Preset date ranges displayed as buttons in the quick filter sidebar.
|
|
348
|
+
* @default []
|
|
349
|
+
*/
|
|
237
350
|
quickFilterRanges?: PresetRange[];
|
|
351
|
+
/**
|
|
352
|
+
* Text content displayed at the bottom of the datepicker, above the
|
|
353
|
+
* action row. Overridden by the `action-extra` slot when it is used.
|
|
354
|
+
*/
|
|
238
355
|
actionExtraContent?: string;
|
|
239
356
|
}>();
|
|
240
357
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @dpa-shared-components/UiDialog
|
|
2
2
|
|
|
3
|
+
A wrapper around the native `<dialog>` element. Native `<dialog>` behaviors and events (such as the `cancel` event fired when the Escape key is pressed) apply.
|
|
4
|
+
|
|
3
5
|
## Usage
|
|
4
6
|
|
|
5
7
|
```html
|
|
@@ -16,30 +18,3 @@
|
|
|
16
18
|
import {UiDialog} from "@dpa-id-components/dpa-shared-components";
|
|
17
19
|
</script>
|
|
18
20
|
```
|
|
19
|
-
|
|
20
|
-
## API
|
|
21
|
-
|
|
22
|
-
### Props
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
| Name | Type | Default | Description |
|
|
26
|
-
|------------------|-----------|---------|---------------------------------------------------|
|
|
27
|
-
| `hasCloseButton` | `boolean` | `true` | Whether to show the close button |
|
|
28
|
-
| `closeLabel` | `string` | `undefined` | Close button label |
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### Exposes
|
|
32
|
-
|
|
33
|
-
| Name | Type | Description |
|
|
34
|
-
|----------------|------|----------------------------------------------------------------------|
|
|
35
|
-
| `close` | none | Exposes the native `close()` function of a `<dialog>` element |
|
|
36
|
-
| `requestClose` | none | Exposes the native `requestClose()` function of a `<dialog>` element |
|
|
37
|
-
| `showModal` | none | Exposes the native `showModal()` function of a `<dialog>` element |
|
|
38
|
-
|
|
39
|
-
### Slots
|
|
40
|
-
|
|
41
|
-
| Name | Description |
|
|
42
|
-
|-----------|--------------|
|
|
43
|
-
| `default` | Main content |
|
|
44
|
-
| `header` | Header |
|
|
45
|
-
| `footer` | Footer |
|