@prioticket/design-system-web 1.0.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/COMPONENT-DOCUMENTATION.md +608 -0
- package/README.md +229 -0
- package/component-documentation.json +1681 -0
- package/dist/components/pd-button.cjs.js +99 -0
- package/dist/components/pd-button.es.js +156 -0
- package/dist/components/pd-card.cjs.js +59 -0
- package/dist/components/pd-card.es.js +93 -0
- package/dist/components/pd-checkbox.cjs.js +85 -0
- package/dist/components/pd-checkbox.es.js +154 -0
- package/dist/components/pd-chip.cjs.js +118 -0
- package/dist/components/pd-chip.es.js +220 -0
- package/dist/components/pd-dialog.cjs.js +195 -0
- package/dist/components/pd-dialog.es.js +285 -0
- package/dist/components/pd-expandable-card.cjs.js +134 -0
- package/dist/components/pd-expandable-card.es.js +205 -0
- package/dist/components/pd-fab.cjs.js +119 -0
- package/dist/components/pd-fab.es.js +179 -0
- package/dist/components/pd-icon-button.cjs.js +159 -0
- package/dist/components/pd-icon-button.es.js +268 -0
- package/dist/components/pd-icon.cjs.js +71 -0
- package/dist/components/pd-icon.es.js +102 -0
- package/dist/components/pd-list.cjs.js +108 -0
- package/dist/components/pd-list.es.js +229 -0
- package/dist/components/pd-menu-item.cjs.js +85 -0
- package/dist/components/pd-menu-item.es.js +156 -0
- package/dist/components/pd-menu.cjs.js +42 -0
- package/dist/components/pd-menu.es.js +122 -0
- package/dist/components/pd-progress.cjs.js +72 -0
- package/dist/components/pd-progress.es.js +119 -0
- package/dist/components/pd-radio.cjs.js +38 -0
- package/dist/components/pd-radio.es.js +153 -0
- package/dist/components/pd-segmented-button.cjs.js +135 -0
- package/dist/components/pd-segmented-button.es.js +234 -0
- package/dist/components/pd-segmented-stepper.cjs.js +191 -0
- package/dist/components/pd-segmented-stepper.es.js +333 -0
- package/dist/components/pd-select.cjs.js +59 -0
- package/dist/components/pd-select.es.js +136 -0
- package/dist/components/pd-slider.cjs.js +42 -0
- package/dist/components/pd-slider.es.js +123 -0
- package/dist/components/pd-stepper.cjs.js +279 -0
- package/dist/components/pd-stepper.es.js +375 -0
- package/dist/components/pd-switch.cjs.js +57 -0
- package/dist/components/pd-switch.es.js +126 -0
- package/dist/components/pd-tabs.cjs.js +32 -0
- package/dist/components/pd-tabs.es.js +139 -0
- package/dist/components/pd-text-field.cjs.js +86 -0
- package/dist/components/pd-text-field.es.js +202 -0
- package/dist/design-system-web.css +1 -0
- package/dist/fonts/ProximaNova-Bold.woff2 +0 -0
- package/dist/fonts/ProximaNova-Extrabld.woff2 +0 -0
- package/dist/fonts/ProximaNova-Light.woff2 +0 -0
- package/dist/fonts/ProximaNova-Medium.woff2 +0 -0
- package/dist/fonts/ProximaNova-Regular.woff2 +0 -0
- package/dist/fonts/ProximaNova-Semibold.woff2 +0 -0
- package/dist/fonts/ProximaNovaCond-Semibold.woff2 +0 -0
- package/dist/fonts-only.css +59 -0
- package/dist/fonts.cjs.js +1 -0
- package/dist/fonts.es.js +1 -0
- package/dist/prioticket-design-system-web.cjs.js +1 -0
- package/dist/prioticket-design-system-web.es.js +52 -0
- package/dist/theme-only.css +311 -0
- package/dist/theme-with-fonts.cjs.js +1 -0
- package/dist/theme-with-fonts.css +372 -0
- package/dist/theme-with-fonts.es.js +2 -0
- package/dist/theme.cjs.js +1 -0
- package/dist/theme.es.js +1 -0
- package/dist/types/components/pd-button.d.ts +30 -0
- package/dist/types/components/pd-card.d.ts +8 -0
- package/dist/types/components/pd-checkbox.d.ts +16 -0
- package/dist/types/components/pd-chip.d.ts +26 -0
- package/dist/types/components/pd-dialog.d.ts +49 -0
- package/dist/types/components/pd-expandable-card.d.ts +39 -0
- package/dist/types/components/pd-fab.d.ts +17 -0
- package/dist/types/components/pd-icon-button.d.ts +24 -0
- package/dist/types/components/pd-icon.d.ts +9 -0
- package/dist/types/components/pd-list.d.ts +36 -0
- package/dist/types/components/pd-menu-item.d.ts +38 -0
- package/dist/types/components/pd-menu.d.ts +58 -0
- package/dist/types/components/pd-progress.d.ts +30 -0
- package/dist/types/components/pd-radio.d.ts +54 -0
- package/dist/types/components/pd-segmented-button.d.ts +53 -0
- package/dist/types/components/pd-segmented-stepper.d.ts +65 -0
- package/dist/types/components/pd-select.d.ts +46 -0
- package/dist/types/components/pd-slider.d.ts +43 -0
- package/dist/types/components/pd-stepper.d.ts +47 -0
- package/dist/types/components/pd-switch.d.ts +37 -0
- package/dist/types/components/pd-tabs.d.ts +54 -0
- package/dist/types/components/pd-text-field.d.ts +30 -0
- package/dist/types/fonts.d.ts +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/theme-with-fonts.d.ts +2 -0
- package/dist/types/theme.d.ts +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { css as m, LitElement as p, html as i } from "lit";
|
|
2
|
+
import { property as o, query as h, customElement as y } from "lit/decorators.js";
|
|
3
|
+
import "@material/web/dialog/dialog.js";
|
|
4
|
+
import "@material/web/button/text-button.js";
|
|
5
|
+
import "@material/web/button/filled-button.js";
|
|
6
|
+
import "@material/web/icon/icon.js";
|
|
7
|
+
var g = Object.defineProperty, u = Object.getOwnPropertyDescriptor, e = (n, s, d, l) => {
|
|
8
|
+
for (var a = l > 1 ? void 0 : l ? u(s, d) : s, r = n.length - 1, c; r >= 0; r--)
|
|
9
|
+
(c = n[r]) && (a = (l ? c(s, d, a) : c(a)) || a);
|
|
10
|
+
return l && a && g(s, d, a), a;
|
|
11
|
+
};
|
|
12
|
+
let t = class extends p {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.open = !1, this.size = "medium", this.variant = "custom", this.headline = "", this.primaryAction = "", this.secondaryAction = "", this.closableByBackdrop = !0, this.showCloseButton = !1;
|
|
15
|
+
}
|
|
16
|
+
/** Opens the dialog. */
|
|
17
|
+
openDialog() {
|
|
18
|
+
this.open = !0, this.dialogElement?.show?.();
|
|
19
|
+
}
|
|
20
|
+
/** Closes the dialog. */
|
|
21
|
+
closeDialog() {
|
|
22
|
+
this.open = !1, this.dialogElement?.close?.();
|
|
23
|
+
}
|
|
24
|
+
/** Toggles the dialog open state. */
|
|
25
|
+
toggle() {
|
|
26
|
+
this.open ? this.closeDialog() : this.openDialog();
|
|
27
|
+
}
|
|
28
|
+
handleDialogOpen() {
|
|
29
|
+
this.open = !0, this.dispatchEvent(new CustomEvent("open", {
|
|
30
|
+
detail: { dialog: this },
|
|
31
|
+
bubbles: !0
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
handleDialogClose() {
|
|
35
|
+
this.open = !1, this.dispatchEvent(new CustomEvent("closed", {
|
|
36
|
+
detail: { dialog: this },
|
|
37
|
+
bubbles: !0
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
handlePrimaryAction() {
|
|
41
|
+
this.dispatchEvent(new CustomEvent("primary-action", {
|
|
42
|
+
detail: { dialog: this },
|
|
43
|
+
bubbles: !0
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
handleSecondaryAction() {
|
|
47
|
+
this.dispatchEvent(new CustomEvent("secondary-action", {
|
|
48
|
+
detail: { dialog: this },
|
|
49
|
+
bubbles: !0
|
|
50
|
+
})), this.closeDialog();
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
return i`
|
|
54
|
+
<md-dialog
|
|
55
|
+
?open=${this.open}
|
|
56
|
+
?no-focus-trap=${!this.closableByBackdrop}
|
|
57
|
+
@open=${this.handleDialogOpen}
|
|
58
|
+
@closed=${this.handleDialogClose}
|
|
59
|
+
@cancel=${(n) => {
|
|
60
|
+
this.closableByBackdrop || n.preventDefault();
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
${this.headline || this.showCloseButton ? i`
|
|
64
|
+
<div slot="headline" class="headline-container">
|
|
65
|
+
${this.headline ? i`<span class="headline-text">${this.headline}</span>` : ""}
|
|
66
|
+
${this.showCloseButton ? i`
|
|
67
|
+
<md-text-button
|
|
68
|
+
class="close-button"
|
|
69
|
+
@click=${this.closeDialog}
|
|
70
|
+
aria-label="Close dialog"
|
|
71
|
+
>
|
|
72
|
+
<md-icon slot="icon">close</md-icon>
|
|
73
|
+
</md-text-button>
|
|
74
|
+
` : ""}
|
|
75
|
+
</div>
|
|
76
|
+
` : ""}
|
|
77
|
+
|
|
78
|
+
<div slot="content" class="content-container">
|
|
79
|
+
<slot></slot>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
${this.primaryAction || this.secondaryAction ? i`
|
|
83
|
+
<div slot="actions" class="actions-container">
|
|
84
|
+
${this.secondaryAction ? i`
|
|
85
|
+
<md-text-button
|
|
86
|
+
class="secondary-action"
|
|
87
|
+
@click=${this.handleSecondaryAction}
|
|
88
|
+
>
|
|
89
|
+
${this.secondaryAction}
|
|
90
|
+
</md-text-button>
|
|
91
|
+
` : ""}
|
|
92
|
+
${this.primaryAction ? i`
|
|
93
|
+
<md-filled-button
|
|
94
|
+
class="primary-action"
|
|
95
|
+
@click=${this.handlePrimaryAction}
|
|
96
|
+
>
|
|
97
|
+
${this.primaryAction}
|
|
98
|
+
</md-filled-button>
|
|
99
|
+
` : ""}
|
|
100
|
+
<slot name="actions"></slot>
|
|
101
|
+
</div>
|
|
102
|
+
` : i`<slot name="actions" slot="actions"></slot>`}
|
|
103
|
+
</md-dialog>
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
t.styles = m`
|
|
108
|
+
:host {
|
|
109
|
+
/* Set default shape for ALL Prioticket dialogs to match card styling */
|
|
110
|
+
--md-dialog-container-shape: var(--md-sys-shape-corner-small);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
md-dialog {
|
|
114
|
+
/* Dialog transitions and animations */
|
|
115
|
+
transition: all 200ms ease-in-out;
|
|
116
|
+
|
|
117
|
+
/* Material Web dialog customization */
|
|
118
|
+
--md-dialog-headline-color: var(--md-sys-color-on-surface);
|
|
119
|
+
--md-dialog-supporting-text-color: var(--md-sys-color-on-surface-variant);
|
|
120
|
+
--md-dialog-container-color: var(--md-sys-color-surface);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.headline-container {
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: space-between;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: var(--md-sys-spacing-400, 16px);
|
|
128
|
+
width: 100%;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.headline-text {
|
|
132
|
+
font-family: var(--md-sys-typescale-headline-small-font);
|
|
133
|
+
font-size: var(--md-sys-typescale-headline-small-size);
|
|
134
|
+
font-weight: var(--md-sys-typescale-headline-small-weight);
|
|
135
|
+
line-height: var(--md-sys-typescale-headline-small-line-height);
|
|
136
|
+
color: var(--md-sys-color-on-surface);
|
|
137
|
+
flex: 1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.close-button {
|
|
141
|
+
flex-shrink: 0;
|
|
142
|
+
--md-text-button-label-text-size: 0; /* Hide text, show only icon */
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.content-container {
|
|
146
|
+
font-family: var(--md-sys-typescale-body-medium-font);
|
|
147
|
+
font-size: var(--md-sys-typescale-body-medium-size);
|
|
148
|
+
font-weight: var(--md-sys-typescale-body-medium-weight);
|
|
149
|
+
line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
150
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.actions-container {
|
|
154
|
+
display: flex;
|
|
155
|
+
justify-content: flex-end;
|
|
156
|
+
gap: 8px;
|
|
157
|
+
align-items: center;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* --- Size Variants --- */
|
|
161
|
+
:host([size='small']) md-dialog {
|
|
162
|
+
--md-dialog-container-max-width: var(--md-sys-dialog-container-max-width-small, 320px);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host([size='medium']) md-dialog {
|
|
166
|
+
--md-dialog-container-max-width: var(--md-sys-dialog-container-max-width-medium, 560px);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host([size='large']) md-dialog {
|
|
170
|
+
--md-dialog-container-max-width: var(--md-sys-dialog-container-max-width-large, 800px);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:host([size='fullscreen']) md-dialog {
|
|
174
|
+
--md-dialog-container-max-width: var(--md-sys-dialog-container-max-width-fullscreen, 100vw);
|
|
175
|
+
--md-dialog-container-max-height: var(--md-sys-dialog-container-max-height-fullscreen, 100vh);
|
|
176
|
+
--md-dialog-container-inset-block-start: 0;
|
|
177
|
+
--md-dialog-container-inset-inline-start: 0;
|
|
178
|
+
--md-dialog-container-inset-inline-end: 0;
|
|
179
|
+
--md-dialog-container-inset-block-end: 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* --- Variant Styles --- */
|
|
183
|
+
:host([variant='alert']) .content-container {
|
|
184
|
+
padding: var(--md-sys-padding-200, 8px) 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
:host([variant='confirm']) .actions-container {
|
|
188
|
+
gap: var(--md-sys-spacing-300, 12px);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
:host([variant='form']) .content-container {
|
|
192
|
+
padding: var(--md-sys-padding-400, 16px) 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Responsive adjustments */
|
|
196
|
+
@media (max-width: 768px) {
|
|
197
|
+
md-dialog {
|
|
198
|
+
--md-dialog-container-inset-inline-start: var(--md-sys-spacing-400, 16px);
|
|
199
|
+
--md-dialog-container-inset-inline-end: var(--md-sys-spacing-400, 16px);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
:host([size='small']) md-dialog,
|
|
203
|
+
:host([size='medium']) md-dialog,
|
|
204
|
+
:host([size='large']) md-dialog {
|
|
205
|
+
--md-dialog-container-max-width: calc(100vw - var(--md-sys-spacing-800, 32px));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
:host([size='fullscreen']) md-dialog {
|
|
209
|
+
--md-dialog-container-inset-inline-start: 0;
|
|
210
|
+
--md-dialog-container-inset-inline-end: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.actions-container {
|
|
214
|
+
flex-direction: column-reverse;
|
|
215
|
+
gap: var(--md-sys-spacing-200, 8px);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.actions-container md-filled-button,
|
|
219
|
+
.actions-container md-text-button {
|
|
220
|
+
width: var(--md-sys-dialog-action-button-width-mobile, 100%);
|
|
221
|
+
--md-filled-button-container-width: var(--md-sys-dialog-action-button-width-mobile, 100%);
|
|
222
|
+
--md-text-button-container-width: var(--md-sys-dialog-action-button-width-mobile, 100%);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Enhanced Material Web styling */
|
|
227
|
+
md-dialog::part(scrim) {
|
|
228
|
+
--md-dialog-scrim-opacity: 0.32;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Button styling to match pd-button component */
|
|
232
|
+
.primary-action,
|
|
233
|
+
.secondary-action,
|
|
234
|
+
.close-button {
|
|
235
|
+
/* Apply same border radius as pd-button component */
|
|
236
|
+
--md-filled-button-container-shape: var(--md-sys-shape-corner-small);
|
|
237
|
+
--md-text-button-container-shape: var(--md-sys-shape-corner-small);
|
|
238
|
+
/* Smooth transitions like pd-button */
|
|
239
|
+
transition: all 150ms ease-in-out;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Focus and interaction states */
|
|
243
|
+
.primary-action {
|
|
244
|
+
--md-filled-button-hover-state-layer-color: var(--md-sys-color-primary);
|
|
245
|
+
--md-filled-button-pressed-state-layer-color: var(--md-sys-color-primary);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.secondary-action {
|
|
249
|
+
--md-text-button-hover-state-layer-color: var(--md-sys-color-primary);
|
|
250
|
+
--md-text-button-pressed-state-layer-color: var(--md-sys-color-primary);
|
|
251
|
+
}
|
|
252
|
+
`;
|
|
253
|
+
e([
|
|
254
|
+
o({ type: Boolean, reflect: !0 })
|
|
255
|
+
], t.prototype, "open", 2);
|
|
256
|
+
e([
|
|
257
|
+
o({ type: String })
|
|
258
|
+
], t.prototype, "size", 2);
|
|
259
|
+
e([
|
|
260
|
+
o({ type: String })
|
|
261
|
+
], t.prototype, "variant", 2);
|
|
262
|
+
e([
|
|
263
|
+
o({ type: String })
|
|
264
|
+
], t.prototype, "headline", 2);
|
|
265
|
+
e([
|
|
266
|
+
o({ type: String, attribute: "primary-action" })
|
|
267
|
+
], t.prototype, "primaryAction", 2);
|
|
268
|
+
e([
|
|
269
|
+
o({ type: String, attribute: "secondary-action" })
|
|
270
|
+
], t.prototype, "secondaryAction", 2);
|
|
271
|
+
e([
|
|
272
|
+
o({ type: Boolean, attribute: "closable-by-backdrop" })
|
|
273
|
+
], t.prototype, "closableByBackdrop", 2);
|
|
274
|
+
e([
|
|
275
|
+
o({ type: Boolean, attribute: "show-close-button" })
|
|
276
|
+
], t.prototype, "showCloseButton", 2);
|
|
277
|
+
e([
|
|
278
|
+
h("md-dialog")
|
|
279
|
+
], t.prototype, "dialogElement", 2);
|
|
280
|
+
t = e([
|
|
281
|
+
y("pd-dialog")
|
|
282
|
+
], t);
|
|
283
|
+
export {
|
|
284
|
+
t as PdDialog
|
|
285
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("lit"),t=require("lit/decorators.js");require("@material/web/icon/icon.js");require("@material/web/iconbutton/icon-button.js");var c=Object.defineProperty,p=Object.getOwnPropertyDescriptor,d=(o,e,n,s)=>{for(var a=s>1?void 0:s?p(e,n):e,r=o.length-1,i;r>=0;r--)(i=o[r])&&(a=(s?i(e,n,a):i(a))||a);return s&&a&&c(e,n,a),a};exports.PdExpandableCard=class extends l.LitElement{constructor(){super(...arguments),this.variant="elevated",this.expanded=!1,this.expandIcon="keyboard_arrow_down",this.collapseIcon="keyboard_arrow_up",this.headerClickable=!1,this._expanded=!1}connectedCallback(){super.connectedCallback(),this._expanded=this.expanded}toggle(){this._expanded=!this._expanded,this._dispatchExpandEvent()}expand(){this._expanded||(this._expanded=!0,this._dispatchExpandEvent())}collapse(){this._expanded&&(this._expanded=!1,this._dispatchExpandEvent())}_dispatchExpandEvent(){const e=this._expanded?"expand":"collapse";this.dispatchEvent(new CustomEvent(e,{detail:{expanded:this._expanded},bubbles:!0,composed:!0}))}_handleToggle(){this.toggle()}_handleHeaderClick(e){this.headerClickable&&(e.target.closest("md-icon-button")||this.toggle())}render(){const e=`card ${this.variant}`;return l.html`
|
|
2
|
+
<div class="${e}">
|
|
3
|
+
<div
|
|
4
|
+
class="header ${this.headerClickable?"clickable":""}"
|
|
5
|
+
@click=${this._handleHeaderClick}
|
|
6
|
+
>
|
|
7
|
+
<div class="header-content">
|
|
8
|
+
<slot name="header"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
<md-icon-button
|
|
11
|
+
class="expand-button"
|
|
12
|
+
@click=${this._handleToggle}
|
|
13
|
+
aria-label=${this._expanded?"Collapse":"Expand"}
|
|
14
|
+
>
|
|
15
|
+
<md-icon class="expand-icon ${this._expanded?"expanded":""}">${this.expandIcon}</md-icon>
|
|
16
|
+
</md-icon-button>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div class="content ${this._expanded?"expanded":"collapsed"}">
|
|
20
|
+
<div class="content-inner">
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
`}};exports.PdExpandableCard.styles=l.css`
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
font-family: var(--md-sys-typescale-body-large-font, 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.card {
|
|
32
|
+
border-radius: var(--md-sys-shape-corner-small, 12px);
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
transition: all var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-standard, ease);
|
|
35
|
+
position: relative;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.card.elevated {
|
|
39
|
+
background: var(--md-sys-color-surface, #ffffff);
|
|
40
|
+
color: var(--md-sys-color-on-surface, #000000);
|
|
41
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.card.filled {
|
|
45
|
+
background: var(--md-sys-color-surface-variant, #f3f3f3);
|
|
46
|
+
color: var(--md-sys-color-on-surface-variant, #000000);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.card.outlined {
|
|
50
|
+
background: var(--md-sys-color-surface, #ffffff);
|
|
51
|
+
color: var(--md-sys-color-on-surface, #000000);
|
|
52
|
+
border: 1px solid var(--md-sys-color-outline, #cccccc);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Header */
|
|
56
|
+
.header {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: space-between;
|
|
60
|
+
padding: var(--md-sys-spacing-400, 16px);
|
|
61
|
+
min-height: 48px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.header.clickable {
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
user-select: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.header.clickable:hover {
|
|
70
|
+
background: var(--md-sys-color-primary-container, rgba(103, 80, 164, 0.08));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.header-content {
|
|
74
|
+
flex: 1;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: var(--md-sys-spacing-300, 12px);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Expand button */
|
|
81
|
+
.expand-button {
|
|
82
|
+
flex-shrink: 0;
|
|
83
|
+
--md-icon-button-icon-size: 24px;
|
|
84
|
+
--md-icon-button-state-layer-size: 40px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.expand-icon {
|
|
88
|
+
transition: transform var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-emphasized, ease);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.expand-icon.expanded {
|
|
92
|
+
transform: rotate(180deg);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Content */
|
|
96
|
+
.content {
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
transition: all var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-emphasized, ease);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.content.collapsed {
|
|
102
|
+
max-height: 0;
|
|
103
|
+
opacity: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.content.expanded {
|
|
107
|
+
max-height: 1000px; /* Large enough for most content */
|
|
108
|
+
opacity: 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.content-inner {
|
|
112
|
+
padding: 0 var(--md-sys-spacing-400, 16px) var(--md-sys-spacing-400, 16px);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Accessibility */
|
|
116
|
+
@media (prefers-reduced-motion: reduce) {
|
|
117
|
+
.card,
|
|
118
|
+
.expand-icon,
|
|
119
|
+
.content {
|
|
120
|
+
transition: none;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Focus styles */
|
|
125
|
+
.expand-button:focus-visible {
|
|
126
|
+
outline: 2px solid var(--md-sys-color-primary, #6750a4);
|
|
127
|
+
outline-offset: 2px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.header.clickable:focus-visible {
|
|
131
|
+
outline: 2px solid var(--md-sys-color-primary, #6750a4);
|
|
132
|
+
outline-offset: -2px;
|
|
133
|
+
}
|
|
134
|
+
`;d([t.property({type:String})],exports.PdExpandableCard.prototype,"variant",2);d([t.property({type:Boolean})],exports.PdExpandableCard.prototype,"expanded",2);d([t.property({type:String,attribute:"expand-icon"})],exports.PdExpandableCard.prototype,"expandIcon",2);d([t.property({type:String,attribute:"collapse-icon"})],exports.PdExpandableCard.prototype,"collapseIcon",2);d([t.property({type:Boolean,attribute:"header-clickable"})],exports.PdExpandableCard.prototype,"headerClickable",2);d([t.state()],exports.PdExpandableCard.prototype,"_expanded",2);exports.PdExpandableCard=d([t.customElement("pd-expandable-card")],exports.PdExpandableCard);
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { css as l, LitElement as p, html as m } from "lit";
|
|
2
|
+
import { property as o, state as x, customElement as h } from "lit/decorators.js";
|
|
3
|
+
import "@material/web/icon/icon.js";
|
|
4
|
+
import "@material/web/iconbutton/icon-button.js";
|
|
5
|
+
var v = Object.defineProperty, f = Object.getOwnPropertyDescriptor, s = (a, n, r, d) => {
|
|
6
|
+
for (var t = d > 1 ? void 0 : d ? f(n, r) : n, i = a.length - 1, c; i >= 0; i--)
|
|
7
|
+
(c = a[i]) && (t = (d ? c(n, r, t) : c(t)) || t);
|
|
8
|
+
return d && t && v(n, r, t), t;
|
|
9
|
+
};
|
|
10
|
+
let e = class extends p {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.variant = "elevated", this.expanded = !1, this.expandIcon = "keyboard_arrow_down", this.collapseIcon = "keyboard_arrow_up", this.headerClickable = !1, this._expanded = !1;
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
super.connectedCallback(), this._expanded = this.expanded;
|
|
16
|
+
}
|
|
17
|
+
/** Toggles the expanded state */
|
|
18
|
+
toggle() {
|
|
19
|
+
this._expanded = !this._expanded, this._dispatchExpandEvent();
|
|
20
|
+
}
|
|
21
|
+
/** Expands the card */
|
|
22
|
+
expand() {
|
|
23
|
+
this._expanded || (this._expanded = !0, this._dispatchExpandEvent());
|
|
24
|
+
}
|
|
25
|
+
/** Collapses the card */
|
|
26
|
+
collapse() {
|
|
27
|
+
this._expanded && (this._expanded = !1, this._dispatchExpandEvent());
|
|
28
|
+
}
|
|
29
|
+
_dispatchExpandEvent() {
|
|
30
|
+
const a = this._expanded ? "expand" : "collapse";
|
|
31
|
+
this.dispatchEvent(new CustomEvent(a, {
|
|
32
|
+
detail: { expanded: this._expanded },
|
|
33
|
+
bubbles: !0,
|
|
34
|
+
composed: !0
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
_handleToggle() {
|
|
38
|
+
this.toggle();
|
|
39
|
+
}
|
|
40
|
+
_handleHeaderClick(a) {
|
|
41
|
+
this.headerClickable && (a.target.closest("md-icon-button") || this.toggle());
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
const a = `card ${this.variant}`;
|
|
45
|
+
return m`
|
|
46
|
+
<div class="${a}">
|
|
47
|
+
<div
|
|
48
|
+
class="header ${this.headerClickable ? "clickable" : ""}"
|
|
49
|
+
@click=${this._handleHeaderClick}
|
|
50
|
+
>
|
|
51
|
+
<div class="header-content">
|
|
52
|
+
<slot name="header"></slot>
|
|
53
|
+
</div>
|
|
54
|
+
<md-icon-button
|
|
55
|
+
class="expand-button"
|
|
56
|
+
@click=${this._handleToggle}
|
|
57
|
+
aria-label=${this._expanded ? "Collapse" : "Expand"}
|
|
58
|
+
>
|
|
59
|
+
<md-icon class="expand-icon ${this._expanded ? "expanded" : ""}">${this.expandIcon}</md-icon>
|
|
60
|
+
</md-icon-button>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div class="content ${this._expanded ? "expanded" : "collapsed"}">
|
|
64
|
+
<div class="content-inner">
|
|
65
|
+
<slot></slot>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
e.styles = l`
|
|
73
|
+
:host {
|
|
74
|
+
display: block;
|
|
75
|
+
font-family: var(--md-sys-typescale-body-large-font, 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.card {
|
|
79
|
+
border-radius: var(--md-sys-shape-corner-small, 12px);
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
transition: all var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-standard, ease);
|
|
82
|
+
position: relative;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.card.elevated {
|
|
86
|
+
background: var(--md-sys-color-surface, #ffffff);
|
|
87
|
+
color: var(--md-sys-color-on-surface, #000000);
|
|
88
|
+
box-shadow: var(--md-sys-elevation-level1, 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.card.filled {
|
|
92
|
+
background: var(--md-sys-color-surface-variant, #f3f3f3);
|
|
93
|
+
color: var(--md-sys-color-on-surface-variant, #000000);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.card.outlined {
|
|
97
|
+
background: var(--md-sys-color-surface, #ffffff);
|
|
98
|
+
color: var(--md-sys-color-on-surface, #000000);
|
|
99
|
+
border: 1px solid var(--md-sys-color-outline, #cccccc);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Header */
|
|
103
|
+
.header {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
padding: var(--md-sys-spacing-400, 16px);
|
|
108
|
+
min-height: 48px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.header.clickable {
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
user-select: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.header.clickable:hover {
|
|
117
|
+
background: var(--md-sys-color-primary-container, rgba(103, 80, 164, 0.08));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.header-content {
|
|
121
|
+
flex: 1;
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
gap: var(--md-sys-spacing-300, 12px);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Expand button */
|
|
128
|
+
.expand-button {
|
|
129
|
+
flex-shrink: 0;
|
|
130
|
+
--md-icon-button-icon-size: 24px;
|
|
131
|
+
--md-icon-button-state-layer-size: 40px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.expand-icon {
|
|
135
|
+
transition: transform var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-emphasized, ease);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.expand-icon.expanded {
|
|
139
|
+
transform: rotate(180deg);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Content */
|
|
143
|
+
.content {
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
transition: all var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-emphasized, ease);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.content.collapsed {
|
|
149
|
+
max-height: 0;
|
|
150
|
+
opacity: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.content.expanded {
|
|
154
|
+
max-height: 1000px; /* Large enough for most content */
|
|
155
|
+
opacity: 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.content-inner {
|
|
159
|
+
padding: 0 var(--md-sys-spacing-400, 16px) var(--md-sys-spacing-400, 16px);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Accessibility */
|
|
163
|
+
@media (prefers-reduced-motion: reduce) {
|
|
164
|
+
.card,
|
|
165
|
+
.expand-icon,
|
|
166
|
+
.content {
|
|
167
|
+
transition: none;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Focus styles */
|
|
172
|
+
.expand-button:focus-visible {
|
|
173
|
+
outline: 2px solid var(--md-sys-color-primary, #6750a4);
|
|
174
|
+
outline-offset: 2px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.header.clickable:focus-visible {
|
|
178
|
+
outline: 2px solid var(--md-sys-color-primary, #6750a4);
|
|
179
|
+
outline-offset: -2px;
|
|
180
|
+
}
|
|
181
|
+
`;
|
|
182
|
+
s([
|
|
183
|
+
o({ type: String })
|
|
184
|
+
], e.prototype, "variant", 2);
|
|
185
|
+
s([
|
|
186
|
+
o({ type: Boolean })
|
|
187
|
+
], e.prototype, "expanded", 2);
|
|
188
|
+
s([
|
|
189
|
+
o({ type: String, attribute: "expand-icon" })
|
|
190
|
+
], e.prototype, "expandIcon", 2);
|
|
191
|
+
s([
|
|
192
|
+
o({ type: String, attribute: "collapse-icon" })
|
|
193
|
+
], e.prototype, "collapseIcon", 2);
|
|
194
|
+
s([
|
|
195
|
+
o({ type: Boolean, attribute: "header-clickable" })
|
|
196
|
+
], e.prototype, "headerClickable", 2);
|
|
197
|
+
s([
|
|
198
|
+
x()
|
|
199
|
+
], e.prototype, "_expanded", 2);
|
|
200
|
+
e = s([
|
|
201
|
+
h("pd-expandable-card")
|
|
202
|
+
], e);
|
|
203
|
+
export {
|
|
204
|
+
e as PdExpandableCard
|
|
205
|
+
};
|