@haiilo/catalyst 1.3.1 → 2.0.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 (148) hide show
  1. package/dist/catalyst/catalyst.css +1 -1
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.cdn.js +7 -3
  5. package/dist/catalyst/index.esm.js +9 -1
  6. package/dist/catalyst/index.esm.js.map +1 -1
  7. package/dist/catalyst/p-167f01e8.entry.js +2 -0
  8. package/dist/catalyst/p-167f01e8.entry.js.map +1 -0
  9. package/dist/catalyst/p-5865f232.js +2 -0
  10. package/dist/catalyst/p-5865f232.js.map +1 -0
  11. package/dist/catalyst/scss/_variables.scss +1 -1
  12. package/dist/catalyst/scss/core/_form.scss +8 -0
  13. package/dist/catalyst/scss/core/_nav.scss +3 -3
  14. package/dist/catalyst/scss/core/_notification.scss +48 -0
  15. package/dist/catalyst/scss/index.scss +2 -1
  16. package/dist/catalyst/scss/utils/_typography.scss +4 -0
  17. package/dist/cjs/cat-alert_22.cjs.entry.js +351 -290
  18. package/dist/cjs/cat-alert_22.cjs.entry.js.map +1 -1
  19. package/dist/cjs/cat-icon-registry-2a54df3d.js +417 -0
  20. package/dist/cjs/cat-icon-registry-2a54df3d.js.map +1 -0
  21. package/dist/cjs/catalyst.cjs.js +1 -1
  22. package/dist/cjs/index.cjs.js +528 -4
  23. package/dist/cjs/index.cjs.js.map +1 -1
  24. package/dist/cjs/loader.cjs.js +1 -1
  25. package/dist/collection/collection-manifest.json +2 -2
  26. package/dist/collection/components/cat-button/cat-button.css +21 -63
  27. package/dist/collection/components/cat-button/cat-button.js +21 -4
  28. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  29. package/dist/collection/components/cat-card/cat-card.css +5 -4
  30. package/dist/collection/components/cat-checkbox/cat-checkbox.css +1 -4
  31. package/dist/collection/components/cat-checkbox/cat-checkbox.js +1 -1
  32. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  33. package/dist/collection/components/{cat-menu/cat-menu.css → cat-dropdown/cat-dropdown.css} +20 -0
  34. package/dist/collection/components/{cat-menu/cat-menu.js → cat-dropdown/cat-dropdown.js} +102 -87
  35. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -0
  36. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +13 -38
  37. package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -1
  38. package/dist/collection/components/cat-icon/cat-icon-registry.js +1 -0
  39. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
  40. package/dist/collection/components/cat-input/cat-input.css +1 -4
  41. package/dist/collection/components/cat-input/cat-input.js +4 -5
  42. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  43. package/dist/collection/components/cat-notification/cat-notification.js +61 -89
  44. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  45. package/dist/collection/components/cat-pagination/cat-pagination.css +106 -0
  46. package/dist/collection/components/cat-pagination/cat-pagination.js +302 -0
  47. package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -0
  48. package/dist/collection/components/cat-radio/cat-radio.css +1 -4
  49. package/dist/collection/components/cat-radio/cat-radio.js +1 -1
  50. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  51. package/dist/collection/components/cat-select/cat-select.css +1 -4
  52. package/dist/collection/components/cat-select/cat-select.js +8 -9
  53. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  54. package/dist/collection/components/cat-select-demo/cat-select-demo.js +1 -1
  55. package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
  56. package/dist/collection/components/cat-tabs/cat-tabs.css +2 -2
  57. package/dist/collection/components/cat-tabs/cat-tabs.js +2 -2
  58. package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
  59. package/dist/collection/components/cat-textarea/cat-textarea.css +1 -4
  60. package/dist/collection/components/cat-textarea/cat-textarea.js +1 -1
  61. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  62. package/dist/collection/components/cat-toggle/cat-toggle.css +1 -4
  63. package/dist/collection/components/cat-toggle/cat-toggle.js +1 -1
  64. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  65. package/dist/collection/index.cdn.js +7 -3
  66. package/dist/collection/index.js +3 -3
  67. package/dist/collection/index.js.map +1 -1
  68. package/dist/collection/scss/_variables.scss +1 -1
  69. package/dist/collection/scss/core/_form.scss +8 -0
  70. package/dist/collection/scss/core/_nav.scss +3 -3
  71. package/dist/collection/scss/core/_notification.scss +48 -0
  72. package/dist/collection/scss/index.scss +2 -1
  73. package/dist/collection/scss/utils/_typography.scss +4 -0
  74. package/dist/components/cat-button2.js +6 -5
  75. package/dist/components/cat-button2.js.map +1 -1
  76. package/dist/components/cat-card.js +1 -1
  77. package/dist/components/cat-card.js.map +1 -1
  78. package/dist/components/cat-checkbox2.js +2 -2
  79. package/dist/components/cat-checkbox2.js.map +1 -1
  80. package/dist/components/{cat-menu.d.ts → cat-dropdown.d.ts} +4 -4
  81. package/dist/components/cat-dropdown.js +8 -0
  82. package/dist/components/cat-dropdown.js.map +1 -0
  83. package/dist/components/cat-dropdown2.js +195 -0
  84. package/dist/components/cat-dropdown2.js.map +1 -0
  85. package/dist/components/cat-i18n-registry.js +14 -39
  86. package/dist/components/cat-i18n-registry.js.map +1 -1
  87. package/dist/components/cat-icon2.js +2 -1
  88. package/dist/components/cat-icon2.js.map +1 -1
  89. package/dist/components/cat-input.js +5 -6
  90. package/dist/components/cat-input.js.map +1 -1
  91. package/dist/components/{cat-toast-demo.d.ts → cat-pagination.d.ts} +4 -4
  92. package/dist/components/cat-pagination.js +150 -0
  93. package/dist/components/cat-pagination.js.map +1 -0
  94. package/dist/components/cat-radio.js +2 -2
  95. package/dist/components/cat-radio.js.map +1 -1
  96. package/dist/components/cat-select-demo.js +6 -6
  97. package/dist/components/cat-select-demo.js.map +1 -1
  98. package/dist/components/cat-select2.js +7 -8
  99. package/dist/components/cat-select2.js.map +1 -1
  100. package/dist/components/cat-tabs.js +3 -3
  101. package/dist/components/cat-tabs.js.map +1 -1
  102. package/dist/components/cat-textarea.js +2 -2
  103. package/dist/components/cat-textarea.js.map +1 -1
  104. package/dist/components/cat-toggle.js +2 -2
  105. package/dist/components/cat-toggle.js.map +1 -1
  106. package/dist/components/index.d.ts +2 -2
  107. package/dist/components/index.js +531 -4
  108. package/dist/components/index.js.map +1 -1
  109. package/dist/esm/cat-alert_22.entry.js +348 -287
  110. package/dist/esm/cat-alert_22.entry.js.map +1 -1
  111. package/dist/esm/cat-icon-registry-d537b18b.js +409 -0
  112. package/dist/esm/cat-icon-registry-d537b18b.js.map +1 -0
  113. package/dist/esm/catalyst.js +1 -1
  114. package/dist/esm/index.js +527 -1
  115. package/dist/esm/index.js.map +1 -1
  116. package/dist/esm/loader.js +1 -1
  117. package/dist/types/components/cat-button/cat-button.d.ts +4 -0
  118. package/dist/types/components/{cat-menu/cat-menu.d.ts → cat-dropdown/cat-dropdown.d.ts} +19 -12
  119. package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +4 -6
  120. package/dist/types/components/cat-icon/cat-icon-registry.d.ts +1 -0
  121. package/dist/types/components/cat-input/cat-input.d.ts +0 -1
  122. package/dist/types/components/cat-notification/cat-notification.d.ts +21 -48
  123. package/dist/types/components/cat-pagination/cat-pagination.d.ts +56 -0
  124. package/dist/types/components/cat-select/cat-select.d.ts +0 -1
  125. package/dist/types/components.d.ts +145 -57
  126. package/dist/types/index.d.ts +4 -4
  127. package/package.json +3 -3
  128. package/dist/catalyst/p-10b0d7a2.js +0 -10
  129. package/dist/catalyst/p-10b0d7a2.js.map +0 -1
  130. package/dist/catalyst/p-b561dcd4.entry.js +0 -2
  131. package/dist/catalyst/p-b561dcd4.entry.js.map +0 -1
  132. package/dist/catalyst/scss/core/_toast.scss +0 -87
  133. package/dist/cjs/cat-notification-bcb9fb86.js +0 -990
  134. package/dist/cjs/cat-notification-bcb9fb86.js.map +0 -1
  135. package/dist/collection/components/cat-menu/cat-menu.js.map +0 -1
  136. package/dist/collection/components/cat-toast-demo/cat-toast-demo.css +0 -3
  137. package/dist/collection/components/cat-toast-demo/cat-toast-demo.js +0 -62
  138. package/dist/collection/components/cat-toast-demo/cat-toast-demo.js.map +0 -1
  139. package/dist/collection/scss/core/_toast.scss +0 -87
  140. package/dist/components/cat-menu.js +0 -8
  141. package/dist/components/cat-menu.js.map +0 -1
  142. package/dist/components/cat-menu2.js +0 -176
  143. package/dist/components/cat-menu2.js.map +0 -1
  144. package/dist/components/cat-toast-demo.js +0 -647
  145. package/dist/components/cat-toast-demo.js.map +0 -1
  146. package/dist/esm/cat-notification-8bcf6fa2.js +0 -985
  147. package/dist/esm/cat-notification-8bcf6fa2.js.map +0 -1
  148. package/dist/types/components/cat-toast-demo/cat-toast-demo.d.ts +0 -9
@@ -7,10 +7,11 @@
7
7
  "./components/cat-button/cat-button.js",
8
8
  "./components/cat-card/cat-card.js",
9
9
  "./components/cat-checkbox/cat-checkbox.js",
10
+ "./components/cat-dropdown/cat-dropdown.js",
10
11
  "./components/cat-icon/cat-icon.js",
11
12
  "./components/cat-input/cat-input.js",
12
- "./components/cat-menu/cat-menu.js",
13
13
  "./components/cat-modal/cat-modal.js",
14
+ "./components/cat-pagination/cat-pagination.js",
14
15
  "./components/cat-radio/cat-radio.js",
15
16
  "./components/cat-radio-group/cat-radio-group.js",
16
17
  "./components/cat-scrollable/cat-scrollable.js",
@@ -20,7 +21,6 @@
20
21
  "./components/cat-tab/cat-tab.js",
21
22
  "./components/cat-tabs/cat-tabs.js",
22
23
  "./components/cat-textarea/cat-textarea.js",
23
- "./components/cat-toast-demo/cat-toast-demo.js",
24
24
  "./components/cat-toggle/cat-toggle.js",
25
25
  "./components/cat-tooltip/cat-tooltip.js"
26
26
  ],
@@ -236,22 +236,13 @@
236
236
  padding: 0.25rem 0.25rem;
237
237
  font-size: 0.875rem;
238
238
  line-height: 1rem;
239
- }
240
- .cat-button-xs .cat-button-prefix {
241
- margin-right: 0.25rem;
242
- }
243
- .cat-button-xs .cat-button-suffix {
244
- margin-left: 0.25rem;
239
+ gap: 0.25rem;
245
240
  }
246
241
  .cat-button-xs.cat-button-icon {
247
242
  width: 1.5rem;
248
243
  padding-left: 0;
249
244
  padding-right: 0;
250
245
  }
251
- :host-context(nav) .cat-button-xs {
252
- padding-left: 1.25rem;
253
- padding-right: 1.25rem;
254
- }
255
246
 
256
247
  :host(.cat-button-pull[size=xs]) {
257
248
  margin: -0.25rem -0.25rem;
@@ -288,12 +279,7 @@
288
279
  padding: 0.375rem 0.5rem;
289
280
  font-size: 0.9375rem;
290
281
  line-height: 1.25rem;
291
- }
292
- .cat-button-s .cat-button-prefix {
293
- margin-right: 0.25rem;
294
- }
295
- .cat-button-s .cat-button-suffix {
296
- margin-left: 0.25rem;
282
+ gap: 0.25rem;
297
283
  }
298
284
  .cat-button-s cat-icon {
299
285
  margin-top: -0.125rem;
@@ -304,10 +290,6 @@
304
290
  padding-left: 0;
305
291
  padding-right: 0;
306
292
  }
307
- :host-context(nav) .cat-button-s {
308
- padding-left: 1.25rem;
309
- padding-right: 1.25rem;
310
- }
311
293
 
312
294
  :host(.cat-button-pull[size=s]) {
313
295
  margin: -0.375rem -0.5rem;
@@ -344,12 +326,7 @@
344
326
  padding: 0.625rem 0.75rem;
345
327
  font-size: 0.9375rem;
346
328
  line-height: 1.25rem;
347
- }
348
- .cat-button-m .cat-button-prefix {
349
- margin-right: 0.25rem;
350
- }
351
- .cat-button-m .cat-button-suffix {
352
- margin-left: 0.25rem;
329
+ gap: 0.25rem;
353
330
  }
354
331
  .cat-button-m cat-icon {
355
332
  margin-top: -0.125rem;
@@ -360,10 +337,6 @@
360
337
  padding-left: 0;
361
338
  padding-right: 0;
362
339
  }
363
- :host-context(nav) .cat-button-m {
364
- padding-left: 1.25rem;
365
- padding-right: 1.25rem;
366
- }
367
340
 
368
341
  :host(.cat-button-pull[size=m]) {
369
342
  margin: -0.625rem -0.75rem;
@@ -400,12 +373,7 @@
400
373
  padding: 0.875rem 1rem;
401
374
  font-size: 0.9375rem;
402
375
  line-height: 1.25rem;
403
- }
404
- .cat-button-l .cat-button-prefix {
405
- margin-right: 0.25rem;
406
- }
407
- .cat-button-l .cat-button-suffix {
408
- margin-left: 0.25rem;
376
+ gap: 0.25rem;
409
377
  }
410
378
  .cat-button-l cat-icon {
411
379
  margin-top: -0.125rem;
@@ -416,10 +384,6 @@
416
384
  padding-left: 0;
417
385
  padding-right: 0;
418
386
  }
419
- :host-context(nav) .cat-button-l {
420
- padding-left: 1.25rem;
421
- padding-right: 1.25rem;
422
- }
423
387
 
424
388
  :host(.cat-button-pull[size=l]) {
425
389
  margin: -0.875rem -1rem;
@@ -456,22 +420,13 @@
456
420
  padding: 1rem 1.25rem;
457
421
  font-size: 1.125rem;
458
422
  line-height: 1.5rem;
459
- }
460
- .cat-button-xl .cat-button-prefix {
461
- margin-right: 0.25rem;
462
- }
463
- .cat-button-xl .cat-button-suffix {
464
- margin-left: 0.25rem;
423
+ gap: 0.25rem;
465
424
  }
466
425
  .cat-button-xl.cat-button-icon {
467
426
  width: 3.5rem;
468
427
  padding-left: 0;
469
428
  padding-right: 0;
470
429
  }
471
- :host-context(nav) .cat-button-xl {
472
- padding-left: 1.25rem;
473
- padding-right: 1.25rem;
474
- }
475
430
 
476
431
  :host(.cat-button-pull[size=xl]) {
477
432
  margin: -1rem -1.25rem;
@@ -503,26 +458,29 @@
503
458
  margin-right: -1.25rem;
504
459
  }
505
460
 
506
- :host-context(cat-tabs) .cat-button {
507
- background-color: transparent !important;
461
+ :host(.cat-tab-active:not(:hover)) {
462
+ --cat-primary-text: transparent;
463
+ }
464
+
465
+ :host(.cat-text-left) .cat-button {
466
+ justify-content: left;
467
+ }
468
+
469
+ :host(.cat-text-right) .cat-button {
470
+ justify-content: right;
508
471
  }
509
472
 
510
- :host-context(nav) {
473
+ :host(.cat-nav-item) {
511
474
  width: 100%;
512
475
  }
513
- :host-context(nav) .cat-button {
476
+ :host(.cat-nav-item) .cat-button {
514
477
  box-shadow: none;
515
478
  border-radius: 0;
516
479
  justify-content: left;
480
+ padding-left: 1.25rem;
481
+ padding-right: 1.25rem;
482
+ gap: 0.5rem;
517
483
  }
518
- :host-context(nav) .cat-button:focus-visible {
484
+ :host(.cat-nav-item) .cat-button:focus-visible {
519
485
  outline-offset: -2px;
520
- }
521
-
522
- :host(.cat-text-left) .cat-button {
523
- justify-content: left;
524
- }
525
-
526
- :host(.cat-text-right) .cat-button {
527
- justify-content: right;
528
486
  }
@@ -107,7 +107,7 @@ export class CatButton {
107
107
  render() {
108
108
  var _a;
109
109
  if (this.url) {
110
- return (h("a", { ref: el => (this.button = el), href: this.disabled ? undefined : this.url, target: this.urlTarget, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
110
+ return (h("a", { ref: el => (this.button = el), href: this.disabled ? undefined : this.url, target: this.urlTarget, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, "aria-current": this.a11yCurrent, id: this.buttonId, part: "button", class: {
111
111
  'cat-button': true,
112
112
  'cat-button-icon': this.isIconButton,
113
113
  'cat-button-round': this.round,
@@ -120,7 +120,7 @@ export class CatButton {
120
120
  }, onClick: this.onClick.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
121
121
  }
122
122
  else {
123
- return (h("button", { ref: el => (this.button = el), type: this.submit ? 'submit' : 'button', name: this.name, value: this.value, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
123
+ return (h("button", { ref: el => (this.button = el), type: this.submit ? 'submit' : 'button', name: this.name, value: this.value, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, "aria-current": this.a11yCurrent, id: this.buttonId, part: "button", class: {
124
124
  'cat-button': true,
125
125
  'cat-button-active': this.active,
126
126
  'cat-button-icon': this.isIconButton,
@@ -161,10 +161,10 @@ export class CatButton {
161
161
  }
162
162
  get content() {
163
163
  return [
164
- this.hasPrefixIcon ? (h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-prefix", part: "prefix" })) : null,
164
+ this.hasPrefixIcon ? h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null,
165
165
  this.isIconButton ? (h("cat-icon", { icon: this.icon, size: this.iconSize })) : (h("span", { class: "cat-button-content", part: "content" },
166
166
  h("slot", null))),
167
- this.hasSuffixIcon ? (h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-suffix", part: "suffix" })) : null,
167
+ this.hasSuffixIcon ? h("cat-icon", { icon: this.icon, size: this.iconSize, part: "suffix" }) : null,
168
168
  this.loading ? h("cat-spinner", { size: this.spinnerSize }) : null
169
169
  ];
170
170
  }
@@ -507,6 +507,23 @@ export class CatButton {
507
507
  },
508
508
  "attribute": "a11y-label",
509
509
  "reflect": false
510
+ },
511
+ "a11yCurrent": {
512
+ "type": "boolean",
513
+ "mutable": false,
514
+ "complexType": {
515
+ "original": "boolean",
516
+ "resolved": "boolean | undefined",
517
+ "references": {}
518
+ },
519
+ "required": false,
520
+ "optional": true,
521
+ "docs": {
522
+ "tags": [],
523
+ "text": "Sets the `aria-current` attribute on the button."
524
+ },
525
+ "attribute": "a11y-current",
526
+ "reflect": false
510
527
  }
511
528
  }; }
512
529
  static get states() { return {
@@ -1 +1 @@
1
- {"version":3,"file":"cat-button.js","sourceRoot":"","sources":["../../../src/components/cat-button/cat-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAc,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAChF,O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C5B,CAAC;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { Breakpoint, Breakpoints, isBreakpoint } from '../../utils/breakpoints';\nimport { MediaMatcher } from '../../utils/media-matcher';\n\n/**\n * Buttons are used for interface actions. Primary style should be used only\n * once per view for main call-to-action.\n *\n * @part button - The native anchor or button element.\n * @part content - The textual content of the button.\n * @part prefix - The prefix icon.\n * @part suffix - The suffix icon.\n */\n@Component({\n tag: 'cat-button',\n styleUrl: 'cat-button.scss',\n shadow: true\n})\nexport class CatButton {\n private button!: HTMLButtonElement | HTMLAnchorElement;\n private mediaMatcher?: MediaMatcher;\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n @State() _iconOnly = true;\n\n /**\n * The rendering style of the button.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'outlined';\n\n /**\n * The color palette of the button.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'secondary';\n\n /**\n * Set the button into an active state.\n */\n @Prop() active = false;\n\n /**\n * The size of the button.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The name of the button, which gets paired with the button's value when\n * submitted as part of a form. Corresponds with the native HTML name\n * attribute.\n */\n @Prop() name?: string;\n\n /**\n * The value of the button, which gets paired with the button's name when\n * submitted as part of a form. Corresponds with the native HTML value\n * attribute.\n */\n @Prop() value?: string;\n\n /**\n * Specifies that the button should be disabled. A disabled button is unusable\n * and un-clickable. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * Displays the button in a loading state with a spinner. Just like a disabled\n * button, an inactive button is unusable and un-clickable. However, it\n * retains the current focus state.\n */\n @Prop() loading = false;\n\n /**\n * Allows the button to submit a form.\n */\n @Prop() submit = false;\n\n /**\n * Disables ellipse overflowing button content.\n */\n @Prop() noEllipsis = false;\n\n /**\n * Use round button edges.\n */\n @Prop() round = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop() url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop() urlTarget?: '_blank' | '_self';\n\n /**\n * The name of an icon to be displayed in the button.\n */\n @Prop() icon?: string;\n\n /**\n * Hide the actual button content and only display the icon.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * Adds a unique identifier for the button. Please note that with this\n * particular component this ID is added inside the web component. If you need\n * an ID on the HTML element, use the regular `id` attribute instead.\n */\n @Prop() buttonId?: string;\n\n /**\n * Adds accessible label for the button that is only shown for screen\n * readers. Typically, this label text replaces the visible text on the\n * button for users who use assistive technology.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n @Watch('iconOnly')\n onIconOnlyChanged(value: boolean | Breakpoint): void {\n // teardown\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.mediaQueryList?.removeEventListener('change', this.mediaQueryListener!);\n this.mediaQueryList = undefined;\n this.mediaQueryListener = undefined;\n // setup\n if (isBreakpoint(value)) {\n this.mediaMatcher ??= new MediaMatcher();\n this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);\n this.mediaQueryListener = (event: MediaQueryListEvent) => (this._iconOnly = event.matches);\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n this._iconOnly = this.mediaQueryList.matches;\n } else {\n this._iconOnly = value;\n }\n }\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() catClick!: EventEmitter<MouseEvent>;\n\n /**\n * Emitted when the button received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the button loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad(): void {\n this.onIconOnlyChanged(this.iconOnly);\n }\n\n componentWillRender(): void {\n if (this.isIconButton && !this.a11yLabel) {\n log.warn('[A11y] Missing ARIA label on icon button', this);\n }\n }\n\n @Listen('click')\n haltDisabledEvents(event: Event): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n /**\n * Sets focus on the button. Use this method instead of `button.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.button.focus(options);\n }\n\n render() {\n if (this.url) {\n return (\n <a\n ref={el => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? undefined : this.url}\n target={this.urlTarget}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </a>\n );\n } else {\n return (\n <button\n ref={el => (this.button = el as HTMLButtonElement)}\n type={this.submit ? 'submit' : 'button'}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-active': this.active,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round ?? this.isIconButton,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </button>\n );\n }\n }\n\n private get iconSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 's';\n default:\n return 'l';\n }\n }\n\n private get spinnerSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 'xs';\n default:\n return 'm';\n }\n }\n\n private get isIconButton() {\n return Boolean(this.icon) && this._iconOnly;\n }\n\n private get hasPrefixIcon() {\n return Boolean(this.icon) && !this._iconOnly && !this.iconRight;\n }\n\n private get hasSuffixIcon() {\n return Boolean(this.icon) && !this._iconOnly && this.iconRight;\n }\n\n private get content() {\n return [\n this.hasPrefixIcon ? (\n <cat-icon icon={this.icon} size={this.iconSize} class=\"cat-button-prefix\" part=\"prefix\"></cat-icon>\n ) : null,\n this.isIconButton ? (\n <cat-icon icon={this.icon} size={this.iconSize}></cat-icon>\n ) : (\n <span class=\"cat-button-content\" part=\"content\">\n <slot></slot>\n </span>\n ),\n this.hasSuffixIcon ? (\n <cat-icon icon={this.icon} size={this.iconSize} class=\"cat-button-suffix\" part=\"suffix\"></cat-icon>\n ) : null,\n this.loading ? <cat-spinner size={this.spinnerSize}></cat-spinner> : null\n ];\n }\n\n private onClick(event: MouseEvent) {\n this.catClick.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
1
+ {"version":3,"file":"cat-button.js","sourceRoot":"","sources":["../../../src/components/cat-button/cat-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAc,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;;;GAQG;AAMH,MAAM,OAAO,SAAS;EALtB;IAWW,cAAS,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACK,YAAO,GAAmC,UAAU,CAAC;IAE7D;;OAEG;IACK,UAAK,GAA+D,WAAW,CAAC;IAExF;;OAEG;IACK,WAAM,GAAG,KAAK,CAAC;IAEvB;;OAEG;IACK,SAAI,GAAkC,GAAG,CAAC;IAgBlD;;;OAGG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;;;OAIG;IACK,YAAO,GAAG,KAAK,CAAC;IAExB;;OAEG;IACK,WAAM,GAAG,KAAK,CAAC;IAEvB;;OAEG;IACK,eAAU,GAAG,KAAK,CAAC;IAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { Breakpoint, Breakpoints, isBreakpoint } from '../../utils/breakpoints';\nimport { MediaMatcher } from '../../utils/media-matcher';\n\n/**\n * Buttons are used for interface actions. Primary style should be used only\n * once per view for main call-to-action.\n *\n * @part button - The native anchor or button element.\n * @part content - The textual content of the button.\n * @part prefix - The prefix icon.\n * @part suffix - The suffix icon.\n */\n@Component({\n tag: 'cat-button',\n styleUrl: 'cat-button.scss',\n shadow: true\n})\nexport class CatButton {\n private button!: HTMLButtonElement | HTMLAnchorElement;\n private mediaMatcher?: MediaMatcher;\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n @State() _iconOnly = true;\n\n /**\n * The rendering style of the button.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'outlined';\n\n /**\n * The color palette of the button.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'secondary';\n\n /**\n * Set the button into an active state.\n */\n @Prop() active = false;\n\n /**\n * The size of the button.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The name of the button, which gets paired with the button's value when\n * submitted as part of a form. Corresponds with the native HTML name\n * attribute.\n */\n @Prop() name?: string;\n\n /**\n * The value of the button, which gets paired with the button's name when\n * submitted as part of a form. Corresponds with the native HTML value\n * attribute.\n */\n @Prop() value?: string;\n\n /**\n * Specifies that the button should be disabled. A disabled button is unusable\n * and un-clickable. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * Displays the button in a loading state with a spinner. Just like a disabled\n * button, an inactive button is unusable and un-clickable. However, it\n * retains the current focus state.\n */\n @Prop() loading = false;\n\n /**\n * Allows the button to submit a form.\n */\n @Prop() submit = false;\n\n /**\n * Disables ellipse overflowing button content.\n */\n @Prop() noEllipsis = false;\n\n /**\n * Use round button edges.\n */\n @Prop() round = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop() url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop() urlTarget?: '_blank' | '_self';\n\n /**\n * The name of an icon to be displayed in the button.\n */\n @Prop() icon?: string;\n\n /**\n * Hide the actual button content and only display the icon.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * Adds a unique identifier for the button. Please note that with this\n * particular component this ID is added inside the web component. If you need\n * an ID on the HTML element, use the regular `id` attribute instead.\n */\n @Prop() buttonId?: string;\n\n /**\n * Adds accessible label for the button that is only shown for screen\n * readers. Typically, this label text replaces the visible text on the\n * button for users who use assistive technology.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n /**\n * Sets the `aria-current` attribute on the button.\n */\n @Prop({ attribute: 'a11y-current' }) a11yCurrent?: boolean;\n\n @Watch('iconOnly')\n onIconOnlyChanged(value: boolean | Breakpoint): void {\n // teardown\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.mediaQueryList?.removeEventListener('change', this.mediaQueryListener!);\n this.mediaQueryList = undefined;\n this.mediaQueryListener = undefined;\n // setup\n if (isBreakpoint(value)) {\n this.mediaMatcher ??= new MediaMatcher();\n this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);\n this.mediaQueryListener = (event: MediaQueryListEvent) => (this._iconOnly = event.matches);\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n this._iconOnly = this.mediaQueryList.matches;\n } else {\n this._iconOnly = value;\n }\n }\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() catClick!: EventEmitter<MouseEvent>;\n\n /**\n * Emitted when the button received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the button loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad(): void {\n this.onIconOnlyChanged(this.iconOnly);\n }\n\n componentWillRender(): void {\n if (this.isIconButton && !this.a11yLabel) {\n log.warn('[A11y] Missing ARIA label on icon button', this);\n }\n }\n\n @Listen('click')\n haltDisabledEvents(event: Event): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n /**\n * Sets focus on the button. Use this method instead of `button.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.button.focus(options);\n }\n\n render() {\n if (this.url) {\n return (\n <a\n ref={el => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? undefined : this.url}\n target={this.urlTarget}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n aria-current={this.a11yCurrent}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </a>\n );\n } else {\n return (\n <button\n ref={el => (this.button = el as HTMLButtonElement)}\n type={this.submit ? 'submit' : 'button'}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n aria-current={this.a11yCurrent}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-active': this.active,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round ?? this.isIconButton,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': !this.noEllipsis && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </button>\n );\n }\n }\n\n private get iconSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 's';\n default:\n return 'l';\n }\n }\n\n private get spinnerSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 'xs';\n default:\n return 'm';\n }\n }\n\n private get isIconButton() {\n return Boolean(this.icon) && this._iconOnly;\n }\n\n private get hasPrefixIcon() {\n return Boolean(this.icon) && !this._iconOnly && !this.iconRight;\n }\n\n private get hasSuffixIcon() {\n return Boolean(this.icon) && !this._iconOnly && this.iconRight;\n }\n\n private get content() {\n return [\n this.hasPrefixIcon ? <cat-icon icon={this.icon} size={this.iconSize} part=\"prefix\"></cat-icon> : null,\n this.isIconButton ? (\n <cat-icon icon={this.icon} size={this.iconSize}></cat-icon>\n ) : (\n <span class=\"cat-button-content\" part=\"content\">\n <slot></slot>\n </span>\n ),\n this.hasSuffixIcon ? <cat-icon icon={this.icon} size={this.iconSize} part=\"suffix\"></cat-icon> : null,\n this.loading ? <cat-spinner size={this.spinnerSize}></cat-spinner> : null\n ];\n }\n\n private onClick(event: MouseEvent) {\n this.catClick.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
@@ -15,14 +15,15 @@
15
15
  display: none;
16
16
  }
17
17
 
18
- ::slotted(nav) {
19
- margin: -0.75rem -1.25rem !important;
20
- }
21
-
22
18
  ::slotted(:last-child) {
23
19
  margin-bottom: 0 !important;
24
20
  }
25
21
 
22
+ ::slotted(nav),
23
+ ::slotted(nav:last-child) {
24
+ margin: -0.75rem -1.25rem !important;
25
+ }
26
+
26
27
  ::slotted(.cat-card-pull) {
27
28
  margin: -1.25rem !important;
28
29
  width: calc(100% + 2.5rem) !important;
@@ -7,6 +7,7 @@
7
7
  display: flex;
8
8
  gap: 0.5rem;
9
9
  flex-direction: column;
10
+ color: rgb(var(--cat-hint-color, inherit));
10
11
  }
11
12
  .hint-section .input-hint,
12
13
  .hint-section ::slotted([slot=hint]) {
@@ -16,10 +17,6 @@
16
17
  margin: 0 !important;
17
18
  }
18
19
 
19
- :host-context(.cat-error) .hint-section {
20
- color: rgb(var(--cat-danger-text, 217, 52, 13));
21
- }
22
-
23
20
  :host {
24
21
  display: flex;
25
22
  flex-direction: column;
@@ -52,7 +52,7 @@ export class CatCheckbox {
52
52
  componentWillRender() {
53
53
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
54
54
  if (!this.label && !this.hasSlottedLabel) {
55
- log.error('[A11y] Missing ARIA label on checkbox', this);
55
+ log.warn('[A11y] Missing ARIA label on checkbox', this);
56
56
  }
57
57
  }
58
58
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"cat-checkbox.js","sourceRoot":"","sources":["../../../src/components/cat-checkbox/cat-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,IAAI,YAAY,GAAG,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,CAAC,IAAI,CAAC,IAAI,IAAI,cAAc,CAAC,IAAI,CAC/B,EAAC,WAAW,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CAC3F,CACF,CAAC;EACJ,CAAC;EAEO,OAAO,CAAC,KAAY;IAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAElC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;MAClD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC;KAC3B;IACD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC7B,CAAC;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Checkboxes are used to let a user choose one or more options from a limited\n * number of options.\n *\n * @slot hint - Optional hint element to be displayed with the checkbox.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part checkbox - The checkbox element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-checkbox',\n styleUrls: ['cat-checkbox.scss'],\n shadow: true\n})\nexport class CatCheckbox {\n private readonly id = `cat-checkbox-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Checked state of the checkbox\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Disabled state of the checkbox\n */\n @Prop() disabled = false;\n\n /**\n * Indeterminate state of the checkbox\n */\n @Prop() indeterminate = false;\n\n /**\n * Label of the checkbox which is presented in the UI\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input\n */\n @Prop() name?: string;\n\n /**\n * Required state of the checkbox\n */\n @Prop() required = false;\n\n /**\n * The value of the checkbox\n */\n @Prop({ mutable: true }) value?: string | boolean;\n\n /**\n * Optional hint text(s) to be displayed with the checkbox.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the checkbox.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the checked status of the checkbox is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the checkbox received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the checkbox loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentDidLoad() {\n if (this.input && this.indeterminate) {\n this.input.indeterminate = true;\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on checkbox', this);\n }\n }\n\n /**\n * Sets focus on the checkbox. Use this method instead of `checkbox.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value !== undefined ? String(this.value) : this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"box\" aria-hidden=\"true\" part=\"checkbox\">\n <svg class=\"check\" viewBox=\"0 0 12 10\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n <svg class=\"dash\" viewBox=\"0 0 12 10\">\n <polyline points=\"1.5 5 10.5 5\"></polyline>\n </svg>\n </span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.checked = this.input.checked;\n\n if (!this.value || typeof this.value === 'boolean') {\n this.value = this.checked;\n }\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
1
+ {"version":3,"file":"cat-checkbox.js","sourceRoot":"","sources":["../../../src/components/cat-checkbox/cat-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE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ter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Checkboxes are used to let a user choose one or more options from a limited\n * number of options.\n *\n * @slot hint - Optional hint element to be displayed with the checkbox.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part checkbox - The checkbox element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-checkbox',\n styleUrls: ['cat-checkbox.scss'],\n shadow: true\n})\nexport class CatCheckbox {\n private readonly id = `cat-checkbox-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Checked state of the checkbox\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Disabled state of the checkbox\n */\n @Prop() disabled = false;\n\n /**\n * Indeterminate state of the checkbox\n */\n @Prop() indeterminate = false;\n\n /**\n * Label of the checkbox which is presented in the UI\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input\n */\n @Prop() name?: string;\n\n /**\n * Required state of the checkbox\n */\n @Prop() required = false;\n\n /**\n * The value of the checkbox\n */\n @Prop({ mutable: true }) value?: string | boolean;\n\n /**\n * Optional hint text(s) to be displayed with the checkbox.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the checkbox.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the checked status of the checkbox is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the checkbox received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the checkbox loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentDidLoad() {\n if (this.input && this.indeterminate) {\n this.input.indeterminate = true;\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on checkbox', this);\n }\n }\n\n /**\n * Sets focus on the checkbox. Use this method instead of `checkbox.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value !== undefined ? String(this.value) : this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"box\" aria-hidden=\"true\" part=\"checkbox\">\n <svg class=\"check\" viewBox=\"0 0 12 10\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n <svg class=\"dash\" viewBox=\"0 0 12 10\">\n <polyline points=\"1.5 5 10.5 5\"></polyline>\n </svg>\n </span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.checked = this.input.checked;\n\n if (!this.value || typeof this.value === 'boolean') {\n this.value = this.checked;\n }\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
@@ -31,6 +31,26 @@
31
31
  box-shadow: 0 1px 4px 0 rgba(16, 29, 48, 0.2);
32
32
  border-radius: var(--cat-border-radius-m, 0.25rem);
33
33
  z-index: 100;
34
+ opacity: 0;
35
+ transition: transform 0.13s cubic-bezier(0.3, 0, 0.8, 0.15), opacity 0.13s cubic-bezier(0.3, 0, 0.8, 0.15);
36
+ }
37
+ .content[data-placement^=top] {
38
+ transform: translateY(1rem);
39
+ }
40
+ .content[data-placement^=left] {
41
+ transform: translateX(1rem);
42
+ }
43
+ .content[data-placement^=right] {
44
+ transform: translateX(-1rem);
45
+ }
46
+ .content[data-placement^=bottom] {
47
+ transform: translateY(-1rem);
48
+ }
49
+ .content.show {
50
+ opacity: 1;
51
+ transform: translateX(0);
52
+ transform: translateY(0);
53
+ transition: transform 0.5s cubic-bezier(0.05, 0.7, 0.1, 1), opacity 0.5s cubic-bezier(0.05, 0.7, 0.1, 1);
34
54
  }
35
55
  .content.overflow-auto {
36
56
  overflow: auto;