@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,11 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { KbdGroup, Kbd as Kbd$1 } from './ui/kbd.js';
|
|
3
|
+
|
|
4
|
+
function Kbd({ keys, children }) {
|
|
5
|
+
if (keys && keys.length > 0) {
|
|
6
|
+
return /* @__PURE__ */ jsx(KbdGroup, { children: keys.map((key, i) => /* @__PURE__ */ jsx(Kbd$1, { children: key }, i)) });
|
|
7
|
+
}
|
|
8
|
+
return /* @__PURE__ */ jsx(Kbd$1, { children });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { Kbd };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Label — closed wrapper over shadcn's <Label>.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's Label accepts arbitrary `className`, leaving colour and weight up
|
|
6
|
+
* to callers. This wrapper closes that escape hatch:
|
|
7
|
+
* - `muted` is the only expressible colour variant; it renders the label in
|
|
8
|
+
* `text-muted-foreground` for secondary / helper contexts (e.g. "optional"
|
|
9
|
+
* hints) rather than the default `text-foreground` / medium-weight style.
|
|
10
|
+
* - there is NO `className` / `style` prop.
|
|
11
|
+
* - need a danger / success tint? Add a `tone` prop here.
|
|
12
|
+
*/
|
|
13
|
+
export interface LabelProps {
|
|
14
|
+
/** For associating with a form control. */
|
|
15
|
+
htmlFor?: string;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
/** Renders in muted colour for secondary / helper contexts. */
|
|
18
|
+
muted?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function Label({ htmlFor, children, muted }: LabelProps): React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
import { Label as Label$1 } from './ui/label.js';
|
|
5
|
+
|
|
6
|
+
function Label({ htmlFor, children, muted }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Label$1,
|
|
9
|
+
{
|
|
10
|
+
htmlFor,
|
|
11
|
+
className: cn(muted && "text-muted-foreground font-normal"),
|
|
12
|
+
children
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Label };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Menubar — closed wrapper over shadcn's Menubar primitive family.
|
|
4
|
+
*
|
|
5
|
+
* The raw Menubar accepts arbitrary children, className, and any nesting
|
|
6
|
+
* pattern. This wrapper closes the surface:
|
|
7
|
+
* - `menus` is the only way to populate menus; no raw MenubarMenu /
|
|
8
|
+
* MenubarItem composition needed from consumer code.
|
|
9
|
+
* - Each menu has a `label` and an `items` array. Each item has a `label`,
|
|
10
|
+
* optional `onSelect` callback, optional `shortcut` string displayed at
|
|
11
|
+
* the right edge, and an optional `separatorBefore` rule.
|
|
12
|
+
* - No `className` or `style` escape hatch on any public prop.
|
|
13
|
+
* - Need sub-menus or radio groups? Extend the item model here.
|
|
14
|
+
*/
|
|
15
|
+
export interface MenubarItemDef {
|
|
16
|
+
/** Display text for the menu item. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Called when the item is selected. */
|
|
19
|
+
onSelect?: () => void;
|
|
20
|
+
/** Optional keyboard shortcut label displayed at the right of the item. */
|
|
21
|
+
shortcut?: string;
|
|
22
|
+
/** Render a separator rule immediately before this item. */
|
|
23
|
+
separatorBefore?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface MenuDef {
|
|
26
|
+
/** Display text for the top-level menu trigger. */
|
|
27
|
+
label: string;
|
|
28
|
+
/** Ordered list of items inside this menu. */
|
|
29
|
+
items: MenubarItemDef[];
|
|
30
|
+
}
|
|
31
|
+
export interface MenubarProps {
|
|
32
|
+
/** Ordered list of top-level menus. */
|
|
33
|
+
menus: MenuDef[];
|
|
34
|
+
}
|
|
35
|
+
export declare function Menubar({ menus }: MenubarProps): React.JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Menubar as Menubar$1, MenubarMenu, MenubarTrigger, MenubarContent, MenubarSeparator, MenubarItem, MenubarShortcut } from './ui/menubar.js';
|
|
5
|
+
|
|
6
|
+
function Menubar({ menus }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Menubar$1, { children: menus.map((menu, menuIndex) => /* @__PURE__ */ jsxs(MenubarMenu, { children: [
|
|
8
|
+
/* @__PURE__ */ jsx(MenubarTrigger, { children: menu.label }),
|
|
9
|
+
/* @__PURE__ */ jsx(MenubarContent, { children: menu.items.map((item, itemIndex) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
10
|
+
item.separatorBefore && /* @__PURE__ */ jsx(MenubarSeparator, {}),
|
|
11
|
+
/* @__PURE__ */ jsxs(MenubarItem, { onSelect: item.onSelect, children: [
|
|
12
|
+
item.label,
|
|
13
|
+
item.shortcut && /* @__PURE__ */ jsx(MenubarShortcut, { children: item.shortcut })
|
|
14
|
+
] })
|
|
15
|
+
] }, itemIndex)) })
|
|
16
|
+
] }, menuIndex)) });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Menubar };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* NativeSelect — closed, options-driven wrapper over shadcn's NativeSelect.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's NativeSelect accepts arbitrary `className` on both the wrapper and
|
|
6
|
+
* the option elements, and requires callers to compose NativeSelectOption
|
|
7
|
+
* children manually. This wrapper closes both escape hatches:
|
|
8
|
+
* - `options` is the only way to populate items; no raw NativeSelectOption
|
|
9
|
+
* imports needed (or possible) from consumer code.
|
|
10
|
+
* - `size` maps to the primitive's two sanctioned heights ('sm'|'md').
|
|
11
|
+
* - `invalid` activates the error ring via `aria-invalid`.
|
|
12
|
+
* - there is NO `className` / `style` prop.
|
|
13
|
+
*/
|
|
14
|
+
export interface NativeSelectOption {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}
|
|
18
|
+
export interface NativeSelectProps {
|
|
19
|
+
options: NativeSelectOption[];
|
|
20
|
+
value?: string;
|
|
21
|
+
defaultValue?: string;
|
|
22
|
+
onChange?: React.ChangeEventHandler<HTMLSelectElement>;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/** Activates the error ring. Prefer pairing with a <Field> error. */
|
|
25
|
+
invalid?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Controls the trigger height. Defaults to 'md'. */
|
|
28
|
+
size?: 'sm' | 'md';
|
|
29
|
+
name?: string;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
id?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function NativeSelect({ options, value, defaultValue, onChange, placeholder, invalid, disabled, size, name, required, id, }: NativeSelectProps): React.JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { NativeSelect as NativeSelect$1, NativeSelectOption } from './ui/native-select.js';
|
|
3
|
+
|
|
4
|
+
function NativeSelect({
|
|
5
|
+
options,
|
|
6
|
+
value,
|
|
7
|
+
defaultValue,
|
|
8
|
+
onChange,
|
|
9
|
+
placeholder,
|
|
10
|
+
invalid,
|
|
11
|
+
disabled,
|
|
12
|
+
size = "md",
|
|
13
|
+
name,
|
|
14
|
+
required,
|
|
15
|
+
id
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(
|
|
18
|
+
NativeSelect$1,
|
|
19
|
+
{
|
|
20
|
+
size: size === "md" ? "default" : "sm",
|
|
21
|
+
value,
|
|
22
|
+
defaultValue,
|
|
23
|
+
onChange,
|
|
24
|
+
disabled,
|
|
25
|
+
"aria-invalid": invalid || void 0,
|
|
26
|
+
name,
|
|
27
|
+
required,
|
|
28
|
+
id,
|
|
29
|
+
children: [
|
|
30
|
+
placeholder && /* @__PURE__ */ jsx(NativeSelectOption, { value: "", disabled: true, children: placeholder }),
|
|
31
|
+
options.map((opt) => /* @__PURE__ */ jsx(NativeSelectOption, { value: opt.value, children: opt.label }, opt.value))
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { NativeSelect };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* NavigationMenu — closed wrapper over shadcn's NavigationMenu primitives.
|
|
4
|
+
*
|
|
5
|
+
* The raw primitives are free-form composition building blocks that accept
|
|
6
|
+
* arbitrary className and unrestricted children. This wrapper closes the API:
|
|
7
|
+
* - `items` is the single source of truth for top-level nav entries; each
|
|
8
|
+
* item has a `label` and optionally an `href` (plain link) or `content`
|
|
9
|
+
* (dropdown panel). When `content` is provided, the item renders as a
|
|
10
|
+
* trigger + content panel; otherwise it renders as a plain link.
|
|
11
|
+
* - No `className` or `style` escape hatch is exposed on any public prop.
|
|
12
|
+
* - Need a new pattern (icon, badge, active state)? Add it to NavItem here.
|
|
13
|
+
*/
|
|
14
|
+
export interface NavItem {
|
|
15
|
+
/** Display text for the top-level navigation entry. */
|
|
16
|
+
label: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional href for plain link items.
|
|
19
|
+
* Used only when `content` is not provided.
|
|
20
|
+
*/
|
|
21
|
+
href?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional dropdown panel content.
|
|
24
|
+
* When present, the item renders as a trigger + floating content panel.
|
|
25
|
+
*/
|
|
26
|
+
content?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export interface NavigationMenuProps {
|
|
29
|
+
/** Ordered list of top-level navigation entries. */
|
|
30
|
+
items: NavItem[];
|
|
31
|
+
}
|
|
32
|
+
export declare function NavigationMenu({ items }: NavigationMenuProps): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { NavigationMenu as NavigationMenu$1, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink } from './ui/navigation-menu.js';
|
|
4
|
+
|
|
5
|
+
function NavigationMenu({ items }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(NavigationMenu$1, { children: /* @__PURE__ */ jsx(NavigationMenuList, { children: items.map(
|
|
7
|
+
(item, index) => item.content ? /* @__PURE__ */ jsxs(NavigationMenuItem, { children: [
|
|
8
|
+
/* @__PURE__ */ jsx(NavigationMenuTrigger, { children: item.label }),
|
|
9
|
+
/* @__PURE__ */ jsx(NavigationMenuContent, { children: item.content })
|
|
10
|
+
] }, index) : /* @__PURE__ */ jsx(NavigationMenuItem, { children: /* @__PURE__ */ jsx(NavigationMenuLink, { href: item.href, children: item.label }) }, index)
|
|
11
|
+
) }) });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { NavigationMenu };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Pagination — closed wrapper over shadcn's Pagination primitives.
|
|
4
|
+
*
|
|
5
|
+
* The raw parts accept arbitrary className, free-form hrefs, and any item
|
|
6
|
+
* arrangement. This wrapper closes that down into a fully computed,
|
|
7
|
+
* button-driven page control:
|
|
8
|
+
* - `page`, `total`, and `onPageChange` are the only data contract; no
|
|
9
|
+
* ad-hoc PaginationLink imports needed (or possible) from consumer code.
|
|
10
|
+
* - `siblingCount` controls how many page numbers appear on each side of
|
|
11
|
+
* the active page before an ellipsis is shown (default: 1).
|
|
12
|
+
* - Page buttons fire `onPageChange`; no href routing is assumed.
|
|
13
|
+
* - No `className` or `style` escape hatch on the public API.
|
|
14
|
+
*/
|
|
15
|
+
export interface PaginationProps {
|
|
16
|
+
/** Currently active page (1-indexed). */
|
|
17
|
+
page: number;
|
|
18
|
+
/** Total number of pages. */
|
|
19
|
+
total: number;
|
|
20
|
+
/** Called with the new page number when a page button is clicked. */
|
|
21
|
+
onPageChange: (page: number) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Number of page number buttons to show on each side of the active page
|
|
24
|
+
* before an ellipsis is rendered. Defaults to 1.
|
|
25
|
+
*/
|
|
26
|
+
siblingCount?: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function Pagination({ page, total, onPageChange, siblingCount, }: PaginationProps): React.JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Pagination as Pagination$1, PaginationContent, PaginationItem, PaginationPrevious, PaginationEllipsis, PaginationLink, PaginationNext } from './ui/pagination.js';
|
|
3
|
+
|
|
4
|
+
function buildPageRange(page, total, siblingCount) {
|
|
5
|
+
const range = [];
|
|
6
|
+
for (let i = Math.max(2, page - siblingCount); i <= Math.min(total - 1, page + siblingCount); i++) {
|
|
7
|
+
range.push(i);
|
|
8
|
+
}
|
|
9
|
+
const showLeftEllipsis = range[0] > 2;
|
|
10
|
+
const showRightEllipsis = range[range.length - 1] < total - 1;
|
|
11
|
+
const pages = [1];
|
|
12
|
+
if (showLeftEllipsis) {
|
|
13
|
+
pages.push("ellipsis-start");
|
|
14
|
+
}
|
|
15
|
+
pages.push(...range);
|
|
16
|
+
if (showRightEllipsis) {
|
|
17
|
+
pages.push("ellipsis-end");
|
|
18
|
+
}
|
|
19
|
+
if (total > 1) {
|
|
20
|
+
pages.push(total);
|
|
21
|
+
}
|
|
22
|
+
return pages;
|
|
23
|
+
}
|
|
24
|
+
function Pagination({
|
|
25
|
+
page,
|
|
26
|
+
total,
|
|
27
|
+
onPageChange,
|
|
28
|
+
siblingCount = 1
|
|
29
|
+
}) {
|
|
30
|
+
const pages = buildPageRange(page, total, siblingCount);
|
|
31
|
+
return /* @__PURE__ */ jsx(Pagination$1, { children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
33
|
+
PaginationPrevious,
|
|
34
|
+
{
|
|
35
|
+
onClick: page > 1 ? () => onPageChange(page - 1) : void 0,
|
|
36
|
+
"aria-disabled": page <= 1,
|
|
37
|
+
style: page <= 1 ? { pointerEvents: "none", opacity: 0.5 } : void 0
|
|
38
|
+
}
|
|
39
|
+
) }),
|
|
40
|
+
pages.map(
|
|
41
|
+
(p, index) => p === "ellipsis-start" || p === "ellipsis-end" ? /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }, p) : /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
42
|
+
PaginationLink,
|
|
43
|
+
{
|
|
44
|
+
isActive: p === page,
|
|
45
|
+
onClick: p !== page ? () => onPageChange(p) : void 0,
|
|
46
|
+
"aria-label": `Page ${p}`,
|
|
47
|
+
children: p
|
|
48
|
+
}
|
|
49
|
+
) }, p)
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
52
|
+
PaginationNext,
|
|
53
|
+
{
|
|
54
|
+
onClick: page < total ? () => onPageChange(page + 1) : void 0,
|
|
55
|
+
"aria-disabled": page >= total,
|
|
56
|
+
style: page >= total ? { pointerEvents: "none", opacity: 0.5 } : void 0
|
|
57
|
+
}
|
|
58
|
+
) })
|
|
59
|
+
] }) });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { Pagination };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Popover — a closed convenience wrapper over the shadcn Popover primitives.
|
|
4
|
+
*
|
|
5
|
+
* The underlying PopoverContent accepts arbitrary `className` and leaves
|
|
6
|
+
* callers free to set any width, shadow, or positioning offset. This wrapper
|
|
7
|
+
* closes that:
|
|
8
|
+
* - `side` and `align` are the only placement controls, constrained to the
|
|
9
|
+
* radix enumeration — no raw pixel offsets.
|
|
10
|
+
* - Width, padding, shadow, and background are fixed to the system's
|
|
11
|
+
* popover token treatment; they cannot be overridden per-instance.
|
|
12
|
+
* - No `className` or `style` escape hatch on any public prop.
|
|
13
|
+
*/
|
|
14
|
+
export interface PopoverProps {
|
|
15
|
+
/** Element that toggles the popover (e.g. a Button). */
|
|
16
|
+
trigger: React.ReactNode;
|
|
17
|
+
/** Popover panel content. */
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
/** Preferred side relative to the trigger; defaults to 'bottom'. */
|
|
20
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
21
|
+
/** Alignment along the side axis; defaults to 'center'. */
|
|
22
|
+
align?: "start" | "center" | "end";
|
|
23
|
+
/** Controlled open state. */
|
|
24
|
+
open?: boolean;
|
|
25
|
+
/** Called when the open state should change. */
|
|
26
|
+
onOpenChange?: (open: boolean) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function Popover({ trigger, children, side, align, open, onOpenChange, }: PopoverProps): React.JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Popover as Popover$1, PopoverTrigger, PopoverContent } from './ui/popover.js';
|
|
4
|
+
|
|
5
|
+
function Popover({
|
|
6
|
+
trigger,
|
|
7
|
+
children,
|
|
8
|
+
side = "bottom",
|
|
9
|
+
align = "center",
|
|
10
|
+
open,
|
|
11
|
+
onOpenChange
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ jsxs(Popover$1, { open, onOpenChange, children: [
|
|
14
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: trigger }),
|
|
15
|
+
/* @__PURE__ */ jsx(PopoverContent, { side, align, children })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Popover };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
/**
|
|
4
|
+
* Progress — a closed wrapper over shadcn's Progress primitive.
|
|
5
|
+
*
|
|
6
|
+
* shadcn's <Progress> accepts arbitrary `className`, letting consumers paint
|
|
7
|
+
* the indicator any color on a whim. This wrapper closes it:
|
|
8
|
+
* - `tone` names the indicator color by INTENT (neutral/success/danger).
|
|
9
|
+
* - `value` is constrained to 0–100 (clamped internally).
|
|
10
|
+
* - NO `className`/`style` escape hatch. Every progress bar on screen is
|
|
11
|
+
* one of a finite, on-brand set of treatments.
|
|
12
|
+
* - Need another tone? Add it here — a deliberate, reviewable DS change.
|
|
13
|
+
*/
|
|
14
|
+
declare const indicatorVariants: (props?: ({
|
|
15
|
+
tone?: "danger" | "success" | "neutral" | null | undefined;
|
|
16
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
|
+
export type ProgressTone = NonNullable<VariantProps<typeof indicatorVariants>['tone']>;
|
|
18
|
+
export interface ProgressProps {
|
|
19
|
+
/** Current value, 0–100 (clamped). */
|
|
20
|
+
value: number;
|
|
21
|
+
/** Named by intent, not appearance. */
|
|
22
|
+
tone?: ProgressTone;
|
|
23
|
+
}
|
|
24
|
+
export declare function Progress({ value, tone }: ProgressProps): React.JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
const indicatorVariants = cva("size-full flex-1 transition-all", {
|
|
6
|
+
variants: {
|
|
7
|
+
tone: {
|
|
8
|
+
neutral: "bg-primary",
|
|
9
|
+
success: "bg-emerald-500",
|
|
10
|
+
danger: "bg-destructive"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { tone: "neutral" }
|
|
14
|
+
});
|
|
15
|
+
function Progress({ value, tone = "neutral" }) {
|
|
16
|
+
const clamped = Math.min(100, Math.max(0, value));
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "progress",
|
|
21
|
+
role: "progressbar",
|
|
22
|
+
"aria-valuenow": clamped,
|
|
23
|
+
"aria-valuemin": 0,
|
|
24
|
+
"aria-valuemax": 100,
|
|
25
|
+
className: "relative flex h-1.5 w-full items-center overflow-x-hidden rounded-full bg-muted",
|
|
26
|
+
children: /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: indicatorVariants({ tone }),
|
|
30
|
+
style: { transform: `translateX(-${100 - clamped}%)` }
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { Progress };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* RadioGroup / RadioGroupItem — closed wrappers over shadcn's radio primitives.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's RadioGroup accepts an arbitrary `className` on both the root and
|
|
6
|
+
* each item, making it easy to accidentally break the shared spacing grid,
|
|
7
|
+
* indicator colour, or focus ring. These wrappers close both escape hatches:
|
|
8
|
+
* - `orientation` controls the layout direction (vertical = stacked grid,
|
|
9
|
+
* horizontal = flex row) — the only sanctioned layout variants.
|
|
10
|
+
* - RadioGroupItem accepts `value`, `id`, and `children` (label text);
|
|
11
|
+
* there is NO `className` on either the root or items.
|
|
12
|
+
* - need a compact spacing variant? Add a `density` prop to RadioGroup here.
|
|
13
|
+
*/
|
|
14
|
+
export interface RadioGroupProps {
|
|
15
|
+
value?: string;
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
/** Controls layout direction. Defaults to 'vertical'. */
|
|
19
|
+
orientation?: 'horizontal' | 'vertical';
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
name?: string;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare function RadioGroup({ orientation, children, ...props }: RadioGroupProps): React.JSX.Element;
|
|
26
|
+
export interface RadioGroupItemProps {
|
|
27
|
+
/** The value submitted when this item is selected. */
|
|
28
|
+
value: string;
|
|
29
|
+
/** For associating with a <Label htmlFor={id}>. */
|
|
30
|
+
id?: string;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
required?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function RadioGroupItem({ value, id, disabled, required, children }: RadioGroupItemProps): React.JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
import { RadioGroup as RadioGroup$1, RadioGroupItem as RadioGroupItem$1 } from './ui/radio-group.js';
|
|
5
|
+
|
|
6
|
+
function RadioGroup({
|
|
7
|
+
orientation = "vertical",
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
RadioGroup$1,
|
|
13
|
+
{
|
|
14
|
+
className: cn(
|
|
15
|
+
orientation === "horizontal" ? "flex flex-row flex-wrap gap-4" : "grid gap-3"
|
|
16
|
+
),
|
|
17
|
+
...props,
|
|
18
|
+
children
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function RadioGroupItem({ value, id, disabled, required, children }) {
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
RadioGroupItem$1,
|
|
26
|
+
{
|
|
27
|
+
value,
|
|
28
|
+
id,
|
|
29
|
+
disabled,
|
|
30
|
+
required
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
children && /* @__PURE__ */ jsx(
|
|
34
|
+
"label",
|
|
35
|
+
{
|
|
36
|
+
htmlFor: id,
|
|
37
|
+
className: "text-sm leading-none font-medium select-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
38
|
+
children
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Resizable — closed wrapper over shadcn's react-resizable-panels primitives.
|
|
4
|
+
*
|
|
5
|
+
* The raw primitives accept arbitrary className, unconstrained panel nesting,
|
|
6
|
+
* and manual handle placement. This wrapper closes the layout:
|
|
7
|
+
* - `panels` is the ordered list of panel contents; handles are inserted
|
|
8
|
+
* automatically between every adjacent pair of panels.
|
|
9
|
+
* - `direction` is enumerated ('horizontal' | 'vertical'); default is
|
|
10
|
+
* 'horizontal'. Controls both panel arrangement and handle orientation.
|
|
11
|
+
* - `defaultSizes` maps percentage sizes to panels by index. When omitted,
|
|
12
|
+
* panels share space equally. Values should sum to 100.
|
|
13
|
+
* - No `className` or `style` escape hatch is exposed.
|
|
14
|
+
* - Need min/max constraints per panel? Add `minSize`/`maxSize` to a panel
|
|
15
|
+
* descriptor shape here.
|
|
16
|
+
*/
|
|
17
|
+
export interface ResizableProps {
|
|
18
|
+
/** Ordered list of panel contents, one entry per resizable panel. */
|
|
19
|
+
panels: React.ReactNode[];
|
|
20
|
+
/**
|
|
21
|
+
* Layout direction for the panel group.
|
|
22
|
+
* @default 'horizontal'
|
|
23
|
+
*/
|
|
24
|
+
direction?: "horizontal" | "vertical";
|
|
25
|
+
/**
|
|
26
|
+
* Initial percentage sizes for each panel, matching the `panels` array
|
|
27
|
+
* by index. Values should sum to 100. Omit for equal distribution.
|
|
28
|
+
*/
|
|
29
|
+
defaultSizes?: number[];
|
|
30
|
+
}
|
|
31
|
+
export declare function Resizable({ panels, direction, defaultSizes, }: ResizableProps): React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ResizablePanelGroup, ResizableHandle, ResizablePanel } from './ui/resizable.js';
|
|
5
|
+
|
|
6
|
+
function Resizable({
|
|
7
|
+
panels,
|
|
8
|
+
direction = "horizontal",
|
|
9
|
+
defaultSizes
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(ResizablePanelGroup, { orientation: direction, children: panels.map((panel, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
12
|
+
index > 0 && /* @__PURE__ */ jsx(ResizableHandle, { withHandle: true }),
|
|
13
|
+
/* @__PURE__ */ jsx(ResizablePanel, { defaultSize: defaultSizes?.[index], children: panel })
|
|
14
|
+
] }, index)) });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Resizable };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface ScrollAreaProps {
|
|
3
|
+
/** Enumerated max-height constraint. Defaults to 'md'. */
|
|
4
|
+
height?: 'sm' | 'md' | 'lg';
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Closed scroll area — no className/style. */
|
|
8
|
+
export declare function ScrollArea({ height, children }: ScrollAreaProps): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { ScrollArea as ScrollArea$1 } from './ui/scroll-area.js';
|
|
4
|
+
|
|
5
|
+
const HEIGHT_MAP = {
|
|
6
|
+
sm: "max-h-40",
|
|
7
|
+
md: "max-h-72",
|
|
8
|
+
lg: "max-h-[32rem]"
|
|
9
|
+
};
|
|
10
|
+
function ScrollArea({ height = "md", children }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(ScrollArea$1, { className: HEIGHT_MAP[height], children });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { ScrollArea };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Select — closed, convenience wrapper over shadcn's composable Select parts.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's Select is a composition of SelectRoot / SelectTrigger / SelectContent /
|
|
6
|
+
* SelectItem — each accepting arbitrary `className`. This wrapper collapses the
|
|
7
|
+
* composition into a single component driven by a data `options` array:
|
|
8
|
+
* - `options` is the only way to populate items; no child render props or
|
|
9
|
+
* ad-hoc SelectItem imports needed (or possible) from consumer code.
|
|
10
|
+
* - `size` maps to the trigger's two sanctioned heights (sm / md).
|
|
11
|
+
* - `placeholder` sets the empty-state trigger label.
|
|
12
|
+
* - there is NO `className` / `style` on the public API. The trigger border,
|
|
13
|
+
* content shadow, item hover colour, and checked indicator are all fixed to
|
|
14
|
+
* design-system token values.
|
|
15
|
+
* - need an option group, separator, or destructive item? Extend `options` to
|
|
16
|
+
* accept a richer discriminated-union type here — a deliberate, reviewable
|
|
17
|
+
* change — rather than leaking the raw primitives.
|
|
18
|
+
*/
|
|
19
|
+
export interface SelectOption {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SelectProps {
|
|
24
|
+
options: SelectOption[];
|
|
25
|
+
value?: string;
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
onValueChange?: (value: string) => void;
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/** Controls trigger height. Defaults to 'md'. */
|
|
30
|
+
size?: 'sm' | 'md';
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
name?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function Select({ options, value, defaultValue, onValueChange, placeholder, size, disabled, required, name, }: SelectProps): React.JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Select as Select$1, SelectTrigger, SelectValue, SelectContent, SelectItem } from './ui/select.js';
|
|
4
|
+
|
|
5
|
+
function Select({
|
|
6
|
+
options,
|
|
7
|
+
value,
|
|
8
|
+
defaultValue,
|
|
9
|
+
onValueChange,
|
|
10
|
+
placeholder,
|
|
11
|
+
size = "md",
|
|
12
|
+
disabled,
|
|
13
|
+
required,
|
|
14
|
+
name
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
Select$1,
|
|
18
|
+
{
|
|
19
|
+
value,
|
|
20
|
+
defaultValue,
|
|
21
|
+
onValueChange,
|
|
22
|
+
disabled,
|
|
23
|
+
required,
|
|
24
|
+
name,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx(SelectTrigger, { size: size === "md" ? "default" : "sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder }) }),
|
|
27
|
+
/* @__PURE__ */ jsx(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Select };
|