@salla.sa/twilight-components 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/cjs/index-6ea83d19.js +1619 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/cjs/salla-alert_3.cjs.entry.js +171 -0
  7. package/dist/cjs/salla-modal.cjs.entry.js +52 -0
  8. package/dist/cjs/twilight-components.cjs.js +19 -0
  9. package/dist/collection/collection-manifest.json +15 -0
  10. package/dist/collection/components/alert/alert.css +112 -0
  11. package/dist/collection/components/alert/alert.js +194 -0
  12. package/dist/collection/components/generate-summary.js +35 -0
  13. package/dist/collection/components/modal/modal.css +158 -0
  14. package/dist/collection/components/modal/modal.js +180 -0
  15. package/dist/collection/components/salla-login/salla-login.css +104 -0
  16. package/dist/collection/components/salla-login/salla-login.js +113 -0
  17. package/dist/collection/components/search-modal/search-modal.css +0 -0
  18. package/dist/collection/components/search-modal/search-modal.js +126 -0
  19. package/dist/collection/index.js +1 -0
  20. package/dist/collection/interfaces/colors.js +1 -0
  21. package/dist/collection/interfaces/index.js +2 -0
  22. package/dist/collection/interfaces/ratio.js +1 -0
  23. package/dist/collection/plugins/tailwind-theme/index.js +35 -0
  24. package/dist/collection/plugins/tailwind-theme/scripts/generator.js +51 -0
  25. package/dist/collection/utils/utils.js +16 -0
  26. package/dist/esm/index-3c2b0663.js +1591 -0
  27. package/dist/esm/index.js +1 -0
  28. package/dist/esm/loader.js +17 -0
  29. package/dist/esm/polyfills/core-js.js +11 -0
  30. package/dist/esm/polyfills/css-shim.js +1 -0
  31. package/dist/esm/polyfills/dom.js +79 -0
  32. package/dist/esm/polyfills/es5-html-element.js +1 -0
  33. package/dist/esm/polyfills/index.js +34 -0
  34. package/dist/esm/polyfills/system.js +6 -0
  35. package/dist/esm/salla-alert_3.entry.js +165 -0
  36. package/dist/esm/salla-modal.entry.js +48 -0
  37. package/dist/esm/twilight-components.js +17 -0
  38. package/dist/index.cjs.js +1 -0
  39. package/dist/index.js +1 -0
  40. package/dist/twilight-components/index.esm.js +0 -0
  41. package/dist/twilight-components/p-58168e3c.entry.js +1 -0
  42. package/dist/twilight-components/p-a2a8cae2.entry.js +1 -0
  43. package/dist/twilight-components/p-e1773073.js +1 -0
  44. package/dist/twilight-components/twilight-components.esm.js +1 -0
  45. package/dist/types/components/alert/alert.d.ts +38 -0
  46. package/dist/types/components/modal/modal.d.ts +28 -0
  47. package/dist/types/components/salla-login/salla-login.d.ts +14 -0
  48. package/dist/types/components/search-modal/search-modal.d.ts +22 -0
  49. package/dist/types/components.d.ts +188 -0
  50. package/dist/types/index.d.ts +1 -0
  51. package/dist/types/interfaces/colors.d.ts +1 -0
  52. package/dist/types/interfaces/index.d.ts +2 -0
  53. package/dist/types/interfaces/ratio.d.ts +1 -0
  54. package/dist/types/stencil-public-runtime.d.ts +1563 -0
  55. package/dist/types/utils/utils.d.ts +6 -0
  56. package/loader/cdn.js +3 -0
  57. package/loader/index.cjs.js +3 -0
  58. package/loader/index.d.ts +13 -0
  59. package/loader/index.es2017.js +3 -0
  60. package/loader/index.js +4 -0
  61. package/loader/package.json +10 -0
  62. package/package.json +66 -0
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-6ea83d19.js');
6
+
7
+ /*
8
+ Stencil Client Patch Esm v2.8.1 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchEsm = () => {
11
+ return index.promiseResolve();
12
+ };
13
+
14
+ const defineCustomElements = (win, options) => {
15
+ if (typeof window === 'undefined') return Promise.resolve();
16
+ return patchEsm().then(() => {
17
+ return index.bootstrapLazy([["salla-alert_3.cjs",[[6,"salla-alert",{"color":[1],"autoClose":[4,"auto-close"],"closeSecs":[2,"close-secs"],"closeable":[4],"closeText":[1,"close-text"],"rounded":[4],"countDownTimerId":[32]}],[1,"salla-login",{"searchIcon":[1,"search-icon"],"visible":[1540],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32]},[[8,"click","handleClick"]]],[0,"salla-search-modal",{"searchPlaceholder":[1,"search-placeholder"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]],["salla-modal.cjs",[[6,"salla-modal",{"modalTitle":[1,"modal-title"],"cancelText":[1,"cancel-text"],"saveText":[1,"save-text"],"visible":[1540],"modalHeader":[516,"modal-header"]}]]]], options);
18
+ });
19
+ };
20
+
21
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,171 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-6ea83d19.js');
6
+
7
+ const alertCss = ".sc-salla-alert-h{-webkit-font-smoothing:antialiased;padding:var(--padding-top, 8px) var(--padding-right, 16px) var(--padding-bottom, 8px) var(--padding-left, 16px);min-height:var(--height, 24px);color:var(--color, #fff);background-color:var(--background-color, #327bb7);border-color:transparent;font-family:var(--font-family, \"Helvetica Neue\", Helvetica, Arial, sans-serif);font-size:var(--font-size, 13px);font-weight:var(--font-weight, normal);line-height:1;position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center}.sc-salla-alert-h .alert__content.sc-salla-alert{display:block;height:100%;width:100%}.sc-salla-alert-h .alert__close-text.sc-salla-alert{cursor:pointer;opacity:0.7;position:absolute;top:14px;right:16px;font-size:0.8em}.sc-salla-alert-h .alert__close-text.sc-salla-alert:hover{opacity:0.85}.primary.sc-salla-alert-h{color:white;background-color:#5cd5c4}.secondary.sc-salla-alert-h{color:white;background-color:#ff7d09}.success.sc-salla-alert-h{color:white;background-color:#00c092}.warning.sc-salla-alert-h{color:white;background-color:#e8d700}.error.sc-salla-alert-h{color:white;background-color:#d0021b}.light.sc-salla-alert-h{color:black;background-color:#e5e5e5}.info.sc-salla-alert-h{color:black;background-color:#53ff5c}.dark.sc-salla-alert-h{color:white;background-color:#5d5d5d}.white.sc-salla-alert-h{color:black;background-color:white}.black.sc-salla-alert-h{color:white;background-color:black}.rounded.sc-salla-alert-h{border-radius:var(--border-radius, 4px)}";
8
+
9
+ const Alert = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.closed = index.createEvent(this, "closed", 7);
13
+ /**
14
+ * If `true` alert will close automatically.
15
+ */
16
+ this.autoClose = true;
17
+ /**
18
+ * Number of seconds to close alert automatically if autoClose `true`.
19
+ */
20
+ this.closeSecs = 3;
21
+ /**
22
+ * If closable or not.
23
+ */
24
+ this.closeable = true;
25
+ /**
26
+ * Customized close button text.
27
+ */
28
+ this.closeText = '\u2573';
29
+ /**
30
+ * If `true`, make the alert rounded.
31
+ */
32
+ this.rounded = false;
33
+ this.countDownTimerId = null;
34
+ this.close = () => {
35
+ this.closed.emit(true);
36
+ this.el.remove();
37
+ };
38
+ this.renderCloseText = () => {
39
+ if (this.closeable) {
40
+ return (index.h("span", { class: "alert__close-text", onClick: this.close }, this.closeText));
41
+ }
42
+ return null;
43
+ };
44
+ }
45
+ componentWillLoad() {
46
+ if (this.el.attributes['auto-close']) {
47
+ this.countDownTimerId = window.setTimeout(() => {
48
+ this.close();
49
+ }, this.closeSecs * 1000);
50
+ }
51
+ }
52
+ disconnectedCallback() {
53
+ if (this.autoClose) {
54
+ window.clearInterval(this.countDownTimerId);
55
+ }
56
+ }
57
+ render() {
58
+ return (index.h(index.Host, { class: {
59
+ [this.color]: true,
60
+ rounded: this.rounded,
61
+ } }, index.h("div", { class: "alert__content" }, index.h("slot", null)), this.renderCloseText()));
62
+ }
63
+ get el() { return index.getElement(this); }
64
+ };
65
+ Alert.style = alertCss;
66
+
67
+ const sallaLoginCss = ".wrapper{opacity:0;visibility:hidden;position:fixed;width:100%;height:100%;top:0;left:0;background:#fcfcfc;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;display:flex;align-items:center;justify-content:center;z-index:1050}.wrapper .modal{font-family:Helvetica, sans-serif;font-size:14px;background-color:#fff;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:90%;border:1px solid rgba(0, 0, 0, 0.2);border-radius:0.3rem}@media (min-width: 576px){.wrapper .modal{max-width:500px}}.wrapper .modal .displayed{display:flex}.wrapper .modal .modal-body{position:relative;-ms-flex:1 1 auto;flex:1 1 auto;padding:1rem}.visible{opacity:1;visibility:visible;transform:scale(1);transition:visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s}.hide{display:none !important}.show{display:block !important}.search-box{display:flex}.search-box input{width:100%;padding:10px;padding-inline-start:32px}.search-box button{background-color:transparent;border:0;position:absolute;padding:12px;left:12px}.results{list-style:none;padding:0;margin:0;max-height:300px;overflow-y:scroll}.results .product-img{width:50px;margin-inline-end:10px}.results a:first-child{margin-top:20px}.results a{display:flex;border-bottom:1px solid #ddd}.results a h5{margin-top:5px}";
68
+
69
+ const SallaLogin = class {
70
+ constructor(hostRef) {
71
+ index.registerInstance(this, hostRef);
72
+ this.fetchStatus = '';
73
+ this.searchIcon = 'Search_Icon.svg';
74
+ /**
75
+ * If 'true' will make the modal visible.
76
+ */
77
+ this.visible = false;
78
+ this.handleClose = () => {
79
+ this.visible = false;
80
+ };
81
+ }
82
+ handleClick(ev) {
83
+ if (!ev.path.some(x => x.className && x.className.includes('modal-body')) &&
84
+ ev.target.localName === 'salla-search-modal') {
85
+ this.visible = false;
86
+ }
87
+ }
88
+ render() {
89
+ return (index.h("div", { class: this.visible ? 'wrapper visible' : 'wrapper' }, index.h("div", { class: "modal" }, index.h("div", { class: 'modal-header' }, index.h("h5", { class: "title" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u064A \u0627\u0644\u0645\u0648\u0642\u0639"), index.h("button", { type: "button", class: "close", "data-dismiss": "modal", "aria-label": "Close", onClick: this.handleClose }, index.h("span", { "aria-hidden": "true" }, "\u00D7"))), index.h("div", { class: "modal-body" }, index.h("div", { id: "showLoginMethods" }, index.h("p", { class: "text-sm text-gray-text mb-5" }, "\u0627\u062E\u062A\u0631 \u0627\u0644\u0648\u0633\u064A\u0644\u0629 \u0627\u0644\u0645\u0646\u0627\u0633\u0628\u0629"), index.h("div", { id: "openEmailLogin", class: "mb-2.5 box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200" }, index.h("div", { class: "flex-shrink-0" }, index.h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, index.h("i", { class: "sicon-mail" }))), index.h("div", { class: "flex-1 min-w-0" }, index.h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, index.h("div", { class: "flex-1" }, index.h("span", { class: "absolute inset-0", "aria-hidden": "true" }), index.h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), index.h("h6", { class: "font-boldf" }, "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A")), index.h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))), index.h("div", { class: "box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200" }, index.h("div", { class: "flex-shrink-0" }, index.h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" }, index.h("i", { class: "sicon-phone" }))), index.h("div", { class: "flex-1 min-w-0" }, index.h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" }, index.h("div", { class: "flex-1" }, index.h("span", { class: "absolute inset-0", "aria-hidden": "true" }), index.h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"), index.h("h6", { class: "font-boldf" }, "\u0627\u0644\u0647\u0627\u062A\u0641")), index.h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))))))));
90
+ }
91
+ static get assetsDirs() { return ["assets"]; }
92
+ };
93
+ SallaLogin.style = sallaLoginCss;
94
+
95
+ const searchModalCss = "";
96
+
97
+ const SearchModal = class {
98
+ constructor(hostRef) {
99
+ index.registerInstance(this, hostRef);
100
+ this.fetchStatus = '';
101
+ this.showModal = false;
102
+ /**
103
+ * The text to overwrite search placeholder.
104
+ */
105
+ this.searchPlaceholder = 'Search here ...';
106
+ this.handleChange = event => {
107
+ this.searchTerm = event.target.value;
108
+ console.log('this.value', this.searchTerm);
109
+ this.fetchStatus = 'loading';
110
+ this.showResult = false;
111
+ this.results = [];
112
+ if (this.searchTerm.length > 2) {
113
+ window.salla.search.api
114
+ .search(this.searchTerm)
115
+ .then(response => response)
116
+ .then(response => {
117
+ console.log('response', response);
118
+ this.fetchStatus = 'idle';
119
+ this.results = response.results;
120
+ this.showResult = true;
121
+ if (this.results.length < 1) {
122
+ this.fetchStatus = 'error';
123
+ }
124
+ })
125
+ .catch(err => {
126
+ this.showResult = true;
127
+ this.fetchStatus = 'error';
128
+ console.log(err);
129
+ });
130
+ }
131
+ };
132
+ this.openSearch = () => {
133
+ console.log('openSearchModal');
134
+ this.searchTerm = '';
135
+ this.fetchStatus = '';
136
+ this.results = [];
137
+ this.showModal = true;
138
+ window.scrollTo(0, 0);
139
+ document.getElementsByTagName('html')[0].style.position = 'fixed';
140
+ document.getElementsByTagName('html')[0].style.overflowY = 'scroll';
141
+ //this.$nextTick(() => { this.$refs.searchInput.focus(); });
142
+ };
143
+ this.closeSearch = () => {
144
+ console.log('closeSearchModal');
145
+ this.searchTerm = '';
146
+ this.fetchStatus = '';
147
+ this.results = [];
148
+ document.getElementsByTagName('html')[0].style.position = 'static';
149
+ document.getElementsByTagName('html')[0].style.overflowY = 'auto';
150
+ this.showModal = false;
151
+ };
152
+ }
153
+ getProduct(item) {
154
+ var _a;
155
+ return (index.h("div", { key: item.id, class: "s-search-modal-results-item" }, index.h("div", { class: "s-search-modal-product" }, index.h("a", { target: "_blank", href: item.url, class: "s-search-modal-product-image-container" }, index.h("img", { class: "s-search-modal-product-image", src: item.thumb })), index.h("div", { class: "s-search-modal-product-details" }, index.h("div", { class: "s-search-modal-product-title" }, index.h("h3", { class: "s-search-modal-product-title-h3" }, item.title)), index.h("div", { class: "s-search-modal-product-price" }, index.h("h4", { class: "s-search-modal-product-price-h4" }, (_a = item.price) === null || _a === void 0 ? void 0 : _a.after))))));
156
+ }
157
+ render() {
158
+ return (index.h(index.Host, { class: "s-search-modal" }, index.h("button", { type: "button", onClick: this.openSearch, class: "s-search-modal-search-button-icon" }, index.h("i", { class: "sicon-search font-bold" })), this.showModal && (index.h("div", { class: "s-search-modal-container", style: { backgroundColor: 'rgba(0,0,0,0.5)' } }, index.h("div", { class: "s-search-modal-wrapper", onClick: this.closeSearch }, index.h("div", { class: "s-search-modal-inner" }, index.h("div", { class: "s-search-modal-search-box-container" }, index.h("div", { class: !this.showResult ? 's-search-modal-search-box-inner' : 's-search-modal-search-box-inner-open' }, index.h("input", { onClick: e => {
159
+ e.stopPropagation();
160
+ }, class: "s-search-modal-input", type: "text", placeholder: this.searchPlaceholder, value: this.searchTerm, onInput: event => this.handleChange(event) }), this.fetchStatus != 'loading' ? (index.h("button", { class: "s-search-modal-search-icon" }, index.h("i", { class: "sicon-search" }))) : (index.h("span", { class: "s-search-modal-spinner" }, index.h("span", { class: "s-search-modal-spinner-loader" }))))), index.h("div", { class: "s-search-modal-search-results" }, this.fetchStatus === 'error' && (index.h("p", { class: "s-search-modal-no-results error p-4 text-sm text-gray-text" }, "\u0644\u0627 \u064A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C")), this.results &&
161
+ this.results.map(item => {
162
+ return this.getProduct(item);
163
+ }))))))));
164
+ }
165
+ static get assetsDirs() { return ["assets"]; }
166
+ };
167
+ SearchModal.style = searchModalCss;
168
+
169
+ exports.salla_alert = Alert;
170
+ exports.salla_login = SallaLogin;
171
+ exports.salla_search_modal = SearchModal;
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-6ea83d19.js');
6
+
7
+ const modalCss = ".wrapper.sc-salla-modal{opacity:0;visibility:hidden;position:fixed;width:100%;height:100%;top:0;left:0;background:rgba(0, 0, 0, 0.42);-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;display:flex;align-items:center;justify-content:center;z-index:1050}.wrapper.sc-salla-modal .modal.sc-salla-modal{font-family:Helvetica, sans-serif;font-size:14px;background-color:#fff;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:90%;border:1px solid rgba(0, 0, 0, 0.2);border-radius:0.3rem}@media (min-width: 576px){.wrapper.sc-salla-modal .modal.sc-salla-modal{max-width:500px}}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-header.sc-salla-modal{display:none;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:justify;justify-content:space-between;padding:1rem 1rem;border-bottom:1px solid #dee2e6;border-top-left-radius:0.3rem;border-top-right-radius:0.3rem}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-header.sc-salla-modal h5.sc-salla-modal{margin:0;font-weight:normal}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-header.sc-salla-modal .title.sc-salla-modal{font-size:1.25rem}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-header.sc-salla-modal button.close.sc-salla-modal{padding:0;background-color:transparent;border:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:grey;outline:0;float:right;font-size:1.5rem;font-weight:700;line-height:1;text-shadow:0 1px 0 #fff;opacity:0.5}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-header.sc-salla-modal button.close.sc-salla-modal .sc-salla-modal:hover{color:black;cursor:pointer}.wrapper.sc-salla-modal .modal.sc-salla-modal .displayed.sc-salla-modal{display:flex}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-body.sc-salla-modal{position:relative;-ms-flex:1 1 auto;flex:1 1 auto;padding:1rem}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-footer.sc-salla-modal{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end;padding:1rem;border-top:1px solid #dee2e6;border-bottom-right-radius:0.3rem;border-bottom-left-radius:0.3rem}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-footer.sc-salla-modal .btn-primary.sc-salla-modal{color:#fff;background-color:#007bff;border-color:#007bff;outline:none}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-footer.sc-salla-modal .btn-primary.sc-salla-modal:hover{background-color:#0069d9;border-color:#0062cc;cursor:pointer}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-footer.sc-salla-modal .btn-secondary.sc-salla-modal{color:#fff;background-color:#6c757d;border-color:#6c757d;outline:none}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-footer.sc-salla-modal .btn-secondary.sc-salla-modal:hover{background-color:#5a6269;border-color:#5a6269;cursor:pointer}.wrapper.sc-salla-modal .modal.sc-salla-modal .modal-footer.sc-salla-modal>.sc-salla-modal:not(:last-child){margin-right:0.25rem}.wrapper.sc-salla-modal .modal.sc-salla-modal .button-container.sc-salla-modal{text-align:right}.wrapper.sc-salla-modal .modal.sc-salla-modal button.sc-salla-modal{display:inline-block;font-weight:400;color:#212529;text-align:center;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:transparent;border:1px solid transparent;padding:0.375rem 0.75rem;font-size:1rem;line-height:1.5;border-radius:0.25rem;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out}.wrapper.sc-salla-modal .modal.sc-salla-modal button.sc-salla-modal:hover{background-color:#6c757d;border-color:#6c757d}.visible.sc-salla-modal{opacity:1;visibility:visible;transform:scale(1);transition:visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s}";
8
+
9
+ const Modal = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.ok = index.createEvent(this, "ok", 7);
13
+ this.cancel = index.createEvent(this, "cancel", 7);
14
+ /**
15
+ * The title to display in the modal.
16
+ */
17
+ this.modalTitle = 'Modal Title';
18
+ /**
19
+ * The text to display in the cancel button.
20
+ */
21
+ this.cancelText = 'Cancel';
22
+ /**
23
+ * The text to display in the save button.
24
+ */
25
+ this.saveText = 'Save';
26
+ /**
27
+ * If 'true' will make the modal visible.
28
+ */
29
+ this.visible = false;
30
+ /**
31
+ * If 'true' will show the modal header.
32
+ */
33
+ this.modalHeader = false;
34
+ this.handleCancelClick = () => {
35
+ this.visible = false;
36
+ this.cancel.emit();
37
+ };
38
+ this.handleOkClick = () => {
39
+ this.visible = false;
40
+ this.ok.emit();
41
+ };
42
+ this.handleClose = () => {
43
+ this.visible = false;
44
+ };
45
+ }
46
+ render() {
47
+ return (index.h("div", { class: this.visible ? 'wrapper visible' : 'wrapper' }, index.h("div", { class: "modal" }, index.h("div", { class: this.modalHeader ? 'modal-header displayed' : 'modal-header' }, index.h("h5", { class: "title" }, this.modalTitle), index.h("button", { type: "button", class: "close", "data-dismiss": "modal", "aria-label": "Close", onClick: this.handleClose }, index.h("span", { "aria-hidden": "true" }, "\u00D7"))), index.h("div", { class: "modal-body" }, index.h("slot", null)), index.h("div", { class: "modal-footer" }, index.h("button", { type: "button", class: "btn-secondary", onClick: this.handleCancelClick }, this.cancelText), index.h("button", { type: "button", class: "btn-primary", onClick: this.handleOkClick }, this.saveText)))));
48
+ }
49
+ };
50
+ Modal.style = modalCss;
51
+
52
+ exports.salla_modal = Modal;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-6ea83d19.js');
4
+
5
+ /*
6
+ Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ const patchBrowser = () => {
9
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('twilight-components.cjs.js', document.baseURI).href));
10
+ const opts = {};
11
+ if (importMeta !== '') {
12
+ opts.resourcesUrl = new URL('.', importMeta).href;
13
+ }
14
+ return index.promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(options => {
18
+ return index.bootstrapLazy([["salla-alert_3.cjs",[[6,"salla-alert",{"color":[1],"autoClose":[4,"auto-close"],"closeSecs":[2,"close-secs"],"closeable":[4],"closeText":[1,"close-text"],"rounded":[4],"countDownTimerId":[32]}],[1,"salla-login",{"searchIcon":[1,"search-icon"],"visible":[1540],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32]},[[8,"click","handleClick"]]],[0,"salla-search-modal",{"searchPlaceholder":[1,"search-placeholder"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]],["salla-modal.cjs",[[6,"salla-modal",{"modalTitle":[1,"modal-title"],"cancelText":[1,"cancel-text"],"saveText":[1,"save-text"],"visible":[1540],"modalHeader":[516,"modal-header"]}]]]], options);
19
+ });
@@ -0,0 +1,15 @@
1
+ {
2
+ "entries": [
3
+ "./components/alert/alert.js",
4
+ "./components/modal/modal.js",
5
+ "./components/salla-login/salla-login.js",
6
+ "./components/search-modal/search-modal.js"
7
+ ],
8
+ "compiler": {
9
+ "name": "@stencil/core",
10
+ "version": "2.8.1",
11
+ "typescriptVersion": "4.2.3"
12
+ },
13
+ "collections": [],
14
+ "bundles": []
15
+ }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Initial Variables
3
+ */
4
+ /**
5
+ * Functions
6
+ */
7
+ /**
8
+ * Delivered variables
9
+ */
10
+ :host {
11
+ /**
12
+ * @prop --background-color: Background color of the alert
13
+ * @prop --color: Text color of the alert
14
+ *
15
+ * @prop --padding-top: Padding top of the alert
16
+ * @prop --padding-right: Padding right of the alert
17
+ * @prop --padding-bottom: Padding bottom of the alert
18
+ * @prop --padding-left: Padding left of the alert
19
+ *
20
+ * @prop --font-family: Font family of the alert text
21
+ * @prop --font-size: Font size of the alert text
22
+ * @prop --font-weight: Font weight of the alert text
23
+ */
24
+ -webkit-font-smoothing: antialiased;
25
+ padding: var(--padding-top, 8px) var(--padding-right, 16px) var(--padding-bottom, 8px) var(--padding-left, 16px);
26
+ min-height: var(--height, 24px);
27
+ color: var(--color, #fff);
28
+ background-color: var(--background-color, #327bb7);
29
+ border-color: transparent;
30
+ font-family: var(--font-family, "Helvetica Neue", Helvetica, Arial, sans-serif);
31
+ font-size: var(--font-size, 13px);
32
+ font-weight: var(--font-weight, normal);
33
+ line-height: 1;
34
+ position: relative;
35
+ display: flex;
36
+ flex-direction: column;
37
+ justify-content: center;
38
+ align-items: center;
39
+ }
40
+ :host .alert__content {
41
+ display: block;
42
+ height: 100%;
43
+ width: 100%;
44
+ }
45
+ :host .alert__close-text {
46
+ cursor: pointer;
47
+ opacity: 0.7;
48
+ position: absolute;
49
+ top: 14px;
50
+ right: 16px;
51
+ font-size: 0.8em;
52
+ }
53
+ :host .alert__close-text:hover {
54
+ opacity: 0.85;
55
+ }
56
+
57
+ :host(.primary) {
58
+ color: white;
59
+ background-color: #5cd5c4;
60
+ }
61
+
62
+ :host(.secondary) {
63
+ color: white;
64
+ background-color: #ff7d09;
65
+ }
66
+
67
+ :host(.success) {
68
+ color: white;
69
+ background-color: #00c092;
70
+ }
71
+
72
+ :host(.warning) {
73
+ color: white;
74
+ background-color: #e8d700;
75
+ }
76
+
77
+ :host(.error) {
78
+ color: white;
79
+ background-color: #d0021b;
80
+ }
81
+
82
+ :host(.light) {
83
+ color: black;
84
+ background-color: #e5e5e5;
85
+ }
86
+
87
+ :host(.info) {
88
+ color: black;
89
+ background-color: #53ff5c;
90
+ }
91
+
92
+ :host(.dark) {
93
+ color: white;
94
+ background-color: #5d5d5d;
95
+ }
96
+
97
+ :host(.white) {
98
+ color: black;
99
+ background-color: white;
100
+ }
101
+
102
+ :host(.black) {
103
+ color: white;
104
+ background-color: black;
105
+ }
106
+
107
+ :host(.rounded) {
108
+ /**
109
+ * @prop --border-radius: Border radius of the badge if is rounded
110
+ */
111
+ border-radius: var(--border-radius, 4px);
112
+ }
@@ -0,0 +1,194 @@
1
+ import { Component, Host, Prop, State, Event, Element, h } from '@stencil/core';
2
+ export class Alert {
3
+ constructor() {
4
+ /**
5
+ * If `true` alert will close automatically.
6
+ */
7
+ this.autoClose = true;
8
+ /**
9
+ * Number of seconds to close alert automatically if autoClose `true`.
10
+ */
11
+ this.closeSecs = 3;
12
+ /**
13
+ * If closable or not.
14
+ */
15
+ this.closeable = true;
16
+ /**
17
+ * Customized close button text.
18
+ */
19
+ this.closeText = '\u2573';
20
+ /**
21
+ * If `true`, make the alert rounded.
22
+ */
23
+ this.rounded = false;
24
+ this.countDownTimerId = null;
25
+ this.close = () => {
26
+ this.closed.emit(true);
27
+ this.el.remove();
28
+ };
29
+ this.renderCloseText = () => {
30
+ if (this.closeable) {
31
+ return (h("span", { class: "alert__close-text", onClick: this.close }, this.closeText));
32
+ }
33
+ return null;
34
+ };
35
+ }
36
+ componentWillLoad() {
37
+ if (this.el.attributes['auto-close']) {
38
+ this.countDownTimerId = window.setTimeout(() => {
39
+ this.close();
40
+ }, this.closeSecs * 1000);
41
+ }
42
+ }
43
+ disconnectedCallback() {
44
+ if (this.autoClose) {
45
+ window.clearInterval(this.countDownTimerId);
46
+ }
47
+ }
48
+ render() {
49
+ return (h(Host, { class: {
50
+ [this.color]: true,
51
+ rounded: this.rounded,
52
+ } },
53
+ h("div", { class: "alert__content" },
54
+ h("slot", null)),
55
+ this.renderCloseText()));
56
+ }
57
+ static get is() { return "salla-alert"; }
58
+ static get encapsulation() { return "scoped"; }
59
+ static get originalStyleUrls() { return {
60
+ "$": ["alert.scss"]
61
+ }; }
62
+ static get styleUrls() { return {
63
+ "$": ["alert.css"]
64
+ }; }
65
+ static get properties() { return {
66
+ "color": {
67
+ "type": "string",
68
+ "mutable": false,
69
+ "complexType": {
70
+ "original": "string",
71
+ "resolved": "string",
72
+ "references": {}
73
+ },
74
+ "required": false,
75
+ "optional": true,
76
+ "docs": {
77
+ "tags": [],
78
+ "text": "The color options are: `\"primary\"`, `\"secondary\"`, `\"success\"`, `\"warning\"`, `\"error\"`, `\"light\"`, `\"info\"`, `\"white\"`, `\"black\"`, and `\"dark\"`."
79
+ },
80
+ "attribute": "color",
81
+ "reflect": false
82
+ },
83
+ "autoClose": {
84
+ "type": "boolean",
85
+ "mutable": false,
86
+ "complexType": {
87
+ "original": "boolean",
88
+ "resolved": "boolean",
89
+ "references": {}
90
+ },
91
+ "required": false,
92
+ "optional": false,
93
+ "docs": {
94
+ "tags": [],
95
+ "text": "If `true` alert will close automatically."
96
+ },
97
+ "attribute": "auto-close",
98
+ "reflect": false,
99
+ "defaultValue": "true"
100
+ },
101
+ "closeSecs": {
102
+ "type": "number",
103
+ "mutable": false,
104
+ "complexType": {
105
+ "original": "number",
106
+ "resolved": "number",
107
+ "references": {}
108
+ },
109
+ "required": false,
110
+ "optional": false,
111
+ "docs": {
112
+ "tags": [],
113
+ "text": "Number of seconds to close alert automatically if autoClose `true`."
114
+ },
115
+ "attribute": "close-secs",
116
+ "reflect": false,
117
+ "defaultValue": "3"
118
+ },
119
+ "closeable": {
120
+ "type": "boolean",
121
+ "mutable": false,
122
+ "complexType": {
123
+ "original": "boolean",
124
+ "resolved": "boolean",
125
+ "references": {}
126
+ },
127
+ "required": false,
128
+ "optional": false,
129
+ "docs": {
130
+ "tags": [],
131
+ "text": "If closable or not."
132
+ },
133
+ "attribute": "closeable",
134
+ "reflect": false,
135
+ "defaultValue": "true"
136
+ },
137
+ "closeText": {
138
+ "type": "string",
139
+ "mutable": false,
140
+ "complexType": {
141
+ "original": "string",
142
+ "resolved": "string",
143
+ "references": {}
144
+ },
145
+ "required": false,
146
+ "optional": true,
147
+ "docs": {
148
+ "tags": [],
149
+ "text": "Customized close button text."
150
+ },
151
+ "attribute": "close-text",
152
+ "reflect": false,
153
+ "defaultValue": "'\\u2573'"
154
+ },
155
+ "rounded": {
156
+ "type": "boolean",
157
+ "mutable": false,
158
+ "complexType": {
159
+ "original": "boolean",
160
+ "resolved": "boolean",
161
+ "references": {}
162
+ },
163
+ "required": false,
164
+ "optional": true,
165
+ "docs": {
166
+ "tags": [],
167
+ "text": "If `true`, make the alert rounded."
168
+ },
169
+ "attribute": "rounded",
170
+ "reflect": false,
171
+ "defaultValue": "false"
172
+ }
173
+ }; }
174
+ static get states() { return {
175
+ "countDownTimerId": {}
176
+ }; }
177
+ static get events() { return [{
178
+ "method": "closed",
179
+ "name": "closed",
180
+ "bubbles": true,
181
+ "cancelable": true,
182
+ "composed": true,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": "Emitted when the alert is closed."
186
+ },
187
+ "complexType": {
188
+ "original": "any",
189
+ "resolved": "any",
190
+ "references": {}
191
+ }
192
+ }]; }
193
+ static get elementRef() { return "el"; }
194
+ }
@@ -0,0 +1,35 @@
1
+ var fs = require('fs'), path = require('path'), util = require('util');
2
+
3
+ var dirToJSON = function (dir, done) {
4
+ var results = [];
5
+
6
+ function recWalk(d, res) {
7
+ var list = fs.readdirSync(d);
8
+ list.forEach((name) => {
9
+ var file = path.resolve(d, name);
10
+ var stat = fs.statSync(file);
11
+ if (stat && stat.isDirectory()) {
12
+ var title;
13
+ if (name) {
14
+ title = 'salla-' + name
15
+ }
16
+ res.push({ title: title, file: name + '/readme.md' });
17
+ }
18
+ });
19
+ }
20
+
21
+ try {
22
+ recWalk(dir, results);
23
+ done(null, results);
24
+ } catch (err) {
25
+ done(err);
26
+ }
27
+ };
28
+
29
+ dirToJSON("src/components", function (err, results) {
30
+ if (err) console.log(err);
31
+ else fs.writeFile('src/components/summary.json', JSON.stringify(results), 'utf8', function (err) {
32
+ if (err) throw err;
33
+ console.log('Saved!');
34
+ });
35
+ });