glints-aries 4.0.230 → 4.0.232

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.
Files changed (129) hide show
  1. package/es/@next/Button/ButtonStyle.js +1 -1
  2. package/es/@next/Checkbox/Checkbox.js +3 -1
  3. package/es/@next/IndexTable/IndexTable.js +3 -2
  4. package/es/@next/IndexTable/IndexTableStyle.js +3 -1
  5. package/es/@next/IndexTable/components/Checkbox/Checkbox.js +3 -1
  6. package/es/@next/IndexTable/components/Checkbox/CheckboxStyle.js +2 -1
  7. package/es/@next/Menu/Menu.d.ts +12 -5
  8. package/es/@next/Menu/Menu.js +84 -31
  9. package/es/@next/Menu/Menu.stories.d.ts +2 -0
  10. package/es/@next/Menu/MenuStyle.d.ts +1 -0
  11. package/es/@next/Menu/MenuStyle.js +7 -3
  12. package/es/@next/Menu/components/MenuOption.d.ts +12 -0
  13. package/es/@next/Menu/components/MenuOption.js +24 -0
  14. package/es/@next/Menu/components/MenuOptionCheckbox.d.ts +6 -0
  15. package/es/@next/Menu/components/MenuOptionCheckbox.js +12 -0
  16. package/es/@next/Menu/components/MenuOptionLabel.d.ts +4 -0
  17. package/es/@next/Menu/components/MenuOptionLabel.js +11 -0
  18. package/es/@next/Menu/components/index.d.ts +3 -0
  19. package/es/@next/Menu/components/index.js +3 -0
  20. package/es/@next/Menu/index.d.ts +1 -0
  21. package/es/@next/Menu/index.js +2 -1
  22. package/es/@next/Menu/menuStoryHelper/PopoverMenu.d.ts +7 -0
  23. package/es/@next/Menu/menuStoryHelper/PopoverMenu.js +52 -0
  24. package/es/@next/Select/Select.d.ts +36 -0
  25. package/es/@next/Select/Select.js +118 -0
  26. package/es/@next/Select/Select.stories.d.ts +11 -0
  27. package/es/@next/Select/SelectStyle.d.ts +6 -0
  28. package/es/@next/Select/SelectStyle.js +12 -0
  29. package/es/@next/Select/components/Activator/ActivatorContext.d.ts +17 -0
  30. package/es/@next/Select/components/Activator/ActivatorContext.js +17 -0
  31. package/es/@next/Select/components/Activator/ActivatorSelect.d.ts +10 -0
  32. package/es/@next/Select/components/Activator/ActivatorSelect.js +71 -0
  33. package/es/@next/Select/components/Activator/ActivatorStyle.d.ts +9 -0
  34. package/es/@next/Select/components/Activator/ActivatorStyle.js +28 -0
  35. package/es/@next/Select/components/Activator/ActivatorTextInput.d.ts +8 -0
  36. package/es/@next/Select/components/Activator/ActivatorTextInput.js +38 -0
  37. package/es/@next/Select/components/Activator/index.d.ts +2 -0
  38. package/es/@next/Select/components/Activator/index.js +2 -0
  39. package/es/@next/Select/components/Label/Label.d.ts +4 -0
  40. package/es/@next/Select/components/Label/Label.js +11 -0
  41. package/es/@next/Select/components/OptionList/OptionList.d.ts +15 -0
  42. package/es/@next/Select/components/OptionList/OptionList.js +46 -0
  43. package/es/@next/Select/components/OptionList/OptionListStyle.d.ts +6 -0
  44. package/es/@next/Select/components/OptionList/OptionListStyle.js +12 -0
  45. package/es/@next/Select/components/OptionList/index.d.ts +1 -0
  46. package/es/@next/Select/components/OptionList/index.js +1 -0
  47. package/es/@next/Select/components/index.d.ts +2 -0
  48. package/es/@next/Select/components/index.js +2 -0
  49. package/es/@next/Select/index.d.ts +2 -0
  50. package/es/@next/Select/index.js +2 -0
  51. package/es/@next/Select/selectStoryHelper/NonSearchableMultiSelect.d.ts +3 -0
  52. package/es/@next/Select/selectStoryHelper/NonSearchableMultiSelect.js +40 -0
  53. package/es/@next/Select/selectStoryHelper/NonSearchableSingleSelect.d.ts +3 -0
  54. package/es/@next/Select/selectStoryHelper/NonSearchableSingleSelect.js +27 -0
  55. package/es/@next/Select/selectStoryHelper/Searchable.d.ts +7 -0
  56. package/es/@next/Select/selectStoryHelper/Searchable.js +85 -0
  57. package/es/@next/Select/selectStoryHelper/SelectStoryStyle.d.ts +2 -0
  58. package/es/@next/Select/selectStoryHelper/SelectStoryStyle.js +7 -0
  59. package/es/@next/Tag/Tag.d.ts +1 -1
  60. package/es/@next/Tag/TagStyle.js +1 -1
  61. package/es/@next/TextInput/TextInput.js +4 -2
  62. package/es/@next/index.d.ts +1 -0
  63. package/es/@next/index.js +1 -0
  64. package/es/Input/PhoneNumberInput/PhoneNumberInput.js +1 -1
  65. package/lib/@next/Button/ButtonStyle.js +1 -1
  66. package/lib/@next/Checkbox/Checkbox.js +3 -1
  67. package/lib/@next/IndexTable/IndexTable.js +3 -2
  68. package/lib/@next/IndexTable/IndexTableStyle.js +3 -1
  69. package/lib/@next/IndexTable/components/Checkbox/Checkbox.js +3 -1
  70. package/lib/@next/IndexTable/components/Checkbox/CheckboxStyle.js +2 -1
  71. package/lib/@next/Menu/Menu.d.ts +12 -5
  72. package/lib/@next/Menu/Menu.js +83 -30
  73. package/lib/@next/Menu/Menu.stories.d.ts +2 -0
  74. package/lib/@next/Menu/MenuStyle.d.ts +1 -0
  75. package/lib/@next/Menu/MenuStyle.js +9 -4
  76. package/lib/@next/Menu/components/MenuOption.d.ts +12 -0
  77. package/lib/@next/Menu/components/MenuOption.js +30 -0
  78. package/lib/@next/Menu/components/MenuOptionCheckbox.d.ts +6 -0
  79. package/lib/@next/Menu/components/MenuOptionCheckbox.js +18 -0
  80. package/lib/@next/Menu/components/MenuOptionLabel.d.ts +4 -0
  81. package/lib/@next/Menu/components/MenuOptionLabel.js +17 -0
  82. package/lib/@next/Menu/components/index.d.ts +3 -0
  83. package/lib/@next/Menu/components/index.js +11 -0
  84. package/lib/@next/Menu/index.d.ts +1 -0
  85. package/lib/@next/Menu/index.js +6 -0
  86. package/lib/@next/Menu/menuStoryHelper/PopoverMenu.d.ts +7 -0
  87. package/lib/@next/Menu/menuStoryHelper/PopoverMenu.js +60 -0
  88. package/lib/@next/Select/Select.d.ts +36 -0
  89. package/lib/@next/Select/Select.js +125 -0
  90. package/lib/@next/Select/Select.stories.d.ts +11 -0
  91. package/lib/@next/Select/SelectStyle.d.ts +6 -0
  92. package/lib/@next/Select/SelectStyle.js +19 -0
  93. package/lib/@next/Select/components/Activator/ActivatorContext.d.ts +17 -0
  94. package/lib/@next/Select/components/Activator/ActivatorContext.js +25 -0
  95. package/lib/@next/Select/components/Activator/ActivatorSelect.d.ts +10 -0
  96. package/lib/@next/Select/components/Activator/ActivatorSelect.js +79 -0
  97. package/lib/@next/Select/components/Activator/ActivatorStyle.d.ts +9 -0
  98. package/lib/@next/Select/components/Activator/ActivatorStyle.js +39 -0
  99. package/lib/@next/Select/components/Activator/ActivatorTextInput.d.ts +8 -0
  100. package/lib/@next/Select/components/Activator/ActivatorTextInput.js +46 -0
  101. package/lib/@next/Select/components/Activator/index.d.ts +2 -0
  102. package/lib/@next/Select/components/Activator/index.js +8 -0
  103. package/lib/@next/Select/components/Label/Label.d.ts +4 -0
  104. package/lib/@next/Select/components/Label/Label.js +17 -0
  105. package/lib/@next/Select/components/OptionList/OptionList.d.ts +15 -0
  106. package/lib/@next/Select/components/OptionList/OptionList.js +53 -0
  107. package/lib/@next/Select/components/OptionList/OptionListStyle.d.ts +6 -0
  108. package/lib/@next/Select/components/OptionList/OptionListStyle.js +19 -0
  109. package/lib/@next/Select/components/OptionList/index.d.ts +1 -0
  110. package/lib/@next/Select/components/OptionList/index.js +6 -0
  111. package/lib/@next/Select/components/index.d.ts +2 -0
  112. package/lib/@next/Select/components/index.js +18 -0
  113. package/lib/@next/Select/index.d.ts +2 -0
  114. package/lib/@next/Select/index.js +15 -0
  115. package/lib/@next/Select/selectStoryHelper/NonSearchableMultiSelect.d.ts +3 -0
  116. package/lib/@next/Select/selectStoryHelper/NonSearchableMultiSelect.js +48 -0
  117. package/lib/@next/Select/selectStoryHelper/NonSearchableSingleSelect.d.ts +3 -0
  118. package/lib/@next/Select/selectStoryHelper/NonSearchableSingleSelect.js +35 -0
  119. package/lib/@next/Select/selectStoryHelper/Searchable.d.ts +7 -0
  120. package/lib/@next/Select/selectStoryHelper/Searchable.js +93 -0
  121. package/lib/@next/Select/selectStoryHelper/SelectStoryStyle.d.ts +2 -0
  122. package/lib/@next/Select/selectStoryHelper/SelectStoryStyle.js +13 -0
  123. package/lib/@next/Tag/Tag.d.ts +1 -1
  124. package/lib/@next/Tag/TagStyle.js +1 -1
  125. package/lib/@next/TextInput/TextInput.js +4 -2
  126. package/lib/@next/index.d.ts +1 -0
  127. package/lib/@next/index.js +4 -1
  128. package/lib/Input/PhoneNumberInput/PhoneNumberInput.js +1 -1
  129. package/package.json +2 -2
@@ -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,118 @@
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
+ import { Popover } from '../Popover';
3
+ import { Typography } from '../Typography';
4
+ import { Neutral } from '../utilities/colors';
5
+ import { ActivatorTextInput, OptionList } from './components';
6
+ import { ActivatorSelectContext, ActivatorTextInputContext } from './components/Activator/ActivatorContext';
7
+ import { ActivatorSelect } from './components/Activator/ActivatorSelect';
8
+ import { Label } from './components/Label/Label';
9
+ import { ActivatorWrapper, HelpTextContainer } from './SelectStyle';
10
+ export var Select = function Select(_ref) {
11
+ var _ref$allowMultiple = _ref.allowMultiple,
12
+ allowMultiple = _ref$allowMultiple === void 0 ? false : _ref$allowMultiple,
13
+ disabled = _ref.disabled,
14
+ hasError = _ref.hasError,
15
+ helpText = _ref.helpText,
16
+ label = _ref.label,
17
+ onClose = _ref.onClose,
18
+ onRemoveTag = _ref.onRemoveTag,
19
+ onSelect = _ref.onSelect,
20
+ options = _ref.options,
21
+ placeholder = _ref.placeholder,
22
+ listHeight = _ref.listHeight,
23
+ searchableProps = _ref.searchableProps,
24
+ scrollable = _ref.scrollable,
25
+ sections = _ref.sections,
26
+ selectedValues = _ref.selectedValues,
27
+ width = _ref.width;
28
+ var _useState = useState(false),
29
+ popoverActive = _useState[0],
30
+ setPopoverActive = _useState[1];
31
+ var _useState2 = useState(''),
32
+ optionListHeight = _useState2[0],
33
+ setOptionListHeight = _useState2[1];
34
+ var handleClose = useCallback(function () {
35
+ setPopoverActive(false);
36
+ onClose == null ? void 0 : onClose();
37
+ }, [onClose]);
38
+ var handleFocus = function handleFocus() {
39
+ setPopoverActive(true);
40
+ };
41
+ var handleBlur = function handleBlur() {
42
+ if (popoverActive) {
43
+ handleClose();
44
+ }
45
+ };
46
+ var handleSelectClick = function handleSelectClick() {
47
+ setPopoverActive(!popoverActive);
48
+ };
49
+ var activatorSelectContextValue = {
50
+ allowMultiple: allowMultiple,
51
+ disabled: disabled,
52
+ hasError: hasError,
53
+ onSelectClick: handleSelectClick,
54
+ selectedValues: selectedValues
55
+ };
56
+ var activatorTextInputContextValue = {
57
+ disabled: disabled,
58
+ hasError: hasError,
59
+ onFocus: handleFocus,
60
+ onBlur: handleBlur
61
+ };
62
+ useEffect(function () {
63
+ if (listHeight) {
64
+ setOptionListHeight(listHeight + 24 + "px");
65
+ return;
66
+ }
67
+ if (scrollable) {
68
+ setOptionListHeight(296 + 24 + "px");
69
+ return;
70
+ }
71
+ }, [listHeight, scrollable]);
72
+ var activator = function activator() {
73
+ if (searchableProps) {
74
+ var inputValue = searchableProps.inputValue,
75
+ _onInputChange = searchableProps.onInputChange;
76
+ return /*#__PURE__*/React.createElement(ActivatorTextInputContext.Provider, {
77
+ value: activatorTextInputContextValue
78
+ }, /*#__PURE__*/React.createElement(ActivatorTextInput, {
79
+ value: inputValue,
80
+ onChange: _onInputChange,
81
+ placeholder: placeholder != null ? placeholder : 'Search',
82
+ width: width
83
+ }));
84
+ }
85
+ return /*#__PURE__*/React.createElement(ActivatorSelectContext.Provider, {
86
+ value: activatorSelectContextValue
87
+ }, /*#__PURE__*/React.createElement(ActivatorSelect, {
88
+ disabled: disabled,
89
+ placeholder: "Placeholder",
90
+ onRemoveTag: onRemoveTag,
91
+ width: width,
92
+ values: selectedValues
93
+ }));
94
+ };
95
+ return /*#__PURE__*/React.createElement(Popover, {
96
+ active: popoverActive,
97
+ activator: /*#__PURE__*/React.createElement(ActivatorWrapper, {
98
+ width: width
99
+ }, label && /*#__PURE__*/React.createElement(Label, null, label), activator(), helpText && /*#__PURE__*/React.createElement(HelpTextContainer, null, /*#__PURE__*/React.createElement(Typography, {
100
+ as: "span",
101
+ variant: "subtitle2",
102
+ color: disabled ? Neutral.B85 : Neutral.B40
103
+ }, helpText))),
104
+ onClose: handleClose,
105
+ autofocusTarget: "none",
106
+ preventFocusOnClose: true,
107
+ fullWidth: true
108
+ }, /*#__PURE__*/React.createElement(Popover.Pane, {
109
+ height: optionListHeight
110
+ }, /*#__PURE__*/React.createElement(OptionList, {
111
+ allowMultiple: allowMultiple,
112
+ onSelect: onSelect,
113
+ options: options,
114
+ sections: sections,
115
+ selectedValues: selectedValues,
116
+ width: width
117
+ })));
118
+ };
@@ -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,12 @@
1
+ import styled from 'styled-components';
2
+ import { space4 } from '../utilities/spacing';
3
+ export var HelpTextContainer = styled.div.withConfig({
4
+ displayName: "SelectStyle__HelpTextContainer",
5
+ componentId: "sc-c6sc8m-0"
6
+ })(["margin-top:", ";"], space4);
7
+ export var ActivatorWrapper = styled.div.withConfig({
8
+ displayName: "SelectStyle__ActivatorWrapper",
9
+ componentId: "sc-c6sc8m-1"
10
+ })(["display:flex;flex-direction:column;width:", ";"], function (props) {
11
+ return props.width;
12
+ });
@@ -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,17 @@
1
+ import { createContext, useContext } from 'react';
2
+ export var ActivatorSelectContext = /*#__PURE__*/createContext(undefined);
3
+ export var ActivatorTextInputContext = /*#__PURE__*/createContext(undefined);
4
+ export var useActivatorSelect = function useActivatorSelect() {
5
+ var context = useContext(ActivatorSelectContext);
6
+ if (!context) {
7
+ throw new Error('No ActivatorSelectContext was provided. Your component must be wrapped in a <ActivatorSelectContext.Provider>');
8
+ }
9
+ return context;
10
+ };
11
+ export var useActivatorTextInput = function useActivatorTextInput() {
12
+ var context = useContext(ActivatorTextInputContext);
13
+ if (!context) {
14
+ throw new Error('No ActivatorTextInputContext was provided. Your component must be wrapped in a <ActivatorTextInputContext.Provider>');
15
+ }
16
+ return context;
17
+ };
@@ -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;
@@ -0,0 +1,71 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["placeholder", "values", "onClick", "onRemoveTag", "width"];
4
+ import React, { useRef } from 'react';
5
+ import { Icon } from '../../../Icon';
6
+ import { Typography } from '../../../Typography';
7
+ import { Blue, Neutral } from '../../../utilities/colors';
8
+ import { useActivatorSelect } from './ActivatorContext';
9
+ import { StyledSelect, StyledTag, TagsContainer } from './ActivatorStyle';
10
+ export var ActivatorSelect = function ActivatorSelect(_ref) {
11
+ var placeholder = _ref.placeholder,
12
+ values = _ref.values,
13
+ onClick = _ref.onClick,
14
+ onRemoveTag = _ref.onRemoveTag,
15
+ width = _ref.width,
16
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
17
+ var activatorRef = useRef(null);
18
+ var filteredValues = values == null ? void 0 : values.filter(function (value) {
19
+ return value != '';
20
+ });
21
+ var hasValue = filteredValues.length > 0;
22
+ var activatorContext = useActivatorSelect();
23
+ var allowMultiple = activatorContext.allowMultiple,
24
+ disabled = activatorContext.disabled,
25
+ onSelectClick = activatorContext.onSelectClick,
26
+ hasError = activatorContext.hasError,
27
+ selectedValues = activatorContext.selectedValues;
28
+ var handleClick = function handleClick(e) {
29
+ e.preventDefault();
30
+ e.stopPropagation();
31
+ onSelectClick();
32
+ onClick;
33
+ };
34
+ var placeholderMarkup = /*#__PURE__*/React.createElement(Typography, {
35
+ variant: "body1",
36
+ as: "span",
37
+ color: disabled ? Neutral.B85 : Neutral.B40
38
+ }, placeholder);
39
+ var tagsMarkup = function tagsMarkup() {
40
+ var hasSelectedValues = selectedValues.length > 0;
41
+ if (!hasSelectedValues) {
42
+ return placeholderMarkup;
43
+ }
44
+ if (hasSelectedValues) {
45
+ return /*#__PURE__*/React.createElement(TagsContainer, null, /*#__PURE__*/React.createElement(StyledTag, {
46
+ key: "option-" + selectedValues[0],
47
+ onRemove: onRemoveTag({
48
+ option: selectedValues[0]
49
+ }),
50
+ textColor: Blue.S99
51
+ }, selectedValues[0]), selectedValues.length > 1 && /*#__PURE__*/React.createElement(Typography, {
52
+ variant: "caption",
53
+ color: disabled ? Neutral.B85 : Neutral.B40
54
+ }, "... and ", selectedValues.length - 1, " more"));
55
+ }
56
+ };
57
+ return /*#__PURE__*/React.createElement(StyledSelect, _extends({}, props, {
58
+ ref: activatorRef,
59
+ "data-error": hasError,
60
+ onClick: handleClick,
61
+ disabled: disabled,
62
+ width: width
63
+ }), allowMultiple ? tagsMarkup() : /*#__PURE__*/React.createElement(Typography, {
64
+ variant: "body1",
65
+ color: disabled ? Neutral.B85 : Neutral.B40
66
+ }, hasValue ? filteredValues[0] : placeholderMarkup), /*#__PURE__*/React.createElement(Icon, {
67
+ height: 24,
68
+ name: "ri-arrow-m-down-line",
69
+ fill: disabled ? Neutral.B85 : Neutral.B40
70
+ }));
71
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ActivatorSelectProps } from './ActivatorSelect';
3
+ export declare const StyledSelect: import("styled-components").StyledComponent<"button", any, ActivatorSelectProps, never>;
4
+ export declare const TagsContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const StyledTag: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../Tag").TagProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
6
+ export declare const StyledTextInput: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("../../../Input/Input").InputProps, "type" | "onChange"> & {
7
+ canClear?: boolean;
8
+ onChange?: (value: string) => void;
9
+ } & import("react").RefAttributes<HTMLInputElement>>, any, {}, never>;
@@ -0,0 +1,28 @@
1
+ import styled from 'styled-components';
2
+ import * as Breakpoints from '../../../utilities/breakpoints/Breakpoints';
3
+ import { borderRadius4 } from '../../../utilities/borderRadius';
4
+ import { Neutral, Red } from '../../../utilities/colors';
5
+ import { NotoSans } from '../../../utilities/fonts';
6
+ import { space8 } from '../../../utilities/spacing';
7
+ import { TextInput } from '../../../TextInput';
8
+ import { Tag } from '../../../Tag';
9
+ export var StyledSelect = styled.button.withConfig({
10
+ displayName: "ActivatorStyle__StyledSelect",
11
+ componentId: "sc-rui73p-0"
12
+ })(["display:flex;align-items:center;justify-content:space-between;height:36px;cursor:pointer;padding:0px 8px 0px 12px;border:1px solid ", ";box-shadow:0px 1px 0px rgba(0,0,0,0.05);border-radius:", ";background:", ";width:", ";color:", ";font-family:", ",sans-serif;font-weight:400;font-size:16px;line-height:150%;letter-spacing:0px;@media (max-width:", "){font-size:14px;}&:focus{outline:none;box-shadow:0px 0px 0px 1px #ffffff,0px 0px 0px 3px #6cc9ec;}&:disabled{background:", ";pointer-events:none;cursor:default;border:1px solid ", ";}&[data-error='true']{border:1px solid ", ";border-radius:", ";}"], Neutral.B68, borderRadius4, Neutral.B100, function (props) {
13
+ return props.width;
14
+ }, Neutral.B18, NotoSans, Breakpoints.large, Neutral.B95, Neutral.B85, Red.B93, borderRadius4);
15
+ export var TagsContainer = styled.div.withConfig({
16
+ displayName: "ActivatorStyle__TagsContainer",
17
+ componentId: "sc-rui73p-1"
18
+ })(["display:flex;justify-content:space-between;flex-direction:row;align-items:center;"]);
19
+ export var StyledTag = styled(Tag).withConfig({
20
+ displayName: "ActivatorStyle__StyledTag",
21
+ componentId: "sc-rui73p-2"
22
+ })(["height:28px;margin-right:", ";"], space8);
23
+ export var StyledTextInput = styled(TextInput).withConfig({
24
+ displayName: "ActivatorStyle__StyledTextInput",
25
+ componentId: "sc-rui73p-3"
26
+ })(["width:", ";"], function (props) {
27
+ return props.width;
28
+ });
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { TextInputProps } from '../../../TextInput';
3
+ export interface ActivatorTextInputProps extends Omit<TextInputProps, 'onChange'> {
4
+ hasError?: boolean;
5
+ onChange?(value: string): void;
6
+ width?: string;
7
+ }
8
+ export declare const ActivatorTextInput: ({ onChange, value, width, ...props }: ActivatorTextInputProps) => JSX.Element;
@@ -0,0 +1,38 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["onChange", "value", "width"];
4
+ import React, { useRef } from 'react';
5
+ import { Icon } from '../../../Icon';
6
+ import { useActivatorTextInput } from './ActivatorContext';
7
+ import { StyledTextInput } from './ActivatorStyle';
8
+ export var ActivatorTextInput = function ActivatorTextInput(_ref) {
9
+ var onChange = _ref.onChange,
10
+ value = _ref.value,
11
+ width = _ref.width,
12
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
13
+ var activatorRef = useRef(null);
14
+ var activatorContext = useActivatorTextInput();
15
+ var disabled = activatorContext.disabled,
16
+ onFocus = activatorContext.onFocus,
17
+ hasError = activatorContext.hasError;
18
+ var handleChange = function handleChange(_ref2) {
19
+ var value = _ref2.value;
20
+ if (onChange) onChange(value);
21
+ };
22
+ return /*#__PURE__*/React.createElement(StyledTextInput, _extends({}, props, {
23
+ ref: activatorRef,
24
+ prefix: /*#__PURE__*/React.createElement(Icon, {
25
+ name: "ri-search"
26
+ }),
27
+ value: value,
28
+ onChange: function onChange(value) {
29
+ return handleChange({
30
+ value: value
31
+ });
32
+ },
33
+ onFocus: onFocus,
34
+ error: hasError,
35
+ disabled: disabled,
36
+ width: width
37
+ }));
38
+ };
@@ -0,0 +1,2 @@
1
+ export { ActivatorTextInput } from './ActivatorTextInput';
2
+ export { ActivatorSelect } from './ActivatorSelect';
@@ -0,0 +1,2 @@
1
+ export { ActivatorTextInput } from './ActivatorTextInput';
2
+ export { ActivatorSelect } from './ActivatorSelect';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const Label: ({ children }: {
3
+ children: React.ReactNode;
4
+ }) => JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Typography } from '../../../Typography';
3
+ import { Neutral } from '../../../utilities/colors';
4
+ export var Label = function Label(_ref) {
5
+ var children = _ref.children;
6
+ return /*#__PURE__*/React.createElement(Typography, {
7
+ as: "span",
8
+ variant: "subtitle2",
9
+ color: Neutral.B18
10
+ }, children);
11
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { MenuProps } from '../../../Menu';
3
+ export interface OptionListProps extends MenuProps {
4
+ isEmpty?: boolean;
5
+ noOptionsMessage?: React.ReactNode;
6
+ onSelect?({ value }: {
7
+ value: string;
8
+ }): void;
9
+ width?: string;
10
+ }
11
+ export interface NoOptionListProps {
12
+ noOptionsMessage?: React.ReactNode;
13
+ }
14
+ export declare const NoOptionList: ({ noOptionsMessage, }: NoOptionListProps) => JSX.Element;
15
+ export declare const OptionList: ({ allowMultiple, noOptionsMessage, onSelect, options, sections, selectedValues, title, width, }: OptionListProps) => JSX.Element;
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { Menu } from '../../../Menu';
3
+ import { Typography } from '../../../Typography';
4
+ import { Neutral } from '../../../utilities/colors';
5
+ import { EmptyOptionContainer, OptionListContainer } from './OptionListStyle';
6
+ export var NoOptionList = function NoOptionList(_ref) {
7
+ var _ref$noOptionsMessage = _ref.noOptionsMessage,
8
+ noOptionsMessage = _ref$noOptionsMessage === void 0 ? 'No matching results' : _ref$noOptionsMessage;
9
+ return /*#__PURE__*/React.createElement(EmptyOptionContainer, null, /*#__PURE__*/React.createElement(Typography, {
10
+ as: "span",
11
+ variant: "body2",
12
+ color: Neutral.B40
13
+ }, noOptionsMessage));
14
+ };
15
+ export var OptionList = function OptionList(_ref2) {
16
+ var allowMultiple = _ref2.allowMultiple,
17
+ noOptionsMessage = _ref2.noOptionsMessage,
18
+ onSelect = _ref2.onSelect,
19
+ options = _ref2.options,
20
+ sections = _ref2.sections,
21
+ selectedValues = _ref2.selectedValues,
22
+ title = _ref2.title,
23
+ width = _ref2.width;
24
+ var hasOptions = options.length > 0;
25
+ var onOptionSelect = function onOptionSelect(_ref3) {
26
+ var value = _ref3.value;
27
+ if (onSelect) {
28
+ onSelect({
29
+ value: value
30
+ });
31
+ return;
32
+ }
33
+ };
34
+ return /*#__PURE__*/React.createElement(OptionListContainer, {
35
+ width: width
36
+ }, hasOptions ? /*#__PURE__*/React.createElement(Menu, {
37
+ allowMultiple: allowMultiple,
38
+ options: options,
39
+ onClick: onOptionSelect,
40
+ sections: sections,
41
+ selectedValues: selectedValues,
42
+ title: title
43
+ }) : /*#__PURE__*/React.createElement(NoOptionList, {
44
+ noOptionsMessage: noOptionsMessage
45
+ }));
46
+ };
@@ -0,0 +1,6 @@
1
+ interface OptionListContainerProps {
2
+ width?: string;
3
+ }
4
+ export declare const OptionListContainer: import("styled-components").StyledComponent<"div", any, OptionListContainerProps, never>;
5
+ export declare const EmptyOptionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ import styled from 'styled-components';
2
+ import { space8 } from '../../../utilities/spacing';
3
+ export var OptionListContainer = styled.div.withConfig({
4
+ displayName: "OptionListStyle__OptionListContainer",
5
+ componentId: "sc-1ytfzi1-0"
6
+ })(["width:", ";padding:", " 0;"], function (props) {
7
+ return props.width;
8
+ }, space8);
9
+ export var EmptyOptionContainer = styled.div.withConfig({
10
+ displayName: "OptionListStyle__EmptyOptionContainer",
11
+ componentId: "sc-1ytfzi1-1"
12
+ })(["display:flex;align-items:center;justify-content:center;margin:10px 0;"]);
@@ -0,0 +1 @@
1
+ export { OptionList } from './OptionList';
@@ -0,0 +1 @@
1
+ export { OptionList } from './OptionList';
@@ -0,0 +1,2 @@
1
+ export { ActivatorSelect, ActivatorTextInput } from './Activator';
2
+ export * from './OptionList';
@@ -0,0 +1,2 @@
1
+ export { ActivatorSelect, ActivatorTextInput } from './Activator';
2
+ export * from './OptionList';
@@ -0,0 +1,2 @@
1
+ export * from './Select';
2
+ export * from './components';
@@ -0,0 +1,2 @@
1
+ export * from './Select';
2
+ export * from './components';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { SelectProps } from '../Select';
3
+ export declare const NonSearchableMultiSelect: ({ options, disabled, ...args }: SelectProps) => JSX.Element;
@@ -0,0 +1,40 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["options", "disabled"];
4
+ import React, { useState } from 'react';
5
+ import { Select } from '../Select';
6
+ export var NonSearchableMultiSelect = function NonSearchableMultiSelect(_ref) {
7
+ var options = _ref.options,
8
+ disabled = _ref.disabled,
9
+ args = _objectWithoutPropertiesLoose(_ref, _excluded);
10
+ var _useState = useState([]),
11
+ selected = _useState[0],
12
+ setSelected = _useState[1];
13
+ var handleSelect = function handleSelect(_ref2) {
14
+ var value = _ref2.value;
15
+ if (!selected.includes(value)) {
16
+ setSelected([].concat(selected, [value]));
17
+ return;
18
+ }
19
+ setSelected(selected.filter(function (option) {
20
+ return option !== value;
21
+ }));
22
+ };
23
+ var removeTag = function removeTag(_ref3) {
24
+ var option = _ref3.option;
25
+ return function (e) {
26
+ e.stopPropagation();
27
+ var options = [].concat(selected);
28
+ options.splice(options.indexOf(option), 1);
29
+ setSelected(options);
30
+ };
31
+ };
32
+ return /*#__PURE__*/React.createElement(Select, _extends({}, args, {
33
+ disabled: disabled,
34
+ onRemoveTag: removeTag,
35
+ options: options,
36
+ onSelect: handleSelect,
37
+ selectedValues: selected,
38
+ width: "400px"
39
+ }));
40
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { SelectProps } from '../Select';
3
+ export declare const SingleSelect: ({ options, allowMultiple, disabled, ...args }: SelectProps) => JSX.Element;
@@ -0,0 +1,27 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["options", "allowMultiple", "disabled"];
4
+ import React, { useState } from 'react';
5
+ import { Select } from '../Select';
6
+ export var SingleSelect = function SingleSelect(_ref) {
7
+ var options = _ref.options,
8
+ allowMultiple = _ref.allowMultiple,
9
+ disabled = _ref.disabled,
10
+ args = _objectWithoutPropertiesLoose(_ref, _excluded);
11
+ var _useState = useState(''),
12
+ selected = _useState[0],
13
+ setSelected = _useState[1];
14
+ var handleSelect = function handleSelect(_ref2) {
15
+ var value = _ref2.value;
16
+ setSelected(value);
17
+ };
18
+ return /*#__PURE__*/React.createElement(Select, _extends({}, args, {
19
+ allowMultiple: allowMultiple,
20
+ disabled: disabled,
21
+ options: options,
22
+ onSelect: handleSelect,
23
+ selectedValues: [selected],
24
+ width: "400px",
25
+ label: "Label"
26
+ }));
27
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { Option } from '../../Menu';
3
+ interface SearchableProps {
4
+ data?: Option[];
5
+ }
6
+ export declare const SearchableSelect: ({ data, ...args }: SearchableProps) => JSX.Element;
7
+ export {};