Skip to content

Commit

Permalink
chore: make autocomplete options readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
magnh committed Jun 5, 2024
1 parent a0eb80f commit dfb3e4f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 39 deletions.
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,15 @@
"eds-tokens-sync",
"eds-tokens-build"
],
"cSpell.words": ["colorjs", "lightningcss", "OKLCH", "Overridable"]
"cSpell.words": [
"colorjs",
"lightningcss",
"OKLCH",
"Overridable"
],
"workbench.colorCustomizations": {
"activityBar.background": "#1C3408",
"titleBar.activeBackground": "#27480C",
"titleBar.activeForeground": "#F4FCED"
}
}
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
import { arrow_drop_down, arrow_drop_up, close } from '@equinor/eds-icons'
import {
forwardRef,
useState,
HTMLAttributes,
useEffect,
useRef,
useMemo,
useCallback,
ReactNode,
EventHandler,
SyntheticEvent,
DOMAttributes,
FocusEvent,
} from 'react'
bordersTemplate,
useIsomorphicLayoutEffect,
useToken,
} from '@equinor/eds-utils'
import {
MiddlewareState,
autoUpdate,
flip,
offset,
size,
useFloating,
useInteractions,
} from '@floating-ui/react'
import { useVirtualizer } from '@tanstack/react-virtual'
import {
useCombobox,
UseComboboxProps,
useMultipleSelection,
UseMultipleSelectionProps,
useCombobox,
useMultipleSelection,
} from 'downshift'
import { pickBy, mergeWith } from 'ramda'
import { HelperText as _HelperText } from '../InputWrapper/HelperText' /* TODO: Use InputWrapper instead of HelperText once the new token system is in place */
import { useVirtualizer } from '@tanstack/react-virtual'
import { mergeWith, pickBy } from 'ramda'
import {
DOMAttributes,
EventHandler,
FocusEvent,
HTMLAttributes,
ReactNode,
SyntheticEvent,
forwardRef,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react'
import styled, { ThemeProvider, css } from 'styled-components'
import { Button } from '../Button'
import { List } from '../List'
import { useEds } from '../EdsProvider'
import { Label } from '../Label'
import { Icon } from '../Icon'
import { Input } from '../Input'
import { HelperText as _HelperText } from '../InputWrapper/HelperText' /* TODO: Use InputWrapper instead of HelperText once the new token system is in place */
import { Label } from '../Label'
import { List } from '../List'
import { Progress } from '../Progress'
import { arrow_drop_down, arrow_drop_up, close } from '@equinor/eds-icons'
import { Variants } from '../types'
import {
AutocompleteToken,
multiSelect as multiSelectTokens,
selectTokens as selectTokens,
selectTokens,
} from './Autocomplete.tokens'
import {
useToken,
bordersTemplate,
useIsomorphicLayoutEffect,
} from '@equinor/eds-utils'
import { AutocompleteOption } from './Option'
import {
offset,
flip,
size,
autoUpdate,
useFloating,
useInteractions,
MiddlewareState,
} from '@floating-ui/react'
import { Variants } from '../types'

const Container = styled.div`
position: relative;
Expand Down Expand Up @@ -250,7 +250,7 @@ export type AutocompleteChanges<T> = { selectedItems: T[] }

export type AutocompleteProps<T> = {
/** List of options in dropdown */
options: T[]
options: readonly T[]
/** Label for the select element */
label: ReactNode
/** Array of initial selected items
Expand Down

0 comments on commit dfb3e4f

Please sign in to comment.