@ongov/ontario-design-system-component-library 4.3.1-alpha.1 → 5.0.0-alpha.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 (108) hide show
  1. package/dist/cjs/index-88d5cf20.js +2 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/{ontario-accordion_43.cjs.entry.js → ontario-accordion_44.cjs.entry.js} +339 -78
  4. package/dist/cjs/ontario-accordion_44.cjs.entry.js.map +1 -0
  5. package/dist/cjs/ontario-design-system-components.cjs.js +1 -1
  6. package/dist/collection/collection-manifest.json +1 -0
  7. package/dist/collection/components/ontario-card/ontario-card-types.js +29 -2
  8. package/dist/collection/components/ontario-card/ontario-card-types.js.map +1 -1
  9. package/dist/collection/components/ontario-card/ontario-card.css +252 -34
  10. package/dist/collection/components/ontario-card/ontario-card.js +102 -78
  11. package/dist/collection/components/ontario-card/ontario-card.js.map +1 -1
  12. package/dist/collection/components/ontario-card/test/ontario-cards.spec.js +23 -13
  13. package/dist/collection/components/ontario-card/test/ontario-cards.spec.js.map +1 -1
  14. package/dist/collection/components/ontario-header/service-ontario-header.css +0 -3
  15. package/dist/collection/components/ontario-search-box/assets/ontario-icon-close.svg +1 -0
  16. package/dist/collection/components/ontario-search-box/assets/ontario-logo--mobile.svg +6 -0
  17. package/dist/collection/components/ontario-search-box/ontario-search-box.css +823 -0
  18. package/dist/collection/components/ontario-search-box/ontario-search-box.js +584 -0
  19. package/dist/collection/components/ontario-search-box/ontario-search-box.js.map +1 -0
  20. package/dist/collection/components/ontario-search-box/test/ontario-search-box.e2e.js +20 -0
  21. package/dist/collection/components/ontario-search-box/test/ontario-search-box.e2e.js.map +1 -0
  22. package/dist/collection/components/ontario-search-box/test/ontario-search-box.spec.js +19 -0
  23. package/dist/collection/components/ontario-search-box/test/ontario-search-box.spec.js.map +1 -0
  24. package/dist/collection/components/ontario-step-indicator/ontario-step-indicator.js +5 -5
  25. package/dist/collection/components/ontario-table/ontario-table.js +5 -5
  26. package/dist/collection/components/ontario-textarea/ontario-textarea.js +3 -3
  27. package/dist/collection/utils/common/input/input.js +3 -0
  28. package/dist/collection/utils/common/input/input.js.map +1 -1
  29. package/dist/collection/utils/common/input-caption/input-caption.js +5 -3
  30. package/dist/collection/utils/common/input-caption/input-caption.js.map +1 -1
  31. package/dist/components/error-message.js +1 -324
  32. package/dist/components/error-message.js.map +1 -1
  33. package/dist/components/event-handler.js +330 -0
  34. package/dist/components/event-handler.js.map +1 -0
  35. package/dist/components/input.js +3 -0
  36. package/dist/components/input.js.map +1 -1
  37. package/dist/components/ontario-card.js +116 -64
  38. package/dist/components/ontario-card.js.map +1 -1
  39. package/dist/components/ontario-checkboxes.js +2 -1
  40. package/dist/components/ontario-checkboxes.js.map +1 -1
  41. package/dist/components/ontario-date-input.js +2 -1
  42. package/dist/components/ontario-date-input.js.map +1 -1
  43. package/dist/components/ontario-dropdown-list.js +2 -1
  44. package/dist/components/ontario-dropdown-list.js.map +1 -1
  45. package/dist/components/ontario-header.js +2 -4
  46. package/dist/components/ontario-header.js.map +1 -1
  47. package/dist/components/ontario-icon-search2.js +6 -0
  48. package/dist/components/ontario-icon-search2.js.map +1 -0
  49. package/dist/components/ontario-input.js +2 -1
  50. package/dist/components/ontario-input.js.map +1 -1
  51. package/dist/components/ontario-radio-buttons.js +2 -1
  52. package/dist/components/ontario-radio-buttons.js.map +1 -1
  53. package/dist/components/ontario-search-box.d.ts +11 -0
  54. package/dist/components/ontario-search-box.js +269 -0
  55. package/dist/components/ontario-search-box.js.map +1 -0
  56. package/dist/components/ontario-step-indicator.js +5 -5
  57. package/dist/components/ontario-table.js +5 -5
  58. package/dist/components/ontario-textarea.js +5 -4
  59. package/dist/components/ontario-textarea.js.map +1 -1
  60. package/dist/esm/index-603026f7.js +2 -2
  61. package/dist/esm/loader.js +1 -1
  62. package/dist/esm/{ontario-accordion_43.entry.js → ontario-accordion_44.entry.js} +339 -78
  63. package/dist/esm/ontario-accordion_44.entry.js.map +1 -0
  64. package/dist/esm/ontario-design-system-components.js +1 -1
  65. package/dist/ontario-design-system-components/ontario-design-system-components.esm.js +1 -1
  66. package/dist/ontario-design-system-components/ontario-design-system-components.esm.js.map +1 -1
  67. package/dist/ontario-design-system-components/{p-abe58ec9.entry.js → p-9c3a1be9.entry.js} +1925 -1728
  68. package/dist/ontario-design-system-components/p-9c3a1be9.entry.js.map +1 -0
  69. package/dist/types/components/ontario-card/ontario-card-types.d.ts +4 -4
  70. package/dist/types/components/ontario-card/ontario-card.d.ts +40 -29
  71. package/dist/types/components/ontario-search-box/ontario-search-box.d.ts +180 -0
  72. package/dist/types/components.d.ts +199 -16
  73. package/dist/types/utils/common/input/input.d.ts +2 -1
  74. package/dist/types/utils/common/input-caption/input-caption.d.ts +7 -1
  75. package/package.json +2 -2
  76. package/src/components/ontario-card/ontario-card-types.tsx +33 -4
  77. package/src/components/ontario-card/ontario-card.scss +54 -40
  78. package/src/components/ontario-card/ontario-card.tsx +94 -68
  79. package/src/components/ontario-card/readme.md +57 -27
  80. package/src/components/ontario-card/test/__snapshots__/ontario-cards.spec.tsx.snap +66 -0
  81. package/src/components/ontario-card/test/ontario-cards.spec.tsx +27 -13
  82. package/src/components/ontario-card-collection/readme.md +13 -13
  83. package/src/components/ontario-checkbox/ontario-checkboxes.scss +0 -1
  84. package/src/components/ontario-header/service-ontario-header.scss +0 -4
  85. package/src/components/ontario-hint-text/readme.md +2 -0
  86. package/src/components/ontario-radio-buttons/ontario-radio-buttons.scss +0 -1
  87. package/src/components/ontario-search-box/assets/ontario-icon-close.svg +1 -0
  88. package/src/components/ontario-search-box/assets/ontario-logo--mobile.svg +6 -0
  89. package/src/components/ontario-search-box/ontario-search-box.scss +141 -0
  90. package/src/components/ontario-search-box/ontario-search-box.tsx +341 -0
  91. package/src/components/ontario-search-box/readme.md +132 -0
  92. package/src/components/ontario-search-box/test/__snapshots__/ontario-search-box.spec.tsx.snap +35 -0
  93. package/src/components/ontario-search-box/test/ontario-search-box.e2e.ts +21 -0
  94. package/src/components/ontario-search-box/test/ontario-search-box.spec.tsx +22 -0
  95. package/src/components.d.ts +199 -16
  96. package/src/index.html +287 -52
  97. package/src/utils/common/input/input.tsx +4 -1
  98. package/src/utils/common/input-caption/input-caption.tsx +9 -3
  99. package/www/build/ontario-design-system-components.esm.js +1 -1
  100. package/www/build/ontario-design-system-components.esm.js.map +1 -1
  101. package/www/build/{p-fdc9ab6d.js → p-84035ac3.js} +1 -1
  102. package/www/build/{p-abe58ec9.entry.js → p-9c3a1be9.entry.js} +1925 -1728
  103. package/www/build/p-9c3a1be9.entry.js.map +1 -0
  104. package/www/index.html +261 -52
  105. package/dist/cjs/ontario-accordion_43.cjs.entry.js.map +0 -1
  106. package/dist/esm/ontario-accordion_43.entry.js.map +0 -1
  107. package/dist/ontario-design-system-components/p-abe58ec9.entry.js.map +0 -1
  108. package/www/build/p-abe58ec9.entry.js.map +0 -1
@@ -1,109 +1,135 @@
1
1
  import { h } from '@stencil/core';
2
- import { CardTypes, HeaderTypes } from './ontario-card-types';
2
+ import { HeaderColours, Layouts } from './ontario-card-types';
3
3
  import { validateValueAgainstArray } from '../../utils/validation/validation-functions';
4
4
  import { ConsoleMessageClass } from '../../utils/console-message/console-message';
5
+ import { printArray } from '../../utils/helper/utils';
5
6
  export class OntarioCard {
6
7
  constructor() {
7
8
  this.label = undefined;
8
9
  this.image = undefined;
9
10
  this.description = undefined;
10
11
  this.cardLink = undefined;
11
- this.cardType = 'basic';
12
- this.headerType = 'default';
12
+ this.layout = 'vertical';
13
+ this.headerColour = undefined;
13
14
  this.horizontalImagePositionType = 'left';
14
15
  this.horizontalImageSizeType = 'one-third';
15
16
  this.ariaLabelText = undefined;
16
- this.cardTypeState = undefined;
17
- this.headerTypeState = undefined;
17
+ this.layoutState = undefined;
18
18
  }
19
19
  /**
20
- * Watch for changes to the `cardType` property for validation purposes.
20
+ * Watch for changes to the `layout` property for validation purposes.
21
21
  *
22
- * If the user input doesn't match one of the array values then `cardType` will be set to its default (`basic`).
23
- * If a match is found in one of the array values then `cardType` will be set to the matching array key value.
22
+ * If the user input doesn't match one of the array values then `layout` will be set to its default (`vertical`).
23
+ * If a match is found in one of the array values then `layoutState` will be set to the matching array key value.
24
24
  */
25
- validateCardType() {
26
- const isValid = validateValueAgainstArray(this.cardType, CardTypes);
27
- if (isValid) {
28
- this.cardTypeState = this.cardType;
29
- } else {
30
- this.cardTypeState = this.warnDefaultCardType();
25
+ validateLayout() {
26
+ if (this.layout) {
27
+ const isValid = validateValueAgainstArray(this.layout, Layouts);
28
+ if (isValid) {
29
+ this.layoutState = this.layout;
30
+ } else {
31
+ this.warnDefaultLayout();
32
+ this.layoutState = 'vertical';
33
+ }
31
34
  }
32
35
  }
33
36
  /**
34
- * Watch for changes to the `headerType` property for validation purposes.
37
+ * Watch for changes to the `headerColour` property for validation purposes.
35
38
  *
36
- * If the user input doesn't match one of the array values then `headerType` will be set to its default (`default`).
37
- * If a match is found in one of the array values then `headerType` will be set to the matching array key value.
39
+ * If the user input doesn't match one of the array values then `headerColour` will be kept empty ('').
40
+ * If a match is found in one of the array values then `headerColour` will be set to the matching array key value.
38
41
  */
39
- validateHeaderType() {
40
- const isValid = validateValueAgainstArray(this.headerType, HeaderTypes);
41
- if (isValid) {
42
- this.headerTypeState = this.headerType;
43
- } else {
44
- this.headerTypeState = this.warnDefaultHeaderType();
42
+ validateHeaderColour() {
43
+ if (this.headerColour) {
44
+ const isValid = validateValueAgainstArray(this.headerColour, HeaderColours);
45
+ if (!isValid) {
46
+ this.warnDefaultHeaderColour();
47
+ this.headerColour = '';
48
+ }
45
49
  }
46
50
  }
47
51
  /**
48
- * Print the invalid `cardType` prop warning message.
49
- * @returns default type (basic).
52
+ * Print the invalid `layout` prop warning message.
50
53
  */
51
- warnDefaultCardType() {
54
+ warnDefaultLayout() {
52
55
  const message = new ConsoleMessageClass();
53
56
  message
54
57
  .addDesignSystemTag()
55
- .addMonospaceText(' card-type ')
58
+ .addMonospaceText(' layout ')
56
59
  .addRegularText('on')
57
60
  .addMonospaceText(' <ontario-card> ')
58
- .addRegularText('was set to an invalid type; only')
59
- .addMonospaceText(' basic, image, label, horizontal ')
60
- .addRegularText('are supported. The default type')
61
- .addMonospaceText(' basic ')
61
+ .addRegularText('was set to an invalid layout; only ')
62
+ .addMonospaceText(printArray([...Layouts]))
63
+ .addRegularText(' are supported. The default layout')
64
+ .addMonospaceText(' vertical ')
62
65
  .addRegularText('is assumed.')
63
66
  .printMessage();
64
- return 'basic';
65
67
  }
66
68
  /**
67
- * Print the invalid `headerType` prop warning message.
68
- * @returns default type (default).
69
+ * Print the invalid `headerColour` prop warning message.
69
70
  */
70
- warnDefaultHeaderType() {
71
+ warnDefaultHeaderColour() {
71
72
  const message = new ConsoleMessageClass();
72
73
  message
73
74
  .addDesignSystemTag()
74
- .addMonospaceText(' header-type ')
75
+ .addMonospaceText(' header-colour ')
75
76
  .addRegularText('on')
76
77
  .addMonospaceText(' <ontario-card> ')
77
- .addRegularText('was set to an invalid type; only')
78
- .addMonospaceText(' default, light, dark')
79
- .addRegularText('are supported. The default type')
80
- .addMonospaceText(' default ')
81
- .addRegularText('is assumed.')
78
+ .addRegularText('was set to an invalid colour; only ')
79
+ .addMonospaceText(printArray([...HeaderColours]))
80
+ .addRegularText(' are supported. ')
81
+ .addRegularText('No colour is assumed as the default.')
82
82
  .printMessage();
83
- return 'default';
84
83
  }
85
84
  /**
86
- * @returns the classes of the ontario cards based off the `cardType` and `headerType`.
85
+ * Returns the top level classes of the card.
86
+ *
87
+ * @returns {string}
87
88
  */
88
- getClass() {
89
+ getCardClasses() {
89
90
  const baseClass =
90
- this.cardTypeState === 'horizontal'
91
- ? `ontario-card ontario-card__card-type--horizontal ontario-card__image-${this.horizontalImagePositionType} ontario-card__image-size-${this.horizontalImageSizeType}`
92
- : `ontario-card ontario-card__header-type--${this.headerTypeState} ontario-card__card-type--${this.cardTypeState}`;
91
+ this.layoutState === 'horizontal'
92
+ ? `ontario-card ontario-card__card-type--${this.layoutState} ontario-card__image-${this.horizontalImagePositionType} ontario-card__image-size-${this.horizontalImageSizeType}`
93
+ : `ontario-card ontario-card__card-type--basic ontario-card--position-${this.layoutState}`;
93
94
  const descriptionClass = this.description ? '' : ' ontario-card__description-false';
94
- return `${baseClass}${descriptionClass}`;
95
+ const backgroundClass =
96
+ this.headerColour && !this.description ? `ontario-card__background--${this.headerColour}` : '';
97
+ return `${baseClass} ${descriptionClass} ${backgroundClass}`.trim();
95
98
  }
99
+ /**
100
+ * Returns the heading classes of the card.
101
+ *
102
+ * @returns {string}
103
+ */
104
+ getCardHeadingClasses() {
105
+ const baseClass = 'ontario-card__heading';
106
+ const backgroundClass =
107
+ this.headerColour && validateValueAgainstArray(this.headerColour, HeaderColours)
108
+ ? `ontario-card__heading--${this.headerColour}`
109
+ : '';
110
+ return `${baseClass} ${backgroundClass}`.trim();
111
+ }
112
+ /**
113
+ * Returns the url that the card links to.
114
+ *
115
+ * @returns {string}
116
+ */
96
117
  getHref() {
97
118
  return this.cardLink ? this.cardLink : '#';
98
119
  }
120
+ /**
121
+ * Component life cycle hook.
122
+ *
123
+ * https://stenciljs.com/docs/component-lifecycle#connectedcallback
124
+ */
99
125
  componentWillLoad() {
100
- this.validateCardType();
101
- this.validateHeaderType();
126
+ this.validateLayout();
127
+ this.validateHeaderColour();
102
128
  }
103
129
  render() {
104
130
  return h(
105
131
  'li',
106
- { key: '606e74cea5d81cd31b355ffb1a71cf7450126cf4', class: this.getClass() },
132
+ { key: 'e63b893390ea13ee21a2d47f7ef6c9b403c4d044', class: this.getCardClasses() },
107
133
  this.image &&
108
134
  h(
109
135
  'div',
@@ -117,16 +143,16 @@ export class OntarioCard {
117
143
  h(
118
144
  'div',
119
145
  {
120
- key: '7d71d14690d4e75dcf1e4ef5c0198183b27e4b39',
146
+ key: 'b6f0a2218840a76baf9c803c3f155733a00ee029',
121
147
  class: `ontario-card__text-container ${this.image ? 'ontario-card--image-true' : ''}`,
122
148
  },
123
149
  h(
124
150
  'h2',
125
- { key: '4f6a337efa3986a5023f3c17e869f072aaef0e4f', class: 'ontario-card__heading' },
151
+ { key: '063dc227db00f3faecec029dc82f5478910b65be', class: this.getCardHeadingClasses() },
126
152
  h(
127
153
  'a',
128
154
  {
129
- 'key': '6efece75daafc95e43dca997e895dc88cab9194c',
155
+ 'key': 'debb40036a708ad1a1852a85fa35db2d5f1e23cc',
130
156
  'href': this.getHref(),
131
157
  'aria-label': this.ariaLabelText,
132
158
  },
@@ -228,53 +254,52 @@ export class OntarioCard {
228
254
  attribute: 'card-link',
229
255
  reflect: false,
230
256
  },
231
- cardType: {
257
+ layout: {
232
258
  type: 'string',
233
259
  mutable: false,
234
260
  complexType: {
235
- original: 'CardType',
236
- resolved: '"basic" | "horizontal" | "image" | "title"',
261
+ original: 'Layout',
262
+ resolved: '"horizontal" | "vertical" | undefined',
237
263
  references: {
238
- CardType: {
264
+ Layout: {
239
265
  location: 'import',
240
266
  path: './ontario-card-types',
241
- id: 'src/components/ontario-card/ontario-card-types.tsx::CardType',
267
+ id: 'src/components/ontario-card/ontario-card-types.tsx::Layout',
242
268
  },
243
269
  },
244
270
  },
245
271
  required: false,
246
- optional: false,
272
+ optional: true,
247
273
  docs: {
248
274
  tags: [],
249
- text: "The type of card to render.\n\nIf no type is passed, it will default to 'basic'.",
275
+ text: "The layout oritnetation of the card.\n\nIf no type is passed, it will default to 'vertical'.",
250
276
  },
251
- attribute: 'card-type',
277
+ attribute: 'layout',
252
278
  reflect: false,
253
- defaultValue: "'basic'",
279
+ defaultValue: "'vertical'",
254
280
  },
255
- headerType: {
281
+ headerColour: {
256
282
  type: 'string',
257
283
  mutable: false,
258
284
  complexType: {
259
- original: 'HeaderType',
260
- resolved: '"dark" | "default" | "light"',
285
+ original: 'HeaderColour',
286
+ resolved: 'string | undefined',
261
287
  references: {
262
- HeaderType: {
288
+ HeaderColour: {
263
289
  location: 'import',
264
290
  path: './ontario-card-types',
265
- id: 'src/components/ontario-card/ontario-card-types.tsx::HeaderType',
291
+ id: 'src/components/ontario-card/ontario-card-types.tsx::HeaderColour',
266
292
  },
267
293
  },
268
294
  },
269
295
  required: false,
270
- optional: false,
296
+ optional: true,
271
297
  docs: {
272
298
  tags: [],
273
- text: "The type of header to render.\n\nIf no type is passed, it will default to 'default'.",
299
+ text: "Set the card's header colour.\n\nThis is optional.",
274
300
  },
275
- attribute: 'header-type',
301
+ attribute: 'header-colour',
276
302
  reflect: false,
277
- defaultValue: "'default'",
278
303
  },
279
304
  horizontalImagePositionType: {
280
305
  type: 'string',
@@ -355,8 +380,7 @@ export class OntarioCard {
355
380
  }
356
381
  static get states() {
357
382
  return {
358
- cardTypeState: {},
359
- headerTypeState: {},
383
+ layoutState: {},
360
384
  };
361
385
  }
362
386
  static get elementRef() {
@@ -365,12 +389,12 @@ export class OntarioCard {
365
389
  static get watchers() {
366
390
  return [
367
391
  {
368
- propName: 'cardType',
369
- methodName: 'validateCardType',
392
+ propName: 'layout',
393
+ methodName: 'validateLayout',
370
394
  },
371
395
  {
372
- propName: 'headerType',
373
- methodName: 'validateHeaderType',
396
+ propName: 'headerColour',
397
+ methodName: 'validateHeaderColour',
374
398
  },
375
399
  ];
376
400
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ontario-card.js","sourceRoot":"","sources":["../../../src/components/ontario-card/ontario-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAEN,SAAS,EAET,WAAW,GAGX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAOlF,MAAM,OAAO,WAAW;;;;;;wBA2CM,OAAO;0BAOH,SAAS;2CAkB0B,MAAM;uCAkBd,WAAW;;;;;IAsBvE;;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C,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE;gBACzF,2DAAI,KAAK,EAAC,uBAAuB;oBAChC,0DAAG,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,gBAAc,IAAI,CAAC,aAAa,IACrD,IAAI,CAAC,KAAK,CACR,CACA;gBACJ,IAAI,CAAC,WAAW,IAAI,CACpB,WAAK,KAAK,EAAC,2BAA2B;oBACrC,aAAI,IAAI,CAAC,WAAW,CAAK,CACpB,CACN,CACI,CACF,CACL,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Prop, Element, h, State, Watch } from '@stencil/core';\nimport {\n\tCardType,\n\tCardTypes,\n\tHeaderType,\n\tHeaderTypes,\n\tHorizontalImagePositionType,\n\tHorizontalImageSizeType,\n} from './ontario-card-types';\nimport { validateValueAgainstArray } from '../../utils/validation/validation-functions';\nimport { ConsoleMessageClass } from '../../utils/console-message/console-message';\n\n@Component({\n\ttag: 'ontario-card',\n\tstyleUrl: 'ontario-card.scss',\n\tshadow: true,\n})\nexport class OntarioCard {\n\t@Element() host: HTMLElement;\n\n\t/**\n\t * Text to be displayed within the header.\n\t *\n\t * @example\n\t *\t<ontario-card\n\t *\t\theader-type=\"dark\"\n\t *\t\tcard-type=\"horizontal\"\n\t *\t\tlabel=\"Card Title 1\"\n\t *\t\tdescription=\"Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum\"\n\t *\t>\n\t */\n\t@Prop() label: string;\n\n\t/**\n\t * Image to be displayed within the card image container.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() image?: string;\n\n\t/**\n\t * Text to be displayed within the card description container.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() description?: string;\n\n\t/**\n\t * Action link for when the card is clicked.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() cardLink?: string;\n\n\t/**\n\t * The type of card to render.\n\t *\n\t * If no type is passed, it will default to 'basic'.\n\t *\n\t */\n\t@Prop() cardType: CardType = 'basic';\n\n\t/**\n\t * The type of header to render.\n\t *\n\t * If no type is passed, it will default to 'default'.\n\t */\n\t@Prop() headerType: HeaderType = 'default';\n\n\t/**\n\t * The position of the image when the card-type is set to 'horizontal'.\n\t *\n\t * This prop is only necessry when the card-type is set to 'horizontal'.\n\t *\n\t * @example\n\t * \t<ontario-card\n\t *\t\tcard-type=\"horizontal\"\n\t *\t\tlabel=\"Card Title 1\"\n\t *\t\timage=\"https://picsum.photos/200/300\"\n\t *\t\thorizontal-image-position-type=\"left\"\n\t *\t\thorizontal-image-size-type=\"one-fourth\"\n\t *\t description=\"Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum\"\n\t *\t>\n\t *\t</ontario-card>\n\t */\n\t@Prop() horizontalImagePositionType?: HorizontalImagePositionType = 'left';\n\n\t/**\n\t * The size of the image when the card-type is set to 'horizontal'.\n\t *\n\t * This prop is only necessry when the card-type is set to 'horizontal'.\n\t *\n\t * @example\n\t * \t<ontario-card\n\t *\t\tcard-type=\"horizontal\"\n\t *\t\tlabel=\"Card Title 1\"\n\t *\t\timage=\"https://picsum.photos/200/300\"\n\t *\t\thorizontal-image-position-type=\"left\"\n\t *\t\thorizontal-image-size-type=\"one-fourth\"\n\t *\t description=\"Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum\"\n\t *\t>\n\t *\t</ontario-card>\n\t */\n\t@Prop() horizontalImageSizeType?: HorizontalImageSizeType = 'one-third';\n\n\t/**\n\t * Provides more context as to what the card interaction is doing. This should only be used for accessibility purposes, if the card interaction requires more * * description than what the text provides.\n\t *\n\t * This is optional.\n\t *\n\t */\n\t@Prop() ariaLabelText?: string;\n\n\t/**\n\t * Mutable variable, for internal use only.\n\t * Set the card's type depending on validation result.\n\t */\n\t@State() private cardTypeState: string;\n\n\t/**\n\t * Mutable variable, for internal use only.\n\t * Set the card's header type depending on validation result.\n\t */\n\t@State() private headerTypeState: string;\n\n\t/**\n\t * Watch for changes to the `cardType` property for validation purposes.\n\t *\n\t * If the user input doesn't match one of the array values then `cardType` will be set to its default (`basic`).\n\t * If a match is found in one of the array values then `cardType` will be set to the matching array key value.\n\t */\n\t@Watch('cardType')\n\tvalidateCardType() {\n\t\tconst isValid = validateValueAgainstArray(this.cardType, CardTypes);\n\t\tif (isValid) {\n\t\t\tthis.cardTypeState = this.cardType;\n\t\t} else {\n\t\t\tthis.cardTypeState = this.warnDefaultCardType();\n\t\t}\n\t}\n\n\t/**\n\t * Watch for changes to the `headerType` property for validation purposes.\n\t *\n\t * If the user input doesn't match one of the array values then `headerType` will be set to its default (`default`).\n\t * If a match is found in one of the array values then `headerType` will be set to the matching array key value.\n\t */\n\t@Watch('headerType')\n\tvalidateHeaderType() {\n\t\tconst isValid = validateValueAgainstArray(this.headerType, HeaderTypes);\n\t\tif (isValid) {\n\t\t\tthis.headerTypeState = this.headerType;\n\t\t} else {\n\t\t\tthis.headerTypeState = this.warnDefaultHeaderType();\n\t\t}\n\t}\n\n\t/**\n\t * Print the invalid `cardType` prop warning message.\n\t * @returns default type (basic).\n\t */\n\tprivate warnDefaultCardType(): CardType {\n\t\tconst message = new ConsoleMessageClass();\n\t\tmessage\n\t\t\t.addDesignSystemTag()\n\t\t\t.addMonospaceText(' card-type ')\n\t\t\t.addRegularText('on')\n\t\t\t.addMonospaceText(' <ontario-card> ')\n\t\t\t.addRegularText('was set to an invalid type; only')\n\t\t\t.addMonospaceText(' basic, image, label, horizontal ')\n\t\t\t.addRegularText('are supported. The default type')\n\t\t\t.addMonospaceText(' basic ')\n\t\t\t.addRegularText('is assumed.')\n\t\t\t.printMessage();\n\t\treturn 'basic';\n\t}\n\n\t/**\n\t * Print the invalid `headerType` prop warning message.\n\t * @returns default type (default).\n\t */\n\tprivate warnDefaultHeaderType(): HeaderType {\n\t\tconst message = new ConsoleMessageClass();\n\t\tmessage\n\t\t\t.addDesignSystemTag()\n\t\t\t.addMonospaceText(' header-type ')\n\t\t\t.addRegularText('on')\n\t\t\t.addMonospaceText(' <ontario-card> ')\n\t\t\t.addRegularText('was set to an invalid type; only')\n\t\t\t.addMonospaceText(' default, light, dark')\n\t\t\t.addRegularText('are supported. The default type')\n\t\t\t.addMonospaceText(' default ')\n\t\t\t.addRegularText('is assumed.')\n\t\t\t.printMessage();\n\t\treturn 'default';\n\t}\n\n\t/**\n\t * @returns the classes of the ontario cards based off the `cardType` and `headerType`.\n\t */\n\tprivate getClass() {\n\t\tconst baseClass =\n\t\t\tthis.cardTypeState === 'horizontal'\n\t\t\t\t? `ontario-card ontario-card__card-type--horizontal ontario-card__image-${this.horizontalImagePositionType} ontario-card__image-size-${this.horizontalImageSizeType}`\n\t\t\t\t: `ontario-card ontario-card__header-type--${this.headerTypeState} ontario-card__card-type--${this.cardTypeState}`;\n\n\t\tconst descriptionClass = this.description ? '' : ' ontario-card__description-false';\n\n\t\treturn `${baseClass}${descriptionClass}`;\n\t}\n\n\tprivate getHref() {\n\t\treturn this.cardLink ? this.cardLink : '#';\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateCardType();\n\t\tthis.validateHeaderType();\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<li class={this.getClass()}>\n\t\t\t\t{this.image && (\n\t\t\t\t\t<div class=\"ontario-card__image-container\">\n\t\t\t\t\t\t<a href={this.getHref()} aria-label={this.ariaLabelText}>\n\t\t\t\t\t\t\t<img class=\"ontario-card__image\" src={this.image} />\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<div class={`ontario-card__text-container ${this.image ? 'ontario-card--image-true' : ''}`}>\n\t\t\t\t\t<h2 class=\"ontario-card__heading\">\n\t\t\t\t\t\t<a href={this.getHref()} aria-label={this.ariaLabelText}>\n\t\t\t\t\t\t\t{this.label}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</h2>\n\t\t\t\t\t{this.description && (\n\t\t\t\t\t\t<div class=\"ontario-card__description\">\n\t\t\t\t\t\t\t<p>{this.description}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"ontario-card.js","sourceRoot":"","sources":["../../../src/components/ontario-card/ontario-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAEN,aAAa,EAIb,OAAO,GACP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAOtD,MAAM,OAAO,WAAW;;;;;;sBA2CG,UAAU;;2CAyBgC,MAAM;uCAkBd,WAAW;;;;IAgBvE;;;;;OAKG;IAEH,cAAc;QACb,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChE,IAAI,OAAO,EAAE,CAAC;gBACb,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACzB,IA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Ac,EAAE;YAC9B,IAAI,CAAC,KAAK,IAAI,CACd,WAAK,KAAK,EAAC,+BAA+B;gBACzC,SAAG,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,gBAAc,IAAI,CAAC,aAAa;oBACtD,WAAK,KAAK,EAAC,qBAAqB,EAAC,GAAG,EAAE,IAAI,CAAC,KAAK,GAAI,CACjD,CACC,CACN;YACD,4DAAK,KAAK,EAAE,gCAAgC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE;gBACzF,2DAAI,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE;oBACtC,0DAAG,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,gBAAc,IAAI,CAAC,aAAa,IACrD,IAAI,CAAC,KAAK,CACR,CACA;gBACJ,IAAI,CAAC,WAAW,IAAI,CACpB,WAAK,KAAK,EAAC,2BAA2B;oBACrC,aAAI,IAAI,CAAC,WAAW,CAAK,CACpB,CACN,CACI,CACF,CACL,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Prop, Element, h, State, Watch } from '@stencil/core';\nimport {\n\tHeaderColour,\n\tHeaderColours,\n\tHorizontalImagePositionType,\n\tHorizontalImageSizeType,\n\tLayout,\n\tLayouts,\n} from './ontario-card-types';\nimport { validateValueAgainstArray } from '../../utils/validation/validation-functions';\nimport { ConsoleMessageClass } from '../../utils/console-message/console-message';\nimport { printArray } from '../../utils/helper/utils';\n\n@Component({\n\ttag: 'ontario-card',\n\tstyleUrl: 'ontario-card.scss',\n\tshadow: true,\n})\nexport class OntarioCard {\n\t@Element() host: HTMLElement;\n\n\t/**\n\t * Text to be displayed within the header.\n\t *\n\t * @example\n\t *\t<ontario-card\n\t *\t\theader-type=\"dark\"\n\t *\t\tcard-type=\"horizontal\"\n\t *\t\tlabel=\"Card Title 1\"\n\t *\t\tdescription=\"Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum\"\n\t *\t>\n\t */\n\t@Prop() label: string;\n\n\t/**\n\t * Image to be displayed within the card image container.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() image?: string;\n\n\t/**\n\t * Text to be displayed within the card description container.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() description?: string;\n\n\t/**\n\t * Action link for when the card is clicked.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() cardLink?: string;\n\n\t/**\n\t * The layout oritnetation of the card.\n\t *\n\t * If no type is passed, it will default to 'vertical'.\n\t *\n\t */\n\t@Prop() layout?: Layout = 'vertical';\n\n\t/**\n\t * Set the card's header colour.\n\t *\n\t * This is optional.\n\t */\n\t@Prop() headerColour?: HeaderColour;\n\n\t/**\n\t * The position of the image when the card-type is set to 'horizontal'.\n\t *\n\t * This prop is only necessry when the card-type is set to 'horizontal'.\n\t *\n\t * @example\n\t * \t<ontario-card\n\t *\t\tcard-type=\"horizontal\"\n\t *\t\tlabel=\"Card Title 1\"\n\t *\t\timage=\"https://picsum.photos/200/300\"\n\t *\t\thorizontal-image-position-type=\"left\"\n\t *\t\thorizontal-image-size-type=\"one-fourth\"\n\t *\t description=\"Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum\"\n\t *\t>\n\t *\t</ontario-card>\n\t */\n\t@Prop() horizontalImagePositionType?: HorizontalImagePositionType = 'left';\n\n\t/**\n\t * The size of the image when the card-type is set to 'horizontal'.\n\t *\n\t * This prop is only necessry when the card-type is set to 'horizontal'.\n\t *\n\t * @example\n\t * \t<ontario-card\n\t *\t\tcard-type=\"horizontal\"\n\t *\t\tlabel=\"Card Title 1\"\n\t *\t\timage=\"https://picsum.photos/200/300\"\n\t *\t\thorizontal-image-position-type=\"left\"\n\t *\t\thorizontal-image-size-type=\"one-fourth\"\n\t *\t description=\"Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum\"\n\t *\t>\n\t *\t</ontario-card>\n\t */\n\t@Prop() horizontalImageSizeType?: HorizontalImageSizeType = 'one-third';\n\n\t/**\n\t * Provides more context as to what the card interaction is doing. This should only be used for accessibility purposes, if the card interaction requires more * * description than what the text provides.\n\t *\n\t * This is optional.\n\t *\n\t */\n\t@Prop() ariaLabelText?: string;\n\n\t/**\n\t * Mutable variable, for internal use only.\n\t * Set the card's layout depending on validation result.\n\t */\n\t@State() private layoutState: string;\n\n\t/**\n\t * Watch for changes to the `layout` property for validation purposes.\n\t *\n\t * If the user input doesn't match one of the array values then `layout` will be set to its default (`vertical`).\n\t * If a match is found in one of the array values then `layoutState` will be set to the matching array key value.\n\t */\n\t@Watch('layout')\n\tvalidateLayout() {\n\t\tif (this.layout) {\n\t\t\tconst isValid = validateValueAgainstArray(this.layout, Layouts);\n\t\t\tif (isValid) {\n\t\t\t\tthis.layoutState = this.layout;\n\t\t\t} else {\n\t\t\t\tthis.warnDefaultLayout();\n\t\t\t\tthis.layoutState = 'vertical';\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Watch for changes to the `headerColour` property for validation purposes.\n\t *\n\t * If the user input doesn't match one of the array values then `headerColour` will be kept empty ('').\n\t * If a match is found in one of the array values then `headerColour` will be set to the matching array key value.\n\t */\n\t@Watch('headerColour')\n\tvalidateHeaderColour() {\n\t\tif (this.headerColour) {\n\t\t\tconst isValid = validateValueAgainstArray(this.headerColour, HeaderColours);\n\n\t\t\tif (!isValid) {\n\t\t\t\tthis.warnDefaultHeaderColour();\n\t\t\t\tthis.headerColour = '';\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Print the invalid `layout` prop warning message.\n\t */\n\tprivate warnDefaultLayout() {\n\t\tconst message = new ConsoleMessageClass();\n\t\tmessage\n\t\t\t.addDesignSystemTag()\n\t\t\t.addMonospaceText(' layout ')\n\t\t\t.addRegularText('on')\n\t\t\t.addMonospaceText(' <ontario-card> ')\n\t\t\t.addRegularText('was set to an invalid layout; only ')\n\t\t\t.addMonospaceText(printArray([...Layouts]))\n\t\t\t.addRegularText(' are supported. The default layout')\n\t\t\t.addMonospaceText(' vertical ')\n\t\t\t.addRegularText('is assumed.')\n\t\t\t.printMessage();\n\t}\n\n\t/**\n\t * Print the invalid `headerColour` prop warning message.\n\t */\n\tprivate warnDefaultHeaderColour() {\n\t\tconst message = new ConsoleMessageClass();\n\t\tmessage\n\t\t\t.addDesignSystemTag()\n\t\t\t.addMonospaceText(' header-colour ')\n\t\t\t.addRegularText('on')\n\t\t\t.addMonospaceText(' <ontario-card> ')\n\t\t\t.addRegularText('was set to an invalid colour; only ')\n\t\t\t.addMonospaceText(printArray([...HeaderColours]))\n\t\t\t.addRegularText(' are supported. ')\n\t\t\t.addRegularText('No colour is assumed as the default.')\n\t\t\t.printMessage();\n\t}\n\n\t/**\n\t * Returns the top level classes of the card.\n\t *\n\t * @returns {string}\n\t */\n\tprivate getCardClasses(): string {\n\t\tconst baseClass =\n\t\t\tthis.layoutState === 'horizontal'\n\t\t\t\t? `ontario-card ontario-card__card-type--${this.layoutState} ontario-card__image-${this.horizontalImagePositionType} ontario-card__image-size-${this.horizontalImageSizeType}`\n\t\t\t\t: `ontario-card ontario-card__card-type--basic ontario-card--position-${this.layoutState}`;\n\n\t\tconst descriptionClass = this.description ? '' : ' ontario-card__description-false';\n\n\t\tconst backgroundClass =\n\t\t\tthis.headerColour && !this.description ? `ontario-card__background--${this.headerColour}` : '';\n\n\t\treturn `${baseClass} ${descriptionClass} ${backgroundClass}`.trim();\n\t}\n\n\t/**\n\t * Returns the heading classes of the card.\n\t *\n\t * @returns {string}\n\t */\n\tprivate getCardHeadingClasses(): string {\n\t\tconst baseClass = 'ontario-card__heading';\n\n\t\tconst backgroundClass =\n\t\t\tthis.headerColour && validateValueAgainstArray(this.headerColour, HeaderColours)\n\t\t\t\t? `ontario-card__heading--${this.headerColour}`\n\t\t\t\t: '';\n\n\t\treturn `${baseClass} ${backgroundClass}`.trim();\n\t}\n\n\t/**\n\t * Returns the url that the card links to.\n\t *\n\t * @returns {string}\n\t */\n\tprivate getHref(): string {\n\t\treturn this.cardLink ? this.cardLink : '#';\n\t}\n\n\t/**\n\t * Component life cycle hook.\n\t *\n\t * https://stenciljs.com/docs/component-lifecycle#connectedcallback\n\t */\n\tcomponentWillLoad() {\n\t\tthis.validateLayout();\n\t\tthis.validateHeaderColour();\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<li class={this.getCardClasses()}>\n\t\t\t\t{this.image && (\n\t\t\t\t\t<div class=\"ontario-card__image-container\">\n\t\t\t\t\t\t<a href={this.getHref()} aria-label={this.ariaLabelText}>\n\t\t\t\t\t\t\t<img class=\"ontario-card__image\" src={this.image} />\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<div class={`ontario-card__text-container ${this.image ? 'ontario-card--image-true' : ''}`}>\n\t\t\t\t\t<h2 class={this.getCardHeadingClasses()}>\n\t\t\t\t\t\t<a href={this.getHref()} aria-label={this.ariaLabelText}>\n\t\t\t\t\t\t\t{this.label}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</h2>\n\t\t\t\t\t{this.description && (\n\t\t\t\t\t\t<div class=\"ontario-card__description\">\n\t\t\t\t\t\t\t<p>{this.description}</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t);\n\t}\n}\n"]}
@@ -6,19 +6,29 @@ describe('ontario-card', () => {
6
6
  components: [OntarioCard],
7
7
  html: `<ontario-card></ontario-card>`,
8
8
  });
9
- expect(page.root).toEqualHtml(`
10
- <ontario-card>
11
- <mock:shadow-root>
12
- <li class="ontario-card ontario-card__card-type--basic ontario-card__header-type--default ontario-card__description-false">
13
- <div class="ontario-card__text-container">
14
- <h2 class="ontario-card__heading">
15
- <a href="#"></a>
16
- </h2>
17
- </div>
18
- </li>
19
- </mock:shadow-root>
20
- </ontario-card>
21
- `);
9
+ expect(page.root).toMatchSnapshot();
22
10
  });
11
+ it('should render a label', async () => {
12
+ const page = await newSpecPage({
13
+ components: [OntarioCard],
14
+ html: `<ontario-card label="Card Title 1"></ontario-card>`,
15
+ });
16
+ expect(page.root).toMatchSnapshot();
17
+ });
18
+ it('should render a header colour on the label', async () => {
19
+ const page = await newSpecPage({
20
+ components: [OntarioCard],
21
+ html: `<ontario-card label="Card Title 1" header-colour="sky"></ontario-card>`,
22
+ });
23
+ expect(page.root).toMatchSnapshot();
24
+ });
25
+ it('should render a description', async () => {
26
+ const page = await newSpecPage({
27
+ components: [OntarioCard],
28
+ html: `<ontario-card description="Lorem ipsum"></ontario-card>`,
29
+ });
30
+ expect(page.root).toMatchSnapshot();
31
+ });
32
+ // Don't think we can test images unless we point to a local path
23
33
  });
24
34
  //# sourceMappingURL=ontario-cards.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ontario-cards.spec.js","sourceRoot":"","sources":["../../../../src/components/ontario-card/test/ontario-cards.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACxB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC9B,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,IAAI,EAAE,+BAA+B;SACrC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;KAY3B,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { OntarioCard } from '../ontario-card';\n\ndescribe('ontario-card', () => {\n\tit('renders', async () => {\n\t\tconst page = await newSpecPage({\n\t\t\tcomponents: [OntarioCard],\n\t\t\thtml: `<ontario-card></ontario-card>`,\n\t\t});\n\t\texpect(page.root).toEqualHtml(`\n <ontario-card>\n\t\t\t\t<mock:shadow-root>\n\t\t\t\t\t<li class=\"ontario-card ontario-card__card-type--basic ontario-card__header-type--default ontario-card__description-false\">\n\t\t\t\t\t\t<div class=\"ontario-card__text-container\">\n\t\t\t\t\t\t\t<h2 class=\"ontario-card__heading\">\n\t\t\t\t\t\t\t\t<a href=\"#\"></a>\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</li>\n\t\t\t\t</mock:shadow-root>\n </ontario-card>\n `);\n\t});\n});\n"]}
1
+ {"version":3,"file":"ontario-cards.spec.js","sourceRoot":"","sources":["../../../../src/components/ontario-card/test/ontario-cards.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACxB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC9B,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,IAAI,EAAE,+BAA+B;SACrC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACtC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC9B,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,IAAI,EAAE,oDAAoD;SAC1D,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QAC3D,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC9B,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,IAAI,EAAE,wEAAwE;SAC9E,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC9B,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,IAAI,EAAE,yDAAyD;SAC/D,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,iEAAiE;AAClE,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { OntarioCard } from '../ontario-card';\n\ndescribe('ontario-card', () => {\n\tit('renders', async () => {\n\t\tconst page = await newSpecPage({\n\t\t\tcomponents: [OntarioCard],\n\t\t\thtml: `<ontario-card></ontario-card>`,\n\t\t});\n\t\texpect(page.root).toMatchSnapshot();\n\t});\n\n\tit('should render a label', async () => {\n\t\tconst page = await newSpecPage({\n\t\t\tcomponents: [OntarioCard],\n\t\t\thtml: `<ontario-card label=\"Card Title 1\"></ontario-card>`,\n\t\t});\n\t\texpect(page.root).toMatchSnapshot();\n\t});\n\n\tit('should render a header colour on the label', async () => {\n\t\tconst page = await newSpecPage({\n\t\t\tcomponents: [OntarioCard],\n\t\t\thtml: `<ontario-card label=\"Card Title 1\" header-colour=\"sky\"></ontario-card>`,\n\t\t});\n\t\texpect(page.root).toMatchSnapshot();\n\t});\n\n\tit('should render a description', async () => {\n\t\tconst page = await newSpecPage({\n\t\t\tcomponents: [OntarioCard],\n\t\t\thtml: `<ontario-card description=\"Lorem ipsum\"></ontario-card>`,\n\t\t});\n\t\texpect(page.root).toMatchSnapshot();\n\t});\n\n\t// Don't think we can test images unless we point to a local path\n});\n"]}
@@ -2366,9 +2366,6 @@
2366
2366
  .ontario-service-subheader .ontario-header-button {
2367
2367
  display: flex;
2368
2368
  }
2369
- .ontario-service-subheader .ontario-header-button:last-of-type {
2370
- display: none;
2371
- }
2372
2369
 
2373
2370
  .ontario-service-subheader .ontario-header-button {
2374
2371
  background-color: #03713d;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path d="M19 6.4L17.6 5 12 10.6 6.4 5 5 6.4l5.6 5.6L5 17.6 6.4 19l5.6-5.6 5.6 5.6 1.4-1.4-5.6-5.6L19 6.4z" fill="#000"/></svg>
@@ -0,0 +1,6 @@
1
+ <svg width="46" height="46" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 46 46" fill="none" xmlns:v="https://vecta.io/nano" tabindex="-1">
2
+ <path d="M23 0C7.36 0 0 7.36 0 23s7.36 23 23 23 23-7.36 23-23S38.64 0 23 0" fill="#fff" />
3
+ <path fill-rule="evenodd"
4
+ d="M23 13.223c4.728-3.178 10.58-3.613 15.69-1.153l.18.128-.026.18a16.08 16.08 0 0 1-2.07 6.765c-1.405 2.41-3.4 4.408-5.8 5.79h-.025a15.71 15.71 0 0 0-.365.191c-.188.1-.38.203-.58.296.383 5.69-2.172 10.994-6.85 14.197L23 39.72l-.153-.102a15.76 15.76 0 0 1-4.805-5.176 16.12 16.12 0 0 1-2.095-7.944v-.026c0-.333.025-.692.05-1.05-5.086-2.51-8.382-7.38-8.817-13.043l-.026-.18.153-.077c2.147-1.05 4.523-1.59 6.874-1.59 2.786 0 5.494.743 7.897 2.127h.026a17.21 17.21 0 0 1 .895.564zm5.93 8.56c1.763-1.025 3.27-2.46 4.37-4.33.51-.897.894-1.82 1.176-2.69-2.888-.666-5.8-.23-8.433 1.204.23.307.383.64.537 1.076s.18 1.025.05 1.512c-.05.205-.153.4-.256.615h0c-.51.87-1.584 1.512-2.913 1.922.51-1.59-.307-2.998-1.33-3.895-.51-.46-1.1-.846-1.687-1.204a12.29 12.29 0 0 0-5.929-1.614 12.52 12.52 0 0 0-2.964.359c.894 2.844 2.71 5.15 5.265 6.714.153-.36.358-.64.664-1s.792-.666 1.278-.794a2.94 2.94 0 0 1 .664-.077c.997 0 2.096.615 3.118 1.563-1.6.36-2.428 1.768-2.683 3.1-.128.692-.204 1.384-.204 2.076 0 2.024.486 4.075 1.56 5.945.486.87 1.125 1.69 1.79 2.383 2.02-2.204 3.092-4.946 3.17-7.944-.41.05-.74 0-1.2-.077s-.97-.384-1.33-.718c-.153-.154-.307-.333-.41-.538-.51-.897-.51-2.153-.204-3.51 1.124 1.23 2.734 1.256 4.012.794a10.52 10.52 0 0 0 1.891-.871z"
5
+ fill="#000" />
6
+ </svg>