glints-aries 4.0.231 → 4.0.233
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/es/@next/Button/DestructivePlainButton.stories.d.ts +4 -0
- package/es/@next/Button/DestructivePlainButtonStyle.d.ts +2 -0
- package/es/@next/Button/DestructivePlainButtonStyle.js +7 -0
- package/es/@next/Button/PlainButton.stories.d.ts +4 -0
- package/es/@next/Button/PlainButtonStyle.d.ts +2 -0
- package/es/@next/Button/PlainButtonStyle.js +7 -0
- package/es/@next/Checkbox/Checkbox.js +3 -1
- package/es/@next/IndexTable/IndexTable.js +3 -2
- package/es/@next/IndexTable/IndexTableStyle.js +3 -1
- package/es/@next/IndexTable/components/Checkbox/Checkbox.js +3 -1
- package/es/@next/IndexTable/components/Checkbox/CheckboxStyle.js +2 -1
- package/es/@next/Menu/Menu.d.ts +12 -5
- package/es/@next/Menu/Menu.js +84 -31
- package/es/@next/Menu/Menu.stories.d.ts +2 -0
- package/es/@next/Menu/MenuStyle.d.ts +1 -0
- package/es/@next/Menu/MenuStyle.js +7 -3
- package/es/@next/Menu/components/MenuOption.d.ts +12 -0
- package/es/@next/Menu/components/MenuOption.js +24 -0
- package/es/@next/Menu/components/MenuOptionCheckbox.d.ts +6 -0
- package/es/@next/Menu/components/MenuOptionCheckbox.js +12 -0
- package/es/@next/Menu/components/MenuOptionLabel.d.ts +4 -0
- package/es/@next/Menu/components/MenuOptionLabel.js +11 -0
- package/es/@next/Menu/components/index.d.ts +3 -0
- package/es/@next/Menu/components/index.js +3 -0
- package/es/@next/Menu/index.d.ts +1 -0
- package/es/@next/Menu/index.js +2 -1
- package/es/@next/Menu/menuStoryHelper/PopoverMenu.d.ts +7 -0
- package/es/@next/Menu/menuStoryHelper/PopoverMenu.js +52 -0
- package/es/@next/Select/Select.d.ts +36 -0
- package/es/@next/Select/Select.js +118 -0
- package/es/@next/Select/Select.stories.d.ts +11 -0
- package/es/@next/Select/SelectStyle.d.ts +6 -0
- package/es/@next/Select/SelectStyle.js +12 -0
- package/es/@next/Select/components/Activator/ActivatorContext.d.ts +17 -0
- package/es/@next/Select/components/Activator/ActivatorContext.js +17 -0
- package/es/@next/Select/components/Activator/ActivatorSelect.d.ts +10 -0
- package/es/@next/Select/components/Activator/ActivatorSelect.js +71 -0
- package/es/@next/Select/components/Activator/ActivatorStyle.d.ts +9 -0
- package/es/@next/Select/components/Activator/ActivatorStyle.js +28 -0
- package/es/@next/Select/components/Activator/ActivatorTextInput.d.ts +8 -0
- package/es/@next/Select/components/Activator/ActivatorTextInput.js +38 -0
- package/es/@next/Select/components/Activator/index.d.ts +2 -0
- package/es/@next/Select/components/Activator/index.js +2 -0
- package/es/@next/Select/components/Label/Label.d.ts +4 -0
- package/es/@next/Select/components/Label/Label.js +11 -0
- package/es/@next/Select/components/OptionList/OptionList.d.ts +15 -0
- package/es/@next/Select/components/OptionList/OptionList.js +46 -0
- package/es/@next/Select/components/OptionList/OptionListStyle.d.ts +6 -0
- package/es/@next/Select/components/OptionList/OptionListStyle.js +12 -0
- package/es/@next/Select/components/OptionList/index.d.ts +1 -0
- package/es/@next/Select/components/OptionList/index.js +1 -0
- package/es/@next/Select/components/index.d.ts +2 -0
- package/es/@next/Select/components/index.js +2 -0
- package/es/@next/Select/index.d.ts +2 -0
- package/es/@next/Select/index.js +2 -0
- package/es/@next/Select/selectStoryHelper/NonSearchableMultiSelect.d.ts +3 -0
- package/es/@next/Select/selectStoryHelper/NonSearchableMultiSelect.js +40 -0
- package/es/@next/Select/selectStoryHelper/NonSearchableSingleSelect.d.ts +3 -0
- package/es/@next/Select/selectStoryHelper/NonSearchableSingleSelect.js +27 -0
- package/es/@next/Select/selectStoryHelper/Searchable.d.ts +7 -0
- package/es/@next/Select/selectStoryHelper/Searchable.js +85 -0
- package/es/@next/Select/selectStoryHelper/SelectStoryStyle.d.ts +2 -0
- package/es/@next/Select/selectStoryHelper/SelectStoryStyle.js +7 -0
- package/es/@next/Tag/Tag.d.ts +1 -1
- package/es/@next/Tag/TagStyle.js +1 -1
- package/es/@next/TextInput/TextInput.js +4 -2
- package/es/@next/index.d.ts +1 -0
- package/es/@next/index.js +1 -0
- package/es/Input/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/lib/@next/Button/DestructivePlainButton.stories.d.ts +4 -0
- package/lib/@next/Button/DestructivePlainButtonStyle.d.ts +2 -0
- package/lib/@next/Button/DestructivePlainButtonStyle.js +13 -0
- package/lib/@next/Button/PlainButton.stories.d.ts +4 -0
- package/lib/@next/Button/PlainButtonStyle.d.ts +2 -0
- package/lib/@next/Button/PlainButtonStyle.js +13 -0
- package/lib/@next/Checkbox/Checkbox.js +3 -1
- package/lib/@next/IndexTable/IndexTable.js +3 -2
- package/lib/@next/IndexTable/IndexTableStyle.js +3 -1
- package/lib/@next/IndexTable/components/Checkbox/Checkbox.js +3 -1
- package/lib/@next/IndexTable/components/Checkbox/CheckboxStyle.js +2 -1
- package/lib/@next/Menu/Menu.d.ts +12 -5
- package/lib/@next/Menu/Menu.js +83 -30
- package/lib/@next/Menu/Menu.stories.d.ts +2 -0
- package/lib/@next/Menu/MenuStyle.d.ts +1 -0
- package/lib/@next/Menu/MenuStyle.js +9 -4
- package/lib/@next/Menu/components/MenuOption.d.ts +12 -0
- package/lib/@next/Menu/components/MenuOption.js +30 -0
- package/lib/@next/Menu/components/MenuOptionCheckbox.d.ts +6 -0
- package/lib/@next/Menu/components/MenuOptionCheckbox.js +18 -0
- package/lib/@next/Menu/components/MenuOptionLabel.d.ts +4 -0
- package/lib/@next/Menu/components/MenuOptionLabel.js +17 -0
- package/lib/@next/Menu/components/index.d.ts +3 -0
- package/lib/@next/Menu/components/index.js +11 -0
- package/lib/@next/Menu/index.d.ts +1 -0
- package/lib/@next/Menu/index.js +6 -0
- package/lib/@next/Menu/menuStoryHelper/PopoverMenu.d.ts +7 -0
- package/lib/@next/Menu/menuStoryHelper/PopoverMenu.js +60 -0
- package/lib/@next/Select/Select.d.ts +36 -0
- package/lib/@next/Select/Select.js +125 -0
- package/lib/@next/Select/Select.stories.d.ts +11 -0
- package/lib/@next/Select/SelectStyle.d.ts +6 -0
- package/lib/@next/Select/SelectStyle.js +19 -0
- package/lib/@next/Select/components/Activator/ActivatorContext.d.ts +17 -0
- package/lib/@next/Select/components/Activator/ActivatorContext.js +25 -0
- package/lib/@next/Select/components/Activator/ActivatorSelect.d.ts +10 -0
- package/lib/@next/Select/components/Activator/ActivatorSelect.js +79 -0
- package/lib/@next/Select/components/Activator/ActivatorStyle.d.ts +9 -0
- package/lib/@next/Select/components/Activator/ActivatorStyle.js +39 -0
- package/lib/@next/Select/components/Activator/ActivatorTextInput.d.ts +8 -0
- package/lib/@next/Select/components/Activator/ActivatorTextInput.js +46 -0
- package/lib/@next/Select/components/Activator/index.d.ts +2 -0
- package/lib/@next/Select/components/Activator/index.js +8 -0
- package/lib/@next/Select/components/Label/Label.d.ts +4 -0
- package/lib/@next/Select/components/Label/Label.js +17 -0
- package/lib/@next/Select/components/OptionList/OptionList.d.ts +15 -0
- package/lib/@next/Select/components/OptionList/OptionList.js +53 -0
- package/lib/@next/Select/components/OptionList/OptionListStyle.d.ts +6 -0
- package/lib/@next/Select/components/OptionList/OptionListStyle.js +19 -0
- package/lib/@next/Select/components/OptionList/index.d.ts +1 -0
- package/lib/@next/Select/components/OptionList/index.js +6 -0
- package/lib/@next/Select/components/index.d.ts +2 -0
- package/lib/@next/Select/components/index.js +18 -0
- package/lib/@next/Select/index.d.ts +2 -0
- package/lib/@next/Select/index.js +15 -0
- package/lib/@next/Select/selectStoryHelper/NonSearchableMultiSelect.d.ts +3 -0
- package/lib/@next/Select/selectStoryHelper/NonSearchableMultiSelect.js +48 -0
- package/lib/@next/Select/selectStoryHelper/NonSearchableSingleSelect.d.ts +3 -0
- package/lib/@next/Select/selectStoryHelper/NonSearchableSingleSelect.js +35 -0
- package/lib/@next/Select/selectStoryHelper/Searchable.d.ts +7 -0
- package/lib/@next/Select/selectStoryHelper/Searchable.js +93 -0
- package/lib/@next/Select/selectStoryHelper/SelectStoryStyle.d.ts +2 -0
- package/lib/@next/Select/selectStoryHelper/SelectStoryStyle.js +13 -0
- package/lib/@next/Tag/Tag.d.ts +1 -1
- package/lib/@next/Tag/TagStyle.js +1 -1
- package/lib/@next/TextInput/TextInput.js +4 -2
- package/lib/@next/index.d.ts +1 -0
- package/lib/@next/index.js +4 -1
- package/lib/Input/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/package.json +2 -2
package/lib/@next/Menu/Menu.js
CHANGED
|
@@ -8,44 +8,97 @@ var _reactIdGenerator = _interopRequireDefault(require("react-id-generator"));
|
|
|
8
8
|
var _Typography = require("../Typography");
|
|
9
9
|
var _colors = require("../utilities/colors");
|
|
10
10
|
var _MenuStyle = require("./MenuStyle");
|
|
11
|
+
var _MenuOptionLabel = require("./components/MenuOptionLabel");
|
|
12
|
+
var _MenuOption = require("./components/MenuOption");
|
|
13
|
+
var _MenuOptionCheckbox = require("./components/MenuOptionCheckbox");
|
|
11
14
|
var Menu = function Menu(_ref) {
|
|
12
|
-
var
|
|
13
|
-
|
|
15
|
+
var allowMultiple = _ref.allowMultiple,
|
|
16
|
+
id = _ref.id,
|
|
17
|
+
onClick = _ref.onClick,
|
|
14
18
|
options = _ref.options,
|
|
19
|
+
sections = _ref.sections,
|
|
15
20
|
selectedValues = _ref.selectedValues,
|
|
16
21
|
title = _ref.title;
|
|
17
22
|
var randomId = (0, _reactIdGenerator["default"])('glints-menu');
|
|
18
23
|
var menuId = id ? id : randomId;
|
|
19
|
-
var
|
|
20
|
-
|
|
24
|
+
var renderTitle = function renderTitle(_ref2) {
|
|
25
|
+
var title = _ref2.title;
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuStyle.TitleContainer, null, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
27
|
+
variant: "subtitle2",
|
|
28
|
+
as: "span",
|
|
29
|
+
color: _colors.Neutral.B40
|
|
30
|
+
}, title));
|
|
31
|
+
};
|
|
32
|
+
var renderOptions = function renderOptions(_ref3) {
|
|
33
|
+
var options = _ref3.options;
|
|
34
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuStyle.StyledMenu, null, options == null ? void 0 : options.map(function (option) {
|
|
35
|
+
var value = option.value,
|
|
36
|
+
label = option.label,
|
|
37
|
+
disabled = option.disabled,
|
|
38
|
+
id = option.id;
|
|
39
|
+
var randomId = (0, _reactIdGenerator["default"])('glints-menu-option');
|
|
40
|
+
var menuOptionId = id ? id : randomId;
|
|
41
|
+
var isSelected = selectedValues == null ? void 0 : selectedValues.includes(value);
|
|
42
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuOption.MenuOption, {
|
|
43
|
+
key: menuOptionId,
|
|
44
|
+
value: value,
|
|
45
|
+
disabled: disabled,
|
|
46
|
+
isSelected: isSelected,
|
|
47
|
+
onClick: onClick,
|
|
48
|
+
allowMultiple: allowMultiple
|
|
49
|
+
}, /*#__PURE__*/_react["default"].createElement(_MenuOptionLabel.MenuOptionLabel, {
|
|
50
|
+
label: label
|
|
51
|
+
}));
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
var renderOptionsWithCheckbox = function renderOptionsWithCheckbox(_ref4) {
|
|
55
|
+
var options = _ref4.options;
|
|
56
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuStyle.StyledMenu, null, options == null ? void 0 : options.map(function (option) {
|
|
57
|
+
var value = option.value,
|
|
58
|
+
label = option.label,
|
|
59
|
+
disabled = option.disabled,
|
|
60
|
+
id = option.id;
|
|
61
|
+
var randomId = (0, _reactIdGenerator["default"])('glints-menu-option');
|
|
62
|
+
var menuOptionId = id ? id : randomId;
|
|
63
|
+
var isSelected = selectedValues == null ? void 0 : selectedValues.includes(value);
|
|
64
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuOption.MenuOption, {
|
|
65
|
+
key: menuOptionId,
|
|
66
|
+
value: value,
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
isSelected: isSelected,
|
|
69
|
+
onClick: onClick,
|
|
70
|
+
allowMultiple: allowMultiple
|
|
71
|
+
}, /*#__PURE__*/_react["default"].createElement(_MenuOptionCheckbox.MenuOptionCheckbox, {
|
|
72
|
+
isSelected: isSelected,
|
|
73
|
+
disabled: disabled,
|
|
74
|
+
label: label
|
|
75
|
+
}));
|
|
76
|
+
}));
|
|
21
77
|
};
|
|
22
|
-
|
|
78
|
+
var renderSections = function renderSections(_ref5) {
|
|
79
|
+
var sections = _ref5.sections;
|
|
80
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuStyle.StyledSections, null, sections.map(function (section, index) {
|
|
81
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
82
|
+
key: "menu-section-" + title + "-" + index
|
|
83
|
+
}, renderTitle({
|
|
84
|
+
title: section == null ? void 0 : section.title
|
|
85
|
+
}), allowMultiple ? renderOptionsWithCheckbox({
|
|
86
|
+
options: section == null ? void 0 : section.options
|
|
87
|
+
}) : renderOptions({
|
|
88
|
+
options: section == null ? void 0 : section.options
|
|
89
|
+
}));
|
|
90
|
+
}));
|
|
91
|
+
};
|
|
92
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
23
93
|
id: menuId
|
|
24
|
-
}, title &&
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
id = option.id;
|
|
33
|
-
var isSelected = selectedValues == null ? void 0 : selectedValues.includes(value);
|
|
34
|
-
return /*#__PURE__*/_react["default"].createElement(_MenuStyle.ListContainer, {
|
|
35
|
-
key: id
|
|
36
|
-
}, /*#__PURE__*/_react["default"].createElement("li", {
|
|
37
|
-
key: id,
|
|
38
|
-
"aria-disabled": disabled,
|
|
39
|
-
"data-active": isSelected,
|
|
40
|
-
value: value,
|
|
41
|
-
onClick: function onClick() {
|
|
42
|
-
return handleClick(value);
|
|
43
|
-
}
|
|
44
|
-
}, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
45
|
-
as: "span",
|
|
46
|
-
variant: "body1",
|
|
47
|
-
color: _colors.Neutral.B18
|
|
48
|
-
}, label)));
|
|
94
|
+
}, title && renderTitle({
|
|
95
|
+
title: title
|
|
96
|
+
}), allowMultiple ? renderOptionsWithCheckbox({
|
|
97
|
+
options: options
|
|
98
|
+
}) : renderOptions({
|
|
99
|
+
options: options
|
|
100
|
+
}), sections && renderSections({
|
|
101
|
+
sections: sections
|
|
49
102
|
}));
|
|
50
103
|
};
|
|
51
104
|
exports.Menu = Menu;
|
|
@@ -2,3 +2,4 @@ import { MenuProps } from './Menu';
|
|
|
2
2
|
export declare const StyledMenu: import("styled-components").StyledComponent<"ul", any, MenuProps, never>;
|
|
3
3
|
export declare const TitleContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
export declare const ListContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const StyledSections: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.TitleContainer = exports.StyledMenu = exports.ListContainer = void 0;
|
|
5
|
+
exports.TitleContainer = exports.StyledSections = exports.StyledMenu = exports.ListContainer = void 0;
|
|
6
6
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
7
|
var _borderRadius = require("../utilities/borderRadius");
|
|
8
8
|
var _colors = require("../utilities/colors");
|
|
@@ -10,15 +10,20 @@ var _spacing = require("../utilities/spacing");
|
|
|
10
10
|
var StyledMenu = _styledComponents["default"].ul.withConfig({
|
|
11
11
|
displayName: "MenuStyle__StyledMenu",
|
|
12
12
|
componentId: "sc-zm0l1a-0"
|
|
13
|
-
})(["list-style:none;
|
|
13
|
+
})(["list-style:none;padding:0;margin:0;li{display:flex;height:44px;position:relative;align-items:center;padding:0 ", ";margin-bottom:", ";svg{height:24px;width:24px;}&:hover{background:", ";border-radius:", ";cursor:pointer;}&:focus{outline:none;background:rgba(255,255,255,0.001);border:2px solid ", ";border-radius:", ";}&[aria-disabled='true']{cursor:default;pointer-events:none;span{color:", ";}}&[data-active='true']{background:", ";border-radius:", ";cursor:default;::before{content:'';display:block;position:absolute;top:0;left:-", ";height:44px;width:3px;background-color:", ";border-radius:0px 4px 4px 0px;}&[data-multiple='true']{background:", ";::before{content:none;}}}}"], _spacing.space8, _spacing.space4, _colors.Neutral.B99, _borderRadius.borderRadius4, _colors.Blue.S54, _spacing.space4, _colors.Neutral.B85, _colors.Blue.S08, _borderRadius.borderRadius4, _spacing.space8, _colors.Blue.S99, _colors.Neutral.B100);
|
|
14
14
|
exports.StyledMenu = StyledMenu;
|
|
15
15
|
var TitleContainer = _styledComponents["default"].div.withConfig({
|
|
16
16
|
displayName: "MenuStyle__TitleContainer",
|
|
17
17
|
componentId: "sc-zm0l1a-1"
|
|
18
|
-
})(["padding:", " ", ";span{text-transform:uppercase;}"], _spacing.space8, _spacing.space16);
|
|
18
|
+
})(["margin:", " 0 ", ";padding:", " ", ";span{text-transform:uppercase;}"], _spacing.space8, _spacing.space4, _spacing.space8, _spacing.space16);
|
|
19
19
|
exports.TitleContainer = TitleContainer;
|
|
20
20
|
var ListContainer = _styledComponents["default"].div.withConfig({
|
|
21
21
|
displayName: "MenuStyle__ListContainer",
|
|
22
22
|
componentId: "sc-zm0l1a-2"
|
|
23
23
|
})(["padding:0 ", ";"], _spacing.space8);
|
|
24
|
-
exports.ListContainer = ListContainer;
|
|
24
|
+
exports.ListContainer = ListContainer;
|
|
25
|
+
var StyledSections = _styledComponents["default"].ul.withConfig({
|
|
26
|
+
displayName: "MenuStyle__StyledSections",
|
|
27
|
+
componentId: "sc-zm0l1a-3"
|
|
28
|
+
})(["list-style:none;padding:0;margin:", " 0;"], _spacing.space8);
|
|
29
|
+
exports.StyledSections = StyledSections;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface MenuOptionProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'onClick'> {
|
|
3
|
+
id?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
isSelected?: boolean;
|
|
6
|
+
value: string;
|
|
7
|
+
onClick?({ value }: {
|
|
8
|
+
value: string;
|
|
9
|
+
}): void;
|
|
10
|
+
allowMultiple?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const MenuOption: ({ children, disabled, isSelected, onClick, value, allowMultiple, }: MenuOptionProps) => JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.MenuOption = void 0;
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _MenuStyle = require("../MenuStyle");
|
|
8
|
+
var MenuOption = function MenuOption(_ref) {
|
|
9
|
+
var children = _ref.children,
|
|
10
|
+
disabled = _ref.disabled,
|
|
11
|
+
isSelected = _ref.isSelected,
|
|
12
|
+
onClick = _ref.onClick,
|
|
13
|
+
value = _ref.value,
|
|
14
|
+
allowMultiple = _ref.allowMultiple;
|
|
15
|
+
var handleClick = function handleClick(value) {
|
|
16
|
+
onClick({
|
|
17
|
+
value: value
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuStyle.ListContainer, null, /*#__PURE__*/_react["default"].createElement("li", {
|
|
21
|
+
"aria-disabled": disabled,
|
|
22
|
+
"data-active": isSelected,
|
|
23
|
+
"data-multiple": allowMultiple,
|
|
24
|
+
value: value,
|
|
25
|
+
onClick: function onClick() {
|
|
26
|
+
return handleClick(value);
|
|
27
|
+
}
|
|
28
|
+
}, children));
|
|
29
|
+
};
|
|
30
|
+
exports.MenuOption = MenuOption;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.MenuOptionCheckbox = void 0;
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _Checkbox = require("../../Checkbox");
|
|
8
|
+
var MenuOptionCheckbox = function MenuOptionCheckbox(_ref) {
|
|
9
|
+
var disabled = _ref.disabled,
|
|
10
|
+
isSelected = _ref.isSelected,
|
|
11
|
+
label = _ref.label;
|
|
12
|
+
return /*#__PURE__*/_react["default"].createElement(_Checkbox.Checkbox, {
|
|
13
|
+
label: label,
|
|
14
|
+
checked: isSelected,
|
|
15
|
+
disabled: disabled
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.MenuOptionCheckbox = MenuOptionCheckbox;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.MenuOptionLabel = void 0;
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _Typography = require("../../Typography");
|
|
8
|
+
var _colors = require("../../utilities/colors");
|
|
9
|
+
var MenuOptionLabel = function MenuOptionLabel(_ref) {
|
|
10
|
+
var label = _ref.label;
|
|
11
|
+
return /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
12
|
+
as: "span",
|
|
13
|
+
variant: "body1",
|
|
14
|
+
color: _colors.Neutral.B18
|
|
15
|
+
}, label);
|
|
16
|
+
};
|
|
17
|
+
exports.MenuOptionLabel = MenuOptionLabel;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.MenuOptionProps = exports.MenuOptionLabel = exports.MenuOptionCheckbox = exports.MenuOption = void 0;
|
|
5
|
+
var _MenuOption = require("./MenuOption");
|
|
6
|
+
exports.MenuOption = _MenuOption.MenuOption;
|
|
7
|
+
exports.MenuOptionProps = _MenuOption.MenuOptionProps;
|
|
8
|
+
var _MenuOptionLabel = require("./MenuOptionLabel");
|
|
9
|
+
exports.MenuOptionLabel = _MenuOptionLabel.MenuOptionLabel;
|
|
10
|
+
var _MenuOptionCheckbox = require("./MenuOptionCheckbox");
|
|
11
|
+
exports.MenuOptionCheckbox = _MenuOptionCheckbox.MenuOptionCheckbox;
|
package/lib/@next/Menu/index.js
CHANGED
|
@@ -6,4 +6,10 @@ Object.keys(_Menu).forEach(function (key) {
|
|
|
6
6
|
if (key === "default" || key === "__esModule") return;
|
|
7
7
|
if (key in exports && exports[key] === _Menu[key]) return;
|
|
8
8
|
exports[key] = _Menu[key];
|
|
9
|
+
});
|
|
10
|
+
var _components = require("./components");
|
|
11
|
+
Object.keys(_components).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (key in exports && exports[key] === _components[key]) return;
|
|
14
|
+
exports[key] = _components[key];
|
|
9
15
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MenuProps } from '../Menu';
|
|
3
|
+
interface PopoverMenuProps extends MenuProps {
|
|
4
|
+
activatorLabel?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const PopoverMenu: ({ activatorLabel, allowMultiple, ...props }: PopoverMenuProps) => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.PopoverMenu = void 0;
|
|
6
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _Button = require("../../Button");
|
|
10
|
+
var _Popover = require("../../Popover");
|
|
11
|
+
var _Menu = require("../Menu");
|
|
12
|
+
var _excluded = ["activatorLabel", "allowMultiple"];
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
var PopoverMenu = function PopoverMenu(_ref) {
|
|
16
|
+
var _ref$activatorLabel = _ref.activatorLabel,
|
|
17
|
+
activatorLabel = _ref$activatorLabel === void 0 ? 'Menu' : _ref$activatorLabel,
|
|
18
|
+
allowMultiple = _ref.allowMultiple,
|
|
19
|
+
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
20
|
+
var _useState = (0, _react.useState)(true),
|
|
21
|
+
popoverActive = _useState[0],
|
|
22
|
+
setPopoverActive = _useState[1];
|
|
23
|
+
var _useState2 = (0, _react.useState)([]),
|
|
24
|
+
selectedOptions = _useState2[0],
|
|
25
|
+
setSelectedOptions = _useState2[1];
|
|
26
|
+
var togglePopoverActive = (0, _react.useCallback)(function () {
|
|
27
|
+
return setPopoverActive(function (popoverActive) {
|
|
28
|
+
return !popoverActive;
|
|
29
|
+
});
|
|
30
|
+
}, []);
|
|
31
|
+
var handleSelect = function handleSelect(_ref2) {
|
|
32
|
+
var value = _ref2.value;
|
|
33
|
+
if (!allowMultiple) {
|
|
34
|
+
setSelectedOptions([value]);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!selectedOptions.includes(value)) {
|
|
38
|
+
setSelectedOptions([].concat(selectedOptions, [value]));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setSelectedOptions(selectedOptions.filter(function (option) {
|
|
42
|
+
return option !== value;
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
var activator = /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
46
|
+
onClick: togglePopoverActive
|
|
47
|
+
}, activatorLabel);
|
|
48
|
+
return /*#__PURE__*/_react["default"].createElement(_Popover.Popover, {
|
|
49
|
+
active: popoverActive,
|
|
50
|
+
activator: activator,
|
|
51
|
+
onClose: function onClose() {
|
|
52
|
+
return setPopoverActive(false);
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/_react["default"].createElement(_Popover.Popover.Pane, null, /*#__PURE__*/_react["default"].createElement(_Menu.Menu, (0, _extends2["default"])({}, props, {
|
|
55
|
+
allowMultiple: allowMultiple,
|
|
56
|
+
onClick: handleSelect,
|
|
57
|
+
selectedValues: selectedOptions
|
|
58
|
+
}))));
|
|
59
|
+
};
|
|
60
|
+
exports.PopoverMenu = PopoverMenu;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Option, Section } from '../Menu';
|
|
3
|
+
interface SearchableProps {
|
|
4
|
+
/** value of TextInput activator when Select is searchable */
|
|
5
|
+
inputValue?: string;
|
|
6
|
+
/** onChange of TextInput activator when Select is searchable */
|
|
7
|
+
onInputChange?(value: string): void;
|
|
8
|
+
}
|
|
9
|
+
export interface SelectProps {
|
|
10
|
+
allowMultiple?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
hasError?: boolean;
|
|
13
|
+
helpText?: React.ReactNode;
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
/** Margin Top = 8 ; Option height = 48 ; optionListHeight = (n options * option height) + margin top; */
|
|
16
|
+
listHeight?: number;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
onRemoveTag?({ option }: {
|
|
19
|
+
option: string;
|
|
20
|
+
}): void;
|
|
21
|
+
onSelect?({ value }: {
|
|
22
|
+
value: string;
|
|
23
|
+
}): void;
|
|
24
|
+
options?: Option[];
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/** sets whether to be able to type in to search from the options*/
|
|
27
|
+
searchableProps?: SearchableProps;
|
|
28
|
+
/** true = Allow vertical scroll, default by 6 options. */
|
|
29
|
+
scrollable?: boolean;
|
|
30
|
+
sections?: Section[];
|
|
31
|
+
selectedValues?: string[];
|
|
32
|
+
/** sets a width for the Select component*/
|
|
33
|
+
width: string;
|
|
34
|
+
}
|
|
35
|
+
export declare const Select: ({ allowMultiple, disabled, hasError, helpText, label, onClose, onRemoveTag, onSelect, options, placeholder, listHeight, searchableProps, scrollable, sections, selectedValues, width, }: SelectProps) => JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Select = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _Popover = require("../Popover");
|
|
7
|
+
var _Typography = require("../Typography");
|
|
8
|
+
var _colors = require("../utilities/colors");
|
|
9
|
+
var _components = require("./components");
|
|
10
|
+
var _ActivatorContext = require("./components/Activator/ActivatorContext");
|
|
11
|
+
var _ActivatorSelect = require("./components/Activator/ActivatorSelect");
|
|
12
|
+
var _Label = require("./components/Label/Label");
|
|
13
|
+
var _SelectStyle = require("./SelectStyle");
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
var Select = function Select(_ref) {
|
|
17
|
+
var _ref$allowMultiple = _ref.allowMultiple,
|
|
18
|
+
allowMultiple = _ref$allowMultiple === void 0 ? false : _ref$allowMultiple,
|
|
19
|
+
disabled = _ref.disabled,
|
|
20
|
+
hasError = _ref.hasError,
|
|
21
|
+
helpText = _ref.helpText,
|
|
22
|
+
label = _ref.label,
|
|
23
|
+
onClose = _ref.onClose,
|
|
24
|
+
onRemoveTag = _ref.onRemoveTag,
|
|
25
|
+
onSelect = _ref.onSelect,
|
|
26
|
+
options = _ref.options,
|
|
27
|
+
placeholder = _ref.placeholder,
|
|
28
|
+
listHeight = _ref.listHeight,
|
|
29
|
+
searchableProps = _ref.searchableProps,
|
|
30
|
+
scrollable = _ref.scrollable,
|
|
31
|
+
sections = _ref.sections,
|
|
32
|
+
selectedValues = _ref.selectedValues,
|
|
33
|
+
width = _ref.width;
|
|
34
|
+
var _useState = (0, _react.useState)(false),
|
|
35
|
+
popoverActive = _useState[0],
|
|
36
|
+
setPopoverActive = _useState[1];
|
|
37
|
+
var _useState2 = (0, _react.useState)(''),
|
|
38
|
+
optionListHeight = _useState2[0],
|
|
39
|
+
setOptionListHeight = _useState2[1];
|
|
40
|
+
var handleClose = (0, _react.useCallback)(function () {
|
|
41
|
+
setPopoverActive(false);
|
|
42
|
+
onClose == null ? void 0 : onClose();
|
|
43
|
+
}, [onClose]);
|
|
44
|
+
var handleFocus = function handleFocus() {
|
|
45
|
+
setPopoverActive(true);
|
|
46
|
+
};
|
|
47
|
+
var handleBlur = function handleBlur() {
|
|
48
|
+
if (popoverActive) {
|
|
49
|
+
handleClose();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var handleSelectClick = function handleSelectClick() {
|
|
53
|
+
setPopoverActive(!popoverActive);
|
|
54
|
+
};
|
|
55
|
+
var activatorSelectContextValue = {
|
|
56
|
+
allowMultiple: allowMultiple,
|
|
57
|
+
disabled: disabled,
|
|
58
|
+
hasError: hasError,
|
|
59
|
+
onSelectClick: handleSelectClick,
|
|
60
|
+
selectedValues: selectedValues
|
|
61
|
+
};
|
|
62
|
+
var activatorTextInputContextValue = {
|
|
63
|
+
disabled: disabled,
|
|
64
|
+
hasError: hasError,
|
|
65
|
+
onFocus: handleFocus,
|
|
66
|
+
onBlur: handleBlur
|
|
67
|
+
};
|
|
68
|
+
(0, _react.useEffect)(function () {
|
|
69
|
+
if (listHeight) {
|
|
70
|
+
setOptionListHeight(listHeight + 24 + "px");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (scrollable) {
|
|
74
|
+
setOptionListHeight(296 + 24 + "px");
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}, [listHeight, scrollable]);
|
|
78
|
+
var activator = function activator() {
|
|
79
|
+
if (searchableProps) {
|
|
80
|
+
var inputValue = searchableProps.inputValue,
|
|
81
|
+
_onInputChange = searchableProps.onInputChange;
|
|
82
|
+
return /*#__PURE__*/_react["default"].createElement(_ActivatorContext.ActivatorTextInputContext.Provider, {
|
|
83
|
+
value: activatorTextInputContextValue
|
|
84
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.ActivatorTextInput, {
|
|
85
|
+
value: inputValue,
|
|
86
|
+
onChange: _onInputChange,
|
|
87
|
+
placeholder: placeholder != null ? placeholder : 'Search',
|
|
88
|
+
width: width
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
return /*#__PURE__*/_react["default"].createElement(_ActivatorContext.ActivatorSelectContext.Provider, {
|
|
92
|
+
value: activatorSelectContextValue
|
|
93
|
+
}, /*#__PURE__*/_react["default"].createElement(_ActivatorSelect.ActivatorSelect, {
|
|
94
|
+
disabled: disabled,
|
|
95
|
+
placeholder: "Placeholder",
|
|
96
|
+
onRemoveTag: onRemoveTag,
|
|
97
|
+
width: width,
|
|
98
|
+
values: selectedValues
|
|
99
|
+
}));
|
|
100
|
+
};
|
|
101
|
+
return /*#__PURE__*/_react["default"].createElement(_Popover.Popover, {
|
|
102
|
+
active: popoverActive,
|
|
103
|
+
activator: /*#__PURE__*/_react["default"].createElement(_SelectStyle.ActivatorWrapper, {
|
|
104
|
+
width: width
|
|
105
|
+
}, label && /*#__PURE__*/_react["default"].createElement(_Label.Label, null, label), activator(), helpText && /*#__PURE__*/_react["default"].createElement(_SelectStyle.HelpTextContainer, null, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
106
|
+
as: "span",
|
|
107
|
+
variant: "subtitle2",
|
|
108
|
+
color: disabled ? _colors.Neutral.B85 : _colors.Neutral.B40
|
|
109
|
+
}, helpText))),
|
|
110
|
+
onClose: handleClose,
|
|
111
|
+
autofocusTarget: "none",
|
|
112
|
+
preventFocusOnClose: true,
|
|
113
|
+
fullWidth: true
|
|
114
|
+
}, /*#__PURE__*/_react["default"].createElement(_Popover.Popover.Pane, {
|
|
115
|
+
height: optionListHeight
|
|
116
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.OptionList, {
|
|
117
|
+
allowMultiple: allowMultiple,
|
|
118
|
+
onSelect: onSelect,
|
|
119
|
+
options: options,
|
|
120
|
+
sections: sections,
|
|
121
|
+
selectedValues: selectedValues,
|
|
122
|
+
width: width
|
|
123
|
+
})));
|
|
124
|
+
};
|
|
125
|
+
exports.Select = Select;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
declare const _default: Meta<import("@storybook/react").Args>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export declare const NonSearchableSingleSelect: any;
|
|
5
|
+
export declare const NonSearchableMultipleSelect: any;
|
|
6
|
+
export declare const WithErrorNonSearchable: any;
|
|
7
|
+
export declare const NonSearchableDisabled: any;
|
|
8
|
+
export declare const SearchableMultiSelect: any;
|
|
9
|
+
export declare const MultiSelectScrollable: any;
|
|
10
|
+
export declare const WithInlineError: any;
|
|
11
|
+
export declare const SearchableDisabled: any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface ActivatorWrapperProps {
|
|
2
|
+
width?: string;
|
|
3
|
+
}
|
|
4
|
+
export declare const HelpTextContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const ActivatorWrapper: import("styled-components").StyledComponent<"div", any, ActivatorWrapperProps, never>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.HelpTextContainer = exports.ActivatorWrapper = void 0;
|
|
6
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
|
+
var _spacing = require("../utilities/spacing");
|
|
8
|
+
var HelpTextContainer = _styledComponents["default"].div.withConfig({
|
|
9
|
+
displayName: "SelectStyle__HelpTextContainer",
|
|
10
|
+
componentId: "sc-c6sc8m-0"
|
|
11
|
+
})(["margin-top:", ";"], _spacing.space4);
|
|
12
|
+
exports.HelpTextContainer = HelpTextContainer;
|
|
13
|
+
var ActivatorWrapper = _styledComponents["default"].div.withConfig({
|
|
14
|
+
displayName: "SelectStyle__ActivatorWrapper",
|
|
15
|
+
componentId: "sc-c6sc8m-1"
|
|
16
|
+
})(["display:flex;flex-direction:column;width:", ";"], function (props) {
|
|
17
|
+
return props.width;
|
|
18
|
+
});
|
|
19
|
+
exports.ActivatorWrapper = ActivatorWrapper;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ActivatorSelectProps } from './ActivatorSelect';
|
|
3
|
+
import { ActivatorTextInputProps } from './ActivatorTextInput';
|
|
4
|
+
export interface ActivatorSelectContextProps extends ActivatorSelectProps {
|
|
5
|
+
allowMultiple?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
hasError?: boolean;
|
|
8
|
+
onSelectClick(): void;
|
|
9
|
+
selectedValues?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface ActivatorTextInputContextProps extends ActivatorTextInputProps {
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const ActivatorSelectContext: import("react").Context<ActivatorSelectContextProps>;
|
|
15
|
+
export declare const ActivatorTextInputContext: import("react").Context<ActivatorTextInputContextProps>;
|
|
16
|
+
export declare const useActivatorSelect: () => ActivatorSelectContextProps;
|
|
17
|
+
export declare const useActivatorTextInput: () => ActivatorTextInputContextProps;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useActivatorTextInput = exports.useActivatorSelect = exports.ActivatorTextInputContext = exports.ActivatorSelectContext = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var ActivatorSelectContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
7
|
+
exports.ActivatorSelectContext = ActivatorSelectContext;
|
|
8
|
+
var ActivatorTextInputContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
9
|
+
exports.ActivatorTextInputContext = ActivatorTextInputContext;
|
|
10
|
+
var useActivatorSelect = function useActivatorSelect() {
|
|
11
|
+
var context = (0, _react.useContext)(ActivatorSelectContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error('No ActivatorSelectContext was provided. Your component must be wrapped in a <ActivatorSelectContext.Provider>');
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
};
|
|
17
|
+
exports.useActivatorSelect = useActivatorSelect;
|
|
18
|
+
var useActivatorTextInput = function useActivatorTextInput() {
|
|
19
|
+
var context = (0, _react.useContext)(ActivatorTextInputContext);
|
|
20
|
+
if (!context) {
|
|
21
|
+
throw new Error('No ActivatorTextInputContext was provided. Your component must be wrapped in a <ActivatorTextInputContext.Provider>');
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
};
|
|
25
|
+
exports.useActivatorTextInput = useActivatorTextInput;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ActivatorSelectProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
values?: string[];
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
onRemoveTag?({ option }: {
|
|
6
|
+
option: string;
|
|
7
|
+
}): void;
|
|
8
|
+
width?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const ActivatorSelect: ({ placeholder, values, onClick, onRemoveTag, width, ...props }: ActivatorSelectProps) => JSX.Element;
|