@azmr/ui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -0
- package/dist/avatar.d.ts +58 -0
- package/dist/avatar.js +84 -0
- package/dist/breadcrumb.d.ts +47 -0
- package/dist/breadcrumb.js +120 -0
- package/dist/button-CYt2Zw3D.d.ts +64 -0
- package/dist/button.d.ts +54 -0
- package/dist/button.js +19 -0
- package/dist/chunk-2RIWL363.js +27 -0
- package/dist/chunk-2TQSHVXA.js +12 -0
- package/dist/chunk-7EOSDFS3.js +10 -0
- package/dist/chunk-C2HKIPLQ.js +118 -0
- package/dist/chunk-CAJLW6K2.js +16 -0
- package/dist/chunk-CZJZYN54.js +36 -0
- package/dist/chunk-EE4V6XMB.js +35 -0
- package/dist/chunk-EFHRRLAW.js +211 -0
- package/dist/chunk-GLB75NT3.js +21 -0
- package/dist/chunk-GX2YEJ43.js +36 -0
- package/dist/chunk-LTOLV67A.js +19 -0
- package/dist/chunk-LZMX27IZ.js +10 -0
- package/dist/chunk-NIIDYIZA.js +1 -0
- package/dist/chunk-Q4PPM2SU.js +97 -0
- package/dist/chunk-WVE2E37B.js +20 -0
- package/dist/chunk-XRZHP6BD.js +92 -0
- package/dist/disclosure.d.ts +72 -0
- package/dist/disclosure.js +221 -0
- package/dist/display.d.ts +111 -0
- package/dist/display.js +237 -0
- package/dist/floating.d.ts +81 -0
- package/dist/floating.js +231 -0
- package/dist/hooks.d.ts +33 -0
- package/dist/hooks.js +55 -0
- package/dist/icons/lucide.d.ts +77 -0
- package/dist/icons/lucide.js +135 -0
- package/dist/icons/mui-map.d.ts +1268 -0
- package/dist/icons/mui-map.js +352 -0
- package/dist/icons.d.ts +48 -0
- package/dist/icons.js +19 -0
- package/dist/index.d.ts +238 -3
- package/dist/index.js +242 -15
- package/dist/input.d.ts +14 -0
- package/dist/input.js +8 -0
- package/dist/layout/mui-map.d.ts +80 -0
- package/dist/layout/mui-map.js +104 -0
- package/dist/layout.d.ts +89 -0
- package/dist/layout.js +455 -0
- package/dist/lib.d.ts +11 -0
- package/dist/lib.js +6 -0
- package/dist/menu.d.ts +105 -0
- package/dist/menu.js +56 -0
- package/dist/modal.d.ts +105 -0
- package/dist/modal.js +273 -0
- package/dist/motion.css +295 -0
- package/dist/pagination.d.ts +82 -0
- package/dist/pagination.js +211 -0
- package/dist/presets.d.ts +97 -0
- package/dist/presets.js +94 -0
- package/dist/progress.d.ts +70 -0
- package/dist/progress.js +138 -0
- package/dist/react.d.ts +81 -0
- package/dist/react.js +281 -0
- package/dist/responsive-YJBnvsjt.d.ts +69 -0
- package/dist/scroll-area.d.ts +30 -0
- package/dist/scroll-area.js +80 -0
- package/dist/shared-Fkx-sjPt.d.ts +15 -0
- package/dist/spinner.d.ts +18 -0
- package/dist/spinner.js +39 -0
- package/dist/split-button.d.ts +32 -0
- package/dist/split-button.js +54 -0
- package/dist/stepper.d.ts +27 -0
- package/dist/stepper.js +104 -0
- package/dist/styles.css +24 -0
- package/dist/table.d.ts +52 -0
- package/dist/table.js +124 -0
- package/dist/theme.d.ts +111 -0
- package/dist/theme.js +414 -0
- package/dist/toast.d.ts +77 -0
- package/dist/toast.js +203 -0
- package/dist/toggle.d.ts +55 -0
- package/dist/toggle.js +88 -0
- package/dist/tokens.css +337 -0
- package/dist/transition.d.ts +51 -0
- package/dist/transition.js +79 -0
- package/dist/types-BBudf463.d.ts +39 -0
- package/dist/typography/mui-map.d.ts +91 -0
- package/dist/typography/mui-map.js +62 -0
- package/dist/typography.d.ts +90 -0
- package/dist/typography.js +193 -0
- package/dist/useSignal-C-3ZGURN.d.ts +21 -0
- package/dist/variants-De0c0ucO.d.ts +60 -0
- package/package.json +167 -12
package/dist/display.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import {
|
|
2
|
+
motionPresets
|
|
3
|
+
} from "./chunk-GLB75NT3.js";
|
|
4
|
+
import {
|
|
5
|
+
Icon
|
|
6
|
+
} from "./chunk-Q4PPM2SU.js";
|
|
7
|
+
import {
|
|
8
|
+
cn
|
|
9
|
+
} from "./chunk-7EOSDFS3.js";
|
|
10
|
+
|
|
11
|
+
// src/components/display/alert.tsx
|
|
12
|
+
import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from "lucide-react";
|
|
13
|
+
import { forwardRef } from "react";
|
|
14
|
+
|
|
15
|
+
// src/components/display/status.ts
|
|
16
|
+
var STATUS = {
|
|
17
|
+
info: {
|
|
18
|
+
token: "info",
|
|
19
|
+
textToken: "info",
|
|
20
|
+
alert: "border-info/30 bg-info/10",
|
|
21
|
+
badge: "border-transparent bg-info/15 text-info",
|
|
22
|
+
icon: "text-info"
|
|
23
|
+
},
|
|
24
|
+
success: {
|
|
25
|
+
token: "success",
|
|
26
|
+
textToken: "success",
|
|
27
|
+
alert: "border-success/30 bg-success/10",
|
|
28
|
+
badge: "border-transparent bg-success/15 text-success",
|
|
29
|
+
icon: "text-success"
|
|
30
|
+
},
|
|
31
|
+
warning: {
|
|
32
|
+
token: "warning",
|
|
33
|
+
textToken: "warning-text",
|
|
34
|
+
alert: "border-warning/40 bg-warning/10",
|
|
35
|
+
badge: "border-transparent bg-warning/15 text-warning-text",
|
|
36
|
+
icon: "text-warning-text"
|
|
37
|
+
},
|
|
38
|
+
destructive: {
|
|
39
|
+
token: "destructive",
|
|
40
|
+
textToken: "destructive",
|
|
41
|
+
alert: "border-destructive/30 bg-destructive/10",
|
|
42
|
+
badge: "border-transparent bg-destructive/10 text-destructive",
|
|
43
|
+
icon: "text-destructive"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/components/display/alert.tsx
|
|
48
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
49
|
+
var DEFAULT_ICONS = {
|
|
50
|
+
info: Info,
|
|
51
|
+
success: CircleCheck,
|
|
52
|
+
warning: TriangleAlert,
|
|
53
|
+
destructive: CircleAlert
|
|
54
|
+
};
|
|
55
|
+
var Alert = forwardRef(function Alert2({ variant = "info", icon, onDismiss, dismissLabel = "Dismiss", className, children, ...props }, ref) {
|
|
56
|
+
const status = STATUS[variant];
|
|
57
|
+
const role = variant === "warning" || variant === "destructive" ? "alert" : "status";
|
|
58
|
+
return /* @__PURE__ */ jsxs(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
ref,
|
|
62
|
+
role,
|
|
63
|
+
className: cn(
|
|
64
|
+
"relative flex w-full items-start gap-3 rounded-lg border p-4 text-sm text-foreground",
|
|
65
|
+
status.alert,
|
|
66
|
+
onDismiss && "pr-11",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
...props,
|
|
70
|
+
children: [
|
|
71
|
+
icon === void 0 ? /* @__PURE__ */ jsx(Icon, { icon: DEFAULT_ICONS[variant], className: cn("mt-0.5", status.icon) }) : icon,
|
|
72
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 space-y-1", children }),
|
|
73
|
+
onDismiss && /* @__PURE__ */ jsx(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
type: "button",
|
|
77
|
+
"aria-label": dismissLabel,
|
|
78
|
+
onClick: onDismiss,
|
|
79
|
+
className: "absolute top-3 right-3 rounded-sm p-1 opacity-70 outline-none transition-opacity duration-(--motion-duration-fast) hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring",
|
|
80
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: X, size: "sm" })
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
var AlertTitle = forwardRef(
|
|
88
|
+
function AlertTitle2({ className, ...props }, ref) {
|
|
89
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("font-medium leading-none", className), ...props });
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
var AlertDescription = forwardRef(
|
|
93
|
+
function AlertDescription2({ className, ...props }, ref) {
|
|
94
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("text-sm leading-relaxed", className), ...props });
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// src/components/display/badge.tsx
|
|
99
|
+
import { cva } from "class-variance-authority";
|
|
100
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
101
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
102
|
+
var badgeVariants = cva(
|
|
103
|
+
"inline-flex shrink-0 items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium whitespace-nowrap",
|
|
104
|
+
{
|
|
105
|
+
variants: {
|
|
106
|
+
variant: {
|
|
107
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
108
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
109
|
+
outline: "border-border text-foreground",
|
|
110
|
+
destructive: STATUS.destructive.badge,
|
|
111
|
+
success: STATUS.success.badge,
|
|
112
|
+
warning: STATUS.warning.badge,
|
|
113
|
+
info: STATUS.info.badge
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
defaultVariants: { variant: "default" }
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
var Badge = forwardRef2(function Badge2({ variant, className, ...props }, ref) {
|
|
120
|
+
return /* @__PURE__ */ jsx2("span", { ref, className: cn(badgeVariants({ variant }), className), ...props });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// src/components/display/card.tsx
|
|
124
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
125
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
126
|
+
var Card = forwardRef3(function Card2({ className, ...props }, ref) {
|
|
127
|
+
return /* @__PURE__ */ jsx3(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
ref,
|
|
131
|
+
className: cn(
|
|
132
|
+
"rounded-xl border border-border bg-card text-card-foreground shadow-elevation-1",
|
|
133
|
+
className
|
|
134
|
+
),
|
|
135
|
+
...props
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
var CardHeader = forwardRef3(function CardHeader2({ className, ...props }, ref) {
|
|
140
|
+
return /* @__PURE__ */ jsx3("div", { ref, className: cn("flex flex-col gap-1.5 p-6", className), ...props });
|
|
141
|
+
});
|
|
142
|
+
var CardTitle = forwardRef3(function CardTitle2({ as: Component = "h3", className, ...props }, ref) {
|
|
143
|
+
return /* @__PURE__ */ jsx3(
|
|
144
|
+
Component,
|
|
145
|
+
{
|
|
146
|
+
ref,
|
|
147
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
148
|
+
...props
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
});
|
|
152
|
+
var CardDescription = forwardRef3(function CardDescription2({ className, ...props }, ref) {
|
|
153
|
+
return /* @__PURE__ */ jsx3("div", { ref, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
154
|
+
});
|
|
155
|
+
var CardContent = forwardRef3(function CardContent2({ className, ...props }, ref) {
|
|
156
|
+
return /* @__PURE__ */ jsx3("div", { ref, className: cn("px-6 pb-6", className), ...props });
|
|
157
|
+
});
|
|
158
|
+
var CardFooter = forwardRef3(function CardFooter2({ className, ...props }, ref) {
|
|
159
|
+
return /* @__PURE__ */ jsx3("div", { ref, className: cn("flex items-center px-6 pb-6", className), ...props });
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// src/components/display/chip.tsx
|
|
163
|
+
import { X as X2 } from "lucide-react";
|
|
164
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
165
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
166
|
+
var Chip = forwardRef4(function Chip2({ onRemove, removeLabel, className, children, ...props }, ref) {
|
|
167
|
+
const label = removeLabel ?? (typeof children === "string" ? `Remove ${children}` : "Remove");
|
|
168
|
+
return /* @__PURE__ */ jsxs2(Badge, { ref, className: cn(onRemove && "pr-1", className), ...props, children: [
|
|
169
|
+
children,
|
|
170
|
+
onRemove && /* @__PURE__ */ jsx4(
|
|
171
|
+
"button",
|
|
172
|
+
{
|
|
173
|
+
type: "button",
|
|
174
|
+
"aria-label": label,
|
|
175
|
+
onClick: onRemove,
|
|
176
|
+
className: "rounded-sm p-0.5 outline-none transition-colors duration-(--motion-duration-fast) hover:bg-foreground/10 focus-visible:ring-2 focus-visible:ring-ring",
|
|
177
|
+
children: /* @__PURE__ */ jsx4(Icon, { icon: X2, size: "xs" })
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
] });
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// src/components/display/empty-state.tsx
|
|
184
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
185
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
186
|
+
var EmptyState = forwardRef5(function EmptyState2({ title, description, icon, action, headingLevel = 3, className, ...props }, ref) {
|
|
187
|
+
const Title = `h${headingLevel}`;
|
|
188
|
+
return /* @__PURE__ */ jsxs3(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
ref,
|
|
192
|
+
className: cn("flex flex-col items-center gap-2 px-6 py-10 text-center", className),
|
|
193
|
+
...props,
|
|
194
|
+
children: [
|
|
195
|
+
icon && /* @__PURE__ */ jsx5("div", { className: "text-muted-foreground", children: icon }),
|
|
196
|
+
/* @__PURE__ */ jsx5(Title, { className: "text-lg font-semibold tracking-tight text-foreground", children: title }),
|
|
197
|
+
description && /* @__PURE__ */ jsx5("p", { className: "max-w-sm text-sm text-muted-foreground", children: description }),
|
|
198
|
+
action && /* @__PURE__ */ jsx5("div", { className: "mt-2", children: action })
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// src/components/display/skeleton.tsx
|
|
205
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
206
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
207
|
+
var Skeleton = forwardRef6(function Skeleton2({ animate = true, shimmer = false, className, ...props }, ref) {
|
|
208
|
+
return /* @__PURE__ */ jsx6(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
ref,
|
|
212
|
+
"aria-hidden": "true",
|
|
213
|
+
className: cn(
|
|
214
|
+
"rounded-md bg-muted",
|
|
215
|
+
animate && (shimmer ? motionPresets.shimmer : "animate-pulse"),
|
|
216
|
+
className
|
|
217
|
+
),
|
|
218
|
+
...props
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
export {
|
|
223
|
+
Alert,
|
|
224
|
+
AlertDescription,
|
|
225
|
+
AlertTitle,
|
|
226
|
+
Badge,
|
|
227
|
+
Card,
|
|
228
|
+
CardContent,
|
|
229
|
+
CardDescription,
|
|
230
|
+
CardFooter,
|
|
231
|
+
CardHeader,
|
|
232
|
+
CardTitle,
|
|
233
|
+
Chip,
|
|
234
|
+
EmptyState,
|
|
235
|
+
Skeleton,
|
|
236
|
+
badgeVariants
|
|
237
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as _base_ui_react from '@base-ui/react';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
4
|
+
import { PreviewCard } from '@base-ui/react/preview-card';
|
|
5
|
+
import { P as PositionProps } from './shared-Fkx-sjPt.js';
|
|
6
|
+
export { A as Align, S as Side } from './shared-Fkx-sjPt.js';
|
|
7
|
+
import { Popover as Popover$1 } from '@base-ui/react/popover';
|
|
8
|
+
import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Shared tooltip timing. Hovering waits `TOOLTIP_DELAY_MS` before a tooltip shows, so sweeping
|
|
12
|
+
* the pointer across a toolbar does not flash every tip; once one is showing, its neighbours
|
|
13
|
+
* open at once (Base UI's provider handles that grouping). Closing is immediate.
|
|
14
|
+
*/
|
|
15
|
+
declare const TOOLTIP_DELAY_MS = 500;
|
|
16
|
+
declare const TOOLTIP_CLOSE_DELAY_MS = 0;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A preview of a link's target, shown on hover and keyboard focus of the link. The link works
|
|
20
|
+
* without the card, so the card must only ever be a convenience: it is not announced as a
|
|
21
|
+
* dialog, it does not open on touch, and nothing in it may be the only way to reach something.
|
|
22
|
+
*/
|
|
23
|
+
declare const HoverCard: <Payload>(props: PreviewCard.Root.Props<Payload>) => react.JSX.Element;
|
|
24
|
+
/** The link the card previews. Renders an `<a>`: give it an `href`. */
|
|
25
|
+
declare const HoverCardTrigger: PreviewCard.Trigger;
|
|
26
|
+
type HoverCardContentProps = Omit<ComponentPropsWithoutRef<typeof PreviewCard.Popup>, "className"> & PositionProps & {
|
|
27
|
+
className?: string;
|
|
28
|
+
};
|
|
29
|
+
declare const HoverCardContent: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.PreviewCardPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & PositionProps & {
|
|
30
|
+
className?: string;
|
|
31
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A panel anchored to a button, opened by click or Enter and Space. Focus moves into it, Tab
|
|
35
|
+
* moves through its content, and Escape or an outside click closes it and returns focus to the
|
|
36
|
+
* trigger. Use it for anything interactive; for a short label use `Tooltip`.
|
|
37
|
+
*/
|
|
38
|
+
declare const Popover: typeof Popover$1.Root;
|
|
39
|
+
declare const PopoverTrigger: Popover$1.Trigger;
|
|
40
|
+
/** Closes the popover. Put it inside `PopoverContent`. */
|
|
41
|
+
declare const PopoverClose: react.ForwardRefExoticComponent<Omit<_base_ui_react.PopoverCloseProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
type PopoverContentProps = Omit<ComponentPropsWithoutRef<typeof Popover$1.Popup>, "className"> & PositionProps & {
|
|
43
|
+
className?: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The panel. It is named by `PopoverTitle` (or `aria-label`) and described by
|
|
47
|
+
* `PopoverDescription`. Its size is capped to the space available, so it scrolls instead of
|
|
48
|
+
* running off the viewport.
|
|
49
|
+
*/
|
|
50
|
+
declare const PopoverContent: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.PopoverPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & PositionProps & {
|
|
51
|
+
className?: string;
|
|
52
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
declare const PopoverTitle: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.PopoverTitleProps, "ref"> & react.RefAttributes<HTMLHeadingElement>, "ref">, "className"> & {
|
|
54
|
+
className?: string;
|
|
55
|
+
} & react.RefAttributes<HTMLHeadingElement>>;
|
|
56
|
+
declare const PopoverDescription: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.PopoverDescriptionProps, "ref"> & react.RefAttributes<HTMLParagraphElement>, "ref">, "className"> & {
|
|
57
|
+
className?: string;
|
|
58
|
+
} & react.RefAttributes<HTMLParagraphElement>>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Shares one delay across every tooltip inside it: the first waits `delay`, then its neighbours
|
|
62
|
+
* open at once while one is showing. Wrap a toolbar, or the app.
|
|
63
|
+
*/
|
|
64
|
+
declare function TooltipProvider({ delay, closeDelay, ...props }: ComponentPropsWithoutRef<typeof Tooltip$1.Provider>): react.JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* A short label for a control, shown on hover and keyboard focus. It describes the trigger
|
|
67
|
+
* (`aria-describedby` while open), is dismissed with Escape, and never takes the pointer.
|
|
68
|
+
*
|
|
69
|
+
* Touch: there is no hover, so it does not open on touch. Never put essential information in a
|
|
70
|
+
* tooltip; use a `Popover` when people on touch devices need the content.
|
|
71
|
+
*/
|
|
72
|
+
declare function Tooltip({ open, defaultOpen, onOpenChange, ...props }: ComponentPropsWithoutRef<typeof Tooltip$1.Root>): react.JSX.Element;
|
|
73
|
+
declare const TooltipTrigger: react.ForwardRefExoticComponent<Omit<Tooltip$1.Trigger.Props<unknown> & react.RefAttributes<HTMLElement>, "ref"> & react.RefAttributes<HTMLElement>>;
|
|
74
|
+
type TooltipContentProps = Omit<ComponentPropsWithoutRef<typeof Tooltip$1.Popup>, "className"> & PositionProps & {
|
|
75
|
+
className?: string;
|
|
76
|
+
};
|
|
77
|
+
declare const TooltipContent: react.ForwardRefExoticComponent<Omit<Omit<Omit<_base_ui_react.TooltipPopupProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref">, "className"> & PositionProps & {
|
|
78
|
+
className?: string;
|
|
79
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
80
|
+
|
|
81
|
+
export { HoverCard, HoverCardContent, type HoverCardContentProps, HoverCardTrigger, Popover, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverTitle, PopoverTrigger, PositionProps, TOOLTIP_CLOSE_DELAY_MS, TOOLTIP_DELAY_MS, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger };
|
package/dist/floating.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
FLOATING_MOTION,
|
|
4
|
+
POSITION_DEFAULTS
|
|
5
|
+
} from "./chunk-LZMX27IZ.js";
|
|
6
|
+
import {
|
|
7
|
+
cn
|
|
8
|
+
} from "./chunk-2TQSHVXA.js";
|
|
9
|
+
|
|
10
|
+
// src/components/floating/delays.ts
|
|
11
|
+
var TOOLTIP_DELAY_MS = 500;
|
|
12
|
+
var TOOLTIP_CLOSE_DELAY_MS = 0;
|
|
13
|
+
|
|
14
|
+
// src/components/floating/hover-card.tsx
|
|
15
|
+
import { forwardRef } from "react";
|
|
16
|
+
|
|
17
|
+
// src/primitives/preview-card.ts
|
|
18
|
+
import { PreviewCard } from "@base-ui/react/preview-card";
|
|
19
|
+
|
|
20
|
+
// src/components/floating/hover-card.tsx
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
var HoverCard = PreviewCard.Root;
|
|
23
|
+
var HoverCardTrigger = PreviewCard.Trigger;
|
|
24
|
+
var HoverCardContent = forwardRef(
|
|
25
|
+
function HoverCardContent2({
|
|
26
|
+
side,
|
|
27
|
+
align,
|
|
28
|
+
sideOffset = POSITION_DEFAULTS.sideOffset,
|
|
29
|
+
collisionPadding = POSITION_DEFAULTS.collisionPadding,
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}, ref) {
|
|
33
|
+
return /* @__PURE__ */ jsx(PreviewCard.Portal, { children: /* @__PURE__ */ jsx(
|
|
34
|
+
PreviewCard.Positioner,
|
|
35
|
+
{
|
|
36
|
+
side,
|
|
37
|
+
align,
|
|
38
|
+
sideOffset,
|
|
39
|
+
collisionPadding,
|
|
40
|
+
className: "z-(--z-popover)",
|
|
41
|
+
children: /* @__PURE__ */ jsx(
|
|
42
|
+
PreviewCard.Popup,
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
className: cn(
|
|
46
|
+
"max-h-(--available-height) w-64 max-w-(--available-width) overflow-auto rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-elevation-3 outline-none",
|
|
47
|
+
FLOATING_MOTION,
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
) });
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// src/components/floating/popover.tsx
|
|
59
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
60
|
+
|
|
61
|
+
// src/primitives/popover.ts
|
|
62
|
+
import { Popover } from "@base-ui/react/popover";
|
|
63
|
+
|
|
64
|
+
// src/components/floating/popover.tsx
|
|
65
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
66
|
+
var Popover2 = Popover.Root;
|
|
67
|
+
var PopoverTrigger = Popover.Trigger;
|
|
68
|
+
var PopoverClose = Popover.Close;
|
|
69
|
+
var PopoverContent = forwardRef2(
|
|
70
|
+
function PopoverContent2({
|
|
71
|
+
side,
|
|
72
|
+
align,
|
|
73
|
+
sideOffset = POSITION_DEFAULTS.sideOffset,
|
|
74
|
+
collisionPadding = POSITION_DEFAULTS.collisionPadding,
|
|
75
|
+
className,
|
|
76
|
+
...props
|
|
77
|
+
}, ref) {
|
|
78
|
+
return /* @__PURE__ */ jsx2(Popover.Portal, { children: /* @__PURE__ */ jsx2(
|
|
79
|
+
Popover.Positioner,
|
|
80
|
+
{
|
|
81
|
+
side,
|
|
82
|
+
align,
|
|
83
|
+
sideOffset,
|
|
84
|
+
collisionPadding,
|
|
85
|
+
className: "z-(--z-popover)",
|
|
86
|
+
children: /* @__PURE__ */ jsx2(
|
|
87
|
+
Popover.Popup,
|
|
88
|
+
{
|
|
89
|
+
ref,
|
|
90
|
+
className: cn(
|
|
91
|
+
"max-h-(--available-height) w-72 max-w-(--available-width) overflow-auto rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-elevation-3 outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
92
|
+
FLOATING_MOTION,
|
|
93
|
+
className
|
|
94
|
+
),
|
|
95
|
+
...props
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
) });
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
var PopoverTitle = forwardRef2(function PopoverTitle2({ className, ...props }, ref) {
|
|
103
|
+
return /* @__PURE__ */ jsx2(
|
|
104
|
+
Popover.Title,
|
|
105
|
+
{
|
|
106
|
+
ref,
|
|
107
|
+
className: cn("text-sm font-medium leading-none", className),
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
var PopoverDescription = forwardRef2(function PopoverDescription2({ className, ...props }, ref) {
|
|
113
|
+
return /* @__PURE__ */ jsx2(
|
|
114
|
+
Popover.Description,
|
|
115
|
+
{
|
|
116
|
+
ref,
|
|
117
|
+
className: cn("mt-1 text-sm text-muted-foreground", className),
|
|
118
|
+
...props
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// src/components/floating/tooltip.tsx
|
|
124
|
+
import {
|
|
125
|
+
createContext,
|
|
126
|
+
forwardRef as forwardRef3,
|
|
127
|
+
useContext,
|
|
128
|
+
useId,
|
|
129
|
+
useState
|
|
130
|
+
} from "react";
|
|
131
|
+
|
|
132
|
+
// src/primitives/tooltip.ts
|
|
133
|
+
import { Tooltip } from "@base-ui/react/tooltip";
|
|
134
|
+
|
|
135
|
+
// src/components/floating/tooltip.tsx
|
|
136
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
137
|
+
function TooltipProvider({
|
|
138
|
+
delay = TOOLTIP_DELAY_MS,
|
|
139
|
+
closeDelay = TOOLTIP_CLOSE_DELAY_MS,
|
|
140
|
+
...props
|
|
141
|
+
}) {
|
|
142
|
+
return /* @__PURE__ */ jsx3(Tooltip.Provider, { delay, closeDelay, ...props });
|
|
143
|
+
}
|
|
144
|
+
var TooltipLink = createContext(null);
|
|
145
|
+
function Tooltip2({
|
|
146
|
+
open,
|
|
147
|
+
defaultOpen = false,
|
|
148
|
+
onOpenChange,
|
|
149
|
+
...props
|
|
150
|
+
}) {
|
|
151
|
+
const id = useId();
|
|
152
|
+
const [internal, setInternal] = useState(defaultOpen);
|
|
153
|
+
const isOpen = open ?? internal;
|
|
154
|
+
return /* @__PURE__ */ jsx3(TooltipLink.Provider, { value: { id, open: isOpen }, children: /* @__PURE__ */ jsx3(
|
|
155
|
+
Tooltip.Root,
|
|
156
|
+
{
|
|
157
|
+
open: isOpen,
|
|
158
|
+
onOpenChange: (next, details) => {
|
|
159
|
+
setInternal(next);
|
|
160
|
+
onOpenChange?.(next, details);
|
|
161
|
+
},
|
|
162
|
+
...props
|
|
163
|
+
}
|
|
164
|
+
) });
|
|
165
|
+
}
|
|
166
|
+
var TooltipTrigger = forwardRef3(function TooltipTrigger2(props, ref) {
|
|
167
|
+
const link = useContext(TooltipLink);
|
|
168
|
+
return /* @__PURE__ */ jsx3(
|
|
169
|
+
Tooltip.Trigger,
|
|
170
|
+
{
|
|
171
|
+
ref,
|
|
172
|
+
"aria-describedby": link?.open ? link.id : void 0,
|
|
173
|
+
...props
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
});
|
|
177
|
+
var TooltipContent = forwardRef3(
|
|
178
|
+
function TooltipContent2({
|
|
179
|
+
side,
|
|
180
|
+
align,
|
|
181
|
+
sideOffset = POSITION_DEFAULTS.sideOffset,
|
|
182
|
+
collisionPadding = POSITION_DEFAULTS.collisionPadding,
|
|
183
|
+
className,
|
|
184
|
+
...props
|
|
185
|
+
}, ref) {
|
|
186
|
+
const link = useContext(TooltipLink);
|
|
187
|
+
return /* @__PURE__ */ jsx3(Tooltip.Portal, { children: /* @__PURE__ */ jsx3(
|
|
188
|
+
Tooltip.Positioner,
|
|
189
|
+
{
|
|
190
|
+
side,
|
|
191
|
+
align,
|
|
192
|
+
sideOffset,
|
|
193
|
+
collisionPadding,
|
|
194
|
+
className: "z-(--z-tooltip)",
|
|
195
|
+
children: /* @__PURE__ */ jsx3(
|
|
196
|
+
Tooltip.Popup,
|
|
197
|
+
{
|
|
198
|
+
ref,
|
|
199
|
+
id: link?.id,
|
|
200
|
+
role: "tooltip",
|
|
201
|
+
className: cn(
|
|
202
|
+
"pointer-events-none max-w-xs rounded-md bg-foreground px-2 py-1 text-xs text-background shadow-elevation-2",
|
|
203
|
+
FLOATING_MOTION,
|
|
204
|
+
// Moving from one tooltip to the next must not replay the animation.
|
|
205
|
+
"data-[instant]:transition-none",
|
|
206
|
+
className
|
|
207
|
+
),
|
|
208
|
+
...props
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
) });
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
export {
|
|
216
|
+
HoverCard,
|
|
217
|
+
HoverCardContent,
|
|
218
|
+
HoverCardTrigger,
|
|
219
|
+
Popover2 as Popover,
|
|
220
|
+
PopoverClose,
|
|
221
|
+
PopoverContent,
|
|
222
|
+
PopoverDescription,
|
|
223
|
+
PopoverTitle,
|
|
224
|
+
PopoverTrigger,
|
|
225
|
+
TOOLTIP_CLOSE_DELAY_MS,
|
|
226
|
+
TOOLTIP_DELAY_MS,
|
|
227
|
+
Tooltip2 as Tooltip,
|
|
228
|
+
TooltipContent,
|
|
229
|
+
TooltipProvider,
|
|
230
|
+
TooltipTrigger
|
|
231
|
+
};
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { u as useSignal } from './useSignal-C-3ZGURN.js';
|
|
2
|
+
import '@azmr/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether the person has asked their system for reduced motion. It follows the setting while the app
|
|
6
|
+
* is open. On the server, and during hydration, it is `false`, so there is no mismatch; the global CSS
|
|
7
|
+
* already collapses animations for these people, so this is for JavaScript-driven motion (a count-up, a
|
|
8
|
+
* view transition) that CSS cannot reach.
|
|
9
|
+
*/
|
|
10
|
+
declare function useReducedMotion(): boolean;
|
|
11
|
+
|
|
12
|
+
interface UseUrlTabOptions<T extends string> {
|
|
13
|
+
/** The search parameter that holds the tab. Default `tab`. */
|
|
14
|
+
param?: string;
|
|
15
|
+
/** The tabs the URL may select. Anything else in the URL is ignored. */
|
|
16
|
+
values: readonly T[];
|
|
17
|
+
/** The tab when the URL says nothing (or something not in `values`). Its URL has no parameter. */
|
|
18
|
+
defaultValue: T;
|
|
19
|
+
/** `replace` (default) rewrites the current entry; `push` adds a history entry per change. */
|
|
20
|
+
history?: "replace" | "push";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Keeps the selected tab in the URL (`?tab=billing`), so a tab can be linked to, reloaded, and
|
|
24
|
+
* reached with the back button. Router-agnostic: it reads and writes `window.location` and the
|
|
25
|
+
* History API.
|
|
26
|
+
*
|
|
27
|
+
* The URL is untrusted input: a value that is not in `values` is ignored, never passed on. On the
|
|
28
|
+
* server, and during hydration, the value is `defaultValue`, so there is no mismatch; it then
|
|
29
|
+
* follows the URL. Use it with `Tabs`: `<Tabs value={tab} onValueChange={setTab}>`.
|
|
30
|
+
*/
|
|
31
|
+
declare function useUrlTab<T extends string>({ param, values, defaultValue, history, }: UseUrlTabOptions<T>): [T, (next: T) => void];
|
|
32
|
+
|
|
33
|
+
export { type UseUrlTabOptions, useReducedMotion, useUrlTab };
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useReducedMotion
|
|
4
|
+
} from "./chunk-WVE2E37B.js";
|
|
5
|
+
import {
|
|
6
|
+
useSignal
|
|
7
|
+
} from "./chunk-CAJLW6K2.js";
|
|
8
|
+
|
|
9
|
+
// src/use-url-tab.ts
|
|
10
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
11
|
+
var URL_CHANGE = "azmr:urlchange";
|
|
12
|
+
function useUrlTab({
|
|
13
|
+
param = "tab",
|
|
14
|
+
values,
|
|
15
|
+
defaultValue,
|
|
16
|
+
history = "replace"
|
|
17
|
+
}) {
|
|
18
|
+
const valuesKey = values.join("\0");
|
|
19
|
+
const value = useSyncExternalStore(
|
|
20
|
+
useCallback((notify) => {
|
|
21
|
+
window.addEventListener("popstate", notify);
|
|
22
|
+
window.addEventListener(URL_CHANGE, notify);
|
|
23
|
+
return () => {
|
|
24
|
+
window.removeEventListener("popstate", notify);
|
|
25
|
+
window.removeEventListener(URL_CHANGE, notify);
|
|
26
|
+
};
|
|
27
|
+
}, []),
|
|
28
|
+
() => {
|
|
29
|
+
const raw = new URLSearchParams(window.location.search).get(param);
|
|
30
|
+
return raw !== null && values.includes(raw) ? raw : defaultValue;
|
|
31
|
+
},
|
|
32
|
+
() => defaultValue
|
|
33
|
+
);
|
|
34
|
+
const setValue = useCallback(
|
|
35
|
+
(next) => {
|
|
36
|
+
if (!valuesKey.split("\0").includes(next)) {
|
|
37
|
+
throw new TypeError(`useUrlTab: "${next}" is not one of the allowed tabs`);
|
|
38
|
+
}
|
|
39
|
+
const url = new URL(window.location.href);
|
|
40
|
+
if (next === defaultValue) url.searchParams.delete(param);
|
|
41
|
+
else url.searchParams.set(param, next);
|
|
42
|
+
const target = `${url.pathname}${url.search}${url.hash}`;
|
|
43
|
+
if (history === "push") window.history.pushState(window.history.state, "", target);
|
|
44
|
+
else window.history.replaceState(window.history.state, "", target);
|
|
45
|
+
window.dispatchEvent(new Event(URL_CHANGE));
|
|
46
|
+
},
|
|
47
|
+
[param, valuesKey, defaultValue, history]
|
|
48
|
+
);
|
|
49
|
+
return [value, setValue];
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
useReducedMotion,
|
|
53
|
+
useSignal,
|
|
54
|
+
useUrlTab
|
|
55
|
+
};
|