@ponti-studios/ui 1.7.0 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ponti-studios/ui",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "private": false,
5
5
  "description": "Shared UI component library for Ponti Studios",
6
6
  "license": "MIT",
@@ -54,20 +54,18 @@
54
54
  --color-foreground: var(--text-primary);
55
55
  --color-card: var(--card);
56
56
  --color-card-foreground: var(--text-primary);
57
- --color-popover: var(--background);
57
+ --color-popover: var(--popover);
58
58
  --color-popover-foreground: var(--text-primary);
59
59
  --color-primary: var(--primary);
60
60
  --color-primary-foreground: var(--primary-foreground);
61
- --color-secondary: var(--card);
61
+ --color-secondary: var(--secondary);
62
62
  --color-secondary-foreground: var(--text-primary);
63
63
  --color-muted: var(--muted);
64
64
  --color-muted-foreground: var(--text-secondary);
65
- --color-accent: var(--primary);
66
- --color-accent-foreground: var(--primary-foreground);
67
- /* Distinct from --color-accent: that pairs with white/primary-foreground
68
- * for solid fills (badges, active states). This pairs with the page
69
- * background for standalone text/icons/borders (inline links, upload
70
- * affordances) and must differ per theme to stay AA-compliant. */
65
+ --color-accent: var(--accent);
66
+ --color-accent-foreground: var(--accent-foreground);
67
+ /* Distinct from --color-accent: this pairs with the page background for
68
+ * standalone text/icons/borders (inline links, upload affordances). */
71
69
  --color-accent-text: var(--text-accent);
72
70
  --color-destructive: var(--destructive);
73
71
  --color-destructive-foreground: var(--destructive-foreground);
@@ -78,8 +76,10 @@
78
76
  --color-destructive-text: var(--text-destructive);
79
77
  --color-success: var(--success);
80
78
  --color-success-foreground: var(--success-foreground);
79
+ --color-success-text: var(--text-success);
81
80
  --color-warning: var(--warning);
82
81
  --color-warning-foreground: var(--warning-foreground);
82
+ --color-warning-text: var(--text-warning);
83
83
  --color-border: var(--border-default);
84
84
  --color-input: var(--border-default);
85
85
  --color-ring: var(--focus-ring);
@@ -2,40 +2,188 @@ import type { Meta, StoryObj } from "@storybook/react-vite";
2
2
 
3
3
  import { Button } from "../../components/primitives/button";
4
4
  import { colors } from "./css-vars";
5
- import { colorTokenNames } from "./index";
5
+ import type { ColorToken } from "./index";
6
6
 
7
7
  const meta: Meta = { title: "Foundations/Colors", parameters: { layout: "fullscreen" } };
8
8
  export default meta;
9
9
  type Story = StoryObj<typeof meta>;
10
10
 
11
+ type Role = {
12
+ token: ColorToken;
13
+ purpose: string;
14
+ foreground?: ColorToken;
15
+ };
16
+
17
+ const surfaces: Role[] = [
18
+ { token: "background", purpose: "The page and app shell surface." },
19
+ { token: "card", purpose: "Content containers and grouped information." },
20
+ { token: "popover", purpose: "Dropdowns, dialogs, and floating panels." },
21
+ { token: "muted", purpose: "Quiet, disabled, and loading surfaces." },
22
+ { token: "secondary", purpose: "Secondary actions and selectable chips." },
23
+ {
24
+ token: "accent",
25
+ purpose: "Tinted emphasis and hover surfaces.",
26
+ foreground: "accent-foreground",
27
+ },
28
+ ];
29
+
30
+ const text: Role[] = [
31
+ { token: "text-primary", purpose: "Primary reading text." },
32
+ { token: "text-secondary", purpose: "Supporting labels and descriptions." },
33
+ { token: "tertiary", purpose: "Metadata, timestamps, and placeholders." },
34
+ { token: "text-accent", purpose: "Standalone links and accent affordances." },
35
+ { token: "text-success", purpose: "Standalone positive status text and icons." },
36
+ { token: "text-warning", purpose: "Standalone cautionary status text and icons." },
37
+ { token: "text-destructive", purpose: "Standalone error and destructive text." },
38
+ ];
39
+
40
+ const actions: Role[] = [
41
+ {
42
+ token: "primary",
43
+ purpose: "The strongest action on a screen.",
44
+ foreground: "primary-foreground",
45
+ },
46
+ {
47
+ token: "destructive",
48
+ purpose: "Irreversible or dangerous actions.",
49
+ foreground: "destructive-foreground",
50
+ },
51
+ {
52
+ token: "success",
53
+ purpose: "Positive indicators and confirmed states.",
54
+ foreground: "success-foreground",
55
+ },
56
+ {
57
+ token: "warning",
58
+ purpose: "Caution indicators and attention states.",
59
+ foreground: "warning-foreground",
60
+ },
61
+ ];
62
+
63
+ const system: Role[] = [
64
+ { token: "border-default", purpose: "Default borders, inputs, and dividers." },
65
+ { token: "focus-ring", purpose: "Keyboard focus indication." },
66
+ { token: "overlay-scrim", purpose: "Backdrop behind modal surfaces." },
67
+ ];
68
+
69
+ const charts: Role[] = [
70
+ { token: "chart-1", purpose: "Categorical data series one." },
71
+ { token: "chart-2", purpose: "Categorical data series two." },
72
+ { token: "chart-3", purpose: "Categorical data series three." },
73
+ { token: "chart-4", purpose: "Categorical data series four." },
74
+ { token: "chart-5", purpose: "Categorical data series five." },
75
+ { token: "chart-positive", purpose: "Positive trend in a visualization." },
76
+ { token: "chart-negative", purpose: "Negative trend in a visualization." },
77
+ { token: "chart-neutral", purpose: "Neutral or baseline trend." },
78
+ ];
79
+
80
+ function RoleCard({ token, purpose, foreground }: Role) {
81
+ const isText = token.startsWith("text-") || token === "tertiary";
82
+ const isSurface = surfaces.some((role) => role.token === token);
83
+ const swatchOnly = !isText && !isSurface && !foreground;
84
+ const background = isText ? "background" : token;
85
+ const contentColor = isText ? token : (foreground ?? "text-primary");
86
+
87
+ return (
88
+ <article className="border-border overflow-hidden rounded-md border bg-card">
89
+ <div
90
+ className="flex min-h-24 items-end p-3"
91
+ style={{
92
+ backgroundColor: colors[swatchOnly ? "card" : background],
93
+ color: colors[swatchOnly ? "text-primary" : contentColor],
94
+ }}
95
+ >
96
+ {swatchOnly ? (
97
+ <span
98
+ aria-hidden="true"
99
+ className="h-full min-h-16 w-full rounded-sm"
100
+ style={{ backgroundColor: colors[token] }}
101
+ />
102
+ ) : (
103
+ <span className="font-mono text-xs">{token}</span>
104
+ )}
105
+ </div>
106
+ <div className="grid gap-1 p-3">
107
+ <code className="text-sm font-medium">--{token}</code>
108
+ <p className="text-muted-foreground text-sm">{purpose}</p>
109
+ {foreground && (
110
+ <p className="text-muted-foreground text-xs">Paired content: --{foreground}</p>
111
+ )}
112
+ </div>
113
+ </article>
114
+ );
115
+ }
116
+
117
+ function RoleSection({
118
+ title,
119
+ description,
120
+ roles,
121
+ }: {
122
+ title: string;
123
+ description: string;
124
+ roles: Role[];
125
+ }) {
126
+ return (
127
+ <section className="grid gap-3">
128
+ <div className="grid gap-1">
129
+ <h2 className="text-lg font-semibold">{title}</h2>
130
+ <p className="text-muted-foreground text-sm">{description}</p>
131
+ </div>
132
+ <div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
133
+ {roles.map((role) => (
134
+ <RoleCard key={role.token} {...role} />
135
+ ))}
136
+ </div>
137
+ </section>
138
+ );
139
+ }
140
+
11
141
  export const SystemAppearance: Story = {
12
142
  render: () => (
13
- <main className="bg-background text-foreground grid min-h-screen gap-8 p-6 md:p-10">
14
- <header className="grid gap-2">
15
- <h1 className="text-2xl font-semibold">System color roles</h1>
16
- <p className="text-muted-foreground max-w-prose text-sm">
17
- These semantic roles resolve from the operating system’s light or dark appearance. CSS is
18
- the single source of their values.
143
+ <main className="bg-background text-foreground grid min-h-screen gap-10 p-6 md:p-10">
144
+ <header className="grid max-w-3xl gap-2">
145
+ <p className="text-accent-text text-xs font-medium uppercase tracking-widest">
146
+ Foundations
19
147
  </p>
148
+ <h1 className="text-2xl font-semibold">Color roles</h1>
149
+ <p className="text-muted-foreground text-sm">
150
+ Every color has a job. These roles resolve from the operating system’s light or dark
151
+ appearance and are the only colors components should consume.
152
+ </p>
153
+ <div className="flex flex-wrap gap-2 pt-2">
154
+ <Button>Primary action</Button>
155
+ <Button variant="secondary">Secondary action</Button>
156
+ <Button variant="outline">Outline action</Button>
157
+ <Button variant="destructive">Delete item</Button>
158
+ </div>
20
159
  </header>
21
- <div className="flex flex-wrap gap-2">
22
- <Button>Primary action</Button>
23
- <Button variant="secondary">Secondary action</Button>
24
- <Button variant="outline">Outline action</Button>
25
- <Button variant="destructive">Delete item</Button>
26
- </div>
27
- <div className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
28
- {colorTokenNames.map((token) => (
29
- <div
30
- key={token}
31
- className="border-border grid min-h-20 content-end rounded-md border p-3"
32
- style={{ backgroundColor: colors[token] }}
33
- >
34
- <span className="bg-background text-foreground w-fit rounded px-1 font-mono text-xs">
35
- {token}
36
- </span>
37
- </div>
38
- ))}
160
+
161
+ <div className="grid gap-10">
162
+ <RoleSection
163
+ title="Surfaces"
164
+ description="Backgrounds establish hierarchy. Use the lightest appropriate surface and let spacing do the rest."
165
+ roles={surfaces}
166
+ />
167
+ <RoleSection
168
+ title="Text"
169
+ description="Text roles describe hierarchy or state. Use a text role when content sits directly on a surface."
170
+ roles={text}
171
+ />
172
+ <RoleSection
173
+ title="Actions and status"
174
+ description="Fill roles communicate action or state and always pair with their matching foreground."
175
+ roles={actions}
176
+ />
177
+ <RoleSection
178
+ title="System"
179
+ description="Structural colors support boundaries, focus, and modal layering without competing with content."
180
+ roles={system}
181
+ />
182
+ <RoleSection
183
+ title="Charts"
184
+ description="Chart roles are for data visualization only. They do not communicate interaction or severity in product UI."
185
+ roles={charts}
186
+ />
39
187
  </div>
40
188
  </main>
41
189
  ),
@@ -5,18 +5,23 @@
5
5
  export default {
6
6
  background: "#171714",
7
7
  card: "#1d1d19",
8
+ secondary: "#2b2b25",
8
9
  popover: "#22221e",
9
10
  muted: "#1d1d19",
10
11
  "text-primary": "#ffffff",
11
12
  "text-secondary": "#aaa79f",
12
13
  tertiary: "#d0ccc2",
13
14
  primary: "#178277",
15
+ accent: "#21433f",
14
16
  destructive: "#ce2c31",
15
17
  success: "#30a46c",
16
18
  warning: "#ffc53d",
19
+ "text-success": "#55d89a",
20
+ "text-warning": "#ffd86a",
17
21
  "success-foreground": "#15110f",
18
22
  "warning-foreground": "#15110f",
19
23
  "primary-foreground": "#ffffff",
24
+ "accent-foreground": "#ffffff",
20
25
  "destructive-foreground": "#ffffff",
21
26
  "text-destructive": "#ff9592",
22
27
  "text-accent": "#1b988b",
@@ -5,18 +5,23 @@
5
5
  :root {
6
6
  --background: #171714;
7
7
  --card: #1d1d19;
8
+ --secondary: #2b2b25;
8
9
  --popover: #22221e;
9
10
  --muted: #1d1d19;
10
11
  --text-primary: #ffffff;
11
12
  --text-secondary: #aaa79f;
12
13
  --tertiary: #d0ccc2;
13
14
  --primary: #178277;
15
+ --accent: #21433f;
14
16
  --destructive: #ce2c31;
15
17
  --success: #30a46c;
16
18
  --warning: #ffc53d;
19
+ --text-success: #55d89a;
20
+ --text-warning: #ffd86a;
17
21
  --success-foreground: #15110f;
18
22
  --warning-foreground: #15110f;
19
23
  --primary-foreground: #ffffff;
24
+ --accent-foreground: #ffffff;
20
25
  --destructive-foreground: #ffffff;
21
26
  --text-destructive: #ff9592;
22
27
  --text-accent: #1b988b;
@@ -5,18 +5,23 @@
5
5
  export default {
6
6
  background: "#f4f0e8",
7
7
  card: "#fbf8f2",
8
+ secondary: "#e8e4da",
8
9
  popover: "#f6f2ea",
9
10
  muted: "#efe9dc",
10
11
  "text-primary": "#11110f",
11
12
  "text-secondary": "#6a6352",
12
13
  tertiary: "#6d6659",
13
14
  primary: "#107066",
15
+ accent: "#d7efeb",
14
16
  destructive: "#ce2c31",
15
17
  success: "#30a46c",
16
18
  warning: "#ffc53d",
19
+ "text-success": "#1f7a50",
20
+ "text-warning": "#8a5a00",
17
21
  "success-foreground": "#15110f",
18
22
  "warning-foreground": "#15110f",
19
23
  "primary-foreground": "#ffffff",
24
+ "accent-foreground": "#11110f",
20
25
  "destructive-foreground": "#ffffff",
21
26
  "text-destructive": "#c82c31",
22
27
  "text-accent": "#107066",
@@ -5,18 +5,23 @@
5
5
  :root {
6
6
  --background: #f4f0e8;
7
7
  --card: #fbf8f2;
8
+ --secondary: #e8e4da;
8
9
  --popover: #f6f2ea;
9
10
  --muted: #efe9dc;
10
11
  --text-primary: #11110f;
11
12
  --text-secondary: #6a6352;
12
13
  --tertiary: #6d6659;
13
14
  --primary: #107066;
15
+ --accent: #d7efeb;
14
16
  --destructive: #ce2c31;
15
17
  --success: #30a46c;
16
18
  --warning: #ffc53d;
19
+ --text-success: #1f7a50;
20
+ --text-warning: #8a5a00;
17
21
  --success-foreground: #15110f;
18
22
  --warning-foreground: #15110f;
19
23
  --primary-foreground: #ffffff;
24
+ --accent-foreground: #11110f;
20
25
  --destructive-foreground: #ffffff;
21
26
  --text-destructive: #c82c31;
22
27
  --text-accent: #107066;
@@ -30,6 +30,13 @@ for (const file of sourceFiles) {
30
30
  const source = readFileSync(file, "utf8");
31
31
  for (const check of checks) {
32
32
  if (check.name === "legacy semantic utility classes" && file.endsWith(".css")) continue;
33
+ // The Colors foundation story intentionally lists token names as data;
34
+ // those strings are not Tailwind utility classes consumed by components.
35
+ if (
36
+ check.name === "legacy semantic utility classes" &&
37
+ file.endsWith("color-systems.stories.tsx")
38
+ )
39
+ continue;
33
40
  if (check.pattern.test(source))
34
41
  failures.push(`${check.name}: ${relative(sourceDirectory, file)}`);
35
42
  }
@@ -10,6 +10,10 @@
10
10
  "$type": "color",
11
11
  "$value": "rgb(29, 29, 25)"
12
12
  },
13
+ "secondary": {
14
+ "$type": "color",
15
+ "$value": "rgb(43, 43, 37)"
16
+ },
13
17
  "popover": {
14
18
  "$type": "color",
15
19
  "$value": "rgb(34, 34, 30)"
@@ -34,6 +38,10 @@
34
38
  "$type": "color",
35
39
  "$value": "rgb(23, 130, 119)"
36
40
  },
41
+ "accent": {
42
+ "$type": "color",
43
+ "$value": "rgb(33, 67, 63)"
44
+ },
37
45
  "destructive": {
38
46
  "$type": "color",
39
47
  "$value": "rgb(206, 44, 49)"
@@ -46,6 +54,14 @@
46
54
  "$type": "color",
47
55
  "$value": "rgb(255, 197, 61)"
48
56
  },
57
+ "text-success": {
58
+ "$type": "color",
59
+ "$value": "rgb(85, 216, 154)"
60
+ },
61
+ "text-warning": {
62
+ "$type": "color",
63
+ "$value": "rgb(255, 216, 106)"
64
+ },
49
65
  "success-foreground": {
50
66
  "$type": "color",
51
67
  "$value": "rgb(21, 17, 15)"
@@ -58,6 +74,10 @@
58
74
  "$type": "color",
59
75
  "$value": "rgb(255, 255, 255)"
60
76
  },
77
+ "accent-foreground": {
78
+ "$type": "color",
79
+ "$value": "rgb(255, 255, 255)"
80
+ },
61
81
  "destructive-foreground": {
62
82
  "$type": "color",
63
83
  "$value": "rgb(255, 255, 255)"
@@ -10,6 +10,10 @@
10
10
  "$type": "color",
11
11
  "$value": "rgb(251, 248, 242)"
12
12
  },
13
+ "secondary": {
14
+ "$type": "color",
15
+ "$value": "rgb(232, 228, 218)"
16
+ },
13
17
  "popover": {
14
18
  "$type": "color",
15
19
  "$value": "rgb(246, 242, 234)"
@@ -34,6 +38,10 @@
34
38
  "$type": "color",
35
39
  "$value": "rgb(16, 112, 102)"
36
40
  },
41
+ "accent": {
42
+ "$type": "color",
43
+ "$value": "rgb(215, 239, 235)"
44
+ },
37
45
  "destructive": {
38
46
  "$type": "color",
39
47
  "$value": "rgb(206, 44, 49)"
@@ -46,6 +54,14 @@
46
54
  "$type": "color",
47
55
  "$value": "rgb(255, 197, 61)"
48
56
  },
57
+ "text-success": {
58
+ "$type": "color",
59
+ "$value": "rgb(31, 122, 80)"
60
+ },
61
+ "text-warning": {
62
+ "$type": "color",
63
+ "$value": "rgb(138, 90, 0)"
64
+ },
49
65
  "success-foreground": {
50
66
  "$type": "color",
51
67
  "$value": "rgb(21, 17, 15)"
@@ -58,6 +74,10 @@
58
74
  "$type": "color",
59
75
  "$value": "rgb(255, 255, 255)"
60
76
  },
77
+ "accent-foreground": {
78
+ "$type": "color",
79
+ "$value": "rgb(17, 17, 15)"
80
+ },
61
81
  "destructive-foreground": {
62
82
  "$type": "color",
63
83
  "$value": "rgb(255, 255, 255)"