@xingxingmofashu/ui 0.1.0-beta.2 → 0.1.1
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 +115 -66
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/{accordion.js → accordion.mjs} +1 -1
- package/dist/components/{alert-dialog.js → alert-dialog.mjs} +2 -2
- package/dist/components/button.d.ts +1 -1
- package/dist/components/{button.js → button.mjs} +1 -1
- package/dist/components/{card.js → card.mjs} +1 -1
- package/dist/components/checkbox.d.ts +4 -2
- package/dist/components/{checkbox.js → checkbox.mjs} +1 -1
- package/dist/components/{dialog.js → dialog.mjs} +1 -1
- package/dist/components/drawer.d.ts +19 -0
- package/dist/components/drawer.mjs +40 -0
- package/dist/components/input.d.ts +2 -2
- package/dist/components/{input.js → input.mjs} +1 -1
- package/dist/components/popover.d.ts +32 -0
- package/dist/components/popover.mjs +59 -0
- package/dist/components/scroll-area.d.ts +21 -0
- package/dist/components/scroll-area.mjs +64 -0
- package/dist/components/{slider.js → slider.mjs} +1 -1
- package/dist/components/switch.d.ts +4 -2
- package/dist/components/{switch.js → switch.mjs} +41 -24
- package/dist/components/toast.d.ts +19 -0
- package/dist/components/toast.mjs +120 -0
- package/dist/components/toggle-group.d.ts +1 -1
- package/dist/components/{toggle-group.js → toggle-group.mjs} +1 -1
- package/dist/components/toggle.d.ts +17 -0
- package/dist/components/toggle.mjs +26 -0
- package/dist/composables/create-toast-manager.d.ts +6 -0
- package/dist/composables/create-toast-manager.mjs +3 -0
- package/dist/composables/use-toast.d.ts +7 -0
- package/dist/composables/use-toast.mjs +4 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +17 -10
- package/dist/index.mjs +27 -0
- package/dist/theme/{button.js → button.mjs} +1 -1
- package/dist/theme/drawer.d.ts +98 -0
- package/dist/theme/drawer.mjs +87 -0
- package/dist/theme/popover.d.ts +80 -0
- package/dist/theme/popover.mjs +42 -0
- package/dist/theme/scroll-area.d.ts +68 -0
- package/dist/theme/scroll-area.mjs +46 -0
- package/dist/theme/{switch.js → switch.mjs} +3 -4
- package/dist/theme/toast.d.ts +107 -0
- package/dist/theme/toast.mjs +104 -0
- package/dist/theme/toggle.d.ts +95 -0
- package/dist/theme/toggle.mjs +64 -0
- package/package.json +16 -9
- package/dist/index.js +0 -14
- /package/dist/theme/{accordion.js → accordion.mjs} +0 -0
- /package/dist/theme/{alert-dialog.js → alert-dialog.mjs} +0 -0
- /package/dist/theme/{card.js → card.mjs} +0 -0
- /package/dist/theme/{checkbox.js → checkbox.mjs} +0 -0
- /package/dist/theme/{dialog.js → dialog.mjs} +0 -0
- /package/dist/theme/{input.js → input.mjs} +0 -0
- /package/dist/theme/{slider.js → slider.mjs} +0 -0
- /package/dist/theme/{toggle-group.js → toggle-group.mjs} +0 -0
package/README.md
CHANGED
|
@@ -1,47 +1,59 @@
|
|
|
1
1
|
# @xingxingmofashu/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![License][license-src]][license-href]
|
|
6
|
+
[![React][react-src]][react-href]
|
|
7
|
+
[![Tailwind CSS][tailwind-src]][tailwind-href]
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Liquid Glass UI is a collection of accessible, typed [React](https://react.dev)
|
|
10
|
+
components built on [Base UI](https://base-ui.com),
|
|
11
|
+
[Tailwind CSS](https://tailwindcss.com), and
|
|
12
|
+
[Tailwind Variants](https://www.tailwind-variants.org). Glass surfaces, rim
|
|
13
|
+
highlights, and inner shadows are drawn entirely with CSS.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
The package ships fifteen components: Accordion, Alert Dialog, Button, Card,
|
|
16
|
+
Checkbox, Dialog, Drawer, Input, Popover, Scroll Area, Slider, Switch, Toast,
|
|
17
|
+
Toggle, and Toggle Group.
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
19
|
+
> [!NOTE]
|
|
20
|
+
> Requires React 19, React DOM 19, Tailwind CSS 4, Node.js 22+, and an
|
|
21
|
+
> ESM-capable bundler. `Card` is server-safe; the interactive components are
|
|
22
|
+
> client components.
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
`Switch`, and `ToggleGroup` are client components. `Card` is server-safe and can be
|
|
20
|
-
rendered from a React Server Component.
|
|
24
|
+
## Documentation
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
- [English documentation](https://xingxingmofashu.github.io/ui/docs/en/get-started)
|
|
27
|
+
- [简体中文文档](https://xingxingmofashu.github.io/ui/docs/zh/get-started)
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash [pnpm]
|
|
32
|
+
pnpm add @xingxingmofashu/ui
|
|
26
33
|
```
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
```bash [yarn]
|
|
36
|
+
yarn add @xingxingmofashu/ui
|
|
37
|
+
```
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
```bash [npm]
|
|
40
|
+
npm install @xingxingmofashu/ui
|
|
41
|
+
```
|
|
32
42
|
|
|
33
|
-
|
|
43
|
+
```bash [bun]
|
|
44
|
+
bun add @xingxingmofashu/ui
|
|
45
|
+
```
|
|
34
46
|
|
|
35
|
-
|
|
36
|
-
@import "tailwindcss";
|
|
37
|
-
@import "@xingxingmofashu/ui/index.css";
|
|
47
|
+
Add the package styles to your Tailwind CSS entry:
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
@
|
|
49
|
+
```css [app.css]
|
|
50
|
+
@import "tailwindcss";
|
|
51
|
+
@import "@xingxingmofashu/ui";
|
|
41
52
|
```
|
|
42
53
|
|
|
43
|
-
The package
|
|
44
|
-
|
|
54
|
+
The package root resolves to `dist/index.css` through its `style` export. The
|
|
55
|
+
stylesheet includes its own Tailwind source scan, so component utilities are
|
|
56
|
+
generated without an extra `@source` directive.
|
|
45
57
|
|
|
46
58
|
## Usage
|
|
47
59
|
|
|
@@ -58,19 +70,47 @@ export function Example() {
|
|
|
58
70
|
}
|
|
59
71
|
```
|
|
60
72
|
|
|
61
|
-
Deep imports
|
|
73
|
+
### Deep imports
|
|
74
|
+
|
|
75
|
+
Import a single component or theme recipe without going through the package
|
|
76
|
+
root:
|
|
62
77
|
|
|
63
78
|
```tsx
|
|
64
79
|
import { Button } from "@xingxingmofashu/ui/components/button";
|
|
65
80
|
import buttonTheme from "@xingxingmofashu/ui/theme/button";
|
|
66
81
|
```
|
|
67
82
|
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
Toast hooks live under `@xingxingmofashu/ui/composables`.
|
|
84
|
+
|
|
85
|
+
## Components
|
|
86
|
+
|
|
87
|
+
### Element
|
|
88
|
+
|
|
89
|
+
- Accordion
|
|
90
|
+
- Button
|
|
91
|
+
- Card
|
|
92
|
+
- Scroll Area
|
|
93
|
+
- Toggle
|
|
94
|
+
- Toggle Group
|
|
95
|
+
|
|
96
|
+
### Form
|
|
97
|
+
|
|
98
|
+
- Checkbox
|
|
99
|
+
- Input
|
|
100
|
+
- Slider
|
|
101
|
+
- Switch
|
|
102
|
+
|
|
103
|
+
### Overlay
|
|
104
|
+
|
|
105
|
+
- Alert Dialog
|
|
106
|
+
- Dialog
|
|
107
|
+
- Drawer
|
|
108
|
+
- Popover
|
|
109
|
+
- Toast
|
|
70
110
|
|
|
71
111
|
## Theming
|
|
72
112
|
|
|
73
|
-
Light and dark
|
|
113
|
+
Light and dark tokens are selected by `.light` / `.dark`, or by
|
|
74
114
|
`data-theme="light"` / `data-theme="dark"`:
|
|
75
115
|
|
|
76
116
|
```html
|
|
@@ -81,32 +121,14 @@ Light and dark values are selected by `.light` / `.dark`, or by
|
|
|
81
121
|
```
|
|
82
122
|
|
|
83
123
|
A nested `.light` / `[data-theme="light"]` subtree can switch back to light
|
|
84
|
-
tokens. Shared colors and glass parameters live in the `--ui-*` tokens
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
`Button`, `Card`, `Checkbox`, `Dialog`, `Input`, `Slider`, `Switch`,
|
|
90
|
-
`ToggleGroup`, `Accordion`, and `AlertDialog` inherit the host font and do not
|
|
91
|
-
force a font family.
|
|
92
|
-
|
|
93
|
-
The visual material relies on modern CSS: `backdrop-filter`, `color-mix`,
|
|
94
|
-
container units, individual `translate` / `scale` properties, and `:has`.
|
|
95
|
-
Use a current evergreen browser.
|
|
96
|
-
|
|
97
|
-
## Components
|
|
98
|
-
|
|
99
|
-
- `Accordion`
|
|
100
|
-
- `AlertDialog`
|
|
101
|
-
- `Button`
|
|
102
|
-
- `Card`
|
|
103
|
-
- `Checkbox`
|
|
104
|
-
- `Dialog`
|
|
105
|
-
- `Input`
|
|
106
|
-
- `Slider`
|
|
107
|
-
- `Switch`
|
|
108
|
-
- `ToggleGroup`
|
|
124
|
+
tokens. Shared colors and glass parameters live in the `--ui-*` tokens; override
|
|
125
|
+
them in your own theme layer. Tailwind aliases use the `ui-` prefix
|
|
126
|
+
(`text-ui-ink`, `outline-ui-glass-focus`, and so on) to avoid colliding with
|
|
127
|
+
host tokens.
|
|
109
128
|
|
|
129
|
+
The components inherit the host font. The visual material relies on modern CSS:
|
|
130
|
+
`backdrop-filter`, `color-mix`, container units, individual `translate` /
|
|
131
|
+
`scale` properties, and `:has`. Use a current evergreen browser.
|
|
110
132
|
|
|
111
133
|
## Development
|
|
112
134
|
|
|
@@ -114,19 +136,46 @@ Use a current evergreen browser.
|
|
|
114
136
|
pnpm install
|
|
115
137
|
pnpm build # build dist with unbuild
|
|
116
138
|
pnpm lint # lint with oxlint
|
|
117
|
-
pnpm lint:fix # apply oxlint's safe fixes
|
|
118
139
|
pnpm test # run the Vitest suite
|
|
119
140
|
pnpm typecheck # typecheck the package
|
|
120
|
-
pnpm docs:dev #
|
|
121
|
-
pnpm
|
|
122
|
-
pnpm playground:dev # start the component playground on port 3002
|
|
141
|
+
pnpm docs:dev # docs site on http://localhost:3001
|
|
142
|
+
pnpm playground:dev # component playground on http://localhost:3002
|
|
123
143
|
```
|
|
124
144
|
|
|
125
|
-
The documentation site lives in `docs/` and
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
The documentation site lives in `docs/` and the playground lives in
|
|
146
|
+
`playground/`; both import the package from the workspace.
|
|
147
|
+
|
|
148
|
+
## Contribution
|
|
149
|
+
|
|
150
|
+
Found a bug? [Open an issue](https://github.com/xingxingmofashu/ui/issues) with
|
|
151
|
+
a reproduction. Before opening a pull request, run `pnpm lint`, `pnpm test`, and
|
|
152
|
+
`pnpm typecheck`.
|
|
153
|
+
|
|
154
|
+
> [!TIP]
|
|
155
|
+
> [`AGENTS.md`](https://github.com/xingxingmofashu/ui/blob/main/AGENTS.md)
|
|
156
|
+
> describes the component, theme, test, and documentation conventions used in
|
|
157
|
+
> this repository.
|
|
158
|
+
|
|
159
|
+
## Credits
|
|
160
|
+
|
|
161
|
+
- [Base UI](https://base-ui.com)
|
|
162
|
+
- [Tailwind CSS](https://tailwindcss.com)
|
|
163
|
+
- [Tailwind Variants](https://www.tailwind-variants.org)
|
|
164
|
+
- [cn](https://github.com/shadcn-ui/cn)
|
|
129
165
|
|
|
130
166
|
## License
|
|
131
167
|
|
|
132
|
-
MIT
|
|
168
|
+
Licensed under the [MIT license](https://github.com/xingxingmofashu/ui/blob/main/LICENSE).
|
|
169
|
+
|
|
170
|
+
<!-- Badges -->
|
|
171
|
+
|
|
172
|
+
[npm-version-src]: https://img.shields.io/npm/v/@xingxingmofashu/ui.svg?style=flat&colorA=18181B&colorB=52525B
|
|
173
|
+
[npm-version-href]: https://www.npmjs.com/package/@xingxingmofashu/ui
|
|
174
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@xingxingmofashu/ui.svg?style=flat&colorA=18181B&colorB=52525B
|
|
175
|
+
[npm-downloads-href]: https://npm.chart.dev/@xingxingmofashu/ui
|
|
176
|
+
[license-src]: https://img.shields.io/github/license/xingxingmofashu/ui.svg?style=flat&colorA=18181B&colorB=52525B
|
|
177
|
+
[license-href]: https://github.com/xingxingmofashu/ui/blob/main/LICENSE
|
|
178
|
+
[react-src]: https://img.shields.io/badge/React-19-18181B?style=flat&logo=react&logoColor=white
|
|
179
|
+
[react-href]: https://react.dev
|
|
180
|
+
[tailwind-src]: https://img.shields.io/badge/Tailwind_CSS-4-18181B?style=flat&logo=tailwindcss&logoColor=white
|
|
181
|
+
[tailwind-href]: https://tailwindcss.com
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Accordion as UIAccordion } from "@base-ui/react/accordion";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { type VariantProps } from "tailwind-variants";
|
|
4
|
-
import theme from "../theme/accordion
|
|
4
|
+
import theme from "../theme/accordion";
|
|
5
5
|
/** One panel managed by the accordion. */
|
|
6
6
|
type AccordionItemProps = {
|
|
7
7
|
/** Value that identifies the item in the accordion value. */
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { AlertDialog as UIAlertDialog } from "@base-ui/react/alert-dialog";
|
|
3
3
|
import { cn } from "cn";
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import theme from "../theme/alert-dialog.
|
|
6
|
-
import { Button } from "./button.
|
|
5
|
+
import theme from "../theme/alert-dialog.mjs";
|
|
6
|
+
import { Button } from "./button.mjs";
|
|
7
7
|
function AlertDialog({
|
|
8
8
|
title,
|
|
9
9
|
description,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ButtonProps as UIButtonProps } from "@base-ui/react/button";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { type VariantProps } from "tailwind-variants";
|
|
4
|
-
import theme from "../theme/button
|
|
4
|
+
import theme from "../theme/button";
|
|
5
5
|
interface ButtonProps extends Omit<UIButtonProps, "ref" | "style" | "className">, VariantProps<typeof theme> {
|
|
6
6
|
/** Ref to the rendered root element. */
|
|
7
7
|
ref?: React.Ref<HTMLElement>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Checkbox as UICheckbox } from "@base-ui/react/checkbox";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { type VariantProps } from "tailwind-variants";
|
|
4
|
-
import theme from "../theme/checkbox
|
|
5
|
-
interface CheckboxProps extends Omit<
|
|
4
|
+
import theme from "../theme/checkbox";
|
|
5
|
+
interface CheckboxProps extends Omit<UICheckbox.Root.Props, "className" | "children" | "style" | "ref">, VariantProps<typeof theme> {
|
|
6
|
+
/** Ref to the rendered root element. */
|
|
7
|
+
ref?: React.Ref<HTMLElement>;
|
|
6
8
|
/** Tailwind classes merged into the Base UI checkbox root. */
|
|
7
9
|
className?: string;
|
|
8
10
|
/** Visible label. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Checkbox as UICheckbox } from "@base-ui/react/checkbox";
|
|
3
3
|
import { cn } from "cn";
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import theme from "../theme/checkbox.
|
|
5
|
+
import theme from "../theme/checkbox.mjs";
|
|
6
6
|
function CheckIcon({ indeterminate }) {
|
|
7
7
|
return /* @__PURE__ */ React.createElement(
|
|
8
8
|
"svg",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Drawer as UIDrawer } from "@base-ui/react/drawer";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface DrawerProps extends Omit<UIDrawer.Root.Props, "children" | "className" | "style" | "swipeDirection"> {
|
|
4
|
+
/** Drawer heading. */
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
/** Supporting copy under the title. */
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
/** Extra content between the description and the footer. */
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
/** Action area rendered at the bottom of the drawer. */
|
|
11
|
+
footer?: React.ReactNode;
|
|
12
|
+
/** Edge the drawer slides in from. */
|
|
13
|
+
direction?: NonNullable<UIDrawer.Root.Props["swipeDirection"]>;
|
|
14
|
+
/** Tailwind classes merged into the popup. */
|
|
15
|
+
className?: any;
|
|
16
|
+
}
|
|
17
|
+
declare function Drawer({ title, description, children, footer, direction, className, ...props }: DrawerProps): React.JSX.Element;
|
|
18
|
+
export { Drawer };
|
|
19
|
+
export type { DrawerProps };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Drawer as UIDrawer } from "@base-ui/react/drawer";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import theme from "../theme/drawer.mjs";
|
|
6
|
+
function Drawer({
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
children,
|
|
10
|
+
footer,
|
|
11
|
+
direction = "down",
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
const ui = theme({ direction });
|
|
16
|
+
return /* @__PURE__ */ React.createElement(UIDrawer.Root, { ...props, swipeDirection: direction }, /* @__PURE__ */ React.createElement(UIDrawer.Portal, null, /* @__PURE__ */ React.createElement(UIDrawer.Backdrop, { "data-slot": "backdrop", className: ui.backdrop() }), /* @__PURE__ */ React.createElement(UIDrawer.Viewport, { "data-slot": "viewport", className: ui.viewport() }, /* @__PURE__ */ React.createElement(
|
|
17
|
+
UIDrawer.Popup,
|
|
18
|
+
{
|
|
19
|
+
"data-slot": "popup",
|
|
20
|
+
className: cn(ui.popup(), className)
|
|
21
|
+
},
|
|
22
|
+
/* @__PURE__ */ React.createElement("span", { "aria-hidden": "true", "data-slot": "glass", className: ui.glass() }, /* @__PURE__ */ React.createElement(
|
|
23
|
+
"span",
|
|
24
|
+
{
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
"data-slot": "overlay",
|
|
27
|
+
className: ui.overlay()
|
|
28
|
+
}
|
|
29
|
+
)),
|
|
30
|
+
/* @__PURE__ */ React.createElement(UIDrawer.Content, { "data-slot": "content", className: ui.content() }, /* @__PURE__ */ React.createElement(UIDrawer.Title, { "data-slot": "title", className: ui.title() }, title), description ? /* @__PURE__ */ React.createElement(
|
|
31
|
+
UIDrawer.Description,
|
|
32
|
+
{
|
|
33
|
+
"data-slot": "description",
|
|
34
|
+
className: ui.description()
|
|
35
|
+
},
|
|
36
|
+
description
|
|
37
|
+
) : null, children ? /* @__PURE__ */ React.createElement("div", { "data-slot": "body", className: ui.body() }, children) : null, footer ? /* @__PURE__ */ React.createElement("div", { "data-slot": "footer", className: ui.footer() }, footer) : null)
|
|
38
|
+
))));
|
|
39
|
+
}
|
|
40
|
+
export { Drawer };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Input as UIInput } from "@base-ui/react/input";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { type VariantProps } from "tailwind-variants";
|
|
4
|
-
import theme from "../theme/input
|
|
5
|
-
interface InputProps extends Omit<
|
|
4
|
+
import theme from "../theme/input";
|
|
5
|
+
interface InputProps extends Omit<UIInput.Props, "className" | "children" | "size" | "style">, VariantProps<typeof theme> {
|
|
6
6
|
/** Tailwind classes merged into the root element. */
|
|
7
7
|
className?: string;
|
|
8
8
|
/** Visible label associated with the input. */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Popover as UIPopover } from "@base-ui/react/popover";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type PositionerProps = React.ComponentProps<typeof UIPopover.Positioner>;
|
|
4
|
+
type PopoverProps = Omit<UIPopover.Root.Props, "children"> & {
|
|
5
|
+
/** Element that opens the popover. It must forward props and refs. */
|
|
6
|
+
trigger: React.ReactElement;
|
|
7
|
+
/** Popover heading. */
|
|
8
|
+
title: React.ReactNode;
|
|
9
|
+
/** Supporting copy under the title. */
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
/** Content between the description and the footer. */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/** Action area rendered at the bottom of the popover. */
|
|
14
|
+
footer?: React.ReactNode;
|
|
15
|
+
/** Whether to render the directional arrow. */
|
|
16
|
+
arrow?: boolean;
|
|
17
|
+
/** Side of the trigger the popover is placed on. */
|
|
18
|
+
side?: PositionerProps["side"];
|
|
19
|
+
/** Alignment of the popover relative to the trigger. */
|
|
20
|
+
align?: PositionerProps["align"];
|
|
21
|
+
/** Distance between the trigger and the popup in pixels. */
|
|
22
|
+
sideOffset?: PositionerProps["sideOffset"];
|
|
23
|
+
/** Offset along the alignment axis in pixels. */
|
|
24
|
+
alignOffset?: PositionerProps["alignOffset"];
|
|
25
|
+
/** Padding between the popup and the edge of the collision boundary. */
|
|
26
|
+
collisionPadding?: PositionerProps["collisionPadding"];
|
|
27
|
+
/** Tailwind classes merged into the popup. */
|
|
28
|
+
className?: any;
|
|
29
|
+
};
|
|
30
|
+
declare function Popover({ trigger, title, description, children, footer, arrow, side, align, sideOffset, alignOffset, collisionPadding, className, ...props }: PopoverProps): React.JSX.Element;
|
|
31
|
+
export { Popover };
|
|
32
|
+
export type { PopoverProps };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Popover as UIPopover } from "@base-ui/react/popover";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import theme from "../theme/popover.mjs";
|
|
6
|
+
function Popover({
|
|
7
|
+
trigger,
|
|
8
|
+
title,
|
|
9
|
+
description,
|
|
10
|
+
children,
|
|
11
|
+
footer,
|
|
12
|
+
arrow = true,
|
|
13
|
+
side,
|
|
14
|
+
align,
|
|
15
|
+
sideOffset = 10,
|
|
16
|
+
alignOffset,
|
|
17
|
+
collisionPadding,
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
const ui = theme();
|
|
22
|
+
return /* @__PURE__ */ React.createElement(UIPopover.Root, { ...props }, /* @__PURE__ */ React.createElement(UIPopover.Trigger, { render: trigger }), /* @__PURE__ */ React.createElement(UIPopover.Portal, null, /* @__PURE__ */ React.createElement(
|
|
23
|
+
UIPopover.Positioner,
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "positioner",
|
|
26
|
+
side,
|
|
27
|
+
align,
|
|
28
|
+
sideOffset,
|
|
29
|
+
alignOffset,
|
|
30
|
+
collisionPadding,
|
|
31
|
+
className: ui.positioner()
|
|
32
|
+
},
|
|
33
|
+
/* @__PURE__ */ React.createElement(
|
|
34
|
+
UIPopover.Popup,
|
|
35
|
+
{
|
|
36
|
+
"data-slot": "popup",
|
|
37
|
+
className: cn(ui.popup(), className)
|
|
38
|
+
},
|
|
39
|
+
/* @__PURE__ */ React.createElement("span", { "aria-hidden": "true", "data-slot": "glass", className: ui.glass() }, /* @__PURE__ */ React.createElement(
|
|
40
|
+
"span",
|
|
41
|
+
{
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
"data-slot": "overlay",
|
|
44
|
+
className: ui.overlay()
|
|
45
|
+
}
|
|
46
|
+
)),
|
|
47
|
+
arrow ? /* @__PURE__ */ React.createElement(UIPopover.Arrow, { "data-slot": "arrow", className: ui.arrow() }) : null,
|
|
48
|
+
/* @__PURE__ */ React.createElement("div", { "data-slot": "content", className: ui.content() }, /* @__PURE__ */ React.createElement(UIPopover.Title, { "data-slot": "title", className: ui.title() }, title), description ? /* @__PURE__ */ React.createElement(
|
|
49
|
+
UIPopover.Description,
|
|
50
|
+
{
|
|
51
|
+
"data-slot": "description",
|
|
52
|
+
className: ui.description()
|
|
53
|
+
},
|
|
54
|
+
description
|
|
55
|
+
) : null, children ? /* @__PURE__ */ React.createElement("div", { "data-slot": "body", className: ui.body() }, children) : null, footer ? /* @__PURE__ */ React.createElement("div", { "data-slot": "footer", className: ui.footer() }, footer) : null)
|
|
56
|
+
)
|
|
57
|
+
)));
|
|
58
|
+
}
|
|
59
|
+
export { Popover };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ScrollArea as UIScrollArea } from "@base-ui/react/scroll-area";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/** Scrollbar axes rendered by the scroll area. */
|
|
4
|
+
type ScrollAreaOrientation = "vertical" | "horizontal" | "both";
|
|
5
|
+
type ScrollAreaProps = Omit<UIScrollArea.Root.Props, "children" | "className" | "style"> & {
|
|
6
|
+
/** Scrollable content. */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/** Scrollbar axes to render. Defaults to `"vertical"`. */
|
|
9
|
+
orientation?: ScrollAreaOrientation;
|
|
10
|
+
/** Tailwind classes merged into the root. */
|
|
11
|
+
className?: any;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A native scroll container with custom liquid glass scrollbars.
|
|
15
|
+
*
|
|
16
|
+
* The root owns the visible glass surface. Give it a height (for example
|
|
17
|
+
* `className="h-64"`) to create a scrollable viewport.
|
|
18
|
+
*/
|
|
19
|
+
declare function ScrollArea({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, className, orientation, ...props }: ScrollAreaProps): React.JSX.Element;
|
|
20
|
+
export { ScrollArea };
|
|
21
|
+
export type { ScrollAreaOrientation, ScrollAreaProps };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ScrollArea as UIScrollArea } from "@base-ui/react/scroll-area";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import theme from "../theme/scroll-area.mjs";
|
|
6
|
+
function ScrollArea({
|
|
7
|
+
"aria-describedby": ariaDescribedBy,
|
|
8
|
+
"aria-label": ariaLabel,
|
|
9
|
+
"aria-labelledby": ariaLabelledBy,
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
orientation = "vertical",
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
const ui = theme();
|
|
16
|
+
return /* @__PURE__ */ React.createElement(
|
|
17
|
+
UIScrollArea.Root,
|
|
18
|
+
{
|
|
19
|
+
...props,
|
|
20
|
+
"data-slot": "root",
|
|
21
|
+
"data-orientation": orientation,
|
|
22
|
+
className: cn(ui.root(), className)
|
|
23
|
+
},
|
|
24
|
+
/* @__PURE__ */ React.createElement("span", { "aria-hidden": "true", "data-slot": "glass", className: ui.glass() }, /* @__PURE__ */ React.createElement(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
"data-slot": "overlay",
|
|
29
|
+
className: ui.overlay()
|
|
30
|
+
}
|
|
31
|
+
)),
|
|
32
|
+
/* @__PURE__ */ React.createElement(
|
|
33
|
+
UIScrollArea.Viewport,
|
|
34
|
+
{
|
|
35
|
+
"aria-describedby": ariaDescribedBy,
|
|
36
|
+
"aria-label": ariaLabel,
|
|
37
|
+
"aria-labelledby": ariaLabelledBy,
|
|
38
|
+
"data-slot": "viewport",
|
|
39
|
+
className: ui.viewport()
|
|
40
|
+
},
|
|
41
|
+
/* @__PURE__ */ React.createElement(UIScrollArea.Content, { "data-slot": "content", className: ui.content() }, children)
|
|
42
|
+
),
|
|
43
|
+
orientation !== "horizontal" ? /* @__PURE__ */ React.createElement(
|
|
44
|
+
UIScrollArea.Scrollbar,
|
|
45
|
+
{
|
|
46
|
+
"data-slot": "scrollbar",
|
|
47
|
+
orientation: "vertical",
|
|
48
|
+
className: ui.scrollbar()
|
|
49
|
+
},
|
|
50
|
+
/* @__PURE__ */ React.createElement(UIScrollArea.Thumb, { "data-slot": "thumb", className: ui.thumb() })
|
|
51
|
+
) : null,
|
|
52
|
+
orientation !== "vertical" ? /* @__PURE__ */ React.createElement(
|
|
53
|
+
UIScrollArea.Scrollbar,
|
|
54
|
+
{
|
|
55
|
+
"data-slot": "scrollbar",
|
|
56
|
+
orientation: "horizontal",
|
|
57
|
+
className: ui.scrollbar()
|
|
58
|
+
},
|
|
59
|
+
/* @__PURE__ */ React.createElement(UIScrollArea.Thumb, { "data-slot": "thumb", className: ui.thumb() })
|
|
60
|
+
) : null,
|
|
61
|
+
orientation === "both" ? /* @__PURE__ */ React.createElement(UIScrollArea.Corner, { "data-slot": "corner", className: ui.corner() }) : null
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
export { ScrollArea };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Switch as UISwitch } from "@base-ui/react/switch";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { type VariantProps } from "tailwind-variants";
|
|
4
|
-
import theme from "../theme/switch
|
|
5
|
-
interface SwitchProps extends Omit<
|
|
4
|
+
import theme from "../theme/switch";
|
|
5
|
+
interface SwitchProps extends Omit<UISwitch.Root.Props, "className" | "children" | "style" | "ref">, VariantProps<typeof theme> {
|
|
6
|
+
/** Ref to the rendered root element. */
|
|
7
|
+
ref?: React.Ref<HTMLElement>;
|
|
6
8
|
/** Tailwind classes merged into the Base UI switch root. */
|
|
7
9
|
className?: string;
|
|
8
10
|
/** Visible label. */
|