@hoardodile/ui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/README.md +70 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/alert.js +97 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/app-dialog.d.ts +62 -0
- package/dist/components/app-dialog.js +656 -0
- package/dist/components/app-dialog.js.map +1 -0
- package/dist/components/badge.d.ts +11 -0
- package/dist/components/badge.js +70 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +617 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +78 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/caption-bar.d.ts +44 -0
- package/dist/components/caption-bar.js +827 -0
- package/dist/components/caption-bar.js.map +1 -0
- package/dist/components/chart-card.d.ts +15 -0
- package/dist/components/chart-card.js +27 -0
- package/dist/components/chart-card.js.map +1 -0
- package/dist/components/checkbox.d.ts +6 -0
- package/dist/components/checkbox.js +76 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip-button.d.ts +28 -0
- package/dist/components/chip-button.js +87 -0
- package/dist/components/chip-button.js.map +1 -0
- package/dist/components/close-confirm-dialog.d.ts +19 -0
- package/dist/components/close-confirm-dialog.js +743 -0
- package/dist/components/close-confirm-dialog.js.map +1 -0
- package/dist/components/color-picker.d.ts +32 -0
- package/dist/components/color-picker.js +667 -0
- package/dist/components/color-picker.js.map +1 -0
- package/dist/components/combobox.d.ts +32 -0
- package/dist/components/combobox.js +1211 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/confirm-by-typing-dialog.d.ts +48 -0
- package/dist/components/confirm-by-typing-dialog.js +759 -0
- package/dist/components/confirm-by-typing-dialog.js.map +1 -0
- package/dist/components/confirm-dialog.d.ts +34 -0
- package/dist/components/confirm-dialog.js +710 -0
- package/dist/components/confirm-dialog.js.map +1 -0
- package/dist/components/count-badge.d.ts +13 -0
- package/dist/components/count-badge.js +39 -0
- package/dist/components/count-badge.js.map +1 -0
- package/dist/components/dialog.d.ts +40 -0
- package/dist/components/dialog.js +571 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +45 -0
- package/dist/components/dropdown-menu.js +1003 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/dropdown-select.d.ts +29 -0
- package/dist/components/dropdown-select.js +1036 -0
- package/dist/components/dropdown-select.js.map +1 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +119 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/filter-rail.d.ts +48 -0
- package/dist/components/filter-rail.js +231 -0
- package/dist/components/filter-rail.js.map +1 -0
- package/dist/components/fixed-action-bar.d.ts +24 -0
- package/dist/components/fixed-action-bar.js +48 -0
- package/dist/components/fixed-action-bar.js.map +1 -0
- package/dist/components/font-picker.d.ts +45 -0
- package/dist/components/font-picker.js +759 -0
- package/dist/components/font-picker.js.map +1 -0
- package/dist/components/form.d.ts +17 -0
- package/dist/components/form.js +150 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/group-label.d.ts +12 -0
- package/dist/components/group-label.js +10 -0
- package/dist/components/group-label.js.map +1 -0
- package/dist/components/icon-tile.d.ts +16 -0
- package/dist/components/icon-tile.js +67 -0
- package/dist/components/icon-tile.js.map +1 -0
- package/dist/components/icon-toggle.d.ts +24 -0
- package/dist/components/icon-toggle.js +81 -0
- package/dist/components/icon-toggle.js.map +1 -0
- package/dist/components/icon.d.ts +2 -0
- package/dist/components/icon.js +49 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/image-crop-panel.d.ts +80 -0
- package/dist/components/image-crop-panel.js +1104 -0
- package/dist/components/image-crop-panel.js.map +1 -0
- package/dist/components/image-cropper.d.ts +63 -0
- package/dist/components/image-cropper.js +166 -0
- package/dist/components/image-cropper.js.map +1 -0
- package/dist/components/input-group.d.ts +22 -0
- package/dist/components/input-group.js +270 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +16 -0
- package/dist/components/input.js +60 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.d.ts +5 -0
- package/dist/components/label.js +40 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/list-empty-row.d.ts +16 -0
- package/dist/components/list-empty-row.js +40 -0
- package/dist/components/list-empty-row.js.map +1 -0
- package/dist/components/management-empty.d.ts +14 -0
- package/dist/components/management-empty.js +40 -0
- package/dist/components/management-empty.js.map +1 -0
- package/dist/components/management-skeleton.d.ts +11 -0
- package/dist/components/management-skeleton.js +72 -0
- package/dist/components/management-skeleton.js.map +1 -0
- package/dist/components/meta-chip.d.ts +17 -0
- package/dist/components/meta-chip.js +49 -0
- package/dist/components/meta-chip.js.map +1 -0
- package/dist/components/mobile-drawer.d.ts +29 -0
- package/dist/components/mobile-drawer.js +331 -0
- package/dist/components/mobile-drawer.js.map +1 -0
- package/dist/components/page-header.d.ts +20 -0
- package/dist/components/page-header.js +44 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/page-scaffold.d.ts +34 -0
- package/dist/components/page-scaffold.js +157 -0
- package/dist/components/page-scaffold.js.map +1 -0
- package/dist/components/pagination-bar.d.ts +22 -0
- package/dist/components/pagination-bar.js +703 -0
- package/dist/components/pagination-bar.js.map +1 -0
- package/dist/components/pagination.d.ts +22 -0
- package/dist/components/pagination.js +680 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/panel-toolbar.d.ts +37 -0
- package/dist/components/panel-toolbar.js +781 -0
- package/dist/components/panel-toolbar.js.map +1 -0
- package/dist/components/pill-tabs.d.ts +33 -0
- package/dist/components/pill-tabs.js +66 -0
- package/dist/components/pill-tabs.js.map +1 -0
- package/dist/components/plugin-download-consent.d.ts +52 -0
- package/dist/components/plugin-download-consent.js +780 -0
- package/dist/components/plugin-download-consent.js.map +1 -0
- package/dist/components/popover.d.ts +26 -0
- package/dist/components/popover.js +343 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +10 -0
- package/dist/components/progress.js +103 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/query-state-view.d.ts +36 -0
- package/dist/components/query-state-view.js +17 -0
- package/dist/components/query-state-view.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.js +60 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/scroll-area.d.ts +7 -0
- package/dist/components/scroll-area.js +80 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/search-field.d.ts +49 -0
- package/dist/components/search-field.js +586 -0
- package/dist/components/search-field.js.map +1 -0
- package/dist/components/secondary-stat.d.ts +13 -0
- package/dist/components/secondary-stat.js +56 -0
- package/dist/components/secondary-stat.js.map +1 -0
- package/dist/components/section-header.d.ts +23 -0
- package/dist/components/section-header.js +76 -0
- package/dist/components/section-header.js.map +1 -0
- package/dist/components/section-label.d.ts +20 -0
- package/dist/components/section-label.js +46 -0
- package/dist/components/section-label.js.map +1 -0
- package/dist/components/section-tabs.d.ts +47 -0
- package/dist/components/section-tabs.js +145 -0
- package/dist/components/section-tabs.js.map +1 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +49 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +22 -0
- package/dist/components/sheet.js +469 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +69 -0
- package/dist/components/sidebar.js +1645 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +8 -0
- package/dist/components/skeleton.js +41 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +6 -0
- package/dist/components/slider.js +75 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sortable-chip-list.d.ts +26 -0
- package/dist/components/sortable-chip-list.js +59 -0
- package/dist/components/sortable-chip-list.js.map +1 -0
- package/dist/components/spinner.d.ts +5 -0
- package/dist/components/spinner.js +65 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/surface.d.ts +13 -0
- package/dist/components/surface.js +51 -0
- package/dist/components/surface.js.map +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +53 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +129 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/textarea.d.ts +15 -0
- package/dist/components/textarea.js +58 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toast.d.ts +19 -0
- package/dist/components/toast.js +805 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/toggle.d.ts +12 -0
- package/dist/components/toggle.js +63 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.d.ts +9 -0
- package/dist/components/tooltip.js +82 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/hooks/use-dialog-footer-actions.d.ts +18 -0
- package/dist/hooks/use-dialog-footer-actions.js +11 -0
- package/dist/hooks/use-dialog-footer-actions.js.map +1 -0
- package/dist/hooks/use-form-field.d.ts +33 -0
- package/dist/hooks/use-form-field.js +36 -0
- package/dist/hooks/use-form-field.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +34 -0
- package/dist/hooks/use-mobile.js +29 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-pinch-pan.d.ts +56 -0
- package/dist/hooks/use-pinch-pan.js +223 -0
- package/dist/hooks/use-pinch-pan.js.map +1 -0
- package/dist/hooks/useMobileBackToClose.d.ts +61 -0
- package/dist/hooks/useMobileBackToClose.js +234 -0
- package/dist/hooks/useMobileBackToClose.js.map +1 -0
- package/dist/icon-BOgL5bpL.d.ts +85 -0
- package/dist/icons/actions.d.ts +4 -0
- package/dist/icons/actions.js +520 -0
- package/dist/icons/actions.js.map +1 -0
- package/dist/icons/icon-style.d.ts +2 -0
- package/dist/icons/icon-style.js +51 -0
- package/dist/icons/icon-style.js.map +1 -0
- package/dist/icons/marks.d.ts +15 -0
- package/dist/icons/marks.js +48 -0
- package/dist/icons/marks.js.map +1 -0
- package/dist/icons/registry.d.ts +177 -0
- package/dist/icons/registry.js +1180 -0
- package/dist/icons/registry.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +653 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/merge-config.d.ts +15 -0
- package/dist/lib/merge-config.js +20 -0
- package/dist/lib/merge-config.js.map +1 -0
- package/dist/lib/pagination.d.ts +19 -0
- package/dist/lib/pagination.js +26 -0
- package/dist/lib/pagination.js.map +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +26 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles/theme.css +480 -0
- package/dist/styles/theme.css.map +1 -0
- package/dist/styles/theme.d.ts +2 -0
- package/dist/viewport.d.ts +64 -0
- package/dist/viewport.js +13 -0
- package/dist/viewport.js.map +1 -0
- package/package.json +122 -0
- package/src/components/alert.tsx +76 -0
- package/src/components/app-dialog.tsx +187 -0
- package/src/components/badge.tsx +52 -0
- package/src/components/breadcrumb.tsx +129 -0
- package/src/components/button.tsx +70 -0
- package/src/components/caption-bar.test.tsx +151 -0
- package/src/components/caption-bar.tsx +392 -0
- package/src/components/chart-card.tsx +31 -0
- package/src/components/checkbox.tsx +28 -0
- package/src/components/chip-button.tsx +69 -0
- package/src/components/close-confirm-dialog.tsx +99 -0
- package/src/components/color-picker.tsx +186 -0
- package/src/components/combobox.tsx +335 -0
- package/src/components/confirm-by-typing-dialog.tsx +130 -0
- package/src/components/confirm-dialog.test.tsx +39 -0
- package/src/components/confirm-dialog.tsx +98 -0
- package/src/components/count-badge.tsx +23 -0
- package/src/components/dialog.tsx +315 -0
- package/src/components/dropdown-menu.tsx +311 -0
- package/src/components/dropdown-select.tsx +211 -0
- package/src/components/empty.tsx +104 -0
- package/src/components/filter-rail.tsx +139 -0
- package/src/components/fixed-action-bar.tsx +46 -0
- package/src/components/font-picker.tsx +257 -0
- package/src/components/form.tsx +127 -0
- package/src/components/group-label.tsx +13 -0
- package/src/components/icon-tile.tsx +35 -0
- package/src/components/icon-toggle.tsx +57 -0
- package/src/components/icon.tsx +66 -0
- package/src/components/image-crop-panel.test.tsx +167 -0
- package/src/components/image-crop-panel.tsx +465 -0
- package/src/components/image-cropper.test.tsx +144 -0
- package/src/components/image-cropper.tsx +265 -0
- package/src/components/input-group.tsx +156 -0
- package/src/components/input.tsx +45 -0
- package/src/components/label.tsx +20 -0
- package/src/components/list-empty-row.tsx +27 -0
- package/src/components/management-empty.tsx +25 -0
- package/src/components/management-skeleton.tsx +23 -0
- package/src/components/meta-chip.tsx +40 -0
- package/src/components/mobile-drawer.test.tsx +52 -0
- package/src/components/mobile-drawer.tsx +98 -0
- package/src/components/page-header.tsx +47 -0
- package/src/components/page-scaffold.test.tsx +24 -0
- package/src/components/page-scaffold.tsx +131 -0
- package/src/components/pagination-bar.test.tsx +87 -0
- package/src/components/pagination-bar.tsx +139 -0
- package/src/components/pagination.tsx +139 -0
- package/src/components/panel-toolbar.tsx +99 -0
- package/src/components/pill-tabs.test.tsx +84 -0
- package/src/components/pill-tabs.tsx +77 -0
- package/src/components/plugin-download-consent.test.tsx +90 -0
- package/src/components/plugin-download-consent.tsx +183 -0
- package/src/components/popover.tsx +133 -0
- package/src/components/progress.tsx +88 -0
- package/src/components/query-state-view.tsx +47 -0
- package/src/components/radio-group.tsx +36 -0
- package/src/components/scroll-area.tsx +52 -0
- package/src/components/search-field.test.tsx +86 -0
- package/src/components/search-field.tsx +119 -0
- package/src/components/secondary-stat.tsx +24 -0
- package/src/components/section-header.tsx +54 -0
- package/src/components/section-label.tsx +40 -0
- package/src/components/section-tabs.test.tsx +154 -0
- package/src/components/section-tabs.tsx +190 -0
- package/src/components/separator.tsx +38 -0
- package/src/components/sheet.tsx +170 -0
- package/src/components/sidebar.tsx +725 -0
- package/src/components/skeleton.tsx +18 -0
- package/src/components/slider.tsx +52 -0
- package/src/components/sortable-chip-list.tsx +56 -0
- package/src/components/spinner.tsx +35 -0
- package/src/components/surface.tsx +37 -0
- package/src/components/switch.tsx +30 -0
- package/src/components/table.tsx +116 -0
- package/src/components/textarea.tsx +41 -0
- package/src/components/toast.tsx +239 -0
- package/src/components/toggle.tsx +45 -0
- package/src/components/tooltip.tsx +64 -0
- package/src/hooks/use-dialog-footer-actions.ts +23 -0
- package/src/hooks/use-form-field.ts +62 -0
- package/src/hooks/use-mobile.ts +54 -0
- package/src/hooks/use-pinch-pan.test.tsx +42 -0
- package/src/hooks/use-pinch-pan.ts +340 -0
- package/src/hooks/useMobileBackToClose.test.tsx +140 -0
- package/src/hooks/useMobileBackToClose.ts +508 -0
- package/src/icons/actions.ts +10 -0
- package/src/icons/icon-style.test.tsx +69 -0
- package/src/icons/icon-style.ts +104 -0
- package/src/icons/marks.tsx +72 -0
- package/src/icons/registry.test.ts +65 -0
- package/src/icons/registry.ts +1163 -0
- package/src/index.ts +22 -0
- package/src/lib/merge-config.test.ts +109 -0
- package/src/lib/merge-config.ts +22 -0
- package/src/lib/pagination.test.ts +55 -0
- package/src/lib/pagination.ts +42 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/scan-contract.test.ts +74 -0
- package/src/styles/theme.css +798 -0
- package/src/test/i18n.tsx +22 -0
- package/src/test/setup.ts +104 -0
- package/src/viewport.ts +69 -0
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
import { Button as Button$1 } from '@base-ui/react/button';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
5
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { createContext, useState, useEffect, useRef, useMemo } from 'react';
|
|
9
|
+
import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import 'react-use';
|
|
12
|
+
|
|
13
|
+
// src/components/button.tsx
|
|
14
|
+
var mergeTheme = {
|
|
15
|
+
text: ["tiny", "ui", "doc", "doc-title", "doc-heading", "quote"],
|
|
16
|
+
spacing: ["chip", "control", "nav", "sidebar", "panel"],
|
|
17
|
+
tracking: ["label"],
|
|
18
|
+
shadow: ["card", "dialog"],
|
|
19
|
+
container: ["reading", "medium", "content"],
|
|
20
|
+
font: ["doc", "heading"],
|
|
21
|
+
ease: ["standard"],
|
|
22
|
+
animate: ["skel", "pop"]
|
|
23
|
+
};
|
|
24
|
+
var twMerge = extendTailwindMerge({
|
|
25
|
+
extend: { theme: mergeTheme }
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// src/lib/utils.ts
|
|
29
|
+
function cn(...inputs) {
|
|
30
|
+
return twMerge(clsx(inputs));
|
|
31
|
+
}
|
|
32
|
+
var buttonVariants = cva(
|
|
33
|
+
"group/button inline-flex shrink-0 items-center justify-center rounded-lg text-ui font-medium whitespace-nowrap outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
34
|
+
{
|
|
35
|
+
variants: {
|
|
36
|
+
variant: {
|
|
37
|
+
default: "bg-primary px-4! text-primary-foreground hover:bg-primary/80",
|
|
38
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
39
|
+
secondary: "bg-secondary text-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-foreground",
|
|
40
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
41
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
42
|
+
danger: "bg-[color-mix(in_oklab,var(--destructive),black_12%)] text-white hover:bg-[color-mix(in_oklab,var(--destructive),black_4%)] focus-visible:border-destructive/40 focus-visible:ring-destructive/20 disabled:bg-destructive/10 disabled:text-muted-foreground dark:focus-visible:ring-destructive/40",
|
|
43
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
default: "h-control gap-2 px-3 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
47
|
+
xs: "h-6 gap-2 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
48
|
+
sm: "h-chip gap-2 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
49
|
+
lg: "h-10 gap-2 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
50
|
+
icon: "size-9",
|
|
51
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
52
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
53
|
+
"icon-lg": "size-10"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
variant: "default",
|
|
58
|
+
size: "default"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
function Button({
|
|
63
|
+
active,
|
|
64
|
+
className,
|
|
65
|
+
variant = "default",
|
|
66
|
+
size = "default",
|
|
67
|
+
...props
|
|
68
|
+
}) {
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
Button$1,
|
|
71
|
+
{
|
|
72
|
+
"data-slot": "button",
|
|
73
|
+
className: cn(
|
|
74
|
+
buttonVariants({ variant, size, className }),
|
|
75
|
+
active && "bg-accent text-accent-foreground hover:bg-accent"
|
|
76
|
+
),
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
function Mark({
|
|
82
|
+
d,
|
|
83
|
+
filled,
|
|
84
|
+
className
|
|
85
|
+
}) {
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
87
|
+
"svg",
|
|
88
|
+
{
|
|
89
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
90
|
+
viewBox: "0 0 24 24",
|
|
91
|
+
fill: "none",
|
|
92
|
+
className,
|
|
93
|
+
children: filled ? /* @__PURE__ */ jsx("path", { d, fill: "currentColor" }) : /* @__PURE__ */ jsx(
|
|
94
|
+
"path",
|
|
95
|
+
{
|
|
96
|
+
d,
|
|
97
|
+
stroke: "currentColor",
|
|
98
|
+
strokeWidth: "2",
|
|
99
|
+
strokeLinecap: "round",
|
|
100
|
+
strokeLinejoin: "round"
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function Check(props) {
|
|
107
|
+
return /* @__PURE__ */ jsx(Mark, { ...props, d: "M5 12.8l4.7 4.7L19 7.2" });
|
|
108
|
+
}
|
|
109
|
+
function Cross(props) {
|
|
110
|
+
return /* @__PURE__ */ jsx(Mark, { ...props, d: "M6 6l12 12M18 6L6 18" });
|
|
111
|
+
}
|
|
112
|
+
function Checkbox({ className, ...props }) {
|
|
113
|
+
return /* @__PURE__ */ jsx(
|
|
114
|
+
Checkbox$1.Root,
|
|
115
|
+
{
|
|
116
|
+
"data-slot": "checkbox",
|
|
117
|
+
className: cn(
|
|
118
|
+
"peer relative flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm bg-muted outline-none group-has-disabled/field:opacity-50 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:bg-destructive/20 aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-checked:bg-primary data-checked:text-primary-foreground",
|
|
119
|
+
className
|
|
120
|
+
),
|
|
121
|
+
...props,
|
|
122
|
+
children: /* @__PURE__ */ jsx(
|
|
123
|
+
Checkbox$1.Indicator,
|
|
124
|
+
{
|
|
125
|
+
"data-slot": "checkbox-indicator",
|
|
126
|
+
className: "grid place-content-center text-current [&>svg]:size-3",
|
|
127
|
+
children: /* @__PURE__ */ jsx(Check, {})
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/viewport.ts
|
|
135
|
+
var MOBILE_BREAKPOINT_PX = 768;
|
|
136
|
+
var MOBILE_QUERY = `(max-width: ${MOBILE_BREAKPOINT_PX - 1}px)`;
|
|
137
|
+
function isBelowMd() {
|
|
138
|
+
if (typeof window === "undefined") return false;
|
|
139
|
+
return window.matchMedia(MOBILE_QUERY).matches;
|
|
140
|
+
}
|
|
141
|
+
var HISTORY_KEY = "__appMobileOverlay";
|
|
142
|
+
var overlayStack = [];
|
|
143
|
+
var popListenerInstalled = false;
|
|
144
|
+
var historyPatched = false;
|
|
145
|
+
var nextOverlayId = 0;
|
|
146
|
+
var suppressPopCount = 0;
|
|
147
|
+
var seenSyntheticIds = /* @__PURE__ */ new Set();
|
|
148
|
+
function patchHistory() {
|
|
149
|
+
if (historyPatched) return;
|
|
150
|
+
if (typeof window === "undefined") return;
|
|
151
|
+
historyPatched = true;
|
|
152
|
+
const origPush = window.history.pushState.bind(window.history);
|
|
153
|
+
window.history.pushState = (data, unused, url) => {
|
|
154
|
+
const state = data;
|
|
155
|
+
if (state !== null && typeof state === "object" && HISTORY_KEY in state) {
|
|
156
|
+
origPush(data, unused, url);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (overlayStack.length > 0) {
|
|
160
|
+
closeAllOverlays();
|
|
161
|
+
}
|
|
162
|
+
origPush(data, unused, url);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function closeAllOverlays() {
|
|
166
|
+
while (overlayStack.length > 0) {
|
|
167
|
+
const entry = overlayStack.pop();
|
|
168
|
+
if (entry?.close !== void 0) {
|
|
169
|
+
const fn = entry.close;
|
|
170
|
+
entry.close = void 0;
|
|
171
|
+
fn();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function ensurePopListener() {
|
|
176
|
+
if (popListenerInstalled) return;
|
|
177
|
+
if (typeof window === "undefined") return;
|
|
178
|
+
popListenerInstalled = true;
|
|
179
|
+
window.addEventListener(
|
|
180
|
+
"popstate",
|
|
181
|
+
(e) => {
|
|
182
|
+
if (suppressPopCount > 0) return;
|
|
183
|
+
const state = e.state;
|
|
184
|
+
if (state !== null && typeof state === "object" && HISTORY_KEY in state) {
|
|
185
|
+
const id = state[HISTORY_KEY];
|
|
186
|
+
if (typeof id === "number" && overlayStack.some((entry) => entry.id === id)) {
|
|
187
|
+
closeTopOverlay();
|
|
188
|
+
e.stopImmediatePropagation();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
e.stopImmediatePropagation();
|
|
192
|
+
if (typeof id === "number" && seenSyntheticIds.has(id)) {
|
|
193
|
+
window.history.back();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
true
|
|
198
|
+
// capture phase
|
|
199
|
+
);
|
|
200
|
+
window.addEventListener("popstate", handlePop);
|
|
201
|
+
patchHistory();
|
|
202
|
+
}
|
|
203
|
+
function closeTopOverlay() {
|
|
204
|
+
const top = overlayStack.pop();
|
|
205
|
+
if (top === void 0) return;
|
|
206
|
+
if (top.close === void 0) return;
|
|
207
|
+
const closeFn = top.close;
|
|
208
|
+
top.close = void 0;
|
|
209
|
+
closeFn();
|
|
210
|
+
}
|
|
211
|
+
function handlePop() {
|
|
212
|
+
if (suppressPopCount > 0) {
|
|
213
|
+
suppressPopCount--;
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
closeTopOverlay();
|
|
217
|
+
}
|
|
218
|
+
function removeFromStack(id) {
|
|
219
|
+
const idx = overlayStack.findIndex((e) => e.id === id);
|
|
220
|
+
if (idx === -1) return { removed: false, parkedBelow: 0 };
|
|
221
|
+
const wasTop = idx === overlayStack.length - 1;
|
|
222
|
+
if (!wasTop) {
|
|
223
|
+
const entry = overlayStack[idx];
|
|
224
|
+
if (entry !== void 0) entry.close = void 0;
|
|
225
|
+
return { removed: true, parkedBelow: 0 };
|
|
226
|
+
}
|
|
227
|
+
overlayStack.pop();
|
|
228
|
+
const remaining = overlayStack.splice(0, overlayStack.length);
|
|
229
|
+
const active = remaining.filter((e) => e.close !== void 0);
|
|
230
|
+
const parkedBelow = remaining.length - active.length;
|
|
231
|
+
overlayStack.push(...active);
|
|
232
|
+
return { removed: true, parkedBelow };
|
|
233
|
+
}
|
|
234
|
+
function scheduleStateRestore(id, baseState, parkedBelow) {
|
|
235
|
+
function check() {
|
|
236
|
+
const currentState = window.history.state;
|
|
237
|
+
if (currentState === null || typeof currentState !== "object" || !(HISTORY_KEY in currentState) || currentState[HISTORY_KEY] !== id) {
|
|
238
|
+
sweepParkedEntries();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const totalBacks = 1 + parkedBelow;
|
|
242
|
+
let done = false;
|
|
243
|
+
function restore() {
|
|
244
|
+
if (done) return;
|
|
245
|
+
done = true;
|
|
246
|
+
window.removeEventListener("popstate", onPop);
|
|
247
|
+
window.history.replaceState(baseState, "");
|
|
248
|
+
const sweptIds = sweepParkedEntries();
|
|
249
|
+
cleanupSeenIds(sweptIds);
|
|
250
|
+
}
|
|
251
|
+
function onPop() {
|
|
252
|
+
if (suppressPopCount > 0) {
|
|
253
|
+
suppressPopCount--;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
restore();
|
|
257
|
+
}
|
|
258
|
+
window.addEventListener("popstate", onPop);
|
|
259
|
+
suppressPopCount += totalBacks;
|
|
260
|
+
for (let i = 0; i < totalBacks; i++) {
|
|
261
|
+
window.history.back();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
let disposed = false;
|
|
265
|
+
let rafId;
|
|
266
|
+
function run() {
|
|
267
|
+
if (disposed) return;
|
|
268
|
+
disposed = true;
|
|
269
|
+
if (rafId !== void 0) {
|
|
270
|
+
cancelAnimationFrame(rafId);
|
|
271
|
+
}
|
|
272
|
+
check();
|
|
273
|
+
}
|
|
274
|
+
rafId = requestAnimationFrame(run);
|
|
275
|
+
}
|
|
276
|
+
function sweepParkedEntries() {
|
|
277
|
+
const sweptIds = [];
|
|
278
|
+
for (let i = overlayStack.length - 1; i >= 0; i--) {
|
|
279
|
+
const entry = overlayStack[i];
|
|
280
|
+
if (entry !== void 0 && entry.close === void 0) {
|
|
281
|
+
sweptIds.push(entry.id);
|
|
282
|
+
overlayStack.splice(i, 1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return sweptIds;
|
|
286
|
+
}
|
|
287
|
+
function cleanupSeenIds(sweptIds) {
|
|
288
|
+
const activeIds = new Set(overlayStack.map((e) => e.id));
|
|
289
|
+
for (const id of sweptIds) {
|
|
290
|
+
if (!activeIds.has(id)) {
|
|
291
|
+
seenSyntheticIds.delete(id);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function useMobileBackToClose(open, onOpenChange) {
|
|
296
|
+
const idRef = useRef(void 0);
|
|
297
|
+
const onChangeRef = useRef(onOpenChange);
|
|
298
|
+
onChangeRef.current = onOpenChange;
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
if (typeof window === "undefined") return;
|
|
301
|
+
if (onChangeRef.current === void 0) return;
|
|
302
|
+
if (!isBelowMd()) return;
|
|
303
|
+
ensurePopListener();
|
|
304
|
+
if (open === true && idRef.current === void 0) {
|
|
305
|
+
const id = ++nextOverlayId;
|
|
306
|
+
idRef.current = id;
|
|
307
|
+
seenSyntheticIds.add(id);
|
|
308
|
+
const baseState = window.history.state ?? null;
|
|
309
|
+
window.history.pushState(
|
|
310
|
+
{
|
|
311
|
+
...baseState ?? {},
|
|
312
|
+
[HISTORY_KEY]: id
|
|
313
|
+
},
|
|
314
|
+
""
|
|
315
|
+
);
|
|
316
|
+
overlayStack.push({
|
|
317
|
+
id,
|
|
318
|
+
baseState,
|
|
319
|
+
close() {
|
|
320
|
+
idRef.current = void 0;
|
|
321
|
+
onChangeRef.current?.(false);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (open !== true && idRef.current !== void 0) {
|
|
327
|
+
const id = idRef.current;
|
|
328
|
+
idRef.current = void 0;
|
|
329
|
+
const entryIdx = overlayStack.findIndex((e) => e.id === id);
|
|
330
|
+
const entry = entryIdx !== -1 ? overlayStack[entryIdx] : void 0;
|
|
331
|
+
const { removed, parkedBelow } = removeFromStack(id);
|
|
332
|
+
if (removed && entry !== void 0) {
|
|
333
|
+
scheduleStateRestore(id, entry.baseState, parkedBelow);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}, [open]);
|
|
337
|
+
useEffect(() => {
|
|
338
|
+
return () => {
|
|
339
|
+
if (idRef.current !== void 0) {
|
|
340
|
+
const id = idRef.current;
|
|
341
|
+
idRef.current = void 0;
|
|
342
|
+
const entryIdx = overlayStack.findIndex((e) => e.id === id);
|
|
343
|
+
const entry = entryIdx !== -1 ? overlayStack[entryIdx] : void 0;
|
|
344
|
+
const { removed, parkedBelow } = removeFromStack(id);
|
|
345
|
+
if (removed && entry !== void 0) {
|
|
346
|
+
scheduleStateRestore(id, entry.baseState, parkedBelow);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
}, []);
|
|
351
|
+
}
|
|
352
|
+
function Dialog({
|
|
353
|
+
open,
|
|
354
|
+
defaultOpen,
|
|
355
|
+
onOpenChange,
|
|
356
|
+
...props
|
|
357
|
+
}) {
|
|
358
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(
|
|
359
|
+
defaultOpen ?? false
|
|
360
|
+
);
|
|
361
|
+
const isControlled = open !== void 0;
|
|
362
|
+
const currentOpen = isControlled ? open : uncontrolledOpen;
|
|
363
|
+
function handleOpenChange(next, eventDetails) {
|
|
364
|
+
if (!isControlled) setUncontrolledOpen(next);
|
|
365
|
+
onOpenChange?.(next, eventDetails);
|
|
366
|
+
}
|
|
367
|
+
useMobileBackToClose(currentOpen, handleOpenChange);
|
|
368
|
+
return /* @__PURE__ */ jsx(
|
|
369
|
+
Dialog$1.Root,
|
|
370
|
+
{
|
|
371
|
+
"data-slot": "dialog",
|
|
372
|
+
open: currentOpen,
|
|
373
|
+
onOpenChange: handleOpenChange,
|
|
374
|
+
...props
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
function DialogPortal({ ...props }) {
|
|
379
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, { "data-slot": "dialog-portal", ...props });
|
|
380
|
+
}
|
|
381
|
+
function DialogOverlay({
|
|
382
|
+
className,
|
|
383
|
+
...props
|
|
384
|
+
}) {
|
|
385
|
+
return /* @__PURE__ */ jsx(
|
|
386
|
+
Dialog$1.Backdrop,
|
|
387
|
+
{
|
|
388
|
+
"data-slot": "dialog-overlay",
|
|
389
|
+
className: cn(
|
|
390
|
+
// The dialog layer: a static whisper-of-ink scrim plus
|
|
391
|
+
// backdrop blur — part of the surface definition, not motion.
|
|
392
|
+
"fixed inset-0 isolate z-50 bg-foreground/5 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-sm",
|
|
393
|
+
className
|
|
394
|
+
),
|
|
395
|
+
...props
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
function DialogContent({
|
|
400
|
+
className,
|
|
401
|
+
children,
|
|
402
|
+
showCloseButton = true,
|
|
403
|
+
overlayClassName,
|
|
404
|
+
contentMotion = "default",
|
|
405
|
+
...props
|
|
406
|
+
}) {
|
|
407
|
+
const { t } = useTranslation("ui", { useSuspense: false });
|
|
408
|
+
const arranged = arrangeDialogChildren(children);
|
|
409
|
+
const motionClasses = contentMotion === "minimal" ? "data-ending-style:opacity-0 data-starting-style:opacity-0" : cn(
|
|
410
|
+
"data-ending-style:translate-y-10 data-ending-style:opacity-0 data-starting-style:translate-y-10 data-starting-style:opacity-0",
|
|
411
|
+
// ≥ sm the popup is centred with -translate-y-1/2, so the
|
|
412
|
+
// starting/ending styles must keep that offset (zoom + fade
|
|
413
|
+
// only, no slide) instead of clobbering it with translate-y-0.
|
|
414
|
+
"sm:data-ending-style:-translate-y-1/2 sm:data-ending-style:scale-95 sm:data-starting-style:-translate-y-1/2 sm:data-starting-style:scale-95"
|
|
415
|
+
);
|
|
416
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
417
|
+
/* @__PURE__ */ jsx(DialogOverlay, { className: overlayClassName }),
|
|
418
|
+
/* @__PURE__ */ jsxs(
|
|
419
|
+
Dialog$1.Popup,
|
|
420
|
+
{
|
|
421
|
+
"data-slot": "dialog-content",
|
|
422
|
+
className: cn(
|
|
423
|
+
// The floating-card anatomy: `bg-card`
|
|
424
|
+
// hairline-bordered surface with the system's one deep shadow.
|
|
425
|
+
// Mobile: bottom sheet occupying most of the viewport so edit
|
|
426
|
+
// forms have room to breathe. The component never scrolls
|
|
427
|
+
// itself; only the inner DialogBody does. Header/body/footer
|
|
428
|
+
// parts are held apart by the card's section gap
|
|
429
|
+
// (`gap-4` between the header document, the body and the
|
|
430
|
+
// hairline footer).
|
|
431
|
+
"fixed z-50 flex flex-col gap-4 bg-card text-sm text-card-foreground shadow-dialog outline-hidden transition duration-200 ease-in-out",
|
|
432
|
+
"inset-x-0 bottom-0 max-h-[85svh] overflow-hidden rounded-t-2xl rounded-b-none border border-b-0 border-border",
|
|
433
|
+
motionClasses,
|
|
434
|
+
// ≥ sm: centred modal, allow up to 90vh.
|
|
435
|
+
"sm:inset-x-auto sm:bottom-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:max-w-md sm:max-h-[90vh] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl",
|
|
436
|
+
className
|
|
437
|
+
),
|
|
438
|
+
...props,
|
|
439
|
+
children: [
|
|
440
|
+
arranged,
|
|
441
|
+
showCloseButton && /* @__PURE__ */ jsxs(
|
|
442
|
+
Dialog$1.Close,
|
|
443
|
+
{
|
|
444
|
+
"data-slot": "dialog-close",
|
|
445
|
+
className: "absolute top-3 right-3 z-20 flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground",
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ jsx(Cross, { className: "size-3" }),
|
|
448
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t("aria.close") })
|
|
449
|
+
]
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
)
|
|
455
|
+
] });
|
|
456
|
+
}
|
|
457
|
+
function DialogHeader({ className, ...props }) {
|
|
458
|
+
return /* @__PURE__ */ jsx(
|
|
459
|
+
"div",
|
|
460
|
+
{
|
|
461
|
+
"data-slot": "dialog-header",
|
|
462
|
+
className: cn(
|
|
463
|
+
// The header document: the card's `p-5`
|
|
464
|
+
// rhythm — 20px top and sides, no bottom padding — with the
|
|
465
|
+
// eyebrow, title row and description stacked tight; the section
|
|
466
|
+
// gap below separates it from the body.
|
|
467
|
+
"flex shrink-0 flex-col bg-card px-5 pt-5",
|
|
468
|
+
className
|
|
469
|
+
),
|
|
470
|
+
...props
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
function DialogBody({ className, ...props }) {
|
|
475
|
+
return /* @__PURE__ */ jsx(
|
|
476
|
+
"div",
|
|
477
|
+
{
|
|
478
|
+
"data-slot": "dialog-body",
|
|
479
|
+
className: cn(
|
|
480
|
+
"flex-1 overflow-y-auto overscroll-contain px-5",
|
|
481
|
+
className
|
|
482
|
+
),
|
|
483
|
+
...props
|
|
484
|
+
}
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
function DialogFooter({
|
|
488
|
+
className,
|
|
489
|
+
flush = false,
|
|
490
|
+
showCloseButton = false,
|
|
491
|
+
children,
|
|
492
|
+
...props
|
|
493
|
+
}) {
|
|
494
|
+
return /* @__PURE__ */ jsxs(
|
|
495
|
+
"div",
|
|
496
|
+
{
|
|
497
|
+
"data-slot": "dialog-footer",
|
|
498
|
+
className: cn("flex shrink-0 flex-col bg-card", className),
|
|
499
|
+
...props,
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ jsx(
|
|
502
|
+
"div",
|
|
503
|
+
{
|
|
504
|
+
className: cn(
|
|
505
|
+
"border-t border-border",
|
|
506
|
+
flush ? "mx-4" : "mx-5"
|
|
507
|
+
)
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
/* @__PURE__ */ jsxs(
|
|
511
|
+
"div",
|
|
512
|
+
{
|
|
513
|
+
className: cn(
|
|
514
|
+
// The hairline action bar: 16px above the
|
|
515
|
+
// buttons, the card's bottom padding (20px) below.
|
|
516
|
+
"flex flex-row justify-end flex-wrap gap-2",
|
|
517
|
+
flush ? "p-4" : "px-5 pt-4 pb-5"
|
|
518
|
+
),
|
|
519
|
+
children: [
|
|
520
|
+
children,
|
|
521
|
+
showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, { render: /* @__PURE__ */ jsx(Button, { variant: "outline" }), children: "Close" })
|
|
522
|
+
]
|
|
523
|
+
}
|
|
524
|
+
)
|
|
525
|
+
]
|
|
526
|
+
}
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
function DialogTitle({ className, ...props }) {
|
|
530
|
+
return /* @__PURE__ */ jsx(
|
|
531
|
+
Dialog$1.Title,
|
|
532
|
+
{
|
|
533
|
+
"data-slot": "dialog-title",
|
|
534
|
+
className: cn("text-sm font-semibold", className),
|
|
535
|
+
...props
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
function DialogDescription({
|
|
540
|
+
className,
|
|
541
|
+
...props
|
|
542
|
+
}) {
|
|
543
|
+
return /* @__PURE__ */ jsx(
|
|
544
|
+
Dialog$1.Description,
|
|
545
|
+
{
|
|
546
|
+
"data-slot": "dialog-description",
|
|
547
|
+
className: cn(
|
|
548
|
+
"text-xs leading-5 text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
|
|
549
|
+
className
|
|
550
|
+
),
|
|
551
|
+
...props
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
function arrangeDialogChildren(children) {
|
|
556
|
+
const headers = [];
|
|
557
|
+
const footers = [];
|
|
558
|
+
const bodyNodes = [];
|
|
559
|
+
let hasExplicitBody = false;
|
|
560
|
+
React.Children.forEach(children, (child) => {
|
|
561
|
+
if (!React.isValidElement(child)) {
|
|
562
|
+
bodyNodes.push(child);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (child.type === DialogHeader) {
|
|
566
|
+
headers.push(child);
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
if (child.type === DialogFooter) {
|
|
570
|
+
footers.push(child);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (child.type === DialogBody) {
|
|
574
|
+
hasExplicitBody = true;
|
|
575
|
+
bodyNodes.push(child);
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
bodyNodes.push(child);
|
|
579
|
+
});
|
|
580
|
+
const body = hasExplicitBody ? bodyNodes : /* @__PURE__ */ jsx(DialogBody, { children: bodyNodes });
|
|
581
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
582
|
+
headers,
|
|
583
|
+
body,
|
|
584
|
+
footers
|
|
585
|
+
] });
|
|
586
|
+
}
|
|
587
|
+
var DialogFooterActionsContext = createContext(null);
|
|
588
|
+
var sizeClasses = {
|
|
589
|
+
sm: "sm:max-w-sm",
|
|
590
|
+
md: "sm:max-w-md",
|
|
591
|
+
lg: "sm:max-w-2xl",
|
|
592
|
+
xl: "sm:max-w-3xl",
|
|
593
|
+
"2xl": "sm:max-w-4xl"
|
|
594
|
+
};
|
|
595
|
+
function AppDialog(props) {
|
|
596
|
+
const {
|
|
597
|
+
open,
|
|
598
|
+
onOpenChange,
|
|
599
|
+
title,
|
|
600
|
+
eyebrow,
|
|
601
|
+
icon,
|
|
602
|
+
danger,
|
|
603
|
+
size,
|
|
604
|
+
flush,
|
|
605
|
+
description,
|
|
606
|
+
children,
|
|
607
|
+
footer,
|
|
608
|
+
contentClassName,
|
|
609
|
+
overlayClassName,
|
|
610
|
+
contentMotion,
|
|
611
|
+
suppressAutoFocus = true,
|
|
612
|
+
contentTestId
|
|
613
|
+
} = props;
|
|
614
|
+
const contentRef = useRef(null);
|
|
615
|
+
const [footerActions, setFooterActions] = useState(null);
|
|
616
|
+
const actionsValue = useMemo(
|
|
617
|
+
() => ({ setFooterActions }),
|
|
618
|
+
[setFooterActions]
|
|
619
|
+
);
|
|
620
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
|
|
621
|
+
DialogContent,
|
|
622
|
+
{
|
|
623
|
+
ref: contentRef,
|
|
624
|
+
className: cn(
|
|
625
|
+
size !== void 0 && sizeClasses[size],
|
|
626
|
+
flush && "p-0",
|
|
627
|
+
contentClassName
|
|
628
|
+
),
|
|
629
|
+
overlayClassName,
|
|
630
|
+
contentMotion,
|
|
631
|
+
initialFocus: suppressAutoFocus ? contentRef : void 0,
|
|
632
|
+
"data-testid": contentTestId,
|
|
633
|
+
children: [
|
|
634
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: flush ? "gap-4" : void 0, children: [
|
|
635
|
+
eyebrow !== void 0 ? /* @__PURE__ */ jsx(
|
|
636
|
+
"span",
|
|
637
|
+
{
|
|
638
|
+
className: cn(
|
|
639
|
+
"text-tiny font-semibold tracking-label uppercase",
|
|
640
|
+
danger ? "text-destructive" : "text-muted-foreground"
|
|
641
|
+
),
|
|
642
|
+
children: eyebrow
|
|
643
|
+
}
|
|
644
|
+
) : null,
|
|
645
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-3 pr-6", children: [
|
|
646
|
+
icon,
|
|
647
|
+
/* @__PURE__ */ jsx(
|
|
648
|
+
DialogTitle,
|
|
649
|
+
{
|
|
650
|
+
className: cn("truncate", danger && "text-destructive"),
|
|
651
|
+
children: title
|
|
652
|
+
}
|
|
653
|
+
)
|
|
654
|
+
] }),
|
|
655
|
+
description !== void 0 ? /* @__PURE__ */ jsx(DialogDescription, { children: description }) : null
|
|
656
|
+
] }),
|
|
657
|
+
/* @__PURE__ */ jsx(DialogBody, { className: flush ? "p-0" : void 0, children: /* @__PURE__ */ jsx(DialogFooterActionsContext.Provider, { value: actionsValue, children }) }),
|
|
658
|
+
footer !== void 0 && footer !== null || footerActions !== null ? /* @__PURE__ */ jsxs(DialogFooter, { flush, children: [
|
|
659
|
+
footer,
|
|
660
|
+
footerActions
|
|
661
|
+
] }) : null
|
|
662
|
+
]
|
|
663
|
+
}
|
|
664
|
+
) });
|
|
665
|
+
}
|
|
666
|
+
function PluginDownloadConsentDialog(props) {
|
|
667
|
+
const { entry, onDeny, onAllow } = props;
|
|
668
|
+
const { t } = useTranslation("ui", { useSuspense: false });
|
|
669
|
+
const formatBytes = props.formatBytes ?? ((bytes) => `${bytes} B`);
|
|
670
|
+
const activeId = entry === null ? null : entry.ticketId;
|
|
671
|
+
const [remember, setRemember] = useState(false);
|
|
672
|
+
useEffect(() => {
|
|
673
|
+
setRemember(false);
|
|
674
|
+
}, [activeId]);
|
|
675
|
+
return /* @__PURE__ */ jsx(
|
|
676
|
+
AppDialog,
|
|
677
|
+
{
|
|
678
|
+
open: entry !== null,
|
|
679
|
+
onOpenChange: (open) => {
|
|
680
|
+
if (!open && activeId !== null) onDeny(activeId);
|
|
681
|
+
},
|
|
682
|
+
title: t("pluginDownload.title", void 0),
|
|
683
|
+
eyebrow: t("pluginDownload.eyebrow", void 0),
|
|
684
|
+
description: entry === null ? void 0 : t("pluginDownload.description", {
|
|
685
|
+
pluginName: entry.pluginName
|
|
686
|
+
}),
|
|
687
|
+
size: "md",
|
|
688
|
+
contentTestId: "plugin-download-consent",
|
|
689
|
+
footer: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
690
|
+
/* @__PURE__ */ jsx(
|
|
691
|
+
Button,
|
|
692
|
+
{
|
|
693
|
+
variant: "outline",
|
|
694
|
+
size: "sm",
|
|
695
|
+
disabled: activeId === null,
|
|
696
|
+
onClick: () => activeId !== null && onDeny(activeId),
|
|
697
|
+
"data-testid": "plugin-download-deny",
|
|
698
|
+
children: t("pluginDownload.deny", void 0)
|
|
699
|
+
}
|
|
700
|
+
),
|
|
701
|
+
/* @__PURE__ */ jsx(
|
|
702
|
+
Button,
|
|
703
|
+
{
|
|
704
|
+
size: "sm",
|
|
705
|
+
disabled: activeId === null,
|
|
706
|
+
onClick: () => activeId !== null && onAllow(activeId, remember),
|
|
707
|
+
"data-testid": "plugin-download-allow",
|
|
708
|
+
children: t("pluginDownload.allow", void 0)
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
] }),
|
|
712
|
+
children: entry === null ? null : /* @__PURE__ */ jsx(
|
|
713
|
+
ConsentBody,
|
|
714
|
+
{
|
|
715
|
+
entry,
|
|
716
|
+
remember,
|
|
717
|
+
onRememberChange: setRemember,
|
|
718
|
+
formatBytes
|
|
719
|
+
}
|
|
720
|
+
)
|
|
721
|
+
}
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
function ConsentBody(props) {
|
|
725
|
+
const { entry, remember, onRememberChange, formatBytes } = props;
|
|
726
|
+
const { t } = useTranslation("ui", { useSuspense: false });
|
|
727
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
728
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
729
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs tracking-label text-muted-foreground uppercase", children: t("pluginDownload.urlLabel", void 0) }),
|
|
730
|
+
/* @__PURE__ */ jsx(
|
|
731
|
+
"code",
|
|
732
|
+
{
|
|
733
|
+
className: "rounded-sm bg-muted px-2 py-1.5 text-xs text-secondary-foreground break-all select-all",
|
|
734
|
+
"data-testid": "plugin-download-url",
|
|
735
|
+
children: entry.url
|
|
736
|
+
}
|
|
737
|
+
)
|
|
738
|
+
] }),
|
|
739
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
740
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs tracking-label text-muted-foreground uppercase", children: t("pluginDownload.destLabel", void 0) }),
|
|
741
|
+
/* @__PURE__ */ jsx(
|
|
742
|
+
"code",
|
|
743
|
+
{
|
|
744
|
+
className: "text-xs text-secondary-foreground break-all select-all",
|
|
745
|
+
"data-testid": "plugin-download-dest",
|
|
746
|
+
children: entry.dest
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
] }),
|
|
750
|
+
/* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
751
|
+
t("pluginDownload.sizeLabel", void 0),
|
|
752
|
+
":",
|
|
753
|
+
" ",
|
|
754
|
+
entry.sizeBytes === void 0 ? t("pluginDownload.unknownSize", void 0) : formatBytes(entry.sizeBytes)
|
|
755
|
+
] }),
|
|
756
|
+
entry.reason !== void 0 && entry.reason.length > 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-secondary-foreground italic", children: entry.reason }) : null,
|
|
757
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-t pt-3", children: [
|
|
758
|
+
/* @__PURE__ */ jsx(
|
|
759
|
+
Checkbox,
|
|
760
|
+
{
|
|
761
|
+
checked: remember,
|
|
762
|
+
onCheckedChange: (checked) => onRememberChange(checked === true),
|
|
763
|
+
id: "plugin-download-remember"
|
|
764
|
+
}
|
|
765
|
+
),
|
|
766
|
+
/* @__PURE__ */ jsx(
|
|
767
|
+
"label",
|
|
768
|
+
{
|
|
769
|
+
htmlFor: "plugin-download-remember",
|
|
770
|
+
className: "text-xs text-secondary-foreground select-none",
|
|
771
|
+
children: t("pluginDownload.remember", void 0)
|
|
772
|
+
}
|
|
773
|
+
)
|
|
774
|
+
] })
|
|
775
|
+
] });
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
export { PluginDownloadConsentDialog };
|
|
779
|
+
//# sourceMappingURL=plugin-download-consent.js.map
|
|
780
|
+
//# sourceMappingURL=plugin-download-consent.js.map
|