@equinor/eds-core-react 1.1.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/eds-core-react.cjs +272 -150
- package/dist/esm/components/Accordion/Accordion.js +4 -3
- package/dist/esm/components/Autocomplete/Autocomplete.js +88 -21
- package/dist/esm/components/Datepicker/fields/FieldWrapper.js +8 -2
- package/dist/esm/components/Icon/Icon.js +2 -3
- package/dist/esm/components/InputWrapper/useInputField.js +61 -0
- package/dist/esm/components/SideBar/SideBarAccordion/index.js +4 -3
- package/dist/esm/components/Slider/Slider.js +8 -5
- package/dist/esm/components/Tabs/Tabs.js +4 -3
- package/dist/esm/components/TextField/TextField.js +23 -56
- package/dist/esm/components/Textarea/Textarea.js +64 -33
- package/dist/esm/components/Typography/Typography.js +1 -15
- package/dist/esm/index.js +2 -0
- package/dist/types/components/InputWrapper/index.d.ts +5 -0
- package/dist/types/components/InputWrapper/types.d.ts +21 -0
- package/dist/types/components/InputWrapper/useInputField.d.ts +31 -0
- package/dist/types/components/TextField/TextField.d.ts +11 -0
- package/dist/types/components/Textarea/Textarea.d.ts +9 -0
- package/dist/types/{src/components → components}/Typography/Typography.d.ts +0 -13
- package/dist/types/{src/components → components}/Typography/Typography.new.d.ts +2 -6
- package/dist/types/{src/components → components}/Typography/Typography.new.types.d.ts +2 -2
- package/dist/types/{src/components → components}/Typography/Typography.stories.shared.d.ts +1 -22
- package/dist/types/{src/index.d.ts → index.d.ts} +1 -0
- package/package.json +6 -7
- package/dist/style.css +0 -81
- package/dist/style.js +0 -3
- package/dist/types/playwright.config.d.ts +0 -6
- package/dist/types/src/components/InputWrapper/index.d.ts +0 -2
- package/dist/types/src/components/TextField/TextField.d.ts +0 -31
- package/dist/types/src/components/Textarea/Textarea.d.ts +0 -30
- /package/dist/types/{src/components → components}/Accordion/Accordion.d.ts +0 -0
- /package/dist/types/{src/components → components}/Accordion/Accordion.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Accordion/Accordion.types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Accordion/AccordionHeader.d.ts +0 -0
- /package/dist/types/{src/components → components}/Accordion/AccordionHeaderActions.d.ts +0 -0
- /package/dist/types/{src/components → components}/Accordion/AccordionHeaderTitle.d.ts +0 -0
- /package/dist/types/{src/components → components}/Accordion/AccordionItem.d.ts +0 -0
- /package/dist/types/{src/components → components}/Accordion/AccordionPanel.d.ts +0 -0
- /package/dist/types/{src/components → components}/Accordion/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Autocomplete/AddNewOption.d.ts +0 -0
- /package/dist/types/{src/components → components}/Autocomplete/Autocomplete.d.ts +0 -0
- /package/dist/types/{src/components → components}/Autocomplete/Autocomplete.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Autocomplete/Option.d.ts +0 -0
- /package/dist/types/{src/components → components}/Autocomplete/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Avatar/Avatar.d.ts +0 -0
- /package/dist/types/{src/components → components}/Avatar/Avatar.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Avatar/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Banner/Banner.d.ts +0 -0
- /package/dist/types/{src/components → components}/Banner/Banner.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Banner/BannerActions.d.ts +0 -0
- /package/dist/types/{src/components → components}/Banner/BannerIcon.d.ts +0 -0
- /package/dist/types/{src/components → components}/Banner/BannerMessage.d.ts +0 -0
- /package/dist/types/{src/components → components}/Banner/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Breadcrumbs/Breadcrumb.d.ts +0 -0
- /package/dist/types/{src/components → components}/Breadcrumbs/Breadcrumbs.d.ts +0 -0
- /package/dist/types/{src/components → components}/Breadcrumbs/Breadcrumbs.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Breadcrumbs/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/Button.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/Button.types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/ButtonGroup/ButtonGroup.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/ButtonGroup/ButtonGroup.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/ButtonGroup/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/InnerFullWidth.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/ToggleButton/ToggleButton.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/ToggleButton/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/tokens/button.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/tokens/contained.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/tokens/contained_icon.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/tokens/ghost.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/tokens/icon.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/tokens/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Button/tokens/outlined.d.ts +0 -0
- /package/dist/types/{src/components → components}/Card/Card.d.ts +0 -0
- /package/dist/types/{src/components → components}/Card/Card.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Card/CardActions.d.ts +0 -0
- /package/dist/types/{src/components → components}/Card/CardContent.d.ts +0 -0
- /package/dist/types/{src/components → components}/Card/CardHeader.d.ts +0 -0
- /package/dist/types/{src/components → components}/Card/CardHeaderTitle.d.ts +0 -0
- /package/dist/types/{src/components → components}/Card/CardMedia.d.ts +0 -0
- /package/dist/types/{src/components → components}/Card/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Checkbox/Checkbox.d.ts +0 -0
- /package/dist/types/{src/components → components}/Checkbox/Checkbox.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Checkbox/Input.d.ts +0 -0
- /package/dist/types/{src/components → components}/Checkbox/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Chip/Chip.d.ts +0 -0
- /package/dist/types/{src/components → components}/Chip/Chip.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Chip/Icon.d.ts +0 -0
- /package/dist/types/{src/components → components}/Chip/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/DatePicker.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/DateRangePicker.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/calendars/Calendar.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/calendars/CalendarCell.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/calendars/CalendarGrid.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/calendars/CalendarHeader.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/calendars/CalendarWrapper.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/calendars/RangeCalendar.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/calendars/YearGrid.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/fields/DateField.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/fields/DateFieldSegments.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/fields/DateRangeField.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/fields/DateSegment.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/fields/FieldWrapper.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/fields/Toggle.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/props.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/utils/context.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/utils/get-calendar-date.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/utils/getPageYears.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/utils/types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/utils/useConvertedValidationFunctions.d.ts +0 -0
- /package/dist/types/{src/components → components}/Datepicker/utils/useGetLocale.d.ts +0 -0
- /package/dist/types/{src/components → components}/Dialog/Dialog.d.ts +0 -0
- /package/dist/types/{src/components → components}/Dialog/Dialog.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Dialog/DialogActions.d.ts +0 -0
- /package/dist/types/{src/components → components}/Dialog/DialogContent.d.ts +0 -0
- /package/dist/types/{src/components → components}/Dialog/DialogHeader.d.ts +0 -0
- /package/dist/types/{src/components → components}/Dialog/DialogTitle.d.ts +0 -0
- /package/dist/types/{src/components → components}/Dialog/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Divider/Divider.d.ts +0 -0
- /package/dist/types/{src/components → components}/Divider/Divider.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Divider/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/EdsProvider/eds.context.d.ts +0 -0
- /package/dist/types/{src/components → components}/EdsProvider/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Icon/Icon.d.ts +0 -0
- /package/dist/types/{src/components → components}/Icon/Icon.types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Icon/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Icon/library.d.ts +0 -0
- /package/dist/types/{src/components → components}/Input/Input.d.ts +0 -0
- /package/dist/types/{src/components → components}/Input/Input.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Input/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/InputWrapper/HelperText/HelperText.d.ts +0 -0
- /package/dist/types/{src/components → components}/InputWrapper/HelperText/HelperText.token.d.ts +0 -0
- /package/dist/types/{src/components → components}/InputWrapper/HelperText/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/InputWrapper/InputWrapper.d.ts +0 -0
- /package/dist/types/{src/components → components}/InputWrapper/InputWrapper.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Label/Label.d.ts +0 -0
- /package/dist/types/{src/components → components}/Label/Label.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Label/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/List/List.d.ts +0 -0
- /package/dist/types/{src/components → components}/List/List.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/List/ListItem.d.ts +0 -0
- /package/dist/types/{src/components → components}/List/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Menu/Menu.context.d.ts +0 -0
- /package/dist/types/{src/components → components}/Menu/Menu.d.ts +0 -0
- /package/dist/types/{src/components → components}/Menu/Menu.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Menu/Menu.types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Menu/MenuItem.d.ts +0 -0
- /package/dist/types/{src/components → components}/Menu/MenuList.d.ts +0 -0
- /package/dist/types/{src/components → components}/Menu/MenuSection.d.ts +0 -0
- /package/dist/types/{src/components → components}/Menu/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Pagination/Pagination.d.ts +0 -0
- /package/dist/types/{src/components → components}/Pagination/Pagination.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Pagination/PaginationItem.d.ts +0 -0
- /package/dist/types/{src/components → components}/Pagination/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Pagination/paginationControl.d.ts +0 -0
- /package/dist/types/{src/components → components}/Paper/Paper.d.ts +0 -0
- /package/dist/types/{src/components → components}/Paper/Paper.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Paper/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Popover/Popover.d.ts +0 -0
- /package/dist/types/{src/components → components}/Popover/Popover.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Popover/PopoverActions.d.ts +0 -0
- /package/dist/types/{src/components → components}/Popover/PopoverContent.d.ts +0 -0
- /package/dist/types/{src/components → components}/Popover/PopoverHeader.d.ts +0 -0
- /package/dist/types/{src/components → components}/Popover/PopoverTitle.d.ts +0 -0
- /package/dist/types/{src/components → components}/Popover/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/Circular/CircularProgress.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/Circular/CircularProgress.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/Dots/DotProgress.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/Dots/DotProgress.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/Linear/LinearProgress.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/Linear/LinearProgress.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/Star/StarProgress.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/Star/StarProgress.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Progress/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Radio/Radio.d.ts +0 -0
- /package/dist/types/{src/components → components}/Radio/Radio.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Radio/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Scrim/Scrim.d.ts +0 -0
- /package/dist/types/{src/components → components}/Scrim/Scrim.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Scrim/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Search/Search.d.ts +0 -0
- /package/dist/types/{src/components → components}/Search/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Select/NativeSelect.d.ts +0 -0
- /package/dist/types/{src/components → components}/Select/NativeSelect.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Select/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBar.context.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBar.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBar.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBarAccordion/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBarAccordionItem/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBarButton/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBarContent.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBarFooter.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SideBarToggle.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/SidebarLink/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideBar/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideSheet/SideSheet.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideSheet/SideSheet.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/SideSheet/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Slider/MinMax.d.ts +0 -0
- /package/dist/types/{src/components → components}/Slider/Output.d.ts +0 -0
- /package/dist/types/{src/components → components}/Slider/Slider.d.ts +0 -0
- /package/dist/types/{src/components → components}/Slider/Slider.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Slider/SliderInput.d.ts +0 -0
- /package/dist/types/{src/components → components}/Slider/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Snackbar/Snackbar.d.ts +0 -0
- /package/dist/types/{src/components → components}/Snackbar/Snackbar.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Snackbar/SnackbarAction.d.ts +0 -0
- /package/dist/types/{src/components → components}/Snackbar/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Switch/Switch.d.ts +0 -0
- /package/dist/types/{src/components → components}/Switch/Switch.styles.d.ts +0 -0
- /package/dist/types/{src/components → components}/Switch/Switch.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Switch/SwitchDefault.d.ts +0 -0
- /package/dist/types/{src/components → components}/Switch/SwitchSmall.d.ts +0 -0
- /package/dist/types/{src/components → components}/Switch/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Body.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Caption.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Cell.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/DataCell/DataCell.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/DataCell/DataCell.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/DataCell/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Foot/Foot.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Foot/Foot.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Foot/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/FooterCell/FooterCell.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/FooterCell/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Head/Head.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Head/Head.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Head/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/HeaderCell/HeaderCell.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/HeaderCell/HeaderCell.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/HeaderCell/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Inner.context.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Row/Row.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Row/Row.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Row/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Table.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/Table.types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Table/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/TableOfContents/LinkItem.d.ts +0 -0
- /package/dist/types/{src/components → components}/TableOfContents/TableOfContents.d.ts +0 -0
- /package/dist/types/{src/components → components}/TableOfContents/TableOfContents.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/TableOfContents/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/Tab.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/TabList.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/TabPanel.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/TabPanels.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/Tabs.context.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/Tabs.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/Tabs.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/Tabs.types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tabs/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/TextField/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Textarea/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tooltip/Tooltip.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tooltip/Tooltip.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Tooltip/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/TopBar/Actions.d.ts +0 -0
- /package/dist/types/{src/components → components}/TopBar/CustomContent.d.ts +0 -0
- /package/dist/types/{src/components → components}/TopBar/Header.d.ts +0 -0
- /package/dist/types/{src/components → components}/TopBar/TopBar.d.ts +0 -0
- /package/dist/types/{src/components → components}/TopBar/TopBar.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/TopBar/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Typography/Heading.d.ts +0 -0
- /package/dist/types/{src/components → components}/Typography/Heading.types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Typography/Paragraph.d.ts +0 -0
- /package/dist/types/{src/components → components}/Typography/Paragraph.types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Typography/Typography.tokens.d.ts +0 -0
- /package/dist/types/{src/components → components}/Typography/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Typography/types.d.ts +0 -0
- /package/dist/types/{src/components → components}/Typography/utils.d.ts +0 -0
- /package/dist/types/{src/components → components}/types.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, useMemo, useCallback,
|
|
1
|
+
import { forwardRef, useState, useMemo, useCallback, useRef, useImperativeHandle, useEffect } from 'react';
|
|
2
2
|
import { useMultipleSelection, useCombobox } from 'downshift';
|
|
3
3
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
import styled, { ThemeProvider, css } from 'styled-components';
|
|
@@ -158,6 +158,8 @@ const defaultOptionDisabled = () => false;
|
|
|
158
158
|
|
|
159
159
|
// MARK: component
|
|
160
160
|
function AutocompleteInner(props, ref) {
|
|
161
|
+
const [controlledHighlightedIndex, setControlledHighlightedIndex] = useState(0);
|
|
162
|
+
const [lastScrollOffset, setLastScrollOffset] = useState(0);
|
|
161
163
|
const {
|
|
162
164
|
options = [],
|
|
163
165
|
totalOptions,
|
|
@@ -229,6 +231,7 @@ function AutocompleteInner(props, ref) {
|
|
|
229
231
|
if (onAddNewOption) return [AddSymbol, ..._availableItems];
|
|
230
232
|
return _availableItems;
|
|
231
233
|
}, [_availableItems, showSelectAll, onAddNewOption]);
|
|
234
|
+
const getSelectedIndex = useCallback(selectedItem => availableItems.findIndex(item => itemCompare ? itemCompare(item, selectedItem) : item === selectedItem), [availableItems, itemCompare]);
|
|
232
235
|
|
|
233
236
|
//issue 2304, update dataset when options are added dynamically
|
|
234
237
|
useEffect(() => {
|
|
@@ -366,20 +369,18 @@ function AutocompleteInner(props, ref) {
|
|
|
366
369
|
}));
|
|
367
370
|
},
|
|
368
371
|
onHighlightedIndexChange({
|
|
369
|
-
highlightedIndex
|
|
370
|
-
type
|
|
372
|
+
highlightedIndex
|
|
371
373
|
}) {
|
|
372
|
-
if (
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
if (highlightedIndex >= 0 && rowVirtualizer.getVirtualItems) {
|
|
375
|
+
const visibleIndexes = rowVirtualizer.getVirtualItems().map(v => v.index);
|
|
376
|
+
if (!visibleIndexes.includes(highlightedIndex)) {
|
|
375
377
|
rowVirtualizer.scrollToIndex(highlightedIndex, {
|
|
376
378
|
align: allowSelectAll ? 'center' : 'auto'
|
|
377
379
|
});
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (typeof rowVirtualizer.scrollOffset === 'number') {
|
|
383
|
+
setLastScrollOffset(rowVirtualizer.scrollOffset);
|
|
383
384
|
}
|
|
384
385
|
},
|
|
385
386
|
onIsOpenChange: ({
|
|
@@ -387,6 +388,19 @@ function AutocompleteInner(props, ref) {
|
|
|
387
388
|
}) => {
|
|
388
389
|
if (!multiple && selectedItem !== null) {
|
|
389
390
|
setAvailableItems(options);
|
|
391
|
+
setTimeout(() => {
|
|
392
|
+
if (controlledHighlightedIndex === 0) {
|
|
393
|
+
rowVirtualizer.scrollToOffset?.(0);
|
|
394
|
+
} else if (rowVirtualizer.scrollToOffset && lastScrollOffset > 0) {
|
|
395
|
+
rowVirtualizer.scrollToOffset(lastScrollOffset);
|
|
396
|
+
}
|
|
397
|
+
const visibleIndexes = rowVirtualizer.getVirtualItems?.().map(v => v.index) || [];
|
|
398
|
+
if (!visibleIndexes.includes(controlledHighlightedIndex)) {
|
|
399
|
+
rowVirtualizer.scrollToIndex(controlledHighlightedIndex, {
|
|
400
|
+
align: allowSelectAll ? 'center' : 'auto'
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}, 10);
|
|
390
404
|
}
|
|
391
405
|
},
|
|
392
406
|
onStateChange: ({
|
|
@@ -426,6 +440,8 @@ function AutocompleteInner(props, ref) {
|
|
|
426
440
|
...comboBoxProps,
|
|
427
441
|
onSelectedItemChange: changes => {
|
|
428
442
|
if (changes.selectedItem === AddSymbol) return;
|
|
443
|
+
const idx = getSelectedIndex(changes.selectedItem);
|
|
444
|
+
setControlledHighlightedIndex(idx >= 0 ? idx : 0);
|
|
429
445
|
if (onOptionsChange) {
|
|
430
446
|
let {
|
|
431
447
|
selectedItem
|
|
@@ -438,7 +454,7 @@ function AutocompleteInner(props, ref) {
|
|
|
438
454
|
});
|
|
439
455
|
}
|
|
440
456
|
},
|
|
441
|
-
stateReducer: (
|
|
457
|
+
stateReducer: (state, actionAndChanges) => {
|
|
442
458
|
const {
|
|
443
459
|
changes,
|
|
444
460
|
type
|
|
@@ -447,19 +463,25 @@ function AutocompleteInner(props, ref) {
|
|
|
447
463
|
case useCombobox.stateChangeTypes.InputClick:
|
|
448
464
|
return {
|
|
449
465
|
...changes,
|
|
450
|
-
isOpen: !(disabled || readOnly)
|
|
466
|
+
isOpen: !(disabled || readOnly),
|
|
467
|
+
highlightedIndex: controlledHighlightedIndex
|
|
451
468
|
};
|
|
452
469
|
case useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
453
470
|
case useCombobox.stateChangeTypes.ItemClick:
|
|
454
|
-
|
|
471
|
+
{
|
|
472
|
+
if (changes.selectedItem === AddSymbol) {
|
|
473
|
+
return {
|
|
474
|
+
...changes,
|
|
475
|
+
inputValue: ''
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
const idx = getSelectedIndex(changes.selectedItem);
|
|
479
|
+
setControlledHighlightedIndex(idx >= 0 ? idx : 0);
|
|
455
480
|
return {
|
|
456
481
|
...changes,
|
|
457
|
-
|
|
482
|
+
highlightedIndex: idx >= 0 ? idx : 0
|
|
458
483
|
};
|
|
459
484
|
}
|
|
460
|
-
return {
|
|
461
|
-
...changes
|
|
462
|
-
};
|
|
463
485
|
case useCombobox.stateChangeTypes.InputBlur:
|
|
464
486
|
return {
|
|
465
487
|
...changes,
|
|
@@ -471,13 +493,19 @@ function AutocompleteInner(props, ref) {
|
|
|
471
493
|
...changes
|
|
472
494
|
};
|
|
473
495
|
case useCombobox.stateChangeTypes.InputKeyDownArrowDown:
|
|
474
|
-
case useCombobox.stateChangeTypes.InputKeyDownHome:
|
|
475
496
|
if (readOnly) {
|
|
476
497
|
return {
|
|
477
498
|
...changes,
|
|
478
499
|
isOpen: false
|
|
479
500
|
};
|
|
480
501
|
}
|
|
502
|
+
if (state.isOpen === false) {
|
|
503
|
+
return {
|
|
504
|
+
...changes,
|
|
505
|
+
isOpen: true,
|
|
506
|
+
highlightedIndex: controlledHighlightedIndex
|
|
507
|
+
};
|
|
508
|
+
}
|
|
481
509
|
return {
|
|
482
510
|
...changes,
|
|
483
511
|
highlightedIndex: findNextIndex({
|
|
@@ -487,14 +515,36 @@ function AutocompleteInner(props, ref) {
|
|
|
487
515
|
allDisabled
|
|
488
516
|
})
|
|
489
517
|
};
|
|
518
|
+
case useCombobox.stateChangeTypes.InputKeyDownHome:
|
|
519
|
+
if (readOnly) {
|
|
520
|
+
return {
|
|
521
|
+
...changes,
|
|
522
|
+
isOpen: false
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
return {
|
|
526
|
+
...changes,
|
|
527
|
+
highlightedIndex: findNextIndex({
|
|
528
|
+
index: 0,
|
|
529
|
+
availableItems,
|
|
530
|
+
optionDisabled,
|
|
531
|
+
allDisabled
|
|
532
|
+
})
|
|
533
|
+
};
|
|
490
534
|
case useCombobox.stateChangeTypes.InputKeyDownArrowUp:
|
|
491
|
-
case useCombobox.stateChangeTypes.InputKeyDownEnd:
|
|
492
535
|
if (readOnly) {
|
|
493
536
|
return {
|
|
494
537
|
...changes,
|
|
495
538
|
isOpen: false
|
|
496
539
|
};
|
|
497
540
|
}
|
|
541
|
+
if (state.isOpen === false) {
|
|
542
|
+
return {
|
|
543
|
+
...changes,
|
|
544
|
+
isOpen: true,
|
|
545
|
+
highlightedIndex: controlledHighlightedIndex
|
|
546
|
+
};
|
|
547
|
+
}
|
|
498
548
|
return {
|
|
499
549
|
...changes,
|
|
500
550
|
highlightedIndex: findPrevIndex({
|
|
@@ -504,10 +554,27 @@ function AutocompleteInner(props, ref) {
|
|
|
504
554
|
allDisabled
|
|
505
555
|
})
|
|
506
556
|
};
|
|
557
|
+
case useCombobox.stateChangeTypes.InputKeyDownEnd:
|
|
558
|
+
if (readOnly) {
|
|
559
|
+
return {
|
|
560
|
+
...changes,
|
|
561
|
+
isOpen: false
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
return {
|
|
565
|
+
...changes,
|
|
566
|
+
highlightedIndex: findPrevIndex({
|
|
567
|
+
index: availableItems.length - 1,
|
|
568
|
+
availableItems,
|
|
569
|
+
optionDisabled,
|
|
570
|
+
allDisabled
|
|
571
|
+
})
|
|
572
|
+
};
|
|
507
573
|
case useCombobox.stateChangeTypes.ControlledPropUpdatedSelectedItem:
|
|
508
574
|
setSelectedItems([changes.selectedItem]);
|
|
509
575
|
return {
|
|
510
|
-
...changes
|
|
576
|
+
...changes,
|
|
577
|
+
highlightedIndex: controlledHighlightedIndex
|
|
511
578
|
};
|
|
512
579
|
default:
|
|
513
580
|
return changes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { tokens } from '@equinor/eds-tokens';
|
|
3
|
-
import { forwardRef, useEffect } from 'react';
|
|
3
|
+
import { forwardRef, useState, useEffect } from 'react';
|
|
4
4
|
import { Popover } from '../../Popover/index.js';
|
|
5
5
|
import { filterDOMProps } from '@react-aria/utils';
|
|
6
6
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -101,6 +101,12 @@ const FieldWrapper = /*#__PURE__*/forwardRef(({
|
|
|
101
101
|
readonly,
|
|
102
102
|
...props
|
|
103
103
|
}, ref) => {
|
|
104
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (ref && typeof ref !== 'function' && ref.current) {
|
|
107
|
+
setAnchorEl(ref.current);
|
|
108
|
+
}
|
|
109
|
+
}, [ref]);
|
|
104
110
|
useEffect(() => {
|
|
105
111
|
if (isOpen === false) {
|
|
106
112
|
// Focus the first segment in the input field
|
|
@@ -123,7 +129,7 @@ const FieldWrapper = /*#__PURE__*/forwardRef(({
|
|
|
123
129
|
}), /*#__PURE__*/jsx(Popover, {
|
|
124
130
|
open: isOpen ?? false,
|
|
125
131
|
onClose: () => setIsOpen(false),
|
|
126
|
-
anchorEl:
|
|
132
|
+
anchorEl: anchorEl,
|
|
127
133
|
placement: 'bottom-start',
|
|
128
134
|
children: calendar
|
|
129
135
|
})]
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { useId } from '
|
|
2
|
-
import { forwardRef } from 'react';
|
|
1
|
+
import { forwardRef, useId } from 'react';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import { get } from './library.js';
|
|
5
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -72,7 +71,7 @@ const Icon = /*#__PURE__*/forwardRef(function Icon({
|
|
|
72
71
|
};
|
|
73
72
|
|
|
74
73
|
// Accessibility
|
|
75
|
-
const titleId = useId(
|
|
74
|
+
const titleId = useId();
|
|
76
75
|
if (title) {
|
|
77
76
|
svgProps = {
|
|
78
77
|
...svgProps,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useId } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared hook for TextField and Textarea that handles common logic
|
|
5
|
+
* for IDs, labels, helper text, and ARIA attributes
|
|
6
|
+
*/
|
|
7
|
+
const useInputField = ({
|
|
8
|
+
id,
|
|
9
|
+
label,
|
|
10
|
+
meta,
|
|
11
|
+
helperText,
|
|
12
|
+
helperIcon,
|
|
13
|
+
variant,
|
|
14
|
+
disabled,
|
|
15
|
+
className,
|
|
16
|
+
style
|
|
17
|
+
}) => {
|
|
18
|
+
const generatedFieldId = useId();
|
|
19
|
+
const generatedHelperTextId = useId();
|
|
20
|
+
|
|
21
|
+
// Use provided ID or fall back to generated one
|
|
22
|
+
const fieldId = id ?? generatedFieldId;
|
|
23
|
+
const helperTextId = generatedHelperTextId;
|
|
24
|
+
const hasHelperText = Boolean(helperText);
|
|
25
|
+
const containerProps = {
|
|
26
|
+
className,
|
|
27
|
+
style: {
|
|
28
|
+
width: '100%',
|
|
29
|
+
...style
|
|
30
|
+
},
|
|
31
|
+
color: variant
|
|
32
|
+
};
|
|
33
|
+
const labelProps = {
|
|
34
|
+
htmlFor: fieldId,
|
|
35
|
+
label,
|
|
36
|
+
meta,
|
|
37
|
+
disabled
|
|
38
|
+
};
|
|
39
|
+
const helperProps = {
|
|
40
|
+
id: hasHelperText ? helperTextId : null,
|
|
41
|
+
text: helperText,
|
|
42
|
+
icon: helperIcon
|
|
43
|
+
};
|
|
44
|
+
const ariaProps = {
|
|
45
|
+
id: fieldId,
|
|
46
|
+
'aria-invalid': variant === 'error' || undefined,
|
|
47
|
+
...(hasHelperText && {
|
|
48
|
+
'aria-describedby': helperTextId
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
fieldId,
|
|
53
|
+
helperTextId: hasHelperText ? helperTextId : null,
|
|
54
|
+
containerProps,
|
|
55
|
+
labelProps,
|
|
56
|
+
helperProps,
|
|
57
|
+
ariaProps
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { useInputField };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { forwardRef, useState, useMemo, Children } from 'react';
|
|
1
|
+
import { forwardRef, useId, useState, useMemo, Children } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import {
|
|
3
|
+
import { mergeRefs, bordersTemplate, outlineTemplate } from '@equinor/eds-utils';
|
|
4
4
|
import { chevron_up, chevron_down, arrow_drop_down } from '@equinor/eds-icons';
|
|
5
5
|
import { useSideBar } from '../SideBar.context.js';
|
|
6
6
|
import { sidebar } from '../SideBar.tokens.js';
|
|
@@ -104,7 +104,8 @@ const SideBarAccordion = /*#__PURE__*/forwardRef(function SideBarAccordion({
|
|
|
104
104
|
disabled,
|
|
105
105
|
...rest
|
|
106
106
|
}, ref) {
|
|
107
|
-
const
|
|
107
|
+
const generatedAccordionId = useId();
|
|
108
|
+
const accordionId = id ?? generatedAccordionId;
|
|
108
109
|
const [menuIsOpen, setMenuIsOpen] = useState(false);
|
|
109
110
|
const [accordionIsOpen, setAccordionIsOpen] = useState(isExpanded);
|
|
110
111
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { forwardRef, useState, useEffect, useRef, useCallback } from 'react';
|
|
1
|
+
import { forwardRef, useState, useEffect, useRef, useId, useCallback } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { slider } from './Slider.tokens.js';
|
|
4
4
|
import { MinMax } from './MinMax.js';
|
|
5
5
|
import { Output } from './Output.js';
|
|
6
6
|
import { SliderInput } from './SliderInput.js';
|
|
7
|
-
import {
|
|
7
|
+
import { bordersTemplate } from '@equinor/eds-utils';
|
|
8
8
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
const {
|
|
@@ -216,9 +216,12 @@ const Slider = /*#__PURE__*/forwardRef(function Slider({
|
|
|
216
216
|
setMousePressed(false);
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
const generatedInputIdA = useId();
|
|
220
|
+
const generatedInputIdB = useId();
|
|
221
|
+
const generatedInputId = useId();
|
|
222
|
+
let inputIdA = generatedInputIdA;
|
|
223
|
+
let inputIdB = generatedInputIdB;
|
|
224
|
+
let inputId = generatedInputId;
|
|
222
225
|
if (rest['id']) {
|
|
223
226
|
const overrideId = rest['id'];
|
|
224
227
|
inputIdA = `${overrideId}-thumb-a`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { forwardRef, useRef, useMemo, useState, useEffect } from 'react';
|
|
1
|
+
import { forwardRef, useId, useRef, useMemo, useState, useEffect } from 'react';
|
|
2
2
|
import { TabsProvider } from './Tabs.context.js';
|
|
3
3
|
import { token } from './Tabs.tokens.js';
|
|
4
|
-
import {
|
|
4
|
+
import { mergeRefs, useToken } from '@equinor/eds-utils';
|
|
5
5
|
import { ThemeProvider } from 'styled-components';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
@@ -16,7 +16,8 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs({
|
|
|
16
16
|
id,
|
|
17
17
|
...props
|
|
18
18
|
}, ref) {
|
|
19
|
-
const
|
|
19
|
+
const generatedTabsId = useId();
|
|
20
|
+
const tabsId = id ?? generatedTabsId;
|
|
20
21
|
const tabsRef = useRef(null);
|
|
21
22
|
const combinedTabsRef = useMemo(() => mergeRefs(tabsRef, ref), [tabsRef, ref]);
|
|
22
23
|
const [tabsFocused, setTabsFocused] = useState(false);
|
|
@@ -1,93 +1,60 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useInputField } from '../InputWrapper/useInputField.js';
|
|
4
4
|
import { InputWrapper } from '../InputWrapper/InputWrapper.js';
|
|
5
|
-
import { Textarea } from '../Textarea/Textarea.js';
|
|
6
5
|
import { Input } from '../Input/Input.js';
|
|
7
6
|
|
|
8
|
-
/** Proxy component for working around typescript and element type switching */
|
|
9
|
-
const Field = /*#__PURE__*/forwardRef(function Field(props, ref) {
|
|
10
|
-
return props.$multiline ? /*#__PURE__*/jsx(Textarea, {
|
|
11
|
-
ref: ref,
|
|
12
|
-
...props
|
|
13
|
-
}) : /*#__PURE__*/jsx(Input, {
|
|
14
|
-
ref: ref,
|
|
15
|
-
...props
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
7
|
const TextField = /*#__PURE__*/forwardRef(function TextField({
|
|
19
|
-
id
|
|
8
|
+
id,
|
|
20
9
|
label,
|
|
21
10
|
meta,
|
|
22
11
|
unit,
|
|
23
12
|
helperText,
|
|
24
13
|
placeholder,
|
|
25
14
|
disabled,
|
|
26
|
-
multiline = false,
|
|
27
15
|
className,
|
|
28
16
|
variant,
|
|
29
17
|
inputIcon,
|
|
30
18
|
helperIcon,
|
|
31
19
|
style,
|
|
32
|
-
rowsMax,
|
|
33
|
-
textareaRef,
|
|
34
20
|
inputRef,
|
|
35
21
|
...other
|
|
36
22
|
}, ref) {
|
|
37
|
-
const
|
|
38
|
-
|
|
23
|
+
const {
|
|
24
|
+
ariaProps,
|
|
25
|
+
containerProps,
|
|
26
|
+
labelProps,
|
|
27
|
+
helperProps
|
|
28
|
+
} = useInputField({
|
|
29
|
+
id,
|
|
30
|
+
label,
|
|
31
|
+
meta,
|
|
32
|
+
helperText,
|
|
33
|
+
helperIcon,
|
|
34
|
+
variant,
|
|
35
|
+
disabled,
|
|
36
|
+
className,
|
|
37
|
+
style
|
|
38
|
+
});
|
|
39
39
|
const hasRightAdornments = Boolean(unit || inputIcon);
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const fieldProps = {
|
|
41
|
+
...ariaProps,
|
|
42
42
|
disabled,
|
|
43
43
|
placeholder,
|
|
44
|
-
id,
|
|
45
44
|
variant,
|
|
46
45
|
rightAdornments: hasRightAdornments && /*#__PURE__*/jsxs(Fragment, {
|
|
47
46
|
children: [inputIcon, /*#__PURE__*/jsx("span", {
|
|
48
47
|
children: unit
|
|
49
48
|
})]
|
|
50
49
|
}),
|
|
51
|
-
|
|
52
|
-
ref: ref || inputRef || textareaRef,
|
|
53
|
-
$multiline: multiline,
|
|
50
|
+
ref: ref || inputRef,
|
|
54
51
|
...other
|
|
55
52
|
};
|
|
56
|
-
let helperProps = {
|
|
57
|
-
id: null,
|
|
58
|
-
text: helperText,
|
|
59
|
-
icon: helperIcon,
|
|
60
|
-
disabled
|
|
61
|
-
};
|
|
62
|
-
const containerProps = {
|
|
63
|
-
className,
|
|
64
|
-
style: {
|
|
65
|
-
width: '100%',
|
|
66
|
-
...style
|
|
67
|
-
},
|
|
68
|
-
color: variant
|
|
69
|
-
};
|
|
70
|
-
const labelProps = {
|
|
71
|
-
htmlFor: id,
|
|
72
|
-
label,
|
|
73
|
-
meta,
|
|
74
|
-
disabled
|
|
75
|
-
};
|
|
76
|
-
if (helperText) {
|
|
77
|
-
fieldProps = {
|
|
78
|
-
'aria-describedby': helperTextId,
|
|
79
|
-
...fieldProps
|
|
80
|
-
};
|
|
81
|
-
helperProps = {
|
|
82
|
-
...helperProps,
|
|
83
|
-
id: helperTextId
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
53
|
return /*#__PURE__*/jsx(InputWrapper, {
|
|
87
54
|
helperProps: helperProps,
|
|
88
55
|
labelProps: labelProps,
|
|
89
56
|
...containerProps,
|
|
90
|
-
children: /*#__PURE__*/jsx(
|
|
57
|
+
children: /*#__PURE__*/jsx(Input, {
|
|
91
58
|
...fieldProps
|
|
92
59
|
})
|
|
93
60
|
});
|
|
@@ -1,22 +1,58 @@
|
|
|
1
|
-
import { forwardRef,
|
|
1
|
+
import { forwardRef, useMemo } from 'react';
|
|
2
2
|
import * as Input_tokens from '../Input/Input.tokens.js';
|
|
3
3
|
import { input as input$1 } from '../Input/Input.tokens.js';
|
|
4
4
|
import { useAutoResize, mergeRefs } from '@equinor/eds-utils';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
import {
|
|
6
|
+
import { useInputField } from '../InputWrapper/useInputField.js';
|
|
7
|
+
import { InputWrapper } from '../InputWrapper/InputWrapper.js';
|
|
7
8
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
|
+
import { Input } from '../Input/Input.js';
|
|
8
10
|
|
|
9
11
|
const {
|
|
10
12
|
input
|
|
11
13
|
} = Input_tokens;
|
|
14
|
+
const leftAdornmentStyles = {
|
|
15
|
+
style: {
|
|
16
|
+
alignItems: 'flex-start'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const rightAdornmentStyles = {
|
|
20
|
+
style: {
|
|
21
|
+
alignItems: 'flex-start',
|
|
22
|
+
pointerEvents: 'none'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
12
25
|
const Textarea = /*#__PURE__*/forwardRef(function Textarea({
|
|
26
|
+
id,
|
|
27
|
+
label,
|
|
28
|
+
meta,
|
|
29
|
+
helperText,
|
|
30
|
+
placeholder,
|
|
31
|
+
disabled,
|
|
32
|
+
className,
|
|
13
33
|
variant,
|
|
14
|
-
|
|
15
|
-
|
|
34
|
+
inputIcon,
|
|
35
|
+
helperIcon,
|
|
36
|
+
style,
|
|
16
37
|
rowsMax,
|
|
17
38
|
...other
|
|
18
39
|
}, ref) {
|
|
19
|
-
const
|
|
40
|
+
const {
|
|
41
|
+
ariaProps,
|
|
42
|
+
containerProps,
|
|
43
|
+
labelProps,
|
|
44
|
+
helperProps
|
|
45
|
+
} = useInputField({
|
|
46
|
+
id,
|
|
47
|
+
label,
|
|
48
|
+
meta,
|
|
49
|
+
helperText,
|
|
50
|
+
helperIcon,
|
|
51
|
+
variant,
|
|
52
|
+
disabled,
|
|
53
|
+
className,
|
|
54
|
+
style
|
|
55
|
+
});
|
|
20
56
|
const {
|
|
21
57
|
density
|
|
22
58
|
} = useEds();
|
|
@@ -28,40 +64,35 @@ const Textarea = /*#__PURE__*/forwardRef(function Textarea({
|
|
|
28
64
|
top,
|
|
29
65
|
bottom
|
|
30
66
|
} = spacings;
|
|
31
|
-
|
|
32
|
-
if
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
ref: combinedRef,
|
|
41
|
-
type,
|
|
67
|
+
|
|
68
|
+
// Calculate maxHeight if rowsMax is provided
|
|
69
|
+
// Using default fontSize of 16px for initial calculation
|
|
70
|
+
// useAutoResize will handle actual resizing based on element's scrollHeight
|
|
71
|
+
const maxHeight = rowsMax ? parseFloat(lineHeight) * 16 * rowsMax + parseInt(top) + parseInt(bottom) : null;
|
|
72
|
+
const autoResizeRef = useAutoResize(maxHeight);
|
|
73
|
+
const combinedRef = useMemo(() => mergeRefs(ref, autoResizeRef), [ref, autoResizeRef]);
|
|
74
|
+
const fieldProps = {
|
|
75
|
+
...ariaProps,
|
|
42
76
|
disabled,
|
|
77
|
+
placeholder,
|
|
43
78
|
variant,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const leftAdornmentStyles = {
|
|
47
|
-
style: {
|
|
48
|
-
alignItems: 'flex-start'
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const rigthAdornmentStyles = {
|
|
52
|
-
style: {
|
|
53
|
-
alignItems: 'flex-start',
|
|
54
|
-
pointerEvents: 'none'
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
return /*#__PURE__*/jsx(Input, {
|
|
58
|
-
as: "textarea",
|
|
59
|
-
rightAdornmentsProps: rigthAdornmentStyles,
|
|
79
|
+
rightAdornments: inputIcon,
|
|
80
|
+
rightAdornmentsProps: rightAdornmentStyles,
|
|
60
81
|
leftAdornmentsProps: leftAdornmentStyles,
|
|
82
|
+
as: 'textarea',
|
|
83
|
+
ref: combinedRef,
|
|
61
84
|
style: {
|
|
62
85
|
height: 'auto'
|
|
63
86
|
},
|
|
64
|
-
...
|
|
87
|
+
...other
|
|
88
|
+
};
|
|
89
|
+
return /*#__PURE__*/jsx(InputWrapper, {
|
|
90
|
+
helperProps: helperProps,
|
|
91
|
+
labelProps: labelProps,
|
|
92
|
+
...containerProps,
|
|
93
|
+
children: /*#__PURE__*/jsx(Input, {
|
|
94
|
+
...fieldProps
|
|
95
|
+
})
|
|
65
96
|
});
|
|
66
97
|
});
|
|
67
98
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import {
|
|
3
|
+
import { typographyTemplate, outlineTemplate } from '@equinor/eds-utils';
|
|
4
4
|
import { quickVariants, typography, colors, link } from './Typography.tokens.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -53,19 +53,6 @@ const StyledTypography = styled.p.withConfig({
|
|
|
53
53
|
}) => $lines && css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], $lines), ({
|
|
54
54
|
$link
|
|
55
55
|
}) => $link && css(["&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], outlineTemplate(link.states.focus.outline), outlineTemplate(link.states.focus.outline)));
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated Typography component is deprecated and will be removed in a future version.
|
|
58
|
-
* Please use the new Typography, Heading, or Paragraph components instead.
|
|
59
|
-
*
|
|
60
|
-
* Migration guide:
|
|
61
|
-
* - For headings: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
|
|
62
|
-
* - For paragraphs: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
|
|
63
|
-
* - For inline text: Use `<Typography>` for more flexible text styling
|
|
64
|
-
*
|
|
65
|
-
* @see {@link TypographyNext}
|
|
66
|
-
* @see {@link Heading}
|
|
67
|
-
* @see {@link Paragraph}
|
|
68
|
-
*/
|
|
69
56
|
const Typography = /*#__PURE__*/forwardRef(function Typography({
|
|
70
57
|
variant = 'body_short',
|
|
71
58
|
children,
|
|
@@ -79,7 +66,6 @@ const Typography = /*#__PURE__*/forwardRef(function Typography({
|
|
|
79
66
|
as: providedAs,
|
|
80
67
|
...other
|
|
81
68
|
}, ref) {
|
|
82
|
-
useDeprecationWarning('The Typography component is deprecated and will be removed in a future version. ' + 'Please migrate to the new TypographyNext, Heading, or Paragraph component. ' + 'See the documentation for migration details.', 'Typography');
|
|
83
69
|
const as = providedAs ? providedAs : getElementType(variant, link);
|
|
84
70
|
const variantName = toVariantName(variant, bold, italic, link);
|
|
85
71
|
const typography = findTypography(variantName, group);
|
package/dist/esm/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { Row as TableRow } from './components/Table/Row/Row.js';
|
|
|
30
30
|
export { Caption as TableCaption } from './components/Table/Caption.js';
|
|
31
31
|
export { Divider } from './components/Divider/Divider.js';
|
|
32
32
|
export { TextField } from './components/TextField/TextField.js';
|
|
33
|
+
export { Textarea } from './components/Textarea/Textarea.js';
|
|
33
34
|
export { ListItem } from './components/List/ListItem.js';
|
|
34
35
|
export { AccordionItem } from './components/Accordion/AccordionItem.js';
|
|
35
36
|
export { AccordionHeader } from './components/Accordion/AccordionHeader.js';
|
|
@@ -86,6 +87,7 @@ export { EdsProvider, useEds } from './components/EdsProvider/eds.context.js';
|
|
|
86
87
|
export { Paper } from './components/Paper/Paper.js';
|
|
87
88
|
export { Autocomplete } from './components/Autocomplete/Autocomplete.js';
|
|
88
89
|
export { InputWrapper } from './components/InputWrapper/InputWrapper.js';
|
|
90
|
+
export { useInputField } from './components/InputWrapper/useInputField.js';
|
|
89
91
|
export { useSideBar } from './components/SideBar/SideBar.context.js';
|
|
90
92
|
export { SidebarLink } from './components/SideBar/SidebarLink/index.js';
|
|
91
93
|
export { SideBarContent } from './components/SideBar/SideBarContent.js';
|