@dodlhuat/basix 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +482 -0
- package/css/accordion.css +109 -0
- package/css/accordion.css.map +1 -0
- package/css/accordion.scss +78 -0
- package/css/alert.css +57 -0
- package/css/alert.css.map +1 -0
- package/css/alert.scss +86 -0
- package/css/button.css +69 -0
- package/css/button.css.map +1 -0
- package/css/button.scss +102 -0
- package/css/card.css +144 -0
- package/css/card.css.map +1 -0
- package/css/card.scss +66 -0
- package/css/carousel.css +118 -0
- package/css/carousel.css.map +1 -0
- package/css/carousel.scss +87 -0
- package/css/chart.css +159 -0
- package/css/chart.css.map +1 -0
- package/css/chart.scss +159 -0
- package/css/chat-bubbles.css +97 -0
- package/css/chat-bubbles.css.map +1 -0
- package/css/chat-bubbles.scss +68 -0
- package/css/checkbox.css +77 -0
- package/css/checkbox.css.map +1 -0
- package/css/checkbox.scss +55 -0
- package/css/chips.css +72 -0
- package/css/chips.css.map +1 -0
- package/css/chips.scss +52 -0
- package/css/code-viewer.css +97 -0
- package/css/code-viewer.css.map +1 -0
- package/css/code-viewer.scss +98 -0
- package/css/colors.css +63 -0
- package/css/colors.css.map +1 -0
- package/css/colors.scss +33 -0
- package/css/datepicker.css +264 -0
- package/css/datepicker.css.map +1 -0
- package/css/datepicker.scss +317 -0
- package/css/defaults.css +118 -0
- package/css/defaults.css.map +1 -0
- package/css/defaults.scss +91 -0
- package/css/dropdown.css +146 -0
- package/css/dropdown.css.map +1 -0
- package/css/dropdown.scss +137 -0
- package/css/editor.css +413 -0
- package/css/editor.scss +458 -0
- package/css/file-uploader.css +194 -0
- package/css/file-uploader.css.map +1 -0
- package/css/file-uploader.scss +195 -0
- package/css/flyout-menu.css +345 -0
- package/css/flyout-menu.css.map +1 -0
- package/css/flyout-menu.scss +355 -0
- package/css/form-builder.css +9 -0
- package/css/form-builder.css.map +1 -0
- package/css/form-builder.scss +11 -0
- package/css/form.css +130 -0
- package/css/form.css.map +1 -0
- package/css/form.scss +115 -0
- package/css/gallery.css +91 -0
- package/css/gallery.css.map +1 -0
- package/css/gallery.scss +63 -0
- package/css/grid.css +44 -0
- package/css/grid.css.map +1 -0
- package/css/grid.scss +41 -0
- package/css/guitar-chords.css +251 -0
- package/css/icons.css +327 -0
- package/css/icons.css.map +1 -0
- package/css/icons.scss +331 -0
- package/css/modal.css +97 -0
- package/css/modal.css.map +1 -0
- package/css/modal.scss +72 -0
- package/css/parameters.css +1 -0
- package/css/parameters.css.map +1 -0
- package/css/parameters.scss +4 -0
- package/css/placeholder.css +50 -0
- package/css/placeholder.css.map +1 -0
- package/css/placeholder.scss +28 -0
- package/css/progress.css +51 -0
- package/css/progress.css.map +1 -0
- package/css/progress.scss +32 -0
- package/css/properties.css +31 -0
- package/css/properties.css.map +1 -0
- package/css/properties.scss +31 -0
- package/css/push-menu.css +145 -0
- package/css/push-menu.css.map +1 -0
- package/css/push-menu.scss +127 -0
- package/css/radiobutton.css +91 -0
- package/css/radiobutton.css.map +1 -0
- package/css/radiobutton.scss +64 -0
- package/css/reset.css +46 -0
- package/css/reset.css.map +1 -0
- package/css/reset.scss +40 -0
- package/css/scrollbar.css +91 -0
- package/css/scrollbar.css.map +1 -0
- package/css/scrollbar.scss +69 -0
- package/css/spinner.css +118 -0
- package/css/spinner.css.map +1 -0
- package/css/spinner.scss +91 -0
- package/css/style.css +3735 -0
- package/css/style.css.map +1 -0
- package/css/style.min.css +1 -0
- package/css/style.scss +38 -0
- package/css/switch.css +66 -0
- package/css/switch.css.map +1 -0
- package/css/switch.scss +42 -0
- package/css/table.css +201 -0
- package/css/table.css.map +1 -0
- package/css/table.scss +178 -0
- package/css/tabs.css +135 -0
- package/css/tabs.css.map +1 -0
- package/css/tabs.scss +118 -0
- package/css/timeline.css +69 -0
- package/css/timeline.css.map +1 -0
- package/css/timeline.scss +69 -0
- package/css/timepicker.scss +72 -0
- package/css/toast.css +98 -0
- package/css/toast.css.map +1 -0
- package/css/toast.scss +81 -0
- package/css/tooltip.css +151 -0
- package/css/tooltip.css.map +1 -0
- package/css/tooltip.scss +122 -0
- package/css/tree.css +199 -0
- package/css/tree.css.map +1 -0
- package/css/tree.scss +192 -0
- package/css/typography.css +137 -0
- package/css/typography.css.map +1 -0
- package/css/typography.scss +100 -0
- package/css/virtual-dropdown.css +149 -0
- package/css/virtual-dropdown.css.map +1 -0
- package/css/virtual-dropdown.scss +142 -0
- package/fonts/MaterialSymbolsOutlined.woff2 +0 -0
- package/fonts/Outfit-VariableFont_wght.woff +0 -0
- package/fonts/Outfit-VariableFont_wght.woff2 +0 -0
- package/fonts/material-icons.woff2 +0 -0
- package/icons/activity-outline.svg +1 -0
- package/icons/alert-circle-outline.svg +1 -0
- package/icons/alert-triangle-outline.svg +1 -0
- package/icons/archive-outline.svg +1 -0
- package/icons/arrow-back-outline.svg +1 -0
- package/icons/arrow-circle-down-outline.svg +1 -0
- package/icons/arrow-circle-left-outline.svg +1 -0
- package/icons/arrow-circle-right-outline.svg +1 -0
- package/icons/arrow-circle-up-outline.svg +1 -0
- package/icons/arrow-down-outline.svg +1 -0
- package/icons/arrow-downward-outline.svg +1 -0
- package/icons/arrow-forward-outline.svg +1 -0
- package/icons/arrow-ios-back-outline.svg +1 -0
- package/icons/arrow-ios-downward-outline.svg +1 -0
- package/icons/arrow-ios-forward-outline.svg +1 -0
- package/icons/arrow-ios-upward-outline.svg +1 -0
- package/icons/arrow-left-outline.svg +1 -0
- package/icons/arrow-right-outline.svg +1 -0
- package/icons/arrow-up-outline.svg +1 -0
- package/icons/arrow-upward-outline.svg +1 -0
- package/icons/arrowhead-down-outline.svg +1 -0
- package/icons/arrowhead-left-outline.svg +1 -0
- package/icons/arrowhead-right-outline.svg +1 -0
- package/icons/arrowhead-up-outline.svg +1 -0
- package/icons/at-outline.svg +1 -0
- package/icons/attach-2-outline.svg +1 -0
- package/icons/attach-outline.svg +1 -0
- package/icons/award-outline.svg +1 -0
- package/icons/backspace-outline.svg +1 -0
- package/icons/bar-chart-2-outline.svg +1 -0
- package/icons/bar-chart-outline.svg +1 -0
- package/icons/battery-outline.svg +1 -0
- package/icons/behance-outline.svg +1 -0
- package/icons/bell-off-outline.svg +1 -0
- package/icons/bell-outline.svg +1 -0
- package/icons/bluetooth-outline.svg +1 -0
- package/icons/book-open-outline.svg +1 -0
- package/icons/book-outline.svg +1 -0
- package/icons/bookmark-outline.svg +1 -0
- package/icons/briefcase-outline.svg +1 -0
- package/icons/browser-outline.svg +1 -0
- package/icons/brush-outline.svg +1 -0
- package/icons/bulb-outline.svg +1 -0
- package/icons/calendar-outline.svg +1 -0
- package/icons/camera-outline.svg +1 -0
- package/icons/car-outline.svg +1 -0
- package/icons/cast-outline.svg +1 -0
- package/icons/charging-outline.svg +1 -0
- package/icons/checkmark-circle-2-outline.svg +1 -0
- package/icons/checkmark-circle-outline.svg +1 -0
- package/icons/checkmark-outline.svg +1 -0
- package/icons/checkmark-square-2-outline.svg +1 -0
- package/icons/checkmark-square-outline.svg +1 -0
- package/icons/chevron-down-outline.svg +1 -0
- package/icons/chevron-left-outline.svg +1 -0
- package/icons/chevron-right-outline.svg +1 -0
- package/icons/chevron-up-outline.svg +1 -0
- package/icons/clipboard-outline.svg +1 -0
- package/icons/clock-outline.svg +1 -0
- package/icons/close-circle-outline.svg +1 -0
- package/icons/close-outline.svg +1 -0
- package/icons/close-square-outline.svg +1 -0
- package/icons/cloud-download-outline.svg +1 -0
- package/icons/cloud-upload-outline.svg +1 -0
- package/icons/code-download-outline.svg +1 -0
- package/icons/code-outline.svg +1 -0
- package/icons/collapse-outline.svg +1 -0
- package/icons/color-palette-outline.svg +1 -0
- package/icons/color-picker-outline.svg +1 -0
- package/icons/compass-outline.svg +1 -0
- package/icons/copy-outline.svg +1 -0
- package/icons/corner-down-left-outline.svg +1 -0
- package/icons/corner-down-right-outline.svg +1 -0
- package/icons/corner-left-down-outline.svg +1 -0
- package/icons/corner-left-up-outline.svg +1 -0
- package/icons/corner-right-down-outline.svg +1 -0
- package/icons/corner-right-up-outline.svg +1 -0
- package/icons/corner-up-left-outline.svg +1 -0
- package/icons/corner-up-right-outline.svg +1 -0
- package/icons/credit-card-outline.svg +1 -0
- package/icons/crop-outline.svg +1 -0
- package/icons/cube-outline.svg +1 -0
- package/icons/diagonal-arrow-left-down-outline.svg +1 -0
- package/icons/diagonal-arrow-left-up-outline.svg +1 -0
- package/icons/diagonal-arrow-right-down-outline.svg +1 -0
- package/icons/diagonal-arrow-right-up-outline.svg +1 -0
- package/icons/done-all-outline.svg +1 -0
- package/icons/download-outline.svg +1 -0
- package/icons/droplet-off-outline.svg +1 -0
- package/icons/droplet-outline.svg +1 -0
- package/icons/edit-2-outline.svg +1 -0
- package/icons/edit-outline.svg +1 -0
- package/icons/email-outline.svg +1 -0
- package/icons/expand-outline.svg +1 -0
- package/icons/external-link-outline.svg +1 -0
- package/icons/eye-off-2-outline.svg +1 -0
- package/icons/eye-off-outline.svg +1 -0
- package/icons/eye-outline.svg +1 -0
- package/icons/facebook-outline.svg +1 -0
- package/icons/file-add-outline.svg +1 -0
- package/icons/file-outline.svg +1 -0
- package/icons/file-remove-outline.svg +1 -0
- package/icons/file-text-outline.svg +1 -0
- package/icons/film-outline.svg +1 -0
- package/icons/flag-outline.svg +1 -0
- package/icons/flash-off-outline.svg +1 -0
- package/icons/flash-outline.svg +1 -0
- package/icons/flip-2-outline.svg +1 -0
- package/icons/flip-outline.svg +1 -0
- package/icons/folder-add-outline.svg +1 -0
- package/icons/folder-outline.svg +1 -0
- package/icons/folder-remove-outline.svg +1 -0
- package/icons/funnel-outline.svg +1 -0
- package/icons/gift-outline.svg +1 -0
- package/icons/github-outline.svg +1 -0
- package/icons/globe-2-outline.svg +1 -0
- package/icons/globe-outline.svg +1 -0
- package/icons/google-outline.svg +1 -0
- package/icons/grid-outline.svg +1 -0
- package/icons/hard-drive-outline.svg +1 -0
- package/icons/hash-outline.svg +1 -0
- package/icons/headphones-outline.svg +1 -0
- package/icons/heart-outline.svg +1 -0
- package/icons/home-outline.svg +1 -0
- package/icons/image-outline.svg +1 -0
- package/icons/inbox-outline.svg +1 -0
- package/icons/info-outline.svg +1 -0
- package/icons/keypad-outline.svg +1 -0
- package/icons/layers-outline.svg +1 -0
- package/icons/layout-outline.svg +1 -0
- package/icons/link-2-outline.svg +1 -0
- package/icons/link-outline.svg +1 -0
- package/icons/linkedin-outline.svg +1 -0
- package/icons/list-outline.svg +1 -0
- package/icons/loader-outline.svg +1 -0
- package/icons/lock-outline.svg +1 -0
- package/icons/log-in-outline.svg +1 -0
- package/icons/log-out-outline.svg +1 -0
- package/icons/map-outline.svg +1 -0
- package/icons/maximize-outline.svg +1 -0
- package/icons/menu-2-outline.svg +1 -0
- package/icons/menu-arrow-outline.svg +1 -0
- package/icons/menu-outline.svg +1 -0
- package/icons/message-circle-outline.svg +1 -0
- package/icons/message-square-outline.svg +1 -0
- package/icons/mic-off-outline.svg +1 -0
- package/icons/mic-outline.svg +1 -0
- package/icons/minimize-outline.svg +1 -0
- package/icons/minus-circle-outline.svg +1 -0
- package/icons/minus-outline.svg +1 -0
- package/icons/minus-square-outline.svg +1 -0
- package/icons/monitor-outline.svg +1 -0
- package/icons/moon-outline.svg +1 -0
- package/icons/more-horizontal-outline.svg +1 -0
- package/icons/more-vertical-outline.svg +1 -0
- package/icons/move-outline.svg +1 -0
- package/icons/music-outline.svg +1 -0
- package/icons/navigation-2-outline.svg +1 -0
- package/icons/navigation-outline.svg +1 -0
- package/icons/npm-outline.svg +1 -0
- package/icons/options-2-outline.svg +1 -0
- package/icons/options-outline.svg +1 -0
- package/icons/pantone-outline.svg +1 -0
- package/icons/paper-plane-outline.svg +1 -0
- package/icons/pause-circle-outline.svg +1 -0
- package/icons/people-outline.svg +1 -0
- package/icons/percent-outline.svg +1 -0
- package/icons/person-add-outline.svg +1 -0
- package/icons/person-delete-outline.svg +1 -0
- package/icons/person-done-outline.svg +1 -0
- package/icons/person-outline.svg +1 -0
- package/icons/person-remove-outline.svg +1 -0
- package/icons/phone-call-outline.svg +1 -0
- package/icons/phone-missed-outline.svg +1 -0
- package/icons/phone-off-outline.svg +1 -0
- package/icons/phone-outline.svg +1 -0
- package/icons/pie-chart-outline.svg +1 -0
- package/icons/pin-outline.svg +1 -0
- package/icons/play-circle-outline.svg +1 -0
- package/icons/plus-circle-outline.svg +1 -0
- package/icons/plus-outline.svg +1 -0
- package/icons/plus-square-outline.svg +1 -0
- package/icons/power-outline.svg +1 -0
- package/icons/pricetags-outline.svg +1 -0
- package/icons/printer-outline.svg +1 -0
- package/icons/question-mark-circle-outline.svg +1 -0
- package/icons/question-mark-outline.svg +1 -0
- package/icons/radio-button-off-outline.svg +1 -0
- package/icons/radio-button-on-outline.svg +1 -0
- package/icons/radio-outline.svg +1 -0
- package/icons/recording-outline.svg +1 -0
- package/icons/refresh-outline.svg +1 -0
- package/icons/repeat-outline.svg +1 -0
- package/icons/rewind-left-outline.svg +1 -0
- package/icons/rewind-right-outline.svg +1 -0
- package/icons/save-outline.svg +1 -0
- package/icons/scissors-outline.svg +1 -0
- package/icons/search-outline.svg +1 -0
- package/icons/settings-2-outline.svg +1 -0
- package/icons/settings-outline.svg +1 -0
- package/icons/shake-outline.svg +1 -0
- package/icons/share-outline.svg +1 -0
- package/icons/shield-off-outline.svg +1 -0
- package/icons/shield-outline.svg +1 -0
- package/icons/shopping-bag-outline.svg +1 -0
- package/icons/shopping-cart-outline.svg +1 -0
- package/icons/shuffle-2-outline.svg +1 -0
- package/icons/shuffle-outline.svg +1 -0
- package/icons/skip-back-outline.svg +1 -0
- package/icons/skip-forward-outline.svg +1 -0
- package/icons/slash-outline.svg +1 -0
- package/icons/smartphone-outline.svg +1 -0
- package/icons/smiling-face-outline.svg +1 -0
- package/icons/speaker-outline.svg +1 -0
- package/icons/square-outline.svg +1 -0
- package/icons/star-outline.svg +1 -0
- package/icons/stop-circle-outline.svg +1 -0
- package/icons/sun-outline.svg +1 -0
- package/icons/swap-outline.svg +1 -0
- package/icons/sync-outline.svg +1 -0
- package/icons/text-outline.svg +1 -0
- package/icons/thermometer-minus-outline.svg +1 -0
- package/icons/thermometer-outline.svg +1 -0
- package/icons/thermometer-plus-outline.svg +1 -0
- package/icons/toggle-left-outline.svg +1 -0
- package/icons/toggle-right-outline.svg +1 -0
- package/icons/trash-2-outline.svg +1 -0
- package/icons/trash-outline.svg +1 -0
- package/icons/trending-down-outline.svg +1 -0
- package/icons/trending-up-outline.svg +1 -0
- package/icons/tv-outline.svg +1 -0
- package/icons/twitter-outline.svg +1 -0
- package/icons/umbrella-outline.svg +1 -0
- package/icons/undo-outline.svg +1 -0
- package/icons/unlock-outline.svg +1 -0
- package/icons/upload-outline.svg +1 -0
- package/icons/video-off-outline.svg +1 -0
- package/icons/video-outline.svg +1 -0
- package/icons/volume-down-outline.svg +1 -0
- package/icons/volume-mute-outline.svg +1 -0
- package/icons/volume-off-outline.svg +1 -0
- package/icons/volume-up-outline.svg +1 -0
- package/icons/wifi-off-outline.svg +1 -0
- package/icons/wifi-outline.svg +1 -0
- package/js/carousel.js +133 -0
- package/js/carousel.ts +173 -0
- package/js/chart.js +257 -0
- package/js/code-viewer.js +148 -0
- package/js/code-viewer.ts +188 -0
- package/js/datepicker.js +497 -0
- package/js/datepicker.ts +619 -0
- package/js/dropdown.js +122 -0
- package/js/dropdown.ts +180 -0
- package/js/editor.js +421 -0
- package/js/editor.ts +426 -0
- package/js/file-uploader.js +268 -0
- package/js/file-uploader.ts +350 -0
- package/js/flyout-menu.js +195 -0
- package/js/flyout-menu.ts +250 -0
- package/js/form-builder.js +107 -0
- package/js/gallery.js +177 -0
- package/js/gallery.ts +231 -0
- package/js/guitar-chords.js +268 -0
- package/js/index.js +720 -0
- package/js/index.ts +874 -0
- package/js/lazy-loader.js +121 -0
- package/js/modal.js +113 -0
- package/js/modal.ts +167 -0
- package/js/push-menu.js +101 -0
- package/js/push-menu.ts +130 -0
- package/js/request.js +51 -0
- package/js/scroll.js +27 -0
- package/js/scroll.ts +47 -0
- package/js/scrollbar.js +219 -0
- package/js/scrollbar.ts +308 -0
- package/js/select.js +158 -0
- package/js/select.ts +217 -0
- package/js/table.js +359 -0
- package/js/table.ts +453 -0
- package/js/tabs.js +225 -0
- package/js/tabs.ts +280 -0
- package/js/theme.js +194 -0
- package/js/theme.ts +225 -0
- package/js/timepicker.js +98 -0
- package/js/timepicker.ts +131 -0
- package/js/toast.js +93 -0
- package/js/toast.ts +138 -0
- package/js/tooltip.js +193 -0
- package/js/tooltip.ts +252 -0
- package/js/tree.js +162 -0
- package/js/tree.ts +218 -0
- package/js/tsconfig.json +18 -0
- package/js/utils.js +69 -0
- package/js/utils.ts +84 -0
- package/js/virtual-dropdown.js +277 -0
- package/js/virtual-dropdown.ts +366 -0
- package/package.json +38 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
interface FlyoutMenuOptions {
|
|
2
|
+
triggerSelector?: string;
|
|
3
|
+
menuSelector?: string;
|
|
4
|
+
overlaySelector?: string;
|
|
5
|
+
closeSelector?: string;
|
|
6
|
+
submenuToggleSelector?: string;
|
|
7
|
+
linkSelector?: string;
|
|
8
|
+
direction?: 'right' | 'left';
|
|
9
|
+
title?: string;
|
|
10
|
+
footerText?: string;
|
|
11
|
+
enableHeader?: boolean;
|
|
12
|
+
enableFooter?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
class FlyoutMenu {
|
|
16
|
+
private options: Required<FlyoutMenuOptions>;
|
|
17
|
+
private menuTrigger: HTMLElement | null;
|
|
18
|
+
private readonly flyoutMenu: HTMLElement | null;
|
|
19
|
+
private flyoutOverlay: HTMLElement | null;
|
|
20
|
+
private closeBtn: HTMLElement | null = null;
|
|
21
|
+
private submenuToggles: NodeListOf<HTMLElement> | null = null;
|
|
22
|
+
private menuLinks: NodeListOf<HTMLAnchorElement> | null = null;
|
|
23
|
+
|
|
24
|
+
constructor(options: FlyoutMenuOptions = {}) {
|
|
25
|
+
this.options = {
|
|
26
|
+
triggerSelector: '.menu-trigger',
|
|
27
|
+
menuSelector: '#flyoutMenu',
|
|
28
|
+
overlaySelector: '#flyoutOverlay',
|
|
29
|
+
closeSelector: '.close-menu',
|
|
30
|
+
submenuToggleSelector: '.submenu-toggle',
|
|
31
|
+
linkSelector: '.flyout-links > li > a',
|
|
32
|
+
direction: 'right',
|
|
33
|
+
title: 'Menu',
|
|
34
|
+
footerText: '© 2025 Brand Inc.',
|
|
35
|
+
enableHeader: true,
|
|
36
|
+
enableFooter: true,
|
|
37
|
+
...options
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
this.menuTrigger = document.querySelector(this.options.triggerSelector);
|
|
41
|
+
this.flyoutMenu = document.querySelector(this.options.menuSelector);
|
|
42
|
+
this.flyoutOverlay = document.querySelector(this.options.overlaySelector);
|
|
43
|
+
|
|
44
|
+
this.open = this.open.bind(this);
|
|
45
|
+
this.close = this.close.bind(this);
|
|
46
|
+
this.handleSubmenu = this.handleSubmenu.bind(this);
|
|
47
|
+
this.handleKeydown = this.handleKeydown.bind(this);
|
|
48
|
+
|
|
49
|
+
this.init();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private init(): void {
|
|
53
|
+
if (!this.flyoutMenu) {
|
|
54
|
+
throw new Error(`FlyoutMenu: Menu element not found for selector "${this.options.menuSelector}"`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this.hydrateMenu();
|
|
58
|
+
|
|
59
|
+
if (this.options.enableHeader) this.renderHeader();
|
|
60
|
+
if (this.options.enableFooter) this.renderFooter();
|
|
61
|
+
|
|
62
|
+
this.closeBtn = document.querySelector(this.options.closeSelector);
|
|
63
|
+
this.submenuToggles = this.flyoutMenu.querySelectorAll(this.options.submenuToggleSelector);
|
|
64
|
+
this.menuLinks = this.flyoutMenu.querySelectorAll('a');
|
|
65
|
+
|
|
66
|
+
this.setDirection(this.options.direction);
|
|
67
|
+
|
|
68
|
+
this.bindEvents();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private hydrateMenu(): void {
|
|
72
|
+
if (!this.flyoutMenu) return;
|
|
73
|
+
|
|
74
|
+
const rootUl = this.flyoutMenu.querySelector('ul');
|
|
75
|
+
if (rootUl) {
|
|
76
|
+
rootUl.classList.add('flyout-links');
|
|
77
|
+
this.processListItems(rootUl);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private processListItems(ul: HTMLUListElement): void {
|
|
82
|
+
const items = Array.from(ul.children) as HTMLLIElement[];
|
|
83
|
+
items.forEach((li, index) => {
|
|
84
|
+
// Check if it has a nested UL
|
|
85
|
+
const nestedUl = li.querySelector('ul') as HTMLUListElement | null;
|
|
86
|
+
if (nestedUl) {
|
|
87
|
+
li.classList.add('has-submenu');
|
|
88
|
+
nestedUl.classList.add('submenu');
|
|
89
|
+
|
|
90
|
+
// Get text content (excluding nested UL text)
|
|
91
|
+
const textNode = Array.from(li.childNodes).find(
|
|
92
|
+
node => node.nodeType === Node.TEXT_NODE && node.textContent?.trim() !== ''
|
|
93
|
+
) as Text | undefined;
|
|
94
|
+
const text = textNode?.textContent?.trim() || 'Menu Item';
|
|
95
|
+
textNode?.remove();
|
|
96
|
+
|
|
97
|
+
// Create Toggle Button
|
|
98
|
+
const button = document.createElement('button');
|
|
99
|
+
button.className = 'submenu-toggle';
|
|
100
|
+
button.style.setProperty('--delay', `${(index + 1) * 0.1}s`);
|
|
101
|
+
button.innerHTML = `
|
|
102
|
+
${text}
|
|
103
|
+
<svg class="chevron" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
104
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
105
|
+
</svg>
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
li.insertBefore(button, nestedUl);
|
|
109
|
+
|
|
110
|
+
// Recursively process nested UL
|
|
111
|
+
this.processListItems(nestedUl);
|
|
112
|
+
} else {
|
|
113
|
+
// Leaf node - ensure it has a link
|
|
114
|
+
const link = li.querySelector('a');
|
|
115
|
+
if (link) {
|
|
116
|
+
link.style.setProperty('--delay', `${(index + 1) * 0.1}s`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private renderHeader(): void {
|
|
123
|
+
if (!this.flyoutMenu) return;
|
|
124
|
+
|
|
125
|
+
const header = document.createElement('div');
|
|
126
|
+
header.className = 'flyout-header';
|
|
127
|
+
header.innerHTML = `
|
|
128
|
+
<span class="flyout-title">${this.options.title}</span>
|
|
129
|
+
<button class="close-menu" aria-label="Close Menu">
|
|
130
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
|
131
|
+
stroke-linecap="round" stroke-linejoin="round">
|
|
132
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
133
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
134
|
+
</svg>
|
|
135
|
+
</button>
|
|
136
|
+
`;
|
|
137
|
+
this.flyoutMenu.prepend(header);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private renderFooter(): void {
|
|
141
|
+
if (!this.flyoutMenu) return;
|
|
142
|
+
|
|
143
|
+
const footer = document.createElement('div');
|
|
144
|
+
footer.className = 'flyout-footer';
|
|
145
|
+
footer.style.setProperty('--delay', '0.6s');
|
|
146
|
+
footer.innerHTML = `<p>${this.options.footerText}</p>`;
|
|
147
|
+
this.flyoutMenu.append(footer);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private bindEvents(): void {
|
|
151
|
+
// Open
|
|
152
|
+
this.menuTrigger?.addEventListener('click', this.open);
|
|
153
|
+
|
|
154
|
+
// Close
|
|
155
|
+
this.closeBtn?.addEventListener('click', this.close);
|
|
156
|
+
this.flyoutOverlay?.addEventListener('click', this.close);
|
|
157
|
+
|
|
158
|
+
// Submenus
|
|
159
|
+
this.submenuToggles?.forEach(toggle => {
|
|
160
|
+
toggle.addEventListener('click', (e) => this.handleSubmenu(e, toggle));
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// Close on Link Click
|
|
164
|
+
this.menuLinks?.forEach(link => {
|
|
165
|
+
link.addEventListener('click', this.close);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Keyboard navigation
|
|
169
|
+
document.addEventListener('keydown', this.handleKeydown);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private open(): void {
|
|
173
|
+
this.flyoutMenu?.classList.add('is-open');
|
|
174
|
+
this.flyoutOverlay?.classList.add('is-visible');
|
|
175
|
+
document.body.style.overflow = 'hidden';
|
|
176
|
+
this.menuTrigger?.setAttribute('aria-expanded', 'true');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private close(): void {
|
|
180
|
+
this.flyoutMenu?.classList.remove('is-open');
|
|
181
|
+
this.flyoutOverlay?.classList.remove('is-visible');
|
|
182
|
+
document.body.style.overflow = '';
|
|
183
|
+
this.menuTrigger?.setAttribute('aria-expanded', 'false');
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
private handleSubmenu(e: Event, toggle: HTMLElement): void {
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
e.stopPropagation();
|
|
189
|
+
|
|
190
|
+
const submenu = toggle.nextElementSibling as HTMLElement | null;
|
|
191
|
+
const parentLi = toggle.parentElement as HTMLLIElement | null;
|
|
192
|
+
const parentUl = parentLi?.parentElement as HTMLUListElement | null;
|
|
193
|
+
|
|
194
|
+
if (!parentUl || !parentLi) return;
|
|
195
|
+
|
|
196
|
+
// Close other submenus at the same level
|
|
197
|
+
const siblings = Array.from(parentUl.children) as HTMLLIElement[];
|
|
198
|
+
siblings.forEach(sibling => {
|
|
199
|
+
if (sibling !== parentLi) {
|
|
200
|
+
const siblingSubmenu = sibling.querySelector('.submenu');
|
|
201
|
+
const siblingToggle = sibling.querySelector('.submenu-toggle');
|
|
202
|
+
if (siblingSubmenu?.classList.contains('is-open')) {
|
|
203
|
+
siblingSubmenu.classList.remove('is-open');
|
|
204
|
+
siblingToggle?.classList.remove('active');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
toggle.classList.toggle('active');
|
|
210
|
+
submenu?.classList.toggle('is-open');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
private handleKeydown(e: KeyboardEvent): void {
|
|
214
|
+
if (e.key === 'Escape' && this.flyoutMenu?.classList.contains('is-open')) {
|
|
215
|
+
this.close();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
public setDirection(direction: 'left' | 'right'): void {
|
|
220
|
+
if (!this.flyoutMenu) return;
|
|
221
|
+
|
|
222
|
+
const validDirections: Array<'left' | 'right'> = ['left', 'right'];
|
|
223
|
+
if (!validDirections.includes(direction)) return;
|
|
224
|
+
|
|
225
|
+
this.flyoutMenu.classList.remove('flyout-from-right', 'flyout-from-left');
|
|
226
|
+
this.flyoutMenu.classList.add(`flyout-from-${direction}`);
|
|
227
|
+
|
|
228
|
+
this.options.direction = direction;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
public destroy(): void {
|
|
232
|
+
this.menuTrigger?.removeEventListener('click', this.open);
|
|
233
|
+
this.closeBtn?.removeEventListener('click', this.close);
|
|
234
|
+
this.flyoutOverlay?.removeEventListener('click', this.close);
|
|
235
|
+
|
|
236
|
+
this.submenuToggles?.forEach(toggle => {
|
|
237
|
+
toggle.removeEventListener('click', (e) => this.handleSubmenu(e, toggle));
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
this.menuLinks?.forEach(link => {
|
|
241
|
+
link.removeEventListener('click', this.close);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
document.removeEventListener('keydown', this.handleKeydown);
|
|
245
|
+
|
|
246
|
+
document.body.style.overflow = '';
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export { FlyoutMenu, type FlyoutMenuOptions };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
let dragged_element = null;
|
|
2
|
+
let action = 'copy';
|
|
3
|
+
let row_count = 1;
|
|
4
|
+
|
|
5
|
+
let formbuilder = {
|
|
6
|
+
init() {
|
|
7
|
+
document.querySelectorAll('.draggable').forEach(function (element) {
|
|
8
|
+
element.removeEventListener("dragstart", dragAction);
|
|
9
|
+
element.addEventListener("dragstart", dragAction);
|
|
10
|
+
});
|
|
11
|
+
initDropzones();
|
|
12
|
+
},
|
|
13
|
+
addRow() {
|
|
14
|
+
document.querySelector('.form-content').innerHTML += buildRowElement();
|
|
15
|
+
},
|
|
16
|
+
addColumn() {
|
|
17
|
+
|
|
18
|
+
},
|
|
19
|
+
removeRow() {
|
|
20
|
+
|
|
21
|
+
},
|
|
22
|
+
removeColumn() {
|
|
23
|
+
|
|
24
|
+
},
|
|
25
|
+
load(file_name) {
|
|
26
|
+
load(file_name).then((data) => {
|
|
27
|
+
console.log(data);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const moveAction = function (event) {
|
|
33
|
+
dragged_element = event.target;
|
|
34
|
+
action = 'move';
|
|
35
|
+
}
|
|
36
|
+
const dragAction = function (event) {
|
|
37
|
+
dragged_element = event.target;
|
|
38
|
+
action = 'copy';
|
|
39
|
+
}
|
|
40
|
+
const addMoveListeners = function () {
|
|
41
|
+
document.querySelectorAll('.movable').forEach(function (element) {
|
|
42
|
+
element.removeEventListener("dragstart", moveAction);
|
|
43
|
+
element.addEventListener("dragstart", moveAction);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const load = async function (file_name) {
|
|
48
|
+
const url = new URL(file_name,
|
|
49
|
+
document.currentScript && document.currentScript.src || location.href)
|
|
50
|
+
// fetch and parse template as string
|
|
51
|
+
let template = await fetch(url)
|
|
52
|
+
template = await template.text()
|
|
53
|
+
template = new DOMParser().parseFromString(template, 'text/html')
|
|
54
|
+
.querySelector('template')
|
|
55
|
+
if (!template) throw new TypeError('No template element found')
|
|
56
|
+
return template.innerHTML.trim()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const buildRowElement = function () {
|
|
60
|
+
const row = document.createElement('div');
|
|
61
|
+
row_count++;
|
|
62
|
+
row.setAttribute('data-row-id', String(row_count));
|
|
63
|
+
row.className = 'row';
|
|
64
|
+
const col = document.createElement('div');
|
|
65
|
+
col.className = 'column';
|
|
66
|
+
const dropzone = document.createElement('div');
|
|
67
|
+
dropzone.className = 'dropzone';
|
|
68
|
+
col.innerHTML = dropzone.outerHTML;
|
|
69
|
+
row.innerHTML = col.outerHTML;
|
|
70
|
+
return row.outerHTML;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const dropEvent = function (event) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
let node = dragged_element;
|
|
76
|
+
if (action === 'copy') {
|
|
77
|
+
node = dragged_element.cloneNode(true);
|
|
78
|
+
}
|
|
79
|
+
node.classList.remove('draggable');
|
|
80
|
+
node.classList.add('movable');
|
|
81
|
+
const label = node.querySelector('span.label');
|
|
82
|
+
if (label) {
|
|
83
|
+
label.setAttribute('contenteditable', true);
|
|
84
|
+
}
|
|
85
|
+
const pElement = node.querySelector('p');
|
|
86
|
+
if (pElement) {
|
|
87
|
+
pElement.setAttribute('contenteditable', true);
|
|
88
|
+
}
|
|
89
|
+
event.target.appendChild(node);
|
|
90
|
+
addMoveListeners();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const dragOverEvent = function (event) {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
event.dataTransfer.effectAllowed = action;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const initDropzones = function () {
|
|
99
|
+
document.querySelectorAll('.dropzone').forEach(function (dropzone) {
|
|
100
|
+
dropzone.removeEventListener('drop', dropEvent);
|
|
101
|
+
dropzone.addEventListener('drop', dropEvent);
|
|
102
|
+
dropzone.removeEventListener('dragover', dragOverEvent);
|
|
103
|
+
dropzone.addEventListener('dragover', dragOverEvent);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export {formbuilder}
|
package/js/gallery.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
class MasonryGallery {
|
|
2
|
+
constructor(containerId, options = {}) {
|
|
3
|
+
this.columns = [];
|
|
4
|
+
this.isFetching = false;
|
|
5
|
+
this.resizeObserver = null;
|
|
6
|
+
this.abortController = null;
|
|
7
|
+
this.reloaded = 0;
|
|
8
|
+
this.handleScroll = () => {
|
|
9
|
+
if (this.isFetching)
|
|
10
|
+
return;
|
|
11
|
+
const { scrollTop, scrollHeight, clientHeight } = document.documentElement;
|
|
12
|
+
if (scrollTop + clientHeight >=
|
|
13
|
+
scrollHeight - this.options.scrollThreshold) {
|
|
14
|
+
this.loadMoreImages();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const container = document.getElementById(containerId);
|
|
18
|
+
if (!container) {
|
|
19
|
+
throw new Error(`Container with id "${containerId}" not found`);
|
|
20
|
+
}
|
|
21
|
+
this.container = container;
|
|
22
|
+
this.loader = document.querySelector(options.loaderSelector || ".loader");
|
|
23
|
+
this.options = {
|
|
24
|
+
minColumnWidth: options.minColumnWidth ?? 250,
|
|
25
|
+
scrollThreshold: options.scrollThreshold ?? 100,
|
|
26
|
+
reload: 2,
|
|
27
|
+
fetchFunction: options.fetchFunction ?? this.fetchMockImages(),
|
|
28
|
+
};
|
|
29
|
+
this.init();
|
|
30
|
+
}
|
|
31
|
+
init() {
|
|
32
|
+
this.setupLayout();
|
|
33
|
+
this.loadMoreImages();
|
|
34
|
+
this.addEventListeners();
|
|
35
|
+
}
|
|
36
|
+
setupLayout() {
|
|
37
|
+
const containerWidth = this.container.getBoundingClientRect().width;
|
|
38
|
+
const numColumns = Math.max(1, Math.floor(containerWidth / this.options.minColumnWidth));
|
|
39
|
+
if (this.columns.length !== numColumns) {
|
|
40
|
+
this.container.innerHTML = "";
|
|
41
|
+
this.columns = [];
|
|
42
|
+
for (let i = 0; i < numColumns; i++) {
|
|
43
|
+
const col = document.createElement("div");
|
|
44
|
+
col.className = "masonry-column";
|
|
45
|
+
this.container.appendChild(col);
|
|
46
|
+
this.columns.push(col);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
addEventListeners() {
|
|
51
|
+
let resizeTimeout;
|
|
52
|
+
window.addEventListener("resize", () => {
|
|
53
|
+
clearTimeout(resizeTimeout);
|
|
54
|
+
resizeTimeout = setTimeout(() => {
|
|
55
|
+
this.reLayout();
|
|
56
|
+
}, 200);
|
|
57
|
+
});
|
|
58
|
+
this.abortController = new AbortController();
|
|
59
|
+
window.addEventListener("scroll", this.handleScroll, {
|
|
60
|
+
passive: true,
|
|
61
|
+
signal: this.abortController.signal,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
reLayout() {
|
|
65
|
+
const items = [];
|
|
66
|
+
this.columns.forEach((col) => {
|
|
67
|
+
Array.from(col.children).forEach((child) => {
|
|
68
|
+
items.push(child);
|
|
69
|
+
});
|
|
70
|
+
col.innerHTML = "";
|
|
71
|
+
});
|
|
72
|
+
const availableWidth = Math.min(1200, window.innerWidth - 40);
|
|
73
|
+
const numColumns = Math.max(1, Math.floor(availableWidth / this.options.minColumnWidth));
|
|
74
|
+
if (this.columns.length !== numColumns) {
|
|
75
|
+
this.container.innerHTML = "";
|
|
76
|
+
this.columns = [];
|
|
77
|
+
for (let i = 0; i < numColumns; i++) {
|
|
78
|
+
const col = document.createElement("div");
|
|
79
|
+
col.className = "masonry-column";
|
|
80
|
+
this.container.appendChild(col);
|
|
81
|
+
this.columns.push(col);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
items.forEach((item) => {
|
|
85
|
+
this.addToShortestColumn(item);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async loadMoreImages() {
|
|
89
|
+
this.reloaded++;
|
|
90
|
+
if (this.options.reload > 0 && this.reloaded > this.options.reload) {
|
|
91
|
+
console.warn("Maximum reload limit reached.");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (this.isFetching)
|
|
95
|
+
return;
|
|
96
|
+
this.isFetching = true;
|
|
97
|
+
this.toggleLoader(true);
|
|
98
|
+
try {
|
|
99
|
+
const newImages = await this.options.fetchFunction;
|
|
100
|
+
this.renderImages(newImages);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw new Error("Error loading images: " + error);
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
this.isFetching = false;
|
|
107
|
+
this.toggleLoader(false);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
toggleLoader(show) {
|
|
111
|
+
if (this.loader) {
|
|
112
|
+
this.loader.classList.toggle("hidden", !show);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
fetchMockImages() {
|
|
116
|
+
throw Error("Method not implemented.");
|
|
117
|
+
}
|
|
118
|
+
renderImages(imageDataList) {
|
|
119
|
+
imageDataList.forEach((data) => {
|
|
120
|
+
const item = this.createCard(data);
|
|
121
|
+
this.addToShortestColumn(item);
|
|
122
|
+
requestAnimationFrame(() => {
|
|
123
|
+
const img = item.querySelector("img");
|
|
124
|
+
if (img) {
|
|
125
|
+
img.addEventListener("load", () => img.classList.add("loaded"), {
|
|
126
|
+
once: true,
|
|
127
|
+
});
|
|
128
|
+
if (img.complete) {
|
|
129
|
+
img.classList.add("loaded");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
createCard(data) {
|
|
136
|
+
const div = document.createElement("div");
|
|
137
|
+
div.className = "masonry-item";
|
|
138
|
+
div.innerHTML = `
|
|
139
|
+
<img src="${this.escapeHtml(data.src)}" alt="${this.escapeHtml(data.title)}" loading="lazy">
|
|
140
|
+
<div class="masonry-item-info">
|
|
141
|
+
<h3 class="masonry-item-title">${this.escapeHtml(data.title)}</h3>
|
|
142
|
+
<p class="masonry-item-desc">${this.escapeHtml(data.desc)}</p>
|
|
143
|
+
</div>
|
|
144
|
+
`;
|
|
145
|
+
return div;
|
|
146
|
+
}
|
|
147
|
+
escapeHtml(text) {
|
|
148
|
+
const div = document.createElement("div");
|
|
149
|
+
div.textContent = text;
|
|
150
|
+
return div.innerHTML;
|
|
151
|
+
}
|
|
152
|
+
addToShortestColumn(element) {
|
|
153
|
+
if (this.columns.length === 0)
|
|
154
|
+
return;
|
|
155
|
+
let shortestCol = this.columns[0];
|
|
156
|
+
let minHeight = shortestCol.offsetHeight;
|
|
157
|
+
for (let i = 1; i < this.columns.length; i++) {
|
|
158
|
+
const h = this.columns[i].offsetHeight;
|
|
159
|
+
if (h < minHeight) {
|
|
160
|
+
minHeight = h;
|
|
161
|
+
shortestCol = this.columns[i];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
shortestCol.appendChild(element);
|
|
165
|
+
}
|
|
166
|
+
destroy() {
|
|
167
|
+
if (this.resizeObserver) {
|
|
168
|
+
this.resizeObserver.disconnect();
|
|
169
|
+
this.resizeObserver = null;
|
|
170
|
+
}
|
|
171
|
+
if (this.abortController) {
|
|
172
|
+
this.abortController.abort();
|
|
173
|
+
this.abortController = null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export { MasonryGallery };
|