@haiilo/catalyst 0.7.0 → 0.7.3

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 (99) hide show
  1. package/dist/catalyst/catalyst.css +2 -2
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/{p-4c9cd203.entry.js → p-4254363e.entry.js} +2 -2
  4. package/dist/catalyst/p-4254363e.entry.js.map +1 -0
  5. package/dist/catalyst/p-dda85567.entry.js +10 -0
  6. package/dist/catalyst/p-dda85567.entry.js.map +1 -0
  7. package/dist/catalyst/scss/_mixins.scss +9 -0
  8. package/dist/catalyst/scss/_variables.scss +64 -0
  9. package/dist/catalyst/scss/_variables.tokens.scss +84 -0
  10. package/dist/catalyst/scss/core/_base.scss +12 -0
  11. package/dist/catalyst/scss/core/_nav.scss +23 -0
  12. package/dist/catalyst/scss/core/_toast.scss +77 -0
  13. package/dist/catalyst/scss/core/_typography.scss +237 -0
  14. package/dist/catalyst/scss/fonts/_fonts.mixins.azeret.scss +14 -0
  15. package/dist/catalyst/scss/fonts/_fonts.mixins.dm.scss +53 -0
  16. package/dist/catalyst/scss/fonts/_fonts.mixins.lato.scss +185 -0
  17. package/dist/catalyst/scss/fonts/_fonts.mixins.scss +17 -0
  18. package/dist/catalyst/scss/index.scss +34 -0
  19. package/dist/catalyst/scss/utils/_color.scss +52 -0
  20. package/dist/catalyst/scss/utils/_disabled.mixins.scss +7 -0
  21. package/dist/catalyst/scss/utils/_display.scss +20 -0
  22. package/dist/catalyst/scss/utils/_elevation.mixins.scss +10 -0
  23. package/dist/catalyst/scss/utils/_elevation.scss +19 -0
  24. package/dist/catalyst/scss/utils/_layout.scss +78 -0
  25. package/dist/catalyst/scss/utils/_media.mixins.scss +37 -0
  26. package/dist/catalyst/scss/utils/_ratio.mixins.scss +12 -0
  27. package/dist/catalyst/scss/utils/_ratio.scss +20 -0
  28. package/dist/catalyst/scss/utils/_sizing.mixins.scss +15 -0
  29. package/dist/catalyst/scss/utils/_sizing.scss +16 -0
  30. package/dist/catalyst/scss/utils/_spacing.mixins.scss +5 -0
  31. package/dist/catalyst/scss/utils/_spacing.scss +49 -0
  32. package/dist/catalyst/scss/utils/_typography.mixins.scss +102 -0
  33. package/dist/catalyst/scss/utils/_typography.scss +34 -0
  34. package/dist/catalyst/scss/utils/_visibility.mixins.scss +29 -0
  35. package/dist/catalyst/scss/utils/_visibility.scss +13 -0
  36. package/dist/cjs/cat-alert_18.cjs.entry.js +9 -5
  37. package/dist/cjs/cat-alert_18.cjs.entry.js.map +1 -1
  38. package/dist/cjs/cat-textarea.cjs.entry.js +2 -1
  39. package/dist/cjs/cat-textarea.cjs.entry.js.map +1 -1
  40. package/dist/collection/components/cat-checkbox/cat-checkbox.js +2 -1
  41. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  42. package/dist/collection/components/cat-icon/cat-icon.css +4 -1
  43. package/dist/collection/components/cat-input/cat-input.js +2 -1
  44. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  45. package/dist/collection/components/cat-radio/cat-radio.js +2 -1
  46. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  47. package/dist/collection/components/cat-textarea/cat-textarea.js +2 -1
  48. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  49. package/dist/collection/components/cat-toggle/cat-toggle.js +2 -1
  50. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  51. package/dist/collection/scss/_mixins.scss +9 -0
  52. package/dist/collection/scss/_variables.scss +64 -0
  53. package/dist/collection/scss/_variables.tokens.scss +84 -0
  54. package/dist/collection/scss/core/_base.scss +12 -0
  55. package/dist/collection/scss/core/_nav.scss +23 -0
  56. package/dist/collection/scss/core/_toast.scss +77 -0
  57. package/dist/collection/scss/core/_typography.scss +237 -0
  58. package/dist/collection/scss/fonts/_fonts.mixins.azeret.scss +14 -0
  59. package/dist/collection/scss/fonts/_fonts.mixins.dm.scss +53 -0
  60. package/dist/collection/scss/fonts/_fonts.mixins.lato.scss +185 -0
  61. package/dist/collection/scss/fonts/_fonts.mixins.scss +17 -0
  62. package/dist/collection/scss/index.scss +34 -0
  63. package/dist/collection/scss/utils/_color.scss +52 -0
  64. package/dist/collection/scss/utils/_disabled.mixins.scss +7 -0
  65. package/dist/collection/scss/utils/_display.scss +20 -0
  66. package/dist/collection/scss/utils/_elevation.mixins.scss +10 -0
  67. package/dist/collection/scss/utils/_elevation.scss +19 -0
  68. package/dist/collection/scss/utils/_layout.scss +78 -0
  69. package/dist/collection/scss/utils/_media.mixins.scss +37 -0
  70. package/dist/collection/scss/utils/_ratio.mixins.scss +12 -0
  71. package/dist/collection/scss/utils/_ratio.scss +20 -0
  72. package/dist/collection/scss/utils/_sizing.mixins.scss +15 -0
  73. package/dist/collection/scss/utils/_sizing.scss +16 -0
  74. package/dist/collection/scss/utils/_spacing.mixins.scss +5 -0
  75. package/dist/collection/scss/utils/_spacing.scss +49 -0
  76. package/dist/collection/scss/utils/_typography.mixins.scss +102 -0
  77. package/dist/collection/scss/utils/_typography.scss +34 -0
  78. package/dist/collection/scss/utils/_visibility.mixins.scss +29 -0
  79. package/dist/collection/scss/utils/_visibility.scss +13 -0
  80. package/dist/components/cat-checkbox.js +2 -1
  81. package/dist/components/cat-checkbox.js.map +1 -1
  82. package/dist/components/cat-icon2.js +1 -1
  83. package/dist/components/cat-icon2.js.map +1 -1
  84. package/dist/components/cat-input.js +2 -1
  85. package/dist/components/cat-input.js.map +1 -1
  86. package/dist/components/cat-radio.js +2 -1
  87. package/dist/components/cat-radio.js.map +1 -1
  88. package/dist/components/cat-textarea.js +2 -1
  89. package/dist/components/cat-textarea.js.map +1 -1
  90. package/dist/components/cat-toggle.js +2 -1
  91. package/dist/components/cat-toggle.js.map +1 -1
  92. package/dist/esm/cat-alert_18.entry.js +9 -5
  93. package/dist/esm/cat-alert_18.entry.js.map +1 -1
  94. package/dist/esm/cat-textarea.entry.js +2 -1
  95. package/dist/esm/cat-textarea.entry.js.map +1 -1
  96. package/package.json +2 -2
  97. package/dist/catalyst/p-4c9cd203.entry.js.map +0 -1
  98. package/dist/catalyst/p-9d2eab4f.entry.js +0 -10
  99. package/dist/catalyst/p-9d2eab4f.entry.js.map +0 -1
@@ -0,0 +1,10 @@
1
+ @use 'sass:map';
2
+ @use '../variables' as *;
3
+
4
+ @mixin cat-elevation($level) {
5
+ box-shadow: map.get($cat-elevation, $level);
6
+ }
7
+
8
+ @mixin cat-elevation-transition {
9
+ transition: $cat-elevation-transition;
10
+ }
@@ -0,0 +1,19 @@
1
+ @use '../variables' as *;
2
+ @use 'elevation.mixins' as *;
3
+
4
+ .cat-elevation-transition {
5
+ @include cat-elevation-transition;
6
+ }
7
+
8
+ @each $level, $_def in $cat-elevation {
9
+ .cat-elevation-#{$level} {
10
+ @include cat-elevation($level);
11
+ }
12
+ .cat-elevation-hover-#{$level} {
13
+ &:hover,
14
+ &:focus,
15
+ &:focus-within {
16
+ @include cat-elevation($level);
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,78 @@
1
+ @use '../variables' as *;
2
+
3
+ @mixin -layout-property($name, $property, $value) {
4
+ .cat-#{$name} {
5
+ #{$property}: #{$value};
6
+ @content;
7
+ }
8
+ }
9
+
10
+ // -- Direction
11
+
12
+ @include -layout-property('flex-row', 'flex-direction', 'row');
13
+ @include -layout-property('flex-col', 'flex-direction', 'column');
14
+
15
+ // -- Flex
16
+
17
+ @include -layout-property('flex-1', 'flex', '1 1 0%');
18
+ @include -layout-property('flex-auto', 'flex', '1 1 auto');
19
+ @include -layout-property('flex-init', 'flex', '0 1 auto');
20
+ @include -layout-property('flex-none', 'flex', 'none');
21
+
22
+ // -- Wrap
23
+
24
+ @include -layout-property('flex-wrap', 'flex-wrap', 'wrap');
25
+ @include -layout-property('flex-nowrap', 'flex-wrap', 'nowrap');
26
+
27
+ // -- Gap
28
+
29
+ @each $size, $value in cat-token('size.spacing') {
30
+ @include -layout-property('gap-#{$size}', 'gap', $value);
31
+ @include -layout-property('gap-x-#{$size}', 'column-gap', $value);
32
+ @include -layout-property('gap-y-#{$size}', 'row-gap', $value);
33
+ }
34
+
35
+ // -- Alignment
36
+
37
+ @include -layout-property('justify-start', 'justify-content', 'flex-start');
38
+ @include -layout-property('justify-end', 'justify-content', 'flex-end');
39
+ @include -layout-property('justify-center', 'justify-content', 'center');
40
+ @include -layout-property('justify-between', 'justify-content', 'space-between');
41
+ // @include -layout-property('justify-around', 'justify-content', 'space-around');
42
+ // @include -layout-property('justify-evenly', 'justify-content', 'space-evenly');
43
+
44
+ @include -layout-property('justify-items-start', 'justify-items', 'flex-start');
45
+ @include -layout-property('justify-items-end', 'justify-items', 'flex-end');
46
+ @include -layout-property('justify-items-center', 'justify-items', 'flex-center');
47
+ @include -layout-property('justify-items-stretch', 'justify-items', 'flex-stretch');
48
+
49
+ @include -layout-property('content-start', 'align-content', 'flex-start');
50
+ @include -layout-property('content-end', 'align-content', 'flex-end');
51
+ @include -layout-property('content-center', 'align-content', 'center');
52
+ @include -layout-property('content-between', 'align-content', 'space-between');
53
+ // @include -layout-property('content-around', 'align-content', 'space-around');
54
+ // @include -layout-property('content-evenly', 'align-content', 'space-evenly');
55
+
56
+ @include -layout-property('items-start', 'align-items', 'flex-start');
57
+ @include -layout-property('items-end', 'align-items', 'flex-end');
58
+ @include -layout-property('items-center', 'align-items', 'flex-center');
59
+ @include -layout-property('items-stretch', 'align-items', 'flex-stretch');
60
+
61
+ // -- Grid
62
+
63
+ @for $i from 1 through 12 {
64
+ @include -layout-property('grid-#{$i}', 'grid-template-columns', 'repeat(#{$i}, minmax(0, 1fr))');
65
+ @include -layout-property('grid-col-#{$i}', 'grid-column', 'span #{$i} / span #{$i}');
66
+ }
67
+
68
+ @for $i from 1 through 6 {
69
+ @include -layout-property('grid-row-#{$i}', 'grid-row', 'span #{$i} / span #{$i}');
70
+ }
71
+
72
+ @include -layout-property(
73
+ 'grid-auto',
74
+ 'grid-template-columns',
75
+ 'repeat(auto-fill,minmax(min(var(--grid-min),100%),1fr))'
76
+ ) {
77
+ --grid-min: 100%;
78
+ }
@@ -0,0 +1,37 @@
1
+ @use '../variables' as *;
2
+
3
+ // ---- Responsive
4
+
5
+ @mixin until($size, $media-type: screen) {
6
+ @media #{$media-type} and (max-width: #{cat-token('size.screen.#{$size}') - 1px}) {
7
+ @content;
8
+ }
9
+ }
10
+
11
+ @mixin from($size, $media-type: screen) {
12
+ @media #{$media-type} and (min-width: #{cat-token('size.screen.#{$size}')}) {
13
+ @content;
14
+ }
15
+ }
16
+
17
+ // ---- Print
18
+
19
+ @mixin print {
20
+ @media print {
21
+ @content;
22
+ }
23
+ }
24
+
25
+ // ---- Interaction
26
+
27
+ @mixin pointer($pointer: fine) {
28
+ @media (pointer: #{$pointer}) {
29
+ @content;
30
+ }
31
+ }
32
+
33
+ @mixin hover($hover: hover) {
34
+ @media (hover: #{$hover}) {
35
+ @content;
36
+ }
37
+ }
@@ -0,0 +1,12 @@
1
+ @mixin cat-ratio($aspect-ratio) {
2
+ position: relative;
3
+ aspect-ratio: $aspect-ratio;
4
+
5
+ > * {
6
+ position: absolute;
7
+ top: 0;
8
+ left: 0;
9
+ width: 100%;
10
+ height: 100%;
11
+ }
12
+ }
@@ -0,0 +1,20 @@
1
+ @use 'ratio.mixins' as *;
2
+
3
+ $aspect-ratios: (
4
+ '1x1': 1,
5
+ '3x1': 3,
6
+ '6x1': 6,
7
+ '4x3': calc(4 / 3),
8
+ '16x9': calc(16 / 9),
9
+ '21x9': calc(21 / 9)
10
+ );
11
+
12
+ .cat-ratio {
13
+ @include cat-ratio(var(--cat-aspect-ratio));
14
+ }
15
+
16
+ @each $key, $ratio in $aspect-ratios {
17
+ .cat-ratio-#{$key} {
18
+ --cat-aspect-ratio: #{$ratio};
19
+ }
20
+ }
@@ -0,0 +1,15 @@
1
+ @use '../variables' as *;
2
+
3
+ @function cat-size($size) {
4
+ @return cat-token('size.base.#{$size}');
5
+ }
6
+
7
+ @function cat-border-radius($size) {
8
+ @if $size == '0' or $size == 0 {
9
+ @return none;
10
+ } @else if $size == 'full' {
11
+ @return 100rem;
12
+ } @else {
13
+ @return cat-token('size.border.radius.#{$size}');
14
+ }
15
+ }
@@ -0,0 +1,16 @@
1
+ @use '../variables' as *;
2
+ @use 'sizing.mixins' as *;
3
+
4
+ @each $size, $_def in cat-token('size.border.radius') {
5
+ .cat-radius-#{$size} {
6
+ border-radius: cat-border-radius($size);
7
+ }
8
+ }
9
+
10
+ .cat-radius-0 {
11
+ border-radius: cat-border-radius('0');
12
+ }
13
+
14
+ .cat-radius-full {
15
+ border-radius: cat-border-radius('full');
16
+ }
@@ -0,0 +1,5 @@
1
+ @use '../variables' as *;
2
+
3
+ @function cat-spacing($size) {
4
+ @return cat-token('size.spacing.#{$size}');
5
+ }
@@ -0,0 +1,49 @@
1
+ @use 'sass:map';
2
+ @use '../variables' as *;
3
+ @use 'spacing.mixins' as *;
4
+
5
+ $-spacings: map.merge(
6
+ (
7
+ 'auto': auto,
8
+ '0': 0
9
+ ),
10
+ cat-token('size.spacing')
11
+ );
12
+
13
+ @each $name, $spacing in $-spacings {
14
+ .cat-m-#{$name} {
15
+ margin: $spacing !important;
16
+ }
17
+ .cat-mv-#{$name} {
18
+ margin-top: $spacing !important;
19
+ margin-bottom: $spacing !important;
20
+ }
21
+ .cat-mh-#{$name} {
22
+ margin-left: $spacing !important;
23
+ margin-right: $spacing !important;
24
+ }
25
+ @each $dir in (top, bottom, left, right) {
26
+ .cat-m#{str-slice($dir, 0, 1)}-#{$name} {
27
+ margin-#{$dir}: $spacing !important;
28
+ }
29
+ }
30
+
31
+ @if $spacing != auto {
32
+ .cat-p-#{$name} {
33
+ padding: $spacing !important;
34
+ }
35
+ .cat-pv-#{$name} {
36
+ padding-top: $spacing !important;
37
+ padding-bottom: $spacing !important;
38
+ }
39
+ .cat-ph-#{$name} {
40
+ padding-left: $spacing !important;
41
+ padding-right: $spacing !important;
42
+ }
43
+ @each $dir in (top, bottom, left, right) {
44
+ .cat-p#{str-slice($dir, 0, 1)}-#{$name} {
45
+ padding-#{$dir}: $spacing !important;
46
+ }
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,102 @@
1
+ @use '../variables' as *;
2
+
3
+ // ---- Head
4
+
5
+ @function cat-head-font-family() {
6
+ @return cat-token('font.family.head'), $font-fallback-sans-serif;
7
+ }
8
+
9
+ @function cat-head-font-size($size) {
10
+ @return cat-token('size.font.head.#{$size}');
11
+ }
12
+
13
+ @function cat-head-line-height($size) {
14
+ @return cat-token('size.line.head.#{$size}');
15
+ }
16
+
17
+ @mixin cat-head($size, $weight: null) {
18
+ font-family: cat-head-font-family();
19
+ font-size: cat-head-font-size($size);
20
+ line-height: cat-head-line-height($size);
21
+ color: cat-token('color.ui.font.head');
22
+ font-weight: $weight;
23
+ }
24
+
25
+ // ---- Body
26
+
27
+ @function cat-body-font-family() {
28
+ @return cat-token('font.family.body'), $font-fallback-sans-serif;
29
+ }
30
+
31
+ @function cat-body-font-size($size) {
32
+ @return cat-token('size.font.body.#{$size}');
33
+ }
34
+
35
+ @function cat-body-line-height($size) {
36
+ @return cat-token('size.line.body.#{$size}');
37
+ }
38
+
39
+ @mixin cat-body($size, $weight: null) {
40
+ // skip font family, as it is set on the body
41
+ // skip color, as it is set on the body
42
+ font-size: cat-body-font-size($size);
43
+ line-height: cat-body-line-height($size);
44
+ font-weight: $weight;
45
+ }
46
+
47
+ // ---- Mono
48
+
49
+ @function cat-mono-font-family() {
50
+ @return cat-token('font.family.mono'), $font-fallback-monospace;
51
+ }
52
+
53
+ @function cat-mono-font-size($size) {
54
+ @return cat-token('size.font.mono.#{$size}');
55
+ }
56
+
57
+ @function cat-mono-line-height($size) {
58
+ @return cat-token('size.line.mono.#{$size}');
59
+ }
60
+
61
+ @mixin cat-mono($size, $weight: null) {
62
+ font-family: cat-mono-font-family();
63
+ font-size: cat-mono-font-size($size);
64
+ line-height: cat-mono-line-height($size);
65
+ color: cat-token('color.ui.font.mono');
66
+ font-weight: $weight;
67
+ }
68
+
69
+ // ---- Utils
70
+
71
+ @mixin cat-break-word {
72
+ word-wrap: break-word;
73
+ word-break: break-word;
74
+ }
75
+
76
+ @mixin cat-ellipsis($lines: 1) {
77
+ /* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */
78
+ @if $lines == 1 {
79
+ overflow: hidden;
80
+ text-overflow: ellipsis;
81
+ white-space: nowrap;
82
+ } @else {
83
+ display: -webkit-box;
84
+ -webkit-line-clamp: $lines;
85
+ -webkit-box-orient: vertical;
86
+ overflow: hidden;
87
+ }
88
+ /* stylelint-enable value-no-vendor-prefix, property-no-vendor-prefix */
89
+ }
90
+
91
+ @mixin cat-select($select: auto) {
92
+ /* stylelint-disable property-no-vendor-prefix */
93
+ -webkit-user-select: $select;
94
+ -ms-user-select: $select;
95
+ user-select: $select;
96
+ /* stylelint-enable property-no-vendor-prefix */
97
+ }
98
+
99
+ @mixin cat-font-smooth() {
100
+ -webkit-font-smoothing: antialiased;
101
+ -moz-osx-font-smoothing: greyscale;
102
+ }
@@ -0,0 +1,34 @@
1
+ @use 'typography.mixins' as *;
2
+
3
+ .cat-text-left {
4
+ text-align: left !important;
5
+ }
6
+
7
+ .cat-text-center {
8
+ text-align: center !important;
9
+ }
10
+
11
+ .cat-text-right {
12
+ text-align: right !important;
13
+ }
14
+
15
+ .cat-ellipsis {
16
+ @include cat-ellipsis;
17
+ }
18
+ @for $i from 1 through 5 {
19
+ .cat-ellipsis-#{$i} {
20
+ @include cat-ellipsis($i);
21
+ }
22
+ }
23
+
24
+ .cat-select {
25
+ @include cat-select;
26
+ }
27
+
28
+ .cat-no-select {
29
+ @include cat-select(none);
30
+ }
31
+
32
+ .cat-break-word {
33
+ @include cat-break-word;
34
+ }
@@ -0,0 +1,29 @@
1
+ @mixin cat-visually-hidden {
2
+ position: absolute !important;
3
+ width: 1px !important;
4
+ height: 1px !important;
5
+ padding: 0 !important;
6
+ margin: -1px !important;
7
+ overflow: hidden !important;
8
+ clip: rect(0, 0, 0, 0) !important;
9
+ white-space: nowrap !important;
10
+ border: 0 !important;
11
+ }
12
+
13
+ @mixin cat-visually-hidden-focusable {
14
+ &:not(:focus):not(:focus-within) {
15
+ @include cat-visually-hidden;
16
+ }
17
+ }
18
+
19
+ @mixin cat-visually-hidden-hoverable($container: null) {
20
+ @if $container {
21
+ #{$container}:not(:hover):not(:focus):not(:focus-within) & {
22
+ @include cat-visually-hidden;
23
+ }
24
+ } @else {
25
+ *:not(:hover):not(:focus):not(:focus-within) > & {
26
+ @include cat-visually-hidden;
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,13 @@
1
+ @use 'visibility.mixins' as *;
2
+
3
+ .cat-visually-hidden {
4
+ @include cat-visually-hidden;
5
+ }
6
+
7
+ .cat-visually-hidden-focusable {
8
+ @include cat-visually-hidden-focusable;
9
+ }
10
+
11
+ .cat-visually-hidden-hoverable {
12
+ @include cat-visually-hidden-hoverable;
13
+ }
@@ -46,7 +46,8 @@ const CatCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
46
46
  }
47
47
  }
48
48
  componentWillRender() {
49
- if (!this.label && !this.hostElement.querySelector('[slot="label"]')) {
49
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
50
+ if (!this.label && !this.hasSlottedLabel) {
50
51
  loglevel.error('[A11y] Missing ARIA label on checkbox', this);
51
52
  }
52
53
  }
@@ -1 +1 @@
1
- {"file":"cat-checkbox.js","mappings":";;;;AAAA,MAAM,cAAc,GAAG,k+DAAk+D;;ACIz/D,IAAI,YAAY,GAAG,CAAC,CAAC;MAgBRA,aAAW;EALxB;;;;;;;IAMmB,OAAE,GAAG,gBAAgB,YAAY,EAAE,EAAE,CAAC;IAK9C,oBAAe,GAAG,KAAK,CAAC;;;;IAKzB,YAAO,GAAG,KAAK,CAAC;;;;IAKhB,aAAQ,GAAG,KAAK,CAAC;;;;IAKjB,kBAAa,GAAG,KAAK,CAAC;;;;IAKtB,UAAK,GAAG,EAAE,CAAC;;;;IAKX,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BAAa,MAAM,EAAC,IAAI,EAAC,UAAU,IAClD,WAAK,KAAK,EAAC,OAAO,EAAC,OAAO,EAAC,WAAW,IACpC,gBAAU,MAAM,EAAC,oBAAoB,GAAY,CAC7C,EACN,WAAK,KAAK,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,IACnC,gBAAU,MAAM,EAAC,cAAc,GAAY,CACvC,CACD,EACP,YAAM,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,IAC7B,CAAC,IAAI,CAAC,eAAe,IAAI,YAAM,IAAI,EAAC,OAAO,GAAQ,KAAK,IAAI,CAAC,KAAK,CAC9D,CACD,EACP,IAAI,CAAC,WAAW,CACZ,EACP;GACH;EAED,IAAY,WAAW;IACrB,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACzE,QACE,CAAC,IAAI,CAAC,IAAI,IAAI,cAAc,MAC1B,EAAC,WAAW,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CAC3F,EACD;GACH;EAEO,OAAO,CAAC,KAAY;IAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC5B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatCheckbox","log"],"sources":["./src/components/cat-checkbox/cat-checkbox.scss?tag=cat-checkbox&encapsulation=shadow","./src/components/cat-checkbox/cat-checkbox.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nlabel {\n flex: 0 1 auto;\n display: flex;\n gap: 0.5rem;\n @include cat-body('m');\n @include cat-select(none);\n cursor: pointer;\n}\n\ninput {\n @include cat-visually-hidden;\n}\n\n.box {\n flex: 0 0 auto;\n display: flex;\n position: relative;\n height: 1.25rem;\n width: 1.25rem;\n background-color: cat-token('color.ui.background.input');\n border: 1px solid cat-token('color.ui.border.input');\n border-radius: cat-border-radius(s);\n transition: background-color cat-token('time.transition.s') ease, border-color cat-token('time.transition.s') ease;\n\n svg {\n fill: none;\n stroke-width: 2;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-dasharray: 16px;\n stroke-dashoffset: 16px;\n transition: all cat-token('time.transition.s') ease;\n width: 70%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(0.99);\n }\n\n :checked + & {\n background-color: cat-token('color.theme.primary.bg');\n border-color: cat-token('color.theme.primary.bg');\n stroke: cat-token('color.theme.primary.fill');\n\n .check {\n stroke-dashoffset: 0;\n }\n }\n\n :indeterminate + & {\n background-color: cat-token('color.theme.primary.bg');\n border-color: cat-token('color.theme.primary.bg');\n stroke: cat-token('color.theme.primary.fill');\n\n .dash {\n stroke-dashoffset: 0;\n }\n }\n\n :focus-visible + & {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n }\n}\n\n.label {\n flex: 1 1 auto;\n\n .is-hidden & {\n @include cat-visually-hidden;\n }\n}\n\n.is-disabled {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n}\n","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() 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;\n\n /**\n * Optional hint text(s) to be displayed with the checkbox.\n */\n @Prop() hint?: string | string[];\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 if (!this.label && !this.hostElement.querySelector('[slot=\"label\"]')) {\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 htmlFor={this.id} class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled }}>\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}\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.value = this.input.value;\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"],"version":3}
1
+ {"file":"cat-checkbox.js","mappings":";;;;AAAA,MAAM,cAAc,GAAG,k+DAAk+D;;ACIz/D,IAAI,YAAY,GAAG,CAAC,CAAC;MAgBRA,aAAW;EALxB;;;;;;;IAMmB,OAAE,GAAG,gBAAgB,YAAY,EAAE,EAAE,CAAC;IAK9C,oBAAe,GAAG,KAAK,CAAC;;;;IAKzB,YAAO,GAAG,KAAK,CAAC;;;;IAKhB,aAAQ,GAAG,KAAK,CAAC;;;;IAKjB,kBAAa,GAAG,KAAK,C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;;","names":["CatCheckbox","log"],"sources":["./src/components/cat-checkbox/cat-checkbox.scss?tag=cat-checkbox&encapsulation=shadow","./src/components/cat-checkbox/cat-checkbox.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nlabel {\n flex: 0 1 auto;\n display: flex;\n gap: 0.5rem;\n @include cat-body('m');\n @include cat-select(none);\n cursor: pointer;\n}\n\ninput {\n @include cat-visually-hidden;\n}\n\n.box {\n flex: 0 0 auto;\n display: flex;\n position: relative;\n height: 1.25rem;\n width: 1.25rem;\n background-color: cat-token('color.ui.background.input');\n border: 1px solid cat-token('color.ui.border.input');\n border-radius: cat-border-radius(s);\n transition: background-color cat-token('time.transition.s') ease, border-color cat-token('time.transition.s') ease;\n\n svg {\n fill: none;\n stroke-width: 2;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-dasharray: 16px;\n stroke-dashoffset: 16px;\n transition: all cat-token('time.transition.s') ease;\n width: 70%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(0.99);\n }\n\n :checked + & {\n background-color: cat-token('color.theme.primary.bg');\n border-color: cat-token('color.theme.primary.bg');\n stroke: cat-token('color.theme.primary.fill');\n\n .check {\n stroke-dashoffset: 0;\n }\n }\n\n :indeterminate + & {\n background-color: cat-token('color.theme.primary.bg');\n border-color: cat-token('color.theme.primary.bg');\n stroke: cat-token('color.theme.primary.fill');\n\n .dash {\n stroke-dashoffset: 0;\n }\n }\n\n :focus-visible + & {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n }\n}\n\n.label {\n flex: 1 1 auto;\n\n .is-hidden & {\n @include cat-visually-hidden;\n }\n}\n\n.is-disabled {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n}\n","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() 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;\n\n /**\n * Optional hint text(s) to be displayed with the checkbox.\n */\n @Prop() hint?: string | string[];\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 htmlFor={this.id} class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled }}>\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}\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.value = this.input.value;\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"],"version":3}
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
  import { C as CatIconRegistry } from './cat-icon-registry.js';
3
3
 
4
- const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;width:1em;height:1em}.icon-xs svg{font-size:0.75rem}.icon-s svg{font-size:1rem}.icon-m svg{font-size:1.25rem}.icon-l svg{font-size:1.5rem}.icon-xl svg{font-size:1.75rem}";
4
+ const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;height:1em;width:calc(var(--cat-icon-ratio, 1) * 1em)}.icon-xs svg{font-size:0.75rem}.icon-s svg{font-size:1rem}.icon-m svg{font-size:1.25rem}.icon-l svg{font-size:1.5rem}.icon-xl svg{font-size:1.75rem}";
5
5
 
6
6
  const CatIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
7
  constructor() {
@@ -1 +1 @@
1
- {"file":"cat-icon2.js","mappings":";;;AAAA,MAAM,UAAU,GAAG,kZAAkZ;;MCcxZ,OAAO;EALpB;;;;IAMmB,iBAAY,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;;;;IAKtD,SAAI,GAAG,EAAE,CAAC;;;;IAKV,SAAI,GAA6C,GAAG,CAAC;GAsB9D;EAdC,MAAM;IACJ,QACE,YACE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBACnC,IAAI,CAAC,SAAS,iBACb,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,MAAM,EAC3C,IAAI,EAAC,MAAM,EACX,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;QACV,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,KAAK,QAAQ;OAC9C,GACK,EACR;GACH;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/cat-icon/cat-icon.scss?tag=cat-icon&encapsulation=shadow","./src/components/cat-icon/cat-icon.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: inline-flex;\n vertical-align: middle;\n @include cat-select(none);\n}\n\n:host([hidden]) {\n display: none;\n}\n\nspan {\n display: inline-flex;\n}\n\nsvg {\n fill: currentColor;\n stroke: none;\n transform-origin: center center;\n width: 1em;\n height: 1em;\n}\n\n// ----- size\n\n@mixin size($size) {\n .icon-#{$size} svg {\n font-size: cat-size($size) * 0.5;\n }\n}\n\n@include size('xs');\n@include size('s');\n@include size('m');\n@include size('l');\n@include size('xl');\n","import { Component, h, Prop } from '@stencil/core';\nimport { CatIconRegistry } from './cat-icon-registry';\n\n/**\n * Icons are used to provide additional meaning or in places where text label\n * doesn't fit.\n *\n * @part icon - The span element wrapping the SVG icon.\n */\n@Component({\n tag: 'cat-icon',\n styleUrl: 'cat-icon.scss',\n shadow: true\n})\nexport class CatIcon {\n private readonly iconRegistry = CatIconRegistry.getInstance();\n\n /**\n * The name of the icon.\n */\n @Prop() icon = '';\n\n /**\n * The size of the icon.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' | 'inline' = 'm';\n\n /**\n * Adds accessible label for the icon that is only shown for screen\n * readers. The `aria-hidden` attribute will be set if no label is present.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n render() {\n return (\n <span\n innerHTML={this.iconRegistry.getIcon(this.icon)}\n aria-label={this.a11yLabel}\n aria-hidden={this.a11yLabel ? null : 'true'}\n part=\"icon\"\n class={{\n icon: true,\n [`icon-${this.size}`]: this.size !== 'inline'\n }}\n ></span>\n );\n }\n}\n"],"version":3}
1
+ {"file":"cat-icon2.js","mappings":";;;AAAA,MAAM,UAAU,GAAG,mbAAmb;;MCczb,OAAO;EALpB;;;;IAMmB,iBAAY,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;;;;IAKtD,SAAI,GAAG,EAAE,CAAC;;;;IAKV,SAAI,GAA6C,GAAG,CAAC;GAsB9D;EAdC,MAAM;IACJ,QACE,YACE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBACnC,IAAI,CAAC,SAAS,iBACb,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,MAAM,EAC3C,IAAI,EAAC,MAAM,EACX,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;QACV,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,KAAK,QAAQ;OAC9C,GACK,EACR;GACH;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/cat-icon/cat-icon.scss?tag=cat-icon&encapsulation=shadow","./src/components/cat-icon/cat-icon.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n /**\n * @prop --cat-icon-ratio: The aspect ratio of the avatar.\n */\n display: inline-flex;\n vertical-align: middle;\n @include cat-select(none);\n}\n\n:host([hidden]) {\n display: none;\n}\n\nspan {\n display: inline-flex;\n}\n\nsvg {\n fill: currentColor;\n stroke: none;\n transform-origin: center center;\n height: 1em;\n width: calc(var(--cat-icon-ratio, 1) * 1em);\n}\n\n// ----- size\n\n@mixin size($size) {\n .icon-#{$size} svg {\n font-size: cat-size($size) * 0.5;\n }\n}\n\n@include size('xs');\n@include size('s');\n@include size('m');\n@include size('l');\n@include size('xl');\n","import { Component, h, Prop } from '@stencil/core';\nimport { CatIconRegistry } from './cat-icon-registry';\n\n/**\n * Icons are used to provide additional meaning or in places where text label\n * doesn't fit.\n *\n * @part icon - The span element wrapping the SVG icon.\n */\n@Component({\n tag: 'cat-icon',\n styleUrl: 'cat-icon.scss',\n shadow: true\n})\nexport class CatIcon {\n private readonly iconRegistry = CatIconRegistry.getInstance();\n\n /**\n * The name of the icon.\n */\n @Prop() icon = '';\n\n /**\n * The size of the icon.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' | 'inline' = 'm';\n\n /**\n * Adds accessible label for the icon that is only shown for screen\n * readers. The `aria-hidden` attribute will be set if no label is present.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n render() {\n return (\n <span\n innerHTML={this.iconRegistry.getIcon(this.icon)}\n aria-label={this.a11yLabel}\n aria-hidden={this.a11yLabel ? null : 'true'}\n part=\"icon\"\n class={{\n icon: true,\n [`icon-${this.size}`]: this.size !== 'inline'\n }}\n ></span>\n );\n }\n}\n"],"version":3}
@@ -62,7 +62,8 @@ const CatInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
62
62
  this.type = 'text';
63
63
  }
64
64
  componentWillRender() {
65
- if (!this.label && !this.hostElement.querySelector('[slot="label"]')) {
65
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
66
+ if (!this.label && !this.hasSlottedLabel) {
66
67
  loglevel.error('[A11y] Missing ARIA label on input', this);
67
68
  }
68
69
  }
@@ -1 +1 @@
1
- {"file":"cat-input.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,49DAA49D;;ACKh/D,IAAI,YAAY,GAAG,CAAC,CAAC;MAkBRA,UAAQ;EALrB;;;;;;;IAMmB,SAAI,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;IACrC,OAAE,GAAG,aAAa,YAAY,EAAE,EAAE,CAAC;IAK3C,oBAAe,GAAG,KAAK,CAAC;;;;IAUzB,cAAS,GAAG,KAAK,CAAC;;;;IAKlB,aAAQ,GAAG,KAAK,CAAC;;;;IAejB,cAAS,GAAG,KAAK,CAAC;;;;IAKlB,UAAK,GAAG,EAAE,CAAC;;;;IAKX,gBAAW,GAAG,KAAK,CAAC;;;;IAyBpB,SAAI,GAAG,EAAE,CAAC;;;;IAoBV,aAAQ,GAAG,KAAK,CAAC;;;;IAKjB,aAAQ,GAAG,KAAK,CAAC;;;;IAKjB,UAAK,GAAG,KAAK,CAAC;;;;IAKd,SAAI,GAAwE,MAAM,CAAC;GAgJ5F;EA1HC,mBAAmB;IACjB,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,I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AC,SAAS,IAAI,gBAAU,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,GAAG,GAAY,EAClG,IAAI,CAAC,UAAU,KACd,YAAM,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,QAAQ,IACpC,IAAI,CAAC,UAAU,CACX,CACR,CACG,EACL,IAAI,CAAC,WAAW,CACZ,EACP;GACH;EAED,IAAY,WAAW;IACrB,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACzE,QACE,CAAC,IAAI,CAAC,IAAI,IAAI,cAAc,MAC1B,EAAC,WAAW,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CAC3F,EACD;GACH;EAEO,OAAO,CAAC,KAAY;IAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC5B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatInput","log"],"sources":["./src/components/cat-input/cat-input.scss?tag=cat-input&encapsulation=shadow","./src/components/cat-input/cat-input.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n @include cat-body('m');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.input-wrapper {\n display: flex;\n align-items: stretch;\n gap: 0.75rem;\n padding: 0 0.75rem;\n height: cat-size('m');\n overflow: hidden;\n background: cat-token('color.ui.background.input');\n border-radius: cat-border-radius('m');\n box-shadow: 0 0 0 1px cat-token('color.ui.border.input');\n transition: box-shadow cat-token('time.transition.s') linear;\n\n &.input-round {\n border-radius: 10rem;\n }\n\n &.input-disabled {\n background: cat-token('color.ui.background.inputDisabled');\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &:not(.input-disabled) {\n &:hover {\n box-shadow: 0 0 0 2px cat-token('color.ui.border.input');\n }\n\n &:focus-within {\n outline: 2px solid cat-token('color.ui.border.focus');\n }\n }\n}\n\nlabel {\n align-self: flex-start;\n\n &.hidden {\n @include cat-visually-hidden;\n }\n}\n\n.input-optional {\n margin-left: 0.25rem;\n @include cat-body('xs');\n color: cat-token('color.ui.font.muted');\n}\n\n.text-prefix,\n.text-suffix {\n display: inline-flex;\n align-items: center;\n @include cat-select(none);\n}\n\n.text-prefix {\n border-right: 1px solid cat-token('color.ui.border.input');\n padding-right: 0.75rem;\n}\n\n.text-suffix {\n border-left: 1px solid cat-token('color.ui.border.input');\n padding-left: 0.75rem;\n}\n\n.icon-prefix,\n.icon-suffix {\n align-self: center;\n}\n\n.input-inner-wrapper {\n display: flex;\n position: relative;\n flex: 1 1 auto;\n}\n\ninput {\n font: inherit;\n margin: 0;\n padding: 0;\n width: 100%;\n min-width: 0;\n border: none;\n outline: none;\n background: none;\n\n .input-disabled & {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &.has-clearable {\n padding-right: calc(cat-size('s') - 0.5rem);\n }\n\n &::placeholder {\n color: cat-token('color.ui.font.muted');\n }\n}\n\n.clearable {\n position: absolute;\n top: calc(50% - cat-size('s') / 2);\n right: -0.5rem;\n}\n","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';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\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 label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-input-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * The label for the input.\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 * A maximum value for numeric values.\n */\n @Prop() max?: number;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for numeric values.\n */\n @Prop() min?: number;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name = '';\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: 'text' | 'email' | 'password' | 'tel' | 'url' | 'search' | 'number' = 'text';\n\n /**\n * The initial value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n if (!this.label && !this.hostElement.querySelector('[slot=\"label\"]')) {\n log.error('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Sets focus on the input. Use this method instead of `input.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 /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.getMessage('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.max}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={this.i18n.getMessage('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\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.value = this.input.value;\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"],"version":3}
1
+ {"file":"cat-input.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,49DAA49D;;ACKh/D,IAAI,YAAY,GAAG,CAAC,CAAC;MAkBRA,UAAQ;EALrB;;;;;;;IAMmB,SAAI,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;IACrC,OAAE,GAAG,aAAa,YAAY,EAAE,EAAE,CAAC;IAK3C,oBAAe,GAAG,KAAK,CAAC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AiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatInput","log"],"sources":["./src/components/cat-input/cat-input.scss?tag=cat-input&encapsulation=shadow","./src/components/cat-input/cat-input.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n @include cat-body('m');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.input-wrapper {\n display: flex;\n align-items: stretch;\n gap: 0.75rem;\n padding: 0 0.75rem;\n height: cat-size('m');\n overflow: hidden;\n background: cat-token('color.ui.background.input');\n border-radius: cat-border-radius('m');\n box-shadow: 0 0 0 1px cat-token('color.ui.border.input');\n transition: box-shadow cat-token('time.transition.s') linear;\n\n &.input-round {\n border-radius: 10rem;\n }\n\n &.input-disabled {\n background: cat-token('color.ui.background.inputDisabled');\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &:not(.input-disabled) {\n &:hover {\n box-shadow: 0 0 0 2px cat-token('color.ui.border.input');\n }\n\n &:focus-within {\n outline: 2px solid cat-token('color.ui.border.focus');\n }\n }\n}\n\nlabel {\n align-self: flex-start;\n\n &.hidden {\n @include cat-visually-hidden;\n }\n}\n\n.input-optional {\n margin-left: 0.25rem;\n @include cat-body('xs');\n color: cat-token('color.ui.font.muted');\n}\n\n.text-prefix,\n.text-suffix {\n display: inline-flex;\n align-items: center;\n @include cat-select(none);\n}\n\n.text-prefix {\n border-right: 1px solid cat-token('color.ui.border.input');\n padding-right: 0.75rem;\n}\n\n.text-suffix {\n border-left: 1px solid cat-token('color.ui.border.input');\n padding-left: 0.75rem;\n}\n\n.icon-prefix,\n.icon-suffix {\n align-self: center;\n}\n\n.input-inner-wrapper {\n display: flex;\n position: relative;\n flex: 1 1 auto;\n}\n\ninput {\n font: inherit;\n margin: 0;\n padding: 0;\n width: 100%;\n min-width: 0;\n border: none;\n outline: none;\n background: none;\n\n .input-disabled & {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n }\n\n &.has-clearable {\n padding-right: calc(cat-size('s') - 0.5rem);\n }\n\n &::placeholder {\n color: cat-token('color.ui.font.muted');\n }\n}\n\n.clearable {\n position: absolute;\n top: calc(50% - cat-size('s') / 2);\n right: -0.5rem;\n}\n","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';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\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 label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-input-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * The label for the input.\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 * A maximum value for numeric values.\n */\n @Prop() max?: number;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for numeric values.\n */\n @Prop() min?: number;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name = '';\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: 'text' | 'email' | 'password' | 'tel' | 'url' | 'search' | 'number' = 'text';\n\n /**\n * The initial value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\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 input', this);\n }\n }\n\n /**\n * Sets focus on the input. Use this method instead of `input.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 /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.getMessage('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.max}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={this.i18n.getMessage('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\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.value = this.input.value;\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"],"version":3}
@@ -37,7 +37,8 @@ const CatRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
37
37
  this.required = false;
38
38
  }
39
39
  componentWillRender() {
40
- if (!this.label && !this.hostElement.querySelector('[slot="label"]')) {
40
+ this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
41
+ if (!this.label && !this.hasSlottedLabel) {
41
42
  loglevel.error('[A11y] Missing ARIA label on radio', this);
42
43
  }
43
44
  }