margo-ui 1.2.2 → 1.2.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "margo-ui",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "A small React UI kit built on Tailwind CSS v4 design tokens, themeable through plain CSS custom properties.",
5
5
  "keywords": [
6
6
  "react",
@@ -18,7 +18,7 @@
18
18
 
19
19
  .margo-progress-bar[data-mode="indeterminate"]::before {
20
20
  inset: 0 auto 0 0;
21
- width: 40%;
21
+ width: 50%;
22
22
  animation: margo-progress-bar-indeterminate 800ms ease-in-out infinite;
23
23
  }
24
24
 
@@ -10,10 +10,10 @@ import "./progress_bar.css";
10
10
 
11
11
  export const ProgressBar = <T extends ElementType = "div">({
12
12
  animate = true,
13
- className,
14
13
  mode = "indeterminate",
15
14
  style,
16
15
  value = 0,
16
+ className,
17
17
  ...rest
18
18
  }: ProgressBarProps<T>) => {
19
19
  const isDeterminate = mode === "determinate";
@@ -0,0 +1,19 @@
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
+ }
@@ -0,0 +1,27 @@
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 "./splash.css";
8
+
9
+ export const Splash = <T extends ElementType = "div">({ initial = true, className, ...rest }: SplashProps<T>) => (
10
+ <Tag
11
+ {...Tag.forward<T>(rest)}
12
+ inert
13
+ aria-hidden={true}
14
+ role="presentation"
15
+ data-margo-splash=""
16
+ data-margo-splash-initial={initial}
17
+ className={cn(
18
+ "fixed inset-0 z-max",
19
+ className && "[clip-path:none] margo-splash-idle:[clip-path:none]",
20
+ className,
21
+ )}
22
+ />
23
+ );
24
+
25
+ Splash.Serve = ({ instant = false }: SplashServeProps) => (
26
+ <span hidden data-margo-splash-serve="" data-margo-splash-instant={instant || undefined} />
27
+ );
@@ -0,0 +1 @@
1
+ export const splashBaseClassName = "margo-splash";
@@ -0,0 +1,12 @@
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
+ };
@@ -1 +1,2 @@
1
1
  @custom-variant dark (&:where(.dark, .dark *));
2
+ @custom-variant margo-splash-idle (:root:not(:has([data-margo-splash-serve])) &);
@@ -5,7 +5,7 @@
5
5
  pointer-events: none;
6
6
  opacity: 0;
7
7
  background: radial-gradient(
8
- 480px circle at var(--margo-border-glow-x, 70%) var(--margo-border-glow-y, 70%),
8
+ var(--margo-border-glow-size, 480px) circle at var(--margo-border-glow-x, 70%) var(--margo-border-glow-y, 70%),
9
9
  var(--color-primary-darken),
10
10
  transparent 70%
11
11
  );
@@ -8,12 +8,14 @@ import type { BorderGlowProps } from "./type.js";
8
8
 
9
9
  import "./border_glow.css";
10
10
 
11
- export const BorderGlow = ({ children, position = "all" }: BorderGlowProps) => {
11
+ export const BorderGlow = ({ children, position = "all", tolerance = 1 }: BorderGlowProps) => {
12
12
  const handlePointerMove = (event: PointerEvent<HTMLElement>) => {
13
13
  const bounds = event.currentTarget.getBoundingClientRect();
14
14
  const x = event.clientX - bounds.left;
15
15
  const y = event.clientY - bounds.top;
16
+ const size = Math.max(bounds.width, bounds.height) * Math.min(Math.max(tolerance, 0), 1);
16
17
 
18
+ event.currentTarget.style.setProperty("--margo-border-glow-size", `${size}px`);
17
19
  event.currentTarget.style.setProperty("--margo-border-glow-x", `${position === "right" ? bounds.width - x : x}px`);
18
20
  event.currentTarget.style.setProperty("--margo-border-glow-y", `${position === "down" ? bounds.height - y : y}px`);
19
21
 
@@ -10,4 +10,5 @@ export type BorderGlowChildProps = {
10
10
  export type BorderGlowProps = {
11
11
  children: ReactElement<BorderGlowChildProps>;
12
12
  position?: BorderGlowPosition;
13
+ tolerance?: number;
13
14
  };
@@ -0,0 +1,17 @@
1
+ .margo-mask-gradient-y {
2
+ --margo-mask-gradient-y-offset-top: 0px;
3
+ --margo-mask-gradient-y-offset-bottom: 0px;
4
+ --margo-mask-gradient-y-fade-top: 2rem;
5
+ --margo-mask-gradient-y-fade-bottom: 2rem;
6
+
7
+ --margo-mask-gradient-y-image: linear-gradient(
8
+ to bottom,
9
+ transparent var(--margo-mask-gradient-y-offset-top),
10
+ #000 calc(var(--margo-mask-gradient-y-offset-top) + var(--margo-mask-gradient-y-fade-top)),
11
+ #000 calc(100% - var(--margo-mask-gradient-y-offset-bottom) - var(--margo-mask-gradient-y-fade-bottom)),
12
+ transparent calc(100% - var(--margo-mask-gradient-y-offset-bottom))
13
+ );
14
+
15
+ -webkit-mask-image: var(--margo-mask-gradient-y-image);
16
+ mask-image: var(--margo-mask-gradient-y-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 { MaskGradientYProps } from "./type.js";
7
+
8
+ import "./mask_gradient_y.css";
9
+
10
+ export const MaskGradientY = ({ children, fade, fadeTop, fadeBottom, offsetTop, offsetBottom }: MaskGradientYProps) => {
11
+ const style = {
12
+ "--margo-mask-gradient-y-offset-top": offsetTop,
13
+ "--margo-mask-gradient-y-offset-bottom": offsetBottom,
14
+ "--margo-mask-gradient-y-fade-top": fadeTop ?? fade,
15
+ "--margo-mask-gradient-y-fade-bottom": fadeBottom ?? fade,
16
+ } as CSSProperties;
17
+
18
+ return cloneElement(children, {
19
+ className: cn("margo-mask-gradient-y", 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 MaskGradientYChildProps = {
4
+ className?: string;
5
+ style?: CSSProperties;
6
+ };
7
+
8
+ export type MaskGradientYProps = {
9
+ children: ReactElement<MaskGradientYChildProps>;
10
+ fade?: string;
11
+ fadeTop?: string;
12
+ fadeBottom?: string;
13
+ offsetTop?: string;
14
+ offsetBottom?: string;
15
+ };
package/src/index.ts CHANGED
@@ -3,11 +3,13 @@ export { Button } from "./components/button/button.js";
3
3
  export { Card } from "./components/card/card.js";
4
4
  export { Chip } from "./components/chip/chip.js";
5
5
  export { ProgressBar } from "./components/progress_bar/progress_bar.js";
6
+ export { Splash } from "./components/splash/splash.js";
6
7
  export { Spinner } from "./components/spinner/spinner.js";
7
8
  export { Tooltip } from "./components/tooltip/tooltip.js";
8
9
 
9
10
  export { BackgroundGlow } from "./hoc/background_glow/background_glow.js";
10
11
  export { BorderGlow } from "./hoc/border_glow/border_glow.js";
12
+ export { MaskGradientY } from "./hoc/mask_gradient_y/mask_gradient_y.js";
11
13
  export { Ripple } from "./hoc/ripple/ripple.js";
12
14
 
13
15
  export { MetaColorScheme } from "./meta/meta_color_scheme/meta_color_scheme.js";
@@ -29,11 +31,13 @@ export type {
29
31
  export type { CardProps } from "./components/card/type.js";
30
32
  export type { ChipProps } from "./components/chip/type.js";
31
33
  export type { ProgressBarMode, ProgressBarProps } from "./components/progress_bar/type.js";
34
+ export type { SplashProps, SplashServeProps } from "./components/splash/type.js";
32
35
  export type { SpinnerProps } from "./components/spinner/type.js";
33
36
  export type { TooltipPosition, TooltipProps } from "./components/tooltip/type.js";
34
37
 
35
38
  export type { BackgroundGlowProps, BackgroundGlowSize } from "./hoc/background_glow/type.js";
36
39
  export type { BorderGlowPosition, BorderGlowProps } from "./hoc/border_glow/type.js";
40
+ export type { MaskGradientYProps } from "./hoc/mask_gradient_y/type.js";
37
41
  export type { RippleProps } from "./hoc/ripple/type.js";
38
42
 
39
43
  export type { MargoTheme, MargoThemeClient } from "./utils/theme/type.js";