@equinor/eds-core-react 0.18.0-envis.2 → 0.19.0-dev.20220405
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/dist/eds-core-react.cjs.js +2276 -1930
- package/dist/esm/components/Accordion/Accordion.js +9 -9
- package/dist/esm/components/Accordion/Accordion.tokens.js +6 -1
- package/dist/esm/components/Accordion/AccordionHeader.js +61 -49
- package/dist/esm/components/Accordion/AccordionHeaderTitle.js +12 -10
- package/dist/esm/components/Accordion/AccordionItem.js +11 -10
- package/dist/esm/components/Accordion/AccordionPanel.js +22 -18
- package/dist/esm/components/Avatar/Avatar.js +21 -14
- package/dist/esm/components/Banner/Banner.js +12 -11
- package/dist/esm/components/Banner/BannerActions.js +11 -9
- package/dist/esm/components/Banner/BannerIcon.js +12 -10
- package/dist/esm/components/Banner/BannerMessage.js +5 -4
- package/dist/esm/components/Breadcrumbs/Breadcrumb.js +16 -12
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +7 -6
- package/dist/esm/components/Button/Button.js +16 -17
- package/dist/esm/components/Button/InnerFullWidth.js +4 -3
- package/dist/esm/components/Button/tokens/button.js +1 -1
- package/dist/esm/components/Button/tokens/contained.js +5 -5
- package/dist/esm/components/Button/tokens/ghost.js +4 -4
- package/dist/esm/components/Button/tokens/icon.js +11 -6
- package/dist/esm/components/Button/tokens/outlined.js +5 -5
- package/dist/esm/components/Card/Card.js +19 -12
- package/dist/esm/components/Card/CardActions.js +13 -9
- package/dist/esm/components/Card/CardContent.js +5 -4
- package/dist/esm/components/Card/CardHeader.js +5 -4
- package/dist/esm/components/Card/CardHeaderTitle.js +5 -4
- package/dist/esm/components/Card/CardMedia.js +12 -8
- package/dist/esm/components/Checkbox/Checkbox.js +15 -11
- package/dist/esm/components/Checkbox/Checkbox.tokens.js +9 -4
- package/dist/esm/components/Checkbox/Input.js +72 -46
- package/dist/esm/components/Chip/Chip.js +46 -30
- package/dist/esm/components/Chip/Chip.tokens.js +7 -2
- package/dist/esm/components/Chip/Icon.js +12 -7
- package/dist/esm/components/Dialog/Dialog.js +44 -20
- package/dist/esm/components/Dialog/Dialog.tokens.js +4 -12
- package/dist/esm/components/Dialog/DialogActions.js +27 -0
- package/dist/esm/components/Dialog/DialogContent.js +44 -0
- package/dist/esm/components/Dialog/DialogHeader.js +37 -0
- package/dist/esm/components/Dialog/DialogTitle.js +31 -0
- package/dist/esm/components/Dialog/index.js +11 -7
- package/dist/esm/components/Divider/Divider.js +6 -5
- package/dist/esm/components/EdsProvider/eds.context.js +5 -4
- package/dist/esm/components/Icon/Icon.js +77 -46
- package/dist/esm/components/Input/Input.js +12 -12
- package/dist/esm/components/Input/Input.tokens.js +4 -4
- package/dist/esm/components/Label/Label.js +7 -4
- package/dist/esm/components/List/List.js +13 -9
- package/dist/esm/components/List/ListItem.js +5 -4
- package/dist/esm/components/Menu/Menu.context.js +16 -4
- package/dist/esm/components/Menu/Menu.js +71 -30
- package/dist/esm/components/Menu/MenuItem.js +38 -25
- package/dist/esm/components/Menu/MenuList.js +18 -11
- package/dist/esm/components/Menu/MenuSection.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js +16 -12
- package/dist/esm/components/Pagination/PaginationItem.js +7 -6
- package/dist/esm/components/Paper/Paper.js +11 -7
- package/dist/esm/components/Popover/Popover.js +43 -50
- package/dist/esm/components/Popover/Popover.tokens.js +2 -12
- package/dist/esm/components/Popover/PopoverActions.js +28 -0
- package/dist/esm/components/Popover/PopoverContent.js +12 -6
- package/dist/esm/components/Popover/PopoverHeader.js +36 -0
- package/dist/esm/components/Popover/PopoverTitle.js +13 -24
- package/dist/esm/components/Popover/index.js +6 -0
- package/dist/esm/components/Progress/Circular/CircularProgress.js +14 -10
- package/dist/esm/components/Progress/Dots/DotProgress.js +12 -8
- package/dist/esm/components/Progress/Linear/LinearProgress.js +6 -5
- package/dist/esm/components/Progress/Star/StarProgress.js +14 -10
- package/dist/esm/components/Radio/Radio.js +84 -52
- package/dist/esm/components/Radio/Radio.tokens.js +9 -4
- package/dist/esm/components/Scrim/Scrim.js +16 -20
- package/dist/esm/components/Search/Search.js +28 -28
- package/dist/esm/components/Select/MultiSelect/MultiSelect.js +27 -22
- package/dist/esm/components/Select/NativeSelect/NativeSelect.js +19 -17
- package/dist/esm/components/Select/Select.tokens.js +2 -2
- package/dist/esm/components/Select/SingleSelect/SingleSelect.js +29 -23
- package/dist/esm/components/Select/commonStyles.js +14 -13
- package/dist/esm/components/SideSheet/SideSheet.js +16 -13
- package/dist/esm/components/Slider/MinMax.js +5 -4
- package/dist/esm/components/Slider/Output.js +13 -9
- package/dist/esm/components/Slider/Slider.js +81 -38
- package/dist/esm/components/Slider/Slider.tokens.js +7 -2
- package/dist/esm/components/Slider/SliderInput.js +14 -14
- package/dist/esm/components/Snackbar/Snackbar.js +17 -21
- package/dist/esm/components/Snackbar/SnackbarAction.js +9 -7
- package/dist/esm/components/Switch/Switch.js +21 -15
- package/dist/esm/components/Switch/Switch.styles.js +24 -17
- package/dist/esm/components/Switch/Switch.tokens.js +6 -1
- package/dist/esm/components/Switch/SwitchDefault.js +39 -29
- package/dist/esm/components/Switch/SwitchSmall.js +38 -28
- package/dist/esm/components/Table/Body.js +5 -4
- package/dist/esm/components/Table/Caption.js +8 -5
- package/dist/esm/components/Table/Cell.js +9 -6
- package/dist/esm/components/Table/DataCell/DataCell.js +12 -12
- package/dist/esm/components/Table/DataCell/DataCell.tokens.js +2 -2
- package/dist/esm/components/Table/Head/Head.js +7 -6
- package/dist/esm/components/Table/HeaderCell/HeaderCell.js +7 -8
- package/dist/esm/components/Table/Row/Row.js +7 -5
- package/dist/esm/components/Table/Table.js +5 -4
- package/dist/esm/components/TableOfContents/LinkItem.js +10 -10
- package/dist/esm/components/TableOfContents/TableOfContents.js +17 -15
- package/dist/esm/components/Tabs/Tab.js +21 -19
- package/dist/esm/components/Tabs/TabList.js +27 -11
- package/dist/esm/components/Tabs/TabPanel.js +8 -7
- package/dist/esm/components/Tabs/TabPanels.js +5 -4
- package/dist/esm/components/Tabs/Tabs.context.js +1 -0
- package/dist/esm/components/Tabs/Tabs.js +45 -15
- package/dist/esm/components/Tabs/Tabs.tokens.js +8 -2
- package/dist/esm/components/TextField/Field.js +49 -38
- package/dist/esm/components/TextField/HelperText/HelperText.js +28 -19
- package/dist/esm/components/TextField/Icon/Icon.js +20 -18
- package/dist/esm/components/TextField/TextField.context.js +4 -3
- package/dist/esm/components/TextField/TextField.js +19 -19
- package/dist/esm/components/Textarea/Textarea.js +16 -16
- package/dist/esm/components/Tooltip/Tooltip.js +23 -24
- package/dist/esm/components/TopBar/Actions.js +5 -4
- package/dist/esm/components/TopBar/CustomContent.js +5 -4
- package/dist/esm/components/TopBar/Header.js +5 -4
- package/dist/esm/components/TopBar/TopBar.js +11 -11
- package/dist/esm/components/Typography/Typography.js +49 -28
- package/dist/esm/components/Typography/Typography.tokens.js +7 -2
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry1.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry2.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry3.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_has.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isObject.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isPlaceholder.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepRight.js +2 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepWithKey.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeWithKey.js +1 -1
- package/dist/types/components/Accordion/AccordionHeader.d.ts +2 -2
- package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/Checkbox/Input.d.ts +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +18 -2
- package/dist/types/components/Dialog/DialogActions.d.ts +3 -0
- package/dist/types/components/Dialog/{CustomContent.d.ts → DialogContent.d.ts} +2 -2
- package/dist/types/components/Dialog/DialogHeader.d.ts +3 -0
- package/dist/types/components/Dialog/DialogTitle.d.ts +3 -0
- package/dist/types/components/Dialog/index.d.ts +10 -7
- package/dist/types/components/Icon/Icon.d.ts +2 -2
- package/dist/types/components/Menu/Menu.context.d.ts +3 -0
- package/dist/types/components/Menu/Menu.d.ts +1 -6
- package/dist/types/components/Menu/MenuList.d.ts +0 -2
- package/dist/types/components/Popover/Popover.d.ts +1 -1
- package/dist/types/components/Popover/PopoverActions.d.ts +3 -0
- package/dist/types/components/Popover/PopoverHeader.d.ts +3 -0
- package/dist/types/components/Popover/index.d.ts +5 -1
- package/dist/types/components/Progress/Circular/CircularProgress.d.ts +1 -1
- package/dist/types/components/Progress/Dots/DotProgress.d.ts +1 -1
- package/dist/types/components/Progress/Star/StarProgress.d.ts +1 -1
- package/dist/types/components/Switch/Switch.d.ts +1 -1
- package/dist/types/components/Switch/Switch.styles.d.ts +2 -1
- package/dist/types/components/Tabs/TabList.d.ts +4 -0
- package/dist/types/components/Tabs/Tabs.context.d.ts +1 -0
- package/dist/types/components/Tabs/Tabs.d.ts +4 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/package.json +37 -38
- package/dist/esm/components/Dialog/Actions.js +0 -26
- package/dist/esm/components/Dialog/CustomContent.js +0 -46
- package/dist/esm/components/Dialog/Title.js +0 -41
- package/dist/esm/hooks/useAutoResize.js +0 -39
- package/dist/esm/hooks/useCombinedRefs.js +0 -14
- package/dist/esm/hooks/useGlobalKeyPress.js +0 -34
- package/dist/esm/hooks/useHideBodyScroll.js +0 -20
- package/dist/esm/hooks/useId.js +0 -14
- package/dist/esm/hooks/useMountedRef.js +0 -12
- package/dist/esm/hooks/useOutsideClick.js +0 -18
- package/dist/esm/hooks/usePopper.js +0 -31
- package/dist/esm/hooks/useToken.js +0 -16
- package/dist/esm/utils/joinHandlers.js +0 -10
- package/dist/esm/utils/setReactInputValue.js +0 -18
- package/dist/esm/utils/templates/borders.js +0 -35
- package/dist/esm/utils/templates/common.js +0 -19
- package/dist/esm/utils/templates/focus.js +0 -35
- package/dist/esm/utils/templates/index.js +0 -52
- package/dist/types/components/Dialog/Actions.d.ts +0 -3
- package/dist/types/components/Dialog/Title.d.ts +0 -3
- package/dist/types/hooks/index.d.ts +0 -9
- package/dist/types/hooks/useAutoResize.d.ts +0 -1
- package/dist/types/hooks/useCombinedRefs.d.ts +0 -3
- package/dist/types/hooks/useGlobalKeyPress.d.ts +0 -10
- package/dist/types/hooks/useHideBodyScroll.d.ts +0 -1
- package/dist/types/hooks/useId.d.ts +0 -1
- package/dist/types/hooks/useMountedRef.d.ts +0 -1
- package/dist/types/hooks/useOutsideClick.d.ts +0 -1
- package/dist/types/hooks/usePopper.d.ts +0 -12
- package/dist/types/hooks/useToken.d.ts +0 -7
- package/dist/types/utils/index.d.ts +0 -4
- package/dist/types/utils/joinHandlers.d.ts +0 -3
- package/dist/types/utils/setReactInputValue.d.ts +0 -7
- package/dist/types/utils/templates/borders.d.ts +0 -2
- package/dist/types/utils/templates/common.d.ts +0 -9
- package/dist/types/utils/templates/focus.d.ts +0 -2
- package/dist/types/utils/templates/index.d.ts +0 -7
|
@@ -3,24 +3,21 @@ import styled, { css, ThemeProvider } from 'styled-components';
|
|
|
3
3
|
import { search as search$1, close } from '@equinor/eds-icons';
|
|
4
4
|
import { search } from './Search.tokens.js';
|
|
5
5
|
import { Icon } from '../Icon/index.js';
|
|
6
|
+
import { bordersTemplate, spacingsTemplate, typographyTemplate, useToken, useCombinedRefs, setReactInputValue } from '@equinor/eds-utils';
|
|
6
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
-
import { useCombinedRefs } from '../../hooks/useCombinedRefs.js';
|
|
8
|
-
import { setReactInputValue } from '../../utils/setReactInputValue.js';
|
|
9
|
-
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
10
|
-
import { spacingsTemplate, typographyTemplate } from '../../utils/templates/index.js';
|
|
11
8
|
import { Input } from '../Input/Input.js';
|
|
12
9
|
import { Button } from '../Button/Button.js';
|
|
13
10
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
14
|
-
import { useToken } from '../../hooks/useToken.js';
|
|
15
11
|
|
|
16
12
|
const Container = styled.span.withConfig({
|
|
17
13
|
displayName: "Search__Container",
|
|
18
14
|
componentId: "sc-v8l23u-0"
|
|
19
|
-
})(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
})(_ref => {
|
|
16
|
+
let {
|
|
17
|
+
disabled,
|
|
18
|
+
isFocused,
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
24
21
|
const {
|
|
25
22
|
height,
|
|
26
23
|
spacings,
|
|
@@ -38,19 +35,21 @@ const Container = styled.span.withConfig({
|
|
|
38
35
|
const SearchInput = styled(Input).withConfig({
|
|
39
36
|
displayName: "Search__SearchInput",
|
|
40
37
|
componentId: "sc-v8l23u-1"
|
|
41
|
-
})(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
})(_ref2 => {
|
|
39
|
+
let {
|
|
40
|
+
theme,
|
|
41
|
+
disabled
|
|
42
|
+
} = _ref2;
|
|
45
43
|
return css(["height:calc(", " - 2px);align-self:start;box-shadow:unset;&[type='search']::-webkit-search-decoration,&[type='search']::-webkit-search-cancel-button,&[type='search']::-webkit-search-results-button,&[type='search']::-webkit-search-results-decoration{-webkit-appearance:none;}", " &:focus{outline:none;}", ""], theme.height, typographyTemplate(theme.typography), disabled && css(["cursor:not-allowed;"]));
|
|
46
44
|
});
|
|
47
45
|
const InsideButton = styled(Button).withConfig({
|
|
48
46
|
displayName: "Search__InsideButton",
|
|
49
47
|
componentId: "sc-v8l23u-2"
|
|
50
|
-
})(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
})(_ref3 => {
|
|
49
|
+
let {
|
|
50
|
+
theme,
|
|
51
|
+
isActive
|
|
52
|
+
} = _ref3;
|
|
54
53
|
const {
|
|
55
54
|
entities: {
|
|
56
55
|
button
|
|
@@ -58,16 +57,17 @@ const InsideButton = styled(Button).withConfig({
|
|
|
58
57
|
} = theme;
|
|
59
58
|
return css(["visibility:hidden;position:absolute;right:", ";height:", ";width:", ";", ""], button.spacings.right, button.height, button.width, isActive && css(["visibility:visible;"]));
|
|
60
59
|
});
|
|
61
|
-
const Search = /*#__PURE__*/forwardRef(function Search({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
const Search = /*#__PURE__*/forwardRef(function Search(_ref4, ref) {
|
|
61
|
+
let {
|
|
62
|
+
onChange,
|
|
63
|
+
defaultValue = '',
|
|
64
|
+
value,
|
|
65
|
+
className = '',
|
|
66
|
+
disabled = false,
|
|
67
|
+
onBlur,
|
|
68
|
+
onFocus,
|
|
69
|
+
...rest
|
|
70
|
+
} = _ref4;
|
|
71
71
|
const {
|
|
72
72
|
density
|
|
73
73
|
} = useEds();
|
|
@@ -6,30 +6,33 @@ import { close, arrow_drop_up, arrow_drop_down } from '@equinor/eds-icons';
|
|
|
6
6
|
import styled, { ThemeProvider } from 'styled-components';
|
|
7
7
|
import { multiSelect } from '../Select.tokens.js';
|
|
8
8
|
import { StyledListItem, Container, StyledInputWrapper, PaddedInput, StyledButton, StyledList } from '../commonStyles.js';
|
|
9
|
+
import { spacingsTemplate, useToken } from '@equinor/eds-utils';
|
|
9
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
-
import { spacingsTemplate } from '../../../utils/templates/index.js';
|
|
11
11
|
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
12
|
-
import { useToken } from '../../../hooks/useToken.js';
|
|
13
12
|
import { Label } from '../../Label/Label.js';
|
|
14
13
|
|
|
15
14
|
const PaddedStyledListItem = styled(StyledListItem).withConfig({
|
|
16
15
|
displayName: "MultiSelect__PaddedStyledListItem",
|
|
17
16
|
componentId: "sc-69ntfg-0"
|
|
18
|
-
})(["display:flex;align-items:center;", ""],
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
})(["display:flex;align-items:center;", ""], _ref => {
|
|
18
|
+
let {
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
21
|
+
return spacingsTemplate(theme.spacings);
|
|
22
|
+
});
|
|
23
|
+
const MultiSelect = /*#__PURE__*/forwardRef(function MultiSelect(_ref2, ref) {
|
|
24
|
+
let {
|
|
25
|
+
items = [],
|
|
26
|
+
initialSelectedItems = [],
|
|
27
|
+
label,
|
|
28
|
+
meta,
|
|
29
|
+
className,
|
|
30
|
+
disabled = false,
|
|
31
|
+
readOnly = false,
|
|
32
|
+
selectedOptions,
|
|
33
|
+
handleSelectedItemsChange,
|
|
34
|
+
...other
|
|
35
|
+
} = _ref2;
|
|
33
36
|
const isControlled = selectedOptions ? true : false;
|
|
34
37
|
const [inputValue, setInputValue] = useState('');
|
|
35
38
|
const {
|
|
@@ -104,11 +107,13 @@ const MultiSelect = /*#__PURE__*/forwardRef(function MultiSelect({
|
|
|
104
107
|
return changes;
|
|
105
108
|
}
|
|
106
109
|
},
|
|
107
|
-
onStateChange:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
onStateChange: _ref3 => {
|
|
111
|
+
let {
|
|
112
|
+
inputValue,
|
|
113
|
+
type,
|
|
114
|
+
selectedItem
|
|
115
|
+
} = _ref3;
|
|
116
|
+
|
|
112
117
|
switch (type) {
|
|
113
118
|
case useCombobox.stateChangeTypes.InputChange:
|
|
114
119
|
setInputValue(inputValue);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
3
|
import { nativeselect } from './NativeSelect.tokens.js';
|
|
4
|
+
import { typographyTemplate, spacingsTemplate, outlineTemplate, useToken } from '@equinor/eds-utils';
|
|
4
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
-
import { typographyTemplate, spacingsTemplate } from '../../../utils/templates/index.js';
|
|
6
|
-
import { outlineTemplate } from '../../../utils/templates/focus.js';
|
|
7
6
|
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
8
|
-
import { useToken } from '../../../hooks/useToken.js';
|
|
9
7
|
import { Label } from '../../Label/Label.js';
|
|
10
8
|
|
|
11
9
|
const Container = styled.div.withConfig({
|
|
@@ -15,20 +13,24 @@ const Container = styled.div.withConfig({
|
|
|
15
13
|
const StyledSelect = styled.select.withConfig({
|
|
16
14
|
displayName: "NativeSelect__StyledSelect",
|
|
17
15
|
componentId: "sc-1c1ogya-1"
|
|
18
|
-
})(["border:none;border-radius:0;box-shadow:", ";", " ", " padding-right:calc(", " *2 + ", ");display:block;margin:0;appearance:none;background-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%236f6f6f' d='M7 9.5l5 5 5-5H7z'/%3E%3C/svg%3E\"),linear-gradient( to bottom,", " 0%,", " 100% );background-repeat:no-repeat,repeat;background-position:right ", " top 50%;width:100%;&:active,&:focus{box-shadow:none;", "}&:disabled{color:", ";background-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23bebebe' d='M7 9.5l5 5 5-5H7z'/%3E%3C/svg%3E\"),linear-gradient( to bottom,", " 0%,", " 100% );cursor:not-allowed;box-shadow:none;outline:none;.arrow-icon{fill:red;}&:focus,&:active{outline:none;}}"], nativeselect.boxShadow, typographyTemplate(nativeselect.typography),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
})(["border:none;border-radius:0;box-shadow:", ";", " ", " padding-right:calc(", " *2 + ", ");display:block;margin:0;appearance:none;background-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%236f6f6f' d='M7 9.5l5 5 5-5H7z'/%3E%3C/svg%3E\"),linear-gradient( to bottom,", " 0%,", " 100% );background-repeat:no-repeat,repeat;background-position:right ", " top 50%;width:100%;&:active,&:focus{box-shadow:none;", "}&:disabled{color:", ";background-image:url(\"data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23bebebe' d='M7 9.5l5 5 5-5H7z'/%3E%3C/svg%3E\"),linear-gradient( to bottom,", " 0%,", " 100% );cursor:not-allowed;box-shadow:none;outline:none;.arrow-icon{fill:red;}&:focus,&:active{outline:none;}}"], nativeselect.boxShadow, typographyTemplate(nativeselect.typography), _ref => {
|
|
17
|
+
let {
|
|
18
|
+
theme
|
|
19
|
+
} = _ref;
|
|
20
|
+
return css(["height:", ";", ""], theme.minHeight, spacingsTemplate(theme.entities.input.spacings));
|
|
21
|
+
}, nativeselect.entities.input.spacings.right, nativeselect.entities.icon.width, nativeselect.background, nativeselect.background, nativeselect.entities.input.spacings.right, outlineTemplate(nativeselect.states.focus.outline), nativeselect.states.disabled.typography.color, nativeselect.background, nativeselect.background);
|
|
22
|
+
const NativeSelect = /*#__PURE__*/forwardRef(function NativeSelect(_ref2, ref) {
|
|
23
|
+
let {
|
|
24
|
+
label,
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
selectRef,
|
|
28
|
+
id,
|
|
29
|
+
meta,
|
|
30
|
+
disabled = false,
|
|
31
|
+
multiple = false,
|
|
32
|
+
...other
|
|
33
|
+
} = _ref2;
|
|
32
34
|
const {
|
|
33
35
|
density
|
|
34
36
|
} = useEds();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
|
-
import
|
|
2
|
+
import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.27.2/node_modules/ramda/src/mergeDeepRight.js';
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
5
|
typography,
|
|
@@ -81,7 +81,7 @@ const select = {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
const multiSelect =
|
|
84
|
+
const multiSelect = mergeDeepRight(select, {
|
|
85
85
|
spacings: {
|
|
86
86
|
top: '0',
|
|
87
87
|
bottom: '0',
|
|
@@ -3,32 +3,35 @@ import { useCombobox } from 'downshift';
|
|
|
3
3
|
import styled, { ThemeProvider } from 'styled-components';
|
|
4
4
|
import { Icon } from '../../Icon/index.js';
|
|
5
5
|
import { close, arrow_drop_up, arrow_drop_down } from '@equinor/eds-icons';
|
|
6
|
+
import { spacingsTemplate, useToken } from '@equinor/eds-utils';
|
|
6
7
|
import { select } from '../Select.tokens.js';
|
|
7
8
|
import { StyledListItem, Container, StyledInputWrapper, PaddedInput, StyledButton, StyledList } from '../commonStyles.js';
|
|
8
9
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
-
import { spacingsTemplate } from '../../../utils/templates/index.js';
|
|
10
10
|
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
11
|
-
import { useToken } from '../../../hooks/useToken.js';
|
|
12
11
|
import { Label } from '../../Label/Label.js';
|
|
13
12
|
|
|
14
13
|
const PaddedStyledListItem = styled(StyledListItem).withConfig({
|
|
15
14
|
displayName: "SingleSelect__PaddedStyledListItem",
|
|
16
15
|
componentId: "sc-rh1yw2-0"
|
|
17
|
-
})(["", ""],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
})(["", ""], _ref => {
|
|
17
|
+
let {
|
|
18
|
+
theme
|
|
19
|
+
} = _ref;
|
|
20
|
+
return spacingsTemplate(theme.spacings);
|
|
21
|
+
});
|
|
22
|
+
const SingleSelect = /*#__PURE__*/forwardRef(function SingleSelect(_ref2, ref) {
|
|
23
|
+
let {
|
|
24
|
+
items = [],
|
|
25
|
+
label,
|
|
26
|
+
meta,
|
|
27
|
+
className,
|
|
28
|
+
disabled = false,
|
|
29
|
+
readOnly = false,
|
|
30
|
+
initialSelectedItem,
|
|
31
|
+
selectedOption,
|
|
32
|
+
handleSelectedItemChange,
|
|
33
|
+
...other
|
|
34
|
+
} = _ref2;
|
|
32
35
|
const [inputItems, setInputItems] = useState(items);
|
|
33
36
|
const isControlled = selectedOption !== undefined ? true : false;
|
|
34
37
|
const {
|
|
@@ -43,14 +46,17 @@ const SingleSelect = /*#__PURE__*/forwardRef(function SingleSelect({
|
|
|
43
46
|
let comboboxProps = {
|
|
44
47
|
items: inputItems,
|
|
45
48
|
onSelectedItemChange: handleSelectedItemChange,
|
|
46
|
-
onInputValueChange:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
onInputValueChange: _ref3 => {
|
|
50
|
+
let {
|
|
51
|
+
inputValue
|
|
52
|
+
} = _ref3;
|
|
49
53
|
setInputItems(items.filter(item => item.toLowerCase().includes(inputValue.toLowerCase())));
|
|
50
54
|
},
|
|
51
|
-
onIsOpenChange:
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
onIsOpenChange: _ref4 => {
|
|
56
|
+
let {
|
|
57
|
+
selectedItem
|
|
58
|
+
} = _ref4;
|
|
59
|
+
|
|
54
60
|
if (inputItems.length === 1 && selectedItem === inputItems[0]) {
|
|
55
61
|
setInputItems(items);
|
|
56
62
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { List } from '../List/index.js';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { select } from './Select.tokens.js';
|
|
4
|
+
import { bordersTemplate, typographyTemplate } from '@equinor/eds-utils';
|
|
4
5
|
import { Input } from '../Input/Input.js';
|
|
5
|
-
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
6
|
-
import { typographyTemplate } from '../../utils/templates/index.js';
|
|
7
6
|
import { Button } from '../Button/Button.js';
|
|
8
7
|
|
|
9
8
|
const {
|
|
@@ -26,24 +25,26 @@ const StyledList = styled(List).withConfig({
|
|
|
26
25
|
const StyledListItem = styled(List.Item).withConfig({
|
|
27
26
|
displayName: "commonStyles__StyledListItem",
|
|
28
27
|
componentId: "sc-v98ajk-3"
|
|
29
|
-
})(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
})(_ref => {
|
|
29
|
+
let {
|
|
30
|
+
theme,
|
|
31
|
+
highlighted,
|
|
32
|
+
active
|
|
33
|
+
} = _ref;
|
|
34
34
|
const backgroundColor = highlighted === 'true' ? theme.states.hover.background : active === 'true' ? theme.states.active.background : theme.background;
|
|
35
35
|
return css(["margin:0;list-style:none;background-color:", ";", ";cursor:", ";"], backgroundColor, typographyTemplate(theme.typography), highlighted === 'true' ? 'pointer' : 'default');
|
|
36
36
|
});
|
|
37
37
|
const StyledButton = styled(Button).withConfig({
|
|
38
38
|
displayName: "commonStyles__StyledButton",
|
|
39
39
|
componentId: "sc-v98ajk-4"
|
|
40
|
-
})(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
})(_ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
theme: {
|
|
43
|
+
entities: {
|
|
44
|
+
button
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
|
-
}
|
|
46
|
-
}) => {
|
|
47
|
+
} = _ref2;
|
|
47
48
|
return css(["position:absolute;right:", ";height:", ";width:", ";top:", ";color:", ";"], button.spacings.right, button.height, button.height, button.spacings.top, button.typography.color);
|
|
48
49
|
});
|
|
49
50
|
const StyledInputWrapper = styled.div.withConfig({
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { clear } from '@equinor/eds-icons';
|
|
4
|
+
import { bordersTemplate, spacingsTemplate } from '@equinor/eds-utils';
|
|
4
5
|
import { Icon } from '../Icon/index.js';
|
|
5
6
|
import { comfortable, variants } from './SideSheet.tokens.js';
|
|
6
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
8
|
import { Button } from '../Button/Button.js';
|
|
8
|
-
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
9
|
-
import { spacingsTemplate } from '../../utils/templates/index.js';
|
|
10
9
|
import { Typography } from '../Typography/Typography.js';
|
|
11
10
|
|
|
12
11
|
const {
|
|
@@ -17,21 +16,25 @@ const {
|
|
|
17
16
|
const StyledSideSheet = styled.div.withConfig({
|
|
18
17
|
displayName: "SideSheet__StyledSideSheet",
|
|
19
18
|
componentId: "sc-wkzlnn-0"
|
|
20
|
-
})(["height:100%;position:absolute;z-index:
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
})(["height:100%;position:absolute;z-index:1200;top:0;right:0;box-sizing:border-box;background:", ";width:", ";", " ", ";"], background, _ref => {
|
|
20
|
+
let {
|
|
21
|
+
width
|
|
22
|
+
} = _ref;
|
|
23
|
+
return width;
|
|
24
|
+
}, bordersTemplate(border), spacingsTemplate(spacings));
|
|
23
25
|
const Header = styled.div.withConfig({
|
|
24
26
|
displayName: "SideSheet__Header",
|
|
25
27
|
componentId: "sc-wkzlnn-1"
|
|
26
28
|
})(["display:flex;flex-wrap:nowrap;justify-content:space-between;align-items:center;padding-bottom:24px;padding-right:10px;"]);
|
|
27
|
-
const SideSheet = /*#__PURE__*/forwardRef(function SideSheet({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const SideSheet = /*#__PURE__*/forwardRef(function SideSheet(_ref2, ref) {
|
|
30
|
+
let {
|
|
31
|
+
variant = 'medium',
|
|
32
|
+
title = '',
|
|
33
|
+
children,
|
|
34
|
+
open = true,
|
|
35
|
+
onClose,
|
|
36
|
+
...rest
|
|
37
|
+
} = _ref2;
|
|
35
38
|
const props = { ...rest,
|
|
36
39
|
ref,
|
|
37
40
|
width: variants[variant]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import { typographyTemplate } from '@equinor/eds-utils';
|
|
3
4
|
import { slider } from './Slider.tokens.js';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
import { typographyTemplate } from '../../utils/templates/index.js';
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
8
|
entities: {
|
|
@@ -14,9 +14,10 @@ const StyledMinMax = styled.span.withConfig({
|
|
|
14
14
|
displayName: "MinMax__StyledMinMax",
|
|
15
15
|
componentId: "sc-lxmlid-0"
|
|
16
16
|
})(["grid-row:2;", " position:absolute;left:2px;top:", ";pointer-events:none;text-align:left;transform:translate(calc(-1 * calc((100% - 8px) / 2)));&:last-child{left:auto;right:2px;transform:translate(calc((100% - 8px) / 2));}"], typographyTemplate(output.typography), track.spacings.top);
|
|
17
|
-
const MinMax = /*#__PURE__*/forwardRef(function MinMax({
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const MinMax = /*#__PURE__*/forwardRef(function MinMax(_ref, ref) {
|
|
18
|
+
let {
|
|
19
|
+
children
|
|
20
|
+
} = _ref;
|
|
20
21
|
return /*#__PURE__*/jsx(StyledMinMax, {
|
|
21
22
|
ref: ref,
|
|
22
23
|
children: children
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import { typographyTemplate } from '@equinor/eds-utils';
|
|
3
4
|
import { slider } from './Slider.tokens.js';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
import { typographyTemplate } from '../../utils/templates/index.js';
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
8
|
entities: {
|
|
@@ -13,14 +13,18 @@ const {
|
|
|
13
13
|
const StyledOutput = styled.output.withConfig({
|
|
14
14
|
displayName: "Output__StyledOutput",
|
|
15
15
|
componentId: "sc-1dy945x-0"
|
|
16
|
-
})(["--val:", ";--realWidth:calc(100% - 12px);width:fit-content;position:relative;z-index:1;", " background:", ";padding:0 5px;top:", ";pointer-events:none;margin-left:calc((var(--val) - var(--min)) / var(--dif) * var(--realWidth));transform:translate(calc(-1 * calc(var(--realWidth) / 2)));grid-row:2;grid-column:1 / -1;"],
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
})(["--val:", ";--realWidth:calc(100% - 12px);width:fit-content;position:relative;z-index:1;", " background:", ";padding:0 5px;top:", ";pointer-events:none;margin-left:calc((var(--val) - var(--min)) / var(--dif) * var(--realWidth));transform:translate(calc(-1 * calc(var(--realWidth) / 2)));grid-row:2;grid-column:1 / -1;"], _ref => {
|
|
17
|
+
let {
|
|
18
|
+
value
|
|
19
|
+
} = _ref;
|
|
20
|
+
return value;
|
|
21
|
+
}, typographyTemplate(output.typography), slider.background, track.spacings.top);
|
|
22
|
+
const Output = /*#__PURE__*/forwardRef(function Output(_ref2, ref) {
|
|
23
|
+
let {
|
|
24
|
+
children,
|
|
25
|
+
value,
|
|
26
|
+
htmlFor
|
|
27
|
+
} = _ref2;
|
|
24
28
|
return /*#__PURE__*/jsx(StyledOutput, {
|
|
25
29
|
ref: ref,
|
|
26
30
|
value: value,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { forwardRef, useState, useRef } from 'react';
|
|
1
|
+
import { forwardRef, useState, useEffect, useRef } 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 { bordersTemplate } from '@equinor/eds-utils';
|
|
7
8
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
8
|
-
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
9
9
|
|
|
10
10
|
const {
|
|
11
11
|
entities: {
|
|
@@ -23,29 +23,56 @@ const wrapperGrid = css(["display:grid;grid-template-rows:max-content 24px;grid-
|
|
|
23
23
|
const RangeWrapper = styled.div.withConfig({
|
|
24
24
|
displayName: "Slider__RangeWrapper",
|
|
25
25
|
componentId: "sc-n1grrg-0"
|
|
26
|
-
})(["--a:", ";--b:", ";--min:", ";--max:", ";--dif:calc(var(--max) - var(--min));--realWidth:calc(100% - 12px);", " ", " &::before,&::after{", " background:", ";}&::before{margin-left:calc( calc(", " / 2) + (var(--a) - var(--min)) / var(--dif) * var(--realWidth) );width:calc((var(--b) - var(--a)) / var(--dif) * var(--realWidth));}&::after{margin-left:calc( calc(", " / 2) + (var(--b) - var(--min)) / var(--dif) * var(--realWidth) );width:calc((var(--a) - var(--b)) / var(--dif) * var(--realWidth));}@media (hover:hover) and (pointer:fine){&:hover:not([disabled]){", " &::before,&::after{background:", ";}}}"],
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
26
|
+
})(["--a:", ";--b:", ";--min:", ";--max:", ";--dif:calc(var(--max) - var(--min));--realWidth:calc(100% - 12px);", " ", " &::before,&::after{", " background:", ";}&::before{margin-left:calc( calc(", " / 2) + (var(--a) - var(--min)) / var(--dif) * var(--realWidth) );width:calc((var(--b) - var(--a)) / var(--dif) * var(--realWidth));}&::after{margin-left:calc( calc(", " / 2) + (var(--b) - var(--min)) / var(--dif) * var(--realWidth) );width:calc((var(--a) - var(--b)) / var(--dif) * var(--realWidth));}@media (hover:hover) and (pointer:fine){&:hover:not([disabled]){", " &::before,&::after{background:", ";}}}"], _ref => {
|
|
27
|
+
let {
|
|
28
|
+
valA
|
|
29
|
+
} = _ref;
|
|
30
|
+
return valA;
|
|
31
|
+
}, _ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
valB
|
|
34
|
+
} = _ref2;
|
|
35
|
+
return valB;
|
|
36
|
+
}, _ref3 => {
|
|
37
|
+
let {
|
|
38
|
+
min
|
|
39
|
+
} = _ref3;
|
|
40
|
+
return min;
|
|
41
|
+
}, _ref4 => {
|
|
42
|
+
let {
|
|
43
|
+
max
|
|
44
|
+
} = _ref4;
|
|
45
|
+
return max;
|
|
46
|
+
}, wrapperGrid, fakeTrackBg, trackFill, _ref5 => {
|
|
47
|
+
let {
|
|
48
|
+
disabled
|
|
49
|
+
} = _ref5;
|
|
50
|
+
return disabled ? track.entities.indicator.states.disabled.background : track.entities.indicator.background;
|
|
51
|
+
}, handle.width, handle.width, fakeTrackBgHover, track.entities.indicator.states.hover.background);
|
|
37
52
|
const Wrapper = styled.div.withConfig({
|
|
38
53
|
displayName: "Slider__Wrapper",
|
|
39
54
|
componentId: "sc-n1grrg-1"
|
|
40
|
-
})(["--min:", ";--max:", ";--dif:calc(var(--max) - var(--min));--value:", ";--realWidth:calc(100% - 12px);", " ", " &::after{", " background:", "}&::after{margin-right:calc( (var(--max) - var(--value)) / var(--dif) * var(--realWidth) );margin-left:3px;}@media (hover:hover) and (pointer:fine){&:hover:not([disabled]){", " &::after{background:", ";}}}"],
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
55
|
+
})(["--min:", ";--max:", ";--dif:calc(var(--max) - var(--min));--value:", ";--realWidth:calc(100% - 12px);", " ", " &::after{", " background:", "}&::after{margin-right:calc( (var(--max) - var(--value)) / var(--dif) * var(--realWidth) );margin-left:3px;}@media (hover:hover) and (pointer:fine){&:hover:not([disabled]){", " &::after{background:", ";}}}"], _ref6 => {
|
|
56
|
+
let {
|
|
57
|
+
min
|
|
58
|
+
} = _ref6;
|
|
59
|
+
return min;
|
|
60
|
+
}, _ref7 => {
|
|
61
|
+
let {
|
|
62
|
+
max
|
|
63
|
+
} = _ref7;
|
|
64
|
+
return max;
|
|
65
|
+
}, _ref8 => {
|
|
66
|
+
let {
|
|
67
|
+
value
|
|
68
|
+
} = _ref8;
|
|
69
|
+
return value;
|
|
70
|
+
}, wrapperGrid, fakeTrackBg, trackFill, _ref9 => {
|
|
71
|
+
let {
|
|
72
|
+
disabled
|
|
73
|
+
} = _ref9;
|
|
74
|
+
return disabled ? track.entities.indicator.states.disabled.background : track.entities.indicator.background;
|
|
75
|
+
}, fakeTrackBgHover, track.entities.indicator.states.hover.background);
|
|
49
76
|
const WrapperGroupLabel = styled.div.withConfig({
|
|
50
77
|
displayName: "Slider__WrapperGroupLabel",
|
|
51
78
|
componentId: "sc-n1grrg-2"
|
|
@@ -58,22 +85,38 @@ const SrOnlyLabel = styled.label.withConfig({
|
|
|
58
85
|
displayName: "Slider__SrOnlyLabel",
|
|
59
86
|
componentId: "sc-n1grrg-4"
|
|
60
87
|
})(["position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;"]);
|
|
61
|
-
const Slider = /*#__PURE__*/forwardRef(function Slider({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
const Slider = /*#__PURE__*/forwardRef(function Slider(_ref10, ref) {
|
|
89
|
+
let {
|
|
90
|
+
min = 0,
|
|
91
|
+
max = 100,
|
|
92
|
+
value = [40, 60],
|
|
93
|
+
outputFunction,
|
|
94
|
+
onChange,
|
|
95
|
+
onChangeCommitted,
|
|
96
|
+
minMaxDots = true,
|
|
97
|
+
minMaxValues = true,
|
|
98
|
+
step = 1,
|
|
99
|
+
disabled,
|
|
100
|
+
ariaLabelledby,
|
|
101
|
+
...rest
|
|
102
|
+
} = _ref10;
|
|
75
103
|
const isRangeSlider = Array.isArray(value);
|
|
76
|
-
const
|
|
104
|
+
const parsedValue = isRangeSlider ? value : [value];
|
|
105
|
+
const [initalValue, setInitalValue] = useState(parsedValue);
|
|
106
|
+
const [sliderValue, setSliderValue] = useState(parsedValue);
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (isRangeSlider) {
|
|
109
|
+
if (value[0] !== initalValue[0] || value[1] !== initalValue[1]) {
|
|
110
|
+
setInitalValue(value);
|
|
111
|
+
setSliderValue(value);
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
if (value !== initalValue[0]) {
|
|
115
|
+
setInitalValue([value]);
|
|
116
|
+
setSliderValue([value]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}, [value, initalValue, isRangeSlider]);
|
|
77
120
|
const minRange = useRef(null);
|
|
78
121
|
const maxRange = useRef(null);
|
|
79
122
|
|
|
@@ -103,7 +146,7 @@ const Slider = /*#__PURE__*/forwardRef(function Slider({
|
|
|
103
146
|
};
|
|
104
147
|
|
|
105
148
|
const handleKeyUp = event => {
|
|
106
|
-
if (event.
|
|
149
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
|
107
150
|
handleCommitedValue(event);
|
|
108
151
|
}
|
|
109
152
|
};
|
|
@@ -41,6 +41,11 @@ const {
|
|
|
41
41
|
},
|
|
42
42
|
typography: {
|
|
43
43
|
paragraph
|
|
44
|
+
},
|
|
45
|
+
interactions: {
|
|
46
|
+
focused: {
|
|
47
|
+
width: focusOutlineWidth
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
} = tokens;
|
|
46
51
|
const slider = {
|
|
@@ -93,9 +98,9 @@ const slider = {
|
|
|
93
98
|
outline: {
|
|
94
99
|
type: 'outline',
|
|
95
100
|
color: focusOutlineColor,
|
|
96
|
-
width:
|
|
101
|
+
width: focusOutlineWidth,
|
|
97
102
|
style: 'dashed',
|
|
98
|
-
offset: '
|
|
103
|
+
offset: '3px'
|
|
99
104
|
}
|
|
100
105
|
},
|
|
101
106
|
hover: {
|