@suryapamenang/ui 0.1.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 +81 -0
- package/dist/components/basic-blocks-base-kit.d.ts +6 -0
- package/dist/components/basic-blocks-base-kit.d.ts.map +1 -0
- package/dist/components/basic-blocks-base-kit.js +17 -0
- package/dist/components/basic-blocks-kit.d.ts +6 -0
- package/dist/components/basic-blocks-kit.d.ts.map +1 -0
- package/dist/components/basic-blocks-kit.js +68 -0
- package/dist/components/basic-marks-base-kit.d.ts +20 -0
- package/dist/components/basic-marks-base-kit.d.ts.map +1 -0
- package/dist/components/basic-marks-base-kit.js +15 -0
- package/dist/components/basic-marks-kit.d.ts +20 -0
- package/dist/components/basic-marks-kit.d.ts.map +1 -0
- package/dist/components/basic-marks-kit.js +27 -0
- package/dist/components/basic-nodes-kit.d.ts +24 -0
- package/dist/components/basic-nodes-kit.d.ts.map +1 -0
- package/dist/components/basic-nodes-kit.js +3 -0
- package/dist/components/file-upload.d.ts +15 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +29 -0
- package/dist/components/multi-step-viewer.d.ts +23 -0
- package/dist/components/multi-step-viewer.d.ts.map +1 -0
- package/dist/components/multi-step-viewer.js +73 -0
- package/dist/components/plate-editor.d.ts +2 -0
- package/dist/components/plate-editor.d.ts.map +1 -0
- package/dist/components/plate-editor.js +44 -0
- package/dist/hooks/use-file-upload.d.ts +46 -0
- package/dist/hooks/use-file-upload.d.ts.map +1 -0
- package/dist/hooks/use-file-upload.js +228 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/hooks/use-multi-step-viewer.d.ts +30 -0
- package/dist/hooks/use-multi-step-viewer.d.ts.map +1 -0
- package/dist/hooks/use-multi-step-viewer.js +72 -0
- package/dist/index.css +3645 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +5 -0
- package/dist/primitives/accordion.d.ts +8 -0
- package/dist/primitives/accordion.d.ts.map +1 -0
- package/dist/primitives/accordion.js +17 -0
- package/dist/primitives/alert-dialog.d.ts +15 -0
- package/dist/primitives/alert-dialog.d.ts.map +1 -0
- package/dist/primitives/alert-dialog.js +38 -0
- package/dist/primitives/avatar.d.ts +7 -0
- package/dist/primitives/avatar.d.ts.map +1 -0
- package/dist/primitives/avatar.js +13 -0
- package/dist/primitives/badge.d.ts +10 -0
- package/dist/primitives/badge.d.ts.map +1 -0
- package/dist/primitives/badge.js +22 -0
- package/dist/primitives/blockquote-node-static.d.ts +3 -0
- package/dist/primitives/blockquote-node-static.d.ts.map +1 -0
- package/dist/primitives/blockquote-node-static.js +5 -0
- package/dist/primitives/blockquote-node.d.ts +3 -0
- package/dist/primitives/blockquote-node.d.ts.map +1 -0
- package/dist/primitives/blockquote-node.js +5 -0
- package/dist/primitives/breadcrumb.d.ts +14 -0
- package/dist/primitives/breadcrumb.d.ts.map +1 -0
- package/dist/primitives/breadcrumb.js +29 -0
- package/dist/primitives/button.d.ts +11 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +33 -0
- package/dist/primitives/calendar.d.ts +9 -0
- package/dist/primitives/calendar.d.ts.map +1 -0
- package/dist/primitives/calendar.js +73 -0
- package/dist/primitives/card.d.ts +10 -0
- package/dist/primitives/card.d.ts.map +1 -0
- package/dist/primitives/card.js +24 -0
- package/dist/primitives/chart.d.ts +42 -0
- package/dist/primitives/chart.d.ts.map +1 -0
- package/dist/primitives/chart.js +132 -0
- package/dist/primitives/checkbox.d.ts +5 -0
- package/dist/primitives/checkbox.d.ts.map +1 -0
- package/dist/primitives/checkbox.js +8 -0
- package/dist/primitives/code-node-static.d.ts +3 -0
- package/dist/primitives/code-node-static.d.ts.map +1 -0
- package/dist/primitives/code-node-static.js +5 -0
- package/dist/primitives/code-node.d.ts +3 -0
- package/dist/primitives/code-node.d.ts.map +1 -0
- package/dist/primitives/code-node.js +5 -0
- package/dist/primitives/command.d.ts +19 -0
- package/dist/primitives/command.d.ts.map +1 -0
- package/dist/primitives/command.js +33 -0
- package/dist/primitives/datepicker.d.ts +8 -0
- package/dist/primitives/datepicker.d.ts.map +1 -0
- package/dist/primitives/datepicker.js +42 -0
- package/dist/primitives/datepicker2.d.ts +8 -0
- package/dist/primitives/datepicker2.d.ts.map +1 -0
- package/dist/primitives/datepicker2.js +13 -0
- package/dist/primitives/dialog.d.ts +16 -0
- package/dist/primitives/dialog.d.ts.map +1 -0
- package/dist/primitives/dialog.js +35 -0
- package/dist/primitives/drawer.d.ts +14 -0
- package/dist/primitives/drawer.d.ts.map +1 -0
- package/dist/primitives/drawer.js +34 -0
- package/dist/primitives/dropdown-menu.d.ts +26 -0
- package/dist/primitives/dropdown-menu.d.ts.map +1 -0
- package/dist/primitives/dropdown-menu.js +50 -0
- package/dist/primitives/dropzone.d.ts +12 -0
- package/dist/primitives/dropzone.d.ts.map +1 -0
- package/dist/primitives/dropzone.js +7 -0
- package/dist/primitives/editor-static.d.ts +9 -0
- package/dist/primitives/editor-static.d.ts.map +1 -0
- package/dist/primitives/editor-static.js +29 -0
- package/dist/primitives/editor.d.ts +29 -0
- package/dist/primitives/editor.d.ts.map +1 -0
- package/dist/primitives/editor.js +56 -0
- package/dist/primitives/field.d.ts +27 -0
- package/dist/primitives/field.d.ts.map +1 -0
- package/dist/primitives/field.js +77 -0
- package/dist/primitives/fixed-toolbar.d.ts +3 -0
- package/dist/primitives/fixed-toolbar.d.ts.map +1 -0
- package/dist/primitives/fixed-toolbar.js +6 -0
- package/dist/primitives/form.d.ts +24 -0
- package/dist/primitives/form.d.ts.map +1 -0
- package/dist/primitives/form.js +58 -0
- package/dist/primitives/heading-node-static.d.ts +15 -0
- package/dist/primitives/heading-node-static.d.ts.map +1 -0
- package/dist/primitives/heading-node-static.js +37 -0
- package/dist/primitives/heading-node.d.ts +15 -0
- package/dist/primitives/heading-node.d.ts.map +1 -0
- package/dist/primitives/heading-node.js +37 -0
- package/dist/primitives/highlight-node-static.d.ts +3 -0
- package/dist/primitives/highlight-node-static.d.ts.map +1 -0
- package/dist/primitives/highlight-node-static.js +5 -0
- package/dist/primitives/highlight-node.d.ts +3 -0
- package/dist/primitives/highlight-node.d.ts.map +1 -0
- package/dist/primitives/highlight-node.js +5 -0
- package/dist/primitives/hr-node-static.d.ts +3 -0
- package/dist/primitives/hr-node-static.d.ts.map +1 -0
- package/dist/primitives/hr-node-static.js +6 -0
- package/dist/primitives/hr-node.d.ts +3 -0
- package/dist/primitives/hr-node.d.ts.map +1 -0
- package/dist/primitives/hr-node.js +9 -0
- package/dist/primitives/input.d.ts +4 -0
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +6 -0
- package/dist/primitives/kbd-node-static.d.ts +3 -0
- package/dist/primitives/kbd-node-static.d.ts.map +1 -0
- package/dist/primitives/kbd-node-static.js +5 -0
- package/dist/primitives/kbd-node.d.ts +3 -0
- package/dist/primitives/kbd-node.d.ts.map +1 -0
- package/dist/primitives/kbd-node.js +5 -0
- package/dist/primitives/kbd.d.ts +4 -0
- package/dist/primitives/kbd.d.ts.map +1 -0
- package/dist/primitives/kbd.js +9 -0
- package/dist/primitives/label.d.ts +5 -0
- package/dist/primitives/label.d.ts.map +1 -0
- package/dist/primitives/label.js +7 -0
- package/dist/primitives/mark-toolbar-button.d.ts +7 -0
- package/dist/primitives/mark-toolbar-button.d.ts.map +1 -0
- package/dist/primitives/mark-toolbar-button.js +8 -0
- package/dist/primitives/pagination.d.ts +14 -0
- package/dist/primitives/pagination.d.ts.map +1 -0
- package/dist/primitives/pagination.js +29 -0
- package/dist/primitives/paragraph-node-static.d.ts +3 -0
- package/dist/primitives/paragraph-node-static.d.ts.map +1 -0
- package/dist/primitives/paragraph-node-static.js +6 -0
- package/dist/primitives/paragraph-node.d.ts +3 -0
- package/dist/primitives/paragraph-node.d.ts.map +1 -0
- package/dist/primitives/paragraph-node.js +6 -0
- package/dist/primitives/popover.d.ts +8 -0
- package/dist/primitives/popover.d.ts.map +1 -0
- package/dist/primitives/popover.js +16 -0
- package/dist/primitives/progress.d.ts +5 -0
- package/dist/primitives/progress.d.ts.map +1 -0
- package/dist/primitives/progress.js +7 -0
- package/dist/primitives/radio-group.d.ts +6 -0
- package/dist/primitives/radio-group.d.ts.map +1 -0
- package/dist/primitives/radio-group.js +11 -0
- package/dist/primitives/scroll-area.d.ts +6 -0
- package/dist/primitives/scroll-area.d.ts.map +1 -0
- package/dist/primitives/scroll-area.js +12 -0
- package/dist/primitives/select.d.ts +16 -0
- package/dist/primitives/select.d.ts.map +1 -0
- package/dist/primitives/select.js +37 -0
- package/dist/primitives/separator.d.ts +5 -0
- package/dist/primitives/separator.d.ts.map +1 -0
- package/dist/primitives/separator.js +7 -0
- package/dist/primitives/sheet.d.ts +14 -0
- package/dist/primitives/sheet.d.ts.map +1 -0
- package/dist/primitives/sheet.js +39 -0
- package/dist/primitives/sidebar.d.ts +71 -0
- package/dist/primitives/sidebar.d.ts.map +1 -0
- package/dist/primitives/sidebar.js +212 -0
- package/dist/primitives/skeleton.d.ts +3 -0
- package/dist/primitives/skeleton.d.ts.map +1 -0
- package/dist/primitives/skeleton.js +6 -0
- package/dist/primitives/sonner.d.ts +4 -0
- package/dist/primitives/sonner.d.ts.map +1 -0
- package/dist/primitives/sonner.js +20 -0
- package/dist/primitives/spinner.d.ts +3 -0
- package/dist/primitives/spinner.d.ts.map +1 -0
- package/dist/primitives/spinner.js +7 -0
- package/dist/primitives/table.d.ts +11 -0
- package/dist/primitives/table.d.ts.map +1 -0
- package/dist/primitives/table.js +27 -0
- package/dist/primitives/tabs.d.ts +8 -0
- package/dist/primitives/tabs.d.ts.map +1 -0
- package/dist/primitives/tabs.js +16 -0
- package/dist/primitives/textarea.d.ts +4 -0
- package/dist/primitives/textarea.d.ts.map +1 -0
- package/dist/primitives/textarea.js +6 -0
- package/dist/primitives/toggle-group.d.ts +10 -0
- package/dist/primitives/toggle-group.d.ts.map +1 -0
- package/dist/primitives/toggle-group.js +21 -0
- package/dist/primitives/toggle.d.ts +10 -0
- package/dist/primitives/toggle.d.ts.map +1 -0
- package/dist/primitives/toggle.js +25 -0
- package/dist/primitives/toolbar.d.ts +43 -0
- package/dist/primitives/toolbar.d.ts.map +1 -0
- package/dist/primitives/toolbar.js +110 -0
- package/dist/primitives/tooltip.d.ts +8 -0
- package/dist/primitives/tooltip.d.ts.map +1 -0
- package/dist/primitives/tooltip.js +16 -0
- package/package.json +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @suryapamenang/ui
|
|
2
|
+
|
|
3
|
+
Shared React UI primitives, composite components and styles for Surya Pamenang application frontends.
|
|
4
|
+
|
|
5
|
+
Built on [shadcn/ui](https://ui.shadcn.com/) primitives, Tailwind CSS v4 and Radix UI.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Node.js >= 22
|
|
10
|
+
- pnpm >= 10
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pnpm add @suryapamenang/ui
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Peer dependencies are installed automatically by pnpm (`auto-install-peers=true`). With npm/yarn you must install them manually, see `peerDependencies` in `package.json`.
|
|
19
|
+
|
|
20
|
+
### Add the styles
|
|
21
|
+
|
|
22
|
+
The package ships a prebuilt Tailwind browser `.css` containing the design tokens. Import it once in your app (e.g. `app.css`):
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
@import "@suryapamenang/ui/styles.css";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> Note: the stylesheet already includes Tailwind, animations ([tw-animate-css](https://github.com/originjs/tw-animate-css)) and the `tailwind-scrollbar-hide` plugin. Do **not** import `tailwindcss` twice in the consuming app.
|
|
29
|
+
|
|
30
|
+
### Import components
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Button } from "@suryapamenang/ui/primitives/button";
|
|
34
|
+
import { Card, CardContent } from "@suryapamenang/ui/primitives/card";
|
|
35
|
+
import { cn } from "@suryapamenang/ui/lib/utils";
|
|
36
|
+
import { useIsMobile } from "@suryapamenang/ui/hooks/use-mobile";
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Exports are split by folder:
|
|
40
|
+
|
|
41
|
+
- `@suryapamenang/ui/primitives/*` – low-level UI primitives (button, dialog, select, …)
|
|
42
|
+
- `@suryapamenang/ui/components/*` – composite components (plate editor, file upload, multi-step viewer, …)
|
|
43
|
+
- `@suryapamenang/ui/hooks/*` – shared hooks
|
|
44
|
+
- `@suryapamenang/ui/lib/utils` – `cn()` helper
|
|
45
|
+
|
|
46
|
+
### Theming
|
|
47
|
+
|
|
48
|
+
Theme tokens are plain CSS variables defined in `src/styles/styles.css` (`--background`, `--primary`, `--brand`, `--highlight`, …). Override them after the stylesheet import to theme your app:
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
@import "@suryapamenang/ui/styles.css";
|
|
52
|
+
|
|
53
|
+
:root {
|
|
54
|
+
--primary: oklch(0.45 0.2 150);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Dark mode is a `.dark` class strategy (`@custom-variant dark (&:is(.dark *))`).
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
pnpm install
|
|
64
|
+
pnpm dev:styles # tailwind watch -> dist/index.css
|
|
65
|
+
pnpm dev:components # tsc watch -> dist
|
|
66
|
+
pnpm build # styles + components
|
|
67
|
+
pnpm check-types
|
|
68
|
+
pnpm lint # biome
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
New shadcn-style components can be added with the CLI and the bundled `components.json`.
|
|
72
|
+
|
|
73
|
+
## Publishing
|
|
74
|
+
|
|
75
|
+
Releases are managed with [release-please](https://github.com/googleapis/release-please-action). On merge to `main`, release-please opens a release PR; when merged, `.github/workflows/release.yaml` publishes via npm [trusted publishing (OIDC)](https://docs.npmjs.com/trusted-publishers) — no npm token is stored in CI. Both workflows run inside the nix development shell (see `flake.nix`).
|
|
76
|
+
|
|
77
|
+
The first version must be published manually (`npm login`, then `npm publish`) so the package exists on the registry, then configure the trusted publisher on the package's npm access page pointing at this repository's `release.yaml` workflow.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
Proprietary. Internal Surya Pamenang library.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const BaseBasicBlocksKit: (import("platejs").SlatePlugin<import("platejs").PluginConfig<"p", {}, {}, {}, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<any, {}, {}, Record<any, {
|
|
2
|
+
toggle: () => void;
|
|
3
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"blockquote", {}, {}, Record<"blockquote", {
|
|
4
|
+
toggle: () => void;
|
|
5
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"hr", {}, {}, {}, {}>>)[];
|
|
6
|
+
//# sourceMappingURL=basic-blocks-base-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-blocks-base-kit.d.ts","sourceRoot":"","sources":["../../src/components/basic-blocks-base-kit.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,kBAAkB;;;;iGAU9B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseBlockquotePlugin, BaseH1Plugin, BaseH2Plugin, BaseH3Plugin, BaseH4Plugin, BaseH5Plugin, BaseH6Plugin, BaseHorizontalRulePlugin, } from "@platejs/basic-nodes";
|
|
2
|
+
import { BaseParagraphPlugin } from "platejs";
|
|
3
|
+
import { BlockquoteElementStatic } from "../primitives/blockquote-node-static";
|
|
4
|
+
import { H1ElementStatic, H2ElementStatic, H3ElementStatic, H4ElementStatic, H5ElementStatic, H6ElementStatic, } from "../primitives/heading-node-static";
|
|
5
|
+
import { HrElementStatic } from "../primitives/hr-node-static";
|
|
6
|
+
import { ParagraphElementStatic } from "../primitives/paragraph-node-static";
|
|
7
|
+
export const BaseBasicBlocksKit = [
|
|
8
|
+
BaseParagraphPlugin.withComponent(ParagraphElementStatic),
|
|
9
|
+
BaseH1Plugin.withComponent(H1ElementStatic),
|
|
10
|
+
BaseH2Plugin.withComponent(H2ElementStatic),
|
|
11
|
+
BaseH3Plugin.withComponent(H3ElementStatic),
|
|
12
|
+
BaseH4Plugin.withComponent(H4ElementStatic),
|
|
13
|
+
BaseH5Plugin.withComponent(H5ElementStatic),
|
|
14
|
+
BaseH6Plugin.withComponent(H6ElementStatic),
|
|
15
|
+
BaseBlockquotePlugin.withComponent(BlockquoteElementStatic),
|
|
16
|
+
BaseHorizontalRulePlugin.withComponent(HrElementStatic),
|
|
17
|
+
];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const BasicBlocksKit: (import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"p", {}, {}, {}, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<any, {}, {}, Record<any, {
|
|
2
|
+
toggle: () => void;
|
|
3
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"blockquote", {}, {}, Record<"blockquote", {
|
|
4
|
+
toggle: () => void;
|
|
5
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"hr", {}, {}, {}, {}>>)[];
|
|
6
|
+
//# sourceMappingURL=basic-blocks-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-blocks-kit.d.ts","sourceRoot":"","sources":["../../src/components/basic-blocks-kit.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,cAAc;;;;uGA6D1B,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { BlockquotePlugin, H1Plugin, H2Plugin, H3Plugin, H4Plugin, H5Plugin, H6Plugin, HorizontalRulePlugin, } from "@platejs/basic-nodes/react";
|
|
2
|
+
import { ParagraphPlugin } from "platejs/react";
|
|
3
|
+
import { BlockquoteElement } from "../primitives/blockquote-node";
|
|
4
|
+
import { H1Element, H2Element, H3Element, H4Element, H5Element, H6Element, } from "../primitives/heading-node";
|
|
5
|
+
import { HrElement } from "../primitives/hr-node";
|
|
6
|
+
import { ParagraphElement } from "../primitives/paragraph-node";
|
|
7
|
+
export const BasicBlocksKit = [
|
|
8
|
+
ParagraphPlugin.withComponent(ParagraphElement),
|
|
9
|
+
H1Plugin.configure({
|
|
10
|
+
node: {
|
|
11
|
+
component: H1Element,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
break: { empty: "reset" },
|
|
15
|
+
},
|
|
16
|
+
shortcuts: { toggle: { keys: "mod+alt+1" } },
|
|
17
|
+
}),
|
|
18
|
+
H2Plugin.configure({
|
|
19
|
+
node: {
|
|
20
|
+
component: H2Element,
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
break: { empty: "reset" },
|
|
24
|
+
},
|
|
25
|
+
shortcuts: { toggle: { keys: "mod+alt+2" } },
|
|
26
|
+
}),
|
|
27
|
+
H3Plugin.configure({
|
|
28
|
+
node: {
|
|
29
|
+
component: H3Element,
|
|
30
|
+
},
|
|
31
|
+
rules: {
|
|
32
|
+
break: { empty: "reset" },
|
|
33
|
+
},
|
|
34
|
+
shortcuts: { toggle: { keys: "mod+alt+3" } },
|
|
35
|
+
}),
|
|
36
|
+
H4Plugin.configure({
|
|
37
|
+
node: {
|
|
38
|
+
component: H4Element,
|
|
39
|
+
},
|
|
40
|
+
rules: {
|
|
41
|
+
break: { empty: "reset" },
|
|
42
|
+
},
|
|
43
|
+
shortcuts: { toggle: { keys: "mod+alt+4" } },
|
|
44
|
+
}),
|
|
45
|
+
H5Plugin.configure({
|
|
46
|
+
node: {
|
|
47
|
+
component: H5Element,
|
|
48
|
+
},
|
|
49
|
+
rules: {
|
|
50
|
+
break: { empty: "reset" },
|
|
51
|
+
},
|
|
52
|
+
shortcuts: { toggle: { keys: "mod+alt+5" } },
|
|
53
|
+
}),
|
|
54
|
+
H6Plugin.configure({
|
|
55
|
+
node: {
|
|
56
|
+
component: H6Element,
|
|
57
|
+
},
|
|
58
|
+
rules: {
|
|
59
|
+
break: { empty: "reset" },
|
|
60
|
+
},
|
|
61
|
+
shortcuts: { toggle: { keys: "mod+alt+6" } },
|
|
62
|
+
}),
|
|
63
|
+
BlockquotePlugin.configure({
|
|
64
|
+
node: { component: BlockquoteElement },
|
|
65
|
+
shortcuts: { toggle: { keys: "mod+shift+period" } },
|
|
66
|
+
}),
|
|
67
|
+
HorizontalRulePlugin.withComponent(HrElement),
|
|
68
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const BaseBasicMarksKit: (import("platejs").SlatePlugin<import("platejs").PluginConfig<"bold", {}, {}, Record<"bold", {
|
|
2
|
+
toggle: () => void;
|
|
3
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"italic", {}, {}, Record<"italic", {
|
|
4
|
+
toggle: () => void;
|
|
5
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"underline", {}, {}, Record<"underline", {
|
|
6
|
+
toggle: () => void;
|
|
7
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"code", {}, {}, Record<"code", {
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"strikethrough", {}, {}, Record<"strikethrough", {
|
|
10
|
+
toggle: () => void;
|
|
11
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"subscript", {}, {}, Record<"subscript", {
|
|
12
|
+
toggle: () => void;
|
|
13
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"superscript", {}, {}, Record<"superscript", {
|
|
14
|
+
toggle: () => void;
|
|
15
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"highlight", {}, {}, Record<"highlight", {
|
|
16
|
+
toggle: () => void;
|
|
17
|
+
}>, {}>> | import("platejs").SlatePlugin<import("platejs").PluginConfig<"kbd", {}, {}, Record<"kbd", {
|
|
18
|
+
toggle: () => void;
|
|
19
|
+
}>, {}>>)[];
|
|
20
|
+
//# sourceMappingURL=basic-marks-base-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-marks-base-kit.d.ts","sourceRoot":"","sources":["../../src/components/basic-marks-base-kit.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;WAU7B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseBoldPlugin, BaseCodePlugin, BaseHighlightPlugin, BaseItalicPlugin, BaseKbdPlugin, BaseStrikethroughPlugin, BaseSubscriptPlugin, BaseSuperscriptPlugin, BaseUnderlinePlugin, } from "@platejs/basic-nodes";
|
|
2
|
+
import { CodeLeafStatic } from "../primitives/code-node-static";
|
|
3
|
+
import { HighlightLeafStatic } from "../primitives/highlight-node-static";
|
|
4
|
+
import { KbdLeafStatic } from "../primitives/kbd-node-static";
|
|
5
|
+
export const BaseBasicMarksKit = [
|
|
6
|
+
BaseBoldPlugin,
|
|
7
|
+
BaseItalicPlugin,
|
|
8
|
+
BaseUnderlinePlugin,
|
|
9
|
+
BaseCodePlugin.withComponent(CodeLeafStatic),
|
|
10
|
+
BaseStrikethroughPlugin,
|
|
11
|
+
BaseSubscriptPlugin,
|
|
12
|
+
BaseSuperscriptPlugin,
|
|
13
|
+
BaseHighlightPlugin.withComponent(HighlightLeafStatic),
|
|
14
|
+
BaseKbdPlugin.withComponent(KbdLeafStatic),
|
|
15
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const BasicMarksKit: (import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"bold", {}, {}, Record<"bold", {
|
|
2
|
+
toggle: () => void;
|
|
3
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"italic", {}, {}, Record<"italic", {
|
|
4
|
+
toggle: () => void;
|
|
5
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"underline", {}, {}, Record<"underline", {
|
|
6
|
+
toggle: () => void;
|
|
7
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"code", {}, {}, Record<"code", {
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"strikethrough", {}, {}, Record<"strikethrough", {
|
|
10
|
+
toggle: () => void;
|
|
11
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"subscript", {}, {}, Record<"subscript", {
|
|
12
|
+
toggle: () => void;
|
|
13
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"superscript", {}, {}, Record<"superscript", {
|
|
14
|
+
toggle: () => void;
|
|
15
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"highlight", {}, {}, Record<"highlight", {
|
|
16
|
+
toggle: () => void;
|
|
17
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"kbd", {}, {}, Record<"kbd", {
|
|
18
|
+
toggle: () => void;
|
|
19
|
+
}>, {}>>)[];
|
|
20
|
+
//# sourceMappingURL=basic-marks-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-marks-kit.d.ts","sourceRoot":"","sources":["../../src/components/basic-marks-kit.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;WAsBzB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BoldPlugin, CodePlugin, HighlightPlugin, ItalicPlugin, KbdPlugin, StrikethroughPlugin, SubscriptPlugin, SuperscriptPlugin, UnderlinePlugin, } from "@platejs/basic-nodes/react";
|
|
2
|
+
import { CodeLeaf } from "../primitives/code-node";
|
|
3
|
+
import { HighlightLeaf } from "../primitives/highlight-node";
|
|
4
|
+
import { KbdLeaf } from "../primitives/kbd-node";
|
|
5
|
+
export const BasicMarksKit = [
|
|
6
|
+
BoldPlugin,
|
|
7
|
+
ItalicPlugin,
|
|
8
|
+
UnderlinePlugin,
|
|
9
|
+
CodePlugin.configure({
|
|
10
|
+
node: { component: CodeLeaf },
|
|
11
|
+
shortcuts: { toggle: { keys: "mod+e" } },
|
|
12
|
+
}),
|
|
13
|
+
StrikethroughPlugin.configure({
|
|
14
|
+
shortcuts: { toggle: { keys: "mod+shift+x" } },
|
|
15
|
+
}),
|
|
16
|
+
SubscriptPlugin.configure({
|
|
17
|
+
shortcuts: { toggle: { keys: "mod+comma" } },
|
|
18
|
+
}),
|
|
19
|
+
SuperscriptPlugin.configure({
|
|
20
|
+
shortcuts: { toggle: { keys: "mod+period" } },
|
|
21
|
+
}),
|
|
22
|
+
HighlightPlugin.configure({
|
|
23
|
+
node: { component: HighlightLeaf },
|
|
24
|
+
shortcuts: { toggle: { keys: "mod+shift+h" } },
|
|
25
|
+
}),
|
|
26
|
+
KbdPlugin.withComponent(KbdLeaf),
|
|
27
|
+
];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const BasicNodesKit: (import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"p", {}, {}, {}, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<any, {}, {}, Record<any, {
|
|
2
|
+
toggle: () => void;
|
|
3
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"blockquote", {}, {}, Record<"blockquote", {
|
|
4
|
+
toggle: () => void;
|
|
5
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"hr", {}, {}, {}, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"bold", {}, {}, Record<"bold", {
|
|
6
|
+
toggle: () => void;
|
|
7
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"italic", {}, {}, Record<"italic", {
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"underline", {}, {}, Record<"underline", {
|
|
10
|
+
toggle: () => void;
|
|
11
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"code", {}, {}, Record<"code", {
|
|
12
|
+
toggle: () => void;
|
|
13
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"strikethrough", {}, {}, Record<"strikethrough", {
|
|
14
|
+
toggle: () => void;
|
|
15
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"subscript", {}, {}, Record<"subscript", {
|
|
16
|
+
toggle: () => void;
|
|
17
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"superscript", {}, {}, Record<"superscript", {
|
|
18
|
+
toggle: () => void;
|
|
19
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"highlight", {}, {}, Record<"highlight", {
|
|
20
|
+
toggle: () => void;
|
|
21
|
+
}>, {}>> | import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"kbd", {}, {}, Record<"kbd", {
|
|
22
|
+
toggle: () => void;
|
|
23
|
+
}>, {}>>)[];
|
|
24
|
+
//# sourceMappingURL=basic-nodes-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-nodes-kit.d.ts","sourceRoot":"","sources":["../../src/components/basic-nodes-kit.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;WAAwC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function FileUpload({ maxFiles, maxSize, placeholder, required, setValue, accept, name, disabled, }: {
|
|
2
|
+
maxFiles: number;
|
|
3
|
+
maxSize: number;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
setValue: (name: string, value: any, options?: {
|
|
8
|
+
shouldValidate?: boolean;
|
|
9
|
+
shouldDirty?: boolean;
|
|
10
|
+
shouldTouch?: boolean;
|
|
11
|
+
}) => void;
|
|
12
|
+
accept?: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=file-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.d.ts","sourceRoot":"","sources":["../../src/components/file-upload.tsx"],"names":[],"mappings":"AA4BA,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,OAAO,EACP,WAAW,EAEX,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,KACE,IAAI,CAAC;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,+BAyHA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** biome-ignore-all lint/a11y/useKeyWithClickEvents: 3rd party component */
|
|
3
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: 3rd party copy paste component */
|
|
4
|
+
/** biome-ignore-all lint/a11y/useSemanticElements: 3rd party copy paste component */
|
|
5
|
+
/** biome-ignore-all lint/a11y/useFocusableInteractive: 3rd party component */
|
|
6
|
+
import { AlertCircleIcon, CloudUpload, File, XIcon } from "lucide-react";
|
|
7
|
+
import { formatBytes, useFileUpload } from "../hooks/use-file-upload";
|
|
8
|
+
import { Button } from "../primitives/button";
|
|
9
|
+
const getFileIcon = (file) => {
|
|
10
|
+
const fileType = file.file.type;
|
|
11
|
+
if (fileType.startsWith("image/")) {
|
|
12
|
+
return (_jsx("div", { className: "aspect-square size-10 overflow-hidden rounded-md", children: _jsx("img", { src: URL.createObjectURL(file.file), alt: "hehe", className: "object-fill" }) }));
|
|
13
|
+
}
|
|
14
|
+
return (_jsx("div", { className: "aspect-square size-10 flex items-center justify-center overflow-hidden rounded-full", children: _jsx(File, { className: "size-5 opacity-60" }) }));
|
|
15
|
+
};
|
|
16
|
+
export function FileUpload({ maxFiles, maxSize, placeholder,
|
|
17
|
+
// description,
|
|
18
|
+
required, setValue, accept, name, disabled, }) {
|
|
19
|
+
const [{ files, isDragging, errors }, { handleDragEnter, handleDragLeave, handleDragOver, handleDrop, openFileDialog, removeFile, clearFiles, getInputProps, },] = useFileUpload({
|
|
20
|
+
multiple: maxFiles > 1,
|
|
21
|
+
maxFiles,
|
|
22
|
+
maxSize,
|
|
23
|
+
accept,
|
|
24
|
+
onFilesChange: (files) => {
|
|
25
|
+
setValue(name, files.map((file) => file.file), { shouldValidate: true, shouldDirty: true, shouldTouch: true });
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return (_jsxs("div", { className: "flex flex-col gap-2 pb-2", children: [_jsxs("div", { role: "button", onClick: openFileDialog, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, "data-dragging": isDragging || undefined, className: "border-input hover:bg-accent/50 data-[dragging=true]:bg-accent/50 has-[input:focus]:border-ring has-[input:focus]:ring-ring/50 flex min-h-32 flex-col items-center justify-center rounded-md border border-dashed p-4 transition-colors has-disabled:pointer-events-none has-disabled:opacity-50 has-[input:focus]:ring-[3px] hover:cursor-pointer", children: [_jsx("input", { ...getInputProps(), className: "sr-only", "aria-label": "Upload files", required: required, disabled: disabled }), _jsxs("div", { className: "flex flex-col items-center justify-center text-center", children: [_jsx("div", { className: "bg-secondary mb-2 flex size-11 shrink-0 items-center justify-center rounded-full border", "aria-hidden": "true", children: _jsx(CloudUpload, { className: "size-4 opacity-60" }) }), _jsx("p", { className: "text-foreground font-medium text-sm mb-2", children: "Drag & drop or click to browse" }), _jsx("div", { className: "text-muted-foreground/70 flex flex-wrap justify-center gap-1 text-xs", children: placeholder })] })] }), errors.length > 0 && (_jsxs("div", { className: "text-destructive flex items-center gap-1 text-xs", role: "alert", children: [_jsx(AlertCircleIcon, { className: "size-3 shrink-0" }), _jsx("span", { children: errors[0] })] })), files.length > 0 && (_jsxs("div", { className: "space-y-2", children: [files.map((file) => (_jsxs("div", { className: "flex items-center justify-between gap-2 rounded-lg border p-2 pe-3", children: [_jsxs("div", { className: "flex items-center gap-1.5 overflow-hidden", children: [getFileIcon(file), _jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx("p", { className: "truncate text-[11px] font-medium max-w-[200px]", children: file.file.name }), _jsx("p", { className: "text-muted-foreground text-xs", children: formatBytes(file.file.size) })] })] }), _jsx(Button, { size: "icon", variant: "ghost", className: "text-muted-foreground/80 hover:text-foreground -me-2 size-8 hover:bg-transparent", onClick: () => removeFile(file.id), "aria-label": "Remove file", children: _jsx(XIcon, { className: "size-4", "aria-hidden": "true" }) })] }, file.id))), files.length > 1 && (_jsx("div", { className: "flex justify-end", children: _jsx(Button, { size: "sm", variant: "outline", onClick: clearFiles, children: "Remove all files" }) }))] }))] }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { type MotionProps } from "motion/react";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
import { type buttonVariants } from "../primitives/button";
|
|
5
|
+
declare const NextButton: (props: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
}) => React.JSX.Element | null;
|
|
8
|
+
declare const PreviousButton: (props: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
}) => React.JSX.Element | null;
|
|
11
|
+
declare const SubmitButton: (props: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
}) => React.JSX.Element | null;
|
|
14
|
+
declare const ResetButton: (props: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
}) => React.JSX.Element;
|
|
17
|
+
declare const FormHeader: (props: React.ComponentProps<"div">) => React.JSX.Element;
|
|
18
|
+
declare const StepIndicator: (props: React.ComponentProps<"div">) => React.JSX.Element;
|
|
19
|
+
declare const FormFooter: (props: React.ComponentProps<"div">) => React.JSX.Element;
|
|
20
|
+
declare const StepFields: (props: React.ComponentProps<"div"> & MotionProps) => React.JSX.Element | null;
|
|
21
|
+
declare function MultiStepFormContent(props: React.ComponentProps<"div">): React.JSX.Element;
|
|
22
|
+
export { MultiStepFormContent, FormHeader, FormFooter, StepFields, StepIndicator, NextButton, PreviousButton, SubmitButton, ResetButton, };
|
|
23
|
+
//# sourceMappingURL=multi-step-viewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-step-viewer.d.ts","sourceRoot":"","sources":["../../src/components/multi-step-viewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAmB,KAAK,WAAW,EAAU,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGnE,QAAA,MAAM,UAAU,GACd,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GACnC,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,6BAOJ,CAAC;AAEF,QAAA,MAAM,cAAc,GAClB,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GACnC,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,6BAaJ,CAAC;AAEF,QAAA,MAAM,YAAY,GAChB,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GACnC,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,6BAKJ,CAAC;AAEF,QAAA,MAAM,WAAW,GACf,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GACnC,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,sBAGJ,CAAC;AAEF,QAAA,MAAM,UAAU,GAAI,OAAO,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,sBAWrD,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,OAAO,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,sBA0ExD,CAAC;AACF,QAAA,MAAM,UAAU,GAAI,OAAO,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,sBAOrD,CAAC;AAEF,QAAA,MAAM,UAAU,GAAI,OAAO,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,6BAwBnE,CAAC;AAEF,iBAAS,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAE/D;AAED,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,UAAU,EACV,aAAa,EAEb,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,GACZ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check } from "lucide-react";
|
|
3
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
4
|
+
import { useMultiStepForm } from "../hooks/use-multi-step-viewer";
|
|
5
|
+
import { Button } from "../primitives/button";
|
|
6
|
+
import { Progress } from "../primitives/progress";
|
|
7
|
+
const NextButton = (props) => {
|
|
8
|
+
const { isLastStep, goToNext } = useMultiStepForm();
|
|
9
|
+
if (isLastStep)
|
|
10
|
+
return null;
|
|
11
|
+
return (_jsx(Button, { size: "sm", type: "button", onClick: () => goToNext(), ...props }));
|
|
12
|
+
};
|
|
13
|
+
const PreviousButton = (props) => {
|
|
14
|
+
const { isFirstStep, goToPrevious } = useMultiStepForm();
|
|
15
|
+
if (isFirstStep)
|
|
16
|
+
return null;
|
|
17
|
+
return (_jsx(Button, { size: "sm", type: "button", variant: "outline", onClick: () => goToPrevious(), ...props }));
|
|
18
|
+
};
|
|
19
|
+
const SubmitButton = (props) => {
|
|
20
|
+
const { isLastStep } = useMultiStepForm();
|
|
21
|
+
if (!isLastStep)
|
|
22
|
+
return null;
|
|
23
|
+
return _jsx(Button, { size: "sm", type: "button", ...props });
|
|
24
|
+
};
|
|
25
|
+
const ResetButton = (props) => {
|
|
26
|
+
return _jsx(Button, { size: "sm", type: "button", variant: "ghost", ...props });
|
|
27
|
+
};
|
|
28
|
+
const FormHeader = (props) => {
|
|
29
|
+
const { currentStepIndex, steps } = useMultiStepForm();
|
|
30
|
+
return (_jsxs("div", { className: "flex flex-col items-start justify-center gap-3 pb-4", ...props, children: [_jsx(StepIndicator, {}), _jsx(Progress, { value: (currentStepIndex / steps.length) * 100 })] }));
|
|
31
|
+
};
|
|
32
|
+
const StepIndicator = (props) => {
|
|
33
|
+
const { currentStepIndex, steps, goToStep } = useMultiStepForm();
|
|
34
|
+
const currentStep = steps[currentStepIndex - 1];
|
|
35
|
+
const StepIcon = currentStep?.icon;
|
|
36
|
+
return (_jsxs("div", { className: "w-full", ...props, children: [_jsx("div", { className: "flex flex-col items-center gap-2 md:hidden", children: _jsxs("div", { className: "flex items-center gap-2", children: [StepIcon && _jsx(StepIcon, { className: "w-4 h-4 text-primary" }), _jsx("span", { className: "text-sm font-medium text-primary", children: currentStep?.title || `Step ${currentStepIndex}` })] }) }), _jsx("div", { className: "hidden md:flex items-center justify-between w-full gap-2 px-1", children: steps.map((step, index) => {
|
|
37
|
+
const stepNum = index + 1;
|
|
38
|
+
const isCurrent = stepNum === currentStepIndex;
|
|
39
|
+
const isCompleted = stepNum < currentStepIndex;
|
|
40
|
+
const typedStep = step;
|
|
41
|
+
const Icon = typedStep.icon;
|
|
42
|
+
return (_jsxs("button", { type: "button", onClick: () => goToStep(stepNum), className: `flex flex-col items-center gap-1.5 min-w-20 ${isCurrent
|
|
43
|
+
? "text-primary"
|
|
44
|
+
: isCompleted
|
|
45
|
+
? "text-muted-foreground cursor-pointer"
|
|
46
|
+
: "text-muted-foreground/50 cursor-pointer"}`, children: [_jsx("div", { className: `w-8 h-8 rounded-full flex items-center justify-center border-2 transition-colors shrink-0 ${isCurrent
|
|
47
|
+
? "border-primary bg-primary text-primary-foreground"
|
|
48
|
+
: isCompleted
|
|
49
|
+
? "border-primary bg-primary text-primary-foreground"
|
|
50
|
+
: "border-muted-foreground/30"}`, children: isCompleted ? (_jsx(Check, { className: "w-4 h-4" })) : Icon ? (_jsx(Icon, { className: "w-4 h-4" })) : (stepNum) }), _jsx("span", { className: `text-xs text-center leading-tight whitespace-nowrap ${isCurrent
|
|
51
|
+
? "text-primary font-medium"
|
|
52
|
+
: "text-muted-foreground"}`, children: typedStep.title || `Step ${stepNum}` })] }, stepNum));
|
|
53
|
+
}) })] }));
|
|
54
|
+
};
|
|
55
|
+
const FormFooter = (props) => {
|
|
56
|
+
return (_jsx("div", { className: "w-full pt-3 flex items-center justify-end gap-3", ...props }));
|
|
57
|
+
};
|
|
58
|
+
const StepFields = (props) => {
|
|
59
|
+
const { currentStepIndex, steps } = useMultiStepForm();
|
|
60
|
+
const currentFormStep = steps[currentStepIndex - 1];
|
|
61
|
+
if (!currentFormStep ||
|
|
62
|
+
currentStepIndex < 1 ||
|
|
63
|
+
currentStepIndex > steps.length) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return (_jsx(AnimatePresence, { mode: "popLayout", children: _jsx(motion.div, { initial: { opacity: 0, x: 15 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: -15 }, transition: { duration: 0.4, type: "spring" }, ...props, children: currentFormStep.component }, currentStepIndex) }));
|
|
67
|
+
};
|
|
68
|
+
function MultiStepFormContent(props) {
|
|
69
|
+
return _jsx("div", { className: "flex flex-col gap-2 pt-3", ...props });
|
|
70
|
+
}
|
|
71
|
+
export { MultiStepFormContent, FormHeader, FormFooter, StepFields, StepIndicator,
|
|
72
|
+
// Form Actions
|
|
73
|
+
NextButton, PreviousButton, SubmitButton, ResetButton, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plate-editor.d.ts","sourceRoot":"","sources":["../../src/components/plate-editor.tsx"],"names":[],"mappings":"AAMA,wBAAgB,WAAW,gCAa1B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { normalizeNodeId } from "platejs";
|
|
3
|
+
import { Plate, usePlateEditor } from "platejs/react";
|
|
4
|
+
import { BasicNodesKit } from "../components/basic-nodes-kit";
|
|
5
|
+
import { Editor, EditorContainer } from "../primitives/editor";
|
|
6
|
+
export function PlateEditor() {
|
|
7
|
+
const editor = usePlateEditor({
|
|
8
|
+
plugins: BasicNodesKit,
|
|
9
|
+
value,
|
|
10
|
+
});
|
|
11
|
+
return (_jsx(Plate, { editor: editor, children: _jsx(EditorContainer, { children: _jsx(Editor, { variant: "demo", placeholder: "Type..." }) }) }));
|
|
12
|
+
}
|
|
13
|
+
const value = normalizeNodeId([
|
|
14
|
+
{
|
|
15
|
+
children: [{ text: "Basic Editor" }],
|
|
16
|
+
type: "h1",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
children: [{ text: "Heading 2" }],
|
|
20
|
+
type: "h2",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
children: [{ text: "Heading 3" }],
|
|
24
|
+
type: "h3",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
children: [{ text: "This is a blockquote element" }],
|
|
28
|
+
type: "blockquote",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
children: [
|
|
32
|
+
{ text: "Basic marks: " },
|
|
33
|
+
{ bold: true, text: "bold" },
|
|
34
|
+
{ text: ", " },
|
|
35
|
+
{ italic: true, text: "italic" },
|
|
36
|
+
{ text: ", " },
|
|
37
|
+
{ text: "underline", underline: true },
|
|
38
|
+
{ text: ", " },
|
|
39
|
+
{ strikethrough: true, text: "strikethrough" },
|
|
40
|
+
{ text: "." },
|
|
41
|
+
],
|
|
42
|
+
type: "p",
|
|
43
|
+
},
|
|
44
|
+
]);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { type ChangeEvent, type DragEvent, type InputHTMLAttributes } from "react";
|
|
3
|
+
export type FileMetadata = {
|
|
4
|
+
name: string;
|
|
5
|
+
size: number;
|
|
6
|
+
type: string;
|
|
7
|
+
url: string;
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
export type FileWithPreview = {
|
|
11
|
+
file: File | FileMetadata;
|
|
12
|
+
id: string;
|
|
13
|
+
preview?: string;
|
|
14
|
+
};
|
|
15
|
+
export type FileUploadOptions = {
|
|
16
|
+
maxFiles?: number;
|
|
17
|
+
maxSize?: number;
|
|
18
|
+
accept?: string;
|
|
19
|
+
multiple?: boolean;
|
|
20
|
+
initialFiles?: FileMetadata[];
|
|
21
|
+
onFilesChange?: (files: FileWithPreview[]) => void;
|
|
22
|
+
onFilesAdded?: (addedFiles: FileWithPreview[]) => void;
|
|
23
|
+
};
|
|
24
|
+
export type FileUploadState = {
|
|
25
|
+
files: FileWithPreview[];
|
|
26
|
+
isDragging: boolean;
|
|
27
|
+
errors: string[];
|
|
28
|
+
};
|
|
29
|
+
export type FileUploadActions = {
|
|
30
|
+
addFiles: (files: FileList | File[]) => void;
|
|
31
|
+
removeFile: (id: string) => void;
|
|
32
|
+
clearFiles: () => void;
|
|
33
|
+
clearErrors: () => void;
|
|
34
|
+
handleDragEnter: (e: DragEvent<HTMLElement>) => void;
|
|
35
|
+
handleDragLeave: (e: DragEvent<HTMLElement>) => void;
|
|
36
|
+
handleDragOver: (e: DragEvent<HTMLElement>) => void;
|
|
37
|
+
handleDrop: (e: DragEvent<HTMLElement>) => void;
|
|
38
|
+
handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
39
|
+
openFileDialog: () => void;
|
|
40
|
+
getInputProps: (props?: InputHTMLAttributes<HTMLInputElement>) => InputHTMLAttributes<HTMLInputElement> & {
|
|
41
|
+
ref: React.Ref<HTMLInputElement>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const useFileUpload: (options?: FileUploadOptions) => [FileUploadState, FileUploadActions];
|
|
45
|
+
export declare const formatBytes: (bytes: number, decimals?: number) => string;
|
|
46
|
+
//# sourceMappingURL=use-file-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-file-upload.d.ts","sourceRoot":"","sources":["../../src/hooks/use-file-upload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,mBAAmB,EAIzB,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,IAAI,GAAG,YAAY,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACnD,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;IAC7C,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACrD,eAAe,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACrD,cAAc,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACpD,UAAU,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAChD,gBAAgB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7D,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,EAAE,CACb,KAAK,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,KAC1C,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;QAC3C,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;KAClC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,UAAS,iBAAsB,KAC9B,CAAC,eAAe,EAAE,iBAAiB,CA2RrC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,iBAAY,KAAG,MAezD,CAAC"}
|