@mantine/core 7.0.0-alpha.14 → 7.0.0-alpha.15
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/Accordion/Accordion.context.js +13 -0
- package/cjs/components/Accordion/Accordion.context.js.map +1 -0
- package/cjs/components/Accordion/Accordion.js +182 -0
- package/cjs/components/Accordion/Accordion.js.map +1 -0
- package/cjs/components/Accordion/Accordion.module.css.js +8 -0
- package/cjs/components/Accordion/Accordion.module.css.js.map +1 -0
- package/cjs/components/Accordion/AccordionChevron.js +67 -0
- package/cjs/components/Accordion/AccordionChevron.js.map +1 -0
- package/cjs/components/Accordion/AccordionControl/AccordionControl.js +134 -0
- package/cjs/components/Accordion/AccordionControl/AccordionControl.js.map +1 -0
- package/cjs/components/Accordion/AccordionItem/AccordionItem.js +65 -0
- package/cjs/components/Accordion/AccordionItem/AccordionItem.js.map +1 -0
- package/cjs/components/Accordion/AccordionItem.context.js +11 -0
- package/cjs/components/Accordion/AccordionItem.context.js.map +1 -0
- package/cjs/components/Accordion/AccordionPanel/AccordionPanel.js +75 -0
- package/cjs/components/Accordion/AccordionPanel/AccordionPanel.js.map +1 -0
- package/cjs/components/ActionIcon/ActionIcon.js +1 -1
- package/cjs/components/ActionIcon/ActionIcon.js.map +1 -1
- package/cjs/components/ActionIcon/ActionIconGroup/ActionIconGroup.js +1 -1
- package/cjs/components/Center/Center.js +1 -1
- package/cjs/components/Center/Center.js.map +1 -1
- package/cjs/components/Checkbox/CheckIcon.js +24 -12
- package/cjs/components/Checkbox/CheckIcon.js.map +1 -1
- package/cjs/components/Combobox/Combobox.js +4 -0
- package/cjs/components/Combobox/Combobox.js.map +1 -1
- package/cjs/components/Combobox/Combobox.module.css.js +1 -1
- package/cjs/components/Combobox/ComboboxFooter/ComboboxFooter.js +63 -0
- package/cjs/components/Combobox/ComboboxFooter/ComboboxFooter.js.map +1 -0
- package/cjs/components/Combobox/ComboboxHeader/ComboboxHeader.js +63 -0
- package/cjs/components/Combobox/ComboboxHeader/ComboboxHeader.js.map +1 -0
- package/cjs/components/Combobox/ComboboxSearch/ComboboxSearch.js +1 -0
- package/cjs/components/Combobox/ComboboxSearch/ComboboxSearch.js.map +1 -1
- package/cjs/components/Combobox/ComboboxTarget/ComboboxTarget.js +3 -5
- package/cjs/components/Combobox/ComboboxTarget/ComboboxTarget.js.map +1 -1
- package/cjs/components/Combobox/use-combobox/use-combobox.js +102 -66
- package/cjs/components/Combobox/use-combobox/use-combobox.js.map +1 -1
- package/cjs/components/Combobox/use-combobox/use-virtualized-combobox.js +2 -0
- package/cjs/components/Combobox/use-combobox/use-virtualized-combobox.js.map +1 -1
- package/cjs/components/Combobox/use-combobox-target-props/use-combobox-target-props.js +14 -4
- package/cjs/components/Combobox/use-combobox-target-props/use-combobox-target-props.js.map +1 -1
- package/cjs/components/InputBase/InputBase.js.map +1 -1
- package/cjs/components/Loader/Loader.js +2 -2
- package/cjs/components/Tabs/Tabs.js +1 -1
- package/cjs/components/Tabs/TabsTab/TabsTab.js +1 -1
- package/cjs/index.css +263 -12
- package/cjs/index.js +14 -4
- package/cjs/index.js.map +1 -1
- package/esm/components/Accordion/Accordion.context.js +8 -0
- package/esm/components/Accordion/Accordion.context.js.map +1 -0
- package/esm/components/Accordion/Accordion.js +174 -0
- package/esm/components/Accordion/Accordion.js.map +1 -0
- package/esm/components/Accordion/Accordion.module.css.js +4 -0
- package/esm/components/Accordion/Accordion.module.css.js.map +1 -0
- package/esm/components/Accordion/AccordionChevron.js +59 -0
- package/esm/components/Accordion/AccordionChevron.js.map +1 -0
- package/esm/components/Accordion/AccordionControl/AccordionControl.js +126 -0
- package/esm/components/Accordion/AccordionControl/AccordionControl.js.map +1 -0
- package/esm/components/Accordion/AccordionItem/AccordionItem.js +57 -0
- package/esm/components/Accordion/AccordionItem/AccordionItem.js.map +1 -0
- package/esm/components/Accordion/AccordionItem.context.js +6 -0
- package/esm/components/Accordion/AccordionItem.context.js.map +1 -0
- package/esm/components/Accordion/AccordionPanel/AccordionPanel.js +67 -0
- package/esm/components/Accordion/AccordionPanel/AccordionPanel.js.map +1 -0
- package/esm/components/ActionIcon/ActionIcon.js +1 -1
- package/esm/components/ActionIcon/ActionIcon.js.map +1 -1
- package/esm/components/ActionIcon/ActionIconGroup/ActionIconGroup.js +1 -1
- package/esm/components/Center/Center.js +1 -1
- package/esm/components/Center/Center.js.map +1 -1
- package/esm/components/Checkbox/CheckIcon.js +24 -12
- package/esm/components/Checkbox/CheckIcon.js.map +1 -1
- package/esm/components/Combobox/Combobox.js +4 -0
- package/esm/components/Combobox/Combobox.js.map +1 -1
- package/esm/components/Combobox/Combobox.module.css.js +1 -1
- package/esm/components/Combobox/ComboboxFooter/ComboboxFooter.js +55 -0
- package/esm/components/Combobox/ComboboxFooter/ComboboxFooter.js.map +1 -0
- package/esm/components/Combobox/ComboboxHeader/ComboboxHeader.js +55 -0
- package/esm/components/Combobox/ComboboxHeader/ComboboxHeader.js.map +1 -0
- package/esm/components/Combobox/ComboboxSearch/ComboboxSearch.js +1 -0
- package/esm/components/Combobox/ComboboxSearch/ComboboxSearch.js.map +1 -1
- package/esm/components/Combobox/ComboboxTarget/ComboboxTarget.js +3 -5
- package/esm/components/Combobox/ComboboxTarget/ComboboxTarget.js.map +1 -1
- package/esm/components/Combobox/use-combobox/use-combobox.js +103 -67
- package/esm/components/Combobox/use-combobox/use-combobox.js.map +1 -1
- package/esm/components/Combobox/use-combobox/use-virtualized-combobox.js +2 -0
- package/esm/components/Combobox/use-combobox/use-virtualized-combobox.js.map +1 -1
- package/esm/components/Combobox/use-combobox-target-props/use-combobox-target-props.js +14 -4
- package/esm/components/Combobox/use-combobox-target-props/use-combobox-target-props.js.map +1 -1
- package/esm/components/InputBase/InputBase.js.map +1 -1
- package/esm/components/Loader/Loader.js +2 -2
- package/esm/components/Tabs/Tabs.js +1 -1
- package/esm/components/Tabs/TabsTab/TabsTab.js +1 -1
- package/esm/index.css +263 -12
- package/esm/index.js +7 -2
- package/esm/index.js.map +1 -1
- package/lib/components/Accordion/Accordion.context.d.ts +23 -0
- package/lib/components/Accordion/Accordion.d.ts +73 -0
- package/lib/components/Accordion/Accordion.types.d.ts +3 -0
- package/lib/components/Accordion/AccordionChevron.d.ts +9 -0
- package/lib/components/Accordion/AccordionControl/AccordionControl.d.ts +25 -0
- package/lib/components/Accordion/AccordionItem/AccordionItem.d.ts +18 -0
- package/lib/components/Accordion/AccordionItem.context.d.ts +9 -0
- package/lib/components/Accordion/AccordionPanel/AccordionPanel.d.ts +16 -0
- package/lib/components/Accordion/index.d.ts +11 -0
- package/lib/components/ActionIcon/ActionIcon.d.ts +2 -2
- package/lib/components/Checkbox/CheckIcon.d.ts +4 -1
- package/lib/components/Checkbox/index.d.ts +1 -1
- package/lib/components/ColorPicker/ColorPicker.context.d.ts +1 -0
- package/lib/components/Combobox/Combobox.context.d.ts +1 -0
- package/lib/components/Combobox/Combobox.d.ts +17 -1
- package/lib/components/Combobox/ComboboxFooter/ComboboxFooter.d.ts +16 -0
- package/lib/components/Combobox/ComboboxHeader/ComboboxHeader.d.ts +16 -0
- package/lib/components/Combobox/ComboboxTarget/ComboboxTarget.d.ts +5 -0
- package/lib/components/Combobox/index.d.ts +1 -1
- package/lib/components/Combobox/use-combobox/use-combobox.d.ts +12 -8
- package/lib/components/Combobox/use-combobox-target-props/use-combobox-target-props.d.ts +2 -1
- package/lib/components/Input/use-input-props.d.ts +65 -64
- package/lib/components/InputBase/InputBase.d.ts +2 -0
- package/lib/components/ModalBase/use-modal.d.ts +1 -0
- package/lib/components/ScrollArea/ScrollArea.context.d.ts +1 -0
- package/lib/components/ScrollArea/ScrollAreaScrollbar/Scrollbar.context.d.ts +1 -0
- package/lib/components/Slider/Slider.context.d.ts +1 -0
- package/lib/components/Table/Table.context.d.ts +1 -0
- package/lib/components/Tabs/Tabs.context.d.ts +1 -0
- package/lib/components/Tooltip/TooltipFloating/use-floating-tooltip.d.ts +1 -0
- package/lib/components/UnstyledButton/UnstyledButton.d.ts +1 -1
- package/lib/components/index.d.ts +3 -2
- package/lib/core/Box/Box.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxFooter.js","sources":["../../../../src/components/Combobox/ComboboxFooter/ComboboxFooter.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Box,\n BoxProps,\n StylesApiProps,\n factory,\n ElementProps,\n useProps,\n Factory,\n} from '../../../core';\nimport { useComboboxContext } from '../Combobox.context';\nimport classes from '../Combobox.module.css';\n\nexport type ComboboxFooterStylesNames = 'footer';\n\nexport interface ComboboxFooterProps\n extends BoxProps,\n StylesApiProps<ComboboxFooterFactory>,\n ElementProps<'div'> {}\n\nexport type ComboboxFooterFactory = Factory<{\n props: ComboboxFooterProps;\n ref: HTMLDivElement;\n stylesNames: ComboboxFooterStylesNames;\n compound: true;\n}>;\n\nconst defaultProps: Partial<ComboboxFooterProps> = {};\n\nexport const ComboboxFooter = factory<ComboboxFooterFactory>((props, ref) => {\n const { classNames, className, style, styles, unstyled, vars, ...others } = useProps(\n 'ComboboxFooter',\n defaultProps,\n props\n );\n const ctx = useComboboxContext();\n\n return (\n <Box\n ref={ref}\n {...ctx.getStyles('footer', { className, classNames, style, styles })}\n {...others}\n />\n );\n});\n\nComboboxFooter.classes = classes;\nComboboxFooter.displayName = '@mantine/core/ComboboxFooter';\n"],"names":[],"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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AI,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;AACtE,QAAQ,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,KAAK;AACL,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AASF,MAAM,YAAY,GAAG,EAAE,CAAC;AACZ,MAAC,cAAc,GAAG,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,GAAG,QAAQ;AACrB,IAAI,gBAAgB;AACpB,IAAI,YAAY;AAChB,IAAI,KAAK;AACT,GAAG,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/J,EAAE,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;AACnC,EAAE,uBAAuB,KAAK,CAAC,aAAa;AAC5C,IAAI,GAAG;AACP,IAAI,cAAc,CAAC,cAAc,CAAC;AAClC,MAAM,GAAG;AACT,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;AAClF,GAAG,CAAC;AACJ,CAAC,EAAE;AACH,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC;AACjC,cAAc,CAAC,WAAW,GAAG,8BAA8B;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useComboboxContext } from '../Combobox.context.js';
|
|
3
|
+
import classes from '../Combobox.module.css.js';
|
|
4
|
+
import { factory } from '../../../core/factory/factory.js';
|
|
5
|
+
import { useProps } from '../../../core/MantineProvider/use-props/use-props.js';
|
|
6
|
+
import { Box } from '../../../core/Box/Box.js';
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
const defaultProps = {};
|
|
37
|
+
const ComboboxHeader = factory((props, ref) => {
|
|
38
|
+
const _a = useProps(
|
|
39
|
+
"ComboboxHeader",
|
|
40
|
+
defaultProps,
|
|
41
|
+
props
|
|
42
|
+
), { classNames, className, style, styles, unstyled, vars } = _a, others = __objRest(_a, ["classNames", "className", "style", "styles", "unstyled", "vars"]);
|
|
43
|
+
const ctx = useComboboxContext();
|
|
44
|
+
return /* @__PURE__ */ React.createElement(
|
|
45
|
+
Box,
|
|
46
|
+
__spreadValues(__spreadValues({
|
|
47
|
+
ref
|
|
48
|
+
}, ctx.getStyles("header", { className, classNames, style, styles })), others)
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
ComboboxHeader.classes = classes;
|
|
52
|
+
ComboboxHeader.displayName = "@mantine/core/ComboboxHeader";
|
|
53
|
+
|
|
54
|
+
export { ComboboxHeader };
|
|
55
|
+
//# sourceMappingURL=ComboboxHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxHeader.js","sources":["../../../../src/components/Combobox/ComboboxHeader/ComboboxHeader.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Box,\n BoxProps,\n StylesApiProps,\n factory,\n ElementProps,\n useProps,\n Factory,\n} from '../../../core';\nimport { useComboboxContext } from '../Combobox.context';\nimport classes from '../Combobox.module.css';\n\nexport type ComboboxHeaderStylesNames = 'header';\n\nexport interface ComboboxHeaderProps\n extends BoxProps,\n StylesApiProps<ComboboxHeaderFactory>,\n ElementProps<'div'> {}\n\nexport type ComboboxHeaderFactory = Factory<{\n props: ComboboxHeaderProps;\n ref: HTMLDivElement;\n stylesNames: ComboboxHeaderStylesNames;\n compound: true;\n}>;\n\nconst defaultProps: Partial<ComboboxHeaderProps> = {};\n\nexport const ComboboxHeader = factory<ComboboxHeaderFactory>((props, ref) => {\n const { classNames, className, style, styles, unstyled, vars, ...others } = useProps(\n 'ComboboxHeader',\n defaultProps,\n props\n );\n const ctx = useComboboxContext();\n\n return (\n <Box\n ref={ref}\n {...ctx.getStyles('header', { className, classNames, style, styles })}\n {...others}\n />\n );\n});\n\nComboboxHeader.classes = classes;\nComboboxHeader.displayName = '@mantine/core/ComboboxHeader';\n"],"names":[],"mappings":";;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAA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AAC,EAAE,MAAM,CAAC;AAClF,GAAG,CAAC;AACJ,CAAC,EAAE;AACH,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC;AACjC,cAAc,CAAC,WAAW,GAAG,8BAA8B;;;;"}
|
|
@@ -63,6 +63,7 @@ const ComboboxSearch = factory((_props, ref) => {
|
|
|
63
63
|
const ctx = useComboboxContext();
|
|
64
64
|
const _styles = ctx.getStyles("search");
|
|
65
65
|
const targetProps = useComboboxTargetProps({
|
|
66
|
+
targetType: "input",
|
|
66
67
|
withAriaAttributes,
|
|
67
68
|
withKeyboardNavigation,
|
|
68
69
|
onKeyDown
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxSearch.js","sources":["../../../../src/components/Combobox/ComboboxSearch/ComboboxSearch.tsx"],"sourcesContent":["import React from 'react';\nimport { useMergedRef } from '@mantine/hooks';\nimport { factory, ElementProps, useProps, Factory } from '../../../core';\nimport { Input, InputProps, InputStylesNames } from '../../Input/Input';\nimport { useComboboxContext } from '../Combobox.context';\nimport { useComboboxTargetProps } from '../use-combobox-target-props/use-combobox-target-props';\nimport classes from '../Combobox.module.css';\n\nexport type ComboboxSearchStylesNames = InputStylesNames;\n\nexport interface ComboboxSearchProps extends InputProps, ElementProps<'input', 'size'> {\n /** Determines whether the search input should have `aria-` attribute, `true` by default */\n withAriaAttributes?: boolean;\n\n /** Determines whether the search input should handle keyboard navigation, `true` by default */\n withKeyboardNavigation?: boolean;\n}\n\nexport type ComboboxSearchFactory = Factory<{\n props: ComboboxSearchProps;\n ref: HTMLInputElement;\n stylesNames: ComboboxSearchStylesNames;\n}>;\n\nconst defaultProps: Partial<ComboboxSearchProps> = {\n withAriaAttributes: true,\n withKeyboardNavigation: true,\n};\n\nexport const ComboboxSearch = factory<ComboboxSearchFactory>((_props, ref) => {\n const props = useProps('ComboboxSearch', defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n withAriaAttributes,\n onKeyDown,\n withKeyboardNavigation,\n size,\n ...others\n } = props;\n\n const ctx = useComboboxContext();\n const _styles = ctx.getStyles('search');\n\n const targetProps = useComboboxTargetProps({\n withAriaAttributes,\n withKeyboardNavigation,\n onKeyDown,\n });\n\n return (\n <Input\n ref={useMergedRef(ref, ctx.store.searchRef)}\n classNames={[{ input: _styles.className }, classNames] as any}\n styles={[{ input: _styles.style }, styles] as any}\n size={size || ctx.size}\n {...targetProps}\n {...others}\n />\n );\n});\n\nComboboxSearch.classes = classes;\nComboboxSearch.displayName = '@mantine/core/ComboboxSearch';\n"],"names":[],"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;AAC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xSearch.js","sources":["../../../../src/components/Combobox/ComboboxSearch/ComboboxSearch.tsx"],"sourcesContent":["import React from 'react';\nimport { useMergedRef } from '@mantine/hooks';\nimport { factory, ElementProps, useProps, Factory } from '../../../core';\nimport { Input, InputProps, InputStylesNames } from '../../Input/Input';\nimport { useComboboxContext } from '../Combobox.context';\nimport { useComboboxTargetProps } from '../use-combobox-target-props/use-combobox-target-props';\nimport classes from '../Combobox.module.css';\n\nexport type ComboboxSearchStylesNames = InputStylesNames;\n\nexport interface ComboboxSearchProps extends InputProps, ElementProps<'input', 'size'> {\n /** Determines whether the search input should have `aria-` attribute, `true` by default */\n withAriaAttributes?: boolean;\n\n /** Determines whether the search input should handle keyboard navigation, `true` by default */\n withKeyboardNavigation?: boolean;\n}\n\nexport type ComboboxSearchFactory = Factory<{\n props: ComboboxSearchProps;\n ref: HTMLInputElement;\n stylesNames: ComboboxSearchStylesNames;\n}>;\n\nconst defaultProps: Partial<ComboboxSearchProps> = {\n withAriaAttributes: true,\n withKeyboardNavigation: true,\n};\n\nexport const ComboboxSearch = factory<ComboboxSearchFactory>((_props, ref) => {\n const props = useProps('ComboboxSearch', defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n withAriaAttributes,\n onKeyDown,\n withKeyboardNavigation,\n size,\n ...others\n } = props;\n\n const ctx = useComboboxContext();\n const _styles = ctx.getStyles('search');\n\n const targetProps = useComboboxTargetProps({\n targetType: 'input',\n withAriaAttributes,\n withKeyboardNavigation,\n onKeyDown,\n });\n\n return (\n <Input\n ref={useMergedRef(ref, ctx.store.searchRef)}\n classNames={[{ input: _styles.className }, classNames] as any}\n styles={[{ input: _styles.style }, styles] as any}\n size={size || ctx.size}\n {...targetProps}\n {...others}\n />\n );\n});\n\nComboboxSearch.classes = classes;\nComboboxSearch.displayName = '@mantine/core/ComboboxSearch';\n"],"names":[],"mappings":";;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAA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E,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,EAAE,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAC7C,IAAI,UAAU,EAAE,OAAO;AACvB,IAAI,kBAAkB;AACtB,IAAI,sBAAsB;AAC1B,IAAI,SAAS;AACb,GAAG,CAAC,CAAC;AACL,EAAE,uBAAuB,KAAK,CAAC,aAAa;AAC5C,IAAI,KAAK;AACT,IAAI,cAAc,CAAC,cAAc,CAAC;AAClC,MAAM,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;AACjD,MAAM,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,UAAU,CAAC;AAC5D,MAAM,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,MAAM,CAAC;AAChD,MAAM,IAAI,EAAE,IAAI,IAAI,GAAG,CAAC,IAAI;AAC5B,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC;AAC5B,GAAG,CAAC;AACJ,CAAC,EAAE;AACH,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC;AACjC,cAAc,CAAC,WAAW,GAAG,8BAA8B;;;;"}
|
|
@@ -37,15 +37,12 @@ var __objRest = (source, exclude) => {
|
|
|
37
37
|
};
|
|
38
38
|
const defaultProps = {
|
|
39
39
|
refProp: "ref",
|
|
40
|
+
targetType: "input",
|
|
40
41
|
withKeyboardNavigation: true,
|
|
41
42
|
withAriaAttributes: true
|
|
42
43
|
};
|
|
43
44
|
const ComboboxTarget = factory((props, ref) => {
|
|
44
|
-
const _a = useProps(
|
|
45
|
-
"ComboboxTarget",
|
|
46
|
-
defaultProps,
|
|
47
|
-
props
|
|
48
|
-
), { children, refProp, withKeyboardNavigation, withAriaAttributes } = _a, others = __objRest(_a, ["children", "refProp", "withKeyboardNavigation", "withAriaAttributes"]);
|
|
45
|
+
const _a = useProps("ComboboxTarget", defaultProps, props), { children, refProp, withKeyboardNavigation, withAriaAttributes, targetType } = _a, others = __objRest(_a, ["children", "refProp", "withKeyboardNavigation", "withAriaAttributes", "targetType"]);
|
|
49
46
|
if (!isElement(children)) {
|
|
50
47
|
throw new Error(
|
|
51
48
|
"Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
|
|
@@ -53,6 +50,7 @@ const ComboboxTarget = factory((props, ref) => {
|
|
|
53
50
|
}
|
|
54
51
|
const ctx = useComboboxContext();
|
|
55
52
|
const targetProps = useComboboxTargetProps({
|
|
53
|
+
targetType,
|
|
56
54
|
withAriaAttributes,
|
|
57
55
|
withKeyboardNavigation,
|
|
58
56
|
onKeyDown: children.props.onKeyDown
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxTarget.js","sources":["../../../../src/components/Combobox/ComboboxTarget/ComboboxTarget.tsx"],"sourcesContent":["import React, { cloneElement } from 'react';\nimport { useMergedRef } from '@mantine/hooks';\nimport { Popover } from '../../Popover';\nimport { isElement, useProps, factory, Factory } from '../../../core';\nimport { useComboboxContext } from '../Combobox.context';\nimport { useComboboxTargetProps } from '../use-combobox-target-props/use-combobox-target-props';\n\nexport interface ComboboxTargetProps {\n /** Target element */\n children: React.ReactNode;\n\n /** Key of the prop that should be used to access element ref */\n refProp?: string;\n\n /** Determines whether component should respond to keyboard events, `true` by default */\n withKeyboardNavigation?: boolean;\n\n /** Determines whether the target should have `aria-` attributes, `true` by default */\n withAriaAttributes?: boolean;\n}\n\nconst defaultProps: Partial<ComboboxTargetProps> = {\n refProp: 'ref',\n withKeyboardNavigation: true,\n withAriaAttributes: true,\n};\n\nexport type ComboboxTargetFactory = Factory<{\n props: ComboboxTargetProps;\n ref: HTMLElement;\n compound: true;\n}>;\n\nexport const ComboboxTarget = factory<ComboboxTargetFactory>((props, ref) => {\n const { children, refProp, withKeyboardNavigation, withAriaAttributes, ...others }
|
|
1
|
+
{"version":3,"file":"ComboboxTarget.js","sources":["../../../../src/components/Combobox/ComboboxTarget/ComboboxTarget.tsx"],"sourcesContent":["import React, { cloneElement } from 'react';\nimport { useMergedRef } from '@mantine/hooks';\nimport { Popover } from '../../Popover';\nimport { isElement, useProps, factory, Factory } from '../../../core';\nimport { useComboboxContext } from '../Combobox.context';\nimport { useComboboxTargetProps } from '../use-combobox-target-props/use-combobox-target-props';\n\nexport interface ComboboxTargetProps {\n /** Target element */\n children: React.ReactNode;\n\n /** Key of the prop that should be used to access element ref */\n refProp?: string;\n\n /** Determines whether component should respond to keyboard events, `true` by default */\n withKeyboardNavigation?: boolean;\n\n /** Determines whether the target should have `aria-` attributes, `true` by default */\n withAriaAttributes?: boolean;\n\n /** Determines which events should be handled by the target element.\n * `button` target type handles `Space` and `Enter` keys to toggle dropdown opened state.\n * `input` by default.\n * */\n targetType?: 'button' | 'input';\n}\n\nconst defaultProps: Partial<ComboboxTargetProps> = {\n refProp: 'ref',\n targetType: 'input',\n withKeyboardNavigation: true,\n withAriaAttributes: true,\n};\n\nexport type ComboboxTargetFactory = Factory<{\n props: ComboboxTargetProps;\n ref: HTMLElement;\n compound: true;\n}>;\n\nexport const ComboboxTarget = factory<ComboboxTargetFactory>((props, ref) => {\n const { children, refProp, withKeyboardNavigation, withAriaAttributes, targetType, ...others } =\n useProps('ComboboxTarget', defaultProps, props);\n\n if (!isElement(children)) {\n throw new Error(\n 'Combobox.Target 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 ctx = useComboboxContext();\n\n const targetProps = useComboboxTargetProps({\n targetType,\n withAriaAttributes,\n withKeyboardNavigation,\n onKeyDown: children.props.onKeyDown,\n });\n\n const clonedElement = cloneElement(children, {\n ...targetProps,\n ...others,\n });\n\n return (\n <Popover.Target ref={useMergedRef(ref, ctx.store.targetRef)}>{clonedElement}</Popover.Target>\n );\n});\n\nComboboxTarget.displayName = '@mantine/core/ComboboxTarget';\n"],"names":[],"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AG;AACH,EAAE,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;AACnC,EAAE,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAC7C,IAAI,UAAU;AACd,IAAI,kBAAkB;AACtB,IAAI,sBAAsB;AAC1B,IAAI,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS;AACvC,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,aAAa,GAAG,YAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACxG,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;AAC7H,CAAC,EAAE;AACH,cAAc,CAAC,WAAW,GAAG,8BAA8B;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef, useEffect } from 'react';
|
|
1
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
2
2
|
import { useUncontrolled } from '@mantine/hooks';
|
|
3
3
|
import { getNextIndex, getPreviousIndex, getFirstIndex } from './get-index/get-index.js';
|
|
4
4
|
|
|
@@ -8,7 +8,8 @@ function useCombobox({
|
|
|
8
8
|
onOpenedChange,
|
|
9
9
|
onDropdownClose,
|
|
10
10
|
onDropdownOpen,
|
|
11
|
-
loop = true
|
|
11
|
+
loop = true,
|
|
12
|
+
scrollBehavior = "instant"
|
|
12
13
|
} = {}) {
|
|
13
14
|
const [dropdownOpened, setDropdownOpened] = useUncontrolled({
|
|
14
15
|
value: opened,
|
|
@@ -22,48 +23,61 @@ function useCombobox({
|
|
|
22
23
|
const targetRef = useRef(null);
|
|
23
24
|
const focusSearchTimeout = useRef(-1);
|
|
24
25
|
const focusTargetTimeout = useRef(-1);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
26
|
+
const selectedIndexUpdateTimeout = useRef(-1);
|
|
27
|
+
const openDropdown = useCallback(
|
|
28
|
+
(eventSource = "unknown") => {
|
|
29
|
+
if (!dropdownOpened) {
|
|
30
|
+
setDropdownOpened(true);
|
|
31
|
+
onDropdownOpen == null ? void 0 : onDropdownOpen(eventSource);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
[setDropdownOpened, onDropdownOpen, dropdownOpened]
|
|
35
|
+
);
|
|
36
|
+
const closeDropdown = useCallback(
|
|
37
|
+
(eventSource = "unknown") => {
|
|
38
|
+
if (dropdownOpened) {
|
|
39
|
+
setDropdownOpened(false);
|
|
40
|
+
onDropdownClose == null ? void 0 : onDropdownClose(eventSource);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
[setDropdownOpened, onDropdownClose, dropdownOpened]
|
|
44
|
+
);
|
|
45
|
+
const toggleDropdown = useCallback(
|
|
46
|
+
(eventSource = "unknown") => {
|
|
47
|
+
if (dropdownOpened) {
|
|
48
|
+
closeDropdown(eventSource);
|
|
49
|
+
} else {
|
|
50
|
+
openDropdown(eventSource);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
[closeDropdown, openDropdown, dropdownOpened]
|
|
54
|
+
);
|
|
55
|
+
const clearSelectedItem = useCallback(() => {
|
|
45
56
|
const selected = document.querySelector(`#${listId.current} [data-combobox-selected]`);
|
|
46
57
|
selected == null ? void 0 : selected.removeAttribute("data-combobox-selected");
|
|
47
58
|
selected == null ? void 0 : selected.removeAttribute("aria-selected");
|
|
48
|
-
};
|
|
49
|
-
const selectOption = (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
}, []);
|
|
60
|
+
const selectOption = useCallback(
|
|
61
|
+
(index) => {
|
|
62
|
+
const list = document.getElementById(listId.current);
|
|
63
|
+
const items = list == null ? void 0 : list.querySelectorAll("[data-combobox-option]");
|
|
64
|
+
if (!items) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const nextIndex = index >= items.length ? 0 : index < 0 ? items.length - 1 : index;
|
|
68
|
+
selectedOptionIndex.current = nextIndex;
|
|
69
|
+
if ((items == null ? void 0 : items[nextIndex]) && !items[nextIndex].hasAttribute("data-combobox-disabled")) {
|
|
70
|
+
clearSelectedItem();
|
|
71
|
+
items[nextIndex].setAttribute("data-combobox-selected", "true");
|
|
72
|
+
items[nextIndex].setAttribute("aria-selected", "true");
|
|
73
|
+
items[nextIndex].scrollIntoView({ block: "nearest", behavior: scrollBehavior });
|
|
74
|
+
return items[nextIndex].id;
|
|
75
|
+
}
|
|
53
76
|
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
clearSelectedItem();
|
|
59
|
-
items[nextIndex].setAttribute("data-combobox-selected", "true");
|
|
60
|
-
items[nextIndex].setAttribute("aria-selected", "true");
|
|
61
|
-
items[nextIndex].scrollIntoView({ block: "nearest" });
|
|
62
|
-
return items[nextIndex].id;
|
|
63
|
-
}
|
|
64
|
-
return null;
|
|
65
|
-
};
|
|
66
|
-
const selectActiveOption = () => {
|
|
77
|
+
},
|
|
78
|
+
[scrollBehavior, clearSelectedItem]
|
|
79
|
+
);
|
|
80
|
+
const selectActiveOption = useCallback(() => {
|
|
67
81
|
const activeOption = document.querySelector(
|
|
68
82
|
`#${listId.current} [data-combobox-active]`
|
|
69
83
|
);
|
|
@@ -75,50 +89,71 @@ function useCombobox({
|
|
|
75
89
|
return selectOption(index);
|
|
76
90
|
}
|
|
77
91
|
return selectOption(0);
|
|
78
|
-
};
|
|
79
|
-
const selectNextOption = (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
}, [selectOption]);
|
|
93
|
+
const selectNextOption = useCallback(
|
|
94
|
+
() => selectOption(
|
|
95
|
+
getNextIndex(
|
|
96
|
+
selectedOptionIndex.current,
|
|
97
|
+
document.querySelectorAll(`#${listId.current} [data-combobox-option]`),
|
|
98
|
+
loop
|
|
99
|
+
)
|
|
100
|
+
),
|
|
101
|
+
[selectOption, loop]
|
|
85
102
|
);
|
|
86
|
-
const selectPreviousOption = (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
103
|
+
const selectPreviousOption = useCallback(
|
|
104
|
+
() => selectOption(
|
|
105
|
+
getPreviousIndex(
|
|
106
|
+
selectedOptionIndex.current,
|
|
107
|
+
document.querySelectorAll(`#${listId.current} [data-combobox-option]`),
|
|
108
|
+
loop
|
|
109
|
+
)
|
|
110
|
+
),
|
|
111
|
+
[selectOption, loop]
|
|
92
112
|
);
|
|
93
|
-
const selectFirstOption = (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
113
|
+
const selectFirstOption = useCallback(
|
|
114
|
+
() => selectOption(
|
|
115
|
+
getFirstIndex(
|
|
116
|
+
document.querySelectorAll(`#${listId.current} [data-combobox-option]`)
|
|
117
|
+
)
|
|
118
|
+
),
|
|
119
|
+
[selectOption]
|
|
97
120
|
);
|
|
98
|
-
const
|
|
121
|
+
const updateSelectedOptionIndex = useCallback((target = "selected") => {
|
|
122
|
+
selectedIndexUpdateTimeout.current = window.setTimeout(() => {
|
|
123
|
+
const items = document.querySelectorAll(
|
|
124
|
+
`#${listId.current} [data-combobox-option]`
|
|
125
|
+
);
|
|
126
|
+
const index = Array.from(items).findIndex(
|
|
127
|
+
(option) => option.hasAttribute(`data-combobox-${target}`)
|
|
128
|
+
);
|
|
129
|
+
selectedOptionIndex.current = index;
|
|
130
|
+
}, 0);
|
|
131
|
+
}, []);
|
|
132
|
+
const resetSelectedOption = useCallback(() => {
|
|
99
133
|
selectedOptionIndex.current = -1;
|
|
100
134
|
clearSelectedItem();
|
|
101
|
-
};
|
|
102
|
-
const clickSelectedOption = () => {
|
|
135
|
+
}, [clearSelectedItem]);
|
|
136
|
+
const clickSelectedOption = useCallback(() => {
|
|
103
137
|
const items = document.querySelectorAll(
|
|
104
138
|
`#${listId.current} [data-combobox-option]`
|
|
105
139
|
);
|
|
106
140
|
const item = items == null ? void 0 : items[selectedOptionIndex.current];
|
|
107
141
|
item == null ? void 0 : item.click();
|
|
108
|
-
};
|
|
109
|
-
const setListId = (id) => {
|
|
142
|
+
}, []);
|
|
143
|
+
const setListId = useCallback((id) => {
|
|
110
144
|
listId.current = id;
|
|
111
|
-
};
|
|
112
|
-
const focusSearchInput = () => {
|
|
145
|
+
}, []);
|
|
146
|
+
const focusSearchInput = useCallback(() => {
|
|
113
147
|
focusSearchTimeout.current = window.setTimeout(() => searchRef.current.focus(), 0);
|
|
114
|
-
};
|
|
115
|
-
const focusTarget = () => {
|
|
148
|
+
}, []);
|
|
149
|
+
const focusTarget = useCallback(() => {
|
|
116
150
|
focusTargetTimeout.current = window.setTimeout(() => targetRef.current.focus(), 0);
|
|
117
|
-
};
|
|
151
|
+
}, []);
|
|
118
152
|
useEffect(
|
|
119
153
|
() => () => {
|
|
120
154
|
window.clearTimeout(focusSearchTimeout.current);
|
|
121
155
|
window.clearTimeout(focusTargetTimeout.current);
|
|
156
|
+
window.clearTimeout(selectedIndexUpdateTimeout.current);
|
|
122
157
|
},
|
|
123
158
|
[]
|
|
124
159
|
);
|
|
@@ -134,6 +169,7 @@ function useCombobox({
|
|
|
134
169
|
selectNextOption,
|
|
135
170
|
selectPreviousOption,
|
|
136
171
|
resetSelectedOption,
|
|
172
|
+
updateSelectedOptionIndex,
|
|
137
173
|
listId: listId.current,
|
|
138
174
|
setListId,
|
|
139
175
|
clickSelectedOption,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-combobox.js","sources":["../../../../src/components/Combobox/use-combobox/use-combobox.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { getPreviousIndex, getNextIndex, getFirstIndex } from './get-index/get-index';\n\nexport interface ComboboxStore {\n dropdownOpened: boolean;\n openDropdown(): void;\n closeDropdown(): void;\n toggleDropdown(): void;\n\n selectedOptionIndex: number;\n selectOption(index: number): void;\n selectActiveOption(): string | null;\n selectFirstOption(): string | null;\n selectNextOption(): string | null;\n selectPreviousOption(): string | null;\n resetSelectedOption(): void;\n clickSelectedOption(): void;\n\n listId: string | null;\n setListId(id: string): void;\n\n searchRef: React.MutableRefObject<HTMLInputElement | null>;\n focusSearchInput(): void;\n\n targetRef: React.MutableRefObject<HTMLElement | null>;\n focusTarget(): void;\n}\n\ninterface UseComboboxOptions {\n /** Default value for `dropdownOpened`, `false` by default */\n defaultOpened?: boolean;\n\n /** Controlled `dropdownOpened` state */\n opened?: boolean;\n\n /** Called when `dropdownOpened` state changes */\n onOpenedChange?(opened: boolean): void;\n\n /** Called when dropdown closes */\n onDropdownClose?(): void;\n\n /** Called when dropdown opens */\n onDropdownOpen?(): void;\n\n /** Determines whether arrow key presses should loop though items (first to last and last to first), `true` by default */\n loop?: boolean;\n}\n\nexport function useCombobox({\n defaultOpened,\n opened,\n onOpenedChange,\n onDropdownClose,\n onDropdownOpen,\n loop = true,\n}: UseComboboxOptions = {}): ComboboxStore {\n const [dropdownOpened, setDropdownOpened] = useUncontrolled({\n value: opened,\n defaultValue: defaultOpened,\n finalValue: false,\n onChange: onOpenedChange,\n });\n\n const listId = useRef<string | null>(null);\n const selectedOptionIndex = useRef<number>(-1);\n const searchRef = useRef<HTMLInputElement | null>(null);\n const targetRef = useRef<HTMLElement | null>(null);\n const focusSearchTimeout = useRef<number>(-1);\n const focusTargetTimeout = useRef<number>(-1);\n\n const openDropdown = () => {\n if (!dropdownOpened) {\n setDropdownOpened(true);\n onDropdownOpen?.();\n }\n };\n\n const closeDropdown = () => {\n if (dropdownOpened) {\n setDropdownOpened(false);\n onDropdownClose?.();\n }\n };\n\n const toggleDropdown = () => {\n if (dropdownOpened) {\n closeDropdown();\n } else {\n openDropdown();\n }\n };\n\n const clearSelectedItem = () => {\n const selected = document.querySelector(`#${listId.current} [data-combobox-selected]`);\n selected?.removeAttribute('data-combobox-selected');\n selected?.removeAttribute('aria-selected');\n };\n\n const selectOption = (index: number) => {\n const list = document.getElementById(listId.current!);\n const items = list?.querySelectorAll('[data-combobox-option]');\n\n if (!items) {\n return null;\n }\n\n const nextIndex = index >= items!.length ? 0 : index < 0 ? items!.length - 1 : index;\n selectedOptionIndex.current = nextIndex;\n\n if (items?.[nextIndex] && !items[nextIndex].hasAttribute('data-combobox-disabled')) {\n clearSelectedItem();\n items[nextIndex].setAttribute('data-combobox-selected', 'true');\n items[nextIndex].setAttribute('aria-selected', 'true');\n items[nextIndex].scrollIntoView({ block: 'nearest' });\n return items[nextIndex].id;\n }\n\n return null;\n };\n\n const selectActiveOption = () => {\n const activeOption = document.querySelector<HTMLDivElement>(\n `#${listId.current} [data-combobox-active]`\n );\n\n if (activeOption) {\n const items = document.querySelectorAll<HTMLDivElement>(\n `#${listId.current} [data-combobox-option]`\n );\n const index = Array.from(items).findIndex((option) => option === activeOption);\n return selectOption(index);\n }\n\n return selectOption(0);\n };\n\n const selectNextOption = () =>\n selectOption(\n getNextIndex(\n selectedOptionIndex.current,\n document.querySelectorAll<HTMLDivElement>(`#${listId.current} [data-combobox-option]`),\n loop\n )\n );\n\n const selectPreviousOption = () =>\n selectOption(\n getPreviousIndex(\n selectedOptionIndex.current,\n document.querySelectorAll<HTMLDivElement>(`#${listId.current} [data-combobox-option]`),\n loop\n )\n );\n\n const selectFirstOption = () =>\n selectOption(\n getFirstIndex(\n document.querySelectorAll<HTMLDivElement>(`#${listId.current} [data-combobox-option]`)\n )\n );\n\n const resetSelectedOption = () => {\n selectedOptionIndex.current = -1;\n clearSelectedItem();\n };\n\n const clickSelectedOption = () => {\n const items = document.querySelectorAll<HTMLDivElement>(\n `#${listId.current} [data-combobox-option]`\n );\n const item = items?.[selectedOptionIndex.current];\n item?.click();\n };\n\n const setListId = (id: string) => {\n listId.current = id;\n };\n\n const focusSearchInput = () => {\n focusSearchTimeout.current = window.setTimeout(() => searchRef.current!.focus(), 0);\n };\n\n const focusTarget = () => {\n focusTargetTimeout.current = window.setTimeout(() => targetRef.current!.focus(), 0);\n };\n\n useEffect(\n () => () => {\n window.clearTimeout(focusSearchTimeout.current);\n window.clearTimeout(focusTargetTimeout.current);\n },\n []\n );\n\n return {\n dropdownOpened,\n openDropdown,\n closeDropdown,\n toggleDropdown,\n\n selectedOptionIndex: selectedOptionIndex.current,\n selectOption,\n selectFirstOption,\n selectActiveOption,\n selectNextOption,\n selectPreviousOption,\n resetSelectedOption,\n\n listId: listId.current,\n setListId,\n clickSelectedOption,\n\n searchRef,\n focusSearchInput,\n\n targetRef,\n focusTarget,\n };\n}\n"],"names":[],"mappings":";;;;AAGO,SAAS,WAAW,CAAC;AAC5B,EAAE,aAAa;AACf,EAAE,MAAM;AACR,EAAE,cAAc;AAChB,EAAE,eAAe;AACjB,EAAE,cAAc;AAChB,EAAE,IAAI,GAAG,IAAI;AACb,CAAC,GAAG,EAAE,EAAE;AACR,EAAE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,eAAe,CAAC;AAC9D,IAAI,KAAK,EAAE,MAAM;AACjB,IAAI,YAAY,EAAE,aAAa;AAC/B,IAAI,UAAU,EAAE,KAAK;AACrB,IAAI,QAAQ,EAAE,cAAc;AAC5B,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9B,EAAE,MAAM,mBAAmB,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,EAAE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACjC,EAAE,MAAM,SAAS,GAAG,MA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,EAAE,mBAAmB,CAAC,OAAO;AACpD,IAAI,YAAY;AAChB,IAAI,iBAAiB;AACrB,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,IAAI,oBAAoB;AACxB,IAAI,mBAAmB;AACvB,IAAI,MAAM,EAAE,MAAM,CAAC,OAAO;AAC1B,IAAI,SAAS;AACb,IAAI,mBAAmB;AACvB,IAAI,SAAS;AACb,IAAI,gBAAgB;AACpB,IAAI,SAAS;AACb,IAAI,WAAW;AACf,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"use-combobox.js","sources":["../../../../src/components/Combobox/use-combobox/use-combobox.ts"],"sourcesContent":["import { useEffect, useRef, useCallback } from 'react';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { getPreviousIndex, getNextIndex, getFirstIndex } from './get-index/get-index';\n\nexport type ComboboxDropdownEventSource = 'keyboard' | 'mouse' | 'unknown';\n\nexport interface ComboboxStore {\n dropdownOpened: boolean;\n openDropdown(eventSource?: ComboboxDropdownEventSource): void;\n closeDropdown(eventSource?: ComboboxDropdownEventSource): void;\n toggleDropdown(eventSource?: ComboboxDropdownEventSource): void;\n\n selectedOptionIndex: number;\n selectOption(index: number): void;\n selectActiveOption(): string | null;\n selectFirstOption(): string | null;\n selectNextOption(): string | null;\n selectPreviousOption(): string | null;\n resetSelectedOption(): void;\n clickSelectedOption(): void;\n updateSelectedOptionIndex(target?: 'active' | 'selected'): void;\n\n listId: string | null;\n setListId(id: string): void;\n\n searchRef: React.MutableRefObject<HTMLInputElement | null>;\n focusSearchInput(): void;\n\n targetRef: React.MutableRefObject<HTMLElement | null>;\n focusTarget(): void;\n}\n\ninterface UseComboboxOptions {\n /** Default value for `dropdownOpened`, `false` by default */\n defaultOpened?: boolean;\n\n /** Controlled `dropdownOpened` state */\n opened?: boolean;\n\n /** Called when `dropdownOpened` state changes */\n onOpenedChange?(opened: boolean): void;\n\n /** Called when dropdown closes with event source: keyboard, mouse or unknown */\n onDropdownClose?(eventSource: ComboboxDropdownEventSource): void;\n\n /** Called when dropdown opens with event source: keyboard, mouse or unknown */\n onDropdownOpen?(eventSource: ComboboxDropdownEventSource): void;\n\n /** Determines whether arrow key presses should loop though items (first to last and last to first), `true` by default */\n loop?: boolean;\n\n /** `behavior` passed down to `element.scrollIntoView`, `'instant'` by default */\n scrollBehavior?: ScrollBehavior;\n}\n\nexport function useCombobox({\n defaultOpened,\n opened,\n onOpenedChange,\n onDropdownClose,\n onDropdownOpen,\n loop = true,\n scrollBehavior = 'instant',\n}: UseComboboxOptions = {}): ComboboxStore {\n const [dropdownOpened, setDropdownOpened] = useUncontrolled({\n value: opened,\n defaultValue: defaultOpened,\n finalValue: false,\n onChange: onOpenedChange,\n });\n\n const listId = useRef<string | null>(null);\n const selectedOptionIndex = useRef<number>(-1);\n const searchRef = useRef<HTMLInputElement | null>(null);\n const targetRef = useRef<HTMLElement | null>(null);\n const focusSearchTimeout = useRef<number>(-1);\n const focusTargetTimeout = useRef<number>(-1);\n const selectedIndexUpdateTimeout = useRef<number>(-1);\n\n const openDropdown: ComboboxStore['openDropdown'] = useCallback(\n (eventSource = 'unknown') => {\n if (!dropdownOpened) {\n setDropdownOpened(true);\n onDropdownOpen?.(eventSource);\n }\n },\n [setDropdownOpened, onDropdownOpen, dropdownOpened]\n );\n\n const closeDropdown: ComboboxStore['closeDropdown'] = useCallback(\n (eventSource = 'unknown') => {\n if (dropdownOpened) {\n setDropdownOpened(false);\n onDropdownClose?.(eventSource);\n }\n },\n [setDropdownOpened, onDropdownClose, dropdownOpened]\n );\n\n const toggleDropdown: ComboboxStore['toggleDropdown'] = useCallback(\n (eventSource = 'unknown') => {\n if (dropdownOpened) {\n closeDropdown(eventSource);\n } else {\n openDropdown(eventSource);\n }\n },\n [closeDropdown, openDropdown, dropdownOpened]\n );\n\n const clearSelectedItem = useCallback(() => {\n const selected = document.querySelector(`#${listId.current} [data-combobox-selected]`);\n selected?.removeAttribute('data-combobox-selected');\n selected?.removeAttribute('aria-selected');\n }, []);\n\n const selectOption = useCallback(\n (index: number) => {\n const list = document.getElementById(listId.current!);\n const items = list?.querySelectorAll('[data-combobox-option]');\n\n if (!items) {\n return null;\n }\n\n const nextIndex = index >= items!.length ? 0 : index < 0 ? items!.length - 1 : index;\n selectedOptionIndex.current = nextIndex;\n\n if (items?.[nextIndex] && !items[nextIndex].hasAttribute('data-combobox-disabled')) {\n clearSelectedItem();\n items[nextIndex].setAttribute('data-combobox-selected', 'true');\n items[nextIndex].setAttribute('aria-selected', 'true');\n items[nextIndex].scrollIntoView({ block: 'nearest', behavior: scrollBehavior });\n return items[nextIndex].id;\n }\n\n return null;\n },\n [scrollBehavior, clearSelectedItem]\n );\n\n const selectActiveOption = useCallback(() => {\n const activeOption = document.querySelector<HTMLDivElement>(\n `#${listId.current} [data-combobox-active]`\n );\n\n if (activeOption) {\n const items = document.querySelectorAll<HTMLDivElement>(\n `#${listId.current} [data-combobox-option]`\n );\n const index = Array.from(items).findIndex((option) => option === activeOption);\n return selectOption(index);\n }\n\n return selectOption(0);\n }, [selectOption]);\n\n const selectNextOption = useCallback(\n () =>\n selectOption(\n getNextIndex(\n selectedOptionIndex.current,\n document.querySelectorAll<HTMLDivElement>(`#${listId.current} [data-combobox-option]`),\n loop\n )\n ),\n [selectOption, loop]\n );\n\n const selectPreviousOption = useCallback(\n () =>\n selectOption(\n getPreviousIndex(\n selectedOptionIndex.current,\n document.querySelectorAll<HTMLDivElement>(`#${listId.current} [data-combobox-option]`),\n loop\n )\n ),\n [selectOption, loop]\n );\n\n const selectFirstOption = useCallback(\n () =>\n selectOption(\n getFirstIndex(\n document.querySelectorAll<HTMLDivElement>(`#${listId.current} [data-combobox-option]`)\n )\n ),\n [selectOption]\n );\n\n const updateSelectedOptionIndex = useCallback((target: 'active' | 'selected' = 'selected') => {\n selectedIndexUpdateTimeout.current = window.setTimeout(() => {\n const items = document.querySelectorAll<HTMLDivElement>(\n `#${listId.current} [data-combobox-option]`\n );\n const index = Array.from(items).findIndex((option) =>\n option.hasAttribute(`data-combobox-${target}`)\n );\n selectedOptionIndex.current = index;\n }, 0);\n }, []);\n\n const resetSelectedOption = useCallback(() => {\n selectedOptionIndex.current = -1;\n clearSelectedItem();\n }, [clearSelectedItem]);\n\n const clickSelectedOption = useCallback(() => {\n const items = document.querySelectorAll<HTMLDivElement>(\n `#${listId.current} [data-combobox-option]`\n );\n const item = items?.[selectedOptionIndex.current];\n item?.click();\n }, []);\n\n const setListId = useCallback((id: string) => {\n listId.current = id;\n }, []);\n\n const focusSearchInput = useCallback(() => {\n focusSearchTimeout.current = window.setTimeout(() => searchRef.current!.focus(), 0);\n }, []);\n\n const focusTarget = useCallback(() => {\n focusTargetTimeout.current = window.setTimeout(() => targetRef.current!.focus(), 0);\n }, []);\n\n useEffect(\n () => () => {\n window.clearTimeout(focusSearchTimeout.current);\n window.clearTimeout(focusTargetTimeout.current);\n window.clearTimeout(selectedIndexUpdateTimeout.current);\n },\n []\n );\n\n return {\n dropdownOpened,\n openDropdown,\n closeDropdown,\n toggleDropdown,\n\n selectedOptionIndex: selectedOptionIndex.current,\n selectOption,\n selectFirstOption,\n selectActiveOption,\n selectNextOption,\n selectPreviousOption,\n resetSelectedOption,\n updateSelectedOptionIndex,\n\n listId: listId.current,\n setListId,\n clickSelectedOption,\n\n searchRef,\n focusSearchInput,\n\n targetRef,\n focusTarget,\n };\n}\n"],"names":[],"mappings":";;;;AAGO,SAAS,WAAW,CAAC;AAC5B,EAAE,aAAa;AACf,EAAE,MAAM;AACR,EAAE,cAAc;AAChB,EAAE,eAAe;AACjB,EAAE,cAAc;AAChB,EAAE,IAAI,GAAG,IAAI;AACb,EAAE,cAAc,GAAG,SAAS;AAC5B,CAAC,GAAG,EAAE,EAAE;AACR,EAAE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,eAAe,CAAC;AAC9D,IAAI,KAAK,EAAE,MAAM;AACjB,IAAI,YAAY,EAAE,aAAa;AAC/B,IAAI,UAAU,EAAE,KAA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M,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AACvF,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAE,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM;AACxC,IAAI,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AACvF,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAE,SAAS;AACX,IAAI,MAAM,MAAM;AAChB,MAAM,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACtD,MAAM,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACtD,MAAM,MAAM,CAAC,YAAY,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAC9D,KAAK;AACL,IAAI,EAAE;AACN,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,cAAc;AAClB,IAAI,YAAY;AAChB,IAAI,aAAa;AACjB,IAAI,cAAc;AAClB,IAAI,mBAAmB,EAAE,mBAAmB,CAAC,OAAO;AACpD,IAAI,YAAY;AAChB,IAAI,iBAAiB;AACrB,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,IAAI,oBAAoB;AACxB,IAAI,mBAAmB;AACvB,IAAI,yBAAyB;AAC7B,IAAI,MAAM,EAAE,MAAM,CAAC,OAAO;AAC1B,IAAI,SAAS;AACb,IAAI,mBAAmB;AACvB,IAAI,SAAS;AACb,IAAI,gBAAgB;AACpB,IAAI,SAAS;AACb,IAAI,WAAW;AACf,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-virtualized-combobox.js","sources":["../../../../src/components/Combobox/use-combobox/use-virtualized-combobox.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { getPreviousIndex, getNextIndex, getFirstIndex } from './get-index/get-virtualized-index';\nimport { ComboboxStore } from './use-combobox';\n\ninterface UseComboboxOptions {\n /** Default value for `dropdownOpened`, `false` by default */\n defaultOpened?: boolean;\n\n /** Controlled `dropdownOpened` state */\n opened?: boolean;\n\n /** Called when `dropdownOpened` state changes */\n onOpenedChange?(opened: boolean): void;\n\n /** Called when dropdown closes */\n onDropdownClose?(): void;\n\n /** Called when dropdown opens */\n onDropdownOpen?(): void;\n\n /** Determines whether arrow key presses should loop though items (first to last and last to first), `true` by default */\n loop?: boolean;\n\n /** Function to determine whether the option is disabled */\n isOptionDisabled?(optionIndex: number): boolean;\n\n totalOptionsCount: number;\n\n getOptionId(index: number): string | null;\n\n selectedOptionIndex: number;\n\n setSelectedOptionIndex(index: number): void;\n\n activeOptionIndex?: number;\n\n onSelectedOptionSubmit(index: number): void;\n}\n\nexport function useVirtualizedCombobox(\n {\n defaultOpened,\n opened,\n onOpenedChange,\n onDropdownClose,\n onDropdownOpen,\n loop = true,\n totalOptionsCount,\n isOptionDisabled = () => false,\n getOptionId,\n selectedOptionIndex,\n setSelectedOptionIndex,\n activeOptionIndex,\n onSelectedOptionSubmit,\n }: UseComboboxOptions = {\n totalOptionsCount: 0,\n getOptionId: () => null,\n selectedOptionIndex: 1,\n setSelectedOptionIndex: () => {},\n onSelectedOptionSubmit: () => {},\n }\n): ComboboxStore {\n const [dropdownOpened, setDropdownOpened] = useUncontrolled({\n value: opened,\n defaultValue: defaultOpened,\n finalValue: false,\n onChange: onOpenedChange,\n });\n\n const listId = useRef<string | null>(null);\n const searchRef = useRef<HTMLInputElement | null>(null);\n const targetRef = useRef<HTMLElement | null>(null);\n const focusSearchTimeout = useRef<number>(-1);\n const focusTargetTimeout = useRef<number>(-1);\n\n const openDropdown = () => {\n if (!dropdownOpened) {\n setDropdownOpened(true);\n onDropdownOpen?.();\n }\n };\n\n const closeDropdown = () => {\n if (dropdownOpened) {\n setDropdownOpened(false);\n onDropdownClose?.();\n }\n };\n\n const toggleDropdown = () => {\n if (dropdownOpened) {\n closeDropdown();\n } else {\n openDropdown();\n }\n };\n\n const selectOption = (index: number) => {\n const nextIndex = index >= totalOptionsCount ? 0 : index < 0 ? totalOptionsCount - 1 : index;\n setSelectedOptionIndex(nextIndex);\n return getOptionId(nextIndex);\n };\n\n const selectActiveOption = () => selectOption(activeOptionIndex ?? 0);\n\n const selectNextOption = () =>\n selectOption(\n getNextIndex({ currentIndex: selectedOptionIndex, isOptionDisabled, totalOptionsCount, loop })\n );\n\n const selectPreviousOption = () =>\n selectOption(\n getPreviousIndex({\n currentIndex: selectedOptionIndex,\n isOptionDisabled,\n totalOptionsCount,\n loop,\n })\n );\n\n const selectFirstOption = () =>\n selectOption(getFirstIndex({ isOptionDisabled, totalOptionsCount }));\n\n const resetSelectedOption = () => {\n setSelectedOptionIndex(-1);\n };\n\n const clickSelectedOption = () => {\n onSelectedOptionSubmit?.(selectedOptionIndex);\n };\n\n const setListId = (id: string) => {\n listId.current = id;\n };\n\n const focusSearchInput = () => {\n focusSearchTimeout.current = window.setTimeout(() => searchRef.current!.focus(), 0);\n };\n\n const focusTarget = () => {\n focusTargetTimeout.current = window.setTimeout(() => targetRef.current!.focus(), 0);\n };\n\n useEffect(\n () => () => {\n window.clearTimeout(focusSearchTimeout.current);\n window.clearTimeout(focusTargetTimeout.current);\n },\n []\n );\n\n return {\n dropdownOpened,\n openDropdown,\n closeDropdown,\n toggleDropdown,\n\n selectedOptionIndex,\n selectOption,\n selectFirstOption,\n selectActiveOption,\n selectNextOption,\n selectPreviousOption,\n resetSelectedOption,\n\n listId: listId.current,\n setListId,\n clickSelectedOption,\n\n searchRef,\n focusSearchInput,\n\n targetRef,\n focusTarget,\n };\n}\n"],"names":[],"mappings":";;;;AAGO,SAAS,sBAAsB,CAAC;AACvC,EAAE,aAAa;AACf,EAAE,MAAM;AACR,EAAE,cAAc;AAChB,EAAE,eAAe;AACjB,EAAE,cAAc;AAChB,EAAE,IAAI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,IAAI,SAAS;AACb,IAAI,gBAAgB;AACpB,IAAI,SAAS;AACb,IAAI,WAAW;AACf,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"use-virtualized-combobox.js","sources":["../../../../src/components/Combobox/use-combobox/use-virtualized-combobox.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { getPreviousIndex, getNextIndex, getFirstIndex } from './get-index/get-virtualized-index';\nimport { ComboboxStore } from './use-combobox';\n\ninterface UseComboboxOptions {\n /** Default value for `dropdownOpened`, `false` by default */\n defaultOpened?: boolean;\n\n /** Controlled `dropdownOpened` state */\n opened?: boolean;\n\n /** Called when `dropdownOpened` state changes */\n onOpenedChange?(opened: boolean): void;\n\n /** Called when dropdown closes */\n onDropdownClose?(): void;\n\n /** Called when dropdown opens */\n onDropdownOpen?(): void;\n\n /** Determines whether arrow key presses should loop though items (first to last and last to first), `true` by default */\n loop?: boolean;\n\n /** Function to determine whether the option is disabled */\n isOptionDisabled?(optionIndex: number): boolean;\n\n totalOptionsCount: number;\n\n getOptionId(index: number): string | null;\n\n selectedOptionIndex: number;\n\n setSelectedOptionIndex(index: number): void;\n\n activeOptionIndex?: number;\n\n onSelectedOptionSubmit(index: number): void;\n}\n\nexport function useVirtualizedCombobox(\n {\n defaultOpened,\n opened,\n onOpenedChange,\n onDropdownClose,\n onDropdownOpen,\n loop = true,\n totalOptionsCount,\n isOptionDisabled = () => false,\n getOptionId,\n selectedOptionIndex,\n setSelectedOptionIndex,\n activeOptionIndex,\n onSelectedOptionSubmit,\n }: UseComboboxOptions = {\n totalOptionsCount: 0,\n getOptionId: () => null,\n selectedOptionIndex: 1,\n setSelectedOptionIndex: () => {},\n onSelectedOptionSubmit: () => {},\n }\n): ComboboxStore {\n const [dropdownOpened, setDropdownOpened] = useUncontrolled({\n value: opened,\n defaultValue: defaultOpened,\n finalValue: false,\n onChange: onOpenedChange,\n });\n\n const listId = useRef<string | null>(null);\n const searchRef = useRef<HTMLInputElement | null>(null);\n const targetRef = useRef<HTMLElement | null>(null);\n const focusSearchTimeout = useRef<number>(-1);\n const focusTargetTimeout = useRef<number>(-1);\n\n const openDropdown = () => {\n if (!dropdownOpened) {\n setDropdownOpened(true);\n onDropdownOpen?.();\n }\n };\n\n const closeDropdown = () => {\n if (dropdownOpened) {\n setDropdownOpened(false);\n onDropdownClose?.();\n }\n };\n\n const toggleDropdown = () => {\n if (dropdownOpened) {\n closeDropdown();\n } else {\n openDropdown();\n }\n };\n\n const selectOption = (index: number) => {\n const nextIndex = index >= totalOptionsCount ? 0 : index < 0 ? totalOptionsCount - 1 : index;\n setSelectedOptionIndex(nextIndex);\n return getOptionId(nextIndex);\n };\n\n const selectActiveOption = () => selectOption(activeOptionIndex ?? 0);\n\n const selectNextOption = () =>\n selectOption(\n getNextIndex({ currentIndex: selectedOptionIndex, isOptionDisabled, totalOptionsCount, loop })\n );\n\n const selectPreviousOption = () =>\n selectOption(\n getPreviousIndex({\n currentIndex: selectedOptionIndex,\n isOptionDisabled,\n totalOptionsCount,\n loop,\n })\n );\n\n const selectFirstOption = () =>\n selectOption(getFirstIndex({ isOptionDisabled, totalOptionsCount }));\n\n const resetSelectedOption = () => {\n setSelectedOptionIndex(-1);\n };\n\n const clickSelectedOption = () => {\n onSelectedOptionSubmit?.(selectedOptionIndex);\n };\n\n const setListId = (id: string) => {\n listId.current = id;\n };\n\n const focusSearchInput = () => {\n focusSearchTimeout.current = window.setTimeout(() => searchRef.current!.focus(), 0);\n };\n\n const focusTarget = () => {\n focusTargetTimeout.current = window.setTimeout(() => targetRef.current!.focus(), 0);\n };\n\n useEffect(\n () => () => {\n window.clearTimeout(focusSearchTimeout.current);\n window.clearTimeout(focusTargetTimeout.current);\n },\n []\n );\n\n return {\n dropdownOpened,\n openDropdown,\n closeDropdown,\n toggleDropdown,\n\n selectedOptionIndex,\n selectOption,\n selectFirstOption,\n selectActiveOption,\n selectNextOption,\n selectPreviousOption,\n resetSelectedOption,\n updateSelectedOptionIndex: () => {},\n\n listId: listId.current,\n setListId,\n clickSelectedOption,\n\n searchRef,\n focusSearchInput,\n\n targetRef,\n focusTarget,\n };\n}\n"],"names":[],"mappings":";;;;AAGO,SAAS,sBAAsB,CAAC;AACvC,EAAE,aAAa;AACf,EAAE,MAAM;AACR,EAAE,cAAc;AAChB,EAAE,eAAe;AACjB,EAAE,cAAc;AAChB,EAAE,IAAI,GAAG,IAAI;AACb,EAAE,iBAAiB;AACnB,EAAE,gBAAgB,GAAG,MAAM,KAAK;AAChC,EAAE,WAAW;AACb,EAAE,mBAAmB;AACrB,EAAE,sBAAsB;AACxB,EAAE,iBAAiB;AACnB,EAAE,sBAAsB;AACxB,CAAC,GAAG;AACJ,EAAE,iBAAiB,EAAE,CAAC;AACtB,EAAE,WAAW,EAAE,MAAM,IAAI;AACzB,EAAE,mBAAmB,EAAE,CAAC;AACxB,EAAE,sBAAsB,EAAE,MAAM;AAChC,GAAG;AACH,EAAE,sBAAsB,EAAE,MAAM;AAChC,GAAG;AACH,CAAC,EAAE;AACH,EAAE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,eAAe,CAAC;AAC9D,IAAI,KAAK,EAAE,MAAM;AACjB,IAAI,YAAY,EAAE,aAAa;AAC/B,IAAI,UAAU,EAAE,KAAK;AACrB,IAAI,QAAQ,EAAE,cAAc;AAC5B,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9B,EAAE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACjC,EAAE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACjC,EAAE,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,EAAE,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,EAAE,MAAM,YAAY,GAAG,MAAM;A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AAY;AAChB,IAAI,aAAa;AACjB,IAAI,cAAc;AAClB,IAAI,mBAAmB;AACvB,IAAI,YAAY;AAChB,IAAI,iBAAiB;AACrB,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,IAAI,oBAAoB;AACxB,IAAI,mBAAmB;AACvB,IAAI,yBAAyB,EAAE,MAAM;AACrC,KAAK;AACL,IAAI,MAAM,EAAE,MAAM,CAAC,OAAO;AAC1B,IAAI,SAAS;AACb,IAAI,mBAAmB;AACvB,IAAI,SAAS;AACb,IAAI,gBAAgB;AACpB,IAAI,SAAS;AACb,IAAI,WAAW;AACf,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -23,7 +23,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
23
23
|
function useComboboxTargetProps({
|
|
24
24
|
onKeyDown,
|
|
25
25
|
withKeyboardNavigation,
|
|
26
|
-
withAriaAttributes
|
|
26
|
+
withAriaAttributes,
|
|
27
|
+
targetType
|
|
27
28
|
}) {
|
|
28
29
|
const ctx = useComboboxContext();
|
|
29
30
|
const [selectedOptionId, setSelectedOptionId] = useState(null);
|
|
@@ -33,7 +34,7 @@ function useComboboxTargetProps({
|
|
|
33
34
|
if (event.nativeEvent.code === "ArrowDown") {
|
|
34
35
|
event.preventDefault();
|
|
35
36
|
if (!ctx.store.dropdownOpened) {
|
|
36
|
-
ctx.store.openDropdown();
|
|
37
|
+
ctx.store.openDropdown("keyboard");
|
|
37
38
|
setSelectedOptionId(ctx.store.selectActiveOption());
|
|
38
39
|
} else {
|
|
39
40
|
setSelectedOptionId(ctx.store.selectNextOption());
|
|
@@ -42,7 +43,7 @@ function useComboboxTargetProps({
|
|
|
42
43
|
if (event.nativeEvent.code === "ArrowUp") {
|
|
43
44
|
event.preventDefault();
|
|
44
45
|
if (!ctx.store.dropdownOpened) {
|
|
45
|
-
ctx.store.openDropdown();
|
|
46
|
+
ctx.store.openDropdown("keyboard");
|
|
46
47
|
setSelectedOptionId(ctx.store.selectActiveOption());
|
|
47
48
|
} else {
|
|
48
49
|
setSelectedOptionId(ctx.store.selectPreviousOption());
|
|
@@ -52,10 +53,19 @@ function useComboboxTargetProps({
|
|
|
52
53
|
if (ctx.store.dropdownOpened) {
|
|
53
54
|
event.preventDefault();
|
|
54
55
|
ctx.store.clickSelectedOption();
|
|
56
|
+
} else if (targetType === "button") {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
ctx.store.openDropdown("keyboard");
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
if (event.nativeEvent.code === "Escape") {
|
|
58
|
-
ctx.store.closeDropdown();
|
|
62
|
+
ctx.store.closeDropdown("keyboard");
|
|
63
|
+
}
|
|
64
|
+
if (event.nativeEvent.code === "Space") {
|
|
65
|
+
if (targetType === "button") {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
ctx.store.toggleDropdown("keyboard");
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
}
|
|
61
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-combobox-target-props.js","sources":["../../../../src/components/Combobox/use-combobox-target-props/use-combobox-target-props.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useComboboxContext } from '../Combobox.context';\n\ninterface UseComboboxTargetPropsInput {\n withAriaAttributes: boolean | undefined;\n withKeyboardNavigation: boolean | undefined;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement> | undefined;\n}\n\nexport function useComboboxTargetProps({\n onKeyDown,\n withKeyboardNavigation,\n withAriaAttributes,\n}: UseComboboxTargetPropsInput) {\n const ctx = useComboboxContext();\n const [selectedOptionId, setSelectedOptionId] = useState<string | null>(null);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (withKeyboardNavigation) {\n if (event.nativeEvent.code === 'ArrowDown') {\n event.preventDefault();\n\n if (!ctx.store.dropdownOpened) {\n ctx.store.openDropdown();\n setSelectedOptionId(ctx.store.selectActiveOption());\n } else {\n setSelectedOptionId(ctx.store.selectNextOption());\n }\n }\n\n if (event.nativeEvent.code === 'ArrowUp') {\n event.preventDefault();\n\n if (!ctx.store.dropdownOpened) {\n ctx.store.openDropdown();\n setSelectedOptionId(ctx.store.selectActiveOption());\n } else {\n setSelectedOptionId(ctx.store.selectPreviousOption());\n }\n }\n\n if (event.nativeEvent.code === 'Enter') {\n if (ctx.store.dropdownOpened) {\n event.preventDefault();\n ctx.store.clickSelectedOption();\n }\n }\n\n if (event.nativeEvent.code === 'Escape') {\n ctx.store.closeDropdown();\n }\n }\n };\n\n const ariaAttributes = withAriaAttributes\n ? {\n 'aria-haspopup': 'listbox',\n 'aria-expanded': ctx.store.listId ? ctx.store.dropdownOpened : undefined,\n 'aria-controls': ctx.store.listId,\n 'aria-activedescendant': ctx.store.dropdownOpened\n ? selectedOptionId || undefined\n : undefined,\n autoComplete: 'off',\n 'data-expanded': ctx.store.dropdownOpened ? true : undefined,\n }\n : {};\n\n return {\n ...ariaAttributes,\n onKeyDown: handleKeyDown,\n };\n}\n"],"names":[],"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,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AK,CAAC,cAAc,EAAE,CAAC;AAC/B,QAAQ,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE;AACvC,UAAU,GAAG,CAAC,KAAK,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"use-combobox-target-props.js","sources":["../../../../src/components/Combobox/use-combobox-target-props/use-combobox-target-props.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useComboboxContext } from '../Combobox.context';\n\ninterface UseComboboxTargetPropsInput {\n targetType: 'input' | 'button' | undefined;\n withAriaAttributes: boolean | undefined;\n withKeyboardNavigation: boolean | undefined;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement> | undefined;\n}\n\nexport function useComboboxTargetProps({\n onKeyDown,\n withKeyboardNavigation,\n withAriaAttributes,\n targetType,\n}: UseComboboxTargetPropsInput) {\n const ctx = useComboboxContext();\n const [selectedOptionId, setSelectedOptionId] = useState<string | null>(null);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n\n if (withKeyboardNavigation) {\n if (event.nativeEvent.code === 'ArrowDown') {\n event.preventDefault();\n\n if (!ctx.store.dropdownOpened) {\n ctx.store.openDropdown('keyboard');\n setSelectedOptionId(ctx.store.selectActiveOption());\n } else {\n setSelectedOptionId(ctx.store.selectNextOption());\n }\n }\n\n if (event.nativeEvent.code === 'ArrowUp') {\n event.preventDefault();\n\n if (!ctx.store.dropdownOpened) {\n ctx.store.openDropdown('keyboard');\n setSelectedOptionId(ctx.store.selectActiveOption());\n } else {\n setSelectedOptionId(ctx.store.selectPreviousOption());\n }\n }\n\n if (event.nativeEvent.code === 'Enter') {\n if (ctx.store.dropdownOpened) {\n event.preventDefault();\n ctx.store.clickSelectedOption();\n } else if (targetType === 'button') {\n event.preventDefault();\n ctx.store.openDropdown('keyboard');\n }\n }\n\n if (event.nativeEvent.code === 'Escape') {\n ctx.store.closeDropdown('keyboard');\n }\n\n if (event.nativeEvent.code === 'Space') {\n if (targetType === 'button') {\n event.preventDefault();\n ctx.store.toggleDropdown('keyboard');\n }\n }\n }\n };\n\n const ariaAttributes = withAriaAttributes\n ? {\n 'aria-haspopup': 'listbox',\n 'aria-expanded': ctx.store.listId ? ctx.store.dropdownOpened : undefined,\n 'aria-controls': ctx.store.listId,\n 'aria-activedescendant': ctx.store.dropdownOpened\n ? selectedOptionId || undefined\n : undefined,\n autoComplete: 'off',\n 'data-expanded': ctx.store.dropdownOpened ? true : undefined,\n }\n : {};\n\n return {\n ...ariaAttributes,\n onKeyDown: handleKeyDown,\n };\n}\n"],"names":[],"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,CA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AC,cAAc,CAAC,UAAU,CAAC,CAAC;AAC/C,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,MAAM,cAAc,GAAG,kBAAkB,GAAG;AAC9C,IAAI,eAAe,EAAE,SAAS;AAC9B,IAAI,eAAe,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC;AACzE,IAAI,eAAe,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM;AACrC,IAAI,uBAAuB,EAAE,GAAG,CAAC,KAAK,CAAC,cAAc,GAAG,gBAAgB,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC;AAC3F,IAAI,YAAY,EAAE,KAAK;AACvB,IAAI,eAAe,EAAE,GAAG,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,GAAG,KAAK,CAAC;AAC7D,GAAG,GAAG,EAAE,CAAC;AACT,EAAE,OAAO,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,cAAc,CAAC,EAAE;AAC3D,IAAI,SAAS,EAAE,aAAa;AAC5B,GAAG,CAAC,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputBase.js","sources":["../../../src/components/InputBase/InputBase.tsx"],"sourcesContent":["import React from 'react';\nimport { BoxProps, StylesApiProps, polymorphicFactory, PolymorphicFactory } from '../../core';\nimport { __InputStylesNames, __BaseInputProps, InputVariant, useInputProps, Input } from '../Input';\n\nexport interface InputBaseProps\n extends BoxProps,\n __BaseInputProps,\n StylesApiProps<InputBaseFactory> {\n __staticSelector?: string;\n\n /** Props passed to the root element (`Input.Wrapper` component) */\n wrapperProps?: Record<string, any>;\n}\n\nexport type InputBaseFactory = PolymorphicFactory<{\n props: InputBaseProps;\n defaultRef: HTMLInputElement;\n defaultComponent: 'input';\n stylesNames: __InputStylesNames;\n variant: InputVariant;\n}>;\n\nconst defaultProps: Partial<InputBaseProps> = {\n size: 'sm',\n __staticSelector: 'InputBase',\n};\n\nexport const InputBase = polymorphicFactory<InputBaseFactory>((props, ref) => {\n const { inputProps, wrapperProps, ...others } = useInputProps('InputBase', defaultProps, props);\n return (\n <Input.Wrapper {...wrapperProps}>\n <Input {...inputProps} {...others} ref={ref} />\n </Input.Wrapper>\n );\n});\n\nInputBase.classes = { ...Input.classes, ...Input.Wrapper.classes };\nInputBase.displayName = '@mantine/core/InputBase';\n"],"names":[],"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,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AAK;AAC5D,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;AACxJ,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,EAAE,YAAY,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1N,CAAC,EAAE;AACH,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7F,SAAS,CAAC,WAAW,GAAG,yBAAyB;;;;"}
|
|
1
|
+
{"version":3,"file":"InputBase.js","sources":["../../../src/components/InputBase/InputBase.tsx"],"sourcesContent":["import React from 'react';\nimport { BoxProps, StylesApiProps, polymorphicFactory, PolymorphicFactory } from '../../core';\nimport { __InputStylesNames, __BaseInputProps, InputVariant, useInputProps, Input } from '../Input';\n\nexport interface InputBaseProps\n extends BoxProps,\n __BaseInputProps,\n StylesApiProps<InputBaseFactory> {\n __staticSelector?: string;\n\n /** Props passed to the root element (`Input.Wrapper` component) */\n wrapperProps?: Record<string, any>;\n\n /** Determines whether the input can have multiple lines, for example when `component=\"textarea\"`, `false` by default */\n multiline?: boolean;\n}\n\nexport type InputBaseFactory = PolymorphicFactory<{\n props: InputBaseProps;\n defaultRef: HTMLInputElement;\n defaultComponent: 'input';\n stylesNames: __InputStylesNames;\n variant: InputVariant;\n}>;\n\nconst defaultProps: Partial<InputBaseProps> = {\n size: 'sm',\n __staticSelector: 'InputBase',\n};\n\nexport const InputBase = polymorphicFactory<InputBaseFactory>((props, ref) => {\n const { inputProps, wrapperProps, ...others } = useInputProps('InputBase', defaultProps, props);\n return (\n <Input.Wrapper {...wrapperProps}>\n <Input {...inputProps} {...others} ref={ref} />\n </Input.Wrapper>\n );\n});\n\nInputBase.classes = { ...Input.classes, ...Input.Wrapper.classes };\nInputBase.displayName = '@mantine/core/InputBase';\n"],"names":[],"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,KAA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,KAAK,EAAE,GAAG,KAAK;AAC5D,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;AACxJ,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,EAAE,YAAY,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1N,CAAC,EAAE;AACH,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7F,SAAS,CAAC,WAAW,GAAG,yBAAyB;;;;"}
|
|
@@ -3,13 +3,13 @@ import { Bars } from './loaders/Bars.js';
|
|
|
3
3
|
import { Oval } from './loaders/Oval.js';
|
|
4
4
|
import { Dots } from './loaders/Dots.js';
|
|
5
5
|
import classes from './Loader.module.css.js';
|
|
6
|
-
import { factory } from '../../core/factory/factory.js';
|
|
7
|
-
import { createVarsResolver } from '../../core/styles-api/create-vars-resolver/create-vars-resolver.js';
|
|
8
6
|
import { getSize } from '../../core/utils/get-size/get-size.js';
|
|
9
7
|
import { getThemeColor } from '../../core/MantineProvider/color-functions/get-theme-color/get-theme-color.js';
|
|
8
|
+
import { factory } from '../../core/factory/factory.js';
|
|
10
9
|
import { useProps } from '../../core/MantineProvider/use-props/use-props.js';
|
|
11
10
|
import { useStyles } from '../../core/styles-api/use-styles/use-styles.js';
|
|
12
11
|
import { Box } from '../../core/Box/Box.js';
|
|
12
|
+
import { createVarsResolver } from '../../core/styles-api/create-vars-resolver/create-vars-resolver.js';
|
|
13
13
|
|
|
14
14
|
var __defProp = Object.defineProperty;
|
|
15
15
|
var __defProps = Object.defineProperties;
|