@jalvin/ui 1.0.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/dist/button.d.ts +28 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +87 -0
- package/dist/button.js.map +1 -0
- package/dist/colors.d.ts +28 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +39 -0
- package/dist/colors.js.map +1 -0
- package/dist/image.d.ts +21 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +53 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/input.d.ts +22 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +48 -0
- package/dist/input.js.map +1 -0
- package/dist/layout.d.ts +31 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +81 -0
- package/dist/layout.js.map +1 -0
- package/dist/modifier.d.ts +84 -0
- package/dist/modifier.d.ts.map +1 -0
- package/dist/modifier.js +160 -0
- package/dist/modifier.js.map +1 -0
- package/dist/spacer.d.ts +23 -0
- package/dist/spacer.d.ts.map +1 -0
- package/dist/spacer.js +39 -0
- package/dist/spacer.js.map +1 -0
- package/dist/surface.d.ts +33 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +77 -0
- package/dist/surface.js.map +1 -0
- package/dist/text.d.ts +18 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +29 -0
- package/dist/text.js.map +1 -0
- package/dist/typography.d.ts +137 -0
- package/dist/typography.d.ts.map +1 -0
- package/dist/typography.js +34 -0
- package/dist/typography.js.map +1 -0
- package/package.json +35 -0
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Modifier } from "./modifier.js";
|
|
3
|
+
export type ButtonVariant = "filled" | "outlined" | "text" | "tonal";
|
|
4
|
+
export interface ButtonProps {
|
|
5
|
+
text?: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
modifier?: Modifier;
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Icon rendered before the label */
|
|
12
|
+
leadingIcon?: React.ReactNode;
|
|
13
|
+
/** Icon rendered after the label */
|
|
14
|
+
trailingIcon?: React.ReactNode;
|
|
15
|
+
type?: "button" | "submit" | "reset";
|
|
16
|
+
}
|
|
17
|
+
/** Button — analogous to Compose's Button / OutlinedButton / TextButton. */
|
|
18
|
+
export declare function Button({ text, children, onClick, modifier, variant, enabled, leadingIcon, trailingIcon, type, }: ButtonProps): React.ReactElement;
|
|
19
|
+
export interface IconButtonProps {
|
|
20
|
+
onClick?: () => void;
|
|
21
|
+
modifier?: Modifier;
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
"aria-label"?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Icon-only circular button. */
|
|
27
|
+
export declare function IconButton({ onClick, modifier, enabled, children, "aria-label": ariaLabel, }: IconButtonProps): React.ReactElement;
|
|
28
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../src/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qCAAqC;IACrC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,oCAAoC;IACpC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;CACtC;AAwCD,4EAA4E;AAC5E,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAkB,EAClB,OAAc,EACd,WAAW,EACX,YAAY,EACZ,IAAe,GAChB,EAAE,WAAW,GAAG,KAAK,CAAC,YAAY,CAoBlC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,iCAAiC;AACjC,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,OAAc,EACd,QAAQ,EACR,YAAY,EAAE,SAAS,GACxB,EAAE,eAAe,GAAG,KAAK,CAAC,YAAY,CAuBtC"}
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Button = Button;
|
|
7
|
+
exports.IconButton = IconButton;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const colors_js_1 = require("./colors.js");
|
|
10
|
+
const BASE = {
|
|
11
|
+
display: "inline-flex",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
justifyContent: "center",
|
|
14
|
+
gap: "8px",
|
|
15
|
+
padding: "8px 16px",
|
|
16
|
+
borderRadius: "20px",
|
|
17
|
+
fontSize: "0.875rem",
|
|
18
|
+
fontWeight: 500,
|
|
19
|
+
letterSpacing: "0.031em",
|
|
20
|
+
cursor: "pointer",
|
|
21
|
+
border: "none",
|
|
22
|
+
outline: "none",
|
|
23
|
+
transition: "background-color 0.15s, opacity 0.15s",
|
|
24
|
+
userSelect: "none",
|
|
25
|
+
};
|
|
26
|
+
const VARIANT_STYLES = {
|
|
27
|
+
filled: {
|
|
28
|
+
backgroundColor: colors_js_1.Color.Primary,
|
|
29
|
+
color: colors_js_1.Color.OnPrimary,
|
|
30
|
+
},
|
|
31
|
+
outlined: {
|
|
32
|
+
backgroundColor: "transparent",
|
|
33
|
+
color: colors_js_1.Color.Primary,
|
|
34
|
+
border: `1px solid ${colors_js_1.Color.Primary}`,
|
|
35
|
+
},
|
|
36
|
+
text: {
|
|
37
|
+
backgroundColor: "transparent",
|
|
38
|
+
color: colors_js_1.Color.Primary,
|
|
39
|
+
padding: "8px 12px",
|
|
40
|
+
},
|
|
41
|
+
tonal: {
|
|
42
|
+
backgroundColor: colors_js_1.Color.PrimaryLight + "33",
|
|
43
|
+
color: colors_js_1.Color.Primary,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
/** Button — analogous to Compose's Button / OutlinedButton / TextButton. */
|
|
47
|
+
function Button({ text, children, onClick, modifier, variant = "filled", enabled = true, leadingIcon, trailingIcon, type = "button", }) {
|
|
48
|
+
const modProps = modifier?.toProps() ?? {};
|
|
49
|
+
return react_1.default.createElement("button", {
|
|
50
|
+
type,
|
|
51
|
+
onClick: enabled ? onClick : undefined,
|
|
52
|
+
disabled: !enabled,
|
|
53
|
+
...modProps,
|
|
54
|
+
style: {
|
|
55
|
+
...BASE,
|
|
56
|
+
...VARIANT_STYLES[variant],
|
|
57
|
+
opacity: enabled ? 1 : 0.4,
|
|
58
|
+
...modProps.style,
|
|
59
|
+
},
|
|
60
|
+
}, leadingIcon, text ?? children, trailingIcon);
|
|
61
|
+
}
|
|
62
|
+
/** Icon-only circular button. */
|
|
63
|
+
function IconButton({ onClick, modifier, enabled = true, children, "aria-label": ariaLabel, }) {
|
|
64
|
+
const modProps = modifier?.toProps() ?? {};
|
|
65
|
+
return react_1.default.createElement("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
onClick: enabled ? onClick : undefined,
|
|
68
|
+
disabled: !enabled,
|
|
69
|
+
"aria-label": ariaLabel,
|
|
70
|
+
...modProps,
|
|
71
|
+
style: {
|
|
72
|
+
display: "inline-flex",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
justifyContent: "center",
|
|
75
|
+
width: "40px",
|
|
76
|
+
height: "40px",
|
|
77
|
+
borderRadius: "50%",
|
|
78
|
+
border: "none",
|
|
79
|
+
background: "transparent",
|
|
80
|
+
cursor: enabled ? "pointer" : "default",
|
|
81
|
+
opacity: enabled ? 1 : 0.4,
|
|
82
|
+
transition: "background-color 0.15s",
|
|
83
|
+
...modProps.style,
|
|
84
|
+
},
|
|
85
|
+
}, children);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../src/button.tsx"],"names":[],"mappings":";;;;;AA4DA,wBA8BC;AAWD,gCA6BC;AAlID,kDAA0B;AAE1B,2CAAoC;AAmBpC,MAAM,IAAI,GAAkB;IAC1B,OAAO,EAAE,aAAa;IACtB,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,MAAM;IACpB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,GAAG;IACf,aAAa,EAAE,SAAS;IACxB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,MAAM;IACd,O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B,YAAY,CACb,CAAC;AACJ,CAAC;AAUD,iCAAiC;AACjC,SAAgB,UAAU,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,OAAO,GAAG,IAAI,EACd,QAAQ,EACR,YAAY,EAAE,SAAS,GACP;IAChB,MAAM,QAAQ,GAAG,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3C,OAAO,eAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;QACnC,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;QACtC,QAAQ,EAAE,CAAC,OAAO;QAClB,YAAY,EAAE,SAAS;QACvB,GAAG,QAAQ;QACX,KAAK,EAAE;YACL,OAAO,EAAE,aAAa;YACtB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,KAAK;YACnB,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,aAAa;YACzB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACvC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;YAC1B,UAAU,EAAE,wBAAwB;YACpC,GAAG,QAAQ,CAAC,KAAK;SAClB;KACF,EAAE,QAAQ,CAAC,CAAC;AACf,CAAC"}
|
package/dist/colors.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const Color: {
|
|
2
|
+
readonly White: "#ffffff";
|
|
3
|
+
readonly Black: "#000000";
|
|
4
|
+
readonly Transparent: "transparent";
|
|
5
|
+
readonly Surface: "#f5f5f5";
|
|
6
|
+
readonly SurfaceVariant: "#e7e7e7";
|
|
7
|
+
readonly Outline: "#c4c4c4";
|
|
8
|
+
readonly OnSurface: "#1c1c1c";
|
|
9
|
+
readonly OnSurfaceVariant: "#5c5c5c";
|
|
10
|
+
readonly Primary: "#0066cc";
|
|
11
|
+
readonly PrimaryLight: "#4d94ff";
|
|
12
|
+
readonly PrimaryDark: "#004499";
|
|
13
|
+
readonly OnPrimary: "#ffffff";
|
|
14
|
+
readonly Secondary: "#6750a4";
|
|
15
|
+
readonly SecondaryLight: "#9a82d9";
|
|
16
|
+
readonly OnSecondary: "#ffffff";
|
|
17
|
+
readonly Error: "#b00020";
|
|
18
|
+
readonly ErrorLight: "#ef5350";
|
|
19
|
+
readonly OnError: "#ffffff";
|
|
20
|
+
readonly Success: "#2e7d32";
|
|
21
|
+
readonly SuccessLight: "#66bb6a";
|
|
22
|
+
readonly OnSuccess: "#ffffff";
|
|
23
|
+
readonly Warning: "#f57c00";
|
|
24
|
+
readonly WarningLight: "#ffb74d";
|
|
25
|
+
readonly OnWarning: "#ffffff";
|
|
26
|
+
};
|
|
27
|
+
export type ColorValue = string;
|
|
28
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;CAoCR,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC"}
|
package/dist/colors.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
// Color — named color constants matching Material Design 3 + extras
|
|
4
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Color = void 0;
|
|
7
|
+
exports.Color = {
|
|
8
|
+
// Grays
|
|
9
|
+
White: "#ffffff",
|
|
10
|
+
Black: "#000000",
|
|
11
|
+
Transparent: "transparent",
|
|
12
|
+
Surface: "#f5f5f5",
|
|
13
|
+
SurfaceVariant: "#e7e7e7",
|
|
14
|
+
Outline: "#c4c4c4",
|
|
15
|
+
OnSurface: "#1c1c1c",
|
|
16
|
+
OnSurfaceVariant: "#5c5c5c",
|
|
17
|
+
// Primary
|
|
18
|
+
Primary: "#0066cc",
|
|
19
|
+
PrimaryLight: "#4d94ff",
|
|
20
|
+
PrimaryDark: "#004499",
|
|
21
|
+
OnPrimary: "#ffffff",
|
|
22
|
+
// Secondary
|
|
23
|
+
Secondary: "#6750a4",
|
|
24
|
+
SecondaryLight: "#9a82d9",
|
|
25
|
+
OnSecondary: "#ffffff",
|
|
26
|
+
// Error
|
|
27
|
+
Error: "#b00020",
|
|
28
|
+
ErrorLight: "#ef5350",
|
|
29
|
+
OnError: "#ffffff",
|
|
30
|
+
// Success
|
|
31
|
+
Success: "#2e7d32",
|
|
32
|
+
SuccessLight: "#66bb6a",
|
|
33
|
+
OnSuccess: "#ffffff",
|
|
34
|
+
// Warning
|
|
35
|
+
Warning: "#f57c00",
|
|
36
|
+
WarningLight: "#ffb74d",
|
|
37
|
+
OnWarning: "#ffffff",
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oEAAoE;AACpE,gFAAgF;;;AAEnE,QAAA,KAAK,GAAG;IACnB,QAAQ;IACR,KAAK,EAAS,SAAS;IACvB,KAAK,EAAS,SAAS;IACvB,WAAW,EAAG,aAAa;IAC3B,OAAO,EAAO,SAAS;IACvB,cAAc,EAAE,SAAS;IACzB,OAAO,EAAO,SAAS;IACvB,SAAS,EAAK,SAAS;IACvB,gBAAgB,EAAE,SAAS;IAE3B,UAAU;IACV,OAAO,EAAO,SAAS;IACvB,YAAY,EAAE,SAAS;IACvB,WAAW,EAAG,SAAS;IACvB,SAAS,EAAK,SAAS;IAEvB,YAAY;IACZ,SAAS,EAAK,SAAS;IACvB,cAAc,EAAE,SAAS;IACzB,WAAW,EAAG,SAAS;IAEvB,QAAQ;IACR,KAAK,EAAS,SAAS;IACvB,UAAU,EAAI,SAAS;IACvB,OAAO,EAAO,SAAS;IAEvB,UAAU;IACV,OAAO,EAAO,SAAS;IACvB,YAAY,EAAE,SAAS;IACvB,SAAS,EAAK,SAAS;IAEvB,UAAU;IACV,OAAO,EAAO,SAAS;IACvB,YAAY,EAAE,SAAS;IACvB,SAAS,EAAK,SAAS;CACf,CAAC"}
|
package/dist/image.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Modifier } from "./modifier.js";
|
|
3
|
+
export interface ImageProps {
|
|
4
|
+
src: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
modifier?: Modifier;
|
|
7
|
+
contentScale?: "fill" | "fit" | "crop" | "none";
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
/** Image element — analogous to Compose's Image. */
|
|
11
|
+
export declare function Image({ src, alt, modifier, contentScale, onClick, }: ImageProps): React.ReactElement;
|
|
12
|
+
export interface AsyncImageProps extends ImageProps {
|
|
13
|
+
loadingPlaceholder?: React.ReactNode;
|
|
14
|
+
errorPlaceholder?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Image that handles loading/error states.
|
|
18
|
+
* Falls back to placeholder content on error.
|
|
19
|
+
*/
|
|
20
|
+
export declare function AsyncImage({ src, alt, modifier, contentScale, onClick, loadingPlaceholder, errorPlaceholder, }: AsyncImageProps): React.ReactElement;
|
|
21
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AASD,oDAAoD;AACpD,wBAAgB,KAAK,CAAC,EACpB,GAAG,EACH,GAAQ,EACR,QAAQ,EACR,YAAoB,EACpB,OAAO,GACR,EAAE,UAAU,GAAG,KAAK,CAAC,YAAY,CAmBjC;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,GAAG,EACH,GAAG,EACH,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,gBAAgB,GACjB,EAAE,eAAe,GAAG,KAAK,CAAC,YAAY,CAmBtC"}
|
package/dist/image.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Image = Image;
|
|
7
|
+
exports.AsyncImage = AsyncImage;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const CONTENT_SCALE = {
|
|
10
|
+
fill: "100% 100%",
|
|
11
|
+
fit: "contain",
|
|
12
|
+
crop: "cover",
|
|
13
|
+
none: "none",
|
|
14
|
+
};
|
|
15
|
+
/** Image element — analogous to Compose's Image. */
|
|
16
|
+
function Image({ src, alt = "", modifier, contentScale = "fit", onClick, }) {
|
|
17
|
+
const modProps = modifier?.toProps() ?? {};
|
|
18
|
+
return react_1.default.createElement("img", {
|
|
19
|
+
src,
|
|
20
|
+
alt,
|
|
21
|
+
onClick,
|
|
22
|
+
...modProps,
|
|
23
|
+
style: {
|
|
24
|
+
objectFit: (contentScale === "fill"
|
|
25
|
+
? "fill"
|
|
26
|
+
: contentScale === "fit"
|
|
27
|
+
? "contain"
|
|
28
|
+
: contentScale === "crop"
|
|
29
|
+
? "cover"
|
|
30
|
+
: "none"),
|
|
31
|
+
cursor: onClick ? "pointer" : undefined,
|
|
32
|
+
...modProps.style,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Image that handles loading/error states.
|
|
38
|
+
* Falls back to placeholder content on error.
|
|
39
|
+
*/
|
|
40
|
+
function AsyncImage({ src, alt, modifier, contentScale, onClick, loadingPlaceholder, errorPlaceholder, }) {
|
|
41
|
+
const [status, setStatus] = react_1.default.useState("loading");
|
|
42
|
+
if (status === "error" && errorPlaceholder) {
|
|
43
|
+
return react_1.default.createElement(react_1.default.Fragment, null, errorPlaceholder);
|
|
44
|
+
}
|
|
45
|
+
return react_1.default.createElement("span", { style: { position: "relative", display: "inline-block" } }, status === "loading" && loadingPlaceholder, react_1.default.createElement(Image, {
|
|
46
|
+
src,
|
|
47
|
+
alt: alt ?? "",
|
|
48
|
+
modifier,
|
|
49
|
+
contentScale,
|
|
50
|
+
onClick,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":";;;;;AAmBA,sBAyBC;AAWD,gCA2BC;AAlFD,kDAA0B;AAW1B,MAAM,aAAa,GAA4D;IAC7E,IAAI,EAAE,WAAW;IACjB,GAAG,EAAG,SAAS;IACf,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,oDAAoD;AACpD,SA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AK,EAAE;QACzB,GAAG;QACH,GAAG,EAAE,GAAG,IAAI,EAAE;QACd,QAAQ;QACR,YAAY;QACZ,OAAO;KACR,CAAC,CAGH,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Modifier } from "./modifier.js";
|
|
2
|
+
export { Color } from "./colors.js";
|
|
3
|
+
export type { ColorValue } from "./colors.js";
|
|
4
|
+
export { TextStyle, textStyleToCSS } from "./typography.js";
|
|
5
|
+
export type { TextStyleDef, TextStyleKey } from "./typography.js";
|
|
6
|
+
export { Column, Row, Box } from "./layout.js";
|
|
7
|
+
export type { ColumnProps, RowProps, BoxProps, Alignment, Arrangement } from "./layout.js";
|
|
8
|
+
export { Text } from "./text.js";
|
|
9
|
+
export type { TextProps } from "./text.js";
|
|
10
|
+
export { Button, IconButton } from "./button.js";
|
|
11
|
+
export type { ButtonProps, ButtonVariant, IconButtonProps } from "./button.js";
|
|
12
|
+
export { Spacer, Divider } from "./spacer.js";
|
|
13
|
+
export type { SpacerProps, DividerProps } from "./spacer.js";
|
|
14
|
+
export { Input } from "./input.js";
|
|
15
|
+
export type { InputProps } from "./input.js";
|
|
16
|
+
export { Card, Scaffold, TopBar } from "./surface.js";
|
|
17
|
+
export type { CardProps, ScaffoldProps, TopBarProps } from "./surface.js";
|
|
18
|
+
export { Image, AsyncImage } from "./image.js";
|
|
19
|
+
export type { ImageProps, AsyncImageProps } from "./image.js";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG3F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG/E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG1E,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @jalvin/ui — Compose-style React component library
|
|
3
|
+
//
|
|
4
|
+
// Usage example (in a .jalvin file):
|
|
5
|
+
// import { Column, Row, Text, Button, Modifier, Color } from "@jalvin/ui"
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AsyncImage = exports.Image = exports.TopBar = exports.Scaffold = exports.Card = exports.Input = exports.Divider = exports.Spacer = exports.IconButton = exports.Button = exports.Text = exports.Box = exports.Row = exports.Column = exports.textStyleToCSS = exports.TextStyle = exports.Color = exports.Modifier = void 0;
|
|
8
|
+
var modifier_js_1 = require("./modifier.js");
|
|
9
|
+
Object.defineProperty(exports, "Modifier", { enumerable: true, get: function () { return modifier_js_1.Modifier; } });
|
|
10
|
+
var colors_js_1 = require("./colors.js");
|
|
11
|
+
Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return colors_js_1.Color; } });
|
|
12
|
+
var typography_js_1 = require("./typography.js");
|
|
13
|
+
Object.defineProperty(exports, "TextStyle", { enumerable: true, get: function () { return typography_js_1.TextStyle; } });
|
|
14
|
+
Object.defineProperty(exports, "textStyleToCSS", { enumerable: true, get: function () { return typography_js_1.textStyleToCSS; } });
|
|
15
|
+
// Layout
|
|
16
|
+
var layout_js_1 = require("./layout.js");
|
|
17
|
+
Object.defineProperty(exports, "Column", { enumerable: true, get: function () { return layout_js_1.Column; } });
|
|
18
|
+
Object.defineProperty(exports, "Row", { enumerable: true, get: function () { return layout_js_1.Row; } });
|
|
19
|
+
Object.defineProperty(exports, "Box", { enumerable: true, get: function () { return layout_js_1.Box; } });
|
|
20
|
+
// Text
|
|
21
|
+
var text_js_1 = require("./text.js");
|
|
22
|
+
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return text_js_1.Text; } });
|
|
23
|
+
// Buttons
|
|
24
|
+
var button_js_1 = require("./button.js");
|
|
25
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return button_js_1.Button; } });
|
|
26
|
+
Object.defineProperty(exports, "IconButton", { enumerable: true, get: function () { return button_js_1.IconButton; } });
|
|
27
|
+
// Spacer & Divider
|
|
28
|
+
var spacer_js_1 = require("./spacer.js");
|
|
29
|
+
Object.defineProperty(exports, "Spacer", { enumerable: true, get: function () { return spacer_js_1.Spacer; } });
|
|
30
|
+
Object.defineProperty(exports, "Divider", { enumerable: true, get: function () { return spacer_js_1.Divider; } });
|
|
31
|
+
// Input
|
|
32
|
+
var input_js_1 = require("./input.js");
|
|
33
|
+
Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return input_js_1.Input; } });
|
|
34
|
+
// Surfaces
|
|
35
|
+
var surface_js_1 = require("./surface.js");
|
|
36
|
+
Object.defineProperty(exports, "Card", { enumerable: true, get: function () { return surface_js_1.Card; } });
|
|
37
|
+
Object.defineProperty(exports, "Scaffold", { enumerable: true, get: function () { return surface_js_1.Scaffold; } });
|
|
38
|
+
Object.defineProperty(exports, "TopBar", { enumerable: true, get: function () { return surface_js_1.TopBar; } });
|
|
39
|
+
// Image
|
|
40
|
+
var image_js_1 = require("./image.js");
|
|
41
|
+
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return image_js_1.Image; } });
|
|
42
|
+
Object.defineProperty(exports, "AsyncImage", { enumerable: true, get: function () { return image_js_1.AsyncImage; } });
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,EAAE;AACF,qCAAqC;AACrC,4EAA4E;;;AAE5E,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AAEjB,yCAAoC;AAA3B,kGAAA,KAAK,OAAA;AAGd,iDAA4D;AAAnD,0GAAA,SAAS,OAAA;AAAE,+GAAA,cAAc,OAAA;AAGlC,SAAS;AACT,yCAA+C;AAAtC,mGAAA,MAAM,OAAA;AAAE,gGAAA,GAAG,OAAA;AAAE,gGAAA,GAAG,OAAA;AAGzB,OAAO;AACP,qCAAiC;AAAxB,+FAAA,IAAI,OAAA;AAGb,UAAU;AACV,yCAAiD;AAAxC,mGAAA,MAAM,OAAA;AAAE,uGAAA,UAAU,OAAA;AAG3B,mBAAmB;AACnB,yCAA8C;AAArC,mGAAA,MAAM,OAAA;AAAE,oGAAA,OAAO,OAAA;AAGxB,QAAQ;AACR,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AAGd,WAAW;AACX,2CAAsD;AAA7C,kGAAA,IAAI,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,oGAAA,MAAM,OAAA;AAG/B,QAAQ;AACR,uCAA+C;AAAtC,iGAAA,KAAK,OAAA;AAAE,sGAAA,UAAU,OAAA"}
|
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Modifier } from "./modifier.js";
|
|
3
|
+
export interface InputProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
onValueChange?: (value: string) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
modifier?: Modifier;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
type?: "text" | "email" | "password" | "number" | "search" | "tel" | "url";
|
|
11
|
+
label?: string;
|
|
12
|
+
supportingText?: string;
|
|
13
|
+
isError?: boolean;
|
|
14
|
+
maxLength?: number;
|
|
15
|
+
onFocus?: () => void;
|
|
16
|
+
onBlur?: () => void;
|
|
17
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
18
|
+
autoFocus?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Text input — analogous to Compose's TextField / OutlinedTextField. */
|
|
21
|
+
export declare function Input({ value, onValueChange, placeholder, modifier, enabled, readOnly, type, label, supportingText, isError, maxLength, onFocus, onBlur, onKeyDown, autoFocus, }: InputProps): React.ReactElement;
|
|
22
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,yEAAyE;AACzE,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,aAAa,EACb,WAAW,EACX,QAAQ,EACR,OAAc,EACd,QAAgB,EAChB,IAAa,EACb,KAAK,EACL,cAAc,EACd,OAAe,EACf,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,SAAS,GACV,EAAE,UAAU,GAAG,KAAK,CAAC,YAAY,CA6CjC"}
|
package/dist/input.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Input = Input;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
/** Text input — analogous to Compose's TextField / OutlinedTextField. */
|
|
9
|
+
function Input({ value, onValueChange, placeholder, modifier, enabled = true, readOnly = false, type = "text", label, supportingText, isError = false, maxLength, onFocus, onBlur, onKeyDown, autoFocus, }) {
|
|
10
|
+
const modProps = modifier?.toProps() ?? {};
|
|
11
|
+
const borderColor = isError ? "#b00020" : "#c4c4c4";
|
|
12
|
+
const input = react_1.default.createElement("input", {
|
|
13
|
+
value,
|
|
14
|
+
onChange: (e) => onValueChange?.(e.target.value),
|
|
15
|
+
placeholder,
|
|
16
|
+
disabled: !enabled,
|
|
17
|
+
readOnly,
|
|
18
|
+
type,
|
|
19
|
+
maxLength,
|
|
20
|
+
onFocus,
|
|
21
|
+
onBlur,
|
|
22
|
+
onKeyDown,
|
|
23
|
+
autoFocus,
|
|
24
|
+
style: {
|
|
25
|
+
width: "100%",
|
|
26
|
+
padding: "8px 12px",
|
|
27
|
+
fontSize: "1rem",
|
|
28
|
+
border: `1px solid ${borderColor}`,
|
|
29
|
+
borderRadius: "4px",
|
|
30
|
+
outline: "none",
|
|
31
|
+
backgroundColor: enabled ? "#fff" : "#f5f5f5",
|
|
32
|
+
color: "#1c1c1c",
|
|
33
|
+
boxSizing: "border-box",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
if (!label && !supportingText) {
|
|
37
|
+
return react_1.default.createElement("div", { ...modProps }, input);
|
|
38
|
+
}
|
|
39
|
+
return react_1.default.createElement("div", {
|
|
40
|
+
...modProps,
|
|
41
|
+
style: { display: "flex", flexDirection: "column", gap: "4px", ...modProps.style },
|
|
42
|
+
}, label && react_1.default.createElement("label", {
|
|
43
|
+
style: { fontSize: "0.875rem", fontWeight: 500, color: isError ? "#b00020" : "#5c5c5c" },
|
|
44
|
+
}, label), input, supportingText && react_1.default.createElement("span", {
|
|
45
|
+
style: { fontSize: "0.75rem", color: isError ? "#b00020" : "#5c5c5c" },
|
|
46
|
+
}, supportingText));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.tsx"],"names":[],"mappings":";;;;;AAsBA,sBA6DC;AAnFD,kDAA0B;AAqB1B,yEAAyE;AACzE,SAAgB,KAAK,CAAC,EACpB,KAAK,EACL,aAAa,EACb,WAAW,EACX,QAAQ,EACR,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,KAAK,EAChB,IAAI,GAAG,MAAM,EACb,KAAK,EACL,cAAc,EACd,OAAO,GAAG,KAAK,EACf,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,SAAS,GACE;IACX,MAAM,QAAQ,GAAG,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpD,MAAM,KAAK,GAAG,eAAK,CAAC,aAAa,CAAC,OAAO,EAAE;QACzC,KAAK;QACL,QAAQ,EAAE,CAAC,CAAsC,EAAE,EAAE,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QACrF,WAAW;QACX,QAAQ,EAAE,CAAC,OAAO;QAClB,QAAQ;QACR,IAAI;QACJ,SAAS;QACT,OAAO;QACP,MAAM;QACN,SAAS;QACT,SAAS;QACT,KAAK,EAAE;YACL,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,UAAU;YACnB,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,aAAa,WAAW,EAAE;YAClC,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE,MAAM;YACf,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YAC7C,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,YAAqB;SACjC;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;QAC9B,OAAO,eAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,GAAG,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,eAAK,CAAC,aAAa,CAAC,KAAK,EAAE;QAChC,GAAG,QAAQ;QACX,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE;KACnF,EACC,KAAK,IAAI,eAAK,CAAC,aAAa,CAAC,OAAO,EAAE;QACpC,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE;KACzF,EAAE,KAAK,CAAC,EACT,KAAK,EACL,cAAc,IAAI,eAAK,CAAC,aAAa,CAAC,MAAM,EAAE;QAC5C,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE;KACvE,EAAE,cAAc,CAAC,CACnB,CAAC;AACJ,CAAC"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Modifier } from "./modifier.js";
|
|
3
|
+
export type Alignment = "start" | "center" | "end" | "stretch";
|
|
4
|
+
export type Arrangement = "start" | "center" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly";
|
|
5
|
+
export interface ColumnProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
modifier?: Modifier;
|
|
8
|
+
spacing?: number;
|
|
9
|
+
verticalArrangement?: Arrangement;
|
|
10
|
+
horizontalAlignment?: Alignment;
|
|
11
|
+
}
|
|
12
|
+
/** Vertical flex container — analogous to Compose's Column. */
|
|
13
|
+
export declare function Column({ children, modifier, spacing, verticalArrangement, horizontalAlignment, }: ColumnProps): React.ReactElement;
|
|
14
|
+
export interface RowProps {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
modifier?: Modifier;
|
|
17
|
+
spacing?: number;
|
|
18
|
+
horizontalArrangement?: Arrangement;
|
|
19
|
+
verticalAlignment?: Alignment;
|
|
20
|
+
wrap?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Horizontal flex container — analogous to Compose's Row. */
|
|
23
|
+
export declare function Row({ children, modifier, spacing, horizontalArrangement, verticalAlignment, wrap, }: RowProps): React.ReactElement;
|
|
24
|
+
export interface BoxProps {
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
modifier?: Modifier;
|
|
27
|
+
contentAlignment?: "topStart" | "topCenter" | "topEnd" | "centerStart" | "center" | "centerEnd" | "bottomStart" | "bottomCenter" | "bottomEnd";
|
|
28
|
+
}
|
|
29
|
+
/** Positioned container — analogous to Compose's Box. */
|
|
30
|
+
export declare function Box({ children, modifier, contentAlignment, }: BoxProps): React.ReactElement;
|
|
31
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAC/D,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,cAAc,GAAG,aAAa,GAAG,aAAa,CAAC;AAsBtG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAClC,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,+DAA+D;AAC/D,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,mBAA6B,EAC7B,mBAA6B,GAC9B,EAAE,WAAW,GAAG,KAAK,CAAC,YAAY,CAalC;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qBAAqB,CAAC,EAAE,WAAW,CAAC;IACpC,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,8DAA8D;AAC9D,wBAAgB,GAAG,CAAC,EAClB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,qBAA+B,EAC/B,iBAA4B,EAC5B,IAAY,GACb,EAAE,QAAQ,GAAG,KAAK,CAAC,YAAY,CAc/B;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,gBAAgB,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,WAAW,CAAC;CAChJ;AAED,yDAAyD;AACzD,wBAAgB,GAAG,CAAC,EAClB,QAAQ,EACR,QAAQ,EACR,gBAA6B,GAC9B,EAAE,QAAQ,GAAG,KAAK,CAAC,YAAY,CAqB/B"}
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Column = Column;
|
|
7
|
+
exports.Row = Row;
|
|
8
|
+
exports.Box = Box;
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
function arrangementToJustify(a) {
|
|
11
|
+
switch (a) {
|
|
12
|
+
case "start": return "flex-start";
|
|
13
|
+
case "center": return "center";
|
|
14
|
+
case "end": return "flex-end";
|
|
15
|
+
case "spaceBetween": return "space-between";
|
|
16
|
+
case "spaceAround": return "space-around";
|
|
17
|
+
case "spaceEvenly": return "space-evenly";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function alignmentToAlign(a) {
|
|
21
|
+
switch (a) {
|
|
22
|
+
case "start": return "flex-start";
|
|
23
|
+
case "center": return "center";
|
|
24
|
+
case "end": return "flex-end";
|
|
25
|
+
case "stretch": return "stretch";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Vertical flex container — analogous to Compose's Column. */
|
|
29
|
+
function Column({ children, modifier, spacing, verticalArrangement = "start", horizontalAlignment = "start", }) {
|
|
30
|
+
const modProps = modifier?.toProps() ?? {};
|
|
31
|
+
return react_1.default.createElement("div", {
|
|
32
|
+
...modProps,
|
|
33
|
+
style: {
|
|
34
|
+
display: "flex",
|
|
35
|
+
flexDirection: "column",
|
|
36
|
+
justifyContent: arrangementToJustify(verticalArrangement),
|
|
37
|
+
alignItems: alignmentToAlign(horizontalAlignment),
|
|
38
|
+
gap: spacing !== undefined ? `${spacing}px` : undefined,
|
|
39
|
+
...modProps.style,
|
|
40
|
+
},
|
|
41
|
+
}, children);
|
|
42
|
+
}
|
|
43
|
+
/** Horizontal flex container — analogous to Compose's Row. */
|
|
44
|
+
function Row({ children, modifier, spacing, horizontalArrangement = "start", verticalAlignment = "center", wrap = false, }) {
|
|
45
|
+
const modProps = modifier?.toProps() ?? {};
|
|
46
|
+
return react_1.default.createElement("div", {
|
|
47
|
+
...modProps,
|
|
48
|
+
style: {
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexDirection: "row",
|
|
51
|
+
justifyContent: arrangementToJustify(horizontalArrangement),
|
|
52
|
+
alignItems: alignmentToAlign(verticalAlignment),
|
|
53
|
+
flexWrap: wrap ? "wrap" : "nowrap",
|
|
54
|
+
gap: spacing !== undefined ? `${spacing}px` : undefined,
|
|
55
|
+
...modProps.style,
|
|
56
|
+
},
|
|
57
|
+
}, children);
|
|
58
|
+
}
|
|
59
|
+
/** Positioned container — analogous to Compose's Box. */
|
|
60
|
+
function Box({ children, modifier, contentAlignment = "topStart", }) {
|
|
61
|
+
const modProps = modifier?.toProps() ?? {};
|
|
62
|
+
const [vertical, horizontal] = contentAlignment === "center"
|
|
63
|
+
? ["center", "center"]
|
|
64
|
+
: contentAlignment.startsWith("top")
|
|
65
|
+
? ["flex-start", contentAlignment.includes("Center") ? "center" : contentAlignment.includes("End") ? "flex-end" : "flex-start"]
|
|
66
|
+
: contentAlignment.startsWith("bottom")
|
|
67
|
+
? ["flex-end", contentAlignment.includes("Center") ? "center" : contentAlignment.includes("End") ? "flex-end" : "flex-start"]
|
|
68
|
+
: ["center", contentAlignment.includes("Center") ? "center" : contentAlignment.includes("End") ? "flex-end" : "flex-start"];
|
|
69
|
+
return react_1.default.createElement("div", {
|
|
70
|
+
...modProps,
|
|
71
|
+
style: {
|
|
72
|
+
position: "relative",
|
|
73
|
+
display: "flex",
|
|
74
|
+
flexDirection: "column",
|
|
75
|
+
alignItems: horizontal,
|
|
76
|
+
justifyContent: vertical,
|
|
77
|
+
...modProps.style,
|
|
78
|
+
},
|
|
79
|
+
}, children);
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":";;;;;AAmCA,wBAmBC;AAYD,kBAqBC;AASD,kBAyBC;AAzHD,kDAA0B;AAM1B,SAAS,oBAAoB,C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