@krizaka/sovkora-design-system 0.0.0-stage → 4.0.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/CHANGELOG.md +234 -0
- package/LICENSE +202 -0
- package/README.md +82 -2
- package/package.json +112 -3
- package/registry/badge.json +97 -0
- package/registry/button.json +140 -0
- package/registry/chat-showcase.json +113 -0
- package/registry/clip-player.json +120 -0
- package/registry/command-palette.json +116 -0
- package/registry/examples/badge/model-state.tsx +16 -0
- package/registry/examples/button/send.tsx +18 -0
- package/registry/examples/chat-showcase/french.tsx +20 -0
- package/registry/examples/chat-showcase/sovereign-answer.tsx +20 -0
- package/registry/examples/clip-player/tea-pour.tsx +27 -0
- package/registry/examples/command-palette/workspace.tsx +30 -0
- package/registry/examples/icon/engine.tsx +26 -0
- package/registry/examples/icon/in-a-button.tsx +12 -0
- package/registry/examples/run-facts/clip-run.tsx +15 -0
- package/registry/examples/sentinel-mini/sidebar.tsx +11 -0
- package/registry/examples/skeleton/answer-loading.tsx +11 -0
- package/registry/examples/video-result/assistant.tsx +36 -0
- package/registry/examples/video-result/tea-pour.tsx +40 -0
- package/registry/foundations.json +2067 -0
- package/registry/icon.json +109 -0
- package/registry/index.json +242 -0
- package/registry/run-facts.json +75 -0
- package/registry/sentinel-mini.json +81 -0
- package/registry/skeleton.json +116 -0
- package/registry/video-result.json +167 -0
- package/src/components/Badge.tsx +36 -0
- package/src/components/Button.tsx +26 -0
- package/src/components/ChatShowcase.tsx +248 -0
- package/src/components/ClipPlayer.tsx +223 -0
- package/src/components/CommandPalette.tsx +104 -0
- package/src/components/CommandPalette.types.ts +33 -0
- package/src/components/Input.tsx +14 -0
- package/src/components/RunFacts.tsx +36 -0
- package/src/components/SentinelMini.tsx +61 -0
- package/src/components/Skeleton.tsx +50 -0
- package/src/components/VideoResult.tsx +123 -0
- package/src/components/badge.meta.ts +34 -0
- package/src/components/button.meta.ts +35 -0
- package/src/components/chat-showcase.css.ts +19 -0
- package/src/components/chat-showcase.meta.ts +50 -0
- package/src/components/clip-player.meta.ts +48 -0
- package/src/components/command-palette.meta.ts +47 -0
- package/src/components/icon.meta.ts +45 -0
- package/src/components/run-facts.meta.ts +32 -0
- package/src/components/sentinel-mini.meta.ts +39 -0
- package/src/components/skeleton.meta.ts +42 -0
- package/src/components/video-result.meta.ts +53 -0
- package/src/icon.registry.tsx +737 -0
- package/src/icon.tsx +74 -0
- package/src/index.ts +43 -0
- package/src/meta.ts +76 -0
- package/src/theme.css +859 -0
package/src/icon.tsx
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file icon.tsx
|
|
3
|
+
* @description Centralized polymorphic icon registry for the Sovkora UI.
|
|
4
|
+
*
|
|
5
|
+
* Single ICON_REGISTRY dictionary housing custom-crafted, minimalist geometric
|
|
6
|
+
* SVG paths. Every path uses vector-effect="non-scaling-stroke" for visual
|
|
7
|
+
* thickness consistency during layout motion sweeps.
|
|
8
|
+
*
|
|
9
|
+
* Usage: <Icon name="dashboard" size={20} className="text-accent" />
|
|
10
|
+
*
|
|
11
|
+
* Default: 24×24 viewBox, 1.25px stroke, round caps, currentColor.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import React from "react";
|
|
15
|
+
|
|
16
|
+
import type { IconName } from "./icon.registry";
|
|
17
|
+
import { ICON_REGISTRY } from "./icon.registry";
|
|
18
|
+
|
|
19
|
+
export type { IconName };
|
|
20
|
+
|
|
21
|
+
interface IconProps {
|
|
22
|
+
/** Icon identifier from the registry */
|
|
23
|
+
name: IconName;
|
|
24
|
+
/** Pixel size (width & height). Defaults to 20. */
|
|
25
|
+
size?: number;
|
|
26
|
+
/** Additional CSS classes */
|
|
27
|
+
className?: string;
|
|
28
|
+
/** Accessible label — if omitted, icon is decorative (aria-hidden) */
|
|
29
|
+
label?: string;
|
|
30
|
+
/** Drawn when `name` is not in the registry (a key that comes from data, e.g. a Studio's `iconKey`). */
|
|
31
|
+
fallback?: IconName;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Polymorphic SVG icon wrapper with uniform fallback configuration.
|
|
36
|
+
*
|
|
37
|
+
* - Default fine strokeWidth: 1.25
|
|
38
|
+
* - Round caps and joins
|
|
39
|
+
* - Size control via `size` prop
|
|
40
|
+
* - vector-effect="non-scaling-stroke" on all paths
|
|
41
|
+
*
|
|
42
|
+
* @param props — Icon configuration
|
|
43
|
+
* @returns SVG element with the requested icon path
|
|
44
|
+
*/
|
|
45
|
+
export function Icon({ name, size = 20, className = "", label, fallback }: Readonly<IconProps>) {
|
|
46
|
+
const paths = ICON_REGISTRY[name] ?? (fallback ? ICON_REGISTRY[fallback] : undefined);
|
|
47
|
+
if (!paths) return null;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<svg
|
|
51
|
+
width={size}
|
|
52
|
+
height={size}
|
|
53
|
+
viewBox="0 0 24 24"
|
|
54
|
+
fill="none"
|
|
55
|
+
stroke="currentColor"
|
|
56
|
+
strokeWidth="1.25"
|
|
57
|
+
strokeLinecap="round"
|
|
58
|
+
strokeLinejoin="round"
|
|
59
|
+
className={className}
|
|
60
|
+
role={label ? "img" : "presentation"}
|
|
61
|
+
aria-label={label}
|
|
62
|
+
aria-hidden={!label}
|
|
63
|
+
>
|
|
64
|
+
{paths}
|
|
65
|
+
</svg>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* ═══════════════════════════════════════════════════════════
|
|
70
|
+
ICON_REGISTRY — Minimalist Geometric SVG Paths
|
|
71
|
+
─────────────────────────────────────────────────────────
|
|
72
|
+
Every path entry features vector-effect="non-scaling-stroke"
|
|
73
|
+
for visual thickness consistency during layout motion sweeps.
|
|
74
|
+
═══════════════════════════════════════════════════════════ */
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description Public surface of `@krizaka/sovkora-design-system` — the Sovkora identity on the Krizaka platform:
|
|
4
|
+
* the theme (`./theme.css`, --kz-* overrides; import it once at the app root, after `tailwindcss`), the product
|
|
5
|
+
* composites, and a few @krizaka/ui primitives re-exported with their Sovkora defaults (Button's `primary`). Every
|
|
6
|
+
* other primitive — Card, Dialog, Toaster, Loader, Stepper, Meter, NumberTicker… — is imported from @krizaka/ui.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// ── Design tokens (framework-agnostic, from sovkora-shared) ─────────────────
|
|
10
|
+
// The token values for React Native and the CLI (the Sovkora orange of @krizaka/tokens/native). The web theme is
|
|
11
|
+
// theme.css (--kz-* roles).
|
|
12
|
+
export type { ThemeColors, ThemeName, Tokens } from "@krizaka/sovkora-shared";
|
|
13
|
+
export { radius, shadows, status, themes, tokens, typeScale } from "@krizaka/sovkora-shared";
|
|
14
|
+
|
|
15
|
+
// ── Class helpers ───────────────────────────────────────────────────────────
|
|
16
|
+
export { cn } from "@krizaka/ui/cn";
|
|
17
|
+
|
|
18
|
+
// ── Icon registry ───────────────────────────────────────────────────────────
|
|
19
|
+
export type { IconName } from "./icon";
|
|
20
|
+
export { Icon } from "./icon";
|
|
21
|
+
|
|
22
|
+
// ── Primitives from @krizaka/ui (re-exported) ───────────────────────────────
|
|
23
|
+
export type { BadgeProps, BadgeVariant, BadgeVariants } from "./components/Badge";
|
|
24
|
+
export { Badge, badgeVariants } from "./components/Badge";
|
|
25
|
+
export type { ButtonProps, ButtonVariants, IconButtonProps } from "./components/Button";
|
|
26
|
+
export { Button, buttonVariants, IconButton } from "./components/Button";
|
|
27
|
+
export type { InputProps } from "./components/Input";
|
|
28
|
+
export { Field, Input, Select, Textarea } from "./components/Input";
|
|
29
|
+
export type { SkeletonGroupProps, SkeletonProps } from "./components/Skeleton";
|
|
30
|
+
export { Skeleton, SkeletonGroup, skeletonVariants } from "./components/Skeleton";
|
|
31
|
+
|
|
32
|
+
// ── Sovkora composites ──────────────────────────────────────────────────────
|
|
33
|
+
export type { ChatShowcaseLabels, ChatShowcaseProps } from "./components/ChatShowcase";
|
|
34
|
+
export { ChatShowcase } from "./components/ChatShowcase";
|
|
35
|
+
export type { ClipPlayerLabels, ClipPlayerProps, ClipSources } from "./components/ClipPlayer";
|
|
36
|
+
export { ClipPlayer } from "./components/ClipPlayer";
|
|
37
|
+
export type { CommandPaletteItem, CommandPaletteLabels, CommandPaletteProps } from "./components/CommandPalette";
|
|
38
|
+
export { CommandPalette } from "./components/CommandPalette";
|
|
39
|
+
export type { RunFact, RunFactsProps } from "./components/RunFacts";
|
|
40
|
+
export { RunFacts } from "./components/RunFacts";
|
|
41
|
+
export { SentinelMini } from "./components/SentinelMini";
|
|
42
|
+
export type { VideoResultFact, VideoResultLabels, VideoResultProps } from "./components/VideoResult";
|
|
43
|
+
export { VideoResult } from "./components/VideoResult";
|
package/src/meta.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// The documentation of a component of the kit, carried by its code — the same format as @krizaka/ui's (`src/meta.ts`
|
|
2
|
+
// in krizaka-ui), plus what a product component owes its reader: why it exists above Krizaka UI, the primitives it is
|
|
3
|
+
// built on, and, when it is deprecated, what replaces it. Each component has a `<name>.meta.ts` beside it; never built
|
|
4
|
+
// into the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which krizaka.com renders as
|
|
5
|
+
// /docs/sovkora/ui/<name>, and `scripts/registry.test.mjs` fails when an exported component has none.
|
|
6
|
+
|
|
7
|
+
/** Every documented component of the kit. */
|
|
8
|
+
export type ComponentName =
|
|
9
|
+
| "badge"
|
|
10
|
+
| "button"
|
|
11
|
+
| "chat-showcase"
|
|
12
|
+
| "clip-player"
|
|
13
|
+
| "command-palette"
|
|
14
|
+
| "icon"
|
|
15
|
+
| "run-facts"
|
|
16
|
+
| "sentinel-mini"
|
|
17
|
+
| "skeleton"
|
|
18
|
+
| "video-result";
|
|
19
|
+
|
|
20
|
+
/** A component of @krizaka/ui, documented at krizaka.com/docs/ui/<name>: `ui/badge`, `ui/button`. */
|
|
21
|
+
export type UiComponent = `ui/${string}`;
|
|
22
|
+
|
|
23
|
+
/** A component a reader should know about: one of this kit, or one of @krizaka/ui. */
|
|
24
|
+
export type Reference = ComponentName | UiComponent;
|
|
25
|
+
|
|
26
|
+
/** `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: see `deprecated`. */
|
|
27
|
+
export type Status = "stable" | "beta" | "deprecated";
|
|
28
|
+
|
|
29
|
+
/** The group of the catalogue (the @krizaka/ui categories). */
|
|
30
|
+
export type Category =
|
|
31
|
+
"actions" | "forms" | "navigation" | "overlays" | "feedback" | "data-display" | "layout" | "foundations";
|
|
32
|
+
|
|
33
|
+
/** A named example: `registry/examples/<component>/<name>.tsx` — at most 40 lines, a realistic product scenario. */
|
|
34
|
+
export interface Example {
|
|
35
|
+
/** The file name, kebab-case (`sovereign-answer`). */
|
|
36
|
+
readonly name: string;
|
|
37
|
+
/** A short title (`A sovereign answer`). */
|
|
38
|
+
readonly title: string;
|
|
39
|
+
/** One or two sentences: the situation it shows. */
|
|
40
|
+
readonly description: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface KeyboardInteraction {
|
|
44
|
+
readonly keys: string;
|
|
45
|
+
readonly action: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ComponentMeta {
|
|
49
|
+
/** The display name: `Chat showcase`. */
|
|
50
|
+
readonly title: string;
|
|
51
|
+
/** One sentence: what it is. */
|
|
52
|
+
readonly summary: string;
|
|
53
|
+
/** Why it exists above Krizaka UI: what the primitive alone does not say about Sovkora. */
|
|
54
|
+
readonly why: string;
|
|
55
|
+
readonly status: Status;
|
|
56
|
+
/** Required when `status` is `deprecated`: since when, what replaces it, when it goes. */
|
|
57
|
+
readonly deprecated?: { readonly since: string; readonly use: Reference; readonly removedIn: string };
|
|
58
|
+
readonly category: Category;
|
|
59
|
+
/** The kit's components are web components; the mobile app takes the tokens (`@krizaka/sovkora-shared`). */
|
|
60
|
+
readonly platforms: "web";
|
|
61
|
+
/** The @krizaka/ui components it is built on (`ui/command`): a product component composes, it never copies. */
|
|
62
|
+
readonly builtOn: readonly UiComponent[];
|
|
63
|
+
readonly whenToUse: readonly string[];
|
|
64
|
+
readonly whenNotToUse: readonly { readonly when: string; readonly use?: Reference }[];
|
|
65
|
+
readonly bestPractices: readonly string[];
|
|
66
|
+
readonly accessibility: { readonly keyboard: readonly KeyboardInteraction[]; readonly notes: readonly string[] };
|
|
67
|
+
readonly related: readonly Reference[];
|
|
68
|
+
readonly web: {
|
|
69
|
+
/** The names to import. */
|
|
70
|
+
readonly imports: readonly string[];
|
|
71
|
+
/** The entry they come from: `.` (the package root, the only one). */
|
|
72
|
+
readonly entry?: ".";
|
|
73
|
+
/** The examples, in reading order; the first one is the preview. Empty only for a deprecated component. */
|
|
74
|
+
readonly examples: readonly Example[];
|
|
75
|
+
};
|
|
76
|
+
}
|