@flamingo-stack/openframe-frontend-core 0.0.622 → 0.0.623-snapshot.20260914025439

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 (146) hide show
  1. package/dist/{chunk-DV7IBKJI.cjs → chunk-2MMEPNSX.cjs} +8 -8
  2. package/dist/{chunk-DV7IBKJI.cjs.map → chunk-2MMEPNSX.cjs.map} +1 -1
  3. package/dist/{chunk-F4GW2DPW.js → chunk-56CBPVCF.js} +5 -5
  4. package/dist/{chunk-CLPPOP5T.cjs → chunk-5JOKGJSG.cjs} +11 -11
  5. package/dist/{chunk-CLPPOP5T.cjs.map → chunk-5JOKGJSG.cjs.map} +1 -1
  6. package/dist/{chunk-C6Y5FZMJ.cjs → chunk-AO6CJFQU.cjs} +18 -18
  7. package/dist/{chunk-C6Y5FZMJ.cjs.map → chunk-AO6CJFQU.cjs.map} +1 -1
  8. package/dist/{chunk-2BJONQDE.cjs → chunk-BC4GLCNE.cjs} +42 -42
  9. package/dist/{chunk-2BJONQDE.cjs.map → chunk-BC4GLCNE.cjs.map} +1 -1
  10. package/dist/{chunk-XAUPFCIJ.js → chunk-BXKM4GFD.js} +9 -2
  11. package/dist/chunk-BXKM4GFD.js.map +1 -0
  12. package/dist/{chunk-IP4OYYDY.cjs → chunk-C4Y3TEKO.cjs} +174 -174
  13. package/dist/{chunk-IP4OYYDY.cjs.map → chunk-C4Y3TEKO.cjs.map} +1 -1
  14. package/dist/{chunk-QUL55PJP.js → chunk-CP4YNYQA.js} +4 -4
  15. package/dist/{chunk-KTYYH3JV.cjs → chunk-D3IW3CSH.cjs} +5 -5
  16. package/dist/{chunk-KTYYH3JV.cjs.map → chunk-D3IW3CSH.cjs.map} +1 -1
  17. package/dist/{chunk-6TML2UIF.cjs → chunk-DPFMA6JD.cjs} +63 -63
  18. package/dist/{chunk-6TML2UIF.cjs.map → chunk-DPFMA6JD.cjs.map} +1 -1
  19. package/dist/{chunk-ME4C6DYA.cjs → chunk-DY4XQFGC.cjs} +12 -12
  20. package/dist/{chunk-ME4C6DYA.cjs.map → chunk-DY4XQFGC.cjs.map} +1 -1
  21. package/dist/{chunk-43JQ3SJS.js → chunk-EW6PYGB3.js} +2 -2
  22. package/dist/{chunk-EQ7AOKFK.js → chunk-F2G5BTBR.js} +9 -9
  23. package/dist/{chunk-A7TZZQGS.js → chunk-GRZHXAX6.js} +2 -2
  24. package/dist/{chunk-CKL3UD5N.js → chunk-HAYYFOUU.js} +4 -4
  25. package/dist/{chunk-HC6FZJMM.cjs → chunk-ISXADEGT.cjs} +39 -39
  26. package/dist/{chunk-HC6FZJMM.cjs.map → chunk-ISXADEGT.cjs.map} +1 -1
  27. package/dist/{chunk-KDZLAUHJ.cjs → chunk-IUMRVY4I.cjs} +28 -28
  28. package/dist/{chunk-KDZLAUHJ.cjs.map → chunk-IUMRVY4I.cjs.map} +1 -1
  29. package/dist/{chunk-PDGVOZCD.cjs → chunk-JEMBYNOG.cjs} +6 -6
  30. package/dist/{chunk-PDGVOZCD.cjs.map → chunk-JEMBYNOG.cjs.map} +1 -1
  31. package/dist/{chunk-7E24VV6D.js → chunk-JT4FL2DK.js} +8 -8
  32. package/dist/{chunk-IQNG52SU.js → chunk-KEHI5NAD.js} +189 -140
  33. package/dist/{chunk-IQNG52SU.js.map → chunk-KEHI5NAD.js.map} +1 -1
  34. package/dist/{chunk-NFITQGUP.js → chunk-KKD35GSD.js} +4 -4
  35. package/dist/{chunk-EYFFIJEY.js → chunk-LDR3QNOT.js} +3 -3
  36. package/dist/{chunk-CS7MVDUF.cjs → chunk-MP2K44EK.cjs} +8 -8
  37. package/dist/{chunk-CS7MVDUF.cjs.map → chunk-MP2K44EK.cjs.map} +1 -1
  38. package/dist/{chunk-RGVXFAWM.cjs → chunk-N3CTSPDZ.cjs} +3 -3
  39. package/dist/{chunk-RGVXFAWM.cjs.map → chunk-N3CTSPDZ.cjs.map} +1 -1
  40. package/dist/{chunk-IZ5GI3FP.cjs → chunk-NOQDSRSK.cjs} +11 -11
  41. package/dist/{chunk-IZ5GI3FP.cjs.map → chunk-NOQDSRSK.cjs.map} +1 -1
  42. package/dist/{chunk-5QUBQ4WP.js → chunk-NULR47FR.js} +4 -4
  43. package/dist/{chunk-7EV2UHWQ.cjs → chunk-OKMMP5PU.cjs} +734 -685
  44. package/dist/chunk-OKMMP5PU.cjs.map +1 -0
  45. package/dist/{chunk-Q2NPL4FU.cjs → chunk-OYP7ZNHW.cjs} +24 -24
  46. package/dist/{chunk-Q2NPL4FU.cjs.map → chunk-OYP7ZNHW.cjs.map} +1 -1
  47. package/dist/{chunk-CFZUWKQF.js → chunk-Q6QF35QE.js} +6 -6
  48. package/dist/{chunk-L4FR7YIS.js → chunk-QHH2GXHS.js} +3 -3
  49. package/dist/{chunk-VRUJPZ2C.js → chunk-RFUYCKBZ.js} +3 -3
  50. package/dist/{chunk-QCZMCOAD.cjs → chunk-TTSGX6AB.cjs} +33 -33
  51. package/dist/{chunk-QCZMCOAD.cjs.map → chunk-TTSGX6AB.cjs.map} +1 -1
  52. package/dist/{chunk-5G3L6327.cjs → chunk-U7TTQV4N.cjs} +3 -3
  53. package/dist/{chunk-5G3L6327.cjs.map → chunk-U7TTQV4N.cjs.map} +1 -1
  54. package/dist/{chunk-7OYQ6RVB.cjs → chunk-WKDNZXJK.cjs} +94 -94
  55. package/dist/{chunk-7OYQ6RVB.cjs.map → chunk-WKDNZXJK.cjs.map} +1 -1
  56. package/dist/{chunk-CJBSU3XB.cjs → chunk-WRJVEB2J.cjs} +9 -2
  57. package/dist/chunk-WRJVEB2J.cjs.map +1 -0
  58. package/dist/{chunk-YEIX26DQ.js → chunk-WSEDVYDY.js} +6 -6
  59. package/dist/{chunk-VBIFSOPQ.js → chunk-X3LC6R37.js} +3 -3
  60. package/dist/{chunk-5WGOAJ4B.js → chunk-X7LJRNMJ.js} +2 -2
  61. package/dist/{chunk-EG4IKWY4.cjs → chunk-YB6RCW77.cjs} +7 -7
  62. package/dist/{chunk-EG4IKWY4.cjs.map → chunk-YB6RCW77.cjs.map} +1 -1
  63. package/dist/{chunk-5YVZQVSR.js → chunk-YBEAX6QC.js} +5 -5
  64. package/dist/{chunk-FHR2JU2J.js → chunk-YQCA4ZEJ.js} +2 -2
  65. package/dist/{chunk-TMGTVVE2.js → chunk-YWFMYZ4G.js} +3 -3
  66. package/dist/{chunk-OHJZD7QU.js → chunk-ZYPB57IM.js} +4 -4
  67. package/dist/{chunk-O3P2INXM.cjs → chunk-ZZECM2I2.cjs} +27 -27
  68. package/dist/{chunk-O3P2INXM.cjs.map → chunk-ZZECM2I2.cjs.map} +1 -1
  69. package/dist/components/calendar.cjs +4 -4
  70. package/dist/components/calendar.js +1 -1
  71. package/dist/components/case-studies/index.cjs +12 -12
  72. package/dist/components/case-studies/index.js +6 -6
  73. package/dist/components/chat/index.cjs +4 -4
  74. package/dist/components/chat/index.js +3 -3
  75. package/dist/components/contact/index.cjs +7 -7
  76. package/dist/components/contact/index.js +6 -6
  77. package/dist/components/docs/index.cjs +10 -10
  78. package/dist/components/docs/index.js +9 -9
  79. package/dist/components/embeds/index.cjs +7 -7
  80. package/dist/components/embeds/index.js +6 -6
  81. package/dist/components/faq/index.cjs +7 -7
  82. package/dist/components/faq/index.js +6 -6
  83. package/dist/components/features/command-box.d.ts +11 -1
  84. package/dist/components/features/command-box.d.ts.map +1 -1
  85. package/dist/components/features/index.cjs +6 -6
  86. package/dist/components/features/index.js +5 -5
  87. package/dist/components/help-center-pages/index.cjs +28 -28
  88. package/dist/components/help-center-pages/index.js +19 -19
  89. package/dist/components/index.cjs +70 -70
  90. package/dist/components/index.js +19 -19
  91. package/dist/components/meeting-scheduler/index.cjs +46 -46
  92. package/dist/components/meeting-scheduler/index.js +7 -7
  93. package/dist/components/navigation/index.cjs +9 -9
  94. package/dist/components/navigation/index.js +8 -8
  95. package/dist/components/onboarding-guides/index.cjs +9 -9
  96. package/dist/components/onboarding-guides/index.js +8 -8
  97. package/dist/components/related-content/index.cjs +5 -5
  98. package/dist/components/related-content/index.js +4 -4
  99. package/dist/components/tickets/index.cjs +11 -11
  100. package/dist/components/tickets/index.js +10 -10
  101. package/dist/components/ui/button/button-styles.d.ts +1 -0
  102. package/dist/components/ui/button/button-styles.d.ts.map +1 -1
  103. package/dist/components/ui/button/button.d.ts +1 -1
  104. package/dist/components/ui/button/button.d.ts.map +1 -1
  105. package/dist/components/ui/fade-preview.d.ts +25 -7
  106. package/dist/components/ui/fade-preview.d.ts.map +1 -1
  107. package/dist/components/ui/file-manager/index.cjs +11 -11
  108. package/dist/components/ui/file-manager/index.js +1 -1
  109. package/dist/components/ui/index.cjs +6 -6
  110. package/dist/components/ui/index.js +5 -5
  111. package/dist/components/ui/page-actions.d.ts +2 -2
  112. package/dist/components/ui/page-actions.d.ts.map +1 -1
  113. package/dist/index.cjs +10 -10
  114. package/dist/index.js +9 -9
  115. package/package.json +1 -1
  116. package/src/components/features/.command-box.md +2 -1
  117. package/src/components/features/command-box.tsx +36 -3
  118. package/src/components/ui/.fade-preview.md +5 -1
  119. package/src/components/ui/button/button-styles.ts +6 -0
  120. package/src/components/ui/button/button.tsx +1 -0
  121. package/src/components/ui/fade-preview.tsx +92 -20
  122. package/src/components/ui/page-actions.tsx +2 -2
  123. package/src/stories/Button.stories.tsx +6 -1
  124. package/dist/chunk-7EV2UHWQ.cjs.map +0 -1
  125. package/dist/chunk-CJBSU3XB.cjs.map +0 -1
  126. package/dist/chunk-XAUPFCIJ.js.map +0 -1
  127. /package/dist/{chunk-F4GW2DPW.js.map → chunk-56CBPVCF.js.map} +0 -0
  128. /package/dist/{chunk-QUL55PJP.js.map → chunk-CP4YNYQA.js.map} +0 -0
  129. /package/dist/{chunk-43JQ3SJS.js.map → chunk-EW6PYGB3.js.map} +0 -0
  130. /package/dist/{chunk-EQ7AOKFK.js.map → chunk-F2G5BTBR.js.map} +0 -0
  131. /package/dist/{chunk-A7TZZQGS.js.map → chunk-GRZHXAX6.js.map} +0 -0
  132. /package/dist/{chunk-CKL3UD5N.js.map → chunk-HAYYFOUU.js.map} +0 -0
  133. /package/dist/{chunk-7E24VV6D.js.map → chunk-JT4FL2DK.js.map} +0 -0
  134. /package/dist/{chunk-NFITQGUP.js.map → chunk-KKD35GSD.js.map} +0 -0
  135. /package/dist/{chunk-EYFFIJEY.js.map → chunk-LDR3QNOT.js.map} +0 -0
  136. /package/dist/{chunk-5QUBQ4WP.js.map → chunk-NULR47FR.js.map} +0 -0
  137. /package/dist/{chunk-CFZUWKQF.js.map → chunk-Q6QF35QE.js.map} +0 -0
  138. /package/dist/{chunk-L4FR7YIS.js.map → chunk-QHH2GXHS.js.map} +0 -0
  139. /package/dist/{chunk-VRUJPZ2C.js.map → chunk-RFUYCKBZ.js.map} +0 -0
  140. /package/dist/{chunk-YEIX26DQ.js.map → chunk-WSEDVYDY.js.map} +0 -0
  141. /package/dist/{chunk-VBIFSOPQ.js.map → chunk-X3LC6R37.js.map} +0 -0
  142. /package/dist/{chunk-5WGOAJ4B.js.map → chunk-X7LJRNMJ.js.map} +0 -0
  143. /package/dist/{chunk-5YVZQVSR.js.map → chunk-YBEAX6QC.js.map} +0 -0
  144. /package/dist/{chunk-FHR2JU2J.js.map → chunk-YQCA4ZEJ.js.map} +0 -0
  145. /package/dist/{chunk-TMGTVVE2.js.map → chunk-YWFMYZ4G.js.map} +0 -0
  146. /package/dist/{chunk-OHJZD7QU.js.map → chunk-ZYPB57IM.js.map} +0 -0
@@ -4,6 +4,7 @@ import type React from 'react';
4
4
  import { cn } from '../../utils/cn';
5
5
  import { Copy02Icon } from '../icons-v2-generated/documents/copy-02-icon';
6
6
  import { Button } from '../ui/button';
7
+ import { FadePreview } from '../ui/fade-preview';
7
8
 
8
9
  export interface CommandBoxAction {
9
10
  /** Button label */
@@ -35,6 +36,16 @@ export interface CommandBoxProps {
35
36
  commandClassName?: string;
36
37
  /** Maximum lines to show (uses line-clamp, 0 for unlimited) */
37
38
  maxLines?: number;
39
+ /**
40
+ * Fixed height for the command area, in lines of `text-code`. Unlike
41
+ * `maxLines`, the box is this tall whatever the content: every box in a list
42
+ * lines up, and text that changes live (a template being filled in) never
43
+ * moves the layout. Longer text fades out under the shared `FadePreview` with
44
+ * a "Show all" toggle; it NEVER scrolls inside the box, because a nested
45
+ * scroller captures the wheel and stops the page from scrolling under the
46
+ * pointer. Takes precedence over `maxLines`. Nothing is hidden from `onCopy`.
47
+ */
48
+ visibleLines?: number;
38
49
  /** When set, shows a copy icon button in the top-right corner of the box */
39
50
  onCopy?: () => void;
40
51
  /** Accessible label for the corner copy button */
@@ -92,17 +103,19 @@ export function CommandBox({
92
103
  className,
93
104
  commandClassName,
94
105
  maxLines = 0,
106
+ visibleLines,
95
107
  onCopy,
96
108
  copyAriaLabel = 'Copy command',
97
109
  }: CommandBoxProps) {
110
+ const fixedHeight = visibleLines !== undefined && visibleLines > 0;
98
111
  // Get static line-clamp class or undefined for unlimited
99
- const lineClampClass = maxLines > 0 ? lineClampClasses[maxLines] : undefined;
112
+ const lineClampClass = !fixedHeight && maxLines > 0 ? lineClampClasses[maxLines] : undefined;
100
113
 
101
- const commandText = (
114
+ const text = (
102
115
  <div
103
116
  className={cn(
104
117
  'break-all text-ods-text-primary text-code',
105
- onCopy && 'min-w-0 flex-1',
118
+ !fixedHeight && onCopy && 'min-w-0 flex-1',
106
119
  lineClampClass,
107
120
  commandClassName,
108
121
  )}
@@ -111,6 +124,26 @@ export function CommandBox({
111
124
  </div>
112
125
  );
113
126
 
127
+ // The height is N rows of the `text-code` line height token, so it follows
128
+ // the responsive type scale instead of a pixel guess.
129
+ const commandText = fixedHeight ? (
130
+ <div className={cn(onCopy && 'min-w-0 flex-1')}>
131
+ {/* No `resetKey`: the text of a live template changes on every keystroke,
132
+ and collapsing on each one would fold an expanded box under the
133
+ typist, the exact jump this mode exists to prevent. Nothing goes stale
134
+ without it: the expanded height is re-measured on every commit. */}
135
+ <FadePreview
136
+ fixedHeight
137
+ collapsedHeight={`calc(${visibleLines} * var(--font-line-space-h6-caption))`}
138
+ labels={{ more: 'Show all', less: 'Show less' }}
139
+ >
140
+ {text}
141
+ </FadePreview>
142
+ </div>
143
+ ) : (
144
+ text
145
+ );
146
+
114
147
  return (
115
148
  <div className={cn('flex flex-col gap-2', className)}>
116
149
  {title && <div className="text-ods-text-primary text-h4">{title}</div>}
@@ -41,4 +41,8 @@ import { FadePreview } from '@/components/fade-preview';
41
41
 
42
42
  ## Source
43
43
 
44
- [`fade-preview.tsx`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/fade-preview.tsx)
44
+ [`fade-preview.tsx`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/fade-preview.tsx)
45
+
46
+ ## Fixed-height mode
47
+
48
+ `fixedHeight` holds `collapsedHeight` (px or any CSS length) even for short content, measures overflow instead of taking `hiddenCount`, and always reserves the toggle row, so the block's height changes only when the reader expands it. It never scrolls inside. `labels` overrides the toggle wording and `toggleClassName` its spacing. `CommandBox visibleLines` is built on it.
@@ -21,6 +21,12 @@ export const buttonSurfaceClasses = {
21
21
  // `hover:bg-transparent active:bg-transparent`.
22
22
  glyph:
23
23
  'bg-transparent text-ods-text-primary hover:bg-transparent active:bg-transparent disabled:bg-transparent disabled:text-ods-text-disabled aria-disabled:bg-transparent aria-disabled:text-ods-text-disabled',
24
+ // A quiet inline text action (a "Show all" / "Show less" disclosure, a
25
+ // secondary "Clear" beside a field): secondary text that takes the accent on
26
+ // hover, and no surface in any state. Promoted to a variant because the
27
+ // disclosure toggle was a primitive <button> restating these classes. Pair
28
+ // with size="compact" and noPaddingX so the label aligns with the text above.
29
+ link: 'bg-transparent text-ods-text-secondary hover:bg-transparent hover:text-ods-accent active:bg-transparent active:text-ods-accent-active disabled:bg-transparent disabled:text-ods-text-disabled aria-disabled:bg-transparent aria-disabled:text-ods-text-disabled',
24
30
  // Chrome that sits ON media (video cards, image lightboxes): a scrim disc so
25
31
  // the glyph stays legible over an arbitrary frame. Promoted to a variant
26
32
  // because the walkthrough card, its theater and the bite cards were each
@@ -32,6 +32,7 @@ const buttonVariants = cva(
32
32
  warning: buttonSurfaceClasses.warning,
33
33
  glyph: buttonSurfaceClasses.glyph,
34
34
  overlay: buttonSurfaceClasses.overlay,
35
+ link: buttonSurfaceClasses.link,
35
36
  },
36
37
  size: {
37
38
  default: 'h-11 px-[var(--spacing-system-m)] py-[var(--spacing-system-sf)] text-h3 md:h-12',
@@ -2,8 +2,10 @@
2
2
 
3
3
  import { ChevronDown } from 'lucide-react';
4
4
  import type React from 'react';
5
- import { useState, useRef } from 'react';
5
+ import { useEffect, useRef, useState } from 'react';
6
6
  import { useIsomorphicLayoutEffect } from '../../hooks/ui/use-isomorphic-layout-effect';
7
+ import { cn } from '../../utils/cn';
8
+ import { Button } from './button';
7
9
 
8
10
  /**
9
11
  * FadePreview — the single shared progressive-disclosure primitive for
@@ -18,26 +20,57 @@ import { useIsomorphicLayoutEffect } from '../../hooks/ui/use-isomorphic-layout-
18
20
  *
19
21
  * When `hiddenCount <= 0` the children render unclamped and no toggle
20
22
  * shows (single-entry sections need no disclosure).
23
+ *
24
+ * `fixedHeight` is the mode for a block whose height must not move (a list of
25
+ * command boxes, text filled in live): the collapsed height is held even when
26
+ * the content is shorter, overflow is MEASURED instead of counted, and the
27
+ * toggle row is always reserved. The block changes height only when the reader
28
+ * expands it. It never scrolls inside: the page stays the only scroll surface,
29
+ * so a wheel over the block always moves the page.
21
30
  */
22
31
  export interface FadePreviewProps {
23
32
  /** How many items are visually hidden while collapsed — drives the
24
33
  * "Show N more" label. Pass `total - visible`; `<= 0` disables the
25
- * clamp + fade + toggle entirely. */
26
- hiddenCount: number;
27
- /** Collapsed height in px. ~120 shows one changelog entry's title +
28
- * the start of its description before the mask kicks in. Callers with
29
- * taller rows (e.g. delivery tables) pass a larger value. */
30
- collapsedHeight?: number;
34
+ * clamp + fade + toggle entirely. Ignored under `fixedHeight`, which
35
+ * measures overflow itself. */
36
+ hiddenCount?: number;
37
+ /** Collapsed height: px, or any CSS length (e.g. a line-height token
38
+ * multiple). ~120px shows one changelog entry's title + the start of its
39
+ * description before the mask kicks in. Callers with taller rows (e.g.
40
+ * delivery tables) pass a larger value. */
41
+ collapsedHeight?: number | string;
31
42
  /** Reset the expanded state when this value changes — otherwise a
32
43
  * parent that refetches and shrinks the list would leave a stale
33
44
  * "expanded" state and a momentarily-wrong "Show 0 more" button.
34
45
  * Callers typically pass the item count. */
35
46
  resetKey?: unknown;
47
+ /** Hold the collapsed height for short content, measure overflow, reserve the toggle row. */
48
+ fixedHeight?: boolean;
49
+ /** Toggle wording. Defaults to "Show N more" / "Show less". */
50
+ labels?: { more: string; less: string };
51
+ /** Classes for the toggle button (e.g. its spacing inside a bordered box). */
52
+ toggleClassName?: string;
36
53
  children: React.ReactNode;
37
54
  }
38
55
 
39
- export function FadePreview({ hiddenCount, collapsedHeight = 120, resetKey, children }: FadePreviewProps) {
56
+ const cssLength = (value: number | string) => (typeof value === 'number' ? `${value}px` : value);
57
+
58
+ export function FadePreview({
59
+ hiddenCount = 0,
60
+ collapsedHeight = 120,
61
+ resetKey,
62
+ fixedHeight = false,
63
+ labels,
64
+ toggleClassName,
65
+ children,
66
+ }: FadePreviewProps) {
40
67
  const [expanded, setExpanded] = useState(false);
68
+ // Overflow is a MEASUREMENT (text wraps to the live width), so it is unknown
69
+ // until the first layout pass. Nothing about the block's HEIGHT depends on it:
70
+ // the collapsed height is in the markup and the toggle row is always
71
+ // reserved. Only the fade and the toggle's visibility wait for the measure,
72
+ // which on the client happens before paint.
73
+ const [overflows, setOverflows] = useState(false);
41
74
  const contentRef = useRef<HTMLDivElement>(null);
42
75
 
43
76
  // Collapse when the caller's `resetKey` changes. Adjusted while rendering —
@@ -63,26 +96,56 @@ export function FadePreview({ hiddenCount, collapsedHeight = 120, resetKey, chil
63
96
  useIsomorphicLayoutEffect(() => {
64
97
  const el = contentRef.current;
65
98
  if (!el) return;
66
- el.style.maxHeight = expanded ? `${el.scrollHeight}px` : `${collapsedHeight}px`;
99
+ if (!fixedHeight) {
100
+ el.style.maxHeight = expanded ? `${el.scrollHeight}px` : cssLength(collapsedHeight);
101
+ return;
102
+ }
103
+ // Fixed mode sets `height`, not `max-height`, so short content keeps the
104
+ // collapsed height too. Overflow is read while collapsed (content taller
105
+ // than the box), which is the only state the fade and the toggle depend on.
106
+ el.style.height = expanded ? `${el.scrollHeight}px` : cssLength(collapsedHeight);
107
+ if (!expanded) {
108
+ const next = el.scrollHeight > el.clientHeight + 1;
109
+ if (next !== overflows) setOverflows(next);
110
+ }
67
111
  });
68
112
 
69
- const needsFade = hiddenCount > 0;
113
+ // A width change re-wraps text without a React commit; re-measure then too.
114
+ useEffect(() => {
115
+ const el = contentRef.current;
116
+ if (!fixedHeight || !el || typeof ResizeObserver === 'undefined') return undefined;
117
+ const observer = new ResizeObserver(() => {
118
+ if (expanded) return;
119
+ setOverflows(el.scrollHeight > el.clientHeight + 1);
120
+ });
121
+ observer.observe(el);
122
+ return () => observer.disconnect();
123
+ }, [fixedHeight, expanded]);
124
+
125
+ const needsFade = fixedHeight ? overflows : hiddenCount > 0;
70
126
 
71
127
  // No disclosure needed → no clamp wrapper at all. (Keeping the wrapper
72
128
  // with a `scrollHeight ?? 2000` max-height would clip tall content on
73
129
  // the first render, before the ref measures.)
74
- if (!needsFade) return <>{children}</>;
130
+ if (!fixedHeight && !needsFade) return <>{children}</>;
131
+
132
+ const showToggle = needsFade || expanded;
133
+ const moreLabel = labels?.more ?? `Show ${hiddenCount} more`;
134
+ const lessLabel = labels?.less ?? 'Show less';
75
135
 
76
136
  return (
77
137
  <div className="relative">
78
138
  <div
79
139
  ref={contentRef}
80
- className="overflow-hidden transition-[max-height] duration-500"
140
+ className="overflow-hidden transition-[max-height,height] duration-500"
81
141
  style={{
82
142
  transitionTimingFunction: 'cubic-bezier(0.33, 1, 0.68, 1)',
83
- // `maxHeight` is intentionally absent — the layout effect above owns
84
- // it, because the expanded value is a live DOM measurement.
85
- ...(!expanded
143
+ // Fixed mode renders the collapsed height INTO the markup, so the
144
+ // server-rendered block is already clamped and hydration never shrinks
145
+ // it. The expanded value is a live DOM measurement, so the layout
146
+ // effect above owns it (and `maxHeight` in the counted mode).
147
+ ...(fixedHeight && !expanded ? { height: cssLength(collapsedHeight) } : {}),
148
+ ...(!expanded && needsFade
86
149
  ? {
87
150
  maskImage: 'linear-gradient(to bottom, black 30%, transparent 100%)',
88
151
  WebkitMaskImage: 'linear-gradient(to bottom, black 30%, transparent 100%)',
@@ -92,14 +155,23 @@ export function FadePreview({ hiddenCount, collapsedHeight = 120, resetKey, chil
92
155
  >
93
156
  {children}
94
157
  </div>
95
- <button
158
+ {/* The shared Button's quiet text-action variant. Fixed mode ALWAYS renders
159
+ the row so the block keeps its height; it is just not visible or
160
+ focusable while there is nothing to disclose. */}
161
+ <Button
96
162
  type="button"
163
+ variant="link"
164
+ size="compact"
165
+ noPaddingX
97
166
  onClick={() => setExpanded(!expanded)}
98
- className="mt-4 flex items-center gap-1.5 text-ods-text-secondary transition-colors duration-200 text-h6 hover:text-ods-accent"
167
+ aria-expanded={expanded}
168
+ aria-hidden={showToggle ? undefined : true}
169
+ tabIndex={showToggle ? undefined : -1}
170
+ rightIcon={<ChevronDown className={cn('transition-transform duration-300', expanded && 'rotate-180')} />}
171
+ className={cn('mt-[var(--spacing-system-mf)]', !showToggle && 'invisible', toggleClassName)}
99
172
  >
100
- <span>{expanded ? 'Show less' : `Show ${hiddenCount} more`}</span>
101
- <ChevronDown className={`h-3.5 w-3.5 transition-transform duration-300 ${expanded ? 'rotate-180' : ''}`} />
102
- </button>
173
+ {expanded ? lessLabel : moreLabel}
174
+ </Button>
103
175
  </div>
104
176
  );
105
177
  }
@@ -17,8 +17,8 @@ export type PageActionButton = {
17
17
  /** Click handler. Optional when `href` or `submenu` is provided. */
18
18
  onClick?: () => void;
19
19
  icon?: React.ReactNode;
20
- /** `overlay` is media chrome only — SplitButton has no divider colour for it. */
21
- variant?: Exclude<ButtonProps['variant'], 'overlay' | 'glyph'>;
20
+ /** `overlay` and `glyph` are media chrome and `link` an inline text action; none is a page action, and SplitButton has no divider colour for them. */
21
+ variant?: Exclude<ButtonProps['variant'], 'overlay' | 'glyph' | 'link'>;
22
22
  disabled?: boolean;
23
23
  /**
24
24
  * For SplitButton actions (when `iconAction` is set): disables only the main
@@ -24,7 +24,7 @@ const meta = {
24
24
  argTypes: {
25
25
  variant: {
26
26
  control: 'select',
27
- options: ['accent', 'outline', 'transparent', 'destructive', 'warning'],
27
+ options: ['accent', 'outline', 'transparent', 'destructive', 'warning', 'glyph', 'overlay', 'link'],
28
28
  },
29
29
  size: {
30
30
  control: 'select',
@@ -61,6 +61,11 @@ export const Warning: Story = {
61
61
  args: { children: 'Proceed with caution', variant: 'warning', leftIcon: <AlertTriangle /> },
62
62
  };
63
63
 
64
+ /** Quiet inline text action, e.g. the FadePreview "Show all" / "Show less" disclosure. */
65
+ export const Link: Story = {
66
+ args: { children: 'Show all', variant: 'link', size: 'compact', noPaddingX: true, rightIcon: <ChevronDown /> },
67
+ };
68
+
64
69
  // === Sizes ===
65
70
 
66
71
  export const SizeDefault: Story = {