@jackbernnie/hiyf 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/NOTICE +12 -0
- package/README.md +47 -0
- package/dist/components/Accordion.d.ts +38 -0
- package/dist/components/Accordion.js +38 -0
- package/dist/components/Alert.d.ts +29 -0
- package/dist/components/Alert.js +39 -0
- package/dist/components/AlertDialog.d.ts +37 -0
- package/dist/components/AlertDialog.js +38 -0
- package/dist/components/AspectRatio.d.ts +15 -0
- package/dist/components/AspectRatio.js +15 -0
- package/dist/components/Avatar.d.ts +26 -0
- package/dist/components/Avatar.js +13 -0
- package/dist/components/Badge.d.ts +18 -0
- package/dist/components/Badge.js +17 -0
- package/dist/components/Box.d.ts +13 -0
- package/dist/components/Box.js +52 -0
- package/dist/components/Breadcrumb.d.ts +33 -0
- package/dist/components/Breadcrumb.js +16 -0
- package/dist/components/Button.d.ts +40 -0
- package/dist/components/Button.js +33 -0
- package/dist/components/ButtonGroup.d.ts +18 -0
- package/dist/components/ButtonGroup.js +8 -0
- package/dist/components/Card.d.ts +46 -0
- package/dist/components/Card.js +24 -0
- package/dist/components/Carousel.d.ts +27 -0
- package/dist/components/Carousel.js +13 -0
- package/dist/components/Chart.d.ts +17 -0
- package/dist/components/Chart.js +94 -0
- package/dist/components/Checkbox.d.ts +26 -0
- package/dist/components/Checkbox.js +9 -0
- package/dist/components/Collapsible.d.ts +27 -0
- package/dist/components/Collapsible.js +26 -0
- package/dist/components/Combobox.d.ts +36 -0
- package/dist/components/Combobox.js +41 -0
- package/dist/components/Command.d.ts +37 -0
- package/dist/components/Command.js +32 -0
- package/dist/components/ContextMenu.d.ts +34 -0
- package/dist/components/ContextMenu.js +23 -0
- package/dist/components/Dialog.d.ts +20 -0
- package/dist/components/Dialog.js +34 -0
- package/dist/components/Drawer.d.ts +28 -0
- package/dist/components/Drawer.js +25 -0
- package/dist/components/DropdownMenu.d.ts +42 -0
- package/dist/components/DropdownMenu.js +32 -0
- package/dist/components/Empty.d.ts +28 -0
- package/dist/components/Empty.js +15 -0
- package/dist/components/Field.d.ts +30 -0
- package/dist/components/Field.js +13 -0
- package/dist/components/Grid.d.ts +32 -0
- package/dist/components/Grid.js +37 -0
- package/dist/components/GridItem.d.ts +30 -0
- package/dist/components/GridItem.js +40 -0
- package/dist/components/HoverCard.d.ts +22 -0
- package/dist/components/HoverCard.js +12 -0
- package/dist/components/Input.d.ts +34 -0
- package/dist/components/Input.js +8 -0
- package/dist/components/InputGroup.d.ts +28 -0
- package/dist/components/InputGroup.js +13 -0
- package/dist/components/InputOTP.d.ts +26 -0
- package/dist/components/InputOTP.js +25 -0
- package/dist/components/Kbd.d.ts +26 -0
- package/dist/components/Kbd.js +11 -0
- package/dist/components/Label.d.ts +20 -0
- package/dist/components/Label.js +17 -0
- package/dist/components/Menubar.d.ts +35 -0
- package/dist/components/Menubar.js +19 -0
- package/dist/components/NativeSelect.d.ts +33 -0
- package/dist/components/NativeSelect.js +37 -0
- package/dist/components/NavigationMenu.d.ts +32 -0
- package/dist/components/NavigationMenu.js +14 -0
- package/dist/components/Pagination.d.ts +28 -0
- package/dist/components/Pagination.js +62 -0
- package/dist/components/Popover.d.ts +28 -0
- package/dist/components/Popover.js +19 -0
- package/dist/components/Progress.d.ts +25 -0
- package/dist/components/Progress.js +37 -0
- package/dist/components/RadioGroup.d.ts +35 -0
- package/dist/components/RadioGroup.js +44 -0
- package/dist/components/Resizable.d.ts +31 -0
- package/dist/components/Resizable.js +17 -0
- package/dist/components/ScrollArea.d.ts +8 -0
- package/dist/components/ScrollArea.js +14 -0
- package/dist/components/Select.d.ts +35 -0
- package/dist/components/Select.js +33 -0
- package/dist/components/Separator.d.ts +10 -0
- package/dist/components/Separator.js +30 -0
- package/dist/components/Sheet.d.ts +31 -0
- package/dist/components/Sheet.js +26 -0
- package/dist/components/Sidebar.d.ts +52 -0
- package/dist/components/Sidebar.js +96 -0
- package/dist/components/Skeleton.d.ts +40 -0
- package/dist/components/Skeleton.js +42 -0
- package/dist/components/Slider.d.ts +26 -0
- package/dist/components/Slider.js +9 -0
- package/dist/components/Spinner.d.ts +7 -0
- package/dist/components/Spinner.js +13 -0
- package/dist/components/Status.d.ts +30 -0
- package/dist/components/Status.js +27 -0
- package/dist/components/Switch.d.ts +27 -0
- package/dist/components/Switch.js +9 -0
- package/dist/components/Table.d.ts +39 -0
- package/dist/components/Table.js +22 -0
- package/dist/components/Tabs.d.ts +32 -0
- package/dist/components/Tabs.js +21 -0
- package/dist/components/Text.d.ts +2 -0
- package/dist/components/Text.js +5 -0
- package/dist/components/Textarea.d.ts +32 -0
- package/dist/components/Textarea.js +15 -0
- package/dist/components/Toaster.d.ts +30 -0
- package/dist/components/Toaster.js +9 -0
- package/dist/components/Toggle.d.ts +34 -0
- package/dist/components/Toggle.js +31 -0
- package/dist/components/ToggleGroup.d.ts +46 -0
- package/dist/components/ToggleGroup.js +26 -0
- package/dist/components/Tooltip.d.ts +25 -0
- package/dist/components/Tooltip.js +12 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +81 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/alert-dialog.js +154 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.js +64 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +11 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/avatar.js +57 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +42 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.js +87 -0
- package/dist/components/ui/button-group.d.ts +11 -0
- package/dist/components/ui/button-group.js +37 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +55 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/card.js +82 -0
- package/dist/components/ui/carousel.d.ts +28 -0
- package/dist/components/ui/carousel.js +196 -0
- package/dist/components/ui/chart.d.ts +44 -0
- package/dist/components/ui/chart.js +198 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +33 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +33 -0
- package/dist/components/ui/combobox.d.ts +24 -0
- package/dist/components/ui/combobox.js +160 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/command.js +142 -0
- package/dist/components/ui/context-menu.d.ts +31 -0
- package/dist/components/ui/context-menu.js +73 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +138 -0
- package/dist/components/ui/direction.d.ts +7 -0
- package/dist/components/ui/direction.js +14 -0
- package/dist/components/ui/drawer.d.ts +13 -0
- package/dist/components/ui/drawer.js +101 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/dropdown-menu.js +98 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/empty.js +97 -0
- package/dist/components/ui/field.d.ts +24 -0
- package/dist/components/ui/field.js +110 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.js +37 -0
- package/dist/components/ui/input-group.d.ts +16 -0
- package/dist/components/ui/input-group.js +111 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input-otp.js +66 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +19 -0
- package/dist/components/ui/item.d.ts +23 -0
- package/dist/components/ui/item.js +181 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +28 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +23 -0
- package/dist/components/ui/menubar.d.ts +30 -0
- package/dist/components/ui/menubar.js +119 -0
- package/dist/components/ui/native-select.d.ts +8 -0
- package/dist/components/ui/native-select.js +49 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/navigation-menu.js +139 -0
- package/dist/components/ui/pagination.d.ts +17 -0
- package/dist/components/ui/pagination.js +120 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.js +37 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +44 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/resizable.js +44 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +59 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/select.js +131 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +27 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.js +113 -0
- package/dist/components/ui/sidebar.d.ts +69 -0
- package/dist/components/ui/sidebar.js +459 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +60 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/sonner.js +38 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +13 -0
- package/dist/components/ui/switch.d.ts +6 -0
- package/dist/components/ui/switch.js +32 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +95 -0
- package/dist/components/ui/tabs.d.ts +11 -0
- package/dist/components/ui/tabs.js +87 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +18 -0
- package/dist/components/ui/toggle-group.d.ts +10 -0
- package/dist/components/ui/toggle-group.js +76 -0
- package/dist/components/ui/toggle.d.ts +9 -0
- package/dist/components/ui/toggle.js +43 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +53 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.js +61 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +8 -0
- package/dist/primitives/createText.d.ts +103 -0
- package/dist/primitives/createText.js +183 -0
- package/dist/primitives/resolveProperties.d.ts +17 -0
- package/dist/stylex.css +1450 -0
- package/dist/tokens/animations.d.ts +126 -0
- package/dist/tokens/animations.js +61 -0
- package/dist/tokens/tokens.stylex.d.ts +85 -0
- package/dist/tokens/tokens.stylex.js +81 -0
- package/dist/utils/box-styles.d.ts +1117 -0
- package/dist/utils/box-styles.js +1455 -0
- package/dist/utils/grid.d.ts +4 -0
- package/dist/utils/resolvers.d.ts +10 -0
- package/dist/utils/resolvers.js +356 -0
- package/dist/utils/types.d.ts +133 -0
- package/package.json +80 -0
- package/src/theme.css +206 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Breadcrumb — closed wrapper over shadcn's composable Breadcrumb parts.
|
|
4
|
+
*
|
|
5
|
+
* The raw parts accept arbitrary className and free-form children, letting
|
|
6
|
+
* callers produce ad-hoc crumb shapes. This wrapper closes that down by
|
|
7
|
+
* driving the trail from a typed `items` data model:
|
|
8
|
+
* - `items` is the only way to populate crumbs; no ad-hoc BreadcrumbItem
|
|
9
|
+
* imports needed (or possible) from consumer code.
|
|
10
|
+
* - The last item, or any item with `current: true`, renders as a
|
|
11
|
+
* non-interactive BreadcrumbPage; all others render as anchor links.
|
|
12
|
+
* - Separators are inserted automatically between items.
|
|
13
|
+
* - No `className` or `style` escape hatch on the public API.
|
|
14
|
+
*/
|
|
15
|
+
export interface BreadcrumbItemDef {
|
|
16
|
+
/** Display text for the crumb. */
|
|
17
|
+
label: string;
|
|
18
|
+
/**
|
|
19
|
+
* Href for the crumb link. Omit (or leave undefined) for the current page
|
|
20
|
+
* crumb — it will render as non-interactive text regardless of `current`.
|
|
21
|
+
*/
|
|
22
|
+
href?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Explicitly marks this crumb as the current page. The last item in the
|
|
25
|
+
* array is always treated as current even without this flag.
|
|
26
|
+
*/
|
|
27
|
+
current?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface BreadcrumbProps {
|
|
30
|
+
/** Ordered list of breadcrumb crumbs, left-to-right. */
|
|
31
|
+
items: BreadcrumbItemDef[];
|
|
32
|
+
}
|
|
33
|
+
export declare function Breadcrumb({ items }: BreadcrumbProps): React.JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Breadcrumb as Breadcrumb$1, BreadcrumbList, BreadcrumbItem, BreadcrumbPage, BreadcrumbLink, BreadcrumbSeparator } from './ui/breadcrumb.js';
|
|
4
|
+
|
|
5
|
+
function Breadcrumb({ items }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Breadcrumb$1, { children: /* @__PURE__ */ jsx(BreadcrumbList, { children: items.map((item, index) => {
|
|
7
|
+
const isLast = index === items.length - 1;
|
|
8
|
+
const isCurrent = isLast || item.current === true;
|
|
9
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
10
|
+
/* @__PURE__ */ jsx(BreadcrumbItem, { children: isCurrent ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsx(BreadcrumbLink, { href: item.href, children: item.label }) }),
|
|
11
|
+
!isLast && /* @__PURE__ */ jsx(BreadcrumbSeparator, {})
|
|
12
|
+
] }, index);
|
|
13
|
+
}) }) });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Button — closed wrapper over shadcn's <Button>.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's Button accepts an arbitrary `variant` string (default / outline /
|
|
6
|
+
* secondary / ghost / destructive / link) and a raw `className`. This wrapper
|
|
7
|
+
* closes both escape hatches:
|
|
8
|
+
* - `intent` is named by purpose (primary / secondary / outline / ghost /
|
|
9
|
+
* danger), not by appearance. `primary` maps to the default filled style;
|
|
10
|
+
* `danger` maps to the destructive treatment.
|
|
11
|
+
* - `size` accepts only the three product-sanctioned options (sm / md / lg).
|
|
12
|
+
* - there is NO `className` / `style` prop. Every button on screen is one of
|
|
13
|
+
* a finite set of correct, on-brand treatments.
|
|
14
|
+
* - need a new look? Add an `intent` here — a deliberate, reviewable change
|
|
15
|
+
* to the design system — rather than a one-off class.
|
|
16
|
+
*
|
|
17
|
+
* Standard behaviour props (onClick, disabled, type, children) pass through.
|
|
18
|
+
*/
|
|
19
|
+
declare const intentToVariant: {
|
|
20
|
+
readonly primary: "default";
|
|
21
|
+
readonly secondary: "secondary";
|
|
22
|
+
readonly outline: "outline";
|
|
23
|
+
readonly ghost: "ghost";
|
|
24
|
+
readonly danger: "destructive";
|
|
25
|
+
};
|
|
26
|
+
declare const sizeToVariant: {
|
|
27
|
+
readonly sm: "sm";
|
|
28
|
+
readonly md: "default";
|
|
29
|
+
readonly lg: "lg";
|
|
30
|
+
};
|
|
31
|
+
export type ButtonIntent = keyof typeof intentToVariant;
|
|
32
|
+
export type ButtonSize = keyof typeof sizeToVariant;
|
|
33
|
+
type NativeButtonProps = Omit<React.ComponentPropsWithRef<'button'>, 'className' | 'style'>;
|
|
34
|
+
export interface ButtonProps extends NativeButtonProps {
|
|
35
|
+
/** Named by purpose, not appearance. */
|
|
36
|
+
intent?: ButtonIntent;
|
|
37
|
+
size?: ButtonSize;
|
|
38
|
+
}
|
|
39
|
+
export declare function Button({ intent, size, children, ...rest }: ButtonProps): React.JSX.Element;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Button as Button$1 } from './ui/button.js';
|
|
3
|
+
|
|
4
|
+
const intentToVariant = {
|
|
5
|
+
primary: "default",
|
|
6
|
+
secondary: "secondary",
|
|
7
|
+
outline: "outline",
|
|
8
|
+
ghost: "ghost",
|
|
9
|
+
danger: "destructive"
|
|
10
|
+
};
|
|
11
|
+
const sizeToVariant = {
|
|
12
|
+
sm: "sm",
|
|
13
|
+
md: "default",
|
|
14
|
+
lg: "lg"
|
|
15
|
+
};
|
|
16
|
+
function Button({
|
|
17
|
+
intent = "primary",
|
|
18
|
+
size = "md",
|
|
19
|
+
children,
|
|
20
|
+
...rest
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
Button$1,
|
|
24
|
+
{
|
|
25
|
+
variant: intentToVariant[intent],
|
|
26
|
+
size: sizeToVariant[size],
|
|
27
|
+
...rest,
|
|
28
|
+
children
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Button };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* ButtonGroup — closed wrapper over shadcn's <ButtonGroup>.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's ButtonGroup accepts arbitrary `className` and leaves orientation
|
|
6
|
+
* as an open-ended string. This wrapper closes those escape hatches:
|
|
7
|
+
* - `orientation` accepts only the two sanctioned directions
|
|
8
|
+
* ('horizontal'|'vertical'); defaults to 'horizontal'.
|
|
9
|
+
* - `children` should be HIYF <Button> elements (or other HIYF controls);
|
|
10
|
+
* the group stitches them into a joined button strip automatically via CSS.
|
|
11
|
+
* - there is NO `className` / `style` prop.
|
|
12
|
+
*/
|
|
13
|
+
export interface ButtonGroupProps {
|
|
14
|
+
/** Layout direction of the grouped buttons. Defaults to 'horizontal'. */
|
|
15
|
+
orientation?: 'horizontal' | 'vertical';
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare function ButtonGroup({ orientation, children }: ButtonGroupProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ButtonGroup as ButtonGroup$1 } from './ui/button-group.js';
|
|
3
|
+
|
|
4
|
+
function ButtonGroup({ orientation = "horizontal", children }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(ButtonGroup$1, { orientation, children });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { ButtonGroup };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Card — a closed composable wrapper over shadcn's Card primitive family.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's Card passes `className` through to every sub-part, leaving the
|
|
6
|
+
* door open to arbitrary one-off styles. This wrapper closes the root:
|
|
7
|
+
* - `padding` is enumerated ('sm'|'md'|'lg') via the ui's built-in
|
|
8
|
+
* `data-size` mechanism — the only expressible spacing options are
|
|
9
|
+
* the ones the design system sanctions.
|
|
10
|
+
* - Each sub-part (CardHeader, CardTitle, …) is a thin children-only
|
|
11
|
+
* re-export with NO `className` passthrough.
|
|
12
|
+
* - Need a new padding step? Add a variant here.
|
|
13
|
+
*
|
|
14
|
+
* Composable usage:
|
|
15
|
+
* <Card padding="md">
|
|
16
|
+
* <CardHeader><CardTitle>…</CardTitle></CardHeader>
|
|
17
|
+
* <CardContent>…</CardContent>
|
|
18
|
+
* </Card>
|
|
19
|
+
*/
|
|
20
|
+
export interface CardProps {
|
|
21
|
+
/** Enumerated internal spacing. Maps to the ui primitive's `size` prop. */
|
|
22
|
+
padding?: 'sm' | 'md' | 'lg';
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/** Closed card root — no className/style. */
|
|
26
|
+
export declare function Card({ padding, children }: CardProps): React.JSX.Element;
|
|
27
|
+
/** Closed card header — children only, no className. */
|
|
28
|
+
export declare function CardHeader({ children }: {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}): React.JSX.Element;
|
|
31
|
+
/** Closed card title — children only, no className. */
|
|
32
|
+
export declare function CardTitle({ children }: {
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
/** Closed card description — children only, no className. */
|
|
36
|
+
export declare function CardDescription({ children }: {
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
}): React.JSX.Element;
|
|
39
|
+
/** Closed card content area — children only, no className. */
|
|
40
|
+
export declare function CardContent({ children }: {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
/** Closed card footer — children only, no className. */
|
|
44
|
+
export declare function CardFooter({ children }: {
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Card as Card$1, CardContent as CardContent$1, CardDescription as CardDescription$1, CardFooter as CardFooter$1, CardHeader as CardHeader$1, CardTitle as CardTitle$1 } from './ui/card.js';
|
|
3
|
+
|
|
4
|
+
function Card({ padding = "md", children }) {
|
|
5
|
+
const size = padding === "sm" ? "sm" : "default";
|
|
6
|
+
return /* @__PURE__ */ jsx(Card$1, { size, children });
|
|
7
|
+
}
|
|
8
|
+
function CardHeader({ children }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(CardHeader$1, { children });
|
|
10
|
+
}
|
|
11
|
+
function CardTitle({ children }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(CardTitle$1, { children });
|
|
13
|
+
}
|
|
14
|
+
function CardDescription({ children }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(CardDescription$1, { children });
|
|
16
|
+
}
|
|
17
|
+
function CardContent({ children }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(CardContent$1, { children });
|
|
19
|
+
}
|
|
20
|
+
function CardFooter({ children }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(CardFooter$1, { children });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Carousel — a closed wrapper over shadcn's Carousel primitive family.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's Carousel exposes a fully composable primitive set where consumers
|
|
6
|
+
* manually assemble CarouselContent, CarouselItem, CarouselPrevious, and
|
|
7
|
+
* CarouselNext, passing arbitrary className to each. This wrapper closes it:
|
|
8
|
+
* - `items` is an array of React nodes; the carousel structure (content,
|
|
9
|
+
* items, prev/next controls) is composed internally.
|
|
10
|
+
* - `orientation` is enumerated ('horizontal'|'vertical') — no raw Embla
|
|
11
|
+
* options passthrough.
|
|
12
|
+
* - NO `className`/`style` escape hatch. Every carousel on screen is one
|
|
13
|
+
* of two correct orientations with consistent item sizing and controls.
|
|
14
|
+
* - Need custom item sizing or loop behavior? Add enumerated props here.
|
|
15
|
+
*/
|
|
16
|
+
export interface CarouselProps {
|
|
17
|
+
/** Slide contents. Each element becomes one carousel slide. */
|
|
18
|
+
items: React.ReactNode[];
|
|
19
|
+
/**
|
|
20
|
+
* Scroll axis.
|
|
21
|
+
* - 'horizontal' → slides scroll left/right (default)
|
|
22
|
+
* - 'vertical' → slides scroll up/down
|
|
23
|
+
*/
|
|
24
|
+
orientation?: 'horizontal' | 'vertical';
|
|
25
|
+
}
|
|
26
|
+
/** Closed carousel — no className/style. */
|
|
27
|
+
export declare function Carousel({ items, orientation }: CarouselProps): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Carousel as Carousel$1, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext } from './ui/carousel.js';
|
|
4
|
+
|
|
5
|
+
function Carousel({ items, orientation = "horizontal" }) {
|
|
6
|
+
return /* @__PURE__ */ jsxs(Carousel$1, { orientation, children: [
|
|
7
|
+
/* @__PURE__ */ jsx(CarouselContent, { children: items.map((item, index) => /* @__PURE__ */ jsx(CarouselItem, { children: item }, index)) }),
|
|
8
|
+
/* @__PURE__ */ jsx(CarouselPrevious, {}),
|
|
9
|
+
/* @__PURE__ */ jsx(CarouselNext, {})
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Carousel };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ChartProps {
|
|
3
|
+
/** Chart rendering type. */
|
|
4
|
+
type: "line" | "bar" | "area";
|
|
5
|
+
/** Array of row objects; each key corresponds to `index` or a category key. */
|
|
6
|
+
data: Array<Record<string, string | number>>;
|
|
7
|
+
/** The key in each data row used as the x-axis label. */
|
|
8
|
+
index: string;
|
|
9
|
+
/** The numeric series keys to plot; each becomes one Line/Bar/Area. */
|
|
10
|
+
categories: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Chart height bucket.
|
|
13
|
+
* @default 'md'
|
|
14
|
+
*/
|
|
15
|
+
height?: "sm" | "md" | "lg";
|
|
16
|
+
}
|
|
17
|
+
export declare function Chart({ type, data, index, categories, height, }: ChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { LineChart, Line, BarChart, Bar, AreaChart, Area, CartesianGrid, XAxis } from 'recharts';
|
|
4
|
+
import { ChartContainer, ChartTooltip, ChartTooltipContent } from './ui/chart.js';
|
|
5
|
+
|
|
6
|
+
const CHART_COLORS = [
|
|
7
|
+
"var(--chart-1)",
|
|
8
|
+
"var(--chart-2)",
|
|
9
|
+
"var(--chart-3)",
|
|
10
|
+
"var(--chart-4)",
|
|
11
|
+
"var(--chart-5)"
|
|
12
|
+
];
|
|
13
|
+
const HEIGHT_MAP = {
|
|
14
|
+
sm: 200,
|
|
15
|
+
md: 320,
|
|
16
|
+
lg: 480
|
|
17
|
+
};
|
|
18
|
+
function Chart({
|
|
19
|
+
type,
|
|
20
|
+
data,
|
|
21
|
+
index,
|
|
22
|
+
categories,
|
|
23
|
+
height = "md"
|
|
24
|
+
}) {
|
|
25
|
+
const config = Object.fromEntries(
|
|
26
|
+
categories.map((cat, i) => [
|
|
27
|
+
cat,
|
|
28
|
+
{
|
|
29
|
+
label: cat,
|
|
30
|
+
color: CHART_COLORS[i % CHART_COLORS.length]
|
|
31
|
+
}
|
|
32
|
+
])
|
|
33
|
+
);
|
|
34
|
+
const pixelHeight = HEIGHT_MAP[height];
|
|
35
|
+
const commonProps = { data };
|
|
36
|
+
const grid = /* @__PURE__ */ jsx(CartesianGrid, { vertical: false });
|
|
37
|
+
const xAxis = /* @__PURE__ */ jsx(XAxis, { dataKey: index, tickLine: false, axisLine: false });
|
|
38
|
+
const tooltip = /* @__PURE__ */ jsx(ChartTooltip, { content: /* @__PURE__ */ jsx(ChartTooltipContent, {}) });
|
|
39
|
+
let chart;
|
|
40
|
+
if (type === "line") {
|
|
41
|
+
chart = /* @__PURE__ */ jsxs(LineChart, { ...commonProps, children: [
|
|
42
|
+
grid,
|
|
43
|
+
xAxis,
|
|
44
|
+
tooltip,
|
|
45
|
+
categories.map((cat) => /* @__PURE__ */ jsx(
|
|
46
|
+
Line,
|
|
47
|
+
{
|
|
48
|
+
type: "monotone",
|
|
49
|
+
dataKey: cat,
|
|
50
|
+
stroke: `var(--color-${cat})`,
|
|
51
|
+
strokeWidth: 2,
|
|
52
|
+
dot: false
|
|
53
|
+
},
|
|
54
|
+
cat
|
|
55
|
+
))
|
|
56
|
+
] });
|
|
57
|
+
} else if (type === "bar") {
|
|
58
|
+
chart = /* @__PURE__ */ jsxs(BarChart, { ...commonProps, children: [
|
|
59
|
+
grid,
|
|
60
|
+
xAxis,
|
|
61
|
+
tooltip,
|
|
62
|
+
categories.map((cat) => /* @__PURE__ */ jsx(
|
|
63
|
+
Bar,
|
|
64
|
+
{
|
|
65
|
+
dataKey: cat,
|
|
66
|
+
fill: `var(--color-${cat})`,
|
|
67
|
+
radius: [4, 4, 0, 0]
|
|
68
|
+
},
|
|
69
|
+
cat
|
|
70
|
+
))
|
|
71
|
+
] });
|
|
72
|
+
} else {
|
|
73
|
+
chart = /* @__PURE__ */ jsxs(AreaChart, { ...commonProps, children: [
|
|
74
|
+
grid,
|
|
75
|
+
xAxis,
|
|
76
|
+
tooltip,
|
|
77
|
+
categories.map((cat) => /* @__PURE__ */ jsx(
|
|
78
|
+
Area,
|
|
79
|
+
{
|
|
80
|
+
type: "monotone",
|
|
81
|
+
dataKey: cat,
|
|
82
|
+
stroke: `var(--color-${cat})`,
|
|
83
|
+
fill: `var(--color-${cat})`,
|
|
84
|
+
fillOpacity: 0.2,
|
|
85
|
+
strokeWidth: 2
|
|
86
|
+
},
|
|
87
|
+
cat
|
|
88
|
+
))
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ jsx("div", { style: { height: pixelHeight, width: "100%" }, children: /* @__PURE__ */ jsx(ChartContainer, { config, className: "aspect-auto h-full w-full", children: chart }) });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { Chart };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Checkbox — closed wrapper over shadcn's <Checkbox>.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's Checkbox forwards an arbitrary `className` to Radix's root element,
|
|
6
|
+
* making it trivial to break the on-brand size, border-radius, or checked
|
|
7
|
+
* colour. This wrapper closes that hatch completely:
|
|
8
|
+
* - the only expressible props are the behavioural ones: checked state,
|
|
9
|
+
* change handler, disabled flag, and DOM id.
|
|
10
|
+
* - there is NO `className` / `style` prop. Every checkbox on screen is the
|
|
11
|
+
* single correct, on-brand treatment.
|
|
12
|
+
* - need a larger variant? Add a `size` prop here — a deliberate, reviewable
|
|
13
|
+
* change — rather than a one-off class.
|
|
14
|
+
*/
|
|
15
|
+
export interface CheckboxProps {
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
defaultChecked?: boolean;
|
|
18
|
+
onCheckedChange?: (checked: boolean | 'indeterminate') => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** For associating with a <Label htmlFor={id}>. */
|
|
21
|
+
id?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
value?: string;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function Checkbox({ ...props }: CheckboxProps): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Collapsible — closed wrapper over shadcn's Collapsible primitives.
|
|
4
|
+
*
|
|
5
|
+
* The raw parts compose freely with arbitrary className and children.
|
|
6
|
+
* This wrapper closes that down:
|
|
7
|
+
* - `trigger` is the clickable element that toggles visibility; it is
|
|
8
|
+
* rendered inside the Radix trigger with `asChild` so any interactive
|
|
9
|
+
* element (button, text, icon row) works without extra wrapping.
|
|
10
|
+
* - `children` is the hidden/shown content.
|
|
11
|
+
* - Controlled and uncontrolled modes are both supported via `open` /
|
|
12
|
+
* `onOpenChange` / `defaultOpen`, matching the Radix root contract.
|
|
13
|
+
* - No `className` or `style` escape hatch on the public API.
|
|
14
|
+
*/
|
|
15
|
+
export interface CollapsibleProps {
|
|
16
|
+
/** Element that toggles the panel open/closed. */
|
|
17
|
+
trigger: React.ReactNode;
|
|
18
|
+
/** Content shown when the panel is open. */
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
/** Whether the panel is open on first render (uncontrolled). */
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
/** Controlled open state. */
|
|
23
|
+
open?: boolean;
|
|
24
|
+
/** Called when the open state should change (controlled mode). */
|
|
25
|
+
onOpenChange?: (open: boolean) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function Collapsible({ trigger, children, defaultOpen, open, onOpenChange, }: CollapsibleProps): React.JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Collapsible as Collapsible$1, CollapsibleTrigger, CollapsibleContent } from './ui/collapsible.js';
|
|
4
|
+
|
|
5
|
+
function Collapsible({
|
|
6
|
+
trigger,
|
|
7
|
+
children,
|
|
8
|
+
defaultOpen,
|
|
9
|
+
open,
|
|
10
|
+
onOpenChange
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
Collapsible$1,
|
|
14
|
+
{
|
|
15
|
+
defaultOpen,
|
|
16
|
+
open,
|
|
17
|
+
onOpenChange,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: trigger }),
|
|
20
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { children })
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Collapsible };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Combobox — closed, searchable select wrapper over the ui/combobox primitives.
|
|
4
|
+
*
|
|
5
|
+
* ui/combobox composes @base-ui/react's Combobox with styled InputGroup chrome.
|
|
6
|
+
* The raw parts accept arbitrary className and free-form children. This wrapper
|
|
7
|
+
* closes that down into a single searchable-select surface:
|
|
8
|
+
* - `options` is the only way to populate items (value + label pairs).
|
|
9
|
+
* - Controlled and uncontrolled value modes are both supported.
|
|
10
|
+
* - `placeholder` / `emptyText` are the only copy customisation points.
|
|
11
|
+
* - The trigger input doubles as the search field (base-ui architecture):
|
|
12
|
+
* typing filters options live. `searchPlaceholder` maps to the same input.
|
|
13
|
+
* - No `className` or `style` escape hatch on the public API.
|
|
14
|
+
*/
|
|
15
|
+
export interface ComboboxOption {
|
|
16
|
+
value: string;
|
|
17
|
+
label: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ComboboxProps {
|
|
20
|
+
/** Flat list of selectable options. */
|
|
21
|
+
options: ComboboxOption[];
|
|
22
|
+
/** Controlled selected value. */
|
|
23
|
+
value?: string;
|
|
24
|
+
/** Called when the selected value changes. */
|
|
25
|
+
onValueChange?: (value: string) => void;
|
|
26
|
+
/** Placeholder shown in the input/trigger (also acts as the search hint). */
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Accepted for API symmetry with Select; maps to `placeholder` on the combo
|
|
30
|
+
* input since the trigger and search field are the same element in base-ui.
|
|
31
|
+
*/
|
|
32
|
+
searchPlaceholder?: string;
|
|
33
|
+
/** Text shown when no options match the current search query. */
|
|
34
|
+
emptyText?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function Combobox({ options, value, onValueChange, placeholder, searchPlaceholder, emptyText, }: ComboboxProps): React.JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Combobox as Combobox$1 } from '@base-ui/react';
|
|
5
|
+
import { ComboboxInput, ComboboxContent, ComboboxList, ComboboxEmpty, ComboboxItem } from './ui/combobox.js';
|
|
6
|
+
|
|
7
|
+
function Combobox({
|
|
8
|
+
options,
|
|
9
|
+
value,
|
|
10
|
+
onValueChange,
|
|
11
|
+
placeholder = "Search\u2026",
|
|
12
|
+
searchPlaceholder,
|
|
13
|
+
emptyText = "No results found."
|
|
14
|
+
}) {
|
|
15
|
+
const handleValueChange = React.useCallback(
|
|
16
|
+
(val) => {
|
|
17
|
+
if (val != null) onValueChange?.(val);
|
|
18
|
+
},
|
|
19
|
+
[onValueChange]
|
|
20
|
+
);
|
|
21
|
+
const inputPlaceholder = searchPlaceholder ?? placeholder;
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
Combobox$1.Root,
|
|
24
|
+
{
|
|
25
|
+
value: value ?? null,
|
|
26
|
+
onValueChange: onValueChange ? handleValueChange : void 0,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx(ComboboxInput, { placeholder: inputPlaceholder, showTrigger: true, showClear: false }),
|
|
29
|
+
/* @__PURE__ */ jsx(ComboboxContent, { children: /* @__PURE__ */ jsxs(ComboboxList, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(ComboboxEmpty, { children: emptyText }),
|
|
31
|
+
options.map((opt) => (
|
|
32
|
+
// ComboboxItem from ui/combobox already includes the ItemIndicator.
|
|
33
|
+
/* @__PURE__ */ jsx(ComboboxItem, { value: opt.value, children: opt.label }, opt.value)
|
|
34
|
+
))
|
|
35
|
+
] }) })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { Combobox };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Command — closed command-palette wrapper over the shadcn Command primitives.
|
|
4
|
+
*
|
|
5
|
+
* The raw primitives compose freely with arbitrary className, custom item
|
|
6
|
+
* shapes, and ad-hoc group arrangements. This wrapper closes that down by
|
|
7
|
+
* driving the palette entirely from a typed `groups` data model:
|
|
8
|
+
* - `groups` is the only way to populate items; no ad-hoc CommandGroup /
|
|
9
|
+
* CommandItem imports needed (or possible) from consumer code.
|
|
10
|
+
* - Each item supports an optional `shortcut` string rendered in the
|
|
11
|
+
* design-system's CommandShortcut treatment.
|
|
12
|
+
* - `placeholder` customises the search input hint text.
|
|
13
|
+
* - CommandEmpty is always present; its copy is not yet configurable —
|
|
14
|
+
* add an `emptyText` prop here when that becomes a product need.
|
|
15
|
+
* - No `className` or `style` escape hatch on the public API.
|
|
16
|
+
*/
|
|
17
|
+
export interface CommandItemDef {
|
|
18
|
+
/** Display label for the command item. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Called when the item is selected via click or keyboard. */
|
|
21
|
+
onSelect?: () => void;
|
|
22
|
+
/** Optional keyboard shortcut label (e.g. "⌘K"). Rendered inline. */
|
|
23
|
+
shortcut?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CommandGroup {
|
|
26
|
+
/** Optional section heading rendered above the group's items. */
|
|
27
|
+
heading?: string;
|
|
28
|
+
/** Ordered list of items in this group. */
|
|
29
|
+
items: CommandItemDef[];
|
|
30
|
+
}
|
|
31
|
+
export interface CommandProps {
|
|
32
|
+
/** Ordered list of command groups. A group without a heading is unsectioned. */
|
|
33
|
+
groups: CommandGroup[];
|
|
34
|
+
/** Placeholder text in the search input. Defaults to 'Search commands…'. */
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function Command({ groups, placeholder, }: CommandProps): React.JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Command as Command$1, CommandInput, CommandList, CommandEmpty, CommandSeparator, CommandGroup, CommandItem, CommandShortcut } from './ui/command.js';
|
|
5
|
+
|
|
6
|
+
function Command({
|
|
7
|
+
groups,
|
|
8
|
+
placeholder = "Search commands\u2026"
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsxs(Command$1, { children: [
|
|
11
|
+
/* @__PURE__ */ jsx(CommandInput, { placeholder }),
|
|
12
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
13
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." }),
|
|
14
|
+
groups.map((group, groupIndex) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
15
|
+
groupIndex > 0 && /* @__PURE__ */ jsx(CommandSeparator, {}),
|
|
16
|
+
/* @__PURE__ */ jsx(CommandGroup, { heading: group.heading, children: group.items.map((item, itemIndex) => /* @__PURE__ */ jsxs(
|
|
17
|
+
CommandItem,
|
|
18
|
+
{
|
|
19
|
+
onSelect: item.onSelect,
|
|
20
|
+
children: [
|
|
21
|
+
item.label,
|
|
22
|
+
item.shortcut && /* @__PURE__ */ jsx(CommandShortcut, { children: item.shortcut })
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
itemIndex
|
|
26
|
+
)) })
|
|
27
|
+
] }, groupIndex))
|
|
28
|
+
] })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Command };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* ContextMenu — a closed convenience wrapper over the shadcn ContextMenu primitives.
|
|
4
|
+
*
|
|
5
|
+
* The raw primitives are composition primitives that accept arbitrary className,
|
|
6
|
+
* free-form children, and any nesting pattern. This wrapper closes that by
|
|
7
|
+
* driving the menu from a typed item model — mirroring DropdownMenu.tsx exactly:
|
|
8
|
+
* - `items` is an array of plain data objects with `label`, `onSelect`,
|
|
9
|
+
* `tone`, and `separatorBefore`; no JSX, no className.
|
|
10
|
+
* - `tone: 'danger'` maps to `variant="destructive"` so callers express
|
|
11
|
+
* intent, not appearance.
|
|
12
|
+
* - `trigger` is the right-click target area.
|
|
13
|
+
* - No `className` or `style` escape hatch on any public prop.
|
|
14
|
+
*/
|
|
15
|
+
export interface ContextMenuItemDef {
|
|
16
|
+
/** Display text for the menu item. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Called when the item is selected. */
|
|
19
|
+
onSelect?: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Intent of the action.
|
|
22
|
+
* 'danger' renders the item in the destructive style.
|
|
23
|
+
*/
|
|
24
|
+
tone?: "default" | "danger";
|
|
25
|
+
/** Render a separator rule immediately before this item. */
|
|
26
|
+
separatorBefore?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface ContextMenuProps {
|
|
29
|
+
/** Element wrapping the right-clickable area. */
|
|
30
|
+
trigger: React.ReactNode;
|
|
31
|
+
/** Ordered list of menu items. */
|
|
32
|
+
items: ContextMenuItemDef[];
|
|
33
|
+
}
|
|
34
|
+
export declare function ContextMenu({ trigger, items }: ContextMenuProps): React.JSX.Element;
|