@nesso-how/ui 1.0.0-beta.3 → 1.0.0-beta.5
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 +3 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +49 -1
- package/dist/styles.css +58 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,13 +43,15 @@ Your build must compile this CSS; it is not a precompiled stylesheet. Supply the
|
|
|
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`
|
|
46
|
+
| Dialogs | `Dialog`, `DialogActions`, `DialogPopup`, `ConfirmDialog`, `TextPromptDialog`, `BottomSheet` |
|
|
47
47
|
| Panels and disclosure | `SidePanel`, `PanelHeader`, `PluginPage`, `PluginContent`, `SectionHeading`, `Collapsible`, `Tabs` |
|
|
48
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
|
|
|
55
57
|
`MarkdownInput` also accepts an optional `placeholder` shown only while the editor is empty.
|
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";
|
|
@@ -140,6 +140,18 @@ export declare function ConfirmDialog({ open, onOpenChange, title, description,
|
|
|
140
140
|
children?: ReactNode;
|
|
141
141
|
}): import("react").JSX.Element;
|
|
142
142
|
//#endregion
|
|
143
|
+
//#region src/sheet.d.ts
|
|
144
|
+
export declare function BottomSheet({ open, onOpenChange, title, closeLabel, popupRef, footer, className, children }: {
|
|
145
|
+
open: boolean;
|
|
146
|
+
onOpenChange: (open: boolean) => void;
|
|
147
|
+
title: ReactNode;
|
|
148
|
+
closeLabel: string;
|
|
149
|
+
popupRef?: Ref<HTMLDivElement>;
|
|
150
|
+
footer?: ReactNode;
|
|
151
|
+
className?: string;
|
|
152
|
+
children: ReactNode;
|
|
153
|
+
}): import("react").JSX.Element;
|
|
154
|
+
//#endregion
|
|
143
155
|
//#region src/prompt.d.ts
|
|
144
156
|
export declare function PromptForm({ initialValue, nameLabel, submitLabel, cancelLabel, maxLength, onSubmit }: {
|
|
145
157
|
initialValue?: string;
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Decoration, EditorView, ViewPlugin, WidgetType, keymap, placeholder } f
|
|
|
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";
|
|
@@ -858,6 +859,53 @@ function ConfirmDialog({ open, onOpenChange, title, description, cancelLabel, co
|
|
|
858
859
|
});
|
|
859
860
|
}
|
|
860
861
|
//#endregion
|
|
862
|
+
//#region src/sheet.tsx
|
|
863
|
+
function BottomSheet({ open, onOpenChange, title, closeLabel, popupRef, footer, className, children }) {
|
|
864
|
+
return /* @__PURE__ */ jsx(Drawer.Root, {
|
|
865
|
+
open,
|
|
866
|
+
onOpenChange,
|
|
867
|
+
modal: false,
|
|
868
|
+
disablePointerDismissal: true,
|
|
869
|
+
swipeDirection: "down",
|
|
870
|
+
children: /* @__PURE__ */ jsx(Drawer.Portal, { children: /* @__PURE__ */ jsx(Drawer.Viewport, {
|
|
871
|
+
className: "pointer-events-none fixed inset-0 z-40 flex items-end pr-[env(safe-area-inset-right)] pl-[env(safe-area-inset-left)]",
|
|
872
|
+
children: /* @__PURE__ */ jsxs(Drawer.Popup, {
|
|
873
|
+
ref: popupRef,
|
|
874
|
+
className: cn("nesso-sheet pointer-events-auto", className),
|
|
875
|
+
initialFocus: false,
|
|
876
|
+
children: [
|
|
877
|
+
/* @__PURE__ */ jsx("div", {
|
|
878
|
+
"aria-hidden": "true",
|
|
879
|
+
className: "nesso-sheet-handle"
|
|
880
|
+
}),
|
|
881
|
+
/* @__PURE__ */ jsxs("div", {
|
|
882
|
+
className: "flex shrink-0 items-center justify-between gap-2 pr-2 pl-5",
|
|
883
|
+
children: [/* @__PURE__ */ jsx(Drawer.Title, {
|
|
884
|
+
className: "nesso-sheet-title",
|
|
885
|
+
children: title
|
|
886
|
+
}), /* @__PURE__ */ jsx(Drawer.Close, {
|
|
887
|
+
render: /* @__PURE__ */ jsx(IconButton, {
|
|
888
|
+
className: "min-h-11 min-w-11",
|
|
889
|
+
"aria-label": closeLabel,
|
|
890
|
+
title: closeLabel
|
|
891
|
+
}),
|
|
892
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
893
|
+
})]
|
|
894
|
+
}),
|
|
895
|
+
/* @__PURE__ */ jsx(Drawer.Content, {
|
|
896
|
+
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-1 pb-5",
|
|
897
|
+
children
|
|
898
|
+
}),
|
|
899
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
900
|
+
className: "nesso-sheet-footer",
|
|
901
|
+
children: footer
|
|
902
|
+
})
|
|
903
|
+
]
|
|
904
|
+
})
|
|
905
|
+
}) })
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
//#endregion
|
|
861
909
|
//#region src/prompt.tsx
|
|
862
910
|
function PromptForm({ initialValue = "", nameLabel, submitLabel, cancelLabel, maxLength, onSubmit }) {
|
|
863
911
|
const [value, setValue] = useState(initialValue);
|
|
@@ -1467,4 +1515,4 @@ function ActionIcon({ name, ...props }) {
|
|
|
1467
1515
|
});
|
|
1468
1516
|
}
|
|
1469
1517
|
//#endregion
|
|
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 };
|
|
1518
|
+
export { ActionIcon, Autocomplete, AutocompleteClear, AutocompleteItem, AutocompletePopup, Banner, BannerDetails, BannerRow, BottomSheet, 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
|
@@ -27,11 +27,15 @@
|
|
|
27
27
|
@layer base {
|
|
28
28
|
:root {
|
|
29
29
|
--nesso-panel-bar-height: 40px;
|
|
30
|
+
--nesso-reading-font-size: 13px;
|
|
31
|
+
--nesso-reading-line-height: 20px;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
@media (pointer: coarse) {
|
|
33
35
|
:root {
|
|
34
36
|
--nesso-panel-bar-height: 52px;
|
|
37
|
+
--nesso-reading-font-size: 15px;
|
|
38
|
+
--nesso-reading-line-height: 23px;
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -97,6 +101,57 @@
|
|
|
97
101
|
outline: none;
|
|
98
102
|
}
|
|
99
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
|
+
|
|
100
155
|
.nesso-option[data-highlighted] {
|
|
101
156
|
background: var(--hover);
|
|
102
157
|
}
|
|
@@ -340,6 +395,9 @@
|
|
|
340
395
|
}
|
|
341
396
|
|
|
342
397
|
@media (prefers-reduced-motion: reduce) {
|
|
398
|
+
.nesso-sheet {
|
|
399
|
+
transition: none;
|
|
400
|
+
}
|
|
343
401
|
*,
|
|
344
402
|
*::before,
|
|
345
403
|
*::after {
|
package/package.json
CHANGED