@k2b/ui 0.7.0 → 0.9.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 (59) hide show
  1. package/dist/browser/content/Calendar.js +12 -5
  2. package/dist/browser/content/Calendar.js.map +1 -1
  3. package/dist/browser/content/DataTable.js +25 -10
  4. package/dist/browser/content/DataTable.js.map +1 -1
  5. package/dist/browser/content/PdfPreview.js +170 -72
  6. package/dist/browser/content/PdfPreview.js.map +1 -1
  7. package/dist/browser/feedback/dialog-core.js +2 -1
  8. package/dist/browser/feedback/dialog-core.js.map +1 -1
  9. package/dist/browser/feedback/prompts.js +20 -6
  10. package/dist/browser/feedback/prompts.js.map +1 -1
  11. package/dist/browser/feedback/toast.js +4 -2
  12. package/dist/browser/feedback/toast.js.map +1 -1
  13. package/dist/browser/inputs/MultiSelectInput.js +258 -174
  14. package/dist/browser/inputs/MultiSelectInput.js.map +1 -1
  15. package/dist/browser/inputs/choice.js +27 -0
  16. package/dist/browser/inputs/choice.js.map +1 -1
  17. package/dist/browser/intl/messages.js +54 -2
  18. package/dist/browser/intl/messages.js.map +1 -1
  19. package/dist/browser/layout/Navigation.js +8 -5
  20. package/dist/browser/layout/Navigation.js.map +1 -1
  21. package/dist/browser/layout/SettingsModal.js +32 -10
  22. package/dist/browser/layout/SettingsModal.js.map +1 -1
  23. package/dist/browser/layout/navigation-model.js +1 -0
  24. package/dist/browser/layout/navigation-model.js.map +1 -1
  25. package/dist/browser/surfaces/Placeholder.js +3 -0
  26. package/dist/browser/surfaces/Placeholder.js.map +1 -1
  27. package/dist/ssr/content/Calendar.js +13 -6
  28. package/dist/ssr/content/Calendar.js.map +1 -1
  29. package/dist/ssr/content/DataTable.js +25 -10
  30. package/dist/ssr/content/DataTable.js.map +1 -1
  31. package/dist/ssr/content/PdfPreview.js +79 -22
  32. package/dist/ssr/content/PdfPreview.js.map +1 -1
  33. package/dist/ssr/feedback/dialog-core.js +2 -1
  34. package/dist/ssr/feedback/dialog-core.js.map +1 -1
  35. package/dist/ssr/feedback/prompts.js +19 -5
  36. package/dist/ssr/feedback/prompts.js.map +1 -1
  37. package/dist/ssr/feedback/toast.js +4 -2
  38. package/dist/ssr/feedback/toast.js.map +1 -1
  39. package/dist/ssr/inputs/MultiSelectInput.js +87 -42
  40. package/dist/ssr/inputs/MultiSelectInput.js.map +1 -1
  41. package/dist/ssr/inputs/choice.js +27 -0
  42. package/dist/ssr/inputs/choice.js.map +1 -1
  43. package/dist/ssr/intl/messages.js +54 -2
  44. package/dist/ssr/intl/messages.js.map +1 -1
  45. package/dist/ssr/layout/Navigation.js +8 -5
  46. package/dist/ssr/layout/Navigation.js.map +1 -1
  47. package/dist/ssr/layout/SettingsModal.js +30 -5
  48. package/dist/ssr/layout/SettingsModal.js.map +1 -1
  49. package/dist/ssr/layout/navigation-model.js +1 -0
  50. package/dist/ssr/layout/navigation-model.js.map +1 -1
  51. package/dist/ssr/surfaces/Placeholder.js +3 -0
  52. package/dist/ssr/surfaces/Placeholder.js.map +1 -1
  53. package/dist/styles.css +1 -1
  54. package/dist/types/content/PdfPreview.d.ts +8 -0
  55. package/dist/types/inputs/choice.d.ts +12 -0
  56. package/dist/types/intl/messages.d.ts +26 -0
  57. package/dist/types/layout/navigation-model.d.ts +5 -0
  58. package/dist/types/surfaces/Placeholder.d.ts +2 -1
  59. package/package.json +2 -1
@@ -7,6 +7,14 @@ export type PdfPreviewProps = {
7
7
  title?: string;
8
8
  buttonLabel?: string;
9
9
  openButtonLabel?: string;
10
+ /**
11
+ * Opens the document at this address in a new tab instead of a local copy. Pass a stable same-origin URL that
12
+ * serves the PDF inline, so reloading and the viewer's file name keep working. Without it, the open action shows
13
+ * a temporary copy of the requested document.
14
+ */
15
+ openHref?: string;
16
+ /** Adds a Download action. The host owns the download, for example a fresh attachment URL. */
17
+ onDownload?: () => void;
10
18
  emptyText?: string;
11
19
  class?: string;
12
20
  children?: (parts: {
@@ -12,6 +12,18 @@ export type ChoiceOption<T extends string = string> = {
12
12
  export type ChoiceOptionsLoader<T extends string = string> = (query: string, signal: AbortSignal) => Promise<readonly ChoiceOption<T>[]>;
13
13
  export declare const filterChoiceOptions: <T extends string>(options: readonly ChoiceOption<T>[], query: string) => readonly ChoiceOption<T>[];
14
14
  export declare const nextEnabledChoiceIndex: <T extends string>(options: readonly ChoiceOption<T>[], current: number, direction: 1 | -1) => number;
15
+ /**
16
+ * Counts the leading pills that fit into `available` pixels and measures the
17
+ * whole row. When not all of them fit, the rest collapse into a summary pill
18
+ * of width `more`; the first pill always stays and truncates when even it does
19
+ * not fit. Without a measured width (no layout yet) every pill stays. Half a
20
+ * pixel of slack absorbs layout rounding, so a row given exactly its own
21
+ * `rowWidth` always fits.
22
+ */
23
+ export declare const fitChoicePills: (available: number, widths: readonly number[], gap: number, more: number) => {
24
+ visible: number;
25
+ rowWidth: number;
26
+ };
15
27
  export declare function createChoiceLoader<T extends string>(loader: () => ChoiceOptionsLoader<T> | undefined, debounceMs: () => number): {
16
28
  options: () => readonly ChoiceOption<T>[];
17
29
  loading: () => boolean;
@@ -86,6 +86,18 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
86
86
  refreshing: string;
87
87
  reset: string;
88
88
  required: string;
89
+ minCharacters: ({ count }: {
90
+ count: number;
91
+ }) => string;
92
+ maxCharacters: ({ count }: {
93
+ count: number;
94
+ }) => string;
95
+ minTags: ({ count }: {
96
+ count: number;
97
+ }) => string;
98
+ maxTags: ({ count }: {
99
+ count: number;
100
+ }) => string;
89
101
  rename: string;
90
102
  delete: string;
91
103
  remove: string;
@@ -142,6 +154,11 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
142
154
  hiddenOverlappingEvents: ({ count }: {
143
155
  count: number;
144
156
  }) => string;
157
+ calendarEventTime: ({ title, start, end }: {
158
+ title: string;
159
+ start: string;
160
+ end: string;
161
+ }) => string;
145
162
  today: string;
146
163
  day: string;
147
164
  week: string;
@@ -222,6 +239,9 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
222
239
  messageComposer: string;
223
240
  messageInput: string;
224
241
  confirmation: string;
242
+ typeToConfirm: ({ phrase }: {
243
+ phrase: string;
244
+ }) => string;
225
245
  confirm: string;
226
246
  dialog: string;
227
247
  discard: string;
@@ -229,6 +249,7 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
229
249
  form: string;
230
250
  filterActions: string;
231
251
  info: string;
252
+ dismissNotification: string;
232
253
  interactiveLineChart: string;
233
254
  interactiveChart: string;
234
255
  chartFields: ({ key }: {
@@ -311,6 +332,8 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
311
332
  pdfPreviewHttpError: ({ status }: {
312
333
  status: number;
313
334
  }) => string;
335
+ pdfPreviewTabBlocked: string;
336
+ pdfPreviewRendering: string;
314
337
  pickIcon: string;
315
338
  postMessage: string;
316
339
  preview: string;
@@ -334,6 +357,9 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
334
357
  index: number;
335
358
  total: number;
336
359
  }) => string;
360
+ moreSelected: ({ count }: {
361
+ count: number;
362
+ }) => string;
337
363
  removeNamed: ({ name }: {
338
364
  name: string;
339
365
  }) => string;
@@ -12,6 +12,8 @@ type NavigationEntry = {
12
12
  children?: readonly NavigationItem[];
13
13
  /** Initial disclosure state; subsequent toggles remain local to the renderer. */
14
14
  defaultExpanded?: boolean;
15
+ /** Owner-held disclosure state. The renderer shows it and reports toggles through `onExpandedChange`. */
16
+ expanded?: boolean;
15
17
  actions?: readonly NavigationItem[];
16
18
  };
17
19
  /** Serializable presentation. Functions stay with the controller's owning island. */
@@ -36,12 +38,15 @@ export type NavigationOptions = {
36
38
  items: Accessor<readonly NavigationItem[]>;
37
39
  onAction?: (action: string) => void | Promise<void>;
38
40
  onNavigate?: (event: LinkNavigateEvent) => void | Promise<void>;
41
+ /** Receives disclosure toggles of items that carry `expanded`; the owner decides the next state. */
42
+ onExpandedChange?: (id: string, expanded: boolean) => void;
39
43
  };
40
44
  export declare function findNavigationItem(items: readonly NavigationItem[], id: string): NavigationItem | undefined;
41
45
  /** One live source for renderers; no router, registry, fetching or persisted state. */
42
46
  export declare function createNavigation(options: NavigationOptions): {
43
47
  items: Accessor<readonly NavigationItem[]>;
44
48
  onNavigate: ((event: LinkNavigateEvent) => void | Promise<void>) | undefined;
49
+ onExpandedChange: ((id: string, expanded: boolean) => void) | undefined;
45
50
  activate(id: string): Promise<void>;
46
51
  };
47
52
  export type NavigationController = ReturnType<typeof createNavigation>;
@@ -2,7 +2,8 @@ import { type JSX } from "solid-js";
2
2
  export type PlaceholderAlign = "center" | "left";
3
3
  export type PlaceholderSurface = "none" | "paper";
4
4
  export type PlaceholderState = "empty" | "loading" | "error";
5
- export type PlaceholderVariant = "compact" | "panel";
5
+ /** `compact` stacks inside a section, `inline` is one row in a list or sidebar, `panel` fills a work area. */
6
+ export type PlaceholderVariant = "compact" | "inline" | "panel";
6
7
  export type PlaceholderProps = {
7
8
  title?: JSX.Element;
8
9
  description?: JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k2b/ui",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Production-ready components for SolidJS applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -62,6 +62,7 @@
62
62
  "bun-plugin-tailwind": "0.1.2",
63
63
  "happy-dom": "20.11.2",
64
64
  "hono": "4.13.8",
65
+ "playwright": "1.62.0",
65
66
  "seroval": "1.6.7",
66
67
  "solid-js": "1.9.15",
67
68
  "tailwindcss": "4.3.3",