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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "margo-ui",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "React UI kit built on Tailwind CSS v4 design tokens, themeable through plain CSS custom properties.",
5
5
  "keywords": [
6
6
  "react",
@@ -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 border-margo text-on-main
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 border-margo border-border bg-main p-5 text-on-main shadow-card";
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-3/4 border-margo border-border
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-3/4 text-mc shadow-chip
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,3 +1,3 @@
1
1
  export const codeBaseClassName = "font-mono text-xs text-medium";
2
2
 
3
- export const codeFilledClassName = "rounded-margo-1/2 bg-neutral/60 px-1 py-0.5 text-on-main/90";
3
+ export const codeFilledClassName = "rounded-margo-xs bg-neutral/60 px-1 py-0.5 text-on-main/90";
@@ -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-1 border-margo border-border bg-main text-on-main shadow-sm`;
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 border-margo text-on-main
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 border-margo px-3 py-2 text-on-main
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-1 border-margo border-border bg-main text-on-main shadow-card outline-none`;
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
- { ...style, "--margo-progress-bar-fill": fill, "--margo-progress-bar-value": `${progress}%` } as CSSProperties
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
  />
@@ -5,6 +5,7 @@ export type ProgressBarMode = "determinate" | "indeterminate";
5
5
 
6
6
  export type ProgressBarOwnProps = {
7
7
  animate?: boolean;
8
+ delay?: number | string;
8
9
  fill?: string;
9
10
  mode?: ProgressBarMode;
10
11
  value?: number;
@@ -1,4 +1,4 @@
1
- export const selectBaseClassName = `group/select relative flex h-10 w-full items-center rounded-margo-1
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-1
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 border-margo border-border";
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-1/2 bg-on-main px-2 py-0.5 text-xs text-main lowercase
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-1: var(--margo-radius);
44
- --radius-margo-3\/4: calc(var(--margo-radius) * 3 / 4);
45
- --radius-margo-1\/2: calc(var(--margo-radius) / 2);
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: 1.5;
65
+ --text-xs--line-height: initial;
66
66
  --text-sm: var(--margo-font-size-sm);
67
- --text-sm--line-height: 1.5;
67
+ --text-sm--line-height: initial;
68
68
  --text-base: var(--margo-font-size-base);
69
- --text-base--line-height: 1.25;
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: 1.25;
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: 1;
75
+ --text-xl--line-height: initial;
78
76
  --text-2xl: var(--margo-font-size-2xl);
79
- --text-2xl--line-height: 0.75;
77
+ --text-2xl--line-height: initial;
80
78
  --text-3xl: var(--margo-font-size-3xl);
81
- --text-3xl--line-height: 0.75;
79
+ --text-3xl--line-height: initial;
82
80
  --text-4xl: var(--margo-font-size-4xl);
83
- --text-4xl--line-height: 0.75;
81
+ --text-4xl--line-height: initial;
84
82
  --text-5xl: var(--margo-font-size-5xl);
85
- --text-5xl--line-height: 0.75;
83
+ --text-5xl--line-height: initial;
86
84
  --text-6xl: var(--margo-font-size-6xl);
87
- --text-6xl--line-height: 0.75;
85
+ --text-6xl--line-height: initial;
88
86
  --text-7xl: var(--margo-font-size-7xl);
89
- --text-7xl--line-height: 0.75;
87
+ --text-7xl--line-height: initial;
90
88
  --text-8xl: var(--margo-font-size-8xl);
91
- --text-8xl--line-height: 0.75;
89
+ --text-8xl--line-height: initial;
92
90
  --text-9xl: var(--margo-font-size-9xl);
93
- --text-9xl--line-height: 0.75;
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
  }
@@ -29,6 +29,8 @@
29
29
  --margo-font-weight-extrabold: 800;
30
30
  --margo-font-weight-black: 900;
31
31
 
32
+ --margo-line-height: 1.5;
33
+
32
34
  --margo-radius: 0.5rem;
33
35
 
34
36
  --margo-border: 1.5px;
@@ -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 isMargoStep = (value: string) => /^margo-\d+(\/\d+)?$/.test(value);
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"]: [isMargoStep] }],
25
+ [{ [corner ? `rounded-${corner}` : "rounded"]: [isMargoRadiusStep] }],
26
26
  ]),
27
27
  );
28
28