Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Komponentsynk med figma + combobox hotfix #2219

Merged
merged 5 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eleven-rocks-doubt-css.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-css": patch
---

CSS: Popover har nå 8px border-radius. Fikset padding-bug i Select-small.
5 changes: 5 additions & 0 deletions .changeset/eleven-rocks-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-react": patch
---

Combobox: Fikset bruk av `useLayoutEffect` med SSR-safe metode.
2 changes: 1 addition & 1 deletion @navikt/core/css/form/select.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

.navds-form-field--small .navds-select__input {
min-height: 2rem;
padding: 0 2rem 0 0.25rem;
padding: 0 var(--a-spacing-8) 0 var(--a-spacing-2);
}

.navds-form-field--small .navds-select__chevron {
Expand Down
9 changes: 7 additions & 2 deletions @navikt/core/css/list.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
margin-block: var(--a-spacing-2);
}

.navds-list--small ul,
.navds-list--small ol {
margin-block: var(--a-spacing-3);
}

.navds-list li {
margin-block-end: var(--a-spacing-5);
margin-block-end: var(--a-spacing-4);
}

.navds-list--small li {
margin-block-end: var(--a-spacing-2);
margin-block-end: var(--a-spacing-3);
}

.navds-list--nested li {
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/css/popover.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
box-shadow: var(--a-shadow-medium);
border: 1px solid;
border-color: var(--ac-popover-border, var(--a-border-default));
border-radius: var(--a-border-radius-medium);
border-radius: var(--a-border-radius-large);
max-width: calc(100vw - var(--a-spacing-6));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import React, {
useContext,
useCallback,
useRef,
useLayoutEffect,
SetStateAction,
} from "react";
import cl from "clsx";
import { useCustomOptionsContext } from "../customOptionsContext";
import { useInputContext } from "../Input/inputContext";
import usePrevious from "../../../util/usePrevious";
import { useClientLayoutEffect } from "../../../util";

const normalizeText = (text: string): string =>
typeof text === "string" ? `${text}`.toLowerCase().trim() : "";
Expand Down Expand Up @@ -90,7 +90,7 @@ export const FilteredOptionsProvider = ({ children, value: props }) => {
const [isMouseLastUsedInputDevice, setIsMouseLastUsedInputDevice] =
useState(false);

useLayoutEffect(() => {
useClientLayoutEffect(() => {
if (
shouldAutocomplete &&
normalizeText(searchTerm) !== "" &&
Expand Down
4 changes: 2 additions & 2 deletions @navikt/core/react/src/form/combobox/Input/inputContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import React, {
createContext,
useCallback,
useContext,
useLayoutEffect,
useMemo,
useRef,
useState,
} from "react";
import { useFormField, FormFieldType } from "../../useFormField";
import { useClientLayoutEffect } from "../../../util";

interface InputContextType extends FormFieldType {
clearInput: (event: React.PointerEvent | React.KeyboardEvent) => void;
Expand Down Expand Up @@ -92,7 +92,7 @@ export const InputContextProvider = ({ children, value: props }) => {
inputRef.current?.focus?.();
}, []);

useLayoutEffect(() => {
useClientLayoutEffect(() => {
if (shouldAutocomplete && inputRef && value !== searchTerm) {
inputRef.current?.setSelectionRange?.(searchTerm.length, value.length);
}
Expand Down