rouse-ui-kit 0.1.1 → 0.1.2

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": "rouse-ui-kit",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Rouse UI Kit — React + MUI component library for Figma Make",
5
5
  "keywords": ["react", "ui-kit", "components", "mui", "figma", "figma-make", "design-system", "rouse"],
6
6
  "type": "module",
package/src/App.tsx CHANGED
@@ -2,6 +2,7 @@ import StarIcon from "@mui/icons-material/Star";
2
2
  import VisibilityIcon from "@mui/icons-material/Visibility";
3
3
  import { Box, Divider, Stack, Typography } from "@mui/material";
4
4
  import { useState } from "react";
5
+ import { AlertStandard, type AlertSeverity } from "./components/Alert";
5
6
  import { ButtonContained, ButtonOutlined, ButtonText } from "./components/Button";
6
7
  import { Checkbox } from "./components/Checkbox";
7
8
  import { IconButtonOutlined } from "./components/IconButton";
@@ -26,6 +27,35 @@ export default function App() {
26
27
  const [menuSearch, setMenuSearch] = useState("");
27
28
  return (
28
29
  <Box sx={{ p: 4, bgcolor: "#f5f5f5", minHeight: "100vh" }}>
30
+ <Typography variant="h5" sx={{ mb: 3, fontWeight: 600 }}>
31
+ Alert / Standard
32
+ </Typography>
33
+ {(["error", "warning", "info", "success", "primary", "secondary"] as AlertSeverity[]).map(
34
+ (severity) => (
35
+ <Stack key={severity} spacing={1.5} sx={{ mb: 3 }}>
36
+ <Typography variant="body2" sx={{ color: "#666", textTransform: "capitalize" }}>
37
+ {severity}
38
+ </Typography>
39
+ <Stack spacing={1}>
40
+ <Box sx={{ width: 400 }}>
41
+ <AlertStandard severity={severity}>Alert content</AlertStandard>
42
+ </Box>
43
+ <Box sx={{ width: 400 }}>
44
+ <AlertStandard severity={severity} title="Title">Alert content</AlertStandard>
45
+ </Box>
46
+ <Box sx={{ width: 400 }}>
47
+ <AlertStandard severity={severity} title="Title" onClose={() => {}}>Alert content</AlertStandard>
48
+ </Box>
49
+ <Box sx={{ width: 400 }}>
50
+ <AlertStandard severity={severity} title="Title" action="Action" onAction={() => {}} onClose={() => {}}>Alert content</AlertStandard>
51
+ </Box>
52
+ </Stack>
53
+ </Stack>
54
+ )
55
+ )}
56
+
57
+ <Divider sx={{ mb: 4 }} />
58
+
29
59
  <Typography variant="h5" sx={{ mb: 3, fontWeight: 600 }}>
30
60
  Button / Contained
31
61
  </Typography>
@@ -0,0 +1,174 @@
1
+ import CheckCircleIcon from "@mui/icons-material/CheckCircle";
2
+ import CloseIcon from "@mui/icons-material/Close";
3
+ import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
4
+ import InfoIcon from "@mui/icons-material/Info";
5
+ import WarningAmberIcon from "@mui/icons-material/WarningAmber";
6
+ import { Box, IconButton, Typography } from "@mui/material";
7
+ import type { ComponentType, ReactNode } from "react";
8
+
9
+ export type AlertSeverity = "error" | "warning" | "info" | "success" | "primary" | "secondary";
10
+
11
+ type SeverityConfig = {
12
+ bg: string;
13
+ border: string;
14
+ color: string;
15
+ Icon: ComponentType<{ sx?: object }>;
16
+ };
17
+
18
+ const severityConfig: Record<AlertSeverity, SeverityConfig> = {
19
+ error: { bg: "#fdeaea", border: "#ef5350", color: "#c62828", Icon: ErrorOutlineIcon }, // light/error/tint, light/error/light, light/error/dark
20
+ warning: { bg: "#fff3e0", border: "#ff9800", color: "#e65100", Icon: WarningAmberIcon }, // light/warning/tint, light/warning/light, light/warning/dark
21
+ info: { bg: "#e1f5fe", border: "#03a9f4", color: "#01579b", Icon: InfoIcon }, // light/info/tint, light/info/light, light/info/dark
22
+ success: { bg: "#eaf5ea", border: "#4caf50", color: "#1b5e20", Icon: CheckCircleIcon }, // light/success/tint, light/success/light, light/success/dark
23
+ primary: { bg: "#f1f1f1", border: "#808080", color: "#4c4c4c", Icon: InfoIcon }, // light/primary/tint, light/primary/light, light/primary/main
24
+ secondary: { bg: "#f7f8fe", border: "#6f8de3", color: "#2c4d9e", Icon: InfoIcon }, // light/background/sky, light/secondary/light, light/secondary/main
25
+ };
26
+
27
+ type AlertStandardProps = {
28
+ severity?: AlertSeverity;
29
+ title?: string;
30
+ children: ReactNode;
31
+ action?: string;
32
+ onAction?: () => void;
33
+ onClose?: () => void;
34
+ };
35
+
36
+ export default function AlertStandard({
37
+ severity = "info",
38
+ title,
39
+ children,
40
+ action,
41
+ onAction,
42
+ onClose,
43
+ }: AlertStandardProps) {
44
+ const { bg, border, color, Icon } = severityConfig[severity];
45
+ const hasActions = Boolean(action || onClose);
46
+
47
+ return (
48
+ <Box
49
+ sx={{
50
+ display: "flex",
51
+ alignItems: "flex-start",
52
+ gap: "12px",
53
+ px: "16px",
54
+ py: "6px",
55
+ borderRadius: "8px",
56
+ border: `1px solid ${border}`,
57
+ bgcolor: bg,
58
+ width: "100%",
59
+ }}
60
+ >
61
+ {/* Severity icon */}
62
+ <Box sx={{ display: "flex", alignItems: "flex-start", pt: "8px", flexShrink: 0 }}>
63
+ <Icon sx={{ fontSize: 20, color }} />
64
+ </Box>
65
+
66
+ {/* Title + message */}
67
+ <Box
68
+ sx={{
69
+ flex: "1 0 0",
70
+ display: "flex",
71
+ flexDirection: "column",
72
+ gap: "4px",
73
+ py: "8px",
74
+ overflow: "hidden",
75
+ wordBreak: "break-word",
76
+ minWidth: 0,
77
+ }}
78
+ >
79
+ {title && (
80
+ <Typography
81
+ sx={{
82
+ fontFamily: "Roboto, sans-serif",
83
+ fontWeight: 500,
84
+ fontSize: 16,
85
+ lineHeight: 1.5,
86
+ letterSpacing: "0.15px",
87
+ color,
88
+ width: "100%",
89
+ }}
90
+ >
91
+ {title}
92
+ </Typography>
93
+ )}
94
+ <Typography
95
+ sx={{
96
+ fontFamily: "Roboto, sans-serif",
97
+ fontWeight: 400,
98
+ fontSize: 14,
99
+ lineHeight: 1.5,
100
+ letterSpacing: "0.15px",
101
+ color,
102
+ width: "100%",
103
+ }}
104
+ >
105
+ {children}
106
+ </Typography>
107
+ </Box>
108
+
109
+ {/* Action link + close button */}
110
+ {hasActions && (
111
+ <Box
112
+ sx={{
113
+ display: "flex",
114
+ alignItems: "center",
115
+ gap: "4px",
116
+ height: "36px",
117
+ pl: "8px",
118
+ py: "2px",
119
+ flexShrink: 0,
120
+ }}
121
+ >
122
+ {action && (
123
+ <Box
124
+ sx={{
125
+ display: "flex",
126
+ alignItems: "center",
127
+ justifyContent: "center",
128
+ height: "32px",
129
+ px: "8px",
130
+ }}
131
+ >
132
+ <Typography
133
+ component="button"
134
+ onClick={onAction}
135
+ sx={{
136
+ fontFamily: "Roboto, sans-serif",
137
+ fontWeight: 500,
138
+ fontSize: 14,
139
+ lineHeight: 1.5,
140
+ letterSpacing: "0.15px",
141
+ color,
142
+ textDecoration: "underline",
143
+ whiteSpace: "nowrap",
144
+ cursor: "pointer",
145
+ background: "none",
146
+ border: "none",
147
+ padding: 0,
148
+ }}
149
+ >
150
+ {action}
151
+ </Typography>
152
+ </Box>
153
+ )}
154
+ {onClose && (
155
+ <IconButton
156
+ size="small"
157
+ onClick={onClose}
158
+ sx={{
159
+ color,
160
+ padding: "8px",
161
+ width: 32,
162
+ height: 32,
163
+ borderRadius: "48px",
164
+ "& .MuiSvgIcon-root": { fontSize: 16 },
165
+ }}
166
+ >
167
+ <CloseIcon />
168
+ </IconButton>
169
+ )}
170
+ </Box>
171
+ )}
172
+ </Box>
173
+ );
174
+ }
@@ -0,0 +1,2 @@
1
+ export { default as AlertStandard } from "./AlertStandard";
2
+ export type { AlertSeverity } from "./AlertStandard";
@@ -4,6 +4,7 @@ import type { ElementType } from "react";
4
4
 
5
5
  type TextFieldOutlinedProps = {
6
6
  label?: string;
7
+ placeholder?: string;
7
8
  value?: string;
8
9
  helperText?: string;
9
10
  error?: boolean;
@@ -11,6 +12,7 @@ type TextFieldOutlinedProps = {
11
12
  clearable?: boolean;
12
13
  icon?: ElementType;
13
14
  type?: string;
15
+ size?: "small" | "medium";
14
16
  onChange?: (value: string) => void;
15
17
  onClear?: () => void;
16
18
  onIconClick?: () => void;
@@ -41,7 +43,8 @@ const borderSx = {
41
43
  };
42
44
 
43
45
  export default function TextFieldOutlined({
44
- label = "Label",
46
+ label,
47
+ placeholder,
45
48
  value = "",
46
49
  helperText,
47
50
  error = false,
@@ -49,6 +52,7 @@ export default function TextFieldOutlined({
49
52
  clearable = false,
50
53
  icon: Icon,
51
54
  type = "text",
55
+ size = "medium",
52
56
  onChange,
53
57
  onClear,
54
58
  onIconClick,
@@ -87,12 +91,14 @@ export default function TextFieldOutlined({
87
91
  return (
88
92
  <TextField
89
93
  variant="outlined"
90
- label={label}
94
+ label={placeholder ? undefined : (label ?? "Label")}
95
+ placeholder={placeholder}
91
96
  value={value}
92
97
  helperText={helperText}
93
98
  error={error}
94
99
  disabled={disabled}
95
100
  type={type}
101
+ size={size}
96
102
  fullWidth
97
103
  onChange={(e) => onChange?.(e.target.value)}
98
104
  slotProps={{
@@ -34,24 +34,29 @@ export const secondary = {
34
34
  export const error = {
35
35
  light: "#ef5350",
36
36
  main: "#d32f2f",
37
+ dark: "#c62828", // light/error/dark — alert text color
37
38
  tint: "#fdeaea",
38
39
  } as const;
39
40
 
40
41
  export const warning = {
41
42
  lighter: "#ffd28c",
43
+ light: "#ff9800", // light/warning/light — alert border color
42
44
  main: "#ef6c00",
45
+ dark: "#e65100", // light/warning/dark — alert text color
43
46
  tint: "#fff3e0",
44
47
  } as const;
45
48
 
46
49
  export const success = {
47
50
  light: "#4caf50",
48
51
  main: "#2e7d32",
52
+ dark: "#1b5e20", // light/success/dark — alert text color
49
53
  tint: "#eaf5ea",
50
54
  } as const;
51
55
 
52
56
  export const info = {
53
57
  light: "#03a9f4",
54
58
  main: "#0288d1",
59
+ dark: "#01579b", // light/info/dark — alert text color
55
60
  tint: "#e1f5fe",
56
61
  } as const;
57
62
 
@@ -67,6 +72,7 @@ export const background = {
67
72
  white: "#ffffff",
68
73
  paper: "#fafafa",
69
74
  default: "#f5f5f5",
75
+ sky: "#f7f8fe", // light/background/sky — secondary alert background
70
76
  } as const;
71
77
 
72
78
  // ─── Gray scale ───────────────────────────────────────────────────────────────
package/src/index.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  // Rouse UI Kit — public exports
2
2
  // Import this package in Figma Make to use all components.
3
3
 
4
+ export { default as AlertStandard } from "./components/Alert/AlertStandard";
5
+ export type { AlertSeverity } from "./components/Alert/AlertStandard";
6
+
4
7
  export { default as ButtonContained } from "./components/Button/ButtonContained";
5
8
  export { default as ButtonOutlined } from "./components/Button/ButtonOutlined";
6
9
  export { default as ButtonText } from "./components/Button/ButtonText";