@k2b/ui 0.56.0 → 0.57.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.
- package/dist/browser/actions/SplitButton.js +5 -7
- package/dist/browser/actions/SplitButton.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +6 -5
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/intl/messages.js +1 -1
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/FloatingWindow.js +416 -122
- package/dist/browser/layout/FloatingWindow.js.map +1 -1
- package/dist/browser/layout/PersonPopover.js +406 -0
- package/dist/browser/layout/PersonPopover.js.map +1 -0
- package/dist/browser/layout/floating-window-geometry.js +58 -2
- package/dist/browser/layout/floating-window-geometry.js.map +1 -1
- package/dist/browser/layout/floating-window-messages.js +12 -0
- package/dist/browser/layout/floating-window-messages.js.map +1 -1
- package/dist/browser/layout/index.js +1 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/ssr/actions/SplitButton.js +5 -7
- package/dist/ssr/actions/SplitButton.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +6 -5
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/intl/messages.js +1 -1
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/FloatingWindow.js +286 -73
- package/dist/ssr/layout/FloatingWindow.js.map +1 -1
- package/dist/ssr/layout/PersonPopover.js +248 -0
- package/dist/ssr/layout/PersonPopover.js.map +1 -0
- package/dist/ssr/layout/floating-window-geometry.js +58 -2
- package/dist/ssr/layout/floating-window-geometry.js.map +1 -1
- package/dist/ssr/layout/floating-window-messages.js +12 -0
- package/dist/ssr/layout/floating-window-messages.js.map +1 -1
- package/dist/ssr/layout/index.js +1 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/SplitButton.d.ts +2 -0
- package/dist/types/layout/FloatingWindow.d.ts +29 -1
- package/dist/types/layout/PersonPopover.d.ts +70 -0
- package/dist/types/layout/floating-window-geometry.d.ts +20 -3
- package/dist/types/layout/floating-window-messages.d.ts +6 -0
- package/dist/types/layout/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -2,6 +2,8 @@ import { type JSX } from "solid-js";
|
|
|
2
2
|
import { type ButtonProps } from "./Button";
|
|
3
3
|
import { type DropdownItem, type DropdownPosition, type DropdownProps } from "./Dropdown";
|
|
4
4
|
export type SplitButtonProps = Omit<ButtonProps, "align"> & {
|
|
5
|
+
/** Classes for the whole control, so host tone tokens such as `--k2b-action-solid` reach both segments. */
|
|
6
|
+
class?: string;
|
|
5
7
|
/** Actions shown from the secondary menu trigger. */
|
|
6
8
|
items: readonly DropdownItem[];
|
|
7
9
|
/** Optional selection menu in place of the primary immediate action. */
|
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
import { type JSX } from "solid-js";
|
|
2
|
-
|
|
2
|
+
import { type FloatingWindowRect } from "./floating-window-geometry";
|
|
3
|
+
export { type FloatingWindowBounds, type FloatingWindowRect, fitFloatingWindowRect } from "./floating-window-geometry";
|
|
4
|
+
/** `minimized` is a bar at the bottom edge with the content kept alive; `maximized` covers the area above a scrim. */
|
|
5
|
+
export type FloatingWindowState = "normal" | "minimized" | "maximized";
|
|
3
6
|
export type FloatingWindowProps = {
|
|
7
|
+
/** One line in the header; a long title ends with an ellipsis and shows in full on hover. */
|
|
4
8
|
title: string;
|
|
5
9
|
icon?: string;
|
|
10
|
+
/** A short status right after the title, such as "Saved". On a phone it sits below the title. */
|
|
11
|
+
status?: JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Actions of the content in the header, such as Send, after the title and before the window controls. A minimized bar
|
|
14
|
+
* hides them. On a phone sheet they stand at the end of the header, within reach above the keyboard.
|
|
15
|
+
*/
|
|
16
|
+
actions?: JSX.Element;
|
|
6
17
|
children: JSX.Element;
|
|
7
18
|
onClose: () => void;
|
|
19
|
+
/** The current state when the application owns it; pair it with `onStateChange`. */
|
|
20
|
+
state?: FloatingWindowState;
|
|
21
|
+
/** The state the window opens in when the application does not own it. Defaults to `normal`. */
|
|
22
|
+
defaultState?: FloatingWindowState;
|
|
23
|
+
/** Called when the person minimizes, maximizes, or restores the window. */
|
|
24
|
+
onStateChange?: (state: FloatingWindowState) => void;
|
|
25
|
+
/** Where the window stands, in viewport pixels, such as a remembered place. Without it the window places itself. */
|
|
26
|
+
rect?: FloatingWindowRect;
|
|
27
|
+
/** Called when the person moved or resized the window, with its new place. */
|
|
28
|
+
onRectChange?: (rect: FloatingWindowRect) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Where a window without `rect` opens: `center` (default) in the middle of the area, or `dock` at the bottom end, in
|
|
31
|
+
* one row with minimized windows, until the person moves it.
|
|
32
|
+
*/
|
|
33
|
+
placement?: "center" | "dock";
|
|
34
|
+
/** The element whose box the window lives in: it stays inside it, docks at its bottom, and maximizes over it. Defaults to the viewport. */
|
|
35
|
+
area?: () => HTMLElement | null | undefined;
|
|
8
36
|
initialWidth?: number;
|
|
9
37
|
initialHeight?: number;
|
|
10
38
|
minWidth?: number;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type PersonPopoverPhone = {
|
|
3
|
+
number: string /** Such as "Office" or "Mobile". */;
|
|
4
|
+
label?: string;
|
|
5
|
+
};
|
|
6
|
+
/** A row of the list section, such as an earlier conversation: a link or a button. */
|
|
7
|
+
export type PersonPopoverLink = {
|
|
8
|
+
label: string /** A quiet second line, such as a date and a count. */;
|
|
9
|
+
meta?: string;
|
|
10
|
+
href?: string;
|
|
11
|
+
onSelect?: () => void;
|
|
12
|
+
};
|
|
13
|
+
/** A menu-like row at the end of the card. Choosing it closes the card. */
|
|
14
|
+
export type PersonPopoverAction = {
|
|
15
|
+
label: string;
|
|
16
|
+
icon?: string;
|
|
17
|
+
href?: string;
|
|
18
|
+
onSelect?: () => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
};
|
|
21
|
+
/** A quiet line in place of what could not load, with a retry. */
|
|
22
|
+
export type PersonPopoverError = {
|
|
23
|
+
message: string;
|
|
24
|
+
onRetry: () => void /** Defaults to the shared "Retry". */;
|
|
25
|
+
retryLabel?: string;
|
|
26
|
+
};
|
|
27
|
+
export type PersonPopoverList = {
|
|
28
|
+
title: string;
|
|
29
|
+
items?: readonly PersonPopoverLink[];
|
|
30
|
+
/** Two placeholder rows in the size of real rows while the list loads. */
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
error?: PersonPopoverError;
|
|
33
|
+
/** A quiet line when the list is empty; without it an empty list hides the section. */
|
|
34
|
+
empty?: string;
|
|
35
|
+
};
|
|
36
|
+
export type PersonPopoverProps = {
|
|
37
|
+
/** The control the card belongs to, such as a sender name. The card is open while this is set. */
|
|
38
|
+
anchor: HTMLElement | null | undefined;
|
|
39
|
+
onClose: () => void;
|
|
40
|
+
/** The card's accessible name; defaults to the name or the address. */
|
|
41
|
+
label?: string;
|
|
42
|
+
/** The person's name. Without it the address heads the card. */
|
|
43
|
+
name?: string;
|
|
44
|
+
/** An image URL for the avatar; without it the avatar shows initials. */
|
|
45
|
+
avatar?: string | null;
|
|
46
|
+
/** One secondary line, such as company and role. */
|
|
47
|
+
detail?: string;
|
|
48
|
+
/** Shown with a copy button. */
|
|
49
|
+
email?: string;
|
|
50
|
+
/** Each number is a `tel:` link with an optional label. */
|
|
51
|
+
phones?: readonly PersonPopoverPhone[];
|
|
52
|
+
/** While the person's details load, placeholders stand where the detail line and the contact rows will be. */
|
|
53
|
+
loading?: boolean;
|
|
54
|
+
/** The details could not load: a quiet line with a retry stands in their place. */
|
|
55
|
+
error?: PersonPopoverError;
|
|
56
|
+
/** An optional section with a heading and link rows, such as earlier conversations. */
|
|
57
|
+
list?: PersonPopoverList;
|
|
58
|
+
actions?: readonly PersonPopoverAction[];
|
|
59
|
+
align?: "start" | "end";
|
|
60
|
+
side?: "below" | "above";
|
|
61
|
+
/** Desktop width, such as `22rem`. On a phone the card is a bottom sheet. */
|
|
62
|
+
width?: string;
|
|
63
|
+
class?: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* A card about one person, anchored to the control that names them: avatar, name, one secondary line, contact rows,
|
|
67
|
+
* an optional list such as earlier conversations, and actions. The application supplies every text and decides what
|
|
68
|
+
* the actions do; the card owns layout, loading, partial and error states, and keyboard behaviour.
|
|
69
|
+
*/
|
|
70
|
+
export declare function PersonPopover(props: PersonPopoverProps): JSX.Element;
|
|
@@ -4,8 +4,25 @@ export type FloatingWindowRect = {
|
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
/** The area a window lives in, in viewport pixels. Without `x` and `y` it starts at the top left corner. */
|
|
8
|
+
export type FloatingWindowBounds = {
|
|
9
|
+
x?: number;
|
|
10
|
+
y?: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
export type FloatingWindowSize = {
|
|
9
15
|
width: number;
|
|
10
16
|
height: number;
|
|
11
|
-
}
|
|
17
|
+
};
|
|
18
|
+
export declare const FLOATING_WINDOW_VIEWPORT_GAP = 16;
|
|
19
|
+
/** A minimized window is a bar as tall as the window header. */
|
|
20
|
+
export declare const FLOATING_WINDOW_BAR: FloatingWindowSize;
|
|
21
|
+
export declare const fitFloatingWindowRect: (rect: FloatingWindowRect, minWidth: number, minHeight: number, viewport: FloatingWindowBounds) => FloatingWindowRect;
|
|
22
|
+
/** A maximized window covers almost the whole area. */
|
|
23
|
+
export declare const maximizedFloatingWindowRect: (bounds: FloatingWindowBounds) => FloatingWindowRect;
|
|
24
|
+
/**
|
|
25
|
+
* Lines docked windows up along the bottom edge of the area, the first at the end. A row that is full continues
|
|
26
|
+
* above the previous one, so no two docked windows overlap. A window wider than the area shrinks to fit it.
|
|
27
|
+
*/
|
|
28
|
+
export declare const layoutFloatingWindowDock: (sizes: readonly FloatingWindowSize[], bounds: FloatingWindowBounds) => FloatingWindowRect[];
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
declare const floatingWindowMessages: import("@k2b/stdlib").Catalog<{
|
|
2
2
|
closeWindow: string;
|
|
3
|
+
minimizeWindow: string;
|
|
4
|
+
maximizeWindow: string;
|
|
5
|
+
restoreSize: string;
|
|
6
|
+
restoreWindow: ({ title }: {
|
|
7
|
+
title: string;
|
|
8
|
+
}) => string;
|
|
3
9
|
moveWindow: ({ title }: {
|
|
4
10
|
title: string;
|
|
5
11
|
}) => string;
|
|
@@ -20,8 +20,8 @@ export { DetailAccess, DetailLinks, DetailPresence, DetailPresenceSlot, DetailPr
|
|
|
20
20
|
export { DETAILS_ICON, DetailsToggle, type DetailsToggleProps } from "./DetailsToggle";
|
|
21
21
|
export type { DiscussionComposerProps, DiscussionItemProps, DiscussionListProps, DiscussionProps } from "./Discussion";
|
|
22
22
|
export { default as Discussion } from "./Discussion";
|
|
23
|
-
export type { FloatingWindowClose, FloatingWindowProps, OpenFloatingWindowOptions, } from "./FloatingWindow";
|
|
24
|
-
export { default as FloatingWindow, type FloatingWindowRect, fitFloatingWindowRect, openFloatingWindow, } from "./FloatingWindow";
|
|
23
|
+
export type { FloatingWindowClose, FloatingWindowProps, FloatingWindowState, OpenFloatingWindowOptions, } from "./FloatingWindow";
|
|
24
|
+
export { default as FloatingWindow, type FloatingWindowBounds, type FloatingWindowRect, fitFloatingWindowRect, openFloatingWindow, } from "./FloatingWindow";
|
|
25
25
|
export type { MobileShellHeaderProps, MobileShellProps, MobileShellSidebarItem, MobileShellSidebarProps } from "./MobileShell";
|
|
26
26
|
export { default as MobileShell, observeMobileShell } from "./MobileShell";
|
|
27
27
|
export { default as Navigation, type NavigationProps } from "./Navigation";
|
|
@@ -34,6 +34,7 @@ export type { PanelHeaderProps } from "./PanelHeader";
|
|
|
34
34
|
export { PanelHeader } from "./PanelHeader";
|
|
35
35
|
export type { PanesItem, PanesProps } from "./Panes";
|
|
36
36
|
export { default as Panes } from "./Panes";
|
|
37
|
+
export { PersonPopover, type PersonPopoverAction, type PersonPopoverError, type PersonPopoverLink, type PersonPopoverList, type PersonPopoverPhone, type PersonPopoverProps, } from "./PersonPopover";
|
|
37
38
|
export type { PullToRefreshProps, PullToRefreshState } from "./PullToRefresh";
|
|
38
39
|
export { default as PullToRefresh } from "./PullToRefresh";
|
|
39
40
|
export { installPageTitleController } from "./page-title-controller";
|