@jaetask/toolkit 0.0.0-stage → 0.1.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.
@@ -0,0 +1,681 @@
1
+ /* @jaetask/toolkit: tokens and component styles. Import once at the app's root:
2
+ import "@jaetask/toolkit/styles.css";
3
+ Dark values apply under .dark or [data-theme="dark"] on any ancestor. */
4
+
5
+ :root {
6
+ --tk-ink: #1f2328;
7
+ --tk-muted: #6b6a63;
8
+ --tk-line: #e6e4dd;
9
+ --tk-line-strong: #c9c7bf;
10
+ --tk-panel: #f0efe9;
11
+ --tk-card: #ffffff;
12
+ --tk-page: #ffffff;
13
+ --tk-side: #fafafa;
14
+ --tk-side-fill: #f2f2f2;
15
+ --tk-side-text: #737373;
16
+ --tk-side-line: #e6e6e6;
17
+ --tk-primary: #262626;
18
+ --tk-on-primary: #ffffff;
19
+ --tk-todo: #c9c7bf;
20
+ --tk-doing: #d97706;
21
+ --tk-done: #1a7f37;
22
+ --tk-danger: #b42318;
23
+ --tk-focus: #1f2328;
24
+
25
+ --tk-font: "Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif;
26
+
27
+ --tk-radius-panel: 20px;
28
+ --tk-radius-edit: 16px;
29
+ --tk-radius-card: 14px;
30
+ --tk-radius-button: 10px;
31
+ --tk-radius-input: 8px;
32
+ --tk-radius-row: 6px;
33
+
34
+ --tk-sidebar-width: 17.25rem;
35
+ --tk-sidebar-collapsed: 3.25rem;
36
+ --tk-content-width: 75rem;
37
+ }
38
+
39
+ .dark,
40
+ [data-theme="dark"] {
41
+ --tk-ink: #e6edf3;
42
+ --tk-muted: #9a9890;
43
+ --tk-line: #3a3935;
44
+ --tk-line-strong: #5a5952;
45
+ --tk-panel: #222220;
46
+ --tk-card: #2d2d2b;
47
+ --tk-page: #181818;
48
+ --tk-side: #222222;
49
+ --tk-side-fill: #292929;
50
+ --tk-side-text: #999999;
51
+ --tk-side-line: #333333;
52
+ --tk-primary: #bfbfbf;
53
+ --tk-on-primary: #1a1a1a;
54
+ --tk-todo: #5a5952;
55
+ --tk-doing: #d97706;
56
+ --tk-done: #3fb950;
57
+ --tk-danger: #f97066;
58
+ --tk-focus: #e6edf3;
59
+ }
60
+
61
+ /* ---------- Base ---------- */
62
+ .tk-root {
63
+ font-family: var(--tk-font);
64
+ font-feature-settings: "cv02", "cv03", "cv04", "cv11";
65
+ color: var(--tk-ink);
66
+ background: var(--tk-page);
67
+ font-size: 14px;
68
+ line-height: 1.5;
69
+ }
70
+ .tk-root *,
71
+ .tk-root *::before,
72
+ .tk-root *::after {
73
+ box-sizing: border-box;
74
+ }
75
+ .tk-root :focus-visible {
76
+ outline: 2px solid var(--tk-focus);
77
+ outline-offset: 2px;
78
+ }
79
+ .tk-muted {
80
+ color: var(--tk-muted);
81
+ }
82
+
83
+ /* ---------- Shell ---------- */
84
+ .tk-shell {
85
+ display: grid;
86
+ grid-template-columns: var(--tk-sidebar-width) minmax(0, 1fr);
87
+ min-height: 100dvh;
88
+ }
89
+ .tk-shell[data-collapsed="true"] {
90
+ grid-template-columns: var(--tk-sidebar-collapsed) minmax(0, 1fr);
91
+ }
92
+ .tk-side {
93
+ position: sticky;
94
+ top: 0;
95
+ height: 100dvh;
96
+ display: flex;
97
+ flex-direction: column;
98
+ min-width: 0;
99
+ background: var(--tk-side);
100
+ border-right: 1px solid var(--tk-side-line);
101
+ color: var(--tk-side-text);
102
+ }
103
+ .tk-side-scroll {
104
+ flex: 1;
105
+ min-height: 0;
106
+ overflow-y: auto;
107
+ padding-bottom: 16px;
108
+ }
109
+ .tk-mark {
110
+ display: flex;
111
+ align-items: center;
112
+ gap: 8px;
113
+ padding: 14px 16px 10px;
114
+ color: var(--tk-ink);
115
+ font-weight: 600;
116
+ text-decoration: none;
117
+ min-width: 0;
118
+ }
119
+ .tk-mark-icon {
120
+ display: grid;
121
+ place-items: center;
122
+ flex: none;
123
+ width: 22px;
124
+ height: 22px;
125
+ border-radius: 6px;
126
+ background: var(--tk-primary);
127
+ color: var(--tk-on-primary);
128
+ font-size: 12px;
129
+ font-weight: 800;
130
+ }
131
+ .tk-nav {
132
+ display: grid;
133
+ gap: 2px;
134
+ padding: 4px 12px;
135
+ }
136
+ .tk-nav-item,
137
+ .tk-group-item,
138
+ .tk-side-link {
139
+ display: flex;
140
+ align-items: center;
141
+ gap: 8px;
142
+ min-width: 0;
143
+ padding: 6px 12px;
144
+ border-radius: var(--tk-radius-row);
145
+ color: var(--tk-side-text);
146
+ text-decoration: none;
147
+ }
148
+ .tk-nav-item:hover,
149
+ .tk-group-item:hover,
150
+ .tk-side-link:hover {
151
+ background: var(--tk-side-fill);
152
+ }
153
+ .tk-nav-item[aria-current="page"] {
154
+ background: var(--tk-side-fill);
155
+ color: var(--tk-ink);
156
+ font-weight: 500;
157
+ }
158
+ .tk-nav-icon {
159
+ display: inline-flex;
160
+ flex: none;
161
+ width: 16px;
162
+ height: 16px;
163
+ }
164
+ .tk-nav-icon > svg {
165
+ width: 16px;
166
+ height: 16px;
167
+ }
168
+ .tk-label {
169
+ overflow: hidden;
170
+ text-overflow: ellipsis;
171
+ white-space: nowrap;
172
+ }
173
+ .tk-group-label {
174
+ display: block;
175
+ padding: 14px 22px 6px;
176
+ font-size: 11px;
177
+ font-weight: 800;
178
+ letter-spacing: 0.08em;
179
+ text-transform: uppercase;
180
+ color: var(--tk-side-text);
181
+ text-decoration: none;
182
+ }
183
+ a.tk-group-label:hover {
184
+ color: var(--tk-ink);
185
+ }
186
+ .tk-group {
187
+ display: grid;
188
+ gap: 2px;
189
+ }
190
+ .tk-group-item {
191
+ margin: 0 12px;
192
+ color: var(--tk-ink);
193
+ }
194
+ .tk-group-item .tk-dot {
195
+ margin-left: auto;
196
+ }
197
+ .tk-avatar {
198
+ display: grid;
199
+ place-items: center;
200
+ flex: none;
201
+ width: 22px;
202
+ height: 22px;
203
+ border-radius: 50%;
204
+ overflow: hidden;
205
+ background: var(--tk-line);
206
+ color: var(--tk-ink);
207
+ font-size: 11px;
208
+ font-weight: 700;
209
+ }
210
+ .tk-group-open {
211
+ margin: 2px 12px;
212
+ padding: 6px 0 10px;
213
+ border-radius: 10px;
214
+ background: var(--tk-panel);
215
+ }
216
+ .tk-group-open > .tk-group-item {
217
+ margin: 0 6px;
218
+ font-weight: 600;
219
+ }
220
+ .tk-side-section {
221
+ display: grid;
222
+ gap: 1px;
223
+ }
224
+ .tk-side-section > .tk-group-label {
225
+ padding: 10px 18px 4px;
226
+ font-size: 10.5px;
227
+ }
228
+ .tk-side-link {
229
+ justify-content: space-between;
230
+ margin: 0 6px;
231
+ padding: 5px 12px;
232
+ color: var(--tk-ink);
233
+ font-size: 13px;
234
+ }
235
+ .tk-side-link[aria-current="page"] {
236
+ background: var(--tk-card);
237
+ font-weight: 500;
238
+ }
239
+ .tk-side-link-text {
240
+ display: flex;
241
+ flex-direction: column;
242
+ min-width: 0;
243
+ }
244
+ .tk-side-link-line {
245
+ color: var(--tk-side-text);
246
+ font-size: 11px;
247
+ font-weight: 400;
248
+ line-height: 1.3;
249
+ }
250
+ .tk-side-empty {
251
+ padding: 6px 24px;
252
+ font-size: 12px;
253
+ color: var(--tk-side-text);
254
+ }
255
+ .tk-side-foot {
256
+ display: flex;
257
+ align-items: center;
258
+ gap: 4px;
259
+ padding: 10px 12px 10px 16px;
260
+ border-top: 1px solid var(--tk-side-line);
261
+ color: var(--tk-ink);
262
+ font-size: 13px;
263
+ }
264
+ .tk-side-foot > .tk-settings {
265
+ flex: 1;
266
+ color: inherit;
267
+ text-decoration: none;
268
+ }
269
+ .tk-icon-button {
270
+ display: inline-grid;
271
+ place-items: center;
272
+ width: 28px;
273
+ height: 28px;
274
+ border: 0;
275
+ border-radius: var(--tk-radius-row);
276
+ background: transparent;
277
+ color: var(--tk-side-text);
278
+ cursor: pointer;
279
+ }
280
+ .tk-icon-button:hover {
281
+ background: var(--tk-side-fill);
282
+ color: var(--tk-ink);
283
+ }
284
+ .tk-icon-button > svg {
285
+ width: 16px;
286
+ height: 16px;
287
+ }
288
+ .tk-shell[data-collapsed="true"] .tk-label,
289
+ .tk-shell[data-collapsed="true"] .tk-group-label,
290
+ .tk-shell[data-collapsed="true"] .tk-group-open > :not(.tk-group-item),
291
+ .tk-shell[data-collapsed="true"] .tk-dot,
292
+ .tk-shell[data-collapsed="true"] .tk-settings,
293
+ .tk-shell[data-collapsed="true"] .tk-side-empty {
294
+ display: none;
295
+ }
296
+ .tk-shell[data-collapsed="true"] .tk-nav,
297
+ .tk-shell[data-collapsed="true"] .tk-group-item,
298
+ .tk-shell[data-collapsed="true"] .tk-group-open {
299
+ margin-inline: 4px;
300
+ padding-inline: 4px;
301
+ }
302
+ .tk-shell[data-collapsed="true"] .tk-nav-item,
303
+ .tk-shell[data-collapsed="true"] .tk-group-item,
304
+ .tk-shell[data-collapsed="true"] .tk-mark {
305
+ justify-content: center;
306
+ padding-inline: 0;
307
+ }
308
+ .tk-shell[data-collapsed="true"] .tk-side-foot {
309
+ flex-direction: column;
310
+ padding-inline: 0;
311
+ }
312
+
313
+ .tk-main {
314
+ display: flex;
315
+ flex-direction: column;
316
+ min-width: 0;
317
+ }
318
+ .tk-top {
319
+ display: flex;
320
+ align-items: center;
321
+ gap: 8px;
322
+ min-height: 52px;
323
+ padding: 10px 24px;
324
+ }
325
+ .tk-top-title {
326
+ font-weight: 500;
327
+ }
328
+ .tk-top-app {
329
+ color: var(--tk-muted);
330
+ font-size: 13px;
331
+ }
332
+ .tk-top-aside {
333
+ margin-left: auto;
334
+ display: flex;
335
+ align-items: center;
336
+ gap: 8px;
337
+ }
338
+ .tk-content {
339
+ flex: 1;
340
+ min-width: 0;
341
+ padding: 12px 24px 40px;
342
+ }
343
+
344
+ @media (max-width: 760px) {
345
+ .tk-shell,
346
+ .tk-shell[data-collapsed="true"] {
347
+ grid-template-columns: 1fr;
348
+ }
349
+ .tk-side {
350
+ position: static;
351
+ height: auto;
352
+ border-right: 0;
353
+ border-bottom: 1px solid var(--tk-side-line);
354
+ }
355
+ .tk-side-scroll {
356
+ max-height: 50dvh;
357
+ }
358
+ .tk-top,
359
+ .tk-content {
360
+ padding-inline: 16px;
361
+ }
362
+ }
363
+
364
+ /* ---------- Page kit ---------- */
365
+ .tk-page {
366
+ display: flex;
367
+ flex-direction: column;
368
+ gap: 28px;
369
+ max-width: var(--tk-content-width);
370
+ }
371
+ .tk-page-head {
372
+ display: flex;
373
+ flex-wrap: wrap;
374
+ align-items: flex-start;
375
+ justify-content: space-between;
376
+ gap: 16px;
377
+ }
378
+ .tk-page-title {
379
+ margin: 0;
380
+ font-size: 26px;
381
+ font-weight: 800;
382
+ line-height: 1.15;
383
+ }
384
+ .tk-page-line {
385
+ margin: 4px 0 0;
386
+ color: var(--tk-muted);
387
+ font-size: 14px;
388
+ }
389
+ .tk-panel {
390
+ display: flex;
391
+ flex-direction: column;
392
+ gap: 14px;
393
+ padding: 22px 24px 24px;
394
+ border-radius: var(--tk-radius-panel);
395
+ background: var(--tk-panel);
396
+ scroll-margin-top: 96px;
397
+ }
398
+ .tk-panel-head {
399
+ display: flex;
400
+ flex-wrap: wrap;
401
+ align-items: flex-start;
402
+ justify-content: space-between;
403
+ gap: 12px;
404
+ }
405
+ .tk-panel-title {
406
+ margin: 0;
407
+ font-size: 20px;
408
+ font-weight: 800;
409
+ line-height: 1.25;
410
+ }
411
+ .tk-panel-line {
412
+ margin: 4px 0 0;
413
+ color: var(--tk-muted);
414
+ font-size: 14px;
415
+ line-height: 1.35;
416
+ }
417
+ .tk-card {
418
+ padding: 20px 24px;
419
+ border: 1px solid var(--tk-line);
420
+ border-radius: var(--tk-radius-card);
421
+ background: var(--tk-card);
422
+ }
423
+ .tk-kicker {
424
+ font-size: 12px;
425
+ font-weight: 700;
426
+ letter-spacing: 0.08em;
427
+ text-transform: uppercase;
428
+ color: var(--tk-muted);
429
+ }
430
+ .tk-list {
431
+ margin: 0;
432
+ padding: 0;
433
+ list-style: none;
434
+ overflow: hidden;
435
+ border: 1px solid var(--tk-line);
436
+ border-radius: var(--tk-radius-card);
437
+ background: var(--tk-card);
438
+ }
439
+ .tk-list-row {
440
+ display: flex;
441
+ align-items: center;
442
+ gap: 12px;
443
+ padding: 13px 20px;
444
+ border-top: 1px solid var(--tk-line);
445
+ }
446
+ .tk-list-row:first-child {
447
+ border-top: 0;
448
+ }
449
+ .tk-list-body {
450
+ display: flex;
451
+ flex: 1;
452
+ flex-direction: column;
453
+ gap: 4px;
454
+ min-width: 0;
455
+ color: inherit;
456
+ text-decoration: none;
457
+ }
458
+ a.tk-list-body:hover {
459
+ opacity: 0.8;
460
+ }
461
+ .tk-list-aside {
462
+ display: flex;
463
+ flex: none;
464
+ align-items: center;
465
+ gap: 8px;
466
+ }
467
+ .tk-empty {
468
+ display: flex;
469
+ flex-wrap: wrap;
470
+ align-items: center;
471
+ justify-content: space-between;
472
+ gap: 12px;
473
+ padding: 16px 20px;
474
+ border: 1px dashed var(--tk-line-strong);
475
+ border-radius: var(--tk-radius-card);
476
+ }
477
+ .tk-empty > p {
478
+ margin: 0;
479
+ color: var(--tk-muted);
480
+ }
481
+ .tk-dot {
482
+ display: inline-block;
483
+ flex: none;
484
+ width: 8px;
485
+ height: 8px;
486
+ border-radius: 50%;
487
+ }
488
+ .tk-dot[data-status="not-started"] {
489
+ background: var(--tk-todo);
490
+ }
491
+ .tk-dot[data-status="in-progress"] {
492
+ background: var(--tk-doing);
493
+ }
494
+ .tk-dot[data-status="done"] {
495
+ background: var(--tk-done);
496
+ }
497
+ .tk-status {
498
+ display: inline-flex;
499
+ align-items: center;
500
+ gap: 6px;
501
+ color: var(--tk-muted);
502
+ font-size: 13px;
503
+ }
504
+ .tk-chip {
505
+ display: inline-block;
506
+ padding: 4px 10px;
507
+ border-radius: 999px;
508
+ background: var(--tk-panel);
509
+ color: var(--tk-ink);
510
+ font-size: 13px;
511
+ }
512
+ .tk-chips {
513
+ display: flex;
514
+ flex-wrap: wrap;
515
+ gap: 6px;
516
+ }
517
+
518
+ /* ---------- Buttons and inputs ---------- */
519
+ .tk-button {
520
+ display: inline-flex;
521
+ align-items: center;
522
+ justify-content: center;
523
+ gap: 6px;
524
+ padding: 8px 14px;
525
+ border: 0;
526
+ border-radius: var(--tk-radius-button);
527
+ background: var(--tk-card);
528
+ color: var(--tk-ink);
529
+ font: 600 13px / 1.25 var(--tk-font);
530
+ text-decoration: none;
531
+ white-space: nowrap;
532
+ cursor: pointer;
533
+ }
534
+ .tk-button:hover {
535
+ background: var(--tk-line);
536
+ }
537
+ .tk-button[data-surface="white"] {
538
+ background: var(--tk-panel);
539
+ }
540
+ .tk-button[data-surface="white"]:hover {
541
+ background: var(--tk-line);
542
+ }
543
+ .tk-button[data-variant="primary"] {
544
+ background: var(--tk-primary);
545
+ color: var(--tk-on-primary);
546
+ }
547
+ .tk-button[data-variant="primary"]:hover {
548
+ opacity: 0.9;
549
+ }
550
+ .tk-button[data-variant="danger"] {
551
+ background: var(--tk-danger);
552
+ color: #ffffff;
553
+ }
554
+ .tk-button:disabled,
555
+ .tk-button[aria-disabled="true"] {
556
+ opacity: 0.5;
557
+ cursor: default;
558
+ pointer-events: none;
559
+ }
560
+ .tk-input,
561
+ .tk-textarea,
562
+ .tk-select {
563
+ width: 100%;
564
+ padding: 9px 11px;
565
+ border: 1px solid var(--tk-line);
566
+ border-radius: var(--tk-radius-input);
567
+ background: var(--tk-card);
568
+ color: var(--tk-ink);
569
+ font: 14px / 1.4 var(--tk-font);
570
+ }
571
+ .tk-textarea {
572
+ min-height: 80px;
573
+ resize: vertical;
574
+ }
575
+ .tk-input:focus-visible,
576
+ .tk-textarea:focus-visible,
577
+ .tk-select:focus-visible {
578
+ outline: 2px solid var(--tk-focus);
579
+ outline-offset: 0;
580
+ border-color: transparent;
581
+ }
582
+ .tk-pick {
583
+ padding: 6px 12px;
584
+ border: 0;
585
+ border-radius: 999px;
586
+ background: var(--tk-panel);
587
+ color: var(--tk-ink);
588
+ font: 600 13px / 1.25 var(--tk-font);
589
+ cursor: pointer;
590
+ }
591
+ .tk-pick[aria-checked="true"] {
592
+ background: var(--tk-ink);
593
+ color: var(--tk-page);
594
+ }
595
+
596
+ /* ---------- Edit page ---------- */
597
+ .tk-edit {
598
+ display: flex;
599
+ flex-direction: column;
600
+ gap: 24px;
601
+ max-width: var(--tk-content-width);
602
+ }
603
+ .tk-edit-card {
604
+ padding: 4px 32px 8px;
605
+ border: 1px solid var(--tk-line);
606
+ border-radius: var(--tk-radius-edit);
607
+ background: var(--tk-card);
608
+ }
609
+ .tk-edit-bar {
610
+ display: flex;
611
+ flex-wrap: wrap;
612
+ align-items: center;
613
+ justify-content: flex-end;
614
+ gap: 8px;
615
+ }
616
+ .tk-edit-extra {
617
+ margin-right: auto;
618
+ }
619
+ .tk-row {
620
+ display: grid;
621
+ grid-template-columns: 200px minmax(0, 1fr);
622
+ gap: 24px;
623
+ padding: 22px 0;
624
+ border-top: 1px solid var(--tk-line);
625
+ }
626
+ .tk-row:first-child {
627
+ border-top: 0;
628
+ }
629
+ .tk-row-label {
630
+ display: flex;
631
+ flex-direction: column;
632
+ gap: 4px;
633
+ }
634
+ .tk-row-title {
635
+ font-size: 15px;
636
+ font-weight: 800;
637
+ }
638
+ .tk-row-line {
639
+ color: var(--tk-muted);
640
+ font-size: 12px;
641
+ line-height: 1.35;
642
+ }
643
+ .tk-row-fields {
644
+ display: flex;
645
+ flex-direction: column;
646
+ gap: 12px;
647
+ min-width: 0;
648
+ }
649
+ @media (max-width: 760px) {
650
+ .tk-row {
651
+ grid-template-columns: 1fr;
652
+ gap: 10px;
653
+ }
654
+ .tk-edit-card {
655
+ padding-inline: 18px;
656
+ }
657
+ }
658
+
659
+ /* ---------- Confirm delete ---------- */
660
+ .tk-dialog {
661
+ max-width: 28rem;
662
+ padding: 24px;
663
+ border: 1px solid var(--tk-line);
664
+ border-radius: var(--tk-radius-card);
665
+ background: var(--tk-card);
666
+ color: var(--tk-ink);
667
+ font-family: var(--tk-font);
668
+ }
669
+ .tk-dialog::backdrop {
670
+ background: rgb(0 0 0 / 0.35);
671
+ }
672
+ .tk-dialog-form {
673
+ display: flex;
674
+ flex-direction: column;
675
+ gap: 14px;
676
+ }
677
+ .tk-dialog-title {
678
+ margin: 0;
679
+ font-size: 18px;
680
+ font-weight: 800;
681
+ }
package/dist/ui.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { type ButtonHTMLAttributes, type InputHTMLAttributes, type LabelHTMLAttributes, type ReactNode, type SelectHTMLAttributes, type TextareaHTMLAttributes } from "react";
2
+ export declare const cx: (...parts: (string | false | null | undefined)[]) => string;
3
+ export type ButtonVariant = "grey" | "primary" | "danger";
4
+ /** The surface a grey button sits on: a warm grey panel (default) or a white card. */
5
+ export type Surface = "panel" | "white";
6
+ export declare const Button: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
7
+ variant?: ButtonVariant;
8
+ surface?: Surface;
9
+ } & import("react").RefAttributes<HTMLButtonElement>>;
10
+ export declare const Input: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
11
+ export declare const Textarea: import("react").ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
12
+ export declare const Select: import("react").ForwardRefExoticComponent<SelectHTMLAttributes<HTMLSelectElement> & import("react").RefAttributes<HTMLSelectElement>>;
13
+ export declare function Label({ className, ...rest }: LabelHTMLAttributes<HTMLLabelElement>): import("react").JSX.Element;
14
+ /**
15
+ * Permanent delete, confirmed by typing the name. Archive is the everyday way to retire something;
16
+ * this is the only dialog the toolkit has.
17
+ */
18
+ export declare function ConfirmDelete({ name, what, onConfirm, label, }: {
19
+ name: string;
20
+ what?: string;
21
+ onConfirm: () => void;
22
+ label?: string;
23
+ }): import("react").JSX.Element;
24
+ export type Children = {
25
+ children?: ReactNode;
26
+ };