@behavioral-agentic-design-system/core 0.12.1 → 0.13.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/package.json +1 -1
- package/src/app/preview/components/page.tsx +187 -5
- package/src/app/shell.tsx +32 -11
- package/src/components/customize/brand-mark-section.tsx +1 -1
- package/src/components/customize/font-pickers.tsx +2 -2
- package/src/components/customize/letter-spacing.tsx +1 -1
- package/src/components/customize/type-scale.tsx +1 -1
- package/src/components/customize-tab.tsx +6 -6
- package/src/components/ui/date-picker.tsx +158 -0
- package/src/components/ui/index.ts +2 -0
- package/src/components/ui/rating-group.tsx +126 -0
- package/src/components/ui/stepper.tsx +13 -2
- package/src/components/ui/tabs.tsx +4 -7
- package/src/data/docs-index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behavioral-agentic-design-system/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "BADS core — tokens, shadcn/ui components, and the BADS template shell (app routes, customize tab, theme hooks). Forks consume this and re-export, keeping client repos to ~30 lines of glue.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Matthew Stephens <work@matthewstephens.com> (https://github.com/matthewlarn)",
|
|
@@ -150,6 +150,8 @@ import {
|
|
|
150
150
|
HoverCardTrigger,
|
|
151
151
|
} from "@behavioral-agentic-design-system/core/components/ui/hover-card";
|
|
152
152
|
import { Sparkles, Info, CircleAlert, CalendarIcon, BuildingIcon } from "lucide-react";
|
|
153
|
+
import { DatePicker } from "@behavioral-agentic-design-system/core/components/ui/date-picker";
|
|
154
|
+
import { RatingGroup } from "@behavioral-agentic-design-system/core/components/ui/rating-group";
|
|
153
155
|
import { Toaster } from "@behavioral-agentic-design-system/core/components/ui/sonner";
|
|
154
156
|
import { toast } from "sonner";
|
|
155
157
|
|
|
@@ -1378,13 +1380,13 @@ export default function ComponentsPreview() {
|
|
|
1378
1380
|
</p>
|
|
1379
1381
|
</HoverCardHeader>
|
|
1380
1382
|
<Separator className="my-3" />
|
|
1381
|
-
<div className="flex
|
|
1382
|
-
<span className="flex items-center gap-1">
|
|
1383
|
-
<CalendarIcon className="size-3.5" strokeWidth={1.5} />
|
|
1383
|
+
<div className="flex flex-col gap-2 text-xs text-muted-foreground">
|
|
1384
|
+
<span className="flex items-center gap-1.5 whitespace-nowrap">
|
|
1385
|
+
<CalendarIcon className="size-3.5 shrink-0" strokeWidth={1.5} />
|
|
1384
1386
|
Joined March 2021
|
|
1385
1387
|
</span>
|
|
1386
|
-
<span className="flex items-center gap-1">
|
|
1387
|
-
<BuildingIcon className="size-3.5" strokeWidth={1.5} />
|
|
1388
|
+
<span className="flex items-center gap-1.5 whitespace-nowrap">
|
|
1389
|
+
<BuildingIcon className="size-3.5 shrink-0" strokeWidth={1.5} />
|
|
1388
1390
|
Lakeview Health
|
|
1389
1391
|
</span>
|
|
1390
1392
|
</div>
|
|
@@ -1585,7 +1587,187 @@ export default function ComponentsPreview() {
|
|
|
1585
1587
|
</div>
|
|
1586
1588
|
</div>
|
|
1587
1589
|
</Section>
|
|
1590
|
+
|
|
1591
|
+
<Section title="Date Picker">
|
|
1592
|
+
<div className="space-y-6">
|
|
1593
|
+
<div className="space-y-3">
|
|
1594
|
+
<p className="text-sm font-medium text-muted-foreground">Sizes</p>
|
|
1595
|
+
<div className="flex flex-col gap-3 max-w-xs">
|
|
1596
|
+
<DatePickerShowcase size="sm" placeholder="Small — pick a date" />
|
|
1597
|
+
<DatePickerShowcase size="default" placeholder="Default — pick a date" />
|
|
1598
|
+
<DatePickerShowcase size="lg" placeholder="Large — pick a date" />
|
|
1599
|
+
</div>
|
|
1600
|
+
</div>
|
|
1601
|
+
<div className="space-y-3">
|
|
1602
|
+
<p className="text-sm font-medium text-muted-foreground">With value + clearable</p>
|
|
1603
|
+
<div className="max-w-xs">
|
|
1604
|
+
<DatePickerShowcase
|
|
1605
|
+
defaultValue={new Date("2026-08-15")}
|
|
1606
|
+
clearable
|
|
1607
|
+
placeholder="Pick a date"
|
|
1608
|
+
/>
|
|
1609
|
+
</div>
|
|
1610
|
+
</div>
|
|
1611
|
+
<div className="space-y-3">
|
|
1612
|
+
<p className="text-sm font-medium text-muted-foreground">Disabled</p>
|
|
1613
|
+
<div className="max-w-xs">
|
|
1614
|
+
<DatePicker
|
|
1615
|
+
disabled
|
|
1616
|
+
value={new Date("2026-06-24")}
|
|
1617
|
+
placeholder="Pick a date"
|
|
1618
|
+
/>
|
|
1619
|
+
</div>
|
|
1620
|
+
</div>
|
|
1621
|
+
<div className="space-y-3">
|
|
1622
|
+
<p className="text-sm font-medium text-muted-foreground">Realistic use — schedule form</p>
|
|
1623
|
+
<DatePickerScheduleForm />
|
|
1624
|
+
</div>
|
|
1625
|
+
</div>
|
|
1626
|
+
</Section>
|
|
1627
|
+
|
|
1628
|
+
<Section title="Rating Group">
|
|
1629
|
+
<div className="space-y-6">
|
|
1630
|
+
<div className="space-y-3">
|
|
1631
|
+
<p className="text-sm font-medium text-muted-foreground">Sizes</p>
|
|
1632
|
+
<div className="flex flex-col gap-3">
|
|
1633
|
+
<RatingGroupShowcase size="sm" defaultValue={3} label="Small rating" />
|
|
1634
|
+
<RatingGroupShowcase size="default" defaultValue={3} label="Default rating" />
|
|
1635
|
+
<RatingGroupShowcase size="lg" defaultValue={3} label="Large rating" />
|
|
1636
|
+
</div>
|
|
1637
|
+
</div>
|
|
1638
|
+
<div className="space-y-3">
|
|
1639
|
+
<p className="text-sm font-medium text-muted-foreground">Interactive (unset)</p>
|
|
1640
|
+
<RatingGroupShowcase label="Rate this" />
|
|
1641
|
+
</div>
|
|
1642
|
+
<div className="space-y-3">
|
|
1643
|
+
<p className="text-sm font-medium text-muted-foreground">Read-only</p>
|
|
1644
|
+
<RatingGroup value={4} readOnly label="Average rating: 4 of 5" />
|
|
1645
|
+
</div>
|
|
1646
|
+
<div className="space-y-3">
|
|
1647
|
+
<p className="text-sm font-medium text-muted-foreground">Disabled</p>
|
|
1648
|
+
<RatingGroup value={2} disabled label="Rating" />
|
|
1649
|
+
</div>
|
|
1650
|
+
<div className="space-y-3">
|
|
1651
|
+
<p className="text-sm font-medium text-muted-foreground">Realistic use — session feedback</p>
|
|
1652
|
+
<RatingGroupFeedbackDemo />
|
|
1653
|
+
</div>
|
|
1654
|
+
</div>
|
|
1655
|
+
</Section>
|
|
1588
1656
|
</div>
|
|
1589
1657
|
</div>
|
|
1590
1658
|
);
|
|
1591
1659
|
}
|
|
1660
|
+
|
|
1661
|
+
function DatePickerShowcase({
|
|
1662
|
+
size,
|
|
1663
|
+
placeholder,
|
|
1664
|
+
defaultValue,
|
|
1665
|
+
clearable,
|
|
1666
|
+
}: {
|
|
1667
|
+
size?: "sm" | "default" | "lg";
|
|
1668
|
+
placeholder?: string;
|
|
1669
|
+
defaultValue?: Date;
|
|
1670
|
+
clearable?: boolean;
|
|
1671
|
+
}) {
|
|
1672
|
+
const [date, setDate] = React.useState<Date | undefined>(defaultValue);
|
|
1673
|
+
return (
|
|
1674
|
+
<DatePicker
|
|
1675
|
+
size={size}
|
|
1676
|
+
value={date}
|
|
1677
|
+
onValueChange={setDate}
|
|
1678
|
+
placeholder={placeholder}
|
|
1679
|
+
clearable={clearable}
|
|
1680
|
+
/>
|
|
1681
|
+
);
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
function DatePickerScheduleForm() {
|
|
1685
|
+
const [startDate, setStartDate] = React.useState<Date | undefined>(undefined);
|
|
1686
|
+
const [endDate, setEndDate] = React.useState<Date | undefined>(undefined);
|
|
1687
|
+
return (
|
|
1688
|
+
<div className="w-80 space-y-4 rounded-lg border border-border bg-card p-4">
|
|
1689
|
+
<div className="space-y-1">
|
|
1690
|
+
<p className="text-sm font-semibold">Schedule practice block</p>
|
|
1691
|
+
<p className="text-xs text-muted-foreground">
|
|
1692
|
+
Breezy Hills Aquatic Club · Summer season
|
|
1693
|
+
</p>
|
|
1694
|
+
</div>
|
|
1695
|
+
<div className="space-y-3">
|
|
1696
|
+
<div className="space-y-1.5">
|
|
1697
|
+
<label className="text-sm font-medium">Start date</label>
|
|
1698
|
+
<DatePicker
|
|
1699
|
+
value={startDate}
|
|
1700
|
+
onValueChange={setStartDate}
|
|
1701
|
+
placeholder="Pick start date"
|
|
1702
|
+
clearable
|
|
1703
|
+
toDate={endDate}
|
|
1704
|
+
/>
|
|
1705
|
+
</div>
|
|
1706
|
+
<div className="space-y-1.5">
|
|
1707
|
+
<label className="text-sm font-medium">End date</label>
|
|
1708
|
+
<DatePicker
|
|
1709
|
+
value={endDate}
|
|
1710
|
+
onValueChange={setEndDate}
|
|
1711
|
+
placeholder="Pick end date"
|
|
1712
|
+
clearable
|
|
1713
|
+
fromDate={startDate}
|
|
1714
|
+
/>
|
|
1715
|
+
</div>
|
|
1716
|
+
</div>
|
|
1717
|
+
<div className="flex justify-end gap-2">
|
|
1718
|
+
<Button variant="outline" size="sm" className="min-h-11">Cancel</Button>
|
|
1719
|
+
<Button size="sm" className="min-h-11">Schedule</Button>
|
|
1720
|
+
</div>
|
|
1721
|
+
</div>
|
|
1722
|
+
);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
function RatingGroupShowcase({
|
|
1726
|
+
size,
|
|
1727
|
+
defaultValue = 0,
|
|
1728
|
+
label,
|
|
1729
|
+
}: {
|
|
1730
|
+
size?: "sm" | "default" | "lg";
|
|
1731
|
+
defaultValue?: number;
|
|
1732
|
+
label: string;
|
|
1733
|
+
}) {
|
|
1734
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
1735
|
+
return <RatingGroup size={size} value={value} onValueChange={setValue} label={label} />;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
function RatingGroupFeedbackDemo() {
|
|
1739
|
+
const [value, setValue] = React.useState(0);
|
|
1740
|
+
const [submitted, setSubmitted] = React.useState(false);
|
|
1741
|
+
const labels = ["", "Needs work", "Below average", "Average", "Good", "Excellent"];
|
|
1742
|
+
return (
|
|
1743
|
+
<div className="w-72 rounded-lg border border-border bg-card p-4 space-y-4">
|
|
1744
|
+
<div className="space-y-1">
|
|
1745
|
+
<p className="text-sm font-semibold">Rate your practice session</p>
|
|
1746
|
+
<p className="text-xs text-muted-foreground">Breezy Hills Aquatic Club · Tuesday AM</p>
|
|
1747
|
+
</div>
|
|
1748
|
+
{submitted ? (
|
|
1749
|
+
<div className="space-y-2">
|
|
1750
|
+
<RatingGroup value={value} readOnly label="Your submitted rating" />
|
|
1751
|
+
<p className="text-sm text-muted-foreground">Thanks for your feedback!</p>
|
|
1752
|
+
</div>
|
|
1753
|
+
) : (
|
|
1754
|
+
<div className="space-y-3">
|
|
1755
|
+
<div className="space-y-1.5">
|
|
1756
|
+
<RatingGroup value={value} onValueChange={setValue} label="Session rating" />
|
|
1757
|
+
{value > 0 && (
|
|
1758
|
+
<p className="text-xs text-muted-foreground">{labels[value]}</p>
|
|
1759
|
+
)}
|
|
1760
|
+
</div>
|
|
1761
|
+
<Button
|
|
1762
|
+
disabled={value === 0}
|
|
1763
|
+
size="sm"
|
|
1764
|
+
className="w-full min-h-11"
|
|
1765
|
+
onClick={() => setSubmitted(true)}
|
|
1766
|
+
>
|
|
1767
|
+
Submit rating
|
|
1768
|
+
</Button>
|
|
1769
|
+
</div>
|
|
1770
|
+
)}
|
|
1771
|
+
</div>
|
|
1772
|
+
);
|
|
1773
|
+
}
|
package/src/app/shell.tsx
CHANGED
|
@@ -408,13 +408,34 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
408
408
|
<header className="border-b bg-card shrink-0">
|
|
409
409
|
<div className="flex h-14 items-center px-4 sm:px-6">
|
|
410
410
|
<div className="flex items-center gap-2 min-w-0">
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
411
|
+
{brand.logo?.lockup ? (
|
|
412
|
+
// Full lockup slot: a brand whose identity is a combined
|
|
413
|
+
// mark+wordmark renders it as ONE sanitized SVG, sized to the
|
|
414
|
+
// header. This preserves the artwork's intrinsic alignment and
|
|
415
|
+
// replaces the boxed mark + product-name. The wordmark's
|
|
416
|
+
// currentColor follows chrome text (legible light/dark); any
|
|
417
|
+
// brand-colored mark fills are preserved. Sanitized server-side
|
|
418
|
+
// by /api/brand-mark before it lands in brand.config, same as
|
|
419
|
+
// `logo.svg` — safe to inline render.
|
|
420
|
+
<span
|
|
421
|
+
role="img"
|
|
422
|
+
aria-label={`${brand.name} logo`}
|
|
423
|
+
className="flex h-7 items-center shrink-0 min-w-0 text-foreground [&>svg]:h-full [&>svg]:w-auto [&>svg]:max-w-full"
|
|
424
|
+
dangerouslySetInnerHTML={{ __html: brand.logo.lockup }}
|
|
425
|
+
/>
|
|
426
|
+
) : (
|
|
427
|
+
<>
|
|
428
|
+
<div
|
|
429
|
+
className="h-8 w-8 rounded-lg flex items-center justify-center bg-primary text-primary-foreground shrink-0"
|
|
430
|
+
>
|
|
431
|
+
<BrandMark size={20} />
|
|
432
|
+
</div>
|
|
433
|
+
<span className="text-lg font-semibold truncate">{brand.name}</span>
|
|
434
|
+
</>
|
|
435
|
+
)}
|
|
436
|
+
{brand.tagline ? (
|
|
437
|
+
<Badge variant="outline" className="ml-2 text-xs hidden sm:inline-flex">{brand.tagline}</Badge>
|
|
438
|
+
) : null}
|
|
418
439
|
</div>
|
|
419
440
|
<div className="ml-auto flex items-center gap-1.5 sm:gap-2 shrink-0">
|
|
420
441
|
{/* Fork-configurable header links — set `headerLinks` in brand.config
|
|
@@ -427,7 +448,7 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
427
448
|
asChild
|
|
428
449
|
variant="ghost"
|
|
429
450
|
size="sm"
|
|
430
|
-
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-
|
|
451
|
+
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-primary hover:!text-primary-foreground hover:border-primary"
|
|
431
452
|
title={`Open ${link.label}`}
|
|
432
453
|
>
|
|
433
454
|
<a href={link.href} target="_blank" rel="noreferrer" aria-label={`Open ${link.label} in a new tab`}>
|
|
@@ -441,7 +462,7 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
441
462
|
asChild
|
|
442
463
|
variant="ghost"
|
|
443
464
|
size="sm"
|
|
444
|
-
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-
|
|
465
|
+
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-primary hover:!text-primary-foreground hover:border-primary"
|
|
445
466
|
title="Open Storybook"
|
|
446
467
|
>
|
|
447
468
|
<a href={storybookUrl} target="_blank" rel="noreferrer" aria-label="Open Storybook in a new tab">
|
|
@@ -455,7 +476,7 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
455
476
|
asChild
|
|
456
477
|
variant="ghost"
|
|
457
478
|
size="sm"
|
|
458
|
-
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-
|
|
479
|
+
className="group h-8 gap-1.5 border border-foreground/30 hover:!bg-primary hover:!text-primary-foreground hover:border-primary"
|
|
459
480
|
title={`Open ${brand.repo.replace(/^https?:\/\//, "")} on GitHub`}
|
|
460
481
|
>
|
|
461
482
|
<a href={brand.repo} target="_blank" rel="noreferrer" aria-label="Open GitHub repo in a new tab">
|
|
@@ -468,7 +489,7 @@ export function Shell({ tabs, defaultTab }: ShellProps) {
|
|
|
468
489
|
variant="ghost"
|
|
469
490
|
size="icon"
|
|
470
491
|
onClick={toggleDark}
|
|
471
|
-
className="group size-8 border border-foreground/30 hover:!bg-
|
|
492
|
+
className="group size-8 border border-foreground/30 hover:!bg-primary hover:!text-primary-foreground hover:border-primary"
|
|
472
493
|
aria-label={dark ? "Switch to light mode" : "Switch to dark mode"}
|
|
473
494
|
>
|
|
474
495
|
{dark ? (
|
|
@@ -160,7 +160,7 @@ export function BrandMarkSection() {
|
|
|
160
160
|
}
|
|
161
161
|
}}
|
|
162
162
|
placeholder='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">…</svg>'
|
|
163
|
-
className="min-h-[180px] font-mono text-xs"
|
|
163
|
+
className="min-h-[180px] max-h-[200px] overflow-auto font-mono text-xs"
|
|
164
164
|
/>
|
|
165
165
|
</div>
|
|
166
166
|
|
|
@@ -159,7 +159,7 @@ function AddFontTile({ kind }: { kind: FontKind }) {
|
|
|
159
159
|
<PopoverTrigger asChild>
|
|
160
160
|
<button
|
|
161
161
|
type="button"
|
|
162
|
-
className="group flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border p-4 transition-all hover:border-
|
|
162
|
+
className="group flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border p-4 transition-all hover:border-primary/40 min-h-[7.5rem]"
|
|
163
163
|
aria-label={`Add custom ${kind} font`}
|
|
164
164
|
>
|
|
165
165
|
<div className="flex h-10 w-10 items-center justify-center rounded-full border border-dashed border-border text-muted-foreground group-hover:text-foreground">
|
|
@@ -333,7 +333,7 @@ function FontCardGrid<K extends string>({
|
|
|
333
333
|
className={`group flex flex-col items-start gap-3 rounded-lg border p-4 text-left transition-all ${
|
|
334
334
|
isActive
|
|
335
335
|
? "border-primary ring-2 ring-primary/30"
|
|
336
|
-
: "border-border hover:border-
|
|
336
|
+
: "border-border hover:border-primary/40"
|
|
337
337
|
}`}
|
|
338
338
|
>
|
|
339
339
|
<span
|
|
@@ -74,7 +74,7 @@ export function LetterSpacingPanel() {
|
|
|
74
74
|
className={`text-xs font-medium px-2 py-1 rounded-md border transition-colors ${
|
|
75
75
|
active
|
|
76
76
|
? "border-primary text-primary"
|
|
77
|
-
: "border-border text-muted-foreground hover:border-
|
|
77
|
+
: "border-border text-muted-foreground hover:border-primary/40"
|
|
78
78
|
}`}
|
|
79
79
|
>
|
|
80
80
|
{preset.label}
|
|
@@ -92,7 +92,7 @@ export function TypeScalePanel() {
|
|
|
92
92
|
className={`text-xs font-medium px-2 py-1 rounded-md border transition-colors ${
|
|
93
93
|
active
|
|
94
94
|
? "border-primary text-primary"
|
|
95
|
-
: "border-border text-muted-foreground hover:border-
|
|
95
|
+
: "border-border text-muted-foreground hover:border-primary/40"
|
|
96
96
|
}`}
|
|
97
97
|
>
|
|
98
98
|
{preset.label}
|
|
@@ -126,7 +126,7 @@ function ColorSwatch({
|
|
|
126
126
|
className="group block w-full text-left rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
127
127
|
>
|
|
128
128
|
<div
|
|
129
|
-
className={`h-20 rounded-lg border ${className} flex items-end p-2.5 transition-all group-hover:border-
|
|
129
|
+
className={`h-20 rounded-lg border ${className} flex items-end p-2.5 transition-all group-hover:border-primary/40 ${
|
|
130
130
|
isOverridden ? "ring-2 ring-primary/30" : ""
|
|
131
131
|
}`}
|
|
132
132
|
>
|
|
@@ -225,7 +225,7 @@ function ColorSwatch({
|
|
|
225
225
|
className={`group/sw flex flex-col items-center gap-1.5 rounded-md border p-2 transition-all ${
|
|
226
226
|
isActive
|
|
227
227
|
? "border-primary ring-2 ring-primary/30"
|
|
228
|
-
: "border-border hover:border-
|
|
228
|
+
: "border-border hover:border-primary/40"
|
|
229
229
|
}`}
|
|
230
230
|
>
|
|
231
231
|
<div
|
|
@@ -250,7 +250,7 @@ function ColorSwatch({
|
|
|
250
250
|
type="button"
|
|
251
251
|
onClick={() => setShowAdd(true)}
|
|
252
252
|
title="Add a new brand color and apply it here"
|
|
253
|
-
className="group/sw flex flex-col items-center gap-1.5 rounded-md border border-dashed border-border p-2 transition-all hover:border-
|
|
253
|
+
className="group/sw flex flex-col items-center gap-1.5 rounded-md border border-dashed border-border p-2 transition-all hover:border-primary/40"
|
|
254
254
|
>
|
|
255
255
|
<div className="flex h-7 w-7 items-center justify-center rounded-full border border-dashed border-border/60 text-muted-foreground group-hover/sw:text-foreground">
|
|
256
256
|
<Plus className="h-3.5 w-3.5" strokeWidth={1.5} />
|
|
@@ -358,7 +358,7 @@ function AddBrandColorButton({
|
|
|
358
358
|
<PopoverTrigger asChild>
|
|
359
359
|
<button
|
|
360
360
|
type="button"
|
|
361
|
-
className="group flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border p-3 transition-all hover:border-
|
|
361
|
+
className="group flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border p-3 transition-all hover:border-primary/40 min-h-[8.5rem]"
|
|
362
362
|
aria-label="Add brand color"
|
|
363
363
|
>
|
|
364
364
|
<div className="flex h-12 w-12 items-center justify-center rounded-full border border-dashed border-border text-muted-foreground group-hover:text-foreground">
|
|
@@ -509,7 +509,7 @@ function BrandColorCard({
|
|
|
509
509
|
className={`flex w-full flex-col items-center gap-2 rounded-lg border p-3 transition-all min-h-[8.5rem] ${
|
|
510
510
|
isActive
|
|
511
511
|
? "border-primary ring-2 ring-primary/30"
|
|
512
|
-
: "border-border hover:border-
|
|
512
|
+
: "border-border hover:border-primary/40"
|
|
513
513
|
} ${pending ? "opacity-60" : ""}`}
|
|
514
514
|
>
|
|
515
515
|
<div
|
|
@@ -557,7 +557,7 @@ function BrandColorCard({
|
|
|
557
557
|
type="button"
|
|
558
558
|
aria-label={`Edit ${opt.label}`}
|
|
559
559
|
disabled={pending !== null}
|
|
560
|
-
className="absolute top-1.5 right-1.5 inline-flex h-6 w-6 items-center justify-center rounded-md border border-border bg-background text-muted-foreground hover:text-foreground hover:border-
|
|
560
|
+
className="absolute top-1.5 right-1.5 inline-flex h-6 w-6 items-center justify-center rounded-md border border-border bg-background text-muted-foreground hover:text-foreground hover:border-primary/40 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity disabled:opacity-50"
|
|
561
561
|
>
|
|
562
562
|
<MoreHorizontal className="h-3 w-3" strokeWidth={1.5} />
|
|
563
563
|
</button>
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { CalendarIcon, XIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import { Calendar } from "./calendar"
|
|
8
|
+
import {
|
|
9
|
+
Popover,
|
|
10
|
+
PopoverContent,
|
|
11
|
+
PopoverTrigger,
|
|
12
|
+
} from "./popover"
|
|
13
|
+
|
|
14
|
+
export interface DatePickerProps {
|
|
15
|
+
value?: Date
|
|
16
|
+
onValueChange?: (date: Date | undefined) => void
|
|
17
|
+
placeholder?: string
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
clearable?: boolean
|
|
20
|
+
size?: "sm" | "default" | "lg"
|
|
21
|
+
className?: string
|
|
22
|
+
/** Forward to DayPicker: earliest selectable date */
|
|
23
|
+
fromDate?: Date
|
|
24
|
+
/** Forward to DayPicker: latest selectable date */
|
|
25
|
+
toDate?: Date
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const sizeMap = {
|
|
29
|
+
sm: { height: "h-8", px: "px-2.5", text: "text-sm", gap: "gap-1.5", icon: 14 },
|
|
30
|
+
default: { height: "h-9", px: "px-3", text: "text-sm", gap: "gap-2", icon: 16 },
|
|
31
|
+
lg: { height: "h-10", px: "px-4", text: "text-base", gap: "gap-2", icon: 16 },
|
|
32
|
+
} as const
|
|
33
|
+
|
|
34
|
+
function formatDate(date: Date): string {
|
|
35
|
+
return date.toLocaleDateString("en-US", {
|
|
36
|
+
month: "short",
|
|
37
|
+
day: "numeric",
|
|
38
|
+
year: "numeric",
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function DatePicker({
|
|
43
|
+
value,
|
|
44
|
+
onValueChange,
|
|
45
|
+
placeholder = "Pick a date",
|
|
46
|
+
disabled = false,
|
|
47
|
+
clearable = false,
|
|
48
|
+
size = "default",
|
|
49
|
+
className,
|
|
50
|
+
fromDate,
|
|
51
|
+
toDate,
|
|
52
|
+
}: DatePickerProps) {
|
|
53
|
+
const [open, setOpen] = React.useState(false)
|
|
54
|
+
const [internalDate, setInternalDate] = React.useState<Date | undefined>(
|
|
55
|
+
undefined
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
const isControlled = value !== undefined || onValueChange !== undefined
|
|
59
|
+
const selectedDate = isControlled ? value : internalDate
|
|
60
|
+
|
|
61
|
+
function handleSelect(date: Date | undefined) {
|
|
62
|
+
if (!isControlled) {
|
|
63
|
+
setInternalDate(date)
|
|
64
|
+
}
|
|
65
|
+
onValueChange?.(date)
|
|
66
|
+
if (date) setOpen(false)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function handleClear(e: React.MouseEvent) {
|
|
70
|
+
e.stopPropagation()
|
|
71
|
+
handleSelect(undefined)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const { height, px, text, gap, icon: iconSize } = sizeMap[size]
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Popover open={open} onOpenChange={disabled ? undefined : setOpen}>
|
|
78
|
+
{/*
|
|
79
|
+
Outer div carries all visual chrome (border, rounded, bg, shadow).
|
|
80
|
+
focus-within shows the ring when either the trigger OR clear button is focused —
|
|
81
|
+
consistent with how compound inputs (e.g. search with clear) behave.
|
|
82
|
+
The clear button must be a sibling of the trigger, NOT nested inside it,
|
|
83
|
+
to satisfy the axe-core `nested-interactive` rule.
|
|
84
|
+
*/}
|
|
85
|
+
<div
|
|
86
|
+
data-slot="date-picker-root"
|
|
87
|
+
data-size={size}
|
|
88
|
+
className={cn(
|
|
89
|
+
"inline-flex w-full min-w-0 items-center rounded-md border border-input bg-transparent shadow-xs",
|
|
90
|
+
"focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50",
|
|
91
|
+
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
92
|
+
height,
|
|
93
|
+
px,
|
|
94
|
+
gap,
|
|
95
|
+
className
|
|
96
|
+
)}
|
|
97
|
+
>
|
|
98
|
+
<PopoverTrigger asChild>
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
data-slot="date-picker-trigger"
|
|
102
|
+
disabled={disabled}
|
|
103
|
+
aria-haspopup="dialog"
|
|
104
|
+
aria-expanded={open}
|
|
105
|
+
aria-label={selectedDate ? formatDate(selectedDate) : placeholder}
|
|
106
|
+
style={{
|
|
107
|
+
transitionDuration: "var(--duration-fast)",
|
|
108
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
109
|
+
}}
|
|
110
|
+
className={cn(
|
|
111
|
+
"inline-flex flex-1 min-w-0 h-full items-center text-left font-normal bg-transparent outline-none",
|
|
112
|
+
"transition-[color]",
|
|
113
|
+
gap,
|
|
114
|
+
text,
|
|
115
|
+
!selectedDate && "text-muted-foreground"
|
|
116
|
+
)}
|
|
117
|
+
>
|
|
118
|
+
<CalendarIcon
|
|
119
|
+
size={iconSize}
|
|
120
|
+
strokeWidth={1.5}
|
|
121
|
+
className="shrink-0 text-muted-foreground"
|
|
122
|
+
/>
|
|
123
|
+
<span className="flex-1 truncate">
|
|
124
|
+
{selectedDate ? formatDate(selectedDate) : placeholder}
|
|
125
|
+
</span>
|
|
126
|
+
</button>
|
|
127
|
+
</PopoverTrigger>
|
|
128
|
+
{clearable && selectedDate ? (
|
|
129
|
+
<button
|
|
130
|
+
type="button"
|
|
131
|
+
aria-label="Clear date"
|
|
132
|
+
onClick={handleClear}
|
|
133
|
+
disabled={disabled}
|
|
134
|
+
style={{
|
|
135
|
+
transitionDuration: "var(--duration-fast)",
|
|
136
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
137
|
+
}}
|
|
138
|
+
className="shrink-0 -mr-1 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
139
|
+
>
|
|
140
|
+
<XIcon size={iconSize - 2} strokeWidth={1.5} />
|
|
141
|
+
</button>
|
|
142
|
+
) : null}
|
|
143
|
+
</div>
|
|
144
|
+
<PopoverContent className="w-auto p-0" align="start">
|
|
145
|
+
<Calendar
|
|
146
|
+
mode="single"
|
|
147
|
+
selected={selectedDate}
|
|
148
|
+
onSelect={handleSelect}
|
|
149
|
+
fromDate={fromDate}
|
|
150
|
+
toDate={toDate}
|
|
151
|
+
initialFocus
|
|
152
|
+
/>
|
|
153
|
+
</PopoverContent>
|
|
154
|
+
</Popover>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export { DatePicker }
|
|
@@ -12,6 +12,7 @@ export * from "./breadcrumb";
|
|
|
12
12
|
export * from "./button";
|
|
13
13
|
export * from "./calendar";
|
|
14
14
|
export * from "./card";
|
|
15
|
+
export * from "./date-picker";
|
|
15
16
|
export * from "./chart";
|
|
16
17
|
export * from "./checkbox";
|
|
17
18
|
export * from "./collapsible";
|
|
@@ -31,6 +32,7 @@ export * from "./pagination";
|
|
|
31
32
|
export * from "./popover";
|
|
32
33
|
export * from "./progress";
|
|
33
34
|
export * from "./radio-group";
|
|
35
|
+
export * from "./rating-group";
|
|
34
36
|
export * from "./resizable";
|
|
35
37
|
export * from "./scroll-area";
|
|
36
38
|
export * from "./select";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { StarIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
export interface RatingGroupProps {
|
|
9
|
+
value?: number
|
|
10
|
+
onValueChange?: (value: number) => void
|
|
11
|
+
max?: number
|
|
12
|
+
disabled?: boolean
|
|
13
|
+
readOnly?: boolean
|
|
14
|
+
size?: "sm" | "default" | "lg"
|
|
15
|
+
className?: string
|
|
16
|
+
/** Accessible label for the group */
|
|
17
|
+
label?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const sizeMap = {
|
|
21
|
+
sm: { icon: 16, gap: "gap-0.5" },
|
|
22
|
+
default: { icon: 20, gap: "gap-1" },
|
|
23
|
+
lg: { icon: 28, gap: "gap-1.5" },
|
|
24
|
+
} as const
|
|
25
|
+
|
|
26
|
+
function RatingGroup({
|
|
27
|
+
value,
|
|
28
|
+
onValueChange,
|
|
29
|
+
max = 5,
|
|
30
|
+
disabled = false,
|
|
31
|
+
readOnly = false,
|
|
32
|
+
size = "default",
|
|
33
|
+
className,
|
|
34
|
+
label = "Rating",
|
|
35
|
+
}: RatingGroupProps) {
|
|
36
|
+
const [internalValue, setInternalValue] = React.useState(0)
|
|
37
|
+
const [hoverValue, setHoverValue] = React.useState(0)
|
|
38
|
+
|
|
39
|
+
const isControlled = value !== undefined
|
|
40
|
+
const currentValue = isControlled ? (value ?? 0) : internalValue
|
|
41
|
+
const displayValue = hoverValue > 0 ? hoverValue : currentValue
|
|
42
|
+
|
|
43
|
+
const { icon: iconSize, gap } = sizeMap[size]
|
|
44
|
+
|
|
45
|
+
function handleSelect(star: number) {
|
|
46
|
+
if (disabled || readOnly) return
|
|
47
|
+
if (!isControlled) setInternalValue(star)
|
|
48
|
+
onValueChange?.(star)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handleKeyDown(e: React.KeyboardEvent, star: number) {
|
|
52
|
+
if (disabled || readOnly) return
|
|
53
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") {
|
|
54
|
+
e.preventDefault()
|
|
55
|
+
const next = Math.min(star + 1, max)
|
|
56
|
+
handleSelect(next)
|
|
57
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowDown") {
|
|
58
|
+
e.preventDefault()
|
|
59
|
+
const prev = Math.max(star - 1, 1)
|
|
60
|
+
handleSelect(prev)
|
|
61
|
+
} else if (e.key === "Home") {
|
|
62
|
+
e.preventDefault()
|
|
63
|
+
handleSelect(1)
|
|
64
|
+
} else if (e.key === "End") {
|
|
65
|
+
e.preventDefault()
|
|
66
|
+
handleSelect(max)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
role="radiogroup"
|
|
73
|
+
aria-label={label}
|
|
74
|
+
aria-disabled={disabled || undefined}
|
|
75
|
+
aria-readonly={readOnly || undefined}
|
|
76
|
+
data-slot="rating-group"
|
|
77
|
+
data-size={size}
|
|
78
|
+
className={cn("inline-flex items-center", gap, className)}
|
|
79
|
+
onMouseLeave={() => setHoverValue(0)}
|
|
80
|
+
>
|
|
81
|
+
{Array.from({ length: max }, (_, i) => {
|
|
82
|
+
const star = i + 1
|
|
83
|
+
const isFilled = star <= displayValue
|
|
84
|
+
const isSelected = star <= currentValue
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<button
|
|
88
|
+
key={star}
|
|
89
|
+
type="button"
|
|
90
|
+
role="radio"
|
|
91
|
+
aria-checked={isSelected}
|
|
92
|
+
aria-label={`${star} of ${max}`}
|
|
93
|
+
tabIndex={disabled || readOnly ? -1 : isSelected || (currentValue === 0 && star === 1) ? 0 : -1}
|
|
94
|
+
disabled={disabled}
|
|
95
|
+
data-slot="rating-item"
|
|
96
|
+
data-filled={isFilled || undefined}
|
|
97
|
+
style={{ transitionDuration: "var(--duration-fast)", transitionTimingFunction: "var(--ease-out)" }}
|
|
98
|
+
className={cn(
|
|
99
|
+
"min-h-[24px] min-w-[24px] flex items-center justify-center rounded-sm outline-none",
|
|
100
|
+
"transition-[color,transform]",
|
|
101
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
102
|
+
disabled
|
|
103
|
+
? "cursor-not-allowed opacity-40"
|
|
104
|
+
: readOnly
|
|
105
|
+
? "cursor-default"
|
|
106
|
+
: "cursor-pointer hover:scale-110",
|
|
107
|
+
isFilled ? "text-primary" : "text-muted-foreground/40"
|
|
108
|
+
)}
|
|
109
|
+
onClick={() => handleSelect(star)}
|
|
110
|
+
onMouseEnter={() => !disabled && !readOnly && setHoverValue(star)}
|
|
111
|
+
onKeyDown={(e) => handleKeyDown(e, currentValue || 1)}
|
|
112
|
+
>
|
|
113
|
+
<StarIcon
|
|
114
|
+
size={iconSize}
|
|
115
|
+
strokeWidth={1.5}
|
|
116
|
+
fill={isFilled ? "currentColor" : "none"}
|
|
117
|
+
aria-hidden="true"
|
|
118
|
+
/>
|
|
119
|
+
</button>
|
|
120
|
+
)
|
|
121
|
+
})}
|
|
122
|
+
</div>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { RatingGroup }
|
|
@@ -145,8 +145,8 @@ function StepperIndicator({
|
|
|
145
145
|
"flex shrink-0 items-center justify-center size-11 rounded-full border-2",
|
|
146
146
|
"text-sm font-semibold",
|
|
147
147
|
"transition-colors",
|
|
148
|
-
state === "completed" && "
|
|
149
|
-
state === "active" && "
|
|
148
|
+
state === "completed" && "bg-primary text-primary-foreground",
|
|
149
|
+
state === "active" && "bg-background text-primary",
|
|
150
150
|
state === "pending" && "border-input bg-background text-muted-foreground",
|
|
151
151
|
state === "error" && "border-destructive bg-background text-destructive",
|
|
152
152
|
className
|
|
@@ -154,6 +154,17 @@ function StepperIndicator({
|
|
|
154
154
|
style={{
|
|
155
155
|
transitionDuration: "var(--duration-base)",
|
|
156
156
|
transitionTimingFunction: "var(--ease-out)",
|
|
157
|
+
// Inline styles guarantee var(--primary) resolves to the brand color
|
|
158
|
+
// regardless of Tailwind's @theme inline cascade order. Completed uses
|
|
159
|
+
// a box-shadow ring (background-gap + brand ring) so the ring is
|
|
160
|
+
// visible against the filled primary background.
|
|
161
|
+
...(state === "completed" && {
|
|
162
|
+
borderColor: "var(--background, white)",
|
|
163
|
+
boxShadow: "0 0 0 2px var(--primary)",
|
|
164
|
+
}),
|
|
165
|
+
...(state === "active" && {
|
|
166
|
+
borderColor: "var(--primary)",
|
|
167
|
+
}),
|
|
157
168
|
}}
|
|
158
169
|
{...props}
|
|
159
170
|
>
|
|
@@ -122,13 +122,10 @@ function TabsTrigger({
|
|
|
122
122
|
<TabsPrimitive.Trigger
|
|
123
123
|
data-slot="tabs-trigger"
|
|
124
124
|
className={cn(
|
|
125
|
-
// Active
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
// (~13:1 dark, ~20:1 light) and matches the Calendar range-middle
|
|
130
|
-
// pattern, so nested tabs can never regress on brand swaps.
|
|
131
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-accent data-[state=active]:text-foreground data-[state=active]:shadow-xs",
|
|
125
|
+
// Active state uses --primary / --primary-foreground so the selected tab
|
|
126
|
+
// always reflects the fork's brand color. bg-accent broke forks where
|
|
127
|
+
// --accent is a dark brand color (e.g. plum), rendering the pill illegibly dark.
|
|
128
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-xs",
|
|
132
129
|
className
|
|
133
130
|
)}
|
|
134
131
|
{...props}
|
package/src/data/docs-index.ts
CHANGED
|
@@ -101,6 +101,7 @@ export const DOCS_INDEX: DocGroup[] = [
|
|
|
101
101
|
description: "How the system stays honest — anti-patterns, the corrections log, the ethics floor.",
|
|
102
102
|
entries: [
|
|
103
103
|
{ title: "Design rules", path: "DESIGN.md", summary: "Visual system + accessibility baseline." },
|
|
104
|
+
{ title: "Gamification — responsible vs. manipulative", path: "layer-2-ethics-responsibility/gamification.md", summary: "Sir's 10 Core Drives (Octalysis 8 + Exploration & Discovery + Challenge & Competition) + the test gates that decide when Black Hat ships and when it refuses." },
|
|
104
105
|
{ title: "Corrections log", path: "corrections.md", summary: "Per-fork anti-pattern log. Read before every Path B build." },
|
|
105
106
|
{ title: "Anti-defaults refresh", path: "prompts/anti-defaults-refresh.md", summary: "Quarterly pressure-test of the current anti-defaults." },
|
|
106
107
|
{ title: "Promote corrections", path: "prompts/promote-corrections.md", summary: "Monthly: corrections → lint promotion candidates." },
|