@mantine/core 9.5.1-alpha.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.
- package/cjs/components/Cascader/Cascader.cjs +9 -3
- package/cjs/components/Cascader/Cascader.cjs.map +1 -1
- package/cjs/components/Cascader/CascaderColumns.cjs +34 -3
- package/cjs/components/Cascader/CascaderColumns.cjs.map +1 -1
- package/cjs/components/Cascader/use-cascader-safe-area.cjs +76 -0
- package/cjs/components/Cascader/use-cascader-safe-area.cjs.map +1 -0
- package/cjs/components/Checkbox/CheckboxCard/CheckboxCard.cjs +8 -4
- package/cjs/components/Checkbox/CheckboxCard/CheckboxCard.cjs.map +1 -1
- package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.cjs +3 -2
- package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.cjs.map +1 -1
- package/cjs/components/ColorInput/ColorInput.cjs +4 -2
- package/cjs/components/ColorInput/ColorInput.cjs.map +1 -1
- package/cjs/components/ColorPicker/ColorPicker.cjs.map +1 -1
- package/cjs/components/Combobox/get-options-lockup/get-option-by-label.cjs +17 -0
- package/cjs/components/Combobox/get-options-lockup/get-option-by-label.cjs.map +1 -0
- package/cjs/components/Combobox/is-external-input-change/is-external-input-change.cjs +17 -0
- package/cjs/components/Combobox/is-external-input-change/is-external-input-change.cjs.map +1 -0
- package/cjs/components/ComboboxPopover/ComboboxPopover.cjs.map +1 -1
- package/cjs/components/FloatingIndicator/use-floating-indicator.cjs +6 -4
- package/cjs/components/FloatingIndicator/use-floating-indicator.cjs.map +1 -1
- package/cjs/components/MultiSelect/MultiSelect.cjs +9 -0
- package/cjs/components/MultiSelect/MultiSelect.cjs.map +1 -1
- package/cjs/components/Notification/Notification.cjs.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.cjs +4 -3
- package/cjs/components/PasswordInput/PasswordInput.cjs.map +1 -1
- package/cjs/components/RollingNumber/RollingNumber.cjs +7 -3
- package/cjs/components/RollingNumber/RollingNumber.cjs.map +1 -1
- package/cjs/components/RollingNumber/RollingNumber.module.cjs +1 -0
- package/cjs/components/RollingNumber/RollingNumber.module.cjs.map +1 -1
- package/cjs/components/Select/Select.cjs +12 -0
- package/cjs/components/Select/Select.cjs.map +1 -1
- package/cjs/components/TagsInput/TagsInput.cjs +5 -1
- package/cjs/components/TagsInput/TagsInput.cjs.map +1 -1
- package/cjs/components/Tooltip/Tooltip.cjs +11 -3
- package/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
- package/cjs/components/Tooltip/Tooltip.module.cjs.map +1 -1
- package/cjs/components/Tooltip/TooltipFloating/TooltipFloating.cjs +2 -2
- package/cjs/components/Tooltip/TooltipFloating/TooltipFloating.cjs.map +1 -1
- package/cjs/components/Tooltip/TooltipFloating/use-floating-tooltip.cjs +1 -0
- package/cjs/components/Tooltip/TooltipFloating/use-floating-tooltip.cjs.map +1 -1
- package/cjs/components/Tooltip/use-tooltip.cjs +2 -1
- package/cjs/components/Tooltip/use-tooltip.cjs.map +1 -1
- package/cjs/components/TreeSelect/TreeSelect.cjs +3 -0
- package/cjs/components/TreeSelect/TreeSelect.cjs.map +1 -1
- package/esm/components/Cascader/Cascader.mjs +9 -3
- package/esm/components/Cascader/Cascader.mjs.map +1 -1
- package/esm/components/Cascader/CascaderColumns.mjs +35 -4
- package/esm/components/Cascader/CascaderColumns.mjs.map +1 -1
- package/esm/components/Cascader/use-cascader-safe-area.mjs +76 -0
- package/esm/components/Cascader/use-cascader-safe-area.mjs.map +1 -0
- package/esm/components/Checkbox/CheckboxCard/CheckboxCard.mjs +8 -4
- package/esm/components/Checkbox/CheckboxCard/CheckboxCard.mjs.map +1 -1
- package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.mjs +3 -2
- package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.mjs.map +1 -1
- package/esm/components/ColorInput/ColorInput.mjs +4 -2
- package/esm/components/ColorInput/ColorInput.mjs.map +1 -1
- package/esm/components/ColorPicker/ColorPicker.mjs.map +1 -1
- package/esm/components/Combobox/get-options-lockup/get-option-by-label.mjs +17 -0
- package/esm/components/Combobox/get-options-lockup/get-option-by-label.mjs.map +1 -0
- package/esm/components/Combobox/is-external-input-change/is-external-input-change.mjs +17 -0
- package/esm/components/Combobox/is-external-input-change/is-external-input-change.mjs.map +1 -0
- package/esm/components/ComboboxPopover/ComboboxPopover.mjs.map +1 -1
- package/esm/components/FloatingIndicator/use-floating-indicator.mjs +6 -4
- package/esm/components/FloatingIndicator/use-floating-indicator.mjs.map +1 -1
- package/esm/components/MultiSelect/MultiSelect.mjs +9 -0
- package/esm/components/MultiSelect/MultiSelect.mjs.map +1 -1
- package/esm/components/Notification/Notification.mjs.map +1 -1
- package/esm/components/PasswordInput/PasswordInput.mjs +4 -3
- package/esm/components/PasswordInput/PasswordInput.mjs.map +1 -1
- package/esm/components/RollingNumber/RollingNumber.mjs +8 -4
- package/esm/components/RollingNumber/RollingNumber.mjs.map +1 -1
- package/esm/components/RollingNumber/RollingNumber.module.mjs +1 -0
- package/esm/components/RollingNumber/RollingNumber.module.mjs.map +1 -1
- package/esm/components/Select/Select.mjs +12 -0
- package/esm/components/Select/Select.mjs.map +1 -1
- package/esm/components/TagsInput/TagsInput.mjs +5 -1
- package/esm/components/TagsInput/TagsInput.mjs.map +1 -1
- package/esm/components/Tooltip/Tooltip.mjs +11 -3
- package/esm/components/Tooltip/Tooltip.mjs.map +1 -1
- package/esm/components/Tooltip/Tooltip.module.mjs.map +1 -1
- package/esm/components/Tooltip/TooltipFloating/TooltipFloating.mjs +2 -2
- package/esm/components/Tooltip/TooltipFloating/TooltipFloating.mjs.map +1 -1
- package/esm/components/Tooltip/TooltipFloating/use-floating-tooltip.mjs +1 -0
- package/esm/components/Tooltip/TooltipFloating/use-floating-tooltip.mjs.map +1 -1
- package/esm/components/Tooltip/use-tooltip.mjs +3 -2
- package/esm/components/Tooltip/use-tooltip.mjs.map +1 -1
- package/esm/components/TreeSelect/TreeSelect.mjs +3 -0
- package/esm/components/TreeSelect/TreeSelect.mjs.map +1 -1
- package/lib/components/Cascader/Cascader.d.ts +4 -0
- package/lib/components/Cascader/CascaderColumns.d.ts +3 -2
- package/lib/components/Cascader/use-cascader-safe-area.d.ts +20 -0
- package/lib/components/Checkbox/CheckboxCard/CheckboxCard.d.ts +3 -0
- package/lib/components/ColorPicker/ColorPicker.d.ts +2 -2
- package/lib/components/Combobox/get-options-lockup/get-option-by-label.d.ts +8 -0
- package/lib/components/Combobox/is-external-input-change/is-external-input-change.d.ts +7 -0
- package/lib/components/ComboboxPopover/ComboboxPopover.d.ts +1 -1
- package/lib/components/Notification/Notification.d.ts +2 -1
- package/lib/components/PasswordInput/PasswordInput.d.ts +2 -0
- package/lib/components/RollingNumber/RollingNumber.d.ts +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +2 -0
- package/lib/components/Tooltip/use-tooltip.d.ts +1 -0
- package/package.json +2 -2
- package/styles/RollingNumber.css +21 -0
- package/styles/RollingNumber.layer.css +21 -0
- package/styles/Tooltip.css +4 -0
- package/styles/Tooltip.layer.css +4 -0
- package/styles.css +25 -0
- package/styles.layer.css +25 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSelect.mjs","names":["useId","classes"],"sources":["../../../src/components/TreeSelect/TreeSelect.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n Factory,\n genericFactory,\n MantineColor,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\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 { Pill } from '../Pill';\nimport { PillsInput } from '../PillsInput';\nimport { ScrollArea, ScrollAreaProps } from '../ScrollArea';\nimport type { TreeNodeData } from '../Tree';\nimport { filterTreeData } from '../Tree/filter-tree-data/filter-tree-data';\nimport {\n findTreeNode,\n getChildrenNodesValues,\n} from '../Tree/get-children-nodes-values/get-children-nodes-values';\nimport { isNodeChecked } from '../Tree/is-node-checked/is-node-checked';\nimport { isNodeIndeterminate } from '../Tree/is-node-indeterminate/is-node-indeterminate';\nimport { getTreeExpandedState, TreeExpandedState } from '../Tree/use-tree';\nimport { flattenTreeSelectData } from './flatten-tree-select-data';\nimport {\n CheckedStrategy,\n checkedToValue,\n expandToLeafChecked,\n} from './get-checked-values-by-strategy';\nimport {\n TreeSelectChevronAriaLabels,\n TreeSelectOption,\n TreeSelectRenderNodePayload,\n} from './TreeSelectOption';\nimport classes from './TreeSelect.module.css';\n\nexport type TreeSelectStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'pill'\n | 'pillsList'\n | 'inputField';\n\nexport type TreeSelectMode = 'single' | 'multiple' | 'checkbox';\n\nexport type TreeSelectValue<Mode extends TreeSelectMode> = Mode extends 'single'\n ? string | null\n : string[];\n\nexport interface TreeSelectProps<Mode extends TreeSelectMode = 'single'>\n extends\n BoxProps,\n __BaseInputProps,\n StylesApiProps<TreeSelectFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Tree data */\n data: TreeNodeData[];\n\n /** Selection mode: 'single', 'multiple', or 'checkbox' (with cascade) @default 'single' */\n mode?: Mode;\n\n /** Controlled value */\n value?: TreeSelectValue<Mode>;\n\n /** Default value */\n defaultValue?: TreeSelectValue<Mode>;\n\n /** Called when value changes */\n onChange?: (value: TreeSelectValue<Mode>) => void;\n\n /** Disables parent-child cascade in checkbox mode @default false */\n checkStrictly?: boolean;\n\n /** Controls which checked nodes appear in value/pills in checkbox mode @default 'child' */\n checkedStrategy?: CheckedStrategy;\n\n /** Default expanded node values */\n defaultExpandedValues?: string[];\n\n /** Expand all nodes by default @default false */\n defaultExpandAll?: boolean;\n\n /** Controlled expanded state */\n expandedValues?: string[];\n\n /** Called when expanded state changes */\n onExpandedChange?: (values: string[]) => void;\n\n /** Also toggle expand when clicking a parent node (not just the chevron). In `single` and `multiple` modes, parent clicks only expand; only leaves can be selected. In `checkbox` mode, parent clicks both check and expand. @default false */\n expandOnClick?: boolean;\n\n /** Enables search filtering @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 /** Custom filter function */\n filter?: (query: string, node: TreeNodeData) => boolean;\n\n /** Message when no nodes match search */\n nothingFoundMessage?: React.ReactNode;\n\n /** Allows deselecting in single mode @default true */\n allowDeselect?: boolean;\n\n /** Shows clear button @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props for the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Maximum selectable values (multiple/checkbox mode) */\n maxValues?: number;\n\n /** Maximum displayed pills before \"+N more\" */\n maxDisplayedValues?: number;\n\n /** Content shown when values overflow maxDisplayedValues */\n maxDisplayedValuesContent?: React.ReactNode | ((overflow: number) => React.ReactNode);\n\n /** Called with removed value in multiple/checkbox mode */\n onRemove?: (value: string) => void;\n\n /** Called when clear button is clicked */\n onClear?: () => void;\n\n /** Custom node rendering in the dropdown */\n renderNode?: (payload: TreeSelectRenderNodePayload) => React.ReactNode;\n\n /** Show tree connection lines between parent and child nodes @default true */\n withLines?: boolean;\n\n /** Props for the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Divider for hidden input values @default ',' */\n hiddenInputValuesDivider?: string;\n\n /** Props for the ScrollArea in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls the default chevron color */\n chevronColor?: MantineColor;\n\n /** Max dropdown height @default 220 */\n maxDropdownHeight?: number | string;\n\n /** Controlled dropdown state */\n dropdownOpened?: boolean;\n\n /** Default dropdown state */\n defaultDropdownOpened?: boolean;\n\n /** Called when dropdown opens */\n onDropdownOpen?: () => void;\n\n /** Called when dropdown closes */\n onDropdownClose?: () => void;\n\n /** Props passed to the underlying Combobox */\n comboboxProps?: Record<string, any>;\n\n /** Clear search on selection change @default true */\n clearSearchOnChange?: boolean;\n\n /** Opens dropdown on focus (searchable mode) @default true */\n openOnFocus?: boolean;\n\n /** aria-label values for the expand/collapse chevron button */\n chevronAriaLabels?: TreeSelectChevronAriaLabels;\n}\n\nexport type TreeSelectFactory = Factory<{\n props: TreeSelectProps;\n ref: HTMLInputElement;\n stylesNames: TreeSelectStylesNames;\n variant: InputVariant;\n signature: <Mode extends TreeSelectMode = 'single'>(\n props: TreeSelectProps<Mode>\n ) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n mode: 'single',\n allowDeselect: true,\n checkedStrategy: 'child',\n maxValues: Infinity,\n hiddenInputValuesDivider: ',',\n clearSearchOnChange: true,\n openOnFocus: true,\n size: 'sm',\n withLines: true,\n} satisfies Partial<TreeSelectProps<TreeSelectMode>>;\n\nconst clearSectionOffset: Record<string, number> = {\n xs: 41,\n sm: 50,\n md: 60,\n lg: 72,\n xl: 89,\n};\n\nfunction getAncestorsToNode(value: string, nodes: TreeNodeData[]): string[] | null {\n for (const node of nodes) {\n if (node.value === value) {\n return [];\n }\n if (Array.isArray(node.children)) {\n const path = getAncestorsToNode(value, node.children);\n if (path !== null) {\n return [node.value, ...path];\n }\n }\n }\n return null;\n}\n\nexport const TreeSelect = genericFactory<TreeSelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'TreeSelect'], defaultProps as any, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n size,\n data,\n mode,\n value,\n defaultValue,\n onChange,\n checkStrictly,\n checkedStrategy,\n defaultExpandedValues,\n defaultExpandAll,\n expandedValues,\n onExpandedChange,\n expandOnClick,\n searchable,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n filter,\n nothingFoundMessage,\n allowDeselect,\n clearable,\n clearSectionMode,\n clearButtonProps,\n maxValues,\n maxDisplayedValues,\n maxDisplayedValuesContent,\n onRemove,\n onClear,\n renderNode,\n withLines,\n hiddenInputProps,\n hiddenInputValuesDivider,\n scrollAreaProps,\n chevronColor,\n maxDropdownHeight,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n comboboxProps,\n clearSearchOnChange,\n openOnFocus,\n chevronAriaLabels,\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 isMulti = mode === 'multiple' || mode === 'checkbox';\n const isCheckbox = mode === 'checkbox';\n const _id = useId(id);\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n },\n });\n\n const initialExpanded = useMemo(() => {\n if (defaultExpandAll) {\n return getTreeExpandedState(data, '*');\n }\n if (defaultExpandedValues) {\n return getTreeExpandedState(data, defaultExpandedValues);\n }\n return getTreeExpandedState(data, []);\n }, []);\n\n const expandedToRecord = useCallback(\n (values: string[] | undefined): TreeExpandedState | undefined => {\n if (!values) {\n return undefined;\n }\n return getTreeExpandedState(data, values);\n },\n [data]\n );\n\n const [_expandedState, setExpandedState] = useUncontrolled<TreeExpandedState>({\n value: expandedToRecord(expandedValues),\n defaultValue: initialExpanded,\n finalValue: {},\n onChange: (val) => {\n if (onExpandedChange) {\n onExpandedChange(\n Object.entries(val)\n .filter(([, v]) => v)\n .map(([k]) => k)\n );\n }\n },\n });\n\n const toggleExpand = useCallback(\n (nodeValue: string) => {\n setExpandedState({ ..._expandedState, [nodeValue]: !_expandedState[nodeValue] });\n },\n [_expandedState]\n );\n\n const initialSearchValue = useMemo(() => {\n if (mode !== 'single' || !defaultValue) {\n return '';\n }\n const node = findTreeNode(defaultValue as string, data);\n return node ? (typeof node.label === 'string' ? node.label : '') : '';\n }, []);\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: initialSearchValue,\n onChange: onSearchChange,\n });\n\n const handleSearchChange = (val: string) => {\n setSearchValue(val);\n combobox.resetSelectedOption();\n };\n\n const [_value, setValue] = useUncontrolled({\n value: value as any,\n defaultValue: defaultValue as any,\n finalValue: isMulti ? [] : null,\n onChange,\n });\n\n const internalChecked = useMemo(() => {\n if (!isCheckbox || !_value || !Array.isArray(_value)) {\n return [];\n }\n if (checkStrictly) {\n return _value;\n }\n return expandToLeafChecked(_value, data);\n }, [isCheckbox, _value, data, checkStrictly]);\n\n const filteredData = useMemo(() => {\n if (!searchable || !_searchValue) {\n return data;\n }\n if (mode === 'single' && _value) {\n const node = findTreeNode(_value as string, data);\n if (node && _searchValue === (typeof node.label === 'string' ? node.label : '')) {\n return data;\n }\n }\n return filterTreeData(data, _searchValue, filter);\n }, [data, _searchValue, filter, searchable, mode, _value]);\n\n const expandedForRender = useMemo(() => {\n if (_searchValue && filteredData !== data) {\n const expanded = { ..._expandedState };\n const expandFilteredParents = (nodes: TreeNodeData[]) => {\n for (const node of nodes) {\n if (Array.isArray(node.children) && node.children.length > 0) {\n expanded[node.value] = true;\n expandFilteredParents(node.children);\n }\n }\n };\n expandFilteredParents(filteredData);\n return expanded;\n }\n return _expandedState;\n }, [filteredData, _expandedState, _searchValue, data]);\n\n const flatNodes = useMemo(\n () => flattenTreeSelectData(filteredData, expandedForRender),\n [filteredData, expandedForRender]\n );\n\n const flatNodesRef = useRef(flatNodes);\n flatNodesRef.current = flatNodes;\n\n const nodeLookup = useMemo(() => {\n const lookup: Record<string, TreeNodeData> = {};\n const walk = (nodes: TreeNodeData[]) => {\n for (const node of nodes) {\n lookup[node.value] = node;\n if (Array.isArray(node.children)) {\n walk(node.children);\n }\n }\n };\n walk(data);\n return lookup;\n }, [data]);\n\n const getNodeLabel = (nodeValue: string): string => {\n const node = nodeLookup[nodeValue];\n if (!node) {\n return nodeValue;\n }\n return typeof node.label === 'string' ? node.label : nodeValue;\n };\n\n const getStyles = useStyles<TreeSelectFactory>({\n name: 'TreeSelect',\n classes: {} as any,\n props: props as any,\n classNames,\n styles,\n unstyled,\n attributes,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<TreeSelectFactory>({\n props,\n styles,\n classNames,\n });\n\n const {\n styleProps,\n rest: { type, autoComplete, ...rest },\n } = extractStyleProps(others);\n\n const handleOptionSubmit = (val: string) => {\n if (mode === 'single') {\n if (expandOnClick) {\n const node = findTreeNode(val, data);\n if (node && Array.isArray(node.children) && node.children.length > 0) {\n toggleExpand(val);\n return;\n }\n }\n const nextValue = allowDeselect && val === _value ? null : val;\n setValue(nextValue);\n combobox.closeDropdown();\n if (clearSearchOnChange) {\n handleSearchChange(nextValue ? getNodeLabel(nextValue) : '');\n }\n } else if (mode === 'multiple') {\n if (expandOnClick) {\n const node = findTreeNode(val, data);\n if (node && Array.isArray(node.children) && node.children.length > 0) {\n toggleExpand(val);\n return;\n }\n }\n const arr = (_value as string[]) || [];\n if (arr.includes(val)) {\n setValue(arr.filter((v: string) => v !== val));\n onRemove?.(val);\n } else if (arr.length < (maxValues ?? Infinity)) {\n setValue([...arr, val]);\n } else {\n return;\n }\n if (clearSearchOnChange) {\n setSearchValue('');\n }\n } else if (mode === 'checkbox') {\n const nodeChecked = checkStrictly\n ? internalChecked.includes(val)\n : isNodeChecked(val, data, internalChecked);\n\n let newInternalChecked: string[];\n if (checkStrictly) {\n newInternalChecked = nodeChecked\n ? internalChecked.filter((v) => v !== val)\n : [...internalChecked, val];\n } else {\n const childLeaves = getChildrenNodesValues(val, data);\n if (nodeChecked) {\n newInternalChecked = internalChecked.filter((v) => !childLeaves.includes(v));\n } else {\n newInternalChecked = [...new Set([...internalChecked, ...childLeaves])];\n }\n }\n\n const newValue = checkedToValue(newInternalChecked, data, checkedStrategy!);\n if (!nodeChecked && newValue.length > (maxValues ?? Infinity)) {\n return;\n }\n setValue(newValue);\n if (clearSearchOnChange) {\n setSearchValue('');\n }\n\n if (expandOnClick) {\n const node = findTreeNode(val, data);\n if (node && Array.isArray(node.children) && node.children.length > 0) {\n if (!_expandedState[val]) {\n toggleExpand(val);\n }\n }\n }\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.key === ' ' && !searchable && isMulti) {\n event.preventDefault();\n combobox.toggleDropdown();\n }\n\n if (event.key === 'Backspace' && _searchValue.length === 0 && isMulti) {\n const arr = (_value as string[]) || [];\n if (arr.length > 0) {\n const removed = arr[arr.length - 1];\n onRemove?.(removed);\n setValue(arr.slice(0, -1));\n }\n }\n\n if (!combobox.dropdownOpened) {\n return;\n }\n\n const index = combobox.getSelectedOptionIndex();\n if (index < 0 || index >= flatNodesRef.current.length) {\n return;\n }\n\n const currentNode = flatNodesRef.current[index];\n\n if (event.key === 'ArrowRight') {\n if (currentNode.hasChildren && !currentNode.expanded) {\n event.preventDefault();\n toggleExpand(currentNode.node.value);\n }\n }\n\n if (event.key === 'ArrowLeft') {\n if (currentNode.hasChildren && currentNode.expanded) {\n event.preventDefault();\n toggleExpand(currentNode.node.value);\n } else if (currentNode.parent) {\n event.preventDefault();\n const parentIndex = flatNodesRef.current.findIndex(\n (n) => n.node.value === currentNode.parent\n );\n if (parentIndex >= 0) {\n combobox.selectOption(parentIndex);\n }\n }\n }\n };\n\n useEffect(() => {\n if (mode !== 'single' || !searchable) {\n return;\n }\n if (value === null) {\n handleSearchChange('');\n } else if (typeof value === 'string') {\n handleSearchChange(getNodeLabel(value));\n }\n }, [value]);\n\n const prevDropdownOpenedRef = useRef(false);\n useEffect(() => {\n if (combobox.dropdownOpened && !prevDropdownOpenedRef.current && searchable && _value) {\n const targets = Array.isArray(_value) ? _value : [_value];\n const newExpanded = { ..._expandedState };\n let changed = false;\n for (const target of targets) {\n const ancestors = getAncestorsToNode(target as string, data);\n if (ancestors) {\n for (const a of ancestors) {\n if (!newExpanded[a]) {\n newExpanded[a] = true;\n changed = true;\n }\n }\n }\n }\n if (changed) {\n setExpandedState(newExpanded);\n requestAnimationFrame(() => {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n });\n }\n }\n prevDropdownOpenedRef.current = combobox.dropdownOpened;\n });\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n onClear?.();\n setValue(isMulti ? [] : null);\n handleSearchChange('');\n combobox.focusTarget();\n }}\n />\n );\n\n const hasValue = isMulti\n ? Array.isArray(_value) && _value.length > 0\n : _value != null && _value !== '';\n const _clearable = clearable && hasValue && !disabled && !readOnly;\n\n const singleDisplayLabel = useMemo(() => {\n if (mode !== 'single' || !_value) {\n return '';\n }\n return getNodeLabel(_value as string);\n }, [mode, _value, nodeLookup]);\n\n const displayValues = useMemo(() => {\n if (!isMulti || !Array.isArray(_value)) {\n return [];\n }\n return _value as string[];\n }, [isMulti, _value]);\n\n const pillsListStyle =\n _clearable && isMulti\n ? { paddingInlineEnd: clearSectionOffset[size as string] ?? clearSectionOffset.sm }\n : undefined;\n\n const visiblePills =\n maxDisplayedValues != null ? displayValues.slice(0, maxDisplayedValues) : displayValues;\n\n const overflowCount =\n maxDisplayedValues != null ? Math.max(0, displayValues.length - maxDisplayedValues) : 0;\n\n const pills = visiblePills.map((item, index) => (\n <Pill\n key={`${item}-${index}`}\n withRemoveButton={!readOnly}\n onRemove={() => {\n if (isCheckbox) {\n const childLeaves = checkStrictly ? [item] : getChildrenNodesValues(item, data);\n const newInternal = internalChecked.filter((v) => !childLeaves.includes(v));\n setValue(checkedToValue(newInternal, data, checkedStrategy!));\n } else {\n setValue((_value as string[]).filter((v: string) => v !== item));\n }\n onRemove?.(item);\n }}\n unstyled={unstyled}\n disabled={disabled}\n {...getStyles('pill')}\n >\n {getNodeLabel(item)}\n </Pill>\n ));\n\n if (overflowCount > 0) {\n const overflowContent =\n typeof maxDisplayedValuesContent === 'function'\n ? maxDisplayedValuesContent(overflowCount)\n : maxDisplayedValuesContent || `+${overflowCount} more`;\n pills.push(\n <Pill key=\"__overflow\" unstyled={unstyled} disabled={disabled} {...getStyles('pill')}>\n {overflowContent}\n </Pill>\n );\n }\n\n const isEmpty = flatNodes.length === 0;\n\n const options = flatNodes.map((flatNode) => {\n const isSelected =\n mode === 'single'\n ? _value === flatNode.node.value\n : mode === 'multiple'\n ? ((_value as string[]) || []).includes(flatNode.node.value)\n : false;\n\n const nodeChecked = isCheckbox\n ? checkStrictly\n ? internalChecked.includes(flatNode.node.value)\n : isNodeChecked(flatNode.node.value, data, internalChecked)\n : false;\n\n const nodeIndeterminate =\n isCheckbox && !checkStrictly\n ? isNodeIndeterminate(flatNode.node.value, data, internalChecked)\n : false;\n\n return (\n <TreeSelectOption\n key={flatNode.node.value}\n node={flatNode.node}\n level={flatNode.level}\n expanded={flatNode.expanded}\n hasChildren={flatNode.hasChildren}\n selected={isSelected}\n checked={nodeChecked}\n indeterminate={nodeIndeterminate}\n showCheckbox={isCheckbox}\n isLastChild={flatNode.isLastChild}\n lineGuides={flatNode.lineGuides}\n withLines={!!withLines}\n onToggleExpand={toggleExpand}\n renderNode={renderNode}\n chevronAriaLabels={chevronAriaLabels}\n />\n );\n });\n\n const dropdown = (\n <Combobox.Dropdown hidden={readOnly || disabled}>\n <Combobox.Options\n className={classes.optionsWrapper}\n aria-multiselectable={isMulti || undefined}\n >\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 {isEmpty && nothingFoundMessage && <Combobox.Empty>{nothingFoundMessage}</Combobox.Empty>}\n </Combobox.Options>\n </Combobox.Dropdown>\n );\n\n if (isMulti) {\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=\"TreeSelect\"\n attributes={attributes}\n onOptionSubmit={handleOptionSubmit}\n {...comboboxProps}\n >\n <Combobox.DropdownTarget>\n <PillsInput\n {...styleProps}\n __staticSelector=\"TreeSelect\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n className={className}\n style={style}\n variant={variant}\n disabled={disabled}\n radius={radius}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n rightSectionWidth={rightSectionWidth}\n rightSectionProps={rightSectionProps}\n leftSection={leftSection}\n leftSectionWidth={leftSectionWidth}\n leftSectionPointerEvents={leftSectionPointerEvents}\n leftSectionProps={leftSectionProps}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n 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 >\n {pills}\n <Combobox.EventsTarget autoComplete={autoComplete}>\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 if (openOnFocus && searchable) {\n combobox.openDropdown();\n }\n }}\n onBlur={(event) => {\n onBlur?.(event);\n combobox.closeDropdown();\n handleSearchChange('');\n }}\n onKeyDown={handleKeyDown}\n value={_searchValue}\n onChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n if (searchable) {\n combobox.openDropdown();\n }\n }}\n disabled={disabled}\n readOnly={readOnly || !searchable}\n pointer={!searchable}\n />\n </Combobox.EventsTarget>\n </Pill.Group>\n </PillsInput>\n </Combobox.DropdownTarget>\n {dropdown}\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\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"TreeSelect\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n onOptionSubmit={handleOptionSubmit}\n {...comboboxProps}\n >\n <Combobox.Target targetType={searchable ? 'input' : 'button'} autoComplete={autoComplete}>\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=\"TreeSelect\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={searchable ? _searchValue : singleDisplayLabel}\n onChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n }}\n onFocus={(event) => {\n if (openOnFocus && searchable) {\n combobox.openDropdown();\n }\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (searchable) {\n combobox.closeDropdown();\n }\n handleSearchChange(_value ? getNodeLabel(_value as string) : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\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={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nTreeSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nTreeSelect.displayName = '@mantine/core/TreeSelect';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4MA,MAAM,eAAe;CACnB,MAAM;CACN,eAAe;CACf,iBAAiB;CACjB,WAAW;CACX,0BAA0B;CAC1B,qB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I;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,WAAW,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;AAAQ;AACjE,WAAW,cAAc"}
|
|
1
|
+
{"version":3,"file":"TreeSelect.mjs","names":["useId","classes"],"sources":["../../../src/components/TreeSelect/TreeSelect.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useId, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n Factory,\n genericFactory,\n MantineColor,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\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 { Pill } from '../Pill';\nimport { PillsInput } from '../PillsInput';\nimport { ScrollArea, ScrollAreaProps } from '../ScrollArea';\nimport type { TreeNodeData } from '../Tree';\nimport { filterTreeData } from '../Tree/filter-tree-data/filter-tree-data';\nimport {\n findTreeNode,\n getChildrenNodesValues,\n} from '../Tree/get-children-nodes-values/get-children-nodes-values';\nimport { isNodeChecked } from '../Tree/is-node-checked/is-node-checked';\nimport { isNodeIndeterminate } from '../Tree/is-node-indeterminate/is-node-indeterminate';\nimport { getTreeExpandedState, TreeExpandedState } from '../Tree/use-tree';\nimport { flattenTreeSelectData } from './flatten-tree-select-data';\nimport {\n CheckedStrategy,\n checkedToValue,\n expandToLeafChecked,\n} from './get-checked-values-by-strategy';\nimport {\n TreeSelectChevronAriaLabels,\n TreeSelectOption,\n TreeSelectRenderNodePayload,\n} from './TreeSelectOption';\nimport classes from './TreeSelect.module.css';\n\nexport type TreeSelectStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'pill'\n | 'pillsList'\n | 'inputField';\n\nexport type TreeSelectMode = 'single' | 'multiple' | 'checkbox';\n\nexport type TreeSelectValue<Mode extends TreeSelectMode> = Mode extends 'single'\n ? string | null\n : string[];\n\nexport interface TreeSelectProps<Mode extends TreeSelectMode = 'single'>\n extends\n BoxProps,\n __BaseInputProps,\n StylesApiProps<TreeSelectFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Tree data */\n data: TreeNodeData[];\n\n /** Selection mode: 'single', 'multiple', or 'checkbox' (with cascade) @default 'single' */\n mode?: Mode;\n\n /** Controlled value */\n value?: TreeSelectValue<Mode>;\n\n /** Default value */\n defaultValue?: TreeSelectValue<Mode>;\n\n /** Called when value changes */\n onChange?: (value: TreeSelectValue<Mode>) => void;\n\n /** Disables parent-child cascade in checkbox mode @default false */\n checkStrictly?: boolean;\n\n /** Controls which checked nodes appear in value/pills in checkbox mode @default 'child' */\n checkedStrategy?: CheckedStrategy;\n\n /** Default expanded node values */\n defaultExpandedValues?: string[];\n\n /** Expand all nodes by default @default false */\n defaultExpandAll?: boolean;\n\n /** Controlled expanded state */\n expandedValues?: string[];\n\n /** Called when expanded state changes */\n onExpandedChange?: (values: string[]) => void;\n\n /** Also toggle expand when clicking a parent node (not just the chevron). In `single` and `multiple` modes, parent clicks only expand; only leaves can be selected. In `checkbox` mode, parent clicks both check and expand. @default false */\n expandOnClick?: boolean;\n\n /** Enables search filtering @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 /** Custom filter function */\n filter?: (query: string, node: TreeNodeData) => boolean;\n\n /** Message when no nodes match search */\n nothingFoundMessage?: React.ReactNode;\n\n /** Allows deselecting in single mode @default true */\n allowDeselect?: boolean;\n\n /** Shows clear button @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props for the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Maximum selectable values (multiple/checkbox mode) */\n maxValues?: number;\n\n /** Maximum displayed pills before \"+N more\" */\n maxDisplayedValues?: number;\n\n /** Content shown when values overflow maxDisplayedValues */\n maxDisplayedValuesContent?: React.ReactNode | ((overflow: number) => React.ReactNode);\n\n /** Called with removed value in multiple/checkbox mode */\n onRemove?: (value: string) => void;\n\n /** Called when clear button is clicked */\n onClear?: () => void;\n\n /** Custom node rendering in the dropdown */\n renderNode?: (payload: TreeSelectRenderNodePayload) => React.ReactNode;\n\n /** Show tree connection lines between parent and child nodes @default true */\n withLines?: boolean;\n\n /** Props for the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** Divider for hidden input values @default ',' */\n hiddenInputValuesDivider?: string;\n\n /** Props for the ScrollArea in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls the default chevron color */\n chevronColor?: MantineColor;\n\n /** Max dropdown height @default 220 */\n maxDropdownHeight?: number | string;\n\n /** Controlled dropdown state */\n dropdownOpened?: boolean;\n\n /** Default dropdown state */\n defaultDropdownOpened?: boolean;\n\n /** Called when dropdown opens */\n onDropdownOpen?: () => void;\n\n /** Called when dropdown closes */\n onDropdownClose?: () => void;\n\n /** Props passed to the underlying Combobox */\n comboboxProps?: Record<string, any>;\n\n /** Clear search on selection change @default true */\n clearSearchOnChange?: boolean;\n\n /** Opens dropdown on focus (searchable mode) @default true */\n openOnFocus?: boolean;\n\n /** aria-label values for the expand/collapse chevron button */\n chevronAriaLabels?: TreeSelectChevronAriaLabels;\n}\n\nexport type TreeSelectFactory = Factory<{\n props: TreeSelectProps;\n ref: HTMLInputElement;\n stylesNames: TreeSelectStylesNames;\n variant: InputVariant;\n signature: <Mode extends TreeSelectMode = 'single'>(\n props: TreeSelectProps<Mode>\n ) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n mode: 'single',\n allowDeselect: true,\n checkedStrategy: 'child',\n maxValues: Infinity,\n hiddenInputValuesDivider: ',',\n clearSearchOnChange: true,\n openOnFocus: true,\n size: 'sm',\n withLines: true,\n} satisfies Partial<TreeSelectProps<TreeSelectMode>>;\n\nconst clearSectionOffset: Record<string, number> = {\n xs: 41,\n sm: 50,\n md: 60,\n lg: 72,\n xl: 89,\n};\n\nfunction getAncestorsToNode(value: string, nodes: TreeNodeData[]): string[] | null {\n for (const node of nodes) {\n if (node.value === value) {\n return [];\n }\n if (Array.isArray(node.children)) {\n const path = getAncestorsToNode(value, node.children);\n if (path !== null) {\n return [node.value, ...path];\n }\n }\n }\n return null;\n}\n\nexport const TreeSelect = genericFactory<TreeSelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'TreeSelect'], defaultProps as any, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n size,\n data,\n mode,\n value,\n defaultValue,\n onChange,\n checkStrictly,\n checkedStrategy,\n defaultExpandedValues,\n defaultExpandAll,\n expandedValues,\n onExpandedChange,\n expandOnClick,\n searchable,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n filter,\n nothingFoundMessage,\n allowDeselect,\n clearable,\n clearSectionMode,\n clearButtonProps,\n maxValues,\n maxDisplayedValues,\n maxDisplayedValuesContent,\n onRemove,\n onClear,\n renderNode,\n withLines,\n hiddenInputProps,\n hiddenInputValuesDivider,\n scrollAreaProps,\n chevronColor,\n maxDropdownHeight,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownOpen,\n onDropdownClose,\n comboboxProps,\n clearSearchOnChange,\n openOnFocus,\n chevronAriaLabels,\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 isMulti = mode === 'multiple' || mode === 'checkbox';\n const isCheckbox = mode === 'checkbox';\n const _id = useId(id);\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n combobox.resetSelectedOption();\n },\n });\n\n const initialExpanded = useMemo(() => {\n if (defaultExpandAll) {\n return getTreeExpandedState(data, '*');\n }\n if (defaultExpandedValues) {\n return getTreeExpandedState(data, defaultExpandedValues);\n }\n return getTreeExpandedState(data, []);\n }, []);\n\n const expandedToRecord = useCallback(\n (values: string[] | undefined): TreeExpandedState | undefined => {\n if (!values) {\n return undefined;\n }\n return getTreeExpandedState(data, values);\n },\n [data]\n );\n\n const [_expandedState, setExpandedState] = useUncontrolled<TreeExpandedState>({\n value: expandedToRecord(expandedValues),\n defaultValue: initialExpanded,\n finalValue: {},\n onChange: (val) => {\n if (onExpandedChange) {\n onExpandedChange(\n Object.entries(val)\n .filter(([, v]) => v)\n .map(([k]) => k)\n );\n }\n },\n });\n\n const toggleExpand = useCallback(\n (nodeValue: string) => {\n setExpandedState({ ..._expandedState, [nodeValue]: !_expandedState[nodeValue] });\n },\n [_expandedState]\n );\n\n const initialSearchValue = useMemo(() => {\n if (mode !== 'single' || !defaultValue) {\n return '';\n }\n const node = findTreeNode(defaultValue as string, data);\n return node ? (typeof node.label === 'string' ? node.label : '') : '';\n }, []);\n\n const [_searchValue, setSearchValue] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: initialSearchValue,\n onChange: onSearchChange,\n });\n\n const handleSearchChange = (val: string) => {\n setSearchValue(val);\n combobox.resetSelectedOption();\n };\n\n const [_value, setValue] = useUncontrolled({\n value: value as any,\n defaultValue: defaultValue as any,\n finalValue: isMulti ? [] : null,\n onChange,\n });\n\n const internalChecked = useMemo(() => {\n if (!isCheckbox || !_value || !Array.isArray(_value)) {\n return [];\n }\n if (checkStrictly) {\n return _value;\n }\n return expandToLeafChecked(_value, data);\n }, [isCheckbox, _value, data, checkStrictly]);\n\n const filteredData = useMemo(() => {\n if (!searchable || !_searchValue) {\n return data;\n }\n if (mode === 'single' && _value) {\n const node = findTreeNode(_value as string, data);\n if (node && _searchValue === (typeof node.label === 'string' ? node.label : '')) {\n return data;\n }\n }\n return filterTreeData(data, _searchValue, filter);\n }, [data, _searchValue, filter, searchable, mode, _value]);\n\n const expandedForRender = useMemo(() => {\n if (_searchValue && filteredData !== data) {\n const expanded = { ..._expandedState };\n const expandFilteredParents = (nodes: TreeNodeData[]) => {\n for (const node of nodes) {\n if (Array.isArray(node.children) && node.children.length > 0) {\n expanded[node.value] = true;\n expandFilteredParents(node.children);\n }\n }\n };\n expandFilteredParents(filteredData);\n return expanded;\n }\n return _expandedState;\n }, [filteredData, _expandedState, _searchValue, data]);\n\n const flatNodes = useMemo(\n () => flattenTreeSelectData(filteredData, expandedForRender),\n [filteredData, expandedForRender]\n );\n\n const flatNodesRef = useRef(flatNodes);\n flatNodesRef.current = flatNodes;\n\n const nodeLookup = useMemo(() => {\n const lookup: Record<string, TreeNodeData> = {};\n const walk = (nodes: TreeNodeData[]) => {\n for (const node of nodes) {\n lookup[node.value] = node;\n if (Array.isArray(node.children)) {\n walk(node.children);\n }\n }\n };\n walk(data);\n return lookup;\n }, [data]);\n\n const getNodeLabel = (nodeValue: string): string => {\n const node = nodeLookup[nodeValue];\n if (!node) {\n return nodeValue;\n }\n return typeof node.label === 'string' ? node.label : nodeValue;\n };\n\n const getStyles = useStyles<TreeSelectFactory>({\n name: 'TreeSelect',\n classes: {} as any,\n props: props as any,\n classNames,\n styles,\n unstyled,\n attributes,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<TreeSelectFactory>({\n props,\n styles,\n classNames,\n });\n\n const {\n styleProps,\n rest: { type, autoComplete, ...rest },\n } = extractStyleProps(others);\n\n const handleOptionSubmit = (val: string) => {\n if (mode === 'single') {\n if (expandOnClick) {\n const node = findTreeNode(val, data);\n if (node && Array.isArray(node.children) && node.children.length > 0) {\n toggleExpand(val);\n return;\n }\n }\n const nextValue = allowDeselect && val === _value ? null : val;\n setValue(nextValue);\n combobox.closeDropdown();\n if (clearSearchOnChange) {\n handleSearchChange(nextValue ? getNodeLabel(nextValue) : '');\n }\n } else if (mode === 'multiple') {\n if (expandOnClick) {\n const node = findTreeNode(val, data);\n if (node && Array.isArray(node.children) && node.children.length > 0) {\n toggleExpand(val);\n return;\n }\n }\n const arr = (_value as string[]) || [];\n if (arr.includes(val)) {\n setValue(arr.filter((v: string) => v !== val));\n onRemove?.(val);\n } else if (arr.length < (maxValues ?? Infinity)) {\n setValue([...arr, val]);\n } else {\n return;\n }\n if (clearSearchOnChange) {\n setSearchValue('');\n }\n } else if (mode === 'checkbox') {\n const nodeChecked = checkStrictly\n ? internalChecked.includes(val)\n : isNodeChecked(val, data, internalChecked);\n\n let newInternalChecked: string[];\n if (checkStrictly) {\n newInternalChecked = nodeChecked\n ? internalChecked.filter((v) => v !== val)\n : [...internalChecked, val];\n } else {\n const childLeaves = getChildrenNodesValues(val, data);\n if (nodeChecked) {\n newInternalChecked = internalChecked.filter((v) => !childLeaves.includes(v));\n } else {\n newInternalChecked = [...new Set([...internalChecked, ...childLeaves])];\n }\n }\n\n const newValue = checkedToValue(newInternalChecked, data, checkedStrategy!);\n if (!nodeChecked && newValue.length > (maxValues ?? Infinity)) {\n return;\n }\n setValue(newValue);\n if (clearSearchOnChange) {\n setSearchValue('');\n }\n\n if (expandOnClick) {\n const node = findTreeNode(val, data);\n if (node && Array.isArray(node.children) && node.children.length > 0) {\n if (!_expandedState[val]) {\n toggleExpand(val);\n }\n }\n }\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.key === ' ' && !searchable && isMulti) {\n event.preventDefault();\n combobox.toggleDropdown();\n }\n\n if (event.key === 'Backspace' && _searchValue.length === 0 && isMulti) {\n const arr = (_value as string[]) || [];\n if (arr.length > 0) {\n const removed = arr[arr.length - 1];\n onRemove?.(removed);\n setValue(arr.slice(0, -1));\n }\n }\n\n if (!combobox.dropdownOpened) {\n return;\n }\n\n const index = combobox.getSelectedOptionIndex();\n if (index < 0 || index >= flatNodesRef.current.length) {\n return;\n }\n\n const currentNode = flatNodesRef.current[index];\n\n if (event.key === 'ArrowRight') {\n if (currentNode.hasChildren && !currentNode.expanded) {\n event.preventDefault();\n toggleExpand(currentNode.node.value);\n }\n }\n\n if (event.key === 'ArrowLeft') {\n if (currentNode.hasChildren && currentNode.expanded) {\n event.preventDefault();\n toggleExpand(currentNode.node.value);\n } else if (currentNode.parent) {\n event.preventDefault();\n const parentIndex = flatNodesRef.current.findIndex(\n (n) => n.node.value === currentNode.parent\n );\n if (parentIndex >= 0) {\n combobox.selectOption(parentIndex);\n }\n }\n }\n };\n\n useEffect(() => {\n if (mode !== 'single' || !searchable) {\n return;\n }\n if (value === null) {\n handleSearchChange('');\n } else if (typeof value === 'string') {\n handleSearchChange(getNodeLabel(value));\n }\n }, [value]);\n\n const prevDropdownOpenedRef = useRef(false);\n useEffect(() => {\n if (combobox.dropdownOpened && !prevDropdownOpenedRef.current && searchable && _value) {\n const targets = Array.isArray(_value) ? _value : [_value];\n const newExpanded = { ..._expandedState };\n let changed = false;\n for (const target of targets) {\n const ancestors = getAncestorsToNode(target as string, data);\n if (ancestors) {\n for (const a of ancestors) {\n if (!newExpanded[a]) {\n newExpanded[a] = true;\n changed = true;\n }\n }\n }\n }\n if (changed) {\n setExpandedState(newExpanded);\n requestAnimationFrame(() => {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n });\n }\n }\n prevDropdownOpenedRef.current = combobox.dropdownOpened;\n });\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n onClear?.();\n setValue(isMulti ? [] : null);\n handleSearchChange('');\n combobox.focusTarget();\n }}\n />\n );\n\n const hasValue = isMulti\n ? Array.isArray(_value) && _value.length > 0\n : _value != null && _value !== '';\n const _clearable = clearable && hasValue && !disabled && !readOnly;\n\n const singleDisplayLabel = useMemo(() => {\n if (mode !== 'single' || !_value) {\n return '';\n }\n return getNodeLabel(_value as string);\n }, [mode, _value, nodeLookup]);\n\n const displayValues = useMemo(() => {\n if (!isMulti || !Array.isArray(_value)) {\n return [];\n }\n return _value as string[];\n }, [isMulti, _value]);\n\n const pillsListStyle =\n _clearable && isMulti\n ? { paddingInlineEnd: clearSectionOffset[size as string] ?? clearSectionOffset.sm }\n : undefined;\n\n const visiblePills =\n maxDisplayedValues != null ? displayValues.slice(0, maxDisplayedValues) : displayValues;\n\n const overflowCount =\n maxDisplayedValues != null ? Math.max(0, displayValues.length - maxDisplayedValues) : 0;\n\n const pills = visiblePills.map((item, index) => (\n <Pill\n key={`${item}-${index}`}\n withRemoveButton={!readOnly}\n onRemove={() => {\n if (isCheckbox) {\n const childLeaves = checkStrictly ? [item] : getChildrenNodesValues(item, data);\n const newInternal = internalChecked.filter((v) => !childLeaves.includes(v));\n setValue(checkedToValue(newInternal, data, checkedStrategy!));\n } else {\n setValue((_value as string[]).filter((v: string) => v !== item));\n }\n onRemove?.(item);\n }}\n unstyled={unstyled}\n disabled={disabled}\n {...getStyles('pill')}\n >\n {getNodeLabel(item)}\n </Pill>\n ));\n\n if (overflowCount > 0) {\n const overflowContent =\n typeof maxDisplayedValuesContent === 'function'\n ? maxDisplayedValuesContent(overflowCount)\n : maxDisplayedValuesContent || `+${overflowCount} more`;\n pills.push(\n <Pill key=\"__overflow\" unstyled={unstyled} disabled={disabled} {...getStyles('pill')}>\n {overflowContent}\n </Pill>\n );\n }\n\n const isEmpty = flatNodes.length === 0;\n\n const options = flatNodes.map((flatNode) => {\n const isSelected =\n mode === 'single'\n ? _value === flatNode.node.value\n : mode === 'multiple'\n ? ((_value as string[]) || []).includes(flatNode.node.value)\n : false;\n\n const nodeChecked = isCheckbox\n ? checkStrictly\n ? internalChecked.includes(flatNode.node.value)\n : isNodeChecked(flatNode.node.value, data, internalChecked)\n : false;\n\n const nodeIndeterminate =\n isCheckbox && !checkStrictly\n ? isNodeIndeterminate(flatNode.node.value, data, internalChecked)\n : false;\n\n return (\n <TreeSelectOption\n key={flatNode.node.value}\n node={flatNode.node}\n level={flatNode.level}\n expanded={flatNode.expanded}\n hasChildren={flatNode.hasChildren}\n selected={isSelected}\n checked={nodeChecked}\n indeterminate={nodeIndeterminate}\n showCheckbox={isCheckbox}\n isLastChild={flatNode.isLastChild}\n lineGuides={flatNode.lineGuides}\n withLines={!!withLines}\n onToggleExpand={toggleExpand}\n renderNode={renderNode}\n chevronAriaLabels={chevronAriaLabels}\n />\n );\n });\n\n const dropdown = (\n <Combobox.Dropdown hidden={readOnly || disabled}>\n <Combobox.Options\n className={classes.optionsWrapper}\n aria-multiselectable={isMulti || undefined}\n >\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 {isEmpty && nothingFoundMessage && <Combobox.Empty>{nothingFoundMessage}</Combobox.Empty>}\n </Combobox.Options>\n </Combobox.Dropdown>\n );\n\n if (isMulti) {\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=\"TreeSelect\"\n attributes={attributes}\n onOptionSubmit={handleOptionSubmit}\n {...comboboxProps}\n >\n <Combobox.DropdownTarget>\n <PillsInput\n {...styleProps}\n __staticSelector=\"TreeSelect\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n size={size}\n className={className}\n style={style}\n variant={variant}\n disabled={disabled}\n radius={radius}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n rightSectionWidth={rightSectionWidth}\n rightSectionProps={rightSectionProps}\n leftSection={leftSection}\n leftSectionWidth={leftSectionWidth}\n leftSectionPointerEvents={leftSectionPointerEvents}\n leftSectionProps={leftSectionProps}\n inputContainer={inputContainer}\n inputWrapperOrder={inputWrapperOrder}\n withAsterisk={withAsterisk}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorProps={errorProps}\n 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 >\n {pills}\n <Combobox.EventsTarget autoComplete={autoComplete}>\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 if (openOnFocus && searchable) {\n combobox.openDropdown();\n }\n }}\n onBlur={(event) => {\n onBlur?.(event);\n combobox.closeDropdown();\n handleSearchChange('');\n }}\n onKeyDown={handleKeyDown}\n value={_searchValue}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n if (searchable) {\n combobox.openDropdown();\n }\n }}\n disabled={disabled}\n readOnly={readOnly || !searchable}\n pointer={!searchable}\n />\n </Combobox.EventsTarget>\n </Pill.Group>\n </PillsInput>\n </Combobox.DropdownTarget>\n {dropdown}\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\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"TreeSelect\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n onOptionSubmit={handleOptionSubmit}\n {...comboboxProps}\n >\n <Combobox.Target targetType={searchable ? 'input' : 'button'} autoComplete={autoComplete}>\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=\"TreeSelect\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={searchable ? _searchValue : singleDisplayLabel}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n }}\n onFocus={(event) => {\n if (openOnFocus && searchable) {\n combobox.openDropdown();\n }\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (searchable) {\n combobox.closeDropdown();\n }\n handleSearchChange(_value ? getNodeLabel(_value as string) : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\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={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nTreeSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nTreeSelect.displayName = '@mantine/core/TreeSelect';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6MA,MAAM,eAAe;CACnB,MAAM;CACN,eAAe;CACf,iBAAiB;CACjB,WAAW;CACX,0BAA0B;CAC1B,qBAAqB;CACrB,aAAa;CACb,MAAM;CACN,WAAW;AACb;AAEA,MAAM,qBAA6C;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,SAAS,mBAAmB,OAAe,OAAwC;CACjF,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,UAAU,OACjB,OAAO,CAAC;EAEV,IAAI,MAAM,QAAQ,KAAK,QAAQ,GAAG;GAChC,MAAM,OAAO,mBAAmB,OAAO,KAAK,QAAQ;GACpD,IAAI,SAAS,MACX,OAAO,CAAC,KAAK,OAAO,GAAG,IAAI;EAE/B;CACF;CACA,OAAO;AACT;AAEA,MAAa,aAAa,gBAAmC,WAAW;CACtE,MAAM,QAAQ,SAAS;EAAC;EAAS;EAAgB;CAAY,GAAG,cAAqB,MAAM;CAC3F,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,MACA,MACA,OACA,cACA,UACA,eACA,iBACA,uBACA,kBACA,gBACA,kBACA,eACA,YACA,aACA,oBACA,gBACA,QACA,qBACA,eACA,WACA,kBACA,kBACA,WACA,oBACA,2BACA,UACA,SACA,YACA,WACA,kBACA,0BACA,iBACA,cACA,mBACA,gBACA,uBACA,gBACA,iBACA,eACA,qBACA,aACA,mBACA,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,UAAU,SAAS,cAAc,SAAS;CAChD,MAAM,aAAa,SAAS;CAC5B,MAAM,MAAMA,QAAM,EAAE;CAEpB,MAAM,WAAW,YAAY;EAC3B,QAAQ;EACR,eAAe;EACf,sBAAsB;GACpB,iBAAiB;GACjB,SAAS,0BAA0B,UAAU,EAAE,gBAAgB,KAAK,CAAC;EACvE;EACA,uBAAuB;GACrB,kBAAkB;GAClB,SAAS,oBAAoB;EAC/B;CACF,CAAC;CAED,MAAM,kBAAkB,cAAc;EACpC,IAAI,kBACF,OAAO,qBAAqB,MAAM,GAAG;EAEvC,IAAI,uBACF,OAAO,qBAAqB,MAAM,qBAAqB;EAEzD,OAAO,qBAAqB,MAAM,CAAC,CAAC;CACtC,GAAG,CAAC,CAAC;CAYL,MAAM,CAAC,gBAAgB,oBAAoB,gBAAmC;EAC5E,OAXuB,aACtB,WAAgE;GAC/D,IAAI,CAAC,QACH;GAEF,OAAO,qBAAqB,MAAM,MAAM;EAC1C,GACA,CAAC,IAAI,CAIiB,CAAC,CAAC,cAAc;EACtC,cAAc;EACd,YAAY,CAAC;EACb,WAAW,QAAQ;GACjB,IAAI,kBACF,iBACE,OAAO,Q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a;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;KACnB,IAAI,sBAAsB,KAAK,GAC7B;KAGF,mBAAmB,MAAM,cAAc,KAAK;KAC5C,SAAS,aAAa;IACxB;IACA,UAAU,UAAU;KAClB,IAAI,eAAe,YACjB,SAAS,aAAa;KAExB,UAAU,KAAK;IACjB;IACA,SAAS,UAAU;KACjB,IAAI,YACF,SAAS,cAAc;KAEzB,mBAAmB,SAAS,aAAa,MAAgB,IAAI,EAAE;KAC/D,SAAS,KAAK;IAChB;IACA,UAAU,UAAU;KAClB,aAAa,SAAS,aAAa,IAAI,SAAS,eAAe;KAC/D,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;EACD;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,WAAW,UAAU;CAAE,GAAG,UAAU;CAAS,GAAG,SAAS;AAAQ;AACjE,WAAW,cAAc"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SafePolygonOptions } from '@floating-ui/react';
|
|
1
2
|
import { BoxProps, ElementProps, Factory, MantineColor, StylesApiProps } from '../../core';
|
|
2
3
|
import { ComboboxLikeStylesNames } from '../Combobox';
|
|
3
4
|
import { __BaseInputProps, __InputStylesNames, ClearSectionMode, InputClearButtonProps, InputVariant } from '../Input';
|
|
@@ -19,6 +20,7 @@ export interface CascaderFormatValueInput {
|
|
|
19
20
|
options: CascaderOption[];
|
|
20
21
|
}
|
|
21
22
|
export type CascaderFormatValue = (input: CascaderFormatValueInput) => React.ReactNode;
|
|
23
|
+
export type CascaderSafeAreaPolygonOptions = Omit<SafePolygonOptions, 'blockPointerEvents'>;
|
|
22
24
|
export type CascaderStylesNames = __InputStylesNames | ComboboxLikeStylesNames | 'columnsList' | 'columnsOverflow' | 'column' | 'columnScroll' | 'columnOption' | 'columnOptionLabel' | 'columnOptionIcon' | 'columnOptionCheck' | 'columnEmpty' | 'flatOption';
|
|
23
25
|
export interface CascaderProps extends BoxProps, __BaseInputProps, StylesApiProps<CascaderFactory>, ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {
|
|
24
26
|
/** Hierarchical options data */
|
|
@@ -43,6 +45,8 @@ export interface CascaderProps extends BoxProps, __BaseInputProps, StylesApiProp
|
|
|
43
45
|
withColumns?: boolean;
|
|
44
46
|
/** Determines how the next column is opened @default 'click' */
|
|
45
47
|
expandTrigger?: 'click' | 'hover';
|
|
48
|
+
/** 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 */
|
|
49
|
+
safeAreaPolygon?: boolean | CascaderSafeAreaPolygonOptions;
|
|
46
50
|
/** If set, options can be searched by their flattened paths @default false */
|
|
47
51
|
searchable?: boolean;
|
|
48
52
|
/** Controlled search value */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GetStylesApi } from '../../core';
|
|
2
2
|
import { ScrollAreaProps } from '../ScrollArea';
|
|
3
|
-
import type { CascaderOption, CascaderStylesNames } from './Cascader';
|
|
3
|
+
import type { CascaderOption, CascaderSafeAreaPolygonOptions, CascaderStylesNames } from './Cascader';
|
|
4
4
|
type CascaderColumnsGetStyles = GetStylesApi<{
|
|
5
5
|
props: any;
|
|
6
6
|
stylesNames: CascaderStylesNames;
|
|
@@ -27,9 +27,10 @@ export interface CascaderColumnsProps {
|
|
|
27
27
|
onColumnsMouseLeave: (() => void) | undefined;
|
|
28
28
|
onPointerActivity: (() => void) | undefined;
|
|
29
29
|
listId: string | undefined;
|
|
30
|
+
safeAreaPolygon: boolean | CascaderSafeAreaPolygonOptions | undefined;
|
|
30
31
|
}
|
|
31
32
|
export declare function getCascaderOptionId(listId: string | undefined, level: number, value: string): string | undefined;
|
|
32
|
-
export declare function CascaderColumns({ data, activePath, value, keyboardNav, withCheckIcon, checkIconPosition, renderOption, columnWidth, maxDisplayedLevels, previousLevelsControlLabel, nextLevelsControlLabel, maxDropdownHeight, nothingFoundMessage, getStyles, unstyled, scrollAreaProps, onOptionClick, onOptionMouseEnter, onColumnsMouseLeave, onPointerActivity, listId, }: CascaderColumnsProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare function CascaderColumns({ data, activePath, value, keyboardNav, withCheckIcon, checkIconPosition, renderOption, columnWidth, maxDisplayedLevels, previousLevelsControlLabel, nextLevelsControlLabel, maxDropdownHeight, nothingFoundMessage, getStyles, unstyled, scrollAreaProps, onOptionClick, onOptionMouseEnter, onColumnsMouseLeave, onPointerActivity, listId, safeAreaPolygon, }: CascaderColumnsProps): import("react/jsx-runtime").JSX.Element;
|
|
33
34
|
export declare namespace CascaderColumns {
|
|
34
35
|
var displayName: string;
|
|
35
36
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CascaderOption, CascaderSafeAreaPolygonOptions } from './Cascader';
|
|
2
|
+
export interface CascaderSafeAreaArmInput {
|
|
3
|
+
level: number;
|
|
4
|
+
reference: HTMLElement;
|
|
5
|
+
floating: HTMLElement;
|
|
6
|
+
clientX: number;
|
|
7
|
+
clientY: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UseCascaderSafeAreaInput {
|
|
10
|
+
safeAreaPolygon: boolean | CascaderSafeAreaPolygonOptions | undefined;
|
|
11
|
+
onFlush: (level: number, option: CascaderOption) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function useCascaderSafeArea({ safeAreaPolygon, onFlush }: UseCascaderSafeAreaInput): {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
arm: ({ level, reference, floating, clientX, clientY }: CascaderSafeAreaArmInput) => void;
|
|
16
|
+
disarm: () => void;
|
|
17
|
+
isBlocked: (level: number) => boolean;
|
|
18
|
+
setPending: (level: number, option: CascaderOption) => void;
|
|
19
|
+
clearPending: (level: number, option: CascaderOption) => void;
|
|
20
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BoxProps, ElementProps, Factory, MantineRadius, StylesApiProps } from '../../../core';
|
|
2
2
|
export interface CheckboxCardContextValue {
|
|
3
3
|
checked: boolean;
|
|
4
|
+
indeterminate?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export declare const CheckboxCardContext: import("react").Context<CheckboxCardContextValue | null>;
|
|
6
7
|
export type CheckboxCardStylesNames = 'card';
|
|
@@ -14,6 +15,8 @@ export interface CheckboxCardProps extends BoxProps, StylesApiProps<CheckboxCard
|
|
|
14
15
|
defaultChecked?: boolean;
|
|
15
16
|
/** Called when value changes */
|
|
16
17
|
onChange?: (checked: boolean) => void;
|
|
18
|
+
/** Indeterminate state of the checkbox. If set, `checked` prop is ignored and `aria-checked` is set to `mixed` */
|
|
19
|
+
indeterminate?: boolean;
|
|
17
20
|
/** Adds border to the root element */
|
|
18
21
|
withBorder?: boolean;
|
|
19
22
|
/** Key of `theme.radius` or any valid CSS value to set `border-radius`, numbers are converted to rem @default theme.defaultRadius */
|
|
@@ -23,11 +23,11 @@ export interface __ColorPickerProps {
|
|
|
23
23
|
swatchesPerRow?: number;
|
|
24
24
|
/** Component size @default 'md' */
|
|
25
25
|
size?: MantineSize | (string & {});
|
|
26
|
+
/** If set, the component takes 100% width of its container @default false */
|
|
27
|
+
fullWidth?: boolean;
|
|
26
28
|
}
|
|
27
29
|
export interface ColorPickerProps extends BoxProps, __ColorPickerProps, StylesApiProps<ColorPickerFactory>, ElementProps<'div', 'onChange' | 'value' | 'defaultValue'> {
|
|
28
30
|
__staticSelector?: string;
|
|
29
|
-
/** If set, the component takes 100% width of its container @default false */
|
|
30
|
-
fullWidth?: boolean;
|
|
31
31
|
/** If set, interactive elements (sliders thumbs and swatches) are focusable with keyboard @default true */
|
|
32
32
|
focusable?: boolean;
|
|
33
33
|
/** Saturation slider `aria-label` */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Primitive } from '../../../core';
|
|
2
|
+
import { ComboboxItem } from '../Combobox.types';
|
|
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
|
+
export declare function getOptionByLabel<Value extends Primitive = string>(optionsLockup: Record<PropertyKey, ComboboxItem<Value>>, label: string): ComboboxItem<Value> | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether an input change was produced by something other than the user typing into the
|
|
3
|
+
* input – browser autofill, password managers and browser extensions all write to inputs without
|
|
4
|
+
* focusing them first. Combobox components reconcile the search value with the selected value on
|
|
5
|
+
* blur, which never happens for such writes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isExternalInputChange(event: React.ChangeEvent<HTMLInputElement>): boolean;
|
|
@@ -3,7 +3,7 @@ import { ComboboxData, ComboboxItem, ComboboxLikeRenderOptionInput, ComboboxLike
|
|
|
3
3
|
import { ScrollAreaProps } from '../ScrollArea';
|
|
4
4
|
import { ComboboxPopoverValue } from './ComboboxPopover.types';
|
|
5
5
|
import { ComboboxPopoverTarget } from './ComboboxPopoverTarget';
|
|
6
|
-
export type ComboboxPopoverStylesNames = ComboboxLikeStylesNames;
|
|
6
|
+
export type ComboboxPopoverStylesNames = ComboboxLikeStylesNames | 'search';
|
|
7
7
|
export interface ComboboxPopoverProps<Multiple extends boolean = false, Value extends Primitive = string> extends StylesApiProps<ComboboxPopoverFactory> {
|
|
8
8
|
/** If set, multiple items can be selected at the same time */
|
|
9
9
|
multiple?: Multiple;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BoxProps, DataAttributes, ElementProps, Factory, MantineColor, MantineRadius, StylesApiProps } from '../../core';
|
|
2
|
+
import { __CloseButtonProps } from '../CloseButton';
|
|
2
3
|
import { LoaderProps } from '../Loader';
|
|
3
4
|
export type NotificationStylesNames = 'root' | 'icon' | 'loader' | 'body' | 'title' | 'description' | 'closeButton';
|
|
4
5
|
export type NotificationCssVariables = {
|
|
@@ -24,7 +25,7 @@ export interface NotificationProps extends BoxProps, StylesApiProps<Notification
|
|
|
24
25
|
/** If set, the close button is visible @default true */
|
|
25
26
|
withCloseButton?: boolean;
|
|
26
27
|
/** Props passed down to the close button */
|
|
27
|
-
closeButtonProps?: ElementProps<'button'> & DataAttributes;
|
|
28
|
+
closeButtonProps?: __CloseButtonProps & ElementProps<'button'> & DataAttributes;
|
|
28
29
|
/** Props passed down to the `Loader` component */
|
|
29
30
|
loaderProps?: LoaderProps;
|
|
30
31
|
}
|
|
@@ -11,6 +11,8 @@ export interface PasswordInputProps extends BoxProps, Omit<__BaseInputProps, 'po
|
|
|
11
11
|
}>;
|
|
12
12
|
/** Props passed down to the visibility toggle button */
|
|
13
13
|
visibilityToggleButtonProps?: Record<string, any>;
|
|
14
|
+
/** If set, the visibility toggle button is focusable with keyboard @default `false` */
|
|
15
|
+
visibilityToggleFocusable?: boolean;
|
|
14
16
|
/** If set, the input value is visible */
|
|
15
17
|
visible?: boolean;
|
|
16
18
|
/** If set, the input value is visible by default */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoxProps, ElementProps, Factory, StylesApiProps } from '../../core';
|
|
2
|
-
export type RollingNumberStylesNames = 'root' | 'digit' | 'digitColumn' | 'char';
|
|
2
|
+
export type RollingNumberStylesNames = 'root' | 'copyValue' | 'digit' | 'digitColumn' | 'char';
|
|
3
3
|
export type RollingNumberCssVariables = {
|
|
4
4
|
root: '--rn-duration' | '--rn-timing-function';
|
|
5
5
|
};
|
|
@@ -35,6 +35,8 @@ export interface TooltipProps extends TooltipBaseProps {
|
|
|
35
35
|
focus: boolean;
|
|
36
36
|
touch: boolean;
|
|
37
37
|
};
|
|
38
|
+
/** If set, the tooltip stays open while the pointer moves from the target to the tooltip and remains over it. Required by [WCAG 1.4.13](https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html) if the tooltip contains interactive content. Note that an interactive tooltip intercepts pointer events of the content it overlaps @default false */
|
|
39
|
+
interactive?: boolean;
|
|
38
40
|
/** Must be set if the tooltip target is an inline element */
|
|
39
41
|
inline?: boolean;
|
|
40
42
|
/** If set, the tooltip is not unmounted from the DOM when hidden, `display: none` styles are applied instead */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine/core",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.2",
|
|
4
4
|
"description": "React components library focused on usability, accessibility and developer experience",
|
|
5
5
|
"homepage": "https://mantine.dev/",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"directory": "packages/@mantine/core"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@mantine/hooks": "9.5.
|
|
46
|
+
"@mantine/hooks": "9.5.2",
|
|
47
47
|
"react": "^19.2.0",
|
|
48
48
|
"react-dom": "^19.2.0"
|
|
49
49
|
},
|
package/styles/RollingNumber.css
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.m_47dd3981 {
|
|
2
|
+
position: relative;
|
|
2
3
|
display: inline-flex;
|
|
3
4
|
align-items: baseline;
|
|
4
5
|
overflow: hidden;
|
|
@@ -8,12 +9,27 @@
|
|
|
8
9
|
font-variant-numeric: tabular-nums;
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
.m_ccf525bd {
|
|
13
|
+
position: absolute;
|
|
14
|
+
inset: 0;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
white-space: pre;
|
|
18
|
+
color: transparent;
|
|
19
|
+
forced-color-adjust: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
.m_b301d46e {
|
|
23
|
+
position: relative;
|
|
24
|
+
z-index: 2;
|
|
12
25
|
display: inline-block;
|
|
13
26
|
width: 1ch;
|
|
14
27
|
height: 1em;
|
|
15
28
|
overflow: hidden;
|
|
16
29
|
line-height: 1;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
user-select: none;
|
|
32
|
+
-webkit-user-select: none;
|
|
17
33
|
transition:
|
|
18
34
|
width var(--rn-duration) var(--rn-timing-function),
|
|
19
35
|
opacity var(--rn-duration) var(--rn-timing-function);
|
|
@@ -38,9 +54,14 @@
|
|
|
38
54
|
}
|
|
39
55
|
|
|
40
56
|
.m_47d64bf5 {
|
|
57
|
+
position: relative;
|
|
58
|
+
z-index: 2;
|
|
41
59
|
display: inline-block;
|
|
42
60
|
overflow: hidden;
|
|
43
61
|
white-space: pre;
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
user-select: none;
|
|
64
|
+
-webkit-user-select: none;
|
|
44
65
|
transition: opacity var(--rn-duration) var(--rn-timing-function);
|
|
45
66
|
}
|
|
46
67
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@layer mantine {.m_47dd3981 {
|
|
2
|
+
position: relative;
|
|
2
3
|
display: inline-flex;
|
|
3
4
|
align-items: baseline;
|
|
4
5
|
overflow: hidden;
|
|
@@ -8,12 +9,27 @@
|
|
|
8
9
|
font-variant-numeric: tabular-nums;
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
.m_ccf525bd {
|
|
13
|
+
position: absolute;
|
|
14
|
+
inset: 0;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
white-space: pre;
|
|
18
|
+
color: transparent;
|
|
19
|
+
forced-color-adjust: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
.m_b301d46e {
|
|
23
|
+
position: relative;
|
|
24
|
+
z-index: 2;
|
|
12
25
|
display: inline-block;
|
|
13
26
|
width: 1ch;
|
|
14
27
|
height: 1em;
|
|
15
28
|
overflow: hidden;
|
|
16
29
|
line-height: 1;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
user-select: none;
|
|
32
|
+
-webkit-user-select: none;
|
|
17
33
|
transition:
|
|
18
34
|
width var(--rn-duration) var(--rn-timing-function),
|
|
19
35
|
opacity var(--rn-duration) var(--rn-timing-function);
|
|
@@ -38,9 +54,14 @@
|
|
|
38
54
|
}
|
|
39
55
|
|
|
40
56
|
.m_47d64bf5 {
|
|
57
|
+
position: relative;
|
|
58
|
+
z-index: 2;
|
|
41
59
|
display: inline-block;
|
|
42
60
|
overflow: hidden;
|
|
43
61
|
white-space: pre;
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
user-select: none;
|
|
64
|
+
-webkit-user-select: none;
|
|
44
65
|
transition: opacity var(--rn-duration) var(--rn-timing-function);
|
|
45
66
|
}
|
|
46
67
|
|
package/styles/Tooltip.css
CHANGED
package/styles/Tooltip.layer.css
CHANGED
package/styles.css
CHANGED
|
@@ -6626,6 +6626,7 @@ fieldset:disabled .m_8ee546b8,
|
|
|
6626
6626
|
}
|
|
6627
6627
|
|
|
6628
6628
|
.m_47dd3981 {
|
|
6629
|
+
position: relative;
|
|
6629
6630
|
display: inline-flex;
|
|
6630
6631
|
align-items: baseline;
|
|
6631
6632
|
overflow: hidden;
|
|
@@ -6635,12 +6636,27 @@ fieldset:disabled .m_8ee546b8,
|
|
|
6635
6636
|
font-variant-numeric: tabular-nums;
|
|
6636
6637
|
}
|
|
6637
6638
|
|
|
6639
|
+
.m_ccf525bd {
|
|
6640
|
+
position: absolute;
|
|
6641
|
+
inset: 0;
|
|
6642
|
+
z-index: 1;
|
|
6643
|
+
overflow: hidden;
|
|
6644
|
+
white-space: pre;
|
|
6645
|
+
color: transparent;
|
|
6646
|
+
forced-color-adjust: none;
|
|
6647
|
+
}
|
|
6648
|
+
|
|
6638
6649
|
.m_b301d46e {
|
|
6650
|
+
position: relative;
|
|
6651
|
+
z-index: 2;
|
|
6639
6652
|
display: inline-block;
|
|
6640
6653
|
width: 1ch;
|
|
6641
6654
|
height: 1em;
|
|
6642
6655
|
overflow: hidden;
|
|
6643
6656
|
line-height: 1;
|
|
6657
|
+
pointer-events: none;
|
|
6658
|
+
user-select: none;
|
|
6659
|
+
-webkit-user-select: none;
|
|
6644
6660
|
transition:
|
|
6645
6661
|
width var(--rn-duration) var(--rn-timing-function),
|
|
6646
6662
|
opacity var(--rn-duration) var(--rn-timing-function);
|
|
@@ -6665,9 +6681,14 @@ fieldset:disabled .m_8ee546b8,
|
|
|
6665
6681
|
}
|
|
6666
6682
|
|
|
6667
6683
|
.m_47d64bf5 {
|
|
6684
|
+
position: relative;
|
|
6685
|
+
z-index: 2;
|
|
6668
6686
|
display: inline-block;
|
|
6669
6687
|
overflow: hidden;
|
|
6670
6688
|
white-space: pre;
|
|
6689
|
+
pointer-events: none;
|
|
6690
|
+
user-select: none;
|
|
6691
|
+
-webkit-user-select: none;
|
|
6671
6692
|
transition: opacity var(--rn-duration) var(--rn-timing-function);
|
|
6672
6693
|
}
|
|
6673
6694
|
|
|
@@ -6715,6 +6736,10 @@ fieldset:disabled .m_8ee546b8,
|
|
|
6715
6736
|
position: fixed;
|
|
6716
6737
|
}
|
|
6717
6738
|
|
|
6739
|
+
.m_1b3c8819:where([data-interactive]) {
|
|
6740
|
+
pointer-events: auto;
|
|
6741
|
+
}
|
|
6742
|
+
|
|
6718
6743
|
.m_f898399f {
|
|
6719
6744
|
background-color: inherit;
|
|
6720
6745
|
border: 0;
|