@amiceli/papierjs 0.6.0 → 0.7.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.
Files changed (201) hide show
  1. package/dist/cjs/{index-82a72b67.js → index-875ceae0.js} +39 -6
  2. package/dist/cjs/index-875ceae0.js.map +1 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/p-accordion.cjs.entry.js +4 -4
  5. package/dist/cjs/p-alert.cjs.entry.js +2 -2
  6. package/dist/cjs/p-badge.cjs.entry.js +2 -2
  7. package/dist/cjs/p-breadcrumb-item.cjs.entry.js +2 -2
  8. package/dist/cjs/p-breadcrumb.cjs.entry.js +2 -2
  9. package/dist/cjs/{p-dropdown_2.cjs.entry.js → p-button_3.cjs.entry.js} +55 -6
  10. package/dist/cjs/p-button_3.cjs.entry.js.map +1 -0
  11. package/dist/cjs/p-dropdown-preview.cjs.entry.js +2 -2
  12. package/dist/cjs/p-input-text.cjs.entry.js +2 -2
  13. package/dist/cjs/p-leaf.cjs.entry.js +2 -2
  14. package/dist/cjs/p-modal-preview.cjs.entry.js +2 -2
  15. package/dist/cjs/p-modal.cjs.entry.js +31 -0
  16. package/dist/cjs/p-modal.cjs.entry.js.map +1 -0
  17. package/dist/cjs/p-notification-handler.cjs.entry.js +57 -0
  18. package/dist/cjs/p-notification-handler.cjs.entry.js.map +1 -0
  19. package/dist/cjs/p-notification-preview.cjs.entry.js +41 -0
  20. package/dist/cjs/p-notification-preview.cjs.entry.js.map +1 -0
  21. package/dist/cjs/p-notification.cjs.entry.js +64 -0
  22. package/dist/cjs/p-notification.cjs.entry.js.map +1 -0
  23. package/dist/cjs/p-progress-bar.cjs.entry.js +2 -2
  24. package/dist/cjs/p-slider.cjs.entry.js +3 -3
  25. package/dist/cjs/p-switch-tile.cjs.entry.js +3 -3
  26. package/dist/cjs/p-switch.cjs.entry.js +4 -4
  27. package/dist/cjs/p-tab.cjs.entry.js +3 -3
  28. package/dist/cjs/p-tabs.cjs.entry.js +4 -4
  29. package/dist/cjs/p-tooltip.cjs.entry.js +2 -2
  30. package/dist/cjs/papierjs.cjs.js +2 -2
  31. package/dist/collection/collection-manifest.json +3 -0
  32. package/dist/collection/components/accordion/accordion.js +3 -3
  33. package/dist/collection/components/alert/alert.js +1 -1
  34. package/dist/collection/components/badge/badge.js +1 -1
  35. package/dist/collection/components/breadcrumb/breadcrumb/breadcrumb.js +1 -1
  36. package/dist/collection/components/breadcrumb/breadcrumb-item/breadcrumb-item.js +1 -1
  37. package/dist/collection/components/button/button.js +1 -1
  38. package/dist/collection/components/dropdown/dropdown/dropdown.js +2 -2
  39. package/dist/collection/components/dropdown/dropdown/stories/dropdown.preview.js +1 -1
  40. package/dist/collection/components/dropdown/dropdown-item/dropdown-item.js +2 -2
  41. package/dist/collection/components/form/input-text/input-text.js +1 -1
  42. package/dist/collection/components/form/slider/sliders.js +2 -2
  43. package/dist/collection/components/form/switch/switch.js +3 -3
  44. package/dist/collection/components/form/switch-tile/switch-tile.js +2 -2
  45. package/dist/collection/components/leaf/leaf.js +1 -1
  46. package/dist/collection/components/modal/modal.js +1 -1
  47. package/dist/collection/components/modal/stories/modal.preview.js +1 -1
  48. package/dist/collection/components/notification/p-notification/p-notification.css +3260 -0
  49. package/dist/collection/components/notification/p-notification/p-notification.js +164 -0
  50. package/dist/collection/components/notification/p-notification/p-notification.js.map +1 -0
  51. package/dist/collection/components/notification/p-notification-handler/p-notification-handler.css +13 -0
  52. package/dist/collection/components/notification/p-notification-handler/p-notification-handler.js +100 -0
  53. package/dist/collection/components/notification/p-notification-handler/p-notification-handler.js.map +1 -0
  54. package/dist/collection/components/notification/p-notification-handler/stories/p-notification-preview.js +36 -0
  55. package/dist/collection/components/notification/p-notification-handler/stories/p-notification-preview.js.map +1 -0
  56. package/dist/collection/components/progress-bar/progress-bar.js +1 -1
  57. package/dist/collection/components/tabs/tab/tab.js +2 -2
  58. package/dist/collection/components/tabs/tabs/tabs.js +3 -3
  59. package/dist/collection/components/tooltip/tooltip.js +1 -1
  60. package/dist/components/index.js +1 -1
  61. package/dist/components/{p-44ddcae9.js → p-3e858546.js} +3 -3
  62. package/dist/components/{p-44ddcae9.js.map → p-3e858546.js.map} +1 -1
  63. package/dist/components/{p-ee5f2278.js → p-51fafe64.js} +4 -4
  64. package/dist/components/{p-ee5f2278.js.map → p-51fafe64.js.map} +1 -1
  65. package/dist/components/{p-1754e5cb.js → p-555df865.js} +3 -3
  66. package/dist/components/{p-1754e5cb.js.map → p-555df865.js.map} +1 -1
  67. package/dist/components/p-accordion.js +4 -4
  68. package/dist/components/{p-eea4fbc1.js → p-af62ba98.js} +23 -2
  69. package/dist/components/p-af62ba98.js.map +1 -0
  70. package/dist/components/p-alert.js +2 -2
  71. package/dist/components/p-badge.js +2 -2
  72. package/dist/components/p-breadcrumb-item.js +2 -2
  73. package/dist/components/p-breadcrumb.js +2 -2
  74. package/dist/components/p-button.js +1 -1
  75. package/dist/components/p-c3c46963.js +78 -0
  76. package/dist/components/p-c3c46963.js.map +1 -0
  77. package/dist/components/{p-18fc6353.js → p-c8138bbd.js} +4 -4
  78. package/dist/components/{p-18fc6353.js.map → p-c8138bbd.js.map} +1 -1
  79. package/dist/components/p-dropdown-item.js +1 -1
  80. package/dist/components/p-dropdown-preview.js +6 -6
  81. package/dist/components/p-dropdown.js +1 -1
  82. package/dist/components/p-ef7a623f.js +81 -0
  83. package/dist/components/p-ef7a623f.js.map +1 -0
  84. package/dist/components/p-input-text.js +2 -2
  85. package/dist/components/p-leaf.js +2 -2
  86. package/dist/components/p-modal-preview.js +4 -4
  87. package/dist/components/p-modal.js +1 -1
  88. package/dist/components/p-notification-handler.d.ts +11 -0
  89. package/dist/components/p-notification-handler.js +8 -0
  90. package/dist/components/p-notification-handler.js.map +1 -0
  91. package/dist/components/p-notification-preview.d.ts +11 -0
  92. package/dist/components/p-notification-preview.js +87 -0
  93. package/dist/components/p-notification-preview.js.map +1 -0
  94. package/dist/components/p-notification.d.ts +11 -0
  95. package/dist/components/p-notification.js +8 -0
  96. package/dist/components/p-notification.js.map +1 -0
  97. package/dist/components/p-progress-bar.js +2 -2
  98. package/dist/components/p-slider.js +3 -3
  99. package/dist/components/p-switch-tile.js +3 -3
  100. package/dist/components/p-switch.js +4 -4
  101. package/dist/components/p-tab.js +3 -3
  102. package/dist/components/p-tabs.js +4 -4
  103. package/dist/components/p-tooltip.js +2 -2
  104. package/dist/esm/{index-4646b002.js → index-7ee4e700.js} +39 -6
  105. package/dist/esm/index-7ee4e700.js.map +1 -0
  106. package/dist/esm/loader.js +3 -3
  107. package/dist/esm/p-accordion.entry.js +4 -4
  108. package/dist/esm/p-alert.entry.js +2 -2
  109. package/dist/esm/p-badge.entry.js +2 -2
  110. package/dist/esm/p-breadcrumb-item.entry.js +2 -2
  111. package/dist/esm/p-breadcrumb.entry.js +2 -2
  112. package/dist/esm/{p-dropdown_2.entry.js → p-button_3.entry.js} +55 -7
  113. package/dist/esm/p-button_3.entry.js.map +1 -0
  114. package/dist/esm/p-dropdown-preview.entry.js +2 -2
  115. package/dist/esm/p-input-text.entry.js +2 -2
  116. package/dist/esm/p-leaf.entry.js +2 -2
  117. package/dist/esm/p-modal-preview.entry.js +2 -2
  118. package/dist/esm/p-modal.entry.js +27 -0
  119. package/dist/esm/p-modal.entry.js.map +1 -0
  120. package/dist/esm/p-notification-handler.entry.js +53 -0
  121. package/dist/esm/p-notification-handler.entry.js.map +1 -0
  122. package/dist/esm/p-notification-preview.entry.js +37 -0
  123. package/dist/esm/p-notification-preview.entry.js.map +1 -0
  124. package/dist/esm/p-notification.entry.js +60 -0
  125. package/dist/esm/p-notification.entry.js.map +1 -0
  126. package/dist/esm/p-progress-bar.entry.js +2 -2
  127. package/dist/esm/p-slider.entry.js +3 -3
  128. package/dist/esm/p-switch-tile.entry.js +3 -3
  129. package/dist/esm/p-switch.entry.js +4 -4
  130. package/dist/esm/p-tab.entry.js +3 -3
  131. package/dist/esm/p-tabs.entry.js +4 -4
  132. package/dist/esm/p-tooltip.entry.js +2 -2
  133. package/dist/esm/papierjs.js +3 -3
  134. package/dist/papierjs/{p-f21b09d8.entry.js → p-21ae2040.entry.js} +2 -2
  135. package/dist/papierjs/{p-005736fe.entry.js → p-3149398f.entry.js} +2 -2
  136. package/dist/papierjs/p-34a520d8.js +3 -0
  137. package/dist/papierjs/p-34a520d8.js.map +1 -0
  138. package/dist/papierjs/p-4de54c9d.entry.js +2 -0
  139. package/dist/papierjs/p-4de54c9d.entry.js.map +1 -0
  140. package/dist/papierjs/p-4e8985c5.entry.js +2 -0
  141. package/dist/papierjs/p-4e8985c5.entry.js.map +1 -0
  142. package/dist/papierjs/{p-08ab91b8.entry.js → p-4ef52ae1.entry.js} +2 -2
  143. package/dist/papierjs/{p-b5ab3669.entry.js → p-55975574.entry.js} +2 -2
  144. package/dist/papierjs/p-57f13bee.entry.js +2 -0
  145. package/dist/papierjs/p-5e68bd6c.entry.js +2 -0
  146. package/dist/papierjs/p-5e68bd6c.entry.js.map +1 -0
  147. package/dist/papierjs/{p-8a2f9883.entry.js → p-743abca9.entry.js} +2 -2
  148. package/dist/papierjs/p-7b6c5a15.entry.js +2 -0
  149. package/dist/papierjs/p-7b6c5a15.entry.js.map +1 -0
  150. package/dist/papierjs/{p-2a173336.entry.js → p-963f21b8.entry.js} +2 -2
  151. package/dist/papierjs/{p-6af8d60e.entry.js → p-a2523f10.entry.js} +2 -2
  152. package/dist/papierjs/{p-d98c84b2.entry.js → p-a40b185f.entry.js} +2 -2
  153. package/dist/papierjs/{p-dfbbdb7b.entry.js → p-acf916fa.entry.js} +2 -2
  154. package/dist/papierjs/{p-ba661e41.entry.js → p-b783633d.entry.js} +2 -2
  155. package/dist/papierjs/p-bc16a85a.entry.js +2 -0
  156. package/dist/papierjs/p-bc16a85a.entry.js.map +1 -0
  157. package/dist/papierjs/{p-deb8c796.entry.js → p-d583fd92.entry.js} +2 -2
  158. package/dist/papierjs/{p-5a7955a5.entry.js → p-d9e3c9ca.entry.js} +2 -2
  159. package/dist/papierjs/{p-e6765c48.entry.js → p-edbf5d19.entry.js} +2 -2
  160. package/dist/papierjs/{p-5f1c0163.entry.js → p-ef8536b9.entry.js} +2 -2
  161. package/dist/papierjs/{p-3231294d.entry.js → p-f7bc7154.entry.js} +2 -2
  162. package/dist/papierjs/papierjs.esm.js +1 -1
  163. package/dist/papierjs/papierjs.esm.js.map +1 -1
  164. package/dist/types/components/notification/p-notification/p-notification.d.ts +16 -0
  165. package/dist/types/components/notification/p-notification-handler/p-notification-handler.d.ts +18 -0
  166. package/dist/types/components/notification/p-notification-handler/stories/p-notification-preview.d.ts +7 -0
  167. package/dist/types/components.d.ts +66 -0
  168. package/package.json +1 -1
  169. package/readme.md +4 -4
  170. package/dist/cjs/index-82a72b67.js.map +0 -1
  171. package/dist/cjs/p-button_2.cjs.entry.js +0 -80
  172. package/dist/cjs/p-button_2.cjs.entry.js.map +0 -1
  173. package/dist/cjs/p-dropdown_2.cjs.entry.js.map +0 -1
  174. package/dist/components/p-eea4fbc1.js.map +0 -1
  175. package/dist/esm/index-4646b002.js.map +0 -1
  176. package/dist/esm/p-button_2.entry.js +0 -75
  177. package/dist/esm/p-button_2.entry.js.map +0 -1
  178. package/dist/esm/p-dropdown_2.entry.js.map +0 -1
  179. package/dist/papierjs/p-2f044192.entry.js +0 -2
  180. package/dist/papierjs/p-2f044192.entry.js.map +0 -1
  181. package/dist/papierjs/p-4ed82d68.js +0 -3
  182. package/dist/papierjs/p-4ed82d68.js.map +0 -1
  183. package/dist/papierjs/p-a3c7e705.entry.js +0 -2
  184. package/dist/papierjs/p-fc85498a.entry.js +0 -2
  185. package/dist/papierjs/p-fc85498a.entry.js.map +0 -1
  186. /package/dist/papierjs/{p-f21b09d8.entry.js.map → p-21ae2040.entry.js.map} +0 -0
  187. /package/dist/papierjs/{p-005736fe.entry.js.map → p-3149398f.entry.js.map} +0 -0
  188. /package/dist/papierjs/{p-08ab91b8.entry.js.map → p-4ef52ae1.entry.js.map} +0 -0
  189. /package/dist/papierjs/{p-b5ab3669.entry.js.map → p-55975574.entry.js.map} +0 -0
  190. /package/dist/papierjs/{p-a3c7e705.entry.js.map → p-57f13bee.entry.js.map} +0 -0
  191. /package/dist/papierjs/{p-8a2f9883.entry.js.map → p-743abca9.entry.js.map} +0 -0
  192. /package/dist/papierjs/{p-2a173336.entry.js.map → p-963f21b8.entry.js.map} +0 -0
  193. /package/dist/papierjs/{p-6af8d60e.entry.js.map → p-a2523f10.entry.js.map} +0 -0
  194. /package/dist/papierjs/{p-d98c84b2.entry.js.map → p-a40b185f.entry.js.map} +0 -0
  195. /package/dist/papierjs/{p-dfbbdb7b.entry.js.map → p-acf916fa.entry.js.map} +0 -0
  196. /package/dist/papierjs/{p-ba661e41.entry.js.map → p-b783633d.entry.js.map} +0 -0
  197. /package/dist/papierjs/{p-deb8c796.entry.js.map → p-d583fd92.entry.js.map} +0 -0
  198. /package/dist/papierjs/{p-5a7955a5.entry.js.map → p-d9e3c9ca.entry.js.map} +0 -0
  199. /package/dist/papierjs/{p-e6765c48.entry.js.map → p-edbf5d19.entry.js.map} +0 -0
  200. /package/dist/papierjs/{p-5f1c0163.entry.js.map → p-ef8536b9.entry.js.map} +0 -0
  201. /package/dist/papierjs/{p-3231294d.entry.js.map → p-f7bc7154.entry.js.map} +0 -0
@@ -0,0 +1,164 @@
1
+ import { Host, h, } from "@stencil/core";
2
+ import feather from "feather-icons";
3
+ export class PNotification {
4
+ constructor() {
5
+ this.type = 'info';
6
+ this.text = '';
7
+ this.canclose = false;
8
+ this.timestamp = '';
9
+ }
10
+ getIconName() {
11
+ switch (this.type) {
12
+ case 'primary':
13
+ return feather.icons.info.toSvg();
14
+ case 'warning':
15
+ return feather.icons['alert-triangle'].toSvg();
16
+ case 'danger':
17
+ return feather.icons['alert-circle'].toSvg();
18
+ case 'success':
19
+ return feather.icons['check-circle'].toSvg();
20
+ default:
21
+ return feather.icons.info.toSvg();
22
+ }
23
+ }
24
+ getClassName() {
25
+ const cssClass = {
26
+ alert: true,
27
+ 'can--close': this.canclose,
28
+ };
29
+ const type = [
30
+ 'primary',
31
+ 'secondary',
32
+ 'success',
33
+ 'warning',
34
+ 'danger',
35
+ ].find((v) => v === this.type);
36
+ cssClass[`alert-${type || 'primary'}`] = true;
37
+ return cssClass;
38
+ }
39
+ onClose() {
40
+ console.debug('on close baby');
41
+ this.close.emit(this.timestamp);
42
+ }
43
+ render() {
44
+ return (h(Host, { key: 'ca862c36f4286b20d8c957311728b5b8b7572c14' }, h("div", { key: '739c685f45b963303481799168a73ef7fd239db4', class: "papier" }, h("div", { key: '98ded37d6cfc45fc70d5b1579d4ad2dff1db55ee', class: this.getClassName() }, h("div", { key: 'e78c92b7a8ed0d540ffa57bfb0e7dd61512f0725', innerHTML: this.getIconName() }), h("div", { key: '37430e196744a4b87db55c157e521ef34836d461', innerHTML: this.text }), this.canclose && (h("span", { key: '3c639b245f622723b1fd814ecc94d094faa052f1', onClick: () => {
45
+ this.onClose();
46
+ }, innerHTML: feather.icons.x.toSvg() }))))));
47
+ }
48
+ static get is() { return "p-notification"; }
49
+ static get encapsulation() { return "shadow"; }
50
+ static get originalStyleUrls() {
51
+ return {
52
+ "$": ["p-notification.scss"]
53
+ };
54
+ }
55
+ static get styleUrls() {
56
+ return {
57
+ "$": ["p-notification.css"]
58
+ };
59
+ }
60
+ static get properties() {
61
+ return {
62
+ "type": {
63
+ "type": "string",
64
+ "mutable": false,
65
+ "complexType": {
66
+ "original": "string",
67
+ "resolved": "string",
68
+ "references": {}
69
+ },
70
+ "required": false,
71
+ "optional": true,
72
+ "docs": {
73
+ "tags": [],
74
+ "text": ""
75
+ },
76
+ "getter": false,
77
+ "setter": false,
78
+ "attribute": "type",
79
+ "reflect": false,
80
+ "defaultValue": "'info'"
81
+ },
82
+ "text": {
83
+ "type": "string",
84
+ "mutable": false,
85
+ "complexType": {
86
+ "original": "string",
87
+ "resolved": "string",
88
+ "references": {}
89
+ },
90
+ "required": false,
91
+ "optional": false,
92
+ "docs": {
93
+ "tags": [],
94
+ "text": ""
95
+ },
96
+ "getter": false,
97
+ "setter": false,
98
+ "attribute": "text",
99
+ "reflect": false,
100
+ "defaultValue": "''"
101
+ },
102
+ "canclose": {
103
+ "type": "boolean",
104
+ "mutable": false,
105
+ "complexType": {
106
+ "original": "boolean",
107
+ "resolved": "boolean",
108
+ "references": {}
109
+ },
110
+ "required": false,
111
+ "optional": false,
112
+ "docs": {
113
+ "tags": [],
114
+ "text": ""
115
+ },
116
+ "getter": false,
117
+ "setter": false,
118
+ "attribute": "canclose",
119
+ "reflect": false,
120
+ "defaultValue": "false"
121
+ },
122
+ "timestamp": {
123
+ "type": "string",
124
+ "mutable": false,
125
+ "complexType": {
126
+ "original": "string",
127
+ "resolved": "string",
128
+ "references": {}
129
+ },
130
+ "required": false,
131
+ "optional": false,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": ""
135
+ },
136
+ "getter": false,
137
+ "setter": false,
138
+ "attribute": "timestamp",
139
+ "reflect": false,
140
+ "defaultValue": "''"
141
+ }
142
+ };
143
+ }
144
+ static get events() {
145
+ return [{
146
+ "method": "close",
147
+ "name": "close",
148
+ "bubbles": true,
149
+ "cancelable": true,
150
+ "composed": true,
151
+ "docs": {
152
+ "tags": [],
153
+ "text": ""
154
+ },
155
+ "complexType": {
156
+ "original": "string",
157
+ "resolved": "string",
158
+ "references": {}
159
+ }
160
+ }];
161
+ }
162
+ static get elementRef() { return "el"; }
163
+ }
164
+ //# sourceMappingURL=p-notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"p-notification.js","sourceRoot":"","sources":["../../../../src/components/notification/p-notification/p-notification.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,CAAC,GACJ,MAAM,eAAe,CAAA;AACtB,OAAO,OAAO,MAAM,eAAe,CAAA;AAOnC,MAAM,OAAO,aAAa;IAL1B;QAUW,SAAI,GAAY,MAAM,CAA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AK,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE;oBAC3B,4DAAK,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,GAAI;oBACtC,4DAAK,SAAS,EAAE,IAAI,CAAC,IAAI,GAAI;oBAC5B,IAAI,CAAC,QAAQ,IAAI,CACd,6DACI,OAAO,EAAE,GAAG,EAAE;4BACV,IAAI,CAAC,OAAO,EAAE,CAAA;wBAClB,CAAC,EACD,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,GACpC,CACL,CACC,CACJ,CACH,CACV,CAAA;IACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n Event,\n type EventEmitter,\n Host,\n Prop,\n h,\n} from '@stencil/core'\nimport feather from 'feather-icons'\n\n@Component({\n tag: 'p-notification',\n styleUrl: 'p-notification.scss',\n shadow: true,\n})\nexport class PNotification {\n @Element()\n public el: HTMLElement\n\n @Prop()\n public type?: string = 'info'\n\n @Prop()\n public text = ''\n\n @Prop()\n public canclose = false\n\n @Prop()\n public timestamp = ''\n\n @Event({ eventName: 'close' })\n public close: EventEmitter<string>\n\n public getIconName() {\n switch (this.type) {\n case 'primary':\n return feather.icons.info.toSvg()\n case 'warning':\n return feather.icons['alert-triangle'].toSvg()\n case 'danger':\n return feather.icons['alert-circle'].toSvg()\n case 'success':\n return feather.icons['check-circle'].toSvg()\n default:\n return feather.icons.info.toSvg()\n }\n }\n\n public getClassName() {\n const cssClass = {\n alert: true,\n 'can--close': this.canclose,\n }\n const type = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n ].find((v) => v === this.type)\n cssClass[`alert-${type || 'primary'}`] = true\n\n return cssClass\n }\n\n private onClose() {\n console.debug('on close baby')\n this.close.emit(this.timestamp)\n }\n\n render() {\n return (\n <Host>\n <div class=\"papier\">\n <div class={this.getClassName()}>\n <div innerHTML={this.getIconName()} />\n <div innerHTML={this.text} />\n {this.canclose && (\n <span\n onClick={() => {\n this.onClose()\n }}\n innerHTML={feather.icons.x.toSvg()}\n />\n )}\n </div>\n </div>\n </Host>\n )\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ :host {
2
+ pointer-events: none;
3
+ display: flex;
4
+ flex-direction: column;
5
+ justify-content: center;
6
+ row-gap: 8px;
7
+ position: fixed;
8
+ top: 40px;
9
+ margin: auto 80px;
10
+ left: 0;
11
+ right: 0;
12
+ z-index: 9999;
13
+ }
@@ -0,0 +1,100 @@
1
+ import { Host, h } from "@stencil/core";
2
+ export class PNotificationHandler {
3
+ constructor() {
4
+ this.notifications = [];
5
+ }
6
+ async pushNotification(options) {
7
+ const { type, text, canclose, timeout } = options;
8
+ const timestamp = String(new Date().getTime());
9
+ this.notifications = [
10
+ ...this.notifications,
11
+ {
12
+ type,
13
+ text,
14
+ canclose,
15
+ timestamp,
16
+ },
17
+ ];
18
+ if (!timeout)
19
+ return;
20
+ setTimeout(() => {
21
+ const notification = this.notifications.find((toast) => {
22
+ return toast.timestamp === timestamp;
23
+ });
24
+ if (notification) {
25
+ this.removeToast(timestamp);
26
+ }
27
+ }, timeout);
28
+ }
29
+ removeToast(timestamp) {
30
+ this.notifications = this.notifications.filter((toast) => {
31
+ return toast.timestamp !== timestamp;
32
+ });
33
+ }
34
+ closeToastHandler(event) {
35
+ this.removeToast(event.detail);
36
+ }
37
+ mapNotifications() {
38
+ return this.notifications.map((toast) => (h("p-notification", { key: toast.type, type: toast.type, text: toast.text, canclose: toast.canclose, timestamp: toast.timestamp })));
39
+ }
40
+ render() {
41
+ return h(Host, { key: '7b1d1a23ed6a286ecca50ac9219876202cae55be' }, this.mapNotifications());
42
+ }
43
+ static get is() { return "p-notification-handler"; }
44
+ static get encapsulation() { return "shadow"; }
45
+ static get originalStyleUrls() {
46
+ return {
47
+ "$": ["p-notification-handler.scss"]
48
+ };
49
+ }
50
+ static get styleUrls() {
51
+ return {
52
+ "$": ["p-notification-handler.css"]
53
+ };
54
+ }
55
+ static get states() {
56
+ return {
57
+ "notifications": {}
58
+ };
59
+ }
60
+ static get methods() {
61
+ return {
62
+ "pushNotification": {
63
+ "complexType": {
64
+ "signature": "(options: PushOptions) => Promise<void>",
65
+ "parameters": [{
66
+ "name": "options",
67
+ "type": "{ type: string; text: string; canclose: boolean; timeout?: number; }",
68
+ "docs": ""
69
+ }],
70
+ "references": {
71
+ "Promise": {
72
+ "location": "global",
73
+ "id": "global::Promise"
74
+ },
75
+ "PushOptions": {
76
+ "location": "local",
77
+ "path": "/Users/antoinemiceli/Projects/Github/papierjs/src/components/notification/p-notification-handler/p-notification-handler.tsx",
78
+ "id": "src/components/notification/p-notification-handler/p-notification-handler.tsx::PushOptions"
79
+ }
80
+ },
81
+ "return": "Promise<void>"
82
+ },
83
+ "docs": {
84
+ "text": "",
85
+ "tags": []
86
+ }
87
+ }
88
+ };
89
+ }
90
+ static get listeners() {
91
+ return [{
92
+ "name": "close",
93
+ "method": "closeToastHandler",
94
+ "target": undefined,
95
+ "capture": false,
96
+ "passive": false
97
+ }];
98
+ }
99
+ }
100
+ //# sourceMappingURL=p-notification-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"p-notification-handler.js","sourceRoot":"","sources":["../../../../src/components/notification/p-notification-handler/p-notification-handler.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AAkBzE,MAAM,OAAO,oBAAoB;IALjC;QAOW,kBAAa,GAAmB,EAAE,CAAA;KAsD5C;IAnDU,KAAK,CAAC,gBAAgB,CAAC,OAAoB;QAC9C,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;QACjD,MAAM,S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AC,gBAAgB,EAAE,CAAQ,CAAA;IACjD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Host, Listen, Method, State, h } from '@stencil/core'\n\nexport type PushOptions = {\n type: string\n text: string\n canclose: boolean\n timeout?: number\n}\n\ntype Notification = PushOptions & {\n timestamp: string\n}\n\n@Component({\n tag: 'p-notification-handler',\n styleUrl: 'p-notification-handler.scss',\n shadow: true,\n})\nexport class PNotificationHandler {\n @State()\n public notifications: Notification[] = []\n\n @Method()\n public async pushNotification(options: PushOptions) {\n const { type, text, canclose, timeout } = options\n const timestamp = String(new Date().getTime())\n this.notifications = [\n ...this.notifications,\n {\n type,\n text,\n canclose,\n timestamp,\n },\n ]\n\n if (!timeout) return\n\n setTimeout(() => {\n const notification = this.notifications.find((toast) => {\n return toast.timestamp === timestamp\n })\n if (notification) {\n this.removeToast(timestamp)\n }\n }, timeout)\n }\n\n private removeToast(timestamp: string) {\n this.notifications = this.notifications.filter((toast) => {\n return toast.timestamp !== timestamp\n })\n }\n\n @Listen('close')\n public closeToastHandler(event: CustomEvent<string>) {\n this.removeToast(event.detail)\n }\n\n public mapNotifications() {\n return this.notifications.map((toast) => (\n <p-notification\n key={toast.type}\n type={toast.type}\n text={toast.text}\n canclose={toast.canclose}\n timestamp={toast.timestamp}\n />\n ))\n }\n\n render() {\n return <Host>{this.mapNotifications()}</Host>\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import { h } from "@stencil/core";
2
+ export class PNotification {
3
+ addNotification(options) {
4
+ const handler = this.el.querySelector('p-notification-handler');
5
+ if (handler) {
6
+ handler.pushNotification(Object.assign({ type: this.notificationType, canclose: false, text: `${this.notificationType || 'primary'} notification` }, options));
7
+ }
8
+ }
9
+ render() {
10
+ return (h("div", { key: 'a8249a75ec65b727c90914ce2e684b9bf3697945' }, h("p-notification-handler", { key: '664695f2c9fafdfc68bd092096c9ca6ddd0359f6' }), h("p-dropdown", { key: 'da5dc45e74d800b221f6833aabc19a40e0cca57b', placeholder: "Choose notification type", onSelect: (e) => {
11
+ this.notificationType = e.detail;
12
+ } }, [
13
+ 'primary',
14
+ 'secondary',
15
+ 'success',
16
+ 'warning',
17
+ 'danger',
18
+ ].map((value) => {
19
+ return (h("p-dropdown-item", { key: value, value: value }, value));
20
+ })), h("div", { key: '1d4cf0a74eecda4aa147541ceea1d8f99ece39b2', style: { marginTop: '20px' } }, h("p-button", { key: '348695d918d61dd858e6c660caa2a73e9e3ded79', style: { marginRight: '20px' }, type: "primary", onClick: () => {
21
+ this.addNotification({});
22
+ } }, "Add notification"), h("p-button", { key: '0e6cc40f30f61cf28013dfc697e183db27097499', type: "secondary", style: { marginRight: '20px' }, onClick: () => {
23
+ this.addNotification({ canclose: true });
24
+ } }, "Add closable notification"), h("p-button", { key: '0648fbaeec551c170a5ea9680cb8770bec229a1b', type: "success", onClick: () => {
25
+ this.addNotification({ timeout: 2000 });
26
+ } }, "Add timeout notification"))));
27
+ }
28
+ static get is() { return "p-notification-preview"; }
29
+ static get states() {
30
+ return {
31
+ "notificationType": {}
32
+ };
33
+ }
34
+ static get elementRef() { return "el"; }
35
+ }
36
+ //# sourceMappingURL=p-notification-preview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"p-notification-preview.js","sourceRoot":"","sources":["../../../../../src/components/notification/p-notification-handler/stories/p-notification-preview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AAM5D,MAAM,OAAO,aAAa;IAOf,eAAe,CAAC,OAA6B;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAA;QAE/D,IAAI,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,gBAAgB,iBACpB,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAC3B,QAAQ,EAAE,KAAK,EACf,IAAI,EAAE,GAAG,IAAI,CAAC,gBAAgB,IAAI,SAAS,eAAe,IACvD,OAAO,EACZ,CAAA;QACN,CAAC;IACL,CAAC;IAED,MAAM;QACF,OAAO,CACH;YACI,gFAA0B;YAC1B,mEACI,WAAW,EAAC,0BAA0B,EACtC,QAAQ,EAAE,CAAC,CAAc,EAAE,EAAE;oBACzB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAA;gBACpC,CAAC,IAEA;gBACG,SAAS;gBACT,WAAW;gBACX,SAAS;gBACT,SAAS;gBACT,QAAQ;aACX,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACZ,OAAO,CACH,uBAAiB,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,IACpC,KAAK,CACQ,CACrB,CAAA;YACL,CAAC,CAAC,CACO;YAEb,4DAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;gBAC7B,iEACI,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,EAC9B,IAAI,EAAC,SAAS,EACd,OAAO,EAAE,GAAG,EAAE;wBACV,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;oBAC5B,CAAC,uBAGM;gBACX,iEACI,IAAI,EAAC,WAAW,EAChB,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,EAC9B,OAAO,EAAE,GAAG,EAAE;wBACV,IAAI,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;oBAC5C,CAAC,gCAGM;gBACX,iEACI,IAAI,EAAC,SAAS,EACd,OAAO,EAAE,GAAG,EAAE;wBACV,IAAI,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;oBAC3C,CAAC,+BAGM,CACT,CACJ,CACT,CAAA;IACL,CAAC;;;;;;CACJ","sourcesContent":["import { Component, Element, State, h } from '@stencil/core'\nimport type { PushOptions } from '../p-notification-handler'\n\n@Component({\n tag: 'p-notification-preview',\n})\nexport class PNotification {\n @Element()\n public el: HTMLElement\n\n @State()\n notificationType?: string\n\n public addNotification(options: Partial<PushOptions>) {\n const handler = this.el.querySelector('p-notification-handler')\n\n if (handler) {\n handler.pushNotification({\n type: this.notificationType,\n canclose: false,\n text: `${this.notificationType || 'primary'} notification`,\n ...options,\n })\n }\n }\n\n render() {\n return (\n <div>\n <p-notification-handler />\n <p-dropdown\n placeholder=\"Choose notification type\"\n onSelect={(e: CustomEvent) => {\n this.notificationType = e.detail\n }}\n >\n {[\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n ].map((value) => {\n return (\n <p-dropdown-item key={value} value={value}>\n {value}\n </p-dropdown-item>\n )\n })}\n </p-dropdown>\n\n <div style={{ marginTop: '20px' }}>\n <p-button\n style={{ marginRight: '20px' }}\n type=\"primary\"\n onClick={() => {\n this.addNotification({})\n }}\n >\n Add notification\n </p-button>\n <p-button\n type=\"secondary\"\n style={{ marginRight: '20px' }}\n onClick={() => {\n this.addNotification({ canclose: true })\n }}\n >\n Add closable notification\n </p-button>\n <p-button\n type=\"success\"\n onClick={() => {\n this.addNotification({ timeout: 2000 })\n }}\n >\n Add timeout notification\n </p-button>\n </div>\n </div>\n )\n }\n}\n"]}
@@ -36,7 +36,7 @@ export class ProgressBar {
36
36
  return cssClass;
37
37
  }
38
38
  render() {
39
- return (h("div", { key: '265866ff4d3f95b7741c828b25723e7793732e4f', class: this.getParentClass() }, h("div", { key: '6fb4ff19a6d42104d4fc574e977fc30eed1087fb', class: "progress" }, h("div", { key: '028c08f43d0b0ffe4d6fa8e643fa6fc026ae805d', class: this.getClass() }, h("slot", { key: '7f9f94d272c7796b1a72b3268d8c5910f7571bf8' })))));
39
+ return (h("div", { key: '20e868c53ea4b6726c934b00a96a96af5fd90735', class: this.getParentClass() }, h("div", { key: '9844c710e50a284db3854a4f375578bfb0936ba1', class: "progress" }, h("div", { key: '11e92c1aadfe9f305347cfb10404179756d861f1', class: this.getClass() }, h("slot", { key: '4810e3c69cd5cb77b7767fff9fdbd617f0e38223' })))));
40
40
  }
41
41
  static get is() { return "p-progress-bar"; }
42
42
  static get encapsulation() { return "shadow"; }
@@ -5,11 +5,11 @@ export class PTab {
5
5
  this.dark = false;
6
6
  }
7
7
  render() {
8
- return (h(Host, { key: '2dcda2fa7d7868c55f503308626f86a8bf43dfb8' }, h("div", { key: 'fbcca0ed3f6cea8e697b687b8abb5555f8b75044', class: {
8
+ return (h(Host, { key: '29336150bccaf6a1ec95231fdfbc560c7027bdaf' }, h("div", { key: 'a55e95646d7772e26f7d65706e096271bd642fb2', class: {
9
9
  papier: true,
10
10
  'is--selected': this.selected,
11
11
  'is--dark': this.dark,
12
- } }, h("slot", { key: '5d150082f08ae4e05af71d965b3b7845b3e6155a' }))));
12
+ } }, h("slot", { key: '79283e0f890d83ebf5ef388b78ac7d9a1a9dfb2c' }))));
13
13
  }
14
14
  static get is() { return "p-tab"; }
15
15
  static get encapsulation() { return "shadow"; }
@@ -44,12 +44,12 @@ export class PTabs {
44
44
  };
45
45
  }
46
46
  render() {
47
- return (h(Host, { key: 'da40a21de1a04bfbe55ca13d13bb42f18711bccc' }, h("div", { key: '57ae24e8054245c0148eeedffa3e022c107a9457', class: {
47
+ return (h(Host, { key: '0c78c9ce416e99234c2db3aee9607c80758ca594' }, h("div", { key: 'e934889da2cc7c65b00807f37887adc1330b52fe', class: {
48
48
  'is--dark': this.dark,
49
49
  papier: true,
50
- } }, h("div", { key: 'aff4aa296e27b60428a6163d1122e9811b8e3f8c', class: "row flex-spaces tabs" }, this.tabs.map((t) => {
50
+ } }, h("div", { key: '38501e443b9b04ab2f276232c4060fb2fa969a89', class: "row flex-spaces tabs" }, this.tabs.map((t) => {
51
51
  return (h("label", { class: this.getTabClass(t), htmlFor: "tab1", key: t.title, onClick: () => this.onSelectTab(t) }, t.title));
52
- }), h("div", { key: '79bfdea23e0aced78e2fb7f94f3b1b13c5a05562', class: "content" }, h("slot", { key: '40c497f849e95b148ccf1be29f1379de2b9c15a6' }))))));
52
+ }), h("div", { key: '19546aed34979d4630348b64a4ddcac48333e671', class: "content" }, h("slot", { key: 'b9e5992eec171cdcbb3332f8047468a4751f594d' }))))));
53
53
  }
54
54
  static get is() { return "p-tabs"; }
55
55
  static get encapsulation() { return "shadow"; }
@@ -8,7 +8,7 @@ export class PTooltip {
8
8
  this.top = false;
9
9
  }
10
10
  render() {
11
- return (h(Host, { key: 'bbb4b01e07ebaaf9de17a06afccd000e2ae7a6c5' }, h("div", { key: '6c2ac0466932ceb2187c6549787a6d5efe4fcde5', class: "papier" }, h("div", { key: '55e0a5c7a37966262d70887de69fadb795a81711', "popover-left": this.left && !this.disabled ? this.title : null, "popover-right": this.right && !this.disabled ? this.title : null, "popover-bottom": this.bottom && !this.disabled ? this.title : null, "popover-top": this.top && !this.disabled ? this.title : null }, h("slot", { key: '382e0f88097067dd16a6d925a9c9d97044e81126' })))));
11
+ return (h(Host, { key: 'da2470d96d915e91915fba74a644acb21c9af74b' }, h("div", { key: '3913b807488a7591aab79d33b05f46d70c127c5b', class: "papier" }, h("div", { key: 'b7b8b48b77dde291ea1b893a806f0b4e43f77eeb', "popover-left": this.left && !this.disabled ? this.title : null, "popover-right": this.right && !this.disabled ? this.title : null, "popover-bottom": this.bottom && !this.disabled ? this.title : null, "popover-top": this.top && !this.disabled ? this.title : null }, h("slot", { key: '82aec744a324e1ac8dab4eca236401135366fdb0' })))));
12
12
  }
13
13
  static get is() { return "p-tooltip"; }
14
14
  static get encapsulation() { return "shadow"; }
@@ -1,3 +1,3 @@
1
- export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-eea4fbc1.js';
1
+ export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-af62ba98.js';
2
2
 
3
3
  //# sourceMappingURL=index.js.map