@nesso-how/ui 1.0.0-beta.1 → 1.0.0-beta.3

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 CHANGED
@@ -44,12 +44,14 @@ Your build must compile this CSS; it is not a precompiled stylesheet. Supply the
44
44
  | Menus and popovers | `Menu`, `MenuItem`, `MenuPopup`, `MenuRadioItem`, `Popover`, `PopoverPopup` |
45
45
  | Search and suggestions | `Combobox`, `ComboboxItem`, `ComboboxPopup`, `Autocomplete`, `AutocompleteClear`, `AutocompleteItem`, `AutocompletePopup` |
46
46
  | Dialogs | `Dialog`, `DialogActions`, `DialogPopup`, `ConfirmDialog`, `TextPromptDialog` |
47
- | Panels and disclosure | `SidePanel`, `PanelHeader`, `SectionHeading`, `Collapsible`, `Tabs` |
48
- | Feedback | `Banner`, `ToastViewport`, `Spinner` |
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
53
  `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
54
 
55
+ `MarkdownInput` also accepts an optional `placeholder` shown only while the editor is empty.
56
+
55
57
  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
@@ -39,6 +39,10 @@ export declare function PanelHeader({ actions, size, className, children, ...pro
39
39
  size?: 'default' | 'lg';
40
40
  }): import("react").JSX.Element;
41
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
42
46
  //#region src/spinner.d.ts
43
47
  export declare function Spinner({ label, className }: {
44
48
  label: string;
@@ -58,8 +62,9 @@ type MarkdownInputProps = Omit<ComponentProps<'div'>, 'onChange' | 'children' |
58
62
  readOnly?: boolean;
59
63
  history?: boolean;
60
64
  onOpenLink?: (url: string) => void;
65
+ placeholder?: string;
61
66
  };
62
- export declare function MarkdownInput({ value, onChange, readOnly, history, onOpenLink, className, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: MarkdownInputProps): import("react").JSX.Element;
67
+ export declare function MarkdownInput({ value, onChange, readOnly, history, onOpenLink, placeholder, className, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }: MarkdownInputProps): import("react").JSX.Element;
63
68
  //#endregion
64
69
  //#region src/label.d.ts
65
70
  declare function Label({ className, ...props }: ComponentProps<'label'>): import("react").JSX.Element;
@@ -75,6 +80,14 @@ type BannerProps = ComponentProps<'div'> & {
75
80
  tone?: 'info' | 'warning' | 'error';
76
81
  };
77
82
  export declare function Banner({ tone, className, children, ...props }: BannerProps): import("react").JSX.Element;
83
+ export declare function BannerRow({ message, actions }: {
84
+ message: ReactNode;
85
+ actions?: ReactNode;
86
+ }): import("react").JSX.Element;
87
+ export declare function BannerDetails({ label, children }: {
88
+ label: ReactNode;
89
+ children: ReactNode;
90
+ }): import("react").JSX.Element;
78
91
  //#endregion
79
92
  //#region src/toast.d.ts
80
93
  type ToastAction = {
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, useSy
6
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";
@@ -180,6 +180,22 @@ function PanelHeader({ actions, size = "default", className, children, ...props
180
180
  });
181
181
  }
182
182
  //#endregion
183
+ //#region src/plugin-page.tsx
184
+ function PluginPage({ className, children, ...props }) {
185
+ return /* @__PURE__ */ jsx("main", {
186
+ className: cn("nesso-plugin-page", className),
187
+ ...props,
188
+ children
189
+ });
190
+ }
191
+ function PluginContent({ className, children, ...props }) {
192
+ return /* @__PURE__ */ jsx("div", {
193
+ className: cn("nesso-plugin-content", className),
194
+ ...props,
195
+ children
196
+ });
197
+ }
198
+ //#endregion
183
199
  //#region src/spinner.tsx
184
200
  function Spinner({ label, className }) {
185
201
  return /* @__PURE__ */ jsxs("div", {
@@ -421,7 +437,7 @@ const livePreview = ViewPlugin.define((view) => ({
421
437
  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
438
  }
423
439
  }), { 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 }) {
440
+ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 = true, onOpenLink, placeholder: placeholder$1, className, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
425
441
  const container = useRef(null);
426
442
  const editor = useRef(null);
427
443
  const callbacks = useRef({
@@ -523,7 +539,8 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
523
539
  "aria-readonly": String(readOnly),
524
540
  spellcheck: "true"
525
541
  }),
526
- ...history$1 ? [history(), keymap.of(historyKeymap)] : []
542
+ ...history$1 ? [history(), keymap.of(historyKeymap)] : [],
543
+ ...placeholder$1 ? [placeholder(placeholder$1)] : []
527
544
  ]) });
528
545
  }, [
529
546
  configuration,
@@ -531,7 +548,8 @@ function MarkdownInput({ value, onChange, readOnly = false, history: history$1 =
531
548
  history$1,
532
549
  id,
533
550
  ariaLabel,
534
- ariaLabelledBy
551
+ ariaLabelledBy,
552
+ placeholder$1
535
553
  ]);
536
554
  useLayoutEffect(() => {
537
555
  const view = editor.current;
@@ -589,6 +607,30 @@ function Banner({ tone = "info", className, children, ...props }) {
589
607
  children
590
608
  });
591
609
  }
610
+ function BannerRow({ message, actions }) {
611
+ return /* @__PURE__ */ jsxs("div", {
612
+ className: "flex flex-wrap items-center gap-x-3 gap-y-2",
613
+ children: [/* @__PURE__ */ jsx("span", {
614
+ className: "min-w-0 flex-1",
615
+ children: message
616
+ }), actions && /* @__PURE__ */ jsx("span", {
617
+ className: "ml-auto flex flex-wrap items-center gap-2",
618
+ children: actions
619
+ })]
620
+ });
621
+ }
622
+ function BannerDetails({ label, children }) {
623
+ return /* @__PURE__ */ jsxs("details", {
624
+ className: "mt-1",
625
+ children: [/* @__PURE__ */ jsx("summary", {
626
+ className: "w-fit cursor-pointer text-[11px] leading-4 text-muted-foreground underline underline-offset-2",
627
+ children: label
628
+ }), /* @__PURE__ */ jsx("div", {
629
+ className: "pt-2",
630
+ children
631
+ })]
632
+ });
633
+ }
592
634
  //#endregion
593
635
  //#region src/toast.tsx
594
636
  function useToastLifecycle({ id, duration, onDismiss, onRestoreFocus }) {
@@ -1418,11 +1460,11 @@ const icons = {
1418
1460
  zap: Zap
1419
1461
  };
1420
1462
  function ActionIcon({ name, ...props }) {
1421
- const Icon = (name !== void 0 ? icons[name] : void 0) ?? Zap;
1463
+ const Icon = name !== void 0 && Object.hasOwn(icons, name) ? icons[name] : Zap;
1422
1464
  return /* @__PURE__ */ jsx(Icon, {
1423
1465
  "aria-hidden": "true",
1424
1466
  ...props
1425
1467
  });
1426
1468
  }
1427
1469
  //#endregion
1428
- 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 };
1470
+ export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, BannerDetails, BannerRow, 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, PluginContent, PluginPage, Popover, PopoverPopup, PreferenceSelect, PromptForm, RevealActions, SectionHeading, SidePanel, Spinner, Tabs, TextPromptDialog, ToastViewport, contrastColor, presetColors, useMediaQuery };
package/dist/styles.css CHANGED
@@ -163,6 +163,23 @@
163
163
  width: 26px;
164
164
  height: 28px;
165
165
  }
166
+ .nesso-plugin-page {
167
+ display: flex;
168
+ flex-direction: column;
169
+ height: 100%;
170
+ min-height: 0;
171
+ overflow: hidden;
172
+ background: var(--background);
173
+ color: var(--foreground);
174
+ font-family: var(--font-sans);
175
+ }
176
+ .nesso-plugin-content {
177
+ box-sizing: border-box;
178
+ width: 100%;
179
+ max-width: 40rem;
180
+ margin-inline: auto;
181
+ padding: clamp(1.5rem, 5vw, 3rem);
182
+ }
166
183
 
167
184
  .side-panel {
168
185
  position: relative;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nesso-how/ui",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Reusable React primitives and shared styles for Nesso, usable in the app and in isolated plugin panels",
5
5
  "license": "MIT",
6
6
  "repository": {