@tecsinapse/cortex-react 1.13.0-beta.3 → 1.13.0-beta.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/dist/cjs/components/Select/CustomMultiOption.js +38 -0
- package/dist/cjs/components/Select/MultiCheckAllOptions.js +1 -1
- package/dist/cjs/components/Select/MultiGroupedOptions.js +2 -8
- package/dist/cjs/components/Select/MultiOption.js +3 -12
- package/dist/cjs/components/Select/MultiOptions.js +2 -3
- package/dist/cjs/components/Select/index.js +3 -1
- package/dist/cjs/components/Select/useMultiSelectOption.js +29 -0
- package/dist/cjs/components/Select/utils.js +2 -2
- package/dist/esm/components/Select/CustomMultiOption.js +36 -0
- package/dist/esm/components/Select/MultiCheckAllOptions.js +1 -1
- package/dist/esm/components/Select/MultiGroupedOptions.js +2 -8
- package/dist/esm/components/Select/MultiOption.js +4 -13
- package/dist/esm/components/Select/MultiOptions.js +2 -3
- package/dist/esm/components/Select/index.js +3 -1
- package/dist/esm/components/Select/useMultiSelectOption.js +27 -0
- package/dist/esm/components/Select/utils.js +2 -2
- package/dist/types/components/Select/CustomMultiOption.d.ts +3 -0
- package/dist/types/components/Select/MultiOption.d.ts +1 -1
- package/dist/types/components/Select/context.d.ts +1 -1
- package/dist/types/components/Select/index.d.ts +2 -1
- package/dist/types/components/Select/types.d.ts +5 -2
- package/dist/types/components/Select/useMultiSelectOption.d.ts +8 -0
- package/dist/types/components/Select/utils.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var useMultiSelectOption = require('./useMultiSelectOption.js');
|
|
6
|
+
|
|
7
|
+
const SelectCustomMultiOption = ({
|
|
8
|
+
onSelect,
|
|
9
|
+
option,
|
|
10
|
+
grouped = false,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
const { onClickOption, isChecked, inputRef } = useMultiSelectOption.useMultiSelectOption(
|
|
14
|
+
option,
|
|
15
|
+
onSelect
|
|
16
|
+
);
|
|
17
|
+
return /* @__PURE__ */ React.createElement(
|
|
18
|
+
"li",
|
|
19
|
+
{
|
|
20
|
+
onClick: onClickOption,
|
|
21
|
+
className: cortexCore.option({ grouped }),
|
|
22
|
+
role: "option"
|
|
23
|
+
},
|
|
24
|
+
/* @__PURE__ */ React.createElement(
|
|
25
|
+
"input",
|
|
26
|
+
{
|
|
27
|
+
type: "checkbox",
|
|
28
|
+
checked: isChecked,
|
|
29
|
+
className: cortexCore.checkbox({ className: "pointer-events-none" }),
|
|
30
|
+
onChange: () => false,
|
|
31
|
+
ref: inputRef
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
children
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.SelectCustomMultiOption = SelectCustomMultiOption;
|
|
@@ -33,7 +33,7 @@ const SelectMultiCheckAllOptions = ({
|
|
|
33
33
|
updateSelected.splice(updateSelected.indexOf(it), 1);
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
onSelect(updateSelected);
|
|
36
|
+
onSelect?.(updateSelected);
|
|
37
37
|
}
|
|
38
38
|
}, [options, onSelect]);
|
|
39
39
|
return options?.length ? /* @__PURE__ */ React.createElement("div", { className: cortexCore.option(), onClick: checkAll }, /* @__PURE__ */ React.createElement(
|
|
@@ -14,7 +14,6 @@ var useSelectGroupedOptions = require('../../hooks/useSelectGroupedOptions.js');
|
|
|
14
14
|
var MultiOption = require('./MultiOption.js');
|
|
15
15
|
var SkeletonOptions = require('./SkeletonOptions.js');
|
|
16
16
|
var context = require('./context.js');
|
|
17
|
-
var utils = require('./utils.js');
|
|
18
17
|
|
|
19
18
|
const { groupedTitle, list } = cortexCore.selectVariants();
|
|
20
19
|
const SelectMultiGroupedOptions = ({
|
|
@@ -23,7 +22,7 @@ const SelectMultiGroupedOptions = ({
|
|
|
23
22
|
options,
|
|
24
23
|
children
|
|
25
24
|
}) => {
|
|
26
|
-
const {
|
|
25
|
+
const { keyExtractor } = React.useContext(context.SelectContext);
|
|
27
26
|
const { options: _options, isLoading } = useSelectGroupedOptions.useSelectGroupedOptions({ options });
|
|
28
27
|
const flattenMap = React.useMemo(
|
|
29
28
|
() => _options ? Array.from(_options?.values()).flatMap((value) => value) : [],
|
|
@@ -41,12 +40,7 @@ const SelectMultiGroupedOptions = ({
|
|
|
41
40
|
grouped: true,
|
|
42
41
|
option,
|
|
43
42
|
key: keyExtractor(option),
|
|
44
|
-
|
|
45
|
-
option2,
|
|
46
|
-
currentValue,
|
|
47
|
-
onSelect,
|
|
48
|
-
keyExtractor
|
|
49
|
-
)
|
|
43
|
+
onSelect
|
|
50
44
|
}
|
|
51
45
|
)))))
|
|
52
46
|
);
|
|
@@ -2,23 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var
|
|
5
|
+
var useMultiSelectOption = require('./useMultiSelectOption.js');
|
|
6
6
|
|
|
7
7
|
const SelectMultiOption = ({
|
|
8
|
-
|
|
8
|
+
onSelect,
|
|
9
9
|
option,
|
|
10
10
|
grouped = false
|
|
11
11
|
}) => {
|
|
12
|
-
const {
|
|
13
|
-
const inputRef = React.useRef(null);
|
|
14
|
-
const isChecked = React.useMemo(
|
|
15
|
-
() => value?.length > 0 && value.find((it) => keyExtractor(it) === keyExtractor(option)) !== void 0,
|
|
16
|
-
[value, option]
|
|
17
|
-
);
|
|
18
|
-
const onClickOption = React.useCallback(() => {
|
|
19
|
-
onSelectOption(option);
|
|
20
|
-
inputRef.current?.click();
|
|
21
|
-
}, [onSelectOption, inputRef]);
|
|
12
|
+
const { onClickOption, isChecked, inputRef, labelExtractor } = useMultiSelectOption.useMultiSelectOption(option, onSelect);
|
|
22
13
|
return /* @__PURE__ */ React.createElement(
|
|
23
14
|
"li",
|
|
24
15
|
{
|
|
@@ -14,7 +14,6 @@ var useSelectOptions = require('../../hooks/useSelectOptions.js');
|
|
|
14
14
|
var MultiOption = require('./MultiOption.js');
|
|
15
15
|
var SkeletonOptions = require('./SkeletonOptions.js');
|
|
16
16
|
var context = require('./context.js');
|
|
17
|
-
var utils = require('./utils.js');
|
|
18
17
|
|
|
19
18
|
const { list } = cortexCore.selectVariants();
|
|
20
19
|
const SelectMultiOptions = ({
|
|
@@ -22,14 +21,14 @@ const SelectMultiOptions = ({
|
|
|
22
21
|
options,
|
|
23
22
|
children
|
|
24
23
|
}) => {
|
|
25
|
-
const { keyExtractor
|
|
24
|
+
const { keyExtractor } = React.useContext(context.SelectContext);
|
|
26
25
|
const { options: _options, isLoading } = useSelectOptions.useSelectOptions({ options });
|
|
27
26
|
return /* @__PURE__ */ React.createElement(context.SelectMultiOptionsContext.Provider, { value: { onSelect, options: _options } }, isLoading ? /* @__PURE__ */ React.createElement(SkeletonOptions.SkeletonOptions, null) : /* @__PURE__ */ React.createElement("ul", { role: "select", className: list() }, children, _options?.map((option) => /* @__PURE__ */ React.createElement(
|
|
28
27
|
MultiOption.SelectMultiOption,
|
|
29
28
|
{
|
|
30
29
|
option,
|
|
31
30
|
key: keyExtractor(option),
|
|
32
|
-
|
|
31
|
+
onSelect
|
|
33
32
|
}
|
|
34
33
|
))));
|
|
35
34
|
};
|
|
@@ -11,6 +11,7 @@ var Popover = require('./Popover.js');
|
|
|
11
11
|
var Root = require('./Root.js');
|
|
12
12
|
var Trigger = require('./Trigger.js');
|
|
13
13
|
var CustomOption = require('./CustomOption.js');
|
|
14
|
+
var CustomMultiOption = require('./CustomMultiOption.js');
|
|
14
15
|
|
|
15
16
|
const Select = {
|
|
16
17
|
Root: Root.SelectRoot,
|
|
@@ -23,7 +24,8 @@ const Select = {
|
|
|
23
24
|
MultiGroupedOptions: MultiGroupedOptions.SelectMultiGroupedOptions,
|
|
24
25
|
MultiOption: MultiOption.SelectMultiOption,
|
|
25
26
|
MultiCheckAllOptions: MultiCheckAllOptions.SelectMultiCheckAllOptions,
|
|
26
|
-
CustomOption: CustomOption.SelectCustomOption
|
|
27
|
+
CustomOption: CustomOption.SelectCustomOption,
|
|
28
|
+
CustomMultiOption: CustomMultiOption.SelectCustomMultiOption
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
exports.Select = Select;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var context = require('./context.js');
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
|
|
7
|
+
const useMultiSelectOption = (option, onSelect) => {
|
|
8
|
+
const { keyExtractor, value, labelExtractor } = React.useContext(context.SelectContext);
|
|
9
|
+
const inputRef = React.useRef(null);
|
|
10
|
+
const onSelectOption = (option2) => utils.handleSelectMulti(option2, value, keyExtractor, onSelect);
|
|
11
|
+
const isChecked = React.useMemo(
|
|
12
|
+
() => value?.length > 0 && value.find((it) => keyExtractor(it) === keyExtractor(option)) !== void 0,
|
|
13
|
+
[value, option]
|
|
14
|
+
);
|
|
15
|
+
const onClickOption = React.useCallback(() => {
|
|
16
|
+
onSelectOption(option);
|
|
17
|
+
inputRef.current?.click();
|
|
18
|
+
}, [onSelectOption, inputRef]);
|
|
19
|
+
return {
|
|
20
|
+
keyExtractor,
|
|
21
|
+
value,
|
|
22
|
+
isChecked,
|
|
23
|
+
onClickOption,
|
|
24
|
+
inputRef,
|
|
25
|
+
labelExtractor
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.useMultiSelectOption = useMultiSelectOption;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const handleSelectMulti = (option, value,
|
|
3
|
+
const handleSelectMulti = (option, value, keyExtractor, onSelect) => {
|
|
4
4
|
const current = Array.from(value ?? []);
|
|
5
5
|
const indexOf = current.findIndex(
|
|
6
6
|
(it) => keyExtractor(it) === keyExtractor(option)
|
|
@@ -10,7 +10,7 @@ const handleSelectMulti = (option, value, onSelect, keyExtractor) => {
|
|
|
10
10
|
} else {
|
|
11
11
|
current.splice(indexOf, 1);
|
|
12
12
|
}
|
|
13
|
-
onSelect(current);
|
|
13
|
+
onSelect?.(current);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
exports.handleSelectMulti = handleSelectMulti;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { option, checkbox } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { useMultiSelectOption } from './useMultiSelectOption.js';
|
|
4
|
+
|
|
5
|
+
const SelectCustomMultiOption = ({
|
|
6
|
+
onSelect,
|
|
7
|
+
option: option$1,
|
|
8
|
+
grouped = false,
|
|
9
|
+
children
|
|
10
|
+
}) => {
|
|
11
|
+
const { onClickOption, isChecked, inputRef } = useMultiSelectOption(
|
|
12
|
+
option$1,
|
|
13
|
+
onSelect
|
|
14
|
+
);
|
|
15
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
16
|
+
"li",
|
|
17
|
+
{
|
|
18
|
+
onClick: onClickOption,
|
|
19
|
+
className: option({ grouped }),
|
|
20
|
+
role: "option"
|
|
21
|
+
},
|
|
22
|
+
/* @__PURE__ */ React__default.createElement(
|
|
23
|
+
"input",
|
|
24
|
+
{
|
|
25
|
+
type: "checkbox",
|
|
26
|
+
checked: isChecked,
|
|
27
|
+
className: checkbox({ className: "pointer-events-none" }),
|
|
28
|
+
onChange: () => false,
|
|
29
|
+
ref: inputRef
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
children
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { SelectCustomMultiOption };
|
|
@@ -31,7 +31,7 @@ const SelectMultiCheckAllOptions = ({
|
|
|
31
31
|
updateSelected.splice(updateSelected.indexOf(it), 1);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
onSelect(updateSelected);
|
|
34
|
+
onSelect?.(updateSelected);
|
|
35
35
|
}
|
|
36
36
|
}, [options, onSelect]);
|
|
37
37
|
return options?.length ? /* @__PURE__ */ React__default.createElement("div", { className: option(), onClick: checkAll }, /* @__PURE__ */ React__default.createElement(
|
|
@@ -12,7 +12,6 @@ import { useSelectGroupedOptions } from '../../hooks/useSelectGroupedOptions.js'
|
|
|
12
12
|
import { SelectMultiOption } from './MultiOption.js';
|
|
13
13
|
import { SkeletonOptions } from './SkeletonOptions.js';
|
|
14
14
|
import { SelectContext, SelectMultiOptionsContext } from './context.js';
|
|
15
|
-
import { handleSelectMulti } from './utils.js';
|
|
16
15
|
|
|
17
16
|
const { groupedTitle, list } = selectVariants();
|
|
18
17
|
const SelectMultiGroupedOptions = ({
|
|
@@ -21,7 +20,7 @@ const SelectMultiGroupedOptions = ({
|
|
|
21
20
|
options,
|
|
22
21
|
children
|
|
23
22
|
}) => {
|
|
24
|
-
const {
|
|
23
|
+
const { keyExtractor } = useContext(SelectContext);
|
|
25
24
|
const { options: _options, isLoading } = useSelectGroupedOptions({ options });
|
|
26
25
|
const flattenMap = useMemo(
|
|
27
26
|
() => _options ? Array.from(_options?.values()).flatMap((value) => value) : [],
|
|
@@ -39,12 +38,7 @@ const SelectMultiGroupedOptions = ({
|
|
|
39
38
|
grouped: true,
|
|
40
39
|
option,
|
|
41
40
|
key: keyExtractor(option),
|
|
42
|
-
|
|
43
|
-
option2,
|
|
44
|
-
currentValue,
|
|
45
|
-
onSelect,
|
|
46
|
-
keyExtractor
|
|
47
|
-
)
|
|
41
|
+
onSelect
|
|
48
42
|
}
|
|
49
43
|
)))))
|
|
50
44
|
);
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { option, checkbox } from '@tecsinapse/cortex-core';
|
|
2
|
-
import React__default
|
|
3
|
-
import {
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { useMultiSelectOption } from './useMultiSelectOption.js';
|
|
4
4
|
|
|
5
5
|
const SelectMultiOption = ({
|
|
6
|
-
|
|
6
|
+
onSelect,
|
|
7
7
|
option: option$1,
|
|
8
8
|
grouped = false
|
|
9
9
|
}) => {
|
|
10
|
-
const {
|
|
11
|
-
const inputRef = useRef(null);
|
|
12
|
-
const isChecked = useMemo(
|
|
13
|
-
() => value?.length > 0 && value.find((it) => keyExtractor(it) === keyExtractor(option$1)) !== void 0,
|
|
14
|
-
[value, option$1]
|
|
15
|
-
);
|
|
16
|
-
const onClickOption = useCallback(() => {
|
|
17
|
-
onSelectOption(option$1);
|
|
18
|
-
inputRef.current?.click();
|
|
19
|
-
}, [onSelectOption, inputRef]);
|
|
10
|
+
const { onClickOption, isChecked, inputRef, labelExtractor } = useMultiSelectOption(option$1, onSelect);
|
|
20
11
|
return /* @__PURE__ */ React__default.createElement(
|
|
21
12
|
"li",
|
|
22
13
|
{
|
|
@@ -12,7 +12,6 @@ import { useSelectOptions } from '../../hooks/useSelectOptions.js';
|
|
|
12
12
|
import { SelectMultiOption } from './MultiOption.js';
|
|
13
13
|
import { SkeletonOptions } from './SkeletonOptions.js';
|
|
14
14
|
import { SelectContext, SelectMultiOptionsContext } from './context.js';
|
|
15
|
-
import { handleSelectMulti } from './utils.js';
|
|
16
15
|
|
|
17
16
|
const { list } = selectVariants();
|
|
18
17
|
const SelectMultiOptions = ({
|
|
@@ -20,14 +19,14 @@ const SelectMultiOptions = ({
|
|
|
20
19
|
options,
|
|
21
20
|
children
|
|
22
21
|
}) => {
|
|
23
|
-
const { keyExtractor
|
|
22
|
+
const { keyExtractor } = useContext(SelectContext);
|
|
24
23
|
const { options: _options, isLoading } = useSelectOptions({ options });
|
|
25
24
|
return /* @__PURE__ */ React__default.createElement(SelectMultiOptionsContext.Provider, { value: { onSelect, options: _options } }, isLoading ? /* @__PURE__ */ React__default.createElement(SkeletonOptions, null) : /* @__PURE__ */ React__default.createElement("ul", { role: "select", className: list() }, children, _options?.map((option) => /* @__PURE__ */ React__default.createElement(
|
|
26
25
|
SelectMultiOption,
|
|
27
26
|
{
|
|
28
27
|
option,
|
|
29
28
|
key: keyExtractor(option),
|
|
30
|
-
|
|
29
|
+
onSelect
|
|
31
30
|
}
|
|
32
31
|
))));
|
|
33
32
|
};
|
|
@@ -9,6 +9,7 @@ import { SelectPopover } from './Popover.js';
|
|
|
9
9
|
import { SelectRoot } from './Root.js';
|
|
10
10
|
import { SelectTrigger } from './Trigger.js';
|
|
11
11
|
import { SelectCustomOption } from './CustomOption.js';
|
|
12
|
+
import { SelectCustomMultiOption } from './CustomMultiOption.js';
|
|
12
13
|
|
|
13
14
|
const Select = {
|
|
14
15
|
Root: SelectRoot,
|
|
@@ -21,7 +22,8 @@ const Select = {
|
|
|
21
22
|
MultiGroupedOptions: SelectMultiGroupedOptions,
|
|
22
23
|
MultiOption: SelectMultiOption,
|
|
23
24
|
MultiCheckAllOptions: SelectMultiCheckAllOptions,
|
|
24
|
-
CustomOption: SelectCustomOption
|
|
25
|
+
CustomOption: SelectCustomOption,
|
|
26
|
+
CustomMultiOption: SelectCustomMultiOption
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
export { Select };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useContext, useRef, useMemo, useCallback } from 'react';
|
|
2
|
+
import { SelectContext } from './context.js';
|
|
3
|
+
import { handleSelectMulti } from './utils.js';
|
|
4
|
+
|
|
5
|
+
const useMultiSelectOption = (option, onSelect) => {
|
|
6
|
+
const { keyExtractor, value, labelExtractor } = useContext(SelectContext);
|
|
7
|
+
const inputRef = useRef(null);
|
|
8
|
+
const onSelectOption = (option2) => handleSelectMulti(option2, value, keyExtractor, onSelect);
|
|
9
|
+
const isChecked = useMemo(
|
|
10
|
+
() => value?.length > 0 && value.find((it) => keyExtractor(it) === keyExtractor(option)) !== void 0,
|
|
11
|
+
[value, option]
|
|
12
|
+
);
|
|
13
|
+
const onClickOption = useCallback(() => {
|
|
14
|
+
onSelectOption(option);
|
|
15
|
+
inputRef.current?.click();
|
|
16
|
+
}, [onSelectOption, inputRef]);
|
|
17
|
+
return {
|
|
18
|
+
keyExtractor,
|
|
19
|
+
value,
|
|
20
|
+
isChecked,
|
|
21
|
+
onClickOption,
|
|
22
|
+
inputRef,
|
|
23
|
+
labelExtractor
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { useMultiSelectOption };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const handleSelectMulti = (option, value,
|
|
1
|
+
const handleSelectMulti = (option, value, keyExtractor, onSelect) => {
|
|
2
2
|
const current = Array.from(value ?? []);
|
|
3
3
|
const indexOf = current.findIndex(
|
|
4
4
|
(it) => keyExtractor(it) === keyExtractor(option)
|
|
@@ -8,7 +8,7 @@ const handleSelectMulti = (option, value, onSelect, keyExtractor) => {
|
|
|
8
8
|
} else {
|
|
9
9
|
current.splice(indexOf, 1);
|
|
10
10
|
}
|
|
11
|
-
onSelect(current);
|
|
11
|
+
onSelect?.(current);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export { handleSelectMulti };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SelectMultiOptionProps } from './types';
|
|
3
|
-
export declare const SelectMultiOption: <T>({
|
|
3
|
+
export declare const SelectMultiOption: <T>({ onSelect, option, grouped, }: SelectMultiOptionProps<T>) => React.JSX.Element;
|
|
@@ -8,7 +8,7 @@ interface SelectContextProps<T> {
|
|
|
8
8
|
export declare const SelectContext: import("react").Context<SelectContextProps<any>>;
|
|
9
9
|
interface SelectMultiOptionsContextProps<T> {
|
|
10
10
|
options?: T[];
|
|
11
|
-
onSelect
|
|
11
|
+
onSelect?: (value: T[]) => void;
|
|
12
12
|
}
|
|
13
13
|
export declare const SelectMultiOptionsContext: import("react").Context<SelectMultiOptionsContextProps<any>>;
|
|
14
14
|
export {};
|
|
@@ -7,8 +7,9 @@ export declare const Select: {
|
|
|
7
7
|
Option: <T>({ onSelectOption, option, grouped, }: import("./types").SelectOptionProps<T>) => import("react").JSX.Element;
|
|
8
8
|
MultiOptions: <T>({ onSelect, options, children, }: import("./types").SelectMultiOptionsProps<T>) => import("react").JSX.Element;
|
|
9
9
|
MultiGroupedOptions: <T>({ onSelect, groupedLabelExtractor, options, children, }: import("./types").SelectMultiGroupedOptionsProps<T>) => import("react").JSX.Element;
|
|
10
|
-
MultiOption: <T>({
|
|
10
|
+
MultiOption: <T>({ onSelect, option, grouped, }: import("./types").SelectMultiOptionProps<T>) => import("react").JSX.Element;
|
|
11
11
|
MultiCheckAllOptions: <T>({ checkAllLabel, }: import("./types").SelectMultiCheckAllOptionsProps) => import("react").JSX.Element;
|
|
12
12
|
CustomOption: <T>({ option, onSelectOption, grouped, children, }: import("./types").CustomOptionProps<T>) => import("react").JSX.Element;
|
|
13
|
+
CustomMultiOption: <T>({ onSelect, option, grouped, children, }: import("./types").CustomMultiOptionProps<T>) => import("react").JSX.Element;
|
|
13
14
|
};
|
|
14
15
|
export * from './types';
|
|
@@ -19,12 +19,15 @@ export interface SelectMultiGroupedOptionsProps<T> {
|
|
|
19
19
|
}
|
|
20
20
|
export interface SelectMultiOptionProps<T> {
|
|
21
21
|
option: T;
|
|
22
|
-
|
|
22
|
+
onSelect?: (option: T[]) => void;
|
|
23
23
|
grouped?: boolean;
|
|
24
24
|
}
|
|
25
|
+
export interface CustomMultiOptionProps<T> extends SelectMultiOptionProps<T> {
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
}
|
|
25
28
|
export interface SelectMultiOptionsProps<T> {
|
|
26
29
|
options?: T[] | (() => Promise<T[]>);
|
|
27
|
-
onSelect
|
|
30
|
+
onSelect?: (value: T[]) => void;
|
|
28
31
|
children?: React.ReactNode;
|
|
29
32
|
}
|
|
30
33
|
export interface SelectOptionProps<T> {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const useMultiSelectOption: <T>(option: T, onSelect?: (option: T[]) => void) => {
|
|
2
|
+
keyExtractor: (value: any) => string;
|
|
3
|
+
value: any;
|
|
4
|
+
isChecked: boolean;
|
|
5
|
+
onClickOption: () => void;
|
|
6
|
+
inputRef: import("react").RefObject<HTMLInputElement>;
|
|
7
|
+
labelExtractor: (value: any) => string;
|
|
8
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const handleSelectMulti: <T>(option: T, value: T[],
|
|
1
|
+
export declare const handleSelectMulti: <T>(option: T, value: T[], keyExtractor: (value: T) => string, onSelect?: (value: T[]) => void) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.13.0-beta.
|
|
3
|
+
"version": "1.13.0-beta.4",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"react-icons": ">=5.2.0",
|
|
48
48
|
"tailwind": ">=3.3.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "de7f5e6b13c54069be4e5f2cb18bd7aa2f4af1c8"
|
|
51
51
|
}
|