@malexander-tech/ui 0.0.0-stage → 0.2.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/components/Alert.d.ts +9 -0
- package/dist/components/Alert.d.ts.map +1 -0
- package/dist/components/Alert.js +11 -0
- package/dist/components/Button.d.ts +7 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +6 -0
- package/dist/components/Card.d.ts +7 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +5 -0
- package/dist/components/Field.d.ts +9 -0
- package/dist/components/Field.d.ts.map +1 -0
- package/dist/components/Field.js +15 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/styles.css +133 -0
- package/package.json +34 -4
- package/README.md +0 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
export type AlertTone = "error" | "success" | "warning";
|
|
3
|
+
export type AlertProps = ComponentPropsWithRef<"div"> & {
|
|
4
|
+
title: string;
|
|
5
|
+
tone: AlertTone;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare function Alert({ children, className, role, title, tone, ...props }: AlertProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=Alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAMF,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,UAAU,+BAmBZ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const toneLabel = {
|
|
3
|
+
error: "Error",
|
|
4
|
+
success: "Success",
|
|
5
|
+
warning: "Warning",
|
|
6
|
+
};
|
|
7
|
+
export function Alert({ children, className, role, title, tone, ...props }) {
|
|
8
|
+
return (_jsxs("div", { ...props, className: ["mat-alert", `mat-alert--${tone}`, className]
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
.join(" "), role: role ?? (tone === "error" ? "alert" : "status"), children: [_jsx("span", { "aria-hidden": "true", className: "mat-alert__accent" }), _jsxs("div", { children: [_jsxs("strong", { className: "mat-alert__title", children: [_jsxs("span", { className: "mat-alert__tone", children: [toneLabel[tone], ": "] }), title] }), _jsx("div", { className: "mat-alert__body", children: children })] })] }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
export type ButtonProps = ComponentPropsWithRef<"button"> & {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
variant?: "primary" | "secondary";
|
|
5
|
+
};
|
|
6
|
+
export declare function Button({ children, className, variant, type, ...props }: ButtonProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,WAAW,GAAG,qBAAqB,CAAC,QAAQ,CAAC,GAAG;IAC1D,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;CACnC,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,SAAS,EACT,OAAmB,EACnB,IAAe,EACf,GAAG,KAAK,EACT,EAAE,WAAW,+BAYb"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function Button({ children, className, variant = "primary", type = "button", ...props }) {
|
|
3
|
+
return (_jsx("button", { ...props, className: ["mat-button", `mat-button--${variant}`, className]
|
|
4
|
+
.filter(Boolean)
|
|
5
|
+
.join(" "), type: type, children: children }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
export type CardProps = ComponentPropsWithRef<"article" | "section" | "div"> & {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
as?: "article" | "section" | "div";
|
|
5
|
+
};
|
|
6
|
+
export declare function Card({ as, children, className, ...props }: CardProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3E,MAAM,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG;IAC7E,QAAQ,EAAE,SAAS,CAAC;IACpB,EAAE,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,CAAC;CACpC,CAAC;AACF,wBAAgB,IAAI,CAAC,EACnB,EAAc,EACd,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,SAAS,+BAUX"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from "react";
|
|
2
|
+
export type FieldProps = Omit<ComponentPropsWithRef<"input">, "id"> & {
|
|
3
|
+
label: string;
|
|
4
|
+
helperText?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
id?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function Field({ "aria-describedby": consumerDescribedBy, className, disabled, error, helperText, id: providedId, label, required, ...inputProps }: FieldProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=Field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/components/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,GAAG;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AACF,wBAAgB,KAAK,CAAC,EACpB,kBAAkB,EAAE,mBAAmB,EACvC,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,EACV,EAAE,EAAE,UAAU,EACd,KAAK,EACL,QAAQ,EACR,GAAG,UAAU,EACd,EAAE,UAAU,+BAsCZ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
export function Field({ "aria-describedby": consumerDescribedBy, className, disabled, error, helperText, id: providedId, label, required, ...inputProps }) {
|
|
4
|
+
const generatedId = useId();
|
|
5
|
+
const id = providedId ?? generatedId;
|
|
6
|
+
const message = error ?? helperText;
|
|
7
|
+
const messageId = message ? `${id}-message` : undefined;
|
|
8
|
+
const describedBy = [consumerDescribedBy, messageId].filter(Boolean).join(" ") || undefined;
|
|
9
|
+
return (_jsxs("div", { className: ["mat-field", className].filter(Boolean).join(" "), children: [_jsxs("label", { className: "mat-field__label", htmlFor: id, children: [label, required ? _jsx("span", { "aria-hidden": "true", children: " *" }) : null] }), _jsx("input", { ...inputProps, "aria-describedby": describedBy, "aria-invalid": error ? true : undefined, className: "mat-field__input", disabled: disabled, id: id, required: required }), message ? (_jsx("p", { className: [
|
|
10
|
+
"mat-field__message",
|
|
11
|
+
error ? "mat-field__message--error" : "",
|
|
12
|
+
]
|
|
13
|
+
.filter(Boolean)
|
|
14
|
+
.join(" "), id: messageId, role: error ? "alert" : undefined, children: message })) : null] }));
|
|
15
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { AlertProps, AlertTone } from "./components/Alert.js";
|
|
2
|
+
export { Alert } from "./components/Alert.js";
|
|
3
|
+
export type { ButtonProps } from "./components/Button.js";
|
|
4
|
+
export { Button } from "./components/Button.js";
|
|
5
|
+
export type { CardProps } from "./components/Card.js";
|
|
6
|
+
export { Card } from "./components/Card.js";
|
|
7
|
+
export type { FieldProps } from "./components/Field.js";
|
|
8
|
+
export { Field } from "./components/Field.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
package/dist/styles.css
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
@import "@malexander-tech/tokens/css";
|
|
2
|
+
|
|
3
|
+
.mat-button,
|
|
4
|
+
.mat-field__input,
|
|
5
|
+
.mat-card,
|
|
6
|
+
.mat-alert {
|
|
7
|
+
border: var(--mat-border-width) solid var(--mat-color-border-default);
|
|
8
|
+
box-shadow: var(--mat-shadow);
|
|
9
|
+
}
|
|
10
|
+
.mat-button,
|
|
11
|
+
.mat-field,
|
|
12
|
+
.mat-field__input,
|
|
13
|
+
.mat-card,
|
|
14
|
+
.mat-alert {
|
|
15
|
+
font-family: var(--mat-font-family-base);
|
|
16
|
+
font-size: var(--mat-font-size-md);
|
|
17
|
+
}
|
|
18
|
+
.mat-field,
|
|
19
|
+
.mat-card,
|
|
20
|
+
.mat-alert {
|
|
21
|
+
line-height: var(--mat-line-height-md);
|
|
22
|
+
}
|
|
23
|
+
.mat-button {
|
|
24
|
+
align-items: center;
|
|
25
|
+
background: var(--mat-color-action-primary);
|
|
26
|
+
border-radius: var(--mat-control-radius);
|
|
27
|
+
color: var(--mat-color-text-on-primary);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
min-height: var(--mat-control-min-height);
|
|
33
|
+
padding: var(--mat-space-4) var(--mat-space-6);
|
|
34
|
+
}
|
|
35
|
+
.mat-button:hover:not(:disabled) {
|
|
36
|
+
background: var(--mat-color-action-primary-hover);
|
|
37
|
+
}
|
|
38
|
+
.mat-button:active:not(:disabled) {
|
|
39
|
+
box-shadow: none;
|
|
40
|
+
transform: translate(var(--mat-pressed-offset), var(--mat-pressed-offset));
|
|
41
|
+
}
|
|
42
|
+
.mat-button:focus-visible,
|
|
43
|
+
.mat-field__input:focus-visible {
|
|
44
|
+
outline: 3px solid var(--mat-color-focus-ring);
|
|
45
|
+
outline-offset: 3px;
|
|
46
|
+
}
|
|
47
|
+
.mat-button:disabled,
|
|
48
|
+
.mat-field__input:disabled {
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
opacity: 0.55;
|
|
51
|
+
}
|
|
52
|
+
.mat-button--secondary {
|
|
53
|
+
background: var(--mat-color-surface-card);
|
|
54
|
+
color: var(--mat-color-text-default);
|
|
55
|
+
}
|
|
56
|
+
.mat-button--secondary:hover:not(:disabled) {
|
|
57
|
+
background: var(--mat-color-surface-card-hover);
|
|
58
|
+
}
|
|
59
|
+
.mat-card {
|
|
60
|
+
background: var(--mat-color-surface-card);
|
|
61
|
+
border-radius: var(--mat-control-radius);
|
|
62
|
+
color: var(--mat-color-text-default);
|
|
63
|
+
padding: var(--mat-space-6);
|
|
64
|
+
}
|
|
65
|
+
.mat-field {
|
|
66
|
+
color: var(--mat-color-text-default);
|
|
67
|
+
display: grid;
|
|
68
|
+
gap: var(--mat-space-3);
|
|
69
|
+
}
|
|
70
|
+
.mat-field__label {
|
|
71
|
+
font-weight: 700;
|
|
72
|
+
}
|
|
73
|
+
.mat-field__input {
|
|
74
|
+
background: var(--mat-color-surface-card);
|
|
75
|
+
border-radius: var(--mat-control-radius);
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
color: var(--mat-color-text-default);
|
|
78
|
+
min-height: var(--mat-control-min-height);
|
|
79
|
+
padding: 0 var(--mat-space-4);
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
.mat-field__message {
|
|
83
|
+
font-size: var(--mat-font-size-sm);
|
|
84
|
+
line-height: var(--mat-line-height-sm);
|
|
85
|
+
margin: 0;
|
|
86
|
+
}
|
|
87
|
+
.mat-field__message--error {
|
|
88
|
+
color: var(--mat-color-feedback-error);
|
|
89
|
+
}
|
|
90
|
+
.mat-field:has(.mat-field__message--error) .mat-field__input {
|
|
91
|
+
border-color: var(--mat-color-feedback-error);
|
|
92
|
+
}
|
|
93
|
+
.mat-alert {
|
|
94
|
+
align-items: flex-start;
|
|
95
|
+
background: var(--mat-color-surface-card);
|
|
96
|
+
border-radius: var(--mat-control-radius);
|
|
97
|
+
color: var(--mat-color-text-default);
|
|
98
|
+
display: grid;
|
|
99
|
+
gap: var(--mat-space-3);
|
|
100
|
+
grid-template-columns: 8px 1fr;
|
|
101
|
+
padding: var(--mat-space-4);
|
|
102
|
+
}
|
|
103
|
+
.mat-alert__accent {
|
|
104
|
+
align-self: stretch;
|
|
105
|
+
background: currentColor;
|
|
106
|
+
border-radius: 999px;
|
|
107
|
+
min-height: 2rem;
|
|
108
|
+
}
|
|
109
|
+
.mat-alert--error {
|
|
110
|
+
color: var(--mat-color-feedback-error);
|
|
111
|
+
}
|
|
112
|
+
.mat-alert--success {
|
|
113
|
+
color: var(--mat-color-feedback-success);
|
|
114
|
+
}
|
|
115
|
+
.mat-alert--warning {
|
|
116
|
+
color: var(--mat-color-feedback-warning);
|
|
117
|
+
}
|
|
118
|
+
.mat-alert__title {
|
|
119
|
+
color: var(--mat-color-text-default);
|
|
120
|
+
display: block;
|
|
121
|
+
}
|
|
122
|
+
.mat-alert__tone {
|
|
123
|
+
block-size: 1px;
|
|
124
|
+
clip-path: inset(50%);
|
|
125
|
+
inline-size: 1px;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
position: absolute;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
}
|
|
130
|
+
.mat-alert__body {
|
|
131
|
+
color: var(--mat-color-text-default);
|
|
132
|
+
margin-top: var(--mat-space-1);
|
|
133
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malexander-tech/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./styles.css": "./dist/styles.css"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -p tsconfig.json && cp src/styles.css dist/styles.css",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": "^19.0.0",
|
|
21
|
+
"react-dom": "^19.0.0"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@malexander-tech/tokens": "0.2.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"registry": "https://registry.npmjs.org",
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/malexandertech/malexandertech-design-system.git",
|
|
33
|
+
"directory": "packages/ui"
|
|
34
|
+
},
|
|
35
|
+
"license": "MIT"
|
|
36
|
+
}
|
package/README.md
DELETED