@nesso-how/ui 1.0.0-alpha.34 → 1.0.0-beta.10
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 +8 -4
- package/dist/index.d.ts +46 -3
- package/dist/index.js +151 -12
- package/dist/styles.css +89 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,17 +39,21 @@ Your build must compile this CSS; it is not a precompiled stylesheet. Supply the
|
|
|
39
39
|
|
|
40
40
|
| Area | Exports |
|
|
41
41
|
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
-
| Buttons and inputs | `Button`, `IconButton`, `Input`, `MarkdownInput`, `Label`, `PreferenceSelect`, `ColorPicker`
|
|
42
|
+
| Buttons and inputs | `Button`, `IconButton`, `Input`, `DirectoryField`, `MarkdownInput`, `Label`, `PreferenceSelect`, `ColorPicker` |
|
|
43
43
|
| Forms and rows | `Field`, `FieldHint`, `ListRow`, `ListRowButton`, `ListRowDetail`, `ListRowTitle`, `RevealActions`, `PromptForm` |
|
|
44
44
|
| Menus and popovers | `Menu`, `MenuItem`, `MenuPopup`, `MenuRadioItem`, `Popover`, `PopoverPopup` |
|
|
45
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`
|
|
46
|
+
| Dialogs | `Dialog`, `DialogActions`, `DialogPopup`, `ConfirmDialog`, `TextPromptDialog`, `BottomSheet` |
|
|
47
|
+
| Panels and disclosure | `SidePanel`, `PanelHeader`, `PluginPage`, `PluginContent`, `SectionHeading`, `Collapsible`, `Tabs` |
|
|
48
|
+
| Feedback | `Banner`, `BannerRow`, `BannerDetails`, `ToastViewport`, `Spinner` |
|
|
49
49
|
| Labels and icons | `Kbd`, `ContextLabel`, `ActionIcon` |
|
|
50
50
|
|
|
51
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
52
|
|
|
53
|
+
`BottomSheet` is a controlled, non-modal drawer with a title, close label, optional footer, and popup ref for measuring covered content. It supports swipe-down dismissal, safe-area padding, and reduced motion. Reading text can use `--nesso-reading-font-size` and `--nesso-reading-line-height`, which increase from 13/20px to 15/23px on narrow screens or coarse pointers.
|
|
54
|
+
|
|
53
55
|
`MarkdownInput` provides a live preview of bold, italic, links, and bullet or numbered lists in one field without a toolbar. Markdown delimiters reappear when the cursor or selection enters formatted text, including link destinations and list markers. Enter continues a list, incrementing the current number for numbered lists; Enter on an empty nested item returns to the parent level, and on an empty top-level item ends the list. Tab nests the current item under the previous one; Shift+Tab moves it up a level. Both move the item's continuation lines and children together, leaving unrelated text alone. At level boundaries they leave content and focus unchanged; outside lists they retain normal focus navigation. Shift+Enter inserts a plain line break. Existing items are not renumbered, and there are no checklists. It accepts the unchanged Markdown source through `value` and `onChange`, supports Cmd/Ctrl+B/I on selections, and preserves line breaks. Set `history={false}` when the host owns undo/redo and its shortcuts. Cmd/Ctrl-click requests `onOpenLink`; read-only fields request it on a regular click. The host is responsible for validating and opening destinations.
|
|
54
56
|
|
|
57
|
+
`MarkdownInput` also accepts an optional `placeholder` shown only while the editor is empty.
|
|
58
|
+
|
|
55
59
|
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
import { ButtonHTMLAttributes, ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
3
|
+
import { ButtonHTMLAttributes, ComponentProps, HTMLAttributes, ReactNode, Ref } from "react";
|
|
4
4
|
import { LucideIcon, Zap } from "lucide-react";
|
|
5
5
|
import { Dialog, Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
6
6
|
import { Combobox } from "@base-ui/react/combobox";
|
|
@@ -34,10 +34,15 @@ export declare function SidePanel({ id, side, open, size, minSize, maxSize, onTo
|
|
|
34
34
|
}): import("react").JSX.Element;
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/panel-header.d.ts
|
|
37
|
-
export declare function PanelHeader({ actions, className, children, ...props }: ComponentProps<'header'> & {
|
|
37
|
+
export declare function PanelHeader({ actions, size, className, children, ...props }: ComponentProps<'header'> & {
|
|
38
38
|
actions: ReactNode;
|
|
39
|
+
size?: 'default' | 'lg';
|
|
39
40
|
}): import("react").JSX.Element;
|
|
40
41
|
//#endregion
|
|
42
|
+
//#region src/plugin-page.d.ts
|
|
43
|
+
export declare function PluginPage({ className, children, ...props }: ComponentProps<'main'>): import("react").JSX.Element;
|
|
44
|
+
export declare function PluginContent({ className, children, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
45
|
+
//#endregion
|
|
41
46
|
//#region src/spinner.d.ts
|
|
42
47
|
export declare function Spinner({ label, className }: {
|
|
43
48
|
label: string;
|
|
@@ -50,6 +55,22 @@ export declare function useMediaQuery(query: string): boolean;
|
|
|
50
55
|
//#region src/input.d.ts
|
|
51
56
|
declare function Input({ className, type, ...props }: ComponentProps<'input'>): import("react").JSX.Element;
|
|
52
57
|
//#endregion
|
|
58
|
+
//#region src/directory-field.d.ts
|
|
59
|
+
export declare function DirectoryField({ label, value, labels, disabled, changeDisabled, onOpen, onChange, onRestore }: {
|
|
60
|
+
label: string;
|
|
61
|
+
value?: string;
|
|
62
|
+
labels: {
|
|
63
|
+
open: string;
|
|
64
|
+
change: string;
|
|
65
|
+
restore: string;
|
|
66
|
+
};
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
changeDisabled?: boolean;
|
|
69
|
+
onOpen: () => void;
|
|
70
|
+
onChange: () => void;
|
|
71
|
+
onRestore?: () => void;
|
|
72
|
+
}): import("react").JSX.Element;
|
|
73
|
+
//#endregion
|
|
53
74
|
//#region src/markdown-input.d.ts
|
|
54
75
|
type MarkdownInputProps = Omit<ComponentProps<'div'>, 'onChange' | 'children' | 'defaultValue'> & {
|
|
55
76
|
value: string;
|
|
@@ -57,8 +78,9 @@ type MarkdownInputProps = Omit<ComponentProps<'div'>, 'onChange' | 'children' |
|
|
|
57
78
|
readOnly?: boolean;
|
|
58
79
|
history?: boolean;
|
|
59
80
|
onOpenLink?: (url: string) => void;
|
|
81
|
+
placeholder?: string;
|
|
60
82
|
};
|
|
61
|
-
export declare function MarkdownInput({ value, onChange, readOnly, history, onOpenLink, className, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: MarkdownInputProps): import("react").JSX.Element;
|
|
83
|
+
export declare function MarkdownInput({ value, onChange, readOnly, history, onOpenLink, placeholder, className, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: MarkdownInputProps): import("react").JSX.Element;
|
|
62
84
|
//#endregion
|
|
63
85
|
//#region src/label.d.ts
|
|
64
86
|
declare function Label({ className, ...props }: ComponentProps<'label'>): import("react").JSX.Element;
|
|
@@ -74,6 +96,14 @@ type BannerProps = ComponentProps<'div'> & {
|
|
|
74
96
|
tone?: 'info' | 'warning' | 'error';
|
|
75
97
|
};
|
|
76
98
|
export declare function Banner({ tone, className, children, ...props }: BannerProps): import("react").JSX.Element;
|
|
99
|
+
export declare function BannerRow({ message, actions }: {
|
|
100
|
+
message: ReactNode;
|
|
101
|
+
actions?: ReactNode;
|
|
102
|
+
}): import("react").JSX.Element;
|
|
103
|
+
export declare function BannerDetails({ label, children }: {
|
|
104
|
+
label: ReactNode;
|
|
105
|
+
children: ReactNode;
|
|
106
|
+
}): import("react").JSX.Element;
|
|
77
107
|
//#endregion
|
|
78
108
|
//#region src/toast.d.ts
|
|
79
109
|
type ToastAction = {
|
|
@@ -126,6 +156,18 @@ export declare function ConfirmDialog({ open, onOpenChange, title, description,
|
|
|
126
156
|
children?: ReactNode;
|
|
127
157
|
}): import("react").JSX.Element;
|
|
128
158
|
//#endregion
|
|
159
|
+
//#region src/sheet.d.ts
|
|
160
|
+
export declare function BottomSheet({ open, onOpenChange, title, closeLabel, popupRef, footer, className, children }: {
|
|
161
|
+
open: boolean;
|
|
162
|
+
onOpenChange: (open: boolean) => void;
|
|
163
|
+
title: ReactNode;
|
|
164
|
+
closeLabel: string;
|
|
165
|
+
popupRef?: Ref<HTMLDivElement>;
|
|
166
|
+
footer?: ReactNode;
|
|
167
|
+
className?: string;
|
|
168
|
+
children: ReactNode;
|
|
169
|
+
}): import("react").JSX.Element;
|
|
170
|
+
//#endregion
|
|
129
171
|
//#region src/prompt.d.ts
|
|
130
172
|
export declare function PromptForm({ initialValue, nameLabel, submitLabel, cancelLabel, maxLength, onSubmit }: {
|
|
131
173
|
initialValue?: string;
|
|
@@ -270,6 +312,7 @@ declare const icons: {
|
|
|
270
312
|
readonly play: LucideIcon;
|
|
271
313
|
readonly plus: LucideIcon;
|
|
272
314
|
readonly refresh: LucideIcon;
|
|
315
|
+
readonly repeat: LucideIcon;
|
|
273
316
|
readonly scissors: LucideIcon;
|
|
274
317
|
readonly search: LucideIcon;
|
|
275
318
|
readonly share: LucideIcon;
|
package/dist/index.js
CHANGED
|
@@ -3,13 +3,14 @@ import { cva } from "class-variance-authority";
|
|
|
3
3
|
import { cn } from "cn";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
6
|
-
import { ArrowRight, BookOpen, Check, ChevronDown, ChevronLeft, ChevronRight, CircleHelp, ClipboardPaste, Copy, Download, FileDown, FileUp, Folder, Glasses, Globe, Info, Layers, Minus, Pencil, Play, Plus, RefreshCw, RotateCcw, Scissors, Search, Share2, Sparkles, TriangleAlert, Upload, X, Zap } from "lucide-react";
|
|
6
|
+
import { ArrowRight, BookOpen, Check, ChevronDown, ChevronLeft, ChevronRight, CircleHelp, ClipboardPaste, Copy, Download, FileDown, FileUp, Folder, Glasses, Globe, Info, Layers, Minus, Pencil, Play, Plus, RefreshCw, Repeat, RotateCcw, Scissors, Search, Share2, Sparkles, TriangleAlert, Upload, X, Zap } from "lucide-react";
|
|
7
7
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
8
8
|
import { Annotation, Compartment, EditorSelection, EditorState, Transaction } from "@codemirror/state";
|
|
9
|
-
import { Decoration, EditorView, ViewPlugin, WidgetType, keymap } from "@codemirror/view";
|
|
9
|
+
import { Decoration, EditorView, ViewPlugin, WidgetType, keymap, placeholder } from "@codemirror/view";
|
|
10
10
|
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
|
|
11
11
|
import { parser } from "@lezer/markdown";
|
|
12
12
|
import { Dialog, Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
13
|
+
import { Drawer } from "@base-ui/react/drawer";
|
|
13
14
|
import { Combobox } from "@base-ui/react/combobox";
|
|
14
15
|
import { Menu } from "@base-ui/react/menu";
|
|
15
16
|
import { Popover } from "@base-ui/react/popover";
|
|
@@ -21,8 +22,8 @@ const buttonVariants = cva("nesso-button inline-flex shrink-0 items-center justi
|
|
|
21
22
|
variants: {
|
|
22
23
|
variant: {
|
|
23
24
|
default: "bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-hover",
|
|
24
|
-
outline: "border-border bg-background hover:bg-accent active:bg-pressed",
|
|
25
|
-
ghost: "hover:bg-accent active:bg-pressed"
|
|
25
|
+
outline: "border-border bg-background text-foreground hover:bg-accent active:bg-pressed",
|
|
26
|
+
ghost: "text-foreground hover:bg-accent active:bg-pressed"
|
|
26
27
|
},
|
|
27
28
|
size: {
|
|
28
29
|
default: "min-h-9",
|
|
@@ -169,9 +170,9 @@ function SidePanel({ id, side, open, size, minSize, maxSize, onToggle, onSizeCha
|
|
|
169
170
|
}
|
|
170
171
|
//#endregion
|
|
171
172
|
//#region src/panel-header.tsx
|
|
172
|
-
function PanelHeader({ actions, className, children, ...props }) {
|
|
173
|
+
function PanelHeader({ actions, size = "default", className, children, ...props }) {
|
|
173
174
|
return /* @__PURE__ */ jsxs("header", {
|
|
174
|
-
className: cn("nesso-panel-header", className),
|
|
175
|
+
className: cn("nesso-panel-header", size === "lg" && "h-[49px] pointer-coarse:h-[52px]", className),
|
|
175
176
|
...props,
|
|
176
177
|
children: [children, /* @__PURE__ */ jsx("div", {
|
|
177
178
|
className: "nesso-panel-actions",
|
|
@@ -180,6 +181,22 @@ function PanelHeader({ actions, className, children, ...props }) {
|
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
//#endregion
|
|
184
|
+
//#region src/plugin-page.tsx
|
|
185
|
+
function PluginPage({ className, children, ...props }) {
|
|
186
|
+
return /* @__PURE__ */ jsx("main", {
|
|
187
|
+
className: cn("nesso-plugin-page", className),
|
|
188
|
+
...props,
|
|
189
|
+
children
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function PluginContent({ className, children, ...props }) {
|
|
193
|
+
return /* @__PURE__ */ jsx("div", {
|
|
194
|
+
className: cn("nesso-plugin-content", className),
|
|
195
|
+
...props,
|
|
196
|
+
children
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
183
200
|
//#region src/spinner.tsx
|
|
184
201
|
function Spinner({ label, className }) {
|
|
185
202
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -220,6 +237,54 @@ function Input({ className, type, ...props }) {
|
|
|
220
237
|
});
|
|
221
238
|
}
|
|
222
239
|
//#endregion
|
|
240
|
+
//#region src/directory-field.tsx
|
|
241
|
+
function DirectoryField({ label, value, labels, disabled, changeDisabled, onOpen, onChange, onRestore }) {
|
|
242
|
+
const id = useId();
|
|
243
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
244
|
+
className: "mt-4",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx("label", {
|
|
247
|
+
htmlFor: id,
|
|
248
|
+
className: "block text-xs",
|
|
249
|
+
children: label
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ jsxs("div", {
|
|
252
|
+
className: "mt-2 flex items-center gap-2",
|
|
253
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
254
|
+
className: "relative min-w-0 flex-1",
|
|
255
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
256
|
+
id,
|
|
257
|
+
className: "pr-10",
|
|
258
|
+
readOnly: true,
|
|
259
|
+
value: value ?? "",
|
|
260
|
+
title: value
|
|
261
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
262
|
+
className: "absolute top-1/2 right-1 -translate-y-1/2 text-muted-foreground",
|
|
263
|
+
"aria-label": labels.open,
|
|
264
|
+
title: labels.open,
|
|
265
|
+
disabled,
|
|
266
|
+
onClick: onOpen,
|
|
267
|
+
children: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true" })
|
|
268
|
+
})]
|
|
269
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
270
|
+
variant: "outline",
|
|
271
|
+
disabled: disabled || changeDisabled,
|
|
272
|
+
onClick: onChange,
|
|
273
|
+
children: labels.change
|
|
274
|
+
})]
|
|
275
|
+
}),
|
|
276
|
+
onRestore && /* @__PURE__ */ jsxs(Button, {
|
|
277
|
+
variant: "ghost",
|
|
278
|
+
size: "sm",
|
|
279
|
+
className: "mt-2",
|
|
280
|
+
disabled: disabled || changeDisabled,
|
|
281
|
+
onClick: onRestore,
|
|
282
|
+
children: [/* @__PURE__ */ jsx(RotateCcw, { "aria-hidden": "true" }), labels.restore]
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
223
288
|
//#region src/markdown.ts
|
|
224
289
|
const listPrefix = /^(\s*)([-+*]|(\d{1,9})([.)]))([\t ]+|$)/;
|
|
225
290
|
var ListMarker = class extends WidgetType {
|
|
@@ -421,7 +486,7 @@ const livePreview = ViewPlugin.define((view) => ({
|
|
|
421
486
|
if (update.docChanged || update.selectionSet || update.focusChanged || update.startState.readOnly !== update.state.readOnly) this.decorations = markdownDecorations(update.state, update.view.hasFocus && !update.state.readOnly);
|
|
422
487
|
}
|
|
423
488
|
}), { decorations: (plugin) => plugin.decorations });
|
|
424
|
-
function MarkdownInput({ value, onChange, readOnly = false, history: history$1 = true, onOpenLink, className, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
|
|
489
|
+
function MarkdownInput({ value, onChange, readOnly = false, history: history$1 = true, onOpenLink, placeholder: placeholder$1, className, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
|
|
425
490
|
const container = useRef(null);
|
|
426
491
|
const editor = useRef(null);
|
|
427
492
|
const callbacks = useRef({
|
|
@@ -523,7 +588,8 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
523
588
|
"aria-readonly": String(readOnly),
|
|
524
589
|
spellcheck: "true"
|
|
525
590
|
}),
|
|
526
|
-
...history$1 ? [history(), keymap.of(historyKeymap)] : []
|
|
591
|
+
...history$1 ? [history(), keymap.of(historyKeymap)] : [],
|
|
592
|
+
...placeholder$1 ? [placeholder(placeholder$1)] : []
|
|
527
593
|
]) });
|
|
528
594
|
}, [
|
|
529
595
|
configuration,
|
|
@@ -531,7 +597,8 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
|
|
|
531
597
|
history$1,
|
|
532
598
|
id,
|
|
533
599
|
ariaLabel,
|
|
534
|
-
ariaLabelledBy
|
|
600
|
+
ariaLabelledBy,
|
|
601
|
+
placeholder$1
|
|
535
602
|
]);
|
|
536
603
|
useLayoutEffect(() => {
|
|
537
604
|
const view = editor.current;
|
|
@@ -564,7 +631,7 @@ function Label({ className, ...props }) {
|
|
|
564
631
|
//#region src/kbd.tsx
|
|
565
632
|
function Kbd({ className, ...props }) {
|
|
566
633
|
return /* @__PURE__ */ jsx("kbd", {
|
|
567
|
-
className: cn("inline-flex h-6 min-w-6 items-center justify-center rounded-sm border border-border bg-
|
|
634
|
+
className: cn("inline-flex h-6 min-w-6 items-center justify-center rounded-sm border border-border bg-transparent px-1.5 font-mono text-[11px] leading-none text-muted-foreground", className),
|
|
568
635
|
...props
|
|
569
636
|
});
|
|
570
637
|
}
|
|
@@ -589,6 +656,30 @@ function Banner({ tone = "info", className, children, ...props }) {
|
|
|
589
656
|
children
|
|
590
657
|
});
|
|
591
658
|
}
|
|
659
|
+
function BannerRow({ message, actions }) {
|
|
660
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
661
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-2",
|
|
662
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
663
|
+
className: "min-w-0 flex-1",
|
|
664
|
+
children: message
|
|
665
|
+
}), actions && /* @__PURE__ */ jsx("span", {
|
|
666
|
+
className: "ml-auto flex flex-wrap items-center gap-2",
|
|
667
|
+
children: actions
|
|
668
|
+
})]
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
function BannerDetails({ label, children }) {
|
|
672
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
673
|
+
className: "mt-1",
|
|
674
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
675
|
+
className: "w-fit cursor-pointer text-[11px] leading-4 text-muted-foreground underline underline-offset-2",
|
|
676
|
+
children: label
|
|
677
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
678
|
+
className: "pt-2",
|
|
679
|
+
children
|
|
680
|
+
})]
|
|
681
|
+
});
|
|
682
|
+
}
|
|
592
683
|
//#endregion
|
|
593
684
|
//#region src/toast.tsx
|
|
594
685
|
function useToastLifecycle({ id, duration, onDismiss, onRestoreFocus }) {
|
|
@@ -816,6 +907,53 @@ function ConfirmDialog({ open, onOpenChange, title, description, cancelLabel, co
|
|
|
816
907
|
});
|
|
817
908
|
}
|
|
818
909
|
//#endregion
|
|
910
|
+
//#region src/sheet.tsx
|
|
911
|
+
function BottomSheet({ open, onOpenChange, title, closeLabel, popupRef, footer, className, children }) {
|
|
912
|
+
return /* @__PURE__ */ jsx(Drawer.Root, {
|
|
913
|
+
open,
|
|
914
|
+
onOpenChange,
|
|
915
|
+
modal: false,
|
|
916
|
+
disablePointerDismissal: true,
|
|
917
|
+
swipeDirection: "down",
|
|
918
|
+
children: /* @__PURE__ */ jsx(Drawer.Portal, { children: /* @__PURE__ */ jsx(Drawer.Viewport, {
|
|
919
|
+
className: "pointer-events-none fixed inset-0 z-40 flex items-end pr-[env(safe-area-inset-right)] pl-[env(safe-area-inset-left)]",
|
|
920
|
+
children: /* @__PURE__ */ jsxs(Drawer.Popup, {
|
|
921
|
+
ref: popupRef,
|
|
922
|
+
className: cn("nesso-sheet pointer-events-auto", className),
|
|
923
|
+
initialFocus: false,
|
|
924
|
+
children: [
|
|
925
|
+
/* @__PURE__ */ jsx("div", {
|
|
926
|
+
"aria-hidden": "true",
|
|
927
|
+
className: "nesso-sheet-handle"
|
|
928
|
+
}),
|
|
929
|
+
/* @__PURE__ */ jsxs("div", {
|
|
930
|
+
className: "flex shrink-0 items-center justify-between gap-2 pr-2 pl-5",
|
|
931
|
+
children: [/* @__PURE__ */ jsx(Drawer.Title, {
|
|
932
|
+
className: "nesso-sheet-title",
|
|
933
|
+
children: title
|
|
934
|
+
}), /* @__PURE__ */ jsx(Drawer.Close, {
|
|
935
|
+
render: /* @__PURE__ */ jsx(IconButton, {
|
|
936
|
+
className: "min-h-11 min-w-11",
|
|
937
|
+
"aria-label": closeLabel,
|
|
938
|
+
title: closeLabel
|
|
939
|
+
}),
|
|
940
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
941
|
+
})]
|
|
942
|
+
}),
|
|
943
|
+
/* @__PURE__ */ jsx(Drawer.Content, {
|
|
944
|
+
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-1 pb-5",
|
|
945
|
+
children
|
|
946
|
+
}),
|
|
947
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
948
|
+
className: "nesso-sheet-footer",
|
|
949
|
+
children: footer
|
|
950
|
+
})
|
|
951
|
+
]
|
|
952
|
+
})
|
|
953
|
+
}) })
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
//#endregion
|
|
819
957
|
//#region src/prompt.tsx
|
|
820
958
|
function PromptForm({ initialValue = "", nameLabel, submitLabel, cancelLabel, maxLength, onSubmit }) {
|
|
821
959
|
const [value, setValue] = useState(initialValue);
|
|
@@ -1409,6 +1547,7 @@ const icons = {
|
|
|
1409
1547
|
play: Play,
|
|
1410
1548
|
plus: Plus,
|
|
1411
1549
|
refresh: RefreshCw,
|
|
1550
|
+
repeat: Repeat,
|
|
1412
1551
|
scissors: Scissors,
|
|
1413
1552
|
search: Search,
|
|
1414
1553
|
share: Share2,
|
|
@@ -1417,11 +1556,11 @@ const icons = {
|
|
|
1417
1556
|
zap: Zap
|
|
1418
1557
|
};
|
|
1419
1558
|
function ActionIcon({ name, ...props }) {
|
|
1420
|
-
const Icon =
|
|
1559
|
+
const Icon = name !== void 0 && Object.hasOwn(icons, name) ? icons[name] : Zap;
|
|
1421
1560
|
return /* @__PURE__ */ jsx(Icon, {
|
|
1422
1561
|
"aria-hidden": "true",
|
|
1423
1562
|
...props
|
|
1424
1563
|
});
|
|
1425
1564
|
}
|
|
1426
1565
|
//#endregion
|
|
1427
|
-
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, Button, Collapsible, ColorPicker, Combobox, ComboboxItem, ComboboxPopup, ConfirmDialog, ContextLabel, Dialog, DialogActions, DialogPopup, Field, FieldHint, IconButton, Input, Kbd, Label, ListRow, ListRowButton, ListRowDetail, ListRowTitle, MarkdownInput, Menu, MenuItem, MenuPopup, MenuRadioItem, PanelHeader, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport, contrastColor, presetColors, useMediaQuery };
|
|
1566
|
+
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, BannerDetails, BannerRow, BottomSheet, Button, Collapsible, ColorPicker, Combobox, ComboboxItem, ComboboxPopup, ConfirmDialog, ContextLabel, Dialog, DialogActions, DialogPopup, DirectoryField, Field, FieldHint, IconButton, Input, Kbd, Label, ListRow, ListRowButton, ListRowDetail, ListRowTitle, MarkdownInput, Menu, MenuItem, MenuPopup, MenuRadioItem, PanelHeader, PluginContent, PluginPage, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport, contrastColor, presetColors, useMediaQuery };
|
package/dist/styles.css
CHANGED
|
@@ -24,6 +24,22 @@
|
|
|
24
24
|
--radius-lg: var(--radius-object);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
@layer base {
|
|
28
|
+
:root {
|
|
29
|
+
--nesso-panel-bar-height: 40px;
|
|
30
|
+
--nesso-reading-font-size: 13px;
|
|
31
|
+
--nesso-reading-line-height: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (pointer: coarse) {
|
|
35
|
+
:root {
|
|
36
|
+
--nesso-panel-bar-height: 52px;
|
|
37
|
+
--nesso-reading-font-size: 15px;
|
|
38
|
+
--nesso-reading-line-height: 23px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
@layer components {
|
|
28
44
|
.nesso-button,
|
|
29
45
|
.nesso-input,
|
|
@@ -85,6 +101,57 @@
|
|
|
85
101
|
outline: none;
|
|
86
102
|
}
|
|
87
103
|
|
|
104
|
+
.nesso-sheet {
|
|
105
|
+
display: flex;
|
|
106
|
+
width: 100%;
|
|
107
|
+
max-height: min(60dvh, calc(100dvh - 96px));
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
border-top: 1px solid var(--border);
|
|
110
|
+
border-radius: calc(var(--radius-object) * 2) calc(var(--radius-object) * 2) 0 0;
|
|
111
|
+
background: var(--background);
|
|
112
|
+
color: var(--foreground);
|
|
113
|
+
box-shadow: 0 -8px 24px #00000014;
|
|
114
|
+
outline: none;
|
|
115
|
+
transform: translateY(var(--drawer-swipe-movement-y, 0px));
|
|
116
|
+
transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.nesso-sheet[data-swiping] {
|
|
120
|
+
transition-duration: 0s;
|
|
121
|
+
user-select: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nesso-sheet[data-starting-style],
|
|
125
|
+
.nesso-sheet[data-ending-style] {
|
|
126
|
+
transform: translateY(calc(100% + 2px));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.nesso-sheet-handle {
|
|
130
|
+
flex-shrink: 0;
|
|
131
|
+
width: 36px;
|
|
132
|
+
height: 4px;
|
|
133
|
+
margin: 8px auto 0;
|
|
134
|
+
border-radius: 2px;
|
|
135
|
+
background: var(--node-border);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.nesso-sheet-title {
|
|
139
|
+
min-width: 0;
|
|
140
|
+
font-size: 18px;
|
|
141
|
+
line-height: 24px;
|
|
142
|
+
font-weight: 500;
|
|
143
|
+
overflow-wrap: anywhere;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.nesso-sheet-footer {
|
|
147
|
+
display: flex;
|
|
148
|
+
flex-shrink: 0;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: 12px;
|
|
151
|
+
padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
|
|
152
|
+
border-top: 1px solid var(--border);
|
|
153
|
+
}
|
|
154
|
+
|
|
88
155
|
.nesso-option[data-highlighted] {
|
|
89
156
|
background: var(--hover);
|
|
90
157
|
}
|
|
@@ -138,7 +205,7 @@
|
|
|
138
205
|
align-items: center;
|
|
139
206
|
justify-content: space-between;
|
|
140
207
|
gap: 12px;
|
|
141
|
-
height:
|
|
208
|
+
height: var(--nesso-panel-bar-height);
|
|
142
209
|
padding: 0 14px 0 20px;
|
|
143
210
|
border-bottom: 1px solid var(--border);
|
|
144
211
|
}
|
|
@@ -146,12 +213,28 @@
|
|
|
146
213
|
display: flex;
|
|
147
214
|
flex-shrink: 0;
|
|
148
215
|
gap: 2px;
|
|
149
|
-
color: var(--muted-foreground);
|
|
150
216
|
}
|
|
151
217
|
.nesso-panel-actions button {
|
|
152
218
|
width: 26px;
|
|
153
219
|
height: 28px;
|
|
154
220
|
}
|
|
221
|
+
.nesso-plugin-page {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
height: 100%;
|
|
225
|
+
min-height: 0;
|
|
226
|
+
overflow: hidden;
|
|
227
|
+
background: var(--background);
|
|
228
|
+
color: var(--foreground);
|
|
229
|
+
font-family: var(--font-sans);
|
|
230
|
+
}
|
|
231
|
+
.nesso-plugin-content {
|
|
232
|
+
box-sizing: border-box;
|
|
233
|
+
width: 100%;
|
|
234
|
+
max-width: 40rem;
|
|
235
|
+
margin-inline: auto;
|
|
236
|
+
padding: clamp(1.5rem, 5vw, 3rem);
|
|
237
|
+
}
|
|
155
238
|
|
|
156
239
|
.side-panel {
|
|
157
240
|
position: relative;
|
|
@@ -312,6 +395,9 @@
|
|
|
312
395
|
}
|
|
313
396
|
|
|
314
397
|
@media (prefers-reduced-motion: reduce) {
|
|
398
|
+
.nesso-sheet {
|
|
399
|
+
transition: none;
|
|
400
|
+
}
|
|
315
401
|
*,
|
|
316
402
|
*::before,
|
|
317
403
|
*::after {
|
|
@@ -440,6 +526,7 @@
|
|
|
440
526
|
color: var(--muted-foreground);
|
|
441
527
|
font-size: 12px;
|
|
442
528
|
line-height: 18px;
|
|
529
|
+
white-space: pre-line;
|
|
443
530
|
}
|
|
444
531
|
.toast-actions {
|
|
445
532
|
display: flex;
|
package/package.json
CHANGED