@ntbjs/react-components 2.0.2-rc.1 → 2.0.2-rc.11
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/build/data/Badge/Badge.js +6 -6
- package/build/data/Badge/Badge.js.map +1 -1
- package/build/data/Badge/Badge.styled.js +10 -11
- package/build/data/Badge/Badge.styled.js.map +1 -1
- package/build/inputs/CompactTextInput/CompactTextInput.js +2 -2
- package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
- package/build/inputs/CompactTextInput/CompactTextInput.styled.js +107 -117
- package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.js +184 -105
- package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.styled.js +123 -111
- package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
- package/build/inputs/TextArea/TextArea.js +5 -5
- package/build/inputs/TextArea/TextArea.js.map +1 -1
- package/build/inputs/TextArea/TextArea.styled.js +48 -56
- package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
- package/build/utils/defaultTheme.js +10 -1
- package/build/utils/defaultTheme.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js +8 -8
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +2 -2
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\n// import { nanoid } from 'nanoid';\nimport * as S from './MultiSelect.styled';\n\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\n\n/**\n * Multi-select with autocomplete and support for asynchronous fetching/filtering of\n * available options with pagination, update handling with callback,\n * and the ability for the end-user to create new options.\n *\n * The component uses [react-select](https://react-select.com/) for the main select functionality,\n * with [react-select-async-paginate](https://www.npmjs.com/package/react-select-async-paginate) for pagination.\n *\n *\n * <br />### Import\n *\n * ``` js\n * import { MultiSelect } from '@ntbjs/react-components/inputs'\n * // or\n * import MultiSelect from '@ntbjs/react-components/inputs/MultiSelect'\n * ```\n *\n * <br />## Option `object` format\n * Options are represented by an `Array` of `objects` with the following format:\n *\n * ``` js\n * {\n * value: \"Example\",\n * label: \"Example\"\n * }\n * ```\n *\n * The `label` is what will visible to the end-user. Whether `value` and `label`\n * should be different will depend on your use-case, but they are not required to.\n *\n *\n * <br />## Update handling\n * Changes from the end-user to the selected/available options can be handled with a callback function\n * passed through the `onUpdateCallback` prop, which is triggered any time the selected values change.\n *\n * The callback function will be passed two arguments:\n * * `action: string`\n * * `updatedOption: object`\n *\n * <br />#### `action`\n * A `string` indicating what kind of update was made.\n *\n * The possible values of `action` are:\n * * `create-option`: an option that didn't exist in the original list of available options were added\n * * `select-option`: an option was selected\n * * `deselect-option`: an option was de-selected by clicking the X in the dropdown menu\n * * `remove-value`: an option was de-selected by clicking the X on the option label/box\n * * `pop-value`: an option was de-selected with backspace\n * * `clear`: all options were de-selected by clicking the clear indicator (not currently in use)\n *\n * <br />#### `updatedOption`\n * Option `object`of the updated option:\n *\n * In addition to the default `value` and `label` keys, an `__isNew__` flag will be present if the option was\n * not part of the original list of available options, i.e. created by the user in the current \"session\".\n * This is the case regardless of whether the list is provided through `availableOptions` or\n * asynchronously through `loadOptions`.\n *\n *\n * <br />## Asynchronous fetching/filtering with pagination\n * The list of available options can be fetched and filtered asynchronously with a `Promise`\n * passed through the `loadOptions` prop.\n *\n * It will be passed two arguments:\n *\n * * `inputValue: string`: current input value/search\n * * `prevOptions: Array`: previously loaded options for the current search\n *\n * The function is triggered and the first page is fetched when the dropdown menu opens.\n * Whenever the user scrolls down to the bottom of the list, `loadOptions` will\n * be triggered again to fetch the next page.\n *\n * The `Promise` should return an `object` with the following keys:\n *\n * ``` js\n * {\n * options: Array,\n * hasMore: boolean\n * }\n * ```\n *\n * `options` should contain the current page of options. It will be concatenated to the previous\n * set of options automatically. The `hasMore` flag indicates whether there is another page to be fetched.\n *\n * **Example:**\n *\n * ``` js\n *\n * const availableOptions = [\n * { value: \"Example 1\", label: \"Example 1\" },\n * ...\n * { value: \"Example N\", label: \"Example N\" }\n * ];\n *\n * const filterOptions = inputValue => {\n * return availableOptions.filter(option => {\n * return option.label.toLowerCase().includes(inputValue.toLowerCase());\n * });\n * };\n *\n * const loadOptionsFunc = (inputValue, prevOptions) => {\n * const currentLength = prevOptions.length;\n * const pageLength = 10;\n *\n * let filteredOptions;\n *\n * if (inputValue) {\n * filteredOptions = filterOptions(inputValue);\n * } else {\n * filteredOptions = availableOptions;\n * }\n *\n * const hasMore = filteredOptions.length > currentLength + pageLength;\n * const slicedOptions = filteredOptions.slice(currentLength, currentLength + pageLength);\n *\n * return {\n * options: slicedOptions,\n * hasMore\n * };\n * };\n *\n * const loadOptions = (inputValue, prevOptions) => {\n * return new Promise(resolve => {\n * resolve(loadOptionsFunc(inputValue, prevOptions));\n * });\n * };\n * ```\n *\n * While waiting for the `Promise` to resolve, the component will be in a loading state.\n * The loading state is showcased in the \"Primary With Fetching Timeout\" Story.\n *\n * <br />#### Without asynchronous fetching/filtering\n * If you wish to not use asynchronous fetching/filtering, leave the `loadOptions` prop undefined\n * and pass the `Array` of all available options to the `availableOptions` prop instead.\n * The component will use the built-in filtering on `label` from `react-select`, and the options\n * will not be paginated.\n *\n *\n * <br />## \"Show more\" overlay\n * The \"Show more\" overlay must be set manually with the `showMore` prop.\n *\n * By default, the total number\n * of selected options will be displayed in parenthesis after the \"Show more\" text. This can be\n * disabled with the `displayTotalOnShowMore` prop.\n *\n * **Note:**\n * <br />The component has been given a max-width in these Stories.\n * This is because the \"Show more\" overlay does not work well visually when there are\n * fewer than three rows of selected options. The component itself does not have\n * a max-width, so keep this in mind when using it.\n *\n * <br />\n */\nconst MultiSelect = React.forwardRef(function MultiSelect(\n {\n // label,\n selectedOptions,\n availableOptions,\n loadOptions,\n loadingMessageFunc,\n onUpdateCallback,\n editText,\n createNewOptionMessageFunc,\n noOptionsMessageFunc,\n onMultiValueClick,\n showMore,\n showMoreText,\n displayTotalOnShowMore,\n creatable,\n readOnly,\n hidden,\n disabled,\n error,\n warning,\n ...props\n },\n forwardedRef\n) {\n // const [uniqueId] = useState(nanoid());\n const [selected, setSelected] = useState(selectedOptions);\n const [focused, setFocused] = useState(false);\n const [displayShowMore, setDisplayShowMore] = useState(error || warning ? false : showMore);\n const [cacheUnique, setCacheUnique] = useState(0);\n\n useEffect(() => {\n setSelected(selectedOptions);\n }, [selectedOptions]);\n\n const handleShowMoreClick = () => {\n setDisplayShowMore(false);\n };\n\n /**\n * Inner components to replace the default components of 'react-select'.\n * This is to add classnames, custom styling and functionality.\n *\n * Some of these are defined here, inside of the main MultiSelect,\n * because they use our props for custom styling/functionality.\n * The ones that don't are defined outside of (below) the main component.\n */\n // const Control = useMemo(() => {\n // const ControlWrapper = innerProps => {\n // return <S.Control className=\"multi-select-control\" readOnly={readOnly} {...innerProps} />;\n // };\n // ControlWrapper.displayName = 'ControlWrapper';\n // return ControlWrapper;\n // }, []);\n\n // const ValueContainer = useMemo(() => {\n // const ValueContainerWrapper = innerProps => {\n // return (\n // <>\n // {label && <S.Label htmlFor={uniqueId}>{label}</S.Label>}\n // <S.ValueContainer\n // showMore={displayShowMore}\n // $error={error}\n // $warning={warning}\n // className=\"multi-select-values-container\"\n // {...innerProps}\n // />\n // </>\n // );\n // };\n // ValueContainerWrapper.displayName = 'ValueContainerWrapper';\n // return ValueContainerWrapper;\n // }, [displayShowMore, error, warning]);\n\n const MultiValue = innerProps => {\n return (\n <S.MultiValueWrapper\n className=\"multi-value-wrapper\"\n onMouseDown={e => {\n e.stopPropagation();\n\n if (\n onMultiValueClick &&\n innerProps.data &&\n !(e.target.role === 'button' || e.target instanceof SVGElement)\n ) {\n onMultiValueClick(innerProps.data);\n }\n }}\n >\n <S.MultiValue className=\"multi-value\" readOnly={readOnly} {...innerProps} />\n </S.MultiValueWrapper>\n );\n };\n\n // const Input = useMemo(() => {\n // const InputWrapper = innerProps => {\n // return (\n // <S.Input\n // className=\"multi-select-input\"\n // $focused={focused}\n // edittext={editText}\n // {...innerProps}\n // isDisabled={readOnly || disabled}\n // />\n // );\n // };\n // InputWrapper.displayName = 'InputWrapper';\n // return InputWrapper;\n // }, [focused]);\n\n /**\n * Replace inner components of 'react-select'\n */\n const innerComponents = {\n DropdownIndicator: null,\n // Control,\n MultiValue,\n MultiValueRemove: innerProps => {\n return readOnly || disabled ? false : MultiValueRemove(innerProps);\n },\n // ValueContainer,\n // Input,\n Menu,\n Option: innerProps => {\n return innerProps.isSelected ? SelectedOption(innerProps) : Option(innerProps);\n }\n };\n\n /**\n * Props from 'react-select'/'react-select-async-paginate' shared by the different Select versions\n */\n const sharedSelectProps = {\n ref: forwardedRef,\n value: selected,\n options: loadOptions ? undefined : availableOptions,\n loadOptions: loadOptions,\n loadingMessage: loadingMessageFunc,\n editText: editText,\n formatCreateLabel: createNewOptionMessageFunc,\n showMore: displayShowMore,\n readOnly: readOnly,\n isDisabled: disabled,\n components: innerComponents,\n focused: focused,\n isMulti: true,\n isClearable: false,\n placeholder: null,\n closeMenuOnSelect: false,\n hideSelectedOptions: false,\n cacheUniqs: loadOptions ? [cacheUnique] : undefined,\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n\n noOptionsMessage: input => {\n return noOptionsMessageFunc(input.inputValue);\n },\n\n onChange: (selectedOptions, actionMeta) => {\n switch (actionMeta.action) {\n case 'create-option':\n if (onUpdateCallback) {\n onUpdateCallback(actionMeta.action, actionMeta.option);\n }\n\n if (loadOptions) {\n setCacheUnique(cacheUnique + 1);\n }\n\n setSelected(selectedOptions);\n break;\n\n case 'select-option':\n if (onUpdateCallback) {\n onUpdateCallback(actionMeta.action, actionMeta.option);\n }\n\n setSelected(selectedOptions);\n break;\n\n case 'remove-value':\n if (onUpdateCallback) {\n onUpdateCallback(actionMeta.action, actionMeta.removedValue);\n }\n\n setSelected(selectedOptions);\n break;\n\n case 'pop-value':\n if (onUpdateCallback) {\n onUpdateCallback(actionMeta.action, actionMeta.removedValue);\n }\n\n setSelected(selectedOptions);\n break;\n\n case 'deselect-option':\n if (onUpdateCallback) {\n onUpdateCallback(actionMeta.action, actionMeta.option);\n }\n\n setSelected(selectedOptions);\n break;\n\n case 'clear':\n // Does currently not occur as 'isClearable' is always set to false\n break;\n\n default:\n if (onUpdateCallback) {\n onUpdateCallback(actionMeta.action, actionMeta.option);\n }\n\n setSelected(selectedOptions);\n break;\n }\n }\n };\n\n if (hidden) return null;\n\n return (\n <S.MultiSelectWrapper $error={error} $warning={warning}>\n {loadOptions ? (\n creatable ? (\n <S.AsyncCreatableMultiSelect {...sharedSelectProps} {...props} />\n ) : (\n <S.AsyncMultiSelect {...sharedSelectProps} {...props} />\n )\n ) : creatable ? (\n <S.CreatableMultiSelect {...sharedSelectProps} {...props} />\n ) : (\n <S.MultiSelect {...sharedSelectProps} {...props} />\n )}\n {displayShowMore && !(error || warning) && (\n <S.ShowMoreWrapper onClick={handleShowMoreClick}>\n <S.ShowMoreOverlay></S.ShowMoreOverlay>\n <S.ShowMoreText>\n {showMoreText} {displayTotalOnShowMore && '(' + selected.length + ')'}\n </S.ShowMoreText>\n </S.ShowMoreWrapper>\n )}\n {(typeof error === 'string' || typeof warning === 'string') && (\n <S.ErrorMessage $error={error} $warning={warning}>\n {error ? error : warning}\n </S.ErrorMessage>\n )}\n </S.MultiSelectWrapper>\n );\n});\n\nMultiSelect.propTypes = {\n /**\n *\n * The label of the input field – leave `undefined` to hide the label\n */\n label: PropTypes.string,\n /**\n * `Array` of `objects` containing the default options. This is only needed\n * when asynchronous option fetching with the `loadOptions` prop is not used.\n *\n * **Note:**\n * <br />This will be overridden by the `loadOptions` prop if both props are set.\n */\n availableOptions: PropTypes.arrayOf(PropTypes.object),\n\n /**\n * `Array` of `objects` containing the selected options.\n */\n selectedOptions: PropTypes.arrayOf(PropTypes.object),\n\n /**\n * Function with a `Promise` returning filtered options.\n *\n * See [Asynchronous fetching/filtering with pagination](#asynchronous-fetchingfiltering-with-pagination)\n * for details.\n *\n * **Note:**\n * <br />This will override the `availableOptions` prop if both props are set.\n */\n loadOptions: PropTypes.func,\n\n /**\n * Function for custom \"Loading...\" message while waiting for the first page\n * from `loadOptions` to resolve. Defaults to \"Loading...\" if no function is provided.\n */\n loadingMessageFunc: PropTypes.func,\n\n /**\n * Callback function for sending updates to the backend whenever the selected values are updated.\n * See [Update handling](#update-handling) for details.\n */\n onUpdateCallback: PropTypes.func,\n\n /**\n * Text to be displayed on the input element when the component\n * is enabled and not focused – e.g. \"Add a keyword...\"\n */\n editText: PropTypes.string.isRequired,\n\n /**\n * Whether the user can create new options.\n */\n creatable: PropTypes.bool,\n\n /**\n * Callback function for formatting the message displayed in the dropdown when there\n * are no matching options, and the user has permission to create new options.\n * The callback function will be given the current input value as an argument.\n */\n createNewOptionMessageFunc: PropTypes.func,\n\n /**\n * If the list of options is empty, or if the current input value doesn't match\n * any of the available options and the user doesn't have permission to add options,\n * this function will be called and passed the current input value as an argument.\n */\n noOptionsMessageFunc: PropTypes.func,\n\n /**\n * Optional callback function to be trigger when clicking a selected option's label – e.g. opening\n * a search filtered on the given multi-value's `label`.\n *\n * The callback function will be passed the option `object` as an argument.\n */\n onMultiValueClick: PropTypes.func,\n\n /**\n * Display an overlay which the user needs to click in order to\n * show the selected options list in its entirety and edit it.\n */\n showMore: PropTypes.bool,\n\n /**\n * Text displayed on the \"Show more\" overlay.\n */\n showMoreText: PropTypes.string,\n\n /**\n * Whether to display the total number of selected options after the show more text.\n */\n displayTotalOnShowMore: PropTypes.bool,\n\n /**\n * Whether the multi-select should be displayed in read-only mode.\n * The user can still click the selected options to trigger their on-click effect.\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n\n /**\n * Whether the multi-select should be disabled.\n * The user will not be able to trigger the on-click effect of the selected options.\n */\n disabled: PropTypes.bool,\n\n /**\n * Set to `true` to display a red border indicating an error.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n\n /**\n * Set to `true` to display an orange border.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])\n};\n\nMultiSelect.defaultProps = {\n noOptionsMessageFunc: inputValue => {\n if (inputValue) {\n return `No matches for \"${inputValue}\"`;\n } else {\n return 'No available options';\n }\n },\n showMore: false,\n displayTotalOnShowMore: true,\n readOnly: false,\n disabled: false,\n creatable: false,\n error: false,\n warning: false,\n showMoreText: 'Show more',\n hidden: false\n};\n\n/**\n * Inner components to replace the default inner components of 'react-select'.\n * This is to add classnames, custom styling and functionality.\n *\n * Some are defined inside of the main MultiSelect component, as they use our props\n * for prop/state dependent functionality and styling. The ones below do not.\n */\nconst MultiValueRemove = innerProps => {\n return (\n <S.MultiValueRemove {...innerProps}>\n <CloseIcon className=\"multi-value-remove-icon\" />\n </S.MultiValueRemove>\n );\n};\n\nconst Menu = innerProps => {\n return <S.DropdownMenu {...innerProps} />;\n};\n\nconst Option = innerProps => {\n return <S.Option className=\"multi-select-dropdown-item\" {...innerProps} />;\n};\n\nconst SelectedOption = innerProps => {\n return (\n <S.SelectedOption {...innerProps}>\n {innerProps.label}\n <S.DropdownOptionDeleteIcon />\n </S.SelectedOption>\n );\n};\n\nexport default MultiSelect;\n"],"names":["MultiSelect","React","forwardRef","selectedOptions","availableOptions","loadOptions","loadingMessageFunc","onUpdateCallback","editText","createNewOptionMessageFunc","noOptionsMessageFunc","onMultiValueClick","showMore","showMoreText","displayTotalOnShowMore","creatable","readOnly","hidden","disabled","error","warning","props","forwardedRef","selected","setSelected","useState","focused","setFocused","displayShowMore","setDisplayShowMore","cacheUnique","setCacheUnique","useEffect","handleShowMoreClick","MultiValue","innerProps","createElement","S","className","onMouseDown","e","stopPropagation","data","target","role","SVGElement","_extends","innerComponents","DropdownIndicator","MultiValueRemove","Menu","Option","isSelected","SelectedOption","sharedSelectProps","ref","value","options","undefined","loadingMessage","formatCreateLabel","isDisabled","components","isMulti","isClearable","placeholder","closeMenuOnSelect","hideSelectedOptions","cacheUniqs","onFocus","onBlur","noOptionsMessage","input","inputValue","onChange","actionMeta","action","option","removedValue","$error","$warning","onClick","length","propTypes","process","env","NODE_ENV","label","PropTypes","string","arrayOf","object","func","isRequired","bool","oneOfType","defaultProps","CloseIcon"],"mappings":";;;;;;AAgKMA,MAAAA,WAAW,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,WAAWA,CACvD;EAEEG,eAAe;EACfC,gBAAgB;EAChBC,WAAW;EACXC,kBAAkB;EAClBC,gBAAgB;EAChBC,QAAQ;EACRC,0BAA0B;EAC1BC,oBAAoB;EACpBC,iBAAiB;EACjBC,QAAQ;EACRC,YAAY;EACZC,sBAAsB;EACtBC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,OAAO;EACP,GAAGC,KAAAA;AACL,CAAC,EACDC,YAAY,EACZ;EAEA,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGC,QAAQ,CAACtB,eAAe,CAAC,CAAA;EACzD,MAAM,CAACuB,OAAO,EAAEC,UAAU,CAAC,GAAGF,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC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,EAAAS,QAAA,CAAA;AAACR,IAAAA,SAAS,EAAC,4BAAA;GAAiCH,EAAAA,UAAU,CAAG,CAAC,CAAA;AAC5E,CAAC,CAAA;AAED,MAAMkB,cAAc,GAAGlB,UAAU,IAAI;EACnC,OACElC,cAAA,CAAAmC,aAAA,CAACC,gBAAgB,EAAKF,UAAU,EAC7BA,UAAU,CAACoD,KAAK,EACjBtF,cAAA,CAAAmC,aAAA,CAACC,wBAA0B,EAAE,IAAA,CACb,CAAC,CAAA;AAEvB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"MultiSelect.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.js"],"sourcesContent":["import React, { useState, useMemo, useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { nanoid } from 'nanoid';\nimport { components } from 'react-select';\nimport * as S from './MultiSelect.styled';\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\n\n/**\n * Multi-select with autocomplete and support for asynchronous fetching/filtering of\n * available options with pagination, update handling with callback,\n * and the ability for the end-user to create new options.\n *\n * The component uses [react-select](https://react-select.com/) for the main select functionality,\n * with [react-select-async-paginate](https://www.npmjs.com/package/react-select-async-paginate) for pagination.\n *\n *\n * <br />### Import\n *\n * ``` js\n * import { MultiSelect } from '@ntbjs/react-components/inputs'\n * // or\n * import MultiSelect from '@ntbjs/react-components/inputs/MultiSelect'\n * ```\n *\n * <br />## Option `object` format\n * Options are represented by an `Array` of `objects` with the following format:\n *\n * ``` js\n * {\n * value: \"Example\",\n * label: \"Example\"\n * }\n * ```\n *\n * The `label` is what will visible to the end-user. Whether `value` and `label`\n * should be different will depend on your use-case, but they are not required to.\n *\n *\n * <br />## Update handling\n * Changes from the end-user to the selected/available options can be handled with a callback function\n * passed through the `onUpdateCallback` prop, which is triggered any time the selected values change.\n *\n * The callback function will be passed two arguments:\n * * `action: string`\n * * `updatedOption: object`\n *\n * <br />#### `action`\n * A `string` indicating what kind of update was made.\n *\n * The possible values of `action` are:\n * * `create-option`: an option that didn't exist in the original list of available options were added\n * * `select-option`: an option was selected\n * * `deselect-option`: an option was de-selected by clicking the X in the dropdown menu\n * * `remove-value`: an option was de-selected by clicking the X on the option label/box\n * * `pop-value`: an option was de-selected with backspace\n * * `clear`: all options were de-selected by clicking the clear indicator (not currently in use)\n *\n * <br />#### `updatedOption`\n * Option `object`of the updated option:\n *\n * In addition to the default `value` and `label` keys, an `__isNew__` flag will be present if the option was\n * not part of the original list of available options, i.e. created by the user in the current \"session\".\n * This is the case regardless of whether the list is provided through `availableOptions` or\n * asynchronously through `loadOptions`.\n *\n *\n * <br />## Asynchronous fetching/filtering with pagination\n * The list of available options can be fetched and filtered asynchronously with a `Promise`\n * passed through the `loadOptions` prop.\n *\n * It will be passed two arguments:\n *\n * * `inputValue: string`: current input value/search\n * * `prevOptions: Array`: previously loaded options for the current search\n *\n * The function is triggered and the first page is fetched when the dropdown menu opens.\n * Whenever the user scrolls down to the bottom of the list, `loadOptions` will\n * be triggered again to fetch the next page.\n *\n * The `Promise` should return an `object` with the following keys:\n *\n * ``` js\n * {\n * options: Array,\n * hasMore: boolean\n * }\n * ```\n *\n * `options` should contain the current page of options. It will be concatenated to the previous\n * set of options automatically. The `hasMore` flag indicates whether there is another page to be fetched.\n *\n * **Example:**\n *\n * ``` js\n *\n * const availableOptions = [\n * { value: \"Example 1\", label: \"Example 1\" },\n * ...\n * { value: \"Example N\", label: \"Example N\" }\n * ];\n *\n * const filterOptions = inputValue => {\n * return availableOptions.filter(option => {\n * return option.label.toLowerCase().includes(inputValue.toLowerCase());\n * });\n * };\n *\n * const loadOptionsFunc = (inputValue, prevOptions) => {\n * const currentLength = prevOptions.length;\n * const pageLength = 10;\n *\n * let filteredOptions;\n *\n * if (inputValue) {\n * filteredOptions = filterOptions(inputValue);\n * } else {\n * filteredOptions = availableOptions;\n * }\n *\n * const hasMore = filteredOptions.length > currentLength + pageLength;\n * const slicedOptions = filteredOptions.slice(currentLength, currentLength + pageLength);\n *\n * return {\n * options: slicedOptions,\n * hasMore\n * };\n * };\n *\n * const loadOptions = (inputValue, prevOptions) => {\n * return new Promise(resolve => {\n * resolve(loadOptionsFunc(inputValue, prevOptions));\n * });\n * };\n * ```\n *\n * While waiting for the `Promise` to resolve, the component will be in a loading state.\n * The loading state is showcased in the \"Primary With Fetching Timeout\" Story.\n *\n * <br />#### Without asynchronous fetching/filtering\n * If you wish to not use asynchronous fetching/filtering, leave the `loadOptions` prop undefined\n * and pass the `Array` of all available options to the `availableOptions` prop instead.\n * The component will use the built-in filtering on `label` from `react-select`, and the options\n * will not be paginated.\n *\n *\n * <br />## \"Show more\" overlay\n * The \"Show more\" overlay must be set manually with the `showMore` prop.\n *\n * By default, the total number\n * of selected options will be displayed in parenthesis after the \"Show more\" text. This can be\n * disabled with the `displayTotalOnShowMore` prop.\n *\n * **Note:**\n * <br />The component has been given a max-width in these Stories.\n * This is because the \"Show more\" overlay does not work well visually when there are\n * fewer than three rows of selected options. The component itself does not have\n * a max-width, so keep this in mind when using it.\n *\n * <br />\n */\n\nconst reactSelectTheme = theme => ({\n ...theme,\n spacing: {\n baseUnit: 4,\n controlHeight: 38,\n menuGutter: 8\n }\n});\n\nconst MultiSelect = React.forwardRef(function MultiSelect(\n {\n label,\n selectedOptions = [],\n availableOptions,\n loadOptions,\n loadingMessageFunc,\n onUpdateCallback,\n editText,\n creatable,\n readOnly,\n hidden,\n disabled,\n error,\n warning,\n onMultiValueClick,\n showMore,\n showMoreText = 'Show more',\n displayTotalOnShowMore = true,\n noOptionsMessageFunc,\n ...props\n },\n forwardedRef\n) {\n const [uniqueId] = useState(nanoid());\n const [selected, setSelected] = useState(selectedOptions);\n const [focused, setFocused] = useState(false);\n const [displayShowMore, setDisplayShowMore] = useState(error || warning ? false : showMore);\n const [cacheUnique, setCacheUnique] = useState(0);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const wrapperRef = useRef(null);\n const selectRef = useRef(null);\n\n useEffect(() => {\n setSelected(selectedOptions);\n }, [selectedOptions]);\n\n // Handle clicks outside the component to close the menu\n useEffect(() => {\n function handleClickOutside(event) {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {\n setIsMenuOpen(false);\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n\n // Handle clicks inside the wrapper to open the menu\n const handleWrapperClick = event => {\n if (readOnly || disabled) return;\n\n // Check if clicking on a remove button\n const isRemoveButton =\n event.target.closest('.multi-select__multi-value__remove') ||\n event.target.closest('[role=\"button\"]') ||\n event.target instanceof SVGElement ||\n event.target.closest('svg');\n\n if (!isRemoveButton && !isMenuOpen) {\n // Open the menu by focusing the select\n if (selectRef.current) {\n selectRef.current.focus();\n }\n setIsMenuOpen(true);\n }\n };\n\n const getNoOptionsMessage = inputValue => {\n if (typeof noOptionsMessageFunc === 'function') {\n return noOptionsMessageFunc(inputValue);\n }\n return inputValue ? `No matches for \"${inputValue}\"` : 'No available options';\n };\n\n /**\n * Inner components to replace the default components of 'react-select'.\n * This is to add classnames, custom styling and functionality.\n */\n const innerComponents = {\n DropdownIndicator: null,\n /* eslint-disable react/prop-types */\n MultiValue: ({ data, ...props }) => {\n return (\n <div\n className=\"multi-value-wrapper\"\n onMouseDown={e => {\n if (\n onMultiValueClick &&\n data &&\n !(e.target.role === 'button' || e.target instanceof SVGElement)\n ) {\n e.stopPropagation();\n onMultiValueClick(data);\n }\n }}\n >\n <S.MultiValue data={data} $isDisabled={disabled} $isReadOnly={readOnly} {...props} />\n </div>\n );\n },\n /* eslint-enable react/prop-types */\n MultiValueRemove: props => {\n if (readOnly || disabled) return null;\n return (\n <components.MultiValueRemove {...props}>\n <CloseIcon />\n </components.MultiValueRemove>\n );\n },\n Input: inputProps => (\n <S.InputWrapper\n $focused={focused}\n $editText={!readOnly && !disabled ? editText : ''}\n $isDisabled={readOnly || disabled}\n $isMenuOpen={isMenuOpen}\n >\n <components.Input {...inputProps} />\n </S.InputWrapper>\n ),\n Menu: menuProps => <S.DropdownMenu {...menuProps} />,\n Option: optProps =>\n optProps.isSelected ? (\n <S.SelectedOption {...optProps}>\n <span>{optProps.label}</span>\n <S.DropdownOptionDeleteIcon />\n </S.SelectedOption>\n ) : (\n <S.Option {...optProps} />\n )\n };\n\n /**\n * Custom styles for react-select components\n */\n const selectStyles = useMemo(\n () => ({\n control: base => ({\n ...base,\n alignItems: 'flex-start',\n background: 'transparent',\n border: 'none',\n boxShadow: 'none',\n minHeight: 'unset',\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n valueContainer: base => ({\n ...base,\n padding: 0,\n gap: '8px',\n maxHeight: displayShowMore && !(error || warning) ? '130px' : '100%',\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n input: base => ({\n ...base,\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n menu: base => ({\n ...base,\n backgroundColor: 'transparent',\n boxShadow: 'none'\n }),\n menuList: base => ({\n ...base,\n backgroundColor: 'transparent'\n }),\n option: base => ({\n ...base,\n backgroundColor: 'transparent',\n color: 'inherit'\n }),\n multiValue: base => ({\n ...base,\n margin: 0,\n border: 'none',\n background: 'none',\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n multiValueLabel: base => ({\n ...base,\n padding: 0,\n cursor: readOnly || disabled ? 'default' : 'pointer'\n }),\n multiValueRemove: base => ({\n ...base,\n padding: 0,\n cursor: readOnly || disabled ? 'default' : 'pointer'\n })\n }),\n [error, warning, displayShowMore, readOnly, disabled]\n );\n\n /**\n * Props from 'react-select'/'react-select-async-paginate' shared by the different Select versions\n */\n const sharedProps = {\n ...props,\n ref: node => {\n selectRef.current = node;\n if (forwardedRef) {\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else {\n forwardedRef.current = node;\n }\n }\n },\n classNamePrefix: 'multi-select',\n value: selected,\n options: loadOptions ? undefined : availableOptions,\n loadOptions,\n loadingMessage: loadingMessageFunc,\n theme: reactSelectTheme,\n styles: selectStyles,\n components: innerComponents,\n isMulti: true,\n isClearable: false,\n placeholder: null,\n isDisabled: disabled,\n readOnly: readOnly,\n closeMenuOnSelect: false,\n hideSelectedOptions: false,\n openMenuOnClick: true,\n openMenuOnFocus: true,\n blurInputOnSelect: false,\n menuIsOpen: isMenuOpen ? true : undefined,\n cacheUniqs: loadOptions ? [cacheUnique] : undefined,\n onMenuOpen: () => {\n setIsMenuOpen(true);\n },\n onMenuClose: () => {\n setIsMenuOpen(false);\n },\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n noOptionsMessage: ({ inputValue }) => getNoOptionsMessage(inputValue),\n onChange: (selectedOptions, actionMeta) => {\n if (props.onChange) {\n props.onChange(selectedOptions, actionMeta);\n }\n\n if (onUpdateCallback) {\n const updatedItem = actionMeta.option || actionMeta.removedValue;\n onUpdateCallback(actionMeta.action, updatedItem);\n }\n\n setSelected(selectedOptions);\n\n if (actionMeta.action === 'create-option' && loadOptions) {\n setCacheUnique(cacheUnique + 1);\n }\n }\n };\n\n if (hidden) return null;\n\n return (\n <S.MultiSelectWrapper ref={wrapperRef} onClick={handleWrapperClick}>\n {label && <S.Label htmlFor={uniqueId}>{label}</S.Label>}\n <S.InnerWrapper $error={error} $warning={warning}>\n {loadOptions ? (\n creatable ? (\n <S.AsyncCreatableMultiSelect {...sharedProps} />\n ) : (\n <S.AsyncMultiSelect {...sharedProps} />\n )\n ) : creatable ? (\n <S.CreatableMultiSelect {...sharedProps} />\n ) : (\n <S.MultiSelect {...sharedProps} />\n )}\n </S.InnerWrapper>\n {displayShowMore && !(error || warning) && (\n <S.ShowMoreWrapper\n onClick={e => {\n e.stopPropagation();\n setDisplayShowMore(false);\n }}\n >\n <S.ShowMoreOverlay />\n <S.ShowMoreText>\n {showMoreText} {displayTotalOnShowMore && `(${selected.length})`}\n </S.ShowMoreText>\n </S.ShowMoreWrapper>\n )}\n {(typeof error === 'string' || typeof warning === 'string') && (\n <S.ErrorMessage $error={error} $warning={warning}>\n {error ? error : warning}\n </S.ErrorMessage>\n )}\n </S.MultiSelectWrapper>\n );\n});\n\nMultiSelect.propTypes = {\n /**\n *\n * The label of the input field — leave `undefined` to hide the label\n */\n label: PropTypes.string,\n /**\n * `Array` of `objects` containing the default options. This is only needed\n * when asynchronous option fetching with the `loadOptions` prop is not used.\n *\n * **Note:**\n * <br />This will be overridden by the `loadOptions` prop if both props are set.\n */\n availableOptions: PropTypes.arrayOf(PropTypes.object),\n\n /**\n * `Array` of `objects` containing the selected options.\n */\n selectedOptions: PropTypes.arrayOf(PropTypes.object),\n\n /**\n * Function with a `Promise` returning filtered options.\n *\n * See [Asynchronous fetching/filtering with pagination](#asynchronous-fetchingfiltering-with-pagination)\n * for details.\n *\n * **Note:**\n * <br />This will override the `availableOptions` prop if both props are set.\n */\n loadOptions: PropTypes.func,\n\n /**\n * Function for custom \"Loading...\" message while waiting for the first page\n * from `loadOptions` to resolve. Defaults to \"Loading...\" if no function is provided.\n */\n loadingMessageFunc: PropTypes.func,\n\n /**\n * Callback function for sending updates to the backend whenever the selected values are updated.\n * See [Update handling](#update-handling) for details.\n */\n onUpdateCallback: PropTypes.func,\n\n /**\n * Text to be displayed on the input element when the component\n * is enabled and not focused — e.g. \"Add a keyword...\"\n */\n editText: PropTypes.string.isRequired,\n\n /**\n * Whether the user can create new options.\n */\n creatable: PropTypes.bool,\n\n /**\n * Callback function for formatting the message displayed in the dropdown when there\n * are no matching options, and the user has permission to create new options.\n * The callback function will be given the current input value as an argument.\n */\n createNewOptionMessageFunc: PropTypes.func,\n\n /**\n * If the list of options is empty, or if the current input value doesn't match\n * any of the available options and the user doesn't have permission to add options,\n * this function will be called and passed the current input value as an argument.\n */\n noOptionsMessageFunc: PropTypes.func,\n\n /**\n * Optional callback function to be trigger when clicking a selected option's label — e.g. opening\n * a search filtered on the given multi-value's `label`.\n *\n * The callback function will be passed the option `object` as an argument.\n */\n onMultiValueClick: PropTypes.func,\n\n /**\n * Display an overlay which the user needs to click in order to\n * show the selected options list in its entirety and edit it.\n */\n showMore: PropTypes.bool,\n\n /**\n * Text displayed on the \"Show more\" overlay.\n */\n showMoreText: PropTypes.string,\n\n /**\n * Whether to display the total number of selected options after the show more text.\n */\n displayTotalOnShowMore: PropTypes.bool,\n\n /**\n * Whether the multi-select should be displayed in read-only mode.\n * The user can still click the selected options to trigger their on-click effect.\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n\n /**\n * Whether the multi-select should be disabled.\n * The user will not be able to trigger the on-click effect of the selected options.\n */\n disabled: PropTypes.bool,\n\n /**\n * Set to `true` to display a red border indicating an error.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n\n /**\n * Set to `true` to display an orange border.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n\n /**\n * Optional onChange handler that receives the selected options and action metadata.\n */\n onChange: PropTypes.func\n};\n\nMultiSelect.defaultProps = {\n noOptionsMessageFunc: inputValue => {\n if (inputValue) {\n return `No matches for \"${inputValue}\"`;\n } else {\n return 'No available options';\n }\n },\n showMore: false,\n displayTotalOnShowMore: true,\n readOnly: false,\n disabled: false,\n creatable: false,\n error: false,\n warning: false,\n showMoreText: 'Show more',\n hidden: false\n};\n\nexport default MultiSelect;\n"],"names":["reactSelectTheme","theme","spacing","baseUnit","controlHeight","menuGutter","MultiSelect","React","forwardRef","label","selectedOptions","availableOptions","loadOptions","loadingMessageFunc","onUpdateCallback","editText","creatable","readOnly","hidden","disabled","error","warning","onMultiValueClick","showMore","showMoreText","displayTotalOnShowMore","noOptionsMessageFunc","props","forwardedRef","uniqueId","useState","nanoid","selected","setSelected","focused","setFocused","displayShowMore","setDisplayShowMore","cacheUnique","setCacheUnique","isMenuOpen","setIsMenuOpen","wrapperRef","useRef","selectRef","useEffect","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","handleWrapperClick","isRemoveButton","closest","SVGElement","focus","getNoOptionsMessage","inputValue","innerComponents","DropdownIndicator","MultiValue","data","createElement","className","onMouseDown","e","role","stopPropagation","S","_extends","$isDisabled","$isReadOnly","MultiValueRemove","components","CloseIcon","Input","inputProps","$focused","$editText","$isMenuOpen","Menu","menuProps","Option","optProps","isSelected","selectStyles","useMemo","control","base","alignItems","background","border","boxShadow","minHeight","cursor","valueContainer","padding","gap","maxHeight","input","menu","backgroundColor","menuList","option","color","multiValue","margin","multiValueLabel","multiValueRemove","sharedProps","ref","node","classNamePrefix","value","options","undefined","loadingMessage","styles","isMulti","isClearable","placeholder","isDisabled","closeMenuOnSelect","hideSelectedOptions","openMenuOnClick","openMenuOnFocus","blurInputOnSelect","menuIsOpen","cacheUniqs","onMenuOpen","onMenuClose","onFocus","onBlur","noOptionsMessage","onChange","actionMeta","updatedItem","removedValue","action","onClick","htmlFor","$error","$warning","length","propTypes","process","env","NODE_ENV","PropTypes","string","arrayOf","object","func","isRequired","bool","createNewOptionMessageFunc","oneOfType","defaultProps"],"mappings":";;;;;;;;AAkKA,MAAMA,gBAAgB,GAAGC,KAAK,KAAK;AACjC,EAAA,GAAGA,KAAK;AACRC,EAAAA,OAAO,EAAE;AACPC,IAAAA,QAAQ,EAAE,CAAC;AACXC,IAAAA,aAAa,EAAE,EAAE;AACjBC,IAAAA,UAAU,EAAE,CAAA;AACd,GAAA;AACF,CAAC,CAAC,CAAA;AAEIC,MAAAA,WAAW,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,WAAWA,CACvD;EACEG,KAAK;AACLC,EAAAA,eAAe,GAAG,EAAE;EACpBC,gBAAgB;EAChBC,WAAW;EACXC,kBAAkB;EAClBC,gBAAgB;EAChBC,QAAQ;EACRC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACNC,QAAQ;EACRC,KAAK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AE,KAAK;AACfH,EAAAA,SAAS,EAAE,KAAK;AAChBI,EAAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,OAAO,EAAE,KAAK;AACdG,EAAAA,YAAY,EAAE,WAAW;AACzBN,EAAAA,MAAM,EAAE,KAAA;AACV,CAAC;;;;"}
|
|
@@ -5,15 +5,35 @@ import Select, { components } from 'react-select';
|
|
|
5
5
|
import CreatableSelect from 'react-select/creatable';
|
|
6
6
|
import { withAsyncPaginate, AsyncPaginate } from 'react-select-async-paginate';
|
|
7
7
|
|
|
8
|
-
const AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);
|
|
9
8
|
const showMoreHeight = 114;
|
|
9
|
+
const AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);
|
|
10
|
+
const shouldForwardProp = prop => {
|
|
11
|
+
return prop !== 'theme' && !prop.startsWith('$');
|
|
12
|
+
};
|
|
10
13
|
const sharedStyle = css`
|
|
11
|
-
font-family: ${props => props.theme
|
|
14
|
+
font-family: ${props => props.theme?.primaryFontFamily || 'Arial, sans-serif'};
|
|
12
15
|
font-size: 12px;
|
|
13
16
|
font-weight: 400;
|
|
14
17
|
position: relative;
|
|
15
18
|
`;
|
|
16
|
-
styled.
|
|
19
|
+
const MultiSelectWrapper = styled.div.withConfig({
|
|
20
|
+
shouldForwardProp
|
|
21
|
+
}).attrs(applyDefaultTheme)`
|
|
22
|
+
position: relative;
|
|
23
|
+
`;
|
|
24
|
+
const InnerWrapper = styled.div.withConfig({
|
|
25
|
+
shouldForwardProp
|
|
26
|
+
}).attrs(applyDefaultTheme)`
|
|
27
|
+
${props => (props.$error || props.$warning) && css`
|
|
28
|
+
border: 1px solid;
|
|
29
|
+
border-radius: 3px;
|
|
30
|
+
padding: 4px;
|
|
31
|
+
border-color: ${props.$error ? props.theme.getColor('red-500') : props.theme.getColor('orange-500')};
|
|
32
|
+
`}
|
|
33
|
+
`;
|
|
34
|
+
const Label = styled.label.withConfig({
|
|
35
|
+
shouldForwardProp
|
|
36
|
+
}).attrs(applyDefaultTheme)`
|
|
17
37
|
${props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('gray-700'))};
|
|
18
38
|
flex-basis: 33.33%;
|
|
19
39
|
font-size: 0.875rem;
|
|
@@ -23,120 +43,108 @@ styled.label.attrs(applyDefaultTheme)`
|
|
|
23
43
|
display: flex;
|
|
24
44
|
align-items: center;
|
|
25
45
|
`;
|
|
26
|
-
const MultiSelect = styled(Select).attrs(applyDefaultTheme)`
|
|
27
|
-
${sharedStyle}
|
|
28
|
-
`;
|
|
29
|
-
const CreatableMultiSelect = styled(CreatableSelect).attrs(applyDefaultTheme)`
|
|
30
|
-
${sharedStyle}
|
|
31
|
-
`;
|
|
32
|
-
const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate).attrs(applyDefaultTheme)`
|
|
33
|
-
${sharedStyle}
|
|
34
|
-
`;
|
|
35
|
-
const AsyncMultiSelect = styled(AsyncPaginate).attrs(applyDefaultTheme)`
|
|
36
|
-
${sharedStyle}
|
|
37
|
-
`;
|
|
38
|
-
const MultiSelectWrapper = styled.div.attrs(applyDefaultTheme)`
|
|
39
|
-
position: relative;
|
|
40
|
-
`;
|
|
41
|
-
styled(components.Control).attrs(applyDefaultTheme)`
|
|
42
|
-
&& {
|
|
43
|
-
align-items: flex-start;
|
|
44
|
-
background: transparent;
|
|
45
|
-
border: none;
|
|
46
|
-
box-shadow: none;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
:hover {
|
|
50
|
-
cursor: ${props => !props.isDisabled && props.focused || props.readOnly ? 'default' : 'pointer'};
|
|
51
|
-
}
|
|
52
|
-
`;
|
|
53
|
-
styled(components.ValueContainer)`
|
|
54
|
-
&& {
|
|
55
|
-
align-items: flex-start;
|
|
56
|
-
gap: 8px;
|
|
57
|
-
padding: 0;
|
|
58
|
-
|
|
59
|
-
max-height: ${props => {
|
|
60
|
-
return props.showMore ? props.$error || props.$warning ? '100%' : showMoreHeight + 16 + 'px' : '100%';
|
|
61
|
-
}} !important;
|
|
62
|
-
|
|
63
|
-
${props => (props.$error || props.$warning) && css`
|
|
64
|
-
border: 1px solid;
|
|
65
|
-
border-radius: 3px;
|
|
66
|
-
padding: 4px;
|
|
67
|
-
|
|
68
|
-
border-color: ${props => props.$error ? props.theme.getColor('red-500') : props.warning ? props.theme.getColor('orange-500') : 'inherit'};
|
|
69
|
-
`}
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
const MultiValueWrapper = styled.div.attrs(applyDefaultTheme)`
|
|
73
|
-
&& {
|
|
74
|
-
border-radius: 3px;
|
|
75
|
-
margin: 0;
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
78
46
|
const MultiValue = styled(components.MultiValue).attrs(applyDefaultTheme)`
|
|
79
47
|
&& {
|
|
80
48
|
border-radius: 3px;
|
|
81
49
|
margin: 0;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
border: none;
|
|
82
53
|
|
|
83
54
|
${props => props.theme.themeProp('background-color', props.theme.getColor('gray-600'), props.theme.getColor('gray-800'))}
|
|
84
55
|
|
|
85
|
-
${props => props
|
|
56
|
+
${props => props.$isDisabled && css`
|
|
57
|
+
opacity: 0.6;
|
|
58
|
+
cursor: not-allowed !important;
|
|
86
59
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
& > * {
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
cursor: not-allowed !important;
|
|
63
|
+
}
|
|
64
|
+
`}
|
|
65
|
+
|
|
66
|
+
${props => props.$isReadOnly && !props.$isDisabled && css`
|
|
67
|
+
cursor: default !important;
|
|
68
|
+
`}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
& > div:first-of-type {
|
|
90
72
|
font-size: 12px;
|
|
91
73
|
min-height: 26px;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
padding: ${props => props.$isDisabled || props.$isReadOnly ? '0 8px' : '0 3px 0 8px'};
|
|
77
|
+
color: ${props => props.theme.getColor('gray-100')};
|
|
78
|
+
cursor: ${props => props.$isDisabled ? 'not-allowed' : props.$isReadOnly ? 'default' : 'pointer'};
|
|
79
|
+
}
|
|
92
80
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
81
|
+
/* Target the Remove Button */
|
|
82
|
+
.multi-select__multi-value__remove,
|
|
83
|
+
& > div:last-of-type {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
padding: 0 8px 0 5px;
|
|
87
|
+
height: 26px;
|
|
88
|
+
width: fit-content;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
background-color: transparent;
|
|
102
91
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
92
|
+
${props => !props.$isDisabled && !props.$isReadOnly && css`
|
|
93
|
+
&:hover {
|
|
94
|
+
background-color: ${props.theme.getColor('red-500')} !important;
|
|
95
|
+
border-radius: 0 3px 3px 0;
|
|
96
|
+
}
|
|
97
|
+
`}
|
|
109
98
|
|
|
110
99
|
svg {
|
|
111
100
|
stroke: white;
|
|
112
101
|
stroke-width: 2px;
|
|
113
102
|
width: 8px;
|
|
114
103
|
}
|
|
115
|
-
|
|
116
|
-
:hover {
|
|
117
|
-
cursor: pointer;
|
|
118
104
|
}
|
|
119
105
|
}
|
|
120
106
|
`;
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
107
|
+
const MultiSelect = styled(Select)`
|
|
108
|
+
${sharedStyle}
|
|
109
|
+
`;
|
|
110
|
+
const CreatableMultiSelect = styled(CreatableSelect)`
|
|
111
|
+
${sharedStyle}
|
|
112
|
+
`;
|
|
113
|
+
const AsyncMultiSelect = styled(AsyncPaginate)`
|
|
114
|
+
${sharedStyle}
|
|
115
|
+
`;
|
|
116
|
+
const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate)`
|
|
117
|
+
${sharedStyle}
|
|
118
|
+
`;
|
|
119
|
+
const InputWrapper = styled.div.withConfig({
|
|
120
|
+
shouldForwardProp
|
|
121
|
+
}).attrs(applyDefaultTheme)`
|
|
122
|
+
position: relative;
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
125
|
min-width: 150px;
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
input {
|
|
128
|
+
color: ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))} !important;
|
|
129
|
+
font-size: ${props => props.$focused ? '14px' : '12px'} !important;
|
|
130
|
+
}
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
${props => !props.$isMenuOpen && css`
|
|
133
|
+
&:before {
|
|
134
|
+
content: '${props.$editText}';
|
|
135
|
+
position: absolute;
|
|
136
|
+
left: 2px;
|
|
137
|
+
color: ${props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))};
|
|
138
|
+
pointer-events: none;
|
|
139
|
+
font-size: 12px;
|
|
137
140
|
}
|
|
138
141
|
`}
|
|
139
|
-
|
|
142
|
+
|
|
143
|
+
${props => props.$isDisabled && css`
|
|
144
|
+
opacity: 0.5;
|
|
145
|
+
cursor: not-allowed;
|
|
146
|
+
pointer-events: none;
|
|
147
|
+
`};
|
|
140
148
|
`;
|
|
141
149
|
const DropdownMenu = styled(components.Menu).attrs(applyDefaultTheme)`
|
|
142
150
|
font-size: 14px;
|
|
@@ -166,20 +174,25 @@ const sharedOptionStyle = css`
|
|
|
166
174
|
`;
|
|
167
175
|
const Option = styled(components.Option).attrs(applyDefaultTheme)`
|
|
168
176
|
${sharedOptionStyle}
|
|
177
|
+
padding: 8px 12px;
|
|
169
178
|
`;
|
|
170
179
|
const SelectedOption = styled(components.Option).attrs(applyDefaultTheme)`
|
|
171
180
|
${sharedOptionStyle}
|
|
172
|
-
|
|
173
181
|
display: flex !important;
|
|
174
182
|
justify-content: space-between;
|
|
183
|
+
align-items: center;
|
|
184
|
+
padding: 8px 12px;
|
|
175
185
|
`;
|
|
176
|
-
const DropdownOptionDeleteIcon = styled(SvgClose).
|
|
186
|
+
const DropdownOptionDeleteIcon = styled(SvgClose).withConfig({
|
|
187
|
+
shouldForwardProp
|
|
188
|
+
}).attrs(applyDefaultTheme)`
|
|
177
189
|
stroke-width: 1px;
|
|
178
190
|
width: 8px;
|
|
179
|
-
|
|
180
191
|
${props => props.theme.themeProp('stroke', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
|
|
181
192
|
`;
|
|
182
|
-
const ShowMoreWrapper = styled.div.
|
|
193
|
+
const ShowMoreWrapper = styled.div.withConfig({
|
|
194
|
+
shouldForwardProp
|
|
195
|
+
}).attrs(applyDefaultTheme)`
|
|
183
196
|
align-items: end;
|
|
184
197
|
display: flex;
|
|
185
198
|
flex-direction: column;
|
|
@@ -189,36 +202,35 @@ const ShowMoreWrapper = styled.div.attrs(applyDefaultTheme)`
|
|
|
189
202
|
max-height: ${showMoreHeight + 16}px;
|
|
190
203
|
top: 0;
|
|
191
204
|
width: 100%;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
cursor: pointer;
|
|
205
|
+
z-index: 2;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
color: ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('emerald-500'))};
|
|
208
|
+
&:hover {
|
|
197
209
|
text-decoration: underline;
|
|
198
210
|
}
|
|
199
211
|
`;
|
|
200
|
-
const ShowMoreOverlay = styled.div.
|
|
201
|
-
|
|
202
|
-
|
|
212
|
+
const ShowMoreOverlay = styled.div.withConfig({
|
|
213
|
+
shouldForwardProp
|
|
214
|
+
}).attrs(applyDefaultTheme)`
|
|
203
215
|
height: 100%;
|
|
204
216
|
max-height: ${showMoreHeight}px;
|
|
205
|
-
left: 0;
|
|
206
|
-
top: 0;
|
|
207
|
-
width: 100%;
|
|
208
|
-
|
|
209
217
|
${props => props.theme.themeProp('background', 'transparent linear-gradient(180deg, #12121200 0%, #12121230 40%, #12121279 70%, #121212 95%, #121212 100%) 0% 0% no-repeat padding-box', 'transparent linear-gradient(180deg, #fefefe00 0%, #fefefe30 40%, #fefefe79 70%, #fefefe 95%, #fefefe 100%) 0% 0% no-repeat padding-box')}
|
|
210
218
|
`;
|
|
211
|
-
const ShowMoreText = styled.div.
|
|
219
|
+
const ShowMoreText = styled.div.withConfig({
|
|
220
|
+
shouldForwardProp
|
|
221
|
+
}).attrs(applyDefaultTheme)`
|
|
212
222
|
font-size: 0.875rem;
|
|
213
223
|
width: 100%;
|
|
214
|
-
${props => props.theme.themeProp('background-color', '#121212', '#fefefe')}
|
|
224
|
+
background-color: ${props => props.theme.themeProp('background-color', '#121212', '#fefefe')};
|
|
215
225
|
`;
|
|
216
|
-
const ErrorMessage = styled.div.
|
|
226
|
+
const ErrorMessage = styled.div.withConfig({
|
|
227
|
+
shouldForwardProp
|
|
228
|
+
}).attrs(applyDefaultTheme)`
|
|
217
229
|
color: ${props => props.$error ? props.theme.getColor('red-500') : props.$warning ? props.theme.getColor('orange-500') : 'inherit'};
|
|
218
230
|
font-size: 0.75rem;
|
|
219
231
|
margin-top: 8px;
|
|
220
232
|
padding: 0 12px;
|
|
221
233
|
`;
|
|
222
234
|
|
|
223
|
-
export { AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, DropdownMenu, DropdownOptionDeleteIcon, ErrorMessage,
|
|
235
|
+
export { AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, DropdownMenu, DropdownOptionDeleteIcon, ErrorMessage, InnerWrapper, InputWrapper, Label, MultiSelect, MultiSelectWrapper, MultiValue, Option, SelectedOption, ShowMoreOverlay, ShowMoreText, ShowMoreWrapper };
|
|
224
236
|
//# sourceMappingURL=MultiSelect.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.styled.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\n\nimport Select from 'react-select';\nimport CreatableSelect from 'react-select/creatable';\nimport { AsyncPaginate, withAsyncPaginate } from 'react-select-async-paginate';\nimport { components } from 'react-select';\n\nconst AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);\n\nconst showMoreHeight = 114;\n\nconst sharedStyle = css`\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 12px;\n font-weight: 400;\n position: relative;\n`;\n\nexport const Label = styled.label.attrs(applyDefaultTheme)`\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('white'),\n props.theme.getColor('gray-700')\n )};\n flex-basis: 33.33%;\n font-size: 0.875rem;\n line-height: 1rem;\n cursor: pointer;\n height: 19px;\n display: flex;\n align-items: center;\n`;\n\nexport const MultiSelect = styled(Select).attrs(applyDefaultTheme)`\n ${sharedStyle}\n`;\n\nexport const CreatableMultiSelect = styled(CreatableSelect).attrs(applyDefaultTheme)`\n ${sharedStyle}\n`;\n\nexport const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate).attrs(\n applyDefaultTheme\n)`\n ${sharedStyle}\n`;\n\nexport const AsyncMultiSelect = styled(AsyncPaginate).attrs(applyDefaultTheme)`\n ${sharedStyle}\n`;\n\nexport const MultiSelectWrapper = styled.div.attrs(applyDefaultTheme)`\n position: relative;\n`;\n\nexport const Control = styled(components.Control).attrs(applyDefaultTheme)`\n && {\n align-items: flex-start;\n background: transparent;\n border: none;\n box-shadow: none;\n }\n\n :hover {\n cursor: ${props =>\n (!props.isDisabled && props.focused) || props.readOnly ? 'default' : 'pointer'};\n }\n`;\n\nexport const ValueContainer = styled(components.ValueContainer)`\n && {\n align-items: flex-start;\n gap: 8px;\n padding: 0;\n\n max-height: ${props => {\n return props.showMore\n ? props.$error || props.$warning\n ? '100%'\n : showMoreHeight + 16 + 'px'\n : '100%';\n }} !important;\n\n ${props =>\n (props.$error || props.$warning) &&\n css`\n border: 1px solid;\n border-radius: 3px;\n padding: 4px;\n\n border-color: ${props =>\n props.$error\n ? props.theme.getColor('red-500')\n : props.warning\n ? props.theme.getColor('orange-500')\n : 'inherit'};\n `}\n }\n`;\n\nexport const MultiValueWrapper = styled.div.attrs(applyDefaultTheme)`\n && {\n border-radius: 3px;\n margin: 0;\n }\n`;\n\nexport const MultiValue = styled(components.MultiValue).attrs(applyDefaultTheme)`\n && {\n border-radius: 3px;\n margin: 0;\n\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-600'),\n props.theme.getColor('gray-800')\n )}\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-100')\n )}\n\n > div {\n align-items: center;\n display: flex;\n font-size: 12px;\n min-height: 26px;\n\n :first-of-type {\n padding: ${props => (props.isDisabled || props.readOnly ? '0 8px' : '0 3px 0 8px')};\n }\n\n :last-of-type:not(:only-child) {\n padding: 0 8px 0 5px;\n height: 100%;\n width: fit-content;\n }\n\n :last-of-type:not(:only-child):hover {\n background-color: ${props => props.theme.getColor('red-500')};\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n cursor: pointer;\n }\n\n svg {\n stroke: white;\n stroke-width: 2px;\n width: 8px;\n }\n\n :hover {\n cursor: pointer;\n }\n }\n`;\n\nexport const MultiValueRemove = styled(components.MultiValueRemove).attrs(applyDefaultTheme)``;\n\nexport const Input = styled(components.Input).attrs(applyDefaultTheme)`\n align-self: center;\n font-size: ${props => (props.$focused ? '14px' : '12px')};\n min-width: 150px;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n\n ${props =>\n !props.$focused &&\n css`\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-400'),\n props.theme.getColor('gray-500')\n )}\n\n :before {\n height: 100%;\n white-space: nowrap;\n width: fit-content;\n content: '${props => props.edittext}';\n }\n `}\n }\n`;\n\nexport const DropdownMenu = styled(components.Menu).attrs(applyDefaultTheme)`\n font-size: 14px;\n\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-600'),\n props.theme.getColor('white')\n )}\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n`;\n\nconst sharedOptionStyle = css`\n ${props =>\n props.isFocused &&\n css`\n ${props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-200')\n )}\n `}\n\n ${props =>\n props.isSelected &&\n css`\n ${props.theme.themeProp('background-color', 'transparent', 'transparent')}\n\n ${props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n `}\n\n ${props =>\n props.isFocused &&\n props.isSelected &&\n css`\n ${props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-200')\n )}\n `}\n\n :hover {\n cursor: pointer;\n }\n`;\n\nexport const Option = styled(components.Option).attrs(applyDefaultTheme)`\n ${sharedOptionStyle}\n`;\n\nexport const SelectedOption = styled(components.Option).attrs(applyDefaultTheme)`\n ${sharedOptionStyle}\n\n display: flex !important;\n justify-content: space-between;\n`;\n\nexport const DropdownOptionDeleteIcon = styled(CloseIcon).attrs(applyDefaultTheme)`\n stroke-width: 1px;\n width: 8px;\n\n ${props =>\n props.theme.themeProp(\n 'stroke',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n`;\n\nexport const ShowMoreWrapper = styled.div.attrs(applyDefaultTheme)`\n align-items: end;\n display: flex;\n flex-direction: column;\n height: 100%;\n left: 0;\n position: absolute;\n max-height: ${showMoreHeight + 16}px;\n top: 0;\n width: 100%;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('emerald-500')\n )}\n\n :hover {\n cursor: pointer;\n text-decoration: underline;\n }\n`;\n\nexport const ShowMoreOverlay = styled.div.attrs(applyDefaultTheme)`\n align-items: end;\n display: block;\n height: 100%;\n max-height: ${showMoreHeight}px;\n left: 0;\n top: 0;\n width: 100%;\n\n ${props =>\n props.theme.themeProp(\n 'background',\n 'transparent linear-gradient(180deg, #12121200 0%, #12121230 40%, #12121279 70%, #121212 95%, #121212 100%) 0% 0% no-repeat padding-box',\n 'transparent linear-gradient(180deg, #fefefe00 0%, #fefefe30 40%, #fefefe79 70%, #fefefe 95%, #fefefe 100%) 0% 0% no-repeat padding-box'\n )}\n`;\n\nexport const ShowMoreText = styled.div.attrs(applyDefaultTheme)`\n font-size: 0.875rem;\n width: 100%;\n ${props => props.theme.themeProp('background-color', '#121212', '#fefefe')}\n`;\n\nexport const ErrorMessage = styled.div.attrs(applyDefaultTheme)`\n color: ${props =>\n props.$error\n ? props.theme.getColor('red-500')\n : props.$warning\n ? props.theme.getColor('orange-500')\n : 'inherit'};\n font-size: 0.75rem;\n margin-top: 8px;\n padding: 0 12px;\n`;\n"],"names":["AsyncCreatableSelectPaginate","withAsyncPaginate","CreatableSelect","showMoreHeight","sharedStyle","css","props","theme","primaryFontFamily","styled","label","attrs","applyDefaultTheme","themeProp","getColor","MultiSelect","Select","CreatableMultiSelect","AsyncCreatableMultiSelect","AsyncMultiSelect","AsyncPaginate","MultiSelectWrapper","div","components","Control","isDisabled","focused","readOnly","ValueContainer","showMore","$error","$warning","warning","MultiValueWrapper","MultiValue","MultiValueRemove","Input","$focused","edittext","DropdownMenu","Menu","sharedOptionStyle","isFocused","isSelected","Option","SelectedOption","DropdownOptionDeleteIcon","CloseIcon","ShowMoreWrapper","ShowMoreOverlay","ShowMoreText","ErrorMessage"],"mappings":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CAACO,QAAQ,CAAC,SAAS,CAAC,GAC/BR,KAAK,CAACyB,QAAQ,GACZzB,KAAK,CAACC,KAAK,CAACO,QAAQ,CAAC,YAAY,CAAC,GAClC,SAAS,CAAA;AACnB;AACA;AACA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"MultiSelect.styled.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\nimport { components } from 'react-select';\nimport Select from 'react-select';\nimport CreatableSelect from 'react-select/creatable';\nimport { AsyncPaginate, withAsyncPaginate } from 'react-select-async-paginate';\n\nconst showMoreHeight = 114;\nconst AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);\n\nconst shouldForwardProp = prop => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nconst sharedStyle = css`\n font-family: ${props => props.theme?.primaryFontFamily || 'Arial, sans-serif'};\n font-size: 12px;\n font-weight: 400;\n position: relative;\n`;\n\nexport const MultiSelectWrapper = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n position: relative;\n`;\n\nexport const InnerWrapper = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n ${props =>\n (props.$error || props.$warning) &&\n css`\n border: 1px solid;\n border-radius: 3px;\n padding: 4px;\n border-color: ${props.$error\n ? props.theme.getColor('red-500')\n : props.theme.getColor('orange-500')};\n `}\n`;\n\nexport const Label = styled.label\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('white'),\n props.theme.getColor('gray-700')\n )};\n flex-basis: 33.33%;\n font-size: 0.875rem;\n line-height: 1rem;\n cursor: pointer;\n height: 19px;\n display: flex;\n align-items: center;\n`;\n\nexport const MultiValue = styled(components.MultiValue).attrs(applyDefaultTheme)`\n && {\n border-radius: 3px;\n margin: 0;\n display: flex;\n align-items: center;\n border: none;\n\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-600'),\n props.theme.getColor('gray-800')\n )}\n\n ${props =>\n props.$isDisabled &&\n css`\n opacity: 0.6;\n cursor: not-allowed !important;\n\n & > * {\n pointer-events: none;\n cursor: not-allowed !important;\n }\n `}\n\n ${props =>\n props.$isReadOnly &&\n !props.$isDisabled &&\n css`\n cursor: default !important;\n `}\n\n \n & > div:first-of-type {\n font-size: 12px;\n min-height: 26px;\n display: flex;\n align-items: center;\n padding: ${props => (props.$isDisabled || props.$isReadOnly ? '0 8px' : '0 3px 0 8px')};\n color: ${props => props.theme.getColor('gray-100')};\n cursor: ${props =>\n props.$isDisabled ? 'not-allowed' : props.$isReadOnly ? 'default' : 'pointer'};\n }\n\n /* Target the Remove Button */\n .multi-select__multi-value__remove,\n & > div:last-of-type {\n display: flex;\n align-items: center;\n padding: 0 8px 0 5px;\n height: 26px;\n width: fit-content;\n cursor: pointer;\n background-color: transparent;\n\n ${props =>\n !props.$isDisabled &&\n !props.$isReadOnly &&\n css`\n &:hover {\n background-color: ${props.theme.getColor('red-500')} !important;\n border-radius: 0 3px 3px 0;\n }\n `}\n\n svg {\n stroke: white;\n stroke-width: 2px;\n width: 8px;\n }\n }\n }\n`;\n\nexport const MultiSelect = styled(Select)`\n ${sharedStyle}\n`;\nexport const CreatableMultiSelect = styled(CreatableSelect)`\n ${sharedStyle}\n`;\nexport const AsyncMultiSelect = styled(AsyncPaginate)`\n ${sharedStyle}\n`;\nexport const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate)`\n ${sharedStyle}\n`;\n\nexport const InputWrapper = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n position: relative;\n display: flex;\n align-items: center;\n min-width: 150px;\n\n input {\n color: ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )} !important;\n font-size: ${props => (props.$focused ? '14px' : '12px')} !important;\n }\n\n ${props =>\n !props.$isMenuOpen &&\n css`\n &:before {\n content: '${props.$editText}';\n position: absolute;\n left: 2px;\n color: ${props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-400'),\n props.theme.getColor('gray-500')\n )};\n pointer-events: none;\n font-size: 12px;\n }\n `}\n\n ${props =>\n props.$isDisabled &&\n css`\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n `};\n`;\n\nexport const DropdownMenu = styled(components.Menu).attrs(applyDefaultTheme)`\n font-size: 14px;\n\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-600'),\n props.theme.getColor('white')\n )}\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n`;\n\nconst sharedOptionStyle = css`\n ${props =>\n props.isFocused &&\n css`\n ${props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-200')\n )}\n `}\n\n ${props =>\n props.isSelected &&\n css`\n ${props.theme.themeProp('background-color', 'transparent', 'transparent')}\n\n ${props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n `}\n\n ${props =>\n props.isFocused &&\n props.isSelected &&\n css`\n ${props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-200')\n )}\n `}\n\n :hover {\n cursor: pointer;\n }\n`;\n\nexport const Option = styled(components.Option).attrs(applyDefaultTheme)`\n ${sharedOptionStyle}\n padding: 8px 12px;\n`;\n\nexport const SelectedOption = styled(components.Option).attrs(applyDefaultTheme)`\n ${sharedOptionStyle}\n display: flex !important;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n`;\n\nexport const DropdownOptionDeleteIcon = styled(CloseIcon)\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n stroke-width: 1px;\n width: 8px;\n ${props =>\n props.theme.themeProp(\n 'stroke',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )}\n`;\n\nexport const ShowMoreWrapper = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-items: end;\n display: flex;\n flex-direction: column;\n height: 100%;\n left: 0;\n position: absolute;\n max-height: ${showMoreHeight + 16}px;\n top: 0;\n width: 100%;\n z-index: 2;\n cursor: pointer;\n color: ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('emerald-500')\n )};\n &:hover {\n text-decoration: underline;\n }\n`;\n\nexport const ShowMoreOverlay = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n height: 100%;\n max-height: ${showMoreHeight}px;\n ${props =>\n props.theme.themeProp(\n 'background',\n 'transparent linear-gradient(180deg, #12121200 0%, #12121230 40%, #12121279 70%, #121212 95%, #121212 100%) 0% 0% no-repeat padding-box',\n 'transparent linear-gradient(180deg, #fefefe00 0%, #fefefe30 40%, #fefefe79 70%, #fefefe 95%, #fefefe 100%) 0% 0% no-repeat padding-box'\n )}\n`;\n\nexport const ShowMoreText = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-size: 0.875rem;\n width: 100%;\n background-color: ${props => props.theme.themeProp('background-color', '#121212', '#fefefe')};\n`;\n\nexport const ErrorMessage = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n color: ${props =>\n props.$error\n ? props.theme.getColor('red-500')\n : props.$warning\n ? props.theme.getColor('orange-500')\n : 'inherit'};\n font-size: 0.75rem;\n margin-top: 8px;\n padding: 0 12px;\n`;\n"],"names":["showMoreHeight","AsyncCreatableSelectPaginate","withAsyncPaginate","CreatableSelect","shouldForwardProp","prop","startsWith","sharedStyle","css","props","theme","primaryFontFamily","MultiSelectWrapper","styled","div","withConfig","attrs","applyDefaultTheme","InnerWrapper","$error","$warning","getColor","Label","label","themeProp","MultiValue","components","$isDisabled","$isReadOnly","MultiSelect","Select","CreatableMultiSelect","AsyncMultiSelect","AsyncPaginate","AsyncCreatableMultiSelect","InputWrapper","$focused","$isMenuOpen","$editText","DropdownMenu","Menu","sharedOptionStyle","isFocused","isSelected","Option","SelectedOption","DropdownOptionDeleteIcon","CloseIcon","ShowMoreWrapper","ShowMoreOverlay","ShowMoreText","ErrorMessage"],"mappings":";;;;;;;AAQA,MAAMA,cAAc,GAAG,GAAG,CAAA;AAC1B,MAAMC,4BAA4B,GAAGC,iBAAiB,CAACC,eAAe,CAAC,CAAA;AAEvE,MAAMC,iBAAiB,GAAGC,IAAI,IAAI;EAChC,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AAClD,CAAC,CAAA;AAED,MAAMC,WAAW,GAAGC,GAAG,CAAA;AACvB,eAAiBC,EAAAA,KAAK,IAAIA,KAAK,CAACC,KAAK,EAAEC,iBAAiB,IAAI,mBAAmB,CAAA;AAC/E;AACA;AACA;AACA,CAAC,CAAA;AAEM,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,GAAG,CACzCC,UAAU,CAAC;AACVX,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDY,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA,EAAC;AAEM,MAAMC,YAAY,GAAGL,MAAM,CAACC,GAAG,CACnCC,UAAU,CAAC;AACVX,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDY,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B,EAAIR,EAAAA,KAAK,IACL,CAACA,KAAK,CAACU,MAAM,IAAIV,KAAK,CAACW,QAAQ,KAC/BZ,GAAG,CAAA;AACP;AACA;AACA;AACA,oBAAsBC,EAAAA,KAAK,CAACU,MAAM,GACxBV,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,SAAS,CAAC,GAC/BZ,KAAK,CAACC,KAAK,CAAC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wIAAwI,EACxI,wIACF,CAAC,CAAA;AACL,EAAC;AAEM,MAAM0B,YAAY,GAAGrC,MAAM,CAACC,GAAG,CACnCC,UAAU,CAAC;AACVX,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDY,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA,oBAAA,EAAsBR,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACc,SAAS,CAAC,kBAAkB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAC9F,EAAC;AAEM,MAAM2B,YAAY,GAAGtC,MAAM,CAACC,GAAG,CACnCC,UAAU,CAAC;AACVX,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDY,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B,SAAA,EAAWR,KAAK,IACZA,KAAK,CAACU,MAAM,GACRV,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,SAAS,CAAC,GAC/BZ,KAAK,CAACW,QAAQ,GACZX,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,YAAY,CAAC,GAClC,SAAS,CAAA;AACnB;AACA;AACA;AACA;;;;"}
|
|
@@ -67,11 +67,11 @@ const TextArea = React__default.forwardRef(function TextArea({
|
|
|
67
67
|
$fieldLabel: !isEmpty(fieldLabel),
|
|
68
68
|
disabled: disabled,
|
|
69
69
|
readOnly: readOnly,
|
|
70
|
-
type: type,
|
|
70
|
+
$type: type,
|
|
71
71
|
className: className,
|
|
72
72
|
style: style
|
|
73
73
|
}, React__default.createElement(TextInputFieldIconAlert, {
|
|
74
|
-
type: type
|
|
74
|
+
$type: type
|
|
75
75
|
}, icon), React__default.createElement(TextInputField, _extends({
|
|
76
76
|
autoFocus: autoFocus,
|
|
77
77
|
$borderRadius: borderRadius,
|
|
@@ -85,7 +85,7 @@ const TextArea = React__default.forwardRef(function TextArea({
|
|
|
85
85
|
readOnly: readOnly,
|
|
86
86
|
disabled: disabled,
|
|
87
87
|
$edit: edit,
|
|
88
|
-
type: type,
|
|
88
|
+
$type: type,
|
|
89
89
|
autoComplete: autoComplete,
|
|
90
90
|
$hasIcon: Boolean(icon),
|
|
91
91
|
id: `text-input-${uniqueId}`,
|
|
@@ -108,7 +108,7 @@ const TextArea = React__default.forwardRef(function TextArea({
|
|
|
108
108
|
onKeyDown: onKeyDown,
|
|
109
109
|
onBlur: onBlur,
|
|
110
110
|
$noBorder: noBorder
|
|
111
|
-
}, rest)), !fieldLabel && (type === 'loading' || type === 'success') && React__default.createElement(SuccessContainer, null, type === 'loading' && loadingIcon, type === 'success' && successIcon), !readOnly && noBorder && React__default.createElement(InputIconContainer, {
|
|
111
|
+
}, rest)), !fieldLabel && (type === 'loading' || type === 'success') && React__default.createElement(SuccessContainer, null, type === 'loading' && loadingIcon, type === 'success' && successIcon), !readOnly && (edit || noBorder) && React__default.createElement(InputIconContainer, {
|
|
112
112
|
disabled: disabled
|
|
113
113
|
}, React__default.createElement(SvgEditNote, {
|
|
114
114
|
className: padding === 'small' ? 'smallPadingIcon' : undefined
|
|
@@ -118,7 +118,7 @@ const TextArea = React__default.forwardRef(function TextArea({
|
|
|
118
118
|
$hasIcon: Boolean(icon),
|
|
119
119
|
$inputIsEmpty: inputIsEmpty
|
|
120
120
|
}, label, required && ' *'), typeof description === 'string' && description.length > 0 && React__default.createElement(Description, {
|
|
121
|
-
type: type
|
|
121
|
+
$type: type
|
|
122
122
|
}, description)));
|
|
123
123
|
};
|
|
124
124
|
if (hidden) return null;
|