@ptcwebops/ptcw-design 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/icon-asset_13.cjs.entry.js +758 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ptc-accordion-item.cjs.entry.js +110 -0
- package/dist/cjs/ptc-accordion.cjs.entry.js +49 -0
- package/dist/cjs/ptc-announcement.cjs.entry.js +48 -0
- package/dist/cjs/{ptc-announcement_2.cjs.entry.js → ptc-svg-btn.cjs.entry.js} +0 -42
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/icon-asset/media/designer.svg +11 -0
- package/dist/collection/components/ptc-accordion/ptc-accordion-item/ptc-accordion-item.css +74 -0
- package/dist/collection/components/ptc-accordion/ptc-accordion-item/ptc-accordion-item.js +296 -0
- package/dist/collection/components/ptc-accordion/ptc-accordion.css +8 -0
- package/dist/collection/components/ptc-accordion/ptc-accordion.js +74 -0
- package/dist/collection/components/ptc-checkbox/ptc-checkbox.css +46 -13
- package/dist/collection/components/ptc-checkbox/ptc-checkbox.js +58 -20
- package/dist/collection/components/ptc-container/ptc-container.css +24 -1
- package/dist/collection/components/ptc-container/ptc-container.js +22 -1
- package/dist/collection/components/ptc-dropdown/ptc-dropdown.css +66 -0
- package/dist/collection/components/ptc-dropdown/ptc-dropdown.js +144 -0
- package/dist/collection/components/ptc-filter-tag/ptc-filter-tag.css +67 -14
- package/dist/collection/components/ptc-filter-tag/ptc-filter-tag.js +24 -50
- package/dist/collection/components/ptc-icon-minimize/ptc-icon-minimize.css +37 -0
- package/dist/collection/components/ptc-icon-minimize/ptc-icon-minimize.js +86 -0
- package/dist/collection/components/ptc-link/ptc-link.css +18 -0
- package/dist/collection/components/ptc-link/ptc-link.js +2 -2
- package/dist/collection/components/ptc-modal/ptc-modal.css +37 -0
- package/dist/collection/components/ptc-modal/ptc-modal.js +93 -11
- package/dist/collection/components/ptc-shopping-cart/ptc-shopping-cart.css +10 -5
- package/dist/collection/components/ptc-shopping-cart/ptc-shopping-cart.js +30 -8
- package/dist/collection/components/ptc-title/ptc-title.css +67 -35
- package/dist/collection/components/ptc-title/ptc-title.js +11 -2
- package/dist/collection/media/svg-imgs/check-mark.svg +3 -0
- package/dist/collection/media/svg-imgs/union.svg +3 -0
- package/dist/collection/utils/component.js +3 -0
- package/dist/custom-elements/index.d.ts +24 -0
- package/dist/custom-elements/index.js +398 -46
- package/dist/esm/dropdown-item.entry.js +1 -1
- package/dist/esm/icon-asset_13.entry.js +742 -0
- package/dist/esm/{index-f64012bd.js → index-357497dc.js} +1 -1
- package/dist/esm/list-item.entry.js +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/lottie-player.entry.js +1 -1
- package/dist/esm/my-component.entry.js +1 -1
- package/dist/esm/ptc-accordion-item.entry.js +106 -0
- package/dist/esm/ptc-accordion.entry.js +45 -0
- package/dist/esm/ptc-announcement.entry.js +44 -0
- package/dist/esm/ptc-breadcrumb.entry.js +1 -1
- package/dist/esm/ptc-card-bottom.entry.js +1 -1
- package/dist/esm/ptc-card-content.entry.js +1 -1
- package/dist/esm/ptc-card-plm.entry.js +1 -1
- package/dist/esm/ptc-card.entry.js +1 -1
- package/dist/esm/ptc-date.entry.js +1 -1
- package/dist/esm/ptc-ellipsis-dropdown.entry.js +1 -1
- package/dist/esm/ptc-hero-footer-cta.entry.js +1 -1
- package/dist/esm/ptc-hero.entry.js +1 -1
- package/dist/esm/ptc-icon-list.entry.js +1 -1
- package/dist/esm/ptc-img_2.entry.js +1 -1
- package/dist/esm/ptc-list.entry.js +1 -1
- package/dist/esm/ptc-lottie.entry.js +1 -1
- package/dist/esm/ptc-minimized-footer.entry.js +1 -1
- package/dist/esm/ptc-minimized-header.entry.js +1 -1
- package/dist/esm/ptc-mobile-select.entry.js +1 -1
- package/dist/esm/ptc-nav-item.entry.js +1 -1
- package/dist/esm/ptc-nav.entry.js +1 -1
- package/dist/esm/ptc-picture.entry.js +1 -1
- package/dist/esm/ptc-previous-url.entry.js +1 -1
- package/dist/esm/ptc-pricing-block.entry.js +1 -1
- package/dist/esm/ptc-quote.entry.js +1 -1
- package/dist/esm/ptc-responsive-wrapper.entry.js +1 -1
- package/dist/esm/ptc-social-share.entry.js +1 -1
- package/dist/esm/ptc-span.entry.js +1 -1
- package/dist/esm/{ptc-announcement_2.entry.js → ptc-svg-btn.entry.js} +2 -43
- package/dist/esm/ptc-tab-list.entry.js +1 -1
- package/dist/esm/ptc-two-column-media.entry.js +1 -1
- package/dist/esm/ptcw-design.js +2 -2
- package/dist/esm/tab-content.entry.js +1 -1
- package/dist/esm/tab-header.entry.js +1 -1
- package/dist/ptcw-design/media/designer.svg +11 -0
- package/dist/ptcw-design/{p-7448f767.entry.js → p-00c1c3ec.entry.js} +1 -1
- package/dist/ptcw-design/{p-e8a60227.js → p-0e571387.js} +1 -1
- package/dist/ptcw-design/p-0f17a4f0.entry.js +1 -0
- package/dist/ptcw-design/{p-c3e79e54.entry.js → p-316d8eae.entry.js} +1 -1
- package/dist/ptcw-design/p-32ec2097.entry.js +1 -0
- package/dist/ptcw-design/p-45528270.entry.js +1 -0
- package/dist/ptcw-design/{p-3a41081a.entry.js → p-5142e9f1.entry.js} +1 -1
- package/dist/ptcw-design/{p-b79303ef.entry.js → p-525da87e.entry.js} +1 -1
- package/dist/ptcw-design/{p-8c6b8bc9.entry.js → p-59fd3cd2.entry.js} +1 -1
- package/dist/ptcw-design/{p-679b99ad.entry.js → p-6106d579.entry.js} +1 -1
- package/dist/ptcw-design/{p-18d0d10a.entry.js → p-66740e2e.entry.js} +1 -1
- package/dist/ptcw-design/{p-28174fbe.entry.js → p-689d91a7.entry.js} +1 -1
- package/dist/ptcw-design/{p-2b3a38c3.entry.js → p-68bcb24d.entry.js} +1 -1
- package/dist/ptcw-design/{p-796b4a16.entry.js → p-69581273.entry.js} +1 -1
- package/dist/ptcw-design/p-695f82bc.entry.js +1 -0
- package/dist/ptcw-design/{p-cd7119b8.entry.js → p-6ec21b76.entry.js} +1 -1
- package/dist/ptcw-design/{p-204a78ce.entry.js → p-737796bc.entry.js} +1 -1
- package/dist/ptcw-design/{p-5069bb7d.entry.js → p-74a72a40.entry.js} +1 -1
- package/dist/ptcw-design/{p-72e6a3f1.entry.js → p-7966413a.entry.js} +1 -1
- package/dist/ptcw-design/{p-1cfc77eb.entry.js → p-83277ae9.entry.js} +1 -1
- package/dist/ptcw-design/{p-c5bfb13d.entry.js → p-870d7171.entry.js} +1 -1
- package/dist/ptcw-design/{p-ee61991d.entry.js → p-91456c49.entry.js} +1 -1
- package/dist/ptcw-design/p-95f7e520.entry.js +1 -0
- package/dist/ptcw-design/{p-c13f31f6.entry.js → p-9e1fe694.entry.js} +1 -1
- package/dist/ptcw-design/{p-fe957cbf.entry.js → p-9e693f5e.entry.js} +1 -1
- package/dist/ptcw-design/{p-c5951736.entry.js → p-9ed142ce.entry.js} +1 -1
- package/dist/ptcw-design/{p-781aacb7.entry.js → p-9fe3e385.entry.js} +1 -1
- package/dist/ptcw-design/{p-0c86ac1a.entry.js → p-aa4f80c6.entry.js} +1 -1
- package/dist/ptcw-design/{p-612f7224.entry.js → p-adcbd7e1.entry.js} +1 -1
- package/dist/ptcw-design/{p-fa53e5e5.entry.js → p-beb569e6.entry.js} +1 -1
- package/dist/ptcw-design/{p-ec10f846.entry.js → p-c23a6ee1.entry.js} +1 -1
- package/dist/ptcw-design/{p-7bcc42e1.entry.js → p-cbf56b5e.entry.js} +1 -1
- package/dist/ptcw-design/p-cc18f13a.entry.js +1 -0
- package/dist/ptcw-design/{p-2a1808f8.entry.js → p-d0709a7c.entry.js} +1 -1
- package/dist/ptcw-design/{p-dbf3779e.entry.js → p-e4359c5a.entry.js} +1 -1
- package/dist/ptcw-design/{p-cec492a8.entry.js → p-ea8fa57b.entry.js} +1 -1
- package/dist/ptcw-design/{p-d64c3892.entry.js → p-ef64b508.entry.js} +1 -1
- package/dist/ptcw-design/{p-8ea08e1d.entry.js → p-f72ef3fc.entry.js} +1 -1
- package/dist/ptcw-design/{p-dc18ae76.entry.js → p-ff08fa6c.entry.js} +1 -1
- package/dist/ptcw-design/ptcw-design.css +2 -2
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/ptc-accordion/ptc-accordion-item/ptc-accordion-item.d.ts +59 -0
- package/dist/types/components/ptc-accordion/ptc-accordion.d.ts +13 -0
- package/dist/types/components/ptc-checkbox/ptc-checkbox.d.ts +6 -4
- package/dist/types/components/ptc-container/ptc-container.d.ts +1 -0
- package/dist/types/components/ptc-dropdown/ptc-dropdown.d.ts +18 -0
- package/dist/types/components/ptc-filter-tag/ptc-filter-tag.d.ts +4 -9
- package/dist/types/components/ptc-icon-minimize/ptc-icon-minimize.d.ts +9 -0
- package/dist/types/components/ptc-link/ptc-link.d.ts +1 -1
- package/dist/types/components/ptc-modal/ptc-modal.d.ts +9 -0
- package/dist/types/components/ptc-title/ptc-title.d.ts +1 -1
- package/dist/types/components.d.ts +167 -23
- package/dist/types/utils/component.d.ts +1 -0
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/cjs/icon-asset.cjs.entry.js +0 -64
- package/dist/cjs/ptc-button.cjs.entry.js +0 -76
- package/dist/cjs/ptc-checkbox.cjs.entry.js +0 -36
- package/dist/cjs/ptc-container.cjs.entry.js +0 -43
- package/dist/cjs/ptc-filter-tag.cjs.entry.js +0 -40
- package/dist/cjs/ptc-link.cjs.entry.js +0 -53
- package/dist/cjs/ptc-modal.cjs.entry.js +0 -117
- package/dist/cjs/ptc-para.cjs.entry.js +0 -50
- package/dist/cjs/ptc-shopping-cart.cjs.entry.js +0 -41
- package/dist/cjs/ptc-spacer.cjs.entry.js +0 -46
- package/dist/cjs/ptc-title.cjs.entry.js +0 -59
- package/dist/esm/icon-asset.entry.js +0 -60
- package/dist/esm/ptc-button.entry.js +0 -72
- package/dist/esm/ptc-checkbox.entry.js +0 -32
- package/dist/esm/ptc-container.entry.js +0 -39
- package/dist/esm/ptc-filter-tag.entry.js +0 -36
- package/dist/esm/ptc-link.entry.js +0 -49
- package/dist/esm/ptc-modal.entry.js +0 -113
- package/dist/esm/ptc-para.entry.js +0 -46
- package/dist/esm/ptc-shopping-cart.entry.js +0 -37
- package/dist/esm/ptc-spacer.entry.js +0 -42
- package/dist/esm/ptc-title.entry.js +0 -55
- package/dist/ptcw-design/p-279609f3.entry.js +0 -1
- package/dist/ptcw-design/p-412ca190.entry.js +0 -1
- package/dist/ptcw-design/p-49d34cb8.entry.js +0 -1
- package/dist/ptcw-design/p-7133275c.entry.js +0 -1
- package/dist/ptcw-design/p-90423b6f.entry.js +0 -1
- package/dist/ptcw-design/p-969c178b.entry.js +0 -1
- package/dist/ptcw-design/p-a9e7cd3e.entry.js +0 -1
- package/dist/ptcw-design/p-ab27089f.entry.js +0 -1
- package/dist/ptcw-design/p-b238d684.entry.js +0 -1
- package/dist/ptcw-design/p-c69933fe.entry.js +0 -1
- package/dist/ptcw-design/p-d2ef4221.entry.js +0 -1
- package/dist/ptcw-design/p-df80470b.entry.js +0 -1
- package/dist/ptcw-design/p-f32f9817.entry.js +0 -1
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { Component, Host, h, Prop, State, Element, Method, Event, } from '@stencil/core';
|
|
2
|
+
import { hasSlot } from '../../../utils/component';
|
|
3
|
+
export class PtcAccordionItem {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Heading text.
|
|
7
|
+
* This will be overwritten by `heading` slot
|
|
8
|
+
*/
|
|
9
|
+
this.heading = null;
|
|
10
|
+
/**
|
|
11
|
+
* The HTML tag to be applied to the heading text.
|
|
12
|
+
* This will be overwritten by `heading` slot
|
|
13
|
+
*/
|
|
14
|
+
this.headingTag = 'h3';
|
|
15
|
+
/**
|
|
16
|
+
* If expanded height should be automatically calculated. If set, the `--ptc-accordion-item-body-max-height` CSS variable will be set automatically to the content height
|
|
17
|
+
*/
|
|
18
|
+
this.autoHeight = false;
|
|
19
|
+
/**
|
|
20
|
+
* If the accordion item should be opened by default
|
|
21
|
+
*/
|
|
22
|
+
this.active = false;
|
|
23
|
+
this.hasHeadingSlot = true;
|
|
24
|
+
this.hasArrowSlot = true;
|
|
25
|
+
}
|
|
26
|
+
componentWillLoad() {
|
|
27
|
+
this.hasHeadingSlot = hasSlot(this.el, 'heading');
|
|
28
|
+
this.hasArrowSlot = hasSlot(this.el, 'arrow');
|
|
29
|
+
}
|
|
30
|
+
componentDidLoad() {
|
|
31
|
+
if (this.autoHeight) {
|
|
32
|
+
this.bodyEl.style.setProperty('--ptc-accordion-item-body-max-height', this.bodyEl.scrollHeight + 2 + 'px');
|
|
33
|
+
}
|
|
34
|
+
this.onTransitionEnd();
|
|
35
|
+
this.bodyEl.addEventListener('transitionstart', () => {
|
|
36
|
+
this.onTransitionStart();
|
|
37
|
+
});
|
|
38
|
+
this.bodyEl.addEventListener('transitionend', () => {
|
|
39
|
+
this.onTransitionEnd();
|
|
40
|
+
});
|
|
41
|
+
this.hasHeadingSlot = hasSlot(this.el, 'heading');
|
|
42
|
+
this.hasArrowSlot = hasSlot(this.el, 'arrow');
|
|
43
|
+
}
|
|
44
|
+
onTransitionEnd() {
|
|
45
|
+
if (this.active) {
|
|
46
|
+
this.bodyEl.style.overflow = 'auto';
|
|
47
|
+
this.opened.emit();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.bodyEl.style.overflow = 'hidden';
|
|
51
|
+
this.bodyEl.style.visibility = 'hidden';
|
|
52
|
+
this.closed.emit();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
onTransitionStart() {
|
|
56
|
+
if (this.active) {
|
|
57
|
+
this.bodyEl.style.visibility = 'visible';
|
|
58
|
+
this.opening.emit();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.closing.emit();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Toggle open state of accordion item
|
|
66
|
+
*/
|
|
67
|
+
async toggle() {
|
|
68
|
+
if (this.active) {
|
|
69
|
+
this.close();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.open();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Closes the accordion item
|
|
77
|
+
*/
|
|
78
|
+
async close() {
|
|
79
|
+
this.active = false;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Opens the accordion item.
|
|
83
|
+
*/
|
|
84
|
+
async open() {
|
|
85
|
+
this.active = true;
|
|
86
|
+
}
|
|
87
|
+
render() {
|
|
88
|
+
const { active, autoHeight, headingTag: HeadingTag } = this;
|
|
89
|
+
return (h(Host, { class: { active, autoHeight } },
|
|
90
|
+
h("button", { class: "heading", role: "button", onClick: () => this.toggle() },
|
|
91
|
+
h("span", { class: "arrow" }, this.hasArrowSlot ? (h("slot", { name: "arrow" })) : (h("svg", { focusable: "false", viewBox: "0 0 24 24", "aria-hidden": "true" },
|
|
92
|
+
h("path", { d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" })))),
|
|
93
|
+
this.hasHeadingSlot ? (h("slot", { name: "heading" })) : (h(HeadingTag, { class: "heading-text" }, this.heading))),
|
|
94
|
+
h("div", { class: "body-container", ref: el => (this.bodyEl = el) },
|
|
95
|
+
h("div", { class: "body" },
|
|
96
|
+
h("slot", null)))));
|
|
97
|
+
}
|
|
98
|
+
static get is() { return "ptc-accordion-item"; }
|
|
99
|
+
static get encapsulation() { return "shadow"; }
|
|
100
|
+
static get originalStyleUrls() { return {
|
|
101
|
+
"$": ["ptc-accordion-item.scss"]
|
|
102
|
+
}; }
|
|
103
|
+
static get styleUrls() { return {
|
|
104
|
+
"$": ["ptc-accordion-item.css"]
|
|
105
|
+
}; }
|
|
106
|
+
static get properties() { return {
|
|
107
|
+
"heading": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"mutable": false,
|
|
110
|
+
"complexType": {
|
|
111
|
+
"original": "string",
|
|
112
|
+
"resolved": "string",
|
|
113
|
+
"references": {}
|
|
114
|
+
},
|
|
115
|
+
"required": false,
|
|
116
|
+
"optional": true,
|
|
117
|
+
"docs": {
|
|
118
|
+
"tags": [],
|
|
119
|
+
"text": "Heading text.\nThis will be overwritten by `heading` slot"
|
|
120
|
+
},
|
|
121
|
+
"attribute": "heading",
|
|
122
|
+
"reflect": false,
|
|
123
|
+
"defaultValue": "null"
|
|
124
|
+
},
|
|
125
|
+
"headingTag": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"mutable": false,
|
|
128
|
+
"complexType": {
|
|
129
|
+
"original": "string",
|
|
130
|
+
"resolved": "string",
|
|
131
|
+
"references": {}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": true,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": "The HTML tag to be applied to the heading text.\nThis will be overwritten by `heading` slot"
|
|
138
|
+
},
|
|
139
|
+
"attribute": "heading-tag",
|
|
140
|
+
"reflect": false,
|
|
141
|
+
"defaultValue": "'h3'"
|
|
142
|
+
},
|
|
143
|
+
"autoHeight": {
|
|
144
|
+
"type": "boolean",
|
|
145
|
+
"mutable": false,
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "boolean",
|
|
148
|
+
"resolved": "boolean",
|
|
149
|
+
"references": {}
|
|
150
|
+
},
|
|
151
|
+
"required": false,
|
|
152
|
+
"optional": true,
|
|
153
|
+
"docs": {
|
|
154
|
+
"tags": [],
|
|
155
|
+
"text": "If expanded height should be automatically calculated. If set, the `--ptc-accordion-item-body-max-height` CSS variable will be set automatically to the content height"
|
|
156
|
+
},
|
|
157
|
+
"attribute": "auto-height",
|
|
158
|
+
"reflect": false,
|
|
159
|
+
"defaultValue": "false"
|
|
160
|
+
},
|
|
161
|
+
"active": {
|
|
162
|
+
"type": "boolean",
|
|
163
|
+
"mutable": true,
|
|
164
|
+
"complexType": {
|
|
165
|
+
"original": "boolean",
|
|
166
|
+
"resolved": "boolean",
|
|
167
|
+
"references": {}
|
|
168
|
+
},
|
|
169
|
+
"required": false,
|
|
170
|
+
"optional": true,
|
|
171
|
+
"docs": {
|
|
172
|
+
"tags": [],
|
|
173
|
+
"text": "If the accordion item should be opened by default"
|
|
174
|
+
},
|
|
175
|
+
"attribute": "active",
|
|
176
|
+
"reflect": true,
|
|
177
|
+
"defaultValue": "false"
|
|
178
|
+
}
|
|
179
|
+
}; }
|
|
180
|
+
static get states() { return {
|
|
181
|
+
"hasHeadingSlot": {},
|
|
182
|
+
"hasArrowSlot": {}
|
|
183
|
+
}; }
|
|
184
|
+
static get events() { return [{
|
|
185
|
+
"method": "opened",
|
|
186
|
+
"name": "opened",
|
|
187
|
+
"bubbles": true,
|
|
188
|
+
"cancelable": true,
|
|
189
|
+
"composed": true,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [],
|
|
192
|
+
"text": "Emitted when accordion item has opened"
|
|
193
|
+
},
|
|
194
|
+
"complexType": {
|
|
195
|
+
"original": "any",
|
|
196
|
+
"resolved": "any",
|
|
197
|
+
"references": {}
|
|
198
|
+
}
|
|
199
|
+
}, {
|
|
200
|
+
"method": "opening",
|
|
201
|
+
"name": "opening",
|
|
202
|
+
"bubbles": true,
|
|
203
|
+
"cancelable": true,
|
|
204
|
+
"composed": true,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": "Emitted when accordion item started opening"
|
|
208
|
+
},
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "any",
|
|
211
|
+
"resolved": "any",
|
|
212
|
+
"references": {}
|
|
213
|
+
}
|
|
214
|
+
}, {
|
|
215
|
+
"method": "closed",
|
|
216
|
+
"name": "closed",
|
|
217
|
+
"bubbles": true,
|
|
218
|
+
"cancelable": true,
|
|
219
|
+
"composed": true,
|
|
220
|
+
"docs": {
|
|
221
|
+
"tags": [],
|
|
222
|
+
"text": "Emitted when accordion item has closed"
|
|
223
|
+
},
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "any",
|
|
226
|
+
"resolved": "any",
|
|
227
|
+
"references": {}
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
"method": "closing",
|
|
231
|
+
"name": "closing",
|
|
232
|
+
"bubbles": true,
|
|
233
|
+
"cancelable": true,
|
|
234
|
+
"composed": true,
|
|
235
|
+
"docs": {
|
|
236
|
+
"tags": [],
|
|
237
|
+
"text": "Emitted when accordion item started closing"
|
|
238
|
+
},
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "any",
|
|
241
|
+
"resolved": "any",
|
|
242
|
+
"references": {}
|
|
243
|
+
}
|
|
244
|
+
}]; }
|
|
245
|
+
static get methods() { return {
|
|
246
|
+
"toggle": {
|
|
247
|
+
"complexType": {
|
|
248
|
+
"signature": "() => Promise<void>",
|
|
249
|
+
"parameters": [],
|
|
250
|
+
"references": {
|
|
251
|
+
"Promise": {
|
|
252
|
+
"location": "global"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"return": "Promise<void>"
|
|
256
|
+
},
|
|
257
|
+
"docs": {
|
|
258
|
+
"text": "Toggle open state of accordion item",
|
|
259
|
+
"tags": []
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"close": {
|
|
263
|
+
"complexType": {
|
|
264
|
+
"signature": "() => Promise<void>",
|
|
265
|
+
"parameters": [],
|
|
266
|
+
"references": {
|
|
267
|
+
"Promise": {
|
|
268
|
+
"location": "global"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"return": "Promise<void>"
|
|
272
|
+
},
|
|
273
|
+
"docs": {
|
|
274
|
+
"text": "Closes the accordion item",
|
|
275
|
+
"tags": []
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"open": {
|
|
279
|
+
"complexType": {
|
|
280
|
+
"signature": "() => Promise<void>",
|
|
281
|
+
"parameters": [],
|
|
282
|
+
"references": {
|
|
283
|
+
"Promise": {
|
|
284
|
+
"location": "global"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"return": "Promise<void>"
|
|
288
|
+
},
|
|
289
|
+
"docs": {
|
|
290
|
+
"text": "Opens the accordion item.",
|
|
291
|
+
"tags": []
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}; }
|
|
295
|
+
static get elementRef() { return "el"; }
|
|
296
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Component, Host, h, Prop, Element, Listen } from '@stencil/core';
|
|
2
|
+
export class PtcAccordion {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* If multiple `<ptc-accordion-item>`s can open at the same time
|
|
6
|
+
*/
|
|
7
|
+
this.multiple = false;
|
|
8
|
+
}
|
|
9
|
+
componentWillLoad() {
|
|
10
|
+
this.items = this.el.querySelectorAll(':scope > ptc-accordion-item');
|
|
11
|
+
if (!this.multiple) {
|
|
12
|
+
this.activeItem = this.el.querySelector(':scope > ptc-accordion-item[active]');
|
|
13
|
+
if (this.activeItem) {
|
|
14
|
+
this.activeItem.open();
|
|
15
|
+
}
|
|
16
|
+
this.closeNonActive();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
openHandler(e) {
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
const eventTarget = e.target;
|
|
22
|
+
if (!this.multiple) {
|
|
23
|
+
this.activeItem = eventTarget;
|
|
24
|
+
this.closeNonActive();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
closeNonActive() {
|
|
28
|
+
this.items.forEach(item => {
|
|
29
|
+
if (!item.isEqualNode(this.activeItem)) {
|
|
30
|
+
item.close();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return (h(Host, null,
|
|
36
|
+
h("slot", null)));
|
|
37
|
+
}
|
|
38
|
+
static get is() { return "ptc-accordion"; }
|
|
39
|
+
static get encapsulation() { return "shadow"; }
|
|
40
|
+
static get originalStyleUrls() { return {
|
|
41
|
+
"$": ["ptc-accordion.scss"]
|
|
42
|
+
}; }
|
|
43
|
+
static get styleUrls() { return {
|
|
44
|
+
"$": ["ptc-accordion.css"]
|
|
45
|
+
}; }
|
|
46
|
+
static get properties() { return {
|
|
47
|
+
"multiple": {
|
|
48
|
+
"type": "boolean",
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"complexType": {
|
|
51
|
+
"original": "boolean",
|
|
52
|
+
"resolved": "boolean",
|
|
53
|
+
"references": {}
|
|
54
|
+
},
|
|
55
|
+
"required": false,
|
|
56
|
+
"optional": true,
|
|
57
|
+
"docs": {
|
|
58
|
+
"tags": [],
|
|
59
|
+
"text": "If multiple `<ptc-accordion-item>`s can open at the same time"
|
|
60
|
+
},
|
|
61
|
+
"attribute": "multiple",
|
|
62
|
+
"reflect": false,
|
|
63
|
+
"defaultValue": "false"
|
|
64
|
+
}
|
|
65
|
+
}; }
|
|
66
|
+
static get elementRef() { return "el"; }
|
|
67
|
+
static get listeners() { return [{
|
|
68
|
+
"name": "opened",
|
|
69
|
+
"method": "openHandler",
|
|
70
|
+
"target": undefined,
|
|
71
|
+
"capture": false,
|
|
72
|
+
"passive": false
|
|
73
|
+
}]; }
|
|
74
|
+
}
|
|
@@ -1,22 +1,55 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
3
|
}
|
|
4
|
-
:host .ptc-checkbox
|
|
5
|
-
|
|
4
|
+
:host .ptc-checkbox {
|
|
5
|
+
display: block;
|
|
6
|
+
position: relative;
|
|
7
|
+
user-select: none;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
font-family: "Raleway";
|
|
10
|
+
font-style: normal;
|
|
11
|
+
color: var(--color-gray-10);
|
|
12
|
+
padding-left: var(--spacing-lg);
|
|
13
|
+
font-weight: var(--ptc-font-weight-regular);
|
|
14
|
+
font-size: var(--ptc-font-size-x-small);
|
|
15
|
+
line-height: var(--ptc-line-height-dense);
|
|
16
|
+
}
|
|
17
|
+
:host .ptc-checkbox input {
|
|
18
|
+
position: absolute;
|
|
19
|
+
opacity: 0;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
height: 0;
|
|
22
|
+
width: 0;
|
|
23
|
+
}
|
|
24
|
+
:host .ptc-checkbox .check {
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
height: 1.375rem;
|
|
29
|
+
width: 1.375rem;
|
|
30
|
+
background-color: var(--color-white);
|
|
31
|
+
border: 1px solid var(--color-gray-07);
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
border-radius: 0.4rem;
|
|
6
34
|
}
|
|
7
|
-
:host .ptc-checkbox .
|
|
8
|
-
|
|
9
|
-
|
|
35
|
+
:host .ptc-checkbox .check .mark {
|
|
36
|
+
position: absolute;
|
|
37
|
+
transition: opacity ease-out 250ms;
|
|
38
|
+
opacity: 0;
|
|
39
|
+
left: 3px;
|
|
40
|
+
top: -2px;
|
|
41
|
+
width: 1.375rem;
|
|
42
|
+
height: 1.375rem;
|
|
10
43
|
}
|
|
11
|
-
:host .ptc-checkbox
|
|
12
|
-
|
|
44
|
+
:host .ptc-checkbox input:checked ~ .check {
|
|
45
|
+
background-color: #1F2024;
|
|
13
46
|
}
|
|
14
|
-
:host .ptc-checkbox
|
|
15
|
-
|
|
47
|
+
:host .ptc-checkbox input:checked ~ .check .mark {
|
|
48
|
+
opacity: 1;
|
|
16
49
|
}
|
|
17
|
-
:host .ptc-checkbox
|
|
18
|
-
|
|
50
|
+
:host .ptc-checkbox:hover input ~ .check {
|
|
51
|
+
background-color: #E4E7E9;
|
|
19
52
|
}
|
|
20
|
-
:host .ptc-checkbox
|
|
21
|
-
|
|
53
|
+
:host .ptc-checkbox:hover input:checked ~ .check {
|
|
54
|
+
background-color: #33353A;
|
|
22
55
|
}
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import { Component, h, Host, Prop, Event,
|
|
1
|
+
import { Component, h, Host, Prop, Event, Element } from '@stencil/core';
|
|
2
|
+
import CheckIcon from '../../media/svg-imgs/check-mark.svg';
|
|
2
3
|
export class PtcCheckbox {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.checked = 'unchecked';
|
|
5
|
-
this.handleClick = () => {
|
|
6
|
+
this.handleClick = (e) => {
|
|
7
|
+
let input = this.host.shadowRoot.querySelector('input');
|
|
8
|
+
let parameter = {
|
|
9
|
+
event: e,
|
|
10
|
+
sender: input,
|
|
11
|
+
value: this.value,
|
|
12
|
+
checked: this.checked
|
|
13
|
+
};
|
|
6
14
|
if (this.checked == 'unchecked') {
|
|
7
15
|
this.checked = 'checked';
|
|
8
16
|
}
|
|
9
17
|
else {
|
|
10
18
|
this.checked = 'unchecked';
|
|
11
19
|
}
|
|
20
|
+
this.checkedChanged.emit(parameter);
|
|
12
21
|
};
|
|
13
22
|
}
|
|
23
|
+
componentDidLoad() {
|
|
24
|
+
let input = this.host.shadowRoot.querySelector('input');
|
|
25
|
+
input.checked = this.checked == 'checked';
|
|
26
|
+
}
|
|
14
27
|
render() {
|
|
15
|
-
const classMap = this.getCssClassMap();
|
|
16
28
|
return (h(Host, null,
|
|
17
|
-
h("
|
|
18
|
-
h("
|
|
19
|
-
h("
|
|
20
|
-
h("span", { class: "
|
|
21
|
-
h("
|
|
22
|
-
}
|
|
23
|
-
getCssClassMap() {
|
|
24
|
-
return {
|
|
25
|
-
['ptc-checkbox']: true,
|
|
26
|
-
[this.checked]: true
|
|
27
|
-
};
|
|
29
|
+
h("label", { class: "ptc-checkbox", onClick: (e) => this.handleClick(e) },
|
|
30
|
+
h("slot", null),
|
|
31
|
+
h("input", { type: "checkbox", name: this.inputName, value: this.value }),
|
|
32
|
+
h("span", { class: "check" },
|
|
33
|
+
h("span", { class: "mark", innerHTML: CheckIcon })))));
|
|
28
34
|
}
|
|
29
35
|
static get is() { return "ptc-checkbox"; }
|
|
30
36
|
static get encapsulation() { return "shadow"; }
|
|
@@ -37,7 +43,7 @@ export class PtcCheckbox {
|
|
|
37
43
|
static get properties() { return {
|
|
38
44
|
"checked": {
|
|
39
45
|
"type": "string",
|
|
40
|
-
"mutable":
|
|
46
|
+
"mutable": true,
|
|
41
47
|
"complexType": {
|
|
42
48
|
"original": "'checked' | 'unchecked'",
|
|
43
49
|
"resolved": "\"checked\" | \"unchecked\"",
|
|
@@ -52,14 +58,45 @@ export class PtcCheckbox {
|
|
|
52
58
|
"attribute": "checked",
|
|
53
59
|
"reflect": false,
|
|
54
60
|
"defaultValue": "'unchecked'"
|
|
61
|
+
},
|
|
62
|
+
"value": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"mutable": true,
|
|
65
|
+
"complexType": {
|
|
66
|
+
"original": "string",
|
|
67
|
+
"resolved": "string",
|
|
68
|
+
"references": {}
|
|
69
|
+
},
|
|
70
|
+
"required": false,
|
|
71
|
+
"optional": false,
|
|
72
|
+
"docs": {
|
|
73
|
+
"tags": [],
|
|
74
|
+
"text": ""
|
|
75
|
+
},
|
|
76
|
+
"attribute": "value",
|
|
77
|
+
"reflect": false
|
|
78
|
+
},
|
|
79
|
+
"inputName": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"mutable": false,
|
|
82
|
+
"complexType": {
|
|
83
|
+
"original": "string",
|
|
84
|
+
"resolved": "string",
|
|
85
|
+
"references": {}
|
|
86
|
+
},
|
|
87
|
+
"required": false,
|
|
88
|
+
"optional": false,
|
|
89
|
+
"docs": {
|
|
90
|
+
"tags": [],
|
|
91
|
+
"text": ""
|
|
92
|
+
},
|
|
93
|
+
"attribute": "input-name",
|
|
94
|
+
"reflect": false
|
|
55
95
|
}
|
|
56
96
|
}; }
|
|
57
|
-
static get states() { return {
|
|
58
|
-
"selectedItem": {}
|
|
59
|
-
}; }
|
|
60
97
|
static get events() { return [{
|
|
61
|
-
"method": "
|
|
62
|
-
"name": "
|
|
98
|
+
"method": "checkedChanged",
|
|
99
|
+
"name": "checkedChanged",
|
|
63
100
|
"bubbles": true,
|
|
64
101
|
"cancelable": true,
|
|
65
102
|
"composed": true,
|
|
@@ -73,4 +110,5 @@ export class PtcCheckbox {
|
|
|
73
110
|
"references": {}
|
|
74
111
|
}
|
|
75
112
|
}]; }
|
|
113
|
+
static get elementRef() { return "host"; }
|
|
76
114
|
}
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.content-wrapper {
|
|
17
|
-
padding: 3rem;
|
|
18
17
|
font-family: Raleway;
|
|
19
18
|
font-size: 16px;
|
|
20
19
|
font-weight: 400;
|
|
@@ -36,4 +35,28 @@
|
|
|
36
35
|
}
|
|
37
36
|
.content-wrapper.x-large {
|
|
38
37
|
box-shadow: var(--ptc-shadow-x-large);
|
|
38
|
+
}
|
|
39
|
+
.content-wrapper.spacing-xx-small {
|
|
40
|
+
padding: var(--ptc-element-spacing-01);
|
|
41
|
+
}
|
|
42
|
+
.content-wrapper.spacing-x-small {
|
|
43
|
+
padding: var(--ptc-element-spacing-02);
|
|
44
|
+
}
|
|
45
|
+
.content-wrapper.spacing-small {
|
|
46
|
+
padding: var(--ptc-element-spacing-03);
|
|
47
|
+
}
|
|
48
|
+
.content-wrapper.spacing-medium {
|
|
49
|
+
padding: var(--ptc-element-spacing-04);
|
|
50
|
+
}
|
|
51
|
+
.content-wrapper.spacing-large {
|
|
52
|
+
padding: var(--ptc-element-spacing-05);
|
|
53
|
+
}
|
|
54
|
+
.content-wrapper.spacing-x-large {
|
|
55
|
+
padding: var(--ptc-element-spacing-06);
|
|
56
|
+
}
|
|
57
|
+
.content-wrapper.spacing-xx-large {
|
|
58
|
+
padding: var(--ptc-element-spacing-07);
|
|
59
|
+
}
|
|
60
|
+
.content-wrapper.spacing-xxx-large {
|
|
61
|
+
padding: var(--ptc-element-spacing-08);
|
|
39
62
|
}
|
|
@@ -7,6 +7,7 @@ export class PtcContainer {
|
|
|
7
7
|
this.backgroundColor = 'white';
|
|
8
8
|
this.elevation = 'small';
|
|
9
9
|
this.containerType = 'normal';
|
|
10
|
+
this.spacing = 'xxx-large';
|
|
10
11
|
}
|
|
11
12
|
render() {
|
|
12
13
|
const classMap = this.getCssClassMap();
|
|
@@ -25,10 +26,12 @@ export class PtcContainer {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
getCssClassMap() {
|
|
29
|
+
const spacing = `spacing-${this.spacing}`;
|
|
28
30
|
return {
|
|
29
31
|
['content-wrapper']: true,
|
|
30
32
|
[this.backgroundColor]: true,
|
|
31
|
-
[this.elevation]: true
|
|
33
|
+
[this.elevation]: true,
|
|
34
|
+
[spacing]: true
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
static get is() { return "ptc-container"; }
|
|
@@ -93,6 +96,24 @@ export class PtcContainer {
|
|
|
93
96
|
"attribute": "container-type",
|
|
94
97
|
"reflect": false,
|
|
95
98
|
"defaultValue": "'normal'"
|
|
99
|
+
},
|
|
100
|
+
"spacing": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"mutable": false,
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "'xx-small' | 'x-small' | 'small' | 'medium' | 'large' | 'x-large' | 'xxx-large' | 'xxx-large'",
|
|
105
|
+
"resolved": "\"large\" | \"medium\" | \"small\" | \"x-large\" | \"x-small\" | \"xx-small\" | \"xxx-large\"",
|
|
106
|
+
"references": {}
|
|
107
|
+
},
|
|
108
|
+
"required": false,
|
|
109
|
+
"optional": false,
|
|
110
|
+
"docs": {
|
|
111
|
+
"tags": [],
|
|
112
|
+
"text": ""
|
|
113
|
+
},
|
|
114
|
+
"attribute": "spacing",
|
|
115
|
+
"reflect": false,
|
|
116
|
+
"defaultValue": "'xxx-large'"
|
|
96
117
|
}
|
|
97
118
|
}; }
|
|
98
119
|
}
|