@matthiaskrijgsman/mat-ui 0.0.28 → 0.0.30
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 +106 -0
- package/dist/components/inputs/InputIconButtonTray.d.ts +1 -1
- package/dist/components/inputs/InputSelect.d.ts +3 -6
- package/dist/components/inputs/InputSelectDivider.d.ts +3 -0
- package/dist/components/inputs/InputSelectGroupHeader.d.ts +5 -0
- package/dist/components/inputs/InputSelectMultiple.d.ts +22 -0
- package/dist/components/inputs/InputSelectOption.d.ts +3 -2
- package/dist/components/inputs/InputSelectSearchable.d.ts +4 -7
- package/dist/components/inputs/InputSelectSearchableAsync.d.ts +3 -6
- package/dist/components/inputs/input-lexical/InputLexical.d.ts +30 -0
- package/dist/components/inputs/input-lexical/LexicalBlockTypeSelect.d.ts +1 -0
- package/dist/components/inputs/input-lexical/LexicalFloatingToolbar.d.ts +5 -0
- package/dist/components/inputs/input-lexical/LexicalFormatButtons.d.ts +1 -0
- package/dist/components/inputs/input-lexical/LexicalHistoryButtons.d.ts +1 -0
- package/dist/components/inputs/input-lexical/LexicalLinkButton.d.ts +1 -0
- package/dist/components/inputs/input-lexical/LexicalListButtons.d.ts +1 -0
- package/dist/components/inputs/input-lexical/LexicalToolbar.d.ts +8 -0
- package/dist/components/inputs/input-lexical/LexicalToolbarButton.d.ts +13 -0
- package/dist/components/inputs/input-lexical/LexicalToolbarDivider.d.ts +6 -0
- package/dist/components/inputs/input-lexical/LexicalToolbarItems.d.ts +5 -0
- package/dist/components/inputs/input-lexical/lexical-theme.d.ts +26 -0
- package/dist/components/inputs/input-lexical/use-lexical-toolbar.d.ts +31 -0
- package/dist/components/inputs/select-item.d.ts +15 -0
- package/dist/control-size/control-size.util.d.ts +1 -0
- package/dist/hooks/use-overflow-fit.d.ts +12 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +16903 -5584
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +95 -42
- package/dist/index.umd.cjs.map +1 -1
- package/dist/popover/PopoverBase.d.ts +3 -1
- package/dist/popover/use-select-popover.d.ts +28 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +11 -1
- package/package.json +16 -1
package/README.md
CHANGED
|
@@ -49,6 +49,112 @@ function App() {
|
|
|
49
49
|
}
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
## Rich text editor (`InputLexical`)
|
|
53
|
+
|
|
54
|
+
`InputLexical` is a [Lexical](https://lexical.dev)-powered rich text editor styled like the rest of the kit. It ships with two toolbar variants that share the exact same controls:
|
|
55
|
+
|
|
56
|
+
- **`static`** (default) — a light toolbar fixed at the top of the editor.
|
|
57
|
+
- **`floating`** — a dark bar that appears above the editor while it is focused, matching the editor width.
|
|
58
|
+
|
|
59
|
+
Lexical and its plugins are **peer dependencies** — install them alongside the library:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pnpm add lexical @lexical/react @lexical/rich-text @lexical/list @lexical/link @lexical/selection @lexical/utils
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Basic usage
|
|
66
|
+
|
|
67
|
+
The value is a **serialized Lexical editor state** (a JSON string). Pass the last `onChange` value back as `value` to restore content.
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { useState } from "react";
|
|
71
|
+
import { InputLexical } from "@matthiaskrijgsman/mat-ui";
|
|
72
|
+
|
|
73
|
+
function Editor() {
|
|
74
|
+
const [value, setValue] = useState<string>();
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<InputLexical
|
|
78
|
+
label={"Description"}
|
|
79
|
+
placeholder={"Write something…"}
|
|
80
|
+
toolbar={"floating"} // or "static" (default)
|
|
81
|
+
value={value}
|
|
82
|
+
onChange={setValue}
|
|
83
|
+
autogrow // grow with content…
|
|
84
|
+
minRows={4} // …from a 4-row floor…
|
|
85
|
+
maxRows={12} // …up to 12 rows, then scroll
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Sizing mirrors `InputTextArea`: `minRows` sets a height floor, `maxRows` caps the height (content beyond it scrolls), and `autogrow` lets the editor grow with its content between the two. Without `autogrow` the editor is fixed at `minRows`.
|
|
92
|
+
|
|
93
|
+
### Extending the toolbar
|
|
94
|
+
|
|
95
|
+
The toolbar is assembled from exported **building blocks**, so you can reorder, drop, or add controls via the `renderToolbar` slot. It receives `{ editor, state, tone }` and renders into whichever variant is active — the same render function drives both the static and floating bars.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import {
|
|
99
|
+
InputLexical,
|
|
100
|
+
LexicalBlockTypeSelect,
|
|
101
|
+
LexicalFormatButtons,
|
|
102
|
+
LexicalListButtons,
|
|
103
|
+
LexicalLinkButton,
|
|
104
|
+
LexicalHistoryButtons,
|
|
105
|
+
LexicalToolbarDivider,
|
|
106
|
+
} from "@matthiaskrijgsman/mat-ui";
|
|
107
|
+
|
|
108
|
+
<InputLexical
|
|
109
|
+
renderToolbar={() => (
|
|
110
|
+
<>
|
|
111
|
+
<LexicalFormatButtons/>
|
|
112
|
+
<LexicalToolbarDivider/>
|
|
113
|
+
<LexicalListButtons/>
|
|
114
|
+
<LexicalLinkButton/>
|
|
115
|
+
<LexicalToolbarDivider/>
|
|
116
|
+
<LexicalHistoryButtons/>
|
|
117
|
+
</>
|
|
118
|
+
)}
|
|
119
|
+
/>;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Building blocks read the active editor and formatting `state`/`tone` from context, so they work in either variant with no extra wiring. Dividers automatically flip orientation (and the whole toolbar collapses overflowing controls into a vertical `⋮` dropdown) when space runs out — return each control as a top-level child so it stays individually measurable.
|
|
123
|
+
|
|
124
|
+
#### Custom controls
|
|
125
|
+
|
|
126
|
+
Build your own control with `LexicalToolbarButton` plus Lexical's editor context. `useLexicalToolbar()` exposes the current `{ state, tone }`:
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
130
|
+
import { FORMAT_TEXT_COMMAND } from "lexical";
|
|
131
|
+
import { IconStrikethrough } from "@tabler/icons-react";
|
|
132
|
+
import { LexicalToolbarButton, useLexicalToolbar } from "@matthiaskrijgsman/mat-ui";
|
|
133
|
+
|
|
134
|
+
const StrikethroughButton = () => {
|
|
135
|
+
const [editor] = useLexicalComposerContext();
|
|
136
|
+
const { tone } = useLexicalToolbar();
|
|
137
|
+
return (
|
|
138
|
+
<LexicalToolbarButton
|
|
139
|
+
Icon={IconStrikethrough}
|
|
140
|
+
tone={tone}
|
|
141
|
+
aria-label={"Strikethrough"}
|
|
142
|
+
onClick={() => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough")}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Registering extra Lexical nodes
|
|
149
|
+
|
|
150
|
+
If a plugin needs additional nodes (tables, mentions, code blocks, …), pass them via the `nodes` prop — they are registered alongside the built-in set (headings, lists, links, quotes):
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { CodeNode } from "@lexical/code";
|
|
154
|
+
|
|
155
|
+
<InputLexical nodes={[CodeNode]} renderToolbar={/* … */} />;
|
|
156
|
+
```
|
|
157
|
+
|
|
52
158
|
## Dark Theme
|
|
53
159
|
|
|
54
160
|
mat-ui ships with built-in dark theme support. Add the `dark` class to the `<html>` element to activate it:
|
|
@@ -3,4 +3,4 @@ export type InputIconButtonTrayProps = {
|
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
className?: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const InputIconButtonTray:
|
|
6
|
+
export declare const InputIconButtonTray: React.ForwardRefExoticComponent<InputIconButtonTrayProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type SelectItem } from "@/components/inputs/select-item.ts";
|
|
2
3
|
export type Size = 'sm' | 'md' | 'lg';
|
|
3
4
|
export type InputSelectProps<T> = {
|
|
4
5
|
name?: string;
|
|
@@ -6,7 +7,7 @@ export type InputSelectProps<T> = {
|
|
|
6
7
|
className?: string;
|
|
7
8
|
label?: string | React.ReactNode;
|
|
8
9
|
description?: string | React.ReactNode;
|
|
9
|
-
options:
|
|
10
|
+
options: SelectItem<T>[];
|
|
10
11
|
value: T | null;
|
|
11
12
|
onChange: (value: T | null) => void;
|
|
12
13
|
placeholder?: string;
|
|
@@ -14,9 +15,5 @@ export type InputSelectProps<T> = {
|
|
|
14
15
|
error?: string | React.ReactNode;
|
|
15
16
|
size?: Size;
|
|
16
17
|
};
|
|
17
|
-
export type Option
|
|
18
|
-
label: string | React.ReactNode;
|
|
19
|
-
value: T;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
};
|
|
18
|
+
export type { Option, SelectGroupHeader, SelectDivider, SelectItem } from "@/components/inputs/select-item.ts";
|
|
22
19
|
export declare const InputSelect: <T>(props: InputSelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface InputSelectGroupHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare const InputSelectGroupHeader: React.ForwardRefExoticComponent<InputSelectGroupHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type BadgeColorKey } from "@/components/BadgeColors.tsx";
|
|
3
|
+
import { type SelectItem } from "@/components/inputs/select-item.ts";
|
|
4
|
+
export type Size = 'sm' | 'md' | 'lg';
|
|
5
|
+
export type InputSelectMultipleProps<T> = {
|
|
6
|
+
name?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
label?: string | React.ReactNode;
|
|
10
|
+
description?: string | React.ReactNode;
|
|
11
|
+
options: SelectItem<T>[];
|
|
12
|
+
onSearch?: (search: string) => SelectItem<T>[];
|
|
13
|
+
value: T[];
|
|
14
|
+
onChange: (value: T[]) => void;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
maxHeight?: number;
|
|
17
|
+
error?: string | React.ReactNode;
|
|
18
|
+
size?: Size;
|
|
19
|
+
singleLine?: boolean;
|
|
20
|
+
color?: BadgeColorKey;
|
|
21
|
+
};
|
|
22
|
+
export declare const InputSelectMultiple: <T>(props: InputSelectMultipleProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export interface InputSelectOptionProps {
|
|
2
|
+
export interface InputSelectOptionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
selected: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
active?: boolean;
|
|
6
7
|
onClick?: () => void;
|
|
7
8
|
}
|
|
8
|
-
export declare const InputSelectOption:
|
|
9
|
+
export declare const InputSelectOption: React.ForwardRefExoticComponent<InputSelectOptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type SelectItem } from "@/components/inputs/select-item.ts";
|
|
3
|
+
export type { Option } from "@/components/inputs/select-item.ts";
|
|
2
4
|
export type Size = 'sm' | 'md' | 'lg';
|
|
3
5
|
export type InputSelectSearchableProps<T> = {
|
|
4
6
|
name?: string;
|
|
@@ -6,8 +8,8 @@ export type InputSelectSearchableProps<T> = {
|
|
|
6
8
|
className?: string;
|
|
7
9
|
label?: string | React.ReactNode;
|
|
8
10
|
description?: string | React.ReactNode;
|
|
9
|
-
options:
|
|
10
|
-
onSearch: (search: string) =>
|
|
11
|
+
options: SelectItem<T>[];
|
|
12
|
+
onSearch: (search: string) => SelectItem<T>[];
|
|
11
13
|
value: T | null;
|
|
12
14
|
onChange: (value: T | null) => void;
|
|
13
15
|
placeholder?: string;
|
|
@@ -15,9 +17,4 @@ export type InputSelectSearchableProps<T> = {
|
|
|
15
17
|
error?: string | React.ReactNode;
|
|
16
18
|
size?: Size;
|
|
17
19
|
};
|
|
18
|
-
export type Option<T> = {
|
|
19
|
-
label: string | React.ReactNode;
|
|
20
|
-
value: T;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
};
|
|
23
20
|
export declare const InputSelectSearchable: <T>(props: InputSelectSearchableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type Option, type SelectItem } from "@/components/inputs/select-item.ts";
|
|
3
|
+
export type { Option } from "@/components/inputs/select-item.ts";
|
|
2
4
|
export type Size = 'sm' | 'md' | 'lg';
|
|
3
5
|
export type InputSelectSearchableAsyncProps<T> = {
|
|
4
6
|
name?: string;
|
|
@@ -6,7 +8,7 @@ export type InputSelectSearchableAsyncProps<T> = {
|
|
|
6
8
|
className?: string;
|
|
7
9
|
label?: string | React.ReactNode;
|
|
8
10
|
description?: string | React.ReactNode;
|
|
9
|
-
fetchOptionsByQuery: (search: string) => Promise<
|
|
11
|
+
fetchOptionsByQuery: (search: string) => Promise<SelectItem<T>[]>;
|
|
10
12
|
fetchOptionByValue: (value: T) => Promise<Option<T>>;
|
|
11
13
|
onSearchDebounceMs?: number;
|
|
12
14
|
value: T | null;
|
|
@@ -16,9 +18,4 @@ export type InputSelectSearchableAsyncProps<T> = {
|
|
|
16
18
|
error?: string | React.ReactNode;
|
|
17
19
|
size?: Size;
|
|
18
20
|
};
|
|
19
|
-
export type Option<T> = {
|
|
20
|
-
label: string | React.ReactNode;
|
|
21
|
-
value: T;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
};
|
|
24
21
|
export declare const InputSelectSearchableAsync: <T>(props: InputSelectSearchableAsyncProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Klass, LexicalNode } from "lexical";
|
|
3
|
+
import type { LexicalToolbarRender } from "@/components/inputs/input-lexical/use-lexical-toolbar.ts";
|
|
4
|
+
export type Size = "sm" | "md" | "lg";
|
|
5
|
+
export type LexicalToolbarVariant = "static" | "floating";
|
|
6
|
+
export type InputLexicalProps = {
|
|
7
|
+
label?: string | React.ReactNode;
|
|
8
|
+
description?: string | React.ReactNode;
|
|
9
|
+
error?: string | React.ReactNode;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
/** Serialized editor state (JSON string from a previous onChange), or undefined for empty. */
|
|
12
|
+
value?: string;
|
|
13
|
+
onChange?: (value: string) => void;
|
|
14
|
+
size?: Size;
|
|
15
|
+
toolbar?: LexicalToolbarVariant;
|
|
16
|
+
/** Override the default toolbar content. Drop in the exported building blocks. */
|
|
17
|
+
renderToolbar?: LexicalToolbarRender;
|
|
18
|
+
/** Minimum visible rows — sets a height floor for the editable area. */
|
|
19
|
+
minRows?: number;
|
|
20
|
+
/** Maximum visible rows. Content beyond this scrolls. */
|
|
21
|
+
maxRows?: number;
|
|
22
|
+
/** Grow the editor with its content (between minRows and maxRows). */
|
|
23
|
+
autogrow?: boolean;
|
|
24
|
+
namespace?: string;
|
|
25
|
+
/** Extra Lexical nodes to register alongside the built-in set. */
|
|
26
|
+
nodes?: Array<Klass<LexicalNode>>;
|
|
27
|
+
autoFocus?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const InputLexical: (props: InputLexicalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LexicalBlockTypeSelect: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type LexicalToolbarRender } from "@/components/inputs/input-lexical/use-lexical-toolbar.ts";
|
|
2
|
+
export type LexicalFloatingToolbarProps = {
|
|
3
|
+
render?: LexicalToolbarRender;
|
|
4
|
+
};
|
|
5
|
+
export declare const LexicalFloatingToolbar: (props: LexicalFloatingToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LexicalFormatButtons: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LexicalHistoryButtons: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LexicalLinkButton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LexicalListButtons: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LexicalToolbarRender } from "@/components/inputs/input-lexical/use-lexical-toolbar.ts";
|
|
2
|
+
export declare const lexicalDefaultToolbarItems: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const LexicalDefaultToolbarContent: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export type LexicalToolbarProps = {
|
|
5
|
+
render?: LexicalToolbarRender;
|
|
6
|
+
className?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const LexicalToolbar: (props: LexicalToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { TablerIcon } from "@tabler/icons-react";
|
|
3
|
+
import type { LexicalToolbarTone } from "@/components/inputs/input-lexical/use-lexical-toolbar.ts";
|
|
4
|
+
export type LexicalToolbarButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
|
+
Icon: TablerIcon;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
tone?: LexicalToolbarTone;
|
|
8
|
+
};
|
|
9
|
+
export declare const LexicalToolbarButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
|
+
Icon: TablerIcon;
|
|
11
|
+
active?: boolean;
|
|
12
|
+
tone?: LexicalToolbarTone;
|
|
13
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type LexicalToolbarTone } from "@/components/inputs/input-lexical/use-lexical-toolbar.ts";
|
|
2
|
+
export type LexicalToolbarDividerProps = {
|
|
3
|
+
tone?: LexicalToolbarTone;
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const LexicalToolbarDivider: (props: LexicalToolbarDividerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Klass, LexicalNode } from "lexical";
|
|
2
|
+
export declare const LEXICAL_NODES: Array<Klass<LexicalNode>>;
|
|
3
|
+
export declare const lexicalTheme: {
|
|
4
|
+
paragraph: string;
|
|
5
|
+
heading: {
|
|
6
|
+
h1: string;
|
|
7
|
+
h2: string;
|
|
8
|
+
h3: string;
|
|
9
|
+
h4: string;
|
|
10
|
+
};
|
|
11
|
+
quote: string;
|
|
12
|
+
list: {
|
|
13
|
+
ul: string;
|
|
14
|
+
ol: string;
|
|
15
|
+
listitem: string;
|
|
16
|
+
nested: {
|
|
17
|
+
listitem: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
link: string;
|
|
21
|
+
text: {
|
|
22
|
+
bold: string;
|
|
23
|
+
italic: string;
|
|
24
|
+
underline: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type LexicalEditor } from "lexical";
|
|
3
|
+
export type LexicalBlockType = "paragraph" | "h1" | "h2" | "h3" | "h4";
|
|
4
|
+
export type LexicalToolbarState = {
|
|
5
|
+
isBold: boolean;
|
|
6
|
+
isItalic: boolean;
|
|
7
|
+
isUnderline: boolean;
|
|
8
|
+
isLink: boolean;
|
|
9
|
+
isUnorderedList: boolean;
|
|
10
|
+
isOrderedList: boolean;
|
|
11
|
+
blockType: LexicalBlockType;
|
|
12
|
+
canUndo: boolean;
|
|
13
|
+
canRedo: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const DEFAULT_LEXICAL_TOOLBAR_STATE: LexicalToolbarState;
|
|
16
|
+
export type LexicalToolbarTone = "light" | "dark";
|
|
17
|
+
export type LexicalToolbarOrientation = "horizontal" | "vertical";
|
|
18
|
+
export type LexicalToolbarContextValue = {
|
|
19
|
+
state: LexicalToolbarState;
|
|
20
|
+
tone: LexicalToolbarTone;
|
|
21
|
+
orientation?: LexicalToolbarOrientation;
|
|
22
|
+
};
|
|
23
|
+
export declare const LexicalToolbarContext: React.Context<LexicalToolbarContextValue>;
|
|
24
|
+
export declare const useLexicalToolbar: () => LexicalToolbarContextValue;
|
|
25
|
+
export declare const useLexicalToolbarState: () => LexicalToolbarState;
|
|
26
|
+
export type LexicalToolbarRenderContext = {
|
|
27
|
+
editor: LexicalEditor;
|
|
28
|
+
state: LexicalToolbarState;
|
|
29
|
+
tone: LexicalToolbarTone;
|
|
30
|
+
};
|
|
31
|
+
export type LexicalToolbarRender = (ctx: LexicalToolbarRenderContext) => React.ReactNode;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type Option<T> = {
|
|
3
|
+
label: string | React.ReactNode;
|
|
4
|
+
value: T;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type SelectGroupHeader = {
|
|
8
|
+
kind: 'header';
|
|
9
|
+
label: string | React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export type SelectDivider = {
|
|
12
|
+
kind: 'divider';
|
|
13
|
+
};
|
|
14
|
+
export type SelectItem<T> = Option<T> | SelectGroupHeader | SelectDivider;
|
|
15
|
+
export declare const isSelectOption: <T>(item: SelectItem<T>) => item is Option<T>;
|
|
@@ -7,6 +7,7 @@ export declare const sizePaddingXClasses: Record<ControlSize, string>;
|
|
|
7
7
|
export declare const sizePaddingLeftClasses: Record<ControlSize, string>;
|
|
8
8
|
export declare const sizePaddingRightClasses: Record<ControlSize, string>;
|
|
9
9
|
export declare const sizePaddingRightWithTrayClasses: Record<ControlSize, string>;
|
|
10
|
+
export declare const sizePaddingRightWithTrayTwoClasses: Record<ControlSize, string>;
|
|
10
11
|
export declare const sizePaddingLeftWithIconClasses: Record<ControlSize, string>;
|
|
11
12
|
export declare const sizeIconLeftPositionClasses: Record<ControlSize, string>;
|
|
12
13
|
export declare const sizeTrayRightPositionClasses: Record<ControlSize, string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
type UseOverflowFitOptions = {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
5
|
+
measureRef: RefObject<HTMLElement | null>;
|
|
6
|
+
trayRef?: RefObject<HTMLElement | null>;
|
|
7
|
+
itemCount: number;
|
|
8
|
+
deps?: ReadonlyArray<unknown>;
|
|
9
|
+
gap?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function useOverflowFit(options: UseOverflowFitOptions): number;
|
|
12
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -18,11 +18,28 @@ export { InputIconButtonTray } from "./components/inputs/InputIconButtonTray.tsx
|
|
|
18
18
|
export { InputFileSingle } from "./components/inputs/input-file/InputFileSingle.tsx";
|
|
19
19
|
export { InputFileMultiple } from "./components/inputs/input-file/InputFileMultiple.tsx";
|
|
20
20
|
export { UploadFileTile } from "./components/inputs/input-file/UploadFileTile.tsx";
|
|
21
|
+
export { InputLexical } from "./components/inputs/input-lexical/InputLexical.tsx";
|
|
22
|
+
export { LexicalToolbar, LexicalDefaultToolbarContent } from "./components/inputs/input-lexical/LexicalToolbar.tsx";
|
|
23
|
+
export { LexicalFloatingToolbar } from "./components/inputs/input-lexical/LexicalFloatingToolbar.tsx";
|
|
24
|
+
export { LexicalToolbarItems } from "./components/inputs/input-lexical/LexicalToolbarItems.tsx";
|
|
25
|
+
export { LexicalToolbarButton } from "./components/inputs/input-lexical/LexicalToolbarButton.tsx";
|
|
26
|
+
export { LexicalToolbarDivider } from "./components/inputs/input-lexical/LexicalToolbarDivider.tsx";
|
|
27
|
+
export { LexicalBlockTypeSelect } from "./components/inputs/input-lexical/LexicalBlockTypeSelect.tsx";
|
|
28
|
+
export { LexicalFormatButtons } from "./components/inputs/input-lexical/LexicalFormatButtons.tsx";
|
|
29
|
+
export { LexicalListButtons } from "./components/inputs/input-lexical/LexicalListButtons.tsx";
|
|
30
|
+
export { LexicalLinkButton } from "./components/inputs/input-lexical/LexicalLinkButton.tsx";
|
|
31
|
+
export { LexicalHistoryButtons } from "./components/inputs/input-lexical/LexicalHistoryButtons.tsx";
|
|
32
|
+
export { useLexicalToolbar, useLexicalToolbarState } from "./components/inputs/input-lexical/use-lexical-toolbar.ts";
|
|
33
|
+
export { lexicalTheme, LEXICAL_NODES } from "./components/inputs/input-lexical/lexical-theme.ts";
|
|
21
34
|
export { InputSelectNative } from "./components/inputs/InputSelectNative.tsx";
|
|
22
35
|
export { InputSelect } from "./components/inputs/InputSelect.tsx";
|
|
23
36
|
export { InputSelectSearchable } from "./components/inputs/InputSelectSearchable.tsx";
|
|
24
37
|
export { InputSelectSearchableAsync } from "./components/inputs/InputSelectSearchableAsync.tsx";
|
|
38
|
+
export { InputSelectMultiple } from "./components/inputs/InputSelectMultiple.tsx";
|
|
25
39
|
export { InputSelectOption } from "./components/inputs/InputSelectOption.tsx";
|
|
40
|
+
export { InputSelectGroupHeader } from "./components/inputs/InputSelectGroupHeader.tsx";
|
|
41
|
+
export { InputSelectDivider } from "./components/inputs/InputSelectDivider.tsx";
|
|
42
|
+
export { isSelectOption } from "./components/inputs/select-item.ts";
|
|
26
43
|
export { Panel } from "./components/panel/Panel.tsx";
|
|
27
44
|
export { PanelStack } from "./components/panel/PanelStack.tsx";
|
|
28
45
|
export { PanelField } from "./components/panel/PanelField.tsx";
|
|
@@ -43,6 +60,7 @@ export { DropdownButtonGroup } from "./components/dropdown-menu/DropdownButtonGr
|
|
|
43
60
|
export { DropdownPanel } from "./components/dropdown-menu/DropdownPanel.tsx";
|
|
44
61
|
export { DropdownMenu } from "./components/dropdown-menu/DropdownMenu.tsx";
|
|
45
62
|
export { usePopover } from "./popover/use-popover.tsx";
|
|
63
|
+
export { useSelectPopover } from "./popover/use-select-popover.tsx";
|
|
46
64
|
export { PopoverBase } from "./popover/PopoverBase.tsx";
|
|
47
65
|
export { Test } from "./components/Test.tsx";
|
|
48
66
|
export * from "./types.ts";
|