@k2b/ui 0.11.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.
Files changed (69) hide show
  1. package/dist/browser/content/FileView.js +203 -136
  2. package/dist/browser/content/FileView.js.map +1 -1
  3. package/dist/browser/content/markdown-title.js +52 -0
  4. package/dist/browser/content/markdown-title.js.map +1 -0
  5. package/dist/browser/feedback/index.js.map +1 -1
  6. package/dist/browser/feedback/prompts.js +18 -19
  7. package/dist/browser/feedback/prompts.js.map +1 -1
  8. package/dist/browser/feedback/toast.js +363 -122
  9. package/dist/browser/feedback/toast.js.map +1 -1
  10. package/dist/browser/inputs/DatePicker.js +263 -222
  11. package/dist/browser/inputs/DatePicker.js.map +1 -1
  12. package/dist/browser/inputs/MultiSelectInput.js +139 -105
  13. package/dist/browser/inputs/MultiSelectInput.js.map +1 -1
  14. package/dist/browser/inputs/NumberInput.js +209 -122
  15. package/dist/browser/inputs/NumberInput.js.map +1 -1
  16. package/dist/browser/inputs/Select.js +184 -92
  17. package/dist/browser/inputs/Select.js.map +1 -1
  18. package/dist/browser/inputs/index.js.map +1 -1
  19. package/dist/browser/intl/messages.js +4 -0
  20. package/dist/browser/intl/messages.js.map +1 -1
  21. package/dist/browser/layout/DetailPanel.js +2 -1
  22. package/dist/browser/layout/DetailPanel.js.map +1 -1
  23. package/dist/browser/layout/Navigation.js +1 -0
  24. package/dist/browser/layout/Navigation.js.map +1 -1
  25. package/dist/browser/layout/PanelDialog.js +1 -0
  26. package/dist/browser/layout/PanelDialog.js.map +1 -1
  27. package/dist/browser/layout/Settings.js +2 -2
  28. package/dist/browser/layout/Settings.js.map +1 -1
  29. package/dist/ssr/content/FileView.js +141 -81
  30. package/dist/ssr/content/FileView.js.map +1 -1
  31. package/dist/ssr/content/markdown-title.js +52 -0
  32. package/dist/ssr/content/markdown-title.js.map +1 -0
  33. package/dist/ssr/feedback/index.js.map +1 -1
  34. package/dist/ssr/feedback/prompts.js +1 -1
  35. package/dist/ssr/feedback/prompts.js.map +1 -1
  36. package/dist/ssr/feedback/toast.js +363 -122
  37. package/dist/ssr/feedback/toast.js.map +1 -1
  38. package/dist/ssr/inputs/DatePicker.js +78 -52
  39. package/dist/ssr/inputs/DatePicker.js.map +1 -1
  40. package/dist/ssr/inputs/MultiSelectInput.js +52 -32
  41. package/dist/ssr/inputs/MultiSelectInput.js.map +1 -1
  42. package/dist/ssr/inputs/NumberInput.js +93 -40
  43. package/dist/ssr/inputs/NumberInput.js.map +1 -1
  44. package/dist/ssr/inputs/Select.js +108 -29
  45. package/dist/ssr/inputs/Select.js.map +1 -1
  46. package/dist/ssr/inputs/index.js.map +1 -1
  47. package/dist/ssr/intl/messages.js +4 -0
  48. package/dist/ssr/intl/messages.js.map +1 -1
  49. package/dist/ssr/layout/DetailPanel.js +2 -1
  50. package/dist/ssr/layout/DetailPanel.js.map +1 -1
  51. package/dist/ssr/layout/Navigation.js +1 -0
  52. package/dist/ssr/layout/Navigation.js.map +1 -1
  53. package/dist/ssr/layout/PanelDialog.js +1 -0
  54. package/dist/ssr/layout/PanelDialog.js.map +1 -1
  55. package/dist/ssr/layout/Settings.js +2 -2
  56. package/dist/ssr/layout/Settings.js.map +1 -1
  57. package/dist/styles.css +1 -1
  58. package/dist/types/content/FileView.d.ts +11 -1
  59. package/dist/types/content/markdown-title.d.ts +9 -0
  60. package/dist/types/feedback/index.d.ts +1 -1
  61. package/dist/types/feedback/toast.d.ts +7 -0
  62. package/dist/types/inputs/DatePicker.d.ts +11 -2
  63. package/dist/types/inputs/MultiSelectInput.d.ts +5 -1
  64. package/dist/types/inputs/NumberInput.d.ts +14 -0
  65. package/dist/types/inputs/Select.d.ts +10 -0
  66. package/dist/types/inputs/index.d.ts +1 -1
  67. package/dist/types/intl/messages.d.ts +2 -0
  68. package/dist/types/layout/Settings.d.ts +2 -2
  69. 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
- /** Plain previews inherit the surrounding surface without a frame or inset padding. */
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 }: {
@@ -22,8 +22,8 @@ export type SettingsSectionProps = {
22
22
  class?: string;
23
23
  };
24
24
  /**
25
- * A full-page settings group. Dialogs keep using PanelDialog.Section; this
26
- * component owns the quieter, observability-style paper used on admin pages.
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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k2b/ui",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Production-ready components for SolidJS applications.",
5
5
  "repository": {
6
6
  "type": "git",