@aragon/gov-ui-kit 1.21.0 → 1.22.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.
- package/CHANGELOG.md +12 -0
- package/build.css +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/types/src/core/components/cards/cardCollapsible/cardCollapsible.d.ts +7 -1
- package/dist/types/src/core/components/collapsible/collapsibleUtils.d.ts +47 -0
- package/package.json +1 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { type ICollapsibleProps } from '../../collapsible';
|
|
2
|
-
export interface ICardCollapsibleProps extends Omit<ICollapsibleProps, 'buttonVariant' | 'className'> {
|
|
2
|
+
export interface ICardCollapsibleProps extends Omit<ICollapsibleProps, 'buttonVariant' | 'className' | 'showOverlay' | 'collapsedLines'> {
|
|
3
3
|
/**
|
|
4
4
|
* Additional class names to apply to the card.
|
|
5
5
|
*/
|
|
6
6
|
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The collapsed height in pixels. CardCollapsible always uses overlay mode (showOverlay=true),
|
|
9
|
+
* which requires pixel-based height measurement instead of line-based counting.
|
|
10
|
+
* @default 180
|
|
11
|
+
*/
|
|
12
|
+
collapsedPixels?: number;
|
|
7
13
|
}
|
|
8
14
|
export declare const CardCollapsible: React.FC<ICardCollapsibleProps>;
|
|
@@ -46,3 +46,50 @@ export interface OverlayHeightParams {
|
|
|
46
46
|
fallbackLineHeight?: number;
|
|
47
47
|
}
|
|
48
48
|
export declare const computeOverlayHeightPx: (params: OverlayHeightParams) => number;
|
|
49
|
+
/**
|
|
50
|
+
* Result of element height measurements for collapsible calculations.
|
|
51
|
+
*/
|
|
52
|
+
export interface MeasureHeightsResult {
|
|
53
|
+
/**
|
|
54
|
+
* The current rendered height of the element in the DOM (with clamp/max-height applied).
|
|
55
|
+
*/
|
|
56
|
+
clampedClientHeight: number;
|
|
57
|
+
/**
|
|
58
|
+
* The full content height with no clamping and no max-height applied.
|
|
59
|
+
*/
|
|
60
|
+
fullHeight: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Measures the current (clamped) clientHeight and the full content height by
|
|
64
|
+
* creating a hidden clone without clamping and without max-height.
|
|
65
|
+
*
|
|
66
|
+
* This allows overflow detection and overlay sizing for mixed-content
|
|
67
|
+
* rich text (e.g. combinations of h1, ul/li, p, code) where a single
|
|
68
|
+
* line-height is not representative.
|
|
69
|
+
*/
|
|
70
|
+
export declare const measureElementHeights: (element: HTMLElement | null) => MeasureHeightsResult;
|
|
71
|
+
export interface OverlayRatioParams {
|
|
72
|
+
/** Number of lines visible when collapsed (requested). */
|
|
73
|
+
collapsedLines: number;
|
|
74
|
+
/** Number of lines used for overlay sizing (requested). */
|
|
75
|
+
overlayLines: number;
|
|
76
|
+
/** Actual rendered height of the collapsed block (in pixels). */
|
|
77
|
+
clampedClientHeight: number;
|
|
78
|
+
/** Minimum visible pixels of content above overlay to avoid full cover. */
|
|
79
|
+
minVisiblePx?: number;
|
|
80
|
+
/** Minimum overlay thickness in pixels (after clamping). */
|
|
81
|
+
minOverlayPx?: number;
|
|
82
|
+
/** Maximum overlay thickness in pixels (after clamping). */
|
|
83
|
+
maxOverlayPx?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Computes overlay height as a ratio of the actual visible collapsed height
|
|
87
|
+
* instead of relying on a single line-height. This makes the overlay robust
|
|
88
|
+
* for mixed content where each line may have different heights.
|
|
89
|
+
*
|
|
90
|
+
* Constraints:
|
|
91
|
+
* - overlayLines is clamped to [0, collapsedLines - 1]
|
|
92
|
+
* - overlay cannot cover all visible content; we keep at least `minVisiblePx`
|
|
93
|
+
* - final result is clamped within [minOverlayPx, maxOverlayPx]
|
|
94
|
+
*/
|
|
95
|
+
export declare const computeOverlayHeightByRatio: (params: OverlayRatioParams) => number;
|