@cosxai/ui 0.25.0 → 1.0.0-alpha.1

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.
Files changed (165) hide show
  1. package/CHANGELOG.md +597 -0
  2. package/NOTICE +11 -0
  3. package/README.md +52 -0
  4. package/package.json +57 -7
  5. package/src/brand.css +13 -0
  6. package/src/components/Badge.tsx +68 -0
  7. package/src/components/Button.tsx +178 -0
  8. package/src/components/Card.tsx +42 -0
  9. package/src/components/Checkbox.tsx +67 -0
  10. package/src/components/Dialog.tsx +111 -0
  11. package/src/components/Field.tsx +66 -0
  12. package/src/components/Figure.tsx +30 -0
  13. package/src/components/Icon.tsx +32 -0
  14. package/src/components/IconButton.tsx +55 -0
  15. package/src/components/Input.tsx +74 -0
  16. package/src/components/Logo.tsx +62 -0
  17. package/src/components/Marker.tsx +26 -0
  18. package/src/components/MetaLabel.tsx +38 -0
  19. package/src/components/Radio.tsx +72 -0
  20. package/src/components/Select.tsx +351 -0
  21. package/src/components/Spinner.tsx +20 -0
  22. package/src/components/Switch.tsx +67 -0
  23. package/src/components/Table.tsx +196 -0
  24. package/src/components/Tabs.tsx +124 -0
  25. package/src/components/Tag.tsx +35 -0
  26. package/src/components/Textarea.tsx +46 -0
  27. package/src/components/ThemeProvider.tsx +80 -0
  28. package/src/components/Toast.tsx +159 -0
  29. package/src/components/Tooltip.tsx +57 -0
  30. package/src/components/core.test.tsx +242 -0
  31. package/src/components/forms-control.ts +36 -0
  32. package/src/components/forms.test.tsx +280 -0
  33. package/src/components/logo-art.ts +4 -0
  34. package/src/components/overlays.test.tsx +245 -0
  35. package/src/components/useButtonAction.ts +57 -0
  36. package/src/fonts.css +20 -0
  37. package/src/index.ts +34 -24
  38. package/src/lib/cn.ts +23 -6
  39. package/src/modes.css +10 -0
  40. package/src/styles.css +19 -0
  41. package/src/theme.css +143 -0
  42. package/src/tokens/colors.css +112 -0
  43. package/src/tokens/compat.css +36 -0
  44. package/src/tokens/elevation.css +14 -0
  45. package/src/tokens/motion.css +42 -0
  46. package/src/tokens/spacing.css +55 -0
  47. package/src/tokens/typography-cjk.css +42 -0
  48. package/src/tokens/typography.css +81 -0
  49. package/src/actionbar/ActionBar.tsx +0 -837
  50. package/src/actionbar/ActionBarButton.tsx +0 -111
  51. package/src/actionbar/ActionBarMenuGroup.tsx +0 -116
  52. package/src/actionbar/ActionBarModeHandle.tsx +0 -171
  53. package/src/actionbar/ActionBarProvider.tsx +0 -91
  54. package/src/actionbar/actionbar-context.ts +0 -45
  55. package/src/actionbar/index.ts +0 -28
  56. package/src/actionbar/types.ts +0 -147
  57. package/src/actionbar/useActionBarItems.ts +0 -60
  58. package/src/actionbar/useActionBarMode.ts +0 -144
  59. package/src/actionbar/useActionBarPanel.ts +0 -56
  60. package/src/actionbar/useActionBarStatusDot.ts +0 -49
  61. package/src/actionbar/useActionBarToast.ts +0 -33
  62. package/src/ambient/AmbientBackdrop.tsx +0 -74
  63. package/src/ambient/CommandInput.tsx +0 -107
  64. package/src/ambient/SuperbarStrip.tsx +0 -36
  65. package/src/ambient/index.ts +0 -6
  66. package/src/bento/BentoCell.tsx +0 -66
  67. package/src/bento/BentoGrid.tsx +0 -42
  68. package/src/bento/index.ts +0 -2
  69. package/src/command/CommandPalette.tsx +0 -329
  70. package/src/command/CommandProvider.tsx +0 -57
  71. package/src/command/command-context.ts +0 -12
  72. package/src/command/index.ts +0 -6
  73. package/src/command/rank.ts +0 -50
  74. package/src/command/types.ts +0 -37
  75. package/src/command/useCommandSource.ts +0 -37
  76. package/src/dialogs/DialogsProvider.tsx +0 -216
  77. package/src/dialogs/Modal.tsx +0 -260
  78. package/src/dialogs/Toast.tsx +0 -85
  79. package/src/dialogs/dialogs-context.ts +0 -6
  80. package/src/dialogs/index.ts +0 -10
  81. package/src/dialogs/types.ts +0 -37
  82. package/src/dialogs/useDialogs.ts +0 -8
  83. package/src/editorial/EditorialSpotlight.tsx +0 -63
  84. package/src/editorial/Folio.tsx +0 -52
  85. package/src/editorial/PlateMarker.tsx +0 -33
  86. package/src/editorial/RomanSection.tsx +0 -65
  87. package/src/editorial/RunningMarginalia.tsx +0 -65
  88. package/src/editorial/index.ts +0 -10
  89. package/src/hooks/index.ts +0 -5
  90. package/src/hooks/useKeyboardHotkey.ts +0 -93
  91. package/src/hooks/useReducedMotion.ts +0 -20
  92. package/src/hooks/useViewport.ts +0 -61
  93. package/src/layout/Breadcrumb.tsx +0 -74
  94. package/src/layout/LeftNavRail.tsx +0 -139
  95. package/src/layout/MobileTabBar.tsx +0 -101
  96. package/src/layout/NavItem.tsx +0 -128
  97. package/src/layout/NavSearchTrigger.tsx +0 -88
  98. package/src/layout/NavSection.tsx +0 -40
  99. package/src/layout/RightSidebarPanel.tsx +0 -111
  100. package/src/layout/Shell.tsx +0 -91
  101. package/src/layout/SidePanel.tsx +0 -316
  102. package/src/layout/StickyBanner.tsx +0 -83
  103. package/src/layout/Topbar.tsx +0 -68
  104. package/src/layout/index.ts +0 -24
  105. package/src/layout/useNavRailState.ts +0 -69
  106. package/src/lib/time-utils.ts +0 -44
  107. package/src/neobrutalism/Marquee.tsx +0 -81
  108. package/src/neobrutalism/Sticker.tsx +0 -71
  109. package/src/neobrutalism/index.ts +0 -4
  110. package/src/primitives/Avatar.tsx +0 -53
  111. package/src/primitives/Button.tsx +0 -67
  112. package/src/primitives/Card.tsx +0 -41
  113. package/src/primitives/Checkbox.tsx +0 -87
  114. package/src/primitives/Chip.tsx +0 -191
  115. package/src/primitives/Combobox.tsx +0 -507
  116. package/src/primitives/CopyField.tsx +0 -139
  117. package/src/primitives/CountBadge.tsx +0 -50
  118. package/src/primitives/Input.tsx +0 -204
  119. package/src/primitives/Kbd.tsx +0 -45
  120. package/src/primitives/MentionCombobox.tsx +0 -612
  121. package/src/primitives/MultiCombobox.tsx +0 -327
  122. package/src/primitives/PageHeader.tsx +0 -77
  123. package/src/primitives/Radio.tsx +0 -131
  124. package/src/primitives/SegmentedControl.tsx +0 -135
  125. package/src/primitives/Select.tsx +0 -779
  126. package/src/primitives/SignaturePad.tsx +0 -461
  127. package/src/primitives/Tag.tsx +0 -56
  128. package/src/primitives/Textarea.tsx +0 -62
  129. package/src/primitives/ToggleSwitch.tsx +0 -79
  130. package/src/primitives/Tooltip.tsx +0 -213
  131. package/src/primitives/index.ts +0 -53
  132. package/src/pwa/InstallPromptBanner.tsx +0 -132
  133. package/src/pwa/index.ts +0 -4
  134. package/src/pwa/manifest.template.json +0 -20
  135. package/src/pwa/registerSW.ts +0 -55
  136. package/src/riso/Halftone.tsx +0 -85
  137. package/src/riso/Misregister.tsx +0 -63
  138. package/src/riso/RisoStamp.tsx +0 -76
  139. package/src/riso/index.ts +0 -3
  140. package/src/sketch/HandUnderline.tsx +0 -53
  141. package/src/sketch/RoughArrow.tsx +0 -91
  142. package/src/sketch/RoughBox.tsx +0 -73
  143. package/src/sketch/StickyNote.tsx +0 -56
  144. package/src/sketch/index.ts +0 -4
  145. package/src/styles/base.css +0 -186
  146. package/src/styles/chrome-ambient.css +0 -235
  147. package/src/styles/chrome-bento.css +0 -192
  148. package/src/styles/chrome-editorial.css +0 -168
  149. package/src/styles/chrome-neobrutalism.css +0 -326
  150. package/src/styles/chrome-riso.css +0 -339
  151. package/src/styles/chrome-sketch.css +0 -362
  152. package/src/styles/chrome-swiss.css +0 -265
  153. package/src/styles/chrome-terminal.css +0 -272
  154. package/src/styles/fonts.css +0 -1034
  155. package/src/styles/index.css +0 -343
  156. package/src/styles/tokens.css +0 -941
  157. package/src/terminal/AsciiBox.tsx +0 -65
  158. package/src/terminal/BrailleSpinner.tsx +0 -46
  159. package/src/terminal/index.ts +0 -4
  160. package/src/theme/ThemeProvider.tsx +0 -99
  161. package/src/theme/index.ts +0 -6
  162. package/src/theme/inline-script.ts +0 -40
  163. package/src/theme/theme-context.ts +0 -7
  164. package/src/theme/types.ts +0 -39
  165. package/src/theme/useTheme.ts +0 -8
@@ -1,343 +0,0 @@
1
- /* @cosxai/ui — single stylesheet consumers import.
2
- Order matters: fonts → tokens → base → component CSS →
3
- chrome variants. Each chrome-* file is scoped to a
4
- `html[data-ck-chrome="<name>"]` selector so it's a no-op
5
- until that chrome is selected. */
6
-
7
- @import "./fonts.css";
8
- @import "./tokens.css";
9
- @import "./base.css";
10
- @import "./chrome-editorial.css";
11
- @import "./chrome-neobrutalism.css";
12
- @import "./chrome-ambient.css";
13
- @import "./chrome-swiss.css";
14
- @import "./chrome-terminal.css";
15
- @import "./chrome-bento.css";
16
- @import "./chrome-riso.css";
17
- @import "./chrome-sketch.css";
18
-
19
- /* ---------- Button (Phase 0 bootstrap — Phase 3 will replace
20
- this with full variant + size + loading-state styles
21
- keyed off the tokens block). ---------- */
22
-
23
- .ck-btn {
24
- display: inline-flex;
25
- align-items: center;
26
- gap: 8px;
27
- height: 32px;
28
- padding: 0 12px;
29
- border-radius: var(--ck-radius-sm);
30
- font: 500 13px/1 var(--ck-font-sans);
31
- border: 1px solid transparent;
32
- background: transparent;
33
- color: var(--ck-text-primary);
34
- cursor: pointer;
35
- white-space: nowrap;
36
- text-decoration: none;
37
- transition: background var(--ck-dur-fast) var(--ck-ease), border-color var(--ck-dur-fast) var(--ck-ease);
38
- }
39
-
40
- .ck-btn:disabled { opacity: 0.5; cursor: not-allowed; }
41
-
42
- /* Loading spinner — rendered inside a Button when its `loading`
43
- prop is true. CSS-only ring (1.5px stroke, 720ms linear spin).
44
- `currentColor` inherits the variant's foreground so the spinner
45
- reads on primary / secondary / ghost / icon without per-variant
46
- overrides. Reduced-motion users get a slower spin instead of a
47
- frozen ring (which would read as broken). */
48
- .ck-btn-spinner {
49
- width: 0.85em;
50
- height: 0.85em;
51
- border: 1.5px solid currentColor;
52
- border-right-color: transparent;
53
- border-radius: 50%;
54
- display: inline-block;
55
- vertical-align: -0.1em;
56
- flex-shrink: 0;
57
- animation: ck-btn-spin 720ms linear infinite;
58
- }
59
- @keyframes ck-btn-spin {
60
- to { transform: rotate(360deg); }
61
- }
62
- @media (prefers-reduced-motion: reduce) {
63
- .ck-btn-spinner { animation-duration: 2400ms; }
64
- }
65
-
66
- .ck-btn--primary {
67
- background: var(--ck-accent);
68
- color: var(--ck-text-inverse);
69
- }
70
- .ck-btn--primary:hover { background: var(--ck-accent-hover); }
71
-
72
- .ck-btn--secondary {
73
- background: var(--ck-bg-surface);
74
- color: var(--ck-text-primary);
75
- border-color: var(--ck-border-strong);
76
- }
77
- .ck-btn--secondary:hover { background: var(--ck-bg-muted); }
78
-
79
- .ck-btn--ghost {
80
- background: transparent;
81
- color: var(--ck-text-primary);
82
- }
83
- .ck-btn--ghost:hover { background: var(--ck-bg-muted); }
84
-
85
- .ck-btn--icon {
86
- background: transparent;
87
- color: var(--ck-text-secondary);
88
- width: 32px;
89
- padding: 0;
90
- justify-content: center;
91
- }
92
- .ck-btn--icon:hover {
93
- background: var(--ck-bg-muted);
94
- color: var(--ck-text-primary);
95
- }
96
-
97
- /* ---------- Card ---------- */
98
- .ck-card {
99
- background: var(--ck-bg-surface);
100
- border: 1px solid var(--ck-border-subtle);
101
- border-radius: var(--ck-radius-md);
102
- overflow: hidden;
103
- }
104
- html[data-ck-chrome="seamless"] .ck-card {
105
- border-color: transparent;
106
- border-radius: 14px;
107
- box-shadow: var(--ck-shadow-1);
108
- }
109
- .ck-card__head {
110
- padding: 14px 20px;
111
- display: flex;
112
- align-items: center;
113
- gap: 12px;
114
- border-bottom: 1px solid var(--ck-border-subtle);
115
- }
116
- html[data-ck-chrome="seamless"] .ck-card__head {
117
- border-bottom-color: transparent;
118
- padding-bottom: 8px;
119
- }
120
- .ck-card__body {
121
- padding: 20px;
122
- }
123
- .ck-card__foot {
124
- padding: 12px 20px;
125
- border-top: 1px solid var(--ck-border-subtle);
126
- background: var(--ck-bg-surface-2);
127
- }
128
- html[data-ck-chrome="seamless"] .ck-card__foot {
129
- border-top-color: transparent;
130
- background: transparent;
131
- }
132
-
133
- /* ---------- Input + Textarea focus state ---------- */
134
- .ck-input:focus-visible,
135
- .ck-textarea:focus-visible {
136
- border-color: var(--ck-accent) !important;
137
- box-shadow: 0 0 0 3px var(--ck-accent-muted);
138
- }
139
- .ck-input::placeholder,
140
- .ck-textarea::placeholder {
141
- color: var(--ck-text-tertiary);
142
- }
143
-
144
- /* ---------- Input + Textarea disabled state ----------
145
- Native :disabled styling is barely perceptible on a cream / dark
146
- surface, which made disabled fields read as editable in
147
- product-meta's settings (the email field in particular). Match
148
- the .ck-btn:disabled treatment so consumers don't have to
149
- reapply the same opacity / cursor pattern at every call site.
150
-
151
- The addon-wrap variant uses :has(:disabled) so a wrapping
152
- .ck-input-addon-wrap also dims when its inner <input> is disabled
153
- — otherwise the slug input dims but its ".meta.test.cosx.dev"
154
- suffix stays at full opacity, which looks broken. :has() is
155
- supported across all evergreen browsers since 2023; pre-1.0 we
156
- don't need a polyfill. */
157
- .ck-input:disabled,
158
- .ck-textarea:disabled,
159
- .ck-input-addon-wrap:has(:disabled) {
160
- opacity: 0.55;
161
- cursor: not-allowed;
162
- }
163
- .ck-input:disabled,
164
- .ck-textarea:disabled {
165
- background: var(--ck-bg-muted, var(--ck-bg-surface));
166
- }
167
-
168
- /* ---------- Select (custom listbox — never native <select>) ----------
169
- The trigger LOOKS like .ck-input so chrome restyles cascade
170
- uniformly. Chromes that want a different vibe (terminal squared,
171
- sketch hand-drawn, swiss underline-only) override at their own
172
- scope. */
173
- .ck-select-trigger:focus-visible {
174
- border-color: var(--ck-accent) !important;
175
- box-shadow: 0 0 0 3px var(--ck-accent-muted);
176
- }
177
- .ck-select-trigger--disabled {
178
- cursor: not-allowed !important;
179
- }
180
- .ck-select-popover {
181
- animation: ck-popover-enter 140ms var(--ck-ease) both;
182
- transform-origin: top center;
183
- }
184
- .ck-select-option--active {
185
- /* Inline style already paints --ck-bg-muted; this class hook is
186
- left for chrome overrides that want to draw a left-border or
187
- other indicator on the active row. */
188
- }
189
- .ck-select-option--selected {
190
- font-weight: 500;
191
- }
192
-
193
- /* ---------- ActionBar — button row inside <ActionBar> ---------- */
194
- .ck-actionbar-btn {
195
- display: inline-flex;
196
- align-items: center;
197
- gap: 6px;
198
- height: 36px;
199
- padding: 0 12px;
200
- border: 1px solid transparent;
201
- background: transparent;
202
- color: var(--ck-text-primary);
203
- font: 500 13px/1 var(--ck-font-sans);
204
- border-radius: 999px;
205
- cursor: pointer;
206
- white-space: nowrap;
207
- transition: background var(--ck-dur-fast) var(--ck-ease), color var(--ck-dur-fast) var(--ck-ease);
208
- }
209
- .ck-actionbar-btn:hover:not(:disabled):not(.ck-actionbar-btn--primary) {
210
- background: var(--ck-bg-muted);
211
- }
212
- /* Children inside an open disclosure group sit on top of the wrapper's
213
- --ck-accent-muted pill. The default gray hover above reads as a hue
214
- collision against the coral/indigo wrapper — swap in an accent-blended
215
- overlay so the hover signal stays in the accent family.
216
-
217
- 30% blend (was 18% in 0.4.5): 18% layered onto an --ck-accent-muted
218
- wrapper (already 8–14% accent depending on chrome) composites to
219
- ~30% effective saturation. At that low saturation translucent
220
- orange / coral / blue all read as washed-out salmon — the hover
221
- loses its hue identity against the solid --ck-accent text right
222
- beside it. 30% pushes the overlay past the "dilution reads as
223
- pink" inflection so the workspace's actual brand colour is
224
- recognisable. */
225
- .ck-actionbar-group--open .ck-actionbar-btn:hover:not(:disabled):not(.ck-actionbar-btn--primary) {
226
- background: color-mix(in oklab, var(--ck-accent) 30%, transparent);
227
- }
228
- .ck-actionbar-btn--primary {
229
- background: var(--ck-accent);
230
- color: var(--ck-text-inverse);
231
- }
232
- .ck-actionbar-btn--primary:hover:not(:disabled) {
233
- background: var(--ck-accent-hover);
234
- }
235
- .ck-actionbar-btn:disabled {
236
- opacity: 0.5;
237
- cursor: not-allowed;
238
- }
239
-
240
- /* Icon glyph wrapper — sized larger than the button's 13 px label
241
- text so unicode symbols (◐ ☀ ☾ ◇) and small SVGs read clearly.
242
- ActionBarButton wraps the icon prop in this span automatically;
243
- callers don't need to opt in. The 1 px upward translate
244
- compensates for geometric glyphs sitting about 1 px below their
245
- em-box centre — flex centring otherwise leaves them looking
246
- slightly low next to the heavier label text. */
247
- .ck-actionbar-icon {
248
- display: inline-flex;
249
- align-items: center;
250
- justify-content: center;
251
- font-size: 16px;
252
- line-height: 1;
253
- transform: translateY(-1px);
254
- }
255
-
256
- /* Hide labels + keyboard-shortcut hints below 768 px (the standard
257
- md breakpoint). Icons + tooltips remain — the bar's still
258
- informative on phones, and there's no physical keyboard so the
259
- shortcut badge has nothing to advertise. */
260
- @media (max-width: 767px) {
261
- .ck-actionbar-label,
262
- .ck-actionbar-hint {
263
- display: none;
264
- }
265
- }
266
-
267
- /* Spring entry from the left edge — only applied when the bar
268
- sits at its default centred position. A dragged custom position
269
- doesn't replay this on mount. Back-out easing overshoots ~10%
270
- so the bar reads as "stuck to the edge". */
271
- @keyframes ck-actionbar-enter {
272
- from {
273
- opacity: 0;
274
- transform: translateX(calc(-50% - 240px));
275
- }
276
- to {
277
- opacity: 1;
278
- transform: translateX(-50%);
279
- }
280
- }
281
- .ck-actionbar-enter {
282
- animation: ck-actionbar-enter 360ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
283
- }
284
-
285
- /* Phone collapsed-to-handle peek-in animation. Pairs with the
286
- half-pill render path in ActionBar.tsx. */
287
- @keyframes ck-action-handle-enter {
288
- from {
289
- opacity: 0;
290
- transform: translateX(-110%);
291
- }
292
- to {
293
- opacity: 1;
294
- transform: translateX(0);
295
- }
296
- }
297
- .ck-action-handle-enter {
298
- animation: ck-action-handle-enter 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
299
- }
300
-
301
- @media (prefers-reduced-motion: reduce) {
302
- .ck-actionbar-enter,
303
- .ck-action-handle-enter {
304
- animation: none;
305
- }
306
- }
307
-
308
- /* ---------- Input bare mode + MultiCombobox inline field ----------
309
- `.ck-input--bare` is an <input> whose FIELD is drawn by its host
310
- (MultiCombobox inline layout: chips + input in one frame). Chrome
311
- presets restyle `.ck-input` with !important at up to (0,5,1)
312
- specificity, so this rule uses `:not(#\#)` to out-rank them and
313
- strip every trace of field chrome back off. */
314
- .ck-input.ck-input--bare:not(#\#) {
315
- background: transparent !important;
316
- border: none !important;
317
- border-radius: 0 !important;
318
- box-shadow: none !important;
319
- outline: none !important;
320
- height: 28px !important;
321
- padding: 0 4px !important;
322
- }
323
-
324
- /* The host-drawn field: looks like .ck-input, carries the focus ring
325
- via :focus-within, the invalid border via :has([aria-invalid]) and
326
- the disabled dim via :has(:disabled). */
327
- .ck-multi-combobox-field:focus-within {
328
- border-color: var(--ck-accent) !important;
329
- box-shadow: 0 0 0 3px var(--ck-accent-muted);
330
- }
331
- .ck-multi-combobox-field:has(.ck-input[aria-invalid="true"]) {
332
- border-color: var(--ck-critical) !important;
333
- }
334
- .ck-multi-combobox-field:has(.ck-input:disabled) {
335
- opacity: 0.55;
336
- cursor: not-allowed;
337
- }
338
- .ck-multi-combobox-invalid-hint {
339
- display: none;
340
- }
341
- .ck-multi-combobox-field:has(.ck-input[aria-invalid="true"]) + .ck-multi-combobox-invalid-hint {
342
- display: block;
343
- }