@equinor/eds-core-react 0.28.0-dev12052022 → 0.28.0
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 +48 -32
- package/dist/esm/components/Autocomplete/Autocomplete.js +23 -11
- package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +7 -6
- package/dist/esm/components/Autocomplete/Option.js +7 -4
- package/dist/types/components/Autocomplete/Autocomplete.d.ts +4 -0
- package/dist/types/components/Autocomplete/Option.d.ts +2 -0
- package/package.json +2 -2
|
@@ -56,11 +56,11 @@ var buttonTypography = edsTokens.tokens.typography.navigation.button,
|
|
|
56
56
|
disabledBorderColor$2 = _tokens$colors$intera$l.disabled__border.rgba,
|
|
57
57
|
disabledColor$3 = _tokens$colors$intera$l.disabled__fill.rgba,
|
|
58
58
|
medium$7 = edsTokens.tokens.spacings.comfortable.medium,
|
|
59
|
-
_tokens$shape$
|
|
60
|
-
_tokens$shape$button = _tokens$shape$
|
|
59
|
+
_tokens$shape$1 = edsTokens.tokens.shape,
|
|
60
|
+
_tokens$shape$button = _tokens$shape$1.button,
|
|
61
61
|
buttonHeight = _tokens$shape$button.minHeight,
|
|
62
62
|
buttonBorderRadius$2 = _tokens$shape$button.borderRadius,
|
|
63
|
-
compactButtonHeight = _tokens$shape$
|
|
63
|
+
compactButtonHeight = _tokens$shape$1._modes.compact.button.minHeight,
|
|
64
64
|
outline = edsTokens.tokens.interactions.focused,
|
|
65
65
|
_tokens$clickbounds$4 = edsTokens.tokens.clickbounds,
|
|
66
66
|
clicboundHeight$2 = _tokens$clickbounds$4.default__base,
|
|
@@ -4008,16 +4008,16 @@ var _tokens$colors$c = edsTokens.tokens.colors,
|
|
|
4008
4008
|
borderRadius$5 = edsTokens.tokens.shape.corners.borderRadius,
|
|
4009
4009
|
_tokens$spacings$comf$b = edsTokens.tokens.spacings.comfortable,
|
|
4010
4010
|
small$4 = _tokens$spacings$comf$b.small,
|
|
4011
|
-
x_large = _tokens$spacings$comf$b.x_large,
|
|
4012
|
-
xxx_large = _tokens$spacings$comf$b.xxx_large,
|
|
4011
|
+
x_large$1 = _tokens$spacings$comf$b.x_large,
|
|
4012
|
+
xxx_large$1 = _tokens$spacings$comf$b.xxx_large,
|
|
4013
4013
|
typography$9 = edsTokens.tokens.typography;
|
|
4014
4014
|
var tableOfContents = {
|
|
4015
4015
|
typography: _objectSpread__default["default"](_objectSpread__default["default"]({}, typography$9.navigation.button), {}, {
|
|
4016
4016
|
color: labelColor
|
|
4017
4017
|
}),
|
|
4018
4018
|
spacings: {
|
|
4019
|
-
top: xxx_large,
|
|
4020
|
-
bottom: x_large
|
|
4019
|
+
top: xxx_large$1,
|
|
4020
|
+
bottom: x_large$1
|
|
4021
4021
|
},
|
|
4022
4022
|
entities: {
|
|
4023
4023
|
icon: {
|
|
@@ -4043,8 +4043,8 @@ var tableOfContents = {
|
|
|
4043
4043
|
},
|
|
4044
4044
|
sticky: {
|
|
4045
4045
|
spacings: {
|
|
4046
|
-
top: x_large,
|
|
4047
|
-
right: x_large
|
|
4046
|
+
top: x_large$1,
|
|
4047
|
+
right: x_large$1
|
|
4048
4048
|
}
|
|
4049
4049
|
}
|
|
4050
4050
|
},
|
|
@@ -7829,9 +7829,9 @@ var _tokens$colors$1 = edsTokens.tokens.colors,
|
|
|
7829
7829
|
clickbounds = edsTokens.tokens.clickbounds,
|
|
7830
7830
|
boxShadow$1 = edsTokens.tokens.elevation.raised,
|
|
7831
7831
|
medium_small = edsTokens.tokens.spacings.comfortable.medium_small,
|
|
7832
|
-
_tokens$shape
|
|
7833
|
-
circle = _tokens$shape
|
|
7834
|
-
compactIconButton = _tokens$shape
|
|
7832
|
+
_tokens$shape = edsTokens.tokens.shape,
|
|
7833
|
+
circle = _tokens$shape.circle,
|
|
7834
|
+
compactIconButton = _tokens$shape._modes.compact.icon_button,
|
|
7835
7835
|
focusOutlineWidth = edsTokens.tokens.interactions.focused.width;
|
|
7836
7836
|
var comfortable = {
|
|
7837
7837
|
typography: labelTypography,
|
|
@@ -8005,20 +8005,18 @@ Switch.displayName = 'Switch';
|
|
|
8005
8005
|
|
|
8006
8006
|
var typography = edsTokens.tokens.typography,
|
|
8007
8007
|
colors = edsTokens.tokens.colors,
|
|
8008
|
-
|
|
8009
|
-
straight = _tokens$shape.straight,
|
|
8010
|
-
borderRadius = _tokens$shape.corners.borderRadius,
|
|
8008
|
+
borderRadius = edsTokens.tokens.shape.corners.borderRadius,
|
|
8011
8009
|
_tokens$spacings$comf$1 = edsTokens.tokens.spacings.comfortable,
|
|
8012
8010
|
spacingSmall = _tokens$spacings$comf$1.small,
|
|
8013
8011
|
spacingMediumSmall = _tokens$spacings$comf$1.medium_small,
|
|
8014
8012
|
spacingMedium = _tokens$spacings$comf$1.medium,
|
|
8015
8013
|
spacingLarge = _tokens$spacings$comf$1.large,
|
|
8016
|
-
|
|
8014
|
+
x_large = _tokens$spacings$comf$1.x_large,
|
|
8015
|
+
xxx_large = _tokens$spacings$comf$1.xxx_large,
|
|
8017
8016
|
boxShadow = edsTokens.tokens.elevation.temporary_nav;
|
|
8018
8017
|
var selectTokens = {
|
|
8019
8018
|
background: colors.ui.background__default.rgba,
|
|
8020
8019
|
boxShadow: boxShadow,
|
|
8021
|
-
minHeight: straight.minHeight,
|
|
8022
8020
|
spacings: {
|
|
8023
8021
|
top: '0',
|
|
8024
8022
|
right: spacingLarge,
|
|
@@ -8056,6 +8054,7 @@ var selectTokens = {
|
|
|
8056
8054
|
}
|
|
8057
8055
|
},
|
|
8058
8056
|
label: {
|
|
8057
|
+
minHeight: xxx_large,
|
|
8059
8058
|
spacings: {
|
|
8060
8059
|
left: '0',
|
|
8061
8060
|
right: '0',
|
|
@@ -8081,6 +8080,7 @@ var selectTokens = {
|
|
|
8081
8080
|
}
|
|
8082
8081
|
},
|
|
8083
8082
|
label: {
|
|
8083
|
+
minHeight: x_large,
|
|
8084
8084
|
spacings: {
|
|
8085
8085
|
left: '0',
|
|
8086
8086
|
right: '0',
|
|
@@ -8102,14 +8102,15 @@ var multiSelect = mergeDeepRight$1(selectTokens, {
|
|
|
8102
8102
|
modes: {
|
|
8103
8103
|
compact: {
|
|
8104
8104
|
spacings: {
|
|
8105
|
-
top:
|
|
8105
|
+
top: '0',
|
|
8106
|
+
//xx_small,
|
|
8106
8107
|
bottom: '0'
|
|
8107
8108
|
}
|
|
8108
8109
|
}
|
|
8109
8110
|
}
|
|
8110
8111
|
});
|
|
8111
8112
|
|
|
8112
|
-
var _excluded$6 = ["value", "multiple", "isSelected", "isDisabled", "onClick", "aria-selected"];
|
|
8113
|
+
var _excluded$6 = ["value", "multiple", "isSelected", "isDisabled", "multiline", "onClick", "aria-selected"];
|
|
8113
8114
|
var StyledListItem = styled__default["default"].li.withConfig({
|
|
8114
8115
|
displayName: "Option__StyledListItem",
|
|
8115
8116
|
componentId: "sc-1ly11zu-0"
|
|
@@ -8119,20 +8120,22 @@ var StyledListItem = styled__default["default"].li.withConfig({
|
|
|
8119
8120
|
active = _ref.active,
|
|
8120
8121
|
isdisabled = _ref.isdisabled;
|
|
8121
8122
|
var backgroundColor = highlighted === 'true' ? theme.states.hover.background : active === 'true' ? theme.states.active.background : theme.background;
|
|
8122
|
-
return styled.css(["display:flex;grid-area:1 / -1;align-items:center;align-self:start;margin:0;list-style:none;background-color:", ";user-select:none;
|
|
8123
|
+
return styled.css(["display:flex;grid-area:1 / -1;align-items:center;align-self:start;margin:0;list-style:none;background-color:", ";user-select:none;overflow:hidden;cursor:", ";", " ", " ", ""], backgroundColor, highlighted === 'true' ? 'pointer' : 'default', edsUtils.typographyTemplate(theme.typography), edsUtils.spacingsTemplate(theme.spacings), isdisabled === 'true' ? styled.css(["color:", ";"], theme.states.disabled.typography.color) : '');
|
|
8123
8124
|
});
|
|
8124
8125
|
var Label = styled__default["default"].span.withConfig({
|
|
8125
8126
|
displayName: "Option__Label",
|
|
8126
8127
|
componentId: "sc-1ly11zu-1"
|
|
8127
8128
|
})(function (_ref2) {
|
|
8128
|
-
var theme = _ref2.theme
|
|
8129
|
-
|
|
8129
|
+
var theme = _ref2.theme,
|
|
8130
|
+
multiline = _ref2.multiline;
|
|
8131
|
+
return styled.css(["", " text-overflow:ellipsis;white-space:", ";overflow:", ";overflow-wrap:anywhere;"], edsUtils.spacingsTemplate(theme.entities.label.spacings), multiline ? 'normal' : 'nowrap', multiline ? 'initial' : 'hidden');
|
|
8130
8132
|
});
|
|
8131
8133
|
var AutocompleteOption = /*#__PURE__*/react.forwardRef(function AutocompleteOption(_ref3, ref) {
|
|
8132
8134
|
var value = _ref3.value,
|
|
8133
8135
|
multiple = _ref3.multiple,
|
|
8134
8136
|
isSelected = _ref3.isSelected,
|
|
8135
8137
|
isDisabled = _ref3.isDisabled,
|
|
8138
|
+
multiline = _ref3.multiline,
|
|
8136
8139
|
_onClick = _ref3.onClick,
|
|
8137
8140
|
ariaSelected = _ref3['aria-selected'],
|
|
8138
8141
|
other = _objectWithoutProperties__default["default"](_ref3, _excluded$6);
|
|
@@ -8154,12 +8157,13 @@ var AutocompleteOption = /*#__PURE__*/react.forwardRef(function AutocompleteOpti
|
|
|
8154
8157
|
return null;
|
|
8155
8158
|
}
|
|
8156
8159
|
}), /*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
8160
|
+
multiline: multiline,
|
|
8157
8161
|
children: value
|
|
8158
8162
|
})]
|
|
8159
8163
|
}));
|
|
8160
8164
|
});
|
|
8161
8165
|
|
|
8162
|
-
var _excluded$5 = ["options", "label", "meta", "className", "style", "disabled", "readOnly", "hideClearButton", "onOptionsChange", "selectedOptions", "multiple", "initialSelectedOptions", "disablePortal", "optionDisabled", "optionsFilter", "autoWidth", "placeholder", "optionLabel", "clearSearchOnChange"];
|
|
8166
|
+
var _excluded$5 = ["options", "label", "meta", "className", "style", "disabled", "readOnly", "hideClearButton", "onOptionsChange", "selectedOptions", "multiple", "initialSelectedOptions", "disablePortal", "optionDisabled", "optionsFilter", "autoWidth", "placeholder", "optionLabel", "clearSearchOnChange", "multiline"];
|
|
8163
8167
|
var Container$1 = styled__default["default"].div.withConfig({
|
|
8164
8168
|
displayName: "Autocomplete__Container",
|
|
8165
8169
|
componentId: "sc-yvif0e-0"
|
|
@@ -8266,6 +8270,8 @@ function AutocompleteInner(props, ref) {
|
|
|
8266
8270
|
optionLabel = props.optionLabel,
|
|
8267
8271
|
_props$clearSearchOnC = props.clearSearchOnChange,
|
|
8268
8272
|
clearSearchOnChange = _props$clearSearchOnC === void 0 ? true : _props$clearSearchOnC,
|
|
8273
|
+
_props$multiline = props.multiline,
|
|
8274
|
+
multiline = _props$multiline === void 0 ? false : _props$multiline,
|
|
8269
8275
|
other = _objectWithoutProperties__default["default"](props, _excluded$5);
|
|
8270
8276
|
var anchorRef = react.useRef(null);
|
|
8271
8277
|
var isControlled = Boolean(selectedOptions);
|
|
@@ -8354,10 +8360,16 @@ function AutocompleteInner(props, ref) {
|
|
|
8354
8360
|
return scrollContainer.current;
|
|
8355
8361
|
},
|
|
8356
8362
|
estimateSize: react.useCallback(function () {
|
|
8357
|
-
return
|
|
8358
|
-
}, []),
|
|
8359
|
-
overscan:
|
|
8363
|
+
return parseInt(token().entities.label.minHeight);
|
|
8364
|
+
}, [token]),
|
|
8365
|
+
overscan: 25
|
|
8360
8366
|
});
|
|
8367
|
+
|
|
8368
|
+
//https://github.com/TanStack/virtual/discussions/379#discussioncomment-3501037
|
|
8369
|
+
edsUtils.useIsomorphicLayoutEffect(function () {
|
|
8370
|
+
var _rowVirtualizer$measu;
|
|
8371
|
+
rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : (_rowVirtualizer$measu = rowVirtualizer.measure) === null || _rowVirtualizer$measu === void 0 ? void 0 : _rowVirtualizer$measu.call(rowVirtualizer);
|
|
8372
|
+
}, [rowVirtualizer, density]);
|
|
8361
8373
|
var comboBoxProps = {
|
|
8362
8374
|
items: availableItems,
|
|
8363
8375
|
initialSelectedItem: initialSelectedOptions[0],
|
|
@@ -8597,16 +8609,20 @@ function AutocompleteInner(props, ref) {
|
|
|
8597
8609
|
multiple: multiple,
|
|
8598
8610
|
highlighted: highlightedIndex === index && !isDisabled ? 'true' : 'false',
|
|
8599
8611
|
isSelected: isSelected,
|
|
8600
|
-
isDisabled: isDisabled
|
|
8601
|
-
|
|
8602
|
-
|
|
8612
|
+
isDisabled: isDisabled,
|
|
8613
|
+
multiline: multiline
|
|
8614
|
+
}, getItemProps(_objectSpread__default["default"](_objectSpread__default["default"]({}, multiline && {
|
|
8615
|
+
ref: rowVirtualizer.measureElement
|
|
8616
|
+
}), {}, {
|
|
8603
8617
|
item: item,
|
|
8604
8618
|
index: index,
|
|
8605
8619
|
disabled: disabled,
|
|
8606
|
-
style: {
|
|
8620
|
+
style: _objectSpread__default["default"]({
|
|
8607
8621
|
transform: "translateY(".concat(virtualItem.start, "px)")
|
|
8608
|
-
}
|
|
8609
|
-
|
|
8622
|
+
}, !multiline && {
|
|
8623
|
+
height: "".concat(virtualItem.size, "px")
|
|
8624
|
+
})
|
|
8625
|
+
}))), virtualItem.key);
|
|
8610
8626
|
})]
|
|
8611
8627
|
}))
|
|
8612
8628
|
}));
|
|
@@ -11,7 +11,7 @@ import { List } from '../List/index.js';
|
|
|
11
11
|
import { Icon } from '../Icon/index.js';
|
|
12
12
|
import { close, arrow_drop_up, arrow_drop_down } from '@equinor/eds-icons';
|
|
13
13
|
import { multiSelect, selectTokens } from './Autocomplete.tokens.js';
|
|
14
|
-
import { bordersTemplate, useToken } from '@equinor/eds-utils';
|
|
14
|
+
import { bordersTemplate, useToken, useIsomorphicLayoutEffect } from '@equinor/eds-utils';
|
|
15
15
|
import { AutocompleteOption } from './Option.js';
|
|
16
16
|
import { useFloating, offset, flip, shift, size, useInteractions, autoUpdate, FloatingPortal } from '@floating-ui/react-dom-interactions';
|
|
17
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -19,7 +19,7 @@ import { useEds } from '../EdsProvider/eds.context.js';
|
|
|
19
19
|
import { Label } from '../Label/Label.js';
|
|
20
20
|
import { Input } from '../Input/Input.js';
|
|
21
21
|
|
|
22
|
-
var _excluded = ["options", "label", "meta", "className", "style", "disabled", "readOnly", "hideClearButton", "onOptionsChange", "selectedOptions", "multiple", "initialSelectedOptions", "disablePortal", "optionDisabled", "optionsFilter", "autoWidth", "placeholder", "optionLabel", "clearSearchOnChange"];
|
|
22
|
+
var _excluded = ["options", "label", "meta", "className", "style", "disabled", "readOnly", "hideClearButton", "onOptionsChange", "selectedOptions", "multiple", "initialSelectedOptions", "disablePortal", "optionDisabled", "optionsFilter", "autoWidth", "placeholder", "optionLabel", "clearSearchOnChange", "multiline"];
|
|
23
23
|
var Container = styled.div.withConfig({
|
|
24
24
|
displayName: "Autocomplete__Container",
|
|
25
25
|
componentId: "sc-yvif0e-0"
|
|
@@ -126,6 +126,8 @@ function AutocompleteInner(props, ref) {
|
|
|
126
126
|
optionLabel = props.optionLabel,
|
|
127
127
|
_props$clearSearchOnC = props.clearSearchOnChange,
|
|
128
128
|
clearSearchOnChange = _props$clearSearchOnC === void 0 ? true : _props$clearSearchOnC,
|
|
129
|
+
_props$multiline = props.multiline,
|
|
130
|
+
multiline = _props$multiline === void 0 ? false : _props$multiline,
|
|
129
131
|
other = _objectWithoutProperties(props, _excluded);
|
|
130
132
|
var anchorRef = useRef(null);
|
|
131
133
|
var isControlled = Boolean(selectedOptions);
|
|
@@ -214,10 +216,16 @@ function AutocompleteInner(props, ref) {
|
|
|
214
216
|
return scrollContainer.current;
|
|
215
217
|
},
|
|
216
218
|
estimateSize: useCallback(function () {
|
|
217
|
-
return
|
|
218
|
-
}, []),
|
|
219
|
-
overscan:
|
|
219
|
+
return parseInt(token().entities.label.minHeight);
|
|
220
|
+
}, [token]),
|
|
221
|
+
overscan: 25
|
|
220
222
|
});
|
|
223
|
+
|
|
224
|
+
//https://github.com/TanStack/virtual/discussions/379#discussioncomment-3501037
|
|
225
|
+
useIsomorphicLayoutEffect(function () {
|
|
226
|
+
var _rowVirtualizer$measu;
|
|
227
|
+
rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : (_rowVirtualizer$measu = rowVirtualizer.measure) === null || _rowVirtualizer$measu === void 0 ? void 0 : _rowVirtualizer$measu.call(rowVirtualizer);
|
|
228
|
+
}, [rowVirtualizer, density]);
|
|
221
229
|
var comboBoxProps = {
|
|
222
230
|
items: availableItems,
|
|
223
231
|
initialSelectedItem: initialSelectedOptions[0],
|
|
@@ -457,16 +465,20 @@ function AutocompleteInner(props, ref) {
|
|
|
457
465
|
multiple: multiple,
|
|
458
466
|
highlighted: highlightedIndex === index && !isDisabled ? 'true' : 'false',
|
|
459
467
|
isSelected: isSelected,
|
|
460
|
-
isDisabled: isDisabled
|
|
461
|
-
|
|
462
|
-
|
|
468
|
+
isDisabled: isDisabled,
|
|
469
|
+
multiline: multiline
|
|
470
|
+
}, getItemProps(_objectSpread(_objectSpread({}, multiline && {
|
|
471
|
+
ref: rowVirtualizer.measureElement
|
|
472
|
+
}), {}, {
|
|
463
473
|
item: item,
|
|
464
474
|
index: index,
|
|
465
475
|
disabled: disabled,
|
|
466
|
-
style: {
|
|
476
|
+
style: _objectSpread({
|
|
467
477
|
transform: "translateY(".concat(virtualItem.start, "px)")
|
|
468
|
-
}
|
|
469
|
-
|
|
478
|
+
}, !multiline && {
|
|
479
|
+
height: "".concat(virtualItem.size, "px")
|
|
480
|
+
})
|
|
481
|
+
}))), virtualItem.key);
|
|
470
482
|
})]
|
|
471
483
|
}))
|
|
472
484
|
}));
|
|
@@ -4,20 +4,18 @@ import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.28.0/node_modules/r
|
|
|
4
4
|
|
|
5
5
|
var typography = tokens.typography,
|
|
6
6
|
colors = tokens.colors,
|
|
7
|
-
|
|
8
|
-
straight = _tokens$shape.straight,
|
|
9
|
-
borderRadius = _tokens$shape.corners.borderRadius,
|
|
7
|
+
borderRadius = tokens.shape.corners.borderRadius,
|
|
10
8
|
_tokens$spacings$comf = tokens.spacings.comfortable,
|
|
11
9
|
spacingSmall = _tokens$spacings$comf.small,
|
|
12
10
|
spacingMediumSmall = _tokens$spacings$comf.medium_small,
|
|
13
11
|
spacingMedium = _tokens$spacings$comf.medium,
|
|
14
12
|
spacingLarge = _tokens$spacings$comf.large,
|
|
15
|
-
|
|
13
|
+
x_large = _tokens$spacings$comf.x_large,
|
|
14
|
+
xxx_large = _tokens$spacings$comf.xxx_large,
|
|
16
15
|
boxShadow = tokens.elevation.temporary_nav;
|
|
17
16
|
var selectTokens = {
|
|
18
17
|
background: colors.ui.background__default.rgba,
|
|
19
18
|
boxShadow: boxShadow,
|
|
20
|
-
minHeight: straight.minHeight,
|
|
21
19
|
spacings: {
|
|
22
20
|
top: '0',
|
|
23
21
|
right: spacingLarge,
|
|
@@ -55,6 +53,7 @@ var selectTokens = {
|
|
|
55
53
|
}
|
|
56
54
|
},
|
|
57
55
|
label: {
|
|
56
|
+
minHeight: xxx_large,
|
|
58
57
|
spacings: {
|
|
59
58
|
left: '0',
|
|
60
59
|
right: '0',
|
|
@@ -80,6 +79,7 @@ var selectTokens = {
|
|
|
80
79
|
}
|
|
81
80
|
},
|
|
82
81
|
label: {
|
|
82
|
+
minHeight: x_large,
|
|
83
83
|
spacings: {
|
|
84
84
|
left: '0',
|
|
85
85
|
right: '0',
|
|
@@ -101,7 +101,8 @@ var multiSelect = mergeDeepRight(selectTokens, {
|
|
|
101
101
|
modes: {
|
|
102
102
|
compact: {
|
|
103
103
|
spacings: {
|
|
104
|
-
top:
|
|
104
|
+
top: '0',
|
|
105
|
+
//xx_small,
|
|
105
106
|
bottom: '0'
|
|
106
107
|
}
|
|
107
108
|
}
|
|
@@ -6,7 +6,7 @@ import { typographyTemplate, spacingsTemplate } from '@equinor/eds-utils';
|
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
7
|
import { Checkbox } from '../Checkbox/Checkbox.js';
|
|
8
8
|
|
|
9
|
-
var _excluded = ["value", "multiple", "isSelected", "isDisabled", "onClick", "aria-selected"];
|
|
9
|
+
var _excluded = ["value", "multiple", "isSelected", "isDisabled", "multiline", "onClick", "aria-selected"];
|
|
10
10
|
var StyledListItem = styled.li.withConfig({
|
|
11
11
|
displayName: "Option__StyledListItem",
|
|
12
12
|
componentId: "sc-1ly11zu-0"
|
|
@@ -16,20 +16,22 @@ var StyledListItem = styled.li.withConfig({
|
|
|
16
16
|
active = _ref.active,
|
|
17
17
|
isdisabled = _ref.isdisabled;
|
|
18
18
|
var backgroundColor = highlighted === 'true' ? theme.states.hover.background : active === 'true' ? theme.states.active.background : theme.background;
|
|
19
|
-
return css(["display:flex;grid-area:1 / -1;align-items:center;align-self:start;margin:0;list-style:none;background-color:", ";user-select:none;
|
|
19
|
+
return css(["display:flex;grid-area:1 / -1;align-items:center;align-self:start;margin:0;list-style:none;background-color:", ";user-select:none;overflow:hidden;cursor:", ";", " ", " ", ""], backgroundColor, highlighted === 'true' ? 'pointer' : 'default', typographyTemplate(theme.typography), spacingsTemplate(theme.spacings), isdisabled === 'true' ? css(["color:", ";"], theme.states.disabled.typography.color) : '');
|
|
20
20
|
});
|
|
21
21
|
var Label = styled.span.withConfig({
|
|
22
22
|
displayName: "Option__Label",
|
|
23
23
|
componentId: "sc-1ly11zu-1"
|
|
24
24
|
})(function (_ref2) {
|
|
25
|
-
var theme = _ref2.theme
|
|
26
|
-
|
|
25
|
+
var theme = _ref2.theme,
|
|
26
|
+
multiline = _ref2.multiline;
|
|
27
|
+
return css(["", " text-overflow:ellipsis;white-space:", ";overflow:", ";overflow-wrap:anywhere;"], spacingsTemplate(theme.entities.label.spacings), multiline ? 'normal' : 'nowrap', multiline ? 'initial' : 'hidden');
|
|
27
28
|
});
|
|
28
29
|
var AutocompleteOption = /*#__PURE__*/forwardRef(function AutocompleteOption(_ref3, ref) {
|
|
29
30
|
var value = _ref3.value,
|
|
30
31
|
multiple = _ref3.multiple,
|
|
31
32
|
isSelected = _ref3.isSelected,
|
|
32
33
|
isDisabled = _ref3.isDisabled,
|
|
34
|
+
multiline = _ref3.multiline,
|
|
33
35
|
_onClick = _ref3.onClick,
|
|
34
36
|
ariaSelected = _ref3['aria-selected'],
|
|
35
37
|
other = _objectWithoutProperties(_ref3, _excluded);
|
|
@@ -51,6 +53,7 @@ var AutocompleteOption = /*#__PURE__*/forwardRef(function AutocompleteOption(_re
|
|
|
51
53
|
return null;
|
|
52
54
|
}
|
|
53
55
|
}), /*#__PURE__*/jsx(Label, {
|
|
56
|
+
multiline: multiline,
|
|
54
57
|
children: value
|
|
55
58
|
})]
|
|
56
59
|
}));
|
|
@@ -42,6 +42,8 @@ export declare type AutocompleteProps<T> = {
|
|
|
42
42
|
placeholder?: string;
|
|
43
43
|
/** Toggle if input is cleared when an options is selected when `multiple` is `true`*/
|
|
44
44
|
clearSearchOnChange?: boolean;
|
|
45
|
+
/** Will wrap overflowing text at the expence of some performance overhead to calculate item heigths. Mostly relevant in combination with autoWidth */
|
|
46
|
+
multiline?: boolean;
|
|
45
47
|
} & HTMLAttributes<HTMLDivElement>;
|
|
46
48
|
declare function AutocompleteInner<T>(props: AutocompleteProps<T>, ref: React.ForwardedRef<HTMLDivElement>): JSX.Element;
|
|
47
49
|
export declare const Autocomplete: <T>(props: {
|
|
@@ -84,6 +86,8 @@ export declare const Autocomplete: <T>(props: {
|
|
|
84
86
|
placeholder?: string;
|
|
85
87
|
/** Toggle if input is cleared when an options is selected when `multiple` is `true`*/
|
|
86
88
|
clearSearchOnChange?: boolean;
|
|
89
|
+
/** Will wrap overflowing text at the expence of some performance overhead to calculate item heigths. Mostly relevant in combination with autoWidth */
|
|
90
|
+
multiline?: boolean;
|
|
87
91
|
} & HTMLAttributes<HTMLDivElement> & {
|
|
88
92
|
ref?: React.ForwardedRef<HTMLDivElement>;
|
|
89
93
|
displayName?: string | undefined;
|
|
@@ -5,6 +5,7 @@ export declare type AutocompleteOptionProps = {
|
|
|
5
5
|
highlighted: string;
|
|
6
6
|
isSelected: boolean;
|
|
7
7
|
isDisabled?: boolean;
|
|
8
|
+
multiline: boolean;
|
|
8
9
|
} & LiHTMLAttributes<HTMLLIElement>;
|
|
9
10
|
export declare const AutocompleteOption: import("react").ForwardRefExoticComponent<{
|
|
10
11
|
value: string;
|
|
@@ -12,4 +13,5 @@ export declare const AutocompleteOption: import("react").ForwardRefExoticCompone
|
|
|
12
13
|
highlighted: string;
|
|
13
14
|
isSelected: boolean;
|
|
14
15
|
isDisabled?: boolean;
|
|
16
|
+
multiline: boolean;
|
|
15
17
|
} & LiHTMLAttributes<HTMLLIElement> & import("react").RefAttributes<HTMLLIElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/eds-core-react",
|
|
3
|
-
"version": "0.28.0
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "The React implementation of the Equinor Design System",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@babel/runtime": "^7.19.0",
|
|
82
82
|
"@floating-ui/react-dom-interactions": "^0.10.1",
|
|
83
83
|
"@tanstack/react-virtual": "3.0.0-beta.30",
|
|
84
|
-
"downshift": "^7.0.
|
|
84
|
+
"downshift": "^7.0.5",
|
|
85
85
|
"@equinor/eds-icons": "0.17.0",
|
|
86
86
|
"@equinor/eds-tokens": "0.9.0",
|
|
87
87
|
"@equinor/eds-utils": "0.7.0"
|