@petrarca/sonnet-ui 0.4.1 → 0.5.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/index.d.ts +117 -7
- package/dist/index.js +752 -516
- package/dist/index.js.map +1 -1
- package/dist/json-editor/index.d.ts +9 -1
- package/dist/json-editor/index.js +24 -17
- package/dist/json-editor/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,49 @@ interface ButtonProps$1 extends React$1.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
50
50
|
}
|
|
51
51
|
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps$1 & React$1.RefAttributes<HTMLButtonElement>>;
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* IconButton -- a compact, square icon-only button with an accessible label
|
|
55
|
+
* and a tooltip. The house standard for inline affordances (rename, delete,
|
|
56
|
+
* edit) and small toolbar actions across the Sonnet apps.
|
|
57
|
+
*
|
|
58
|
+
* - `variant` defaults to "ghost" (borderless, for inline/hover-reveal rows).
|
|
59
|
+
* Use "outline" for standalone toolbar buttons.
|
|
60
|
+
* - `tone="destructive"` tints the hover state red (e.g. delete).
|
|
61
|
+
* - The `label` is both the tooltip text and the aria-label, so the button is
|
|
62
|
+
* always accessible without visible text.
|
|
63
|
+
* - Do not size the icon yourself: the underlying Button forces child SVGs to
|
|
64
|
+
* `size-4` (16px), so pass a bare `<Icon />` (no h-/w- class).
|
|
65
|
+
* - `revealOnHover` applies the house row-action convention: the button is
|
|
66
|
+
* hidden at rest and revealed when the row is hovered or the button is
|
|
67
|
+
* keyboard-focused; a disabled action stays faintly visible (opacity-30)
|
|
68
|
+
* rather than hidden. The row must set the `group/row` class for this.
|
|
69
|
+
*
|
|
70
|
+
* Usage:
|
|
71
|
+
* <IconButton label="Delete" tone="destructive" onClick={...}>
|
|
72
|
+
* <Trash2 />
|
|
73
|
+
* </IconButton>
|
|
74
|
+
*
|
|
75
|
+
* // row-action (parent row has className="... group/row"):
|
|
76
|
+
* <IconButton label="Edit" revealOnHover onClick={...}><Pencil /></IconButton>
|
|
77
|
+
*/
|
|
78
|
+
interface IconButtonProps extends Omit<ButtonProps$1, "size" | "children" | "aria-label"> {
|
|
79
|
+
/** Tooltip text and accessible label. */
|
|
80
|
+
label: string;
|
|
81
|
+
/** The icon to render. */
|
|
82
|
+
children: React$1.ReactNode;
|
|
83
|
+
/** Hover tone. "destructive" tints hover red. Default "default". */
|
|
84
|
+
tone?: "default" | "destructive";
|
|
85
|
+
/** Tooltip side. */
|
|
86
|
+
tooltipSide?: "top" | "right" | "bottom" | "left";
|
|
87
|
+
/**
|
|
88
|
+
* Row-action reveal: hidden at rest, shown on row hover (`group/row`) or
|
|
89
|
+
* keyboard focus. Disabled buttons stay at opacity-30 instead of hidden, so
|
|
90
|
+
* the affordance reads as "present but unavailable". Default false.
|
|
91
|
+
*/
|
|
92
|
+
revealOnHover?: boolean;
|
|
93
|
+
}
|
|
94
|
+
declare const IconButton: React$1.ForwardRefExoticComponent<IconButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
95
|
+
|
|
53
96
|
declare const Card: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
54
97
|
declare const CardHeader: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
55
98
|
declare const CardTitle: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -413,6 +456,12 @@ interface TabsListProps extends React$1.ComponentPropsWithoutRef<typeof TabsPrim
|
|
|
413
456
|
declare const TabsList: React$1.ForwardRefExoticComponent<TabsListProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
414
457
|
declare const TabsTrigger: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
415
458
|
declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
459
|
+
/**
|
|
460
|
+
* TabsSeparator -- a thin, non-interactive vertical divider placed inside a
|
|
461
|
+
* TabsList to visually group related triggers (e.g. preview tabs vs. source
|
|
462
|
+
* tabs). Presentational only; not part of the roving-tabindex order.
|
|
463
|
+
*/
|
|
464
|
+
declare const TabsSeparator: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
416
465
|
|
|
417
466
|
declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
|
|
418
467
|
|
|
@@ -623,6 +672,23 @@ declare function createRenderer<TRow = Record<string, unknown>>(render: (row: TR
|
|
|
623
672
|
* Extractable to @petrarca/sonnet-ui.
|
|
624
673
|
*/
|
|
625
674
|
|
|
675
|
+
/** How a row's detail (onRowClick) is opened. */
|
|
676
|
+
type RowActivation = "click" | "double-click";
|
|
677
|
+
/**
|
|
678
|
+
* Props of EntityTable that can be defaulted app-wide via SonnetConfigProvider.
|
|
679
|
+
* Behavioral, non-data props only.
|
|
680
|
+
*/
|
|
681
|
+
interface EntityTableConfigurable {
|
|
682
|
+
rowActivation: RowActivation;
|
|
683
|
+
showChevron: boolean;
|
|
684
|
+
}
|
|
685
|
+
declare module "@petrarca/sonnet-core" {
|
|
686
|
+
interface SonnetComponentDefaults {
|
|
687
|
+
EntityTable?: {
|
|
688
|
+
defaultProps?: Partial<EntityTableConfigurable>;
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
}
|
|
626
692
|
/** Declarative row action rendered as a button in a trailing "Actions" column. */
|
|
627
693
|
interface RowAction<TRow> {
|
|
628
694
|
label: string;
|
|
@@ -646,6 +712,30 @@ interface EntityTableProps<TRow extends RowData> {
|
|
|
646
712
|
isFiltered?: boolean;
|
|
647
713
|
emptyMessage?: string;
|
|
648
714
|
onRowClick?: (row: TRow) => void;
|
|
715
|
+
/**
|
|
716
|
+
* How onRowClick (open detail) is triggered. Resolved against app-wide
|
|
717
|
+
* config (SonnetConfigProvider) then the built-in default "click".
|
|
718
|
+
*
|
|
719
|
+
* "click" -- single-click on a row opens detail (default,
|
|
720
|
+
* preserves existing behavior). The chevron is a
|
|
721
|
+
* non-interactive affordance.
|
|
722
|
+
* "double-click" -- single-click sets the active row (and fires
|
|
723
|
+
* onActiveRowChange); double-click, or clicking the
|
|
724
|
+
* trailing chevron button, opens detail.
|
|
725
|
+
*/
|
|
726
|
+
rowActivation?: RowActivation;
|
|
727
|
+
/**
|
|
728
|
+
* Fired when the active (single-selected) row changes. Only meaningful when
|
|
729
|
+
* rowActivation is "double-click" and selectionMode is off. null when the
|
|
730
|
+
* active row is cleared.
|
|
731
|
+
*/
|
|
732
|
+
onActiveRowChange?: (row: TRow | null) => void;
|
|
733
|
+
/**
|
|
734
|
+
* Whether to show the trailing chevron column. Resolved against app-wide
|
|
735
|
+
* config then a built-in default of "show when onRowClick is set". In
|
|
736
|
+
* "double-click" mode the chevron is an interactive button that opens detail.
|
|
737
|
+
*/
|
|
738
|
+
showChevron?: boolean;
|
|
649
739
|
selectionMode?: boolean;
|
|
650
740
|
onSelectionChange?: (selectedRows: TRow[]) => void;
|
|
651
741
|
pagination?: PaginationState;
|
|
@@ -655,22 +745,29 @@ interface EntityTableProps<TRow extends RowData> {
|
|
|
655
745
|
declare function EntityTable<TRow extends RowData>(props: EntityTableProps<TRow>): React__default.ReactElement;
|
|
656
746
|
|
|
657
747
|
/**
|
|
658
|
-
* PropertyList — read-only display of a record's properties
|
|
748
|
+
* PropertyList — read-only display of a record's properties.
|
|
659
749
|
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
750
|
+
* Two layout modes:
|
|
751
|
+
* - `"inline"` (default) — horizontal two-column grid, key left / value right.
|
|
752
|
+
* - `"stacked"` — key label above each value.
|
|
753
|
+
*
|
|
754
|
+
* Values rendered by {@link PropertyValue}. Optional per-property schema
|
|
755
|
+
* refines value rendering (schema is NOT required).
|
|
663
756
|
*
|
|
664
757
|
* Shared by the graph view's node/edge cards and the table inspector so all
|
|
665
758
|
* property displays look identical.
|
|
666
759
|
*/
|
|
667
760
|
|
|
761
|
+
/** Layout mode for the property list. */
|
|
762
|
+
type PropertyListLayout = "inline" | "stacked";
|
|
668
763
|
interface PropertyListProps {
|
|
669
764
|
/** Property name -> value. */
|
|
670
765
|
properties: Record<string, unknown>;
|
|
671
766
|
/** Optional property name -> schema, to refine value rendering. */
|
|
672
767
|
propertySchemas?: Record<string, JsonSchemaProperty>;
|
|
673
|
-
/**
|
|
768
|
+
/** Layout mode. Default "inline" (horizontal key-value grid). */
|
|
769
|
+
layout?: PropertyListLayout;
|
|
770
|
+
/** Show a "Properties" section header. Default false. */
|
|
674
771
|
showHeader?: boolean;
|
|
675
772
|
/** Click value to copy it to the clipboard. Default true. */
|
|
676
773
|
copyable?: boolean;
|
|
@@ -678,7 +775,7 @@ interface PropertyListProps {
|
|
|
678
775
|
emptyLabel?: string;
|
|
679
776
|
className?: string;
|
|
680
777
|
}
|
|
681
|
-
declare function PropertyList({ properties, propertySchemas, showHeader, copyable, emptyLabel, className, }: PropertyListProps): React__default.ReactElement;
|
|
778
|
+
declare function PropertyList({ properties, propertySchemas, layout, showHeader, copyable, emptyLabel, className, }: PropertyListProps): React__default.ReactElement;
|
|
682
779
|
|
|
683
780
|
/**
|
|
684
781
|
* PropertyValue — read-only, type-aware rendering of a single property value.
|
|
@@ -737,6 +834,13 @@ interface EntitySelectProps {
|
|
|
737
834
|
minChars?: number;
|
|
738
835
|
/** Currently selected value (controlled). */
|
|
739
836
|
value?: string | null;
|
|
837
|
+
/**
|
|
838
|
+
* The option for the current value, supplying its label. Use when the
|
|
839
|
+
* selected value is set before any options have loaded (e.g. an edit form
|
|
840
|
+
* in typeahead/explicit mode) so the trigger can render the label without
|
|
841
|
+
* fetching the full list. Must match `value`; ignored otherwise.
|
|
842
|
+
*/
|
|
843
|
+
selectedOption?: EntityOption | null;
|
|
740
844
|
/** Called when the selection changes. */
|
|
741
845
|
onChange?: (value: string | null) => void;
|
|
742
846
|
/** Called when the selection changes, passing the full option (value + label). */
|
|
@@ -753,6 +857,12 @@ interface EntitySelectProps {
|
|
|
753
857
|
emptyMessage?: string;
|
|
754
858
|
/** Whether the field is required (shows asterisk). */
|
|
755
859
|
required?: boolean;
|
|
860
|
+
/**
|
|
861
|
+
* Show a clear (X) affordance that resets the selection to null when a value
|
|
862
|
+
* is set. Use for optional entity references (e.g. an assignment that can be
|
|
863
|
+
* removed). Ignored when required or disabled.
|
|
864
|
+
*/
|
|
865
|
+
clearable?: boolean;
|
|
756
866
|
/** Whether the select is disabled. */
|
|
757
867
|
disabled?: boolean;
|
|
758
868
|
/** Description text below the label. */
|
|
@@ -1080,4 +1190,4 @@ type Props = {
|
|
|
1080
1190
|
*/
|
|
1081
1191
|
declare function ClipboardMenu({ onAddItem }: Props): react_jsx_runtime.JSX.Element;
|
|
1082
1192
|
|
|
1083
|
-
export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, CELL_RENDERERS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellRenderer, type CellRendererProps, Checkbox, ClipboardButton, ClipboardItemComponent as ClipboardItem, ClipboardMenu, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EntitySelect, type EntitySelectProps, EntityTable, type EntityTableProps, EntityTree, type EntityTreeHandle, type EntityTreeProps, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Popover, PopoverContent, PopoverTrigger, PropertyList, type PropertyListProps, PropertyValue, type PropertyValueProps, ResizeHandle, type ResizeHandleProps, type ResolvedColumn, type RowAction, ScrollArea, ScrollBar, SearchInput, type SearchMode, Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetTitle, SheetTrigger, SimpleGroup, SimpleStack, SimpleTooltip, Skeleton, Spinner, Stepper, StepperContent, StepperDescription, StepperIndicator, StepperItem, StepperList, StepperNext, StepperPrev, type StepperProps, StepperSeparator, StepperTitle, StepperTrigger, type TableUiSchema, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TreeNode, TreeView, type TreeViewHandle, type TreeViewProps, badgeVariants, buttonVariants, createRenderer, useStore as useStepper };
|
|
1193
|
+
export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, CELL_RENDERERS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellRenderer, type CellRendererProps, Checkbox, ClipboardButton, ClipboardItemComponent as ClipboardItem, ClipboardMenu, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EntitySelect, type EntitySelectProps, EntityTable, type EntityTableProps, EntityTree, type EntityTreeHandle, type EntityTreeProps, IconButton, type IconButtonProps, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Popover, PopoverContent, PopoverTrigger, PropertyList, type PropertyListLayout, type PropertyListProps, PropertyValue, type PropertyValueProps, ResizeHandle, type ResizeHandleProps, type ResolvedColumn, type RowAction, ScrollArea, ScrollBar, SearchInput, type SearchMode, Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetTitle, SheetTrigger, SimpleGroup, SimpleStack, SimpleTooltip, Skeleton, Spinner, Stepper, StepperContent, StepperDescription, StepperIndicator, StepperItem, StepperList, StepperNext, StepperPrev, type StepperProps, StepperSeparator, StepperTitle, StepperTrigger, type TableUiSchema, Tabs, TabsContent, TabsList, TabsSeparator, TabsTrigger, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TreeNode, TreeView, type TreeViewHandle, type TreeViewProps, badgeVariants, buttonVariants, createRenderer, useStore as useStepper };
|