@umami/react-zen 0.232.0 → 0.233.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 +3 -3
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/styles.full.css +1 -1
- package/tailwind.preset.ts +34 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# zen
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Zen** is a props-driven React component library built for speed. Build polished interfaces without writing HTML, CSS, or thinking about Tailwind classes.
|
|
4
4
|
|
|
5
5
|
- **Props over classes** - Style through component props, not utility classes
|
|
6
6
|
- **Design included** - Complete design system out of the box with dark mode
|
|
@@ -43,11 +43,11 @@ export default function Welcome() {
|
|
|
43
43
|
|
|
44
44
|
No `className`. No CSS files. Just components and props.
|
|
45
45
|
|
|
46
|
-
## Why
|
|
46
|
+
## Why Zen?
|
|
47
47
|
|
|
48
48
|
Building UI is slow. You have to think about markup, CSS organization, responsive breakpoints, accessibility, and design consistency.
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Zen eliminates that friction:
|
|
51
51
|
|
|
52
52
|
| Traditional approach | zen approach |
|
|
53
53
|
|---------------------|--------------|
|
package/dist/index.d.mts
CHANGED
|
@@ -117,6 +117,12 @@ type MinWidth = Spacing | Fraction | SizingSpecial | WidthViewport;
|
|
|
117
117
|
type MaxWidth = Spacing | Fraction | MaxWidthSpecial | WidthViewport;
|
|
118
118
|
type MinHeight = Spacing | Fraction | SizingSpecial | HeightViewport;
|
|
119
119
|
type MaxHeight = Spacing | Fraction | SizingSpecial | HeightViewport;
|
|
120
|
+
interface StateStyles {
|
|
121
|
+
color?: FontColor;
|
|
122
|
+
backgroundColor?: BackgroundColor;
|
|
123
|
+
borderColor?: BorderColor;
|
|
124
|
+
opacity?: Opacity;
|
|
125
|
+
}
|
|
120
126
|
|
|
121
127
|
type RenderProp<P = Record<string, unknown>> = ReactElement | ((props: P) => ReactElement);
|
|
122
128
|
/**
|
|
@@ -224,6 +230,9 @@ interface BoxProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
|
|
|
224
230
|
order?: number;
|
|
225
231
|
zIndex?: number;
|
|
226
232
|
theme?: string;
|
|
233
|
+
hover?: StateStyles;
|
|
234
|
+
focus?: StateStyles;
|
|
235
|
+
active?: StateStyles;
|
|
227
236
|
as?: string;
|
|
228
237
|
render?: RenderProp<BoxRenderProps>;
|
|
229
238
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,12 @@ type MinWidth = Spacing | Fraction | SizingSpecial | WidthViewport;
|
|
|
117
117
|
type MaxWidth = Spacing | Fraction | MaxWidthSpecial | WidthViewport;
|
|
118
118
|
type MinHeight = Spacing | Fraction | SizingSpecial | HeightViewport;
|
|
119
119
|
type MaxHeight = Spacing | Fraction | SizingSpecial | HeightViewport;
|
|
120
|
+
interface StateStyles {
|
|
121
|
+
color?: FontColor;
|
|
122
|
+
backgroundColor?: BackgroundColor;
|
|
123
|
+
borderColor?: BorderColor;
|
|
124
|
+
opacity?: Opacity;
|
|
125
|
+
}
|
|
120
126
|
|
|
121
127
|
type RenderProp<P = Record<string, unknown>> = ReactElement | ((props: P) => ReactElement);
|
|
122
128
|
/**
|
|
@@ -224,6 +230,9 @@ interface BoxProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
|
|
|
224
230
|
order?: number;
|
|
225
231
|
zIndex?: number;
|
|
226
232
|
theme?: string;
|
|
233
|
+
hover?: StateStyles;
|
|
234
|
+
focus?: StateStyles;
|
|
235
|
+
active?: StateStyles;
|
|
227
236
|
as?: string;
|
|
228
237
|
render?: RenderProp<BoxRenderProps>;
|
|
229
238
|
}
|
package/dist/index.js
CHANGED
|
@@ -2284,6 +2284,37 @@ function isMinHeightPreset(value) {
|
|
|
2284
2284
|
function isMaxHeightPreset(value) {
|
|
2285
2285
|
return value in maxHeightMap;
|
|
2286
2286
|
}
|
|
2287
|
+
function addStatePrefix(prefix, className) {
|
|
2288
|
+
if (!className) return "";
|
|
2289
|
+
return className.split(" ").filter(Boolean).map((cls) => `${prefix}:${cls}`).join(" ");
|
|
2290
|
+
}
|
|
2291
|
+
function mapStateStyles(prefix, styles) {
|
|
2292
|
+
if (!styles) return "";
|
|
2293
|
+
const classes = [];
|
|
2294
|
+
if (styles.color !== void 0) {
|
|
2295
|
+
const colorClass = mapTextColor(
|
|
2296
|
+
typeof styles.color === "boolean" ? "true" : String(styles.color)
|
|
2297
|
+
);
|
|
2298
|
+
if (colorClass) classes.push(addStatePrefix(prefix, colorClass));
|
|
2299
|
+
}
|
|
2300
|
+
if (styles.backgroundColor !== void 0) {
|
|
2301
|
+
const bgClass = mapBackgroundColor(
|
|
2302
|
+
typeof styles.backgroundColor === "boolean" ? "true" : String(styles.backgroundColor)
|
|
2303
|
+
);
|
|
2304
|
+
if (bgClass) classes.push(addStatePrefix(prefix, bgClass));
|
|
2305
|
+
}
|
|
2306
|
+
if (styles.borderColor !== void 0) {
|
|
2307
|
+
const borderClass = mapBorderColor(
|
|
2308
|
+
typeof styles.borderColor === "boolean" ? "true" : String(styles.borderColor)
|
|
2309
|
+
);
|
|
2310
|
+
if (borderClass) classes.push(addStatePrefix(prefix, borderClass));
|
|
2311
|
+
}
|
|
2312
|
+
if (styles.opacity !== void 0) {
|
|
2313
|
+
const opacityClass = mapOpacity(styles.opacity);
|
|
2314
|
+
if (opacityClass) classes.push(addStatePrefix(prefix, opacityClass));
|
|
2315
|
+
}
|
|
2316
|
+
return classes.join(" ");
|
|
2317
|
+
}
|
|
2287
2318
|
var sizeMap = {
|
|
2288
2319
|
xs: "w-3 h-3",
|
|
2289
2320
|
sm: "w-4 h-4",
|
|
@@ -2499,6 +2530,9 @@ var Box = react.forwardRef(function Box2({
|
|
|
2499
2530
|
order,
|
|
2500
2531
|
zIndex,
|
|
2501
2532
|
theme,
|
|
2533
|
+
hover,
|
|
2534
|
+
focus,
|
|
2535
|
+
active,
|
|
2502
2536
|
as = "div",
|
|
2503
2537
|
render,
|
|
2504
2538
|
className,
|
|
@@ -2553,6 +2587,9 @@ var Box = react.forwardRef(function Box2({
|
|
|
2553
2587
|
mapPointerEvents(pointerEvents),
|
|
2554
2588
|
mapAlignSelf(alignSelf),
|
|
2555
2589
|
theme && `${theme}-theme`,
|
|
2590
|
+
mapStateStyles("hover", hover),
|
|
2591
|
+
mapStateStyles("focus", focus),
|
|
2592
|
+
mapStateStyles("active", active),
|
|
2556
2593
|
className
|
|
2557
2594
|
);
|
|
2558
2595
|
const widthStyle = getSizingStyle(width, isWidthPreset);
|