@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,72 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("lit"),r=require("lit/decorators.js");require("@material/web/progress/circular-progress.js");require("@material/web/progress/linear-progress.js");var n=Object.defineProperty,c=Object.getOwnPropertyDescriptor,e=(a,t,p,i)=>{for(var s=i>1?void 0:i?c(t,p):t,l=a.length-1,d;l>=0;l--)(d=a[l])&&(s=(i?d(t,p,s):d(s))||s);return i&&s&&n(t,p,s),s};exports.PdProgress=class extends o.LitElement{constructor(){super(...arguments),this.type="linear",this.max=1,this.indeterminate=!1,this.visible=!0,this.size="medium",this.ariaLabel=""}render(){return this.type==="circular"?o.html`
|
|
2
|
+
<md-circular-progress
|
|
3
|
+
.value=${this.indeterminate?void 0:this.value}
|
|
4
|
+
?indeterminate=${this.indeterminate}
|
|
5
|
+
aria-label=${this.ariaLabel||"Progress indicator"}
|
|
6
|
+
></md-circular-progress>
|
|
7
|
+
`:o.html`
|
|
8
|
+
<md-linear-progress
|
|
9
|
+
.value=${this.indeterminate?void 0:this.value}
|
|
10
|
+
.max=${this.max}
|
|
11
|
+
.buffer=${this.buffer}
|
|
12
|
+
?indeterminate=${this.indeterminate}
|
|
13
|
+
aria-label=${this.ariaLabel||"Progress indicator"}
|
|
14
|
+
></md-linear-progress>
|
|
15
|
+
`}};exports.PdProgress.styles=o.css`
|
|
16
|
+
:host {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([type="linear"]) {
|
|
21
|
+
display: block;
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([type="circular"]) {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
md-linear-progress {
|
|
32
|
+
width: 100%;
|
|
33
|
+
/* Apply Prioticket design system tokens */
|
|
34
|
+
--md-linear-progress-active-indicator-color: var(--md-sys-color-primary);
|
|
35
|
+
--md-linear-progress-track-color: var(--md-sys-color-outline-variant);
|
|
36
|
+
--md-linear-progress-active-indicator-height: 4px;
|
|
37
|
+
--md-linear-progress-track-height: 4px;
|
|
38
|
+
--md-linear-progress-track-shape: var(--md-sys-shape-corner-full);
|
|
39
|
+
|
|
40
|
+
/* Buffer progress styling */
|
|
41
|
+
--md-linear-progress-buffer-color: var(--md-sys-color-surface-container-high);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
md-circular-progress {
|
|
45
|
+
/* Apply Prioticket design system tokens */
|
|
46
|
+
--md-circular-progress-color: var(--md-sys-color-primary);
|
|
47
|
+
--md-circular-progress-active-indicator-color: var(--md-sys-color-primary);
|
|
48
|
+
--md-circular-progress-size: var(--pd-progress-size, 48px);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Size variants for circular progress */
|
|
52
|
+
:host([size="small"]) md-circular-progress {
|
|
53
|
+
--md-circular-progress-size: 24px;
|
|
54
|
+
--pd-progress-size: 24px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([size="medium"]) md-circular-progress {
|
|
58
|
+
--md-circular-progress-size: 48px;
|
|
59
|
+
--pd-progress-size: 48px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([size="large"]) md-circular-progress {
|
|
63
|
+
--md-circular-progress-size: 64px;
|
|
64
|
+
--pd-progress-size: 64px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Hidden state */
|
|
68
|
+
:host([hidden]),
|
|
69
|
+
:host(:not([visible])) {
|
|
70
|
+
display: none !important;
|
|
71
|
+
}
|
|
72
|
+
`;e([r.property({type:String})],exports.PdProgress.prototype,"type",2);e([r.property({type:Number})],exports.PdProgress.prototype,"value",2);e([r.property({type:Number})],exports.PdProgress.prototype,"max",2);e([r.property({type:Number})],exports.PdProgress.prototype,"buffer",2);e([r.property({type:Boolean})],exports.PdProgress.prototype,"indeterminate",2);e([r.property({type:Boolean,reflect:!0})],exports.PdProgress.prototype,"visible",2);e([r.property({type:String})],exports.PdProgress.prototype,"size",2);e([r.property({type:String,attribute:"aria-label"})],exports.PdProgress.prototype,"ariaLabel",2);exports.PdProgress=e([r.customElement("pd-progress")],exports.PdProgress);
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { css as m, LitElement as d, html as c } from "lit";
|
|
2
|
+
import { property as s, customElement as u } from "lit/decorators.js";
|
|
3
|
+
import "@material/web/progress/circular-progress.js";
|
|
4
|
+
import "@material/web/progress/linear-progress.js";
|
|
5
|
+
var g = Object.defineProperty, y = Object.getOwnPropertyDescriptor, e = (n, t, a, o) => {
|
|
6
|
+
for (var i = o > 1 ? void 0 : o ? y(t, a) : t, p = n.length - 1, l; p >= 0; p--)
|
|
7
|
+
(l = n[p]) && (i = (o ? l(t, a, i) : l(i)) || i);
|
|
8
|
+
return o && i && g(t, a, i), i;
|
|
9
|
+
};
|
|
10
|
+
let r = class extends d {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.type = "linear", this.max = 1, this.indeterminate = !1, this.visible = !0, this.size = "medium", this.ariaLabel = "";
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return this.type === "circular" ? c`
|
|
16
|
+
<md-circular-progress
|
|
17
|
+
.value=${this.indeterminate ? void 0 : this.value}
|
|
18
|
+
?indeterminate=${this.indeterminate}
|
|
19
|
+
aria-label=${this.ariaLabel || "Progress indicator"}
|
|
20
|
+
></md-circular-progress>
|
|
21
|
+
` : c`
|
|
22
|
+
<md-linear-progress
|
|
23
|
+
.value=${this.indeterminate ? void 0 : this.value}
|
|
24
|
+
.max=${this.max}
|
|
25
|
+
.buffer=${this.buffer}
|
|
26
|
+
?indeterminate=${this.indeterminate}
|
|
27
|
+
aria-label=${this.ariaLabel || "Progress indicator"}
|
|
28
|
+
></md-linear-progress>
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
r.styles = m`
|
|
33
|
+
:host {
|
|
34
|
+
display: inline-block;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([type="linear"]) {
|
|
38
|
+
display: block;
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([type="circular"]) {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
md-linear-progress {
|
|
49
|
+
width: 100%;
|
|
50
|
+
/* Apply Prioticket design system tokens */
|
|
51
|
+
--md-linear-progress-active-indicator-color: var(--md-sys-color-primary);
|
|
52
|
+
--md-linear-progress-track-color: var(--md-sys-color-outline-variant);
|
|
53
|
+
--md-linear-progress-active-indicator-height: 4px;
|
|
54
|
+
--md-linear-progress-track-height: 4px;
|
|
55
|
+
--md-linear-progress-track-shape: var(--md-sys-shape-corner-full);
|
|
56
|
+
|
|
57
|
+
/* Buffer progress styling */
|
|
58
|
+
--md-linear-progress-buffer-color: var(--md-sys-color-surface-container-high);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
md-circular-progress {
|
|
62
|
+
/* Apply Prioticket design system tokens */
|
|
63
|
+
--md-circular-progress-color: var(--md-sys-color-primary);
|
|
64
|
+
--md-circular-progress-active-indicator-color: var(--md-sys-color-primary);
|
|
65
|
+
--md-circular-progress-size: var(--pd-progress-size, 48px);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Size variants for circular progress */
|
|
69
|
+
:host([size="small"]) md-circular-progress {
|
|
70
|
+
--md-circular-progress-size: 24px;
|
|
71
|
+
--pd-progress-size: 24px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:host([size="medium"]) md-circular-progress {
|
|
75
|
+
--md-circular-progress-size: 48px;
|
|
76
|
+
--pd-progress-size: 48px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([size="large"]) md-circular-progress {
|
|
80
|
+
--md-circular-progress-size: 64px;
|
|
81
|
+
--pd-progress-size: 64px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Hidden state */
|
|
85
|
+
:host([hidden]),
|
|
86
|
+
:host(:not([visible])) {
|
|
87
|
+
display: none !important;
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
e([
|
|
91
|
+
s({ type: String })
|
|
92
|
+
], r.prototype, "type", 2);
|
|
93
|
+
e([
|
|
94
|
+
s({ type: Number })
|
|
95
|
+
], r.prototype, "value", 2);
|
|
96
|
+
e([
|
|
97
|
+
s({ type: Number })
|
|
98
|
+
], r.prototype, "max", 2);
|
|
99
|
+
e([
|
|
100
|
+
s({ type: Number })
|
|
101
|
+
], r.prototype, "buffer", 2);
|
|
102
|
+
e([
|
|
103
|
+
s({ type: Boolean })
|
|
104
|
+
], r.prototype, "indeterminate", 2);
|
|
105
|
+
e([
|
|
106
|
+
s({ type: Boolean, reflect: !0 })
|
|
107
|
+
], r.prototype, "visible", 2);
|
|
108
|
+
e([
|
|
109
|
+
s({ type: String })
|
|
110
|
+
], r.prototype, "size", 2);
|
|
111
|
+
e([
|
|
112
|
+
s({ type: String, attribute: "aria-label" })
|
|
113
|
+
], r.prototype, "ariaLabel", 2);
|
|
114
|
+
r = e([
|
|
115
|
+
u("pd-progress")
|
|
116
|
+
], r);
|
|
117
|
+
export {
|
|
118
|
+
r as PdProgress
|
|
119
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lit"),e=require("lit/decorators.js");require("@material/web/radio/radio.js");var u=Object.defineProperty,n=Object.getOwnPropertyDescriptor,t=(l,a,r,i)=>{for(var d=i>1?void 0:i?n(a,r):a,o=l.length-1,p;o>=0;o--)(p=l[o])&&(d=(i?p(a,r,d):p(d))||d);return i&&d&&u(a,r,d),d};exports.PdRadio=class extends s.LitElement{constructor(){super(...arguments),this.checked=!1,this.disabled=!1,this.name="",this.value="",this.ariaLabel="",this.ariaDescribedby="",this.required=!1}render(){return s.html`
|
|
2
|
+
<md-radio
|
|
3
|
+
?checked=${this.checked}
|
|
4
|
+
?disabled=${this.disabled}
|
|
5
|
+
name=${this.name}
|
|
6
|
+
value=${this.value}
|
|
7
|
+
aria-label=${this.ariaLabel}
|
|
8
|
+
aria-describedby=${this.ariaDescribedby}
|
|
9
|
+
?required=${this.required}
|
|
10
|
+
@change=${this.handleChange}
|
|
11
|
+
@input=${this.handleInput}
|
|
12
|
+
></md-radio>
|
|
13
|
+
`}handleChange(a){const r=a.target;this.checked=r.checked,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked,value:this.value}}))}handleInput(a){const r=a.target;this.checked=r.checked,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{checked:this.checked,value:this.value}}))}};t([e.query("md-radio")],exports.PdRadio.prototype,"radio",2);t([e.property({type:Boolean,reflect:!0})],exports.PdRadio.prototype,"checked",2);t([e.property({type:Boolean,reflect:!0})],exports.PdRadio.prototype,"disabled",2);t([e.property({type:String})],exports.PdRadio.prototype,"name",2);t([e.property({type:String})],exports.PdRadio.prototype,"value",2);t([e.property({type:String,attribute:"aria-label"})],exports.PdRadio.prototype,"ariaLabel",2);t([e.property({type:String,attribute:"aria-describedby"})],exports.PdRadio.prototype,"ariaDescribedby",2);t([e.property({type:Boolean})],exports.PdRadio.prototype,"required",2);exports.PdRadio=t([e.customElement("pd-radio")],exports.PdRadio);exports.PdRadioGroup=class extends s.LitElement{constructor(){super(...arguments),this.name="",this.value="",this.disabled=!1,this.required=!1,this.ariaLabel="",this.ariaLabelledby=""}render(){return s.html`
|
|
14
|
+
<div
|
|
15
|
+
role="radiogroup"
|
|
16
|
+
aria-label=${this.ariaLabel}
|
|
17
|
+
aria-labelledby=${this.ariaLabelledby}
|
|
18
|
+
aria-required=${this.required?"true":"false"}
|
|
19
|
+
@change=${this.handleChange}
|
|
20
|
+
>
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</div>
|
|
23
|
+
`}firstUpdated(){this.updateRadioButtons()}updated(a){(a.has("name")||a.has("value")||a.has("disabled"))&&this.updateRadioButtons()}updateRadioButtons(){this.querySelectorAll("pd-radio").forEach(r=>{const i=r;this.name&&(i.name=this.name),i.disabled=this.disabled||i.disabled,i.checked=i.value===this.value,i.required=this.required})}handleChange(a){const r=a.target;r.checked&&(this.value=r.value,this.querySelectorAll("pd-radio").forEach(d=>{const o=d;o!==r&&o.name===r.name&&(o.checked=!1)}),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}})))}};exports.PdRadioGroup.styles=s.css`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
div[role="radiogroup"] {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([disabled]) {
|
|
35
|
+
opacity: 0.6;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
`;t([e.property({type:String})],exports.PdRadioGroup.prototype,"name",2);t([e.property({type:String})],exports.PdRadioGroup.prototype,"value",2);t([e.property({type:Boolean,reflect:!0})],exports.PdRadioGroup.prototype,"disabled",2);t([e.property({type:Boolean})],exports.PdRadioGroup.prototype,"required",2);t([e.property({type:String,attribute:"aria-label"})],exports.PdRadioGroup.prototype,"ariaLabel",2);t([e.property({type:String,attribute:"aria-labelledby"})],exports.PdRadioGroup.prototype,"ariaLabelledby",2);exports.PdRadioGroup=t([e.customElement("pd-radio-group")],exports.PdRadioGroup);
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { css as b, LitElement as p, html as u } from "lit";
|
|
2
|
+
import { query as y, property as i, customElement as c } from "lit/decorators.js";
|
|
3
|
+
import "@material/web/radio/radio.js";
|
|
4
|
+
var m = Object.defineProperty, v = Object.getOwnPropertyDescriptor, e = (a, t, r, l) => {
|
|
5
|
+
for (var s = l > 1 ? void 0 : l ? v(t, r) : t, h = a.length - 1, n; h >= 0; h--)
|
|
6
|
+
(n = a[h]) && (s = (l ? n(t, r, s) : n(s)) || s);
|
|
7
|
+
return l && s && m(t, r, s), s;
|
|
8
|
+
};
|
|
9
|
+
let d = class extends p {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.checked = !1, this.disabled = !1, this.name = "", this.value = "", this.ariaLabel = "", this.ariaDescribedby = "", this.required = !1;
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
return u`
|
|
15
|
+
<md-radio
|
|
16
|
+
?checked=${this.checked}
|
|
17
|
+
?disabled=${this.disabled}
|
|
18
|
+
name=${this.name}
|
|
19
|
+
value=${this.value}
|
|
20
|
+
aria-label=${this.ariaLabel}
|
|
21
|
+
aria-describedby=${this.ariaDescribedby}
|
|
22
|
+
?required=${this.required}
|
|
23
|
+
@change=${this.handleChange}
|
|
24
|
+
@input=${this.handleInput}
|
|
25
|
+
></md-radio>
|
|
26
|
+
`;
|
|
27
|
+
}
|
|
28
|
+
handleChange(a) {
|
|
29
|
+
const t = a.target;
|
|
30
|
+
this.checked = t.checked, this.dispatchEvent(new CustomEvent("change", {
|
|
31
|
+
bubbles: !0,
|
|
32
|
+
composed: !0,
|
|
33
|
+
detail: { checked: this.checked, value: this.value }
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
handleInput(a) {
|
|
37
|
+
const t = a.target;
|
|
38
|
+
this.checked = t.checked, this.dispatchEvent(new CustomEvent("input", {
|
|
39
|
+
bubbles: !0,
|
|
40
|
+
composed: !0,
|
|
41
|
+
detail: { checked: this.checked, value: this.value }
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
e([
|
|
46
|
+
y("md-radio")
|
|
47
|
+
], d.prototype, "radio", 2);
|
|
48
|
+
e([
|
|
49
|
+
i({ type: Boolean, reflect: !0 })
|
|
50
|
+
], d.prototype, "checked", 2);
|
|
51
|
+
e([
|
|
52
|
+
i({ type: Boolean, reflect: !0 })
|
|
53
|
+
], d.prototype, "disabled", 2);
|
|
54
|
+
e([
|
|
55
|
+
i({ type: String })
|
|
56
|
+
], d.prototype, "name", 2);
|
|
57
|
+
e([
|
|
58
|
+
i({ type: String })
|
|
59
|
+
], d.prototype, "value", 2);
|
|
60
|
+
e([
|
|
61
|
+
i({ type: String, attribute: "aria-label" })
|
|
62
|
+
], d.prototype, "ariaLabel", 2);
|
|
63
|
+
e([
|
|
64
|
+
i({ type: String, attribute: "aria-describedby" })
|
|
65
|
+
], d.prototype, "ariaDescribedby", 2);
|
|
66
|
+
e([
|
|
67
|
+
i({ type: Boolean })
|
|
68
|
+
], d.prototype, "required", 2);
|
|
69
|
+
d = e([
|
|
70
|
+
c("pd-radio")
|
|
71
|
+
], d);
|
|
72
|
+
let o = class extends p {
|
|
73
|
+
constructor() {
|
|
74
|
+
super(...arguments), this.name = "", this.value = "", this.disabled = !1, this.required = !1, this.ariaLabel = "", this.ariaLabelledby = "";
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
return u`
|
|
78
|
+
<div
|
|
79
|
+
role="radiogroup"
|
|
80
|
+
aria-label=${this.ariaLabel}
|
|
81
|
+
aria-labelledby=${this.ariaLabelledby}
|
|
82
|
+
aria-required=${this.required ? "true" : "false"}
|
|
83
|
+
@change=${this.handleChange}
|
|
84
|
+
>
|
|
85
|
+
<slot></slot>
|
|
86
|
+
</div>
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
firstUpdated() {
|
|
90
|
+
this.updateRadioButtons();
|
|
91
|
+
}
|
|
92
|
+
updated(a) {
|
|
93
|
+
(a.has("name") || a.has("value") || a.has("disabled")) && this.updateRadioButtons();
|
|
94
|
+
}
|
|
95
|
+
updateRadioButtons() {
|
|
96
|
+
this.querySelectorAll("pd-radio").forEach((t) => {
|
|
97
|
+
const r = t;
|
|
98
|
+
this.name && (r.name = this.name), r.disabled = this.disabled || r.disabled, r.checked = r.value === this.value, r.required = this.required;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
handleChange(a) {
|
|
102
|
+
const t = a.target;
|
|
103
|
+
t.checked && (this.value = t.value, this.querySelectorAll("pd-radio").forEach((l) => {
|
|
104
|
+
const s = l;
|
|
105
|
+
s !== t && s.name === t.name && (s.checked = !1);
|
|
106
|
+
}), this.dispatchEvent(new CustomEvent("change", {
|
|
107
|
+
bubbles: !0,
|
|
108
|
+
composed: !0,
|
|
109
|
+
detail: { value: this.value }
|
|
110
|
+
})));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
o.styles = b`
|
|
114
|
+
:host {
|
|
115
|
+
display: block;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
div[role="radiogroup"] {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
gap: 8px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:host([disabled]) {
|
|
125
|
+
opacity: 0.6;
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
e([
|
|
130
|
+
i({ type: String })
|
|
131
|
+
], o.prototype, "name", 2);
|
|
132
|
+
e([
|
|
133
|
+
i({ type: String })
|
|
134
|
+
], o.prototype, "value", 2);
|
|
135
|
+
e([
|
|
136
|
+
i({ type: Boolean, reflect: !0 })
|
|
137
|
+
], o.prototype, "disabled", 2);
|
|
138
|
+
e([
|
|
139
|
+
i({ type: Boolean })
|
|
140
|
+
], o.prototype, "required", 2);
|
|
141
|
+
e([
|
|
142
|
+
i({ type: String, attribute: "aria-label" })
|
|
143
|
+
], o.prototype, "ariaLabel", 2);
|
|
144
|
+
e([
|
|
145
|
+
i({ type: String, attribute: "aria-labelledby" })
|
|
146
|
+
], o.prototype, "ariaLabelledby", 2);
|
|
147
|
+
o = e([
|
|
148
|
+
c("pd-radio-group")
|
|
149
|
+
], o);
|
|
150
|
+
export {
|
|
151
|
+
d as PdRadio,
|
|
152
|
+
o as PdRadioGroup
|
|
153
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("lit"),s=require("lit/decorators.js");require("@material/web/icon/icon.js");var c=Object.defineProperty,m=Object.getOwnPropertyDescriptor,n=(d,r,e,t)=>{for(var o=t>1?void 0:t?m(r,e):r,i=d.length-1,a;i>=0;i--)(a=d[i])&&(o=(t?a(r,e,o):a(o))||o);return t&&o&&c(r,e,o),o};exports.PdSegmentedButton=class extends l.LitElement{constructor(){super(...arguments),this.multiSelect=!1,this.size="medium",this.disabled=!1,this.selectedValues=[],this._segments=[]}connectedCallback(){super.connectedCallback(),this.addEventListener("segment-click",this._handleSegmentClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("segment-click",this._handleSegmentClick)}firstUpdated(){this._updateSegments()}_updateSegments(){const r=this.querySelectorAll("pd-segment-item");this._segments=Array.from(r),this._segments.forEach((e,t)=>{e.disabled=this.disabled||e.disabled,e.setAttribute("data-segment-index",t.toString()),this.selectedValues.includes(e.value)&&(e.selected=!0)})}_handleSegmentClick(r){if(this.disabled)return;const e=r.target,t=e.value;this.multiSelect?this.selectedValues.indexOf(t)>-1?(this.selectedValues=this.selectedValues.filter(i=>i!==t),e.selected=!1):(this.selectedValues=[...this.selectedValues,t],e.selected=!0):this.selectedValues[0]===t?(this.selectedValues=[],e.selected=!1):(this._segments.forEach(o=>o.selected=!1),this.selectedValues=[t],e.selected=!0),this.dispatchEvent(new CustomEvent("selectionchange",{detail:{selectedValues:this.selectedValues,multiSelect:this.multiSelect},bubbles:!0,composed:!0}))}render(){return l.html`
|
|
2
|
+
<div class="segmented-button" role="group">
|
|
3
|
+
<slot @slotchange=${this._updateSegments}></slot>
|
|
4
|
+
</div>
|
|
5
|
+
`}};exports.PdSegmentedButton.styles=l.css`
|
|
6
|
+
:host {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
font-family: var(--md-sys-typescale-body-large-font, 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.segmented-button {
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
border-radius: var(--md-segmented-button-shape, var(--md-sys-shape-corner-small, 20px));
|
|
14
|
+
border: 1px solid var(--md-sys-color-outline, #79747e);
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
background: var(--md-sys-color-surface, #fef7ff);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host([disabled]) .segmented-button {
|
|
20
|
+
border-color: var(--md-sys-color-on-surface-opacity-12, rgba(29, 27, 32, 0.12));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Size variants */
|
|
24
|
+
:host([size='small']) {
|
|
25
|
+
--md-segmented-button-container-height: var(--md-sys-button-container-height-small, 2rem);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([size='medium']) {
|
|
29
|
+
--md-segmented-button-container-height: var(--md-sys-button-container-height-medium, 2.5rem);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([size='large']) {
|
|
33
|
+
--md-segmented-button-container-height: var(--md-sys-button-container-height-large, 3rem);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
::slotted(pd-segment-item) {
|
|
37
|
+
border-right: 1px solid var(--md-sys-color-outline, #79747e);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
::slotted(pd-segment-item:last-child) {
|
|
41
|
+
border-right: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([disabled]) ::slotted(pd-segment-item) {
|
|
45
|
+
border-right-color: var(--md-sys-color-on-surface-opacity-12, rgba(29, 27, 32, 0.12));
|
|
46
|
+
}
|
|
47
|
+
`;n([s.property({type:Boolean,attribute:"multi-select"})],exports.PdSegmentedButton.prototype,"multiSelect",2);n([s.property({type:String,reflect:!0})],exports.PdSegmentedButton.prototype,"size",2);n([s.property({type:Boolean,reflect:!0})],exports.PdSegmentedButton.prototype,"disabled",2);n([s.property({type:Array})],exports.PdSegmentedButton.prototype,"selectedValues",2);n([s.state()],exports.PdSegmentedButton.prototype,"_segments",2);exports.PdSegmentedButton=n([s.customElement("pd-segmented-button")],exports.PdSegmentedButton);exports.PdSegmentItem=class extends l.LitElement{constructor(){super(...arguments),this.value="",this.selected=!1,this.disabled=!1,this.icon="",this.iconOnly=!1}_handleClick(){this.disabled||this.dispatchEvent(new CustomEvent("segment-click",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){return l.html`
|
|
48
|
+
<button
|
|
49
|
+
class="segment ${this.selected?"selected":""} ${this.iconOnly?"icon-only":""}"
|
|
50
|
+
?disabled=${this.disabled}
|
|
51
|
+
@click=${this._handleClick}
|
|
52
|
+
aria-pressed=${this.selected}
|
|
53
|
+
>
|
|
54
|
+
${this.icon?l.html`<md-icon class="segment-icon">${this.icon}</md-icon>`:""}
|
|
55
|
+
${this.iconOnly?"":l.html`<span class="segment-label"><slot></slot></span>`}
|
|
56
|
+
</button>
|
|
57
|
+
`}};exports.PdSegmentItem.styles=l.css`
|
|
58
|
+
:host {
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.segment {
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
gap: var(--md-sys-spacing-200, 8px);
|
|
67
|
+
padding: 0 var(--md-sys-spacing-400, 16px);
|
|
68
|
+
height: var(--md-segmented-button-container-height, 2.5rem);
|
|
69
|
+
border: none;
|
|
70
|
+
background: transparent;
|
|
71
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
72
|
+
font-family: inherit;
|
|
73
|
+
font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
|
|
74
|
+
font-weight: var(--md-sys-typescale-label-large-weight, 500);
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
transition: all 150ms ease-in-out;
|
|
77
|
+
position: relative;
|
|
78
|
+
outline: none;
|
|
79
|
+
min-width: 48px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.segment.icon-only {
|
|
83
|
+
padding: 0;
|
|
84
|
+
width: var(--md-segmented-button-container-height, 2.5rem);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.segment:hover:not(:disabled) {
|
|
88
|
+
background: var(--md-sys-color-on-surface-opacity-08, rgba(29, 27, 32, 0.08));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.segment:focus-visible {
|
|
92
|
+
background: var(--md-sys-color-on-surface-opacity-12, rgba(29, 27, 32, 0.12));
|
|
93
|
+
outline: 2px solid var(--md-sys-color-primary, #6750a4);
|
|
94
|
+
outline-offset: -2px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.segment:active:not(:disabled) {
|
|
98
|
+
background: var(--md-sys-color-on-surface-opacity-12, rgba(29, 27, 32, 0.12));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.segment.selected {
|
|
102
|
+
background: var(--md-sys-color-secondary-container, #e8def8);
|
|
103
|
+
color: var(--md-sys-color-on-secondary-container, #1d192b);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.segment.selected:hover:not(:disabled) {
|
|
107
|
+
background: var(--md-sys-color-secondary-container, #e8def8);
|
|
108
|
+
filter: brightness(0.95);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.segment:disabled {
|
|
112
|
+
color: var(--md-sys-color-on-surface-opacity-38, rgba(29, 27, 32, 0.38));
|
|
113
|
+
cursor: not-allowed;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.segment.selected:disabled {
|
|
117
|
+
background: var(--md-sys-color-on-surface-opacity-12, rgba(29, 27, 32, 0.12));
|
|
118
|
+
color: var(--md-sys-color-on-surface-opacity-38, rgba(29, 27, 32, 0.38));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.segment-icon {
|
|
122
|
+
--md-icon-size: 18px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.segment-label {
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Accessibility */
|
|
130
|
+
@media (prefers-reduced-motion: reduce) {
|
|
131
|
+
.segment {
|
|
132
|
+
transition: none;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
`;n([s.property({type:String})],exports.PdSegmentItem.prototype,"value",2);n([s.property({type:Boolean,reflect:!0})],exports.PdSegmentItem.prototype,"selected",2);n([s.property({type:Boolean,reflect:!0})],exports.PdSegmentItem.prototype,"disabled",2);n([s.property({type:String})],exports.PdSegmentItem.prototype,"icon",2);n([s.property({type:Boolean,attribute:"icon-only"})],exports.PdSegmentItem.prototype,"iconOnly",2);exports.PdSegmentItem=n([s.customElement("pd-segment-item")],exports.PdSegmentItem);
|