margo-ui 5.0.0 → 5.1.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/components/button/button.tsx +1 -0
- package/src/components/button/style.ts +1 -1
- package/src/components/card/style.ts +1 -1
- package/src/components/checkbox/style.ts +1 -1
- package/src/components/chip/style.ts +1 -1
- package/src/components/code/style.ts +1 -1
- package/src/components/dialog/style.ts +1 -1
- package/src/components/input/style.ts +1 -1
- package/src/components/item/style.ts +1 -1
- package/src/components/popover/style.ts +1 -1
- package/src/components/progress_bar/progress_bar.css +2 -0
- package/src/components/progress_bar/progress_bar.tsx +9 -1
- package/src/components/progress_bar/type.ts +1 -0
- package/src/components/select/style.ts +2 -2
- package/src/components/table/style.ts +1 -1
- package/src/components/tooltip/style.ts +1 -1
- package/src/css/theme.css +27 -19
- package/src/css/variables.css +2 -0
- package/src/utils/cn/cn.ts +2 -2
package/package.json
CHANGED
|
@@ -45,6 +45,7 @@ export const Button = <T extends ElementType = "button">({
|
|
|
45
45
|
data-margo-open={open}
|
|
46
46
|
data-margo-disabled={disabled}
|
|
47
47
|
aria-disabled={disabled || undefined}
|
|
48
|
+
data-active={active || undefined}
|
|
48
49
|
inert={disabled || !clickable || undefined}
|
|
49
50
|
onClick={handleClick}
|
|
50
51
|
className={cn(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const buttonBaseClassName = `group/button flex h-8 w-fit shrink-0 items-center px-2 rounded-margo-
|
|
1
|
+
export const buttonBaseClassName = `group/button flex h-8 w-fit shrink-0 items-center px-2 rounded-margo-base border-margo text-on-main
|
|
2
2
|
hover:border-on-main hover:text-on-main focus-visible:border-primary
|
|
3
3
|
focus-visible:outline focus-visible:outline-offset-1 focus-visible:outline-on-main
|
|
4
4
|
select-none origin-center transition-transform duration-[160ms] ease-out active:scale-[0.95] bg-main`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const cardBaseClassName = "rounded-margo-
|
|
1
|
+
export const cardBaseClassName = "rounded-margo-base border-margo border-border bg-main p-5 text-on-main shadow-card";
|
|
2
2
|
|
|
3
3
|
export const cardFocusClassName = `focus:border-primary focus-visible:outline focus-visible:outline-offset-1
|
|
4
4
|
focus-visible:outline-on-main`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const checkboxBaseClassName = `margo-checkbox size-5 flex-none cursor-pointer rounded-margo-
|
|
1
|
+
export const checkboxBaseClassName = `margo-checkbox size-5 flex-none cursor-pointer rounded-margo-sm border-margo border-border
|
|
2
2
|
bg-main p-1 text-on-main enabled:hover:border-on-main focus-visible:border-primary focus-visible:outline
|
|
3
3
|
focus-visible:outline-offset-1 focus-visible:outline-on-main checked:border-primary indeterminate:border-primary
|
|
4
4
|
select-none origin-center transition-transform duration-[120ms] ease-out active:scale-[0.92] disabled:cursor-auto
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const chipBaseClassName = `bg-on-main/8 margo-text-box-trim flex items-center justify-center px-3 py-0.5
|
|
2
|
-
whitespace-nowrap lowercase flex-none leading-none rounded-margo-
|
|
2
|
+
whitespace-nowrap lowercase flex-none leading-none rounded-margo-sm text-mc shadow-chip
|
|
3
3
|
focus-visible:outline focus-visible:outline-offset-1 focus-visible:outline-on-main`;
|
|
4
4
|
|
|
5
5
|
export const chipActiveClassName = "bg-on-main text-main";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const dialogBaseClassName = `flex m-4 max-h-[calc(100%-2rem)] w-[calc(100%-2rem)] flex-col overflow-hidden
|
|
2
|
-
rounded-margo-
|
|
2
|
+
rounded-margo-base border-margo border-border bg-main text-on-main shadow-sm`;
|
|
3
3
|
|
|
4
4
|
export const dialogBodyClassName = "min-h-0 flex-1 overflow-y-auto px-5 py-4 text-sm";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const inputBaseClassName = `group/input flex h-10 w-full cursor-text items-center rounded-margo-
|
|
1
|
+
export const inputBaseClassName = `group/input flex h-10 w-full cursor-text items-center rounded-margo-base border-margo text-on-main
|
|
2
2
|
text-sm select-none bg-low
|
|
3
3
|
border-transparent text-medium hover:border-on-main hover:text-on-main hover:shadow-item
|
|
4
4
|
focus-within:border-primary focus-within:text-on-main
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const itemBaseClassName = `group/item flex w-full cursor-pointer items-center gap-1 rounded-margo-
|
|
1
|
+
export const itemBaseClassName = `group/item flex w-full cursor-pointer items-center gap-1 rounded-margo-base border-margo px-3 py-2 text-on-main
|
|
2
2
|
text-sm focus-visible:border-primary focus-visible:outline select-none
|
|
3
3
|
focus-visible:outline-offset-1 min-h-[2.5rem] hover:border-on-main focus-visible:outline-on-main
|
|
4
4
|
origin-center bg-low transition-transform duration-[160ms] ease-out active:scale-[0.98]`;
|
|
@@ -3,7 +3,7 @@ import type { PopoverAlign, PopoverPosition } from "./type.js";
|
|
|
3
3
|
export const popoverAnchorClassName = "relative inline-block size-fit";
|
|
4
4
|
|
|
5
5
|
export const popoverBaseClassName = `margo-popover absolute z-20 m-0 flex w-max max-w-[calc(100vw-2rem)] flex-col
|
|
6
|
-
overflow-clip rounded-margo-
|
|
6
|
+
overflow-clip rounded-margo-base border-margo border-border bg-main text-on-main shadow-card outline-none`;
|
|
7
7
|
|
|
8
8
|
export const popoverBodyClassName = `flex min-h-0 max-h-56 flex-col gap-1
|
|
9
9
|
overflow-y-auto overscroll-contain w-64 p-2 text-sm`;
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
.margo-progress-bar[data-margo-mode="determinate"][data-margo-animate="true"]::before {
|
|
13
13
|
transition: clip-path 300ms ease-out;
|
|
14
|
+
transition-delay: var(--margo-progress-bar-delay, 0ms);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.margo-progress-bar[data-margo-mode="indeterminate"]::before {
|
|
17
18
|
inset: 0 auto 0 0;
|
|
18
19
|
width: 50%;
|
|
19
20
|
animation: margo-progress-bar-indeterminate 800ms ease-in-out infinite;
|
|
21
|
+
animation-delay: var(--margo-progress-bar-delay, 0ms);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
@keyframes margo-progress-bar-indeterminate {
|
|
@@ -10,6 +10,7 @@ import "./progress_bar.css";
|
|
|
10
10
|
|
|
11
11
|
export const ProgressBar = <T extends ElementType = "div">({
|
|
12
12
|
animate = true,
|
|
13
|
+
delay,
|
|
13
14
|
fill = progressBarDefaultFill,
|
|
14
15
|
mode = "indeterminate",
|
|
15
16
|
style,
|
|
@@ -30,7 +31,14 @@ export const ProgressBar = <T extends ElementType = "div">({
|
|
|
30
31
|
data-margo-mode={mode}
|
|
31
32
|
data-margo-animate={animate}
|
|
32
33
|
style={
|
|
33
|
-
{
|
|
34
|
+
{
|
|
35
|
+
...style,
|
|
36
|
+
"--margo-progress-bar-fill": fill,
|
|
37
|
+
"--margo-progress-bar-value": `${progress}%`,
|
|
38
|
+
...(delay != null && {
|
|
39
|
+
"--margo-progress-bar-delay": typeof delay === "number" ? `${delay}ms` : delay,
|
|
40
|
+
}),
|
|
41
|
+
} as CSSProperties
|
|
34
42
|
}
|
|
35
43
|
className={cn(progressBarBaseClassName, className)}
|
|
36
44
|
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const selectBaseClassName = `group/select relative flex h-10 w-full items-center rounded-margo-
|
|
1
|
+
export const selectBaseClassName = `group/select relative flex h-10 w-full items-center rounded-margo-base
|
|
2
2
|
border-margo border-transparent bg-low text-sm text-medium select-none
|
|
3
3
|
hover:border-on-main hover:text-on-main hover:shadow-item
|
|
4
4
|
focus-within:border-primary focus-within:text-on-main
|
|
@@ -6,7 +6,7 @@ has-[select:disabled]:pointer-events-none has-[select:disabled]:opacity-40`;
|
|
|
6
6
|
|
|
7
7
|
export const selectActiveClassName = "border-primary";
|
|
8
8
|
|
|
9
|
-
export const selectControlClassName = `h-full min-w-0 flex-1 cursor-pointer appearance-none truncate rounded-margo-
|
|
9
|
+
export const selectControlClassName = `h-full min-w-0 flex-1 cursor-pointer appearance-none truncate rounded-margo-base
|
|
10
10
|
bg-transparent pl-3 text-left text-on-main outline-none disabled:cursor-auto
|
|
11
11
|
has-[option[value='']:checked]:text-medium
|
|
12
12
|
[&>option]:bg-main [&>option]:text-on-main
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const tableWrapperClassName = "w-full overflow-x-auto overscroll-x-none rounded-margo-
|
|
1
|
+
export const tableWrapperClassName = "w-full overflow-x-auto overscroll-x-none rounded-margo-base border-margo border-border";
|
|
2
2
|
|
|
3
3
|
export const tableBaseClassName = "w-full border-collapse text-xs text-on-main";
|
|
4
4
|
|
|
@@ -2,7 +2,7 @@ import type { TooltipPosition } from "./type.js";
|
|
|
2
2
|
|
|
3
3
|
export const tooltipAnchorClassName = "group relative inline-block size-fit";
|
|
4
4
|
|
|
5
|
-
export const tooltipBubbleClassName = `pointer-events-none absolute z-10 rounded-margo-
|
|
5
|
+
export const tooltipBubbleClassName = `pointer-events-none absolute z-10 rounded-margo-xs bg-on-main px-2 py-0.5 text-xs text-main lowercase
|
|
6
6
|
whitespace-nowrap opacity-0`;
|
|
7
7
|
|
|
8
8
|
export const tooltipTransitionClassName = "transition-opacity duration-[250ms] ease-in-out";
|
package/src/css/theme.css
CHANGED
|
@@ -40,9 +40,10 @@
|
|
|
40
40
|
--z-index-max: var(--margo-max-z-index);
|
|
41
41
|
|
|
42
42
|
/* Radii */
|
|
43
|
-
--radius-margo-
|
|
44
|
-
--radius-margo-
|
|
45
|
-
--radius-margo-
|
|
43
|
+
--radius-margo-mc: calc(var(--margo-radius) / 4);
|
|
44
|
+
--radius-margo-xs: calc(var(--margo-radius) / 2);
|
|
45
|
+
--radius-margo-sm: calc(var(--margo-radius) * 3 / 4);
|
|
46
|
+
--radius-margo-base: var(--margo-radius);
|
|
46
47
|
|
|
47
48
|
/* Border widths */
|
|
48
49
|
--border-width-margo: var(--margo-border);
|
|
@@ -60,35 +61,42 @@
|
|
|
60
61
|
|
|
61
62
|
/* Font sizes */
|
|
62
63
|
--text-mc: var(--margo-font-size-mc);
|
|
63
|
-
--text-mc--line-height: 1.5;
|
|
64
64
|
--text-xs: var(--margo-font-size-xs);
|
|
65
|
-
--text-xs--line-height:
|
|
65
|
+
--text-xs--line-height: initial;
|
|
66
66
|
--text-sm: var(--margo-font-size-sm);
|
|
67
|
-
--text-sm--line-height:
|
|
67
|
+
--text-sm--line-height: initial;
|
|
68
68
|
--text-base: var(--margo-font-size-base);
|
|
69
|
-
--text-base--line-height:
|
|
69
|
+
--text-base--line-height: initial;
|
|
70
70
|
--text-md: var(--margo-font-size-md);
|
|
71
|
-
--text-md--line-height: 1.25;
|
|
72
71
|
--text-lg: var(--margo-font-size-lg);
|
|
73
|
-
--text-lg--line-height:
|
|
72
|
+
--text-lg--line-height: initial;
|
|
74
73
|
--text-2lg: var(--margo-font-size-2lg);
|
|
75
|
-
--text-2lg--line-height: 1;
|
|
76
74
|
--text-xl: var(--margo-font-size-xl);
|
|
77
|
-
--text-xl--line-height:
|
|
75
|
+
--text-xl--line-height: initial;
|
|
78
76
|
--text-2xl: var(--margo-font-size-2xl);
|
|
79
|
-
--text-2xl--line-height:
|
|
77
|
+
--text-2xl--line-height: initial;
|
|
80
78
|
--text-3xl: var(--margo-font-size-3xl);
|
|
81
|
-
--text-3xl--line-height:
|
|
79
|
+
--text-3xl--line-height: initial;
|
|
82
80
|
--text-4xl: var(--margo-font-size-4xl);
|
|
83
|
-
--text-4xl--line-height:
|
|
81
|
+
--text-4xl--line-height: initial;
|
|
84
82
|
--text-5xl: var(--margo-font-size-5xl);
|
|
85
|
-
--text-5xl--line-height:
|
|
83
|
+
--text-5xl--line-height: initial;
|
|
86
84
|
--text-6xl: var(--margo-font-size-6xl);
|
|
87
|
-
--text-6xl--line-height:
|
|
85
|
+
--text-6xl--line-height: initial;
|
|
88
86
|
--text-7xl: var(--margo-font-size-7xl);
|
|
89
|
-
--text-7xl--line-height:
|
|
87
|
+
--text-7xl--line-height: initial;
|
|
90
88
|
--text-8xl: var(--margo-font-size-8xl);
|
|
91
|
-
--text-8xl--line-height:
|
|
89
|
+
--text-8xl--line-height: initial;
|
|
92
90
|
--text-9xl: var(--margo-font-size-9xl);
|
|
93
|
-
--text-9xl--line-height:
|
|
91
|
+
--text-9xl--line-height: initial;
|
|
92
|
+
|
|
93
|
+
/* Line heights */
|
|
94
|
+
--leading-mc: calc(var(--margo-line-height) / 6);
|
|
95
|
+
--leading-xs: calc(var(--margo-line-height) / 3);
|
|
96
|
+
--leading-sm: calc(var(--margo-line-height) / 2);
|
|
97
|
+
--leading-md: calc(var(--margo-line-height) * 2 / 3);
|
|
98
|
+
--leading-lg: calc(var(--margo-line-height) * 5 / 6);
|
|
99
|
+
--leading-base: var(--margo-line-height);
|
|
100
|
+
--leading-xl: calc(var(--margo-line-height) * 7 / 6);
|
|
101
|
+
--leading-2xl: calc(var(--margo-line-height) * 4 / 3);
|
|
94
102
|
}
|
package/src/css/variables.css
CHANGED
package/src/utils/cn/cn.ts
CHANGED
|
@@ -7,7 +7,7 @@ const isNumber = (value: string) => /^\d+$/.test(value);
|
|
|
7
7
|
|
|
8
8
|
const isColumnLine = (value: string) => value === "full" || value === "content" || isNumber(value);
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const isMargoRadiusStep = (value: string) => /^margo-(mc|xs|sm|base)$/.test(value);
|
|
11
11
|
|
|
12
12
|
const BORDER_SIDES = ["", "x", "y", "s", "e", "t", "r", "b", "l"] as const;
|
|
13
13
|
const RADIUS_CORNERS = ["", "s", "e", "t", "r", "b", "l", "ss", "se", "ee", "es", "tl", "tr", "br", "bl"] as const;
|
|
@@ -22,7 +22,7 @@ const borderWidthGroups = Object.fromEntries(
|
|
|
22
22
|
const radiusGroups = Object.fromEntries(
|
|
23
23
|
RADIUS_CORNERS.map((corner) => [
|
|
24
24
|
corner ? `rounded-${corner}` : "rounded",
|
|
25
|
-
[{ [corner ? `rounded-${corner}` : "rounded"]: [
|
|
25
|
+
[{ [corner ? `rounded-${corner}` : "rounded"]: [isMargoRadiusStep] }],
|
|
26
26
|
]),
|
|
27
27
|
);
|
|
28
28
|
|