@dodlhuat/basix 1.1.1 → 1.2.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 (352) hide show
  1. package/README.md +706 -482
  2. package/css/accordion.scss +86 -87
  3. package/css/alert.scss +137 -137
  4. package/css/badge.scss +104 -0
  5. package/css/bottom-sheet.scss +192 -0
  6. package/css/breadcrumb.scss +158 -0
  7. package/css/button.scss +48 -0
  8. package/css/calendar.scss +957 -0
  9. package/css/card.scss +65 -65
  10. package/css/chart.scss +270 -157
  11. package/css/chat-bubbles.scss +134 -68
  12. package/css/chips.scss +109 -19
  13. package/css/colors.scss +32 -32
  14. package/css/context-menu.scss +182 -0
  15. package/css/datepicker.scss +336 -336
  16. package/css/defaults.scss +90 -90
  17. package/css/docs.scss +529 -0
  18. package/css/editor.scss +664 -461
  19. package/css/file-uploader.scss +1 -1
  20. package/css/flyout-menu.scss +361 -361
  21. package/css/form.scss +124 -0
  22. package/css/gallery.scss +65 -6
  23. package/css/grid.scss +41 -40
  24. package/css/group-picker.scss +345 -0
  25. package/css/guitar-chords.css +250 -250
  26. package/css/icons.scss +330 -330
  27. package/css/parameters.scss +3 -3
  28. package/css/placeholder.scss +33 -33
  29. package/css/popover.scss +206 -0
  30. package/css/progress.scss +76 -32
  31. package/css/properties.scss +51 -36
  32. package/css/push-menu.scss +302 -174
  33. package/css/reset.scss +39 -39
  34. package/css/scrollbar.scss +62 -5
  35. package/css/sidebar-nav.scss +92 -0
  36. package/css/spinner.scss +65 -65
  37. package/css/stepper.scss +248 -0
  38. package/css/style.css +4603 -273
  39. package/css/style.css.map +1 -1
  40. package/css/style.min.css +1 -1
  41. package/css/style.scss +51 -39
  42. package/css/table.scss +199 -199
  43. package/css/tabs.scss +154 -123
  44. package/css/timeline.scss +83 -38
  45. package/css/timepicker.scss +100 -5
  46. package/css/toast.scss +81 -81
  47. package/css/typography.scss +194 -161
  48. package/css/virtual-dropdown.scss +35 -29
  49. package/js/bottom-sheet.js +173 -0
  50. package/js/bottom-sheet.ts +222 -0
  51. package/js/calendar.js +532 -0
  52. package/js/calendar.ts +706 -0
  53. package/js/carousel.js +26 -13
  54. package/js/chart.js +573 -257
  55. package/js/chart.ts +692 -0
  56. package/js/code-viewer.js +10 -10
  57. package/js/code-viewer.ts +188 -188
  58. package/js/context-menu.js +212 -0
  59. package/js/context-menu.ts +252 -0
  60. package/js/datepicker.ts +627 -627
  61. package/js/docs-nav.js +204 -0
  62. package/js/dropdown.ts +179 -179
  63. package/js/editor.js +96 -38
  64. package/js/editor.ts +483 -425
  65. package/js/file-uploader.js +1 -0
  66. package/js/file-uploader.ts +1 -0
  67. package/js/flyout-menu.js +14 -14
  68. package/js/flyout-menu.ts +249 -249
  69. package/js/form-builder.js +106 -106
  70. package/js/gallery.js +13 -6
  71. package/js/gallery.ts +245 -236
  72. package/js/group-picker.js +342 -0
  73. package/js/group-picker.ts +447 -0
  74. package/js/guitar-chords.js +268 -268
  75. package/js/lazy-loader.js +121 -121
  76. package/js/modal.ts +166 -166
  77. package/js/popover.js +163 -0
  78. package/js/popover.ts +219 -0
  79. package/js/position.js +108 -0
  80. package/js/position.ts +111 -0
  81. package/js/push-menu.js +226 -113
  82. package/js/push-menu.ts +284 -145
  83. package/js/request.js +50 -50
  84. package/js/scroll.ts +47 -47
  85. package/js/scrollbar.js +13 -0
  86. package/js/scrollbar.ts +324 -307
  87. package/js/select.ts +216 -216
  88. package/js/sidebar-nav.js +41 -0
  89. package/js/sidebar-nav.ts +66 -0
  90. package/js/stepper.js +80 -0
  91. package/js/stepper.ts +104 -0
  92. package/js/table.ts +452 -452
  93. package/js/tabs.ts +279 -279
  94. package/js/theme.js +17 -6
  95. package/js/theme.ts +234 -224
  96. package/js/timepicker.js +21 -8
  97. package/js/toast.ts +137 -137
  98. package/js/tooltip.js +6 -60
  99. package/js/tooltip.ts +184 -251
  100. package/js/tsconfig.json +18 -18
  101. package/js/utils.ts +83 -83
  102. package/js/virtual-dropdown.js +25 -25
  103. package/js/virtual-dropdown.ts +365 -365
  104. package/package.json +39 -39
  105. package/fonts/Outfit-VariableFont_wght.woff +0 -0
  106. package/fonts/material-icons.woff2 +0 -0
  107. package/icons/activity-outline.svg +0 -1
  108. package/icons/alert-circle-outline.svg +0 -1
  109. package/icons/alert-triangle-outline.svg +0 -1
  110. package/icons/archive-outline.svg +0 -1
  111. package/icons/arrow-back-outline.svg +0 -1
  112. package/icons/arrow-circle-down-outline.svg +0 -1
  113. package/icons/arrow-circle-left-outline.svg +0 -1
  114. package/icons/arrow-circle-right-outline.svg +0 -1
  115. package/icons/arrow-circle-up-outline.svg +0 -1
  116. package/icons/arrow-down-outline.svg +0 -1
  117. package/icons/arrow-downward-outline.svg +0 -1
  118. package/icons/arrow-forward-outline.svg +0 -1
  119. package/icons/arrow-ios-back-outline.svg +0 -1
  120. package/icons/arrow-ios-downward-outline.svg +0 -1
  121. package/icons/arrow-ios-forward-outline.svg +0 -1
  122. package/icons/arrow-ios-upward-outline.svg +0 -1
  123. package/icons/arrow-left-outline.svg +0 -1
  124. package/icons/arrow-right-outline.svg +0 -1
  125. package/icons/arrow-up-outline.svg +0 -1
  126. package/icons/arrow-upward-outline.svg +0 -1
  127. package/icons/arrowhead-down-outline.svg +0 -1
  128. package/icons/arrowhead-left-outline.svg +0 -1
  129. package/icons/arrowhead-right-outline.svg +0 -1
  130. package/icons/arrowhead-up-outline.svg +0 -1
  131. package/icons/at-outline.svg +0 -1
  132. package/icons/attach-2-outline.svg +0 -1
  133. package/icons/attach-outline.svg +0 -1
  134. package/icons/award-outline.svg +0 -1
  135. package/icons/backspace-outline.svg +0 -1
  136. package/icons/bar-chart-2-outline.svg +0 -1
  137. package/icons/bar-chart-outline.svg +0 -1
  138. package/icons/battery-outline.svg +0 -1
  139. package/icons/behance-outline.svg +0 -1
  140. package/icons/bell-off-outline.svg +0 -1
  141. package/icons/bell-outline.svg +0 -1
  142. package/icons/bluetooth-outline.svg +0 -1
  143. package/icons/book-open-outline.svg +0 -1
  144. package/icons/book-outline.svg +0 -1
  145. package/icons/bookmark-outline.svg +0 -1
  146. package/icons/briefcase-outline.svg +0 -1
  147. package/icons/browser-outline.svg +0 -1
  148. package/icons/brush-outline.svg +0 -1
  149. package/icons/bulb-outline.svg +0 -1
  150. package/icons/calendar-outline.svg +0 -1
  151. package/icons/camera-outline.svg +0 -1
  152. package/icons/car-outline.svg +0 -1
  153. package/icons/cast-outline.svg +0 -1
  154. package/icons/charging-outline.svg +0 -1
  155. package/icons/checkmark-circle-2-outline.svg +0 -1
  156. package/icons/checkmark-circle-outline.svg +0 -1
  157. package/icons/checkmark-outline.svg +0 -1
  158. package/icons/checkmark-square-2-outline.svg +0 -1
  159. package/icons/checkmark-square-outline.svg +0 -1
  160. package/icons/chevron-down-outline.svg +0 -1
  161. package/icons/chevron-left-outline.svg +0 -1
  162. package/icons/chevron-right-outline.svg +0 -1
  163. package/icons/chevron-up-outline.svg +0 -1
  164. package/icons/clipboard-outline.svg +0 -1
  165. package/icons/clock-outline.svg +0 -1
  166. package/icons/close-circle-outline.svg +0 -1
  167. package/icons/close-outline.svg +0 -1
  168. package/icons/close-square-outline.svg +0 -1
  169. package/icons/cloud-download-outline.svg +0 -1
  170. package/icons/cloud-upload-outline.svg +0 -1
  171. package/icons/code-download-outline.svg +0 -1
  172. package/icons/code-outline.svg +0 -1
  173. package/icons/collapse-outline.svg +0 -1
  174. package/icons/color-palette-outline.svg +0 -1
  175. package/icons/color-picker-outline.svg +0 -1
  176. package/icons/compass-outline.svg +0 -1
  177. package/icons/copy-outline.svg +0 -1
  178. package/icons/corner-down-left-outline.svg +0 -1
  179. package/icons/corner-down-right-outline.svg +0 -1
  180. package/icons/corner-left-down-outline.svg +0 -1
  181. package/icons/corner-left-up-outline.svg +0 -1
  182. package/icons/corner-right-down-outline.svg +0 -1
  183. package/icons/corner-right-up-outline.svg +0 -1
  184. package/icons/corner-up-left-outline.svg +0 -1
  185. package/icons/corner-up-right-outline.svg +0 -1
  186. package/icons/credit-card-outline.svg +0 -1
  187. package/icons/crop-outline.svg +0 -1
  188. package/icons/cube-outline.svg +0 -1
  189. package/icons/diagonal-arrow-left-down-outline.svg +0 -1
  190. package/icons/diagonal-arrow-left-up-outline.svg +0 -1
  191. package/icons/diagonal-arrow-right-down-outline.svg +0 -1
  192. package/icons/diagonal-arrow-right-up-outline.svg +0 -1
  193. package/icons/done-all-outline.svg +0 -1
  194. package/icons/download-outline.svg +0 -1
  195. package/icons/droplet-off-outline.svg +0 -1
  196. package/icons/droplet-outline.svg +0 -1
  197. package/icons/edit-2-outline.svg +0 -1
  198. package/icons/edit-outline.svg +0 -1
  199. package/icons/email-outline.svg +0 -1
  200. package/icons/expand-outline.svg +0 -1
  201. package/icons/external-link-outline.svg +0 -1
  202. package/icons/eye-off-2-outline.svg +0 -1
  203. package/icons/eye-off-outline.svg +0 -1
  204. package/icons/eye-outline.svg +0 -1
  205. package/icons/facebook-outline.svg +0 -1
  206. package/icons/file-add-outline.svg +0 -1
  207. package/icons/file-outline.svg +0 -1
  208. package/icons/file-remove-outline.svg +0 -1
  209. package/icons/file-text-outline.svg +0 -1
  210. package/icons/film-outline.svg +0 -1
  211. package/icons/flag-outline.svg +0 -1
  212. package/icons/flash-off-outline.svg +0 -1
  213. package/icons/flash-outline.svg +0 -1
  214. package/icons/flip-2-outline.svg +0 -1
  215. package/icons/flip-outline.svg +0 -1
  216. package/icons/folder-add-outline.svg +0 -1
  217. package/icons/folder-outline.svg +0 -1
  218. package/icons/folder-remove-outline.svg +0 -1
  219. package/icons/funnel-outline.svg +0 -1
  220. package/icons/gift-outline.svg +0 -1
  221. package/icons/github-outline.svg +0 -1
  222. package/icons/globe-2-outline.svg +0 -1
  223. package/icons/globe-outline.svg +0 -1
  224. package/icons/google-outline.svg +0 -1
  225. package/icons/grid-outline.svg +0 -1
  226. package/icons/hard-drive-outline.svg +0 -1
  227. package/icons/hash-outline.svg +0 -1
  228. package/icons/headphones-outline.svg +0 -1
  229. package/icons/heart-outline.svg +0 -1
  230. package/icons/home-outline.svg +0 -1
  231. package/icons/image-outline.svg +0 -1
  232. package/icons/inbox-outline.svg +0 -1
  233. package/icons/info-outline.svg +0 -1
  234. package/icons/keypad-outline.svg +0 -1
  235. package/icons/layers-outline.svg +0 -1
  236. package/icons/layout-outline.svg +0 -1
  237. package/icons/link-2-outline.svg +0 -1
  238. package/icons/link-outline.svg +0 -1
  239. package/icons/linkedin-outline.svg +0 -1
  240. package/icons/list-outline.svg +0 -1
  241. package/icons/loader-outline.svg +0 -1
  242. package/icons/lock-outline.svg +0 -1
  243. package/icons/log-in-outline.svg +0 -1
  244. package/icons/log-out-outline.svg +0 -1
  245. package/icons/map-outline.svg +0 -1
  246. package/icons/maximize-outline.svg +0 -1
  247. package/icons/menu-2-outline.svg +0 -1
  248. package/icons/menu-arrow-outline.svg +0 -1
  249. package/icons/menu-outline.svg +0 -1
  250. package/icons/message-circle-outline.svg +0 -1
  251. package/icons/message-square-outline.svg +0 -1
  252. package/icons/mic-off-outline.svg +0 -1
  253. package/icons/mic-outline.svg +0 -1
  254. package/icons/minimize-outline.svg +0 -1
  255. package/icons/minus-circle-outline.svg +0 -1
  256. package/icons/minus-outline.svg +0 -1
  257. package/icons/minus-square-outline.svg +0 -1
  258. package/icons/monitor-outline.svg +0 -1
  259. package/icons/moon-outline.svg +0 -1
  260. package/icons/more-horizontal-outline.svg +0 -1
  261. package/icons/more-vertical-outline.svg +0 -1
  262. package/icons/move-outline.svg +0 -1
  263. package/icons/music-outline.svg +0 -1
  264. package/icons/navigation-2-outline.svg +0 -1
  265. package/icons/navigation-outline.svg +0 -1
  266. package/icons/npm-outline.svg +0 -1
  267. package/icons/options-2-outline.svg +0 -1
  268. package/icons/options-outline.svg +0 -1
  269. package/icons/pantone-outline.svg +0 -1
  270. package/icons/paper-plane-outline.svg +0 -1
  271. package/icons/pause-circle-outline.svg +0 -1
  272. package/icons/people-outline.svg +0 -1
  273. package/icons/percent-outline.svg +0 -1
  274. package/icons/person-add-outline.svg +0 -1
  275. package/icons/person-delete-outline.svg +0 -1
  276. package/icons/person-done-outline.svg +0 -1
  277. package/icons/person-outline.svg +0 -1
  278. package/icons/person-remove-outline.svg +0 -1
  279. package/icons/phone-call-outline.svg +0 -1
  280. package/icons/phone-missed-outline.svg +0 -1
  281. package/icons/phone-off-outline.svg +0 -1
  282. package/icons/phone-outline.svg +0 -1
  283. package/icons/pie-chart-outline.svg +0 -1
  284. package/icons/pin-outline.svg +0 -1
  285. package/icons/play-circle-outline.svg +0 -1
  286. package/icons/plus-circle-outline.svg +0 -1
  287. package/icons/plus-outline.svg +0 -1
  288. package/icons/plus-square-outline.svg +0 -1
  289. package/icons/power-outline.svg +0 -1
  290. package/icons/pricetags-outline.svg +0 -1
  291. package/icons/printer-outline.svg +0 -1
  292. package/icons/question-mark-circle-outline.svg +0 -1
  293. package/icons/question-mark-outline.svg +0 -1
  294. package/icons/radio-button-off-outline.svg +0 -1
  295. package/icons/radio-button-on-outline.svg +0 -1
  296. package/icons/radio-outline.svg +0 -1
  297. package/icons/recording-outline.svg +0 -1
  298. package/icons/refresh-outline.svg +0 -1
  299. package/icons/repeat-outline.svg +0 -1
  300. package/icons/rewind-left-outline.svg +0 -1
  301. package/icons/rewind-right-outline.svg +0 -1
  302. package/icons/save-outline.svg +0 -1
  303. package/icons/scissors-outline.svg +0 -1
  304. package/icons/search-outline.svg +0 -1
  305. package/icons/settings-2-outline.svg +0 -1
  306. package/icons/settings-outline.svg +0 -1
  307. package/icons/shake-outline.svg +0 -1
  308. package/icons/share-outline.svg +0 -1
  309. package/icons/shield-off-outline.svg +0 -1
  310. package/icons/shield-outline.svg +0 -1
  311. package/icons/shopping-bag-outline.svg +0 -1
  312. package/icons/shopping-cart-outline.svg +0 -1
  313. package/icons/shuffle-2-outline.svg +0 -1
  314. package/icons/shuffle-outline.svg +0 -1
  315. package/icons/skip-back-outline.svg +0 -1
  316. package/icons/skip-forward-outline.svg +0 -1
  317. package/icons/slash-outline.svg +0 -1
  318. package/icons/smartphone-outline.svg +0 -1
  319. package/icons/smiling-face-outline.svg +0 -1
  320. package/icons/speaker-outline.svg +0 -1
  321. package/icons/square-outline.svg +0 -1
  322. package/icons/star-outline.svg +0 -1
  323. package/icons/stop-circle-outline.svg +0 -1
  324. package/icons/sun-outline.svg +0 -1
  325. package/icons/swap-outline.svg +0 -1
  326. package/icons/sync-outline.svg +0 -1
  327. package/icons/text-outline.svg +0 -1
  328. package/icons/thermometer-minus-outline.svg +0 -1
  329. package/icons/thermometer-outline.svg +0 -1
  330. package/icons/thermometer-plus-outline.svg +0 -1
  331. package/icons/toggle-left-outline.svg +0 -1
  332. package/icons/toggle-right-outline.svg +0 -1
  333. package/icons/trash-2-outline.svg +0 -1
  334. package/icons/trash-outline.svg +0 -1
  335. package/icons/trending-down-outline.svg +0 -1
  336. package/icons/trending-up-outline.svg +0 -1
  337. package/icons/tv-outline.svg +0 -1
  338. package/icons/twitter-outline.svg +0 -1
  339. package/icons/umbrella-outline.svg +0 -1
  340. package/icons/undo-outline.svg +0 -1
  341. package/icons/unlock-outline.svg +0 -1
  342. package/icons/upload-outline.svg +0 -1
  343. package/icons/video-off-outline.svg +0 -1
  344. package/icons/video-outline.svg +0 -1
  345. package/icons/volume-down-outline.svg +0 -1
  346. package/icons/volume-mute-outline.svg +0 -1
  347. package/icons/volume-off-outline.svg +0 -1
  348. package/icons/volume-up-outline.svg +0 -1
  349. package/icons/wifi-off-outline.svg +0 -1
  350. package/icons/wifi-outline.svg +0 -1
  351. package/js/index.js +0 -718
  352. package/js/index.ts +0 -873
package/js/index.ts DELETED
@@ -1,873 +0,0 @@
1
- import {utils} from "./utils.js";
2
- import {Scrollbar} from "./scrollbar.js";
3
- import {Modal} from "./modal.js";
4
- import {PushMenu} from "./push-menu.js";
5
- import {Toast} from "./toast.js";
6
- import {DatePicker} from "./datepicker.js";
7
- import {Theme} from "./theme.js";
8
- import {Table, TableColumn, TableRow} from "./table.js";
9
- import {FlyoutMenu} from "./flyout-menu.js";
10
- import {Tabs} from "./tabs.js";
11
- import {Carousel} from "./carousel.js";
12
- import {CodeViewer} from "./code-viewer.js";
13
- import {FileUploader} from "./file-uploader.js";
14
- import {TreeComponent, TreeNode} from "./tree.js";
15
- import {MasonryGallery, ImageData} from "./gallery.js";
16
- import {Tooltip} from "./tooltip.js";
17
- import {Dropdown, DropdownSelectDetail} from "./dropdown.js";
18
- import {VirtualDropdown} from "./virtual-dropdown.js";
19
- import {TimeSpanPicker} from "./timepicker.js";
20
- import {RangeSlider} from "./range-slider.js";
21
-
22
- // Generate sample table data
23
- const generateData = (count: number): TableRow[] => {
24
- const data: TableRow[] = [];
25
- const firstNames = [
26
- "John",
27
- "Jane",
28
- "Mike",
29
- "Sarah",
30
- "Robert",
31
- "Emily",
32
- "David",
33
- "Emma",
34
- "James",
35
- "Olivia",
36
- ];
37
- const lastNames = [
38
- "Smith",
39
- "Johnson",
40
- "Williams",
41
- "Brown",
42
- "Jones",
43
- "Garcia",
44
- "Miller",
45
- "Davis",
46
- "Rodriguez",
47
- "Martinez",
48
- ];
49
- const roles = ["Admin", "User", "Editor", "Viewer", "Manager", "Developer"];
50
- const statuses = ["Active", "Inactive", "Pending", "Banned"];
51
-
52
- for (let i = 1; i <= count; i++) {
53
- const firstName = firstNames[Math.floor(Math.random() * firstNames.length)];
54
- const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
55
- const role = roles[Math.floor(Math.random() * roles.length)];
56
- const status = statuses[Math.floor(Math.random() * statuses.length)];
57
- const lastLoginDate = new Date(
58
- Date.now() - Math.floor(Math.random() * 10000000000),
59
- );
60
-
61
- data.push({
62
- id: i,
63
- name: `${firstName} ${lastName}`,
64
- email: `user${i}@example.com`,
65
- role,
66
- status,
67
- lastLogin: lastLoginDate.toLocaleDateString(),
68
- });
69
- }
70
-
71
- return data;
72
- };
73
-
74
- // Initialize all components when DOM is ready
75
- utils.ready(() => {
76
- // Initialize scrollbars
77
- Scrollbar.initAll(".scroll-container");
78
-
79
- // Initialize theme
80
- Theme.init();
81
-
82
- // Initialize horizontal tabs
83
- const horizontalTabs = new Tabs(".horizontal", {
84
- layout: "horizontal",
85
- });
86
-
87
- // Initialize vertical tabs
88
- const verticalTabs = new Tabs(".vertical", {
89
- layout: "vertical",
90
- });
91
-
92
- // Initialize carousel
93
- const carousel = new Carousel("#carouselIdHere", {
94
- loop: true,
95
- });
96
-
97
- // Initialize advanced table with data
98
- const columns: TableColumn[] = [
99
- {key: "id", label: "ID"},
100
- {key: "name", label: "Name"},
101
- {key: "email", label: "Email"},
102
- {key: "role", label: "Role"},
103
- {key: "status", label: "Status"},
104
- {key: "lastLogin", label: "Last Login"},
105
- ];
106
-
107
- const tableData = generateData(50);
108
- new Table("#demo-table-js", {
109
- data: tableData,
110
- columns: columns,
111
- pageSize: 10,
112
- });
113
-
114
- // Initialize modal
115
- const modalTrigger = document.querySelector(".show-modal");
116
- if (modalTrigger) {
117
- modalTrigger.addEventListener("click", () => {
118
- const buttons =
119
- '<div class="buttons"><button class="button-light">Close</button>&nbsp;<button>Save Changes</button></div>';
120
- const modal = new Modal(
121
- "bluffi",
122
- "<strong>blaffi</strong>",
123
- buttons,
124
- true,
125
- "default",
126
- );
127
- modal.show();
128
-
129
- console.warn("Buttons have no bound listeners");
130
- });
131
- }
132
-
133
- // Initialize toast
134
- const toastTrigger = document.querySelector(".show-toast");
135
- if (toastTrigger) {
136
- toastTrigger.addEventListener("click", () => {
137
- const toast = new Toast(
138
- "some content. maybe even more text in here!",
139
- "some header",
140
- "success",
141
- true,
142
- );
143
- toast.show(3000);
144
- });
145
- }
146
-
147
- // Initialize push menu
148
- PushMenu.init();
149
-
150
- // Initialize flyout menu
151
- const menu = new FlyoutMenu({
152
- direction: "right",
153
- triggerSelector: ".trigger-flyout-menu",
154
- });
155
-
156
- // Flyout menu controls: Switch direction
157
- const directionBtns = document.querySelectorAll<HTMLButtonElement>(
158
- ".flyout-controls > button",
159
- );
160
- directionBtns.forEach((btn) => {
161
- btn.addEventListener("click", () => {
162
- // Remove active class from all buttons
163
- directionBtns.forEach((b) => b.classList.remove("active"));
164
-
165
- // Add active class to clicked button
166
- btn.classList.add("active");
167
-
168
- // Update menu direction
169
- const direction = btn.dataset.direction as "left" | "right" | undefined;
170
- if (direction) {
171
- menu.setDirection(direction);
172
- }
173
- });
174
- });
175
-
176
- new DatePicker("#datepicker-single", {
177
- mode: "single",
178
- onSelect: (date) => {
179
- console.log("Single selected:", date);
180
- },
181
- });
182
-
183
- new DatePicker("#datepicker-time", {
184
- mode: "single",
185
- timePicker: true,
186
- onSelect: (date) => {
187
- console.log("Single selected:", date);
188
- },
189
- });
190
-
191
- new DatePicker("#datepicker-range", {
192
- mode: "range",
193
- onSelect: (range) => {
194
- console.log("Range selected:", range);
195
- },
196
- });
197
-
198
- new DatePicker("#datepicker-localized", {
199
- mode: "single",
200
- startDay: 1, // Monday
201
- locales: {
202
- days: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"],
203
- months: [
204
- "Enero",
205
- "Febrero",
206
- "Marzo",
207
- "Abril",
208
- "Mayo",
209
- "Junio",
210
- "Julio",
211
- "Agosto",
212
- "Septiembre",
213
- "Octubre",
214
- "Noviembre",
215
- "Diciembre",
216
- ],
217
- },
218
- format: (date) => {
219
- return date.toLocaleDateString("es-ES", {
220
- weekday: "long",
221
- year: "numeric",
222
- month: "long",
223
- day: "numeric",
224
- });
225
- },
226
- onSelect: (date) => {
227
- console.log("Localized selected:", date);
228
- },
229
- });
230
-
231
- // Initialize code viewer with usage example
232
- const usageTabs = `new Tabs('.horizontal', {
233
- layout: 'horizontal',
234
- defaultTab: 0
235
- });`;
236
-
237
- new CodeViewer("#usage-tabs", usageTabs, "js");
238
-
239
- // Initialize file uploader
240
- const uploaderElement =
241
- document.querySelector<HTMLElement>(".uploader-content");
242
- if (uploaderElement) {
243
- new FileUploader(uploaderElement);
244
- }
245
-
246
- const sampleData: TreeNode[] = [
247
- new TreeNode("Documents", "folder", [
248
- new TreeNode("Work", "folder", [
249
- new TreeNode("presentation.pptx", "file"),
250
- new TreeNode("report.docx", "file"),
251
- new TreeNode("budget.xlsx", "file"),
252
- ]),
253
- new TreeNode("Personal", "folder", [
254
- new TreeNode("resume.pdf", "file"),
255
- new TreeNode("vacation-photos", "folder", [
256
- new TreeNode("beach.jpg", "file"),
257
- new TreeNode("mountain.jpg", "file"),
258
- ]),
259
- ]),
260
- ]),
261
- new TreeNode("Projects", "folder", [
262
- new TreeNode("website", "folder", [
263
- new TreeNode("index.html", "file"),
264
- new TreeNode("styles.css", "file"),
265
- new TreeNode("script.js", "file"),
266
- ]),
267
- new TreeNode("app", "folder", [
268
- new TreeNode("src", "folder", [
269
- new TreeNode("main.js", "file"),
270
- new TreeNode("utils.js", "file"),
271
- ]),
272
- new TreeNode("package.json", "file"),
273
- ]),
274
- ]),
275
- new TreeNode("Downloads", "folder", [
276
- new TreeNode("installer.exe", "file"),
277
- new TreeNode("readme.txt", "file"),
278
- ]),
279
- new TreeNode("README.md", "file"),
280
- ];
281
- const tree = new TreeComponent("#tree-root", sampleData);
282
-
283
- const batchSize = 12;
284
- let indexNumber = 1;
285
- const gallery = new MasonryGallery("gallery", {
286
- minColumnWidth: 300,
287
- fetchFunction: new Promise((resolve) => {
288
- setTimeout(() => {
289
- const images: ImageData[] = [];
290
-
291
- for (let i = 0; i < batchSize; i++) {
292
- const width = 400;
293
- const height = Math.floor(Math.random() * 301) + 300; // 300-600
294
- const id = Math.floor(Math.random() * 1000);
295
- const imageIndex = indexNumber * batchSize + i;
296
-
297
- images.push({
298
- src: `https://picsum.photos/${width}/${height}?random=${imageIndex}`,
299
- title: `Image ${imageIndex + 1}`,
300
- desc: `A random caption for image ${id}`,
301
- });
302
- }
303
-
304
- indexNumber++;
305
- resolve(images);
306
- }, 800);
307
- }),
308
- });
309
-
310
- const dropdown = new Dropdown("#myDropdown");
311
- const dropdownElement = document.querySelector("#myDropdown");
312
- dropdownElement?.addEventListener("dropdown-select", ((
313
- event: CustomEvent<DropdownSelectDetail>,
314
- ) => {
315
- const {text, element} = event.detail;
316
- console.log("User selected:", text);
317
- console.log("Selected element:", element);
318
- }) as EventListener);
319
-
320
- const generateItems = (count: number, prefix: string) => {
321
- return Array.from({length: count}, (_, i) => ({
322
- label: `${prefix} Item ${i + 1}`,
323
- value: `${prefix.toLowerCase()}_${i + 1}`,
324
- }));
325
- };
326
-
327
- const bigData = generateItems(10000, "Option");
328
- const smallData = generateItems(50, "Choice");
329
-
330
- const singleDropdown = new VirtualDropdown({
331
- container: "#dropdown-single",
332
- options: bigData,
333
- searchable: true,
334
- placeholder: "Search 10k items...",
335
- renderLimit: 15,
336
- onSelect: (val) => {
337
- console.log("Single Select:", val);
338
- },
339
- });
340
-
341
- const multiDropdown = new VirtualDropdown({
342
- container: "#dropdown-multi",
343
- options: smallData,
344
- searchable: true,
345
- multiSelect: true,
346
- placeholder: "Choose multiple...",
347
- renderLimit: 10,
348
- onSelect: (vals) => {
349
- console.log("Multi Select:", vals);
350
- },
351
- });
352
-
353
- // Initialize range sliders
354
- RangeSlider.initAll();
355
-
356
- Tooltip.initializeAll();
357
-
358
- const timeSpanPicker = new TimeSpanPicker('timespan-1', {
359
- onChange: (start, end) => {
360
- console.log(`Start: ${start}, Ende: ${end}`);
361
- }
362
- });
363
-
364
- new CodeViewer(
365
- "#usage-text-input",
366
- `<label for="text-input-demo">Text Input</label>
367
- <input type="text" id="text-input-demo"/>`,
368
- "html",
369
- );
370
- new CodeViewer(
371
- "#usage-textarea",
372
- `<label for="textarea-demo">Text Area</label>
373
- <textarea id="textarea-demo"></textarea>`,
374
- "html",
375
- );
376
- new CodeViewer(
377
- "#usage-checkbox-demo",
378
- `<input class="styled-checkbox"
379
- id="checkbox-1"
380
- type="checkbox"
381
- value="1"
382
- />
383
- <label for="checkbox-1">Checkbox</label>`,
384
- "html",
385
- );
386
- });
387
- new CodeViewer(
388
- "#usage-radiobutton-demo",
389
- `<label class="radio-button-container">Three
390
- <input type="radio" name="radio"/>
391
- <span class="checkmark"></span>
392
- </label>`,
393
- "html",
394
- );
395
- new CodeViewer(
396
- "#usage-switch-demo",
397
- `<div class="switch">
398
- <input type="checkbox" id="switch"/><label for="switch">Toggle</label>
399
- </div>`,
400
- "html",
401
- );
402
- new CodeViewer(
403
- "#usage-slider-demo",
404
- `<div class="range-slider">
405
- <input type="range" min="1" max="100" value="50" />
406
- </div>`,
407
- "html",
408
- );
409
- new CodeViewer(
410
- "#usage-pushmenu-control-demo",
411
- `<div class="open-menu">
412
- <div class="navigation-controls">
413
- <input type="checkbox" id="menu-navigation" class="navigation"/>
414
- <label for="menu-navigation">
415
- <span class="icon icon-menu"></span>
416
- </label>
417
- </div>
418
- </div>`,
419
- "html",
420
- );
421
- new CodeViewer(
422
- "#usage-pushmenu-demo",
423
- `<nav class="push-menu">
424
- <ul>
425
- <li>
426
- <a onclick="window.Scroll.to('#grid')">Grid</a>
427
- </li>
428
- <li>
429
- <a onclick="window.Scroll.to('#typography')">Typography</a>
430
- </li>
431
- </ul>
432
- </nav>`,
433
- "html",
434
- );
435
- new CodeViewer("#usage-pushmenu-script-demo", `PushMenu.init();`, "js");
436
- new CodeViewer(
437
- "#usage-flyout-script-demo",
438
- `const menu = new FlyoutMenu({
439
- direction: "right",
440
- triggerSelector: ".trigger-flyout-menu",
441
- });`,
442
- "js",
443
- );
444
- new CodeViewer(
445
- "#usage-flyout-demo",
446
- `<div class="flyout-overlay" id="flyoutOverlay"></div>
447
- <div class="flyout-menu" id="flyoutMenu">
448
- <ul>
449
- <li><a href="#">Home</a></li>
450
- <li>
451
- About
452
- <ul>
453
- <li><a href="#">Our Story</a></li>
454
- <li><a href="#">Team</a></li>
455
- <li><a href="#">Careers</a></li>
456
- </ul>
457
- </li>
458
- <li>
459
- Services
460
- <ul>
461
- <li>
462
- Web Design
463
- <ul>
464
- <li><a href="#">eCommerce</a></li>
465
- <li><a href="#">Landing Pages</a></li>
466
- <li><a href="#">Portfolios</a></li>
467
- </ul>
468
- </li>
469
- <li><a href="#">Development</a></li>
470
- <li><a href="#">SEO</a></li>
471
- </ul>
472
- </li>
473
- <li><a href="#">Portfolio</a></li>
474
- <li><a href="#">Contact</a></li>
475
- </ul>
476
- </div>`,
477
- "html",
478
- );
479
- new CodeViewer(
480
- "#usage-dropdown-menu-demo",
481
- `<div class="dropdown-container" id="myDropdown">
482
- <button class="dropdown-trigger">Select Option</button>
483
- <ul class="dropdown-menu">
484
- <li>
485
- <div class="dropdown-item">Profile</div>
486
- </li>
487
- <li>
488
- <div class="dropdown-item">Settings</div>
489
- <ul>
490
- <li>
491
- <div class="dropdown-item">Account</div>
492
- </li>
493
- <li>
494
- <div class="dropdown-item">Privacy</div>
495
- <ul>
496
- <li>
497
- <div class="dropdown-item">Public</div>
498
- </li>
499
- <li>
500
- <div class="dropdown-item">Private</div>
501
- </li>
502
- <li>
503
- <div class="dropdown-item">Friends Only</div>
504
- </li>
505
- </ul>
506
- </li>
507
- <li>
508
- <div class="dropdown-item">Notifications</div>
509
- </li>
510
- </ul>
511
- </li>
512
- <li>
513
- <div class="dropdown-item">Help</div>
514
- </li>
515
- <li>
516
- <div class="dropdown-item">Logout</div>
517
- </li>
518
- </ul>
519
- </div>`,
520
- "html",
521
- );
522
- new CodeViewer(
523
- "#usage-dropdown-menu-js-demo",
524
- `const dropdown = new Dropdown("#myDropdown");
525
- const dropdownElement = document.querySelector("#myDropdown");
526
- dropdownElement?.addEventListener("dropdown-select", ((
527
- event: CustomEvent<DropdownSelectDetail>,
528
- ) => {
529
- const { text, element } = event.detail;
530
- console.log("User selected:", text);
531
- console.log("Selected element:", element);
532
- }) as EventListener);`,
533
- "js",
534
- );
535
- new CodeViewer(
536
- "#usage-modal-demo",
537
- `const modal = new Modal(
538
- "content",
539
- "<strong>header</strong>",
540
- "controls",
541
- true,
542
- "default",
543
- );
544
- modal.show();`,
545
- "js",
546
- );
547
- new CodeViewer(
548
- "#usage-toast-demo",
549
- `const toast = new Toast(
550
- "some content. maybe even more text in here!",
551
- "some header",
552
- "success",
553
- true,
554
- );
555
- toast.show(3000);`,
556
- "js",
557
- );
558
- new CodeViewer(
559
- "#usage-tooltip-demo",
560
- `<button class="tooltip-trigger" data-tooltip="This is a simple tooltip">
561
- Simple Tooltip
562
- </button>`,
563
- "html",
564
- );
565
- new CodeViewer("#usage-tooltip-js-demo", `Tooltip.initializeAll();`, "js");
566
- new CodeViewer("#usage-spinner-demo", `<div class="spinner"></div>`, "html");
567
- new CodeViewer("#usage-loading-demo", `<div class="loading"></div>`, "html");
568
- new CodeViewer(
569
- "#usage-alerts-demo",
570
- `<div class="alert alert-default">
571
- <strong>Default:</strong> This is a default alert message.
572
- </div>`,
573
- "html",
574
- );
575
- new CodeViewer(
576
- "#usage-chips-demo",
577
- `<div class="chips">
578
- <div class="chip">Example Chip</div>
579
- <div class="chip clickable">Example Chip with hover</div>
580
- <div class="chip closeable">
581
- Example Chip with closure
582
- <button class="close">
583
- <span class="icon icon-close"></span>
584
- </button>
585
- </div>
586
- </div>`,
587
- "html",
588
- );
589
- new CodeViewer(
590
- "#usage-accordion-demo",
591
- `<div class="accordion">
592
- <div class="accordion-item">
593
- <input
594
- type="radio"
595
- name="accordion"
596
- id="acc1"
597
- class="accordion-input"
598
- checked
599
- />
600
- <label for="acc1" class="accordion-label"> What is this? </label>
601
- <div class="accordion-content">
602
- <div class="accordion-body">
603
- <div>
604
- <p>
605
- This is a pure CSS accordion component. It uses the "Radio
606
- Button Hack" to manage state without a single line of
607
- JavaScript.
608
- </p>
609
- </div>
610
- </div>
611
- </div>
612
- </div>
613
- <div class="accordion-item">
614
- <input
615
- type="radio"
616
- name="accordion"
617
- id="acc2"
618
- class="accordion-input"
619
- />
620
- <label for="acc2" class="accordion-label"> How does it work? </label>
621
- <div class="accordion-content">
622
- <div class="accordion-body">
623
- <div>
624
- <p>It links label elements to hidden radio buttons.</p>
625
- </div>
626
- </div>
627
- </div>
628
- </div>
629
- <div class="accordion-item">
630
- <input
631
- type="radio"
632
- name="accordion"
633
- id="acc3"
634
- class="accordion-input"
635
- />
636
- <label for="acc3" class="accordion-label"> Is it accessible? </label>
637
- <div class="accordion-content">
638
- <div class="accordion-body">
639
- <div>
640
- <p>
641
- It's reasonably accessible as it uses semantic form elements.
642
- Users can tab through the headers (radio inputs) and select
643
- them with the keyboard. However, for full ARIA support, a
644
- small amount of JS is usually recommended to manage
645
- aria-expanded attributes.
646
- </p>
647
- </div>
648
- </div>
649
- </div>
650
- </div>
651
- </div>`,
652
- "html",
653
- );
654
- new CodeViewer(
655
- "#usage-timeline-demo",
656
- `<div class="timeline">
657
- <div class="timeline-item active">
658
- <div class="timeline-content">
659
- <span class="timeline-date">October 12, 2023</span>
660
- <h3 class="timeline-title">Project Kickoff</h3>
661
- <p class="timeline-body">
662
- Initial meeting with shareholders to discuss the scope and
663
- requirements of the project. Team roles were assigned and the
664
- roadmap was drafted.
665
- </p>
666
- </div>
667
- </div>
668
- <div class="timeline-item">
669
- <div class="timeline-content">
670
- <span class="timeline-date">January 15, 2024</span>
671
- <h3 class="timeline-title">Beta Launch</h3>
672
- <p class="timeline-body">
673
- Opened the platform to a closed beta group of 500 users. Collected
674
- feedback regarding the onboarding flow and notification settings.
675
- </p>
676
- </div>
677
- </div>
678
- </div>`,
679
- "html",
680
- );
681
- new CodeViewer(
682
- "#usage-progress-bar-demo",
683
- `<div class="progress-bar">
684
- <div class="progress" style="height: 24px; width: 50%"></div>
685
- </div>`,
686
- "html",
687
- );
688
- new CodeViewer(
689
- "#usage-placeholder-demo",
690
- `<span class="placeholder w-6">`,
691
- "html"
692
- );
693
- new CodeViewer(
694
- "#usage-table-demo",
695
- `const columns: TableColumn[] = [
696
- { key: "id", label: "ID" },
697
- { key: "name", label: "Name" },
698
- ];
699
- const tableData: TableRow[] = [
700
- { id: 1, name: "John Doe" },
701
- { id: 2, name: "Jane Smith" },
702
- { id: 3, name: "Mike Johnson" },
703
- ];
704
- new Table("#demo-table-js", {
705
- data: tableData,
706
- columns: columns,
707
- pageSize: 10,
708
- });
709
-
710
- // Initialize basic table from html data
711
- new Table("#demo-table", { pageSize: 5 });`,
712
- "js"
713
- );
714
- new CodeViewer(
715
- "#usage-datepicker-html-demo",
716
- `<label for="datepicker-range">Datepicker Range</label>
717
- <input
718
- type="text"
719
- id="datepicker-range"
720
- class="datepicker-input"
721
- placeholder="Select a date range"
722
- readonly
723
- />`,
724
- "html"
725
- );
726
- new CodeViewer(
727
- "#usage-datepicker-js-demo",
728
- `new DatePicker("#datepicker-single", {
729
- mode: "single",
730
- onSelect: (date) => {
731
- console.log("Single selected:", date);
732
- },
733
- });`,
734
- "js"
735
- );
736
- new CodeViewer("#usage-tree-demo-html", `<ul id="tree-root" class="tree"></ul>`, "html");
737
- new CodeViewer("#usage-tree-demo-js", `const sampleData: TreeNode[] = [
738
- new TreeNode("Documents", "folder", [
739
- new TreeNode("Work", "folder", [
740
- new TreeNode("presentation.pptx", "file"),
741
- new TreeNode("report.docx", "file"),
742
- new TreeNode("budget.xlsx", "file"),
743
- ]),
744
- new TreeNode("Personal", "folder", [
745
- new TreeNode("resume.pdf", "file"),
746
- new TreeNode("vacation-photos", "folder", [
747
- new TreeNode("beach.jpg", "file"),
748
- new TreeNode("mountain.jpg", "file"),
749
- ]),
750
- ]),
751
- ]),
752
- ];
753
- const tree = new TreeComponent("#tree-root", sampleData);`, "js");
754
- new CodeViewer("#usage-file-uploader-demo", `<div class="uploader-content">
755
- <div class="header">
756
- <h2>Upload Files</h2>
757
- <p>Select or drag files to upload</p>
758
- </div>
759
- <div id="drop-zone" class="drop-zone">
760
- <input type="file" id="file-input" multiple hidden/>
761
- <div class="drop-zone-content">
762
- <div class="icon-container">
763
- <svg
764
- xmlns="http://www.w3.org/2000/svg"
765
- width="24"
766
- height="24"
767
- viewBox="0 0 24 24"
768
- fill="none"
769
- stroke="currentColor"
770
- stroke-width="2"
771
- stroke-linecap="round"
772
- stroke-linejoin="round"
773
- class="upload-icon"
774
- >
775
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
776
- <polyline points="17 8 12 3 7 8"></polyline>
777
- <line x1="12" y1="3" x2="12" y2="15"></line>
778
- </svg>
779
- </div>
780
- <p class="primary-text">Click to upload or drag and drop</p>
781
- <p class="secondary-text">
782
- SVG, PNG, JPG or GIF (max. 800x400px)
783
- </p>
784
- </div>
785
- </div>
786
-
787
- <div id="file-list" class="file-list"></div>
788
-
789
- <div class="actions">
790
- <button id="upload-btn" disabled>Upload Files</button>
791
- </div>
792
- </div>`, "html");
793
- new CodeViewer("#usage-file-uploader-demo-js", `const uploaderElement =
794
- document.querySelector<HTMLElement>(".uploader-content");
795
- if (uploaderElement) {
796
- new FileUploader(uploaderElement);
797
- }`, "js");
798
- new CodeViewer("#usage-virtual-dropdown-demo-html", `<div class="virtual-dropdown">
799
- <h2>1. Searchable Single Select (10,000 items)</h2>
800
- <p>
801
- This list uses virtual scrolling to handle 10k items efficiently.
802
- </p>
803
- <div id="dropdown-single"></div>
804
- </div>`, "html");
805
- new CodeViewer("#usage-virtual-dropdown-demo-js", `const singleDropdown = new VirtualDropdown({
806
- container: "#dropdown-single",
807
- options: bigData,
808
- searchable: true,
809
- placeholder: "Search 10k items...",
810
- renderLimit: 15,
811
- onSelect: (val) => {
812
- console.log("Single Select:", val);
813
- },
814
- });`, "js");
815
- new CodeViewer("#usage-scrollbar-demo", `Scrollbar.initAll(".scroll-container");`, "js");
816
- new CodeViewer("#usage-theme-demo", `Theme.init();`, "js");
817
- new CodeViewer("#usage-scroll-demo", `window.Scroll.to('#grid')`, "js");
818
- new CodeViewer("#usage-chat-demo-html", `<div class="chat-container">
819
- <div class="message message-incoming">
820
- Hi there! How are you doing today?
821
- <span class="message-meta">10:42 AM</span>
822
- </div>
823
- <div class="message message-outgoing">
824
- I'm doing great, thanks! Just working on some new CSS
825
- components.<br/>And other stuff.
826
- <span class="message-meta">10:43 AM</span>
827
- </div>
828
- <div class="message message-outgoing">
829
- Trying to make a simple chat UI.
830
- <span class="message-meta">10:43 AM</span>
831
- </div>
832
- <div class="message message-incoming">
833
- That sounds cool!
834
- <span class="message-meta">10:45 AM</span>
835
- </div>
836
- </div>`, "html");
837
- new CodeViewer("#usage-carousel-demo-html", `<div class="carousel" id="carouselIdHere">
838
- <div>Slide 1</div>
839
- <div>Slide 2</div>
840
- <div>Slide 3</div>
841
- <div>Slide 4</div>
842
- </div>`, "html");
843
- new CodeViewer("#usage-carousel-demo-js", `const carousel = new Carousel("#carouselIdHere", {
844
- loop: true,
845
- });`, "js");
846
- new CodeViewer("#usage-gallery-demo-html", `<div id="gallery" class="masonry-container"></div>
847
- <div class="loader hidden">
848
- <div class="spinner"></div>
849
- </div>`, "html");
850
- new CodeViewer("#usage-gallery-demo-js", `const gallery = new MasonryGallery("gallery", {
851
- minColumnWidth: 300,
852
- fetchFunction: new Promise((resolve) => {
853
- setTimeout(() => {
854
- const images: ImageData[] = [];
855
-
856
- for (let i = 0; i < batchSize; i++) {
857
- const width = 400;
858
- const height = Math.floor(Math.random() * 301) + 300;
859
- const id = Math.floor(Math.random() * 1000);
860
- const imageIndex = indexNumber * batchSize + i;
861
-
862
- images.push({
863
- src: \`https://picsum.photos/$\{width}/$\{height}?random=$\{imageIndex}\`,
864
- title: \`Image $\{imageIndex + 1}\`,
865
- desc: \`A random caption for image $\{id}\`,
866
- });
867
- }
868
-
869
- indexNumber++;
870
- resolve(images);
871
- }, 800);
872
- }),
873
- });`, "js");