@andreagiugni/tailwind-dashboard-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.
Files changed (66) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +282 -0
  3. package/dist/Editor-uOYxR3HX.d.cts +53 -0
  4. package/dist/Editor-uOYxR3HX.d.ts +53 -0
  5. package/dist/chunk-4OETC46A.js +353 -0
  6. package/dist/chunk-4OETC46A.js.map +1 -0
  7. package/dist/chunk-7OWZKV75.js +420 -0
  8. package/dist/chunk-7OWZKV75.js.map +1 -0
  9. package/dist/chunk-BGA7AECV.cjs +152 -0
  10. package/dist/chunk-BGA7AECV.cjs.map +1 -0
  11. package/dist/chunk-HT7SQXRF.cjs +85 -0
  12. package/dist/chunk-HT7SQXRF.cjs.map +1 -0
  13. package/dist/chunk-HZQZC5CK.js +124 -0
  14. package/dist/chunk-HZQZC5CK.js.map +1 -0
  15. package/dist/chunk-MEU4PMP5.js +146 -0
  16. package/dist/chunk-MEU4PMP5.js.map +1 -0
  17. package/dist/chunk-MYOOZFHK.cjs +430 -0
  18. package/dist/chunk-MYOOZFHK.cjs.map +1 -0
  19. package/dist/chunk-OSIOO5AE.cjs +130 -0
  20. package/dist/chunk-OSIOO5AE.cjs.map +1 -0
  21. package/dist/chunk-R66LONPQ.js +83 -0
  22. package/dist/chunk-R66LONPQ.js.map +1 -0
  23. package/dist/chunk-W7SNEBD7.cjs +362 -0
  24. package/dist/chunk-W7SNEBD7.cjs.map +1 -0
  25. package/dist/chunk-YERNSNT4.cjs +13 -0
  26. package/dist/chunk-YERNSNT4.cjs.map +1 -0
  27. package/dist/chunk-ZLIYUUA4.js +11 -0
  28. package/dist/chunk-ZLIYUUA4.js.map +1 -0
  29. package/dist/components/Calendar/Calendar.cjs +14 -0
  30. package/dist/components/Calendar/Calendar.cjs.map +1 -0
  31. package/dist/components/Calendar/Calendar.d.cts +12 -0
  32. package/dist/components/Calendar/Calendar.d.ts +12 -0
  33. package/dist/components/Calendar/Calendar.js +5 -0
  34. package/dist/components/Calendar/Calendar.js.map +1 -0
  35. package/dist/components/Charts/BarChart.cjs +13 -0
  36. package/dist/components/Charts/BarChart.cjs.map +1 -0
  37. package/dist/components/Charts/BarChart.d.cts +13 -0
  38. package/dist/components/Charts/BarChart.d.ts +13 -0
  39. package/dist/components/Charts/BarChart.js +4 -0
  40. package/dist/components/Charts/BarChart.js.map +1 -0
  41. package/dist/components/Charts/LineChart.cjs +13 -0
  42. package/dist/components/Charts/LineChart.cjs.map +1 -0
  43. package/dist/components/Charts/LineChart.d.cts +13 -0
  44. package/dist/components/Charts/LineChart.d.ts +13 -0
  45. package/dist/components/Charts/LineChart.js +4 -0
  46. package/dist/components/Charts/LineChart.js.map +1 -0
  47. package/dist/components/Editor/Editor.cjs +14 -0
  48. package/dist/components/Editor/Editor.cjs.map +1 -0
  49. package/dist/components/Editor/Editor.d.cts +3 -0
  50. package/dist/components/Editor/Editor.d.ts +3 -0
  51. package/dist/components/Editor/Editor.js +5 -0
  52. package/dist/components/Editor/Editor.js.map +1 -0
  53. package/dist/components/Map/CountryMap.cjs +13 -0
  54. package/dist/components/Map/CountryMap.cjs.map +1 -0
  55. package/dist/components/Map/CountryMap.d.cts +13 -0
  56. package/dist/components/Map/CountryMap.d.ts +13 -0
  57. package/dist/components/Map/CountryMap.js +4 -0
  58. package/dist/components/Map/CountryMap.js.map +1 -0
  59. package/dist/index.cjs +2896 -0
  60. package/dist/index.cjs.map +1 -0
  61. package/dist/index.d.cts +573 -0
  62. package/dist/index.d.ts +573 -0
  63. package/dist/index.js +2816 -0
  64. package/dist/index.js.map +1 -0
  65. package/package.json +134 -0
  66. package/src/theme.css +784 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andrea Giugni
4
+ Copyright (c) 2023 TailAdmin (original TailAdmin dashboard this library was extracted from)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,282 @@
1
+ # @andreagiugni/tailwind-dashboard-ui
2
+
3
+ Reusable React + Tailwind CSS v4 dashboard components extracted from TailAdmin. Every primitive
4
+ ships with its Tailwind styling, extends the underlying element's native HTML attributes (so
5
+ `onClick`, `onDoubleClick`, `aria-*`, `data-*`, … just work), exposes named style variants, and —
6
+ where visually meaningful — accepts inline `bgColor` / `textColor` / `borderColor` overrides.
7
+
8
+ Dual ESM + CJS builds with TypeScript types. Every component — including the data-viz widgets
9
+ (charts, calendar, map) — is exported from the single package entry point.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm i @andreagiugni/tailwind-dashboard-ui
15
+ ```
16
+
17
+ ### Peer dependencies
18
+
19
+ The core package requires:
20
+
21
+ - **React 18 or 19** (`react`, `react-dom`)
22
+ - **Tailwind CSS v4** (`tailwindcss@^4`)
23
+
24
+ `clsx`, `tailwind-merge`, and `flatpickr` (used by `DatePicker`) are bundled runtime dependencies —
25
+ you do not need to install them yourself.
26
+
27
+ The following heavy libraries are **optional** peers, only needed if you use the matching
28
+ data-viz component:
29
+
30
+ | Component | Optional peer deps |
31
+ |---|---|
32
+ | `BarChart`, `LineChart` | `apexcharts`, `react-apexcharts` |
33
+ | `Calendar` | `@fullcalendar/core`, `@fullcalendar/react`, `@fullcalendar/daygrid`, `@fullcalendar/timegrid`, `@fullcalendar/list`, `@fullcalendar/interaction` |
34
+ | `CountryMap` | `@react-jvectormap/core`, `@react-jvectormap/world` |
35
+ | `Editor` (WYSIWYG) | `@tiptap/react`, `@tiptap/pm`, `@tiptap/starter-kit`, `@tiptap/extension-link`, `@tiptap/extension-placeholder` |
36
+
37
+ Install only the ones for the components you use, e.g.:
38
+
39
+ ```bash
40
+ npm i apexcharts react-apexcharts # for BarChart / LineChart
41
+ npm i @tiptap/react @tiptap/pm @tiptap/starter-kit @tiptap/extension-link @tiptap/extension-placeholder # for Editor
42
+ ```
43
+
44
+ > **SSR note:** the data-viz components and the `Editor` touch `window`/the DOM at render time.
45
+ > In server-rendered frameworks (e.g. Next.js) render them client-only — for example with
46
+ > `next/dynamic(() => import('@andreagiugni/tailwind-dashboard-ui').then(m => m.BarChart), { ssr: false })`.
47
+ > They are code-split into their own chunks and never executed unless you actually import them, so
48
+ > the rest of the library stays SSR-safe and light.
49
+
50
+ ## Tailwind setup
51
+
52
+ The library ships its design tokens as an importable stylesheet. Add this line to your app's
53
+ Tailwind entry CSS (the file that already contains `@import 'tailwindcss';`):
54
+
55
+ ```css
56
+ @import '@andreagiugni/tailwind-dashboard-ui/theme.css';
57
+ ```
58
+
59
+ `theme.css` registers the full TailAdmin token set (brand / blue-light / gray / orange / success /
60
+ error / warning palettes, `--text-theme-*`, `--shadow-theme-*`, `--z-index-*`) inside an `@theme`
61
+ block, plus base layer rules.
62
+
63
+ **Dark mode** is driven by the `.dark` class. The theme defines a custom `dark` variant against an
64
+ ancestor `.dark`, so toggle dark mode by adding/removing the `dark` class on `<html>` (or any
65
+ ancestor):
66
+
67
+ ```html
68
+ <html class="dark">
69
+ ```
70
+
71
+ The `ThemeToggleButton` component is controllable for this purpose (`theme` + `onToggle` props).
72
+
73
+ ## Importing components
74
+
75
+ Everything is exported from the single package entry point:
76
+
77
+ ```tsx
78
+ import {
79
+ Button,
80
+ Badge,
81
+ Alert,
82
+ Input,
83
+ Select,
84
+ Modal,
85
+ Table,
86
+ TableHeader,
87
+ TableBody,
88
+ TableRow,
89
+ TableCell,
90
+ // hero-ui parity additions
91
+ Accordion,
92
+ AccordionItem,
93
+ Tabs,
94
+ Tab,
95
+ Tooltip,
96
+ Popover,
97
+ Drawer,
98
+ Chip,
99
+ Progress,
100
+ Spinner,
101
+ Skeleton,
102
+ Slider,
103
+ Code,
104
+ Snippet,
105
+ // data viz + editor (see SSR note above)
106
+ BarChart,
107
+ LineChart,
108
+ Calendar,
109
+ CountryMap,
110
+ Editor,
111
+ } from '@andreagiugni/tailwind-dashboard-ui';
112
+ ```
113
+
114
+ ## Props model
115
+
116
+ Three conventions apply across the library:
117
+
118
+ 1. **Native handlers via HTML-attribute extension.** Each component's props extend the root
119
+ element's React HTML attribute type (e.g. `ButtonHTMLAttributes`), so every native handler and
120
+ attribute (`onClick`, `onDoubleClick`, `onMouseEnter`, `aria-*`, `data-*`, …) is available with
121
+ zero extra wiring and is forwarded onto the underlying element.
122
+ 2. **Named variants.** Visual states are selected with discrete props such as `variant`, `size`,
123
+ and `color` instead of class strings.
124
+ 3. **Inline color overrides.** Where meaningful, components accept `bgColor`, `textColor`, and
125
+ `borderColor`. These map to inline `style` (`backgroundColor` / `color` / `borderColor`) and let
126
+ you escape the named palette for one-off colors. A consumer-supplied `style` prop always wins.
127
+
128
+ ```tsx
129
+ import { Button, Badge } from '@andreagiugni/tailwind-dashboard-ui';
130
+ import '@andreagiugni/tailwind-dashboard-ui/theme.css'; // in your Tailwind entry CSS
131
+
132
+ <Button variant="primary" onDoubleClick={handle}>Save</Button>
133
+ <Button bgColor="#ff5722" textColor="#fff">Custom</Button>
134
+ <Badge color="success">Active</Badge>
135
+ ```
136
+
137
+ ## Component reference
138
+
139
+ Legend: **(+native)** = also extends the element's native HTML attributes.
140
+ **(+override)** = accepts `bgColor` / `textColor` / `borderColor`.
141
+
142
+ ### Core UI
143
+
144
+ | Component | Key props |
145
+ |---|---|
146
+ | `Button` | `variant` (primary/outline), `size` (sm/md), `startIcon`, `endIcon`, `disabled`, (+native button) (+override) |
147
+ | `Badge` | `variant` (light/solid), `color` (primary/success/error/warning/info/light/dark), `size` (sm/md), `startIcon`, `endIcon`, (+native span) (+override) |
148
+ | `Ribbon` | `variant` (corner/rounded/flag), `color` (primary/success/error/warning/info/dark), `position` (top-left/top-right/bottom-left/bottom-right), `children` (label), (+native span) (+override) — place inside a `relative` host (corner needs `overflow-hidden`) |
149
+ | `Alert` | `variant` (success/error/warning/info), `title`, `message`, `showLink`, `linkHref`, `linkText`, `icon?` (override icon), (+native div) |
150
+ | `Avatar` | `src`, `alt`, `size` (xsmall…xxlarge), `status` (online/offline/busy/none), `statusColor?`, (+native img) |
151
+ | `AvatarText` | `children`, `className`, (+native div) |
152
+ | `Dropdown` | `isOpen`, `onClose`, `children`, (+native div) |
153
+ | `DropdownItem` | `variant` (default/primary/outline, like Button), `bgColor`/`textColor`/`borderColor` overrides, `tag` (a/button), `href`, `onClick`, `onItemClick`, `baseClassName` (full override) |
154
+ | `Modal` | `isOpen`, `onClose`, `showCloseButton`, `isFullscreen`, `closeOnBackdrop?`, `closeOnEsc?`; **alert preset** → `variant` (`success`/`info`/`warning`/`danger`) + `title`, `description`, `actionText?`, `onAction?`; (+native div) |
155
+ | `Table` / `TableHeader` / `TableBody` / `TableRow` / `TableCell` | `children`, `isHeader` (cell), (+native table elements; `onClick` / `onDoubleClick` on rows & cells) |
156
+ | `Pagination` | `currentPage`, `totalPages`, `onPageChange` |
157
+ | `DataTable` | `data`, `columns` (`key`, `header`, `sortable?`, `align?`, `render?`), `rowsPerPage?`, `rowsPerPageOptions?`, `searchable?`, `searchKeys?`, `defaultSortKey?` / `defaultSortDirection?`, `pagination?`, `showSizeSelector?`, `onRowClick?`, `getRowId?`, `emptyContent?` — generic, search + per-column sort + pagination built in |
158
+ | `Breadcrumb` | `pageTitle`, `items?`, (+native) |
159
+ | `ThemeToggleButton` | `theme?` (controlled), `onToggle?`, (+native button) |
160
+ | `Accordion` / `AccordionItem` | `selectionMode` (single/multiple), `expandedKeys` / `defaultExpandedKeys`, `onExpandedChange`; item: `itemKey`, `title`, `startContent?`, `disabled` |
161
+ | `Tabs` / `Tab` | `variant` (underline/solid/pill), `selectedKey` / `defaultSelectedKey`, `onSelectionChange`, `color?`; tab: `tabKey`, `title`, `disabled` |
162
+ | `Chip` | `color`, `variant` (light/solid), `size`, `startIcon`, `endIcon`, `avatar?`, `onClose?`, (+native span) (+override) |
163
+ | `Code` | `color` (primary/success/error/warning/info/default), `size` (sm/md), (+native code) (+override) |
164
+ | `Snippet` | `code` (string \| string[]), `symbol?`, `hideCopyButton?`, `hideSymbol?`, `size`, (+override) |
165
+ | `Progress` | `value`, `maxValue?`, `color`, `size` (sm/md/lg), `label?`, `showValueLabel?`, `isIndeterminate?` |
166
+ | `Spinner` | `size` (sm/md/lg), `color`, `label?` |
167
+ | `Skeleton` | `isLoaded`, `width?`, `height?`, `className`, `children?` |
168
+
169
+ ### Overlays
170
+
171
+ | Component | Key props |
172
+ |---|---|
173
+ | `Tooltip` | `content`, `placement` (top/right/bottom/left), `delay?`, `disabled?`, (+native span) (+override) |
174
+ | `Popover` | `trigger`, `placement`, `isOpen?` / `defaultOpen?` / `onOpenChange?`, `closeOnOutsideClick?`, `closeOnEsc?` |
175
+ | `Drawer` | `isOpen`, `onClose`, `placement` (left/right/top/bottom), `showCloseButton?`, `closeOnBackdrop?`, `closeOnEsc?`, `size?`, (+native div) |
176
+
177
+ ### Form controls
178
+
179
+ | Component | Key props |
180
+ |---|---|
181
+ | `Input` | `type`, `value` / `defaultValue`, `onChange`, `success`, `error`, `hint`, `disabled`, (+native input) (+override) |
182
+ | `Label` | `htmlFor`, `children`, (+native label) |
183
+ | `Select` | `options`, `placeholder`, `defaultValue`, `onChange(value)`, `disabled` |
184
+ | `MultiSelect` | `options`, `selected` / `defaultSelected`, `onChange`, `placeholder`, `disabled` |
185
+ | `Checkbox` | `label`, `checked`, `onChange(checked)`, `disabled`, `checkedColor?` |
186
+ | `Radio` / `RadioSm` | `id`, `name`, `value`, `checked`, `label`, `onChange(value)`, `disabled` |
187
+ | `Switch` | `label`, `checked` / `defaultChecked`, `onChange(checked)`, `color` (blue/gray), `disabled` |
188
+ | `TextArea` | `value`, `onChange`, `rows`, `success`, `error`, `hint`, `disabled` |
189
+ | `FileInput` | `onChange`, `accept`, `multiple`, (+native input) |
190
+ | `PasswordInput` | password field with a show/hide eye toggle, (+native input attrs) |
191
+ | `Dropzone` | `onDrop(files)`, `accept?`, `multiple?`, `title?`, `description?`, `browseLabel?` — drag-and-drop upload, dependency-free |
192
+ | `DatePicker` | `id`, `mode` (single/multiple/range/time), `defaultDate`, `onChange`, `label`, `placeholder` |
193
+ | `DateTimePicker` | `id`, `label?`, `placeholder?`, `defaultDate?`, `defaultTime?` (`"HH:MM"`), `onChange?({ date, time })` — flatpickr date calendar + a compact `HH:MM` time input |
194
+ | `Slider` | `value` / `defaultValue`, `onChange(value)`, `min`, `max`, `step`, `color`, `label?`, `showValue?`, `disabled` |
195
+ | `Editor` (WYSIWYG) | `content`, `onChange(html)`, `placeholder?`, `editable?`, `toolbar?` (ordered tool ids or custom buttons), `editorClassName?` — optional Tiptap peers; render client-only (see Data viz) |
196
+
197
+ ### Data viz
198
+
199
+ These wrap optional heavy peer deps and must be rendered client-only under SSR (see the SSR note
200
+ in [Peer dependencies](#peer-dependencies)).
201
+
202
+ | Component | Key props |
203
+ |---|---|
204
+ | `BarChart` | `series`, `categories`, `colors?`, `height?`, `options?` (merged over defaults) |
205
+ | `LineChart` | `series`, `categories`, `colors?`, `height?`, `options?` |
206
+ | `Calendar` | `events`, `onEventClick`, `onDateSelect`, `initialView` |
207
+ | `CountryMap` | `markers`, `markerColor?`, `mapColor?` |
208
+ | `Editor` (WYSIWYG) | `content`, `onChange(html)`, `placeholder?`, `editable?`, `toolbar?` — Tiptap-powered, customizable toolbar |
209
+
210
+ > The data-viz components default their data to sensible demo values, so they render
211
+ > out-of-the-box and are fully overridable via the props above.
212
+
213
+ The `Editor` is a Tiptap-powered rich-text editor with a fully customizable toolbar. Pass an
214
+ ordered `toolbar` array of built-in tool ids (`"bold" | "italic" | "strike" | "code" |
215
+ "heading1" | "heading2" | "heading3" | "bulletList" | "orderedList" | "blockquote" |
216
+ "codeBlock" | "link" | "undo" | "redo" | "divider"`) or custom `{ id, icon, title, onClick,
217
+ isActive? }` button objects. Set `editable={false}` for a read-only view (toolbar hidden).
218
+
219
+ ```tsx
220
+ import dynamic from 'next/dynamic';
221
+ const Editor = dynamic(
222
+ () => import('@andreagiugni/tailwind-dashboard-ui').then((m) => m.Editor),
223
+ { ssr: false }
224
+ );
225
+
226
+ <Editor
227
+ content="<p>Hello <strong>world</strong></p>"
228
+ onChange={(html) => save(html)}
229
+ toolbar={['bold', 'italic', 'divider', 'bulletList', 'orderedList', 'link']}
230
+ />
231
+ ```
232
+
233
+ ## Data table
234
+
235
+ `DataTable` is a generic, batteries-included table: pass your `data` array and a `columns`
236
+ definition and you get live search, per-column click-to-sort, a "Show N entries" selector and
237
+ pagination out of the box. Light/dark styling follows the standard `.dark` variant.
238
+
239
+ ```tsx
240
+ import { DataTable, type DataTableColumn } from '@andreagiugni/tailwind-dashboard-ui';
241
+
242
+ type Person = { name: string; office: string; salary: number };
243
+
244
+ const people: Person[] = [
245
+ { name: 'Abram Schleifer', office: 'Edinburgh', salary: 89500 },
246
+ { name: 'Carla George', office: 'London', salary: 15500 },
247
+ // …
248
+ ];
249
+
250
+ const columns: DataTableColumn<Person>[] = [
251
+ { key: 'name', header: 'User', sortable: true },
252
+ { key: 'office', header: 'Office', sortable: true },
253
+ {
254
+ key: 'salary',
255
+ header: 'Salary',
256
+ sortable: true,
257
+ align: 'right',
258
+ render: (row) => `$${row.salary.toLocaleString()}`, // custom cell
259
+ },
260
+ ];
261
+
262
+ <DataTable
263
+ data={people}
264
+ columns={columns}
265
+ rowsPerPage={5}
266
+ rowsPerPageOptions={[5, 10, 25]}
267
+ defaultSortKey="name"
268
+ searchKeys={['name', 'office']}
269
+ onRowClick={(row) => console.log(row)}
270
+ />
271
+ ```
272
+
273
+ Key props: `data`, `columns` (each: `key`, `header`, `sortable?`, `align?`, `render?`,
274
+ `className?`), `rowsPerPage` (default 10), `rowsPerPageOptions` (default `[5,10,25,50]`),
275
+ `searchable` / `searchPlaceholder` / `searchKeys`, `defaultSortKey` / `defaultSortDirection`,
276
+ `pagination`, `showSizeSelector`, `onRowClick`, `getRowId`, `emptyContent`. It is built on the
277
+ exported `Table`, `Input` and `Pagination` primitives — drop down to those directly if you need
278
+ full control over the markup.
279
+
280
+ ## License
281
+
282
+ MIT © Andrea Giugni
@@ -0,0 +1,53 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import { Editor as Editor$1 } from '@tiptap/react';
3
+
4
+ interface ColorOverrideProps {
5
+ /** Inline background color override (any CSS color). */
6
+ bgColor?: string;
7
+ /** Inline text color override (any CSS color). */
8
+ textColor?: string;
9
+ /** Inline border color override (any CSS color). */
10
+ borderColor?: string;
11
+ }
12
+ declare function styleOverride({ bgColor, textColor, borderColor, }: ColorOverrideProps): CSSProperties;
13
+
14
+ /** Built-in toolbar tool ids. */
15
+ type ToolbarItemId = "bold" | "italic" | "strike" | "code" | "heading1" | "heading2" | "heading3" | "bulletList" | "orderedList" | "blockquote" | "codeBlock" | "link" | "undo" | "redo" | "divider";
16
+ /** A fully custom toolbar button. */
17
+ interface CustomToolbarItem {
18
+ id: string;
19
+ icon: React.ReactNode;
20
+ title: string;
21
+ onClick: (editor: Editor$1) => void;
22
+ isActive?: (editor: Editor$1) => boolean;
23
+ }
24
+ /** A toolbar entry: either a built-in id or a custom button object. */
25
+ type EditorToolItem = ToolbarItemId | CustomToolbarItem;
26
+ /** @deprecated Alias kept for naming flexibility. Use `EditorToolItem`. */
27
+ type ToolbarItem = EditorToolItem;
28
+ interface EditorProps extends ColorOverrideProps {
29
+ /** Initial HTML content. */
30
+ content?: string;
31
+ /** Fires with the current HTML whenever the document changes. */
32
+ onChange?: (html: string) => void;
33
+ /** Placeholder shown when the document is empty. */
34
+ placeholder?: string;
35
+ /** When false the editor is read-only and the toolbar is hidden. */
36
+ editable?: boolean;
37
+ /** Ordered toolbar configuration. Defaults to a sensible full set. */
38
+ toolbar?: EditorToolItem[];
39
+ /** Wrapper class. */
40
+ className?: string;
41
+ /** Class for the prose content area. */
42
+ editorClassName?: string;
43
+ }
44
+ /**
45
+ * Tiptap-powered WYSIWYG editor.
46
+ *
47
+ * Heavy, optional peer-dependency component (`@tiptap/*`). It is a client
48
+ * component and touches the DOM at import time, so in SSR frameworks render it
49
+ * client-only (e.g. next/dynamic with `ssr:false`), like the charts.
50
+ */
51
+ declare const Editor: React.FC<EditorProps>;
52
+
53
+ export { type ColorOverrideProps as C, Editor as E, type ToolbarItem as T, type EditorProps as a, type EditorToolItem as b, type CustomToolbarItem as c, type ToolbarItemId as d, styleOverride as s };
@@ -0,0 +1,53 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import { Editor as Editor$1 } from '@tiptap/react';
3
+
4
+ interface ColorOverrideProps {
5
+ /** Inline background color override (any CSS color). */
6
+ bgColor?: string;
7
+ /** Inline text color override (any CSS color). */
8
+ textColor?: string;
9
+ /** Inline border color override (any CSS color). */
10
+ borderColor?: string;
11
+ }
12
+ declare function styleOverride({ bgColor, textColor, borderColor, }: ColorOverrideProps): CSSProperties;
13
+
14
+ /** Built-in toolbar tool ids. */
15
+ type ToolbarItemId = "bold" | "italic" | "strike" | "code" | "heading1" | "heading2" | "heading3" | "bulletList" | "orderedList" | "blockquote" | "codeBlock" | "link" | "undo" | "redo" | "divider";
16
+ /** A fully custom toolbar button. */
17
+ interface CustomToolbarItem {
18
+ id: string;
19
+ icon: React.ReactNode;
20
+ title: string;
21
+ onClick: (editor: Editor$1) => void;
22
+ isActive?: (editor: Editor$1) => boolean;
23
+ }
24
+ /** A toolbar entry: either a built-in id or a custom button object. */
25
+ type EditorToolItem = ToolbarItemId | CustomToolbarItem;
26
+ /** @deprecated Alias kept for naming flexibility. Use `EditorToolItem`. */
27
+ type ToolbarItem = EditorToolItem;
28
+ interface EditorProps extends ColorOverrideProps {
29
+ /** Initial HTML content. */
30
+ content?: string;
31
+ /** Fires with the current HTML whenever the document changes. */
32
+ onChange?: (html: string) => void;
33
+ /** Placeholder shown when the document is empty. */
34
+ placeholder?: string;
35
+ /** When false the editor is read-only and the toolbar is hidden. */
36
+ editable?: boolean;
37
+ /** Ordered toolbar configuration. Defaults to a sensible full set. */
38
+ toolbar?: EditorToolItem[];
39
+ /** Wrapper class. */
40
+ className?: string;
41
+ /** Class for the prose content area. */
42
+ editorClassName?: string;
43
+ }
44
+ /**
45
+ * Tiptap-powered WYSIWYG editor.
46
+ *
47
+ * Heavy, optional peer-dependency component (`@tiptap/*`). It is a client
48
+ * component and touches the DOM at import time, so in SSR frameworks render it
49
+ * client-only (e.g. next/dynamic with `ssr:false`), like the charts.
50
+ */
51
+ declare const Editor: React.FC<EditorProps>;
52
+
53
+ export { type ColorOverrideProps as C, Editor as E, type ToolbarItem as T, type EditorProps as a, type EditorToolItem as b, type CustomToolbarItem as c, type ToolbarItemId as d, styleOverride as s };