@nocoo/basalt 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/charts/area.d.ts +8 -0
- package/dist/charts/area.js +55 -0
- package/dist/charts/area.js.map +1 -0
- package/dist/charts/bar.d.ts +9 -0
- package/dist/charts/bar.js +42 -0
- package/dist/charts/bar.js.map +1 -0
- package/dist/charts/bullet.d.ts +8 -0
- package/dist/charts/bullet.js +50 -0
- package/dist/charts/bullet.js.map +1 -0
- package/dist/charts/chart-colors.d.ts +1 -0
- package/dist/charts/chart-colors.js +3 -0
- package/dist/charts/charts.d.ts +6 -0
- package/dist/charts/charts.js +15 -0
- package/dist/charts/charts.js.map +1 -0
- package/dist/charts/config.d.ts +117 -0
- package/dist/charts/config.js +117 -0
- package/dist/charts/config.js.map +1 -0
- package/dist/charts/custom-chart.d.ts +6 -0
- package/dist/charts/custom-chart.js +15 -0
- package/dist/charts/custom-chart.js.map +1 -0
- package/dist/charts/date-navigation.d.ts +22 -0
- package/dist/charts/date-navigation.js +122 -0
- package/dist/charts/date-navigation.js.map +1 -0
- package/dist/charts/donut.d.ts +8 -0
- package/dist/charts/donut.js +36 -0
- package/dist/charts/donut.js.map +1 -0
- package/dist/charts/frame.d.ts +9 -0
- package/dist/charts/frame.js +22 -0
- package/dist/charts/frame.js.map +1 -0
- package/dist/charts/funnel.d.ts +7 -0
- package/dist/charts/funnel.js +35 -0
- package/dist/charts/funnel.js.map +1 -0
- package/dist/charts/gauge.d.ts +8 -0
- package/dist/charts/gauge.js +46 -0
- package/dist/charts/gauge.js.map +1 -0
- package/dist/charts/grouped-bar.d.ts +7 -0
- package/dist/charts/grouped-bar.js +42 -0
- package/dist/charts/grouped-bar.js.map +1 -0
- package/dist/charts/heatmap-calendar.d.ts +27 -0
- package/dist/charts/heatmap-calendar.js +200 -0
- package/dist/charts/heatmap-calendar.js.map +1 -0
- package/dist/charts/item-list.d.ts +9 -0
- package/dist/charts/item-list.js +22 -0
- package/dist/charts/item-list.js.map +1 -0
- package/dist/charts/line.d.ts +9 -0
- package/dist/charts/line.js +58 -0
- package/dist/charts/line.js.map +1 -0
- package/dist/charts/palette.d.ts +33 -0
- package/dist/charts/palette.js +44 -0
- package/dist/charts/palette.js.map +1 -0
- package/dist/charts/radar.d.ts +6 -0
- package/dist/charts/radar.js +37 -0
- package/dist/charts/radar.js.map +1 -0
- package/dist/charts/sample.d.ts +42 -0
- package/dist/charts/sample.js +124 -0
- package/dist/charts/sample.js.map +1 -0
- package/dist/charts/sankey.d.ts +6 -0
- package/dist/charts/sankey.js +51 -0
- package/dist/charts/sankey.js.map +1 -0
- package/dist/charts/slot-bar.d.ts +15 -0
- package/dist/charts/slot-bar.js +80 -0
- package/dist/charts/slot-bar.js.map +1 -0
- package/dist/charts/sparkline.d.ts +6 -0
- package/dist/charts/sparkline.js +29 -0
- package/dist/charts/sparkline.js.map +1 -0
- package/dist/charts/stacked-bar.d.ts +7 -0
- package/dist/charts/stacked-bar.js +51 -0
- package/dist/charts/stacked-bar.js.map +1 -0
- package/dist/charts/stat-card.d.ts +21 -0
- package/dist/charts/stat-card.js +66 -0
- package/dist/charts/stat-card.js.map +1 -0
- package/dist/charts/timeline.d.ts +17 -0
- package/dist/charts/timeline.js +79 -0
- package/dist/charts/timeline.js.map +1 -0
- package/dist/charts/timeseries.d.ts +6 -0
- package/dist/charts/timeseries.js +15 -0
- package/dist/charts/timeseries.js.map +1 -0
- package/dist/components/accordion.d.ts +6 -0
- package/dist/components/accordion.js +21 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +25 -0
- package/dist/components/alert-dialog.js +61 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/app-header.d.ts +10 -0
- package/dist/components/app-header.js +35 -0
- package/dist/components/app-header.js.map +1 -0
- package/dist/components/app-shell.d.ts +4 -0
- package/dist/components/app-shell.js +29 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.d.ts +47 -0
- package/dist/components/autocomplete.js +28 -0
- package/dist/components/autocomplete.js.map +1 -0
- package/dist/components/avatar.d.ts +5 -0
- package/dist/components/avatar.js +28 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +10 -0
- package/dist/components/badge.js +37 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/banner.d.ts +22 -0
- package/dist/components/banner.js +88 -0
- package/dist/components/banner.js.map +1 -0
- package/dist/components/basalt-mark.d.ts +8 -0
- package/dist/components/basalt-mark.js +17 -0
- package/dist/components/basalt-mark.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +9 -0
- package/dist/components/breadcrumbs.js +38 -0
- package/dist/components/breadcrumbs.js.map +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +73 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/checkbox.d.ts +86 -0
- package/dist/components/checkbox.js +107 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/clipboard-text.d.ts +5 -0
- package/dist/components/clipboard-text.js +33 -0
- package/dist/components/clipboard-text.js.map +1 -0
- package/dist/components/code.d.ts +26 -0
- package/dist/components/code.js +45 -0
- package/dist/components/code.js.map +1 -0
- package/dist/components/collapsible.d.ts +33 -0
- package/dist/components/collapsible.js +38 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.d.ts +47 -0
- package/dist/components/combobox.js +28 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/command-palette.d.ts +83 -0
- package/dist/components/command-palette.js +90 -0
- package/dist/components/command-palette.js.map +1 -0
- package/dist/components/confirm-dialog.d.ts +52 -0
- package/dist/components/confirm-dialog.js +61 -0
- package/dist/components/confirm-dialog.js.map +1 -0
- package/dist/components/context-menu.d.ts +7 -0
- package/dist/components/context-menu.js +23 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/data-table.d.ts +76 -0
- package/dist/components/data-table.js +230 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/date-picker.d.ts +90 -0
- package/dist/components/date-picker.js +452 -0
- package/dist/components/date-picker.js.map +1 -0
- package/dist/components/dialog.d.ts +37 -0
- package/dist/components/dialog.js +67 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +38 -0
- package/dist/components/dropdown-menu.js +24 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty.d.ts +6 -0
- package/dist/components/empty.js +28 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.d.ts +39 -0
- package/dist/components/field.js +52 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/flow.d.ts +24 -0
- package/dist/components/flow.js +56 -0
- package/dist/components/flow.js.map +1 -0
- package/dist/components/grid.d.ts +15 -0
- package/dist/components/grid.js +24 -0
- package/dist/components/grid.js.map +1 -0
- package/dist/components/hover-card.d.ts +5 -0
- package/dist/components/hover-card.js +18 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-area.d.ts +19 -0
- package/dist/components/input-area.js +27 -0
- package/dist/components/input-area.js.map +1 -0
- package/dist/components/input-group.d.ts +70 -0
- package/dist/components/input-group.js +78 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +19 -0
- package/dist/components/input.js +28 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.d.ts +20 -0
- package/dist/components/label.js +34 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/layer-card.d.ts +69 -0
- package/dist/components/layer-card.js +104 -0
- package/dist/components/layer-card.js.map +1 -0
- package/dist/components/link.d.ts +8 -0
- package/dist/components/link.js +18 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/loader.d.ts +4 -0
- package/dist/components/loader.js +66 -0
- package/dist/components/loader.js.map +1 -0
- package/dist/components/loading-screen.d.ts +5 -0
- package/dist/components/loading-screen.js +24 -0
- package/dist/components/loading-screen.js.map +1 -0
- package/dist/components/menu-bar.d.ts +8 -0
- package/dist/components/menu-bar.js +42 -0
- package/dist/components/menu-bar.js.map +1 -0
- package/dist/components/meter.d.ts +8 -0
- package/dist/components/meter.js +26 -0
- package/dist/components/meter.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +6 -0
- package/dist/components/navigation-menu.js +16 -0
- package/dist/components/navigation-menu.js.map +1 -0
- package/dist/components/overlay.d.ts +16 -0
- package/dist/components/overlay.js +14 -0
- package/dist/components/overlay.js.map +1 -0
- package/dist/components/page-header.d.ts +19 -0
- package/dist/components/page-header.js +43 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/pagination.d.ts +35 -0
- package/dist/components/pagination.js +68 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.d.ts +38 -0
- package/dist/components/popover.js +65 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/radio.d.ts +108 -0
- package/dist/components/radio.js +80 -0
- package/dist/components/radio.js.map +1 -0
- package/dist/components/scroll-area.d.ts +15 -0
- package/dist/components/scroll-area.js +49 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/segment-control.d.ts +35 -0
- package/dist/components/segment-control.js +46 -0
- package/dist/components/segment-control.js.map +1 -0
- package/dist/components/select.d.ts +99 -0
- package/dist/components/select.js +51 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/sensitive-input.d.ts +23 -0
- package/dist/components/sensitive-input.js +43 -0
- package/dist/components/sensitive-input.js.map +1 -0
- package/dist/components/separator.d.ts +26 -0
- package/dist/components/separator.js +18 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +26 -0
- package/dist/components/sheet.js +49 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +101 -0
- package/dist/components/sidebar.js +260 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton-line.d.ts +6 -0
- package/dist/components/skeleton-line.js +22 -0
- package/dist/components/skeleton-line.js.map +1 -0
- package/dist/components/slider.d.ts +3 -0
- package/dist/components/slider.js +21 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/stat-strip.d.ts +19 -0
- package/dist/components/stat-strip.js +27 -0
- package/dist/components/stat-strip.js.map +1 -0
- package/dist/components/switch.d.ts +85 -0
- package/dist/components/switch.js +94 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table-of-contents.d.ts +33 -0
- package/dist/components/table-of-contents.js +37 -0
- package/dist/components/table-of-contents.js.map +1 -0
- package/dist/components/table-pager.d.ts +26 -0
- package/dist/components/table-pager.js +35 -0
- package/dist/components/table-pager.js.map +1 -0
- package/dist/components/table.d.ts +45 -0
- package/dist/components/table.js +32 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +65 -0
- package/dist/components/tabs.js +56 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/text.d.ts +32 -0
- package/dist/components/text.js +46 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/theme-toggle.d.ts +7 -0
- package/dist/components/theme-toggle.js +28 -0
- package/dist/components/theme-toggle.js.map +1 -0
- package/dist/components/toast.d.ts +27 -0
- package/dist/components/toast.js +78 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/toggle-group.d.ts +4 -0
- package/dist/components/toggle-group.js +48 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +7 -0
- package/dist/components/toggle.js +37 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/toolbar.d.ts +58 -0
- package/dist/components/toolbar.js +76 -0
- package/dist/components/toolbar.js.map +1 -0
- package/dist/components/tooltip.d.ts +13 -0
- package/dist/components/tooltip.js +18 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/typeahead-field.d.ts +24 -0
- package/dist/components/typeahead-field.js +177 -0
- package/dist/components/typeahead-field.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +35 -0
- package/dist/providers/link.d.ts +12 -0
- package/dist/providers/link.js +18 -0
- package/dist/providers/link.js.map +1 -0
- package/dist/providers/theme.d.ts +11 -0
- package/dist/providers/theme.js +43 -0
- package/dist/providers/theme.js.map +1 -0
- package/dist/styles/standalone.css +2233 -0
- package/dist/styles/tailwind.css +103 -0
- package/dist/styles/tokens.css +277 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +11 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/control-surface.d.ts +2 -0
- package/dist/utils/control-surface.js +11 -0
- package/dist/utils/control-surface.js.map +1 -0
- package/dist/utils/selection-indicator.d.ts +24 -0
- package/dist/utils/selection-indicator.js +108 -0
- package/dist/utils/selection-indicator.js.map +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { FOCUS_RING as t } from "./overlay.js";
|
|
4
|
+
import { useSelectionIndicator as n } from "../utils/selection-indicator.js";
|
|
5
|
+
import * as r from "react";
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
import * as o from "@radix-ui/react-toggle-group";
|
|
8
|
+
//#region src/components/toggle-group.tsx
|
|
9
|
+
var s = r.createContext("single"), c = r.forwardRef(({ className: t, children: r, ...c }, l) => {
|
|
10
|
+
let u = c.type === "single", { ref: d, state: f, motionClassName: p } = n({
|
|
11
|
+
itemSelector: "[data-state=\"on\"]",
|
|
12
|
+
enabled: u,
|
|
13
|
+
ref: l
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ i(s.Provider, {
|
|
16
|
+
value: c.type,
|
|
17
|
+
children: /* @__PURE__ */ a(o.Root, {
|
|
18
|
+
ref: d,
|
|
19
|
+
className: e("relative inline-flex h-8 shrink-0 items-center gap-0.5 rounded-full bg-basalt-muted p-0.5 ring-1 ring-basalt-border/70", t),
|
|
20
|
+
...c,
|
|
21
|
+
children: [u ? /* @__PURE__ */ i("span", {
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
"data-slot": "selection-indicator",
|
|
24
|
+
className: e("pointer-events-none absolute rounded-full bg-basalt-primary shadow-sm", p),
|
|
25
|
+
style: {
|
|
26
|
+
left: f.left,
|
|
27
|
+
width: f.visible ? f.width : 0,
|
|
28
|
+
top: f.top,
|
|
29
|
+
height: f.visible ? f.height : 0
|
|
30
|
+
}
|
|
31
|
+
}) : null, r]
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
c.displayName = o.Root.displayName;
|
|
36
|
+
var l = r.forwardRef(({ className: n, ...a }, c) => {
|
|
37
|
+
let l = r.useContext(s);
|
|
38
|
+
return /* @__PURE__ */ i(o.Item, {
|
|
39
|
+
ref: c,
|
|
40
|
+
className: e("relative inline-flex h-7 items-center rounded-full px-2.5 text-[11px] font-semibold tracking-wide text-basalt-muted-foreground transition-colors", "hover:text-basalt-foreground", t, "data-[state=on]:text-basalt-primary-foreground", l === "multiple" && "data-[state=on]:bg-basalt-primary data-[state=on]:shadow-sm", "disabled:pointer-events-none disabled:opacity-50", n),
|
|
41
|
+
...a
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
l.displayName = o.Item.displayName;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { c as ToggleGroup, l as ToggleGroupItem };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=toggle-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-group.js","names":[],"sources":["../../src/components/toggle-group.tsx"],"sourcesContent":["import * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { useSelectionIndicator } from \"../utils/selection-indicator\";\nimport { FOCUS_RING } from \"./overlay\";\n\nconst ToggleGroupMode = React.createContext<\"single\" | \"multiple\">(\"single\");\n\nexport const ToggleGroup = React.forwardRef<\n\tReact.ElementRef<typeof ToggleGroupPrimitive.Root>,\n\tReact.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>\n>(({ className, children, ...props }, ref) => {\n\tconst sliding = props.type === \"single\";\n\tconst {\n\t\tref: rootRef,\n\t\tstate,\n\t\tmotionClassName,\n\t} = useSelectionIndicator({\n\t\titemSelector: '[data-state=\"on\"]',\n\t\tenabled: sliding,\n\t\tref,\n\t});\n\n\treturn (\n\t\t<ToggleGroupMode.Provider value={props.type}>\n\t\t\t<ToggleGroupPrimitive.Root\n\t\t\t\tref={rootRef}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"relative inline-flex h-8 shrink-0 items-center gap-0.5 rounded-full bg-basalt-muted p-0.5 ring-1 ring-basalt-border/70\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{sliding ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tdata-slot=\"selection-indicator\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\"pointer-events-none absolute rounded-full bg-basalt-primary shadow-sm\",\n\t\t\t\t\t\t\tmotionClassName,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tleft: state.left,\n\t\t\t\t\t\t\twidth: state.visible ? state.width : 0,\n\t\t\t\t\t\t\ttop: state.top,\n\t\t\t\t\t\t\theight: state.visible ? state.height : 0,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t\t{children}\n\t\t\t</ToggleGroupPrimitive.Root>\n\t\t</ToggleGroupMode.Provider>\n\t);\n});\nToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;\n\nexport const ToggleGroupItem = React.forwardRef<\n\tReact.ElementRef<typeof ToggleGroupPrimitive.Item>,\n\tReact.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>\n>(({ className, ...props }, ref) => {\n\tconst mode = React.useContext(ToggleGroupMode);\n\treturn (\n\t\t<ToggleGroupPrimitive.Item\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"relative inline-flex h-7 items-center rounded-full px-2.5 text-[11px] font-semibold tracking-wide text-basalt-muted-foreground transition-colors\",\n\t\t\t\t\"hover:text-basalt-foreground\",\n\t\t\t\tFOCUS_RING,\n\t\t\t\t\"data-[state=on]:text-basalt-primary-foreground\",\n\t\t\t\tmode === \"multiple\" && \"data-[state=on]:bg-basalt-primary data-[state=on]:shadow-sm\",\n\t\t\t\t\"disabled:pointer-events-none disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;\n"],"mappings":";;;;;;;;AAMA,IAAM,IAAkB,EAAM,cAAqC,QAAQ,GAE9D,IAAc,EAAM,YAG9B,EAAE,cAAW,aAAU,GAAG,KAAS,MAAQ;CAC7C,IAAM,IAAU,EAAM,SAAS,UACzB,EACL,KAAK,GACL,UACA,uBACG,EAAsB;EACzB,cAAc;EACd,SAAS;EACT;CACD,CAAC;CAED,OACC,kBAAC,EAAgB,UAAjB;EAA0B,OAAO,EAAM;EACtC,UAAA,kBAAC,EAAqB,MAAtB;GACC,KAAK;GACL,WAAW,EACV,0HACA,CACD;GACA,GAAI;GANL,UAAA,CAQE,IACA,kBAAC,QAAD;IACC,eAAY;IACZ,aAAU;IACV,WAAW,EACV,yEACA,CACD;IACA,OAAO;KACN,MAAM,EAAM;KACZ,OAAO,EAAM,UAAU,EAAM,QAAQ;KACrC,KAAK,EAAM;KACX,QAAQ,EAAM,UAAU,EAAM,SAAS;IACxC;GACA,CAAA,IACE,MACH,CACyB;;CACF,CAAA;AAE5B,CAAC;AACD,EAAY,cAAc,EAAqB,KAAK;AAEpD,IAAa,IAAkB,EAAM,YAGlC,EAAE,cAAW,GAAG,KAAS,MAAQ;CACnC,IAAM,IAAO,EAAM,WAAW,CAAe;CAC7C,OACC,kBAAC,EAAqB,MAAtB;EACM;EACL,WAAW,EACV,oJACA,gCACA,GACA,kDACA,MAAS,cAAc,+DACvB,oDACA,CACD;EACA,GAAI;CACJ,CAAA;AAEH,CAAC;AACD,EAAgB,cAAc,EAAqB,KAAK"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { FOCUS_RING as t } from "./overlay.js";
|
|
4
|
+
import * as n from "react";
|
|
5
|
+
import { cva as r } from "class-variance-authority";
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
7
|
+
import * as a from "@radix-ui/react-toggle";
|
|
8
|
+
//#region src/components/toggle.tsx
|
|
9
|
+
var o = r(`inline-flex items-center justify-center rounded-basalt-md text-sm font-medium transition-colors hover:bg-basalt-accent data-[state=on]:bg-basalt-accent ${t}`, {
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-basalt-muted text-basalt-foreground",
|
|
13
|
+
outline: "border border-basalt-border bg-basalt-secondary"
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: "h-9 px-3",
|
|
17
|
+
sm: "h-8 px-2 text-xs",
|
|
18
|
+
lg: "h-10 px-4"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: "default",
|
|
23
|
+
size: "default"
|
|
24
|
+
}
|
|
25
|
+
}), s = n.forwardRef(({ className: t, variant: n, size: r, ...s }, c) => /* @__PURE__ */ i(a.Root, {
|
|
26
|
+
ref: c,
|
|
27
|
+
className: e(o({
|
|
28
|
+
variant: n,
|
|
29
|
+
size: r
|
|
30
|
+
}), t),
|
|
31
|
+
...s
|
|
32
|
+
}));
|
|
33
|
+
s.displayName = a.Root.displayName;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { s as Toggle };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.js","names":[],"sources":["../../src/components/toggle.tsx"],"sourcesContent":["import * as TogglePrimitive from \"@radix-ui/react-toggle\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { FOCUS_RING } from \"./overlay\";\n\nconst toggleVariants = cva(\n\t`inline-flex items-center justify-center rounded-basalt-md text-sm font-medium transition-colors hover:bg-basalt-accent data-[state=on]:bg-basalt-accent ${FOCUS_RING}`,\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: \"bg-basalt-muted text-basalt-foreground\",\n\t\t\t\toutline: \"border border-basalt-border bg-basalt-secondary\",\n\t\t\t},\n\t\t\tsize: { default: \"h-9 px-3\", sm: \"h-8 px-2 text-xs\", lg: \"h-10 px-4\" },\n\t\t},\n\t\tdefaultVariants: { variant: \"default\", size: \"default\" },\n\t},\n);\n\nexport const Toggle = React.forwardRef<\n\tReact.ElementRef<typeof TogglePrimitive.Root>,\n\tReact.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>\n>(({ className, variant, size, ...props }, ref) => (\n\t<TogglePrimitive.Root\n\t\tref={ref}\n\t\tclassName={cn(toggleVariants({ variant, size }), className)}\n\t\t{...props}\n\t/>\n));\nToggle.displayName = TogglePrimitive.Root.displayName;\n"],"mappings":";;;;;;;;AAMA,IAAM,IAAiB,EACtB,2JAA2J,KAC3J;CACC,UAAU;EACT,SAAS;GACR,SAAS;GACT,SAAS;EACV;EACA,MAAM;GAAE,SAAS;GAAY,IAAI;GAAoB,IAAI;EAAY;CACtE;CACA,iBAAiB;EAAE,SAAS;EAAW,MAAM;CAAU;AACxD,CACD,GAEa,IAAS,EAAM,YAGzB,EAAE,cAAW,YAAS,SAAM,GAAG,KAAS,MAC1C,kBAAC,EAAgB,MAAjB;CACM;CACL,WAAW,EAAG,EAAe;EAAE;EAAS;CAAK,CAAC,GAAG,CAAS;CAC1D,GAAI;AACJ,CAAA,CACD;AACD,EAAO,cAAc,EAAgB,KAAK"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ButtonProps } from "./button.js";
|
|
3
|
+
import { Input } from "./input.js";
|
|
4
|
+
export type ToolbarProps = Omit<React.HTMLAttributes<HTMLDivElement>, "aria-label"> & {
|
|
5
|
+
/**
|
|
6
|
+
* Accessible name for the toolbar.
|
|
7
|
+
*/
|
|
8
|
+
"aria-label"?: string;
|
|
9
|
+
};
|
|
10
|
+
export type ToolbarButtonProps = Omit<ButtonProps, "variant" | "disabled" | "asChild"> & {
|
|
11
|
+
/**
|
|
12
|
+
* Disable the toolbar button.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const ToolbarButton: React.ForwardRefExoticComponent<Omit<ButtonProps, "asChild" | "disabled" | "variant"> & {
|
|
18
|
+
/**
|
|
19
|
+
* Disable the toolbar button.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
export type ToolbarInputProps = Omit<React.ComponentPropsWithoutRef<typeof Input>, "disabled"> & {
|
|
25
|
+
/**
|
|
26
|
+
* Disable the toolbar input.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare const ToolbarInput: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("./input.js").InputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref">, "disabled"> & {
|
|
32
|
+
/**
|
|
33
|
+
* Disable the toolbar input.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
38
|
+
export declare const Toolbar: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "aria-label"> & {
|
|
39
|
+
/**
|
|
40
|
+
* Accessible name for the toolbar.
|
|
41
|
+
*/
|
|
42
|
+
"aria-label"?: string;
|
|
43
|
+
} & React.RefAttributes<HTMLDivElement>> & {
|
|
44
|
+
Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "asChild" | "disabled" | "variant"> & {
|
|
45
|
+
/**
|
|
46
|
+
* Disable the toolbar button.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
51
|
+
Input: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("./input.js").InputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref">, "disabled"> & {
|
|
52
|
+
/**
|
|
53
|
+
* Disable the toolbar input.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
58
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { FOCUS_INSET as t } from "./overlay.js";
|
|
4
|
+
import { Button as n } from "./button.js";
|
|
5
|
+
import { Input as r } from "./input.js";
|
|
6
|
+
import * as i from "react";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/toolbar.tsx
|
|
9
|
+
var o = e("relative min-w-0 rounded-none border-0 bg-transparent shadow-none", "first:rounded-l-basalt-md last:rounded-r-basalt-md", "focus-within:z-2 focus:z-2 focus-visible:z-2");
|
|
10
|
+
function s(e) {
|
|
11
|
+
return [...e.querySelectorAll("button:not([disabled]), input:not([disabled])")].filter((t) => t.closest("[role=\"toolbar\"]") === e);
|
|
12
|
+
}
|
|
13
|
+
function c(e, t) {
|
|
14
|
+
for (let n of e) n.tabIndex = n === t ? 0 : -1;
|
|
15
|
+
}
|
|
16
|
+
var l = i.forwardRef(({ className: t, onKeyDown: n, onFocus: r, ...o }, l) => {
|
|
17
|
+
let u = i.useRef(null);
|
|
18
|
+
return i.useLayoutEffect(() => {
|
|
19
|
+
let e = u.current;
|
|
20
|
+
if (!e) return;
|
|
21
|
+
let t = s(e), n = t.find((e) => e.tabIndex === 0 && !e.disabled) ?? t[0];
|
|
22
|
+
n && c(t, n);
|
|
23
|
+
}), /* @__PURE__ */ a("div", {
|
|
24
|
+
ref: (e) => {
|
|
25
|
+
u.current = e, typeof l == "function" ? l(e) : l && (l.current = e);
|
|
26
|
+
},
|
|
27
|
+
...o,
|
|
28
|
+
role: "toolbar",
|
|
29
|
+
onFocus: (e) => {
|
|
30
|
+
r?.(e);
|
|
31
|
+
let t = s(e.currentTarget), n = e.target;
|
|
32
|
+
t.includes(n) && c(t, n);
|
|
33
|
+
},
|
|
34
|
+
onKeyDown: (e) => {
|
|
35
|
+
if (n?.(e), e.defaultPrevented || e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
|
|
36
|
+
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
|
|
37
|
+
let t = e.target.selectionStart ?? 0;
|
|
38
|
+
if (t !== (e.target.selectionEnd ?? t) || e.key === "ArrowLeft" && t > 0 || e.key === "ArrowRight" && t < e.target.value.length) return;
|
|
39
|
+
}
|
|
40
|
+
let t = s(e.currentTarget), r = t.indexOf(e.target);
|
|
41
|
+
if (r < 0 || t.length === 0) return;
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
let i = t[e.key === "ArrowRight" ? (r + 1) % t.length : (r - 1 + t.length) % t.length];
|
|
44
|
+
i && (c(t, i), i.focus());
|
|
45
|
+
},
|
|
46
|
+
className: e("inline-flex w-fit items-stretch rounded-basalt-md bg-basalt-secondary shadow-xs ring-1 ring-basalt-border", "[&>*:not(:first-child)]:border-l [&>*:not(:first-child)]:border-basalt-border", t)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
l.displayName = "Toolbar";
|
|
50
|
+
var u = i.forwardRef(({ className: t, size: r, icon: i, children: s, ...c }, l) => {
|
|
51
|
+
let u = r ?? (i && s == null ? "icon" : "default");
|
|
52
|
+
return /* @__PURE__ */ a(n, {
|
|
53
|
+
ref: l,
|
|
54
|
+
icon: i,
|
|
55
|
+
className: e(o, "h-auto min-h-9 shrink-0", u === "icon" && "w-9", t),
|
|
56
|
+
...c,
|
|
57
|
+
variant: "ghost",
|
|
58
|
+
size: u,
|
|
59
|
+
children: s
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
u.displayName = "Toolbar.Button";
|
|
63
|
+
var d = i.forwardRef(({ className: n, ...i }, s) => /* @__PURE__ */ a(r, {
|
|
64
|
+
ref: s,
|
|
65
|
+
className: e(o, t, "h-auto min-h-9", n),
|
|
66
|
+
...i
|
|
67
|
+
}));
|
|
68
|
+
d.displayName = "Toolbar.Input";
|
|
69
|
+
var f = Object.assign(l, {
|
|
70
|
+
Button: u,
|
|
71
|
+
Input: d
|
|
72
|
+
});
|
|
73
|
+
//#endregion
|
|
74
|
+
export { f as Toolbar, u as ToolbarButton, d as ToolbarInput };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.js","names":[],"sources":["../../src/components/toolbar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Button, type ButtonProps } from \"./button\";\nimport { Input } from \"./input\";\nimport { FOCUS_INSET } from \"./overlay\";\n\nconst toolbarControlClass = cn(\n\t\"relative min-w-0 rounded-none border-0 bg-transparent shadow-none\",\n\t\"first:rounded-l-basalt-md last:rounded-r-basalt-md\",\n\t\"focus-within:z-2 focus:z-2 focus-visible:z-2\",\n);\n\nexport type ToolbarProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"aria-label\"> & {\n\t/**\n\t * Accessible name for the toolbar.\n\t */\n\t\"aria-label\"?: string;\n};\n\nfunction toolbarItems(root: HTMLElement) {\n\treturn [\n\t\t...root.querySelectorAll<HTMLElement>(\"button:not([disabled]), input:not([disabled])\"),\n\t].filter((node) => node.closest('[role=\"toolbar\"]') === root);\n}\n\nfunction setRovingTab(items: HTMLElement[], active: HTMLElement) {\n\tfor (const item of items) {\n\t\titem.tabIndex = item === active ? 0 : -1;\n\t}\n}\n\nconst ToolbarRoot = React.forwardRef<HTMLDivElement, ToolbarProps>(\n\t({ className, onKeyDown, onFocus, ...props }, ref) => {\n\t\tconst innerRef = React.useRef<HTMLDivElement | null>(null);\n\t\tReact.useLayoutEffect(() => {\n\t\t\tconst root = innerRef.current;\n\t\t\tif (!root) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst items = toolbarItems(root);\n\t\t\tconst active =\n\t\t\t\titems.find((item) => item.tabIndex === 0 && !(item as HTMLButtonElement).disabled) ??\n\t\t\t\titems[0];\n\t\t\tif (active) {\n\t\t\t\tsetRovingTab(items, active);\n\t\t\t}\n\t\t});\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={(node) => {\n\t\t\t\t\tinnerRef.current = node;\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t\trole=\"toolbar\"\n\t\t\t\tonFocus={(event) => {\n\t\t\t\t\tonFocus?.(event);\n\t\t\t\t\tconst items = toolbarItems(event.currentTarget);\n\t\t\t\t\tconst target = event.target as HTMLElement;\n\t\t\t\t\tif (items.includes(target)) {\n\t\t\t\t\t\tsetRovingTab(items, target);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\tonKeyDown?.(event);\n\t\t\t\t\tif (event.defaultPrevented || (event.key !== \"ArrowRight\" && event.key !== \"ArrowLeft\")) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.target instanceof HTMLInputElement ||\n\t\t\t\t\t\tevent.target instanceof HTMLTextAreaElement\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst start = event.target.selectionStart ?? 0;\n\t\t\t\t\t\tconst end = event.target.selectionEnd ?? start;\n\t\t\t\t\t\tif (start !== end) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"ArrowLeft\" && start > 0) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"ArrowRight\" && start < event.target.value.length) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst items = toolbarItems(event.currentTarget);\n\t\t\t\t\tconst index = items.indexOf(event.target as HTMLElement);\n\t\t\t\t\tif (index < 0 || items.length === 0) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tconst next =\n\t\t\t\t\t\tevent.key === \"ArrowRight\"\n\t\t\t\t\t\t\t? (index + 1) % items.length\n\t\t\t\t\t\t\t: (index - 1 + items.length) % items.length;\n\t\t\t\t\tconst node = items[next];\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tsetRovingTab(items, node);\n\t\t\t\t\t\tnode.focus();\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"inline-flex w-fit items-stretch rounded-basalt-md bg-basalt-secondary shadow-xs ring-1 ring-basalt-border\",\n\t\t\t\t\t\"[&>*:not(:first-child)]:border-l [&>*:not(:first-child)]:border-basalt-border\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t},\n);\nToolbarRoot.displayName = \"Toolbar\";\n\nexport type ToolbarButtonProps = Omit<ButtonProps, \"variant\" | \"disabled\" | \"asChild\"> & {\n\t/**\n\t * Disable the toolbar button.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n};\n\nexport const ToolbarButton = React.forwardRef<HTMLButtonElement, ToolbarButtonProps>(\n\t({ className, size, icon, children, ...props }, ref) => {\n\t\tconst resolvedSize = size ?? (icon && children == null ? \"icon\" : \"default\");\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tref={ref}\n\t\t\t\ticon={icon}\n\t\t\t\tclassName={cn(\n\t\t\t\t\ttoolbarControlClass,\n\t\t\t\t\t\"h-auto min-h-9 shrink-0\",\n\t\t\t\t\tresolvedSize === \"icon\" && \"w-9\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\tsize={resolvedSize}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Button>\n\t\t);\n\t},\n);\nToolbarButton.displayName = \"Toolbar.Button\";\n\nexport type ToolbarInputProps = Omit<React.ComponentPropsWithoutRef<typeof Input>, \"disabled\"> & {\n\t/**\n\t * Disable the toolbar input.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n};\n\nexport const ToolbarInput = React.forwardRef<HTMLInputElement, ToolbarInputProps>(\n\t({ className, ...props }, ref) => (\n\t\t<Input\n\t\t\tref={ref}\n\t\t\tclassName={cn(toolbarControlClass, FOCUS_INSET, \"h-auto min-h-9\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nToolbarInput.displayName = \"Toolbar.Input\";\n\nexport const Toolbar = Object.assign(ToolbarRoot, {\n\tButton: ToolbarButton,\n\tInput: ToolbarInput,\n});\n"],"mappings":";;;;;;;;AAMA,IAAM,IAAsB,EAC3B,qEACA,sDACA,8CACD;AASA,SAAS,EAAa,GAAmB;CACxC,OAAO,CACN,GAAG,EAAK,iBAA8B,+CAA+C,CACtF,CAAC,CAAC,QAAQ,MAAS,EAAK,QAAQ,oBAAkB,MAAM,CAAI;AAC7D;AAEA,SAAS,EAAa,GAAsB,GAAqB;CAChE,KAAK,IAAM,KAAQ,GAClB,EAAK,WAAW,MAAS,IAAS,IAAI;AAExC;AAEA,IAAM,IAAc,EAAM,YACxB,EAAE,cAAW,cAAW,YAAS,GAAG,KAAS,MAAQ;CACrD,IAAM,IAAW,EAAM,OAA8B,IAAI;CAczD,OAbA,EAAM,sBAAsB;EAC3B,IAAM,IAAO,EAAS;EACtB,IAAI,CAAC,GACJ;EAED,IAAM,IAAQ,EAAa,CAAI,GACzB,IACL,EAAM,MAAM,MAAS,EAAK,aAAa,KAAK,CAAE,EAA2B,QAAQ,KACjF,EAAM;EACP,AAAI,KACH,EAAa,GAAO,CAAM;CAE5B,CAAC,GAEA,kBAAC,OAAD;EACC,MAAM,MAAS;GAEd,AADA,EAAS,UAAU,GACf,OAAO,KAAQ,aAClB,EAAI,CAAI,IACE,MACV,EAAI,UAAU;EAEhB;EACA,GAAI;EACJ,MAAK;EACL,UAAU,MAAU;GACnB,IAAU,CAAK;GACf,IAAM,IAAQ,EAAa,EAAM,aAAa,GACxC,IAAS,EAAM;GACrB,AAAI,EAAM,SAAS,CAAM,KACxB,EAAa,GAAO,CAAM;EAE5B;EACA,YAAY,MAAU;GAErB,IADA,IAAY,CAAK,GACb,EAAM,oBAAqB,EAAM,QAAQ,gBAAgB,EAAM,QAAQ,aAC1E;GAED,IACC,EAAM,kBAAkB,oBACxB,EAAM,kBAAkB,qBACvB;IACD,IAAM,IAAQ,EAAM,OAAO,kBAAkB;IAQ7C,IANI,OADQ,EAAM,OAAO,gBAAgB,MAIrC,EAAM,QAAQ,eAAe,IAAQ,KAGrC,EAAM,QAAQ,gBAAgB,IAAQ,EAAM,OAAO,MAAM,QAC5D;GAEF;GACA,IAAM,IAAQ,EAAa,EAAM,aAAa,GACxC,IAAQ,EAAM,QAAQ,EAAM,MAAqB;GACvD,IAAI,IAAQ,KAAK,EAAM,WAAW,GACjC;GAED,EAAM,eAAe;GAKrB,IAAM,IAAO,EAHZ,EAAM,QAAQ,gBACV,IAAQ,KAAK,EAAM,UACnB,IAAQ,IAAI,EAAM,UAAU,EAAM;GAEvC,AAAI,MACH,EAAa,GAAO,CAAI,GACxB,EAAK,MAAM;EAEb;EACA,WAAW,EACV,6GACA,iFACA,CACD;CACA,CAAA;AAEH,CACD;AACA,EAAY,cAAc;AAU1B,IAAa,IAAgB,EAAM,YACjC,EAAE,cAAW,SAAM,SAAM,aAAU,GAAG,KAAS,MAAQ;CACvD,IAAM,IAAe,MAAS,KAAQ,KAAY,OAAO,SAAS;CAClE,OACC,kBAAC,GAAD;EACM;EACC;EACN,WAAW,EACV,GACA,2BACA,MAAiB,UAAU,OAC3B,CACD;EACA,GAAI;EACJ,SAAQ;EACR,MAAM;EAEL;CACM,CAAA;AAEV,CACD;AACA,EAAc,cAAc;AAU5B,IAAa,IAAe,EAAM,YAChC,EAAE,cAAW,GAAG,KAAS,MACzB,kBAAC,GAAD;CACM;CACL,WAAW,EAAG,GAAqB,GAAa,kBAAkB,CAAS;CAC3E,GAAI;AACJ,CAAA,CAEH;AACA,EAAa,cAAc;AAE3B,IAAa,IAAU,OAAO,OAAO,GAAa;CACjD,QAAQ;CACR,OAAO;AACR,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type TooltipProps = Omit<React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>, "delayDuration"> & {
|
|
4
|
+
/**
|
|
5
|
+
* Delay before the tooltip opens, in milliseconds.
|
|
6
|
+
* @default 700
|
|
7
|
+
*/
|
|
8
|
+
delayDuration?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
11
|
+
export declare const Tooltip: React.FC<TooltipProps>;
|
|
12
|
+
export declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { OVERLAY_LAYER as t, OVERLAY_MOTION as n } from "./overlay.js";
|
|
4
|
+
import * as r from "react";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import * as a from "@radix-ui/react-tooltip";
|
|
7
|
+
//#region src/components/tooltip.tsx
|
|
8
|
+
var o = a.Provider, s = a.Root, c = a.Trigger, l = r.forwardRef(({ className: r, sideOffset: o = 4, ...s }, c) => /* @__PURE__ */ i(a.Portal, { children: /* @__PURE__ */ i(a.Content, {
|
|
9
|
+
ref: c,
|
|
10
|
+
sideOffset: o,
|
|
11
|
+
className: e(t, n, "overflow-hidden rounded-basalt-md border border-basalt-border bg-basalt-popover px-3 py-1.5 text-sm text-basalt-popover-foreground shadow-md", r),
|
|
12
|
+
...s
|
|
13
|
+
}) }));
|
|
14
|
+
l.displayName = a.Content.displayName;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { s as Tooltip, l as TooltipContent, o as TooltipProvider, c as TooltipTrigger };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":[],"sources":["../../src/components/tooltip.tsx"],"sourcesContent":["import * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { OVERLAY_LAYER, OVERLAY_MOTION } from \"./overlay\";\n\nexport type TooltipProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>,\n\t\"delayDuration\"\n> & {\n\t/**\n\t * Delay before the tooltip opens, in milliseconds.\n\t * @default 700\n\t */\n\tdelayDuration?: number;\n};\n\nexport const TooltipProvider = TooltipPrimitive.Provider;\nexport const Tooltip: React.FC<TooltipProps> = TooltipPrimitive.Root;\nexport const TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport const TooltipContent = React.forwardRef<\n\tReact.ElementRef<typeof TooltipPrimitive.Content>,\n\tReact.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n\t<TooltipPrimitive.Portal>\n\t\t<TooltipPrimitive.Content\n\t\t\tref={ref}\n\t\t\tsideOffset={sideOffset}\n\t\t\tclassName={cn(\n\t\t\t\tOVERLAY_LAYER,\n\t\t\t\tOVERLAY_MOTION,\n\t\t\t\t\"overflow-hidden rounded-basalt-md border border-basalt-border bg-basalt-popover px-3 py-1.5 text-sm text-basalt-popover-foreground shadow-md\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t</TooltipPrimitive.Portal>\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n"],"mappings":";;;;;;;AAgBA,IAAa,IAAkB,EAAiB,UACnC,IAAkC,EAAiB,MACnD,IAAiB,EAAiB,SAElC,IAAiB,EAAM,YAGjC,EAAE,cAAW,gBAAa,GAAG,GAAG,KAAS,MAC3C,kBAAC,EAAiB,QAAlB,EAAA,UACC,kBAAC,EAAiB,SAAlB;CACM;CACO;CACZ,WAAW,EACV,GACA,GACA,gJACA,CACD;CACA,GAAI;AACJ,CAAA,EACuB,CAAA,CACzB;AACD,EAAe,cAAc,EAAiB,QAAQ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { type InputSize } from "./input.js";
|
|
3
|
+
export type TypeaheadItem = {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function TypeaheadField({ items, value, defaultValue, onValueChange, name, placeholder, disabled, loading, size, className, id, allowFreeform, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, onBlur, ...rest }: {
|
|
9
|
+
items: TypeaheadItem[];
|
|
10
|
+
value?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
onValueChange?: (value: string) => void;
|
|
13
|
+
name?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
size?: InputSize;
|
|
18
|
+
className?: string;
|
|
19
|
+
id?: string;
|
|
20
|
+
allowFreeform: boolean;
|
|
21
|
+
"aria-label"?: string;
|
|
22
|
+
"aria-describedby"?: string;
|
|
23
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling";
|
|
24
|
+
} & Omit<ComponentPropsWithoutRef<"div">, "children" | "defaultValue" | "onChange">): import("react").JSX.Element;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { overlayItemClass as t, overlayPanelClass as n } from "./overlay.js";
|
|
4
|
+
import { Input as r } from "./input.js";
|
|
5
|
+
import { useEffect as i, useId as a, useRef as o, useState as s } from "react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/typeahead-field.tsx
|
|
8
|
+
function u({ items: u, value: p, defaultValue: m = "", onValueChange: h, name: g, placeholder: _ = "Select…", disabled: v = !1, loading: y = !1, size: b = "default", className: x, id: S, allowFreeform: C, "aria-label": w, "aria-describedby": T, "aria-invalid": E, onBlur: D, ...O }) {
|
|
9
|
+
let [k, A] = s(m), j = p ?? k, [M, N] = s(d(u, j)), [P, F] = s(p), [I, L] = s(!1), [R, z] = s(null), B = a(), V = o(null), H = o(!1);
|
|
10
|
+
p !== P && (F(p), p === void 0 ? P !== void 0 && (A(P), N(d(u, P))) : N(d(u, p)));
|
|
11
|
+
let U = d(u, j), [W, G] = s(U);
|
|
12
|
+
U !== W && (G(U), (!I || M === W) && N(U)), i(() => {
|
|
13
|
+
let e = V.current?.form;
|
|
14
|
+
if (!e) return;
|
|
15
|
+
let t = (e) => {
|
|
16
|
+
queueMicrotask(() => {
|
|
17
|
+
e.defaultPrevented || (p === void 0 ? (A(m), N(d(u, m))) : N(d(u, p)), L(!1), z(null));
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
21
|
+
}, [
|
|
22
|
+
m,
|
|
23
|
+
u,
|
|
24
|
+
p
|
|
25
|
+
]);
|
|
26
|
+
let K = f(u, M, !C), q = R === null || K.length === 0 ? null : Math.min(R, K.length - 1), J = q === null ? void 0 : K[q], Y = I && K.length > 0, X = v || y;
|
|
27
|
+
i(() => {
|
|
28
|
+
if (!I) return;
|
|
29
|
+
let e = f(u, M, !C).length;
|
|
30
|
+
z((t) => t === null || e === 0 ? null : Math.min(t, e - 1));
|
|
31
|
+
}, [
|
|
32
|
+
C,
|
|
33
|
+
u,
|
|
34
|
+
I,
|
|
35
|
+
M
|
|
36
|
+
]);
|
|
37
|
+
function Z(e, t) {
|
|
38
|
+
p === void 0 ? (A(e), N(t)) : N(d(u, p)), L(!1), z(null), h?.(e), V.current && document.activeElement !== V.current && (H.current = !0, V.current.focus());
|
|
39
|
+
}
|
|
40
|
+
function Q(e) {
|
|
41
|
+
e.disabled || Z(e.value, e.label);
|
|
42
|
+
}
|
|
43
|
+
function $(e) {
|
|
44
|
+
let t = e.trim(), n = u.find((e) => !e.disabled && (e.label.toLowerCase() === t.toLowerCase() || e.value === t));
|
|
45
|
+
if (n) {
|
|
46
|
+
Q(n);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
Z(t, t);
|
|
50
|
+
}
|
|
51
|
+
return i(() => {
|
|
52
|
+
if (!I) return;
|
|
53
|
+
let e = (e) => {
|
|
54
|
+
e.key !== "Escape" || e.isComposing || (e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), L(!1), N(d(u, j)), z(null));
|
|
55
|
+
};
|
|
56
|
+
return window.addEventListener("keydown", e, !0), document.addEventListener("keydown", e, !0), () => {
|
|
57
|
+
window.removeEventListener("keydown", e, !0), document.removeEventListener("keydown", e, !0);
|
|
58
|
+
};
|
|
59
|
+
}, [
|
|
60
|
+
u,
|
|
61
|
+
I,
|
|
62
|
+
j
|
|
63
|
+
]), /* @__PURE__ */ l("div", {
|
|
64
|
+
...O,
|
|
65
|
+
className: e("relative w-full", x),
|
|
66
|
+
onBlur: (e) => {
|
|
67
|
+
if (D?.(e), !e.currentTarget.contains(e.relatedTarget)) {
|
|
68
|
+
if (C) {
|
|
69
|
+
if (M.trim() !== d(u, j)) {
|
|
70
|
+
$(M);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
} else N(d(u, j));
|
|
74
|
+
L(!1), z(null);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
children: [
|
|
78
|
+
g ? /* @__PURE__ */ c("input", {
|
|
79
|
+
type: "hidden",
|
|
80
|
+
name: g,
|
|
81
|
+
value: j,
|
|
82
|
+
disabled: X
|
|
83
|
+
}) : null,
|
|
84
|
+
/* @__PURE__ */ c(r, {
|
|
85
|
+
ref: V,
|
|
86
|
+
id: S,
|
|
87
|
+
value: M,
|
|
88
|
+
disabled: X,
|
|
89
|
+
size: b,
|
|
90
|
+
"aria-busy": y || void 0,
|
|
91
|
+
"aria-invalid": E,
|
|
92
|
+
"aria-describedby": T,
|
|
93
|
+
onChange: (e) => {
|
|
94
|
+
N(e.target.value), L(!0), z(null);
|
|
95
|
+
},
|
|
96
|
+
onFocus: () => {
|
|
97
|
+
if (!X) {
|
|
98
|
+
if (H.current) {
|
|
99
|
+
H.current = !1;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
z(null), L(!0);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
onClick: () => {
|
|
106
|
+
X || (I || z(null), L(!0));
|
|
107
|
+
},
|
|
108
|
+
onKeyDown: (e) => {
|
|
109
|
+
if (!(e.nativeEvent.isComposing || e.key === "Process")) {
|
|
110
|
+
if (e.key === "ArrowDown") {
|
|
111
|
+
if (e.preventDefault(), L(!0), K.length === 0) {
|
|
112
|
+
z(null);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
z((e) => e === null ? 0 : (e + 1) % K.length);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (e.key === "ArrowUp") {
|
|
119
|
+
if (e.preventDefault(), L(!0), K.length === 0) {
|
|
120
|
+
z(null);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
z((e) => e === null ? K.length - 1 : (e - 1 + K.length) % K.length);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (e.key === "Enter") {
|
|
127
|
+
if (I && J) {
|
|
128
|
+
e.preventDefault(), Q(J);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
C && M.trim() !== d(u, j) && (e.preventDefault(), $(M));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
placeholder: _,
|
|
136
|
+
role: "combobox",
|
|
137
|
+
"aria-label": w ?? (S ? void 0 : _),
|
|
138
|
+
"aria-expanded": Y,
|
|
139
|
+
"aria-autocomplete": "list",
|
|
140
|
+
"aria-controls": Y ? B : void 0,
|
|
141
|
+
"aria-activedescendant": Y && J && q !== null ? `${B}-opt-${q}` : void 0
|
|
142
|
+
}),
|
|
143
|
+
Y ? /* @__PURE__ */ c("div", {
|
|
144
|
+
id: B,
|
|
145
|
+
role: "listbox",
|
|
146
|
+
className: n("absolute top-full z-20 mt-1 w-full"),
|
|
147
|
+
children: K.map((n, r) => /* @__PURE__ */ c("button", {
|
|
148
|
+
type: "button",
|
|
149
|
+
id: `${B}-opt-${r}`,
|
|
150
|
+
role: "option",
|
|
151
|
+
tabIndex: -1,
|
|
152
|
+
disabled: n.disabled,
|
|
153
|
+
"aria-disabled": n.disabled || void 0,
|
|
154
|
+
"aria-selected": r === q,
|
|
155
|
+
className: e(t("hover:bg-basalt-accent"), r === q && "bg-basalt-accent", n.disabled && "opacity-50"),
|
|
156
|
+
onMouseEnter: () => {
|
|
157
|
+
n.disabled || z(r);
|
|
158
|
+
},
|
|
159
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
160
|
+
onClick: () => Q(n),
|
|
161
|
+
children: n.label
|
|
162
|
+
}, `${B}-opt-${r}`))
|
|
163
|
+
}) : null
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function d(e, t) {
|
|
168
|
+
return e.find((e) => e.value === t)?.label ?? t;
|
|
169
|
+
}
|
|
170
|
+
function f(e, t, n) {
|
|
171
|
+
let r = t.trim().toLowerCase();
|
|
172
|
+
return r === "" ? n ? e : [] : e.filter((e) => e.label.toLowerCase().includes(r));
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { u as TypeaheadField };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=typeahead-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeahead-field.js","names":[],"sources":["../../src/components/typeahead-field.tsx"],"sourcesContent":["import { type ComponentPropsWithoutRef, useEffect, useId, useRef, useState } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Input, type InputSize } from \"./input\";\nimport { overlayItemClass, overlayPanelClass } from \"./overlay\";\n\nexport type TypeaheadItem = {\n\tvalue: string;\n\tlabel: string;\n\tdisabled?: boolean;\n};\n\nexport function TypeaheadField({\n\titems,\n\tvalue,\n\tdefaultValue = \"\",\n\tonValueChange,\n\tname,\n\tplaceholder = \"Select…\",\n\tdisabled = false,\n\tloading = false,\n\tsize = \"default\",\n\tclassName,\n\tid,\n\tallowFreeform,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\t\"aria-invalid\": ariaInvalid,\n\tonBlur,\n\t...rest\n}: {\n\titems: TypeaheadItem[];\n\tvalue?: string;\n\tdefaultValue?: string;\n\tonValueChange?: (value: string) => void;\n\tname?: string;\n\tplaceholder?: string;\n\tdisabled?: boolean;\n\tloading?: boolean;\n\tsize?: InputSize;\n\tclassName?: string;\n\tid?: string;\n\tallowFreeform: boolean;\n\t\"aria-label\"?: string;\n\t\"aria-describedby\"?: string;\n\t\"aria-invalid\"?: boolean | \"true\" | \"false\" | \"grammar\" | \"spelling\";\n} & Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"defaultValue\" | \"onChange\">) {\n\tconst [uncontrolled, setUncontrolled] = useState(defaultValue);\n\tconst selected = value ?? uncontrolled;\n\tconst [query, setQuery] = useState(displayOf(items, selected));\n\tconst [prevValue, setPrevValue] = useState(value);\n\tconst [open, setOpen] = useState(false);\n\tconst [active, setActive] = useState<number | null>(null);\n\tconst listId = useId();\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst skipFocusOpen = useRef(false);\n\tif (value !== prevValue) {\n\t\tsetPrevValue(value);\n\t\tif (value !== undefined) {\n\t\t\tsetQuery(displayOf(items, value));\n\t\t} else if (prevValue !== undefined) {\n\t\t\tsetUncontrolled(prevValue);\n\t\t\tsetQuery(displayOf(items, prevValue));\n\t\t}\n\t}\n\tconst selectedDisplay = displayOf(items, selected);\n\tconst [prevDisplay, setPrevDisplay] = useState(selectedDisplay);\n\tif (selectedDisplay !== prevDisplay) {\n\t\tsetPrevDisplay(selectedDisplay);\n\t\tif (!open || query === prevDisplay) {\n\t\t\tsetQuery(selectedDisplay);\n\t\t}\n\t}\n\tuseEffect(() => {\n\t\tconst node = inputRef.current;\n\t\tconst form = node?.form;\n\t\tif (!form) {\n\t\t\treturn;\n\t\t}\n\t\tconst onReset = (event: Event) => {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tsetUncontrolled(defaultValue);\n\t\t\t\t\tsetQuery(displayOf(items, defaultValue));\n\t\t\t\t} else {\n\t\t\t\t\tsetQuery(displayOf(items, value));\n\t\t\t\t}\n\t\t\t\tsetOpen(false);\n\t\t\t\tsetActive(null);\n\t\t\t});\n\t\t};\n\t\tform.addEventListener(\"reset\", onReset);\n\t\treturn () => form.removeEventListener(\"reset\", onReset);\n\t}, [defaultValue, items, value]);\n\tconst filtered = filterItems(items, query, !allowFreeform);\n\tconst activeIndex =\n\t\tactive === null || filtered.length === 0 ? null : Math.min(active, filtered.length - 1);\n\tconst activeItem = activeIndex === null ? undefined : filtered[activeIndex];\n\tconst listOpen = open && filtered.length > 0;\n\tconst busy = disabled || loading;\n\n\tuseEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextLen = filterItems(items, query, !allowFreeform).length;\n\t\tsetActive((current) => {\n\t\t\tif (current === null || nextLen === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn Math.min(current, nextLen - 1);\n\t\t});\n\t}, [allowFreeform, items, open, query]);\n\n\tfunction commitValue(next: string, display: string) {\n\t\tif (value === undefined) {\n\t\t\tsetUncontrolled(next);\n\t\t\tsetQuery(display);\n\t\t} else {\n\t\t\tsetQuery(displayOf(items, value));\n\t\t}\n\t\tsetOpen(false);\n\t\tsetActive(null);\n\t\tonValueChange?.(next);\n\t\tif (inputRef.current && document.activeElement !== inputRef.current) {\n\t\t\tskipFocusOpen.current = true;\n\t\t\tinputRef.current.focus();\n\t\t}\n\t}\n\n\tfunction commitItem(item: TypeaheadItem) {\n\t\tif (item.disabled) {\n\t\t\treturn;\n\t\t}\n\t\tcommitValue(item.value, item.label);\n\t}\n\n\tfunction commitFreeform(text: string) {\n\t\tconst trimmed = text.trim();\n\t\tconst match = items.find(\n\t\t\t(item) =>\n\t\t\t\t!item.disabled &&\n\t\t\t\t(item.label.toLowerCase() === trimmed.toLowerCase() || item.value === trimmed),\n\t\t);\n\t\tif (match) {\n\t\t\tcommitItem(match);\n\t\t\treturn;\n\t\t}\n\t\tcommitValue(trimmed, trimmed);\n\t}\n\n\tuseEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tconst onKey = (event: KeyboardEvent) => {\n\t\t\tif (event.key !== \"Escape\" || event.isComposing) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tevent.stopImmediatePropagation();\n\t\t\tsetOpen(false);\n\t\t\tsetQuery(displayOf(items, selected));\n\t\t\tsetActive(null);\n\t\t};\n\t\twindow.addEventListener(\"keydown\", onKey, true);\n\t\tdocument.addEventListener(\"keydown\", onKey, true);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"keydown\", onKey, true);\n\t\t\tdocument.removeEventListener(\"keydown\", onKey, true);\n\t\t};\n\t}, [items, open, selected]);\n\n\treturn (\n\t\t<div\n\t\t\t{...rest}\n\t\t\tclassName={cn(\"relative w-full\", className)}\n\t\t\tonBlur={(event) => {\n\t\t\t\tonBlur?.(event);\n\t\t\t\tif (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n\t\t\t\t\tif (allowFreeform) {\n\t\t\t\t\t\tif (query.trim() !== displayOf(items, selected)) {\n\t\t\t\t\t\t\tcommitFreeform(query);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetQuery(displayOf(items, selected));\n\t\t\t\t\t}\n\t\t\t\t\tsetOpen(false);\n\t\t\t\t\tsetActive(null);\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t{name ? <input type=\"hidden\" name={name} value={selected} disabled={busy} /> : null}\n\t\t\t<Input\n\t\t\t\tref={inputRef}\n\t\t\t\tid={id}\n\t\t\t\tvalue={query}\n\t\t\t\tdisabled={busy}\n\t\t\t\tsize={size}\n\t\t\t\taria-busy={loading || undefined}\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\tonChange={(event) => {\n\t\t\t\t\tsetQuery(event.target.value);\n\t\t\t\t\tsetOpen(true);\n\t\t\t\t\tsetActive(null);\n\t\t\t\t}}\n\t\t\t\tonFocus={() => {\n\t\t\t\t\tif (busy) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (skipFocusOpen.current) {\n\t\t\t\t\t\tskipFocusOpen.current = false;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsetActive(null);\n\t\t\t\t\tsetOpen(true);\n\t\t\t\t}}\n\t\t\t\tonClick={() => {\n\t\t\t\t\tif (busy) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (!open) {\n\t\t\t\t\t\tsetActive(null);\n\t\t\t\t\t}\n\t\t\t\t\tsetOpen(true);\n\t\t\t\t}}\n\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\tif (event.nativeEvent.isComposing || event.key === \"Process\") {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (event.key === \"ArrowDown\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tsetOpen(true);\n\t\t\t\t\t\tif (filtered.length === 0) {\n\t\t\t\t\t\t\tsetActive(null);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetActive((current) => (current === null ? 0 : (current + 1) % filtered.length));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (event.key === \"ArrowUp\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tsetOpen(true);\n\t\t\t\t\t\tif (filtered.length === 0) {\n\t\t\t\t\t\t\tsetActive(null);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetActive((current) =>\n\t\t\t\t\t\t\tcurrent === null\n\t\t\t\t\t\t\t\t? filtered.length - 1\n\t\t\t\t\t\t\t\t: (current - 1 + filtered.length) % filtered.length,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (event.key === \"Enter\") {\n\t\t\t\t\t\tif (open && activeItem) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tcommitItem(activeItem);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (allowFreeform && query.trim() !== displayOf(items, selected)) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tcommitFreeform(query);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\trole=\"combobox\"\n\t\t\t\taria-label={ariaLabel ?? (id ? undefined : placeholder)}\n\t\t\t\taria-expanded={listOpen}\n\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\taria-controls={listOpen ? listId : undefined}\n\t\t\t\taria-activedescendant={\n\t\t\t\t\tlistOpen && activeItem && activeIndex !== null\n\t\t\t\t\t\t? `${listId}-opt-${activeIndex}`\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{listOpen ? (\n\t\t\t\t<div\n\t\t\t\t\tid={listId}\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\tclassName={overlayPanelClass(\"absolute top-full z-20 mt-1 w-full\")}\n\t\t\t\t>\n\t\t\t\t\t{filtered.map((item, index) => (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tkey={`${listId}-opt-${index}`}\n\t\t\t\t\t\t\tid={`${listId}-opt-${index}`}\n\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\tdisabled={item.disabled}\n\t\t\t\t\t\t\taria-disabled={item.disabled || undefined}\n\t\t\t\t\t\t\taria-selected={index === activeIndex}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\toverlayItemClass(\"hover:bg-basalt-accent\"),\n\t\t\t\t\t\t\t\tindex === activeIndex && \"bg-basalt-accent\",\n\t\t\t\t\t\t\t\titem.disabled && \"opacity-50\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonMouseEnter={() => {\n\t\t\t\t\t\t\t\tif (!item.disabled) {\n\t\t\t\t\t\t\t\t\tsetActive(index);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonMouseDown={(event) => event.preventDefault()}\n\t\t\t\t\t\t\tonClick={() => commitItem(item)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nfunction displayOf(items: TypeaheadItem[], value: string) {\n\treturn items.find((item) => item.value === value)?.label ?? value;\n}\n\nfunction filterItems(items: TypeaheadItem[], query: string, showAllWhenEmpty: boolean) {\n\tconst needle = query.trim().toLowerCase();\n\tif (needle === \"\") {\n\t\treturn showAllWhenEmpty ? items : [];\n\t}\n\treturn items.filter((item) => item.label.toLowerCase().includes(needle));\n}\n"],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "./components/alert-dialog.js";
|
|
2
|
+
export { Avatar, AvatarFallback, AvatarImage } from "./components/avatar.js";
|
|
3
|
+
export { Badge } from "./components/badge.js";
|
|
4
|
+
export { Button } from "./components/button.js";
|
|
5
|
+
export { Checkbox } from "./components/checkbox.js";
|
|
6
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
|
|
7
|
+
export { CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandPalette, CommandPaletteTrigger, CommandSeparator, CommandShortcut, } from "./components/command-palette.js";
|
|
8
|
+
export { ConfirmDialog, useConfirm } from "./components/confirm-dialog.js";
|
|
9
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./components/dialog.js";
|
|
10
|
+
export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./components/dropdown-menu.js";
|
|
11
|
+
export { Field } from "./components/field.js";
|
|
12
|
+
export { Input } from "./components/input.js";
|
|
13
|
+
export { Label } from "./components/label.js";
|
|
14
|
+
export { LayerCard } from "./components/layer-card.js";
|
|
15
|
+
export { Link } from "./components/link.js";
|
|
16
|
+
export { Meter } from "./components/meter.js";
|
|
17
|
+
export { Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, } from "./components/popover.js";
|
|
18
|
+
export { ScrollArea } from "./components/scroll-area.js";
|
|
19
|
+
export { SegmentControl } from "./components/segment-control.js";
|
|
20
|
+
export { Separator } from "./components/separator.js";
|
|
21
|
+
export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, } from "./components/sheet.js";
|
|
22
|
+
export { ContentIsland, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarIconItem, SidebarItem, SidebarNav, SidebarPartition, SidebarProvider, SidebarSearch, SidebarUser, } from "./components/sidebar.js";
|
|
23
|
+
export { StatStrip } from "./components/stat-strip.js";
|
|
24
|
+
export { Switch } from "./components/switch.js";
|
|
25
|
+
export { TablePager } from "./components/table-pager.js";
|
|
26
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/tabs.js";
|
|
27
|
+
export { Text } from "./components/text.js";
|
|
28
|
+
export { ThemeToggle } from "./components/theme-toggle.js";
|
|
29
|
+
export { Toast, Toaster, toast } from "./components/toast.js";
|
|
30
|
+
export { Toolbar } from "./components/toolbar.js";
|
|
31
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
|
|
32
|
+
export { LinkProvider } from "./providers/link.js";
|
|
33
|
+
export { ThemeProvider } from "./providers/theme.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "./components/button.js";
|
|
3
|
+
import { Dialog as t, DialogClose as n, DialogContent as r, DialogDescription as i, DialogFooter as a, DialogHeader as o, DialogTitle as s, DialogTrigger as c } from "./components/dialog.js";
|
|
4
|
+
import { AlertDialog as l, AlertDialogAction as u, AlertDialogCancel as d, AlertDialogContent as f, AlertDialogDescription as p, AlertDialogFooter as m, AlertDialogHeader as h, AlertDialogTitle as g, AlertDialogTrigger as _ } from "./components/alert-dialog.js";
|
|
5
|
+
import { Avatar as v, AvatarFallback as y, AvatarImage as b } from "./components/avatar.js";
|
|
6
|
+
import { Badge as x } from "./components/badge.js";
|
|
7
|
+
import { Checkbox as S } from "./components/checkbox.js";
|
|
8
|
+
import { Collapsible as C, CollapsibleContent as w, CollapsibleTrigger as T } from "./components/collapsible.js";
|
|
9
|
+
import { CommandEmpty as E, CommandGroup as D, CommandInput as O, CommandItem as k, CommandList as A, CommandPalette as j, CommandPaletteTrigger as M, CommandSeparator as N, CommandShortcut as P } from "./components/command-palette.js";
|
|
10
|
+
import { ConfirmDialog as F, useConfirm as I } from "./components/confirm-dialog.js";
|
|
11
|
+
import { DropdownMenu as L, DropdownMenuContent as R, DropdownMenuItem as z, DropdownMenuTrigger as B } from "./components/dropdown-menu.js";
|
|
12
|
+
import { Tooltip as V, TooltipContent as H, TooltipProvider as U, TooltipTrigger as W } from "./components/tooltip.js";
|
|
13
|
+
import { Label as G } from "./components/label.js";
|
|
14
|
+
import { Field as K } from "./components/field.js";
|
|
15
|
+
import { Input as q } from "./components/input.js";
|
|
16
|
+
import { LayerCard as J } from "./components/layer-card.js";
|
|
17
|
+
import { LinkProvider as Y } from "./providers/link.js";
|
|
18
|
+
import { Link as X } from "./components/link.js";
|
|
19
|
+
import { Meter as Z } from "./components/meter.js";
|
|
20
|
+
import { Popover as Q, PopoverClose as $, PopoverContent as ee, PopoverDescription as te, PopoverTitle as ne, PopoverTrigger as re } from "./components/popover.js";
|
|
21
|
+
import { ScrollArea as ie } from "./components/scroll-area.js";
|
|
22
|
+
import { SegmentControl as ae } from "./components/segment-control.js";
|
|
23
|
+
import { Separator as oe } from "./components/separator.js";
|
|
24
|
+
import { Sheet as se, SheetClose as ce, SheetContent as le, SheetDescription as ue, SheetFooter as de, SheetHeader as fe, SheetTitle as pe, SheetTrigger as me } from "./components/sheet.js";
|
|
25
|
+
import { ContentIsland as he, Sidebar as ge, SidebarFooter as _e, SidebarGroup as ve, SidebarHeader as ye, SidebarIconItem as be, SidebarItem as xe, SidebarNav as Se, SidebarPartition as Ce, SidebarProvider as we, SidebarSearch as Te, SidebarUser as Ee } from "./components/sidebar.js";
|
|
26
|
+
import { StatStrip as De } from "./components/stat-strip.js";
|
|
27
|
+
import { Switch as Oe } from "./components/switch.js";
|
|
28
|
+
import { TablePager as ke } from "./components/table-pager.js";
|
|
29
|
+
import { Tabs as Ae, TabsContent as je, TabsList as Me, TabsTrigger as Ne } from "./components/tabs.js";
|
|
30
|
+
import { Text as Pe } from "./components/text.js";
|
|
31
|
+
import { ThemeProvider as Fe } from "./providers/theme.js";
|
|
32
|
+
import { ThemeToggle as Ie } from "./components/theme-toggle.js";
|
|
33
|
+
import { Toast as Le, Toaster as Re, toast as ze } from "./components/toast.js";
|
|
34
|
+
import { Toolbar as Be } from "./components/toolbar.js";
|
|
35
|
+
export { l as AlertDialog, u as AlertDialogAction, d as AlertDialogCancel, f as AlertDialogContent, p as AlertDialogDescription, m as AlertDialogFooter, h as AlertDialogHeader, g as AlertDialogTitle, _ as AlertDialogTrigger, v as Avatar, y as AvatarFallback, b as AvatarImage, x as Badge, e as Button, S as Checkbox, C as Collapsible, w as CollapsibleContent, T as CollapsibleTrigger, E as CommandEmpty, D as CommandGroup, O as CommandInput, k as CommandItem, A as CommandList, j as CommandPalette, M as CommandPaletteTrigger, N as CommandSeparator, P as CommandShortcut, F as ConfirmDialog, he as ContentIsland, t as Dialog, n as DialogClose, r as DialogContent, i as DialogDescription, a as DialogFooter, o as DialogHeader, s as DialogTitle, c as DialogTrigger, L as DropdownMenu, R as DropdownMenuContent, z as DropdownMenuItem, B as DropdownMenuTrigger, K as Field, q as Input, G as Label, J as LayerCard, X as Link, Y as LinkProvider, Z as Meter, Q as Popover, $ as PopoverClose, ee as PopoverContent, te as PopoverDescription, ne as PopoverTitle, re as PopoverTrigger, ie as ScrollArea, ae as SegmentControl, oe as Separator, se as Sheet, ce as SheetClose, le as SheetContent, ue as SheetDescription, de as SheetFooter, fe as SheetHeader, pe as SheetTitle, me as SheetTrigger, ge as Sidebar, _e as SidebarFooter, ve as SidebarGroup, ye as SidebarHeader, be as SidebarIconItem, xe as SidebarItem, Se as SidebarNav, Ce as SidebarPartition, we as SidebarProvider, Te as SidebarSearch, Ee as SidebarUser, De as StatStrip, Oe as Switch, ke as TablePager, Ae as Tabs, je as TabsContent, Me as TabsList, Ne as TabsTrigger, Pe as Text, Fe as ThemeProvider, Ie as ThemeToggle, Le as Toast, Re as Toaster, Be as Toolbar, V as Tooltip, H as TooltipContent, U as TooltipProvider, W as TooltipTrigger, ze as toast, I as useConfirm };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from "react";
|
|
2
|
+
type LinkComponent = ComponentType<{
|
|
3
|
+
href: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function LinkProvider({ render, children, }: {
|
|
8
|
+
render?: LinkComponent;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
export declare function useLinkComponent(): "a" | LinkComponent;
|
|
12
|
+
export {};
|