@ptcwebops/ptcw-design 0.6.0 → 0.6.2

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.
Files changed (82) hide show
  1. package/dist/cjs/list-item.cjs.entry.js +1 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/my-component.cjs.entry.js +2 -5
  4. package/dist/cjs/ptc-card_6.cjs.entry.js +479 -0
  5. package/dist/cjs/ptc-checkbox.cjs.entry.js +1 -1
  6. package/dist/cjs/ptc-collapse-list.cjs.entry.js +202 -0
  7. package/dist/cjs/ptc-list.cjs.entry.js +30 -3
  8. package/dist/cjs/ptc-overlay.cjs.entry.js +31 -0
  9. package/dist/cjs/ptc-picture.cjs.entry.js +1 -1
  10. package/dist/cjs/ptc-title.cjs.entry.js +1 -1
  11. package/dist/cjs/ptcw-design.cjs.js +1 -1
  12. package/dist/cjs/utils-dc2c222f.js +71 -0
  13. package/dist/collection/collection-manifest.json +1 -0
  14. package/dist/collection/components/icon-asset/media/designer.svg +28 -18
  15. package/dist/collection/components/list-item/list-item.js +1 -0
  16. package/dist/collection/components/ptc-card/ptc-card.css +144 -6
  17. package/dist/collection/components/ptc-card/ptc-card.js +4 -4
  18. package/dist/collection/components/ptc-checkbox/ptc-checkbox.js +1 -1
  19. package/dist/collection/components/ptc-collapse-list/ptc-collapse-list.css +121 -0
  20. package/dist/collection/components/ptc-collapse-list/ptc-collapse-list.js +288 -0
  21. package/dist/collection/components/ptc-list/ptc-list.js +31 -4
  22. package/dist/collection/components/ptc-picture/ptc-picture.css +3 -0
  23. package/dist/collection/components/ptc-title/ptc-title.css +1 -1
  24. package/dist/collection/utils/utils.js +62 -0
  25. package/dist/custom-elements/index.d.ts +6 -0
  26. package/dist/custom-elements/index.js +300 -12
  27. package/dist/esm/{interfaces-c1c73092.js → interfaces-3cb94654.js} +1 -1
  28. package/dist/esm/list-item.entry.js +1 -0
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/my-component.entry.js +1 -4
  31. package/dist/esm/ptc-card_6.entry.js +470 -0
  32. package/dist/esm/ptc-checkbox.entry.js +1 -1
  33. package/dist/esm/ptc-collapse-list.entry.js +198 -0
  34. package/dist/esm/ptc-list.entry.js +31 -4
  35. package/dist/esm/ptc-overlay.entry.js +27 -0
  36. package/dist/esm/ptc-picture.entry.js +2 -2
  37. package/dist/esm/ptc-title.entry.js +1 -1
  38. package/dist/esm/ptcw-design.js +1 -1
  39. package/dist/esm/utils-334d53bc.js +67 -0
  40. package/dist/ptcw-design/media/designer.svg +28 -18
  41. package/dist/ptcw-design/p-07c07cf9.entry.js +1 -0
  42. package/dist/ptcw-design/{p-50e52c88.js → p-240733ce.js} +1 -1
  43. package/dist/ptcw-design/p-2e496d31.js +1 -0
  44. package/dist/ptcw-design/p-3a972520.entry.js +1 -0
  45. package/dist/ptcw-design/p-3d3c73b1.entry.js +1 -0
  46. package/dist/ptcw-design/{p-3a41081a.entry.js → p-44cb62a9.entry.js} +1 -1
  47. package/dist/ptcw-design/p-46cf7f48.entry.js +1 -0
  48. package/dist/ptcw-design/{p-9b442487.entry.js → p-818df883.entry.js} +1 -1
  49. package/dist/ptcw-design/p-b146377a.entry.js +1 -0
  50. package/dist/ptcw-design/p-d8b48946.entry.js +1 -0
  51. package/dist/ptcw-design/p-e5bfbb91.entry.js +1 -0
  52. package/dist/ptcw-design/ptcw-design.css +1 -1
  53. package/dist/ptcw-design/ptcw-design.esm.js +1 -1
  54. package/dist/types/components/ptc-card/ptc-card.d.ts +1 -1
  55. package/dist/types/components/ptc-collapse-list/ptc-collapse-list.d.ts +39 -0
  56. package/dist/types/components/ptc-list/ptc-list.d.ts +2 -0
  57. package/dist/types/components.d.ts +21 -2
  58. package/dist/types/utils/utils.d.ts +2 -0
  59. package/package.json +1 -1
  60. package/readme.md +1 -1
  61. package/dist/cjs/ptc-card.cjs.entry.js +0 -79
  62. package/dist/cjs/ptc-date.cjs.entry.js +0 -59
  63. package/dist/cjs/ptc-img_2.cjs.entry.js +0 -185
  64. package/dist/cjs/ptc-pagenation.cjs.entry.js +0 -115
  65. package/dist/cjs/ptc-para.cjs.entry.js +0 -50
  66. package/dist/cjs/ptc-spacer.cjs.entry.js +0 -46
  67. package/dist/esm/ptc-card.entry.js +0 -75
  68. package/dist/esm/ptc-date.entry.js +0 -55
  69. package/dist/esm/ptc-img_2.entry.js +0 -180
  70. package/dist/esm/ptc-pagenation.entry.js +0 -111
  71. package/dist/esm/ptc-para.entry.js +0 -46
  72. package/dist/esm/ptc-spacer.entry.js +0 -42
  73. package/dist/ptcw-design/p-1cfc77eb.entry.js +0 -1
  74. package/dist/ptcw-design/p-42df89de.entry.js +0 -1
  75. package/dist/ptcw-design/p-51c39418.entry.js +0 -1
  76. package/dist/ptcw-design/p-679b99ad.entry.js +0 -1
  77. package/dist/ptcw-design/p-7bcc42e1.entry.js +0 -1
  78. package/dist/ptcw-design/p-8e27bb6d.entry.js +0 -1
  79. package/dist/ptcw-design/p-969c178b.entry.js +0 -1
  80. package/dist/ptcw-design/p-df80470b.entry.js +0 -1
  81. package/dist/ptcw-design/p-ec10f846.entry.js +0 -1
  82. package/dist/ptcw-design/p-fa53e5e5.entry.js +0 -1
@@ -224,9 +224,24 @@
224
224
  text-decoration: none;
225
225
  }
226
226
  :host(.hightlight-card) .link-wrapper:hover ::slotted([slot=slot-description]) {
227
- height: var(--ptc-layout-spacing-05);
227
+ height: 96px;
228
228
  opacity: 1;
229
229
  }
230
+ @media only screen and (min-width: 768px) {
231
+ :host(.hightlight-card) .link-wrapper:hover ::slotted([slot=slot-description]) {
232
+ height: var(--ptc-layout-spacing-05);
233
+ }
234
+ }
235
+ @media only screen and (min-width: 992px) {
236
+ :host(.hightlight-card) .link-wrapper:hover ::slotted([slot=slot-description]) {
237
+ height: var(--ptc-layout-spacing-06);
238
+ }
239
+ }
240
+ @media only screen and (min-width: 1440px) {
241
+ :host(.hightlight-card) .link-wrapper:hover ::slotted([slot=slot-description]) {
242
+ height: var(--ptc-layout-spacing-05);
243
+ }
244
+ }
230
245
  :host(.hightlight-card) .card-media {
231
246
  width: 100%;
232
247
  height: auto;
@@ -261,8 +276,62 @@
261
276
  transition-delay: var(--ptc-delay-5);
262
277
  }
263
278
 
264
- :host(.listing-card) .card-border {
279
+ :host(.horizontal-card) {
280
+ margin-bottom: var(--ptc-layout-spacing-02);
281
+ }
282
+ :host(.horizontal-card) .card-layout {
283
+ position: relative;
284
+ }
285
+ @media only screen and (min-width: 768px) {
286
+ :host(.horizontal-card) .card-layout {
287
+ display: grid;
288
+ grid-template-columns: 42% 58%;
289
+ direction: ltr;
290
+ grid-auto-rows: 1fr;
291
+ }
292
+ }
293
+ :host(.horizontal-card) .link-wrapper {
294
+ outline: none;
295
+ text-decoration: none;
296
+ transition: var(--ptc-transition-slow) linear;
297
+ }
298
+ :host(.horizontal-card) .link-wrapper:hover {
299
+ box-shadow: var(--ptc-shadow-large);
300
+ transition: var(--ptc-transition-slow) linear;
301
+ background-color: var(--color-white);
302
+ }
303
+ :host(.horizontal-card) .link-wrapper:hover h3 {
304
+ border-color: var(--color-green-06);
305
+ transition: var(--ptc-transition-slow) linear;
306
+ }
307
+ :host(.horizontal-card) .card-media {
308
+ display: flex;
309
+ align-self: center;
310
+ }
311
+ :host(.horizontal-card) .card-body {
312
+ padding: var(--ptc-element-spacing-05) var(--ptc-element-spacing-04);
313
+ }
314
+ @media only screen and (min-width: 768px) {
315
+ :host(.horizontal-card) .card-body {
316
+ padding: var(--ptc-element-spacing-06) var(--ptc-element-spacing-07);
317
+ }
318
+ }
319
+ :host(.horizontal-card) .card-body h3 {
320
+ margin-top: 0;
321
+ font-size: var(--ptc-font-size-x-small);
322
+ color: var(--color-gray-10);
323
+ border-bottom: 1px solid transparent;
324
+ padding-bottom: var(--ptc-element-spacing-01);
325
+ margin-bottom: var(--ptc-element-spacing-02);
326
+ transition: var(--ptc-transition-slow) linear;
327
+ }
328
+ :host(.horizontal-card) ::slotted([slot=slot-image]) {
329
+ box-shadow: var(--ptc-shadow-medium);
265
330
  width: 100%;
331
+ }
332
+
333
+ :host(.listing-card) .card-border {
334
+ width: 320px;
266
335
  overflow: hidden;
267
336
  background: var(--color-white);
268
337
  box-shadow: var(--ptc-shadow-small);
@@ -304,14 +373,17 @@
304
373
  }
305
374
  :host(.listing-card) .card-media {
306
375
  width: 100%;
307
- height: 224.5px;
376
+ height: 200px;
308
377
  transform: scale(1);
309
378
  transform-origin: center bottom;
310
379
  transition: transform var(--ptc-transition-medium) var(--ptc-standard-ease);
311
380
  transition-delay: var(--ptc-delay-medium);
312
381
  }
382
+ :host(.listing-card) .card-media .smart-img {
383
+ height: 200px;
384
+ }
313
385
  :host(.listing-card) .card-body {
314
- padding: 24px 20px;
386
+ padding: 20px 38px 20px 20px;
315
387
  }
316
388
  :host(.listing-card) .card-body .small {
317
389
  font-size: var(--ptc-font-size-x-small);
@@ -330,9 +402,75 @@
330
402
  :host(.listing-card) ::slotted([slot=slot-description]) {
331
403
  font-family: var(--ptc-font-latin);
332
404
  font-style: var(--ptc-font-style-normal);
333
- font-weight: var(--ptc-font-weight-regular);
405
+ font-weight: 400;
406
+ font-size: 1rem;
407
+ line-height: 19px;
408
+ color: var(--color-gray-11);
409
+ margin-bottom: 39px;
410
+ }
411
+
412
+ :host(.listing-card-horizontal) .card-border {
413
+ width: 890px;
414
+ overflow: hidden;
415
+ background: var(--color-white);
416
+ box-shadow: var(--ptc-shadow-small);
417
+ border-radius: 3px;
418
+ height: 224px;
419
+ }
420
+ :host(.listing-card-horizontal) .card-border:hover {
421
+ background: var(--color-gray-02);
422
+ box-shadow: var(--ptc-shadow-large);
423
+ }
424
+ :host(.listing-card-horizontal) .card-layout {
425
+ display: flex;
426
+ flex-direction: row;
427
+ width: 890px;
428
+ height: 224px;
429
+ }
430
+ :host(.listing-card-horizontal) .link-wrapper {
431
+ outline: none;
432
+ text-decoration: none;
433
+ }
434
+ :host(.listing-card-horizontal) .link-wrapper:hover {
435
+ outline: none;
436
+ text-decoration: none;
437
+ }
438
+ :host(.listing-card-horizontal) .card-media {
439
+ width: 385px;
440
+ height: 224px;
441
+ transform: scale(1);
442
+ transform-origin: center bottom;
443
+ transition: transform var(--ptc-transition-medium) var(--ptc-standard-ease);
444
+ transition-delay: var(--ptc-delay-medium);
445
+ }
446
+ :host(.listing-card-horizontal) .card-media .smart-img {
447
+ height: 224px;
448
+ width: 385px;
449
+ }
450
+ :host(.listing-card-horizontal) .card-body {
451
+ padding: 20px 38px 20px 20px;
452
+ width: 505px;
453
+ }
454
+ :host(.listing-card-horizontal) .card-body .small {
334
455
  font-size: var(--ptc-font-size-x-small);
335
- line-height: var(--ptc-line-height-dense);
456
+ }
457
+ :host(.listing-card-horizontal) .card-body h3 {
458
+ font-family: var(--ptc-font-latin);
459
+ font-style: var(--ptc-font-style-normal);
460
+ font-weight: var(--ptc-font-weight-bold);
461
+ font-size: var(--ptc-font-size-small);
462
+ line-height: var(--ptc-line-height-loose);
463
+ line-height: 21px;
464
+ color: var(--color-gray-11);
465
+ margin-bottom: 12px;
466
+ margin-top: 0rem;
467
+ }
468
+ :host(.listing-card-horizontal) ::slotted([slot=slot-description]) {
469
+ font-family: var(--ptc-font-latin);
470
+ font-style: var(--ptc-font-style-normal);
471
+ font-weight: 400;
472
+ font-size: 1rem;
473
+ line-height: 19px;
336
474
  color: var(--color-gray-11);
337
475
  margin-bottom: 39px;
338
476
  }
@@ -45,7 +45,7 @@ export class PtcCard {
45
45
  this.hasImage || this.hasLottie || this.hasVideo ? (h("div", { class: "card-media", part: "media-wrapper" }, this.getMediaSlot ? h("slot", { name: this.getMediaSlot() }) : null)) : null,
46
46
  !!this.ribbonText && this.cardType == 'listing-card' ? h("div", { class: "ribbon-text" }, `${this.ribbonText}`) : null,
47
47
  h("div", { class: "card-body", part: "body-wrapper" },
48
- !!this.cardDate && this.cardType == 'listing-card' ? h("ptc-date", { "date-string": `${this.cardDate}`, "date-styles": "span{font-weight: 400;font-size: 16px;line-height: 19px;color: #282F35;margin-bottom:24px;display:inline-block;}" }) : null,
48
+ !!this.cardDate && (this.cardType === 'listing-card' || this.cardType === 'listing-card-horizontal') ? h("ptc-date", { "date-string": `${this.cardDate}`, "date-styles": "span{font-weight: 400;font-size: 16px;line-height: 19px;color: #282F35;margin-bottom:24px;display:inline-block;}" }) : null,
49
49
  h("slot", { name: "slot-before-heading" }),
50
50
  !!this.heading
51
51
  ? [
@@ -54,7 +54,7 @@ export class PtcCard {
54
54
  ]
55
55
  : null,
56
56
  h("slot", { name: "slot-description" }),
57
- !!this.cardDate && this.cardType != 'listing-card' ? h("ptc-date", { "date-string": `${this.cardDate}`, "date-styles": "span{color:#40434a;font-size:var(--ptc-font-size-x-small);margin-top:var(--ptc-element-spacing-06);display:inline-block;}" }) : null)))));
57
+ !!this.cardDate && this.cardType !== 'listing-card' && this.cardType !== 'listing-card-horizontal' && this.cardType !== 'hightlight-card' ? h("ptc-date", { "date-string": `${this.cardDate}`, "date-styles": "span{color:#40434a;font-size:var(--ptc-font-size-x-small);margin-top:var(--ptc-element-spacing-06);display:inline-block;}" }) : null)))));
58
58
  }
59
59
  getCssClassMap() {
60
60
  return {
@@ -89,8 +89,8 @@ export class PtcCard {
89
89
  "type": "string",
90
90
  "mutable": false,
91
91
  "complexType": {
92
- "original": "'simple-card' | 'lottie-card' | 'custom-card' | 'clip-edge-card' | 'hightlight-card' | 'listing-card'",
93
- "resolved": "\"clip-edge-card\" | \"custom-card\" | \"hightlight-card\" | \"listing-card\" | \"lottie-card\" | \"simple-card\"",
92
+ "original": "'simple-card' | 'lottie-card' | 'custom-card' | 'clip-edge-card' | 'hightlight-card' | 'listing-card' | 'horizontal-card' | 'listing-card-horizontal'",
93
+ "resolved": "\"clip-edge-card\" | \"custom-card\" | \"hightlight-card\" | \"horizontal-card\" | \"listing-card\" | \"listing-card-horizontal\" | \"lottie-card\" | \"simple-card\"",
94
94
  "references": {}
95
95
  },
96
96
  "required": false,
@@ -30,7 +30,7 @@ export class PtcCheckbox {
30
30
  h("input", { type: "checkbox", checked: this.checked == "checked", name: this.inputName, value: this.value, onChange: (e) => this.handleClick(e) }),
31
31
  h("span", { class: "check" },
32
32
  h("span", { class: "mark" },
33
- h("icon-asset", { type: "ptc", size: "xx-small", name: "check-mark" }))))));
33
+ h("icon-asset", { type: "ptc", size: "xx-small", name: "checkmark" }))))));
34
34
  }
35
35
  static get is() { return "ptc-checkbox"; }
36
36
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,121 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .container {
6
+ border-right: 1px solid rgba(112, 112, 112, 0.25);
7
+ position: relative;
8
+ }
9
+
10
+ a {
11
+ transition: color ease-out 250ms;
12
+ }
13
+
14
+ ul {
15
+ transition: max-height ease-out 250ms, padding ease-out 250ms;
16
+ overflow: hidden;
17
+ list-style: none;
18
+ padding: 0;
19
+ margin: 0;
20
+ }
21
+
22
+ .level-1 > ul, .level-2 > ul, .level-3 > ul, .level-4 > ul, .level-5 > ul {
23
+ max-height: 0;
24
+ }
25
+
26
+ .level-1 {
27
+ position: relative;
28
+ padding: 17px 20px 17px 0;
29
+ border-bottom: 1px solid rgba(112, 112, 112, 0.25);
30
+ }
31
+ .level-1 > a {
32
+ font-size: 18px;
33
+ letter-spacing: 0.45px;
34
+ font-weight: 800;
35
+ color: #40434a;
36
+ text-decoration: none;
37
+ }
38
+ .level-1 > a:hover, .level-1 > a:active, .level-1 > a:focus {
39
+ text-decoration: none;
40
+ }
41
+ .level-1 > icon-asset {
42
+ transition: transform ease-out 250ms;
43
+ position: absolute;
44
+ right: 32px;
45
+ }
46
+ .level-1 > ul {
47
+ padding-top: 0;
48
+ }
49
+ .level-1.expanded > icon-asset {
50
+ transform: rotate(-180deg);
51
+ }
52
+ .level-1.expanded > ul {
53
+ padding-top: 14px;
54
+ }
55
+ .level-1:after {
56
+ content: "";
57
+ display: block;
58
+ position: absolute;
59
+ bottom: -2px;
60
+ left: 0;
61
+ height: 3px;
62
+ width: 40px;
63
+ background-color: #74c34d;
64
+ }
65
+
66
+ .level-2 {
67
+ margin: 8px 0;
68
+ }
69
+ .level-2 > a {
70
+ font-size: 15px;
71
+ font-weight: 500;
72
+ letter-spacing: 0.4px;
73
+ color: #3b4550;
74
+ text-decoration: none;
75
+ }
76
+ .level-2 > a:hover, .level-2 > a:active, .level-2 > a:focus {
77
+ font-weight: 800;
78
+ color: #74c34d;
79
+ text-decoration: none;
80
+ }
81
+
82
+ input[type=text] {
83
+ padding: 9px 45px 9px 18px;
84
+ font-size: 15px;
85
+ font-weight: 500;
86
+ color: var(--color-gray-07);
87
+ box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.16);
88
+ border: solid 1px var(--color-gray-07);
89
+ background-color: #ffffff;
90
+ }
91
+ input[type=text]::-ms-clear {
92
+ display: none;
93
+ }
94
+ input[type=text]:focus {
95
+ outline: none;
96
+ }
97
+ input[type=text]::-webkit-input-placeholder {
98
+ color: var(--color-gray-02);
99
+ }
100
+ input[type=text]:-moz-placeholder {
101
+ /* FF 4-18 */
102
+ color: var(--color-gray-02);
103
+ opacity: 1;
104
+ }
105
+ input[type=text]::-moz-placeholder {
106
+ /* FF 19+ */
107
+ color: var(--color-gray-02);
108
+ opacity: 1;
109
+ }
110
+ input[type=text]:-ms-input-placeholder {
111
+ /* IE 10+ */
112
+ color: var(--color-gray-02);
113
+ }
114
+ input[type=text]::-ms-input-placeholder {
115
+ /* Microsoft Edge */
116
+ color: var(--color-gray-02);
117
+ }
118
+ input[type=text] *::placeholder {
119
+ /* modern browser */
120
+ color: var(--color-gray-02);
121
+ }
@@ -0,0 +1,288 @@
1
+ import { Component, Host, h, Prop, Element, State } from '@stencil/core';
2
+ import { generateUUID, MapDOM } from '../../utils/utils';
3
+ import { Event } from '@stencil/core';
4
+ class CollapseListItem {
5
+ }
6
+ export class PtcCollapseList {
7
+ componentWillLoad() {
8
+ this.loadListItems();
9
+ }
10
+ componentDidLoad() {
11
+ this.ready.emit({
12
+ sender: this.el,
13
+ tree: this.data
14
+ });
15
+ }
16
+ componentDidUpdate() {
17
+ this.updated.emit({
18
+ sender: this.el,
19
+ tree: this.data
20
+ });
21
+ }
22
+ onItemSelectedHandler(event) {
23
+ this.itemSelected.emit({
24
+ event: event,
25
+ sender: event ? event.target : this.el,
26
+ selectedItems: this.selectedItems,
27
+ tree: this.data
28
+ });
29
+ }
30
+ onItemExpandeddHandler(event) {
31
+ this.itemExpanded.emit({
32
+ event: event,
33
+ sender: event ? event.target : this.el,
34
+ selectedItems: this.selectedItems,
35
+ tree: this.data
36
+ });
37
+ }
38
+ loadListItems() {
39
+ this.hashMap = {};
40
+ if (!this.data) {
41
+ let dom = MapDOM(this.el);
42
+ if (dom.collapseListItem) {
43
+ this.data = new Array();
44
+ let buildChildren = (arr, outArr) => {
45
+ arr.map((z) => {
46
+ var newItem = new CollapseListItem();
47
+ newItem.isExternalLink = z.linkHref ? true : false;
48
+ if (z.linkHref) {
49
+ newItem.href = z.linkHref;
50
+ newItem.target = z.linkTarget;
51
+ newItem.title = z.linkTitle;
52
+ }
53
+ else {
54
+ newItem.id = generateUUID();
55
+ newItem.text = z.facetDisplay;
56
+ newItem.name = z.facetName;
57
+ newItem.value = z.facetValue;
58
+ newItem.category = z.category;
59
+ newItem.allowMultiSelect = z.allowMultiSelect != 'false';
60
+ this.setUpCategory(newItem.category, newItem.allowMultiSelect);
61
+ }
62
+ if (z.collapseListItem) {
63
+ newItem.children = new Array();
64
+ buildChildren(z.collapseListItem, newItem.children);
65
+ }
66
+ this.hashMap[newItem.id] = newItem;
67
+ outArr.push(newItem);
68
+ });
69
+ };
70
+ this.setUpCategory('default', true);
71
+ buildChildren(dom.collapseListItem, this.data);
72
+ }
73
+ }
74
+ }
75
+ setUpCategory(name, allowMultiSelect) {
76
+ if (!this.selectedItems) {
77
+ this.selectedItems = {};
78
+ }
79
+ if (name && !this.selectedItems[name]) {
80
+ this.selectedItems[name] = {
81
+ name: name,
82
+ items: new Array(),
83
+ allowMultiSelect: allowMultiSelect
84
+ };
85
+ }
86
+ }
87
+ collapseAllFirstLevelItems(exclude) {
88
+ let items = this.el.shadowRoot.querySelectorAll('.level-1');
89
+ items.forEach((z) => {
90
+ if (z.classList.contains('expanded') && z != exclude) {
91
+ z.classList.remove('expanded');
92
+ }
93
+ });
94
+ }
95
+ updateExpandedItems() {
96
+ let items = this.el.shadowRoot.querySelectorAll('li');
97
+ items.forEach((z) => {
98
+ let ul = z.querySelector(':scope > ul');
99
+ if (ul) {
100
+ if (!z.classList.contains('expanded')) {
101
+ ul.style.removeProperty('max-height');
102
+ }
103
+ else {
104
+ ul.style.maxHeight = ul.scrollHeight + "px";
105
+ }
106
+ }
107
+ });
108
+ }
109
+ updateSelectedItemStatus(uuid) {
110
+ var _a;
111
+ let selectedItem = this.hashMap[uuid];
112
+ if (selectedItem && selectedItem.value) {
113
+ let categoryName = (_a = selectedItem.category) !== null && _a !== void 0 ? _a : 'default';
114
+ if (!this.selectedItems[categoryName]) {
115
+ this.setUpCategory(categoryName, selectedItem.allowMultiSelect == true);
116
+ }
117
+ let items = this.selectedItems[categoryName].items;
118
+ if (items.indexOf(selectedItem.value) < 0) {
119
+ if (this.selectedItems[categoryName].allowMultiSelect) {
120
+ items.push(selectedItem.value);
121
+ }
122
+ else {
123
+ items = [selectedItem.value];
124
+ }
125
+ }
126
+ else {
127
+ items = items.filter((z) => { return z != selectedItem.value; });
128
+ }
129
+ this.selectedItems[categoryName].items = items;
130
+ }
131
+ }
132
+ onItemLinkClick(event, uuid) {
133
+ if (event) {
134
+ event.preventDefault();
135
+ }
136
+ this.updateSelectedItemStatus(uuid);
137
+ this.onItemSelectedHandler(event);
138
+ }
139
+ onExpandClick(event, collapseParents) {
140
+ if (event) {
141
+ event.preventDefault();
142
+ let sender = event.target;
143
+ if (collapseParents) {
144
+ this.collapseAllFirstLevelItems(sender.parentNode);
145
+ }
146
+ if (sender && sender.parentNode) {
147
+ let parent = sender.parentNode;
148
+ parent.classList.toggle("expanded");
149
+ }
150
+ this.updateExpandedItems();
151
+ }
152
+ this.onItemExpandeddHandler(event);
153
+ }
154
+ render() {
155
+ let renderLevel = (arr, index) => {
156
+ let levelClass = `level-${index}`;
157
+ return (h("ul", null, arr.map((z) => {
158
+ let expandable = false;
159
+ let icon = '';
160
+ if (index == 1 && z.children) {
161
+ expandable = true;
162
+ icon = (h("icon-asset", { type: "ptc", name: "chevron-down", color: "ptc-green", size: "medium" }));
163
+ }
164
+ return (h("li", { class: levelClass },
165
+ icon,
166
+ getLink(z, expandable),
167
+ z.children ? renderLevel(z.children, index + 1) : ''));
168
+ })));
169
+ };
170
+ let getLink = (item, expandable) => {
171
+ let clickEvent = (e) => {
172
+ if (expandable) {
173
+ this.onExpandClick(e, true);
174
+ }
175
+ else {
176
+ this.onItemLinkClick(e, item.id);
177
+ }
178
+ };
179
+ if (item.isExternalLink) {
180
+ return (h("a", { href: item.href, target: item.target, title: item.title }, item.text));
181
+ }
182
+ else {
183
+ return (h("a", { href: "#", title: item.text, onClick: clickEvent }, item.text));
184
+ }
185
+ };
186
+ return (h(Host, null,
187
+ h("div", { class: "container" },
188
+ h("ptc-title", { type: 'h4', "title-size": "medium", "title-weight": "w-6", "text-align": 'left', upperline: "no-upperline" }, "Filter Results :"),
189
+ h("input", { type: "text", placeholder: 'Search' }),
190
+ renderLevel(this.data, 1))));
191
+ }
192
+ static get is() { return "ptc-collapse-list"; }
193
+ static get encapsulation() { return "shadow"; }
194
+ static get originalStyleUrls() { return {
195
+ "$": ["ptc-collapse-list.scss"]
196
+ }; }
197
+ static get styleUrls() { return {
198
+ "$": ["ptc-collapse-list.css"]
199
+ }; }
200
+ static get properties() { return {
201
+ "listItems": {
202
+ "type": "unknown",
203
+ "mutable": true,
204
+ "complexType": {
205
+ "original": "Object",
206
+ "resolved": "Object",
207
+ "references": {
208
+ "Object": {
209
+ "location": "global"
210
+ }
211
+ }
212
+ },
213
+ "required": false,
214
+ "optional": true,
215
+ "docs": {
216
+ "tags": [],
217
+ "text": ""
218
+ }
219
+ }
220
+ }; }
221
+ static get states() { return {
222
+ "data": {},
223
+ "selectedItems": {},
224
+ "hashMap": {}
225
+ }; }
226
+ static get events() { return [{
227
+ "method": "itemSelected",
228
+ "name": "itemSelected",
229
+ "bubbles": true,
230
+ "cancelable": true,
231
+ "composed": true,
232
+ "docs": {
233
+ "tags": [],
234
+ "text": ""
235
+ },
236
+ "complexType": {
237
+ "original": "any",
238
+ "resolved": "any",
239
+ "references": {}
240
+ }
241
+ }, {
242
+ "method": "itemExpanded",
243
+ "name": "itemExpanded",
244
+ "bubbles": true,
245
+ "cancelable": true,
246
+ "composed": true,
247
+ "docs": {
248
+ "tags": [],
249
+ "text": ""
250
+ },
251
+ "complexType": {
252
+ "original": "any",
253
+ "resolved": "any",
254
+ "references": {}
255
+ }
256
+ }, {
257
+ "method": "ready",
258
+ "name": "ready",
259
+ "bubbles": true,
260
+ "cancelable": true,
261
+ "composed": true,
262
+ "docs": {
263
+ "tags": [],
264
+ "text": ""
265
+ },
266
+ "complexType": {
267
+ "original": "any",
268
+ "resolved": "any",
269
+ "references": {}
270
+ }
271
+ }, {
272
+ "method": "updated",
273
+ "name": "updated",
274
+ "bubbles": true,
275
+ "cancelable": true,
276
+ "composed": true,
277
+ "docs": {
278
+ "tags": [],
279
+ "text": ""
280
+ },
281
+ "complexType": {
282
+ "original": "any",
283
+ "resolved": "any",
284
+ "references": {}
285
+ }
286
+ }]; }
287
+ static get elementRef() { return "el"; }
288
+ }
@@ -1,4 +1,6 @@
1
- import { Component, Host, h, Prop } from '@stencil/core';
1
+ import { Component, Host, h, Prop, Element } from '@stencil/core';
2
+ class ListItem {
3
+ }
2
4
  export class PtcList {
3
5
  constructor() {
4
6
  this.listType = 'list-primary';
@@ -6,16 +8,40 @@ export class PtcList {
6
8
  }
7
9
  render() {
8
10
  const classMap = this.getCssClassMap();
9
- const listItems = this.listItems;
10
- //console.log(this.listItems.length);
11
+ const listItems = this.getListItems();
11
12
  if (!listItems || listItems.length === 0) {
12
13
  return null;
13
14
  }
14
15
  return (h(Host, { class: classMap },
15
16
  h("ul", null, listItems.map(listItem => {
16
- h("li", null, listItem);
17
+ return (h("list-item", { "link-type": listItem.type, "link-href": listItem.href, "link-target": listItem.target, "flush-before": listItem.flushBefore }, listItem.value));
17
18
  }))));
18
19
  }
20
+ getListItems() {
21
+ let result = new Array();
22
+ if (this.listItems && this.listItems.length > 0) {
23
+ this.listItems.map(listItem => {
24
+ let i = new ListItem();
25
+ i.value = listItem;
26
+ result.push(i);
27
+ });
28
+ }
29
+ else {
30
+ let items = Array.from(this.el.querySelectorAll('list-item'));
31
+ items.map(el => {
32
+ let i = new ListItem();
33
+ let item = el;
34
+ i.value = item.innerText;
35
+ i.href = item.getAttribute('link-href');
36
+ i.target = item.getAttribute('link-target');
37
+ i.flushBefore = item.getAttribute('flush-before') == 'true';
38
+ i.type = item.getAttribute('link-type');
39
+ result.push(i);
40
+ });
41
+ console.log();
42
+ }
43
+ return result;
44
+ }
19
45
  getCssClassMap() {
20
46
  return {
21
47
  [this.listType]: this.listItems ? true : false,
@@ -65,4 +91,5 @@ export class PtcList {
65
91
  "defaultValue": "[]"
66
92
  }
67
93
  }; }
94
+ static get elementRef() { return "el"; }
68
95
  }
@@ -2,6 +2,9 @@
2
2
  display: block;
3
3
  overflow: hidden;
4
4
  }
5
+ :host img {
6
+ display: block;
7
+ }
5
8
 
6
9
  :host(.relative) {
7
10
  position: relative;