@nesso-how/ui 0.0.0-stage → 1.0.0-alpha.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/LICENSE +21 -0
- package/README.md +52 -2
- package/dist/index.d.ts +273 -0
- package/dist/index.js +1088 -0
- package/dist/styles.css +211 -0
- package/package.json +41 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Omar Desogus and Paolo Manfredotti
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nesso UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components styled for Nesso, including buttons, forms, menus, dialogs, and panels. Many controls build on [Base UI](https://base-ui.com/). The package depends on Nesso's theme tokens; it does not include a standalone theme.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @nesso-how/ui@alpha
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires React and React DOM `^19.2.8`. The package follows Nesso's app version; test against the app versions you support rather than assuming compatibility from matching version numbers.
|
|
12
|
+
|
|
13
|
+
## Use in a Nesso plugin
|
|
14
|
+
|
|
15
|
+
Nesso supplies React, component styles, and theme tokens inside plugin UI panels. No package stylesheet import is needed:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Button } from '@nesso-how/ui'
|
|
19
|
+
|
|
20
|
+
export function PluginUI() {
|
|
21
|
+
return <Button>Hello</Button>
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Keep React and React DOM external in your plugin bundle. Import your own layout CSS normally; Nesso does not compile arbitrary Tailwind classes from plugin source. Start with the [standalone plugin example](https://github.com/nesso-how/nesso/tree/main/packages/plugin/example) and see the [SDK UI contract](https://github.com/nesso-how/nesso/blob/main/packages/plugin/README.md#action-ui) for setup and permissions.
|
|
26
|
+
|
|
27
|
+
## Use outside Nesso
|
|
28
|
+
|
|
29
|
+
Install React/React DOM and configure [Tailwind CSS 4](https://tailwindcss.com/docs/installation) in your application. Import the package's source CSS after Tailwind in your main stylesheet:
|
|
30
|
+
|
|
31
|
+
```css
|
|
32
|
+
@import "tailwindcss";
|
|
33
|
+
@import "@nesso-how/ui/styles.css";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Your build must compile this CSS; it is not a precompiled stylesheet. Supply the theme CSS variables on your document or component container: colors such as `--background`, `--foreground`, and `--border`; `--font-sans` and `--font-mono`; `--radius-control` and `--radius-object` with length units; and `--duration-state` with time units. No theme values or font files are included. See the [theme schema](https://github.com/nesso-how/nesso/blob/main/packages/plugin/src/definitions.ts) for all color tokens and [Paper's theme](https://github.com/nesso-how/nesso/blob/main/plugins/paper-theme/src/index.ts) for example values.
|
|
37
|
+
|
|
38
|
+
## Components
|
|
39
|
+
|
|
40
|
+
| Area | Exports |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| Buttons and inputs | `Button`, `IconButton`, `Input`, `Label`, `PreferenceSelect`, `ColorPicker` |
|
|
43
|
+
| Forms and rows | `Field`, `FieldHint`, `ListRow`, `ListRowButton`, `ListRowDetail`, `ListRowTitle`, `RevealActions`, `PromptForm` |
|
|
44
|
+
| Menus and popovers | `Menu`, `MenuItem`, `MenuPopup`, `MenuRadioItem`, `Popover`, `PopoverPopup` |
|
|
45
|
+
| Search and suggestions | `Combobox`, `ComboboxItem`, `ComboboxPopup`, `Autocomplete`, `AutocompleteClear`, `AutocompleteItem`, `AutocompletePopup` |
|
|
46
|
+
| Dialogs | `Dialog`, `DialogActions`, `DialogPopup`, `ConfirmDialog`, `TextPromptDialog` |
|
|
47
|
+
| Panels and disclosure | `SidePanel`, `PanelHeader`, `SectionHeading`, `Collapsible`, `Tabs` |
|
|
48
|
+
| Feedback | `Banner`, `ToastViewport`, `Spinner` |
|
|
49
|
+
| Labels and icons | `Kbd`, `ContextLabel`, `ActionIcon` |
|
|
50
|
+
|
|
51
|
+
`Button` supports `default`, `outline`, and `ghost` variants. `SidePanel` supports controlled resizing and collapse. `Spinner` accepts an accessible `label` and respects reduced motion. State, content, and event handling remain yours to provide.
|
|
52
|
+
|
|
53
|
+
The package also exports `useMediaQuery`, `contrastColor`, `presetColors`, and the `ActionIconName` and `ToastItem` types. See the [public exports](https://github.com/nesso-how/nesso/blob/main/packages/ui/src/index.ts) and component source files for prop definitions; published TypeScript declarations provide editor completion.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { Button as Button$1 } from "@base-ui/react/button";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ButtonHTMLAttributes, ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
4
|
+
import { LucideIcon, Zap } from "lucide-react";
|
|
5
|
+
import { Dialog, Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
6
|
+
import { Combobox } from "@base-ui/react/combobox";
|
|
7
|
+
import { Menu } from "@base-ui/react/menu";
|
|
8
|
+
import { Popover } from "@base-ui/react/popover";
|
|
9
|
+
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
10
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
11
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
12
|
+
//#region src/button.d.ts
|
|
13
|
+
declare const buttonVariants: (props?: ({
|
|
14
|
+
variant?: "default" | "ghost" | "outline" | null | undefined;
|
|
15
|
+
size?: "default" | "icon" | "icon-sm" | "sm" | null | undefined;
|
|
16
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
|
+
declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
|
|
18
|
+
export declare function IconButton({ className, ...props }: ComponentProps<typeof Button>): import("react").JSX.Element;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/side-panel.d.ts
|
|
21
|
+
export declare function SidePanel({ id, side, open, size, minSize, maxSize, onToggle, onSizeChange, toggleLabel, resizeLabel, className, children }: {
|
|
22
|
+
id: string;
|
|
23
|
+
side: 'left' | 'right';
|
|
24
|
+
open: boolean;
|
|
25
|
+
size: number;
|
|
26
|
+
minSize: number;
|
|
27
|
+
maxSize: number | `${number}%`;
|
|
28
|
+
onToggle: () => void;
|
|
29
|
+
onSizeChange: (size: number) => void;
|
|
30
|
+
toggleLabel: string;
|
|
31
|
+
resizeLabel: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/panel-header.d.ts
|
|
37
|
+
export declare function PanelHeader({ actions, className, children, ...props }: ComponentProps<'header'> & {
|
|
38
|
+
actions: ReactNode;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/spinner.d.ts
|
|
42
|
+
export declare function Spinner({ label, className }: {
|
|
43
|
+
label: string;
|
|
44
|
+
className?: string;
|
|
45
|
+
}): import("react").JSX.Element;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/media.d.ts
|
|
48
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/input.d.ts
|
|
51
|
+
declare function Input({ className, type, ...props }: ComponentProps<"input">): import("react").JSX.Element;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/label.d.ts
|
|
54
|
+
declare function Label({ className, ...props }: ComponentProps<"label">): import("react").JSX.Element;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/kbd.d.ts
|
|
57
|
+
export declare function Kbd({ className, ...props }: ComponentProps<'kbd'>): import("react").JSX.Element;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/context-label.d.ts
|
|
60
|
+
export declare function ContextLabel({ className, ...props }: ComponentProps<'p'>): import("react").JSX.Element;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/banner.d.ts
|
|
63
|
+
type BannerProps = ComponentProps<'div'> & {
|
|
64
|
+
tone?: 'info' | 'warning' | 'error';
|
|
65
|
+
};
|
|
66
|
+
export declare function Banner({ tone, className, children, ...props }: BannerProps): import("react").JSX.Element;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/toast.d.ts
|
|
69
|
+
type ToastAction = {
|
|
70
|
+
label: string;
|
|
71
|
+
onClick: () => void;
|
|
72
|
+
};
|
|
73
|
+
type ToastItem = {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
title: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
} & ({
|
|
79
|
+
tone: 'info';
|
|
80
|
+
duration?: number;
|
|
81
|
+
action?: ToastAction;
|
|
82
|
+
} | {
|
|
83
|
+
tone: 'warning';
|
|
84
|
+
action?: ToastAction;
|
|
85
|
+
} | {
|
|
86
|
+
tone: 'confirmation';
|
|
87
|
+
action: ToastAction;
|
|
88
|
+
cancelAction: ToastAction;
|
|
89
|
+
});
|
|
90
|
+
export declare function ToastViewport({ items, label, closeLabel, queueLabel, onDismiss, onRestoreFocus }: {
|
|
91
|
+
items: readonly ToastItem[];
|
|
92
|
+
label: string;
|
|
93
|
+
closeLabel: string;
|
|
94
|
+
queueLabel: string;
|
|
95
|
+
onDismiss: (id: string) => void;
|
|
96
|
+
onRestoreFocus: () => void;
|
|
97
|
+
}): import("react").JSX.Element | null;
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/dialog.d.ts
|
|
100
|
+
export declare function DialogPopup({ className, ...props }: Dialog.Popup.Props): import("react").JSX.Element;
|
|
101
|
+
export declare function DialogActions({ className, children }: {
|
|
102
|
+
className?: string;
|
|
103
|
+
children: ReactNode;
|
|
104
|
+
}): import("react").JSX.Element;
|
|
105
|
+
export declare function ConfirmDialog({ open, onOpenChange, title, description, cancelLabel, confirmLabel, onConfirm, initialFocus, finalFocus, children }: {
|
|
106
|
+
open: boolean;
|
|
107
|
+
onOpenChange: (open: boolean) => void;
|
|
108
|
+
title: string;
|
|
109
|
+
description: string;
|
|
110
|
+
cancelLabel: string;
|
|
111
|
+
confirmLabel: string;
|
|
112
|
+
onConfirm: () => void;
|
|
113
|
+
initialFocus?: Dialog.Popup.Props['initialFocus'];
|
|
114
|
+
finalFocus?: Dialog.Popup.Props['finalFocus'];
|
|
115
|
+
children?: ReactNode;
|
|
116
|
+
}): import("react").JSX.Element;
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/prompt.d.ts
|
|
119
|
+
export declare function PromptForm({ initialValue, nameLabel, submitLabel, cancelLabel, maxLength, onSubmit }: {
|
|
120
|
+
initialValue?: string;
|
|
121
|
+
nameLabel: string;
|
|
122
|
+
submitLabel: string;
|
|
123
|
+
cancelLabel: string;
|
|
124
|
+
maxLength?: number;
|
|
125
|
+
onSubmit: (value: string) => void;
|
|
126
|
+
}): import("react").JSX.Element;
|
|
127
|
+
export declare function TextPromptDialog({ open, onOpenChange, title, description, initialValue, nameLabel, submitLabel, cancelLabel, maxLength, onSubmit, finalFocus, trigger }: {
|
|
128
|
+
open: boolean;
|
|
129
|
+
onOpenChange: (open: boolean) => void;
|
|
130
|
+
title: string;
|
|
131
|
+
description: string;
|
|
132
|
+
initialValue?: string;
|
|
133
|
+
nameLabel: string;
|
|
134
|
+
submitLabel: string;
|
|
135
|
+
cancelLabel: string;
|
|
136
|
+
maxLength?: number;
|
|
137
|
+
onSubmit: (value: string) => void;
|
|
138
|
+
finalFocus?: Dialog$1.Popup.Props['finalFocus'];
|
|
139
|
+
trigger?: ReactNode;
|
|
140
|
+
}): import("react").JSX.Element;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/row.d.ts
|
|
143
|
+
export declare function ListRow({ className, children }: {
|
|
144
|
+
className?: string;
|
|
145
|
+
children: ReactNode;
|
|
146
|
+
}): import("react").JSX.Element;
|
|
147
|
+
export declare function ListRowButton({ className, ...props }: ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
148
|
+
export declare function ListRowTitle({ active, className, children }: {
|
|
149
|
+
active?: boolean;
|
|
150
|
+
className?: string;
|
|
151
|
+
children: ReactNode;
|
|
152
|
+
}): import("react").JSX.Element;
|
|
153
|
+
export declare function ListRowDetail({ className, children }: {
|
|
154
|
+
className?: string;
|
|
155
|
+
children: ReactNode;
|
|
156
|
+
}): import("react").JSX.Element;
|
|
157
|
+
export declare function RevealActions({ className, children }: {
|
|
158
|
+
className?: string;
|
|
159
|
+
children: ReactNode;
|
|
160
|
+
}): import("react").JSX.Element;
|
|
161
|
+
export declare function Field({ className, children }: {
|
|
162
|
+
className?: string;
|
|
163
|
+
children: ReactNode;
|
|
164
|
+
}): import("react").JSX.Element;
|
|
165
|
+
export declare function FieldHint({ className, ...props }: HTMLAttributes<HTMLParagraphElement>): import("react").JSX.Element;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/preference-select.d.ts
|
|
168
|
+
export declare function PreferenceSelect({ label, items, value, onChange, disabled }: {
|
|
169
|
+
label: string;
|
|
170
|
+
items: {
|
|
171
|
+
value: string;
|
|
172
|
+
label: string;
|
|
173
|
+
}[];
|
|
174
|
+
value: string;
|
|
175
|
+
onChange: (value: string) => void;
|
|
176
|
+
disabled?: boolean;
|
|
177
|
+
}): import("react").JSX.Element;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/menu.d.ts
|
|
180
|
+
export declare function MenuPopup({ className, align, anchor, sideOffset, children, ...props }: Menu.Popup.Props & Pick<Menu.Positioner.Props, 'align' | 'anchor' | 'sideOffset'>): import("react").JSX.Element;
|
|
181
|
+
export declare function MenuItem({ className, ...props }: Menu.Item.Props): import("react").JSX.Element;
|
|
182
|
+
export declare function MenuRadioItem({ className, children, ...props }: Menu.RadioItem.Props): import("react").JSX.Element;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/popover.d.ts
|
|
185
|
+
export declare function PopoverPopup({ className, anchor, align, sideOffset, children, ...props }: Popover.Popup.Props & Pick<Popover.Positioner.Props, 'align' | 'anchor' | 'sideOffset'>): import("react").JSX.Element;
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/color-picker.d.ts
|
|
188
|
+
export declare function ColorPicker({ value: color, onValueChange, onCopyError, labels, presets, disabled, inputProps }: {
|
|
189
|
+
value?: string | null;
|
|
190
|
+
onValueChange: (value: string | undefined, interactionId?: string) => void;
|
|
191
|
+
onCopyError: () => void;
|
|
192
|
+
labels: Record<'color' | 'chooseColor' | 'title' | 'saturationBrightness' | 'saturationHint' | 'hue' | 'colorPresets' | 'hex' | 'copyColor' | 'copied' | 'colorInvalid' | 'default' | 'mixed' | 'resetColor', string>;
|
|
193
|
+
presets: readonly {
|
|
194
|
+
label: string;
|
|
195
|
+
value: string;
|
|
196
|
+
}[];
|
|
197
|
+
disabled?: boolean;
|
|
198
|
+
inputProps?: ComponentProps<'input'> & {
|
|
199
|
+
[attribute: `data-${string}`]: string | boolean | undefined;
|
|
200
|
+
};
|
|
201
|
+
}): import("react").JSX.Element;
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/color.d.ts
|
|
204
|
+
export declare const contrastColor: (hex: string) => string;
|
|
205
|
+
export declare const presetColors: readonly [{
|
|
206
|
+
readonly key: 'presetWhite';
|
|
207
|
+
readonly value: '#ffffff';
|
|
208
|
+
}, {
|
|
209
|
+
readonly key: 'presetSand';
|
|
210
|
+
readonly value: '#f3ead5';
|
|
211
|
+
}, {
|
|
212
|
+
readonly key: 'presetPeach';
|
|
213
|
+
readonly value: '#f5e3d5';
|
|
214
|
+
}, {
|
|
215
|
+
readonly key: 'presetRose';
|
|
216
|
+
readonly value: '#f5dfe2';
|
|
217
|
+
}, {
|
|
218
|
+
readonly key: 'presetSage';
|
|
219
|
+
readonly value: '#e1ecde';
|
|
220
|
+
}, {
|
|
221
|
+
readonly key: 'presetMint';
|
|
222
|
+
readonly value: '#dceee8';
|
|
223
|
+
}, {
|
|
224
|
+
readonly key: 'presetSky';
|
|
225
|
+
readonly value: '#dfeaf5';
|
|
226
|
+
}, {
|
|
227
|
+
readonly key: 'presetLavender';
|
|
228
|
+
readonly value: '#e9e2f3';
|
|
229
|
+
}];
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/combobox.d.ts
|
|
232
|
+
export declare function ComboboxPopup({ className, children, ...props }: Combobox.Popup.Props): import("react").JSX.Element;
|
|
233
|
+
export declare function ComboboxItem({ className, ...props }: Combobox.Item.Props): import("react").JSX.Element;
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/autocomplete.d.ts
|
|
236
|
+
export declare function AutocompletePopup({ className, children, ...props }: Autocomplete.Popup.Props): import("react").JSX.Element;
|
|
237
|
+
export declare function AutocompleteItem({ className, ...props }: Autocomplete.Item.Props): import("react").JSX.Element;
|
|
238
|
+
export declare function AutocompleteClear({ className, children, ...props }: Autocomplete.Clear.Props): import("react").JSX.Element;
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/section-heading.d.ts
|
|
241
|
+
export declare function SectionHeading({ open, children, className, ...props }: ComponentProps<typeof Button> & {
|
|
242
|
+
open: boolean;
|
|
243
|
+
}): import("react").JSX.Element;
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/action-icon.d.ts
|
|
246
|
+
declare const icons: {
|
|
247
|
+
readonly 'arrow-right': LucideIcon;
|
|
248
|
+
readonly 'book-open': LucideIcon;
|
|
249
|
+
readonly 'clipboard-paste': LucideIcon;
|
|
250
|
+
readonly copy: LucideIcon;
|
|
251
|
+
readonly download: LucideIcon;
|
|
252
|
+
readonly 'file-down': LucideIcon;
|
|
253
|
+
readonly 'file-up': LucideIcon;
|
|
254
|
+
readonly folder: LucideIcon;
|
|
255
|
+
readonly globe: LucideIcon;
|
|
256
|
+
readonly layers: LucideIcon;
|
|
257
|
+
readonly pencil: LucideIcon;
|
|
258
|
+
readonly play: LucideIcon;
|
|
259
|
+
readonly plus: LucideIcon;
|
|
260
|
+
readonly refresh: LucideIcon;
|
|
261
|
+
readonly scissors: LucideIcon;
|
|
262
|
+
readonly search: LucideIcon;
|
|
263
|
+
readonly share: LucideIcon;
|
|
264
|
+
readonly sparkles: LucideIcon;
|
|
265
|
+
readonly upload: LucideIcon;
|
|
266
|
+
readonly zap: LucideIcon;
|
|
267
|
+
};
|
|
268
|
+
type ActionIconName = keyof typeof icons;
|
|
269
|
+
export declare function ActionIcon({ name, ...props }: {
|
|
270
|
+
name?: string;
|
|
271
|
+
} & ComponentProps<typeof Zap>): import("react").JSX.Element;
|
|
272
|
+
//#endregion
|
|
273
|
+
export { type ActionIconName, Autocomplete, Button, Collapsible, Combobox, Dialog, Input, Label, Menu, Popover, Tabs, type ToastItem };
|