@muenchen/muc-patternlab-vue 1.1.0 → 1.2.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.
@@ -1,4 +1,4 @@
1
- import { type PropType } from "vue";
1
+ import type { PropType } from "vue";
2
2
  type bannerType = "info" | "warning" | "emergency";
3
3
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
4
4
  type: {
@@ -16,6 +16,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
16
16
  default?(_: {}): any;
17
17
  }>;
18
18
  export default _default;
19
+
19
20
  type __VLS_WithTemplateSlots<T, S> = T & {
20
21
  new (): {
21
22
  $slots: S;
@@ -1,46 +1,2 @@
1
- declare const _default: {
2
- MucBanner: {
3
- new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
4
- type: {
5
- type: import("vue").PropType<"info" | "warning" | "emergency">;
6
- default: string;
7
- };
8
- }>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
9
- type: {
10
- type: import("vue").PropType<"info" | "warning" | "emergency">;
11
- default: string;
12
- };
13
- }>>, {
14
- type: "info" | "warning" | "emergency";
15
- }, true, {}, {}, {
16
- P: {};
17
- B: {};
18
- D: {};
19
- C: {};
20
- M: {};
21
- Defaults: {};
22
- }, Readonly<import("vue").ExtractPropTypes<{
23
- type: {
24
- type: import("vue").PropType<"info" | "warning" | "emergency">;
25
- default: string;
26
- };
27
- }>>, {}, {}, {}, {}, {
28
- type: "info" | "warning" | "emergency";
29
- }>;
30
- __isFragment?: undefined;
31
- __isTeleport?: undefined;
32
- __isSuspense?: undefined;
33
- } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
34
- type: {
35
- type: import("vue").PropType<"info" | "warning" | "emergency">;
36
- default: string;
37
- };
38
- }>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
39
- type: "info" | "warning" | "emergency";
40
- }, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
41
- $slots: {
42
- default?(_: {}): any;
43
- };
44
- });
45
- };
46
- export default _default;
1
+ import MucBanner from "./MucBanner.vue";
2
+ export { MucBanner };
@@ -0,0 +1,41 @@
1
+ type calloutType = "info" | "warning" | "success" | "error";
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
3
+ type?: calloutType | undefined;
4
+ }>, {
5
+ type: string;
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
7
+ type?: calloutType | undefined;
8
+ }>, {
9
+ type: string;
10
+ }>>>, {
11
+ type: calloutType;
12
+ }, {}>, {
13
+ icon?(_: {}): any;
14
+ header?(_: {}): any;
15
+ content?(_: {
16
+ class: string;
17
+ }): any;
18
+ }>;
19
+ export default _default;
20
+ type __VLS_WithDefaults<P, D> = {
21
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
22
+ default: D[K];
23
+ }> : P[K];
24
+ };
25
+ type __VLS_Prettify<T> = {
26
+ [K in keyof T]: T[K];
27
+ } & {};
28
+ type __VLS_WithTemplateSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
33
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
34
+ type __VLS_TypePropsToOption<T> = {
35
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
36
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
37
+ } : {
38
+ type: import('vue').PropType<T[K]>;
39
+ required: true;
40
+ };
41
+ };
@@ -0,0 +1,2 @@
1
+ import MucCallout from "./MucCallout.vue";
2
+ export { MucCallout };
@@ -1,4 +1,5 @@
1
- import MucButton from "./Button/MucButton.vue";
2
- import MucBanner from "./Banner/MucBanner.vue";
3
- import MucIntro from "./Intro/MucIntro.vue";
4
- export { MucButton, MucBanner, MucIntro };
1
+ import { MucBanner } from "./Banner";
2
+ import { MucButton } from "./Button";
3
+ import { MucCallout } from "./Callout";
4
+ import { MucIntro } from "./Intro";
5
+ export { MucButton, MucBanner, MucIntro, MucCallout };
@@ -1,8 +1,8 @@
1
- import { type App } from 'vue';
2
- declare function install(app: App): void;
1
+ import { type App } from "vue";
3
2
  import "../public/assets/temporary/muenchende-style.css";
3
+ declare function install(app: App): void;
4
4
  declare const _default: {
5
5
  install: typeof install;
6
6
  };
7
7
  export default _default;
8
- export * from './components';
8
+ export * from "./components";
package/package.json CHANGED
@@ -3,10 +3,11 @@
3
3
  "author": "FabianWilms",
4
4
  "description": "A vue component library of some of the components available from https://patternlab.muenchen.space",
5
5
  "license": "MIT",
6
- "version": "1.1.0",
6
+ "version": "1.2.0",
7
7
  "private": false,
8
8
  "module": "./dist/muc-patternlab-vue.es.js",
9
9
  "types": "./dist/types/index.d.ts",
10
+ "prettier": "@muenchen/prettier-codeformat",
10
11
  "repository": {
11
12
  "type": "git",
12
13
  "url": "https://github.com/it-at-m/muc-patternlab-vue"
@@ -44,6 +45,7 @@
44
45
  "vue": "^3.4.0"
45
46
  },
46
47
  "devDependencies": {
48
+ "@muenchen/prettier-codeformat": "^1.0.1",
47
49
  "@rushstack/eslint-patch": "^1.3.3",
48
50
  "@semantic-release/git": "^10.0.1",
49
51
  "@semantic-release/github": "^10.0.0",
@@ -51,8 +53,8 @@
51
53
  "@types/jsdom": "^21.1.6",
52
54
  "@types/node": "^20.11.10",
53
55
  "@vitejs/plugin-vue": "^5.0.3",
54
- "@vue/eslint-config-prettier": "^8.0.0",
55
- "@vue/eslint-config-typescript": "^12.0.0",
56
+ "@vue/eslint-config-prettier": "^9.0.0",
57
+ "@vue/eslint-config-typescript": "^13.0.0",
56
58
  "@vue/test-utils": "^2.4.4",
57
59
  "@vue/tsconfig": "^0.5.1",
58
60
  "eslint": "^8.49.0",
@@ -62,11 +64,11 @@
62
64
  "prettier": "^3.0.3",
63
65
  "rimraf": "^5.0.1",
64
66
  "semantic-release": "^23.0.0",
65
- "typescript": "~5.3.0",
67
+ "typescript": "~5.4.0",
66
68
  "vite": "^5.0.11",
67
- "vitepress": "^0.22.4",
68
69
  "vite-plugin-dts": "^3.0.0",
70
+ "vitepress": "^0.22.4",
69
71
  "vitest": "^1.2.2",
70
- "vue-tsc": "^1.8.27"
72
+ "vue-tsc": "^2.0.0"
71
73
  }
72
74
  }
@@ -1,14 +1,16 @@
1
1
  <script setup lang="ts">
2
- import {computed, type PropType} from "vue";
2
+ import type { PropType } from "vue";
3
+
4
+ import { computed } from "vue";
3
5
 
4
6
  type bannerType = "info" | "warning" | "emergency";
5
7
 
6
8
  const props = defineProps({
7
9
  type: {
8
10
  type: String as PropType<bannerType>,
9
- default: "info"
10
- }
11
- })
11
+ default: "info",
12
+ },
13
+ });
12
14
 
13
15
  const typeClass = computed(() => {
14
16
  switch (props.type) {
@@ -54,20 +56,20 @@ const typeAriaLabel = computed(() => {
54
56
  <div>
55
57
  <div>
56
58
  <div
57
- class="m-banner"
58
- :class="typeClass"
59
- :role="typeRole"
60
- :aria-label="typeAriaLabel"
59
+ class="m-banner"
60
+ :class="typeClass"
61
+ :role="typeRole"
62
+ :aria-label="typeAriaLabel"
61
63
  >
62
64
  <div class="container-fluid">
63
65
  <svg class="icon">
64
- <use href="#icon-information"/>
66
+ <use href="#icon-information" />
65
67
  </svg>
66
68
  <p>
67
- <slot/>
69
+ <slot />
68
70
  </p>
69
71
  </div>
70
72
  </div>
71
73
  </div>
72
74
  </div>
73
- </template>
75
+ </template>
@@ -1,3 +1,3 @@
1
- import MucBanner from "./MucBanner.vue"
1
+ import MucBanner from "./MucBanner.vue";
2
2
 
3
- export default { MucBanner };
3
+ export { MucBanner };
@@ -1,10 +1,10 @@
1
1
  <script setup lang="ts">
2
- const props = defineProps({
2
+ defineProps({
3
3
  expanded: {
4
4
  type: Boolean,
5
- default: false
6
- }
7
- })
5
+ default: false,
6
+ },
7
+ });
8
8
  </script>
9
9
 
10
10
  <template>
@@ -13,6 +13,4 @@ const props = defineProps({
13
13
  </button>
14
14
  </template>
15
15
 
16
- <style scoped>
17
-
18
- </style>
16
+ <style scoped></style>
@@ -1,3 +1,3 @@
1
1
  import MucButton from "./MucButton.vue";
2
2
 
3
- export { MucButton };
3
+ export { MucButton };
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <div
3
+ class="m-callout"
4
+ :class="calloutClass"
5
+ :aria-label="typeAriaLabel"
6
+ >
7
+ <div class="m-callout__inner">
8
+ <div class="m-callout__icon">
9
+ <slot name="icon">
10
+ <!-- fallback icon -->
11
+ <svg
12
+ aria-hidden="true"
13
+ class="icon"
14
+ >
15
+ <use :xlink:href="`#icon-${fallbackCalloutIcon}`"></use>
16
+ </svg>
17
+ </slot>
18
+ </div>
19
+ <div class="m-callout__body">
20
+ <div class="m-callout__body__inner">
21
+ <div class="m-callout__headline">
22
+ <slot name="header" />
23
+ </div>
24
+ <div class="m-callout__content">
25
+ <slot
26
+ name="content"
27
+ class="m-callout__content"
28
+ />
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </template>
35
+
36
+ <script setup lang="ts">
37
+ import { computed } from "vue";
38
+
39
+ type calloutType = "info" | "warning" | "success" | "error";
40
+
41
+ const props = withDefaults(
42
+ defineProps<{
43
+ type?: calloutType;
44
+ }>(),
45
+ {
46
+ type: "info",
47
+ }
48
+ );
49
+
50
+ /*
51
+ Computing the corresponding icon-component for the given comment-type
52
+ */
53
+ const fallbackCalloutIcon = computed(() => {
54
+ switch (props.type) {
55
+ case "error" || "warning":
56
+ return "warning";
57
+ case "success":
58
+ return "check";
59
+ default:
60
+ return "information";
61
+ }
62
+ });
63
+
64
+ /*
65
+ Computing the corresponding css-class for the given comment-type
66
+ */
67
+ const calloutClass = computed(() => {
68
+ switch (props.type) {
69
+ case "error":
70
+ return "m-callout--error";
71
+ case "warning":
72
+ return "m-callout--warning";
73
+ case "success":
74
+ return "m-callout--success";
75
+ default:
76
+ return "m-callout--default";
77
+ }
78
+ });
79
+
80
+ /*
81
+ Computing the corresponding aria-label for the given comment-type, currently in german
82
+ */
83
+ const typeAriaLabel = computed(() => {
84
+ switch (props.type) {
85
+ case "success":
86
+ return "Erfolgreich";
87
+ case "warning":
88
+ return "Warnung";
89
+ case "error":
90
+ return "Error";
91
+ default:
92
+ return "Information";
93
+ }
94
+ });
95
+ </script>
96
+
97
+ <style scoped>
98
+ /* class below may look unused but they are used dynamically! Do NOT remove them!! */
99
+ .m-callout--success {
100
+ background-color: #f1f6f3;
101
+ border-color: #95b9a2;
102
+ }
103
+
104
+ /* class below may look unused but they are used dynamically! Do NOT remove them!! */
105
+ .m-callout--success .m-callout__icon {
106
+ background-color: #3a7f53;
107
+ box-shadow: 0 0.3125rem 0.625rem rgba(0, 90, 159, 0.2);
108
+ }
109
+
110
+ /* class below may look unused but they are used dynamically! Do NOT remove them!! */
111
+ .m-callout--error {
112
+ background-color: #f8f2f2;
113
+ border-color: #c79a9b;
114
+ }
115
+
116
+ /* class below may look unused but they are used dynamically! Do NOT remove them!! */
117
+ .m-callout--error .m-callout__icon {
118
+ background-color: #984447;
119
+ box-shadow: 0 0.3125rem 0.625rem rgba(0, 90, 159, 0.2);
120
+ }
121
+ </style>
@@ -0,0 +1,3 @@
1
+ import MucCallout from "./MucCallout.vue";
2
+
3
+ export { MucCallout };
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  defineProps({
3
3
  title: {
4
- type: String
5
- }
6
- })
4
+ type: String,
5
+ },
6
+ });
7
7
  </script>
8
8
 
9
9
  <template>
@@ -21,4 +21,4 @@ defineProps({
21
21
  </div>
22
22
  </div>
23
23
  </div>
24
- </template>
24
+ </template>
@@ -1,3 +1,3 @@
1
- import MucIntro from "./MucIntro.vue"
1
+ import MucIntro from "./MucIntro.vue";
2
2
 
3
- export { MucIntro };
3
+ export { MucIntro };
@@ -1,5 +1,6 @@
1
- import MucButton from "./Button/MucButton.vue";
2
- import MucBanner from "./Banner/MucBanner.vue";
3
- import MucIntro from "./Intro/MucIntro.vue";
1
+ import { MucBanner } from "./Banner";
2
+ import { MucButton } from "./Button";
3
+ import { MucCallout } from "./Callout";
4
+ import { MucIntro } from "./Intro";
4
5
 
5
- export { MucButton, MucBanner, MucIntro };
6
+ export { MucButton, MucBanner, MucIntro, MucCallout };
package/src/index.ts CHANGED
@@ -1,15 +1,16 @@
1
- import { type App } from 'vue'
2
- import * as components from './components'
3
-
4
- function install (app: App) {
5
- for (const key in components) {
6
- // @ts-expect-error
7
- app.component(key, components[key])
8
- }
9
- }
1
+ import { type App } from "vue";
2
+
3
+ import * as components from "./components";
10
4
 
11
5
  import "../public/assets/temporary/muenchende-style.css";
12
6
 
13
- export default { install }
7
+ function install(app: App) {
8
+ for (const key in components) {
9
+ // @ts-expect-error
10
+ app.component(key, components[key]);
11
+ }
12
+ }
13
+
14
+ export default { install };
14
15
 
15
- export * from './components'
16
+ export * from "./components";