@egen-civitas/esm-styleguide 1.16.0 → 2.0.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 (53) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/_overrides.scss +0 -36
  3. package/dist/_vars.scss +1 -1
  4. package/dist/components/_main-content.scss +2 -5
  5. package/dist/components/_panel-overrides.scss +0 -12
  6. package/dist/content-section/content-section.component.d.ts +4 -0
  7. package/dist/content-section/content-section.component.d.ts.map +1 -1
  8. package/dist/content-section/content-section.component.js +4 -0
  9. package/dist/internal.d.ts +0 -2
  10. package/dist/internal.d.ts.map +1 -1
  11. package/dist/internal.js +0 -2
  12. package/dist/public.d.ts +1 -2
  13. package/dist/public.d.ts.map +1 -1
  14. package/dist/public.js +1 -2
  15. package/dist/section/index.d.ts +6 -0
  16. package/dist/section/index.d.ts.map +1 -0
  17. package/dist/section/index.js +5 -0
  18. package/dist/section/section-action.component.d.ts +31 -0
  19. package/dist/section/section-action.component.d.ts.map +1 -0
  20. package/dist/section/section-action.component.js +51 -0
  21. package/dist/section/section-grid.component.d.ts +38 -0
  22. package/dist/section/section-grid.component.d.ts.map +1 -0
  23. package/dist/section/section-grid.component.js +50 -0
  24. package/dist/section/section-parts.component.d.ts +14 -0
  25. package/dist/section/section-parts.component.d.ts.map +1 -0
  26. package/dist/section/section-parts.component.js +228 -0
  27. package/dist/section/section.component.d.ts +22 -0
  28. package/dist/section/section.component.d.ts.map +1 -0
  29. package/dist/section/section.component.js +192 -0
  30. package/dist/section/section.context.d.ts +21 -0
  31. package/dist/section/section.context.d.ts.map +1 -0
  32. package/dist/section/section.context.js +21 -0
  33. package/dist/section/section.types.d.ts +140 -0
  34. package/dist/section/section.types.d.ts.map +1 -0
  35. package/dist/section/section.types.js +1 -0
  36. package/dist/workbench/tool-window-rail.component.d.ts +1 -1
  37. package/dist/workbench/tool-window-rail.component.d.ts.map +1 -1
  38. package/dist/workbench/tool-window-rail.component.js +19 -8
  39. package/dist/workbench/use-tool-windows.d.ts +2 -1
  40. package/dist/workbench/use-tool-windows.d.ts.map +1 -1
  41. package/dist/workbench/use-tool-windows.js +5 -3
  42. package/mock-jest.tsx +93 -0
  43. package/mock.tsx +93 -0
  44. package/package.json +11 -11
  45. package/src/_vars.scss +1 -1
  46. package/dist/dashboard-extension/dashboard.module.scss +0 -13
  47. package/dist/dashboard-extension/index.d.ts +0 -13
  48. package/dist/dashboard-extension/index.d.ts.map +0 -1
  49. package/dist/dashboard-extension/index.js +0 -59
  50. package/dist/left-nav/index.d.ts +0 -27
  51. package/dist/left-nav/index.d.ts.map +0 -1
  52. package/dist/left-nav/index.js +0 -60
  53. package/dist/left-nav/left-nav.module.scss +0 -43
@@ -0,0 +1,228 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** @category Section */ import React, { useEffect, useRef, useState } from "react";
3
+ import { cn } from "../page-background/page-background.utils.js";
4
+ import { useSectionContext } from "./section.context.js";
5
+ // =============================================================================
6
+ // Parties du squelette Section : SectionDivider, SectionHeader, SectionBody,
7
+ // SectionFooter. Chacune lit la configuration de son `Section` parent (ton,
8
+ // densité, dispositions, classNames) et reste utilisable seule.
9
+ //
10
+ // Couleurs : variables CSS surchargeables (valeurs par défaut pour un fond
11
+ // sombre) — `--section-fg`, `--section-muted`, `--section-line`,
12
+ // `--section-accent`. Le texte reste clair quel que soit le thème, car le fond
13
+ // de page (PageBackground) est toujours sombre.
14
+ // =============================================================================
15
+ /** Durée du repli — doit rester alignée sur `duration-300` du corps. */ const COLLAPSE_MS = 320;
16
+ const HEADER_PAD = {
17
+ compact: 'pb-2',
18
+ comfortable: 'pb-3',
19
+ spacious: 'pb-4'
20
+ };
21
+ const BODY_PAD = {
22
+ compact: 'pt-3',
23
+ comfortable: 'pt-4',
24
+ spacious: 'pt-6'
25
+ };
26
+ const FOOTER_GAP = {
27
+ compact: 'mt-3',
28
+ comfortable: 'mt-4',
29
+ spacious: 'mt-6'
30
+ };
31
+ const FOOTER_PAD = {
32
+ compact: 'pt-2',
33
+ comfortable: 'pt-3',
34
+ spacious: 'pt-4'
35
+ };
36
+ const TITLE_SIZE = {
37
+ sm: 'text-base font-medium leading-snug',
38
+ md: 'text-xl font-light leading-tight sm:text-2xl',
39
+ lg: 'text-2xl font-light leading-tight sm:text-3xl'
40
+ };
41
+ const HEADER_ROW = {
42
+ split: 'flex-wrap items-center justify-between',
43
+ stacked: 'flex-col items-start',
44
+ centered: 'flex-col items-center text-center'
45
+ };
46
+ const HEADER_ACTIONS = {
47
+ split: 'ml-auto justify-end',
48
+ stacked: 'justify-start',
49
+ centered: 'justify-center'
50
+ };
51
+ const FOOTER_JUSTIFY = {
52
+ between: 'justify-between',
53
+ start: 'justify-start',
54
+ center: 'justify-center',
55
+ end: 'justify-end'
56
+ };
57
+ /** Trait fin pleine largeur, légèrement visible : ni bordure ni fond. */ export function SectionDivider({ className }) {
58
+ const { classNames } = useSectionContext();
59
+ return /*#__PURE__*/ _jsx("div", {
60
+ role: "presentation",
61
+ "aria-hidden": "true",
62
+ "data-section-part": "divider",
63
+ className: cn('h-px w-full shrink-0 bg-(--section-line,rgba(255,255,255,0.12))', classNames.divider, className)
64
+ });
65
+ }
66
+ function CollapseToggle() {
67
+ const { collapsed, toggle, labels, bodyId } = useSectionContext();
68
+ const label = collapsed ? labels.expand : labels.collapse;
69
+ return /*#__PURE__*/ _jsx("button", {
70
+ type: "button",
71
+ onClick: toggle,
72
+ title: label,
73
+ "aria-label": label,
74
+ "aria-expanded": !collapsed,
75
+ "aria-controls": bodyId,
76
+ className: cn('inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 p-0', 'bg-transparent text-(--section-muted,rgba(255,255,255,0.65)) outline-none transition-colors duration-150', 'hover:bg-(--section-fg,#fff)/10 hover:text-(--section-fg,#fff)', 'focus-visible:ring-2 focus-visible:ring-(--section-accent,#34d399)/70'),
77
+ children: /*#__PURE__*/ _jsx("svg", {
78
+ viewBox: "0 0 16 16",
79
+ width: "16",
80
+ height: "16",
81
+ fill: "none",
82
+ stroke: "currentColor",
83
+ strokeWidth: "1.5",
84
+ strokeLinecap: "round",
85
+ strokeLinejoin: "round",
86
+ "aria-hidden": "true",
87
+ className: cn('transition-transform duration-300 motion-reduce:transition-none', !collapsed && 'rotate-180'),
88
+ children: /*#__PURE__*/ _jsx("path", {
89
+ d: "M4 6l4 4 4-4"
90
+ })
91
+ })
92
+ });
93
+ }
94
+ /** En-tête : titre à gauche, actions à droite (disposition par défaut), puis trait fin. */ export function SectionHeader({ title, titleAs = 'h2', titleSize = 'md', icon, description, count, actions, children, layout, divider, className }) {
95
+ const ctx = useSectionContext();
96
+ const { classNames, density, collapsible } = ctx;
97
+ const resolvedLayout = layout ?? ctx.headerLayout;
98
+ const showDivider = divider ?? ctx.divider;
99
+ const TitleTag = titleAs;
100
+ const hasCount = count !== undefined && count !== null && count !== '';
101
+ const hasActions = actions !== undefined && actions !== null && actions !== false;
102
+ return /*#__PURE__*/ _jsxs("div", {
103
+ "data-section-part": "header",
104
+ className: cn('flex flex-col', classNames.header, className),
105
+ children: [
106
+ /*#__PURE__*/ _jsxs("div", {
107
+ className: cn('flex gap-x-4 gap-y-2', HEADER_ROW[resolvedLayout], HEADER_PAD[density]),
108
+ children: [
109
+ children !== undefined && children !== null ? /*#__PURE__*/ _jsx("div", {
110
+ className: "min-w-0 flex-1",
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),
114
+ children: [
115
+ /*#__PURE__*/ _jsxs("div", {
116
+ className: cn('flex min-w-0 items-center gap-2.5', resolvedLayout === 'centered' && 'justify-center'),
117
+ children: [
118
+ icon ? /*#__PURE__*/ _jsx("span", {
119
+ className: cn('inline-flex shrink-0 items-center justify-center text-(--section-accent,#34d399)', classNames.leading),
120
+ children: icon
121
+ }) : null,
122
+ title ? /*#__PURE__*/ _jsx(TitleTag, {
123
+ id: ctx.headingId,
124
+ className: cn('m-0 min-w-0 text-balance tracking-tight text-(--section-fg,#fff)', TITLE_SIZE[titleSize], classNames.title),
125
+ children: title
126
+ }) : null,
127
+ hasCount ? /*#__PURE__*/ _jsx("span", {
128
+ 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),
129
+ children: count
130
+ }) : null
131
+ ]
132
+ }),
133
+ description ? /*#__PURE__*/ _jsx("p", {
134
+ className: cn('m-0 max-w-3xl text-sm leading-relaxed text-(--section-muted,rgba(255,255,255,0.65))', classNames.description),
135
+ children: description
136
+ }) : null
137
+ ]
138
+ }),
139
+ hasActions || collapsible ? /*#__PURE__*/ _jsxs("div", {
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
146
+ ]
147
+ }),
148
+ showDivider ? /*#__PURE__*/ _jsx(SectionDivider, {}) : null
149
+ ]
150
+ });
151
+ }
152
+ /** Corps : contenu libre, repliable avec le `Section` parent. */ export function SectionBody({ children, flush = false, maxHeight, className }) {
153
+ const { classNames, density, collapsible, collapsed, bodyId } = useSectionContext();
154
+ // `overflow: hidden` n'est posé que pendant l'animation de repli et quand le
155
+ // corps est replié : en régime établi il reste visible, pour ne pas rogner
156
+ // ombres, anneaux de focus ni effets de survol des cartes.
157
+ const [clip, setClip] = useState(collapsed);
158
+ const firstRun = useRef(true);
159
+ useEffect(()=>{
160
+ if (firstRun.current) {
161
+ firstRun.current = false;
162
+ return undefined;
163
+ }
164
+ setClip(true);
165
+ const timer = setTimeout(()=>setClip(collapsed), COLLAPSE_MS);
166
+ return ()=>clearTimeout(timer);
167
+ }, [
168
+ collapsed
169
+ ]);
170
+ const content = /*#__PURE__*/ _jsx("div", {
171
+ "data-section-part": "body",
172
+ className: cn('min-w-0', !flush && BODY_PAD[density], maxHeight && 'overflow-y-auto overscroll-contain', classNames.body, className),
173
+ style: maxHeight ? {
174
+ maxHeight
175
+ } : undefined,
176
+ children: children
177
+ });
178
+ if (!collapsible) {
179
+ return /*#__PURE__*/ _jsx("div", {
180
+ id: bodyId,
181
+ children: content
182
+ });
183
+ }
184
+ return /*#__PURE__*/ _jsx("div", {
185
+ id: bodyId,
186
+ "aria-hidden": collapsed || undefined,
187
+ ...collapsed ? {
188
+ inert: ''
189
+ } : {},
190
+ className: cn('grid transition-[grid-template-rows] duration-300 ease-out motion-reduce:transition-none', collapsed ? 'grid-rows-[0fr]' : 'grid-rows-[1fr]'),
191
+ children: /*#__PURE__*/ _jsx("div", {
192
+ className: cn('min-h-0', clip && 'overflow-hidden'),
193
+ children: content
194
+ })
195
+ });
196
+ }
197
+ /** Pied : contenu à gauche, actions à droite (disposition par défaut), précédé d'un trait fin. */ export function SectionFooter({ children, actions, layout, divider, className }) {
198
+ const ctx = useSectionContext();
199
+ const { classNames, density, collapsible, collapsed } = ctx;
200
+ const resolvedLayout = layout ?? ctx.footerLayout;
201
+ const showDivider = divider ?? ctx.footerDivider;
202
+ const hasChildren = children !== undefined && children !== null && children !== false;
203
+ const hasActions = actions !== undefined && actions !== null && actions !== false;
204
+ // Un `Section` replié ne montre que son en-tête.
205
+ if (collapsible && collapsed) {
206
+ return null;
207
+ }
208
+ return /*#__PURE__*/ _jsxs("div", {
209
+ "data-section-part": "footer",
210
+ className: cn('flex flex-col', FOOTER_GAP[density], classNames.footer, className),
211
+ children: [
212
+ showDivider ? /*#__PURE__*/ _jsx(SectionDivider, {}) : null,
213
+ /*#__PURE__*/ _jsxs("div", {
214
+ className: cn('flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-(--section-muted,rgba(255,255,255,0.65))', FOOTER_PAD[density], FOOTER_JUSTIFY[resolvedLayout]),
215
+ children: [
216
+ hasChildren ? /*#__PURE__*/ _jsx("div", {
217
+ className: cn('min-w-0', classNames.footerStart),
218
+ children: children
219
+ }) : null,
220
+ hasActions ? /*#__PURE__*/ _jsx("div", {
221
+ className: cn('flex flex-wrap items-center gap-1.5', resolvedLayout === 'between' && 'ml-auto', classNames.footerEnd),
222
+ children: actions
223
+ }) : null
224
+ ]
225
+ })
226
+ ]
227
+ });
228
+ }
@@ -0,0 +1,22 @@
1
+ /** @category Section */
2
+ import React from 'react';
3
+ import { SectionAction } from './section-action.component.js';
4
+ import { SectionGrid } from './section-grid.component.js';
5
+ import { SectionBody, SectionDivider, SectionFooter, SectionHeader } from './section-parts.component.js';
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;
8
+ /**
9
+ * `Section` — squelette en-tête / corps / pied. Les parties sont aussi
10
+ * disponibles en statiques : `Section.Header`, `Section.Body`, `Section.Footer`,
11
+ * `Section.Divider`, `Section.Action`, `Section.Grid`.
12
+ */
13
+ export declare const Section: typeof SectionRoot & {
14
+ Header: typeof SectionHeader;
15
+ Body: typeof SectionBody;
16
+ Footer: typeof SectionFooter;
17
+ Divider: typeof SectionDivider;
18
+ Action: typeof SectionAction;
19
+ Grid: typeof SectionGrid;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=section.component.d.ts.map
@@ -0,0 +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;AAC1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAiCvD,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,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,qBAyGd;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO;;;;;;;CAOlB,CAAC"}
@@ -0,0 +1,192 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** @category Section */ import React, { Children, isValidElement, useCallback, useId, useMemo, useState } from "react";
3
+ import { cn } from "../page-background/page-background.utils.js";
4
+ import { DEFAULT_SECTION_LABELS, SectionContext } from "./section.context.js";
5
+ import { SectionAction } from "./section-action.component.js";
6
+ import { SectionGrid } from "./section-grid.component.js";
7
+ import { SectionBody, SectionDivider, SectionFooter, SectionHeader } from "./section-parts.component.js";
8
+ // =============================================================================
9
+ // SECTION — squelette réutilisable pour toute section de page
10
+ //
11
+ // ┌ En-tête ─────────────────────────────────────────────┐
12
+ // │ [icône] Titre (compteur) [actions…] ▾ │
13
+ // │ Description │
14
+ // ├──────────────────── trait fin ───────────────────────┤ ← 1 px, opacité réduite
15
+ // │ Corps : contenu libre (SectionGrid, liste, carte...) │
16
+ // ├──────────────────── trait fin ───────────────────────┤
17
+ // │ Pied : contenu [actions] │
18
+ // └──────────────────────────────────────────────────────┘
19
+ //
20
+ // Aucune bordure, aucun fond par défaut : la section est posée directement
21
+ // sur le fond de page. Tout est optionnel et configurable (voir le guide
22
+ // d'utilisation en bas de fichier).
23
+ // =============================================================================
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 VARIANT = {
26
+ plain: '',
27
+ glass: 'rounded-2xl p-5 backdrop-blur-xl ring-1 ring-inset ring-(--section-line,rgba(255,255,255,0.12))'
28
+ };
29
+ const GLASS_FILL = {
30
+ onDark: 'bg-black/40',
31
+ onLight: 'bg-white/70'
32
+ };
33
+ const PART_TYPES = new Set([
34
+ SectionHeader,
35
+ SectionBody,
36
+ SectionFooter
37
+ ]);
38
+ function isPresent(node) {
39
+ return node !== undefined && node !== null && node !== false && node !== '';
40
+ }
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
+ const reactId = useId();
43
+ const headingId = `${reactId}-title`;
44
+ const bodyId = `${reactId}-body`;
45
+ const [innerCollapsed, setInnerCollapsed] = useState(defaultCollapsed);
46
+ const collapsed = collapsible && (collapsedProp ?? innerCollapsed);
47
+ const toggle = useCallback(()=>{
48
+ const next = !collapsed;
49
+ if (collapsedProp === undefined) {
50
+ setInnerCollapsed(next);
51
+ }
52
+ onCollapsedChange?.(next);
53
+ }, [
54
+ collapsed,
55
+ collapsedProp,
56
+ onCollapsedChange
57
+ ]);
58
+ const hasTitle = isPresent(title);
59
+ const labelsValue = useMemo(()=>({
60
+ ...DEFAULT_SECTION_LABELS,
61
+ ...labels
62
+ }), [
63
+ labels
64
+ ]);
65
+ const ctx = useMemo(()=>({
66
+ tone,
67
+ density,
68
+ classNames,
69
+ labels: labelsValue,
70
+ headerLayout,
71
+ footerLayout,
72
+ divider,
73
+ footerDivider,
74
+ collapsible,
75
+ collapsed,
76
+ toggle,
77
+ headingId: hasTitle ? headingId : undefined,
78
+ bodyId
79
+ }), [
80
+ tone,
81
+ density,
82
+ classNames,
83
+ labelsValue,
84
+ headerLayout,
85
+ footerLayout,
86
+ divider,
87
+ footerDivider,
88
+ collapsible,
89
+ collapsed,
90
+ toggle,
91
+ hasTitle,
92
+ headingId,
93
+ bodyId
94
+ ]);
95
+ const hasHeader = hasTitle || isPresent(description) || isPresent(actions) || isPresent(icon) || isPresent(header) || count !== undefined && count !== null && count !== '' || collapsible;
96
+ const hasFooter = isPresent(footer) || isPresent(footerActions);
97
+ const hasBody = isPresent(children);
98
+ const composed = Children.toArray(children).some((child)=>/*#__PURE__*/ isValidElement(child) && PART_TYPES.has(child.type));
99
+ return /*#__PURE__*/ _jsx(SectionContext.Provider, {
100
+ value: ctx,
101
+ children: /*#__PURE__*/ _jsxs(Root, {
102
+ id: id,
103
+ "aria-label": ariaLabel,
104
+ "aria-labelledby": !ariaLabel && hasTitle ? headingId : undefined,
105
+ "data-section-variant": variant,
106
+ 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
+ children: [
108
+ hasHeader ? /*#__PURE__*/ _jsx(SectionHeader, {
109
+ title: title,
110
+ titleAs: titleAs,
111
+ titleSize: titleSize,
112
+ icon: icon,
113
+ description: description,
114
+ count: count,
115
+ actions: actions,
116
+ children: header
117
+ }) : null,
118
+ hasBody ? composed ? children : /*#__PURE__*/ _jsx(SectionBody, {
119
+ flush: bodyFlush,
120
+ maxHeight: bodyMaxHeight,
121
+ children: children
122
+ }) : null,
123
+ hasFooter ? /*#__PURE__*/ _jsx(SectionFooter, {
124
+ actions: footerActions,
125
+ children: footer
126
+ }) : null
127
+ ]
128
+ })
129
+ });
130
+ }
131
+ /**
132
+ * `Section` — squelette en-tête / corps / pied. Les parties sont aussi
133
+ * disponibles en statiques : `Section.Header`, `Section.Body`, `Section.Footer`,
134
+ * `Section.Divider`, `Section.Action`, `Section.Grid`.
135
+ */ export const Section = Object.assign(SectionRoot, {
136
+ Header: SectionHeader,
137
+ Body: SectionBody,
138
+ Footer: SectionFooter,
139
+ Divider: SectionDivider,
140
+ Action: SectionAction,
141
+ Grid: SectionGrid
142
+ }); /* ============================================================================
143
+ * GUIDE D'UTILISATION — Section
144
+ * ============================================================================
145
+ * Cas courant — raccourcis `title` / `actions` / `footer` :
146
+ *
147
+ * <Section
148
+ * title="Actualités"
149
+ * count={8}
150
+ * actions={<SectionAction onClick={...}>Voir tout</SectionAction>}
151
+ * footer="6 articles sur 8"
152
+ * footerActions={<SectionAction size="sm" href="/informations/news">Tout lire →</SectionAction>}
153
+ * >
154
+ * <SectionGrid minItemWidth="16rem" gap="lg">{cards}</SectionGrid>
155
+ * </Section>
156
+ *
157
+ * Filtres dans l'en-tête (plusieurs SectionAction avec `active`) :
158
+ *
159
+ * <Section title="Annonces" actions={levels.map((l) => (
160
+ * <SectionAction key={l} size="sm" active={l === level} onClick={() => setLevel(l)}>{l}</SectionAction>
161
+ * ))}>…</Section>
162
+ *
163
+ * Disposition de l'en-tête / du pied :
164
+ *
165
+ * <Section headerLayout="stacked" footerLayout="center" …>
166
+ *
167
+ * En-tête libre (remplace titre + description + actions) :
168
+ *
169
+ * <Section header={<MyToolbar />}>…</Section>
170
+ *
171
+ * Composition manuelle — dès qu'un enfant est une partie, rien n'est
172
+ * enveloppé automatiquement, vous placez chaque partie où vous voulez :
173
+ *
174
+ * <Section ariaLabel="Équipe" collapsible>
175
+ * <Section.Header title="Équipe" actions={…} />
176
+ * <Section.Body maxHeight="20rem">…</Section.Body>
177
+ * <Section.Footer layout="end">…</Section.Footer>
178
+ * </Section>
179
+ *
180
+ * Repli : `collapsible` (+ `defaultCollapsed`, ou `collapsed` /
181
+ * `onCollapsedChange` en mode contrôlé). Un `Section` replié ne montre que
182
+ * son en-tête.
183
+ *
184
+ * Personnalisation fine :
185
+ * - `classNames={{ title: '…', divider: '…', body: '…' }}` pour chaque partie ;
186
+ * - variables CSS `--section-fg`, `--section-muted`, `--section-line`,
187
+ * `--section-accent` (via `style` ou une classe) ;
188
+ * - `tone="onLight"` pour un fond clair, `variant="glass"` pour un panneau
189
+ * vitré, `density="compact" | "spacious"` pour les espacements.
190
+ *
191
+ * Sans trait : `divider={false}` (sous l'en-tête) / `footerDivider={false}`.
192
+ * ==========================================================================*/
@@ -0,0 +1,21 @@
1
+ import type { SectionClassNames, SectionDensity, SectionFooterLayout, SectionHeaderLayout, SectionLabels, SectionTone } from './section.types.js';
2
+ export interface SectionContextValue {
3
+ tone: SectionTone;
4
+ density: SectionDensity;
5
+ classNames: SectionClassNames;
6
+ labels: SectionLabels;
7
+ headerLayout: SectionHeaderLayout;
8
+ footerLayout: SectionFooterLayout;
9
+ divider: boolean;
10
+ footerDivider: boolean;
11
+ collapsible: boolean;
12
+ collapsed: boolean;
13
+ toggle: () => void;
14
+ headingId?: string;
15
+ bodyId?: string;
16
+ }
17
+ export declare const DEFAULT_SECTION_LABELS: SectionLabels;
18
+ /** Valeurs par défaut : permet d'utiliser les parties hors d'un `Section`. */
19
+ export declare const SectionContext: import("react").Context<SectionContextValue>;
20
+ export declare function useSectionContext(): SectionContextValue;
21
+ //# sourceMappingURL=section.context.d.ts.map
@@ -0,0 +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;CACjB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,cAAc,8CAYzB,CAAC;AAEH,wBAAgB,iBAAiB,IAAI,mBAAmB,CAEvD"}
@@ -0,0 +1,21 @@
1
+ /** @category Section */ import { createContext, useContext } from "react";
2
+ export const DEFAULT_SECTION_LABELS = {
3
+ collapse: 'Replier la section',
4
+ expand: 'Déplier la section'
5
+ };
6
+ /** Valeurs par défaut : permet d'utiliser les parties hors d'un `Section`. */ export const SectionContext = createContext({
7
+ tone: 'onDark',
8
+ density: 'comfortable',
9
+ classNames: {},
10
+ labels: DEFAULT_SECTION_LABELS,
11
+ headerLayout: 'split',
12
+ footerLayout: 'between',
13
+ divider: true,
14
+ footerDivider: true,
15
+ collapsible: false,
16
+ collapsed: false,
17
+ toggle: ()=>undefined
18
+ });
19
+ export function useSectionContext() {
20
+ return useContext(SectionContext);
21
+ }
@@ -0,0 +1,140 @@
1
+ /** @category Section */
2
+ import type React from 'react';
3
+ /** `onDark` : texte clair (fond de page sombre, cas par défaut). `onLight` : texte foncé. */
4
+ export type SectionTone = 'onDark' | 'onLight';
5
+ /** `plain` : aucun habillage (défaut). `glass` : panneau vitré, opt-in. */
6
+ export type SectionVariant = 'plain' | 'glass';
7
+ /** Espacement vertical entre en-tête, corps et pied. */
8
+ export type SectionDensity = 'compact' | 'comfortable' | 'spacious';
9
+ export type SectionTitleSize = 'sm' | 'md' | 'lg';
10
+ export type SectionTitleTag = 'h1' | 'h2' | 'h3' | 'h4' | 'div';
11
+ export type SectionRootTag = 'section' | 'div' | 'aside' | 'article';
12
+ /**
13
+ * Disposition de l'en-tête.
14
+ * - `split` (défaut) : titre à gauche, actions à droite (passent dessous si la place manque).
15
+ * - `stacked` : titre puis actions en dessous, alignés à gauche.
16
+ * - `centered` : titre puis actions en dessous, centrés.
17
+ */
18
+ export type SectionHeaderLayout = 'split' | 'stacked' | 'centered';
19
+ /**
20
+ * Disposition du pied.
21
+ * - `between` (défaut) : contenu à gauche, actions à droite.
22
+ * - `start` | `center` | `end` : tout regroupé de ce côté.
23
+ */
24
+ export type SectionFooterLayout = 'between' | 'start' | 'center' | 'end';
25
+ /** Classes additionnelles par partie (fusionnées après les classes par défaut). */
26
+ export interface SectionClassNames {
27
+ root?: string;
28
+ header?: string;
29
+ leading?: string;
30
+ heading?: string;
31
+ title?: string;
32
+ description?: string;
33
+ count?: string;
34
+ actions?: string;
35
+ divider?: string;
36
+ body?: string;
37
+ footer?: string;
38
+ footerStart?: string;
39
+ footerEnd?: string;
40
+ }
41
+ /** Libellés accessibles du bouton replier/déplier. Doivent être déjà traduits. */
42
+ export interface SectionLabels {
43
+ collapse: string;
44
+ expand: string;
45
+ }
46
+ export interface SectionHeaderProps {
47
+ /** Titre de la section (à gauche en disposition `split`). */
48
+ title?: React.ReactNode;
49
+ /** Balise du titre. @default 'h2' */
50
+ titleAs?: SectionTitleTag;
51
+ /** Taille typographique du titre. @default 'md' */
52
+ titleSize?: SectionTitleSize;
53
+ /** Icône ou visuel placé avant le titre. */
54
+ icon?: React.ReactNode;
55
+ /** Texte descriptif sous le titre. */
56
+ description?: React.ReactNode;
57
+ /** Compteur affiché en pastille après le titre (masqué si `undefined`/`null`). */
58
+ count?: number | string | null;
59
+ /** Boutons de contrôle, filtres, menus... (à droite en disposition `split`). */
60
+ actions?: React.ReactNode;
61
+ /** Remplace entièrement titre/description/actions par un contenu libre. */
62
+ children?: React.ReactNode;
63
+ /** Surcharge la disposition définie sur `Section`. */
64
+ layout?: SectionHeaderLayout;
65
+ /** Trait fin sous l'en-tête. Surcharge la valeur de `Section`. */
66
+ divider?: boolean;
67
+ className?: string;
68
+ }
69
+ export interface SectionBodyProps {
70
+ children?: React.ReactNode;
71
+ /** Supprime l'espacement entre le trait de l'en-tête et le contenu. @default false */
72
+ flush?: boolean;
73
+ /** Hauteur max (ex. `'24rem'`) : au-delà, le corps défile verticalement. */
74
+ maxHeight?: string;
75
+ className?: string;
76
+ }
77
+ export interface SectionFooterProps {
78
+ /** Contenu principal (à gauche en disposition `between`). */
79
+ children?: React.ReactNode;
80
+ /** Actions (à droite en disposition `between`). */
81
+ actions?: React.ReactNode;
82
+ /** Surcharge la disposition définie sur `Section`. */
83
+ layout?: SectionFooterLayout;
84
+ /** Trait fin au-dessus du pied. Surcharge la valeur de `Section`. */
85
+ divider?: boolean;
86
+ className?: string;
87
+ }
88
+ export interface SectionProps {
89
+ id?: string;
90
+ /** Balise racine. @default 'section' */
91
+ as?: SectionRootTag;
92
+ /** Libellé accessible si le titre visuel ne suffit pas. */
93
+ ariaLabel?: string;
94
+ variant?: SectionVariant;
95
+ tone?: SectionTone;
96
+ density?: SectionDensity;
97
+ title?: React.ReactNode;
98
+ titleAs?: SectionTitleTag;
99
+ titleSize?: SectionTitleSize;
100
+ icon?: React.ReactNode;
101
+ description?: React.ReactNode;
102
+ count?: number | string | null;
103
+ actions?: React.ReactNode;
104
+ /** Contenu libre qui remplace titre/description/actions. */
105
+ header?: React.ReactNode;
106
+ /** @default 'split' */
107
+ headerLayout?: SectionHeaderLayout;
108
+ /** Trait fin sous l'en-tête. @default true */
109
+ divider?: boolean;
110
+ /** Contenu du pied (à gauche en disposition `between`). Pas de pied si absent. */
111
+ footer?: React.ReactNode;
112
+ /** Actions du pied (à droite en disposition `between`). */
113
+ footerActions?: React.ReactNode;
114
+ /** @default 'between' */
115
+ footerLayout?: SectionFooterLayout;
116
+ /** Trait fin au-dessus du pied. @default true */
117
+ footerDivider?: boolean;
118
+ /** Hauteur max du corps (défile au-delà). */
119
+ bodyMaxHeight?: string;
120
+ /** Supprime l'espacement entre le trait de l'en-tête et le contenu. */
121
+ bodyFlush?: boolean;
122
+ /** Affiche un bouton replier/déplier dans l'en-tête. @default false */
123
+ collapsible?: boolean;
124
+ /** État replié (mode contrôlé). */
125
+ collapsed?: boolean;
126
+ /** État replié initial (mode non contrôlé). @default false */
127
+ defaultCollapsed?: boolean;
128
+ onCollapsedChange?: (collapsed: boolean) => void;
129
+ /** @default { collapse: 'Replier la section', expand: 'Déplier la section' } */
130
+ labels?: Partial<SectionLabels>;
131
+ className?: string;
132
+ classNames?: SectionClassNames;
133
+ /**
134
+ * Contenu du corps. Si les enfants contiennent déjà `SectionHeader`,
135
+ * `SectionBody` ou `SectionFooter`, ils sont rendus tels quels (composition
136
+ * manuelle) ; sinon ils sont enveloppés dans un `SectionBody`.
137
+ */
138
+ children?: React.ReactNode;
139
+ }
140
+ //# sourceMappingURL=section.types.d.ts.map
@@ -0,0 +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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0,0 +1 @@
1
+ /** @category Section */ export { };
@@ -4,6 +4,6 @@ import React from 'react';
4
4
  * gauche ; en bas, celles affichées dans la zone basse (ex. terminal).
5
5
  */
6
6
  export declare function LeftRail(): React.JSX.Element;
7
- /** Rail droit (fixe) : options globales, affichées dans la zone droite. */
7
+ /** Rail droit (fixe) : options globales en haut (zone droite) ; en bas, celles qui ouvrent la zone basse. */
8
8
  export declare function RightRail(): React.JSX.Element;
9
9
  //# sourceMappingURL=tool-window-rail.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-window-rail.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-rail.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAyD1B;;;GAGG;AACH,wBAAgB,QAAQ,sBAQvB;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,sBAMxB"}
1
+ {"version":3,"file":"tool-window-rail.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-rail.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAyD1B;;;GAGG;AACH,wBAAgB,QAAQ,sBAQvB;AAED,6GAA6G;AAC7G,wBAAgB,SAAS,sBAQxB"}