@vitality-ds/components 4.15.0 → 5.0.3
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/Box/index.js +2 -1
- package/dist/Flex/index.js +3 -1
- package/dist/Input/Select/CreateableSelect/index.js +4 -2
- package/dist/Input/Select/SearchSelectInput/index.js +5 -1
- package/dist/Input/Select/Select/index.js +3 -1
- package/dist/Input/Select/Select/primitives/index.js +3 -1
- package/dist/Input/Select/components/Control/index.js +11 -17
- package/dist/Input/Select/logic.js +2 -8
- package/dist/components/src/Box/index.d.ts +1 -1
- package/dist/components/src/Flex/index.d.ts +1 -1
- package/dist/components/src/Input/Select/Select/primitives/types.d.ts +5 -1
- package/dist/components/src/Input/Select/hooks/useGetCustomComponents.d.ts +1 -1
- package/dist/components/src/Input/Select/logic.d.ts +3 -2
- package/dist/esm/Box/index.js +2 -1
- package/dist/esm/Flex/index.js +3 -1
- package/dist/esm/Input/Select/CreateableSelect/index.js +4 -2
- package/dist/esm/Input/Select/SearchSelectInput/index.js +5 -1
- package/dist/esm/Input/Select/Select/index.js +3 -1
- package/dist/esm/Input/Select/Select/primitives/index.js +3 -1
- package/dist/esm/Input/Select/components/Control/index.js +11 -17
- package/dist/esm/Input/Select/logic.js +2 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
package/dist/Box/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _empties = require("../helpers/logic/empties");
|
|
12
12
|
var _styled = require("./styled");
|
|
13
|
-
var _excluded = ["width", "height", "position", "maxWidth", "minWidth", "maxHeight", "minHeight", "htmlTag", "css", "shouldShrink", "shouldGrow", "gridSpans", "top", "right", "bottom", "left", "inset", "children"];
|
|
13
|
+
var _excluded = ["width", "height", "position", "maxWidth", "minWidth", "maxHeight", "minHeight", "htmlTag", "css", "style", "shouldShrink", "shouldGrow", "gridSpans", "top", "right", "bottom", "left", "inset", "children"];
|
|
14
14
|
function Box(_ref) {
|
|
15
15
|
var width = _ref.width,
|
|
16
16
|
height = _ref.height,
|
|
@@ -21,6 +21,7 @@ function Box(_ref) {
|
|
|
21
21
|
minHeight = _ref.minHeight,
|
|
22
22
|
htmlTag = _ref.htmlTag,
|
|
23
23
|
css = _ref.css,
|
|
24
|
+
style = _ref.style,
|
|
24
25
|
_ref$shouldShrink = _ref.shouldShrink,
|
|
25
26
|
shouldShrink = _ref$shouldShrink === void 0 ? true : _ref$shouldShrink,
|
|
26
27
|
shouldGrow = _ref.shouldGrow,
|
package/dist/Flex/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _styled = require("./styled");
|
|
12
|
-
var _excluded = ["width", "height", "position", "maxWidth", "minWidth", "maxHeight", "minHeight", "htmlTag", "direction", "spacing", "align", "justify", "wrap"];
|
|
12
|
+
var _excluded = ["width", "height", "position", "maxWidth", "minWidth", "maxHeight", "minHeight", "htmlTag", "direction", "spacing", "align", "justify", "wrap", "css", "style"];
|
|
13
13
|
function Flex(_ref) {
|
|
14
14
|
var width = _ref.width,
|
|
15
15
|
height = _ref.height,
|
|
@@ -29,6 +29,8 @@ function Flex(_ref) {
|
|
|
29
29
|
justify = _ref$justify === void 0 ? "start" : _ref$justify,
|
|
30
30
|
_ref$wrap = _ref.wrap,
|
|
31
31
|
wrap = _ref$wrap === void 0 ? "noWrap" : _ref$wrap,
|
|
32
|
+
css = _ref.css,
|
|
33
|
+
style = _ref.style,
|
|
32
34
|
restProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
33
35
|
return /*#__PURE__*/_react["default"].createElement(_styled.BaseFlex, (0, _extends2["default"])({
|
|
34
36
|
spacing: spacing,
|
|
@@ -13,7 +13,7 @@ var _creatable = _interopRequireDefault(require("react-select/creatable"));
|
|
|
13
13
|
var _useGetCustomComponents = _interopRequireDefault(require("../hooks/useGetCustomComponents"));
|
|
14
14
|
var _useMenuPositionProps = _interopRequireDefault(require("../hooks/useMenuPositionProps"));
|
|
15
15
|
var _logic = require("../logic");
|
|
16
|
-
var _excluded = ["css", "asChild", "as", "style", "className", "options", "name", "onChange", "id", "disabled", "hasError", "onCreateOption", "value", "hideDropdownIndicator", "isMulti", "openMenuOnClick", "renderOption", "menuPlacement", "menuPosition", "portalMenu"];
|
|
16
|
+
var _excluded = ["css", "asChild", "as", "style", "className", "options", "name", "onChange", "id", "disabled", "hasError", "onCreateOption", "value", "hideDropdownIndicator", "isMulti", "openMenuOnClick", "renderOption", "menuPlacement", "menuPosition", "portalMenu", "icon"];
|
|
17
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
18
|
var CreatableSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardedRef) {
|
|
19
19
|
var css = _ref.css,
|
|
@@ -40,6 +40,7 @@ var CreatableSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
40
40
|
menuPosition = _ref$menuPosition === void 0 ? "absolute" : _ref$menuPosition,
|
|
41
41
|
_ref$portalMenu = _ref.portalMenu,
|
|
42
42
|
portalMenu = _ref$portalMenu === void 0 ? false : _ref$portalMenu,
|
|
43
|
+
icon = _ref.icon,
|
|
43
44
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
44
45
|
var disabledOptions = function disabledOptions(option) {
|
|
45
46
|
return option.disabled;
|
|
@@ -74,7 +75,8 @@ var CreatableSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
74
75
|
components: customComponents // inner components that have been customised
|
|
75
76
|
,
|
|
76
77
|
unstyled: true,
|
|
77
|
-
renderOption: renderOption
|
|
78
|
+
renderOption: renderOption,
|
|
79
|
+
icon: icon
|
|
78
80
|
}, menuPositionProps, props));
|
|
79
81
|
});
|
|
80
82
|
CreatableSelect.displayName = "CreatableSelect";
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _icons = require("@vitality-ds/icons");
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _AsyncSelect = _interopRequireDefault(require("../AsyncSelect"));
|
|
12
13
|
var _useGetCustomComponents = _interopRequireDefault(require("../hooks/useGetCustomComponents"));
|
|
@@ -16,7 +17,8 @@ var SearchSelectInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref
|
|
|
16
17
|
onChange = _ref.onChange,
|
|
17
18
|
name = _ref.name,
|
|
18
19
|
id = _ref.id,
|
|
19
|
-
icon = _ref.icon,
|
|
20
|
+
_ref$icon = _ref.icon,
|
|
21
|
+
icon = _ref$icon === void 0 ? _icons.Search : _ref$icon,
|
|
20
22
|
_ref$hideDropdownIndi = _ref.hideDropdownIndicator,
|
|
21
23
|
hideDropdownIndicator = _ref$hideDropdownIndi === void 0 ? true : _ref$hideDropdownIndi,
|
|
22
24
|
_ref$openMenuOnClick = _ref.openMenuOnClick,
|
|
@@ -44,6 +46,8 @@ var SearchSelectInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref
|
|
|
44
46
|
isMulti: isMulti,
|
|
45
47
|
valueRenderType: valueRenderType,
|
|
46
48
|
components: customComponents // custom inner components
|
|
49
|
+
,
|
|
50
|
+
icon: icon
|
|
47
51
|
}, restProps));
|
|
48
52
|
});
|
|
49
53
|
SearchSelectInput.displayName = "SearchSelectInput";
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _primitives = _interopRequireDefault(require("./primitives"));
|
|
12
|
-
var _excluded = ["css", "asChild", "as", "style", "className", "name", "hasError", "options", "isMulti", "value", "id", "inputId", "openMenuOnClick", "onChange", "disabled", "isClearable", "renderOption", "menuPlacement", "menuPosition", "portalMenu"];
|
|
12
|
+
var _excluded = ["css", "asChild", "as", "style", "className", "name", "hasError", "options", "isMulti", "value", "id", "inputId", "openMenuOnClick", "onChange", "disabled", "isClearable", "renderOption", "menuPlacement", "menuPosition", "portalMenu", "icon"];
|
|
13
13
|
var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardedRef) {
|
|
14
14
|
var css = _ref.css,
|
|
15
15
|
asChild = _ref.asChild,
|
|
@@ -34,6 +34,7 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwarded
|
|
|
34
34
|
menuPosition = _ref$menuPosition === void 0 ? "absolute" : _ref$menuPosition,
|
|
35
35
|
_ref$portalMenu = _ref.portalMenu,
|
|
36
36
|
portalMenu = _ref$portalMenu === void 0 ? false : _ref$portalMenu,
|
|
37
|
+
icon = _ref.icon,
|
|
37
38
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
38
39
|
return /*#__PURE__*/_react["default"].createElement(_primitives["default"], (0, _extends2["default"])({
|
|
39
40
|
id: id,
|
|
@@ -49,6 +50,7 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwarded
|
|
|
49
50
|
isClearable: isClearable,
|
|
50
51
|
isMulti: isMulti,
|
|
51
52
|
renderOption: renderOption,
|
|
53
|
+
icon: icon,
|
|
52
54
|
valueRenderType: "default",
|
|
53
55
|
portalMenu: portalMenu,
|
|
54
56
|
menuPosition: menuPosition,
|
|
@@ -15,7 +15,7 @@ var _useGetCustomComponents = _interopRequireDefault(require("../../hooks/useGet
|
|
|
15
15
|
var _useMenuPositionProps = _interopRequireDefault(require("../../hooks/useMenuPositionProps"));
|
|
16
16
|
var _useTypeaheadChangeHandlers = _interopRequireDefault(require("../../hooks/useTypeaheadChangeHandlers"));
|
|
17
17
|
var _logic = require("../../logic");
|
|
18
|
-
var _excluded = ["css", "asChild", "as", "style", "className", "options", "name", "onChange", "id", "disabled", "hasError", "isClearable", "hideDropdownIndicator", "isMulti", "value", "inputId", "openMenuOnClick", "renderOption", "valueRenderType", "inputValue", "menuPlacement", "menuPosition", "portalMenu", "onInputChange", "noOptionsMessage"];
|
|
18
|
+
var _excluded = ["css", "asChild", "as", "style", "className", "options", "name", "onChange", "id", "disabled", "hasError", "isClearable", "hideDropdownIndicator", "isMulti", "value", "inputId", "openMenuOnClick", "renderOption", "valueRenderType", "inputValue", "menuPlacement", "menuPosition", "portalMenu", "onInputChange", "noOptionsMessage", "icon"];
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
var SelectPrimitive = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardedRef) {
|
|
21
21
|
var css = _ref.css,
|
|
@@ -49,6 +49,7 @@ var SelectPrimitive = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
49
49
|
return null;
|
|
50
50
|
} : _ref$onInputChange,
|
|
51
51
|
noOptionsMessage = _ref.noOptionsMessage,
|
|
52
|
+
icon = _ref.icon,
|
|
52
53
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
53
54
|
var disabledOptions = function disabledOptions(option) {
|
|
54
55
|
return option.disabled;
|
|
@@ -87,6 +88,7 @@ var SelectPrimitive = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
87
88
|
"aria-invalid": hasError,
|
|
88
89
|
isClearable: isClearable,
|
|
89
90
|
isMulti: isMulti,
|
|
91
|
+
icon: icon,
|
|
90
92
|
styles: styles,
|
|
91
93
|
components: customComponents // inner components that have been customised
|
|
92
94
|
,
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
-
var _icons = require("@vitality-ds/icons");
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _reactSelect = require("react-select");
|
|
11
10
|
var _AdornmentWrapper = _interopRequireDefault(require("../../../TextInput/components/AdornmentWrapper"));
|
|
@@ -17,23 +16,18 @@ function CustomControl(innerProps) {
|
|
|
17
16
|
isMulti = innerProps.isMulti,
|
|
18
17
|
hasValue = innerProps.hasValue;
|
|
19
18
|
var icon = selectProps.icon;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
var renderAdornment = function renderAdornment() {
|
|
20
|
+
return /*#__PURE__*/_react["default"].createElement(_AdornmentWrapper["default"], {
|
|
21
|
+
side: "start",
|
|
22
|
+
adornmentProps: {
|
|
23
|
+
type: "icon",
|
|
24
|
+
props: {
|
|
25
|
+
icon: icon
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
adornmentProps: {
|
|
31
|
-
type: "icon",
|
|
32
|
-
props: {
|
|
33
|
-
icon: icon || _icons.Search
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}), children);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement(BaseControl, innerProps, icon && (isMulti && hasValue ? /*#__PURE__*/_react["default"].createElement(_styled.BaseIsMultiWrapper, null, renderAdornment()) : renderAdornment()), children);
|
|
37
31
|
}
|
|
38
32
|
CustomControl.displayName = "CustomControl";
|
|
39
33
|
var _default = exports["default"] = CustomControl;
|
|
@@ -25,8 +25,6 @@ function getStyles(multiSelectType) {
|
|
|
25
25
|
function getCustomComponents(_ref) {
|
|
26
26
|
var hideDropdownIndicator = _ref.hideDropdownIndicator,
|
|
27
27
|
multiSelectType = _ref.multiSelectType,
|
|
28
|
-
_ref$component = _ref.component,
|
|
29
|
-
component = _ref$component === void 0 ? "select" : _ref$component,
|
|
30
28
|
_ref$valueRenderType = _ref.valueRenderType,
|
|
31
29
|
valueRenderType = _ref$valueRenderType === void 0 ? "default" : _ref$valueRenderType;
|
|
32
30
|
var customComponents = (0, _extends2["default"])({
|
|
@@ -34,13 +32,9 @@ function getCustomComponents(_ref) {
|
|
|
34
32
|
ClearIndicator: _ClearButton["default"],
|
|
35
33
|
LoadingIndicator: _LoadingIndicator["default"],
|
|
36
34
|
Option: _Option["default"],
|
|
37
|
-
SingleValue: _SingleValue["default"]
|
|
35
|
+
SingleValue: _SingleValue["default"],
|
|
36
|
+
Control: _Control["default"]
|
|
38
37
|
}, _constants.CUSTOM_COMPONENTS[multiSelectType]);
|
|
39
|
-
if (component === "searchSelectInput") {
|
|
40
|
-
Object.assign(customComponents, {
|
|
41
|
-
Control: _Control["default"]
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
38
|
if (valueRenderType === "typeahead") {
|
|
45
39
|
Object.assign(customComponents, {
|
|
46
40
|
Input: _Input["default"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BoxProps } from "./types";
|
|
3
|
-
declare function Box({ width, height, position, maxWidth, minWidth, maxHeight, minHeight, htmlTag, css, shouldShrink, shouldGrow, gridSpans, top, right, bottom, left, inset, children, ...restProps }: BoxProps): JSX.Element;
|
|
3
|
+
declare function Box({ width, height, position, maxWidth, minWidth, maxHeight, minHeight, htmlTag, css, style, shouldShrink, shouldGrow, gridSpans, top, right, bottom, left, inset, children, ...restProps }: BoxProps): JSX.Element;
|
|
4
4
|
export default Box;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FlexProps } from "./types";
|
|
3
|
-
declare function Flex({ width, height, position, maxWidth, minWidth, maxHeight, minHeight, htmlTag, direction, spacing, align, justify, wrap, ...restProps }: FlexProps): JSX.Element;
|
|
3
|
+
declare function Flex({ width, height, position, maxWidth, minWidth, maxHeight, minHeight, htmlTag, direction, spacing, align, justify, wrap, css, style, ...restProps }: FlexProps): JSX.Element;
|
|
4
4
|
export default Flex;
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { GroupBase, MenuProps, OptionsOrGroups } from "react-select";
|
|
4
4
|
import { ChipProps } from "../../../../Chip/types";
|
|
5
5
|
import { StatusBadgeType } from "../../../../StatusBadge/types";
|
|
6
|
-
import { RenderOptionType, ValueRenderType } from "../../types";
|
|
6
|
+
import { IconPropType, RenderOptionType, ValueRenderType } from "../../types";
|
|
7
7
|
export declare type BaseOption = {
|
|
8
8
|
label: string;
|
|
9
9
|
value: string;
|
|
@@ -114,6 +114,10 @@ export declare type BaseSelectProps = {
|
|
|
114
114
|
* @default false
|
|
115
115
|
*/
|
|
116
116
|
portalMenu?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Display an optional icon within the select input
|
|
119
|
+
*/
|
|
120
|
+
icon?: IconPropType | null;
|
|
117
121
|
};
|
|
118
122
|
export declare type ChipValue = (BaseOption & Omit<ChipProps, "chipCheckboxProps"> & {
|
|
119
123
|
chipCheckboxProps?: ChipProps["chipCheckboxProps"] & {
|
|
@@ -4,7 +4,7 @@ declare const useGetCustomComponents: ({ hideDropdownIndicator, multiSelectType,
|
|
|
4
4
|
Option: typeof import("../components/Option").default | import("react").ComponentType<import("react-select").OptionProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
5
5
|
Group?: import("react").ComponentType<import("react-select").GroupProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
6
6
|
ClearIndicator: typeof import("../components/ClearButton").default | import("react").ComponentType<import("react-select").ClearIndicatorProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
7
|
-
Control
|
|
7
|
+
Control: typeof import("../components/Control").default | import("react").ComponentType<import("react-select").ControlProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
8
8
|
DropdownIndicator: typeof import("../components/DropdownIndicator").default | import("react").ComponentType<import("react-select").DropdownIndicatorProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
9
9
|
DownChevron?: import("react").ComponentType<import("react-select/dist/declarations/src/components/indicators").DownChevronProps>;
|
|
10
10
|
CrossIcon?: import("react").ComponentType<import("react-select/dist/declarations/src/components/indicators").CrossIconProps>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import CustomClearButton from "./components/ClearButton";
|
|
2
|
+
import CustomControl from "./components/Control";
|
|
2
3
|
import CustomDropdownIndicator from "./components/DropdownIndicator";
|
|
3
4
|
import CustomLoadingIndicator from "./components/LoadingIndicator";
|
|
4
5
|
import CustomRenderedOption from "./components/Option";
|
|
5
6
|
import CustomSingleValue from "./components/SingleValue";
|
|
6
7
|
import { CustomComponentsType } from "./types";
|
|
7
8
|
export declare function getStyles(multiSelectType: any): any;
|
|
8
|
-
export declare function getCustomComponents({ hideDropdownIndicator, multiSelectType,
|
|
9
|
+
export declare function getCustomComponents({ hideDropdownIndicator, multiSelectType, valueRenderType, }: CustomComponentsType): {
|
|
9
10
|
Option: typeof CustomRenderedOption | import("react").ComponentType<import("react-select").OptionProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
10
11
|
Group?: import("react").ComponentType<import("react-select").GroupProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
11
12
|
ClearIndicator: typeof CustomClearButton | import("react").ComponentType<import("react-select").ClearIndicatorProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
12
|
-
Control
|
|
13
|
+
Control: typeof CustomControl | import("react").ComponentType<import("react-select").ControlProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
13
14
|
DropdownIndicator: typeof CustomDropdownIndicator | import("react").ComponentType<import("react-select").DropdownIndicatorProps<unknown, boolean, import("react-select").GroupBase<unknown>>>;
|
|
14
15
|
DownChevron?: import("react").ComponentType<import("react-select/dist/declarations/src/components/indicators").DownChevronProps>;
|
|
15
16
|
CrossIcon?: import("react").ComponentType<import("react-select/dist/declarations/src/components/indicators").CrossIconProps>;
|
package/dist/esm/Box/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["width", "height", "position", "maxWidth", "minWidth", "maxHeight", "minHeight", "htmlTag", "css", "shouldShrink", "shouldGrow", "gridSpans", "top", "right", "bottom", "left", "inset", "children"];
|
|
3
|
+
var _excluded = ["width", "height", "position", "maxWidth", "minWidth", "maxHeight", "minHeight", "htmlTag", "css", "style", "shouldShrink", "shouldGrow", "gridSpans", "top", "right", "bottom", "left", "inset", "children"];
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { EMPTY_OBJ } from "../helpers/logic/empties";
|
|
6
6
|
import { BaseBox } from "./styled";
|
|
@@ -14,6 +14,7 @@ function Box(_ref) {
|
|
|
14
14
|
minHeight = _ref.minHeight,
|
|
15
15
|
htmlTag = _ref.htmlTag,
|
|
16
16
|
css = _ref.css,
|
|
17
|
+
style = _ref.style,
|
|
17
18
|
_ref$shouldShrink = _ref.shouldShrink,
|
|
18
19
|
shouldShrink = _ref$shouldShrink === void 0 ? true : _ref$shouldShrink,
|
|
19
20
|
shouldGrow = _ref.shouldGrow,
|
package/dist/esm/Flex/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["width", "height", "position", "maxWidth", "minWidth", "maxHeight", "minHeight", "htmlTag", "direction", "spacing", "align", "justify", "wrap"];
|
|
3
|
+
var _excluded = ["width", "height", "position", "maxWidth", "minWidth", "maxHeight", "minHeight", "htmlTag", "direction", "spacing", "align", "justify", "wrap", "css", "style"];
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { BaseFlex } from "./styled";
|
|
6
6
|
function Flex(_ref) {
|
|
@@ -22,6 +22,8 @@ function Flex(_ref) {
|
|
|
22
22
|
justify = _ref$justify === void 0 ? "start" : _ref$justify,
|
|
23
23
|
_ref$wrap = _ref.wrap,
|
|
24
24
|
wrap = _ref$wrap === void 0 ? "noWrap" : _ref$wrap,
|
|
25
|
+
css = _ref.css,
|
|
26
|
+
style = _ref.style,
|
|
25
27
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
26
28
|
return /*#__PURE__*/React.createElement(BaseFlex, _extends({
|
|
27
29
|
spacing: spacing,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["css", "asChild", "as", "style", "className", "options", "name", "onChange", "id", "disabled", "hasError", "onCreateOption", "value", "hideDropdownIndicator", "isMulti", "openMenuOnClick", "renderOption", "menuPlacement", "menuPosition", "portalMenu"];
|
|
3
|
+
var _excluded = ["css", "asChild", "as", "style", "className", "options", "name", "onChange", "id", "disabled", "hasError", "onCreateOption", "value", "hideDropdownIndicator", "isMulti", "openMenuOnClick", "renderOption", "menuPlacement", "menuPosition", "portalMenu", "icon"];
|
|
4
4
|
import React, { useMemo } from "react";
|
|
5
5
|
import Creatable from "react-select/creatable";
|
|
6
6
|
import useGetCustomComponents from "../hooks/useGetCustomComponents";
|
|
@@ -31,6 +31,7 @@ var CreatableSelect = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef
|
|
|
31
31
|
menuPosition = _ref$menuPosition === void 0 ? "absolute" : _ref$menuPosition,
|
|
32
32
|
_ref$portalMenu = _ref.portalMenu,
|
|
33
33
|
portalMenu = _ref$portalMenu === void 0 ? false : _ref$portalMenu,
|
|
34
|
+
icon = _ref.icon,
|
|
34
35
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
36
|
var disabledOptions = function disabledOptions(option) {
|
|
36
37
|
return option.disabled;
|
|
@@ -65,7 +66,8 @@ var CreatableSelect = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef
|
|
|
65
66
|
components: customComponents // inner components that have been customised
|
|
66
67
|
,
|
|
67
68
|
unstyled: true,
|
|
68
|
-
renderOption: renderOption
|
|
69
|
+
renderOption: renderOption,
|
|
70
|
+
icon: icon
|
|
69
71
|
}, menuPositionProps, props));
|
|
70
72
|
});
|
|
71
73
|
CreatableSelect.displayName = "CreatableSelect";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["onSearch", "onChange", "name", "id", "icon", "hideDropdownIndicator", "openMenuOnClick", "isMulti", "valueRenderType"];
|
|
4
|
+
import { Search } from "@vitality-ds/icons";
|
|
4
5
|
import React from "react";
|
|
5
6
|
import AsyncSelect from "../AsyncSelect";
|
|
6
7
|
import useGetCustomComponents from "../hooks/useGetCustomComponents";
|
|
@@ -9,7 +10,8 @@ var SearchSelectInput = /*#__PURE__*/React.forwardRef(function (_ref, forwardedR
|
|
|
9
10
|
onChange = _ref.onChange,
|
|
10
11
|
name = _ref.name,
|
|
11
12
|
id = _ref.id,
|
|
12
|
-
icon = _ref.icon,
|
|
13
|
+
_ref$icon = _ref.icon,
|
|
14
|
+
icon = _ref$icon === void 0 ? Search : _ref$icon,
|
|
13
15
|
_ref$hideDropdownIndi = _ref.hideDropdownIndicator,
|
|
14
16
|
hideDropdownIndicator = _ref$hideDropdownIndi === void 0 ? true : _ref$hideDropdownIndi,
|
|
15
17
|
_ref$openMenuOnClick = _ref.openMenuOnClick,
|
|
@@ -37,6 +39,8 @@ var SearchSelectInput = /*#__PURE__*/React.forwardRef(function (_ref, forwardedR
|
|
|
37
39
|
isMulti: isMulti,
|
|
38
40
|
valueRenderType: valueRenderType,
|
|
39
41
|
components: customComponents // custom inner components
|
|
42
|
+
,
|
|
43
|
+
icon: icon
|
|
40
44
|
}, restProps));
|
|
41
45
|
});
|
|
42
46
|
SearchSelectInput.displayName = "SearchSelectInput";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["css", "asChild", "as", "style", "className", "name", "hasError", "options", "isMulti", "value", "id", "inputId", "openMenuOnClick", "onChange", "disabled", "isClearable", "renderOption", "menuPlacement", "menuPosition", "portalMenu"];
|
|
3
|
+
var _excluded = ["css", "asChild", "as", "style", "className", "name", "hasError", "options", "isMulti", "value", "id", "inputId", "openMenuOnClick", "onChange", "disabled", "isClearable", "renderOption", "menuPlacement", "menuPosition", "portalMenu", "icon"];
|
|
4
4
|
import React from "react";
|
|
5
5
|
import SelectPrimitive from "./primitives";
|
|
6
6
|
var Select = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
@@ -27,6 +27,7 @@ var Select = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
27
27
|
menuPosition = _ref$menuPosition === void 0 ? "absolute" : _ref$menuPosition,
|
|
28
28
|
_ref$portalMenu = _ref.portalMenu,
|
|
29
29
|
portalMenu = _ref$portalMenu === void 0 ? false : _ref$portalMenu,
|
|
30
|
+
icon = _ref.icon,
|
|
30
31
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
32
|
return /*#__PURE__*/React.createElement(SelectPrimitive, _extends({
|
|
32
33
|
id: id,
|
|
@@ -42,6 +43,7 @@ var Select = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
42
43
|
isClearable: isClearable,
|
|
43
44
|
isMulti: isMulti,
|
|
44
45
|
renderOption: renderOption,
|
|
46
|
+
icon: icon,
|
|
45
47
|
valueRenderType: "default",
|
|
46
48
|
portalMenu: portalMenu,
|
|
47
49
|
menuPosition: menuPosition,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["css", "asChild", "as", "style", "className", "options", "name", "onChange", "id", "disabled", "hasError", "isClearable", "hideDropdownIndicator", "isMulti", "value", "inputId", "openMenuOnClick", "renderOption", "valueRenderType", "inputValue", "menuPlacement", "menuPosition", "portalMenu", "onInputChange", "noOptionsMessage"];
|
|
4
|
+
var _excluded = ["css", "asChild", "as", "style", "className", "options", "name", "onChange", "id", "disabled", "hasError", "isClearable", "hideDropdownIndicator", "isMulti", "value", "inputId", "openMenuOnClick", "renderOption", "valueRenderType", "inputValue", "menuPlacement", "menuPosition", "portalMenu", "onInputChange", "noOptionsMessage", "icon"];
|
|
5
5
|
import React, { useMemo } from "react";
|
|
6
6
|
import ReactSelect from "react-select";
|
|
7
7
|
import useGetCustomComponents from "../../hooks/useGetCustomComponents";
|
|
@@ -40,6 +40,7 @@ var SelectPrimitive = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef
|
|
|
40
40
|
return null;
|
|
41
41
|
} : _ref$onInputChange,
|
|
42
42
|
noOptionsMessage = _ref.noOptionsMessage,
|
|
43
|
+
icon = _ref.icon,
|
|
43
44
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
44
45
|
var disabledOptions = function disabledOptions(option) {
|
|
45
46
|
return option.disabled;
|
|
@@ -78,6 +79,7 @@ var SelectPrimitive = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef
|
|
|
78
79
|
"aria-invalid": hasError,
|
|
79
80
|
isClearable: isClearable,
|
|
80
81
|
isMulti: isMulti,
|
|
82
|
+
icon: icon,
|
|
81
83
|
styles: styles,
|
|
82
84
|
components: customComponents // inner components that have been customised
|
|
83
85
|
,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Search } from "@vitality-ds/icons";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { components } from "react-select";
|
|
4
3
|
import AdornmentWrapper from "../../../TextInput/components/AdornmentWrapper";
|
|
@@ -10,23 +9,18 @@ function CustomControl(innerProps) {
|
|
|
10
9
|
isMulti = innerProps.isMulti,
|
|
11
10
|
hasValue = innerProps.hasValue;
|
|
12
11
|
var icon = selectProps.icon;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
var renderAdornment = function renderAdornment() {
|
|
13
|
+
return /*#__PURE__*/React.createElement(AdornmentWrapper, {
|
|
14
|
+
side: "start",
|
|
15
|
+
adornmentProps: {
|
|
16
|
+
type: "icon",
|
|
17
|
+
props: {
|
|
18
|
+
icon: icon
|
|
19
|
+
}
|
|
19
20
|
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
adornmentProps: {
|
|
24
|
-
type: "icon",
|
|
25
|
-
props: {
|
|
26
|
-
icon: icon || Search
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}), children);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/React.createElement(BaseControl, innerProps, icon && (isMulti && hasValue ? /*#__PURE__*/React.createElement(BaseIsMultiWrapper, null, renderAdornment()) : renderAdornment()), children);
|
|
30
24
|
}
|
|
31
25
|
CustomControl.displayName = "CustomControl";
|
|
32
26
|
export default CustomControl;
|
|
@@ -15,8 +15,6 @@ export function getStyles(multiSelectType) {
|
|
|
15
15
|
export function getCustomComponents(_ref) {
|
|
16
16
|
var hideDropdownIndicator = _ref.hideDropdownIndicator,
|
|
17
17
|
multiSelectType = _ref.multiSelectType,
|
|
18
|
-
_ref$component = _ref.component,
|
|
19
|
-
component = _ref$component === void 0 ? "select" : _ref$component,
|
|
20
18
|
_ref$valueRenderType = _ref.valueRenderType,
|
|
21
19
|
valueRenderType = _ref$valueRenderType === void 0 ? "default" : _ref$valueRenderType;
|
|
22
20
|
var customComponents = _extends({
|
|
@@ -24,13 +22,9 @@ export function getCustomComponents(_ref) {
|
|
|
24
22
|
ClearIndicator: CustomClearButton,
|
|
25
23
|
LoadingIndicator: CustomLoadingIndicator,
|
|
26
24
|
Option: CustomRenderedOption,
|
|
27
|
-
SingleValue: CustomSingleValue
|
|
25
|
+
SingleValue: CustomSingleValue,
|
|
26
|
+
Control: CustomControl
|
|
28
27
|
}, CUSTOM_COMPONENTS[multiSelectType]);
|
|
29
|
-
if (component === "searchSelectInput") {
|
|
30
|
-
Object.assign(customComponents, {
|
|
31
|
-
Control: CustomControl
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
28
|
if (valueRenderType === "typeahead") {
|
|
35
29
|
Object.assign(customComponents, {
|
|
36
30
|
Input: CustomInput
|