@mlola-ui/registry 1.0.11 → 1.0.13
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/components/accordion.json +2 -2
- package/components/alert.json +1 -1
- package/components/app-shell.json +1 -1
- package/components/badge.json +1 -1
- package/components/breadcrumb.json +2 -2
- package/components/button.json +1 -1
- package/components/calendar.json +1 -1
- package/components/carousel.json +3 -3
- package/components/checkbox.json +1 -1
- package/components/color-picker.json +1 -1
- package/components/combobox.json +1 -1
- package/components/command-menu.json +1 -1
- package/components/context-menu.json +3 -3
- package/components/copy-button.json +1 -1
- package/components/date-picker.json +1 -1
- package/components/dropdown-menu.json +2 -2
- package/components/dropzone.json +1 -1
- package/components/hover-card.json +2 -2
- package/components/modal.json +2 -2
- package/components/number-input.json +1 -1
- package/components/pagination.json +1 -1
- package/components/password-input.json +2 -2
- package/components/popover.json +2 -2
- package/components/segmented-control.json +1 -1
- package/components/select.json +3 -3
- package/components/sheet.json +2 -2
- package/components/slider.json +1 -1
- package/components/stepper.json +1 -1
- package/components/tabs.json +1 -1
- package/components/tag-input.json +1 -1
- package/components/time-picker.json +1 -1
- package/components/timeline.json +1 -1
- package/components/toast.json +1 -1
- package/components/tooltip.json +10 -2
- package/components/tour.json +3 -3
- package/generated/catalog.js +51 -44
- package/generated/examples.json +6 -1
- package/index.json +1 -1
- package/package.json +1 -1
- package/snapshot/index.json +61 -53
- package/snapshot/items/components/accordion.json +2 -2
- package/snapshot/items/components/alert.json +1 -1
- package/snapshot/items/components/app-shell.json +1 -1
- package/snapshot/items/components/badge.json +1 -1
- package/snapshot/items/components/breadcrumb.json +2 -2
- package/snapshot/items/components/button.json +1 -1
- package/snapshot/items/components/calendar.json +1 -1
- package/snapshot/items/components/carousel.json +3 -3
- package/snapshot/items/components/checkbox.json +1 -1
- package/snapshot/items/components/color-picker.json +1 -1
- package/snapshot/items/components/combobox.json +1 -1
- package/snapshot/items/components/command-menu.json +1 -1
- package/snapshot/items/components/context-menu.json +3 -3
- package/snapshot/items/components/copy-button.json +1 -1
- package/snapshot/items/components/date-picker.json +1 -1
- package/snapshot/items/components/dropdown-menu.json +2 -2
- package/snapshot/items/components/dropzone.json +1 -1
- package/snapshot/items/components/hover-card.json +2 -2
- package/snapshot/items/components/modal.json +2 -2
- package/snapshot/items/components/number-input.json +1 -1
- package/snapshot/items/components/pagination.json +1 -1
- package/snapshot/items/components/password-input.json +2 -2
- package/snapshot/items/components/popover.json +2 -2
- package/snapshot/items/components/segmented-control.json +1 -1
- package/snapshot/items/components/select.json +3 -3
- package/snapshot/items/components/sheet.json +2 -2
- package/snapshot/items/components/slider.json +1 -1
- package/snapshot/items/components/stepper.json +1 -1
- package/snapshot/items/components/tabs.json +1 -1
- package/snapshot/items/components/tag-input.json +1 -1
- package/snapshot/items/components/time-picker.json +1 -1
- package/snapshot/items/components/timeline.json +1 -1
- package/snapshot/items/components/toast.json +1 -1
- package/snapshot/items/components/tooltip.json +10 -2
- package/snapshot/items/components/tour.json +3 -3
- package/snapshot/source/packages/components/_internal/anchor.ts +1 -1
- package/snapshot/source/packages/components/breadcrumb/breadcrumb.tsx +18 -4
- package/snapshot/source/packages/components/carousel/carousel.tsx +1 -0
- package/snapshot/source/packages/components/tooltip/tooltip.tsx +26 -2
- package/snapshot/source-manifest.json +4 -4
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"registryDependencies": [],
|
|
20
20
|
"engineDependencies": {
|
|
21
|
-
"@mlola-ui/behavior": "^1.0.
|
|
21
|
+
"@mlola-ui/behavior": "^1.0.13"
|
|
22
22
|
},
|
|
23
23
|
"options": [
|
|
24
24
|
{
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"path": "packages/components/_internal/anchor.ts",
|
|
51
51
|
"target": "{{aliases.components}}/_internal/anchor.ts",
|
|
52
52
|
"type": "registry:ui",
|
|
53
|
-
"integrity": "sha256
|
|
53
|
+
"integrity": "sha256-/yW3RVjoY6QfTWnUYSeZ9rFkC9W4WGB1qop8Jp/H1r8="
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
"path": "packages/components/_internal/floating.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"registryDependencies": [],
|
|
20
20
|
"engineDependencies": {
|
|
21
|
-
"@mlola-ui/behavior": "^1.0.
|
|
22
|
-
"@mlola-ui/icons": "^1.0.
|
|
21
|
+
"@mlola-ui/behavior": "^1.0.13",
|
|
22
|
+
"@mlola-ui/icons": "^1.0.13"
|
|
23
23
|
},
|
|
24
24
|
"options": [
|
|
25
25
|
{
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"path": "packages/components/_internal/anchor.ts",
|
|
44
44
|
"target": "{{aliases.components}}/_internal/anchor.ts",
|
|
45
45
|
"type": "registry:ui",
|
|
46
|
-
"integrity": "sha256
|
|
46
|
+
"integrity": "sha256-/yW3RVjoY6QfTWnUYSeZ9rFkC9W4WGB1qop8Jp/H1r8="
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"path": "packages/components/_internal/floating.ts",
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"isDefault": false
|
|
24
24
|
},
|
|
25
25
|
"registryDependencies": [],
|
|
26
|
-
"engineDependencies": {
|
|
26
|
+
"engineDependencies": {
|
|
27
|
+
"@mlola-ui/behavior": "^1.0.13"
|
|
28
|
+
},
|
|
27
29
|
"options": [
|
|
28
30
|
{
|
|
29
31
|
"component": "Tooltip",
|
|
@@ -40,6 +42,12 @@
|
|
|
40
42
|
"variants": [],
|
|
41
43
|
"sizes": [],
|
|
42
44
|
"files": [
|
|
45
|
+
{
|
|
46
|
+
"path": "packages/components/_internal/anchor.ts",
|
|
47
|
+
"target": "{{aliases.components}}/_internal/anchor.ts",
|
|
48
|
+
"type": "registry:ui",
|
|
49
|
+
"integrity": "sha256-/yW3RVjoY6QfTWnUYSeZ9rFkC9W4WGB1qop8Jp/H1r8="
|
|
50
|
+
},
|
|
43
51
|
{
|
|
44
52
|
"path": "packages/components/_internal/react.ts",
|
|
45
53
|
"target": "{{aliases.components}}/_internal/react.ts",
|
|
@@ -50,7 +58,7 @@
|
|
|
50
58
|
"path": "packages/components/tooltip/tooltip.tsx",
|
|
51
59
|
"target": "{{aliases.components}}/tooltip.tsx",
|
|
52
60
|
"type": "registry:ui",
|
|
53
|
-
"integrity": "sha256-
|
|
61
|
+
"integrity": "sha256-hplqwWF/ZqQQ9oyoErrOA3VjkRCDCbqwt5xgZOdsFcA="
|
|
54
62
|
}
|
|
55
63
|
],
|
|
56
64
|
"themeContract": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"registryDependencies": [],
|
|
22
22
|
"engineDependencies": {
|
|
23
|
-
"@mlola-ui/behavior": "^1.0.
|
|
24
|
-
"@mlola-ui/icons": "^1.0.
|
|
23
|
+
"@mlola-ui/behavior": "^1.0.13",
|
|
24
|
+
"@mlola-ui/icons": "^1.0.13"
|
|
25
25
|
},
|
|
26
26
|
"options": [],
|
|
27
27
|
"variants": [],
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"path": "packages/components/_internal/anchor.ts",
|
|
32
32
|
"target": "{{aliases.components}}/_internal/anchor.ts",
|
|
33
33
|
"type": "registry:ui",
|
|
34
|
-
"integrity": "sha256
|
|
34
|
+
"integrity": "sha256-/yW3RVjoY6QfTWnUYSeZ9rFkC9W4WGB1qop8Jp/H1r8="
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"path": "packages/components/_internal/floating.ts",
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Where a floating layer goes next to its anchor. The math is shared with the
|
|
3
3
|
* framework-free runtime, so it lives in @mlola-ui/behavior/logic.
|
|
4
4
|
*/
|
|
5
|
-
export { placeFloating, type Align, type Placement, type Rect, type Side } from "@mlola-ui/behavior/logic";
|
|
5
|
+
export { fitTooltip, placeFloating, type Align, type Placement, type Rect, type Side } from "@mlola-ui/behavior/logic";
|
|
@@ -4,7 +4,15 @@ import * as React from "react";
|
|
|
4
4
|
import { cx } from "../_internal/react";
|
|
5
5
|
import { IconChevronRight } from "@mlola-ui/icons";
|
|
6
6
|
|
|
7
|
-
export type BreadcrumbItemType = {
|
|
7
|
+
export type BreadcrumbItemType = {
|
|
8
|
+
label: string;
|
|
9
|
+
/** A link to the page. */
|
|
10
|
+
href?: string;
|
|
11
|
+
/** In-app navigation without a URL; the item becomes a button. */
|
|
12
|
+
onSelect?: () => void;
|
|
13
|
+
/** A decorative mark before the label, such as a page's icon. */
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
};
|
|
8
16
|
type BreadcrumbProps = { items: BreadcrumbItemType[]; separator?: React.ReactNode; className?: string };
|
|
9
17
|
|
|
10
18
|
const BreadcrumbList = React.forwardRef<HTMLOListElement, React.OlHTMLAttributes<HTMLOListElement>>(
|
|
@@ -29,6 +37,8 @@ function BreadcrumbEllipsis({ className }: { className?: string }) {
|
|
|
29
37
|
return <span aria-hidden="true" className={cx("ml-breadcrumb-ellipsis", className)}>…</span>;
|
|
30
38
|
}
|
|
31
39
|
|
|
40
|
+
const icon = (item: BreadcrumbItemType) => (item.icon ? <span aria-hidden="true" className="ml-breadcrumb-icon">{item.icon}</span> : null);
|
|
41
|
+
|
|
32
42
|
export function Breadcrumb({ items, separator, className }: BreadcrumbProps) {
|
|
33
43
|
const last = items.length - 1;
|
|
34
44
|
const collapse = items.length > 3;
|
|
@@ -46,9 +56,13 @@ export function Breadcrumb({ items, separator, className }: BreadcrumbProps) {
|
|
|
46
56
|
</BreadcrumbItem>
|
|
47
57
|
) : null}
|
|
48
58
|
<BreadcrumbItem data-collapsible={middle && collapse ? "" : undefined}>
|
|
49
|
-
{current || !item.href
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
{current || (!item.href && !item.onSelect) ? (
|
|
60
|
+
<BreadcrumbPage>{icon(item)}{item.label}</BreadcrumbPage>
|
|
61
|
+
) : item.href ? (
|
|
62
|
+
<BreadcrumbLink href={item.href}>{icon(item)}{item.label}</BreadcrumbLink>
|
|
63
|
+
) : (
|
|
64
|
+
<button type="button" className="ml-breadcrumb-link" data-hit="expand" onClick={item.onSelect}>{icon(item)}{item.label}</button>
|
|
65
|
+
)}
|
|
52
66
|
{!current ? <BreadcrumbSeparator>{separator}</BreadcrumbSeparator> : null}
|
|
53
67
|
</BreadcrumbItem>
|
|
54
68
|
</React.Fragment>
|
|
@@ -180,6 +180,7 @@ export function Carousel({
|
|
|
180
180
|
aria-roledescription="carousel"
|
|
181
181
|
aria-label={label}
|
|
182
182
|
data-playing={playing || undefined}
|
|
183
|
+
data-arrows={(arrows && positions > 1) || undefined}
|
|
183
184
|
style={{ ...style, "--ml-carousel-per-view": view, "--ml-carousel-peek": peek ?? "0px", "--ml-carousel-min": minSlideWidth ?? "0px", "--ml-carousel-autoplay": `${autoplay ?? 0}ms` } as React.CSSProperties}
|
|
184
185
|
onPointerEnter={() => setPaused(true)}
|
|
185
186
|
onPointerLeave={() => setPaused(false)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { fitTooltip, type Side } from "../_internal/anchor";
|
|
4
5
|
import { cx } from "../_internal/react";
|
|
5
6
|
|
|
6
7
|
export type TooltipPlacement = "top" | "bottom" | "left" | "right";
|
|
@@ -14,6 +15,10 @@ interface TooltipProps {
|
|
|
14
15
|
|
|
15
16
|
function Tooltip({ content, placement = "top", delay = 200, children, className }: TooltipProps) {
|
|
16
17
|
const [open, setOpen] = React.useState(false);
|
|
18
|
+
// Where it actually opens: the asked side, flipped or slid to stay on screen.
|
|
19
|
+
const [fit, setFit] = React.useState<{ side: Side; shift: number }>({ side: placement, shift: 0 });
|
|
20
|
+
const root = React.useRef<HTMLSpanElement>(null);
|
|
21
|
+
const tip = React.useRef<HTMLSpanElement>(null);
|
|
17
22
|
const timer = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
18
23
|
const id = React.useId();
|
|
19
24
|
const clear = () => {
|
|
@@ -29,6 +34,17 @@ function Tooltip({ content, placement = "top", delay = 200, children, className
|
|
|
29
34
|
setOpen(false);
|
|
30
35
|
};
|
|
31
36
|
React.useEffect(() => clear, []);
|
|
37
|
+
React.useLayoutEffect(() => {
|
|
38
|
+
const anchor = root.current?.firstElementChild ?? root.current;
|
|
39
|
+
if (!open || !anchor || !tip.current) {
|
|
40
|
+
setFit({ side: placement, shift: 0 });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const a = anchor.getBoundingClientRect();
|
|
44
|
+
// Layout size, not the painted box: the pop-in animation starts scaled down.
|
|
45
|
+
const t = { width: tip.current.offsetWidth, height: tip.current.offsetHeight };
|
|
46
|
+
setFit(fitTooltip({ x: a.left, y: a.top, width: a.width, height: a.height }, t, { width: document.documentElement.clientWidth, height: window.innerHeight }, placement));
|
|
47
|
+
}, [open, placement]);
|
|
32
48
|
React.useEffect(() => {
|
|
33
49
|
if (!open) return;
|
|
34
50
|
const onKeyDown = (event: KeyboardEvent) => {
|
|
@@ -55,10 +71,18 @@ function Tooltip({ content, placement = "top", delay = 200, children, className
|
|
|
55
71
|
: childProps["aria-describedby"],
|
|
56
72
|
} as Record<string, unknown>);
|
|
57
73
|
return (
|
|
58
|
-
<span className="ml-tooltip-root" onMouseEnter={clear} onMouseLeave={hide}>
|
|
74
|
+
<span ref={root} className="ml-tooltip-root" onMouseEnter={clear} onMouseLeave={hide}>
|
|
59
75
|
{trigger}
|
|
60
76
|
{open ? (
|
|
61
|
-
<span
|
|
77
|
+
<span
|
|
78
|
+
ref={tip}
|
|
79
|
+
id={id}
|
|
80
|
+
role="tooltip"
|
|
81
|
+
data-side={fit.side}
|
|
82
|
+
data-state="open"
|
|
83
|
+
className={cx("ml-tooltip", className)}
|
|
84
|
+
style={{ "--ml-tooltip-shift": `${fit.shift}px` } as React.CSSProperties}
|
|
85
|
+
>
|
|
62
86
|
{content}
|
|
63
87
|
<span aria-hidden="true" className="ml-tooltip-arrow" />
|
|
64
88
|
</span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"packages/components/_internal/anchor.ts": "sha256
|
|
2
|
+
"packages/components/_internal/anchor.ts": "sha256-/yW3RVjoY6QfTWnUYSeZ9rFkC9W4WGB1qop8Jp/H1r8=",
|
|
3
3
|
"packages/components/_internal/clipboard.ts": "sha256-0y5p88CTXWuOrUYlC5J4XP1VCrOwkx9jYWVHmD2LouQ=",
|
|
4
4
|
"packages/components/_internal/dialog.ts": "sha256-796y3oNOVWarLvICTdi+d0/2axqSrzLVJiyBeh9X7bU=",
|
|
5
5
|
"packages/components/_internal/floating.ts": "sha256-+WxgC4CtAlSr2qA1EkoDTgto535XLIPsvtOfdOK6CHk=",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"packages/components/app-shell/app-shell.tsx": "sha256-XAq82XOTH3ZR+hxTkYFu8P7Ih2aI6ERy/TpXc2VMUwM=",
|
|
14
14
|
"packages/components/avatar/avatar.tsx": "sha256-EjqC8ytKqRtsTVdK6vncaDfhO/i7ICe+jwaYCg5bjIw=",
|
|
15
15
|
"packages/components/badge/badge.tsx": "sha256-flEH8S2jZ/64n3Y/ROhC9+9rvF7wXaN0xLcMMwqNOVQ=",
|
|
16
|
-
"packages/components/breadcrumb/breadcrumb.tsx": "sha256-
|
|
16
|
+
"packages/components/breadcrumb/breadcrumb.tsx": "sha256-mxQpach2kFayT8H1vMt5252LQLxVV+sohdVXDhPuKoU=",
|
|
17
17
|
"packages/components/button/button.tsx": "sha256-sXVANbGeFSYPHpiWuPvHHqMoPjG0zl0HSsKEdTgl5ME=",
|
|
18
18
|
"packages/components/calendar/calendar.tsx": "sha256-rWiS4YAueZfVoo6j5Fi3uN7A+yApe5U6HMm1woTVjys=",
|
|
19
19
|
"packages/components/calendar/dates.ts": "sha256-mygYkoC70av2ZQ0vkxf885trwW97Wd10I4dptYQe+4A=",
|
|
20
20
|
"packages/components/card/card.tsx": "sha256-aMKbv5DWYYWq7GZAFR9O1fuYE0H61WCjkvEbRMOd894=",
|
|
21
|
-
"packages/components/carousel/carousel.tsx": "sha256-
|
|
21
|
+
"packages/components/carousel/carousel.tsx": "sha256-Gsw0LhQsOuvdQN/F2KDGVC/gJq53+ifLs19u95RWCoU=",
|
|
22
22
|
"packages/components/checkbox/checkbox.tsx": "sha256-hz4YbGwOxv/aJpJHrLXR4MKSWJGyjzoJEIGvdhyML9M=",
|
|
23
23
|
"packages/components/color-picker/color-picker.tsx": "sha256-E+QB6MbSxg+3AZX3A7bOkst4arxgpmFL2ZmochoWCl8=",
|
|
24
24
|
"packages/components/color-picker/color.ts": "sha256-YqSgYjzn7XfPWAHuyzbwOhbg/ScaSfB7V73e9w+OjJs=",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"packages/components/timeline/timeline.tsx": "sha256-nVg7lBcAUAzqEb0YrHagJXSaHE2aWWE9bUbQMWQY6PU=",
|
|
65
65
|
"packages/components/toast/toast.tsx": "sha256-f0DwN0XuV46fSsQf3i9RJcfQbAs2mSz7A8UJoIIICHg=",
|
|
66
66
|
"packages/components/toggle/toggle.tsx": "sha256-8qPHeSliHNdzQS7OLJ47BrvRR75MYyUGJlK4s21XS/U=",
|
|
67
|
-
"packages/components/tooltip/tooltip.tsx": "sha256-
|
|
67
|
+
"packages/components/tooltip/tooltip.tsx": "sha256-hplqwWF/ZqQQ9oyoErrOA3VjkRCDCbqwt5xgZOdsFcA=",
|
|
68
68
|
"packages/components/tour/tour.tsx": "sha256-mrAE8aVDBVIibGvQah9Gh3mzIiWDFxB6aObzqFo5xXU=",
|
|
69
69
|
"packages/components/virtual-list/virtual-list.tsx": "sha256-raGEFn4HlAOIohqZcy0DgptsnUIPS/6bWLYeTe+M9E8=",
|
|
70
70
|
"packages/components/virtual-list/virtual.ts": "sha256-PyDIj3C2Vwb1i4ZssxSlYjgKmZPBIFLZFNq8YCW2Z78="
|