@pravalabs/ui 0.0.0-stage → 1.0.0-rc.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/LICENSE +21 -0
- package/README.md +142 -2
- package/dist/Accordion-CVRdRha1.js +107 -0
- package/dist/Alert-Bxv6CGPj.js +54 -0
- package/dist/Avatar-DUw9xBQ-.js +49 -0
- package/dist/Badge-cupXlWce.js +37 -0
- package/dist/Button-vjrnnaM_.js +65 -0
- package/dist/Card-BJNdpGjM.js +44 -0
- package/dist/Checkbox-BQtcnwwC.js +60 -0
- package/dist/Container-DO8bd1tv.js +19 -0
- package/dist/Dialog-D3-sT_1Z.js +147 -0
- package/dist/Drawer-BRzJmvQx.js +21 -0
- package/dist/DropdownMenu-CFa2vgXi.js +137 -0
- package/dist/FormField-CoC946w9.js +61 -0
- package/dist/Grid-vTrChm2w.js +31 -0
- package/dist/Input-B97l8Dj0.js +82 -0
- package/dist/Label-DYOFzyEM.js +25 -0
- package/dist/Popover-C9Vgtm3q.js +81 -0
- package/dist/PravaProvider-0znpKV4G.js +59 -0
- package/dist/Progress-_Hz8dxM4.js +51 -0
- package/dist/RadioGroup-CvdV80Pg.js +90 -0
- package/dist/Select-_urp2aA_.js +451 -0
- package/dist/Separator-MnFbL0eH.js +23 -0
- package/dist/Skeleton-CyjiU8o1.js +25 -0
- package/dist/Spinner-Da7h4BDn.js +77 -0
- package/dist/Stack-DNtmh6BN.js +30 -0
- package/dist/Switch-Cp-wriw6.js +50 -0
- package/dist/Tabs-C0SRJSv1.js +158 -0
- package/dist/Textarea-D0fNA7sQ.js +69 -0
- package/dist/Toast-7qJXHzEb.js +110 -0
- package/dist/Tooltip-CyW8YfU9.js +57 -0
- package/dist/accordion.js +8 -0
- package/dist/alert.js +7 -0
- package/dist/avatar.js +7 -0
- package/dist/badge.js +7 -0
- package/dist/button.js +7 -0
- package/dist/card.js +10 -0
- package/dist/checkbox.js +8 -0
- package/dist/components/accordion/Accordion.d.ts +42 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/alert/Alert.d.ts +35 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/avatar/Avatar.d.ts +16 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/badge/Badge.d.ts +22 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/button/Button.d.ts +50 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/card/Card.d.ts +49 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +23 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/container/Container.d.ts +22 -0
- package/dist/components/container/index.d.ts +2 -0
- package/dist/components/dialog/Dialog.d.ts +89 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/drawer/Drawer.d.ts +46 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +59 -0
- package/dist/components/dropdown-menu/index.d.ts +2 -0
- package/dist/components/field/field.d.ts +87 -0
- package/dist/components/form-field/FormField.d.ts +41 -0
- package/dist/components/form-field/index.d.ts +2 -0
- package/dist/components/grid/Grid.d.ts +36 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/input/Input.d.ts +35 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/label/Label.d.ts +15 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/popover/Popover.d.ts +35 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/progress/Progress.d.ts +15 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/provider/PravaProvider.d.ts +69 -0
- package/dist/components/provider/index.d.ts +2 -0
- package/dist/components/radio-group/RadioGroup.d.ts +58 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/select/Select.d.ts +76 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/separator/Separator.d.ts +9 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/skeleton/Skeleton.d.ts +7 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/spinner/Spinner.d.ts +15 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/stack/Stack.d.ts +38 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/switch/Switch.d.ts +19 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/tabs/Tabs.d.ts +69 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/textarea/Textarea.d.ts +26 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/toast/Toast.d.ts +55 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +22 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/container.js +7 -0
- package/dist/dialog.js +8 -0
- package/dist/drawer.js +8 -0
- package/dist/dropdown-menu.js +8 -0
- package/dist/field-U1YinldE.js +152 -0
- package/dist/form-field.js +8 -0
- package/dist/grid.js +7 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +29 -0
- package/dist/input.js +8 -0
- package/dist/internal/overlay.d.ts +39 -0
- package/dist/internal/useControllable.d.ts +2 -0
- package/dist/label.js +8 -0
- package/dist/overlay-9zlvgpUZ.js +121 -0
- package/dist/popover.js +8 -0
- package/dist/progress.js +7 -0
- package/dist/provider.js +7 -0
- package/dist/radio-group.js +8 -0
- package/dist/select.js +8 -0
- package/dist/separator.js +7 -0
- package/dist/skeleton.js +7 -0
- package/dist/spinner.js +7 -0
- package/dist/stack.js +7 -0
- package/dist/styles/components/accordion.css +1 -0
- package/dist/styles/components/alert.css +1 -0
- package/dist/styles/components/avatar.css +1 -0
- package/dist/styles/components/badge.css +1 -0
- package/dist/styles/components/button.css +1 -0
- package/dist/styles/components/card.css +1 -0
- package/dist/styles/components/checkbox.css +1 -0
- package/dist/styles/components/container.css +1 -0
- package/dist/styles/components/dialog.css +1 -0
- package/dist/styles/components/drawer.css +1 -0
- package/dist/styles/components/dropdown-menu.css +1 -0
- package/dist/styles/components/field.css +1 -0
- package/dist/styles/components/floating.css +1 -0
- package/dist/styles/components/form-field.css +1 -0
- package/dist/styles/components/grid.css +1 -0
- package/dist/styles/components/input.css +1 -0
- package/dist/styles/components/label.css +1 -0
- package/dist/styles/components/popover.css +1 -0
- package/dist/styles/components/progress.css +1 -0
- package/dist/styles/components/provider.css +1 -0
- package/dist/styles/components/radio-group.css +1 -0
- package/dist/styles/components/select.css +1 -0
- package/dist/styles/components/separator.css +1 -0
- package/dist/styles/components/skeleton.css +1 -0
- package/dist/styles/components/spinner.css +1 -0
- package/dist/styles/components/stack.css +1 -0
- package/dist/styles/components/switch.css +1 -0
- package/dist/styles/components/tabs.css +1 -0
- package/dist/styles/components/textarea.css +1 -0
- package/dist/styles/components/toast.css +1 -0
- package/dist/styles/components/tooltip.css +1 -0
- package/dist/styles.css +1 -0
- package/dist/switch.js +8 -0
- package/dist/tabs.js +10 -0
- package/dist/textarea.js +8 -0
- package/dist/toast.js +9 -0
- package/dist/tokens.css +192 -0
- package/dist/tooltip.js +8 -0
- package/dist/useControllable-C2Te1pSd.js +14 -0
- package/package.json +223 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dinesh_DC
|
|
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
CHANGED
|
@@ -1,3 +1,143 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Prava UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Accessible, responsive React components that look finished the moment you install them. No Tailwind setup, no CSS-in-JS runtime, and no runtime dependencies.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@pravalabs/ui?activeTab=versions)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://github.com/dineshdcshinde/prava-ui/actions/workflows/ci.yml)
|
|
8
|
+
|
|
9
|
+
> **Release candidate.** The API is close to final, but it can still change before `1.0.0`. Please try it and [report what you find](https://github.com/dineshdcshinde/prava-ui/issues).
|
|
10
|
+
|
|
11
|
+
## Why Prava UI
|
|
12
|
+
|
|
13
|
+
- **No design work.** Polished defaults for every state, in light and dark.
|
|
14
|
+
- **No setup.** Styles are compiled and load automatically. You don't need Tailwind or a provider.
|
|
15
|
+
- **Keyboard, screen reader, and RTL support built in.** They're part of each component, not an add-on.
|
|
16
|
+
- **Fits any screen.** Components adapt to their container with no breakpoint props.
|
|
17
|
+
- **Easy to theme.** One CSS file of tokens restyles everything, and your CSS always wins.
|
|
18
|
+
- **Only what you import.** Each component brings its own JavaScript and CSS.
|
|
19
|
+
|
|
20
|
+
## Getting started
|
|
21
|
+
|
|
22
|
+
Prava UI needs React 18.2 or newer, including React 19.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install @pravalabs/ui@next
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Import a component and use it. Its styles come with it:
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { Button, Dialog, DialogClose, Input } from "@pravalabs/ui";
|
|
32
|
+
|
|
33
|
+
export function InviteTeammate() {
|
|
34
|
+
return (
|
|
35
|
+
<Dialog
|
|
36
|
+
trigger={<Button>Invite</Button>}
|
|
37
|
+
title="Invite a teammate"
|
|
38
|
+
description="They get an email with a link to join."
|
|
39
|
+
footer={
|
|
40
|
+
<>
|
|
41
|
+
<DialogClose>
|
|
42
|
+
<Button variant="outline">Cancel</Button>
|
|
43
|
+
</DialogClose>
|
|
44
|
+
<Button>Send invite</Button>
|
|
45
|
+
</>
|
|
46
|
+
}
|
|
47
|
+
>
|
|
48
|
+
<Input label="Work email" type="email" />
|
|
49
|
+
</Dialog>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
You can also import one component at a time, such as `import { Button } from "@pravalabs/ui/button"`.
|
|
55
|
+
|
|
56
|
+
Components inherit your app's font. Prava UI never loads a font or adds global styles to your page.
|
|
57
|
+
|
|
58
|
+
### Next.js
|
|
59
|
+
|
|
60
|
+
Works in the App Router: you can use components directly in Server Components, because the package marks its own client code. Functions such as `onClick` still have to be passed from a Client Component, as with any React component. Call `toast()` from client code too.
|
|
61
|
+
|
|
62
|
+
## Components
|
|
63
|
+
|
|
64
|
+
| Group | Components |
|
|
65
|
+
| ---------- | --------------------------------------------------------------------------------------- |
|
|
66
|
+
| Actions | `Button` |
|
|
67
|
+
| Forms | `Input`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `Switch`, `Label`, `FormField` |
|
|
68
|
+
| Display | `Avatar`, `Badge`, `Card`, `Separator`, `Skeleton`, `Spinner`, `Progress` |
|
|
69
|
+
| Feedback | `Alert`, `Toaster` with `toast()` |
|
|
70
|
+
| Overlays | `Dialog`, `Drawer`, `Popover`, `Tooltip`, `DropdownMenu` |
|
|
71
|
+
| Navigation | `Tabs`, `Accordion` |
|
|
72
|
+
| Layout | `Container`, `Stack`, `Grid` |
|
|
73
|
+
| Setup | `PravaProvider` (optional: direction, locale, messages, and theme for part of your app) |
|
|
74
|
+
|
|
75
|
+
Form controls connect to [react-hook-form](https://react-hook-form.com/) through a `field` prop, with no extra dependency:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<Input label="Email" field={register("email")} error={errors.email?.message} />
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
|
|
83
|
+
Every component has live examples and an API reference in Storybook. A hosted version isn't available yet, so run it locally:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
git clone https://github.com/dineshdcshinde/prava-ui.git
|
|
87
|
+
cd prava-ui
|
|
88
|
+
npm install
|
|
89
|
+
npm run dev
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Your editor also shows the docs: each prop and component has a description and an example inline.
|
|
93
|
+
|
|
94
|
+
## Theming
|
|
95
|
+
|
|
96
|
+
Light is the default. Choose a theme for the whole page or any part of it:
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<body data-prava-theme="dark">
|
|
100
|
+
...
|
|
101
|
+
</body>
|
|
102
|
+
<section data-prava-theme="system">...</section>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
To use your brand's colors, override the tokens in your own CSS. Prava UI's styles sit in a cascade layer, so yours win whatever the import order:
|
|
106
|
+
|
|
107
|
+
```css
|
|
108
|
+
:root {
|
|
109
|
+
--prava-color-primary: #7c3aed;
|
|
110
|
+
--prava-color-primary-hover: #6d28d9;
|
|
111
|
+
--prava-color-primary-active: #5b21b6;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Every component also takes `className` and `style`, and compound ones take `classNames` for their inner parts. See [DESIGN.md](./DESIGN.md) for all the tokens.
|
|
116
|
+
|
|
117
|
+
## Right-to-left and translations
|
|
118
|
+
|
|
119
|
+
Prava UI has no translation dependency, so it works alongside whichever library you already use. `PravaProvider` sets direction, locale, and the library's own text for its subtree:
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { PravaProvider } from "@pravalabs/ui";
|
|
123
|
+
|
|
124
|
+
<PravaProvider direction="rtl" locale="ar" messages={{ close: "إغلاق" }}>
|
|
125
|
+
<App />
|
|
126
|
+
</PravaProvider>;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
It only affects what's inside it. To change the whole page, set `<html dir="rtl">` yourself as well.
|
|
130
|
+
|
|
131
|
+
## Browser support
|
|
132
|
+
|
|
133
|
+
Tests run on current Chromium, Firefox, and WebKit, plus emulated phones. Overlays use the native `<dialog>` element and Popover API, so they need Chrome or Edge 114, Firefox 125, or Safari 17 and newer. Browsers that don't support the newest animation features still work, and overlays just close without animating.
|
|
134
|
+
|
|
135
|
+
## Contributing
|
|
136
|
+
|
|
137
|
+
Bug reports, ideas, and pull requests are all welcome. Start with the [contributing guide](./CONTRIBUTING.md), and please follow the [code of conduct](./CODE_OF_CONDUCT.md). To report a security problem, see the [security policy](./SECURITY.md).
|
|
138
|
+
|
|
139
|
+
Changes in each version are listed in the [changelog](./CHANGELOG.md).
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as A, useContext as N, useId as b } from "react";
|
|
4
|
+
import { u as w } from "./useControllable-C2Te1pSd.js";
|
|
5
|
+
const m = A(null);
|
|
6
|
+
function B({
|
|
7
|
+
multiple: t,
|
|
8
|
+
value: l,
|
|
9
|
+
defaultValue: s = [],
|
|
10
|
+
onValueChange: p,
|
|
11
|
+
headingLevel: g = 3,
|
|
12
|
+
className: u,
|
|
13
|
+
onKeyDown: a,
|
|
14
|
+
...c
|
|
15
|
+
}) {
|
|
16
|
+
const [e, i] = w(
|
|
17
|
+
l,
|
|
18
|
+
s,
|
|
19
|
+
p
|
|
20
|
+
), _ = (r) => {
|
|
21
|
+
const d = e.filter((n) => n !== r);
|
|
22
|
+
e.includes(r) ? i(d) : i(t ? [...e, r] : [r]);
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ o(m.Provider, { value: { open: e, toggle: _, headingLevel: g }, children: /* @__PURE__ */ o(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
...c,
|
|
28
|
+
className: ["prava-accordion", u].filter(Boolean).join(" "),
|
|
29
|
+
onKeyDown: (r) => {
|
|
30
|
+
if (a?.(r), r.defaultPrevented) return;
|
|
31
|
+
const d = r.currentTarget, n = Array.from(
|
|
32
|
+
d.querySelectorAll(
|
|
33
|
+
".prava-accordion__trigger:not(:disabled)"
|
|
34
|
+
)
|
|
35
|
+
).filter((x) => x.closest(".prava-accordion") === d), v = n.indexOf(r.target);
|
|
36
|
+
if (v < 0) return;
|
|
37
|
+
const f = {
|
|
38
|
+
ArrowDown: v + 1,
|
|
39
|
+
ArrowUp: v - 1,
|
|
40
|
+
Home: 0,
|
|
41
|
+
End: n.length - 1
|
|
42
|
+
}[r.key];
|
|
43
|
+
f !== void 0 && (r.preventDefault(), n[(f + n.length) % n.length]?.focus());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
) });
|
|
47
|
+
}
|
|
48
|
+
function D({
|
|
49
|
+
value: t,
|
|
50
|
+
title: l,
|
|
51
|
+
disabled: s,
|
|
52
|
+
className: p,
|
|
53
|
+
children: g,
|
|
54
|
+
...u
|
|
55
|
+
}) {
|
|
56
|
+
const a = N(m);
|
|
57
|
+
if (!a) throw new Error("AccordionItem must be inside <Accordion>.");
|
|
58
|
+
const c = b(), e = a.open.includes(t), i = `h${a.headingLevel}`;
|
|
59
|
+
return /* @__PURE__ */ h(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
...u,
|
|
63
|
+
className: ["prava-accordion__item", p].filter(Boolean).join(" "),
|
|
64
|
+
"data-open": e ? "" : void 0,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ o(i, { className: "prava-accordion__heading", children: /* @__PURE__ */ h(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
id: `${c}-trigger`,
|
|
71
|
+
className: "prava-accordion__trigger",
|
|
72
|
+
"aria-expanded": e,
|
|
73
|
+
"aria-controls": `${c}-panel`,
|
|
74
|
+
disabled: s,
|
|
75
|
+
onClick: () => a.toggle(t),
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ o("span", { className: "prava-accordion__title", children: l }),
|
|
78
|
+
/* @__PURE__ */ o(
|
|
79
|
+
"svg",
|
|
80
|
+
{
|
|
81
|
+
className: "prava-accordion__chevron",
|
|
82
|
+
viewBox: "0 0 16 16",
|
|
83
|
+
"aria-hidden": "true",
|
|
84
|
+
children: /* @__PURE__ */ o("path", { d: "M4 6l4 4 4-4" })
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
) }),
|
|
90
|
+
/* @__PURE__ */ o(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
id: `${c}-panel`,
|
|
94
|
+
role: "region",
|
|
95
|
+
"aria-labelledby": `${c}-trigger`,
|
|
96
|
+
className: "prava-accordion__panel",
|
|
97
|
+
children: /* @__PURE__ */ o("div", { className: "prava-accordion__clip", children: /* @__PURE__ */ o("div", { className: "prava-accordion__content", children: g }) })
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
B as A,
|
|
106
|
+
D as a
|
|
107
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as h } from "react";
|
|
4
|
+
import { u as p } from "./PravaProvider-0znpKV4G.js";
|
|
5
|
+
const u = {
|
|
6
|
+
neutral: "M8 7.25v3.5M8 5.25h.01M14 8A6 6 0 1 1 2 8a6 6 0 0 1 12 0z",
|
|
7
|
+
info: "M8 7.25v3.5M8 5.25h.01M14 8A6 6 0 1 1 2 8a6 6 0 0 1 12 0z",
|
|
8
|
+
success: "M5.25 8.25 7.25 10.25 10.75 6M14 8A6 6 0 1 1 2 8a6 6 0 0 1 12 0z",
|
|
9
|
+
warning: "M8 6.25v3M8 11.25h.01M7.13 2.75 1.9 12a1 1 0 0 0 .87 1.5h10.46a1 1 0 0 0 .87-1.5L8.87 2.75a1 1 0 0 0-1.74 0z",
|
|
10
|
+
danger: "M8 5v3.75M8 11h.01M14 8A6 6 0 1 1 2 8a6 6 0 0 1 12 0z"
|
|
11
|
+
}, A = h(function({
|
|
12
|
+
tone: e = "neutral",
|
|
13
|
+
title: l,
|
|
14
|
+
icon: s,
|
|
15
|
+
action: t,
|
|
16
|
+
onDismiss: r,
|
|
17
|
+
className: d,
|
|
18
|
+
children: i,
|
|
19
|
+
...o
|
|
20
|
+
}, c) {
|
|
21
|
+
const { messages: v } = p();
|
|
22
|
+
return /* @__PURE__ */ n(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
role: "status",
|
|
26
|
+
...o,
|
|
27
|
+
ref: c,
|
|
28
|
+
className: ["prava-alert", d].filter(Boolean).join(" "),
|
|
29
|
+
"data-tone": e,
|
|
30
|
+
"data-dismissible": r ? "" : void 0,
|
|
31
|
+
children: [
|
|
32
|
+
s !== null && /* @__PURE__ */ a("span", { className: "prava-alert__icon", "aria-hidden": "true", children: s ?? /* @__PURE__ */ a("svg", { viewBox: "0 0 16 16", children: /* @__PURE__ */ a("path", { d: u[e] }) }) }),
|
|
33
|
+
/* @__PURE__ */ n("div", { className: "prava-alert__body", children: [
|
|
34
|
+
l != null && /* @__PURE__ */ a("div", { className: "prava-alert__title", children: l }),
|
|
35
|
+
i != null && /* @__PURE__ */ a("div", { className: "prava-alert__description", children: i })
|
|
36
|
+
] }),
|
|
37
|
+
t != null && /* @__PURE__ */ a("div", { className: "prava-alert__action", children: t }),
|
|
38
|
+
r && /* @__PURE__ */ a(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: "button",
|
|
42
|
+
className: "prava-alert__dismiss",
|
|
43
|
+
"aria-label": v.dismiss,
|
|
44
|
+
onClick: r,
|
|
45
|
+
children: /* @__PURE__ */ a("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "M4 4l8 8M12 4l-8 8" }) })
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
A
|
|
54
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { useState as B } from "react";
|
|
4
|
+
const s = [
|
|
5
|
+
"primary",
|
|
6
|
+
"success",
|
|
7
|
+
"warning",
|
|
8
|
+
"info",
|
|
9
|
+
"danger",
|
|
10
|
+
"neutral"
|
|
11
|
+
];
|
|
12
|
+
function x({
|
|
13
|
+
src: e,
|
|
14
|
+
firstName: i,
|
|
15
|
+
lastName: n,
|
|
16
|
+
alt: d,
|
|
17
|
+
fallback: c,
|
|
18
|
+
size: m = "md",
|
|
19
|
+
className: p,
|
|
20
|
+
onError: f,
|
|
21
|
+
...u
|
|
22
|
+
}) {
|
|
23
|
+
const [r, v] = B(!1), o = [i, n].filter(Boolean).join(" "), g = [i, n].filter(Boolean).map((a) => a.trim()[0]).filter(Boolean).join("").toLocaleUpperCase(), h = o ? s[[...o].reduce((a, j) => a + j.charCodeAt(0), 0) % s.length] : void 0, t = d ?? o;
|
|
24
|
+
return /* @__PURE__ */ l(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
...u,
|
|
28
|
+
className: ["prava-avatar", p].filter(Boolean).join(" "),
|
|
29
|
+
"data-size": m,
|
|
30
|
+
"data-tone": e && !r ? void 0 : h,
|
|
31
|
+
role: t ? "img" : void 0,
|
|
32
|
+
"aria-label": t || void 0,
|
|
33
|
+
"aria-hidden": t ? void 0 : !0,
|
|
34
|
+
children: e && !r ? /* @__PURE__ */ l(
|
|
35
|
+
"img",
|
|
36
|
+
{
|
|
37
|
+
src: e,
|
|
38
|
+
alt: "",
|
|
39
|
+
onError: (a) => {
|
|
40
|
+
v(!0), f?.(a);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
) : c ?? g
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
x as A
|
|
49
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
function c({
|
|
4
|
+
tone: t,
|
|
5
|
+
size: s = "sm",
|
|
6
|
+
placement: d = "top-end",
|
|
7
|
+
content: o,
|
|
8
|
+
className: r,
|
|
9
|
+
children: e,
|
|
10
|
+
...l
|
|
11
|
+
}) {
|
|
12
|
+
const a = e == null;
|
|
13
|
+
return /* @__PURE__ */ i(
|
|
14
|
+
"span",
|
|
15
|
+
{
|
|
16
|
+
...l,
|
|
17
|
+
className: ["prava-badge", r].filter(Boolean).join(" "),
|
|
18
|
+
"data-standalone": a || void 0,
|
|
19
|
+
children: [
|
|
20
|
+
!a && /* @__PURE__ */ n("span", { className: "prava-badge__target", children: e }),
|
|
21
|
+
/* @__PURE__ */ n(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
className: "prava-badge__indicator",
|
|
25
|
+
"data-tone": t ?? (a ? "neutral" : "danger"),
|
|
26
|
+
"data-size": s,
|
|
27
|
+
"data-placement": a ? void 0 : d,
|
|
28
|
+
children: o
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
c as B
|
|
37
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n, jsxs as f, Fragment as x } from "react/jsx-runtime";
|
|
3
|
+
import { S as z } from "./Spinner-Da7h4BDn.js";
|
|
4
|
+
function D(r) {
|
|
5
|
+
const {
|
|
6
|
+
variant: m,
|
|
7
|
+
size: s = "md",
|
|
8
|
+
type: d = "button",
|
|
9
|
+
loading: a = !1,
|
|
10
|
+
disableAnimation: v = !1,
|
|
11
|
+
disabled: o = !1,
|
|
12
|
+
fullWidth: _ = !1,
|
|
13
|
+
className: k,
|
|
14
|
+
startIcon: l,
|
|
15
|
+
endIcon: c,
|
|
16
|
+
children: y,
|
|
17
|
+
...i
|
|
18
|
+
} = r, e = d === "icon", u = {
|
|
19
|
+
className: ["prava-button", k].filter(Boolean).join(" "),
|
|
20
|
+
"data-variant": m ?? (e ? "ghost" : "primary"),
|
|
21
|
+
"data-size": s,
|
|
22
|
+
"data-type": e ? "icon" : "button",
|
|
23
|
+
"data-motion": v ? "none" : "default",
|
|
24
|
+
"data-loading": a || void 0,
|
|
25
|
+
"data-full-width": _ || void 0,
|
|
26
|
+
"aria-busy": a || i["aria-busy"]
|
|
27
|
+
}, p = /* @__PURE__ */ f(x, { children: [
|
|
28
|
+
/* @__PURE__ */ f("span", { className: "prava-button__content", children: [
|
|
29
|
+
l && /* @__PURE__ */ n("span", { className: "prava-button__icon", "aria-hidden": "true", children: l }),
|
|
30
|
+
y,
|
|
31
|
+
c && /* @__PURE__ */ n("span", { className: "prava-button__icon", "aria-hidden": "true", children: c })
|
|
32
|
+
] }),
|
|
33
|
+
a && /* @__PURE__ */ n("span", { className: "prava-button__loader", "aria-hidden": "true", children: /* @__PURE__ */ n(z, { size: s === "lg" ? "md" : "sm", color: "currentColor" }) })
|
|
34
|
+
] });
|
|
35
|
+
if (r.href !== void 0) {
|
|
36
|
+
const { href: t, onClick: g, ...j } = i, h = o || a;
|
|
37
|
+
return /* @__PURE__ */ n(
|
|
38
|
+
"a",
|
|
39
|
+
{
|
|
40
|
+
...j,
|
|
41
|
+
...u,
|
|
42
|
+
href: o ? void 0 : t,
|
|
43
|
+
"aria-disabled": h || void 0,
|
|
44
|
+
onClick: (b) => h ? b.preventDefault() : g?.(b),
|
|
45
|
+
children: p
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
const { onClick: C, ...N } = i;
|
|
50
|
+
return /* @__PURE__ */ n(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
...N,
|
|
54
|
+
...u,
|
|
55
|
+
type: e ? "button" : d,
|
|
56
|
+
disabled: o,
|
|
57
|
+
"aria-disabled": a || void 0,
|
|
58
|
+
onClick: (t) => a ? t.preventDefault() : C?.(t),
|
|
59
|
+
children: p
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
D as B
|
|
65
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
function n({ className: a, ...r }) {
|
|
4
|
+
return /* @__PURE__ */ e(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
...r,
|
|
8
|
+
className: ["prava-card", a].filter(Boolean).join(" ")
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
function t({ className: a, ...r }) {
|
|
13
|
+
return /* @__PURE__ */ e(
|
|
14
|
+
"header",
|
|
15
|
+
{
|
|
16
|
+
...r,
|
|
17
|
+
className: ["prava-card__header", a].filter(Boolean).join(" ")
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function i({ className: a, ...r }) {
|
|
22
|
+
return /* @__PURE__ */ e(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
...r,
|
|
26
|
+
className: ["prava-card__content", a].filter(Boolean).join(" ")
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function c({ className: a, ...r }) {
|
|
31
|
+
return /* @__PURE__ */ e(
|
|
32
|
+
"footer",
|
|
33
|
+
{
|
|
34
|
+
...r,
|
|
35
|
+
className: ["prava-card__footer", a].filter(Boolean).join(" ")
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
n as C,
|
|
41
|
+
i as a,
|
|
42
|
+
c as b,
|
|
43
|
+
t as c
|
|
44
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as C, jsx as k } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as x, useRef as v, useEffect as R, useCallback as g } from "react";
|
|
4
|
+
import { b as j, s as y, u as F, C as w } from "./field-U1YinldE.js";
|
|
5
|
+
const P = x(
|
|
6
|
+
function(o, c) {
|
|
7
|
+
const {
|
|
8
|
+
label: t,
|
|
9
|
+
indeterminate: i = !1,
|
|
10
|
+
description: d,
|
|
11
|
+
error: l,
|
|
12
|
+
invalid: f,
|
|
13
|
+
id: u,
|
|
14
|
+
onBlur: b,
|
|
15
|
+
onChange: m,
|
|
16
|
+
onInvalid: p,
|
|
17
|
+
ref: a,
|
|
18
|
+
...e
|
|
19
|
+
} = j(
|
|
20
|
+
o,
|
|
21
|
+
c,
|
|
22
|
+
"checked"
|
|
23
|
+
), r = v(null);
|
|
24
|
+
R(() => {
|
|
25
|
+
r.current && (r.current.indeterminate = i);
|
|
26
|
+
}, [i]);
|
|
27
|
+
const h = g(
|
|
28
|
+
(s) => {
|
|
29
|
+
r.current = s, y(a, s);
|
|
30
|
+
},
|
|
31
|
+
[a]
|
|
32
|
+
), n = F({
|
|
33
|
+
id: u,
|
|
34
|
+
description: d,
|
|
35
|
+
error: l,
|
|
36
|
+
invalid: f,
|
|
37
|
+
onBlur: b,
|
|
38
|
+
onChange: m,
|
|
39
|
+
onInvalid: p,
|
|
40
|
+
"aria-describedby": e["aria-describedby"],
|
|
41
|
+
"aria-invalid": e["aria-invalid"]
|
|
42
|
+
});
|
|
43
|
+
return /* @__PURE__ */ C("span", { className: "prava-field", "data-choice": "", children: [
|
|
44
|
+
/* @__PURE__ */ k(
|
|
45
|
+
w,
|
|
46
|
+
{
|
|
47
|
+
...e,
|
|
48
|
+
...n.controlProps,
|
|
49
|
+
ref: h,
|
|
50
|
+
kind: "checkbox",
|
|
51
|
+
label: t
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
n.messages
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
export {
|
|
59
|
+
P as C
|
|
60
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as i } from "react";
|
|
4
|
+
const c = i(
|
|
5
|
+
function({ size: o = "lg", as: r = "div", className: a, ...n }, t) {
|
|
6
|
+
return /* @__PURE__ */ e(
|
|
7
|
+
r,
|
|
8
|
+
{
|
|
9
|
+
...n,
|
|
10
|
+
ref: t,
|
|
11
|
+
className: ["prava-container", a].filter(Boolean).join(" "),
|
|
12
|
+
"data-size": o
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
export {
|
|
18
|
+
c as C
|
|
19
|
+
};
|