@flamingo-stack/openframe-frontend-core 0.0.847 → 0.0.849

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 (188) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/{case-study-card-DJOHIHYU.cjs → case-study-card-X2HKPKT7.cjs} +5 -5
  3. package/dist/{chunk-CNMXP77I.cjs → chunk-36DUCHI7.cjs} +4 -4
  4. package/dist/{chunk-MPVOPSU6.cjs → chunk-36XWCVSM.cjs} +96 -96
  5. package/dist/{chunk-J2IXYCEH.cjs → chunk-3W4ASAXN.cjs} +15 -15
  6. package/dist/{chunk-6LDL3UZE.cjs → chunk-4YBS4HIO.cjs} +20 -20
  7. package/dist/{chunk-ABL5OBSF.cjs → chunk-533QK4R6.cjs} +296 -250
  8. package/dist/{chunk-QK2A334V.cjs → chunk-5CBI2ZYV.cjs} +12 -12
  9. package/dist/{chunk-D5DMWXF2.cjs → chunk-5PIR77V5.cjs} +4 -4
  10. package/dist/{chunk-HPXET3LH.cjs → chunk-6AJYGXXS.cjs} +27 -27
  11. package/dist/{chunk-4R4HAFXI.cjs → chunk-ALRYVZ3E.cjs} +6 -6
  12. package/dist/{chunk-FLW4WULE.cjs → chunk-BU2PSRAS.cjs} +17 -61
  13. package/dist/{chunk-HBDLJUI3.cjs → chunk-C3P7IUTU.cjs} +39 -14
  14. package/dist/{chunk-SSSI2RBV.cjs → chunk-FNQWL4W4.cjs} +14 -14
  15. package/dist/{chunk-TBOWFTEN.cjs → chunk-FRG724DU.cjs} +22 -22
  16. package/dist/{chunk-SIFRIUPW.cjs → chunk-FXLROQUT.cjs} +345 -356
  17. package/dist/{chunk-3V5JWG27.cjs → chunk-GG466XFQ.cjs} +2 -2
  18. package/dist/{chunk-XCVH5BCZ.cjs → chunk-GRCOEICK.cjs} +6 -6
  19. package/dist/{chunk-5GBLXY5F.cjs → chunk-HTYJUMFB.cjs} +7 -7
  20. package/dist/{chunk-URP6GYTD.cjs → chunk-IG6ROHPS.cjs} +56 -56
  21. package/dist/{chunk-DGQDGCQH.cjs → chunk-IHY7E4EX.cjs} +2 -2
  22. package/dist/{chunk-WCK5T3UD.cjs → chunk-IKOL6NJY.cjs} +101 -69
  23. package/dist/{chunk-RAJ5FYFL.cjs → chunk-IN3LA2FU.cjs} +14 -14
  24. package/dist/{chunk-ZTO7KNYV.cjs → chunk-KXBZCUDW.cjs} +35 -35
  25. package/dist/{chunk-57JYB3E2.cjs → chunk-MC3L525K.cjs} +3 -3
  26. package/dist/{chunk-BIOSHDXQ.cjs → chunk-MDLT6D46.cjs} +61 -61
  27. package/dist/{chunk-3TOWCFIK.cjs → chunk-PMUCEUFQ.cjs} +13 -1
  28. package/dist/{chunk-PV3NKXWS.cjs → chunk-PV2XQJ2R.cjs} +99 -178
  29. package/dist/{chunk-J2ZSGOUC.cjs → chunk-R5JPZ6TY.cjs} +27 -27
  30. package/dist/{chunk-744JXTDP.cjs → chunk-SA2NNWIJ.cjs} +23 -23
  31. package/dist/{chunk-DEEQSVLX.cjs → chunk-SHQY4GOE.cjs} +90 -90
  32. package/dist/{chunk-BHOVF4KP.cjs → chunk-SOSIXRQ3.cjs} +2 -2
  33. package/dist/{chunk-Y2OEC7UW.cjs → chunk-TEKN6TJ5.cjs} +40 -40
  34. package/dist/{chunk-PZNWIJRZ.cjs → chunk-TIVPOVIM.cjs} +2 -2
  35. package/dist/{chunk-BZZE4KIV.cjs → chunk-TX4NTH22.cjs} +155 -136
  36. package/dist/{chunk-NFNSPLGC.cjs → chunk-W7OFAROY.cjs} +14 -9
  37. package/dist/{chunk-N2A24FDF.cjs → chunk-YLETC7LP.cjs} +994 -953
  38. package/dist/{chunk-YC52LSPP.cjs → chunk-YYHQY3K6.cjs} +40 -40
  39. package/dist/{chunk-2FUTZKLB.cjs → chunk-Z5UCDEKZ.cjs} +6 -6
  40. package/dist/{chunk-SWF6TNZ3.cjs → chunk-ZGEWT3SF.cjs} +2 -2
  41. package/dist/{chunk-PQDCSZ3W.cjs → chunk-ZY34R37A.cjs} +85 -85
  42. package/dist/{chunk-5SZ4ILU3.cjs → chunk-ZZDFMUEU.cjs} +3 -3
  43. package/dist/{cloud-tenants-XEUUMABT.cjs → cloud-tenants-HKUUEUAY.cjs} +21 -21
  44. package/dist/components/case-studies/index.cjs +36 -36
  45. package/dist/components/chat/chat-composer.d.ts.map +1 -1
  46. package/dist/components/chat/chat-composer.js +4 -3
  47. package/dist/components/chat/chat-container.d.ts.map +1 -1
  48. package/dist/components/chat/chat-container.js +2 -2
  49. package/dist/components/chat/entity-cards/design-doc-card.d.ts.map +1 -1
  50. package/dist/components/chat/entity-cards/design-doc-card.js +5 -17
  51. package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
  52. package/dist/components/chat/entity-cards/dispatch.js +5 -7
  53. package/dist/components/chat/index.cjs +15 -15
  54. package/dist/components/contact/index.cjs +22 -22
  55. package/dist/components/docs/doc-viewer.d.ts +7 -7
  56. package/dist/components/docs/doc-viewer.d.ts.map +1 -1
  57. package/dist/components/docs/doc-viewer.js +29 -16
  58. package/dist/components/docs/docs-hub-page.d.ts +1 -1
  59. package/dist/components/docs/docs-hub-page.d.ts.map +1 -1
  60. package/dist/components/docs/docs-hub-page.js +4 -11
  61. package/dist/components/docs/index.cjs +25 -25
  62. package/dist/components/docs/use-document-tree.d.ts.map +1 -1
  63. package/dist/components/docs/use-document-tree.js +24 -24
  64. package/dist/components/embeds/claude-embed.d.ts +2 -2
  65. package/dist/components/embeds/claude-embed.d.ts.map +1 -1
  66. package/dist/components/embeds/claude-embed.js +3 -3
  67. package/dist/components/embeds/embed-iframe.d.ts +5 -3
  68. package/dist/components/embeds/embed-iframe.d.ts.map +1 -1
  69. package/dist/components/embeds/embed-iframe.js +4 -3
  70. package/dist/components/embeds/embed-viewer-frame.d.ts +12 -9
  71. package/dist/components/embeds/embed-viewer-frame.d.ts.map +1 -1
  72. package/dist/components/embeds/embed-viewer-frame.js +21 -7
  73. package/dist/components/embeds/figma-embed.d.ts +4 -2
  74. package/dist/components/embeds/figma-embed.d.ts.map +1 -1
  75. package/dist/components/embeds/figma-embed.js +4 -3
  76. package/dist/components/embeds/file-download-card.d.ts +3 -1
  77. package/dist/components/embeds/file-download-card.d.ts.map +1 -1
  78. package/dist/components/embeds/file-download-card.js +18 -3
  79. package/dist/components/embeds/google-sheets-viewer.d.ts +3 -1
  80. package/dist/components/embeds/google-sheets-viewer.d.ts.map +1 -1
  81. package/dist/components/embeds/google-sheets-viewer.js +7 -4
  82. package/dist/components/embeds/index.cjs +22 -22
  83. package/dist/components/embeds/pdf-viewer.d.ts +3 -1
  84. package/dist/components/embeds/pdf-viewer.d.ts.map +1 -1
  85. package/dist/components/embeds/pdf-viewer.js +6 -2
  86. package/dist/components/faq/index.cjs +23 -23
  87. package/dist/components/features/index.cjs +21 -21
  88. package/dist/components/features/status-filter-component.d.ts +7 -1
  89. package/dist/components/features/status-filter-component.d.ts.map +1 -1
  90. package/dist/components/features/status-filter-component.js +9 -3
  91. package/dist/components/help-center-pages/index.cjs +140 -140
  92. package/dist/components/index.cjs +137 -135
  93. package/dist/components/layout/back-button.d.ts +7 -1
  94. package/dist/components/layout/back-button.d.ts.map +1 -1
  95. package/dist/components/layout/back-button.js +34 -2
  96. package/dist/components/loading/unified-skeleton.d.ts +6 -1
  97. package/dist/components/loading/unified-skeleton.d.ts.map +1 -1
  98. package/dist/components/loading/unified-skeleton.js +13 -1
  99. package/dist/components/meeting-scheduler/index.cjs +119 -119
  100. package/dist/components/navigation/index.cjs +24 -24
  101. package/dist/components/onboarding-guides/index.cjs +24 -24
  102. package/dist/components/product-demo/index.cjs +33 -33
  103. package/dist/components/related-content/index.cjs +11 -11
  104. package/dist/components/tickets/index.cjs +28 -28
  105. package/dist/components/ui/file-manager/file-manager-table.d.ts.map +1 -1
  106. package/dist/components/ui/file-manager/file-manager-table.js +59 -50
  107. package/dist/components/ui/file-manager/index.cjs +71 -62
  108. package/dist/components/ui/index.cjs +23 -21
  109. package/dist/components/ui/markdown/engine.d.ts +5 -4
  110. package/dist/components/ui/markdown/engine.d.ts.map +1 -1
  111. package/dist/components/ui/markdown/engine.js +15 -15
  112. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +1 -1
  113. package/dist/components/ui/markdown/rich/rich-markdown-renderer.js +7 -3
  114. package/dist/components/ui/people-cell.d.ts +9 -2
  115. package/dist/components/ui/people-cell.d.ts.map +1 -1
  116. package/dist/components/ui/people-cell.js +39 -23
  117. package/dist/components/ui/progress-bar.d.ts +6 -0
  118. package/dist/components/ui/progress-bar.d.ts.map +1 -1
  119. package/dist/components/ui/progress-bar.js +2 -0
  120. package/dist/components/ui/tag.d.ts +8 -0
  121. package/dist/components/ui/tag.d.ts.map +1 -1
  122. package/dist/components/ui/tag.js +5 -0
  123. package/dist/{devices-7YDIHVVP.cjs → devices-P7M4Z7VP.cjs} +22 -22
  124. package/dist/embed-shims/index.cjs +3 -3
  125. package/dist/embed-shims/next-image.cjs +3 -3
  126. package/dist/{embeddable-chat-Z3S37SSM.cjs → embeddable-chat-322NDFP5.cjs} +94 -94
  127. package/dist/hooks/index.cjs +6 -6
  128. package/dist/index.cjs +32 -30
  129. package/dist/{knowledge-SQVPQSKM.cjs → knowledge-TC7JLOWI.cjs} +22 -22
  130. package/dist/{logs-M5DFGUBC.cjs → logs-GPOYCP4B.cjs} +28 -28
  131. package/dist/{policies-T3VQEJUD.cjs → policies-ZUHOUMDD.cjs} +25 -25
  132. package/dist/{remote-session-EE6477O3.cjs → remote-session-NT4NG7EF.cjs} +10 -10
  133. package/dist/{scripts-JFRFJKPH.cjs → scripts-FOEVDGTH.cjs} +28 -28
  134. package/dist/{software-update-E7W3AAIY.cjs → software-update-XGTMNFST.cjs} +25 -25
  135. package/dist/{tickets-board-44HO3LR4.cjs → tickets-board-7FLGQEHF.cjs} +10 -10
  136. package/dist/types/design-doc.d.ts +45 -8
  137. package/dist/types/design-doc.d.ts.map +1 -1
  138. package/dist/types/doc-source.d.ts +2 -2
  139. package/dist/types/doc-source.d.ts.map +1 -1
  140. package/dist/utils/design-doc-readiness.d.ts +17 -15
  141. package/dist/utils/design-doc-readiness.d.ts.map +1 -1
  142. package/dist/utils/design-doc-readiness.js +5 -11
  143. package/dist/utils/doc-tree-nav.d.ts +7 -0
  144. package/dist/utils/doc-tree-nav.d.ts.map +1 -1
  145. package/dist/utils/doc-tree-nav.js +19 -0
  146. package/dist/utils/index.cjs +30 -13
  147. package/dist/utils/list-url.d.ts.map +1 -1
  148. package/dist/utils/list-url.js +2 -1
  149. package/dist/utils/source-grouping.d.ts +2 -2
  150. package/dist/utils/source-grouping.d.ts.map +1 -1
  151. package/dist/utils/source-grouping.js +1 -1
  152. package/dist/utils/source-icons.d.ts.map +1 -1
  153. package/dist/utils/source-icons.js +3 -0
  154. package/package.json +1 -1
  155. package/src/components/chat/chat-composer.tsx +10 -3
  156. package/src/components/chat/chat-container.tsx +6 -4
  157. package/src/components/chat/entity-cards/design-doc-card.tsx +12 -17
  158. package/src/components/chat/entity-cards/dispatch.tsx +10 -10
  159. package/src/components/docs/doc-viewer.tsx +56 -35
  160. package/src/components/docs/docs-hub-page.tsx +13 -37
  161. package/src/components/docs/use-document-tree.ts +33 -23
  162. package/src/components/embeds/claude-embed.tsx +4 -4
  163. package/src/components/embeds/embed-iframe.tsx +8 -5
  164. package/src/components/embeds/embed-viewer-frame.tsx +35 -15
  165. package/src/components/embeds/figma-embed.tsx +9 -4
  166. package/src/components/embeds/file-download-card.tsx +28 -4
  167. package/src/components/embeds/google-sheets-viewer.tsx +9 -3
  168. package/src/components/embeds/pdf-viewer.tsx +9 -2
  169. package/src/components/features/status-filter-component.tsx +15 -0
  170. package/src/components/layout/back-button.tsx +54 -2
  171. package/src/components/loading/unified-skeleton.tsx +18 -2
  172. package/src/components/ui/file-manager/file-manager-table.tsx +8 -3
  173. package/src/components/ui/markdown/engine.tsx +21 -30
  174. package/src/components/ui/markdown/rich/rich-markdown-renderer.tsx +4 -0
  175. package/src/components/ui/people-cell.tsx +53 -17
  176. package/src/components/ui/progress-bar.tsx +8 -0
  177. package/src/components/ui/tag.tsx +14 -0
  178. package/src/types/design-doc.ts +59 -10
  179. package/src/types/doc-source.ts +2 -2
  180. package/src/utils/design-doc-readiness.ts +22 -23
  181. package/src/utils/doc-tree-nav.ts +27 -0
  182. package/src/utils/list-url.ts +2 -1
  183. package/src/utils/source-grouping.ts +2 -2
  184. package/src/utils/source-icons.ts +3 -0
  185. package/dist/components/docs/skeletons.d.ts +0 -25
  186. package/dist/components/docs/skeletons.d.ts.map +0 -1
  187. package/dist/components/docs/skeletons.js +0 -83
  188. package/src/components/docs/skeletons.tsx +0 -131
@@ -1,83 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { cn } from "../../utils/cn.js";
4
- import { EmbedLoadingSkeleton } from "../embeds/embed-iframe.js";
5
- import { LoadingRegion } from "../loading/loading-region.js";
6
- import { TextLineSkeleton, UnifiedSkeleton } from "../loading/unified-skeleton.js";
7
- import { MARKDOWN_H2_CLASS, MARKDOWN_PARAGRAPH_CLASS } from "../ui/markdown/base-components.js";
8
- import { MARKDOWN_RENDERER_CLASS } from "../ui/markdown/engine.js";
9
- import { TEXT_SIZE_PRESETS } from "../ui/markdown/text-size.js";
10
- const MARKDOWN_SKELETON_BLOCKS = [
11
- { kind: "p", lines: 4 },
12
- { kind: "p", lines: 4 },
13
- { kind: "p", lines: 5 },
14
- { kind: "h2" },
15
- { kind: "p", lines: 4 },
16
- { kind: "p", lines: 5 },
17
- { kind: "h2" },
18
- { kind: "p", lines: 3 },
19
- { kind: "p", lines: 4 }
20
- ];
21
- const MARKDOWN_SKELETON_H2_CLASS = cn(MARKDOWN_H2_CLASS, TEXT_SIZE_PRESETS.default.h2);
22
- const MARKDOWN_SKELETON_P_CLASS = cn(MARKDOWN_PARAGRAPH_CLASS, TEXT_SIZE_PRESETS.default.p);
23
- function MarkdownSkeleton({
24
- region = true
25
- } = {}) {
26
- return (
27
- // The renderer's root class, and its box (no margin of its own, like the rendered body): the document's first fold.
28
- /* @__PURE__ */ jsx(LoadingRegion, { label: "Loading the document", announce: region, className: MARKDOWN_RENDERER_CLASS, children: MARKDOWN_SKELETON_BLOCKS.map(
29
- (block, i) => block.kind === "h2" ? (
30
- // biome-ignore lint/suspicious/noArrayIndexKey: skeleton blocks never reorder
31
- /* @__PURE__ */ jsx("h2", { className: MARKDOWN_SKELETON_H2_CLASS, "aria-hidden": true, children: /* @__PURE__ */ jsx(TextLineSkeleton, { type: "inherit", as: "span", className: "w-1/3" }) }, i)
32
- ) : (
33
- // The last block ends the body with no margin, like the rendered one. Its own `last:mb-0` does not apply here:
34
- // the region's status line follows the blocks, so the paragraph is not the last child.
35
- // biome-ignore lint/suspicious/noArrayIndexKey: skeleton blocks never reorder
36
- /* @__PURE__ */ jsx(
37
- "p",
38
- {
39
- className: cn(MARKDOWN_SKELETON_P_CLASS, i === MARKDOWN_SKELETON_BLOCKS.length - 1 && "mb-0"),
40
- "aria-hidden": true,
41
- children: /* @__PURE__ */ jsx(TextLineSkeleton, { type: "inherit", as: "span", lines: block.lines, className: "w-full" })
42
- },
43
- i
44
- )
45
- )
46
- ) })
47
- );
48
- }
49
- function EmbedSkeleton({ documentType, region = true } = {}) {
50
- if (documentType === "file") {
51
- return /* @__PURE__ */ jsx(
52
- LoadingRegion,
53
- {
54
- label: "Loading the document",
55
- announce: region,
56
- className: "flex flex-col items-center justify-center py-16",
57
- children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md space-y-4 rounded-xl border border-ods-border bg-ods-card p-8 text-center", children: [
58
- /* @__PURE__ */ jsx(UnifiedSkeleton, { className: "mx-auto h-16 w-16 rounded" }),
59
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
60
- /* @__PURE__ */ jsx(UnifiedSkeleton, { className: "mx-auto h-5 w-2/3 rounded" }),
61
- /* @__PURE__ */ jsx(UnifiedSkeleton, { className: "mx-auto h-4 w-1/2 rounded" })
62
- ] }),
63
- /* @__PURE__ */ jsx(UnifiedSkeleton, { className: "h-10 w-full rounded" })
64
- ] })
65
- }
66
- );
67
- }
68
- const buttonCount = documentType === "pdf" ? 2 : 1;
69
- return /* @__PURE__ */ jsxs(LoadingRegion, { label: "Loading the document", announce: region, className: "space-y-4", children: [
70
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 content-sm:flex-row content-sm:items-center content-sm:justify-between", children: [
71
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
72
- /* @__PURE__ */ jsx(UnifiedSkeleton, { className: "h-5 w-5 shrink-0 rounded" }),
73
- /* @__PURE__ */ jsx(UnifiedSkeleton, { className: "h-6 w-2/3 rounded" })
74
- ] }),
75
- /* @__PURE__ */ jsx("div", { className: "flex w-full items-center gap-2 content-sm:w-auto", children: Array.from({ length: buttonCount }).map((_, i) => /* @__PURE__ */ jsx(UnifiedSkeleton, { className: "h-10 w-full flex-1 rounded content-sm:w-32 content-sm:flex-initial" }, i)) })
76
- ] }),
77
- /* @__PURE__ */ jsx(EmbedLoadingSkeleton, { region: false })
78
- ] });
79
- }
80
- export {
81
- EmbedSkeleton,
82
- MarkdownSkeleton
83
- };
@@ -1,131 +0,0 @@
1
- import { cn } from '../../utils/cn';
2
- import { EmbedLoadingSkeleton } from '../embeds/embed-iframe';
3
- import { LoadingRegion } from '../loading/loading-region';
4
- import { TextLineSkeleton, UnifiedSkeleton } from '../loading/unified-skeleton';
5
- import { MARKDOWN_H2_CLASS, MARKDOWN_PARAGRAPH_CLASS } from '../ui/markdown/base-components';
6
- import { MARKDOWN_RENDERER_CLASS } from '../ui/markdown/engine';
7
- import { TEXT_SIZE_PRESETS } from '../ui/markdown/text-size';
8
- /**
9
- * Text-style skeleton — matches a rendered markdown article layout.
10
- * Used by `<DocsHubPage>` as the default for `markdown` (and unknown
11
- * document types). Embedders can override via `renderSkeleton`.
12
- */
13
- /** Paragraphs and headings the markdown skeleton draws (a document's first fold), with each paragraph's lines. */
14
- const MARKDOWN_SKELETON_BLOCKS = [
15
- { kind: 'p', lines: 4 },
16
- { kind: 'p', lines: 4 },
17
- { kind: 'p', lines: 5 },
18
- { kind: 'h2' },
19
- { kind: 'p', lines: 4 },
20
- { kind: 'p', lines: 5 },
21
- { kind: 'h2' },
22
- { kind: 'p', lines: 3 },
23
- { kind: 'p', lines: 4 },
24
- ] as const;
25
- const MARKDOWN_SKELETON_H2_CLASS = cn(MARKDOWN_H2_CLASS, TEXT_SIZE_PRESETS.default.h2);
26
- const MARKDOWN_SKELETON_P_CLASS = cn(MARKDOWN_PARAGRAPH_CLASS, TEXT_SIZE_PRESETS.default.p);
27
-
28
- export function MarkdownSkeleton({
29
- region = true,
30
- }: {
31
- /** The loading state announces itself (`LoadingRegion`). `false` inside another loading region. Default `true`. */
32
- region?: boolean;
33
- } = {}) {
34
- // The rendered document's own heading and paragraph elements (the markdown renderer's default preset), each line a
35
- // bar of the element's line box.
36
- return (
37
- // The renderer's root class, and its box (no margin of its own, like the rendered body): the document's first fold.
38
- <LoadingRegion label="Loading the document" announce={region} className={MARKDOWN_RENDERER_CLASS}>
39
- {MARKDOWN_SKELETON_BLOCKS.map((block, i) =>
40
- block.kind === 'h2' ? (
41
- // biome-ignore lint/suspicious/noArrayIndexKey: skeleton blocks never reorder
42
- <h2 key={i} className={MARKDOWN_SKELETON_H2_CLASS} aria-hidden>
43
- <TextLineSkeleton type="inherit" as="span" className="w-1/3" />
44
- </h2>
45
- ) : (
46
- // The last block ends the body with no margin, like the rendered one. Its own `last:mb-0` does not apply here:
47
- // the region's status line follows the blocks, so the paragraph is not the last child.
48
- // biome-ignore lint/suspicious/noArrayIndexKey: skeleton blocks never reorder
49
- <p
50
- key={i}
51
- className={cn(MARKDOWN_SKELETON_P_CLASS, i === MARKDOWN_SKELETON_BLOCKS.length - 1 && 'mb-0')}
52
- aria-hidden
53
- >
54
- <TextLineSkeleton type="inherit" as="span" lines={block.lines} className="w-full" />
55
- </p>
56
- ),
57
- )}
58
- </LoadingRegion>
59
- );
60
- }
61
-
62
- /**
63
- * Embed-style skeleton — matches the iframe loading state for `pdf`,
64
- * `google_sheet`, `figma`, and `file` document types. Used by
65
- * `<DocsHubPage>` as the default for non-markdown documentTypes.
66
- *
67
- * The skeleton is documentType-aware so its layout matches the actual
68
- * viewer that will replace it:
69
- * - `pdf` → header with title + TWO buttons (Preview, Download)
70
- * - `google_sheet`/`figma` → header with title + ONE button/toggle
71
- * - `file` → centered FileDownloadCard-style box
72
- * - undefined / others → generic (1-button header)
73
- */
74
- export interface EmbedSkeletonProps {
75
- /** When provided, the header layout matches the eventual viewer's
76
- * button count + arrangement, so the layout doesn't shift on load. */
77
- documentType?: 'pdf' | 'google_sheet' | 'figma' | 'file' | string;
78
- /** The loading state announces itself (`LoadingRegion`). `false` inside another loading region. Default `true`. */
79
- region?: boolean;
80
- }
81
-
82
- export function EmbedSkeleton({ documentType, region = true }: EmbedSkeletonProps = {}) {
83
- // Centered card shape for the `file` documentType — matches
84
- // `<FileDownloadCard>`'s `flex flex-col items-center justify-center py-16`
85
- // + bordered card with icon, name, type/size row, Download button.
86
- if (documentType === 'file') {
87
- return (
88
- <LoadingRegion
89
- label="Loading the document"
90
- announce={region}
91
- className="flex flex-col items-center justify-center py-16"
92
- >
93
- <div className="w-full max-w-md space-y-4 rounded-xl border border-ods-border bg-ods-card p-8 text-center">
94
- <UnifiedSkeleton className="mx-auto h-16 w-16 rounded" />
95
- <div className="space-y-2">
96
- <UnifiedSkeleton className="mx-auto h-5 w-2/3 rounded" />
97
- <UnifiedSkeleton className="mx-auto h-4 w-1/2 rounded" />
98
- </div>
99
- <UnifiedSkeleton className="h-10 w-full rounded" />
100
- </div>
101
- </LoadingRegion>
102
- );
103
- }
104
-
105
- // PDF viewer has TWO buttons (Preview + Download); Sheets / Figma
106
- // render ONE (Open / view-toggle). Default to one for unknown types.
107
- const buttonCount = documentType === 'pdf' ? 2 : 1;
108
-
109
- return (
110
- <LoadingRegion label="Loading the document" announce={region} className="space-y-4">
111
- {/* Header — matches the actual viewer's
112
- * `flex flex-col gap-3 content-sm:flex-row content-sm:items-center content-sm:justify-between`
113
- * (mobile-stacked, desktop-row). */}
114
- <div className="flex flex-col gap-3 content-sm:flex-row content-sm:items-center content-sm:justify-between">
115
- {/* Left: icon + title */}
116
- <div className="flex min-w-0 flex-1 items-center gap-2">
117
- <UnifiedSkeleton className="h-5 w-5 shrink-0 rounded" />
118
- <UnifiedSkeleton className="h-6 w-2/3 rounded" />
119
- </div>
120
- {/* Right: 1 or 2 buttons. Mobile = full-width; desktop = auto. */}
121
- <div className="flex w-full items-center gap-2 content-sm:w-auto">
122
- {Array.from({ length: buttonCount }).map((_, i) => (
123
- <UnifiedSkeleton key={i} className="h-10 w-full flex-1 rounded content-sm:w-32 content-sm:flex-initial" />
124
- ))}
125
- </div>
126
- </div>
127
- {/* Body: the iframe viewer's own loading box (its default `calc(100vh - 250px)` height). */}
128
- <EmbedLoadingSkeleton region={false} />
129
- </LoadingRegion>
130
- );
131
- }