@everymatrix/lottery-game-page 0.0.5 → 0.0.8

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 (78) hide show
  1. package/dist/cjs/helper-accordion_13.cjs.entry.js +23492 -0
  2. package/dist/cjs/helper-pagination.cjs.entry.js +188 -0
  3. package/dist/cjs/index-81cb3b3b.js +1277 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/cjs/lottery-game-page.cjs.js +19 -0
  7. package/dist/collection/collection-manifest.json +86 -0
  8. package/dist/collection/components/lottery-game-page/lottery-game-page.css +305 -0
  9. package/dist/collection/components/lottery-game-page/lottery-game-page.js +496 -0
  10. package/dist/collection/index.js +1 -0
  11. package/dist/collection/utils/locale.utils.js +50 -0
  12. package/dist/collection/utils/utils.js +12 -0
  13. package/dist/components/assets/chrono_desktop.png +0 -0
  14. package/dist/components/assets/chrono_lottery_mobile.png +0 -0
  15. package/dist/components/helper-accordion.js +6 -0
  16. package/dist/components/helper-accordion2.js +110 -0
  17. package/dist/components/helper-filters.js +6 -0
  18. package/dist/components/helper-filters2.js +22347 -0
  19. package/dist/components/helper-modal.js +6 -0
  20. package/dist/components/helper-modal2.js +58 -0
  21. package/dist/components/helper-pagination.js +215 -0
  22. package/dist/components/helper-tab.js +6 -0
  23. package/dist/components/helper-tab2.js +47 -0
  24. package/dist/components/helper-tabs.js +6 -0
  25. package/dist/components/helper-tabs2.js +62 -0
  26. package/dist/components/index.d.ts +22 -0
  27. package/dist/components/index.js +15 -0
  28. package/dist/components/lottery-bullet.js +6 -0
  29. package/dist/components/lottery-bullet2.js +56 -0
  30. package/dist/components/lottery-draw-results-history.js +6 -0
  31. package/dist/components/lottery-draw-results-history2.js +174 -0
  32. package/dist/components/lottery-draw-results.js +6 -0
  33. package/dist/components/lottery-draw-results2.js +217 -0
  34. package/dist/components/lottery-game-details.js +6 -0
  35. package/dist/components/lottery-game-details2.js +48 -0
  36. package/dist/components/lottery-game-page.d.ts +11 -0
  37. package/dist/components/lottery-game-page.js +407 -0
  38. package/dist/components/lottery-grid.js +6 -0
  39. package/dist/components/lottery-grid2.js +196 -0
  40. package/dist/components/lottery-ticket-controller.js +6 -0
  41. package/dist/components/lottery-ticket-controller2.js +117 -0
  42. package/dist/components/lottery-ticket.js +6 -0
  43. package/dist/components/lottery-ticket2.js +183 -0
  44. package/dist/esm/helper-accordion_13.entry.js +23476 -0
  45. package/dist/esm/helper-pagination.entry.js +184 -0
  46. package/dist/esm/index-be84da79.js +1250 -0
  47. package/dist/esm/index.js +1 -0
  48. package/dist/esm/loader.js +17 -0
  49. package/dist/esm/lottery-game-page.js +17 -0
  50. package/dist/esm/polyfills/core-js.js +11 -0
  51. package/dist/esm/polyfills/css-shim.js +1 -0
  52. package/dist/esm/polyfills/dom.js +79 -0
  53. package/dist/esm/polyfills/es5-html-element.js +1 -0
  54. package/dist/esm/polyfills/index.js +34 -0
  55. package/dist/esm/polyfills/system.js +6 -0
  56. package/dist/index.cjs.js +1 -0
  57. package/dist/index.js +1 -0
  58. package/dist/lottery-game-page/index.esm.js +0 -0
  59. package/dist/lottery-game-page/lottery-game-page.esm.js +1 -0
  60. package/dist/lottery-game-page/p-08581ede.entry.js +1 -0
  61. package/dist/lottery-game-page/p-49bd2864.entry.js +2849 -0
  62. package/dist/lottery-game-page/p-91420518.js +2 -0
  63. package/dist/stencil.config.js +29 -0
  64. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-game-page/.stencil/packages/lottery-game-page/stencil.config.d.ts +2 -0
  65. package/dist/types/components/lottery-game-page/lottery-game-page.d.ts +74 -0
  66. package/dist/types/components.d.ts +93 -0
  67. package/dist/types/index.d.ts +1 -0
  68. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  69. package/dist/types/utils/locale.utils.d.ts +1 -0
  70. package/dist/types/utils/utils.d.ts +7 -0
  71. package/loader/cdn.js +3 -0
  72. package/loader/index.cjs.js +3 -0
  73. package/loader/index.d.ts +12 -0
  74. package/loader/index.es2017.js +3 -0
  75. package/loader/index.js +4 -0
  76. package/loader/package.json +10 -0
  77. package/package.json +2 -2
  78. package/LICENSE +0 -21
@@ -0,0 +1,184 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-be84da79.js';
2
+
3
+ /**
4
+ * @name isMobile
5
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
6
+ * @param {String} userAgent window.navigator.userAgent
7
+ * @returns {Boolean} true or false
8
+ */
9
+ const isMobile = (userAgent) => {
10
+ return !!(userAgent.toLowerCase().match(/android/i) ||
11
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
12
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
13
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
14
+ };
15
+
16
+ const DEFAULT_LANGUAGE = 'en';
17
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
18
+ const TRANSLATIONS = {
19
+ en: {
20
+ firstPage: 'First',
21
+ previousPage: 'Previous',
22
+ nextPage: 'Next',
23
+ lastPage: 'Last'
24
+ },
25
+ ro: {
26
+ firstPage: 'Prima',
27
+ previousPage: 'Anterior',
28
+ nextPage: 'Urmatoarea',
29
+ lastPage: 'Ultima'
30
+ },
31
+ };
32
+ const translate = (key, customLang) => {
33
+ const lang = customLang;
34
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
35
+ };
36
+
37
+ const helperPaginationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}#PaginationContainer{width:100%;margin-top:20px;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems button:not(:first-child),.RightItems button:not(:last-child){margin:0 10px}.LeftItems button,.RightItems button{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li button{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem button{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem button:disabled{pointer-events:none;cursor:not-allowed}.PaginationItem button:hover,.PaginationItem button:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}button{width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}button:hover,button:active{background:#004D4A;border-color:#004D4A}button:disabled{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){button{width:90px;font-size:12px}}@media screen and (max-width: 480px){button{width:70px;font-size:10px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:10px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem button:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem button:hover{background:#009993;border-color:#009993;color:#fff}}";
38
+
39
+ const HelperPagination = class {
40
+ constructor(hostRef) {
41
+ registerInstance(this, hostRef);
42
+ this.hpPageChange = createEvent(this, "hpPageChange", 7);
43
+ /**
44
+ * First page boolean value - determines if the page is disabled or active
45
+ */
46
+ this.firstPage = false;
47
+ /**
48
+ * Previous page boolean value - determines if the page is disabled or active
49
+ */
50
+ this.previousPage = false;
51
+ /**
52
+ * The received offset
53
+ */
54
+ this.offset = 0;
55
+ /**
56
+ * The received limit for the number of pages
57
+ */
58
+ this.limit = 1;
59
+ /**
60
+ * The received total number of pages
61
+ */
62
+ this.total = 1;
63
+ /**
64
+ * Language
65
+ */
66
+ this.language = 'en';
67
+ /**
68
+ * In component working variable for the array of pages
69
+ */
70
+ this.pagesArray = [];
71
+ /**
72
+ * In component working variable for last page
73
+ */
74
+ this.endInt = 0;
75
+ this.userAgent = window.navigator.userAgent;
76
+ this.currentPage = 1;
77
+ /**
78
+ * Navigation logic
79
+ */
80
+ this.navigateTo = (navigationPage) => {
81
+ switch (navigationPage) {
82
+ case 'firstPage':
83
+ this.offsetInt = 0;
84
+ break;
85
+ case 'lastPage':
86
+ this.offsetInt = this.endInt * this.limitInt;
87
+ break;
88
+ case 'previousPage':
89
+ this.offsetInt -= 10;
90
+ break;
91
+ case 'nextPage':
92
+ this.offsetInt += 10;
93
+ break;
94
+ case 'fivePagesBack':
95
+ this.offsetInt -= 30;
96
+ this.offsetInt = this.offsetInt < 0 ? 0 : this.offsetInt;
97
+ break;
98
+ case 'fivePagesForward':
99
+ this.offsetInt += 30;
100
+ this.offsetInt = this.offsetInt / 10 >= this.endInt ? this.endInt * 10 : this.offsetInt;
101
+ break;
102
+ }
103
+ this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
104
+ };
105
+ /**
106
+ * Handle navigation from here
107
+ */
108
+ this.paginationNavigation = (pageNumber, index) => {
109
+ if (!isNaN(pageNumber)) {
110
+ if (pageNumber === 1) {
111
+ this.offsetInt = pageNumber - 1;
112
+ }
113
+ else {
114
+ this.offsetInt = (pageNumber - 1) * 10;
115
+ }
116
+ }
117
+ else {
118
+ if (index === 0 && this.currentPage <= 4) {
119
+ this.navigateTo('firstPage');
120
+ }
121
+ else if (index === 0 && this.currentPage > 4) {
122
+ this.navigateTo('fivePagesBack');
123
+ }
124
+ else if (index === 4 && this.endInt - this.currentPage >= 2) {
125
+ this.navigateTo('fivePagesForward');
126
+ }
127
+ }
128
+ this.currentPage = this.offsetInt;
129
+ this.hpPageChange.emit({ offset: this.offsetInt, limit: this.limitInt, total: this.totalInt });
130
+ };
131
+ }
132
+ componentWillRender() {
133
+ this.offsetInt = this.offset;
134
+ this.currentPage = this.offsetInt / this.limitInt + 1;
135
+ this.limitInt = this.limit;
136
+ this.totalInt = this.total;
137
+ this.endInt = (Math.ceil(this.totalInt / this.limitInt) - 1);
138
+ this.lastPage = (this.offsetInt >= this.endInt * this.limitInt) ? false : true;
139
+ /**
140
+ * Construct numbered navigation area based on current page position
141
+ */
142
+ if (this.currentPage === 1 || this.currentPage === 2) {
143
+ this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
144
+ this.pagesArray.push('...');
145
+ }
146
+ else if (this.currentPage >= 3 && ((this.endInt - this.currentPage) >= 2)) {
147
+ this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
148
+ this.pagesArray.push('...');
149
+ this.pagesArray.unshift('...');
150
+ }
151
+ else if ((this.endInt - this.currentPage) < 3) {
152
+ this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endInt - 2 + i);
153
+ this.pagesArray.unshift('...');
154
+ }
155
+ }
156
+ render() {
157
+ /**
158
+ * Center navigation area
159
+ */
160
+ let navigationArea = h("ul", { class: "PaginationArea" }, this.pagesArray.map((item, index) => {
161
+ return (h("li", { class: 'PaginationItem' + (item === this.currentPage ? ' ActiveItem' : ' ') + ' ' + (isMobile(this.userAgent) ? 'MobileButtons' : '') }, h("button", { disabled: item === this.currentPage ? true : false, onClick: this.paginationNavigation.bind(this, item, index) }, h("span", null, item))));
162
+ }));
163
+ /**
164
+ * Left navigation area
165
+ */
166
+ let buttonsLeftSide = h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage, onClick: this.navigateTo.bind(this, 'firstPage') }, translate('firstPage', this.language)), h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
167
+ if (isMobile(this.userAgent)) {
168
+ buttonsLeftSide =
169
+ h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, translate('previousPage', this.language)));
170
+ }
171
+ /**
172
+ * Right navigation area
173
+ */
174
+ let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)), h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'lastPage') }, translate('lastPage', this.language)));
175
+ if (isMobile(this.userAgent)) {
176
+ buttonsRightSide =
177
+ h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, translate('nextPage', this.language)));
178
+ }
179
+ return (h("div", { id: "PaginationContainer" }, buttonsLeftSide, navigationArea, buttonsRightSide));
180
+ }
181
+ };
182
+ HelperPagination.style = helperPaginationCss;
183
+
184
+ export { HelperPagination as helper_pagination };