@dinachi/cli 0.10.0 → 0.12.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/CHANGELOG.md +73 -0
- package/dist/index.js +12 -3
- package/package.json +2 -2
- package/templates/accordion/accordion.tsx +4 -5
- package/templates/alert-dialog/alert-dialog.tsx +9 -2
- package/templates/autocomplete/autocomplete.tsx +6 -4
- package/templates/avatar/avatar.tsx +5 -2
- package/templates/button/button.tsx +19 -2
- package/templates/collapsible/collapsible.tsx +3 -7
- package/templates/combobox/combobox.tsx +8 -4
- package/templates/combobox/index.ts +1 -0
- package/templates/context-menu/context-menu.tsx +10 -6
- package/templates/dialog/dialog.tsx +9 -2
- package/templates/drawer/drawer.tsx +24 -2
- package/templates/hold-to-confirm/hold-to-confirm.tsx +8 -1
- package/templates/menu/index.ts +5 -0
- package/templates/menu/menu.tsx +89 -7
- package/templates/menubar/menubar.tsx +10 -6
- package/templates/meter/meter.tsx +1 -1
- package/templates/navigation-menu/navigation-menu.tsx +9 -6
- package/templates/otp-field/otp-field.tsx +2 -1
- package/templates/popover/popover.tsx +7 -6
- package/templates/preview-card/preview-card.tsx +2 -1
- package/templates/progress/progress.tsx +1 -1
- package/templates/select/select.tsx +18 -4
- package/templates/slider/slider.tsx +3 -2
- package/templates/switch/switch.tsx +4 -2
- package/templates/tabs/tabs.tsx +10 -2
- package/templates/toggle/toggle.tsx +1 -1
- package/templates/tooltip/tooltip.tsx +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,77 @@ All notable changes to `@dinachi/cli` will be documented in this file.
|
|
|
5
5
|
The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.12.0] - 2026-10-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Menu**: filtering. Wrap a menu in `MenuFilter`, add `MenuInput` (with
|
|
13
|
+
`MenuClear` inside it) to the popup, and put the items in `MenuList`.
|
|
14
|
+
`MenuEmpty` shows when nothing matches. A submenu takes its own
|
|
15
|
+
`MenuFilter`. Also works in a Menubar menu. Filtering is a Base UI preview
|
|
16
|
+
API and may change.
|
|
17
|
+
- **Avatar**: `keepMounted` on `AvatarImage` renders the image right away, for
|
|
18
|
+
`next/image` and `loading="lazy"`. The fallback shows beneath it until the
|
|
19
|
+
image loads, and stays if it fails.
|
|
20
|
+
- **Combobox**: `createComboboxItems` builds `items` from objects with
|
|
21
|
+
`getValue` and `getLabel`, so selection uses IDs while the list renders the
|
|
22
|
+
full objects.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- `@base-ui/react` is now installed at `^1.9.0`, up from `^1.7.0`. It brings
|
|
27
|
+
fixes across Drawer swipes, Dialog and Popover outside clicks, Field
|
|
28
|
+
validation, and Select and Combobox `readOnly`.
|
|
29
|
+
- **Avatar**: the image and fallback are stacked in the same box, and the
|
|
30
|
+
image uses `object-cover`, so a non-square source crops instead of
|
|
31
|
+
stretching.
|
|
32
|
+
- **Collapsible**: with a native button, the trigger now gets the `disabled`
|
|
33
|
+
attribute instead of `aria-disabled` (a Base UI 1.9 change).
|
|
34
|
+
|
|
35
|
+
## [0.11.0] - 2026-08-10
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **Motion tokens**: `dinachi init` now writes `--motion-ease-out`,
|
|
40
|
+
`--motion-ease-in-out`, `--motion-ease-drawer`, `--motion-duration-fast` and
|
|
41
|
+
`--motion-duration-base` into `:root`. Change a duration there and every
|
|
42
|
+
installed component retimes together. Components inline the same values as
|
|
43
|
+
`var()` fallbacks, so this is a tuning surface, not a requirement: a project
|
|
44
|
+
that never runs `init` still animates correctly. Projects already on 0.10.0
|
|
45
|
+
can copy the block out of `dinachi init` to get the same control.
|
|
46
|
+
- **Select**: a `positionMethod` prop, defaulting to the existing `"fixed"`.
|
|
47
|
+
See the fix below for when to set `"absolute"`.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- **Button**: presses now give way slightly, `scale(0.97)` going down in 100ms
|
|
52
|
+
and back up in 150ms. The `link` variant is excluded.
|
|
53
|
+
- **Drawer**: a swipe dismissal now finishes at the speed it was thrown, and
|
|
54
|
+
the backdrop dims with the finger instead of holding full strength until the
|
|
55
|
+
drawer lets go.
|
|
56
|
+
- Popups, menus, tooltips and selects scale from their trigger rather than
|
|
57
|
+
from their own centre. Dialogs stay centred.
|
|
58
|
+
- Every animated component now has a `prefers-reduced-motion` path. Movement
|
|
59
|
+
is dropped, the fade that signals arrival is kept.
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
- **Select on Safari**: the dropdown could open far from its trigger when any
|
|
64
|
+
ancestor had a `filter`, `backdrop-filter` or `transform`. Those make the
|
|
65
|
+
ancestor the containing block for a fixed-positioned element, which the
|
|
66
|
+
positioning library accounts for everywhere except WebKit. Pass
|
|
67
|
+
`positionMethod="absolute"` if you hit this; it resolves against the nearest
|
|
68
|
+
positioned ancestor, which no filter can move.
|
|
69
|
+
- Motion classes across nine components used Tailwind 4 only syntax, which
|
|
70
|
+
emits no CSS at all on Tailwind 3 rather than erroring. Those animations
|
|
71
|
+
never ran on a v3 project.
|
|
72
|
+
- **Autocomplete** and **Combobox**: the popup had no anchor width on
|
|
73
|
+
Tailwind 3, so it did not match its input.
|
|
74
|
+
- Arbitrary transition lists now name `scale` alongside `transform`. Tailwind
|
|
75
|
+
4 compiles `scale-*` into its own property, so the scale was silently
|
|
76
|
+
excluded from the transition and snapped instead of animating.
|
|
77
|
+
- No component uses `ease-in` for an entrance any more.
|
|
78
|
+
|
|
8
79
|
## [0.10.0] - 2026-08-10
|
|
9
80
|
|
|
10
81
|
### Added
|
|
@@ -140,5 +211,7 @@ Re-run `dinachi add select`, `dinachi add slider`, and `dinachi add otp-field`
|
|
|
140
211
|
See [git history](https://github.com/raymond-UI/dinachiUI/commits/main/packages/cli)
|
|
141
212
|
for changes prior to 0.9.0.
|
|
142
213
|
|
|
214
|
+
[0.12.0]: https://github.com/raymond-UI/dinachiUI/releases/tag/cli-v0.12.0
|
|
215
|
+
[0.11.0]: https://github.com/raymond-UI/dinachiUI/releases/tag/cli-v0.11.0
|
|
143
216
|
[0.10.0]: https://github.com/raymond-UI/dinachiUI/releases/tag/cli-v0.10.0
|
|
144
217
|
[0.9.0]: https://github.com/raymond-UI/dinachiUI/releases/tag/cli-v0.9.0
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ function getComponentRegistry() {
|
|
|
75
75
|
name: "accordion",
|
|
76
76
|
description: "A vertically stacked set of interactive headings that each reveal a section of content.",
|
|
77
77
|
files: [{ name: "accordion.tsx" }, { name: "index.ts" }],
|
|
78
|
-
dependencies: ["@base-ui/react", "lucide-react"
|
|
78
|
+
dependencies: ["@base-ui/react", "lucide-react"],
|
|
79
79
|
utilityDependencies: ["cn"]
|
|
80
80
|
},
|
|
81
81
|
"alert-dialog": {
|
|
@@ -139,7 +139,7 @@ function getComponentRegistry() {
|
|
|
139
139
|
name: "collapsible",
|
|
140
140
|
description: "A collapsible panel controlled by a button.",
|
|
141
141
|
files: [{ name: "collapsible.tsx" }, { name: "index.ts" }],
|
|
142
|
-
dependencies: ["@base-ui/react"
|
|
142
|
+
dependencies: ["@base-ui/react"],
|
|
143
143
|
utilityDependencies: ["cn"]
|
|
144
144
|
},
|
|
145
145
|
combobox: {
|
|
@@ -697,7 +697,7 @@ function parseJsonWithComments(content) {
|
|
|
697
697
|
|
|
698
698
|
// src/utils/dependencies.ts
|
|
699
699
|
var DEPENDENCY_VERSION_MAP = {
|
|
700
|
-
"@base-ui/react": "^1.
|
|
700
|
+
"@base-ui/react": "^1.9.0",
|
|
701
701
|
"lucide-react": "^0.552.0",
|
|
702
702
|
"motion": "^12.23.6",
|
|
703
703
|
"class-variance-authority": "^0.7.1",
|
|
@@ -1403,6 +1403,15 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1403
1403
|
--sidebar-border: oklch(0.9407 0.0045 134.8505);
|
|
1404
1404
|
--sidebar-ring: oklch(0.5916 0.218 0.5844);
|
|
1405
1405
|
--radius: 1.05rem;
|
|
1406
|
+
/* Every component inlines these same values as a var() fallback, so motion works
|
|
1407
|
+
without them. Declaring them here is what lets a project retune the feel of every
|
|
1408
|
+
installed component from one place. The --motion- prefix avoids Tailwind v4's own
|
|
1409
|
+
--ease-out and --duration-* theme variables. */
|
|
1410
|
+
--motion-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
|
|
1411
|
+
--motion-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
|
|
1412
|
+
--motion-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
|
|
1413
|
+
--motion-duration-fast: 150ms;
|
|
1414
|
+
--motion-duration-base: 200ms;
|
|
1406
1415
|
/* Softer and tighter than Tailwind's defaults, which every component's shadow-sm,
|
|
1407
1416
|
shadow-md and shadow-lg then picks up. Without these the popovers and dialogs a
|
|
1408
1417
|
user installs are shadowed harder than the same components on the docs site. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dinachi/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "CLI for adding Dinachi UI components to your project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"ts-morph": "^27.0.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@base-ui/react": "1.
|
|
47
|
+
"@base-ui/react": "1.9.0",
|
|
48
48
|
"@json-render/core": "^0.14.0",
|
|
49
49
|
"@json-render/react": "^0.14.0",
|
|
50
50
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -44,7 +44,7 @@ const AccordionTrigger = React.forwardRef<
|
|
|
44
44
|
<BaseAccordion.Trigger
|
|
45
45
|
ref={ref}
|
|
46
46
|
className={cn(
|
|
47
|
-
"flex flex-1 items-center justify-between py-4 font-medium transition-
|
|
47
|
+
"flex flex-1 items-center justify-between py-4 font-medium transition-colors hover:underline",
|
|
48
48
|
"[&[data-panel-open]>svg]:rotate-180",
|
|
49
49
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
50
50
|
className
|
|
@@ -52,7 +52,7 @@ const AccordionTrigger = React.forwardRef<
|
|
|
52
52
|
{...props}
|
|
53
53
|
>
|
|
54
54
|
{children}
|
|
55
|
-
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-
|
|
55
|
+
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none" />
|
|
56
56
|
</BaseAccordion.Trigger>
|
|
57
57
|
));
|
|
58
58
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
@@ -65,10 +65,9 @@ const AccordionPanel = React.forwardRef<
|
|
|
65
65
|
ref={ref}
|
|
66
66
|
className={cn(
|
|
67
67
|
"overflow-hidden text-sm h-[var(--accordion-panel-height)]",
|
|
68
|
-
"transition-[height] duration-
|
|
68
|
+
"transition-[height] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
69
69
|
"data-[starting-style]:h-0 data-[ending-style]:h-0",
|
|
70
|
-
"
|
|
71
|
-
"data-[closed]:animate-out data-[closed]:slide-up-to-top",
|
|
70
|
+
"motion-reduce:transition-none",
|
|
72
71
|
className
|
|
73
72
|
)}
|
|
74
73
|
{...props}
|
|
@@ -17,7 +17,8 @@ const AlertDialogBackdrop = React.forwardRef<
|
|
|
17
17
|
className={cn(
|
|
18
18
|
"fixed inset-0 z-50 bg-black/80",
|
|
19
19
|
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
20
|
-
"transition-
|
|
20
|
+
"transition-opacity duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
21
|
+
"data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
|
|
21
22
|
className
|
|
22
23
|
)}
|
|
23
24
|
{...props}
|
|
@@ -48,9 +49,15 @@ const AlertDialogPopup = React.forwardRef<
|
|
|
48
49
|
ref={ref}
|
|
49
50
|
className={cn(
|
|
50
51
|
"w-[95%] max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg",
|
|
52
|
+
// An alert dialog is not anchored to its trigger, so scaling from the centre is
|
|
53
|
+
// correct here in a way it is not for a popover.
|
|
51
54
|
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
52
55
|
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
53
|
-
"
|
|
56
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
57
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
58
|
+
// Slower in than out. The user is deciding on the way in and has already decided
|
|
59
|
+
// on the way out.
|
|
60
|
+
"data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
|
|
54
61
|
className
|
|
55
62
|
)}
|
|
56
63
|
{...props}
|
|
@@ -81,10 +81,12 @@ const AutocompleteContent = React.forwardRef<
|
|
|
81
81
|
<AutocompletePrimitive.Popup
|
|
82
82
|
ref={ref}
|
|
83
83
|
className={cn(
|
|
84
|
-
"relative z-50 min-w-(--anchor-width) overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
85
|
-
"origin-(--transform-origin) outline-none",
|
|
86
|
-
"
|
|
87
|
-
"data-
|
|
84
|
+
"relative z-50 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
85
|
+
"origin-[var(--transform-origin)] outline-none",
|
|
86
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
87
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
88
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
89
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
88
90
|
className
|
|
89
91
|
)}
|
|
90
92
|
{...props}
|
|
@@ -38,7 +38,10 @@ const AvatarImage = React.forwardRef<
|
|
|
38
38
|
>(({ className, ...props }, ref) => (
|
|
39
39
|
<BaseAvatar.Image
|
|
40
40
|
ref={ref}
|
|
41
|
-
className={cn(
|
|
41
|
+
className={cn(
|
|
42
|
+
"absolute inset-0 z-[1] aspect-square h-full w-full object-cover data-[error]:invisible data-[loading]:invisible",
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
42
45
|
{...props}
|
|
43
46
|
/>
|
|
44
47
|
));
|
|
@@ -51,7 +54,7 @@ const AvatarFallback = React.forwardRef<
|
|
|
51
54
|
<BaseAvatar.Fallback
|
|
52
55
|
ref={ref}
|
|
53
56
|
className={cn(
|
|
54
|
-
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
57
|
+
"absolute inset-0 flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
55
58
|
className
|
|
56
59
|
)}
|
|
57
60
|
{...props}
|
|
@@ -4,7 +4,23 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
4
4
|
import { cn } from "@/lib/utils"
|
|
5
5
|
|
|
6
6
|
const buttonVariants = cva(
|
|
7
|
-
|
|
7
|
+
[
|
|
8
|
+
"inline-flex items-center cursor-pointer justify-center whitespace-nowrap rounded-md text-sm font-medium",
|
|
9
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
10
|
+
// `transform` and `scale` are both named because Tailwind 3 compiles scale-* into
|
|
11
|
+
// `transform` while Tailwind 4 compiles it into `scale`, and a copied component has
|
|
12
|
+
// no say in which major its project runs.
|
|
13
|
+
"transition-[color,background-color,border-color,transform,scale] duration-[var(--motion-duration-fast,150ms)]",
|
|
14
|
+
// The button gives way under the press and comes back when released. 0.97 is small
|
|
15
|
+
// enough to read as the surface yielding rather than the button resizing.
|
|
16
|
+
"active:scale-[0.97]",
|
|
17
|
+
// Faster down than up: the press is the system answering the user, the release is
|
|
18
|
+
// the button settling. Equal timings in both directions read as mushy.
|
|
19
|
+
"active:duration-100",
|
|
20
|
+
// The colour change on hover and press already carries the feedback, so dropping
|
|
21
|
+
// the movement costs nothing.
|
|
22
|
+
"motion-reduce:active:scale-100",
|
|
23
|
+
],
|
|
8
24
|
{
|
|
9
25
|
variants: {
|
|
10
26
|
variant: {
|
|
@@ -16,7 +32,8 @@ const buttonVariants = cva(
|
|
|
16
32
|
secondary:
|
|
17
33
|
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
18
34
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
19
|
-
|
|
35
|
+
// A run of text is not a surface, so there is nothing to press into.
|
|
36
|
+
link: "text-primary underline-offset-4 hover:underline active:scale-100",
|
|
20
37
|
},
|
|
21
38
|
size: {
|
|
22
39
|
default: "h-10 px-4 py-2",
|
|
@@ -38,16 +38,12 @@ const CollapsiblePanel = React.forwardRef<
|
|
|
38
38
|
<BaseCollapsible.Panel
|
|
39
39
|
ref={ref}
|
|
40
40
|
className={cn(
|
|
41
|
-
"overflow-hidden text-sm
|
|
41
|
+
"overflow-hidden text-sm h-[var(--collapsible-panel-height)]",
|
|
42
|
+
"transition-[height] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
42
43
|
"data-[ending-style]:h-0 data-[starting-style]:h-0",
|
|
43
|
-
"
|
|
44
|
-
"data-[closed]:animate-out data-[closed]:slide-up-to-top",
|
|
44
|
+
"motion-reduce:transition-none",
|
|
45
45
|
className
|
|
46
46
|
)}
|
|
47
|
-
style={{
|
|
48
|
-
"--collapsible-panel-height": "var(--collapsible-panel-height)",
|
|
49
|
-
"--collapsible-panel-width": "var(--collapsible-panel-width)",
|
|
50
|
-
} as React.CSSProperties}
|
|
51
47
|
{...props}
|
|
52
48
|
/>
|
|
53
49
|
))
|
|
@@ -10,6 +10,7 @@ const ComboboxValue = ComboboxPrimitive.Value
|
|
|
10
10
|
const ComboboxCollection = ComboboxPrimitive.Collection
|
|
11
11
|
const ComboboxPortal = ComboboxPrimitive.Portal
|
|
12
12
|
const ComboboxInputGroup = ComboboxPrimitive.InputGroup
|
|
13
|
+
const createComboboxItems = ComboboxPrimitive.createItems
|
|
13
14
|
|
|
14
15
|
const ComboboxInput = React.forwardRef<
|
|
15
16
|
React.ComponentRef<typeof ComboboxPrimitive.Input>,
|
|
@@ -81,10 +82,12 @@ const ComboboxContent = React.forwardRef<
|
|
|
81
82
|
<ComboboxPrimitive.Popup
|
|
82
83
|
ref={ref}
|
|
83
84
|
className={cn(
|
|
84
|
-
"relative z-50 min-w-(--anchor-width) overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
85
|
-
"origin-(--transform-origin) outline-none",
|
|
86
|
-
"
|
|
87
|
-
"data-
|
|
85
|
+
"relative z-50 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
86
|
+
"origin-[var(--transform-origin)] outline-none",
|
|
87
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
88
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
89
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
90
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
88
91
|
className
|
|
89
92
|
)}
|
|
90
93
|
{...props}
|
|
@@ -207,6 +210,7 @@ export {
|
|
|
207
210
|
ComboboxCollection,
|
|
208
211
|
ComboboxPortal,
|
|
209
212
|
ComboboxInputGroup,
|
|
213
|
+
createComboboxItems,
|
|
210
214
|
ComboboxInput,
|
|
211
215
|
ComboboxTrigger,
|
|
212
216
|
ComboboxClear,
|
|
@@ -49,10 +49,12 @@ const ContextMenuContent = React.forwardRef<
|
|
|
49
49
|
ref={ref}
|
|
50
50
|
className={cn(
|
|
51
51
|
"z-50 min-w-48 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
|
|
52
|
-
"origin-(--transform-origin)",
|
|
52
|
+
"origin-[var(--transform-origin)]",
|
|
53
53
|
"outline-none focus:outline-none focus-visible:outline-none",
|
|
54
|
-
"
|
|
55
|
-
"data-[
|
|
54
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
55
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
56
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
57
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
56
58
|
className
|
|
57
59
|
)}
|
|
58
60
|
{...props}
|
|
@@ -246,10 +248,12 @@ const ContextMenuSubContent = React.forwardRef<
|
|
|
246
248
|
ref={ref}
|
|
247
249
|
className={cn(
|
|
248
250
|
"z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
|
|
249
|
-
"origin-(--transform-origin)",
|
|
251
|
+
"origin-[var(--transform-origin)]",
|
|
250
252
|
"outline-none focus:outline-none focus-visible:outline-none",
|
|
251
|
-
"
|
|
252
|
-
"data-[
|
|
253
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
254
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
255
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
256
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
253
257
|
className
|
|
254
258
|
)}
|
|
255
259
|
{...props}
|
|
@@ -17,7 +17,8 @@ const DialogBackdrop = React.forwardRef<
|
|
|
17
17
|
className={cn(
|
|
18
18
|
"fixed inset-0 z-50 bg-black/80",
|
|
19
19
|
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
20
|
-
"transition-
|
|
20
|
+
"transition-opacity duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
21
|
+
"data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
|
|
21
22
|
className
|
|
22
23
|
)}
|
|
23
24
|
{...props}
|
|
@@ -48,9 +49,15 @@ const DialogPopup = React.forwardRef<
|
|
|
48
49
|
ref={ref}
|
|
49
50
|
className={cn(
|
|
50
51
|
"w-[95%] max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg",
|
|
52
|
+
// A dialog is not anchored to its trigger, so scaling from the centre is correct
|
|
53
|
+
// here in a way it is not for a popover.
|
|
51
54
|
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
52
55
|
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
53
|
-
"
|
|
56
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
57
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
58
|
+
// Slower in than out. The user is deciding on the way in and has already decided
|
|
59
|
+
// on the way out.
|
|
60
|
+
"data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
|
|
54
61
|
className
|
|
55
62
|
)}
|
|
56
63
|
{...props}
|
|
@@ -18,8 +18,15 @@ const DrawerBackdrop = React.forwardRef<
|
|
|
18
18
|
ref={ref}
|
|
19
19
|
className={cn(
|
|
20
20
|
"fixed inset-0 z-50 bg-black/50",
|
|
21
|
+
// Base UI writes --drawer-swipe-progress on this element as the drag runs: 0 while
|
|
22
|
+
// the drawer is open, 1 once it has travelled far enough to be gone. Reading it
|
|
23
|
+
// here is what makes the dim follow the finger instead of holding full strength
|
|
24
|
+
// until the drawer lets go.
|
|
25
|
+
"opacity-[calc(1_-_var(--drawer-swipe-progress,0))]",
|
|
21
26
|
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
22
|
-
"transition-opacity duration-
|
|
27
|
+
"transition-opacity duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-drawer,cubic-bezier(0.32,0.72,0,1))]",
|
|
28
|
+
// During the drag the opacity is the finger's to set, not a transition's.
|
|
29
|
+
"data-[swiping]:transition-none",
|
|
23
30
|
className
|
|
24
31
|
)}
|
|
25
32
|
{...props}
|
|
@@ -41,7 +48,16 @@ const DrawerContent = React.forwardRef<
|
|
|
41
48
|
<DrawerPrimitive.Popup
|
|
42
49
|
ref={ref}
|
|
43
50
|
className={cn(
|
|
44
|
-
"fixed z-50 flex flex-col gap-4 border bg-background p-6 shadow-lg
|
|
51
|
+
"fixed z-50 flex flex-col gap-4 border bg-background p-6 shadow-lg",
|
|
52
|
+
// A surface that travels in from an edge gets the drawer curve, which decays
|
|
53
|
+
// more slowly than the standard one and reads as weight rather than snap.
|
|
54
|
+
"transition-transform duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-drawer,cubic-bezier(0.32,0.72,0,1))]",
|
|
55
|
+
// Base UI resolves a flick into --drawer-swipe-strength, a multiplier on how
|
|
56
|
+
// long the rest of the journey should take: below 1 for a fast flick, above 1
|
|
57
|
+
// for a slow drag released past the threshold. Without it every dismissal
|
|
58
|
+
// takes the same 200ms and the drawer ignores how hard it was thrown. It is
|
|
59
|
+
// registered with an initial value of 1, so a click-driven close is unchanged.
|
|
60
|
+
"data-[ending-style]:duration-[calc(var(--motion-duration-base,200ms)_*_var(--drawer-swipe-strength,1))]",
|
|
45
61
|
side === "top" &&
|
|
46
62
|
"inset-x-0 top-0 border-b data-[starting-style]:-translate-y-full data-[ending-style]:-translate-y-full",
|
|
47
63
|
side === "bottom" &&
|
|
@@ -50,6 +66,12 @@ const DrawerContent = React.forwardRef<
|
|
|
50
66
|
"inset-y-0 left-0 h-full w-3/4 max-w-sm border-r data-[starting-style]:-translate-x-full data-[ending-style]:-translate-x-full",
|
|
51
67
|
side === "right" &&
|
|
52
68
|
"inset-y-0 right-0 h-full w-3/4 max-w-sm border-l data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full",
|
|
69
|
+
// A drawer's whole entrance is travel, so there is nothing left once the
|
|
70
|
+
// movement is dropped. It fades in place instead, which still marks the
|
|
71
|
+
// arrival without sweeping a full panel across the viewport.
|
|
72
|
+
"motion-reduce:transition-opacity",
|
|
73
|
+
"motion-reduce:data-[starting-style]:translate-x-0 motion-reduce:data-[starting-style]:translate-y-0 motion-reduce:data-[starting-style]:opacity-0",
|
|
74
|
+
"motion-reduce:data-[ending-style]:translate-x-0 motion-reduce:data-[ending-style]:translate-y-0 motion-reduce:data-[ending-style]:opacity-0",
|
|
53
75
|
className
|
|
54
76
|
)}
|
|
55
77
|
{...props}
|
|
@@ -400,8 +400,15 @@ function shellClass(
|
|
|
400
400
|
// press feedback as a pointer one, and so the button lifts on the frame the hold
|
|
401
401
|
// completes. Quicker in than out: the press is the interface answering the user,
|
|
402
402
|
// the release is only it relaxing.
|
|
403
|
+
// `useReducedMotion` samples the OS setting at mount, so the class is dropped here
|
|
404
|
+
// only for a preference that was already set. `motion-reduce` catches the same
|
|
405
|
+
// preference turned on while the page is open, which the hook would not see.
|
|
403
406
|
!reducedMotion &&
|
|
404
|
-
|
|
407
|
+
cn(
|
|
408
|
+
"transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
409
|
+
"data-[holding]:duration-100 data-[holding]:scale-[0.97]",
|
|
410
|
+
"motion-reduce:data-[holding]:scale-100"
|
|
411
|
+
),
|
|
405
412
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
406
413
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
407
414
|
SHAPE[variant],
|
package/templates/menu/index.ts
CHANGED
package/templates/menu/menu.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
5
|
-
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
5
|
+
import { Check, ChevronRight, Circle, Search, X } from "lucide-react"
|
|
6
6
|
import { cn } from "@/lib/utils"
|
|
7
7
|
|
|
8
8
|
const Menu: React.FC<React.ComponentProps<typeof MenuPrimitive.Root>> = (props) => (
|
|
@@ -57,9 +57,11 @@ const MenuContent = React.forwardRef<
|
|
|
57
57
|
ref={ref}
|
|
58
58
|
className={cn(
|
|
59
59
|
"z-50 min-w-40 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
60
|
-
"origin-(--transform-origin) outline-none",
|
|
61
|
-
"
|
|
62
|
-
"data-[
|
|
60
|
+
"origin-[var(--transform-origin)] outline-none",
|
|
61
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
62
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
63
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
64
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
63
65
|
className
|
|
64
66
|
)}
|
|
65
67
|
{...props}
|
|
@@ -246,9 +248,11 @@ const MenuSubContent = React.forwardRef<
|
|
|
246
248
|
ref={ref}
|
|
247
249
|
className={cn(
|
|
248
250
|
"z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
249
|
-
"origin-(--transform-origin) outline-none",
|
|
250
|
-
"
|
|
251
|
-
"data-[
|
|
251
|
+
"origin-[var(--transform-origin)] outline-none",
|
|
252
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
253
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
254
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
255
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
252
256
|
className
|
|
253
257
|
)}
|
|
254
258
|
{...props}
|
|
@@ -258,6 +262,79 @@ const MenuSubContent = React.forwardRef<
|
|
|
258
262
|
))
|
|
259
263
|
MenuSubContent.displayName = "MenuSubContent"
|
|
260
264
|
|
|
265
|
+
const MenuFilter: React.FC<React.ComponentProps<typeof MenuPrimitive.FilterProvider>> = (props) => (
|
|
266
|
+
<MenuPrimitive.FilterProvider {...props} />
|
|
267
|
+
)
|
|
268
|
+
MenuFilter.displayName = "MenuFilter"
|
|
269
|
+
|
|
270
|
+
const MenuInput = React.forwardRef<
|
|
271
|
+
React.ComponentRef<typeof MenuPrimitive.Input>,
|
|
272
|
+
React.ComponentProps<typeof MenuPrimitive.Input>
|
|
273
|
+
>(({ className, children, ...props }, ref) => (
|
|
274
|
+
<div className="-mx-1 -mt-1 mb-1 flex items-center gap-2 border-b px-2">
|
|
275
|
+
<Search className="h-4 w-4 shrink-0 text-muted-foreground" />
|
|
276
|
+
<MenuPrimitive.Input
|
|
277
|
+
ref={ref}
|
|
278
|
+
className={cn(
|
|
279
|
+
"flex h-9 w-full bg-transparent py-2 text-sm outline-none",
|
|
280
|
+
"placeholder:text-muted-foreground",
|
|
281
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
282
|
+
className
|
|
283
|
+
)}
|
|
284
|
+
{...props}
|
|
285
|
+
/>
|
|
286
|
+
{children}
|
|
287
|
+
</div>
|
|
288
|
+
))
|
|
289
|
+
MenuInput.displayName = "MenuInput"
|
|
290
|
+
|
|
291
|
+
const MenuClear = React.forwardRef<
|
|
292
|
+
React.ComponentRef<typeof MenuPrimitive.Clear>,
|
|
293
|
+
React.ComponentProps<typeof MenuPrimitive.Clear>
|
|
294
|
+
>(({ className, children, ...props }, ref) => (
|
|
295
|
+
<MenuPrimitive.Clear
|
|
296
|
+
ref={ref}
|
|
297
|
+
className={cn(
|
|
298
|
+
"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-muted-foreground",
|
|
299
|
+
"hover:text-foreground",
|
|
300
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
301
|
+
className
|
|
302
|
+
)}
|
|
303
|
+
{...props}
|
|
304
|
+
>
|
|
305
|
+
{children ?? <X className="h-4 w-4" />}
|
|
306
|
+
</MenuPrimitive.Clear>
|
|
307
|
+
))
|
|
308
|
+
MenuClear.displayName = "MenuClear"
|
|
309
|
+
|
|
310
|
+
const MenuEmpty = React.forwardRef<
|
|
311
|
+
React.ComponentRef<typeof MenuPrimitive.Empty>,
|
|
312
|
+
React.ComponentProps<typeof MenuPrimitive.Empty>
|
|
313
|
+
>(({ className, ...props }, ref) => (
|
|
314
|
+
<MenuPrimitive.Empty
|
|
315
|
+
ref={ref}
|
|
316
|
+
className={cn("py-6 text-center text-sm text-muted-foreground", className)}
|
|
317
|
+
{...props}
|
|
318
|
+
/>
|
|
319
|
+
))
|
|
320
|
+
MenuEmpty.displayName = "MenuEmpty"
|
|
321
|
+
|
|
322
|
+
const MenuList = React.forwardRef<
|
|
323
|
+
React.ComponentRef<typeof MenuPrimitive.List>,
|
|
324
|
+
React.ComponentProps<typeof MenuPrimitive.List>
|
|
325
|
+
>(({ className, ...props }, ref) => (
|
|
326
|
+
<MenuPrimitive.List
|
|
327
|
+
ref={ref}
|
|
328
|
+
className={cn(
|
|
329
|
+
"max-h-[min(22rem,var(--available-height))] overflow-y-auto scroll-py-1 outline-none",
|
|
330
|
+
"[&>[data-filter-section]:not([hidden])~[data-filter-section]:not([hidden])>[data-filter-separator]]:block",
|
|
331
|
+
className
|
|
332
|
+
)}
|
|
333
|
+
{...props}
|
|
334
|
+
/>
|
|
335
|
+
))
|
|
336
|
+
MenuList.displayName = "MenuList"
|
|
337
|
+
|
|
261
338
|
export {
|
|
262
339
|
Menu,
|
|
263
340
|
MenuTrigger,
|
|
@@ -276,4 +353,9 @@ export {
|
|
|
276
353
|
MenuSub,
|
|
277
354
|
MenuSubTrigger,
|
|
278
355
|
MenuSubContent,
|
|
356
|
+
MenuFilter,
|
|
357
|
+
MenuInput,
|
|
358
|
+
MenuClear,
|
|
359
|
+
MenuEmpty,
|
|
360
|
+
MenuList,
|
|
279
361
|
}
|
|
@@ -71,10 +71,12 @@ const MenubarContent = React.forwardRef<
|
|
|
71
71
|
ref={ref}
|
|
72
72
|
className={cn(
|
|
73
73
|
"z-50 min-w-48 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
74
|
-
"origin-(--transform-origin)",
|
|
74
|
+
"origin-[var(--transform-origin)]",
|
|
75
75
|
"outline-none focus:outline-none focus-visible:outline-none",
|
|
76
|
-
"
|
|
77
|
-
"data-[
|
|
76
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
77
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
78
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
79
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
78
80
|
className
|
|
79
81
|
)}
|
|
80
82
|
{...props}
|
|
@@ -249,10 +251,12 @@ const MenubarSubContent = React.forwardRef<
|
|
|
249
251
|
ref={ref}
|
|
250
252
|
className={cn(
|
|
251
253
|
"z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
|
|
252
|
-
"origin-(--transform-origin)",
|
|
254
|
+
"origin-[var(--transform-origin)]",
|
|
253
255
|
"outline-none focus:outline-none focus-visible:outline-none",
|
|
254
|
-
"
|
|
255
|
-
"data-[
|
|
256
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
257
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
258
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
259
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
256
260
|
className
|
|
257
261
|
)}
|
|
258
262
|
{...props}
|
|
@@ -30,7 +30,7 @@ const MeterIndicator = React.forwardRef<
|
|
|
30
30
|
>(({ className, ...props }, ref) => (
|
|
31
31
|
<MeterPrimitive.Indicator
|
|
32
32
|
ref={ref}
|
|
33
|
-
className={cn("h-full rounded-full bg-primary transition-[width] duration-
|
|
33
|
+
className={cn("h-full rounded-full bg-primary transition-[width] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none", className)}
|
|
34
34
|
{...props}
|
|
35
35
|
/>
|
|
36
36
|
))
|
|
@@ -68,7 +68,7 @@ const NavigationMenuTrigger = React.forwardRef<
|
|
|
68
68
|
{children}{" "}
|
|
69
69
|
<BaseNavigationMenu.Icon
|
|
70
70
|
render={
|
|
71
|
-
<ChevronDown className="relative top-[1px] ml-1 h-3 w-3 transition duration-
|
|
71
|
+
<ChevronDown className="relative top-[1px] ml-1 h-3 w-3 transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none group-data-[popup-open]:rotate-180" />
|
|
72
72
|
}
|
|
73
73
|
/>
|
|
74
74
|
</BaseNavigationMenu.Trigger>
|
|
@@ -83,8 +83,8 @@ const NavigationMenuContent = React.forwardRef<
|
|
|
83
83
|
ref={ref}
|
|
84
84
|
className={cn(
|
|
85
85
|
"left-0 top-0 w-full",
|
|
86
|
-
"
|
|
87
|
-
"data-[
|
|
86
|
+
"transition-opacity duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
87
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
88
88
|
className
|
|
89
89
|
)}
|
|
90
90
|
{...props}
|
|
@@ -133,8 +133,11 @@ const NavigationMenuPopup = React.forwardRef<
|
|
|
133
133
|
<BaseNavigationMenu.Popup
|
|
134
134
|
ref={ref}
|
|
135
135
|
className={cn(
|
|
136
|
-
"
|
|
137
|
-
"
|
|
136
|
+
"origin-[var(--transform-origin)]",
|
|
137
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
138
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
139
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
140
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
138
141
|
className
|
|
139
142
|
)}
|
|
140
143
|
{...props}
|
|
@@ -204,7 +207,7 @@ const NavigationMenuBackdrop = React.forwardRef<
|
|
|
204
207
|
className={cn(
|
|
205
208
|
"fixed inset-0 z-40 bg-black/40 pointer-events-none",
|
|
206
209
|
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
207
|
-
"transition-opacity duration-
|
|
210
|
+
"transition-opacity duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
208
211
|
className
|
|
209
212
|
)}
|
|
210
213
|
{...props}
|
|
@@ -39,7 +39,8 @@ const OTPFieldInput = React.forwardRef<
|
|
|
39
39
|
<OTPFieldPrimitive.Input
|
|
40
40
|
ref={ref}
|
|
41
41
|
className={cn(
|
|
42
|
-
"relative h-10 w-10 border-y border-r border-input bg-background text-center text-sm shadow-sm outline-none
|
|
42
|
+
"relative h-10 w-10 border-y border-r border-input bg-background text-center text-sm shadow-sm outline-none",
|
|
43
|
+
"transition-[color,background-color,border-color,box-shadow] duration-[var(--motion-duration-fast,150ms)]",
|
|
43
44
|
"first:rounded-l-md first:border-l last:rounded-r-md",
|
|
44
45
|
"focus-visible:z-10 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50",
|
|
45
46
|
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
@@ -31,10 +31,11 @@ const PopoverPopup = React.forwardRef<
|
|
|
31
31
|
ref={ref}
|
|
32
32
|
className={cn(
|
|
33
33
|
"rounded-lg border bg-popover px-6 py-4 text-popover-foreground shadow-lg outline-none",
|
|
34
|
-
"origin-(--transform-origin)",
|
|
35
|
-
"
|
|
36
|
-
"data-
|
|
37
|
-
"
|
|
34
|
+
"origin-[var(--transform-origin)]",
|
|
35
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
36
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
37
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
38
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
38
39
|
className
|
|
39
40
|
)}
|
|
40
41
|
{...props}
|
|
@@ -165,8 +166,8 @@ const PopoverBackdrop = React.forwardRef<
|
|
|
165
166
|
ref={ref}
|
|
166
167
|
className={cn(
|
|
167
168
|
"fixed inset-0 z-40 bg-black/50",
|
|
168
|
-
"data-starting-style:opacity-0 data-ending-style:opacity-0",
|
|
169
|
-
"transition-opacity duration-
|
|
169
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
170
|
+
"transition-opacity duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
170
171
|
className
|
|
171
172
|
)}
|
|
172
173
|
{...props}
|
|
@@ -64,9 +64,10 @@ const PreviewCardPopup = React.forwardRef<
|
|
|
64
64
|
className={cn(
|
|
65
65
|
"flex w-[280px] origin-[var(--transform-origin)] flex-col gap-3 rounded-lg bg-secondary/80 p-4 shadow-lg shadow-secondary/20",
|
|
66
66
|
"outline outline-1 outline-border",
|
|
67
|
-
"transition-[scale,opacity] duration-
|
|
67
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
68
68
|
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
69
69
|
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
70
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
70
71
|
"backdrop-blur-sm dark:shadow-none dark:-outline-offset-1",
|
|
71
72
|
className
|
|
72
73
|
)}
|
|
@@ -30,7 +30,7 @@ const ProgressIndicator = React.forwardRef<
|
|
|
30
30
|
>(({ className, ...props }, ref) => (
|
|
31
31
|
<ProgressPrimitive.Indicator
|
|
32
32
|
ref={ref}
|
|
33
|
-
className={cn("h-full rounded-full bg-primary transition-[width] duration-
|
|
33
|
+
className={cn("h-full rounded-full bg-primary transition-[width] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none", className)}
|
|
34
34
|
{...props}
|
|
35
35
|
/>
|
|
36
36
|
))
|
|
@@ -38,21 +38,35 @@ const SelectContent = React.forwardRef<
|
|
|
38
38
|
readonly alignItemWithTrigger?: boolean
|
|
39
39
|
readonly sideOffset?: number
|
|
40
40
|
readonly portal?: boolean
|
|
41
|
+
/**
|
|
42
|
+
* Set this to `"absolute"` if the dropdown lands away from its trigger in Safari.
|
|
43
|
+
* A `filter`, `backdrop-filter` or `transform` on any ancestor makes that ancestor
|
|
44
|
+
* the containing block for a fixed-positioned descendant, and the positioning
|
|
45
|
+
* library skips those two filter properties on WebKit — so it measures against the
|
|
46
|
+
* viewport while Safari lays out against the ancestor. `"absolute"` resolves
|
|
47
|
+
* against the nearest positioned ancestor instead, which no filter can change.
|
|
48
|
+
*/
|
|
49
|
+
readonly positionMethod?: "absolute" | "fixed"
|
|
41
50
|
}
|
|
42
|
-
>(({ className, children, alignItemWithTrigger = false, sideOffset = 4, portal = false, ...props }, ref) => {
|
|
51
|
+
>(({ className, children, alignItemWithTrigger = false, sideOffset = 4, portal = false, positionMethod = "fixed", ...props }, ref) => {
|
|
43
52
|
const content = (
|
|
44
53
|
<SelectPrimitive.Positioner
|
|
45
54
|
sideOffset={sideOffset}
|
|
46
55
|
alignItemWithTrigger={alignItemWithTrigger}
|
|
47
|
-
positionMethod=
|
|
56
|
+
positionMethod={positionMethod}
|
|
57
|
+
// The stacking context that keeps sibling form controls from painting over an
|
|
58
|
+
// open dropdown comes from this z-index, not from the position method.
|
|
48
59
|
className="z-50"
|
|
49
60
|
>
|
|
50
61
|
<SelectPrimitive.Popup
|
|
51
62
|
ref={ref}
|
|
52
63
|
className={cn(
|
|
53
64
|
"relative max-h-96 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
65
|
+
"origin-[var(--transform-origin)]",
|
|
66
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
67
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
68
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
69
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
56
70
|
!alignItemWithTrigger &&
|
|
57
71
|
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
58
72
|
className
|
|
@@ -73,10 +73,11 @@ const SliderThumb = React.forwardRef<
|
|
|
73
73
|
<BaseSlider.Thumb
|
|
74
74
|
ref={ref}
|
|
75
75
|
className={cn(
|
|
76
|
-
"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background
|
|
76
|
+
"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background",
|
|
77
|
+
"transition-[color,background-color,border-color,transform,scale] duration-150",
|
|
77
78
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
78
79
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
79
|
-
"data-[dragging]:scale-110",
|
|
80
|
+
"data-[dragging]:scale-110 motion-reduce:data-[dragging]:scale-100",
|
|
80
81
|
className
|
|
81
82
|
)}
|
|
82
83
|
{...props}
|
|
@@ -12,7 +12,7 @@ const Switch = React.forwardRef<
|
|
|
12
12
|
<SwitchPrimitive.Root
|
|
13
13
|
ref={ref}
|
|
14
14
|
className={cn(
|
|
15
|
-
"inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
|
|
15
|
+
"inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-[var(--motion-duration-fast,150ms)]",
|
|
16
16
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
17
17
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
18
|
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
@@ -32,7 +32,9 @@ const SwitchThumb = React.forwardRef<
|
|
|
32
32
|
<SwitchPrimitive.Thumb
|
|
33
33
|
ref={ref}
|
|
34
34
|
className={cn(
|
|
35
|
-
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0
|
|
35
|
+
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0",
|
|
36
|
+
"transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
37
|
+
"motion-reduce:transition-none",
|
|
36
38
|
"data-[checked]:translate-x-5 data-[unchecked]:translate-x-0",
|
|
37
39
|
"data-[disabled]:opacity-80",
|
|
38
40
|
className
|
package/templates/tabs/tabs.tsx
CHANGED
|
@@ -36,7 +36,8 @@ const TabsTrigger = React.forwardRef<
|
|
|
36
36
|
<BaseTabs.Tab
|
|
37
37
|
ref={ref}
|
|
38
38
|
className={cn(
|
|
39
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background
|
|
39
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background",
|
|
40
|
+
"transition-[color,background-color,box-shadow] duration-[var(--motion-duration-fast,150ms)]",
|
|
40
41
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
41
42
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
42
43
|
"data-[active]:bg-muted data-[active]:text-foreground data-[active]:shadow-sm",
|
|
@@ -71,7 +72,14 @@ const TabsIndicator = React.forwardRef<
|
|
|
71
72
|
<BaseTabs.Indicator
|
|
72
73
|
ref={ref}
|
|
73
74
|
className={cn(
|
|
74
|
-
"absolute bottom-0 left-0 z-10 h-1 w-[var(--active-tab-width)] -translate-y-1/2 translate-x-[var(--active-tab-left)] rounded-sm bg-muted-foreground
|
|
75
|
+
"absolute bottom-0 left-0 z-10 h-1 w-[var(--active-tab-width)] -translate-y-1/2 translate-x-[var(--active-tab-left)] rounded-sm bg-muted-foreground",
|
|
76
|
+
// The indicator moves between two on-screen positions rather than entering, so it
|
|
77
|
+
// takes the in-out curve. Width is a layout property, but the indicator is
|
|
78
|
+
// absolutely positioned and therefore out of flow, so animating it reflows only
|
|
79
|
+
// itself. Naming the three properties keeps `all` from animating its colour and
|
|
80
|
+
// shadow on every tab change as well.
|
|
81
|
+
"transition-[transform,translate,width] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-in-out,cubic-bezier(0.77,0,0.175,1))]",
|
|
82
|
+
"motion-reduce:transition-none",
|
|
75
83
|
className
|
|
76
84
|
)}
|
|
77
85
|
{...props}
|
|
@@ -8,7 +8,7 @@ import { cn } from "@/lib/utils"
|
|
|
8
8
|
const toggleVariants = cva(
|
|
9
9
|
[
|
|
10
10
|
"inline-flex items-center justify-center rounded-md text-sm font-medium",
|
|
11
|
-
"ring-offset-background transition-
|
|
11
|
+
"ring-offset-background transition-colors duration-[var(--motion-duration-fast,150ms)]",
|
|
12
12
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
13
13
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
14
14
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
@@ -60,10 +60,16 @@ const TooltipPopup: React.ForwardRefExoticComponent<
|
|
|
60
60
|
<BaseTooltip.Popup
|
|
61
61
|
ref={ref}
|
|
62
62
|
className={cn(
|
|
63
|
-
"origin-(--transform-origin) rounded-md px-3 py-1.5 text-sm shadow-md",
|
|
64
|
-
"transition-[transform,scale,opacity] duration-
|
|
65
|
-
"data-ending-style:scale-95 data-ending-style:opacity-0",
|
|
66
|
-
"data-starting-style:scale-95 data-starting-style:opacity-0",
|
|
63
|
+
"origin-[var(--transform-origin)] rounded-md px-3 py-1.5 text-sm shadow-md",
|
|
64
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
65
|
+
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
66
|
+
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
67
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
68
|
+
// Base UI sets data-instant when the open came from an adjacent trigger while a
|
|
69
|
+
// tooltip was already up, from keyboard focus, or from Escape. All three are
|
|
70
|
+
// cases where the animation is the only thing standing between the user and the
|
|
71
|
+
// content they asked for.
|
|
72
|
+
"data-[instant]:duration-0",
|
|
67
73
|
variantStyles[variant],
|
|
68
74
|
className
|
|
69
75
|
)}
|