@zsherman/kit 0.1.0 → 0.1.1
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/CHANGELOG.md +15 -0
- package/dist/css/card-input.css +1 -1
- package/dist/css/date-picker.css +1 -1
- package/dist/css/natural-date-input.css +1 -1
- package/dist/css/recurrence.css +1 -1
- package/dist/dom/card-input/card-input.js +27 -7
- package/dist/dom/date-picker/date-picker.js +8 -3
- package/dist/dom/peek-panel/peek-panel.js +13 -2
- package/dist/solid/card-input/card-input.jsx +9 -1
- package/dist/solid/date-picker/date-picker.jsx +2 -1
- package/dist/solid/peek-panel/peek-panel.jsx +13 -2
- package/dist/styles.css +1 -1
- package/docs/blocks/command-palette.md +4 -2
- package/docs/date-picker.md +1 -1
- package/docs/peek-panel.md +1 -0
- package/docs/search-index.json +2 -2
- package/package.json +6 -1
|
@@ -10,7 +10,7 @@ The kit [Command](../command.md) inside a top-anchored dialog, opened from a lau
|
|
|
10
10
|
| ---------------------------- | ----- |
|
|
11
11
|
| `command-palette.tsx` | 273 |
|
|
12
12
|
| `command-palette-search.tsx` | 734 |
|
|
13
|
-
| `command-palette.module.css` |
|
|
13
|
+
| `command-palette.module.css` | 523 |
|
|
14
14
|
|
|
15
15
|
To write them into your app, from its root:
|
|
16
16
|
|
|
@@ -1196,7 +1196,9 @@ function toListData(items: readonly PaletteItem[], order: string[] = []): ListEn
|
|
|
1196
1196
|
|
|
1197
1197
|
/* Core: the launcher and the dialog (command-palette.tsx). */
|
|
1198
1198
|
|
|
1199
|
-
|
|
1199
|
+
/* No specificity, so a `launcherClass` (an app shell's header sizes it) wins wherever a bundle puts its rules;
|
|
1200
|
+
still unlayered, so it wins over the kit's Button. */
|
|
1201
|
+
:where(.launcher) {
|
|
1200
1202
|
min-width: 15rem;
|
|
1201
1203
|
justify-content: flex-start;
|
|
1202
1204
|
color: var(--sui-text-muted);
|
package/docs/date-picker.md
CHANGED
|
@@ -38,7 +38,7 @@ const [anchor, setAnchor] = createSignal<HTMLElement>();
|
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
40
40
|
<DatePicker> // mode="range" for [start, end]
|
|
41
|
-
<DatePickerGroup> // the visible field; its ref anchors the popup
|
|
41
|
+
<DatePickerGroup> // the visible field (data-slot="date-picker-group"); its ref anchors the popup; fades as one when disabled
|
|
42
42
|
<DatePickerInput />
|
|
43
43
|
<DatePickerSeparator /> // range only
|
|
44
44
|
<DatePickerInput end /> // range only
|
package/docs/peek-panel.md
CHANGED
|
@@ -254,6 +254,7 @@ The panel enters with a fade and a short slide from the inline end (`--sui-durat
|
|
|
254
254
|
|
|
255
255
|
- **Why a region and not a dialog.** The panel is non-modal: the list stays usable, focus stays where it was when the panel opens (on the row, so Space, J/K and the arrows keep working), and Tab reaches the panel after the list (it comes after it in the page). That's a region, not a dialog: a dialog says focus is inside it and contained. It's a `<section>` named by `PeekPanelTitle` (`aria-labelledby`), so it's in the landmarks list, and `PeekPanelTrigger` points at it (`aria-controls`, `aria-expanded`). On a phone the sheet is a modal dialog: focus moves into it, the page behind is inert, and Escape or a swipe closes it.
|
|
256
256
|
- **Announcements.** When another item shows, the panel says `labels.announce` politely: "ENG-142 Fix SSO, 3 of 24" (`itemLabel` gives the name; the id otherwise). Opening on an item when the page loads says nothing.
|
|
257
|
+
- **A press on a row.** Safari doesn't focus a button or link it presses; when a press on a row's button or link leaves focus on the page, the panel focuses it, so Escape, J/K and Space work after a click there too.
|
|
257
258
|
- **Focus coming back.** Escape, Close and Space again close the panel and put focus on the row of the item now shown (not the one first opened), scrolled into view. Closing it from your code doesn't move focus.
|
|
258
259
|
- **Previous and Next** are disabled at the ends (unless `wrap`) but stay focusable (`aria-disabled`), so focus isn't lost when a step reaches the end. Their names carry the key (`title`, `aria-keyshortcuts`).
|
|
259
260
|
|
package/docs/search-index.json
CHANGED
|
@@ -998,7 +998,7 @@
|
|
|
998
998
|
{"id":"peek-panel.md#async-content","kind":"section","title":"Async content","page":"Peek panel","doc":"peek-panel.md","anchor":"async-content","text":"PeekPanelBody wraps each item's content in a loading boundary. An async read inside it (a memo of a promise) shows fallback (skeleton lines, by default, with \"Loading\" for screen readers) until it lands; the header (title, position, buttons) stays and keeps working, so people can step past an item that's slow. Each item's content is made again when the item changes, so its state starts over and the body scrolls back to the top.","code":"Details details createMemo api issue description PeekPanelBody fallback MySkeleton"},
|
|
999
999
|
{"id":"peek-panel.md#modes-and-the-phone-sheet","kind":"section","title":"Modes and the phone sheet","page":"Peek panel","doc":"peek-panel.md","anchor":"modes-and-the-phone-sheet","text":"mode=\"overlay\" (the default): the panel is a card floating over the list's inline end, as an issue tracker's peek: inset from the root's edges by --peek-panel-inset (--sui-space-2), with a border, rounded corners (--sui-radius-lg) and a large shadow. The list keeps its width and stays usable beside it. Use it for lists whose content fits to the left of the panel (a list of titles, a narrow table): whatever sits under the panel can't be seen, and a focused control there is hidden. mode=\"inline\" for wide content: a Data grid with many columns, end columns with row menus or actions, a file list. The panel is a pane beside the list, split from it by a hairline, and the list narrows (a grid scrolls sideways), so every column stays reachable while the panel is open. The issue tracker and files blocks use it. mode=\"inline\" is also a reading pane: open it on an item with defaultPeekId for a pane that's always there. panelWidth sets its width (26rem by default; at most the root's width less the insets in overlay, 60% of it inline). presentation=\"auto\" (the default) shows a modal bottom Sheet instead when the window is narrower than 40rem (a phone): the same header and body, the sheet's handle, closed by a swipe down, Escape, the backdrop or Close, with focus back on the row of the item it showed last. presentation=\"panel\" or \"sheet\" picks one at every width. The sheet's code is a chunk of its own, loaded only once the window is narrow (or with \"sheet\"). The server renders the panel; a phone switches after it loads. An item already open when the root mounts (defaultPeekId, a peekId from the URL) isn't presented as a sheet on a phone (a modal over a page that just loaded): its row is marked, and the first change (a press on a row, J/K) shows the sheet.","code":"PeekPanel items ids mode inline defaultPeekId panelWidth presentation sheet"},
|
|
1000
1000
|
{"id":"peek-panel.md#motion","kind":"section","title":"Motion","page":"Peek panel","doc":"peek-panel.md","anchor":"motion","text":"The panel enters with a fade and a short slide from the inline end (--sui-duration-base, ease-out) and leaves faster (--sui-duration-exit, ease-in), from [data-starting-style] to [data-ending-style]/[data-closed] on opacity and transform only. Moving to another item doesn't replay that, and the body swaps its content at once: holding J reads as stepping through the list, not a flicker. Under prefers-reduced-motion: reduce the panel only fades."},
|
|
1001
|
-
{"id":"peek-panel.md#focus-and-screen-readers","kind":"section","title":"Focus and screen readers","page":"Peek panel","doc":"peek-panel.md","anchor":"focus-and-screen-readers","text":"Why a region and not a dialog. The panel is non-modal: the list stays usable, focus stays where it was when the panel opens (on the row, so Space, J/K and the arrows keep working), and Tab reaches the panel after the list (it comes after it in the page). That's a region, not a dialog: a dialog says focus is inside it and contained. It's a <section> named by PeekPanelTitle (aria-labelledby), so it's in the landmarks list, and PeekPanelTrigger points at it (aria-controls, aria-expanded). On a phone the sheet is a modal dialog: focus moves into it, the page behind is inert, and Escape or a swipe closes it. Announcements. When another item shows, the panel says labels.announce politely: \"ENG-142 Fix SSO, 3 of 24\" (itemLabel gives the name; the id otherwise). Opening on an item when the page loads says nothing. Focus coming back. Escape, Close and Space again close the panel and put focus on the row of the item now shown (not the one first opened), scrolled into view. Closing it from your code doesn't move focus. Previous and Next are disabled at the ends (unless wrap) but stay focusable (aria-disabled), so focus isn't lost when a step reaches the end. Their names carry the key (title, aria-keyshortcuts)."},
|
|
1001
|
+
{"id":"peek-panel.md#focus-and-screen-readers","kind":"section","title":"Focus and screen readers","page":"Peek panel","doc":"peek-panel.md","anchor":"focus-and-screen-readers","text":"Why a region and not a dialog. The panel is non-modal: the list stays usable, focus stays where it was when the panel opens (on the row, so Space, J/K and the arrows keep working), and Tab reaches the panel after the list (it comes after it in the page). That's a region, not a dialog: a dialog says focus is inside it and contained. It's a <section> named by PeekPanelTitle (aria-labelledby), so it's in the landmarks list, and PeekPanelTrigger points at it (aria-controls, aria-expanded). On a phone the sheet is a modal dialog: focus moves into it, the page behind is inert, and Escape or a swipe closes it. Announcements. When another item shows, the panel says labels.announce politely: \"ENG-142 Fix SSO, 3 of 24\" (itemLabel gives the name; the id otherwise). Opening on an item when the page loads says nothing. A press on a row. Safari doesn't focus a button or link it presses; when a press on a row's button or link leaves focus on the page, the panel focuses it, so Escape, J/K and Space work after a click there too. Focus coming back. Escape, Close and Space again close the panel and put focus on the row of the item now shown (not the one first opened), scrolled into view. Closing it from your code doesn't move focus. Previous and Next are disabled at the ends (unless wrap) but stay focusable (aria-disabled), so focus isn't lost when a step reaches the end. Their names carry the key (title, aria-keyshortcuts)."},
|
|
1002
1002
|
{"id":"peek-panel.md#keyboard","kind":"section","title":"Keyboard","page":"Peek panel","doc":"peek-panel.md","anchor":"keyboard","text":"Space · a row (not a button or checkbox in it) · Peek its item; Space again on the row of the item shown closes it J, ↓ · the list or the panel, while open · The next item (focus in the list moves to its row; in the panel it stays). In the panel the arrows step items, not the scroll: Page Down/Page Up, Space on the body, Home and End scroll it K, ↑ · the list or the panel, while open · The previous item Escape · the list or the panel · Close; focus goes back to the row of the item shown Enter, Space · a PeekPanelTrigger · Peek its item, or close it when it's the one shown Tab · The list's stops, then the panel's (title is not a stop; the buttons, then the body, which scrolls) Keys the panel leaves alone: anything typed in a field (an input, a text area, an editor) in the panel or the list; the arrows in widgets that use them (a list box, a select list, a slider, a grid's own cells); Space on a control in a row; keys with Ctrl, Alt or ⌘; Escape while a popup is open (a select list in a Property list closes first). onKeyDown on the root runs first: event.preventDefault() keeps a key for you. While the panel is open, focus moving to another row (a Data grid's or a Tree's arrows, Tab, a click) shows that row's item. Focus on a control inside a row (a card's checkbox, a row's menu button) doesn't: that control has a job of its own. Set followFocus={false} to keep the item until a key or button moves it."},
|
|
1003
1003
|
{"id":"peek-panel.md#words","kind":"section","title":"Words","page":"Peek panel","doc":"peek-panel.md","anchor":"words","text":"Every string has an English default; override them per panel with labels, or for every panel with LocaleProvider (messages.peekPanel): previous · \"Previous\" (or each button's label) next · \"Next\" close · \"Close\" open · \"Open\" peek(label) · \"Peek ENG-142\" (PeekPanelTrigger, with itemLabel's name) position(index, count) · \"3 of 24\" (the numbers come formatted for the locale: \"1,204\") announce(label, index, count) · \"ENG-142, 3 of 24\" loading · \"Loading\" (the body's fallback) hintMove, hintClose · \"to move\", \"to close\" (PeekPanelHints)"},
|
|
1004
1004
|
{"id":"peek-panel.md#data-attributes","kind":"section","title":"Data attributes","page":"Peek panel","doc":"peek-panel.md","anchor":"data-attributes","text":"PeekPanel (data-slot=\"peek-panel\") · data-mode · overlay or inline PeekPanel · data-open · an item is peeked PeekPanelContent (data-slot=\"peek-panel-content\") · data-mode, data-open, data-closed · the panel's state; data-closed while it leaves PeekPanelContent · data-starting-style, data-ending-style · its first frame, and while it leaves (ui-sdk's presence helpers) the phone's sheet · data-peek-sheet · on the Sheet's content (data-slot=\"drawer-content\") PeekPanelBody (data-slot=\"peek-panel-body\") · — · the scroller each item's content · data-slot=\"peek-panel-item\", data-item · the id shown the buttons · data-peek=\"previous\" | \"next\" | \"open\" | \"close\" | \"trigger\" · (their data-slot is the Button's) PeekPanelTrigger · aria-expanded · \"true\" while its item shows"},
|
|
@@ -1856,7 +1856,7 @@
|
|
|
1856
1856
|
{"id":"blocks/chat.md#new-messages-from-others","kind":"section","title":"New messages from others","page":"Chat (block)","parent":"Recipes","doc":"blocks/chat.md","anchor":"new-messages-from-others","text":"Push them into the store as they arrive (a WebSocket, server-sent events): add a function next to send that does setEntries((s) => { s.list.push(entry); }). The scroller follows them while the reader is at the end."},
|
|
1857
1857
|
{"id":"blocks/chat.md#loading-older-messages","kind":"section","title":"Loading older messages","page":"Chat (block)","parent":"Recipes","doc":"blocks/chat.md","anchor":"loading-older-messages","text":"Add a \"Load earlier\" button at the top of the viewport and call scroller.prepend() before adding the older entries, as in the Message scroller docs: the reader's place doesn't move."},
|
|
1858
1858
|
{"id":"blocks/chat.md#source","kind":"section","title":"Source","page":"Chat (block)","doc":"blocks/chat.md","anchor":"source","text":""},
|
|
1859
|
-
{"id":"blocks/command-palette.md","kind":"page","title":"Command palette (block)","page":"Command palette (block)","doc":"blocks/command-palette.md","keywords":"cmd k, command menu, search dialog, spotlight, quick open, nested pages, deep link","text":"The kit Command inside a top-anchored dialog, opened from a launcher or ⌘K / Ctrl+K, with results from your search, nested pages (Settings ▸ Theme, Go to project ▸ …), a detail pane and deep links. This is copyable source: put the three files below in your app (for example src/components/command-palette/), then edit them freely. They import only public @zsherman/kit/* entries and style with --sui-* tokens in a CSS module, so no StyleX compiler is needed. Vite and Rsbuild handle *.module.css out of the box. Files on this page: each is a fenced block titled with its file name. Copy them into one folder, keeping the names (they import each other by relative path). command-palette.tsx · 273 command-palette-search.tsx · 734 command-palette.module.css ·
|
|
1859
|
+
{"id":"blocks/command-palette.md","kind":"page","title":"Command palette (block)","page":"Command palette (block)","doc":"blocks/command-palette.md","keywords":"cmd k, command menu, search dialog, spotlight, quick open, nested pages, deep link","text":"The kit Command inside a top-anchored dialog, opened from a launcher or ⌘K / Ctrl+K, with results from your search, nested pages (Settings ▸ Theme, Go to project ▸ …), a detail pane and deep links. This is copyable source: put the three files below in your app (for example src/components/command-palette/), then edit them freely. They import only public @zsherman/kit/* entries and style with --sui-* tokens in a CSS module, so no StyleX compiler is needed. Vite and Rsbuild handle *.module.css out of the box. Files on this page: each is a fenced block titled with its file name. Copy them into one folder, keeping the names (they import each other by relative path). command-palette.tsx · 273 command-palette-search.tsx · 734 command-palette.module.css · 523 To write them into your app, from its root: It writes src/components/command-palette/ (--dir for a folder other than src/components), with the files it imports from other blocks beside it, keeps files you've edited, and lists the packages to install."},
|
|
1860
1860
|
{"id":"blocks/command-palette.md#use-it","kind":"section","title":"Use it","page":"Command palette (block)","doc":"blocks/command-palette.md","anchor":"use-it","text":"search is called with \"\" when the palette opens (suggestions, recent items), then on typing (debounced 120ms). Throw to show the error state. Results show at once. The palette keeps what search answered, by page and query, across openings (the latest 100 answers). Opening again, going back a page and a query typed before all show their last results at once while a fresh search runs quietly in the background (no spinner), and the list updates if the answer changed. The first page's \"\" search also runs ahead: when the browser is idle, and on the launcher's hover or focus. A page loads while the item that opens it is highlighted. A search already running for the same page and query is joined, not repeated. With nothing to show yet (a page that hasn't loaded), the dialog keeps its size until the results land, and they fade in. Typing never waits. Until search answers a new query, the list narrows at once to the rows already loaded whose label or description has a word starting with each word typed (ignoring case and accents; from the results of the longest start of the query loaded on that page, the empty query's at worst), with those words marked. It's quiet (no spinner), Enter runs the highlighted row, and the answer replaces the rows when it lands, adding any the search found by other means. When no loaded row matches, the list stays as it was until the answer. Motion. The palette is opened often, from the keyboard, so it fades in fast (--sui-duration-fast) in place, with no rise or scale, and the backdrop with it; it leaves with the dialog's exit at the same speed. The.panel rules in the CSS module set this; delete them for the kit dialog's entrance. Under reduced motion nothing moves. Pass prefetch={false} when an empty search is costly (it loads a large index, say): search then runs only for what the palette shows. Results are cached per palette, so keep search pure of per-open state. Loading. The launcher and the dialog are in command-palette.tsx; the search inside (the kit Command, its async loader, the results list) is command-palette-search.tsx, a lazy module that loads when the browser is idle after the page settles, or on the first hover, focus or press of the launcher. A page that shows only the launcher (an app shell's header) doesn't put the Command in its first bundle. ⌘K pressed before the module arrives opens the dialog with a spinner, then focuses the input. Keep the import(\"./command-palette-search\") literal so your bundler splits it.","code":"CommandPalette CommandItem components command-palette search query signal AbortSignal Promise res fetch api encodeURIComponent throw Error Search failed hits Array title page person subtitle json map label group Pages People description onSelect item navigate groupOrder"},
|
|
1861
1861
|
{"id":"blocks/command-palette.md#nested-pages","kind":"section","title":"Nested pages","page":"Command palette (block)","doc":"blocks/command-palette.md","anchor":"nested-pages","text":"An item with page opens that page instead of running. The same search answers for every page: its second argument says which (page is null on the first page; pages is the whole stack). pages on the palette gives each page its title (in the header's trail) and placeholder. The header (the kit CommandHeader) shows a back button and the trail (\"Home › Settings › Theme\"), set off from the field by a hairline; a step jumps back to its page. Backspace in the empty field and Escape go back too, and each page keeps the search typed there. A page's results load like the first page's (loading rows, the error row, Enter queued while loading); the last page's results never show on the new one. With nothing to show yet, the list holds the last page's height and, past 150ms, fills with loading rows in the shape of the rows coming (the field's spinner is for a search refreshing rows already shown). The meeting-app example loads its people and meetings slowly with prefetch={false}, to show them. A page seen before, or loaded ahead while its item was highlighted, opens on its results. Going back highlights the item that opened the page. Items that open a page end in a chevron, mirrored in right-to-left text. Pages can nest as deep as you like: the gallery's meeting-app example goes four levels (Home › Settings › Audio & video › Microphone), with people and past meetings as pages too. With local commands, answer at once and pass debounce={0}; on the first page it searches every level and puts each result's path in its description (\"Settings / Audio & video\"), matching only labels and keywords there, since a match in a description the path replaces wouldn't show.","code":"pages settings title Settings placeholder Search theme Theme Choose projects project detail search query signal page CommandPaletteSearchContext Promise CommandItem filter settingsItems Light Dark System map name label api toProjectItem results toItem go-project group Actions Pages CommandPalette onSelect run"},
|
|
1862
1862
|
{"id":"blocks/command-palette.md#detail-pane","kind":"section","title":"Detail pane","page":"Command palette (block)","doc":"blocks/command-palette.md","anchor":"detail-pane","text":"Give items a detail (a function returning JSX) and a pane beside the list shows the highlighted item's detail, when the palette is at least 38rem wide (it is 40rem). The pane shares the palette's width, so moving between pages never resizes the dialog (.panel in the CSS module keeps the kit dialog from widening for it), and the list keeps its full height (--command-list-height) beside the pane, so results land and narrow without the dialog changing size. Set detail: true on a page whose items have details, so the pane comes with the page, not a moment later when its results land; on other pages the pane shows once a result has a detail. In a narrower window the pane is hidden, so keep what people need to choose in the label and description. It is a region named \"Details\", not a live one.","code":"toProjectItem Project CommandItem label name description summary detail ProjectSummary project"},
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zsherman/kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Accessible Solid 2 components styled with StyleX. Precompiled CSS, themeable with CSS custom properties.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/zsherman/solid-ui.git",
|
|
9
|
+
"directory": "packages/kit"
|
|
10
|
+
},
|
|
6
11
|
"bin": {
|
|
7
12
|
"solid-ui-kit": "./dist/cli/docs.mjs"
|
|
8
13
|
},
|