@momoi-labs/kiso-react 0.2.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/LICENSE +21 -0
- package/README.md +85 -0
- package/SHADCN-LICENSE +21 -0
- package/dist/alert-dialog.d.ts +15 -0
- package/dist/alert-dialog.js +40 -0
- package/dist/badge.d.ts +9 -0
- package/dist/badge.js +16 -0
- package/dist/brand-mark.d.ts +3 -0
- package/dist/brand-mark.js +8 -0
- package/dist/button.d.ts +10 -0
- package/dist/button.js +21 -0
- package/dist/card.d.ts +9 -0
- package/dist/card.js +24 -0
- package/dist/checkbox.d.ts +4 -0
- package/dist/checkbox.js +9 -0
- package/dist/form-field.d.ts +6 -0
- package/dist/form-field.js +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +13 -0
- package/dist/input.d.ts +3 -0
- package/dist/input.js +6 -0
- package/dist/label.d.ts +4 -0
- package/dist/label.js +9 -0
- package/dist/styles.css +111 -0
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +1 -0
- package/dist/table.d.ts +10 -0
- package/dist/table.js +29 -0
- package/dist/terminal-icon.d.ts +3 -0
- package/dist/terminal-icon.js +6 -0
- package/dist/theme-selector.d.ts +4 -0
- package/dist/theme-selector.js +23 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Momoi Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Kiso React
|
|
2
|
+
|
|
3
|
+
React components that use Kiso's tokens and CSS, adapted from shadcn/ui with
|
|
4
|
+
Radix handling interactive behavior. Requires React 19 and React DOM 19.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm install @momoi-labs/kiso-react
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Import the stylesheet once, before application overrides:
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import '@momoi-labs/kiso-react/styles.css';
|
|
14
|
+
import { Button, FormField } from '@momoi-labs/kiso-react';
|
|
15
|
+
|
|
16
|
+
export function ApplicationForm() {
|
|
17
|
+
return (
|
|
18
|
+
<form>
|
|
19
|
+
<FormField name="name" label="Name" hint="Choose a unique name." required />
|
|
20
|
+
<Button type="submit" variant="primary">Save</Button>
|
|
21
|
+
</form>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`@momoi-labs/kiso` is a regular dependency. The stylesheet imports its tokens
|
|
27
|
+
and component layer; consumers do not need to import those again. React and
|
|
28
|
+
React DOM are peer dependencies supplied by the application. No Tailwind setup
|
|
29
|
+
is required. The Kiso base stylesheet includes global styles and Google Fonts.
|
|
30
|
+
|
|
31
|
+
## Available components
|
|
32
|
+
|
|
33
|
+
- Button and `buttonVariants`; Badge and `badgeVariants`.
|
|
34
|
+
- BrandMark and TerminalIcon, the momoi-labs terminal prompt glyph.
|
|
35
|
+
- Input, Label, Checkbox, and FormField.
|
|
36
|
+
- Card, CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter.
|
|
37
|
+
- Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption.
|
|
38
|
+
- AlertDialog, Trigger, Portal, Overlay, Content, Header, Footer, Title,
|
|
39
|
+
Description, Action, and Cancel (each prefixed with `AlertDialog`).
|
|
40
|
+
- ThemeSelector, a controlled selector. The application owns theme persistence
|
|
41
|
+
and applies `data-theme="light"` or `data-theme="dark"` to the document root.
|
|
42
|
+
Remove the attribute for system mode.
|
|
43
|
+
|
|
44
|
+
Button variants are `default`, `primary`, `destructive`, and `ghost`; sizes are
|
|
45
|
+
`xs`, `sm`, `md`, and `lg`. Badge variants are `neutral`, `info`, `success`,
|
|
46
|
+
`warning`, and `danger`. Native props and refs pass through to the underlying
|
|
47
|
+
control. FormField adds `label` and optional `hint` to Input's props.
|
|
48
|
+
|
|
49
|
+
Compose confirmations with AlertDialogTitle and AlertDialogDescription inside
|
|
50
|
+
AlertDialogContent, plus AlertDialogCancel and AlertDialogAction. For asynchronous
|
|
51
|
+
actions, control `open` and prevent the Action's default click behavior until the
|
|
52
|
+
operation succeeds. Application code owns pending, error, and retry states.
|
|
53
|
+
|
|
54
|
+
BrandMark takes a letter or a single SVG icon as `children`. It hides itself
|
|
55
|
+
from assistive technology; keep the product name beside it. SVG children get
|
|
56
|
+
the existing `icon icon-sm` classes. Custom icons must forward `className`.
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { BrandMark, TerminalIcon } from '@momoi-labs/kiso-react';
|
|
60
|
+
|
|
61
|
+
<div className="brand">
|
|
62
|
+
<BrandMark>S</BrandMark>
|
|
63
|
+
<span>self-host</span>
|
|
64
|
+
</div>
|
|
65
|
+
<div className="brand">
|
|
66
|
+
<BrandMark><TerminalIcon /></BrandMark>
|
|
67
|
+
<span>self-host</span>
|
|
68
|
+
</div>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The gallery covers all 36 Kiso catalog entries. Entries labelled Composition
|
|
72
|
+
preview are examples, not additional exports from this package. CommandPalette
|
|
73
|
+
is a layout preview without complete command keyboard behavior.
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
From the repository root, run `npm ci`, then `npm run prototype`.
|
|
78
|
+
The console opens at <http://127.0.0.1:5173/#overview> and the component gallery at
|
|
79
|
+
<http://127.0.0.1:5173/#components>. All console data is simulated in memory.
|
|
80
|
+
|
|
81
|
+
`npm run check:react` builds the demo and tests packed npm artifacts in an
|
|
82
|
+
isolated consumer, including TypeScript, CSS bundling, and rendered semantics.
|
|
83
|
+
|
|
84
|
+
See [Publishing Kiso](../../docs/publishing.md) for releases. Adapted shadcn/ui
|
|
85
|
+
code retains its upstream MIT notice in `SHADCN-LICENSE`.
|
package/SHADCN-LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 shadcn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
declare function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>): React.JSX.Element;
|
|
5
|
+
declare function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>): React.JSX.Element;
|
|
6
|
+
declare function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>): React.JSX.Element;
|
|
7
|
+
declare function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): React.JSX.Element;
|
|
8
|
+
declare function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
|
|
9
|
+
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): React.JSX.Element;
|
|
12
|
+
declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Description>): React.JSX.Element;
|
|
13
|
+
declare function AlertDialogAction({ className, variant, size, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Action> & Pick<React.ComponentProps<typeof Button>, "variant" | "size">): React.JSX.Element;
|
|
14
|
+
declare function AlertDialogCancel({ className, variant, size, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> & Pick<React.ComponentProps<typeof Button>, "variant" | "size">): React.JSX.Element;
|
|
15
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Adapted from shadcn/ui new-york-v4. See ../SHADCN-LICENSE.
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { clsx as cn } from "clsx";
|
|
5
|
+
import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
function AlertDialog({ ...props }) {
|
|
8
|
+
return _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
9
|
+
}
|
|
10
|
+
function AlertDialogTrigger({ ...props }) {
|
|
11
|
+
return (_jsx(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props }));
|
|
12
|
+
}
|
|
13
|
+
function AlertDialogPortal({ ...props }) {
|
|
14
|
+
return (_jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props }));
|
|
15
|
+
}
|
|
16
|
+
function AlertDialogOverlay({ className, ...props }) {
|
|
17
|
+
return (_jsx(AlertDialogPrimitive.Overlay, { "data-slot": "alert-dialog-overlay", className: cn("kiso-react-overlay", className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function AlertDialogContent({ className, ...props }) {
|
|
20
|
+
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, { "aria-modal": "true", "data-slot": "alert-dialog-content", className: cn("kiso-react-dialog marked", className), ...props })] }));
|
|
21
|
+
}
|
|
22
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
23
|
+
return (_jsx("div", { "data-slot": "alert-dialog-header", className: cn("dialog-header", className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
26
|
+
return (_jsx("div", { "data-slot": "alert-dialog-footer", className: cn("dialog-footer", className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
29
|
+
return (_jsx(AlertDialogPrimitive.Title, { "data-slot": "alert-dialog-title", className: cn("t-h3", className), ...props }));
|
|
30
|
+
}
|
|
31
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
32
|
+
return (_jsx(AlertDialogPrimitive.Description, { "data-slot": "alert-dialog-description", className: cn("muted", className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
function AlertDialogAction({ className, variant = "default", size = "md", ...props }) {
|
|
35
|
+
return (_jsx(Button, { variant: variant, size: size, asChild: true, children: _jsx(AlertDialogPrimitive.Action, { "data-slot": "alert-dialog-action", className: cn(className), ...props }) }));
|
|
36
|
+
}
|
|
37
|
+
function AlertDialogCancel({ className, variant = "default", size = "md", ...props }) {
|
|
38
|
+
return (_jsx(Button, { variant: variant, size: size, asChild: true, children: _jsx(AlertDialogPrimitive.Cancel, { "data-slot": "alert-dialog-cancel", className: cn(className), ...props }) }));
|
|
39
|
+
}
|
|
40
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
package/dist/badge.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "danger" | "info" | "neutral" | "success" | "warning" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
export { Badge, badgeVariants };
|
package/dist/badge.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { clsx as cn } from "clsx";
|
|
4
|
+
import { Slot } from "radix-ui";
|
|
5
|
+
const badgeVariants = cva("badge", {
|
|
6
|
+
variants: { variant: {
|
|
7
|
+
neutral: "", info: "badge-info", success: "badge-success",
|
|
8
|
+
warning: "badge-warning", danger: "badge-danger",
|
|
9
|
+
} },
|
|
10
|
+
defaultVariants: { variant: "neutral" },
|
|
11
|
+
});
|
|
12
|
+
function Badge({ className, variant = "neutral", asChild = false, ...props }) {
|
|
13
|
+
const Comp = asChild ? Slot.Root : "span";
|
|
14
|
+
return (_jsx(Comp, { "data-slot": "badge", "data-variant": variant, className: cn(badgeVariants({ variant }), className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { clsx as cn } from "clsx";
|
|
4
|
+
import { Slot } from "radix-ui";
|
|
5
|
+
function BrandMark({ className, children, ...props }) {
|
|
6
|
+
return (_jsx("span", { "data-slot": "brand-mark", className: cn("brand-mark", className), ...props, "aria-hidden": "true", children: React.isValidElement(children) ? (_jsx(Slot.Root, { className: "icon icon-sm", children: children })) : children }));
|
|
7
|
+
}
|
|
8
|
+
export { BrandMark };
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "destructive" | "ghost" | "primary" | null | undefined;
|
|
5
|
+
size?: "lg" | "md" | "sm" | "xs" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { clsx as cn } from "clsx";
|
|
4
|
+
import { Slot } from "radix-ui";
|
|
5
|
+
const buttonVariants = cva("btn", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "btn-outline",
|
|
9
|
+
primary: "btn-primary",
|
|
10
|
+
destructive: "btn-danger",
|
|
11
|
+
ghost: "btn-ghost",
|
|
12
|
+
},
|
|
13
|
+
size: { xs: "btn-xs", sm: "btn-sm", md: "", lg: "btn-lg" },
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: { variant: "default", size: "md" },
|
|
16
|
+
});
|
|
17
|
+
function Button({ className, variant = "default", size = "md", asChild = false, ...props }) {
|
|
18
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
19
|
+
return (_jsx(Comp, { ...(!asChild ? { type: "button" } : {}), "data-slot": "button", "data-variant": variant, "data-size": size, className: cn(buttonVariants({ variant, size, className })), ...props }));
|
|
20
|
+
}
|
|
21
|
+
export { Button, buttonVariants };
|
package/dist/card.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Card({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
3
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
4
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
5
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
6
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
package/dist/card.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as cn } from "clsx";
|
|
3
|
+
function Card({ className, ...props }) {
|
|
4
|
+
return (_jsx("div", { "data-slot": "card", className: cn("card", className), ...props }));
|
|
5
|
+
}
|
|
6
|
+
function CardHeader({ className, ...props }) {
|
|
7
|
+
return (_jsx("div", { "data-slot": "card-header", className: cn("card-header", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
function CardTitle({ className, ...props }) {
|
|
10
|
+
return (_jsx("div", { "data-slot": "card-title", className: cn("t-h3", className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
function CardDescription({ className, ...props }) {
|
|
13
|
+
return (_jsx("div", { "data-slot": "card-description", className: cn("muted t-label", className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
function CardAction({ className, ...props }) {
|
|
16
|
+
return (_jsx("div", { "data-slot": "card-action", className: cn("", className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function CardContent({ className, ...props }) {
|
|
19
|
+
return (_jsx("div", { "data-slot": "card-content", className: cn("card-body", className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function CardFooter({ className, ...props }) {
|
|
22
|
+
return (_jsx("div", { "data-slot": "card-footer", className: cn("card-footer", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Adapted from shadcn/ui new-york-v4. See ../SHADCN-LICENSE.
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { clsx as cn } from "clsx";
|
|
5
|
+
import { Checkbox as CheckboxPrimitive } from "radix-ui";
|
|
6
|
+
function Checkbox({ className, ...props }) {
|
|
7
|
+
return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn("kiso-checkbox", className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "checkbox-indicator", children: _jsxs("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: [_jsx("path", { className: "checkbox-check", d: "m3 8 3 3 7-7", fill: "none", stroke: "currentColor", strokeWidth: "2" }), _jsx("path", { className: "checkbox-mixed", d: "M3 8h10", fill: "none", stroke: "currentColor", strokeWidth: "2" })] }) }) }));
|
|
8
|
+
}
|
|
9
|
+
export { Checkbox };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { Input } from "./input.js";
|
|
3
|
+
export declare function FormField({ label, hint, id: providedId, "aria-describedby": describedBy, ...props }: ComponentProps<typeof Input> & {
|
|
4
|
+
label: string;
|
|
5
|
+
hint?: string;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { Input } from "./input.js";
|
|
5
|
+
import { Label } from "./label.js";
|
|
6
|
+
export function FormField({ label, hint, id: providedId, "aria-describedby": describedBy, ...props }) {
|
|
7
|
+
const generatedId = useId();
|
|
8
|
+
const id = providedId ?? generatedId;
|
|
9
|
+
const description = [describedBy, hint ? `${id}-help` : undefined]
|
|
10
|
+
.filter(Boolean).join(" ") || undefined;
|
|
11
|
+
return (_jsxs("div", { className: "field", children: [_jsx(Label, { htmlFor: id, children: label }), _jsx(Input, { ...props, id: id, "aria-describedby": description }), hint && (_jsx("small", { className: "field-hint", id: `${id}-help`, children: hint }))] }));
|
|
12
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./alert-dialog.js";
|
|
2
|
+
export * from "./badge.js";
|
|
3
|
+
export * from "./brand-mark.js";
|
|
4
|
+
export * from "./button.js";
|
|
5
|
+
export * from "./card.js";
|
|
6
|
+
export * from "./checkbox.js";
|
|
7
|
+
export * from "./form-field.js";
|
|
8
|
+
export * from "./input.js";
|
|
9
|
+
export * from "./label.js";
|
|
10
|
+
export * from "./table.js";
|
|
11
|
+
export * from "./terminal-icon.js";
|
|
12
|
+
export * from "./theme-selector.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export * from "./alert-dialog.js";
|
|
3
|
+
export * from "./badge.js";
|
|
4
|
+
export * from "./brand-mark.js";
|
|
5
|
+
export * from "./button.js";
|
|
6
|
+
export * from "./card.js";
|
|
7
|
+
export * from "./checkbox.js";
|
|
8
|
+
export * from "./form-field.js";
|
|
9
|
+
export * from "./input.js";
|
|
10
|
+
export * from "./label.js";
|
|
11
|
+
export * from "./table.js";
|
|
12
|
+
export * from "./terminal-icon.js";
|
|
13
|
+
export * from "./theme-selector.js";
|
package/dist/input.d.ts
ADDED
package/dist/input.js
ADDED
package/dist/label.d.ts
ADDED
package/dist/label.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Adapted from shadcn/ui new-york-v4. See ../SHADCN-LICENSE.
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { clsx as cn } from "clsx";
|
|
5
|
+
import { Label as LabelPrimitive } from "radix-ui";
|
|
6
|
+
function Label({ className, ...props }) {
|
|
7
|
+
return (_jsx(LabelPrimitive.Root, { "data-slot": "label", className: cn("t-label", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
export { Label };
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
@import "@momoi-labs/kiso/tokens.css";
|
|
2
|
+
@import "@momoi-labs/kiso/ui.css";
|
|
3
|
+
|
|
4
|
+
.theme-row {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
gap: var(--spacing-sm);
|
|
9
|
+
padding: var(--spacing-sm);
|
|
10
|
+
}
|
|
11
|
+
.theme-buttons {
|
|
12
|
+
display: flex;
|
|
13
|
+
padding: var(--spacing-2xs);
|
|
14
|
+
border: 1px solid var(--color-border);
|
|
15
|
+
border-radius: var(--radius-lg);
|
|
16
|
+
background: var(--color-muted);
|
|
17
|
+
}
|
|
18
|
+
.theme-buttons .btn[aria-pressed="true"] {
|
|
19
|
+
background: var(--color-card);
|
|
20
|
+
color: var(--color-foreground);
|
|
21
|
+
box-shadow: var(--shadow-xs);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.kiso-checkbox {
|
|
25
|
+
position: relative;
|
|
26
|
+
display: inline-grid;
|
|
27
|
+
place-items: center;
|
|
28
|
+
flex: none;
|
|
29
|
+
width: var(--size-icon-md);
|
|
30
|
+
height: var(--size-icon-md);
|
|
31
|
+
padding: 0;
|
|
32
|
+
border: 1px solid var(--color-input);
|
|
33
|
+
border-radius: var(--radius-sm);
|
|
34
|
+
background: var(--color-card);
|
|
35
|
+
color: var(--color-primary-foreground);
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
box-shadow: var(--shadow-xs);
|
|
38
|
+
}
|
|
39
|
+
.kiso-checkbox[data-state="checked"],
|
|
40
|
+
.kiso-checkbox[data-state="indeterminate"] {
|
|
41
|
+
background: var(--color-primary);
|
|
42
|
+
border-color: var(--color-primary);
|
|
43
|
+
}
|
|
44
|
+
.checkbox-indicator,
|
|
45
|
+
.checkbox-indicator svg {
|
|
46
|
+
display: block;
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
}
|
|
50
|
+
.kiso-checkbox:disabled {
|
|
51
|
+
opacity: 0.5;
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
}
|
|
54
|
+
.kiso-react-overlay {
|
|
55
|
+
position: fixed;
|
|
56
|
+
inset: 0;
|
|
57
|
+
z-index: 50;
|
|
58
|
+
background: var(--color-overlay);
|
|
59
|
+
}
|
|
60
|
+
.kiso-react-dialog {
|
|
61
|
+
position: fixed;
|
|
62
|
+
top: 50%;
|
|
63
|
+
left: 50%;
|
|
64
|
+
z-index: 51;
|
|
65
|
+
transform: translate(-50%, -50%);
|
|
66
|
+
width: min(32rem, calc(100vw - 2 * var(--spacing-lg)));
|
|
67
|
+
background: var(--color-elevated-surface);
|
|
68
|
+
border: 1px solid var(--color-border);
|
|
69
|
+
border-radius: var(--radius-surface);
|
|
70
|
+
box-shadow: var(--shadow-md);
|
|
71
|
+
}
|
|
72
|
+
.dialog-scroll {
|
|
73
|
+
max-height: calc(100dvh - 2 * var(--spacing-xl));
|
|
74
|
+
overflow-y: auto;
|
|
75
|
+
}
|
|
76
|
+
.kiso-react-dialog .dialog-header {
|
|
77
|
+
display: grid;
|
|
78
|
+
gap: var(--spacing-sm);
|
|
79
|
+
}
|
|
80
|
+
.kiso-react-dialog .dialog-body {
|
|
81
|
+
display: grid;
|
|
82
|
+
gap: var(--spacing-md);
|
|
83
|
+
}
|
|
84
|
+
.kiso-react-dialog .dialog-footer {
|
|
85
|
+
flex-wrap: wrap;
|
|
86
|
+
}
|
|
87
|
+
.kiso-react-dialog .alert:focus {
|
|
88
|
+
outline: 2px solid var(--color-focus);
|
|
89
|
+
outline-offset: 2px;
|
|
90
|
+
}
|
|
91
|
+
.btn[aria-busy="true"] {
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
.btn[aria-busy="true"] .spinner {
|
|
95
|
+
border-color: currentColor;
|
|
96
|
+
border-right-color: transparent;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@media (pointer: coarse) {
|
|
100
|
+
.kiso-checkbox::before {
|
|
101
|
+
content: "";
|
|
102
|
+
position: absolute;
|
|
103
|
+
width: var(--size-touch-min);
|
|
104
|
+
height: var(--size-touch-min);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.kiso-checkbox .checkbox-mixed,
|
|
109
|
+
.kiso-checkbox[data-state="indeterminate"] .checkbox-check { display: none; }
|
|
110
|
+
.kiso-checkbox[data-state="indeterminate"] .checkbox-mixed { display: block; }
|
|
111
|
+
.kiso-react-dialog { max-height: calc(100dvh - 2 * var(--spacing-lg)); overflow-y: auto; }
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Adapted from shadcn/ui new-york-v4. See ../SHADCN-LICENSE.
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { clsx as cn } from "clsx";
|
|
5
|
+
function Table({ className, ...props }) {
|
|
6
|
+
return (_jsx("div", { "data-slot": "table-container", className: "table-scroll", children: _jsx("table", { "data-slot": "table", className: cn("table", className), ...props }) }));
|
|
7
|
+
}
|
|
8
|
+
function TableHeader({ className, ...props }) {
|
|
9
|
+
return (_jsx("thead", { "data-slot": "table-header", className: cn("", className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
function TableBody({ className, ...props }) {
|
|
12
|
+
return (_jsx("tbody", { "data-slot": "table-body", className: cn("", className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
function TableFooter({ className, ...props }) {
|
|
15
|
+
return (_jsx("tfoot", { "data-slot": "table-footer", className: cn("", className), ...props }));
|
|
16
|
+
}
|
|
17
|
+
function TableRow({ className, ...props }) {
|
|
18
|
+
return (_jsx("tr", { "data-slot": "table-row", className: cn("", className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function TableHead({ className, ...props }) {
|
|
21
|
+
return (_jsx("th", { scope: "col", "data-slot": "table-head", className: cn("", className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
function TableCell({ className, ...props }) {
|
|
24
|
+
return (_jsx("td", { "data-slot": "table-cell", className: cn("", className), ...props }));
|
|
25
|
+
}
|
|
26
|
+
function TableCaption({ className, ...props }) {
|
|
27
|
+
return (_jsx("caption", { "data-slot": "table-caption", className: cn("muted", className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as cn } from "clsx";
|
|
3
|
+
function TerminalIcon({ className, ...props }) {
|
|
4
|
+
return (_jsxs("svg", { "data-slot": "terminal-icon", className: cn("icon", className), viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", ...props, children: [_jsx("path", { d: "M4 4.5L8 8l-4 3.5" }), _jsx("path", { d: "M9.5 11.5H13" })] }));
|
|
5
|
+
}
|
|
6
|
+
export { TerminalIcon };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
export function ThemeSelector({ theme, onChange, }) {
|
|
5
|
+
const options = [
|
|
6
|
+
{
|
|
7
|
+
value: "system",
|
|
8
|
+
label: "Follow system",
|
|
9
|
+
path: "M2 2h12v9H2zM8 11v3M5 14h6",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: "light",
|
|
13
|
+
label: "Light theme",
|
|
14
|
+
path: "M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM8 0v2m0 12v2M0 8h2m12 0h2M2 2l2 2m8 8 2 2M2 14l2-2M12 4l2-2",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "dark",
|
|
18
|
+
label: "Dark theme",
|
|
19
|
+
path: "M13.5 10A6 6 0 0 1 6 2.5a6 6 0 1 0 7.5 7.5Z",
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
return (_jsxs("div", { className: "theme-row", children: [_jsx("span", { className: "t-label", children: "Theme" }), _jsx("div", { className: "theme-buttons", role: "group", "aria-label": "Theme", children: options.map((option) => (_jsx(Button, { variant: "ghost", size: "sm", className: "btn-icon", "aria-label": option.label, title: option.label, "aria-pressed": theme === option.value, onClick: () => onChange(option.value), children: _jsx("svg", { className: "icon icon-sm", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", "aria-hidden": "true", children: _jsx("path", { d: option.path }) }) }, option.value))) })] }));
|
|
23
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@momoi-labs/kiso-react",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Kiso React components built with shadcn/ui and Radix",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/momoi-labs/blueprint.git",
|
|
10
|
+
"directory": "packages/kiso-react"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/",
|
|
14
|
+
"SHADCN-LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./styles.css": {
|
|
22
|
+
"types": "./dist/styles.d.ts",
|
|
23
|
+
"default": "./dist/styles.css"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"sideEffects": [
|
|
28
|
+
"**/*.css"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.json && node -e \"require('node:fs').copyFileSync('src/styles.css', 'dist/styles.css')\"",
|
|
32
|
+
"prepack": "npm run build"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@momoi-labs/kiso": "^0.5.0",
|
|
36
|
+
"class-variance-authority": "0.7.1",
|
|
37
|
+
"clsx": "2.1.1",
|
|
38
|
+
"radix-ui": "1.6.7"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"react": "^19.0.0",
|
|
42
|
+
"react-dom": "^19.0.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/react": "19.2.18",
|
|
46
|
+
"@types/react-dom": "19.2.7",
|
|
47
|
+
"typescript": "7.0.2"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public",
|
|
51
|
+
"provenance": true
|
|
52
|
+
}
|
|
53
|
+
}
|