@epignosis_llc/gnosis 6.7.7 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +130 -88
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/_virtual/index6.js +2 -2
- package/dist/esm/_virtual/index7.js +2 -2
- package/dist/esm/node_modules/color-string/index.js +1 -1
- package/dist/esm/node_modules/exenv/index.js +1 -1
- package/dist/esm/node_modules/react-modal/lib/helpers/safeHTMLElement.js +1 -1
- package/dist/esm/node_modules/simple-swizzle/index.js +1 -1
- package/dist/esm/src/components/FormElements/Select/Select.js +15 -4
- package/dist/esm/src/components/FormElements/Select/Select.js.map +1 -1
- package/dist/esm/src/components/FormElements/Select/components/CustomClearIndicator.js +47 -0
- package/dist/esm/src/components/FormElements/Select/components/CustomClearIndicator.js.map +1 -0
- package/dist/types/components/FormElements/Select/components/CustomClearIndicator.d.ts +8 -0
- package/dist/types/icons/logos/index.d.ts +1 -0
- package/icons/index.cjs +2108 -2091
- package/icons/index.js +2108 -2092
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { c as colorString } from '../../_virtual/index3.js';
|
|
10
10
|
import colorName from '../color-name/index.js';
|
|
11
11
|
import '../simple-swizzle/index.js';
|
|
12
|
-
import { s as simpleSwizzle } from '../../_virtual/
|
|
12
|
+
import { s as simpleSwizzle } from '../../_virtual/index7.js';
|
|
13
13
|
|
|
14
14
|
/* MIT license */
|
|
15
15
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { __exports as safeHTMLElement } from '../../../../_virtual/safeHTMLElement.js';
|
|
10
10
|
import '../../../exenv/index.js';
|
|
11
|
-
import { e as exenv } from '../../../../_virtual/
|
|
11
|
+
import { e as exenv } from '../../../../_virtual/index6.js';
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(safeHTMLElement, "__esModule", {
|
|
14
14
|
value: true
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Released under the MIT license.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { s as simpleSwizzle } from '../../_virtual/
|
|
9
|
+
import { s as simpleSwizzle } from '../../_virtual/index7.js';
|
|
10
10
|
import isArrayish$1 from './node_modules/is-arrayish/index.js';
|
|
11
11
|
|
|
12
12
|
var isArrayish = isArrayish$1;
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* Released under the MIT license.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectSpread2 as _objectSpread2 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
10
10
|
import '../../../../node_modules/core-js/modules/es.array.concat.js';
|
|
11
11
|
import '../../../../node_modules/core-js/modules/es.array.reduce.js';
|
|
12
12
|
import '../../../../node_modules/core-js/modules/es.object.to-string.js';
|
|
13
|
-
import { forwardRef, useRef, isValidElement } from 'react';
|
|
13
|
+
import { forwardRef, useRef, useImperativeHandle, useCallback, isValidElement } from 'react';
|
|
14
14
|
import classNames from '../../../../node_modules/classnames/index.js';
|
|
15
15
|
import SvgInfoCircled from '../../../icons/legacy/info-circled.svg.js';
|
|
16
16
|
import SvgAddOperator from '../../../icons/legacy/add-operator.svg.js';
|
|
@@ -22,6 +22,7 @@ import { containerClassNames, renderSelect } from './helpers.js';
|
|
|
22
22
|
import CustomMultiValueLabel from './components/CustomMultiValueLabel.js';
|
|
23
23
|
import CustomSingleValue from './components/CustomSingleValue.js';
|
|
24
24
|
import CustomOptionComponent from './components/CustomOptionComponent.js';
|
|
25
|
+
import CustomClearIndicator from './components/CustomClearIndicator.js';
|
|
25
26
|
import { createElement as jsx } from '../../../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js';
|
|
26
27
|
|
|
27
28
|
var _excluded = ["id", "type", "required", "label", "options", "size", "inline", "status", "isInlineFlex", "isMulti", "creatableTooltip", "maxMenuHeight", "minWidth", "maxWidth", "placeholder", "tooltipContent", "minNumberOfOptionsToEnableSearch", "isValidNewOption", "menuMinWidth", "loadOptions", "isSearchable", "allowTextWrap", "onChange"];
|
|
@@ -69,9 +70,18 @@ var Select = function Select(props, forwardedRef) {
|
|
|
69
70
|
rest = _objectWithoutProperties(props, _excluded);
|
|
70
71
|
var hasLabel = Boolean(label);
|
|
71
72
|
var containerRef = useRef(null);
|
|
73
|
+
var selectRef = useRef(null);
|
|
72
74
|
var labelClassname = classNames({
|
|
73
75
|
required: required
|
|
74
76
|
});
|
|
77
|
+
useImperativeHandle(forwardedRef, function () {
|
|
78
|
+
return selectRef.current;
|
|
79
|
+
}, []);
|
|
80
|
+
var ClearIndicatorWithRef = useCallback(function (indicatorProps) {
|
|
81
|
+
return jsx(CustomClearIndicator, _extends({}, indicatorProps, {
|
|
82
|
+
selectRef: selectRef
|
|
83
|
+
}));
|
|
84
|
+
}, []);
|
|
75
85
|
var countOptions = function countOptions() {
|
|
76
86
|
// Count the number of options, including nested options if exists
|
|
77
87
|
return options.reduce(function (count, option) {
|
|
@@ -108,7 +118,7 @@ var Select = function Select(props, forwardedRef) {
|
|
|
108
118
|
var customSelectProps = _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
109
119
|
id: id,
|
|
110
120
|
"aria-label": rest["aria-label"],
|
|
111
|
-
ref:
|
|
121
|
+
ref: selectRef,
|
|
112
122
|
styles: styles,
|
|
113
123
|
isMulti: isMulti,
|
|
114
124
|
classNames: {
|
|
@@ -126,7 +136,8 @@ var Select = function Select(props, forwardedRef) {
|
|
|
126
136
|
},
|
|
127
137
|
Option: CustomOptionComponent,
|
|
128
138
|
SingleValue: CustomSingleValue,
|
|
129
|
-
MultiValueLabel: CustomMultiValueLabel
|
|
139
|
+
MultiValueLabel: CustomMultiValueLabel,
|
|
140
|
+
ClearIndicator: ClearIndicatorWithRef
|
|
130
141
|
},
|
|
131
142
|
formatCreateLabel: formatCreateLabel,
|
|
132
143
|
isSearchable: isSelectSearchable(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../../../../src/components/FormElements/Select/Select.tsx"],"sourcesContent":["import React, { ForwardRefRenderFunction, forwardRef, isValidElement, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport { ActionMeta, MultiValue, SelectInstance, SingleValue } from \"react-select\";\nimport { SerializedStyles } from \"@emotion/react\";\nimport { AddOperatorSVG, InfoCircledSVG } from \"../../../icons\";\nimport Label from \"../Label/Label\";\nimport Tooltip from \"../../Tooltip/Tooltip\";\nimport { resolveStyles, selectContainer } from \"./styles\";\nimport { CustomOption, CustomSelectProps } from \"./types\";\nimport { MAX_MENU_HEIGHT, MIN_WIDTH, MAX_WIDTH, PLACEHOLDER } from \"./constants\";\nimport { containerClassNames, renderSelect } from \"./helpers\";\nimport CustomMultiValueLabel from \"./components/CustomMultiValueLabel\";\nimport CustomSingleValue from \"./components/CustomSingleValue\";\nimport CustomOptionComponent from \"./components/CustomOptionComponent\";\n\nconst Select: ForwardRefRenderFunction<\n SelectInstance<CustomOption>,\n CustomSelectProps<CustomOption, boolean>\n> = (props, forwardedRef) => {\n const {\n id = \"\",\n type = \"select\",\n required = false,\n label = \"\",\n options = [],\n size = \"md\",\n inline = false,\n status = \"valid\",\n isInlineFlex = false,\n isMulti = false,\n creatableTooltip = \"Create\",\n maxMenuHeight = MAX_MENU_HEIGHT,\n minWidth = MIN_WIDTH,\n maxWidth = MAX_WIDTH,\n placeholder = PLACEHOLDER,\n tooltipContent = \"\",\n minNumberOfOptionsToEnableSearch = 10,\n isValidNewOption,\n menuMinWidth,\n loadOptions,\n isSearchable,\n allowTextWrap,\n onChange,\n ...rest\n } = props;\n\n const hasLabel = Boolean(label);\n const containerRef = useRef<HTMLInputElement>(null);\n const labelClassname = classNames({\n required,\n });\n\n const countOptions = () => {\n // Count the number of options, including nested options if exists\n return options.reduce((count, option) => {\n return count + (\"options\" in option ? option.options.length : 1);\n }, 0);\n };\n\n const isSelectSearchable = () => {\n if (isSearchable !== undefined) {\n return isSearchable;\n }\n\n const isAsyncType = type === \"async\";\n const hasManyOptions = countOptions() > minNumberOfOptionsToEnableSearch;\n return isAsyncType || hasManyOptions;\n };\n\n const shouldRenderTooltip =\n (tooltipContent && typeof tooltipContent === \"string\" && tooltipContent !== \"\") ||\n isValidElement(tooltipContent);\n\n const styles = resolveStyles({ size, menuMinWidth, allowTextWrap });\n\n const formatCreateLabel = (inputValue: string) => (\n <Tooltip content={creatableTooltip} parentProps={{ \"aria-label\": inputValue }}>\n <div className=\"select-create-label\">\n <span>{inputValue} </span>\n <span>\n <AddOperatorSVG color=\"black\" height={12} />\n </span>\n </div>\n </Tooltip>\n );\n\n const customSelectProps = {\n ...rest,\n id: id,\n \"aria-label\": rest[\"aria-label\"],\n ref: forwardedRef,\n styles,\n isMulti,\n classNames: {\n control: () => containerClassNames(status, size),\n option: ({ isSelected }: { isSelected: boolean }) =>\n `${isSelected ? \"selected\" : \"\"} option-${size}`,\n },\n components: {\n IndicatorSeparator: () => null,\n Option: CustomOptionComponent,\n SingleValue: CustomSingleValue,\n MultiValueLabel: CustomMultiValueLabel,\n },\n formatCreateLabel,\n isSearchable: isSelectSearchable(),\n maxMenuHeight,\n options,\n placeholder,\n type,\n isValidNewOption,\n loadOptions,\n onMouseDown: (e: MouseEvent) => e.stopPropagation(),\n onChange: (\n option: MultiValue<CustomOption> | SingleValue<CustomOption>,\n action: ActionMeta<CustomOption>,\n ) => {\n onChange?.(option, action);\n },\n isOptionDisabled: (option: CustomOption): boolean => Boolean(option.disabled),\n };\n\n return (\n <div\n css={(theme): SerializedStyles =>\n selectContainer(theme, {\n size,\n inline,\n isInlineFlex,\n minWidth,\n maxWidth,\n })\n }\n >\n {hasLabel && (\n <div className=\"label-container\">\n <Label\n htmlFor={id}\n aria-labelledby={id}\n data-testid={`${id}-label`}\n className={labelClassname}\n >\n {label}\n </Label>\n {shouldRenderTooltip && (\n <div data-testid={`${id}-tooltip`}>\n <Tooltip content={tooltipContent} parentProps={{ \"aria-label\": label }}>\n <InfoCircledSVG height={20} />\n </Tooltip>\n </div>\n )}\n </div>\n )}\n <div className=\"select-input-wrapper\" data-testid={`${id}-select`} ref={containerRef}>\n {renderSelect(type, customSelectProps)}\n </div>\n </div>\n );\n};\n\nexport default forwardRef(Select);\n"],"names":["Select","props","forwardedRef","_props$id","id","_props$type","type","_props$required","required","_props$label","label","_props$options","options","_props$size","size","_props$inline","inline","_props$status","status","_props$isInlineFlex","isInlineFlex","_props$isMulti","isMulti","_props$creatableToolt","creatableTooltip","_props$maxMenuHeight","maxMenuHeight","MAX_MENU_HEIGHT","_props$minWidth","minWidth","MIN_WIDTH","_props$maxWidth","maxWidth","MAX_WIDTH","_props$placeholder","placeholder","PLACEHOLDER","_props$tooltipContent","tooltipContent","_props$minNumberOfOpt","minNumberOfOptionsToEnableSearch","isValidNewOption","menuMinWidth","loadOptions","isSearchable","allowTextWrap","onChange","rest","_objectWithoutProperties","_excluded","hasLabel","Boolean","containerRef","useRef","labelClassname","classNames","countOptions","reduce","count","option","length","isSelectSearchable","undefined","isAsyncType","hasManyOptions","shouldRenderTooltip","isValidElement","styles","resolveStyles","formatCreateLabel","inputValue","___EmotionJSX","Tooltip","content","parentProps","className","AddOperatorSVG","color","height","customSelectProps","_objectSpread","ref","control","containerClassNames","_ref","isSelected","concat","components","IndicatorSeparator","Option","CustomOptionComponent","SingleValue","CustomSingleValue","MultiValueLabel","CustomMultiValueLabel","onMouseDown","e","stopPropagation","action","isOptionDisabled","disabled","css","theme","selectContainer","Label","htmlFor","InfoCircledSVG","renderSelect","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAMA,MAGL,GAAG,SAHEA,MAGLA,CAAIC,KAAK,EAAEC,YAAY,EAAK;AAC3B,EAAA,IAAAC,SAAA,GAyBIF,KAAK,C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KAAA,EAAA;AAAKI,IAAAA,SAAS,EAAC,iBAAA;GACbJ,EAAAA,GAAA,CAACiC,KAAK,EAAA;AACJC,IAAAA,OAAO,EAAErG,EAAG;AACZ,IAAA,iBAAA,EAAiBA,EAAG;IACpB,aAAAkF,EAAAA,EAAAA,CAAAA,MAAA,CAAgBlF,EAAE,EAAS,QAAA,CAAA;AAC3BuE,IAAAA,SAAS,EAAErB,cAAAA;AAAe,GAAA,EAEzB5C,KACI,CAAC,EACPuD,mBAAmB,IAClBM,GAAA,CAAA,KAAA,EAAA;IAAK,aAAAe,EAAAA,EAAAA,CAAAA,MAAA,CAAgBlF,EAAE,EAAA,UAAA,CAAA;GACrBmE,EAAAA,GAAA,CAACC,OAAO,EAAA;AAACC,IAAAA,OAAO,EAAEnC,cAAe;AAACoC,IAAAA,WAAW,EAAE;AAAE,MAAA,YAAY,EAAEhE,KAAAA;AAAM,KAAA;GACnE6D,EAAAA,GAAA,CAACmC,cAAc,EAAA;AAAC5B,IAAAA,MAAM,EAAE,EAAA;AAAG,GAAE,CACtB,CACN,CAEJ,CACN,EACDP,GAAA,CAAA,KAAA,EAAA;AAAKI,IAAAA,SAAS,EAAC,sBAAsB;IAAC,aAAAW,EAAAA,EAAAA,CAAAA,MAAA,CAAgBlF,EAAE,EAAU,SAAA,CAAA;AAAC6E,IAAAA,GAAG,EAAE7B,YAAAA;AAAa,GAAA,EAClFuD,YAAY,CAACrG,IAAI,EAAEyE,iBAAiB,CAClC,CACF,CAAC,CAAA;AAEV,CAAC,CAAA;AAED,eAAe6B,aAAAA,UAAU,CAAC5G,MAAM,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../../../src/components/FormElements/Select/Select.tsx"],"sourcesContent":["import React, {\n ForwardRefRenderFunction,\n forwardRef,\n isValidElement,\n useCallback,\n useImperativeHandle,\n useRef,\n} from \"react\";\nimport classNames from \"classnames\";\nimport {\n ActionMeta,\n ClearIndicatorProps,\n MultiValue,\n SelectInstance,\n SingleValue,\n} from \"react-select\";\nimport { SerializedStyles } from \"@emotion/react\";\nimport { AddOperatorSVG, InfoCircledSVG } from \"../../../icons\";\nimport Label from \"../Label/Label\";\nimport Tooltip from \"../../Tooltip/Tooltip\";\nimport { resolveStyles, selectContainer } from \"./styles\";\nimport { CustomOption, CustomSelectProps } from \"./types\";\nimport { MAX_MENU_HEIGHT, MIN_WIDTH, MAX_WIDTH, PLACEHOLDER } from \"./constants\";\nimport { containerClassNames, renderSelect } from \"./helpers\";\nimport CustomMultiValueLabel from \"./components/CustomMultiValueLabel\";\nimport CustomSingleValue from \"./components/CustomSingleValue\";\nimport CustomOptionComponent from \"./components/CustomOptionComponent\";\nimport CustomClearIndicator from \"./components/CustomClearIndicator\";\n\nconst Select: ForwardRefRenderFunction<\n SelectInstance<CustomOption>,\n CustomSelectProps<CustomOption, boolean>\n> = (props, forwardedRef) => {\n const {\n id = \"\",\n type = \"select\",\n required = false,\n label = \"\",\n options = [],\n size = \"md\",\n inline = false,\n status = \"valid\",\n isInlineFlex = false,\n isMulti = false,\n creatableTooltip = \"Create\",\n maxMenuHeight = MAX_MENU_HEIGHT,\n minWidth = MIN_WIDTH,\n maxWidth = MAX_WIDTH,\n placeholder = PLACEHOLDER,\n tooltipContent = \"\",\n minNumberOfOptionsToEnableSearch = 10,\n isValidNewOption,\n menuMinWidth,\n loadOptions,\n isSearchable,\n allowTextWrap,\n onChange,\n ...rest\n } = props;\n\n const hasLabel = Boolean(label);\n const containerRef = useRef<HTMLInputElement>(null);\n const selectRef = useRef<SelectInstance<CustomOption> | null>(null);\n const labelClassname = classNames({\n required,\n });\n\n useImperativeHandle<SelectInstance<CustomOption> | null, SelectInstance<CustomOption> | null>(\n forwardedRef,\n () => selectRef.current,\n [],\n );\n\n const ClearIndicatorWithRef = useCallback(\n (indicatorProps: ClearIndicatorProps<CustomOption>) => (\n <CustomClearIndicator {...indicatorProps} selectRef={selectRef} />\n ),\n [],\n );\n\n const countOptions = () => {\n // Count the number of options, including nested options if exists\n return options.reduce((count, option) => {\n return count + (\"options\" in option ? option.options.length : 1);\n }, 0);\n };\n\n const isSelectSearchable = () => {\n if (isSearchable !== undefined) {\n return isSearchable;\n }\n\n const isAsyncType = type === \"async\";\n const hasManyOptions = countOptions() > minNumberOfOptionsToEnableSearch;\n return isAsyncType || hasManyOptions;\n };\n\n const shouldRenderTooltip =\n (tooltipContent && typeof tooltipContent === \"string\" && tooltipContent !== \"\") ||\n isValidElement(tooltipContent);\n\n const styles = resolveStyles({ size, menuMinWidth, allowTextWrap });\n\n const formatCreateLabel = (inputValue: string) => (\n <Tooltip content={creatableTooltip} parentProps={{ \"aria-label\": inputValue }}>\n <div className=\"select-create-label\">\n <span>{inputValue} </span>\n <span>\n <AddOperatorSVG color=\"black\" height={12} />\n </span>\n </div>\n </Tooltip>\n );\n\n const customSelectProps = {\n ...rest,\n id: id,\n \"aria-label\": rest[\"aria-label\"],\n ref: selectRef,\n styles,\n isMulti,\n classNames: {\n control: () => containerClassNames(status, size),\n option: ({ isSelected }: { isSelected: boolean }) =>\n `${isSelected ? \"selected\" : \"\"} option-${size}`,\n },\n components: {\n IndicatorSeparator: () => null,\n Option: CustomOptionComponent,\n SingleValue: CustomSingleValue,\n MultiValueLabel: CustomMultiValueLabel,\n ClearIndicator: ClearIndicatorWithRef,\n },\n formatCreateLabel,\n isSearchable: isSelectSearchable(),\n maxMenuHeight,\n options,\n placeholder,\n type,\n isValidNewOption,\n loadOptions,\n onMouseDown: (e: MouseEvent) => e.stopPropagation(),\n onChange: (\n option: MultiValue<CustomOption> | SingleValue<CustomOption>,\n action: ActionMeta<CustomOption>,\n ) => {\n onChange?.(option, action);\n },\n isOptionDisabled: (option: CustomOption): boolean => Boolean(option.disabled),\n };\n\n return (\n <div\n css={(theme): SerializedStyles =>\n selectContainer(theme, {\n size,\n inline,\n isInlineFlex,\n minWidth,\n maxWidth,\n })\n }\n >\n {hasLabel && (\n <div className=\"label-container\">\n <Label\n htmlFor={id}\n aria-labelledby={id}\n data-testid={`${id}-label`}\n className={labelClassname}\n >\n {label}\n </Label>\n {shouldRenderTooltip && (\n <div data-testid={`${id}-tooltip`}>\n <Tooltip content={tooltipContent} parentProps={{ \"aria-label\": label }}>\n <InfoCircledSVG height={20} />\n </Tooltip>\n </div>\n )}\n </div>\n )}\n <div className=\"select-input-wrapper\" data-testid={`${id}-select`} ref={containerRef}>\n {renderSelect(type, customSelectProps)}\n </div>\n </div>\n );\n};\n\nexport default forwardRef(Select);\n"],"names":["Select","props","forwardedRef","_props$id","id","_props$type","type","_props$required","required","_props$label","label","_props$options","options","_props$size","size","_props$inline","inline","_props$status","status","_props$isInlineFlex","isInlineFlex","_props$isMulti","isMulti","_props$creatableToolt","creatableTooltip","_props$maxMenuHeight","maxMenuHeight","MAX_MENU_HEIGHT","_props$minWidth","minWidth","MIN_WIDTH","_props$maxWidth","maxWidth","MAX_WIDTH","_props$placeholder","placeholder","PLACEHOLDER","_props$tooltipContent","tooltipContent","_props$minNumberOfOpt","minNumberOfOptionsToEnableSearch","isValidNewOption","menuMinWidth","loadOptions","isSearchable","allowTextWrap","onChange","rest","_objectWithoutProperties","_excluded","hasLabel","Boolean","containerRef","useRef","selectRef","labelClassname","classNames","useImperativeHandle","current","ClearIndicatorWithRef","useCallback","indicatorProps","___EmotionJSX","CustomClearIndicator","_extends","countOptions","reduce","count","option","length","isSelectSearchable","undefined","isAsyncType","hasManyOptions","shouldRenderTooltip","isValidElement","styles","resolveStyles","formatCreateLabel","inputValue","Tooltip","content","parentProps","className","AddOperatorSVG","color","height","customSelectProps","_objectSpread","ref","control","containerClassNames","_ref","isSelected","concat","components","IndicatorSeparator","Option","CustomOptionComponent","SingleValue","CustomSingleValue","MultiValueLabel","CustomMultiValueLabel","ClearIndicator","onMouseDown","e","stopPropagation","action","isOptionDisabled","disabled","css","theme","selectContainer","Label","htmlFor","InfoCircledSVG","renderSelect","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAMA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EACDxB,GAAA,CAAA,KAAA,EAAA;AAAKqB,IAAAA,SAAS,EAAC,sBAAsB;IAAC,aAAAW,EAAAA,EAAAA,CAAAA,MAAA,CAAgB1F,EAAE,EAAU,SAAA,CAAA;AAACqF,IAAAA,GAAG,EAAErC,YAAAA;AAAa,GAAA,EAClFgE,YAAY,CAAC9G,IAAI,EAAEiF,iBAAiB,CAClC,CACF,CAAC,CAAA;AAEV,CAAC,CAAA;AAED,eAAe8B,aAAAA,UAAU,CAACrH,MAAM,CAAC;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* author: epignosis front-end team
|
|
5
|
+
* @epignosis_llc/gnosis.js v6.6.16
|
|
6
|
+
* Released under the MIT license.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
10
|
+
import { memo } from 'react';
|
|
11
|
+
import { createElement as jsx } from '../../../../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js';
|
|
12
|
+
import { c as components } from '../../../../../node_modules/react-select/dist/index-a301f526.esm.js';
|
|
13
|
+
|
|
14
|
+
var _excluded = ["selectRef"];
|
|
15
|
+
var CustomClearIndicator = function CustomClearIndicator(_ref) {
|
|
16
|
+
var selectRef = _ref.selectRef,
|
|
17
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
+
var innerProps = props.innerProps,
|
|
19
|
+
selectProps = props.selectProps,
|
|
20
|
+
clearValue = props.clearValue;
|
|
21
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
22
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
23
|
+
var _selectRef$current;
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
clearValue();
|
|
27
|
+
// The clear indicator unmounts once the value is gone, taking focus with
|
|
28
|
+
// it. Refocus the select's own input so keyboard users can keep going.
|
|
29
|
+
(_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 || _selectRef$current.focus();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var clearIndicatorInnerProps = _objectSpread2(_objectSpread2({}, innerProps), {}, {
|
|
33
|
+
role: "button",
|
|
34
|
+
tabIndex: 0,
|
|
35
|
+
"aria-label": "Clear selection",
|
|
36
|
+
"aria-hidden": undefined,
|
|
37
|
+
"data-testid": "".concat(selectProps.id, "-clear"),
|
|
38
|
+
onKeyDown: handleKeyDown
|
|
39
|
+
});
|
|
40
|
+
return jsx(components.ClearIndicator, _extends({}, props, {
|
|
41
|
+
innerProps: clearIndicatorInnerProps
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
var CustomClearIndicator$1 = /*#__PURE__*/memo(CustomClearIndicator);
|
|
45
|
+
|
|
46
|
+
export { CustomClearIndicator$1 as default };
|
|
47
|
+
//# sourceMappingURL=CustomClearIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomClearIndicator.js","sources":["../../../../../../../src/components/FormElements/Select/components/CustomClearIndicator.tsx"],"sourcesContent":["import React, { FC, KeyboardEvent, RefObject, memo } from \"react\";\nimport { components, ClearIndicatorProps, SelectInstance } from \"react-select\";\nimport { CustomOption } from \"../types\";\n\ntype CustomClearIndicatorProps = ClearIndicatorProps<CustomOption> & {\n selectRef: RefObject<SelectInstance<CustomOption>>;\n};\n\nconst CustomClearIndicator: FC<CustomClearIndicatorProps> = ({ selectRef, ...props }) => {\n const { innerProps, selectProps, clearValue } = props;\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n event.stopPropagation();\n clearValue();\n // The clear indicator unmounts once the value is gone, taking focus with\n // it. Refocus the select's own input so keyboard users can keep going.\n selectRef.current?.focus();\n }\n };\n\n const clearIndicatorInnerProps = {\n ...innerProps,\n role: \"button\",\n tabIndex: 0,\n \"aria-label\": \"Clear selection\",\n \"aria-hidden\": undefined,\n \"data-testid\": `${selectProps.id}-clear`,\n onKeyDown: handleKeyDown,\n };\n\n return <components.ClearIndicator {...props} innerProps={clearIndicatorInnerProps} />;\n};\n\nexport default memo(CustomClearIndicator);\n"],"names":["CustomClearIndicator","_ref","selectRef","props","_objectWithoutProperties","_excluded","innerProps","selectProps","clearValue","handleKeyDown","event","key","_selectRef$current","preventDefault","stopPropagation","current","focus","clearIndicatorInnerProps","_objectSpread","role","tabIndex","undefined","concat","id","onKeyDown","___EmotionJSX","components","ClearIndicator","_extends","memo"],"mappings":";;;;;;;;;;;;;;AAQA,IAAMA,oBAAmD,GAAG,SAAtDA,oBAAmDA,CAAAC,IAAA,EAAgC;AAAA,EAAA,IAA1BC,SAAS,GAAAD,IAAA,CAATC,SAAS;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA,CAAA,CAAA;AAChF,EAAA,IAAQC,UAAU,GAA8BH,KAAK,CAA7CG,UAAU;IAAEC,WAAW,GAAiBJ,KAAK,CAAjCI,WAAW;IAAEC,UAAU,GAAKL,KAAK,CAApBK,UAAU,CAAA;AAE3C,EAAA,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,KAAoC,EAAW;IACpE,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,IAAID,KAAK,CAACC,GAAG,KAAK,GAAG,EAAE;AAAA,MAAA,IAAAC,kBAAA,CAAA;MAC9CF,KAAK,CAACG,cAAc,EAAE,CAAA;MACtBH,KAAK,CAACI,eAAe,EAAE,CAAA;AACvBN,MAAAA,UAAU,EAAE,CAAA;AACZ;AACA;AACA,MAAA,CAAAI,kBAAA,GAAAV,SAAS,CAACa,OAAO,MAAA,IAAA,IAAAH,kBAAA,KAAA,KAAA,CAAA,IAAjBA,kBAAA,CAAmBI,KAAK,EAAE,CAAA;AAC5B,KAAA;GACD,CAAA;AAED,EAAA,IAAMC,wBAAwB,GAAAC,cAAA,CAAAA,cAAA,KACzBZ,UAAU,CAAA,EAAA,EAAA,EAAA;AACba,IAAAA,IAAI,EAAE,QAAQ;AACdC,IAAAA,QAAQ,EAAE,CAAC;AACX,IAAA,YAAY,EAAE,iBAAiB;AAC/B,IAAA,aAAa,EAAEC,SAAS;AACxB,IAAA,aAAa,KAAAC,MAAA,CAAKf,WAAW,CAACgB,EAAE,EAAQ,QAAA,CAAA;AACxCC,IAAAA,SAAS,EAAEf,aAAAA;GACZ,CAAA,CAAA;EAED,OAAOgB,GAAA,CAACC,UAAU,CAACC,cAAc,EAAAC,QAAA,KAAKzB,KAAK,EAAA;AAAEG,IAAAA,UAAU,EAAEW,wBAAAA;AAAyB,GAAA,CAAE,CAAC,CAAA;AACvF,CAAC,CAAA;AAED,6BAAeY,aAAAA,IAAI,CAAC7B,oBAAoB,CAAC;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { RefObject } from "react";
|
|
2
|
+
import { ClearIndicatorProps, SelectInstance } from "react-select";
|
|
3
|
+
import { CustomOption } from "../types";
|
|
4
|
+
type CustomClearIndicatorProps = ClearIndicatorProps<CustomOption> & {
|
|
5
|
+
selectRef: RefObject<SelectInstance<CustomOption>>;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: React.NamedExoticComponent<CustomClearIndicatorProps>;
|
|
8
|
+
export default _default;
|
|
@@ -28,3 +28,4 @@ export { default as HubSpotSVG } from "./hubspot.svg";
|
|
|
28
28
|
export { default as LinkedInIntegrationSVG } from "./linked-in-integration.svg";
|
|
29
29
|
export { default as WorkdaySVG } from "./workday.svg";
|
|
30
30
|
export { default as RipplingSVG } from "./rippling.svg";
|
|
31
|
+
export { default as UdemyLogoSVG } from "./udemy.svg";
|