@mantine/core 5.10.2 → 5.10.4
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/Autocomplete/Autocomplete.js +10 -4
- package/cjs/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/FileButton/FileButton.js +6 -4
- package/cjs/FileButton/FileButton.js.map +1 -1
- package/cjs/FileInput/FileInput.js +6 -3
- package/cjs/FileInput/FileInput.js.map +1 -1
- package/cjs/Floating/use-floating-auto-update.js +2 -2
- package/cjs/Floating/use-floating-auto-update.js.map +1 -1
- package/cjs/Input/use-input-props.js +23 -22
- package/cjs/Input/use-input-props.js.map +1 -1
- package/cjs/MultiSelect/MultiSelect.js +25 -8
- package/cjs/MultiSelect/MultiSelect.js.map +1 -1
- package/cjs/MultiSelect/filter-data/filter-data.js +10 -2
- package/cjs/MultiSelect/filter-data/filter-data.js.map +1 -1
- package/cjs/Notification/Notification.styles.js +1 -0
- package/cjs/Notification/Notification.styles.js.map +1 -1
- package/cjs/Pagination/Pagination.js +1 -1
- package/cjs/Pagination/Pagination.js.map +1 -1
- package/cjs/PasswordInput/PasswordInput.styles.js +3 -0
- package/cjs/PasswordInput/PasswordInput.styles.js.map +1 -1
- package/cjs/Popover/Popover.context.js.map +1 -1
- package/cjs/Popover/use-popover.js +8 -8
- package/cjs/Popover/use-popover.js.map +1 -1
- package/cjs/SegmentedControl/SegmentedControl.js.map +1 -1
- package/cjs/Select/Select.js +11 -5
- package/cjs/Select/Select.js.map +1 -1
- package/cjs/Select/SelectItems/SelectItems.js +1 -0
- package/cjs/Select/SelectItems/SelectItems.js.map +1 -1
- package/cjs/SimpleGrid/SimpleGrid.styles.js +3 -2
- package/cjs/SimpleGrid/SimpleGrid.styles.js.map +1 -1
- package/cjs/Skeleton/Skeleton.styles.js +1 -1
- package/cjs/Skeleton/Skeleton.styles.js.map +1 -1
- package/cjs/Table/Table.styles.js +5 -2
- package/cjs/Table/Table.styles.js.map +1 -1
- package/cjs/Text/Text.js.map +1 -1
- package/cjs/Text/Text.styles.js +11 -2
- package/cjs/Text/Text.styles.js.map +1 -1
- package/cjs/Tooltip/TooltipFloating/use-floating-tooltip.js +4 -4
- package/cjs/Tooltip/TooltipFloating/use-floating-tooltip.js.map +1 -1
- package/cjs/Tooltip/TooltipGroup/TooltipGroup.js +2 -2
- package/cjs/Tooltip/TooltipGroup/TooltipGroup.js.map +1 -1
- package/cjs/Tooltip/use-tooltip.js +14 -14
- package/cjs/Tooltip/use-tooltip.js.map +1 -1
- package/cjs/TransferList/RenderList/RenderList.js +2 -1
- package/cjs/TransferList/RenderList/RenderList.js.map +1 -1
- package/cjs/TransferList/TransferList.js +20 -7
- package/cjs/TransferList/TransferList.js.map +1 -1
- package/esm/Autocomplete/Autocomplete.js +10 -4
- package/esm/Autocomplete/Autocomplete.js.map +1 -1
- package/esm/FileButton/FileButton.js +6 -4
- package/esm/FileButton/FileButton.js.map +1 -1
- package/esm/FileInput/FileInput.js +6 -3
- package/esm/FileInput/FileInput.js.map +1 -1
- package/esm/Floating/use-floating-auto-update.js +1 -1
- package/esm/Floating/use-floating-auto-update.js.map +1 -1
- package/esm/Input/use-input-props.js +23 -22
- package/esm/Input/use-input-props.js.map +1 -1
- package/esm/MultiSelect/MultiSelect.js +25 -8
- package/esm/MultiSelect/MultiSelect.js.map +1 -1
- package/esm/MultiSelect/filter-data/filter-data.js +10 -2
- package/esm/MultiSelect/filter-data/filter-data.js.map +1 -1
- package/esm/Notification/Notification.styles.js +1 -0
- package/esm/Notification/Notification.styles.js.map +1 -1
- package/esm/Pagination/Pagination.js +1 -1
- package/esm/Pagination/Pagination.js.map +1 -1
- package/esm/PasswordInput/PasswordInput.styles.js +3 -0
- package/esm/PasswordInput/PasswordInput.styles.js.map +1 -1
- package/esm/Popover/Popover.context.js.map +1 -1
- package/esm/Popover/use-popover.js +1 -1
- package/esm/Popover/use-popover.js.map +1 -1
- package/esm/SegmentedControl/SegmentedControl.js.map +1 -1
- package/esm/Select/Select.js +11 -5
- package/esm/Select/Select.js.map +1 -1
- package/esm/Select/SelectItems/SelectItems.js +1 -0
- package/esm/Select/SelectItems/SelectItems.js.map +1 -1
- package/esm/SimpleGrid/SimpleGrid.styles.js +3 -2
- package/esm/SimpleGrid/SimpleGrid.styles.js.map +1 -1
- package/esm/Skeleton/Skeleton.styles.js +1 -1
- package/esm/Skeleton/Skeleton.styles.js.map +1 -1
- package/esm/Table/Table.styles.js +5 -2
- package/esm/Table/Table.styles.js.map +1 -1
- package/esm/Text/Text.js.map +1 -1
- package/esm/Text/Text.styles.js +11 -2
- package/esm/Text/Text.styles.js.map +1 -1
- package/esm/Tooltip/TooltipFloating/use-floating-tooltip.js +1 -1
- package/esm/Tooltip/TooltipFloating/use-floating-tooltip.js.map +1 -1
- package/esm/Tooltip/TooltipGroup/TooltipGroup.js +1 -1
- package/esm/Tooltip/TooltipGroup/TooltipGroup.js.map +1 -1
- package/esm/Tooltip/use-tooltip.js +1 -1
- package/esm/Tooltip/use-tooltip.js.map +1 -1
- package/esm/TransferList/RenderList/RenderList.js +2 -1
- package/esm/TransferList/RenderList/RenderList.js.map +1 -1
- package/esm/TransferList/TransferList.js +20 -7
- package/esm/TransferList/TransferList.js.map +1 -1
- package/lib/Autocomplete/Autocomplete.d.ts +2 -0
- package/lib/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/lib/FileButton/FileButton.d.ts +2 -0
- package/lib/FileButton/FileButton.d.ts.map +1 -1
- package/lib/FileInput/FileInput.d.ts +2 -0
- package/lib/FileInput/FileInput.d.ts.map +1 -1
- package/lib/Input/use-input-props.d.ts +37 -6
- package/lib/Input/use-input-props.d.ts.map +1 -1
- package/lib/MultiSelect/MultiSelect.d.ts +4 -0
- package/lib/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/lib/MultiSelect/filter-data/filter-data.d.ts +2 -1
- package/lib/MultiSelect/filter-data/filter-data.d.ts.map +1 -1
- package/lib/Notification/Notification.styles.d.ts.map +1 -1
- package/lib/PasswordInput/PasswordInput.styles.d.ts.map +1 -1
- package/lib/Popover/Popover.context.d.ts +1 -1
- package/lib/Popover/Popover.context.d.ts.map +1 -1
- package/lib/Popover/use-popover.d.ts +1 -1
- package/lib/Select/Select.d.ts +3 -1
- package/lib/Select/Select.d.ts.map +1 -1
- package/lib/Select/SelectItems/SelectItems.d.ts.map +1 -1
- package/lib/Select/types.d.ts +1 -0
- package/lib/Select/types.d.ts.map +1 -1
- package/lib/Skeleton/Skeleton.styles.d.ts.map +1 -1
- package/lib/Table/Table.styles.d.ts.map +1 -1
- package/lib/Text/Text.d.ts +1 -1
- package/lib/Text/Text.d.ts.map +1 -1
- package/lib/Text/Text.styles.d.ts +1 -1
- package/lib/Text/Text.styles.d.ts.map +1 -1
- package/lib/Tooltip/use-tooltip.d.ts +2 -2
- package/lib/TransferList/RenderList/RenderList.d.ts +2 -1
- package/lib/TransferList/RenderList/RenderList.d.ts.map +1 -1
- package/lib/TransferList/TransferList.d.ts +2 -0
- package/lib/TransferList/TransferList.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -103,7 +103,8 @@ const Autocomplete = React.forwardRef((props, ref) => {
|
|
|
103
103
|
maxDropdownHeight,
|
|
104
104
|
dropdownComponent,
|
|
105
105
|
positionDependencies,
|
|
106
|
-
readOnly
|
|
106
|
+
readOnly,
|
|
107
|
+
hoverOnSearchChange
|
|
107
108
|
} = _a, others = __objRest(_a, [
|
|
108
109
|
"inputProps",
|
|
109
110
|
"wrapperProps",
|
|
@@ -137,7 +138,8 @@ const Autocomplete = React.forwardRef((props, ref) => {
|
|
|
137
138
|
"maxDropdownHeight",
|
|
138
139
|
"dropdownComponent",
|
|
139
140
|
"positionDependencies",
|
|
140
|
-
"readOnly"
|
|
141
|
+
"readOnly",
|
|
142
|
+
"hoverOnSearchChange"
|
|
141
143
|
]);
|
|
142
144
|
const { classes } = Autocomplete_styles['default'](null, { classNames, styles, name: "Autocomplete", unstyled });
|
|
143
145
|
const [dropdownOpened, _setDropdownOpened] = React.useState(initiallyOpened);
|
|
@@ -157,8 +159,12 @@ const Autocomplete = React.forwardRef((props, ref) => {
|
|
|
157
159
|
typeof handler === "function" && handler();
|
|
158
160
|
};
|
|
159
161
|
hooks.useDidUpdate(() => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
if (hoverOnSearchChange && _value) {
|
|
163
|
+
setHovered(0);
|
|
164
|
+
} else {
|
|
165
|
+
setHovered(-1);
|
|
166
|
+
}
|
|
167
|
+
}, [_value, hoverOnSearchChange]);
|
|
162
168
|
const handleItemClick = (item) => {
|
|
163
169
|
handleChange(item.value);
|
|
164
170
|
typeof onItemSubmit === "function" && onItemSubmit(item);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.js","sources":["../../src/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import React, { useState, forwardRef, useRef } from 'react';\nimport { useUncontrolled, useDidUpdate, useMergedRef } from '@mantine/hooks';\nimport { DefaultProps, getDefaultZIndex } from '@mantine/styles';\nimport { groupOptions } from '@mantine/utils';\nimport { Input, InputWrapperBaseProps, InputSharedProps, useInputProps } from '../Input';\nimport { SelectStylesNames } from '../Select';\nimport { SelectItems } from '../Select/SelectItems/SelectItems';\nimport { DefaultItem } from '../Select/DefaultItem/DefaultItem';\nimport { SelectPopover } from '../Select/SelectPopover/SelectPopover';\nimport { SelectScrollArea } from '../Select/SelectScrollArea/SelectScrollArea';\nimport { filterData } from './filter-data/filter-data';\nimport useStyles from './Autocomplete.styles';\nimport { SelectSharedProps } from '../Select/Select';\n\nexport type AutocompleteStylesNames = SelectStylesNames;\n\nexport interface AutocompleteItem {\n value: string;\n [key: string]: any;\n}\n\nexport interface AutocompleteProps\n extends DefaultProps<AutocompleteStylesNames>,\n InputSharedProps,\n InputWrapperBaseProps,\n SelectSharedProps<AutocompleteItem, string>,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'size' | 'onChange' | 'value' | 'defaultValue'> {\n /** Maximum dropdown height */\n maxDropdownHeight?: number | string;\n\n /** Change dropdown component, can be used to add native scrollbars */\n dropdownComponent?: any;\n\n /** Called when item from dropdown was selected */\n onItemSubmit?(item: AutocompleteItem): void;\n}\n\nexport function defaultFilter(value: string, item: AutocompleteItem) {\n return item.value.toLowerCase().trim().includes(value.toLowerCase().trim());\n}\n\nconst defaultProps: Partial<AutocompleteProps> = {\n required: false,\n size: 'sm',\n shadow: 'sm',\n limit: 5,\n itemComponent: DefaultItem,\n transition: 'pop',\n transitionDuration: 0,\n initiallyOpened: false,\n filter: defaultFilter,\n switchDirectionOnFlip: false,\n zIndex: getDefaultZIndex('popover'),\n dropdownPosition: 'flip',\n maxDropdownHeight: 'auto',\n positionDependencies: [],\n};\n\nexport const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>((props, ref) => {\n const {\n inputProps,\n wrapperProps,\n shadow,\n data,\n limit,\n value,\n defaultValue,\n onChange,\n unstyled,\n itemComponent,\n onItemSubmit,\n onKeyDown,\n onFocus,\n onBlur,\n onClick,\n transition,\n transitionDuration,\n initiallyOpened,\n transitionTimingFunction,\n classNames,\n styles,\n filter,\n nothingFound,\n onDropdownClose,\n onDropdownOpen,\n withinPortal,\n switchDirectionOnFlip,\n zIndex,\n dropdownPosition,\n maxDropdownHeight,\n dropdownComponent,\n positionDependencies,\n readOnly,\n ...others\n } = useInputProps('Autocomplete', defaultProps, props);\n const { classes } = useStyles(null, { classNames, styles, name: 'Autocomplete', unstyled });\n const [dropdownOpened, _setDropdownOpened] = useState(initiallyOpened);\n const [hovered, setHovered] = useState(-1);\n const [direction, setDirection] = useState<React.CSSProperties['flexDirection']>('column');\n const inputRef = useRef<HTMLInputElement>(null);\n const [IMEOpen, setIMEOpen] = useState(false);\n const [_value, handleChange] = useUncontrolled({\n value,\n defaultValue,\n finalValue: '',\n onChange,\n });\n\n const setDropdownOpened = (opened: boolean) => {\n _setDropdownOpened(opened);\n const handler = opened ? onDropdownOpen : onDropdownClose;\n typeof handler === 'function' && handler();\n };\n\n useDidUpdate(() => {\n setHovered(-1);\n }, [_value]);\n\n const handleItemClick = (item: AutocompleteItem) => {\n handleChange(item.value);\n typeof onItemSubmit === 'function' && onItemSubmit(item);\n setDropdownOpened(false);\n };\n\n const formattedData = data.map((item) => (typeof item === 'string' ? { value: item } : item));\n const filteredData = groupOptions({\n data: filterData({ data: formattedData, value: _value, limit, filter }),\n });\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (IMEOpen) {\n return;\n }\n\n typeof onKeyDown === 'function' && onKeyDown(event);\n\n const isColumn = direction === 'column';\n\n const handleNext = () => {\n setHovered((current) => (current < filteredData.length - 1 ? current + 1 : current));\n };\n\n const handlePrevious = () => {\n setHovered((current) => (current > 0 ? current - 1 : current));\n };\n\n switch (event.key) {\n case 'ArrowUp': {\n event.preventDefault();\n isColumn ? handlePrevious() : handleNext();\n break;\n }\n\n case 'ArrowDown': {\n event.preventDefault();\n isColumn ? handleNext() : handlePrevious();\n break;\n }\n\n case 'Enter': {\n if (filteredData[hovered] && dropdownOpened) {\n event.preventDefault();\n handleChange(filteredData[hovered].value);\n typeof onItemSubmit === 'function' && onItemSubmit(filteredData[hovered]);\n setDropdownOpened(false);\n }\n break;\n }\n\n case 'Escape': {\n if (dropdownOpened) {\n event.preventDefault();\n setDropdownOpened(false);\n }\n }\n }\n };\n\n const handleInputFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n typeof onFocus === 'function' && onFocus(event);\n setDropdownOpened(true);\n };\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n typeof onBlur === 'function' && onBlur(event);\n setDropdownOpened(false);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement, MouseEvent>) => {\n typeof onClick === 'function' && onClick(event);\n setDropdownOpened(true);\n };\n\n const shouldRenderDropdown =\n dropdownOpened && (filteredData.length > 0 || (filteredData.length === 0 && !!nothingFound));\n\n return (\n <Input.Wrapper {...wrapperProps} __staticSelector=\"Autocomplete\">\n <SelectPopover\n opened={shouldRenderDropdown}\n transition={transition}\n transitionDuration={transitionDuration}\n shadow=\"sm\"\n withinPortal={withinPortal}\n __staticSelector=\"Autocomplete\"\n onDirectionChange={setDirection}\n switchDirectionOnFlip={switchDirectionOnFlip}\n zIndex={zIndex}\n dropdownPosition={dropdownPosition}\n positionDependencies={positionDependencies}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n readOnly={readOnly}\n >\n <SelectPopover.Target>\n <div\n className={classes.wrapper}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-owns={shouldRenderDropdown ? `${inputProps.id}-items` : null}\n aria-controls={inputProps.id}\n aria-expanded={shouldRenderDropdown}\n onMouseLeave={() => setHovered(-1)}\n tabIndex={-1}\n >\n <Input<'input'>\n type=\"search\"\n autoComplete=\"off\"\n {...inputProps}\n {...others}\n readOnly={readOnly}\n data-mantine-stop-propagation={dropdownOpened}\n ref={useMergedRef(ref, inputRef)}\n onKeyDown={handleInputKeydown}\n classNames={classNames}\n styles={styles}\n __staticSelector=\"Autocomplete\"\n value={_value}\n onChange={(event) => {\n handleChange(event.currentTarget.value);\n setDropdownOpened(true);\n }}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n onClick={handleInputClick}\n onCompositionStart={() => setIMEOpen(true)}\n onCompositionEnd={() => setIMEOpen(false)}\n aria-autocomplete=\"list\"\n aria-controls={shouldRenderDropdown ? `${inputProps.id}-items` : null}\n aria-activedescendant={hovered >= 0 ? `${inputProps.id}-${hovered}` : null}\n />\n </div>\n </SelectPopover.Target>\n\n <SelectPopover.Dropdown\n component={dropdownComponent || SelectScrollArea}\n maxHeight={maxDropdownHeight}\n direction={direction}\n id={inputProps.id}\n __staticSelector=\"Autocomplete\"\n classNames={classNames}\n styles={styles}\n >\n <SelectItems\n data={filteredData}\n hovered={hovered}\n classNames={classNames}\n styles={styles}\n uuid={inputProps.id}\n __staticSelector=\"Autocomplete\"\n onItemHover={setHovered}\n onItemSelect={handleItemClick}\n itemComponent={itemComponent}\n size={inputProps.size}\n nothingFound={nothingFound}\n />\n </SelectPopover.Dropdown>\n </SelectPopover>\n </Input.Wrapper>\n );\n});\n\nAutocomplete.displayName = '@mantine/core/Autocomplete';\n"],"names":["DefaultItem","getDefaultZIndex","forwardRef","useInputProps","useStyles","useState","useRef","useUncontrolled","useDidUpdate","groupOptions","filterData","React","Input","SelectPopover","useMergedRef","SelectScrollArea","SelectItems"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,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AAc;AACpC,IAAI,WAAW,EAAE,UAAU;AAC3B,IAAI,YAAY,EAAE,eAAe;AACjC,IAAI,aAAa;AACjB,IAAI,IAAI,EAAE,UAAU,CAAC,IAAI;AACzB,IAAI,YAAY;AAChB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,EAAE;AACH,YAAY,CAAC,WAAW,GAAG,4BAA4B;;;;;"}
|
|
1
|
+
{"version":3,"file":"Autocomplete.js","sources":["../../src/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import React, { useState, forwardRef, useRef } from 'react';\nimport { useUncontrolled, useDidUpdate, useMergedRef } from '@mantine/hooks';\nimport { DefaultProps, getDefaultZIndex } from '@mantine/styles';\nimport { groupOptions } from '@mantine/utils';\nimport { Input, InputWrapperBaseProps, InputSharedProps, useInputProps } from '../Input';\nimport { SelectStylesNames } from '../Select';\nimport { SelectItems } from '../Select/SelectItems/SelectItems';\nimport { DefaultItem } from '../Select/DefaultItem/DefaultItem';\nimport { SelectPopover } from '../Select/SelectPopover/SelectPopover';\nimport { SelectScrollArea } from '../Select/SelectScrollArea/SelectScrollArea';\nimport { filterData } from './filter-data/filter-data';\nimport useStyles from './Autocomplete.styles';\nimport { SelectSharedProps } from '../Select/Select';\n\nexport type AutocompleteStylesNames = SelectStylesNames;\n\nexport interface AutocompleteItem {\n value: string;\n [key: string]: any;\n}\n\nexport interface AutocompleteProps\n extends DefaultProps<AutocompleteStylesNames>,\n InputSharedProps,\n InputWrapperBaseProps,\n SelectSharedProps<AutocompleteItem, string>,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'size' | 'onChange' | 'value' | 'defaultValue'> {\n /** Maximum dropdown height */\n maxDropdownHeight?: number | string;\n\n /** Change dropdown component, can be used to add native scrollbars */\n dropdownComponent?: any;\n\n /** Called when item from dropdown was selected */\n onItemSubmit?(item: AutocompleteItem): void;\n\n /** Hovers the first result when input changes */\n hoverOnSearchChange?: boolean;\n}\n\nexport function defaultFilter(value: string, item: AutocompleteItem) {\n return item.value.toLowerCase().trim().includes(value.toLowerCase().trim());\n}\n\nconst defaultProps: Partial<AutocompleteProps> = {\n required: false,\n size: 'sm',\n shadow: 'sm',\n limit: 5,\n itemComponent: DefaultItem,\n transition: 'pop',\n transitionDuration: 0,\n initiallyOpened: false,\n filter: defaultFilter,\n switchDirectionOnFlip: false,\n zIndex: getDefaultZIndex('popover'),\n dropdownPosition: 'flip',\n maxDropdownHeight: 'auto',\n positionDependencies: [],\n};\n\nexport const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>((props, ref) => {\n const {\n inputProps,\n wrapperProps,\n shadow,\n data,\n limit,\n value,\n defaultValue,\n onChange,\n unstyled,\n itemComponent,\n onItemSubmit,\n onKeyDown,\n onFocus,\n onBlur,\n onClick,\n transition,\n transitionDuration,\n initiallyOpened,\n transitionTimingFunction,\n classNames,\n styles,\n filter,\n nothingFound,\n onDropdownClose,\n onDropdownOpen,\n withinPortal,\n switchDirectionOnFlip,\n zIndex,\n dropdownPosition,\n maxDropdownHeight,\n dropdownComponent,\n positionDependencies,\n readOnly,\n hoverOnSearchChange,\n ...others\n } = useInputProps('Autocomplete', defaultProps, props);\n const { classes } = useStyles(null, { classNames, styles, name: 'Autocomplete', unstyled });\n const [dropdownOpened, _setDropdownOpened] = useState(initiallyOpened);\n const [hovered, setHovered] = useState(-1);\n const [direction, setDirection] = useState<React.CSSProperties['flexDirection']>('column');\n const inputRef = useRef<HTMLInputElement>(null);\n const [IMEOpen, setIMEOpen] = useState(false);\n const [_value, handleChange] = useUncontrolled({\n value,\n defaultValue,\n finalValue: '',\n onChange,\n });\n\n const setDropdownOpened = (opened: boolean) => {\n _setDropdownOpened(opened);\n const handler = opened ? onDropdownOpen : onDropdownClose;\n typeof handler === 'function' && handler();\n };\n\n useDidUpdate(() => {\n if (hoverOnSearchChange && _value) {\n setHovered(0);\n } else {\n setHovered(-1);\n }\n }, [_value, hoverOnSearchChange]);\n\n const handleItemClick = (item: AutocompleteItem) => {\n handleChange(item.value);\n typeof onItemSubmit === 'function' && onItemSubmit(item);\n setDropdownOpened(false);\n };\n\n const formattedData = data.map((item) => (typeof item === 'string' ? { value: item } : item));\n const filteredData = groupOptions({\n data: filterData({ data: formattedData, value: _value, limit, filter }),\n });\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (IMEOpen) {\n return;\n }\n\n typeof onKeyDown === 'function' && onKeyDown(event);\n\n const isColumn = direction === 'column';\n\n const handleNext = () => {\n setHovered((current) => (current < filteredData.length - 1 ? current + 1 : current));\n };\n\n const handlePrevious = () => {\n setHovered((current) => (current > 0 ? current - 1 : current));\n };\n\n switch (event.key) {\n case 'ArrowUp': {\n event.preventDefault();\n isColumn ? handlePrevious() : handleNext();\n break;\n }\n\n case 'ArrowDown': {\n event.preventDefault();\n isColumn ? handleNext() : handlePrevious();\n break;\n }\n\n case 'Enter': {\n if (filteredData[hovered] && dropdownOpened) {\n event.preventDefault();\n handleChange(filteredData[hovered].value);\n typeof onItemSubmit === 'function' && onItemSubmit(filteredData[hovered]);\n setDropdownOpened(false);\n }\n break;\n }\n\n case 'Escape': {\n if (dropdownOpened) {\n event.preventDefault();\n setDropdownOpened(false);\n }\n }\n }\n };\n\n const handleInputFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n typeof onFocus === 'function' && onFocus(event);\n setDropdownOpened(true);\n };\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n typeof onBlur === 'function' && onBlur(event);\n setDropdownOpened(false);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement, MouseEvent>) => {\n typeof onClick === 'function' && onClick(event);\n setDropdownOpened(true);\n };\n\n const shouldRenderDropdown =\n dropdownOpened && (filteredData.length > 0 || (filteredData.length === 0 && !!nothingFound));\n\n return (\n <Input.Wrapper {...wrapperProps} __staticSelector=\"Autocomplete\">\n <SelectPopover\n opened={shouldRenderDropdown}\n transition={transition}\n transitionDuration={transitionDuration}\n shadow=\"sm\"\n withinPortal={withinPortal}\n __staticSelector=\"Autocomplete\"\n onDirectionChange={setDirection}\n switchDirectionOnFlip={switchDirectionOnFlip}\n zIndex={zIndex}\n dropdownPosition={dropdownPosition}\n positionDependencies={positionDependencies}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n readOnly={readOnly}\n >\n <SelectPopover.Target>\n <div\n className={classes.wrapper}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-owns={shouldRenderDropdown ? `${inputProps.id}-items` : null}\n aria-controls={inputProps.id}\n aria-expanded={shouldRenderDropdown}\n onMouseLeave={() => setHovered(-1)}\n tabIndex={-1}\n >\n <Input<'input'>\n type=\"search\"\n autoComplete=\"off\"\n {...inputProps}\n {...others}\n readOnly={readOnly}\n data-mantine-stop-propagation={dropdownOpened}\n ref={useMergedRef(ref, inputRef)}\n onKeyDown={handleInputKeydown}\n classNames={classNames}\n styles={styles}\n __staticSelector=\"Autocomplete\"\n value={_value}\n onChange={(event) => {\n handleChange(event.currentTarget.value);\n setDropdownOpened(true);\n }}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n onClick={handleInputClick}\n onCompositionStart={() => setIMEOpen(true)}\n onCompositionEnd={() => setIMEOpen(false)}\n aria-autocomplete=\"list\"\n aria-controls={shouldRenderDropdown ? `${inputProps.id}-items` : null}\n aria-activedescendant={hovered >= 0 ? `${inputProps.id}-${hovered}` : null}\n />\n </div>\n </SelectPopover.Target>\n\n <SelectPopover.Dropdown\n component={dropdownComponent || SelectScrollArea}\n maxHeight={maxDropdownHeight}\n direction={direction}\n id={inputProps.id}\n __staticSelector=\"Autocomplete\"\n classNames={classNames}\n styles={styles}\n >\n <SelectItems\n data={filteredData}\n hovered={hovered}\n classNames={classNames}\n styles={styles}\n uuid={inputProps.id}\n __staticSelector=\"Autocomplete\"\n onItemHover={setHovered}\n onItemSelect={handleItemClick}\n itemComponent={itemComponent}\n size={inputProps.size}\n nothingFound={nothingFound}\n />\n </SelectPopover.Dropdown>\n </SelectPopover>\n </Input.Wrapper>\n );\n});\n\nAutocomplete.displayName = '@mantine/core/Autocomplete';\n"],"names":["DefaultItem","getDefaultZIndex","forwardRef","useInputProps","useStyles","useState","useRef","useUncontrolled","useDidUpdate","groupOptions","filterData","React","Input","SelectPopover","useMergedRef","SelectScrollArea","SelectItems"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC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AAU;AACd,IAAI,MAAM;AACV,IAAI,IAAI,EAAE,UAAU,CAAC,EAAE;AACvB,IAAI,gBAAgB,EAAE,cAAc;AACpC,IAAI,WAAW,EAAE,UAAU;AAC3B,IAAI,YAAY,EAAE,eAAe;AACjC,IAAI,aAAa;AACjB,IAAI,IAAI,EAAE,UAAU,CAAC,IAAI;AACzB,IAAI,YAAY;AAChB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,EAAE;AACH,YAAY,CAAC,WAAW,GAAG,4BAA4B;;;;;"}
|
|
@@ -51,7 +51,8 @@ const FileButton = React.forwardRef((props, ref) => {
|
|
|
51
51
|
form,
|
|
52
52
|
resetRef,
|
|
53
53
|
disabled,
|
|
54
|
-
capture
|
|
54
|
+
capture,
|
|
55
|
+
inputProps
|
|
55
56
|
} = _a, others = __objRest(_a, [
|
|
56
57
|
"onChange",
|
|
57
58
|
"children",
|
|
@@ -61,7 +62,8 @@ const FileButton = React.forwardRef((props, ref) => {
|
|
|
61
62
|
"form",
|
|
62
63
|
"resetRef",
|
|
63
64
|
"disabled",
|
|
64
|
-
"capture"
|
|
65
|
+
"capture",
|
|
66
|
+
"inputProps"
|
|
65
67
|
]);
|
|
66
68
|
const inputRef = React.useRef();
|
|
67
69
|
const onClick = () => {
|
|
@@ -78,7 +80,7 @@ const FileButton = React.forwardRef((props, ref) => {
|
|
|
78
80
|
inputRef.current.value = "";
|
|
79
81
|
};
|
|
80
82
|
hooks.assignRef(resetRef, reset);
|
|
81
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children(__spreadValues({ onClick }, others)), /* @__PURE__ */ React__default.createElement("input", {
|
|
83
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children(__spreadValues({ onClick }, others)), /* @__PURE__ */ React__default.createElement("input", __spreadValues({
|
|
82
84
|
style: { display: "none" },
|
|
83
85
|
type: "file",
|
|
84
86
|
accept,
|
|
@@ -88,7 +90,7 @@ const FileButton = React.forwardRef((props, ref) => {
|
|
|
88
90
|
name,
|
|
89
91
|
form,
|
|
90
92
|
capture
|
|
91
|
-
}));
|
|
93
|
+
}, inputProps)));
|
|
92
94
|
});
|
|
93
95
|
FileButton.displayName = "@mantine/core/FileButton";
|
|
94
96
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileButton.js","sources":["../../src/FileButton/FileButton.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-prop-types */\nimport React, { useRef, forwardRef } from 'react';\nimport { useComponentDefaultProps } from '@mantine/styles';\nimport { assignRef, useMergedRef } from '@mantine/hooks';\n\nexport interface FileButtonProps<Multiple extends boolean = false> {\n /** Called when files are picked */\n onChange(payload: Multiple extends true ? File[] : File | null): void;\n\n /** Function that receives button props and returns react node that should be rendered */\n children(props: { onClick(): void }): React.ReactNode;\n\n /** Determines whether user can pick more than one file */\n multiple?: Multiple;\n\n /** File input accept attribute, for example, \"image/png,image/jpeg\" */\n accept?: string;\n\n /** Input name attribute */\n name?: string;\n\n /** Input form attribute */\n form?: string;\n\n /** Function that should be called when value changes to null or empty array */\n resetRef?: React.ForwardedRef<() => void>;\n\n /** Disables file picker */\n disabled?: boolean;\n\n /** Specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. */\n capture?: boolean | 'user' | 'environment';\n}\n\nconst defaultProps: Partial<FileButtonProps> = {\n multiple: false,\n};\n\ntype FileButtonComponent = (<Multiple extends boolean = false>(\n props: FileButtonProps<Multiple>\n) => React.ReactElement) & { displayName?: string };\n\nexport const FileButton: FileButtonComponent = forwardRef<HTMLInputElement, FileButtonProps>(\n (props, ref) => {\n const {\n onChange,\n children,\n multiple,\n accept,\n name,\n form,\n resetRef,\n disabled,\n capture,\n ...others\n } = useComponentDefaultProps('FileButton', defaultProps, props);\n\n const inputRef = useRef<HTMLInputElement>();\n\n const onClick = () => {\n !disabled && inputRef.current.click();\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (multiple) {\n onChange(Array.from(event.currentTarget.files) as any);\n } else {\n onChange(event.currentTarget.files[0] || null);\n }\n };\n\n const reset = () => {\n inputRef.current.value = '';\n };\n\n assignRef(resetRef, reset);\n\n return (\n <>\n {children({ onClick, ...others })}\n\n <input\n style={{ display: 'none' }}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleChange}\n ref={useMergedRef(ref, inputRef)}\n name={name}\n form={form}\n capture={capture}\n />\n </>\n );\n }\n) as any;\n\nFileButton.displayName = '@mantine/core/FileButton';\n"],"names":["forwardRef","useComponentDefaultProps","useRef","assignRef","React","useMergedRef"],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,m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+
{"version":3,"file":"FileButton.js","sources":["../../src/FileButton/FileButton.tsx"],"sourcesContent":["/* eslint-disable react/no-unused-prop-types */\nimport React, { useRef, forwardRef } from 'react';\nimport { useComponentDefaultProps } from '@mantine/styles';\nimport { assignRef, useMergedRef } from '@mantine/hooks';\n\nexport interface FileButtonProps<Multiple extends boolean = false> {\n /** Called when files are picked */\n onChange(payload: Multiple extends true ? File[] : File | null): void;\n\n /** Function that receives button props and returns react node that should be rendered */\n children(props: { onClick(): void }): React.ReactNode;\n\n /** Determines whether user can pick more than one file */\n multiple?: Multiple;\n\n /** File input accept attribute, for example, \"image/png,image/jpeg\" */\n accept?: string;\n\n /** Input name attribute */\n name?: string;\n\n /** Input form attribute */\n form?: string;\n\n /** Function that should be called when value changes to null or empty array */\n resetRef?: React.ForwardedRef<() => void>;\n\n /** Disables file picker */\n disabled?: boolean;\n\n /** Specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. */\n capture?: boolean | 'user' | 'environment';\n\n /** Spreads props to input element used to capture files */\n inputProps?: React.ComponentPropsWithoutRef<'input'>;\n}\n\nconst defaultProps: Partial<FileButtonProps> = {\n multiple: false,\n};\n\ntype FileButtonComponent = (<Multiple extends boolean = false>(\n props: FileButtonProps<Multiple>\n) => React.ReactElement) & { displayName?: string };\n\nexport const FileButton: FileButtonComponent = forwardRef<HTMLInputElement, FileButtonProps>(\n (props, ref) => {\n const {\n onChange,\n children,\n multiple,\n accept,\n name,\n form,\n resetRef,\n disabled,\n capture,\n inputProps,\n ...others\n } = useComponentDefaultProps('FileButton', defaultProps, props);\n\n const inputRef = useRef<HTMLInputElement>();\n\n const onClick = () => {\n !disabled && inputRef.current.click();\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (multiple) {\n onChange(Array.from(event.currentTarget.files) as any);\n } else {\n onChange(event.currentTarget.files[0] || null);\n }\n };\n\n const reset = () => {\n inputRef.current.value = '';\n };\n\n assignRef(resetRef, reset);\n\n return (\n <>\n {children({ onClick, ...others })}\n\n <input\n style={{ display: 'none' }}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleChange}\n ref={useMergedRef(ref, inputRef)}\n name={name}\n form={form}\n capture={capture}\n {...inputProps}\n />\n </>\n );\n }\n) as any;\n\nFileButton.displayName = '@mantine/core/FileButton';\n"],"names":["forwardRef","useComponentDefaultProps","useRef","assignRef","React","useMergedRef"],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,QAAQ,eA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E,MAAM;AAChB,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,QAAQ,EAAE,YAAY;AAC1B,IAAI,GAAG,EAAEC,kBAAY,CAAC,GAAG,EAAE,QAAQ,CAAC;AACpC,IAAI,IAAI;AACR,IAAI,IAAI;AACR,IAAI,OAAO;AACX,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,EAAE;AACH,UAAU,CAAC,WAAW,GAAG,0BAA0B;;;;"}
|
|
@@ -83,7 +83,8 @@ const _FileInput = React.forwardRef((props, ref) => {
|
|
|
83
83
|
clearButtonLabel,
|
|
84
84
|
clearButtonTabIndex,
|
|
85
85
|
readOnly,
|
|
86
|
-
capture
|
|
86
|
+
capture,
|
|
87
|
+
fileInputProps
|
|
87
88
|
} = _a, others = __objRest(_a, [
|
|
88
89
|
"inputProps",
|
|
89
90
|
"wrapperProps",
|
|
@@ -105,7 +106,8 @@ const _FileInput = React.forwardRef((props, ref) => {
|
|
|
105
106
|
"clearButtonLabel",
|
|
106
107
|
"clearButtonTabIndex",
|
|
107
108
|
"readOnly",
|
|
108
|
-
"capture"
|
|
109
|
+
"capture",
|
|
110
|
+
"fileInputProps"
|
|
109
111
|
]);
|
|
110
112
|
const resetRef = React.useRef();
|
|
111
113
|
const { classes, theme, cx } = FileInput_styles['default'](null, {
|
|
@@ -144,7 +146,8 @@ const _FileInput = React.forwardRef((props, ref) => {
|
|
|
144
146
|
form,
|
|
145
147
|
resetRef,
|
|
146
148
|
disabled: readOnly,
|
|
147
|
-
capture
|
|
149
|
+
capture,
|
|
150
|
+
inputProps: fileInputProps
|
|
148
151
|
}, (fileButtonProps) => /* @__PURE__ */ React__default.createElement(Input.Input, __spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
149
152
|
multiline: true
|
|
150
153
|
}, fileButtonProps), inputProps), others), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.js","sources":["../../src/FileInput/FileInput.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\nimport { DefaultProps, MantineSize, Selectors } from '@mantine/styles';\nimport { useUncontrolled } from '@mantine/hooks';\nimport {\n Input,\n InputSharedProps,\n InputStylesNames,\n useInputProps,\n InputWrapperBaseProps,\n InputWrapperStylesNames,\n} from '../Input';\nimport { Text } from '../Text';\nimport { CloseButton } from '../CloseButton';\nimport { FileButton } from '../FileButton';\nimport useStyles from './FileInput.styles';\n\nexport type FileInputStylesNames =\n | InputStylesNames\n | InputWrapperStylesNames\n | Selectors<typeof useStyles>;\n\nexport interface FileInputProps<Multiple extends boolean = false>\n extends DefaultProps<FileInputStylesNames>,\n InputSharedProps,\n InputWrapperBaseProps,\n Omit<React.ComponentPropsWithoutRef<'button'>, 'size' | 'onChange' | 'value' | 'defaultValue'> {\n /** Props passed to root element (InputWrapper component) */\n wrapperProps?: Record<string, any>;\n\n /** Called when user picks files */\n onChange?(payload: Multiple extends true ? File[] : File | null): void;\n\n /** Controlled input value */\n value?: Multiple extends true ? File[] : File | null;\n\n /** Uncontrolled input default value */\n defaultValue?: Multiple extends true ? File[] : File | null;\n\n /** Input size */\n size?: MantineSize;\n\n /** Determines whether user can pick more than one file */\n multiple?: Multiple;\n\n /** File input accept attribute, for example, \"image/png,image/jpeg\" */\n accept?: string;\n\n /** Input name attribute */\n name?: string;\n\n /** Input form attribute */\n form?: string;\n\n /** Current value renderer */\n valueComponent?: React.FC<{ value: null | File | File[] }>;\n\n /** Allow to clear value */\n clearable?: boolean;\n\n /** aria-label for clear button */\n clearButtonLabel?: string;\n\n /** Set the clear button tab index to disabled or default after input field */\n clearButtonTabIndex?: -1 | 0;\n\n /** Determines whether the user can change value */\n readOnly?: boolean;\n\n /** Specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. */\n capture?: boolean | 'user' | 'environment';\n}\n\nconst DefaultValue: FileInputProps['valueComponent'] = ({ value }) => (\n <Text sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>\n {Array.isArray(value) ? value.map((file) => file.name).join(', ') : value?.name}\n </Text>\n);\n\nconst defaultProps: Partial<FileInputProps> = {\n size: 'sm',\n valueComponent: DefaultValue,\n clearButtonTabIndex: 0,\n};\n\nconst RIGHT_SECTION_WIDTH = {\n xs: 24,\n sm: 30,\n md: 34,\n lg: 40,\n xl: 44,\n};\n\nexport const _FileInput = forwardRef<HTMLButtonElement, FileInputProps>((props, ref) => {\n const {\n inputProps,\n wrapperProps,\n placeholder,\n value,\n defaultValue,\n onChange,\n multiple,\n accept,\n name,\n form,\n classNames,\n styles,\n unstyled,\n valueComponent: ValueComponent,\n rightSection,\n rightSectionWidth,\n clearable,\n clearButtonLabel,\n clearButtonTabIndex,\n readOnly,\n capture,\n ...others\n } = useInputProps('FileInput', defaultProps, props);\n const resetRef = useRef<() => void>();\n const { classes, theme, cx } = useStyles(null, {\n name: 'FileInput',\n classNames,\n styles,\n unstyled,\n });\n\n const [_value, setValue] = useUncontrolled<File | File[]>({\n value,\n defaultValue,\n onChange,\n finalValue: multiple ? [] : null,\n });\n\n const hasValue = Array.isArray(_value) ? _value.length !== 0 : _value !== null;\n\n const _rightSection =\n rightSection ||\n (clearable && hasValue && !readOnly ? (\n <CloseButton\n variant=\"transparent\"\n aria-label={clearButtonLabel}\n onClick={() => setValue(multiple ? [] : null)}\n size={inputProps.size}\n tabIndex={clearButtonTabIndex}\n unstyled={unstyled}\n />\n ) : null);\n\n useEffect(() => {\n if ((Array.isArray(_value) && _value.length === 0) || _value === null) {\n resetRef.current();\n }\n }, [_value]);\n\n return (\n <Input.Wrapper {...wrapperProps} __staticSelector=\"FileInput\">\n <FileButton\n onChange={setValue}\n multiple={multiple}\n accept={accept}\n name={name}\n form={form}\n resetRef={resetRef}\n disabled={readOnly}\n capture={capture}\n >\n {(fileButtonProps) => (\n <Input\n multiline\n {...fileButtonProps}\n {...inputProps}\n {...others}\n component=\"button\"\n type=\"button\"\n ref={ref}\n __staticSelector=\"FileInput\"\n rightSection={_rightSection}\n rightSectionWidth={\n rightSectionWidth ||\n theme.fn.size({ size: inputProps.size, sizes: RIGHT_SECTION_WIDTH })\n }\n classNames={{ ...classNames, input: cx(classes.input, (classNames as any)?.input) }}\n >\n {!hasValue ? (\n <Input.Placeholder className={classes.placeholder}>{placeholder}</Input.Placeholder>\n ) : (\n <ValueComponent value={_value} />\n )}\n </Input>\n )}\n </FileButton>\n </Input.Wrapper>\n );\n});\n\n_FileInput.displayName = '@mantine/core/FileInput';\n\ntype FileInputComponent = <Multiple extends boolean = false>(\n props: FileInputProps<Multiple> & {\n ref?: React.ForwardedRef<HTMLButtonElement>;\n }\n) => JSX.Element;\n\nexport const FileInput: FileInputComponent = _FileInput as any;\n"],"names":["React","Text","forwardRef","useInputProps","useRef","useStyles","useUncontrolled","CloseButton","useEffect","Input","FileButton"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAA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AC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE;AAC7C,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,GAAG;AACP,IAAI,gBAAgB,EAAE,WAAW;AACjC,IAAI,YAAY,EAAE,aAAa;AAC/B,IAAI,iBAAiB,EAAE,iBAAiB,IAAI,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;AAChH,IAAI,UAAU,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;AAC3I,GAAG,CAAC,EAAE,CAAC,QAAQ,mBAAmBT,cAAK,CAAC,aAAa,CAACS,WAAK,CAAC,WAAW,EAAE;AACzE,IAAI,SAAS,EAAE,OAAO,CAAC,WAAW;AAClC,GAAG,EAAE,WAAW,CAAC,mBAAmBT,cAAK,CAAC,aAAa,CAAC,cAAc,EAAE;AACxE,IAAI,KAAK,EAAE,MAAM;AACjB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,EAAE;AACH,UAAU,CAAC,WAAW,GAAG,yBAAyB,CAAC;AACvC,MAAC,SAAS,GAAG;;;;;"}
|
|
1
|
+
{"version":3,"file":"FileInput.js","sources":["../../src/FileInput/FileInput.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\nimport { DefaultProps, MantineSize, Selectors } from '@mantine/styles';\nimport { useUncontrolled } from '@mantine/hooks';\nimport {\n Input,\n InputSharedProps,\n InputStylesNames,\n useInputProps,\n InputWrapperBaseProps,\n InputWrapperStylesNames,\n} from '../Input';\nimport { Text } from '../Text';\nimport { CloseButton } from '../CloseButton';\nimport { FileButton } from '../FileButton';\nimport useStyles from './FileInput.styles';\n\nexport type FileInputStylesNames =\n | InputStylesNames\n | InputWrapperStylesNames\n | Selectors<typeof useStyles>;\n\nexport interface FileInputProps<Multiple extends boolean = false>\n extends DefaultProps<FileInputStylesNames>,\n InputSharedProps,\n InputWrapperBaseProps,\n Omit<React.ComponentPropsWithoutRef<'button'>, 'size' | 'onChange' | 'value' | 'defaultValue'> {\n /** Props passed to root element (InputWrapper component) */\n wrapperProps?: Record<string, any>;\n\n /** Called when user picks files */\n onChange?(payload: Multiple extends true ? File[] : File | null): void;\n\n /** Controlled input value */\n value?: Multiple extends true ? File[] : File | null;\n\n /** Uncontrolled input default value */\n defaultValue?: Multiple extends true ? File[] : File | null;\n\n /** Input size */\n size?: MantineSize;\n\n /** Determines whether user can pick more than one file */\n multiple?: Multiple;\n\n /** File input accept attribute, for example, \"image/png,image/jpeg\" */\n accept?: string;\n\n /** Input name attribute */\n name?: string;\n\n /** Input form attribute */\n form?: string;\n\n /** Current value renderer */\n valueComponent?: React.FC<{ value: null | File | File[] }>;\n\n /** Allow to clear value */\n clearable?: boolean;\n\n /** aria-label for clear button */\n clearButtonLabel?: string;\n\n /** Set the clear button tab index to disabled or default after input field */\n clearButtonTabIndex?: -1 | 0;\n\n /** Determines whether the user can change value */\n readOnly?: boolean;\n\n /** Specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute. */\n capture?: boolean | 'user' | 'environment';\n\n /** Spreads props to input element used to capture files */\n fileInputProps?: React.ComponentPropsWithoutRef<'input'>;\n}\n\nconst DefaultValue: FileInputProps['valueComponent'] = ({ value }) => (\n <Text sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>\n {Array.isArray(value) ? value.map((file) => file.name).join(', ') : value?.name}\n </Text>\n);\n\nconst defaultProps: Partial<FileInputProps> = {\n size: 'sm',\n valueComponent: DefaultValue,\n clearButtonTabIndex: 0,\n};\n\nconst RIGHT_SECTION_WIDTH = {\n xs: 24,\n sm: 30,\n md: 34,\n lg: 40,\n xl: 44,\n};\n\nexport const _FileInput = forwardRef<HTMLButtonElement, FileInputProps>((props, ref) => {\n const {\n inputProps,\n wrapperProps,\n placeholder,\n value,\n defaultValue,\n onChange,\n multiple,\n accept,\n name,\n form,\n classNames,\n styles,\n unstyled,\n valueComponent: ValueComponent,\n rightSection,\n rightSectionWidth,\n clearable,\n clearButtonLabel,\n clearButtonTabIndex,\n readOnly,\n capture,\n fileInputProps,\n ...others\n } = useInputProps('FileInput', defaultProps, props);\n const resetRef = useRef<() => void>();\n const { classes, theme, cx } = useStyles(null, {\n name: 'FileInput',\n classNames,\n styles,\n unstyled,\n });\n\n const [_value, setValue] = useUncontrolled<File | File[]>({\n value,\n defaultValue,\n onChange,\n finalValue: multiple ? [] : null,\n });\n\n const hasValue = Array.isArray(_value) ? _value.length !== 0 : _value !== null;\n\n const _rightSection =\n rightSection ||\n (clearable && hasValue && !readOnly ? (\n <CloseButton\n variant=\"transparent\"\n aria-label={clearButtonLabel}\n onClick={() => setValue(multiple ? [] : null)}\n size={inputProps.size}\n tabIndex={clearButtonTabIndex}\n unstyled={unstyled}\n />\n ) : null);\n\n useEffect(() => {\n if ((Array.isArray(_value) && _value.length === 0) || _value === null) {\n resetRef.current();\n }\n }, [_value]);\n\n return (\n <Input.Wrapper {...wrapperProps} __staticSelector=\"FileInput\">\n <FileButton\n onChange={setValue}\n multiple={multiple}\n accept={accept}\n name={name}\n form={form}\n resetRef={resetRef}\n disabled={readOnly}\n capture={capture}\n inputProps={fileInputProps}\n >\n {(fileButtonProps) => (\n <Input\n multiline\n {...fileButtonProps}\n {...inputProps}\n {...others}\n component=\"button\"\n type=\"button\"\n ref={ref}\n __staticSelector=\"FileInput\"\n rightSection={_rightSection}\n rightSectionWidth={\n rightSectionWidth ||\n theme.fn.size({ size: inputProps.size, sizes: RIGHT_SECTION_WIDTH })\n }\n classNames={{ ...classNames, input: cx(classes.input, (classNames as any)?.input) }}\n >\n {!hasValue ? (\n <Input.Placeholder className={classes.placeholder}>{placeholder}</Input.Placeholder>\n ) : (\n <ValueComponent value={_value} />\n )}\n </Input>\n )}\n </FileButton>\n </Input.Wrapper>\n );\n});\n\n_FileInput.displayName = '@mantine/core/FileInput';\n\ntype FileInputComponent = <Multiple extends boolean = false>(\n props: FileInputProps<Multiple> & {\n ref?: React.ForwardedRef<HTMLButtonElement>;\n }\n) => JSX.Element;\n\nexport const FileInput: FileInputComponent = _FileInput as any;\n"],"names":["React","Text","forwardRef","useInputProps","useRef","useStyles","useUncontrolled","CloseButton","useEffect","Input","FileButton"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,E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AACvB,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,GAAG;AACP,IAAI,gBAAgB,EAAE,WAAW;AACjC,IAAI,YAAY,EAAE,aAAa;AAC/B,IAAI,iBAAiB,EAAE,iBAAiB,IAAI,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;AAChH,IAAI,UAAU,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;AAC3I,GAAG,CAAC,EAAE,CAAC,QAAQ,mBAAmBT,cAAK,CAAC,aAAa,CAACS,WAAK,CAAC,WAAW,EAAE;AACzE,IAAI,SAAS,EAAE,OAAO,CAAC,WAAW;AAClC,GAAG,EAAE,WAAW,CAAC,mBAAmBT,cAAK,CAAC,aAAa,CAAC,cAAc,EAAE;AACxE,IAAI,KAAK,EAAE,MAAM;AACjB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,EAAE;AACH,UAAU,CAAC,WAAW,GAAG,yBAAyB,CAAC;AACvC,MAAC,SAAS,GAAG;;;;;"}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var react = require('@floating-ui/react');
|
|
7
7
|
var hooks = require('@mantine/hooks');
|
|
8
8
|
|
|
9
9
|
function useFloatingAutoUpdate({ opened, floating, positionDependencies }) {
|
|
10
10
|
const [delayedUpdate, setDelayedUpdate] = React.useState(0);
|
|
11
11
|
React.useEffect(() => {
|
|
12
12
|
if (floating.refs.reference.current && floating.refs.floating.current) {
|
|
13
|
-
return
|
|
13
|
+
return react.autoUpdate(floating.refs.reference.current, floating.refs.floating.current, floating.update);
|
|
14
14
|
}
|
|
15
15
|
return void 0;
|
|
16
16
|
}, [floating.refs.reference, floating.refs.floating, opened, delayedUpdate]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-floating-auto-update.js","sources":["../../src/Floating/use-floating-auto-update.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { autoUpdate } from '@floating-ui/react
|
|
1
|
+
{"version":3,"file":"use-floating-auto-update.js","sources":["../../src/Floating/use-floating-auto-update.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { autoUpdate } from '@floating-ui/react';\nimport { useDidUpdate } from '@mantine/hooks';\n\ninterface Payload {\n opened: boolean;\n floating: {\n update(): void;\n refs: {\n floating: React.MutableRefObject<any>;\n reference: React.MutableRefObject<any>;\n };\n };\n positionDependencies: any[];\n}\n\nexport function useFloatingAutoUpdate({ opened, floating, positionDependencies }: Payload) {\n const [delayedUpdate, setDelayedUpdate] = useState(0);\n\n useEffect(() => {\n if (floating.refs.reference.current && floating.refs.floating.current) {\n return autoUpdate(\n floating.refs.reference.current,\n floating.refs.floating.current,\n floating.update\n );\n }\n\n return undefined;\n }, [floating.refs.reference, floating.refs.floating, opened, delayedUpdate]);\n\n useDidUpdate(() => {\n floating.update();\n }, positionDependencies);\n\n useDidUpdate(() => {\n setDelayedUpdate((c) => c + 1);\n }, [opened]);\n}\n"],"names":["useState","useEffect","autoUpdate","useDidUpdate"],"mappings":";;;;;;;;AAGO,SAAS,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE;AAClF,EAAE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAC,CAAC,CAAC,CAAC;AACxD,EAAEC,eAAS,CAAC,MAAM;AAClB,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC3E,MAAM,OAAOC,gBAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC1G,KAAK;AACL,IAAI,OAAO,KAAK,CAAC,CAAC;AAClB,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAC/E,EAAEC,kBAAY,CAAC,MAAM;AACrB,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;AACtB,GAAG,EAAE,oBAAoB,CAAC,CAAC;AAC3B,EAAEA,kBAAY,CAAC,MAAM;AACrB,IAAI,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACnC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACf;;;;"}
|
|
@@ -52,7 +52,7 @@ function useInputProps(component, defaultProps, props) {
|
|
|
52
52
|
errorProps,
|
|
53
53
|
labelProps,
|
|
54
54
|
descriptionProps,
|
|
55
|
-
wrapperProps,
|
|
55
|
+
wrapperProps: _wrapperProps,
|
|
56
56
|
id,
|
|
57
57
|
size,
|
|
58
58
|
style,
|
|
@@ -83,31 +83,32 @@ function useInputProps(component, defaultProps, props) {
|
|
|
83
83
|
]);
|
|
84
84
|
const uid = hooks.useId(id);
|
|
85
85
|
const { systemStyles, rest } = extractSystemStyles.extractSystemStyles(others);
|
|
86
|
+
const wrapperProps = __spreadValues({
|
|
87
|
+
label,
|
|
88
|
+
description,
|
|
89
|
+
error,
|
|
90
|
+
required,
|
|
91
|
+
classNames,
|
|
92
|
+
className,
|
|
93
|
+
__staticSelector,
|
|
94
|
+
sx,
|
|
95
|
+
errorProps,
|
|
96
|
+
labelProps,
|
|
97
|
+
descriptionProps,
|
|
98
|
+
unstyled,
|
|
99
|
+
styles: styles$1,
|
|
100
|
+
id: uid,
|
|
101
|
+
size,
|
|
102
|
+
style,
|
|
103
|
+
inputContainer,
|
|
104
|
+
inputWrapperOrder,
|
|
105
|
+
withAsterisk
|
|
106
|
+
}, _wrapperProps);
|
|
86
107
|
return __spreadProps(__spreadValues({}, rest), {
|
|
87
108
|
classNames,
|
|
88
109
|
styles: styles$1,
|
|
89
110
|
unstyled,
|
|
90
|
-
wrapperProps: __spreadValues(__spreadValues({
|
|
91
|
-
label,
|
|
92
|
-
description,
|
|
93
|
-
error,
|
|
94
|
-
required,
|
|
95
|
-
classNames,
|
|
96
|
-
className,
|
|
97
|
-
__staticSelector,
|
|
98
|
-
sx,
|
|
99
|
-
errorProps,
|
|
100
|
-
labelProps,
|
|
101
|
-
descriptionProps,
|
|
102
|
-
unstyled,
|
|
103
|
-
styles: styles$1,
|
|
104
|
-
id: uid,
|
|
105
|
-
size,
|
|
106
|
-
style,
|
|
107
|
-
inputContainer,
|
|
108
|
-
inputWrapperOrder,
|
|
109
|
-
withAsterisk
|
|
110
|
-
}, wrapperProps), systemStyles),
|
|
111
|
+
wrapperProps: __spreadValues(__spreadValues({}, wrapperProps), systemStyles),
|
|
111
112
|
inputProps: {
|
|
112
113
|
required,
|
|
113
114
|
classNames,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-input-props.js","sources":["../../src/Input/use-input-props.ts"],"sourcesContent":["import { useComponentDefaultProps, DefaultProps } from '@mantine/styles';\nimport { useId } from '@mantine/hooks';\nimport { extractSystemStyles } from '../Box';\nimport { InputWrapperBaseProps } from './InputWrapper/InputWrapper';\nimport { InputSharedProps } from './Input';\n\ninterface BaseProps extends InputWrapperBaseProps, InputSharedProps, DefaultProps {\n __staticSelector?: string;\n id?: string;\n}\n\
|
|
1
|
+
{"version":3,"file":"use-input-props.js","sources":["../../src/Input/use-input-props.ts"],"sourcesContent":["import { useComponentDefaultProps, DefaultProps, MantineStyleSystemProps } from '@mantine/styles';\nimport { useId } from '@mantine/hooks';\nimport { extractSystemStyles } from '../Box';\nimport { InputWrapperBaseProps } from './InputWrapper/InputWrapper';\nimport { InputSharedProps } from './Input';\n\ninterface BaseProps extends InputWrapperBaseProps, InputSharedProps, DefaultProps {\n __staticSelector?: string;\n id?: string;\n}\n\nexport function useInputProps<T extends BaseProps, U extends Partial<T>>(\n component: string,\n defaultProps: U,\n props: T\n) {\n const {\n label,\n description,\n error,\n required,\n classNames,\n styles,\n className,\n unstyled,\n __staticSelector,\n sx,\n errorProps,\n labelProps,\n descriptionProps,\n wrapperProps: _wrapperProps,\n id,\n size,\n style,\n inputContainer,\n inputWrapperOrder,\n withAsterisk,\n ...others\n } = useComponentDefaultProps<T>(component, defaultProps, props);\n\n const uid = useId(id);\n\n const { systemStyles, rest } = extractSystemStyles(others);\n\n const wrapperProps = {\n label,\n description,\n error,\n required,\n classNames,\n className,\n __staticSelector,\n sx,\n errorProps,\n labelProps,\n descriptionProps,\n unstyled,\n styles,\n id: uid,\n size,\n style,\n inputContainer,\n inputWrapperOrder,\n withAsterisk,\n ..._wrapperProps,\n };\n\n return {\n ...rest,\n classNames,\n styles,\n unstyled,\n wrapperProps: {\n ...wrapperProps,\n ...systemStyles,\n } as typeof wrapperProps & MantineStyleSystemProps,\n inputProps: {\n required,\n classNames,\n styles,\n unstyled,\n id: uid,\n size,\n __staticSelector,\n invalid: !!error,\n },\n };\n}\n"],"names":["useComponentDefaultProps","styles","useId","extractSystemStyles"],"mappings":";;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,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C,KAAK;AACtB,KAAK;AACL,GAAG,CAAC,CAAC;AACL;;;;"}
|
|
@@ -68,7 +68,12 @@ function filterValue(value, data) {
|
|
|
68
68
|
if (data.length === 0) {
|
|
69
69
|
return [];
|
|
70
70
|
}
|
|
71
|
-
const flatData =
|
|
71
|
+
const flatData = data.map((item) => {
|
|
72
|
+
if (typeof item === "object") {
|
|
73
|
+
return item.value;
|
|
74
|
+
}
|
|
75
|
+
return item;
|
|
76
|
+
});
|
|
72
77
|
return value.filter((val) => flatData.includes(val));
|
|
73
78
|
}
|
|
74
79
|
const defaultProps = {
|
|
@@ -93,7 +98,8 @@ const defaultProps = {
|
|
|
93
98
|
zIndex: styles.getDefaultZIndex("popover"),
|
|
94
99
|
selectOnBlur: false,
|
|
95
100
|
clearButtonTabIndex: 0,
|
|
96
|
-
positionDependencies: []
|
|
101
|
+
positionDependencies: [],
|
|
102
|
+
dropdownPosition: "flip"
|
|
97
103
|
};
|
|
98
104
|
const MultiSelect = React.forwardRef((props, ref) => {
|
|
99
105
|
const _a = styles.useComponentDefaultProps("MultiSelect", defaultProps, props), {
|
|
@@ -165,7 +171,9 @@ const MultiSelect = React.forwardRef((props, ref) => {
|
|
|
165
171
|
inputContainer,
|
|
166
172
|
inputWrapperOrder,
|
|
167
173
|
readOnly,
|
|
168
|
-
withAsterisk
|
|
174
|
+
withAsterisk,
|
|
175
|
+
hoverOnSearchChange,
|
|
176
|
+
disableSelectedItemFiltering
|
|
169
177
|
} = _a, others = __objRest(_a, [
|
|
170
178
|
"className",
|
|
171
179
|
"style",
|
|
@@ -235,7 +243,9 @@ const MultiSelect = React.forwardRef((props, ref) => {
|
|
|
235
243
|
"inputContainer",
|
|
236
244
|
"inputWrapperOrder",
|
|
237
245
|
"readOnly",
|
|
238
|
-
"withAsterisk"
|
|
246
|
+
"withAsterisk",
|
|
247
|
+
"hoverOnSearchChange",
|
|
248
|
+
"disableSelectedItemFiltering"
|
|
239
249
|
]);
|
|
240
250
|
const { classes, cx, theme } = MultiSelect_styles['default']({ size, invalid: !!error }, { classNames, styles: styles$1, unstyled, name: "MultiSelect" });
|
|
241
251
|
const { systemStyles, rest } = extractSystemStyles.extractSystemStyles(others);
|
|
@@ -292,7 +302,8 @@ const MultiSelect = React.forwardRef((props, ref) => {
|
|
|
292
302
|
searchValue: _searchValue,
|
|
293
303
|
limit,
|
|
294
304
|
filter,
|
|
295
|
-
value: _value
|
|
305
|
+
value: _value,
|
|
306
|
+
disableSelectedItemFiltering
|
|
296
307
|
});
|
|
297
308
|
const getNextIndex = (index, nextItem, compareFn) => {
|
|
298
309
|
let i = index;
|
|
@@ -304,8 +315,12 @@ const MultiSelect = React.forwardRef((props, ref) => {
|
|
|
304
315
|
return index;
|
|
305
316
|
};
|
|
306
317
|
hooks.useDidUpdate(() => {
|
|
307
|
-
|
|
308
|
-
|
|
318
|
+
if (hoverOnSearchChange && _searchValue) {
|
|
319
|
+
setHovered(0);
|
|
320
|
+
} else {
|
|
321
|
+
setHovered(-1);
|
|
322
|
+
}
|
|
323
|
+
}, [_searchValue, hoverOnSearchChange]);
|
|
309
324
|
hooks.useDidUpdate(() => {
|
|
310
325
|
if (!disabled && _value.length > data.length) {
|
|
311
326
|
setDropdownOpened(false);
|
|
@@ -496,6 +511,7 @@ const MultiSelect = React.forwardRef((props, ref) => {
|
|
|
496
511
|
classNames,
|
|
497
512
|
radius
|
|
498
513
|
})));
|
|
514
|
+
const isItemSelected = (itemValue) => _value.includes(itemValue);
|
|
499
515
|
const handleClear = () => {
|
|
500
516
|
var _a2;
|
|
501
517
|
handleSearchChange("");
|
|
@@ -545,7 +561,7 @@ const MultiSelect = React.forwardRef((props, ref) => {
|
|
|
545
561
|
switchDirectionOnFlip,
|
|
546
562
|
zIndex,
|
|
547
563
|
dropdownPosition,
|
|
548
|
-
positionDependencies,
|
|
564
|
+
positionDependencies: [...positionDependencies, _searchValue],
|
|
549
565
|
classNames,
|
|
550
566
|
styles: styles$1,
|
|
551
567
|
unstyled
|
|
@@ -644,6 +660,7 @@ const MultiSelect = React.forwardRef((props, ref) => {
|
|
|
644
660
|
itemComponent,
|
|
645
661
|
size,
|
|
646
662
|
nothingFound,
|
|
663
|
+
isItemSelected,
|
|
647
664
|
creatable: creatable && !!createLabel,
|
|
648
665
|
createLabel,
|
|
649
666
|
unstyled
|