@equinor/eds-core-react 0.28.0-dev12052022 → 0.28.0-dev12152022
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 +21 -12
- package/dist/esm/components/Autocomplete/Autocomplete.js +14 -8
- 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 +1 -1
|
@@ -8109,7 +8109,7 @@ var multiSelect = mergeDeepRight$1(selectTokens, {
|
|
|
8109
8109
|
}
|
|
8110
8110
|
});
|
|
8111
8111
|
|
|
8112
|
-
var _excluded$6 = ["value", "multiple", "isSelected", "isDisabled", "onClick", "aria-selected"];
|
|
8112
|
+
var _excluded$6 = ["value", "multiple", "isSelected", "isDisabled", "multiline", "onClick", "aria-selected"];
|
|
8113
8113
|
var StyledListItem = styled__default["default"].li.withConfig({
|
|
8114
8114
|
displayName: "Option__StyledListItem",
|
|
8115
8115
|
componentId: "sc-1ly11zu-0"
|
|
@@ -8119,20 +8119,22 @@ var StyledListItem = styled__default["default"].li.withConfig({
|
|
|
8119
8119
|
active = _ref.active,
|
|
8120
8120
|
isdisabled = _ref.isdisabled;
|
|
8121
8121
|
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;
|
|
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;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
8123
|
});
|
|
8124
8124
|
var Label = styled__default["default"].span.withConfig({
|
|
8125
8125
|
displayName: "Option__Label",
|
|
8126
8126
|
componentId: "sc-1ly11zu-1"
|
|
8127
8127
|
})(function (_ref2) {
|
|
8128
|
-
var theme = _ref2.theme
|
|
8129
|
-
|
|
8128
|
+
var theme = _ref2.theme,
|
|
8129
|
+
multiline = _ref2.multiline;
|
|
8130
|
+
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
8131
|
});
|
|
8131
8132
|
var AutocompleteOption = /*#__PURE__*/react.forwardRef(function AutocompleteOption(_ref3, ref) {
|
|
8132
8133
|
var value = _ref3.value,
|
|
8133
8134
|
multiple = _ref3.multiple,
|
|
8134
8135
|
isSelected = _ref3.isSelected,
|
|
8135
8136
|
isDisabled = _ref3.isDisabled,
|
|
8137
|
+
multiline = _ref3.multiline,
|
|
8136
8138
|
_onClick = _ref3.onClick,
|
|
8137
8139
|
ariaSelected = _ref3['aria-selected'],
|
|
8138
8140
|
other = _objectWithoutProperties__default["default"](_ref3, _excluded$6);
|
|
@@ -8154,12 +8156,13 @@ var AutocompleteOption = /*#__PURE__*/react.forwardRef(function AutocompleteOpti
|
|
|
8154
8156
|
return null;
|
|
8155
8157
|
}
|
|
8156
8158
|
}), /*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
8159
|
+
multiline: multiline,
|
|
8157
8160
|
children: value
|
|
8158
8161
|
})]
|
|
8159
8162
|
}));
|
|
8160
8163
|
});
|
|
8161
8164
|
|
|
8162
|
-
var _excluded$5 = ["options", "label", "meta", "className", "style", "disabled", "readOnly", "hideClearButton", "onOptionsChange", "selectedOptions", "multiple", "initialSelectedOptions", "disablePortal", "optionDisabled", "optionsFilter", "autoWidth", "placeholder", "optionLabel", "clearSearchOnChange"];
|
|
8165
|
+
var _excluded$5 = ["options", "label", "meta", "className", "style", "disabled", "readOnly", "hideClearButton", "onOptionsChange", "selectedOptions", "multiple", "initialSelectedOptions", "disablePortal", "optionDisabled", "optionsFilter", "autoWidth", "placeholder", "optionLabel", "clearSearchOnChange", "multiline"];
|
|
8163
8166
|
var Container$1 = styled__default["default"].div.withConfig({
|
|
8164
8167
|
displayName: "Autocomplete__Container",
|
|
8165
8168
|
componentId: "sc-yvif0e-0"
|
|
@@ -8266,6 +8269,8 @@ function AutocompleteInner(props, ref) {
|
|
|
8266
8269
|
optionLabel = props.optionLabel,
|
|
8267
8270
|
_props$clearSearchOnC = props.clearSearchOnChange,
|
|
8268
8271
|
clearSearchOnChange = _props$clearSearchOnC === void 0 ? true : _props$clearSearchOnC,
|
|
8272
|
+
_props$multiline = props.multiline,
|
|
8273
|
+
multiline = _props$multiline === void 0 ? false : _props$multiline,
|
|
8269
8274
|
other = _objectWithoutProperties__default["default"](props, _excluded$5);
|
|
8270
8275
|
var anchorRef = react.useRef(null);
|
|
8271
8276
|
var isControlled = Boolean(selectedOptions);
|
|
@@ -8356,7 +8361,7 @@ function AutocompleteInner(props, ref) {
|
|
|
8356
8361
|
estimateSize: react.useCallback(function () {
|
|
8357
8362
|
return 48;
|
|
8358
8363
|
}, []),
|
|
8359
|
-
overscan:
|
|
8364
|
+
overscan: 25
|
|
8360
8365
|
});
|
|
8361
8366
|
var comboBoxProps = {
|
|
8362
8367
|
items: availableItems,
|
|
@@ -8597,16 +8602,20 @@ function AutocompleteInner(props, ref) {
|
|
|
8597
8602
|
multiple: multiple,
|
|
8598
8603
|
highlighted: highlightedIndex === index && !isDisabled ? 'true' : 'false',
|
|
8599
8604
|
isSelected: isSelected,
|
|
8600
|
-
isDisabled: isDisabled
|
|
8601
|
-
|
|
8602
|
-
|
|
8605
|
+
isDisabled: isDisabled,
|
|
8606
|
+
multiline: multiline
|
|
8607
|
+
}, getItemProps(_objectSpread__default["default"](_objectSpread__default["default"]({}, multiline && {
|
|
8608
|
+
ref: rowVirtualizer.measureElement
|
|
8609
|
+
}), {}, {
|
|
8603
8610
|
item: item,
|
|
8604
8611
|
index: index,
|
|
8605
8612
|
disabled: disabled,
|
|
8606
|
-
style: {
|
|
8613
|
+
style: _objectSpread__default["default"]({
|
|
8607
8614
|
transform: "translateY(".concat(virtualItem.start, "px)")
|
|
8608
|
-
}
|
|
8609
|
-
|
|
8615
|
+
}, !multiline && {
|
|
8616
|
+
height: "".concat(virtualItem.size, "px")
|
|
8617
|
+
})
|
|
8618
|
+
}))), virtualItem.key);
|
|
8610
8619
|
})]
|
|
8611
8620
|
}))
|
|
8612
8621
|
}));
|
|
@@ -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);
|
|
@@ -216,7 +218,7 @@ function AutocompleteInner(props, ref) {
|
|
|
216
218
|
estimateSize: useCallback(function () {
|
|
217
219
|
return 48;
|
|
218
220
|
}, []),
|
|
219
|
-
overscan:
|
|
221
|
+
overscan: 25
|
|
220
222
|
});
|
|
221
223
|
var comboBoxProps = {
|
|
222
224
|
items: availableItems,
|
|
@@ -457,16 +459,20 @@ function AutocompleteInner(props, ref) {
|
|
|
457
459
|
multiple: multiple,
|
|
458
460
|
highlighted: highlightedIndex === index && !isDisabled ? 'true' : 'false',
|
|
459
461
|
isSelected: isSelected,
|
|
460
|
-
isDisabled: isDisabled
|
|
461
|
-
|
|
462
|
-
|
|
462
|
+
isDisabled: isDisabled,
|
|
463
|
+
multiline: multiline
|
|
464
|
+
}, getItemProps(_objectSpread(_objectSpread({}, multiline && {
|
|
465
|
+
ref: rowVirtualizer.measureElement
|
|
466
|
+
}), {}, {
|
|
463
467
|
item: item,
|
|
464
468
|
index: index,
|
|
465
469
|
disabled: disabled,
|
|
466
|
-
style: {
|
|
470
|
+
style: _objectSpread({
|
|
467
471
|
transform: "translateY(".concat(virtualItem.start, "px)")
|
|
468
|
-
}
|
|
469
|
-
|
|
472
|
+
}, !multiline && {
|
|
473
|
+
height: "".concat(virtualItem.size, "px")
|
|
474
|
+
})
|
|
475
|
+
}))), virtualItem.key);
|
|
470
476
|
})]
|
|
471
477
|
}))
|
|
472
478
|
}));
|
|
@@ -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>>;
|