@mantine/core 9.5.1 → 9.5.2

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 (58) hide show
  1. package/cjs/components/Cascader/Cascader.cjs +5 -1
  2. package/cjs/components/Cascader/Cascader.cjs.map +1 -1
  3. package/cjs/components/Combobox/get-options-lockup/get-option-by-label.cjs +17 -0
  4. package/cjs/components/Combobox/get-options-lockup/get-option-by-label.cjs.map +1 -0
  5. package/cjs/components/Combobox/is-external-input-change/is-external-input-change.cjs +17 -0
  6. package/cjs/components/Combobox/is-external-input-change/is-external-input-change.cjs.map +1 -0
  7. package/cjs/components/ComboboxPopover/ComboboxPopover.cjs.map +1 -1
  8. package/cjs/components/MultiSelect/MultiSelect.cjs +9 -0
  9. package/cjs/components/MultiSelect/MultiSelect.cjs.map +1 -1
  10. package/cjs/components/Notification/Notification.cjs.map +1 -1
  11. package/cjs/components/RollingNumber/RollingNumber.cjs +7 -3
  12. package/cjs/components/RollingNumber/RollingNumber.cjs.map +1 -1
  13. package/cjs/components/RollingNumber/RollingNumber.module.cjs +1 -0
  14. package/cjs/components/RollingNumber/RollingNumber.module.cjs.map +1 -1
  15. package/cjs/components/Select/Select.cjs +12 -0
  16. package/cjs/components/Select/Select.cjs.map +1 -1
  17. package/cjs/components/TagsInput/TagsInput.cjs +5 -1
  18. package/cjs/components/TagsInput/TagsInput.cjs.map +1 -1
  19. package/cjs/components/Tooltip/TooltipFloating/TooltipFloating.cjs +2 -2
  20. package/cjs/components/Tooltip/TooltipFloating/TooltipFloating.cjs.map +1 -1
  21. package/cjs/components/Tooltip/TooltipFloating/use-floating-tooltip.cjs +1 -0
  22. package/cjs/components/Tooltip/TooltipFloating/use-floating-tooltip.cjs.map +1 -1
  23. package/cjs/components/TreeSelect/TreeSelect.cjs +3 -0
  24. package/cjs/components/TreeSelect/TreeSelect.cjs.map +1 -1
  25. package/esm/components/Cascader/Cascader.mjs +5 -1
  26. package/esm/components/Cascader/Cascader.mjs.map +1 -1
  27. package/esm/components/Combobox/get-options-lockup/get-option-by-label.mjs +17 -0
  28. package/esm/components/Combobox/get-options-lockup/get-option-by-label.mjs.map +1 -0
  29. package/esm/components/Combobox/is-external-input-change/is-external-input-change.mjs +17 -0
  30. package/esm/components/Combobox/is-external-input-change/is-external-input-change.mjs.map +1 -0
  31. package/esm/components/ComboboxPopover/ComboboxPopover.mjs.map +1 -1
  32. package/esm/components/MultiSelect/MultiSelect.mjs +9 -0
  33. package/esm/components/MultiSelect/MultiSelect.mjs.map +1 -1
  34. package/esm/components/Notification/Notification.mjs.map +1 -1
  35. package/esm/components/RollingNumber/RollingNumber.mjs +8 -4
  36. package/esm/components/RollingNumber/RollingNumber.mjs.map +1 -1
  37. package/esm/components/RollingNumber/RollingNumber.module.mjs +1 -0
  38. package/esm/components/RollingNumber/RollingNumber.module.mjs.map +1 -1
  39. package/esm/components/Select/Select.mjs +12 -0
  40. package/esm/components/Select/Select.mjs.map +1 -1
  41. package/esm/components/TagsInput/TagsInput.mjs +5 -1
  42. package/esm/components/TagsInput/TagsInput.mjs.map +1 -1
  43. package/esm/components/Tooltip/TooltipFloating/TooltipFloating.mjs +2 -2
  44. package/esm/components/Tooltip/TooltipFloating/TooltipFloating.mjs.map +1 -1
  45. package/esm/components/Tooltip/TooltipFloating/use-floating-tooltip.mjs +1 -0
  46. package/esm/components/Tooltip/TooltipFloating/use-floating-tooltip.mjs.map +1 -1
  47. package/esm/components/TreeSelect/TreeSelect.mjs +3 -0
  48. package/esm/components/TreeSelect/TreeSelect.mjs.map +1 -1
  49. package/lib/components/Combobox/get-options-lockup/get-option-by-label.d.ts +8 -0
  50. package/lib/components/Combobox/is-external-input-change/is-external-input-change.d.ts +7 -0
  51. package/lib/components/ComboboxPopover/ComboboxPopover.d.ts +1 -1
  52. package/lib/components/Notification/Notification.d.ts +2 -1
  53. package/lib/components/RollingNumber/RollingNumber.d.ts +1 -1
  54. package/package.json +2 -2
  55. package/styles/RollingNumber.css +21 -0
  56. package/styles/RollingNumber.layer.css +21 -0
  57. package/styles.css +21 -0
  58. package/styles.layer.css +21 -0
@@ -9,6 +9,7 @@ import { InputBase } from "../InputBase/InputBase.mjs";
9
9
  import { useCombobox } from "../Combobox/use-combobox/use-combobox.mjs";
10
10
  import { Combobox } from "../Combobox/Combobox.mjs";
11
11
  import { CheckIcon } from "../Checkbox/CheckIcon.mjs";
12
+ import { isExternalInputChange } from "../Combobox/is-external-input-change/is-external-input-change.mjs";
12
13
  import { CascaderColumns } from "./CascaderColumns.mjs";
13
14
  import { flattenCascaderPaths } from "./flatten-cascader-paths.mjs";
14
15
  import { getCascaderPathOptions } from "./get-cascader-path-options.mjs";
@@ -301,7 +302,10 @@ const Cascader = factory((_props) => {
301
302
  disabled,
302
303
  readOnly: readOnly || !searchable,
303
304
  value: searchable ? _searchValue : displayString,
304
- onChange: (event) => handleSearchChange(event.currentTarget.value),
305
+ onChange: (event) => {
306
+ if (isExternalInputChange(event)) return;
307
+ handleSearchChange(event.currentTarget.value);
308
+ },
305
309
  onFocus: (event) => {
306
310
  if (openOnFocus && searchable && canInteract) combobox.openDropdown();
307
311
  onFocus?.(event);
@@ -1 +1 @@
1
- {"version":3,"file":"Cascader.mjs","names":["useId","classes"],"sources":["../../../src/components/Cascader/Cascader.tsx"],"sourcesContent":["import { Fragment, useEffect, useMemo } from 'react';\nimport type { SafePolygonOptions } from '@floating-ui/react';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n Factory,\n factory,\n MantineColor,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport { CheckIcon } from '../Checkbox/CheckIcon';\nimport { Combobox, ComboboxLikeStylesNames, useCombobox } from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollArea, ScrollAreaProps } from '../ScrollArea';\nimport { CascaderColumns } from './CascaderColumns';\nimport { flattenCascaderPaths } from './flatten-cascader-paths';\nimport { getCascaderPathOptions } from './get-cascader-path-options';\nimport { useCascader } from './use-cascader';\nimport classes from './Cascader.module.css';\n\nexport interface CascaderOption {\n /** Option value, must be unique across the whole data tree */\n value: string;\n\n /** Option label, if not set `value` is used instead */\n label?: React.ReactNode;\n\n /** Nested options */\n children?: CascaderOption[];\n\n /** If set, the option cannot be selected or expanded */\n disabled?: boolean;\n}\n\nexport interface CascaderFormatValueInput {\n /** Selected path from root to node */\n value: string[];\n\n /** Option chain resolved from the selected path */\n options: CascaderOption[];\n}\n\nexport type CascaderFormatValue = (input: CascaderFormatValueInput) => React.ReactNode;\n\nexport type CascaderSafeAreaPolygonOptions = Omit<SafePolygonOptions, 'blockPointerEvents'>;\n\nexport type CascaderStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'columnsList'\n | 'columnsOverflow'\n | 'column'\n | 'columnScroll'\n | 'columnOption'\n | 'columnOptionLabel'\n | 'columnOptionIcon'\n | 'columnOptionCheck'\n | 'columnEmpty'\n | 'flatOption';\n\nexport interface CascaderProps\n extends\n BoxProps,\n __BaseInputProps,\n StylesApiProps<CascaderFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Hierarchical options data */\n data: CascaderOption[];\n\n /** Controlled selected path from root to node */\n value?: string[] | null;\n\n /** Uncontrolled selected path from root to node */\n defaultValue?: string[] | null;\n\n /** Called when the selected path changes with the path and the resolved option chain */\n onChange?: (value: string[] | null, options: CascaderOption[]) => void;\n\n /** If set, any intermediate option can be selected, not only leaf options @default false */\n changeOnSelect?: boolean;\n\n /** Determines whether the dropdown should be closed when a value is selected, defaults to `!allowDeselect` */\n closeOnSelect?: boolean;\n\n /** If set, the selected value can be deselected by selecting it again @default true */\n allowDeselect?: boolean;\n\n /** If set, the check icon is displayed on the selected option @default true */\n withCheckIcon?: boolean;\n\n /** Position of the check icon relative to the option label @default 'right' */\n checkIconPosition?: 'left' | 'right';\n\n /** Renders the dropdown as cascading columns. When `false`, options are rendered as a flat list of paths, the same way as search results (useful for narrow/mobile layouts) @default true */\n withColumns?: boolean;\n\n /** Determines how the next column is opened @default 'click' */\n expandTrigger?: 'click' | 'hover';\n\n /** Determines whether the next column stays open while the cursor moves toward it, applicable only when `expandTrigger=\"hover\"`. Pass an object to configure safe polygon behavior. @default true */\n safeAreaPolygon?: boolean | CascaderSafeAreaPolygonOptions;\n\n /** If set, options can be searched by their flattened paths @default false */\n searchable?: boolean;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Uncontrolled search value */\n defaultSearchValue?: string;\n\n /** Called when the search value changes */\n onSearchChange?: (value: string) => void;\n\n /** Custom search filter, matched against the full option path */\n filter?: (query: string, options: CascaderOption[]) => boolean;\n\n /** Custom rendering of a search result row */\n renderSearchOption?: (query: string, options: CascaderOption[]) => React.ReactNode;\n\n /** A function to format the selected path displayed in the input, should return a string */\n formatValue?: CascaderFormatValue;\n\n /** Custom rendering of an option in columns */\n renderOption?: (option: CascaderOption, level: number) => React.ReactNode;\n\n /** Path separator displayed in the input and search results @default '/' */\n separator?: React.ReactNode;\n\n /** Width of each column */\n columnWidth?: number | string;\n\n /** Maximum number of columns (levels) displayed next to each other, deeper levels replace earlier ones @default 3 */\n maxDisplayedLevels?: number;\n\n /** `aria-label` and `title` of the control that reveals levels hidden before the visible ones by `maxDisplayedLevels` @default 'Show previous levels' */\n previousLevelsControlLabel?: string;\n\n /** `aria-label` and `title` of the control that reveals levels hidden after the visible ones by `maxDisplayedLevels` @default 'Show next levels' */\n nextLevelsControlLabel?: string;\n\n /** Max height of a column before it becomes scrollable @default 260 */\n maxDropdownHeight?: number | string;\n\n /** Message displayed when there are no options or search results */\n nothingFoundMessage?: React.ReactNode;\n\n /** If set, the clear button is displayed when a value is selected @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 /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Controlled dropdown opened state */\n dropdownOpened?: boolean;\n\n /** Uncontrolled dropdown opened state */\n defaultDropdownOpened?: boolean;\n\n /** Called when the dropdown opens */\n onDropdownOpen?: () => void;\n\n /** Called when the dropdown closes */\n onDropdownClose?: () => void;\n\n /** Props passed down to the underlying `Combobox` component */\n comboboxProps?: Record<string, any>;\n\n /** Props passed down to the dropdown `ScrollArea` */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls the default chevron color */\n chevronColor?: MantineColor;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Opens the dropdown when the input is focused in `searchable` mode @default true */\n openOnFocus?: boolean;\n}\n\nexport type CascaderFactory = Factory<{\n props: CascaderProps;\n ref: HTMLInputElement;\n stylesNames: CascaderStylesNames;\n variant: InputVariant;\n}>;\n\nconst defaultProps = {\n expandTrigger: 'click',\n safeAreaPolygon: true,\n changeOnSelect: false,\n allowDeselect: true,\n withCheckIcon: true,\n checkIconPosition: 'right',\n withColumns: true,\n searchable: false,\n separator: '/',\n maxDisplayedLevels: 3,\n previousLevelsControlLabel: 'Show previous levels',\n nextLevelsControlLabel: 'Show next levels',\n maxDropdownHeight: 260,\n openOnFocus: true,\n size: 'sm',\n} satisfies Partial<CascaderProps>;\n\nfunction optionLabelToString(option: CascaderOption): string {\n return typeof option.label === 'string' || typeof option.label === 'number'\n ? String(option.label)\n : option.value;\n}\n\nfunction firstEnabledOptionIndex(options: CascaderOption[]): number {\n return options.findIndex((option) => !option.disabled);\n}\n\nfunction lastEnabledOptionIndex(options: CascaderOption[]): number {\n for (let index = options.length - 1; index >= 0; index -= 1) {\n if (!options[index].disabled) {\n return index;\n }\n }\n return -1;\n}\n\nfunction joinPathLabels(options: CascaderOption[], separator: string): string {\n return options.map(optionLabelToString).join(` ${separator} `);\n}\n\nfunction defaultCascaderFilter(\n query: string,\n options: CascaderOption[],\n separator: string\n): boolean {\n const trimmed = query.trim().toLowerCase();\n if (trimmed.length === 0) {\n return true;\n }\n return joinPathLabels(options, separator).toLowerCase().includes(trimmed);\n}\n\nfunction defaultRenderSearchOption(\n options: CascaderOption[],\n separator: React.ReactNode\n): React.ReactNode {\n return options.map((option, index) => (\n <Fragment key={option.value}>\n {index > 0 && <span data-cascader-separator> {separator} </span>}\n {option.label ?? option.value}\n </Fragment>\n ));\n}\n\nexport const Cascader = factory<CascaderFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'Cascader'], defaultProps as any, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n size,\n data,\n value,\n defaultValue,\n onChange,\n changeOnSelect,\n closeOnSelect,\n allowDeselect,\n withCheckIcon,\n checkIconPosition,\n withColumns,\n expandTrigger,\n safeAreaPolygon,\n searchable,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n filter,\n renderSearchOption,\n formatValue,\n renderOption,\n separator,\n columnWidth,\n maxDisplayedLevels,\n previousLevelsControlLabel,\n nextLevelsControlLabel,\n maxDropdownHeight,\n nothingFoundMessage,\n clearable,\n clearSectionMode,\n clearButtonProps,\n onClear,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n comboboxProps,\n scrollAreaProps,\n chevronColor,\n hiddenInputProps,\n openOnFocus,\n variant,\n onKeyDown,\n onFocus,\n onBlur,\n onClick,\n readOnly,\n disabled,\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 successProps,\n wrapperProps,\n description,\n label,\n error,\n success,\n withErrorStyles,\n withSuccessStyles,\n name,\n form,\n id,\n placeholder,\n required,\n mod,\n attributes,\n ...others\n } = props;\n\n const _id = useId(id);\n const separatorString =\n typeof separator === 'string' || typeof separator === 'number' ? String(separator) : '/';\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n cascader.resetActivePath();\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n if (searchable) {\n setSearchValue(cascader.value ? displayString : '');\n }\n },\n });\n\n // When `allowDeselect` is enabled, keep the dropdown open by default so the value can be toggled\n const shouldCloseOnSelect = closeOnSelect ?? !allowDeselect;\n\n const cascader = useCascader({\n data,\n value,\n defaultValue,\n onChange,\n changeOnSelect,\n allowDeselect,\n expandTrigger,\n onLeafSelect: () => {\n if (shouldCloseOnSelect) {\n combobox.closeDropdown();\n }\n },\n });\n\n const getStyles = useStyles<CascaderFactory>({\n name: 'Cascader',\n classes,\n props: props as any,\n classNames,\n styles,\n unstyled,\n attributes,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<CascaderFactory>({\n props,\n styles,\n classNames,\n });\n\n const {\n styleProps,\n rest: { type, autoComplete, ...rest },\n } = extractStyleProps(others);\n\n const displayString = useMemo(() => {\n if (cascader.pathOptions.length === 0 || !cascader.value) {\n return '';\n }\n if (formatValue) {\n const rendered = formatValue({ value: cascader.value, options: cascader.pathOptions });\n if (typeof rendered === 'string' || typeof rendered === 'number') {\n return String(rendered);\n }\n }\n return joinPathLabels(cascader.pathOptions, separatorString);\n }, [cascader.pathOptions, cascader.value, formatValue, separatorString]);\n\n const initialSearchValue = useMemo(() => {\n if (!searchable || !defaultValue) {\n return '';\n }\n return joinPathLabels(getCascaderPathOptions(data, defaultValue), separatorString);\n }, []);\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: initialSearchValue,\n onChange: onSearchChange,\n });\n\n const isSearching =\n !!searchable && _searchValue.trim().length > 0 && _searchValue !== displayString;\n\n useEffect(() => {\n if (searchable) {\n setSearchValue(cascader.value ? displayString : '');\n }\n }, [cascader.value]);\n\n // The dropdown renders a flat list of paths when searching or when `withColumns` is disabled\n const showFlatList = isSearching || !withColumns;\n\n const flatPaths = useMemo(() => flattenCascaderPaths(data), [data]);\n\n const flatListItems = useMemo(() => {\n if (!showFlatList) {\n return [];\n }\n const base = flatPaths.filter((flatPath) => (changeOnSelect ? true : flatPath.leaf));\n if (!isSearching) {\n return base;\n }\n return base.filter((flatPath) =>\n filter\n ? filter(_searchValue, flatPath.options)\n : defaultCascaderFilter(_searchValue, flatPath.options, separatorString)\n );\n }, [flatPaths, showFlatList, isSearching, _searchValue, changeOnSelect, filter, separatorString]);\n\n const canInteract = !readOnly && !disabled;\n\n const handleSearchChange = (nextValue: string) => {\n setSearchValue(nextValue);\n if (canInteract) {\n combobox.openDropdown();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.key === 'Escape') {\n combobox.closeDropdown();\n return;\n }\n\n if (showFlatList || !canInteract) {\n return;\n }\n\n if (!combobox.dropdownOpened) {\n const opensDropdown =\n event.key === 'ArrowDown' ||\n event.key === 'ArrowUp' ||\n event.key === 'ArrowRight' ||\n event.key === 'Enter' ||\n (!searchable && event.key === ' ');\n\n if (opensDropdown) {\n event.preventDefault();\n cascader.setKeyboardNav(true);\n combobox.openDropdown();\n\n if (!cascader.value && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {\n const rootIndex =\n event.key === 'ArrowDown'\n ? firstEnabledOptionIndex(data)\n : lastEnabledOptionIndex(data);\n if (rootIndex >= 0) {\n cascader.setActivePath([data[rootIndex].value]);\n }\n }\n }\n return;\n }\n\n if (cascader.handleColumnsKeyDown(event)) {\n event.preventDefault();\n } else if (!searchable && event.key === ' ') {\n event.preventDefault();\n }\n };\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n onClear?.();\n cascader.setValue(null);\n cascader.setActivePath([]);\n setSearchValue('');\n combobox.focusTarget();\n }}\n />\n );\n\n const hasValue = Array.isArray(cascader.value) && cascader.value.length > 0;\n const _clearable = clearable && hasValue && !disabled && !readOnly;\n\n const listId = _id ? `${_id}-cascader-list` : undefined;\n const valueKey = cascader.value ? JSON.stringify(cascader.value) : null;\n\n const dropdown = (\n <Combobox.Dropdown\n hidden={readOnly || disabled}\n style={showFlatList ? undefined : { padding: 0 }}\n >\n {showFlatList ? (\n <Combobox.Options aria-label={typeof label === 'string' ? label : undefined}>\n <ScrollArea.Autosize\n mah={maxDropdownHeight ?? 260}\n type=\"scroll\"\n scrollbarSize=\"var(--combobox-padding)\"\n offsetScrollbars=\"y\"\n {...scrollAreaProps}\n >\n {flatListItems.map((flatPath, index) => {\n const pathKey = JSON.stringify(flatPath.path);\n const active = valueKey !== null && pathKey === valueKey;\n return (\n <Combobox.Option\n key={pathKey}\n value={`${index}`}\n active={active}\n disabled={flatPath.disabled}\n >\n <span {...getStyles('flatOption')}>\n {active && withCheckIcon && checkIconPosition === 'left' && (\n <CheckIcon {...getStyles('columnOptionCheck')} />\n )}\n <span {...getStyles('columnOptionLabel')}>\n {renderSearchOption\n ? renderSearchOption(_searchValue, flatPath.options)\n : defaultRenderSearchOption(flatPath.options, separator)}\n </span>\n {active && withCheckIcon && checkIconPosition !== 'left' && (\n <CheckIcon {...getStyles('columnOptionCheck')} />\n )}\n </span>\n </Combobox.Option>\n );\n })}\n </ScrollArea.Autosize>\n {flatListItems.length === 0 && nothingFoundMessage && (\n <Combobox.Empty>{nothingFoundMessage}</Combobox.Empty>\n )}\n </Combobox.Options>\n ) : (\n <CascaderColumns\n data={data}\n activePath={cascader.activePath}\n value={cascader.value}\n keyboardNav={cascader.keyboardNav}\n withCheckIcon={withCheckIcon}\n checkIconPosition={checkIconPosition}\n renderOption={renderOption}\n columnWidth={columnWidth}\n maxDisplayedLevels={maxDisplayedLevels}\n previousLevelsControlLabel={previousLevelsControlLabel}\n nextLevelsControlLabel={nextLevelsControlLabel}\n maxDropdownHeight={maxDropdownHeight}\n nothingFoundMessage={nothingFoundMessage}\n getStyles={getStyles}\n unstyled={unstyled}\n scrollAreaProps={scrollAreaProps}\n onOptionClick={cascader.handleOptionClick}\n onOptionMouseEnter={cascader.handleOptionMouseEnter}\n onColumnsMouseLeave={() => {\n if (expandTrigger === 'hover') {\n cascader.setActivePath(cascader.value ?? []);\n }\n }}\n onPointerActivity={() => cascader.setKeyboardNav(false)}\n listId={listId}\n safeAreaPolygon={expandTrigger === 'hover' ? safeAreaPolygon : false}\n />\n )}\n </Combobox.Dropdown>\n );\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Cascader\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n width={showFlatList ? 'target' : 'max-content'}\n position=\"bottom-start\"\n onOptionSubmit={(val) => {\n const index = Number(val);\n const flatPath = flatListItems[index];\n if (!flatPath || flatPath.disabled) {\n return;\n }\n cascader.selectPath(flatPath.path);\n cascader.setActivePath(flatPath.path);\n if (shouldCloseOnSelect) {\n combobox.closeDropdown();\n }\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n withKeyboardNavigation={showFlatList}\n autoComplete={autoComplete}\n >\n <InputBase\n id={_id}\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 {...rest}\n {...styleProps}\n size={size}\n __staticSelector=\"Cascader\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={searchable ? _searchValue : displayString}\n onChange={(event) => handleSearchChange(event.currentTarget.value)}\n onFocus={(event) => {\n if (openOnFocus && searchable && canInteract) {\n combobox.openDropdown();\n }\n onFocus?.(event);\n }}\n onBlur={(event) => {\n combobox.closeDropdown();\n onBlur?.(event);\n }}\n onClick={(event) => {\n if (canInteract) {\n cascader.setKeyboardNav(false);\n if (searchable) {\n combobox.openDropdown();\n } else {\n combobox.toggleDropdown();\n }\n }\n onClick?.(event);\n }}\n onKeyDown={handleKeyDown}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n success={success}\n attributes={attributes}\n className={className}\n style={style}\n variant={variant}\n radius={radius}\n leftSection={leftSection}\n leftSectionWidth={leftSectionWidth}\n leftSectionPointerEvents={leftSectionPointerEvents}\n leftSectionProps={leftSectionProps}\n rightSectionWidth={rightSectionWidth}\n rightSectionProps={rightSectionProps}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n successProps={successProps}\n wrapperProps={wrapperProps}\n description={description}\n label={label}\n withErrorStyles={withErrorStyles}\n withSuccessStyles={withSuccessStyles}\n placeholder={placeholder}\n required={required}\n mod={mod}\n />\n </Combobox.Target>\n {dropdown}\n </Combobox>\n <Combobox.HiddenInput\n value={cascader.value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nCascader.classes = { ...InputBase.classes, ...Combobox.classes, ...classes };\nCascader.displayName = '@mantine/core/Cascader';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8MA,MAAM,eAAe;CACnB,eAAe;CACf,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;CACb,YAAY;CACZ,WAAW;CACX,oBAAoB;CACpB,4BAA4B;CAC5B,wBAAwB;CACxB,mBAAmB;CACnB,aAAa;CACb,MAAM;AACR;AAEA,SAAS,oBAAoB,QAAgC;CAC3D,OAAO,OAAO,OAAO,UAAU,YAAY,OAAO,OAAO,UAAU,WAC/D,OAAO,OAAO,KAAK,IACnB,OAAO;AACb;AAEA,SAAS,wBAAwB,S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AAY,aAAa,UAAU;GACnC,wBAAwB;GACV;aAEd,oBAAC,WAAD;IACE,IAAI;IACJ,uBACE,oBAAC,SAAS,SAAV;KACQ;KACC;KACG;KACV,OAAO;IACR,CAAA;IAEH,gBAAgB;IAChB,aAAa;IACb,oBAAoB;IACN;IACd,2BAA2B,6BAA6B;IACxD,GAAI;IACJ,GAAI;IACE;IACN,kBAAiB;IACP;IACV,UAAU,YAAY,CAAC;IACvB,OAAO,aAAa,eAAe;IACnC,WAAW,UAAU,mBAAmB,MAAM,cAAc,KAAK;IACjE,UAAU,UAAU;KAClB,IAAI,eAAe,cAAc,aAC/B,SAAS,aAAa;KAExB,UAAU,KAAK;IACjB;IACA,SAAS,UAAU;KACjB,SAAS,cAAc;KACvB,SAAS,KAAK;IAChB;IACA,UAAU,UAAU;KAClB,IAAI,aAAa;MACf,SAAS,eAAe,KAAK;MAC7B,IAAI,YACF,SAAS,aAAa;WAEtB,SAAS,eAAe;KAE5B;KACA,UAAU,KAAK;IACjB;IACA,WAAW;IACX,YAAY;IACZ,QAAQ;IACE;IACV,SAAS,CAAC;IACH;IACE;IACG;IACD;IACJ;IACE;IACD;IACK;IACK;IACQ;IACR;IACC;IACA;IACH;IACG;IACL;IACF;IACM;IACN;IACE;IACA;IACD;IACN;IACU;IACE;IACN;IACH;IACL;GACN,CAAA;EACc,CAAA,GAChB,QACO;KACV,oBAAC,SAAS,aAAV;EACE,OAAO,SAAS;EACV;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,SAAS,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;CAAS,GAAGC;AAAQ;AAC3E,SAAS,cAAc"}
1
+ {"version":3,"file":"Cascader.mjs","names":["useId","classes"],"sources":["../../../src/components/Cascader/Cascader.tsx"],"sourcesContent":["import { Fragment, useEffect, useMemo } from 'react';\nimport type { SafePolygonOptions } from '@floating-ui/react';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n Factory,\n factory,\n MantineColor,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport { CheckIcon } from '../Checkbox/CheckIcon';\nimport { Combobox, ComboboxLikeStylesNames, useCombobox } from '../Combobox';\nimport { isExternalInputChange } from '../Combobox/is-external-input-change/is-external-input-change';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollArea, ScrollAreaProps } from '../ScrollArea';\nimport { CascaderColumns } from './CascaderColumns';\nimport { flattenCascaderPaths } from './flatten-cascader-paths';\nimport { getCascaderPathOptions } from './get-cascader-path-options';\nimport { useCascader } from './use-cascader';\nimport classes from './Cascader.module.css';\n\nexport interface CascaderOption {\n /** Option value, must be unique across the whole data tree */\n value: string;\n\n /** Option label, if not set `value` is used instead */\n label?: React.ReactNode;\n\n /** Nested options */\n children?: CascaderOption[];\n\n /** If set, the option cannot be selected or expanded */\n disabled?: boolean;\n}\n\nexport interface CascaderFormatValueInput {\n /** Selected path from root to node */\n value: string[];\n\n /** Option chain resolved from the selected path */\n options: CascaderOption[];\n}\n\nexport type CascaderFormatValue = (input: CascaderFormatValueInput) => React.ReactNode;\n\nexport type CascaderSafeAreaPolygonOptions = Omit<SafePolygonOptions, 'blockPointerEvents'>;\n\nexport type CascaderStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'columnsList'\n | 'columnsOverflow'\n | 'column'\n | 'columnScroll'\n | 'columnOption'\n | 'columnOptionLabel'\n | 'columnOptionIcon'\n | 'columnOptionCheck'\n | 'columnEmpty'\n | 'flatOption';\n\nexport interface CascaderProps\n extends\n BoxProps,\n __BaseInputProps,\n StylesApiProps<CascaderFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Hierarchical options data */\n data: CascaderOption[];\n\n /** Controlled selected path from root to node */\n value?: string[] | null;\n\n /** Uncontrolled selected path from root to node */\n defaultValue?: string[] | null;\n\n /** Called when the selected path changes with the path and the resolved option chain */\n onChange?: (value: string[] | null, options: CascaderOption[]) => void;\n\n /** If set, any intermediate option can be selected, not only leaf options @default false */\n changeOnSelect?: boolean;\n\n /** Determines whether the dropdown should be closed when a value is selected, defaults to `!allowDeselect` */\n closeOnSelect?: boolean;\n\n /** If set, the selected value can be deselected by selecting it again @default true */\n allowDeselect?: boolean;\n\n /** If set, the check icon is displayed on the selected option @default true */\n withCheckIcon?: boolean;\n\n /** Position of the check icon relative to the option label @default 'right' */\n checkIconPosition?: 'left' | 'right';\n\n /** Renders the dropdown as cascading columns. When `false`, options are rendered as a flat list of paths, the same way as search results (useful for narrow/mobile layouts) @default true */\n withColumns?: boolean;\n\n /** Determines how the next column is opened @default 'click' */\n expandTrigger?: 'click' | 'hover';\n\n /** Determines whether the next column stays open while the cursor moves toward it, applicable only when `expandTrigger=\"hover\"`. Pass an object to configure safe polygon behavior. @default true */\n safeAreaPolygon?: boolean | CascaderSafeAreaPolygonOptions;\n\n /** If set, options can be searched by their flattened paths @default false */\n searchable?: boolean;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Uncontrolled search value */\n defaultSearchValue?: string;\n\n /** Called when the search value changes */\n onSearchChange?: (value: string) => void;\n\n /** Custom search filter, matched against the full option path */\n filter?: (query: string, options: CascaderOption[]) => boolean;\n\n /** Custom rendering of a search result row */\n renderSearchOption?: (query: string, options: CascaderOption[]) => React.ReactNode;\n\n /** A function to format the selected path displayed in the input, should return a string */\n formatValue?: CascaderFormatValue;\n\n /** Custom rendering of an option in columns */\n renderOption?: (option: CascaderOption, level: number) => React.ReactNode;\n\n /** Path separator displayed in the input and search results @default '/' */\n separator?: React.ReactNode;\n\n /** Width of each column */\n columnWidth?: number | string;\n\n /** Maximum number of columns (levels) displayed next to each other, deeper levels replace earlier ones @default 3 */\n maxDisplayedLevels?: number;\n\n /** `aria-label` and `title` of the control that reveals levels hidden before the visible ones by `maxDisplayedLevels` @default 'Show previous levels' */\n previousLevelsControlLabel?: string;\n\n /** `aria-label` and `title` of the control that reveals levels hidden after the visible ones by `maxDisplayedLevels` @default 'Show next levels' */\n nextLevelsControlLabel?: string;\n\n /** Max height of a column before it becomes scrollable @default 260 */\n maxDropdownHeight?: number | string;\n\n /** Message displayed when there are no options or search results */\n nothingFoundMessage?: React.ReactNode;\n\n /** If set, the clear button is displayed when a value is selected @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 /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Controlled dropdown opened state */\n dropdownOpened?: boolean;\n\n /** Uncontrolled dropdown opened state */\n defaultDropdownOpened?: boolean;\n\n /** Called when the dropdown opens */\n onDropdownOpen?: () => void;\n\n /** Called when the dropdown closes */\n onDropdownClose?: () => void;\n\n /** Props passed down to the underlying `Combobox` component */\n comboboxProps?: Record<string, any>;\n\n /** Props passed down to the dropdown `ScrollArea` */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls the default chevron color */\n chevronColor?: MantineColor;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Opens the dropdown when the input is focused in `searchable` mode @default true */\n openOnFocus?: boolean;\n}\n\nexport type CascaderFactory = Factory<{\n props: CascaderProps;\n ref: HTMLInputElement;\n stylesNames: CascaderStylesNames;\n variant: InputVariant;\n}>;\n\nconst defaultProps = {\n expandTrigger: 'click',\n safeAreaPolygon: true,\n changeOnSelect: false,\n allowDeselect: true,\n withCheckIcon: true,\n checkIconPosition: 'right',\n withColumns: true,\n searchable: false,\n separator: '/',\n maxDisplayedLevels: 3,\n previousLevelsControlLabel: 'Show previous levels',\n nextLevelsControlLabel: 'Show next levels',\n maxDropdownHeight: 260,\n openOnFocus: true,\n size: 'sm',\n} satisfies Partial<CascaderProps>;\n\nfunction optionLabelToString(option: CascaderOption): string {\n return typeof option.label === 'string' || typeof option.label === 'number'\n ? String(option.label)\n : option.value;\n}\n\nfunction firstEnabledOptionIndex(options: CascaderOption[]): number {\n return options.findIndex((option) => !option.disabled);\n}\n\nfunction lastEnabledOptionIndex(options: CascaderOption[]): number {\n for (let index = options.length - 1; index >= 0; index -= 1) {\n if (!options[index].disabled) {\n return index;\n }\n }\n return -1;\n}\n\nfunction joinPathLabels(options: CascaderOption[], separator: string): string {\n return options.map(optionLabelToString).join(` ${separator} `);\n}\n\nfunction defaultCascaderFilter(\n query: string,\n options: CascaderOption[],\n separator: string\n): boolean {\n const trimmed = query.trim().toLowerCase();\n if (trimmed.length === 0) {\n return true;\n }\n return joinPathLabels(options, separator).toLowerCase().includes(trimmed);\n}\n\nfunction defaultRenderSearchOption(\n options: CascaderOption[],\n separator: React.ReactNode\n): React.ReactNode {\n return options.map((option, index) => (\n <Fragment key={option.value}>\n {index > 0 && <span data-cascader-separator> {separator} </span>}\n {option.label ?? option.value}\n </Fragment>\n ));\n}\n\nexport const Cascader = factory<CascaderFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'Cascader'], defaultProps as any, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n size,\n data,\n value,\n defaultValue,\n onChange,\n changeOnSelect,\n closeOnSelect,\n allowDeselect,\n withCheckIcon,\n checkIconPosition,\n withColumns,\n expandTrigger,\n safeAreaPolygon,\n searchable,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n filter,\n renderSearchOption,\n formatValue,\n renderOption,\n separator,\n columnWidth,\n maxDisplayedLevels,\n previousLevelsControlLabel,\n nextLevelsControlLabel,\n maxDropdownHeight,\n nothingFoundMessage,\n clearable,\n clearSectionMode,\n clearButtonProps,\n onClear,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n comboboxProps,\n scrollAreaProps,\n chevronColor,\n hiddenInputProps,\n openOnFocus,\n variant,\n onKeyDown,\n onFocus,\n onBlur,\n onClick,\n readOnly,\n disabled,\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 successProps,\n wrapperProps,\n description,\n label,\n error,\n success,\n withErrorStyles,\n withSuccessStyles,\n name,\n form,\n id,\n placeholder,\n required,\n mod,\n attributes,\n ...others\n } = props;\n\n const _id = useId(id);\n const separatorString =\n typeof separator === 'string' || typeof separator === 'number' ? String(separator) : '/';\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n cascader.resetActivePath();\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n if (searchable) {\n setSearchValue(cascader.value ? displayString : '');\n }\n },\n });\n\n // When `allowDeselect` is enabled, keep the dropdown open by default so the value can be toggled\n const shouldCloseOnSelect = closeOnSelect ?? !allowDeselect;\n\n const cascader = useCascader({\n data,\n value,\n defaultValue,\n onChange,\n changeOnSelect,\n allowDeselect,\n expandTrigger,\n onLeafSelect: () => {\n if (shouldCloseOnSelect) {\n combobox.closeDropdown();\n }\n },\n });\n\n const getStyles = useStyles<CascaderFactory>({\n name: 'Cascader',\n classes,\n props: props as any,\n classNames,\n styles,\n unstyled,\n attributes,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<CascaderFactory>({\n props,\n styles,\n classNames,\n });\n\n const {\n styleProps,\n rest: { type, autoComplete, ...rest },\n } = extractStyleProps(others);\n\n const displayString = useMemo(() => {\n if (cascader.pathOptions.length === 0 || !cascader.value) {\n return '';\n }\n if (formatValue) {\n const rendered = formatValue({ value: cascader.value, options: cascader.pathOptions });\n if (typeof rendered === 'string' || typeof rendered === 'number') {\n return String(rendered);\n }\n }\n return joinPathLabels(cascader.pathOptions, separatorString);\n }, [cascader.pathOptions, cascader.value, formatValue, separatorString]);\n\n const initialSearchValue = useMemo(() => {\n if (!searchable || !defaultValue) {\n return '';\n }\n return joinPathLabels(getCascaderPathOptions(data, defaultValue), separatorString);\n }, []);\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: initialSearchValue,\n onChange: onSearchChange,\n });\n\n const isSearching =\n !!searchable && _searchValue.trim().length > 0 && _searchValue !== displayString;\n\n useEffect(() => {\n if (searchable) {\n setSearchValue(cascader.value ? displayString : '');\n }\n }, [cascader.value]);\n\n // The dropdown renders a flat list of paths when searching or when `withColumns` is disabled\n const showFlatList = isSearching || !withColumns;\n\n const flatPaths = useMemo(() => flattenCascaderPaths(data), [data]);\n\n const flatListItems = useMemo(() => {\n if (!showFlatList) {\n return [];\n }\n const base = flatPaths.filter((flatPath) => (changeOnSelect ? true : flatPath.leaf));\n if (!isSearching) {\n return base;\n }\n return base.filter((flatPath) =>\n filter\n ? filter(_searchValue, flatPath.options)\n : defaultCascaderFilter(_searchValue, flatPath.options, separatorString)\n );\n }, [flatPaths, showFlatList, isSearching, _searchValue, changeOnSelect, filter, separatorString]);\n\n const canInteract = !readOnly && !disabled;\n\n const handleSearchChange = (nextValue: string) => {\n setSearchValue(nextValue);\n if (canInteract) {\n combobox.openDropdown();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.key === 'Escape') {\n combobox.closeDropdown();\n return;\n }\n\n if (showFlatList || !canInteract) {\n return;\n }\n\n if (!combobox.dropdownOpened) {\n const opensDropdown =\n event.key === 'ArrowDown' ||\n event.key === 'ArrowUp' ||\n event.key === 'ArrowRight' ||\n event.key === 'Enter' ||\n (!searchable && event.key === ' ');\n\n if (opensDropdown) {\n event.preventDefault();\n cascader.setKeyboardNav(true);\n combobox.openDropdown();\n\n if (!cascader.value && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {\n const rootIndex =\n event.key === 'ArrowDown'\n ? firstEnabledOptionIndex(data)\n : lastEnabledOptionIndex(data);\n if (rootIndex >= 0) {\n cascader.setActivePath([data[rootIndex].value]);\n }\n }\n }\n return;\n }\n\n if (cascader.handleColumnsKeyDown(event)) {\n event.preventDefault();\n } else if (!searchable && event.key === ' ') {\n event.preventDefault();\n }\n };\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n onClear?.();\n cascader.setValue(null);\n cascader.setActivePath([]);\n setSearchValue('');\n combobox.focusTarget();\n }}\n />\n );\n\n const hasValue = Array.isArray(cascader.value) && cascader.value.length > 0;\n const _clearable = clearable && hasValue && !disabled && !readOnly;\n\n const listId = _id ? `${_id}-cascader-list` : undefined;\n const valueKey = cascader.value ? JSON.stringify(cascader.value) : null;\n\n const dropdown = (\n <Combobox.Dropdown\n hidden={readOnly || disabled}\n style={showFlatList ? undefined : { padding: 0 }}\n >\n {showFlatList ? (\n <Combobox.Options aria-label={typeof label === 'string' ? label : undefined}>\n <ScrollArea.Autosize\n mah={maxDropdownHeight ?? 260}\n type=\"scroll\"\n scrollbarSize=\"var(--combobox-padding)\"\n offsetScrollbars=\"y\"\n {...scrollAreaProps}\n >\n {flatListItems.map((flatPath, index) => {\n const pathKey = JSON.stringify(flatPath.path);\n const active = valueKey !== null && pathKey === valueKey;\n return (\n <Combobox.Option\n key={pathKey}\n value={`${index}`}\n active={active}\n disabled={flatPath.disabled}\n >\n <span {...getStyles('flatOption')}>\n {active && withCheckIcon && checkIconPosition === 'left' && (\n <CheckIcon {...getStyles('columnOptionCheck')} />\n )}\n <span {...getStyles('columnOptionLabel')}>\n {renderSearchOption\n ? renderSearchOption(_searchValue, flatPath.options)\n : defaultRenderSearchOption(flatPath.options, separator)}\n </span>\n {active && withCheckIcon && checkIconPosition !== 'left' && (\n <CheckIcon {...getStyles('columnOptionCheck')} />\n )}\n </span>\n </Combobox.Option>\n );\n })}\n </ScrollArea.Autosize>\n {flatListItems.length === 0 && nothingFoundMessage && (\n <Combobox.Empty>{nothingFoundMessage}</Combobox.Empty>\n )}\n </Combobox.Options>\n ) : (\n <CascaderColumns\n data={data}\n activePath={cascader.activePath}\n value={cascader.value}\n keyboardNav={cascader.keyboardNav}\n withCheckIcon={withCheckIcon}\n checkIconPosition={checkIconPosition}\n renderOption={renderOption}\n columnWidth={columnWidth}\n maxDisplayedLevels={maxDisplayedLevels}\n previousLevelsControlLabel={previousLevelsControlLabel}\n nextLevelsControlLabel={nextLevelsControlLabel}\n maxDropdownHeight={maxDropdownHeight}\n nothingFoundMessage={nothingFoundMessage}\n getStyles={getStyles}\n unstyled={unstyled}\n scrollAreaProps={scrollAreaProps}\n onOptionClick={cascader.handleOptionClick}\n onOptionMouseEnter={cascader.handleOptionMouseEnter}\n onColumnsMouseLeave={() => {\n if (expandTrigger === 'hover') {\n cascader.setActivePath(cascader.value ?? []);\n }\n }}\n onPointerActivity={() => cascader.setKeyboardNav(false)}\n listId={listId}\n safeAreaPolygon={expandTrigger === 'hover' ? safeAreaPolygon : false}\n />\n )}\n </Combobox.Dropdown>\n );\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Cascader\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n width={showFlatList ? 'target' : 'max-content'}\n position=\"bottom-start\"\n onOptionSubmit={(val) => {\n const index = Number(val);\n const flatPath = flatListItems[index];\n if (!flatPath || flatPath.disabled) {\n return;\n }\n cascader.selectPath(flatPath.path);\n cascader.setActivePath(flatPath.path);\n if (shouldCloseOnSelect) {\n combobox.closeDropdown();\n }\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n withKeyboardNavigation={showFlatList}\n autoComplete={autoComplete}\n >\n <InputBase\n id={_id}\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 {...rest}\n {...styleProps}\n size={size}\n __staticSelector=\"Cascader\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={searchable ? _searchValue : displayString}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n }}\n onFocus={(event) => {\n if (openOnFocus && searchable && canInteract) {\n combobox.openDropdown();\n }\n onFocus?.(event);\n }}\n onBlur={(event) => {\n combobox.closeDropdown();\n onBlur?.(event);\n }}\n onClick={(event) => {\n if (canInteract) {\n cascader.setKeyboardNav(false);\n if (searchable) {\n combobox.openDropdown();\n } else {\n combobox.toggleDropdown();\n }\n }\n onClick?.(event);\n }}\n onKeyDown={handleKeyDown}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n success={success}\n attributes={attributes}\n className={className}\n style={style}\n variant={variant}\n radius={radius}\n leftSection={leftSection}\n leftSectionWidth={leftSectionWidth}\n leftSectionPointerEvents={leftSectionPointerEvents}\n leftSectionProps={leftSectionProps}\n rightSectionWidth={rightSectionWidth}\n rightSectionProps={rightSectionProps}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n successProps={successProps}\n wrapperProps={wrapperProps}\n description={description}\n label={label}\n withErrorStyles={withErrorStyles}\n withSuccessStyles={withSuccessStyles}\n placeholder={placeholder}\n required={required}\n mod={mod}\n />\n </Combobox.Target>\n {dropdown}\n </Combobox>\n <Combobox.HiddenInput\n value={cascader.value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nCascader.classes = { ...InputBase.classes, ...Combobox.classes, ...classes };\nCascader.displayName = '@mantine/core/Cascader';\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B;CAAU,GAAG,cAAqB,MAAM;CACzF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,MACA,OACA,cACA,UACA,gBACA,eACA,eACA,eACA,mBACA,aACA,eACA,iBACA,YACA,aACA,oBACA,gBACA,QACA,oBACA,aACA,cACA,WACA,aACA,oBACA,4BACA,wBACA,mBACA,qBACA,WACA,kBACA,kBACA,SACA,gBACA,uBACA,gBACA,iBACA,eACA,iBACA,cACA,kBACA,aACA,SACA,WACA,SACA,QACA,SACA,UACA,UACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,YACA,kBACA,YACA,cACA,cACA,aACA,OACA,OACA,SACA,iBACA,mBACA,MACA,MACA,IACA,aACA,UACA,KACA,YACA,GAAG,WACD;CAEJ,MAAM,MAAMA,QAAM,EAAE;CACpB,MAAM,kBACJ,OAAO,cAAc,YAAY,OAAO,cAAc,WAAW,OAAO,SAAS,IAAI;CAEvF,MAAM,WAAW,YAAY;EAC3B,QAAQ;EACR,eAAe;EACf,sBAAsB;GACpB,iBAAiB;GACjB,SAAS,gBAAgB;EAC3B;EACA,uBAAuB;GACrB,kBAAkB;GAClB,IAAI,YACF,eAAe,SAAS,QAAQ,gBAAgB,EAAE;EAEtD;CACF,CAAC;CAGD,MAAM,sBAAsB,iBAAiB,CAAC;CAE9C,MAAM,WAAW,YAAY;EAC3B;EACA;EACA;EACA;EACA;EACA;EACA;EACA,oBAAoB;GAClB,IAAI,qBACF,SAAS,cAAc;EAE3B;CACF,CAAC;CAED,MAAM,YAAY,UAA2B;EAC3C,MAAM;EACN,SAAA;EACO;EACP;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,oBAAoB,mBAAmB,qBAAsC;EACnF;EACA;EACA;CACF,CAAC;CAED,MAAM,EACJ,YACA,MAAM,EAAE,MAAM,cAAc,GAAG,WAC7B,kBAAkB,MAAM;CAE5B,MAAM,gBAAgB,cAAc;EAClC,IAAI,SAAS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;IACU;IACE;IACN;IACH;IACL;GACN,CAAA;EACc,CAAA,GAChB,QACO;KACV,oBAAC,SAAS,aAAV;EACE,OAAO,SAAS;EACV;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,SAAS,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;CAAS,GAAGC;AAAQ;AAC3E,SAAS,cAAc"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ //#region packages/@mantine/core/src/components/Combobox/get-options-lockup/get-option-by-label.ts
3
+ /**
4
+ * Finds an enabled option by its label, ignoring casing and surrounding whitespace. Returns
5
+ * `undefined` when the label is ambiguous: options with duplicate labels are valid data, and there
6
+ * is no way to tell which of them was meant.
7
+ */
8
+ function getOptionByLabel(optionsLockup, label) {
9
+ const normalizedLabel = label.trim().toLowerCase();
10
+ if (normalizedLabel === "") return;
11
+ const matchedOptions = Object.values(optionsLockup).filter((option) => !option.disabled && option.label.trim().toLowerCase() === normalizedLabel);
12
+ return matchedOptions.length === 1 ? matchedOptions[0] : void 0;
13
+ }
14
+ //#endregion
15
+ export { getOptionByLabel };
16
+
17
+ //# sourceMappingURL=get-option-by-label.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-option-by-label.mjs","names":[],"sources":["../../../../src/components/Combobox/get-options-lockup/get-option-by-label.ts"],"sourcesContent":["import { Primitive } from '../../../core';\nimport { ComboboxItem } from '../Combobox.types';\n\n/**\n * Finds an enabled option by its label, ignoring casing and surrounding whitespace. Returns\n * `undefined` when the label is ambiguous: options with duplicate labels are valid data, and there\n * is no way to tell which of them was meant.\n */\nexport function getOptionByLabel<Value extends Primitive = string>(\n optionsLockup: Record<PropertyKey, ComboboxItem<Value>>,\n label: string\n): ComboboxItem<Value> | undefined {\n const normalizedLabel = label.trim().toLowerCase();\n\n if (normalizedLabel === '') {\n return undefined;\n }\n\n const matchedOptions = Object.values(optionsLockup).filter(\n (option) => !option.disabled && option.label.trim().toLowerCase() === normalizedLabel\n );\n\n return matchedOptions.length === 1 ? matchedOptions[0] : undefined;\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,iBACd,eACA,OACiC;CACjC,MAAM,kBAAkB,MAAM,KAAK,CAAC,CAAC,YAAY;CAEjD,IAAI,oBAAoB,IACtB;CAGF,MAAM,iBAAiB,OAAO,OAAO,aAAa,CAAC,CAAC,QACjD,WAAW,CAAC,OAAO,YAAY,OAAO,MAAM,KAAK,CAAC,CAAC,YAAY,MAAM,eACxE;CAEA,OAAO,eAAe,WAAW,IAAI,eAAe,KAAK,KAAA;AAC3D"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { getRootElement } from "../../../core/utils/find-element-in-shadow-dom/find-element-in-shadow-dom.mjs";
3
+ //#region packages/@mantine/core/src/components/Combobox/is-external-input-change/is-external-input-change.ts
4
+ /**
5
+ * Determines whether an input change was produced by something other than the user typing into the
6
+ * input – browser autofill, password managers and browser extensions all write to inputs without
7
+ * focusing them first. Combobox components reconcile the search value with the selected value on
8
+ * blur, which never happens for such writes.
9
+ */
10
+ function isExternalInputChange(event) {
11
+ const target = event.currentTarget;
12
+ return getRootElement(target).activeElement !== target;
13
+ }
14
+ //#endregion
15
+ export { isExternalInputChange };
16
+
17
+ //# sourceMappingURL=is-external-input-change.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-external-input-change.mjs","names":[],"sources":["../../../../src/components/Combobox/is-external-input-change/is-external-input-change.ts"],"sourcesContent":["import { getRootElement } from '../../../core';\n\n/**\n * Determines whether an input change was produced by something other than the user typing into the\n * input – browser autofill, password managers and browser extensions all write to inputs without\n * focusing them first. Combobox components reconcile the search value with the selected value on\n * blur, which never happens for such writes.\n */\nexport function isExternalInputChange(event: React.ChangeEvent<HTMLInputElement>) {\n const target = event.currentTarget;\n return getRootElement(target).activeElement !== target;\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,sBAAsB,OAA4C;CAChF,MAAM,SAAS,MAAM;CACrB,OAAO,eAAe,MAAM,CAAC,CAAC,kBAAkB;AAClD"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxPopover.mjs","names":["comboboxClasses"],"sources":["../../../src/components/ComboboxPopover/ComboboxPopover.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport cx from 'clsx';\nimport { useUncontrolled } from '@mantine/hooks';\nimport {\n Factory,\n genericFactory,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport { CheckIcon } from '../Checkbox';\nimport {\n Combobox,\n ComboboxData,\n ComboboxItem,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n ComboboxProps,\n defaultOptionsFilter,\n getOptionsLockup,\n getParsedComboboxData,\n isOptionsGroup,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport { ComboboxParsedItem } from '../Combobox/Combobox.types';\nimport { isEmptyComboboxData } from '../Combobox/OptionsDropdown/is-empty-combobox-data';\nimport { ScrollArea, ScrollAreaProps } from '../ScrollArea';\nimport { ComboboxPopoverValue } from './ComboboxPopover.types';\nimport { ComboboxPopoverTarget } from './ComboboxPopoverTarget';\nimport comboboxClasses from '../Combobox/Combobox.module.css';\n\nfunction isValueChecked(value: Primitive | Primitive[] | undefined | null, optionValue: Primitive) {\n return Array.isArray(value) ? value.includes(optionValue) : value === optionValue;\n}\n\ninterface OptionProps {\n data: ComboboxParsedItem<Primitive>;\n withCheckIcon?: boolean;\n withAlignedLabels?: boolean;\n value?: Primitive | Primitive[] | null;\n checkIconPosition?: 'left' | 'right';\n unstyled: boolean | undefined;\n renderOption?: (input: ComboboxLikeRenderOptionInput<any>) => React.ReactNode;\n}\n\nfunction Option({\n data,\n withCheckIcon,\n withAlignedLabels,\n value,\n checkIconPosition,\n unstyled,\n renderOption,\n}: OptionProps) {\n if (isOptionsGroup(data)) {\n const options = data.items.map((item) => (\n <Option\n data={item}\n value={value}\n key={`${item.value}`}\n unstyled={unstyled}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n checkIconPosition={checkIconPosition}\n renderOption={renderOption}\n />\n ));\n return <Combobox.Group label={data.group}>{options}</Combobox.Group>;\n }\n\n const checked = isValueChecked(value, data.value);\n const check =\n withCheckIcon &&\n (checked ? (\n <CheckIcon className={comboboxClasses.optionsDropdownCheckIcon} />\n ) : withAlignedLabels ? (\n <div className={comboboxClasses.optionsDropdownCheckPlaceholder} />\n ) : null);\n\n const defaultContent = (\n <>\n {checkIconPosition === 'left' && check}\n <span>{data.label}</span>\n {checkIconPosition === 'right' && check}\n </>\n );\n\n return (\n <Combobox.Option\n value={data.value}\n disabled={data.disabled}\n className={cx({ [comboboxClasses.optionsDropdownOption]: !unstyled })}\n data-reverse={checkIconPosition === 'right' || undefined}\n data-checked={checked || undefined}\n aria-selected={checked}\n active={checked}\n >\n {typeof renderOption === 'function'\n ? renderOption({ option: data, checked })\n : defaultContent}\n </Combobox.Option>\n );\n}\n\ninterface SearchableDropdownProps {\n data: ComboboxParsedItem<Primitive>[];\n filter: OptionsFilter<Primitive> | undefined;\n search: string;\n limit: number | undefined;\n nothingFoundMessage: React.ReactNode | undefined;\n withScrollArea: boolean | undefined;\n maxDropdownHeight: number | string | undefined;\n value: Primitive | Primitive[] | null;\n checkIconPosition: 'left' | 'right' | undefined;\n withCheckIcon: boolean | undefined;\n withAlignedLabels: boolean | undefined;\n unstyled: boolean | undefined;\n renderOption?: (input: ComboboxLikeRenderOptionInput<any>) => React.ReactNode;\n scrollAreaProps: ScrollAreaProps | undefined;\n onSearchChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n}\n\nfunction SearchableDropdown({\n data,\n filter,\n search,\n limit,\n nothingFoundMessage,\n withScrollArea = true,\n maxDropdownHeight,\n value,\n checkIconPosition,\n withCheckIcon = false,\n withAlignedLabels = false,\n unstyled,\n renderOption,\n scrollAreaProps,\n onSearchChange,\n}: SearchableDropdownProps) {\n const filteredData = (filter || defaultOptionsFilter)({\n options: data,\n search,\n limit: limit ?? Infinity,\n });\n const isEmpty = isEmptyComboboxData(filteredData);\n\n const options = filteredData.map((item, index) => (\n <Option\n data={item}\n key={\n isOptionsGroup(item)\n ? `group-${typeof item.group === 'string' ? item.group : index}`\n : `${item.value}`\n }\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n value={value}\n checkIconPosition={checkIconPosition}\n unstyled={unstyled}\n renderOption={renderOption}\n />\n ));\n\n return (\n <Combobox.Dropdown data-composed>\n <Combobox.Search value={search} onChange={onSearchChange} placeholder=\"Search...\" />\n <Combobox.Options>\n {withScrollArea ? (\n <ScrollArea.Autosize\n mah={maxDropdownHeight ?? 220}\n type=\"scroll\"\n scrollbarSize=\"var(--combobox-padding)\"\n offsetScrollbars=\"y\"\n {...scrollAreaProps}\n >\n {options}\n </ScrollArea.Autosize>\n ) : (\n options\n )}\n {isEmpty && nothingFoundMessage && <Combobox.Empty>{nothingFoundMessage}</Combobox.Empty>}\n </Combobox.Options>\n </Combobox.Dropdown>\n );\n}\n\nexport type ComboboxPopoverStylesNames = ComboboxLikeStylesNames;\n\nexport interface ComboboxPopoverProps<\n Multiple extends boolean = false,\n Value extends Primitive = string,\n> extends StylesApiProps<ComboboxPopoverFactory> {\n /** If set, multiple items can be selected at the same time */\n multiple?: Multiple;\n\n /** Controlled component value */\n value?: ComboboxPopoverValue<Multiple, Value>;\n\n /** Uncontrolled component default value */\n defaultValue?: ComboboxPopoverValue<Multiple, Value>;\n\n /** Called when value changes */\n onChange?: (value: ComboboxPopoverValue<Multiple, Value>) => void;\n\n /** Data used to generate options */\n data?: ComboboxData<Value>;\n\n /** Controlled dropdown opened state */\n dropdownOpened?: boolean;\n\n /** Uncontrolled dropdown initial opened state */\n defaultDropdownOpened?: boolean;\n\n /** Called when dropdown opens */\n onDropdownOpen?: () => void;\n\n /** Called when dropdown closes */\n onDropdownClose?: () => void;\n\n /** Called when option is submitted from dropdown with mouse click or Enter key */\n onOptionSubmit?: (value: Value) => void;\n\n /** Props passed down to Combobox component */\n comboboxProps?: ComboboxProps;\n\n /** Function based on which items are filtered and sorted */\n filter?: OptionsFilter<Value>;\n\n /** Maximum number of options displayed at a time @default Infinity */\n limit?: number;\n\n /** Determines whether the options should be wrapped with ScrollArea.AutoSize @default true */\n withScrollArea?: boolean;\n\n /** max-height of the dropdown @default 250 */\n maxDropdownHeight?: number | string;\n\n /** If set, the first option is selected when dropdown opens @default false */\n selectFirstOptionOnDropdownOpen?: boolean;\n\n /** Displays check icon near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** Aligns unchecked labels with the checked one @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the check icon relative to the option label @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** Message displayed when no options match the search query or when there is no data */\n nothingFoundMessage?: React.ReactNode;\n\n /** Allows searching through options @default false */\n searchable?: boolean;\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 /** Allows deselecting the selected option by clicking it (only for single mode) @default true */\n allowDeselect?: boolean;\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 /** Props passed down to the underlying ScrollArea component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Hidden input name for form submission */\n name?: string;\n\n /** Hidden input form for form submission */\n form?: string;\n\n /** Content of the component */\n children?: React.ReactNode;\n\n /** Divider used to separate values in the hidden input value attribute @default ',' */\n hiddenInputValuesDivider?: string;\n}\n\nexport type ComboboxPopoverFactory = Factory<{\n props: ComboboxPopoverProps;\n ref: HTMLDivElement;\n stylesNames: ComboboxPopoverStylesNames;\n signature: <Multiple extends boolean = false, Value extends Primitive = string>(\n props: ComboboxPopoverProps<Multiple, Value>\n ) => React.JSX.Element;\n staticComponents: {\n Target: typeof ComboboxPopoverTarget;\n };\n}>;\n\nconst defaultProps = {\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n hiddenInputValuesDivider: ',',\n} satisfies Partial<ComboboxPopoverProps>;\n\nexport const ComboboxPopover = genericFactory<ComboboxPopoverFactory>((_props) => {\n const props = useProps('ComboboxPopover', defaultProps as any, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n children,\n multiple,\n value,\n defaultValue,\n onChange,\n data,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n onOptionSubmit,\n comboboxProps,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n selectFirstOptionOnDropdownOpen,\n withCheckIcon,\n withAlignedLabels,\n checkIconPosition,\n nothingFoundMessage,\n searchable,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n renderOption,\n scrollAreaProps,\n hiddenInputProps,\n name,\n form,\n hiddenInputValuesDivider,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: multiple ? ([] as any) : null,\n onChange,\n });\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (searchable) {\n combobox.focusSearchInput();\n }\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n if (searchable) {\n combobox.focusTarget();\n }\n },\n });\n\n const handleSearchChange = (val: string) => {\n setSearchValue(val);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<ComboboxPopoverFactory>({\n props,\n styles,\n classNames,\n });\n\n const handleOptionSubmit = (val: string) => {\n onOptionSubmit?.(val as any);\n const option = optionsLockup[val];\n\n if (multiple) {\n const currentValue = Array.isArray(_value) ? _value : [];\n if (currentValue.includes(option.value)) {\n setValue(currentValue.filter((v: any) => v !== option.value) as any);\n } else {\n setValue([...currentValue, option.value] as any);\n }\n combobox.updateSelectedOptionIndex('selected');\n } else {\n const nextValue = allowDeselect && `${option.value}` === `${_value}` ? null : option.value;\n setValue(nextValue as any);\n combobox.closeDropdown();\n }\n\n if (searchable) {\n handleSearchChange('');\n }\n };\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"ComboboxPopover\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n attributes={attributes}\n onOptionSubmit={handleOptionSubmit}\n {...comboboxProps}\n {...others}\n >\n {children}\n {searchable ? (\n <SearchableDropdown\n data={parsedData as any}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={_searchValue}\n limit={limit}\n nothingFoundMessage={nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n unstyled={unstyled}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n onSearchChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n }}\n />\n ) : (\n <OptionsDropdown\n data={parsedData as any}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={undefined}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={false}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n labelId={undefined}\n aria-label={undefined}\n />\n )}\n </Combobox>\n <Combobox.HiddenInput\n name={name}\n value={_value}\n form={form}\n valuesDivider={hiddenInputValuesDivider}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nComboboxPopover.classes = Combobox.classes;\nComboboxPopover.displayName = '@mantine/core/ComboboxPopover';\nComboboxPopover.Target = ComboboxPopoverTarget;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,eAAe,OAAmD,aAAwB;CACjG,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS,WAAW,IAAI,UAAU;AACxE;AAYA,SAAS,OAAO,EACd,MACA,eACA,mBACA,OACA,mBACA,UACA,gBACc;CACd,IAAI,eAAe,IAAI,GAAG;EACxB,MAAM,UAAU,KAAK,MAAM,KAAK,SAC9B,oBAAC,QAAD;GACE,MAAM;GACC;GAEG;GACK;GACI;GACA;GACL;EACf,GANM,GAAG,KAAK,OAMd,CACF;EACD,OAAO,oBAAC,SAAS,OAAV;GAAgB,OAAO,KAAK;aAAQ;EAAwB,CAAA;CACrE;CAEA,MAAM,UAAU,eAAe,OAAO,KAAK,KAAK;CAChD,MAAM,QACJ,kBACC,UACC,oBAAC,WAAD,EAAW,WAAWA,wBAAgB,yBAA2B,CAAA,IAC/D,oBACF,oBAAC,OAAD,EAAK,WAAWA,wBAAgB,gCAAkC,CAAA,IAChE;CAEN,MAAM,iBACJ,qBAAA,YAAA,EAAA,UAAA;EACG,sBAAsB,UAAU;EACjC,oBAAC,QAAD,EAAA,UAAO,KAAK,MAAY,CAAA;EACvB,sBAAsB,WAAW;CAClC,EAAA,CAAA;CAGJ,OACE,oBAAC,SAAS,QAAV;EACE,OAAO,KAAK;EACZ,UAAU,KAAK;EACf,WAAW,GAAG,GAAGA,wBAAgB,wBAAwB,CAAC,SAAS,CAAC;EACpE,gBAAc,sBAAsB,WAAW,KAAA;EAC/C,gBAAc,WAAW,KAAA;EACzB,iBAAe;EACf,QAAQ;YAEP,OAAO,iB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I,YACF,mBAAmB,EAAE;CAEzB;CAEA,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,UAAD;EACE,OAAO;EACP,kBAAiB;EACjB,YAAY;EACZ,QAAQ;EACE;EACE;EACZ,gBAAgB;EAChB,GAAI;EACJ,GAAI;YATN,CAWG,UACA,aACC,oBAAC,oBAAD;GACE,MAAM;GACE;GACR,QAAQ;GACD;GACc;GACL;GACG;GACnB,OAAO;GACY;GACJ;GACI;GACT;GACI;GACG;GACjB,iBAAiB,UAAU;IACzB,mBAAmB,MAAM,cAAc,KAAK;GAC9C;EACD,CAAA,IAED,oBAAC,iBAAD;GACE,MAAM;GACE;GACR,QAAQ,KAAA;GACD;GACP,iBAAiB,CAAC;GACF;GACG;GACnB,eAAe;GACf,OAAO;GACY;GACJ;GACI;GACE;GACX;GACI;GACG;GACjB,SAAS,KAAA;GACT,cAAY,KAAA;EACb,CAAA,CAEK;KACV,oBAAC,SAAS,aAAV;EACQ;EACN,OAAO;EACD;EACN,eAAe;EACf,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,gBAAgB,UAAU,SAAS;AACnC,gBAAgB,cAAc;AAC9B,gBAAgB,SAAS"}
1
+ {"version":3,"file":"ComboboxPopover.mjs","names":["comboboxClasses"],"sources":["../../../src/components/ComboboxPopover/ComboboxPopover.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport cx from 'clsx';\nimport { useUncontrolled } from '@mantine/hooks';\nimport {\n Factory,\n genericFactory,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport { CheckIcon } from '../Checkbox';\nimport {\n Combobox,\n ComboboxData,\n ComboboxItem,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n ComboboxProps,\n defaultOptionsFilter,\n getOptionsLockup,\n getParsedComboboxData,\n isOptionsGroup,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport { ComboboxParsedItem } from '../Combobox/Combobox.types';\nimport { isEmptyComboboxData } from '../Combobox/OptionsDropdown/is-empty-combobox-data';\nimport { ScrollArea, ScrollAreaProps } from '../ScrollArea';\nimport { ComboboxPopoverValue } from './ComboboxPopover.types';\nimport { ComboboxPopoverTarget } from './ComboboxPopoverTarget';\nimport comboboxClasses from '../Combobox/Combobox.module.css';\n\nfunction isValueChecked(value: Primitive | Primitive[] | undefined | null, optionValue: Primitive) {\n return Array.isArray(value) ? value.includes(optionValue) : value === optionValue;\n}\n\ninterface OptionProps {\n data: ComboboxParsedItem<Primitive>;\n withCheckIcon?: boolean;\n withAlignedLabels?: boolean;\n value?: Primitive | Primitive[] | null;\n checkIconPosition?: 'left' | 'right';\n unstyled: boolean | undefined;\n renderOption?: (input: ComboboxLikeRenderOptionInput<any>) => React.ReactNode;\n}\n\nfunction Option({\n data,\n withCheckIcon,\n withAlignedLabels,\n value,\n checkIconPosition,\n unstyled,\n renderOption,\n}: OptionProps) {\n if (isOptionsGroup(data)) {\n const options = data.items.map((item) => (\n <Option\n data={item}\n value={value}\n key={`${item.value}`}\n unstyled={unstyled}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n checkIconPosition={checkIconPosition}\n renderOption={renderOption}\n />\n ));\n return <Combobox.Group label={data.group}>{options}</Combobox.Group>;\n }\n\n const checked = isValueChecked(value, data.value);\n const check =\n withCheckIcon &&\n (checked ? (\n <CheckIcon className={comboboxClasses.optionsDropdownCheckIcon} />\n ) : withAlignedLabels ? (\n <div className={comboboxClasses.optionsDropdownCheckPlaceholder} />\n ) : null);\n\n const defaultContent = (\n <>\n {checkIconPosition === 'left' && check}\n <span>{data.label}</span>\n {checkIconPosition === 'right' && check}\n </>\n );\n\n return (\n <Combobox.Option\n value={data.value}\n disabled={data.disabled}\n className={cx({ [comboboxClasses.optionsDropdownOption]: !unstyled })}\n data-reverse={checkIconPosition === 'right' || undefined}\n data-checked={checked || undefined}\n aria-selected={checked}\n active={checked}\n >\n {typeof renderOption === 'function'\n ? renderOption({ option: data, checked })\n : defaultContent}\n </Combobox.Option>\n );\n}\n\ninterface SearchableDropdownProps {\n data: ComboboxParsedItem<Primitive>[];\n filter: OptionsFilter<Primitive> | undefined;\n search: string;\n limit: number | undefined;\n nothingFoundMessage: React.ReactNode | undefined;\n withScrollArea: boolean | undefined;\n maxDropdownHeight: number | string | undefined;\n value: Primitive | Primitive[] | null;\n checkIconPosition: 'left' | 'right' | undefined;\n withCheckIcon: boolean | undefined;\n withAlignedLabels: boolean | undefined;\n unstyled: boolean | undefined;\n renderOption?: (input: ComboboxLikeRenderOptionInput<any>) => React.ReactNode;\n scrollAreaProps: ScrollAreaProps | undefined;\n onSearchChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n}\n\nfunction SearchableDropdown({\n data,\n filter,\n search,\n limit,\n nothingFoundMessage,\n withScrollArea = true,\n maxDropdownHeight,\n value,\n checkIconPosition,\n withCheckIcon = false,\n withAlignedLabels = false,\n unstyled,\n renderOption,\n scrollAreaProps,\n onSearchChange,\n}: SearchableDropdownProps) {\n const filteredData = (filter || defaultOptionsFilter)({\n options: data,\n search,\n limit: limit ?? Infinity,\n });\n const isEmpty = isEmptyComboboxData(filteredData);\n\n const options = filteredData.map((item, index) => (\n <Option\n data={item}\n key={\n isOptionsGroup(item)\n ? `group-${typeof item.group === 'string' ? item.group : index}`\n : `${item.value}`\n }\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n value={value}\n checkIconPosition={checkIconPosition}\n unstyled={unstyled}\n renderOption={renderOption}\n />\n ));\n\n return (\n <Combobox.Dropdown data-composed>\n <Combobox.Search value={search} onChange={onSearchChange} placeholder=\"Search...\" />\n <Combobox.Options>\n {withScrollArea ? (\n <ScrollArea.Autosize\n mah={maxDropdownHeight ?? 220}\n type=\"scroll\"\n scrollbarSize=\"var(--combobox-padding)\"\n offsetScrollbars=\"y\"\n {...scrollAreaProps}\n >\n {options}\n </ScrollArea.Autosize>\n ) : (\n options\n )}\n {isEmpty && nothingFoundMessage && <Combobox.Empty>{nothingFoundMessage}</Combobox.Empty>}\n </Combobox.Options>\n </Combobox.Dropdown>\n );\n}\n\nexport type ComboboxPopoverStylesNames = ComboboxLikeStylesNames | 'search';\n\nexport interface ComboboxPopoverProps<\n Multiple extends boolean = false,\n Value extends Primitive = string,\n> extends StylesApiProps<ComboboxPopoverFactory> {\n /** If set, multiple items can be selected at the same time */\n multiple?: Multiple;\n\n /** Controlled component value */\n value?: ComboboxPopoverValue<Multiple, Value>;\n\n /** Uncontrolled component default value */\n defaultValue?: ComboboxPopoverValue<Multiple, Value>;\n\n /** Called when value changes */\n onChange?: (value: ComboboxPopoverValue<Multiple, Value>) => void;\n\n /** Data used to generate options */\n data?: ComboboxData<Value>;\n\n /** Controlled dropdown opened state */\n dropdownOpened?: boolean;\n\n /** Uncontrolled dropdown initial opened state */\n defaultDropdownOpened?: boolean;\n\n /** Called when dropdown opens */\n onDropdownOpen?: () => void;\n\n /** Called when dropdown closes */\n onDropdownClose?: () => void;\n\n /** Called when option is submitted from dropdown with mouse click or Enter key */\n onOptionSubmit?: (value: Value) => void;\n\n /** Props passed down to Combobox component */\n comboboxProps?: ComboboxProps;\n\n /** Function based on which items are filtered and sorted */\n filter?: OptionsFilter<Value>;\n\n /** Maximum number of options displayed at a time @default Infinity */\n limit?: number;\n\n /** Determines whether the options should be wrapped with ScrollArea.AutoSize @default true */\n withScrollArea?: boolean;\n\n /** max-height of the dropdown @default 250 */\n maxDropdownHeight?: number | string;\n\n /** If set, the first option is selected when dropdown opens @default false */\n selectFirstOptionOnDropdownOpen?: boolean;\n\n /** Displays check icon near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** Aligns unchecked labels with the checked one @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the check icon relative to the option label @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** Message displayed when no options match the search query or when there is no data */\n nothingFoundMessage?: React.ReactNode;\n\n /** Allows searching through options @default false */\n searchable?: boolean;\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 /** Allows deselecting the selected option by clicking it (only for single mode) @default true */\n allowDeselect?: boolean;\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 /** Props passed down to the underlying ScrollArea component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Hidden input name for form submission */\n name?: string;\n\n /** Hidden input form for form submission */\n form?: string;\n\n /** Content of the component */\n children?: React.ReactNode;\n\n /** Divider used to separate values in the hidden input value attribute @default ',' */\n hiddenInputValuesDivider?: string;\n}\n\nexport type ComboboxPopoverFactory = Factory<{\n props: ComboboxPopoverProps;\n ref: HTMLDivElement;\n stylesNames: ComboboxPopoverStylesNames;\n signature: <Multiple extends boolean = false, Value extends Primitive = string>(\n props: ComboboxPopoverProps<Multiple, Value>\n ) => React.JSX.Element;\n staticComponents: {\n Target: typeof ComboboxPopoverTarget;\n };\n}>;\n\nconst defaultProps = {\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n hiddenInputValuesDivider: ',',\n} satisfies Partial<ComboboxPopoverProps>;\n\nexport const ComboboxPopover = genericFactory<ComboboxPopoverFactory>((_props) => {\n const props = useProps('ComboboxPopover', defaultProps as any, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n children,\n multiple,\n value,\n defaultValue,\n onChange,\n data,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n onOptionSubmit,\n comboboxProps,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n selectFirstOptionOnDropdownOpen,\n withCheckIcon,\n withAlignedLabels,\n checkIconPosition,\n nothingFoundMessage,\n searchable,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n renderOption,\n scrollAreaProps,\n hiddenInputProps,\n name,\n form,\n hiddenInputValuesDivider,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: multiple ? ([] as any) : null,\n onChange,\n });\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (searchable) {\n combobox.focusSearchInput();\n }\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n if (searchable) {\n combobox.focusTarget();\n }\n },\n });\n\n const handleSearchChange = (val: string) => {\n setSearchValue(val);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<ComboboxPopoverFactory>({\n props,\n styles,\n classNames,\n });\n\n const handleOptionSubmit = (val: string) => {\n onOptionSubmit?.(val as any);\n const option = optionsLockup[val];\n\n if (multiple) {\n const currentValue = Array.isArray(_value) ? _value : [];\n if (currentValue.includes(option.value)) {\n setValue(currentValue.filter((v: any) => v !== option.value) as any);\n } else {\n setValue([...currentValue, option.value] as any);\n }\n combobox.updateSelectedOptionIndex('selected');\n } else {\n const nextValue = allowDeselect && `${option.value}` === `${_value}` ? null : option.value;\n setValue(nextValue as any);\n combobox.closeDropdown();\n }\n\n if (searchable) {\n handleSearchChange('');\n }\n };\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"ComboboxPopover\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n attributes={attributes}\n onOptionSubmit={handleOptionSubmit}\n {...comboboxProps}\n {...others}\n >\n {children}\n {searchable ? (\n <SearchableDropdown\n data={parsedData as any}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={_searchValue}\n limit={limit}\n nothingFoundMessage={nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n unstyled={unstyled}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n onSearchChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n }}\n />\n ) : (\n <OptionsDropdown\n data={parsedData as any}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={undefined}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={false}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n labelId={undefined}\n aria-label={undefined}\n />\n )}\n </Combobox>\n <Combobox.HiddenInput\n name={name}\n value={_value}\n form={form}\n valuesDivider={hiddenInputValuesDivider}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nComboboxPopover.classes = Combobox.classes;\nComboboxPopover.displayName = '@mantine/core/ComboboxPopover';\nComboboxPopover.Target = ComboboxPopoverTarget;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,eAAe,OAAmD,aAAwB;CACjG,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS,WAAW,IAAI,UAAU;AACxE;AAYA,SAAS,OAAO,EACd,MACA,eACA,mBACA,OACA,mBACA,UACA,gBACc;CACd,IAAI,eAAe,IAAI,GAAG;EACxB,MAAM,UAAU,KAAK,MAAM,KAAK,SAC9B,oBAAC,QAAD;GACE,MAAM;GACC;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AAA;GACT,cAAY,KAAA;EACb,CAAA,CAEK;KACV,oBAAC,SAAS,aAAV;EACQ;EACN,OAAO;EACD;EACN,eAAe;EACf,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,gBAAgB,UAAU,SAAS;AACnC,gBAAgB,cAAc;AAC9B,gBAAgB,SAAS"}
@@ -11,6 +11,8 @@ import { useCombobox } from "../Combobox/use-combobox/use-combobox.mjs";
11
11
  import { Combobox } from "../Combobox/Combobox.mjs";
12
12
  import { OptionsDropdown } from "../Combobox/OptionsDropdown/OptionsDropdown.mjs";
13
13
  import { usePillsReorder } from "../Combobox/use-pills-reorder/use-pills-reorder.mjs";
14
+ import { isExternalInputChange } from "../Combobox/is-external-input-change/is-external-input-change.mjs";
15
+ import { getOptionByLabel } from "../Combobox/get-options-lockup/get-option-by-label.mjs";
14
16
  import { Pill } from "../Pill/Pill.mjs";
15
17
  import { PillsInput } from "../PillsInput/PillsInput.mjs";
16
18
  import { filterPickedValues } from "./filter-picked-values.mjs";
@@ -260,6 +262,13 @@ const MultiSelect = genericFactory((_props) => {
260
262
  onKeyDown: handleInputKeydown,
261
263
  value: _searchValue,
262
264
  onChange: (event) => {
265
+ if (isExternalInputChange(event)) {
266
+ if (!readOnly) {
267
+ const externalOption = getOptionByLabel(optionsLockup, event.currentTarget.value);
268
+ if (externalOption && !_value.includes(externalOption.value) && _value.length < maxValues) setValue([..._value, externalOption.value]);
269
+ }
270
+ return;
271
+ }
263
272
  handleSearchChange(event.currentTarget.value);
264
273
  searchable && combobox.openDropdown();
265
274
  selectFirstOptionOnChange && combobox.selectFirstOption();
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.mjs","names":["useId"],"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 usePillsReorder,\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 attempts 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<Value>>) => 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 /** If set, selected values can be reordered by dragging pills. Disabled when `disabled` or `readOnly` is set. @default false */\n withPillsReorder?: 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(['Input', 'InputWrapper', '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 floatingHeight,\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 successProps,\n wrapperProps,\n description,\n label,\n error,\n success,\n maxValues,\n searchable,\n nothingFoundMessage,\n withCheckIcon,\n withAlignedLabels,\n checkIconPosition,\n hidePickedOptions,\n withErrorStyles,\n withSuccessStyles,\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 loading,\n loadingPosition,\n withPillsReorder,\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 { getPillProps, getListProps, handleInputKeyDown } = usePillsReorder({\n value: _value,\n onChange: setValue,\n enabled: withPillsReorder && !disabled && !readOnly,\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.defaultPrevented) {\n return;\n }\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 handleInputKeyDown(event);\n };\n\n const values = _value.map((item, index) => {\n const optionData = optionsLockup[`${item}`] || retainedSelectedOptions.current[`${item}`];\n const reorderProps = getPillProps(index);\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 reorderProps,\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 {...reorderProps}\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 floatingHeight={floatingHeight}\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 loading={loading}\n loadingPosition={loadingPosition}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n successProps={successProps}\n wrapperProps={wrapperProps}\n description={description}\n label={label}\n error={error}\n success={success}\n withErrorStyles={withErrorStyles}\n withSuccessStyles={withSuccessStyles}\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 {...getListProps()}\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\nexport namespace MultiSelect {\n export type Props<Value extends Primitive = string> = MultiSelectProps<Value>;\n export type StylesNames = MultiSelectStylesNames;\n export type Factory = MultiSelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,qBAA6C;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AA8GA,MAAM,eAAe;CACnB,WAAW;CACX,eAAe;CACf,mBAAmB;CACnB,0BAA0B;CAC1B,qBAAqB;CACrB,aAAa;CACb,MAAM;AACR;AAEA,MAAa,cAAc,gBAAoC,WAAW;CACxE,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAa,GAAG,cAAc,MAAM;CACrF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,OACA,cACA,UACA,WACA,SACA,MACA,gBACA,uBACA,gBACA,iBACA,2BACA,iCACA,gBACA,eACA,QACA,OACA,gBACA,mBACA,gBACA,aACA,oBACA,gBACA,UACA,UACA,SACA,QACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,YACA,kBACA,YACA,cACA,cACA,aACA,OACA,OACA,SACA,WACA,YACA,qBACA,eACA,mBACA,mBACA,mBACA,iBACA,mBACA,MACA,MACA,IACA,WACA,kBACA,kBACA,kBACA,aACA,0BACA,UACA,KACA,cACA,YACA,UACA,SACA,aACA,iBACA,cACA,YACA,qBACA,aACA,SACA,iBACA,kBACA,GAAG,WACD;CAEJ,MAAM,MAAMA,QAAM,EAAE;CACpB,MAAM,aAAa,sBAAsB,IAAI;CAC7C,MAAM,gBAAgB,iBAAiB,UAAU;CACjD,MAAM,0BAA0B,OAAgD,CAAC,CAAC;CAElF,MAAM,WAAW,YAAY;EAC3B,QAAQ;EACR,eAAe;EACf,sBAAsB;GACpB,iBAAiB;GACjB,IAAI,iCACF,SAAS,kBAAkB;EAE/B;EACA,uBAAuB;GACrB,kBAAkB;GAClB,SAAS,oBAAoB;EAC/B;CACF,CAAC;CAED,MAAM,EACJ,YACA,MAAM,EAAE,MAAM,cAAc,GAAG,WAC7B,kBAAkB,MAAM;CAE5B,MAAM,CAAC,QAAQ,YAAY,gBAAgB;EACzC;EACA;EACA,YAAY,CAAC;EACb;CACF,CAAC;CAED,MAAM,EAAE,cAAc,cAAc,uBAAuB,gBAAgB;EACzE,OAAO;EACP,UAAU;EACV,SAAS,oBAAoB,CAAC,YAAY,CAAC;CAC7C,CAAC;CAED,MAAM,CAAC,cAAc,kBAAkB,gBAAgB;EACrD,OAAO;EACP,cAAc;EACd,YAAY;EACZ,UAAU;CACZ,CAAC;CAED,MAAM,sBAAsB,UAAkB;EAC5C,eAAe,KAAK;EACpB,SAAS,oBAAoB;CAC/B;CAEA,MAAM,Y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AClC,cAAY,QAAQ,KAAA,IAAY,OAAO;GACzB;GACG;EAClB,CAAA,CACO;KACV,oBAAC,SAAS,aAAV;EACQ;EACN,eAAe;EACf,OAAO;EACD;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,YAAY,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;AAAQ;AAClE,YAAY,cAAc"}
1
+ {"version":3,"file":"MultiSelect.mjs","names":["useId"],"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 usePillsReorder,\n} from '../Combobox';\nimport { getOptionByLabel } from '../Combobox/get-options-lockup/get-option-by-label';\nimport { isExternalInputChange } from '../Combobox/is-external-input-change/is-external-input-change';\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 attempts 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<Value>>) => 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 /** If set, selected values can be reordered by dragging pills. Disabled when `disabled` or `readOnly` is set. @default false */\n withPillsReorder?: 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(['Input', 'InputWrapper', '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 floatingHeight,\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 successProps,\n wrapperProps,\n description,\n label,\n error,\n success,\n maxValues,\n searchable,\n nothingFoundMessage,\n withCheckIcon,\n withAlignedLabels,\n checkIconPosition,\n hidePickedOptions,\n withErrorStyles,\n withSuccessStyles,\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 loading,\n loadingPosition,\n withPillsReorder,\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 { getPillProps, getListProps, handleInputKeyDown } = usePillsReorder({\n value: _value,\n onChange: setValue,\n enabled: withPillsReorder && !disabled && !readOnly,\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.defaultPrevented) {\n return;\n }\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 handleInputKeyDown(event);\n };\n\n const values = _value.map((item, index) => {\n const optionData = optionsLockup[`${item}`] || retainedSelectedOptions.current[`${item}`];\n const reorderProps = getPillProps(index);\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 reorderProps,\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 {...reorderProps}\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 floatingHeight={floatingHeight}\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 loading={loading}\n loadingPosition={loadingPosition}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n successProps={successProps}\n wrapperProps={wrapperProps}\n description={description}\n label={label}\n error={error}\n success={success}\n withErrorStyles={withErrorStyles}\n withSuccessStyles={withSuccessStyles}\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 {...getListProps()}\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 if (isExternalInputChange(event)) {\n if (!readOnly) {\n const externalOption = getOptionByLabel(\n optionsLockup,\n event.currentTarget.value\n );\n\n if (\n externalOption &&\n !_value.includes(externalOption.value as any) &&\n _value.length < maxValues\n ) {\n setValue([..._value, externalOption.value] as any);\n }\n }\n\n return;\n }\n\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\nexport namespace MultiSelect {\n export type Props<Value extends Primitive = string> = MultiSelectProps<Value>;\n export type StylesNames = MultiSelectStylesNames;\n export type Factory = MultiSelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,qBAA6C;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AA8GA,MAAM,eAAe;CACnB,WAAW;CACX,eAAe;CACf,mBAAmB;CACnB,0BAA0B;CAC1B,qBAAqB;CACrB,aAAa;CACb,MAAM;AACR;AAEA,MAAa,cAAc,gBAAoC,WAAW;CACxE,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAa,GAAG,cAAc,MAAM;CACrF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,OACA,cACA,UACA,WACA,SACA,MACA,gBACA,uBACA,gBACA,iBACA,2BACA,iCACA,gBACA,eACA,QACA,OACA,gBACA,mBACA,gBACA,aACA,oBACA,gBACA,UACA,UACA,SACA,QACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,YACA,kBACA,YACA,cACA,cACA,aACA,OACA,OACA,SACA,WACA,YACA,qBACA,eACA,mBACA,mBACA,mBACA,iBACA,mBACA,MACA,MACA,IACA,WACA,kBACA,kBACA,kBACA,aACA,0BACA,UACA,KACA,cACA,YACA,UACA,SACA,aACA,iBACA,cACA,YACA,qBACA,aACA,SACA,iBACA,kBACA,GAAG,WACD;CAEJ,MAAM,MAAMA,QAAM,EAAE;C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,YAAY,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.mjs","names":["classes"],"sources":["../../../src/components/Notification/Notification.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineColor,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { CloseButton } from '../CloseButton';\nimport { Loader, LoaderProps } from '../Loader';\nimport classes from './Notification.module.css';\n\nexport type NotificationStylesNames =\n | 'root'\n | 'icon'\n | 'loader'\n | 'body'\n | 'title'\n | 'description'\n | 'closeButton';\nexport type NotificationCssVariables = {\n root: '--notification-radius' | '--notification-color';\n};\n\nexport interface NotificationProps\n extends BoxProps, StylesApiProps<NotificationFactory>, ElementProps<'div', 'title'> {\n /** Called when the close button is clicked */\n onClose?: () => void;\n\n /** Controls icon background color or notification accent line color, key of `theme.colors` or any valid CSS color. When `icon` is provided, sets the icon background color. When no icon is provided, sets the colored accent line on the left. @default theme.primaryColor */\n color?: MantineColor;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Notification icon, replaces color line */\n icon?: React.ReactNode;\n\n /** Notification title, displayed above the message body */\n title?: React.ReactNode;\n\n /** Notification description, displayed below the title. When no title is provided, this serves as the main message. */\n children?: React.ReactNode;\n\n /** If set, displays a `Loader` component instead of the icon. Takes precedence over the `icon` prop if both are provided. */\n loading?: boolean;\n\n /** Adds border to the root element */\n withBorder?: boolean;\n\n /** If set, the close button is visible @default true */\n withCloseButton?: boolean;\n\n /** Props passed down to the close button */\n closeButtonProps?: ElementProps<'button'> & DataAttributes;\n\n /** Props passed down to the `Loader` component */\n loaderProps?: LoaderProps;\n}\n\nexport type NotificationFactory = Factory<{\n props: NotificationProps;\n ref: HTMLDivElement;\n stylesNames: NotificationStylesNames;\n vars: NotificationCssVariables;\n}>;\n\nconst defaultProps = {\n withCloseButton: true,\n} satisfies Partial<NotificationProps>;\n\nconst varsResolver = createVarsResolver<NotificationFactory>((theme, { radius, color }) => ({\n root: {\n '--notification-radius': radius === undefined ? undefined : getRadius(radius),\n '--notification-color': color ? getThemeColor(color, theme) : undefined,\n },\n}));\n\nexport const Notification = factory<NotificationFactory>((_props) => {\n const props = useProps('Notification', defaultProps, _props);\n const {\n className,\n color,\n radius,\n loading,\n withCloseButton,\n withBorder,\n title,\n icon,\n children,\n onClose,\n closeButtonProps,\n classNames,\n style,\n styles,\n unstyled,\n vars,\n mod,\n loaderProps,\n role,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<NotificationFactory>({\n name: 'Notification',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n return (\n <Box\n {...getStyles('root')}\n mod={[{ 'data-with-icon': !!icon || loading, 'data-with-border': withBorder }, mod]}\n role={role || 'alert'}\n {...others}\n >\n {icon && !loading && <div {...getStyles('icon')}>{icon}</div>}\n {loading && <Loader size={28} color={color} {...getStyles('loader')} {...loaderProps} />}\n\n <div {...getStyles('body')}>\n {title && <div {...getStyles('title')}>{title}</div>}\n\n <Box {...getStyles('description')} mod={{ 'data-with-title': !!title }}>\n {children}\n </Box>\n </div>\n\n {withCloseButton && (\n <CloseButton\n iconSize={16}\n color=\"gray\"\n {...closeButtonProps}\n unstyled={unstyled}\n onClick={(event) => {\n closeButtonProps?.onClick?.(event);\n onClose?.();\n }}\n {...getStyles('closeButton')}\n />\n )}\n </Box>\n );\n});\n\nNotification.classes = classes;\nNotification.varsResolver = varsResolver;\nNotification.displayName = '@mantine/core/Notification';\n\nexport namespace Notification {\n export type Props = NotificationProps;\n export type StylesNames = NotificationStylesNames;\n export type Factory = NotificationFactory;\n export type CssVariables = NotificationCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;AA2EA,MAAM,eAAe,EACnB,iBAAiB,KACnB;AAEA,MAAM,eAAe,oBAAyC,OAAO,EAAE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;AACvB,aAAa,eAAe;AAC5B,aAAa,cAAc"}
1
+ {"version":3,"file":"Notification.mjs","names":["classes"],"sources":["../../../src/components/Notification/Notification.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineColor,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { __CloseButtonProps, CloseButton } from '../CloseButton';\nimport { Loader, LoaderProps } from '../Loader';\nimport classes from './Notification.module.css';\n\nexport type NotificationStylesNames =\n | 'root'\n | 'icon'\n | 'loader'\n | 'body'\n | 'title'\n | 'description'\n | 'closeButton';\nexport type NotificationCssVariables = {\n root: '--notification-radius' | '--notification-color';\n};\n\nexport interface NotificationProps\n extends BoxProps, StylesApiProps<NotificationFactory>, ElementProps<'div', 'title'> {\n /** Called when the close button is clicked */\n onClose?: () => void;\n\n /** Controls icon background color or notification accent line color, key of `theme.colors` or any valid CSS color. When `icon` is provided, sets the icon background color. When no icon is provided, sets the colored accent line on the left. @default theme.primaryColor */\n color?: MantineColor;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Notification icon, replaces color line */\n icon?: React.ReactNode;\n\n /** Notification title, displayed above the message body */\n title?: React.ReactNode;\n\n /** Notification description, displayed below the title. When no title is provided, this serves as the main message. */\n children?: React.ReactNode;\n\n /** If set, displays a `Loader` component instead of the icon. Takes precedence over the `icon` prop if both are provided. */\n loading?: boolean;\n\n /** Adds border to the root element */\n withBorder?: boolean;\n\n /** If set, the close button is visible @default true */\n withCloseButton?: boolean;\n\n /** Props passed down to the close button */\n closeButtonProps?: __CloseButtonProps & ElementProps<'button'> & DataAttributes;\n\n /** Props passed down to the `Loader` component */\n loaderProps?: LoaderProps;\n}\n\nexport type NotificationFactory = Factory<{\n props: NotificationProps;\n ref: HTMLDivElement;\n stylesNames: NotificationStylesNames;\n vars: NotificationCssVariables;\n}>;\n\nconst defaultProps = {\n withCloseButton: true,\n} satisfies Partial<NotificationProps>;\n\nconst varsResolver = createVarsResolver<NotificationFactory>((theme, { radius, color }) => ({\n root: {\n '--notification-radius': radius === undefined ? undefined : getRadius(radius),\n '--notification-color': color ? getThemeColor(color, theme) : undefined,\n },\n}));\n\nexport const Notification = factory<NotificationFactory>((_props) => {\n const props = useProps('Notification', defaultProps, _props);\n const {\n className,\n color,\n radius,\n loading,\n withCloseButton,\n withBorder,\n title,\n icon,\n children,\n onClose,\n closeButtonProps,\n classNames,\n style,\n styles,\n unstyled,\n vars,\n mod,\n loaderProps,\n role,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<NotificationFactory>({\n name: 'Notification',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n return (\n <Box\n {...getStyles('root')}\n mod={[{ 'data-with-icon': !!icon || loading, 'data-with-border': withBorder }, mod]}\n role={role || 'alert'}\n {...others}\n >\n {icon && !loading && <div {...getStyles('icon')}>{icon}</div>}\n {loading && <Loader size={28} color={color} {...getStyles('loader')} {...loaderProps} />}\n\n <div {...getStyles('body')}>\n {title && <div {...getStyles('title')}>{title}</div>}\n\n <Box {...getStyles('description')} mod={{ 'data-with-title': !!title }}>\n {children}\n </Box>\n </div>\n\n {withCloseButton && (\n <CloseButton\n iconSize={16}\n color=\"gray\"\n {...closeButtonProps}\n unstyled={unstyled}\n onClick={(event) => {\n closeButtonProps?.onClick?.(event);\n onClose?.();\n }}\n {...getStyles('closeButton')}\n />\n )}\n </Box>\n );\n});\n\nNotification.classes = classes;\nNotification.varsResolver = varsResolver;\nNotification.displayName = '@mantine/core/Notification';\n\nexport namespace Notification {\n export type Props = NotificationProps;\n export type StylesNames = NotificationStylesNames;\n export type Factory = NotificationFactory;\n export type CssVariables = NotificationCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;AA2EA,MAAM,eAAe,EACnB,iBAAiB,KACnB;A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;EAEA;;AAET,CAAC;AAED,aAAa,UAAUA;AACvB,aAAa,eAAe;AAC5B,aAAa,cAAc"}
@@ -10,7 +10,7 @@ import { DigitColumn } from "./DigitColumn.mjs";
10
10
  import { getRenderSlots } from "./get-render-slots.mjs";
11
11
  import RollingNumber_module_default from "./RollingNumber.module.mjs";
12
12
  import { useEffect, useRef } from "react";
13
- import { jsx } from "react/jsx-runtime";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
14
  //#region packages/@mantine/core/src/components/RollingNumber/RollingNumber.tsx
15
15
  const defaultProps = {
16
16
  animationDuration: 600,
@@ -69,13 +69,17 @@ const RollingNumber = factory((_props) => {
69
69
  decimalScale,
70
70
  fixedDecimalScale
71
71
  });
72
- return /* @__PURE__ */ jsx(Box, {
72
+ return /* @__PURE__ */ jsxs(Box, {
73
73
  ...getStyles("root"),
74
74
  mod: [{ "tabular-numbers": tabularNumbers }, mod],
75
75
  role: withLiveRegion ? "status" : "img",
76
76
  "aria-label": accessibleValue,
77
77
  ...others,
78
- children: slots.map((slot) => {
78
+ children: [/* @__PURE__ */ jsx("span", {
79
+ ...getStyles("copyValue"),
80
+ "aria-hidden": "true",
81
+ children: accessibleValue
82
+ }), slots.map((slot) => {
79
83
  if (slot.type === "digit") return /* @__PURE__ */ jsx(DigitColumn, {
80
84
  digit: slot.digit,
81
85
  previousDigit: slot.previousDigit,
@@ -89,7 +93,7 @@ const RollingNumber = factory((_props) => {
89
93
  "aria-hidden": "true",
90
94
  children: slot.char
91
95
  }, slot.key);
92
- })
96
+ })]
93
97
  });
94
98
  });
95
99
  RollingNumber.classes = RollingNumber_module_default;
@@ -1 +1 @@
1
- {"version":3,"file":"RollingNumber.mjs","names":["classes"],"sources":["../../../src/components/RollingNumber/RollingNumber.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { buildValue } from './build-value';\nimport { DigitColumn } from './DigitColumn';\nimport { getDigitParts } from './get-digit-parts';\nimport { getRenderSlots } from './get-render-slots';\nimport classes from './RollingNumber.module.css';\n\nexport type RollingNumberStylesNames = 'root' | 'digit' | 'digitColumn' | 'char';\nexport type RollingNumberCssVariables = {\n root: '--rn-duration' | '--rn-timing-function';\n};\n\nexport interface RollingNumberProps\n extends BoxProps, StylesApiProps<RollingNumberFactory>, ElementProps<'div'> {\n /** Number value to display */\n value: number;\n\n /** Prefix added before the value */\n prefix?: string;\n\n /** Suffix added after the value */\n suffix?: string;\n\n /** Character used as a decimal separator @default '.' */\n decimalSeparator?: string;\n\n /** Character used to separate thousands, set to `true` for `,` @default false */\n thousandSeparator?: string | boolean;\n\n /** Number of decimal places to display */\n decimalScale?: number;\n\n /** If set, trailing zeros are added to match `decimalScale` @default false */\n fixedDecimalScale?: boolean;\n\n /** Animation duration in milliseconds @default 600 */\n animationDuration?: number;\n\n /** CSS timing function for animation @default 'ease' */\n timingFunction?: string;\n\n /** If set, use tabular (monospace) numbers @default true */\n tabularNumbers?: boolean;\n\n /** If set, the root element acts as an `aria-live=\"polite\"` region (`role=\"status\"`) and screen readers announce every value change. When `false`, the root uses `role=\"img\"` so the current value is still accessible but updates are not announced. @default false */\n withLiveRegion?: boolean;\n}\n\nexport type RollingNumberFactory = Factory<{\n props: RollingNumberProps;\n ref: HTMLDivElement;\n stylesNames: RollingNumberStylesNames;\n vars: RollingNumberCssVariables;\n}>;\n\nconst defaultProps = {\n animationDuration: 600,\n timingFunction: 'ease',\n decimalSeparator: '.',\n tabularNumbers: true,\n} satisfies Partial<RollingNumberProps>;\n\nconst varsResolver = createVarsResolver<RollingNumberFactory>(\n (_, { animationDuration, timingFunction }) => ({\n root: {\n '--rn-duration': `${animationDuration}ms`,\n '--rn-timing-function': timingFunction,\n },\n })\n);\n\nexport const RollingNumber = factory<RollingNumberFactory>((_props) => {\n const props = useProps('RollingNumber', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n value,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n decimalScale,\n fixedDecimalScale,\n animationDuration,\n timingFunction,\n tabularNumbers,\n withLiveRegion,\n mod,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<RollingNumberFactory>({\n name: 'RollingNumber',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const previousValueRef = useRef(value);\n const previousValue = previousValueRef.current;\n\n useEffect(() => {\n previousValueRef.current = value;\n });\n\n const valueDirection: 'up' | 'down' = value >= previousValue ? 'up' : 'down';\n\n const current = getDigitParts({ value, decimalScale, fixedDecimalScale });\n const prev = getDigitParts({ value: previousValue, decimalScale, fixedDecimalScale });\n\n const slots = getRenderSlots({\n current,\n previous: prev,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n });\n\n const accessibleValue = buildValue({\n value,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n decimalScale,\n fixedDecimalScale,\n });\n\n return (\n <Box\n {...getStyles('root')}\n mod={[{ 'tabular-numbers': tabularNumbers }, mod]}\n role={withLiveRegion ? 'status' : 'img'}\n aria-label={accessibleValue}\n {...others}\n >\n {slots.map((slot) => {\n if (slot.type === 'digit') {\n return (\n <DigitColumn\n key={slot.key}\n digit={slot.digit}\n previousDigit={slot.previousDigit}\n getStyles={getStyles}\n empty={slot.empty}\n valueDirection={valueDirection}\n />\n );\n }\n\n return (\n <span\n key={slot.key}\n {...getStyles('char')}\n data-empty={slot.empty || undefined}\n aria-hidden=\"true\"\n >\n {slot.char}\n </span>\n );\n })}\n </Box>\n );\n});\n\nRollingNumber.classes = classes;\nRollingNumber.varsResolver = varsResolver;\nRollingNumber.displayName = '@mantine/core/RollingNumber';\n"],"mappings":";;;;;;;;;;;;;;AAkEA,MAAM,eAAe;CACnB,mBAAmB;CACnB,gBAAgB;CAChB,kBAAkB;CAClB,gBAAgB;AAClB;AAEA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ANC,KAAK,GAMN;EAEV,CAAC;CACE,CAAA;AAET,CAAC;AAED,cAAc,UAAUA;AACxB,cAAc,eAAe;AAC7B,cAAc,cAAc"}
1
+ {"version":3,"file":"RollingNumber.mjs","names":["classes"],"sources":["../../../src/components/RollingNumber/RollingNumber.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { buildValue } from './build-value';\nimport { DigitColumn } from './DigitColumn';\nimport { getDigitParts } from './get-digit-parts';\nimport { getRenderSlots } from './get-render-slots';\nimport classes from './RollingNumber.module.css';\n\nexport type RollingNumberStylesNames = 'root' | 'copyValue' | 'digit' | 'digitColumn' | 'char';\nexport type RollingNumberCssVariables = {\n root: '--rn-duration' | '--rn-timing-function';\n};\n\nexport interface RollingNumberProps\n extends BoxProps, StylesApiProps<RollingNumberFactory>, ElementProps<'div'> {\n /** Number value to display */\n value: number;\n\n /** Prefix added before the value */\n prefix?: string;\n\n /** Suffix added after the value */\n suffix?: string;\n\n /** Character used as a decimal separator @default '.' */\n decimalSeparator?: string;\n\n /** Character used to separate thousands, set to `true` for `,` @default false */\n thousandSeparator?: string | boolean;\n\n /** Number of decimal places to display */\n decimalScale?: number;\n\n /** If set, trailing zeros are added to match `decimalScale` @default false */\n fixedDecimalScale?: boolean;\n\n /** Animation duration in milliseconds @default 600 */\n animationDuration?: number;\n\n /** CSS timing function for animation @default 'ease' */\n timingFunction?: string;\n\n /** If set, use tabular (monospace) numbers @default true */\n tabularNumbers?: boolean;\n\n /** If set, the root element acts as an `aria-live=\"polite\"` region (`role=\"status\"`) and screen readers announce every value change. When `false`, the root uses `role=\"img\"` so the current value is still accessible but updates are not announced. @default false */\n withLiveRegion?: boolean;\n}\n\nexport type RollingNumberFactory = Factory<{\n props: RollingNumberProps;\n ref: HTMLDivElement;\n stylesNames: RollingNumberStylesNames;\n vars: RollingNumberCssVariables;\n}>;\n\nconst defaultProps = {\n animationDuration: 600,\n timingFunction: 'ease',\n decimalSeparator: '.',\n tabularNumbers: true,\n} satisfies Partial<RollingNumberProps>;\n\nconst varsResolver = createVarsResolver<RollingNumberFactory>(\n (_, { animationDuration, timingFunction }) => ({\n root: {\n '--rn-duration': `${animationDuration}ms`,\n '--rn-timing-function': timingFunction,\n },\n })\n);\n\nexport const RollingNumber = factory<RollingNumberFactory>((_props) => {\n const props = useProps('RollingNumber', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n value,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n decimalScale,\n fixedDecimalScale,\n animationDuration,\n timingFunction,\n tabularNumbers,\n withLiveRegion,\n mod,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<RollingNumberFactory>({\n name: 'RollingNumber',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const previousValueRef = useRef(value);\n const previousValue = previousValueRef.current;\n\n useEffect(() => {\n previousValueRef.current = value;\n });\n\n const valueDirection: 'up' | 'down' = value >= previousValue ? 'up' : 'down';\n\n const current = getDigitParts({ value, decimalScale, fixedDecimalScale });\n const prev = getDigitParts({ value: previousValue, decimalScale, fixedDecimalScale });\n\n const slots = getRenderSlots({\n current,\n previous: prev,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n });\n\n const accessibleValue = buildValue({\n value,\n prefix,\n suffix,\n decimalSeparator,\n thousandSeparator,\n decimalScale,\n fixedDecimalScale,\n });\n\n return (\n <Box\n {...getStyles('root')}\n mod={[{ 'tabular-numbers': tabularNumbers }, mod]}\n role={withLiveRegion ? 'status' : 'img'}\n aria-label={accessibleValue}\n {...others}\n >\n <span {...getStyles('copyValue')} aria-hidden=\"true\">\n {accessibleValue}\n </span>\n {slots.map((slot) => {\n if (slot.type === 'digit') {\n return (\n <DigitColumn\n key={slot.key}\n digit={slot.digit}\n previousDigit={slot.previousDigit}\n getStyles={getStyles}\n empty={slot.empty}\n valueDirection={valueDirection}\n />\n );\n }\n\n return (\n <span\n key={slot.key}\n {...getStyles('char')}\n data-empty={slot.empty || undefined}\n aria-hidden=\"true\"\n >\n {slot.char}\n </span>\n );\n })}\n </Box>\n );\n});\n\nRollingNumber.classes = classes;\nRollingNumber.varsResolver = varsResolver;\nRollingNumber.displayName = '@mantine/core/RollingNumber';\n"],"mappings":";;;;;;;;;;;;;;AAkEA,MAAM,eAAe;CACnB,mBAAmB;CACnB,gBAAgB;CAChB,kBAAkB;CAClB,gBAAgB;AAClB;AAEA,MAAM,eAAe,oBAClB,GAAG,EAAE,mBAAmB,sBAAsB,EAC7C,MAAM;CACJ,iBAAiB,GAAG,kBAAkB;CACtC,wBAAwB;AAC1B,EACF,EACF;AAEA,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS,iBAAiB,cAAc,MAAM;CAC5D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,OACA,QACA,QACA,kBACA,mBACA,cACA,mBACA,mBACA,gBACA,gBACA,gBACA,KACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAAgC;EAChD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,mBAAmB,OAAO,KAAK;CACrC,MAAM,gBAAgB,iBAAiB;CAEvC,gBAAgB;EACd,iBAAiB,UAAU;CAC7B,CAAC;CAED,MAAM,iBAAgC,SAAS,gBAAgB,OAAO;CAKtE,MAAM,QAAQ,eAAe;EAC3B,SAJc,cAAc;GAAE;GAAO;GAAc;EAAkB,CAI/D;EACN,UAJW,cAAc;GAAE,OAAO;GAAe;GAAc;EAAkB,CAIpE;EACb;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,kBAAkB,WAAW;EACjC;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,qBAAC,KAAD;EACE,GAAI,UAAU,MAAM;EACpB,KAAK,CAAC,EAAE,mBAAmB,eAAe,GAAG,GAAG;EAChD,MAAM,iBAAiB,WAAW;EAClC,cAAY;EACZ,GAAI;YALN,CAOE,oBAAC,QAAD;GAAM,GAAI,UAAU,WAAW;GAAG,eAAY;aAC3C;EACG,CAAA,GACL,MAAM,KAAK,SAAS;GACnB,IAAI,KAAK,SAAS,SAChB,OACE,oBAAC,aAAD;IAEE,OAAO,KAAK;IACZ,eAAe,KAAK;IACT;IACX,OAAO,KAAK;IACI;GACjB,GANM,KAAK,GAMX;GAIL,OACE,oBAAC,QAAD;IAEE,GAAI,UAAU,MAAM;IACpB,cAAY,KAAK,SAAS,KAAA;IAC1B,eAAY;cAEX,KAAK;GACF,GANC,KAAK,GAMN;EAEV,CAAC,CACE;;AAET,CAAC;AAED,cAAc,UAAUA;AACxB,cAAc,eAAe;AAC7B,cAAc,cAAc"}
@@ -2,6 +2,7 @@
2
2
  //#region packages/@mantine/core/src/components/RollingNumber/RollingNumber.module.css
3
3
  var RollingNumber_module_default = {
4
4
  "root": "m_47dd3981",
5
+ "copyValue": "m_ccf525bd",
5
6
  "digit": "m_b301d46e",
6
7
  "digitColumn": "m_8ae40964",
7
8
  "mantine-rolling-number-roll": "m_18d73873",
@@ -1 +1 @@
1
- {"version":3,"file":"RollingNumber.module.mjs","names":[],"sources":["../../../src/components/RollingNumber/RollingNumber.module.css"],"sourcesContent":[".root {\n display: inline-flex;\n align-items: baseline;\n overflow: hidden;\n\n &[data-tabular-numbers] {\n font-variant-numeric: tabular-nums;\n }\n}\n\n.digit {\n display: inline-block;\n width: 1ch;\n height: 1em;\n overflow: hidden;\n line-height: 1;\n transition:\n width var(--rn-duration) var(--rn-timing-function),\n opacity var(--rn-duration) var(--rn-timing-function);\n\n &[data-empty] {\n width: 0;\n opacity: 0;\n }\n}\n\n.digitColumn {\n display: flex;\n flex-direction: column;\n animation: mantine-rolling-number-roll var(--rn-duration) var(--rn-timing-function);\n\n & > span {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 1em;\n }\n}\n\n.char {\n display: inline-block;\n overflow: hidden;\n white-space: pre;\n transition: opacity var(--rn-duration) var(--rn-timing-function);\n\n &[data-empty] {\n width: 0;\n opacity: 0;\n }\n}\n\n@keyframes mantine-rolling-number-roll {\n from {\n transform: var(--rn-roll-from);\n }\n\n to {\n transform: var(--rn-roll-to);\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"RollingNumber.module.mjs","names":[],"sources":["../../../src/components/RollingNumber/RollingNumber.module.css"],"sourcesContent":[".root {\n position: relative;\n display: inline-flex;\n align-items: baseline;\n overflow: hidden;\n\n &[data-tabular-numbers] {\n font-variant-numeric: tabular-nums;\n }\n}\n\n.copyValue {\n position: absolute;\n inset: 0;\n z-index: 1;\n overflow: hidden;\n white-space: pre;\n color: transparent;\n forced-color-adjust: none;\n}\n\n.digit {\n position: relative;\n z-index: 2;\n display: inline-block;\n width: 1ch;\n height: 1em;\n overflow: hidden;\n line-height: 1;\n pointer-events: none;\n user-select: none;\n -webkit-user-select: none;\n transition:\n width var(--rn-duration) var(--rn-timing-function),\n opacity var(--rn-duration) var(--rn-timing-function);\n\n &[data-empty] {\n width: 0;\n opacity: 0;\n }\n}\n\n.digitColumn {\n display: flex;\n flex-direction: column;\n animation: mantine-rolling-number-roll var(--rn-duration) var(--rn-timing-function);\n\n & > span {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 1em;\n }\n}\n\n.char {\n position: relative;\n z-index: 2;\n display: inline-block;\n overflow: hidden;\n white-space: pre;\n pointer-events: none;\n user-select: none;\n -webkit-user-select: none;\n transition: opacity var(--rn-duration) var(--rn-timing-function);\n\n &[data-empty] {\n width: 0;\n opacity: 0;\n }\n}\n\n@keyframes mantine-rolling-number-roll {\n from {\n transform: var(--rn-roll-from);\n }\n\n to {\n transform: var(--rn-roll-to);\n }\n}\n"],"mappings":""}