@haiilo/catalyst 0.4.0 → 0.5.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/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.esm.js +1 -1
- package/dist/catalyst/p-23d54bc6.js +2 -0
- package/dist/catalyst/p-23d54bc6.js.map +1 -0
- package/dist/catalyst/p-84693f87.entry.js +24 -0
- package/dist/catalyst/p-84693f87.entry.js.map +1 -0
- package/dist/catalyst/p-8f5cfa78.js +2 -0
- package/dist/catalyst/p-8f5cfa78.js.map +1 -0
- package/dist/catalyst/{p-ed826597.js → p-fa7da4c6.js} +2 -2
- package/dist/catalyst/p-fa7da4c6.js.map +1 -0
- package/dist/cjs/{app-globals-7f2b1f8e.js → app-globals-50e7504d.js} +9 -2
- package/dist/cjs/app-globals-50e7504d.js.map +1 -0
- package/dist/cjs/{cat-alert_9.cjs.entry.js → cat-alert_15.cjs.entry.js} +449 -354
- package/dist/cjs/cat-alert_15.cjs.entry.js.map +1 -0
- package/dist/cjs/cat-icon-registry-6895750f.js +441 -0
- package/dist/cjs/cat-icon-registry-6895750f.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +4 -4
- package/dist/cjs/{index-c0881ae0.js → index-2db8e23d.js} +1 -2
- package/dist/cjs/index-2db8e23d.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/cat-alert/cat-alert.css +11 -6
- package/dist/collection/components/cat-alert/cat-alert.js +19 -8
- package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
- package/dist/collection/components/cat-badge/cat-badge.css +17 -17
- package/dist/collection/components/cat-badge/cat-badge.js +9 -8
- package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.css +18 -8
- package/dist/collection/components/cat-button/cat-button.js +32 -8
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-card/cat-card.css +25 -0
- package/dist/collection/components/cat-card/cat-card.js +20 -0
- package/dist/collection/components/cat-card/cat-card.js.map +1 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +105 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +314 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +69 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -0
- package/dist/collection/components/cat-icon/cat-icon-registry.js +14 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon.css +5 -5
- package/dist/collection/components/cat-icon/cat-icon.js +3 -2
- package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.css +131 -0
- package/dist/collection/components/cat-input/cat-input.js +606 -0
- package/dist/collection/components/cat-input/cat-input.js.map +1 -0
- package/dist/collection/components/cat-menu/cat-menu.css +2 -1
- package/dist/collection/components/cat-radio/cat-radio.css +84 -0
- package/dist/collection/components/cat-radio/cat-radio.js +283 -0
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -0
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +4 -2
- package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.css +30 -30
- package/dist/collection/components/cat-skeleton/cat-skeleton.js +4 -4
- package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.css +7 -7
- package/dist/collection/components/cat-spinner/cat-spinner.js +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.css +74 -0
- package/dist/collection/components/cat-textarea/cat-textarea.js +393 -0
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -0
- package/dist/collection/components/cat-toggle/cat-toggle.css +93 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js +283 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +9 -5
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +2 -2
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/init.js +9 -1
- package/dist/collection/init.js.map +1 -1
- package/dist/components/cat-alert.js +15 -6
- package/dist/components/cat-alert.js.map +1 -1
- package/dist/components/cat-badge.js +7 -7
- package/dist/components/cat-badge.js.map +1 -1
- package/dist/components/cat-button.js +1 -647
- package/dist/components/cat-button.js.map +1 -1
- package/dist/components/cat-button2.js +346 -0
- package/dist/components/cat-button2.js.map +1 -0
- package/dist/components/cat-card.d.ts +11 -0
- package/dist/components/cat-card.js +35 -0
- package/dist/components/cat-card.js.map +1 -0
- package/dist/components/cat-checkbox.d.ts +11 -0
- package/dist/components/cat-checkbox.js +103 -0
- package/dist/components/cat-checkbox.js.map +1 -0
- package/dist/components/cat-i18n-registry.js +73 -0
- package/dist/components/cat-i18n-registry.js.map +1 -0
- package/dist/components/cat-icon-registry.js +15 -1
- package/dist/components/cat-icon-registry.js.map +1 -1
- package/dist/components/cat-icon2.js +3 -2
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.d.ts +11 -0
- package/dist/components/cat-input.js +172 -0
- package/dist/components/cat-input.js.map +1 -0
- package/dist/components/cat-menu.js +1 -1
- package/dist/components/cat-menu.js.map +1 -1
- package/dist/components/cat-radio.d.ts +11 -0
- package/dist/components/cat-radio.js +93 -0
- package/dist/components/cat-radio.js.map +1 -0
- package/dist/components/cat-scrollable.js +1 -2
- package/dist/components/cat-scrollable.js.map +1 -1
- package/dist/components/cat-skeleton.js +5 -5
- package/dist/components/cat-skeleton.js.map +1 -1
- package/dist/components/cat-spinner2.js +2 -2
- package/dist/components/cat-spinner2.js.map +1 -1
- package/dist/components/cat-textarea.d.ts +11 -0
- package/dist/components/cat-textarea.js +119 -0
- package/dist/components/cat-textarea.js.map +1 -0
- package/dist/components/cat-toggle.d.ts +11 -0
- package/dist/components/cat-toggle.js +93 -0
- package/dist/components/cat-toggle.js.map +1 -0
- package/dist/components/cat-tooltip.js +2 -2
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/first-tabbable.js +5 -4
- package/dist/components/first-tabbable.js.map +1 -1
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/loglevel.js +315 -0
- package/dist/components/loglevel.js.map +1 -0
- package/dist/esm/{app-globals-8af9b2cf.js → app-globals-6906ac5c.js} +9 -2
- package/dist/esm/app-globals-6906ac5c.js.map +1 -0
- package/dist/esm/{cat-alert_9.entry.js → cat-alert_15.entry.js} +442 -353
- package/dist/esm/cat-alert_15.entry.js.map +1 -0
- package/dist/esm/cat-icon-registry-77963c26.js +437 -0
- package/dist/esm/cat-icon-registry-77963c26.js.map +1 -0
- package/dist/esm/catalyst.js +4 -4
- package/dist/esm/{index-0ff35bca.js → index-1f3ca03b.js} +2 -2
- package/dist/esm/index-1f3ca03b.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +4 -4
- package/dist/types/components/cat-alert/cat-alert.d.ts +4 -2
- package/dist/types/components/cat-badge/cat-badge.d.ts +3 -2
- package/dist/types/components/cat-button/cat-button.d.ts +8 -3
- package/dist/types/components/cat-card/cat-card.d.ts +7 -0
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +69 -0
- package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +18 -0
- package/dist/types/components/cat-icon/cat-icon-registry.d.ts +4 -4
- package/dist/types/components/cat-icon/cat-icon.d.ts +1 -1
- package/dist/types/components/cat-input/cat-input.d.ts +130 -0
- package/dist/types/components/cat-radio/cat-radio.d.ts +63 -0
- package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +3 -1
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +85 -0
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +64 -0
- package/dist/types/components.d.ts +619 -4
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -3
- package/dist/catalyst/p-89a97b7b.entry.js +0 -10
- package/dist/catalyst/p-89a97b7b.entry.js.map +0 -1
- package/dist/catalyst/p-ed826597.js.map +0 -1
- package/dist/catalyst/p-ef0a8ae9.js +0 -2
- package/dist/catalyst/p-ef0a8ae9.js.map +0 -1
- package/dist/catalyst/p-f151cb13.js +0 -2
- package/dist/catalyst/p-f151cb13.js.map +0 -1
- package/dist/cjs/app-globals-7f2b1f8e.js.map +0 -1
- package/dist/cjs/cat-alert_9.cjs.entry.js.map +0 -1
- package/dist/cjs/cat-icon-registry-850c538c.js +0 -47
- package/dist/cjs/cat-icon-registry-850c538c.js.map +0 -1
- package/dist/cjs/index-c0881ae0.js.map +0 -1
- package/dist/collection/utils/utils.js +0 -4
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/esm/app-globals-8af9b2cf.js.map +0 -1
- package/dist/esm/cat-alert_9.entry.js.map +0 -1
- package/dist/esm/cat-icon-registry-59da2e37.js +0 -45
- package/dist/esm/cat-icon-registry-59da2e37.js.map +0 -1
- package/dist/esm/index-0ff35bca.js.map +0 -1
- package/dist/types/utils/utils.d.ts +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated file. Do not edit directly.
|
|
3
|
+
*/
|
|
4
|
+
/* stylelint-disable value-keyword-case */
|
|
5
|
+
/* stylelint-enable value-keyword-case */
|
|
6
|
+
:host {
|
|
7
|
+
display: flex;
|
|
8
|
+
margin-bottom: 1rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([hidden]) {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
label {
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: 0.5rem;
|
|
18
|
+
font-size: 0.9375rem;
|
|
19
|
+
line-height: 1.25rem;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.radio {
|
|
24
|
+
display: flex;
|
|
25
|
+
position: relative;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.circle {
|
|
29
|
+
position: absolute;
|
|
30
|
+
width: 0.75rem;
|
|
31
|
+
height: 0.75rem;
|
|
32
|
+
background-color: rgb(var(--cat-primary-bg, 32, 127, 138));
|
|
33
|
+
border-radius: 10rem;
|
|
34
|
+
top: calc(50% - 0.375rem);
|
|
35
|
+
left: calc(50% - 0.375rem);
|
|
36
|
+
visibility: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
input {
|
|
40
|
+
margin: 0;
|
|
41
|
+
width: 1.25rem;
|
|
42
|
+
height: 1.25rem;
|
|
43
|
+
appearance: none;
|
|
44
|
+
background-color: white;
|
|
45
|
+
border: 1px solid #d7dbe0;
|
|
46
|
+
border-radius: 10rem;
|
|
47
|
+
cursor: inherit;
|
|
48
|
+
}
|
|
49
|
+
input:checked {
|
|
50
|
+
border-color: rgb(var(--cat-primary-bg, 32, 127, 138));
|
|
51
|
+
}
|
|
52
|
+
input:checked + .circle {
|
|
53
|
+
visibility: visible;
|
|
54
|
+
}
|
|
55
|
+
input:focus-visible {
|
|
56
|
+
outline: 2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));
|
|
57
|
+
outline-offset: 1px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.is-hidden .label {
|
|
61
|
+
position: absolute !important;
|
|
62
|
+
width: 1px !important;
|
|
63
|
+
height: 1px !important;
|
|
64
|
+
padding: 0 !important;
|
|
65
|
+
margin: -1px !important;
|
|
66
|
+
overflow: hidden !important;
|
|
67
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
68
|
+
white-space: nowrap !important;
|
|
69
|
+
border: 0 !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.is-disabled {
|
|
73
|
+
cursor: not-allowed;
|
|
74
|
+
color: rgb(var(--cat-font-color-muted, 105, 118, 135));
|
|
75
|
+
}
|
|
76
|
+
.is-disabled input {
|
|
77
|
+
background-color: #f8f8fb;
|
|
78
|
+
}
|
|
79
|
+
.is-disabled input:checked {
|
|
80
|
+
border-color: #d7dbe0;
|
|
81
|
+
}
|
|
82
|
+
.is-disabled .circle {
|
|
83
|
+
background-color: #d7dbe0;
|
|
84
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Component, Event, h, Prop, Method } from '@stencil/core';
|
|
2
|
+
import log from 'loglevel';
|
|
3
|
+
let nextUniqueId = 0;
|
|
4
|
+
/**
|
|
5
|
+
* Radio Buttons are graphical interface elements that allow user to choose
|
|
6
|
+
* only one of a predefined set of mutually exclusive options.
|
|
7
|
+
*
|
|
8
|
+
* @part label - The label content.
|
|
9
|
+
*/
|
|
10
|
+
export class CatRadio {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.id = `cat-radio-${++nextUniqueId}`;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this radio is checked.
|
|
15
|
+
*/
|
|
16
|
+
this.checked = false;
|
|
17
|
+
/**
|
|
18
|
+
* Whether this radio is disabled.
|
|
19
|
+
*/
|
|
20
|
+
this.disabled = false;
|
|
21
|
+
/**
|
|
22
|
+
* The label of the radio that is visible.
|
|
23
|
+
*/
|
|
24
|
+
this.label = '';
|
|
25
|
+
/**
|
|
26
|
+
* Visually hide the label, but still show it to assistive technologies like screen readers.
|
|
27
|
+
*/
|
|
28
|
+
this.labelHidden = false;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the radio is required.
|
|
31
|
+
*/
|
|
32
|
+
this.required = false;
|
|
33
|
+
}
|
|
34
|
+
componentWillRender() {
|
|
35
|
+
if (!this.label) {
|
|
36
|
+
log.error('[A11y] Missing ARIA label on radio', this);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Sets focus on the radio. Use this method instead of `radio.focus()`.
|
|
41
|
+
*
|
|
42
|
+
* @param options An optional object providing options to control aspects of
|
|
43
|
+
* the focusing process.
|
|
44
|
+
*/
|
|
45
|
+
async setFocus(options) {
|
|
46
|
+
this.input.focus(options);
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
return (h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } },
|
|
50
|
+
h("span", { class: "radio" },
|
|
51
|
+
h("input", { ref: el => (this.input = el), id: this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }),
|
|
52
|
+
h("span", { class: "circle" })),
|
|
53
|
+
h("span", { class: "label", part: "label" }, this.label)));
|
|
54
|
+
}
|
|
55
|
+
onChange(event) {
|
|
56
|
+
this.catChange.emit(event);
|
|
57
|
+
}
|
|
58
|
+
onFocus(event) {
|
|
59
|
+
this.catFocus.emit(event);
|
|
60
|
+
}
|
|
61
|
+
onBlur(event) {
|
|
62
|
+
this.catBlur.emit(event);
|
|
63
|
+
}
|
|
64
|
+
static get is() { return "cat-radio"; }
|
|
65
|
+
static get encapsulation() { return "shadow"; }
|
|
66
|
+
static get originalStyleUrls() { return {
|
|
67
|
+
"$": ["cat-radio.scss"]
|
|
68
|
+
}; }
|
|
69
|
+
static get styleUrls() { return {
|
|
70
|
+
"$": ["cat-radio.css"]
|
|
71
|
+
}; }
|
|
72
|
+
static get properties() { return {
|
|
73
|
+
"checked": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"mutable": false,
|
|
76
|
+
"complexType": {
|
|
77
|
+
"original": "boolean",
|
|
78
|
+
"resolved": "boolean",
|
|
79
|
+
"references": {}
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"optional": false,
|
|
83
|
+
"docs": {
|
|
84
|
+
"tags": [],
|
|
85
|
+
"text": "Whether this radio is checked."
|
|
86
|
+
},
|
|
87
|
+
"attribute": "checked",
|
|
88
|
+
"reflect": false,
|
|
89
|
+
"defaultValue": "false"
|
|
90
|
+
},
|
|
91
|
+
"disabled": {
|
|
92
|
+
"type": "boolean",
|
|
93
|
+
"mutable": false,
|
|
94
|
+
"complexType": {
|
|
95
|
+
"original": "boolean",
|
|
96
|
+
"resolved": "boolean",
|
|
97
|
+
"references": {}
|
|
98
|
+
},
|
|
99
|
+
"required": false,
|
|
100
|
+
"optional": false,
|
|
101
|
+
"docs": {
|
|
102
|
+
"tags": [],
|
|
103
|
+
"text": "Whether this radio is disabled."
|
|
104
|
+
},
|
|
105
|
+
"attribute": "disabled",
|
|
106
|
+
"reflect": false,
|
|
107
|
+
"defaultValue": "false"
|
|
108
|
+
},
|
|
109
|
+
"label": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "string",
|
|
114
|
+
"resolved": "string",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": "The label of the radio that is visible."
|
|
122
|
+
},
|
|
123
|
+
"attribute": "label",
|
|
124
|
+
"reflect": false,
|
|
125
|
+
"defaultValue": "''"
|
|
126
|
+
},
|
|
127
|
+
"labelHidden": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"complexType": {
|
|
131
|
+
"original": "boolean",
|
|
132
|
+
"resolved": "boolean",
|
|
133
|
+
"references": {}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": "Visually hide the label, but still show it to assistive technologies like screen readers."
|
|
140
|
+
},
|
|
141
|
+
"attribute": "label-hidden",
|
|
142
|
+
"reflect": false,
|
|
143
|
+
"defaultValue": "false"
|
|
144
|
+
},
|
|
145
|
+
"name": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "string",
|
|
150
|
+
"resolved": "string | undefined",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": true,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": "The name of the radio component."
|
|
158
|
+
},
|
|
159
|
+
"attribute": "name",
|
|
160
|
+
"reflect": false
|
|
161
|
+
},
|
|
162
|
+
"required": {
|
|
163
|
+
"type": "boolean",
|
|
164
|
+
"mutable": false,
|
|
165
|
+
"complexType": {
|
|
166
|
+
"original": "boolean",
|
|
167
|
+
"resolved": "boolean",
|
|
168
|
+
"references": {}
|
|
169
|
+
},
|
|
170
|
+
"required": false,
|
|
171
|
+
"optional": false,
|
|
172
|
+
"docs": {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": "Whether the radio is required."
|
|
175
|
+
},
|
|
176
|
+
"attribute": "required",
|
|
177
|
+
"reflect": false,
|
|
178
|
+
"defaultValue": "false"
|
|
179
|
+
},
|
|
180
|
+
"value": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"mutable": false,
|
|
183
|
+
"complexType": {
|
|
184
|
+
"original": "string",
|
|
185
|
+
"resolved": "string | undefined",
|
|
186
|
+
"references": {}
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"optional": true,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [],
|
|
192
|
+
"text": "The value of the radio component."
|
|
193
|
+
},
|
|
194
|
+
"attribute": "value",
|
|
195
|
+
"reflect": false
|
|
196
|
+
}
|
|
197
|
+
}; }
|
|
198
|
+
static get events() { return [{
|
|
199
|
+
"method": "catChange",
|
|
200
|
+
"name": "catChange",
|
|
201
|
+
"bubbles": true,
|
|
202
|
+
"cancelable": true,
|
|
203
|
+
"composed": true,
|
|
204
|
+
"docs": {
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": "Emitted when the radio is changed."
|
|
207
|
+
},
|
|
208
|
+
"complexType": {
|
|
209
|
+
"original": "any",
|
|
210
|
+
"resolved": "any",
|
|
211
|
+
"references": {}
|
|
212
|
+
}
|
|
213
|
+
}, {
|
|
214
|
+
"method": "catFocus",
|
|
215
|
+
"name": "catFocus",
|
|
216
|
+
"bubbles": true,
|
|
217
|
+
"cancelable": true,
|
|
218
|
+
"composed": true,
|
|
219
|
+
"docs": {
|
|
220
|
+
"tags": [],
|
|
221
|
+
"text": "Emitted when the radio received focus."
|
|
222
|
+
},
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "FocusEvent",
|
|
225
|
+
"resolved": "FocusEvent",
|
|
226
|
+
"references": {
|
|
227
|
+
"FocusEvent": {
|
|
228
|
+
"location": "global"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}, {
|
|
233
|
+
"method": "catBlur",
|
|
234
|
+
"name": "catBlur",
|
|
235
|
+
"bubbles": true,
|
|
236
|
+
"cancelable": true,
|
|
237
|
+
"composed": true,
|
|
238
|
+
"docs": {
|
|
239
|
+
"tags": [],
|
|
240
|
+
"text": "Emitted when the radio loses focus."
|
|
241
|
+
},
|
|
242
|
+
"complexType": {
|
|
243
|
+
"original": "FocusEvent",
|
|
244
|
+
"resolved": "FocusEvent",
|
|
245
|
+
"references": {
|
|
246
|
+
"FocusEvent": {
|
|
247
|
+
"location": "global"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}]; }
|
|
252
|
+
static get methods() { return {
|
|
253
|
+
"setFocus": {
|
|
254
|
+
"complexType": {
|
|
255
|
+
"signature": "(options?: FocusOptions | undefined) => Promise<void>",
|
|
256
|
+
"parameters": [{
|
|
257
|
+
"tags": [{
|
|
258
|
+
"name": "param",
|
|
259
|
+
"text": "options An optional object providing options to control aspects of\nthe focusing process."
|
|
260
|
+
}],
|
|
261
|
+
"text": "An optional object providing options to control aspects of\nthe focusing process."
|
|
262
|
+
}],
|
|
263
|
+
"references": {
|
|
264
|
+
"Promise": {
|
|
265
|
+
"location": "global"
|
|
266
|
+
},
|
|
267
|
+
"FocusOptions": {
|
|
268
|
+
"location": "global"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"return": "Promise<void>"
|
|
272
|
+
},
|
|
273
|
+
"docs": {
|
|
274
|
+
"text": "Sets focus on the radio. Use this method instead of `radio.focus()`.",
|
|
275
|
+
"tags": [{
|
|
276
|
+
"name": "param",
|
|
277
|
+
"text": "options An optional object providing options to control aspects of\nthe focusing process."
|
|
278
|
+
}]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}; }
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=cat-radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cat-radio.js","sourceRoot":"","sources":["../../../src/components/cat-radio/cat-radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;GAKG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAMmB,OAAE,GAAG,aAAa,EAAE,YAAY,EAAE,CAAC;IAGpD;;OAEG;IACK,YAAO,GAAG,KAAK,CAAC;IAExB;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,UAAK,GAAG,EAAE,CAAC;IAEnB;;OAEG;IACK,gBAAW,GAAG,KAAK,CAAC;IAO5B;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;GA4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AC,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, Event, EventEmitter, h, Prop, Method } from '@stencil/core';\nimport log from 'loglevel';\n\nlet nextUniqueId = 0;\n\n/**\n * Radio Buttons are graphical interface elements that allow user to choose\n * only one of a predefined set of mutually exclusive options.\n *\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-radio',\n styleUrl: 'cat-radio.scss',\n shadow: true\n})\nexport class CatRadio {\n private readonly id = `cat-radio-${++nextUniqueId}`;\n private input!: HTMLInputElement;\n\n /**\n * Whether this radio is checked.\n */\n @Prop() checked = false;\n\n /**\n * Whether this radio is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The label of the radio that is visible.\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 radio component.\n */\n @Prop() name?: string;\n\n /**\n * Whether the radio is required.\n */\n @Prop() required = false;\n\n /**\n * The value of the radio component.\n */\n @Prop() value?: string;\n\n /**\n * Emitted when the radio is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the radio received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the radio loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n if (!this.label) {\n log.error('[A11y] Missing ARIA label on radio', this);\n }\n }\n\n /**\n * Sets focus on the radio. Use this method instead of `radio.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 <label htmlFor={this.id} class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled }}>\n <span class=\"radio\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"radio\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onChange.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"circle\"></span>\n </span>\n <span class=\"label\" part=\"label\">\n {this.label}\n </span>\n </label>\n );\n }\n\n private onChange(event: Event) {\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,6 +1,9 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, Event, h, Prop } from '@stencil/core';
|
|
2
2
|
import { fromEvent, merge, Subject } from 'rxjs';
|
|
3
3
|
import { distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';
|
|
4
|
+
/**
|
|
5
|
+
* An element to display scrollable content.
|
|
6
|
+
*/
|
|
4
7
|
export class CatScrollable {
|
|
5
8
|
constructor() {
|
|
6
9
|
this.init = new Subject();
|
|
@@ -304,6 +307,5 @@ export class CatScrollable {
|
|
|
304
307
|
"references": {}
|
|
305
308
|
}
|
|
306
309
|
}]; }
|
|
307
|
-
static get elementRef() { return "el"; }
|
|
308
310
|
}
|
|
309
311
|
//# sourceMappingURL=cat-scrollable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-scrollable.js","sourceRoot":"","sources":["../../../src/components/cat-scrollable/cat-scrollable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"cat-scrollable.js","sourceRoot":"","sources":["../../../src/components/cat-scrollable/cat-scrollable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAc,OAAO,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9E;;GAEG;AAMH,MAAM,OAAO,aAAa;EAL1B;IAQmB,SAAI,GAAG,IAAI,OAAO,EAAQ,CAAC;IAC3B,cAAS,GAAG,IAAI,OAAO,EAAQ,CAAC;IAGjD,8CAA8C;IAE9C,YAAO,GAAG,IAAI,CAAC;IAEf,8CAA8C;IAE9C,YAAO,GAAG,IAAI,CAAC;IAEf,yCAAyC;IAEzC,cAAS,GAAG,IAAI,CAAC;IAEjB,yCAAyC;IAEzC,cAAS,GAAG,IAAI,CAAC;IAEjB,kDAAkD;IAElD,eAAU,GAAG,IAAI,CAAC;IAElB;;OAEG;IACK,iBAAY,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACK,mBAAc,GAAG,CAAC,CAAC;GAsH5B;EAhGC,kBAAkB;IAChB,IAAI,IAAI,CAAC,aAAa,EAAE;MACtB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;KACzF;IACD,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACnE,IAAI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;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport { fromEvent, merge, Observable, Subject } from 'rxjs';\nimport { distinctUntilChanged, filter, map, takeUntil } from 'rxjs/operators';\n\n/**\n * An element to display scrollable content.\n */\n@Component({\n tag: 'cat-scrollable',\n styleUrl: 'cat-scrollable.scss',\n shadow: true\n})\nexport class CatScrollable {\n scrollElement?: HTMLElement;\n scrollWrapperElement?: HTMLElement;\n private readonly init = new Subject<void>();\n private readonly destroyed = new Subject<void>();\n private scrolled!: Observable<Event>;\n\n /** Flags to enable/disable scroll shadowX. */\n @Prop()\n shadowX = true;\n\n /** Flags to enable/disable scroll shadowY. */\n @Prop()\n shadowY = true;\n\n /** Flags to enable/disable overflowX. */\n @Prop()\n overflowX = true;\n\n /** Flags to enable/disable overflowY. */\n @Prop()\n overflowY = true;\n\n /** Flag to enable/disable overscroll behavior. */\n @Prop()\n overscroll = true;\n\n /**\n * Flag to fire an initial event after content initialization.\n */\n @Prop() scrolledInit = true;\n\n /**\n * Buffer to be used to calculate the scroll distance.\n */\n @Prop() scrolledBuffer = 0;\n\n /**\n * Emitted when the content is fully scrolled to the top.\n */\n @Event() scrolledTop!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the left.\n */\n @Event() scrolledLeft!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the right.\n */\n @Event() scrolledRight!: EventEmitter<void>;\n\n /**\n * Emitted when the content is fully scrolled to the bottom.\n */\n @Event() scrolledBottom!: EventEmitter<void>;\n\n componentDidRender() {\n if (this.scrollElement) {\n this.scrolled = fromEvent(this.scrollElement, 'scroll').pipe(takeUntil(this.destroyed));\n }\n this.attachEmitter('left', this.scrolledLeft, this.scrolledBuffer);\n this.attachEmitter('right', this.scrolledRight, this.scrolledBuffer);\n this.attachEmitter('bottom', this.scrolledBottom, this.scrolledBuffer);\n this.attachEmitter('top', this.scrolledTop, this.scrolledBuffer);\n merge(this.init, this.scrolled)\n .pipe(\n map(() => ({\n top: this.getScrollOffset('top') > 0,\n left: this.getScrollOffset('left') > 0,\n right: this.getScrollOffset('right') > 0,\n bottom: this.getScrollOffset('bottom') > 0\n })),\n distinctUntilChanged(),\n takeUntil(this.destroyed)\n )\n .subscribe(({ top, left, right, bottom }) => {\n this.toggleClass('cat-scrollable-top', top);\n this.toggleClass('cat-scrollable-left', left);\n this.toggleClass('cat-scrollable-right', right);\n this.toggleClass('cat-scrollable-bottom', bottom);\n });\n }\n\n componentDidLoad() {\n if (this.scrolledInit) {\n this.init.next();\n }\n }\n\n disconnectedCallback() {\n this.init.complete();\n this.destroyed.next();\n this.destroyed.complete();\n }\n\n render() {\n return [\n <div class=\"scrollable-wrapper\" ref={el => (this.scrollWrapperElement = el)}>\n {this.shadowY && <div class=\"shadow-top\"></div>}\n {this.shadowX && <div class=\"shadow-left\"></div>}\n {this.shadowX && <div class=\"shadow-right\"></div>}\n {this.shadowY && <div class=\"shadow-bottom\"></div>}\n </div>,\n <div\n ref={el => (this.scrollElement = el)}\n class={{\n 'scrollable-content': true,\n 'scroll-x': this.overflowX,\n 'scroll-y': this.overflowY,\n 'no-overscroll': !this.overscroll\n }}\n >\n <slot></slot>\n </div>\n ];\n }\n\n private attachEmitter(from: 'top' | 'left' | 'right' | 'bottom', emitter: EventEmitter<void>, buffer: number) {\n merge(this.init, this.scrolled)\n .pipe(map(() => this.getScrollOffset(from)))\n .pipe(map(offset => offset <= buffer))\n .pipe(distinctUntilChanged())\n .pipe(filter(isLower => isLower))\n .pipe(takeUntil(this.destroyed))\n .subscribe(() => emitter.emit());\n }\n\n private getScrollOffset(from: 'top' | 'left' | 'right' | 'bottom') {\n if (this.scrollElement) {\n switch (from) {\n case 'top':\n return this.scrollElement.scrollTop;\n case 'left':\n return this.scrollElement.scrollLeft;\n case 'right':\n return this.scrollElement.scrollWidth - this.scrollElement.clientWidth - this.scrollElement.scrollLeft;\n case 'bottom':\n return this.scrollElement.scrollHeight - this.scrollElement.clientHeight - this.scrollElement.scrollTop;\n default:\n return 0;\n }\n }\n return 0;\n }\n\n private toggleClass(name: string, value: boolean) {\n if (value) {\n this.scrollWrapperElement?.classList.add(name);\n } else {\n this.scrollWrapperElement?.classList.remove(name);\n }\n }\n}\n"]}
|
|
@@ -34,127 +34,127 @@
|
|
|
34
34
|
margin-bottom: 1rem;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
.
|
|
37
|
+
.skeleton {
|
|
38
38
|
display: block;
|
|
39
39
|
border-radius: 0.25rem;
|
|
40
40
|
background: var(--background);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
.
|
|
43
|
+
.skeleton-circle {
|
|
44
44
|
border-radius: 10rem;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.
|
|
47
|
+
.skeleton-xs.skeleton-rectangle {
|
|
48
48
|
width: var(--width, 100%);
|
|
49
49
|
height: var(--height, 1.5rem);
|
|
50
50
|
}
|
|
51
|
-
.
|
|
51
|
+
.skeleton-xs.skeleton-square, .skeleton-xs.skeleton-circle {
|
|
52
52
|
width: var(--width, 1.5rem);
|
|
53
53
|
height: var(--height, 1.5rem);
|
|
54
54
|
}
|
|
55
|
-
.
|
|
55
|
+
.skeleton-xs.skeleton-head, .skeleton-xs.skeleton-body {
|
|
56
56
|
width: var(--width, var(--line-width, 100%));
|
|
57
57
|
}
|
|
58
|
-
.
|
|
58
|
+
.skeleton-xs.skeleton-head {
|
|
59
59
|
height: calc(0.9375rem - 4px);
|
|
60
60
|
margin: calc((1.25rem - 0.9375rem + 4px) * 0.5) 0;
|
|
61
61
|
}
|
|
62
|
-
.
|
|
62
|
+
.skeleton-xs.skeleton-body {
|
|
63
63
|
height: calc(0.75rem - 4px);
|
|
64
64
|
margin: calc((1rem - 0.75rem + 4px) * 0.5) 0;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.
|
|
67
|
+
.skeleton-s.skeleton-rectangle {
|
|
68
68
|
width: var(--width, 100%);
|
|
69
69
|
height: var(--height, 2rem);
|
|
70
70
|
}
|
|
71
|
-
.
|
|
71
|
+
.skeleton-s.skeleton-square, .skeleton-s.skeleton-circle {
|
|
72
72
|
width: var(--width, 2rem);
|
|
73
73
|
height: var(--height, 2rem);
|
|
74
74
|
}
|
|
75
|
-
.
|
|
75
|
+
.skeleton-s.skeleton-head, .skeleton-s.skeleton-body {
|
|
76
76
|
width: var(--width, var(--line-width, 100%));
|
|
77
77
|
}
|
|
78
|
-
.
|
|
78
|
+
.skeleton-s.skeleton-head {
|
|
79
79
|
height: calc(1.125rem - 4px);
|
|
80
80
|
margin: calc((1.5rem - 1.125rem + 4px) * 0.5) 0;
|
|
81
81
|
}
|
|
82
|
-
.
|
|
82
|
+
.skeleton-s.skeleton-body {
|
|
83
83
|
height: calc(0.875rem - 4px);
|
|
84
84
|
margin: calc((1rem - 0.875rem + 4px) * 0.5) 0;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
.
|
|
87
|
+
.skeleton-m.skeleton-rectangle {
|
|
88
88
|
width: var(--width, 100%);
|
|
89
89
|
height: var(--height, 2.5rem);
|
|
90
90
|
}
|
|
91
|
-
.
|
|
91
|
+
.skeleton-m.skeleton-square, .skeleton-m.skeleton-circle {
|
|
92
92
|
width: var(--width, 2.5rem);
|
|
93
93
|
height: var(--height, 2.5rem);
|
|
94
94
|
}
|
|
95
|
-
.
|
|
95
|
+
.skeleton-m.skeleton-head, .skeleton-m.skeleton-body {
|
|
96
96
|
width: var(--width, var(--line-width, 100%));
|
|
97
97
|
}
|
|
98
|
-
.
|
|
98
|
+
.skeleton-m.skeleton-head {
|
|
99
99
|
height: calc(1.25rem - 4px);
|
|
100
100
|
margin: calc((1.5rem - 1.25rem + 4px) * 0.5) 0;
|
|
101
101
|
}
|
|
102
|
-
.
|
|
102
|
+
.skeleton-m.skeleton-body {
|
|
103
103
|
height: calc(0.9375rem - 4px);
|
|
104
104
|
margin: calc((1.25rem - 0.9375rem + 4px) * 0.5) 0;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
.
|
|
107
|
+
.skeleton-l.skeleton-rectangle {
|
|
108
108
|
width: var(--width, 100%);
|
|
109
109
|
height: var(--height, 3rem);
|
|
110
110
|
}
|
|
111
|
-
.
|
|
111
|
+
.skeleton-l.skeleton-square, .skeleton-l.skeleton-circle {
|
|
112
112
|
width: var(--width, 3rem);
|
|
113
113
|
height: var(--height, 3rem);
|
|
114
114
|
}
|
|
115
|
-
.
|
|
115
|
+
.skeleton-l.skeleton-head, .skeleton-l.skeleton-body {
|
|
116
116
|
width: var(--width, var(--line-width, 100%));
|
|
117
117
|
}
|
|
118
|
-
.
|
|
118
|
+
.skeleton-l.skeleton-head {
|
|
119
119
|
height: calc(1.5rem - 4px);
|
|
120
120
|
margin: calc((1.75rem - 1.5rem + 4px) * 0.5) 0;
|
|
121
121
|
}
|
|
122
|
-
.
|
|
122
|
+
.skeleton-l.skeleton-body {
|
|
123
123
|
height: calc(1.125rem - 4px);
|
|
124
124
|
margin: calc((1.5rem - 1.125rem + 4px) * 0.5) 0;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
.
|
|
127
|
+
.skeleton-xl.skeleton-rectangle {
|
|
128
128
|
width: var(--width, 100%);
|
|
129
129
|
height: var(--height, 3.5rem);
|
|
130
130
|
}
|
|
131
|
-
.
|
|
131
|
+
.skeleton-xl.skeleton-square, .skeleton-xl.skeleton-circle {
|
|
132
132
|
width: var(--width, 3.5rem);
|
|
133
133
|
height: var(--height, 3.5rem);
|
|
134
134
|
}
|
|
135
|
-
.
|
|
135
|
+
.skeleton-xl.skeleton-head, .skeleton-xl.skeleton-body {
|
|
136
136
|
width: var(--width, var(--line-width, 100%));
|
|
137
137
|
}
|
|
138
|
-
.
|
|
138
|
+
.skeleton-xl.skeleton-head {
|
|
139
139
|
height: calc(1.75rem - 4px);
|
|
140
140
|
margin: calc((2rem - 1.75rem + 4px) * 0.5) 0;
|
|
141
141
|
}
|
|
142
|
-
.
|
|
142
|
+
.skeleton-xl.skeleton-body {
|
|
143
143
|
height: calc(1.25rem - 4px);
|
|
144
144
|
margin: calc((1.5rem - 1.25rem + 4px) * 0.5) 0;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
.
|
|
147
|
+
.skeleton-sheen {
|
|
148
148
|
background: linear-gradient(90deg, var(--background) 33%, var(--highlight) 50%, var(--background) 66%) var(--background);
|
|
149
149
|
background-size: 300% 100%;
|
|
150
150
|
animation: sheen var(--speed) ease-in-out infinite;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
.
|
|
153
|
+
.skeleton-pulse {
|
|
154
154
|
position: relative;
|
|
155
155
|
overflow: hidden;
|
|
156
156
|
}
|
|
157
|
-
.
|
|
157
|
+
.skeleton-pulse::before {
|
|
158
158
|
content: "";
|
|
159
159
|
display: block;
|
|
160
160
|
position: absolute;
|
|
@@ -20,10 +20,10 @@ export class CatSkeleton {
|
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
return (h(Host, null, Array.from(Array(this.count)).map(() => (h("div", { style: this.style, class: {
|
|
23
|
-
|
|
24
|
-
[`
|
|
25
|
-
[`
|
|
26
|
-
[`
|
|
23
|
+
skeleton: true,
|
|
24
|
+
[`skeleton-${this.effect}`]: Boolean(this.effect),
|
|
25
|
+
[`skeleton-${this.variant}`]: Boolean(this.variant),
|
|
26
|
+
[`skeleton-${this.size}`]: Boolean(this.size)
|
|
27
27
|
} })))));
|
|
28
28
|
}
|
|
29
29
|
get count() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-skeleton.js","sourceRoot":"","sources":["../../../src/components/cat-skeleton/cat-skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD;;GAEG;AAMH,MAAM,OAAO,WAAW;EALxB;IAME;;OAEG;IACK,WAAM,GAAgC,OAAO,CAAC;IAEtD;;OAE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KAAK;IACf,QAAQ,IAAI,CAAC,OAAO,EAAE;MACpB,KAAK,MAAM;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;MACtC,KAAK,MAAM;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;MACtC;QACE,OAAO,CAAC,CAAC;KACZ;EACH,CAAC;EAED,IAAY,KAAK;IACf,OAAO,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM;MACvD,CAAC,CAAC;QACE,cAAc,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG;OAC3C;MACH,CAAC,CAAC,SAAS,CAAC;EAChB,CAAC;EAEO,MAAM,CAAC,GAAW,EAAE,GAAW;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;EAC3D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop } from '@stencil/core';\n\n/**\n * Skeletons are used to show where content will eventually be drawn.\n */\n@Component({\n tag: 'cat-skeleton',\n styleUrl: 'cat-skeleton.scss',\n shadow: true\n})\nexport class CatSkeleton {\n /**\n * The animation style of the skeleton.\n */\n @Prop() effect: 'plain' | 'sheen' | 'pulse' = 'sheen';\n\n /**\n * The rendering style of the skeleton.\n */\n @Prop() variant: 'rectangle' | 'square' | 'circle' | 'head' | 'body' = 'rectangle';\n\n /**\n * The size of the skeleton. If the variant is set to \"head\", the size values\n * \"xs\" to \"xl\" translate to the head levels `h1` to `h5`.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The number of text lines to be rendered for \"head\" and \"body\" variants.\n * Defaults to 1 for \"head\" and 3 for \"body\". Will be ignored for other\n * variants.\n */\n @Prop() lines?: number;\n\n render() {\n return (\n <Host>\n {Array.from(Array(this.count)).map(() => (\n <div\n style={this.style}\n class={{\n skeleton: true,\n [`skeleton-${this.effect}`]: Boolean(this.effect),\n [`skeleton-${this.variant}`]: Boolean(this.variant),\n [`skeleton-${this.size}`]: Boolean(this.size)\n }}\n ></div>\n ))}\n </Host>\n );\n }\n\n private get count() {\n switch (this.variant) {\n case 'head':\n return Math.max(1, this.lines || 1);\n case 'body':\n return Math.max(1, this.lines || 3);\n default:\n return 1;\n }\n }\n\n private get style() {\n return this.variant === 'head' || this.variant === 'body'\n ? {\n '--line-width': `${this.random(50, 100)}%`\n }\n : undefined;\n }\n\n private random(min: number, max: number) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n }\n}\n"]}
|