From 5bac779416f487e73874de8d91c8dde90c2a63a7 Mon Sep 17 00:00:00 2001 From: frozenhelium Date: Sat, 13 Jun 2026 09:20:20 +0545 Subject: [PATCH 1/5] feat(ui)!: restructure go-ui around layer model and token specs BREAKING CHANGE: major API overhaul of @ifrc-go/ui (v3). - specs: replace runtime useSpacingToken with static utility classes + pure resolvers; add textSize/backgroundColor/borderRadius/boxShadow specs with full scales, Extract<> narrowing, and clamped offsets - variants: curated `variant` on Button/ConfirmButton/IconButton; Alert.type and ProgressBar.colorVariant -> variant; `variant` -> `styleVariant` on generic components - props: background/shadow booleans -> backgroundColor/boxShadow tokens; containerRef -> elementRef; unify duplicated textSize scales - structural: add generic RawOutput adapter (TextOutput/KeyFigure rebuilt on it); KeyFigureView -> KeyFigureCard; split RawFileInput into headless primitive + FileInputButton; remove List - migrate all app + storybook consumers; add CONTRIBUTING/MIGRATION docs See packages/ui/MIGRATION.md for call-site rewrites. --- .changeset/gold-llamas-restructure.md | 13 + app/src/App/PageError/index.tsx | 2 +- .../components/CatalogueInfoCard/index.tsx | 4 +- app/src/components/DropdownMenuItem/i18n.json | 9 + app/src/components/DropdownMenuItem/index.tsx | 157 ++++++++- .../DropdownMenuItem/styles.module.css | 3 + app/src/components/GoMapContainer/index.tsx | 6 +- app/src/components/Link/index.tsx | 1 - app/src/components/MapPopup/index.tsx | 4 +- .../components/MultiSelectOutput/index.tsx | 2 +- .../AuthenticatedUserDropdown/index.tsx | 3 +- .../Navbar/CountryDropdown/index.tsx | 5 +- .../Navbar/LanguageDropdown/index.tsx | 2 +- .../Navbar/NavDropdownMenu/index.tsx | 3 +- .../Navbar/NavDropdownTabDetails/index.tsx | 2 +- app/src/components/Navbar/index.tsx | 1 - app/src/components/NavigationTab/index.tsx | 1 - app/src/components/SelectOutput/index.tsx | 2 +- .../components/domain/Admin2Input/index.tsx | 2 +- .../PointDetails/index.tsx | 2 +- .../DistrictSearchMultiSelectInput/index.tsx | 2 +- .../domain/EapIndicatorListInput/index.tsx | 2 +- .../TimeSpanCheck/index.tsx | 6 +- .../EapOperationActivityListInput/index.tsx | 2 +- .../domain/GoMultiFileInput/index.tsx | 13 +- .../domain/GoSingleFileInput/index.tsx | 11 +- .../OperationCard/index.tsx | 8 +- .../domain/ImminentEventListItem/index.tsx | 4 +- .../domain/KeywordSearchSelectInput/index.tsx | 2 +- .../MultiImageWithCaptionInput/index.tsx | 2 +- .../domain/OperationListItem/index.tsx | 2 +- .../domain/PerAssessmentSummary/index.tsx | 2 +- .../domain/RegionKeyFigures/index.tsx | 38 ++- .../LayerOptions/index.tsx | 8 +- .../domain/RiskImminentEventMap/index.tsx | 4 +- .../Gdacs/EventDetails/index.tsx | 16 +- .../Pdc/EventDetails/index.tsx | 18 +- .../domain/RiskImminentEvents/index.tsx | 2 +- .../RiskSeasonalMap/CountryListItem/index.tsx | 2 +- .../domain/RiskSeasonalMap/index.tsx | 6 +- .../components/domain/ShareUserItem/index.tsx | 2 +- .../domain/SourceInformationInput/index.tsx | 2 +- .../domain/SurgeCatalogueContainer/index.tsx | 2 +- .../printable/PrintableDataDisplay/index.tsx | 6 +- .../AccountDetails/ChangePassword/index.tsx | 2 +- .../AccountDetails/EditAccountInfo/index.tsx | 2 +- .../GenerateMontandonTokenModal/index.tsx | 2 +- .../AccountDetails/TokenDetails/index.tsx | 4 +- app/src/views/AccountDetails/index.tsx | 2 +- app/src/views/AccountMyFormsDref/index.tsx | 4 +- .../AccountMyFormsEap/EapStatus/index.tsx | 21 +- .../EapTableActions/BudgetFileInput/index.tsx | 6 +- .../EapTableActions/index.tsx | 28 +- .../EapTableActions/styles.module.css | 3 + .../SubscriptionModal/index.tsx | 6 +- .../EmailPreferences/index.tsx | 8 +- .../SubscriptionPreferences/index.tsx | 1 - .../ActiveSurgeSupport/SurgeCard/index.tsx | 8 +- app/src/views/CountryAdditionalInfo/index.tsx | 41 ++- .../InitiativeCard/index.tsx | 4 +- .../OCACListItem/index.tsx | 8 +- .../CountryNsCapacityStrengthening/index.tsx | 6 +- .../views/CountryNsOverviewCapacity/index.tsx | 4 +- .../NationalSocietyIndicators/index.tsx | 6 +- .../DocumentListCard/index.tsx | 4 +- .../SwitchWithConfirmation/index.tsx | 4 +- .../LocalUnitImportModal/index.tsx | 12 +- .../LocalUnitImportSummary/index.tsx | 7 +- .../OtherProfilesDiffOutput/index.tsx | 10 +- .../LocalUnitView/index.tsx | 96 +++--- .../LocalUnitsExportModal/index.tsx | 2 +- .../HealthFields/index.tsx | 6 +- .../LocalUnitsMap/index.tsx | 6 +- .../NationalSocietyLocalUnits/index.tsx | 2 +- .../index.tsx | 30 +- .../Presence/index.tsx | 8 +- .../CountryKeyFigures/index.tsx | 32 +- .../DocumentCard/index.tsx | 2 +- .../PrivateCountryPreparedness/index.tsx | 12 +- .../PublicCountryPreparedness/index.tsx | 2 +- .../CountryHistoricalKeyFigures/index.tsx | 32 +- .../views/CountryProfileRiskWatch/index.tsx | 4 +- .../DrefApplicationExport/PgaExport/index.tsx | 4 +- app/src/views/DrefApplicationExport/index.tsx | 2 +- .../Actions/NSActionInput/index.tsx | 2 +- .../Actions/NeedInput/index.tsx | 2 +- .../DrefApplicationForm/Actions/index.tsx | 2 +- .../DrefImportModal/index.tsx | 6 +- .../IndicatorInput/index.tsx | 2 +- .../ActivitiesInput/index.tsx | 2 +- .../Operation/RiskSecurityInput/index.tsx | 2 +- .../DrefApplicationForm/Operation/index.tsx | 4 +- app/src/views/DrefFinalReportExport/index.tsx | 5 +- .../Actions/NeedInput/index.tsx | 2 +- .../Operation/InterventionInput/index.tsx | 2 +- .../ActivitiesInput/index.tsx | 2 +- .../Operation/RiskSecurityInput/index.tsx | 2 +- .../DrefOperationalUpdateExport/index.tsx | 5 +- .../Actions/NeedInput/index.tsx | 2 +- .../ObsoletePayloadModal/index.tsx | 1 - .../IndicatorInput/index.tsx | 2 +- .../Operation/InterventionInput/index.tsx | 2 +- .../Operation/RiskSecurityInput/index.tsx | 2 +- .../Operation/index.tsx | 2 - .../EapActivationProcess/index.tsx | 2 +- .../EapFullForm/FinanceLogistics/index.tsx | 6 +- app/src/views/EapFullForm/Meal/index.tsx | 2 +- .../NationalSocietyCapacity/index.tsx | 2 +- app/src/views/EapFullForm/Overview/index.tsx | 12 +- .../PrioritisedImpactInput/index.tsx | 1 - .../views/EapFullForm/RiskAnalysis/index.tsx | 3 +- .../ApproachesInput/index.tsx | 4 +- .../SelectionActions/OperationInput/index.tsx | 4 +- .../EapFullForm/SelectionActions/index.tsx | 6 +- .../views/EapFullForm/TriggerModel/index.tsx | 4 +- app/src/views/EapFullForm/index.tsx | 6 +- app/src/views/EapRegistration/index.tsx | 6 +- .../DeliveryAndBudget/index.tsx | 4 +- .../EapSimplifiedForm/EarlyAction/index.tsx | 4 +- .../ApproachesInput/index.tsx | 4 +- .../EnablingApproaches/index.tsx | 2 +- .../EapSimplifiedForm/Overview/index.tsx | 10 +- .../OperationsInput/index.tsx | 4 +- .../PlannedOperations/index.tsx | 2 +- .../EapSimplifiedForm/RiskAnalysis/index.tsx | 4 +- app/src/views/EapSimplifiedForm/index.tsx | 4 +- app/src/views/Emergencies/index.tsx | 18 +- app/src/views/Emergency/index.tsx | 14 +- .../ActivityActions/index.tsx | 2 +- .../ActivityDetail/index.tsx | 8 +- app/src/views/EmergencyActivities/index.tsx | 18 +- app/src/views/EmergencyDetails/index.tsx | 10 +- .../EmergencyReportAndDocument/index.tsx | 8 +- app/src/views/EmergencySurge/index.tsx | 14 +- app/src/views/EruReadinessForm/index.tsx | 2 +- .../FieldReportForm/ActionsFields/index.tsx | 2 +- .../FieldReportForm/SituationFields/index.tsx | 2 +- app/src/views/FlashUpdateDetails/index.tsx | 4 +- .../ContextTab/CountryProvinceInput/index.tsx | 1 - .../ContextTab/ReferenceInput/index.tsx | 1 - .../FlashUpdateForm/ContextTab/index.tsx | 2 +- app/src/views/Home/index.tsx | 32 +- app/src/views/MontandonLandingPage/index.tsx | 14 +- .../views/OldDrefFinalReportExport/index.tsx | 5 +- .../Actions/NeedInput/index.tsx | 2 +- .../Operation/InterventionInput/index.tsx | 2 +- .../Operation/RiskSecurityInput/index.tsx | 2 +- .../OperationalLearning/KeyInsights/index.tsx | 2 +- .../AllExtractsModal/Extract/index.tsx | 2 +- .../Sources/Emergency/index.tsx | 2 +- .../views/OperationalLearning/Stats/index.tsx | 30 +- .../OperationalLearning/Summary/index.tsx | 2 +- .../ComponentInput/QuestionInput/index.tsx | 2 +- .../AreaInput/ComponentInput/index.tsx | 2 +- app/src/views/PerExport/index.tsx | 2 +- .../ComponentInput/QuestionOutput/index.tsx | 7 +- .../ComponentInput/index.tsx | 4 +- app/src/views/PerPrioritizationForm/index.tsx | 2 +- .../AdditionalActionInput/index.tsx | 4 +- .../PrioritizedActionInput/index.tsx | 2 +- app/src/views/PerWorkPlanForm/index.tsx | 2 +- app/src/views/RegionAdditionalInfo/index.tsx | 6 +- app/src/views/RegionPreparedness/index.tsx | 32 +- app/src/views/RegionProfile/index.tsx | 14 +- app/src/views/Resources/VideoList/index.tsx | 2 +- app/src/views/Resources/index.tsx | 20 +- app/src/views/RootLayout/index.tsx | 2 +- app/src/views/Search/ResultList/index.tsx | 2 +- app/src/views/Search/index.tsx | 8 +- app/src/views/Surge/index.tsx | 18 +- .../views/SurgeOperationalToolbox/index.tsx | 4 +- .../EmergencyResponseUnitCard/index.tsx | 6 +- .../EruReadinessList/index.tsx | 2 +- .../NationalSocietyCard/index.tsx | 6 +- .../RapidResponsePersonnel/index.tsx | 8 +- .../ActivityInput/ActionSupplyInput/index.tsx | 1 - .../CustomSuppliesInput/index.tsx | 1 - .../DisaggregationInput/index.tsx | 84 ++--- .../ActivityInput/PointInput/index.tsx | 1 - .../ActivityInput/index.tsx | 4 +- .../ActivitiesBySectorInput/index.tsx | 4 +- app/src/views/ThreeWActivityForm/index.tsx | 2 +- .../src/stories/Alert.stories.tsx | 10 +- .../src/stories/Button.stories.tsx | 304 +++--------------- .../src/stories/ButtonLayout.stories.ts | 32 ++ .../src/stories/ConfirmButton.stories.tsx | 15 +- .../src/stories/Container.stories.tsx | 6 +- ...tories.tsx => FileInputButton.stories.tsx} | 24 +- .../src/stories/FileInputButton.tsx | 14 + .../src/stories/IconButton.stories.tsx | 27 +- .../src/stories/InputContainer.stories.tsx | 10 +- .../src/stories/InputSection.stories.tsx | 2 +- ....stories.tsx => KeyFigureCard.stories.tsx} | 11 +- .../src/stories/KeyFigureCard.tsx | 12 + .../src/stories/KeyFigureView.tsx | 12 - .../src/stories/List.stories.tsx | 94 ------ packages/go-ui-storybook/src/stories/List.tsx | 20 -- .../src/stories/Modal.stories.tsx | 4 +- .../src/stories/Progressbar.stories.ts | 8 +- .../src/stories/RadioInput.tsx | 2 +- .../src/stories/RawFileInput.tsx | 14 - .../src/stories/SegmentInput.tsx | 6 +- .../src/stories/TextInput.stories.tsx | 4 +- packages/ui/CONTRIBUTING.md | 66 +++- packages/ui/MIGRATION.md | 74 +++++ packages/ui/README.md | 30 +- packages/ui/src/components/Alert/index.tsx | 73 +++-- .../ui/src/components/Alert/styles.module.css | 5 + .../src/components/AlertContainer/index.tsx | 2 +- .../ui/src/components/BlockLoading/index.tsx | 7 + .../ui/src/components/BlockView/index.tsx | 11 +- .../ui/src/components/BooleanInput/index.tsx | 3 + packages/ui/src/components/Button/index.tsx | 78 +++-- .../ui/src/components/ButtonLayout/index.tsx | 34 +- .../components/ButtonLayout/styles.module.css | 18 +- packages/ui/src/components/Checkbox/index.tsx | 27 +- .../src/components/Checkbox/styles.module.css | 10 +- .../ui/src/components/Checklist/index.tsx | 21 +- packages/ui/src/components/Chip/index.tsx | 7 + .../ui/src/components/ConfirmButton/index.tsx | 12 +- .../ui/src/components/Container/index.tsx | 55 +++- .../components/Container/styles.module.css | 19 +- .../ui/src/components/DateInput/index.tsx | 7 + .../src/components/DefaultMessage/index.tsx | 6 + .../ui/src/components/Description/index.tsx | 19 +- .../components/Description/styles.module.css | 16 - .../ui/src/components/DropdownMenu/index.tsx | 22 +- .../components/ExpandableContainer/index.tsx | 11 +- .../src/components/FileInputButton/index.tsx | 87 +++++ packages/ui/src/components/Heading/index.tsx | 18 +- .../ui/src/components/IconButton/index.tsx | 43 +-- .../components/IconButton/styles.module.css | 93 +----- .../ui/src/components/InfoPopup/index.tsx | 8 +- .../ui/src/components/InlineFrame/index.tsx | 9 + .../ui/src/components/InlineLayout/index.tsx | 11 +- .../ui/src/components/InlineView/index.tsx | 6 + .../src/components/InputContainer/index.tsx | 47 +-- .../ui/src/components/InputSection/index.tsx | 15 +- .../ui/src/components/KeyFigure/index.tsx | 110 ++----- .../components/KeyFigure/styles.module.css | 18 -- .../index.tsx | 24 +- .../styles.module.css | 2 +- packages/ui/src/components/Label/index.tsx | 25 +- .../ui/src/components/Label/styles.module.css | 12 - packages/ui/src/components/List/index.tsx | 95 ------ .../ui/src/components/List/styles.module.css | 12 - packages/ui/src/components/ListView/index.tsx | 32 +- .../src/components/ListView/styles.module.css | 9 +- packages/ui/src/components/Message/index.tsx | 11 +- packages/ui/src/components/Modal/index.tsx | 7 +- .../ui/src/components/NumberInput/index.tsx | 7 + packages/ui/src/components/Pager/index.tsx | 5 +- .../ui/src/components/PasswordInput/index.tsx | 12 +- .../ui/src/components/ProgressBar/index.tsx | 43 ++- .../components/ProgressBar/styles.module.css | 12 +- .../ui/src/components/RadioInput/index.tsx | 21 +- .../ui/src/components/RawFileInput/index.tsx | 43 ++- .../components/RawFileInput/styles.module.css | 2 +- .../ui/src/components/RawOutput/index.tsx | 98 ++++++ .../ui/src/components/SegmentInput/index.tsx | 8 +- .../components/SelectInputContainer/index.tsx | 61 ++-- .../components/StackedProgressBar/index.tsx | 7 + packages/ui/src/components/Switch/index.tsx | 4 + .../ui/src/components/TabLayout/index.tsx | 4 +- .../ColumnShortcuts/ExpandButton/index.tsx | 7 +- .../components/Table/ColumnShortcuts/index.ts | 2 +- .../src/components/Table/HeaderCell/index.tsx | 8 +- .../components/Table/TableActions/index.tsx | 9 +- packages/ui/src/components/Tabs/Tab/index.tsx | 9 +- packages/ui/src/components/TextArea/index.tsx | 16 +- .../ui/src/components/TextBadge/index.tsx | 6 + .../ui/src/components/TextInput/index.tsx | 7 + .../ui/src/components/TextOutput/index.tsx | 119 +++---- .../components/TextOutput/styles.module.css | 22 -- .../ui/src/components/TopBanner/index.tsx | 14 +- .../components/printable/TextOutput/index.tsx | 92 ++---- .../printable/TextOutput/styles.module.css | 5 - packages/ui/src/hooks/index.tsx | 1 - packages/ui/src/hooks/useSpacingToken.ts | 75 ----- packages/ui/src/index.css | 3 + packages/ui/src/index.tsx | 10 +- packages/ui/src/utils/inputs.ts | 7 +- packages/ui/src/utils/specs.module.css | 233 ++++++++++++++ packages/ui/src/utils/style.ts | 239 ++++++++++++-- 284 files changed, 2558 insertions(+), 2042 deletions(-) create mode 100644 .changeset/gold-llamas-restructure.md create mode 100644 app/src/components/DropdownMenuItem/i18n.json create mode 100644 app/src/components/DropdownMenuItem/styles.module.css create mode 100644 app/src/views/AccountMyFormsEap/EapTableActions/styles.module.css rename packages/go-ui-storybook/src/stories/{RawFileInput.stories.tsx => FileInputButton.stories.tsx} (69%) create mode 100644 packages/go-ui-storybook/src/stories/FileInputButton.tsx rename packages/go-ui-storybook/src/stories/{KeyFigureView.stories.tsx => KeyFigureCard.stories.tsx} (80%) create mode 100644 packages/go-ui-storybook/src/stories/KeyFigureCard.tsx delete mode 100644 packages/go-ui-storybook/src/stories/KeyFigureView.tsx delete mode 100644 packages/go-ui-storybook/src/stories/List.stories.tsx delete mode 100644 packages/go-ui-storybook/src/stories/List.tsx delete mode 100644 packages/go-ui-storybook/src/stories/RawFileInput.tsx create mode 100644 packages/ui/MIGRATION.md create mode 100644 packages/ui/src/components/FileInputButton/index.tsx rename packages/ui/src/components/{KeyFigureView => KeyFigureCard}/index.tsx (77%) rename packages/ui/src/components/{KeyFigureView => KeyFigureCard}/styles.module.css (88%) delete mode 100644 packages/ui/src/components/List/index.tsx delete mode 100644 packages/ui/src/components/List/styles.module.css create mode 100644 packages/ui/src/components/RawOutput/index.tsx delete mode 100644 packages/ui/src/hooks/useSpacingToken.ts create mode 100644 packages/ui/src/utils/specs.module.css diff --git a/.changeset/gold-llamas-restructure.md b/.changeset/gold-llamas-restructure.md new file mode 100644 index 0000000000..48437d668b --- /dev/null +++ b/.changeset/gold-llamas-restructure.md @@ -0,0 +1,13 @@ +--- +"@ifrc-go/ui": major +--- + +Restructure the library around a declared component layer model (raw → generic → specific) and token specs. + +- **Token specs**: `textSize`, `backgroundColor`, `borderRadius` and `boxShadow` join `spacing` as token-valued props resolved through static utility classes (no more runtime style injection; `useSpacingToken` is replaced by the pure `getSpacingClassName`). Ordinal specs support offsets. +- **Variant model**: generic components keep the two-axis `colorVariant` + `styleVariant` API; specific components expose a single curated `variant` (`Button`: `primary`/`secondary`/`tertiary`/`subtle`; `Alert`'s `type` and `ProgressBar`'s `colorVariant` are renamed to `variant`). +- **Boolean→token conversions**: `withBackground`/`withDarkBackground`/`withLightBackground` → `backgroundColor`; `withShadow`/`withoutShadow` → `boxShadow`. +- **Naming**: `variant` → `styleVariant` on Container/InputContainer/Heading; `containerRef` → `elementRef`; `layoutElementRef` removed. +- **Structural**: new generic `RawOutput` value-rendering adapter (TextOutput and KeyFigure rebuilt on it); `KeyFigureView` → `KeyFigureCard`; `RawFileInput` split into a headless primitive plus the new `FileInputButton`; `List` removed in favor of `ListView` + `RawList` + `DefaultMessage`. + +See `packages/ui/MIGRATION.md` for exact call-site rewrites. diff --git a/app/src/App/PageError/index.tsx b/app/src/App/PageError/index.tsx index 8c6d836bc7..41f190299e 100644 --- a/app/src/App/PageError/index.tsx +++ b/app/src/App/PageError/index.tsx @@ -58,7 +58,7 @@ function PageError() { diff --git a/app/src/components/CatalogueInfoCard/index.tsx b/app/src/components/CatalogueInfoCard/index.tsx index c0bbe6a0be..4b78b818d1 100644 --- a/app/src/components/CatalogueInfoCard/index.tsx +++ b/app/src/components/CatalogueInfoCard/index.tsx @@ -58,8 +58,8 @@ function CatalogueInfoCard(props: Props) { withHeaderBorder headerDescription={description} withPadding - withBackground - withShadow + backgroundColor="foreground" + boxShadow="md" > = Omit, 'type'> & { +type ButtonTypeProps = Omit, 'type' | 'variant' | 'withFullWidth'> & { type: 'button'; } @@ -27,7 +35,7 @@ type LinkTypeProps = LinkProps & { onClick?: never; } -type ConfirmButtonTypeProps = Omit, 'type'> & { +type ConfirmButtonTypeProps = Omit, 'type' | 'variant' | 'withFullWidth'> & { type: 'confirm-button', } @@ -43,7 +51,13 @@ function DropdownMenuItem(props: Props) { ...remainingProps } = props; + const strings = useTranslation(i18n); const { setShowDropdown } = useContext(DropdownMenuContext); + const [showConfirmation, setShowConfirmation] = useState(false); + + const onConfirm = remainingProps.type === 'confirm-button' + ? remainingProps.onConfirm + : undefined; const handleLinkClick = useCallback( () => { @@ -70,6 +84,24 @@ function DropdownMenuItem(props: Props) { [setShowDropdown, persist, onClick, remainingProps.type], ); + const handleConfirmButtonClick = useCallback( + (name: NAME, e: React.MouseEvent) => { + handleButtonClick(name, e); + setShowConfirmation(true); + }, + [handleButtonClick], + ); + + const handleConfirmClick = useCallback( + (name: NAME) => { + setShowConfirmation(false); + if (isDefined(onConfirm)) { + onConfirm(name); + } + }, + [onConfirm], + ); + if (remainingProps.type === 'link') { const { // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -98,18 +130,47 @@ function DropdownMenuItem(props: Props) { const { // eslint-disable-next-line @typescript-eslint/no-unused-vars type: _, - styleVariant = 'transparent', + after, + before, + children, + className, + disabled, + elementRef, + spacing, + spacingOffset = -3, + textSize, + withoutPadding, ...otherProps } = remainingProps; + // NOTE: composing RawButton + ButtonLayout to preserve the old + // (text, transparent) menu item look, which is not in Button's + // curated variant set return ( - + + + )} + > + {confirmMessage} + + )} + ); } } diff --git a/app/src/components/DropdownMenuItem/styles.module.css b/app/src/components/DropdownMenuItem/styles.module.css new file mode 100644 index 0000000000..78085f2a26 --- /dev/null +++ b/app/src/components/DropdownMenuItem/styles.module.css @@ -0,0 +1,3 @@ +.menu-item { + display: contents; +} diff --git a/app/src/components/GoMapContainer/index.tsx b/app/src/components/GoMapContainer/index.tsx index 7ba28d6d48..c81d4ee559 100644 --- a/app/src/components/GoMapContainer/index.tsx +++ b/app/src/components/GoMapContainer/index.tsx @@ -184,8 +184,8 @@ function GoMapContainer(props: Props) { {printMode && ( @@ -339,7 +339,7 @@ function GoMapContainer(props: Props) { {footer} diff --git a/app/src/components/Link/index.tsx b/app/src/components/Link/index.tsx index 4e8b84eb50..0ecf5f7561 100644 --- a/app/src/components/Link/index.tsx +++ b/app/src/components/Link/index.tsx @@ -105,7 +105,6 @@ function Link(props: Props) { const content = ( @@ -62,7 +62,7 @@ function MapPopup(props: Props) { diff --git a/app/src/views/AccountDetails/EditAccountInfo/index.tsx b/app/src/views/AccountDetails/EditAccountInfo/index.tsx index 7c532b1291..2fe970ea75 100644 --- a/app/src/views/AccountDetails/EditAccountInfo/index.tsx +++ b/app/src/views/AccountDetails/EditAccountInfo/index.tsx @@ -224,7 +224,7 @@ function EditAccountInfo(props: Props) { name={undefined} onClick={handleFormSubmit} disabled={updateAccountPending} - styleVariant="filled" + variant="primary" > {strings.editProfileConfirmButtonLabel} diff --git a/app/src/views/AccountDetails/GenerateMontandonTokenModal/index.tsx b/app/src/views/AccountDetails/GenerateMontandonTokenModal/index.tsx index f2a5308eaf..3a35a98335 100644 --- a/app/src/views/AccountDetails/GenerateMontandonTokenModal/index.tsx +++ b/app/src/views/AccountDetails/GenerateMontandonTokenModal/index.tsx @@ -101,7 +101,7 @@ function GenerateMontandonTokenModal(props: Props) { onClick={handleAcceptAndGenerateClick} disabled={isNotDefined(tokenTitle) || tokenTitle.trim().length < MIN_TITLE_LENGTH} - styleVariant="filled" + variant="primary" > {strings.acceptButtonLabel} diff --git a/app/src/views/AccountDetails/TokenDetails/index.tsx b/app/src/views/AccountDetails/TokenDetails/index.tsx index 3be3f919c6..fe49909eb2 100644 --- a/app/src/views/AccountDetails/TokenDetails/index.tsx +++ b/app/src/views/AccountDetails/TokenDetails/index.tsx @@ -46,7 +46,7 @@ function TokenDetails(props: Props) { headerActions={isDefined(data?.token) && ( + } + withoutPadding + > + {strings.additionalFilesButtonLabel} + + )} {isDefined(details?.data.version) && details.data.version > 1 @@ -289,7 +297,7 @@ function EapTableActions(props: Props) { name onClick={setShowExportModalTrue} before={} - styleVariant="action" + variant="tertiary" > {resolveToString( strings.exportWithChangesButtonLabel, @@ -468,7 +476,7 @@ function EapTableActions(props: Props) { name={false} onClick={setShowExportModalTrue} before={} - styleVariant="action" + variant="tertiary" > {strings.exportButtonLabel} @@ -517,7 +525,7 @@ function EapTableActions(props: Props) { name={false} onClick={setShowSummaryExportTrue} before={} - styleVariant="action" + variant="tertiary" > {strings.exportSummaryButtonLabel} diff --git a/app/src/views/AccountMyFormsEap/EapTableActions/styles.module.css b/app/src/views/AccountMyFormsEap/EapTableActions/styles.module.css new file mode 100644 index 0000000000..452accc059 --- /dev/null +++ b/app/src/views/AccountMyFormsEap/EapTableActions/styles.module.css @@ -0,0 +1,3 @@ +.additional-files-button { + display: contents; +} diff --git a/app/src/views/AccountNotifications/EmailPreferences/SubscriptionModal/index.tsx b/app/src/views/AccountNotifications/EmailPreferences/SubscriptionModal/index.tsx index bc253f3c38..acff688fd8 100644 --- a/app/src/views/AccountNotifications/EmailPreferences/SubscriptionModal/index.tsx +++ b/app/src/views/AccountNotifications/EmailPreferences/SubscriptionModal/index.tsx @@ -368,7 +368,7 @@ function SubscriptionModal(props: Props) { {strings.subscriptionUpdateButtonLabel} diff --git a/app/src/views/ActiveSurgeDeployments/ActiveSurgeSupport/SurgeCard/index.tsx b/app/src/views/ActiveSurgeDeployments/ActiveSurgeSupport/SurgeCard/index.tsx index 89c0deb03d..fcdd1fc9d7 100644 --- a/app/src/views/ActiveSurgeDeployments/ActiveSurgeSupport/SurgeCard/index.tsx +++ b/app/src/views/ActiveSurgeDeployments/ActiveSurgeSupport/SurgeCard/index.tsx @@ -135,8 +135,8 @@ function SurgeCard(props: Props) { /> )} withPadding - withBackground - withShadow + backgroundColor="foreground" + boxShadow="md" > {hasCountrySnippet && ( - + + + )} {hasCountryContacts && ( - + + + )} {!isDataAvailable && ( diff --git a/app/src/views/CountryNsOverviewActivities/NationalSocietyDevelopmentInitiatives/InitiativeCard/index.tsx b/app/src/views/CountryNsOverviewActivities/NationalSocietyDevelopmentInitiatives/InitiativeCard/index.tsx index 0570b1cd0e..94e162e814 100644 --- a/app/src/views/CountryNsOverviewActivities/NationalSocietyDevelopmentInitiatives/InitiativeCard/index.tsx +++ b/app/src/views/CountryNsOverviewActivities/NationalSocietyDevelopmentInitiatives/InitiativeCard/index.tsx @@ -49,8 +49,8 @@ function InitiativeCard(props: Props) { valueType="text" /> )} - withBackground - withShadow + backgroundColor="foreground" + boxShadow="md" withPadding > diff --git a/app/src/views/CountryNsOverviewCapacity/CountryNsCapacityStrengthening/index.tsx b/app/src/views/CountryNsOverviewCapacity/CountryNsCapacityStrengthening/index.tsx index 268d27ecd4..0cebc9e85c 100644 --- a/app/src/views/CountryNsOverviewCapacity/CountryNsCapacityStrengthening/index.tsx +++ b/app/src/views/CountryNsOverviewCapacity/CountryNsCapacityStrengthening/index.tsx @@ -106,15 +106,15 @@ function CountryNsCapacityStrengthening() { pending={false} heading={strings.bocaAssessment} headingLevel={4} - withShadow - withBackground + boxShadow="md" + backgroundColor="foreground" withPadding > )} diff --git a/app/src/views/CountryNsOverviewCapacity/index.tsx b/app/src/views/CountryNsOverviewCapacity/index.tsx index a7e6135d5a..2b554f2128 100644 --- a/app/src/views/CountryNsOverviewCapacity/index.tsx +++ b/app/src/views/CountryNsOverviewCapacity/index.tsx @@ -159,8 +159,8 @@ export function Component() { )} withFooterBorder withPadding - withBackground - withShadow + backgroundColor="foreground" + boxShadow="md" > @@ -373,7 +373,7 @@ function NationalSocietyIndicators(props: Props) { @@ -334,7 +334,7 @@ function LocalUnitBulkUploadModal(props: Props) { {isDefined(importSummaryResponse) && ( )} diff --git a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitImportSummary/index.tsx b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitImportSummary/index.tsx index 6050edf668..f772366baf 100644 --- a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitImportSummary/index.tsx +++ b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitImportSummary/index.tsx @@ -5,6 +5,7 @@ import { } from '@ifrc-go/icons'; import { Container, + type ContainerProps, ListView, NumberOutput, ProgressBar, @@ -34,14 +35,14 @@ const BULK_UPLOAD_PENDING = 3 satisfies BulkStatusKey; interface Props { value: BulkUploadResponse | undefined; withPadding?: boolean; - withBackground?: boolean; + backgroundColor?: ContainerProps['backgroundColor']; } function LocalUnitImportSummary(props: Props) { const { value, withPadding, - withBackground, + backgroundColor, } = props; const strings = useTranslation(i18n); @@ -55,7 +56,7 @@ function LocalUnitImportSummary(props: Props) { pending={value?.status === BULK_UPLOAD_PENDING} pendingMessage={strings.processingMessage} withPadding={withPadding} - withBackground={withBackground} + backgroundColor={backgroundColor} > {isDefined(totalCount) && ( diff --git a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/OtherProfilesDiffOutput/index.tsx b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/OtherProfilesDiffOutput/index.tsx index 1b7d9bf956..8d7ee4548a 100644 --- a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/OtherProfilesDiffOutput/index.tsx +++ b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/OtherProfilesDiffOutput/index.tsx @@ -1,8 +1,10 @@ import { ListView, + type ListViewProps, TextOutput, } from '@ifrc-go/ui'; import { useTranslation } from '@ifrc-go/ui/hooks'; +import { isDefined } from '@togglecorp/fujs'; import DiffWrapper from '#components/DiffWrapper'; @@ -17,22 +19,22 @@ type OtherProfile = NonNullable< interface Props { newValue: OtherProfile; oldValue: OtherProfile | undefined; - withBackground?: boolean; + backgroundColor?: ListViewProps['backgroundColor']; } function OtherProfilesDiffOutput(props: Props) { const { newValue, oldValue, - withBackground, + backgroundColor, } = props; const strings = useTranslation(i18n); return ( diff --git a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/index.tsx b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/index.tsx index 42692a732f..b21a863b17 100644 --- a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/index.tsx +++ b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitView/index.tsx @@ -208,7 +208,7 @@ function LocalUnitView(props: Props) { value={newValue?.location_json?.lat} valueType="number" maximumFractionDigits={10} - withBackground + backgroundColor="background" /> {newValue?.type !== TYPE_HEALTH_CARE && ( @@ -311,7 +311,7 @@ function LocalUnitView(props: Props) { strongLabel label={strings.localUnitViewFocalPersonEn} value={newValue?.focal_person_en} - withBackground + backgroundColor="background" /> @@ -341,7 +341,7 @@ function LocalUnitView(props: Props) { strongLabel label={strings.localUnitViewSourceEn} value={newValue?.source_en} - withBackground + backgroundColor="background" /> @@ -389,7 +389,7 @@ function LocalUnitView(props: Props) { strongLabel label={strings.localUnitViewOtherAffiliation} value={newValue?.health?.other_affiliation} - withBackground + backgroundColor="background" /> {newValue?.type !== TYPE_HEALTH_CARE && ( @@ -573,7 +573,7 @@ function LocalUnitView(props: Props) { strongLabel label={strings.localUnitViewPhone} value={newValue?.phone} - withBackground + backgroundColor="background" /> @@ -635,7 +635,7 @@ function LocalUnitView(props: Props) { strongLabel label={strings.localUnitViewOtherFacilityType} value={newValue?.health?.other_facility_type} - withBackground + backgroundColor="background" /> {isDefined(changedOtherProfiles) && changedOtherProfiles.length > 0 && ( @@ -975,7 +975,7 @@ function LocalUnitView(props: Props) { key={profile.client_id} newValue={profile} oldValue={getPreviousProfileValue(profile.client_id)} - withBackground + backgroundColor="foreground" /> ))} @@ -990,7 +990,7 @@ function LocalUnitView(props: Props) { key={profile.client_id} newValue={profile} oldValue={undefined} - withBackground + backgroundColor="foreground" /> ))} @@ -1006,7 +1006,7 @@ function LocalUnitView(props: Props) { valueType="boolean" label={strings.localUnitViewOtherMedicalHeal} value={newValue?.health?.other_medical_heal} - withBackground + backgroundColor="background" /> diff --git a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsExportModal/index.tsx b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsExportModal/index.tsx index 141ca319e1..f3cefd8f52 100644 --- a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsExportModal/index.tsx +++ b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsExportModal/index.tsx @@ -131,7 +131,7 @@ function LocalUnitsExportModal(props: Props) { )} withPadding - withBackground + backgroundColor="foreground" initiallyExpanded withHeaderBorder // FIXME: add non field error and error indicator diff --git a/app/src/views/EapFullForm/SelectionActions/OperationInput/index.tsx b/app/src/views/EapFullForm/SelectionActions/OperationInput/index.tsx index 7fee2c460d..4d836fd362 100644 --- a/app/src/views/EapFullForm/SelectionActions/OperationInput/index.tsx +++ b/app/src/views/EapFullForm/SelectionActions/OperationInput/index.tsx @@ -77,7 +77,7 @@ function OperationsInput(props: Props) { )} withPadding - withBackground + backgroundColor="foreground" initiallyExpanded withHeaderBorder // FIXME: add non field error and error indicator diff --git a/app/src/views/EapFullForm/SelectionActions/index.tsx b/app/src/views/EapFullForm/SelectionActions/index.tsx index 9f40f9461a..d4e675c192 100644 --- a/app/src/views/EapFullForm/SelectionActions/index.tsx +++ b/app/src/views/EapFullForm/SelectionActions/index.tsx @@ -323,7 +323,7 @@ function SelectionActions(props: Props) { /> )} - variant="form" + styleVariant="form" > {strings.selectionActionUploadLabel} @@ -565,7 +563,7 @@ function SelectionActions(props: Props) { headerDescription={ strings.selectionActionPlannedOperationHeadingDescription } - variant="form" + styleVariant="form" > )} - variant="form" + styleVariant="form" > {strings.triggerUploadTableLabel} diff --git a/app/src/views/EapFullForm/index.tsx b/app/src/views/EapFullForm/index.tsx index 42955dbbd2..f83a23094c 100644 --- a/app/src/views/EapFullForm/index.tsx +++ b/app/src/views/EapFullForm/index.tsx @@ -1158,7 +1158,7 @@ export function Component() { name={undefined} onClick={handleRequestForApprovalButtonClick} disabled={readOnly} - styleVariant="filled" + variant="primary" > {strings.submitButtonLabel} @@ -1187,9 +1187,9 @@ export function Component() { )} diff --git a/app/src/views/EapRegistration/index.tsx b/app/src/views/EapRegistration/index.tsx index c46982c13c..5a82605d20 100644 --- a/app/src/views/EapRegistration/index.tsx +++ b/app/src/views/EapRegistration/index.tsx @@ -203,7 +203,7 @@ export function Component() { > {strings.closeButtonLabel} diff --git a/app/src/views/EapSimplifiedForm/DeliveryAndBudget/index.tsx b/app/src/views/EapSimplifiedForm/DeliveryAndBudget/index.tsx index fd781d9b22..8324155af4 100644 --- a/app/src/views/EapSimplifiedForm/DeliveryAndBudget/index.tsx +++ b/app/src/views/EapSimplifiedForm/DeliveryAndBudget/index.tsx @@ -163,7 +163,7 @@ function DeliveryAndBudget(props: Props) { > )} - variant="form" + styleVariant="form" > @@ -79,7 +79,7 @@ function OperationsBySectorInput(props: Props) { )} withPadding - withBackground + backgroundColor="foreground" initiallyExpanded withHeaderBorder > diff --git a/app/src/views/EapSimplifiedForm/EnablingApproaches/index.tsx b/app/src/views/EapSimplifiedForm/EnablingApproaches/index.tsx index c5358deb24..761220a9de 100644 --- a/app/src/views/EapSimplifiedForm/EnablingApproaches/index.tsx +++ b/app/src/views/EapSimplifiedForm/EnablingApproaches/index.tsx @@ -163,7 +163,7 @@ function EnablingApproaches(props: Props) { > @@ -80,7 +80,7 @@ function OperationsBySectorInput(props: Props) { )} withPadding - withBackground + backgroundColor="foreground" initiallyExpanded withHeaderBorder // FIXME: add non field error and error indicator diff --git a/app/src/views/EapSimplifiedForm/PlannedOperations/index.tsx b/app/src/views/EapSimplifiedForm/PlannedOperations/index.tsx index 8540733ec8..f1ed60e6a0 100644 --- a/app/src/views/EapSimplifiedForm/PlannedOperations/index.tsx +++ b/app/src/views/EapSimplifiedForm/PlannedOperations/index.tsx @@ -162,7 +162,7 @@ function PlannedOperations(props: Props) { > )} diff --git a/app/src/views/Emergencies/index.tsx b/app/src/views/Emergencies/index.tsx index aa82e51e3c..fc9e0a3727 100644 --- a/app/src/views/Emergencies/index.tsx +++ b/app/src/views/Emergencies/index.tsx @@ -12,7 +12,7 @@ import { import { BarChart, Container, - KeyFigureView, + KeyFigureCard, ListView, TimeSeriesChart, } from '@ifrc-go/ui'; @@ -231,28 +231,28 @@ export function Component() { layout="grid" numPreferredGridColumns={4} > - } value={eventsResponse?.count} valueType="number" label={strings.emergenciesStatsTitle} /> - } value={numAffected} valueType="number" label={strings.emergenciesStatsAffected} /> - } value={amountRequested} valueType="number" label={strings.emergenciesStatsRequested} /> - } value={funding} @@ -268,9 +268,9 @@ export function Component() { heading={strings.emergenciesByTypeTitle} className={styles.emergenciesByType} withHeaderBorder - withShadow + boxShadow="md" withPadding - withBackground + backgroundColor="foreground" pending={eventsPending} > {aggregateEventResponse && ( {isDefined(peopleTargeted) && ( - } value={peopleTargeted} valueType="number" - valueOptions={{ compact: true }} + compact label={strings.emergencyPeopleTargetedLabel} /> )} {isDefined(fundingRequirements) && ( - } value={fundingRequirements} valueType="number" - valueOptions={{ compact: true }} + compact label={strings.emergencyFundingRequirementsLabel} /> )} {isDefined(funding) && ( - } value={funding} valueType="number" - valueOptions={{ compact: true }} + compact label={strings.emergencyFundingLabel} /> )} diff --git a/app/src/views/EmergencyActivities/ActivityActions/index.tsx b/app/src/views/EmergencyActivities/ActivityActions/index.tsx index 042f0d4052..cca4f7616e 100644 --- a/app/src/views/EmergencyActivities/ActivityActions/index.tsx +++ b/app/src/views/EmergencyActivities/ActivityActions/index.tsx @@ -27,7 +27,7 @@ function ActivityActions(props: Props) { return ( } persistent diff --git a/app/src/views/EmergencyActivities/ActivityDetail/index.tsx b/app/src/views/EmergencyActivities/ActivityDetail/index.tsx index 60f1d0b47b..a7f0de43ea 100644 --- a/app/src/views/EmergencyActivities/ActivityDetail/index.tsx +++ b/app/src/views/EmergencyActivities/ActivityDetail/index.tsx @@ -65,7 +65,7 @@ function Activity({ activity }: ActivityProps) { @@ -135,7 +135,7 @@ function ProjectListItem(props: ProjectListItemProps) { withoutWrapInHeader footerActions={( diff --git a/app/src/views/Home/index.tsx b/app/src/views/Home/index.tsx index d86aacf9f6..aa728ad11e 100644 --- a/app/src/views/Home/index.tsx +++ b/app/src/views/Home/index.tsx @@ -8,7 +8,7 @@ import { import { Container, InfoPopup, - KeyFigureView, + KeyFigureCard, ListView, } from '@ifrc-go/ui'; import { useTranslation } from '@ifrc-go/ui/hooks'; @@ -42,11 +42,11 @@ export function Component() { layout="grid" numPreferredGridColumns={5} > - } value={aggregatedAppealResponse.active_drefs} valueType="number" - size="lg" + textSize="4xl" info={( - } value={aggregatedAppealResponse.active_appeals} valueType="number" - size="lg" + textSize="4xl" info={( - } value={aggregatedAppealResponse.amount_requested_dref_included} valueType="number" - size="lg" - valueOptions={{ compact: true }} + textSize="4xl" + compact label={strings.homeKeyFiguresBudget} /> - } value={getPercentage( aggregatedAppealResponse?.amount_funded_dref_included, aggregatedAppealResponse?.amount_requested_dref_included, )} valueType="number" - valueOptions={{ - compact: true, - suffix: '%', - }} + compact + suffix="%" label={strings.homeKeyFiguresAppealsFunding} - size="lg" + textSize="4xl" /> - } value={aggregatedAppealResponse.target_population} valueType="number" - valueOptions={{ compact: true }} + compact label={strings.homeKeyFiguresTargetPop} - size="lg" + textSize="4xl" /> ); diff --git a/app/src/views/MontandonLandingPage/index.tsx b/app/src/views/MontandonLandingPage/index.tsx index c7c539cfa0..a8f1e3c38b 100644 --- a/app/src/views/MontandonLandingPage/index.tsx +++ b/app/src/views/MontandonLandingPage/index.tsx @@ -43,7 +43,6 @@ export function Component() { } - labelColorVariant="primary" preferredPopupWidth={30} persistent > @@ -91,7 +90,6 @@ export function Component() { } - labelColorVariant="primary" preferredPopupWidth={30} persistent > @@ -161,8 +159,8 @@ export function Component() { heading={strings.gettingStartedGuide} withHeaderBorder withPadding - withBackground - withShadow + backgroundColor="foreground" + boxShadow="md" > ); diff --git a/app/src/views/OldDrefFinalReportForm/Actions/NeedInput/index.tsx b/app/src/views/OldDrefFinalReportForm/Actions/NeedInput/index.tsx index 61bcb879c0..3a13e9542e 100644 --- a/app/src/views/OldDrefFinalReportForm/Actions/NeedInput/index.tsx +++ b/app/src/views/OldDrefFinalReportForm/Actions/NeedInput/index.tsx @@ -72,7 +72,7 @@ function NeedInput(props: Props) { )} withPadding - withBackground - withShadow + backgroundColor="foreground" + boxShadow="md" > {strings.eruNSSeeReadinessInfoButton} )} withPadding - withShadow - withBackground + boxShadow="md" + backgroundColor="foreground" > {deploymentsByNationalSocietyResponse && ( )} heading={type === 'custom' ? `${strings.customActivityHeading} #${itemNumber}` : actionDetails?.title} - withDarkBackground + backgroundColor="background" withPadding > @@ -460,7 +460,7 @@ function ActivityInput(props: Props) { headerActions={( - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -345,8 +127,7 @@ function AllSpacing() {