@k2b/ui 0.61.0 → 0.62.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 (56) hide show
  1. package/dist/browser/actions/FilterChip.js +3 -0
  2. package/dist/browser/actions/FilterChip.js.map +1 -1
  3. package/dist/browser/content/ActivityList.js +379 -290
  4. package/dist/browser/content/ActivityList.js.map +1 -1
  5. package/dist/browser/content/FileView.js +0 -12
  6. package/dist/browser/content/FileView.js.map +1 -1
  7. package/dist/browser/content/activity-messages.js +2 -2
  8. package/dist/browser/content/activity-messages.js.map +1 -1
  9. package/dist/browser/content/file-view-preview.js +13 -0
  10. package/dist/browser/content/file-view-preview.js.map +1 -1
  11. package/dist/browser/content/index.js +4 -4
  12. package/dist/browser/content/index.js.map +1 -1
  13. package/dist/browser/feedback/dialog-core.js +24 -27
  14. package/dist/browser/feedback/dialog-core.js.map +1 -1
  15. package/dist/browser/feedback/dialog-frame-motion.js +506 -15
  16. package/dist/browser/feedback/dialog-frame-motion.js.map +1 -1
  17. package/dist/browser/feedback/prompt-sheet.js +1 -0
  18. package/dist/browser/feedback/prompt-sheet.js.map +1 -1
  19. package/dist/browser/feedback/prompts.js +5 -1
  20. package/dist/browser/feedback/prompts.js.map +1 -1
  21. package/dist/browser/layout/sheet-motion.js +3 -3
  22. package/dist/browser/layout/sheet-motion.js.map +1 -1
  23. package/dist/ssr/actions/FilterChip.js +3 -0
  24. package/dist/ssr/actions/FilterChip.js.map +1 -1
  25. package/dist/ssr/content/ActivityList.js +199 -114
  26. package/dist/ssr/content/ActivityList.js.map +1 -1
  27. package/dist/ssr/content/FileView.js +0 -12
  28. package/dist/ssr/content/FileView.js.map +1 -1
  29. package/dist/ssr/content/activity-messages.js +2 -2
  30. package/dist/ssr/content/activity-messages.js.map +1 -1
  31. package/dist/ssr/content/file-view-preview.js +13 -0
  32. package/dist/ssr/content/file-view-preview.js.map +1 -1
  33. package/dist/ssr/content/index.js +4 -4
  34. package/dist/ssr/content/index.js.map +1 -1
  35. package/dist/ssr/feedback/dialog-core.js +24 -27
  36. package/dist/ssr/feedback/dialog-core.js.map +1 -1
  37. package/dist/ssr/feedback/dialog-frame-motion.js +506 -15
  38. package/dist/ssr/feedback/dialog-frame-motion.js.map +1 -1
  39. package/dist/ssr/feedback/prompt-sheet.js +1 -0
  40. package/dist/ssr/feedback/prompt-sheet.js.map +1 -1
  41. package/dist/ssr/feedback/prompts.js +5 -1
  42. package/dist/ssr/feedback/prompts.js.map +1 -1
  43. package/dist/ssr/layout/sheet-motion.js +3 -3
  44. package/dist/ssr/layout/sheet-motion.js.map +1 -1
  45. package/dist/styles.css +1 -1
  46. package/dist/types/actions/FilterChip.d.ts +9 -0
  47. package/dist/types/content/ActivityList.d.ts +24 -6
  48. package/dist/types/content/FileView.d.ts +0 -5
  49. package/dist/types/content/file-view-preview.d.ts +5 -0
  50. package/dist/types/content/index.d.ts +3 -3
  51. package/dist/types/feedback/dialog-core.d.ts +3 -1
  52. package/dist/types/feedback/dialog-frame-motion.d.ts +26 -1
  53. package/dist/types/feedback/prompt-sheet.d.ts +1 -0
  54. package/dist/types/feedback/prompts.d.ts +4 -0
  55. package/dist/types/layout/sheet-motion.d.ts +2 -2
  56. package/package.json +1 -1
@@ -44,6 +44,15 @@ export type FilterChipProps = {
44
44
  only?: boolean;
45
45
  /** The trigger shows the colors of the first four chosen options before its label, as a quiet hint of what is in view. */
46
46
  swatches?: boolean;
47
+ /**
48
+ * Puts a search field above the options, for a list long enough that finding an option takes reading, such as
49
+ * people. `label` names the field and is its placeholder unless `placeholder` is set. "Only" and "All" stay out of a
50
+ * searchable menu, whose field keeps the focus.
51
+ */
52
+ search?: {
53
+ label: string;
54
+ placeholder?: string;
55
+ };
47
56
  disabled?: boolean;
48
57
  class?: string;
49
58
  };
@@ -1,6 +1,6 @@
1
1
  import type { DateContext } from "@k2b/stdlib";
2
2
  import { type JSX } from "solid-js";
3
- /** Only the icon carries a tone: grey by default, green for a completion, amber for a notice, red only while an action is needed. */
3
+ /** Warning and danger appear as a small mark at the avatar; ordinary kind icons stay out of the sentence. */
4
4
  export type ActivityTone = "neutral" | "success" | "warning" | "danger";
5
5
  /** At most one action per entry, a link with an icon in the last line, only while the state needs it. */
6
6
  export type ActivityAction = {
@@ -14,6 +14,12 @@ export type ActivityAction = {
14
14
  /** For tests: rendered as `data-activity-action`. */
15
15
  data?: string;
16
16
  };
17
+ /** Identity for the avatar; the actor text stays application-owned. Deleted people use `deleted`; system events keep their own glyph. */
18
+ export type ActivityAvatar = {
19
+ name: string;
20
+ kind: "person" | "service" | "system" | "deleted";
21
+ src?: string | null;
22
+ };
17
23
  export type ActivityEntry = {
18
24
  /**
19
25
  * Stable key of the entry, such as its record id; unique within the list. With it a row keeps its node, folded-out
@@ -23,10 +29,10 @@ export type ActivityEntry = {
23
29
  id?: string;
24
30
  /** ISO instant. */
25
31
  at: string;
26
- /** Icon class of the kind, such as `ti ti-mail`; one fixed icon per kind. */
27
- icon: string;
32
+ /** Kind icon, shown as a status mark for warning, danger, or an explicit `iconLabel`. */
33
+ icon?: string;
28
34
  tone?: ActivityTone;
29
- /** Name of the icon for tooltip and screen readers, when the sentence does not say it already. */
35
+ /** Name of the icon for screen readers, when the sentence does not say it already. */
30
36
  iconLabel?: string;
31
37
  /** One sentence, such as "Invitation sent". */
32
38
  text: JSX.Element;
@@ -41,8 +47,9 @@ export type ActivityEntry = {
41
47
  } | null;
42
48
  /** Only a result, the reason of a failure, a quote, or "before → now" (`ActivityList.Change`). */
43
49
  detail?: JSX.Element;
44
- /** Who did it, a text of the application; without one the meta line reads "automatic". */
50
+ /** Who did it, shown before the sentence; without one the row reads "Automatic". */
45
51
  actor?: JSX.Element | null;
52
+ avatar?: ActivityAvatar;
46
53
  action?: ActivityAction | null;
47
54
  /** A click on the entry opens it, such as its dialog. */
48
55
  onOpen?: () => void;
@@ -59,7 +66,7 @@ export type ActivityEntry = {
59
66
  /** Attributes on the list item, such as `data-email` for focus after a reload. */
60
67
  attrs?: Record<`data-${string}`, string | number | undefined>;
61
68
  };
62
- /** `compact` for a card or side column (meta under the sentence); `wide` for a dialog or page (meta on the right). */
69
+ /** `compact` for a card or side column; `wide` for a dialog or page. Both keep time at the end of the row. */
63
70
  export type ActivityDensity = "compact" | "wide";
64
71
  type ActivityTimeProps = {
65
72
  /**
@@ -83,6 +90,16 @@ export type ActivityListProps = ActivityTimeProps & {
83
90
  label?: string;
84
91
  class?: string;
85
92
  };
93
+ /** A single row inside a feed. The caller owns ordering, grouping, pagination, and the clock. */
94
+ export type ActivityRowProps = ActivityTimeProps & {
95
+ entry: ActivityEntry;
96
+ /** Marks the currently open object, independently of expanded details. */
97
+ selected?: boolean;
98
+ /** Handles the sentence link, including keyboard activation. Leave modified clicks to the browser. */
99
+ onNavigate?: (event: MouseEvent) => void;
100
+ class?: string;
101
+ };
102
+ declare function ActivityStandaloneRow(props: ActivityRowProps): JSX.Element;
86
103
  /** "before → now" of a detail line, the old value quiet. With `term` in front ("Plan: Basic → Team"). */
87
104
  declare function ActivityChange(props: {
88
105
  before: JSX.Element;
@@ -103,6 +120,7 @@ declare function ActivityEmpty(props: {
103
120
  text?: JSX.Element;
104
121
  }): JSX.Element;
105
122
  type ActivityListComponent = ((props: ActivityListProps) => JSX.Element) & {
123
+ Row: typeof ActivityStandaloneRow;
106
124
  Loading: typeof ActivityLoading;
107
125
  Empty: typeof ActivityEmpty;
108
126
  Error: typeof ActivityError;
@@ -76,9 +76,4 @@ export type FileViewRenderer = {
76
76
  /** Text renderers that support the edit affordance when `save` is present. */
77
77
  editable?: boolean;
78
78
  };
79
- /**
80
- * A file size such as "4.2 MB". With `locale`, the number follows that language ("4,2 MB") and drops a trailing
81
- * zero ("64 KB"); without it, the output stays as before.
82
- */
83
- export declare const formatFileViewSize: (bytes: number, locale?: string) => string;
84
79
  export default function FileView(props: FileViewProps): JSX.Element;
@@ -10,6 +10,11 @@ export declare const fileViewExtension: (path: string) => string;
10
10
  * its bounded client-side limits. Custom renderers remain registry-driven.
11
11
  */
12
12
  export declare const getFileViewPreviewKind: (file: FileViewFile) => FileViewPreviewKind | null;
13
+ /**
14
+ * A file size such as "4.2 MB". With `locale`, the number follows that language ("4,2 MB") and drops a trailing
15
+ * zero ("64 KB"); without it, the output stays as before.
16
+ */
17
+ export declare const formatFileViewSize: (bytes: number, locale?: string) => string;
13
18
  /** Use this to expose preview actions only for files FileView can render. */
14
19
  export declare const canPreviewFile: (file: FileViewFile) => boolean;
15
20
  export type DelimitedTextPreview = {
@@ -1,5 +1,5 @@
1
1
  export type { ChartDateFormat, ChartDatum, ChartDatumRole, ChartFormat, ChartNumberFormat } from "../charts/core";
2
- export { type ActivityAction, ActivityCard, type ActivityCardProps, type ActivityDensity, type ActivityDialogInput, type ActivityEntry, type ActivityKind, ActivityList, type ActivityListProps, type ActivityTone, openActivityDialog, } from "./ActivityList";
2
+ export { type ActivityAction, type ActivityAvatar, ActivityCard, type ActivityCardProps, type ActivityDensity, type ActivityDialogInput, type ActivityEntry, type ActivityKind, ActivityList, type ActivityListProps, type ActivityRowProps, type ActivityTone, openActivityDialog, } from "./ActivityList";
3
3
  export { BalanceSummary, type BalanceSummaryProps } from "./BalanceSummary";
4
4
  export type { CalendarAttendee, CalendarCommand, CalendarController, CalendarCustomView, CalendarDayBadge, CalendarEvent, CalendarEventColor, CalendarEventLink, CalendarEventRenderContext, CalendarEventTimeChange, CalendarExternalDrag, CalendarLabels, CalendarProps, CalendarQuickCreateControls, CalendarRange, CalendarRecurrence, CalendarResource, CalendarSelectionControls, CalendarView, } from "./Calendar";
5
5
  export { default as Calendar } from "./Calendar";
@@ -35,9 +35,9 @@ export { FileBrowserPanel, type FileBrowserPanelProps, type FileSource, openFile
35
35
  export { FileGrid, type FileGridGroup, type FileGridOpenProps, type FileGridProps, type FileGridSelectableProps } from "./FileGrid";
36
36
  export { default as FileTree, type FileTreeActions, type FileTreeEntry, type FileTreeProps } from "./FileTree";
37
37
  export { type FileType, FileTypeIcon, type FileTypeIconProps, fileKindLabel, fileTypeOf } from "./FileTypeIcon";
38
- export { default as FileView, type FileViewContent, type FileViewProps, type FileViewRenderer, type FileViewRendererProps, formatFileViewSize, } from "./FileView";
38
+ export { default as FileView, type FileViewContent, type FileViewProps, type FileViewRenderer, type FileViewRendererProps, } from "./FileView";
39
39
  export { FlowAmount, type FlowAmountDirection, type FlowAmountProps, flowDirection } from "./FlowAmount";
40
- export { canPreviewFile, type FileViewFile, type FileViewPreviewKind, getFileViewPreviewKind } from "./file-view-preview";
40
+ export { canPreviewFile, type FileViewFile, type FileViewPreviewKind, formatFileViewSize, getFileViewPreviewKind, } from "./file-view-preview";
41
41
  export type { KbdProps } from "./Kbd";
42
42
  export { Kbd } from "./Kbd";
43
43
  export type { LabelChipProps } from "./LabelChip";
@@ -5,6 +5,8 @@ export type OpenDialogOptions = {
5
5
  primary?: "blue" | "ai";
6
6
  /** Close only this dialog when its owning operation is cancelled. */
7
7
  signal?: AbortSignal;
8
+ /** Hold and animate content height changes after first rest. Defaults to false; level morphs are independent. */
9
+ followContent?: boolean;
8
10
  panelClassName?: string;
9
11
  contentClassName?: string;
10
12
  initialFocus?: "first-input" | "none" | ((dialog: HTMLDialogElement) => HTMLElement | null);
@@ -34,7 +36,7 @@ export type DialogRender<T> = (close: DialogClose<T>, context: {
34
36
  dialog: HTMLDialogElement;
35
37
  /** Switch this entry between a modal and a modeless window without remounting. */
36
38
  setModal: (modal: boolean) => void;
37
- /** Set viewport coordinates, or restore the panel stylesheet position with null. */
39
+ /** Set viewport coordinates, or restore stylesheet positioning with null. Repeating the current value preserves running motion. */
38
40
  setPosition: (position: {
39
41
  x: number;
40
42
  y: number;
@@ -5,10 +5,21 @@
5
5
  * first frame so it never rewraps; the frame clips meanwhile. Anything that interrupts a change turns around from the
6
6
  * values the eye sees; the endings of the interrupted change are dropped, not run. Reduced motion swaps in one frame.
7
7
  *
8
+ * An opted-in frame also follows its content's height while it is open: when a notice comes or goes, fields appear, or text
9
+ * grows, the frame goes from the height the eye sees to the new one over `--k2b-motion-fold` with `--k2b-ease-glide`,
10
+ * and new content fades in over `--k2b-motion-fast` from 40 % of that time. Its top edge stays where it is: it grows
11
+ * downwards and moves up together with growth only when the room below runs out; a sheet grows from the bottom edge. Frames with a size of
12
+ * their own (fixed, workspace, full, sheets with detents) never follow. Neither the first open, the close, a window
13
+ * resize, nor the on-screen keyboard starts an animation; a resize during a fold retargets it.
14
+ *
8
15
  * The frame's own size is animated, a named exception to "transform and opacity only" (see the motion guide): the
9
16
  * frame stands alone above the page, so nothing beside it moves.
10
17
  */
11
18
  export { afterExitTransitions } from "../internal/exit-motion";
19
+ type Position = {
20
+ x: number;
21
+ y: number;
22
+ } | null | undefined;
12
23
  export type FrameMotion = {
13
24
  /**
14
25
  * Before a level replaces the shown one: remembers the frame as the eye sees it and takes `leaving` out of the flow,
@@ -25,9 +36,13 @@ export type FrameMotion = {
25
36
  * After `arriving` is shown and its frame presentation applied: morphs the frame to its size and fades the contents.
26
37
  * `left` runs once `leaving` has faded out (hide a lower level, or dispose a closed one).
27
38
  */
28
- arrive: (arriving: HTMLElement, left: () => void) => void;
39
+ arrive: (arriving: HTMLElement, left: () => void, followContent?: boolean) => void;
40
+ /** Follows only opted-in levels; `arrive` passes the arriving level's choice. */
41
+ follow: (level: HTMLElement, enabled?: boolean) => void;
29
42
  /** Ends every motion now and runs the pending endings, for a frame that leaves the document. */
30
43
  stop: () => void;
44
+ /** A changed explicit position wins over a fold; returns false for an unchanged position. */
45
+ position: (previous: Position, next: Position) => boolean;
31
46
  /**
32
47
  * For a frame that closes and fades out: keeps the size, place and contents exactly as the eye sees them now, and
33
48
  * returns the pending endings to run once the frame has left.
@@ -35,3 +50,13 @@ export type FrameMotion = {
35
50
  freeze: () => () => void;
36
51
  };
37
52
  export declare const createFrameMotion: (dialog: HTMLDialogElement) => FrameMotion;
53
+ /** Every successful import, including retries, joins the current frame once and follows its current level. */
54
+ export declare const connectFrameMotion: (state: {
55
+ element?: HTMLDialogElement;
56
+ motion?: FrameMotion;
57
+ stack: readonly {
58
+ container: HTMLElement;
59
+ role: "dialog" | "alertdialog";
60
+ follow?: boolean;
61
+ }[];
62
+ }, announced?: (typeof state.stack)[number]) => void;
@@ -7,6 +7,7 @@ type PromptFrame = {
7
7
  signal?: AbortSignal;
8
8
  cancelBehavior?: OpenDialogOptions["cancelBehavior"];
9
9
  history?: boolean;
10
+ followContent?: boolean;
10
11
  ariaLabel?: string;
11
12
  title?: string;
12
13
  };
@@ -17,6 +17,8 @@ export interface DialogOptions {
17
17
  cancelBehavior?: OpenDialogOptions["cancelBehavior"];
18
18
  /** Back closes the prompt like Cancel, as in a phone app; see `OpenDialogOptions.history`. */
19
19
  history?: boolean;
20
+ /** Animate content height changes. Defaults to false, or true for form, prompt and promptNumber. */
21
+ followContent?: boolean;
20
22
  }
21
23
  export type SuccessDialogOptions = Omit<DialogOptions, "variant"> & {
22
24
  /** A finished success, such as an issued document: the header draws its check once when the dialog opens. */
@@ -149,6 +151,8 @@ type PromptFormOptions<T extends Record<string, FieldSchema>> = {
149
151
  title?: string;
150
152
  ariaLabel?: string;
151
153
  icon?: string;
154
+ /** Hold and animate content height changes. Defaults to true. */
155
+ followContent?: boolean;
152
156
  fields: T;
153
157
  confirmText?: string;
154
158
  cancelText?: string | false;
@@ -23,8 +23,8 @@ export type SheetMotion = {
23
23
  dispose: () => void;
24
24
  };
25
25
  /**
26
- * Moves a bottom sheet with transform and opacity only. Its layout height is fixed when it opens (the content's height,
27
- * or the full height with detents) and never animates; the sheet slides by `--k2b-sheet-y`, the footer stays on the
26
+ * Moves a bottom sheet with transform and opacity only. Its layout height is the content's height, which the dialog
27
+ * core folds on content changes when `followContent` is enabled, or the full height with detents, which never animates; the sheet slides by `--k2b-sheet-y`, the footer stays on the
28
28
  * screen's edge between half and full height by `--k2b-sheet-footer-y`, and the backdrop dims by `--k2b-sheet-dim`.
29
29
  * A glide is a Web Animation that ends on exactly those values, so it lands on its detent without a settle. A drag on
30
30
  * the handle or the header follows the pointer; a finger anywhere follows too, except where a list still scrolls.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k2b/ui",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "Production-ready components for SolidJS applications.",
5
5
  "repository": {
6
6
  "type": "git",