@kennycorrea/ui 0.6.1 → 0.7.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.0 — 2026-10-09
4
+
5
+ ### Added
6
+ - **`Alert`**: an inline message with `type` (`info` default, `warning`, `success`, `error`,
7
+ `brand`), `head`, `body`, and optional `actionButton` / `secondaryActionButton`
8
+ (`{ label, onPress }`). Same colours and icons as `Toast`; `brand` uses the info icon in the
9
+ theme's own accent. Errors and warnings are `role="alert"`, the rest `role="status"`.
10
+ - **`Skeleton`** (Themes' skeleton) and **`SkeletonText`** (a `lines`-long paragraph placeholder).
11
+
3
12
  ## 0.6.1 — 2026-10-08
4
13
 
5
14
  ### Fixed
@@ -0,0 +1,19 @@
1
+ export type AlertType = 'info' | 'warning' | 'success' | 'error' | 'brand';
2
+ export interface AlertAction {
3
+ label: string;
4
+ onPress?: () => void;
5
+ }
6
+ export interface AlertProps {
7
+ type?: AlertType;
8
+ head?: string;
9
+ body?: string;
10
+ actionButton?: AlertAction;
11
+ secondaryActionButton?: AlertAction;
12
+ className?: string;
13
+ }
14
+ /**
15
+ * An inline message that stays on the page, unlike a toast. Errors and warnings are
16
+ * `role="alert"` so they are announced when they appear; the rest are `status`, which waits
17
+ * its turn rather than interrupting.
18
+ */
19
+ export declare function Alert({ type, head, body, actionButton, secondaryActionButton, className, }: AlertProps): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../../utils/cn.js';
3
+ import { Button } from '../Button/Button.js';
4
+ import { Icon } from '../Icon/Icon.js';
5
+ /**
6
+ * The same colour and icon vocabulary as `Toast`. `brand` borrows info's glyph but sets no
7
+ * `data-accent-color`, so `--accent-*` is whatever the theme — and the accent picker — say.
8
+ */
9
+ const TYPES = {
10
+ info: { color: 'blue', icon: 'info' },
11
+ warning: { color: 'amber', icon: 'warning' },
12
+ success: { color: 'jade', icon: 'check-circle' },
13
+ error: { color: 'red', icon: 'error' },
14
+ brand: { icon: 'info' },
15
+ };
16
+ /**
17
+ * An inline message that stays on the page, unlike a toast. Errors and warnings are
18
+ * `role="alert"` so they are announced when they appear; the rest are `status`, which waits
19
+ * its turn rather than interrupting.
20
+ */
21
+ export function Alert({ type = 'info', head, body, actionButton, secondaryActionButton, className, }) {
22
+ const { color, icon } = TYPES[type];
23
+ const urgent = type === 'error' || type === 'warning';
24
+ return (_jsxs("div", { role: urgent ? 'alert' : 'status', "data-accent-color": color, "data-alert-type": type, className: cn('flex gap-3 rounded-[var(--radius-3)] border border-[var(--accent-6)] bg-[var(--accent-3)] p-4 text-[var(--gray-12)]', className), children: [_jsx(Icon, { name: icon, className: "mt-0.5 text-[var(--accent-11)]" }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [head && _jsx("p", { className: "font-medium", children: head }), body && _jsx("p", { className: "text-sm text-[var(--gray-11)]", children: body }), (actionButton || secondaryActionButton) && (_jsxs("div", { className: "mt-2 flex flex-wrap gap-2", children: [actionButton && (_jsx(Button, { size: "sm", variant: "primary", onClick: actionButton.onPress, children: actionButton.label })), secondaryActionButton && (_jsx(Button, { size: "sm", variant: "ghost", onClick: secondaryActionButton.onPress, children: secondaryActionButton.label }))] }))] })] }));
25
+ }
@@ -0,0 +1 @@
1
+ export * from './Alert.js';
@@ -0,0 +1 @@
1
+ export * from './Alert.js';
@@ -0,0 +1,19 @@
1
+ import { Skeleton as ThemedSkeleton } from '@radix-ui/themes';
2
+ import type { ComponentPropsWithoutRef } from 'react';
3
+ export interface SkeletonProps extends ComponentPropsWithoutRef<typeof ThemedSkeleton> {
4
+ }
5
+ /**
6
+ * Themes' skeleton, re-exported under the house name.
7
+ *
8
+ * Two ways to use it, both Themes': wrap real content with `loading` and it takes that
9
+ * content's shape, or give it a `width`/`height` and it stands alone. Wrapping is the better
10
+ * one — the placeholder is then exactly the size of what replaces it, so nothing jumps.
11
+ */
12
+ export declare function Skeleton({ className, ...props }: SkeletonProps): import("react").JSX.Element;
13
+ export interface SkeletonTextProps {
14
+ /** How many lines to draw. The last one is shorter, as a paragraph's is. */
15
+ lines?: number;
16
+ className?: string;
17
+ }
18
+ /** A paragraph-shaped placeholder, for where the text's length is not known yet. */
19
+ export declare function SkeletonText({ lines, className }: SkeletonTextProps): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Skeleton as ThemedSkeleton } from '@radix-ui/themes';
3
+ import { cn } from '../../utils/cn.js';
4
+ /**
5
+ * Themes' skeleton, re-exported under the house name.
6
+ *
7
+ * Two ways to use it, both Themes': wrap real content with `loading` and it takes that
8
+ * content's shape, or give it a `width`/`height` and it stands alone. Wrapping is the better
9
+ * one — the placeholder is then exactly the size of what replaces it, so nothing jumps.
10
+ */
11
+ export function Skeleton({ className, ...props }) {
12
+ return _jsx(ThemedSkeleton, { className: cn(className), ...props });
13
+ }
14
+ /** A paragraph-shaped placeholder, for where the text's length is not known yet. */
15
+ export function SkeletonText({ lines = 3, className }) {
16
+ return (_jsx("div", { className: cn('flex flex-col gap-2', className), "aria-hidden": true, children: Array.from({ length: lines }, (_, i) => i).map((i) => (_jsx(ThemedSkeleton, { height: "0.875rem", width: i === lines - 1 && lines > 1 ? '60%' : '100%' }, i))) }));
17
+ }
@@ -0,0 +1 @@
1
+ export * from './Skeleton.js';
@@ -0,0 +1 @@
1
+ export * from './Skeleton.js';
@@ -1,3 +1,4 @@
1
+ export * from './Alert/index.js';
1
2
  export * from './Avatar/index.js';
2
3
  export * from './Badge/index.js';
3
4
  export * from './Button/index.js';
@@ -13,6 +14,7 @@ export * from './Progress/index.js';
13
14
  export * from './RichText/index.js';
14
15
  export * from './Select/index.js';
15
16
  export * from './Separator/index.js';
17
+ export * from './Skeleton/index.js';
16
18
  export * from './Slider/index.js';
17
19
  export * from './Spinner/index.js';
18
20
  export * from './Switch/index.js';
@@ -1,3 +1,4 @@
1
+ export * from './Alert/index.js';
1
2
  export * from './Avatar/index.js';
2
3
  export * from './Badge/index.js';
3
4
  export * from './Button/index.js';
@@ -13,6 +14,7 @@ export * from './Progress/index.js';
13
14
  export * from './RichText/index.js';
14
15
  export * from './Select/index.js';
15
16
  export * from './Separator/index.js';
17
+ export * from './Skeleton/index.js';
16
18
  export * from './Slider/index.js';
17
19
  export * from './Spinner/index.js';
18
20
  export * from './Switch/index.js';
@@ -97,5 +97,5 @@ export interface Theming<A extends readonly string[]> {
97
97
  export declare function createTheming<const A extends readonly [string, ...string[]]>(config: ThemingConfig<A>): Theming<A>;
98
98
  export declare const readTheme: () => Theme;
99
99
  export declare const storeTheme: (theme: Theme) => void;
100
- export declare const readAccent: () => "jade" | "red" | "yellow" | "orange" | "purple" | "blue";
101
- export declare const storeAccent: (accent: "jade" | "red" | "yellow" | "orange" | "purple" | "blue") => void;
100
+ export declare const readAccent: () => "red" | "yellow" | "orange" | "purple" | "blue" | "jade";
101
+ export declare const storeAccent: (accent: "red" | "yellow" | "orange" | "purple" | "blue" | "jade") => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kennycorrea/ui",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "Upfront's house component layer: atoms over Radix Themes, the token bridge, and the accent logic.",
5
5
  "private": false,
6
6
  "type": "module",