@ntbjs/react-components 2.0.1-rc.31 → 2.0.2-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/build/data/Badge/Badge.js +6 -6
  2. package/build/data/Badge/Badge.js.map +1 -1
  3. package/build/data/Badge/Badge.styled.js +10 -11
  4. package/build/data/Badge/Badge.styled.js.map +1 -1
  5. package/build/inputs/CompactTextInput/CompactTextInput.js +2 -2
  6. package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
  7. package/build/inputs/CompactTextInput/CompactTextInput.styled.js +107 -117
  8. package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
  9. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js.map +1 -1
  10. package/build/inputs/MultiSelect/MultiSelect.js +163 -103
  11. package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
  12. package/build/inputs/MultiSelect/MultiSelect.styled.js +123 -111
  13. package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
  14. package/build/inputs/Radio/Radio.js +13 -4
  15. package/build/inputs/Radio/Radio.js.map +1 -1
  16. package/build/inputs/Radio/Radio.styled.js +40 -23
  17. package/build/inputs/Radio/Radio.styled.js.map +1 -1
  18. package/build/inputs/TextArea/TextArea.js +5 -5
  19. package/build/inputs/TextArea/TextArea.js.map +1 -1
  20. package/build/inputs/TextArea/TextArea.styled.js +48 -56
  21. package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
  22. package/build/styles/.config.scss +2 -2
  23. package/build/utils/defaultTheme.js +10 -1
  24. package/build/utils/defaultTheme.js.map +1 -1
  25. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js +8 -8
  26. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
  27. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +2 -2
  28. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
  29. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js +2 -2
  30. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +1 -1
  31. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js +7 -7
  32. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js.map +1 -1
  33. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js +0 -4
  34. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js.map +1 -1
  35. package/package.json +11 -4
  36. package/styles/.config.scss +2 -2
@@ -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","arrayO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AAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,OAAO,EAAE,KAAK;AACdP,EAAAA,YAAY,EAAE,WAAW;AACzBI,EAAAA,MAAM,EAAE,KAAA;AACV,CAAC,CAAA;AASD,MAAMgC,gBAAgB,GAAGd,UAAU,IAAI;AACrC,EAAA,OACElC,cAAA,CAAAmC,aAAA,CAACC,kBAAkB,EAAKF,UAAU,EAChClC,cAAA,CAAAmC,aAAA,CAAC6D,QAAS,EAAA;AAAC3D,IAAAA,SAAS,EAAC,yBAAA;AAAyB,GAAE,CAC9B,CAAC,CAAA;AAEzB,CAAC,CAAA;AAED,MAAMY,IAAI,GAAGf,UAAU,IAAI;EACzB,OAAOlC,cAAA,CAAAmC,aAAA,CAACC,YAAc,EAAKF,UAAa,CAAC,CAAA;AAC3C,CAAC,CAAA;AAED,MAAMgB,MAAM,GAAGhB,UAAU,IAAI;EAC3B,OAAOlC,cAAA,CAAAmC,aAAA,CAACC,QAAQ,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 } 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 [controlledMenuIsOpen, setControlledMenuIsOpen] = useState(undefined);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const wrapperRef = React.useRef(null);\n\n useEffect(() => {\n setSelected(selectedOptions);\n }, [selectedOptions]);\n\n // Handle clicks inside and outside the component\n useEffect(() => {\n function handleClick(event) {\n if (wrapperRef.current) {\n const isClickInside = wrapperRef.current.contains(event.target);\n\n if (!isClickInside) {\n // Clicked outside - close menu by setting to false\n setControlledMenuIsOpen(false);\n setIsMenuOpen(false);\n } else {\n // Clicked inside - check if it's NOT 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 && !readOnly && !disabled) {\n // Clicked on input area or multi-value labels - open the menu immediately\n setControlledMenuIsOpen(true);\n setIsMenuOpen(true);\n }\n }\n }\n }\n\n // Use mousedown to catch events before react-select processes them\n document.addEventListener('mousedown', handleClick);\n return () => {\n document.removeEventListener('mousedown', handleClick);\n };\n }, [readOnly, disabled]);\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 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 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 }),\n valueContainer: base => ({\n ...base,\n padding: 0,\n gap: '8px',\n maxHeight: displayShowMore && !(error || warning) ? '130px' : '100%'\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 => ({ ...base, margin: 0, border: 'none', background: 'none' }),\n multiValueLabel: base => ({ ...base, padding: 0 }),\n multiValueRemove: base => ({ ...base, padding: 0, cursor: 'pointer' })\n }),\n [error, warning, displayShowMore]\n );\n\n const sharedProps = {\n ...props,\n ref: forwardedRef,\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: false,\n openMenuOnFocus: false,\n blurInputOnSelect: false,\n menuIsOpen: controlledMenuIsOpen,\n cacheUniqs: loadOptions ? [cacheUnique] : undefined,\n onMenuOpen: () => {\n setIsMenuOpen(true);\n setControlledMenuIsOpen(true);\n },\n onMenuClose: () => {\n setIsMenuOpen(false);\n setControlledMenuIsOpen(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}>\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 onClick={() => setDisplayShowMore(false)}>\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","controlledMenuIsOpen","setControlledMenuIsOpen","undefined","isMenuOpen","setIsMenuOpen","wrapperRef","useRef","useEffect","handleClick","event","current","isClickInside","contains","target","isRemoveButton","closest","SVGElement","document","addEventListener","removeEventListener","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","valueContainer","padding","gap","maxHeight","menu","backgroundColor","menuList","option","color","multiValue","margin","multiValueLabel","multiValueRemove","cursor","sharedProps","ref","classNamePrefix","value","options","loadingMessage","styles","isMulti","isClearable","placeholder","isDisabled","closeMenuOnSelect","hideSelectedOptions","openMenuOnClick","openMenuOnFocus","blurInputOnSelect","menuIsOpen","cacheUniqs","onMenuOpen","onMenuClose","onFocus","onBlur","noOptionsMessage","onChange","actionMeta","updatedItem","removedValue","action","htmlFor","$error","$warning","onClick","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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,SAAS,CAAC,CAACR,SAAS,CAACM,IAAI,EAAEN,SAAS,CAACC,MAAM,CAAC,CAAC;AAS9DjI,EAAAA,OAAO,EAAEgI,SAAS,CAACQ,SAAS,CAAC,CAACR,SAAS,CAACM,IAAI,EAAEN,SAAS,CAACC,MAAM,CAAC,CAAC;EAKhEf,QAAQ,EAAEc,SAAS,CAACI,IAAAA;AACtB,CAAC,GAAA,EAAA,CAAA;AAEDnJ,WAAW,CAACwJ,YAAY,GAAG;EACzBpI,oBAAoB,EAAEmC,UAAU,IAAI;AAClC,IAAA,IAAIA,UAAU,EAAE;MACd,OAAO,CAAA,gBAAA,EAAmBA,UAAU,CAAG,CAAA,CAAA,CAAA;AACzC,KAAC,MAAM;AACL,MAAA,OAAO,sBAAsB,CAAA;AAC/B,KAAA;GACD;AACDtC,EAAAA,QAAQ,EAAE,KAAK;AACfE,EAAAA,sBAAsB,EAAE,IAAI;AAC5BR,EAAAA,QAAQ,EAAE,KAAK;AACfE,EAAAA,QAAQ,EAAE,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.primaryFontFamily};
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.label.attrs(applyDefaultTheme)`
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.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-100'))}
56
+ ${props => props.$isDisabled && css`
57
+ opacity: 0.6;
58
+ cursor: not-allowed !important;
86
59
 
87
- > div {
88
- align-items: center;
89
- display: flex;
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
- :first-of-type {
94
- padding: ${props => props.isDisabled || props.readOnly ? '0 8px' : '0 3px 0 8px'};
95
- }
96
-
97
- :last-of-type:not(:only-child) {
98
- padding: 0 8px 0 5px;
99
- height: 100%;
100
- width: fit-content;
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
- :last-of-type:not(:only-child):hover {
104
- background-color: ${props => props.theme.getColor('red-500')};
105
- border-bottom-left-radius: 0;
106
- border-top-left-radius: 0;
107
- cursor: pointer;
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 MultiValueRemove = styled(components.MultiValueRemove).attrs(applyDefaultTheme)``;
122
- styled(components.Input).attrs(applyDefaultTheme)`
123
- align-self: center;
124
- font-size: ${props => props.$focused ? '14px' : '12px'};
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
- ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-900'))}
128
-
129
- ${props => !props.$focused && css`
130
- ${props => props.theme.themeProp('color', props.theme.getColor('gray-400'), props.theme.getColor('gray-500'))}
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
- :before {
133
- height: 100%;
134
- white-space: nowrap;
135
- width: fit-content;
136
- content: '${props => props.edittext}';
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).attrs(applyDefaultTheme)`
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.attrs(applyDefaultTheme)`
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
- ${props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('emerald-500'))}
194
-
195
- :hover {
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.attrs(applyDefaultTheme)`
201
- align-items: end;
202
- display: block;
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.attrs(applyDefaultTheme)`
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.attrs(applyDefaultTheme)`
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, MultiSelect, MultiSelectWrapper, MultiValue, MultiValueRemove, MultiValueWrapper, Option, SelectedOption, ShowMoreOverlay, ShowMoreText, ShowMoreWrapper };
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":";;;;;;;AAUA,MAAMA,4BAA4B,GAAGC,iBAAiB,CAACC,eAAe,CAAC,CAAA;AAEvE,MAAMC,cAAc,GAAG,GAAG,CAAA;AAE1B,MAAMC,WAAW,GAAGC,GAAG,CAAA;AACvB,eAAA,EAAiBC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB,CAAA;AACvD;AACA;AACA;AACA,CAAC,CAAA;AAEoBC,MAAM,CAACC,KAAK,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC1D,EAAIN,EAAAA,KAAK,IACLA,KAAK,CAACC,KAAK,CAACM,SAAS,CACnB,OAAO,EACPP,KAAK,CAACC,KAAK,CAACO,QAAQ,CAAC,OAAO,CAAC,EAC7BR,KAAK,CAACC,KAAK,CAACO,QAAQ,CAAC,UAAU,CACjC,CAAC,CAAA;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;AAEM,MAAMC,WAAW,GAAGN,MAAM,CAACO,MAAM,CAAC,CAACL,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAClE,EAAA,EAAIR,WAAW,CAAA;AACf,EAAC;AAEM,MAAMa,oBAAoB,GAAGR,MAAM,CAACP,eAAe,CAAC,CAACS,KAAK,CAACC,iBAAiB,CAAC,C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AAS,CACnB,YAAY,EACZ,wIAAwI,EACxI,wIACF,CAAC,CAAA;AACL,EAAC;AAEM,MAAMqC,YAAY,GAAGzC,MAAM,CAACa,GAAG,CAACX,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC/D;AACA;AACA,EAAA,EAAIN,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACM,SAAS,CAAC,kBAAkB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAC5E,EAAC;AAEM,MAAMsC,YAAY,GAAG1C,MAAM,CAACa,GAAG,CAACX,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC/D,SAAA,EAAWN,KAAK,IACZA,KAAK,CAACwB,MAAM,GACRxB,KAAK,CAACC,KAAK,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,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KAAK,CAACc,SAAS,CACnB,OAAO,EACPf,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,UAAU,CAAC,EAChCZ,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,aAAa,CACpC,CAAC,CAAA;AACL;AACA;AACA;AACA,EAAC;AAEM,MAAM4B,eAAe,GAAGpC,MAAM,CAACC,GAAG,CACtCC,UAAU,CAAC;AACVX,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDY,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA,cAAA,EAAgBjB,cAAc,CAAA;AAC9B,EAAA,EAAIS,KAAK,IACLA,KAAK,CAACC,KAAK,CAACc,SAAS,CACnB,YAAY,EACZ,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;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
- import React__default, { useState } from 'react';
2
+ import React__default, { useMemo } from 'react';
3
3
  import { nanoid } from 'nanoid';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Radio as Radio$1, RadioLabel } from './Radio.styled.js';
@@ -18,11 +18,21 @@ const Radio = React__default.forwardRef(function Radio({
18
18
  onBlur,
19
19
  ...rest
20
20
  }, forwardedRef) {
21
- const [uniqueId] = useState(nanoid());
21
+ const uniqueId = useMemo(() => nanoid(), []);
22
+ const handleChange = e => {
23
+ if (readOnly) {
24
+ e.preventDefault();
25
+ return;
26
+ }
27
+ if (onChange) {
28
+ onChange(e);
29
+ }
30
+ };
22
31
  return React__default.createElement(Radio$1, {
23
32
  htmlFor: uniqueId,
24
33
  disabled: disabled,
25
34
  readOnly: readOnly,
35
+ $isChecked: checked,
26
36
  className: className,
27
37
  style: style
28
38
  }, React__default.createElement("input", _extends({
@@ -33,9 +43,8 @@ const Radio = React__default.forwardRef(function Radio({
33
43
  checked: checked,
34
44
  defaultChecked: defaultChecked,
35
45
  disabled: disabled,
36
- readOnly: readOnly,
37
46
  id: uniqueId,
38
- onChange: onChange,
47
+ onChange: handleChange,
39
48
  onBlur: onBlur
40
49
  }, rest)), React__default.createElement(RadioLabel, null, label));
41
50
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","sources":["../../../src/components/inputs/Radio/Radio.js"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport PropTypes from 'prop-types';\n\nimport * as S from './Radio.styled';\n\n/**\n * Radio buttons allow the user to select one option from a set.\n *\n * Use radio buttons when the user needs to see all available options. If available options can be\n * collapsed, consider using a dropdown menu because it uses less space.\n *\n * Radio buttons should have the most commonly used option selected by default.\n *\n * ### Import\n *\n * ``` js\n * import { Radio } from '@ntbjs/react-components/inputs'\n * // or\n * import Radio from '@ntbjs/react-components/inputs/Radio'\n * ```\n */\nconst Radio = React.forwardRef(function Radio(\n {\n name,\n value,\n checked,\n defaultChecked,\n disabled,\n readOnly,\n label,\n className,\n style,\n onChange,\n onBlur,\n ...rest\n },\n forwardedRef\n) {\n const [uniqueId] = useState(nanoid());\n\n return (\n <S.Radio\n htmlFor={uniqueId}\n disabled={disabled}\n readOnly={readOnly}\n className={className}\n style={style}\n >\n <input\n ref={forwardedRef}\n type=\"radio\"\n name={name}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n readOnly={readOnly}\n id={uniqueId}\n onChange={onChange}\n onBlur={onBlur}\n {...rest}\n />\n <S.RadioLabel>{label}</S.RadioLabel>\n </S.Radio>\n );\n});\n\nRadio.propTypes = {\n /**\n * Text displayed by the radio button\n */\n label: PropTypes.any,\n\n /**\n * Name of the radio button (used when sending form data)\n */\n name: PropTypes.string.isRequired,\n\n /**\n * Value to be sent when the given radio button is selected\n */\n value: PropTypes.any.isRequired,\n\n /**\n * Whether the radio button is checked\n */\n checked: PropTypes.bool,\n\n /**\n * Whether the radio button is checked by default. The most commonly used option should have this set to `true`.\n */\n defaultChecked: PropTypes.bool,\n\n /**\n * Whether the radio button is disabled\n */\n disabled: PropTypes.bool,\n\n /**\n * Display the radio button as read-only\n */\n readOnly: PropTypes.bool,\n\n /**\n * Custom class names for the HTML element\n */\n className: PropTypes.string,\n\n /**\n * Custom inline CSS styling\n */\n style: PropTypes.object,\n\n /**\n * Optional callback function for the `onChange` event\n */\n onChange: PropTypes.func,\n\n /**\n * Optional callback function for the `onBlur` event\n */\n onBlur: PropTypes.func\n};\n\nRadio.defaultProps = {\n disabled: false\n};\n\nexport default Radio;\n"],"names":["Radio","React","forwardRef","name","value","checked","defaultChecked","disabled","readOnly","label","className","style","onChange","onBlur","rest","forwardedRef","uniqueId","useState","nanoid","createElement","S","htmlFor","_extends","ref","type","id","propTypes","process","env","NODE_ENV","PropTypes","any","string","isRequired","bool","object","func","defaultProps"],"mappings":";;;;;;AAuBMA,MAAAA,KAAK,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,KAAKA,CAC3C;EACEG,IAAI;EACJC,KAAK;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U;AAKjC7B,EAAAA,KAAK,EAAE0B,SAAS,CAACC,GAAG,CAACE,UAAU;EAK/B5B,OAAO,EAAEyB,SAAS,CAACI,IAAI;EAKvB5B,cAAc,EAAEwB,SAAS,CAACI,IAAI;EAK9B3B,QAAQ,EAAEuB,SAAS,CAACI,IAAI;EAKxB1B,QAAQ,EAAEsB,SAAS,CAACI,IAAI;EAKxBxB,SAAS,EAAEoB,SAAS,CAACE,MAAM;EAK3BrB,KAAK,EAAEmB,SAAS,CAACK,MAAM;EAKvBvB,QAAQ,EAAEkB,SAAS,CAACM,IAAI;EAKxBvB,MAAM,EAAEiB,SAAS,CAACM,IAAAA;AACpB,CAAC,GAAA,EAAA,CAAA;AAEDpC,KAAK,CAACqC,YAAY,GAAG;AACnB9B,EAAAA,QAAQ,EAAE,KAAA;AACZ,CAAC;;;;"}
1
+ {"version":3,"file":"Radio.js","sources":["../../../src/components/inputs/Radio/Radio.js"],"sourcesContent":["import React, { useMemo } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport PropTypes from 'prop-types';\n\nimport * as S from './Radio.styled';\n\n/**\n * Radio buttons allow the user to select one option from a set.\n *\n * Use radio buttons when the user needs to see all available options. If available options can be\n * collapsed, consider using a dropdown menu because it uses less space.\n *\n * Radio buttons should have the most commonly used option selected by default.\n *\n * ### Import\n *\n * ``` js\n * import { Radio } from '@ntbjs/react-components/inputs'\n * // or\n * import Radio from '@ntbjs/react-components/inputs/Radio'\n * ```\n */\nconst Radio = React.forwardRef(function Radio(\n {\n name,\n value,\n checked,\n defaultChecked,\n disabled,\n readOnly,\n label,\n className,\n style,\n onChange,\n onBlur,\n ...rest\n },\n forwardedRef\n) {\n const uniqueId = useMemo(() => nanoid(), []);\n\n const handleChange = e => {\n // Prevent onChange when readOnly\n if (readOnly) {\n e.preventDefault();\n return;\n }\n if (onChange) {\n onChange(e);\n }\n };\n\n return (\n <S.Radio\n htmlFor={uniqueId}\n disabled={disabled}\n readOnly={readOnly}\n $isChecked={checked}\n className={className}\n style={style}\n >\n <input\n ref={forwardedRef}\n type=\"radio\"\n name={name}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n id={uniqueId}\n onChange={handleChange}\n onBlur={onBlur}\n {...rest}\n />\n <S.RadioLabel>{label}</S.RadioLabel>\n </S.Radio>\n );\n});\n\nRadio.propTypes = {\n /**\n * Text displayed by the radio button\n */\n label: PropTypes.any,\n\n /**\n * Name of the radio button (used when sending form data)\n */\n name: PropTypes.string.isRequired,\n\n /**\n * Value to be sent when the given radio button is selected\n */\n value: PropTypes.any.isRequired,\n\n /**\n * Whether the radio button is checked\n */\n checked: PropTypes.bool,\n\n /**\n * Whether the radio button is checked by default. The most commonly used option should have this set to `true`.\n */\n defaultChecked: PropTypes.bool,\n\n /**\n * Whether the radio button is disabled\n */\n disabled: PropTypes.bool,\n\n /**\n * Display the radio button as read-only\n */\n readOnly: PropTypes.bool,\n\n /**\n * Custom class names for the HTML element\n */\n className: PropTypes.string,\n\n /**\n * Custom inline CSS styling\n */\n style: PropTypes.object,\n\n /**\n * Optional callback function for the `onChange` event\n */\n onChange: PropTypes.func,\n\n /**\n * Optional callback function for the `onBlur` event\n */\n onBlur: PropTypes.func\n};\n\nRadio.defaultProps = {\n disabled: false\n};\n\nexport default Radio;\n"],"names":["Radio","React","forwardRef","name","value","checked","defaultChecked","disabled","readOnly","label","className","style","onChange","onBlur","rest","forwardedRef","uniqueId","useMemo","nanoid","handleChange","e","preventDefault","createElement","S","htmlFor","$isChecked","_extends","ref","type","id","propTypes","process","env","NODE_ENV","PropTypes","any","string","isRequired","bool","object","func","defaultProps"],"mappings":";;;;;;AAuBMA,MAAAA,KAAK,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,KAAKA,CAC3C;EACEG,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,cAAc;EACdC,QAAQ;EACRC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,KAAK;EACLC,QAAQ;EACRC,MAAM;EACN,GA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