glints-aries 4.0.239 → 4.0.241

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 (64) hide show
  1. package/README.md +20 -1
  2. package/es/@next/Alert/AlertStyle.js +1 -1
  3. package/es/@next/Avatar/AvatarStyle.js +1 -1
  4. package/es/@next/Badge/BadgeStyle.js +1 -1
  5. package/es/@next/Banner/BannerStyle.js +1 -1
  6. package/es/@next/Input/InputStyle.d.ts +1 -2
  7. package/es/@next/Input/InputStyle.js +3 -1
  8. package/es/@next/Menu/components/MenuOption.js +5 -6
  9. package/es/@next/Select/Select.d.ts +4 -2
  10. package/es/@next/Select/Select.js +68 -45
  11. package/es/@next/Select/Select.stories.d.ts +1 -0
  12. package/es/@next/Select/components/Activator/ActivatorSelect.d.ts +5 -2
  13. package/es/@next/Select/components/Activator/ActivatorSelect.js +9 -10
  14. package/es/@next/Select/components/Activator/ActivatorTextInput.d.ts +16 -2
  15. package/es/@next/Select/components/Activator/ActivatorTextInput.js +57 -13
  16. package/es/@next/Select/components/OptionList/OptionList.d.ts +6 -2
  17. package/es/@next/Select/components/OptionList/OptionList.js +20 -7
  18. package/es/@next/Select/components/SearchableSelectInput/ClearSelected.d.ts +9 -0
  19. package/es/@next/Select/components/SearchableSelectInput/ClearSelected.js +22 -0
  20. package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInput.d.ts +36 -0
  21. package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInput.js +121 -0
  22. package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.d.ts +4 -0
  23. package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.js +30 -0
  24. package/es/@next/Select/selectStoryHelper/Searchable.js +2 -25
  25. package/es/@next/Select/selectStoryHelper/SearchableSingleSelect.d.ts +7 -0
  26. package/es/@next/Select/selectStoryHelper/SearchableSingleSelect.js +24 -0
  27. package/es/@next/utilities/colors/orange.d.ts +1 -1
  28. package/es/@next/utilities/colors/orange.js +1 -1
  29. package/es/@next/utilities/colors/red.d.ts +2 -2
  30. package/es/@next/utilities/colors/red.js +2 -2
  31. package/lib/@next/Alert/AlertStyle.js +1 -1
  32. package/lib/@next/Avatar/AvatarStyle.js +1 -1
  33. package/lib/@next/Badge/BadgeStyle.js +1 -1
  34. package/lib/@next/Banner/BannerStyle.js +1 -1
  35. package/lib/@next/Input/InputStyle.d.ts +1 -2
  36. package/lib/@next/Input/InputStyle.js +3 -1
  37. package/lib/@next/Menu/components/MenuOption.js +5 -6
  38. package/lib/@next/Select/Select.d.ts +4 -2
  39. package/lib/@next/Select/Select.js +67 -44
  40. package/lib/@next/Select/Select.stories.d.ts +1 -0
  41. package/lib/@next/Select/components/Activator/ActivatorSelect.d.ts +5 -2
  42. package/lib/@next/Select/components/Activator/ActivatorSelect.js +9 -10
  43. package/lib/@next/Select/components/Activator/ActivatorTextInput.d.ts +16 -2
  44. package/lib/@next/Select/components/Activator/ActivatorTextInput.js +56 -12
  45. package/lib/@next/Select/components/OptionList/OptionList.d.ts +6 -2
  46. package/lib/@next/Select/components/OptionList/OptionList.js +22 -8
  47. package/lib/@next/Select/components/SearchableSelectInput/ClearSelected.d.ts +9 -0
  48. package/lib/@next/Select/components/SearchableSelectInput/ClearSelected.js +28 -0
  49. package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInput.d.ts +36 -0
  50. package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInput.js +129 -0
  51. package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.d.ts +4 -0
  52. package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInputStyle.js +41 -0
  53. package/lib/@next/Select/selectStoryHelper/Searchable.js +1 -24
  54. package/lib/@next/Select/selectStoryHelper/SearchableSingleSelect.d.ts +7 -0
  55. package/lib/@next/Select/selectStoryHelper/SearchableSingleSelect.js +32 -0
  56. package/lib/@next/utilities/colors/orange.d.ts +1 -1
  57. package/lib/@next/utilities/colors/orange.js +3 -3
  58. package/lib/@next/utilities/colors/red.d.ts +2 -2
  59. package/lib/@next/utilities/colors/red.js +2 -2
  60. package/package.json +1 -1
  61. package/es/@next/Select/components/Activator/ActivatorContext.d.ts +0 -17
  62. package/es/@next/Select/components/Activator/ActivatorContext.js +0 -17
  63. package/lib/@next/Select/components/Activator/ActivatorContext.d.ts +0 -17
  64. package/lib/@next/Select/components/Activator/ActivatorContext.js +0 -25
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { InputProps } from '../../../Input/Input';
3
+ import { Option } from '../../../Menu';
4
+ export interface SearchableSelectState {
5
+ showSelected: boolean;
6
+ showInput: boolean;
7
+ showPlaceholder: boolean;
8
+ }
9
+ export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onChange' | 'onSelect'> & {
10
+ canClear?: boolean;
11
+ filterOptions?: (str: string) => Option[];
12
+ onSelect?({ value }: {
13
+ value: string;
14
+ }): void;
15
+ selectedValue?: string;
16
+ inputValue?: string;
17
+ updateInputValue?: (newValue: string) => void;
18
+ searchableSelectState?: SearchableSelectState;
19
+ updateSearchableSelectState?: (newState: SearchableSelectState) => void;
20
+ options?: Option[];
21
+ updateMenuOptions?: (newState: Option[]) => void;
22
+ };
23
+ export declare const SearchableSelectInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange" | "onSelect"> & {
24
+ canClear?: boolean;
25
+ filterOptions?: (str: string) => Option[];
26
+ onSelect?({ value }: {
27
+ value: string;
28
+ }): void;
29
+ selectedValue?: string;
30
+ inputValue?: string;
31
+ updateInputValue?: (newValue: string) => void;
32
+ searchableSelectState?: SearchableSelectState;
33
+ updateSearchableSelectState?: (newState: SearchableSelectState) => void;
34
+ options?: Option[];
35
+ updateMenuOptions?: (newState: Option[]) => void;
36
+ } & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,121 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
4
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
5
+ import { StyledInput, StyledPrefixContainer } from '../../../Input/InputStyle';
6
+ import { ClearSelected } from './ClearSelected';
7
+ import { InputContainer, StyledContainer, StyledSelectedValue } from './SearchableSelectInputStyle';
8
+ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSelectInput(_ref, ref) {
9
+ var _ref$disabled = _ref.disabled,
10
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
11
+ error = _ref.error,
12
+ filterOptions = _ref.filterOptions,
13
+ onSelect = _ref.onSelect,
14
+ placeholder = _ref.placeholder,
15
+ prefix = _ref.prefix,
16
+ selectedValue = _ref.selectedValue,
17
+ width = _ref.width,
18
+ inputValue = _ref.inputValue,
19
+ updateInputValue = _ref.updateInputValue,
20
+ onFocus = _ref.onFocus,
21
+ _ref$searchableSelect = _ref.searchableSelectState,
22
+ showInput = _ref$searchableSelect.showInput,
23
+ showPlaceholder = _ref$searchableSelect.showPlaceholder,
24
+ showSelected = _ref$searchableSelect.showSelected,
25
+ updateSearchableSelectState = _ref.updateSearchableSelectState,
26
+ options = _ref.options,
27
+ updateMenuOptions = _ref.updateMenuOptions,
28
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
29
+ var inputRef = useRef(null);
30
+ var _useState = useState(false),
31
+ showClear = _useState[0],
32
+ setShowClear = _useState[1];
33
+ var _useState2 = useState(false),
34
+ isSelectedClicked = _useState2[0],
35
+ setIsSelectedClicked = _useState2[1];
36
+ var handleFocus = function handleFocus(e) {
37
+ setIsSelectedClicked(false);
38
+ setShowClear(false);
39
+ onFocus(e);
40
+ };
41
+ var handleClearIconClick = function handleClearIconClick() {
42
+ setShowClear(false);
43
+ updateSearchableSelectState({
44
+ showSelected: false,
45
+ showPlaceholder: true,
46
+ showInput: true
47
+ });
48
+ updateMenuOptions(options);
49
+ };
50
+ var handleInputChange = function handleInputChange(e) {
51
+ var str = e.currentTarget.value;
52
+ updateInputValue(str);
53
+ var filteredOptions = filterOptions(str);
54
+ updateMenuOptions(filteredOptions);
55
+ updateSearchableSelectState({
56
+ showSelected: false,
57
+ showInput: true,
58
+ showPlaceholder: false
59
+ });
60
+ };
61
+ var handleSelectedClick = function handleSelectedClick(e) {
62
+ e.stopPropagation();
63
+ setIsSelectedClicked(true);
64
+ updateSearchableSelectState({
65
+ showSelected: true,
66
+ showInput: true,
67
+ showPlaceholder: false
68
+ });
69
+ updateInputValue('');
70
+ updateMenuOptions(options);
71
+ };
72
+ var handleInputBlur = function handleInputBlur() {
73
+ setIsSelectedClicked(false);
74
+ if (selectedValue) {
75
+ // allow onClick event handler in Menu before onBlur of input
76
+ setTimeout(function () {
77
+ setShowClear(true);
78
+ updateSearchableSelectState({
79
+ showSelected: true,
80
+ showInput: false,
81
+ showPlaceholder: false
82
+ });
83
+ }, 100);
84
+ }
85
+ };
86
+ useEffect(function () {
87
+ if (isSelectedClicked && showInput) {
88
+ inputRef.current.focus();
89
+ }
90
+ return;
91
+ }, [isSelectedClicked, showInput]);
92
+ useEffect(function () {
93
+ if (selectedValue) {
94
+ setShowClear(true);
95
+ return;
96
+ }
97
+ setShowClear(false);
98
+ }, [selectedValue]);
99
+ return /*#__PURE__*/React.createElement(StyledContainer, {
100
+ ref: ref,
101
+ "data-error": error,
102
+ "data-disabled": disabled,
103
+ prefixWidth: 37,
104
+ suffixWidth: 33,
105
+ width: width
106
+ }, /*#__PURE__*/React.createElement(StyledPrefixContainer, null, prefix), showSelected && /*#__PURE__*/React.createElement(StyledSelectedValue, {
107
+ className: "searchable-select",
108
+ onClick: handleSelectedClick
109
+ }, selectedValue), showInput && /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement(StyledInput, _extends({
110
+ ref: inputRef,
111
+ onChange: handleInputChange,
112
+ placeholder: showPlaceholder ? placeholder : null,
113
+ value: inputValue,
114
+ onBlur: handleInputBlur,
115
+ onFocus: handleFocus
116
+ }, props))), showClear && /*#__PURE__*/React.createElement(ClearSelected, {
117
+ onSelect: onSelect,
118
+ handleClearIconClick: handleClearIconClick,
119
+ updateInputValue: updateInputValue
120
+ }));
121
+ });
@@ -0,0 +1,4 @@
1
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", any, import("../../../Input/Input").InputProps & import("../../../Input/InputStyle").PreffixSuffixWidthProps, never>;
2
+ export declare const StyledSelectedValue: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const InputContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const ClearSelectedContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,30 @@
1
+ import styled from 'styled-components';
2
+ import * as Breakpoints from '../../../utilities/breakpoints';
3
+ import { Neutral, Red } from '../../../utilities/colors';
4
+ import { NotoSans } from '../../../utilities/fonts';
5
+ import { StyledContainer as StyledInputContainer, StyledSuffixContainer } from '../../../Input/InputStyle';
6
+ import { borderRadius4 } from '../../../utilities/borderRadius';
7
+ export var StyledContainer = styled(StyledInputContainer).withConfig({
8
+ displayName: "SearchableSelectInputStyle__StyledContainer",
9
+ componentId: "sc-1oj168h-0"
10
+ })(["position:relative;height:36px;width:", ";background:", ";box-shadow:0px 1px 0px rgba(0,0,0,0.05);box-sizing:border-box;display:grid;input{background:transparent;z-index:1;width:", ";}&:has(> div > input:focus) > .searchable-select{color:", ";}.searchable-select,input{padding-left:", "px;padding-right:", "px;}&[data-error='true'] .searchable-select{border:1px solid ", ";}&[data-error='true'] .searchable-select:focus{box-shadow:none;}&[data-disabled='true'] .searchable-select{border:1px solid ", ";background:", ";color:", ";}"], function (props) {
11
+ return props.width;
12
+ }, Neutral.B100, function (props) {
13
+ return props.width;
14
+ }, Neutral.B40, function (props) {
15
+ return props.prefixWidth;
16
+ }, function (props) {
17
+ return props.suffixWidth;
18
+ }, Red.B93, Neutral.B85, Neutral.B95, Neutral.B85);
19
+ export var StyledSelectedValue = styled.div.withConfig({
20
+ displayName: "SearchableSelectInputStyle__StyledSelectedValue",
21
+ componentId: "sc-1oj168h-1"
22
+ })(["border:1px solid ", ";border-radius:", ";background:transparent;box-sizing:border-box;padding:0 12px;height:36px;display:flex;align-items:center;grid-column:1 / 1;grid-row:1 / 1;font-family:", ",sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:150%;color:", ";@media (max-width:", "){font-size:14px;}"], Neutral.B68, borderRadius4, NotoSans, Neutral.B18, Breakpoints.large);
23
+ export var InputContainer = styled.div.withConfig({
24
+ displayName: "SearchableSelectInputStyle__InputContainer",
25
+ componentId: "sc-1oj168h-2"
26
+ })(["grid-column:1 / 1;grid-row:1 / 1;"]);
27
+ export var ClearSelectedContainer = styled(StyledSuffixContainer).withConfig({
28
+ displayName: "SearchableSelectInputStyle__ClearSelectedContainer",
29
+ componentId: "sc-1oj168h-3"
30
+ })(["z-index:2;"]);
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["data"];
4
- import React, { useEffect, useState } from 'react';
4
+ import React, { useState } from 'react';
5
5
  import { Blue } from '../../utilities/colors';
6
6
  import { space8 } from '../../utilities/spacing';
7
7
  import { Select } from '../Select';
@@ -15,23 +15,8 @@ export var SearchableSelect = function SearchableSelect(_ref) {
15
15
  var _useState2 = useState([]),
16
16
  selectedOptions = _useState2[0],
17
17
  setSelectedOptions = _useState2[1];
18
- var _useState3 = useState(false),
19
- isSearchEmpty = _useState3[0],
20
- setIsSearchEmpty = _useState3[1];
21
- var _useState4 = useState(data),
22
- options = _useState4[0],
23
- setOptions = _useState4[1];
24
18
  var handleInputChange = function handleInputChange(value) {
25
19
  setInputValue(value);
26
- if (value === '') {
27
- setOptions(data);
28
- return;
29
- }
30
- var filterRegex = new RegExp(value, 'i');
31
- var filterOptions = options.filter(function (option) {
32
- return option.label.match(filterRegex);
33
- });
34
- setOptions(filterOptions);
35
20
  };
36
21
  var handleSelect = function handleSelect(_ref2) {
37
22
  var value = _ref2.value;
@@ -57,17 +42,9 @@ export var SearchableSelect = function SearchableSelect(_ref) {
57
42
  textColor: Blue.S99
58
43
  }, option);
59
44
  });
60
- useEffect(function () {
61
- if (options.length === 0) {
62
- setIsSearchEmpty(true);
63
- }
64
- if (options.length > 0 && isSearchEmpty === true) {
65
- setIsSearchEmpty(false);
66
- }
67
- }, [isSearchEmpty, options]);
68
45
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, _extends({}, args, {
69
46
  onSelect: handleSelect,
70
- options: options,
47
+ options: data,
71
48
  selectedValues: selectedOptions,
72
49
  width: "600px",
73
50
  searchableProps: {
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { Option } from '../../Menu';
3
+ interface SearchableSingleSelectProps {
4
+ data?: Option[];
5
+ }
6
+ export declare const SearchableSingle: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,24 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["data"];
4
+ import React, { useState } from 'react';
5
+ import { Select } from '../Select';
6
+ export var SearchableSingle = function SearchableSingle(_ref) {
7
+ var data = _ref.data,
8
+ args = _objectWithoutPropertiesLoose(_ref, _excluded);
9
+ var _useState = useState(''),
10
+ selected = _useState[0],
11
+ setSelected = _useState[1];
12
+ var handleSelect = function handleSelect(_ref2) {
13
+ var value = _ref2.value;
14
+ setSelected(value);
15
+ };
16
+ return /*#__PURE__*/React.createElement(Select, _extends({}, args, {
17
+ onSelect: handleSelect,
18
+ options: data,
19
+ selectedValues: [selected],
20
+ width: "600px",
21
+ searchable: true,
22
+ label: "Label"
23
+ }));
24
+ };
@@ -1,5 +1,5 @@
1
1
  export declare const Brand = "#F06730";
2
- export declare const S42 = "#FAD491";
2
+ export declare const S21 = "#FCE9C8";
3
3
  export declare const S64 = "#F7BD59";
4
4
  export declare const S86 = "#F5A623";
5
5
  export declare const S87 = "#F48620";
@@ -1,5 +1,5 @@
1
1
  export var Brand = '#F06730';
2
- export var S42 = '#FAD491';
2
+ export var S21 = '#FCE9C8';
3
3
  export var S64 = '#F7BD59';
4
4
  export var S86 = '#F5A623';
5
5
  export var S87 = '#F48620';
@@ -1,6 +1,6 @@
1
1
  export declare const Brand = "#EC272B";
2
- export declare const B100 = "#FFC7C2";
3
- export declare const B99 = "#FC6568";
2
+ export declare const B100 = "#FFE5E6";
3
+ export declare const B99 = "#FCCACB";
4
4
  export declare const B93 = "#EC272B";
5
5
  export declare const B74 = "#BD3638";
6
6
  export declare const B65 = "#8F393B";
@@ -1,6 +1,6 @@
1
1
  export var Brand = '#EC272B';
2
- export var B100 = '#FFC7C2';
3
- export var B99 = '#FC6568';
2
+ export var B100 = '#FFE5E6';
3
+ export var B99 = '#FCCACB';
4
4
  export var B93 = '#EC272B';
5
5
  export var B74 = '#BD3638';
6
6
  export var B65 = '#8F393B';
@@ -13,7 +13,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
13
13
  var StyledAlertContainer = _styledComponents["default"].div.withConfig({
14
14
  displayName: "AlertStyle__StyledAlertContainer",
15
15
  componentId: "sc-1e5i2kj-0"
16
- })(["position:fixed;top:90px;right:24px;display:flex;padding:", ";gap:", ";max-width:640px;width:fit-content;border-radius:", ";box-shadow:0px 8px 20px rgba(71,71,71,0.2),0px 3px 6px -3px rgba(71,71,71,0.08);animation:slide-from-right 400ms cubic-bezier(0.35,0.8,1,0.86);z-index:100;color:", ";svg{display:block;height:24px;width:24px;}&[data-titled='true'] svg{margin-top:3px;}&[data-status='success']{background:", ";}&[data-status='success'] svg{fill:", ";}&[data-status='info']{background:", ";}&[data-status='info'] svg{fill:", ";}&[data-status='warning']{background:", ";}&[data-status='warning'] svg{fill:", ";}&[data-status='error']{background:", ";}&[data-status='error'] svg{fill:", ";}@media (max-width:", "){top:60px;&[data-titled='true']{margin-top:-1px;}&[data-titled='true'] svg{margin-top:0;}padding:", ";min-height:37px;}@media (max-width:480px){&[data-titled='true']{margin-top:-1px;}&[data-titled='true'] svg{margin-top:0;}max-width:calc(100vw - 48px);}@keyframes slide-from-right{0%{transform:translateX(50px);}50%{transform:translateX(0px);}75%{transform:translateX(-10px);}100%{transform:translateX(0px);}}"], _spacing.space12, _spacing.space8, _borderRadius.borderRadius4, _colors.Neutral.B18, _colors.Green.B89, _colors.Green.B61, _colors.Blue.S08, _colors.Blue.Brand, _colors.Orange.S42, _colors.Orange.S86, _colors.Red.B100, _colors.Red.B93, Breakpoints.large, _spacing.space8);
16
+ })(["position:fixed;top:90px;right:24px;display:flex;padding:", ";gap:", ";max-width:640px;width:fit-content;border-radius:", ";box-shadow:0px 8px 20px rgba(71,71,71,0.2),0px 3px 6px -3px rgba(71,71,71,0.08);animation:slide-from-right 400ms cubic-bezier(0.35,0.8,1,0.86);z-index:100;color:", ";svg{display:block;height:24px;width:24px;}&[data-titled='true'] svg{margin-top:3px;}&[data-status='success']{background:", ";}&[data-status='success'] svg{fill:", ";}&[data-status='info']{background:", ";}&[data-status='info'] svg{fill:", ";}&[data-status='warning']{background:", ";}&[data-status='warning'] svg{fill:", ";}&[data-status='error']{background:", ";}&[data-status='error'] svg{fill:", ";}@media (max-width:", "){top:60px;&[data-titled='true']{margin-top:-1px;}&[data-titled='true'] svg{margin-top:0;}padding:", ";min-height:37px;}@media (max-width:480px){&[data-titled='true']{margin-top:-1px;}&[data-titled='true'] svg{margin-top:0;}max-width:calc(100vw - 48px);}@keyframes slide-from-right{0%{transform:translateX(50px);}50%{transform:translateX(0px);}75%{transform:translateX(-10px);}100%{transform:translateX(0px);}}"], _spacing.space12, _spacing.space8, _borderRadius.borderRadius4, _colors.Neutral.B18, _colors.Green.B89, _colors.Green.B61, _colors.Blue.S08, _colors.Blue.S99, _colors.Orange.S21, _colors.Orange.S86, _colors.Red.B100, _colors.Red.B93, Breakpoints.large, _spacing.space8);
17
17
  exports.StyledAlertContainer = StyledAlertContainer;
18
18
  var StyledAlertCloseIconContainer = _styledComponents["default"].div.withConfig({
19
19
  displayName: "AlertStyle__StyledAlertCloseIconContainer",
@@ -11,7 +11,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
11
11
  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; }
12
12
  var mediumAvatarSizeStyle = "\n width: 40px;\n height: 40px;\n \n @media (max-width: " + Breakpoints.large + ") {\n width: 32px;\n height: 32px;\n }\n";
13
13
  var largeAvatarSizeStyle = "\n width: 60px;\n height: 60px;\n\n @media (max-width: " + Breakpoints.large + ") {\n width: 40px;\n height: 40px;\n }\n";
14
- var avatarBackgroundColor = (_avatarBackgroundColo = {}, _avatarBackgroundColo['supplementary'] = _colors.Neutral.B99, _avatarBackgroundColo['warning'] = _colors.Orange.S42, _avatarBackgroundColo['danger'] = _colors.Red.B100, _avatarBackgroundColo['success'] = _colors.Green.B89, _avatarBackgroundColo['outstanding'] = _colors.Blue.S08, _avatarBackgroundColo);
14
+ var avatarBackgroundColor = (_avatarBackgroundColo = {}, _avatarBackgroundColo['supplementary'] = _colors.Neutral.B99, _avatarBackgroundColo['warning'] = _colors.Orange.S21, _avatarBackgroundColo['danger'] = _colors.Red.B100, _avatarBackgroundColo['success'] = _colors.Green.B89, _avatarBackgroundColo['outstanding'] = _colors.Blue.S08, _avatarBackgroundColo);
15
15
  var avatarSizeVariant = (_avatarSizeVariant = {}, _avatarSizeVariant['large'] = largeAvatarSizeStyle, _avatarSizeVariant['medium'] = mediumAvatarSizeStyle, _avatarSizeVariant);
16
16
  var getAvatarBackgroundColor = function getAvatarBackgroundColor(variant) {
17
17
  if (!(variant in avatarBackgroundColor)) {
@@ -8,7 +8,7 @@ var _borderRadius = require("../utilities/borderRadius");
8
8
  var _colors = require("../utilities/colors");
9
9
  var _spacing = require("../utilities/spacing");
10
10
  var _badgeBackgroundColor, _badgeTextColor;
11
- var badgeBackgroundColor = (_badgeBackgroundColor = {}, _badgeBackgroundColor['neutral'] = _colors.Neutral.B95, _badgeBackgroundColor['success'] = _colors.Green.B89, _badgeBackgroundColor['information'] = _colors.Blue.S08, _badgeBackgroundColor['warning'] = _colors.Orange.S42, _badgeBackgroundColor['critical'] = _colors.Red.B100, _badgeBackgroundColor['promotion'] = _colors.Yellow.S75, _badgeBackgroundColor['enticing'] = _colors.Orange.S87, _badgeBackgroundColor['attention'] = _colors.Red.B93, _badgeBackgroundColor);
11
+ var badgeBackgroundColor = (_badgeBackgroundColor = {}, _badgeBackgroundColor['neutral'] = _colors.Neutral.B95, _badgeBackgroundColor['success'] = _colors.Green.B89, _badgeBackgroundColor['information'] = _colors.Blue.S08, _badgeBackgroundColor['warning'] = _colors.Orange.S21, _badgeBackgroundColor['critical'] = _colors.Red.B100, _badgeBackgroundColor['promotion'] = _colors.Yellow.S75, _badgeBackgroundColor['enticing'] = _colors.Orange.S87, _badgeBackgroundColor['attention'] = _colors.Red.B93, _badgeBackgroundColor);
12
12
  var badgeTextColor = (_badgeTextColor = {}, _badgeTextColor['neutral'] = _colors.Neutral.B18, _badgeTextColor['success'] = _colors.Neutral.B18, _badgeTextColor['information'] = _colors.Neutral.B18, _badgeTextColor['warning'] = _colors.Neutral.B18, _badgeTextColor['critical'] = _colors.Neutral.B18, _badgeTextColor['promotion'] = _colors.Neutral.B18, _badgeTextColor['enticing'] = _colors.Neutral.B100, _badgeTextColor['attention'] = _colors.Neutral.B100, _badgeTextColor);
13
13
  exports.badgeTextColor = badgeTextColor;
14
14
  var getBadgeBackgroundColor = function getBadgeBackgroundColor(status) {
@@ -18,7 +18,7 @@ exports.StyledCloseIconWrapper = StyledCloseIconWrapper;
18
18
  var StyledBanner = _styledComponents["default"].div.withConfig({
19
19
  displayName: "BannerStyle__StyledBanner",
20
20
  componentId: "sc-1suv683-1"
21
- })(["min-height:100px;padding:20px;background:", ";color:", ";border:1px solid ", ";border-radius:", ";svg{position:absolute;fill:", ";height:24px;width:24px;top:0;}&[data-titled='true'] svg{top:3px;}&[data-status='success']{background:", ";border:1px solid ", ";}&[data-status='success'] svg{fill:", ";}&[data-status='info']{background:", ";border:1px solid ", ";}&[data-status='info'] svg{fill:", ";}&[data-status='warning']{background:", ";border:1px solid ", ";}&[data-status='warning'] svg{fill:", ";}&[data-status='critical']{background:", ";border:1px solid ", ";}&[data-status='critical'] svg{fill:", ";}@media (max-width:", "){min-height:89px;&[data-titled='true'] svg{top:0;}}"], _colors.Neutral.B99, _colors.Neutral.B18, _colors.Neutral.B68, _borderRadius.borderRadius8, _colors.Neutral.B40, _colors.Green.B89, _colors.Neutral.B68, _colors.Green.B61, _colors.Blue.S08, _colors.Blue.S99, _colors.Blue.S99, _colors.Orange.S42, _colors.Orange.S86, _colors.Orange.S87, _colors.Red.B100, _colors.Red.B93, _colors.Red.B93, Breakpoints.large);
21
+ })(["min-height:100px;padding:20px;background:", ";color:", ";border:1px solid ", ";border-radius:", ";svg{position:absolute;fill:", ";height:24px;width:24px;top:0;}&[data-titled='true'] svg{top:3px;}&[data-status='success']{background:", ";border:1px solid ", ";}&[data-status='success'] svg{fill:", ";}&[data-status='info']{background:", ";border:1px solid ", ";}&[data-status='info'] svg{fill:", ";}&[data-status='warning']{background:", ";border:1px solid ", ";}&[data-status='warning'] svg{fill:", ";}&[data-status='critical']{background:", ";border:1px solid ", ";}&[data-status='critical'] svg{fill:", ";}@media (max-width:", "){min-height:89px;&[data-titled='true'] svg{top:0;}}"], _colors.Neutral.B99, _colors.Neutral.B18, _colors.Neutral.B68, _borderRadius.borderRadius8, _colors.Neutral.B40, _colors.Green.B89, _colors.Neutral.B68, _colors.Green.B61, _colors.Blue.S08, _colors.Blue.S99, _colors.Blue.S99, _colors.Orange.S21, _colors.Orange.S86, _colors.Orange.S87, _colors.Red.B100, _colors.Red.B93, _colors.Red.B93, Breakpoints.large);
22
22
  exports.StyledBanner = StyledBanner;
23
23
  var StyledBannerContentContainer = _styledComponents["default"].div.withConfig({
24
24
  displayName: "BannerStyle__StyledBannerContentContainer",
@@ -1,5 +1,5 @@
1
1
  import { InputProps } from './Input';
2
- interface PreffixSuffixWidthProps {
2
+ export interface PreffixSuffixWidthProps {
3
3
  prefixWidth: number;
4
4
  suffixWidth: number;
5
5
  }
@@ -7,4 +7,3 @@ export declare const StyledContainer: import("styled-components").StyledComponen
7
7
  export declare const StyledPrefixContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
8
8
  export declare const StyledSuffixContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
9
9
  export declare const StyledInput: import("styled-components").StyledComponent<"input", any, InputProps, never>;
10
- export {};
@@ -7,6 +7,8 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
7
7
  var Breakpoints = _interopRequireWildcard(require("../utilities/breakpoints"));
8
8
  var _colors = require("../utilities/colors");
9
9
  var _spacing = require("../utilities/spacing");
10
+ var _fonts = require("../utilities/fonts");
11
+ var _borderRadius = require("../utilities/borderRadius");
10
12
  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); }
11
13
  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; }
12
14
  var StyledContainer = _styledComponents["default"].div.withConfig({
@@ -31,5 +33,5 @@ exports.StyledSuffixContainer = StyledSuffixContainer;
31
33
  var StyledInput = _styledComponents["default"].input.withConfig({
32
34
  displayName: "InputStyle__StyledInput",
33
35
  componentId: "sc-15z2mnd-3"
34
- })(["background:", ";box-sizing:border-box;border:1px solid ", ";border-radius:4px;padding:0 12px;font-family:'Noto Sans',sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:150%;color:", ";flex:none;order:1;align-self:stretch;flex-grow:0;height:36px;&::placeholder{color:", ";}&:focus{outline:none;box-shadow:0px 0px 0px 1px ", ",0px 0px 0px 3px #6ac9ec;}@media (max-width:", "){font-size:14px;}"], _colors.Neutral.B100, _colors.Neutral.B68, _colors.Neutral.B18, _colors.Neutral.B40, _colors.Neutral.B100, Breakpoints.large);
36
+ })(["background:", ";box-sizing:border-box;border:1px solid ", ";border-radius:", ";padding:0 12px;font-family:", ",sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:150%;color:", ";flex:none;order:1;align-self:stretch;flex-grow:0;height:36px;&::placeholder{color:", ";}&:focus{outline:none;box-shadow:0px 0px 0px 1px ", ",0px 0px 0px 3px #6ac9ec;}@media (max-width:", "){font-size:14px;}"], _colors.Neutral.B100, _colors.Neutral.B68, _borderRadius.borderRadius4, _fonts.NotoSans, _colors.Neutral.B18, _colors.Neutral.B40, _colors.Neutral.B100, Breakpoints.large);
35
37
  exports.StyledInput = StyledInput;
@@ -12,19 +12,18 @@ var MenuOption = function MenuOption(_ref) {
12
12
  onClick = _ref.onClick,
13
13
  value = _ref.value,
14
14
  allowMultiple = _ref.allowMultiple;
15
- var handleClick = function handleClick(value) {
15
+ var handleClick = function handleClick(event) {
16
+ event.stopPropagation();
16
17
  onClick({
17
- value: value
18
+ value: event.currentTarget.dataset.value
18
19
  });
19
20
  };
20
21
  return /*#__PURE__*/_react["default"].createElement(_MenuStyle.ListContainer, null, /*#__PURE__*/_react["default"].createElement("li", {
21
22
  "aria-disabled": disabled,
22
23
  "data-active": isSelected,
23
24
  "data-multiple": allowMultiple,
24
- value: value,
25
- onClick: function onClick() {
26
- return handleClick(value);
27
- }
25
+ "data-value": value,
26
+ onClick: handleClick
28
27
  }, children));
29
28
  };
30
29
  exports.MenuOption = MenuOption;
@@ -24,7 +24,9 @@ export interface SelectProps {
24
24
  options?: Option[];
25
25
  placeholder?: string;
26
26
  prefix?: React.ReactNode;
27
- /** sets whether to be able to type in to search from the options*/
27
+ /** sets whether Select is searchable */
28
+ searchable?: boolean;
29
+ /** props used for searchable Select */
28
30
  searchableProps?: SearchableProps;
29
31
  /** true = Allow vertical scroll, default by 6 options. */
30
32
  scrollable?: boolean;
@@ -33,5 +35,5 @@ export interface SelectProps {
33
35
  /** sets a width for the Select component*/
34
36
  width: string;
35
37
  }
36
- export declare const Select: ({ allowMultiple, disabled, hasError, helpText, label, onClose, onRemoveTag, onSelect, options, placeholder, listHeight, prefix, searchableProps, scrollable, sections, selectedValues, width, }: SelectProps) => JSX.Element;
38
+ export declare const Select: ({ allowMultiple, disabled, hasError, helpText, label, onClose, onRemoveTag, onSelect, options, placeholder, listHeight, prefix, searchable, searchableProps, scrollable, sections, selectedValues, width, }: SelectProps) => JSX.Element;
37
39
  export {};
@@ -7,7 +7,6 @@ var _Popover = require("../Popover");
7
7
  var _Typography = require("../Typography");
8
8
  var _colors = require("../utilities/colors");
9
9
  var _components = require("./components");
10
- var _ActivatorContext = require("./components/Activator/ActivatorContext");
11
10
  var _ActivatorSelect = require("./components/Activator/ActivatorSelect");
12
11
  var _Label = require("./components/Label/Label");
13
12
  var _SelectStyle = require("./SelectStyle");
@@ -16,19 +15,25 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
16
15
  var Select = function Select(_ref) {
17
16
  var _ref$allowMultiple = _ref.allowMultiple,
18
17
  allowMultiple = _ref$allowMultiple === void 0 ? false : _ref$allowMultiple,
19
- disabled = _ref.disabled,
20
- hasError = _ref.hasError,
18
+ _ref$disabled = _ref.disabled,
19
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
20
+ _ref$hasError = _ref.hasError,
21
+ hasError = _ref$hasError === void 0 ? false : _ref$hasError,
21
22
  helpText = _ref.helpText,
22
23
  label = _ref.label,
23
24
  onClose = _ref.onClose,
24
25
  onRemoveTag = _ref.onRemoveTag,
25
26
  onSelect = _ref.onSelect,
26
- options = _ref.options,
27
+ _ref$options = _ref.options,
28
+ options = _ref$options === void 0 ? [] : _ref$options,
27
29
  placeholder = _ref.placeholder,
28
30
  listHeight = _ref.listHeight,
29
31
  prefix = _ref.prefix,
32
+ _ref$searchable = _ref.searchable,
33
+ searchable = _ref$searchable === void 0 ? false : _ref$searchable,
30
34
  searchableProps = _ref.searchableProps,
31
- scrollable = _ref.scrollable,
35
+ _ref$scrollable = _ref.scrollable,
36
+ scrollable = _ref$scrollable === void 0 ? false : _ref$scrollable,
32
37
  sections = _ref.sections,
33
38
  selectedValues = _ref.selectedValues,
34
39
  width = _ref.width;
@@ -38,34 +43,38 @@ var Select = function Select(_ref) {
38
43
  var _useState2 = (0, _react.useState)(''),
39
44
  optionListHeight = _useState2[0],
40
45
  setOptionListHeight = _useState2[1];
41
- var handleClose = (0, _react.useCallback)(function () {
46
+ var _useState3 = (0, _react.useState)(options),
47
+ menuOptions = _useState3[0],
48
+ setMenuOptions = _useState3[1];
49
+ var _useState4 = (0, _react.useState)((searchableProps == null ? void 0 : searchableProps.inputValue) || ''),
50
+ inputValue = _useState4[0],
51
+ setInputValue = _useState4[1];
52
+ var _useState5 = (0, _react.useState)({
53
+ showSelected: false,
54
+ showInput: true,
55
+ showPlaceholder: true
56
+ }),
57
+ searchableSelectState = _useState5[0],
58
+ setSearchableSelectState = _useState5[1];
59
+ var _updateSearchableSelectState = function updateSearchableSelectState(newState) {
60
+ setSearchableSelectState(newState);
61
+ };
62
+ var updateInputValue = function updateInputValue(newValue) {
63
+ setInputValue(newValue);
64
+ };
65
+ var updateMenuOptions = function updateMenuOptions(newState) {
66
+ setMenuOptions(newState);
67
+ };
68
+ var handleClose = function handleClose() {
42
69
  setPopoverActive(false);
43
70
  onClose == null ? void 0 : onClose();
44
- }, [onClose]);
71
+ };
45
72
  var handleFocus = function handleFocus() {
46
73
  setPopoverActive(true);
47
74
  };
48
- var handleBlur = function handleBlur() {
49
- if (popoverActive) {
50
- handleClose();
51
- }
52
- };
53
75
  var handleSelectClick = function handleSelectClick() {
54
76
  setPopoverActive(!popoverActive);
55
77
  };
56
- var activatorSelectContextValue = {
57
- allowMultiple: allowMultiple,
58
- disabled: disabled,
59
- hasError: hasError,
60
- onSelectClick: handleSelectClick,
61
- selectedValues: selectedValues
62
- };
63
- var activatorTextInputContextValue = {
64
- disabled: disabled,
65
- hasError: hasError,
66
- onFocus: handleFocus,
67
- onBlur: handleBlur
68
- };
69
78
  (0, _react.useEffect)(function () {
70
79
  if (listHeight) {
71
80
  setOptionListHeight(listHeight + 24 + "px");
@@ -77,28 +86,38 @@ var Select = function Select(_ref) {
77
86
  }
78
87
  }, [listHeight, scrollable]);
79
88
  var activator = function activator() {
80
- if (searchableProps) {
81
- var inputValue = searchableProps.inputValue,
82
- _onInputChange = searchableProps.onInputChange;
83
- return /*#__PURE__*/_react["default"].createElement(_ActivatorContext.ActivatorTextInputContext.Provider, {
84
- value: activatorTextInputContextValue
85
- }, /*#__PURE__*/_react["default"].createElement(_components.ActivatorTextInput, {
86
- value: inputValue,
87
- onChange: _onInputChange,
89
+ if (searchable || searchableProps) {
90
+ return /*#__PURE__*/_react["default"].createElement(_components.ActivatorTextInput, {
91
+ allowMultiple: allowMultiple,
92
+ disabled: disabled,
93
+ hasError: hasError,
94
+ onChange: searchableProps == null ? void 0 : searchableProps.onInputChange,
88
95
  placeholder: placeholder != null ? placeholder : 'Search',
89
- prefix: prefix,
90
- width: width
91
- }));
96
+ width: width,
97
+ selectedValues: selectedValues,
98
+ onSelect: onSelect,
99
+ onFocus: handleFocus,
100
+ inputValue: inputValue,
101
+ updateInputValue: updateInputValue,
102
+ searchableSelectState: searchableSelectState,
103
+ updateSearchableSelectState: function updateSearchableSelectState(newState) {
104
+ return _updateSearchableSelectState(newState);
105
+ },
106
+ options: options,
107
+ updateMenuOptions: updateMenuOptions,
108
+ prefix: prefix
109
+ });
92
110
  }
93
- return /*#__PURE__*/_react["default"].createElement(_ActivatorContext.ActivatorSelectContext.Provider, {
94
- value: activatorSelectContextValue
95
- }, /*#__PURE__*/_react["default"].createElement(_ActivatorSelect.ActivatorSelect, {
111
+ return /*#__PURE__*/_react["default"].createElement(_ActivatorSelect.ActivatorSelect, {
112
+ allowMultiple: allowMultiple,
96
113
  disabled: disabled,
114
+ hasError: hasError,
97
115
  placeholder: "Placeholder",
98
116
  onRemoveTag: onRemoveTag,
117
+ onSelectClick: handleSelectClick,
99
118
  width: width,
100
- values: selectedValues
101
- }));
119
+ selectedValues: selectedValues
120
+ });
102
121
  };
103
122
  return /*#__PURE__*/_react["default"].createElement(_Popover.Popover, {
104
123
  active: popoverActive,
@@ -113,15 +132,19 @@ var Select = function Select(_ref) {
113
132
  autofocusTarget: "none",
114
133
  preventFocusOnClose: true,
115
134
  fullWidth: true
116
- }, /*#__PURE__*/_react["default"].createElement(_Popover.Popover.Pane, {
135
+ }, !disabled && /*#__PURE__*/_react["default"].createElement(_Popover.Popover.Pane, {
117
136
  height: optionListHeight
118
137
  }, /*#__PURE__*/_react["default"].createElement(_components.OptionList, {
138
+ menuOptions: menuOptions,
119
139
  allowMultiple: allowMultiple,
120
140
  onSelect: onSelect,
121
- options: options,
122
141
  sections: sections,
123
142
  selectedValues: selectedValues,
124
- width: width
143
+ width: width,
144
+ onMenuClose: handleClose,
145
+ updateSearchableSelectState: function updateSearchableSelectState(newState) {
146
+ return _updateSearchableSelectState(newState);
147
+ }
125
148
  })));
126
149
  };
127
150
  exports.Select = Select;
@@ -6,6 +6,7 @@ export declare const NonSearchableMultipleSelect: any;
6
6
  export declare const WithErrorNonSearchable: any;
7
7
  export declare const NonSearchableDisabled: any;
8
8
  export declare const SearchableMultiSelect: any;
9
+ export declare const SearchableSingleSelect: any;
9
10
  export declare const MultiSelectScrollable: any;
10
11
  export declare const WithInlineError: any;
11
12
  export declare const SearchableDisabled: any;