margo-ui 1.2.3 → 1.3.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 +20 -4
- package/package.json +11 -1
- package/src/components/button/button.tsx +4 -4
- package/src/components/button/style.ts +3 -3
- package/src/components/button/type.ts +3 -3
- package/src/components/button_micro/button_micro.tsx +37 -0
- package/src/components/button_micro/style.ts +6 -0
- package/src/components/button_micro/type.ts +10 -0
- package/src/components/dialog/dialog.tsx +25 -0
- package/src/components/dialog/style.ts +6 -0
- package/src/components/dialog/type.ts +8 -0
- package/src/components/header/header.tsx +36 -0
- package/src/components/header/style.ts +8 -0
- package/src/components/header/type.ts +20 -0
- package/src/components/item/item.tsx +57 -0
- package/src/components/item/style.ts +13 -0
- package/src/components/item/type.ts +20 -0
- package/src/components/layer/layer.css +51 -0
- package/src/components/layer/layer.tsx +44 -0
- package/src/components/layer/style.ts +2 -0
- package/src/components/layer/type.ts +8 -0
- package/src/components/navigation_bar/navigation_bar.css +21 -0
- package/src/components/navigation_bar/navigation_bar.tsx +70 -0
- package/src/components/navigation_bar/style.ts +6 -0
- package/src/components/navigation_bar/type.ts +9 -0
- package/src/components/progress_bar/progress_bar.css +4 -7
- package/src/components/progress_bar/progress_bar.tsx +7 -4
- package/src/components/progress_bar/style.ts +2 -0
- package/src/components/progress_bar/type.ts +1 -0
- package/src/components/sheet/sheet.css +41 -0
- package/src/components/sheet/sheet.tsx +32 -0
- package/src/components/sheet/style.ts +14 -0
- package/src/components/sheet/type.ts +14 -0
- package/src/components/snippet/highlight.ts +83 -0
- package/src/components/snippet/snippet.tsx +63 -0
- package/src/components/snippet/style.ts +25 -0
- package/src/components/snippet/type.ts +26 -0
- package/src/components/table/style.ts +13 -0
- package/src/components/table/table.tsx +60 -0
- package/src/components/table/type.ts +14 -0
- package/src/components/tooltip/tooltip.tsx +7 -7
- package/src/components/tooltip/type.ts +2 -2
- package/src/css/grid.css +20 -0
- package/src/css/theme.css +8 -0
- package/src/css/variables.css +41 -3
- package/src/hoc/background_glow/background_glow.css +19 -9
- package/src/hoc/background_glow/background_glow.tsx +11 -4
- package/src/hoc/background_glow/style.ts +0 -8
- package/src/hoc/background_glow/type.ts +5 -4
- package/src/hoc/mask_gradient_x/mask_gradient_x.css +17 -0
- package/src/hoc/mask_gradient_x/mask_gradient_x.tsx +22 -0
- package/src/hoc/mask_gradient_x/type.ts +15 -0
- package/src/index.ts +33 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { cloneElement } from "react";
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../utils/cn/cn.js";
|
|
4
|
-
import { backgroundGlowBaseClassName
|
|
4
|
+
import { backgroundGlowBaseClassName } from "./style.js";
|
|
5
5
|
|
|
6
|
-
import type { PointerEvent } from "react";
|
|
6
|
+
import type { CSSProperties, PointerEvent } from "react";
|
|
7
7
|
import type { BackgroundGlowProps } from "./type.js";
|
|
8
8
|
|
|
9
9
|
import "./background_glow.css";
|
|
10
10
|
|
|
11
|
-
export const BackgroundGlow = ({ children,
|
|
11
|
+
export const BackgroundGlow = ({ children, tolerance = 1, opacity = 0.2, noise = 0.04 }: BackgroundGlowProps) => {
|
|
12
12
|
const handlePointerMove = (event: PointerEvent<HTMLElement>) => {
|
|
13
13
|
const bounds = event.currentTarget.getBoundingClientRect();
|
|
14
|
+
const spread = Math.max(bounds.width, bounds.height) * Math.min(Math.max(tolerance, 0), 1);
|
|
14
15
|
|
|
16
|
+
event.currentTarget.style.setProperty("--margo-background-glow-size", `${spread}px`);
|
|
15
17
|
event.currentTarget.style.setProperty("--margo-background-glow-x", `${event.clientX - bounds.left}px`);
|
|
16
18
|
event.currentTarget.style.setProperty("--margo-background-glow-y", `${event.clientY - bounds.top}px`);
|
|
17
19
|
|
|
@@ -19,7 +21,12 @@ export const BackgroundGlow = ({ children, size = "md" }: BackgroundGlowProps) =
|
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
return cloneElement(children, {
|
|
22
|
-
className: cn(backgroundGlowBaseClassName,
|
|
24
|
+
className: cn(backgroundGlowBaseClassName, children.props.className),
|
|
25
|
+
style: {
|
|
26
|
+
...children.props.style,
|
|
27
|
+
"--margo-background-glow-opacity": opacity,
|
|
28
|
+
"--margo-background-glow-noise-opacity": noise,
|
|
29
|
+
} as CSSProperties,
|
|
23
30
|
onPointerMove: handlePointerMove,
|
|
24
31
|
});
|
|
25
32
|
};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import type { BackgroundGlowSize } from "./type.js";
|
|
2
|
-
|
|
3
1
|
export const backgroundGlowBaseClassName = "relative isolate margo-background-glow";
|
|
4
|
-
|
|
5
|
-
export const backgroundGlowSizeClassName: Record<BackgroundGlowSize, string> = {
|
|
6
|
-
sm: "margo-background-glow--size-sm",
|
|
7
|
-
md: "margo-background-glow--size-md",
|
|
8
|
-
lg: "margo-background-glow--size-lg",
|
|
9
|
-
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type { PointerEventHandler, ReactElement } from "react";
|
|
2
|
-
|
|
3
|
-
export type BackgroundGlowSize = "sm" | "md" | "lg";
|
|
1
|
+
import type { CSSProperties, PointerEventHandler, ReactElement } from "react";
|
|
4
2
|
|
|
5
3
|
export type BackgroundGlowChildProps = {
|
|
6
4
|
className?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
7
6
|
onPointerMove?: PointerEventHandler<HTMLElement>;
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
export type BackgroundGlowProps = {
|
|
11
10
|
children: ReactElement<BackgroundGlowChildProps>;
|
|
12
|
-
|
|
11
|
+
tolerance?: number;
|
|
12
|
+
opacity?: number;
|
|
13
|
+
noise?: number;
|
|
13
14
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.margo-mask-gradient-x {
|
|
2
|
+
--margo-mask-gradient-x-offset-left: 0px;
|
|
3
|
+
--margo-mask-gradient-x-offset-right: 0px;
|
|
4
|
+
--margo-mask-gradient-x-fade-left: 2rem;
|
|
5
|
+
--margo-mask-gradient-x-fade-right: 2rem;
|
|
6
|
+
|
|
7
|
+
--margo-mask-gradient-x-image: linear-gradient(
|
|
8
|
+
to right,
|
|
9
|
+
transparent var(--margo-mask-gradient-x-offset-left),
|
|
10
|
+
#000 calc(var(--margo-mask-gradient-x-offset-left) + var(--margo-mask-gradient-x-fade-left)),
|
|
11
|
+
#000 calc(100% - var(--margo-mask-gradient-x-offset-right) - var(--margo-mask-gradient-x-fade-right)),
|
|
12
|
+
transparent calc(100% - var(--margo-mask-gradient-x-offset-right))
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
-webkit-mask-image: var(--margo-mask-gradient-x-image);
|
|
16
|
+
mask-image: var(--margo-mask-gradient-x-image);
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cloneElement } from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
4
|
+
|
|
5
|
+
import type { CSSProperties } from "react";
|
|
6
|
+
import type { MaskGradientXProps } from "./type.js";
|
|
7
|
+
|
|
8
|
+
import "./mask_gradient_x.css";
|
|
9
|
+
|
|
10
|
+
export const MaskGradientX = ({ children, fade, fadeLeft, fadeRight, offsetLeft, offsetRight }: MaskGradientXProps) => {
|
|
11
|
+
const style = {
|
|
12
|
+
"--margo-mask-gradient-x-offset-left": offsetLeft,
|
|
13
|
+
"--margo-mask-gradient-x-offset-right": offsetRight,
|
|
14
|
+
"--margo-mask-gradient-x-fade-left": fadeLeft ?? fade,
|
|
15
|
+
"--margo-mask-gradient-x-fade-right": fadeRight ?? fade,
|
|
16
|
+
} as CSSProperties;
|
|
17
|
+
|
|
18
|
+
return cloneElement(children, {
|
|
19
|
+
className: cn("margo-mask-gradient-x", children.props.className),
|
|
20
|
+
style: { ...style, ...children.props.style },
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement } from "react";
|
|
2
|
+
|
|
3
|
+
export type MaskGradientXChildProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type MaskGradientXProps = {
|
|
9
|
+
children: ReactElement<MaskGradientXChildProps>;
|
|
10
|
+
fade?: string;
|
|
11
|
+
fadeLeft?: string;
|
|
12
|
+
fadeRight?: string;
|
|
13
|
+
offsetLeft?: string;
|
|
14
|
+
offsetRight?: string;
|
|
15
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
export { Blockquote } from "./components/blockquote/blockquote.js";
|
|
2
2
|
export { Button } from "./components/button/button.js";
|
|
3
|
+
export { ButtonMicro } from "./components/button_micro/button_micro.js";
|
|
3
4
|
export { Card } from "./components/card/card.js";
|
|
4
5
|
export { Chip } from "./components/chip/chip.js";
|
|
6
|
+
export { Dialog } from "./components/dialog/dialog.js";
|
|
7
|
+
export { Header } from "./components/header/header.js";
|
|
8
|
+
export { Layer } from "./components/layer/layer.js";
|
|
9
|
+
export { Item } from "./components/item/item.js";
|
|
10
|
+
export { NavigationBar } from "./components/navigation_bar/navigation_bar.js";
|
|
5
11
|
export { ProgressBar } from "./components/progress_bar/progress_bar.js";
|
|
12
|
+
export { Table } from "./components/table/table.js";
|
|
6
13
|
export { Splash } from "./components/splash/splash.js";
|
|
14
|
+
export { Sheet } from "./components/sheet/sheet.js";
|
|
15
|
+
export { Snippet } from "./components/snippet/snippet.js";
|
|
7
16
|
export { Spinner } from "./components/spinner/spinner.js";
|
|
8
17
|
export { Tooltip } from "./components/tooltip/tooltip.js";
|
|
9
18
|
|
|
10
19
|
export { BackgroundGlow } from "./hoc/background_glow/background_glow.js";
|
|
11
20
|
export { BorderGlow } from "./hoc/border_glow/border_glow.js";
|
|
21
|
+
export { MaskGradientX } from "./hoc/mask_gradient_x/mask_gradient_x.js";
|
|
12
22
|
export { MaskGradientY } from "./hoc/mask_gradient_y/mask_gradient_y.js";
|
|
13
23
|
export { Ripple } from "./hoc/ripple/ripple.js";
|
|
14
24
|
|
|
@@ -28,15 +38,37 @@ export type {
|
|
|
28
38
|
ButtonLabelProps,
|
|
29
39
|
ButtonProps,
|
|
30
40
|
} from "./components/button/type.js";
|
|
41
|
+
export type { ButtonMicroProps } from "./components/button_micro/type.js";
|
|
31
42
|
export type { CardProps } from "./components/card/type.js";
|
|
32
43
|
export type { ChipProps } from "./components/chip/type.js";
|
|
44
|
+
export type { DialogBodyProps, DialogFooterProps, DialogProps } from "./components/dialog/type.js";
|
|
45
|
+
export type {
|
|
46
|
+
HeaderLeadingProps,
|
|
47
|
+
HeaderProps,
|
|
48
|
+
HeaderTitleProps,
|
|
49
|
+
HeaderTrailingProps,
|
|
50
|
+
} from "./components/header/type.js";
|
|
51
|
+
export type { LayerProps } from "./components/layer/type.js";
|
|
52
|
+
export type { ItemIconProps, ItemLabelProps, ItemProps } from "./components/item/type.js";
|
|
53
|
+
export type { NavigationBarProps } from "./components/navigation_bar/type.js";
|
|
33
54
|
export type { ProgressBarMode, ProgressBarProps } from "./components/progress_bar/type.js";
|
|
55
|
+
export type {
|
|
56
|
+
TableBodyProps,
|
|
57
|
+
TableCellProps,
|
|
58
|
+
TableHeadCellProps,
|
|
59
|
+
TableHeadProps,
|
|
60
|
+
TableProps,
|
|
61
|
+
TableRowProps,
|
|
62
|
+
} from "./components/table/type.js";
|
|
34
63
|
export type { SplashProps, SplashServeProps } from "./components/splash/type.js";
|
|
64
|
+
export type { SheetBodyProps, SheetFooterProps, SheetProps, SheetSide } from "./components/sheet/type.js";
|
|
65
|
+
export type { SnippetProps, SnippetToken, SnippetTokenType } from "./components/snippet/type.js";
|
|
35
66
|
export type { SpinnerProps } from "./components/spinner/type.js";
|
|
36
67
|
export type { TooltipPosition, TooltipProps } from "./components/tooltip/type.js";
|
|
37
68
|
|
|
38
|
-
export type { BackgroundGlowProps
|
|
69
|
+
export type { BackgroundGlowProps } from "./hoc/background_glow/type.js";
|
|
39
70
|
export type { BorderGlowPosition, BorderGlowProps } from "./hoc/border_glow/type.js";
|
|
71
|
+
export type { MaskGradientXProps } from "./hoc/mask_gradient_x/type.js";
|
|
40
72
|
export type { MaskGradientYProps } from "./hoc/mask_gradient_y/type.js";
|
|
41
73
|
export type { RippleProps } from "./hoc/ripple/type.js";
|
|
42
74
|
|