@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.
- package/cjs/components/Cascader/Cascader.cjs +5 -1
- package/cjs/components/Cascader/Cascader.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/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/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/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/TreeSelect/TreeSelect.cjs +3 -0
- package/cjs/components/TreeSelect/TreeSelect.cjs.map +1 -1
- package/esm/components/Cascader/Cascader.mjs +5 -1
- package/esm/components/Cascader/Cascader.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/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/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/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/TreeSelect/TreeSelect.mjs +3 -0
- package/esm/components/TreeSelect/TreeSelect.mjs.map +1 -1
- 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/RollingNumber/RollingNumber.d.ts +1 -1
- package/package.json +2 -2
- package/styles/RollingNumber.css +21 -0
- package/styles/RollingNumber.layer.css +21 -0
- package/styles.css +21 -0
- package/styles.layer.css +21 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RollingNumber.module.cjs","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.cjs","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":""}
|
|
@@ -8,6 +8,8 @@ const require_get_options_lockup = require("../Combobox/get-options-lockup/get-o
|
|
|
8
8
|
const require_use_combobox = require("../Combobox/use-combobox/use-combobox.cjs");
|
|
9
9
|
const require_Combobox = require("../Combobox/Combobox.cjs");
|
|
10
10
|
const require_OptionsDropdown = require("../Combobox/OptionsDropdown/OptionsDropdown.cjs");
|
|
11
|
+
const require_is_external_input_change = require("../Combobox/is-external-input-change/is-external-input-change.cjs");
|
|
12
|
+
const require_get_option_by_label = require("../Combobox/get-options-lockup/get-option-by-label.cjs");
|
|
11
13
|
let react = require("react");
|
|
12
14
|
let _mantine_hooks = require("@mantine/hooks");
|
|
13
15
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -134,6 +136,16 @@ const Select = require_factory.genericFactory((_props) => {
|
|
|
134
136
|
readOnly: readOnly || !searchable,
|
|
135
137
|
value: search,
|
|
136
138
|
onChange: (event) => {
|
|
139
|
+
if (require_is_external_input_change.isExternalInputChange(event)) {
|
|
140
|
+
if (!readOnly) {
|
|
141
|
+
const externalOption = require_get_option_by_label.getOptionByLabel(optionsLockup, event.currentTarget.value);
|
|
142
|
+
if (externalOption && `${externalOption.value}` !== `${_value}`) {
|
|
143
|
+
setValue(externalOption.value, externalOption);
|
|
144
|
+
!controlled && handleSearchChange(externalOption.label);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
137
149
|
handleSearchChange(event.currentTarget.value);
|
|
138
150
|
combobox.openDropdown();
|
|
139
151
|
selectFirstOptionOnChange && combobox.selectFirstOption();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.cjs","names":["genericFactory","useProps","getParsedComboboxData","getOptionsLockup","useCombobox","useResolvedStylesApi","Combobox","InputBase","OptionsDropdown"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useId, usePrevious, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollAreaProps } from '../ScrollArea';\n\nexport type SelectStylesNames = __InputStylesNames | ComboboxLikeStylesNames;\n\nexport interface SelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<SelectFactory>,\n ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n /** Controlled component value */\n value?: Value | null;\n\n /** Uncontrolled component default value */\n defaultValue?: Value | null;\n\n /** Called when value changes */\n onChange?: (value: Value | null, option: ComboboxItem<Value>) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Determines whether the select should be searchable @default false */\n searchable?: 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 /** 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 @default true */\n allowDeselect?: boolean;\n\n /** Displays clear button in the right section when component has value @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 /** 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 /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron, by default depends on the color scheme */\n chevronColor?: MantineColor;\n\n /** Automatically selects the highlighted option when input loses focus @default false */\n autoSelectOnBlur?: boolean;\n\n /** Opens dropdown when input receives focus (requires searchable={true}) @default true */\n openOnFocus?: boolean;\n}\n\nexport type SelectFactory = Factory<{\n props: SelectProps;\n ref: HTMLInputElement;\n stylesNames: SelectStylesNames;\n variant: InputVariant;\n signature: <Value extends Primitive = string>(props: SelectProps<Value>) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n size: 'sm',\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n openOnFocus: true,\n} satisfies Partial<SelectProps>;\n\nexport const Select = genericFactory<SelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'Select'], defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownClose,\n onDropdownOpen,\n onFocus,\n onBlur,\n onClick,\n onChange,\n data,\n value,\n defaultValue,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n readOnly,\n disabled,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n floatingHeight,\n size,\n searchable,\n rightSection,\n checkIconPosition,\n withCheckIcon,\n withAlignedLabels,\n nothingFoundMessage,\n name,\n form,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n error,\n rightSectionPointerEvents,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n renderOption,\n onClear,\n autoComplete,\n scrollAreaProps,\n __defaultRightSection,\n __clearSection,\n __clearable,\n chevronColor,\n autoSelectOnBlur,\n openOnFocus,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n const _id = useId(id);\n\n const [_value, setValue, controlled] = useUncontrolled({\n value,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const selectedOption =\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]\n : undefined;\n const previousSelectedOption = usePrevious(selectedOption);\n\n const [search, setSearch, searchControlled] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: selectedOption ? selectedOption.label : '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n } else {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n // Required for autoSelectOnBlur to work correctly\n setTimeout(combobox.resetSelectedOption, 0);\n },\n });\n\n const handleSearchChange = (value: string) => {\n setSearch(value);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<SelectFactory>({\n props,\n styles,\n classNames,\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, search]);\n\n useEffect(() => {\n if (value === null) {\n handleSearchChange('');\n }\n\n if (\n value != null &&\n selectedOption &&\n (previousSelectedOption?.value !== selectedOption.value ||\n previousSelectedOption?.label !== selectedOption.label)\n ) {\n handleSearchChange(selectedOption.label);\n }\n }, [value, selectedOption]);\n\n useEffect(() => {\n if (!controlled && !searchControlled) {\n handleSearchChange(\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]?.label\n : retainedSelectedOptions.current[`${_value}`]?.label || ''\n : ''\n );\n }\n }, [optionsLockup, _value]);\n\n useEffect(() => {\n if (_value) {\n if (`${_value}` in optionsLockup) {\n retainedSelectedOptions.current[`${_value}`] = optionsLockup[`${_value}`];\n }\n }\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue(null, null);\n handleSearchChange('');\n onClear?.();\n }}\n />\n );\n\n const _clearable = clearable && _value != null && !disabled && !readOnly;\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Select\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n floatingHeight={floatingHeight}\n keepMounted={autoSelectOnBlur}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n const optionLockup = allowDeselect\n ? `${optionsLockup[val].value}` === `${_value}`\n ? null\n : optionsLockup[val]\n : optionsLockup[val];\n\n const nextValue = optionLockup ? optionLockup.value : null;\n\n nextValue !== _value && setValue(nextValue as any, optionLockup);\n !controlled && handleSearchChange(nextValue != null ? optionLockup?.label || '' : '');\n combobox.closeDropdown();\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n autoComplete={autoComplete}\n withExpandedAttribute\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 {...others}\n size={size}\n __staticSelector=\"Select\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={search}\n onChange={(event) => {\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n onFocus={(event) => {\n openOnFocus && !!searchable && combobox.openDropdown();\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (autoSelectOnBlur) {\n combobox.clickSelectedOption();\n }\n\n !!searchable && combobox.closeDropdown();\n const optionLockup =\n _value != null &&\n (`${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]);\n handleSearchChange(optionLockup ? optionLockup.label || '' : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\n onClick?.(event);\n }}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n attributes={attributes}\n />\n </Combobox.Target>\n <OptionsDropdown\n data={parsedData as any}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={search}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={!!searchable && selectedOption?.label !== search}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={others.label ? `${_id}-label` : undefined}\n aria-label={others.label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n value={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nSelect.displayName = '@mantine/core/Select';\n\nexport namespace Select {\n export type Props<Value extends Primitive = string> = SelectProps<Value>;\n export type StylesNames = SelectStylesNames;\n export type Factory = SelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;AAuHA,MAAM,eAAe;CACnB,MAAM;CACN,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;AACf;AAEA,MAAa,SAASA,gBAAAA,gBAA+B,WAAW;CAC9D,MAAM,QAAQC,kBAAAA,SAAS;EAAC;EAAS;EAAgB;CAAQ,GAAG,cAAc,MAAM;CAChF,MAAM,EACJ,YACA,QACA,UACA,MACA,gBACA,uBACA,iBACA,gBACA,SACA,QACA,SACA,UACA,MACA,OACA,cACA,2BACA,iCACA,gBACA,eACA,UACA,UACA,QACA,OACA,gBACA,mBACA,gBACA,MACA,YACA,cACA,mBACA,eACA,mBACA,qBACA,MACA,MACA,aACA,oBACA,gBACA,eACA,OACA,2BACA,IACA,WACA,kBACA,kBACA,kBACA,cACA,SACA,cACA,iBACA,uBACA,gBACA,aACA,cACA,kBACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,cAAA,GAAA,MAAA,QAAA,OAA2BC,iCAAAA,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;CACpE,MAAM,2BAAA,GAAA,MAAA,OAAA,CAA0E,CAAC,CAAC;CAClF,MAAM,iBAAA,GAAA,MAAA,QAAA,OAA8BC,2BAAAA,iBAAiB,UAAU,GAAG,CAAC,UAAU,CAAC;CAC9E,MAAM,OAAA,GAAA,eAAA,MAAA,CAAY,EAAE;CAEpB,MAAM,CAAC,QAAQ,UAAU,eAAA,GAAA,eAAA,gBAAA,CAA8B;EACrD;EACA;EACA,YAAY;EACZ;CACF,CAAC;CA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1
|
+
{"version":3,"file":"Select.cjs","names":["genericFactory","useProps","getParsedComboboxData","getOptionsLockup","useCombobox","useResolvedStylesApi","Combobox","InputBase","isExternalInputChange","getOptionByLabel","OptionsDropdown"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useId, usePrevious, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { getOptionByLabel } from '../Combobox/get-options-lockup/get-option-by-label';\nimport { isExternalInputChange } from '../Combobox/is-external-input-change/is-external-input-change';\nimport { InputBase } from '../InputBase';\nimport { ScrollAreaProps } from '../ScrollArea';\n\nexport type SelectStylesNames = __InputStylesNames | ComboboxLikeStylesNames;\n\nexport interface SelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<SelectFactory>,\n ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n /** Controlled component value */\n value?: Value | null;\n\n /** Uncontrolled component default value */\n defaultValue?: Value | null;\n\n /** Called when value changes */\n onChange?: (value: Value | null, option: ComboboxItem<Value>) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Determines whether the select should be searchable @default false */\n searchable?: 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 /** 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 @default true */\n allowDeselect?: boolean;\n\n /** Displays clear button in the right section when component has value @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 /** 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 /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron, by default depends on the color scheme */\n chevronColor?: MantineColor;\n\n /** Automatically selects the highlighted option when input loses focus @default false */\n autoSelectOnBlur?: boolean;\n\n /** Opens dropdown when input receives focus (requires searchable={true}) @default true */\n openOnFocus?: boolean;\n}\n\nexport type SelectFactory = Factory<{\n props: SelectProps;\n ref: HTMLInputElement;\n stylesNames: SelectStylesNames;\n variant: InputVariant;\n signature: <Value extends Primitive = string>(props: SelectProps<Value>) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n size: 'sm',\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n openOnFocus: true,\n} satisfies Partial<SelectProps>;\n\nexport const Select = genericFactory<SelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'Select'], defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownClose,\n onDropdownOpen,\n onFocus,\n onBlur,\n onClick,\n onChange,\n data,\n value,\n defaultValue,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n readOnly,\n disabled,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n floatingHeight,\n size,\n searchable,\n rightSection,\n checkIconPosition,\n withCheckIcon,\n withAlignedLabels,\n nothingFoundMessage,\n name,\n form,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n error,\n rightSectionPointerEvents,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n renderOption,\n onClear,\n autoComplete,\n scrollAreaProps,\n __defaultRightSection,\n __clearSection,\n __clearable,\n chevronColor,\n autoSelectOnBlur,\n openOnFocus,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n const _id = useId(id);\n\n const [_value, setValue, controlled] = useUncontrolled({\n value,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const selectedOption =\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]\n : undefined;\n const previousSelectedOption = usePrevious(selectedOption);\n\n const [search, setSearch, searchControlled] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: selectedOption ? selectedOption.label : '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n } else {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n // Required for autoSelectOnBlur to work correctly\n setTimeout(combobox.resetSelectedOption, 0);\n },\n });\n\n const handleSearchChange = (value: string) => {\n setSearch(value);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<SelectFactory>({\n props,\n styles,\n classNames,\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, search]);\n\n useEffect(() => {\n if (value === null) {\n handleSearchChange('');\n }\n\n if (\n value != null &&\n selectedOption &&\n (previousSelectedOption?.value !== selectedOption.value ||\n previousSelectedOption?.label !== selectedOption.label)\n ) {\n handleSearchChange(selectedOption.label);\n }\n }, [value, selectedOption]);\n\n useEffect(() => {\n if (!controlled && !searchControlled) {\n handleSearchChange(\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]?.label\n : retainedSelectedOptions.current[`${_value}`]?.label || ''\n : ''\n );\n }\n }, [optionsLockup, _value]);\n\n useEffect(() => {\n if (_value) {\n if (`${_value}` in optionsLockup) {\n retainedSelectedOptions.current[`${_value}`] = optionsLockup[`${_value}`];\n }\n }\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue(null, null);\n handleSearchChange('');\n onClear?.();\n }}\n />\n );\n\n const _clearable = clearable && _value != null && !disabled && !readOnly;\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Select\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n floatingHeight={floatingHeight}\n keepMounted={autoSelectOnBlur}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n const optionLockup = allowDeselect\n ? `${optionsLockup[val].value}` === `${_value}`\n ? null\n : optionsLockup[val]\n : optionsLockup[val];\n\n const nextValue = optionLockup ? optionLockup.value : null;\n\n nextValue !== _value && setValue(nextValue as any, optionLockup);\n !controlled && handleSearchChange(nextValue != null ? optionLockup?.label || '' : '');\n combobox.closeDropdown();\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n autoComplete={autoComplete}\n withExpandedAttribute\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 {...others}\n size={size}\n __staticSelector=\"Select\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={search}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n if (!readOnly) {\n const externalOption = getOptionByLabel(optionsLockup, event.currentTarget.value);\n\n if (externalOption && `${externalOption.value}` !== `${_value}`) {\n setValue(externalOption.value as any, externalOption);\n !controlled && handleSearchChange(externalOption.label);\n }\n }\n\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n onFocus={(event) => {\n openOnFocus && !!searchable && combobox.openDropdown();\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (autoSelectOnBlur) {\n combobox.clickSelectedOption();\n }\n\n !!searchable && combobox.closeDropdown();\n const optionLockup =\n _value != null &&\n (`${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]);\n handleSearchChange(optionLockup ? optionLockup.label || '' : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\n onClick?.(event);\n }}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n attributes={attributes}\n />\n </Combobox.Target>\n <OptionsDropdown\n data={parsedData as any}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={search}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={!!searchable && selectedOption?.label !== search}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={others.label ? `${_id}-label` : undefined}\n aria-label={others.label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n value={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nSelect.displayName = '@mantine/core/Select';\n\nexport namespace Select {\n export type Props<Value extends Primitive = string> = SelectProps<Value>;\n export type StylesNames = SelectStylesNames;\n export type Factory = SelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyHA,MAAM,eAAe;CACnB,MAAM;CACN,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;AACf;AAEA,MAAa,SAASA,gBAAAA,gBAA+B,WAAW;CAC9D,MAAM,QAAQC,kBAAAA,SAAS;EAAC;EAAS;EAAgB;CAAQ,GAAG,cAAc,MAAM;CAChF,MAAM,EACJ,YACA,QACA,UACA,MACA,gBACA,uBACA,iBACA,gBACA,SACA,QACA,SACA,UACA,MACA,OACA,cACA,2BACA,iCACA,gBACA,eACA,UACA,UACA,QACA,OACA,gBACA,mBACA,gBACA,MACA,YACA,cACA,mBACA,eACA,mBACA,qBACA,MACA,MACA,aACA,oBACA,gBACA,eACA,OACA,2BACA,IACA,WACA,kBACA,kBACA,kBACA,cACA,SACA,cACA,iBACA,uBACA,gBACA,aACA,cACA,kBACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,cAAA,GAAA,MAAA,QAAA,OAA2BC,iCAAAA,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;CACpE,MAAM,2BAAA,GAAA,MAAA,OAAA,CAA0E,CAAC,CAAC;CAClF,MAAM,iBAAA,GAAA,MAAA,QAAA,OAA8BC,2BAAAA,iB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AAiB,CAAC;GACF;GACG;GACnB,eAAe,CAAC,CAAC,cAAc,gBAAgB,UAAU;GACzD,OAAO;GACY;GACJ;GACI;GACE;GACX;GACV,SAAS,OAAO,QAAQ,GAAG,IAAI,UAAU,KAAA;GACzC,cAAY,OAAO,QAAQ,KAAA,IAAY,OAAO;GAChC;GACG;EAClB,CAAA,CACO;KACV,iBAAA,GAAA,kBAAA,IAAA,CAACJ,iBAAAA,SAAS,aAAV;EACE,OAAO;EACD;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,OAAO,UAAU;CAAE,GAAGC,kBAAAA,UAAU;CAAS,GAAGD,iBAAAA,SAAS;AAAQ;AAC7D,OAAO,cAAc"}
|
|
@@ -11,6 +11,7 @@ const require_use_combobox = require("../Combobox/use-combobox/use-combobox.cjs"
|
|
|
11
11
|
const require_Combobox = require("../Combobox/Combobox.cjs");
|
|
12
12
|
const require_OptionsDropdown = require("../Combobox/OptionsDropdown/OptionsDropdown.cjs");
|
|
13
13
|
const require_use_pills_reorder = require("../Combobox/use-pills-reorder/use-pills-reorder.cjs");
|
|
14
|
+
const require_is_external_input_change = require("../Combobox/is-external-input-change/is-external-input-change.cjs");
|
|
14
15
|
const require_Pill = require("../Pill/Pill.cjs");
|
|
15
16
|
const require_PillsInput = require("../PillsInput/PillsInput.cjs");
|
|
16
17
|
const require_filter_picked_tags = require("./filter-picked-tags.cjs");
|
|
@@ -285,7 +286,10 @@ const TagsInput = require_factory.factory((_props) => {
|
|
|
285
286
|
},
|
|
286
287
|
onPaste: handlePaste,
|
|
287
288
|
value: _searchValue,
|
|
288
|
-
onChange: (event) =>
|
|
289
|
+
onChange: (event) => {
|
|
290
|
+
if (require_is_external_input_change.isExternalInputChange(event)) return;
|
|
291
|
+
handleSearchChange(event.currentTarget.value);
|
|
292
|
+
},
|
|
289
293
|
required: required && _value.length === 0,
|
|
290
294
|
disabled,
|
|
291
295
|
readOnly,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsInput.cjs","names":["factory","useProps","getParsedComboboxData","getOptionsLockup","useCombobox","extractStyleProps","usePillsReorder","useStyles","useResolvedStylesApi","getSplittedTags","Fragment","Pill","Combobox","PillsInput","OptionsDropdown","filterPickedTags","InputBase"],"sources":["../../../src/components/TagsInput/TagsInput.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef } from 'react';\nimport { useId, useMergedRef, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport {\n Combobox,\n ComboboxGenericData,\n ComboboxGenericItem,\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 { filterPickedTags } from './filter-picked-tags';\nimport { getSplittedTags } from './get-splitted-tags';\n\nexport type TagsInputStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'pill'\n | 'pillsList'\n | 'inputField';\n\nexport interface TagsInputProps\n extends\n BoxProps,\n __BaseInputProps,\n Omit<ComboboxLikeProps, 'data'>,\n StylesApiProps<TagsInputFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Data displayed in the dropdown. Values must be unique. */\n data?: ComboboxGenericData;\n\n /** Controlled component value */\n value?: string[];\n\n /** Uncontrolled component default value */\n defaultValue?: string[];\n\n /** Called when value changes */\n onChange?: (value: string[]) => void;\n\n /** Called when tag is removed */\n onRemove?: (value: string) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => 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 tags @default Infinity */\n maxTags?: number;\n\n /** Called when user tries to add more tags than maxTags */\n onMaxTags?: (value: string) => void;\n\n /** If set, duplicate tags are allowed @default false */\n allowDuplicates?: boolean;\n\n /** Called when user tries to submit a duplicated tag */\n onDuplicate?: (value: string) => void;\n\n /** Characters that should trigger tags split, `[',']` by default */\n splitChars?: string[];\n\n /** If set, the clear button is displayed in the right section when the component has value @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?: (input: ComboboxLikeRenderOptionInput<ComboboxGenericItem>) => React.ReactNode;\n\n /** A function to render content of the pill, replaces the default content of the pill */\n renderPill?: (props: ComboboxRenderPillInput) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** If set, the value typed in by the user but not submitted is accepted when the input is blurred @default true */\n acceptValueOnBlur?: boolean;\n\n /** Custom function to determine if a tag is duplicate. Accepts tag value and array of current values. By default, checks if the tag exists case-insensitively. */\n isDuplicate?: (value: string, currentValues: string[]) => boolean;\n\n /** If set, the dropdown opens when the input receives focus @default true */\n openOnFocus?: boolean;\n\n /** If set, tags can be reordered by dragging pills. Disabled when `disabled` or `readOnly` is set. @default false */\n withPillsReorder?: boolean;\n}\n\nexport type TagsInputFactory = Factory<{\n props: TagsInputProps;\n ref: HTMLInputElement;\n stylesNames: TagsInputStylesNames;\n}>;\n\nconst defaultProps = {\n maxTags: Infinity,\n acceptValueOnBlur: true,\n splitChars: [','],\n hiddenInputValuesDivider: ',',\n openOnFocus: true,\n size: 'sm',\n} satisfies Partial<TagsInputProps>;\n\nexport const TagsInput = factory<TagsInputFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'TagsInput'], 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 maxTags,\n allowDuplicates,\n onDuplicate,\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 splitChars,\n onFocus,\n onBlur,\n onPaste,\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 required,\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 clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n hiddenInputValuesDivider,\n mod,\n renderOption,\n renderPill,\n onRemove,\n onClear,\n onMaxTags,\n scrollAreaProps,\n acceptValueOnBlur,\n isDuplicate,\n openOnFocus,\n attributes,\n ref,\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 inputRef = useRef<HTMLInputElement>(null);\n const _ref = useMergedRef(inputRef, ref);\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<TagsInputFactory>({\n name: 'TagsInput',\n classes: {} as any,\n props: props as any,\n classNames,\n styles,\n unstyled,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<TagsInputFactory>({\n props,\n styles,\n classNames,\n });\n\n const handleValueSelect = (val: string) => {\n const isDuplicated = isDuplicate\n ? isDuplicate(val, _value)\n : _value.some((tag) => tag.toLowerCase() === val.toLowerCase());\n\n if (isDuplicated) {\n onDuplicate?.(val);\n if (!allowDuplicates) {\n handleSearchChange('');\n return;\n }\n }\n\n if (_value.length >= maxTags) {\n onMaxTags?.(val);\n return;\n }\n\n onOptionSubmit?.(val);\n handleSearchChange('');\n if (val.length > 0) {\n setValue([..._value, val]);\n }\n };\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.defaultPrevented || event.isPropagationStopped()) {\n return;\n }\n\n const inputValue = _searchValue.trim();\n const { length } = inputValue;\n\n if (splitChars.includes(event.key) && length > 0) {\n setValue(\n getSplittedTags({\n splitChars,\n allowDuplicates,\n maxTags,\n value: _searchValue,\n currentTags: _value,\n isDuplicate,\n onDuplicate,\n })\n );\n handleSearchChange('');\n event.preventDefault();\n }\n\n if (event.key === 'Enter' && length > 0 && !event.nativeEvent.isComposing) {\n event.preventDefault();\n\n const hasActiveSelection = !!document.querySelector<HTMLDivElement>(\n `#${combobox.listId} [data-combobox-option][data-combobox-selected]`\n );\n\n if (hasActiveSelection) {\n return;\n }\n\n handleValueSelect(inputValue);\n }\n\n if (\n event.key === 'Backspace' &&\n length === 0 &&\n _value.length > 0 &&\n !event.nativeEvent.isComposing &&\n !readOnly\n ) {\n onRemove?.(_value[_value.length - 1]);\n setValue(_value.slice(0, _value.length - 1));\n }\n\n handleInputKeyDown(event);\n };\n\n const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {\n onPaste?.(event);\n event.preventDefault();\n\n if (event.clipboardData) {\n const pastedText = event.clipboardData.getData('text/plain');\n setValue(\n getSplittedTags({\n splitChars,\n allowDuplicates,\n maxTags,\n value: `${_searchValue}${pastedText}`,\n currentTags: _value,\n isDuplicate,\n onDuplicate,\n })\n );\n handleSearchChange('');\n }\n };\n\n const values = _value.map((item, index) => {\n const onRemoveItem = () => {\n const next_value = _value.slice();\n next_value.splice(index, 1);\n setValue(next_value);\n onRemove?.(item);\n };\n\n const reorderProps = getPillProps(index);\n\n if (renderPill) {\n return (\n <Fragment key={`${item}-${index}`}>\n {renderPill({\n option: optionsLockup[item] || { value: item, label: item, disabled: false },\n value: item,\n onRemove: onRemoveItem,\n disabled: disabled || readOnly,\n reorderProps,\n })}\n </Fragment>\n );\n }\n\n return (\n <Pill\n key={`${item}-${index}`}\n withRemoveButton={!readOnly}\n onRemove={onRemoveItem}\n unstyled={unstyled}\n disabled={disabled}\n attributes={attributes}\n {...getStyles('pill')}\n {...reorderProps}\n >\n {item}\n </Pill>\n );\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, _value, _searchValue]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue([]);\n handleSearchChange('');\n inputRef.current?.focus();\n combobox.openDropdown();\n onClear?.();\n }}\n />\n );\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=\"TagsInput\"\n attributes={attributes}\n floatingHeight={floatingHeight}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val);\n handleSearchChange('');\n\n if (_value.length >= maxTags) {\n onMaxTags?.(val);\n } else {\n setValue([..._value, optionsLockup[val].value]);\n }\n\n combobox.resetSelectedOption();\n }}\n {...comboboxProps}\n >\n <Combobox.DropdownTarget>\n <PillsInput\n {...styleProps}\n __staticSelector=\"TagsInput\"\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 rightSection={rightSection}\n __clearSection={clearButton}\n __clearable={clearable && _value.length > 0 && !disabled && !readOnly}\n __clearSectionMode={clearSectionMode}\n rightSectionWidth={rightSectionWidth}\n rightSectionPointerEvents={rightSectionPointerEvents}\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 required={required}\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={{ ...props, multiline: true }}\n id={_id}\n mod={mod}\n attributes={attributes}\n >\n <Pill.Group\n disabled={disabled}\n unstyled={unstyled}\n {...getStyles('pillsList')}\n {...getListProps()}\n >\n {values}\n <Combobox.EventsTarget autoComplete={autoComplete} withExpandedAttribute>\n <PillsInput.Field\n {...rest}\n ref={_ref}\n {...getStyles('inputField')}\n unstyled={unstyled}\n onKeyDown={handleInputKeydown}\n onFocus={(event) => {\n onFocus?.(event);\n openOnFocus && combobox.openDropdown();\n }}\n onBlur={(event) => {\n onBlur?.(event);\n acceptValueOnBlur && handleValueSelect(_searchValue);\n combobox.closeDropdown();\n }}\n onPaste={handlePaste}\n value={_searchValue}\n onChange={(event) => handleSearchChange(event.currentTarget.value)}\n required={required && _value.length === 0}\n disabled={disabled}\n readOnly={readOnly}\n id={_id}\n />\n </Combobox.EventsTarget>\n </Pill.Group>\n </PillsInput>\n </Combobox.DropdownTarget>\n\n <OptionsDropdown\n data={filterPickedTags({ data: parsedData, value: _value })}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={_searchValue}\n limit={limit}\n hiddenWhenEmpty\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\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 form={form}\n value={_value}\n valuesDivider={hiddenInputValuesDivider}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nTagsInput.classes = { ...InputBase.classes, ...Combobox.classes };\nTagsInput.displayName = '@mantine/core/TagsInput';\n\nexport namespace TagsInput {\n export type Props = TagsInputProps;\n export type StylesNames = TagsInputStylesNames;\n export type Factory = TagsInputFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6IA,MAAM,eAAe;CACnB,SAAS;CACT,mBAAmB;CACnB,YAAY,CAAC,GAAG;CAChB,0BAA0B;CAC1B,aAAa;CACb,MAAM;AACR;AAEA,MAAa,YAAYA,gBAAAA,SAA2B,WAAW;CAC7D,MAAM,QAAQC,kBAAAA,SAAS;EAAC;EAAS;EAAgB;CAAW,GAAG,cAAc,MAAM;CACnF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,OACA,cACA,UACA,WACA,SACA,iBACA,aACA,SACA,MACA,gBACA,uBACA,gBACA,iBACA,2BACA,iCACA,gBACA,eACA,QACA,OACA,gBACA,mBACA,gBACA,aACA,oBACA,gBACA,UACA,UACA,YACA,SACA,QACA,SACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,UACA,YACA,kBACA,YACA,cACA,cACA,aACA,OACA,OACA,SACA,iBACA,mBACA,MACA,MACA,IACA,WACA,kBACA,kBACA,kBACA,0BACA,KACA,cACA,YACA,UACA,SACA,WACA,iBACA,mBACA,aACA,aACA,YACA,KACA,SACA,iBACA,kBACA,GAAG,WACD;CAEJ,MAAM,OAAA,GAAA,eAAA,MAAA,CAAY,EAAE;CACpB,MAAM,aAAaC,iCAAAA,sBAAsB,IAAI;CAC7C,MAAM,gBAAgBC,2BAAAA,iBAAiB,UAAU;CACjD,MAAM,YAAA,GAAA,MAAA,OAAA,CAAoC,IAAI;CAC9C,MAAM,QAAA,GAAA,eAAA,aAAA,CAAoB,UAAU,GAAG;CAEvC,MAAM,WAAWC,qBAAAA,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,WAC7BC,4BAAAA,kBAAkB,MAAM;CAE5B,MAAM,CAAC,QAAQ,aAAA,GAAA,eAAA,gBAAA,CAA4B;EACzC;EACA;EACA,YAAY,CAAC;EACb;CACF,CAAC;CAED,MAAM,EAAE,cAAc,cAAc,uBAAuBC,0BAAAA,gBAAgB;EACzE,OAAO;EACP,UAAU;E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AN;IACY;IACA;IACV,GAAI,UAAU,WAAW;IACzB,GAAI,aAAa;cAJnB,CAMG,QACD,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,SAAS,cAAV;KAAqC;KAAc,uBAAA;eACjD,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,WAAW,OAAZ;MACE,GAAI;MACJ,KAAK;MACL,GAAI,UAAU,YAAY;MAChB;MACV,WAAW;MACX,UAAU,UAAU;OAClB,UAAU,KAAK;OACf,eAAe,SAAS,aAAa;MACvC;MACA,SAAS,UAAU;OACjB,SAAS,KAAK;OACd,qBAAqB,kBAAkB,YAAY;OACnD,SAAS,cAAc;MACzB;MACA,SAAS;MACT,OAAO;MACP,WAAW,UAAU,mBAAmB,MAAM,cAAc,KAAK;MACjE,UAAU,YAAY,OAAO,WAAW;MAC9B;MACA;MACV,IAAI;KACL,CAAA;IACoB,CAAA,CACb;;EACF,CAAA,EACW,CAAA,GAEzB,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,iBAAD;GACE,MAAMC,2BAAAA,iBAAiB;IAAE,MAAM;IAAY,OAAO;GAAO,CAAC;GAC1D,QAAQ,YAAY;GACZ;GACR,QAAQ;GACD;GACP,iBAAA;GACgB;GACG;GACT;GACV,SAAS,QAAQ,GAAG,IAAI,UAAU,KAAA;GAClC,cAAY,QAAQ,KAAA,IAAY,OAAO;GACzB;GACG;EAClB,CAAA,CACO;KACV,iBAAA,GAAA,kBAAA,IAAA,CAACH,iBAAAA,SAAS,aAAV;EACQ;EACA;EACN,OAAO;EACP,eAAe;EACL;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,UAAU,UAAU;CAAE,GAAGI,kBAAAA,UAAU;CAAS,GAAGJ,iBAAAA,SAAS;AAAQ;AAChE,UAAU,cAAc"}
|
|
1
|
+
{"version":3,"file":"TagsInput.cjs","names":["factory","useProps","getParsedComboboxData","getOptionsLockup","useCombobox","extractStyleProps","usePillsReorder","useStyles","useResolvedStylesApi","getSplittedTags","Fragment","Pill","Combobox","PillsInput","isExternalInputChange","OptionsDropdown","filterPickedTags","InputBase"],"sources":["../../../src/components/TagsInput/TagsInput.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef } from 'react';\nimport { useId, useMergedRef, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '../../core';\nimport {\n Combobox,\n ComboboxGenericData,\n ComboboxGenericItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n ComboboxRenderPillInput,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n usePillsReorder,\n} from '../Combobox';\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 { filterPickedTags } from './filter-picked-tags';\nimport { getSplittedTags } from './get-splitted-tags';\n\nexport type TagsInputStylesNames =\n | __InputStylesNames\n | ComboboxLikeStylesNames\n | 'pill'\n | 'pillsList'\n | 'inputField';\n\nexport interface TagsInputProps\n extends\n BoxProps,\n __BaseInputProps,\n Omit<ComboboxLikeProps, 'data'>,\n StylesApiProps<TagsInputFactory>,\n ElementProps<'input', 'size' | 'value' | 'defaultValue' | 'onChange'> {\n /** Data displayed in the dropdown. Values must be unique. */\n data?: ComboboxGenericData;\n\n /** Controlled component value */\n value?: string[];\n\n /** Uncontrolled component default value */\n defaultValue?: string[];\n\n /** Called when value changes */\n onChange?: (value: string[]) => void;\n\n /** Called when tag is removed */\n onRemove?: (value: string) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => 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 tags @default Infinity */\n maxTags?: number;\n\n /** Called when user tries to add more tags than maxTags */\n onMaxTags?: (value: string) => void;\n\n /** If set, duplicate tags are allowed @default false */\n allowDuplicates?: boolean;\n\n /** Called when user tries to submit a duplicated tag */\n onDuplicate?: (value: string) => void;\n\n /** Characters that should trigger tags split, `[',']` by default */\n splitChars?: string[];\n\n /** If set, the clear button is displayed in the right section when the component has value @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?: (input: ComboboxLikeRenderOptionInput<ComboboxGenericItem>) => React.ReactNode;\n\n /** A function to render content of the pill, replaces the default content of the pill */\n renderPill?: (props: ComboboxRenderPillInput) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** If set, the value typed in by the user but not submitted is accepted when the input is blurred @default true */\n acceptValueOnBlur?: boolean;\n\n /** Custom function to determine if a tag is duplicate. Accepts tag value and array of current values. By default, checks if the tag exists case-insensitively. */\n isDuplicate?: (value: string, currentValues: string[]) => boolean;\n\n /** If set, the dropdown opens when the input receives focus @default true */\n openOnFocus?: boolean;\n\n /** If set, tags can be reordered by dragging pills. Disabled when `disabled` or `readOnly` is set. @default false */\n withPillsReorder?: boolean;\n}\n\nexport type TagsInputFactory = Factory<{\n props: TagsInputProps;\n ref: HTMLInputElement;\n stylesNames: TagsInputStylesNames;\n}>;\n\nconst defaultProps = {\n maxTags: Infinity,\n acceptValueOnBlur: true,\n splitChars: [','],\n hiddenInputValuesDivider: ',',\n openOnFocus: true,\n size: 'sm',\n} satisfies Partial<TagsInputProps>;\n\nexport const TagsInput = factory<TagsInputFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'TagsInput'], 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 maxTags,\n allowDuplicates,\n onDuplicate,\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 splitChars,\n onFocus,\n onBlur,\n onPaste,\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 required,\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 clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n hiddenInputValuesDivider,\n mod,\n renderOption,\n renderPill,\n onRemove,\n onClear,\n onMaxTags,\n scrollAreaProps,\n acceptValueOnBlur,\n isDuplicate,\n openOnFocus,\n attributes,\n ref,\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 inputRef = useRef<HTMLInputElement>(null);\n const _ref = useMergedRef(inputRef, ref);\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<TagsInputFactory>({\n name: 'TagsInput',\n classes: {} as any,\n props: props as any,\n classNames,\n styles,\n unstyled,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<TagsInputFactory>({\n props,\n styles,\n classNames,\n });\n\n const handleValueSelect = (val: string) => {\n const isDuplicated = isDuplicate\n ? isDuplicate(val, _value)\n : _value.some((tag) => tag.toLowerCase() === val.toLowerCase());\n\n if (isDuplicated) {\n onDuplicate?.(val);\n if (!allowDuplicates) {\n handleSearchChange('');\n return;\n }\n }\n\n if (_value.length >= maxTags) {\n onMaxTags?.(val);\n return;\n }\n\n onOptionSubmit?.(val);\n handleSearchChange('');\n if (val.length > 0) {\n setValue([..._value, val]);\n }\n };\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (event.defaultPrevented || event.isPropagationStopped()) {\n return;\n }\n\n const inputValue = _searchValue.trim();\n const { length } = inputValue;\n\n if (splitChars.includes(event.key) && length > 0) {\n setValue(\n getSplittedTags({\n splitChars,\n allowDuplicates,\n maxTags,\n value: _searchValue,\n currentTags: _value,\n isDuplicate,\n onDuplicate,\n })\n );\n handleSearchChange('');\n event.preventDefault();\n }\n\n if (event.key === 'Enter' && length > 0 && !event.nativeEvent.isComposing) {\n event.preventDefault();\n\n const hasActiveSelection = !!document.querySelector<HTMLDivElement>(\n `#${combobox.listId} [data-combobox-option][data-combobox-selected]`\n );\n\n if (hasActiveSelection) {\n return;\n }\n\n handleValueSelect(inputValue);\n }\n\n if (\n event.key === 'Backspace' &&\n length === 0 &&\n _value.length > 0 &&\n !event.nativeEvent.isComposing &&\n !readOnly\n ) {\n onRemove?.(_value[_value.length - 1]);\n setValue(_value.slice(0, _value.length - 1));\n }\n\n handleInputKeyDown(event);\n };\n\n const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {\n onPaste?.(event);\n event.preventDefault();\n\n if (event.clipboardData) {\n const pastedText = event.clipboardData.getData('text/plain');\n setValue(\n getSplittedTags({\n splitChars,\n allowDuplicates,\n maxTags,\n value: `${_searchValue}${pastedText}`,\n currentTags: _value,\n isDuplicate,\n onDuplicate,\n })\n );\n handleSearchChange('');\n }\n };\n\n const values = _value.map((item, index) => {\n const onRemoveItem = () => {\n const next_value = _value.slice();\n next_value.splice(index, 1);\n setValue(next_value);\n onRemove?.(item);\n };\n\n const reorderProps = getPillProps(index);\n\n if (renderPill) {\n return (\n <Fragment key={`${item}-${index}`}>\n {renderPill({\n option: optionsLockup[item] || { value: item, label: item, disabled: false },\n value: item,\n onRemove: onRemoveItem,\n disabled: disabled || readOnly,\n reorderProps,\n })}\n </Fragment>\n );\n }\n\n return (\n <Pill\n key={`${item}-${index}`}\n withRemoveButton={!readOnly}\n onRemove={onRemoveItem}\n unstyled={unstyled}\n disabled={disabled}\n attributes={attributes}\n {...getStyles('pill')}\n {...reorderProps}\n >\n {item}\n </Pill>\n );\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, _value, _searchValue]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue([]);\n handleSearchChange('');\n inputRef.current?.focus();\n combobox.openDropdown();\n onClear?.();\n }}\n />\n );\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=\"TagsInput\"\n attributes={attributes}\n floatingHeight={floatingHeight}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val);\n handleSearchChange('');\n\n if (_value.length >= maxTags) {\n onMaxTags?.(val);\n } else {\n setValue([..._value, optionsLockup[val].value]);\n }\n\n combobox.resetSelectedOption();\n }}\n {...comboboxProps}\n >\n <Combobox.DropdownTarget>\n <PillsInput\n {...styleProps}\n __staticSelector=\"TagsInput\"\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 rightSection={rightSection}\n __clearSection={clearButton}\n __clearable={clearable && _value.length > 0 && !disabled && !readOnly}\n __clearSectionMode={clearSectionMode}\n rightSectionWidth={rightSectionWidth}\n rightSectionPointerEvents={rightSectionPointerEvents}\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 required={required}\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={{ ...props, multiline: true }}\n id={_id}\n mod={mod}\n attributes={attributes}\n >\n <Pill.Group\n disabled={disabled}\n unstyled={unstyled}\n {...getStyles('pillsList')}\n {...getListProps()}\n >\n {values}\n <Combobox.EventsTarget autoComplete={autoComplete} withExpandedAttribute>\n <PillsInput.Field\n {...rest}\n ref={_ref}\n {...getStyles('inputField')}\n unstyled={unstyled}\n onKeyDown={handleInputKeydown}\n onFocus={(event) => {\n onFocus?.(event);\n openOnFocus && combobox.openDropdown();\n }}\n onBlur={(event) => {\n onBlur?.(event);\n acceptValueOnBlur && handleValueSelect(_searchValue);\n combobox.closeDropdown();\n }}\n onPaste={handlePaste}\n value={_searchValue}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n }}\n required={required && _value.length === 0}\n disabled={disabled}\n readOnly={readOnly}\n id={_id}\n />\n </Combobox.EventsTarget>\n </Pill.Group>\n </PillsInput>\n </Combobox.DropdownTarget>\n\n <OptionsDropdown\n data={filterPickedTags({ data: parsedData, value: _value })}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={_searchValue}\n limit={limit}\n hiddenWhenEmpty\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\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 form={form}\n value={_value}\n valuesDivider={hiddenInputValuesDivider}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nTagsInput.classes = { ...InputBase.classes, ...Combobox.classes };\nTagsInput.displayName = '@mantine/core/TagsInput';\n\nexport namespace TagsInput {\n export type Props = TagsInputProps;\n export type StylesNames = TagsInputStylesNames;\n export type Factory = TagsInputFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8IA,MAAM,eAAe;CACnB,SAAS;CACT,mBAAmB;CACnB,YAAY,CAAC,GAAG;CAChB,0BAA0B;CAC1B,aAAa;CACb,MAAM;AACR;AAEA,MAAa,YAAYA,gBAAAA,SAA2B,WAAW;CAC7D,MAAM,QAAQC,kBAAAA,SAAS;EAAC;EAAS;EAAgB;CAAW,GAAG,cAAc,MAAM;CACnF,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,OACA,cACA,UACA,WACA,SACA,iBACA,aACA,SACA,MACA,gBACA,uBACA,gBACA,iBACA,2BACA,iCACA,gBACA,eACA,QACA,OACA,gBACA,mBACA,gBACA,aACA,oBACA,gBACA,UACA,UACA,YACA,SACA,QACA,SACA,QACA,cACA,mBACA,2BACA,mBACA,aACA,kBACA,0BACA,kBACA,gBACA,mBACA,cACA,UACA,YACA,kBACA,YACA,cACA,cACA,aACA,OACA,OACA,SACA,iBACA,mBACA,MACA,MACA,IACA,WACA,kBACA,kBACA,kBACA,0BACA,KACA,cACA,YACA,UACA,SACA,WACA,iBACA,mBACA,aACA,aACA,YACA,KACA,SACA,iBACA,kBACA,GAAG,WACD;CAEJ,MAAM,OAAA,GAAA,eAAA,MAAA,CAAY,EAAE;CACpB,MAAM,aAAaC,iCAAAA,sBAAsB,IAAI;CAC7C,MAAM,gBAAgBC,2BAAAA,iBAAiB,UAAU;CACjD,MAAM,YAAA,GAAA,MAAA,OAAA,CAAoC,IAAI;CAC9C,MAAM,QAAA,GAAA,eAAA,aAAA,CAAoB,UAAU,GAAG;CAEvC,MAAM,WAAWC,qBAAAA,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,WAC7BC,4BAAAA,kBAAkB,MAAM;CAE5B,MAAM,CAAC,QAAQ,aAAA,GAAA,eAAA,gBAAA,CAA4B;EACzC;EACA;EACA,YAAY,CAAC;EACb;CACF,CAAC;CAED,MAAM,EAAE,cAAc,cAAc,uBAAuBC,0BAAAA,gBAAgB;EACzE,OAAO;EACP,UAAU;EACV,SA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
|
|
|
75
75
|
...require_get_style_object.getStyleObject(style, theme),
|
|
76
76
|
zIndex,
|
|
77
77
|
display: !disabled && opened ? "block" : "none",
|
|
78
|
-
top: (y
|
|
79
|
-
left: (x
|
|
78
|
+
top: Number.isFinite(y) ? Math.round(y) : "",
|
|
79
|
+
left: Number.isFinite(x) ? Math.round(x) : ""
|
|
80
80
|
} }),
|
|
81
81
|
variant,
|
|
82
82
|
ref: floating,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipFloating.cjs","names":["getDefaultZIndex","createVarsResolver","getRadius","getThemeColor","factory","useProps","useMantineTheme","useStyles","useFloatingTooltip","getSingleElementChild","getRefProp","OptionalPortal","Box","getStyleObject","classes"],"sources":["../../../../src/components/Tooltip/TooltipFloating/TooltipFloating.tsx"],"sourcesContent":["import { cloneElement } from 'react';\nimport { useMergedRef } from '@mantine/hooks';\nimport {\n Box,\n createVarsResolver,\n factory,\n Factory,\n getDefaultZIndex,\n getRadius,\n getRefProp,\n getSingleElementChild,\n getStyleObject,\n getThemeColor,\n useMantineTheme,\n useProps,\n useStyles,\n} from '../../../core';\nimport { OptionalPortal } from '../../Portal';\nimport { TooltipBaseProps, TooltipCssVariables, TooltipStylesNames } from '../Tooltip.types';\nimport { useFloatingTooltip } from './use-floating-tooltip';\nimport classes from '../Tooltip.module.css';\n\nexport interface TooltipFloatingProps extends TooltipBaseProps {\n /** Offset from mouse in px @default 10 */\n offset?: number;\n\n /** Uncontrolled tooltip initial opened state */\n defaultOpened?: boolean;\n}\n\nexport type TooltipFloatingFactory = Factory<{\n props: TooltipFloatingProps;\n ref: HTMLDivElement;\n stylesNames: TooltipStylesNames;\n vars: TooltipCssVariables;\n}>;\n\nconst defaultProps = {\n refProp: 'ref',\n withinPortal: true,\n offset: 10,\n position: 'right',\n zIndex: getDefaultZIndex('popover'),\n} satisfies Partial<TooltipFloatingProps>;\n\nconst varsResolver = createVarsResolver<TooltipFloatingFactory>((theme, { radius, color }) => ({\n tooltip: {\n '--tooltip-radius': radius === undefined ? undefined : getRadius(radius),\n '--tooltip-bg': color ? getThemeColor(color, theme) : undefined,\n '--tooltip-color': color ? 'var(--mantine-color-white)' : undefined,\n },\n}));\n\nexport const TooltipFloating = factory<TooltipFloatingFactory>((_props) => {\n const props = useProps('TooltipFloating', defaultProps, _props);\n const {\n children,\n refProp,\n withinPortal,\n style,\n className,\n classNames,\n styles,\n unstyled,\n radius,\n color,\n label,\n offset,\n position,\n multiline,\n zIndex,\n disabled,\n defaultOpened,\n variant,\n vars,\n portalProps,\n attributes,\n ref,\n ...others\n } = props;\n\n const theme = useMantineTheme();\n const getStyles = useStyles<TooltipFloatingFactory>({\n name: 'TooltipFloating',\n props,\n classes,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n rootSelector: 'tooltip',\n vars,\n varsResolver,\n });\n\n const { handleMouseMove, x, y, opened, boundaryRef, floating, setOpened } = useFloatingTooltip({\n offset,\n position,\n defaultOpened,\n });\n\n const child = getSingleElementChild(children);\n if (!child) {\n throw new Error(\n '[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported'\n );\n }\n\n const targetRef = useMergedRef(boundaryRef, getRefProp(child), ref);\n const childProps = child.props as any;\n\n const onMouseEnter = (event: React.MouseEvent<unknown, MouseEvent>) => {\n childProps.onMouseEnter?.(event);\n handleMouseMove(event);\n setOpened(true);\n };\n\n const onMouseLeave = (event: React.MouseEvent<unknown, MouseEvent>) => {\n childProps.onMouseLeave?.(event);\n setOpened(false);\n };\n\n return (\n <>\n <OptionalPortal {...portalProps} withinPortal={withinPortal}>\n <Box\n {...others}\n {...getStyles('tooltip', {\n style: {\n ...getStyleObject(style, theme),\n zIndex: zIndex as React.CSSProperties['zIndex'],\n display: !disabled && opened ? 'block' : 'none',\n top: (y
|
|
1
|
+
{"version":3,"file":"TooltipFloating.cjs","names":["getDefaultZIndex","createVarsResolver","getRadius","getThemeColor","factory","useProps","useMantineTheme","useStyles","useFloatingTooltip","getSingleElementChild","getRefProp","OptionalPortal","Box","getStyleObject","classes"],"sources":["../../../../src/components/Tooltip/TooltipFloating/TooltipFloating.tsx"],"sourcesContent":["import { cloneElement } from 'react';\nimport { useMergedRef } from '@mantine/hooks';\nimport {\n Box,\n createVarsResolver,\n factory,\n Factory,\n getDefaultZIndex,\n getRadius,\n getRefProp,\n getSingleElementChild,\n getStyleObject,\n getThemeColor,\n useMantineTheme,\n useProps,\n useStyles,\n} from '../../../core';\nimport { OptionalPortal } from '../../Portal';\nimport { TooltipBaseProps, TooltipCssVariables, TooltipStylesNames } from '../Tooltip.types';\nimport { useFloatingTooltip } from './use-floating-tooltip';\nimport classes from '../Tooltip.module.css';\n\nexport interface TooltipFloatingProps extends TooltipBaseProps {\n /** Offset from mouse in px @default 10 */\n offset?: number;\n\n /** Uncontrolled tooltip initial opened state */\n defaultOpened?: boolean;\n}\n\nexport type TooltipFloatingFactory = Factory<{\n props: TooltipFloatingProps;\n ref: HTMLDivElement;\n stylesNames: TooltipStylesNames;\n vars: TooltipCssVariables;\n}>;\n\nconst defaultProps = {\n refProp: 'ref',\n withinPortal: true,\n offset: 10,\n position: 'right',\n zIndex: getDefaultZIndex('popover'),\n} satisfies Partial<TooltipFloatingProps>;\n\nconst varsResolver = createVarsResolver<TooltipFloatingFactory>((theme, { radius, color }) => ({\n tooltip: {\n '--tooltip-radius': radius === undefined ? undefined : getRadius(radius),\n '--tooltip-bg': color ? getThemeColor(color, theme) : undefined,\n '--tooltip-color': color ? 'var(--mantine-color-white)' : undefined,\n },\n}));\n\nexport const TooltipFloating = factory<TooltipFloatingFactory>((_props) => {\n const props = useProps('TooltipFloating', defaultProps, _props);\n const {\n children,\n refProp,\n withinPortal,\n style,\n className,\n classNames,\n styles,\n unstyled,\n radius,\n color,\n label,\n offset,\n position,\n multiline,\n zIndex,\n disabled,\n defaultOpened,\n variant,\n vars,\n portalProps,\n attributes,\n ref,\n ...others\n } = props;\n\n const theme = useMantineTheme();\n const getStyles = useStyles<TooltipFloatingFactory>({\n name: 'TooltipFloating',\n props,\n classes,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n rootSelector: 'tooltip',\n vars,\n varsResolver,\n });\n\n const { handleMouseMove, x, y, opened, boundaryRef, floating, setOpened } = useFloatingTooltip({\n offset,\n position,\n defaultOpened,\n });\n\n const child = getSingleElementChild(children);\n if (!child) {\n throw new Error(\n '[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported'\n );\n }\n\n const targetRef = useMergedRef(boundaryRef, getRefProp(child), ref);\n const childProps = child.props as any;\n\n const onMouseEnter = (event: React.MouseEvent<unknown, MouseEvent>) => {\n childProps.onMouseEnter?.(event);\n handleMouseMove(event);\n setOpened(true);\n };\n\n const onMouseLeave = (event: React.MouseEvent<unknown, MouseEvent>) => {\n childProps.onMouseLeave?.(event);\n setOpened(false);\n };\n\n return (\n <>\n <OptionalPortal {...portalProps} withinPortal={withinPortal}>\n <Box\n {...others}\n {...getStyles('tooltip', {\n style: {\n ...getStyleObject(style, theme),\n zIndex: zIndex as React.CSSProperties['zIndex'],\n display: !disabled && opened ? 'block' : 'none',\n top: Number.isFinite(y) ? Math.round(y) : '',\n left: Number.isFinite(x) ? Math.round(x) : '',\n },\n })}\n variant={variant}\n ref={floating}\n mod={{ multiline }}\n >\n {label}\n </Box>\n </OptionalPortal>\n\n {cloneElement(child, {\n ...childProps,\n [refProp]: targetRef,\n onMouseEnter,\n onMouseLeave,\n })}\n </>\n );\n});\n\nTooltipFloating.classes = classes;\nTooltipFloating.varsResolver = varsResolver;\nTooltipFloating.displayName = '@mantine/core/TooltipFloating';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,eAAe;CACnB,SAAS;CACT,cAAc;CACd,QAAQ;CACR,UAAU;CACV,QAAQA,4BAAAA,iBAAiB,SAAS;AACpC;AAEA,MAAM,eAAeC,6BAAAA,oBAA4C,OAAO,EAAE,QAAQ,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AAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;GACE,GAAI;GACJ,GAAI,UAAU,WAAW,EACvB,OAAO;IACL,GAAGC,yBAAAA,eAAe,OAAO,KAAK;IACtB;IACR,SAAS,CAAC,YAAY,SAAS,UAAU;IACzC,KAAK,OAAO,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI;IAC1C,MAAM,OAAO,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI;GAC7C,EACF,CAAC;GACQ;GACT,KAAK;GACL,KAAK,EAAE,UAAU;aAEhB;EACE,CAAA;CACS,CAAA,IAAA,GAAA,MAAA,aAAA,CAEF,OAAO;EACnB,GAAG;GACF,UAAU;EACX;EACA;CACF,CAAC,CACD,EAAA,CAAA;AAEN,CAAC;AAED,gBAAgB,UAAUC,uBAAAA;AAC1B,gBAAgB,eAAe;AAC/B,gBAAgB,cAAc"}
|
|
@@ -16,6 +16,7 @@ function useFloatingTooltip({ offset, position, defaultOpened }) {
|
|
|
16
16
|
const horizontalOffset = placement.includes("right") ? offset : position.includes("left") ? offset * -1 : 0;
|
|
17
17
|
const verticalOffset = placement.includes("bottom") ? offset : position.includes("top") ? offset * -1 : 0;
|
|
18
18
|
const handleMouseMove = (0, react.useCallback)(({ clientX, clientY }) => {
|
|
19
|
+
if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) return;
|
|
19
20
|
refs.setPositionReference({ getBoundingClientRect() {
|
|
20
21
|
return {
|
|
21
22
|
width: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-floating-tooltip.cjs","names":[],"sources":["../../../../src/components/Tooltip/TooltipFloating/use-floating-tooltip.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { getOverflowAncestors, shift, useFloating } from '@floating-ui/react';\nimport { FloatingPosition } from '../../../utils/Floating';\n\ninterface UseFloatingTooltip {\n offset: number;\n position: FloatingPosition;\n defaultOpened?: boolean;\n}\n\nexport function useFloatingTooltip<T extends HTMLElement = any>({\n offset,\n position,\n defaultOpened,\n}: UseFloatingTooltip) {\n const [opened, setOpened] = useState(defaultOpened);\n const boundaryRef = useRef<T>(null);\n const { x, y, elements, refs, update, placement } = useFloating({\n placement: position,\n middleware: [\n shift({\n crossAxis: true,\n padding: 5,\n rootBoundary: 'document',\n }),\n ],\n });\n\n const horizontalOffset = placement.includes('right')\n ? offset\n : position.includes('left')\n ? offset * -1\n : 0;\n\n const verticalOffset = placement.includes('bottom')\n ? offset\n : position.includes('top')\n ? offset * -1\n : 0;\n\n const handleMouseMove = useCallback(\n ({ clientX, clientY }: MouseEvent | React.MouseEvent<T, MouseEvent>) => {\n refs.setPositionReference({\n getBoundingClientRect() {\n return {\n width: 0,\n height: 0,\n x: clientX,\n y: clientY,\n left: clientX + horizontalOffset,\n top: clientY + verticalOffset,\n right: clientX,\n bottom: clientY,\n };\n },\n });\n },\n [elements.reference]\n );\n\n useEffect(() => {\n if (refs.floating.current) {\n const boundary = boundaryRef.current!;\n boundary.addEventListener('mousemove', handleMouseMove);\n\n const parents = getOverflowAncestors(refs.floating.current);\n parents.forEach((parent) => {\n parent.addEventListener('scroll', update);\n });\n\n return () => {\n boundary.removeEventListener('mousemove', handleMouseMove);\n parents.forEach((parent) => {\n parent.removeEventListener('scroll', update);\n });\n };\n }\n\n return undefined;\n }, [elements.reference, refs.floating.current, update, handleMouseMove, opened]);\n\n return { handleMouseMove, x, y, opened, setOpened, boundaryRef, floating: refs.setFloating };\n}\n"],"mappings":";;;;AAUA,SAAgB,mBAAgD,EAC9D,QACA,UACA,iBACqB;CACrB,MAAM,CAAC,QAAQ,cAAA,GAAA,MAAA,SAAA,CAAsB,aAAa;CAClD,MAAM,eAAA,GAAA,MAAA,OAAA,CAAwB,IAAI;CAClC,MAAM,EAAE,GAAG,GAAG,UAAU,MAAM,QAAQ,eAAA,GAAA,mBAAA,YAAA,CAA0B;EAC9D,WAAW;EACX,YAAY,EAAA,GAAA,mBAAA,MAAA,CACJ;GACJ,WAAW;GACX,SAAS;GACT,cAAc;EAChB,CAAC,CACH;CACF,CAAC;CAED,MAAM,mBAAmB,UAAU,SAAS,OAAO,IAC/C,SACA,SAAS,SAAS,MAAM,IACtB,SAAS,KACT;CAEN,MAAM,iBAAiB,UAAU,SAAS,QAAQ,IAC9C,SACA,SAAS,SAAS,KAAK,IACrB,SAAS,KACT;CAEN,MAAM,mBAAA,GAAA,MAAA,YAAA,EACH,EAAE,SAAS,cAA4D;EACtE,KAAK,qBAAqB,EACxB,wBAAwB;GACtB,OAAO;IACL,OAAO;IACP,QAAQ;IACR,GAAG;IACH,GAAG;IACH,MAAM,UAAU;IAChB,KAAK,UAAU;IACf,OAAO;IACP,QAAQ;GACV;EACF,EACF,CAAC;CACH,GACA,CAAC,SAAS,SAAS,CACrB;CAEA,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,IAAI,KAAK,SAAS,SAAS;GACzB,MAAM,WAAW,YAAY;GAC7B,SAAS,iBAAiB,aAAa,eAAe;GAEtD,MAAM,WAAA,GAAA,mBAAA,qBAAA,CAA+B,KAAK,SAAS,OAAO;GAC1D,QAAQ,SAAS,WAAW;IAC1B,OAAO,iBAAiB,UAAU,MAAM;GAC1C,CAAC;GAED,aAAa;IACX,SAAS,oBAAoB,aAAa,eAAe;IACzD,QAAQ,SAAS,WAAW;KAC1B,OAAO,oBAAoB,UAAU,MAAM;IAC7C,CAAC;GACH;EACF;CAGF,GAAG;EAAC,SAAS;EAAW,KAAK,SAAS;EAAS;EAAQ;EAAiB;CAAM,CAAC;CAE/E,OAAO;EAAE;EAAiB;EAAG;EAAG;EAAQ;EAAW;EAAa,UAAU,KAAK;CAAY;AAC7F"}
|
|
1
|
+
{"version":3,"file":"use-floating-tooltip.cjs","names":[],"sources":["../../../../src/components/Tooltip/TooltipFloating/use-floating-tooltip.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { getOverflowAncestors, shift, useFloating } from '@floating-ui/react';\nimport { FloatingPosition } from '../../../utils/Floating';\n\ninterface UseFloatingTooltip {\n offset: number;\n position: FloatingPosition;\n defaultOpened?: boolean;\n}\n\nexport function useFloatingTooltip<T extends HTMLElement = any>({\n offset,\n position,\n defaultOpened,\n}: UseFloatingTooltip) {\n const [opened, setOpened] = useState(defaultOpened);\n const boundaryRef = useRef<T>(null);\n const { x, y, elements, refs, update, placement } = useFloating({\n placement: position,\n middleware: [\n shift({\n crossAxis: true,\n padding: 5,\n rootBoundary: 'document',\n }),\n ],\n });\n\n const horizontalOffset = placement.includes('right')\n ? offset\n : position.includes('left')\n ? offset * -1\n : 0;\n\n const verticalOffset = placement.includes('bottom')\n ? offset\n : position.includes('top')\n ? offset * -1\n : 0;\n\n const handleMouseMove = useCallback(\n ({ clientX, clientY }: MouseEvent | React.MouseEvent<T, MouseEvent>) => {\n if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {\n return;\n }\n\n refs.setPositionReference({\n getBoundingClientRect() {\n return {\n width: 0,\n height: 0,\n x: clientX,\n y: clientY,\n left: clientX + horizontalOffset,\n top: clientY + verticalOffset,\n right: clientX,\n bottom: clientY,\n };\n },\n });\n },\n [elements.reference]\n );\n\n useEffect(() => {\n if (refs.floating.current) {\n const boundary = boundaryRef.current!;\n boundary.addEventListener('mousemove', handleMouseMove);\n\n const parents = getOverflowAncestors(refs.floating.current);\n parents.forEach((parent) => {\n parent.addEventListener('scroll', update);\n });\n\n return () => {\n boundary.removeEventListener('mousemove', handleMouseMove);\n parents.forEach((parent) => {\n parent.removeEventListener('scroll', update);\n });\n };\n }\n\n return undefined;\n }, [elements.reference, refs.floating.current, update, handleMouseMove, opened]);\n\n return { handleMouseMove, x, y, opened, setOpened, boundaryRef, floating: refs.setFloating };\n}\n"],"mappings":";;;;AAUA,SAAgB,mBAAgD,EAC9D,QACA,UACA,iBACqB;CACrB,MAAM,CAAC,QAAQ,cAAA,GAAA,MAAA,SAAA,CAAsB,aAAa;CAClD,MAAM,eAAA,GAAA,MAAA,OAAA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;EAAa,UAAU,KAAK;CAAY;AAC7F"}
|
|
@@ -8,6 +8,7 @@ const require_ScrollArea = require("../ScrollArea/ScrollArea.cjs");
|
|
|
8
8
|
const require_InputBase = require("../InputBase/InputBase.cjs");
|
|
9
9
|
const require_use_combobox = require("../Combobox/use-combobox/use-combobox.cjs");
|
|
10
10
|
const require_Combobox = require("../Combobox/Combobox.cjs");
|
|
11
|
+
const require_is_external_input_change = require("../Combobox/is-external-input-change/is-external-input-change.cjs");
|
|
11
12
|
const require_Pill = require("../Pill/Pill.cjs");
|
|
12
13
|
const require_PillsInput = require("../PillsInput/PillsInput.cjs");
|
|
13
14
|
const require_get_children_nodes_values = require("../Tree/get-children-nodes-values/get-children-nodes-values.cjs");
|
|
@@ -485,6 +486,7 @@ const TreeSelect = require_factory.genericFactory((_props) => {
|
|
|
485
486
|
onKeyDown: handleKeyDown,
|
|
486
487
|
value: _searchValue,
|
|
487
488
|
onChange: (event) => {
|
|
489
|
+
if (require_is_external_input_change.isExternalInputChange(event)) return;
|
|
488
490
|
handleSearchChange(event.currentTarget.value);
|
|
489
491
|
if (searchable) combobox.openDropdown();
|
|
490
492
|
},
|
|
@@ -538,6 +540,7 @@ const TreeSelect = require_factory.genericFactory((_props) => {
|
|
|
538
540
|
readOnly: readOnly || !searchable,
|
|
539
541
|
value: searchable ? _searchValue : singleDisplayLabel,
|
|
540
542
|
onChange: (event) => {
|
|
543
|
+
if (require_is_external_input_change.isExternalInputChange(event)) return;
|
|
541
544
|
handleSearchChange(event.currentTarget.value);
|
|
542
545
|
combobox.openDropdown();
|
|
543
546
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSelect.cjs","names":["genericFactory","useProps","useCombobox","getTreeExpandedState","findTreeNode","expandToLeafChecked","filterTreeData","flattenTreeSelectData","useStyles","useResolvedStylesApi","extractStyleProps","isNodeChecked","getChildrenNodesValues","checkedToValue","Combobox","Pill","isNodeIndeterminate","TreeSelectOption","classes","ScrollArea","PillsInput","InputBase"],"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,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,aAAaA,gBAAAA,gBAAmC,WAAW;CACtE,MAAM,QAAQC,kBAAAA,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,g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ACA,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,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,SAAS,aAAV;EACE,OAAO;EACD;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,WAAW,UAAU;CAAE,GAAGO,kBAAAA,UAAU;CAAS,GAAGP,iBAAAA,SAAS;AAAQ;AACjE,WAAW,cAAc"}
|
|
1
|
+
{"version":3,"file":"TreeSelect.cjs","names":["genericFactory","useProps","useCombobox","getTreeExpandedState","findTreeNode","expandToLeafChecked","filterTreeData","flattenTreeSelectData","useStyles","useResolvedStylesApi","extractStyleProps","isNodeChecked","getChildrenNodesValues","checkedToValue","Combobox","Pill","isNodeIndeterminate","TreeSelectOption","classes","ScrollArea","PillsInput","isExternalInputChange","InputBase"],"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,aAAaA,gBAAAA,gBAAmC,WAAW;CACtE,MAAM,QAAQC,kBAAAA,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,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