@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.
Files changed (57) hide show
  1. package/package.json +7 -7
  2. package/src/components/UiBadge/README.md +0 -15
  3. package/src/components/UiBadge/UiBadge.vue +14 -0
  4. package/src/components/UiButton/README.md +3 -18
  5. package/src/components/UiButton/UiButton.vue +13 -0
  6. package/src/components/UiCheckbox/README.md +2 -24
  7. package/src/components/UiCheckbox/UiCheckbox.vue +11 -0
  8. package/src/components/UiChip/README.md +0 -21
  9. package/src/components/UiChip/UiChip.vue +13 -0
  10. package/src/components/UiColorPicker/README.md +1 -15
  11. package/src/components/UiColorPicker/UiColorPicker.vue +4 -0
  12. package/src/components/UiDatePicker/README.md +5 -57
  13. package/src/components/UiDatePicker/UiDatePicker.vue +117 -0
  14. package/src/components/UiDialog/README.md +2 -27
  15. package/src/components/UiDialog/UiDialog.vue +32 -0
  16. package/src/components/UiFilterBadge/README.md +2 -17
  17. package/src/components/UiFilterBadge/UiFilterBadge.vue +23 -0
  18. package/src/components/UiIcon/README.md +2 -18
  19. package/src/components/UiIcon/UiIcon.vue +10 -0
  20. package/src/components/UiInfoContent/README.md +2 -17
  21. package/src/components/UiInfoContent/UiInfoContent.vue +22 -0
  22. package/src/components/UiInput/README.md +4 -32
  23. package/src/components/UiInput/UiInput.vue +25 -1
  24. package/src/components/UiLabel/README.md +2 -2
  25. package/src/components/UiListItem/README.md +0 -30
  26. package/src/components/UiListItem/UiListItem.vue +56 -0
  27. package/src/components/UiMediaTypeIcon/README.md +1 -10
  28. package/src/components/UiMediaTypeIcon/UiMediaTypeIcon.vue +7 -0
  29. package/src/components/UiMenu/README.md +4 -51
  30. package/src/components/UiMenu/UiMenu.vue +112 -0
  31. package/src/components/UiPopover/README.md +1 -34
  32. package/src/components/UiPopover/UiPopover.vue +20 -1
  33. package/src/components/UiRadioButton/README.md +1 -23
  34. package/src/components/UiRadioButton/UiRadioButton.vue +11 -0
  35. package/src/components/UiSearchBar/README.md +0 -29
  36. package/src/components/UiSearchBar/UiSearchBar.vue +42 -0
  37. package/src/components/UiSearchInput/README.md +1 -23
  38. package/src/components/UiSearchInput/UiSearchInput.vue +31 -0
  39. package/src/components/UiSelect/README.md +2 -28
  40. package/src/components/UiSelect/UiSelect.vue +7 -1
  41. package/src/components/UiSkeletonBox/README.md +0 -14
  42. package/src/components/UiSkeletonBox/UiSkeletonBox.vue +12 -0
  43. package/src/components/UiSnackbar/README.md +0 -26
  44. package/src/components/UiSnackbar/UiSnackbar.vue +38 -0
  45. package/src/components/UiSpinner/README.md +0 -14
  46. package/src/components/UiSpinner/UiSpinner.vue +9 -0
  47. package/src/components/UiTShirtSizeIcon/README.md +13 -0
  48. package/src/components/UiTShirtSizeIcon/UiTShirtSizeIcon.vue +42 -0
  49. package/src/components/UiTShirtSizeIcon/UiTShirtSizeIconLoading.vue +8 -0
  50. package/src/components/UiTShirtSizeIcon/icons/l.vue +18 -0
  51. package/src/components/UiTShirtSizeIcon/icons/m.vue +18 -0
  52. package/src/components/UiTShirtSizeIcon/icons/xl.vue +18 -0
  53. package/src/components/UiTShirtSizeIcon/icons.ts +5 -0
  54. package/src/components/UiToggleButton/README.md +0 -26
  55. package/src/components/UiToggleButton/UiToggleButton.vue +16 -0
  56. package/src/components/UiTooltip/README.md +1 -26
  57. package/src/components/UiTooltip/UiTooltip.vue +32 -0
@@ -55,7 +55,13 @@ import { watch } from "vue";
55
55
  import UiIcon, { ICON_SIZES, type UiIconName } from "../UiIcon/UiIcon.vue";
56
56
 
57
57
  const emit = defineEmits<{
58
+ /**
59
+ * Emitted when the snackbar's visibility becomes `true` (i.e. when it is shown).
60
+ */
58
61
  input: [boolean];
62
+ /**
63
+ * Emitted when the action button is clicked.
64
+ */
59
65
  "action-click": [];
60
66
  }>();
61
67
 
@@ -66,13 +72,45 @@ const {
66
72
  iconSize = "lg",
67
73
  type = "info",
68
74
  } = defineProps<{
75
+ /**
76
+ * Visibility of the snackbar.
77
+ * @default false
78
+ */
69
79
  isShown?: boolean;
80
+ /**
81
+ * Position of the snackbar, fixed in the viewport.
82
+ * @default "left"
83
+ */
70
84
  position?: "left" | "right";
85
+ /**
86
+ * Name of the icon to display. If not set, defaults to `"alert-filled"`
87
+ * when `type` is `"error"`.
88
+ */
71
89
  iconName?: UiIconName;
90
+ /**
91
+ * Size of the icon.
92
+ * @default "lg"
93
+ */
72
94
  iconSize?: Extract<keyof typeof ICON_SIZES, "sm" | "md" | "lg">;
95
+ /**
96
+ * Overall design/color scheme of the snackbar.
97
+ * @default "info"
98
+ */
73
99
  type?: "info" | "error" | "success";
74
100
  }>();
75
101
 
102
+ defineSlots<{
103
+ /**
104
+ * Text content of the snackbar.
105
+ */
106
+ default: () => any;
107
+ /**
108
+ * Optional slot for the text of the action button. If provided, an action
109
+ * button is rendered.
110
+ */
111
+ action?: () => any;
112
+ }>();
113
+
76
114
  watch(
77
115
  () => isShown,
78
116
  (isShown) => {
@@ -12,17 +12,3 @@
12
12
  import {UiSpinner} 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` | `String` | `primary` | Sets the color theme for the spinner, affecting both the background circle and the arc. |
23
- | `size` | `String` | `lg` | sets size of the spinner |
24
-
25
-
26
- ### Slots
27
-
28
- This component has no slots
@@ -37,7 +37,16 @@
37
37
  import { computed } from "vue";
38
38
 
39
39
  export interface SpinnerProps {
40
+ /**
41
+ * Sets the color theme for the spinner, affecting both the background
42
+ * circle and the arc.
43
+ * @default "primary"
44
+ */
40
45
  appearance?: "primary" | "neutral";
46
+ /**
47
+ * Sets the size of the spinner.
48
+ * @default "lg"
49
+ */
41
50
  size?: "sm" | "md" | "lg" | "xl";
42
51
  }
43
52
 
@@ -0,0 +1,13 @@
1
+ # UiTShirtSizeIcon
2
+
3
+ ## Usage
4
+
5
+ ```html
6
+ <template>
7
+ <UiTShirtSizeIcon name="xl" />
8
+ </template>
9
+
10
+ <script setup>
11
+ import { UiTShirtSizeIcon } from "@dpa-id-components/dpa-shared-components";
12
+ </script>
13
+ ```
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <component
3
+ :is="iconComponent"
4
+ class="inline-flex"
5
+ :class="
6
+ {
7
+ xs: 'size-3',
8
+ sm: 'size-4',
9
+ md: 'size-5',
10
+ lg: 'size-6',
11
+ xl: 'size-10',
12
+ '2xl': 'size-14',
13
+ }[size]
14
+ "
15
+ />
16
+ </template>
17
+
18
+ <script lang="ts">
19
+ export type UiTShirtSizeIconName = keyof typeof icons;
20
+ </script>
21
+
22
+ <script setup lang="ts">
23
+ import { computed, defineAsyncComponent } from "vue";
24
+
25
+ import { icons } from "./icons.ts";
26
+ import UiTShirtSizeIconLoading from "./UiTShirtSizeIconLoading.vue";
27
+
28
+ const { name, size = "lg" } = defineProps<{
29
+ name: UiTShirtSizeIconName;
30
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
31
+ }>();
32
+
33
+ const iconComponent = computed(() =>
34
+ defineAsyncComponent({
35
+ loader: icons[name],
36
+ // Render a substitute element while loading for classes to attach to.
37
+ loadingComponent: UiTShirtSizeIconLoading,
38
+ // Immediately render the loadingComponent so that it can receive classes.
39
+ delay: 0,
40
+ }),
41
+ );
42
+ </script>
@@ -0,0 +1,8 @@
1
+ <template>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ ></svg>
8
+ </template>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <svg
3
+ width="16"
4
+ height="16"
5
+ viewBox="0 0 16 16"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ >
9
+ <path
10
+ d="M8 0.5C12.1421 0.5 15.5 3.85786 15.5 8C15.5 12.1421 12.1421 15.5 8 15.5C3.85786 15.5 0.5 12.1421 0.5 8C0.5 3.85786 3.85786 0.5 8 0.5Z"
11
+ stroke="currentColor"
12
+ />
13
+ <path
14
+ d="M5.78906 12V4H7.23828V10.7852H10.7617V12H5.78906Z"
15
+ fill="currentColor"
16
+ />
17
+ </svg>
18
+ </template>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <svg
3
+ width="16"
4
+ height="16"
5
+ viewBox="0 0 16 16"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ >
9
+ <path
10
+ d="M8 0.5C12.1421 0.5 15.5 3.85786 15.5 8C15.5 12.1421 12.1421 15.5 8 15.5C3.85786 15.5 0.5 12.1421 0.5 8C0.5 3.85786 3.85786 0.5 8 0.5Z"
11
+ stroke="currentColor"
12
+ />
13
+ <path
14
+ d="M3.78906 4H5.5625L7.9375 9.79687H8.03125L10.4063 4H12.1797V12H10.7891V6.50391H10.7148L8.50391 11.9766H7.46484L5.25391 6.49219H5.17969V12H3.78906V4Z"
15
+ fill="currentColor"
16
+ />
17
+ </svg>
18
+ </template>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <svg
3
+ width="16"
4
+ height="16"
5
+ viewBox="0 0 16 16"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ >
9
+ <path
10
+ d="M8 0.5C12.1421 0.5 15.5 3.85786 15.5 8C15.5 12.1421 12.1421 15.5 8 15.5C3.85786 15.5 0.5 12.1421 0.5 8C0.5 3.85786 3.85786 0.5 8 0.5Z"
11
+ stroke="currentColor"
12
+ />
13
+ <path
14
+ d="M4.76278 4.81818L6.00941 6.92507H6.05771L7.31037 4.81818H8.7864L6.89986 7.90909L8.82866 11H7.32546L6.05771 8.89009H6.00941L4.74165 11H3.2445L5.17933 7.90909L3.28072 4.81818H4.76278ZM9.61346 11V4.81818H10.9205V9.92241H13.5707V11H9.61346Z"
15
+ fill="currentColor"
16
+ />
17
+ </svg>
18
+ </template>
@@ -0,0 +1,5 @@
1
+ export const icons = {
2
+ m: () => import("./icons/m.vue"),
3
+ l: () => import("./icons/l.vue"),
4
+ xl: () => import("./icons/xl.vue"),
5
+ } as const;
@@ -14,30 +14,4 @@
14
14
  </script>
15
15
  ```
16
16
 
17
-
18
- ## API
19
-
20
- ### Props
21
-
22
- | Name | Type | Default | Description |
23
- |-----------------|-----------|---------|--------------------------------------------------------------|
24
- | `id` | `String` | | Sets the `id` of the input. Auto-generated if not provided. |
25
- | `modelValue` | `Boolean` | `false` | The `checked` state of the checkbox |
26
- | `labelPosition` | `String` | `left` | To place the label to the right side set this to `"right"` |
27
- | `size` | `String` | `sm` | Sets the element's size to either `"sm"` or `"lg"` |
28
-
29
- ### Attributes
30
-
31
17
  HTML attributes like `disabled`, `aria-label`, etc. are forwarded to the underlying `<input>` element via `v-bind="$attrs"`.
32
-
33
- ### Slots
34
-
35
- | Name | Description |
36
- |-----------|---------------|
37
- | `default` | Label content |
38
-
39
- ### Events
40
-
41
- | Name | Type | Description |
42
- |----------------------|-----------|----------------------------------------|
43
- | `update:model-value` | `boolean` | |
@@ -39,6 +39,10 @@ import UiLabel from "../UiLabel/UiLabel.vue";
39
39
 
40
40
  defineOptions({ inheritAttrs: false });
41
41
 
42
+ /**
43
+ * The `checked` state of the toggle.
44
+ * @default false
45
+ */
42
46
  const model = defineModel<boolean>({ default: false });
43
47
 
44
48
  defineSlots<{
@@ -53,8 +57,20 @@ const {
53
57
  labelPosition = "left",
54
58
  size = "sm",
55
59
  } = defineProps<{
60
+ /**
61
+ * The `id` attribute of the underlying `input` element. Auto-generated if not provided.
62
+ */
56
63
  id?: string;
64
+ /**
65
+ * Position of the label relative to the toggle switch. Set to `"right"` to
66
+ * place the label after the switch.
67
+ * @default "left"
68
+ */
57
69
  labelPosition?: "left" | "right";
70
+ /**
71
+ * Size of the toggle switch.
72
+ * @default "sm"
73
+ */
58
74
  size?: "sm" | "lg";
59
75
  }>();
60
76
 
@@ -19,33 +19,8 @@
19
19
  </script>
20
20
  ```
21
21
 
22
- ## API
23
-
24
- ### Props
25
-
26
- | Name | Type | Default | Description |
27
- |---------------------|-----------------------------|-------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
28
- | `position` | `Placement` | `bottom` | Position of the tooltip relative to the activator slot |
29
- | `fixed` | `Boolean` | `true` | Whether the tooltip positioning is fixed instead of absolute |
30
- | `floatingUiOptions` | `UseFloatingOptions` | `null` | Options for [Floating Ui](https://floating-ui.com/) [Interface](https://github.com/floating-ui/floating-ui/blob/afca34cc59321569ccfca9b41934859809c47a3d/packages/vue/src/types.ts#L60) |
31
- | `animate` | `Boolean` | `false` | Whether the tooltip should be animated |
32
- | `hidden` | `Boolean` | `false` | Allows you to turn off the tooltip content, useful for scenarios like mobile devices where tooltips may not be needed. |
33
-
34
- ### Attributes
35
-
36
- ### Attributes
37
-
38
- The `class` attribute is forwarded to the component's root element, so e.g. `<UiTooltip class="mt-4">` styles the outer wrapper (useful for layout or positioning).
39
- The root element has `inline-block` and `align-middle` as default classes, which can be overridden via `tailwind-merge`.
22
+ The `class` attribute is forwarded to the component's root element, so e.g. `<UiTooltip class="mt-4">` styles the outer wrapper (useful for layout or positioning). The root element has `inline-block` and `align-middle` as default classes, which can be overridden via tailwind-merge.
40
23
 
41
24
  All other attributes (`aria-*`, `data-*`, event listeners, etc.) are forwarded to the inner tooltip content element via `v-bind="$attrs"`.
42
25
 
43
26
  To style the tooltip content itself, wrap the slot content in your own element with the desired classes.
44
-
45
-
46
- ### Slots
47
-
48
- | Name | Description |
49
- |-------------|----------------------------------------------|
50
- | `default` | Default slot for text/content of the tooltip |
51
- | `activator` | Slot for tooltip activator |
@@ -63,13 +63,45 @@ const {
63
63
  animate = false,
64
64
  hidden = false,
65
65
  } = defineProps<{
66
+ /**
67
+ * Position of the tooltip relative to the activator slot.
68
+ * @default "bottom"
69
+ */
66
70
  position?: Placement;
71
+ /**
72
+ * Whether the tooltip positioning is fixed instead of absolute.
73
+ * @default true
74
+ */
67
75
  fixed?: boolean;
76
+ /**
77
+ * Options for [Floating UI](https://floating-ui.com/).
78
+ * @default null
79
+ */
68
80
  floatingUiOptions?: UseFloatingOptions | null;
81
+ /**
82
+ * Whether the tooltip should be animated when opening and closing.
83
+ * @default false
84
+ */
69
85
  animate?: boolean;
86
+ /**
87
+ * Turns off the tooltip content entirely, useful for scenarios like mobile
88
+ * devices where tooltips may not be needed.
89
+ * @default false
90
+ */
70
91
  hidden?: boolean;
71
92
  }>();
72
93
 
94
+ defineSlots<{
95
+ /**
96
+ * Content of the tooltip.
97
+ */
98
+ default: () => any;
99
+ /**
100
+ * The element that triggers the tooltip when hovered or focused.
101
+ */
102
+ activator: () => any;
103
+ }>();
104
+
73
105
  const transitionFromTo = computed(() => {
74
106
  if (!animate) return undefined;
75
107
  const map: Partial<Record<Placement, string>> = {