{# # ============================================================================ # MOLECULE: STEP-INDICATOR # ============================================================================ # # Indicateur de progression par etapes pour wizards et processus multi-etapes. # Affiche les etapes avec leur etat (completed, active, pending). # # ============================================================================ # COMPOSITION (Atomes utilises) # ============================================================================ # # - _atoms/icon/icon.html.twig # # ============================================================================ # PARAMETRES # ============================================================================ # # | Parametre | Type | Defaut | Description | # |---------------|---------|--------------|-------------------------------------| # | steps | array | (requis) | Liste des etapes | # | - id | string | (requis) | ID unique de l'etape | # | - label | string | (requis) | Label de l'etape | # | - icon | string | null | Icone de l'etape | # | currentStep | number | 1 | Numero de l'etape active (1-based) | # | variant | string | 'horizontal' | Layout: horizontal, vertical | # | size | string | 'md' | Taille: sm, md, lg | # | showLabels | bool | true | Afficher les labels | # | clickable | bool | false | Etapes cliquables (navigation) | # | class | string | '' | Classes additionnelles | # # ============================================================================ # EXEMPLES D'UTILISATION # ============================================================================ # # Wizard horizontal: # {% include '_molecules/step-indicator/step-indicator.html.twig' with { # steps: [ # { id: 'upload', label: 'Document', icon: 'document' }, # { id: 'config', label: 'Configuration', icon: 'settings' }, # { id: 'generate', label: 'Generation', icon: 'rocket' }, # { id: 'preview', label: 'Apercu', icon: 'eye' }, # { id: 'deploy', label: 'Deploiement', icon: 'cloud' } # ], # currentStep: 2 # } %} # # Vertical avec navigation: # {% include '_molecules/step-indicator/step-indicator.html.twig' with { # steps: [ # { id: 'info', label: 'Informations' }, # { id: 'payment', label: 'Paiement' }, # { id: 'confirm', label: 'Confirmation' } # ], # currentStep: 1, # variant: 'vertical', # clickable: true # } %} # # ============================================================================ #} {# ============================================================================ CONFIGURATION DES VALEURS PAR DEFAUT ============================================================================ #} {% set steps = steps ?? [] %} {% set currentStep = currentStep ?? 1 %} {% set variant = variant ?? 'horizontal' %} {% set size = size ?? 'md' %} {% set showLabels = showLabels ?? true %} {% set clickable = clickable ?? false %} {% set class = class ?? '' %} {% set isHorizontal = variant == 'horizontal' %} {% set totalSteps = steps|length %} {# ============================================================================ CLASSES TAILWIND ============================================================================ #} {% set sizeConfig = { 'sm': { 'circle': 'w-8 h-8', 'icon': 'sm', 'text': 'text-xs', 'connector': isHorizontal ? 'h-0.5' : 'w-0.5', 'gap': 'gap-1' }, 'md': { 'circle': 'w-10 h-10', 'icon': 'md', 'text': 'text-sm', 'connector': isHorizontal ? 'h-0.5' : 'w-0.5', 'gap': 'gap-2' }, 'lg': { 'circle': 'w-12 h-12', 'icon': 'lg', 'text': 'text-base', 'connector': isHorizontal ? 'h-1' : 'w-1', 'gap': 'gap-3' } } %} {% set sConfig = sizeConfig[size] ?? sizeConfig['md'] %} {# Container classes #} {% set containerClasses = [ isHorizontal ? 'flex items-center justify-between' : 'flex flex-col', class ]|join(' ')|trim %} {# ============================================================================ RENDU HTML ============================================================================ #}