margo-ui 1.3.5 → 1.5.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 +1 -1
- package/package.json +2 -2
- package/src/components/button/button.tsx +1 -1
- package/src/components/button/style.ts +8 -7
- package/src/components/code/code.tsx +16 -0
- package/src/components/code/style.ts +3 -0
- package/src/components/code/type.ts +8 -0
- package/src/components/item/style.ts +2 -1
- package/src/components/spinner/spinner.tsx +1 -1
- package/src/components/spinner/type.ts +1 -1
- package/src/components/table/style.ts +1 -1
- package/src/components/tooltip/type.ts +1 -4
- package/src/css/variables.css +1 -1
- package/src/hoc/ripple/ripple.tsx +3 -3
- package/src/hoc/ripple/type.ts +1 -1
- package/src/index.ts +2 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# margo-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React UI kit built on Tailwind CSS v4 design tokens, themeable through plain CSS custom properties.
|
|
4
4
|
|
|
5
5
|
Package: [npmjs.com/package/margo-ui](https://www.npmjs.com/package/margo-ui)
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "margo-ui",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "React UI kit built on Tailwind CSS v4 design tokens, themeable through plain CSS custom properties.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"ui",
|
|
@@ -77,7 +77,7 @@ Button.IconLabel = ({
|
|
|
77
77
|
className,
|
|
78
78
|
}: ButtonIconLabelProps) => (
|
|
79
79
|
<span
|
|
80
|
-
style={{ "--button-gap": gap } as CSSProperties}
|
|
80
|
+
style={{ "--margo-button-gap": gap } as CSSProperties}
|
|
81
81
|
className={cn(
|
|
82
82
|
buttonGridClassName,
|
|
83
83
|
side === "start" && "[direction:rtl]",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const buttonBaseClassName = `group/button flex h-8 w-fit shrink-0 items-center px-2 rounded-lg border-2 text-on-main
|
|
2
2
|
hover:border-on-main hover:text-on-main focus-visible:margo-border-gradient-primary
|
|
3
|
-
focus-visible:outline focus-visible:outline-offset-1 focus-visible:outline-on-main shadow-button
|
|
3
|
+
focus-visible:outline focus-visible:outline-offset-1 focus-visible:outline-on-main shadow-button
|
|
4
|
+
select-none origin-center transition-transform duration-[160ms] ease-out active:scale-[0.95]`;
|
|
4
5
|
|
|
5
6
|
export const buttonSurfaceClassName = "border-border bg-main";
|
|
6
7
|
|
|
@@ -19,13 +20,13 @@ export const buttonLabelClassName =
|
|
|
19
20
|
export const buttonGridClassName =
|
|
20
21
|
"grid items-center gap-0 transition-[grid-template-columns,gap] duration-[180ms] ease-in-out";
|
|
21
22
|
|
|
22
|
-
export const buttonGridForwardClassName = `grid-cols-[1rem_0fr] group-hover/button:grid-cols-[1rem_1fr] group-hover/button:gap-(--button-gap)
|
|
23
|
-
group-focus-visible/button:grid-cols-[1rem_1fr] group-focus-visible/button:gap-(--button-gap)
|
|
24
|
-
group-data-[margo-open=true]/button:grid-cols-[1rem_1fr] group-data-[margo-open=true]/button:gap-(--button-gap)`;
|
|
23
|
+
export const buttonGridForwardClassName = `grid-cols-[1rem_0fr] group-hover/button:grid-cols-[1rem_1fr] group-hover/button:gap-(--margo-button-gap)
|
|
24
|
+
group-focus-visible/button:grid-cols-[1rem_1fr] group-focus-visible/button:gap-(--margo-button-gap)
|
|
25
|
+
group-data-[margo-open=true]/button:grid-cols-[1rem_1fr] group-data-[margo-open=true]/button:gap-(--margo-button-gap)`;
|
|
25
26
|
|
|
26
|
-
export const buttonGridReverseClassName = `grid-cols-[auto_0rem] group-hover/button:grid-cols-[auto_1rem] group-hover/button:gap-(--button-gap)
|
|
27
|
-
group-focus-visible/button:grid-cols-[auto_1rem] group-focus-visible/button:gap-(--button-gap)
|
|
28
|
-
group-data-[margo-open=true]/button:grid-cols-[auto_1rem] group-data-[margo-open=true]/button:gap-(--button-gap)`;
|
|
27
|
+
export const buttonGridReverseClassName = `grid-cols-[auto_0rem] group-hover/button:grid-cols-[auto_1rem] group-hover/button:gap-(--margo-button-gap)
|
|
28
|
+
group-focus-visible/button:grid-cols-[auto_1rem] group-focus-visible/button:gap-(--margo-button-gap)
|
|
29
|
+
group-data-[margo-open=true]/button:grid-cols-[auto_1rem] group-data-[margo-open=true]/button:gap-(--margo-button-gap)`;
|
|
29
30
|
|
|
30
31
|
export const buttonSlotClassName = `min-w-0 overflow-hidden opacity-0 transition-opacity duration-[180ms] ease-in
|
|
31
32
|
group-hover/button:opacity-100 group-focus-visible/button:opacity-100 group-data-[margo-open=true]/button:opacity-100`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Tag } from "react-renderable";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
4
|
+
import { codeBaseClassName, codeFilledClassName } from "./style.js";
|
|
5
|
+
|
|
6
|
+
import type { ElementType } from "react";
|
|
7
|
+
import type { CodeProps } from "./type.js";
|
|
8
|
+
|
|
9
|
+
export const Code = <T extends ElementType = "code">({ filled = false, className, children, ...rest }: CodeProps<T>) => (
|
|
10
|
+
<Tag
|
|
11
|
+
{...Tag.forward<T>(rest, "code")}
|
|
12
|
+
className={cn(codeBaseClassName, filled && codeFilledClassName, className)}
|
|
13
|
+
>
|
|
14
|
+
{children}
|
|
15
|
+
</Tag>
|
|
16
|
+
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const itemBaseClassName = `group/item flex w-full cursor-pointer items-center gap-1 rounded-lg border-2 px-3 py-2 text-on-main
|
|
2
2
|
text-sm focus-visible:margo-border-gradient-primary focus-visible:outline select-none
|
|
3
|
-
focus-visible:outline-offset-1 focus-visible:outline-on-main
|
|
3
|
+
focus-visible:outline-offset-1 focus-visible:outline-on-main
|
|
4
|
+
origin-center bg-border/20 transition-transform duration-[160ms] ease-out active:scale-[0.98]`;
|
|
4
5
|
|
|
5
6
|
export const itemSurfaceClassName = `border-transparent text-medium hover:border-border hover:text-on-main
|
|
6
7
|
hover:shadow-item focus-visible:shadow-item`;
|
|
@@ -8,9 +8,9 @@ import type { SpinnerProps } from "./type.js";
|
|
|
8
8
|
|
|
9
9
|
export const Spinner = <T extends ElementType = "span">({ className, label = "Loading", ...rest }: SpinnerProps<T>) => (
|
|
10
10
|
<Tag
|
|
11
|
+
aria-label={label}
|
|
11
12
|
{...Tag.forward<T>(rest, "span")}
|
|
12
13
|
role="status"
|
|
13
|
-
aria-label={label}
|
|
14
14
|
className={cn(spinnerBaseClassName, className)}
|
|
15
15
|
>
|
|
16
16
|
<svg viewBox="0 0 24 24" aria-hidden className={spinnerIconClassName}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const tableWrapperClassName = "w-full overflow-x-auto rounded-lg border-2 border-border";
|
|
1
|
+
export const tableWrapperClassName = "w-full overflow-x-auto overscroll-x-none rounded-lg border-2 border-border";
|
|
2
2
|
|
|
3
3
|
export const tableBaseClassName = "w-full border-collapse text-xs text-on-main";
|
|
4
4
|
|
|
@@ -11,7 +11,4 @@ export type TooltipOwnProps = {
|
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type TooltipProps<T extends ElementType = "div"> =
|
|
15
|
-
TagProps<T, TooltipOwnProps>,
|
|
16
|
-
"aria-label"
|
|
17
|
-
>;
|
|
14
|
+
export type TooltipProps<T extends ElementType = "div"> = TagProps<T, TooltipOwnProps>;
|
package/src/css/variables.css
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
--margo-color-primary: #57e550;
|
|
54
54
|
--margo-color-primary-darken: #45b93f;
|
|
55
55
|
--margo-color-secondary: #d3d3d3;
|
|
56
|
-
--margo-color-medium: #
|
|
56
|
+
--margo-color-medium: #808080;
|
|
57
57
|
--margo-color-border: #cecece;
|
|
58
58
|
|
|
59
59
|
--margo-shadow-card: 0 8px 6px -4px rgb(220, 220, 220, 0.5);
|
|
@@ -13,14 +13,14 @@ import "./ripple.css";
|
|
|
13
13
|
export const Ripple = ({ children, disabled = false, rippleClassName = "bg-primary-darken" }: RippleProps) => {
|
|
14
14
|
const { endRipple, ripple, startRipple } = useRipple();
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const handlePointerUp = (event: PointerEvent<HTMLElement>) => {
|
|
17
17
|
if (!disabled) startRipple(event);
|
|
18
|
-
children.props.
|
|
18
|
+
children.props.onPointerUp?.(event);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
return cloneElement(children, {
|
|
22
22
|
className: cn("relative overflow-hidden", children.props.className),
|
|
23
|
-
|
|
23
|
+
onPointerUp: handlePointerUp,
|
|
24
24
|
children: (
|
|
25
25
|
<>
|
|
26
26
|
{children.props.children}
|
package/src/hoc/ripple/type.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { PointerEvent, PointerEventHandler, ReactElement, ReactNode } from
|
|
|
3
3
|
export type RippleChildProps = {
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
className?: string;
|
|
6
|
-
|
|
6
|
+
onPointerUp?: PointerEventHandler<HTMLElement>;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export type RippleProps = {
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { Button } from "./components/button/button.js";
|
|
|
3
3
|
export { ButtonMicro } from "./components/button_micro/button_micro.js";
|
|
4
4
|
export { Card } from "./components/card/card.js";
|
|
5
5
|
export { Chip } from "./components/chip/chip.js";
|
|
6
|
+
export { Code } from "./components/code/code.js";
|
|
6
7
|
export { Dialog } from "./components/dialog/dialog.js";
|
|
7
8
|
export { Header } from "./components/header/header.js";
|
|
8
9
|
export { Layer } from "./components/layer/layer.js";
|
|
@@ -42,6 +43,7 @@ export type {
|
|
|
42
43
|
export type { ButtonMicroProps } from "./components/button_micro/type.js";
|
|
43
44
|
export type { CardProps } from "./components/card/type.js";
|
|
44
45
|
export type { ChipProps } from "./components/chip/type.js";
|
|
46
|
+
export type { CodeOwnProps, CodeProps } from "./components/code/type.js";
|
|
45
47
|
export type { DialogBodyProps, DialogFooterProps, DialogProps } from "./components/dialog/type.js";
|
|
46
48
|
export type {
|
|
47
49
|
HeaderLeadingProps,
|