From f78e619d87eb61374032043e3ce9700589b2d9ca Mon Sep 17 00:00:00 2001 From: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com> Date: Wed, 15 May 2024 16:31:00 +0200 Subject: [PATCH] Merge pull request #18331 from overleaf/rd-bs5-renaming [web ] Bootstrap 5 - rename the wrapper components and restructure GitOrigin-RevId: 7a76903df81cd546e9e469f24c4f203ea6a61672 --- .../components/account-info-section.tsx | 42 +++++------ .../settings/components/emails-section.tsx | 4 +- .../make-primary/confirmation-modal.tsx | 12 ++-- .../actions/make-primary/make-primary.tsx | 6 +- .../actions/make-primary/primary-button.tsx | 10 ++- .../components/emails/actions/remove.tsx | 16 ++--- .../settings/components/emails/add-email.tsx | 26 +++---- .../add-email/add-another-email-btn.tsx | 10 ++- .../emails/add-email/add-new-email-btn.tsx | 10 ++- .../emails/add-email/country-input.tsx | 4 +- .../email-affiliated-with-institution.tsx | 13 ++-- .../components/emails/add-email/input.tsx | 6 +- .../emails/add-email/institution-fields.tsx | 20 +++--- .../components/emails/add-email/layout.tsx | 8 +-- .../emails/add-email/sso-linking-info.tsx | 6 +- .../emails/add-email/university-name.tsx | 6 +- .../components/emails/downshift-input.tsx | 4 +- .../settings/components/emails/email.tsx | 6 +- .../settings/components/emails/header.tsx | 16 ++--- .../emails/institution-and-role.tsx | 24 +++---- .../components/emails/reconfirmation-info.tsx | 44 ++++++------ .../resend-confirmation-email-button.tsx | 6 +- .../settings/components/emails/row.tsx | 54 +++++++------- .../settings/components/emails/sso-alert.tsx | 8 +-- .../settings/components/leave-section.tsx | 6 +- .../components/leave/modal-content.tsx | 12 ++-- .../components/leave/modal-form-error.tsx | 4 +- .../settings/components/leave/modal-form.tsx | 26 +++---- .../settings/components/leave/modal.tsx | 2 +- .../components/leavers-survey-alert.tsx | 4 +- .../settings/components/linking-section.tsx | 6 +- .../components/linking/enable-widget.tsx | 18 ++--- .../components/linking/integration-widget.tsx | 34 +++++---- .../components/linking/sso-widget.tsx | 24 +++---- .../settings/components/password-section.tsx | 40 +++++------ .../js/features/settings/components/root.tsx | 30 ++++---- .../settings/components/security-section.tsx | 6 +- .../wrappers/form-control-wrapper.tsx | 71 ------------------- .../badge-wrapper.tsx => ol/ol-badge.tsx} | 6 +- .../button-wrapper.tsx => ol/ol-button.tsx} | 8 +-- .../card-wrapper.tsx => ol/ol-card.tsx} | 4 +- .../col-wrapper.tsx => ol/ol-col.tsx} | 6 +- .../ol-form-checkbox.tsx} | 6 +- .../ui/components/ol/ol-form-control.tsx | 68 ++++++++++++++++++ .../ol-form-group.tsx} | 6 +- .../ol-form-label.tsx} | 6 +- .../ol-form-text.tsx} | 6 +- .../ol-icon-button.tsx} | 10 +-- .../{bootstrap-5/wrappers => ol}/ol-modal.tsx | 0 .../ol-notification.tsx} | 6 +- .../row-wrapper.tsx => ol/ol-row.tsx} | 6 +- .../tooltip-wrapper.tsx => ol/ol-tooltip.tsx} | 6 +- .../frontend/js/shared/components/badge.tsx | 4 +- 53 files changed, 387 insertions(+), 405 deletions(-) delete mode 100644 services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-control-wrapper.tsx rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/badge-wrapper.tsx => ol/ol-badge.tsx} (86%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/button-wrapper.tsx => ol/ol-button.tsx} (85%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/card-wrapper.tsx => ol/ol-card.tsx} (89%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/col-wrapper.tsx => ol/ol-col.tsx} (88%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/form-checkbox-wrapper.tsx => ol/ol-form-checkbox.tsx} (81%) create mode 100644 services/web/frontend/js/features/ui/components/ol/ol-form-control.tsx rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/form-group-wrapper.tsx => ol/ol-form-group.tsx} (80%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/form-label-wrapper.tsx => ol/ol-form-label.tsx} (78%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/form-text-wrapper.tsx => ol/ol-form-text.tsx} (85%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/icon-button-wrapper.tsx => ol/ol-icon-button.tsx} (75%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers => ol}/ol-modal.tsx (100%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/notification-wrapper.tsx => ol/ol-notification.tsx} (85%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/row-wrapper.tsx => ol/ol-row.tsx} (73%) rename services/web/frontend/js/features/ui/components/{bootstrap-5/wrappers/tooltip-wrapper.tsx => ol/ol-tooltip.tsx} (86%) diff --git a/services/web/frontend/js/features/settings/components/account-info-section.tsx b/services/web/frontend/js/features/settings/components/account-info-section.tsx index 72b2598c6d..dcd5b6cc11 100644 --- a/services/web/frontend/js/features/settings/components/account-info-section.tsx +++ b/services/web/frontend/js/features/settings/components/account-info-section.tsx @@ -8,11 +8,11 @@ import getMeta from '../../../utils/meta' import { ExposedSettings } from '../../../../../types/exposed-settings' import useAsync from '../../../shared/hooks/use-async' import { useUserContext } from '../../../shared/context/user-context' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' -import NotificationWrapper from '@/features/ui/components/bootstrap-5/wrappers/notification-wrapper' -import FormGroupWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-group-wrapper' -import FormLabelWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-label-wrapper' -import FormControlWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-control-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' +import OLNotification from '@/features/ui/components/ol/ol-notification' +import OLFormGroup from '@/features/ui/components/ol/ol-form-group' +import OLFormLabel from '@/features/ui/components/ol/ol-form-label' +import OLFormControl from '@/features/ui/components/ol/ol-form-control' import FormText from '@/features/ui/components/bootstrap-5/form/form-text' function AccountInfoSection() { @@ -107,23 +107,23 @@ function AccountInfoSection() { required={false} /> {isSuccess ? ( - - + - + ) : null} {isError ? ( - - + - + ) : null} {canUpdateEmail || canUpdateNames ? ( - {t('update')} - + ) : null} @@ -175,17 +175,17 @@ function ReadOrWriteFormGroup({ if (!canEdit) { return ( - - {label} - - + + {label} + + ) } return ( - - {label} - + {label} + {validationMessage && {validationMessage}} - + ) } diff --git a/services/web/frontend/js/features/settings/components/emails-section.tsx b/services/web/frontend/js/features/settings/components/emails-section.tsx index 866fc12115..18f078fb07 100644 --- a/services/web/frontend/js/features/settings/components/emails-section.tsx +++ b/services/web/frontend/js/features/settings/components/emails-section.tsx @@ -9,7 +9,7 @@ import EmailsHeader from './emails/header' import EmailsRow from './emails/row' import AddEmail from './emails/add-email' import Icon from '../../../shared/components/icon' -import NotificationWrapper from '@/features/ui/components/bootstrap-5/wrappers/notification-wrapper' +import OLNotification from '@/features/ui/components/ol/ol-notification' import { ExposedSettings } from '../../../../../types/exposed-settings' import { LeaversSurveyAlert } from './leavers-survey-alert' @@ -67,7 +67,7 @@ function EmailsSectionContent() { {isInitializingSuccess && } {isInitializingSuccess && !hideAddSecondaryEmail && } {isInitializingError && ( - , @@ -46,7 +46,7 @@ function ConfirmationModal({

{t('log_in_with_primary_email_address')}

- {t('cancel')} - - + {t('confirm')} - + ) diff --git a/services/web/frontend/js/features/settings/components/emails/actions/make-primary/make-primary.tsx b/services/web/frontend/js/features/settings/components/emails/actions/make-primary/make-primary.tsx index 72c6f4b0d4..40583aef98 100644 --- a/services/web/frontend/js/features/settings/components/emails/actions/make-primary/make-primary.tsx +++ b/services/web/frontend/js/features/settings/components/emails/actions/make-primary/make-primary.tsx @@ -14,7 +14,7 @@ import { UserEmailData } from '../../../../../../../../types/user-email' import { UseAsyncReturnType } from '../../../../../../shared/hooks/use-async' import { ssoAvailableForInstitution } from '../../../../utils/sso' import ConfirmationModal from './confirmation-modal' -import TooltipWrapper from '@/features/ui/components/bootstrap-5/wrappers/tooltip-wrapper' +import OLTooltip from '@/features/ui/components/ol/ol-tooltip' const getDescription = ( t: (s: string) => string, @@ -86,7 +86,7 @@ function MakePrimary({ userEmailData, makePrimaryAsync }: MakePrimaryProps) { {t('processing_uppercase')}… ) : ( - @@ -102,7 +102,7 @@ function MakePrimary({ userEmailData, makePrimaryAsync }: MakePrimaryProps) { {t('make_primary')} - + )} {children} - + ) } diff --git a/services/web/frontend/js/features/settings/components/emails/actions/remove.tsx b/services/web/frontend/js/features/settings/components/emails/actions/remove.tsx index 7418dc1461..62a1d8ba7d 100644 --- a/services/web/frontend/js/features/settings/components/emails/actions/remove.tsx +++ b/services/web/frontend/js/features/settings/components/emails/actions/remove.tsx @@ -3,14 +3,14 @@ import { UserEmailData } from '../../../../../../../types/user-email' import { useUserEmailsContext } from '../../../context/user-email-context' import { postJSON } from '../../../../../infrastructure/fetch-json' import { UseAsyncReturnType } from '../../../../../shared/hooks/use-async' -import TooltipWrapper from '@/features/ui/components/bootstrap-5/wrappers/tooltip-wrapper' -import IconButtonWrapper, { - IconButtonWrapperProps, -} from '@/features/ui/components/bootstrap-5/wrappers/icon-button-wrapper' +import OLTooltip from '@/features/ui/components/ol/ol-tooltip' +import OLIconButton, { + OLIconButtonProps, +} from '@/features/ui/components/ol/ol-icon-button' import { bsVersion } from '@/features/utils/bootstrap-5' type DeleteButtonProps = Pick< - IconButtonWrapperProps, + OLIconButtonProps, 'disabled' | 'isLoading' | 'onClick' > @@ -18,7 +18,7 @@ function DeleteButton({ disabled, isLoading, onClick }: DeleteButtonProps) { const { t } = useTranslation() return ( - - + ) } diff --git a/services/web/frontend/js/features/settings/components/emails/add-email.tsx b/services/web/frontend/js/features/settings/components/emails/add-email.tsx index c7bd833c61..08c4eb5295 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email.tsx @@ -17,7 +17,7 @@ import { isValidEmail } from '../../../../shared/utils/email' import getMeta from '../../../../utils/meta' import { ReCaptcha2 } from '../../../../shared/components/recaptcha-2' import { useRecaptcha } from '../../../../shared/hooks/use-recaptcha' -import ColWrapper from '@/features/ui/components/bootstrap-5/wrappers/col-wrapper' +import OLCol from '@/features/ui/components/ol/ol-col' import { bsVersion } from '@/features/utils/bootstrap-5' function AddEmail() { @@ -109,7 +109,7 @@ function AddEmail() { if (!isFormVisible) { return ( - + {state.data.emailCount >= emailAddressLimit ? ( @@ -127,7 +127,7 @@ function AddEmail() { )} - + ) } @@ -152,15 +152,15 @@ function AddEmail() {
- + {InputComponent}
{t('start_by_adding_your_email')}
-
- + + - +
) @@ -182,7 +182,7 @@ function AddEmail() {
- + {InputComponent} {!isSsoAvailableForDomain ? ( @@ -203,9 +203,9 @@ function AddEmail() { ) : null} - + {!isSsoAvailableForDomain ? ( - + - + ) : ( - +
-
+ )}
diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/add-another-email-btn.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/add-another-email-btn.tsx index 3b895d9bb9..8c1867e340 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/add-another-email-btn.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/add-another-email-btn.tsx @@ -1,20 +1,18 @@ import { useTranslation } from 'react-i18next' -import ButtonWrapper, { - ButtonWrapperProps, -} from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton, { OLButtonProps } from '@/features/ui/components/ol/ol-button' -function AddAnotherEmailBtn({ onClick, ...props }: ButtonWrapperProps) { +function AddAnotherEmailBtn({ onClick, ...props }: OLButtonProps) { const { t } = useTranslation() return ( - {t('add_another_email')} - + ) } diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/add-new-email-btn.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/add-new-email-btn.tsx index 1834b1d88c..8c38a54db5 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/add-new-email-btn.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/add-new-email-btn.tsx @@ -1,7 +1,5 @@ import { useTranslation } from 'react-i18next' -import ButtonWrapper, { - ButtonWrapperProps, -} from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton, { OLButtonProps } from '@/features/ui/components/ol/ol-button' const isValidEmail = (email: string) => { return Boolean(email) @@ -9,7 +7,7 @@ const isValidEmail = (email: string) => { type AddNewEmailColProps = { email: string -} & ButtonWrapperProps +} & OLButtonProps function AddNewEmailBtn({ email, @@ -20,7 +18,7 @@ function AddNewEmailBtn({ const { t } = useTranslation() return ( - {t('add_new_email')} - + ) } diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/country-input.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/country-input.tsx index e506a054c4..2de138c3ab 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/country-input.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/country-input.tsx @@ -4,7 +4,7 @@ import { useCombobox } from 'downshift' import classnames from 'classnames' import countries, { CountryCode } from '../../../data/countries-list' import { bsVersion } from '@/features/utils/bootstrap-5' -import FormControlWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-control-wrapper' +import OLFormControl from '@/features/ui/components/ol/ol-form-control' type CountryInputProps = { setValue: React.Dispatch> @@ -63,7 +63,7 @@ function Downshift({ setValue, inputRef }: CountryInputProps) { > {t('country')} - ) => { setInputValue(event.target.value) diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/email-affiliated-with-institution.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/email-affiliated-with-institution.tsx index ec930fa0d2..e0a2cca3ea 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/email-affiliated-with-institution.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/email-affiliated-with-institution.tsx @@ -1,25 +1,20 @@ import { useTranslation } from 'react-i18next' -import ButtonWrapper, { - ButtonWrapperProps, -} from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton, { OLButtonProps } from '@/features/ui/components/ol/ol-button' -function EmailAffiliatedWithInstitution({ - onClick, - ...props -}: ButtonWrapperProps) { +function EmailAffiliatedWithInstitution({ onClick, ...props }: OLButtonProps) { const { t } = useTranslation() return (
{t('is_email_affiliated')} - {t('let_us_know')} - +
) } diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/input.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/input.tsx index 60fd1201fd..e79d652f6b 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/input.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/input.tsx @@ -11,7 +11,7 @@ import { getJSON } from '../../../../../infrastructure/fetch-json' import useAbortController from '../../../../../shared/hooks/use-abort-controller' import domainBlocklist from '../../../domain-blocklist' import { debugConsole } from '@/utils/debugging' -import FormControlWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-control-wrapper' +import OLFormControl from '@/features/ui/components/ol/ol-form-control' const LOCAL_AND_DOMAIN_REGEX = /([^@]+)@(.+)/ @@ -162,13 +162,13 @@ function Input({ onChange, handleAddNewEmail }: InputProps) { return (
- - - + - - + + - + )} {isRoleAndDepartmentVisible && ( <> - + - - + + - + )} diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/layout.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/layout.tsx index 4f021fe95e..c1002073a0 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/layout.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/layout.tsx @@ -1,8 +1,8 @@ import Icon from '../../../../../shared/components/icon' import { UseAsyncReturnType } from '../../../../../shared/hooks/use-async' import { getUserFacingMessage } from '../../../../../infrastructure/fetch-json' -import RowWrapper from '@/features/ui/components/bootstrap-5/wrappers/row-wrapper' -import NotificationWrapper from '@/features/ui/components/bootstrap-5/wrappers/notification-wrapper' +import OLRow from '@/features/ui/components/ol/ol-row' +import OLNotification from '@/features/ui/components/ol/ol-notification' type LayoutProps = { children: React.ReactNode @@ -13,9 +13,9 @@ type LayoutProps = { function Layout({ isError, error, children }: LayoutProps) { return (
- {children} + {children} {isError && ( -

- {t('link_accounts_and_add_email')} - + ) } diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/university-name.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/university-name.tsx index 5236e50e7b..83a317c824 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/university-name.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/university-name.tsx @@ -1,5 +1,5 @@ import { useTranslation } from 'react-i18next' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' type UniversityNameProps = { name: string @@ -14,13 +14,13 @@ function UniversityName({ name, onClick }: UniversityNameProps) { {name} {' '} - {t('change')} - +

) diff --git a/services/web/frontend/js/features/settings/components/emails/downshift-input.tsx b/services/web/frontend/js/features/settings/components/emails/downshift-input.tsx index 234fffae60..bb9929e392 100644 --- a/services/web/frontend/js/features/settings/components/emails/downshift-input.tsx +++ b/services/web/frontend/js/features/settings/components/emails/downshift-input.tsx @@ -3,7 +3,7 @@ import { useCombobox } from 'downshift' import classnames from 'classnames' import { escapeRegExp } from 'lodash' import { bsVersion } from '@/features/utils/bootstrap-5' -import FormControlWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-control-wrapper' +import OLFormControl from '@/features/ui/components/ol/ol-form-control' type DownshiftInputProps = { highlightMatches?: boolean @@ -98,7 +98,7 @@ function Downshift({ > {label} - ) => { setValue(event.target.value) diff --git a/services/web/frontend/js/features/settings/components/emails/email.tsx b/services/web/frontend/js/features/settings/components/emails/email.tsx index 4d5d52887d..3b16aafe93 100644 --- a/services/web/frontend/js/features/settings/components/emails/email.tsx +++ b/services/web/frontend/js/features/settings/components/emails/email.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next' import { UserEmailData } from '../../../../../../types/user-email' import ResendConfirmationEmailButton from './resend-confirmation-email-button' import { ssoAvailableForInstitution } from '../../utils/sso' -import BadgeWrapper from '@/features/ui/components/bootstrap-5/wrappers/badge-wrapper' +import OLBadge from '@/features/ui/components/ol/ol-badge' import { isBootstrap5 } from '@/features/utils/bootstrap-5' import classnames from 'classnames' @@ -43,11 +43,11 @@ function Email({ userEmailData }: EmailProps) {
{isPrimary && ( <> - Primary{' '} + Primary{' '} )} {isProfessional && ( - {t('professional')} + {t('professional')} )}
)} diff --git a/services/web/frontend/js/features/settings/components/emails/header.tsx b/services/web/frontend/js/features/settings/components/emails/header.tsx index b5039d364c..3948580e46 100644 --- a/services/web/frontend/js/features/settings/components/emails/header.tsx +++ b/services/web/frontend/js/features/settings/components/emails/header.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next' import EmailCell from './cell' -import ColWrapper from '@/features/ui/components/bootstrap-5/wrappers/col-wrapper' -import RowWrapper from '@/features/ui/components/bootstrap-5/wrappers/row-wrapper' +import OLCol from '@/features/ui/components/ol/ol-col' +import OLRow from '@/features/ui/components/ol/ol-row' import classnames from 'classnames' import { bsVersion } from '@/features/utils/bootstrap-5' @@ -10,8 +10,8 @@ function Header() { return ( <> - - + {t('email')} - - + {t('institution_and_role')} - - + +
)} - +
) : (
- + - - + + - - + {t('save_or_cancel-save')} - + {!isLoading && ( <> {t('save_or_cancel-or')} - {t('save_or_cancel-cancel')} - + )}
diff --git a/services/web/frontend/js/features/settings/components/emails/reconfirmation-info.tsx b/services/web/frontend/js/features/settings/components/emails/reconfirmation-info.tsx index 48aa9bce4d..7f8b1dff91 100644 --- a/services/web/frontend/js/features/settings/components/emails/reconfirmation-info.tsx +++ b/services/web/frontend/js/features/settings/components/emails/reconfirmation-info.tsx @@ -3,9 +3,9 @@ import { UserEmailData } from '../../../../../../types/user-email' import getMeta from '../../../../utils/meta' import ReconfirmationInfoSuccess from './reconfirmation-info/reconfirmation-info-success' import ReconfirmationInfoPromptText from './reconfirmation-info/reconfirmation-info-prompt-text' -import RowWrapper from '@/features/ui/components/bootstrap-5/wrappers/row-wrapper' -import ColWrapper from '@/features/ui/components/bootstrap-5/wrappers/col-wrapper' -import NotificationWrapper from '@/features/ui/components/bootstrap-5/wrappers/notification-wrapper' +import OLRow from '@/features/ui/components/ol/ol-row' +import OLCol from '@/features/ui/components/ol/ol-col' +import OLNotification from '@/features/ui/components/ol/ol-notification' import { isBootstrap5 } from '@/features/utils/bootstrap-5' import Icon from '@/shared/components/icon' import { useUserEmailsContext } from '@/features/settings/context/user-email-context' @@ -16,7 +16,7 @@ import { Trans, useTranslation } from 'react-i18next' import useAsync from '@/shared/hooks/use-async' import { ExposedSettings } from '../../../../../../types/exposed-settings' import { useLocation } from '@/shared/hooks/use-location' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' import classnames from 'classnames' type ReconfirmationInfoProps = { @@ -80,9 +80,9 @@ function ReconfirmationInfo({ userEmailData }: ReconfirmationInfoProps) { userEmailData.samlProviderId === reconfirmedViaSAML ) { return ( - - - + + - - + + ) } if (userEmailData.affiliation.inReconfirmNotificationPeriod) { return ( - - + + {isBootstrap5 ? ( - @@ -145,7 +145,7 @@ function ReconfirmationInfo({ userEmailData }: ReconfirmationInfoProps) { {t('sending')}... ) : ( - {t('resend_confirmation_email')} - + )} ) : ( - + ) } /> @@ -204,14 +204,14 @@ function ReconfirmationInfo({ userEmailData }: ReconfirmationInfoProps) { {t('sending')}... ) : ( - {t('resend_confirmation_email')} - + )}
{isError && ( @@ -236,7 +236,7 @@ function ReconfirmationInfo({ userEmailData }: ReconfirmationInfoProps) { />
- +
{isError && (
@@ -263,8 +263,8 @@ function ReconfirmationInfo({ userEmailData }: ReconfirmationInfoProps) { )}
)} - - + + ) } diff --git a/services/web/frontend/js/features/settings/components/emails/resend-confirmation-email-button.tsx b/services/web/frontend/js/features/settings/components/emails/resend-confirmation-email-button.tsx index 58b39dc1ff..9e0509c145 100644 --- a/services/web/frontend/js/features/settings/components/emails/resend-confirmation-email-button.tsx +++ b/services/web/frontend/js/features/settings/components/emails/resend-confirmation-email-button.tsx @@ -5,7 +5,7 @@ import { FetchError, postJSON } from '../../../../infrastructure/fetch-json' import useAsync from '../../../../shared/hooks/use-async' import { UserEmailData } from '../../../../../../types/user-email' import { useUserEmailsContext } from '../../context/user-email-context' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' type ResendConfirmationEmailButtonProps = { email: UserEmailData['email'] @@ -47,14 +47,14 @@ function ResendConfirmationEmailButton({ return ( <> - {t('resend_confirmation_email')} - +
{isError && (
diff --git a/services/web/frontend/js/features/settings/components/emails/row.tsx b/services/web/frontend/js/features/settings/components/emails/row.tsx index 4590bec9cb..7072d93938 100644 --- a/services/web/frontend/js/features/settings/components/emails/row.tsx +++ b/services/web/frontend/js/features/settings/components/emails/row.tsx @@ -12,10 +12,10 @@ import { ExposedSettings } from '../../../../../../types/exposed-settings' import { ssoAvailableForInstitution } from '../../utils/sso' import ReconfirmationInfo from './reconfirmation-info' import { useLocation } from '../../../../shared/hooks/use-location' -import RowWrapper from '@/features/ui/components/bootstrap-5/wrappers/row-wrapper' -import ColWrapper from '@/features/ui/components/bootstrap-5/wrappers/col-wrapper' +import OLRow from '@/features/ui/components/ol/ol-row' +import OLCol from '@/features/ui/components/ol/ol-col' import { bsVersion } from '@/features/utils/bootstrap-5' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' type EmailsRowProps = { userEmailData: UserEmailData @@ -29,20 +29,20 @@ function EmailsRow({ userEmailData }: EmailsRowProps) { return ( <> - - + + - - + + {userEmailData.affiliation?.institution && ( )} - - + + - - + + {hasSSOAffiliation && ( @@ -93,8 +93,8 @@ function SSOAffiliationInfo({ userEmailData }: SSOAffiliationInfoProps) { if (userEmailData.samlProviderId) { return ( - - + +

-
-
+ + ) } return ( - - + +
- - + +

-
- + - {t('link_accounts')} - + - -
- - + + + + ) } diff --git a/services/web/frontend/js/features/settings/components/emails/sso-alert.tsx b/services/web/frontend/js/features/settings/components/emails/sso-alert.tsx index 52ba09e5e6..5d1fe100d9 100644 --- a/services/web/frontend/js/features/settings/components/emails/sso-alert.tsx +++ b/services/web/frontend/js/features/settings/components/emails/sso-alert.tsx @@ -2,7 +2,7 @@ import { useState } from 'react' import { useTranslation, Trans } from 'react-i18next' import Icon from '../../../../shared/components/icon' import getMeta from '../../../../utils/meta' -import NotificationWrapper from '@/features/ui/components/bootstrap-5/wrappers/notification-wrapper' +import OLNotification from '@/features/ui/components/ol/ol-notification' type InstitutionLink = { universityName: string @@ -36,7 +36,7 @@ export function SSOAlert() { if (samlError) { return !errorClosed ? ( - @@ -68,7 +68,7 @@ export function SSOAlert() { return ( <> {!infoClosed && ( - @@ -102,7 +102,7 @@ export function SSOAlert() { /> )} {!warningClosed && institutionEmailNonCanonical && ( - {t('need_to_leave')}{' '} - {t('delete_your_account')} - + ) diff --git a/services/web/frontend/js/features/settings/components/leave/modal-content.tsx b/services/web/frontend/js/features/settings/components/leave/modal-content.tsx index 40f317e61a..bb6dcdd6b6 100644 --- a/services/web/frontend/js/features/settings/components/leave/modal-content.tsx +++ b/services/web/frontend/js/features/settings/components/leave/modal-content.tsx @@ -3,13 +3,13 @@ import { useTranslation, Trans } from 'react-i18next' import getMeta from '../../../../utils/meta' import LeaveModalForm, { LeaveModalFormProps } from './modal-form' import { ExposedSettings } from '../../../../../../types/exposed-settings' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' import { OLModalBody, OLModalFooter, OLModalHeader, OLModalTitle, -} from '@/features/ui/components/bootstrap-5/wrappers/ol-modal' +} from '@/features/ui/components/ol/ol-modal' type LeaveModalContentProps = { handleHide: () => void @@ -74,23 +74,23 @@ function LeaveModalContent({ - {t('cancel')} - + - {inFlight ? <>{t('deleting')}… : t('delete')} - + ) diff --git a/services/web/frontend/js/features/settings/components/leave/modal-form-error.tsx b/services/web/frontend/js/features/settings/components/leave/modal-form-error.tsx index a4c1f81c51..f26be8d948 100644 --- a/services/web/frontend/js/features/settings/components/leave/modal-form-error.tsx +++ b/services/web/frontend/js/features/settings/components/leave/modal-form-error.tsx @@ -2,7 +2,7 @@ import { useTranslation, Trans } from 'react-i18next' import getMeta from '../../../../utils/meta' import { FetchError } from '../../../../infrastructure/fetch-json' import { ExposedSettings } from '../../../../../../types/exposed-settings' -import NotificationWrapper from '@/features/ui/components/bootstrap-5/wrappers/notification-wrapper' +import OLNotification from '@/features/ui/components/ol/ol-notification' type LeaveModalFormErrorProps = { error: FetchError @@ -32,7 +32,7 @@ function LeaveModalFormError({ error }: LeaveModalFormErrorProps) { } return ( - diff --git a/services/web/frontend/js/features/settings/components/leave/modal-form.tsx b/services/web/frontend/js/features/settings/components/leave/modal-form.tsx index 5f825c98ec..83e6cdb018 100644 --- a/services/web/frontend/js/features/settings/components/leave/modal-form.tsx +++ b/services/web/frontend/js/features/settings/components/leave/modal-form.tsx @@ -4,10 +4,10 @@ import { postJSON, FetchError } from '../../../../infrastructure/fetch-json' import getMeta from '../../../../utils/meta' import LeaveModalFormError from './modal-form-error' import { useLocation } from '../../../../shared/hooks/use-location' -import FormGroupWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-group-wrapper' -import FormLabelWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-label-wrapper' -import FormControlWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-control-wrapper' -import FormCheckboxWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-checkbox-wrapper' +import OLFormGroup from '@/features/ui/components/ol/ol-form-group' +import OLFormLabel from '@/features/ui/components/ol/ol-form-label' +import OLFormControl from '@/features/ui/components/ol/ol-form-control' +import OLFormCheckbox from '@/features/ui/components/ol/ol-form-checkbox' export type LeaveModalFormProps = { setInFlight: Dispatch> @@ -73,27 +73,27 @@ function LeaveModalForm({ return (
- - {t('email')} - + {t('email')} + - - - {t('password')} - + + {t('password')} + - - + diff --git a/services/web/frontend/js/features/settings/components/linking-section.tsx b/services/web/frontend/js/features/settings/components/linking-section.tsx index c92991340e..8888144155 100644 --- a/services/web/frontend/js/features/settings/components/linking-section.tsx +++ b/services/web/frontend/js/features/settings/components/linking-section.tsx @@ -6,7 +6,7 @@ import { SSOLinkingWidget } from './linking/sso-widget' import getMeta from '../../../utils/meta' import { useBroadcastUser } from '@/shared/hooks/user-channel/use-broadcast-user' import { useFeatureFlag } from '@/shared/context/split-test-context' -import NotificationWrapper from '@/features/ui/components/bootstrap-5/wrappers/notification-wrapper' +import OLNotification from '@/features/ui/components/ol/ol-notification' function LinkingSection() { useBroadcastUser() @@ -122,7 +122,7 @@ function LinkingSection() { {t('project_synchronisation')} {projectSyncSuccessMessage ? ( - @@ -166,7 +166,7 @@ function LinkingSection() { {t('linked_accounts')} {ssoErrorMessage ? ( - diff --git a/services/web/frontend/js/features/settings/components/linking/enable-widget.tsx b/services/web/frontend/js/features/settings/components/linking/enable-widget.tsx index b6f2c35107..ddd230d854 100644 --- a/services/web/frontend/js/features/settings/components/linking/enable-widget.tsx +++ b/services/web/frontend/js/features/settings/components/linking/enable-widget.tsx @@ -1,8 +1,8 @@ import { ReactNode } from 'react' import { useTranslation } from 'react-i18next' import { sendMB } from '@/infrastructure/event-tracking' -import BadgeWrapper from '@/features/ui/components/bootstrap-5/wrappers/badge-wrapper' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLBadge from '@/features/ui/components/ol/ol-badge' +import OLButton from '@/features/ui/components/ol/ol-button' function trackUpgradeClick() { sendMB('settings-upgrade-click') @@ -49,7 +49,7 @@ export function EnableWidget({

{title}

{!hasFeature && isPremiumFeature && ( - {t('premium_feature')} + {t('premium_feature')} )}

@@ -92,29 +92,29 @@ function ActionButton({ const { t } = useTranslation() if (!hasFeature) { return ( - {t('upgrade')} - + ) } else if (linked) { return ( - {t('turn_off')} - + ) } else { return ( - {t('turn_on')} - + ) } } diff --git a/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx b/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx index d57c0f7ab5..8c0990a248 100644 --- a/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx +++ b/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx @@ -1,16 +1,16 @@ import { useCallback, useState, ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import BadgeWrapper from '@/features/ui/components/bootstrap-5/wrappers/badge-wrapper' +import OLBadge from '@/features/ui/components/ol/ol-badge' import getMeta from '../../../../utils/meta' import { sendMB } from '../../../../infrastructure/event-tracking' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' import { bsVersion } from '@/features/utils/bootstrap-5' import OLModal, { OLModalBody, OLModalFooter, OLModalHeader, OLModalTitle, -} from '@/features/ui/components/bootstrap-5/wrappers/ol-modal' +} from '@/features/ui/components/ol/ol-modal' function trackUpgradeClick(integration: string) { sendMB('settings-upgrade-click', { integration }) @@ -67,9 +67,7 @@ export function IntegrationLinkingWidget({

{title}

- {!hasFeature && ( - {t('premium_feature')} - )} + {!hasFeature && {t('premium_feature')}}

{description}{' '} @@ -121,31 +119,31 @@ function ActionButton({ const { t } = useTranslation() if (!hasFeature) { return ( - trackUpgradeClick(integration)} bs3Props={{ bsStyle: null, className: 'btn-primary' }} > {t('upgrade')} - + ) } else if (linked) { return ( - {t('unlink')} - + ) } else { return ( <> {disabled ? ( - {t('link')} - + ) : ( - trackLinkingClick(integration)} > {t('link')} - + )} ) @@ -217,7 +215,7 @@ function UnlinkConfirmationModal({ - {t('cancel')} - - + {t('unlink')} - + diff --git a/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx b/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx index c27383e542..3d3f44c520 100644 --- a/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx +++ b/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx @@ -5,14 +5,14 @@ import IEEELogo from '../../../../shared/svgs/ieee-logo' import GoogleLogo from '../../../../shared/svgs/google-logo' import OrcidLogo from '../../../../shared/svgs/orcid-logo' import LinkingStatus from './status' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' import { bsVersion } from '@/features/utils/bootstrap-5' import OLModal, { OLModalBody, OLModalFooter, OLModalHeader, OLModalTitle, -} from '@/features/ui/components/bootstrap-5/wrappers/ol-modal' +} from '@/features/ui/components/ol/ol-modal' const providerLogos: { readonly [p: string]: JSX.Element } = { collabratec: , @@ -118,27 +118,27 @@ function ActionButton({ const { t } = useTranslation() if (unlinkRequestInflight) { return ( - {t('unlinking')} - + ) } else if (accountIsLinked) { return ( - {t('unlink')} - + ) } else { return ( - {t('link')} - + ) } } @@ -181,7 +181,7 @@ function UnlinkConfirmModal({ - {t('cancel')} - - + {t('unlink')} - + ) diff --git a/services/web/frontend/js/features/settings/components/password-section.tsx b/services/web/frontend/js/features/settings/components/password-section.tsx index 228f3597a9..541ec4f583 100644 --- a/services/web/frontend/js/features/settings/components/password-section.tsx +++ b/services/web/frontend/js/features/settings/components/password-section.tsx @@ -9,12 +9,12 @@ import getMeta from '../../../utils/meta' import { ExposedSettings } from '../../../../../types/exposed-settings' import { PasswordStrengthOptions } from '../../../../../types/password-strength-options' import useAsync from '../../../shared/hooks/use-async' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' -import NotificationWrapper from '@/features/ui/components/bootstrap-5/wrappers/notification-wrapper' -import FormGroupWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-group-wrapper' -import FormLabelWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-label-wrapper' -import FormControlWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-control-wrapper' -import FormTextWrapper from '@/features/ui/components/bootstrap-5/wrappers/form-text-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' +import OLNotification from '@/features/ui/components/ol/ol-notification' +import OLFormGroup from '@/features/ui/components/ol/ol-form-group' +import OLFormLabel from '@/features/ui/components/ol/ol-form-label' +import OLFormControl from '@/features/ui/components/ol/ol-form-control' +import OLFormText from '@/features/ui/components/ol/ol-form-text' type PasswordUpdateResult = { message?: { @@ -159,13 +159,13 @@ function PasswordForm() { autoComplete="new-password" /> {isSuccess && data?.message?.text ? ( - - - + + + ) : null} {isError ? ( - - + - + ) : null} - {t('change')} - + ) } @@ -255,9 +255,9 @@ function PasswordFormGroup({ ) return ( - - {label} - + {label} + {isInvalid && ( - + {parentValidationMessage || validationMessage} - + )} - + ) } diff --git a/services/web/frontend/js/features/settings/components/root.tsx b/services/web/frontend/js/features/settings/components/root.tsx index b03814296b..170044dcb2 100644 --- a/services/web/frontend/js/features/settings/components/root.tsx +++ b/services/web/frontend/js/features/settings/components/root.tsx @@ -20,9 +20,9 @@ import useWaitForI18n from '../../../shared/hooks/use-wait-for-i18n' import useScrollToIdOnLoad from '../../../shared/hooks/use-scroll-to-id-on-load' import { ExposedSettings } from '../../../../../types/exposed-settings' import { SSOAlert } from './emails/sso-alert' -import RowWrapper from '@/features/ui/components/bootstrap-5/wrappers/row-wrapper' -import ColWrapper from '@/features/ui/components/bootstrap-5/wrappers/col-wrapper' -import CardWrapper from '@/features/ui/components/bootstrap-5/wrappers/card-wrapper' +import OLRow from '@/features/ui/components/ol/ol-row' +import OLCol from '@/features/ui/components/ol/ol-col' +import OLCard from '@/features/ui/components/ol/ol-card' function SettingsPageRoot() { const { isReady } = useWaitForI18n() @@ -34,11 +34,11 @@ function SettingsPageRoot() { return (

- - + + {isReady ? : null} - - + +
) } @@ -51,7 +51,7 @@ function SettingsPageContent() { return ( - +

{t('account_settings')}

@@ -59,14 +59,14 @@ function SettingsPageContent() { - - + + - - + + - - + +
@@ -96,7 +96,7 @@ function SettingsPageContent() { ) : null}
- + ) } diff --git a/services/web/frontend/js/features/settings/components/security-section.tsx b/services/web/frontend/js/features/settings/components/security-section.tsx index 34394f6848..9e5dc098db 100644 --- a/services/web/frontend/js/features/settings/components/security-section.tsx +++ b/services/web/frontend/js/features/settings/components/security-section.tsx @@ -2,7 +2,7 @@ import MaterialIcon from '@/shared/components/material-icon' import { Trans, useTranslation } from 'react-i18next' import { GroupSSOLinkingStatus } from '../../../../../types/subscription/sso' import getMeta from '../../../utils/meta' -import ButtonWrapper from '@/features/ui/components/bootstrap-5/wrappers/button-wrapper' +import OLButton from '@/features/ui/components/ol/ol-button' function SecuritySection() { const { t } = useTranslation() @@ -85,13 +85,13 @@ function SecuritySection() {
{linked ? null : (
- {t('set_up_sso')} - +
)}
diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-control-wrapper.tsx b/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-control-wrapper.tsx deleted file mode 100644 index 6ad6da4b61..0000000000 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-control-wrapper.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { forwardRef } from 'react' -import { Form } from 'react-bootstrap-5' -import { FormControl as BS3FormControl } from 'react-bootstrap' -import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' - -type FormControlWrapperProps = React.ComponentProps< - (typeof Form)['Control'] -> & { - bs3Props?: Record -} - -const FormControlWrapper = forwardRef< - HTMLInputElement, - FormControlWrapperProps ->((props, ref) => { - const { bs3Props, ...rest } = props - - let bs3FormControlProps: React.ComponentProps = { - id: rest.id, - className: rest.className, - style: rest.style, - type: rest.type, - value: rest.value, - required: rest.required, - disabled: rest.disabled, - placeholder: rest.placeholder, - readOnly: rest.readOnly, - autoComplete: rest.autoComplete, - minLength: rest.minLength, - maxLength: rest.maxLength, - onChange: rest.onChange as (e: React.ChangeEvent) => void, - onKeyDown: rest.onKeyDown as (e: React.KeyboardEvent) => void, - onFocus: rest.onFocus as (e: React.FocusEvent) => void, - onInvalid: rest.onInvalid as (e: React.InvalidEvent) => void, - inputRef: (inputElement: HTMLInputElement) => { - if (typeof ref === 'function') { - ref(inputElement) - } else if (ref) { - ref.current = inputElement - } - }, - ...bs3Props, - } - - // get all `aria-*` and `data-*` attributes - const extraProps = Object.entries(rest).reduce( - (acc, [key, value]) => { - if (key.startsWith('aria-') || key.startsWith('data-')) { - acc[key] = value - } - return acc - }, - {} as Record - ) - - bs3FormControlProps = { - ...bs3FormControlProps, - ...extraProps, - 'data-ol-dirty': rest['data-ol-dirty'], - } as typeof bs3FormControlProps & Record - - return ( - } - bs5={} - /> - ) -}) -FormControlWrapper.displayName = 'FormControlWrapper' - -export default FormControlWrapper diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/badge-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-badge.tsx similarity index 86% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/badge-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-badge.tsx index 547d88fbf5..a30e6f08cb 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/badge-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-badge.tsx @@ -3,13 +3,13 @@ import Badge from '@/features/ui/components/bootstrap-5/badge' import BS3Badge from '@/shared/components/badge' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' -type BadgeWrapperProps = React.ComponentProps & { +type OLBadgeProps = React.ComponentProps & { bs3Props?: { bsStyle?: React.ComponentProps['bsStyle'] | null } } -function BadgeWrapper(props: BadgeWrapperProps) { +function OLBadge(props: OLBadgeProps) { const { bs3Props, ...rest } = props let bs3BadgeProps: React.ComponentProps = { @@ -38,4 +38,4 @@ function BadgeWrapper(props: BadgeWrapperProps) { ) } -export default BadgeWrapper +export default OLBadge diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/button-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-button.tsx similarity index 85% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/button-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-button.tsx index 0929e2f163..a6725f0d46 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/button-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-button.tsx @@ -1,10 +1,10 @@ -import BootstrapVersionSwitcher from '../bootstrap-version-switcher' +import BootstrapVersionSwitcher from '../bootstrap-5/bootstrap-version-switcher' import { Button as BS3Button } from 'react-bootstrap' import type { ButtonProps } from '@/features/ui/components/types/button-props' import type { ButtonProps as BS3ButtonPropsBase } from 'react-bootstrap' -import Button from '../button' +import Button from '../bootstrap-5/button' -export type ButtonWrapperProps = ButtonProps & { +export type OLButtonProps = ButtonProps & { bs3Props?: { bsStyle?: string | null className?: string @@ -23,7 +23,7 @@ export const mapBsButtonSizes = ( ): 'sm' | 'lg' | undefined => size === 'small' ? 'sm' : size === 'large' ? 'lg' : undefined -export default function ButtonWrapper(props: ButtonWrapperProps) { +export default function OLButton(props: OLButtonProps) { const { bs3Props, ...rest } = props const bs3ButtonProps: BS3ButtonProps = { diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/card-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-card.tsx similarity index 89% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/card-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-card.tsx index 11927f30ba..7af8dd54e8 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/card-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-card.tsx @@ -5,7 +5,7 @@ import { FC } from 'react' // This wraps the Bootstrap 5 Card component but is restricted to the very // basic way we're using it, which is as a container for page content. The // Bootstrap 3 equivalent in our codebase is a div with class "card" -const CardWrapper: FC = ({ children }) => { +const OLCard: FC = ({ children }) => { return ( {children}
} @@ -18,4 +18,4 @@ const CardWrapper: FC = ({ children }) => { ) } -export default CardWrapper +export default OLCard diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/col-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-col.tsx similarity index 88% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/col-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-col.tsx index 56066a76fd..7e617fcea4 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/col-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-col.tsx @@ -2,11 +2,11 @@ import { Col } from 'react-bootstrap-5' import { Col as BS3Col } from 'react-bootstrap' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' -type ColWrapperProps = React.ComponentProps & { +type OLColProps = React.ComponentProps & { bs3Props?: Record } -function ColWrapper(props: ColWrapperProps) { +function OLCol(props: OLColProps) { const { bs3Props, ...rest } = props const sizes = new Set(['xs', 'sm', 'md', 'lg', 'xl', 'xxl']) @@ -42,4 +42,4 @@ function ColWrapper(props: ColWrapperProps) { ) } -export default ColWrapper +export default OLCol diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-checkbox-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-form-checkbox.tsx similarity index 81% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-checkbox-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-form-checkbox.tsx index 3954a8c697..b10a368788 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-checkbox-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-form-checkbox.tsx @@ -2,11 +2,11 @@ import { Form } from 'react-bootstrap-5' import { Checkbox as BS3Checkbox } from 'react-bootstrap' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' -type FormCheckboxWrapperProps = React.ComponentProps<(typeof Form)['Check']> & { +type OLFormCheckboxProps = React.ComponentProps<(typeof Form)['Check']> & { bs3Props?: Record } -function FormCheckboxWrapper(props: FormCheckboxWrapperProps) { +function OLFormCheckbox(props: OLFormCheckboxProps) { const { bs3Props, ...rest } = props const bs3FormLabelProps: React.ComponentProps = { @@ -29,4 +29,4 @@ function FormCheckboxWrapper(props: FormCheckboxWrapperProps) { ) } -export default FormCheckboxWrapper +export default OLFormCheckbox diff --git a/services/web/frontend/js/features/ui/components/ol/ol-form-control.tsx b/services/web/frontend/js/features/ui/components/ol/ol-form-control.tsx new file mode 100644 index 0000000000..4d1dc7616a --- /dev/null +++ b/services/web/frontend/js/features/ui/components/ol/ol-form-control.tsx @@ -0,0 +1,68 @@ +import { forwardRef } from 'react' +import { Form } from 'react-bootstrap-5' +import { FormControl as BS3FormControl } from 'react-bootstrap' +import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' + +type OLFormControlProps = React.ComponentProps<(typeof Form)['Control']> & { + bs3Props?: Record +} + +const OLFormControl = forwardRef( + (props, ref) => { + const { bs3Props, ...rest } = props + + let bs3FormControlProps: React.ComponentProps = { + id: rest.id, + className: rest.className, + style: rest.style, + type: rest.type, + value: rest.value, + required: rest.required, + disabled: rest.disabled, + placeholder: rest.placeholder, + readOnly: rest.readOnly, + autoComplete: rest.autoComplete, + minLength: rest.minLength, + maxLength: rest.maxLength, + onChange: rest.onChange as (e: React.ChangeEvent) => void, + onKeyDown: rest.onKeyDown as (e: React.KeyboardEvent) => void, + onFocus: rest.onFocus as (e: React.FocusEvent) => void, + onInvalid: rest.onInvalid as (e: React.InvalidEvent) => void, + inputRef: (inputElement: HTMLInputElement) => { + if (typeof ref === 'function') { + ref(inputElement) + } else if (ref) { + ref.current = inputElement + } + }, + ...bs3Props, + } + + // get all `aria-*` and `data-*` attributes + const extraProps = Object.entries(rest).reduce( + (acc, [key, value]) => { + if (key.startsWith('aria-') || key.startsWith('data-')) { + acc[key] = value + } + return acc + }, + {} as Record + ) + + bs3FormControlProps = { + ...bs3FormControlProps, + ...extraProps, + 'data-ol-dirty': rest['data-ol-dirty'], + } as typeof bs3FormControlProps & Record + + return ( + } + bs5={} + /> + ) + } +) +OLFormControl.displayName = 'OLFormControl' + +export default OLFormControl diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-group-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-form-group.tsx similarity index 80% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-group-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-form-group.tsx index 3defd4ac9f..65ec53f85b 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-group-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-form-group.tsx @@ -2,11 +2,11 @@ import { Form } from 'react-bootstrap-5' import { FormGroup as BS3FormGroup } from 'react-bootstrap' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' -type FormGroupWrapperProps = React.ComponentProps<(typeof Form)['Group']> & { +type OLFormGroupProps = React.ComponentProps<(typeof Form)['Group']> & { bs3Props?: Record } -function FormGroupWrapper(props: FormGroupWrapperProps) { +function OLFormGroup(props: OLFormGroupProps) { const { bs3Props, className, ...rest } = props const classNames = className ?? 'mb-3' @@ -26,4 +26,4 @@ function FormGroupWrapper(props: FormGroupWrapperProps) { ) } -export default FormGroupWrapper +export default OLFormGroup diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-label-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-form-label.tsx similarity index 78% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-label-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-form-label.tsx index 3552fcd08e..4565936450 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-label-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-form-label.tsx @@ -2,11 +2,11 @@ import { Form } from 'react-bootstrap-5' import { ControlLabel as BS3FormLabel } from 'react-bootstrap' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' -type FormLabelWrapperProps = React.ComponentProps<(typeof Form)['Label']> & { +type OLFormLabelProps = React.ComponentProps<(typeof Form)['Label']> & { bs3Props?: Record } -function FormLabelWrapper(props: FormLabelWrapperProps) { +function OLFormLabel(props: OLFormLabelProps) { const { bs3Props, ...rest } = props const bs3FormLabelProps: React.ComponentProps = { @@ -24,4 +24,4 @@ function FormLabelWrapper(props: FormLabelWrapperProps) { ) } -export default FormLabelWrapper +export default OLFormLabel diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-text-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-form-text.tsx similarity index 85% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-text-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-form-text.tsx index 87d7de476c..ab09e31b4b 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/form-text-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-form-text.tsx @@ -5,11 +5,11 @@ import PolymorphicComponent from '@/shared/components/polymorphic-component' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' import classnames from 'classnames' -type FormTextWrapperProps = React.ComponentProps & { +type OLFormTextProps = React.ComponentProps & { bs3Props?: Record } -function FormTextWrapper(props: FormTextWrapperProps) { +function OLFormText(props: OLFormTextProps) { const { bs3Props, ...rest } = props const bs3HelpBlockProps = { @@ -35,4 +35,4 @@ function FormTextWrapper(props: FormTextWrapperProps) { ) } -export default FormTextWrapper +export default OLFormText diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/icon-button-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-icon-button.tsx similarity index 75% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/icon-button-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-icon-button.tsx index fd5899b297..25d261ef9a 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/icon-button-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-icon-button.tsx @@ -1,18 +1,18 @@ -import { BS3ButtonProps, mapBsButtonSizes } from './button-wrapper' +import { BS3ButtonProps, mapBsButtonSizes } from './ol-button' import { Button as BS3Button } from 'react-bootstrap' import type { IconButtonProps } from '@/features/ui/components/types/icon-button-props' -import BootstrapVersionSwitcher from '../bootstrap-version-switcher' +import BootstrapVersionSwitcher from '../bootstrap-5/bootstrap-version-switcher' import Icon, { IconProps } from '@/shared/components/icon' -import IconButton from '../icon-button' +import IconButton from '../bootstrap-5/icon-button' -export type IconButtonWrapperProps = IconButtonProps & { +export type OLIconButtonProps = IconButtonProps & { bs3Props?: { loading?: React.ReactNode fw?: IconProps['fw'] } } -export default function IconButtonWrapper(props: IconButtonWrapperProps) { +export default function OLIconButton(props: OLIconButtonProps) { const { bs3Props, ...rest } = props const { fw, ...filterBs3Props } = bs3Props || {} diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/ol-modal.tsx b/services/web/frontend/js/features/ui/components/ol/ol-modal.tsx similarity index 100% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/ol-modal.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-modal.tsx diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/notification-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-notification.tsx similarity index 85% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/notification-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-notification.tsx index ff23e8bb38..f3c8eb33cf 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/notification-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-notification.tsx @@ -3,14 +3,14 @@ import { Alert, AlertProps } from 'react-bootstrap' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' import classnames from 'classnames' -type NotificationWrapperProps = React.ComponentProps & { +type OLNotificationProps = React.ComponentProps & { bs3Props?: { icon?: React.ReactElement className?: string } } -function NotificationWrapper(props: NotificationWrapperProps) { +function OLNotification(props: OLNotificationProps) { const { bs3Props, ...notificationProps } = props const alertProps = { @@ -39,4 +39,4 @@ function NotificationWrapper(props: NotificationWrapperProps) { ) } -export default NotificationWrapper +export default OLNotification diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/row-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-row.tsx similarity index 73% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/row-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-row.tsx index fa5f09c77a..ef68a6887f 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/row-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-row.tsx @@ -2,9 +2,9 @@ import { Row } from 'react-bootstrap-5' import { Row as BS3Row } from 'react-bootstrap' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' -type RowWrapperProps = React.ComponentProps +type OLRowProps = React.ComponentProps -function RowWrapper(props: RowWrapperProps) { +function OLRow(props: OLRowProps) { return ( {props.children}} @@ -13,4 +13,4 @@ function RowWrapper(props: RowWrapperProps) { ) } -export default RowWrapper +export default OLRow diff --git a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/tooltip-wrapper.tsx b/services/web/frontend/js/features/ui/components/ol/ol-tooltip.tsx similarity index 86% rename from services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/tooltip-wrapper.tsx rename to services/web/frontend/js/features/ui/components/ol/ol-tooltip.tsx index 8a9dc92c9f..3104683049 100644 --- a/services/web/frontend/js/features/ui/components/bootstrap-5/wrappers/tooltip-wrapper.tsx +++ b/services/web/frontend/js/features/ui/components/ol/ol-tooltip.tsx @@ -2,11 +2,11 @@ import Tooltip from '@/features/ui/components/bootstrap-5/tooltip' import BS3Tooltip from '@/shared/components/tooltip' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' -type TooltipWrapperProps = React.ComponentProps & { +type OLTooltipProps = React.ComponentProps & { bs3Props?: Record } -function TooltipWrapper(props: TooltipWrapperProps) { +function OLTooltip(props: OLTooltipProps) { const { bs3Props, ...bs5Props } = props const bs3TooltipProps: React.ComponentProps = { @@ -38,4 +38,4 @@ function TooltipWrapper(props: TooltipWrapperProps) { ) } -export default TooltipWrapper +export default OLTooltip diff --git a/services/web/frontend/js/shared/components/badge.tsx b/services/web/frontend/js/shared/components/badge.tsx index a8e8e1aaec..78d0934367 100644 --- a/services/web/frontend/js/shared/components/badge.tsx +++ b/services/web/frontend/js/shared/components/badge.tsx @@ -1,6 +1,6 @@ import classnames from 'classnames' import { MergeAndOverride } from '../../../../types/utils' -import BadgeWrapper from '@/features/ui/components/bootstrap-5/wrappers/badge-wrapper' +import OLBadge from '@/features/ui/components/ol/ol-badge' type BadgeProps = MergeAndOverride< React.ComponentProps<'span'>, @@ -10,7 +10,7 @@ type BadgeProps = MergeAndOverride< closeBtnProps?: React.ComponentProps<'button'> className?: string bsStyle?: NonNullable< - React.ComponentProps['bs3Props'] + React.ComponentProps['bs3Props'] >['bsStyle'] } >