@rsuci/shared-form-components 1.0.74 → 1.0.75
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.
|
@@ -373,11 +373,11 @@ const FormRendererInner = () => {
|
|
|
373
373
|
? 'bg-orange-500 text-white hover:bg-orange-600'
|
|
374
374
|
: 'bg-gray-100 text-gray-400 cursor-not-allowed'}`, children: [_jsx("svg", { className: "h-4 w-4 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), _jsx("span", { className: "hidden sm:inline", children: labels.previousButton || 'Précédent' }), _jsx("span", { className: "sm:hidden", children: "Pr\u00E9c." })] }), mode === 'admin' && features?.saveDraft && callbacks.onSaveDraft && (_jsx("button", { type: "button", onClick: handleSaveDraft, disabled: effectiveDisabled || isSavingDraft || isSubmitting || isSubmittingForm, className: `flex items-center px-4 py-2 rounded-lg font-medium transition-colors ${!effectiveDisabled && !isSavingDraft && !isSubmitting && !isSubmittingForm
|
|
375
375
|
? 'bg-yellow-500 text-white hover:bg-yellow-600'
|
|
376
|
-
: 'bg-gray-300 text-gray-500 cursor-not-allowed'}`, children: isSavingDraft ? (_jsxs("span", { className: "flex items-center", children: [_jsxs("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "Enregistrement..."] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "hidden sm:inline", children: labels.draftButton || 'Enregistrer brouillon' }), _jsx("span", { className: "sm:hidden", children: "Brouillon" })] })) }))] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs("button", { type: "button", onClick: handleCancelClick, disabled: isSubmitting || isSubmittingForm || isSavingDraft, className: "px-4 py-2 rounded-lg font-medium transition-colors bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:cursor-not-allowed", children: [_jsx("span", { className: "hidden sm:inline", children: labels.cancelButton || 'Annuler' }), _jsx("span", { className: "sm:hidden", children: "Annuler" })] }), !navigation.isLastGroup && (_jsxs("button", { type: "button", onClick: handleNext, disabled: !canGoNext || (!isConsultationMode && effectiveDisabled), className: `flex items-center px-4 py-2 rounded-lg font-medium transition-colors ${canGoNext && (isConsultationMode || !effectiveDisabled)
|
|
376
|
+
: 'bg-gray-300 text-gray-500 cursor-not-allowed'}`, children: isSavingDraft ? (_jsxs("span", { className: "flex items-center", children: [_jsxs("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "Enregistrement..."] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "hidden sm:inline", children: labels.draftButton || 'Enregistrer brouillon' }), _jsx("span", { className: "sm:hidden", children: "Brouillon" })] })) }))] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs("button", { type: "button", onClick: handleCancelClick, disabled: isSubmitting || isSubmittingForm || isSavingDraft, className: "px-4 py-2 rounded-lg font-medium transition-colors bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:cursor-not-allowed", children: [_jsx("span", { className: "hidden sm:inline", children: labels.cancelButton || 'Annuler' }), _jsx("span", { className: "sm:hidden", children: "Annuler" })] }), !navigation.isLastGroup && (_jsxs("button", { type: "button", onClick: handleNext, disabled: !canGoNext || hasConditionErrors || (!isConsultationMode && effectiveDisabled), className: `flex items-center px-4 py-2 rounded-lg font-medium transition-colors ${canGoNext && !hasConditionErrors && (isConsultationMode || !effectiveDisabled)
|
|
377
377
|
? 'bg-green-600 text-white hover:bg-green-700'
|
|
378
|
-
: 'bg-gray-400 text-gray-200 cursor-not-allowed'}`, title: !canGoNext ? 'Veuillez remplir tous les champs obligatoires' : 'Passer au groupe suivant', children: [_jsx("span", { className: "hidden sm:inline", children: labels.nextButton || 'Suivant' }), _jsx("span", { className: "sm:hidden", children: "Suiv." }), _jsx("svg", { className: "h-4 w-4 ml-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })] })), navigation.isLastGroup && !isConsultationMode && !showDRValidationButtons && (_jsx("button", { type: "button", onClick: handleSubmit, disabled: effectiveDisabled || isSubmitting || isSubmittingForm || !isFormValid, className: `flex items-center px-4 py-2 rounded-lg font-medium transition-colors ${isFormValid && !effectiveDisabled
|
|
378
|
+
: 'bg-gray-400 text-gray-200 cursor-not-allowed'}`, title: hasConditionErrors ? 'Corrigez les erreurs de validation' : !canGoNext ? 'Veuillez remplir tous les champs obligatoires' : 'Passer au groupe suivant', children: [_jsx("span", { className: "hidden sm:inline", children: labels.nextButton || 'Suivant' }), _jsx("span", { className: "sm:hidden", children: "Suiv." }), _jsx("svg", { className: "h-4 w-4 ml-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })] })), navigation.isLastGroup && !isConsultationMode && !showDRValidationButtons && (_jsx("button", { type: "button", onClick: handleSubmit, disabled: effectiveDisabled || isSubmitting || isSubmittingForm || !isFormValid || hasConditionErrors, className: `flex items-center px-4 py-2 rounded-lg font-medium transition-colors ${isFormValid && !effectiveDisabled && !hasConditionErrors
|
|
379
379
|
? 'bg-green-600 text-white hover:bg-green-700'
|
|
380
|
-
: 'bg-gray-400 text-gray-200 cursor-not-allowed'}`, title: !isFormValid ? 'Veuillez remplir tous les champs obligatoires' : '', children: isSubmitting || isSubmittingForm ? (_jsxs("span", { className: "flex items-center", children: [_jsxs("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "Envoi en cours..."] })) : (labels.submitButton || (mode === 'admin' ? 'Valider' : 'Soumettre')) })), showDRValidationButtons && (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", onClick: () => handleOpenValidationModal('rejeter'), disabled: isSubmitting || isSubmittingForm, className: "px-4 py-2 rounded-lg font-medium transition-colors bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center", children: [_jsx("svg", { className: "h-4 w-4 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }), labels.rejectDRButton || 'Rejeter'] }), _jsxs("button", { type: "button", onClick: () => handleOpenValidationModal('valider'), disabled: isSubmitting || isSubmittingForm, className: "px-4 py-2 rounded-lg font-medium transition-colors bg-green-600 text-white hover:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center", children: [_jsx("svg", { className: "h-4 w-4 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }), labels.validateDRButton || 'Valider'] })] }))] })] }) })] }), _jsx(ConfirmationModal, { isOpen: showCancelModal, title: "Annuler les modifications", message: "Vous avez des modifications non sauvegard\u00E9es. \u00CAtes-vous s\u00FBr de vouloir quitter ?", confirmText: "Quitter", cancelText: "Continuer", onConfirm: handleConfirmCancel, onCancel: () => setShowCancelModal(false), type: "danger" }), _jsx(ValidationModal, { isOpen: showValidationModal, onClose: () => setShowValidationModal(false), onConfirm: handleConfirmValidation, action: validationAction, enquetesCount: 1 })] }));
|
|
380
|
+
: 'bg-gray-400 text-gray-200 cursor-not-allowed'}`, title: hasConditionErrors ? 'Corrigez les erreurs de validation' : !isFormValid ? 'Veuillez remplir tous les champs obligatoires' : '', children: isSubmitting || isSubmittingForm ? (_jsxs("span", { className: "flex items-center", children: [_jsxs("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "Envoi en cours..."] })) : (labels.submitButton || (mode === 'admin' ? 'Valider' : 'Soumettre')) })), showDRValidationButtons && (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", onClick: () => handleOpenValidationModal('rejeter'), disabled: isSubmitting || isSubmittingForm, className: "px-4 py-2 rounded-lg font-medium transition-colors bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center", children: [_jsx("svg", { className: "h-4 w-4 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }), labels.rejectDRButton || 'Rejeter'] }), _jsxs("button", { type: "button", onClick: () => handleOpenValidationModal('valider'), disabled: isSubmitting || isSubmittingForm, className: "px-4 py-2 rounded-lg font-medium transition-colors bg-green-600 text-white hover:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center", children: [_jsx("svg", { className: "h-4 w-4 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }), labels.validateDRButton || 'Valider'] })] }))] })] }) })] }), _jsx(ConfirmationModal, { isOpen: showCancelModal, title: "Annuler les modifications", message: "Vous avez des modifications non sauvegard\u00E9es. \u00CAtes-vous s\u00FBr de vouloir quitter ?", confirmText: "Quitter", cancelText: "Continuer", onConfirm: handleConfirmCancel, onCancel: () => setShowCancelModal(false), type: "danger" }), _jsx(ValidationModal, { isOpen: showValidationModal, onClose: () => setShowValidationModal(false), onConfirm: handleConfirmValidation, action: validationAction, enquetesCount: 1 })] }));
|
|
381
381
|
};
|
|
382
382
|
/**
|
|
383
383
|
* Composant principal FormRenderer
|
package/package.json
CHANGED