@k2b/ui 0.10.0 → 0.12.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/content/FileView.js +203 -136
- package/dist/browser/content/FileView.js.map +1 -1
- package/dist/browser/content/markdown-title.js +52 -0
- package/dist/browser/content/markdown-title.js.map +1 -0
- package/dist/browser/feedback/HoverPreview.js +6 -6
- package/dist/browser/feedback/HoverPreview.js.map +1 -1
- package/dist/browser/feedback/index.js.map +1 -1
- package/dist/browser/feedback/prompts.js +18 -19
- package/dist/browser/feedback/prompts.js.map +1 -1
- package/dist/browser/feedback/toast.js +363 -122
- package/dist/browser/feedback/toast.js.map +1 -1
- package/dist/browser/inputs/DatePicker.js +263 -222
- package/dist/browser/inputs/DatePicker.js.map +1 -1
- package/dist/browser/inputs/MultiSelectInput.js +139 -105
- package/dist/browser/inputs/MultiSelectInput.js.map +1 -1
- package/dist/browser/inputs/NumberInput.js +209 -122
- package/dist/browser/inputs/NumberInput.js.map +1 -1
- package/dist/browser/inputs/Select.js +184 -92
- package/dist/browser/inputs/Select.js.map +1 -1
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/intl/messages.js +4 -0
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +105 -77
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +2 -1
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/Navigation.js +1 -0
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +1 -0
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/browser/layout/Settings.js +2 -2
- package/dist/browser/layout/Settings.js.map +1 -1
- package/dist/browser/layout/app-workspace-controller.js +30 -2
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/content/FileView.js +141 -81
- package/dist/ssr/content/FileView.js.map +1 -1
- package/dist/ssr/content/markdown-title.js +52 -0
- package/dist/ssr/content/markdown-title.js.map +1 -0
- package/dist/ssr/feedback/HoverPreview.js +6 -6
- package/dist/ssr/feedback/HoverPreview.js.map +1 -1
- package/dist/ssr/feedback/index.js.map +1 -1
- package/dist/ssr/feedback/prompts.js +1 -1
- package/dist/ssr/feedback/prompts.js.map +1 -1
- package/dist/ssr/feedback/toast.js +363 -122
- package/dist/ssr/feedback/toast.js.map +1 -1
- package/dist/ssr/inputs/DatePicker.js +78 -52
- package/dist/ssr/inputs/DatePicker.js.map +1 -1
- package/dist/ssr/inputs/MultiSelectInput.js +52 -32
- package/dist/ssr/inputs/MultiSelectInput.js.map +1 -1
- package/dist/ssr/inputs/NumberInput.js +93 -40
- package/dist/ssr/inputs/NumberInput.js.map +1 -1
- package/dist/ssr/inputs/Select.js +108 -29
- package/dist/ssr/inputs/Select.js.map +1 -1
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/intl/messages.js +4 -0
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +84 -66
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +2 -1
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/Navigation.js +1 -0
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +1 -0
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/layout/Settings.js +2 -2
- package/dist/ssr/layout/Settings.js.map +1 -1
- package/dist/ssr/layout/app-workspace-controller.js +30 -2
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/content/FileView.d.ts +11 -1
- package/dist/types/content/markdown-title.d.ts +9 -0
- package/dist/types/feedback/index.d.ts +1 -1
- package/dist/types/feedback/toast.d.ts +7 -0
- package/dist/types/inputs/DatePicker.d.ts +11 -2
- package/dist/types/inputs/MultiSelectInput.d.ts +5 -1
- package/dist/types/inputs/NumberInput.d.ts +14 -0
- package/dist/types/inputs/Select.d.ts +10 -0
- package/dist/types/inputs/index.d.ts +1 -1
- package/dist/types/intl/messages.d.ts +2 -0
- package/dist/types/layout/AppWorkspace.d.ts +14 -0
- package/dist/types/layout/Settings.d.ts +2 -2
- package/dist/types/layout/app-workspace-controller.d.ts +5 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* without it every renderer is read-only. IDE-style chrome: editors reuse
|
|
5
5
|
* the markdown editor's surface (toolbar with an in-toolbar save, Ctrl/Cmd+S),
|
|
6
6
|
* previews are quiet paper panels with icon-only actions overlaid top-right.
|
|
7
|
+
* A plain preview drops the panel and sits on its host's surface instead.
|
|
7
8
|
* Custom renderers are passed per instance, which keeps SSR requests and
|
|
8
9
|
* independently mounted applications isolated.
|
|
9
10
|
*/
|
|
@@ -17,8 +18,17 @@ export type FileViewContent = {
|
|
|
17
18
|
mediaType: string;
|
|
18
19
|
};
|
|
19
20
|
export type FileViewProps = {
|
|
20
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Plain previews inherit the surrounding surface without a frame or inset padding. They keep their natural height,
|
|
23
|
+
* so the host scrolls them and owns the actions around them; a host that stretches one gets its scrolling back.
|
|
24
|
+
*/
|
|
21
25
|
variant?: "default" | "plain";
|
|
26
|
+
/**
|
|
27
|
+
* Lifts a leading Markdown level-one heading into the host, for example a dialog title. Reports its plain text and
|
|
28
|
+
* leaves that heading out of the preview, or reports null when the shown file has none, the heading holds a link or
|
|
29
|
+
* image or is the whole document, or the file fails to load.
|
|
30
|
+
*/
|
|
31
|
+
onDocumentTitle?: (title: string | null) => void;
|
|
22
32
|
/** Read-only excerpt limit; omitted renders the complete preview. */
|
|
23
33
|
previewLines?: number;
|
|
24
34
|
onExpandPreview?: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The document title of Markdown that starts with a level-one heading: its plain text, and the Markdown after it.
|
|
3
|
+
* Null when the first block is anything else, the heading has no text or holds a link or image, or nothing follows
|
|
4
|
+
* it; the heading then stays in the document.
|
|
5
|
+
*/
|
|
6
|
+
export declare function leadingMarkdownTitle(markdown: string): {
|
|
7
|
+
title: string;
|
|
8
|
+
body: string;
|
|
9
|
+
} | null;
|
|
@@ -8,5 +8,5 @@ export type { ConfirmOptions, DialogOptions, FieldSchema, PromptFieldBase, Promp
|
|
|
8
8
|
export { createFormState, DialogHeader, prompts } from "./prompts";
|
|
9
9
|
export type { TooltipAnchorProps, TooltipPlacement, TooltipProps, TooltipTriggerProps } from "./Tooltip";
|
|
10
10
|
export { Tooltip } from "./Tooltip";
|
|
11
|
-
export type { ToastAction, ToastFn, ToastHandle, ToastOptions, ToastVariant } from "./toast";
|
|
11
|
+
export type { ToastAction, ToastFn, ToastHandle, ToastOptions, ToastSlot, ToastVariant } from "./toast";
|
|
12
12
|
export { isPointInsideToast, toast } from "./toast";
|
|
@@ -8,8 +8,10 @@ export type ToastAction = {
|
|
|
8
8
|
});
|
|
9
9
|
export type ToastOptions = {
|
|
10
10
|
variant?: ToastVariant;
|
|
11
|
+
/** Milliseconds until the toast closes; `0` keeps it until it is closed. Omit it for the default by variant, length, and action. */
|
|
11
12
|
duration?: number;
|
|
12
13
|
iconClass?: string;
|
|
14
|
+
/** A short line of context above the message. There is no default title. */
|
|
13
15
|
title?: string;
|
|
14
16
|
action?: ToastAction | null;
|
|
15
17
|
/** Fraction from 0 to 1, or an indeterminate activity indicator. null removes it. */
|
|
@@ -20,10 +22,15 @@ export type ToastHandle = {
|
|
|
20
22
|
dismiss: () => void;
|
|
21
23
|
update: (description: string, options?: ToastOptions) => void;
|
|
22
24
|
};
|
|
25
|
+
export type ToastSlot = {
|
|
26
|
+
dismiss: () => void;
|
|
27
|
+
};
|
|
23
28
|
export interface ToastFn {
|
|
24
29
|
(description: string, options?: ToastOptions): ToastHandle;
|
|
25
30
|
success: (description: string, options?: Omit<ToastOptions, "variant">) => ToastHandle;
|
|
26
31
|
error: (description: string, options?: Omit<ToastOptions, "variant">) => ToastHandle;
|
|
32
|
+
/** Places an application-owned element in the toast rail, in toast chrome; the caller owns its content and lifetime. */
|
|
33
|
+
custom: (content: HTMLElement) => ToastSlot;
|
|
27
34
|
dismissAll: () => void;
|
|
28
35
|
}
|
|
29
36
|
export declare const K2B_TOAST_CONTAINER_ID = "k2b-ui-toast-container";
|
|
@@ -2,6 +2,7 @@ import { type DateContext } from "@k2b/stdlib";
|
|
|
2
2
|
import { type JSX } from "solid-js";
|
|
3
3
|
import { type DateRangeValue } from "./date-picker";
|
|
4
4
|
import type { MaybeAccessor, ValueFieldProps } from "./field-contract";
|
|
5
|
+
import type { ChoiceAppearance } from "./Select";
|
|
5
6
|
export type { DateRangeValue } from "./date-picker";
|
|
6
7
|
export type DatePreset<T> = {
|
|
7
8
|
label: string;
|
|
@@ -17,9 +18,17 @@ export type DatePickerBaseProps<T> = Omit<ValueFieldProps<T>, "value"> & {
|
|
|
17
18
|
presets?: readonly DatePreset<T>[];
|
|
18
19
|
dateConfig?: DateContext;
|
|
19
20
|
clearable?: boolean;
|
|
21
|
+
/** `plain` shows the value as text for property rows; a clearable picker offers clearing in its panel. */
|
|
22
|
+
appearance?: ChoiceAppearance;
|
|
23
|
+
};
|
|
24
|
+
export type DatePickerProps = DatePickerBaseProps<string | null> & {
|
|
25
|
+
/** Trigger content for a set value, for example the date with a relative hint. */
|
|
26
|
+
renderValue?: (value: string) => JSX.Element;
|
|
27
|
+
};
|
|
28
|
+
export type DateTimePickerProps = DatePickerBaseProps<string | null> & {
|
|
29
|
+
/** Trigger content for a set value, for example the date and time with a relative hint. */
|
|
30
|
+
renderValue?: (value: string) => JSX.Element;
|
|
20
31
|
};
|
|
21
|
-
export type DatePickerProps = DatePickerBaseProps<string | null>;
|
|
22
|
-
export type DateTimePickerProps = DatePickerBaseProps<string | null>;
|
|
23
32
|
export type DateRangePickerProps = DatePickerBaseProps<DateRangeValue> & {
|
|
24
33
|
withTime?: boolean;
|
|
25
34
|
datePresets?: readonly DatePreset<string | null>[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type JSX } from "solid-js";
|
|
2
2
|
import { type ChoiceOption } from "./choice";
|
|
3
3
|
import type { ValueFieldProps } from "./field-contract";
|
|
4
|
-
import type { SelectGroup } from "./Select";
|
|
4
|
+
import type { ChoiceAppearance, SelectGroup } from "./Select";
|
|
5
5
|
export type MultiSelectOption = string | {
|
|
6
6
|
id: string;
|
|
7
7
|
label?: string;
|
|
@@ -36,6 +36,10 @@ export type MultiSelectInputProps = ValueFieldProps<string[]> & {
|
|
|
36
36
|
emptyLabel?: string;
|
|
37
37
|
retryLabel?: string;
|
|
38
38
|
clearLabel?: string;
|
|
39
|
+
/** `plain` shows the selection as wrapping pills without a box; options are removed in the list. */
|
|
40
|
+
appearance?: ChoiceAppearance;
|
|
41
|
+
/** Icon class shown before the placeholder while nothing is selected. */
|
|
42
|
+
placeholderIcon?: string;
|
|
39
43
|
};
|
|
40
44
|
export declare function MultiSelectInput(props: MultiSelectInputProps): JSX.Element;
|
|
41
45
|
export default MultiSelectInput;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type JSX } from "solid-js";
|
|
2
2
|
import type { ValueFieldProps } from "./field-contract";
|
|
3
|
+
import type { ChoiceAppearance } from "./Select";
|
|
3
4
|
export type NumberInputProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "max" | "min" | "onChange" | "onInput" | "prefix" | "step" | "type" | "value" | keyof ValueFieldProps<number | null>> & ValueFieldProps<number | null> & {
|
|
4
5
|
max?: number;
|
|
5
6
|
min?: number;
|
|
@@ -21,6 +22,19 @@ export type NumberInputProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "
|
|
|
21
22
|
activeIcon?: string;
|
|
22
23
|
prefix?: JSX.Element;
|
|
23
24
|
suffix?: JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* `plain` edits the value in place for property rows: no box and no steppers
|
|
27
|
+
* or clear button. The field sizes to its text, Enter commits, Escape
|
|
28
|
+
* restores the current value, and clearing the text clears the value. Focus
|
|
29
|
+
* stays in the field.
|
|
30
|
+
*/
|
|
31
|
+
appearance?: ChoiceAppearance;
|
|
32
|
+
/**
|
|
33
|
+
* Text for a set value while a plain field is not being edited, such as
|
|
34
|
+
* `90` as "1 h 30 min". It also names the value for assistive technology.
|
|
35
|
+
* The suffix then shows only while editing.
|
|
36
|
+
*/
|
|
37
|
+
formatValue?: (value: number) => string;
|
|
24
38
|
};
|
|
25
39
|
export declare function NumberInput(props: NumberInputProps): JSX.Element;
|
|
26
40
|
export default NumberInput;
|
|
@@ -8,6 +8,13 @@ export type SelectGroup = {
|
|
|
8
8
|
};
|
|
9
9
|
export type SelectView = "list" | "grid";
|
|
10
10
|
export type SelectGridSize = "sm" | "md" | "lg";
|
|
11
|
+
/**
|
|
12
|
+
* `field` draws the boxed form control. `plain` shows the value as text for
|
|
13
|
+
* property rows: no box, no chevron, and a quiet surface on hover or while
|
|
14
|
+
* open. Its surface and hit area cover the nearest positioned ancestor, such as
|
|
15
|
+
* a `DescriptionList` row, so the whole row opens the picker.
|
|
16
|
+
*/
|
|
17
|
+
export type ChoiceAppearance = "field" | "plain";
|
|
11
18
|
export type SelectSourceOption = string | {
|
|
12
19
|
id: string;
|
|
13
20
|
label?: string;
|
|
@@ -45,6 +52,9 @@ export type SelectProps = ValueFieldProps<string | null> & {
|
|
|
45
52
|
searchPlaceholder?: string;
|
|
46
53
|
clearable?: boolean;
|
|
47
54
|
name?: string;
|
|
55
|
+
appearance?: ChoiceAppearance;
|
|
56
|
+
/** Icon class shown before the placeholder while nothing is selected. */
|
|
57
|
+
placeholderIcon?: string;
|
|
48
58
|
};
|
|
49
59
|
export declare function Select(props: SelectProps): JSX.Element;
|
|
50
60
|
export default Select;
|
|
@@ -27,7 +27,7 @@ export type { MarkdownEditorProps } from "./markdown/MarkdownEditor";
|
|
|
27
27
|
export { MarkdownEditor } from "./markdown/MarkdownEditor";
|
|
28
28
|
export type { NumberInputProps } from "./NumberInput";
|
|
29
29
|
export { NumberInput } from "./NumberInput";
|
|
30
|
-
export type { SelectGridSize, SelectGroup, SelectOption, SelectProps, SelectSourceOption, SelectView } from "./Select";
|
|
30
|
+
export type { ChoiceAppearance, SelectGridSize, SelectGroup, SelectOption, SelectProps, SelectSourceOption, SelectView } from "./Select";
|
|
31
31
|
export { Select } from "./Select";
|
|
32
32
|
export type { SelectChipOption, SelectChipProps } from "./SelectChip";
|
|
33
33
|
export { SelectChip } from "./SelectChip";
|
|
@@ -18,6 +18,7 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
|
|
|
18
18
|
add: string;
|
|
19
19
|
addTag: string;
|
|
20
20
|
addImage: string;
|
|
21
|
+
apply: string;
|
|
21
22
|
attachments: string;
|
|
22
23
|
assistant: string;
|
|
23
24
|
avatarLabel: ({ name }: {
|
|
@@ -250,6 +251,7 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
|
|
|
250
251
|
filterActions: string;
|
|
251
252
|
info: string;
|
|
252
253
|
dismissNotification: string;
|
|
254
|
+
notifications: string;
|
|
253
255
|
interactiveLineChart: string;
|
|
254
256
|
interactiveChart: string;
|
|
255
257
|
chartFields: ({ key }: {
|
|
@@ -82,6 +82,8 @@ export type AppWorkspaceBottomDrawerProps = {
|
|
|
82
82
|
resizable?: boolean;
|
|
83
83
|
};
|
|
84
84
|
export type AppWorkspaceSidebarProps = {
|
|
85
|
+
/** Stable element id, for a toggle elsewhere that names the sidebar in `aria-controls`. */
|
|
86
|
+
id?: string;
|
|
85
87
|
label?: string;
|
|
86
88
|
children: JSX.Element;
|
|
87
89
|
class?: string;
|
|
@@ -97,6 +99,18 @@ export type AppWorkspaceSidebarProps = {
|
|
|
97
99
|
defaultSize?: number;
|
|
98
100
|
minSize?: number;
|
|
99
101
|
maxSize?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Hides the desktop navigation completely: the sidebar renders none of its
|
|
104
|
+
* children and no resize handle, and main panes with `surface="navigation"`
|
|
105
|
+
* hide with it. The state is application-owned, like a persisted layout.
|
|
106
|
+
*/
|
|
107
|
+
hidden?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Makes the sidebar hideable by dragging its resize handle below half its
|
|
110
|
+
* minimum width. The controller then requests `true`; showing it again is
|
|
111
|
+
* the application's control.
|
|
112
|
+
*/
|
|
113
|
+
onHiddenChange?: (hidden: boolean) => void;
|
|
100
114
|
};
|
|
101
115
|
export type AppWorkspaceSidebarVisibility = "always" | "expanded" | "collapsed";
|
|
102
116
|
export type AppWorkspaceSidebarAccessoryVisibility = "always" | "hover";
|
|
@@ -22,8 +22,8 @@ export type SettingsSectionProps = {
|
|
|
22
22
|
class?: string;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
|
-
* A full-page settings group
|
|
26
|
-
*
|
|
25
|
+
* A full-page settings group: a heading, optional actions and its fields on the
|
|
26
|
+
* page surface without a card. Dialogs keep using PanelDialog.Section.
|
|
27
27
|
*/
|
|
28
28
|
export declare function SettingsSection(props: SettingsSectionProps): JSX.Element;
|
|
29
29
|
export type SettingsGroupProps = {
|
|
@@ -4,4 +4,9 @@ export type AppWorkspaceControllerOptions = {
|
|
|
4
4
|
readState?: () => AppWorkspaceLayoutState | null | undefined;
|
|
5
5
|
writeState?: (state: AppWorkspaceLayoutState) => void;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Asks the owning `AppWorkspace.Sidebar` to hide. The sidebar's `hidden` prop
|
|
9
|
+
* stays application state, so the controller only requests the change.
|
|
10
|
+
*/
|
|
11
|
+
export declare const APP_WORKSPACE_SIDEBAR_HIDE_EVENT = "k2b-app-workspace-sidebar-hide";
|
|
7
12
|
export declare const installAppWorkspaceController: (options?: AppWorkspaceControllerOptions) => (() => void);
|