@swisspost/design-system-components 1.0.0-beta.3 → 1.3.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.
Files changed (111) hide show
  1. package/README.md +15 -23
  2. package/dist/cjs/{index-5c30acf6.js → index-8880977f.js} +588 -154
  3. package/dist/cjs/index-8880977f.js.map +1 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/index.cjs.js.map +1 -0
  6. package/dist/cjs/loader.cjs.js +6 -3
  7. package/dist/cjs/loader.cjs.js.map +1 -0
  8. package/dist/cjs/post-collapsible.cjs.entry.js +134 -0
  9. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -0
  10. package/dist/cjs/post-components.cjs.js +12 -3
  11. package/dist/cjs/post-components.cjs.js.map +1 -0
  12. package/dist/cjs/post-icon.cjs.entry.js +142 -0
  13. package/dist/cjs/post-icon.cjs.entry.js.map +1 -0
  14. package/dist/cjs/property-checkers-586ad9d4.js +40 -0
  15. package/dist/cjs/property-checkers-586ad9d4.js.map +1 -0
  16. package/dist/collection/collection-manifest.json +4 -3
  17. package/dist/collection/components/post-collapsible/post-collapsible.css +17297 -0
  18. package/dist/collection/components/post-collapsible/post-collapsible.js +173 -0
  19. package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -0
  20. package/dist/collection/components/post-icon/post-icon.css +94 -0
  21. package/dist/collection/components/post-icon/post-icon.js +291 -0
  22. package/dist/collection/components/post-icon/post-icon.js.map +1 -0
  23. package/dist/collection/index.js +1 -0
  24. package/dist/collection/index.js.map +1 -0
  25. package/dist/collection/utils/get-element-height.js +15 -0
  26. package/dist/collection/utils/get-element-height.js.map +1 -0
  27. package/dist/collection/utils/index.js +8 -0
  28. package/dist/collection/utils/index.js.map +1 -0
  29. package/dist/collection/utils/on-transition-end.js +18 -0
  30. package/dist/collection/utils/on-transition-end.js.map +1 -0
  31. package/dist/collection/utils/property-checkers.js +31 -0
  32. package/dist/collection/utils/property-checkers.js.map +1 -0
  33. package/dist/collection/utils/should-reduce-motion.js +7 -0
  34. package/dist/collection/utils/should-reduce-motion.js.map +1 -0
  35. package/dist/components/index.d.ts +9 -4
  36. package/dist/components/index.js +3 -2
  37. package/dist/components/index.js.map +1 -0
  38. package/dist/components/post-collapsible.d.ts +11 -0
  39. package/dist/components/post-collapsible.js +158 -0
  40. package/dist/components/post-collapsible.js.map +1 -0
  41. package/dist/components/{my-component.d.ts → post-icon.d.ts} +4 -4
  42. package/dist/components/post-icon.js +168 -0
  43. package/dist/components/post-icon.js.map +1 -0
  44. package/dist/components/property-checkers.js +34 -0
  45. package/dist/components/property-checkers.js.map +1 -0
  46. package/dist/docs.d.ts +24 -0
  47. package/dist/docs.json +153 -41
  48. package/dist/esm/{index-865c32d6.js → index-6d5a72fa.js} +586 -154
  49. package/dist/esm/index-6d5a72fa.js.map +1 -0
  50. package/dist/esm/index.js +2 -0
  51. package/dist/esm/index.js.map +1 -0
  52. package/dist/esm/loader.js +6 -3
  53. package/dist/esm/loader.js.map +1 -0
  54. package/dist/esm/polyfills/css-shim.js +1 -1
  55. package/dist/esm/post-collapsible.entry.js +130 -0
  56. package/dist/esm/post-collapsible.entry.js.map +1 -0
  57. package/dist/esm/post-components.js +9 -3
  58. package/dist/esm/post-components.js.map +1 -0
  59. package/dist/esm/post-icon.entry.js +138 -0
  60. package/dist/esm/post-icon.entry.js.map +1 -0
  61. package/dist/esm/property-checkers-484ca671.js +34 -0
  62. package/dist/esm/property-checkers-484ca671.js.map +1 -0
  63. package/dist/post-components/index.esm.js +2 -0
  64. package/dist/post-components/index.esm.js.map +1 -0
  65. package/dist/post-components/p-7cd9c1ad.js +2 -0
  66. package/dist/post-components/p-7cd9c1ad.js.map +1 -0
  67. package/dist/post-components/p-a93114b9.js +3 -0
  68. package/dist/post-components/p-a93114b9.js.map +1 -0
  69. package/dist/post-components/p-b07185a3.entry.js +2 -0
  70. package/dist/post-components/p-b07185a3.entry.js.map +1 -0
  71. package/dist/post-components/p-c4af958b.entry.js +2 -0
  72. package/dist/post-components/p-c4af958b.entry.js.map +1 -0
  73. package/dist/post-components/post-components.esm.js +2 -1
  74. package/dist/post-components/post-components.esm.js.map +1 -0
  75. package/dist/types/components/post-collapsible/post-collapsible.d.ts +30 -0
  76. package/dist/types/components/post-icon/post-icon.d.ts +50 -0
  77. package/dist/types/components.d.ts +96 -28
  78. package/dist/types/stencil-public-runtime.d.ts +91 -19
  79. package/dist/types/utils/get-element-height.d.ts +3 -0
  80. package/dist/types/utils/index.d.ts +4 -0
  81. package/dist/types/utils/on-transition-end.d.ts +1 -0
  82. package/dist/types/utils/property-checkers.d.ts +5 -0
  83. package/dist/types/utils/should-reduce-motion.d.ts +1 -0
  84. package/loader/index.d.ts +9 -0
  85. package/package.json +25 -36
  86. package/dist/cjs/my-component.cjs.entry.js +0 -35
  87. package/dist/collection/components/my-component/my-component.css +0 -3
  88. package/dist/collection/components/my-component/my-component.js +0 -129
  89. package/dist/collection/components/my-component/my-component.stories.js +0 -19
  90. package/dist/collection/stories/Button.js +0 -21
  91. package/dist/collection/stories/Button.stories.js +0 -48
  92. package/dist/collection/stories/Header.js +0 -45
  93. package/dist/collection/stories/Header.stories.js +0 -20
  94. package/dist/collection/stories/Page.js +0 -67
  95. package/dist/collection/stories/Page.stories.js +0 -24
  96. package/dist/collection/stories/assets/code-brackets.svg +0 -1
  97. package/dist/collection/stories/assets/colors.svg +0 -1
  98. package/dist/collection/stories/assets/comments.svg +0 -1
  99. package/dist/collection/stories/assets/direction.svg +0 -1
  100. package/dist/collection/stories/assets/flow.svg +0 -1
  101. package/dist/collection/stories/assets/plugin.svg +0 -1
  102. package/dist/collection/stories/assets/repo.svg +0 -1
  103. package/dist/collection/stories/assets/stackalt.svg +0 -1
  104. package/dist/collection/utils/utils.js +0 -3
  105. package/dist/components/my-component.js +0 -54
  106. package/dist/esm/my-component.entry.js +0 -31
  107. package/dist/post-components/p-89fc10d3.js +0 -2
  108. package/dist/post-components/p-e4e802f7.entry.js +0 -1
  109. package/dist/types/components/my-component/my-component.d.ts +0 -22
  110. package/dist/types/components/my-component/my-component.stories.d.ts +0 -12
  111. package/dist/types/utils/utils.d.ts +0 -1
@@ -0,0 +1,31 @@
1
+ const EMPTY_VALUES = [undefined, null, ''];
2
+ export function checkType(value, type, errorMessage) {
3
+ const lowerCaseType = type.toLowerCase();
4
+ const typeIsArray = lowerCaseType === 'array';
5
+ const valueIsArray = Array.isArray(value);
6
+ if (typeIsArray || valueIsArray) {
7
+ if ((typeIsArray && !valueIsArray) || (!typeIsArray && valueIsArray))
8
+ throw new Error(errorMessage);
9
+ }
10
+ else {
11
+ if (typeof value !== lowerCaseType)
12
+ throw new Error(errorMessage);
13
+ }
14
+ }
15
+ export function checkEmptyOrType(value, type, errorMessage) {
16
+ if (!EMPTY_VALUES.some(v => v === value))
17
+ checkType(value, type, errorMessage);
18
+ }
19
+ export function checkOneOf(value, possibleValues, errorMessage) {
20
+ if (!possibleValues.includes(value))
21
+ throw new Error(errorMessage);
22
+ }
23
+ export function checkEmptyOrOneOf(value, possibleValues, errorMessage) {
24
+ if (!EMPTY_VALUES.some(v => v === value))
25
+ checkOneOf(value, possibleValues, errorMessage);
26
+ }
27
+ export function checkBoolean(value, errorMessage) {
28
+ if (typeof value !== 'boolean')
29
+ throw new Error(errorMessage);
30
+ }
31
+ //# sourceMappingURL=property-checkers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-checkers.js","sourceRoot":"","sources":["../../src/utils/property-checkers.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AAE3C,MAAM,UAAU,SAAS,CAAC,KAAc,EAAE,IAAY,EAAE,YAAoB;EAC1E,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;EACzC,MAAM,WAAW,GAAG,aAAa,KAAK,OAAO,CAAC;EAC9C,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;EAE1C,IAAI,WAAW,IAAI,YAAY,EAAE;IAC/B,IAAI,CAAC,WAAW,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,IAAI,YAAY,CAAC;MAClE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;GACjC;OAAM;IACL,IAAI,OAAO,KAAK,KAAK,aAAa;MAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;GACnE;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,IAAY,EAAE,YAAoB;EACjF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC;IAAE,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,UAAU,CAAI,KAAQ,EAAE,cAAmB,EAAE,YAAoB;EAC/E,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAI,KAAQ,EAAE,cAAmB,EAAE,YAAoB;EACtF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC;IAAE,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AAC5F,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc,EAAE,YAAoB;EAC/D,IAAI,OAAO,KAAK,KAAK,SAAS;IAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AAChE,CAAC","sourcesContent":["const EMPTY_VALUES = [undefined, null, ''];\n\nexport function checkType(value: unknown, type: string, errorMessage: string) {\n const lowerCaseType = type.toLowerCase();\n const typeIsArray = lowerCaseType === 'array';\n const valueIsArray = Array.isArray(value);\n\n if (typeIsArray || valueIsArray) {\n if ((typeIsArray && !valueIsArray) || (!typeIsArray && valueIsArray))\n throw new Error(errorMessage);\n } else {\n if (typeof value !== lowerCaseType) throw new Error(errorMessage);\n }\n}\n\nexport function checkEmptyOrType(value: unknown, type: string, errorMessage: string) {\n if (!EMPTY_VALUES.some(v => v === value)) checkType(value, type, errorMessage);\n}\n\nexport function checkOneOf<T>(value: T, possibleValues: T[], errorMessage: string) {\n if (!possibleValues.includes(value)) throw new Error(errorMessage);\n}\n\nexport function checkEmptyOrOneOf<T>(value: T, possibleValues: T[], errorMessage: string) {\n if (!EMPTY_VALUES.some(v => v === value)) checkOneOf(value, possibleValues, errorMessage);\n}\n\nexport function checkBoolean(value: unknown, errorMessage: string) {\n if (typeof value !== 'boolean') throw new Error(errorMessage);\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Copyright 2022 by Swiss Post, Information Technology
3
+ */
4
+ export function shouldReduceMotion() {
5
+ return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
6
+ }
7
+ //# sourceMappingURL=should-reduce-motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"should-reduce-motion.js","sourceRoot":"","sources":["../../src/utils/should-reduce-motion.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,UAAU,kBAAkB;EAChC,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC","sourcesContent":["/*\n * Copyright 2022 by Swiss Post, Information Technology\n */\n\nexport function shouldReduceMotion(): boolean {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n"]}
@@ -1,6 +1,3 @@
1
- /* PostComponents custom elements */
2
- export { MyComponent as MyComponent } from '../types/components/my-component/my-component';
3
-
4
1
  /**
5
2
  * Used to manually set the base path where assets can be found.
6
3
  * If the script is used as "module", it's recommended to use "import.meta.url",
@@ -13,10 +10,18 @@ export { MyComponent as MyComponent } from '../types/components/my-component/my-
13
10
  */
14
11
  export declare const setAssetPath: (path: string) => void;
15
12
 
13
+ /**
14
+ * Used to specify a nonce value that corresponds with an application's CSP.
15
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
16
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
17
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
18
+ * will result in the same behavior.
19
+ */
20
+ export declare const setNonce: (nonce: string) => void
21
+
16
22
  export interface SetPlatformOptions {
17
23
  raf?: (c: FrameRequestCallback) => number;
18
24
  ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
19
25
  rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
20
26
  }
21
27
  export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
22
- export * from '../types';
@@ -1,2 +1,3 @@
1
- export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
2
- export { MyComponent, defineCustomElement as defineCustomElementMyComponent } from './my-component.js';
1
+ export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"file":"index.js","mappings":"","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PostCollapsible extends Components.PostCollapsible, HTMLElement {}
4
+ export const PostCollapsible: {
5
+ prototype: PostCollapsible;
6
+ new (): PostCollapsible;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;