@shipfox/react-ui 0.31.1 → 0.32.1
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/alert/alert.d.ts +1 -1
- package/dist/components/alert/alert.js +1 -1
- package/dist/components/avatar/avatar.d.ts +1 -1
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/command/command.d.ts +2 -2
- package/dist/components/command/command.js +1 -1
- package/dist/components/dashboard/components/charts/bar-chart.js +4 -0
- package/dist/components/dashboard/components/charts/chart-tooltip.js +1 -1
- package/dist/components/dashboard/components/charts/line-chart.js +4 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/components/form/form.d.ts +1 -1
- package/dist/components/form/form.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/inline-tips/inline-tips.d.ts +1 -1
- package/dist/components/inline-tips/inline-tips.js +1 -1
- package/dist/components/modal/modal.d.ts +2 -2
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/popover/popover.d.ts +1 -1
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.js +1 -1
- package/dist/components/sheet/sheet.d.ts +2 -2
- package/dist/components/sheet/sheet.js +1 -1
- package/dist/components/shiny-text/shiny-text.d.ts +1 -1
- package/dist/components/shipql-editor/index.d.ts +1 -1
- package/dist/components/shipql-editor/lexical/shipql-leaf-node.d.ts +3 -2
- package/dist/components/shipql-editor/lexical/shipql-leaf-node.js +8 -4
- package/dist/components/shipql-editor/lexical/shipql-plugin.d.ts +2 -1
- package/dist/components/shipql-editor/lexical/shipql-plugin.js +7 -3
- package/dist/components/shipql-editor/shipql-editor-inner.d.ts +1 -1
- package/dist/components/shipql-editor/shipql-editor-inner.js +7 -2
- package/dist/components/shipql-editor/shipql-editor.d.ts +3 -2
- package/dist/components/shipql-editor/shipql-editor.js +7 -1
- package/dist/components/shipql-editor/suggestions/generate-suggestions.js +1 -1
- package/dist/components/shipql-editor/suggestions/shipql-range-facet-panel.js +101 -62
- package/dist/components/shipql-editor/suggestions/shipql-suggestions-plugin.js +17 -1
- package/dist/components/shipql-editor/suggestions/types.d.ts +4 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +3 -0
- package/dist/components/switch/switch.d.ts +12 -0
- package/dist/components/switch/switch.js +48 -0
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +1 -1
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/toast/toast.d.ts +1 -1
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +7 -6
- package/dist/components/dropdown-input/dropdown-input.d.ts +0 -25
- package/dist/components/dropdown-input/dropdown-input.js +0 -188
- package/dist/components/dropdown-input/index.d.ts +0 -2
- package/dist/components/dropdown-input/index.js +0 -3
|
@@ -23,6 +23,6 @@ declare function AlertDescription({ className, ...props }: ComponentProps<'div'>
|
|
|
23
23
|
declare function AlertActions({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
declare function AlertAction({ className, ...props }: ComponentProps<'button'>): import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
declare function AlertClose({ className, variant: variantProp, onClick, ...props }: ComponentProps<'button'> & VariantProps<typeof closeIconVariants>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export { Alert, AlertContent, AlertTitle, AlertDescription, AlertActions, AlertAction, AlertClose, alertDefaultTransition, };
|
|
27
26
|
export type { AlertProps };
|
|
27
|
+
export { Alert, AlertAction, AlertActions, AlertClose, AlertContent, AlertDescription, AlertTitle, alertDefaultTransition, };
|
|
28
28
|
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -218,6 +218,6 @@ function AlertClose({ className, variant: variantProp, onClick, ...props }) {
|
|
|
218
218
|
})
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
|
-
export { Alert,
|
|
221
|
+
export { Alert, AlertAction, AlertActions, AlertClose, AlertContent, AlertDescription, AlertTitle, alertDefaultTransition };
|
|
222
222
|
|
|
223
223
|
//# sourceMappingURL=alert.js.map
|
|
@@ -20,5 +20,5 @@ export type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root> & VariantP
|
|
|
20
20
|
logoClassName?: string;
|
|
21
21
|
};
|
|
22
22
|
export declare function Avatar({ className, radius, size, content, src, alt, fallback, animateOnHover, logoName, logoClassName, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export {
|
|
23
|
+
export { AvatarFallback, AvatarImage, AvatarRoot };
|
|
24
24
|
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -160,6 +160,6 @@ export function Avatar({ className, radius, size = 'md', content = 'letters', sr
|
|
|
160
160
|
children: renderContent()
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
export {
|
|
163
|
+
export { AvatarFallback, AvatarImage, AvatarRoot };
|
|
164
164
|
|
|
165
165
|
//# sourceMappingURL=avatar.js.map
|
|
@@ -24,6 +24,6 @@ declare function CommandGroup({ className, ...props }: ComponentProps<typeof Com
|
|
|
24
24
|
declare function CommandSeparator({ className, ...props }: ComponentProps<typeof CommandPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
declare function CommandItem({ className, ...props }: ComponentProps<typeof CommandPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
declare function CommandShortcut({ className, children, ...props }: ComponentProps<typeof Kbd>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export {
|
|
28
|
-
export
|
|
27
|
+
export type { CommandInputProps, CommandTriggerProps };
|
|
28
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CommandTrigger, commandTriggerVariants, };
|
|
29
29
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -189,6 +189,6 @@ function CommandShortcut({ className, children, ...props }) {
|
|
|
189
189
|
children: children
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
export { Command,
|
|
192
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CommandTrigger, commandTriggerVariants };
|
|
193
193
|
|
|
194
194
|
//# sourceMappingURL=command.js.map
|
|
@@ -46,6 +46,10 @@ export function BarChart({ data, bars, height = 200, xAxis, yAxis, grid, tooltip
|
|
|
46
46
|
/*#__PURE__*/ _jsx(ResponsiveContainer, {
|
|
47
47
|
width: "100%",
|
|
48
48
|
height: "100%",
|
|
49
|
+
initialDimension: {
|
|
50
|
+
width: 320,
|
|
51
|
+
height: 200
|
|
52
|
+
},
|
|
49
53
|
children: /*#__PURE__*/ _jsxs(RechartsBarChart, {
|
|
50
54
|
data: isEmpty ? [] : data,
|
|
51
55
|
margin: {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Text } from '../../../../components/typography/index.js';
|
|
3
3
|
import { cn } from '../../../../utils/cn.js';
|
|
4
4
|
export function ChartTooltipContent({ active, label, payload, hoveredDataKey, labelFormatter }) {
|
|
5
|
-
const isVisible = active && payload
|
|
5
|
+
const isVisible = active && payload?.length;
|
|
6
6
|
if (!isVisible) return null;
|
|
7
7
|
return /*#__PURE__*/ _jsxs("div", {
|
|
8
8
|
className: "flex flex-col gap-4 rounded-8 p-12 bg-background-neutral-overlay border border-border-neutral-base shadow-lg",
|
|
@@ -41,6 +41,10 @@ export function LineChart({ data, lines, height = 200, xAxis, yAxis, grid, toolt
|
|
|
41
41
|
/*#__PURE__*/ _jsx(ResponsiveContainer, {
|
|
42
42
|
width: "100%",
|
|
43
43
|
height: "100%",
|
|
44
|
+
initialDimension: {
|
|
45
|
+
width: 320,
|
|
46
|
+
height: 200
|
|
47
|
+
},
|
|
44
48
|
children: /*#__PURE__*/ _jsxs(RechartsLineChart, {
|
|
45
49
|
data: isEmpty ? [] : data,
|
|
46
50
|
margin: {
|
|
@@ -53,6 +53,6 @@ type DropdownMenuSubTriggerProps = ComponentProps<typeof DropdownMenuPrimitive.S
|
|
|
53
53
|
};
|
|
54
54
|
declare function DropdownMenuSubTrigger({ className, inset, icon, children, ...props }: DropdownMenuSubTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
55
55
|
declare function DropdownMenuSubContent({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
56
|
-
export {
|
|
57
|
-
export
|
|
56
|
+
export type { DropdownMenuCheckboxItemProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuLabelProps, DropdownMenuRadioItemProps, DropdownMenuShortcutProps, DropdownMenuSubTriggerProps, };
|
|
57
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuContentVariants, dropdownMenuItemVariants, dropdownMenuLabelVariants, };
|
|
58
58
|
//# sourceMappingURL=dropdown-menu.d.ts.map
|
|
@@ -275,6 +275,6 @@ function DropdownMenuSubContent({ className, ...props }) {
|
|
|
275
275
|
...props
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
|
-
export { DropdownMenu,
|
|
278
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuContentVariants, dropdownMenuItemVariants, dropdownMenuLabelVariants };
|
|
279
279
|
|
|
280
280
|
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -7,5 +7,5 @@ declare const FormLabel: React.ForwardRefExoticComponent<Omit<import("@radix-ui/
|
|
|
7
7
|
declare const FormControl: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-slot").SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
8
8
|
declare const FormDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
9
9
|
declare const FormMessage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
10
|
-
export { Form,
|
|
10
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage };
|
|
11
11
|
//# sourceMappingURL=form.d.ts.map
|
|
@@ -101,6 +101,6 @@ const FormMessage = /*#__PURE__*/ React.forwardRef(({ className, children, ...pr
|
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
FormMessage.displayName = 'FormMessage';
|
|
104
|
-
export { Form,
|
|
104
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage };
|
|
105
105
|
|
|
106
106
|
//# sourceMappingURL=form.js.map
|
|
@@ -15,7 +15,6 @@ export * from './dashboard';
|
|
|
15
15
|
export * from './date-picker';
|
|
16
16
|
export * from './date-time-range-picker';
|
|
17
17
|
export * from './dot-grid';
|
|
18
|
-
export * from './dropdown-input';
|
|
19
18
|
export * from './dropdown-menu';
|
|
20
19
|
export * from './dynamic-item';
|
|
21
20
|
export * from './empty-state';
|
|
@@ -38,6 +37,7 @@ export * from './shiny-text';
|
|
|
38
37
|
export * from './shipql-editor';
|
|
39
38
|
export * from './skeleton';
|
|
40
39
|
export * from './slider';
|
|
40
|
+
export * from './switch';
|
|
41
41
|
export * from './table';
|
|
42
42
|
export * from './tabs';
|
|
43
43
|
export * from './textarea';
|
package/dist/components/index.js
CHANGED
|
@@ -15,7 +15,6 @@ export * from './dashboard/index.js';
|
|
|
15
15
|
export * from './date-picker/index.js';
|
|
16
16
|
export * from './date-time-range-picker/index.js';
|
|
17
17
|
export * from './dot-grid/index.js';
|
|
18
|
-
export * from './dropdown-input/index.js';
|
|
19
18
|
export * from './dropdown-menu/index.js';
|
|
20
19
|
export * from './dynamic-item/index.js';
|
|
21
20
|
export * from './empty-state/index.js';
|
|
@@ -38,6 +37,7 @@ export * from './shiny-text/index.js';
|
|
|
38
37
|
export * from './shipql-editor/index.js';
|
|
39
38
|
export * from './skeleton/index.js';
|
|
40
39
|
export * from './slider/index.js';
|
|
40
|
+
export * from './switch/index.js';
|
|
41
41
|
export * from './table/index.js';
|
|
42
42
|
export * from './tabs/index.js';
|
|
43
43
|
export * from './textarea/index.js';
|
|
@@ -15,5 +15,5 @@ declare const inlineTipsActionVariants: (props?: ({
|
|
|
15
15
|
variant?: "primary" | "secondary" | null | undefined;
|
|
16
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
17
|
declare function InlineTipsAction({ className, variant, ...props }: ComponentProps<'button'> & VariantProps<typeof inlineTipsActionVariants>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export { InlineTips,
|
|
18
|
+
export { InlineTips, InlineTipsAction, InlineTipsActions, InlineTipsContent, InlineTipsDescription, InlineTipsTitle, };
|
|
19
19
|
//# sourceMappingURL=inline-tips.d.ts.map
|
|
@@ -93,6 +93,6 @@ function InlineTipsAction({ className, variant, ...props }) {
|
|
|
93
93
|
...props
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
export { InlineTips,
|
|
96
|
+
export { InlineTips, InlineTipsAction, InlineTipsActions, InlineTipsContent, InlineTipsDescription, InlineTipsTitle };
|
|
97
97
|
|
|
98
98
|
//# sourceMappingURL=inline-tips.js.map
|
|
@@ -41,6 +41,6 @@ type ModalBodyHeaderProps = ComponentProps<'div'> & {
|
|
|
41
41
|
children?: ReactNode;
|
|
42
42
|
};
|
|
43
43
|
declare function ModalBodyHeader({ className, src, alt, title, description, children, ...props }: ModalBodyHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
export {
|
|
45
|
-
export
|
|
44
|
+
export type { ModalBodyHeaderProps, ModalContentProps, ModalDescriptionProps, ModalHeaderProps, ModalOverlayProps, ModalTitleProps, };
|
|
45
|
+
export { Modal, ModalBody, ModalBodyHeader, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, modalContentVariants, modalDefaultTransition, modalOverlayVariants, };
|
|
46
46
|
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -288,6 +288,6 @@ function ModalBodyHeader({ className, src, alt = '', title, description, childre
|
|
|
288
288
|
]
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
export { Modal,
|
|
291
|
+
export { Modal, ModalBody, ModalBodyHeader, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, modalContentVariants, modalDefaultTransition, modalOverlayVariants };
|
|
292
292
|
|
|
293
293
|
//# sourceMappingURL=modal.js.map
|
|
@@ -8,5 +8,5 @@ declare function PopoverContent({ className, align, sideOffset, container, ...pr
|
|
|
8
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
declare function PopoverArrow({ className, ...props }: ComponentProps<typeof PopoverPrimitive.Arrow>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
declare function PopoverClose({ ...props }: ComponentProps<typeof PopoverPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export { Popover,
|
|
11
|
+
export { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger };
|
|
12
12
|
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -43,6 +43,6 @@ function PopoverClose({ ...props }) {
|
|
|
43
43
|
...props
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
export { Popover,
|
|
46
|
+
export { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger };
|
|
47
47
|
|
|
48
48
|
//# sourceMappingURL=popover.js.map
|
|
@@ -22,6 +22,6 @@ type SelectItemProps = ComponentProps<typeof SelectPrimitive.Item> & {
|
|
|
22
22
|
};
|
|
23
23
|
declare function SelectItem({ className, children, icon, ...props }: SelectItemProps): import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
declare function SelectSeparator({ className, ...props }: ComponentProps<typeof SelectPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export {
|
|
26
|
-
export
|
|
25
|
+
export type { SelectItemProps, SelectTriggerProps };
|
|
26
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants, };
|
|
27
27
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -149,6 +149,6 @@ function SelectSeparator({ className, ...props }) {
|
|
|
149
149
|
...props
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
export { Select,
|
|
152
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants };
|
|
153
153
|
|
|
154
154
|
//# sourceMappingURL=select.js.map
|
|
@@ -28,6 +28,6 @@ type SheetDescriptionProps = ComponentProps<typeof DialogPrimitive.Description>;
|
|
|
28
28
|
declare function SheetDescription({ className, ...props }: SheetDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
type SheetBodyProps = ComponentProps<'div'>;
|
|
30
30
|
declare function SheetBody({ className, children, ...props }: SheetBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
-
export {
|
|
32
|
-
export
|
|
31
|
+
export type { SheetBodyProps, SheetContentProps, SheetDescriptionProps, SheetFooterProps, SheetHeaderProps, SheetOverlayProps, SheetTitleProps, };
|
|
32
|
+
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, sheetContentVariants, sheetOverlayVariants, };
|
|
33
33
|
//# sourceMappingURL=sheet.d.ts.map
|
|
@@ -158,6 +158,6 @@ function SheetBody({ className, children, ...props }) {
|
|
|
158
158
|
children: children
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
export { Sheet,
|
|
161
|
+
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, sheetContentVariants, sheetOverlayVariants };
|
|
162
162
|
|
|
163
163
|
//# sourceMappingURL=sheet.js.map
|
|
@@ -5,6 +5,6 @@ type ShinyTextProps = {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
};
|
|
7
7
|
declare function ShinyText({ text, disabled, speed, className }: ShinyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export { ShinyText };
|
|
9
8
|
export type { ShinyTextProps };
|
|
9
|
+
export { ShinyText };
|
|
10
10
|
//# sourceMappingURL=shiny-text.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { LeafAstNode } from './lexical/shipql-leaf-node';
|
|
2
|
-
export { type FacetDef, type LeafChangePayload, type RangeFacetConfig, ShipQLEditor, type ShipQLEditorProps, } from './shipql-editor';
|
|
2
|
+
export { type FacetDef, type FormatLeafDisplay, type LeafChangePayload, type RangeFacetConfig, ShipQLEditor, type ShipQLEditorProps, } from './shipql-editor';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -10,7 +10,8 @@ type SerializedShipQLLeafNode = SerializedTextNode & {
|
|
|
10
10
|
};
|
|
11
11
|
export declare class ShipQLLeafNode extends TextNode {
|
|
12
12
|
__shipqlNode: LeafAstNode;
|
|
13
|
-
|
|
13
|
+
__displayText: string | null;
|
|
14
|
+
constructor(text: string, shipqlNode: LeafAstNode, key?: NodeKey, displayText?: string);
|
|
14
15
|
static getType(): string;
|
|
15
16
|
static clone(node: ShipQLLeafNode): ShipQLLeafNode;
|
|
16
17
|
static importJSON(serialized: SerializedShipQLLeafNode): ShipQLLeafNode;
|
|
@@ -23,7 +24,7 @@ export declare class ShipQLLeafNode extends TextNode {
|
|
|
23
24
|
getShipQLNode(): LeafAstNode;
|
|
24
25
|
}
|
|
25
26
|
export declare function $isShipQLLeafNode(node: unknown): node is ShipQLLeafNode;
|
|
26
|
-
export declare function $createShipQLLeafNode(text: string, shipqlNode: LeafAstNode): ShipQLLeafNode;
|
|
27
|
+
export declare function $createShipQLLeafNode(text: string, shipqlNode: LeafAstNode, displayText?: string): ShipQLLeafNode;
|
|
27
28
|
/** Returns true if the AST node qualifies as a visual leaf chip in the editor. */
|
|
28
29
|
export declare function isAstLeafNode(ast: AstNode): ast is LeafAstNode;
|
|
29
30
|
export declare function leafSource(node: LeafAstNode): string;
|
|
@@ -30,15 +30,16 @@ function isValidLeafText(text) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
export class ShipQLLeafNode extends TextNode {
|
|
33
|
-
constructor(text, shipqlNode, key){
|
|
33
|
+
constructor(text, shipqlNode, key, displayText){
|
|
34
34
|
super(text, key);
|
|
35
35
|
this.__shipqlNode = shipqlNode;
|
|
36
|
+
this.__displayText = displayText ?? null;
|
|
36
37
|
}
|
|
37
38
|
static getType() {
|
|
38
39
|
return 'shipql-leaf';
|
|
39
40
|
}
|
|
40
41
|
static clone(node) {
|
|
41
|
-
return new ShipQLLeafNode(node.__text, node.__shipqlNode, node.__key);
|
|
42
|
+
return new ShipQLLeafNode(node.__text, node.__shipqlNode, node.__key, node.__displayText ?? undefined);
|
|
42
43
|
}
|
|
43
44
|
static importJSON(serialized) {
|
|
44
45
|
const text = serialized.text;
|
|
@@ -76,6 +77,9 @@ export class ShipQLLeafNode extends TextNode {
|
|
|
76
77
|
}
|
|
77
78
|
createDOM(config) {
|
|
78
79
|
const element = super.createDOM(config);
|
|
80
|
+
if (this.__displayText) {
|
|
81
|
+
element.textContent = this.__displayText;
|
|
82
|
+
}
|
|
79
83
|
const valid = isValidLeafText(this.__text);
|
|
80
84
|
for (const cls of LEAF_BASE_CLASSES.split(' '))element.classList.add(cls);
|
|
81
85
|
for (const cls of (valid ? LEAF_NORMAL_CLASSES : LEAF_ERROR_CLASSES).split(' '))element.classList.add(cls);
|
|
@@ -111,8 +115,8 @@ export class ShipQLLeafNode extends TextNode {
|
|
|
111
115
|
export function $isShipQLLeafNode(node) {
|
|
112
116
|
return node instanceof ShipQLLeafNode;
|
|
113
117
|
}
|
|
114
|
-
export function $createShipQLLeafNode(text, shipqlNode) {
|
|
115
|
-
return new ShipQLLeafNode(text, shipqlNode);
|
|
118
|
+
export function $createShipQLLeafNode(text, shipqlNode, displayText) {
|
|
119
|
+
return new ShipQLLeafNode(text, shipqlNode, undefined, displayText);
|
|
116
120
|
}
|
|
117
121
|
/** Returns true if the AST node qualifies as a visual leaf chip in the editor. */ export function isAstLeafNode(ast) {
|
|
118
122
|
return isSimpleLeaf(ast) || isNotLeaf(ast) || isGroupedCompound(ast);
|
|
@@ -3,7 +3,8 @@ import { type LeafAstNode } from './shipql-leaf-node';
|
|
|
3
3
|
export declare const REMOVE_LEAF_COMMAND: import("lexical").LexicalCommand<string>;
|
|
4
4
|
interface ShipQLPluginProps {
|
|
5
5
|
onLeafFocus?: (node: LeafAstNode | null) => void;
|
|
6
|
+
formatLeafDisplay?: (source: string, node: LeafAstNode) => string;
|
|
6
7
|
}
|
|
7
|
-
export declare function ShipQLPlugin({ onLeafFocus }: ShipQLPluginProps): null;
|
|
8
|
+
export declare function ShipQLPlugin({ onLeafFocus, formatLeafDisplay }: ShipQLPluginProps): null;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=shipql-plugin.d.ts.map
|
|
@@ -98,11 +98,13 @@ function getAbsoluteOffset(para, point) {
|
|
|
98
98
|
/** Payload: the Lexical node key of the leaf to remove. */ export const REMOVE_LEAF_COMMAND = createCommand('REMOVE_LEAF_COMMAND');
|
|
99
99
|
// ─── Plugin ───────────────────────────────────────────────────────────────────
|
|
100
100
|
const REBUILD_TAG = 'shipql-rebuild';
|
|
101
|
-
export function ShipQLPlugin({ onLeafFocus }) {
|
|
101
|
+
export function ShipQLPlugin({ onLeafFocus, formatLeafDisplay }) {
|
|
102
102
|
const [editor] = useLexicalComposerContext();
|
|
103
103
|
// Keep latest callback accessible inside Lexical listeners without re-registering.
|
|
104
104
|
const onLeafFocusRef = useRef(onLeafFocus);
|
|
105
105
|
onLeafFocusRef.current = onLeafFocus;
|
|
106
|
+
const formatLeafDisplayRef = useRef(formatLeafDisplay);
|
|
107
|
+
formatLeafDisplayRef.current = formatLeafDisplay;
|
|
106
108
|
// Track the key of the last focused leaf to avoid redundant callbacks.
|
|
107
109
|
const lastFocusedKeyRef = useRef(null);
|
|
108
110
|
useEffect(()=>{
|
|
@@ -233,7 +235,8 @@ export function ShipQLPlugin({ onLeafFocus }) {
|
|
|
233
235
|
const para = $getRoot().getFirstChild();
|
|
234
236
|
if (!para) return;
|
|
235
237
|
para.clear();
|
|
236
|
-
const
|
|
238
|
+
const fmt = formatLeafDisplayRef.current;
|
|
239
|
+
const newNodes = nextSegments.map((seg)=>seg.kind === 'leaf' ? $createShipQLLeafNode(seg.text, seg.node, fmt?.(seg.text, seg.node)) : $createTextNode(seg.text));
|
|
237
240
|
for (const node of newNodes)para.append(node);
|
|
238
241
|
// Restore cursor to the same absolute character position.
|
|
239
242
|
if (savedOffset >= 0 && newNodes.length > 0) {
|
|
@@ -273,9 +276,10 @@ export function ShipQLPlugin({ onLeafFocus }) {
|
|
|
273
276
|
if (!ast) return;
|
|
274
277
|
const segments = tokenize(text, collectLeaves(ast));
|
|
275
278
|
if (!needsRebuild(children, segments)) return;
|
|
279
|
+
const fmt = formatLeafDisplayRef.current;
|
|
276
280
|
para.clear();
|
|
277
281
|
for (const seg of segments){
|
|
278
|
-
para.append(seg.kind === 'leaf' ? $createShipQLLeafNode(seg.text, seg.node) : $createTextNode(seg.text));
|
|
282
|
+
para.append(seg.kind === 'leaf' ? $createShipQLLeafNode(seg.text, seg.node, fmt?.(seg.text, seg.node)) : $createTextNode(seg.text));
|
|
279
283
|
}
|
|
280
284
|
});
|
|
281
285
|
return ()=>{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ShipQLEditorInnerProps } from './shipql-editor';
|
|
2
|
-
export default function ShipQLEditorInner({ onChange, onLeafFocus, placeholder, className, disabled, mode, text, editorKey, isError, onTextChange, onClear, onToggleMode, facets, currentFacet, setCurrentFacet, valueSuggestions, isLoadingValueSuggestions, onLeafChange, }: ShipQLEditorInnerProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function ShipQLEditorInner({ onChange, onLeafFocus, placeholder, className, disabled, mode, text, editorKey, isError, onTextChange, onClear, onToggleMode, facets, currentFacet, setCurrentFacet, valueSuggestions, isLoadingValueSuggestions, onLeafChange, formatLeafDisplay, }: ShipQLEditorInnerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=shipql-editor-inner.d.ts.map
|
|
@@ -21,7 +21,7 @@ import { ShipQLSuggestionsPlugin } from './suggestions/shipql-suggestions-plugin
|
|
|
21
21
|
const INPUT_CLASSES = 'block w-full rounded-6 bg-background-field-base py-2 pl-32 pr-58 sm:pr-64 text-md text-foreground-neutral-base caret-foreground-neutral-base outline-none focus:border-border-highlights-interactive shadow-button-neutral';
|
|
22
22
|
const INPUT_ERROR_CLASSES = 'shadow-border-error';
|
|
23
23
|
const BUTTON_CLASSES = 'shrink-0 text-foreground-neutral-subtle hover:text-foreground-neutral-base transition-all duration-150 flex justify-center items-center cursor-pointer w-28 sm:w-32 h-full';
|
|
24
|
-
export default function ShipQLEditorInner({ onChange, onLeafFocus, placeholder, className, disabled, mode, text, editorKey, isError, onTextChange, onClear, onToggleMode, facets, currentFacet, setCurrentFacet, valueSuggestions, isLoadingValueSuggestions, onLeafChange }) {
|
|
24
|
+
export default function ShipQLEditorInner({ onChange, onLeafFocus, placeholder, className, disabled, mode, text, editorKey, isError, onTextChange, onClear, onToggleMode, facets, currentFacet, setCurrentFacet, valueSuggestions, isLoadingValueSuggestions, onLeafChange, formatLeafDisplay }) {
|
|
25
25
|
const [suggestionsOpen, setSuggestionsOpen] = useState(false);
|
|
26
26
|
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
27
27
|
const [items, setItems] = useState([]);
|
|
@@ -107,7 +107,8 @@ export default function ShipQLEditorInner({ onChange, onLeafFocus, placeholder,
|
|
|
107
107
|
ErrorBoundary: LexicalErrorBoundary
|
|
108
108
|
}),
|
|
109
109
|
/*#__PURE__*/ _jsx(ShipQLPlugin, {
|
|
110
|
-
onLeafFocus: handleLeafFocus
|
|
110
|
+
onLeafFocus: handleLeafFocus,
|
|
111
|
+
formatLeafDisplay: formatLeafDisplay
|
|
111
112
|
}),
|
|
112
113
|
/*#__PURE__*/ _jsx(OnBlurPlugin, {
|
|
113
114
|
onChange: onChange
|
|
@@ -175,6 +176,10 @@ export default function ShipQLEditorInner({ onChange, onLeafFocus, placeholder,
|
|
|
175
176
|
ast: tryParse(newText)
|
|
176
177
|
});
|
|
177
178
|
},
|
|
179
|
+
onBlur: (e)=>{
|
|
180
|
+
const ast = tryParse(e.target.value);
|
|
181
|
+
if (ast) onChange?.(ast);
|
|
182
|
+
},
|
|
178
183
|
placeholder: placeholder,
|
|
179
184
|
disabled: disabled
|
|
180
185
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AstNode } from '@shipfox/shipql-parser';
|
|
2
2
|
import type { LeafAstNode } from './lexical/shipql-leaf-node';
|
|
3
|
-
import type { FacetDef } from './suggestions/types';
|
|
4
|
-
export type { FacetDef, RangeFacetConfig } from './suggestions/types';
|
|
3
|
+
import type { FacetDef, FormatLeafDisplay } from './suggestions/types';
|
|
4
|
+
export type { FacetDef, FormatLeafDisplay, RangeFacetConfig } from './suggestions/types';
|
|
5
5
|
export type LeafChangePayload = {
|
|
6
6
|
partialValue: string;
|
|
7
7
|
ast: AstNode | null;
|
|
@@ -19,6 +19,7 @@ export interface ShipQLEditorProps {
|
|
|
19
19
|
valueSuggestions?: string[];
|
|
20
20
|
isLoadingValueSuggestions?: boolean;
|
|
21
21
|
onLeafChange?: (payload: LeafChangePayload) => void;
|
|
22
|
+
formatLeafDisplay?: FormatLeafDisplay;
|
|
22
23
|
}
|
|
23
24
|
export interface ShipQLEditorInnerProps extends ShipQLEditorProps {
|
|
24
25
|
mode: 'editor' | 'text';
|
|
@@ -34,7 +34,13 @@ export function ShipQLEditor({ disabled, className, ...props }) {
|
|
|
34
34
|
textRef.current = '';
|
|
35
35
|
setIsError(false);
|
|
36
36
|
setEditorKey((k)=>k + 1);
|
|
37
|
-
|
|
37
|
+
props.onLeafChange?.({
|
|
38
|
+
partialValue: '',
|
|
39
|
+
ast: null
|
|
40
|
+
});
|
|
41
|
+
}, [
|
|
42
|
+
props.onLeafChange
|
|
43
|
+
]);
|
|
38
44
|
const handleToggleMode = useCallback(()=>{
|
|
39
45
|
setMode((m)=>{
|
|
40
46
|
if (m === 'editor') {
|
|
@@ -155,7 +155,7 @@ export function buildSuggestionItems(facets, valueSuggestions, activeText, focus
|
|
|
155
155
|
if (filtered.length === 0) return [];
|
|
156
156
|
return [
|
|
157
157
|
header('TYPE'),
|
|
158
|
-
...filtered.
|
|
158
|
+
...filtered.map((f)=>({
|
|
159
159
|
value: f,
|
|
160
160
|
label: f,
|
|
161
161
|
icon: /*#__PURE__*/ _jsx(Icon, {
|