@k2b/ui 0.48.0 → 0.49.0

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.
Files changed (46) hide show
  1. package/dist/browser/actions/CopyButton.js +26 -18
  2. package/dist/browser/actions/CopyButton.js.map +1 -1
  3. package/dist/browser/feedback/prompt-confirm.js +7 -4
  4. package/dist/browser/feedback/prompt-confirm.js.map +1 -1
  5. package/dist/browser/feedback/prompts.js +3 -3
  6. package/dist/browser/feedback/prompts.js.map +1 -1
  7. package/dist/browser/inputs/NumberInput.js +17 -5
  8. package/dist/browser/inputs/NumberInput.js.map +1 -1
  9. package/dist/browser/layout/AppWorkspace.js +574 -522
  10. package/dist/browser/layout/AppWorkspace.js.map +1 -1
  11. package/dist/browser/layout/MobileShell.js +26 -0
  12. package/dist/browser/layout/MobileShell.js.map +1 -1
  13. package/dist/browser/layout/index.js +1 -0
  14. package/dist/browser/layout/index.js.map +1 -1
  15. package/dist/browser/layout/sheet-handle.js +155 -0
  16. package/dist/browser/layout/sheet-handle.js.map +1 -0
  17. package/dist/browser/surfaces/NoticeCard.js +48 -29
  18. package/dist/browser/surfaces/NoticeCard.js.map +1 -1
  19. package/dist/ssr/actions/CopyButton.js +13 -8
  20. package/dist/ssr/actions/CopyButton.js.map +1 -1
  21. package/dist/ssr/feedback/prompt-confirm.js +7 -4
  22. package/dist/ssr/feedback/prompt-confirm.js.map +1 -1
  23. package/dist/ssr/feedback/prompts.js +3 -3
  24. package/dist/ssr/feedback/prompts.js.map +1 -1
  25. package/dist/ssr/inputs/NumberInput.js +17 -5
  26. package/dist/ssr/inputs/NumberInput.js.map +1 -1
  27. package/dist/ssr/layout/AppWorkspace.js +152 -114
  28. package/dist/ssr/layout/AppWorkspace.js.map +1 -1
  29. package/dist/ssr/layout/MobileShell.js +26 -0
  30. package/dist/ssr/layout/MobileShell.js.map +1 -1
  31. package/dist/ssr/layout/index.js +1 -0
  32. package/dist/ssr/layout/index.js.map +1 -1
  33. package/dist/ssr/layout/sheet-handle.js +155 -0
  34. package/dist/ssr/layout/sheet-handle.js.map +1 -0
  35. package/dist/ssr/surfaces/NoticeCard.js +25 -10
  36. package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/dist/types/feedback/prompt-confirm.d.ts +3 -1
  39. package/dist/types/feedback/prompts.d.ts +2 -2
  40. package/dist/types/inputs/NumberInput.d.ts +1 -1
  41. package/dist/types/layout/AppWorkspace.d.ts +16 -1
  42. package/dist/types/layout/MobileShell.d.ts +5 -0
  43. package/dist/types/layout/index.d.ts +2 -1
  44. package/dist/types/layout/sheet-handle.d.ts +21 -0
  45. package/dist/types/surfaces/NoticeCard.d.ts +5 -2
  46. package/package.json +1 -1
@@ -2,8 +2,10 @@ import { type JSX } from "solid-js";
2
2
  import { type DialogTone } from "./dialog-tone";
3
3
  import type { ConfirmOptions, DialogOptions } from "./prompts";
4
4
  export type PromptContent = string | HTMLElement | JSX.Element;
5
- /** A prompt's `variant` is its tone too: a success or danger prompt carries the dialog tone of that name. */
5
+ /** A prompt's `variant` is its tone too: a success, warning or danger prompt carries the dialog tone of that name. */
6
6
  export declare const promptTone: (variant: DialogOptions["variant"]) => DialogTone | undefined;
7
+ /** A warning asks for care, not for a destructive act: its confirm button stays primary. */
8
+ export declare const promptButtonVariant: (variant: DialogOptions["variant"]) => "danger" | "primary" | "success";
7
9
  export declare const DialogHeader: (props: {
8
10
  close: () => void;
9
11
  title?: string;
@@ -9,7 +9,7 @@ export interface DialogOptions {
9
9
  icon?: string;
10
10
  confirmText?: string;
11
11
  cancelText?: string | false;
12
- variant?: "danger" | "primary" | "success";
12
+ variant?: "danger" | "primary" | "success" | "warning";
13
13
  /** `full` fills the available viewport and becomes edge-to-edge on narrow screens. */
14
14
  size?: "small" | "medium" | "large" | "wide" | "full";
15
15
  surface?: "default" | "bare";
@@ -143,7 +143,7 @@ type PromptFormOptions<T extends Record<string, FieldSchema>> = {
143
143
  fields: T;
144
144
  confirmText?: string;
145
145
  cancelText?: string | false;
146
- variant?: "danger" | "primary" | "success";
146
+ variant?: "danger" | "primary" | "success" | "warning";
147
147
  size?: DialogOptions["size"];
148
148
  cancelBehavior?: DialogOptions["cancelBehavior"];
149
149
  };
@@ -6,7 +6,7 @@ export type NumberInputProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "
6
6
  min?: number;
7
7
  /** Stepper increment and commit grid; defaults to `1`. A fractional step also sets the default `decimalPlaces`. */
8
8
  step?: number;
9
- /** Accepted fraction digits. Defaults to the fraction digits of `step` (`0.01` → `2`, `1` → `0`); an explicit value wins. */
9
+ /** Accepted and displayed fraction digits. Defaults to the fraction digits of `step` (`0.01` → `2`, `1` → `0`); an explicit value wins. */
10
10
  decimalPlaces?: number;
11
11
  allowNegative?: boolean;
12
12
  clearable?: boolean;
@@ -2,6 +2,7 @@ import { type AppWorkspaceSidebarItemStatusProps } from "./AppWorkspaceSidebarIt
2
2
  export type { AppWorkspaceSidebarItemStatusProps } from "./AppWorkspaceSidebarItemStatus";
3
3
  import { type LinkNavigateEvent, type NavigationScrollMode } from "@k2b/ssr/nav";
4
4
  import { type JSX } from "solid-js";
5
+ import { type DropdownItem, type DropdownSearch } from "../actions/Dropdown";
5
6
  import { type AppWorkspaceLayoutState } from "./app-workspace-state";
6
7
  import { type AppWorkspaceWidthShare } from "./app-workspace-width";
7
8
  import type { ScrollAreaProps } from "./ScrollArea";
@@ -118,6 +119,12 @@ export type AppWorkspaceMainPaneProps = {
118
119
  };
119
120
  /** Controls at the end of the level head. */
120
121
  actions?: JSX.Element;
122
+ /**
123
+ * Levels mode: the title opens a menu of places to switch to, such as the person's work and each Space; on a phone
124
+ * it opens as a sheet. The title stays the level's heading and gains a chevron; the server HTML already says that
125
+ * it opens a menu.
126
+ */
127
+ switcher?: AppWorkspaceLevelSwitcher;
121
128
  /**
122
129
  * Levels mode: `"page"` marks the level that holds the page itself, such as a settings form or the list of an
123
130
  * area, rather than a column that leads there or a detail beside it. Its title takes the page step of the type
@@ -141,6 +148,13 @@ export type AppWorkspaceMainPaneProps = {
141
148
  scrollFade?: boolean;
142
149
  children: JSX.Element;
143
150
  };
151
+ /** The places a level title switches between; `label` names the menu, such as "Switch Space". */
152
+ export type AppWorkspaceLevelSwitcher = {
153
+ label: string;
154
+ items: readonly DropdownItem[];
155
+ /** A search field above the places, for a long list. */
156
+ search?: DropdownSearch;
157
+ };
144
158
  export type AppWorkspaceDetailWidth = "sm" | "md" | "lg" | "xl";
145
159
  export type AppWorkspaceDetailProps = {
146
160
  children: JSX.Element;
@@ -295,7 +309,8 @@ export type AppWorkspaceSidebarItemProps = {
295
309
  /**
296
310
  * Marks the current page (`aria-current="page"`). On a page deeper than the
297
311
  * sidebar lists, pass `"ancestor"` for the item that contains it: it keeps
298
- * the highlight, and the page keeps its back link.
312
+ * the highlight and, while the sidebar shows, is the way up, so the head
313
+ * drops its back link as beside the current page.
299
314
  */
300
315
  active?: boolean | "ancestor";
301
316
  activeClass?: string;
@@ -43,6 +43,11 @@ export type MobileShellHeaderProps = {
43
43
  /** Controls after the title, such as a menu. */
44
44
  actions?: JSX.Element;
45
45
  };
46
+ /**
47
+ * The height the on-screen keyboard covers at the bottom of the layout viewport, from the visual viewport; zero
48
+ * without a keyboard or without `visualViewport`.
49
+ */
50
+ export declare const keyboardInset: (view: Pick<Window, "innerHeight" | "visualViewport">) => number;
46
51
  /**
47
52
  * Marks the shell around `from` as showing a screen of its own, or not, after the first paint; the server renders
48
53
  * the first state with the `screen` prop. Does nothing outside a shell.
@@ -1,7 +1,7 @@
1
1
  export { AnchoredPopover, type AnchoredPopoverProps } from "./AnchoredPopover";
2
2
  export type { AppOverviewCardsProps, AppOverviewEmptyStateProps, AppOverviewPanelProps, AppOverviewProps, } from "./AppOverview";
3
3
  export { default as AppOverview } from "./AppOverview";
4
- export type { AppWorkspaceBottomDrawerHeight, AppWorkspaceBottomDrawerProps, AppWorkspaceContentProps, AppWorkspaceDetailProps, AppWorkspaceDetailWidth, AppWorkspaceHeadProps, AppWorkspaceMainPaneProps, AppWorkspaceMainProps, AppWorkspaceNavTreeItemProps, AppWorkspaceNavTreeMove, AppWorkspaceNavTreeProps, AppWorkspaceProps, AppWorkspaceSidebarAccessoryVisibility, AppWorkspaceSidebarBodyProps, AppWorkspaceSidebarIconActionProps, AppWorkspaceSidebarIconActionTone, AppWorkspaceSidebarIconGridProps, AppWorkspaceSidebarItemActionProps, AppWorkspaceSidebarItemActionsProps, AppWorkspaceSidebarItemIconProps, AppWorkspaceSidebarItemLabelProps, AppWorkspaceSidebarItemMetaProps, AppWorkspaceSidebarItemProps, AppWorkspaceSidebarItemStatusProps, AppWorkspaceSidebarItemTone, AppWorkspaceSidebarProps, AppWorkspaceSidebarSectionProps, AppWorkspaceSidebarVisibility, AppWorkspaceWidthShare, } from "./AppWorkspace";
4
+ export type { AppWorkspaceBottomDrawerHeight, AppWorkspaceBottomDrawerProps, AppWorkspaceContentProps, AppWorkspaceDetailProps, AppWorkspaceDetailWidth, AppWorkspaceHeadProps, AppWorkspaceLevelSwitcher, AppWorkspaceMainPaneProps, AppWorkspaceMainProps, AppWorkspaceNavTreeItemProps, AppWorkspaceNavTreeMove, AppWorkspaceNavTreeProps, AppWorkspaceProps, AppWorkspaceSidebarAccessoryVisibility, AppWorkspaceSidebarBodyProps, AppWorkspaceSidebarIconActionProps, AppWorkspaceSidebarIconActionTone, AppWorkspaceSidebarIconGridProps, AppWorkspaceSidebarItemActionProps, AppWorkspaceSidebarItemActionsProps, AppWorkspaceSidebarItemIconProps, AppWorkspaceSidebarItemLabelProps, AppWorkspaceSidebarItemMetaProps, AppWorkspaceSidebarItemProps, AppWorkspaceSidebarItemStatusProps, AppWorkspaceSidebarItemTone, AppWorkspaceSidebarProps, AppWorkspaceSidebarSectionProps, AppWorkspaceSidebarVisibility, AppWorkspaceWidthShare, } from "./AppWorkspace";
5
5
  export { appWorkspaceDetailElementId, default as AppWorkspace } from "./AppWorkspace";
6
6
  export { AppWorkspaceSidebarItemStatus } from "./AppWorkspaceSidebarItemStatus";
7
7
  export { watchAppHostWidth } from "./app-host-width";
@@ -50,6 +50,7 @@ export type { SettingsModalFooterProps, SettingsModalGroupProps, SettingsModalPr
50
50
  export { default as SettingsModal } from "./SettingsModal";
51
51
  export { APP_WORKSPACE_SWITCHER_SEARCH_FROM, type AppWorkspaceSidebarSwitcherProps, type AppWorkspaceSwitcherAction, type AppWorkspaceSwitcherOption, } from "./SidebarSwitcher";
52
52
  export { measureScrollFade } from "./scroll-fade";
53
+ export { attachSheetHandle, type SheetHandleOptions } from "./sheet-handle";
53
54
  export type { TabBarItem, TabBarProps } from "./TabBar";
54
55
  export { default as TabBar } from "./TabBar";
55
56
  export type { TableOfContentsItem, TableOfContentsProps } from "./TableOfContents";
@@ -0,0 +1,21 @@
1
+ export type SheetHandleOptions = {
2
+ /** The sheet the handle sits on. It carries the current detent in `data-sheet-detent`. */
3
+ sheet: HTMLElement;
4
+ /** The detents' names, lowest first. The stylesheet gives each `[data-sheet-detent="…"]` its height. */
5
+ detents: readonly string[];
6
+ /** The detent the stylesheet draws while the sheet has no `data-sheet-detent`, such as in the server's markup. */
7
+ initial: string;
8
+ /** After a drag or a press moved the sheet to another detent, for example to rename the handle. */
9
+ onChange?: (detent: string) => void;
10
+ /** Without it, a drag stops at the lowest detent; with it, a drag well below that detent asks to close. */
11
+ onDismiss?: () => void;
12
+ };
13
+ /**
14
+ * Lets a sheet's handle drag it between detents. The handle stays a button: a press, by pointer, Enter or Space,
15
+ * moves the sheet to the next detent up, and from the highest back to the lowest. A drag follows the pointer with an
16
+ * inline height and, on release, snaps to the detent nearest to where the pointer's speed would carry it. The snap
17
+ * animates with the sheet's own height transition, so reduced motion makes it instant. The stylesheet owns every
18
+ * resting height, which keeps the server's first frame and a rotation correct without script; the handle measures
19
+ * them when a drag starts.
20
+ */
21
+ export declare function attachSheetHandle(handle: HTMLElement, options: SheetHandleOptions): () => void;
@@ -14,8 +14,11 @@ type NoticeCardContentProps = {
14
14
  };
15
15
  export type NoticeCardProps = Omit<JSX.HTMLAttributes<HTMLElement>, "children" | "class" | "title"> & NoticeCardContentProps & {
16
16
  tone?: NoticeTone;
17
- /** A Tabler icon class. Turns the notice into a compact status line whose icon and text take the tone colour. */
18
- icon?: string;
17
+ /**
18
+ * A Tabler icon class. Turns the notice into a compact status line whose icon and text take the tone colour. `true`
19
+ * takes the tone's own icon, the one a toned dialog shows, and names the tone for screen readers.
20
+ */
21
+ icon?: string | true;
19
22
  class?: string;
20
23
  bodyClass?: string;
21
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k2b/ui",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "Production-ready components for SolidJS applications.",
5
5
  "repository": {
6
6
  "type": "git",