@vitavision/ui 0.14.0 → 0.14.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/README.md +1 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +40 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ui/ShortcutList.tsx +74 -0
- package/src/components/ui/index.ts +1 -0
package/README.md
CHANGED
|
@@ -130,7 +130,7 @@ deprecated) · `Breakdown`, `breakdownText` (counts by verdict as one thin stack
|
|
|
130
130
|
`unit` written in the field; number-valued with `onValueChange`), `Textarea` (optionally growing
|
|
131
131
|
with its content between `minRows` and `maxRows`) · `HighlightedText`, `findSpans` (a string
|
|
132
132
|
with its placeholders, tags and terms marked, never parsed as HTML) · `VectorInput`,
|
|
133
|
-
`PoseInput` · `Kbd` · `Listbox` (single choice among options that render their own content) ·
|
|
133
|
+
`PoseInput` · `Kbd`, `ShortcutList` (a screen's keyboard shortcuts as titled groups, for a `?` help dialog) · `Listbox` (single choice among options that render their own content) ·
|
|
134
134
|
`PageHeader`, `Panel`, `ReadoutStrip`, `Section` · `Popover`, `PopoverClose` ·
|
|
135
135
|
`SegmentedControl` · `Select` · `Slider` · `Table` (with `windowed` for thousands of rows, and `selectionFollowsFocus` for keyboard selection) ·
|
|
136
136
|
`Checkbox`, `Switch` · `ToggleChip` · `Toaster`, `toast()` (notifications from anywhere; mount one `<Toaster />` near the root) ·
|
package/dist/index.d.ts
CHANGED
|
@@ -1128,6 +1128,39 @@ export declare function Select({ value, onValueChange, options, placeholder, uns
|
|
|
1128
1128
|
className?: string | undefined;
|
|
1129
1129
|
}): import("react").JSX.Element;
|
|
1130
1130
|
//#endregion
|
|
1131
|
+
//#region src/components/ui/ShortcutList.d.ts
|
|
1132
|
+
/** One command and the keys that run it. */
|
|
1133
|
+
interface Shortcut {
|
|
1134
|
+
/**
|
|
1135
|
+
* The keys, as the keyboard labels them: each entry is one key or chord (`J`, `⇧ click`,
|
|
1136
|
+
* `⌘K`), and several distinct entries are alternatives (`["J", "↓"]` reads "J or ↓").
|
|
1137
|
+
*/
|
|
1138
|
+
keys: readonly string[];
|
|
1139
|
+
/** What it does, as a short phrase ("Next tile"), unique within its group. */
|
|
1140
|
+
description: string;
|
|
1141
|
+
}
|
|
1142
|
+
/** A titled group of shortcuts ("Navigation", "Flags"). */
|
|
1143
|
+
interface ShortcutGroup {
|
|
1144
|
+
/** The group's heading, unique within the list. */
|
|
1145
|
+
title: string;
|
|
1146
|
+
/** Its shortcuts, in the order they should read. */
|
|
1147
|
+
shortcuts: readonly Shortcut[];
|
|
1148
|
+
}
|
|
1149
|
+
/** Props of `ShortcutList`. */
|
|
1150
|
+
type ShortcutListProps = Omit<ComponentProps<"div">, "children"> & {
|
|
1151
|
+
/** The groups, in the order they should read. Empty groups are left out. */
|
|
1152
|
+
groups: readonly ShortcutGroup[];
|
|
1153
|
+
};
|
|
1154
|
+
/**
|
|
1155
|
+
* The keyboard shortcuts of a screen as titled groups: each row a command's keys, as `Kbd`
|
|
1156
|
+
* caps, beside what it does. Groups flow into two columns where there is room.
|
|
1157
|
+
*
|
|
1158
|
+
* It only lists: binding the keys is the app's. Put it in a `Dialog` for a `?` help, or in a
|
|
1159
|
+
* panel. Each group is a `<section>` labelled by its heading, and its rows are a description
|
|
1160
|
+
* list, so a screen reader announces "J or ↓, Next tile".
|
|
1161
|
+
*/
|
|
1162
|
+
export declare function ShortcutList({ groups, className, ...rest }: ShortcutListProps): import("react").JSX.Element;
|
|
1163
|
+
//#endregion
|
|
1131
1164
|
//#region src/components/ui/Slider.d.ts
|
|
1132
1165
|
/**
|
|
1133
1166
|
* A continuous value, with its number rendered beside the track.
|
|
@@ -1659,5 +1692,5 @@ export declare function Tabs<Id extends string>({ items, active, onSelect, label
|
|
|
1659
1692
|
className?: string | undefined;
|
|
1660
1693
|
}): import("react").JSX.Element;
|
|
1661
1694
|
//#endregion
|
|
1662
|
-
export type { BackLink, BreakdownProps, BreakdownSegment, BreakdownTextOptions, BreakdownTone, ButtonSize, ButtonVariant, CalloutTone, Column, Density, DropdownMenuProps, HighlightKind, HighlightRule, HighlightSpan, HighlightedTextProps, ListboxOption, ListboxOptionState, ListboxProps, MeasureTone, MenuCheckboxItemProps, MenuItemProps, NumberInputProps, PopoverProps, PoseInputProps, PoseValue, ProgressProps, Quaternion, ReadoutItem, RotationView, SelectOption, SortDirection, TabItem, TableSort, TableWindowing, TextareaProps, ThemeChoice, ToastOptions, ToastRecord, ToastStore, ToastTone, ToasterProps, Tone, Vec3, VectorInputProps };
|
|
1695
|
+
export type { BackLink, BreakdownProps, BreakdownSegment, BreakdownTextOptions, BreakdownTone, ButtonSize, ButtonVariant, CalloutTone, Column, Density, DropdownMenuProps, HighlightKind, HighlightRule, HighlightSpan, HighlightedTextProps, ListboxOption, ListboxOptionState, ListboxProps, MeasureTone, MenuCheckboxItemProps, MenuItemProps, NumberInputProps, PopoverProps, PoseInputProps, PoseValue, ProgressProps, Quaternion, ReadoutItem, RotationView, SelectOption, Shortcut, ShortcutGroup, ShortcutListProps, SortDirection, TabItem, TableSort, TableWindowing, TextareaProps, ThemeChoice, ToastOptions, ToastRecord, ToastStore, ToastTone, ToasterProps, Tone, Vec3, VectorInputProps };
|
|
1663
1696
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AlertTriangle, ArrowDown, ArrowUp, ArrowUpDown, Check, CheckCircle2, ChevronDown, ChevronRight, CircleCheck, CircleX, HelpCircle, Info, Loader2, Minus, Moon, Sun, SunMoon, TriangleAlert, X, XCircle } from "lucide-react";
|
|
2
|
-
import { createContext, isValidElement, use, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { Fragment, createContext, isValidElement, use, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import * as RadixTooltip from "@radix-ui/react-tooltip";
|
|
4
4
|
import { clsx } from "clsx";
|
|
5
5
|
import { twMerge } from "tailwind-merge";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
8
8
|
import * as RadixDialog from "@radix-ui/react-dialog";
|
|
9
9
|
import * as RadixMenu from "@radix-ui/react-dropdown-menu";
|
|
@@ -600,7 +600,7 @@ function ConfirmDialog({ open, onOpenChange, title, description, confirmLabel, o
|
|
|
600
600
|
title,
|
|
601
601
|
description,
|
|
602
602
|
className,
|
|
603
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(RadixDialog.Close, {
|
|
603
|
+
footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RadixDialog.Close, {
|
|
604
604
|
asChild: true,
|
|
605
605
|
children: /* @__PURE__ */ jsx(Button, {
|
|
606
606
|
variant: "ghost",
|
|
@@ -929,7 +929,7 @@ function Field({ label, description, error, required = false, annotation, as = "
|
|
|
929
929
|
hasError
|
|
930
930
|
]);
|
|
931
931
|
const gap = byDensity(density, "gap-1.5", "gap-1");
|
|
932
|
-
const labelled = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
932
|
+
const labelled = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
933
933
|
className: "flex items-baseline gap-2",
|
|
934
934
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
935
935
|
className: cn("font-medium text-fg", byDensity(density, "text-xs", "text-[11px]")),
|
|
@@ -1989,6 +1989,41 @@ function SelectItem({ value, label, note, disabled, muted = false }) {
|
|
|
1989
1989
|
});
|
|
1990
1990
|
}
|
|
1991
1991
|
//#endregion
|
|
1992
|
+
//#region src/components/ui/ShortcutList.tsx
|
|
1993
|
+
/**
|
|
1994
|
+
* The keyboard shortcuts of a screen as titled groups: each row a command's keys, as `Kbd`
|
|
1995
|
+
* caps, beside what it does. Groups flow into two columns where there is room.
|
|
1996
|
+
*
|
|
1997
|
+
* It only lists: binding the keys is the app's. Put it in a `Dialog` for a `?` help, or in a
|
|
1998
|
+
* panel. Each group is a `<section>` labelled by its heading, and its rows are a description
|
|
1999
|
+
* list, so a screen reader announces "J or ↓, Next tile".
|
|
2000
|
+
*/
|
|
2001
|
+
function ShortcutList({ groups, className, ...rest }) {
|
|
2002
|
+
const baseId = useId();
|
|
2003
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2004
|
+
...rest,
|
|
2005
|
+
className: cn("grid gap-x-8 gap-y-4 sm:grid-cols-2", className),
|
|
2006
|
+
children: groups.map((group, g) => group.shortcuts.length === 0 ? null : /* @__PURE__ */ jsxs("section", {
|
|
2007
|
+
"aria-labelledby": `${baseId}-${g}`,
|
|
2008
|
+
className: "min-w-0",
|
|
2009
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
2010
|
+
id: `${baseId}-${g}`,
|
|
2011
|
+
className: "mb-1.5 text-[11px] font-semibold tracking-wider text-fg-muted uppercase",
|
|
2012
|
+
children: group.title
|
|
2013
|
+
}), /* @__PURE__ */ jsx("dl", {
|
|
2014
|
+
className: "grid grid-cols-[auto_1fr] items-baseline gap-x-3 gap-y-1 text-sm",
|
|
2015
|
+
children: group.shortcuts.map((shortcut) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", {
|
|
2016
|
+
className: "flex flex-wrap items-center gap-1 text-xs text-fg-muted",
|
|
2017
|
+
children: shortcut.keys.map((key, k) => /* @__PURE__ */ jsxs(Fragment, { children: [k > 0 && /* @__PURE__ */ jsx("span", { children: "or" }), /* @__PURE__ */ jsx(Kbd, { children: key })] }, key))
|
|
2018
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
2019
|
+
className: "text-fg",
|
|
2020
|
+
children: shortcut.description
|
|
2021
|
+
})] }, shortcut.description))
|
|
2022
|
+
})]
|
|
2023
|
+
}, group.title))
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
//#endregion
|
|
1992
2027
|
//#region src/components/ui/Slider.tsx
|
|
1993
2028
|
/**
|
|
1994
2029
|
* A continuous value, with its number rendered beside the track.
|
|
@@ -2852,6 +2887,6 @@ function Tabs({ items, active, onSelect, label, idPrefix, className }) {
|
|
|
2852
2887
|
});
|
|
2853
2888
|
}
|
|
2854
2889
|
//#endregion
|
|
2855
|
-
export { Badge, Breakdown, Button, ButtonLink, Callout, Checkbox, ConfirmDialog, CountRun, DEFAULT_THEME_STORAGE_KEY, DensityProvider, Dialog, DialogClose, Disclosure, DropdownMenu, Empty, ErrorBox, Field, HighlightedText, InfoHint, Input, Kbd, Listbox, MenuCheckboxItem, MenuItem, MenuLabel, MenuSeparator, NumberInput, PageHeader, Panel, Popover, PopoverClose, PoseInput, Progress, ProgressBar, ReadoutStrip, Section, SegmentedControl, Select, Skeleton, SkeletonRows, Slider, StatusDot, Switch, Table, Tabs, Textarea, ThemeToggle, Toaster, ToggleChip, Tooltip, TooltipProvider, VectorInput, breakdownText, buttonClasses, byDensity, cn, controlClasses, createToastStore, defaultToastStore, findSpans, focusRing, focusRingInset, formatNumber, initTheme, inputClasses, parseNumber, progressText, readThemeChoice, resolveTheme, setThemeChoice, sortRows, toast, toneColor, useControlHeight, useDensity };
|
|
2890
|
+
export { Badge, Breakdown, Button, ButtonLink, Callout, Checkbox, ConfirmDialog, CountRun, DEFAULT_THEME_STORAGE_KEY, DensityProvider, Dialog, DialogClose, Disclosure, DropdownMenu, Empty, ErrorBox, Field, HighlightedText, InfoHint, Input, Kbd, Listbox, MenuCheckboxItem, MenuItem, MenuLabel, MenuSeparator, NumberInput, PageHeader, Panel, Popover, PopoverClose, PoseInput, Progress, ProgressBar, ReadoutStrip, Section, SegmentedControl, Select, ShortcutList, Skeleton, SkeletonRows, Slider, StatusDot, Switch, Table, Tabs, Textarea, ThemeToggle, Toaster, ToggleChip, Tooltip, TooltipProvider, VectorInput, breakdownText, buttonClasses, byDensity, cn, controlClasses, createToastStore, defaultToastStore, findSpans, focusRing, focusRingInset, formatNumber, initTheme, inputClasses, parseNumber, progressText, readThemeChoice, resolveTheme, setThemeChoice, sortRows, toast, toneColor, useControlHeight, useDensity };
|
|
2856
2891
|
|
|
2857
2892
|
//# sourceMappingURL=index.js.map
|