@lontar/admin 0.1.2 → 0.3.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/dist/components/ui/alert-dialog.d.ts +11 -0
- package/dist/components/ui/alert.d.ts +7 -0
- package/dist/components/ui/badge.d.ts +7 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/calendar.d.ts +4 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/field.d.ts +10 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/popover.d.ts +6 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/table.d.ts +8 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +6 -0
- package/dist/context/PortalContainer.d.ts +10 -0
- package/dist/context/ThemeContext.d.ts +22 -0
- package/dist/fields/DateTimePicker.d.ts +9 -0
- package/dist/fields/FieldRenderer.d.ts +5 -3
- package/dist/fields/picker-parts.d.ts +48 -0
- package/dist/index.js +21544 -9410
- package/dist/layout/BrandMark.d.ts +1 -0
- package/dist/layout/FullPageState.d.ts +8 -0
- package/dist/layout/ThemeToggle.d.ts +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/styles.css +2 -1
- package/dist/views/CollectionFilterBar.d.ts +6 -1
- package/dist/views/ConfirmDeleteDialog.d.ts +5 -0
- package/dist/views/EmptyCard.d.ts +4 -0
- package/dist/views/ViewHeader.d.ts +10 -0
- package/package.json +18 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
3
|
+
declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
|
|
4
|
+
declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
6
|
+
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
7
|
+
declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
8
|
+
declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
9
|
+
declare const AlertDialogAction: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
declare const AlertDialogCancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const alertVariants: (props?: ({
|
|
4
|
+
variant?: "success" | "default" | "destructive" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
declare function Alert({ className, variant, role, ...props }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>): React.JSX.Element;
|
|
7
|
+
export { Alert, alertVariants };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "success" | "default" | "destructive" | "outline" | "secondary" | "muted" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
declare function Badge({ className, variant, ...props }: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants>): React.JSX.Element;
|
|
7
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Card({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
3
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
4
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
5
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
6
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
7
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
8
|
+
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
export { Checkbox };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Label } from './label';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare function Field({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
4
|
+
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React.JSX.Element;
|
|
5
|
+
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<'div'> & {
|
|
6
|
+
errors?: Array<{
|
|
7
|
+
message?: string;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
}): React.JSX.Element | null;
|
|
10
|
+
export { Field, FieldLabel, FieldError };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
4
|
+
export { Label };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
|
+
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { Popover, PopoverTrigger, PopoverContent };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
4
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<'table'>): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<'thead'>): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<'tbody'>): React.JSX.Element;
|
|
5
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<'tr'>): React.JSX.Element;
|
|
6
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<'th'>): React.JSX.Element;
|
|
7
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<'td'>): React.JSX.Element;
|
|
8
|
+
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
declare function Tooltip({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { Tooltip, TooltipTrigger, TooltipContent };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface PortalContainerContextValue {
|
|
3
|
+
/** Null until the target node has mounted, on the render after the first. */
|
|
4
|
+
container: HTMLElement | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const PortalContainerContext: import('react').Context<PortalContainerContextValue | null>;
|
|
7
|
+
export declare function usePortalContainer(): HTMLElement | null;
|
|
8
|
+
export declare function PortalContainerProvider({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ThemePreference = 'light' | 'dark' | 'system';
|
|
2
|
+
/** Prefixed so it cannot collide with the host application's own keys. */
|
|
3
|
+
export declare const THEME_STORAGE_KEY = "lontar-admin-theme";
|
|
4
|
+
/**
|
|
5
|
+
* Reads the stored choice only once `mounted` is true. The admin's first
|
|
6
|
+
* render must match the server's, and the server cannot see localStorage, so
|
|
7
|
+
* reading earlier would make React report a hydration mismatch on the
|
|
8
|
+
* wrapper's data-theme.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useThemePreference(mounted: boolean): {
|
|
11
|
+
theme: ThemePreference;
|
|
12
|
+
setTheme: (next: ThemePreference) => void;
|
|
13
|
+
/** Value for the wrapper's data-theme attribute; absent means system. */
|
|
14
|
+
dataTheme: "light" | "dark" | undefined;
|
|
15
|
+
};
|
|
16
|
+
interface ThemeContextValue {
|
|
17
|
+
theme: ThemePreference;
|
|
18
|
+
setTheme: (theme: ThemePreference) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const ThemeContext: import('react').Context<ThemeContextValue | null>;
|
|
21
|
+
export declare function useTheme(): ThemeContextValue;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { Button } from '../components/ui/button';
|
|
3
|
+
export interface DateTimePickerProps extends Omit<ComponentProps<typeof Button>, 'value' | 'onChange'> {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
|
+
/** Offers a Clear action; a required field has nothing to clear to. */
|
|
7
|
+
clearable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const DateTimePicker: import('react').ForwardRefExoticComponent<Omit<DateTimePickerProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { UseFormRegister, UseFormSetValue, UseFormWatch } from 'react-hook-form';
|
|
1
|
+
import { Control, UseFormRegister, UseFormSetValue, UseFormWatch } from 'react-hook-form';
|
|
2
2
|
import { ClientField } from '@lontar/core/client';
|
|
3
3
|
export interface FieldRendererProps {
|
|
4
4
|
field: ClientField;
|
|
5
|
+
control: Control<Record<string, unknown>>;
|
|
5
6
|
register: UseFormRegister<Record<string, unknown>>;
|
|
6
7
|
error?: {
|
|
7
8
|
message?: string;
|
|
8
|
-
}
|
|
9
|
+
} | Record<string, unknown>;
|
|
9
10
|
setValue?: UseFormSetValue<Record<string, unknown>>;
|
|
10
11
|
watch?: UseFormWatch<Record<string, unknown>>;
|
|
11
12
|
mode?: 'create' | 'edit';
|
|
13
|
+
pathPrefix?: string;
|
|
12
14
|
}
|
|
13
15
|
export declare function slugify(text: string): string;
|
|
14
|
-
export declare function FieldRenderer(
|
|
16
|
+
export declare function FieldRenderer(props: FieldRendererProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Button } from '../components/ui/button';
|
|
3
|
+
import { Input } from '../components/ui/input';
|
|
4
|
+
/** Compact outline button used for every picker action. */
|
|
5
|
+
export declare function PickerButton({ className, destructive, ...props }: ComponentProps<typeof Button> & {
|
|
6
|
+
destructive?: boolean;
|
|
7
|
+
}): import('react').JSX.Element;
|
|
8
|
+
/** Opens a document in a new tab; rendered as a button for consistency. */
|
|
9
|
+
export declare function PickerViewLink({ href, testId }: {
|
|
10
|
+
href: string;
|
|
11
|
+
testId: string;
|
|
12
|
+
}): import('react').JSX.Element;
|
|
13
|
+
export declare function PickerSearchBar({ onCancel, cancelTestId, ...inputProps }: ComponentProps<typeof Input> & {
|
|
14
|
+
onCancel?: () => void;
|
|
15
|
+
cancelTestId: string;
|
|
16
|
+
}): import('react').JSX.Element;
|
|
17
|
+
export declare function PickerResults({ className, ...props }: ComponentProps<'div'>): import('react').JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* One row in the results list. Every row has a transparent 1px border from
|
|
20
|
+
* Button; only its bottom edge is coloured, which draws the divider without a
|
|
21
|
+
* `divide-y` on the parent (whose zero-specificity selector would lose to the
|
|
22
|
+
* row's own border utilities).
|
|
23
|
+
*/
|
|
24
|
+
export declare function PickerOption({ className, ...props }: ComponentProps<typeof Button>): import('react').JSX.Element;
|
|
25
|
+
export declare function PickerStatus({ children, error }: {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
error?: boolean;
|
|
28
|
+
}): import('react').JSX.Element;
|
|
29
|
+
/** Bordered row a chosen document is displayed in. */
|
|
30
|
+
export declare function PickerCard({ className, ...props }: ComponentProps<'div'>): import('react').JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* Floats a picker's search over the form instead of pushing the fields below
|
|
33
|
+
* it down (#136). `open` is the picker's own `isSearching` state, so when the
|
|
34
|
+
* search shows and hides is unchanged; Escape and an outside click now close it
|
|
35
|
+
* too. Radix moves focus to the first focusable element inside, the search
|
|
36
|
+
* input, when it opens.
|
|
37
|
+
*/
|
|
38
|
+
export declare function PickerPopover({ open, onOpenChange, trigger, children, }: {
|
|
39
|
+
open: boolean;
|
|
40
|
+
onOpenChange: (open: boolean) => void;
|
|
41
|
+
trigger: ReactNode;
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}): import('react').JSX.Element;
|
|
44
|
+
/** Full-width trigger shown in place of an empty single-value picker. */
|
|
45
|
+
export declare function PickerEmptyTrigger({ className, ...props }: ComponentProps<typeof Button>): import('react').JSX.Element;
|
|
46
|
+
export declare const pickerTitleClass = "lt:truncate lt:font-medium lt:text-foreground";
|
|
47
|
+
export declare const pickerActionsClass = "lt:flex lt:shrink-0 lt:items-center lt:gap-1.5";
|
|
48
|
+
export declare const pickerThumbClass = "lt:shrink-0 lt:rounded-sm lt:border lt:object-cover";
|