margo-ui 1.2.1 → 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/margo.css +1 -0
- package/package.json +1 -1
- package/src/components/progress_bar/progress_bar.css +1 -1
- package/src/components/progress_bar/progress_bar.tsx +1 -1
- package/src/components/splash/splash.css +19 -0
- package/src/components/splash/splash.tsx +27 -0
- package/src/components/splash/style.ts +1 -0
- package/src/components/splash/type.ts +12 -0
- package/src/css/custom-variant.css +1 -0
- package/src/css/grid.css +229 -0
- package/src/css/variables.css +6 -0
- package/src/hoc/border_glow/border_glow.css +1 -1
- package/src/hoc/border_glow/border_glow.tsx +3 -1
- package/src/hoc/border_glow/type.ts +1 -0
- package/src/hoc/mask_gradient_y/mask_gradient_y.css +17 -0
- package/src/hoc/mask_gradient_y/mask_gradient_y.tsx +22 -0
- package/src/hoc/mask_gradient_y/type.ts +15 -0
- package/src/index.ts +4 -0
- package/src/utils/cn/cn.ts +36 -1
package/margo.css
CHANGED
package/package.json
CHANGED
|
@@ -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
|
+
};
|
package/src/css/grid.css
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 12-column grid with full-bleed support.
|
|
3
|
+
*
|
|
4
|
+
* Tunable from the consumer through four variables only (see variables.css):
|
|
5
|
+
* --margo-grid-max-width, --margo-grid-padding, --margo-grid-gutter-x,
|
|
6
|
+
* --margo-grid-gutter-y. Padding and gutters are fully independent: the side
|
|
7
|
+
* padding is real padding on the container, the gutters are column gaps that
|
|
8
|
+
* only exist between the 12 columns. Any combination is valid, including a
|
|
9
|
+
* padding smaller than the gutter.
|
|
10
|
+
*
|
|
11
|
+
* Named lines available inside `margo-grid`:
|
|
12
|
+
* content-start | col-start 1..12 / col-end 1..12 | content-end
|
|
13
|
+
* Rows have no template and no names: they are addressed by index.
|
|
14
|
+
*
|
|
15
|
+
* Full bleed is not a line: it is a negative margin that cancels the distance
|
|
16
|
+
* between the content area and the viewport edge (--margo-grid-bleed), so it
|
|
17
|
+
* works from any column and at any nesting depth.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* Root layout container: centers a 12-column content area capped at
|
|
22
|
+
* --margo-grid-max-width and pads it by --margo-grid-padding on both sides.
|
|
23
|
+
* Direct children sit on the whole content area by default, so a plain
|
|
24
|
+
* `<div className="margo-grid"><section /></div>` is already correctly aligned.
|
|
25
|
+
* That default has zero specificity, so any margo-col-* utility overrides it.
|
|
26
|
+
*
|
|
27
|
+
* Use on: page sections, headers, footers — the outermost element of a layout.
|
|
28
|
+
*/
|
|
29
|
+
@utility margo-grid {
|
|
30
|
+
--margo-grid-bleed: max(var(--margo-grid-padding), calc((100vw - var(--margo-grid-max-width)) / 2));
|
|
31
|
+
|
|
32
|
+
width: 100%;
|
|
33
|
+
max-width: calc(var(--margo-grid-max-width) + var(--margo-grid-padding) * 2);
|
|
34
|
+
margin-inline: auto;
|
|
35
|
+
padding-inline: var(--margo-grid-padding);
|
|
36
|
+
|
|
37
|
+
display: grid;
|
|
38
|
+
column-gap: var(--margo-grid-gutter-x);
|
|
39
|
+
row-gap: var(--margo-grid-gutter-y);
|
|
40
|
+
grid-template-columns: [content-start] repeat(12, [col-start] minmax(0, 1fr) [col-end]) [content-end];
|
|
41
|
+
|
|
42
|
+
:where(&) > * {
|
|
43
|
+
grid-column-start: content-start;
|
|
44
|
+
grid-column-end: content-end;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
* Nested grid that reuses the parent tracks and line names instead of creating
|
|
50
|
+
* new ones, so children keep aligning to the same 12 columns at any depth.
|
|
51
|
+
* Must be a child of margo-grid (or of another margo-grid-sub) and must span
|
|
52
|
+
* the columns it wants to inherit — as a child of margo-grid it already covers
|
|
53
|
+
* the whole content area.
|
|
54
|
+
*
|
|
55
|
+
* Children are auto-placed: one column each unless they carry a margo-col-*
|
|
56
|
+
* utility, so `margo-col-span-6` items flow two per row.
|
|
57
|
+
*
|
|
58
|
+
* Use on: a list/card wrapper whose grandchildren still need global alignment.
|
|
59
|
+
*/
|
|
60
|
+
@utility margo-grid-sub {
|
|
61
|
+
display: grid;
|
|
62
|
+
grid-template-columns: subgrid;
|
|
63
|
+
row-gap: var(--margo-grid-gutter-y);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* Standalone 12-column grid: same line names and gutters, but no max-width and
|
|
68
|
+
* no side padding — it fills whatever box it is placed in.
|
|
69
|
+
*
|
|
70
|
+
* Use on: an isolated component that needs 12 columns of its own, outside of
|
|
71
|
+
* (or independent from) the page layout.
|
|
72
|
+
*/
|
|
73
|
+
@utility margo-grid-flat {
|
|
74
|
+
display: grid;
|
|
75
|
+
grid-template-columns: [content-start] repeat(12, [col-start] minmax(0, 1fr) [col-end]) [content-end];
|
|
76
|
+
column-gap: var(--margo-grid-gutter-x);
|
|
77
|
+
row-gap: var(--margo-grid-gutter-y);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* Full bleed: edge to edge of the viewport, escaping both the max-width and the
|
|
82
|
+
* side padding. Use on: background bands, hero images, sticky bars.
|
|
83
|
+
* To keep inner content on the grid, nest a margo-grid inside it.
|
|
84
|
+
*/
|
|
85
|
+
@utility margo-col-full {
|
|
86
|
+
grid-column-start: content-start;
|
|
87
|
+
grid-column-end: content-end;
|
|
88
|
+
margin-inline: calc(var(--margo-grid-bleed) * -1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
* Back to the centered content area (all 12 columns), dropping any bleed.
|
|
93
|
+
* Use to reset an element that a variant put on `full` at another breakpoint.
|
|
94
|
+
*/
|
|
95
|
+
@utility margo-col-content {
|
|
96
|
+
grid-column-start: content-start;
|
|
97
|
+
grid-column-end: content-end;
|
|
98
|
+
margin-inline: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
* A single column, by index: `margo-col-4` occupies column 4 only.
|
|
103
|
+
* Use for one-cell items; combine with variants, e.g. `900:margo-col-7`.
|
|
104
|
+
*/
|
|
105
|
+
@utility margo-col-* {
|
|
106
|
+
grid-column-start: col-start --value(integer);
|
|
107
|
+
grid-column-end: col-end --value(integer);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Bleed off the left edge of the viewport, keeping the current end line. */
|
|
111
|
+
@utility margo-col-start-full {
|
|
112
|
+
grid-column-start: content-start;
|
|
113
|
+
margin-inline-start: calc(var(--margo-grid-bleed) * -1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Start at the left edge of the content area, dropping any left bleed. */
|
|
117
|
+
@utility margo-col-start-content {
|
|
118
|
+
grid-column-start: content-start;
|
|
119
|
+
margin-inline-start: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/*
|
|
123
|
+
* Start at the beginning of column N: `margo-col-start-5`.
|
|
124
|
+
* Pairs with margo-col-end-* (explicit range) or margo-col-span-* (length).
|
|
125
|
+
*/
|
|
126
|
+
@utility margo-col-start-* {
|
|
127
|
+
grid-column-start: col-start --value(integer);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Bleed off the right edge of the viewport, keeping the current start line. */
|
|
131
|
+
@utility margo-col-end-full {
|
|
132
|
+
grid-column-end: content-end;
|
|
133
|
+
margin-inline-end: calc(var(--margo-grid-bleed) * -1);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* End at the right edge of the content area, dropping any right bleed. */
|
|
137
|
+
@utility margo-col-end-content {
|
|
138
|
+
grid-column-end: content-end;
|
|
139
|
+
margin-inline-end: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
* End at the end of column N, inclusive: `margo-col-start-5 margo-col-end-8`
|
|
144
|
+
* covers columns 5 through 8.
|
|
145
|
+
*/
|
|
146
|
+
@utility margo-col-end-* {
|
|
147
|
+
grid-column-end: col-end --value(integer);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Span the full bleed width regardless of where the item starts. */
|
|
151
|
+
@utility margo-col-span-full {
|
|
152
|
+
grid-column-start: content-start;
|
|
153
|
+
grid-column-end: content-end;
|
|
154
|
+
margin-inline: calc(var(--margo-grid-bleed) * -1);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/*
|
|
158
|
+
* Span N columns from wherever the item starts: `margo-col-span-6`.
|
|
159
|
+
* In margo-grid-sub / margo-grid-flat the item keeps auto-placing, so
|
|
160
|
+
* `margo-col-span-12 900:margo-col-span-6` items flow one per row on mobile
|
|
161
|
+
* and two per row from 900 up. As a direct child of margo-grid the start is
|
|
162
|
+
* pinned to the content edge instead.
|
|
163
|
+
*/
|
|
164
|
+
@utility margo-col-span-* {
|
|
165
|
+
grid-column-end: span --value(integer);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/*
|
|
169
|
+
* Rows are implicit and unnamed, so they are addressed by index only.
|
|
170
|
+
* `margo-row-2` puts the item on the second row, which is how two items are
|
|
171
|
+
* made to share a row band or to overlap a column that spans several rows.
|
|
172
|
+
*/
|
|
173
|
+
@utility margo-row-* {
|
|
174
|
+
grid-row-start: --value(integer);
|
|
175
|
+
grid-row-end: span 1;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/*
|
|
179
|
+
* Start on row N and keep the current end: `margo-row-start-2`.
|
|
180
|
+
* Pair with margo-row-span-* for the length; there is no margo-row-end-*,
|
|
181
|
+
* because without named row lines an end index would mean the line before
|
|
182
|
+
* the row, the opposite of how margo-col-end-* reads.
|
|
183
|
+
*/
|
|
184
|
+
@utility margo-row-start-* {
|
|
185
|
+
grid-row-start: --value(integer);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* Span N rows from wherever the item starts: `margo-row-span-2`. */
|
|
189
|
+
@utility margo-row-span-* {
|
|
190
|
+
grid-row-end: span --value(integer);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/*
|
|
194
|
+
* Gutter overrides, on the spacing scale: `margo-gutter-y-0`, `margo-gutter-x-4`.
|
|
195
|
+
* They set the grid variables rather than the gap properties, so they never
|
|
196
|
+
* depend on utility order to win, and they cascade into nested margo-grid /
|
|
197
|
+
* margo-grid-sub unless those override the gutter again.
|
|
198
|
+
*/
|
|
199
|
+
@utility margo-gutter-* {
|
|
200
|
+
--margo-grid-gutter-x: --spacing(--value(integer));
|
|
201
|
+
--margo-grid-gutter-y: --spacing(--value(integer));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@utility margo-gutter-x-* {
|
|
205
|
+
--margo-grid-gutter-x: --spacing(--value(integer));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@utility margo-gutter-y-* {
|
|
209
|
+
--margo-grid-gutter-y: --spacing(--value(integer));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
* Side padding override, on the spacing scale: `margo-padding-8`.
|
|
214
|
+
* Also feeds --margo-grid-bleed, so full-bleed children stay exact.
|
|
215
|
+
*/
|
|
216
|
+
@utility margo-padding-* {
|
|
217
|
+
--margo-grid-padding: --spacing(--value(integer));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/*
|
|
221
|
+
* Non-grid escape hatch: same max-width and side padding as margo-grid, but a
|
|
222
|
+
* plain block. Use when a section needs the layout width without any columns.
|
|
223
|
+
*/
|
|
224
|
+
@utility margo-container {
|
|
225
|
+
width: 100%;
|
|
226
|
+
max-width: calc(var(--margo-grid-max-width) + var(--margo-grid-padding) * 2);
|
|
227
|
+
margin-inline: auto;
|
|
228
|
+
padding-inline: var(--margo-grid-padding);
|
|
229
|
+
}
|
package/src/css/variables.css
CHANGED
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
--margo-font-weight-black: 900;
|
|
31
31
|
|
|
32
32
|
--margo-border-width-2: 1.5px;
|
|
33
|
+
|
|
34
|
+
--margo-grid-max-width: 80rem;
|
|
35
|
+
--margo-grid-padding: 1rem;
|
|
36
|
+
--margo-grid-gutter-x: 2rem;
|
|
37
|
+
--margo-grid-gutter-y: 2rem;
|
|
38
|
+
--margo-grid-bleed: max(var(--margo-grid-padding), calc((100vw - var(--margo-grid-max-width)) / 2));
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
:root {
|
|
@@ -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
|
|
|
@@ -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";
|
package/src/utils/cn/cn.ts
CHANGED
|
@@ -3,10 +3,45 @@ import { extendTailwindMerge } from "tailwind-merge";
|
|
|
3
3
|
|
|
4
4
|
import type { ClassValue } from "clsx";
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const isNumber = (value: string) => /^\d+$/.test(value);
|
|
7
|
+
|
|
8
|
+
const isColumnLine = (value: string) => value === "full" || value === "content" || isNumber(value);
|
|
9
|
+
|
|
10
|
+
type MargoClassGroupIds =
|
|
11
|
+
| "margo-col"
|
|
12
|
+
| "margo-col-start"
|
|
13
|
+
| "margo-col-end"
|
|
14
|
+
| "margo-col-span"
|
|
15
|
+
| "margo-row"
|
|
16
|
+
| "margo-row-start"
|
|
17
|
+
| "margo-row-span"
|
|
18
|
+
| "margo-gutter"
|
|
19
|
+
| "margo-gutter-x"
|
|
20
|
+
| "margo-gutter-y"
|
|
21
|
+
| "margo-padding";
|
|
22
|
+
|
|
23
|
+
const twMerge = extendTailwindMerge<MargoClassGroupIds>({
|
|
7
24
|
extend: {
|
|
8
25
|
classGroups: {
|
|
9
26
|
"font-size": ["text-mc"],
|
|
27
|
+
"margo-col": [{ "margo-col": [isColumnLine] }],
|
|
28
|
+
"margo-col-start": [{ "margo-col-start": [isColumnLine] }],
|
|
29
|
+
"margo-col-end": [{ "margo-col-end": [isColumnLine] }],
|
|
30
|
+
"margo-col-span": [{ "margo-col-span": [isColumnLine] }],
|
|
31
|
+
"margo-row": [{ "margo-row": [isNumber] }],
|
|
32
|
+
"margo-row-start": [{ "margo-row-start": [isNumber] }],
|
|
33
|
+
"margo-row-span": [{ "margo-row-span": [isNumber] }],
|
|
34
|
+
"margo-gutter": [{ "margo-gutter": [isNumber] }],
|
|
35
|
+
"margo-gutter-x": [{ "margo-gutter-x": [isNumber] }],
|
|
36
|
+
"margo-gutter-y": [{ "margo-gutter-y": [isNumber] }],
|
|
37
|
+
"margo-padding": [{ "margo-padding": [isNumber] }],
|
|
38
|
+
},
|
|
39
|
+
conflictingClassGroups: {
|
|
40
|
+
"margo-col": ["margo-col-start", "margo-col-end", "margo-col-span"],
|
|
41
|
+
"margo-col-span": ["margo-col-end"],
|
|
42
|
+
"margo-col-end": ["margo-col-span"],
|
|
43
|
+
"margo-row": ["margo-row-start", "margo-row-span"],
|
|
44
|
+
"margo-gutter": ["margo-gutter-x", "margo-gutter-y"],
|
|
10
45
|
},
|
|
11
46
|
},
|
|
12
47
|
});
|