@cosxai/ui 0.4.0 → 0.4.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 +1 -1
- package/src/primitives/Input.tsx +8 -0
- package/src/styles/fonts.css +14 -2
- package/src/styles/index.css +24 -0
- package/src/styles/tokens.css +20 -8
package/package.json
CHANGED
package/src/primitives/Input.tsx
CHANGED
|
@@ -98,6 +98,14 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
|
|
|
98
98
|
flexDirection: "column",
|
|
99
99
|
gap: 6,
|
|
100
100
|
width: fit === "full" ? "100%" : undefined,
|
|
101
|
+
// minWidth: 0 lets a parent flex container shrink this
|
|
102
|
+
// wrapper past the inner addon-wrap's nowrap suffix content.
|
|
103
|
+
// Without it, a long suffix (e.g. ".meta.test.cosx.dev")
|
|
104
|
+
// sets a min-content floor that pushes the form wider than
|
|
105
|
+
// its mobile viewport. Per-page CSS workarounds in consumer
|
|
106
|
+
// apps only cover their own scope; fixing it at the primitive
|
|
107
|
+
// catches every page.
|
|
108
|
+
minWidth: 0,
|
|
101
109
|
}}
|
|
102
110
|
>
|
|
103
111
|
{label && (
|
package/src/styles/fonts.css
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
Loaded from Google Fonts CDN — Geist + Geist Mono cover the
|
|
3
3
|
default sans/mono slots; Playfair Display drives the editorial
|
|
4
4
|
chrome's display heading; Caveat covers the sketch chrome's
|
|
5
|
-
handwritten display
|
|
5
|
+
handwritten display; Noto Serif SC is the matching CJK serif for
|
|
6
|
+
the editorial heading so a name like "本杰明 Zoë" renders Latin in
|
|
7
|
+
Playfair Display and Chinese in Noto Serif SC without leaking to
|
|
8
|
+
PingFang SC / SimSun (sans-serif system fallbacks that mis-pair
|
|
9
|
+
with the editorial high-contrast serif). All five are SIL OFL.
|
|
6
10
|
|
|
7
11
|
Why Google Fonts CDN over self-hosting:
|
|
8
12
|
1. Self-hosted /fonts/*.otf had to be shipped per-consumer
|
|
@@ -16,9 +20,17 @@
|
|
|
16
20
|
3. font-display=swap means the system fallback paints first,
|
|
17
21
|
the web font upgrades on arrival — no FOIT.
|
|
18
22
|
|
|
23
|
+
Bandwidth shape — Noto Serif SC is the only large family in the
|
|
24
|
+
set (CJK fonts dwarf Latin by character count). Google Fonts ships
|
|
25
|
+
it as ~100 unicode-range subsets; the browser only fetches a
|
|
26
|
+
subset when a character in its range is rendered. Pure-Latin
|
|
27
|
+
pages pay the CSS file (~5-10KB gzip) but no .woff2 — pages with
|
|
28
|
+
Chinese names pay an additional ~200-400KB of subset binaries
|
|
29
|
+
spread across the few CJK ranges they actually use.
|
|
30
|
+
|
|
19
31
|
For offline / enterprise deploys that block Google Fonts, a
|
|
20
32
|
consumer can override --ck-font-sans/serif/mono in tokens.css
|
|
21
33
|
to fall back entirely to the system-font slot at the tail of
|
|
22
34
|
each stack. */
|
|
23
35
|
|
|
24
|
-
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300..700&family=Geist+Mono:wght@400..700&family=Playfair+Display:wght@400..900&family=Caveat:wght@400..700&display=swap");
|
|
36
|
+
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300..700&family=Geist+Mono:wght@400..700&family=Playfair+Display:wght@400..900&family=Caveat:wght@400..700&family=Noto+Serif+SC:wght@400..900&display=swap");
|
package/src/styles/index.css
CHANGED
|
@@ -117,6 +117,30 @@ html[data-ck-chrome="seamless"] .ck-card__foot {
|
|
|
117
117
|
color: var(--ck-text-tertiary);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/* ---------- Input + Textarea disabled state ----------
|
|
121
|
+
Native :disabled styling is barely perceptible on a cream / dark
|
|
122
|
+
surface, which made disabled fields read as editable in
|
|
123
|
+
product-meta's settings (the email field in particular). Match
|
|
124
|
+
the .ck-btn:disabled treatment so consumers don't have to
|
|
125
|
+
reapply the same opacity / cursor pattern at every call site.
|
|
126
|
+
|
|
127
|
+
The addon-wrap variant uses :has(:disabled) so a wrapping
|
|
128
|
+
.ck-input-addon-wrap also dims when its inner <input> is disabled
|
|
129
|
+
— otherwise the slug input dims but its ".meta.test.cosx.dev"
|
|
130
|
+
suffix stays at full opacity, which looks broken. :has() is
|
|
131
|
+
supported across all evergreen browsers since 2023; pre-1.0 we
|
|
132
|
+
don't need a polyfill. */
|
|
133
|
+
.ck-input:disabled,
|
|
134
|
+
.ck-textarea:disabled,
|
|
135
|
+
.ck-input-addon-wrap:has(:disabled) {
|
|
136
|
+
opacity: 0.55;
|
|
137
|
+
cursor: not-allowed;
|
|
138
|
+
}
|
|
139
|
+
.ck-input:disabled,
|
|
140
|
+
.ck-textarea:disabled {
|
|
141
|
+
background: var(--ck-bg-muted, var(--ck-bg-surface));
|
|
142
|
+
}
|
|
143
|
+
|
|
120
144
|
/* ---------- Select (custom listbox — never native <select>) ----------
|
|
121
145
|
The trigger LOOKS like .ck-input so chrome restyles cascade
|
|
122
146
|
uniformly. Chromes that want a different vibe (terminal squared,
|
package/src/styles/tokens.css
CHANGED
|
@@ -19,19 +19,31 @@
|
|
|
19
19
|
generic family so 中文 / 日本語 / 한국어 don't drop to the
|
|
20
20
|
browser's last-resort glyph (renders as tofu on locked-down
|
|
21
21
|
hosts). Browsers do per-character fallback — Latin hits
|
|
22
|
-
Geist/Playfair, CJK hits the matching
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
Geist/Playfair, CJK hits the next matching family in the stack.
|
|
23
|
+
|
|
24
|
+
Serif slot ALSO carries Noto Serif SC as a web-font fallback
|
|
25
|
+
(loaded via fonts.css). Reason: the editorial chrome's display
|
|
26
|
+
heading uses Playfair Display, a high-contrast modern serif —
|
|
27
|
+
pairing it with PingFang SC / SimSun (the system *sans-serif*
|
|
28
|
+
CJK fallbacks) reads as a style break. Adobe/Google's Noto Serif
|
|
29
|
+
SC matches Playfair's serif vocabulary cross-platform without
|
|
30
|
+
depending on the user having Songti SC / STSong / Source Han
|
|
31
|
+
Serif SC installed locally. Cost is lazy: subset .woff2 only
|
|
32
|
+
downloads when a CJK character is actually rendered (per
|
|
33
|
+
fonts.css's unicode-range mechanism); pure-Latin pages pay only
|
|
34
|
+
the small CSS file.
|
|
35
|
+
|
|
36
|
+
Sans + mono slots stay system-only — system sans CJK
|
|
37
|
+
(PingFang SC / Microsoft YaHei) is what users expect for UI
|
|
38
|
+
copy, and the visual mismatch concern doesn't apply when the
|
|
39
|
+
Latin half is also a clean grotesk. */
|
|
28
40
|
--ck-font-sans: "Geist", "Inter", system-ui, -apple-system,
|
|
29
41
|
"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
|
|
30
42
|
"Source Han Sans SC", sans-serif;
|
|
31
43
|
--ck-font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo,
|
|
32
44
|
"Sarasa Mono SC", monospace;
|
|
33
|
-
--ck-font-serif: "Playfair Display", "GT Sectra", "Canela",
|
|
34
|
-
"Songti SC", "STSong", "Source Han Serif SC", serif;
|
|
45
|
+
--ck-font-serif: "Playfair Display", "Noto Serif SC", "GT Sectra", "Canela",
|
|
46
|
+
Georgia, "Songti SC", "STSong", "Source Han Serif SC", serif;
|
|
35
47
|
--ck-font-display: var(--ck-font-sans);
|
|
36
48
|
|
|
37
49
|
/* ---------- Radii / motion ---------- */
|