@getflip/swirl-components 0.21.1 → 0.23.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/components.json +271 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-app-bar.cjs.entry.js +65 -0
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-description-list-item.cjs.entry.js +5 -2
- package/dist/cjs/swirl-description-list.cjs.entry.js +1 -1
- package/dist/cjs/swirl-heading.cjs.entry.js +5 -2
- package/dist/cjs/swirl-modal.cjs.entry.js +3 -2
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/swirl-app-bar/swirl-app-bar.css +101 -0
- package/dist/collection/components/swirl-app-bar/swirl-app-bar.js +279 -0
- package/dist/collection/components/swirl-app-bar/swirl-app-bar.stories.js +32 -0
- package/dist/collection/components/swirl-description-list/swirl-description-list.css +1 -0
- package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.css +22 -22
- package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.js +27 -1
- package/dist/collection/components/swirl-heading/swirl-heading.css +6 -0
- package/dist/collection/components/swirl-heading/swirl-heading.js +21 -1
- package/dist/collection/components/swirl-modal/swirl-modal.css +1 -1
- package/dist/collection/components/swirl-modal/swirl-modal.js +19 -1
- package/dist/components/swirl-app-bar.d.ts +11 -0
- package/dist/components/swirl-app-bar.js +95 -0
- package/dist/components/swirl-description-list-item.js +6 -2
- package/dist/components/swirl-description-list.js +1 -1
- package/dist/components/swirl-heading2.js +7 -3
- package/dist/components/swirl-modal.js +4 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-app-bar.entry.js +61 -0
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-description-list-item.entry.js +5 -2
- package/dist/esm/swirl-description-list.entry.js +1 -1
- package/dist/esm/swirl-heading.entry.js +5 -2
- package/dist/esm/swirl-modal.entry.js +3 -2
- package/dist/swirl-components/p-1aaa2dbd.entry.js +1 -0
- package/dist/swirl-components/p-490aca41.entry.js +1 -0
- package/dist/swirl-components/{p-00978344.entry.js → p-93173ef4.entry.js} +1 -1
- package/dist/swirl-components/p-98f78231.entry.js +1 -0
- package/dist/swirl-components/p-dce1b3a9.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-app-bar/swirl-app-bar.d.ts +31 -0
- package/dist/types/components/swirl-app-bar/swirl-app-bar.stories.d.ts +13 -0
- package/dist/types/components/swirl-description-list-item/swirl-description-list-item.d.ts +2 -0
- package/dist/types/components/swirl-heading/swirl-heading.d.ts +1 -0
- package/dist/types/components/swirl-modal/swirl-modal.d.ts +1 -0
- package/dist/types/components.d.ts +43 -0
- package/package.json +1 -1
- package/vscode-data.json +57 -0
- package/dist/swirl-components/p-107e3594.entry.js +0 -1
- package/dist/swirl-components/p-13740092.entry.js +0 -1
- package/dist/swirl-components/p-5044fc33.entry.js +0 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { h, Host, } from "@stencil/core";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
/**
|
|
4
|
+
* @slot heading - The app bar's heading element
|
|
5
|
+
* @slot center-controls - Container for controls displayed in the center
|
|
6
|
+
* @slot cta - Container for a call to action button
|
|
7
|
+
* @slot heading - Container for controls displayed at the end of the bar
|
|
8
|
+
*/
|
|
9
|
+
export class SwirlAppBar {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.onBackButtonClick = (event) => {
|
|
12
|
+
this.backButtonClick.emit(event);
|
|
13
|
+
};
|
|
14
|
+
this.onCloseButtonClick = (event) => {
|
|
15
|
+
this.closeButtonClick.emit(event);
|
|
16
|
+
};
|
|
17
|
+
this.onStepUpButtonClick = (event) => {
|
|
18
|
+
this.stepUpButtonClick.emit(event);
|
|
19
|
+
};
|
|
20
|
+
this.onStepDownButtonClick = (event) => {
|
|
21
|
+
this.stepDownButtonClick.emit(event);
|
|
22
|
+
};
|
|
23
|
+
this.backButtonLabel = "Go back";
|
|
24
|
+
this.closeButtonLabel = "Close";
|
|
25
|
+
this.stepUpButtonLabel = "Previous item";
|
|
26
|
+
this.stepDownButtonLabel = "Next item";
|
|
27
|
+
this.showBackButton = undefined;
|
|
28
|
+
this.showCloseButton = undefined;
|
|
29
|
+
this.showStepperControls = undefined;
|
|
30
|
+
this.hasCta = undefined;
|
|
31
|
+
}
|
|
32
|
+
componentWillLoad() {
|
|
33
|
+
this.mutationObserver = new MutationObserver(() => {
|
|
34
|
+
this.updateCtaStatus();
|
|
35
|
+
});
|
|
36
|
+
this.mutationObserver.observe(this.el, { childList: true });
|
|
37
|
+
queueMicrotask(() => {
|
|
38
|
+
this.updateCtaStatus();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
disconnectedCallback() {
|
|
42
|
+
var _a;
|
|
43
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
44
|
+
}
|
|
45
|
+
updateCtaStatus() {
|
|
46
|
+
this.hasCta = Boolean(this.el.querySelector('[slot="cta"]'));
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const showLeftControls = this.showBackButton || this.showCloseButton || this.showStepperControls;
|
|
50
|
+
const className = classnames("app-bar", {
|
|
51
|
+
"app-bar--has-cta": this.hasCta,
|
|
52
|
+
});
|
|
53
|
+
return (h(Host, null, h("div", { class: className }, showLeftControls && (h("div", { class: "app-bar__left-controls" }, (this.showBackButton || this.showCloseButton) && (h("div", { class: "app-bar__main-navigation-control" }, this.showBackButton && (h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.backButtonLabel, onClick: this.onBackButtonClick })), this.showCloseButton && (h("swirl-button", { hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })))), this.showStepperControls && (h("div", { class: "app-bar__stepper-controls" }, h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-upward></swirl-icon-arrow-upward>", label: this.stepUpButtonLabel, onClick: this.onStepUpButtonClick }), h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-downward></swirl-icon-arrow-downward>", label: this.stepDownButtonLabel, onClick: this.onStepDownButtonClick }))))), h("div", { class: "app-bar__cta" }, h("slot", { name: "cta" })), h("div", { class: "app-bar__heading" }, h("slot", { name: "heading" })), h("div", { class: "app-bar__center-controls" }, h("slot", { name: "center-controls" })), h("div", { class: "app-bar__right-controls" }, h("slot", { name: "right-controls" })))));
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "swirl-app-bar"; }
|
|
56
|
+
static get encapsulation() { return "shadow"; }
|
|
57
|
+
static get originalStyleUrls() {
|
|
58
|
+
return {
|
|
59
|
+
"$": ["swirl-app-bar.css"]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
static get styleUrls() {
|
|
63
|
+
return {
|
|
64
|
+
"$": ["swirl-app-bar.css"]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
static get properties() {
|
|
68
|
+
return {
|
|
69
|
+
"backButtonLabel": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"mutable": false,
|
|
72
|
+
"complexType": {
|
|
73
|
+
"original": "string",
|
|
74
|
+
"resolved": "string",
|
|
75
|
+
"references": {}
|
|
76
|
+
},
|
|
77
|
+
"required": false,
|
|
78
|
+
"optional": true,
|
|
79
|
+
"docs": {
|
|
80
|
+
"tags": [],
|
|
81
|
+
"text": ""
|
|
82
|
+
},
|
|
83
|
+
"attribute": "back-button-label",
|
|
84
|
+
"reflect": false,
|
|
85
|
+
"defaultValue": "\"Go back\""
|
|
86
|
+
},
|
|
87
|
+
"closeButtonLabel": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"mutable": false,
|
|
90
|
+
"complexType": {
|
|
91
|
+
"original": "string",
|
|
92
|
+
"resolved": "string",
|
|
93
|
+
"references": {}
|
|
94
|
+
},
|
|
95
|
+
"required": false,
|
|
96
|
+
"optional": true,
|
|
97
|
+
"docs": {
|
|
98
|
+
"tags": [],
|
|
99
|
+
"text": ""
|
|
100
|
+
},
|
|
101
|
+
"attribute": "close-button-label",
|
|
102
|
+
"reflect": false,
|
|
103
|
+
"defaultValue": "\"Close\""
|
|
104
|
+
},
|
|
105
|
+
"stepUpButtonLabel": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"mutable": false,
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "string",
|
|
110
|
+
"resolved": "string",
|
|
111
|
+
"references": {}
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"optional": true,
|
|
115
|
+
"docs": {
|
|
116
|
+
"tags": [],
|
|
117
|
+
"text": ""
|
|
118
|
+
},
|
|
119
|
+
"attribute": "step-up-button-label",
|
|
120
|
+
"reflect": false,
|
|
121
|
+
"defaultValue": "\"Previous item\""
|
|
122
|
+
},
|
|
123
|
+
"stepDownButtonLabel": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"mutable": false,
|
|
126
|
+
"complexType": {
|
|
127
|
+
"original": "string",
|
|
128
|
+
"resolved": "string",
|
|
129
|
+
"references": {}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": true,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": ""
|
|
136
|
+
},
|
|
137
|
+
"attribute": "step-down-button-label",
|
|
138
|
+
"reflect": false,
|
|
139
|
+
"defaultValue": "\"Next item\""
|
|
140
|
+
},
|
|
141
|
+
"showBackButton": {
|
|
142
|
+
"type": "boolean",
|
|
143
|
+
"mutable": false,
|
|
144
|
+
"complexType": {
|
|
145
|
+
"original": "boolean",
|
|
146
|
+
"resolved": "boolean",
|
|
147
|
+
"references": {}
|
|
148
|
+
},
|
|
149
|
+
"required": false,
|
|
150
|
+
"optional": true,
|
|
151
|
+
"docs": {
|
|
152
|
+
"tags": [],
|
|
153
|
+
"text": ""
|
|
154
|
+
},
|
|
155
|
+
"attribute": "show-back-button",
|
|
156
|
+
"reflect": false
|
|
157
|
+
},
|
|
158
|
+
"showCloseButton": {
|
|
159
|
+
"type": "boolean",
|
|
160
|
+
"mutable": false,
|
|
161
|
+
"complexType": {
|
|
162
|
+
"original": "boolean",
|
|
163
|
+
"resolved": "boolean",
|
|
164
|
+
"references": {}
|
|
165
|
+
},
|
|
166
|
+
"required": false,
|
|
167
|
+
"optional": true,
|
|
168
|
+
"docs": {
|
|
169
|
+
"tags": [],
|
|
170
|
+
"text": ""
|
|
171
|
+
},
|
|
172
|
+
"attribute": "show-close-button",
|
|
173
|
+
"reflect": false
|
|
174
|
+
},
|
|
175
|
+
"showStepperControls": {
|
|
176
|
+
"type": "boolean",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "boolean",
|
|
180
|
+
"resolved": "boolean",
|
|
181
|
+
"references": {}
|
|
182
|
+
},
|
|
183
|
+
"required": false,
|
|
184
|
+
"optional": true,
|
|
185
|
+
"docs": {
|
|
186
|
+
"tags": [],
|
|
187
|
+
"text": ""
|
|
188
|
+
},
|
|
189
|
+
"attribute": "show-stepper-controls",
|
|
190
|
+
"reflect": false
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
static get states() {
|
|
195
|
+
return {
|
|
196
|
+
"hasCta": {}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
static get events() {
|
|
200
|
+
return [{
|
|
201
|
+
"method": "backButtonClick",
|
|
202
|
+
"name": "backButtonClick",
|
|
203
|
+
"bubbles": true,
|
|
204
|
+
"cancelable": true,
|
|
205
|
+
"composed": true,
|
|
206
|
+
"docs": {
|
|
207
|
+
"tags": [],
|
|
208
|
+
"text": ""
|
|
209
|
+
},
|
|
210
|
+
"complexType": {
|
|
211
|
+
"original": "MouseEvent",
|
|
212
|
+
"resolved": "MouseEvent",
|
|
213
|
+
"references": {
|
|
214
|
+
"MouseEvent": {
|
|
215
|
+
"location": "global"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}, {
|
|
220
|
+
"method": "closeButtonClick",
|
|
221
|
+
"name": "closeButtonClick",
|
|
222
|
+
"bubbles": true,
|
|
223
|
+
"cancelable": true,
|
|
224
|
+
"composed": true,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": ""
|
|
228
|
+
},
|
|
229
|
+
"complexType": {
|
|
230
|
+
"original": "MouseEvent",
|
|
231
|
+
"resolved": "MouseEvent",
|
|
232
|
+
"references": {
|
|
233
|
+
"MouseEvent": {
|
|
234
|
+
"location": "global"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}, {
|
|
239
|
+
"method": "stepUpButtonClick",
|
|
240
|
+
"name": "stepUpButtonClick",
|
|
241
|
+
"bubbles": true,
|
|
242
|
+
"cancelable": true,
|
|
243
|
+
"composed": true,
|
|
244
|
+
"docs": {
|
|
245
|
+
"tags": [],
|
|
246
|
+
"text": ""
|
|
247
|
+
},
|
|
248
|
+
"complexType": {
|
|
249
|
+
"original": "MouseEvent",
|
|
250
|
+
"resolved": "MouseEvent",
|
|
251
|
+
"references": {
|
|
252
|
+
"MouseEvent": {
|
|
253
|
+
"location": "global"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}, {
|
|
258
|
+
"method": "stepDownButtonClick",
|
|
259
|
+
"name": "stepDownButtonClick",
|
|
260
|
+
"bubbles": true,
|
|
261
|
+
"cancelable": true,
|
|
262
|
+
"composed": true,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": ""
|
|
266
|
+
},
|
|
267
|
+
"complexType": {
|
|
268
|
+
"original": "MouseEvent",
|
|
269
|
+
"resolved": "MouseEvent",
|
|
270
|
+
"references": {
|
|
271
|
+
"MouseEvent": {
|
|
272
|
+
"location": "global"
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}];
|
|
277
|
+
}
|
|
278
|
+
static get elementRef() { return "el"; }
|
|
279
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { generateStoryElement } from "../../utils";
|
|
2
|
+
import Docs from "./swirl-app-bar.mdx";
|
|
3
|
+
export default {
|
|
4
|
+
component: "swirl-app-bar",
|
|
5
|
+
parameters: {
|
|
6
|
+
docs: {
|
|
7
|
+
page: Docs,
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
title: "Components/SwirlAppBar",
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const element = generateStoryElement("swirl-app-bar", args);
|
|
14
|
+
element.innerHTML = `
|
|
15
|
+
<swirl-heading as="h1" level="3" slot="heading" text="Heading" truncate></swirl-heading>
|
|
16
|
+
<swirl-stack justify="center" orientation="horizontal" spacing="8" slot="center-controls">
|
|
17
|
+
<swirl-button label="All posts" variant="flat"></swirl-button>
|
|
18
|
+
<swirl-button label="Groups"></swirl-button>
|
|
19
|
+
<swirl-button label="Saved"></swirl-button>
|
|
20
|
+
<swirl-button label="Scheduled"></swirl-button>
|
|
21
|
+
</swirl-stack>
|
|
22
|
+
<div slot="right-controls">
|
|
23
|
+
<swirl-button hide-label="true" icon="<swirl-icon-search></swirl-icon-search>" label="Search"></swirl-button>
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
return element;
|
|
27
|
+
};
|
|
28
|
+
export const SwirlAppBar = Template.bind({});
|
|
29
|
+
SwirlAppBar.args = {
|
|
30
|
+
showCloseButton: true,
|
|
31
|
+
showStepperControls: true,
|
|
32
|
+
};
|
package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.css
CHANGED
|
@@ -41,40 +41,40 @@
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@container description-list (min-width: 480px) {
|
|
44
|
-
.description-list-item {
|
|
44
|
+
.description-list-item--orientation-horizontal {
|
|
45
45
|
display: flex;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
.description-list-item--orientation-horizontal .description-list-item__term {
|
|
49
|
+
margin-right: var(--s-space-16);
|
|
50
|
+
margin-bottom: 0;
|
|
51
|
+
flex-basis: 12rem;
|
|
52
|
+
flex-grow: 0;
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
.description-list-item--orientation-horizontal .description-list-item__description {
|
|
57
|
+
flex-grow: 1;
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/* Fallback styles for browsers without container query support */
|
|
62
62
|
@supports not (container-type: inline-size) {
|
|
63
63
|
@media (min-width: 768px) {
|
|
64
|
-
.description-list-item {
|
|
64
|
+
.description-list-item--orientation-horizontal {
|
|
65
65
|
display: flex;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
.description-list-item--orientation-horizontal .description-list-item__term {
|
|
69
|
+
margin-right: var(--s-space-16);
|
|
70
|
+
margin-bottom: 0;
|
|
71
|
+
flex-basis: 12rem;
|
|
72
|
+
flex-grow: 0;
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
.description-list-item--orientation-horizontal .description-list-item__description {
|
|
77
|
+
flex-grow: 1;
|
|
78
|
+
}
|
|
79
79
|
}
|
|
80
80
|
}
|
package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
+
import classNames from "classnames";
|
|
2
3
|
/**
|
|
3
4
|
* @slot slot - The description
|
|
4
5
|
*/
|
|
5
6
|
export class SwirlDescriptionListItem {
|
|
6
7
|
constructor() {
|
|
8
|
+
this.orientation = "horizontal";
|
|
7
9
|
this.term = undefined;
|
|
8
10
|
}
|
|
9
11
|
render() {
|
|
10
|
-
|
|
12
|
+
const className = classNames("description-list-item", `description-list-item--orientation-${this.orientation}`);
|
|
13
|
+
return (h(Host, null, h("div", { class: className, part: "description-list-item" }, h("dt", { class: "description-list-item__term", part: "description-list-item__term" }, this.term), h("dd", { class: "description-list-item__description" }, h("slot", null)))));
|
|
11
14
|
}
|
|
12
15
|
static get is() { return "swirl-description-list-item"; }
|
|
13
16
|
static get encapsulation() { return "shadow"; }
|
|
@@ -23,6 +26,29 @@ export class SwirlDescriptionListItem {
|
|
|
23
26
|
}
|
|
24
27
|
static get properties() {
|
|
25
28
|
return {
|
|
29
|
+
"orientation": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"mutable": false,
|
|
32
|
+
"complexType": {
|
|
33
|
+
"original": "SwirlDescriptionListItemOrientation",
|
|
34
|
+
"resolved": "\"horizontal\" | \"vertical\"",
|
|
35
|
+
"references": {
|
|
36
|
+
"SwirlDescriptionListItemOrientation": {
|
|
37
|
+
"location": "local",
|
|
38
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-description-list-item/swirl-description-list-item.tsx"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"required": false,
|
|
43
|
+
"optional": true,
|
|
44
|
+
"docs": {
|
|
45
|
+
"tags": [],
|
|
46
|
+
"text": ""
|
|
47
|
+
},
|
|
48
|
+
"attribute": "orientation",
|
|
49
|
+
"reflect": false,
|
|
50
|
+
"defaultValue": "\"horizontal\""
|
|
51
|
+
},
|
|
26
52
|
"term": {
|
|
27
53
|
"type": "string",
|
|
28
54
|
"mutable": false,
|
|
@@ -9,6 +9,7 @@ export class SwirlHeading {
|
|
|
9
9
|
this.headingId = undefined;
|
|
10
10
|
this.level = 1;
|
|
11
11
|
this.text = undefined;
|
|
12
|
+
this.truncate = undefined;
|
|
12
13
|
}
|
|
13
14
|
componentDidRender() {
|
|
14
15
|
this.rebalance();
|
|
@@ -24,7 +25,9 @@ export class SwirlHeading {
|
|
|
24
25
|
}
|
|
25
26
|
render() {
|
|
26
27
|
const Tag = this.as || `h${this.level}`;
|
|
27
|
-
const className = classnames("heading", `heading--align-${this.align}`, `heading--level-${this.level}
|
|
28
|
+
const className = classnames("heading", `heading--align-${this.align}`, `heading--level-${this.level}`, {
|
|
29
|
+
"heading--truncate": this.truncate,
|
|
30
|
+
});
|
|
28
31
|
return (h(Host, null, h(Tag, { class: className, id: this.headingId, ref: (el) => (this.headingEl = el) }, this.text)));
|
|
29
32
|
}
|
|
30
33
|
static get is() { return "swirl-heading"; }
|
|
@@ -160,6 +163,23 @@ export class SwirlHeading {
|
|
|
160
163
|
},
|
|
161
164
|
"attribute": "text",
|
|
162
165
|
"reflect": false
|
|
166
|
+
},
|
|
167
|
+
"truncate": {
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "boolean",
|
|
172
|
+
"resolved": "boolean",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": true,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": ""
|
|
180
|
+
},
|
|
181
|
+
"attribute": "truncate",
|
|
182
|
+
"reflect": false
|
|
163
183
|
}
|
|
164
184
|
};
|
|
165
185
|
}
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
display: flex;
|
|
111
111
|
overflow: hidden;
|
|
112
112
|
width: 100vw;
|
|
113
|
+
max-width: 40rem;
|
|
113
114
|
height: 100vh;
|
|
114
115
|
background-color: var(--s-surface-overlay-default);
|
|
115
116
|
flex-direction: column;
|
|
@@ -119,7 +120,6 @@
|
|
|
119
120
|
|
|
120
121
|
.modal__body {
|
|
121
122
|
width: 90vw;
|
|
122
|
-
max-width: 33.75rem;
|
|
123
123
|
height: auto;
|
|
124
124
|
max-height: 90vh;
|
|
125
125
|
border-radius: var(--s-border-radius-base);
|
|
@@ -40,6 +40,7 @@ export class SwirlModal {
|
|
|
40
40
|
this.hideCloseButton = undefined;
|
|
41
41
|
this.hideLabel = undefined;
|
|
42
42
|
this.label = undefined;
|
|
43
|
+
this.maxWidth = undefined;
|
|
43
44
|
this.padded = true;
|
|
44
45
|
this.primaryActionLabel = undefined;
|
|
45
46
|
this.secondaryActionLabel = undefined;
|
|
@@ -99,7 +100,7 @@ export class SwirlModal {
|
|
|
99
100
|
"modal--scrolled": this.scrolled,
|
|
100
101
|
"modal--scrolled-down": this.scrolledDown,
|
|
101
102
|
});
|
|
102
|
-
return (h(Host, null, h("section", { "aria-hidden": "true", "aria-label": this.label, class: className, id: "modal", onKeyDown: this.onKeyDown, ref: (el) => (this.modalEl = el) }, h("div", { class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { class: "modal__body", role: "document" }, !this.hideCloseButton && (h("swirl-button", { class: "modal__close-button", hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), !this.hideLabel && (h("header", { class: "modal__header" }, h("swirl-heading", { as: "h2", class: "modal__heading", level: 3, text: this.label }))), h("div", { class: "modal__content", onScroll: this.determineScrollStatus, ref: (el) => (this.scrollContainer = el) }, h("slot", null)), showControls && (h("footer", { class: "modal__controls" }, h("swirl-button-group", { wrap: true }, this.secondaryActionLabel && (h("swirl-button", { label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { intent: "primary", label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: "flat" })))))))));
|
|
103
|
+
return (h(Host, null, h("section", { "aria-hidden": "true", "aria-label": this.label, class: className, id: "modal", onKeyDown: this.onKeyDown, ref: (el) => (this.modalEl = el) }, h("div", { class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { class: "modal__body", role: "document", style: { maxWidth: this.maxWidth } }, !this.hideCloseButton && (h("swirl-button", { class: "modal__close-button", hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), !this.hideLabel && (h("header", { class: "modal__header" }, h("swirl-heading", { as: "h2", class: "modal__heading", level: 3, text: this.label }))), h("div", { class: "modal__content", onScroll: this.determineScrollStatus, ref: (el) => (this.scrollContainer = el) }, h("slot", null)), showControls && (h("footer", { class: "modal__controls" }, h("swirl-button-group", { wrap: true }, this.secondaryActionLabel && (h("swirl-button", { label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { intent: "primary", label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: "flat" })))))))));
|
|
103
104
|
}
|
|
104
105
|
static get is() { return "swirl-modal"; }
|
|
105
106
|
static get encapsulation() { return "shadow"; }
|
|
@@ -184,6 +185,23 @@ export class SwirlModal {
|
|
|
184
185
|
"attribute": "label",
|
|
185
186
|
"reflect": false
|
|
186
187
|
},
|
|
188
|
+
"maxWidth": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"mutable": false,
|
|
191
|
+
"complexType": {
|
|
192
|
+
"original": "string",
|
|
193
|
+
"resolved": "string",
|
|
194
|
+
"references": {}
|
|
195
|
+
},
|
|
196
|
+
"required": false,
|
|
197
|
+
"optional": true,
|
|
198
|
+
"docs": {
|
|
199
|
+
"tags": [],
|
|
200
|
+
"text": ""
|
|
201
|
+
},
|
|
202
|
+
"attribute": "max-width",
|
|
203
|
+
"reflect": false
|
|
204
|
+
},
|
|
187
205
|
"padded": {
|
|
188
206
|
"type": "boolean",
|
|
189
207
|
"mutable": false,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SwirlAppBar extends Components.SwirlAppBar, HTMLElement {}
|
|
4
|
+
export const SwirlAppBar: {
|
|
5
|
+
prototype: SwirlAppBar;
|
|
6
|
+
new (): SwirlAppBar;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as classnames } from './index2.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './swirl-button2.js';
|
|
4
|
+
|
|
5
|
+
const swirlAppBarCss = ":host{display:block;overflow-x:auto;width:100%}:host *{box-sizing:border-box}.app-bar{display:flex;min-width:-webkit-min-content;min-width:-moz-min-content;min-width:min-content;min-height:3.5rem;padding-right:var(--s-space-16);padding-left:var(--s-space-16);align-items:center;gap:var(--s-space-16)}.app-bar--has-cta .app-bar__cta{display:block}.app-bar__left-controls{display:flex;min-width:0;flex-shrink:0;align-items:center;gap:var(--s-space-16)}.app-bar__main-navigation-control{flex-shrink:0}.app-bar__cta{display:none}.app-bar__heading{display:flex;min-width:-webkit-min-content;min-width:-moz-min-content;min-width:min-content;flex-grow:1;align-items:center}@media (min-width: 992px){.app-bar__heading{flex-grow:0}}.app-bar__stepper-controls{position:relative;display:flex;flex-shrink:0;gap:var(--s-space-4)}.app-bar__stepper-controls:not(:first-child){padding-left:var(--s-space-16)}.app-bar__stepper-controls:not(:first-child):after{position:absolute;top:50%;left:0;width:var(--s-border-width-default);height:1.25rem;background-color:var(--s-border-default);content:\"\";transform:translateY(-50%)}.app-bar__center-controls{display:none;flex-grow:1;justify-content:center;align-items:center}@media (min-width: 992px){.app-bar__center-controls{display:flex}}.app-bar__right-controls{display:flex;min-width:0;flex-shrink:0;justify-content:flex-end;align-items:center}";
|
|
6
|
+
|
|
7
|
+
const SwirlAppBar$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.backButtonClick = createEvent(this, "backButtonClick", 7);
|
|
13
|
+
this.closeButtonClick = createEvent(this, "closeButtonClick", 7);
|
|
14
|
+
this.stepUpButtonClick = createEvent(this, "stepUpButtonClick", 7);
|
|
15
|
+
this.stepDownButtonClick = createEvent(this, "stepDownButtonClick", 7);
|
|
16
|
+
this.onBackButtonClick = (event) => {
|
|
17
|
+
this.backButtonClick.emit(event);
|
|
18
|
+
};
|
|
19
|
+
this.onCloseButtonClick = (event) => {
|
|
20
|
+
this.closeButtonClick.emit(event);
|
|
21
|
+
};
|
|
22
|
+
this.onStepUpButtonClick = (event) => {
|
|
23
|
+
this.stepUpButtonClick.emit(event);
|
|
24
|
+
};
|
|
25
|
+
this.onStepDownButtonClick = (event) => {
|
|
26
|
+
this.stepDownButtonClick.emit(event);
|
|
27
|
+
};
|
|
28
|
+
this.backButtonLabel = "Go back";
|
|
29
|
+
this.closeButtonLabel = "Close";
|
|
30
|
+
this.stepUpButtonLabel = "Previous item";
|
|
31
|
+
this.stepDownButtonLabel = "Next item";
|
|
32
|
+
this.showBackButton = undefined;
|
|
33
|
+
this.showCloseButton = undefined;
|
|
34
|
+
this.showStepperControls = undefined;
|
|
35
|
+
this.hasCta = undefined;
|
|
36
|
+
}
|
|
37
|
+
componentWillLoad() {
|
|
38
|
+
this.mutationObserver = new MutationObserver(() => {
|
|
39
|
+
this.updateCtaStatus();
|
|
40
|
+
});
|
|
41
|
+
this.mutationObserver.observe(this.el, { childList: true });
|
|
42
|
+
queueMicrotask(() => {
|
|
43
|
+
this.updateCtaStatus();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
var _a;
|
|
48
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
49
|
+
}
|
|
50
|
+
updateCtaStatus() {
|
|
51
|
+
this.hasCta = Boolean(this.el.querySelector('[slot="cta"]'));
|
|
52
|
+
}
|
|
53
|
+
render() {
|
|
54
|
+
const showLeftControls = this.showBackButton || this.showCloseButton || this.showStepperControls;
|
|
55
|
+
const className = classnames("app-bar", {
|
|
56
|
+
"app-bar--has-cta": this.hasCta,
|
|
57
|
+
});
|
|
58
|
+
return (h(Host, null, h("div", { class: className }, showLeftControls && (h("div", { class: "app-bar__left-controls" }, (this.showBackButton || this.showCloseButton) && (h("div", { class: "app-bar__main-navigation-control" }, this.showBackButton && (h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.backButtonLabel, onClick: this.onBackButtonClick })), this.showCloseButton && (h("swirl-button", { hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })))), this.showStepperControls && (h("div", { class: "app-bar__stepper-controls" }, h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-upward></swirl-icon-arrow-upward>", label: this.stepUpButtonLabel, onClick: this.onStepUpButtonClick }), h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-downward></swirl-icon-arrow-downward>", label: this.stepDownButtonLabel, onClick: this.onStepDownButtonClick }))))), h("div", { class: "app-bar__cta" }, h("slot", { name: "cta" })), h("div", { class: "app-bar__heading" }, h("slot", { name: "heading" })), h("div", { class: "app-bar__center-controls" }, h("slot", { name: "center-controls" })), h("div", { class: "app-bar__right-controls" }, h("slot", { name: "right-controls" })))));
|
|
59
|
+
}
|
|
60
|
+
get el() { return this; }
|
|
61
|
+
static get style() { return swirlAppBarCss; }
|
|
62
|
+
}, [1, "swirl-app-bar", {
|
|
63
|
+
"backButtonLabel": [1, "back-button-label"],
|
|
64
|
+
"closeButtonLabel": [1, "close-button-label"],
|
|
65
|
+
"stepUpButtonLabel": [1, "step-up-button-label"],
|
|
66
|
+
"stepDownButtonLabel": [1, "step-down-button-label"],
|
|
67
|
+
"showBackButton": [4, "show-back-button"],
|
|
68
|
+
"showCloseButton": [4, "show-close-button"],
|
|
69
|
+
"showStepperControls": [4, "show-stepper-controls"],
|
|
70
|
+
"hasCta": [32]
|
|
71
|
+
}]);
|
|
72
|
+
function defineCustomElement$1() {
|
|
73
|
+
if (typeof customElements === "undefined") {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const components = ["swirl-app-bar", "swirl-button"];
|
|
77
|
+
components.forEach(tagName => { switch (tagName) {
|
|
78
|
+
case "swirl-app-bar":
|
|
79
|
+
if (!customElements.get(tagName)) {
|
|
80
|
+
customElements.define(tagName, SwirlAppBar$1);
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
case "swirl-button":
|
|
84
|
+
if (!customElements.get(tagName)) {
|
|
85
|
+
defineCustomElement$2();
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
} });
|
|
89
|
+
}
|
|
90
|
+
defineCustomElement$1();
|
|
91
|
+
|
|
92
|
+
const SwirlAppBar = SwirlAppBar$1;
|
|
93
|
+
const defineCustomElement = defineCustomElement$1;
|
|
94
|
+
|
|
95
|
+
export { SwirlAppBar, defineCustomElement };
|