@boyernick/standard-ui-react 0.1.1-canary.10 → 0.1.1-canary.11
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/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/kbd.tsx +6 -3
- package/src/menubar.tsx +5 -0
- package/src/navigation-menu.tsx +6 -1
- package/src/progress.tsx +5 -0
- package/src/tooltip.tsx +30 -7
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/kbd.tsx
CHANGED
|
@@ -11,9 +11,12 @@ const kbdVariants = cva(
|
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
13
13
|
default: "border-border-primary bg-background-tertiary text-fg-secondary",
|
|
14
|
-
// The default fill is a light grey that vanishes on a dark surface,
|
|
15
|
-
//
|
|
16
|
-
|
|
14
|
+
// The default fill is a light grey that vanishes on a dark surface, so
|
|
15
|
+
// an inverted keycap tints with the inverted foreground instead. It has
|
|
16
|
+
// to be that token rather than a literal `white`: the grey ramp flips
|
|
17
|
+
// under `.dark`, so a hardcoded white wash would sit invisibly on the
|
|
18
|
+
// now-light inverted surface.
|
|
19
|
+
inverted: "border-fg-inverted/10 bg-fg-inverted/10 text-fg-inverted",
|
|
17
20
|
},
|
|
18
21
|
size: {
|
|
19
22
|
sm: "h-4 min-w-3.5 rounded-2xs",
|
package/src/menubar.tsx
CHANGED
|
@@ -10,6 +10,11 @@ export const Menubar = ({ className, ...props }: MenubarProps) => (
|
|
|
10
10
|
<BaseMenubar
|
|
11
11
|
className={cn(
|
|
12
12
|
"inline-flex items-center gap-0.5 rounded-lg border border-border-primary bg-background-secondary p-0.5",
|
|
13
|
+
// Base UI sets data-orientation and handles the arrow keys, but the
|
|
14
|
+
// layout is ours: without this a vertical menubar still renders as a
|
|
15
|
+
// row, so the prop looks supported and does nothing.
|
|
16
|
+
"data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",
|
|
17
|
+
"data-[orientation=vertical]:[&_button]:justify-start",
|
|
13
18
|
"[&_button]:inline-flex [&_button]:h-8 [&_button]:cursor-pointer [&_button]:items-center [&_button]:justify-center [&_button]:gap-1.5 [&_button]:rounded-md [&_button]:px-2.5 [&_button]:text-sm [&_button]:text-fg-secondary [&_button]:outline-none",
|
|
14
19
|
"[&_button]:hover:bg-background-tertiary [&_button]:hover:text-fg-primary",
|
|
15
20
|
"[&_button]:focus-visible:border-ring [&_button]:focus-visible:ring-[3px] [&_button]:focus-visible:ring-offset-1 [&_button]:focus-visible:ring-offset-background-primary [&_button]:focus-visible:ring-ring/20",
|
package/src/navigation-menu.tsx
CHANGED
|
@@ -46,7 +46,12 @@ export type NavigationMenuIconProps = ComponentProps<
|
|
|
46
46
|
>
|
|
47
47
|
|
|
48
48
|
const navigationMenuTriggerClassName = cn(
|
|
49
|
-
|
|
49
|
+
// flex-row and py-0 are here for the link case. This class is exported so
|
|
50
|
+
// a plain link can sit in the bar beside real triggers, but Link's own
|
|
51
|
+
// base is flex-col with p-2.5 — without overriding the direction and the
|
|
52
|
+
// vertical padding, tailwind-merge leaves both, and the link renders as a
|
|
53
|
+
// top-padded column whose text sits below the triggers next to it.
|
|
54
|
+
"inline-flex h-9 cursor-pointer flex-row items-center gap-1 rounded-md px-3 py-0 text-sm text-fg-secondary outline-none",
|
|
50
55
|
motion.colors,
|
|
51
56
|
"hover:bg-background-tertiary hover:text-fg-primary focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20 data-popup-open:bg-background-tertiary data-popup-open:text-fg-primary",
|
|
52
57
|
)
|
package/src/progress.tsx
CHANGED
|
@@ -53,6 +53,11 @@ export const ProgressIndicator = ({
|
|
|
53
53
|
<BaseProgress.Indicator
|
|
54
54
|
className={cn(
|
|
55
55
|
"h-full rounded-full bg-brand-primary transition-[width] duration-[var(--duration-lg)] ease-enter motion-reduce:transition-none",
|
|
56
|
+
// Base UI flags a null value with data-indeterminate and leaves the
|
|
57
|
+
// indicator full width, so without this the bar reads as complete.
|
|
58
|
+
// A quarter-width stripe crossing the track on the passive curve —
|
|
59
|
+
// ambient, system-initiated movement.
|
|
60
|
+
"data-indeterminate:w-1/4 data-indeterminate:animate-[progress-indeterminate_1.4s_var(--ease-passive)_infinite] motion-reduce:animate-none",
|
|
56
61
|
className,
|
|
57
62
|
)}
|
|
58
63
|
{...props}
|
package/src/tooltip.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip"
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
5
|
import type { ComponentProps } from "react"
|
|
5
6
|
import { cn } from "./lib/cn"
|
|
6
7
|
import { motion } from "./lib/motion"
|
|
@@ -12,7 +13,8 @@ export type TooltipPortalProps = ComponentProps<typeof BaseTooltip.Portal>
|
|
|
12
13
|
export type TooltipPositionerProps = ComponentProps<
|
|
13
14
|
typeof BaseTooltip.Positioner
|
|
14
15
|
>
|
|
15
|
-
export type TooltipPopupProps = ComponentProps<typeof BaseTooltip.Popup>
|
|
16
|
+
export type TooltipPopupProps = ComponentProps<typeof BaseTooltip.Popup> &
|
|
17
|
+
VariantProps<typeof tooltipPopupVariants>
|
|
16
18
|
|
|
17
19
|
export const TooltipProvider = (props: TooltipProviderProps) => (
|
|
18
20
|
<BaseTooltip.Provider {...props} />
|
|
@@ -43,13 +45,34 @@ export const TooltipPositioner = ({
|
|
|
43
45
|
/>
|
|
44
46
|
)
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
// `shadow-md` already composes `--elevation-hairline`, so neither variant
|
|
49
|
+
// needs a border — the light one would otherwise stack a second edge.
|
|
50
|
+
const tooltipPopupVariants = cva(
|
|
51
|
+
"z-50 max-w-xs rounded-md px-2.5 py-1 text-xs shadow-md outline-none",
|
|
52
|
+
{
|
|
53
|
+
variants: {
|
|
54
|
+
variant: {
|
|
55
|
+
// Dark on light is the conventional tooltip, and stays the default so
|
|
56
|
+
// existing consumers are unaffected.
|
|
57
|
+
inverted: "bg-surface-inverted text-fg-inverted",
|
|
58
|
+
// For tooltips over dark or busy surfaces, where an inverted popup
|
|
59
|
+
// would sink into its background instead of lifting off it.
|
|
60
|
+
light: "bg-surface text-fg-primary",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: { variant: "inverted" },
|
|
64
|
+
},
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
export const TooltipPopup = ({
|
|
68
|
+
className,
|
|
69
|
+
variant,
|
|
70
|
+
...props
|
|
71
|
+
}: TooltipPopupProps) => (
|
|
47
72
|
<BaseTooltip.Popup
|
|
48
|
-
className={cn(
|
|
49
|
-
"z-50 max-w-xs rounded-md bg-surface-inverted px-2.5 py-1 text-xs text-fg-inverted shadow-md outline-none",
|
|
50
|
-
motion.popupAnchor,
|
|
51
|
-
className,
|
|
52
|
-
)}
|
|
73
|
+
className={cn(tooltipPopupVariants({ variant }), motion.popupAnchor, className)}
|
|
53
74
|
{...props}
|
|
54
75
|
/>
|
|
55
76
|
)
|
|
77
|
+
|
|
78
|
+
export { tooltipPopupVariants }
|