@makoai/app-sdk 2.19.0 → 2.21.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 +140 -11
- package/components/badge.tsx +47 -0
- package/components/button.tsx +63 -0
- package/components/card.tsx +91 -0
- package/components/dialog.tsx +158 -0
- package/components/index.ts +19 -0
- package/components/input.tsx +20 -0
- package/components/popover.tsx +88 -0
- package/components/separator.tsx +27 -0
- package/components/skeleton.tsx +13 -0
- package/components/tabs.tsx +90 -0
- package/components/tooltip.tsx +56 -0
- package/index.d.ts +38 -0
- package/index.js +2 -1
- package/lint.js +77 -0
- package/menu/checkbox.tsx +36 -0
- package/menu/dropdown-menu.tsx +205 -0
- package/menu/filter-menu.tsx +312 -0
- package/menu/index.ts +10 -0
- package/menu/utils.ts +7 -0
- package/package.json +49 -4
- package/tailwind.css +60 -0
- package/time.js +110 -0
- package/ui-core.js +165 -0
- package/ui.css +16 -1
- package/ui.d.ts +95 -5
- package/ui.js +208 -73
package/README.md
CHANGED
|
@@ -388,8 +388,9 @@ import {
|
|
|
388
388
|
<MultiSelect options={["CH", "ES", "IT"]} value={countries} onChange={setCountries} allLabel="All countries" />
|
|
389
389
|
```
|
|
390
390
|
|
|
391
|
-
- `MultiSelect` — controlled (`value` / `onChange`). Options are strings
|
|
392
|
-
`{ value, label, color }`; `showOnly` adds an
|
|
391
|
+
- `MultiSelect` — controlled (`value` / `onChange`). Options are strings,
|
|
392
|
+
`{ value, label, color }`, or groups with `children`; `showOnly` adds an
|
|
393
|
+
"Only" button per row. `FilterItems` is its rows alone. On
|
|
393
394
|
phones the menu is a bottom sheet. See "MultiSelect: the All rule" below.
|
|
394
395
|
- `FreshnessBadge` — presentational: the app decides what fresh means and
|
|
395
396
|
passes `tone` (`ok` / `warn` / `bad`, or `green` / `amber` / `red`), a
|
|
@@ -420,18 +421,61 @@ import {
|
|
|
420
421
|
and declare it once (`src/vite-env.d.ts`):
|
|
421
422
|
`declare const __APP_BINDING_NAMES__: string[];`
|
|
422
423
|
|
|
423
|
-
### MultiSelect: the All rule and one open popover (2.17
|
|
424
|
+
### MultiSelect: the All rule and one open popover (2.17+, tri-state from 2.20)
|
|
424
425
|
|
|
425
|
-
**All.** Nothing is filtered when `value` is empty or holds every
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
**All (2.20).** Nothing is filtered when `value` is empty or holds every
|
|
427
|
+
option, and then every row is ticked, All included. Unticking one row leaves
|
|
428
|
+
All in the partial (–) state. A click on a full All unticks every row; a
|
|
429
|
+
click on a partial All ticks every row. "Nothing ticked" is a draft: it emits
|
|
430
|
+
nothing (an empty filter still means everything), the trigger reads
|
|
431
|
+
`noneLabel` ("None"), the first tick picks that row alone, and closing the
|
|
432
|
+
menu keeps the last selection. Unticking the last row gives the same draft.
|
|
429
433
|
`emptyMeansAll` (default `true`) only sets what All emits: `[]`, or every
|
|
430
|
-
option's value when `false`.
|
|
434
|
+
option's value when `false`. No prop changed: an app gets the rule by
|
|
435
|
+
updating the SDK.
|
|
431
436
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
437
|
+
Before 2.20, All showed ticked over unticked rows and a click under All
|
|
438
|
+
selected only that option.
|
|
439
|
+
|
|
440
|
+
**Groups (2.20).** An option with `children` is a group: its row ticks every
|
|
441
|
+
leaf under it and shows a dash when some are picked; its children follow it,
|
|
442
|
+
indented. A tree that needs hover submenus (Traffic → Bots → GPTBot) is a
|
|
443
|
+
`FilterMenu` from `@makoai/app-sdk/menu` (below). A flat list is a one-level tree. The value is
|
|
444
|
+
always leaf values. `filterToParam` / `filterFromParam` turn a selection into
|
|
445
|
+
a URL value and back ("bots" for a whole group, its picked children for a
|
|
446
|
+
partial one).
|
|
447
|
+
|
|
448
|
+
**Composite menus: `FilterItems` (2.20).** The rows without the trigger, for
|
|
449
|
+
an app's own menu that folds several filters into one dropdown on a phone.
|
|
450
|
+
`MultiSelect` renders the same rows, so every filter ticks alike.
|
|
451
|
+
|
|
452
|
+
```tsx
|
|
453
|
+
<DropdownMenuSubContent>
|
|
454
|
+
<FilterItems options={TRAFFIC} value={traffic} onChange={setTraffic} allLabel="All traffic" showOnly />
|
|
455
|
+
</DropdownMenuSubContent>
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
**Replacing an app's NestedFilterMenu: `FilterMenu`.** See "Menus" below:
|
|
459
|
+
`FilterMenu` and `FilterMenuItems` from `@makoai/app-sdk/menu` take
|
|
460
|
+
NestedFilterMenu's props (`label`, `options`, `selected`, `onChange`,
|
|
461
|
+
`allLabel`, `summary`, `triggerClassName`, `probes`, `sizeTo`; `drill` and
|
|
462
|
+
`root` on the items). For a flat filter, `MultiSelect` takes the same
|
|
463
|
+
props. The `nestedfilter.ts` helpers are `filterLeaves`, `filterLeavesOf`,
|
|
464
|
+
`filterFind`, `filterNormalize`, `filterTick`, `filterToggle`,
|
|
465
|
+
`filterText` (summarize), `filterPickedNode`, `filterToParam`,
|
|
466
|
+
`filterFromParam`, all from `/ui`. Delete the app's copies.
|
|
467
|
+
|
|
468
|
+
A value the options don't list (a URL pick before the options load, or a
|
|
469
|
+
market missing from this date range) stays in the selection: the trigger
|
|
470
|
+
reads it ("PT"), All shows partial, and the next tick keeps it.
|
|
471
|
+
|
|
472
|
+
**Trigger.** It reads the All label, the one picked label (a leaf or a whole
|
|
473
|
+
group), "3 selected" for a flat list, or the picked parts for a tree
|
|
474
|
+
("Humans + Bots: GPTBot"). `formatMany={n => `${n} markets`}` changes "N
|
|
475
|
+
selected"; `summary` replaces the text. Its width is fixed to the longest of
|
|
476
|
+
`sizeTo` (default: All, the top-level labels, "N selected" and "None") plus
|
|
477
|
+
`probes`, so a pick never moves the bar. The `title` lists the selected
|
|
478
|
+
labels. Chips and `maxChips` are gone.
|
|
435
479
|
|
|
436
480
|
**Checkbox.** `Checkbox` (`checked`: `true` / `false` / `"mixed"`) is the
|
|
437
481
|
kit's one checkbox. From 2.18 it ticks white on `--brand` (`--primary` when a
|
|
@@ -463,6 +507,91 @@ Pure helpers for app-side menus: `multiSelectState(value, optionValues)`,
|
|
|
463
507
|
`multiSelectToggle(value, optionValues, v, emptyMeansAll)`,
|
|
464
508
|
`multiSelectText(value, options, allLabel, formatMany)`.
|
|
465
509
|
|
|
510
|
+
### Menus: `@makoai/app-sdk/menu` (2.20)
|
|
511
|
+
|
|
512
|
+
Stock shadcn/ui `DropdownMenu` (every part, hover submenus included) and
|
|
513
|
+
`Checkbox` (new-york, as shipped; the Checkbox adds the indeterminate dash),
|
|
514
|
+
plus the `FilterMenu` built on them. Never copy these into an app: a
|
|
515
|
+
missing part or prop is an SDK pull request.
|
|
516
|
+
|
|
517
|
+
```tsx
|
|
518
|
+
import { FilterMenu, FilterMenuItems } from "@makoai/app-sdk/menu";
|
|
519
|
+
import { filterFromParam, filterToParam } from "@makoai/app-sdk/ui";
|
|
520
|
+
|
|
521
|
+
const traffic = filterFromParam(TRAFFIC, params.get("traffic"));
|
|
522
|
+
<FilterMenu label="Traffic" allLabel="All traffic" options={TRAFFIC}
|
|
523
|
+
selected={traffic} onChange={v => setParam("traffic", filterToParam(TRAFFIC, v))} />
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
- A group opens as a hover submenu (or with →) that starts with
|
|
527
|
+
"All <group>"; its own checkbox ticks the whole group without opening it.
|
|
528
|
+
- Every row has an "Only" action on hover. Rows carry no hover text: a
|
|
529
|
+
filter's definitions belong in its label's info note.
|
|
530
|
+
- The All rule and the "None" draft are `MultiSelect`'s (above).
|
|
531
|
+
- `FilterMenuItems` is the rows alone, for an app's own toolbar menu. On a
|
|
532
|
+
phone, `drill={{ open: node => … }}` opens a group in place and
|
|
533
|
+
`root={node}` lists that group's rows.
|
|
534
|
+
|
|
535
|
+
The folder ships TypeScript source; the app's Vite compiles it. It needs
|
|
536
|
+
the shadcn stack an app already has (`radix-ui`, `lucide-react`, `clsx`,
|
|
537
|
+
`tailwind-merge`, optional peers of the SDK) and Tailwind must see its
|
|
538
|
+
classes. Add one line to the app's CSS, after the Tailwind imports:
|
|
539
|
+
|
|
540
|
+
```css
|
|
541
|
+
@source "../node_modules/@makoai/app-sdk/menu";
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### shadcn/ui: `@makoai/app-sdk/components` (2.21)
|
|
545
|
+
|
|
546
|
+
Stock shadcn/ui new-york-v4, as the shadcn registry ships it: `Badge`,
|
|
547
|
+
`Button`, `Card`, `Dialog`, `Input`, `Popover`, `Separator`, `Skeleton`,
|
|
548
|
+
`Tabs`, `Tooltip`, plus `DropdownMenu` and `Checkbox` (one copy, in
|
|
549
|
+
`/menu`, re-exported here). Only the `cn` import path differs from the
|
|
550
|
+
registry. Never keep a `src/components/ui/` copy of one of them; a missing
|
|
551
|
+
component or prop is an SDK pull request.
|
|
552
|
+
|
|
553
|
+
```css
|
|
554
|
+
/* src/index.css, after Tailwind */
|
|
555
|
+
@import "@makoai/app-sdk/tailwind.css";
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
`tailwind.css` lets Tailwind see the SDK's classes (`@source`) and maps the
|
|
559
|
+
house tokens onto Tailwind's colour names (`bg-popover`,
|
|
560
|
+
`text-muted-foreground`, `bg-brand`, `--radius-*`). It replaces the
|
|
561
|
+
`@theme inline` block each app pasted. The shadcn stack (`radix-ui`,
|
|
562
|
+
`lucide-react`, `clsx`, `tailwind-merge`, `class-variance-authority`) is an
|
|
563
|
+
optional peer set: apps that import neither `/components` nor `/menu` need
|
|
564
|
+
none of it.
|
|
565
|
+
|
|
566
|
+
### Times and dates (2.21)
|
|
567
|
+
|
|
568
|
+
DuckDB runs in UTC, and that stays. Display code decides the zone.
|
|
569
|
+
|
|
570
|
+
```ts
|
|
571
|
+
import { formatDate, formatTime, toDayKey } from "@makoai/app-sdk";
|
|
572
|
+
|
|
573
|
+
formatTime(row.updated_at); // "14:05 CET", "17 Nov, 14:05 CET": the viewer's zone, labelled
|
|
574
|
+
formatDate(row.day); // "18 Nov": a day bucket, never shifted by the viewer's zone
|
|
575
|
+
toDayKey(new Date()); // "2026-11-18": the UTC key for URL state and joins
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
- `formatTime` reads a zone-less timestamp ("2026-11-18 13:05:00", how
|
|
579
|
+
DuckDB renders `TIMESTAMP`) as UTC. It shows the date when the instant
|
|
580
|
+
is not today in the viewer's zone, and the year when it is not this year.
|
|
581
|
+
- `formatDate` takes a "YYYY-MM-DD" string or a parquet `date` (its UTC
|
|
582
|
+
midnight) and prints that calendar day in every zone.
|
|
583
|
+
- `toInstant` turns any of these, epoch ms or epoch µs (bigint), into a `Date`.
|
|
584
|
+
|
|
585
|
+
### Lint: `npx mako-app-lint` (2.21)
|
|
586
|
+
|
|
587
|
+
Run it in an app folder (or pass several). It exits 1 on a finding;
|
|
588
|
+
`--warn` only prints.
|
|
589
|
+
|
|
590
|
+
- `utc-display`: `getUTC*`, `timeZone: "UTC"` or `toISOString().slice` in
|
|
591
|
+
`src/`. A date key the helpers cannot build takes
|
|
592
|
+
`// mako-lint-ignore utc-display` on its line.
|
|
593
|
+
- `local-shadcn`: a `src/components/ui/<name>.tsx` the SDK ships.
|
|
594
|
+
|
|
466
595
|
### Chart tooltips: `TableTooltip` (2.10+, every series from 2.15)
|
|
467
596
|
|
|
468
597
|
Every chart tooltip is a table, never recharts' coloured `name : value` list:
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { cn } from "../menu/utils"
|
|
4
|
+
import { Slot } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(
|
|
7
|
+
"inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
12
|
+
secondary:
|
|
13
|
+
"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
14
|
+
destructive:
|
|
15
|
+
"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
|
|
16
|
+
outline:
|
|
17
|
+
"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
18
|
+
ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
19
|
+
link: "text-primary underline-offset-4 [a&]:hover:underline",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: "default",
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
function Badge({
|
|
29
|
+
className,
|
|
30
|
+
variant = "default",
|
|
31
|
+
asChild = false,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<"span"> &
|
|
34
|
+
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
35
|
+
const Comp = asChild ? Slot.Root : "span"
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Comp
|
|
39
|
+
data-slot="badge"
|
|
40
|
+
data-variant={variant}
|
|
41
|
+
className={cn(badgeVariants({ variant }), className)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { Badge, badgeVariants }
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { cn } from "../menu/utils"
|
|
4
|
+
import { Slot } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
12
|
+
destructive:
|
|
13
|
+
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
14
|
+
outline:
|
|
15
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
16
|
+
secondary:
|
|
17
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
18
|
+
ghost:
|
|
19
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
24
|
+
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
25
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
26
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
+
icon: "size-9",
|
|
28
|
+
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
29
|
+
"icon-sm": "size-8",
|
|
30
|
+
"icon-lg": "size-10",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
variant: "default",
|
|
35
|
+
size: "default",
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
function Button({
|
|
41
|
+
className,
|
|
42
|
+
variant = "default",
|
|
43
|
+
size = "default",
|
|
44
|
+
asChild = false,
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<"button"> &
|
|
47
|
+
VariantProps<typeof buttonVariants> & {
|
|
48
|
+
asChild?: boolean
|
|
49
|
+
}) {
|
|
50
|
+
const Comp = asChild ? Slot.Root : "button"
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Comp
|
|
54
|
+
data-slot="button"
|
|
55
|
+
data-variant={variant}
|
|
56
|
+
data-size={size}
|
|
57
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "../menu/utils"
|
|
3
|
+
|
|
4
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
data-slot="card"
|
|
8
|
+
className={cn(
|
|
9
|
+
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
|
|
10
|
+
className
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
data-slot="card-header"
|
|
21
|
+
className={cn(
|
|
22
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
data-slot="card-title"
|
|
34
|
+
className={cn("leading-none font-semibold", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
data-slot="card-description"
|
|
44
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
data-slot="card-action"
|
|
54
|
+
className={cn(
|
|
55
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
data-slot="card-content"
|
|
67
|
+
className={cn("px-6", className)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
data-slot="card-footer"
|
|
77
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
Card,
|
|
85
|
+
CardHeader,
|
|
86
|
+
CardFooter,
|
|
87
|
+
CardTitle,
|
|
88
|
+
CardAction,
|
|
89
|
+
CardDescription,
|
|
90
|
+
CardContent,
|
|
91
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "../menu/utils"
|
|
5
|
+
import { XIcon } from "lucide-react"
|
|
6
|
+
import { Dialog as DialogPrimitive } from "radix-ui"
|
|
7
|
+
|
|
8
|
+
import { Button } from "./button"
|
|
9
|
+
|
|
10
|
+
function Dialog({
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
13
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function DialogTrigger({
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
19
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function DialogPortal({
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
25
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function DialogClose({
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
31
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function DialogOverlay({
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
38
|
+
return (
|
|
39
|
+
<DialogPrimitive.Overlay
|
|
40
|
+
data-slot="dialog-overlay"
|
|
41
|
+
className={cn(
|
|
42
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function DialogContent({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
showCloseButton = true,
|
|
54
|
+
...props
|
|
55
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
56
|
+
showCloseButton?: boolean
|
|
57
|
+
}) {
|
|
58
|
+
return (
|
|
59
|
+
<DialogPortal data-slot="dialog-portal">
|
|
60
|
+
<DialogOverlay />
|
|
61
|
+
<DialogPrimitive.Content
|
|
62
|
+
data-slot="dialog-content"
|
|
63
|
+
className={cn(
|
|
64
|
+
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
{showCloseButton && (
|
|
71
|
+
<DialogPrimitive.Close
|
|
72
|
+
data-slot="dialog-close"
|
|
73
|
+
className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
74
|
+
>
|
|
75
|
+
<XIcon />
|
|
76
|
+
<span className="sr-only">Close</span>
|
|
77
|
+
</DialogPrimitive.Close>
|
|
78
|
+
)}
|
|
79
|
+
</DialogPrimitive.Content>
|
|
80
|
+
</DialogPortal>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
data-slot="dialog-header"
|
|
88
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function DialogFooter({
|
|
95
|
+
className,
|
|
96
|
+
showCloseButton = false,
|
|
97
|
+
children,
|
|
98
|
+
...props
|
|
99
|
+
}: React.ComponentProps<"div"> & {
|
|
100
|
+
showCloseButton?: boolean
|
|
101
|
+
}) {
|
|
102
|
+
return (
|
|
103
|
+
<div
|
|
104
|
+
data-slot="dialog-footer"
|
|
105
|
+
className={cn(
|
|
106
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
107
|
+
className
|
|
108
|
+
)}
|
|
109
|
+
{...props}
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
{showCloseButton && (
|
|
113
|
+
<DialogPrimitive.Close asChild>
|
|
114
|
+
<Button variant="outline">Close</Button>
|
|
115
|
+
</DialogPrimitive.Close>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function DialogTitle({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
125
|
+
return (
|
|
126
|
+
<DialogPrimitive.Title
|
|
127
|
+
data-slot="dialog-title"
|
|
128
|
+
className={cn("text-lg leading-none font-semibold", className)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function DialogDescription({
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
138
|
+
return (
|
|
139
|
+
<DialogPrimitive.Description
|
|
140
|
+
data-slot="dialog-description"
|
|
141
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
Dialog,
|
|
149
|
+
DialogClose,
|
|
150
|
+
DialogContent,
|
|
151
|
+
DialogDescription,
|
|
152
|
+
DialogFooter,
|
|
153
|
+
DialogHeader,
|
|
154
|
+
DialogOverlay,
|
|
155
|
+
DialogPortal,
|
|
156
|
+
DialogTitle,
|
|
157
|
+
DialogTrigger,
|
|
158
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @makoai/app-sdk/components (2.21): stock shadcn/ui (new-york-v4, as
|
|
2
|
+
// shipped by the shadcn registry; only the `cn` import path changed). One
|
|
3
|
+
// copy per component: DropdownMenu and Checkbox live in ../menu and are
|
|
4
|
+
// re-exported here. A missing component or prop is an SDK pull request,
|
|
5
|
+
// never an app copy. TypeScript source: the app's Vite compiles it, and the
|
|
6
|
+
// app's CSS imports "@makoai/app-sdk/tailwind.css" so Tailwind sees it.
|
|
7
|
+
export * from "./badge";
|
|
8
|
+
export * from "./button";
|
|
9
|
+
export * from "./card";
|
|
10
|
+
export * from "./dialog";
|
|
11
|
+
export * from "./input";
|
|
12
|
+
export * from "./popover";
|
|
13
|
+
export * from "./separator";
|
|
14
|
+
export * from "./skeleton";
|
|
15
|
+
export * from "./tabs";
|
|
16
|
+
export * from "./tooltip";
|
|
17
|
+
export * from "../menu/dropdown-menu";
|
|
18
|
+
export { Checkbox } from "../menu/checkbox";
|
|
19
|
+
export { cn } from "../menu/utils";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "../menu/utils"
|
|
3
|
+
|
|
4
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
5
|
+
return (
|
|
6
|
+
<input
|
|
7
|
+
type={type}
|
|
8
|
+
data-slot="input"
|
|
9
|
+
className={cn(
|
|
10
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
11
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
12
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { Input }
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "../menu/utils"
|
|
5
|
+
import { Popover as PopoverPrimitive } from "radix-ui"
|
|
6
|
+
|
|
7
|
+
function Popover({
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
10
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function PopoverTrigger({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
16
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function PopoverContent({
|
|
20
|
+
className,
|
|
21
|
+
align = "center",
|
|
22
|
+
sideOffset = 4,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
25
|
+
return (
|
|
26
|
+
<PopoverPrimitive.Portal>
|
|
27
|
+
<PopoverPrimitive.Content
|
|
28
|
+
data-slot="popover-content"
|
|
29
|
+
align={align}
|
|
30
|
+
sideOffset={sideOffset}
|
|
31
|
+
className={cn(
|
|
32
|
+
"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
</PopoverPrimitive.Portal>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function PopoverAnchor({
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
44
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
data-slot="popover-header"
|
|
51
|
+
className={cn("flex flex-col gap-1 text-sm", className)}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
data-slot="popover-title"
|
|
61
|
+
className={cn("font-medium", className)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function PopoverDescription({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}: React.ComponentProps<"p">) {
|
|
71
|
+
return (
|
|
72
|
+
<p
|
|
73
|
+
data-slot="popover-description"
|
|
74
|
+
className={cn("text-muted-foreground", className)}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export {
|
|
81
|
+
Popover,
|
|
82
|
+
PopoverTrigger,
|
|
83
|
+
PopoverContent,
|
|
84
|
+
PopoverAnchor,
|
|
85
|
+
PopoverHeader,
|
|
86
|
+
PopoverTitle,
|
|
87
|
+
PopoverDescription,
|
|
88
|
+
}
|