@swisspost/design-system-components 1.3.10 → 1.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/cjs/check-non-empty-35b4d0b5.js +14 -0
- package/dist/cjs/check-non-empty-35b4d0b5.js.map +1 -0
- package/dist/cjs/check-one-of-4c2e8b2e.js +10 -0
- package/dist/cjs/check-one-of-4c2e8b2e.js.map +1 -0
- package/dist/cjs/{package-f6bb523d.js → check-type-508a21a5.js} +1 -10
- package/dist/cjs/check-type-508a21a5.js.map +1 -0
- package/dist/cjs/fade-8c6d4fa7.js +12 -0
- package/dist/cjs/fade-8c6d4fa7.js.map +1 -0
- package/dist/cjs/{index-272283b3.js → index-12cc37c9.js} +121 -5
- package/dist/{post-components/p-0096c140.js.map → cjs/index-12cc37c9.js.map} +1 -1
- package/dist/cjs/index-f8f6f146.js +28 -0
- package/dist/cjs/index-f8f6f146.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/package-67091813.js +7 -0
- package/dist/cjs/package-67091813.js.map +1 -0
- package/dist/cjs/post-alert.cjs.entry.js +106 -0
- package/dist/cjs/post-alert.cjs.entry.js.map +1 -0
- package/dist/cjs/post-collapsible.cjs.entry.js +6 -4
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-icon.cjs.entry.js +14 -29
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-header.cjs.entry.js +35 -0
- package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js +29 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tabs.cjs.entry.js +136 -0
- package/dist/cjs/post-tabs.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tooltip.cjs.entry.js +5097 -0
- package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -0
- package/dist/collection/animations/fade.js +6 -0
- package/dist/collection/animations/fade.js.map +1 -0
- package/dist/collection/animations/index.js +2 -0
- package/dist/collection/animations/index.js.map +1 -0
- package/dist/collection/collection-manifest.json +6 -1
- package/dist/collection/components/post-alert/alert-types.js +2 -0
- package/dist/collection/components/post-alert/alert-types.js.map +1 -0
- package/dist/collection/components/post-alert/post-alert.css +563 -0
- package/dist/collection/components/post-alert/post-alert.js +256 -0
- package/dist/collection/components/post-alert/post-alert.js.map +1 -0
- package/dist/collection/components/post-collapsible/post-collapsible.css +7 -0
- package/dist/collection/components/post-tab-header/post-tab-header.css +337 -0
- package/dist/collection/components/post-tab-header/post-tab-header.js +68 -0
- package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.css +3 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +55 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.js.map +1 -0
- package/dist/collection/components/post-tabs/post-tabs.css +148 -0
- package/dist/collection/components/post-tabs/post-tabs.js +208 -0
- package/dist/collection/components/post-tabs/post-tabs.js.map +1 -0
- package/dist/collection/components/post-tooltip/post-tooltip.css +194 -0
- package/dist/collection/components/post-tooltip/post-tooltip.js +338 -0
- package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -0
- package/dist/collection/components/post-tooltip/types.js +2 -0
- package/dist/collection/components/post-tooltip/types.js.map +1 -0
- package/dist/collection/utils/property-checkers/check-one-of.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-pattern.js +5 -0
- package/dist/collection/utils/property-checkers/check-pattern.js.map +1 -0
- package/dist/collection/utils/property-checkers/index.js +3 -0
- package/dist/collection/utils/property-checkers/index.js.map +1 -1
- package/dist/components/check-non-empty.js +11 -0
- package/dist/components/check-non-empty.js.map +1 -0
- package/dist/components/check-one-of.js +8 -0
- package/dist/components/check-one-of.js.map +1 -0
- package/dist/{esm/package-bcf00737.js → components/check-type.js} +2 -9
- package/dist/components/check-type.js.map +1 -0
- package/dist/components/fade.js +9 -0
- package/dist/components/fade.js.map +1 -0
- package/dist/components/package.js +2 -20
- package/dist/components/package.js.map +1 -1
- package/dist/components/post-alert.d.ts +11 -0
- package/dist/components/post-alert.js +136 -0
- package/dist/components/post-alert.js.map +1 -0
- package/dist/components/post-collapsible.js +3 -1
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-icon.js +1 -141
- package/dist/components/post-icon.js.map +1 -1
- package/dist/components/post-icon2.js +146 -0
- package/dist/components/post-icon2.js.map +1 -0
- package/dist/components/post-tab-header.d.ts +11 -0
- package/dist/components/post-tab-header.js +52 -0
- package/dist/components/post-tab-header.js.map +1 -0
- package/dist/components/post-tab-panel.d.ts +11 -0
- package/dist/components/post-tab-panel.js +46 -0
- package/dist/components/post-tab-panel.js.map +1 -0
- package/dist/components/post-tabs.d.ts +11 -0
- package/dist/components/post-tabs.js +153 -0
- package/dist/components/post-tabs.js.map +1 -0
- package/dist/components/post-tooltip.d.ts +11 -0
- package/dist/components/post-tooltip.js +5118 -0
- package/dist/components/post-tooltip.js.map +1 -0
- package/dist/docs.json +441 -1
- package/dist/esm/check-non-empty-554bdf88.js +11 -0
- package/dist/esm/check-non-empty-554bdf88.js.map +1 -0
- package/dist/esm/check-one-of-ded5e15e.js +8 -0
- package/dist/esm/check-one-of-ded5e15e.js.map +1 -0
- package/dist/esm/check-type-18ebb4e7.js +16 -0
- package/dist/esm/check-type-18ebb4e7.js.map +1 -0
- package/dist/esm/fade-671f1489.js +9 -0
- package/dist/esm/fade-671f1489.js.map +1 -0
- package/dist/esm/{index-60a84798.js → index-5611074b.js} +121 -6
- package/dist/esm/index-5611074b.js.map +1 -0
- package/dist/esm/index-7f723686.js +24 -0
- package/dist/esm/index-7f723686.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-f5cb3167.js +5 -0
- package/dist/esm/package-f5cb3167.js.map +1 -0
- package/dist/esm/post-alert.entry.js +102 -0
- package/dist/esm/post-alert.entry.js.map +1 -0
- package/dist/esm/post-collapsible.entry.js +4 -2
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-icon.entry.js +6 -21
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/esm/post-tab-header.entry.js +31 -0
- package/dist/esm/post-tab-header.entry.js.map +1 -0
- package/dist/esm/post-tab-panel.entry.js +25 -0
- package/dist/esm/post-tab-panel.entry.js.map +1 -0
- package/dist/esm/post-tabs.entry.js +132 -0
- package/dist/esm/post-tabs.entry.js.map +1 -0
- package/dist/esm/post-tooltip.entry.js +5093 -0
- package/dist/esm/post-tooltip.entry.js.map +1 -0
- package/dist/post-components/p-12046db8.entry.js +2 -0
- package/dist/post-components/{p-99ccf0cf.entry.js.map → p-12046db8.entry.js.map} +1 -1
- package/dist/post-components/p-15fc087f.js +2 -0
- package/dist/post-components/p-15fc087f.js.map +1 -0
- package/dist/post-components/p-24b07f64.js +2 -0
- package/dist/post-components/p-24b07f64.js.map +1 -0
- package/dist/post-components/p-29535fea.entry.js +2 -0
- package/dist/post-components/p-29535fea.entry.js.map +1 -0
- package/dist/post-components/p-296af738.entry.js +2 -0
- package/dist/post-components/p-296af738.entry.js.map +1 -0
- package/dist/post-components/p-2b6ab354.entry.js +9 -0
- package/dist/post-components/p-2b6ab354.entry.js.map +1 -0
- package/dist/post-components/p-75a7b352.js +2 -0
- package/dist/post-components/p-75a7b352.js.map +1 -0
- package/dist/post-components/p-a14ec7bb.entry.js +2 -0
- package/dist/post-components/p-a14ec7bb.entry.js.map +1 -0
- package/dist/post-components/p-bcc705f1.js +2 -0
- package/dist/post-components/p-bcc705f1.js.map +1 -0
- package/dist/post-components/p-c7497ecb.entry.js +2 -0
- package/dist/post-components/p-c7497ecb.entry.js.map +1 -0
- package/dist/post-components/p-c8efe0ae.js +2 -0
- package/dist/post-components/p-c8efe0ae.js.map +1 -0
- package/dist/post-components/p-cc6e4eb8.entry.js +2 -0
- package/dist/post-components/p-cc6e4eb8.entry.js.map +1 -0
- package/dist/post-components/p-d94db268.js +3 -0
- package/dist/post-components/p-d94db268.js.map +1 -0
- package/dist/post-components/p-e5306504.js +2 -0
- package/dist/post-components/p-e5306504.js.map +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/animations/fade.d.ts +2 -0
- package/dist/types/animations/index.d.ts +1 -0
- package/dist/types/components/post-alert/alert-types.d.ts +2 -0
- package/dist/types/components/post-alert/post-alert.d.ts +49 -0
- package/dist/types/components/post-tab-header/post-tab-header.d.ts +11 -0
- package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +10 -0
- package/dist/types/components/post-tabs/post-tabs.d.ts +34 -0
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +66 -0
- package/dist/types/components/post-tooltip/types.d.ts +2 -0
- package/dist/types/components.d.ts +190 -0
- package/dist/types/utils/property-checkers/check-one-of.d.ts +1 -1
- package/dist/types/utils/property-checkers/check-pattern.d.ts +1 -0
- package/dist/types/utils/property-checkers/index.d.ts +3 -1
- package/package.json +13 -9
- package/dist/cjs/index-272283b3.js.map +0 -1
- package/dist/cjs/package-f6bb523d.js.map +0 -1
- package/dist/esm/index-60a84798.js.map +0 -1
- package/dist/esm/package-bcf00737.js.map +0 -1
- package/dist/post-components/p-0096c140.js +0 -3
- package/dist/post-components/p-4a3ff4c0.js +0 -2
- package/dist/post-components/p-4a3ff4c0.js.map +0 -1
- package/dist/post-components/p-99ccf0cf.entry.js +0 -2
- package/dist/post-components/p-cafa0281.entry.js +0 -2
- package/dist/post-components/p-cafa0281.entry.js.map +0 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { version } from '../../../package.json';
|
|
3
|
+
import { fadeOut } from '../../animations';
|
|
4
|
+
import { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from '../../utils';
|
|
5
|
+
import { ALERT_TYPES } from './alert-types';
|
|
6
|
+
export class PostAlert {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.alertId = crypto.randomUUID();
|
|
9
|
+
this.classes = undefined;
|
|
10
|
+
this.hasActions = undefined;
|
|
11
|
+
this.hasHeading = undefined;
|
|
12
|
+
this.onDismissButtonClick = () => this.dismiss();
|
|
13
|
+
this.dismissible = false;
|
|
14
|
+
this.dismissLabel = undefined;
|
|
15
|
+
this.fixed = false;
|
|
16
|
+
this.icon = undefined;
|
|
17
|
+
this.type = 'primary';
|
|
18
|
+
}
|
|
19
|
+
validateDismissible(isDismissible = this.dismissible) {
|
|
20
|
+
checkType(isDismissible, 'boolean', 'The post-alert "dismissible" prop should be a boolean.');
|
|
21
|
+
setTimeout(() => this.validateDismissLabel());
|
|
22
|
+
}
|
|
23
|
+
validateDismissLabel(dismissLabel = this.dismissLabel) {
|
|
24
|
+
if (this.dismissible) {
|
|
25
|
+
checkNonEmpty(dismissLabel, 'Dismissible post-alert\'s require a "dismiss-label" prop.');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
validateFixed(isFixed = this.fixed) {
|
|
29
|
+
checkType(isFixed, 'boolean', 'The post-alert "fixed" prop should be a boolean.');
|
|
30
|
+
}
|
|
31
|
+
validateIcon(icon = this.icon) {
|
|
32
|
+
checkEmptyOrPattern(icon, /\d{4}|none/, 'The post-alert "icon" prop should be a 4-digits string.');
|
|
33
|
+
}
|
|
34
|
+
validateType(type = this.type) {
|
|
35
|
+
checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
this.validateDismissible();
|
|
39
|
+
this.validateFixed();
|
|
40
|
+
this.validateIcon();
|
|
41
|
+
this.validateType();
|
|
42
|
+
}
|
|
43
|
+
componentWillRender() {
|
|
44
|
+
var _a;
|
|
45
|
+
this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;
|
|
46
|
+
this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;
|
|
47
|
+
this.classes = `alert alert-${(_a = this.type) !== null && _a !== void 0 ? _a : 'primary'}`;
|
|
48
|
+
if (this.dismissible)
|
|
49
|
+
this.classes += ' alert-dismissible';
|
|
50
|
+
if (this.hasActions)
|
|
51
|
+
this.classes += ' alert-action';
|
|
52
|
+
if (this.fixed)
|
|
53
|
+
this.classes += ' alert-fixed-bottom';
|
|
54
|
+
if (this.icon === 'none')
|
|
55
|
+
this.classes += ' no-icon';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Triggers alert dismissal programmatically (same as clicking on the close button (×)).
|
|
59
|
+
*/
|
|
60
|
+
async dismiss() {
|
|
61
|
+
const dismissal = fadeOut(this.host);
|
|
62
|
+
await dismissal.finished;
|
|
63
|
+
this.host.remove();
|
|
64
|
+
this.dismissed.emit();
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
const defaultAlertContent = [
|
|
68
|
+
this.icon && this.icon !== 'none' && (h("post-icon", { key: `${this.alertId}-icon`, name: this.icon })),
|
|
69
|
+
this.hasHeading && (h("div", { key: `${this.alertId}-heading`, class: "alert-heading" }, h("slot", { name: "heading" }))),
|
|
70
|
+
h("slot", { key: `${this.alertId}-message` })
|
|
71
|
+
];
|
|
72
|
+
const actionAlertContent = [
|
|
73
|
+
h("div", { key: `${this.alertId}-content`, class: "alert-content" }, defaultAlertContent),
|
|
74
|
+
h("div", { key: `${this.alertId}-buttons`, class: "alert-buttons" }, h("slot", { name: "actions" })),
|
|
75
|
+
];
|
|
76
|
+
return (h(Host, { "data-version": version }, h("div", { role: "alert", class: this.classes }, this.dismissible && (h("button", { class: "btn-close", onClick: this.onDismissButtonClick }, h("span", { class: "visually-hidden" }, this.dismissLabel))), this.hasActions
|
|
77
|
+
? actionAlertContent
|
|
78
|
+
: defaultAlertContent)));
|
|
79
|
+
}
|
|
80
|
+
static get is() { return "post-alert"; }
|
|
81
|
+
static get encapsulation() { return "shadow"; }
|
|
82
|
+
static get originalStyleUrls() {
|
|
83
|
+
return {
|
|
84
|
+
"$": ["post-alert.scss"]
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
static get styleUrls() {
|
|
88
|
+
return {
|
|
89
|
+
"$": ["post-alert.css"]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
static get properties() {
|
|
93
|
+
return {
|
|
94
|
+
"dismissible": {
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"mutable": false,
|
|
97
|
+
"complexType": {
|
|
98
|
+
"original": "boolean",
|
|
99
|
+
"resolved": "boolean",
|
|
100
|
+
"references": {}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": "If `true`, a close button (\u00D7) is displayed and the alert can be dismissed by the user."
|
|
107
|
+
},
|
|
108
|
+
"attribute": "dismissible",
|
|
109
|
+
"reflect": false,
|
|
110
|
+
"defaultValue": "false"
|
|
111
|
+
},
|
|
112
|
+
"dismissLabel": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"mutable": false,
|
|
115
|
+
"complexType": {
|
|
116
|
+
"original": "string",
|
|
117
|
+
"resolved": "string",
|
|
118
|
+
"references": {}
|
|
119
|
+
},
|
|
120
|
+
"required": false,
|
|
121
|
+
"optional": false,
|
|
122
|
+
"docs": {
|
|
123
|
+
"tags": [],
|
|
124
|
+
"text": "The label to use for the close button of a dismissible alert."
|
|
125
|
+
},
|
|
126
|
+
"attribute": "dismiss-label",
|
|
127
|
+
"reflect": false
|
|
128
|
+
},
|
|
129
|
+
"fixed": {
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "boolean",
|
|
134
|
+
"resolved": "boolean",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": "If `true`, the alert is positioned at the bottom of the window, from edge to edge."
|
|
142
|
+
},
|
|
143
|
+
"attribute": "fixed",
|
|
144
|
+
"reflect": false,
|
|
145
|
+
"defaultValue": "false"
|
|
146
|
+
},
|
|
147
|
+
"icon": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "string",
|
|
152
|
+
"resolved": "string",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": "The icon to display in the alert. By default, the icon depends on the alert type.\n\nIf `none`, no icon is displayed."
|
|
160
|
+
},
|
|
161
|
+
"attribute": "icon",
|
|
162
|
+
"reflect": false
|
|
163
|
+
},
|
|
164
|
+
"type": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"mutable": false,
|
|
167
|
+
"complexType": {
|
|
168
|
+
"original": "AlertType",
|
|
169
|
+
"resolved": "\"danger\" | \"gray\" | \"info\" | \"primary\" | \"success\" | \"warning\"",
|
|
170
|
+
"references": {
|
|
171
|
+
"AlertType": {
|
|
172
|
+
"location": "import",
|
|
173
|
+
"path": "./alert-types"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "The type of the alert."
|
|
182
|
+
},
|
|
183
|
+
"attribute": "type",
|
|
184
|
+
"reflect": false,
|
|
185
|
+
"defaultValue": "'primary'"
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
static get states() {
|
|
190
|
+
return {
|
|
191
|
+
"alertId": {},
|
|
192
|
+
"classes": {},
|
|
193
|
+
"hasActions": {},
|
|
194
|
+
"hasHeading": {},
|
|
195
|
+
"onDismissButtonClick": {}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
static get events() {
|
|
199
|
+
return [{
|
|
200
|
+
"method": "dismissed",
|
|
201
|
+
"name": "dismissed",
|
|
202
|
+
"bubbles": true,
|
|
203
|
+
"cancelable": true,
|
|
204
|
+
"composed": true,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": "An event emitted when the alert element is dismissed, after the transition.\nIt has no payload and only relevant for dismissible alerts."
|
|
208
|
+
},
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "void",
|
|
211
|
+
"resolved": "void",
|
|
212
|
+
"references": {}
|
|
213
|
+
}
|
|
214
|
+
}];
|
|
215
|
+
}
|
|
216
|
+
static get methods() {
|
|
217
|
+
return {
|
|
218
|
+
"dismiss": {
|
|
219
|
+
"complexType": {
|
|
220
|
+
"signature": "() => Promise<void>",
|
|
221
|
+
"parameters": [],
|
|
222
|
+
"references": {
|
|
223
|
+
"Promise": {
|
|
224
|
+
"location": "global"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"return": "Promise<void>"
|
|
228
|
+
},
|
|
229
|
+
"docs": {
|
|
230
|
+
"text": "Triggers alert dismissal programmatically (same as clicking on the close button (\u00D7)).",
|
|
231
|
+
"tags": []
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
static get elementRef() { return "host"; }
|
|
237
|
+
static get watchers() {
|
|
238
|
+
return [{
|
|
239
|
+
"propName": "dismissible",
|
|
240
|
+
"methodName": "validateDismissible"
|
|
241
|
+
}, {
|
|
242
|
+
"propName": "dismissLabel",
|
|
243
|
+
"methodName": "validateDismissLabel"
|
|
244
|
+
}, {
|
|
245
|
+
"propName": "fixed",
|
|
246
|
+
"methodName": "validateFixed"
|
|
247
|
+
}, {
|
|
248
|
+
"propName": "icon",
|
|
249
|
+
"methodName": "validateIcon"
|
|
250
|
+
}, {
|
|
251
|
+
"propName": "type",
|
|
252
|
+
"methodName": "validateType"
|
|
253
|
+
}];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=post-alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-alert.js","sourceRoot":"","sources":["../../../../src/components/post-alert/post-alert.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeOut } from '../../animations';\nimport { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from '../../utils';\nimport { ALERT_TYPES, AlertType } from './alert-types';\n\n@Component({\n tag: 'post-alert',\n styleUrl: 'post-alert.scss',\n shadow: true,\n})\nexport class PostAlert {\n @Element() host: HTMLPostAlertElement;\n\n @State() alertId = crypto.randomUUID();\n @State() classes: string;\n @State() hasActions: boolean;\n @State() hasHeading: boolean;\n @State() onDismissButtonClick = () => this.dismiss();\n\n /**\n * If `true`, a close button (×) is displayed and the alert can be dismissed by the user.\n */\n @Prop() readonly dismissible: boolean = false;\n\n @Watch('dismissible')\n validateDismissible(isDismissible = this.dismissible) {\n checkType(isDismissible, 'boolean', 'The post-alert \"dismissible\" prop should be a boolean.');\n setTimeout(() => this.validateDismissLabel());\n }\n\n /**\n * The label to use for the close button of a dismissible alert.\n */\n @Prop() readonly dismissLabel: string;\n\n @Watch('dismissLabel')\n validateDismissLabel(dismissLabel = this.dismissLabel) {\n if (this.dismissible) {\n checkNonEmpty(dismissLabel, 'Dismissible post-alert\\'s require a \"dismiss-label\" prop.');\n }\n }\n\n /**\n * If `true`, the alert is positioned at the bottom of the window, from edge to edge.\n */\n @Prop() readonly fixed: boolean = false;\n\n @Watch('fixed')\n validateFixed(isFixed = this.fixed) {\n checkType(isFixed, 'boolean', 'The post-alert \"fixed\" prop should be a boolean.');\n }\n\n /**\n * The icon to display in the alert. By default, the icon depends on the alert type.\n *\n * If `none`, no icon is displayed.\n */\n @Prop() readonly icon: string;\n\n @Watch('icon')\n validateIcon(icon = this.icon) {\n checkEmptyOrPattern(icon, /\\d{4}|none/, 'The post-alert \"icon\" prop should be a 4-digits string.');\n }\n\n /**\n * The type of the alert.\n */\n @Prop() readonly type: AlertType = 'primary';\n\n @Watch('type')\n validateType(type = this.type) {\n checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);\n }\n\n /**\n * An event emitted when the alert element is dismissed, after the transition.\n * It has no payload and only relevant for dismissible alerts.\n */\n @Event() dismissed: EventEmitter<void>;\n\n connectedCallback() {\n this.validateDismissible();\n this.validateFixed();\n this.validateIcon();\n this.validateType();\n }\n\n componentWillRender() {\n this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;\n this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;\n\n this.classes = `alert alert-${this.type ?? 'primary'}`;\n if (this.dismissible) this.classes += ' alert-dismissible';\n if (this.hasActions) this.classes += ' alert-action';\n if (this.fixed) this.classes += ' alert-fixed-bottom';\n if (this.icon === 'none') this.classes += ' no-icon';\n }\n\n /**\n * Triggers alert dismissal programmatically (same as clicking on the close button (×)).\n */\n @Method()\n async dismiss() {\n const dismissal = fadeOut(this.host);\n\n await dismissal.finished;\n\n this.host.remove();\n this.dismissed.emit();\n }\n\n render() {\n const defaultAlertContent = [\n this.icon && this.icon !== 'none' && (\n <post-icon key={`${this.alertId}-icon`} name={this.icon} />\n ),\n this.hasHeading && (\n <div key={`${this.alertId}-heading`} class=\"alert-heading\">\n <slot name=\"heading\"/>\n </div>\n ),\n <slot key={`${this.alertId}-message`}/>\n ];\n\n const actionAlertContent = [\n <div key={`${this.alertId}-content`} class=\"alert-content\">\n {defaultAlertContent}\n </div>,\n <div key={`${this.alertId}-buttons`} class=\"alert-buttons\">\n <slot name=\"actions\"/>\n </div>,\n ];\n\n return (\n <Host data-version={version}>\n <div role=\"alert\" class={this.classes}>\n {this.dismissible && (\n <button class=\"btn-close\" onClick={this.onDismissButtonClick}>\n <span class=\"visually-hidden\">{this.dismissLabel}</span>\n </button>\n )}\n\n {this.hasActions\n ? actionAlertContent\n : defaultAlertContent\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}
|
|
@@ -21,6 +21,13 @@
|
|
|
21
21
|
* will be available as sass-variables
|
|
22
22
|
* but should not be used.
|
|
23
23
|
*/
|
|
24
|
+
/**
|
|
25
|
+
* Colors used by the post style guide
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Maps. Allow maps to have custom colors from the project
|
|
29
|
+
* by always merging into a default empty map
|
|
30
|
+
*/
|
|
24
31
|
.accordion-item {
|
|
25
32
|
border-block-start: 2px solid hsl(0, 0%, 90%);
|
|
26
33
|
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colors used by the post style guide
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Maps. Allow maps to have custom colors from the project
|
|
6
|
+
* by always merging into a default empty map
|
|
7
|
+
*/
|
|
8
|
+
.tab-title {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
position: relative;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
padding: 1rem;
|
|
13
|
+
transition: background-color 100ms;
|
|
14
|
+
border-right: 1px solid transparent;
|
|
15
|
+
border-left: 1px solid transparent;
|
|
16
|
+
outline-color: currentColor;
|
|
17
|
+
opacity: 0.7;
|
|
18
|
+
color: var(--post-contrast-color);
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
}
|
|
21
|
+
.tab-title:focus {
|
|
22
|
+
background-color: unset;
|
|
23
|
+
color: var(--post-contrast-color);
|
|
24
|
+
}
|
|
25
|
+
.tab-title:hover {
|
|
26
|
+
opacity: 1;
|
|
27
|
+
background-color: #fff;
|
|
28
|
+
color: var(--post-contrast-color);
|
|
29
|
+
}
|
|
30
|
+
.tab-title:focus-visible {
|
|
31
|
+
outline: transparent;
|
|
32
|
+
opacity: 1;
|
|
33
|
+
background-color: #fff;
|
|
34
|
+
color: var(--post-contrast-color);
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
}
|
|
37
|
+
.tab-title:focus-visible::after {
|
|
38
|
+
content: "";
|
|
39
|
+
display: block;
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 2px;
|
|
42
|
+
right: 1px;
|
|
43
|
+
bottom: 0;
|
|
44
|
+
left: 1px;
|
|
45
|
+
box-shadow: 0 0 0 1px #fff, 0 0 0 2px hsl(0, 0%, 20%);
|
|
46
|
+
}
|
|
47
|
+
.tab-title.active {
|
|
48
|
+
z-index: 1;
|
|
49
|
+
border-right-color: hsl(0, 0%, 80%);
|
|
50
|
+
border-left-color: hsl(0, 0%, 80%);
|
|
51
|
+
opacity: 1;
|
|
52
|
+
background-color: #fff;
|
|
53
|
+
color: var(--post-contrast-color);
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
}
|
|
56
|
+
.tab-title.active::before {
|
|
57
|
+
content: "";
|
|
58
|
+
display: block;
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 0;
|
|
61
|
+
right: -1px;
|
|
62
|
+
left: -1px;
|
|
63
|
+
height: 0.25rem;
|
|
64
|
+
background-color: #fc0;
|
|
65
|
+
}
|
|
66
|
+
:is(.bg-dark, .bg-primary, .bg-black, .bg-danger, .bg-nightblue, .bg-nightblue-bright, .bg-petrol, .bg-coral, .bg-olive, .bg-purple, .bg-purple-bright, .bg-aubergine, .bg-aubergine-bright) .tab-title:hover {
|
|
67
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
68
|
+
}
|
|
69
|
+
:is(.bg-dark, .bg-primary, .bg-black, .bg-danger, .bg-nightblue, .bg-nightblue-bright, .bg-petrol, .bg-coral, .bg-olive, .bg-purple, .bg-purple-bright, .bg-aubergine, .bg-aubergine-bright) .tab-title:focus-visible {
|
|
70
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
71
|
+
}
|
|
72
|
+
@media (forced-colors: active), (-ms-high-contrast: active), (-ms-high-contrast: white-on-black) {
|
|
73
|
+
.tab-title {
|
|
74
|
+
opacity: 1;
|
|
75
|
+
border-left-color: Canvas;
|
|
76
|
+
border-right-color: Canvas;
|
|
77
|
+
color: LinkText;
|
|
78
|
+
}
|
|
79
|
+
.tab-title:hover, .tab-title:focus, .tab-title:focus-within, .tab-title:focus-visible {
|
|
80
|
+
outline: 2px solid Highlight;
|
|
81
|
+
outline-offset: -0.25rem;
|
|
82
|
+
}
|
|
83
|
+
.tab-title.active {
|
|
84
|
+
border-left-color: ButtonText;
|
|
85
|
+
border-right-color: ButtonText;
|
|
86
|
+
color: Highlight;
|
|
87
|
+
}
|
|
88
|
+
.tab-title.active::before {
|
|
89
|
+
background-color: Highlight;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.bg-yellow .tab-title {
|
|
94
|
+
background-color: #fc0;
|
|
95
|
+
}
|
|
96
|
+
.bg-yellow .tab-title.active {
|
|
97
|
+
background-color: #fc0;
|
|
98
|
+
}
|
|
99
|
+
.bg-yellow .nav-item {
|
|
100
|
+
background-color: #fc0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.bg-light .tab-title {
|
|
104
|
+
background-color: #faf9f8;
|
|
105
|
+
}
|
|
106
|
+
.bg-light .tab-title.active {
|
|
107
|
+
background-color: #faf9f8;
|
|
108
|
+
}
|
|
109
|
+
.bg-light .nav-item {
|
|
110
|
+
background-color: #faf9f8;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.bg-gray .tab-title {
|
|
114
|
+
background-color: #f4f3f1;
|
|
115
|
+
}
|
|
116
|
+
.bg-gray .tab-title.active {
|
|
117
|
+
background-color: #f4f3f1;
|
|
118
|
+
}
|
|
119
|
+
.bg-gray .nav-item {
|
|
120
|
+
background-color: #f4f3f1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.bg-dark .tab-title {
|
|
124
|
+
background-color: hsl(0, 0%, 20%);
|
|
125
|
+
}
|
|
126
|
+
.bg-dark .tab-title.active {
|
|
127
|
+
background-color: hsl(0, 0%, 20%);
|
|
128
|
+
}
|
|
129
|
+
.bg-dark .nav-item {
|
|
130
|
+
background-color: hsl(0, 0%, 20%);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.bg-primary .tab-title {
|
|
134
|
+
background-color: hsl(0, 0%, 20%);
|
|
135
|
+
}
|
|
136
|
+
.bg-primary .tab-title.active {
|
|
137
|
+
background-color: hsl(0, 0%, 20%);
|
|
138
|
+
}
|
|
139
|
+
.bg-primary .nav-item {
|
|
140
|
+
background-color: hsl(0, 0%, 20%);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.bg-white .tab-title {
|
|
144
|
+
background-color: #fff;
|
|
145
|
+
}
|
|
146
|
+
.bg-white .tab-title.active {
|
|
147
|
+
background-color: #fff;
|
|
148
|
+
}
|
|
149
|
+
.bg-white .nav-item {
|
|
150
|
+
background-color: #fff;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.bg-black .tab-title {
|
|
154
|
+
background-color: #000;
|
|
155
|
+
}
|
|
156
|
+
.bg-black .tab-title.active {
|
|
157
|
+
background-color: #000;
|
|
158
|
+
}
|
|
159
|
+
.bg-black .nav-item {
|
|
160
|
+
background-color: #000;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.bg-success .tab-title {
|
|
164
|
+
background-color: #2c911c;
|
|
165
|
+
}
|
|
166
|
+
.bg-success .tab-title.active {
|
|
167
|
+
background-color: #2c911c;
|
|
168
|
+
}
|
|
169
|
+
.bg-success .nav-item {
|
|
170
|
+
background-color: #2c911c;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.bg-info .tab-title {
|
|
174
|
+
background-color: #cce4ee;
|
|
175
|
+
}
|
|
176
|
+
.bg-info .tab-title.active {
|
|
177
|
+
background-color: #cce4ee;
|
|
178
|
+
}
|
|
179
|
+
.bg-info .nav-item {
|
|
180
|
+
background-color: #cce4ee;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.bg-warning .tab-title {
|
|
184
|
+
background-color: #f49e00;
|
|
185
|
+
}
|
|
186
|
+
.bg-warning .tab-title.active {
|
|
187
|
+
background-color: #f49e00;
|
|
188
|
+
}
|
|
189
|
+
.bg-warning .nav-item {
|
|
190
|
+
background-color: #f49e00;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.bg-danger .tab-title {
|
|
194
|
+
background-color: #a51728;
|
|
195
|
+
}
|
|
196
|
+
.bg-danger .tab-title.active {
|
|
197
|
+
background-color: #a51728;
|
|
198
|
+
}
|
|
199
|
+
.bg-danger .nav-item {
|
|
200
|
+
background-color: #a51728;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.bg-nightblue .tab-title {
|
|
204
|
+
background-color: #004976;
|
|
205
|
+
}
|
|
206
|
+
.bg-nightblue .tab-title.active {
|
|
207
|
+
background-color: #004976;
|
|
208
|
+
}
|
|
209
|
+
.bg-nightblue .nav-item {
|
|
210
|
+
background-color: #004976;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.bg-nightblue-bright .tab-title {
|
|
214
|
+
background-color: #0076a8;
|
|
215
|
+
}
|
|
216
|
+
.bg-nightblue-bright .tab-title.active {
|
|
217
|
+
background-color: #0076a8;
|
|
218
|
+
}
|
|
219
|
+
.bg-nightblue-bright .nav-item {
|
|
220
|
+
background-color: #0076a8;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.bg-petrol .tab-title {
|
|
224
|
+
background-color: #006d68;
|
|
225
|
+
}
|
|
226
|
+
.bg-petrol .tab-title.active {
|
|
227
|
+
background-color: #006d68;
|
|
228
|
+
}
|
|
229
|
+
.bg-petrol .nav-item {
|
|
230
|
+
background-color: #006d68;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.bg-petrol-bright .tab-title {
|
|
234
|
+
background-color: #00968f;
|
|
235
|
+
}
|
|
236
|
+
.bg-petrol-bright .tab-title.active {
|
|
237
|
+
background-color: #00968f;
|
|
238
|
+
}
|
|
239
|
+
.bg-petrol-bright .nav-item {
|
|
240
|
+
background-color: #00968f;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.bg-coral .tab-title {
|
|
244
|
+
background-color: #9e2a2f;
|
|
245
|
+
}
|
|
246
|
+
.bg-coral .tab-title.active {
|
|
247
|
+
background-color: #9e2a2f;
|
|
248
|
+
}
|
|
249
|
+
.bg-coral .nav-item {
|
|
250
|
+
background-color: #9e2a2f;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.bg-coral-bright .tab-title {
|
|
254
|
+
background-color: #e03c31;
|
|
255
|
+
}
|
|
256
|
+
.bg-coral-bright .tab-title.active {
|
|
257
|
+
background-color: #e03c31;
|
|
258
|
+
}
|
|
259
|
+
.bg-coral-bright .nav-item {
|
|
260
|
+
background-color: #e03c31;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.bg-olive .tab-title {
|
|
264
|
+
background-color: #716135;
|
|
265
|
+
}
|
|
266
|
+
.bg-olive .tab-title.active {
|
|
267
|
+
background-color: #716135;
|
|
268
|
+
}
|
|
269
|
+
.bg-olive .nav-item {
|
|
270
|
+
background-color: #716135;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.bg-olive-bright .tab-title {
|
|
274
|
+
background-color: #aa9d2e;
|
|
275
|
+
}
|
|
276
|
+
.bg-olive-bright .tab-title.active {
|
|
277
|
+
background-color: #aa9d2e;
|
|
278
|
+
}
|
|
279
|
+
.bg-olive-bright .nav-item {
|
|
280
|
+
background-color: #aa9d2e;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.bg-purple .tab-title {
|
|
284
|
+
background-color: #80276c;
|
|
285
|
+
}
|
|
286
|
+
.bg-purple .tab-title.active {
|
|
287
|
+
background-color: #80276c;
|
|
288
|
+
}
|
|
289
|
+
.bg-purple .nav-item {
|
|
290
|
+
background-color: #80276c;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.bg-purple-bright .tab-title {
|
|
294
|
+
background-color: #c5299b;
|
|
295
|
+
}
|
|
296
|
+
.bg-purple-bright .tab-title.active {
|
|
297
|
+
background-color: #c5299b;
|
|
298
|
+
}
|
|
299
|
+
.bg-purple-bright .nav-item {
|
|
300
|
+
background-color: #c5299b;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.bg-aubergine .tab-title {
|
|
304
|
+
background-color: #523178;
|
|
305
|
+
}
|
|
306
|
+
.bg-aubergine .tab-title.active {
|
|
307
|
+
background-color: #523178;
|
|
308
|
+
}
|
|
309
|
+
.bg-aubergine .nav-item {
|
|
310
|
+
background-color: #523178;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.bg-aubergine-bright .tab-title {
|
|
314
|
+
background-color: #7566a0;
|
|
315
|
+
}
|
|
316
|
+
.bg-aubergine-bright .tab-title.active {
|
|
317
|
+
background-color: #7566a0;
|
|
318
|
+
}
|
|
319
|
+
.bg-aubergine-bright .nav-item {
|
|
320
|
+
background-color: #7566a0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
[class*=bg-] .tab-title.active:focus::after {
|
|
324
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
325
|
+
}
|
|
326
|
+
@supports selector(*:focus-visible) {
|
|
327
|
+
[class*=bg-] .tab-title.active:focus::after {
|
|
328
|
+
background-color: unset;
|
|
329
|
+
}
|
|
330
|
+
[class*=bg-] .tab-title.active:focus-visible::after {
|
|
331
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
:host {
|
|
336
|
+
display: block;
|
|
337
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { version } from '../../../package.json';
|
|
3
|
+
import { checkNonEmpty } from '../../utils';
|
|
4
|
+
export class PostTabHeader {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.tabId = undefined;
|
|
7
|
+
this.panel = undefined;
|
|
8
|
+
}
|
|
9
|
+
validateFor(newValue) {
|
|
10
|
+
checkNonEmpty(newValue, 'The "panel" prop is required for the post-tab-header.');
|
|
11
|
+
}
|
|
12
|
+
componentWillLoad() {
|
|
13
|
+
this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return (h(Host, { "data-version": version }, h("li", { class: "nav-item" }, h("a", { "aria-selected": "false", class: "tab-title nav-link", href: "#", id: this.tabId, role: "tab" }, h("slot", null)))));
|
|
17
|
+
}
|
|
18
|
+
static get is() { return "post-tab-header"; }
|
|
19
|
+
static get encapsulation() { return "shadow"; }
|
|
20
|
+
static get originalStyleUrls() {
|
|
21
|
+
return {
|
|
22
|
+
"$": ["post-tab-header.scss"]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
static get styleUrls() {
|
|
26
|
+
return {
|
|
27
|
+
"$": ["post-tab-header.css"]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static get properties() {
|
|
31
|
+
return {
|
|
32
|
+
"panel": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"mutable": false,
|
|
35
|
+
"complexType": {
|
|
36
|
+
"original": "HTMLPostTabPanelElement['name']",
|
|
37
|
+
"resolved": "string",
|
|
38
|
+
"references": {
|
|
39
|
+
"HTMLPostTabPanelElement": {
|
|
40
|
+
"location": "global"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": false,
|
|
45
|
+
"optional": false,
|
|
46
|
+
"docs": {
|
|
47
|
+
"tags": [],
|
|
48
|
+
"text": "The name of the panel controlled by the tab header."
|
|
49
|
+
},
|
|
50
|
+
"attribute": "panel",
|
|
51
|
+
"reflect": false
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
static get states() {
|
|
56
|
+
return {
|
|
57
|
+
"tabId": {}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static get elementRef() { return "host"; }
|
|
61
|
+
static get watchers() {
|
|
62
|
+
return [{
|
|
63
|
+
"propName": "panel",
|
|
64
|
+
"methodName": "validateFor"
|
|
65
|
+
}];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=post-tab-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-tab-header.js","sourceRoot":"","sources":["../../../../src/components/post-tab-header/post-tab-header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C,MAAM,OAAO,aAAa;;;;;EAWxB,WAAW,CAAC,QAAyC;IACnD,aAAa,CAAC,QAAQ,EAAE,uDAAuD,CAAC,CAAC;EACnF,CAAC;EAED,iBAAiB;IACf,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;EAC5D,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,oBAAe,OAAO;MACzB,UAAI,KAAK,EAAC,UAAU;QAClB,0BACgB,OAAO,EACrB,KAAK,EAAC,oBAAoB,EAC1B,IAAI,EAAC,GAAG,EACR,EAAE,EAAE,IAAI,CAAC,KAAK,EACd,IAAI,EAAC,KAAK;UAEV,eAAO,CACL,CACD,CACA,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { checkNonEmpty } from '../../utils';\n\n@Component({\n tag: 'post-tab-header',\n styleUrl: 'post-tab-header.scss',\n shadow: true,\n})\nexport class PostTabHeader {\n @Element() host: HTMLPostTabHeaderElement;\n\n @State() tabId: string;\n\n /**\n * The name of the panel controlled by the tab header.\n */\n @Prop() readonly panel: HTMLPostTabPanelElement['name'];\n\n @Watch('panel')\n validateFor(newValue: HTMLPostTabPanelElement['name']) {\n checkNonEmpty(newValue, 'The \"panel\" prop is required for the post-tab-header.');\n }\n\n componentWillLoad() {\n this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <li class=\"nav-item\">\n <a\n aria-selected=\"false\"\n class=\"tab-title nav-link\"\n href=\"#\"\n id={this.tabId}\n role=\"tab\"\n >\n <slot/>\n </a>\n </li>\n </Host>\n );\n }\n}\n"]}
|