@equinor/eds-core-react 2.3.5 → 2.3.6
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/build/index.css +121 -248
- package/build/index.min.css +1 -5
- package/dist/eds-core-react.cjs +39 -20
- package/dist/esm/components/Autocomplete/AddNewOption.js +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/esm/components/Autocomplete/Option.js +11 -2
- package/dist/esm/components/Autocomplete/SelectAllOption.js +1 -1
- package/dist/esm/components/Autocomplete/useAutocomplete.js +13 -2
- package/dist/esm/components/Banner/Banner.tokens.js +2 -10
- package/dist/esm/components/Chip/Chip.js +1 -1
- package/dist/esm/components/Chip/Chip.tokens.js +0 -2
- package/dist/esm/components/Datepicker/fields/DateFieldSegments.js +11 -2
- package/dist/esm/components/Datepicker/utils/get-calendar-date.js +1 -1
- package/dist/esm/components/EdsProvider/eds.context.js +1 -1
- package/dist/esm/components/Menu/Menu.context.js +1 -1
- package/dist/esm/components/SideBar/SideBar.context.js +1 -1
- package/dist/esm/components/Typography/Typography.js +1 -1
- package/dist/esm/index.js +64 -64
- package/dist/esm-next/components/next/Button/Button.js +3 -5
- package/dist/esm-next/components/next/Input/Input.js +6 -11
- package/dist/esm-next/index.next.js +4 -4
- package/dist/index.next.cjs +9 -16
- package/dist/types/components/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/types/components/Autocomplete/AutocompleteContext.d.ts +2 -2
- package/dist/types/components/Autocomplete/useAutocomplete.d.ts +3 -2
- package/dist/types/components/Datepicker/DateRangePicker.d.ts +1 -1
- package/dist/types/components/SideBar/SideBarButton/index.d.ts +1 -1
- package/dist/types/components/next/Input/Input.types.d.ts +6 -4
- package/dist/types/components/next/TextField/TextField.d.ts +1 -0
- package/package.json +32 -32
|
@@ -48,7 +48,9 @@ function Option({
|
|
|
48
48
|
const isSelected = selectedItemsLabels.includes(label);
|
|
49
49
|
const optionComponent = _optionComponent?.(item, isSelected);
|
|
50
50
|
const highlighted = highlightedIndex === index && !isDisabled ? 'true' : 'false';
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
// Guard: downshift 9.x validates that item exists in the items array
|
|
53
|
+
const itemProps = item !== undefined ? getItemProps({
|
|
52
54
|
...(multiline && {
|
|
53
55
|
ref: rowVirtualizer.measureElement
|
|
54
56
|
}),
|
|
@@ -60,7 +62,14 @@ function Option({
|
|
|
60
62
|
height: `${virtualItem.size}px`
|
|
61
63
|
})
|
|
62
64
|
}
|
|
63
|
-
})
|
|
65
|
+
}) : {
|
|
66
|
+
style: {
|
|
67
|
+
transform: `translateY(${virtualItem.start}px)`,
|
|
68
|
+
...(!multiline && {
|
|
69
|
+
height: `${virtualItem.size}px`
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
};
|
|
64
73
|
return /*#__PURE__*/jsxs(StyledListItem, {
|
|
65
74
|
$isdisabled: isDisabled ? 'true' : 'false',
|
|
66
75
|
$highlighted: highlighted,
|
|
@@ -112,7 +112,13 @@ const useAutocomplete = ({
|
|
|
112
112
|
...multipleSelectionProps,
|
|
113
113
|
onSelectedItemsChange: changes => {
|
|
114
114
|
if (onOptionsChange) {
|
|
115
|
-
|
|
115
|
+
// AddSymbol/AllSymbol are handled manually in onStateChange,
|
|
116
|
+
// so skip propagating when they appear in selectedItems
|
|
117
|
+
// (downshift 9.x propagates selectedItem to useMultipleSelection)
|
|
118
|
+
if (changes.selectedItems.some(item => item === AllSymbol || item === AddSymbol)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
let selectedItems = changes.selectedItems;
|
|
116
122
|
if (itemCompare) {
|
|
117
123
|
selectedItems = inputOptions.filter(item => selectedItems.some(compare => itemCompare(item, compare)));
|
|
118
124
|
}
|
|
@@ -269,6 +275,9 @@ const useAutocomplete = ({
|
|
|
269
275
|
toggleAllSelected();
|
|
270
276
|
} else if (selectedItem === AddSymbol && typedInputValue.trim()) {
|
|
271
277
|
onAddNewOption?.(typedInputValue);
|
|
278
|
+
if (clearSearchOnChange) {
|
|
279
|
+
setTypedInputValue('');
|
|
280
|
+
}
|
|
272
281
|
} else if (multiple) {
|
|
273
282
|
const shouldRemove = itemCompare ? selectedItems.some(i => itemCompare(selectedItem, i)) : selectedItems.includes(selectedItem);
|
|
274
283
|
if (shouldRemove) {
|
|
@@ -494,7 +503,9 @@ const useAutocomplete = ({
|
|
|
494
503
|
};
|
|
495
504
|
case useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
496
505
|
case useCombobox.stateChangeTypes.ItemClick:
|
|
497
|
-
|
|
506
|
+
// Don't clear typedInputValue for AddSymbol — onStateChange needs
|
|
507
|
+
// it to call onAddNewOption (downshift 9.x runs onStateChange after re-render)
|
|
508
|
+
if (clearSearchOnChange && changes.selectedItem !== AddSymbol) {
|
|
498
509
|
setTypedInputValue('');
|
|
499
510
|
}
|
|
500
511
|
return {
|
|
@@ -74,11 +74,7 @@ const info = {
|
|
|
74
74
|
color: infoColor
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
}
|
|
78
|
-
modes: {
|
|
79
|
-
compact: {}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
77
|
+
}};
|
|
82
78
|
const warning = {
|
|
83
79
|
entities: {
|
|
84
80
|
icon: {
|
|
@@ -87,10 +83,6 @@ const warning = {
|
|
|
87
83
|
color: warningColor
|
|
88
84
|
}
|
|
89
85
|
}
|
|
90
|
-
}
|
|
91
|
-
modes: {
|
|
92
|
-
compact: {}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
86
|
+
}};
|
|
95
87
|
|
|
96
88
|
export { enabled, info, warning };
|
|
@@ -85,7 +85,7 @@ const Chip = /*#__PURE__*/forwardRef(function Chip({
|
|
|
85
85
|
};
|
|
86
86
|
const resizedChildren = Children.map(children, child => {
|
|
87
87
|
// We force size on Icon & Avatar component
|
|
88
|
-
if (child
|
|
88
|
+
if (child?.props) {
|
|
89
89
|
return /*#__PURE__*/cloneElement(child, {
|
|
90
90
|
size: 16,
|
|
91
91
|
disabled
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { useDateFieldState } from '@react-stately/datepicker';
|
|
2
2
|
import { useDateField } from 'react-aria';
|
|
3
|
-
import { createCalendar } from '@internationalized/date';
|
|
3
|
+
import { CalendarDate, createCalendar } from '@internationalized/date';
|
|
4
4
|
import { DateSegment } from './DateSegment.js';
|
|
5
5
|
import { forwardRef } from 'react';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
// In some cases we need to use the index as key
|
|
9
9
|
/* eslint-disable react/no-array-index-key */
|
|
10
|
+
// Use January 1st as placeholder when no value is set.
|
|
11
|
+
// This ensures the day segment allows values up to 31,
|
|
12
|
+
// preventing eager auto-advance when typing "3" (which
|
|
13
|
+
// would otherwise auto-complete to "03" in months with
|
|
14
|
+
// fewer than 30 days, like February).
|
|
15
|
+
const DEFAULT_PLACEHOLDER = new CalendarDate(new Date().getFullYear(), 1, 1);
|
|
16
|
+
|
|
10
17
|
/**
|
|
11
18
|
* A field that wraps segments for inputting a date / date-time
|
|
12
19
|
*/
|
|
13
20
|
const DateFieldSegments = /*#__PURE__*/forwardRef((props, ref) => {
|
|
21
|
+
const placeholderValue = props.placeholderValue ?? DEFAULT_PLACEHOLDER;
|
|
14
22
|
const state = useDateFieldState({
|
|
15
23
|
...props,
|
|
16
24
|
locale: props.locale,
|
|
17
|
-
createCalendar
|
|
25
|
+
createCalendar,
|
|
26
|
+
placeholderValue
|
|
18
27
|
});
|
|
19
28
|
const {
|
|
20
29
|
fieldProps
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toCalendarDateTime,
|
|
1
|
+
import { toCalendarDateTime, fromDate, toCalendarDate } from '@internationalized/date';
|
|
2
2
|
|
|
3
3
|
const getCalendarDate = (value, timezone, showTimeInput = false) => {
|
|
4
4
|
if (!value) return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { typographyTemplate, outlineTemplate } from '@equinor/eds-utils';
|
|
4
|
-
import { quickVariants, typography,
|
|
4
|
+
import { quickVariants, typography, link, colors } from './Typography.tokens.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
const getElementType = (variant, link) => {
|
package/dist/esm/index.js
CHANGED
|
@@ -16,85 +16,85 @@ export { Progress } from './components/Progress/index.js';
|
|
|
16
16
|
export { Breadcrumbs } from './components/Breadcrumbs/index.js';
|
|
17
17
|
export { Menu } from './components/Menu/index.js';
|
|
18
18
|
export { SideBar } from './components/SideBar/index.js';
|
|
19
|
-
export { ButtonGroup } from './components/Button/ButtonGroup/ButtonGroup.js';
|
|
20
|
-
export { ToggleButton } from './components/Button/ToggleButton/ToggleButton.js';
|
|
21
|
-
export { TypographyNext } from './components/Typography/Typography.new.js';
|
|
22
|
-
export { Heading } from './components/Typography/Heading.js';
|
|
23
|
-
export { Paragraph } from './components/Typography/Paragraph.js';
|
|
24
|
-
export { Typography } from './components/Typography/Typography.js';
|
|
25
|
-
export { Body as TableBody } from './components/Table/Body.js';
|
|
26
|
-
export { Cell as TableCell } from './components/Table/Cell.js';
|
|
27
|
-
export { Head as TableHead } from './components/Table/Head/Head.js';
|
|
28
|
-
export { Foot as TableFoot } from './components/Table/Foot/Foot.js';
|
|
29
|
-
export { Row as TableRow } from './components/Table/Row/Row.js';
|
|
30
|
-
export { Caption as TableCaption } from './components/Table/Caption.js';
|
|
31
|
-
export { Divider } from './components/Divider/Divider.js';
|
|
32
|
-
export { TextField } from './components/TextField/TextField.js';
|
|
33
|
-
export { Textarea } from './components/Textarea/Textarea.js';
|
|
34
|
-
export { ListItem } from './components/List/ListItem.js';
|
|
35
|
-
export { AccordionItem } from './components/Accordion/AccordionItem.js';
|
|
36
19
|
export { AccordionHeader } from './components/Accordion/AccordionHeader.js';
|
|
37
|
-
export { AccordionHeaderTitle } from './components/Accordion/AccordionHeaderTitle.js';
|
|
38
20
|
export { AccordionHeaderActions } from './components/Accordion/AccordionHeaderActions.js';
|
|
21
|
+
export { AccordionHeaderTitle } from './components/Accordion/AccordionHeaderTitle.js';
|
|
22
|
+
export { AccordionItem } from './components/Accordion/AccordionItem.js';
|
|
39
23
|
export { AccordionPanel } from './components/Accordion/AccordionPanel.js';
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
24
|
+
export { AddSymbol, AllSymbol, Autocomplete, StyledButton, defaultOptionDisabled } from './components/Autocomplete/Autocomplete.js';
|
|
25
|
+
export { Avatar } from './components/Avatar/Avatar.js';
|
|
26
|
+
export { BannerActions } from './components/Banner/BannerActions.js';
|
|
27
|
+
export { BannerIcon } from './components/Banner/BannerIcon.js';
|
|
28
|
+
export { BannerMessage } from './components/Banner/BannerMessage.js';
|
|
29
|
+
export { Breadcrumb } from './components/Breadcrumbs/Breadcrumb.js';
|
|
30
|
+
export { ButtonGroup } from './components/Button/ButtonGroup/ButtonGroup.js';
|
|
44
31
|
export { CardActions } from './components/Card/CardActions.js';
|
|
45
32
|
export { CardContent } from './components/Card/CardContent.js';
|
|
46
33
|
export { CardHeader } from './components/Card/CardHeader.js';
|
|
47
|
-
export { CardMedia } from './components/Card/CardMedia.js';
|
|
48
34
|
export { CardHeaderTitle } from './components/Card/CardHeaderTitle.js';
|
|
49
|
-
export {
|
|
50
|
-
export {
|
|
51
|
-
export {
|
|
35
|
+
export { CardMedia } from './components/Card/CardMedia.js';
|
|
36
|
+
export { Checkbox } from './components/Checkbox/Checkbox.js';
|
|
37
|
+
export { Chip } from './components/Chip/Chip.js';
|
|
38
|
+
export { CircularProgress } from './components/Progress/Circular/CircularProgress.js';
|
|
39
|
+
export { DatePicker } from './components/Datepicker/DatePicker.js';
|
|
40
|
+
export { DateRangePicker } from './components/Datepicker/DateRangePicker.js';
|
|
52
41
|
export { DialogActions } from './components/Dialog/DialogActions.js';
|
|
53
|
-
export { DialogTitle } from './components/Dialog/DialogTitle.js';
|
|
54
42
|
export { DialogContent } from './components/Dialog/DialogContent.js';
|
|
55
43
|
export { DialogHeader } from './components/Dialog/DialogHeader.js';
|
|
56
|
-
export {
|
|
57
|
-
export {
|
|
58
|
-
export { SideSheet } from './components/SideSheet/SideSheet.js';
|
|
59
|
-
export { Chip } from './components/Chip/Chip.js';
|
|
60
|
-
export { Avatar } from './components/Avatar/Avatar.js';
|
|
61
|
-
export { Search } from './components/Search/Search.js';
|
|
62
|
-
export { Slider } from './components/Slider/Slider.js';
|
|
63
|
-
export { Tooltip } from './components/Tooltip/Tooltip.js';
|
|
64
|
-
export { SnackbarAction } from './components/Snackbar/SnackbarAction.js';
|
|
65
|
-
export { PopoverTitle } from './components/Popover/PopoverTitle.js';
|
|
66
|
-
export { PopoverContent } from './components/Popover/PopoverContent.js';
|
|
67
|
-
export { PopoverHeader } from './components/Popover/PopoverHeader.js';
|
|
68
|
-
export { PopoverActions } from './components/Popover/PopoverActions.js';
|
|
69
|
-
export { BannerIcon } from './components/Banner/BannerIcon.js';
|
|
70
|
-
export { BannerMessage } from './components/Banner/BannerMessage.js';
|
|
71
|
-
export { BannerActions } from './components/Banner/BannerActions.js';
|
|
72
|
-
export { LinearProgress } from './components/Progress/Linear/LinearProgress.js';
|
|
73
|
-
export { CircularProgress } from './components/Progress/Circular/CircularProgress.js';
|
|
74
|
-
export { StarProgress } from './components/Progress/Star/StarProgress.js';
|
|
44
|
+
export { DialogTitle } from './components/Dialog/DialogTitle.js';
|
|
45
|
+
export { Divider } from './components/Divider/Divider.js';
|
|
75
46
|
export { DotProgress } from './components/Progress/Dots/DotProgress.js';
|
|
76
|
-
export {
|
|
47
|
+
export { EdsProvider, useEds } from './components/EdsProvider/eds.context.js';
|
|
48
|
+
export { Heading } from './components/Typography/Heading.js';
|
|
49
|
+
export { Input } from './components/Input/Input.js';
|
|
50
|
+
export { InputWrapper } from './components/InputWrapper/InputWrapper.js';
|
|
51
|
+
export { Label } from './components/Label/Label.js';
|
|
52
|
+
export { LinearProgress } from './components/Progress/Linear/LinearProgress.js';
|
|
53
|
+
export { ListItem } from './components/List/ListItem.js';
|
|
77
54
|
export { MenuItem } from './components/Menu/MenuItem.js';
|
|
78
55
|
export { MenuSection } from './components/Menu/MenuSection.js';
|
|
79
|
-
export { Pagination } from './components/Pagination/Pagination.js';
|
|
80
56
|
export { NativeSelect } from './components/Select/NativeSelect.js';
|
|
81
|
-
export {
|
|
82
|
-
export { Input } from './components/Input/Input.js';
|
|
83
|
-
export { Checkbox } from './components/Checkbox/Checkbox.js';
|
|
84
|
-
export { Radio } from './components/Radio/Radio.js';
|
|
85
|
-
export { Switch } from './components/Switch/Switch.js';
|
|
86
|
-
export { EdsProvider, useEds } from './components/EdsProvider/eds.context.js';
|
|
57
|
+
export { Pagination } from './components/Pagination/Pagination.js';
|
|
87
58
|
export { Paper } from './components/Paper/Paper.js';
|
|
88
|
-
export {
|
|
89
|
-
export {
|
|
90
|
-
export {
|
|
91
|
-
export {
|
|
92
|
-
export {
|
|
59
|
+
export { Paragraph } from './components/Typography/Paragraph.js';
|
|
60
|
+
export { PopoverActions } from './components/Popover/PopoverActions.js';
|
|
61
|
+
export { PopoverContent } from './components/Popover/PopoverContent.js';
|
|
62
|
+
export { PopoverHeader } from './components/Popover/PopoverHeader.js';
|
|
63
|
+
export { PopoverTitle } from './components/Popover/PopoverTitle.js';
|
|
64
|
+
export { Radio } from './components/Radio/Radio.js';
|
|
65
|
+
export { Scrim } from './components/Scrim/Scrim.js';
|
|
66
|
+
export { Search } from './components/Search/Search.js';
|
|
67
|
+
export { SideBarAccordion } from './components/SideBar/SideBarAccordion/index.js';
|
|
68
|
+
export { SideBarAccordionItem } from './components/SideBar/SideBarAccordionItem/index.js';
|
|
69
|
+
export { SideBarButton } from './components/SideBar/SideBarButton/index.js';
|
|
93
70
|
export { SideBarContent } from './components/SideBar/SideBarContent.js';
|
|
94
71
|
export { SideBarFooter } from './components/SideBar/SideBarFooter.js';
|
|
95
72
|
export { SideBarToggle } from './components/SideBar/SideBarToggle.js';
|
|
96
|
-
export {
|
|
97
|
-
export {
|
|
98
|
-
export {
|
|
99
|
-
export {
|
|
100
|
-
export {
|
|
73
|
+
export { SideSheet } from './components/SideSheet/SideSheet.js';
|
|
74
|
+
export { SidebarLink } from './components/SideBar/SidebarLink/index.js';
|
|
75
|
+
export { Slider } from './components/Slider/Slider.js';
|
|
76
|
+
export { SnackbarAction } from './components/Snackbar/SnackbarAction.js';
|
|
77
|
+
export { StarProgress } from './components/Progress/Star/StarProgress.js';
|
|
78
|
+
export { Switch } from './components/Switch/Switch.js';
|
|
79
|
+
export { Tab } from './components/Tabs/Tab.js';
|
|
80
|
+
export { TabList } from './components/Tabs/TabList.js';
|
|
81
|
+
export { TabPanel } from './components/Tabs/TabPanel.js';
|
|
82
|
+
export { TabPanels } from './components/Tabs/TabPanels.js';
|
|
83
|
+
export { Body as TableBody } from './components/Table/Body.js';
|
|
84
|
+
export { Caption as TableCaption } from './components/Table/Caption.js';
|
|
85
|
+
export { Cell as TableCell } from './components/Table/Cell.js';
|
|
86
|
+
export { Foot as TableFoot } from './components/Table/Foot/Foot.js';
|
|
87
|
+
export { Head as TableHead } from './components/Table/Head/Head.js';
|
|
88
|
+
export { LinkItem as TableOfContentsLinkItem } from './components/TableOfContents/LinkItem.js';
|
|
89
|
+
export { Row as TableRow } from './components/Table/Row/Row.js';
|
|
90
|
+
export { TextField } from './components/TextField/TextField.js';
|
|
91
|
+
export { Textarea } from './components/Textarea/Textarea.js';
|
|
92
|
+
export { ToggleButton } from './components/Button/ToggleButton/ToggleButton.js';
|
|
93
|
+
export { Tooltip } from './components/Tooltip/Tooltip.js';
|
|
94
|
+
export { Actions as TopbarActions } from './components/TopBar/Actions.js';
|
|
95
|
+
export { CustomContent as TopbarCustomContent } from './components/TopBar/CustomContent.js';
|
|
96
|
+
export { Header as TopbarHeader } from './components/TopBar/Header.js';
|
|
97
|
+
export { Typography } from './components/Typography/Typography.js';
|
|
98
|
+
export { TypographyNext } from './components/Typography/Typography.new.js';
|
|
99
|
+
export { useInputField } from './components/InputWrapper/useInputField.js';
|
|
100
|
+
export { useSideBar } from './components/SideBar/SideBar.context.js';
|
|
@@ -32,18 +32,16 @@ const Button = /*#__PURE__*/forwardRef(function Button({
|
|
|
32
32
|
"data-variant": variant,
|
|
33
33
|
"data-selectable-space": selectableSpace,
|
|
34
34
|
"data-space-proportions": "squished",
|
|
35
|
-
"data-font-family": "ui",
|
|
36
|
-
"data-font-size": typographySize,
|
|
37
|
-
"data-line-height": "squished",
|
|
38
35
|
"data-color-appearance": disabled ? 'neutral' : tone,
|
|
39
36
|
"data-icon-only": icon || undefined,
|
|
40
37
|
"data-round": icon && round ? true : undefined,
|
|
41
38
|
...rest,
|
|
42
|
-
children: /*#__PURE__*/jsx(TypographyNext, {
|
|
39
|
+
children: icon ? children : /*#__PURE__*/jsx(TypographyNext, {
|
|
40
|
+
as: "span",
|
|
43
41
|
family: "ui",
|
|
44
42
|
size: typographySize,
|
|
45
|
-
baseline: "center",
|
|
46
43
|
lineHeight: "squished",
|
|
44
|
+
baseline: "center",
|
|
47
45
|
children: children
|
|
48
46
|
})
|
|
49
47
|
});
|
|
@@ -5,6 +5,7 @@ import { Icon } from '../Icon/Icon.js';
|
|
|
5
5
|
|
|
6
6
|
const Input = /*#__PURE__*/forwardRef(function Input({
|
|
7
7
|
invalid = false,
|
|
8
|
+
hideErrorIcon = false,
|
|
8
9
|
disabled,
|
|
9
10
|
readOnly,
|
|
10
11
|
type = 'text',
|
|
@@ -17,8 +18,8 @@ const Input = /*#__PURE__*/forwardRef(function Input({
|
|
|
17
18
|
as: Component = 'input',
|
|
18
19
|
...inputProps
|
|
19
20
|
}, ref) {
|
|
20
|
-
const tone = invalid && !disabled ? 'danger' : 'neutral';
|
|
21
|
-
const
|
|
21
|
+
const tone = invalid && !disabled && !readOnly ? 'danger' : 'neutral';
|
|
22
|
+
const displayErrorIcon = !hideErrorIcon && invalid && !disabled && !readOnly;
|
|
22
23
|
const hasStartAdornment = startText || startAdornment;
|
|
23
24
|
const hasEndAdornment = endText || endAdornment;
|
|
24
25
|
const containerClasses = ['eds-input-container', containerClassName].filter(Boolean).join(' ');
|
|
@@ -31,7 +32,7 @@ const Input = /*#__PURE__*/forwardRef(function Input({
|
|
|
31
32
|
"data-disabled": disabled || undefined,
|
|
32
33
|
"data-readonly": readOnly || undefined,
|
|
33
34
|
"data-invalid": invalid || undefined,
|
|
34
|
-
children: [
|
|
35
|
+
children: [displayErrorIcon && /*#__PURE__*/jsx("span", {
|
|
35
36
|
className: "eds-error-icon",
|
|
36
37
|
"data-font-size": "xs",
|
|
37
38
|
"data-font-family": "ui",
|
|
@@ -41,10 +42,9 @@ const Input = /*#__PURE__*/forwardRef(function Input({
|
|
|
41
42
|
})
|
|
42
43
|
}), hasStartAdornment && /*#__PURE__*/jsxs("div", {
|
|
43
44
|
className: "eds-adornment",
|
|
44
|
-
"data-
|
|
45
|
+
"data-color-appearance": "neutral",
|
|
45
46
|
children: [startText && /*#__PURE__*/jsx("span", {
|
|
46
47
|
className: "eds-adornment__text",
|
|
47
|
-
"data-color-appearance": "neutral",
|
|
48
48
|
"data-font-family": "ui",
|
|
49
49
|
"data-font-size": "xs",
|
|
50
50
|
"data-baseline": "center",
|
|
@@ -52,8 +52,6 @@ const Input = /*#__PURE__*/forwardRef(function Input({
|
|
|
52
52
|
}), startAdornment && /*#__PURE__*/jsx("span", {
|
|
53
53
|
className: "eds-adornment__adornment",
|
|
54
54
|
"data-font-size": "xs",
|
|
55
|
-
"data-font-family": "ui",
|
|
56
|
-
"data-baseline": "center",
|
|
57
55
|
children: startAdornment
|
|
58
56
|
})]
|
|
59
57
|
}), /*#__PURE__*/jsx(Component, {
|
|
@@ -70,10 +68,9 @@ const Input = /*#__PURE__*/forwardRef(function Input({
|
|
|
70
68
|
"aria-invalid": invalid || undefined
|
|
71
69
|
}), hasEndAdornment && /*#__PURE__*/jsxs("div", {
|
|
72
70
|
className: "eds-adornment",
|
|
73
|
-
"data-
|
|
71
|
+
"data-color-appearance": "neutral",
|
|
74
72
|
children: [endText && /*#__PURE__*/jsx("span", {
|
|
75
73
|
className: "eds-adornment__text",
|
|
76
|
-
"data-color-appearance": "neutral",
|
|
77
74
|
"data-font-family": "ui",
|
|
78
75
|
"data-font-size": "xs",
|
|
79
76
|
"data-baseline": "center",
|
|
@@ -81,8 +78,6 @@ const Input = /*#__PURE__*/forwardRef(function Input({
|
|
|
81
78
|
}), endAdornment && /*#__PURE__*/jsx("span", {
|
|
82
79
|
className: "eds-adornment__adornment",
|
|
83
80
|
"data-font-size": "xs",
|
|
84
|
-
"data-font-family": "ui",
|
|
85
|
-
"data-baseline": "center",
|
|
86
81
|
children: endAdornment
|
|
87
82
|
})]
|
|
88
83
|
})]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { Button } from './components/next/Button/Button.js';
|
|
2
|
-
export { Icon } from './components/next/Icon/Icon.js';
|
|
3
|
-
export { Field } from './components/next/Field/Field.js';
|
|
4
|
-
export { useFieldIds } from './components/next/Field/useFieldIds.js';
|
|
5
2
|
export { Checkbox } from './components/next/Checkbox/Checkbox.js';
|
|
3
|
+
export { Field } from './components/next/Field/Field.js';
|
|
4
|
+
export { Icon } from './components/next/Icon/Icon.js';
|
|
5
|
+
export { Input } from './components/next/Input/Input.js';
|
|
6
6
|
export { Radio } from './components/next/Radio/Radio.js';
|
|
7
7
|
export { Switch } from './components/next/Switch/Switch.js';
|
|
8
|
-
export { Input } from './components/next/Input/Input.js';
|
|
9
8
|
export { TextField } from './components/next/TextField/TextField.js';
|
|
9
|
+
export { useFieldIds } from './components/next/Field/useFieldIds.js';
|
package/dist/index.next.cjs
CHANGED
|
@@ -106,18 +106,16 @@ const Button = /*#__PURE__*/react.forwardRef(function Button({
|
|
|
106
106
|
"data-variant": variant,
|
|
107
107
|
"data-selectable-space": selectableSpace,
|
|
108
108
|
"data-space-proportions": "squished",
|
|
109
|
-
"data-font-family": "ui",
|
|
110
|
-
"data-font-size": typographySize,
|
|
111
|
-
"data-line-height": "squished",
|
|
112
109
|
"data-color-appearance": disabled ? 'neutral' : tone,
|
|
113
110
|
"data-icon-only": icon || undefined,
|
|
114
111
|
"data-round": icon && round ? true : undefined,
|
|
115
112
|
...rest,
|
|
116
|
-
children: /*#__PURE__*/jsxRuntime.jsx(TypographyNext, {
|
|
113
|
+
children: icon ? children : /*#__PURE__*/jsxRuntime.jsx(TypographyNext, {
|
|
114
|
+
as: "span",
|
|
117
115
|
family: "ui",
|
|
118
116
|
size: typographySize,
|
|
119
|
-
baseline: "center",
|
|
120
117
|
lineHeight: "squished",
|
|
118
|
+
baseline: "center",
|
|
121
119
|
children: children
|
|
122
120
|
})
|
|
123
121
|
});
|
|
@@ -533,6 +531,7 @@ Switch.displayName = 'Switch';
|
|
|
533
531
|
|
|
534
532
|
const Input = /*#__PURE__*/react.forwardRef(function Input({
|
|
535
533
|
invalid = false,
|
|
534
|
+
hideErrorIcon = false,
|
|
536
535
|
disabled,
|
|
537
536
|
readOnly,
|
|
538
537
|
type = 'text',
|
|
@@ -545,8 +544,8 @@ const Input = /*#__PURE__*/react.forwardRef(function Input({
|
|
|
545
544
|
as: Component = 'input',
|
|
546
545
|
...inputProps
|
|
547
546
|
}, ref) {
|
|
548
|
-
const tone = invalid && !disabled ? 'danger' : 'neutral';
|
|
549
|
-
const
|
|
547
|
+
const tone = invalid && !disabled && !readOnly ? 'danger' : 'neutral';
|
|
548
|
+
const displayErrorIcon = !hideErrorIcon && invalid && !disabled && !readOnly;
|
|
550
549
|
const hasStartAdornment = startText || startAdornment;
|
|
551
550
|
const hasEndAdornment = endText || endAdornment;
|
|
552
551
|
const containerClasses = ['eds-input-container', containerClassName].filter(Boolean).join(' ');
|
|
@@ -559,7 +558,7 @@ const Input = /*#__PURE__*/react.forwardRef(function Input({
|
|
|
559
558
|
"data-disabled": disabled || undefined,
|
|
560
559
|
"data-readonly": readOnly || undefined,
|
|
561
560
|
"data-invalid": invalid || undefined,
|
|
562
|
-
children: [
|
|
561
|
+
children: [displayErrorIcon && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
563
562
|
className: "eds-error-icon",
|
|
564
563
|
"data-font-size": "xs",
|
|
565
564
|
"data-font-family": "ui",
|
|
@@ -569,10 +568,9 @@ const Input = /*#__PURE__*/react.forwardRef(function Input({
|
|
|
569
568
|
})
|
|
570
569
|
}), hasStartAdornment && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
571
570
|
className: "eds-adornment",
|
|
572
|
-
"data-
|
|
571
|
+
"data-color-appearance": "neutral",
|
|
573
572
|
children: [startText && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
574
573
|
className: "eds-adornment__text",
|
|
575
|
-
"data-color-appearance": "neutral",
|
|
576
574
|
"data-font-family": "ui",
|
|
577
575
|
"data-font-size": "xs",
|
|
578
576
|
"data-baseline": "center",
|
|
@@ -580,8 +578,6 @@ const Input = /*#__PURE__*/react.forwardRef(function Input({
|
|
|
580
578
|
}), startAdornment && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
581
579
|
className: "eds-adornment__adornment",
|
|
582
580
|
"data-font-size": "xs",
|
|
583
|
-
"data-font-family": "ui",
|
|
584
|
-
"data-baseline": "center",
|
|
585
581
|
children: startAdornment
|
|
586
582
|
})]
|
|
587
583
|
}), /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
@@ -598,10 +594,9 @@ const Input = /*#__PURE__*/react.forwardRef(function Input({
|
|
|
598
594
|
"aria-invalid": invalid || undefined
|
|
599
595
|
}), hasEndAdornment && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
600
596
|
className: "eds-adornment",
|
|
601
|
-
"data-
|
|
597
|
+
"data-color-appearance": "neutral",
|
|
602
598
|
children: [endText && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
603
599
|
className: "eds-adornment__text",
|
|
604
|
-
"data-color-appearance": "neutral",
|
|
605
600
|
"data-font-family": "ui",
|
|
606
601
|
"data-font-size": "xs",
|
|
607
602
|
"data-baseline": "center",
|
|
@@ -609,8 +604,6 @@ const Input = /*#__PURE__*/react.forwardRef(function Input({
|
|
|
609
604
|
}), endAdornment && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
610
605
|
className: "eds-adornment__adornment",
|
|
611
606
|
"data-font-size": "xs",
|
|
612
|
-
"data-font-family": "ui",
|
|
613
|
-
"data-baseline": "center",
|
|
614
607
|
children: endAdornment
|
|
615
608
|
})]
|
|
616
609
|
})]
|
|
@@ -11,7 +11,7 @@ export declare const StyledButton: import("styled-components/dist/types").IStyle
|
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
type?: string;
|
|
13
13
|
fullWidth?: boolean;
|
|
14
|
-
} & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Omit<any,
|
|
14
|
+
} & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Omit<any, keyof import("react").ButtonHTMLAttributes<HTMLButtonElement> | "variant" | "href" | "fullWidth">, never>> & string & Omit<import("@equinor/eds-utils").OverridableComponent<import("../Button").ButtonProps, HTMLButtonElement> & {
|
|
15
15
|
Group: typeof import("../Button").ButtonGroup;
|
|
16
16
|
Toggle: typeof import("../Button").ToggleButton;
|
|
17
17
|
}, keyof import("react").Component<any, {}, any>>;
|
|
@@ -94,7 +94,7 @@ export declare const AutocompleteContext: import("react").Context<{
|
|
|
94
94
|
optionLabel?: (option: unknown) => string;
|
|
95
95
|
} & {
|
|
96
96
|
ref?: React.Ref<HTMLInputElement>;
|
|
97
|
-
}, "
|
|
97
|
+
}, "disabled" | "className" | "style" | "meta" | "label" | "ref" | "multiple" | "variant" | "placeholder" | "readOnly" | "options" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
|
|
98
98
|
highlightedIndex: number;
|
|
99
99
|
selectedItem: unknown;
|
|
100
100
|
isOpen: boolean;
|
|
@@ -208,7 +208,7 @@ export declare const useAutocompleteContext: () => {
|
|
|
208
208
|
optionLabel?: (option: unknown) => string;
|
|
209
209
|
} & {
|
|
210
210
|
ref?: React.Ref<HTMLInputElement>;
|
|
211
|
-
}, "
|
|
211
|
+
}, "disabled" | "className" | "style" | "meta" | "label" | "ref" | "multiple" | "variant" | "placeholder" | "readOnly" | "options" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
|
|
212
212
|
highlightedIndex: number;
|
|
213
213
|
selectedItem: unknown;
|
|
214
214
|
isOpen: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DOMAttributes } from 'react';
|
|
1
2
|
import { AutocompleteProps } from './Autocomplete';
|
|
2
3
|
import { AutocompleteToken } from './Autocomplete.tokens';
|
|
3
4
|
export declare const useAutocomplete: <T>({ options, totalOptions, label, meta, className, style, disabled, readOnly, loading, hideClearButton, onOptionsChange, onAddNewOption, onInputChange, selectedOptions: _selectedOptions, selectionDisplay, multiple, itemToKey: _itemToKey, itemCompare: _itemCompare, allowSelectAll, initialSelectedOptions: _initialSelectedOptions, optionDisabled, optionsFilter, autoWidth, placeholder, optionLabel, clearSearchOnChange, multiline, dropdownHeight, optionComponent, helperText, helperIcon, noOptionsText, variant, onClear, ref, ...other }: AutocompleteProps<T> & {
|
|
@@ -26,7 +27,7 @@ export declare const useAutocomplete: <T>({ options, totalOptions, label, meta,
|
|
|
26
27
|
disabled: boolean;
|
|
27
28
|
ref: import("react").RefObject<HTMLInputElement>;
|
|
28
29
|
}>, "preventKeyAction">>;
|
|
29
|
-
consolidatedEvents: Partial<
|
|
30
|
+
consolidatedEvents: Partial<DOMAttributes<unknown>>;
|
|
30
31
|
multiple: boolean;
|
|
31
32
|
disabled: boolean;
|
|
32
33
|
optionDisabled: (option: T) => boolean;
|
|
@@ -102,7 +103,7 @@ export declare const useAutocomplete: <T>({ options, totalOptions, label, meta,
|
|
|
102
103
|
optionLabel?: (option: T) => string;
|
|
103
104
|
}) & {
|
|
104
105
|
ref?: React.Ref<HTMLInputElement>;
|
|
105
|
-
}, "
|
|
106
|
+
}, "disabled" | "className" | "style" | "meta" | "label" | "ref" | "multiple" | "variant" | "placeholder" | "readOnly" | "options" | "helperText" | "helperIcon" | "loading" | "optionDisabled" | "totalOptions" | "initialSelectedOptions" | "noOptionsText" | "hideClearButton" | "selectedOptions" | "selectionDisplay" | "onOptionsChange" | "onInputChange" | "onAddNewOption" | "allowSelectAll" | "optionComponent" | "optionsFilter" | "autoWidth" | "clearSearchOnChange" | "multiline" | "dropdownHeight" | "itemToKey" | "itemCompare" | "onClear" | "optionLabel">;
|
|
106
107
|
highlightedIndex: number;
|
|
107
108
|
selectedItem: T;
|
|
108
109
|
isOpen: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* DateRangePicker component encapsulates the logic for selecting a range of dates
|
|
3
3
|
* Either by accessible input fields or by a calendar.
|
|
4
4
|
*/
|
|
5
|
-
export declare const DateRangePicker: import("react").ForwardRefExoticComponent<Omit<import("./props").DatePickerProps, "
|
|
5
|
+
export declare const DateRangePicker: import("react").ForwardRefExoticComponent<Omit<import("./props").DatePickerProps, "value" | "defaultValue" | "onChange" | "multiple" | "showTimeInput" | "stateRef"> & Partial<{
|
|
6
6
|
onChange: (range: {
|
|
7
7
|
from: Date | null;
|
|
8
8
|
to: Date | null;
|
|
@@ -7,4 +7,4 @@ export type SideBarButtonProps = {
|
|
|
7
7
|
export declare const SideBarButton: import("react").ForwardRefExoticComponent<{
|
|
8
8
|
label: string;
|
|
9
9
|
icon: IconData;
|
|
10
|
-
} & Omit<ButtonProps, "
|
|
10
|
+
} & Omit<ButtonProps, "type" | "variant" | "href" | "fullWidth"> & import("react").RefAttributes<HTMLButtonElement>>;
|