{"version":3,"file":"MultiSelect.cjs","names":["genericFactory","useProps","getParsedComboboxData","getOptionsLockup","useCombobox","extractStyleProps","useStyles","useResolvedStylesApi","Fragment","Pill","Combobox","filterPickedValues","PillsInput","OptionsDropdown","InputBase"],"sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef } from 'react';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n  BoxProps,\n  ElementProps,\n  extractStyleProps,\n  Factory,\n  genericFactory,\n  MantineColor,\n  Primitive,\n  StylesApiProps,\n  useProps,\n  useResolvedStylesApi,\n  useStyles,\n} from '../../core';\nimport {\n  Combobox,\n  ComboboxItem,\n  ComboboxLikeProps,\n  ComboboxLikeRenderOptionInput,\n  ComboboxLikeStylesNames,\n  ComboboxRenderPillInput,\n  getOptionsLockup,\n  getParsedComboboxData,\n  OptionsDropdown,\n  OptionsFilter,\n  useCombobox,\n} from '../Combobox';\nimport {\n  __BaseInputProps,\n  __InputStylesNames,\n  ClearSectionMode,\n  InputClearButtonProps,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { Pill } from '../Pill';\nimport { PillsInput } from '../PillsInput';\nimport { ScrollAreaProps } from '../ScrollArea';\nimport { filterPickedValues } from './filter-picked-values';\n\nconst clearSectionOffset: Record<string, number> = {\n  xs: 41,\n  sm: 50,\n  md: 60,\n  lg: 72,\n  xl: 89,\n};\n\nexport type MultiSelectStylesNames =\n  | __InputStylesNames\n  | ComboboxLikeStylesNames\n  | 'pill'\n  | 'pillsList'\n  | 'inputField';\n\nexport interface MultiSelectProps<Value extends Primitive = string>\n  extends\n    BoxProps,\n    __BaseInputProps,\n    ComboboxLikeProps<Value>,\n    StylesApiProps<MultiSelectFactory>,\n    ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n  /** Controlled component value */\n  value?: Value[];\n\n  /** Uncontrolled component default value */\n  defaultValue?: Value[];\n\n  /** Called when value changes */\n  onChange?: (value: Value[]) => void;\n\n  /** Called with `value` of the removed item */\n  onRemove?: (value: Value) => void;\n\n  /** Called when the clear button is clicked */\n  onClear?: () => void;\n\n  /** Called when user attemps to select more values than allowed */\n  onMaxValues?: () => void;\n\n  /** Controlled search value */\n  searchValue?: string;\n\n  /** Default search value */\n  defaultSearchValue?: string;\n\n  /** Called when search changes */\n  onSearchChange?: (value: string) => void;\n\n  /** Maximum number of values, no limit if not set */\n  maxValues?: number;\n\n  /** Allows searching through options by user input @default false */\n  searchable?: boolean;\n\n  /** Message displayed when no options match the search query (when searchable is enabled) or when the data array is empty. If not set, the dropdown will be hidden instead. */\n  nothingFoundMessage?: React.ReactNode;\n\n  /** If set, the check icon is displayed near the selected option label @default true */\n  withCheckIcon?: boolean;\n\n  /** If set, unchecked labels are aligned with checked ones @default false */\n  withAlignedLabels?: boolean;\n\n  /** Position of the checkmark icon shown next to selected options in the dropdown @default 'left' */\n  checkIconPosition?: 'left' | 'right';\n\n  /** When enabled, selected options are hidden from the dropdown list @default false */\n  hidePickedOptions?: boolean;\n\n  /** When enabled, displays a clear button to remove all selected values (hidden when component is empty, disabled, or read-only) @default false */\n  clearable?: boolean;\n\n  /** Determines how the clear button and rightSection are rendered @default 'both' */\n  clearSectionMode?: ClearSectionMode;\n\n  /** Props passed down to the clear button */\n  clearButtonProps?: InputClearButtonProps;\n\n  /** Props passed down to the hidden input */\n  hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n  /** Divider used to separate values in the hidden input `value` attribute @default ',' */\n  hiddenInputValuesDivider?: string;\n\n  /** A function to render content of the option, replaces the default content of the option */\n  renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem>) => React.ReactNode;\n\n  /** A function to render content of the pill */\n  renderPill?: (props: ComboboxRenderPillInput<Value>) => React.ReactNode;\n\n  /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n  scrollAreaProps?: ScrollAreaProps;\n\n  /** Controls color of the default chevron */\n  chevronColor?: MantineColor;\n\n  /** Clear search value when item is selected @default true */\n  clearSearchOnChange?: boolean;\n\n  /** Controls whether dropdown opens when the input receives focus @default true */\n  openOnFocus?: boolean;\n}\n\nexport type MultiSelectFactory = Factory<{\n  props: MultiSelectProps;\n  ref: HTMLInputElement;\n  stylesNames: MultiSelectStylesNames;\n  signature: <Value extends Primitive = string>(\n    props: MultiSelectProps<Value>\n  ) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n  maxValues: Infinity,\n  withCheckIcon: true,\n  checkIconPosition: 'left',\n  hiddenInputValuesDivider: ',',\n  clearSearchOnChange: true,\n  openOnFocus: true,\n  size: 'sm',\n} satisfies Partial<MultiSelectProps>;\n\nexport const MultiSelect = genericFactory<MultiSelectFactory>((_props) => {\n  const props = useProps('MultiSelect', defaultProps, _props);\n  const {\n    classNames,\n    className,\n    style,\n    styles,\n    unstyled,\n    vars,\n    size,\n    value,\n    defaultValue,\n    onChange,\n    onKeyDown,\n    variant,\n    data,\n    dropdownOpened,\n    defaultDropdownOpened,\n    onDropdownOpen,\n    onDropdownClose,\n    selectFirstOptionOnChange,\n    selectFirstOptionOnDropdownOpen,\n    onOptionSubmit,\n    comboboxProps,\n    filter,\n    limit,\n    withScrollArea,\n    maxDropdownHeight,\n    searchValue,\n    defaultSearchValue,\n    onSearchChange,\n    readOnly,\n    disabled,\n    onFocus,\n    onBlur,\n    radius,\n    rightSection,\n    rightSectionWidth,\n    rightSectionPointerEvents,\n    rightSectionProps,\n    leftSection,\n    leftSectionWidth,\n    leftSectionPointerEvents,\n    leftSectionProps,\n    inputContainer,\n    inputWrapperOrder,\n    withAsterisk,\n    labelProps,\n    descriptionProps,\n    errorProps,\n    wrapperProps,\n    description,\n    label,\n    error,\n    maxValues,\n    searchable,\n    nothingFoundMessage,\n    withCheckIcon,\n    withAlignedLabels,\n    checkIconPosition,\n    hidePickedOptions,\n    withErrorStyles,\n    name,\n    form,\n    id,\n    clearable,\n    clearSectionMode,\n    clearButtonProps,\n    hiddenInputProps,\n    placeholder,\n    hiddenInputValuesDivider,\n    required,\n    mod,\n    renderOption,\n    renderPill,\n    onRemove,\n    onClear,\n    onMaxValues,\n    scrollAreaProps,\n    chevronColor,\n    attributes,\n    clearSearchOnChange,\n    openOnFocus,\n    ...others\n  } = props;\n\n  const _id = useId(id);\n  const parsedData = getParsedComboboxData(data);\n  const optionsLockup = getOptionsLockup(parsedData);\n  const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n\n  const combobox = useCombobox({\n    opened: dropdownOpened,\n    defaultOpened: defaultDropdownOpened,\n    onDropdownOpen: () => {\n      onDropdownOpen?.();\n      if (selectFirstOptionOnDropdownOpen) {\n        combobox.selectFirstOption();\n      }\n    },\n    onDropdownClose: () => {\n      onDropdownClose?.();\n      combobox.resetSelectedOption();\n    },\n  });\n\n  const {\n    styleProps,\n    rest: { type, autoComplete, ...rest },\n  } = extractStyleProps(others);\n\n  const [_value, setValue] = useUncontrolled({\n    value,\n    defaultValue,\n    finalValue: [],\n    onChange,\n  });\n\n  const [_searchValue, setSearchValue] = useUncontrolled({\n    value: searchValue,\n    defaultValue: defaultSearchValue,\n    finalValue: '',\n    onChange: onSearchChange,\n  });\n\n  const handleSearchChange = (value: string) => {\n    setSearchValue(value);\n    combobox.resetSelectedOption();\n  };\n\n  const getStyles = useStyles<MultiSelectFactory>({\n    name: 'MultiSelect',\n    classes: {} as any,\n    props: props as any,\n    classNames,\n    styles,\n    unstyled,\n    attributes,\n  });\n\n  const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<MultiSelectFactory>({\n    props,\n    styles,\n    classNames,\n  });\n\n  const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n    onKeyDown?.(event);\n\n    if (event.key === ' ' && !searchable) {\n      event.preventDefault();\n      combobox.toggleDropdown();\n    }\n\n    if (event.key === 'Backspace' && _searchValue.length === 0 && _value.length > 0) {\n      onRemove?.(_value[_value.length - 1]);\n      setValue(_value.slice(0, _value.length - 1));\n    }\n  };\n\n  const values = _value.map((item, index) => {\n    const optionData = optionsLockup[`${item}`] || retainedSelectedOptions.current[`${item}`];\n\n    if (renderPill) {\n      return (\n        <Fragment key={`${item}-${index}`}>\n          {renderPill({\n            option: optionData,\n            value: item,\n            onRemove: () => {\n              setValue(_value.filter((i) => item !== i));\n              onRemove?.(item);\n            },\n            disabled,\n          })}\n        </Fragment>\n      );\n    }\n\n    return (\n      <Pill\n        key={`${item}-${index}`}\n        withRemoveButton={!readOnly && !optionsLockup[`${item}`]?.disabled}\n        onRemove={() => {\n          setValue(_value.filter((i) => item !== i));\n          onRemove?.(item);\n        }}\n        unstyled={unstyled}\n        disabled={disabled}\n        {...getStyles('pill')}\n      >\n        {optionData?.label || item}\n      </Pill>\n    );\n  });\n\n  useEffect(() => {\n    if (selectFirstOptionOnChange) {\n      combobox.selectFirstOption();\n    }\n  }, [selectFirstOptionOnChange, _searchValue]);\n\n  useEffect(() => {\n    _value.forEach((val) => {\n      if (`${val}` in optionsLockup) {\n        retainedSelectedOptions.current[`${val}`] = optionsLockup[`${val}`];\n      }\n    });\n  }, [optionsLockup, _value]);\n\n  const clearButton = (\n    <Combobox.ClearButton\n      {...clearButtonProps}\n      onClear={() => {\n        onClear?.();\n        setValue([]);\n        handleSearchChange('');\n      }}\n    />\n  );\n\n  const filteredData = filterPickedValues({ data: parsedData, value: _value });\n  const _clearable = clearable && _value.length > 0 && !disabled && !readOnly;\n  const pillsListStyle = _clearable\n    ? { paddingInlineEnd: clearSectionOffset[size] ?? clearSectionOffset.sm }\n    : undefined;\n\n  return (\n    <>\n      <Combobox\n        store={combobox}\n        classNames={resolvedClassNames}\n        styles={resolvedStyles}\n        unstyled={unstyled}\n        size={size}\n        readOnly={readOnly}\n        __staticSelector=\"MultiSelect\"\n        attributes={attributes}\n        onOptionSubmit={(val) => {\n          onOptionSubmit?.(val as any);\n          if (clearSearchOnChange) {\n            handleSearchChange('');\n          }\n          combobox.updateSelectedOptionIndex('selected');\n\n          if (_value.includes(optionsLockup[`${val}`].value as any)) {\n            setValue(_value.filter((v) => v !== optionsLockup[`${val}`].value));\n            onRemove?.(optionsLockup[`${val}`].value as any);\n          } else if (_value.length < maxValues) {\n            setValue([..._value, optionsLockup[`${val}`].value] as any);\n          } else {\n            onMaxValues?.();\n          }\n        }}\n        {...comboboxProps}\n      >\n        <Combobox.DropdownTarget>\n          <PillsInput\n            {...styleProps}\n            __staticSelector=\"MultiSelect\"\n            classNames={resolvedClassNames}\n            styles={resolvedStyles}\n            unstyled={unstyled}\n            size={size}\n            className={className}\n            style={style}\n            variant={variant}\n            disabled={disabled}\n            radius={radius}\n            __defaultRightSection={\n              <Combobox.Chevron\n                size={size}\n                error={error}\n                unstyled={unstyled}\n                color={chevronColor}\n              />\n            }\n            __clearSection={clearButton}\n            __clearable={_clearable}\n            __clearSectionMode={clearSectionMode}\n            rightSection={rightSection}\n            rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n            rightSectionWidth={rightSectionWidth}\n            rightSectionProps={rightSectionProps}\n            leftSection={leftSection}\n            leftSectionWidth={leftSectionWidth}\n            leftSectionPointerEvents={leftSectionPointerEvents}\n            leftSectionProps={leftSectionProps}\n            inputContainer={inputContainer}\n            inputWrapperOrder={inputWrapperOrder}\n            withAsterisk={withAsterisk}\n            labelProps={labelProps}\n            descriptionProps={descriptionProps}\n            errorProps={errorProps}\n            wrapperProps={wrapperProps}\n            description={description}\n            label={label}\n            error={error}\n            withErrorStyles={withErrorStyles}\n            __stylesApiProps={{\n              ...props,\n              rightSectionPointerEvents: rightSectionPointerEvents || 'none',\n              multiline: true,\n            }}\n            pointer={!searchable}\n            onClick={() => (searchable ? combobox.openDropdown() : combobox.toggleDropdown())}\n            data-expanded={combobox.dropdownOpened || undefined}\n            id={_id}\n            required={required}\n            mod={mod}\n            attributes={attributes}\n          >\n            <Pill.Group\n              attributes={attributes}\n              disabled={disabled}\n              unstyled={unstyled}\n              {...getStyles('pillsList', { style: pillsListStyle })}\n            >\n              {values}\n              <Combobox.EventsTarget autoComplete={autoComplete} withExpandedAttribute>\n                <PillsInput.Field\n                  {...rest}\n                  id={_id}\n                  placeholder={placeholder}\n                  type={!searchable && !placeholder ? 'hidden' : 'visible'}\n                  {...getStyles('inputField')}\n                  unstyled={unstyled}\n                  onFocus={(event) => {\n                    onFocus?.(event);\n                    openOnFocus && searchable && combobox.openDropdown();\n                  }}\n                  onBlur={(event) => {\n                    onBlur?.(event);\n                    combobox.closeDropdown();\n                    handleSearchChange('');\n                  }}\n                  onKeyDown={handleInputKeydown}\n                  value={_searchValue}\n                  onChange={(event) => {\n                    handleSearchChange(event.currentTarget.value);\n                    searchable && combobox.openDropdown();\n                    selectFirstOptionOnChange && combobox.selectFirstOption();\n                  }}\n                  disabled={disabled}\n                  readOnly={readOnly || !searchable}\n                  pointer={!searchable}\n                />\n              </Combobox.EventsTarget>\n            </Pill.Group>\n          </PillsInput>\n        </Combobox.DropdownTarget>\n\n        <OptionsDropdown\n          data={hidePickedOptions ? filteredData : parsedData}\n          hidden={readOnly || disabled}\n          filter={filter as OptionsFilter<Primitive> | undefined}\n          search={_searchValue}\n          limit={limit}\n          hiddenWhenEmpty={!nothingFoundMessage}\n          withScrollArea={withScrollArea}\n          maxDropdownHeight={maxDropdownHeight}\n          filterOptions={searchable}\n          value={_value}\n          checkIconPosition={checkIconPosition}\n          withCheckIcon={withCheckIcon}\n          withAlignedLabels={withAlignedLabels}\n          nothingFoundMessage={nothingFoundMessage}\n          unstyled={unstyled}\n          labelId={label ? `${_id}-label` : undefined}\n          aria-label={label ? undefined : others['aria-label']}\n          renderOption={renderOption}\n          scrollAreaProps={scrollAreaProps}\n        />\n      </Combobox>\n      <Combobox.HiddenInput\n        name={name}\n        valuesDivider={hiddenInputValuesDivider}\n        value={_value}\n        form={form}\n        disabled={disabled}\n        {...hiddenInputProps}\n      />\n    </>\n  );\n});\n\nMultiSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nMultiSelect.displayName = '@mantine/core/MultiSelect';\n"],"mappings":";;;;;;;;;;;;;;;;;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