@egen-civitas/esm-styleguide 2.1.1 → 2.2.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 +8 -0
- package/dist/section/index.d.ts +3 -0
- package/dist/section/index.d.ts.map +1 -1
- package/dist/section/index.js +3 -0
- package/dist/section/section-card.component.d.ts +16 -0
- package/dist/section/section-card.component.d.ts.map +1 -0
- package/dist/section/section-card.component.js +30 -0
- package/dist/section/section-parts.component.d.ts.map +1 -1
- package/dist/section/section-parts.component.js +54 -37
- package/dist/section/section-slot.component.d.ts +5 -0
- package/dist/section/section-slot.component.d.ts.map +1 -0
- package/dist/section/section-slot.component.js +66 -0
- package/dist/section/section-sticky.d.ts +28 -0
- package/dist/section/section-sticky.d.ts.map +1 -0
- package/dist/section/section-sticky.js +81 -0
- package/dist/section/section.component.d.ts +1 -1
- package/dist/section/section.component.d.ts.map +1 -1
- package/dist/section/section.component.js +18 -4
- package/dist/section/section.context.d.ts +2 -0
- package/dist/section/section.context.d.ts.map +1 -1
- package/dist/section/section.types.d.ts +43 -0
- package/dist/section/section.types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @egen-civitas/esm-styleguide
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1ffdcd4: `SectionSlot` : une page expose un slot d'extensions (`<SectionSlot name="home-sections" />`) et chaque app y branche sa propre `Section` depuis son `routes.json`. Les en-têtes de section sont **collants** : l'en-tête reste en haut de la zone de défilement tant que le corps de sa section est visible, puis la section suivante prend le relais. Le mode passe par des variables CSS héritées (`--section-header-position`, `--section-sticky-top`, `--section-sticky-z`, `--section-sticky-bg`), donc il traverse les parcels single-spa sans contexte React partagé.
|
|
8
|
+
|
|
9
|
+
`Section` gagne `stickyHeader`, `stickyOffset` et `stickyZIndex` (hérités du `SectionSlot` quand absents ; `stickyHeader={false}` pour s'en exempter). Nouveaux exports : `SectionSlot`, `SectionCard`, `SectionCardTitleButton`, `SECTION_CARD_CLASS`, `stickyStyleVars`, `STICKY_VARS`. Le shell est republié pour embarquer cette version du styleguide.
|
|
10
|
+
|
|
3
11
|
## 2.1.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/section/index.d.ts
CHANGED
|
@@ -3,4 +3,7 @@ export * from './section-parts.component.js';
|
|
|
3
3
|
export * from './section-action.component.js';
|
|
4
4
|
export * from './section-grid.component.js';
|
|
5
5
|
export * from './section.types.js';
|
|
6
|
+
export * from './section-slot.component.js';
|
|
7
|
+
export { stickyStyleVars, STICKY_VARS } from './section-sticky.js';
|
|
8
|
+
export * from './section-card.component.js';
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,cAAc,6BAA6B,CAAC"}
|
package/dist/section/index.js
CHANGED
|
@@ -3,3 +3,6 @@ export * from "./section-parts.component.js";
|
|
|
3
3
|
export * from "./section-action.component.js";
|
|
4
4
|
export * from "./section-grid.component.js";
|
|
5
5
|
export * from "./section.types.js";
|
|
6
|
+
export * from "./section-slot.component.js";
|
|
7
|
+
export { stickyStyleVars, STICKY_VARS } from "./section-sticky.js";
|
|
8
|
+
export * from "./section-card.component.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @category Section */
|
|
2
|
+
import React, { type ElementType } from 'react';
|
|
3
|
+
export declare const SECTION_CARD_CLASS: string;
|
|
4
|
+
export interface SectionCardProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
|
+
/** Balise rendue. @default 'div' */
|
|
6
|
+
as?: ElementType;
|
|
7
|
+
}
|
|
8
|
+
export declare function SectionCard({ as: Tag, className, children, ...rest }: SectionCardProps): React.JSX.Element;
|
|
9
|
+
export interface SectionCardTitleButtonProps {
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/** La carte parente doit être `relative` (c'est le cas de `SectionCard`). */
|
|
15
|
+
export declare function SectionCardTitleButton({ onClick, className, children }: SectionCardTitleButtonProps): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=section-card.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-card.component.d.ts","sourceRoot":"","sources":["../../src/section/section-card.component.tsx"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAchD,eAAO,MAAM,kBAAkB,QAK9B,CAAC;AAEF,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACzE,oCAAoC;IACpC,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,GAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,qBAM9F;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,6EAA6E;AAC7E,wBAAgB,sBAAsB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,2BAA2B,qBAcnG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** @category Section */ import React from "react";
|
|
3
|
+
import { cn } from "../page-background/page-background.utils.js";
|
|
4
|
+
// =============================================================================
|
|
5
|
+
// SECTION CARD — carte « verre » des contenus de section
|
|
6
|
+
//
|
|
7
|
+
// Même langage visuel pour toutes les sections d'une page, quelle que soit
|
|
8
|
+
// l'app qui les fournit : fond translucide, contour fin, survol qui se relève.
|
|
9
|
+
// `SectionCardTitleButton` : titre = vrai <button> dont un pseudo-élément
|
|
10
|
+
// couvre toute la carte (patron « stretched link ») — carte cliquable à la
|
|
11
|
+
// souris et au clavier, un seul bouton nommé pour les lecteurs d'écran, et
|
|
12
|
+
// la carte peut contenir d'autres liens/boutons sans imbrication invalide.
|
|
13
|
+
// =============================================================================
|
|
14
|
+
export const SECTION_CARD_CLASS = cn('group relative flex min-w-0 flex-col rounded-2xl border border-white/10 bg-slate-900/45 p-4', 'text-slate-100 shadow-lg backdrop-blur-sm outline-none transition-all duration-300', 'hover:-translate-y-1 hover:border-teal-400/50 hover:bg-slate-900/75 hover:shadow-2xl', 'has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-emerald-400');
|
|
15
|
+
export function SectionCard({ as: Tag = 'div', className, children, ...rest }) {
|
|
16
|
+
return /*#__PURE__*/ _jsx(Tag, {
|
|
17
|
+
"data-section-card": "",
|
|
18
|
+
className: cn(SECTION_CARD_CLASS, className),
|
|
19
|
+
...rest,
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** La carte parente doit être `relative` (c'est le cas de `SectionCard`). */ export function SectionCardTitleButton({ onClick, className, children }) {
|
|
24
|
+
return /*#__PURE__*/ _jsx("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
onClick: onClick,
|
|
27
|
+
className: cn('block w-full cursor-pointer border-0 bg-transparent p-0 outline-none [color:inherit] [font:inherit] [text-align:inherit]', "after:absolute after:inset-0 after:content-['']", className),
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-parts.component.d.ts","sourceRoot":"","sources":["../../src/section/section-parts.component.tsx"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"section-parts.component.d.ts","sourceRoot":"","sources":["../../src/section/section-parts.component.tsx"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EACV,gBAAgB,EAGhB,kBAAkB,EAElB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AA4D5B,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,qBAUnE;AAsCD,2FAA2F;AAC3F,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,OAAc,EACd,SAAgB,EAChB,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,GACV,EAAE,kBAAkB,qBAmHpB;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAa,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,gBAAgB,qBAoD9F;AAED,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,kBAAkB,4BAsClG"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/** @category Section */ import React, { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { cn } from "../page-background/page-background.utils.js";
|
|
4
4
|
import { useSectionContext } from "./section.context.js";
|
|
5
|
+
import { STICKY_RESET, useStickyState } from "./section-sticky.js";
|
|
5
6
|
// =============================================================================
|
|
6
7
|
// Parties du squelette Section : SectionDivider, SectionHeader, SectionBody,
|
|
7
8
|
// SectionFooter. Chacune lit la configuration de son `Section` parent (ton,
|
|
@@ -97,55 +98,70 @@ function CollapseToggle() {
|
|
|
97
98
|
const resolvedLayout = layout ?? ctx.headerLayout;
|
|
98
99
|
const showDivider = divider ?? ctx.divider;
|
|
99
100
|
const TitleTag = titleAs;
|
|
101
|
+
const headerRef = useRef(null);
|
|
102
|
+
const { isSticky, stuck, sentinelRef } = useStickyState(headerRef, ctx.stickyKey);
|
|
100
103
|
const hasCount = count !== undefined && count !== null && count !== '';
|
|
101
104
|
const hasActions = actions !== undefined && actions !== null && actions !== false;
|
|
102
|
-
return /*#__PURE__*/ _jsxs(
|
|
103
|
-
"data-section-part": "header",
|
|
104
|
-
className: cn('flex flex-col', classNames.header, className),
|
|
105
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
105
106
|
children: [
|
|
107
|
+
isSticky ? /*#__PURE__*/ _jsx("div", {
|
|
108
|
+
ref: sentinelRef,
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
"data-section-part": "sticky-sentinel",
|
|
111
|
+
className: "pointer-events-none -mb-px h-px w-full shrink-0"
|
|
112
|
+
}) : null,
|
|
106
113
|
/*#__PURE__*/ _jsxs("div", {
|
|
107
|
-
|
|
114
|
+
ref: headerRef,
|
|
115
|
+
"data-section-part": "header",
|
|
116
|
+
"data-stuck": isSticky ? String(stuck) : undefined,
|
|
117
|
+
className: cn('flex flex-col', // Mode collant : piloté par des variables CSS héritées (voir section-sticky.ts).
|
|
118
|
+
'[position:var(--section-header-position,static)] top-(--section-sticky-top,0px) z-(--section-sticky-z,10)', 'transition-[background-color,box-shadow] duration-200 motion-reduce:transition-none', 'data-[stuck=true]:bg-(--section-sticky-bg,rgb(8_12_20/0.72)) data-[stuck=true]:backdrop-blur-xl', 'data-[stuck=true]:shadow-[0_8px_24px_-12px_rgb(0_0_0/0.45)]', classNames.header, className),
|
|
108
119
|
children: [
|
|
109
|
-
|
|
110
|
-
className:
|
|
111
|
-
children: children
|
|
112
|
-
}) : /*#__PURE__*/ _jsxs("div", {
|
|
113
|
-
className: cn('flex min-w-0 flex-col gap-1', resolvedLayout === 'split' && 'flex-1 basis-48', classNames.heading),
|
|
120
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
121
|
+
className: cn('flex gap-x-4 gap-y-2', HEADER_ROW[resolvedLayout], HEADER_PAD[density]),
|
|
114
122
|
children: [
|
|
115
|
-
/*#__PURE__*/
|
|
116
|
-
className:
|
|
123
|
+
children !== undefined && children !== null ? /*#__PURE__*/ _jsx("div", {
|
|
124
|
+
className: "min-w-0 flex-1",
|
|
125
|
+
children: children
|
|
126
|
+
}) : /*#__PURE__*/ _jsxs("div", {
|
|
127
|
+
className: cn('flex min-w-0 flex-col gap-1', resolvedLayout === 'split' && 'flex-1 basis-48', classNames.heading),
|
|
117
128
|
children: [
|
|
118
|
-
|
|
119
|
-
className: cn('
|
|
120
|
-
children:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
130
|
+
className: cn('flex min-w-0 items-center gap-2.5', resolvedLayout === 'centered' && 'justify-center'),
|
|
131
|
+
children: [
|
|
132
|
+
icon ? /*#__PURE__*/ _jsx("span", {
|
|
133
|
+
className: cn('inline-flex shrink-0 items-center justify-center text-(--section-accent,#34d399)', classNames.leading),
|
|
134
|
+
children: icon
|
|
135
|
+
}) : null,
|
|
136
|
+
title ? /*#__PURE__*/ _jsx(TitleTag, {
|
|
137
|
+
id: ctx.headingId,
|
|
138
|
+
className: cn('m-0 min-w-0 text-balance tracking-tight text-(--section-fg,#fff)', TITLE_SIZE[titleSize], classNames.title),
|
|
139
|
+
children: title
|
|
140
|
+
}) : null,
|
|
141
|
+
hasCount ? /*#__PURE__*/ _jsx("span", {
|
|
142
|
+
className: cn('inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5', 'bg-(--section-fg,#fff)/10 text-[11px] font-medium leading-none text-(--section-muted,rgba(255,255,255,0.65))', classNames.count),
|
|
143
|
+
children: count
|
|
144
|
+
}) : null
|
|
145
|
+
]
|
|
146
|
+
}),
|
|
147
|
+
description ? /*#__PURE__*/ _jsx("p", {
|
|
148
|
+
className: cn('m-0 max-w-3xl text-sm leading-relaxed text-(--section-muted,rgba(255,255,255,0.65))', classNames.description),
|
|
149
|
+
children: description
|
|
130
150
|
}) : null
|
|
131
151
|
]
|
|
132
152
|
}),
|
|
133
|
-
|
|
134
|
-
className: cn('
|
|
135
|
-
children:
|
|
153
|
+
hasActions || collapsible ? /*#__PURE__*/ _jsxs("div", {
|
|
154
|
+
className: cn('flex flex-wrap items-center gap-1.5', HEADER_ACTIONS[resolvedLayout], children !== undefined && children !== null && resolvedLayout === 'split' && 'shrink-0', classNames.actions),
|
|
155
|
+
children: [
|
|
156
|
+
actions,
|
|
157
|
+
collapsible ? /*#__PURE__*/ _jsx(CollapseToggle, {}) : null
|
|
158
|
+
]
|
|
136
159
|
}) : null
|
|
137
160
|
]
|
|
138
161
|
}),
|
|
139
|
-
|
|
140
|
-
className: cn('flex flex-wrap items-center gap-1.5', HEADER_ACTIONS[resolvedLayout], children !== undefined && children !== null && resolvedLayout === 'split' && 'shrink-0', classNames.actions),
|
|
141
|
-
children: [
|
|
142
|
-
actions,
|
|
143
|
-
collapsible ? /*#__PURE__*/ _jsx(CollapseToggle, {}) : null
|
|
144
|
-
]
|
|
145
|
-
}) : null
|
|
162
|
+
showDivider ? /*#__PURE__*/ _jsx(SectionDivider, {}) : null
|
|
146
163
|
]
|
|
147
|
-
})
|
|
148
|
-
showDivider ? /*#__PURE__*/ _jsx(SectionDivider, {}) : null
|
|
164
|
+
})
|
|
149
165
|
]
|
|
150
166
|
});
|
|
151
167
|
}
|
|
@@ -171,8 +187,9 @@ function CollapseToggle() {
|
|
|
171
187
|
"data-section-part": "body",
|
|
172
188
|
className: cn('min-w-0', !flush && BODY_PAD[density], maxHeight && 'overflow-y-auto overscroll-contain', classNames.body, className),
|
|
173
189
|
style: maxHeight ? {
|
|
190
|
+
...STICKY_RESET,
|
|
174
191
|
maxHeight
|
|
175
|
-
} :
|
|
192
|
+
} : STICKY_RESET,
|
|
176
193
|
children: children
|
|
177
194
|
});
|
|
178
195
|
if (!collapsible) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** @category Section */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { SectionSlotProps } from './section.types.js';
|
|
4
|
+
export declare function SectionSlot({ name, state, select, stickyHeaders, stickyOffset, stickyZIndex, gap, renderItem, className, itemClassName, style, }: SectionSlotProps): React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=section-slot.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-slot.component.d.ts","sourceRoot":"","sources":["../../src/section/section-slot.component.tsx"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA8B3E,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,KAAK,EACL,MAAM,EACN,aAAoB,EACpB,YAAoB,EACpB,YAAiB,EACjB,GAAU,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,KAAK,GACN,EAAE,gBAAgB,qBAoBlB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** @category Section */ import React from "react";
|
|
3
|
+
import { Extension, ExtensionSlot } from "@egen-civitas/esm-react-utils";
|
|
4
|
+
import { cn } from "../page-background/page-background.utils.js";
|
|
5
|
+
import { stickyStyleVars } from "./section-sticky.js";
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// SECTION SLOT — page composée de sections fournies par des extensions
|
|
8
|
+
//
|
|
9
|
+
// Page hôte (ex. Accueil) Apps contributrices
|
|
10
|
+
// ┌──────────────────────┐ ┌ routes.json ───────────────────────┐
|
|
11
|
+
// │ <SectionSlot │ ◄─────── │ { "name": "news-section", │
|
|
12
|
+
// │ name="home-…" /> │ │ "slot": "home-sections", │
|
|
13
|
+
// └──────────────────────┘ │ "component": "newsSection", │
|
|
14
|
+
// │ "order": 10 } │
|
|
15
|
+
// └────────────────────────────────────┘
|
|
16
|
+
//
|
|
17
|
+
// Chaque extension rend sa propre `<Section>` (données, liens et règles
|
|
18
|
+
// métier restent dans l'app qui la possède). Le slot ne fait que :
|
|
19
|
+
// - ordonner / empiler les extensions (`order` de routes.json) ;
|
|
20
|
+
// - poser les variables CSS qui activent les EN-TÊTES COLLANTS pour toutes
|
|
21
|
+
// les sections du slot (héritage DOM : fonctionne d'un parcel à l'autre).
|
|
22
|
+
//
|
|
23
|
+
// Réutilisable par n'importe quelle page : il suffit de choisir un nom de slot.
|
|
24
|
+
// =============================================================================
|
|
25
|
+
const GAP = {
|
|
26
|
+
none: 'gap-0',
|
|
27
|
+
sm: 'gap-4',
|
|
28
|
+
md: 'gap-6',
|
|
29
|
+
lg: 'gap-10',
|
|
30
|
+
xl: 'gap-14'
|
|
31
|
+
};
|
|
32
|
+
export function SectionSlot({ name, state, select, stickyHeaders = true, stickyOffset = '0px', stickyZIndex = 10, gap = 'lg', renderItem, className, itemClassName, style }) {
|
|
33
|
+
const containerStyle = {
|
|
34
|
+
...stickyStyleVars({
|
|
35
|
+
sticky: stickyHeaders,
|
|
36
|
+
offset: stickyOffset,
|
|
37
|
+
zIndex: stickyZIndex
|
|
38
|
+
}),
|
|
39
|
+
...style
|
|
40
|
+
};
|
|
41
|
+
const classes = cn('flex w-full min-w-0 flex-col', GAP[gap], className);
|
|
42
|
+
return /*#__PURE__*/ _jsx(ExtensionSlot, {
|
|
43
|
+
name: name,
|
|
44
|
+
select: select,
|
|
45
|
+
"data-section-slot": name,
|
|
46
|
+
className: classes,
|
|
47
|
+
style: containerStyle,
|
|
48
|
+
children: (extension)=>{
|
|
49
|
+
const element = /*#__PURE__*/ _jsx(Extension, {
|
|
50
|
+
state: state
|
|
51
|
+
});
|
|
52
|
+
const info = {
|
|
53
|
+
name: extension.name,
|
|
54
|
+
moduleName: extension.moduleName,
|
|
55
|
+
meta: {
|
|
56
|
+
...extension.meta
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
60
|
+
"data-section-slot-item": extension.name,
|
|
61
|
+
className: cn('min-w-0', itemClassName),
|
|
62
|
+
children: renderItem ? renderItem(element, info) : element
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @category Section */
|
|
2
|
+
import { type CSSProperties, type RefObject } from 'react';
|
|
3
|
+
export declare const STICKY_VARS: {
|
|
4
|
+
readonly position: "--section-header-position";
|
|
5
|
+
readonly top: "--section-sticky-top";
|
|
6
|
+
readonly zIndex: "--section-sticky-z";
|
|
7
|
+
};
|
|
8
|
+
export interface StickyOptions {
|
|
9
|
+
sticky?: boolean;
|
|
10
|
+
offset?: string;
|
|
11
|
+
zIndex?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Variables CSS à poser (en `style`) pour activer / désactiver le mode collant. */
|
|
14
|
+
export declare function stickyStyleVars({ sticky, offset, zIndex }: StickyOptions): CSSProperties;
|
|
15
|
+
/** Le corps d'une section coupe l'héritage : une section imbriquée ne devient pas collante par accident. */
|
|
16
|
+
export declare const STICKY_RESET: CSSProperties;
|
|
17
|
+
/**
|
|
18
|
+
* Détecte si l'en-tête est actuellement collé. Un sentinelle d'1 px placé juste
|
|
19
|
+
* avant l'en-tête quitte la zone visible au moment où l'en-tête se colle.
|
|
20
|
+
* Retourne `isSticky` (la position calculée est bien `sticky` — à lire après
|
|
21
|
+
* montage car héritée du DOM) et `stuck`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useStickyState(headerRef: RefObject<HTMLElement>, recheckKey: unknown): {
|
|
24
|
+
isSticky: boolean;
|
|
25
|
+
stuck: boolean;
|
|
26
|
+
sentinelRef: RefObject<HTMLDivElement>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=section-sticky.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-sticky.d.ts","sourceRoot":"","sources":["../../src/section/section-sticky.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAA+B,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAsBxF,eAAO,MAAM,WAAW;;;;CAId,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,aAAa,CAYxF;AAED,4GAA4G;AAC5G,eAAO,MAAM,YAAY,EAAE,aAAqE,CAAC;AAEjG;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,EACjC,UAAU,EAAE,OAAO,GAClB;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,SAAS,CAAC,cAAc,CAAC,CAAA;CAAE,CA2B/E"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** @category Section */ import { useEffect, useRef, useState } from "react";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// EN-TÊTE COLLANT — mécanique partagée par `Section` et `SectionSlot`
|
|
4
|
+
//
|
|
5
|
+
// Principe : tout passe par des variables CSS. Elles s'héritent à travers le
|
|
6
|
+
// DOM, donc aussi d'un parcel single-spa à l'autre : un `SectionSlot` (shell
|
|
7
|
+
// ou app hôte) les pose sur son conteneur et les `Section` rendues par les
|
|
8
|
+
// extensions d'AUTRES apps les reçoivent sans contexte React partagé.
|
|
9
|
+
//
|
|
10
|
+
// --section-header-position `sticky` | `static` (hérité, surchargeable)
|
|
11
|
+
// --section-sticky-top décalage du haut de la zone de défilement
|
|
12
|
+
// --section-sticky-z empilement
|
|
13
|
+
// --section-sticky-bg fond une fois collé (verre sombre par défaut)
|
|
14
|
+
//
|
|
15
|
+
// Le `position: sticky` d'un en-tête est borné par son parent direct (la
|
|
16
|
+
// racine de la `Section`) : il reste visible tant que le corps l'est, puis
|
|
17
|
+
// repart avec la section — la suivante prend le relais, sans code de plus.
|
|
18
|
+
// Condition : aucun ancêtre jusqu'à la zone de défilement (#egen-scroll-region)
|
|
19
|
+
// ne doit poser `overflow` autre que `visible`.
|
|
20
|
+
// =============================================================================
|
|
21
|
+
export const STICKY_VARS = {
|
|
22
|
+
position: '--section-header-position',
|
|
23
|
+
top: '--section-sticky-top',
|
|
24
|
+
zIndex: '--section-sticky-z'
|
|
25
|
+
};
|
|
26
|
+
/** Variables CSS à poser (en `style`) pour activer / désactiver le mode collant. */ export function stickyStyleVars({ sticky, offset, zIndex }) {
|
|
27
|
+
const vars = {};
|
|
28
|
+
if (sticky !== undefined) {
|
|
29
|
+
vars[STICKY_VARS.position] = sticky ? 'sticky' : 'static';
|
|
30
|
+
}
|
|
31
|
+
if (offset !== undefined) {
|
|
32
|
+
vars[STICKY_VARS.top] = offset;
|
|
33
|
+
}
|
|
34
|
+
if (zIndex !== undefined) {
|
|
35
|
+
vars[STICKY_VARS.zIndex] = zIndex;
|
|
36
|
+
}
|
|
37
|
+
return vars;
|
|
38
|
+
}
|
|
39
|
+
/** Le corps d'une section coupe l'héritage : une section imbriquée ne devient pas collante par accident. */ export const STICKY_RESET = {
|
|
40
|
+
[STICKY_VARS.position]: 'static'
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Détecte si l'en-tête est actuellement collé. Un sentinelle d'1 px placé juste
|
|
44
|
+
* avant l'en-tête quitte la zone visible au moment où l'en-tête se colle.
|
|
45
|
+
* Retourne `isSticky` (la position calculée est bien `sticky` — à lire après
|
|
46
|
+
* montage car héritée du DOM) et `stuck`.
|
|
47
|
+
*/ export function useStickyState(headerRef, recheckKey) {
|
|
48
|
+
const sentinelRef = useRef(null);
|
|
49
|
+
const [isSticky, setIsSticky] = useState(false);
|
|
50
|
+
const [stuck, setStuck] = useState(false);
|
|
51
|
+
useEffect(()=>{
|
|
52
|
+
const el = headerRef.current;
|
|
53
|
+
setIsSticky(!!el && getComputedStyle(el).position === 'sticky');
|
|
54
|
+
}, [
|
|
55
|
+
headerRef,
|
|
56
|
+
recheckKey
|
|
57
|
+
]);
|
|
58
|
+
useEffect(()=>{
|
|
59
|
+
const header = headerRef.current;
|
|
60
|
+
const sentinel = sentinelRef.current;
|
|
61
|
+
if (!isSticky || !header || !sentinel || typeof IntersectionObserver === 'undefined') {
|
|
62
|
+
setStuck(false);
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
const top = parseFloat(getComputedStyle(header).top) || 0;
|
|
66
|
+
const observer = new IntersectionObserver(([entry])=>setStuck(!entry.isIntersecting), {
|
|
67
|
+
rootMargin: `-${top}px 0px 0px 0px`,
|
|
68
|
+
threshold: 0
|
|
69
|
+
});
|
|
70
|
+
observer.observe(sentinel);
|
|
71
|
+
return ()=>observer.disconnect();
|
|
72
|
+
}, [
|
|
73
|
+
headerRef,
|
|
74
|
+
isSticky
|
|
75
|
+
]);
|
|
76
|
+
return {
|
|
77
|
+
isSticky,
|
|
78
|
+
stuck,
|
|
79
|
+
sentinelRef
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -4,7 +4,7 @@ import { SectionAction } from './section-action.component.js';
|
|
|
4
4
|
import { SectionGrid } from './section-grid.component.js';
|
|
5
5
|
import { SectionBody, SectionDivider, SectionFooter, SectionHeader } from './section-parts.component.js';
|
|
6
6
|
import type { SectionProps } from './section.types.js';
|
|
7
|
-
declare function SectionRoot({ id, as: Root, ariaLabel, variant, tone, density, title, titleAs, titleSize, icon, description, count, actions, header, headerLayout, divider, footer, footerActions, footerLayout, footerDivider, bodyMaxHeight, bodyFlush, collapsible, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, labels, className, classNames, children, }: SectionProps): React.JSX.Element;
|
|
7
|
+
declare function SectionRoot({ id, as: Root, ariaLabel, variant, tone, density, title, titleAs, titleSize, icon, description, count, actions, header, headerLayout, divider, stickyHeader, stickyOffset, stickyZIndex, footer, footerActions, footerLayout, footerDivider, bodyMaxHeight, bodyFlush, collapsible, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, labels, className, classNames, children, }: SectionProps): React.JSX.Element;
|
|
8
8
|
/**
|
|
9
9
|
* `Section` — squelette en-tête / corps / pied. Les parties sont aussi
|
|
10
10
|
* disponibles en statiques : `Section.Header`, `Section.Body`, `Section.Footer`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.component.d.ts","sourceRoot":"","sources":["../../src/section/section.component.tsx"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,KAA0E,MAAM,OAAO,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"section.component.d.ts","sourceRoot":"","sources":["../../src/section/section.component.tsx"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,KAA0E,MAAM,OAAO,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAkCvD,iBAAS,WAAW,CAAC,EACnB,EAAE,EACF,EAAE,EAAE,IAAgB,EACpB,SAAS,EACT,OAAiB,EACjB,IAAe,EACf,OAAuB,EACvB,KAAK,EACL,OAAO,EACP,SAAS,EACT,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,MAAM,EACN,YAAsB,EACtB,OAAc,EACd,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,aAAa,EACb,YAAwB,EACxB,aAAoB,EACpB,aAAa,EACb,SAAS,EACT,WAAmB,EACnB,SAAS,EAAE,aAAa,EACxB,gBAAwB,EACxB,iBAAiB,EACjB,MAAM,EACN,SAAS,EACT,UAAe,EACf,QAAQ,GACT,EAAE,YAAY,qBA8Gd;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO;;;;;;;CAOlB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { cn } from "../page-background/page-background.utils.js";
|
|
|
4
4
|
import { DEFAULT_SECTION_LABELS, SectionContext } from "./section.context.js";
|
|
5
5
|
import { SectionAction } from "./section-action.component.js";
|
|
6
6
|
import { SectionGrid } from "./section-grid.component.js";
|
|
7
|
+
import { stickyStyleVars } from "./section-sticky.js";
|
|
7
8
|
import { SectionBody, SectionDivider, SectionFooter, SectionHeader } from "./section-parts.component.js";
|
|
8
9
|
// =============================================================================
|
|
9
10
|
// SECTION — squelette réutilisable pour toute section de page
|
|
@@ -21,7 +22,7 @@ import { SectionBody, SectionDivider, SectionFooter, SectionHeader } from "./sec
|
|
|
21
22
|
// sur le fond de page. Tout est optionnel et configurable (voir le guide
|
|
22
23
|
// d'utilisation en bas de fichier).
|
|
23
24
|
// =============================================================================
|
|
24
|
-
const TONE_ON_LIGHT = '[--section-fg:#0f172a] [--section-muted:rgba(15,23,42,0.62)] [--section-line:rgba(15,23,42,0.14)]';
|
|
25
|
+
const TONE_ON_LIGHT = '[--section-fg:#0f172a] [--section-muted:rgba(15,23,42,0.62)] [--section-line:rgba(15,23,42,0.14)] [--section-sticky-bg:rgb(255_255_255/0.82)]';
|
|
25
26
|
const VARIANT = {
|
|
26
27
|
plain: '',
|
|
27
28
|
glass: 'rounded-2xl p-5 backdrop-blur-xl ring-1 ring-inset ring-(--section-line,rgba(255,255,255,0.12))'
|
|
@@ -38,7 +39,7 @@ const PART_TYPES = new Set([
|
|
|
38
39
|
function isPresent(node) {
|
|
39
40
|
return node !== undefined && node !== null && node !== false && node !== '';
|
|
40
41
|
}
|
|
41
|
-
function SectionRoot({ id, as: Root = 'section', ariaLabel, variant = 'plain', tone = 'onDark', density = 'comfortable', title, titleAs, titleSize, icon, description, count, actions, header, headerLayout = 'split', divider = true, footer, footerActions, footerLayout = 'between', footerDivider = true, bodyMaxHeight, bodyFlush, collapsible = false, collapsed: collapsedProp, defaultCollapsed = false, onCollapsedChange, labels, className, classNames = {}, children }) {
|
|
42
|
+
function SectionRoot({ id, as: Root = 'section', ariaLabel, variant = 'plain', tone = 'onDark', density = 'comfortable', title, titleAs, titleSize, icon, description, count, actions, header, headerLayout = 'split', divider = true, stickyHeader, stickyOffset, stickyZIndex, footer, footerActions, footerLayout = 'between', footerDivider = true, bodyMaxHeight, bodyFlush, collapsible = false, collapsed: collapsedProp, defaultCollapsed = false, onCollapsedChange, labels, className, classNames = {}, children }) {
|
|
42
43
|
const reactId = useId();
|
|
43
44
|
const headingId = `${reactId}-title`;
|
|
44
45
|
const bodyId = `${reactId}-body`;
|
|
@@ -75,7 +76,8 @@ function SectionRoot({ id, as: Root = 'section', ariaLabel, variant = 'plain', t
|
|
|
75
76
|
collapsed,
|
|
76
77
|
toggle,
|
|
77
78
|
headingId: hasTitle ? headingId : undefined,
|
|
78
|
-
bodyId
|
|
79
|
+
bodyId,
|
|
80
|
+
stickyKey: `${stickyHeader}|${stickyOffset}|${stickyZIndex}`
|
|
79
81
|
}), [
|
|
80
82
|
tone,
|
|
81
83
|
density,
|
|
@@ -90,7 +92,10 @@ function SectionRoot({ id, as: Root = 'section', ariaLabel, variant = 'plain', t
|
|
|
90
92
|
toggle,
|
|
91
93
|
hasTitle,
|
|
92
94
|
headingId,
|
|
93
|
-
bodyId
|
|
95
|
+
bodyId,
|
|
96
|
+
stickyHeader,
|
|
97
|
+
stickyOffset,
|
|
98
|
+
stickyZIndex
|
|
94
99
|
]);
|
|
95
100
|
const hasHeader = hasTitle || isPresent(description) || isPresent(actions) || isPresent(icon) || isPresent(header) || count !== undefined && count !== null && count !== '' || collapsible;
|
|
96
101
|
const hasFooter = isPresent(footer) || isPresent(footerActions);
|
|
@@ -103,6 +108,11 @@ function SectionRoot({ id, as: Root = 'section', ariaLabel, variant = 'plain', t
|
|
|
103
108
|
"aria-label": ariaLabel,
|
|
104
109
|
"aria-labelledby": !ariaLabel && hasTitle ? headingId : undefined,
|
|
105
110
|
"data-section-variant": variant,
|
|
111
|
+
style: stickyStyleVars({
|
|
112
|
+
sticky: stickyHeader,
|
|
113
|
+
offset: stickyOffset,
|
|
114
|
+
zIndex: stickyZIndex
|
|
115
|
+
}),
|
|
106
116
|
className: cn('relative flex w-full min-w-0 flex-col text-(--section-fg,#fff)', tone === 'onLight' && TONE_ON_LIGHT, VARIANT[variant], variant === 'glass' && GLASS_FILL[tone], className, classNames.root),
|
|
107
117
|
children: [
|
|
108
118
|
hasHeader ? /*#__PURE__*/ _jsx(SectionHeader, {
|
|
@@ -189,4 +199,8 @@ function SectionRoot({ id, as: Root = 'section', ariaLabel, variant = 'plain', t
|
|
|
189
199
|
* vitré, `density="compact" | "spacious"` pour les espacements.
|
|
190
200
|
*
|
|
191
201
|
* Sans trait : `divider={false}` (sous l'en-tête) / `footerDivider={false}`.
|
|
202
|
+
*
|
|
203
|
+
* En-tête collant : `stickyHeader` (+ `stickyOffset`, `stickyZIndex`). Dans un
|
|
204
|
+
* `SectionSlot` c'est actif par défaut ; `stickyHeader={false}` s'en excepte.
|
|
205
|
+
* Fond une fois collé : variable CSS `--section-sticky-bg`.
|
|
192
206
|
* ==========================================================================*/
|
|
@@ -13,6 +13,8 @@ export interface SectionContextValue {
|
|
|
13
13
|
toggle: () => void;
|
|
14
14
|
headingId?: string;
|
|
15
15
|
bodyId?: string;
|
|
16
|
+
/** Change quand le mode collant demandé par la section change (re-lecture du style calculé). */
|
|
17
|
+
stickyKey?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare const DEFAULT_SECTION_LABELS: SectionLabels;
|
|
18
20
|
/** Valeurs par défaut : permet d'utiliser les parties hors d'un `Section`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.context.d.ts","sourceRoot":"","sources":["../../src/section/section.context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,mBAAmB,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"section.context.d.ts","sourceRoot":"","sources":["../../src/section/section.context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,mBAAmB,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,cAAc,8CAYzB,CAAC;AAEH,wBAAgB,iBAAiB,IAAI,mBAAmB,CAEvD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @category Section */
|
|
2
|
+
import type { AssignedExtension } from '@egen-civitas/esm-extensions';
|
|
2
3
|
import type React from 'react';
|
|
3
4
|
/** `onDark` : texte clair (fond de page sombre, cas par défaut). `onLight` : texte foncé. */
|
|
4
5
|
export type SectionTone = 'onDark' | 'onLight';
|
|
@@ -107,6 +108,17 @@ export interface SectionProps {
|
|
|
107
108
|
headerLayout?: SectionHeaderLayout;
|
|
108
109
|
/** Trait fin sous l'en-tête. @default true */
|
|
109
110
|
divider?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Garde l'en-tête collé en haut de la zone de défilement tant que le corps
|
|
113
|
+
* de la section est visible ; il repart avec la section, et celui de la
|
|
114
|
+
* section suivante prend le relais. Absent : hérite du `SectionSlot` parent
|
|
115
|
+
* (collant par défaut dans un slot), sinon non collant.
|
|
116
|
+
*/
|
|
117
|
+
stickyHeader?: boolean;
|
|
118
|
+
/** Décalage du haut de la zone (longueur CSS, ex. `'3rem'`). @default '0px' */
|
|
119
|
+
stickyOffset?: string;
|
|
120
|
+
/** Empilement de l'en-tête collant. @default 10 */
|
|
121
|
+
stickyZIndex?: number;
|
|
110
122
|
/** Contenu du pied (à gauche en disposition `between`). Pas de pied si absent. */
|
|
111
123
|
footer?: React.ReactNode;
|
|
112
124
|
/** Actions du pied (à droite en disposition `between`). */
|
|
@@ -137,4 +149,35 @@ export interface SectionProps {
|
|
|
137
149
|
*/
|
|
138
150
|
children?: React.ReactNode;
|
|
139
151
|
}
|
|
152
|
+
export interface SectionSlotItemInfo {
|
|
153
|
+
/** Nom de l'extension (clé `name` de `routes.json`). */
|
|
154
|
+
name: string;
|
|
155
|
+
/** Module qui a déclaré l'extension. */
|
|
156
|
+
moduleName: string;
|
|
157
|
+
/** `meta` déclarée par l'extension dans `routes.json`. */
|
|
158
|
+
meta: Record<string, unknown>;
|
|
159
|
+
}
|
|
160
|
+
export type SectionSlotGap = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
161
|
+
export interface SectionSlotProps {
|
|
162
|
+
/** Nom du slot d'extensions (ex. `'home-sections'`). */
|
|
163
|
+
name: string;
|
|
164
|
+
/** Données transmises à chaque extension (props de leur composant racine). */
|
|
165
|
+
state?: Record<string | symbol | number, unknown>;
|
|
166
|
+
/** Filtre / réordonne les extensions (même contrat que `ExtensionSlot`). */
|
|
167
|
+
select?: (extensions: Array<AssignedExtension>) => Array<AssignedExtension>;
|
|
168
|
+
/** En-têtes collants pour toutes les sections du slot. @default true */
|
|
169
|
+
stickyHeaders?: boolean;
|
|
170
|
+
/** Décalage du haut de la zone de défilement (longueur CSS). @default '0px' */
|
|
171
|
+
stickyOffset?: string;
|
|
172
|
+
/** Empilement des en-têtes collants. @default 10 */
|
|
173
|
+
stickyZIndex?: number;
|
|
174
|
+
/** Espace vertical entre les sections. @default 'lg' */
|
|
175
|
+
gap?: SectionSlotGap;
|
|
176
|
+
/** Habille chaque extension (ex. pour une grille ou un conteneur dédié). */
|
|
177
|
+
renderItem?: (element: React.ReactElement, info: SectionSlotItemInfo) => React.ReactNode;
|
|
178
|
+
className?: string;
|
|
179
|
+
/** Classe de l'enveloppe de chaque extension. */
|
|
180
|
+
itemClassName?: string;
|
|
181
|
+
style?: React.CSSProperties;
|
|
182
|
+
}
|
|
140
183
|
//# sourceMappingURL=section.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.types.d.ts","sourceRoot":"","sources":["../../src/section/section.types.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,6FAA6F;AAC7F,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC/C,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAC/C,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,m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