Compare commits

..
3 Commits
Author SHA1 Message Date
Halvor Haugan 6ed064ab1a refactor(Combobox2): rename classname to combo-box (#5548) 2026-11-16 10:34:15 +01:00
dependabot[bot] 5a5a015a10 ⬆️ Bump the sanity group across 1 directory with 2 updates (#5550)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-16 10:14:32 +01:00
Halvor Haugan b9b6d3f45b chore(Combobox): move to /legacy (#5547) 2026-11-16 09:52:14 +01:00
45 changed files with 105 additions and 88 deletions

No files matched your search

+2 -2
View File
@@ -10,8 +10,8 @@ import "../@navikt/core/css/src/data-token-filter.css";
import dataTokenFilterStyles from "../@navikt/core/css/src/data-token-filter.css?inline";
import "../@navikt/core/css/src/data-toolbar.css";
import dataToolbarStyles from "../@navikt/core/css/src/data-toolbar.css?inline";
import "../@navikt/core/css/src/form/combobox2.css";
import combobox2Styles from "../@navikt/core/css/src/form/combobox2.css?inline";
import "../@navikt/core/css/src/form/combo-box.css";
import combobox2Styles from "../@navikt/core/css/src/form/combo-box.css?inline";
import "../@navikt/core/css/src/index.css";
import dsStyles from "../@navikt/core/css/src/index.css?inline";
import "../@navikt/core/css/src/listbox.css";
@@ -1,4 +1,4 @@
.aksel-combobox2[data-disabled="true"] {
.aksel-combo-box[data-disabled="true"] {
opacity: var(--ax-opacity-disabled);
pointer-events: none;
}
@@ -7,16 +7,16 @@
* Label & description & error *
************************************************/
.aksel-combobox2__label {
.aksel-combo-box__label {
display: flex;
margin-bottom: var(--ax-space-8);
}
.aksel-combobox2__description {
.aksel-combo-box__description {
margin-bottom: var(--ax-space-8);
}
.aksel-combobox2__error {
.aksel-combo-box__error {
margin-top: var(--ax-space-8);
}
@@ -24,11 +24,11 @@
* Field *
************************************************/
.aksel-combobox2__field-container {
.aksel-combo-box__field-container {
position: relative;
}
.aksel-combobox2__field-btn {
.aksel-combo-box__field-btn {
background-color: var(--ax-bg-input);
border-radius: var(--ax-radius-8);
border: 1px solid var(--ax-border-neutral);
@@ -62,7 +62,7 @@
color: ButtonText;
}
.aksel-combobox2[data-size="small"] & {
.aksel-combo-box[data-size="small"] & {
min-height: 2rem;
padding-block: 0;
}
@@ -79,7 +79,7 @@
}
}
.aksel-combobox2__field-chevron {
.aksel-combo-box__field-chevron {
position: absolute;
right: var(--ax-space-8);
top: 0;
@@ -92,7 +92,7 @@
color: ButtonText;
}
.aksel-combobox2[data-size="small"] & {
.aksel-combo-box[data-size="small"] & {
margin-top: 0.25rem;
}
}
@@ -101,7 +101,7 @@
* Overlay *
************************************************/
.aksel-combobox2__modal {
.aksel-combo-box__modal {
/**
* We set the height of the content to the visible viewport, but the virtual
* keyboard will still compensate for it's precence by adding some empty space
@@ -119,7 +119,7 @@
touch-action: pinch-zoom pan-x;
}
.aksel-combobox2__modal-inner {
.aksel-combo-box__modal-inner {
display: flex;
flex-direction: column;
overflow: hidden;
@@ -129,7 +129,7 @@
* Popup *
************************************************/
.aksel-combobox2__popup {
.aksel-combo-box__popup {
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
min-width: var(--__axc-floating-anchor-width);
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
@@ -142,7 +142,7 @@
flex-direction: column;
overflow: hidden;
.aksel-combobox2:not(:has(.aksel-combobox2__modal)) & {
.aksel-combo-box:not(:has(.aksel-combo-box__modal)) & {
outline: 1px solid var(--ax-border-neutral-subtleA);
outline-offset: -1px;
border-radius: var(--ax-radius-8);
@@ -154,11 +154,11 @@
* Filter input *
************************************************/
.aksel-combobox2__filter {
.aksel-combo-box__filter {
margin: -1px;
}
.aksel-combobox2__filter .aksel-search__wrapper:has(.aksel-search__input:focus-visible) {
.aksel-combo-box__filter .aksel-search__wrapper:has(.aksel-search__input:focus-visible) {
outline: none;
position: relative;
@@ -170,13 +170,13 @@
border: 2px solid var(--ax-border-focus);
}
.aksel-combobox2:not(:has(.aksel-combobox2__modal)) &::after {
.aksel-combo-box:not(:has(.aksel-combo-box__modal)) &::after {
border-top-left-radius: var(--ax-radius-8);
border-top-right-radius: var(--ax-radius-8);
}
}
.aksel-combobox2__filter .aksel-search__input {
.aksel-combo-box__filter .aksel-search__input {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
@@ -184,11 +184,11 @@
border-color: var(--ax-border-neutral-subtleA);
}
.aksel-combobox2__popup[data-size="medium"] & {
.aksel-combo-box__popup[data-size="medium"] & {
min-height: 0;
}
.aksel-combobox2__modal & {
.aksel-combo-box__modal & {
border-radius: 0;
}
}
@@ -197,10 +197,10 @@
* List *
************************************************/
.aksel-combobox2__list {
.aksel-combo-box__list {
padding-block: var(--ax-space-12);
.aksel-combobox2__modal & {
.aksel-combo-box__modal & {
padding-inline: var(--ax-space-16);
/* Prevents scrolling to area taken up by virtual keyboard.
@@ -211,7 +211,7 @@
}
}
.aksel-combobox2__no-results {
.aksel-combo-box__no-results {
padding: var(--ax-space-12) var(--ax-space-8);
text-align: center;
}
@@ -220,7 +220,7 @@
* Option *
************************************************/
.aksel-combobox2__option:is([aria-selected="true"], [aria-selected="true"][data-virtual-focus="true"])
.aksel-combo-box__option:is([aria-selected="true"], [aria-selected="true"][data-virtual-focus="true"])
.aksel-listbox__option-inner {
background-color: var(--ax-bg-moderate-pressedA);
@@ -231,30 +231,23 @@
}
}
.aksel-combobox2__option-checkmark {
--__axc-combobox2-option-checkmark-size: 1.25rem;
.aksel-combo-box__option-checkmark {
--__axc-combo-box-option-checkmark-size: 1.25rem;
width: var(--__axc-combobox2-option-checkmark-size);
height: var(--__axc-combobox2-option-checkmark-size);
width: var(--__axc-combo-box-option-checkmark-size);
height: var(--__axc-combo-box-option-checkmark-size);
margin-top: var(--ax-space-2);
float: left;
.aksel-combobox2__popup[data-size="small"] & {
--__axc-combobox2-option-checkmark-size: 1rem;
.aksel-combo-box__popup[data-size="small"] & {
--__axc-combo-box-option-checkmark-size: 1rem;
}
& svg {
font-size: var(--__axc-combobox2-option-checkmark-size);
font-size: var(--__axc-combo-box-option-checkmark-size);
}
}
.aksel-combobox2__option-label {
.aksel-combo-box__option-label {
padding-left: var(--ax-space-24);
/* &[data-nowrap="true"] {
padding-left: var(--ax-space-2);
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
} */
}
+4 -4
View File
@@ -571,12 +571,12 @@
},
"./Combobox": {
"import": {
"types": "./esm/form/combobox/index.d.ts",
"default": "./esm/form/combobox/index.js"
"types": "./esm/legacy/combobox/index.d.ts",
"default": "./esm/legacy/combobox/index.js"
},
"require": {
"types": "./cjs/form/combobox/index.d.ts",
"default": "./cjs/form/combobox/index.js"
"types": "./cjs/legacy/combobox/index.d.ts",
"default": "./cjs/legacy/combobox/index.js"
}
},
"./ConfirmationPanel": {
@@ -1,9 +1,9 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import React from "react";
import { Button } from "../button";
import { UNSAFE_Combobox } from "../legacy/combobox";
import { HStack, VStack } from "../primitives/stack";
import { Checkbox, CheckboxGroup } from "./checkbox";
import { UNSAFE_Combobox } from "./combobox";
import { Fieldset } from "./fieldset";
import { FileUpload } from "./file-upload";
import { Radio, RadioGroup } from "./radio";
@@ -99,7 +99,7 @@ const Combobox = forwardRef(
{!!description && (
<BodyShort
className={cl(
"aksel-form-field__description aksel-combobox2__description",
"aksel-form-field__description aksel-combo-box__description",
{ "aksel-sr-only": hideLabel },
)}
id={inputDescriptionId}
@@ -113,7 +113,7 @@ const Combobox = forwardRef(
<ComboboxField ref={ref} hasError={hasError} />
</ComboboxTrigger>
<div
className="aksel-form-field__error aksel-combobox2__error"
className="aksel-form-field__error aksel-combo-box__error"
id={errorId}
aria-relevant="additions removals"
aria-live="polite"
@@ -35,13 +35,13 @@ const ComboboxField = forwardRef<HTMLButtonElement, ComboboxFieldProps>(
}, [label]);
return (
<div className="aksel-combobox2__field-container">
<div className="aksel-combo-box__field-container">
<button
type="button"
ref={ref}
data-error={hasError}
className={cl(
"aksel-combobox2__field-btn",
"aksel-combo-box__field-btn",
"aksel-body-short",
`aksel-body-short--${size ?? "medium"}`,
)}
@@ -51,7 +51,7 @@ const ComboboxField = forwardRef<HTMLButtonElement, ComboboxFieldProps>(
{label}
</button>
<ChevronDownIcon
className="aksel-combobox2__field-chevron"
className="aksel-combo-box__field-chevron"
aria-hidden
/>
</div>
@@ -21,7 +21,7 @@ export const ComboboxFilter = (props: ComboboxFilterProps) => {
} = useComboboxPopupContext();
return (
<div className="aksel-combobox2__filter">
<div className="aksel-combo-box__filter">
<Listbox.InputSlot virtuallyFocusedOptionId={virtuallyFocusedOptionValue}>
<Search
value={filterString}
@@ -23,7 +23,7 @@ const ComboboxLabel = ({
return (
<Label
className={cl(
"aksel-form-field__label aksel-combobox2__label",
"aksel-form-field__label aksel-combo-box__label",
className,
{ "aksel-sr-only": hide },
)}
@@ -38,9 +38,9 @@ function ComboboxList<
return (
<>
<Listbox.Options className="aksel-combobox2__list">
<Listbox.Options className="aksel-combo-box__list">
{/*isPending && (
<div className="aksel-combobox2__loading" role="status">
<div className="aksel-combo-box__loading" role="status">
Laster...
</div>
)*/}
@@ -89,7 +89,7 @@ function ComboboxListContent<
if (filteredOptions.length === 0) {
// TODO: Consider moving outside of role=listbox
return (
<div className="aksel-combobox2__no-results">{translate("noHits")}</div>
<div className="aksel-combo-box__no-results">{translate("noHits")}</div>
);
}
@@ -26,19 +26,16 @@ function ComboboxOptionComponent<T extends ComboboxOptionData>({
return (
<Listbox.Option
className="aksel-combobox2__option"
className="aksel-combo-box__option"
id={option.value}
onClick={() => onToggleOption(option, !isSelected)}
aria-selected={isSelected}
hasVirtualFocus={hasVirtualFocus}
>
<div className="aksel-combobox2__option-checkmark" aria-hidden>
<div className="aksel-combo-box__option-checkmark" aria-hidden>
{isSelected && <CheckmarkHeavyIcon aria-hidden />}
</div>
<div
className="aksel-combobox2__option-label"
//data-nowrap={!children || typeof children === "string"}
>
<div className="aksel-combo-box__option-label">
{typeof children === "function"
? children(option)
: (children ??
@@ -125,10 +125,10 @@ function ComboboxModal({ children, open, onOpenChange }: ComboboxModalProps) {
return (
<Dialog size="small" open={open} onOpenChange={onOpenChange}>
<Dialog.Popup className="aksel-combobox2__modal" position="fullscreen">
<Dialog.Popup className="aksel-combo-box__modal" position="fullscreen">
<div
ref={ref}
className="aksel-combobox2__modal-inner"
className="aksel-combo-box__modal-inner"
// The reported height is sometimes a bit too small,
// so we let the dialog fill the entire normal viewport,
// and only limit the inner content's height.
@@ -76,7 +76,7 @@ export const ComboboxPopup = ({ children }: ComboboxPopupProps) => {
return (
<Listbox
ref={ref}
className="aksel-combobox2__popup"
className="aksel-combo-box__popup"
setVirtuallyFocusedOptionId={setVirtuallyFocusedOptionValue}
size={rootContext.size}
>
@@ -121,7 +121,7 @@ export function ComboboxRoot<
return (
<div
{...rest}
className={cl("aksel-combobox2", className)}
className={cl("aksel-combo-box", className)}
data-size={size}
data-disabled={disabled}
>
+1 -1
View File
@@ -119,7 +119,7 @@ export {
type CheckboxGroupProps,
type CheckboxProps,
} from "./form/checkbox";
export { UNSAFE_Combobox, type ComboboxProps } from "./form/combobox";
export { UNSAFE_Combobox, type ComboboxProps } from "./legacy/combobox";
export {
ConfirmationPanel,
type ConfirmationPanelProps,
@@ -2,11 +2,11 @@ import type { Meta, StoryFn } from "@storybook/react-vite";
import React, { useEffect, useMemo, useRef, useState } from "react";
import { Button } from "../../button";
import { Chips } from "../../chips";
import { Alert } from "../../legacy/alert";
import { TextField } from "../../form/textfield";
import { Modal } from "../../modal";
import { VStack } from "../../primitives/stack";
import { BodyLong } from "../../typography";
import { TextField } from "../textfield";
import { Alert } from "../alert";
import { type ComboboxProps, UNSAFE_Combobox } from "./index";
export default {
@@ -1,8 +1,8 @@
import React, { forwardRef } from "react";
import { ReadOnlyIconWithTitle } from "../../form/ReadOnlyIcon";
import { BodyShort, ErrorMessage, Label } from "../../typography";
import { Floating } from "../../utils/components/floating/Floating";
import { cl } from "../../utils/helpers";
import { ReadOnlyIconWithTitle } from "../ReadOnlyIcon";
import ComboboxWrapper from "./ComboboxWrapper";
import FilteredOptions from "./FilteredOptions/FilteredOptions";
import { useInputContext } from "./Input/Input.context";
@@ -1,7 +1,7 @@
import React, { useCallback, useMemo, useRef, useState } from "react";
import { type FormFieldType, useFormField } from "../../../form/useFormField";
import { useClientLayoutEffect } from "../../../utils-external";
import { createStrictContext } from "../../../utils/helpers";
import { type FormFieldType, useFormField } from "../../useFormField";
import type { ComboboxProps } from "../types";
interface InputContextValue extends FormFieldType {
@@ -1,5 +1,5 @@
import React, { type InputHTMLAttributes } from "react";
import type { FormFieldProps } from "../useFormField";
import type { FormFieldProps } from "../../form/useFormField";
/**
* A more complex version of options for the Combobox.
+1 -1
View File
@@ -40,7 +40,7 @@
"devDependencies": {
"@sanity/blueprints": "0.28.0",
"@sanity/export": "7.0.3",
"@sanity/functions": "1.10.1",
"@sanity/functions": "1.11.0",
"@sanity/schema": "6.17.0",
"@types/lodash": "4.17.25",
"@types/react": "19.2.14",
+1 -1
View File
@@ -75,7 +75,7 @@
"@babel/traverse": "^7.27.4",
"@google-cloud/bigquery": "^9.5.0",
"@playwright/test": "1.61.1",
"@portabletext/block-tools": "^6.0.0",
"@portabletext/block-tools": "^6.0.7",
"@portabletext/markdown": "^2.5.1",
"@sanity/schema": "6.17.0",
"@types/jscodeshift": "17.3.0",
+42 -15
View File
@@ -5778,15 +5778,15 @@ __metadata:
languageName: node
linkType: hard
"@portabletext/block-tools@npm:^6.0.0":
version: 6.0.0
resolution: "@portabletext/block-tools@npm:6.0.0"
"@portabletext/block-tools@npm:^6.0.7":
version: 6.0.7
resolution: "@portabletext/block-tools@npm:6.0.7"
dependencies:
"@portabletext/html": "npm:^2.0.0"
"@portabletext/sanity-bridge": "npm:^4.0.0"
"@portabletext/schema": "npm:^3.0.0"
"@portabletext/html": "npm:^2.0.2"
"@portabletext/sanity-bridge": "npm:^5.0.0"
"@portabletext/schema": "npm:^3.1.0"
"@sanity/types": "npm:^6.9.1"
checksum: 10/aab9636932663c6fda5ade211765ed836310dacce057582dd81b73d0d19260321acd3f0d41409b51bd8ada2f20be6e7f04536b42c18b8c93a9ee563abe4a1b14
checksum: 10/8b37564f9eb1f19b15ab8f792b69d004dd8b420493b34066ed09e70a3ba9b9b20c9aa8c3811b11ac718c4a59cca5174eebfd0e7781b716939a6fbe6f3daccdbc
languageName: node
linkType: hard
@@ -5820,6 +5820,16 @@ __metadata:
languageName: node
linkType: hard
"@portabletext/html@npm:^2.0.2":
version: 2.0.2
resolution: "@portabletext/html@npm:2.0.2"
dependencies:
"@portabletext/schema": "npm:^3.1.0"
"@vercel/stega": "npm:^1.1.0"
checksum: 10/1712d108c42f1dff1ae5427ab7dc0b4230a97f8e9d577fe52b2e2ffdc9a65582954f842c8c9024380e1da1826a7069d0959272d4fd6dd86447d3be16ff8bdf1b
languageName: node
linkType: hard
"@portabletext/keyboard-shortcuts@npm:^3.0.0":
version: 3.0.0
resolution: "@portabletext/keyboard-shortcuts@npm:3.0.0"
@@ -5978,7 +5988,7 @@ __metadata:
languageName: node
linkType: hard
"@portabletext/sanity-bridge@npm:^4.0.0, @portabletext/sanity-bridge@npm:^4.1.1":
"@portabletext/sanity-bridge@npm:^4.1.1":
version: 4.1.3
resolution: "@portabletext/sanity-bridge@npm:4.1.3"
dependencies:
@@ -5989,13 +5999,30 @@ __metadata:
languageName: node
linkType: hard
"@portabletext/schema@npm:^3.0.0, @portabletext/schema@npm:^3.0.1":
"@portabletext/sanity-bridge@npm:^5.0.0":
version: 5.0.0
resolution: "@portabletext/sanity-bridge@npm:5.0.0"
dependencies:
"@portabletext/schema": "npm:^3.1.0"
"@sanity/types": "npm:^6.9.1"
checksum: 10/e17b480684f72128615adb66ec3d132cd5c710ca2a41487c882883e7fa61246e3a5c2cba421fe67d6500ce466592d10281f0cbd90173d9f295fc71a6986aebcf
languageName: node
linkType: hard
"@portabletext/schema@npm:^3.0.1":
version: 3.0.1
resolution: "@portabletext/schema@npm:3.0.1"
checksum: 10/7a8b26e2dd1bb4f5d9efe4a6f02feeaa837e44dec6899ac8124c41b9141fe4536eff145343f4dc44018a1c0be17192dc79d5533bf4d1c8b2456270aeed03099e
languageName: node
linkType: hard
"@portabletext/schema@npm:^3.1.0":
version: 3.1.0
resolution: "@portabletext/schema@npm:3.1.0"
checksum: 10/280c0af185ef135f77a34886feb7dbd5169a638356de3f94f3c6e961ecc13832a939b2fc59c02f746206174c3f56c4eb36ba16f1eed4d224c7f9b18de82288bd
languageName: node
linkType: hard
"@portabletext/to-html@npm:^6.0.0":
version: 6.0.0
resolution: "@portabletext/to-html@npm:6.0.0"
@@ -6703,16 +6730,16 @@ __metadata:
languageName: node
linkType: hard
"@sanity/functions@npm:1.10.1":
version: 1.10.1
resolution: "@sanity/functions@npm:1.10.1"
"@sanity/functions@npm:1.11.0":
version: 1.11.0
resolution: "@sanity/functions@npm:1.11.0"
peerDependencies:
"@aws-lite/client": ^0.24.1
"@aws-lite/dynamodb": ^0.3.9
"@aws-lite/lambda": ^0.1.5
"@aws-lite/sns": ^0.0.8
"@aws-lite/sqs": ^0.2.4
checksum: 10/395637c288127e5bab5b7a2301df96a4406e78c166bbca5e3e60d11d6e3c93f4cf6fdf6fa915fbfa31dea179fe80365c7adde0f88601068de325e5a2aeb3cb6b
checksum: 10/ee6e6da36e3caf5fa841188ec5591c3939b01b53f1698b34f97ba168f5e39c0c3a4d224907f515e44e6ea5427a680f5478627a2b7ef473ef71a5ed59d1607a1b
languageName: node
linkType: hard
@@ -9778,7 +9805,7 @@ __metadata:
"@sanity/code-input": "npm:7.3.8"
"@sanity/color-input": "npm:6.1.8"
"@sanity/export": "npm:7.0.3"
"@sanity/functions": "npm:1.10.1"
"@sanity/functions": "npm:1.11.0"
"@sanity/image-url": "npm:2.1.1"
"@sanity/locale-nb-no": "npm:1.1.39"
"@sanity/preview-url-secret": "npm:4.1.5"
@@ -23930,7 +23957,7 @@ __metadata:
"@navikt/next-logger": "npm:5.0.2"
"@navikt/oasis": "npm:4.2.2"
"@playwright/test": "npm:1.61.1"
"@portabletext/block-tools": "npm:^6.0.0"
"@portabletext/block-tools": "npm:^6.0.7"
"@portabletext/markdown": "npm:^2.5.1"
"@portabletext/react": "npm:^8.0.1"
"@sanity/client": "npm:7.27.0"