@navette-js/schemas 0.0.0-stage → 1.0.0-beta.1
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/LICENSE +21 -0
- package/README.md +8 -2
- package/lib/index.d.ts +519 -0
- package/lib/index.js +832 -0
- package/package.json +46 -4
- package/views/asset.ejs +1 -0
- package/views/component.ejs +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NavetteJS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @navette-js/schemas
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Layout components and schemas for Navette, the Node.js port of Filament.
|
|
4
|
+
|
|
5
|
+
Part of [Navette](https://github.com/NavetteJS/navette), a Node.js port of [Filament](https://filamentphp.com). Install the whole framework with `npm install @navette-js/panels`.
|
|
6
|
+
|
|
7
|
+
**Beta:** the API may still change between beta releases.
|
|
8
|
+
|
|
9
|
+
License: MIT. Third-party notices: see `THIRD-PARTY-NOTICES.md` where present.
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import { HtmlString, type ColorManager, type Lazy } from '@navette-js/support';
|
|
2
|
+
/** Ce qu'un schéma attend du composant à état qui l'héberge. */
|
|
3
|
+
export interface SchemaHost {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
_errors: Record<string, string[]>;
|
|
6
|
+
getSchema(name: string): Schema | Promise<Schema>;
|
|
7
|
+
}
|
|
8
|
+
export type ComponentContext = {
|
|
9
|
+
livewire: SchemaHost;
|
|
10
|
+
component: Component;
|
|
11
|
+
operation: string | null;
|
|
12
|
+
record: unknown;
|
|
13
|
+
get: (path: string) => unknown;
|
|
14
|
+
state: unknown;
|
|
15
|
+
};
|
|
16
|
+
type SpanValue = number | string | ((ctx: ComponentContext) => number | string | Promise<number | string>);
|
|
17
|
+
type ColumnSpan = Record<string, SpanValue> | number | string;
|
|
18
|
+
export declare abstract class Component {
|
|
19
|
+
private _grow;
|
|
20
|
+
/** Dans un Flex : `false` pour garder la largeur naturelle au lieu d'occuper la place disponible. */
|
|
21
|
+
grow(condition?: boolean): this;
|
|
22
|
+
canGrow(): boolean;
|
|
23
|
+
/** Réglage par défaut de toutes les instances créées ensuite par `make()` : `TextInput.configureUsing((input) => input.maxLength(255))`. */
|
|
24
|
+
static configureUsing<T>(this: abstract new (...args: any[]) => T, configure: (instance: T) => void): void;
|
|
25
|
+
protected _name: string | null;
|
|
26
|
+
protected _keyName: string | null;
|
|
27
|
+
protected _hidden: Lazy<boolean, ComponentContext>;
|
|
28
|
+
protected _visible: Lazy<boolean, ComponentContext>;
|
|
29
|
+
protected _columnSpan: ColumnSpan;
|
|
30
|
+
protected _extraAttributes: Record<string, string>;
|
|
31
|
+
protected _columnStart: number | null;
|
|
32
|
+
container: Schema;
|
|
33
|
+
hidden(condition?: Lazy<boolean, ComponentContext>): this;
|
|
34
|
+
visible(condition?: Lazy<boolean, ComponentContext>): this;
|
|
35
|
+
key(key: string | null): this;
|
|
36
|
+
/** Masqué pour une opération donnée (`'create'`, `'edit'`…). */
|
|
37
|
+
hiddenOn(operations: string | string[]): this;
|
|
38
|
+
/** Visible seulement pour une opération donnée. */
|
|
39
|
+
visibleOn(operations: string | string[]): this;
|
|
40
|
+
/** Comme Filament : un nombre vaut pour le point de rupture `lg` ; un objet remplace entièrement la valeur par défaut. Les valeurs peuvent être des closures. */
|
|
41
|
+
columnSpan(span: ColumnSpan): this;
|
|
42
|
+
/** Colonne de départ dans la grille, à partir du point de rupture `lg` (comme Filament). */
|
|
43
|
+
columnStart(start: number | null): this;
|
|
44
|
+
extraAttributes(attributes: Record<string, string>): this;
|
|
45
|
+
get livewire(): SchemaHost;
|
|
46
|
+
isLiberatedFromContainerGrid(): boolean;
|
|
47
|
+
/** Méthodes que le JavaScript du composant peut appeler côté serveur (annoncées au navigateur). */
|
|
48
|
+
getExposedMethods(): string[];
|
|
49
|
+
/** Faux pour une méthode exposée après laquelle le composant hôte doit être redessiné (étape suivante d'un assistant : erreurs de validation). */
|
|
50
|
+
isRenderlessMethod(_method: string): boolean;
|
|
51
|
+
hasStatePath(): boolean;
|
|
52
|
+
/** Clé absolue du composant : `<clé du schéma>.<clé ou nom>`, ou null. */
|
|
53
|
+
getKey(): string | null;
|
|
54
|
+
getLivewireKey(): string | null;
|
|
55
|
+
getStatePath(): string;
|
|
56
|
+
getAlpineScopeConfiguration(): Record<string, unknown>;
|
|
57
|
+
context(): ComponentContext;
|
|
58
|
+
isVisible(): Promise<boolean>;
|
|
59
|
+
/** HTML propre au composant (sans son enveloppe de grille). */
|
|
60
|
+
abstract toHtml(): Promise<string>;
|
|
61
|
+
/** Port de Component::toSchemaHtml : enveloppe de colonne de grille, rendue même si le composant est masqué. */
|
|
62
|
+
toSchemaHtml(isVisible: boolean): Promise<string>;
|
|
63
|
+
}
|
|
64
|
+
export declare class Schema {
|
|
65
|
+
livewire: SchemaHost;
|
|
66
|
+
private _key;
|
|
67
|
+
private _components;
|
|
68
|
+
private _statePath;
|
|
69
|
+
private _columns;
|
|
70
|
+
private _root;
|
|
71
|
+
private _inline;
|
|
72
|
+
private _operation;
|
|
73
|
+
private _record;
|
|
74
|
+
private _extraClass;
|
|
75
|
+
private _partial;
|
|
76
|
+
private _dense;
|
|
77
|
+
constructor(livewire: SchemaHost);
|
|
78
|
+
static make(livewire: SchemaHost): Schema;
|
|
79
|
+
key(key: string): this;
|
|
80
|
+
components(components: Component[]): this;
|
|
81
|
+
schema(components: Component[]): this;
|
|
82
|
+
statePath(path: string | null): this;
|
|
83
|
+
columns(columns: Record<string, number> | number | null): this;
|
|
84
|
+
root(isRoot?: boolean): this;
|
|
85
|
+
inline(isInline?: boolean): this;
|
|
86
|
+
operation(operation: string | null): this;
|
|
87
|
+
record(record: unknown): this;
|
|
88
|
+
/** Classe placée avant celles de la grille (ex. `fi-section-content`). */
|
|
89
|
+
extraClass(name: string | null): this;
|
|
90
|
+
/** Espacement resserré entre composants (`fi-sc-dense`). */
|
|
91
|
+
dense(condition?: boolean): this;
|
|
92
|
+
/** Schéma rendu partiellement : sa racine porte `wire:partial="schema.<clé>"`. */
|
|
93
|
+
partiallyRendered(condition?: boolean): this;
|
|
94
|
+
private _partialName;
|
|
95
|
+
/** Nom du fragment `wire:partial` de la racine, quand il ne suit pas la clé du schéma (formulaire de filtres : `table-filters-form`). */
|
|
96
|
+
partialName(name: string | null): this;
|
|
97
|
+
private _gap;
|
|
98
|
+
/** `false` : composants accolés, sans espacement (`fi-sc-has-gap` absent), comme dans un FusedGroup. */
|
|
99
|
+
gap(condition?: boolean): this;
|
|
100
|
+
private _fieldWrapperView;
|
|
101
|
+
/**
|
|
102
|
+
* Enveloppe des champs de ce schéma : `'filament-forms::plain-field-wrapper'` ne garde qu'un libellé réservé aux lecteurs d'écran
|
|
103
|
+
* (champs d'un FusedGroup). `null` : l'enveloppe habituelle.
|
|
104
|
+
*/
|
|
105
|
+
fieldWrapperView(view: string | null): this;
|
|
106
|
+
getFieldWrapperView(): string | null;
|
|
107
|
+
getKey(): string;
|
|
108
|
+
getStatePath(): string;
|
|
109
|
+
getComponents(): Component[];
|
|
110
|
+
getOperation(): string | null;
|
|
111
|
+
getRecord(): unknown;
|
|
112
|
+
isInline(): boolean;
|
|
113
|
+
isRoot(): boolean;
|
|
114
|
+
/** Tous les champs à état, en profondeur. */
|
|
115
|
+
getFlatComponents(): Component[];
|
|
116
|
+
/** Les mêmes, sans les composants masqués ni leur descendance : un champ placé dans une section masquée n'est ni validé ni enregistré, comme dans Filament. */
|
|
117
|
+
getVisibleFlatComponents(): Promise<Component[]>;
|
|
118
|
+
/** Port de Schema::renderEmbeddedHtml. */
|
|
119
|
+
toHtml(): Promise<string>;
|
|
120
|
+
}
|
|
121
|
+
/** Schéma enfant d'un composant de mise en page : partage la clé et le chemin d'état du parent, sans être racine. */
|
|
122
|
+
export declare function childSchema(parent: Component, components: Component[]): Schema;
|
|
123
|
+
/** Groupe à état : ses enfants vivent sous `<chemin du conteneur>.<nom>` (utilisé par les formulaires de filtres). */
|
|
124
|
+
export declare class StatefulGroup extends Component {
|
|
125
|
+
private children;
|
|
126
|
+
constructor(name: string, children: Component[]);
|
|
127
|
+
static make(name: string, children: Component[]): StatefulGroup;
|
|
128
|
+
hasStatePath(): boolean;
|
|
129
|
+
getChildSchemas(): Schema[];
|
|
130
|
+
toHtml(): Promise<string>;
|
|
131
|
+
}
|
|
132
|
+
/** Regroupe des composants dans une grille, sans habillage (port de Group). */
|
|
133
|
+
export declare class Group extends Component {
|
|
134
|
+
protected children: Component[];
|
|
135
|
+
protected _columns: Record<string, number> | number | null;
|
|
136
|
+
constructor(children?: Component[]);
|
|
137
|
+
static make(children?: Component[]): Group;
|
|
138
|
+
schema(components: Component[]): this;
|
|
139
|
+
columns(columns: Record<string, number> | number | null): this;
|
|
140
|
+
getChildSchemas(): Schema[];
|
|
141
|
+
toHtml(): Promise<string>;
|
|
142
|
+
}
|
|
143
|
+
/** Grille de colonnes (port de Grid) : deux colonnes par défaut à partir de `lg`. */
|
|
144
|
+
export declare class Grid extends Group {
|
|
145
|
+
constructor(columns?: Record<string, number> | number);
|
|
146
|
+
static make(columns?: Record<string, number> | number | Component[]): Grid;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Composants côte à côte à partir d'un point de rupture (port de Flex) : chacun occupe la place disponible,
|
|
150
|
+
* sauf ceux marqués `grow(false)`, qui gardent leur largeur naturelle.
|
|
151
|
+
*/
|
|
152
|
+
export declare class Flex extends Component {
|
|
153
|
+
private children;
|
|
154
|
+
private _from;
|
|
155
|
+
constructor(children?: Component[]);
|
|
156
|
+
static make(children?: Component[]): Flex;
|
|
157
|
+
schema(components: Component[]): this;
|
|
158
|
+
from(breakpoint: 'sm' | 'md' | 'lg' | 'xl' | '2xl'): this;
|
|
159
|
+
getChildSchemas(): Schema[];
|
|
160
|
+
toHtml(): Promise<string>;
|
|
161
|
+
}
|
|
162
|
+
export declare const slug: (text: string) => string;
|
|
163
|
+
/** Section : carte regroupant des composants, avec un en-tête facultatif (titre, actions). Sans repli ni icône pour l'instant. */
|
|
164
|
+
export declare class Section extends Component {
|
|
165
|
+
private children;
|
|
166
|
+
private _columns;
|
|
167
|
+
private _heading;
|
|
168
|
+
private _afterHeader;
|
|
169
|
+
constructor(heading?: string | null);
|
|
170
|
+
static make(heading?: string | null): Section;
|
|
171
|
+
schema(components: Component[]): this;
|
|
172
|
+
columns(columns: Record<string, number> | number | null): this;
|
|
173
|
+
private _collapsible;
|
|
174
|
+
private _collapsed;
|
|
175
|
+
/** Section repliable par son en-tête ; `collapsed()` la replie d'emblée. */
|
|
176
|
+
collapsible(condition?: boolean): this;
|
|
177
|
+
collapsed(condition?: boolean): this;
|
|
178
|
+
/** Actions affichées à droite du titre. */
|
|
179
|
+
afterHeader(actions: Renderable[]): this;
|
|
180
|
+
/** Actions que la section expose au montage. */
|
|
181
|
+
getActions(): Renderable[];
|
|
182
|
+
getChildSchemas(): Schema[];
|
|
183
|
+
toHtml(): Promise<string>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Balisage libre dans un schéma. Le contenu est inséré TEL QUEL : n'y placez jamais une valeur venue d'un utilisateur ou de la base
|
|
187
|
+
* sans l'échapper avec `e()` de `@navette-js/support`.
|
|
188
|
+
*/
|
|
189
|
+
export declare class Html extends Component {
|
|
190
|
+
private content;
|
|
191
|
+
constructor(content: string | ((ctx: ComponentContext) => string | Promise<string>));
|
|
192
|
+
static make(content: string | ((ctx: ComponentContext) => string | Promise<string>)): Html;
|
|
193
|
+
toHtml(): Promise<string>;
|
|
194
|
+
}
|
|
195
|
+
/** Un onglet d'un composant Tabs : un titre, une icône facultative et son propre schéma (port de Tabs\Tab). */
|
|
196
|
+
export declare class Tab extends Component {
|
|
197
|
+
private children;
|
|
198
|
+
private _columns;
|
|
199
|
+
private _icon;
|
|
200
|
+
private label;
|
|
201
|
+
constructor(label: string);
|
|
202
|
+
static make(label: string): Tab;
|
|
203
|
+
schema(components: Component[]): this;
|
|
204
|
+
columns(columns: Record<string, number> | number | null): this;
|
|
205
|
+
icon(name: string | null): this;
|
|
206
|
+
getLabel(): string;
|
|
207
|
+
getIcon(): string | null;
|
|
208
|
+
/** Clé de l'onglet côté navigateur (sans le préfixe du schéma). */
|
|
209
|
+
/** Clé de l'onglet dans son groupe : `::data::` suit le chemin d'état du schéma, absent d'un infolist (comme dans Filament). */
|
|
210
|
+
getTabKey(): string;
|
|
211
|
+
getChildSchemas(): Schema[];
|
|
212
|
+
toHtml(): Promise<string>;
|
|
213
|
+
}
|
|
214
|
+
/** Onglets de mise en page : tous les panneaux sont rendus, le navigateur n'affiche que l'onglet actif (port de Tabs). */
|
|
215
|
+
export declare class Tabs extends Component {
|
|
216
|
+
private tabs;
|
|
217
|
+
private label;
|
|
218
|
+
constructor(label: string);
|
|
219
|
+
static make(label: string): Tabs;
|
|
220
|
+
schema(tabs: Tab[]): this;
|
|
221
|
+
getExposedMethods(): string[];
|
|
222
|
+
getLazyLoadedTabBadges(): Record<string, unknown>;
|
|
223
|
+
getDeferredTabBadges(): Record<string, unknown>;
|
|
224
|
+
getChildSchemas(): Schema[];
|
|
225
|
+
toHtml(): Promise<string>;
|
|
226
|
+
}
|
|
227
|
+
/** Point d'injection d'un render hook, avec les portées du composant hôte. Libéré de la grille du conteneur. */
|
|
228
|
+
export declare class RenderHook extends Component {
|
|
229
|
+
private hook;
|
|
230
|
+
constructor(hook: string);
|
|
231
|
+
static make(hook: string): RenderHook;
|
|
232
|
+
isLiberatedFromContainerGrid(): boolean;
|
|
233
|
+
toHtml(): Promise<string>;
|
|
234
|
+
}
|
|
235
|
+
/** Intègre un autre schéma du composant hôte (`form`, `infolist`…) comme schéma racine. */
|
|
236
|
+
export declare class EmbeddedSchema extends Component {
|
|
237
|
+
private schemaName;
|
|
238
|
+
constructor(name: string);
|
|
239
|
+
static make(name: string): EmbeddedSchema;
|
|
240
|
+
toHtml(): Promise<string>;
|
|
241
|
+
}
|
|
242
|
+
/** Balise <form> : contenu, pied (actions), soumission vers une méthode du composant hôte. */
|
|
243
|
+
export declare class Form extends Component {
|
|
244
|
+
private children;
|
|
245
|
+
private _footer;
|
|
246
|
+
private _id;
|
|
247
|
+
private _submit;
|
|
248
|
+
constructor(children: Component[]);
|
|
249
|
+
static make(children?: Component[]): Form;
|
|
250
|
+
id(id: string): this;
|
|
251
|
+
livewireSubmitHandler(method: string): this;
|
|
252
|
+
footer(components: Component[]): this;
|
|
253
|
+
getChildSchemas(): Schema[];
|
|
254
|
+
toHtml(): Promise<string>;
|
|
255
|
+
}
|
|
256
|
+
/** Élément rendu dans un conteneur d'actions : en pratique une Action (paquet actions). */
|
|
257
|
+
export interface Renderable {
|
|
258
|
+
isVisible(ctx: ComponentContext): Promise<boolean>;
|
|
259
|
+
toHtml(ctx: ComponentContext): Promise<string>;
|
|
260
|
+
}
|
|
261
|
+
/** Rangée d'actions d'un schéma. */
|
|
262
|
+
export declare class Actions extends Component {
|
|
263
|
+
private actions;
|
|
264
|
+
private _fullWidth;
|
|
265
|
+
private _alignment;
|
|
266
|
+
constructor(actions: Renderable[]);
|
|
267
|
+
static make(actions: Renderable[]): Actions;
|
|
268
|
+
fullWidth(condition?: boolean): this;
|
|
269
|
+
alignment(alignment: string | null): this;
|
|
270
|
+
toHtml(): Promise<string>;
|
|
271
|
+
}
|
|
272
|
+
/** Gestionnaire de couleurs utilisé hors d'un panel ; dans un panel, celui du panel de l'hôte a la priorité. */
|
|
273
|
+
export declare const useColorManager: (manager: ColorManager) => void;
|
|
274
|
+
/** Élément d'une rangée en ligne : un composant de schéma ou une action. */
|
|
275
|
+
export type InlineItem = Component | Renderable;
|
|
276
|
+
/**
|
|
277
|
+
* Rangée « en ligne » (port d'un schéma enfant `inline()` de Filament : pied, contrôles, après le libellé) où composants et actions se mêlent.
|
|
278
|
+
* Les actions sont montées avec `schemaComponent: mountKey` (par défaut le schéma racine, qui les retrouve par `getActions()` du composant parent).
|
|
279
|
+
* `actionView` : `'button'` (bouton plein), `'link'` (lien, ou bouton-icône pour une action `iconButton()`), `'auto'` (bouton-icône si `iconButton()`, bouton sinon).
|
|
280
|
+
* `scope` remplace des clés de la configuration Alpine des composants (`path`, `containerPath`).
|
|
281
|
+
*/
|
|
282
|
+
export declare function renderInlineItems(parent: Component, items: InlineItem[], options?: {
|
|
283
|
+
alignment?: string | null;
|
|
284
|
+
scope?: Record<string, unknown>;
|
|
285
|
+
mountKey?: string | null;
|
|
286
|
+
actionView?: 'button' | 'link' | 'auto';
|
|
287
|
+
}): Promise<string>;
|
|
288
|
+
/**
|
|
289
|
+
* Cadre titré regroupant des champs (port de Fieldset) : une légende et une grille de deux colonnes par défaut.
|
|
290
|
+
* Avec `statePath()`, les champs vivent sous ce chemin et le fieldset reçoit une clé (et un `id`).
|
|
291
|
+
*/
|
|
292
|
+
export declare class Fieldset extends Component {
|
|
293
|
+
private children;
|
|
294
|
+
private _columns;
|
|
295
|
+
private _label;
|
|
296
|
+
private _hiddenLabel;
|
|
297
|
+
private _contained;
|
|
298
|
+
private _markedAsRequired;
|
|
299
|
+
constructor(label?: Lazy<string | null, ComponentContext>);
|
|
300
|
+
static make(label?: Lazy<string | null, ComponentContext>): Fieldset;
|
|
301
|
+
schema(components: Component[]): this;
|
|
302
|
+
columns(columns: Record<string, number> | number | null): this;
|
|
303
|
+
label(label: Lazy<string | null, ComponentContext>): this;
|
|
304
|
+
/** Légende gardée pour les lecteurs d'écran seulement. */
|
|
305
|
+
hiddenLabel(condition?: boolean): this;
|
|
306
|
+
/** `false` : sans bordure ni marge intérieure. */
|
|
307
|
+
contained(condition?: boolean): this;
|
|
308
|
+
/** Astérisque après la légende (le fieldset lui-même n'est jamais validé). */
|
|
309
|
+
markAsRequired(condition?: boolean): this;
|
|
310
|
+
/** Chemin d'état des champs, relatif au conteneur (port de `statePath()`). */
|
|
311
|
+
statePath(path: string | null): this;
|
|
312
|
+
hasStatePath(): boolean;
|
|
313
|
+
getChildSchemas(): Schema[];
|
|
314
|
+
toHtml(): Promise<string>;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Texte dans un schéma (port de Text) : simple `<span>`, ou pastille avec `badge()`. Le contenu est échappé ;
|
|
318
|
+
* une `HtmlString` (de `@navette-js/support`) est insérée telle quelle, à ne construire qu'avec des valeurs échappées.
|
|
319
|
+
*/
|
|
320
|
+
export declare class Text extends Component {
|
|
321
|
+
private _content;
|
|
322
|
+
private _badge;
|
|
323
|
+
private _color;
|
|
324
|
+
private _size;
|
|
325
|
+
private _weight;
|
|
326
|
+
private _fontFamily;
|
|
327
|
+
private _icon;
|
|
328
|
+
private _iconPosition;
|
|
329
|
+
private _iconSize;
|
|
330
|
+
private _tooltip;
|
|
331
|
+
private _copyable;
|
|
332
|
+
private _copyableState;
|
|
333
|
+
private _copyMessage;
|
|
334
|
+
private _copyMessageDuration;
|
|
335
|
+
constructor(content: Lazy<string | HtmlString | null, ComponentContext>);
|
|
336
|
+
static make(content: Lazy<string | HtmlString | null, ComponentContext>): Text;
|
|
337
|
+
content(content: Lazy<string | HtmlString | null, ComponentContext>): this;
|
|
338
|
+
/** Affiché en pastille. */
|
|
339
|
+
badge(condition?: Lazy<boolean, ComponentContext>): this;
|
|
340
|
+
/** Couleur (`gray` par défaut ; `primary`, `danger`…). */
|
|
341
|
+
color(color: Lazy<string | null, ComponentContext>): this;
|
|
342
|
+
/** Taille du texte (`xs`, `sm`, `md`, `lg`) ou de la pastille. */
|
|
343
|
+
size(size: string | null): this;
|
|
344
|
+
/** Graisse (`bold`, `semibold`, `medium`…). */
|
|
345
|
+
weight(weight: string | null): this;
|
|
346
|
+
/** Famille de police (`sans`, `serif`, `mono`). */
|
|
347
|
+
fontFamily(family: string | null): this;
|
|
348
|
+
/** Icône d'une pastille. */
|
|
349
|
+
icon(name: string | null): this;
|
|
350
|
+
iconPosition(position: 'before' | 'after'): this;
|
|
351
|
+
iconSize(size: string | null): this;
|
|
352
|
+
tooltip(text: Lazy<string | null, ComponentContext>): this;
|
|
353
|
+
/** Un clic copie le texte (ou `copyableState()`) dans le presse-papiers. */
|
|
354
|
+
copyable(condition?: Lazy<boolean, ComponentContext>): this;
|
|
355
|
+
copyableState(state: Lazy<string | null, ComponentContext>): this;
|
|
356
|
+
copyMessage(message: string | null): this;
|
|
357
|
+
copyMessageDuration(milliseconds: number): this;
|
|
358
|
+
getContent(): Promise<string | HtmlString | null>;
|
|
359
|
+
toHtml(): Promise<string>;
|
|
360
|
+
}
|
|
361
|
+
/** Icône Heroicons dans un schéma (port de Icon) : décorative, sauf si une infobulle ou un `aria-label` (attributs supplémentaires) la décrit. */
|
|
362
|
+
export declare class Icon extends Component {
|
|
363
|
+
private _icon;
|
|
364
|
+
private _color;
|
|
365
|
+
private _size;
|
|
366
|
+
private _tooltip;
|
|
367
|
+
constructor(name: Lazy<string | null, ComponentContext>);
|
|
368
|
+
static make(name: Lazy<string | null, ComponentContext>): Icon;
|
|
369
|
+
icon(name: Lazy<string | null, ComponentContext>): this;
|
|
370
|
+
/** Couleur (`primary` par défaut). */
|
|
371
|
+
color(color: Lazy<string | null, ComponentContext>): this;
|
|
372
|
+
/** Taille (`xs` … `2xl`) ; `base` revient à la taille par défaut. */
|
|
373
|
+
size(size: string | null): this;
|
|
374
|
+
tooltip(text: Lazy<string | null, ComponentContext>): this;
|
|
375
|
+
toHtml(): Promise<string>;
|
|
376
|
+
}
|
|
377
|
+
/** Image dans un schéma (port de Image). Seules une adresse du site (`/…`) ou une adresse http(s) sont affichées. */
|
|
378
|
+
export declare class Image extends Component {
|
|
379
|
+
private _url;
|
|
380
|
+
private _alt;
|
|
381
|
+
private _height;
|
|
382
|
+
private _width;
|
|
383
|
+
private _alignment;
|
|
384
|
+
private _tooltip;
|
|
385
|
+
constructor(url: Lazy<string, ComponentContext>, alt: Lazy<string, ComponentContext>);
|
|
386
|
+
static make(url: Lazy<string, ComponentContext>, alt: Lazy<string, ComponentContext>): Image;
|
|
387
|
+
url(url: Lazy<string, ComponentContext>): this;
|
|
388
|
+
alt(alt: Lazy<string, ComponentContext>): this;
|
|
389
|
+
private static dimension;
|
|
390
|
+
/** Hauteur (`8rem` par défaut) ; un nombre est en pixels. */
|
|
391
|
+
imageHeight(height: number | string | null): this;
|
|
392
|
+
imageWidth(width: number | string | null): this;
|
|
393
|
+
imageSize(size: number | string): this;
|
|
394
|
+
/** Alignement (`start`, `center`, `end`). */
|
|
395
|
+
alignment(alignment: string | null): this;
|
|
396
|
+
alignStart(): this;
|
|
397
|
+
alignCenter(): this;
|
|
398
|
+
alignEnd(): this;
|
|
399
|
+
tooltip(text: Lazy<string | null, ComponentContext>): this;
|
|
400
|
+
toHtml(): Promise<string>;
|
|
401
|
+
}
|
|
402
|
+
/** Liste à puces (port de UnorderedList) : chaque élément est un composant ; une chaîne devient un `Text`. Deux colonnes à partir de `sm`. */
|
|
403
|
+
export declare class UnorderedList extends Component {
|
|
404
|
+
private children;
|
|
405
|
+
private _columns;
|
|
406
|
+
private _size;
|
|
407
|
+
constructor(items?: (Component | string | HtmlString)[]);
|
|
408
|
+
static make(items?: (Component | string | HtmlString)[]): UnorderedList;
|
|
409
|
+
private static normalize;
|
|
410
|
+
schema(items: (Component | string | HtmlString)[]): this;
|
|
411
|
+
columns(columns: Record<string, number> | number | null): this;
|
|
412
|
+
/** Taille du texte (`xs`, `sm`, `md`, `lg`). */
|
|
413
|
+
size(size: string | null): this;
|
|
414
|
+
getChildSchemas(): Schema[];
|
|
415
|
+
toHtml(): Promise<string>;
|
|
416
|
+
}
|
|
417
|
+
/** État vide (port de EmptyState) : icône, titre, description et un pied (actions, composants). */
|
|
418
|
+
export declare class EmptyState extends Component {
|
|
419
|
+
private _heading;
|
|
420
|
+
private _description;
|
|
421
|
+
private _icon;
|
|
422
|
+
private _iconColor;
|
|
423
|
+
private _iconSize;
|
|
424
|
+
private _compact;
|
|
425
|
+
private _contained;
|
|
426
|
+
private _headingTag;
|
|
427
|
+
private _footer;
|
|
428
|
+
constructor(heading: Lazy<string, ComponentContext>);
|
|
429
|
+
static make(heading: Lazy<string, ComponentContext>): EmptyState;
|
|
430
|
+
heading(heading: Lazy<string, ComponentContext>): this;
|
|
431
|
+
description(description: Lazy<string | null, ComponentContext>): this;
|
|
432
|
+
icon(name: string | null): this;
|
|
433
|
+
/** Couleur de l'icône (`primary` par défaut). */
|
|
434
|
+
iconColor(color: string | null): this;
|
|
435
|
+
iconSize(size: string | null): this;
|
|
436
|
+
/** Version resserrée. */
|
|
437
|
+
compact(condition?: boolean): this;
|
|
438
|
+
/** `false` : sans carte autour. */
|
|
439
|
+
contained(condition?: boolean): this;
|
|
440
|
+
/** Balise du titre (`h2` par défaut). */
|
|
441
|
+
headingTag(tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'): this;
|
|
442
|
+
/** Pied : actions et composants, en ligne. */
|
|
443
|
+
footer(items: InlineItem[]): this;
|
|
444
|
+
/** Actions du pied, montées sur le schéma racine. */
|
|
445
|
+
getActions(): Renderable[];
|
|
446
|
+
toHtml(): Promise<string>;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Encadré d'information (port de Callout) : statut (`info()`, `success()`, `warning()`, `danger()`) qui fixe couleur et icône,
|
|
450
|
+
* titre, description, actions de pied (en liens) et actions de contrôle (à droite).
|
|
451
|
+
*/
|
|
452
|
+
export declare class Callout extends Component {
|
|
453
|
+
private _heading;
|
|
454
|
+
private _description;
|
|
455
|
+
private _status;
|
|
456
|
+
private _color;
|
|
457
|
+
private _hasColor;
|
|
458
|
+
private _icon;
|
|
459
|
+
private _iconColor;
|
|
460
|
+
private _iconSize;
|
|
461
|
+
private _footerActions;
|
|
462
|
+
private _footerActionsAlignment;
|
|
463
|
+
private _footer;
|
|
464
|
+
private _controlActions;
|
|
465
|
+
constructor(heading?: Lazy<string | null, ComponentContext>);
|
|
466
|
+
static make(heading?: Lazy<string | null, ComponentContext>): Callout;
|
|
467
|
+
heading(heading: Lazy<string | null, ComponentContext>): this;
|
|
468
|
+
description(description: Lazy<string | null, ComponentContext>): this;
|
|
469
|
+
/** Statut : couleur, icône et préfixe lu par les lecteurs d'écran (« Note: »…). */
|
|
470
|
+
status(status: string | null): this;
|
|
471
|
+
danger(): this;
|
|
472
|
+
info(): this;
|
|
473
|
+
success(): this;
|
|
474
|
+
warning(): this;
|
|
475
|
+
/** Couleur du fond ; `null` retire celle du statut (l'icône la garde). */
|
|
476
|
+
color(color: string | null): this;
|
|
477
|
+
icon(name: string | null): this;
|
|
478
|
+
iconColor(color: string | null): this;
|
|
479
|
+
/** Taille de l'icône (`lg` par défaut). */
|
|
480
|
+
iconSize(size: string | null): this;
|
|
481
|
+
/** Actions du pied, rendues en liens (port de `actions()` / `footerActions()`). */
|
|
482
|
+
actions(actions: Renderable[]): this;
|
|
483
|
+
footerActions(actions: Renderable[]): this;
|
|
484
|
+
/** Alignement des actions du pied (`start`, `center`, `end`, `between`). */
|
|
485
|
+
footerActionsAlignment(alignment: string): this;
|
|
486
|
+
/** Pied libre (composants et actions), à la place des actions de pied. */
|
|
487
|
+
footer(items: InlineItem[] | null): this;
|
|
488
|
+
/** Actions à droite de l'encadré (fermeture…), en petite taille. */
|
|
489
|
+
controlActions(actions: Renderable[]): this;
|
|
490
|
+
getColor(): string | null;
|
|
491
|
+
getIcon(): string | null;
|
|
492
|
+
/** Actions de l'encadré, montées sur le schéma racine. */
|
|
493
|
+
getActions(): Renderable[];
|
|
494
|
+
toHtml(): Promise<string>;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Champs accolés sous un seul libellé (port de FusedGroup) : chaque champ n'a plus qu'un libellé pour lecteurs d'écran,
|
|
498
|
+
* et la première erreur de validation des champs s'affiche sous le groupe.
|
|
499
|
+
*/
|
|
500
|
+
export declare class FusedGroup extends Component {
|
|
501
|
+
private children;
|
|
502
|
+
private _columns;
|
|
503
|
+
private _label;
|
|
504
|
+
private _hiddenLabel;
|
|
505
|
+
private _markedAsRequired;
|
|
506
|
+
constructor(children?: Component[]);
|
|
507
|
+
static make(children?: Component[]): FusedGroup;
|
|
508
|
+
schema(components: Component[]): this;
|
|
509
|
+
columns(columns: Record<string, number> | number | null): this;
|
|
510
|
+
label(label: Lazy<string | null, ComponentContext>): this;
|
|
511
|
+
hiddenLabel(condition?: boolean): this;
|
|
512
|
+
/** Astérisque après le libellé (la validation reste celle de chaque champ). */
|
|
513
|
+
markAsRequired(condition?: boolean): this;
|
|
514
|
+
getChildSchemas(): Schema[];
|
|
515
|
+
/** Première erreur des champs du groupe (y compris d'un élément d'un champ à valeurs multiples). */
|
|
516
|
+
private firstError;
|
|
517
|
+
toHtml(): Promise<string>;
|
|
518
|
+
}
|
|
519
|
+
export {};
|