@semcore/select 3.10.3 → 4.0.0-beta.1
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 +3 -3
- package/lib/cjs/InputSearch.js +6 -6
- package/lib/cjs/Select.js +7 -7
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/es6/InputSearch.js +6 -6
- package/lib/es6/Select.js +7 -7
- package/lib/es6/index.d.js.map +1 -1
- package/lib/types/index.d.ts +111 -88
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [4.0.0] - 2023-07-15
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Break
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Strict, backward incompatible typings.
|
|
10
10
|
|
|
11
11
|
## [3.10.2] - 2023-06-28
|
|
12
12
|
|
package/lib/cjs/InputSearch.js
CHANGED
|
@@ -22,12 +22,12 @@ var _context = require("./context");
|
|
|
22
22
|
var _i18nEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/i18nEnhance"));
|
|
23
23
|
var _intergalacticDynamicLocales = require("./translations/__intergalactic-dynamic-locales");
|
|
24
24
|
/*__reshadow-styles__:"./style/input-search.shadow.css"*/
|
|
25
|
-
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".
|
|
26
|
-
"__SInputSearch": "
|
|
27
|
-
"_size_m": "
|
|
28
|
-
"__SClose": "
|
|
29
|
-
"_hide": "
|
|
30
|
-
"__SOutline": "
|
|
25
|
+
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SInputSearch_fmjeo_gg_._size_m_fmjeo_gg_{height:32px}.___SClose_fmjeo_gg_.__hide_fmjeo_gg_{visibility:hidden}.___SOutline_fmjeo_gg_{top:-1px;left:-1px;width:100%;border-radius:var(--intergalactic-control-rounded, 6px) var(--intergalactic-control-rounded, 6px)0 0}" /*__inner_css_end__*/, "fmjeo_gg_") /*__reshadow_css_end__*/, {
|
|
26
|
+
"__SInputSearch": "___SInputSearch_fmjeo_gg_",
|
|
27
|
+
"_size_m": "_size_m_fmjeo_gg_",
|
|
28
|
+
"__SClose": "___SClose_fmjeo_gg_",
|
|
29
|
+
"_hide": "__hide_fmjeo_gg_",
|
|
30
|
+
"__SOutline": "___SOutline_fmjeo_gg_"
|
|
31
31
|
});
|
|
32
32
|
var sizeToIcon = {
|
|
33
33
|
m: [_m["default"], _m2["default"]],
|
package/lib/cjs/Select.js
CHANGED
|
@@ -36,13 +36,13 @@ var _intergalacticDynamicLocales = require("./translations/__intergalactic-dynam
|
|
|
36
36
|
var _useFocusLock = require("@semcore/utils/lib/use/useFocusLock");
|
|
37
37
|
var _excluded = ["Children", "options", "multiselect", "value"];
|
|
38
38
|
/*__reshadow-styles__:"./style/select.shadow.css"*/
|
|
39
|
-
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".
|
|
40
|
-
"__SOptionCheckbox": "
|
|
41
|
-
"_size_l": "
|
|
42
|
-
"_checked": "
|
|
43
|
-
"_theme": "
|
|
44
|
-
"--theme": "--
|
|
45
|
-
"_selected": "
|
|
39
|
+
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SOptionCheckbox_1htee_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-right:var(--intergalactic-spacing-2x, 8px);margin-bottom:auto;position:relative;flex-shrink:0;width:16px;height:16px}.___SOptionCheckbox_1htee_gg_::before{content:\"\";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid;border-radius:var(--intergalactic-addon-rounded, 4px);border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SOptionCheckbox_1htee_gg_::after{content:\"\";position:absolute;top:0;left:0;right:0;bottom:0;margin:0 var(--intergalactic-spacing-05x, 2px);background-repeat:no-repeat;background-position:center center;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iNyIgdmlld0JveD0iMCAwIDEwIDciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik04LjI1IDFMNCA1LjI1TDEuNzUgMyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==)}.___SOptionCheckbox_1htee_gg_._size_l_1htee_gg_{width:20px;height:20px}.___SOptionCheckbox_1htee_gg_._size_l_1htee_gg_::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xMSAxLjVMNC43NSA3Ljc1TDEgNCIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==)}.___SOptionCheckbox_1htee_gg_.__checked_1htee_gg_:before{background-color:var(--intergalactic-control-primary-info, #008ff8);border-color:var(--intergalactic-control-primary-info, #008ff8)}.___SOptionCheckbox_1htee_gg_.__theme_1htee_gg_:before{border-color:var(--theme_1htee)}.___SOptionCheckbox_1htee_gg_.__theme_1htee_gg_.__checked_1htee_gg_:before{background-color:var(--theme_1htee);border-color:var(--theme_1htee)}.___SOptionCheckbox_1htee_gg_.__selected_1htee_gg_{background-color:var(--intergalactic-dropdown-menu-item-selected, rgba(196, 229, 254, 0.7))}@media (hover:hover){.___SOptionCheckbox_1htee_gg_.__selected_1htee_gg_:hover{background-color:var(--intergalactic-dropdown-menu-item-selected-hover, #c4e5fe)}}" /*__inner_css_end__*/, "1htee_gg_") /*__reshadow_css_end__*/, {
|
|
40
|
+
"__SOptionCheckbox": "___SOptionCheckbox_1htee_gg_",
|
|
41
|
+
"_size_l": "_size_l_1htee_gg_",
|
|
42
|
+
"_checked": "__checked_1htee_gg_",
|
|
43
|
+
"_theme": "__theme_1htee_gg_",
|
|
44
|
+
"--theme": "--theme_1htee",
|
|
45
|
+
"_selected": "__selected_1htee_gg_"
|
|
46
46
|
});
|
|
47
47
|
function isSelectedOption(value, valueOption) {
|
|
48
48
|
return Array.isArray(value) ? value.includes(valueOption) : valueOption === value;
|
package/lib/cjs/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport DropdownMenu, {\n DropdownMenuContext,\n DropdownMenuItemProps,\n DropdownMenuProps,\n DropdownMenuHandlers,\n DropdownMenuTriggerProps,\n} from '@semcore/dropdown-menu';\nimport { ButtonTrigger, BaseTriggerProps, ButtonTriggerProps } from '@semcore/base-trigger';\nimport Divider from '@semcore/divider';\nimport { InputValueProps } from '@semcore/input';\nimport { BoxProps } from '@semcore/flex-box';\n\n/** @deprecated */\nexport interface ISelectInputSearch extends SelectInputSearch, UnknownProperties {}\nexport type SelectInputSearch = InputValueProps & {};\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\n/** @deprecated */\nexport interface ISelectProps<T extends SelectValue = SelectValue> extends SelectProps<T> {}\nexport type SelectProps<T extends SelectValue = SelectValue> = DropdownMenuProps &\n BaseTriggerProps & {\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?:\n | ((value: T, e: React.SyntheticEvent) => boolean | void)\n | React.Dispatch<React.SetStateAction<T>>;\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 locale?: string;\n /**\n * If enabled, after opening select popper view will be scrolled to selected option or, if there are multiple selected options, to the first selected option.\n * @default true\n */\n scrollToSelected?: boolean;\n };\n\n/** @deprecated */\nexport interface ISelectOption extends SelectOption, UnknownProperties {}\n\n/** @deprecated */\nexport interface ISelectOptionProps extends SelectOptionProps, UnknownProperties {}\nexport type SelectOptionProps = DropdownMenuItemProps & {\n /** Value of the option */\n value: string | number;\n};\n\n/** @deprecated */\nexport interface ISelectOptionCheckboxProps extends SelectOptionCheckboxProps, UnknownProperties {}\nexport type SelectOptionCheckboxProps = SelectOptionProps & {\n /** Checkbox theme */\n theme?: string;\n};\n\ndeclare const InputSearch: Intergalactic.Component<'div', SelectInputSearch>;\n\n/** @deprecated */\nexport interface ISelectContext extends SelectContext, UnknownProperties {}\nexport type SelectContext = DropdownMenuContext & {\n getOptionProps: PropGetterFn;\n getOptionCheckboxProps: PropGetterFn;\n getDividerProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface ISelectHandlers extends SelectHandlers, UnknownProperties {}\nexport type SelectHandlers = DropdownMenuHandlers & {\n value: (index: SelectValue) => void;\n};\n\ntype IntergalacticSelectComponent = (<\n Value extends SelectValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n SelectProps<Value>,\n SelectContext,\n [handlers: SelectHandlers]\n >,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div'>;\n\ndeclare const Select: IntergalacticSelectComponent & {\n Trigger: Intergalactic.Component<\n 'div',\n DropdownMenuTriggerProps & ButtonTriggerProps,\n {},\n [handlers: SelectHandlers]\n > & {\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: Intergalactic.Component<\n 'option',\n SelectOptionProps,\n SelectContext,\n [handlers: SelectHandlers]\n > & {\n Addon: typeof DropdownMenu.Item.Addon;\n Checkbox: Intergalactic.Component<'div', BoxProps & { theme?: string; selected?: boolean }>;\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
|
@@ -16,12 +16,12 @@ import { selectContext } from './context';
|
|
|
16
16
|
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
17
17
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
18
18
|
/*__reshadow-styles__:"./style/input-search.shadow.css"*/
|
|
19
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".
|
|
20
|
-
"__SInputSearch": "
|
|
21
|
-
"_size_m": "
|
|
22
|
-
"__SClose": "
|
|
23
|
-
"_hide": "
|
|
24
|
-
"__SOutline": "
|
|
19
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SInputSearch_fmjeo_gg_._size_m_fmjeo_gg_{height:32px}.___SClose_fmjeo_gg_.__hide_fmjeo_gg_{visibility:hidden}.___SOutline_fmjeo_gg_{top:-1px;left:-1px;width:100%;border-radius:var(--intergalactic-control-rounded, 6px) var(--intergalactic-control-rounded, 6px)0 0}" /*__inner_css_end__*/, "fmjeo_gg_") /*__reshadow_css_end__*/, {
|
|
20
|
+
"__SInputSearch": "___SInputSearch_fmjeo_gg_",
|
|
21
|
+
"_size_m": "_size_m_fmjeo_gg_",
|
|
22
|
+
"__SClose": "___SClose_fmjeo_gg_",
|
|
23
|
+
"_hide": "__hide_fmjeo_gg_",
|
|
24
|
+
"__SOutline": "___SOutline_fmjeo_gg_"
|
|
25
25
|
});
|
|
26
26
|
var sizeToIcon = {
|
|
27
27
|
m: [SearchM, CloseM],
|
package/lib/es6/Select.js
CHANGED
|
@@ -33,13 +33,13 @@ import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
|
33
33
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
34
34
|
import { setFocus } from '@semcore/utils/lib/use/useFocusLock';
|
|
35
35
|
/*__reshadow-styles__:"./style/select.shadow.css"*/
|
|
36
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".
|
|
37
|
-
"__SOptionCheckbox": "
|
|
38
|
-
"_size_l": "
|
|
39
|
-
"_checked": "
|
|
40
|
-
"_theme": "
|
|
41
|
-
"--theme": "--
|
|
42
|
-
"_selected": "
|
|
36
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SOptionCheckbox_1htee_gg_{margin-top:var(--intergalactic-spacing-05x, 2px);margin-right:var(--intergalactic-spacing-2x, 8px);margin-bottom:auto;position:relative;flex-shrink:0;width:16px;height:16px}.___SOptionCheckbox_1htee_gg_::before{content:\"\";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid;border-radius:var(--intergalactic-addon-rounded, 4px);border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SOptionCheckbox_1htee_gg_::after{content:\"\";position:absolute;top:0;left:0;right:0;bottom:0;margin:0 var(--intergalactic-spacing-05x, 2px);background-repeat:no-repeat;background-position:center center;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iNyIgdmlld0JveD0iMCAwIDEwIDciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik04LjI1IDFMNCA1LjI1TDEuNzUgMyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==)}.___SOptionCheckbox_1htee_gg_._size_l_1htee_gg_{width:20px;height:20px}.___SOptionCheckbox_1htee_gg_._size_l_1htee_gg_::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xMSAxLjVMNC43NSA3Ljc1TDEgNCIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==)}.___SOptionCheckbox_1htee_gg_.__checked_1htee_gg_:before{background-color:var(--intergalactic-control-primary-info, #008ff8);border-color:var(--intergalactic-control-primary-info, #008ff8)}.___SOptionCheckbox_1htee_gg_.__theme_1htee_gg_:before{border-color:var(--theme_1htee)}.___SOptionCheckbox_1htee_gg_.__theme_1htee_gg_.__checked_1htee_gg_:before{background-color:var(--theme_1htee);border-color:var(--theme_1htee)}.___SOptionCheckbox_1htee_gg_.__selected_1htee_gg_{background-color:var(--intergalactic-dropdown-menu-item-selected, rgba(196, 229, 254, 0.7))}@media (hover:hover){.___SOptionCheckbox_1htee_gg_.__selected_1htee_gg_:hover{background-color:var(--intergalactic-dropdown-menu-item-selected-hover, #c4e5fe)}}" /*__inner_css_end__*/, "1htee_gg_") /*__reshadow_css_end__*/, {
|
|
37
|
+
"__SOptionCheckbox": "___SOptionCheckbox_1htee_gg_",
|
|
38
|
+
"_size_l": "_size_l_1htee_gg_",
|
|
39
|
+
"_checked": "__checked_1htee_gg_",
|
|
40
|
+
"_theme": "__theme_1htee_gg_",
|
|
41
|
+
"--theme": "--theme_1htee",
|
|
42
|
+
"_selected": "__selected_1htee_gg_"
|
|
43
43
|
});
|
|
44
44
|
function isSelectedOption(value, valueOption) {
|
|
45
45
|
return Array.isArray(value) ? value.includes(valueOption) : valueOption === value;
|
package/lib/es6/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport DropdownMenu, {\n DropdownMenuContext,\n DropdownMenuItemProps,\n DropdownMenuProps,\n DropdownMenuHandlers,\n DropdownMenuTriggerProps,\n} from '@semcore/dropdown-menu';\nimport { ButtonTrigger, BaseTriggerProps, ButtonTriggerProps } from '@semcore/base-trigger';\nimport Divider from '@semcore/divider';\nimport { InputValueProps } from '@semcore/input';\nimport { BoxProps } from '@semcore/flex-box';\n\n/** @deprecated */\nexport interface ISelectInputSearch extends SelectInputSearch, UnknownProperties {}\nexport type SelectInputSearch = InputValueProps & {};\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\n/** @deprecated */\nexport interface ISelectProps<T extends SelectValue = SelectValue> extends SelectProps<T> {}\nexport type SelectProps<T extends SelectValue = SelectValue> = DropdownMenuProps &\n BaseTriggerProps & {\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?:\n | ((value: T, e: React.SyntheticEvent) => boolean | void)\n | React.Dispatch<React.SetStateAction<T>>;\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 locale?: string;\n /**\n * If enabled, after opening select popper view will be scrolled to selected option or, if there are multiple selected options, to the first selected option.\n * @default true\n */\n scrollToSelected?: boolean;\n };\n\n/** @deprecated */\nexport interface ISelectOption extends SelectOption, UnknownProperties {}\n\n/** @deprecated */\nexport interface ISelectOptionProps extends SelectOptionProps, UnknownProperties {}\nexport type SelectOptionProps = DropdownMenuItemProps & {\n /** Value of the option */\n value: string | number;\n};\n\n/** @deprecated */\nexport interface ISelectOptionCheckboxProps extends SelectOptionCheckboxProps, UnknownProperties {}\nexport type SelectOptionCheckboxProps = SelectOptionProps & {\n /** Checkbox theme */\n theme?: string;\n};\n\ndeclare const InputSearch: Intergalactic.Component<'div', SelectInputSearch>;\n\n/** @deprecated */\nexport interface ISelectContext extends SelectContext, UnknownProperties {}\nexport type SelectContext = DropdownMenuContext & {\n getOptionProps: PropGetterFn;\n getOptionCheckboxProps: PropGetterFn;\n getDividerProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface ISelectHandlers extends SelectHandlers, UnknownProperties {}\nexport type SelectHandlers = DropdownMenuHandlers & {\n value: (index: SelectValue) => void;\n};\n\ntype IntergalacticSelectComponent = (<\n Value extends SelectValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n SelectProps<Value>,\n SelectContext,\n [handlers: SelectHandlers]\n >,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div'>;\n\ndeclare const Select: IntergalacticSelectComponent & {\n Trigger: Intergalactic.Component<\n 'div',\n DropdownMenuTriggerProps & ButtonTriggerProps,\n {},\n [handlers: SelectHandlers]\n > & {\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: Intergalactic.Component<\n 'option',\n SelectOptionProps,\n SelectContext,\n [handlers: SelectHandlers]\n > & {\n Addon: typeof DropdownMenu.Item.Addon;\n Checkbox: Intergalactic.Component<'div', BoxProps & { theme?: string; selected?: boolean }>;\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/types/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
|
|
3
3
|
import DropdownMenu, {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
DropdownMenuContext,
|
|
5
|
+
DropdownMenuItemProps,
|
|
6
|
+
DropdownMenuProps,
|
|
7
|
+
DropdownMenuHandlers,
|
|
8
|
+
DropdownMenuTriggerProps,
|
|
8
9
|
} from '@semcore/dropdown-menu';
|
|
9
|
-
import { ButtonTrigger,
|
|
10
|
+
import { ButtonTrigger, BaseTriggerProps, ButtonTriggerProps } from '@semcore/base-trigger';
|
|
10
11
|
import Divider from '@semcore/divider';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
12
|
+
import { InputValueProps } from '@semcore/input';
|
|
13
|
+
import { BoxProps } from '@semcore/flex-box';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
/** @deprecated */
|
|
16
|
+
export interface ISelectInputSearch extends SelectInputSearch, UnknownProperties {}
|
|
17
|
+
export type SelectInputSearch = InputValueProps & {};
|
|
15
18
|
|
|
16
19
|
export type OptionValue = string | number;
|
|
17
20
|
export type SelectValue = string | number | Array<string | number> | null;
|
|
@@ -22,106 +25,126 @@ export type SelectOption = {
|
|
|
22
25
|
label?: React.ReactNode;
|
|
23
26
|
};
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
28
|
+
/** @deprecated */
|
|
29
|
+
export interface ISelectProps<T extends SelectValue = SelectValue> extends SelectProps<T> {}
|
|
30
|
+
export type SelectProps<T extends SelectValue = SelectValue> = DropdownMenuProps &
|
|
31
|
+
BaseTriggerProps & {
|
|
32
|
+
/**
|
|
33
|
+
* Multiple select
|
|
34
|
+
*/
|
|
35
|
+
multiselect?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Options array
|
|
38
|
+
*/
|
|
39
|
+
options?: SelectOption[];
|
|
40
|
+
/**
|
|
41
|
+
* The value or values array selected by default when using multiselect
|
|
42
|
+
* @type SelectValue
|
|
43
|
+
*/
|
|
44
|
+
defaultValue?: T;
|
|
45
|
+
/**
|
|
46
|
+
* The selected value or values array when using multiselect
|
|
47
|
+
* @type SelectValue
|
|
48
|
+
*/
|
|
49
|
+
value?: T;
|
|
50
|
+
/**
|
|
51
|
+
* Callback on value change
|
|
52
|
+
* @type (value: SelectValue, e: React.SyntheticEvent) => boolean | void
|
|
53
|
+
*/
|
|
54
|
+
onChange?:
|
|
55
|
+
| ((value: T, e: React.SyntheticEvent) => boolean | void)
|
|
56
|
+
| React.Dispatch<React.SetStateAction<T>>;
|
|
57
|
+
/**
|
|
58
|
+
* Trigger placeholder at not selected value
|
|
59
|
+
*/
|
|
60
|
+
placeholder?: React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Trigger state
|
|
63
|
+
*/
|
|
64
|
+
state?: 'normal' | 'valid' | 'invalid';
|
|
65
|
+
/**
|
|
66
|
+
* Disables select
|
|
67
|
+
*/
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Input name
|
|
71
|
+
*/
|
|
72
|
+
name?: string;
|
|
73
|
+
locale?: string;
|
|
74
|
+
/**
|
|
75
|
+
* If enabled, after opening select popper view will be scrolled to selected option or, if there are multiple selected options, to the first selected option.
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
scrollToSelected?: boolean;
|
|
79
|
+
};
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
[key: string]: any;
|
|
78
|
-
}
|
|
81
|
+
/** @deprecated */
|
|
82
|
+
export interface ISelectOption extends SelectOption, UnknownProperties {}
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
/** @deprecated */
|
|
85
|
+
export interface ISelectOptionProps extends SelectOptionProps, UnknownProperties {}
|
|
86
|
+
export type SelectOptionProps = DropdownMenuItemProps & {
|
|
81
87
|
/** Value of the option */
|
|
82
88
|
value: string | number;
|
|
83
|
-
}
|
|
89
|
+
};
|
|
84
90
|
|
|
85
|
-
|
|
91
|
+
/** @deprecated */
|
|
92
|
+
export interface ISelectOptionCheckboxProps extends SelectOptionCheckboxProps, UnknownProperties {}
|
|
93
|
+
export type SelectOptionCheckboxProps = SelectOptionProps & {
|
|
86
94
|
/** Checkbox theme */
|
|
87
95
|
theme?: string;
|
|
88
|
-
}
|
|
96
|
+
};
|
|
89
97
|
|
|
90
|
-
declare const InputSearch: <
|
|
98
|
+
declare const InputSearch: Intergalactic.Component<'div', SelectInputSearch>;
|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
/** @deprecated */
|
|
101
|
+
export interface ISelectContext extends SelectContext, UnknownProperties {}
|
|
102
|
+
export type SelectContext = DropdownMenuContext & {
|
|
93
103
|
getOptionProps: PropGetterFn;
|
|
94
104
|
getOptionCheckboxProps: PropGetterFn;
|
|
95
105
|
getDividerProps: PropGetterFn;
|
|
96
|
-
}
|
|
106
|
+
};
|
|
97
107
|
|
|
98
|
-
|
|
108
|
+
/** @deprecated */
|
|
109
|
+
export interface ISelectHandlers extends SelectHandlers, UnknownProperties {}
|
|
110
|
+
export type SelectHandlers = DropdownMenuHandlers & {
|
|
99
111
|
value: (index: SelectValue) => void;
|
|
100
|
-
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
type IntergalacticSelectComponent = (<
|
|
115
|
+
Value extends SelectValue,
|
|
116
|
+
Tag extends Intergalactic.Tag = 'div',
|
|
117
|
+
>(
|
|
118
|
+
props: Intergalactic.InternalTypings.ComponentProps<
|
|
119
|
+
Tag,
|
|
120
|
+
SelectProps<Value>,
|
|
121
|
+
SelectContext,
|
|
122
|
+
[handlers: SelectHandlers]
|
|
123
|
+
>,
|
|
124
|
+
) => Intergalactic.InternalTypings.ComponentRenderingResults) &
|
|
125
|
+
Intergalactic.InternalTypings.ComponentAdditive<'div'>;
|
|
101
126
|
|
|
102
|
-
declare const Select:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
> &
|
|
110
|
-
T,
|
|
111
|
-
) => ReturnEl) & {
|
|
127
|
+
declare const Select: IntergalacticSelectComponent & {
|
|
128
|
+
Trigger: Intergalactic.Component<
|
|
129
|
+
'div',
|
|
130
|
+
DropdownMenuTriggerProps & ButtonTriggerProps,
|
|
131
|
+
{},
|
|
132
|
+
[handlers: SelectHandlers]
|
|
133
|
+
> & {
|
|
112
134
|
Addon: typeof ButtonTrigger.Addon;
|
|
113
135
|
Text: typeof ButtonTrigger.Text;
|
|
114
136
|
};
|
|
115
137
|
Popper: typeof DropdownMenu.Popper;
|
|
116
138
|
List: typeof DropdownMenu.List;
|
|
117
139
|
Menu: typeof DropdownMenu.Menu;
|
|
118
|
-
Option:
|
|
119
|
-
|
|
120
|
-
|
|
140
|
+
Option: Intergalactic.Component<
|
|
141
|
+
'option',
|
|
142
|
+
SelectOptionProps,
|
|
143
|
+
SelectContext,
|
|
144
|
+
[handlers: SelectHandlers]
|
|
145
|
+
> & {
|
|
121
146
|
Addon: typeof DropdownMenu.Item.Addon;
|
|
122
|
-
Checkbox: <
|
|
123
|
-
props: CProps<IBoxProps & { theme?: string; selected?: boolean } & T>,
|
|
124
|
-
) => ReturnEl;
|
|
147
|
+
Checkbox: Intergalactic.Component<'div', BoxProps & { theme?: string; selected?: boolean }>;
|
|
125
148
|
};
|
|
126
149
|
OptionTitle: typeof DropdownMenu.ItemTitle;
|
|
127
150
|
OptionHint: typeof DropdownMenu.ItemHint;
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/select",
|
|
3
3
|
"description": "Semrush Select Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0-beta.1",
|
|
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
|
"dependencies": {
|
|
11
|
-
"@semcore/base-trigger": "
|
|
12
|
-
"@semcore/checkbox": "
|
|
13
|
-
"@semcore/divider": "
|
|
14
|
-
"@semcore/dropdown-menu": "
|
|
15
|
-
"@semcore/flex-box": "
|
|
16
|
-
"@semcore/icon": "
|
|
17
|
-
"@semcore/input": "
|
|
18
|
-
"@semcore/utils": "
|
|
11
|
+
"@semcore/base-trigger": "4.0.0-beta.1",
|
|
12
|
+
"@semcore/checkbox": "7.0.0-beta.1",
|
|
13
|
+
"@semcore/divider": "4.0.0-beta.1",
|
|
14
|
+
"@semcore/dropdown-menu": "4.0.0-beta.1",
|
|
15
|
+
"@semcore/flex-box": "5.0.0-beta.1",
|
|
16
|
+
"@semcore/icon": "4.0.0-beta.1",
|
|
17
|
+
"@semcore/input": "4.0.0-beta.1",
|
|
18
|
+
"@semcore/utils": "4.0.0-beta.1",
|
|
19
19
|
"classnames": "2.2.6"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@semcore/core": "
|
|
22
|
+
"@semcore/core": "2.0.0-beta.1",
|
|
23
23
|
"react": "16.8 - 18",
|
|
24
24
|
"react-dom": "16.8 - 18"
|
|
25
25
|
},
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/react": "18.0.21",
|
|
33
|
+
"@types/classnames": "2.2.6",
|
|
33
34
|
"@guidepup/playwright": "0.6.1",
|
|
34
35
|
"@playwright/test": "1.25.1",
|
|
35
36
|
"@semcore/testing-utils": "1.0.0"
|