@jztack/ui 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.
- package/README.md +82 -2
- package/dist/components/alert.d.ts +25 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +40 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/app-shell.d.ts +64 -0
- package/dist/components/app-shell.d.ts.map +1 -0
- package/dist/components/app-shell.js +33 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/avatar.d.ts +12 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +23 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +42 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +113 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/button.d.ts +30 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +57 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/card.d.ts +28 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +54 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/checkbox.d.ts +5 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +10 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/confirm-action-modal.d.ts +49 -0
- package/dist/components/confirm-action-modal.d.ts.map +1 -0
- package/dist/components/confirm-action-modal.js +88 -0
- package/dist/components/confirm-action-modal.js.map +1 -0
- package/dist/components/delete-button.d.ts +26 -0
- package/dist/components/delete-button.d.ts.map +1 -0
- package/dist/components/delete-button.js +36 -0
- package/dist/components/delete-button.js.map +1 -0
- package/dist/components/dialog.d.ts +22 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +38 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +30 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +88 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty-state.d.ts +20 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +8 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/error-boundary.d.ts +39 -0
- package/dist/components/error-boundary.d.ts.map +1 -0
- package/dist/components/error-boundary.js +57 -0
- package/dist/components/error-boundary.js.map +1 -0
- package/dist/components/form-field.d.ts +78 -0
- package/dist/components/form-field.d.ts.map +1 -0
- package/dist/components/form-field.js +56 -0
- package/dist/components/form-field.js.map +1 -0
- package/dist/components/input.d.ts +9 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +12 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.d.ts +5 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +8 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/page-header.d.ts +23 -0
- package/dist/components/page-header.d.ts.map +1 -0
- package/dist/components/page-header.js +10 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/progress.d.ts +5 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +13 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +6 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +11 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/scroll-area.d.ts +6 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +11 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +44 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +5 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +9 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +46 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +58 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.d.ts +3 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +7 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/sonner.d.ts +29 -0
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +28 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/switch.d.ts +20 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +15 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +11 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +28 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/textarea.d.ts +4 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +7 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toggle-group.d.ts +11 -0
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +24 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +15 -0
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +30 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.d.ts +8 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +17 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/haptics.d.ts +38 -0
- package/dist/haptics.d.ts.map +1 -0
- package/dist/haptics.js +64 -0
- package/dist/haptics.js.map +1 -0
- package/dist/hooks/useClickOpenDisclosure.d.ts +19 -0
- package/dist/hooks/useClickOpenDisclosure.d.ts.map +1 -0
- package/dist/hooks/useClickOpenDisclosure.js +77 -0
- package/dist/hooks/useClickOpenDisclosure.js.map +1 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +15 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles.css +157 -0
- package/package.json +56 -3
package/README.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @jztack/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The shared web component library for the jztack fleet — the 24 primitives
|
|
4
|
+
Tabbie proved in production, cleaned to the semantic token contract, plus
|
|
5
|
+
the Tier-2 compositions the fleet apps each hand-rolled (AppShell,
|
|
6
|
+
ConfirmActionModal, DeleteButton, the FormField family, PageHeader,
|
|
7
|
+
EmptyState, ErrorBoundary). The React Native twin is `@jztack/ui-native`;
|
|
8
|
+
tokens live in `@jztack/tokens`. All three packages are co-versioned on
|
|
9
|
+
one release train.
|
|
10
|
+
|
|
11
|
+
## Consumer contract
|
|
12
|
+
|
|
13
|
+
Three steps — this is the whole integration:
|
|
14
|
+
|
|
15
|
+
1. **Install** `@jztack/ui` (peers: `react` 19, `tailwindcss` 4,
|
|
16
|
+
`radix-ui`, `lucide-react`, `sonner`).
|
|
17
|
+
2. **One CSS import line** in your global stylesheet:
|
|
18
|
+
|
|
19
|
+
```css
|
|
20
|
+
@import '@jztack/ui/styles.css';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
It pulls in Tailwind 4, the tokens themes, and the animation
|
|
24
|
+
utilities, and maps the token variables to Tailwind utilities.
|
|
25
|
+
3. **Set `data-theme` on your root element** (`tabbie`, `commonboard`,
|
|
26
|
+
`wedding-ops`, `rentproof`, `twjs`), plus the `dark` class where the
|
|
27
|
+
theme has a dark mode. Brand theming is entirely the token layer's —
|
|
28
|
+
components never branch on theme.
|
|
29
|
+
|
|
30
|
+
Optionally mount `<Toaster />` once (sonner) and enable haptics:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { configureHaptics } from '@jztack/ui';
|
|
34
|
+
|
|
35
|
+
// Fleet-wide standard (Justin's decision, Dec 4, 2026): the haptics
|
|
36
|
+
// engine is enabled in every touch app with the shared pattern set.
|
|
37
|
+
// Per-component firing stays opt-in (Button/Switch `haptic` prop,
|
|
38
|
+
// default false).
|
|
39
|
+
configureHaptics({ enabled: true });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## The standards baked in
|
|
43
|
+
|
|
44
|
+
- **48px targets by default.** Button default is `h-12`, icon `size-12`;
|
|
45
|
+
Input/Select are `min-h-12` with `text-base` (16px — no iOS focus
|
|
46
|
+
zoom). The shadcn dense sizes (`sm`/`xs`, 36px and below) survive as
|
|
47
|
+
**documented `dense` escape hatches** for desktop-dense, mouse-driven
|
|
48
|
+
surfaces only — never on touch surfaces.
|
|
49
|
+
- **Card default is `raised`** in light themes; `glass` is an opt-in
|
|
50
|
+
variant in every theme (dark themes' glass recipe is the same code
|
|
51
|
+
path — theme _values_ differ, components don't branch).
|
|
52
|
+
- **Destructive actions have exactly two sanctioned shapes:**
|
|
53
|
+
`DeleteButton` (two-step inline confirm) for row-level deletes, and
|
|
54
|
+
`ConfirmActionModal` for high-impact or irreversible actions. No
|
|
55
|
+
per-app improvisation.
|
|
56
|
+
- **Status colours are token triples** (`success`/`warning`/`danger`/
|
|
57
|
+
`info` × DEFAULT/BG/FOREGROUND). Badge's subtle-accent appearance
|
|
58
|
+
consumes the canonical `accent-bg`/`accent-border` token slots (P4).
|
|
59
|
+
- **No dictionary in the library.** All user-visible copy arrives via
|
|
60
|
+
props/children, so TH/EN (and Burmese on the native twin) stay
|
|
61
|
+
app-owned. The few built-in strings are accessibility labels with
|
|
62
|
+
override props (`closeLabel`, `accessibleTitle`, …).
|
|
63
|
+
|
|
64
|
+
## Components
|
|
65
|
+
|
|
66
|
+
Primitives (24): Alert, Avatar, Badge, Button, Card, Checkbox, Dialog,
|
|
67
|
+
DropdownMenu, Input, Label, Progress, RadioGroup, ScrollArea, Select,
|
|
68
|
+
Separator, Sheet (one responsive pattern — bottom sheet on phone,
|
|
69
|
+
centered dialog ≥768px), Skeleton, Switch, Table, Textarea, Toggle,
|
|
70
|
+
ToggleGroup, Tooltip, Toaster.
|
|
71
|
+
|
|
72
|
+
Tier-2: AppShell (router-agnostic shell; nav items as data +
|
|
73
|
+
`renderNavLink`), ConfirmActionModal, DeleteButton, EmptyState,
|
|
74
|
+
ErrorBoundary, Field / TextField / SelectField / TextAreaField /
|
|
75
|
+
CheckboxField / FormError / FormPanel / FormActions, PageHeader /
|
|
76
|
+
SectionHeading.
|
|
77
|
+
|
|
78
|
+
Utilities: `cn`, `onDialogOpenChange`, the haptics engine
|
|
79
|
+
(`configureHaptics`, `triggerHaptic`, `HapticPattern`), the vendored
|
|
80
|
+
`useClickOpenDisclosure` hook, and `toast` re-exported from sonner.
|
|
81
|
+
|
|
82
|
+
Parked past v1 (decisions pending): options-array ToggleGroup (P1), a
|
|
83
|
+
shared SegmentedControl (P2), a Field `warning` state (P3).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Alert with the full status-tone set (DESIGN.md §2.6): Tabbie shipped
|
|
5
|
+
* default | destructive only; the fleet needs success/warning/info too
|
|
6
|
+
* (RentProof's ReadOnlyBanner and Wedding Ops' FormError are hand-rolled
|
|
7
|
+
* versions of these). Tones colour from the same contract status triples
|
|
8
|
+
* as Badge. `variant` is kept as a deprecated alias of `tone` so Tabbie's
|
|
9
|
+
* call sites port without a rename: destructive → danger.
|
|
10
|
+
*/
|
|
11
|
+
declare const alertVariants: (props?: ({
|
|
12
|
+
tone?: "danger" | "default" | "info" | "success" | "warning" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
|
+
export type AlertTone = NonNullable<VariantProps<typeof alertVariants>['tone']>;
|
|
15
|
+
export interface AlertProps extends React.ComponentProps<'div'> {
|
|
16
|
+
tone?: AlertTone;
|
|
17
|
+
/** Deprecated alias kept for Tabbie's call sites: 'destructive' = danger. */
|
|
18
|
+
variant?: 'default' | 'destructive';
|
|
19
|
+
}
|
|
20
|
+
declare function Alert({ className, tone, variant, ...props }: AlertProps): React.JSX.Element;
|
|
21
|
+
declare function AlertTitle({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
22
|
+
declare function AlertDescription({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
23
|
+
declare function AlertAction({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
24
|
+
export { Alert, AlertAction, AlertDescription, AlertTitle, alertVariants };
|
|
25
|
+
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/components/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAIpC;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa;;8EAmBlB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhF,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC7D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;CACrC;AAED,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,qBAWhE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWvE;AAED,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW7E;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAIxE;AAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Alert with the full status-tone set (DESIGN.md §2.6): Tabbie shipped
|
|
6
|
+
* default | destructive only; the fleet needs success/warning/info too
|
|
7
|
+
* (RentProof's ReadOnlyBanner and Wedding Ops' FormError are hand-rolled
|
|
8
|
+
* versions of these). Tones colour from the same contract status triples
|
|
9
|
+
* as Badge. `variant` is kept as a deprecated alias of `tone` so Tabbie's
|
|
10
|
+
* call sites port without a rename: destructive → danger.
|
|
11
|
+
*/
|
|
12
|
+
const alertVariants = cva("group/alert relative grid w-full gap-0.5 rounded-xl border px-3 py-2.5 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-')]:size-4", {
|
|
13
|
+
variants: {
|
|
14
|
+
tone: {
|
|
15
|
+
default: 'bg-card text-card-foreground',
|
|
16
|
+
success: 'border-success/30 bg-success-bg text-success-foreground *:data-[slot=alert-description]:text-success-foreground/90',
|
|
17
|
+
warning: 'border-warning/30 bg-warning-bg text-warning-foreground *:data-[slot=alert-description]:text-warning-foreground/90',
|
|
18
|
+
danger: 'border-danger/30 bg-danger-bg text-danger-foreground *:data-[slot=alert-description]:text-danger-foreground/90',
|
|
19
|
+
info: 'border-info/30 bg-info-bg text-info-foreground *:data-[slot=alert-description]:text-info-foreground/90',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
tone: 'default',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
function Alert({ className, tone, variant, ...props }) {
|
|
27
|
+
const resolvedTone = tone ?? (variant === 'destructive' ? 'danger' : 'default');
|
|
28
|
+
return (_jsx("div", { "data-slot": "alert", "data-tone": resolvedTone, role: "alert", className: cn(alertVariants({ tone: resolvedTone }), className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function AlertTitle({ className, ...props }) {
|
|
31
|
+
return (_jsx("div", { "data-slot": "alert-title", className: cn('font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground', className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function AlertDescription({ className, ...props }) {
|
|
34
|
+
return (_jsx("div", { "data-slot": "alert-description", className: cn('text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4', className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
function AlertAction({ className, ...props }) {
|
|
37
|
+
return (_jsx("div", { "data-slot": "alert-action", className: cn('absolute top-2 right-2', className), ...props }));
|
|
38
|
+
}
|
|
39
|
+
export { Alert, AlertAction, AlertDescription, AlertTitle, alertVariants };
|
|
40
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../src/components/alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,GAAG,CACvB,0TAA0T,EAC1T;IACE,QAAQ,EAAE;Q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AAgB,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* AppShell (DESIGN.md §3.1) — absorbs the three hand-written fleet shells
|
|
5
|
+
* (CommonBoard / Wedding Ops / RentProof Layout.tsx), which are one shape:
|
|
6
|
+
* brand header + fixed-height status strip + max-w-3xl column + bottom
|
|
7
|
+
* nav. Tabbie does not adopt AppShell in v1 (its shell is dock-based and
|
|
8
|
+
* domain-shaped).
|
|
9
|
+
*
|
|
10
|
+
* The shell is router-agnostic: it renders no router components. Nav items
|
|
11
|
+
* are data; the app supplies link rendering via `renderNavLink` and owns
|
|
12
|
+
* route matching (`activeKey`) — the fleet spans react-router and
|
|
13
|
+
* react-router-dom. The shell provides each link's className and content
|
|
14
|
+
* (icon + label + badge) for the context (bottom nav on phone, top nav
|
|
15
|
+
* row at ≥768px); the app wraps them in its router link.
|
|
16
|
+
*
|
|
17
|
+
* Auth/session logic, online/offline listeners, sign-out handlers, and
|
|
18
|
+
* data contexts stay in the app — the shell receives their results
|
|
19
|
+
* through the slots. Fixed behaviours are ported from the three sources:
|
|
20
|
+
* fixed h-7 status bar (role="status", no layout shift), safe-area-aware
|
|
21
|
+
* bottom nav with ≥48px targets, content clearance via
|
|
22
|
+
* --shell-bottom-clearance (consumed by the Toaster), exactly one scroll
|
|
23
|
+
* container.
|
|
24
|
+
*/
|
|
25
|
+
export interface ShellNavItem {
|
|
26
|
+
key: string;
|
|
27
|
+
label: string;
|
|
28
|
+
/** Bottom-nav label; falls back to `label`. */
|
|
29
|
+
shortLabel?: string;
|
|
30
|
+
/** Required — text-only nav is not the standard. */
|
|
31
|
+
icon: LucideIcon;
|
|
32
|
+
/** Optional count/dot on the icon. */
|
|
33
|
+
badge?: number | string;
|
|
34
|
+
}
|
|
35
|
+
export interface ShellNavLinkState {
|
|
36
|
+
isActive: boolean;
|
|
37
|
+
variant: 'bottom' | 'top';
|
|
38
|
+
/** Classes for the router link element, computed by the shell. */
|
|
39
|
+
className: string;
|
|
40
|
+
/** Icon + label (+ badge) markup for inside the link. */
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
export interface AppShellProps {
|
|
44
|
+
/** Header start: app name / logo. */
|
|
45
|
+
appName: React.ReactNode;
|
|
46
|
+
/** Header end: sign-out, language toggle, … */
|
|
47
|
+
headerActions?: React.ReactNode;
|
|
48
|
+
/** Slot under the header row (association/wedding switcher, role strip). */
|
|
49
|
+
switcher?: React.ReactNode;
|
|
50
|
+
/** Status strip content; the shell wraps it in role="status". */
|
|
51
|
+
statusBar?: React.ReactNode;
|
|
52
|
+
navItems: ShellNavItem[];
|
|
53
|
+
renderNavLink: (item: ShellNavItem, state: ShellNavLinkState) => React.ReactNode;
|
|
54
|
+
activeKey: string;
|
|
55
|
+
/** The fleet column; only value in v1. */
|
|
56
|
+
maxWidth?: '3xl';
|
|
57
|
+
/** aria-label for both nav landmarks. */
|
|
58
|
+
navLabel?: string;
|
|
59
|
+
className?: string;
|
|
60
|
+
children: React.ReactNode;
|
|
61
|
+
}
|
|
62
|
+
declare function AppShell({ appName, headerActions, switcher, statusBar, navItems, renderNavLink, activeKey, navLabel, className, children, }: AppShellProps): React.JSX.Element;
|
|
63
|
+
export { AppShell };
|
|
64
|
+
//# sourceMappingURL=app-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../../src/components/app-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,+C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|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
function navLinkContent(item, variant, isActive) {
|
|
5
|
+
const Icon = item.icon;
|
|
6
|
+
if (variant === 'top') {
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx(Icon, { className: "size-5", "aria-hidden": true }), _jsx("span", { children: item.label }), item.badge !== undefined ? (_jsx("span", { className: "inline-flex min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[11px] font-semibold text-destructive-foreground", children: item.badge })) : null] }));
|
|
8
|
+
}
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsxs("span", { className: cn('relative flex items-center justify-center rounded-full px-3 py-0.5', isActive && 'bg-accent-bg'), children: [_jsx(Icon, { className: "h-[22px] w-[22px]", "aria-hidden": true }), item.badge !== undefined ? (_jsx("span", { className: "absolute -top-1 -right-1 inline-flex min-w-4 items-center justify-center rounded-full bg-destructive px-0.5 text-[10px] font-semibold text-destructive-foreground", children: item.badge })) : null] }), _jsx("span", { children: item.shortLabel ?? item.label })] }));
|
|
10
|
+
}
|
|
11
|
+
function AppShell({ appName, headerActions, switcher, statusBar, navItems, renderNavLink, activeKey, navLabel = 'Primary', className, children, }) {
|
|
12
|
+
return (_jsxs("div", { "data-slot": "app-shell", className: cn('min-h-screen bg-background text-foreground', className), style: { '--shell-bottom-clearance': '4rem' }, children: [_jsxs("header", { className: "sticky top-0 z-40 bg-primary text-primary-foreground", children: [_jsxs("div", { className: "mx-auto flex min-h-14 max-w-3xl items-center justify-between gap-2 px-4", children: [_jsx("div", { className: "flex items-center gap-2 font-semibold", children: appName }), headerActions ? _jsx("div", { className: "flex items-center", children: headerActions }) : null] }), _jsx("nav", { "aria-label": navLabel, className: "hidden tablet:block", children: _jsx("div", { className: "mx-auto flex max-w-3xl items-center gap-1 px-4 pb-2", children: navItems.map((item) => {
|
|
13
|
+
const isActive = item.key === activeKey;
|
|
14
|
+
return (_jsx(React.Fragment, { children: renderNavLink(item, {
|
|
15
|
+
isActive,
|
|
16
|
+
variant: 'top',
|
|
17
|
+
className: cn('flex min-h-12 items-center gap-2 rounded-lg px-3 text-sm', isActive
|
|
18
|
+
? 'bg-primary-foreground/15 font-semibold'
|
|
19
|
+
: 'opacity-80 hover:opacity-100'),
|
|
20
|
+
children: navLinkContent(item, 'top', isActive),
|
|
21
|
+
}) }, item.key));
|
|
22
|
+
}) }) }), switcher ? _jsx("div", { className: "mx-auto max-w-3xl px-4 pb-2", children: switcher }) : null, statusBar ? (_jsx("div", { role: "status", className: "flex h-7 items-center justify-center gap-2 bg-[color-mix(in_oklch,var(--primary),black_18%)] px-4 text-center text-xs", children: statusBar })) : null] }), _jsx("main", { className: "mx-auto max-w-3xl px-4 pt-4 pb-28 tablet:pb-10", children: children }), _jsx("nav", { "aria-label": navLabel, className: "fixed inset-x-0 bottom-0 z-40 border-t border-border bg-card pb-[env(safe-area-inset-bottom)] tablet:hidden", children: _jsx("div", { className: "mx-auto flex max-w-3xl", children: navItems.map((item) => {
|
|
23
|
+
const isActive = item.key === activeKey;
|
|
24
|
+
return (_jsx("div", { className: "flex flex-1", children: renderNavLink(item, {
|
|
25
|
+
isActive,
|
|
26
|
+
variant: 'bottom',
|
|
27
|
+
className: cn('flex min-h-16 flex-1 flex-col items-center justify-center gap-0.5 px-1 text-center text-xs', isActive ? 'font-semibold text-primary' : 'text-muted-foreground'),
|
|
28
|
+
children: navLinkContent(item, 'bottom', isActive),
|
|
29
|
+
}) }, item.key));
|
|
30
|
+
}) }) })] }));
|
|
31
|
+
}
|
|
32
|
+
export { AppShell };
|
|
33
|
+
//# sourceMappingURL=app-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-shell.js","sourceRoot":"","sources":["../../src/components/app-shell.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE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,cAAoB,SAAS,EAAC,aAAa,YACxC,aAAa,CAAC,IAAI,EAAE;gCACnB,QAAQ;gCACR,OAAO,EAAE,QAAQ;gCACjB,SAAS,EAAE,EAAE,CACX,4FAA4F,EAC5F,QAAQ,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,uBAAuB,CAClE;gCACD,QAAQ,EAAE,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC;6BACnD,CAAC,IATM,IAAI,CAAC,GAAG,CAUZ,CACP,CAAC;oBACJ,CAAC,CAAC,GACE,GACF,IACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Avatar as AvatarPrimitive } from 'radix-ui';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root> & {
|
|
4
|
+
size?: 'default' | 'sm' | 'lg';
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>): React.JSX.Element;
|
|
7
|
+
declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>): React.JSX.Element;
|
|
8
|
+
declare function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
9
|
+
declare function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
10
|
+
declare function AvatarGroupCount({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
11
|
+
export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage };
|
|
12
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/components/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAIpC,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG;IACrD,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;CAChC,qBAYA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAQ/F;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,QAAQ,CAAC,qBAWvD;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,qBAczE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWxE;AAED,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW7E;AAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar as AvatarPrimitive } from 'radix-ui';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
function Avatar({ className, size = 'default', ...props }) {
|
|
5
|
+
return (_jsx(AvatarPrimitive.Root, { "data-slot": "avatar", "data-size": size, className: cn('group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten', className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
function AvatarImage({ className, ...props }) {
|
|
8
|
+
return (_jsx(AvatarPrimitive.Image, { "data-slot": "avatar-image", className: cn('aspect-square size-full rounded-full object-cover', className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function AvatarFallback({ className, ...props }) {
|
|
11
|
+
return (_jsx(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", className: cn('flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs', className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
function AvatarBadge({ className, ...props }) {
|
|
14
|
+
return (_jsx("span", { "data-slot": "avatar-badge", className: cn('absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none', 'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden', 'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2', 'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2', className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
function AvatarGroup({ className, ...props }) {
|
|
17
|
+
return (_jsx("div", { "data-slot": "avatar-group", className: cn('group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background', className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function AvatarGroupCount({ className, ...props }) {
|
|
20
|
+
return (_jsx("div", { "data-slot": "avatar-group-count", className: cn('relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3', className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage };
|
|
23
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/components/avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAGrD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,SAAS,MAAM,CAAC,EACd,SAAS,EACT,IAAI,GAAG,SAAS,EAChB,GAAG,KAAK,EAGT;IACC,OAAO,CACL,KAAC,eAAe,CAAC,IAAI,iBACT,QAAQ,eACP,IAAI,EACf,SAAS,EAAE,EAAE,CACX,uPAAuP,EACvP,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAsD;IAC9F,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,mDAAmD,EAAE,SAAS,CAAC,KACzE,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EAC8C;IACtD,OAAO,CACL,KAAC,eAAe,CAAC,QAAQ,iBACb,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CACX,oIAAoI,EACpI,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAgC;IACxE,OAAO,CACL,4BACY,cAAc,EACxB,SAAS,EAAE,EAAE,CACX,0KAA0K,EAC1K,+EAA+E,EAC/E,2FAA2F,EAC3F,+EAA+E,EAC/E,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACvE,OAAO,CACL,2BACY,cAAc,EACxB,SAAS,EAAE,EAAE,CACX,qGAAqG,EACrG,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IAC5E,OAAO,CACL,2BACY,oBAAoB,EAC9B,SAAS,EAAE,EAAE,CACX,0VAA0V,EAC1V,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type { LucideIcon } from 'lucide-react';
|
|
3
|
+
import type * as React from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* The unified Badge / StatusPill (DESIGN.md §2.5): one component, two axes.
|
|
6
|
+
* Tone is semantic (the token contract's status triples); appearance is
|
|
7
|
+
* structural. A status pill is a Badge with an `icon` — there is no
|
|
8
|
+
* separate StatusPill component, and domain status enums (Tabbie's
|
|
9
|
+
* FriendStatusPill) stay in their app, rebuilt on this Badge.
|
|
10
|
+
*
|
|
11
|
+
* Tone mapping onto the contract:
|
|
12
|
+
* - success/warning/danger/info use the status triples: subtle = the
|
|
13
|
+
* triple's `*-bg` background + `*-foreground` text; solid = the triple's
|
|
14
|
+
* main value as background with white text (the triples carry no
|
|
15
|
+
* on-solid foreground — white is the value every source theme's status
|
|
16
|
+
* ramp is designed against); outline = transparent + tone border + tone
|
|
17
|
+
* foreground.
|
|
18
|
+
* - neutral = muted / muted-foreground.
|
|
19
|
+
* - primary solid = primary / primary-foreground. Primary SUBTLE consumes
|
|
20
|
+
* the canonical accent pair (P4, adopted Dec 4, 2026): `accent-bg`
|
|
21
|
+
* background, `accent-border` border, `primary` text — the brand-tinted
|
|
22
|
+
* subtle surface, with values supplied per theme by @jztack/tokens, not
|
|
23
|
+
* faked with color-mix in the component.
|
|
24
|
+
*
|
|
25
|
+
* Label text is mandatory (children) — tone is never the only signal, and
|
|
26
|
+
* icon-only badges are not in the API (DESIGN.md §4.3).
|
|
27
|
+
*/
|
|
28
|
+
declare const badgeVariants: (props?: ({
|
|
29
|
+
tone?: "danger" | "info" | "neutral" | "primary" | "success" | "warning" | null | undefined;
|
|
30
|
+
appearance?: "outline" | "solid" | "subtle" | null | undefined;
|
|
31
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
32
|
+
export type BadgeTone = NonNullable<VariantProps<typeof badgeVariants>['tone']>;
|
|
33
|
+
export type BadgeAppearance = NonNullable<VariantProps<typeof badgeVariants>['appearance']>;
|
|
34
|
+
export interface BadgeProps extends React.ComponentProps<'span'>, VariantProps<typeof badgeVariants> {
|
|
35
|
+
asChild?: boolean;
|
|
36
|
+
/** Optional leading icon, rendered size-3, aria-hidden.
|
|
37
|
+
* A status pill is Badge + icon. */
|
|
38
|
+
icon?: LucideIcon;
|
|
39
|
+
}
|
|
40
|
+
declare function Badge({ className, tone, appearance, asChild, icon: Icon, children, ...props }: BadgeProps): React.JSX.Element;
|
|
41
|
+
export { Badge, badgeVariants };
|
|
42
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/components/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,aAAa;;;8EAiFlB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAChF,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AAE5F,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAClC,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;yCACqC;IACrC,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,IAAgB,EAChB,UAAqB,EACrB,OAAe,EACf,IAAI,EAAE,IAAI,EACV,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,qBAeZ;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { Slot } from 'radix-ui';
|
|
4
|
+
import { cn } from '../lib/utils.js';
|
|
5
|
+
/**
|
|
6
|
+
* The unified Badge / StatusPill (DESIGN.md §2.5): one component, two axes.
|
|
7
|
+
* Tone is semantic (the token contract's status triples); appearance is
|
|
8
|
+
* structural. A status pill is a Badge with an `icon` — there is no
|
|
9
|
+
* separate StatusPill component, and domain status enums (Tabbie's
|
|
10
|
+
* FriendStatusPill) stay in their app, rebuilt on this Badge.
|
|
11
|
+
*
|
|
12
|
+
* Tone mapping onto the contract:
|
|
13
|
+
* - success/warning/danger/info use the status triples: subtle = the
|
|
14
|
+
* triple's `*-bg` background + `*-foreground` text; solid = the triple's
|
|
15
|
+
* main value as background with white text (the triples carry no
|
|
16
|
+
* on-solid foreground — white is the value every source theme's status
|
|
17
|
+
* ramp is designed against); outline = transparent + tone border + tone
|
|
18
|
+
* foreground.
|
|
19
|
+
* - neutral = muted / muted-foreground.
|
|
20
|
+
* - primary solid = primary / primary-foreground. Primary SUBTLE consumes
|
|
21
|
+
* the canonical accent pair (P4, adopted Dec 4, 2026): `accent-bg`
|
|
22
|
+
* background, `accent-border` border, `primary` text — the brand-tinted
|
|
23
|
+
* subtle surface, with values supplied per theme by @jztack/tokens, not
|
|
24
|
+
* faked with color-mix in the component.
|
|
25
|
+
*
|
|
26
|
+
* Label text is mandatory (children) — tone is never the only signal, and
|
|
27
|
+
* icon-only badges are not in the API (DESIGN.md §4.3).
|
|
28
|
+
*/
|
|
29
|
+
const badgeVariants = cva('group/badge inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border px-2 py-0.5 text-badge font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!', {
|
|
30
|
+
variants: {
|
|
31
|
+
tone: {
|
|
32
|
+
neutral: '',
|
|
33
|
+
primary: '',
|
|
34
|
+
success: '',
|
|
35
|
+
warning: '',
|
|
36
|
+
danger: '',
|
|
37
|
+
info: '',
|
|
38
|
+
},
|
|
39
|
+
appearance: {
|
|
40
|
+
subtle: '',
|
|
41
|
+
solid: '',
|
|
42
|
+
outline: 'bg-transparent',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
compoundVariants: [
|
|
46
|
+
// neutral
|
|
47
|
+
{
|
|
48
|
+
tone: 'neutral',
|
|
49
|
+
appearance: 'subtle',
|
|
50
|
+
class: 'border-transparent bg-muted text-muted-foreground',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
tone: 'neutral',
|
|
54
|
+
appearance: 'solid',
|
|
55
|
+
class: 'border-transparent bg-foreground text-background',
|
|
56
|
+
},
|
|
57
|
+
{ tone: 'neutral', appearance: 'outline', class: 'border-border text-foreground' },
|
|
58
|
+
// primary — subtle consumes the canonical accent pair (P4)
|
|
59
|
+
{
|
|
60
|
+
tone: 'primary',
|
|
61
|
+
appearance: 'subtle',
|
|
62
|
+
class: 'border-accent-border bg-accent-bg text-primary',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
tone: 'primary',
|
|
66
|
+
appearance: 'solid',
|
|
67
|
+
class: 'border-transparent bg-primary text-primary-foreground',
|
|
68
|
+
},
|
|
69
|
+
{ tone: 'primary', appearance: 'outline', class: 'border-primary text-primary' },
|
|
70
|
+
// success
|
|
71
|
+
{
|
|
72
|
+
tone: 'success',
|
|
73
|
+
appearance: 'subtle',
|
|
74
|
+
class: 'border-transparent bg-success-bg text-success-foreground',
|
|
75
|
+
},
|
|
76
|
+
{ tone: 'success', appearance: 'solid', class: 'border-transparent bg-success text-white' },
|
|
77
|
+
{ tone: 'success', appearance: 'outline', class: 'border-success text-success-foreground' },
|
|
78
|
+
// warning
|
|
79
|
+
{
|
|
80
|
+
tone: 'warning',
|
|
81
|
+
appearance: 'subtle',
|
|
82
|
+
class: 'border-transparent bg-warning-bg text-warning-foreground',
|
|
83
|
+
},
|
|
84
|
+
{ tone: 'warning', appearance: 'solid', class: 'border-transparent bg-warning text-white' },
|
|
85
|
+
{ tone: 'warning', appearance: 'outline', class: 'border-warning text-warning-foreground' },
|
|
86
|
+
// danger
|
|
87
|
+
{
|
|
88
|
+
tone: 'danger',
|
|
89
|
+
appearance: 'subtle',
|
|
90
|
+
class: 'border-transparent bg-danger-bg text-danger-foreground',
|
|
91
|
+
},
|
|
92
|
+
{ tone: 'danger', appearance: 'solid', class: 'border-transparent bg-danger text-white' },
|
|
93
|
+
{ tone: 'danger', appearance: 'outline', class: 'border-danger text-danger-foreground' },
|
|
94
|
+
// info
|
|
95
|
+
{
|
|
96
|
+
tone: 'info',
|
|
97
|
+
appearance: 'subtle',
|
|
98
|
+
class: 'border-transparent bg-info-bg text-info-foreground',
|
|
99
|
+
},
|
|
100
|
+
{ tone: 'info', appearance: 'solid', class: 'border-transparent bg-info text-white' },
|
|
101
|
+
{ tone: 'info', appearance: 'outline', class: 'border-info text-info-foreground' },
|
|
102
|
+
],
|
|
103
|
+
defaultVariants: {
|
|
104
|
+
tone: 'neutral',
|
|
105
|
+
appearance: 'subtle',
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
function Badge({ className, tone = 'neutral', appearance = 'subtle', asChild = false, icon: Icon, children, ...props }) {
|
|
109
|
+
const Comp = asChild ? Slot.Root : 'span';
|
|
110
|
+
return (_jsxs(Comp, { "data-slot": "badge", "data-tone": tone, "data-appearance": appearance, className: cn(badgeVariants({ tone, appearance }), className), ...props, children: [Icon ? _jsx(Icon, { className: "size-3", "aria-hidden": true }) : null, children] }));
|
|
111
|
+
}
|
|
112
|
+
export { Badge, badgeVariants };
|
|
113
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/components/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,aAAa,GAAG,GAAG,CACvB,ydAAyd,EACzd;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;SACT;QACD,UAAU,EAAE;YACV,MAAM,EAAE,EAAE;YACV,KA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ance-authority';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import { type HapticPattern } from '../haptics.js';
|
|
4
|
+
/**
|
|
5
|
+
* Size scale re-based to the global standard (48px minimum tap target),
|
|
6
|
+
* per DESIGN.md §2.1. Tabbie's scale (default 36px, lg 44px) survives only
|
|
7
|
+
* as the dense sizes: `sm`/`xs`/`icon-sm`/`icon-xs` are DOCUMENTED
|
|
8
|
+
* desktop-only escape hatches for dense, mouse-driven surfaces (toolbars,
|
|
9
|
+
* table rows) — never for primary mobile actions (Justin's dense-size
|
|
10
|
+
* decision, Dec 4, 2026). Icon buttons may expand their hit area with the
|
|
11
|
+
* Switch `after`-inset technique when a dense visual size is used inside a
|
|
12
|
+
* touch surface.
|
|
13
|
+
*/
|
|
14
|
+
declare const buttonVariants: (props?: ({
|
|
15
|
+
variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
|
|
16
|
+
size?: "default" | "icon" | "icon-lg" | "icon-sm" | "icon-xs" | "lg" | "sm" | "xs" | null | undefined;
|
|
17
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
18
|
+
export interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Opt-in haptics (DESIGN.md §2.1): `false` (default) never fires; `true`
|
|
22
|
+
* fires the variant-mapped default pattern; a pattern name fires that
|
|
23
|
+
* pattern. Fires only when the app has enabled the engine via
|
|
24
|
+
* `configureHaptics()` and the button is not disabled.
|
|
25
|
+
*/
|
|
26
|
+
haptic?: boolean | HapticPattern;
|
|
27
|
+
}
|
|
28
|
+
declare function Button({ className, variant, size, asChild, haptic, onClick, ...props }: ButtonProps): React.JSX.Element;
|
|
29
|
+
export { Button, buttonVariants };
|
|
30
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,OAAO,EAGL,KAAK,aAAa,EAEnB,MAAM,eAAe,CAAC;AAGvB;;;;;;;;;GASG;AACH,QAAA,MAAM,cAAc;;;8EAoCnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EACpC,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;CAClC;AAED,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,OAAe,EACf,MAAc,EACd,OAAO,EACP,GAAG,KAAK,EACT,EAAE,WAAW,qBAyBb;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { Slot } from 'radix-ui';
|
|
4
|
+
import { BUTTON_VARIANT_PATTERNS, DEFAULT_BUTTON_PATTERN, triggerHaptic, } from '../haptics.js';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Size scale re-based to the global standard (48px minimum tap target),
|
|
8
|
+
* per DESIGN.md §2.1. Tabbie's scale (default 36px, lg 44px) survives only
|
|
9
|
+
* as the dense sizes: `sm`/`xs`/`icon-sm`/`icon-xs` are DOCUMENTED
|
|
10
|
+
* desktop-only escape hatches for dense, mouse-driven surfaces (toolbars,
|
|
11
|
+
* table rows) — never for primary mobile actions (Justin's dense-size
|
|
12
|
+
* decision, Dec 4, 2026). Icon buttons may expand their hit area with the
|
|
13
|
+
* Switch `after`-inset technique when a dense visual size is used inside a
|
|
14
|
+
* touch surface.
|
|
15
|
+
*/
|
|
16
|
+
const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/80',
|
|
20
|
+
outline: 'border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50',
|
|
21
|
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
|
|
22
|
+
ghost: 'hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50',
|
|
23
|
+
destructive: 'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40',
|
|
24
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
default: 'h-12 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3',
|
|
28
|
+
lg: 'h-[52px] gap-2 px-5 has-data-[icon=inline-end]:pr-3.5 has-data-[icon=inline-start]:pl-3.5',
|
|
29
|
+
icon: 'size-12',
|
|
30
|
+
// Dense-only escape hatches (desktop, mouse-driven) — see header.
|
|
31
|
+
sm: 'h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5',
|
|
32
|
+
xs: "h-7 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
33
|
+
'icon-sm': 'size-8 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg',
|
|
34
|
+
'icon-xs': "size-7 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3.5",
|
|
35
|
+
'icon-lg': 'size-[52px]',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
variant: 'default',
|
|
40
|
+
size: 'default',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
function Button({ className, variant = 'default', size = 'default', asChild = false, haptic = false, onClick, ...props }) {
|
|
44
|
+
const Comp = asChild ? Slot.Root : 'button';
|
|
45
|
+
const handleClick = (event) => {
|
|
46
|
+
if (haptic !== false && !props.disabled) {
|
|
47
|
+
const patternType = typeof haptic === 'string'
|
|
48
|
+
? haptic
|
|
49
|
+
: (BUTTON_VARIANT_PATTERNS[variant ?? 'default'] ?? DEFAULT_BUTTON_PATTERN);
|
|
50
|
+
triggerHaptic(patternType);
|
|
51
|
+
}
|
|
52
|
+
onClick?.(event);
|
|
53
|
+
};
|
|
54
|
+
return (_jsx(Comp, { "data-slot": "button", "data-variant": variant, "data-size": size, "data-haptic": typeof haptic === 'string' ? haptic : haptic === false ? 'false' : undefined, className: cn(buttonVariants({ variant, size, className })), onClick: handleClick, ...props }));
|
|
55
|
+
}
|
|
56
|
+
export { Button, buttonVariants };
|
|
57
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/components/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EAEtB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAG,GAAG,CACxB,4lBAA4lB,EAC5lB;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,wDAAwD;YACjE,OAAO,EACL,iLAAiL;YACnL,SAAS,EACP,gLAAgL;YAClL,KAAK,EACH,kHAAkH;YACpH,WAAW,EACT,6NAA6N;YAC/N,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ,OAAO,EACL,qFAAqF;YACvF,EAAE,EAAE,2FAA2F;YAC/F,IAAI,EAAE,SAAS;YACf,kEAAkE;YAClE,EAAE,EAAE,wFAAwF;YAC5F,EAAE,EAAE,mNAAmN;YACvN,SAAS,EACP,oFAAoF;YACtF,SAAS,EACP,2HAA2H;YAC7H,SAAS,EAAE,aAAa;SACzB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAC;AAeF,SAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,SAAS,EAChB,OAAO,GAAG,KAAK,EACf,MAAM,GAAG,KAAK,EACd,OAAO,EACP,GAAG,KAAK,EACI;IACZ,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IAE5C,MAAM,WAAW,GAAG,CAAC,KAA0C,EAAQ,EAAE;QACvE,IAAI,MAAM,K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