@semcore/select 3.1.3 → 3.1.5
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/CHANGELOG.md +12 -0
- package/lib/cjs/InputSearch.js +7 -7
- package/lib/cjs/Select.js +8 -8
- package/lib/cjs/index.d.js +2 -0
- package/lib/cjs/index.d.js.map +1 -0
- package/lib/es6/InputSearch.js +7 -7
- package/lib/es6/Select.js +8 -8
- package/lib/es6/index.d.js +2 -0
- package/lib/es6/index.d.js.map +1 -0
- package/package.json +3 -2
- package/lib/cjs/index.d.ts +0 -128
- package/lib/es6/index.d.ts +0 -128
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.1.5] - 2022-10-04
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version patch update due to children dependencies update (`@semcore/base-trigger` [3.0.22 ~> 3.0.23], `@semcore/checkbox` [6.0.12 ~> 6.0.13], `@semcore/divider` [3.0.9 ~> 3.0.10], `@semcore/dropdown-menu` [3.1.0 ~> 3.1.1], `@semcore/flex-box` [4.5.11 ~> 4.5.12], `@semcore/icon` [2.32.1 ~> 2.32.2], `@semcore/input` [3.0.15 ~> 3.0.16], `@semcore/utils` [3.37.1 ~> 3.37.2]).
|
|
10
|
+
|
|
11
|
+
## [3.1.4] - 2022-10-03
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Version patch update due to children dependencies update (`@semcore/base-trigger` [3.0.21 ~> 3.0.22], `@semcore/icon` [2.32.0 ~> 2.32.1]).
|
|
16
|
+
|
|
5
17
|
## [3.1.3] - 2022-09-29
|
|
6
18
|
|
|
7
19
|
### Changed
|
package/lib/cjs/InputSearch.js
CHANGED
|
@@ -52,16 +52,16 @@ var style = (
|
|
|
52
52
|
/*__reshadow_css_start__*/
|
|
53
53
|
_core.sstyled.insert(
|
|
54
54
|
/*__inner_css_start__*/
|
|
55
|
-
".
|
|
55
|
+
".___SInputSearch_ydoek_gg_._size_m_ydoek_gg_{height:32px}.___SClose_ydoek_gg_.__hide_ydoek_gg_{visibility:hidden}.___SOutline_ydoek_gg_{top:-1px;left:-1px;width:100%;border-radius:6px 6px 0 0}"
|
|
56
56
|
/*__inner_css_end__*/
|
|
57
|
-
, "
|
|
57
|
+
, "ydoek_gg_")
|
|
58
58
|
/*__reshadow_css_end__*/
|
|
59
59
|
, {
|
|
60
|
-
"__SInputSearch": "
|
|
61
|
-
"_size_m": "
|
|
62
|
-
"__SClose": "
|
|
63
|
-
"_hide": "
|
|
64
|
-
"__SOutline": "
|
|
60
|
+
"__SInputSearch": "___SInputSearch_ydoek_gg_",
|
|
61
|
+
"_size_m": "_size_m_ydoek_gg_",
|
|
62
|
+
"__SClose": "___SClose_ydoek_gg_",
|
|
63
|
+
"_hide": "__hide_ydoek_gg_",
|
|
64
|
+
"__SOutline": "___SOutline_ydoek_gg_"
|
|
65
65
|
});
|
|
66
66
|
var MAP_SIZE_TO_ICON = {
|
|
67
67
|
m: [_m["default"], _m2["default"]],
|
package/lib/cjs/Select.js
CHANGED
|
@@ -78,17 +78,17 @@ var style = (
|
|
|
78
78
|
/*__reshadow_css_start__*/
|
|
79
79
|
_core.sstyled.insert(
|
|
80
80
|
/*__inner_css_start__*/
|
|
81
|
-
".
|
|
81
|
+
".___SOptionCheckbox_c9t2c_gg_{margin-top:2px;margin-right:8px;margin-bottom:auto;position:relative;flex-shrink:0}.___SOptionCheckbox_c9t2c_gg_:before{content:\"\";position:absolute;top:0;left:0;right:0;bottom:0;background:#fff;border:1px solid;border-radius:4px;border-color:#c4c7cf}.___SOptionCheckbox_c9t2c_gg_{width:16px;height:16px}.___SOptionCheckbox_c9t2c_gg_:after{content:\"\";position:absolute;top:0;left:0;right:0;bottom:0;margin:0 2px;background-repeat:no-repeat;background-position:50%;background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iNyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOC4yNSAxTDQgNS4yNSAxLjc1IDMiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=\")}.___SOptionCheckbox_c9t2c_gg_._size_l_c9t2c_gg_{width:20px;height:20px}.___SOptionCheckbox_c9t2c_gg_._size_l_c9t2c_gg_:after{background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTEgMS41TDQuNzUgNy43NSAxIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=\")}.___SOptionCheckbox_c9t2c_gg_.__checked_c9t2c_gg_:before{background-color:#008ff8;border-color:#008ff8}.___SOptionCheckbox_c9t2c_gg_.__theme_c9t2c_gg_:before{border-color:var(--theme_c9t2c)}.___SOptionCheckbox_c9t2c_gg_.__theme_c9t2c_gg_.__checked_c9t2c_gg_:before{background-color:var(--theme_c9t2c);border-color:var(--theme_c9t2c)}.___SOptionCheckbox_c9t2c_gg_.__selected_c9t2c_gg_{background-color:rgba(196,229,254,.7)}.___SOptionCheckbox_c9t2c_gg_.__selected_c9t2c_gg_:hover{background-color:rgba(196,229,254,.7)}"
|
|
82
82
|
/*__inner_css_end__*/
|
|
83
|
-
, "
|
|
83
|
+
, "c9t2c_gg_")
|
|
84
84
|
/*__reshadow_css_end__*/
|
|
85
85
|
, {
|
|
86
|
-
"__SOptionCheckbox": "
|
|
87
|
-
"_size_l": "
|
|
88
|
-
"_checked": "
|
|
89
|
-
"_theme": "
|
|
90
|
-
"--theme": "--
|
|
91
|
-
"_selected": "
|
|
86
|
+
"__SOptionCheckbox": "___SOptionCheckbox_c9t2c_gg_",
|
|
87
|
+
"_size_l": "_size_l_c9t2c_gg_",
|
|
88
|
+
"_checked": "__checked_c9t2c_gg_",
|
|
89
|
+
"_theme": "__theme_c9t2c_gg_",
|
|
90
|
+
"--theme": "--theme_c9t2c",
|
|
91
|
+
"_selected": "__selected_c9t2c_gg_"
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
function isSelectedOption(value, valueOption) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React, { ComponentProps } from 'react';\nimport { CProps, Merge, PropGetterFn, ReturnEl } from '@semcore/core';\nimport DropdownMenu, {\n IDropdownMenuContext,\n IDropdownMenuItemProps,\n IDropdownMenuProps,\n IDropdownMenuHandlers,\n} from '@semcore/dropdown-menu';\nimport { ButtonTrigger, IBaseTriggerProps } from '@semcore/base-trigger';\nimport Divider from '@semcore/divider';\nimport { IInputValueProps } from '@semcore/input';\nimport { IBoxProps } from '@semcore/flex-box';\n\nexport interface ISelectInputSearch extends IInputValueProps {}\n\nexport type OptionValue = string | number;\nexport type SelectValue = string | number | Array<string | number> | null;\n\nexport type SelectOption = {\n value: OptionValue;\n children?: React.ReactNode;\n label?: React.ReactNode;\n};\n\nexport interface ISelectProps<T extends SelectValue = SelectValue>\n extends IDropdownMenuProps,\n IBaseTriggerProps {\n /**\n * Multiple select\n */\n multiselect?: boolean;\n /**\n * Options array\n */\n options?: SelectOption[];\n /**\n * The value or values array selected by default when using multiselect\n * @type SelectValue\n */\n defaultValue?: T;\n /**\n * The selected value or values array when using multiselect\n * @type SelectValue\n */\n value?: T;\n /**\n * Callback on value change\n * @type (value: SelectValue, e: React.SyntheticEvent) => boolean | void\n */\n onChange?: (value: T, e: React.SyntheticEvent) => boolean | void;\n /**\n * Trigger placeholder at not selected value\n */\n placeholder?: React.ReactNode;\n /**\n * Trigger state\n */\n state?: 'normal' | 'valid' | 'invalid';\n /**\n * Disables select\n */\n disabled?: boolean;\n /**\n * Input name\n */\n name?: string;\n}\n\nexport interface ISelectOption {\n value?: string | number;\n [key: string]: any;\n}\n\nexport interface ISelectOptionProps extends IDropdownMenuItemProps {\n /** Value of the option */\n value: string | number;\n}\n\nexport interface ISelectOptionCheckboxProps extends ISelectOptionProps {\n /** Checkbox theme */\n theme?: string;\n}\n\ndeclare const InputSearch: <T>(props: ISelectInputSearch & T) => ReturnEl;\n\nexport interface ISelectContext extends IDropdownMenuContext {\n getOptionProps: PropGetterFn;\n getOptionCheckboxProps: PropGetterFn;\n getDividerProps: PropGetterFn;\n}\n\nexport interface ISelectHandlers extends IDropdownMenuHandlers {\n value: (index: SelectValue) => void;\n}\n\ndeclare const Select: (<T, V extends SelectValue = SelectValue>(\n props: CProps<ISelectProps<V> & T, ISelectContext, ISelectHandlers>,\n) => ReturnEl) & {\n Trigger: (<T>(\n props: Merge<\n ComponentProps<typeof DropdownMenu.Trigger>,\n ComponentProps<typeof ButtonTrigger>\n > &\n T,\n ) => ReturnEl) & {\n Addon: typeof ButtonTrigger.Addon;\n Text: typeof ButtonTrigger.Text;\n };\n Popper: typeof DropdownMenu.Popper;\n List: typeof DropdownMenu.List;\n Menu: typeof DropdownMenu.Menu;\n Option: (<T>(\n props: CProps<ISelectOptionProps & T, ISelectContext, ISelectHandlers>,\n ) => ReturnEl) & {\n Addon: typeof DropdownMenu.Item.Addon;\n Checkbox: <T>(\n props: CProps<IBoxProps & { theme?: string; selected?: boolean } & T>,\n ) => ReturnEl;\n };\n OptionTitle: typeof DropdownMenu.ItemTitle;\n OptionHint: typeof DropdownMenu.ItemHint;\n Divider: typeof Divider;\n InputSearch: typeof InputSearch;\n Input: typeof InputSearch;\n};\n\nexport { InputSearch };\nexport default Select;\n"],"mappings":""}
|
package/lib/es6/InputSearch.js
CHANGED
|
@@ -28,16 +28,16 @@ var style = (
|
|
|
28
28
|
/*__reshadow_css_start__*/
|
|
29
29
|
_sstyled.insert(
|
|
30
30
|
/*__inner_css_start__*/
|
|
31
|
-
".
|
|
31
|
+
".___SInputSearch_ydoek_gg_._size_m_ydoek_gg_{height:32px}.___SClose_ydoek_gg_.__hide_ydoek_gg_{visibility:hidden}.___SOutline_ydoek_gg_{top:-1px;left:-1px;width:100%;border-radius:6px 6px 0 0}"
|
|
32
32
|
/*__inner_css_end__*/
|
|
33
|
-
, "
|
|
33
|
+
, "ydoek_gg_")
|
|
34
34
|
/*__reshadow_css_end__*/
|
|
35
35
|
, {
|
|
36
|
-
"__SInputSearch": "
|
|
37
|
-
"_size_m": "
|
|
38
|
-
"__SClose": "
|
|
39
|
-
"_hide": "
|
|
40
|
-
"__SOutline": "
|
|
36
|
+
"__SInputSearch": "___SInputSearch_ydoek_gg_",
|
|
37
|
+
"_size_m": "_size_m_ydoek_gg_",
|
|
38
|
+
"__SClose": "___SClose_ydoek_gg_",
|
|
39
|
+
"_hide": "__hide_ydoek_gg_",
|
|
40
|
+
"__SOutline": "___SOutline_ydoek_gg_"
|
|
41
41
|
});
|
|
42
42
|
var MAP_SIZE_TO_ICON = {
|
|
43
43
|
m: [SearchM, CloseM],
|
package/lib/es6/Select.js
CHANGED
|
@@ -44,17 +44,17 @@ var style = (
|
|
|
44
44
|
/*__reshadow_css_start__*/
|
|
45
45
|
_sstyled.insert(
|
|
46
46
|
/*__inner_css_start__*/
|
|
47
|
-
".
|
|
47
|
+
".___SOptionCheckbox_c9t2c_gg_{margin-top:2px;margin-right:8px;margin-bottom:auto;position:relative;flex-shrink:0}.___SOptionCheckbox_c9t2c_gg_:before{content:\"\";position:absolute;top:0;left:0;right:0;bottom:0;background:#fff;border:1px solid;border-radius:4px;border-color:#c4c7cf}.___SOptionCheckbox_c9t2c_gg_{width:16px;height:16px}.___SOptionCheckbox_c9t2c_gg_:after{content:\"\";position:absolute;top:0;left:0;right:0;bottom:0;margin:0 2px;background-repeat:no-repeat;background-position:50%;background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iNyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOC4yNSAxTDQgNS4yNSAxLjc1IDMiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=\")}.___SOptionCheckbox_c9t2c_gg_._size_l_c9t2c_gg_{width:20px;height:20px}.___SOptionCheckbox_c9t2c_gg_._size_l_c9t2c_gg_:after{background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTEgMS41TDQuNzUgNy43NSAxIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=\")}.___SOptionCheckbox_c9t2c_gg_.__checked_c9t2c_gg_:before{background-color:#008ff8;border-color:#008ff8}.___SOptionCheckbox_c9t2c_gg_.__theme_c9t2c_gg_:before{border-color:var(--theme_c9t2c)}.___SOptionCheckbox_c9t2c_gg_.__theme_c9t2c_gg_.__checked_c9t2c_gg_:before{background-color:var(--theme_c9t2c);border-color:var(--theme_c9t2c)}.___SOptionCheckbox_c9t2c_gg_.__selected_c9t2c_gg_{background-color:rgba(196,229,254,.7)}.___SOptionCheckbox_c9t2c_gg_.__selected_c9t2c_gg_:hover{background-color:rgba(196,229,254,.7)}"
|
|
48
48
|
/*__inner_css_end__*/
|
|
49
|
-
, "
|
|
49
|
+
, "c9t2c_gg_")
|
|
50
50
|
/*__reshadow_css_end__*/
|
|
51
51
|
, {
|
|
52
|
-
"__SOptionCheckbox": "
|
|
53
|
-
"_size_l": "
|
|
54
|
-
"_checked": "
|
|
55
|
-
"_theme": "
|
|
56
|
-
"--theme": "--
|
|
57
|
-
"_selected": "
|
|
52
|
+
"__SOptionCheckbox": "___SOptionCheckbox_c9t2c_gg_",
|
|
53
|
+
"_size_l": "_size_l_c9t2c_gg_",
|
|
54
|
+
"_checked": "__checked_c9t2c_gg_",
|
|
55
|
+
"_theme": "__theme_c9t2c_gg_",
|
|
56
|
+
"--theme": "--theme_c9t2c",
|
|
57
|
+
"_selected": "__selected_c9t2c_gg_"
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
function isSelectedOption(value, valueOption) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React, { ComponentProps } from 'react';\nimport { CProps, Merge, PropGetterFn, ReturnEl } from '@semcore/core';\nimport DropdownMenu, {\n IDropdownMenuContext,\n IDropdownMenuItemProps,\n IDropdownMenuProps,\n IDropdownMenuHandlers,\n} from '@semcore/dropdown-menu';\nimport { ButtonTrigger, IBaseTriggerProps } from '@semcore/base-trigger';\nimport Divider from '@semcore/divider';\nimport { IInputValueProps } from '@semcore/input';\nimport { IBoxProps } from '@semcore/flex-box';\n\nexport interface ISelectInputSearch extends IInputValueProps {}\n\nexport type OptionValue = string | number;\nexport type SelectValue = string | number | Array<string | number> | null;\n\nexport type SelectOption = {\n value: OptionValue;\n children?: React.ReactNode;\n label?: React.ReactNode;\n};\n\nexport interface ISelectProps<T extends SelectValue = SelectValue>\n extends IDropdownMenuProps,\n IBaseTriggerProps {\n /**\n * Multiple select\n */\n multiselect?: boolean;\n /**\n * Options array\n */\n options?: SelectOption[];\n /**\n * The value or values array selected by default when using multiselect\n * @type SelectValue\n */\n defaultValue?: T;\n /**\n * The selected value or values array when using multiselect\n * @type SelectValue\n */\n value?: T;\n /**\n * Callback on value change\n * @type (value: SelectValue, e: React.SyntheticEvent) => boolean | void\n */\n onChange?: (value: T, e: React.SyntheticEvent) => boolean | void;\n /**\n * Trigger placeholder at not selected value\n */\n placeholder?: React.ReactNode;\n /**\n * Trigger state\n */\n state?: 'normal' | 'valid' | 'invalid';\n /**\n * Disables select\n */\n disabled?: boolean;\n /**\n * Input name\n */\n name?: string;\n}\n\nexport interface ISelectOption {\n value?: string | number;\n [key: string]: any;\n}\n\nexport interface ISelectOptionProps extends IDropdownMenuItemProps {\n /** Value of the option */\n value: string | number;\n}\n\nexport interface ISelectOptionCheckboxProps extends ISelectOptionProps {\n /** Checkbox theme */\n theme?: string;\n}\n\ndeclare const InputSearch: <T>(props: ISelectInputSearch & T) => ReturnEl;\n\nexport interface ISelectContext extends IDropdownMenuContext {\n getOptionProps: PropGetterFn;\n getOptionCheckboxProps: PropGetterFn;\n getDividerProps: PropGetterFn;\n}\n\nexport interface ISelectHandlers extends IDropdownMenuHandlers {\n value: (index: SelectValue) => void;\n}\n\ndeclare const Select: (<T, V extends SelectValue = SelectValue>(\n props: CProps<ISelectProps<V> & T, ISelectContext, ISelectHandlers>,\n) => ReturnEl) & {\n Trigger: (<T>(\n props: Merge<\n ComponentProps<typeof DropdownMenu.Trigger>,\n ComponentProps<typeof ButtonTrigger>\n > &\n T,\n ) => ReturnEl) & {\n Addon: typeof ButtonTrigger.Addon;\n Text: typeof ButtonTrigger.Text;\n };\n Popper: typeof DropdownMenu.Popper;\n List: typeof DropdownMenu.List;\n Menu: typeof DropdownMenu.Menu;\n Option: (<T>(\n props: CProps<ISelectOptionProps & T, ISelectContext, ISelectHandlers>,\n ) => ReturnEl) & {\n Addon: typeof DropdownMenu.Item.Addon;\n Checkbox: <T>(\n props: CProps<IBoxProps & { theme?: string; selected?: boolean } & T>,\n ) => ReturnEl;\n };\n OptionTitle: typeof DropdownMenu.ItemTitle;\n OptionHint: typeof DropdownMenu.ItemHint;\n Divider: typeof Divider;\n InputSearch: typeof InputSearch;\n Input: typeof InputSearch;\n};\n\nexport { InputSearch };\nexport default Select;\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/select",
|
|
3
3
|
"description": "Semrush Select Component",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.5",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
8
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "
|
|
11
|
+
"build": "pnpm semcore-builder --source=js",
|
|
12
12
|
"test": "jest"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"directory": "semcore/select"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@types/react": "16.8 - 17",
|
|
38
39
|
"@guidepup/playwright": "0.6.1",
|
|
39
40
|
"@playwright/test": "1.25.1",
|
|
40
41
|
"@semcore/jest-preset-ui": "1.0.0"
|
package/lib/cjs/index.d.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import React, { ComponentProps } from 'react';
|
|
2
|
-
import { CProps, Merge, PropGetterFn, ReturnEl } from '@semcore/core';
|
|
3
|
-
import DropdownMenu, {
|
|
4
|
-
IDropdownMenuContext,
|
|
5
|
-
IDropdownMenuItemProps,
|
|
6
|
-
IDropdownMenuProps,
|
|
7
|
-
IDropdownMenuHandlers,
|
|
8
|
-
} from '@semcore/dropdown-menu';
|
|
9
|
-
import { ButtonTrigger, IBaseTriggerProps } from '@semcore/base-trigger';
|
|
10
|
-
import Divider from '@semcore/divider';
|
|
11
|
-
import { IInputValueProps } from '@semcore/input';
|
|
12
|
-
import { IBoxProps } from '@semcore/flex-box';
|
|
13
|
-
|
|
14
|
-
export interface ISelectInputSearch extends IInputValueProps {}
|
|
15
|
-
|
|
16
|
-
export type OptionValue = string | number;
|
|
17
|
-
export type SelectValue = string | number | Array<string | number> | null;
|
|
18
|
-
|
|
19
|
-
export type SelectOption = {
|
|
20
|
-
value: OptionValue;
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
label?: React.ReactNode;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export interface ISelectProps<T extends SelectValue = SelectValue>
|
|
26
|
-
extends IDropdownMenuProps,
|
|
27
|
-
IBaseTriggerProps {
|
|
28
|
-
/**
|
|
29
|
-
* Multiple select
|
|
30
|
-
*/
|
|
31
|
-
multiselect?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Options array
|
|
34
|
-
*/
|
|
35
|
-
options?: SelectOption[];
|
|
36
|
-
/**
|
|
37
|
-
* The value or values array selected by default when using multiselect
|
|
38
|
-
* @type SelectValue
|
|
39
|
-
*/
|
|
40
|
-
defaultValue?: T;
|
|
41
|
-
/**
|
|
42
|
-
* The selected value or values array when using multiselect
|
|
43
|
-
* @type SelectValue
|
|
44
|
-
*/
|
|
45
|
-
value?: T;
|
|
46
|
-
/**
|
|
47
|
-
* Callback on value change
|
|
48
|
-
* @type (value: SelectValue, e: React.SyntheticEvent) => boolean | void
|
|
49
|
-
*/
|
|
50
|
-
onChange?: (value: T, e: React.SyntheticEvent) => boolean | void;
|
|
51
|
-
/**
|
|
52
|
-
* Trigger placeholder at not selected value
|
|
53
|
-
*/
|
|
54
|
-
placeholder?: React.ReactNode;
|
|
55
|
-
/**
|
|
56
|
-
* Trigger state
|
|
57
|
-
*/
|
|
58
|
-
state?: 'normal' | 'valid' | 'invalid';
|
|
59
|
-
/**
|
|
60
|
-
* Disables select
|
|
61
|
-
*/
|
|
62
|
-
disabled?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Input name
|
|
65
|
-
*/
|
|
66
|
-
name?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface ISelectOption {
|
|
70
|
-
value?: string | number;
|
|
71
|
-
[key: string]: any;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface ISelectOptionProps extends IDropdownMenuItemProps {
|
|
75
|
-
/** Value of the option */
|
|
76
|
-
value: string | number;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface ISelectOptionCheckboxProps extends ISelectOptionProps {
|
|
80
|
-
/** Checkbox theme */
|
|
81
|
-
theme?: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
declare const InputSearch: <T>(props: ISelectInputSearch & T) => ReturnEl;
|
|
85
|
-
|
|
86
|
-
export interface ISelectContext extends IDropdownMenuContext {
|
|
87
|
-
getOptionProps: PropGetterFn;
|
|
88
|
-
getOptionCheckboxProps: PropGetterFn;
|
|
89
|
-
getDividerProps: PropGetterFn;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface ISelectHandlers extends IDropdownMenuHandlers {
|
|
93
|
-
value: (index: SelectValue) => void;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
declare const Select: (<T, V extends SelectValue = SelectValue>(
|
|
97
|
-
props: CProps<ISelectProps<V> & T, ISelectContext, ISelectHandlers>,
|
|
98
|
-
) => ReturnEl) & {
|
|
99
|
-
Trigger: (<T>(
|
|
100
|
-
props: Merge<
|
|
101
|
-
ComponentProps<typeof DropdownMenu.Trigger>,
|
|
102
|
-
ComponentProps<typeof ButtonTrigger>
|
|
103
|
-
> &
|
|
104
|
-
T,
|
|
105
|
-
) => ReturnEl) & {
|
|
106
|
-
Addon: typeof ButtonTrigger.Addon;
|
|
107
|
-
Text: typeof ButtonTrigger.Text;
|
|
108
|
-
};
|
|
109
|
-
Popper: typeof DropdownMenu.Popper;
|
|
110
|
-
List: typeof DropdownMenu.List;
|
|
111
|
-
Menu: typeof DropdownMenu.Menu;
|
|
112
|
-
Option: (<T>(
|
|
113
|
-
props: CProps<ISelectOptionProps & T, ISelectContext, ISelectHandlers>,
|
|
114
|
-
) => ReturnEl) & {
|
|
115
|
-
Addon: typeof DropdownMenu.Item.Addon;
|
|
116
|
-
Checkbox: <T>(
|
|
117
|
-
props: CProps<IBoxProps & { theme?: string; selected?: boolean } & T>,
|
|
118
|
-
) => ReturnEl;
|
|
119
|
-
};
|
|
120
|
-
OptionTitle: typeof DropdownMenu.ItemTitle;
|
|
121
|
-
OptionHint: typeof DropdownMenu.ItemHint;
|
|
122
|
-
Divider: typeof Divider;
|
|
123
|
-
InputSearch: typeof InputSearch;
|
|
124
|
-
Input: typeof InputSearch;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export { InputSearch };
|
|
128
|
-
export default Select;
|
package/lib/es6/index.d.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import React, { ComponentProps } from 'react';
|
|
2
|
-
import { CProps, Merge, PropGetterFn, ReturnEl } from '@semcore/core';
|
|
3
|
-
import DropdownMenu, {
|
|
4
|
-
IDropdownMenuContext,
|
|
5
|
-
IDropdownMenuItemProps,
|
|
6
|
-
IDropdownMenuProps,
|
|
7
|
-
IDropdownMenuHandlers,
|
|
8
|
-
} from '@semcore/dropdown-menu';
|
|
9
|
-
import { ButtonTrigger, IBaseTriggerProps } from '@semcore/base-trigger';
|
|
10
|
-
import Divider from '@semcore/divider';
|
|
11
|
-
import { IInputValueProps } from '@semcore/input';
|
|
12
|
-
import { IBoxProps } from '@semcore/flex-box';
|
|
13
|
-
|
|
14
|
-
export interface ISelectInputSearch extends IInputValueProps {}
|
|
15
|
-
|
|
16
|
-
export type OptionValue = string | number;
|
|
17
|
-
export type SelectValue = string | number | Array<string | number> | null;
|
|
18
|
-
|
|
19
|
-
export type SelectOption = {
|
|
20
|
-
value: OptionValue;
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
label?: React.ReactNode;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export interface ISelectProps<T extends SelectValue = SelectValue>
|
|
26
|
-
extends IDropdownMenuProps,
|
|
27
|
-
IBaseTriggerProps {
|
|
28
|
-
/**
|
|
29
|
-
* Multiple select
|
|
30
|
-
*/
|
|
31
|
-
multiselect?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Options array
|
|
34
|
-
*/
|
|
35
|
-
options?: SelectOption[];
|
|
36
|
-
/**
|
|
37
|
-
* The value or values array selected by default when using multiselect
|
|
38
|
-
* @type SelectValue
|
|
39
|
-
*/
|
|
40
|
-
defaultValue?: T;
|
|
41
|
-
/**
|
|
42
|
-
* The selected value or values array when using multiselect
|
|
43
|
-
* @type SelectValue
|
|
44
|
-
*/
|
|
45
|
-
value?: T;
|
|
46
|
-
/**
|
|
47
|
-
* Callback on value change
|
|
48
|
-
* @type (value: SelectValue, e: React.SyntheticEvent) => boolean | void
|
|
49
|
-
*/
|
|
50
|
-
onChange?: (value: T, e: React.SyntheticEvent) => boolean | void;
|
|
51
|
-
/**
|
|
52
|
-
* Trigger placeholder at not selected value
|
|
53
|
-
*/
|
|
54
|
-
placeholder?: React.ReactNode;
|
|
55
|
-
/**
|
|
56
|
-
* Trigger state
|
|
57
|
-
*/
|
|
58
|
-
state?: 'normal' | 'valid' | 'invalid';
|
|
59
|
-
/**
|
|
60
|
-
* Disables select
|
|
61
|
-
*/
|
|
62
|
-
disabled?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Input name
|
|
65
|
-
*/
|
|
66
|
-
name?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface ISelectOption {
|
|
70
|
-
value?: string | number;
|
|
71
|
-
[key: string]: any;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface ISelectOptionProps extends IDropdownMenuItemProps {
|
|
75
|
-
/** Value of the option */
|
|
76
|
-
value: string | number;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface ISelectOptionCheckboxProps extends ISelectOptionProps {
|
|
80
|
-
/** Checkbox theme */
|
|
81
|
-
theme?: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
declare const InputSearch: <T>(props: ISelectInputSearch & T) => ReturnEl;
|
|
85
|
-
|
|
86
|
-
export interface ISelectContext extends IDropdownMenuContext {
|
|
87
|
-
getOptionProps: PropGetterFn;
|
|
88
|
-
getOptionCheckboxProps: PropGetterFn;
|
|
89
|
-
getDividerProps: PropGetterFn;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface ISelectHandlers extends IDropdownMenuHandlers {
|
|
93
|
-
value: (index: SelectValue) => void;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
declare const Select: (<T, V extends SelectValue = SelectValue>(
|
|
97
|
-
props: CProps<ISelectProps<V> & T, ISelectContext, ISelectHandlers>,
|
|
98
|
-
) => ReturnEl) & {
|
|
99
|
-
Trigger: (<T>(
|
|
100
|
-
props: Merge<
|
|
101
|
-
ComponentProps<typeof DropdownMenu.Trigger>,
|
|
102
|
-
ComponentProps<typeof ButtonTrigger>
|
|
103
|
-
> &
|
|
104
|
-
T,
|
|
105
|
-
) => ReturnEl) & {
|
|
106
|
-
Addon: typeof ButtonTrigger.Addon;
|
|
107
|
-
Text: typeof ButtonTrigger.Text;
|
|
108
|
-
};
|
|
109
|
-
Popper: typeof DropdownMenu.Popper;
|
|
110
|
-
List: typeof DropdownMenu.List;
|
|
111
|
-
Menu: typeof DropdownMenu.Menu;
|
|
112
|
-
Option: (<T>(
|
|
113
|
-
props: CProps<ISelectOptionProps & T, ISelectContext, ISelectHandlers>,
|
|
114
|
-
) => ReturnEl) & {
|
|
115
|
-
Addon: typeof DropdownMenu.Item.Addon;
|
|
116
|
-
Checkbox: <T>(
|
|
117
|
-
props: CProps<IBoxProps & { theme?: string; selected?: boolean } & T>,
|
|
118
|
-
) => ReturnEl;
|
|
119
|
-
};
|
|
120
|
-
OptionTitle: typeof DropdownMenu.ItemTitle;
|
|
121
|
-
OptionHint: typeof DropdownMenu.ItemHint;
|
|
122
|
-
Divider: typeof Divider;
|
|
123
|
-
InputSearch: typeof InputSearch;
|
|
124
|
-
Input: typeof InputSearch;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export { InputSearch };
|
|
128
|
-
export default Select;
|