@nocoo/basalt 2.0.3 → 2.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/README.md +134 -15
- package/ai/COMPATIBILITY.md +180 -0
- package/ai/INTEGRATION.md +1760 -0
- package/ai/RECIPES.md +161 -0
- package/ai/USAGE.md +99 -0
- package/ai/registry.json +38099 -0
- package/ai/sources.json +10 -0
- package/dist/assets/brand-mark.d.ts +1 -0
- package/dist/assets/brand-mark.js +7 -0
- package/dist/assets/brand-mark.js.map +1 -0
- package/dist/charts/area.d.ts +58 -5
- package/dist/charts/area.js +20 -12
- package/dist/charts/area.js.map +1 -1
- package/dist/charts/bar.d.ts +54 -5
- package/dist/charts/bar.js +16 -10
- package/dist/charts/bar.js.map +1 -1
- package/dist/charts/bullet.d.ts +18 -1
- package/dist/charts/bullet.js +6 -3
- package/dist/charts/bullet.js.map +1 -1
- package/dist/charts/charts.d.ts +58 -5
- package/dist/charts/charts.js +13 -2
- package/dist/charts/charts.js.map +1 -1
- package/dist/charts/config.d.ts +7 -0
- package/dist/charts/config.js +5 -1
- package/dist/charts/config.js.map +1 -1
- package/dist/charts/custom-chart.d.ts +58 -5
- package/dist/charts/custom-chart.js +13 -2
- package/dist/charts/custom-chart.js.map +1 -1
- package/dist/charts/donut.d.ts +18 -1
- package/dist/charts/donut.js +6 -3
- package/dist/charts/donut.js.map +1 -1
- package/dist/charts/frame.d.ts +40 -3
- package/dist/charts/frame.js +55 -28
- package/dist/charts/frame.js.map +1 -1
- package/dist/charts/funnel.d.ts +18 -1
- package/dist/charts/funnel.js +5 -1
- package/dist/charts/funnel.js.map +1 -1
- package/dist/charts/gauge.d.ts +18 -1
- package/dist/charts/gauge.js +38 -20
- package/dist/charts/gauge.js.map +1 -1
- package/dist/charts/grouped-bar.d.ts +54 -5
- package/dist/charts/grouped-bar.js +16 -10
- package/dist/charts/grouped-bar.js.map +1 -1
- package/dist/charts/heatmap-calendar.d.ts +61 -0
- package/dist/charts/heatmap-calendar.js +287 -96
- package/dist/charts/heatmap-calendar.js.map +1 -1
- package/dist/charts/heatmap-matrix.d.ts +99 -0
- package/dist/charts/heatmap-matrix.js +249 -0
- package/dist/charts/heatmap-matrix.js.map +1 -0
- package/dist/charts/line.d.ts +66 -5
- package/dist/charts/line.js +37 -30
- package/dist/charts/line.js.map +1 -1
- package/dist/charts/palette.d.ts +1 -0
- package/dist/charts/palette.js +7 -1
- package/dist/charts/palette.js.map +1 -1
- package/dist/charts/radar.d.ts +18 -1
- package/dist/charts/radar.js +26 -19
- package/dist/charts/radar.js.map +1 -1
- package/dist/charts/sankey.d.ts +18 -1
- package/dist/charts/sankey.js +4 -1
- package/dist/charts/sankey.js.map +1 -1
- package/dist/charts/series.d.ts +5 -7
- package/dist/charts/series.js.map +1 -1
- package/dist/charts/slot-bar.d.ts +38 -6
- package/dist/charts/slot-bar.js +5 -2
- package/dist/charts/slot-bar.js.map +1 -1
- package/dist/charts/sparkline.d.ts +35 -5
- package/dist/charts/sparkline.js +22 -18
- package/dist/charts/sparkline.js.map +1 -1
- package/dist/charts/stacked-bar.d.ts +58 -5
- package/dist/charts/stacked-bar.js +19 -12
- package/dist/charts/stacked-bar.js.map +1 -1
- package/dist/charts/stat-card.d.ts +51 -1
- package/dist/charts/stat-card.js +66 -39
- package/dist/charts/stat-card.js.map +1 -1
- package/dist/charts/timeline.d.ts +3 -0
- package/dist/charts/timeline.js +4 -3
- package/dist/charts/timeline.js.map +1 -1
- package/dist/charts/timeseries.d.ts +58 -5
- package/dist/charts/timeseries.js +13 -2
- package/dist/charts/timeseries.js.map +1 -1
- package/dist/charts/tooltip.d.ts +57 -0
- package/dist/charts/tooltip.js +119 -2
- package/dist/charts/tooltip.js.map +1 -1
- package/dist/components/accordion.d.ts +117 -2
- package/dist/components/accordion.js +20 -13
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +131 -13
- package/dist/components/alert-dialog.js +12 -9
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/app-header.js +18 -17
- package/dist/components/app-header.js.map +1 -1
- package/dist/components/app-shell.js +15 -14
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/autocomplete.d.ts +4 -0
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.d.ts +76 -3
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +15 -1
- package/dist/components/badge.js +17 -16
- package/dist/components/badge.js.map +1 -1
- package/dist/components/banner.d.ts +88 -2
- package/dist/components/banner.js +41 -40
- package/dist/components/banner.js.map +1 -1
- package/dist/components/basalt-mark.js +14 -8
- package/dist/components/basalt-mark.js.map +1 -1
- package/dist/components/battery-meter.d.ts +10 -0
- package/dist/components/battery-meter.js +56 -0
- package/dist/components/battery-meter.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +27 -7
- package/dist/components/breadcrumbs.js +21 -20
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.d.ts +48 -2
- package/dist/components/button.js +87 -36
- package/dist/components/button.js.map +1 -1
- package/dist/components/chat-bubble.d.ts +7 -0
- package/dist/components/chat-bubble.js +14 -13
- package/dist/components/chat-bubble.js.map +1 -1
- package/dist/components/chat-composer.d.ts +7 -3
- package/dist/components/chat-composer.js.map +1 -1
- package/dist/components/chat-header.d.ts +6 -1
- package/dist/components/chat-header.js +17 -16
- package/dist/components/chat-header.js.map +1 -1
- package/dist/components/chat-inbox.d.ts +7 -2
- package/dist/components/chat-inbox.js.map +1 -1
- package/dist/components/checkbox.js +84 -53
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/clipboard-text.d.ts +13 -2
- package/dist/components/clipboard-text.js +4 -4
- package/dist/components/clipboard-text.js.map +1 -1
- package/dist/components/collapsible.d.ts +58 -15
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/command-palette.d.ts +151 -61
- package/dist/components/command-palette.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +1 -1
- package/dist/components/confirm-dialog.js +6 -4
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/context-menu.d.ts +210 -2
- package/dist/components/context-menu.js +7 -4
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table.d.ts +40 -2
- package/dist/components/data-table.js +168 -120
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +53 -2
- package/dist/components/date-picker.js +387 -219
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/delete-resource.d.ts +7 -1
- package/dist/components/delete-resource.js +22 -18
- package/dist/components/delete-resource.js.map +1 -1
- package/dist/components/description-list.js +16 -15
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog.d.ts +141 -12
- package/dist/components/dialog.js +42 -38
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.d.ts +1 -1
- package/dist/components/dock.js +39 -58
- package/dist/components/dock.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +229 -15
- package/dist/components/dropdown-menu.js +9 -6
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editable-nav-item.d.ts +33 -0
- package/dist/components/editable-nav-item.js +90 -0
- package/dist/components/editable-nav-item.js.map +1 -0
- package/dist/components/empty.d.ts +22 -2
- package/dist/components/empty.js +22 -13
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.js +31 -30
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +37 -0
- package/dist/components/file-dropzone.js +103 -0
- package/dist/components/file-dropzone.js.map +1 -0
- package/dist/components/filter-bar.d.ts +34 -0
- package/dist/components/filter-bar.js +52 -0
- package/dist/components/filter-bar.js.map +1 -0
- package/dist/components/flow.js +19 -18
- package/dist/components/flow.js.map +1 -1
- package/dist/components/grid.d.ts +3 -1
- package/dist/components/grid.js.map +1 -1
- package/dist/components/hover-card.d.ts +111 -1
- package/dist/components/hover-card.js +9 -6
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/icon-picker.d.ts +34 -0
- package/dist/components/icon-picker.js +77 -0
- package/dist/components/icon-picker.js.map +1 -0
- package/dist/components/inline-editable.d.ts +46 -0
- package/dist/components/inline-editable.js +124 -0
- package/dist/components/inline-editable.js.map +1 -0
- package/dist/components/input-area.js +3 -3
- package/dist/components/input-group.js +7 -7
- package/dist/components/input.js +3 -3
- package/dist/components/label.js +18 -17
- package/dist/components/label.js.map +1 -1
- package/dist/components/layer-card.d.ts +10 -2
- package/dist/components/layer-card.js +71 -68
- package/dist/components/layer-card.js.map +1 -1
- package/dist/components/loader.d.ts +10 -2
- package/dist/components/loader.js.map +1 -1
- package/dist/components/menu-bar.d.ts +174 -6
- package/dist/components/menu-bar.js +33 -29
- package/dist/components/menu-bar.js.map +1 -1
- package/dist/components/meter.d.ts +27 -2
- package/dist/components/meter.js.map +1 -1
- package/dist/components/multi-select.d.ts +64 -0
- package/dist/components/multi-select.js +218 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +88 -5
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/overlay.js +6 -5
- package/dist/components/overlay.js.map +1 -1
- package/dist/components/page-header.js +23 -21
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.js +7 -7
- package/dist/components/popover.d.ts +136 -16
- package/dist/components/popover.js +32 -28
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js +38 -37
- package/dist/components/radio.js.map +1 -1
- package/dist/components/resource-list.d.ts +26 -1
- package/dist/components/resource-list.js +28 -15
- package/dist/components/resource-list.js.map +1 -1
- package/dist/components/responsive-master-detail.d.ts +27 -0
- package/dist/components/responsive-master-detail.js +85 -0
- package/dist/components/responsive-master-detail.js.map +1 -0
- package/dist/components/section-rule.js +23 -22
- package/dist/components/section-rule.js.map +1 -1
- package/dist/components/select.d.ts +27 -3
- package/dist/components/select.js +11 -11
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.d.ts +115 -11
- package/dist/components/sheet.js +37 -30
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.d.ts +109 -17
- package/dist/components/sidebar.js +109 -108
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton-line.d.ts +22 -2
- package/dist/components/skeleton-line.js.map +1 -1
- package/dist/components/slider.d.ts +61 -1
- package/dist/components/slider.js +31 -15
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-strip.js +16 -15
- package/dist/components/stat-strip.js.map +1 -1
- package/dist/components/switch.js +78 -47
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table-of-contents.js +18 -17
- package/dist/components/table-of-contents.js.map +1 -1
- package/dist/components/table-pager.js +20 -19
- package/dist/components/table-pager.js.map +1 -1
- package/dist/components/table.d.ts +9 -3
- package/dist/components/table.js +19 -18
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js +29 -22
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag-badge.d.ts +58 -0
- package/dist/components/tag-badge.js +72 -0
- package/dist/components/tag-badge.js.map +1 -0
- package/dist/components/tag-color-picker.d.ts +20 -0
- package/dist/components/tag-color-picker.js +42 -0
- package/dist/components/tag-color-picker.js.map +1 -0
- package/dist/components/text.js +17 -16
- package/dist/components/text.js.map +1 -1
- package/dist/components/toast.d.ts +173 -3
- package/dist/components/toast.js +1 -1
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +88 -2
- package/dist/components/toggle-group.js +32 -31
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.d.ts +35 -2
- package/dist/components/toggle.js +12 -11
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tooltip.d.ts +144 -6
- package/dist/components/tooltip.js +9 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typeahead-field.js +193 -132
- package/dist/components/typeahead-field.js.map +1 -1
- package/dist/components/upload-queue.d.ts +51 -0
- package/dist/components/upload-queue.js +116 -0
- package/dist/components/upload-queue.js.map +1 -0
- package/dist/providers/accent.d.ts +46 -2
- package/dist/providers/accent.js +358 -172
- package/dist/providers/accent.js.map +1 -1
- package/dist/providers/link.d.ts +14 -4
- package/dist/providers/link.js.map +1 -1
- package/dist/providers/theme.d.ts +38 -2
- package/dist/providers/theme.js +160 -27
- package/dist/providers/theme.js.map +1 -1
- package/dist/styles/base.css +83 -0
- package/dist/styles/standalone.css +711 -120
- package/dist/styles/tailwind.css +21 -7
- package/dist/styles/tokens.css +145 -91
- package/dist/utils/control-surface.d.ts +2 -1
- package/dist/utils/control-surface.js +4 -4
- package/dist/utils/control-surface.js.map +1 -1
- package/dist/utils/selection-indicator.js +2 -2
- package/dist/utils/selection-indicator.js.map +1 -1
- package/package.json +8 -4
|
@@ -1,8 +1,176 @@
|
|
|
1
1
|
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
3
|
+
type RadixMenubarProps = React.ComponentProps<typeof MenubarPrimitive.Root>;
|
|
4
|
+
type RadixMenubarMenuProps = React.ComponentProps<typeof MenubarPrimitive.Menu>;
|
|
5
|
+
type RadixMenubarTriggerProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>;
|
|
6
|
+
type RadixMenubarContentProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>;
|
|
7
|
+
type RadixMenubarItemProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item>;
|
|
8
|
+
export interface MenuBarProps extends Omit<RadixMenubarProps, "value" | "defaultValue" | "onValueChange" | "loop" | "dir" | "asChild"> {
|
|
9
|
+
/**
|
|
10
|
+
* Controlled value of the currently open menu.
|
|
11
|
+
*/
|
|
12
|
+
value?: RadixMenubarProps["value"];
|
|
13
|
+
/**
|
|
14
|
+
* Uncontrolled initial value of the open menu.
|
|
15
|
+
* @default ""
|
|
16
|
+
*/
|
|
17
|
+
defaultValue?: RadixMenubarProps["defaultValue"];
|
|
18
|
+
/**
|
|
19
|
+
* Callback invoked when the open menu value changes.
|
|
20
|
+
*/
|
|
21
|
+
onValueChange?: RadixMenubarProps["onValueChange"];
|
|
22
|
+
/**
|
|
23
|
+
* Whether keyboard navigation loops around when reaching ends.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
loop?: RadixMenubarProps["loop"];
|
|
27
|
+
/**
|
|
28
|
+
* Reading direction of the menubar.
|
|
29
|
+
* @default "ltr"
|
|
30
|
+
*/
|
|
31
|
+
dir?: RadixMenubarProps["dir"];
|
|
32
|
+
/**
|
|
33
|
+
* Change the default rendered div element to the child element, merging props and behavior.
|
|
34
|
+
* MenuBar forwards ref to HTMLDivElement and inherits native div attributes.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
asChild?: RadixMenubarProps["asChild"];
|
|
38
|
+
}
|
|
39
|
+
export declare function MenuBar(props: MenuBarProps): React.JSX.Element;
|
|
40
|
+
export interface MenuBarMenuProps extends Omit<RadixMenubarMenuProps, "value"> {
|
|
41
|
+
/**
|
|
42
|
+
* Unique identifier value for this menu within the menubar.
|
|
43
|
+
*/
|
|
44
|
+
value?: RadixMenubarMenuProps["value"];
|
|
45
|
+
}
|
|
46
|
+
export declare function MenuBarMenu(props: MenuBarMenuProps): React.JSX.Element;
|
|
47
|
+
export interface MenuBarTriggerProps extends Omit<RadixMenubarTriggerProps, "disabled" | "asChild"> {
|
|
48
|
+
/**
|
|
49
|
+
* Disable the menubar trigger button.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
disabled?: RadixMenubarTriggerProps["disabled"];
|
|
53
|
+
/**
|
|
54
|
+
* Change the default rendered button element to the child element, merging props and behavior.
|
|
55
|
+
* Trigger forwards ref to HTMLButtonElement and inherits native button attributes.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
asChild?: RadixMenubarTriggerProps["asChild"];
|
|
59
|
+
}
|
|
60
|
+
export declare const MenuBarTrigger: React.ForwardRefExoticComponent<MenuBarTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
61
|
+
export interface MenuBarContentProps extends Omit<RadixMenubarContentProps, "loop" | "side" | "sideOffset" | "align" | "alignOffset" | "avoidCollisions" | "collisionBoundary" | "collisionPadding" | "arrowPadding" | "sticky" | "hideWhenDetached" | "forceMount" | "asChild" | "onCloseAutoFocus" | "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside"> {
|
|
62
|
+
/**
|
|
63
|
+
* Whether keyboard navigation loops around when reaching the start or end item.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
loop?: RadixMenubarContentProps["loop"];
|
|
67
|
+
/**
|
|
68
|
+
* Preferred placement side relative to the menu trigger.
|
|
69
|
+
* @default "bottom"
|
|
70
|
+
*/
|
|
71
|
+
side?: RadixMenubarContentProps["side"];
|
|
72
|
+
/**
|
|
73
|
+
* Distance in pixels between trigger and floating content panel.
|
|
74
|
+
* @default 4
|
|
75
|
+
*/
|
|
76
|
+
sideOffset?: RadixMenubarContentProps["sideOffset"];
|
|
77
|
+
/**
|
|
78
|
+
* Preferred alignment along the side axis.
|
|
79
|
+
* @default "start"
|
|
80
|
+
*/
|
|
81
|
+
align?: RadixMenubarContentProps["align"];
|
|
82
|
+
/**
|
|
83
|
+
* Offset in pixels from the start or end alignment position.
|
|
84
|
+
* @default 0
|
|
85
|
+
*/
|
|
86
|
+
alignOffset?: RadixMenubarContentProps["alignOffset"];
|
|
87
|
+
/**
|
|
88
|
+
* Whether to reposition content to avoid viewport boundary collisions.
|
|
89
|
+
* @default true
|
|
90
|
+
*/
|
|
91
|
+
avoidCollisions?: RadixMenubarContentProps["avoidCollisions"];
|
|
92
|
+
/**
|
|
93
|
+
* Element or elements bounding boundary collision calculations.
|
|
94
|
+
* @default []
|
|
95
|
+
*/
|
|
96
|
+
collisionBoundary?: RadixMenubarContentProps["collisionBoundary"];
|
|
97
|
+
/**
|
|
98
|
+
* Virtual padding from collision boundaries in pixels.
|
|
99
|
+
* @default 0
|
|
100
|
+
*/
|
|
101
|
+
collisionPadding?: RadixMenubarContentProps["collisionPadding"];
|
|
102
|
+
/**
|
|
103
|
+
* Padding in pixels between popper arrow and floating panel edge.
|
|
104
|
+
* @default 0
|
|
105
|
+
*/
|
|
106
|
+
arrowPadding?: RadixMenubarContentProps["arrowPadding"];
|
|
107
|
+
/**
|
|
108
|
+
* Sticky positioning behavior along the align axis when overflowing.
|
|
109
|
+
* @default "partial"
|
|
110
|
+
*/
|
|
111
|
+
sticky?: RadixMenubarContentProps["sticky"];
|
|
112
|
+
/**
|
|
113
|
+
* Whether to hide content completely when trigger is fully occluded.
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
hideWhenDetached?: RadixMenubarContentProps["hideWhenDetached"];
|
|
117
|
+
/**
|
|
118
|
+
* Force mounting content in DOM for external animation controls.
|
|
119
|
+
* When forceMount is true, the content remains mounted even when closed.
|
|
120
|
+
* The caller is responsible for visibility transitions and unmounting after animation completes.
|
|
121
|
+
*/
|
|
122
|
+
forceMount?: true;
|
|
123
|
+
/**
|
|
124
|
+
* Change the default rendered div element to the child element, merging props and behavior.
|
|
125
|
+
* Content forwards ref to HTMLDivElement and inherits native div attributes.
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
asChild?: RadixMenubarContentProps["asChild"];
|
|
129
|
+
/**
|
|
130
|
+
* Callback fired when auto-focusing on close. Can be prevented.
|
|
131
|
+
*/
|
|
132
|
+
onCloseAutoFocus?: RadixMenubarContentProps["onCloseAutoFocus"];
|
|
133
|
+
/**
|
|
134
|
+
* Callback fired when the Escape key is down on the dismissable layer. Can be prevented.
|
|
135
|
+
*/
|
|
136
|
+
onEscapeKeyDown?: RadixMenubarContentProps["onEscapeKeyDown"];
|
|
137
|
+
/**
|
|
138
|
+
* Callback fired when a pointerdown event happens outside the bounds of the dismissable layer. Can be prevented.
|
|
139
|
+
*/
|
|
140
|
+
onPointerDownOutside?: RadixMenubarContentProps["onPointerDownOutside"];
|
|
141
|
+
/**
|
|
142
|
+
* Callback fired when focus moves outside the bounds of the dismissable layer. Can be prevented.
|
|
143
|
+
*/
|
|
144
|
+
onFocusOutside?: RadixMenubarContentProps["onFocusOutside"];
|
|
145
|
+
/**
|
|
146
|
+
* Callback fired when an interaction (pointerdown or focus) happens outside the bounds of the dismissable layer. Can be prevented.
|
|
147
|
+
*/
|
|
148
|
+
onInteractOutside?: RadixMenubarContentProps["onInteractOutside"];
|
|
149
|
+
}
|
|
150
|
+
export declare const MenuBarContent: React.ForwardRefExoticComponent<MenuBarContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
151
|
+
export interface MenuBarItemProps extends Omit<RadixMenubarItemProps, "disabled" | "onSelect" | "textValue" | "asChild"> {
|
|
152
|
+
/**
|
|
153
|
+
* Disable the menubar item.
|
|
154
|
+
* @default false
|
|
155
|
+
*/
|
|
156
|
+
disabled?: RadixMenubarItemProps["disabled"];
|
|
157
|
+
/**
|
|
158
|
+
* Event handler called when the menubar item is selected (via click or keyboard).
|
|
159
|
+
*/
|
|
160
|
+
onSelect?: RadixMenubarItemProps["onSelect"];
|
|
161
|
+
/**
|
|
162
|
+
* Optional text used for typeahead navigation. By default typeahead uses item text content.
|
|
163
|
+
*/
|
|
164
|
+
textValue?: RadixMenubarItemProps["textValue"];
|
|
165
|
+
/**
|
|
166
|
+
* Change the default rendered div element to the child element, merging props and behavior.
|
|
167
|
+
* Item forwards ref to HTMLDivElement and inherits native div attributes.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
asChild?: RadixMenubarItemProps["asChild"];
|
|
171
|
+
}
|
|
172
|
+
export declare const MenuBarItem: React.ForwardRefExoticComponent<MenuBarItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
173
|
+
export interface MenuBarRootProps extends MenuBarProps {
|
|
174
|
+
}
|
|
175
|
+
export declare function MenuBarRoot({ className, ...props }: MenuBarRootProps): React.JSX.Element;
|
|
176
|
+
export {};
|
|
@@ -1,42 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../utils/cn.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import { BASALT_UI_CLASS as t } from "../utils/control-surface.js";
|
|
4
|
+
import { overlayItemClass as n, overlayPanelClass as r } from "./overlay.js";
|
|
5
|
+
import * as i from "react";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
import * as o from "@radix-ui/react-menubar";
|
|
7
8
|
//#region src/components/menu-bar.tsx
|
|
8
|
-
function o(e) {
|
|
9
|
-
return /* @__PURE__ */ i(d, { ...e });
|
|
10
|
-
}
|
|
11
9
|
function s(e) {
|
|
12
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ a(f, { ...e });
|
|
11
|
+
}
|
|
12
|
+
function c(e) {
|
|
13
|
+
return /* @__PURE__ */ a(o.Menu, { ...e });
|
|
13
14
|
}
|
|
14
|
-
var
|
|
15
|
-
ref:
|
|
16
|
-
className: e("inline-flex h-8 items-center rounded-basalt-sm px-3 text-sm font-medium outline-hidden hover:bg-basalt-accent data-[state=open]:bg-basalt-accent",
|
|
17
|
-
...
|
|
15
|
+
var l = i.forwardRef(({ className: n, ...r }, i) => /* @__PURE__ */ a(o.Trigger, {
|
|
16
|
+
ref: i,
|
|
17
|
+
className: e(t, "inline-flex h-8 items-center rounded-basalt-sm px-3 text-sm font-medium outline-hidden hover:bg-basalt-accent data-[state=open]:bg-basalt-accent", n),
|
|
18
|
+
...r
|
|
19
|
+
}));
|
|
20
|
+
l.displayName = o.Trigger.displayName;
|
|
21
|
+
var u = i.forwardRef(({ className: t, sideOffset: n = 8, ...i }, s) => /* @__PURE__ */ a(o.Portal, {
|
|
22
|
+
forceMount: i.forceMount,
|
|
23
|
+
children: /* @__PURE__ */ a(o.Content, {
|
|
24
|
+
ref: s,
|
|
25
|
+
sideOffset: n,
|
|
26
|
+
className: r(e("min-w-40", t)),
|
|
27
|
+
...i
|
|
28
|
+
})
|
|
18
29
|
}));
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
ref:
|
|
22
|
-
|
|
23
|
-
className: n(e("min-w-40", t)),
|
|
24
|
-
...o
|
|
25
|
-
}) }));
|
|
26
|
-
l.displayName = a.Content.displayName;
|
|
27
|
-
var u = r.forwardRef(({ className: n, ...r }, o) => /* @__PURE__ */ i(a.Item, {
|
|
28
|
-
ref: o,
|
|
29
|
-
className: t(e("relative outline-hidden focus:bg-basalt-accent", n)),
|
|
30
|
+
u.displayName = o.Content.displayName;
|
|
31
|
+
var d = i.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ a(o.Item, {
|
|
32
|
+
ref: i,
|
|
33
|
+
className: n(e("relative outline-hidden focus:bg-basalt-accent", t)),
|
|
30
34
|
...r
|
|
31
35
|
}));
|
|
32
|
-
|
|
33
|
-
function
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
className: e("flex h-9 items-center gap-0.5 rounded-basalt-md border border-basalt-border bg-basalt-popover px-1",
|
|
36
|
-
...
|
|
36
|
+
d.displayName = o.Item.displayName;
|
|
37
|
+
function f({ className: n, ...r }) {
|
|
38
|
+
return /* @__PURE__ */ a(o.Root, {
|
|
39
|
+
className: e(t, "flex h-9 items-center gap-0.5 rounded-basalt-md border border-basalt-border bg-basalt-popover px-1", n),
|
|
40
|
+
...r
|
|
37
41
|
});
|
|
38
42
|
}
|
|
39
43
|
//#endregion
|
|
40
|
-
export {
|
|
44
|
+
export { s as MenuBar, u as MenuBarContent, d as MenuBarItem, c as MenuBarMenu, f as MenuBarRoot, l as MenuBarTrigger };
|
|
41
45
|
|
|
42
46
|
//# sourceMappingURL=menu-bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-bar.js","names":[],"sources":["../../src/components/menu-bar.tsx"],"sourcesContent":["import * as MenubarPrimitive from \"@radix-ui/react-menubar\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { MENU_GAP, overlayItemClass, overlayPanelClass } from \"./overlay\";\n\nexport function MenuBar(props: React.ComponentProps<typeof MenubarPrimitive.Root>) {\n\treturn <MenuBarRoot {...props} />;\n}\n\nexport function MenuBarMenu(props: React.ComponentProps<typeof MenubarPrimitive.Menu>) {\n\treturn <MenubarPrimitive.Menu {...props} />;\n}\n\nexport const MenuBarTrigger = React.forwardRef<\n\tReact.ElementRef<typeof MenubarPrimitive.Trigger>,\n\tReact.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n\t<MenubarPrimitive.Trigger\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"inline-flex h-8 items-center rounded-basalt-sm px-3 text-sm font-medium outline-hidden hover:bg-basalt-accent data-[state=open]:bg-basalt-accent\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nMenuBarTrigger.displayName = MenubarPrimitive.Trigger.displayName;\n\nexport const MenuBarContent = React.forwardRef<\n\tReact.ElementRef<typeof MenubarPrimitive.Content>,\n\tReact.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>\n>(({ className, sideOffset = MENU_GAP, ...props }, ref) => (\n\t<MenubarPrimitive.Portal>\n\t\t<MenubarPrimitive.Content\n\t\t\tref={ref}\n\t\t\tsideOffset={sideOffset}\n\t\t\tclassName={overlayPanelClass(cn(\"min-w-40\", className))}\n\t\t\t{...props}\n\t\t/>\n\t</MenubarPrimitive.Portal>\n));\nMenuBarContent.displayName = MenubarPrimitive.Content.displayName;\n\nexport const MenuBarItem = React.forwardRef<\n\tReact.ElementRef<typeof MenubarPrimitive.Item>,\n\tReact.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item>\n>(({ className, ...props }, ref) => (\n\t<MenubarPrimitive.Item\n\t\tref={ref}\n\t\tclassName={overlayItemClass(cn(\"relative outline-hidden focus:bg-basalt-accent\", className))}\n\t\t{...props}\n\t/>\n));\nMenuBarItem.displayName = MenubarPrimitive.Item.displayName;\n\nexport function MenuBarRoot({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof MenubarPrimitive.Root>) {\n\treturn (\n\t\t<MenubarPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-9 items-center gap-0.5 rounded-basalt-md border border-basalt-border bg-basalt-popover px-1\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,EAAQ,GAA2D;CAClF,OAAO,kBAAC,GAAD,EAAa,GAAI,EAAQ,CAAA;AACjC;AAEA,SAAgB,EAAY,GAA2D;CACtF,OAAO,kBAAC,EAAiB,MAAlB,EAAuB,GAAI,EAAQ,CAAA;AAC3C;AAEA,IAAa,IAAiB,EAAM,YAGjC,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAiB,SAAlB;CACM;CACL,WAAW,EACV,oJACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAe,cAAc,EAAiB,QAAQ;AAEtD,IAAa,IAAiB,EAAM,YAGjC,EAAE,cAAW,gBAAA,GAAuB,GAAG,KAAS,MAClD,kBAAC,EAAiB,QAAlB,EAAA,UACC,kBAAC,EAAiB,SAAlB;CACM;CACO;CACZ,WAAW,EAAkB,EAAG,YAAY,CAAS,CAAC;CACtD,GAAI;AACJ,CAAA,EACuB,CAAA,CACzB;AACD,EAAe,cAAc,EAAiB,QAAQ;AAEtD,IAAa,IAAc,EAAM,YAG9B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAiB,MAAlB;CACM;CACL,WAAW,EAAiB,EAAG,kDAAkD,CAAS,CAAC;CAC3F,GAAI;AACJ,CAAA,CACD;AACD,EAAY,cAAc,EAAiB,KAAK;AAEhD,SAAgB,EAAY,EAC3B,cACA,GAAG,KACmD;CACtD,OACC,kBAAC,EAAiB,MAAlB;EACC,WAAW,EACV,sGACA,CACD;EACA,GAAI;CACJ,CAAA;AAEH"}
|
|
1
|
+
{"version":3,"file":"menu-bar.js","names":[],"sources":["../../src/components/menu-bar.tsx"],"sourcesContent":["import * as MenubarPrimitive from \"@radix-ui/react-menubar\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\nimport { MENU_GAP, overlayItemClass, overlayPanelClass } from \"./overlay\";\n\ntype RadixMenubarProps = React.ComponentProps<typeof MenubarPrimitive.Root>;\ntype RadixMenubarMenuProps = React.ComponentProps<typeof MenubarPrimitive.Menu>;\ntype RadixMenubarTriggerProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>;\ntype RadixMenubarContentProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>;\ntype RadixMenubarItemProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item>;\n\nexport interface MenuBarProps\n\textends Omit<\n\t\tRadixMenubarProps,\n\t\t\"value\" | \"defaultValue\" | \"onValueChange\" | \"loop\" | \"dir\" | \"asChild\"\n\t> {\n\t/**\n\t * Controlled value of the currently open menu.\n\t */\n\tvalue?: RadixMenubarProps[\"value\"];\n\t/**\n\t * Uncontrolled initial value of the open menu.\n\t * @default \"\"\n\t */\n\tdefaultValue?: RadixMenubarProps[\"defaultValue\"];\n\t/**\n\t * Callback invoked when the open menu value changes.\n\t */\n\tonValueChange?: RadixMenubarProps[\"onValueChange\"];\n\t/**\n\t * Whether keyboard navigation loops around when reaching ends.\n\t * @default true\n\t */\n\tloop?: RadixMenubarProps[\"loop\"];\n\t/**\n\t * Reading direction of the menubar.\n\t * @default \"ltr\"\n\t */\n\tdir?: RadixMenubarProps[\"dir\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * MenuBar forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixMenubarProps[\"asChild\"];\n}\n\nexport function MenuBar(props: MenuBarProps) {\n\treturn <MenuBarRoot {...props} />;\n}\n\nexport interface MenuBarMenuProps extends Omit<RadixMenubarMenuProps, \"value\"> {\n\t/**\n\t * Unique identifier value for this menu within the menubar.\n\t */\n\tvalue?: RadixMenubarMenuProps[\"value\"];\n}\n\nexport function MenuBarMenu(props: MenuBarMenuProps) {\n\treturn <MenubarPrimitive.Menu {...props} />;\n}\n\nexport interface MenuBarTriggerProps\n\textends Omit<RadixMenubarTriggerProps, \"disabled\" | \"asChild\"> {\n\t/**\n\t * Disable the menubar trigger button.\n\t * @default false\n\t */\n\tdisabled?: RadixMenubarTriggerProps[\"disabled\"];\n\t/**\n\t * Change the default rendered button element to the child element, merging props and behavior.\n\t * Trigger forwards ref to HTMLButtonElement and inherits native button attributes.\n\t * @default false\n\t */\n\tasChild?: RadixMenubarTriggerProps[\"asChild\"];\n}\n\nexport const MenuBarTrigger = React.forwardRef<\n\tReact.ElementRef<typeof MenubarPrimitive.Trigger>,\n\tMenuBarTriggerProps\n>(({ className, ...props }, ref) => (\n\t<MenubarPrimitive.Trigger\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\tBASALT_UI_CLASS,\n\t\t\t\"inline-flex h-8 items-center rounded-basalt-sm px-3 text-sm font-medium outline-hidden hover:bg-basalt-accent data-[state=open]:bg-basalt-accent\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nMenuBarTrigger.displayName = MenubarPrimitive.Trigger.displayName;\n\nexport interface MenuBarContentProps\n\textends Omit<\n\t\tRadixMenubarContentProps,\n\t\t| \"loop\"\n\t\t| \"side\"\n\t\t| \"sideOffset\"\n\t\t| \"align\"\n\t\t| \"alignOffset\"\n\t\t| \"avoidCollisions\"\n\t\t| \"collisionBoundary\"\n\t\t| \"collisionPadding\"\n\t\t| \"arrowPadding\"\n\t\t| \"sticky\"\n\t\t| \"hideWhenDetached\"\n\t\t| \"forceMount\"\n\t\t| \"asChild\"\n\t\t| \"onCloseAutoFocus\"\n\t\t| \"onEscapeKeyDown\"\n\t\t| \"onPointerDownOutside\"\n\t\t| \"onFocusOutside\"\n\t\t| \"onInteractOutside\"\n\t> {\n\t/**\n\t * Whether keyboard navigation loops around when reaching the start or end item.\n\t * @default false\n\t */\n\tloop?: RadixMenubarContentProps[\"loop\"];\n\t/**\n\t * Preferred placement side relative to the menu trigger.\n\t * @default \"bottom\"\n\t */\n\tside?: RadixMenubarContentProps[\"side\"];\n\t/**\n\t * Distance in pixels between trigger and floating content panel.\n\t * @default 4\n\t */\n\tsideOffset?: RadixMenubarContentProps[\"sideOffset\"];\n\t/**\n\t * Preferred alignment along the side axis.\n\t * @default \"start\"\n\t */\n\talign?: RadixMenubarContentProps[\"align\"];\n\t/**\n\t * Offset in pixels from the start or end alignment position.\n\t * @default 0\n\t */\n\talignOffset?: RadixMenubarContentProps[\"alignOffset\"];\n\t/**\n\t * Whether to reposition content to avoid viewport boundary collisions.\n\t * @default true\n\t */\n\tavoidCollisions?: RadixMenubarContentProps[\"avoidCollisions\"];\n\t/**\n\t * Element or elements bounding boundary collision calculations.\n\t * @default []\n\t */\n\tcollisionBoundary?: RadixMenubarContentProps[\"collisionBoundary\"];\n\t/**\n\t * Virtual padding from collision boundaries in pixels.\n\t * @default 0\n\t */\n\tcollisionPadding?: RadixMenubarContentProps[\"collisionPadding\"];\n\t/**\n\t * Padding in pixels between popper arrow and floating panel edge.\n\t * @default 0\n\t */\n\tarrowPadding?: RadixMenubarContentProps[\"arrowPadding\"];\n\t/**\n\t * Sticky positioning behavior along the align axis when overflowing.\n\t * @default \"partial\"\n\t */\n\tsticky?: RadixMenubarContentProps[\"sticky\"];\n\t/**\n\t * Whether to hide content completely when trigger is fully occluded.\n\t * @default false\n\t */\n\thideWhenDetached?: RadixMenubarContentProps[\"hideWhenDetached\"];\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * When forceMount is true, the content remains mounted even when closed.\n\t * The caller is responsible for visibility transitions and unmounting after animation completes.\n\t */\n\tforceMount?: true;\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Content forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixMenubarContentProps[\"asChild\"];\n\t/**\n\t * Callback fired when auto-focusing on close. Can be prevented.\n\t */\n\tonCloseAutoFocus?: RadixMenubarContentProps[\"onCloseAutoFocus\"];\n\t/**\n\t * Callback fired when the Escape key is down on the dismissable layer. Can be prevented.\n\t */\n\tonEscapeKeyDown?: RadixMenubarContentProps[\"onEscapeKeyDown\"];\n\t/**\n\t * Callback fired when a pointerdown event happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonPointerDownOutside?: RadixMenubarContentProps[\"onPointerDownOutside\"];\n\t/**\n\t * Callback fired when focus moves outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonFocusOutside?: RadixMenubarContentProps[\"onFocusOutside\"];\n\t/**\n\t * Callback fired when an interaction (pointerdown or focus) happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonInteractOutside?: RadixMenubarContentProps[\"onInteractOutside\"];\n}\n\nexport const MenuBarContent = React.forwardRef<\n\tReact.ElementRef<typeof MenubarPrimitive.Content>,\n\tMenuBarContentProps\n>(({ className, sideOffset = MENU_GAP, ...props }, ref) => (\n\t<MenubarPrimitive.Portal forceMount={props.forceMount}>\n\t\t<MenubarPrimitive.Content\n\t\t\tref={ref}\n\t\t\tsideOffset={sideOffset}\n\t\t\tclassName={overlayPanelClass(cn(\"min-w-40\", className))}\n\t\t\t{...props}\n\t\t/>\n\t</MenubarPrimitive.Portal>\n));\nMenuBarContent.displayName = MenubarPrimitive.Content.displayName;\n\nexport interface MenuBarItemProps\n\textends Omit<RadixMenubarItemProps, \"disabled\" | \"onSelect\" | \"textValue\" | \"asChild\"> {\n\t/**\n\t * Disable the menubar item.\n\t * @default false\n\t */\n\tdisabled?: RadixMenubarItemProps[\"disabled\"];\n\t/**\n\t * Event handler called when the menubar item is selected (via click or keyboard).\n\t */\n\tonSelect?: RadixMenubarItemProps[\"onSelect\"];\n\t/**\n\t * Optional text used for typeahead navigation. By default typeahead uses item text content.\n\t */\n\ttextValue?: RadixMenubarItemProps[\"textValue\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Item forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixMenubarItemProps[\"asChild\"];\n}\n\nexport const MenuBarItem = React.forwardRef<\n\tReact.ElementRef<typeof MenubarPrimitive.Item>,\n\tMenuBarItemProps\n>(({ className, ...props }, ref) => (\n\t<MenubarPrimitive.Item\n\t\tref={ref}\n\t\tclassName={overlayItemClass(cn(\"relative outline-hidden focus:bg-basalt-accent\", className))}\n\t\t{...props}\n\t/>\n));\nMenuBarItem.displayName = MenubarPrimitive.Item.displayName;\n\nexport interface MenuBarRootProps extends MenuBarProps {}\n\nexport function MenuBarRoot({ className, ...props }: MenuBarRootProps) {\n\treturn (\n\t\t<MenubarPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\tBASALT_UI_CLASS,\n\t\t\t\t\"flex h-9 items-center gap-0.5 rounded-basalt-md border border-basalt-border bg-basalt-popover px-1\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAgDA,SAAgB,EAAQ,GAAqB;CAC5C,OAAO,kBAAC,GAAD,EAAa,GAAI,EAAQ,CAAA;AACjC;AASA,SAAgB,EAAY,GAAyB;CACpD,OAAO,kBAAC,EAAiB,MAAlB,EAAuB,GAAI,EAAQ,CAAA;AAC3C;AAiBA,IAAa,IAAiB,EAAM,YAGjC,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAiB,SAAlB;CACM;CACL,WAAW,EACV,GACA,oJACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAe,cAAc,EAAiB,QAAQ;AAiHtD,IAAa,IAAiB,EAAM,YAGjC,EAAE,cAAW,gBAAA,GAAuB,GAAG,KAAS,MAClD,kBAAC,EAAiB,QAAlB;CAAyB,YAAY,EAAM;CAC1C,UAAA,kBAAC,EAAiB,SAAlB;EACM;EACO;EACZ,WAAW,EAAkB,EAAG,YAAY,CAAS,CAAC;EACtD,GAAI;CACJ,CAAA;AACuB,CAAA,CACzB;AACD,EAAe,cAAc,EAAiB,QAAQ;AAyBtD,IAAa,IAAc,EAAM,YAG9B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAiB,MAAlB;CACM;CACL,WAAW,EAAiB,EAAG,kDAAkD,CAAS,CAAC;CAC3F,GAAI;AACJ,CAAA,CACD;AACD,EAAY,cAAc,EAAiB,KAAK;AAIhD,SAAgB,EAAY,EAAE,cAAW,GAAG,KAA2B;CACtE,OACC,kBAAC,EAAiB,MAAlB;EACC,WAAW,EACV,GACA,sGACA,CACD;EACA,GAAI;CACJ,CAAA;AAEH"}
|
|
@@ -1,8 +1,33 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface MeterProps {
|
|
2
|
+
/**
|
|
3
|
+
* Percentage value representing current meter progress (0..100).
|
|
4
|
+
*
|
|
5
|
+
* Note: Rendered bar width is clamped to [0, 100]%; callers should provide 0..100,
|
|
6
|
+
* while underlying Radix validates and manages accessible value attributes.
|
|
7
|
+
* Does not support arbitrary native HTML props, ref forwarding, min/max, or change callbacks.
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
2
10
|
value?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Text label displayed above the meter bar and used as accessible name fallback.
|
|
13
|
+
*/
|
|
3
14
|
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom text overriding the displayed percentage value text next to the label.
|
|
17
|
+
*/
|
|
4
18
|
customValue?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to hide the displayed value text next to the label.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
5
23
|
hideValue?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Additional CSS classes applied to the root container.
|
|
26
|
+
*/
|
|
6
27
|
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Accessible label announced for assistive technologies. Takes precedence over `label`.
|
|
30
|
+
*/
|
|
7
31
|
"aria-label"?: string;
|
|
8
|
-
}
|
|
32
|
+
}
|
|
33
|
+
export declare function Meter({ value, label, customValue, hideValue, className, "aria-label": ariaLabel, }: MeterProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.js","names":[],"sources":["../../src/components/meter.tsx"],"sourcesContent":["import * as Progress from \"@radix-ui/react-progress\";\nimport { cn } from \"../utils/cn\";\n\nexport
|
|
1
|
+
{"version":3,"file":"meter.js","names":[],"sources":["../../src/components/meter.tsx"],"sourcesContent":["import * as Progress from \"@radix-ui/react-progress\";\nimport { cn } from \"../utils/cn\";\n\nexport interface MeterProps {\n\t/**\n\t * Percentage value representing current meter progress (0..100).\n\t *\n\t * Note: Rendered bar width is clamped to [0, 100]%; callers should provide 0..100,\n\t * while underlying Radix validates and manages accessible value attributes.\n\t * Does not support arbitrary native HTML props, ref forwarding, min/max, or change callbacks.\n\t * @default 0\n\t */\n\tvalue?: number;\n\t/**\n\t * Text label displayed above the meter bar and used as accessible name fallback.\n\t */\n\tlabel?: string;\n\t/**\n\t * Custom text overriding the displayed percentage value text next to the label.\n\t */\n\tcustomValue?: string;\n\t/**\n\t * Whether to hide the displayed value text next to the label.\n\t * @default false\n\t */\n\thideValue?: boolean;\n\t/**\n\t * Additional CSS classes applied to the root container.\n\t */\n\tclassName?: string;\n\t/**\n\t * Accessible label announced for assistive technologies. Takes precedence over `label`.\n\t */\n\t\"aria-label\"?: string;\n}\n\nexport function Meter({\n\tvalue = 0,\n\tlabel,\n\tcustomValue,\n\thideValue = false,\n\tclassName,\n\t\"aria-label\": ariaLabel,\n}: MeterProps) {\n\treturn (\n\t\t<div className={cn(\"w-full space-y-1\", className)}>\n\t\t\t{label || (!hideValue && customValue) ? (\n\t\t\t\t<div className=\"flex justify-between text-xs text-basalt-muted-foreground\">\n\t\t\t\t\t<span>{label}</span>\n\t\t\t\t\t{hideValue ? null : <span>{customValue ?? `${value}%`}</span>}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<Progress.Root\n\t\t\t\tvalue={value}\n\t\t\t\taria-label={ariaLabel ?? label}\n\t\t\t\tclassName=\"relative h-2 overflow-hidden rounded-full bg-basalt-muted\"\n\t\t\t>\n\t\t\t\t<Progress.Indicator\n\t\t\t\t\tclassName=\"h-full bg-basalt-primary transition-[width]\"\n\t\t\t\t\tstyle={{ width: `${Math.min(100, Math.max(0, value))}%` }}\n\t\t\t\t/>\n\t\t\t</Progress.Root>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;AAoCA,SAAgB,EAAM,EACrB,WAAQ,GACR,UACA,gBACA,eAAY,IACZ,cACA,cAAc,KACA;CACd,OACC,kBAAC,OAAD;EAAK,WAAW,EAAG,oBAAoB,CAAS;EAAhD,UAAA,CACE,KAAU,CAAC,KAAa,IACxB,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACC,kBAAC,QAAD,EAAA,UAAO,EAAY,CAAA,GAClB,IAAY,OAAO,kBAAC,QAAD,EAAA,UAAO,KAAe,GAAG,EAAM,GAAS,CAAA,CACxD;EACF,CAAA,IAAA,MACJ,kBAAC,EAAS,MAAV;GACQ;GACP,cAAY,KAAa;GACzB,WAAU;GAEV,UAAA,kBAAC,EAAS,WAAV;IACC,WAAU;IACV,OAAO,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,CAAK,CAAC,EAAE,GAAG;GACxD,CAAA;EACa,CAAA,CACX;;AAEP"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface MultiSelectOption {
|
|
3
|
+
/** Stable identifier, independent of the display label. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Searchable and accessible display name. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Optional secondary searchable text. */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Caller-provided icon or avatar. */
|
|
10
|
+
leading?: ReactNode;
|
|
11
|
+
/** Prevent adding or removing this option. */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface MultiSelectProps {
|
|
15
|
+
/** Accessible field and popup name. */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Available options; retain selected options to preserve their display labels. */
|
|
18
|
+
options: readonly MultiSelectOption[];
|
|
19
|
+
/** Controlled selected identifiers. */
|
|
20
|
+
value?: readonly string[];
|
|
21
|
+
/** Initial uncontrolled selection. @default [] */
|
|
22
|
+
defaultValue?: readonly string[];
|
|
23
|
+
/** Selection requests; controlled values change only when accepted by the caller. */
|
|
24
|
+
onValueChange?: (value: string[]) => void;
|
|
25
|
+
/** Controlled search text; asynchronous requests belong to the caller. */
|
|
26
|
+
query?: string;
|
|
27
|
+
/** Initial uncontrolled search text. @default "" */
|
|
28
|
+
defaultQuery?: string;
|
|
29
|
+
/** Search text requests. */
|
|
30
|
+
onQueryChange?: (query: string) => void;
|
|
31
|
+
/** Controlled popup visibility. */
|
|
32
|
+
open?: boolean;
|
|
33
|
+
/** Initial uncontrolled popup visibility. @default false */
|
|
34
|
+
defaultOpen?: boolean;
|
|
35
|
+
/** Popup visibility requests. */
|
|
36
|
+
onOpenChange?: (open: boolean) => void;
|
|
37
|
+
/** Use local label/description filtering; disable for server-filtered options. @default true */
|
|
38
|
+
filterOptions?: boolean;
|
|
39
|
+
/** Loading content replaces the option list. @default false */
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
/** Disables the trigger, chips, and native form entries. @default false */
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/** Repeated native form entry name, one entry per selected identifier. */
|
|
44
|
+
name?: string;
|
|
45
|
+
/** Optional external native form owner. Uncontrolled state respects uncancelled form resets. */
|
|
46
|
+
form?: string;
|
|
47
|
+
/** Empty selection prompt. @default "Select options" */
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
/** Search input prompt. @default "Search options…" */
|
|
50
|
+
searchPlaceholder?: string;
|
|
51
|
+
/** Empty search result text. @default "No options found." */
|
|
52
|
+
emptyLabel?: string;
|
|
53
|
+
/** Loading announcement. @default "Loading options…" */
|
|
54
|
+
loadingLabel?: string;
|
|
55
|
+
/** Chip removal label prefix. @default "Remove" */
|
|
56
|
+
removeLabel?: string;
|
|
57
|
+
/** Show removable selection chips; disable when a FilterBar renders its own chips. @default true */
|
|
58
|
+
showChips?: boolean;
|
|
59
|
+
/** Selection count formatter, including localization. */
|
|
60
|
+
formatSelectionCount?: (count: number) => string;
|
|
61
|
+
/** Additional root classes. */
|
|
62
|
+
className?: string;
|
|
63
|
+
}
|
|
64
|
+
export declare function MultiSelect({ label, options, value, defaultValue, onValueChange, query, defaultQuery, onQueryChange, open, defaultOpen, onOpenChange, filterOptions, loading, disabled, name, form, placeholder, searchPlaceholder, emptyLabel, loadingLabel, removeLabel, showChips, formatSelectionCount, className, }: MultiSelectProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { BASALT_UI_CLASS as t } from "../utils/control-surface.js";
|
|
4
|
+
import { Button as n } from "./button.js";
|
|
5
|
+
import { Input as r } from "./input.js";
|
|
6
|
+
import { Popover as ee, PopoverContent as te, PopoverTrigger as ne } from "./popover.js";
|
|
7
|
+
import { useEffect as i, useId as a, useRef as o, useState as s } from "react";
|
|
8
|
+
import { Check as c, ChevronDown as l, X as u } from "lucide-react";
|
|
9
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/multi-select.tsx
|
|
11
|
+
function p({ label: p, options: m, value: h, defaultValue: g = [], onValueChange: _, query: v, defaultQuery: y = "", onQueryChange: re, open: b, defaultOpen: ie = !1, onOpenChange: ae, filterOptions: oe = !0, loading: x = !1, disabled: S = !1, name: C, form: w, placeholder: se = "Select options", searchPlaceholder: ce = "Search options…", emptyLabel: T = "No options found.", loadingLabel: E = "Loading options…", removeLabel: D = "Remove", showChips: O = !0, formatSelectionCount: k, className: A }) {
|
|
12
|
+
let [le, j] = s(g), [ue, M] = s(y), [de, N] = s(ie), [P, F] = s(null), I = o(null), L = o(null), R = o(null), z = o(null), B = o({
|
|
13
|
+
value: h,
|
|
14
|
+
defaultValue: g,
|
|
15
|
+
query: v,
|
|
16
|
+
defaultQuery: y,
|
|
17
|
+
open: b
|
|
18
|
+
});
|
|
19
|
+
i(() => {
|
|
20
|
+
B.current = {
|
|
21
|
+
value: h,
|
|
22
|
+
defaultValue: g,
|
|
23
|
+
query: v,
|
|
24
|
+
defaultQuery: y,
|
|
25
|
+
open: b
|
|
26
|
+
};
|
|
27
|
+
}), i(() => {
|
|
28
|
+
let e = L.current?.form;
|
|
29
|
+
if (!e) return;
|
|
30
|
+
let t = /* @__PURE__ */ new Set();
|
|
31
|
+
function n(e) {
|
|
32
|
+
let n = setTimeout(() => {
|
|
33
|
+
if (t.delete(n), e.defaultPrevented) return;
|
|
34
|
+
let r = B.current;
|
|
35
|
+
r.value === void 0 && j(r.defaultValue), r.query === void 0 && M(r.defaultQuery), r.open === void 0 && N(!1), F(null);
|
|
36
|
+
}, 0);
|
|
37
|
+
t.add(n);
|
|
38
|
+
}
|
|
39
|
+
return e.addEventListener("reset", n), () => {
|
|
40
|
+
for (let e of t) clearTimeout(e);
|
|
41
|
+
e.removeEventListener("reset", n);
|
|
42
|
+
};
|
|
43
|
+
}, [w]);
|
|
44
|
+
let V = a(), H = h ?? le, U = v ?? ue, W = (b ?? de) && !S, G = m.filter((e) => !oe || `${e.label} ${e.description ?? ""}`.toLocaleLowerCase().includes(U.trim().toLocaleLowerCase())), K = G.filter((e) => !e.disabled), q = K.some((e) => e.value === P) ? P : K[0]?.value, J = G.findIndex((e) => e.value === q), Y = k ? k(H.length) : `${H.length} selected`;
|
|
45
|
+
function X(e) {
|
|
46
|
+
S || (b === void 0 && N(e), ae?.(e));
|
|
47
|
+
}
|
|
48
|
+
function Z(e) {
|
|
49
|
+
S || (h === void 0 && j(e), _?.(e));
|
|
50
|
+
}
|
|
51
|
+
function Q(e) {
|
|
52
|
+
e.disabled || Z(H.includes(e.value) ? H.filter((t) => t !== e.value) : [...H, e.value]);
|
|
53
|
+
}
|
|
54
|
+
function $() {
|
|
55
|
+
if (U) return;
|
|
56
|
+
let e = [...H].reverse().find((e) => !m.find((t) => t.value === e)?.disabled);
|
|
57
|
+
e !== void 0 && Z(H.filter((t) => t !== e));
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ f("div", {
|
|
60
|
+
className: e(t, "min-w-0 space-y-2", A),
|
|
61
|
+
children: [
|
|
62
|
+
O && H.length > 0 && /* @__PURE__ */ d("div", {
|
|
63
|
+
role: "group",
|
|
64
|
+
className: "flex flex-wrap gap-1.5",
|
|
65
|
+
"aria-label": `${p}: ${Y}`,
|
|
66
|
+
children: H.map((e) => {
|
|
67
|
+
let t = m.find((t) => t.value === e), n = t?.label ?? e;
|
|
68
|
+
return /* @__PURE__ */ f("span", {
|
|
69
|
+
className: "inline-flex max-w-full items-center gap-1 rounded-basalt-md border border-basalt-border bg-basalt-accent py-0.5 pl-2 text-xs",
|
|
70
|
+
children: [/* @__PURE__ */ d("span", {
|
|
71
|
+
className: "min-w-0 break-words",
|
|
72
|
+
children: n
|
|
73
|
+
}), /* @__PURE__ */ d("button", {
|
|
74
|
+
type: "button",
|
|
75
|
+
disabled: S || t?.disabled,
|
|
76
|
+
"aria-label": `${D} ${n}`,
|
|
77
|
+
className: "rounded p-1 focus-visible:outline-2 focus-visible:outline-basalt-ring disabled:opacity-50",
|
|
78
|
+
onClick: () => Z(H.filter((t) => t !== e)),
|
|
79
|
+
children: /* @__PURE__ */ d(u, {
|
|
80
|
+
className: "size-3",
|
|
81
|
+
"aria-hidden": "true"
|
|
82
|
+
})
|
|
83
|
+
})]
|
|
84
|
+
}, e);
|
|
85
|
+
})
|
|
86
|
+
}),
|
|
87
|
+
!S && C && H.map((e) => /* @__PURE__ */ d("input", {
|
|
88
|
+
type: "hidden",
|
|
89
|
+
name: C,
|
|
90
|
+
form: w,
|
|
91
|
+
value: e
|
|
92
|
+
}, e)),
|
|
93
|
+
/* @__PURE__ */ f(ee, {
|
|
94
|
+
open: W,
|
|
95
|
+
onOpenChange: X,
|
|
96
|
+
children: [/* @__PURE__ */ d(ne, {
|
|
97
|
+
asChild: !0,
|
|
98
|
+
children: /* @__PURE__ */ f(n, {
|
|
99
|
+
ref: L,
|
|
100
|
+
form: w,
|
|
101
|
+
variant: "outline",
|
|
102
|
+
disabled: S,
|
|
103
|
+
"aria-label": p,
|
|
104
|
+
"aria-describedby": `${V}-count`,
|
|
105
|
+
className: "w-full justify-between",
|
|
106
|
+
onKeyDown: (e) => {
|
|
107
|
+
e.nativeEvent.isComposing || ((e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), X(!0)), e.key === "Backspace" && (e.preventDefault(), $()));
|
|
108
|
+
},
|
|
109
|
+
children: [/* @__PURE__ */ d("span", {
|
|
110
|
+
className: "truncate",
|
|
111
|
+
children: H.length ? Y : se
|
|
112
|
+
}), /* @__PURE__ */ d(l, { "aria-hidden": "true" })]
|
|
113
|
+
})
|
|
114
|
+
}), /* @__PURE__ */ f(te, {
|
|
115
|
+
align: "start",
|
|
116
|
+
className: "w-72 max-w-[calc(100vw-2rem)] p-2",
|
|
117
|
+
"aria-label": p,
|
|
118
|
+
onOpenAutoFocus: (e) => {
|
|
119
|
+
e.preventDefault(), I.current?.focus();
|
|
120
|
+
},
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ d(r, {
|
|
123
|
+
ref: I,
|
|
124
|
+
role: "combobox",
|
|
125
|
+
"aria-label": `${p}: search`,
|
|
126
|
+
"aria-expanded": W,
|
|
127
|
+
"aria-autocomplete": "list",
|
|
128
|
+
"aria-controls": `${V}-list`,
|
|
129
|
+
"aria-activedescendant": !x && J >= 0 ? `${V}-option-${J}` : void 0,
|
|
130
|
+
placeholder: ce,
|
|
131
|
+
value: U,
|
|
132
|
+
onChange: (e) => {
|
|
133
|
+
v === void 0 && M(e.target.value), re?.(e.target.value), F(null);
|
|
134
|
+
},
|
|
135
|
+
onKeyDown: (e) => {
|
|
136
|
+
if (!e.nativeEvent.isComposing) {
|
|
137
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
138
|
+
if (e.preventDefault(), !x && K.length) {
|
|
139
|
+
let t = K.findIndex((e) => e.value === q), n = K[(t + (e.key === "ArrowDown" ? 1 : -1) + K.length) % K.length];
|
|
140
|
+
F(n.value), R.current?.querySelector(`[data-option-index="${G.indexOf(n)}"]`)?.scrollIntoView({ block: "nearest" });
|
|
141
|
+
}
|
|
142
|
+
} else if (e.key === "Enter") {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
let t = K.find((e) => e.value === q);
|
|
145
|
+
!x && t && Q(t);
|
|
146
|
+
} else e.key === "Backspace" && !U && (e.preventDefault(), $());
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ d("div", {
|
|
151
|
+
ref: R,
|
|
152
|
+
id: `${V}-list`,
|
|
153
|
+
role: "listbox",
|
|
154
|
+
"aria-label": p,
|
|
155
|
+
"aria-multiselectable": "true",
|
|
156
|
+
"aria-busy": x,
|
|
157
|
+
className: "mt-2 max-h-60 overflow-y-auto",
|
|
158
|
+
children: !x && G.map((t, n) => /* @__PURE__ */ f("button", {
|
|
159
|
+
type: "button",
|
|
160
|
+
role: "option",
|
|
161
|
+
id: `${V}-option-${n}`,
|
|
162
|
+
"data-option-index": n,
|
|
163
|
+
tabIndex: -1,
|
|
164
|
+
"aria-selected": H.includes(t.value),
|
|
165
|
+
"aria-disabled": t.disabled || void 0,
|
|
166
|
+
disabled: t.disabled,
|
|
167
|
+
className: e("flex w-full items-center gap-2 rounded-basalt-md px-2 py-2 text-left text-sm disabled:opacity-40", q === t.value && "bg-basalt-accent"),
|
|
168
|
+
onPointerMove: (e) => {
|
|
169
|
+
let n = z.current;
|
|
170
|
+
(n?.x !== e.clientX || n.y !== e.clientY) && (z.current = {
|
|
171
|
+
x: e.clientX,
|
|
172
|
+
y: e.clientY
|
|
173
|
+
}, t.disabled || F(t.value));
|
|
174
|
+
},
|
|
175
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
176
|
+
onClick: () => {
|
|
177
|
+
Q(t), I.current?.focus();
|
|
178
|
+
},
|
|
179
|
+
children: [
|
|
180
|
+
t.leading,
|
|
181
|
+
/* @__PURE__ */ f("span", {
|
|
182
|
+
className: "min-w-0 flex-1",
|
|
183
|
+
children: [/* @__PURE__ */ d("span", {
|
|
184
|
+
className: "block break-words",
|
|
185
|
+
children: t.label
|
|
186
|
+
}), t.description && /* @__PURE__ */ d("span", {
|
|
187
|
+
className: "block text-xs text-basalt-muted-foreground",
|
|
188
|
+
children: t.description
|
|
189
|
+
})]
|
|
190
|
+
}),
|
|
191
|
+
H.includes(t.value) && /* @__PURE__ */ d(c, {
|
|
192
|
+
className: "size-4 shrink-0",
|
|
193
|
+
"aria-hidden": "true"
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
}, t.value))
|
|
197
|
+
}),
|
|
198
|
+
(x || G.length === 0) && /* @__PURE__ */ d("p", {
|
|
199
|
+
role: "status",
|
|
200
|
+
className: "px-2 py-4 text-sm text-basalt-muted-foreground",
|
|
201
|
+
children: x ? E : T
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
})]
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ d("span", {
|
|
207
|
+
id: `${V}-count`,
|
|
208
|
+
className: "sr-only",
|
|
209
|
+
"aria-live": "polite",
|
|
210
|
+
children: Y
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
export { p as MultiSelect };
|
|
217
|
+
|
|
218
|
+
//# sourceMappingURL=multi-select.js.map
|