@deweb.id/ui-kit 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +90 -2
- package/css/ui-kit.css +901 -0
- package/dist/chunk-028rzptn.js +253 -0
- package/dist/chunk-028rzptn.js.map +10 -0
- package/dist/chunk-0x0et52k.js +82 -0
- package/dist/chunk-0x0et52k.js.map +10 -0
- package/dist/chunk-17gmkyd1.js +195 -0
- package/dist/chunk-17gmkyd1.js.map +10 -0
- package/dist/chunk-19jsevr8.js +17 -0
- package/dist/chunk-19jsevr8.js.map +10 -0
- package/dist/chunk-1t1fbbme.js +171 -0
- package/dist/chunk-1t1fbbme.js.map +10 -0
- package/dist/chunk-26ban96z.js +151 -0
- package/dist/chunk-26ban96z.js.map +10 -0
- package/dist/chunk-39hey5ns.js +2034 -0
- package/dist/chunk-39hey5ns.js.map +19 -0
- package/dist/chunk-3f0bjycv.js +481 -0
- package/dist/chunk-3f0bjycv.js.map +10 -0
- package/dist/chunk-3zpf64v4.js +108 -0
- package/dist/chunk-3zpf64v4.js.map +10 -0
- package/dist/chunk-4jrq15v9.js +919 -0
- package/dist/chunk-4jrq15v9.js.map +10 -0
- package/dist/chunk-8dacesjp.js +289 -0
- package/dist/chunk-8dacesjp.js.map +10 -0
- package/dist/chunk-8een770x.js +2546 -0
- package/dist/chunk-8een770x.js.map +29 -0
- package/dist/chunk-8jv2g2ne.js +371 -0
- package/dist/chunk-8jv2g2ne.js.map +10 -0
- package/dist/chunk-abdqb4e5.js +156 -0
- package/dist/chunk-abdqb4e5.js.map +10 -0
- package/dist/chunk-af27xdf2.js +891 -0
- package/dist/chunk-af27xdf2.js.map +11 -0
- package/dist/chunk-amsyqyh9.js +23 -0
- package/dist/chunk-amsyqyh9.js.map +9 -0
- package/dist/chunk-czbcw9e1.js +503 -0
- package/dist/chunk-czbcw9e1.js.map +11 -0
- package/dist/chunk-dar8mz91.js +73 -0
- package/dist/chunk-dar8mz91.js.map +10 -0
- package/dist/chunk-dsddmmdk.js +136 -0
- package/dist/chunk-dsddmmdk.js.map +10 -0
- package/dist/chunk-edx7tas6.js +89 -0
- package/dist/chunk-edx7tas6.js.map +10 -0
- package/dist/chunk-es4tgmvr.js +1686 -0
- package/dist/chunk-es4tgmvr.js.map +12 -0
- package/dist/chunk-f2aqj672.js +240 -0
- package/dist/chunk-f2aqj672.js.map +11 -0
- package/dist/chunk-h6k57hyd.js +146 -0
- package/dist/chunk-h6k57hyd.js.map +10 -0
- package/dist/chunk-hkx78qgj.js +1548 -0
- package/dist/chunk-hkx78qgj.js.map +12 -0
- package/dist/chunk-hq57r97c.js +770 -0
- package/dist/chunk-hq57r97c.js.map +11 -0
- package/dist/chunk-jct2e2h1.js +139 -0
- package/dist/chunk-jct2e2h1.js.map +10 -0
- package/dist/chunk-je0j5sn4.js +246 -0
- package/dist/chunk-je0j5sn4.js.map +10 -0
- package/dist/chunk-k2b698v5.js +754 -0
- package/dist/chunk-k2b698v5.js.map +12 -0
- package/dist/chunk-kv58555q.js +267 -0
- package/dist/chunk-kv58555q.js.map +11 -0
- package/dist/chunk-m0msvrte.js +15 -0
- package/dist/chunk-m0msvrte.js.map +10 -0
- package/dist/chunk-m3t14v77.js +30 -0
- package/dist/chunk-m3t14v77.js.map +10 -0
- package/dist/chunk-mctp30cp.js +1466 -0
- package/dist/chunk-mctp30cp.js.map +10 -0
- package/dist/chunk-n37qb5m5.js +1408 -0
- package/dist/chunk-n37qb5m5.js.map +10 -0
- package/dist/chunk-nhhgsdt3.js +570 -0
- package/dist/chunk-nhhgsdt3.js.map +11 -0
- package/dist/chunk-pxydj130.js +28 -0
- package/dist/chunk-pxydj130.js.map +10 -0
- package/dist/chunk-qmbwp4k7.js +3275 -0
- package/dist/chunk-qmbwp4k7.js.map +13 -0
- package/dist/chunk-qzxf0aa2.js +149 -0
- package/dist/chunk-qzxf0aa2.js.map +10 -0
- package/dist/chunk-rbjyp9ff.js +47 -0
- package/dist/chunk-rbjyp9ff.js.map +10 -0
- package/dist/chunk-rbkc50xg.js +103 -0
- package/dist/chunk-rbkc50xg.js.map +10 -0
- package/dist/chunk-rn6f0s6x.js +66 -0
- package/dist/chunk-rn6f0s6x.js.map +9 -0
- package/dist/chunk-rswzbfa2.js +422 -0
- package/dist/chunk-rswzbfa2.js.map +10 -0
- package/dist/chunk-rzns0reg.js +157 -0
- package/dist/chunk-rzns0reg.js.map +10 -0
- package/dist/chunk-s851vtje.js +90 -0
- package/dist/chunk-s851vtje.js.map +10 -0
- package/dist/chunk-vak164kx.js +15 -0
- package/dist/chunk-vak164kx.js.map +9 -0
- package/dist/chunk-vpvnvegz.js +480 -0
- package/dist/chunk-vpvnvegz.js.map +10 -0
- package/dist/chunk-x4pk7vxm.js +10 -0
- package/dist/chunk-x4pk7vxm.js.map +10 -0
- package/dist/chunk-xd2fwgek.js +53 -0
- package/dist/chunk-xd2fwgek.js.map +10 -0
- package/dist/chunk-y71rd8qf.js +499 -0
- package/dist/chunk-y71rd8qf.js.map +10 -0
- package/dist/chunk-zjmt193s.js +34 -0
- package/dist/chunk-zjmt193s.js.map +9 -0
- package/dist/components/blocks/CustomHtmlBlock.d.ts +14 -0
- package/dist/components/blocks/LoginFormBlock.d.ts +16 -0
- package/dist/components/blocks/SidebarMenuBlock.d.ts +11 -0
- package/dist/components/blocks/SliderBlock.d.ts +13 -0
- package/dist/components/code/code-editor.d.ts +58 -0
- package/dist/components/code/code-preview.d.ts +18 -0
- package/dist/components/code/index.d.ts +4 -0
- package/dist/components/code/validator.d.ts +10 -0
- package/dist/components/code/vsc-themes.d.ts +6 -0
- package/dist/components/dashboard/compound/context.d.ts +14 -0
- package/dist/components/dashboard/compound/dashboard.d.ts +14 -0
- package/dist/components/dashboard/compound/index.d.ts +18 -0
- package/dist/components/dashboard/compound/main.d.ts +25 -0
- package/dist/components/dashboard/compound/sidebar.d.ts +5 -0
- package/dist/components/dashboard/dashboard-head-info.d.ts +38 -0
- package/dist/components/dashboard/dashboard-head.d.ts +19 -0
- package/dist/components/dashboard/dataview.d.ts +19 -0
- package/dist/components/dashboard/detailview.d.ts +1 -0
- package/dist/components/dashboard/formview.d.ts +265 -0
- package/dist/components/dashboard/pageformview.d.ts +79 -0
- package/dist/components/dashboard/styling/background-color-control.d.ts +34 -0
- package/dist/components/dashboard/styling/background-control.d.ts +45 -0
- package/dist/components/dashboard/styling/border-control.d.ts +14 -0
- package/dist/components/dashboard/styling/color-control.d.ts +22 -0
- package/dist/components/dashboard/styling/index.d.ts +7 -0
- package/dist/components/dashboard/styling/radius-control.d.ts +15 -0
- package/dist/components/dashboard/styling/spacing-control.d.ts +17 -0
- package/dist/components/dashboard/styling/types.d.ts +50 -0
- package/dist/components/document/index.d.ts +25 -0
- package/dist/components/ecommerce/commerce-cards.d.ts +37 -0
- package/dist/components/effect/action-animation.d.ts +14 -0
- package/dist/components/effect/element-animation.d.ts +41 -0
- package/dist/components/effect/page-transition.d.ts +10 -0
- package/dist/components/layout/BlockPalette.d.ts +14 -0
- package/dist/components/layout/DynamicLayout.d.ts +56 -0
- package/dist/components/layout/GridRow.d.ts +37 -0
- package/dist/components/layout/LayoutBuilder.d.ts +52 -0
- package/dist/components/layout/WidgetFieldsForm.d.ts +15 -0
- package/dist/components/ui/accordion.d.ts +36 -0
- package/dist/components/ui/action-bar.d.ts +46 -0
- package/dist/components/ui/alert.d.ts +25 -0
- package/dist/components/ui/animated.d.ts +41 -0
- package/dist/components/ui/app-shell.d.ts +53 -0
- package/dist/components/ui/avatar.d.ts +18 -0
- package/dist/components/ui/badge.d.ts +15 -0
- package/dist/components/ui/breadcrumb.d.ts +20 -0
- package/dist/components/ui/button-icon.d.ts +9 -0
- package/dist/components/ui/button.d.ts +37 -0
- package/dist/components/ui/calendar.d.ts +14 -0
- package/dist/components/ui/card-skeleton-aware.d.ts +2 -0
- package/dist/components/ui/card.d.ts +36 -0
- package/dist/components/ui/chart.d.ts +75 -0
- package/dist/components/ui/chat-bubble.d.ts +74 -0
- package/dist/components/ui/code.d.ts +85 -0
- package/dist/components/ui/code.js +21 -0
- package/dist/components/ui/code.js.map +9 -0
- package/dist/components/ui/collapsible.d.ts +25 -0
- package/dist/components/ui/control-group.d.ts +39 -0
- package/dist/components/ui/dashboard-grid/DashboardDropSlot.d.ts +10 -0
- package/dist/components/ui/dashboard-grid/DashboardGrid.d.ts +5 -0
- package/dist/components/ui/dashboard-grid/DashboardWidgetCard.d.ts +43 -0
- package/dist/components/ui/dashboard-grid/useDashboardDnd.d.ts +36 -0
- package/dist/components/ui/data-empty.d.ts +24 -0
- package/dist/components/ui/data-list.d.ts +16 -0
- package/dist/components/ui/data-table.d.ts +48 -0
- package/dist/components/ui/data-view/DataView.d.ts +46 -0
- package/dist/components/ui/data-view/DataViewCalendar.d.ts +18 -0
- package/dist/components/ui/data-view/DataViewContent.d.ts +5 -0
- package/dist/components/ui/data-view/DataViewFilter.d.ts +8 -0
- package/dist/components/ui/data-view/DataViewGrid.d.ts +32 -0
- package/dist/components/ui/data-view/DataViewHeader.d.ts +22 -0
- package/dist/components/ui/data-view/DataViewKanban.d.ts +16 -0
- package/dist/components/ui/data-view/DataViewPivot.d.ts +15 -0
- package/dist/components/ui/data-view/DataViewTable.d.ts +33 -0
- package/dist/components/ui/data-view/index.d.ts +9 -0
- package/dist/components/ui/date-time-picker.d.ts +205 -0
- package/dist/components/ui/drawer.d.ts +71 -0
- package/dist/components/ui/dropdown-animation.d.ts +7 -0
- package/dist/components/ui/dropdown.d.ts +71 -0
- package/dist/components/ui/error-state.d.ts +15 -0
- package/dist/components/ui/filter-bar.d.ts +50 -0
- package/dist/components/ui/filter-bar.js +19 -0
- package/dist/components/ui/filter-bar.js.map +9 -0
- package/dist/components/ui/font.d.ts +24 -0
- package/dist/components/ui/form-advanced.d.ts +198 -0
- package/dist/components/ui/form-compound.d.ts +58 -0
- package/dist/components/ui/form-context.d.ts +19 -0
- package/dist/components/ui/form.d.ts +451 -0
- package/dist/components/ui/format-currency.d.ts +10 -0
- package/dist/components/ui/format-date.d.ts +28 -0
- package/dist/components/ui/format-number.d.ts +22 -0
- package/dist/components/ui/format-time.d.ts +5 -0
- package/dist/components/ui/grid.d.ts +30 -0
- package/dist/components/ui/heading.d.ts +9 -0
- package/dist/components/ui/indicator.d.ts +17 -0
- package/dist/components/ui/initial-icon.d.ts +11 -0
- package/dist/components/ui/input-code.d.ts +27 -0
- package/dist/components/ui/input-grid.d.ts +54 -0
- package/dist/components/ui/input.d.ts +37 -0
- package/dist/components/ui/invoice-blocks.d.ts +124 -0
- package/dist/components/ui/invoice-document.d.ts +63 -0
- package/dist/components/ui/kanban.d.ts +16 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/lazy-load.d.ts +13 -0
- package/dist/components/ui/lightbox.d.ts +15 -0
- package/dist/components/ui/list.d.ts +33 -0
- package/dist/components/ui/loading.d.ts +79 -0
- package/dist/components/ui/media-card.d.ts +50 -0
- package/dist/components/ui/media-player.d.ts +47 -0
- package/dist/components/ui/menu.d.ts +24 -0
- package/dist/components/ui/modal.d.ts +233 -0
- package/dist/components/ui/page.d.ts +51 -0
- package/dist/components/ui/pagination.d.ts +16 -0
- package/dist/components/ui/print.d.ts +173 -0
- package/dist/components/ui/project-card.d.ts +43 -0
- package/dist/components/ui/radius-control.d.ts +36 -0
- package/dist/components/ui/rich-text-editor.d.ts +32 -0
- package/dist/components/ui/select-card.d.ts +56 -0
- package/dist/components/ui/sidebar-logo.d.ts +11 -0
- package/dist/components/ui/sidebar-menu.d.ts +82 -0
- package/dist/components/ui/sidebar-search.d.ts +7 -0
- package/dist/components/ui/skeletons.d.ts +46 -0
- package/dist/components/ui/surface.d.ts +13 -0
- package/dist/components/ui/table-pivot.d.ts +10 -0
- package/dist/components/ui/table.d.ts +258 -0
- package/dist/components/ui/tabs.d.ts +79 -0
- package/dist/components/ui/task-board.d.ts +29 -0
- package/dist/components/ui/terminal.d.ts +51 -0
- package/dist/components/ui/text-sensor.d.ts +9 -0
- package/dist/components/ui/theme-styler.d.ts +3 -0
- package/dist/components/ui/theme-toggle.d.ts +23 -0
- package/dist/components/ui/tooltip.d.ts +11 -0
- package/dist/components/website/account-banner.d.ts +11 -0
- package/dist/components/website/account-layout.d.ts +20 -0
- package/dist/components/website/account.d.ts +46 -0
- package/dist/components/website/ambient.d.ts +19 -0
- package/dist/components/website/auth.d.ts +35 -0
- package/dist/components/website/blog/blog-list-custom.d.ts +3 -0
- package/dist/components/website/blog/blog-list-gallery.d.ts +2 -0
- package/dist/components/website/blog/blog-list-grid.d.ts +2 -0
- package/dist/components/website/blog/blog-list-list.d.ts +2 -0
- package/dist/components/website/blog.d.ts +50 -0
- package/dist/components/website/carousel.d.ts +58 -0
- package/dist/components/website/cart.d.ts +31 -0
- package/dist/components/website/catalogue-view.d.ts +81 -0
- package/dist/components/website/catalogue.d.ts +96 -0
- package/dist/components/website/comment.d.ts +52 -0
- package/dist/components/website/eclipse.d.ts +15 -0
- package/dist/components/website/feature-grid.d.ts +58 -0
- package/dist/components/website/filter.d.ts +109 -0
- package/dist/components/website/hero.d.ts +89 -0
- package/dist/components/website/localize.d.ts +36 -0
- package/dist/components/website/logo.d.ts +24 -0
- package/dist/components/website/megamenu.d.ts +10 -0
- package/dist/components/website/navbar.d.ts +42 -0
- package/dist/components/website/notification.d.ts +58 -0
- package/dist/components/website/price.d.ts +26 -0
- package/dist/components/website/pricing.d.ts +21 -0
- package/dist/components/website/product.d.ts +32 -0
- package/dist/components/website/rating.d.ts +36 -0
- package/dist/components/website/review-form.d.ts +54 -0
- package/dist/components/website/reviews.d.ts +119 -0
- package/dist/components/website/search.d.ts +30 -0
- package/dist/entries/accordion.d.ts +1 -0
- package/dist/entries/accordion.js +9 -0
- package/dist/entries/accordion.js.map +9 -0
- package/dist/entries/alert.d.ts +1 -0
- package/dist/entries/alert.js +10 -0
- package/dist/entries/alert.js.map +9 -0
- package/dist/entries/badge.d.ts +1 -0
- package/dist/entries/badge.js +11 -0
- package/dist/entries/badge.js.map +9 -0
- package/dist/entries/breadcrumb.d.ts +1 -0
- package/dist/entries/breadcrumb.js +10 -0
- package/dist/entries/breadcrumb.js.map +9 -0
- package/dist/entries/button.d.ts +1 -0
- package/dist/entries/button.js +12 -0
- package/dist/entries/button.js.map +9 -0
- package/dist/entries/card.d.ts +1 -0
- package/dist/entries/card.js +25 -0
- package/dist/entries/card.js.map +9 -0
- package/dist/entries/chart.d.ts +1 -0
- package/dist/entries/chart.js +130 -0
- package/dist/entries/chart.js.map +10 -0
- package/dist/entries/components.d.ts +53 -0
- package/dist/entries/components.js +643 -0
- package/dist/entries/components.js.map +9 -0
- package/dist/entries/dashboard/dataview.d.ts +1 -0
- package/dist/entries/dashboard/dataview.js +82 -0
- package/dist/entries/dashboard/dataview.js.map +10 -0
- package/dist/entries/dashboard/pageformview.d.ts +1 -0
- package/dist/entries/dashboard/pageformview.js +34 -0
- package/dist/entries/dashboard/pageformview.js.map +9 -0
- package/dist/entries/data-table.d.ts +1 -0
- package/dist/entries/data-table.js +22 -0
- package/dist/entries/data-table.js.map +9 -0
- package/dist/entries/date-time-picker.d.ts +1 -0
- package/dist/entries/date-time-picker.js +28 -0
- package/dist/entries/date-time-picker.js.map +9 -0
- package/dist/entries/document.d.ts +1 -0
- package/dist/entries/document.js +69 -0
- package/dist/entries/document.js.map +10 -0
- package/dist/entries/drawer.d.ts +1 -0
- package/dist/entries/drawer.js +20 -0
- package/dist/entries/drawer.js.map +9 -0
- package/dist/entries/dropdown.d.ts +1 -0
- package/dist/entries/dropdown.js +29 -0
- package/dist/entries/dropdown.js.map +9 -0
- package/dist/entries/error-state.d.ts +1 -0
- package/dist/entries/error-state.js +14 -0
- package/dist/entries/error-state.js.map +9 -0
- package/dist/entries/favorite-button.d.ts +1 -0
- package/dist/entries/favorite-button.js +7 -0
- package/dist/entries/favorite-button.js.map +10 -0
- package/dist/entries/font.d.ts +1 -0
- package/dist/entries/font.js +10 -0
- package/dist/entries/font.js.map +9 -0
- package/dist/entries/form-advanced.d.ts +1 -0
- package/dist/entries/form-advanced.js +39 -0
- package/dist/entries/form-advanced.js.map +9 -0
- package/dist/entries/form.d.ts +1 -0
- package/dist/entries/form.js +74 -0
- package/dist/entries/form.js.map +9 -0
- package/dist/entries/heading.d.ts +1 -0
- package/dist/entries/heading.js +8 -0
- package/dist/entries/heading.js.map +9 -0
- package/dist/entries/input.d.ts +1 -0
- package/dist/entries/input.js +11 -0
- package/dist/entries/input.js.map +9 -0
- package/dist/entries/layout.d.ts +4 -0
- package/dist/entries/layout.js +101 -0
- package/dist/entries/layout.js.map +9 -0
- package/dist/entries/lazy-load.d.ts +1 -0
- package/dist/entries/lazy-load.js +9 -0
- package/dist/entries/lazy-load.js.map +9 -0
- package/dist/entries/list.d.ts +1 -0
- package/dist/entries/list.js +13 -0
- package/dist/entries/list.js.map +9 -0
- package/dist/entries/loading.d.ts +1 -0
- package/dist/entries/loading.js +18 -0
- package/dist/entries/loading.js.map +9 -0
- package/dist/entries/menu.d.ts +1 -0
- package/dist/entries/menu.js +17 -0
- package/dist/entries/menu.js.map +9 -0
- package/dist/entries/modal.d.ts +1 -0
- package/dist/entries/modal.js +33 -0
- package/dist/entries/modal.js.map +9 -0
- package/dist/entries/product.d.ts +2 -0
- package/dist/entries/product.js +10 -0
- package/dist/entries/product.js.map +9 -0
- package/dist/entries/select-card.d.ts +1 -0
- package/dist/entries/select-card.js +13 -0
- package/dist/entries/select-card.js.map +9 -0
- package/dist/entries/skeletons.d.ts +1 -0
- package/dist/entries/skeletons.js +35 -0
- package/dist/entries/skeletons.js.map +9 -0
- package/dist/entries/surface.d.ts +1 -0
- package/dist/entries/surface.js +10 -0
- package/dist/entries/surface.js.map +9 -0
- package/dist/entries/table.d.ts +1 -0
- package/dist/entries/table.js +65 -0
- package/dist/entries/table.js.map +9 -0
- package/dist/entries/tabs.d.ts +1 -0
- package/dist/entries/tabs.js +20 -0
- package/dist/entries/tabs.js.map +9 -0
- package/dist/entries/theme-styler.d.ts +1 -0
- package/dist/entries/theme-styler.js +26 -0
- package/dist/entries/theme-styler.js.map +9 -0
- package/dist/entries/toast.d.ts +1 -0
- package/dist/entries/toast.js +13 -0
- package/dist/entries/toast.js.map +9 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.js +19864 -0
- package/dist/index.js.map +92 -0
- package/dist/lib/color/className.d.ts +14 -0
- package/dist/lib/color/config.d.ts +82 -0
- package/dist/lib/color/engine.d.ts +221 -0
- package/dist/lib/color/generator.d.ts +45 -0
- package/dist/lib/color/index.d.ts +5 -0
- package/dist/lib/color/safelist.d.ts +1 -0
- package/dist/lib/color/types.d.ts +12 -0
- package/dist/lib/font/config.d.ts +13 -0
- package/dist/lib/font/engine.d.ts +77 -0
- package/dist/lib/font/index.d.ts +3 -0
- package/dist/lib/font/types.d.ts +27 -0
- package/dist/lib/icon/config.d.ts +37 -0
- package/dist/lib/icon/engine.d.ts +84 -0
- package/dist/lib/icon/index.d.ts +3 -0
- package/dist/lib/icon/presets.d.ts +71 -0
- package/dist/lib/layout/config.d.ts +7 -0
- package/dist/lib/layout/engine.d.ts +224 -0
- package/dist/lib/layout/types.d.ts +151 -0
- package/dist/lib/layout/useActiveBreakpoint.d.ts +14 -0
- package/dist/lib/layout/useBlockDrag.d.ts +47 -0
- package/dist/lib/layout/useSectionDrag.d.ts +30 -0
- package/dist/lib/layout/useSpanResize.d.ts +31 -0
- package/dist/lib/localize/data.d.ts +9 -0
- package/dist/lib/product-utils.d.ts +7 -0
- package/dist/lib/sanitize/sanitizeHtml.d.ts +52 -0
- package/dist/lib/theme/motion.d.ts +27 -0
- package/dist/lib/theme/motion.js +12 -0
- package/dist/lib/theme/motion.js.map +9 -0
- package/dist/lib/theme/types.d.ts +133 -0
- package/dist/lib/useUndoRedo.d.ts +21 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/types/product.d.ts +27 -0
- package/package.json +442 -4
|
@@ -0,0 +1,2546 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "./chunk-x4pk7vxm.js";
|
|
4
|
+
import {
|
|
5
|
+
Button2
|
|
6
|
+
} from "./chunk-kv58555q.js";
|
|
7
|
+
import {
|
|
8
|
+
Icon2
|
|
9
|
+
} from "./chunk-k2b698v5.js";
|
|
10
|
+
import {
|
|
11
|
+
Input2
|
|
12
|
+
} from "./chunk-nhhgsdt3.js";
|
|
13
|
+
import {
|
|
14
|
+
StatusBadge2
|
|
15
|
+
} from "./chunk-dsddmmdk.js";
|
|
16
|
+
import {
|
|
17
|
+
Dropdown2,
|
|
18
|
+
DropdownTrigger2,
|
|
19
|
+
DropdownContent2
|
|
20
|
+
} from "./chunk-vpvnvegz.js";
|
|
21
|
+
import {
|
|
22
|
+
PortalTooltip2,
|
|
23
|
+
SelectGroup2
|
|
24
|
+
} from "./chunk-qmbwp4k7.js";
|
|
25
|
+
import {
|
|
26
|
+
CardContent2,
|
|
27
|
+
Card2
|
|
28
|
+
} from "./chunk-h6k57hyd.js";
|
|
29
|
+
import {
|
|
30
|
+
parseColorToHsl2,
|
|
31
|
+
hslToColorString2
|
|
32
|
+
} from "./chunk-hkx78qgj.js";
|
|
33
|
+
import {
|
|
34
|
+
getColSpanClass2,
|
|
35
|
+
sectionVisibilityClass2
|
|
36
|
+
} from "./chunk-hq57r97c.js";
|
|
37
|
+
|
|
38
|
+
// src/components/blocks/LoginFormBlock.tsx
|
|
39
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
40
|
+
function LoginFormBlock2({ action, title = "Masuk", buttonColor, logoUrl }) {
|
|
41
|
+
return /* @__PURE__ */ jsxDEV("form", {
|
|
42
|
+
action,
|
|
43
|
+
method: "post",
|
|
44
|
+
className: "flex flex-col gap-2 p-3 bg-[var(--color-background)] border border-[color:var(--color-border)] rounded-lg",
|
|
45
|
+
children: [
|
|
46
|
+
logoUrl && /* @__PURE__ */ jsxDEV("img", {
|
|
47
|
+
src: logoUrl,
|
|
48
|
+
alt: "",
|
|
49
|
+
className: "h-8 w-auto self-center object-contain"
|
|
50
|
+
}, undefined, false, undefined, this),
|
|
51
|
+
/* @__PURE__ */ jsxDEV("h3", {
|
|
52
|
+
className: "text-[14px] font-bold text-[color:var(--color-foreground)]",
|
|
53
|
+
children: title
|
|
54
|
+
}, undefined, false, undefined, this),
|
|
55
|
+
/* @__PURE__ */ jsxDEV("input", {
|
|
56
|
+
type: "email",
|
|
57
|
+
name: "email",
|
|
58
|
+
placeholder: "Email",
|
|
59
|
+
className: "rounded border border-[color:var(--color-border)] bg-[var(--color-secondary)] px-3 py-1.5 text-sm"
|
|
60
|
+
}, undefined, false, undefined, this),
|
|
61
|
+
/* @__PURE__ */ jsxDEV("input", {
|
|
62
|
+
type: "password",
|
|
63
|
+
name: "password",
|
|
64
|
+
placeholder: "Password",
|
|
65
|
+
className: "rounded border border-[color:var(--color-border)] bg-[var(--color-secondary)] px-3 py-1.5 text-sm"
|
|
66
|
+
}, undefined, false, undefined, this),
|
|
67
|
+
/* @__PURE__ */ jsxDEV("button", {
|
|
68
|
+
type: "submit",
|
|
69
|
+
style: buttonColor ? { backgroundColor: buttonColor } : undefined,
|
|
70
|
+
className: `mt-1 rounded-md px-3 py-1.5 text-[13px] font-semibold text-[color:var(--color-primary-foreground)] ${buttonColor ? "" : "bg-[var(--color-primary)]"}`,
|
|
71
|
+
children: title
|
|
72
|
+
}, undefined, false, undefined, this)
|
|
73
|
+
]
|
|
74
|
+
}, undefined, true, undefined, this);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/components/blocks/SidebarMenuBlock.tsx
|
|
78
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
79
|
+
var DEFAULT_ITEMS = [
|
|
80
|
+
{ label: "Dashboard", icon: "dashboard", href: "#" },
|
|
81
|
+
{ label: "Pesanan", icon: "document", href: "#" },
|
|
82
|
+
{ label: "Pengaturan", icon: "settings", href: "#" }
|
|
83
|
+
];
|
|
84
|
+
function SidebarMenuBlock2({ items = DEFAULT_ITEMS }) {
|
|
85
|
+
return /* @__PURE__ */ jsxDEV2("nav", {
|
|
86
|
+
className: "flex flex-col gap-1 p-2 bg-[var(--color-background)] border border-[color:var(--color-border)] rounded-lg",
|
|
87
|
+
children: items.map((item) => /* @__PURE__ */ jsxDEV2("a", {
|
|
88
|
+
href: item.href ?? "#",
|
|
89
|
+
className: "flex items-center gap-2 rounded-md px-3 py-2 text-[13px] font-medium text-[color:var(--color-foreground)] hover:bg-[var(--color-secondary)] transition-colors",
|
|
90
|
+
children: [
|
|
91
|
+
item.icon && /* @__PURE__ */ jsxDEV2(Icon2, {
|
|
92
|
+
name: item.icon,
|
|
93
|
+
size: 16
|
|
94
|
+
}, undefined, false, undefined, this),
|
|
95
|
+
item.label
|
|
96
|
+
]
|
|
97
|
+
}, item.label, true, undefined, this))
|
|
98
|
+
}, undefined, false, undefined, this);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/components/blocks/SliderBlock.tsx
|
|
102
|
+
import * as React from "react";
|
|
103
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
104
|
+
var DEFAULT_SLIDES = [
|
|
105
|
+
{ title: "Promo Spesial", description: "Diskon 20% untuk semua produk" },
|
|
106
|
+
{ title: "Produk Terbaru", description: "Cek koleksi terbaru kami" },
|
|
107
|
+
{ title: "Gratis Ongkir", description: "Untuk pembelian di atas Rp100rb" }
|
|
108
|
+
];
|
|
109
|
+
function SliderBlock2({ slides = DEFAULT_SLIDES, intervalMs = 3000 }) {
|
|
110
|
+
const [index, setIndex] = React.useState(0);
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
if (slides.length <= 1)
|
|
113
|
+
return;
|
|
114
|
+
const timer = setInterval(() => setIndex((i) => (i + 1) % slides.length), intervalMs);
|
|
115
|
+
return () => clearInterval(timer);
|
|
116
|
+
}, [slides.length, intervalMs]);
|
|
117
|
+
const slide = slides[index];
|
|
118
|
+
return /* @__PURE__ */ jsxDEV3("div", {
|
|
119
|
+
className: "relative overflow-hidden rounded-lg border border-[color:var(--color-border)] bg-[var(--color-secondary)] p-6 text-center min-h-[120px] flex flex-col items-center justify-center",
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ jsxDEV3("h3", {
|
|
122
|
+
className: "text-[16px] font-bold text-[color:var(--color-foreground)]",
|
|
123
|
+
children: slide.title
|
|
124
|
+
}, undefined, false, undefined, this),
|
|
125
|
+
slide.description && /* @__PURE__ */ jsxDEV3("p", {
|
|
126
|
+
className: "mt-1 text-[13px] text-[color:var(--color-text-color)]",
|
|
127
|
+
children: slide.description
|
|
128
|
+
}, undefined, false, undefined, this),
|
|
129
|
+
slides.length > 1 && /* @__PURE__ */ jsxDEV3("div", {
|
|
130
|
+
className: "mt-4 flex items-center gap-3",
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ jsxDEV3("button", {
|
|
133
|
+
onClick: () => setIndex((i) => (i - 1 + slides.length) % slides.length),
|
|
134
|
+
className: "text-[color:var(--color-text-color)] hover:text-[color:var(--color-foreground)]",
|
|
135
|
+
"aria-label": "Slide sebelumnya",
|
|
136
|
+
children: /* @__PURE__ */ jsxDEV3(Icon2, {
|
|
137
|
+
name: "back",
|
|
138
|
+
size: 16
|
|
139
|
+
}, undefined, false, undefined, this)
|
|
140
|
+
}, undefined, false, undefined, this),
|
|
141
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
142
|
+
className: "flex gap-1.5",
|
|
143
|
+
children: slides.map((s, i) => /* @__PURE__ */ jsxDEV3("span", {
|
|
144
|
+
className: `h-1.5 w-1.5 rounded-full ${i === index ? "bg-[var(--color-primary)]" : "bg-[var(--color-border)]"}`
|
|
145
|
+
}, s.title, false, undefined, this))
|
|
146
|
+
}, undefined, false, undefined, this),
|
|
147
|
+
/* @__PURE__ */ jsxDEV3("button", {
|
|
148
|
+
onClick: () => setIndex((i) => (i + 1) % slides.length),
|
|
149
|
+
className: "text-[color:var(--color-text-color)] hover:text-[color:var(--color-foreground)]",
|
|
150
|
+
"aria-label": "Slide berikutnya",
|
|
151
|
+
children: /* @__PURE__ */ jsxDEV3(Icon2, {
|
|
152
|
+
name: "forward",
|
|
153
|
+
size: 16
|
|
154
|
+
}, undefined, false, undefined, this)
|
|
155
|
+
}, undefined, false, undefined, this)
|
|
156
|
+
]
|
|
157
|
+
}, undefined, true, undefined, this)
|
|
158
|
+
]
|
|
159
|
+
}, undefined, true, undefined, this);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/components/ui/app-shell.tsx
|
|
163
|
+
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
164
|
+
function AppShell2({
|
|
165
|
+
variant = "standard",
|
|
166
|
+
theme = "auto",
|
|
167
|
+
sidebarOpen = true,
|
|
168
|
+
onSidebarToggle,
|
|
169
|
+
isMobile = false,
|
|
170
|
+
onMobileClose,
|
|
171
|
+
hideSidebar = false,
|
|
172
|
+
sidebarLogo,
|
|
173
|
+
sidebarNav,
|
|
174
|
+
sidebarFooter,
|
|
175
|
+
sidebarLogoBorder = true,
|
|
176
|
+
sidebarFooterBorder = true,
|
|
177
|
+
headerClassName,
|
|
178
|
+
headerContent,
|
|
179
|
+
headerRightContent,
|
|
180
|
+
mainFooter,
|
|
181
|
+
headerSticky = true,
|
|
182
|
+
footerSticky = false,
|
|
183
|
+
children,
|
|
184
|
+
className,
|
|
185
|
+
...props
|
|
186
|
+
}) {
|
|
187
|
+
const sidebarWidth = sidebarOpen ? "w-[240px]" : "w-[68px]";
|
|
188
|
+
let sidebarBaseClasses = "";
|
|
189
|
+
let layoutBaseClasses = "flex h-screen w-full bg-background text-foreground transition-colors overflow-hidden";
|
|
190
|
+
if (theme === "dark")
|
|
191
|
+
layoutBaseClasses += " dark";
|
|
192
|
+
if (theme === "light")
|
|
193
|
+
layoutBaseClasses += " light";
|
|
194
|
+
let contentWrapperClasses = "flex flex-1 flex-col overflow-hidden";
|
|
195
|
+
const sidebarBgClass = "bg-[color:var(--color-sidebar)]";
|
|
196
|
+
if (variant === "standard") {
|
|
197
|
+
sidebarBaseClasses = `border-r border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] transition-[width] duration-150 ${sidebarBgClass}`;
|
|
198
|
+
} else if (variant === "rtl") {
|
|
199
|
+
sidebarBaseClasses = `border-l border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] transition-[width] duration-150 ${sidebarBgClass}`;
|
|
200
|
+
} else if (variant === "rounded") {
|
|
201
|
+
sidebarBaseClasses = `transition-[width] duration-150 border-r border-transparent ${sidebarBgClass}`;
|
|
202
|
+
layoutBaseClasses = layoutBaseClasses.replace("bg-background", sidebarBgClass);
|
|
203
|
+
contentWrapperClasses = "flex flex-1 flex-col overflow-hidden bg-[color:var(--color-background)] text-[color:var(--color-foreground)] rounded-2xl border border-[color:var(--color-border)] shadow-sm m-2";
|
|
204
|
+
} else if (variant === "floating") {
|
|
205
|
+
sidebarBaseClasses = `rounded-xl shadow-sm transition-all duration-150 m-3 ${sidebarBgClass} border border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)]`;
|
|
206
|
+
contentWrapperClasses = "flex flex-1 flex-col overflow-hidden bg-[color:var(--color-background)] text-[color:var(--color-foreground)] rounded-2xl border border-[color:var(--color-border)] shadow-sm m-3";
|
|
207
|
+
}
|
|
208
|
+
if (isMobile) {
|
|
209
|
+
sidebarBaseClasses += ` absolute inset-y-0 ${variant === "rtl" ? "right-0" : "left-0"} z-50 shadow-xl`;
|
|
210
|
+
sidebarBaseClasses += sidebarOpen ? " w-[240px]" : variant === "rtl" ? " w-0 translate-x-full" : " w-0 -translate-x-full";
|
|
211
|
+
} else {
|
|
212
|
+
sidebarBaseClasses += ` flex flex-none flex-col overflow-hidden text-sidebar-foreground ${sidebarWidth}`;
|
|
213
|
+
}
|
|
214
|
+
return /* @__PURE__ */ jsxDEV4("div", {
|
|
215
|
+
className: cn2(layoutBaseClasses, theme === "dark" ? "deweb-dark-scope" : "", className),
|
|
216
|
+
dir: variant === "rtl" ? "rtl" : undefined,
|
|
217
|
+
...props,
|
|
218
|
+
children: [
|
|
219
|
+
isMobile && sidebarOpen && /* @__PURE__ */ jsxDEV4("div", {
|
|
220
|
+
className: "fixed inset-0 z-40 bg-zinc-950/20 backdrop-blur-sm transition-opacity",
|
|
221
|
+
onClick: onMobileClose
|
|
222
|
+
}, undefined, false, undefined, this),
|
|
223
|
+
!hideSidebar && /* @__PURE__ */ jsxDEV4("aside", {
|
|
224
|
+
className: cn2(sidebarBaseClasses, "relative flex flex-none flex-col overflow-hidden text-sidebar-foreground"),
|
|
225
|
+
style: theme === "dark" ? { "--color-sidebar-foreground": "#ffffff" } : undefined,
|
|
226
|
+
children: [
|
|
227
|
+
sidebarLogo && /* @__PURE__ */ jsxDEV4("div", {
|
|
228
|
+
className: cn2("relative z-10 flex flex-none items-center overflow-hidden whitespace-nowrap", variant === "rounded" ? "h-[72px] pt-2" : "h-16", sidebarOpen ? "gap-2.5 px-2.5" : "justify-center px-2.5", sidebarLogoBorder && "border-b border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)]"),
|
|
229
|
+
children: sidebarLogo
|
|
230
|
+
}, undefined, false, undefined, this),
|
|
231
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
232
|
+
className: "relative z-10 flex-1 min-h-0 overflow-y-auto overflow-x-hidden flex flex-col hide-scrollbar [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
233
|
+
children: sidebarNav
|
|
234
|
+
}, undefined, false, undefined, this),
|
|
235
|
+
sidebarFooter && /* @__PURE__ */ jsxDEV4("div", {
|
|
236
|
+
className: cn2("relative z-10 flex-none overflow-hidden whitespace-nowrap", sidebarFooterBorder && "border-t border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)]", variant === "rounded" ? "pb-2" : ""),
|
|
237
|
+
children: sidebarFooter
|
|
238
|
+
}, undefined, false, undefined, this)
|
|
239
|
+
]
|
|
240
|
+
}, undefined, true, undefined, this),
|
|
241
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
242
|
+
className: contentWrapperClasses,
|
|
243
|
+
children: [
|
|
244
|
+
headerSticky && /* @__PURE__ */ jsxDEV4("header", {
|
|
245
|
+
className: cn2("flex h-16 flex-none items-center justify-between border-b border-[color:var(--color-border)] bg-[var(--color-background)] px-6", headerClassName),
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
248
|
+
className: "flex items-center gap-3.5",
|
|
249
|
+
children: headerContent
|
|
250
|
+
}, undefined, false, undefined, this),
|
|
251
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
252
|
+
className: "flex items-center gap-2.5",
|
|
253
|
+
children: headerRightContent
|
|
254
|
+
}, undefined, false, undefined, this)
|
|
255
|
+
]
|
|
256
|
+
}, undefined, true, undefined, this),
|
|
257
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
258
|
+
id: "deweb-app-shell-scroll",
|
|
259
|
+
className: "flex-1 overflow-x-hidden overflow-y-auto flex flex-col [scrollbar-gutter:stable]",
|
|
260
|
+
children: [
|
|
261
|
+
!headerSticky && /* @__PURE__ */ jsxDEV4("header", {
|
|
262
|
+
className: cn2("flex h-16 flex-none items-center justify-between border-b border-[color:var(--color-border)] bg-[var(--color-background)] px-6", headerClassName),
|
|
263
|
+
children: [
|
|
264
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
265
|
+
className: "flex items-center gap-3.5",
|
|
266
|
+
children: headerContent
|
|
267
|
+
}, undefined, false, undefined, this),
|
|
268
|
+
/* @__PURE__ */ jsxDEV4("div", {
|
|
269
|
+
className: "flex items-center gap-2.5",
|
|
270
|
+
children: headerRightContent
|
|
271
|
+
}, undefined, false, undefined, this)
|
|
272
|
+
]
|
|
273
|
+
}, undefined, true, undefined, this),
|
|
274
|
+
/* @__PURE__ */ jsxDEV4("main", {
|
|
275
|
+
className: "flex-1 flex flex-col",
|
|
276
|
+
children
|
|
277
|
+
}, undefined, false, undefined, this),
|
|
278
|
+
!footerSticky && mainFooter && /* @__PURE__ */ jsxDEV4("footer", {
|
|
279
|
+
className: "flex-none border-t border-[color:var(--color-border)] bg-[var(--color-background)]",
|
|
280
|
+
children: mainFooter
|
|
281
|
+
}, undefined, false, undefined, this)
|
|
282
|
+
]
|
|
283
|
+
}, undefined, true, undefined, this),
|
|
284
|
+
footerSticky && mainFooter && /* @__PURE__ */ jsxDEV4("footer", {
|
|
285
|
+
className: "flex-none border-t border-[color:var(--color-border)] bg-[var(--color-background)]",
|
|
286
|
+
children: mainFooter
|
|
287
|
+
}, undefined, false, undefined, this)
|
|
288
|
+
]
|
|
289
|
+
}, undefined, true, undefined, this)
|
|
290
|
+
]
|
|
291
|
+
}, undefined, true, undefined, this);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/components/ui/avatar.tsx
|
|
295
|
+
import * as React3 from "react";
|
|
296
|
+
|
|
297
|
+
// src/components/ui/initial-icon.tsx
|
|
298
|
+
import * as React2 from "react";
|
|
299
|
+
import { cva } from "class-variance-authority";
|
|
300
|
+
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
301
|
+
var initialIconVariants = cva("inline-flex flex-shrink-0 items-center justify-center rounded-full", {
|
|
302
|
+
variants: {
|
|
303
|
+
color: {
|
|
304
|
+
primary: "bg-[var(--color-primary)] text-[color:var(--color-primary-foreground)]",
|
|
305
|
+
secondary: "bg-[var(--color-secondary)] text-[color:var(--color-secondary-foreground)]",
|
|
306
|
+
muted: "bg-[var(--color-muted)] text-[color:var(--color-text-color)]",
|
|
307
|
+
accent: "bg-[var(--color-accent)] text-[color:var(--color-accent-foreground)]",
|
|
308
|
+
success: "bg-[var(--color-success)] text-[color:var(--color-success-foreground)]",
|
|
309
|
+
danger: "bg-[var(--color-danger)] text-[color:var(--color-danger-foreground)]",
|
|
310
|
+
warning: "bg-[var(--color-warning)] text-[color:var(--color-warning-foreground)]",
|
|
311
|
+
info: "bg-[var(--color-info)] text-[color:var(--color-info-foreground)]"
|
|
312
|
+
},
|
|
313
|
+
size: {
|
|
314
|
+
xs: "h-5 w-5 text-[8px] font-bold",
|
|
315
|
+
sm: "h-6 w-6 text-[9px] font-bold",
|
|
316
|
+
md: "h-8 w-8 text-[11px] font-bold",
|
|
317
|
+
default: "h-8 w-8 text-[11px] font-bold",
|
|
318
|
+
lg: "h-10 w-10 text-[13px] font-bold",
|
|
319
|
+
xl: "h-16 w-16 text-xl font-semibold",
|
|
320
|
+
"2xl": "h-20 w-20 text-2xl font-semibold"
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
defaultVariants: {
|
|
324
|
+
color: "secondary",
|
|
325
|
+
size: "md"
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
var InitialIcon2 = React2.forwardRef(({ className, variant, color, size, initials, ...props }, ref) => {
|
|
329
|
+
let finalColor = color;
|
|
330
|
+
if (variant === "primary" || variant === "secondary") {
|
|
331
|
+
finalColor = variant;
|
|
332
|
+
}
|
|
333
|
+
let finalSize = size;
|
|
334
|
+
if (size === "default")
|
|
335
|
+
finalSize = "md";
|
|
336
|
+
return /* @__PURE__ */ jsxDEV5("div", {
|
|
337
|
+
className: cn2(initialIconVariants({ color: finalColor, size: finalSize, className })),
|
|
338
|
+
ref,
|
|
339
|
+
...props,
|
|
340
|
+
children: initials
|
|
341
|
+
}, undefined, false, undefined, this);
|
|
342
|
+
});
|
|
343
|
+
InitialIcon2.displayName = "InitialIcon";
|
|
344
|
+
|
|
345
|
+
// src/components/ui/avatar.tsx
|
|
346
|
+
import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
|
|
347
|
+
var Avatar2 = React3.forwardRef(({ src, alt, initials, size = "md", fallbackIcon = "user", className = "", ...props }, ref) => {
|
|
348
|
+
const [error, setError] = React3.useState(false);
|
|
349
|
+
const finalSize = size === "default" ? "md" : size;
|
|
350
|
+
const sizeMap = {
|
|
351
|
+
xs: "h-5 w-5",
|
|
352
|
+
sm: "h-6 w-6",
|
|
353
|
+
md: "h-8 w-8",
|
|
354
|
+
lg: "h-10 w-10",
|
|
355
|
+
xl: "h-16 w-16",
|
|
356
|
+
"2xl": "h-20 w-20"
|
|
357
|
+
};
|
|
358
|
+
const iconSizeMap = {
|
|
359
|
+
xs: 12,
|
|
360
|
+
sm: 16,
|
|
361
|
+
md: 16,
|
|
362
|
+
lg: 20,
|
|
363
|
+
xl: 24,
|
|
364
|
+
"2xl": 32
|
|
365
|
+
};
|
|
366
|
+
const s = sizeMap[finalSize] || sizeMap["md"];
|
|
367
|
+
const iconSize = iconSizeMap[finalSize] || iconSizeMap["md"];
|
|
368
|
+
if (src && !error) {
|
|
369
|
+
return /* @__PURE__ */ jsxDEV6("div", {
|
|
370
|
+
ref,
|
|
371
|
+
className: cn2(`inline-flex flex-shrink-0 items-center justify-center rounded-full overflow-hidden ${s}`, className),
|
|
372
|
+
...props,
|
|
373
|
+
children: /* @__PURE__ */ jsxDEV6("img", {
|
|
374
|
+
src,
|
|
375
|
+
alt,
|
|
376
|
+
onError: () => setError(true),
|
|
377
|
+
className: "h-full w-full object-cover"
|
|
378
|
+
}, undefined, false, undefined, this)
|
|
379
|
+
}, undefined, false, undefined, this);
|
|
380
|
+
}
|
|
381
|
+
if (initials) {
|
|
382
|
+
return /* @__PURE__ */ jsxDEV6(InitialIcon2, {
|
|
383
|
+
ref,
|
|
384
|
+
initials,
|
|
385
|
+
size: finalSize,
|
|
386
|
+
className,
|
|
387
|
+
...props
|
|
388
|
+
}, undefined, false, undefined, this);
|
|
389
|
+
}
|
|
390
|
+
return /* @__PURE__ */ jsxDEV6("div", {
|
|
391
|
+
ref,
|
|
392
|
+
className: cn2(`inline-flex flex-shrink-0 items-center justify-center rounded-full bg-[var(--color-secondary)] text-[color:var(--color-secondary-foreground)] ${s}`, className),
|
|
393
|
+
...props,
|
|
394
|
+
children: /* @__PURE__ */ jsxDEV6(Icon2, {
|
|
395
|
+
name: fallbackIcon,
|
|
396
|
+
size: iconSize
|
|
397
|
+
}, undefined, false, undefined, this)
|
|
398
|
+
}, undefined, false, undefined, this);
|
|
399
|
+
});
|
|
400
|
+
Avatar2.displayName = "Avatar";
|
|
401
|
+
var AvatarStack2 = React3.forwardRef(({ limit = 3, size = "md", className, children, ...props }, ref) => {
|
|
402
|
+
const validChildren = React3.Children.toArray(children).filter(React3.isValidElement);
|
|
403
|
+
const visibleAvatars = validChildren.slice(0, limit);
|
|
404
|
+
const extraCount = validChildren.length - limit;
|
|
405
|
+
const sizeMap = {
|
|
406
|
+
xs: "h-5 w-5 text-[9px]",
|
|
407
|
+
sm: "h-6 w-6 text-[10px]",
|
|
408
|
+
md: "h-8 w-8 text-xs",
|
|
409
|
+
lg: "h-10 w-10 text-sm",
|
|
410
|
+
xl: "h-16 w-16 text-base",
|
|
411
|
+
"2xl": "h-20 w-20 text-lg"
|
|
412
|
+
};
|
|
413
|
+
const finalSize = size === "default" ? "md" : size;
|
|
414
|
+
const s = sizeMap[finalSize] || sizeMap["md"];
|
|
415
|
+
const overlapMap = {
|
|
416
|
+
xs: "-space-x-1",
|
|
417
|
+
sm: "-space-x-1.5",
|
|
418
|
+
md: "-space-x-2",
|
|
419
|
+
lg: "-space-x-2.5",
|
|
420
|
+
xl: "-space-x-3.5",
|
|
421
|
+
"2xl": "-space-x-4"
|
|
422
|
+
};
|
|
423
|
+
const overlap = overlapMap[finalSize] || "-space-x-2";
|
|
424
|
+
return /* @__PURE__ */ jsxDEV6("div", {
|
|
425
|
+
ref,
|
|
426
|
+
className: cn2("flex items-center", overlap, className),
|
|
427
|
+
...props,
|
|
428
|
+
children: [
|
|
429
|
+
visibleAvatars.map((child, index) => {
|
|
430
|
+
const element = child;
|
|
431
|
+
return React3.cloneElement(element, {
|
|
432
|
+
size: element.props.size || size,
|
|
433
|
+
className: cn2("ring-2 ring-background border-none relative", element.props.className),
|
|
434
|
+
style: { ...element.props.style, zIndex: validChildren.length - index }
|
|
435
|
+
});
|
|
436
|
+
}),
|
|
437
|
+
extraCount > 0 && /* @__PURE__ */ jsxDEV6("div", {
|
|
438
|
+
className: cn2("flex items-center justify-center rounded-full ring-2 ring-background bg-[var(--color-secondary)] text-[color:var(--color-secondary-foreground)] font-medium z-0", s),
|
|
439
|
+
children: [
|
|
440
|
+
"+",
|
|
441
|
+
extraCount
|
|
442
|
+
]
|
|
443
|
+
}, undefined, true, undefined, this)
|
|
444
|
+
]
|
|
445
|
+
}, undefined, true, undefined, this);
|
|
446
|
+
});
|
|
447
|
+
AvatarStack2.displayName = "AvatarStack";
|
|
448
|
+
|
|
449
|
+
// src/components/ui/control-group.tsx
|
|
450
|
+
import * as React4 from "react";
|
|
451
|
+
import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
|
|
452
|
+
var ControlGroup2 = React4.forwardRef(({
|
|
453
|
+
children,
|
|
454
|
+
size = "md",
|
|
455
|
+
radius = "md",
|
|
456
|
+
variant = "default",
|
|
457
|
+
width,
|
|
458
|
+
fullWidth = false,
|
|
459
|
+
layout = "flex",
|
|
460
|
+
cols = 2,
|
|
461
|
+
justify = "start",
|
|
462
|
+
gap = "xs",
|
|
463
|
+
className = "",
|
|
464
|
+
...props
|
|
465
|
+
}, ref) => {
|
|
466
|
+
const sizeClasses = {
|
|
467
|
+
xs: "h-[24px] px-1.5 py-0.5 text-xs",
|
|
468
|
+
sm: "h-[30px] px-2 py-0.5 text-xs",
|
|
469
|
+
md: "h-[36px] px-2.5 py-1 text-xs",
|
|
470
|
+
lg: "h-[42px] px-3 py-1.5 text-sm",
|
|
471
|
+
auto: "h-auto py-1 px-2.5 text-xs"
|
|
472
|
+
}[size];
|
|
473
|
+
const radiusMap = {
|
|
474
|
+
none: "rounded-none",
|
|
475
|
+
sm: "rounded-sm",
|
|
476
|
+
md: "rounded-md",
|
|
477
|
+
lg: "rounded-lg",
|
|
478
|
+
full: "rounded-full"
|
|
479
|
+
};
|
|
480
|
+
const radiusClass = radius ? radiusMap[radius] : "rounded-md";
|
|
481
|
+
const gapMap = {
|
|
482
|
+
none: "gap-0",
|
|
483
|
+
xs: "gap-1",
|
|
484
|
+
sm: "gap-1.5",
|
|
485
|
+
md: "gap-2",
|
|
486
|
+
lg: "gap-3"
|
|
487
|
+
}[gap];
|
|
488
|
+
const justifyMap = {
|
|
489
|
+
start: "justify-start",
|
|
490
|
+
center: "justify-center",
|
|
491
|
+
between: "justify-between",
|
|
492
|
+
end: "justify-end"
|
|
493
|
+
}[justify];
|
|
494
|
+
const isFull = fullWidth || width === "full" || layout === "between";
|
|
495
|
+
const isAuto = width === "auto";
|
|
496
|
+
const widthClass = isFull ? "w-full" : isAuto ? "w-auto" : "w-fit";
|
|
497
|
+
const gridColsMap = {
|
|
498
|
+
1: "grid-cols-1",
|
|
499
|
+
2: "grid-cols-2",
|
|
500
|
+
3: "grid-cols-3",
|
|
501
|
+
4: "grid-cols-4",
|
|
502
|
+
5: "grid-cols-5",
|
|
503
|
+
6: "grid-cols-6",
|
|
504
|
+
12: "grid-cols-12"
|
|
505
|
+
};
|
|
506
|
+
let layoutClasses = "";
|
|
507
|
+
if (layout === "grid") {
|
|
508
|
+
layoutClasses = cn2("grid items-center", gridColsMap[cols] || "grid-cols-2", widthClass);
|
|
509
|
+
} else if (layout === "between") {
|
|
510
|
+
layoutClasses = cn2("flex items-center justify-between w-full");
|
|
511
|
+
} else {
|
|
512
|
+
layoutClasses = cn2("items-center", isFull ? "flex w-full" : "inline-flex", widthClass, justifyMap);
|
|
513
|
+
}
|
|
514
|
+
const variantStyles = {
|
|
515
|
+
default: "bg-[var(--color-input)] [border-width:var(--ui-border-width,1px)] border-solid [border-color:var(--ui-border-input,color-mix(in_srgb,var(--color-foreground)_20%,transparent))] text-[color:var(--color-foreground)]",
|
|
516
|
+
card: "bg-card border border-border shadow-xs text-foreground",
|
|
517
|
+
soft: "bg-muted/40 border border-border/40 text-foreground",
|
|
518
|
+
ghost: "bg-transparent border-transparent text-foreground"
|
|
519
|
+
}[variant];
|
|
520
|
+
return /* @__PURE__ */ jsxDEV7("div", {
|
|
521
|
+
ref,
|
|
522
|
+
className: cn2("relative overflow-hidden transition-all duration-200 select-none max-w-full", layoutClasses, sizeClasses, radiusClass, gapMap, variantStyles, className),
|
|
523
|
+
...props,
|
|
524
|
+
children
|
|
525
|
+
}, undefined, false, undefined, this);
|
|
526
|
+
});
|
|
527
|
+
ControlGroup2.displayName = "ControlGroup";
|
|
528
|
+
|
|
529
|
+
// src/components/ui/dashboard-grid/DashboardDropSlot.tsx
|
|
530
|
+
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
531
|
+
function DashboardDropSlot2({ span, height, label }) {
|
|
532
|
+
return /* @__PURE__ */ jsxDEV8("div", {
|
|
533
|
+
"data-drop-slot": "true",
|
|
534
|
+
style: {
|
|
535
|
+
gridColumn: `span ${span}`,
|
|
536
|
+
minHeight: height,
|
|
537
|
+
backgroundImage: "repeating-linear-gradient(135deg, #fafafa, #fafafa 10px, #f4f4f5 10px, #f4f4f5 20px)"
|
|
538
|
+
},
|
|
539
|
+
className: "flex items-center justify-center rounded-xl border-2 border-dashed border-zinc-300",
|
|
540
|
+
children: /* @__PURE__ */ jsxDEV8("span", {
|
|
541
|
+
className: "text-[12px] font-semibold text-[color:var(--color-text-color)]",
|
|
542
|
+
children: label
|
|
543
|
+
}, undefined, false, undefined, this)
|
|
544
|
+
}, undefined, false, undefined, this);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// src/components/ui/dashboard-grid/DashboardGrid.tsx
|
|
548
|
+
import * as React5 from "react";
|
|
549
|
+
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
550
|
+
var DashboardGrid2 = React5.forwardRef(({ className = "", children, ...props }, ref) => {
|
|
551
|
+
return /* @__PURE__ */ jsxDEV9("div", {
|
|
552
|
+
ref,
|
|
553
|
+
className: `grid grid-cols-1 gap-4 lg:grid-cols-4 ${className}`,
|
|
554
|
+
...props,
|
|
555
|
+
children
|
|
556
|
+
}, undefined, false, undefined, this);
|
|
557
|
+
});
|
|
558
|
+
DashboardGrid2.displayName = "DashboardGrid";
|
|
559
|
+
|
|
560
|
+
// src/components/ui/dashboard-grid/DashboardWidgetCard.tsx
|
|
561
|
+
import * as React6 from "react";
|
|
562
|
+
import { GripVertical, X } from "lucide-react";
|
|
563
|
+
import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
|
|
564
|
+
var DashboardWidgetCard2 = React6.memo(function DashboardWidgetCard({
|
|
565
|
+
id,
|
|
566
|
+
label,
|
|
567
|
+
colSpan,
|
|
568
|
+
isDragging,
|
|
569
|
+
isResizing,
|
|
570
|
+
isDropping,
|
|
571
|
+
isJustDropped,
|
|
572
|
+
dragPos,
|
|
573
|
+
resizeInfo,
|
|
574
|
+
onDragStart,
|
|
575
|
+
onResizeStart,
|
|
576
|
+
onRemove,
|
|
577
|
+
children
|
|
578
|
+
}) {
|
|
579
|
+
const floating = isDragging || isResizing;
|
|
580
|
+
const style = {
|
|
581
|
+
gridColumn: floating ? undefined : `span ${colSpan}`,
|
|
582
|
+
position: floating ? "fixed" : "relative",
|
|
583
|
+
left: isResizing && resizeInfo ? resizeInfo.left : isDragging && dragPos ? dragPos.x - dragPos.offsetX : "auto",
|
|
584
|
+
top: isResizing && resizeInfo ? resizeInfo.top : isDragging && dragPos ? dragPos.y - dragPos.offsetY : "auto",
|
|
585
|
+
width: isResizing && resizeInfo ? resizeInfo.liveWidth : isDragging && dragPos ? dragPos.width : "auto",
|
|
586
|
+
height: isResizing && resizeInfo ? resizeInfo.height : "auto",
|
|
587
|
+
zIndex: floating ? 100 : "auto",
|
|
588
|
+
transform: isDragging && !isDropping ? "scale(1.03)" : "scale(1)",
|
|
589
|
+
transformOrigin: "left center",
|
|
590
|
+
boxShadow: floating ? "0 22px 48px rgba(24,24,27,0.20)" : undefined,
|
|
591
|
+
pointerEvents: floating ? "none" : "auto",
|
|
592
|
+
transition: isDragging ? isDropping ? "left 240ms cubic-bezier(0.4,0,0.2,1), top 240ms cubic-bezier(0.4,0,0.2,1), transform 240ms cubic-bezier(0.4,0,0.2,1), box-shadow 240ms ease" : "transform 160ms ease, box-shadow 160ms ease" : isResizing ? "box-shadow 160ms ease" : "opacity 120ms ease",
|
|
593
|
+
animation: isJustDropped ? "dropSettle 300ms cubic-bezier(0.34, 1.56, 0.64, 1)" : undefined
|
|
594
|
+
};
|
|
595
|
+
return /* @__PURE__ */ jsxDEV10("div", {
|
|
596
|
+
"data-widget-id": id,
|
|
597
|
+
style,
|
|
598
|
+
className: "box-border rounded-xl border border-border bg-card shadow-sm",
|
|
599
|
+
children: [
|
|
600
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
601
|
+
className: "flex items-center justify-between px-3.5 pb-1 pt-3",
|
|
602
|
+
children: [
|
|
603
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
604
|
+
onPointerDown: onDragStart,
|
|
605
|
+
style: { touchAction: "none" },
|
|
606
|
+
className: "flex cursor-grab items-center gap-2 text-text-color active:cursor-grabbing",
|
|
607
|
+
title: "Tarik untuk mengatur ulang urutan",
|
|
608
|
+
children: [
|
|
609
|
+
/* @__PURE__ */ jsxDEV10(GripVertical, {
|
|
610
|
+
size: 13
|
|
611
|
+
}, undefined, false, undefined, this),
|
|
612
|
+
/* @__PURE__ */ jsxDEV10("span", {
|
|
613
|
+
className: "text-[11px] font-bold uppercase tracking-wide",
|
|
614
|
+
children: label
|
|
615
|
+
}, undefined, false, undefined, this)
|
|
616
|
+
]
|
|
617
|
+
}, undefined, true, undefined, this),
|
|
618
|
+
/* @__PURE__ */ jsxDEV10(Button2, {
|
|
619
|
+
variant: "ghost",
|
|
620
|
+
size: "icon-sm",
|
|
621
|
+
onClick: onRemove,
|
|
622
|
+
title: "Hapus widget",
|
|
623
|
+
children: /* @__PURE__ */ jsxDEV10(X, {
|
|
624
|
+
size: 13
|
|
625
|
+
}, undefined, false, undefined, this)
|
|
626
|
+
}, undefined, false, undefined, this)
|
|
627
|
+
]
|
|
628
|
+
}, undefined, true, undefined, this),
|
|
629
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
630
|
+
className: "px-4.5 pb-5 pt-2.5",
|
|
631
|
+
children
|
|
632
|
+
}, undefined, false, undefined, this),
|
|
633
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
634
|
+
onPointerDown: onResizeStart,
|
|
635
|
+
style: { touchAction: "none" },
|
|
636
|
+
title: "Tarik untuk ubah lebar",
|
|
637
|
+
className: "group absolute bottom-0 right-[-8px] top-0 z-[5] flex w-4 cursor-col-resize items-center justify-center",
|
|
638
|
+
children: /* @__PURE__ */ jsxDEV10("div", {
|
|
639
|
+
className: `h-9 w-1 rounded-full transition-colors ${isResizing ? "bg-zinc-900" : "bg-border group-hover:bg-zinc-500"}`
|
|
640
|
+
}, undefined, false, undefined, this)
|
|
641
|
+
}, undefined, false, undefined, this)
|
|
642
|
+
]
|
|
643
|
+
}, undefined, true, undefined, this);
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
// src/components/ui/dashboard-grid/useDashboardDnd.ts
|
|
647
|
+
import * as React7 from "react";
|
|
648
|
+
var GRID_GAP = 16;
|
|
649
|
+
var INITIAL_DRAG = {
|
|
650
|
+
draggingId: null,
|
|
651
|
+
dragOffsetX: 0,
|
|
652
|
+
dragOffsetY: 0,
|
|
653
|
+
dragX: 0,
|
|
654
|
+
dragY: 0,
|
|
655
|
+
dragWidth: 0,
|
|
656
|
+
dragHeight: 0,
|
|
657
|
+
dropping: false
|
|
658
|
+
};
|
|
659
|
+
var INITIAL_RESIZE = {
|
|
660
|
+
resizingId: null,
|
|
661
|
+
resizeStartX: 0,
|
|
662
|
+
resizeStartSpan: 1,
|
|
663
|
+
resizeStartWidth: 0,
|
|
664
|
+
resizeStartLeft: 0,
|
|
665
|
+
resizeStartTop: 0,
|
|
666
|
+
resizeHeight: 0,
|
|
667
|
+
resizeLiveWidth: 0,
|
|
668
|
+
resizeEstSpan: 1
|
|
669
|
+
};
|
|
670
|
+
function useDashboardDnd2(items, setItems, onPersist) {
|
|
671
|
+
const gridRef = React7.useRef(null);
|
|
672
|
+
const [drag, setDragState] = React7.useState(INITIAL_DRAG);
|
|
673
|
+
const [resize, setResizeState] = React7.useState(INITIAL_RESIZE);
|
|
674
|
+
const [justDroppedId, setJustDroppedId] = React7.useState(null);
|
|
675
|
+
const dropTimerRef = React7.useRef(null);
|
|
676
|
+
const dropTimer2Ref = React7.useRef(null);
|
|
677
|
+
const dragRef = React7.useRef(drag);
|
|
678
|
+
const resizeRef = React7.useRef(resize);
|
|
679
|
+
const itemsRef = React7.useRef(items);
|
|
680
|
+
dragRef.current = drag;
|
|
681
|
+
resizeRef.current = resize;
|
|
682
|
+
itemsRef.current = items;
|
|
683
|
+
function setDrag(next) {
|
|
684
|
+
setDragState((s) => {
|
|
685
|
+
const value = typeof next === "function" ? next(s) : next;
|
|
686
|
+
dragRef.current = value;
|
|
687
|
+
return value;
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
function setResize(next) {
|
|
691
|
+
setResizeState((s) => {
|
|
692
|
+
const value = typeof next === "function" ? next(s) : next;
|
|
693
|
+
resizeRef.current = value;
|
|
694
|
+
return value;
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
const rectsBeforeRef = React7.useRef(null);
|
|
698
|
+
function snapshotRects() {
|
|
699
|
+
if (!gridRef.current)
|
|
700
|
+
return null;
|
|
701
|
+
const rects = {};
|
|
702
|
+
gridRef.current.querySelectorAll("[data-widget-id]").forEach((el) => {
|
|
703
|
+
const id = el.getAttribute("data-widget-id");
|
|
704
|
+
if (id)
|
|
705
|
+
rects[id] = el.getBoundingClientRect();
|
|
706
|
+
});
|
|
707
|
+
return rects;
|
|
708
|
+
}
|
|
709
|
+
function playFlip(excludeId) {
|
|
710
|
+
const before = rectsBeforeRef.current;
|
|
711
|
+
if (!before || !gridRef.current)
|
|
712
|
+
return;
|
|
713
|
+
gridRef.current.querySelectorAll("[data-widget-id]").forEach((el) => {
|
|
714
|
+
const id = el.getAttribute("data-widget-id");
|
|
715
|
+
if (!id || id === excludeId)
|
|
716
|
+
return;
|
|
717
|
+
const oldRect = before[id];
|
|
718
|
+
if (!oldRect)
|
|
719
|
+
return;
|
|
720
|
+
const newRect = el.getBoundingClientRect();
|
|
721
|
+
const dx = oldRect.left - newRect.left;
|
|
722
|
+
const dy = oldRect.top - newRect.top;
|
|
723
|
+
const dw = oldRect.width - newRect.width;
|
|
724
|
+
if (Math.abs(dx) < 0.5 && Math.abs(dy) < 0.5 && Math.abs(dw) < 0.5)
|
|
725
|
+
return;
|
|
726
|
+
el.style.transition = "none";
|
|
727
|
+
el.style.transform = `translate(${dx}px, ${dy}px)`;
|
|
728
|
+
if (Math.abs(dw) > 0.5)
|
|
729
|
+
el.style.width = `${oldRect.width}px`;
|
|
730
|
+
el.getBoundingClientRect();
|
|
731
|
+
requestAnimationFrame(() => {
|
|
732
|
+
el.style.transition = "transform 340ms cubic-bezier(0.34, 1.55, 0.5, 1), width 340ms cubic-bezier(0.34, 1.55, 0.5, 1)";
|
|
733
|
+
el.style.transform = "";
|
|
734
|
+
el.style.width = "";
|
|
735
|
+
});
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
function gridMetrics() {
|
|
739
|
+
const grid = gridRef.current;
|
|
740
|
+
if (!grid)
|
|
741
|
+
return null;
|
|
742
|
+
const rect = grid.getBoundingClientRect();
|
|
743
|
+
const colWidth = (rect.width - GRID_GAP * 3) / 4;
|
|
744
|
+
return { gridWidth: rect.width, colWidth };
|
|
745
|
+
}
|
|
746
|
+
const startDrag = (id) => (e) => {
|
|
747
|
+
e.preventDefault();
|
|
748
|
+
const wrapper = e.currentTarget.closest("[data-widget-id]");
|
|
749
|
+
const rect = wrapper ? wrapper.getBoundingClientRect() : { left: e.clientX, top: e.clientY, width: 300, height: 200 };
|
|
750
|
+
document.body.style.cursor = "grabbing";
|
|
751
|
+
document.body.style.userSelect = "none";
|
|
752
|
+
setDrag({
|
|
753
|
+
draggingId: id,
|
|
754
|
+
dragOffsetX: e.clientX - rect.left,
|
|
755
|
+
dragOffsetY: e.clientY - rect.top,
|
|
756
|
+
dragX: e.clientX,
|
|
757
|
+
dragY: e.clientY,
|
|
758
|
+
dragWidth: rect.width,
|
|
759
|
+
dragHeight: rect.height,
|
|
760
|
+
dropping: false
|
|
761
|
+
});
|
|
762
|
+
setJustDroppedId(null);
|
|
763
|
+
};
|
|
764
|
+
const startResize = (id) => (e) => {
|
|
765
|
+
e.preventDefault();
|
|
766
|
+
e.stopPropagation();
|
|
767
|
+
const w = itemsRef.current.find((x) => x.id === id);
|
|
768
|
+
if (!w)
|
|
769
|
+
return;
|
|
770
|
+
const wrapper = e.currentTarget.closest("[data-widget-id]");
|
|
771
|
+
const rect = wrapper ? wrapper.getBoundingClientRect() : { left: 0, top: 0, width: 300, height: 200 };
|
|
772
|
+
document.body.style.cursor = "col-resize";
|
|
773
|
+
document.body.style.userSelect = "none";
|
|
774
|
+
setResize({
|
|
775
|
+
resizingId: id,
|
|
776
|
+
resizeStartX: e.clientX,
|
|
777
|
+
resizeStartSpan: w.colSpan,
|
|
778
|
+
resizeStartWidth: rect.width,
|
|
779
|
+
resizeStartLeft: rect.left,
|
|
780
|
+
resizeStartTop: rect.top,
|
|
781
|
+
resizeHeight: rect.height,
|
|
782
|
+
resizeLiveWidth: rect.width,
|
|
783
|
+
resizeEstSpan: w.colSpan
|
|
784
|
+
});
|
|
785
|
+
};
|
|
786
|
+
React7.useEffect(() => {
|
|
787
|
+
function handleMove(e) {
|
|
788
|
+
const currentResize = resizeRef.current;
|
|
789
|
+
const currentDrag = dragRef.current;
|
|
790
|
+
const currentItems = itemsRef.current;
|
|
791
|
+
if (currentResize.resizingId) {
|
|
792
|
+
const m = gridMetrics();
|
|
793
|
+
if (!m)
|
|
794
|
+
return;
|
|
795
|
+
const { gridWidth, colWidth } = m;
|
|
796
|
+
const minW = colWidth;
|
|
797
|
+
const maxW = gridWidth;
|
|
798
|
+
const deltaX = e.clientX - currentResize.resizeStartX;
|
|
799
|
+
const liveWidth = Math.max(minW, Math.min(maxW, currentResize.resizeStartWidth + deltaX));
|
|
800
|
+
const exactCols = (liveWidth + GRID_GAP) / (colWidth + GRID_GAP);
|
|
801
|
+
const deltaCols = exactCols - currentResize.resizeStartSpan;
|
|
802
|
+
let est;
|
|
803
|
+
if (deltaCols >= 0.05)
|
|
804
|
+
est = currentResize.resizeStartSpan + Math.floor(deltaCols + 0.95);
|
|
805
|
+
else if (deltaCols <= -0.05)
|
|
806
|
+
est = currentResize.resizeStartSpan - Math.floor(-deltaCols + 0.95);
|
|
807
|
+
else
|
|
808
|
+
est = currentResize.resizeStartSpan;
|
|
809
|
+
est = Math.max(1, Math.min(4, est));
|
|
810
|
+
if (currentResize.resizeLiveWidth !== liveWidth || currentResize.resizeEstSpan !== est) {
|
|
811
|
+
setResize((s) => ({ ...s, resizeLiveWidth: liveWidth, resizeEstSpan: est }));
|
|
812
|
+
}
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (currentDrag.draggingId && !currentDrag.dropping) {
|
|
816
|
+
setDrag((s) => ({ ...s, dragX: e.clientX, dragY: e.clientY }));
|
|
817
|
+
const el = document.elementFromPoint(e.clientX, e.clientY);
|
|
818
|
+
const wrapper = el && el.closest("[data-widget-id]");
|
|
819
|
+
const overId = wrapper ? wrapper.getAttribute("data-widget-id") : null;
|
|
820
|
+
if (overId && overId !== currentDrag.draggingId) {
|
|
821
|
+
const from = currentItems.findIndex((w) => w.id === currentDrag.draggingId);
|
|
822
|
+
const to = currentItems.findIndex((w) => w.id === overId);
|
|
823
|
+
if (from !== -1 && to !== -1 && from !== to) {
|
|
824
|
+
rectsBeforeRef.current = snapshotRects();
|
|
825
|
+
const next = [...currentItems];
|
|
826
|
+
const [moved] = next.splice(from, 1);
|
|
827
|
+
next.splice(to, 0, moved);
|
|
828
|
+
itemsRef.current = next;
|
|
829
|
+
setItems(next);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
function handleUp() {
|
|
835
|
+
document.body.style.cursor = "";
|
|
836
|
+
document.body.style.userSelect = "";
|
|
837
|
+
const currentResize = resizeRef.current;
|
|
838
|
+
const currentDrag = dragRef.current;
|
|
839
|
+
const currentItems = itemsRef.current;
|
|
840
|
+
if (currentResize.resizingId) {
|
|
841
|
+
const est = currentResize.resizeEstSpan;
|
|
842
|
+
const resizingId = currentResize.resizingId;
|
|
843
|
+
rectsBeforeRef.current = snapshotRects();
|
|
844
|
+
const next = currentItems.map((w) => w.id === resizingId ? { ...w, colSpan: est } : w);
|
|
845
|
+
itemsRef.current = next;
|
|
846
|
+
setItems(next);
|
|
847
|
+
if (onPersist)
|
|
848
|
+
onPersist(next);
|
|
849
|
+
setResize(INITIAL_RESIZE);
|
|
850
|
+
requestAnimationFrame(() => playFlip(null));
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
if (currentDrag.draggingId) {
|
|
854
|
+
const draggingId = currentDrag.draggingId;
|
|
855
|
+
const slotEl = gridRef.current?.querySelector('[data-drop-slot="true"]');
|
|
856
|
+
const slot = slotEl ? slotEl.getBoundingClientRect() : null;
|
|
857
|
+
if (slot) {
|
|
858
|
+
setDrag((s) => ({ ...s, dropping: true, dragX: slot.left + s.dragOffsetX, dragY: slot.top + s.dragOffsetY }));
|
|
859
|
+
if (dropTimerRef.current)
|
|
860
|
+
clearTimeout(dropTimerRef.current);
|
|
861
|
+
dropTimerRef.current = setTimeout(() => {
|
|
862
|
+
setDrag(INITIAL_DRAG);
|
|
863
|
+
setJustDroppedId(draggingId);
|
|
864
|
+
if (onPersist)
|
|
865
|
+
onPersist(itemsRef.current);
|
|
866
|
+
if (dropTimer2Ref.current)
|
|
867
|
+
clearTimeout(dropTimer2Ref.current);
|
|
868
|
+
dropTimer2Ref.current = setTimeout(() => {
|
|
869
|
+
setJustDroppedId((cur) => cur === draggingId ? null : cur);
|
|
870
|
+
}, 320);
|
|
871
|
+
}, 240);
|
|
872
|
+
} else {
|
|
873
|
+
setDrag(INITIAL_DRAG);
|
|
874
|
+
if (onPersist)
|
|
875
|
+
onPersist(currentItems);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
window.addEventListener("pointermove", handleMove);
|
|
880
|
+
window.addEventListener("pointerup", handleUp);
|
|
881
|
+
return () => {
|
|
882
|
+
window.removeEventListener("pointermove", handleMove);
|
|
883
|
+
window.removeEventListener("pointerup", handleUp);
|
|
884
|
+
};
|
|
885
|
+
}, []);
|
|
886
|
+
React7.useEffect(() => {
|
|
887
|
+
return () => {
|
|
888
|
+
if (dropTimerRef.current)
|
|
889
|
+
clearTimeout(dropTimerRef.current);
|
|
890
|
+
if (dropTimer2Ref.current)
|
|
891
|
+
clearTimeout(dropTimer2Ref.current);
|
|
892
|
+
};
|
|
893
|
+
}, []);
|
|
894
|
+
return { gridRef, drag, resize, justDroppedId, startDrag, startResize };
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// src/lib/color/generator.ts
|
|
898
|
+
var normalizeHue = (h) => (h + 360) % 360;
|
|
899
|
+
var clamp = (val, min, max) => Math.max(min, Math.min(max, val));
|
|
900
|
+
function generateComplementary2(hexColor) {
|
|
901
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
902
|
+
if (!hsl)
|
|
903
|
+
return [hexColor];
|
|
904
|
+
return [
|
|
905
|
+
hslToColorString2(hsl.h, Math.max(0, hsl.s - 20), 92, hsl.a),
|
|
906
|
+
hexColor,
|
|
907
|
+
hslToColorString2(hsl.h, clamp(hsl.s + 10, 0, 100), 20, hsl.a),
|
|
908
|
+
hslToColorString2(normalizeHue(hsl.h + 180), Math.max(0, hsl.s - 30), 85, hsl.a),
|
|
909
|
+
hslToColorString2(normalizeHue(hsl.h + 180), clamp(hsl.s - 10, 0, 100), hsl.l, hsl.a)
|
|
910
|
+
];
|
|
911
|
+
}
|
|
912
|
+
function generateAnalogous2(hexColor) {
|
|
913
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
914
|
+
if (!hsl)
|
|
915
|
+
return [hexColor];
|
|
916
|
+
return [
|
|
917
|
+
hslToColorString2(normalizeHue(hsl.h - 30), Math.max(0, hsl.s - 15), clamp(hsl.l + 15, 0, 90), hsl.a),
|
|
918
|
+
hslToColorString2(normalizeHue(hsl.h - 15), hsl.s, clamp(hsl.l + 5, 0, 100), hsl.a),
|
|
919
|
+
hexColor,
|
|
920
|
+
hslToColorString2(normalizeHue(hsl.h + 15), hsl.s, clamp(hsl.l - 10, 10, 100), hsl.a),
|
|
921
|
+
hslToColorString2(normalizeHue(hsl.h + 30), clamp(hsl.s + 10, 0, 100), clamp(hsl.l - 20, 15, 100), hsl.a)
|
|
922
|
+
];
|
|
923
|
+
}
|
|
924
|
+
function generateTriadic2(hexColor) {
|
|
925
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
926
|
+
if (!hsl)
|
|
927
|
+
return [hexColor];
|
|
928
|
+
return [
|
|
929
|
+
hslToColorString2(hsl.h, Math.max(0, hsl.s - 25), 95, hsl.a),
|
|
930
|
+
hexColor,
|
|
931
|
+
hslToColorString2(normalizeHue(hsl.h + 120), Math.max(0, hsl.s - 15), hsl.l, hsl.a),
|
|
932
|
+
hslToColorString2(normalizeHue(hsl.h + 240), Math.max(0, hsl.s - 15), hsl.l, hsl.a),
|
|
933
|
+
hslToColorString2(normalizeHue(hsl.h + 240), clamp(hsl.s + 10, 0, 100), 25, hsl.a)
|
|
934
|
+
];
|
|
935
|
+
}
|
|
936
|
+
function generateSplitComplementary2(hexColor) {
|
|
937
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
938
|
+
if (!hsl)
|
|
939
|
+
return [hexColor];
|
|
940
|
+
return [
|
|
941
|
+
hslToColorString2(hsl.h, Math.max(0, hsl.s - 20), 92, hsl.a),
|
|
942
|
+
hexColor,
|
|
943
|
+
hslToColorString2(hsl.h, clamp(hsl.s + 10, 0, 100), 20, hsl.a),
|
|
944
|
+
hslToColorString2(normalizeHue(hsl.h + 150), Math.max(0, hsl.s - 15), clamp(hsl.l + 10, 0, 85), hsl.a),
|
|
945
|
+
hslToColorString2(normalizeHue(hsl.h + 210), Math.max(0, hsl.s - 15), clamp(hsl.l + 10, 0, 85), hsl.a)
|
|
946
|
+
];
|
|
947
|
+
}
|
|
948
|
+
function generateTetradic2(hexColor) {
|
|
949
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
950
|
+
if (!hsl)
|
|
951
|
+
return [hexColor];
|
|
952
|
+
return [
|
|
953
|
+
hexColor,
|
|
954
|
+
hslToColorString2(normalizeHue(hsl.h + 90), Math.max(0, hsl.s - 20), clamp(hsl.l + 15, 0, 90), hsl.a),
|
|
955
|
+
hslToColorString2(normalizeHue(hsl.h + 180), Math.max(0, hsl.s - 10), hsl.l, hsl.a),
|
|
956
|
+
hslToColorString2(normalizeHue(hsl.h + 270), clamp(hsl.s + 10, 0, 100), clamp(hsl.l - 15, 10, 85), hsl.a),
|
|
957
|
+
hslToColorString2(hsl.h, Math.max(0, hsl.s - 40), 15, hsl.a)
|
|
958
|
+
];
|
|
959
|
+
}
|
|
960
|
+
function generateMonochromatic2(hexColor) {
|
|
961
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
962
|
+
if (!hsl)
|
|
963
|
+
return [hexColor];
|
|
964
|
+
return [
|
|
965
|
+
hslToColorString2(hsl.h, Math.max(0, hsl.s - 30), 96, hsl.a),
|
|
966
|
+
hslToColorString2(hsl.h, Math.max(0, hsl.s - 15), clamp(hsl.l + 25, 0, 85), hsl.a),
|
|
967
|
+
hexColor,
|
|
968
|
+
hslToColorString2(hsl.h, clamp(hsl.s + 10, 0, 100), clamp(hsl.l - 25, 20, 100), hsl.a),
|
|
969
|
+
hslToColorString2(hsl.h, clamp(hsl.s + 20, 0, 100), 12, hsl.a)
|
|
970
|
+
];
|
|
971
|
+
}
|
|
972
|
+
function generateAccentedAnalogous2(hexColor) {
|
|
973
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
974
|
+
if (!hsl)
|
|
975
|
+
return [hexColor];
|
|
976
|
+
return [
|
|
977
|
+
hslToColorString2(hsl.h, Math.max(0, hsl.s - 25), 94, hsl.a),
|
|
978
|
+
hslToColorString2(normalizeHue(hsl.h - 30), Math.max(0, hsl.s - 10), clamp(hsl.l + 5, 25, 85), hsl.a),
|
|
979
|
+
hexColor,
|
|
980
|
+
hslToColorString2(normalizeHue(hsl.h + 30), hsl.s, clamp(hsl.l - 10, 20, 80), hsl.a),
|
|
981
|
+
hslToColorString2(normalizeHue(hsl.h + 180), clamp(hsl.s + 5, 0, 100), clamp(hsl.l, 35, 65), hsl.a)
|
|
982
|
+
];
|
|
983
|
+
}
|
|
984
|
+
function generateDoubleComplementary2(hexColor) {
|
|
985
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
986
|
+
if (!hsl)
|
|
987
|
+
return [hexColor];
|
|
988
|
+
return [
|
|
989
|
+
hslToColorString2(hsl.h, Math.max(0, hsl.s - 25), 94, hsl.a),
|
|
990
|
+
hexColor,
|
|
991
|
+
hslToColorString2(normalizeHue(hsl.h + 60), Math.max(0, hsl.s - 15), clamp(hsl.l + 5, 30, 80), hsl.a),
|
|
992
|
+
hslToColorString2(normalizeHue(hsl.h + 180), Math.max(0, hsl.s - 15), clamp(hsl.l, 30, 75), hsl.a),
|
|
993
|
+
hslToColorString2(normalizeHue(hsl.h + 240), clamp(hsl.s + 5, 0, 100), 22, hsl.a)
|
|
994
|
+
];
|
|
995
|
+
}
|
|
996
|
+
function generateUiNeutral2(hexColor) {
|
|
997
|
+
const hsl = parseColorToHsl2(hexColor);
|
|
998
|
+
if (!hsl)
|
|
999
|
+
return [hexColor];
|
|
1000
|
+
return [
|
|
1001
|
+
hexColor,
|
|
1002
|
+
hslToColorString2(hsl.h, clamp(Math.min(hsl.s, 45), 15, 50), 18, hsl.a),
|
|
1003
|
+
hslToColorString2(hsl.h, clamp(hsl.s - 25, 10, 60), 86, hsl.a),
|
|
1004
|
+
hslToColorString2(hsl.h, Math.min(hsl.s, 15), 96, hsl.a),
|
|
1005
|
+
hslToColorString2(hsl.h, Math.min(hsl.s, 20), 12, hsl.a)
|
|
1006
|
+
];
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
// src/components/ui/invoice-document.tsx
|
|
1010
|
+
import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
|
|
1011
|
+
function InvoiceDocument2({
|
|
1012
|
+
invoiceNumber,
|
|
1013
|
+
status,
|
|
1014
|
+
billTo,
|
|
1015
|
+
createdAtLabel,
|
|
1016
|
+
dueDateLabel,
|
|
1017
|
+
paidAtLabel,
|
|
1018
|
+
items,
|
|
1019
|
+
subtotalLabel,
|
|
1020
|
+
discountLabel,
|
|
1021
|
+
taxLabel,
|
|
1022
|
+
totalLabel,
|
|
1023
|
+
notes,
|
|
1024
|
+
onPrint,
|
|
1025
|
+
extraActions,
|
|
1026
|
+
className = ""
|
|
1027
|
+
}) {
|
|
1028
|
+
return /* @__PURE__ */ jsxDEV11("div", {
|
|
1029
|
+
className: `flex flex-col gap-4 ${className}`,
|
|
1030
|
+
children: [
|
|
1031
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1032
|
+
className: "flex items-center justify-between gap-2 print:hidden",
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1035
|
+
className: "flex items-center gap-2",
|
|
1036
|
+
children: extraActions
|
|
1037
|
+
}, undefined, false, undefined, this),
|
|
1038
|
+
/* @__PURE__ */ jsxDEV11(Button2, {
|
|
1039
|
+
variant: "secondary",
|
|
1040
|
+
onClick: onPrint ?? (() => window.print()),
|
|
1041
|
+
children: [
|
|
1042
|
+
/* @__PURE__ */ jsxDEV11(Icon2, {
|
|
1043
|
+
name: "printer",
|
|
1044
|
+
size: 16
|
|
1045
|
+
}, undefined, false, undefined, this),
|
|
1046
|
+
"Cetak / Unduh"
|
|
1047
|
+
]
|
|
1048
|
+
}, undefined, true, undefined, this)
|
|
1049
|
+
]
|
|
1050
|
+
}, undefined, true, undefined, this),
|
|
1051
|
+
/* @__PURE__ */ jsxDEV11(Card2, {
|
|
1052
|
+
className: "mx-auto w-full max-w-3xl print:shadow-none print:border-none",
|
|
1053
|
+
children: /* @__PURE__ */ jsxDEV11(CardContent2, {
|
|
1054
|
+
className: "flex flex-col gap-8 p-8",
|
|
1055
|
+
children: [
|
|
1056
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1057
|
+
className: "flex items-start justify-between",
|
|
1058
|
+
children: [
|
|
1059
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1060
|
+
children: [
|
|
1061
|
+
/* @__PURE__ */ jsxDEV11("h2", {
|
|
1062
|
+
className: "text-[20px] font-bold text-foreground",
|
|
1063
|
+
children: "Invoice"
|
|
1064
|
+
}, undefined, false, undefined, this),
|
|
1065
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1066
|
+
className: "text-[13px] text-text-color",
|
|
1067
|
+
children: invoiceNumber
|
|
1068
|
+
}, undefined, false, undefined, this)
|
|
1069
|
+
]
|
|
1070
|
+
}, undefined, true, undefined, this),
|
|
1071
|
+
/* @__PURE__ */ jsxDEV11(StatusBadge2, {
|
|
1072
|
+
status
|
|
1073
|
+
}, undefined, false, undefined, this)
|
|
1074
|
+
]
|
|
1075
|
+
}, undefined, true, undefined, this),
|
|
1076
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1077
|
+
className: "grid grid-cols-2 gap-6",
|
|
1078
|
+
children: [
|
|
1079
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1080
|
+
children: [
|
|
1081
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1082
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-text-color mb-1.5",
|
|
1083
|
+
children: "Ditagihkan Kepada"
|
|
1084
|
+
}, undefined, false, undefined, this),
|
|
1085
|
+
billTo ? /* @__PURE__ */ jsxDEV11("div", {
|
|
1086
|
+
className: "text-[13px] text-foreground flex flex-col gap-0.5",
|
|
1087
|
+
children: [
|
|
1088
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1089
|
+
className: "font-medium",
|
|
1090
|
+
children: billTo.company || billTo.name
|
|
1091
|
+
}, undefined, false, undefined, this),
|
|
1092
|
+
billTo.company && /* @__PURE__ */ jsxDEV11("span", {
|
|
1093
|
+
className: "text-text-color",
|
|
1094
|
+
children: billTo.name
|
|
1095
|
+
}, undefined, false, undefined, this),
|
|
1096
|
+
billTo.email && /* @__PURE__ */ jsxDEV11("span", {
|
|
1097
|
+
className: "text-text-color",
|
|
1098
|
+
children: billTo.email
|
|
1099
|
+
}, undefined, false, undefined, this),
|
|
1100
|
+
billTo.addressLines?.map((line, i) => /* @__PURE__ */ jsxDEV11("span", {
|
|
1101
|
+
className: "text-text-color",
|
|
1102
|
+
children: line
|
|
1103
|
+
}, i, false, undefined, this))
|
|
1104
|
+
]
|
|
1105
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV11("p", {
|
|
1106
|
+
className: "text-[13px] text-text-color",
|
|
1107
|
+
children: "—"
|
|
1108
|
+
}, undefined, false, undefined, this)
|
|
1109
|
+
]
|
|
1110
|
+
}, undefined, true, undefined, this),
|
|
1111
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1112
|
+
className: "flex flex-col gap-2 items-end text-right",
|
|
1113
|
+
children: [
|
|
1114
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1115
|
+
children: [
|
|
1116
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1117
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-text-color",
|
|
1118
|
+
children: "Dibuat"
|
|
1119
|
+
}, undefined, false, undefined, this),
|
|
1120
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1121
|
+
className: "text-[13px] text-foreground",
|
|
1122
|
+
children: createdAtLabel
|
|
1123
|
+
}, undefined, false, undefined, this)
|
|
1124
|
+
]
|
|
1125
|
+
}, undefined, true, undefined, this),
|
|
1126
|
+
dueDateLabel && /* @__PURE__ */ jsxDEV11("div", {
|
|
1127
|
+
children: [
|
|
1128
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1129
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-text-color",
|
|
1130
|
+
children: "Jatuh Tempo"
|
|
1131
|
+
}, undefined, false, undefined, this),
|
|
1132
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1133
|
+
className: "text-[13px] text-foreground",
|
|
1134
|
+
children: dueDateLabel
|
|
1135
|
+
}, undefined, false, undefined, this)
|
|
1136
|
+
]
|
|
1137
|
+
}, undefined, true, undefined, this),
|
|
1138
|
+
paidAtLabel && /* @__PURE__ */ jsxDEV11("div", {
|
|
1139
|
+
children: [
|
|
1140
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1141
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-text-color",
|
|
1142
|
+
children: "Dibayar"
|
|
1143
|
+
}, undefined, false, undefined, this),
|
|
1144
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1145
|
+
className: "text-[13px] text-foreground",
|
|
1146
|
+
children: paidAtLabel
|
|
1147
|
+
}, undefined, false, undefined, this)
|
|
1148
|
+
]
|
|
1149
|
+
}, undefined, true, undefined, this)
|
|
1150
|
+
]
|
|
1151
|
+
}, undefined, true, undefined, this)
|
|
1152
|
+
]
|
|
1153
|
+
}, undefined, true, undefined, this),
|
|
1154
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1155
|
+
className: "overflow-hidden rounded-md border border-border",
|
|
1156
|
+
children: /* @__PURE__ */ jsxDEV11("table", {
|
|
1157
|
+
className: "w-full text-[13px]",
|
|
1158
|
+
children: [
|
|
1159
|
+
/* @__PURE__ */ jsxDEV11("thead", {
|
|
1160
|
+
children: /* @__PURE__ */ jsxDEV11("tr", {
|
|
1161
|
+
className: "border-b border-border text-left text-[11px] font-semibold uppercase tracking-wide text-text-color",
|
|
1162
|
+
children: [
|
|
1163
|
+
/* @__PURE__ */ jsxDEV11("th", {
|
|
1164
|
+
className: "px-4 py-2.5",
|
|
1165
|
+
children: "Deskripsi"
|
|
1166
|
+
}, undefined, false, undefined, this),
|
|
1167
|
+
/* @__PURE__ */ jsxDEV11("th", {
|
|
1168
|
+
className: "px-4 py-2.5 text-right",
|
|
1169
|
+
children: "Qty"
|
|
1170
|
+
}, undefined, false, undefined, this),
|
|
1171
|
+
/* @__PURE__ */ jsxDEV11("th", {
|
|
1172
|
+
className: "px-4 py-2.5 text-right",
|
|
1173
|
+
children: "Harga Satuan"
|
|
1174
|
+
}, undefined, false, undefined, this),
|
|
1175
|
+
/* @__PURE__ */ jsxDEV11("th", {
|
|
1176
|
+
className: "px-4 py-2.5 text-right",
|
|
1177
|
+
children: "Total"
|
|
1178
|
+
}, undefined, false, undefined, this)
|
|
1179
|
+
]
|
|
1180
|
+
}, undefined, true, undefined, this)
|
|
1181
|
+
}, undefined, false, undefined, this),
|
|
1182
|
+
/* @__PURE__ */ jsxDEV11("tbody", {
|
|
1183
|
+
children: items.length === 0 ? /* @__PURE__ */ jsxDEV11("tr", {
|
|
1184
|
+
children: /* @__PURE__ */ jsxDEV11("td", {
|
|
1185
|
+
colSpan: 4,
|
|
1186
|
+
className: "px-4 py-5 text-center text-text-color",
|
|
1187
|
+
children: "Tidak ada item."
|
|
1188
|
+
}, undefined, false, undefined, this)
|
|
1189
|
+
}, undefined, false, undefined, this) : items.map((item) => /* @__PURE__ */ jsxDEV11("tr", {
|
|
1190
|
+
className: "border-b border-border last:border-0",
|
|
1191
|
+
children: [
|
|
1192
|
+
/* @__PURE__ */ jsxDEV11("td", {
|
|
1193
|
+
className: "px-4 py-2.5",
|
|
1194
|
+
children: [
|
|
1195
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1196
|
+
className: "text-foreground",
|
|
1197
|
+
children: item.description
|
|
1198
|
+
}, undefined, false, undefined, this),
|
|
1199
|
+
item.periodLabel && /* @__PURE__ */ jsxDEV11("div", {
|
|
1200
|
+
className: "text-[11.5px] text-text-color",
|
|
1201
|
+
children: item.periodLabel
|
|
1202
|
+
}, undefined, false, undefined, this)
|
|
1203
|
+
]
|
|
1204
|
+
}, undefined, true, undefined, this),
|
|
1205
|
+
/* @__PURE__ */ jsxDEV11("td", {
|
|
1206
|
+
className: "px-4 py-2.5 text-right",
|
|
1207
|
+
children: item.qty
|
|
1208
|
+
}, undefined, false, undefined, this),
|
|
1209
|
+
/* @__PURE__ */ jsxDEV11("td", {
|
|
1210
|
+
className: "px-4 py-2.5 text-right",
|
|
1211
|
+
children: item.unitPriceLabel
|
|
1212
|
+
}, undefined, false, undefined, this),
|
|
1213
|
+
/* @__PURE__ */ jsxDEV11("td", {
|
|
1214
|
+
className: "px-4 py-2.5 text-right font-medium",
|
|
1215
|
+
children: item.totalLabel
|
|
1216
|
+
}, undefined, false, undefined, this)
|
|
1217
|
+
]
|
|
1218
|
+
}, item.id, true, undefined, this))
|
|
1219
|
+
}, undefined, false, undefined, this)
|
|
1220
|
+
]
|
|
1221
|
+
}, undefined, true, undefined, this)
|
|
1222
|
+
}, undefined, false, undefined, this),
|
|
1223
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1224
|
+
className: "flex justify-end",
|
|
1225
|
+
children: /* @__PURE__ */ jsxDEV11("div", {
|
|
1226
|
+
className: "w-full max-w-xs flex flex-col gap-2 text-[13px]",
|
|
1227
|
+
children: [
|
|
1228
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1229
|
+
className: "flex justify-between",
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1232
|
+
className: "text-text-color",
|
|
1233
|
+
children: "Subtotal"
|
|
1234
|
+
}, undefined, false, undefined, this),
|
|
1235
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1236
|
+
className: "text-foreground",
|
|
1237
|
+
children: subtotalLabel
|
|
1238
|
+
}, undefined, false, undefined, this)
|
|
1239
|
+
]
|
|
1240
|
+
}, undefined, true, undefined, this),
|
|
1241
|
+
discountLabel && /* @__PURE__ */ jsxDEV11("div", {
|
|
1242
|
+
className: "flex justify-between",
|
|
1243
|
+
children: [
|
|
1244
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1245
|
+
className: "text-text-color",
|
|
1246
|
+
children: "Diskon"
|
|
1247
|
+
}, undefined, false, undefined, this),
|
|
1248
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1249
|
+
className: "text-foreground",
|
|
1250
|
+
children: [
|
|
1251
|
+
"-",
|
|
1252
|
+
discountLabel
|
|
1253
|
+
]
|
|
1254
|
+
}, undefined, true, undefined, this)
|
|
1255
|
+
]
|
|
1256
|
+
}, undefined, true, undefined, this),
|
|
1257
|
+
taxLabel && /* @__PURE__ */ jsxDEV11("div", {
|
|
1258
|
+
className: "flex justify-between",
|
|
1259
|
+
children: [
|
|
1260
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1261
|
+
className: "text-text-color",
|
|
1262
|
+
children: "Pajak"
|
|
1263
|
+
}, undefined, false, undefined, this),
|
|
1264
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1265
|
+
className: "text-foreground",
|
|
1266
|
+
children: taxLabel
|
|
1267
|
+
}, undefined, false, undefined, this)
|
|
1268
|
+
]
|
|
1269
|
+
}, undefined, true, undefined, this),
|
|
1270
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1271
|
+
className: "flex justify-between border-t border-border pt-2 font-bold text-[15px]",
|
|
1272
|
+
children: [
|
|
1273
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1274
|
+
className: "text-foreground",
|
|
1275
|
+
children: "Total"
|
|
1276
|
+
}, undefined, false, undefined, this),
|
|
1277
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
1278
|
+
className: "text-foreground",
|
|
1279
|
+
children: totalLabel
|
|
1280
|
+
}, undefined, false, undefined, this)
|
|
1281
|
+
]
|
|
1282
|
+
}, undefined, true, undefined, this)
|
|
1283
|
+
]
|
|
1284
|
+
}, undefined, true, undefined, this)
|
|
1285
|
+
}, undefined, false, undefined, this),
|
|
1286
|
+
notes && /* @__PURE__ */ jsxDEV11("div", {
|
|
1287
|
+
children: [
|
|
1288
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1289
|
+
className: "text-[11px] font-semibold uppercase tracking-wide text-text-color mb-1.5",
|
|
1290
|
+
children: "Catatan"
|
|
1291
|
+
}, undefined, false, undefined, this),
|
|
1292
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
1293
|
+
className: "text-[13px] text-foreground whitespace-pre-wrap",
|
|
1294
|
+
children: notes
|
|
1295
|
+
}, undefined, false, undefined, this)
|
|
1296
|
+
]
|
|
1297
|
+
}, undefined, true, undefined, this)
|
|
1298
|
+
]
|
|
1299
|
+
}, undefined, true, undefined, this)
|
|
1300
|
+
}, undefined, false, undefined, this)
|
|
1301
|
+
]
|
|
1302
|
+
}, undefined, true, undefined, this);
|
|
1303
|
+
}
|
|
1304
|
+
var STAGGER_DELAYS = [0, 0.18, 0.09, 0.27, 0.13];
|
|
1305
|
+
function staggerDelay(index) {
|
|
1306
|
+
return { animationDelay: `${STAGGER_DELAYS[index % STAGGER_DELAYS.length]}s` };
|
|
1307
|
+
}
|
|
1308
|
+
function skeletonClass(animation) {
|
|
1309
|
+
return animation === "shimmer" ? "skeleton-block skeleton-shimmer" : "skeleton-block skeleton-pulse";
|
|
1310
|
+
}
|
|
1311
|
+
function InvoiceDocumentSkeleton2({ itemRows = 3, animation = "pulse", className = "" }) {
|
|
1312
|
+
return /* @__PURE__ */ jsxDEV11("div", {
|
|
1313
|
+
className: cn2("flex flex-col gap-4", className),
|
|
1314
|
+
children: [
|
|
1315
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1316
|
+
className: "flex justify-end",
|
|
1317
|
+
children: /* @__PURE__ */ jsxDEV11("div", {
|
|
1318
|
+
className: cn2(skeletonClass(animation), "h-9 w-40 rounded-md")
|
|
1319
|
+
}, undefined, false, undefined, this)
|
|
1320
|
+
}, undefined, false, undefined, this),
|
|
1321
|
+
/* @__PURE__ */ jsxDEV11(Card2, {
|
|
1322
|
+
className: "mx-auto w-full max-w-3xl",
|
|
1323
|
+
children: /* @__PURE__ */ jsxDEV11(CardContent2, {
|
|
1324
|
+
className: "flex flex-col gap-8 p-8",
|
|
1325
|
+
children: [
|
|
1326
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1327
|
+
className: "flex items-start justify-between",
|
|
1328
|
+
children: [
|
|
1329
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1330
|
+
className: "flex flex-col gap-2",
|
|
1331
|
+
children: [
|
|
1332
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1333
|
+
className: cn2(skeletonClass(animation), "h-6 w-24 rounded")
|
|
1334
|
+
}, undefined, false, undefined, this),
|
|
1335
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1336
|
+
className: cn2(skeletonClass(animation), "h-3.5 w-32 rounded"),
|
|
1337
|
+
style: staggerDelay(1)
|
|
1338
|
+
}, undefined, false, undefined, this)
|
|
1339
|
+
]
|
|
1340
|
+
}, undefined, true, undefined, this),
|
|
1341
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1342
|
+
className: cn2(skeletonClass(animation), "h-6 w-16 rounded-full"),
|
|
1343
|
+
style: staggerDelay(2)
|
|
1344
|
+
}, undefined, false, undefined, this)
|
|
1345
|
+
]
|
|
1346
|
+
}, undefined, true, undefined, this),
|
|
1347
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1348
|
+
className: "grid grid-cols-2 gap-6",
|
|
1349
|
+
children: [
|
|
1350
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1351
|
+
className: "flex flex-col gap-2",
|
|
1352
|
+
children: [
|
|
1353
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1354
|
+
className: cn2(skeletonClass(animation), "h-3 w-32 rounded")
|
|
1355
|
+
}, undefined, false, undefined, this),
|
|
1356
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1357
|
+
className: cn2(skeletonClass(animation), "h-3.5 w-40 rounded"),
|
|
1358
|
+
style: staggerDelay(1)
|
|
1359
|
+
}, undefined, false, undefined, this),
|
|
1360
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1361
|
+
className: cn2(skeletonClass(animation), "h-3.5 w-48 rounded"),
|
|
1362
|
+
style: staggerDelay(2)
|
|
1363
|
+
}, undefined, false, undefined, this),
|
|
1364
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1365
|
+
className: cn2(skeletonClass(animation), "h-3.5 w-36 rounded"),
|
|
1366
|
+
style: staggerDelay(3)
|
|
1367
|
+
}, undefined, false, undefined, this)
|
|
1368
|
+
]
|
|
1369
|
+
}, undefined, true, undefined, this),
|
|
1370
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1371
|
+
className: "flex flex-col gap-2 items-end",
|
|
1372
|
+
children: [
|
|
1373
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1374
|
+
className: cn2(skeletonClass(animation), "h-3 w-20 rounded")
|
|
1375
|
+
}, undefined, false, undefined, this),
|
|
1376
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1377
|
+
className: cn2(skeletonClass(animation), "h-3.5 w-28 rounded"),
|
|
1378
|
+
style: staggerDelay(1)
|
|
1379
|
+
}, undefined, false, undefined, this)
|
|
1380
|
+
]
|
|
1381
|
+
}, undefined, true, undefined, this)
|
|
1382
|
+
]
|
|
1383
|
+
}, undefined, true, undefined, this),
|
|
1384
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1385
|
+
className: "overflow-hidden rounded-md border border-border",
|
|
1386
|
+
children: [
|
|
1387
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1388
|
+
className: "border-b border-border px-4 py-2.5",
|
|
1389
|
+
children: /* @__PURE__ */ jsxDEV11("div", {
|
|
1390
|
+
className: cn2(skeletonClass(animation), "h-3 w-full max-w-md rounded")
|
|
1391
|
+
}, undefined, false, undefined, this)
|
|
1392
|
+
}, undefined, false, undefined, this),
|
|
1393
|
+
Array.from({ length: itemRows }).map((_, i) => /* @__PURE__ */ jsxDEV11("div", {
|
|
1394
|
+
className: "flex items-center justify-between border-b border-border px-4 py-3 last:border-0",
|
|
1395
|
+
children: [
|
|
1396
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1397
|
+
className: cn2(skeletonClass(animation), "h-3.5 w-48 rounded"),
|
|
1398
|
+
style: staggerDelay(i)
|
|
1399
|
+
}, undefined, false, undefined, this),
|
|
1400
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1401
|
+
className: cn2(skeletonClass(animation), "h-3.5 w-20 rounded"),
|
|
1402
|
+
style: staggerDelay(i + 2)
|
|
1403
|
+
}, undefined, false, undefined, this)
|
|
1404
|
+
]
|
|
1405
|
+
}, i, true, undefined, this))
|
|
1406
|
+
]
|
|
1407
|
+
}, undefined, true, undefined, this),
|
|
1408
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1409
|
+
className: "flex justify-end",
|
|
1410
|
+
children: /* @__PURE__ */ jsxDEV11("div", {
|
|
1411
|
+
className: "w-full max-w-xs flex flex-col gap-2",
|
|
1412
|
+
children: [
|
|
1413
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1414
|
+
className: cn2(skeletonClass(animation), "h-3.5 w-full rounded")
|
|
1415
|
+
}, undefined, false, undefined, this),
|
|
1416
|
+
/* @__PURE__ */ jsxDEV11("div", {
|
|
1417
|
+
className: cn2(skeletonClass(animation), "h-4 w-full rounded"),
|
|
1418
|
+
style: staggerDelay(1)
|
|
1419
|
+
}, undefined, false, undefined, this)
|
|
1420
|
+
]
|
|
1421
|
+
}, undefined, true, undefined, this)
|
|
1422
|
+
}, undefined, false, undefined, this)
|
|
1423
|
+
]
|
|
1424
|
+
}, undefined, true, undefined, this)
|
|
1425
|
+
}, undefined, false, undefined, this)
|
|
1426
|
+
]
|
|
1427
|
+
}, undefined, true, undefined, this);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
// src/components/ui/page.tsx
|
|
1431
|
+
import * as React8 from "react";
|
|
1432
|
+
import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
|
|
1433
|
+
var WIDTH_CLASS = {
|
|
1434
|
+
full: "",
|
|
1435
|
+
wide: "max-w-6xl mx-auto w-full",
|
|
1436
|
+
narrow: "max-w-3xl mx-auto w-full"
|
|
1437
|
+
};
|
|
1438
|
+
var MainPageWidthContext = React8.createContext("full");
|
|
1439
|
+
var MainPage2 = React8.forwardRef(({ className, width = "full", children, ...props }, ref) => /* @__PURE__ */ jsxDEV12(MainPageWidthContext.Provider, {
|
|
1440
|
+
value: width,
|
|
1441
|
+
children: /* @__PURE__ */ jsxDEV12("div", {
|
|
1442
|
+
ref,
|
|
1443
|
+
className: cn2("flex flex-col gap-4 px-6 md:px-8 py-6", className),
|
|
1444
|
+
...props,
|
|
1445
|
+
children
|
|
1446
|
+
}, undefined, false, undefined, this)
|
|
1447
|
+
}, undefined, false, undefined, this));
|
|
1448
|
+
MainPage2.displayName = "MainPage";
|
|
1449
|
+
var MainHead2 = React8.forwardRef(({ className, title, subtitle, backButton, right, bordered, ...props }, ref) => {
|
|
1450
|
+
const width = React8.useContext(MainPageWidthContext);
|
|
1451
|
+
const showBorder = bordered ?? width !== "full";
|
|
1452
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1453
|
+
ref,
|
|
1454
|
+
className: cn2(showBorder && "border-b border-border pb-2", className),
|
|
1455
|
+
...props,
|
|
1456
|
+
children: /* @__PURE__ */ jsxDEV12("div", {
|
|
1457
|
+
className: cn2("flex flex-wrap items-center justify-between gap-3", WIDTH_CLASS[width]),
|
|
1458
|
+
children: [
|
|
1459
|
+
/* @__PURE__ */ jsxDEV12("div", {
|
|
1460
|
+
className: "flex items-center gap-3",
|
|
1461
|
+
children: [
|
|
1462
|
+
backButton,
|
|
1463
|
+
/* @__PURE__ */ jsxDEV12("div", {
|
|
1464
|
+
children: [
|
|
1465
|
+
/* @__PURE__ */ jsxDEV12("h1", {
|
|
1466
|
+
className: "text-[22px] font-bold text-foreground",
|
|
1467
|
+
children: title
|
|
1468
|
+
}, undefined, false, undefined, this),
|
|
1469
|
+
subtitle !== undefined && /* @__PURE__ */ jsxDEV12("p", {
|
|
1470
|
+
className: "text-[13.5px] text-text-color",
|
|
1471
|
+
children: subtitle
|
|
1472
|
+
}, undefined, false, undefined, this)
|
|
1473
|
+
]
|
|
1474
|
+
}, undefined, true, undefined, this)
|
|
1475
|
+
]
|
|
1476
|
+
}, undefined, true, undefined, this),
|
|
1477
|
+
right
|
|
1478
|
+
]
|
|
1479
|
+
}, undefined, true, undefined, this)
|
|
1480
|
+
}, undefined, false, undefined, this);
|
|
1481
|
+
});
|
|
1482
|
+
MainHead2.displayName = "MainHead";
|
|
1483
|
+
var MainBar2 = React8.forwardRef(({ className, right, children, ...props }, ref) => {
|
|
1484
|
+
const width = React8.useContext(MainPageWidthContext);
|
|
1485
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1486
|
+
ref,
|
|
1487
|
+
className: cn2("flex flex-wrap items-center justify-between gap-4", WIDTH_CLASS[width], className),
|
|
1488
|
+
...props,
|
|
1489
|
+
children: [
|
|
1490
|
+
/* @__PURE__ */ jsxDEV12("div", {
|
|
1491
|
+
className: "flex items-center gap-2",
|
|
1492
|
+
children
|
|
1493
|
+
}, undefined, false, undefined, this),
|
|
1494
|
+
right && /* @__PURE__ */ jsxDEV12("div", {
|
|
1495
|
+
className: "flex items-center gap-2",
|
|
1496
|
+
children: right
|
|
1497
|
+
}, undefined, false, undefined, this)
|
|
1498
|
+
]
|
|
1499
|
+
}, undefined, true, undefined, this);
|
|
1500
|
+
});
|
|
1501
|
+
MainBar2.displayName = "MainBar";
|
|
1502
|
+
var MainContent2 = React8.forwardRef(({ className, ...props }, ref) => {
|
|
1503
|
+
const width = React8.useContext(MainPageWidthContext);
|
|
1504
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1505
|
+
ref,
|
|
1506
|
+
className: cn2("flex flex-col gap-4 overflow-y-auto", WIDTH_CLASS[width], className),
|
|
1507
|
+
...props
|
|
1508
|
+
}, undefined, false, undefined, this);
|
|
1509
|
+
});
|
|
1510
|
+
MainContent2.displayName = "MainContent";
|
|
1511
|
+
|
|
1512
|
+
// src/components/ui/sidebar-logo.tsx
|
|
1513
|
+
import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
|
|
1514
|
+
function SidebarLogo2({ icon, text, open = true, className }) {
|
|
1515
|
+
return /* @__PURE__ */ jsxDEV13("div", {
|
|
1516
|
+
className: cn2("flex items-center", open ? "px-2" : "justify-center", className),
|
|
1517
|
+
children: [
|
|
1518
|
+
/* @__PURE__ */ jsxDEV13("div", {
|
|
1519
|
+
className: "flex-none",
|
|
1520
|
+
children: icon
|
|
1521
|
+
}, undefined, false, undefined, this),
|
|
1522
|
+
/* @__PURE__ */ jsxDEV13("span", {
|
|
1523
|
+
className: cn2("font-semibold transition-all duration-150 overflow-hidden whitespace-nowrap text-[13px]", open ? "ml-2.5 opacity-100" : "w-0 opacity-0 ml-0"),
|
|
1524
|
+
children: text
|
|
1525
|
+
}, undefined, false, undefined, this)
|
|
1526
|
+
]
|
|
1527
|
+
}, undefined, true, undefined, this);
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
// src/components/ui/sidebar-menu.tsx
|
|
1531
|
+
import * as React9 from "react";
|
|
1532
|
+
import { jsxDEV as jsxDEV14, Fragment } from "react/jsx-dev-runtime";
|
|
1533
|
+
var DEFAULT_ITEM_INDENT_PX = 18;
|
|
1534
|
+
var DEFAULT_ITEM_INDENT_PADDING_PX = 11;
|
|
1535
|
+
function collectLeafPaths(entries) {
|
|
1536
|
+
return entries.flatMap((entry) => entry.children ? collectLeafPaths(entry.children) : [{ to: entry.to, label: entry.label }]);
|
|
1537
|
+
}
|
|
1538
|
+
function findActiveLeafLabel2(groups, currentPath, fallback = "") {
|
|
1539
|
+
const leaves = groups.flatMap((g) => collectLeafPaths(g.items));
|
|
1540
|
+
const match = leaves.filter((leaf) => leaf.to === "/" ? currentPath === "/" : currentPath.startsWith(leaf.to)).sort((a, b) => b.to.length - a.to.length)[0];
|
|
1541
|
+
return match?.label ?? fallback;
|
|
1542
|
+
}
|
|
1543
|
+
function isEntryActive(entry, currentPath) {
|
|
1544
|
+
if (entry.children)
|
|
1545
|
+
return entry.children.some((c) => isEntryActive(c, currentPath));
|
|
1546
|
+
return currentPath === entry.to || entry.to !== "/" && currentPath.startsWith(entry.to);
|
|
1547
|
+
}
|
|
1548
|
+
function CollapsibleSection({ open, children }) {
|
|
1549
|
+
const contentRef = React9.useRef(null);
|
|
1550
|
+
const [maxHeight, setMaxHeight] = React9.useState(open ? Infinity : 0);
|
|
1551
|
+
React9.useEffect(() => {
|
|
1552
|
+
const el = contentRef.current;
|
|
1553
|
+
if (!el)
|
|
1554
|
+
return;
|
|
1555
|
+
if (open) {
|
|
1556
|
+
setMaxHeight(0);
|
|
1557
|
+
const raf = requestAnimationFrame(() => setMaxHeight(el.scrollHeight));
|
|
1558
|
+
return () => cancelAnimationFrame(raf);
|
|
1559
|
+
}
|
|
1560
|
+
setMaxHeight(el.scrollHeight);
|
|
1561
|
+
const raf = requestAnimationFrame(() => setMaxHeight(0));
|
|
1562
|
+
return () => cancelAnimationFrame(raf);
|
|
1563
|
+
}, [open]);
|
|
1564
|
+
React9.useEffect(() => {
|
|
1565
|
+
if (!open)
|
|
1566
|
+
return;
|
|
1567
|
+
const el = contentRef.current;
|
|
1568
|
+
if (!el)
|
|
1569
|
+
return;
|
|
1570
|
+
const observer = new ResizeObserver(() => setMaxHeight(el.scrollHeight));
|
|
1571
|
+
observer.observe(el);
|
|
1572
|
+
return () => observer.disconnect();
|
|
1573
|
+
}, [open]);
|
|
1574
|
+
return /* @__PURE__ */ jsxDEV14("div", {
|
|
1575
|
+
className: "overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.25,1,0.5,1)]",
|
|
1576
|
+
style: { maxHeight: maxHeight === Infinity ? "none" : `${maxHeight}px` },
|
|
1577
|
+
children: /* @__PURE__ */ jsxDEV14("div", {
|
|
1578
|
+
ref: contentRef,
|
|
1579
|
+
className: "flex flex-col gap-1",
|
|
1580
|
+
children
|
|
1581
|
+
}, undefined, false, undefined, this)
|
|
1582
|
+
}, undefined, false, undefined, this);
|
|
1583
|
+
}
|
|
1584
|
+
var DefaultLink = React9.forwardRef(({ to, className, title, children, ...props }, ref) => {
|
|
1585
|
+
return /* @__PURE__ */ jsxDEV14("a", {
|
|
1586
|
+
ref,
|
|
1587
|
+
href: to,
|
|
1588
|
+
className,
|
|
1589
|
+
title,
|
|
1590
|
+
...props,
|
|
1591
|
+
children
|
|
1592
|
+
}, undefined, false, undefined, this);
|
|
1593
|
+
});
|
|
1594
|
+
DefaultLink.displayName = "DefaultLink";
|
|
1595
|
+
function SidebarMenu2({
|
|
1596
|
+
groups,
|
|
1597
|
+
currentPath,
|
|
1598
|
+
open,
|
|
1599
|
+
onRequestOpen,
|
|
1600
|
+
linkComponent: Link = DefaultLink,
|
|
1601
|
+
storageKeyPrefix,
|
|
1602
|
+
className = "",
|
|
1603
|
+
itemIndentPx = DEFAULT_ITEM_INDENT_PX,
|
|
1604
|
+
itemIndentPaddingPx = DEFAULT_ITEM_INDENT_PADDING_PX
|
|
1605
|
+
}) {
|
|
1606
|
+
const groupsKey = storageKeyPrefix ? `${storageKeyPrefix}_collapsed_groups` : null;
|
|
1607
|
+
const captionsKey = storageKeyPrefix ? `${storageKeyPrefix}_collapsed_captions` : null;
|
|
1608
|
+
const [collapsedGroups, setCollapsedGroups] = React9.useState(() => {
|
|
1609
|
+
if (!groupsKey)
|
|
1610
|
+
return {};
|
|
1611
|
+
const stored = localStorage.getItem(groupsKey);
|
|
1612
|
+
return stored ? JSON.parse(stored) : {};
|
|
1613
|
+
});
|
|
1614
|
+
const [collapsedCaptions, setCollapsedCaptions] = React9.useState(() => {
|
|
1615
|
+
const initial = {};
|
|
1616
|
+
groups.forEach((g) => {
|
|
1617
|
+
if (g.defaultCollapsed) {
|
|
1618
|
+
initial[g.key] = true;
|
|
1619
|
+
}
|
|
1620
|
+
});
|
|
1621
|
+
if (!captionsKey)
|
|
1622
|
+
return initial;
|
|
1623
|
+
const stored = localStorage.getItem(captionsKey);
|
|
1624
|
+
return stored ? { ...initial, ...JSON.parse(stored) } : initial;
|
|
1625
|
+
});
|
|
1626
|
+
React9.useEffect(() => {
|
|
1627
|
+
if (groupsKey)
|
|
1628
|
+
localStorage.setItem(groupsKey, JSON.stringify(collapsedGroups));
|
|
1629
|
+
}, [groupsKey, collapsedGroups]);
|
|
1630
|
+
React9.useEffect(() => {
|
|
1631
|
+
if (captionsKey)
|
|
1632
|
+
localStorage.setItem(captionsKey, JSON.stringify(collapsedCaptions));
|
|
1633
|
+
}, [captionsKey, collapsedCaptions]);
|
|
1634
|
+
function toggleGroup(key, currentExpanded) {
|
|
1635
|
+
setCollapsedGroups((prev) => ({ ...prev, [key]: currentExpanded }));
|
|
1636
|
+
}
|
|
1637
|
+
function isGroupExpanded(key, isActive) {
|
|
1638
|
+
if (collapsedGroups[key] !== undefined) {
|
|
1639
|
+
return !collapsedGroups[key];
|
|
1640
|
+
}
|
|
1641
|
+
return isActive;
|
|
1642
|
+
}
|
|
1643
|
+
function toggleCaption(key) {
|
|
1644
|
+
setCollapsedCaptions((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
1645
|
+
}
|
|
1646
|
+
function isCaptionExpanded(key) {
|
|
1647
|
+
return !collapsedCaptions[key];
|
|
1648
|
+
}
|
|
1649
|
+
function renderEntry(entry, depth, groupKey) {
|
|
1650
|
+
if (entry.children) {
|
|
1651
|
+
const entryKey = `${groupKey}::${entry.label}`;
|
|
1652
|
+
const entryActive = isEntryActive(entry, currentPath);
|
|
1653
|
+
const expanded = isGroupExpanded(entryKey, entryActive);
|
|
1654
|
+
const btn = /* @__PURE__ */ jsxDEV14("button", {
|
|
1655
|
+
type: "button",
|
|
1656
|
+
onClick: open ? () => toggleGroup(entryKey, expanded) : onRequestOpen,
|
|
1657
|
+
className: cn2("group relative flex items-center rounded-md font-medium transition-colors h-[var(--sidebar-menu-height,36px)] text-[length:var(--sidebar-text-size,13px)] focus:outline-none focus-visible:outline-none", open ? "w-full gap-3 px-2.5" : "justify-center px-0 w-9 mx-auto", entryActive ? "text-[color:var(--color-sidebar-foreground)] bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_15%,transparent)]" : "text-[color:var(--color-sidebar-foreground)] hover:bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] hover:text-[color:var(--color-sidebar-foreground)]"),
|
|
1658
|
+
children: [
|
|
1659
|
+
depth === 0 && (entry.icon ? /* @__PURE__ */ jsxDEV14(Icon2, {
|
|
1660
|
+
name: entry.icon,
|
|
1661
|
+
size: "var(--sidebar-icon-size,18px)",
|
|
1662
|
+
className: cn2("flex-none group-hover:opacity-100", entryActive ? "opacity-100" : "opacity-80")
|
|
1663
|
+
}, undefined, false, undefined, this) : !open && /* @__PURE__ */ jsxDEV14("span", {
|
|
1664
|
+
className: cn2("flex-none font-bold uppercase flex items-center justify-center w-[var(--sidebar-icon-size,18px)] h-[var(--sidebar-icon-size,18px)] text-[14px] leading-none select-none", entryActive ? "opacity-100" : "opacity-80"),
|
|
1665
|
+
children: entry.label.charAt(0)
|
|
1666
|
+
}, undefined, false, undefined, this)),
|
|
1667
|
+
open && /* @__PURE__ */ jsxDEV14(Fragment, {
|
|
1668
|
+
children: [
|
|
1669
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
1670
|
+
className: "flex-1 truncate text-start",
|
|
1671
|
+
children: entry.label
|
|
1672
|
+
}, undefined, false, undefined, this),
|
|
1673
|
+
/* @__PURE__ */ jsxDEV14(Icon2, {
|
|
1674
|
+
name: "chevronDown",
|
|
1675
|
+
size: 14,
|
|
1676
|
+
className: cn2("flex-none opacity-60 transition-transform duration-150", !expanded && "ltr:-rotate-90 rtl:rotate-90")
|
|
1677
|
+
}, undefined, false, undefined, this)
|
|
1678
|
+
]
|
|
1679
|
+
}, undefined, true, undefined, this)
|
|
1680
|
+
]
|
|
1681
|
+
}, undefined, true, undefined, this);
|
|
1682
|
+
return /* @__PURE__ */ jsxDEV14("div", {
|
|
1683
|
+
className: "flex flex-col",
|
|
1684
|
+
children: [
|
|
1685
|
+
/* @__PURE__ */ jsxDEV14(Dropdown2, {
|
|
1686
|
+
side: "right",
|
|
1687
|
+
children: [
|
|
1688
|
+
/* @__PURE__ */ jsxDEV14(PortalTooltip2, {
|
|
1689
|
+
content: entry.label,
|
|
1690
|
+
side: "right",
|
|
1691
|
+
disabled: open,
|
|
1692
|
+
children: /* @__PURE__ */ jsxDEV14(DropdownTrigger2, {
|
|
1693
|
+
asChild: true,
|
|
1694
|
+
disabled: open,
|
|
1695
|
+
children: btn
|
|
1696
|
+
}, undefined, false, undefined, this)
|
|
1697
|
+
}, undefined, false, undefined, this),
|
|
1698
|
+
!open && /* @__PURE__ */ jsxDEV14(DropdownContent2, {
|
|
1699
|
+
className: "min-w-0 w-[200px] p-1.5 ml-1",
|
|
1700
|
+
children: entry.children.map((child) => /* @__PURE__ */ jsxDEV14(Link, {
|
|
1701
|
+
to: child.to ?? "#",
|
|
1702
|
+
onClick: () => {
|
|
1703
|
+
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
|
|
1704
|
+
},
|
|
1705
|
+
className: "flex w-full items-center text-left transition-colors gap-2 px-2.5 py-1.5 text-[13px] rounded-sm text-[color:var(--color-foreground)] hover:bg-hover hover:text-[color:var(--color-foreground)]",
|
|
1706
|
+
children: [
|
|
1707
|
+
child.icon && /* @__PURE__ */ jsxDEV14(Icon2, {
|
|
1708
|
+
name: child.icon,
|
|
1709
|
+
className: "h-4 w-4 flex-none"
|
|
1710
|
+
}, undefined, false, undefined, this),
|
|
1711
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
1712
|
+
className: "truncate",
|
|
1713
|
+
children: child.label
|
|
1714
|
+
}, undefined, false, undefined, this)
|
|
1715
|
+
]
|
|
1716
|
+
}, child.to ?? child.label, true, undefined, this))
|
|
1717
|
+
}, undefined, false, undefined, this)
|
|
1718
|
+
]
|
|
1719
|
+
}, undefined, true, undefined, this),
|
|
1720
|
+
open && /* @__PURE__ */ jsxDEV14(CollapsibleSection, {
|
|
1721
|
+
open: expanded,
|
|
1722
|
+
children: /* @__PURE__ */ jsxDEV14("div", {
|
|
1723
|
+
className: "flex flex-col gap-0.5 border-s border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] py-0.5",
|
|
1724
|
+
style: { marginInlineStart: itemIndentPx, paddingInlineStart: itemIndentPaddingPx },
|
|
1725
|
+
children: entry.children.map((child) => renderEntry(child, depth + 1, groupKey))
|
|
1726
|
+
}, undefined, false, undefined, this)
|
|
1727
|
+
}, undefined, false, undefined, this)
|
|
1728
|
+
]
|
|
1729
|
+
}, entryKey, true, undefined, this);
|
|
1730
|
+
}
|
|
1731
|
+
const isNested = depth > 0;
|
|
1732
|
+
const isActive = entry.to === "/" ? currentPath === "/" : currentPath === entry.to;
|
|
1733
|
+
const lnk = /* @__PURE__ */ jsxDEV14(Link, {
|
|
1734
|
+
to: entry.to,
|
|
1735
|
+
"aria-label": entry.label,
|
|
1736
|
+
title: entry.label,
|
|
1737
|
+
className: cn2("group relative flex items-center rounded-md font-medium transition-colors focus:outline-none focus-visible:outline-none", open ? "gap-3 px-2.5" : "justify-center px-0 w-9 mx-auto", isNested ? "h-[var(--sidebar-sub-menu-height,32px)] text-[length:var(--sidebar-text-sub-size,12.5px)]" : "h-[var(--sidebar-menu-height,36px)] text-[length:var(--sidebar-text-size,13px)]", isActive ? isNested ? "bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] text-[color:var(--color-sidebar-foreground)]" : "bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_15%,transparent)] text-[color:var(--color-sidebar-foreground)]" : "text-[color:var(--color-sidebar-foreground)] hover:bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] hover:text-[color:var(--color-sidebar-foreground)]"),
|
|
1738
|
+
children: [
|
|
1739
|
+
depth === 0 && (entry.icon ? /* @__PURE__ */ jsxDEV14(Icon2, {
|
|
1740
|
+
name: entry.icon,
|
|
1741
|
+
size: "var(--sidebar-icon-size,18px)",
|
|
1742
|
+
className: cn2("flex-none group-hover:opacity-100", isActive ? "opacity-100" : "opacity-80")
|
|
1743
|
+
}, undefined, false, undefined, this) : !open && /* @__PURE__ */ jsxDEV14("span", {
|
|
1744
|
+
className: cn2("flex-none font-bold uppercase flex items-center justify-center w-[var(--sidebar-icon-size,18px)] h-[var(--sidebar-icon-size,18px)] text-[14px] leading-none select-none", isActive ? "opacity-100" : "opacity-80"),
|
|
1745
|
+
children: entry.label.charAt(0)
|
|
1746
|
+
}, undefined, false, undefined, this)),
|
|
1747
|
+
open && /* @__PURE__ */ jsxDEV14(Fragment, {
|
|
1748
|
+
children: [
|
|
1749
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
1750
|
+
className: "truncate flex-1 text-start",
|
|
1751
|
+
children: entry.label
|
|
1752
|
+
}, undefined, false, undefined, this),
|
|
1753
|
+
entry.badge && /* @__PURE__ */ jsxDEV14("span", {
|
|
1754
|
+
className: "ms-auto flex h-4.5 items-center justify-center rounded-full bg-blue-600 px-1.5 text-[10px] font-semibold text-white leading-none",
|
|
1755
|
+
children: entry.badge
|
|
1756
|
+
}, undefined, false, undefined, this)
|
|
1757
|
+
]
|
|
1758
|
+
}, undefined, true, undefined, this)
|
|
1759
|
+
]
|
|
1760
|
+
}, entry.to, true, undefined, this);
|
|
1761
|
+
return !open ? /* @__PURE__ */ jsxDEV14(PortalTooltip2, {
|
|
1762
|
+
content: entry.label,
|
|
1763
|
+
side: "right",
|
|
1764
|
+
children: lnk
|
|
1765
|
+
}, entry.to, false, undefined, this) : lnk;
|
|
1766
|
+
}
|
|
1767
|
+
return /* @__PURE__ */ jsxDEV14("nav", {
|
|
1768
|
+
className: cn2("flex-1 overflow-y-auto px-2.5 pt-2.5 pb-6", className),
|
|
1769
|
+
children: groups.map((group, groupIdx) => {
|
|
1770
|
+
const captionExpanded = isCaptionExpanded(group.key);
|
|
1771
|
+
return /* @__PURE__ */ jsxDEV14("div", {
|
|
1772
|
+
className: groupIdx > 0 ? "mt-4" : undefined,
|
|
1773
|
+
children: [
|
|
1774
|
+
groupIdx > 0 && /* @__PURE__ */ jsxDEV14("div", {
|
|
1775
|
+
className: "mx-2.5 mb-2 border-t border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)]"
|
|
1776
|
+
}, undefined, false, undefined, this),
|
|
1777
|
+
open ? /* @__PURE__ */ jsxDEV14("button", {
|
|
1778
|
+
type: "button",
|
|
1779
|
+
onClick: () => toggleCaption(group.key),
|
|
1780
|
+
className: "group flex w-full items-center justify-between px-2.5 pb-1.5 text-[11px] font-semibold uppercase tracking-wide text-[color:var(--color-sidebar-foreground)]/50 hover:text-[color:var(--color-sidebar-foreground)]/80 focus:outline-none focus-visible:outline-none",
|
|
1781
|
+
children: [
|
|
1782
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
1783
|
+
children: group.caption
|
|
1784
|
+
}, undefined, false, undefined, this),
|
|
1785
|
+
/* @__PURE__ */ jsxDEV14(Icon2, {
|
|
1786
|
+
name: "chevronDown",
|
|
1787
|
+
size: 12,
|
|
1788
|
+
className: cn2("flex-none opacity-60 transition-transform duration-150", !captionExpanded && "ltr:-rotate-90 rtl:rotate-90")
|
|
1789
|
+
}, undefined, false, undefined, this)
|
|
1790
|
+
]
|
|
1791
|
+
}, undefined, true, undefined, this) : null,
|
|
1792
|
+
/* @__PURE__ */ jsxDEV14(CollapsibleSection, {
|
|
1793
|
+
open: !open || captionExpanded,
|
|
1794
|
+
children: group.items.map((item) => renderEntry(item, 0, group.key))
|
|
1795
|
+
}, undefined, false, undefined, this)
|
|
1796
|
+
]
|
|
1797
|
+
}, group.key, true, undefined, this);
|
|
1798
|
+
})
|
|
1799
|
+
}, undefined, false, undefined, this);
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
// src/components/ui/sidebar-search.tsx
|
|
1803
|
+
import * as React10 from "react";
|
|
1804
|
+
import { jsxDEV as jsxDEV15 } from "react/jsx-dev-runtime";
|
|
1805
|
+
var SidebarSearch2 = React10.forwardRef(({ open = true, onSearchClick, className, ...props }, ref) => {
|
|
1806
|
+
if (!open) {
|
|
1807
|
+
return /* @__PURE__ */ jsxDEV15("div", {
|
|
1808
|
+
className: "flex justify-center p-2 mb-2",
|
|
1809
|
+
children: /* @__PURE__ */ jsxDEV15(PortalTooltip2, {
|
|
1810
|
+
content: "Search",
|
|
1811
|
+
side: "right",
|
|
1812
|
+
children: /* @__PURE__ */ jsxDEV15("button", {
|
|
1813
|
+
type: "button",
|
|
1814
|
+
onClick: onSearchClick,
|
|
1815
|
+
className: "group relative flex items-center justify-center rounded-md font-medium transition-colors h-[var(--sidebar-menu-height,36px)] w-9 mx-auto text-[color:var(--color-sidebar-foreground)] hover:bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] hover:text-[color:var(--color-sidebar-foreground)]",
|
|
1816
|
+
children: /* @__PURE__ */ jsxDEV15(Icon2, {
|
|
1817
|
+
name: "search",
|
|
1818
|
+
size: "var(--sidebar-icon-size,18px)",
|
|
1819
|
+
className: "flex-none opacity-80 group-hover:opacity-100"
|
|
1820
|
+
}, undefined, false, undefined, this)
|
|
1821
|
+
}, undefined, false, undefined, this)
|
|
1822
|
+
}, undefined, false, undefined, this)
|
|
1823
|
+
}, undefined, false, undefined, this);
|
|
1824
|
+
}
|
|
1825
|
+
return /* @__PURE__ */ jsxDEV15("div", {
|
|
1826
|
+
className: cn2("p-3 mb-2", className),
|
|
1827
|
+
children: /* @__PURE__ */ jsxDEV15("div", {
|
|
1828
|
+
className: "relative w-full",
|
|
1829
|
+
children: [
|
|
1830
|
+
/* @__PURE__ */ jsxDEV15(Input2, {
|
|
1831
|
+
ref,
|
|
1832
|
+
placeholder: "Search...",
|
|
1833
|
+
inputSize: "sm",
|
|
1834
|
+
className: cn2("w-full !bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_5%,transparent)] !border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_15%,transparent)]", "focus-within:!bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] focus-within:!border-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_25%,transparent)]", "focus-within:!ring-[3px] focus-within:!ring-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)] focus-within:!ring-offset-transparent"),
|
|
1835
|
+
inputClassName: "!pr-9 !text-[color:var(--color-sidebar-foreground)] placeholder:!text-[color:var(--color-sidebar-foreground)] placeholder:opacity-50",
|
|
1836
|
+
...props
|
|
1837
|
+
}, undefined, false, undefined, this),
|
|
1838
|
+
/* @__PURE__ */ jsxDEV15("div", {
|
|
1839
|
+
className: "absolute right-1 top-1/2 flex -translate-y-1/2 items-center",
|
|
1840
|
+
children: /* @__PURE__ */ jsxDEV15(Button2, {
|
|
1841
|
+
type: "button",
|
|
1842
|
+
variant: "ghost",
|
|
1843
|
+
size: "xs",
|
|
1844
|
+
onClick: onSearchClick,
|
|
1845
|
+
className: "px-1.5 text-[color:var(--color-sidebar-foreground)] opacity-70 hover:opacity-100 hover:bg-[color:color-mix(in_srgb,var(--color-sidebar-foreground)_10%,transparent)]",
|
|
1846
|
+
children: [
|
|
1847
|
+
/* @__PURE__ */ jsxDEV15("span", {
|
|
1848
|
+
className: "sr-only",
|
|
1849
|
+
children: "Search"
|
|
1850
|
+
}, undefined, false, undefined, this),
|
|
1851
|
+
/* @__PURE__ */ jsxDEV15(Icon2, {
|
|
1852
|
+
name: "search",
|
|
1853
|
+
size: 14
|
|
1854
|
+
}, undefined, false, undefined, this)
|
|
1855
|
+
]
|
|
1856
|
+
}, undefined, true, undefined, this)
|
|
1857
|
+
}, undefined, false, undefined, this)
|
|
1858
|
+
]
|
|
1859
|
+
}, undefined, true, undefined, this)
|
|
1860
|
+
}, undefined, false, undefined, this);
|
|
1861
|
+
});
|
|
1862
|
+
SidebarSearch2.displayName = "SidebarSearch";
|
|
1863
|
+
|
|
1864
|
+
// src/components/ui/theme-toggle.tsx
|
|
1865
|
+
import { jsxDEV as jsxDEV16 } from "react/jsx-dev-runtime";
|
|
1866
|
+
function ThemeToggle2({
|
|
1867
|
+
value,
|
|
1868
|
+
onChange,
|
|
1869
|
+
size = "sm",
|
|
1870
|
+
radius = "md",
|
|
1871
|
+
className = "",
|
|
1872
|
+
options,
|
|
1873
|
+
iconOnly = true
|
|
1874
|
+
}) {
|
|
1875
|
+
const iconSize = size === "sm" ? 15 : 17;
|
|
1876
|
+
const defaultOptions = [
|
|
1877
|
+
{ label: /* @__PURE__ */ jsxDEV16(Icon2, {
|
|
1878
|
+
name: "sun",
|
|
1879
|
+
size: iconSize,
|
|
1880
|
+
className: value === "dark" ? "text-amber-400" : undefined
|
|
1881
|
+
}, undefined, false, undefined, this), value: "light", color: "primary", ariaLabel: "Ganti ke tema terang", title: "Tema Terang" },
|
|
1882
|
+
{ label: /* @__PURE__ */ jsxDEV16(Icon2, {
|
|
1883
|
+
name: "moon",
|
|
1884
|
+
size: iconSize
|
|
1885
|
+
}, undefined, false, undefined, this), value: "dark", color: "primary", ariaLabel: "Ganti ke tema gelap", title: "Tema Gelap" }
|
|
1886
|
+
];
|
|
1887
|
+
return /* @__PURE__ */ jsxDEV16("div", {
|
|
1888
|
+
className,
|
|
1889
|
+
children: /* @__PURE__ */ jsxDEV16(SelectGroup2, {
|
|
1890
|
+
size,
|
|
1891
|
+
radius,
|
|
1892
|
+
iconOnly,
|
|
1893
|
+
value,
|
|
1894
|
+
onChange: (val) => onChange(val),
|
|
1895
|
+
options: options || defaultOptions
|
|
1896
|
+
}, undefined, false, undefined, this)
|
|
1897
|
+
}, undefined, false, undefined, this);
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
// src/components/ui/grid.tsx
|
|
1901
|
+
import * as React11 from "react";
|
|
1902
|
+
import { jsxDEV as jsxDEV17 } from "react/jsx-dev-runtime";
|
|
1903
|
+
var GAP_CLASS = {
|
|
1904
|
+
0: "gap-0",
|
|
1905
|
+
1: "gap-1",
|
|
1906
|
+
2: "gap-2",
|
|
1907
|
+
3: "gap-3",
|
|
1908
|
+
4: "gap-4",
|
|
1909
|
+
5: "gap-5",
|
|
1910
|
+
6: "gap-6",
|
|
1911
|
+
8: "gap-8",
|
|
1912
|
+
10: "gap-10",
|
|
1913
|
+
12: "gap-12"
|
|
1914
|
+
};
|
|
1915
|
+
var Grid2 = React11.forwardRef(({ className, gap = 4, ...props }, ref) => /* @__PURE__ */ jsxDEV17("div", {
|
|
1916
|
+
ref,
|
|
1917
|
+
className: cn2("grid grid-cols-12", GAP_CLASS[gap] ?? GAP_CLASS[4], className),
|
|
1918
|
+
...props
|
|
1919
|
+
}, undefined, false, undefined, this));
|
|
1920
|
+
Grid2.displayName = "Grid";
|
|
1921
|
+
function normalizeSpan(span) {
|
|
1922
|
+
return typeof span === "number" ? { base: span } : span;
|
|
1923
|
+
}
|
|
1924
|
+
var GridItem2 = React11.forwardRef(({ className, span, visible, ...props }, ref) => {
|
|
1925
|
+
const resolved = normalizeSpan(span);
|
|
1926
|
+
const spanClasses = Object.keys(resolved).map((bp) => getColSpanClass2(resolved[bp], bp)).filter(Boolean).join(" ");
|
|
1927
|
+
const visibleClasses = visible ? sectionVisibilityClass2(visible) : "";
|
|
1928
|
+
return /* @__PURE__ */ jsxDEV17("div", {
|
|
1929
|
+
ref,
|
|
1930
|
+
className: cn2(spanClasses, visibleClasses, className),
|
|
1931
|
+
...props
|
|
1932
|
+
}, undefined, false, undefined, this);
|
|
1933
|
+
});
|
|
1934
|
+
GridItem2.displayName = "GridItem";
|
|
1935
|
+
|
|
1936
|
+
// src/components/ui/print.tsx
|
|
1937
|
+
import * as React12 from "react";
|
|
1938
|
+
import { jsxDEV as jsxDEV18, Fragment as Fragment2 } from "react/jsx-dev-runtime";
|
|
1939
|
+
function resolveTargetHtml(target, contentHtml) {
|
|
1940
|
+
if (contentHtml)
|
|
1941
|
+
return contentHtml;
|
|
1942
|
+
if (!target)
|
|
1943
|
+
return "";
|
|
1944
|
+
let element = null;
|
|
1945
|
+
if (typeof target === "string") {
|
|
1946
|
+
element = document.querySelector(target);
|
|
1947
|
+
} else if ("current" in target) {
|
|
1948
|
+
element = target.current;
|
|
1949
|
+
} else if (target instanceof HTMLElement) {
|
|
1950
|
+
element = target;
|
|
1951
|
+
}
|
|
1952
|
+
if (!element) {
|
|
1953
|
+
console.warn(`[Deweb Print] Target elemen tidak ditemukan:`, target);
|
|
1954
|
+
return "";
|
|
1955
|
+
}
|
|
1956
|
+
return element.outerHTML || element.innerHTML;
|
|
1957
|
+
}
|
|
1958
|
+
function collectParentStylesheets() {
|
|
1959
|
+
let styles = "";
|
|
1960
|
+
const links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
1961
|
+
links.forEach((link) => {
|
|
1962
|
+
styles += `<link rel="stylesheet" href="${link.href}" />
|
|
1963
|
+
`;
|
|
1964
|
+
});
|
|
1965
|
+
const styleTags = document.querySelectorAll("style");
|
|
1966
|
+
styleTags.forEach((styleTag) => {
|
|
1967
|
+
styles += `<style>${styleTag.innerHTML}</style>
|
|
1968
|
+
`;
|
|
1969
|
+
});
|
|
1970
|
+
return styles;
|
|
1971
|
+
}
|
|
1972
|
+
function buildPrintCss({
|
|
1973
|
+
orientation = "portrait",
|
|
1974
|
+
paperSize = "A4",
|
|
1975
|
+
pageMargin = "15mm",
|
|
1976
|
+
hideBrowserMetadata = true,
|
|
1977
|
+
documentStyle = "document",
|
|
1978
|
+
stripCardStyling = true,
|
|
1979
|
+
watermark,
|
|
1980
|
+
extraCss = ""
|
|
1981
|
+
}) {
|
|
1982
|
+
const pageMarginRule = hideBrowserMetadata ? "0" : pageMargin;
|
|
1983
|
+
const bodyPaddingRule = hideBrowserMetadata ? `0 ${pageMargin}` : "0";
|
|
1984
|
+
let baseTypography = "";
|
|
1985
|
+
if (documentStyle === "document" || documentStyle === "clean-word") {
|
|
1986
|
+
baseTypography = `
|
|
1987
|
+
body {
|
|
1988
|
+
margin: 0 !important;
|
|
1989
|
+
padding: ${bodyPaddingRule} !important;
|
|
1990
|
+
background: #ffffff !important;
|
|
1991
|
+
color: #1f2937 !important;
|
|
1992
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
1993
|
+
font-size: 13.5px;
|
|
1994
|
+
line-height: 1.65;
|
|
1995
|
+
-webkit-font-smoothing: antialiased;
|
|
1996
|
+
}
|
|
1997
|
+
.deweb-print-container {
|
|
1998
|
+
width: 100%;
|
|
1999
|
+
max-width: 100%;
|
|
2000
|
+
margin: 0 auto;
|
|
2001
|
+
}
|
|
2002
|
+
.deweb-print-page-table {
|
|
2003
|
+
width: 100% !important;
|
|
2004
|
+
border: none !important;
|
|
2005
|
+
border-collapse: collapse !important;
|
|
2006
|
+
margin: 0 !important;
|
|
2007
|
+
padding: 0 !important;
|
|
2008
|
+
}
|
|
2009
|
+
.deweb-print-page-table > thead {
|
|
2010
|
+
display: table-header-group;
|
|
2011
|
+
}
|
|
2012
|
+
.deweb-print-page-table > tfoot {
|
|
2013
|
+
display: table-footer-group;
|
|
2014
|
+
}
|
|
2015
|
+
.deweb-print-page-table > thead > tr > td,
|
|
2016
|
+
.deweb-print-page-table > tfoot > tr > td,
|
|
2017
|
+
.deweb-print-page-table > tbody > tr > td {
|
|
2018
|
+
border: none !important;
|
|
2019
|
+
padding: 0 !important;
|
|
2020
|
+
background: transparent !important;
|
|
2021
|
+
}
|
|
2022
|
+
.deweb-print-header {
|
|
2023
|
+
margin-bottom: 16px;
|
|
2024
|
+
break-inside: avoid;
|
|
2025
|
+
page-break-inside: avoid;
|
|
2026
|
+
}
|
|
2027
|
+
.deweb-print-first-page-header {
|
|
2028
|
+
margin-bottom: 18px;
|
|
2029
|
+
break-inside: avoid;
|
|
2030
|
+
page-break-inside: avoid;
|
|
2031
|
+
}
|
|
2032
|
+
.deweb-print-footer {
|
|
2033
|
+
margin-top: 24px;
|
|
2034
|
+
break-inside: avoid;
|
|
2035
|
+
page-break-inside: avoid;
|
|
2036
|
+
}
|
|
2037
|
+
.deweb-print-last-page-footer {
|
|
2038
|
+
margin-top: 24px;
|
|
2039
|
+
break-inside: avoid;
|
|
2040
|
+
page-break-inside: avoid;
|
|
2041
|
+
}
|
|
2042
|
+
.deweb-print-running-header {
|
|
2043
|
+
width: 100%;
|
|
2044
|
+
font-size: 10px;
|
|
2045
|
+
color: #94a3b8;
|
|
2046
|
+
border-bottom: 1px solid #f1f5f9;
|
|
2047
|
+
padding-bottom: 4px;
|
|
2048
|
+
}
|
|
2049
|
+
.deweb-print-running-footer {
|
|
2050
|
+
width: 100%;
|
|
2051
|
+
font-size: 10px;
|
|
2052
|
+
color: #94a3b8;
|
|
2053
|
+
border-top: 1px solid #f1f5f9;
|
|
2054
|
+
padding-top: 4px;
|
|
2055
|
+
}
|
|
2056
|
+
h1, h2, h3, h4, h5, h6 {
|
|
2057
|
+
color: #111827 !important;
|
|
2058
|
+
font-weight: 700;
|
|
2059
|
+
line-height: 1.3;
|
|
2060
|
+
margin-top: 0;
|
|
2061
|
+
}
|
|
2062
|
+
h1 { font-size: 22px; margin-bottom: 12px; }
|
|
2063
|
+
h2 { font-size: 18px; margin-bottom: 10px; }
|
|
2064
|
+
h3 { font-size: 15px; margin-bottom: 8px; }
|
|
2065
|
+
p { margin-top: 0; margin-bottom: 10px; }
|
|
2066
|
+
table {
|
|
2067
|
+
width: 100%;
|
|
2068
|
+
max-width: 100% !important;
|
|
2069
|
+
border-collapse: collapse;
|
|
2070
|
+
margin: 16px 0;
|
|
2071
|
+
font-size: 12.5px;
|
|
2072
|
+
}
|
|
2073
|
+
.deweb-print-body table,
|
|
2074
|
+
.deweb-print-body div,
|
|
2075
|
+
.deweb-print-body [style*="width:"] {
|
|
2076
|
+
max-width: 100% !important;
|
|
2077
|
+
box-sizing: border-box !important;
|
|
2078
|
+
}
|
|
2079
|
+
table th, table td {
|
|
2080
|
+
border: 1px solid #e5e7eb !important;
|
|
2081
|
+
padding: 8px 12px;
|
|
2082
|
+
text-align: left;
|
|
2083
|
+
}
|
|
2084
|
+
table th {
|
|
2085
|
+
background-color: #f9fafb !important;
|
|
2086
|
+
font-weight: 600;
|
|
2087
|
+
color: #374151;
|
|
2088
|
+
}
|
|
2089
|
+
blockquote {
|
|
2090
|
+
margin: 14px 0;
|
|
2091
|
+
padding: 8px 16px;
|
|
2092
|
+
border-left: 3px solid #3b82f6;
|
|
2093
|
+
background-color: #f8fafc;
|
|
2094
|
+
color: #475569;
|
|
2095
|
+
font-style: italic;
|
|
2096
|
+
}
|
|
2097
|
+
hr {
|
|
2098
|
+
border: 0;
|
|
2099
|
+
border-top: 1px solid #e5e7eb;
|
|
2100
|
+
margin: 20px 0;
|
|
2101
|
+
}
|
|
2102
|
+
img {
|
|
2103
|
+
max-width: 100%;
|
|
2104
|
+
height: auto;
|
|
2105
|
+
}
|
|
2106
|
+
`;
|
|
2107
|
+
} else if (documentStyle === "minimal") {
|
|
2108
|
+
baseTypography = `
|
|
2109
|
+
body {
|
|
2110
|
+
margin: 0 !important;
|
|
2111
|
+
padding: ${bodyPaddingRule} !important;
|
|
2112
|
+
background: #ffffff !important;
|
|
2113
|
+
color: #000000 !important;
|
|
2114
|
+
font-family: inherit;
|
|
2115
|
+
font-size: 13px;
|
|
2116
|
+
line-height: 1.5;
|
|
2117
|
+
}
|
|
2118
|
+
`;
|
|
2119
|
+
}
|
|
2120
|
+
const stripCardRule = stripCardStyling ? `
|
|
2121
|
+
.deweb-print-body > *:first-child,
|
|
2122
|
+
.deweb-print-body > * {
|
|
2123
|
+
border: none !important;
|
|
2124
|
+
border-width: 0 !important;
|
|
2125
|
+
box-shadow: none !important;
|
|
2126
|
+
border-radius: 0 !important;
|
|
2127
|
+
background: transparent !important;
|
|
2128
|
+
outline: none !important;
|
|
2129
|
+
padding-left: 0 !important;
|
|
2130
|
+
padding-right: 0 !important;
|
|
2131
|
+
padding-top: 0 !important;
|
|
2132
|
+
margin-left: 0 !important;
|
|
2133
|
+
margin-right: 0 !important;
|
|
2134
|
+
}
|
|
2135
|
+
.deweb-print-body [class*="shadow-"],
|
|
2136
|
+
.deweb-print-body [class*="shadow"] {
|
|
2137
|
+
box-shadow: none !important;
|
|
2138
|
+
}
|
|
2139
|
+
.deweb-print-body [class*="rounded-xl"],
|
|
2140
|
+
.deweb-print-body [class*="rounded-2xl"],
|
|
2141
|
+
.deweb-print-body [class*="rounded-lg"],
|
|
2142
|
+
.deweb-print-body [class*="rounded-md"] {
|
|
2143
|
+
border-radius: 0 !important;
|
|
2144
|
+
}
|
|
2145
|
+
` : "";
|
|
2146
|
+
const watermarkRule = watermark ? `
|
|
2147
|
+
body::before {
|
|
2148
|
+
content: '${watermark}';
|
|
2149
|
+
position: fixed;
|
|
2150
|
+
top: 50%;
|
|
2151
|
+
left: 50%;
|
|
2152
|
+
transform: translate(-50%, -50%) rotate(-35deg);
|
|
2153
|
+
font-size: 80px;
|
|
2154
|
+
font-weight: 800;
|
|
2155
|
+
color: rgba(0, 0, 0, 0.05);
|
|
2156
|
+
pointer-events: none;
|
|
2157
|
+
z-index: 99999;
|
|
2158
|
+
text-transform: uppercase;
|
|
2159
|
+
letter-spacing: 0.15em;
|
|
2160
|
+
white-space: nowrap;
|
|
2161
|
+
}
|
|
2162
|
+
` : "";
|
|
2163
|
+
return `
|
|
2164
|
+
@page {
|
|
2165
|
+
size: ${paperSize} ${orientation};
|
|
2166
|
+
margin: ${pageMarginRule};
|
|
2167
|
+
}
|
|
2168
|
+
* {
|
|
2169
|
+
box-sizing: border-box;
|
|
2170
|
+
-webkit-print-color-adjust: exact !important;
|
|
2171
|
+
print-color-adjust: exact !important;
|
|
2172
|
+
}
|
|
2173
|
+
html {
|
|
2174
|
+
background: #ffffff !important;
|
|
2175
|
+
}
|
|
2176
|
+
.no-print, [data-no-print], button, .btn {
|
|
2177
|
+
display: none !important;
|
|
2178
|
+
}
|
|
2179
|
+
${baseTypography}
|
|
2180
|
+
${stripCardRule}
|
|
2181
|
+
${watermarkRule}
|
|
2182
|
+
${extraCss}
|
|
2183
|
+
`;
|
|
2184
|
+
}
|
|
2185
|
+
async function printElement2(options) {
|
|
2186
|
+
const {
|
|
2187
|
+
target,
|
|
2188
|
+
contentHtml,
|
|
2189
|
+
documentTitle = document.title || "Dokumen Cetak",
|
|
2190
|
+
hideBrowserMetadata = true,
|
|
2191
|
+
orientation = "portrait",
|
|
2192
|
+
paperSize = "A4",
|
|
2193
|
+
pageMargin = "15mm",
|
|
2194
|
+
documentStyle = "document",
|
|
2195
|
+
customHeader = "",
|
|
2196
|
+
repeatHeader = false,
|
|
2197
|
+
runningHeader = "",
|
|
2198
|
+
customFooter = "",
|
|
2199
|
+
repeatFooter = false,
|
|
2200
|
+
runningFooter = "",
|
|
2201
|
+
watermark,
|
|
2202
|
+
extraCss = "",
|
|
2203
|
+
copyStyles = true,
|
|
2204
|
+
openInNewTab = false,
|
|
2205
|
+
onBeforePrint,
|
|
2206
|
+
onAfterPrint
|
|
2207
|
+
} = options;
|
|
2208
|
+
const innerHtml = resolveTargetHtml(target, contentHtml);
|
|
2209
|
+
if (!innerHtml) {
|
|
2210
|
+
console.error("[Deweb Print] Tidak ada konten yang dapat dicetak.");
|
|
2211
|
+
return;
|
|
2212
|
+
}
|
|
2213
|
+
if (onBeforePrint)
|
|
2214
|
+
onBeforePrint();
|
|
2215
|
+
const parentStyles = copyStyles ? collectParentStylesheets() : "";
|
|
2216
|
+
const printCss = buildPrintCss({
|
|
2217
|
+
orientation,
|
|
2218
|
+
paperSize,
|
|
2219
|
+
pageMargin,
|
|
2220
|
+
hideBrowserMetadata,
|
|
2221
|
+
documentStyle,
|
|
2222
|
+
stripCardStyling: options.stripCardStyling !== false,
|
|
2223
|
+
watermark,
|
|
2224
|
+
extraCss
|
|
2225
|
+
});
|
|
2226
|
+
const spacerHeight = hideBrowserMetadata ? pageMargin : "0";
|
|
2227
|
+
const hasThead = repeatHeader && customHeader || runningHeader || hideBrowserMetadata;
|
|
2228
|
+
const hasTfoot = repeatFooter && customFooter || runningFooter || hideBrowserMetadata;
|
|
2229
|
+
const theadContent = repeatHeader && customHeader ? `<div class="deweb-print-header">${customHeader}</div>` : runningHeader ? `<div class="deweb-print-running-header" style="min-height: ${spacerHeight}; display: flex; align-items: flex-end; padding-bottom: 2mm;">${runningHeader}</div>` : `<div style="height: ${spacerHeight}; font-size: 1px; line-height: ${spacerHeight};"> </div>`;
|
|
2230
|
+
const tfootContent = repeatFooter && customFooter ? `<div class="deweb-print-footer">${customFooter}</div>` : runningFooter ? `<div class="deweb-print-running-footer" style="min-height: ${spacerHeight}; display: flex; align-items: flex-start; padding-top: 2mm;">${runningFooter}</div>` : `<div style="height: ${spacerHeight}; font-size: 1px; line-height: ${spacerHeight};"> </div>`;
|
|
2231
|
+
const fullDocumentHtml = `
|
|
2232
|
+
<!DOCTYPE html>
|
|
2233
|
+
<html lang="id">
|
|
2234
|
+
<head>
|
|
2235
|
+
<meta charset="utf-8" />
|
|
2236
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
2237
|
+
<title>${documentTitle}</title>
|
|
2238
|
+
${parentStyles}
|
|
2239
|
+
<style>
|
|
2240
|
+
${printCss}
|
|
2241
|
+
</style>
|
|
2242
|
+
</head>
|
|
2243
|
+
<body>
|
|
2244
|
+
<table class="deweb-print-page-table">
|
|
2245
|
+
${hasThead ? `
|
|
2246
|
+
<thead>
|
|
2247
|
+
<tr>
|
|
2248
|
+
<td>
|
|
2249
|
+
${theadContent}
|
|
2250
|
+
</td>
|
|
2251
|
+
</tr>
|
|
2252
|
+
</thead>
|
|
2253
|
+
` : ""}
|
|
2254
|
+
<tbody>
|
|
2255
|
+
<tr>
|
|
2256
|
+
<td>
|
|
2257
|
+
<!-- Header Dokumen / Kop Surat (Hanya di Halaman Pertama jika repeatHeader false) -->
|
|
2258
|
+
${!repeatHeader && customHeader ? `
|
|
2259
|
+
<div class="deweb-print-header deweb-print-first-page-header">
|
|
2260
|
+
${customHeader}
|
|
2261
|
+
</div>
|
|
2262
|
+
` : ""}
|
|
2263
|
+
|
|
2264
|
+
<!-- Body Utama Konten -->
|
|
2265
|
+
<div class="deweb-print-body">
|
|
2266
|
+
${innerHtml}
|
|
2267
|
+
</div>
|
|
2268
|
+
|
|
2269
|
+
<!-- Footer Dokumen / Tanda Tangan / Stempel (Hanya di Akhir Dokumen jika repeatFooter false) -->
|
|
2270
|
+
${!repeatFooter && customFooter ? `
|
|
2271
|
+
<div class="deweb-print-footer deweb-print-last-page-footer">
|
|
2272
|
+
${customFooter}
|
|
2273
|
+
</div>
|
|
2274
|
+
` : ""}
|
|
2275
|
+
</td>
|
|
2276
|
+
</tr>
|
|
2277
|
+
</tbody>
|
|
2278
|
+
${hasTfoot ? `
|
|
2279
|
+
<tfoot>
|
|
2280
|
+
<tr>
|
|
2281
|
+
<td>
|
|
2282
|
+
${tfootContent}
|
|
2283
|
+
</td>
|
|
2284
|
+
</tr>
|
|
2285
|
+
</tfoot>
|
|
2286
|
+
` : ""}
|
|
2287
|
+
</table>
|
|
2288
|
+
</body>
|
|
2289
|
+
</html>
|
|
2290
|
+
`;
|
|
2291
|
+
if (openInNewTab) {
|
|
2292
|
+
const newTab = window.open("", "_blank");
|
|
2293
|
+
if (newTab) {
|
|
2294
|
+
newTab.document.open();
|
|
2295
|
+
newTab.document.write(fullDocumentHtml);
|
|
2296
|
+
newTab.document.close();
|
|
2297
|
+
}
|
|
2298
|
+
if (onAfterPrint)
|
|
2299
|
+
onAfterPrint();
|
|
2300
|
+
return;
|
|
2301
|
+
}
|
|
2302
|
+
const iframe = document.createElement("iframe");
|
|
2303
|
+
iframe.style.position = "fixed";
|
|
2304
|
+
iframe.style.right = "0";
|
|
2305
|
+
iframe.style.bottom = "0";
|
|
2306
|
+
iframe.style.width = "0";
|
|
2307
|
+
iframe.style.height = "0";
|
|
2308
|
+
iframe.style.border = "0";
|
|
2309
|
+
iframe.style.zIndex = "-9999";
|
|
2310
|
+
iframe.setAttribute("title", "Deweb Print Frame");
|
|
2311
|
+
document.body.appendChild(iframe);
|
|
2312
|
+
const frameDoc = iframe.contentWindow?.document;
|
|
2313
|
+
if (!frameDoc) {
|
|
2314
|
+
document.body.removeChild(iframe);
|
|
2315
|
+
throw new Error("[Deweb Print] Gagal menginisialisasi print frame.");
|
|
2316
|
+
}
|
|
2317
|
+
frameDoc.open();
|
|
2318
|
+
frameDoc.write(fullDocumentHtml);
|
|
2319
|
+
frameDoc.close();
|
|
2320
|
+
const images = frameDoc.querySelectorAll("img");
|
|
2321
|
+
const imageLoadPromises = Array.from(images).map((img) => {
|
|
2322
|
+
if (img.complete)
|
|
2323
|
+
return Promise.resolve();
|
|
2324
|
+
return new Promise((resolve) => {
|
|
2325
|
+
img.onload = () => resolve(true);
|
|
2326
|
+
img.onerror = () => resolve(true);
|
|
2327
|
+
});
|
|
2328
|
+
});
|
|
2329
|
+
await Promise.all(imageLoadPromises);
|
|
2330
|
+
await new Promise((r) => setTimeout(r, 120));
|
|
2331
|
+
return new Promise((resolve) => {
|
|
2332
|
+
let cleanedUp = false;
|
|
2333
|
+
const cleanup = () => {
|
|
2334
|
+
if (cleanedUp)
|
|
2335
|
+
return;
|
|
2336
|
+
cleanedUp = true;
|
|
2337
|
+
try {
|
|
2338
|
+
if (iframe.parentNode) {
|
|
2339
|
+
document.body.removeChild(iframe);
|
|
2340
|
+
}
|
|
2341
|
+
} catch (err) {}
|
|
2342
|
+
if (onAfterPrint)
|
|
2343
|
+
onAfterPrint();
|
|
2344
|
+
resolve();
|
|
2345
|
+
};
|
|
2346
|
+
try {
|
|
2347
|
+
const win = iframe.contentWindow;
|
|
2348
|
+
if (!win) {
|
|
2349
|
+
cleanup();
|
|
2350
|
+
return;
|
|
2351
|
+
}
|
|
2352
|
+
win.onafterprint = cleanup;
|
|
2353
|
+
win.focus();
|
|
2354
|
+
win.print();
|
|
2355
|
+
setTimeout(cleanup, 2000);
|
|
2356
|
+
} catch (err) {
|
|
2357
|
+
console.error("[Deweb Print] Error saat memanggil print dialog:", err);
|
|
2358
|
+
cleanup();
|
|
2359
|
+
}
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
async function downloadPdf2(options) {
|
|
2363
|
+
const resolvedTitle = options.fileName ? options.fileName.replace(/\.pdf$/i, "") : options.documentTitle || "Dokumen";
|
|
2364
|
+
await printElement2({
|
|
2365
|
+
...options,
|
|
2366
|
+
documentTitle: resolvedTitle
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
function downloadPrintableHtml2(options) {
|
|
2370
|
+
const {
|
|
2371
|
+
target,
|
|
2372
|
+
contentHtml,
|
|
2373
|
+
documentTitle = "Dokumen",
|
|
2374
|
+
hideBrowserMetadata = true,
|
|
2375
|
+
orientation = "portrait",
|
|
2376
|
+
paperSize = "A4",
|
|
2377
|
+
pageMargin = "15mm",
|
|
2378
|
+
documentStyle = "document",
|
|
2379
|
+
customHeader = "",
|
|
2380
|
+
repeatHeader = false,
|
|
2381
|
+
runningHeader = "",
|
|
2382
|
+
customFooter = "",
|
|
2383
|
+
repeatFooter = false,
|
|
2384
|
+
runningFooter = "",
|
|
2385
|
+
watermark,
|
|
2386
|
+
extraCss = "",
|
|
2387
|
+
copyStyles = true,
|
|
2388
|
+
fileName
|
|
2389
|
+
} = options;
|
|
2390
|
+
const innerHtml = resolveTargetHtml(target, contentHtml);
|
|
2391
|
+
if (!innerHtml) {
|
|
2392
|
+
console.error("[Deweb Print] Tidak ada konten yang dapat diunduh.");
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2395
|
+
const parentStyles = copyStyles ? collectParentStylesheets() : "";
|
|
2396
|
+
const printCss = buildPrintCss({
|
|
2397
|
+
orientation,
|
|
2398
|
+
paperSize,
|
|
2399
|
+
pageMargin,
|
|
2400
|
+
hideBrowserMetadata,
|
|
2401
|
+
documentStyle,
|
|
2402
|
+
stripCardStyling: options.stripCardStyling !== false,
|
|
2403
|
+
watermark,
|
|
2404
|
+
extraCss
|
|
2405
|
+
});
|
|
2406
|
+
const spacerHeight = hideBrowserMetadata ? pageMargin : "0";
|
|
2407
|
+
const hasThead = repeatHeader && customHeader || runningHeader || hideBrowserMetadata;
|
|
2408
|
+
const hasTfoot = repeatFooter && customFooter || runningFooter || hideBrowserMetadata;
|
|
2409
|
+
const theadContent = repeatHeader && customHeader ? `<div class="deweb-print-header">${customHeader}</div>` : runningHeader ? `<div class="deweb-print-running-header" style="min-height: ${spacerHeight}; display: flex; align-items: flex-end; padding-bottom: 2mm;">${runningHeader}</div>` : `<div style="height: ${spacerHeight}; font-size: 1px; line-height: ${spacerHeight};"> </div>`;
|
|
2410
|
+
const tfootContent = repeatFooter && customFooter ? `<div class="deweb-print-footer">${customFooter}</div>` : runningFooter ? `<div class="deweb-print-running-footer" style="min-height: ${spacerHeight}; display: flex; align-items: flex-start; padding-top: 2mm;">${runningFooter}</div>` : `<div style="height: ${spacerHeight}; font-size: 1px; line-height: ${spacerHeight};"> </div>`;
|
|
2411
|
+
const fullDocumentHtml = `<!DOCTYPE html>
|
|
2412
|
+
<html lang="id">
|
|
2413
|
+
<head>
|
|
2414
|
+
<meta charset="utf-8" />
|
|
2415
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
2416
|
+
<title>${documentTitle}</title>
|
|
2417
|
+
${parentStyles}
|
|
2418
|
+
<style>
|
|
2419
|
+
${printCss}
|
|
2420
|
+
@media screen {
|
|
2421
|
+
body {
|
|
2422
|
+
max-width: 860px;
|
|
2423
|
+
margin: 30px auto !important;
|
|
2424
|
+
padding: 30px !important;
|
|
2425
|
+
border: 1px solid #e2e8f0;
|
|
2426
|
+
border-radius: 8px;
|
|
2427
|
+
box-shadow: 0 4px 16px rgba(0,0,0,0.06);
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
</style>
|
|
2431
|
+
</head>
|
|
2432
|
+
<body>
|
|
2433
|
+
<table class="deweb-print-page-table">
|
|
2434
|
+
${hasThead ? `<thead><tr><td>${theadContent}</td></tr></thead>` : ""}
|
|
2435
|
+
<tbody>
|
|
2436
|
+
<tr>
|
|
2437
|
+
<td>
|
|
2438
|
+
${!repeatHeader && customHeader ? `<div class="deweb-print-header deweb-print-first-page-header">${customHeader}</div>` : ""}
|
|
2439
|
+
<div class="deweb-print-body">${innerHtml}</div>
|
|
2440
|
+
${!repeatFooter && customFooter ? `<div class="deweb-print-footer deweb-print-last-page-footer">${customFooter}</div>` : ""}
|
|
2441
|
+
</td>
|
|
2442
|
+
</tr>
|
|
2443
|
+
</tbody>
|
|
2444
|
+
${hasTfoot ? `<tfoot><tr><td>${tfootContent}</td></tr></tfoot>` : ""}
|
|
2445
|
+
</table>
|
|
2446
|
+
</body>
|
|
2447
|
+
</html>`;
|
|
2448
|
+
const blob = new Blob([fullDocumentHtml], { type: "text/html;charset=utf-8" });
|
|
2449
|
+
const url = URL.createObjectURL(blob);
|
|
2450
|
+
const a = document.createElement("a");
|
|
2451
|
+
a.href = url;
|
|
2452
|
+
const resolvedName = fileName || `${documentTitle.replace(/[^a-zA-Z0-9_-]/g, "_")}.html`;
|
|
2453
|
+
a.download = resolvedName.endsWith(".html") ? resolvedName : `${resolvedName}.html`;
|
|
2454
|
+
document.body.appendChild(a);
|
|
2455
|
+
a.click();
|
|
2456
|
+
document.body.removeChild(a);
|
|
2457
|
+
URL.revokeObjectURL(url);
|
|
2458
|
+
}
|
|
2459
|
+
function usePrint2(defaultOptions) {
|
|
2460
|
+
const [isPrinting, setIsPrinting] = React12.useState(false);
|
|
2461
|
+
const handlePrint = React12.useCallback(async (overrideOptions) => {
|
|
2462
|
+
setIsPrinting(true);
|
|
2463
|
+
try {
|
|
2464
|
+
await printElement2({
|
|
2465
|
+
...defaultOptions,
|
|
2466
|
+
...overrideOptions
|
|
2467
|
+
});
|
|
2468
|
+
} finally {
|
|
2469
|
+
setIsPrinting(false);
|
|
2470
|
+
}
|
|
2471
|
+
}, [defaultOptions]);
|
|
2472
|
+
const handleDownloadHtml = React12.useCallback((overrideOptions) => {
|
|
2473
|
+
downloadPrintableHtml2({
|
|
2474
|
+
...defaultOptions,
|
|
2475
|
+
...overrideOptions
|
|
2476
|
+
});
|
|
2477
|
+
}, [defaultOptions]);
|
|
2478
|
+
return {
|
|
2479
|
+
print: handlePrint,
|
|
2480
|
+
downloadHtml: handleDownloadHtml,
|
|
2481
|
+
isPrinting
|
|
2482
|
+
};
|
|
2483
|
+
}
|
|
2484
|
+
var DownloadHtmlButton2 = React12.forwardRef(function DownloadHtmlButton({ target, fileName, printOptions, children, onClick, ...props }, ref) {
|
|
2485
|
+
const { downloadHtml } = usePrint2({
|
|
2486
|
+
target,
|
|
2487
|
+
...printOptions
|
|
2488
|
+
});
|
|
2489
|
+
const handleClick = (e) => {
|
|
2490
|
+
if (onClick)
|
|
2491
|
+
onClick(e);
|
|
2492
|
+
downloadHtml({ fileName });
|
|
2493
|
+
};
|
|
2494
|
+
return /* @__PURE__ */ jsxDEV18(Button2, {
|
|
2495
|
+
ref,
|
|
2496
|
+
onClick: handleClick,
|
|
2497
|
+
...props,
|
|
2498
|
+
children: children || /* @__PURE__ */ jsxDEV18(Fragment2, {
|
|
2499
|
+
children: [
|
|
2500
|
+
/* @__PURE__ */ jsxDEV18(Icon2, {
|
|
2501
|
+
name: "download",
|
|
2502
|
+
size: 15,
|
|
2503
|
+
className: "mr-1.5"
|
|
2504
|
+
}, undefined, false, undefined, this),
|
|
2505
|
+
/* @__PURE__ */ jsxDEV18("span", {
|
|
2506
|
+
children: "Download Berkas HTML"
|
|
2507
|
+
}, undefined, false, undefined, this)
|
|
2508
|
+
]
|
|
2509
|
+
}, undefined, true, undefined, this)
|
|
2510
|
+
}, undefined, false, undefined, this);
|
|
2511
|
+
});
|
|
2512
|
+
var PrintButton2 = React12.forwardRef(function PrintButton({ target, printOptions, children, onClick, ...props }, ref) {
|
|
2513
|
+
const { print, isPrinting } = usePrint2({
|
|
2514
|
+
target,
|
|
2515
|
+
...printOptions
|
|
2516
|
+
});
|
|
2517
|
+
const handleClick = (e) => {
|
|
2518
|
+
if (onClick)
|
|
2519
|
+
onClick(e);
|
|
2520
|
+
print();
|
|
2521
|
+
};
|
|
2522
|
+
return /* @__PURE__ */ jsxDEV18(Button2, {
|
|
2523
|
+
ref,
|
|
2524
|
+
onClick: handleClick,
|
|
2525
|
+
isLoading: isPrinting,
|
|
2526
|
+
...props,
|
|
2527
|
+
children: children || /* @__PURE__ */ jsxDEV18(Fragment2, {
|
|
2528
|
+
children: [
|
|
2529
|
+
/* @__PURE__ */ jsxDEV18(Icon2, {
|
|
2530
|
+
name: "printer",
|
|
2531
|
+
size: 15,
|
|
2532
|
+
className: "mr-1.5"
|
|
2533
|
+
}, undefined, false, undefined, this),
|
|
2534
|
+
/* @__PURE__ */ jsxDEV18("span", {
|
|
2535
|
+
children: "Cetak Dokumen"
|
|
2536
|
+
}, undefined, false, undefined, this)
|
|
2537
|
+
]
|
|
2538
|
+
}, undefined, true, undefined, this)
|
|
2539
|
+
}, undefined, false, undefined, this);
|
|
2540
|
+
});
|
|
2541
|
+
var Printer2 = PrintButton2;
|
|
2542
|
+
var DownloadPdfButton2 = PrintButton2;
|
|
2543
|
+
|
|
2544
|
+
export { LoginFormBlock2, SidebarMenuBlock2, SliderBlock2, AppShell2, InitialIcon2, Avatar2, AvatarStack2, ControlGroup2, DashboardDropSlot2, DashboardGrid2, DashboardWidgetCard2, useDashboardDnd2, generateComplementary2, generateAnalogous2, generateTriadic2, generateSplitComplementary2, generateTetradic2, generateMonochromatic2, generateAccentedAnalogous2, generateDoubleComplementary2, generateUiNeutral2, InvoiceDocument2, InvoiceDocumentSkeleton2, MainPage2, MainHead2, MainBar2, MainContent2, SidebarLogo2, findActiveLeafLabel2, SidebarMenu2, SidebarSearch2, ThemeToggle2, Grid2, GridItem2, printElement2, downloadPdf2, downloadPrintableHtml2, usePrint2, DownloadHtmlButton2, PrintButton2, Printer2, DownloadPdfButton2 };
|
|
2545
|
+
|
|
2546
|
+
//# debugId=7520BD4D797E3B0C64756E2164756E21
|