create-basicjs 0.1.0 → 0.1.1

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 (727) hide show
  1. package/README.md +1 -1
  2. package/bin/create-basicjs.js +2 -2
  3. package/bin/verify-package.js +16 -0
  4. package/package.json +4 -1
  5. package/payload/starter/AGENTS.md +82 -0
  6. package/payload/starter/CLAUDE.md +1 -0
  7. package/payload/starter/README.md +45 -0
  8. package/payload/starter/_basic/VERSION +1 -0
  9. package/payload/starter/_basic/assets/categories/cappuccino.png +0 -0
  10. package/payload/starter/_basic/assets/categories/chocolate-milk.png +0 -0
  11. package/payload/starter/_basic/assets/categories/coffee-cup.png +0 -0
  12. package/payload/starter/_basic/assets/categories/coffee.png +0 -0
  13. package/payload/starter/_basic/assets/categories/frappe.png +0 -0
  14. package/payload/starter/_basic/assets/categories/iced-caffee.png +0 -0
  15. package/payload/starter/_basic/assets/categories/milkshake.png +0 -0
  16. package/payload/starter/_basic/assets/categories/orange-juice.png +0 -0
  17. package/payload/starter/_basic/assets/categories/tea.png +0 -0
  18. package/payload/starter/_basic/assets/data-table/palette.svg +2 -0
  19. package/payload/starter/_basic/assets/data-table/people.js +104 -0
  20. package/payload/starter/_basic/assets/data-table/trash.svg +2 -0
  21. package/payload/starter/_basic/assets/fruids/brokoli.png +0 -0
  22. package/payload/starter/_basic/assets/fruids/cilek.png +0 -0
  23. package/payload/starter/_basic/assets/fruids/domates.png +0 -0
  24. package/payload/starter/_basic/assets/fruids/elma.png +0 -0
  25. package/payload/starter/_basic/assets/fruids/havuc.png +0 -0
  26. package/payload/starter/_basic/assets/fruids/karpuz.png +0 -0
  27. package/payload/starter/_basic/assets/fruids/limon.png +0 -0
  28. package/payload/starter/_basic/assets/fruids/muz.png +0 -0
  29. package/payload/starter/_basic/assets/fruids/nar.png +0 -0
  30. package/payload/starter/_basic/assets/fruids/patlican.png +0 -0
  31. package/payload/starter/_basic/assets/fruids/yabanmersini.png +0 -0
  32. package/payload/starter/_basic/assets/fruids/yesilbiber.png +0 -0
  33. package/payload/starter/_basic/assets/icons/alert-black.png +0 -0
  34. package/payload/starter/_basic/assets/icons/alert.png +0 -0
  35. package/payload/starter/_basic/assets/icons/arrow-drop.svg +3 -0
  36. package/payload/starter/_basic/assets/icons/arrow-rise.svg +3 -0
  37. package/payload/starter/_basic/assets/icons/close.svg +1 -0
  38. package/payload/starter/_basic/assets/icons/lamp-on.png +0 -0
  39. package/payload/starter/_basic/assets/icons/lamp.png +0 -0
  40. package/payload/starter/_basic/assets/icons/lock.png +0 -0
  41. package/payload/starter/_basic/assets/icons/panel.png +0 -0
  42. package/payload/starter/_basic/assets/icons/plant.png +0 -0
  43. package/payload/starter/_basic/assets/icons/trash.png +0 -0
  44. package/payload/starter/_basic/assets/icons/trash.svg +2 -0
  45. package/payload/starter/_basic/assets/tab-bar/settings.png +0 -0
  46. package/payload/starter/_basic/assets/tab-bar/status.png +0 -0
  47. package/payload/starter/_basic/assets/tab-bar/transactions.png +0 -0
  48. package/payload/starter/_basic/assets/tutorial/blueberries.png +0 -0
  49. package/payload/starter/_basic/assets/tutorial/carrot.png +0 -0
  50. package/payload/starter/_basic/assets/tutorial/olives.png +0 -0
  51. package/payload/starter/_basic/assets/tutorial/strawberry.png +0 -0
  52. package/payload/starter/_basic/assets/ui-bottom-bar/setting.svg +11 -0
  53. package/payload/starter/_basic/basic/LICENSE +14 -0
  54. package/payload/starter/_basic/basic/basic.css +277 -0
  55. package/payload/starter/_basic/basic/basic.js +3767 -0
  56. package/payload/starter/_basic/basic/basic.min.css +1 -0
  57. package/payload/starter/_basic/basic/basic.min.js +65 -0
  58. package/payload/starter/_basic/basic/font/open-sans/LICENSE.txt +206 -0
  59. package/payload/starter/_basic/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
  60. package/payload/starter/_basic/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
  61. package/payload/starter/_basic/basic/scroll-bar.js +536 -0
  62. package/payload/starter/_basic/basic/scroll-bar.min.js +2 -0
  63. package/payload/starter/_basic/comp/action-button/add.png +0 -0
  64. package/payload/starter/_basic/comp/action-button.js +522 -0
  65. package/payload/starter/_basic/comp/action-tab-bar.js +383 -0
  66. package/payload/starter/_basic/comp/app-bar.js +236 -0
  67. package/payload/starter/_basic/comp/badge-v2.js +246 -0
  68. package/payload/starter/_basic/comp/bottom-bar.js +547 -0
  69. package/payload/starter/_basic/comp/breadcrumbs.js +522 -0
  70. package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +13 -0
  71. package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +9 -0
  72. package/payload/starter/_basic/comp/chart-box.js +868 -0
  73. package/payload/starter/_basic/comp/check-box.js +374 -0
  74. package/payload/starter/_basic/comp/context-menu.js +634 -0
  75. package/payload/starter/_basic/comp/currency-input-b.js +190 -0
  76. package/payload/starter/_basic/comp/data-table/arrow.svg +2 -0
  77. package/payload/starter/_basic/comp/data-table.js +865 -0
  78. package/payload/starter/_basic/comp/dialog.js +854 -0
  79. package/payload/starter/_basic/comp/email-input-b.js +57 -0
  80. package/payload/starter/_basic/comp/filters.js +493 -0
  81. package/payload/starter/_basic/comp/form.js +590 -0
  82. package/payload/starter/_basic/comp/full-screen-select/arrow.svg +2 -0
  83. package/payload/starter/_basic/comp/full-screen-select/cancel.svg +2 -0
  84. package/payload/starter/_basic/comp/full-screen-select.js +611 -0
  85. package/payload/starter/_basic/comp/gauge.js +435 -0
  86. package/payload/starter/_basic/comp/hold-to-confirm-button/trash-red.png +0 -0
  87. package/payload/starter/_basic/comp/hold-to-confirm-button/trash.png +0 -0
  88. package/payload/starter/_basic/comp/hold-to-confirm-button.js +280 -0
  89. package/payload/starter/_basic/comp/input-b.js +759 -0
  90. package/payload/starter/_basic/comp/item-list.js +1396 -0
  91. package/payload/starter/_basic/comp/label-editor.js +1137 -0
  92. package/payload/starter/_basic/comp/left-menu/_Material Symbols & Icons - Google Fonts.webloc +8 -0
  93. package/payload/starter/_basic/comp/left-menu/data-table.png +0 -0
  94. package/payload/starter/_basic/comp/left-menu/home.png +0 -0
  95. package/payload/starter/_basic/comp/left-menu/reports.png +0 -0
  96. package/payload/starter/_basic/comp/left-menu/setting.png +0 -0
  97. package/payload/starter/_basic/comp/left-menu.js +476 -0
  98. package/payload/starter/_basic/comp/line-progress-bar.js +192 -0
  99. package/payload/starter/_basic/comp/loading-screen.js +382 -0
  100. package/payload/starter/_basic/comp/login-page-v2.js +586 -0
  101. package/payload/starter/_basic/comp/mini-graph-box.js +483 -0
  102. package/payload/starter/_basic/comp/notice.js +227 -0
  103. package/payload/starter/_basic/comp/number-input-b.js +121 -0
  104. package/payload/starter/_basic/comp/numeric-keyboard.js +296 -0
  105. package/payload/starter/_basic/comp/page-control.js +745 -0
  106. package/payload/starter/_basic/comp/page-header.js +190 -0
  107. package/payload/starter/_basic/comp/password-input-b/hide-btn.png +0 -0
  108. package/payload/starter/_basic/comp/password-input-b/hide-btn2.png +0 -0
  109. package/payload/starter/_basic/comp/password-input-b/show-btn.png +0 -0
  110. package/payload/starter/_basic/comp/password-input-b/show-btn2.png +0 -0
  111. package/payload/starter/_basic/comp/password-input-b.js +164 -0
  112. package/payload/starter/_basic/comp/period-bar.js +435 -0
  113. package/payload/starter/_basic/comp/phone-input-b.js +287 -0
  114. package/payload/starter/_basic/comp/progress-bar.js +676 -0
  115. package/payload/starter/_basic/comp/property-panel.js +2740 -0
  116. package/payload/starter/_basic/comp/radio-button.js +467 -0
  117. package/payload/starter/_basic/comp/rich-text-editor.js +1061 -0
  118. package/payload/starter/_basic/comp/scrolling-text.js +296 -0
  119. package/payload/starter/_basic/comp/search-input-v2/clear-round.svg +1 -0
  120. package/payload/starter/_basic/comp/search-input-v2/clear.svg +1 -0
  121. package/payload/starter/_basic/comp/search-input-v2/filter.png +0 -0
  122. package/payload/starter/_basic/comp/search-input-v2/filter.svg +1 -0
  123. package/payload/starter/_basic/comp/search-input-v2/search.svg +1 -0
  124. package/payload/starter/_basic/comp/search-input-v2.js +427 -0
  125. package/payload/starter/_basic/comp/search-results.js +560 -0
  126. package/payload/starter/_basic/comp/select-box.js +1740 -0
  127. package/payload/starter/_basic/comp/select-color.js +603 -0
  128. package/payload/starter/_basic/comp/select-date.js +1003 -0
  129. package/payload/starter/_basic/comp/select-file.js +732 -0
  130. package/payload/starter/_basic/comp/select-time.js +979 -0
  131. package/payload/starter/_basic/comp/settings-row.js +298 -0
  132. package/payload/starter/_basic/comp/side-panel.js +573 -0
  133. package/payload/starter/_basic/comp/slider-field.js +776 -0
  134. package/payload/starter/_basic/comp/slider.js +368 -0
  135. package/payload/starter/_basic/comp/smart-button/alert-black.png +0 -0
  136. package/payload/starter/_basic/comp/smart-button/clock.png +0 -0
  137. package/payload/starter/_basic/comp/smart-button.js +896 -0
  138. package/payload/starter/_basic/comp/smart-table/clock.png +0 -0
  139. package/payload/starter/_basic/comp/smart-table/down.png +0 -0
  140. package/payload/starter/_basic/comp/smart-table/scroll.png +0 -0
  141. package/payload/starter/_basic/comp/smart-table/sort.png +0 -0
  142. package/payload/starter/_basic/comp/smart-table/up.png +0 -0
  143. package/payload/starter/_basic/comp/smart-table.js +1321 -0
  144. package/payload/starter/_basic/comp/sortable-list.js +1172 -0
  145. package/payload/starter/_basic/comp/spark-line-box.js +729 -0
  146. package/payload/starter/_basic/comp/stepper.js +699 -0
  147. package/payload/starter/_basic/comp/tabs.js +1317 -0
  148. package/payload/starter/_basic/comp/tag-input.js +1067 -0
  149. package/payload/starter/_basic/comp/tap-effect.js +168 -0
  150. package/payload/starter/_basic/comp/textarea-b.js +184 -0
  151. package/payload/starter/_basic/comp/time-line.js +324 -0
  152. package/payload/starter/_basic/comp/tiny-select/arrow.svg +1 -0
  153. package/payload/starter/_basic/comp/tiny-select.js +282 -0
  154. package/payload/starter/_basic/comp/tiny-table.js +279 -0
  155. package/payload/starter/_basic/comp/toast.js +838 -0
  156. package/payload/starter/_basic/comp/toggle.js +636 -0
  157. package/payload/starter/_basic/comp/tooltip.js +471 -0
  158. package/payload/starter/_basic/comp/tree-view.js +1096 -0
  159. package/payload/starter/_basic/comp/ui-effects.js +1091 -0
  160. package/payload/starter/_basic/comp/ui-standards.js +402 -0
  161. package/payload/starter/_basic/comp/url-input-b.js +145 -0
  162. package/payload/starter/_basic/comp/web-view.js +534 -0
  163. package/payload/starter/_basic/docs/basic-js-animated-rules.md +90 -0
  164. package/payload/starter/_basic/docs/basic-js-code-rules.md +91 -0
  165. package/payload/starter/_basic/docs/basic-js-components.md +134 -0
  166. package/payload/starter/_basic/docs/basic-js-core.md +131 -0
  167. package/payload/starter/_basic/docs/component-index.md +522 -0
  168. package/payload/starter/_basic/docs/component-template.js +416 -0
  169. package/payload/starter/_basic/docs/handbook/00-introduction.md +125 -0
  170. package/payload/starter/_basic/docs/handbook/00-what-is-new.md +96 -0
  171. package/payload/starter/_basic/docs/handbook/01-label.md +104 -0
  172. package/payload/starter/_basic/docs/handbook/02-box.md +166 -0
  173. package/payload/starter/_basic/docs/handbook/03-image.md +81 -0
  174. package/payload/starter/_basic/docs/handbook/04-common-properties.md +159 -0
  175. package/payload/starter/_basic/docs/handbook/05-autolayout.md +332 -0
  176. package/payload/starter/_basic/docs/handbook/06-button.md +103 -0
  177. package/payload/starter/_basic/docs/handbook/07-input.md +78 -0
  178. package/payload/starter/_basic/docs/handbook/08-page.md +120 -0
  179. package/payload/starter/_basic/docs/handbook/09-useful-examples.md +309 -0
  180. package/payload/starter/_basic/docs/handbook/10-motion.md +132 -0
  181. package/payload/starter/_basic/docs/handbook/11-other-functions.md +92 -0
  182. package/payload/starter/_basic/docs/handbook/12-utilities.md +123 -0
  183. package/payload/starter/_basic/docs/handbook/13-sound.md +88 -0
  184. package/payload/starter/_basic/docs/what-is-new.md +402 -0
  185. package/payload/starter/_basic/examples/action-button.htm +81 -0
  186. package/payload/starter/_basic/examples/action-tab-bar.htm +97 -0
  187. package/payload/starter/_basic/examples/app-bar.htm +140 -0
  188. package/payload/starter/_basic/examples/badgeV2.htm +68 -0
  189. package/payload/starter/_basic/examples/bottom-bar/grid.png +0 -0
  190. package/payload/starter/_basic/examples/bottom-bar/grids.png +0 -0
  191. package/payload/starter/_basic/examples/bottom-bar/home.png +0 -0
  192. package/payload/starter/_basic/examples/bottom-bar/homes.png +0 -0
  193. package/payload/starter/_basic/examples/bottom-bar/icon1.png +0 -0
  194. package/payload/starter/_basic/examples/bottom-bar/icon1s.png +0 -0
  195. package/payload/starter/_basic/examples/bottom-bar/icon2.png +0 -0
  196. package/payload/starter/_basic/examples/bottom-bar/icon2s.png +0 -0
  197. package/payload/starter/_basic/examples/bottom-bar/icon3.png +0 -0
  198. package/payload/starter/_basic/examples/bottom-bar/icon3s.png +0 -0
  199. package/payload/starter/_basic/examples/bottom-bar/icon4.png +0 -0
  200. package/payload/starter/_basic/examples/bottom-bar/icon4s.png +0 -0
  201. package/payload/starter/_basic/examples/bottom-bar/search.png +0 -0
  202. package/payload/starter/_basic/examples/bottom-bar/searchs.png +0 -0
  203. package/payload/starter/_basic/examples/bottom-bar/settings.png +0 -0
  204. package/payload/starter/_basic/examples/bottom-bar/settingss.png +0 -0
  205. package/payload/starter/_basic/examples/bottom-bar/tasks.png +0 -0
  206. package/payload/starter/_basic/examples/bottom-bar/taskss.png +0 -0
  207. package/payload/starter/_basic/examples/bottom-bar-2.htm +187 -0
  208. package/payload/starter/_basic/examples/bottom-bar.htm +46 -0
  209. package/payload/starter/_basic/examples/breadcrumbs.htm +284 -0
  210. package/payload/starter/_basic/examples/chart-box.htm +287 -0
  211. package/payload/starter/_basic/examples/check-box-1.htm +220 -0
  212. package/payload/starter/_basic/examples/check-box-2.htm +212 -0
  213. package/payload/starter/_basic/examples/check-box-3.htm +179 -0
  214. package/payload/starter/_basic/examples/context-menu.htm +269 -0
  215. package/payload/starter/_basic/examples/currency-input-b.htm +71 -0
  216. package/payload/starter/_basic/examples/data-table-2.htm +67 -0
  217. package/payload/starter/_basic/examples/data-table-3.htm +72 -0
  218. package/payload/starter/_basic/examples/data-table-4.htm +144 -0
  219. package/payload/starter/_basic/examples/data-table-5.htm +152 -0
  220. package/payload/starter/_basic/examples/data-table.htm +178 -0
  221. package/payload/starter/_basic/examples/dialog-centered.htm +130 -0
  222. package/payload/starter/_basic/examples/dialog.htm +209 -0
  223. package/payload/starter/_basic/examples/email-input-b.htm +67 -0
  224. package/payload/starter/_basic/examples/filters.htm +115 -0
  225. package/payload/starter/_basic/examples/form-1.htm +123 -0
  226. package/payload/starter/_basic/examples/full-screen-select.htm +114 -0
  227. package/payload/starter/_basic/examples/gauge.htm +133 -0
  228. package/payload/starter/_basic/examples/hold-to-confirm-button.htm +144 -0
  229. package/payload/starter/_basic/examples/input-b-ex1.htm +132 -0
  230. package/payload/starter/_basic/examples/input-b-ex2.htm +136 -0
  231. package/payload/starter/_basic/examples/input-b-ex3-style.htm +113 -0
  232. package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +112 -0
  233. package/payload/starter/_basic/examples/input-b-ex5-warning-icon.htm +80 -0
  234. package/payload/starter/_basic/examples/input-b-ex6-dark.htm +108 -0
  235. package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +153 -0
  236. package/payload/starter/_basic/examples/item-list-2.htm +253 -0
  237. package/payload/starter/_basic/examples/item-list.htm +176 -0
  238. package/payload/starter/_basic/examples/label-editor.htm +196 -0
  239. package/payload/starter/_basic/examples/left-menu.htm +81 -0
  240. package/payload/starter/_basic/examples/line-progress-bar.htm +145 -0
  241. package/payload/starter/_basic/examples/loading-screen.htm +217 -0
  242. package/payload/starter/_basic/examples/login-page-dark-v2.htm +269 -0
  243. package/payload/starter/_basic/examples/login-page-v2.htm +269 -0
  244. package/payload/starter/_basic/examples/mini-graph-box.htm +229 -0
  245. package/payload/starter/_basic/examples/notice.htm +79 -0
  246. package/payload/starter/_basic/examples/number-input-b.htm +68 -0
  247. package/payload/starter/_basic/examples/numeric-keyboard.htm +100 -0
  248. package/payload/starter/_basic/examples/page-control.htm +262 -0
  249. package/payload/starter/_basic/examples/page-header.htm +117 -0
  250. package/payload/starter/_basic/examples/password-input-b.htm +70 -0
  251. package/payload/starter/_basic/examples/period-bar.htm +94 -0
  252. package/payload/starter/_basic/examples/phone-input-b-select-country.htm +298 -0
  253. package/payload/starter/_basic/examples/phone-input-b.htm +72 -0
  254. package/payload/starter/_basic/examples/progress-bar-ozden.htm +168 -0
  255. package/payload/starter/_basic/examples/progress-bar.htm +296 -0
  256. package/payload/starter/_basic/examples/property-panel.htm +216 -0
  257. package/payload/starter/_basic/examples/radio-button-1.htm +264 -0
  258. package/payload/starter/_basic/examples/radio-button-2.htm +256 -0
  259. package/payload/starter/_basic/examples/radio-button-3.htm +168 -0
  260. package/payload/starter/_basic/examples/rich-text-editor.htm +228 -0
  261. package/payload/starter/_basic/examples/scrolling-text.htm +75 -0
  262. package/payload/starter/_basic/examples/search-input-v2-ozden.htm +128 -0
  263. package/payload/starter/_basic/examples/search-input-v2-place.htm +80 -0
  264. package/payload/starter/_basic/examples/search-input-v2.htm +65 -0
  265. package/payload/starter/_basic/examples/search-results.htm +193 -0
  266. package/payload/starter/_basic/examples/select-box-ozden-item.htm +114 -0
  267. package/payload/starter/_basic/examples/select-box-ozden-text.htm +64 -0
  268. package/payload/starter/_basic/examples/select-box.htm +254 -0
  269. package/payload/starter/_basic/examples/select-color.htm +215 -0
  270. package/payload/starter/_basic/examples/select-date.htm +244 -0
  271. package/payload/starter/_basic/examples/select-file.htm +268 -0
  272. package/payload/starter/_basic/examples/select-time.htm +249 -0
  273. package/payload/starter/_basic/examples/settings-row.htm +193 -0
  274. package/payload/starter/_basic/examples/side-panel-2.htm +270 -0
  275. package/payload/starter/_basic/examples/side-panel.htm +219 -0
  276. package/payload/starter/_basic/examples/slider-field.htm +223 -0
  277. package/payload/starter/_basic/examples/slider.htm +180 -0
  278. package/payload/starter/_basic/examples/smart-button-2.htm +220 -0
  279. package/payload/starter/_basic/examples/smart-button-3-ozden.htm +320 -0
  280. package/payload/starter/_basic/examples/smart-button-4-dark.htm +102 -0
  281. package/payload/starter/_basic/examples/smart-button-5-features.htm +205 -0
  282. package/payload/starter/_basic/examples/smart-button.htm +252 -0
  283. package/payload/starter/_basic/examples/smart-table-1.htm +142 -0
  284. package/payload/starter/_basic/examples/smart-table-2.htm +191 -0
  285. package/payload/starter/_basic/examples/smart-table-3.htm +359 -0
  286. package/payload/starter/_basic/examples/smart-table-4.htm +158 -0
  287. package/payload/starter/_basic/examples/sortable-list.htm +250 -0
  288. package/payload/starter/_basic/examples/spark-line-box.htm +285 -0
  289. package/payload/starter/_basic/examples/stepper-2.htm +172 -0
  290. package/payload/starter/_basic/examples/stepper.htm +255 -0
  291. package/payload/starter/_basic/examples/tabs-2/coffee.png +0 -0
  292. package/payload/starter/_basic/examples/tabs-2/i1-white.png +0 -0
  293. package/payload/starter/_basic/examples/tabs-2/i1.png +0 -0
  294. package/payload/starter/_basic/examples/tabs-2/i2-white.png +0 -0
  295. package/payload/starter/_basic/examples/tabs-2/i2.png +0 -0
  296. package/payload/starter/_basic/examples/tabs-2/i3-white.png +0 -0
  297. package/payload/starter/_basic/examples/tabs-2/i3.png +0 -0
  298. package/payload/starter/_basic/examples/tabs-2/i4-white.png +0 -0
  299. package/payload/starter/_basic/examples/tabs-2/i4.png +0 -0
  300. package/payload/starter/_basic/examples/tabs-2/i5-white.png +0 -0
  301. package/payload/starter/_basic/examples/tabs-2/i5.png +0 -0
  302. package/payload/starter/_basic/examples/tabs-2/lamp-on.png +0 -0
  303. package/payload/starter/_basic/examples/tabs-2/lamp.png +0 -0
  304. package/payload/starter/_basic/examples/tabs-2/search.svg +2 -0
  305. package/payload/starter/_basic/examples/tabs-2.htm +188 -0
  306. package/payload/starter/_basic/examples/tabs.htm +300 -0
  307. package/payload/starter/_basic/examples/tag-input.htm +242 -0
  308. package/payload/starter/_basic/examples/tap-effect.htm +100 -0
  309. package/payload/starter/_basic/examples/textarea-b.htm +76 -0
  310. package/payload/starter/_basic/examples/time-line.htm +226 -0
  311. package/payload/starter/_basic/examples/tiny-select.htm +86 -0
  312. package/payload/starter/_basic/examples/tiny-table.htm +109 -0
  313. package/payload/starter/_basic/examples/toast.htm +262 -0
  314. package/payload/starter/_basic/examples/toggle-2.htm +163 -0
  315. package/payload/starter/_basic/examples/toggle-3.htm +218 -0
  316. package/payload/starter/_basic/examples/toggle.htm +93 -0
  317. package/payload/starter/_basic/examples/tooltip-2.htm +177 -0
  318. package/payload/starter/_basic/examples/tooltip-3.htm +212 -0
  319. package/payload/starter/_basic/examples/tooltip.htm +124 -0
  320. package/payload/starter/_basic/examples/tree-view.htm +285 -0
  321. package/payload/starter/_basic/examples/ui-effects.htm +463 -0
  322. package/payload/starter/_basic/examples/ui-standards.htm +261 -0
  323. package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +221 -0
  324. package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +221 -0
  325. package/payload/starter/_basic/examples/url-input-b.htm +85 -0
  326. package/payload/starter/_basic/examples/web-view.htm +241 -0
  327. package/payload/starter/_basic/min/action-button.min.js +2 -0
  328. package/payload/starter/_basic/min/action-tab-bar.min.js +2 -0
  329. package/payload/starter/_basic/min/app-bar.min.js +2 -0
  330. package/payload/starter/_basic/min/badge-v2.min.js +2 -0
  331. package/payload/starter/_basic/min/bottom-bar.min.js +2 -0
  332. package/payload/starter/_basic/min/breadcrumbs.min.js +2 -0
  333. package/payload/starter/_basic/min/chart-box.min.js +2 -0
  334. package/payload/starter/_basic/min/check-box.min.js +2 -0
  335. package/payload/starter/_basic/min/context-menu.min.js +2 -0
  336. package/payload/starter/_basic/min/currency-input-b.min.js +2 -0
  337. package/payload/starter/_basic/min/data-table.min.js +2 -0
  338. package/payload/starter/_basic/min/dialog.min.js +2 -0
  339. package/payload/starter/_basic/min/email-input-b.min.js +2 -0
  340. package/payload/starter/_basic/min/filters.min.js +2 -0
  341. package/payload/starter/_basic/min/form.min.js +2 -0
  342. package/payload/starter/_basic/min/full-screen-select.min.js +2 -0
  343. package/payload/starter/_basic/min/gauge.min.js +2 -0
  344. package/payload/starter/_basic/min/hold-to-confirm-button.min.js +2 -0
  345. package/payload/starter/_basic/min/input-b.min.js +2 -0
  346. package/payload/starter/_basic/min/item-list.min.js +2 -0
  347. package/payload/starter/_basic/min/label-editor.min.js +2 -0
  348. package/payload/starter/_basic/min/left-menu.min.js +2 -0
  349. package/payload/starter/_basic/min/line-progress-bar.min.js +2 -0
  350. package/payload/starter/_basic/min/loading-screen.min.js +2 -0
  351. package/payload/starter/_basic/min/login-page-v2.min.js +2 -0
  352. package/payload/starter/_basic/min/mini-graph-box.min.js +2 -0
  353. package/payload/starter/_basic/min/notice.min.js +2 -0
  354. package/payload/starter/_basic/min/number-input-b.min.js +2 -0
  355. package/payload/starter/_basic/min/numeric-keyboard.min.js +2 -0
  356. package/payload/starter/_basic/min/page-control.min.js +2 -0
  357. package/payload/starter/_basic/min/page-header.min.js +2 -0
  358. package/payload/starter/_basic/min/password-input-b.min.js +2 -0
  359. package/payload/starter/_basic/min/period-bar.min.js +2 -0
  360. package/payload/starter/_basic/min/phone-input-b.min.js +2 -0
  361. package/payload/starter/_basic/min/progress-bar.min.js +2 -0
  362. package/payload/starter/_basic/min/property-panel.min.js +2 -0
  363. package/payload/starter/_basic/min/radio-button.min.js +2 -0
  364. package/payload/starter/_basic/min/rich-text-editor.min.js +2 -0
  365. package/payload/starter/_basic/min/scrolling-text.min.js +2 -0
  366. package/payload/starter/_basic/min/search-input-v2.min.js +2 -0
  367. package/payload/starter/_basic/min/search-results.min.js +2 -0
  368. package/payload/starter/_basic/min/select-box.min.js +2 -0
  369. package/payload/starter/_basic/min/select-color.min.js +2 -0
  370. package/payload/starter/_basic/min/select-date.min.js +2 -0
  371. package/payload/starter/_basic/min/select-file.min.js +2 -0
  372. package/payload/starter/_basic/min/select-time.min.js +2 -0
  373. package/payload/starter/_basic/min/settings-row.min.js +2 -0
  374. package/payload/starter/_basic/min/side-panel.min.js +2 -0
  375. package/payload/starter/_basic/min/slider-field.min.js +2 -0
  376. package/payload/starter/_basic/min/slider.min.js +2 -0
  377. package/payload/starter/_basic/min/smart-button.min.js +2 -0
  378. package/payload/starter/_basic/min/smart-table.min.js +2 -0
  379. package/payload/starter/_basic/min/sortable-list.min.js +2 -0
  380. package/payload/starter/_basic/min/spark-line-box.min.js +2 -0
  381. package/payload/starter/_basic/min/stepper.min.js +2 -0
  382. package/payload/starter/_basic/min/tabs.min.js +2 -0
  383. package/payload/starter/_basic/min/tag-input.min.js +2 -0
  384. package/payload/starter/_basic/min/tap-effect.min.js +2 -0
  385. package/payload/starter/_basic/min/textarea-b.min.js +2 -0
  386. package/payload/starter/_basic/min/time-line.min.js +2 -0
  387. package/payload/starter/_basic/min/tiny-select.min.js +2 -0
  388. package/payload/starter/_basic/min/tiny-table.min.js +2 -0
  389. package/payload/starter/_basic/min/toast.min.js +2 -0
  390. package/payload/starter/_basic/min/toggle.min.js +2 -0
  391. package/payload/starter/_basic/min/tooltip.min.js +2 -0
  392. package/payload/starter/_basic/min/tree-view.min.js +2 -0
  393. package/payload/starter/_basic/min/ui-effects.min.js +2 -0
  394. package/payload/starter/_basic/min/ui-standards.min.js +2 -0
  395. package/payload/starter/_basic/min/url-input-b.min.js +2 -0
  396. package/payload/starter/_basic/min/web-view.min.js +2 -0
  397. package/payload/starter/_basic/tools/build.js +175 -0
  398. package/payload/starter/_basic/tools/check.js +318 -0
  399. package/payload/starter/app/app.js +27 -0
  400. package/payload/starter/assets/.gitkeep +0 -0
  401. package/payload/starter/gitignore +3 -0
  402. package/payload/starter/index.htm +23 -0
  403. package/payload/templates/booking/TEMPLATE.md +77 -0
  404. package/payload/templates/booking/app/app.js +722 -0
  405. package/payload/templates/booking/app/settings.js +52 -0
  406. package/payload/templates/booking/app/store.js +265 -0
  407. package/payload/templates/booking/app/texts.js +148 -0
  408. package/payload/templates/booking/assets/app-icon.svg +1 -0
  409. package/payload/templates/booking/assets/tabs/account.svg +1 -0
  410. package/payload/templates/booking/assets/tabs/appointments.svg +1 -0
  411. package/payload/templates/booking/assets/tabs/home.svg +1 -0
  412. package/payload/templates/booking/assets/tabs/services.svg +1 -0
  413. package/payload/templates/booking/components/booking-ui.js +252 -0
  414. package/payload/templates/booking/index.htm +53 -0
  415. package/payload/templates/booking/pages/account.js +124 -0
  416. package/payload/templates/booking/pages/appointments.js +141 -0
  417. package/payload/templates/booking/pages/book.js +231 -0
  418. package/payload/templates/booking/pages/home.js +99 -0
  419. package/payload/templates/booking/pages/services.js +79 -0
  420. package/payload/templates/classic/TEMPLATE.md +104 -0
  421. package/payload/templates/classic/app/app.js +779 -0
  422. package/payload/templates/classic/app/settings.js +77 -0
  423. package/payload/templates/classic/assets/_attribute.txt +37 -0
  424. package/payload/templates/classic/assets/cards/dill.png +0 -0
  425. package/payload/templates/classic/assets/cards/fennel.png +0 -0
  426. package/payload/templates/classic/assets/cards/juniper.png +0 -0
  427. package/payload/templates/classic/assets/cards/olives.png +0 -0
  428. package/payload/templates/classic/assets/cards/oregano.png +0 -0
  429. package/payload/templates/classic/assets/cards/pepper.png +0 -0
  430. package/payload/templates/classic/assets/cards/rosehip.png +0 -0
  431. package/payload/templates/classic/assets/categories/cappuccino.png +0 -0
  432. package/payload/templates/classic/assets/categories/chocolate-milk.png +0 -0
  433. package/payload/templates/classic/assets/categories/coffee-cup.png +0 -0
  434. package/payload/templates/classic/assets/categories/coffee.png +0 -0
  435. package/payload/templates/classic/assets/categories/frappe.png +0 -0
  436. package/payload/templates/classic/assets/categories/iced-caffee.png +0 -0
  437. package/payload/templates/classic/assets/categories/milkshake.png +0 -0
  438. package/payload/templates/classic/assets/categories/orange-juice.png +0 -0
  439. package/payload/templates/classic/assets/categories/tea.png +0 -0
  440. package/payload/templates/classic/assets/example-tabs/coffee.png +0 -0
  441. package/payload/templates/classic/assets/example-tabs/i1-white.png +0 -0
  442. package/payload/templates/classic/assets/example-tabs/i1.png +0 -0
  443. package/payload/templates/classic/assets/example-tabs/i2-white.png +0 -0
  444. package/payload/templates/classic/assets/example-tabs/i2.png +0 -0
  445. package/payload/templates/classic/assets/example-tabs/i3-white.png +0 -0
  446. package/payload/templates/classic/assets/example-tabs/i3.png +0 -0
  447. package/payload/templates/classic/assets/example-tabs/i4-white.png +0 -0
  448. package/payload/templates/classic/assets/example-tabs/i4.png +0 -0
  449. package/payload/templates/classic/assets/example-tabs/i5-white.png +0 -0
  450. package/payload/templates/classic/assets/example-tabs/i5.png +0 -0
  451. package/payload/templates/classic/assets/example-tabs/lamp-on.png +0 -0
  452. package/payload/templates/classic/assets/example-tabs/lamp.png +0 -0
  453. package/payload/templates/classic/assets/example-tabs/search.svg +2 -0
  454. package/payload/templates/classic/assets/files/ai.png +0 -0
  455. package/payload/templates/classic/assets/files/doc.png +0 -0
  456. package/payload/templates/classic/assets/files/folder.png +0 -0
  457. package/payload/templates/classic/assets/files/js.png +0 -0
  458. package/payload/templates/classic/assets/files/pdf.png +0 -0
  459. package/payload/templates/classic/assets/files/txt.png +0 -0
  460. package/payload/templates/classic/assets/files/xls.png +0 -0
  461. package/payload/templates/classic/assets/icons/arrow-drop.svg +3 -0
  462. package/payload/templates/classic/assets/icons/arrow-rise.svg +3 -0
  463. package/payload/templates/classic/assets/icons/download.svg +18 -0
  464. package/payload/templates/classic/assets/icons/lamp-on.png +0 -0
  465. package/payload/templates/classic/assets/icons/lamp.png +0 -0
  466. package/payload/templates/classic/assets/icons/lock-small.png +0 -0
  467. package/payload/templates/classic/assets/icons/lock.png +0 -0
  468. package/payload/templates/classic/assets/icons/logo.png +0 -0
  469. package/payload/templates/classic/assets/icons/trash-red.svg +2 -0
  470. package/payload/templates/classic/assets/icons/trash.svg +2 -0
  471. package/payload/templates/classic/assets/menu/t1.png +0 -0
  472. package/payload/templates/classic/assets/menu/t10.png +0 -0
  473. package/payload/templates/classic/assets/menu/t11.png +0 -0
  474. package/payload/templates/classic/assets/menu/t2.png +0 -0
  475. package/payload/templates/classic/assets/menu/t3.png +0 -0
  476. package/payload/templates/classic/assets/menu/t4.png +0 -0
  477. package/payload/templates/classic/assets/menu/t5.png +0 -0
  478. package/payload/templates/classic/assets/menu/t6.png +0 -0
  479. package/payload/templates/classic/assets/menu/t7.png +0 -0
  480. package/payload/templates/classic/assets/menu/t8.png +0 -0
  481. package/payload/templates/classic/assets/menu/t9.png +0 -0
  482. package/payload/templates/classic/assets/products/brokoli.png +0 -0
  483. package/payload/templates/classic/assets/products/cilek.png +0 -0
  484. package/payload/templates/classic/assets/products/domates.png +0 -0
  485. package/payload/templates/classic/assets/products/elma.png +0 -0
  486. package/payload/templates/classic/assets/products/havuc.png +0 -0
  487. package/payload/templates/classic/assets/products/karpuz.png +0 -0
  488. package/payload/templates/classic/assets/products/limon.png +0 -0
  489. package/payload/templates/classic/assets/products/muz.png +0 -0
  490. package/payload/templates/classic/assets/products/nar.png +0 -0
  491. package/payload/templates/classic/assets/products/patlican.png +0 -0
  492. package/payload/templates/classic/assets/products/yabanmersini.png +0 -0
  493. package/payload/templates/classic/assets/products/yesilbiber.png +0 -0
  494. package/payload/templates/classic/assets/tab-bar/settings.png +0 -0
  495. package/payload/templates/classic/assets/tab-bar/status.png +0 -0
  496. package/payload/templates/classic/assets/tab-bar/transactions.png +0 -0
  497. package/payload/templates/classic/assets/tabs/grid.png +0 -0
  498. package/payload/templates/classic/assets/tabs/grids.png +0 -0
  499. package/payload/templates/classic/assets/tabs/home.png +0 -0
  500. package/payload/templates/classic/assets/tabs/homes.png +0 -0
  501. package/payload/templates/classic/assets/tabs/search.png +0 -0
  502. package/payload/templates/classic/assets/tabs/searchs.png +0 -0
  503. package/payload/templates/classic/assets/tabs/settings.png +0 -0
  504. package/payload/templates/classic/assets/tabs/settingss.png +0 -0
  505. package/payload/templates/classic/assets/tabs/tasks.png +0 -0
  506. package/payload/templates/classic/assets/tabs/taskss.png +0 -0
  507. package/payload/templates/classic/html/privacy.htm +58 -0
  508. package/payload/templates/classic/index.htm +70 -0
  509. package/payload/templates/classic/pages/dialogs.js +205 -0
  510. package/payload/templates/classic/pages/example.js +296 -0
  511. package/payload/templates/classic/pages/examples.js +148 -0
  512. package/payload/templates/classic/pages/home.js +268 -0
  513. package/payload/templates/classic/pages/info-pages.js +95 -0
  514. package/payload/templates/classic/pages/lock.js +70 -0
  515. package/payload/templates/classic/pages/search.js +153 -0
  516. package/payload/templates/classic/pages/settings.js +184 -0
  517. package/payload/templates/classic/pages/tasks.js +221 -0
  518. package/payload/templates/classic/pages/template-pages.js +240 -0
  519. package/payload/templates/coffee-shop/TEMPLATE.md +63 -0
  520. package/payload/templates/coffee-shop/app/app.js +713 -0
  521. package/payload/templates/coffee-shop/app/settings.js +20 -0
  522. package/payload/templates/coffee-shop/app/store.js +52 -0
  523. package/payload/templates/coffee-shop/assets/cappuccino.png +0 -0
  524. package/payload/templates/coffee-shop/assets/chocolate-milk.png +0 -0
  525. package/payload/templates/coffee-shop/assets/coffee-art/cocoa.svg +1 -0
  526. package/payload/templates/coffee-shop/assets/coffee-art/filter.svg +1 -0
  527. package/payload/templates/coffee-shop/assets/coffee-art/frappe.svg +1 -0
  528. package/payload/templates/coffee-shop/assets/coffee-art/iced.svg +1 -0
  529. package/payload/templates/coffee-shop/assets/coffee-art/latte.svg +1 -0
  530. package/payload/templates/coffee-shop/assets/coffee-art/tea.svg +1 -0
  531. package/payload/templates/coffee-shop/assets/coffee.png +0 -0
  532. package/payload/templates/coffee-shop/assets/credits.txt +41 -0
  533. package/payload/templates/coffee-shop/assets/fonts/OFL.txt +93 -0
  534. package/payload/templates/coffee-shop/assets/fonts/gelasio-OFL.txt +93 -0
  535. package/payload/templates/coffee-shop/assets/fonts/gelasio.ttf +0 -0
  536. package/payload/templates/coffee-shop/assets/frappe.png +0 -0
  537. package/payload/templates/coffee-shop/assets/iced-caffee.png +0 -0
  538. package/payload/templates/coffee-shop/assets/tabs/cart.svg +1 -0
  539. package/payload/templates/coffee-shop/assets/tabs/home.svg +1 -0
  540. package/payload/templates/coffee-shop/assets/tabs/menu.svg +1 -0
  541. package/payload/templates/coffee-shop/assets/tabs/rewards.svg +1 -0
  542. package/payload/templates/coffee-shop/assets/tea.png +0 -0
  543. package/payload/templates/coffee-shop/components/coffee-ui.js +246 -0
  544. package/payload/templates/coffee-shop/index.htm +55 -0
  545. package/payload/templates/coffee-shop/pages/cart.js +82 -0
  546. package/payload/templates/coffee-shop/pages/drink.js +74 -0
  547. package/payload/templates/coffee-shop/pages/home.js +54 -0
  548. package/payload/templates/coffee-shop/pages/menu.js +53 -0
  549. package/payload/templates/coffee-shop/pages/rewards.js +38 -0
  550. package/payload/templates/forms/TEMPLATE.md +12 -0
  551. package/payload/templates/forms/app/app.js +30 -0
  552. package/payload/templates/forms/appointment-form.htm +969 -0
  553. package/payload/templates/forms/assets/error.png +0 -0
  554. package/payload/templates/forms/assets/logo.png +0 -0
  555. package/payload/templates/forms/assets/logo2.png +0 -0
  556. package/payload/templates/forms/assets/mail.png +0 -0
  557. package/payload/templates/forms/assets/success.png +0 -0
  558. package/payload/templates/forms/contact-form-iframe.htm +24 -0
  559. package/payload/templates/forms/contact-form-table.sql +11 -0
  560. package/payload/templates/forms/contact-form-to-mail.htm +358 -0
  561. package/payload/templates/forms/contact-form-to-supabase.htm +396 -0
  562. package/payload/templates/forms/dark-contact-form.htm +623 -0
  563. package/payload/templates/forms/event-registration-form.htm +1056 -0
  564. package/payload/templates/forms/feedback-form.htm +813 -0
  565. package/payload/templates/forms/order-form.htm +1187 -0
  566. package/payload/templates/forms/recruitment-form.htm +698 -0
  567. package/payload/templates/forms/service/PHPMailer/Exception.php +40 -0
  568. package/payload/templates/forms/service/PHPMailer/LICENSE +502 -0
  569. package/payload/templates/forms/service/PHPMailer/PHPMailer.php +5586 -0
  570. package/payload/templates/forms/service/PHPMailer/SMTP.php +1617 -0
  571. package/payload/templates/forms/service/readme.md +162 -0
  572. package/payload/templates/forms/service/send-form-mail.php +941 -0
  573. package/payload/templates/forms/support-ticket-form.htm +908 -0
  574. package/payload/templates/panel/TEMPLATE.md +16 -0
  575. package/payload/templates/panel/assets/_Material Symbols & Icons - Google Fonts.webloc +8 -0
  576. package/payload/templates/panel/assets/arrow_down.png +0 -0
  577. package/payload/templates/panel/assets/close.png +0 -0
  578. package/payload/templates/panel/assets/left-menu/bolt.png +0 -0
  579. package/payload/templates/panel/assets/left-menu/brick.png +0 -0
  580. package/payload/templates/panel/assets/left-menu/code.png +0 -0
  581. package/payload/templates/panel/assets/left-menu/dashboard.png +0 -0
  582. package/payload/templates/panel/assets/left-menu/data-table.png +0 -0
  583. package/payload/templates/panel/assets/left-menu/extension.png +0 -0
  584. package/payload/templates/panel/assets/left-menu/home.png +0 -0
  585. package/payload/templates/panel/assets/left-menu/reports.png +0 -0
  586. package/payload/templates/panel/assets/left-menu/setting.png +0 -0
  587. package/payload/templates/panel/assets/left-menu/url.png +0 -0
  588. package/payload/templates/panel/assets/light.png +0 -0
  589. package/payload/templates/panel/assets/maybe.png +0 -0
  590. package/payload/templates/panel/assets/panel-icon.png +0 -0
  591. package/payload/templates/panel/assets/top-bar/add.png +0 -0
  592. package/payload/templates/panel/assets/top-bar/add.svg +1 -0
  593. package/payload/templates/panel/assets/top-bar/apps.png +0 -0
  594. package/payload/templates/panel/assets/top-bar/apps.svg +1 -0
  595. package/payload/templates/panel/assets/top-bar/arrow-down.svg +1 -0
  596. package/payload/templates/panel/assets/top-bar/bell.svg +1 -0
  597. package/payload/templates/panel/assets/top-bar/bookmark.png +0 -0
  598. package/payload/templates/panel/assets/top-bar/bookmark.svg +1 -0
  599. package/payload/templates/panel/assets/top-bar/cancel.png +0 -0
  600. package/payload/templates/panel/assets/top-bar/close.svg +1 -0
  601. package/payload/templates/panel/assets/top-bar/comment.png +0 -0
  602. package/payload/templates/panel/assets/top-bar/filter.png +0 -0
  603. package/payload/templates/panel/assets/top-bar/keyboard.svg +1 -0
  604. package/payload/templates/panel/assets/top-bar/notification.png +0 -0
  605. package/payload/templates/panel/assets/top-bar/search.png +0 -0
  606. package/payload/templates/panel/assets/top-bar/search.svg +1 -0
  607. package/payload/templates/panel/assets/top-bar/user.png +0 -0
  608. package/payload/templates/panel/assets/top-bar/user.svg +1 -0
  609. package/payload/templates/panel/assets/warning.png +0 -0
  610. package/payload/templates/panel/common/bridge.js +1 -0
  611. package/payload/templates/panel/common/bridge.min.js +0 -0
  612. package/payload/templates/panel/common/components.js +12 -0
  613. package/payload/templates/panel/common/full-view.js +107 -0
  614. package/payload/templates/panel/common/full-view.min.js +1 -0
  615. package/payload/templates/panel/common/main-view.js +53 -0
  616. package/payload/templates/panel/common/main-view.min.js +1 -0
  617. package/payload/templates/panel/common/module-page.js +46 -0
  618. package/payload/templates/panel/common/module-page.min.js +1 -0
  619. package/payload/templates/panel/common/right-view.js +77 -0
  620. package/payload/templates/panel/common/right-view.min.js +1 -0
  621. package/payload/templates/panel/common/start-page.js +31 -0
  622. package/payload/templates/panel/common/start-page.min.js +1 -0
  623. package/payload/templates/panel/common/theme.js +491 -0
  624. package/payload/templates/panel/common/top-bar-v25-07-29-1.js +330 -0
  625. package/payload/templates/panel/common/top-bar-v25-07-29-2.js +265 -0
  626. package/payload/templates/panel/common/top-bar.js +855 -0
  627. package/payload/templates/panel/common/top-bar.min.js +1 -0
  628. package/payload/templates/panel/common/ui-standards.css +77 -0
  629. package/payload/templates/panel/common/ui-standards.js +133 -0
  630. package/payload/templates/panel/common/ui-standards.min.css +1 -0
  631. package/payload/templates/panel/common/ui-standards.min.js +1 -0
  632. package/payload/templates/panel/index.htm +642 -0
  633. package/payload/templates/panel/managers/database.js +1 -0
  634. package/payload/templates/panel/managers/database.min.js +1 -0
  635. package/payload/templates/panel/managers/login.js +2 -0
  636. package/payload/templates/panel/managers/login.min.js +1 -0
  637. package/payload/templates/panel/module1/empty-main.htm +26 -0
  638. package/payload/templates/panel/module10/greenhouse.htm +1361 -0
  639. package/payload/templates/panel/module11/arduino-projects.htm +1124 -0
  640. package/payload/templates/panel/module2/empty-full.htm +26 -0
  641. package/payload/templates/panel/module3/empty-right.htm +26 -0
  642. package/payload/templates/panel/module4/empty-main-topbar.htm +26 -0
  643. package/payload/templates/panel/module5/empty-right-topbar.htm +26 -0
  644. package/payload/templates/panel/module6/energy-hub.htm +1507 -0
  645. package/payload/templates/panel/module7/3d-printers.htm +1258 -0
  646. package/payload/templates/panel/module8/cold-rooms.htm +1250 -0
  647. package/payload/templates/panel/module9/elevator-fleet.htm +1488 -0
  648. package/payload/templates/panel/pages/_page-template.js +36 -0
  649. package/payload/templates/panel/pages/_page-template.min.js +1 -0
  650. package/payload/templates/panel/pages/activity.js +1072 -0
  651. package/payload/templates/panel/pages/contents.js +1555 -0
  652. package/payload/templates/panel/pages/contents.min.js +1 -0
  653. package/payload/templates/panel/pages/customers.js +1171 -0
  654. package/payload/templates/panel/pages/edit-user.js +381 -0
  655. package/payload/templates/panel/pages/edit-user.min.js +1 -0
  656. package/payload/templates/panel/pages/edit-users-table.min.js +1 -0
  657. package/payload/templates/panel/pages/home.js +637 -0
  658. package/payload/templates/panel/pages/home.min.js +1 -0
  659. package/payload/templates/panel/pages/media.js +1538 -0
  660. package/payload/templates/panel/pages/notifications.js +542 -0
  661. package/payload/templates/panel/pages/notifications.min.js +1 -0
  662. package/payload/templates/panel/pages/orders.js +1147 -0
  663. package/payload/templates/panel/pages/products.js +1281 -0
  664. package/payload/templates/panel/pages/reports.js +1138 -0
  665. package/payload/templates/panel/pages/reports.min.js +1 -0
  666. package/payload/templates/panel/pages/roles.js +1096 -0
  667. package/payload/templates/panel/pages/settings.js +1462 -0
  668. package/payload/templates/panel/pages/settings.min.js +1 -0
  669. package/payload/templates/panel/pages/user-actions.js +456 -0
  670. package/payload/templates/panel/pages/user-actions.min.js +2 -0
  671. package/payload/templates/panel/pages/user-list.js +1113 -0
  672. package/payload/templates/panel/pages/users.js +334 -0
  673. package/payload/templates/panel/pages/users.min.js +1 -0
  674. package/payload/templates/shop/TEMPLATE.md +69 -0
  675. package/payload/templates/shop/app/app.js +727 -0
  676. package/payload/templates/shop/app/art.js +89 -0
  677. package/payload/templates/shop/app/settings.js +45 -0
  678. package/payload/templates/shop/app/store.js +239 -0
  679. package/payload/templates/shop/app/texts.js +232 -0
  680. package/payload/templates/shop/assets/app-icon.svg +1 -0
  681. package/payload/templates/shop/assets/tabs/account.svg +1 -0
  682. package/payload/templates/shop/assets/tabs/cart.svg +1 -0
  683. package/payload/templates/shop/assets/tabs/home.svg +1 -0
  684. package/payload/templates/shop/assets/tabs/shop.svg +1 -0
  685. package/payload/templates/shop/components/shop-ui.js +343 -0
  686. package/payload/templates/shop/index.htm +57 -0
  687. package/payload/templates/shop/pages/account.js +190 -0
  688. package/payload/templates/shop/pages/cart.js +116 -0
  689. package/payload/templates/shop/pages/checkout.js +134 -0
  690. package/payload/templates/shop/pages/favorites.js +37 -0
  691. package/payload/templates/shop/pages/home.js +86 -0
  692. package/payload/templates/shop/pages/orders.js +132 -0
  693. package/payload/templates/shop/pages/product.js +168 -0
  694. package/payload/templates/shop/pages/shop.js +113 -0
  695. package/payload/templates/starter/TEMPLATE.md +107 -0
  696. package/payload/templates/starter/app/app.js +660 -0
  697. package/payload/templates/starter/app/settings.js +57 -0
  698. package/payload/templates/starter/assets/app-icon.svg +5 -0
  699. package/payload/templates/starter/assets/products/brokoli.png +0 -0
  700. package/payload/templates/starter/assets/products/cilek.png +0 -0
  701. package/payload/templates/starter/assets/products/domates.png +0 -0
  702. package/payload/templates/starter/assets/products/elma.png +0 -0
  703. package/payload/templates/starter/assets/products/havuc.png +0 -0
  704. package/payload/templates/starter/assets/products/karpuz.png +0 -0
  705. package/payload/templates/starter/assets/products/limon.png +0 -0
  706. package/payload/templates/starter/assets/products/muz.png +0 -0
  707. package/payload/templates/starter/assets/products/nar.png +0 -0
  708. package/payload/templates/starter/assets/products/patlican.png +0 -0
  709. package/payload/templates/starter/assets/products/yabanmersini.png +0 -0
  710. package/payload/templates/starter/assets/products/yesilbiber.png +0 -0
  711. package/payload/templates/starter/assets/tabs/grid.png +0 -0
  712. package/payload/templates/starter/assets/tabs/grids.png +0 -0
  713. package/payload/templates/starter/assets/tabs/home.png +0 -0
  714. package/payload/templates/starter/assets/tabs/homes.png +0 -0
  715. package/payload/templates/starter/assets/tabs/settings.png +0 -0
  716. package/payload/templates/starter/assets/tabs/settingss.png +0 -0
  717. package/payload/templates/starter/assets/tabs/tasks.png +0 -0
  718. package/payload/templates/starter/assets/tabs/taskss.png +0 -0
  719. package/payload/templates/starter/html/about.htm +54 -0
  720. package/payload/templates/starter/index.htm +57 -0
  721. package/payload/templates/starter/pages/about.js +23 -0
  722. package/payload/templates/starter/pages/home.js +81 -0
  723. package/payload/templates/starter/pages/product.js +45 -0
  724. package/payload/templates/starter/pages/products.js +61 -0
  725. package/payload/templates/starter/pages/settings.js +103 -0
  726. package/payload/templates/starter/pages/tasks.js +187 -0
  727. package/payload/templates/starter/pages/website.js +29 -0
@@ -0,0 +1,1740 @@
1
+ /* Bismillah */
2
+
3
+ /*
4
+
5
+ Select Box - v26.09
6
+
7
+ UI COMPONENT TEMPLATE
8
+ - A dropdown select: a field that opens a list (popup) under or above it.
9
+ - Single or multiple selection (multiple: 1). "Select all" and "Clear" for multiple.
10
+ - Search in the list (searchable: "auto" -> when there are more than 8 options). Matches are highlighted.
11
+ - The search box is a SearchInput (comp/search-input-v2.js, with its clear button) when that file is loaded
12
+ before this one (useSearchInput: 1). Its look: style.searchInput (the params of SearchInput). Without it the
13
+ search box is an own input (its look: style.search).
14
+ - The list at the full height of the page (fullHeightList: 1): as wide as the field, at its left, from the top
15
+ of the page to its bottom, and it stays that high when a search leaves a few rows (the comp-m1 SelectItem
16
+ selection_fullScreen). A resize of the page places it again (the normal list closes).
17
+ - Options can have a description, an icon, a group title and can be disabled.
18
+ - Clear button in the field (clearable: 1).
19
+ - Keyboard: Enter / Space / ArrowDown opens. ArrowUp / ArrowDown / Home / End move, Enter selects,
20
+ Escape closes, Tab closes. Typing on the closed field opens the search with the typed letter.
21
+ - Accessibility: combobox + listbox roles, aria-expanded, aria-selected, aria-activedescendant.
22
+ - onChange is NOT called when the component is created or when the value is set with silent: 1.
23
+ - Big lists: Only the first "maxRenderCount" matches are drawn. (Search shows the others.)
24
+ - The list scrolls with basic/scroll-bar.js (useScrollBar: 1, style.scrollBar) when it is loaded before.
25
+ - Your own rows: createItemView(option, row, self) draws an option with your objects. The list is then a
26
+ comp-m4 ItemList (load comp/item-list.js before this file; without it: a warning and the normal rows).
27
+ The search box, the keyboard, single / multiple, disabled options and onChange work the same.
28
+ (Not in this mode: the group titles, the highlight of the search and maxRenderCount.) The list: box.itemList.
29
+ The search finds the label, the description, the group and option.searchText (Turkish letters without marks).
30
+ - Your own field: createValueView(option, field, self) draws the selected option in the field with your
31
+ objects (single selection; the placeholder and the multiple text stay as they are).
32
+ - Style packages: "classic" (default), "dark", "ozden" (the look of the old comp-m1 SelectItem / SelectText
33
+ as a package of params: 350 x 50, a search box, the list goes down to the bottom of the page).
34
+ Select with styleName. (SelectBox.styles) ("legacy" was merged into "ozden" on 2026-10-31.)
35
+ - scale: multiplies every size (the style, width / height / panelMinWidth / panelMaxHeight, the spaces in the
36
+ code, the search box, the rows, the checks). Its default is basic.uiScale: on a page fitted with page.fit()
37
+ (basic.uiScale = 1 / page.zoom) the field and its list keep their size on the screen. The objects of
38
+ createItemView / createValueView are yours: multiply their sizes with self.scale (Ex: fontSize: 16 * self.scale).
39
+ (Needs basic.js v26.11.01 for a scale other than 1.)
40
+
41
+ OPTION: { value, label, description, iconFile, group, disabled }
42
+ - A string or a number is also accepted: "Apple" -> { value: "Apple", label: "Apple" }
43
+
44
+ USAGE:
45
+ const fruit = SelectBox({
46
+ width: 260,
47
+ options: ["Apple", "Banana", { value: "cherry", label: "Cherry", description: "Red and sweet" }],
48
+ value: "Banana",
49
+ clearable: 1,
50
+ onChange: (self) => println(self.value),
51
+ });
52
+ fruit.setValue("cherry"); // onChange is called
53
+ fruit.setValue("Apple", 1); // silent: onChange is not called
54
+ const skills = SelectBox({ multiple: 1, options: ["JS", "CSS", "SQL"], value: ["JS"] });
55
+ skills.getSelectedOptions(); // [{ value: "JS", label: "JS", ... }]
56
+
57
+ // Your own rows and field (load comp/item-list.js first). The other keys of an option stay on it.
58
+ const country = SelectBox({
59
+ styleName: "ozden",
60
+ options: [{ value: "TR", label: "Türkiye", code: "+90", searchText: "Turkey" }, { value: "DE", label: "Germany", code: "+49" }],
61
+ value: "TR",
62
+ createItemView: function (option, row, self) { // Objects created here go into the row (an HGroup).
63
+ Label({ plainText: option.code, fontSize: 16 });
64
+ Label({ plainText: option.label, fontSize: 20 });
65
+ },
66
+ createValueView: function (option, field, self) { // Objects created here go into the field (an HGroup).
67
+ Label({ plainText: option.code + " " + option.label, fontSize: 20 });
68
+ },
69
+ });
70
+
71
+ Started Date: September 2026
72
+ Developer: Bugra Ozden
73
+ Email: bugra.ozden@gmail.com
74
+ Webpage: https://bug7a.github.io/js-components/
75
+
76
+ */
77
+
78
+ "use strict";
79
+
80
+ // Default values:
81
+ const SelectBoxDefaults = {
82
+ key: "0",
83
+ width: 240,
84
+ height: 44,
85
+ options: [], // [{ value, label, description, iconFile, group, disabled }] or ["A", "B"]
86
+ value: null, // Single: a value or null. Multiple: [values]
87
+ multiple: 0,
88
+ searchable: "auto", // 1, 0, "auto" (more than autoSearchCount options)
89
+ autoSearchCount: 8,
90
+ clearable: 0, // 1: Clear button in the field
91
+ closeOnSelect: null, // null: 1 for single, 0 for multiple
92
+ showSelectAll: 1, // Multiple: "Select all" and "Clear" buttons
93
+ placeholder: "Select...",
94
+ searchPlaceholder: "Search...",
95
+ emptyText: "No results",
96
+ selectAllText: "Select all",
97
+ clearText: "Clear",
98
+ moreText: "+{count}", // Multiple: field text when many are selected. Ex: "Apple, Banana +3"
99
+ fieldLabelCount: 2, // Multiple: how many labels are written in the field
100
+ panelMinWidth: 220,
101
+ panelMaxHeight: 320,
102
+ maxRenderCount: 300,
103
+ enabled: 1,
104
+ useScrollBar: 1, // basic/scroll-bar.js on the list (load it first). 0: the scrollbar of the browser (hidden by basic.css in Chrome).
105
+ useSearchInput: 1, // 1: the search box is a SearchInput when comp/search-input-v2.js is loaded first (style.searchInput). 0: the own input (style.search)
106
+ fullHeightList: 0, // 1: the list opens from the top of the page to its bottom, as wide as the field, at its left. (box.setFullHeightList())
107
+ scale: null, // Multiplies every size. null: basic.uiScale (1, or 1 / page.zoom on a fitted page). (Only at create time)
108
+ ariaLabel: "",
109
+ createItemView: null, // function (option, row, self) { ... } Your own rows: the list is an ItemList (load comp/item-list.js first). Its look: style.itemList
110
+ createValueView: null, // function (option, field, self) { ... } Your own view of the selected option in the field (single selection)
111
+ onChange: function (self) { }, // self.value, self.getSelectedOptions()
112
+ onOpen: function (self) { },
113
+ onClose: function (self) { },
114
+ styleName: "classic", // "classic", "dark", "ozden" or a name added to SelectBox.styles
115
+ style: { // Classic style package (default)
116
+ field: {
117
+ color: White(1),
118
+ border: 1,
119
+ borderColor: Black(0.2),
120
+ round: 6,
121
+ padding: [12, 0],
122
+ },
123
+ fieldHover: {
124
+ borderColor: Black(0.5),
125
+ },
126
+ fieldFocus: {
127
+ borderColor: "#141414",
128
+ },
129
+ fieldText: {
130
+ fontSize: 16,
131
+ textColor: Black(0.85),
132
+ },
133
+ // The icon and the description of the selected option in the field (single selection)
134
+ fieldOption: {
135
+ iconSize: 0, // 0: no icon in the field
136
+ iconRound: 0,
137
+ iconMarginLeft: 0,
138
+ gap: 8,
139
+ showDescription: 0,
140
+ emptyIconColor: "", // A box in the place of the icon when nothing is selected. "": no box
141
+ },
142
+ placeholder: {
143
+ textColor: Black(0.4),
144
+ },
145
+ arrow: {
146
+ color: Black(0.55),
147
+ icon: "chevron", // "chevron" (rotates when open), "unfold" (up and down)
148
+ size: 16,
149
+ opacity: 1,
150
+ marginRight: 0, // A negative value moves it into the padding of the field
151
+ },
152
+ panel: {
153
+ color: White(1),
154
+ border: 1,
155
+ borderColor: Black(0.12),
156
+ round: 10,
157
+ padding: 6,
158
+ shadow: "0 8px 24px rgba(0, 0, 0, 0.12)",
159
+ gap: 6,
160
+ coverField: 0, // 1: the panel opens over the field (at its top, as wide as it)
161
+ motion: "", // Ex: "opacity 0.2s, transform 0.2s": the panel fades and grows in (and out)
162
+ motionDuration: 200, // ms of the motion (the close waits for it)
163
+ startScale: 0.9,
164
+ },
165
+ // The search box when it is a SearchInput: its params (a styleName of SearchInput.styles and its look params).
166
+ // An icon file without a folder ("search.svg") is taken from the folder of comp/search-input-v2.js.
167
+ searchInput: {
168
+ styleName: "classic",
169
+ height: 38,
170
+ searchIconLeft: 10, // WHY: the icon and the text at the place of the own search input (icon 18, text 42)
171
+ color: Black(0.04),
172
+ border: 1,
173
+ borderColor: Black(0.1),
174
+ borderBottomStyle: "1px solid rgba(0, 0, 0, 0.1)", // WHY: the bottom line of SearchInput takes the place of the border there.
175
+ round: 6,
176
+ fontSize: 14,
177
+ textColor: Black(0.85),
178
+ placeholderColor: "",
179
+ searchIconFile: "search.svg",
180
+ clearIconFile: "clear.svg",
181
+ searchIconSize: 16,
182
+ searchIconGap: 8, // Between the icon and the text (the default of SearchInput: here, so that scale changes it)
183
+ searchIconOpacity: 0.55,
184
+ clearIconOpacity: 0.45,
185
+ invertIconColor: 0,
186
+ },
187
+ // The own search box (when SearchInput is not loaded)
188
+ search: {
189
+ color: Black(0.04),
190
+ border: 1,
191
+ borderColor: Black(0.1),
192
+ round: 6,
193
+ fontSize: 14,
194
+ textColor: Black(0.85),
195
+ height: 38,
196
+ padding: [10, 0],
197
+ iconSize: 16,
198
+ borderBottom: "", // Ex: "2px solid rgba(0, 0, 0, 0.06)"
199
+ },
200
+ option: {
201
+ fontSize: 15,
202
+ textColor: Black(0.85),
203
+ round: 6,
204
+ padding: [10, 8],
205
+ gap: 10,
206
+ minHeight: 0,
207
+ iconSize: 22,
208
+ iconRound: 0,
209
+ iconMargin: [0, 0], // [left, top and bottom]
210
+ },
211
+ optionActive: {
212
+ color: Black(0.06),
213
+ showAtOpen: 1, // 0: no row is marked when the list opens (only under the mouse / the keyboard)
214
+ },
215
+ optionSelected: {
216
+ textColor: "#141414",
217
+ checkColor: "#141414",
218
+ checkTickColor: White(1),
219
+ fontFamily: "opensans-bold", // Single selection. "": the font does not change
220
+ showTick: 1, // Single selection: a tick on the right
221
+ opacity: 1,
222
+ },
223
+ optionDisabled: {
224
+ opacity: 0.4,
225
+ },
226
+ description: {
227
+ fontSize: 12,
228
+ textColor: Black(0.5),
229
+ marginTop: 0,
230
+ },
231
+ group: {
232
+ fontSize: 11,
233
+ textColor: Black(0.45),
234
+ },
235
+ highlight: {
236
+ color: "rgba(255, 196, 0, 0.35)",
237
+ },
238
+ empty: {
239
+ fontSize: 14,
240
+ textColor: Black(0.45),
241
+ },
242
+ footerButton: {
243
+ fontSize: 13,
244
+ textColor: "#3871E0",
245
+ },
246
+ divider: {
247
+ color: Black(0.08),
248
+ },
249
+ disabled: {
250
+ opacity: 0.4,
251
+ },
252
+ // The style of the ItemList of createItemView (the keys of ItemList.styles.classic: row, hover, selected,
253
+ // disabled, check...). Its empty text takes style.empty. The check mark is shown only for multiple.
254
+ itemList: {
255
+ box: { color: "transparent", border: 0, round: 0, padding: 0 },
256
+ list: { gap: 0 },
257
+ row: { height: "auto", padding: [8, 8], gap: 10, color: "transparent", round: 6, motion: "" },
258
+ hover: { color: Black(0.06) },
259
+ selected: { color: Black(0.04), opacity: 1 },
260
+ disabled: { opacity: 0.4 },
261
+ focus: { ringColor: "transparent" }, // WHY: The keyboard stays in the field / search box (the active row is painted).
262
+ check: { size: 18, color: "#141414", iconColor: White(1), borderColor: Black(0.3) },
263
+ },
264
+ scrollBar: { // The params of ScrollBar (basic/scroll-bar.js)
265
+ bar_color: "#9A9A98",
266
+ bar_mouseOverColor: "#6A6A68",
267
+ bar_width: 4,
268
+ bar_mouseOverWidth: 4, // (the default of ScrollBar: here, so that scale changes it)
269
+ bar_round: 3,
270
+ bar_opacity: 0.4,
271
+ bar_mouseOverOpacity: 0.9,
272
+ bar_padding: 2,
273
+ neverHide: 0,
274
+ showDots: 0,
275
+ },
276
+ }
277
+ };
278
+
279
+ const SelectBox = function (params = {}) {
280
+
281
+ // Merge style package: params.style > SelectBox.styles[styleName] > SelectBoxDefaults.style (classic)
282
+ basic.applyStylePackage(params, SelectBox.styles, SelectBoxDefaults);
283
+
284
+ // Merge params:
285
+ mergeIntoIfMissing(params, SelectBoxDefaults);
286
+
287
+ // Scale: the sizes of the style and of the params are multiplied. (A page fitted with page.fit() sets basic.uiScale.)
288
+ SelectBox.applyScale(params);
289
+
290
+ // WHY: startObject() copies params (only 4 levels) and keeps arrays by reference. Options and value are kept out of it.
291
+ const startOptions = params.options;
292
+ const startValue = params.value;
293
+ delete params.options;
294
+ delete params.value;
295
+
296
+ // BOX: Component container
297
+ let box = startObject(params);
298
+
299
+ // *** PRIVATE VARIABLES:
300
+ const _s = box.style;
301
+ const id = "selectbox-" + (SelectBox._counter++);
302
+ let isOpen = 0;
303
+ let isMouseOver = 0;
304
+ let isFocused = 0;
305
+ let searchText = "";
306
+ let rows = []; // Drawn option rows: [{ row, option }]
307
+ let activeIndex = -1; // Index in rows
308
+ const scale = box.scale; // The px of the code below are multiplied by it, like the style.
309
+ const PANEL_GAP = 6 * scale; // px between the field and the panel
310
+ const SCREEN_MARGIN = 8 * scale; // px: the panel stays this far from the edges of the page
311
+ const MIN_LIST_HEIGHT = 80 * scale; // px: the list is not made shorter than this when the space is small
312
+ const CHECK_SIZE = 18 * scale; // The check box of a row (multiple)
313
+ const TICK_SIZE = 16 * scale; // The tick of the selected row (single)
314
+ const CLEAR_BUTTON_SIZE = 20 * scale; // The clear button of the field
315
+ const CLEAR_ICON_SIZE = 14 * scale;
316
+ const BUTTON_ROUND = 4 * scale; // The clear button and the footer buttons
317
+ const MARK_ROUND = 3 * scale; // The highlight of the search
318
+ const MESSAGE_PADDING = [8 * scale, 14 * scale]; // [x, y] "No results"
319
+ const MORE_MESSAGE_PADDING = [8 * scale, 8 * scale]; // "Showing 300 of 900. Type to search."
320
+ const GROUP_PADDING = [8 * scale, 4 * scale]; // The title of a group of options
321
+ const GROUP_LETTER_SPACING = 1 * scale;
322
+ const GROUP_SPACE_TOP = 6 * scale; // Above a group title that is not the first row
323
+ const SEARCH_GAP = 8 * scale; // The own search box: between its icon and its input
324
+ const SEARCH_INPUT_SPACE = 4 * scale; // The own search box: its input is this much shorter than the box
325
+ const FOOTER_PADDING = [4 * scale, 6 * scale];
326
+ const FOOTER_BUTTON_PADDING = [6 * scale, 2 * scale];
327
+ const DIVIDER_WIDTH = 1 * scale; // The line above the footer
328
+ const OVERLAY_Z_INDEX = 1000;
329
+ const PANEL_Z_INDEX = 1001;
330
+ // createItemView: the list is an ItemList (box.itemList), made at the first open.
331
+ const usesItemList = (typeof box.createItemView === "function") && SelectBox.canUseItemList();
332
+ let fieldViewOption = null; // The option that createValueView has drawn in the field
333
+ // The search box is a SearchInput (box.searchGroup) when comp/search-input-v2.js is loaded. box.searchInput: its input.
334
+ const usesSearchInput = (box.useSearchInput == 1) && SelectBox.canUseSearchInput();
335
+
336
+ // *** PUBLIC VARIABLES:
337
+ // [var] Normalized options
338
+ box.options = [];
339
+ // [var] Single: value or null. Multiple: array
340
+ box.value = null;
341
+
342
+ // *** PRIVATE FUNCTIONS:
343
+
344
+ const isMultiple = function () {
345
+ return box.multiple == 1;
346
+ };
347
+
348
+ const isSearchable = function () {
349
+ if (box.searchable === "auto") return box.options.length > box.autoSearchCount;
350
+ return box.searchable == 1;
351
+ };
352
+
353
+ const sameValue = function (a, b) {
354
+ return a !== null && a !== undefined && b !== null && b !== undefined && String(a) === String(b);
355
+ };
356
+
357
+ const isSelected = function (option) {
358
+ if (isMultiple()) return box.value.some(function (v) { return sameValue(v, option.value); });
359
+ return sameValue(box.value, option.value);
360
+ };
361
+
362
+ const findOption = function (value) {
363
+ return box.options.find(function (option) { return sameValue(option.value, value); });
364
+ };
365
+
366
+ // Multiple: a value, an array or nothing -> an array
367
+ const toValueList = function (value) {
368
+ if (Array.isArray(value)) return value;
369
+ if (value === null || value === undefined || value === "") return [];
370
+ return [value];
371
+ };
372
+
373
+ const normalizeValue = function (value) {
374
+ if (isMultiple()) {
375
+ const list = toValueList(value);
376
+ // WHY: Only values that are in the options. The order of the options is used.
377
+ const selectedOptions = box.options.filter(function (option) {
378
+ return list.some(function (v) { return sameValue(v, option.value); });
379
+ });
380
+ return selectedOptions.map(function (option) { return option.value; });
381
+ }
382
+ const option = findOption(value);
383
+ return (option) ? option.value : null;
384
+ };
385
+
386
+ const getFilteredOptions = function () {
387
+ const text = searchText.trim().toLocaleLowerCase();
388
+ if (!text) return box.options;
389
+ return box.options.filter(function (option) {
390
+ return (option.label + " " + option.description + " " + option.group).toLocaleLowerCase().includes(text);
391
+ });
392
+ };
393
+
394
+ // Label with the search match highlighted (safe HTML)
395
+ const highlight = function (label) {
396
+ const text = searchText.trim();
397
+ const escaped = SelectBox.escapeHtml(label);
398
+ if (!text) return escaped;
399
+ const index = label.toLocaleLowerCase().indexOf(text.toLocaleLowerCase());
400
+ if (index < 0) return escaped;
401
+ const before = SelectBox.escapeHtml(label.slice(0, index));
402
+ const match = SelectBox.escapeHtml(label.slice(index, index + text.length));
403
+ const after = SelectBox.escapeHtml(label.slice(index + text.length));
404
+ const markStyle = "background:" + _s.highlight.color + "; color: inherit; border-radius: " + MARK_ROUND + "px";
405
+ return before + "<mark style='" + markStyle + "'>" + match + "</mark>" + after;
406
+ };
407
+
408
+ // Creates the objects of a container again, in one group (container.wrapper).
409
+ const renderInto = function (container, buildContent) {
410
+ if (container.wrapper) container.wrapper.remove();
411
+ createIn(container, function () {
412
+ container.wrapper = VGroup({ width: "100%", height: "auto", align: "left top", gap: 0, position: "relative" });
413
+ container.wrapper.css.alignItems = "stretch";
414
+ buildContent();
415
+ endGroup();
416
+ });
417
+ };
418
+
419
+ const getFieldBorderColor = function () {
420
+ if (isOpen || isFocused) return _s.fieldFocus.borderColor;
421
+ if (isMouseOver) return _s.fieldHover.borderColor;
422
+ return _s.field.borderColor;
423
+ };
424
+
425
+ // A small SVG picture in a Label that does not shrink in a group.
426
+ const createSvgLabel = function (svg, size) {
427
+ const label = Label({ text: svg, width: size, height: size });
428
+ label.shrink = 0;
429
+ label.lineHeight = "0";
430
+ return label;
431
+ };
432
+
433
+ // The icon and the description of the selected option in the field (style.fieldOption).
434
+ const updateFieldOption = function (option) {
435
+ const hasIcon = _s.fieldOption.iconSize > 0 && option && option.iconFile;
436
+ // WHY: An empty box keeps the place of the icon: the placeholder text starts where a selected label starts.
437
+ const hasIconOptions = box.options.some(function (o) { return o.iconFile; }); // WHY: Text options have no icon place.
438
+ const hasEmptyIcon = _s.fieldOption.iconSize > 0 && !option && _s.fieldOption.emptyIconColor && hasIconOptions;
439
+ box.fieldIcon.visible = (hasIcon || hasEmptyIcon) ? 1 : 0;
440
+ box.fieldIcon.color = hasEmptyIcon ? _s.fieldOption.emptyIconColor : "transparent";
441
+ box.fieldIcon.imageElement.style.visibility = hasEmptyIcon ? "hidden" : "visible";
442
+ // WHY: Loaded again only when it changed, so the icon does not flicker.
443
+ if (hasIcon && box.fieldIcon.imageElement.getAttribute("src") != option.iconFile) box.fieldIcon.load(option.iconFile);
444
+
445
+ const hasDescription = basic.isOn(_s.fieldOption.showDescription) && option && option.description;
446
+ box.fieldDescription.visible = hasDescription ? 1 : 0;
447
+ box.fieldDescription.text = hasDescription ? SelectBox.escapeHtml(option.description) : "";
448
+ };
449
+
450
+ // createValueView: the selected option drawn by the page in the field, in the place of the text.
451
+ const updateFieldView = function (option) {
452
+ if (typeof box.createValueView !== "function") return;
453
+ const isShown = !!option;
454
+ box.fieldTexts.visible = isShown ? 0 : 1; // WHY: The placeholder is still the text of the field.
455
+ if (isShown) box.fieldIcon.visible = 0;
456
+ if (!isShown) {
457
+ removeFieldView();
458
+ return;
459
+ }
460
+ // WHY: Drawn again only when the option changed (setOptions() makes new option objects).
461
+ if (option !== fieldViewOption) drawFieldView(option);
462
+ };
463
+
464
+ const removeFieldView = function () {
465
+ if (box.fieldView) box.fieldView.remove();
466
+ box.fieldView = null;
467
+ fieldViewOption = null;
468
+ };
469
+
470
+ const drawFieldView = function (option) {
471
+ removeFieldView();
472
+ createIn(box.field, function () {
473
+ // GROUP: The view of the page
474
+ box.fieldView = HGroup({ width: "auto", height: "100%", align: "left center", gap: _s.fieldOption.gap });
475
+ box.fieldView.css = { flex: "1 1 auto", minWidth: "0" };
476
+ box.createValueView(option, box.fieldView, box);
477
+ endGroup();
478
+ });
479
+ // WHY: In the place of the text: before the clear button and the arrow.
480
+ box.field.elem.insertBefore(box.fieldView.elem, box.clearButton.elem);
481
+ fieldViewOption = option;
482
+ };
483
+
484
+ const updateField = function () {
485
+
486
+ const selected = box.getSelectedOptions();
487
+ let text = "";
488
+
489
+ if (isMultiple()) {
490
+ const names = selected.slice(0, box.fieldLabelCount).map(function (option) { return SelectBox.escapeHtml(option.label); });
491
+ text = names.join(", ");
492
+ if (selected.length > box.fieldLabelCount) text += " " + box.moreText.replace("{count}", selected.length - box.fieldLabelCount);
493
+ } else if (selected[0]) {
494
+ text = SelectBox.escapeHtml(selected[0].label);
495
+ }
496
+
497
+ box.fieldText.text = text || SelectBox.escapeHtml(box.placeholder);
498
+ box.fieldText.textColor = (text) ? _s.fieldText.textColor : _s.placeholder.textColor;
499
+ updateFieldOption(isMultiple() ? null : selected[0]);
500
+ updateFieldView(isMultiple() ? null : selected[0]);
501
+
502
+ box.clearButton.visible = (box.clearable == 1 && selected.length > 0 && box.enabled == 1) ? 1 : 0;
503
+
504
+ box.field.borderColor = getFieldBorderColor();
505
+ if (_s.arrow.icon === "chevron") box.arrow.css.transform = (isOpen) ? "rotate(180deg)" : "rotate(0deg)";
506
+
507
+ box.opacity = (box.enabled == 1) ? 1 : _s.disabled.opacity;
508
+ box.tabIndex = (box.enabled == 1) ? 0 : -1;
509
+ box.aria = {
510
+ expanded: (isOpen) ? "true" : "false",
511
+ disabled: (box.enabled == 1) ? "false" : "true",
512
+ };
513
+
514
+ };
515
+
516
+ // Draws the option rows. (Filtered by the search)
517
+ const renderList = function () {
518
+
519
+ if (usesItemList) {
520
+ renderItemList();
521
+ return;
522
+ }
523
+
524
+ const list = getFilteredOptions();
525
+ const shown = list.slice(0, box.maxRenderCount);
526
+ rows = [];
527
+
528
+ renderInto(box.list, function () {
529
+
530
+ if (list.length == 0) {
531
+ Label({ text: SelectBox.escapeHtml(box.emptyText), width: "100%", textAlign: "center", padding: MESSAGE_PADDING, ..._s.empty });
532
+ return;
533
+ }
534
+
535
+ let lastGroup = "";
536
+
537
+ shown.forEach(function (option) {
538
+
539
+ if (option.group && option.group != lastGroup) {
540
+ lastGroup = option.group;
541
+ Label({ text: SelectBox.escapeHtml(option.group.toUpperCase()), padding: GROUP_PADDING, ..._s.group });
542
+ that.css = {
543
+ letterSpacing: GROUP_LETTER_SPACING + "px",
544
+ marginTop: (rows.length) ? GROUP_SPACE_TOP + "px" : "0px",
545
+ };
546
+ }
547
+
548
+ rows.push({ row: createOptionRow(option, rows.length), option: option });
549
+
550
+ });
551
+
552
+ if (list.length > shown.length) {
553
+ const moreText = "Showing " + shown.length + " of " + list.length + ". Type to search.";
554
+ Label({ text: moreText, width: "100%", textAlign: "center", padding: MORE_MESSAGE_PADDING, ..._s.empty });
555
+ }
556
+
557
+ });
558
+
559
+ setActive(getStartActiveIndex(), 0);
560
+
561
+ box.list.aria = { multiselectable: (isMultiple()) ? "true" : "false" };
562
+ refreshScrollBar();
563
+
564
+ };
565
+
566
+ const refreshScrollBar = function () {
567
+ if (box.scrollBar) box.scrollBar.refreshScroll();
568
+ };
569
+
570
+ // *** THE ITEMLIST OF createItemView
571
+ // WHY: The keyboard of the ItemList moves the focus into the rows; here the focus stays in the field or
572
+ // the search box (a combobox), so the active row is painted by SelectBox (aria-activedescendant).
573
+
574
+ // An option as an item of the ItemList. The key is its index in box.options.
575
+ const toListItem = function (option, index) {
576
+ return {
577
+ key: String(index),
578
+ title: option.label,
579
+ desc: option.description,
580
+ searchText: [option.group, option.searchText || ""].join(" "),
581
+ disabled: option.disabled,
582
+ option: option,
583
+ };
584
+ };
585
+
586
+ const getListKey = function (option) {
587
+ return String(box.options.indexOf(option));
588
+ };
589
+
590
+ const getItemListStyle = function () {
591
+ const check = Object.assign({}, _s.itemList.check, { visible: isMultiple() ? 1 : 0 });
592
+ return Object.assign({}, _s.itemList, { empty: _s.itemList.empty || _s.empty, check: check });
593
+ };
594
+
595
+ const createListItemView = function (item, row) {
596
+ if (_s.option.minHeight) row.css.minHeight = _s.option.minHeight + "px";
597
+ box.createItemView(item.option, row, box);
598
+ };
599
+
600
+ const createItemList = function () {
601
+ createIn(box.list, function () {
602
+ box.itemList = ItemList({
603
+ width: "100%",
604
+ height: "auto",
605
+ position: "relative",
606
+ items: [],
607
+ selection: isMultiple() ? "multiple" : "single",
608
+ scrollToSelected: 0,
609
+ useScrollBar: 0,
610
+ createItemView: createListItemView,
611
+ emptyText: box.emptyText,
612
+ noResultText: box.emptyText,
613
+ ariaLabel: box.ariaLabel || "List",
614
+ onItemClick: onListItemClick,
615
+ onChange: onListChange,
616
+ style: getItemListStyle(),
617
+ scale: 1, // WHY: style.itemList is scaled already (with the style of SelectBox).
618
+ });
619
+ });
620
+ fillItemList();
621
+ };
622
+
623
+ // The rows of the options, made again (at the first open and by setOptions).
624
+ const fillItemList = function () {
625
+ box.itemList.setItems(box.options.map(toListItem));
626
+ // WHY: box.list is the listbox of the combobox: the group of the ItemList is not one more listbox.
627
+ box.itemList.wrapper.role = "none";
628
+ box.itemList.wrapper.aria = { label: null, multiselectable: null };
629
+ box.itemList.forEach(prepareListRow);
630
+ };
631
+
632
+ const prepareListRow = function (item, row, index) {
633
+ row.elem.id = id + "-option-" + index;
634
+ if (item.option.disabled) row.cursor = "default";
635
+ row.on("mousemove", function () {
636
+ const rowIndex = rows.findIndex(function (shown) { return shown.row === row; });
637
+ if (rowIndex >= 0 && rowIndex != activeIndex && !item.option.disabled) setActive(rowIndex, 0);
638
+ });
639
+ // WHY: The ItemList paints the row again when the mouse leaves it; the keyboard row keeps its color.
640
+ row.onHoverChange(function () {
641
+ if (rows[activeIndex] && rows[activeIndex].row === row) row.color = getActiveColor();
642
+ });
643
+ };
644
+
645
+ // The search, the selection and the active row of the ItemList (its rows are made only once).
646
+ const renderItemList = function () {
647
+ if (!box.itemList) createItemList();
648
+ syncListSelection();
649
+ box.itemList.search(searchText);
650
+ rows = [];
651
+ box.itemList.forEach(function (item, row) {
652
+ if (row.visible == 1) rows.push({ row: row, option: item.option });
653
+ });
654
+ setActive(getStartActiveIndex(), 0);
655
+ box.list.aria = { multiselectable: (isMultiple()) ? "true" : "false" };
656
+ refreshScrollBar();
657
+ };
658
+
659
+ const syncListSelection = function () {
660
+ if (!box.itemList) return;
661
+ const keys = box.getSelectedOptions().map(getListKey);
662
+ box.itemList.setSelected(keys, 1);
663
+ };
664
+
665
+ // A click on a row: the ItemList changes its selection (onListChange). The selected row clicked again
666
+ // (single) is not a change, but the list closes like the normal rows.
667
+ const onListItemClick = function (list, item) {
668
+ if (!isMultiple() && isSelected(item.option)) afterSelect(JSON.stringify(box.value));
669
+ };
670
+
671
+ const onListChange = function () {
672
+ const oldValue = JSON.stringify(box.value);
673
+ const values = box.itemList.getSelected().map(function (item) { return item.option.value; });
674
+ box.value = (isMultiple()) ? normalizeValue(values) : normalizeValue(values[0]);
675
+ afterSelect(oldValue);
676
+ };
677
+
678
+ // Enter / Space on the active row: through the ItemList, like a click.
679
+ const selectInItemList = function (option) {
680
+ const key = getListKey(option);
681
+ if (isMultiple() && isSelected(option)) {
682
+ box.itemList.unselect(key);
683
+ return;
684
+ }
685
+ if (isSelected(option)) {
686
+ afterSelect(JSON.stringify(box.value));
687
+ return;
688
+ }
689
+ box.itemList.select(key);
690
+ };
691
+
692
+ // The options of the rows that are shown now (the search)
693
+ const getShownOptions = function () {
694
+ if (usesItemList) return rows.map(function (item) { return item.option; });
695
+ return getFilteredOptions();
696
+ };
697
+
698
+ const getActiveColor = function () {
699
+ return (usesItemList) ? _s.itemList.hover.color : _s.optionActive.color;
700
+ };
701
+
702
+ // The look of a row that is not active any more.
703
+ const paintInactiveRow = function (row) {
704
+ if (usesItemList) {
705
+ box.itemList.refresh(); // WHY: The ItemList knows its look (selected, under the mouse).
706
+ return;
707
+ }
708
+ row.color = "transparent";
709
+ };
710
+
711
+ // Scrolls the list to show a row.
712
+ const scrollToRow = function (row) {
713
+ if (!usesItemList) {
714
+ row.elem.scrollIntoView({ block: "nearest" });
715
+ return;
716
+ }
717
+ // WHY: Only the list, by its own scrollTop: scrollIntoView() also scrolled the boxes around it.
718
+ const area = box.list.elem;
719
+ let top = 0;
720
+ for (let elem = row.elem; elem && elem !== area; elem = elem.offsetParent) top += elem.offsetTop;
721
+ const bottom = top + row.elem.offsetHeight;
722
+ if (top < area.scrollTop) area.scrollTop = top;
723
+ else if (bottom > area.scrollTop + area.clientHeight) area.scrollTop = bottom - area.clientHeight;
724
+ };
725
+
726
+ // Active row after the list is drawn: the first selected one, or the first enabled one
727
+ const getStartActiveIndex = function () {
728
+ if (_s.optionActive.showAtOpen == 0) return -1;
729
+ const selectedIndex = rows.findIndex(function (item) { return isSelected(item.option) && !item.option.disabled; });
730
+ if (selectedIndex >= 0) return selectedIndex;
731
+ return rows.findIndex(function (item) { return !item.option.disabled; });
732
+ };
733
+
734
+ const createDescription = function (html) {
735
+ const label = Label({ text: html, width: "100%", fontSize: _s.description.fontSize, textColor: _s.description.textColor });
736
+ if (_s.description.marginTop) label.css.marginTop = _s.description.marginTop + "px";
737
+ return label;
738
+ };
739
+
740
+ const createOptionRow = function (option, index) {
741
+
742
+ const selected = isSelected(option);
743
+
744
+ const row = HGroup({
745
+ width: "100%",
746
+ height: "auto",
747
+ align: "left center",
748
+ gap: _s.option.gap,
749
+ padding: _s.option.padding,
750
+ round: _s.option.round,
751
+ color: "transparent",
752
+ clickable: 1,
753
+ });
754
+ if (_s.option.minHeight) row.css.minHeight = _s.option.minHeight + "px";
755
+ if (selected && _s.optionSelected.opacity != 1) row.opacity = _s.optionSelected.opacity;
756
+ row.elem.id = id + "-option-" + index;
757
+ row.role = "option";
758
+ row.aria = { selected: (selected) ? "true" : "false" };
759
+ row.cursor = (option.disabled) ? "default" : "pointer";
760
+ if (option.disabled) {
761
+ row.aria = { disabled: "true" };
762
+ row.opacity = _s.optionDisabled.opacity;
763
+ }
764
+
765
+ // Multiple: check box
766
+ if (isMultiple()) {
767
+ createSvgLabel(SelectBox.getCheckSvg(selected, _s, CHECK_SIZE), CHECK_SIZE);
768
+ }
769
+
770
+ if (option.iconFile) {
771
+ const iconMargin = _s.option.iconMargin;
772
+ Icon({ width: _s.option.iconSize, height: _s.option.iconSize, round: _s.option.iconRound });
773
+ that.load(option.iconFile);
774
+ that.shrink = 0;
775
+ that.elem.alt = "";
776
+ that.css.margin = iconMargin[1] + "px 0px " + iconMargin[1] + "px " + iconMargin[0] + "px";
777
+ }
778
+
779
+ VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
780
+ that.css = { flex: "1 1 auto", minWidth: "0" };
781
+
782
+ const labelColor = (selected) ? _s.optionSelected.textColor : _s.option.textColor;
783
+ Label({ text: highlight(option.label), fontSize: _s.option.fontSize, textColor: labelColor, width: "100%" });
784
+ if (selected && !isMultiple() && _s.optionSelected.fontFamily) that.css.fontFamily = _s.optionSelected.fontFamily;
785
+ that.css.overflowWrap = "anywhere";
786
+
787
+ if (option.description) {
788
+ createDescription(highlight(option.description));
789
+ }
790
+
791
+ endGroup();
792
+
793
+ // Single: tick on the right
794
+ if (!isMultiple() && selected && _s.optionSelected.showTick == 1) {
795
+ createSvgLabel(SelectBox.getTickSvg(_s.optionSelected.checkColor, TICK_SIZE), TICK_SIZE);
796
+ }
797
+
798
+ endGroup();
799
+
800
+ row.on("mousemove", function () {
801
+ if (activeIndex != index && !option.disabled) setActive(index, 0);
802
+ });
803
+
804
+ row.on("click", function () {
805
+ if (!option.disabled) selectOption(option);
806
+ });
807
+
808
+ return row;
809
+
810
+ };
811
+
812
+ // scroll: 1 -> Move the list to show the active row.
813
+ const setActive = function (index, scroll = 1) {
814
+
815
+ if (rows[activeIndex]) paintInactiveRow(rows[activeIndex].row);
816
+ activeIndex = index;
817
+
818
+ const item = rows[activeIndex];
819
+ if (!item) {
820
+ box.panel.aria = { activedescendant: null };
821
+ box.aria = { activedescendant: null };
822
+ return;
823
+ }
824
+
825
+ item.row.color = getActiveColor();
826
+ box.aria = { activedescendant: item.row.elem.id };
827
+ if (box.searchInput) box.searchInput.inputElement.setAttribute("aria-activedescendant", item.row.elem.id);
828
+ if (scroll) scrollToRow(item.row);
829
+
830
+ };
831
+
832
+ // step: +1 or -1. Skips disabled options.
833
+ const moveActive = function (step) {
834
+ if (rows.length == 0) return;
835
+ // WHY: With no active row (-1), ArrowUp starts from the end: (-1 - 1) % length was the row before the last one.
836
+ let index = (activeIndex < 0 && step < 0) ? rows.length : activeIndex;
837
+ for (let i = 0; i < rows.length; i++) {
838
+ index = (index + step + rows.length) % rows.length;
839
+ if (!rows[index].option.disabled) return setActive(index);
840
+ }
841
+ };
842
+
843
+ // closeOnSelect: null -> close for single, stay open for multiple
844
+ const shouldCloseOnSelect = function () {
845
+ if (box.closeOnSelect === null) return !isMultiple();
846
+ return box.closeOnSelect == 1;
847
+ };
848
+
849
+ const toggleInValue = function (option) {
850
+ if (isSelected(option)) {
851
+ box.value = box.value.filter(function (v) { return !sameValue(v, option.value); });
852
+ return;
853
+ }
854
+ box.value = normalizeValue(box.value.concat([option.value]));
855
+ };
856
+
857
+ const selectOption = function (option) {
858
+
859
+ if (usesItemList) {
860
+ selectInItemList(option);
861
+ return;
862
+ }
863
+
864
+ const oldValue = JSON.stringify(box.value);
865
+ if (isMultiple()) {
866
+ toggleInValue(option);
867
+ } else {
868
+ box.value = option.value;
869
+ }
870
+ afterSelect(oldValue);
871
+
872
+ };
873
+
874
+ // After a choice: the field, the list (closed or drawn again) and onChange.
875
+ const afterSelect = function (oldValue) {
876
+
877
+ const isChanged = (JSON.stringify(box.value) !== oldValue);
878
+
879
+ const keepActive = activeIndex;
880
+ updateField();
881
+
882
+ if (shouldCloseOnSelect()) {
883
+ box.close();
884
+ box.elem.focus();
885
+ } else {
886
+ const scrollTop = box.list.elem.scrollTop;
887
+ renderList();
888
+ box.list.elem.scrollTop = scrollTop; // WHY: The list must not jump after a click.
889
+ setActive(keepActive, 0);
890
+ }
891
+
892
+ // WHY: The selected option clicked again is not a change.
893
+ if (isChanged) box.onChange(box);
894
+
895
+ };
896
+
897
+ // Position the popup panel under (or above) the field.
898
+ // Makes the list shorter by "extra" px. (Not shorter than MIN_LIST_HEIGHT.)
899
+ // WHY: From the height of the list now, not from panelMaxHeight: a list shorter than panelMaxHeight was not made shorter.
900
+ const shortenList = function (extra) {
901
+ box.list.css.maxHeight = Math.max(MIN_LIST_HEIGHT, box.list.elem.offsetHeight - extra) + "px";
902
+ };
903
+
904
+ const positionPanel = function () {
905
+
906
+ const rect = box.elem.getBoundingClientRect();
907
+ const width = Math.max(withPageZoom(rect.width), box.panelMinWidth);
908
+
909
+ box.panel.width = width;
910
+
911
+ if (box.fullHeightList == 1) {
912
+ placePanelFullHeight(rect, width);
913
+ return;
914
+ }
915
+
916
+ box.list.css.maxHeight = box.panelMaxHeight + "px";
917
+
918
+ if (_s.panel.coverField == 1) {
919
+ placePanelOverField(rect, width);
920
+ return;
921
+ }
922
+
923
+ const panelHeight = box.panel.elem.offsetHeight;
924
+ const below = page.height - withPageZoom(rect.bottom) - PANEL_GAP - SCREEN_MARGIN;
925
+ const above = withPageZoom(rect.top) - PANEL_GAP - SCREEN_MARGIN;
926
+
927
+ let top = withPageZoom(rect.bottom) + PANEL_GAP;
928
+ if (panelHeight > below && above > below) {
929
+ // Open above. Make the list shorter if there is not enough space.
930
+ const extra = panelHeight - above;
931
+ if (extra > 0) shortenList(extra);
932
+ top = withPageZoom(rect.top) - box.panel.elem.offsetHeight - PANEL_GAP;
933
+ } else if (panelHeight > below) {
934
+ shortenList(panelHeight - below);
935
+ }
936
+
937
+ let left = withPageZoom(rect.left);
938
+ left = Math.max(SCREEN_MARGIN, Math.min(left, page.width - width - SCREEN_MARGIN));
939
+
940
+ box.panel.left = left;
941
+ box.panel.top = Math.max(SCREEN_MARGIN, top);
942
+
943
+ };
944
+
945
+ // style.panel.coverField: the panel opens over the field: from its top down to the bottom of the page, or
946
+ // (when there is more space above) from its bottom up to the top of the page.
947
+ const placePanelOverField = function (rect, width) {
948
+ // WHY: A panel shorter than the field (a search with few results) showed the bottom of the field under it.
949
+ box.panel.css.minHeight = withPageZoom(rect.height) + "px";
950
+ const fieldTop = withPageZoom(rect.top);
951
+ const fieldBottom = withPageZoom(rect.bottom);
952
+ const spaceDown = page.height - fieldTop - SCREEN_MARGIN;
953
+ const spaceUp = fieldBottom - SCREEN_MARGIN;
954
+ const panelHeight = box.panel.elem.offsetHeight;
955
+ const isUp = (panelHeight > spaceDown && spaceUp > spaceDown);
956
+ const space = isUp ? spaceUp : spaceDown;
957
+ if (panelHeight > space) shortenList(panelHeight - space);
958
+
959
+ let left = withPageZoom(rect.left);
960
+ left = Math.max(SCREEN_MARGIN, Math.min(left, page.width - width - SCREEN_MARGIN));
961
+ box.panel.left = left;
962
+ box.panel.top = isUp ? fieldBottom - box.panel.elem.offsetHeight : fieldTop;
963
+ };
964
+
965
+ // fullHeightList: the panel from the top of the page to its bottom, at the left of the field. The list fills
966
+ // the panel, so the panel stays that high after a search that leaves a few rows.
967
+ const placePanelFullHeight = function (rect, width) {
968
+ let left = withPageZoom(rect.left);
969
+ left = Math.max(0, Math.min(left, page.width - width));
970
+ box.panel.left = left;
971
+ box.panel.top = 0;
972
+ box.panel.height = page.height;
973
+ };
974
+
975
+ // The height of the panel and the list for fullHeightList (1) or the normal list (0).
976
+ const applyListHeightMode = function () {
977
+ const isFullHeight = (box.fullHeightList == 1);
978
+ // WHY: a full height list touches the top and the bottom of the page: square corners, like the old SelectItem.
979
+ box.panel.round = isFullHeight ? 0 : _s.panel.round;
980
+ box.panel.height = "auto";
981
+ box.panel.css.minHeight = "";
982
+ box.list.css = {
983
+ flex: isFullHeight ? "1 1 auto" : "",
984
+ minHeight: isFullHeight ? "0px" : "",
985
+ maxHeight: isFullHeight ? "none" : box.panelMaxHeight + "px",
986
+ };
987
+ };
988
+
989
+ // style.panel.motion: the panel fades and grows in.
990
+ const showPanelWithMotion = function () {
991
+ if (!_s.panel.motion) return;
992
+ box.panel.clickable = 1;
993
+ box.panel.css.transition = "none";
994
+ box.panel.css.opacity = "0";
995
+ box.panel.css.transform = "scale(" + _s.panel.startScale + ")";
996
+ // WHY: Read a size, so the browser draws the start state before the transition is turned on.
997
+ void box.panel.elem.offsetHeight;
998
+ box.panel.css.transition = _s.panel.motion;
999
+ box.panel.css.opacity = "1";
1000
+ box.panel.css.transform = "scale(1)";
1001
+ };
1002
+
1003
+ // Returns 1 when the panel is hidden later (after its motion).
1004
+ const hidePanelWithMotion = function () {
1005
+ if (!_s.panel.motion) return 0;
1006
+ box.panel.clickable = 0; // WHY: A fading panel must not take a click.
1007
+ box.panel.css.opacity = "0";
1008
+ box.panel.css.transform = "scale(" + _s.panel.startScale + ")";
1009
+ box.after(_s.panel.motionDuration, function () {
1010
+ if (!isOpen) box.panel.visible = 0;
1011
+ });
1012
+ return 1;
1013
+ };
1014
+
1015
+ const selectActiveRow = function () {
1016
+ const item = rows[activeIndex];
1017
+ if (item && !item.option.disabled) selectOption(item.option);
1018
+ };
1019
+
1020
+ // A letter typed without Ctrl / Cmd / Alt
1021
+ const isTypedLetter = function (event) {
1022
+ if (event.key.length != 1) return false;
1023
+ return !event.ctrlKey && !event.metaKey && !event.altKey;
1024
+ };
1025
+
1026
+ const onKeyDown = function (self, event) {
1027
+
1028
+ if (box.enabled != 1) return;
1029
+ const key = event.key;
1030
+ const inSearch = box.searchInput && event.target === box.searchInput.inputElement;
1031
+
1032
+ if (!isOpen) {
1033
+ if (key == "Enter" || key == " " || key == "ArrowDown" || key == "ArrowUp") {
1034
+ event.preventDefault();
1035
+ box.open();
1036
+ } else if (isTypedLetter(event) && isSearchable()) {
1037
+ // Typing on the field starts a search.
1038
+ event.preventDefault();
1039
+ box.open(key);
1040
+ }
1041
+ return;
1042
+ }
1043
+
1044
+ switch (key) {
1045
+ case "ArrowDown":
1046
+ event.preventDefault();
1047
+ moveActive(1);
1048
+ break;
1049
+ case "ArrowUp":
1050
+ event.preventDefault();
1051
+ moveActive(-1);
1052
+ break;
1053
+ case "Home":
1054
+ if (inSearch) return;
1055
+ event.preventDefault();
1056
+ setActive(-1, 0);
1057
+ moveActive(1);
1058
+ break;
1059
+ case "End":
1060
+ if (inSearch) return;
1061
+ event.preventDefault();
1062
+ setActive(rows.length, 0);
1063
+ moveActive(-1);
1064
+ break;
1065
+ case "Enter":
1066
+ event.preventDefault();
1067
+ selectActiveRow();
1068
+ break;
1069
+ case " ":
1070
+ if (inSearch) return; // WHY: Space is a letter in the search.
1071
+ event.preventDefault();
1072
+ selectActiveRow();
1073
+ break;
1074
+ case "Escape":
1075
+ event.preventDefault();
1076
+ box.close();
1077
+ box.elem.focus();
1078
+ break;
1079
+ case "Tab":
1080
+ box.close();
1081
+ break;
1082
+ }
1083
+
1084
+ };
1085
+
1086
+ // WHY: The full height list is placed again (on a phone the keyboard of the search box resizes the page).
1087
+ const onPageResize = function () {
1088
+ if (!isOpen) return;
1089
+ if (box.fullHeightList != 1) {
1090
+ box.close();
1091
+ return;
1092
+ }
1093
+ positionPanel();
1094
+ refreshScrollBar();
1095
+ };
1096
+
1097
+ // *** THE SEARCH BOX
1098
+
1099
+ const createSearchBox = function () {
1100
+ if (usesSearchInput) createSearchInput();
1101
+ else createOwnSearch();
1102
+ box.searchGroup.shrink = 0;
1103
+ const input = box.searchInput.inputElement;
1104
+ input.setAttribute("aria-label", box.searchPlaceholder);
1105
+ input.setAttribute("aria-controls", id + "-list");
1106
+ input.setAttribute("autocomplete", "off");
1107
+ };
1108
+
1109
+ // A SearchInput of comp/search-input-v2.js (style.searchInput), with its clear button.
1110
+ const createSearchInput = function () {
1111
+ const params = Object.assign({}, _s.searchInput);
1112
+ params.searchIconFile = SelectBox.getSearchIconFile(params.searchIconFile);
1113
+ params.clearIconFile = SelectBox.getSearchIconFile(params.clearIconFile);
1114
+ params.width = "100%";
1115
+ params.scale = 1; // WHY: style.searchInput is scaled already (with the style of SelectBox).
1116
+ params.placeholderText = box.searchPlaceholder;
1117
+ params.onSearch = onSearchTextChange; // WHY: also after its clear button (that is not an "input" event).
1118
+ box.searchGroup = SearchInput(params);
1119
+ box.searchInput = box.searchGroup.txtSearch;
1120
+ };
1121
+
1122
+ // The own search box: an icon and an input in a group (style.search).
1123
+ const createOwnSearch = function () {
1124
+ // GROUP: Search
1125
+ box.searchGroup = HGroup({
1126
+ width: "100%",
1127
+ height: _s.search.height,
1128
+ align: "left center",
1129
+ gap: SEARCH_GAP,
1130
+ padding: _s.search.padding,
1131
+ color: _s.search.color,
1132
+ border: _s.search.border,
1133
+ borderColor: _s.search.borderColor,
1134
+ round: _s.search.round,
1135
+ });
1136
+ if (_s.search.borderBottom) box.searchGroup.css.borderBottom = _s.search.borderBottom;
1137
+
1138
+ createSvgLabel(SelectBox.getSearchSvg(_s.arrow.color, _s.search.iconSize), _s.search.iconSize);
1139
+
1140
+ box.searchInput = Input({ width: "100%", height: _s.search.height - SEARCH_INPUT_SPACE, minimal: 1, color: "transparent", fontSize: _s.search.fontSize, textColor: _s.search.textColor });
1141
+ box.searchInput.inputElement.style.padding = "0px";
1142
+ box.searchInput.inputElement.placeholder = box.searchPlaceholder;
1143
+ box.searchInput.css = { flex: "1 1 auto", minWidth: "0" };
1144
+
1145
+ endGroup();
1146
+ };
1147
+
1148
+ const setSearchBoxText = function (text) {
1149
+ if (usesSearchInput) box.searchGroup.setText(text);
1150
+ else box.searchInput.text = text;
1151
+ };
1152
+
1153
+ // The list of the typed text. (Only when the text changed: SearchInput and the input event both call it.)
1154
+ const onSearchTextChange = function () {
1155
+ if (box.searchInput.text === searchText) return;
1156
+ searchText = box.searchInput.text;
1157
+ renderList();
1158
+ box.list.elem.scrollTop = 0;
1159
+ };
1160
+
1161
+ // *** PUBLIC FUNCTIONS:
1162
+
1163
+ // startText: The first letters of the search (typed on the closed field)
1164
+ box.open = function (startText = "") {
1165
+
1166
+ if (isOpen || box.enabled != 1) return;
1167
+ isOpen = 1;
1168
+
1169
+ searchText = (isSearchable()) ? startText : "";
1170
+ box.searchGroup.visible = (isSearchable()) ? 1 : 0;
1171
+ setSearchBoxText(searchText);
1172
+ box.footer.visible = (isMultiple() && box.showSelectAll == 1) ? 1 : 0;
1173
+
1174
+ box.overlay.visible = 1;
1175
+ box.panel.visible = 1;
1176
+ applyListHeightMode();
1177
+ renderList();
1178
+ positionPanel();
1179
+ refreshScrollBar(); // WHY: positionPanel may make the list shorter.
1180
+ showPanelWithMotion();
1181
+ if (rows[activeIndex]) scrollToRow(rows[activeIndex].row);
1182
+
1183
+ if (isSearchable()) {
1184
+ box.searchInput.inputElement.focus({ preventScroll: true });
1185
+ const length = searchText.length;
1186
+ box.searchInput.inputElement.setSelectionRange(length, length);
1187
+ } else {
1188
+ box.panel.elem.focus({ preventScroll: true });
1189
+ }
1190
+
1191
+ updateField();
1192
+ box.onOpen(box);
1193
+
1194
+ };
1195
+
1196
+ box.close = function () {
1197
+
1198
+ if (!isOpen) return;
1199
+ isOpen = 0;
1200
+
1201
+ box.overlay.visible = 0;
1202
+ if (!hidePanelWithMotion()) box.panel.visible = 0;
1203
+
1204
+ updateField();
1205
+ box.onClose(box);
1206
+
1207
+ };
1208
+
1209
+ box.toggle = function () {
1210
+ (isOpen) ? box.close() : box.open();
1211
+ };
1212
+
1213
+ box.isOpen = function () {
1214
+ return isOpen;
1215
+ };
1216
+
1217
+ // silent: 1 -> onChange is not called.
1218
+ box.setValue = function (value, silent = 0) {
1219
+ box.value = normalizeValue(value);
1220
+ updateField();
1221
+ if (isOpen) renderList();
1222
+ if (!silent) box.onChange(box);
1223
+ };
1224
+ // USAGE: select.setValue("apple") or select.setValue(["a", "b"]) (multiple)
1225
+
1226
+ box.getValue = function () {
1227
+ return (isMultiple()) ? box.value.slice() : box.value;
1228
+ };
1229
+
1230
+ box.getSelectedOptions = function () {
1231
+ return box.options.filter(isSelected);
1232
+ };
1233
+
1234
+ // Changes the options. The value is kept if it is still in the options.
1235
+ box.setOptions = function (options, silent = 1) {
1236
+ box.options = SelectBox.normalizeOptions(options);
1237
+ const oldValue = JSON.stringify(box.value);
1238
+ box.value = normalizeValue(box.value);
1239
+ if (box.itemList) fillItemList();
1240
+ updateField();
1241
+ if (isOpen) renderList();
1242
+ if (!silent && JSON.stringify(box.value) != oldValue) box.onChange(box);
1243
+ };
1244
+
1245
+ box.clear = function (silent = 0) {
1246
+ box.setValue((isMultiple()) ? [] : null, silent);
1247
+ };
1248
+
1249
+ box.setEnabled = function (enabled) {
1250
+ box.enabled = basic.isOn(enabled) ? 1 : 0;
1251
+ if (box.enabled != 1) box.close();
1252
+ updateField();
1253
+ };
1254
+
1255
+ box.setPlaceholder = function (text) {
1256
+ box.placeholder = text;
1257
+ updateField();
1258
+ };
1259
+
1260
+ box.focus = function () {
1261
+ box.elem.focus();
1262
+ };
1263
+
1264
+ // 1: the list from the top of the page to its bottom. 0: under (or above) the field.
1265
+ box.setFullHeightList = function (value) {
1266
+ box.fullHeightList = basic.isOn(value) ? 1 : 0;
1267
+ if (!isOpen) return;
1268
+ applyListHeightMode();
1269
+ positionPanel();
1270
+ refreshScrollBar();
1271
+ };
1272
+ // USAGE: select.setFullHeightList(1)
1273
+
1274
+
1275
+ // *** OBJECT VIEW:
1276
+
1277
+ box.color = "transparent";
1278
+ box.clickable = 1;
1279
+ box.css = { outline: "none", userSelect: "none" };
1280
+ box.role = "combobox";
1281
+ box.aria = { haspopup: "listbox", controls: id + "-list" };
1282
+ if (box.ariaLabel) box.aria = { label: box.ariaLabel };
1283
+
1284
+ // GROUP: Field
1285
+ box.field = HGroup({
1286
+ width: "100%",
1287
+ height: "100%",
1288
+ align: "left center",
1289
+ gap: _s.fieldOption.gap,
1290
+ ..._s.field,
1291
+ });
1292
+ box.field.setMotion("border-color 0.15s");
1293
+
1294
+ // ICON: The icon of the selected option (style.fieldOption.iconSize)
1295
+ box.fieldIcon = Icon({ width: _s.fieldOption.iconSize, height: _s.fieldOption.iconSize, round: _s.fieldOption.iconRound });
1296
+ box.fieldIcon.shrink = 0;
1297
+ box.fieldIcon.elem.alt = "";
1298
+ box.fieldIcon.css.marginLeft = _s.fieldOption.iconMarginLeft + "px";
1299
+
1300
+ // GROUP: Selected text and its description
1301
+ box.fieldTexts = VGroup({ width: "auto", height: "auto", align: "left center", gap: 0 });
1302
+ box.fieldTexts.css = { flex: "1 1 auto", minWidth: "0", alignItems: "stretch" };
1303
+
1304
+ // LABEL: Selected text
1305
+ box.fieldText = Label({
1306
+ text: "",
1307
+ width: "100%",
1308
+ fontSize: _s.fieldText.fontSize,
1309
+ textColor: _s.fieldText.textColor,
1310
+ });
1311
+ box.fieldText.ellipsis = 1;
1312
+
1313
+ // LABEL: Description of the selected option
1314
+ box.fieldDescription = createDescription("");
1315
+ box.fieldDescription.ellipsis = 1;
1316
+
1317
+ endGroup();
1318
+ // WHY: Hidden after they are created: children created in a hidden group are not flex items.
1319
+ box.fieldIcon.visible = 0;
1320
+ box.fieldDescription.visible = 0;
1321
+
1322
+ // LABEL: Clear button
1323
+ box.clearButton = Label({
1324
+ text: SelectBox.getClearSvg(_s.arrow.color, CLEAR_ICON_SIZE),
1325
+ width: CLEAR_BUTTON_SIZE,
1326
+ height: CLEAR_BUTTON_SIZE,
1327
+ round: BUTTON_ROUND,
1328
+ clickable: 1,
1329
+ });
1330
+ box.clearButton.shrink = 0;
1331
+ box.clearButton.lineHeight = "0";
1332
+ box.clearButton.elem.style.display = "flex";
1333
+ box.clearButton.css = { alignItems: "center", justifyContent: "center" };
1334
+ box.clearButton.cursor = "pointer";
1335
+ box.clearButton.aria = { label: "Clear" };
1336
+
1337
+ // LABEL: Arrow
1338
+ const arrowSvg = (_s.arrow.icon === "unfold") ? SelectBox.getUnfoldSvg(_s.arrow.color, _s.arrow.size) : SelectBox.getArrowSvg(_s.arrow.color, _s.arrow.size);
1339
+ box.arrow = createSvgLabel(arrowSvg, _s.arrow.size);
1340
+ box.arrow.css.transition = "transform 0.15s";
1341
+ box.arrow.opacity = _s.arrow.opacity;
1342
+ if (_s.arrow.marginRight) box.arrow.css.marginRight = _s.arrow.marginRight + "px";
1343
+
1344
+ endGroup();
1345
+
1346
+ // POPUP: Create the overlay and the panel on the page, over everything.
1347
+ setDefaultContainerBox(page);
1348
+ // NOTE: endGroup() of the panel below returns the default container to the component box.
1349
+
1350
+ // BOX: Transparent overlay (click outside: close)
1351
+ // WHY a very big box and not 100% x 100%: with position "fixed" the "100%" is taken from the nearest parent that
1352
+ // has a zoom or a transform (page.autoFit, a scaled preview); there the overlay had no height (0 px) and a click
1353
+ // outside the list did not close it. A box that starts far before the screen and ends far after it covers the
1354
+ // screen in every case.
1355
+ const OVERLAY_SIZE = 20000; // px
1356
+ box.overlay = Box(-OVERLAY_SIZE, -OVERLAY_SIZE, OVERLAY_SIZE * 2, OVERLAY_SIZE * 2, { color: "transparent", clickable: 1 });
1357
+ box.overlay.css.position = "fixed";
1358
+ box.overlay.zIndex = OVERLAY_Z_INDEX;
1359
+
1360
+ // GROUP: Panel
1361
+ box.panel = VGroup({
1362
+ width: box.panelMinWidth,
1363
+ height: "auto",
1364
+ align: "left top",
1365
+ gap: _s.panel.gap,
1366
+ color: _s.panel.color,
1367
+ border: _s.panel.border,
1368
+ borderColor: _s.panel.borderColor,
1369
+ round: _s.panel.round,
1370
+ padding: _s.panel.padding,
1371
+ clickable: 1,
1372
+ });
1373
+ box.panel.css = { alignItems: "stretch", outline: "none" };
1374
+ box.panel.boxShadow = _s.panel.shadow;
1375
+ box.panel.zIndex = PANEL_Z_INDEX;
1376
+ box.panel.tabIndex = -1;
1377
+
1378
+ // SEARCH: a SearchInput, or the own search box
1379
+ createSearchBox();
1380
+
1381
+ // BOX: List
1382
+ box.list = Box({ width: "100%", height: "auto", color: "transparent", scrollY: 1, position: "relative" });
1383
+ box.list.elem.id = id + "-list";
1384
+ box.list.role = "listbox";
1385
+ box.list.css.overscrollBehavior = "contain";
1386
+
1387
+ // GROUP: Footer (multiple)
1388
+ box.footer = HGroup({ width: "100%", height: "auto", align: "left center", padding: FOOTER_PADDING });
1389
+ box.footer.css = {
1390
+ justifyContent: "space-between",
1391
+ borderTop: DIVIDER_WIDTH + "px solid " + _s.divider.color,
1392
+ };
1393
+ box.footer.shrink = 0;
1394
+
1395
+ box.selectAllButton = Label({ text: SelectBox.escapeHtml(box.selectAllText), padding: FOOTER_BUTTON_PADDING, round: BUTTON_ROUND, clickable: 1, ..._s.footerButton });
1396
+ box.selectAllButton.cursor = "pointer";
1397
+
1398
+ box.clearAllButton = Label({ text: SelectBox.escapeHtml(box.clearText), padding: FOOTER_BUTTON_PADDING, round: BUTTON_ROUND, clickable: 1, ..._s.footerButton });
1399
+ box.clearAllButton.cursor = "pointer";
1400
+
1401
+ endGroup();
1402
+
1403
+ endGroup();
1404
+
1405
+ box.overlay.visible = 0;
1406
+ box.panel.visible = 0;
1407
+
1408
+ // SCROLL BAR: on the list. It moves itself into the panel (the parent of the list) and sits over the list.
1409
+ // WHY: Created here, not in the panel: an object created in the panel (a group) would be a part of its layout.
1410
+ if (box.useScrollBar == 1 && typeof ScrollBar !== "undefined") {
1411
+ // WHY scale 1: style.scrollBar is scaled already (with the style of SelectBox).
1412
+ box.scrollBar = ScrollBar(Object.assign({ scrollableBox: box.list, scale: 1 }, _s.scrollBar));
1413
+ }
1414
+
1415
+ // *** OBJECT INIT CODE:
1416
+
1417
+ box.on("click", function (self, event) {
1418
+ if (box.enabled != 1) return;
1419
+ if (box.clearButton.elem.contains(event.target)) return;
1420
+ box.toggle();
1421
+ });
1422
+ box.on("keydown", onKeyDown);
1423
+ box.on("focus", function () {
1424
+ isFocused = 1;
1425
+ updateField();
1426
+ });
1427
+ box.on("blur", function () {
1428
+ isFocused = 0;
1429
+ updateField();
1430
+ });
1431
+ box.on("mouseover", function () {
1432
+ isMouseOver = 1;
1433
+ updateField();
1434
+ });
1435
+ box.on("mouseout", function () {
1436
+ isMouseOver = 0;
1437
+ updateField();
1438
+ });
1439
+
1440
+ box.clearButton.on("click", function () {
1441
+ box.clear();
1442
+ box.elem.focus();
1443
+ });
1444
+
1445
+ box.overlay.on("click", function () { box.close(); });
1446
+
1447
+ box.panel.on("keydown", onKeyDown);
1448
+ // style.optionActive.showAtOpen: 0 -> the active row is only the row under the mouse (or of the keyboard).
1449
+ box.list.on("mouseleave", function () {
1450
+ if (_s.optionActive.showAtOpen == 0) setActive(-1, 0);
1451
+ });
1452
+ // WHY: Keep the keyboard focus (field or search) when a row is pressed.
1453
+ box.panel.on("mousedown", function (self, event) {
1454
+ if (event.target !== box.searchInput.inputElement) event.preventDefault();
1455
+ });
1456
+
1457
+ box.searchInput.inputElement.addEventListener("input", onSearchTextChange);
1458
+
1459
+ box.selectAllButton.on("click", function () {
1460
+ // Only the options in the search result
1461
+ const enabledOptions = getShownOptions().filter(function (option) { return !option.disabled; });
1462
+ const valuesToAdd = enabledOptions.map(function (option) { return option.value; });
1463
+ box.setValue(box.value.concat(valuesToAdd));
1464
+ });
1465
+
1466
+ box.clearAllButton.on("click", function () {
1467
+ box.clear();
1468
+ });
1469
+
1470
+ // (onPageResize / own: the overlay and the panel are on the page, they are removed with the box)
1471
+ box.onPageResize(onPageResize);
1472
+ box.own(box.overlay);
1473
+ box.own(box.panel);
1474
+
1475
+ box.enabled = basic.isOn(box.enabled) ? 1 : 0;
1476
+ box.options = SelectBox.normalizeOptions(startOptions);
1477
+ box.value = normalizeValue(startValue);
1478
+
1479
+ updateField();
1480
+
1481
+ return endObject(box);
1482
+
1483
+ };
1484
+
1485
+ // *** STATIC VARIABLES AND FUNCTIONS:
1486
+
1487
+ SelectBox._counter = 1;
1488
+
1489
+ // scale: every size of the style and of the size params is multiplied (params is changed). Scale 1 changes nothing.
1490
+ // WHY: The default (null) is read when a select box is made, not when this file is loaded: the page sets
1491
+ // basic.uiScale later (page.fit(600, 800); basic.uiScale = 1 / page.zoom).
1492
+ SelectBox.applyScale = function (params) {
1493
+ const givenScale = Number(params.scale);
1494
+ params.scale = (givenScale > 0) ? givenScale : (basic.uiScale || 1);
1495
+ if (params.scale === 1) return;
1496
+ const scale = params.scale;
1497
+ const style = basic.scaleStyle(params.style, scale);
1498
+ // WHY: Texts with px in them: basic.scaleStyle changes only the numbers.
1499
+ style.panel.shadow = basic.scaleCssText(style.panel.shadow, scale);
1500
+ style.search.borderBottom = basic.scaleCssText(style.search.borderBottom, scale);
1501
+ style.searchInput.borderBottomStyle = basic.scaleCssText(style.searchInput.borderBottomStyle, scale);
1502
+ params.style = style;
1503
+ ["width", "height", "panelMinWidth", "panelMaxHeight"].forEach(function (name) {
1504
+ params[name] = basic.scaleSize(params[name], scale);
1505
+ });
1506
+ };
1507
+
1508
+ // createItemView needs comp/item-list.js. Without it: one warning, and the normal rows.
1509
+ SelectBox.canUseItemList = function () {
1510
+ if (typeof ItemList !== "undefined") return true;
1511
+ if (!SelectBox._hasWarnedItemList) {
1512
+ console.warn("SelectBox: createItemView needs comp/item-list.js (ItemList), loaded before select-box.js. The normal rows are used.");
1513
+ SelectBox._hasWarnedItemList = 1;
1514
+ }
1515
+ return false;
1516
+ };
1517
+
1518
+ // The search box is a SearchInput when comp/search-input-v2.js is loaded (no warning without it: the own box).
1519
+ // WHY: SearchInput.styles: the comp-m1 SearchInput had the same global name and not the same params.
1520
+ SelectBox.canUseSearchInput = function () {
1521
+ return (typeof SearchInput === "function") && !!SearchInput.styles;
1522
+ };
1523
+
1524
+ // An icon file of style.searchInput: a name without a folder ("search.svg") is taken from the folder of the
1525
+ // loaded comp/search-input-v2.js. WHY: SearchInput gives paths from a page in a samples folder ("_basic/comp/");
1526
+ // a page of another folder did not find them. A path ("../my/search.svg") or a data: URL is used as it is.
1527
+ SelectBox.getSearchIconFile = function (file) {
1528
+ if (!file || file.includes("/")) return file;
1529
+ const script = document.querySelector('script[src*="search-input-v2"]');
1530
+ if (!script) return file;
1531
+ return script.getAttribute("src").replace(/search-input-v2(\.min)?\.js.*$/, "search-input-v2/") + file;
1532
+ };
1533
+
1534
+ // "Apple" -> { value: "Apple", label: "Apple", description: "", iconFile: "", group: "", disabled: 0 }
1535
+ SelectBox.normalizeOptions = function (options) {
1536
+ return (options || []).map(function (option) {
1537
+ if (option === null || typeof option !== "object") {
1538
+ return { value: option, label: String(option), description: "", iconFile: "", group: "", disabled: 0 };
1539
+ }
1540
+ return {
1541
+ ...option,
1542
+ value: option.value,
1543
+ label: String(option.label ?? option.value),
1544
+ description: option.description || "",
1545
+ iconFile: option.iconFile || "",
1546
+ group: option.group || "",
1547
+ disabled: basic.isOn(option.disabled) ? 1 : 0,
1548
+ };
1549
+ });
1550
+ };
1551
+
1552
+ // WHY: Label.text uses innerHTML. Texts must not be read as HTML.
1553
+ SelectBox.escapeHtml = basic.escapeHtml; // (the name is kept: other code may use it)
1554
+
1555
+ SelectBox.getArrowSvg = function (color, size = 16) {
1556
+ return '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 0 24 24" fill="none" stroke="' + color + '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>';
1557
+ };
1558
+
1559
+ // Up and down arrows (the "unfold more" icon of the comp-m1 SelectItem)
1560
+ SelectBox.getUnfoldSvg = function (color, size = 20) {
1561
+ return '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 -960 960 960" fill="' + color + '"><path d="M480-80 240-320l57-57 183 183 183-183 57 57L480-80ZM298-584l-58-56 240-240 240 240-58 56-182-182-182 182Z"/></svg>';
1562
+ };
1563
+
1564
+ SelectBox.getClearSvg = function (color, size = 14) {
1565
+ return '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 0 24 24" fill="none" stroke="' + color + '" stroke-width="2.2" stroke-linecap="round"><path d="M6 6l12 12M18 6 6 18"/></svg>';
1566
+ };
1567
+
1568
+ SelectBox.getSearchSvg = function (color, size = 16) {
1569
+ return '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 0 24 24" fill="none" stroke="' + color + '" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>';
1570
+ };
1571
+
1572
+ SelectBox.getTickSvg = function (color, size = 16) {
1573
+ return '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 0 24 24" fill="none" stroke="' + color + '" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m5 12.5 4.5 4.5L19 7.5"/></svg>';
1574
+ };
1575
+
1576
+ // Check box of the multiple mode
1577
+ SelectBox.getCheckSvg = function (checked, style, size = 18) {
1578
+ const s = style.optionSelected;
1579
+ const svgStart = '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 0 18 18">';
1580
+ if (!checked) {
1581
+ return svgStart + '<rect x="1" y="1" width="16" height="16" rx="4" fill="none" stroke="' + style.arrow.color + '" stroke-width="1.5"/></svg>';
1582
+ }
1583
+ return svgStart + '<rect x="0.5" y="0.5" width="17" height="17" rx="4" fill="' + s.checkColor + '"/>' +
1584
+ '<path d="m4.5 9.3 3 3 6-6.3" fill="none" stroke="' + s.checkTickColor + '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
1585
+ };
1586
+
1587
+ // *** STYLE PACKAGES:
1588
+ // USAGE: SelectBox({ styleName: "dark" })
1589
+ // USAGE: SelectBox({ styleName: "dark", style: { field: { round: 4 } } }) // Change only some keys.
1590
+ // USAGE: SelectBox({ style: SelectBox.styles.dark }) // The same as styleName: "dark". (The package is copied, never changed.)
1591
+ // NOTE: A new package needs only the keys that differ from the default (classic) style.
1592
+ // USAGE: SelectBox.styles.myStyle = { field: { color: "ivory" } };
1593
+ SelectBox.styles = {
1594
+
1595
+ // White field, dark text, a soft line.
1596
+ classic: SelectBoxDefaults.style,
1597
+
1598
+ // Dark theme. (The other dark packages of comp-m4 use these colors.)
1599
+ dark: {
1600
+ field: { color: "#232322", border: 1, borderColor: "rgba(255, 255, 255, 0.10)", round: 8, padding: [12, 0] },
1601
+ fieldHover: { borderColor: "rgba(255, 255, 255, 0.30)" },
1602
+ fieldFocus: { borderColor: "#65A293" },
1603
+ fieldText: { fontSize: 15, textColor: "rgba(255, 255, 255, 0.90)" },
1604
+ placeholder: { textColor: "rgba(255, 255, 255, 0.40)" },
1605
+ arrow: { color: "rgba(255, 255, 255, 0.55)" },
1606
+ panel: { color: "#232322", border: 1, borderColor: "rgba(255, 255, 255, 0.12)", round: 10, padding: 6, shadow: "0 8px 24px rgba(0, 0, 0, 0.5)" },
1607
+ searchInput: {
1608
+ styleName: "classic",
1609
+ height: 38,
1610
+ searchIconLeft: 10, // WHY: the icon and the text at the place of the own search input (icon 18, text 42)
1611
+ color: "rgba(255, 255, 255, 0.05)",
1612
+ border: 1,
1613
+ borderColor: "rgba(255, 255, 255, 0.10)",
1614
+ borderBottomStyle: "1px solid rgba(255, 255, 255, 0.10)",
1615
+ round: 6,
1616
+ fontSize: 14,
1617
+ textColor: "rgba(255, 255, 255, 0.90)",
1618
+ placeholderColor: "",
1619
+ searchIconSize: 16,
1620
+ searchIconOpacity: 0.55,
1621
+ clearIconOpacity: 0.45,
1622
+ invertIconColor: 1, // WHY: the icon files are black.
1623
+ },
1624
+ search: { color: "rgba(255, 255, 255, 0.05)", border: 1, borderColor: "rgba(255, 255, 255, 0.10)", round: 6, fontSize: 14, textColor: "rgba(255, 255, 255, 0.90)" },
1625
+ option: { fontSize: 14, textColor: "rgba(255, 255, 255, 0.85)", round: 6, padding: [10, 8] },
1626
+ optionActive: { color: "rgba(255, 255, 255, 0.08)" },
1627
+ optionSelected: { textColor: "#FFFFFF", checkColor: "#3D7A6B", checkTickColor: "#FFFFFF" },
1628
+ optionDisabled: { opacity: 0.4 },
1629
+ description: { fontSize: 12, textColor: "rgba(255, 255, 255, 0.45)" },
1630
+ group: { fontSize: 11, textColor: "rgba(255, 255, 255, 0.45)" },
1631
+ highlight: { color: "rgba(101, 162, 147, 0.45)" },
1632
+ empty: { fontSize: 14, textColor: "rgba(255, 255, 255, 0.45)" },
1633
+ footerButton: { fontSize: 13, textColor: "#65A293" },
1634
+ divider: { color: "rgba(255, 255, 255, 0.08)" },
1635
+ disabled: { opacity: 0.4 },
1636
+ itemList: {
1637
+ hover: { color: "rgba(255, 255, 255, 0.08)" },
1638
+ selected: { color: "rgba(255, 255, 255, 0.05)", opacity: 1 },
1639
+ check: { color: "#3D7A6B", iconColor: "#FFFFFF", borderColor: "rgba(255, 255, 255, 0.3)" },
1640
+ },
1641
+ scrollBar: { bar_color: "#8A8A88", bar_mouseOverColor: "#BFBFBD" },
1642
+ },
1643
+
1644
+ };
1645
+
1646
+
1647
+ // The look of the old comp-m1 SelectItem and SelectText: a whitesmoke box with a thin border, the list opens
1648
+ // over the field with a fade, a yellow search box (SearchInput), rows that get white under the mouse, the
1649
+ // selected one half transparent. A package of params: a 350 x 50 field, a search box, the list down to the
1650
+ // bottom of the page. Text rows; your own rows and field: createItemView / createValueView
1651
+ // (_basic/examples/select-box-ozden-item.htm). The params of the package are used when the page does not give them.
1652
+ SelectBox.styles.ozden = {
1653
+ width: 350,
1654
+ height: 50,
1655
+ searchable: 1,
1656
+ searchPlaceholder: "Search",
1657
+ panelMaxHeight: 2000, // WHY: The old list went down to the bottom of the page (the panel stays on the page).
1658
+ style: {
1659
+ // WHY: padding 19 (not 20): the border is inside the box. The old border was drawn over the content.
1660
+ field: { color: "whitesmoke", border: 1, borderColor: "rgba(0, 0, 0, 0.3)", round: 4, padding: [19, 0] },
1661
+ fieldHover: { borderColor: "rgba(0, 0, 0, 0.3)" },
1662
+ fieldFocus: { borderColor: "rgba(0, 0, 0, 0.3)" },
1663
+ fieldText: { fontSize: 20, textColor: "rgba(0, 0, 0, 0.8)" },
1664
+ fieldOption: { iconSize: 0, iconRound: 0, iconMarginLeft: 0, gap: 12, showDescription: 0, emptyIconColor: "" }, // text in the field: your own field with createValueView
1665
+ placeholder: { textColor: Black(0.4) },
1666
+ arrow: { color: "black", icon: "unfold", size: 20, opacity: 0.8, marginRight: -16 },
1667
+ panel: {
1668
+ color: "whitesmoke",
1669
+ border: 1,
1670
+ borderColor: "rgba(0, 0, 0, 0.3)",
1671
+ round: 4,
1672
+ padding: 0,
1673
+ shadow: "none",
1674
+ gap: 0,
1675
+ coverField: 1,
1676
+ motion: "opacity 0.2s, transform 0.2s",
1677
+ motionDuration: 200,
1678
+ startScale: 0.9,
1679
+ },
1680
+ // The yellow search bar of the comp-m1 SelectItem: it was this SearchInput (the comp-m1 one) with these params.
1681
+ searchInput: {
1682
+ styleName: "classic",
1683
+ height: 40,
1684
+ color: "#FFFCD6",
1685
+ border: 0,
1686
+ borderColor: "transparent",
1687
+ borderBottomStyle: "2px solid rgba(0, 0, 0, 0.06)",
1688
+ round: 2,
1689
+ fontSize: 18,
1690
+ textColor: "rgba(0, 0, 0, 0.8)",
1691
+ placeholderColor: "",
1692
+ searchIconFile: "search.svg",
1693
+ clearIconFile: "clear.svg",
1694
+ searchIconSize: 22,
1695
+ searchIconOpacity: 1,
1696
+ clearIconOpacity: 0.6,
1697
+ invertIconColor: 0,
1698
+ },
1699
+ search: {
1700
+ color: "#FFFCD6",
1701
+ border: 0,
1702
+ borderColor: "transparent",
1703
+ round: 2,
1704
+ fontSize: 18,
1705
+ textColor: "rgba(0, 0, 0, 0.8)",
1706
+ height: 40,
1707
+ padding: [16, 0],
1708
+ iconSize: 22,
1709
+ borderBottom: "2px solid rgba(0, 0, 0, 0.06)",
1710
+ },
1711
+ option: {
1712
+ fontSize: 20,
1713
+ textColor: "rgba(0, 0, 0, 0.8)",
1714
+ round: 0,
1715
+ padding: [19, 0], // WHY: 19: the border of the panel is inside it (see field)
1716
+ gap: 20,
1717
+ minHeight: 50,
1718
+ iconSize: 30,
1719
+ iconRound: 4,
1720
+ iconMargin: [0, 0],
1721
+ },
1722
+ optionActive: { color: "white", showAtOpen: 0 },
1723
+ optionSelected: { textColor: "rgba(0, 0, 0, 0.8)", checkColor: "#373836", checkTickColor: "white", fontFamily: "", showTick: 0, opacity: 0.5 },
1724
+ description: { fontSize: 14, textColor: "gray", marginTop: -4 }, // WHY: -4: the old title (top 25) and description (top 49) overlap a little.
1725
+ highlight: { color: "transparent" },
1726
+ empty: { fontSize: 16, textColor: Black(0.45) },
1727
+ // createItemView: the rows of the comp-m1 SelectItem list (white under the mouse, the selected one half transparent).
1728
+ itemList: {
1729
+ row: { padding: [19, 0], gap: 20, round: 0, motion: "background-color 0.2s" }, // WHY: 19: see option.padding
1730
+ hover: { color: "white" },
1731
+ selected: { color: "transparent", opacity: 0.5 }, // WHY: transparent: a selected row does not get white under the mouse.
1732
+ check: { size: 22, color: "#373836", iconColor: "white", borderColor: Black(0.25) },
1733
+ },
1734
+ // The scroll bar of the comp-m1 ItemList: always shown, with the dots at its ends.
1735
+ scrollBar: { bar_color: "#373836", bar_mouseOverColor: "#373836", bar_opacity: 0.4, bar_mouseOverOpacity: 0.9, neverHide: 1, showDots: 1 },
1736
+ },
1737
+ };
1738
+
1739
+ // The old name of the dark package. (Kept: pages may use it.)
1740
+ SelectBox.DARK_STYLE = SelectBox.styles.dark;