Migrate site controls to Nebula design system
All checks were successful
Deploy Sokko G / deploy (push) Successful in 17s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 17s
This commit is contained in:
parent
e3d0925eb1
commit
817e21567b
127 changed files with 5380 additions and 2363 deletions
|
|
@ -89,7 +89,7 @@ export function GuidedTooltipTour({ steps, labels = {}, targetAttribute = "data-
|
|||
|
||||
return createPortal(
|
||||
<section ref={tooltipRef} className="toolbox-tutorial-tooltip" aria-live="polite" aria-labelledby="toolbox-tutorial-title" data-placement={placement} role="dialog" style={tooltipStyle}>
|
||||
<button className="toolbox-tutorial-close" type="button" onClick={onDismiss} aria-label={labels.dismiss || "Fermer le tutoriel"} title={labels.dismiss || "Fermer"}>
|
||||
<button className="toolbox-tutorial-close nds-icon-button" data-size="xs" type="button" onClick={onDismiss} aria-label={labels.dismiss || "Fermer le tutoriel"} title={labels.dismiss || "Fermer"}>
|
||||
<Icon name="close" />
|
||||
</button>
|
||||
<span className="toolbox-tutorial-count">{stepIndex + 1}/{steps.length}</span>
|
||||
|
|
@ -99,7 +99,7 @@ export function GuidedTooltipTour({ steps, labels = {}, targetAttribute = "data-
|
|||
</div>
|
||||
<p>{currentStep.text}</p>
|
||||
<footer>
|
||||
<button className="primary" type="button" onClick={isLastStep ? onDismiss : () => setStepIndex((index) => Math.min(index + 1, steps.length - 1))}>
|
||||
<button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={isLastStep ? onDismiss : () => setStepIndex((index) => Math.min(index + 1, steps.length - 1))}>
|
||||
{isLastStep ? labels.done || "Terminer" : labels.next || "Suivant"}
|
||||
</button>
|
||||
</footer>
|
||||
|
|
|
|||
|
|
@ -142,9 +142,9 @@ export function ImageViewer({ image, onClose, createMarkerId = () => globalThis.
|
|||
{image.label && <strong className="image-viewer-title">{image.label}</strong>}
|
||||
<div className="image-viewer-actions">
|
||||
{!canAnnotate && !hasMarkers && (
|
||||
<button className="image-viewer-button" onClick={() => openImageInNewTab(image.dataUrl)} aria-label="Ouvrir l'image en taille réelle" title="Taille réelle"><Icon name="zoom" /></button>
|
||||
<button className="image-viewer-button nds-icon-button" data-size="sm" onClick={() => openImageInNewTab(image.dataUrl)} aria-label="Ouvrir l'image en taille réelle" title="Taille réelle"><Icon name="zoom" /></button>
|
||||
)}
|
||||
<button className="image-viewer-button" onClick={onClose} aria-label="Fermer" title="Fermer"><Icon name="close" /></button>
|
||||
<button className="image-viewer-button nds-icon-button" data-size="sm" onClick={onClose} aria-label="Fermer" title="Fermer"><Icon name="close" /></button>
|
||||
</div>
|
||||
</header>
|
||||
<div className={`image-viewer-body ${canAnnotate ? "has-annotation-side" : ""}`}>
|
||||
|
|
@ -211,12 +211,15 @@ export function ImageViewer({ image, onClose, createMarkerId = () => globalThis.
|
|||
<li key={marker.id}>
|
||||
<span>{index + 1}</span>
|
||||
<input
|
||||
className="nds-input"
|
||||
data-size="sm"
|
||||
type="text"
|
||||
value={marker.label}
|
||||
placeholder={image.markerPlaceholder || "Libellé du marqueur"}
|
||||
onChange={(event) => updateViewerMarker(marker.id, (item) => ({ ...item, label: event.target.value }))}
|
||||
aria-label={`Libellé du marqueur ${index + 1}`}
|
||||
/>
|
||||
<button className="tool-split-action-button danger" type="button" onClick={() => removeViewerMarker(marker.id)} aria-label={`${image.deleteMarkerTitle || "Supprimer"} ${marker.label || `${image.markerPrefix || "Marqueur"} ${index + 1}`}`} title={image.deleteMarkerTitle || "Supprimer"}>
|
||||
<button className="tool-split-action-button nds-icon-button" data-size="sm" data-variant="danger" type="button" onClick={() => removeViewerMarker(marker.id)} aria-label={`${image.deleteMarkerTitle || "Supprimer"} ${marker.label || `${image.markerPrefix || "Marqueur"} ${index + 1}`}`} title={image.deleteMarkerTitle || "Supprimer"}>
|
||||
<Icon name="trash" />
|
||||
</button>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// Rôle : encapsule l'input fichier JSON derrière un bouton d'import réutilisable.
|
||||
import { Icon } from "./Icon.jsx";
|
||||
|
||||
export function ImportButton({ className, label, title, ariaLabel, icon, onFile }) {
|
||||
export function ImportButton({ className, label, title, ariaLabel, icon, onFile, ...props }) {
|
||||
return (
|
||||
<label className={className} aria-label={ariaLabel} title={title}>
|
||||
<label className={className} aria-label={ariaLabel} title={title} {...props}>
|
||||
{icon && <Icon name={icon} />}
|
||||
{label}
|
||||
<input type="file" accept="application/json" hidden onChange={async (event) => {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export function Shell({ route, content, games, toolboxes, links, actions, childr
|
|||
const gameId = route.split("/")[1] === "games" ? route.split("/")[2] || "" : "";
|
||||
const game = games.find((item) => item.id === gameId);
|
||||
const linkedToolbox = game ? toolboxes.find((item) => item.id === links[game.id]) : null;
|
||||
const topbarLabel = route.startsWith("/toolbox") ? content.topbar.toolbox : route.startsWith("/games") ? content.topbar.games : route === "/library" ? content.topbar.library : content.topbar.dashboard;
|
||||
const topbarLabel = route === "/design-system" && import.meta.env.DEV ? "Design system" : route.startsWith("/toolbox") ? content.topbar.toolbox : route.startsWith("/games") ? content.topbar.games : route === "/library" ? content.topbar.library : content.topbar.dashboard;
|
||||
const toolboxLabel = linkedToolbox ? `Ouvrir la toolbox ${linkedToolbox.name}` : "Associer une toolbox";
|
||||
|
||||
return (
|
||||
|
|
@ -27,13 +27,16 @@ export function Shell({ route, content, games, toolboxes, links, actions, childr
|
|||
<div className="sidebar-secondary-links">
|
||||
<a className={`sidebar-about-link ${route === "/about" ? "active" : ""}`} href="#/about"><span className="sidebar-about-icon" aria-hidden="true">?</span><strong>{content.navigation.about}</strong></a>
|
||||
<a className={`sidebar-about-link ${route === "/library" ? "active" : ""}`} href="#/library"><span className="sidebar-about-icon" aria-hidden="true"><Icon name="book" /></span><strong>{content.library.eyebrow}</strong></a>
|
||||
{import.meta.env.DEV && (
|
||||
<a className={`sidebar-about-link ${route === "/design-system" ? "active" : ""}`} href="#/design-system"><span className="sidebar-about-icon" aria-hidden="true"><Icon name="settings" /></span><strong>Design system</strong></a>
|
||||
)}
|
||||
</div>
|
||||
<div className="sidebar-note">
|
||||
<span className="badge">{content.sidebar.badge}</span>
|
||||
<p>{content.sidebar.note}</p>
|
||||
<div className="sidebar-storage-actions" aria-label="Actions globales de stockage">
|
||||
<button className="sidebar-action-button primary" onClick={actions.exportAllToolboxes} aria-label="Exporter toutes les toolboxes" data-toolbox-tutorial-target="exportAll" title="Exporter tout"><Icon name="export" /></button>
|
||||
<ImportButton className="sidebar-action-button import-icon-button" title="Importer tout" ariaLabel="Importer toutes les toolboxes" onFile={actions.importAllToolboxes} icon="import" />
|
||||
<button className="sidebar-action-button nds-icon-button" data-size="sm" data-variant="primary" onClick={actions.exportAllToolboxes} aria-label="Exporter toutes les toolboxes" data-toolbox-tutorial-target="exportAll" title="Exporter tout"><Icon name="export" /></button>
|
||||
<ImportButton className="sidebar-action-button nds-icon-button import-icon-button" data-size="sm" title="Importer tout" ariaLabel="Importer toutes les toolboxes" onFile={actions.importAllToolboxes} icon="import" />
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
|
@ -42,7 +45,7 @@ export function Shell({ route, content, games, toolboxes, links, actions, childr
|
|||
<div><strong>{topbarLabel}</strong></div>
|
||||
{game && (
|
||||
<div className="topbar-actions">
|
||||
<button className="drawer-button toolbox-icon-button primary" onClick={() => actions.setDrawerGameId(game.id)} aria-label={toolboxLabel} title={toolboxLabel}>
|
||||
<button className="drawer-button toolbox-icon-button nds-icon-button" data-size="sm" data-variant="primary" onClick={() => actions.setDrawerGameId(game.id)} aria-label={toolboxLabel} title={toolboxLabel}>
|
||||
<img src="/static/icons/toolbox.svg" alt="" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -53,7 +56,7 @@ export function Shell({ route, content, games, toolboxes, links, actions, childr
|
|||
<nav className="mobile-nav" aria-label="Navigation mobile">
|
||||
<a className={route === "/" ? "active" : ""} href="#/">{content.navigation.home}</a>
|
||||
<a className={route.startsWith("/toolboxes") || route.startsWith("/toolbox") ? "active" : ""} href="#/toolboxes">{content.navigation.toolboxes}</a>
|
||||
<button className="primary" onClick={() => actions.setCreateModal({})}>+</button>
|
||||
<button className="nds-button" data-size="sm" data-variant="primary" onClick={() => actions.setCreateModal({})}>+</button>
|
||||
<a className={route === "/library" ? "active" : ""} href="#/library">{content.navigation.mobileLibrary}</a>
|
||||
<a className={route.startsWith("/games") ? "active" : ""} href="#/games">{content.navigation.mobileGames}</a>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Rôle : fournit un contrôle d'onglets réutilisable avec rôles ARIA.
|
||||
export function Tabs({ tabs, activeTab, onChange, className = "", iconOnly = false }) {
|
||||
export function Tabs({ tabs, activeTab, onChange, className = "", iconOnly = false, size = "sm" }) {
|
||||
return (
|
||||
<div className={`tabs ${className}`.trim()} role="tablist">
|
||||
<div className={`tabs nds-radio-button-group ${className}`.trim()} data-size={size} role="tablist">
|
||||
{tabs.map((tab) => {
|
||||
const active = tab.id === activeTab;
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -4,16 +4,34 @@ import { Icon } from "./Icon.jsx";
|
|||
export function ToastPositionSwitch({ position, labels, onChange }) {
|
||||
const normalizedPosition = position === "left" ? "left" : "right";
|
||||
return (
|
||||
<button
|
||||
className="toast-position-switch"
|
||||
type="button"
|
||||
<div
|
||||
className="toast-position-switch nds-radio-button-group"
|
||||
data-size="xs"
|
||||
role="radiogroup"
|
||||
data-position={normalizedPosition}
|
||||
onClick={() => onChange(normalizedPosition === "left" ? "right" : "left")}
|
||||
aria-label={normalizedPosition === "left" ? labels.left : labels.right}
|
||||
title={labels.title}
|
||||
>
|
||||
<span><Icon name="toast-left" /></span>
|
||||
<span><Icon name="toast-right" /></span>
|
||||
</button>
|
||||
<button
|
||||
className={normalizedPosition === "left" ? "active" : ""}
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={normalizedPosition === "left"}
|
||||
aria-label={labels.left}
|
||||
onClick={() => onChange("left")}
|
||||
>
|
||||
<Icon name="toast-left" />
|
||||
</button>
|
||||
<button
|
||||
className={normalizedPosition === "right" ? "active" : ""}
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={normalizedPosition === "right"}
|
||||
aria-label={labels.right}
|
||||
onClick={() => onChange("right")}
|
||||
>
|
||||
<Icon name="toast-right" />
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ export function ConfirmModal({ title, message, confirmLabel = "Confirmer", cance
|
|||
<header><h2 id="confirm-title">{title}</h2></header>
|
||||
<p id="confirm-message">{message}</p>
|
||||
<footer>
|
||||
<button onClick={() => onClose(false)}>{cancelLabel}</button>
|
||||
<button className={danger ? "danger confirm-danger" : "primary"} onClick={() => onClose(true)}>{confirmLabel}</button>
|
||||
<button className="nds-button" data-size="sm" onClick={() => onClose(false)}>{cancelLabel}</button>
|
||||
<button className="confirm-danger nds-button" data-size="sm" data-variant={danger ? "danger" : "primary"} onClick={() => onClose(true)}>{confirmLabel}</button>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
|
|
@ -33,7 +33,7 @@ export function NotificationToast({ id, message, durationMs = 120000, onClose })
|
|||
return (
|
||||
<div className="notification-toast" role="status">
|
||||
<span>{message}</span>
|
||||
<button type="button" onClick={() => onClose(id)} aria-label="Fermer l'alerte" title="Fermer">
|
||||
<button className="nds-icon-button" data-size="xs" type="button" onClick={() => onClose(id)} aria-label="Fermer l'alerte" title="Fermer">
|
||||
<Icon name="close" />
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -52,8 +52,8 @@ export function CreateToolboxModal({ gameId, initialName = "", onClose }) {
|
|||
event.preventDefault();
|
||||
if (name.trim()) onClose(name.trim());
|
||||
}}>
|
||||
<label className="field"><span>Nom</span><input name="name" autoComplete="off" placeholder="Nom de la toolbox" required value={name} onChange={(event) => setName(event.target.value)} autoFocus /></label>
|
||||
<footer><button type="button" onClick={() => onClose("")}>Annuler</button><button className="primary" type="submit">Créer</button></footer>
|
||||
<label className="field"><span>Nom</span><input className="nds-input" data-size="sm" name="name" type="text" autoComplete="off" placeholder="Nom de la toolbox" required value={name} onChange={(event) => setName(event.target.value)} autoFocus /></label>
|
||||
<footer><button className="nds-button" data-size="sm" type="button" onClick={() => onClose("")}>Annuler</button><button className="nds-button" data-size="sm" data-variant="primary" type="submit">Créer</button></footer>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
|
|
@ -72,8 +72,8 @@ export function LinkToolboxModal({ toolboxes, selectedId, onClose }) {
|
|||
event.preventDefault();
|
||||
onClose(toolboxId);
|
||||
}}>
|
||||
<label className="field"><span>Toolbox associée</span><select value={toolboxId} onChange={(event) => setToolboxId(event.target.value)} autoFocus><option value="">Aucune</option>{toolboxes.map((toolbox) => <option key={toolbox.id} value={toolbox.id}>{toolbox.name}</option>)}</select></label>
|
||||
<footer><button type="button" onClick={() => onClose(null)}>Annuler</button><button className="primary" type="submit">Valider</button></footer>
|
||||
<label className="field"><span>Toolbox associée</span><select className="nds-select" data-size="sm" value={toolboxId} onChange={(event) => setToolboxId(event.target.value)} autoFocus><option value="">Aucune</option>{toolboxes.map((toolbox) => <option key={toolbox.id} value={toolbox.id}>{toolbox.name}</option>)}</select></label>
|
||||
<footer><button className="nds-button" data-size="sm" type="button" onClick={() => onClose(null)}>Annuler</button><button className="nds-button" data-size="sm" data-variant="primary" type="submit">Valider</button></footer>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue