margo-ui 4.0.2 → 5.0.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/package.json +1 -1
- package/src/css/custom-variant.css +0 -1
- package/src/index.ts +0 -4
- package/src/components/navigation_bar/navigation_bar.css +0 -21
- package/src/components/navigation_bar/navigation_bar.tsx +0 -70
- package/src/components/navigation_bar/style.ts +0 -6
- package/src/components/navigation_bar/type.ts +0 -9
- package/src/components/splash/splash.css +0 -19
- package/src/components/splash/splash.tsx +0 -25
- package/src/components/splash/style.ts +0 -3
- package/src/components/splash/type.ts +0 -12
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -11,12 +11,10 @@ export { Label } from "./components/label/label.js";
|
|
|
11
11
|
export { Layer } from "./components/layer/layer.js";
|
|
12
12
|
export { Input } from "./components/input/input.js";
|
|
13
13
|
export { Item } from "./components/item/item.js";
|
|
14
|
-
export { NavigationBar } from "./components/navigation_bar/navigation_bar.js";
|
|
15
14
|
export { Popover } from "./components/popover/popover.js";
|
|
16
15
|
export { ProgressBar } from "./components/progress_bar/progress_bar.js";
|
|
17
16
|
export { Table } from "./components/table/table.js";
|
|
18
17
|
export { Toggle } from "./components/toggle/toggle.js";
|
|
19
|
-
export { Splash } from "./components/splash/splash.js";
|
|
20
18
|
export { Select } from "./components/select/select.js";
|
|
21
19
|
export { Sheet } from "./components/sheet/sheet.js";
|
|
22
20
|
export { Spinner } from "./components/spinner/spinner.js";
|
|
@@ -62,7 +60,6 @@ export type { LabelOwnProps, LabelProps } from "./components/label/type.js";
|
|
|
62
60
|
export type { LayerProps } from "./components/layer/type.js";
|
|
63
61
|
export type { InputIconProps, InputProps, InputTextProps } from "./components/input/type.js";
|
|
64
62
|
export type { ItemIconProps, ItemLabelProps, ItemProps } from "./components/item/type.js";
|
|
65
|
-
export type { NavigationBarProps } from "./components/navigation_bar/type.js";
|
|
66
63
|
export type { PopoverAlign, PopoverAnchorProps, PopoverBodyProps, PopoverPosition, PopoverProps } from "./components/popover/type.js";
|
|
67
64
|
export type { ProgressBarMode, ProgressBarProps } from "./components/progress_bar/type.js";
|
|
68
65
|
export type {
|
|
@@ -73,7 +70,6 @@ export type {
|
|
|
73
70
|
TableProps,
|
|
74
71
|
TableRowProps,
|
|
75
72
|
} from "./components/table/type.js";
|
|
76
|
-
export type { SplashProps, SplashServeProps } from "./components/splash/type.js";
|
|
77
73
|
export type { SelectOwnProps, SelectProps } from "./components/select/type.js";
|
|
78
74
|
export type { SheetBodyProps, SheetFooterProps, SheetProps, SheetSide } from "./components/sheet/type.js";
|
|
79
75
|
export type { SpinnerProps } from "./components/spinner/type.js";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.margo-navigation-bar {
|
|
2
|
-
position: relative;
|
|
3
|
-
height: 100%;
|
|
4
|
-
width: var(--margo-navigation-bar-progress, 0%);
|
|
5
|
-
background: var(--margo-navigation-bar-fill);
|
|
6
|
-
transition: width 200ms ease-out;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.margo-navigation-bar::after {
|
|
10
|
-
content: "";
|
|
11
|
-
position: absolute;
|
|
12
|
-
top: 0;
|
|
13
|
-
right: 0;
|
|
14
|
-
height: 100%;
|
|
15
|
-
width: 6.25rem;
|
|
16
|
-
transform: rotate(3deg) translateY(-0.25rem);
|
|
17
|
-
opacity: 0.9;
|
|
18
|
-
box-shadow:
|
|
19
|
-
0 0 10px var(--margo-color-primary),
|
|
20
|
-
0 0 5px var(--margo-color-primary);
|
|
21
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { Tag } from "react-renderable";
|
|
4
|
-
|
|
5
|
-
import { cn } from "../../utils/cn/cn.js";
|
|
6
|
-
import { navigationBarBaseClassName, navigationBarDefaultFill, navigationBarTrackClassName } from "./style.js";
|
|
7
|
-
|
|
8
|
-
import type { CSSProperties, ElementType } from "react";
|
|
9
|
-
import type { NavigationBarProps } from "./type.js";
|
|
10
|
-
|
|
11
|
-
import "./navigation_bar.css";
|
|
12
|
-
|
|
13
|
-
const TRICKLE_MS = 200;
|
|
14
|
-
const TRICKLE_CEILING = 90;
|
|
15
|
-
const TRICKLE_RATIO = 0.12;
|
|
16
|
-
const START_PROGRESS = 8;
|
|
17
|
-
const HOLD_MS = 300;
|
|
18
|
-
const FADE_MS = 400;
|
|
19
|
-
|
|
20
|
-
export const NavigationBar = <T extends ElementType = "div">({
|
|
21
|
-
loading = false,
|
|
22
|
-
fill = navigationBarDefaultFill,
|
|
23
|
-
className,
|
|
24
|
-
...rest
|
|
25
|
-
}: NavigationBarProps<T>) => {
|
|
26
|
-
const [progress, setProgress] = useState(0);
|
|
27
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
28
|
-
const timeoutRef = useRef<number | undefined>(undefined);
|
|
29
|
-
const resetRef = useRef<number | undefined>(undefined);
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (loading) {
|
|
33
|
-
window.clearTimeout(timeoutRef.current);
|
|
34
|
-
window.clearTimeout(resetRef.current);
|
|
35
|
-
setIsVisible(true);
|
|
36
|
-
setProgress(START_PROGRESS);
|
|
37
|
-
|
|
38
|
-
const interval = window.setInterval(
|
|
39
|
-
() => setProgress((current) => current + (TRICKLE_CEILING - current) * TRICKLE_RATIO),
|
|
40
|
-
TRICKLE_MS,
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
return () => window.clearInterval(interval);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
setProgress((current) => (current > 0 ? 100 : 0));
|
|
47
|
-
|
|
48
|
-
timeoutRef.current = window.setTimeout(() => setIsVisible(false), HOLD_MS);
|
|
49
|
-
resetRef.current = window.setTimeout(() => setProgress(0), HOLD_MS + FADE_MS);
|
|
50
|
-
|
|
51
|
-
return () => {
|
|
52
|
-
window.clearTimeout(timeoutRef.current);
|
|
53
|
-
window.clearTimeout(resetRef.current);
|
|
54
|
-
};
|
|
55
|
-
}, [loading]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<Tag
|
|
59
|
-
{...Tag.forward<T>(rest)}
|
|
60
|
-
role="progressbar"
|
|
61
|
-
aria-hidden={!isVisible}
|
|
62
|
-
style={
|
|
63
|
-
{ "--margo-navigation-bar-fill": fill, "--margo-navigation-bar-progress": `${progress}%` } as CSSProperties
|
|
64
|
-
}
|
|
65
|
-
className={cn(navigationBarBaseClassName, isVisible ? "opacity-100" : "opacity-0", className)}
|
|
66
|
-
>
|
|
67
|
-
<div className={navigationBarTrackClassName} />
|
|
68
|
-
</Tag>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export const navigationBarDefaultFill = "linear-gradient(to right, var(--margo-color-primary-darken), var(--margo-color-primary))";
|
|
2
|
-
|
|
3
|
-
export const navigationBarBaseClassName =
|
|
4
|
-
"fixed inset-x-0 top-0 z-max h-0.5 pointer-events-none transition-opacity duration-200 ease-out";
|
|
5
|
-
|
|
6
|
-
export const navigationBarTrackClassName = "margo-navigation-bar";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TagProps } from "react-renderable";
|
|
2
|
-
import type { ElementType } from "react";
|
|
3
|
-
|
|
4
|
-
export type NavigationBarOwnProps = {
|
|
5
|
-
loading?: boolean;
|
|
6
|
-
fill?: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type NavigationBarProps<T extends ElementType = "div"> = TagProps<T, NavigationBarOwnProps>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
@layer components {
|
|
2
|
-
[data-margo-splash] {
|
|
3
|
-
visibility: visible;
|
|
4
|
-
clip-path: circle(150% at 50% 50%);
|
|
5
|
-
transition:
|
|
6
|
-
clip-path 2500ms ease-out,
|
|
7
|
-
visibility 2500ms ease-out;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
:root:not(:has([data-margo-splash-serve])) [data-margo-splash] {
|
|
11
|
-
visibility: hidden;
|
|
12
|
-
clip-path: circle(0% at 50% 50%);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
:root:has([data-margo-splash-serve][data-margo-splash-instant]) [data-margo-splash] {
|
|
17
|
-
transition-duration: 0ms;
|
|
18
|
-
transition-delay: 0ms;
|
|
19
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Tag } from "react-renderable";
|
|
2
|
-
|
|
3
|
-
import type { ElementType } from "react";
|
|
4
|
-
import type { SplashProps, SplashServeProps } from "./type.js";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../utils/cn/cn.js";
|
|
7
|
-
import { splashBaseClassName, splashOverrideClassName } from "./style.js";
|
|
8
|
-
|
|
9
|
-
import "./splash.css";
|
|
10
|
-
|
|
11
|
-
export const Splash = <T extends ElementType = "div">({ initial = true, className, ...rest }: SplashProps<T>) => (
|
|
12
|
-
<Tag
|
|
13
|
-
{...Tag.forward<T>(rest)}
|
|
14
|
-
inert
|
|
15
|
-
aria-hidden={true}
|
|
16
|
-
role="presentation"
|
|
17
|
-
data-margo-splash=""
|
|
18
|
-
data-margo-splash-initial={initial}
|
|
19
|
-
className={cn(splashBaseClassName, className && splashOverrideClassName, className)}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
Splash.Serve = ({ instant = false }: SplashServeProps) => (
|
|
24
|
-
<span hidden data-margo-splash-serve="" data-margo-splash-instant={instant || undefined} />
|
|
25
|
-
);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from "react";
|
|
2
|
-
import type { TagProps } from "react-renderable";
|
|
3
|
-
|
|
4
|
-
export type SplashOwnProps = {
|
|
5
|
-
initial?: boolean;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type SplashProps<T extends ElementType = "div"> = TagProps<T, SplashOwnProps>;
|
|
9
|
-
|
|
10
|
-
export type SplashServeProps = {
|
|
11
|
-
instant?: boolean;
|
|
12
|
-
};
|