@haiilo/catalyst 2.1.2 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalyst/catalyst.css +1 -1
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/p-757cf2e8.entry.js +2 -0
- package/dist/catalyst/p-757cf2e8.entry.js.map +1 -0
- package/dist/catalyst/scss/core/_typography.scss +6 -1
- package/dist/catalyst/scss/index.scss +0 -1
- package/dist/cjs/cat-alert_22.cjs.entry.js +20 -0
- package/dist/cjs/cat-alert_22.cjs.entry.js.map +1 -1
- package/dist/collection/components/cat-badge/cat-badge.js +21 -2
- package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
- package/dist/collection/scss/core/_typography.scss +6 -1
- package/dist/collection/scss/index.scss +0 -1
- package/dist/collection/utils/setDefault.js +6 -0
- package/dist/collection/utils/setDefault.js.map +1 -1
- package/dist/components/cat-badge.js +15 -1
- package/dist/components/cat-badge.js.map +1 -1
- package/dist/components/setDefault.js +7 -1
- package/dist/components/setDefault.js.map +1 -1
- package/dist/esm/cat-alert_22.entry.js +20 -0
- package/dist/esm/cat-alert_22.entry.js.map +1 -1
- package/dist/types/components/cat-badge/cat-badge.d.ts +3 -0
- package/dist/types/utils/setDefault.d.ts +6 -0
- package/package.json +2 -2
- package/dist/catalyst/p-c0ccf7d1.entry.js +0 -2
- package/dist/catalyst/p-c0ccf7d1.entry.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component, Element,
|
|
2
|
-
import { setPropertyDefault } from '../../utils/setDefault';
|
|
1
|
+
import { Component, Element, Prop, Watch, h } from '@stencil/core';
|
|
2
|
+
import { setProperty, setPropertyDefault } from '../../utils/setDefault';
|
|
3
3
|
/**
|
|
4
4
|
* Badges are used to inform users of the status of an object or of an action
|
|
5
5
|
* that’s been taken.
|
|
@@ -35,6 +35,15 @@ export class CatBadge {
|
|
|
35
35
|
render() {
|
|
36
36
|
return h("slot", null);
|
|
37
37
|
}
|
|
38
|
+
onColorChanged() {
|
|
39
|
+
setProperty(this, 'color');
|
|
40
|
+
}
|
|
41
|
+
onSizeChanged() {
|
|
42
|
+
setProperty(this, 'size');
|
|
43
|
+
}
|
|
44
|
+
onVariantChanged() {
|
|
45
|
+
setProperty(this, 'variant');
|
|
46
|
+
}
|
|
38
47
|
static get is() { return "cat-badge"; }
|
|
39
48
|
static get encapsulation() { return "shadow"; }
|
|
40
49
|
static get originalStyleUrls() { return {
|
|
@@ -136,5 +145,15 @@ export class CatBadge {
|
|
|
136
145
|
}
|
|
137
146
|
}; }
|
|
138
147
|
static get elementRef() { return "hostElement"; }
|
|
148
|
+
static get watchers() { return [{
|
|
149
|
+
"propName": "color",
|
|
150
|
+
"methodName": "onColorChanged"
|
|
151
|
+
}, {
|
|
152
|
+
"propName": "size",
|
|
153
|
+
"methodName": "onSizeChanged"
|
|
154
|
+
}, {
|
|
155
|
+
"propName": "variant",
|
|
156
|
+
"methodName": "onVariantChanged"
|
|
157
|
+
}]; }
|
|
139
158
|
}
|
|
140
159
|
//# sourceMappingURL=cat-badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-badge.js","sourceRoot":"","sources":["../../../src/components/cat-badge/cat-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cat-badge.js","sourceRoot":"","sources":["../../../src/components/cat-badge/cat-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;;GAGG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAQE;;OAEG;IACK,YAAO,GAA0B,QAAQ,CAAC;IAElD;;OAEG;IACK,UAAK,GAA+D,SAAS,CAAC;IAEtF;;OAEG;IACK,SAAI,GAAkC,GAAG,CAAC;IAElD;;OAEG;IACK,UAAK,GAAG,KAAK,CAAC;IAEtB;;OAEG;IACK,UAAK,GAAG,KAAK,CAAC;GA0BvB;EAxBC,iBAAiB;IACf,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;EACnC,CAAC;EAED,MAAM;IACJ,OAAO,eAAa,CAAC;EACvB,CAAC;EAGD,cAAc;IACZ,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;EAC7B,CAAC;EAGD,aAAa;IACX,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;EAC5B,CAAC;EAGD,gBAAgB;IACd,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;EAC/B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Prop, Watch, h } from '@stencil/core';\nimport { setProperty, setPropertyDefault } from '../../utils/setDefault';\n\n/**\n * Badges are used to inform users of the status of an object or of an action\n * that’s been taken.\n */\n@Component({\n tag: 'cat-badge',\n styleUrl: 'cat-badge.scss',\n shadow: true\n})\nexport class CatBadge {\n @Element() hostElement!: HTMLElement;\n\n /**\n * The rendering style of the badge.\n */\n @Prop() variant: 'filled' | 'outlined' = 'filled';\n\n /**\n * The color palette of the badge.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The size of the badge.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * Use round badge edges.\n */\n @Prop() round = false;\n\n /**\n * Draw attention to the badge with a subtle animation.\n */\n @Prop() pulse = false;\n\n connectedCallback() {\n setPropertyDefault(this, 'variant');\n setPropertyDefault(this, 'color');\n setPropertyDefault(this, 'size');\n }\n\n render() {\n return <slot></slot>;\n }\n\n @Watch('color')\n onColorChanged() {\n setProperty(this, 'color');\n }\n\n @Watch('size')\n onSizeChanged() {\n setProperty(this, 'size');\n }\n\n @Watch('variant')\n onVariantChanged() {\n setProperty(this, 'variant');\n }\n}\n"]}
|
|
@@ -6,4 +6,10 @@ export function setAttributeDefault(host, attr, value) {
|
|
|
6
6
|
export function setPropertyDefault(host, prop) {
|
|
7
7
|
setAttributeDefault(host, String(prop), host[prop]);
|
|
8
8
|
}
|
|
9
|
+
export function setAttribute(host, attr, value) {
|
|
10
|
+
host.hostElement.setAttribute(attr, String(value));
|
|
11
|
+
}
|
|
12
|
+
export function setProperty(host, prop) {
|
|
13
|
+
setAttribute(host, String(prop), host[prop]);
|
|
14
|
+
}
|
|
9
15
|
//# sourceMappingURL=setDefault.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setDefault.js","sourceRoot":"","sources":["../../src/utils/setDefault.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CACjC,IAAO,EACP,IAAY,EACZ,KAAc;EAEd,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE;IACzD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;GACpD;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAyC,IAAO,EAAE,IAAa;EAC/F,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["export function setAttributeDefault<T extends { hostElement: HTMLElement }>(\n host: T,\n attr: string,\n value: unknown\n): void {\n if (!host.hostElement.hasAttribute(attr) && value != null) {\n host.hostElement.setAttribute(attr, String(value));\n }\n}\n\nexport function setPropertyDefault<T extends { hostElement: HTMLElement }>(host: T, prop: keyof T): void {\n setAttributeDefault(host, String(prop), host[prop]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"setDefault.js","sourceRoot":"","sources":["../../src/utils/setDefault.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CACjC,IAAO,EACP,IAAY,EACZ,KAAc;EAEd,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE;IACzD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;GACpD;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAyC,IAAO,EAAE,IAAa;EAC/F,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,YAAY,CAAyC,IAAO,EAAE,IAAY,EAAE,KAAc;EACxG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,WAAW,CAAyC,IAAO,EAAE,IAAa;EACxF,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["export function setAttributeDefault<T extends { hostElement: HTMLElement }>(\n host: T,\n attr: string,\n value: unknown\n): void {\n if (!host.hostElement.hasAttribute(attr) && value != null) {\n host.hostElement.setAttribute(attr, String(value));\n }\n}\n\nexport function setPropertyDefault<T extends { hostElement: HTMLElement }>(host: T, prop: keyof T): void {\n setAttributeDefault(host, String(prop), host[prop]);\n}\n\nexport function setAttribute<T extends { hostElement: HTMLElement }>(host: T, attr: string, value: unknown): void {\n host.hostElement.setAttribute(attr, String(value));\n}\n\nexport function setProperty<T extends { hostElement: HTMLElement }>(host: T, prop: keyof T): void {\n setAttribute(host, String(prop), host[prop]);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { a as setPropertyDefault } from './setDefault.js';
|
|
2
|
+
import { a as setPropertyDefault, b as setProperty } from './setDefault.js';
|
|
3
3
|
|
|
4
4
|
const catBadgeCss = ":host([hidden]){display:none}:host{display:inline-flex;max-width:100%;vertical-align:baseline;align-items:center;justify-content:center;border-radius:var(--cat-border-radius-m, 0.25rem);text-decoration:none;line-height:1.5}:host slot{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}:host([round]){border-radius:10rem}:host([variant=filled]){background-color:rgba(var(--bg), 0.1);color:rgb(var(--text));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}:host([variant=outlined]){background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);color:rgb(var(--text))}:host([color=primary]){--bg:var(--cat-primary-bg, 0, 129, 148);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 0, 129, 148);--border:var(--cat-primary-text, 0, 129, 148)}:host([color=secondary]){--bg:var(--cat-secondary-bg, 105, 118, 135);--fill:var(--cat-secondary-fill, 255, 255, 255);--text:var(--cat-secondary-text, 0, 0, 0);--border:var(--cat-secondary-bg, 105, 118, 135)}:host([color=success]){--bg:var(--cat-success-bg-, 0, 132, 88);--fill:var(--cat-success-fill, 255, 255, 255);--text:var(--cat-success-text, 0, 132, 88);--border:var(--cat-success-text, 0, 132, 88)}:host([color=warning]){--bg:var(--cat-warning-bg, 255, 206, 128);--fill:var(--cat-warning-fill, 0, 0, 0);--text:var(--cat-warning-text, 159, 97, 0);--border:var(--cat-warning-text, 159, 97, 0)}:host([color=danger]){--bg:var(--cat-danger-bg, 217, 52, 13);--fill:var(--cat-danger-fill, 255, 255, 255);--text:var(--cat-danger-text, 217, 52, 13);--border:var(--cat-danger-text, 217, 52, 13)}:host([size=xs]){height:1rem;min-width:1rem;font-size:0.75rem;padding:0 0.25rem}:host([size=s]){height:1.5rem;min-width:1.5rem;font-size:0.75rem;padding:0 0.5rem}:host([size=m]){height:2rem;min-width:2rem;font-size:0.875rem;padding:0 0.75rem}:host([size=l]){height:2.5rem;min-width:2.5rem;font-size:0.9375rem;padding:0 1rem}:host([size=xl]){height:3rem;min-width:3rem;font-size:1.125rem;padding:0 1rem}:host([pulse][variant=filled]){animation:1.5s ease 0s infinite normal none running pulse}:host([pulse][variant=outlined]){animation:1.5s ease 0s infinite normal none running pulse-outlined}@keyframes pulse{0%{box-shadow:0 0 0 0 rgb(var(--bg))}70%{box-shadow:transparent 0 0 0 0.5rem}100%{box-shadow:transparent 0 0 0 0}}@keyframes pulse-outlined{0%{box-shadow:0 0 0 0 rgb(var(--bg)), inset 0 0 0 1px rgba(var(--border), 0.2)}70%{box-shadow:transparent 0 0 0 0.5rem, inset 0 0 0 1px rgba(var(--border), 0.2)}100%{box-shadow:transparent 0 0 0 0, inset 0 0 0 1px rgba(var(--border), 0.2)}}";
|
|
5
5
|
|
|
@@ -37,7 +37,21 @@ const CatBadge$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
37
37
|
render() {
|
|
38
38
|
return h("slot", null);
|
|
39
39
|
}
|
|
40
|
+
onColorChanged() {
|
|
41
|
+
setProperty(this, 'color');
|
|
42
|
+
}
|
|
43
|
+
onSizeChanged() {
|
|
44
|
+
setProperty(this, 'size');
|
|
45
|
+
}
|
|
46
|
+
onVariantChanged() {
|
|
47
|
+
setProperty(this, 'variant');
|
|
48
|
+
}
|
|
40
49
|
get hostElement() { return this; }
|
|
50
|
+
static get watchers() { return {
|
|
51
|
+
"color": ["onColorChanged"],
|
|
52
|
+
"size": ["onSizeChanged"],
|
|
53
|
+
"variant": ["onVariantChanged"]
|
|
54
|
+
}; }
|
|
41
55
|
static get style() { return catBadgeCss; }
|
|
42
56
|
}, [1, "cat-badge", {
|
|
43
57
|
"variant": [1],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"cat-badge.js","mappings":";;;AAAA,MAAM,WAAW,GAAG,+jFAA+jF;;MCYtkFA,UAAQ;EALrB;;;;;;;IAWU,YAAO,GAA0B,QAAQ,CAAC;;;;IAK1C,UAAK,GAA+D,SAAS,CAAC;;;;IAK9E,SAAI,GAAkC,GAAG,CAAC;;;;IAK1C,UAAK,GAAG,KAAK,CAAC;;;;IAKd,UAAK,GAAG,KAAK,CAAC;
|
|
1
|
+
{"file":"cat-badge.js","mappings":";;;AAAA,MAAM,WAAW,GAAG,+jFAA+jF;;MCYtkFA,UAAQ;EALrB;;;;;;;IAWU,YAAO,GAA0B,QAAQ,CAAC;;;;IAK1C,UAAK,GAA+D,SAAS,CAAC;;;;IAK9E,SAAI,GAAkC,GAAG,CAAC;;;;IAK1C,UAAK,GAAG,KAAK,CAAC;;;;IAKd,UAAK,GAAG,KAAK,CAAC;GA0BvB;EAxBC,iBAAiB;IACf,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;GAClC;EAED,MAAM;IACJ,OAAO,eAAa,CAAC;GACtB;EAGD,cAAc;IACZ,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;GAC5B;EAGD,aAAa;IACX,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;GAC3B;EAGD,gBAAgB;IACd,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;GAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatBadge"],"sources":["./src/components/cat-badge/cat-badge.scss?tag=cat-badge&encapsulation=shadow","./src/components/cat-badge/cat-badge.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n// -----\n\n$-sizes: (\n 'xl': 3rem,\n 'l': 2.5rem,\n 'm': 2rem,\n 's': 1.5rem,\n 'xs': 1rem\n);\n$-paddings: (\n 'xl': 0 1rem,\n 'l': 0 1rem,\n 'm': 0 0.75rem,\n 's': 0 0.5rem,\n 'xs': 0 0.25rem\n);\n\n// -----\n\n:host([hidden]) {\n display: none;\n}\n\n:host {\n display: inline-flex;\n max-width: 100%;\n vertical-align: baseline;\n align-items: center;\n justify-content: center;\n border-radius: cat-border-radius('m');\n text-decoration: none;\n line-height: 1.5;\n\n slot {\n display: inline-block;\n @include cat-ellipsis;\n }\n}\n\n// ----- round\n\n:host([round]) {\n border-radius: 10rem;\n}\n\n// ----- theme\n\n:host([variant='filled']) {\n background-color: cat-token-wrap(var(--bg), 0.1);\n color: cat-token-wrap(var(--text));\n font-weight: 600;\n @include cat-font-smooth;\n}\n\n$-outline: inset 0 0 0 1px cat-token-wrap(var(--border), $alpha: 0.2);\n\n:host([variant='outlined']) {\n background-color: cat-token('color.ui.background.body');\n box-shadow: $-outline;\n color: cat-token-wrap(var(--text));\n}\n\n@mixin theme($theme) {\n :host([color='#{$theme}']) {\n --bg: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fill', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n @if $theme == 'secondary' {\n --border: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --border: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n\n// ----- size\n\n@mixin size($size, $fontSize) {\n :host([size='#{$size}']) {\n height: map.get($-sizes, $size);\n min-width: map.get($-sizes, $size);\n font-size: cat-body-font-size($fontSize);\n padding: map.get($-paddings, $size);\n }\n}\n\n@include size('xs', 'xs');\n@include size('s', 'xs');\n@include size('m', 's');\n@include size('l', 'm');\n@include size('xl', 'l');\n\n// ----- pulse\n\n$-pulse-0: 0 0 0 0 cat-token-wrap(var(--bg));\n$-pulse-70: transparent 0 0 0 0.5rem;\n$-pulse-100: transparent 0 0 0 0;\n\n:host([pulse][variant='filled']) {\n animation: 1.5s ease 0s infinite normal none running pulse;\n}\n\n:host([pulse][variant='outlined']) {\n animation: 1.5s ease 0s infinite normal none running pulse-outlined;\n}\n\n@keyframes pulse {\n 0% {\n box-shadow: $-pulse-0;\n }\n\n 70% {\n box-shadow: $-pulse-70;\n }\n\n 100% {\n box-shadow: $-pulse-100;\n }\n}\n\n@keyframes pulse-outlined {\n 0% {\n box-shadow: $-pulse-0, $-outline;\n }\n\n 70% {\n box-shadow: $-pulse-70, $-outline;\n }\n\n 100% {\n box-shadow: $-pulse-100, $-outline;\n }\n}\n","import { Component, Element, Prop, Watch, h } from '@stencil/core';\nimport { setProperty, setPropertyDefault } from '../../utils/setDefault';\n\n/**\n * Badges are used to inform users of the status of an object or of an action\n * that’s been taken.\n */\n@Component({\n tag: 'cat-badge',\n styleUrl: 'cat-badge.scss',\n shadow: true\n})\nexport class CatBadge {\n @Element() hostElement!: HTMLElement;\n\n /**\n * The rendering style of the badge.\n */\n @Prop() variant: 'filled' | 'outlined' = 'filled';\n\n /**\n * The color palette of the badge.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The size of the badge.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * Use round badge edges.\n */\n @Prop() round = false;\n\n /**\n * Draw attention to the badge with a subtle animation.\n */\n @Prop() pulse = false;\n\n connectedCallback() {\n setPropertyDefault(this, 'variant');\n setPropertyDefault(this, 'color');\n setPropertyDefault(this, 'size');\n }\n\n render() {\n return <slot></slot>;\n }\n\n @Watch('color')\n onColorChanged() {\n setProperty(this, 'color');\n }\n\n @Watch('size')\n onSizeChanged() {\n setProperty(this, 'size');\n }\n\n @Watch('variant')\n onVariantChanged() {\n setProperty(this, 'variant');\n }\n}\n"],"version":3}
|
|
@@ -6,7 +6,13 @@ function setAttributeDefault(host, attr, value) {
|
|
|
6
6
|
function setPropertyDefault(host, prop) {
|
|
7
7
|
setAttributeDefault(host, String(prop), host[prop]);
|
|
8
8
|
}
|
|
9
|
+
function setAttribute(host, attr, value) {
|
|
10
|
+
host.hostElement.setAttribute(attr, String(value));
|
|
11
|
+
}
|
|
12
|
+
function setProperty(host, prop) {
|
|
13
|
+
setAttribute(host, String(prop), host[prop]);
|
|
14
|
+
}
|
|
9
15
|
|
|
10
|
-
export { setPropertyDefault as a, setAttributeDefault as s };
|
|
16
|
+
export { setPropertyDefault as a, setProperty as b, setAttributeDefault as s };
|
|
11
17
|
|
|
12
18
|
//# sourceMappingURL=setDefault.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"setDefault.js","mappings":"SAAgB,mBAAmB,CACjC,IAAO,EACP,IAAY,EACZ,KAAc;EAEd,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE;IACzD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;GACpD;AACH,CAAC;SAEe,kBAAkB,CAAyC,IAAO,EAAE,IAAa;EAC/F,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD;;;;","names":[],"sources":["./src/utils/setDefault.ts"],"sourcesContent":["export function setAttributeDefault<T extends { hostElement: HTMLElement }>(\n host: T,\n attr: string,\n value: unknown\n): void {\n if (!host.hostElement.hasAttribute(attr) && value != null) {\n host.hostElement.setAttribute(attr, String(value));\n }\n}\n\nexport function setPropertyDefault<T extends { hostElement: HTMLElement }>(host: T, prop: keyof T): void {\n setAttributeDefault(host, String(prop), host[prop]);\n}\n"],"version":3}
|
|
1
|
+
{"file":"setDefault.js","mappings":"SAAgB,mBAAmB,CACjC,IAAO,EACP,IAAY,EACZ,KAAc;EAEd,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE;IACzD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;GACpD;AACH,CAAC;SAEe,kBAAkB,CAAyC,IAAO,EAAE,IAAa;EAC/F,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;SAEe,YAAY,CAAyC,IAAO,EAAE,IAAY,EAAE,KAAc;EACxG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC;SAEe,WAAW,CAAyC,IAAO,EAAE,IAAa;EACxF,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C;;;;","names":[],"sources":["./src/utils/setDefault.ts"],"sourcesContent":["export function setAttributeDefault<T extends { hostElement: HTMLElement }>(\n host: T,\n attr: string,\n value: unknown\n): void {\n if (!host.hostElement.hasAttribute(attr) && value != null) {\n host.hostElement.setAttribute(attr, String(value));\n }\n}\n\nexport function setPropertyDefault<T extends { hostElement: HTMLElement }>(host: T, prop: keyof T): void {\n setAttributeDefault(host, String(prop), host[prop]);\n}\n\nexport function setAttribute<T extends { hostElement: HTMLElement }>(host: T, attr: string, value: unknown): void {\n host.hostElement.setAttribute(attr, String(value));\n}\n\nexport function setProperty<T extends { hostElement: HTMLElement }>(host: T, prop: keyof T): void {\n setAttribute(host, String(prop), host[prop]);\n}\n"],"version":3}
|
|
@@ -10,6 +10,12 @@ function setAttributeDefault(host, attr, value) {
|
|
|
10
10
|
function setPropertyDefault(host, prop) {
|
|
11
11
|
setAttributeDefault(host, String(prop), host[prop]);
|
|
12
12
|
}
|
|
13
|
+
function setAttribute(host, attr, value) {
|
|
14
|
+
host.hostElement.setAttribute(attr, String(value));
|
|
15
|
+
}
|
|
16
|
+
function setProperty(host, prop) {
|
|
17
|
+
setAttribute(host, String(prop), host[prop]);
|
|
18
|
+
}
|
|
13
19
|
|
|
14
20
|
const catAlertCss = ":host{display:flex;gap:0.5rem;padding:1.25rem;border-radius:var(--cat-border-radius-l, 0.5rem);margin-bottom:1rem}:host([hidden]){display:none}:host(:focus-visible){outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.content{align-self:center}::slotted(:last-child){margin-bottom:0 !important}:host([color=primary]){background-color:rgba(var(--cat-primary-bg, 0, 129, 148), 0.1)}:host([color=primary]) cat-icon{color:rgb(var(--cat-primary-text, 0, 129, 148))}:host([color=secondary]){background-color:rgba(var(--cat-secondary-bg, 105, 118, 135), 0.1)}:host([color=secondary]) cat-icon{color:#697687}:host([color=success]){background-color:rgba(var(--cat-success-bg-, 0, 132, 88), 0.1)}:host([color=success]) cat-icon{color:#008458}:host([color=warning]){background-color:rgba(var(--cat-warning-bg, 255, 206, 128), 0.1)}:host([color=warning]) cat-icon{color:#ebb663}:host([color=danger]){background-color:rgba(var(--cat-danger-bg, 217, 52, 13), 0.1)}:host([color=danger]) cat-icon{color:#d9340d}";
|
|
15
21
|
|
|
@@ -170,7 +176,21 @@ const CatBadge = class {
|
|
|
170
176
|
render() {
|
|
171
177
|
return h("slot", null);
|
|
172
178
|
}
|
|
179
|
+
onColorChanged() {
|
|
180
|
+
setProperty(this, 'color');
|
|
181
|
+
}
|
|
182
|
+
onSizeChanged() {
|
|
183
|
+
setProperty(this, 'size');
|
|
184
|
+
}
|
|
185
|
+
onVariantChanged() {
|
|
186
|
+
setProperty(this, 'variant');
|
|
187
|
+
}
|
|
173
188
|
get hostElement() { return getElement(this); }
|
|
189
|
+
static get watchers() { return {
|
|
190
|
+
"color": ["onColorChanged"],
|
|
191
|
+
"size": ["onSizeChanged"],
|
|
192
|
+
"variant": ["onVariantChanged"]
|
|
193
|
+
}; }
|
|
174
194
|
};
|
|
175
195
|
CatBadge.style = catBadgeCss;
|
|
176
196
|
|