@revikornmann/muka-ui 0.62.0 → 0.63.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 (49) hide show
  1. package/cli/templates/agents-block.md +7 -0
  2. package/dist/cjs/components/ChatMessage/ChatMessage.css +9 -0
  3. package/dist/cjs/components/FileUpload/FileUpload.js +5 -1
  4. package/dist/cjs/components/FileUpload/FileUpload.js.map +1 -1
  5. package/dist/cjs/components/FileUpload/FileUploadItem.js +16 -2
  6. package/dist/cjs/components/FileUpload/FileUploadItem.js.map +1 -1
  7. package/dist/cjs/components/View/View.css +80 -0
  8. package/dist/cjs/components/View/View.js +54 -6
  9. package/dist/cjs/components/View/View.js.map +1 -1
  10. package/dist/cjs/components/View/viewNavigation.js +131 -0
  11. package/dist/cjs/components/View/viewNavigation.js.map +1 -0
  12. package/dist/esm/components/ChatMessage/ChatMessage.css +9 -0
  13. package/dist/esm/components/FileUpload/FileUpload.js +5 -1
  14. package/dist/esm/components/FileUpload/FileUpload.js.map +1 -1
  15. package/dist/esm/components/FileUpload/FileUploadItem.js +16 -2
  16. package/dist/esm/components/FileUpload/FileUploadItem.js.map +1 -1
  17. package/dist/esm/components/View/View.css +80 -0
  18. package/dist/esm/components/View/View.js +21 -3
  19. package/dist/esm/components/View/View.js.map +1 -1
  20. package/dist/esm/components/View/viewNavigation.js +126 -0
  21. package/dist/esm/components/View/viewNavigation.js.map +1 -0
  22. package/dist/styles/components/ChatMessage.css +9 -0
  23. package/dist/styles/components/View.css +80 -0
  24. package/dist/styles/index.css +6250 -6160
  25. package/dist/styles/muka-dark.css +6250 -6160
  26. package/dist/styles/muka-light.css +6250 -6160
  27. package/dist/styles/tokens-bouwplan-dark.css +1 -0
  28. package/dist/styles/tokens-bouwplan-light.css +1 -0
  29. package/dist/styles/tokens-fscl-dark.css +1 -0
  30. package/dist/styles/tokens-fscl-light.css +1 -0
  31. package/dist/styles/tokens-grip-dark.css +1 -0
  32. package/dist/styles/tokens-grip-light.css +1 -0
  33. package/dist/styles/tokens-muka-dark.css +1 -0
  34. package/dist/styles/tokens-muka-light.css +1 -0
  35. package/dist/styles/tokens-wireframe-dark.css +1 -0
  36. package/dist/styles/tokens-wireframe-light.css +1 -0
  37. package/dist/styles/wireframe-dark.css +6250 -6160
  38. package/dist/styles/wireframe-light.css +6250 -6160
  39. package/dist/types/components/FileUpload/FileUpload.d.ts +16 -2
  40. package/dist/types/components/FileUpload/FileUpload.d.ts.map +1 -1
  41. package/dist/types/components/FileUpload/FileUploadItem.d.ts +18 -2
  42. package/dist/types/components/FileUpload/FileUploadItem.d.ts.map +1 -1
  43. package/dist/types/components/View/View.d.ts +9 -2
  44. package/dist/types/components/View/View.d.ts.map +1 -1
  45. package/dist/types/components/View/viewNavigation.d.ts +46 -0
  46. package/dist/types/components/View/viewNavigation.d.ts.map +1 -0
  47. package/docs/consumers/devices.md +45 -0
  48. package/package.json +1 -1
  49. package/tokens/t4-components/chatbubble.json +4 -0
@@ -14,7 +14,15 @@ export interface UploadResult {
14
14
  export interface FileWithStatus {
15
15
  file: File;
16
16
  id: string;
17
+ /**
18
+ * Upload progress, 0-100. Absent while uploading means no progress is known
19
+ * yet: the row shows a moving bar instead of "0%".
20
+ */
17
21
  progress?: number;
22
+ /**
23
+ * `uploading` while the bytes are sent; `processing` once they are and the
24
+ * app is still working on the file (checking, converting, reading it).
25
+ */
18
26
  status: 'pending' | 'processing' | 'uploading' | 'success' | 'error';
19
27
  error?: string;
20
28
  previewUrl?: string;
@@ -71,8 +79,14 @@ export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElemen
71
79
  onFilesChange?: (files: FileWithStatus[]) => void;
72
80
  /** Callback when validation error occurs */
73
81
  onError?: (error: FileUploadError) => void;
74
- /** Upload function for each file */
75
- uploadFn?: (file: File, onProgress: (progress: number) => void) => Promise<UploadResult>;
82
+ /**
83
+ * Upload function for each file. Call `onProgress` (0-100) as bytes go out;
84
+ * until the first call the row shows a moving bar rather than "0%". Call
85
+ * `onProcessing` once the bytes are sent but the work isn't done (the server
86
+ * still checks or reads the file): the row then says "Processing…" until
87
+ * the promise settles.
88
+ */
89
+ uploadFn?: (file: File, onProgress: (progress: number) => void, onProcessing: () => void) => Promise<UploadResult>;
76
90
  /** Visual variant */
77
91
  variant?: 'dropzone' | 'button';
78
92
  /** Size variant */
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../../components/FileUpload/FileUpload.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAClF,OAAO,EACL,cAAc,EAEd,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAA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,6 +5,16 @@ export interface FileUploadItemLabels {
5
5
  preview?: (fileName: string) => string;
6
6
  /** Accessible name of the progress bar. Default "Uploading {fileName}: {percent}%". */
7
7
  uploading?: (fileName: string, percent: number) => string;
8
+ /**
9
+ * Status text while uploading before any progress is known, next to the
10
+ * file size and in the bar's accessible name. Default "Uploading…".
11
+ */
12
+ uploadingStatus?: string;
13
+ /**
14
+ * Status text once the bytes are sent and the app still works on the file,
15
+ * next to the file size and in the bar's accessible name. Default "Processing…".
16
+ */
17
+ processingStatus?: string;
8
18
  /** Accessible name of the success icon. Default "Upload complete". */
9
19
  uploadComplete?: string;
10
20
  /**
@@ -19,9 +29,15 @@ export declare const DEFAULT_FILE_UPLOAD_ITEM_LABELS: Required<FileUploadItemLab
19
29
  export interface FileUploadItemProps {
20
30
  /** The file object */
21
31
  file: File;
22
- /** Upload progress (0-100) */
32
+ /**
33
+ * Upload progress (0-100). Leave it out while uploading when no progress is
34
+ * known: the bar moves without a percentage instead of standing at 0%.
35
+ */
23
36
  progress?: number;
24
- /** Upload status */
37
+ /**
38
+ * Upload status. `processing`: the bytes are sent, the app still works on
39
+ * the file; shows a moving bar and `labels.processingStatus`.
40
+ */
25
41
  status?: 'pending' | 'processing' | 'uploading' | 'success' | 'error';
26
42
  /** Error message if upload failed */
27
43
  error?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadItem.d.ts","sourceRoot":"","sources":["../../../../components/FileUpload/FileUploadItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,sDAAsD;AACtD,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,uFAAuF;IACvF,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1D,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CA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IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CACvC;AAED,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,oBAAoB,CAQ1E,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,IAAI,EAAE,IAAI,CAAC;IAEX;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IAEtE,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,mCAAmC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAEtB,sDAAsD;IACtD,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAYD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAwGxD,CAAC;AAIF,eAAe,cAAc,CAAC"}
@@ -28,8 +28,15 @@ export interface ViewProps {
28
28
  controlBar?: React.ReactNode;
29
29
  /** Footer content (e.g. BottomBar for navigation) */
30
30
  footer?: React.ReactNode;
31
- /** View content (scrollable body) */
32
- children: React.ReactNode;
31
+ /** View content (scrollable body). Not rendered while `loading`. */
32
+ children?: React.ReactNode;
33
+ /**
34
+ * Show the view while its content loads: the TopBar (title, back button and
35
+ * actions as passed) with a skeleton body. Render it straight away on
36
+ * navigation, e.g. as a Next.js `loading.tsx`, so a tap moves to the next
37
+ * view at once instead of waiting for its data.
38
+ */
39
+ loading?: boolean;
33
40
  /** Surface elevation level for the content background (default: 2) */
34
41
  surfaceLevel?: 2 | 3;
35
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../../../components/View/View.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAU,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW,SAAS;IACxB,6CAA6C;IAC7C,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;IAErB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE/B,oFAAoF;IACpF,aAAa,CAAC,EAAE,mBAAmB,CAAC;IAEpC,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAEpE,2FAA2F;IAC3F,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,SAAS,CAAC;IAE9D,8FAA8F;IAC9F,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEpC,mDAAmD;IACnD,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE7B,qDAAqD;IACrD,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB,qCAAqC;IACrC,QAAQ,EA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AAE,KAAK,CAAC,SAAS,CAAC;IAE3B,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEpC,mDAAmD;IACnD,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE7B,qDAAqD;IACrD,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,sEAAsE;IACtE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAErB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE1B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA+BD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAwEpC,CAAC;AAaF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Native-style navigation motion for View (push and pop slides).
3
+ *
4
+ * A View that mounts during a React transition — every App Router navigation
5
+ * in Next.js is one — is wrapped in React's `<ViewTransition>`, so the browser
6
+ * animates the old and new View. The direction comes from a navigation stack
7
+ * kept here, like an iOS navigation controller:
8
+ *
9
+ * - a View already on the stack, or whose path is a parent of the current one,
10
+ * is a **pop**: the current View slides out to the right;
11
+ * - any other `sub` View is a **push**: it slides in from the right over the
12
+ * current one;
13
+ * - a `top` View after a `sub` View is a pop, after another `top` View (a tab
14
+ * switch) it is **none**: no slide, as on iOS;
15
+ * - the same path again (a loading View replaced by the loaded one) is none.
16
+ *
17
+ * The stack is used rather than history position because apps often go "back"
18
+ * with a push to the parent (`router.push('/projects')`).
19
+ *
20
+ * The direction is written to `<html data-muka-nav>` during the commit, which
21
+ * React runs inside `document.startViewTransition`'s update callback, so
22
+ * View.css can pick the animation before the browser starts it.
23
+ */
24
+ export type NavDirection = 'push' | 'pop' | 'none';
25
+ export interface NavEntry {
26
+ path: string;
27
+ level: 'top' | 'sub';
28
+ }
29
+ /**
30
+ * Work out the direction from the stack to `next`, and the stack after it.
31
+ * Pure, so it can be tested without a browser.
32
+ */
33
+ export declare function resolveNavigation(stack: readonly NavEntry[], next: NavEntry): {
34
+ direction: NavDirection;
35
+ stack: NavEntry[];
36
+ };
37
+ /**
38
+ * Called from a View's layout effect when it mounts. Every View that mounts in
39
+ * one commit reports here; the last one (the outermost, since React runs
40
+ * effects child first) decides, in a microtask that still runs before the
41
+ * browser captures the new state.
42
+ */
43
+ export declare function registerViewMount(level: 'top' | 'sub'): void;
44
+ /** Test helper: forget the stack. */
45
+ export declare function resetViewNavigation(): void;
46
+ //# sourceMappingURL=viewNavigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewNavigation.d.ts","sourceRoot":"","sources":["../../../../components/View/viewNavigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAEnD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;CACtB;AAaD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,IAAI,EAAE,QAAQ,GACb;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAwBhD;AAkCD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,QAkBrD;AAED,qCAAqC;AACrC,wBAAgB,mBAAmB,SAMlC"}
@@ -35,12 +35,57 @@ page's colour (`Page` `surface`). Give it another with a token:
35
35
  A footer with its own colour sets `Page` `footerSurface`, so that colour runs
36
36
  under the home indicator.
37
37
 
38
+ ## Moving between views
39
+
40
+ `View` moves like an iOS navigation stack, with nothing to wire up:
41
+
42
+ - Opening a `sub` View slides it in from the right over the current one.
43
+ - Going back slides it out to the right. "Back" is recognised whether it is
44
+ the browser's back, `router.back()` or a push to the parent
45
+ (`router.push('/projects')`): Muka keeps its own stack of the views shown
46
+ and treats a view already on it, or a parent path, as back.
47
+ - Switching between `top` Views (the tabs in the BottomBar) doesn't slide,
48
+ and nor does a loading View that is replaced by the loaded one.
49
+ - Below 1024px only. At the large tier the sidebar stays and views swap in
50
+ place. `prefers-reduced-motion` turns the slide off.
51
+ - A swipe back in iOS Safari, or in a web view with back gestures, plays the
52
+ system's own slide; Muka doesn't add a second one.
53
+
54
+ It uses React's `<ViewTransition>`, which the React that Next.js App Router
55
+ ships has (and React 19.3+). With an older React, views swap without motion;
56
+ nothing breaks. In browsers without the View Transitions API the same applies.
57
+
58
+ ### Navigate first, load second
59
+
60
+ A native app moves to the next screen the moment it's tapped and shows it
61
+ loading there. Give every route that loads data a loading screen that renders
62
+ the destination's View with `loading`: the TopBar (title, back button) as it
63
+ will be, with a skeleton body.
64
+
65
+ ```tsx
66
+ // app/projects/[slug]/loading.tsx
67
+ import { View } from '@revikornmann/muka-ui';
68
+ import { BackButton } from './back-button';
69
+
70
+ export default function Loading() {
71
+ return <View level="sub" leading={<BackButton />} loading />;
72
+ }
73
+ ```
74
+
75
+ In Next.js a `loading.tsx` covers only its own route segment, so a dynamic
76
+ route needs its own, not just one at the top. Without it, a tap waits for the
77
+ server before anything moves. Links prefetch the loading screen; a row that
78
+ navigates with `router.push` should call `router.prefetch` for its target, or
79
+ be a `Link`.
80
+
38
81
  ## Don't
39
82
 
40
83
  - Don't add `padding-top: env(safe-area-inset-top)` or a status-bar strip of
41
84
  your own: the components already do, and yours doubles the gap.
42
85
  - Don't pass `disableSafeArea` unless a parent of your own already handles
43
86
  that edge.
87
+ - Don't add page transitions or slide animations of your own around Views;
88
+ they run on top of Muka's.
44
89
  - Don't put a document-scrolling page in a plain `<div>` with your own header.
45
90
  Use `Page` and `SiteHeader`; if they miss something you need, it belongs in
46
91
  Muka.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revikornmann/muka-ui",
3
- "version": "0.62.0",
3
+ "version": "0.63.0",
4
4
  "description": "Muka Design System - Multi-brand design tokens and React components",
5
5
  "main": "dist/cjs/components/index.js",
6
6
  "module": "dist/esm/components/index.js",
@@ -175,6 +175,10 @@
175
175
  "gap": {
176
176
  "$type": "dimension",
177
177
  "$value": "{spacing.3}"
178
+ },
179
+ "offset": {
180
+ "$type": "dimension",
181
+ "$value": "{spacing.4}"
178
182
  }
179
183
  }
180
184
  }