@softure-ai/theme-notion 0.1.0 → 0.2.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +80 -4
  3. package/dist/index.d.ts +7 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +7 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/messages/en.d.ts +3 -0
  8. package/dist/messages/en.d.ts.map +1 -1
  9. package/dist/messages/en.js +1 -0
  10. package/dist/messages/en.js.map +1 -1
  11. package/dist/messages/index.d.ts +3 -0
  12. package/dist/messages/index.d.ts.map +1 -1
  13. package/dist/notion/DetailTable.d.ts +15 -0
  14. package/dist/notion/DetailTable.d.ts.map +1 -0
  15. package/dist/notion/DetailTable.js +20 -0
  16. package/dist/notion/DetailTable.js.map +1 -0
  17. package/dist/notion/FoldRow.d.ts +23 -0
  18. package/dist/notion/FoldRow.d.ts.map +1 -0
  19. package/dist/notion/FoldRow.js +14 -0
  20. package/dist/notion/FoldRow.js.map +1 -0
  21. package/dist/notion/MarkPopover.d.ts +19 -0
  22. package/dist/notion/MarkPopover.d.ts.map +1 -0
  23. package/dist/notion/MarkPopover.js +22 -0
  24. package/dist/notion/MarkPopover.js.map +1 -0
  25. package/dist/notion/PageHeader.d.ts +2 -1
  26. package/dist/notion/PageHeader.d.ts.map +1 -1
  27. package/dist/notion/PageHeader.js +2 -2
  28. package/dist/notion/PageHeader.js.map +1 -1
  29. package/dist/notion/SidePanel.d.ts +13 -0
  30. package/dist/notion/SidePanel.d.ts.map +1 -0
  31. package/dist/notion/SidePanel.js +28 -0
  32. package/dist/notion/SidePanel.js.map +1 -0
  33. package/dist/notion/Stats.d.ts +45 -0
  34. package/dist/notion/Stats.d.ts.map +1 -0
  35. package/dist/notion/Stats.js +31 -0
  36. package/dist/notion/Stats.js.map +1 -0
  37. package/dist/notion/TabBar.d.ts +15 -0
  38. package/dist/notion/TabBar.d.ts.map +1 -0
  39. package/dist/notion/TabBar.js +6 -0
  40. package/dist/notion/TabBar.js.map +1 -0
  41. package/dist/notion/tones.d.ts +8 -0
  42. package/dist/notion/tones.d.ts.map +1 -0
  43. package/dist/notion/tones.js +37 -0
  44. package/dist/notion/tones.js.map +1 -0
  45. package/package.json +2 -2
  46. package/src/index.ts +17 -0
  47. package/src/messages/en.ts +1 -0
  48. package/src/notion/DetailTable.tsx +46 -0
  49. package/src/notion/FoldRow.tsx +78 -0
  50. package/src/notion/MarkPopover.tsx +84 -0
  51. package/src/notion/PageHeader.tsx +4 -2
  52. package/src/notion/SidePanel.tsx +73 -0
  53. package/src/notion/Stats.tsx +145 -0
  54. package/src/notion/TabBar.tsx +47 -0
  55. package/src/notion/tones.ts +45 -0
@@ -0,0 +1,47 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ export interface TabBarItem<Key extends string> {
4
+ // Kept on the link as `data-tab`.
5
+ readonly key: Key;
6
+ readonly label: string;
7
+ readonly href: string;
8
+ // Drawn before the label; the caller hides it from assistive technology.
9
+ readonly icon?: ReactNode;
10
+ // Drawn after the label, 0 included.
11
+ readonly count?: number;
12
+ }
13
+
14
+ export interface TabBarProps<Key extends string> {
15
+ // The nav's accessible name.
16
+ readonly label: string;
17
+ readonly tabs: readonly TabBarItem<Key>[];
18
+ readonly current: Key;
19
+ }
20
+
21
+ // A screen's tabs as line tabs where each tab is a link, so the shown tab lives in the address and survives a reload.
22
+ export function TabBar<Key extends string>({ label, tabs, current }: TabBarProps<Key>) {
23
+ return (
24
+ <nav aria-label={label} data-slot="tab-bar" className="overflow-x-auto border-b border-border">
25
+ <ul className="flex gap-1 pb-1">
26
+ {tabs.map((tab) => (
27
+ <li key={tab.key}>
28
+ <a
29
+ href={tab.href}
30
+ className="relative inline-flex h-control-height items-center gap-1.5 rounded-md px-2 text-ui-medium whitespace-nowrap text-muted-foreground transition-colors duration-120 after:absolute after:inset-x-0 after:-bottom-1 after:h-0.5 after:bg-foreground after:opacity-0 hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none aria-[current=page]:text-foreground aria-[current=page]:after:opacity-100 [&_svg]:size-4 [&_svg]:shrink-0"
31
+ data-tab={tab.key}
32
+ aria-current={tab.key === current ? "page" : undefined}
33
+ >
34
+ {tab.icon}
35
+ {tab.label}
36
+ {tab.count === undefined ? null : (
37
+ <span data-slot="tab-bar-count" className="rounded-xs bg-accent px-1 text-small text-muted-foreground tabular-nums">
38
+ {tab.count}
39
+ </span>
40
+ )}
41
+ </a>
42
+ </li>
43
+ ))}
44
+ </ul>
45
+ </nav>
46
+ );
47
+ }
@@ -0,0 +1,45 @@
1
+ import type { PaletteColor } from "./palette.js";
2
+
3
+ // A figure's colour by what it means: done, to do, owed or failing, out of play, or neutral. Each app keeps its own
4
+ // table of which meaning takes which tone ("booked" → success); the theme owns the colours and the class names.
5
+ export const TONES = ["default", "success", "warning", "danger", "muted"] as const;
6
+
7
+ export type Tone = (typeof TONES)[number];
8
+
9
+ // A tone's palette colour; `default` has none and reads in the text colour.
10
+ export const TONE_COLORS: Readonly<Record<Tone, PaletteColor | null>> = {
11
+ default: null,
12
+ success: "green",
13
+ warning: "orange",
14
+ danger: "red",
15
+ muted: "gray",
16
+ };
17
+
18
+ // Literal class names per tone, so Tailwind generates each one (the theme's `@source` covers this folder).
19
+
20
+ // A figure written in its tone's colour.
21
+ export const TONE_TEXT: Readonly<Record<Tone, string>> = {
22
+ default: "text-foreground",
23
+ success: "text-green",
24
+ warning: "text-orange",
25
+ danger: "text-red",
26
+ muted: "text-gray",
27
+ };
28
+
29
+ // A drawn share (a bar segment) in its tone's colour; the default is a quiet gray.
30
+ export const TONE_FILL: Readonly<Record<Tone, string>> = {
31
+ default: "bg-gray",
32
+ success: "bg-green",
33
+ warning: "bg-orange",
34
+ danger: "bg-red",
35
+ muted: "bg-gray",
36
+ };
37
+
38
+ // A box's leading edge in its tone's colour; the default is a quiet gray.
39
+ export const TONE_EDGE: Readonly<Record<Tone, string>> = {
40
+ default: "border-l-gray",
41
+ success: "border-l-green",
42
+ warning: "border-l-orange",
43
+ danger: "border-l-red",
44
+ muted: "border-l-gray",
45
+ };