@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,50 @@
1
+ /**
2
+ * @class PostIcon - representing a stencil component
3
+ */
4
+ export declare class PostIcon {
5
+ /**
6
+ * The name/id of the icon (e.g. 1000, 1001, ...).
7
+ */
8
+ name: string;
9
+ /**
10
+ * The base path, where the icons are located (must be a public url).
11
+ */
12
+ base?: string;
13
+ /**
14
+ * When set to `true`, the icon will be flipped horizontally.
15
+ */
16
+ flipH?: boolean;
17
+ /**
18
+ * When set to `true`, the icon will be flipped vertically.
19
+ */
20
+ flipV?: boolean;
21
+ /**
22
+ * The `number` for the css `scale` transformation.
23
+ */
24
+ scale?: number;
25
+ /**
26
+ * The `number` of degree for the css `rotate` transformation.
27
+ */
28
+ rotate?: number;
29
+ /**
30
+ * The name of the animation (`cylon`, `cylon-vertical`, `spin`, `spin-reverse`, `fade`, `throb`).
31
+ */
32
+ animation?: string;
33
+ initialPath: string;
34
+ path: string;
35
+ svgSource: string;
36
+ svgOutput: string;
37
+ validateName(newValue?: string): void;
38
+ validateBase(newValue?: string): void;
39
+ validateFlipH(newValue?: boolean): void;
40
+ validateFlipV(newValue?: boolean): void;
41
+ validateScale(newValue?: number): void;
42
+ validateRotate(newValue?: number): void;
43
+ validateAnimation(newValue?: string): void;
44
+ connectedCallback(): void;
45
+ componentWillLoad(): void;
46
+ componentWillRender(): void;
47
+ getPath(basePath: string): string;
48
+ fetchSVG(): void;
49
+ render(): any;
50
+ }
@@ -6,65 +6,133 @@
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
8
  export namespace Components {
9
- interface MyComponent {
9
+ interface PostCollapsible {
10
10
  /**
11
- * The first name
11
+ * If `true`, the element is initially collapsed otherwise it is displayed.
12
12
  */
13
- "first": string;
13
+ "collapsed"?: boolean;
14
14
  /**
15
- * The last name
15
+ * Defines the hierarchical level of the collapsible header within the headings structure.
16
16
  */
17
- "last": string;
17
+ "headingLevel"?: number;
18
18
  /**
19
- * The middle name
19
+ * Triggers the collapse programmatically.
20
20
  */
21
- "middle": string;
22
- "write": (text: string) => Promise<void>;
21
+ "toggle": (open?: boolean) => Promise<boolean>;
22
+ }
23
+ /**
24
+ * @class PostIcon - representing a stencil component
25
+ */
26
+ interface PostIcon {
27
+ /**
28
+ * The name of the animation (`cylon`, `cylon-vertical`, `spin`, `spin-reverse`, `fade`, `throb`).
29
+ */
30
+ "animation"?: string;
31
+ /**
32
+ * The base path, where the icons are located (must be a public url).
33
+ */
34
+ "base"?: string;
35
+ /**
36
+ * When set to `true`, the icon will be flipped horizontally.
37
+ */
38
+ "flipH"?: boolean;
39
+ /**
40
+ * When set to `true`, the icon will be flipped vertically.
41
+ */
42
+ "flipV"?: boolean;
43
+ /**
44
+ * The name/id of the icon (e.g. 1000, 1001, ...).
45
+ */
46
+ "name": string;
47
+ /**
48
+ * The `number` of degree for the css `rotate` transformation.
49
+ */
50
+ "rotate"?: number;
51
+ /**
52
+ * The `number` for the css `scale` transformation.
53
+ */
54
+ "scale"?: number;
23
55
  }
24
- }
25
- export interface MyComponentCustomEvent<T> extends CustomEvent<T> {
26
- detail: T;
27
- target: HTMLMyComponentElement;
28
56
  }
29
57
  declare global {
30
- interface HTMLMyComponentElement extends Components.MyComponent, HTMLStencilElement {
58
+ interface HTMLPostCollapsibleElement extends Components.PostCollapsible, HTMLStencilElement {
59
+ }
60
+ var HTMLPostCollapsibleElement: {
61
+ prototype: HTMLPostCollapsibleElement;
62
+ new (): HTMLPostCollapsibleElement;
63
+ };
64
+ /**
65
+ * @class PostIcon - representing a stencil component
66
+ */
67
+ interface HTMLPostIconElement extends Components.PostIcon, HTMLStencilElement {
31
68
  }
32
- var HTMLMyComponentElement: {
33
- prototype: HTMLMyComponentElement;
34
- new (): HTMLMyComponentElement;
69
+ var HTMLPostIconElement: {
70
+ prototype: HTMLPostIconElement;
71
+ new (): HTMLPostIconElement;
35
72
  };
36
73
  interface HTMLElementTagNameMap {
37
- "my-component": HTMLMyComponentElement;
74
+ "post-collapsible": HTMLPostCollapsibleElement;
75
+ "post-icon": HTMLPostIconElement;
38
76
  }
39
77
  }
40
78
  declare namespace LocalJSX {
41
- interface MyComponent {
79
+ interface PostCollapsible {
80
+ /**
81
+ * If `true`, the element is initially collapsed otherwise it is displayed.
82
+ */
83
+ "collapsed"?: boolean;
84
+ /**
85
+ * Defines the hierarchical level of the collapsible header within the headings structure.
86
+ */
87
+ "headingLevel"?: number;
88
+ }
89
+ /**
90
+ * @class PostIcon - representing a stencil component
91
+ */
92
+ interface PostIcon {
93
+ /**
94
+ * The name of the animation (`cylon`, `cylon-vertical`, `spin`, `spin-reverse`, `fade`, `throb`).
95
+ */
96
+ "animation"?: string;
97
+ /**
98
+ * The base path, where the icons are located (must be a public url).
99
+ */
100
+ "base"?: string;
101
+ /**
102
+ * When set to `true`, the icon will be flipped horizontally.
103
+ */
104
+ "flipH"?: boolean;
42
105
  /**
43
- * The first name
106
+ * When set to `true`, the icon will be flipped vertically.
44
107
  */
45
- "first"?: string;
108
+ "flipV"?: boolean;
46
109
  /**
47
- * The last name
110
+ * The name/id of the icon (e.g. 1000, 1001, ...).
48
111
  */
49
- "last"?: string;
112
+ "name"?: string;
50
113
  /**
51
- * The middle name
114
+ * The `number` of degree for the css `rotate` transformation.
52
115
  */
53
- "middle"?: string;
116
+ "rotate"?: number;
54
117
  /**
55
- * This event is fired randomly
118
+ * The `number` for the css `scale` transformation.
56
119
  */
57
- "onSomeevent"?: (event: MyComponentCustomEvent<string>) => void;
120
+ "scale"?: number;
58
121
  }
59
122
  interface IntrinsicElements {
60
- "my-component": MyComponent;
123
+ "post-collapsible": PostCollapsible;
124
+ "post-icon": PostIcon;
61
125
  }
62
126
  }
63
127
  export { LocalJSX as JSX };
64
128
  declare module "@stencil/core" {
65
129
  export namespace JSX {
66
130
  interface IntrinsicElements {
67
- "my-component": LocalJSX.MyComponent & JSXBase.HTMLAttributes<HTMLMyComponentElement>;
131
+ "post-collapsible": LocalJSX.PostCollapsible & JSXBase.HTMLAttributes<HTMLPostCollapsibleElement>;
132
+ /**
133
+ * @class PostIcon - representing a stencil component
134
+ */
135
+ "post-icon": LocalJSX.PostIcon & JSXBase.HTMLAttributes<HTMLPostIconElement>;
68
136
  }
69
137
  }
70
138
  }
@@ -133,7 +133,7 @@ export interface ListenOptions {
133
133
  */
134
134
  passive?: boolean;
135
135
  }
136
- export declare type ListenTargetOptions = 'body' | 'document' | 'window';
136
+ export type ListenTargetOptions = 'body' | 'document' | 'window';
137
137
  export interface StateDecorator {
138
138
  (): PropertyDecorator;
139
139
  }
@@ -214,14 +214,16 @@ export declare const State: StateDecorator;
214
214
  * https://stenciljs.com/docs/reactive-data#watch-decorator
215
215
  */
216
216
  export declare const Watch: WatchDecorator;
217
- export declare type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
218
- export declare type ErrorHandler = (err: any, element?: HTMLElement) => void;
217
+ export type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
218
+ export type ErrorHandler = (err: any, element?: HTMLElement) => void;
219
219
  /**
220
220
  * `setMode()` is used for libraries which provide multiple "modes" for styles.
221
221
  */
222
222
  export declare const setMode: (handler: ResolutionHandler) => void;
223
223
  /**
224
- * getMode
224
+ * `getMode()` is used for libraries which provide multiple "modes" for styles.
225
+ * @param ref a reference to the node to get styles for
226
+ * @returns the current mode or undefined, if not found
225
227
  */
226
228
  export declare function getMode<T = string | undefined>(ref: any): T;
227
229
  export declare function setPlatformHelpers(helpers: {
@@ -234,6 +236,9 @@ export declare function setPlatformHelpers(helpers: {
234
236
  /**
235
237
  * Get the base path to where the assets can be found. Use `setAssetPath(path)`
236
238
  * if the path needs to be customized.
239
+ * @param path the path to use in calculating the asset path. this value will be
240
+ * used in conjunction with the base asset path
241
+ * @returns the base path
237
242
  */
238
243
  export declare function getAssetPath(path: string): string;
239
244
  /**
@@ -246,22 +251,38 @@ export declare function getAssetPath(path: string): string;
246
251
  * `setAssetPath(document.currentScript.src)`, or using a bundler's replace plugin to
247
252
  * dynamically set the path at build time, such as `setAssetPath(process.env.ASSET_PATH)`.
248
253
  * But do note that this configuration depends on how your script is bundled, or lack of
249
- * bunding, and where your assets can be loaded from. Additionally custom bundling
254
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
250
255
  * will have to ensure the static assets are copied to its build directory.
256
+ * @param path the asset path to set
257
+ * @returns the set path
251
258
  */
252
259
  export declare function setAssetPath(path: string): string;
253
260
  /**
254
- * getElement
261
+ * Used to specify a nonce value that corresponds with an application's
262
+ * [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
263
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
264
+ * Alternatively, the nonce value can be set on a `meta` tag in the DOM head
265
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) and will result in the same behavior.
266
+ * @param nonce The value to be used for the nonce attribute.
267
+ */
268
+ export declare function setNonce(nonce: string): void;
269
+ /**
270
+ * Retrieve a Stencil element for a given reference
271
+ * @param ref the ref to get the Stencil element for
272
+ * @returns a reference to the element
255
273
  */
256
274
  export declare function getElement(ref: any): HTMLStencilElement;
257
275
  /**
258
276
  * Schedules a new render of the given instance or element even if no state changed.
259
277
  *
260
- * Notice `forceUpdate()` is not syncronous and might perform the DOM render in the next frame.
278
+ * Notice `forceUpdate()` is not synchronous and might perform the DOM render in the next frame.
279
+ *
280
+ * @param ref the node/element to force the re-render of
261
281
  */
262
282
  export declare function forceUpdate(ref: any): void;
263
283
  /**
264
284
  * getRenderingRef
285
+ * @returns the rendering ref
265
286
  */
266
287
  export declare function getRenderingRef(): any;
267
288
  export interface HTMLStencilElement extends HTMLElement {
@@ -272,6 +293,8 @@ export interface HTMLStencilElement extends HTMLElement {
272
293
  * in the best moment to perform DOM mutation without causing layout thrashing.
273
294
  *
274
295
  * For further information: https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing
296
+ *
297
+ * @param task the DOM-write to schedule
275
298
  */
276
299
  export declare function writeTask(task: RafCallback): void;
277
300
  /**
@@ -279,6 +302,8 @@ export declare function writeTask(task: RafCallback): void;
279
302
  * in the best moment to perform DOM reads without causing layout thrashing.
280
303
  *
281
304
  * For further information: https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing
305
+ *
306
+ * @param task the DOM-read to schedule
282
307
  */
283
308
  export declare function readTask(task: RafCallback): void;
284
309
  /**
@@ -417,13 +442,57 @@ interface HostAttributes {
417
442
  ref?: (el: HTMLElement | null) => void;
418
443
  [prop: string]: any;
419
444
  }
445
+ /**
446
+ * Utilities for working with functional Stencil components. An object
447
+ * conforming to this interface is passed by the Stencil runtime as the third
448
+ * argument to a functional component, allowing component authors to work with
449
+ * features like children.
450
+ *
451
+ * The children of a functional component will be passed as the second
452
+ * argument, so a functional component which uses these utils to transform its
453
+ * children might look like the following:
454
+ *
455
+ * ```ts
456
+ * export const AddClass: FunctionalComponent = (_, children, utils) => (
457
+ * utils.map(children, child => ({
458
+ * ...child,
459
+ * vattrs: {
460
+ * ...child.vattrs,
461
+ * class: `${child.vattrs.class} add-class`
462
+ * }
463
+ * }))
464
+ * );
465
+ * ```
466
+ *
467
+ * For more see the Stencil documentation, here:
468
+ * https://stenciljs.com/docs/functional-components
469
+ */
420
470
  export interface FunctionalUtilities {
471
+ /**
472
+ * Utility for reading the children of a functional component at runtime.
473
+ * Since the Stencil runtime uses a different interface for children it is
474
+ * not recommendeded to read the children directly, and is preferable to use
475
+ * this utility to, for instance, perform a side effect for each child.
476
+ */
421
477
  forEach: (children: VNode[], cb: (vnode: ChildNode, index: number, array: ChildNode[]) => void) => void;
478
+ /**
479
+ * Utility for transforming the children of a functional component. Given an
480
+ * array of children and a callback this will return a list of the results of
481
+ * passing each child to the supplied callback.
482
+ */
422
483
  map: (children: VNode[], cb: (vnode: ChildNode, index: number, array: ChildNode[]) => ChildNode) => VNode[];
423
484
  }
424
485
  export interface FunctionalComponent<T = {}> {
425
486
  (props: T, children: VNode[], utils: FunctionalUtilities): VNode | VNode[];
426
487
  }
488
+ /**
489
+ * A Child VDOM node
490
+ *
491
+ * This has most of the same properties as {@link VNode} but friendlier names
492
+ * (i.e. `vtag` instead of `$tag$`, `vchildren` instead of `$children$`) in
493
+ * order to provide a friendlier public interface for users of the
494
+ * {@link FunctionalUtilities}).
495
+ */
427
496
  export interface ChildNode {
428
497
  vtag?: string | number | Function;
429
498
  vkey?: string | number;
@@ -470,6 +539,9 @@ export declare function h(sel: any, children: Array<VNode | undefined | null>):
470
539
  export declare function h(sel: any, data: VNodeData | null, text: string): VNode;
471
540
  export declare function h(sel: any, data: VNodeData | null, children: Array<VNode | undefined | null>): VNode;
472
541
  export declare function h(sel: any, data: VNodeData | null, children: VNode): VNode;
542
+ /**
543
+ * A virtual DOM node
544
+ */
473
545
  export interface VNode {
474
546
  $flags$: number;
475
547
  $tag$: string | number | Function;
@@ -820,8 +892,8 @@ export declare namespace JSXBase {
820
892
  accept?: string;
821
893
  allowdirs?: boolean;
822
894
  alt?: string;
823
- autoCapitalize?: any;
824
- autocapitalize?: any;
895
+ autoCapitalize?: string;
896
+ autocapitalize?: string;
825
897
  autoComplete?: string;
826
898
  autocomplete?: string;
827
899
  autoFocus?: boolean;
@@ -1145,8 +1217,8 @@ export declare namespace JSXBase {
1145
1217
  resource?: string;
1146
1218
  typeof?: string;
1147
1219
  vocab?: string;
1148
- autoCapitalize?: any;
1149
- autocapitalize?: any;
1220
+ autoCapitalize?: string;
1221
+ autocapitalize?: string;
1150
1222
  autoCorrect?: string;
1151
1223
  autocorrect?: string;
1152
1224
  autoSave?: string;
@@ -1437,12 +1509,12 @@ export declare namespace JSXBase {
1437
1509
  onCutCapture?: (event: ClipboardEvent) => void;
1438
1510
  onPaste?: (event: ClipboardEvent) => void;
1439
1511
  onPasteCapture?: (event: ClipboardEvent) => void;
1440
- onCompositionEnd?: (event: CompositionEvent) => void;
1441
- onCompositionEndCapture?: (event: CompositionEvent) => void;
1442
- onCompositionStart?: (event: CompositionEvent) => void;
1443
- onCompositionStartCapture?: (event: CompositionEvent) => void;
1444
- onCompositionUpdate?: (event: CompositionEvent) => void;
1445
- onCompositionUpdateCapture?: (event: CompositionEvent) => void;
1512
+ onCompositionend?: (event: CompositionEvent) => void;
1513
+ onCompositionendCapture?: (event: CompositionEvent) => void;
1514
+ onCompositionstart?: (event: CompositionEvent) => void;
1515
+ onCompositionstartCapture?: (event: CompositionEvent) => void;
1516
+ onCompositionupdate?: (event: CompositionEvent) => void;
1517
+ onCompositionupdateCapture?: (event: CompositionEvent) => void;
1446
1518
  onFocus?: (event: FocusEvent) => void;
1447
1519
  onFocusCapture?: (event: FocusEvent) => void;
1448
1520
  onFocusin?: (event: FocusEvent) => void;
@@ -1453,8 +1525,8 @@ export declare namespace JSXBase {
1453
1525
  onBlurCapture?: (event: FocusEvent) => void;
1454
1526
  onChange?: (event: Event) => void;
1455
1527
  onChangeCapture?: (event: Event) => void;
1456
- onInput?: (event: Event) => void;
1457
- onInputCapture?: (event: Event) => void;
1528
+ onInput?: (event: InputEvent) => void;
1529
+ onInputCapture?: (event: InputEvent) => void;
1458
1530
  onReset?: (event: Event) => void;
1459
1531
  onResetCapture?: (event: Event) => void;
1460
1532
  onSubmit?: (event: Event) => void;
@@ -0,0 +1,3 @@
1
+ export declare function getElementHeight(el: HTMLElement): number;
2
+ export declare function getElementHeight(el: HTMLElement, classWhenShown: string): number;
3
+ export declare function getElementHeight(el: HTMLElement, classesWhenShown: string[]): number;
@@ -0,0 +1,4 @@
1
+ export * from './get-element-height';
2
+ export * from './on-transition-end';
3
+ export * from './property-checkers';
4
+ export * from './should-reduce-motion';
@@ -0,0 +1 @@
1
+ export declare function onTransitionEnd(el: HTMLElement): Promise<void>;
@@ -0,0 +1,5 @@
1
+ export declare function checkType(value: unknown, type: string, errorMessage: string): void;
2
+ export declare function checkEmptyOrType(value: unknown, type: string, errorMessage: string): void;
3
+ export declare function checkOneOf<T>(value: T, possibleValues: T[], errorMessage: string): void;
4
+ export declare function checkEmptyOrOneOf<T>(value: T, possibleValues: T[], errorMessage: string): void;
5
+ export declare function checkBoolean(value: unknown, errorMessage: string): void;
@@ -0,0 +1 @@
1
+ export declare function shouldReduceMotion(): boolean;
package/loader/index.d.ts CHANGED
@@ -10,3 +10,12 @@ export interface CustomElementsDefineOptions {
10
10
  }
11
11
  export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
12
12
  export declare function applyPolyfills(): Promise<void>;
13
+
14
+ /**
15
+ * Used to specify a nonce value that corresponds with an application's CSP.
16
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
17
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
18
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
19
+ * will result in the same behavior.
20
+ */
21
+ export declare function setNonce(nonce: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swisspost/design-system-components",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.3.0",
4
4
  "description": "A collection of web components built with Stencil JS for the Swiss Post Design System.",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.cjs.js",
@@ -11,6 +11,7 @@
11
11
  "collection": "dist/collection/collection-manifest.json",
12
12
  "collection:main": "dist/collection/index.js",
13
13
  "unpkg": "dist/post-components/post-components.esm.js",
14
+ "private": false,
14
15
  "repository": {
15
16
  "type": "git",
16
17
  "url": "https://github.com/swisspost/design-system"
@@ -20,51 +21,39 @@
20
21
  "loader/"
21
22
  ],
22
23
  "publishConfig": {
23
- "access": "public"
24
+ "access": "public",
25
+ "linkDirectory": true
24
26
  },
25
27
  "dependencies": {
26
- "@stencil/core": "^2.13.0",
27
- "@stencil/sass": "^2.0.0",
28
- "@swisspost/design-system-styles": "5.0.0-beta.4",
29
- "sass": "^1.49.7"
28
+ "@popperjs/core": "2.11.6",
29
+ "@stencil/core": "3.0.1",
30
+ "@stencil/react-output-target": "0.4.0",
31
+ "@stencil/sass": "2.0.3",
32
+ "@swisspost/design-system-styles": "5.4.0",
33
+ "bootstrap": "5.2.3",
34
+ "puppeteer": "19.7.2",
35
+ "sass": "1.58.3"
30
36
  },
31
37
  "devDependencies": {
32
- "@babel/core": "7.19.6",
33
- "@percy/cli": "1.12.0",
34
- "@percy/storybook": "4.3.4",
35
- "@popperjs/core": "2.11.6",
36
- "@pxtrn/storybook-addon-docs-stencil": "6.4.1",
37
- "@storybook/addon-actions": "6.5.13",
38
- "@storybook/addon-essentials": "6.5.13",
39
- "@storybook/addon-links": "6.5.13",
40
- "@storybook/html": "6.5.13",
38
+ "@percy/cli": "1.20.0",
39
+ "@percy/cypress": "3.1.2",
41
40
  "@types/jest": "27.5.2",
42
- "babel-loader": "8.2.5",
43
- "bootstrap": "5.1.3",
44
- "cypress": "10.11.0",
41
+ "cypress": "12.6.0",
45
42
  "cypress-storybook": "0.5.1",
46
43
  "jest": "27.5.1",
47
44
  "jest-cli": "27.5.1",
48
45
  "npm-run-all": "4.1.5",
49
- "react": "16.14.0",
50
- "react-dom": "16.14.0",
51
- "start-server-and-test": "1.14.0",
52
- "typescript": "4.8.4",
53
- "webpack": "5.74.0"
46
+ "typescript": "4.9.5"
54
47
  },
55
48
  "scripts": {
56
- "start": "npm-run-all stencil:build --parallel stencil:start storybook:start",
57
- "build": "npm-run-all stencil:build storybook:build",
58
- "test": "npm-run-all stencil:build --parallel stencil:test storybook:test",
59
- "stencil:start": "stencil build --watch --docs-readme",
60
- "stencil:build": "stencil build --docs-readme",
61
- "stencil:test": "stencil test --spec",
62
- "stencil:test:watch": "stencil test --spec --watchAll",
63
- "stencil:generate": "stencil generate",
64
- "storybook:start": "start-storybook -p 9203",
65
- "storybook:start:headless": "start-storybook -p 9303 -s www --no-open",
66
- "storybook:build": "build-storybook",
67
- "storybook:test": "start-server-and-test storybook:start:headless 9303 'cypress run --record false'",
68
- "cypress:open": "cypress open"
49
+ "start": "stencil build --watch --docs-readme",
50
+ "build": "stencil build --docs-readme",
51
+ "test": "npm run unit",
52
+ "unit": "stencil test --spec",
53
+ "unit:watch": "stencil test --spec --watchAll --silent",
54
+ "e2e": "cypress run",
55
+ "e2e:watch": "cypress open",
56
+ "snapshots": "percy exec -- cypress run --config-file ./cypress.snapshot.config.js",
57
+ "generate": "stencil generate"
69
58
  }
70
59
  }
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-5c30acf6.js');
6
-
7
- function format(first, middle, last) {
8
- return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
9
- }
10
-
11
- const myComponentCss = ":host{display:block}";
12
-
13
- const MyComponent = class {
14
- constructor(hostRef) {
15
- index.registerInstance(this, hostRef);
16
- this.someevent = index.createEvent(this, "someevent", 7);
17
- /**
18
- * The middle name
19
- */
20
- this.middle = '';
21
- }
22
- async write(text) {
23
- console.log(this.getText());
24
- this.someevent.emit(text);
25
- }
26
- getText() {
27
- return format(this.first, this.middle, this.last);
28
- }
29
- render() {
30
- return index.h("div", null, "Hello, World! I'm ", this.getText());
31
- }
32
- };
33
- MyComponent.style = myComponentCss;
34
-
35
- exports.my_component = MyComponent;
@@ -1,3 +0,0 @@
1
- :host {
2
- display: block;
3
- }