@ponti-studios/ui 0.1.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/README.md +27 -0
- package/dist/index.js +2118 -0
- package/dist/index.js.map +1 -0
- package/package.json +130 -0
- package/src/animations.css +437 -0
- package/src/components/data-display/accordion.stories.tsx +57 -0
- package/src/components/data-display/accordion.tsx +65 -0
- package/src/components/data-display/filter-chip.tsx +41 -0
- package/src/components/data-display/index.ts +13 -0
- package/src/components/data-display/table.stories.tsx +75 -0
- package/src/components/data-display/table.tsx +84 -0
- package/src/components/feedback/alert.stories.tsx +51 -0
- package/src/components/feedback/alert.tsx +60 -0
- package/src/components/feedback/empty-state.tsx +66 -0
- package/src/components/feedback/index.ts +6 -0
- package/src/components/feedback/progress.stories.tsx +37 -0
- package/src/components/feedback/progress.tsx +30 -0
- package/src/components/feedback/spinner.stories.tsx +52 -0
- package/src/components/feedback/spinner.tsx +48 -0
- package/src/components/forms/calendar.stories.tsx +30 -0
- package/src/components/forms/calendar.tsx +67 -0
- package/src/components/forms/date-picker.stories.tsx +48 -0
- package/src/components/forms/date-picker.tsx +60 -0
- package/src/components/forms/field.stories.tsx +62 -0
- package/src/components/forms/field.tsx +65 -0
- package/src/components/forms/field.types.ts +7 -0
- package/src/components/forms/index.ts +24 -0
- package/src/components/forms/input.stories.tsx +47 -0
- package/src/components/forms/input.tsx +20 -0
- package/src/components/forms/radio-group.stories.tsx +48 -0
- package/src/components/forms/radio-group.tsx +38 -0
- package/src/components/forms/select.stories.tsx +88 -0
- package/src/components/forms/select.tsx +147 -0
- package/src/components/forms/slider.stories.tsx +67 -0
- package/src/components/forms/slider.tsx +25 -0
- package/src/components/forms/stepper.stories.tsx +111 -0
- package/src/components/forms/stepper.tsx +66 -0
- package/src/components/forms/switch.stories.tsx +144 -0
- package/src/components/forms/switch.tsx +36 -0
- package/src/components/forms/text-field.stories.tsx +87 -0
- package/src/components/forms/text-field.tsx +40 -0
- package/src/components/forms/text-field.types.ts +9 -0
- package/src/components/forms/textarea.stories.tsx +150 -0
- package/src/components/forms/textarea.tsx +18 -0
- package/src/components/layout/index.ts +2 -0
- package/src/components/layout/scroll-area.stories.tsx +83 -0
- package/src/components/layout/scroll-area.tsx +40 -0
- package/src/components/navigation/app-navigation.stories.tsx +81 -0
- package/src/components/navigation/app-navigation.tsx +155 -0
- package/src/components/navigation/index.ts +3 -0
- package/src/components/navigation/tabs.stories.tsx +69 -0
- package/src/components/navigation/tabs.tsx +49 -0
- package/src/components/overlays/alert-dialog.stories.tsx +45 -0
- package/src/components/overlays/alert-dialog.tsx +119 -0
- package/src/components/overlays/command.stories.tsx +65 -0
- package/src/components/overlays/command.tsx +130 -0
- package/src/components/overlays/dialog.stories.tsx +111 -0
- package/src/components/overlays/dialog.tsx +162 -0
- package/src/components/overlays/dropdown-menu.stories.tsx +79 -0
- package/src/components/overlays/dropdown-menu.tsx +214 -0
- package/src/components/overlays/index.ts +65 -0
- package/src/components/overlays/popover.stories.tsx +39 -0
- package/src/components/overlays/popover.tsx +40 -0
- package/src/components/overlays/sheet.stories.tsx +68 -0
- package/src/components/overlays/sheet.tsx +98 -0
- package/src/components/primitives/avatar.stories.tsx +71 -0
- package/src/components/primitives/avatar.tsx +132 -0
- package/src/components/primitives/badge.stories.tsx +33 -0
- package/src/components/primitives/badge.tsx +44 -0
- package/src/components/primitives/button.stories.tsx +113 -0
- package/src/components/primitives/button.tsx +95 -0
- package/src/components/primitives/button.types.ts +10 -0
- package/src/components/primitives/card.stories.tsx +59 -0
- package/src/components/primitives/card.tsx +69 -0
- package/src/components/primitives/index.ts +13 -0
- package/src/components/primitives/label.stories.tsx +47 -0
- package/src/components/primitives/label.tsx +21 -0
- package/src/constants/chart-colors.ts +39 -0
- package/src/env.d.ts +9 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/sort.types.ts +12 -0
- package/src/hooks/use-api-client.ts +122 -0
- package/src/hooks/use-debounced-value.ts +12 -0
- package/src/hooks/use-filter-state.ts +68 -0
- package/src/hooks/use-media-query.ts +65 -0
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/index.ts +25 -0
- package/src/lib/auth.ts +5 -0
- package/src/lib/clipboard.ts +8 -0
- package/src/lib/create-memory-storage.ts +24 -0
- package/src/lib/index.ts +4 -0
- package/src/lib/utils.ts +6 -0
- package/src/storybook/controls.ts +117 -0
- package/src/storybook/options.ts +52 -0
- package/src/styles.css +1052 -0
- package/src/tokens/color-systems.stories.tsx +133 -0
- package/src/tokens/colors.ts +156 -0
- package/src/tokens/foundations.stories.tsx +151 -0
- package/src/tokens/index.ts +16 -0
- package/src/tokens/layout.stories.tsx +118 -0
- package/src/tokens/motion.ts +51 -0
- package/src/tokens/radii.ts +10 -0
- package/src/tokens/shadows.ts +34 -0
- package/src/tokens/spacing.ts +30 -0
- package/src/tokens/typography.ts +42 -0
- package/src/translations/en.ts +34 -0
- package/src/translations/index.ts +32 -0
- package/src/types/upload.ts +42 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spacing tokens — 8px primary grid, 4px secondary.
|
|
3
|
+
*
|
|
4
|
+
* Values are unitless numbers (px on web via CSS vars, logical pixels on
|
|
5
|
+
* mobile). Must match --spacing-* in packages/ui/src/styles.css.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const spacing = {
|
|
9
|
+
1: 4,
|
|
10
|
+
2: 8,
|
|
11
|
+
3: 12,
|
|
12
|
+
4: 16,
|
|
13
|
+
5: 24,
|
|
14
|
+
6: 32,
|
|
15
|
+
7: 48,
|
|
16
|
+
8: 64,
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Content width tokens for constraining max-width of content.
|
|
21
|
+
* Used for message bubbles, transcript areas, and other content containers.
|
|
22
|
+
*/
|
|
23
|
+
export const contentWidths = {
|
|
24
|
+
bubble: "36rem", // Compact message bubble width (576px)
|
|
25
|
+
transcript: "44rem", // Standard transcript/content width (704px)
|
|
26
|
+
notePreview: "32ch", // Empty-state note preview width
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
export type SpacingToken = keyof typeof spacing;
|
|
30
|
+
export type ContentWidthToken = keyof typeof contentWidths;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const fontFamilies = {
|
|
2
|
+
primary: "-apple-system, BlinkMacSystemFont, system-ui, sans-serif",
|
|
3
|
+
mono: "ui-monospace, monospace",
|
|
4
|
+
} as const;
|
|
5
|
+
|
|
6
|
+
export const fontSizes = {
|
|
7
|
+
micro: 10,
|
|
8
|
+
caption2: 11,
|
|
9
|
+
caption1: 12,
|
|
10
|
+
footnote: 13,
|
|
11
|
+
xs: 12,
|
|
12
|
+
sm: 14,
|
|
13
|
+
subhead: 15,
|
|
14
|
+
md: 16,
|
|
15
|
+
body: 17,
|
|
16
|
+
lg: 18,
|
|
17
|
+
xl: 20,
|
|
18
|
+
headline: 17,
|
|
19
|
+
display: 28,
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
export const fontWeights = {
|
|
23
|
+
regular: "400",
|
|
24
|
+
medium: "500",
|
|
25
|
+
semibold: "600",
|
|
26
|
+
bold: "700",
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
export const lineHeights = {
|
|
30
|
+
tight: 1.2,
|
|
31
|
+
normal: 1.4,
|
|
32
|
+
relaxed: 1.6,
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
export const letterSpacing = {
|
|
36
|
+
tight: -0.05,
|
|
37
|
+
normal: 0,
|
|
38
|
+
relaxed: 0.01,
|
|
39
|
+
} as const;
|
|
40
|
+
|
|
41
|
+
export type FontSizeToken = keyof typeof fontSizes;
|
|
42
|
+
export type FontWeightToken = keyof typeof fontWeights;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const UI_TRANSLATIONS_EN = {
|
|
2
|
+
auth: {
|
|
3
|
+
emailEntry: {
|
|
4
|
+
title: "Sign in",
|
|
5
|
+
helper: "Enter your email to continue.",
|
|
6
|
+
emailPlaceholder: "you@example.com",
|
|
7
|
+
emailLabel: "Email address",
|
|
8
|
+
submitButton: "Continue",
|
|
9
|
+
submitButtonLoading: "Sending...",
|
|
10
|
+
passkeyButton: "Use passkey",
|
|
11
|
+
passkeyLoadingButton: "Connecting...",
|
|
12
|
+
emailRequiredError: "Email is required.",
|
|
13
|
+
emailInvalidError: "Enter a valid email address.",
|
|
14
|
+
sendFailedError: "Unable to send verification code.",
|
|
15
|
+
},
|
|
16
|
+
otpVerification: {
|
|
17
|
+
title: "Verify",
|
|
18
|
+
helper: "Code sent to {{email}}.",
|
|
19
|
+
codeLabel: "Verification code",
|
|
20
|
+
verifyButton: "Verify",
|
|
21
|
+
verifyButtonLoading: "Verifying...",
|
|
22
|
+
resendButton: "Resend code",
|
|
23
|
+
resendButtonLoading: "Resending...",
|
|
24
|
+
changeEmailLink: "Use a different email",
|
|
25
|
+
codeRequiredError: "Code is required.",
|
|
26
|
+
codeLengthError: "Code must be 6 digits.",
|
|
27
|
+
verifyFailedError: "There was a problem signing in. Our team is working on it.",
|
|
28
|
+
resendFailedError: "Unable to resend verification code.",
|
|
29
|
+
},
|
|
30
|
+
passkey: {
|
|
31
|
+
genericError: "Passkey sign-in failed.",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} as const;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { UI_TRANSLATIONS_EN } from "./en";
|
|
2
|
+
|
|
3
|
+
type TranslationValue = string | number | boolean;
|
|
4
|
+
type TranslationOptions = Record<string, TranslationValue>;
|
|
5
|
+
|
|
6
|
+
function getTranslationValue(key: string): unknown {
|
|
7
|
+
return key.split(".").reduce<unknown>((value, part) => {
|
|
8
|
+
if (value && typeof value === "object" && part in value) {
|
|
9
|
+
return (value as Record<string, unknown>)[part];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return undefined;
|
|
13
|
+
}, UI_TRANSLATIONS_EN);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function registerUiTranslations() {
|
|
17
|
+
return UI_TRANSLATIONS_EN;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function translateUi(key: string, options?: TranslationOptions) {
|
|
21
|
+
const value = getTranslationValue(key);
|
|
22
|
+
if (typeof value !== "string") {
|
|
23
|
+
return key;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return value.replace(/{{\s*([a-zA-Z0-9_]+)\s*}}/g, (_, token: string) => {
|
|
27
|
+
const replacement = options?.[token];
|
|
28
|
+
return replacement === undefined ? "" : String(replacement);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { UI_TRANSLATIONS_EN };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// File Processing Types
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Processed file from server-side file processing
|
|
7
|
+
*/
|
|
8
|
+
interface ProcessedFile {
|
|
9
|
+
id: string;
|
|
10
|
+
originalName: string;
|
|
11
|
+
type: "image" | "document" | "audio" | "video" | "unknown";
|
|
12
|
+
mimetype: string;
|
|
13
|
+
size: number;
|
|
14
|
+
content?: string;
|
|
15
|
+
textContent?: string;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
thumbnail?: string;
|
|
18
|
+
duration?: number;
|
|
19
|
+
transcription?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Successfully uploaded file (API response)
|
|
24
|
+
*/
|
|
25
|
+
export interface UploadedFile extends ProcessedFile {
|
|
26
|
+
url: string;
|
|
27
|
+
uploadedAt: Date;
|
|
28
|
+
vectorIds?: string[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface FailedUpload {
|
|
32
|
+
name: string;
|
|
33
|
+
error: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface UploadResponse {
|
|
37
|
+
success: boolean;
|
|
38
|
+
files: UploadedFile[];
|
|
39
|
+
failed: FailedUpload[];
|
|
40
|
+
message: string;
|
|
41
|
+
error?: string;
|
|
42
|
+
}
|