From d7f69a5e5bfe6ff14a0751b3f1e5fd7dba1808f8 Mon Sep 17 00:00:00 2001 From: Magnus Revheim Martinsen Date: Wed, 23 Oct 2024 16:58:31 +0200 Subject: [PATCH 1/8] update to @next Designsystem version --- package.json | 6 +- src/components/EditIconButton.tsx | 2 +- src/components/atoms/AltinnAttachment.tsx | 10 +-- src/components/form/HelpTextContainer.tsx | 2 +- src/components/form/RadioButton.tsx | 2 +- src/components/label/LabelContent.tsx | 2 +- src/components/presentation/Header.tsx | 2 +- src/components/presentation/NavBar.tsx | 12 +-- .../alertOnChange/DeleteWarningPopover.tsx | 32 ++++---- src/features/devtools/DevToolsControls.tsx | 22 +++--- src/features/devtools/DevToolsPanel.tsx | 4 +- .../DevHiddenFunctionality.tsx | 2 +- .../DevNavigationButtons.tsx | 37 +++++---- .../components/DevToolsLogs/DevToolsLogs.tsx | 22 +++--- .../DownloadXMLButton/DownloadXMLButton.tsx | 4 +- .../ExpressionPlayground.tsx | 6 +- .../FeatureToggles/FeatureToggles.tsx | 11 ++- .../LayoutInspector/ComponentSelector.tsx | 2 +- .../LayoutInspector.module.css | 4 + .../LayoutInspector/LayoutInspector.tsx | 10 +-- .../NodeInspector/NodeInspector.tsx | 14 ++-- .../OpenDevToolsButton/OpenDevToolsButton.tsx | 4 +- .../PDFPreviewButton/PDFGeneratorPreview.tsx | 18 +++-- .../PDFPreviewButton/PDFPreviewButton.tsx | 4 +- .../PermissionsEditor/PermissionsEditor.tsx | 8 +- .../VersionSwitcher/VersionSwitcher.tsx | 2 +- .../containers/InvalidSubformLayoutError.tsx | 2 +- .../instantiate/containers/PartySelection.tsx | 2 +- .../instantiate/containers/UnknownError.tsx | 2 +- .../selection/InstanceSelection.tsx | 12 +-- .../validation/ComponentValidations.tsx | 8 +- src/index.tsx | 2 +- src/language/sharedLanguage.ts | 12 +-- src/layout/Accordion/AccordionItem.tsx | 8 +- .../ActionButton/ActionButtonComponent.tsx | 6 +- src/layout/Address/AddressComponent.tsx | 10 +-- src/layout/Alert/AlertBaseComponent.tsx | 2 +- src/layout/Button/SubmitButton.tsx | 2 +- src/layout/Button/WrappedButton.tsx | 4 +- src/layout/Cards/Cards.tsx | 16 ++-- src/layout/Checkboxes/WrappedCheckbox.tsx | 4 +- .../CustomButton/CustomButtonComponent.tsx | 24 +++++- src/layout/Datepicker/DatePickerInput.tsx | 4 +- src/layout/Datepicker/DatepickerComponent.tsx | 31 ++++---- src/layout/Datepicker/DropdownCaption.tsx | 12 +-- .../FileUploadTable/FileTableButtons.tsx | 4 +- .../FileUploadWithTag/EditWindowComponent.tsx | 2 +- src/layout/Grid/GridSummary.tsx | 6 +- src/layout/Group/GroupComponent.tsx | 10 +-- src/layout/Group/GroupSummary.tsx | 2 +- src/layout/Header/HeaderComponent.tsx | 6 +- src/layout/Input/InputComponent.tsx | 4 +- .../Summary/LargeLikertSummaryContainer.tsx | 10 +-- src/layout/Likert/Summary2/LikertSummary.tsx | 6 +- src/layout/Link/LinkComponent.tsx | 6 +- src/layout/List/ListComponent.tsx | 5 +- src/layout/Map/Summary2/MapSummary.tsx | 6 +- .../NavigationButtonsComponent.tsx | 6 +- src/layout/Payment/PaymentComponent.tsx | 10 +-- .../PaymentReceiptDetails.tsx | 28 ++----- .../Payment/SkeletonLoader/SkeletonLoader.tsx | 25 ++++-- .../PrintButton/PrintButtonComponent.tsx | 4 +- .../RadioButtons/ControlledRadioGroup.tsx | 2 +- .../RepeatingGroupContainer.module.css | 4 + .../Container/RepeatingGroupContainer.tsx | 3 +- .../RepeatingGroupsEditContainer.tsx | 18 ++--- .../Pagination/RepeatingGroupPagination.tsx | 67 +++++++--------- .../Summary/LargeGroupSummaryContainer.tsx | 10 +-- .../Summary2/RepeatingGroupSummary.tsx | 6 +- .../Table/RepeatingGroupTableRow.tsx | 10 +-- .../Subform/SubformComponent.module.css | 6 +- src/layout/Subform/SubformComponent.tsx | 10 +-- .../Summary/SubformSummaryComponent2.tsx | 1 - src/layout/Summary/EditButton.tsx | 4 +- .../CommonSummaryComponents/EditButton.tsx | 2 +- .../LayoutSetSummaryAccordion.tsx | 4 +- .../MultipleValueSummary.tsx | 28 ++++--- .../SingleValueSummary.tsx | 6 +- src/layout/Tabs/Tabs.tsx | 14 +++- yarn.lock | 78 ++++++++++++------- 80 files changed, 429 insertions(+), 391 deletions(-) diff --git a/package.json b/package.json index 581ffb7c30..af0e435e19 100644 --- a/package.json +++ b/package.json @@ -128,9 +128,9 @@ "@babel/polyfill": "7.12.1", "@date-fns/tz": "^1.1.2", "@digdir/design-system-react": "0.54.0", - "@digdir/designsystemet-css": "0.10.0", - "@digdir/designsystemet-react": "0.63.1", - "@digdir/designsystemet-theme": "0.15.3", + "@digdir/designsystemet-css": "1.0.0-next.35", + "@digdir/designsystemet-react": "1.0.0-next.35", + "@digdir/designsystemet-theme": "1.0.0-next.35", "@material-ui/core": "4.12.4", "@material-ui/pickers": "3.3.11", "@navikt/aksel-icons": "^7.0.0", diff --git a/src/components/EditIconButton.tsx b/src/components/EditIconButton.tsx index 2562be0918..e6d3edd424 100644 --- a/src/components/EditIconButton.tsx +++ b/src/components/EditIconButton.tsx @@ -15,7 +15,7 @@ export function EditIconButton({ id, label, onClick }: IEditIconButtonProps) { return ( - - + + ); } diff --git a/src/features/devtools/DevToolsControls.tsx b/src/features/devtools/DevToolsControls.tsx index 1949884dc8..4650268259 100644 --- a/src/features/devtools/DevToolsControls.tsx +++ b/src/features/devtools/DevToolsControls.tsx @@ -30,7 +30,7 @@ export const DevToolsControls = () => { return ( @@ -52,7 +52,7 @@ export const DevToolsControls = () => { {isInForm && {DevToolsTab.Expressions}} {/* {DevToolsTab.FeatureToggles} */} - +
@@ -63,24 +63,24 @@ export const DevToolsControls = () => {
-
- + + - + {isInForm && ( - + - + )} {isInForm && ( - + - + )} {isInForm && ( - + - + )} { // diff --git a/src/features/devtools/DevToolsPanel.tsx b/src/features/devtools/DevToolsPanel.tsx index 0b09b54cb0..01855430f1 100644 --- a/src/features/devtools/DevToolsPanel.tsx +++ b/src/features/devtools/DevToolsPanel.tsx @@ -81,8 +81,8 @@ export const DevToolsPanel = ({ isOpen, close, children }: IDevToolsPanelProps)
setFilter(e.target.value)} placeholder='Filtrer logger' @@ -81,8 +81,8 @@ export const DevToolsLogs = () => {
- + ); } diff --git a/src/layout/Checkboxes/WrappedCheckbox.tsx b/src/layout/Checkboxes/WrappedCheckbox.tsx index a5159834e4..960dcca979 100644 --- a/src/layout/Checkboxes/WrappedCheckbox.tsx +++ b/src/layout/Checkboxes/WrappedCheckbox.tsx @@ -53,14 +53,14 @@ export function WrappedCheckbox({ id, option, hideLabel, alertOnChange, checked, description={option.description && } value={option.value} checked={checked} - size='small' + size='sm' onChange={(e) => handleChange(e.target.checked)} > { {langAsString(option.label)} {option.helpText && ( - + )} diff --git a/src/layout/CustomButton/CustomButtonComponent.tsx b/src/layout/CustomButton/CustomButtonComponent.tsx index 595965d817..6ffa9c058a 100644 --- a/src/layout/CustomButton/CustomButtonComponent.tsx +++ b/src/layout/CustomButton/CustomButtonComponent.tsx @@ -210,8 +210,24 @@ export function useActionAuthorization() { } export const buttonStyles: { [style in CBTypes.ButtonStyle]: { color: ButtonColor; variant: ButtonVariant } } = { - primary: { variant: 'primary', color: 'success' }, - secondary: { variant: 'secondary', color: 'first' }, + primary: { variant: 'primary', color: 'accent' }, //success + secondary: { variant: 'secondary', color: 'accent' }, +}; + +const sizeMap: Record = { + small: 'sm', + medium: 'md', + large: 'lg', + sm: 'sm', + md: 'md', + lg: 'lg', +}; + +const colorMap: Record = { + first: 'accent', + second: 'neutral', + success: 'accent', + danger: 'danger', }; export const CustomButtonComponent = ({ node }: Props) => { @@ -275,8 +291,8 @@ export const CustomButtonComponent = ({ node }: Props) => { id={`custom-button-${id}`} disabled={disabled} onClick={onClick} - size={buttonSize} - color={buttonColor ?? style.color} + size={sizeMap[buttonSize ?? 'medium']} + color={colorMap[buttonColor ?? 'accent'] ?? style.color} variant={style.variant} aria-busy={isPending} > diff --git a/src/layout/Datepicker/DatePickerInput.tsx b/src/layout/Datepicker/DatePickerInput.tsx index 1591e3febc..bcfb36ad78 100644 --- a/src/layout/Datepicker/DatePickerInput.tsx +++ b/src/layout/Datepicker/DatePickerInput.tsx @@ -68,8 +68,8 @@ export const DatePickerInput = forwardRef( aria-label={langAsString('date_picker.aria_label_icon')} ref={ref} disabled={readOnly} - color='first' - size='small' + color='accent' + size='sm' > diff --git a/src/layout/Datepicker/DatepickerComponent.tsx b/src/layout/Datepicker/DatepickerComponent.tsx index 745a1f79ff..cf07728b1c 100644 --- a/src/layout/Datepicker/DatepickerComponent.tsx +++ b/src/layout/Datepicker/DatepickerComponent.tsx @@ -1,7 +1,7 @@ import React, { useRef, useState } from 'react'; import type { ReactNode } from 'react'; -import { Modal, Popover } from '@digdir/designsystemet-react'; +import { Button, Modal, Popover } from '@digdir/designsystemet-react'; import { Grid } from '@material-ui/core'; import { formatDate, isValid as isValidDate, parse, parseISO } from 'date-fns'; @@ -62,35 +62,36 @@ export function DatepickerComponent({ node }: IDatepickerProps) { {trigger} modalRef.current?.close()} + backdropClose={true} style={{ width: 'fit-content', minWidth: 'fit-content' }} > - {content} + {content} ) : ( - setIsDialogOpen(false)} - size='lg' - placement='top' - > - + @@ -56,7 +56,7 @@ export const DropdownCaption = ({ calendarMonth, id }: MonthCaptionProps) => { handleMonthChange(months[0])} aria-label={MonthDropdownLabel} @@ -79,7 +79,7 @@ export const DropdownCaption = ({ calendarMonth, id }: MonthCaptionProps) => { handleYearChange(years[0])} aria-label={yearDropdownLabel} @@ -102,12 +102,12 @@ export const DropdownCaption = ({ calendarMonth, id }: MonthCaptionProps) => { diff --git a/src/layout/FileUpload/FileUploadTable/FileTableButtons.tsx b/src/layout/FileUpload/FileUploadTable/FileTableButtons.tsx index 3110dbc9d2..4b9ef3af4e 100644 --- a/src/layout/FileUpload/FileUploadTable/FileTableButtons.tsx +++ b/src/layout/FileUpload/FileUploadTable/FileTableButtons.tsx @@ -76,9 +76,9 @@ export function FileTableButtons({ node, attachment, mobileView, editWindowIsOpe > - diff --git a/src/layout/Payment/PaymentReceiptDetails/PaymentReceiptDetails.tsx b/src/layout/Payment/PaymentReceiptDetails/PaymentReceiptDetails.tsx index 75016754e3..0f759bd7c2 100644 --- a/src/layout/Payment/PaymentReceiptDetails/PaymentReceiptDetails.tsx +++ b/src/layout/Payment/PaymentReceiptDetails/PaymentReceiptDetails.tsx @@ -22,17 +22,13 @@ type PaymentInfoTableRowProps = { const PaymentInfoTableRow = ({ labelId, value }: PaymentInfoTableRowProps) => ( - +