@semcore/select 3.1.2 → 3.1.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/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.4] - 2022-10-03
6
+
7
+ ### Changed
8
+
9
+ - 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]).
10
+
11
+ ## [3.1.3] - 2022-09-29
12
+
13
+ ### Changed
14
+
15
+ - Version patch update due to children dependencies update (`@semcore/base-trigger` [3.0.20 ~> 3.0.21], `@semcore/icon` [2.30.4 ~> 2.31.0]).
16
+
5
17
  ## [3.1.2] - 2022-09-21
6
18
 
7
19
  ### Changed
@@ -52,16 +52,16 @@ var style = (
52
52
  /*__reshadow_css_start__*/
53
53
  _core.sstyled.insert(
54
54
  /*__inner_css_start__*/
55
- ".___SInputSearch_1jop7_gg_._size_m_1jop7_gg_{height:32px}.___SClose_1jop7_gg_.__hide_1jop7_gg_{visibility:hidden}.___SOutline_1jop7_gg_{top:-1px;left:-1px;width:100%;border-radius:6px 6px 0 0}"
55
+ ".___SInputSearch_1fqxs_gg_._size_m_1fqxs_gg_{height:32px}.___SClose_1fqxs_gg_.__hide_1fqxs_gg_{visibility:hidden}.___SOutline_1fqxs_gg_{top:-1px;left:-1px;width:100%;border-radius:6px 6px 0 0}"
56
56
  /*__inner_css_end__*/
57
- , "1jop7_gg_")
57
+ , "1fqxs_gg_")
58
58
  /*__reshadow_css_end__*/
59
59
  , {
60
- "__SInputSearch": "___SInputSearch_1jop7_gg_",
61
- "_size_m": "_size_m_1jop7_gg_",
62
- "__SClose": "___SClose_1jop7_gg_",
63
- "_hide": "__hide_1jop7_gg_",
64
- "__SOutline": "___SOutline_1jop7_gg_"
60
+ "__SInputSearch": "___SInputSearch_1fqxs_gg_",
61
+ "_size_m": "_size_m_1fqxs_gg_",
62
+ "__SClose": "___SClose_1fqxs_gg_",
63
+ "_hide": "__hide_1fqxs_gg_",
64
+ "__SOutline": "___SOutline_1fqxs_gg_"
65
65
  });
66
66
  var MAP_SIZE_TO_ICON = {
67
67
  m: [_m["default"], _m2["default"]],
@@ -123,6 +123,7 @@ var InputSearch = /*#__PURE__*/function (_Component) {
123
123
  "hide": hideClose,
124
124
  "aria-hidden": hideClose,
125
125
  "interactive": true,
126
+ "aria-label": "Clear search field",
126
127
  "onClick": this.handleClear
127
128
  }), /*#__PURE__*/_react["default"].createElement(IconClose, _ref2.cn("IconClose", {}))));
128
129
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InputSearch.js","names":["MAP_SIZE_TO_ICON","m","SearchM","CloseM","l","InputSearch","e","handlers","value","Value","Input","SInputSearch","SClose","Addon","asProps","size","styles","finalSize","context","hideClose","IconClose","IconSearch","sstyled","handleClear","Component","style","defaultValue","selectContext","createComponent"],"sources":["../../src/InputSearch.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport SearchM from '@semcore/icon/Search/m';\nimport CloseM from '@semcore/icon/Close/m';\nimport Input from '@semcore/input';\nimport { selectContext } from './context';\n\nimport style from './style/input-search.shadow.css';\n\nconst MAP_SIZE_TO_ICON = {\n m: [SearchM, CloseM],\n l: [SearchM, CloseM],\n};\n\nclass InputSearch extends Component {\n static displayName = 'InputSearch';\n\n static style = style;\n\n static defaultProps = {\n defaultValue: '',\n };\n\n static contextType = selectContext;\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleClear = (e) => {\n this.handlers.value('', e);\n };\n\n render() {\n const Value = Root;\n const SInputSearch = Input;\n const SClose = Input.Addon;\n const { size, value, styles } = this.asProps;\n const finalSize = size || this.context.size;\n const hideClose = !value;\n const IconClose = MAP_SIZE_TO_ICON[finalSize][1];\n const IconSearch = MAP_SIZE_TO_ICON[finalSize][0];\n\n return sstyled(styles)(\n <SInputSearch size={finalSize} styles={styles}>\n <Input.Addon>\n <IconSearch />\n </Input.Addon>\n <Value render={Input.Value} autoFocus />\n <SClose\n role=\"button\"\n /* hide through css because the width of the input changes */\n hide={hideClose}\n aria-hidden={hideClose}\n interactive\n onClick={this.handleClear}\n >\n <IconClose />\n </SClose>\n </SInputSearch>,\n );\n }\n}\n\nexport default createComponent(InputSearch);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAMA,gBAAgB,GAAG;EACvBC,CAAC,EAAE,CAACC,aAAD,EAAUC,cAAV,CADoB;EAEvBC,CAAC,EAAE,CAACF,aAAD,EAAUC,cAAV;AAFoB,CAAzB;;IAKME,W;;;;;;;;;;;;;;;oGAiBU,UAACC,CAAD,EAAO;MACnB,MAAKC,QAAL,CAAcC,KAAd,CAAoB,EAApB,EAAwBF,CAAxB;IACD,C;;;;;;WARD,6BAAoB;MAClB,OAAO;QACLE,KAAK,EAAE;MADF,CAAP;IAGD;;;WAMD,kBAAS;MAAA;MAAA;;MACP,IAAMC,KAAK,GAcQC,iBAAA,CAAMD,KAdzB;MACA,IAAME,YAAY,GAAGD,iBAArB;MACA,IAAME,MAAM,GAAGF,iBAAA,CAAMG,KAArB;MACA,oBAAgC,KAAKC,OAArC;MAAA,IAAQC,IAAR,iBAAQA,IAAR;MAAA,IAAcP,KAAd,iBAAcA,KAAd;MAAA,IAAqBQ,MAArB,iBAAqBA,MAArB;MACA,IAAMC,SAAS,GAAGF,IAAI,IAAI,KAAKG,OAAL,CAAaH,IAAvC;MACA,IAAMI,SAAS,GAAG,CAACX,KAAnB;MACA,IAAMY,SAAS,GAAGpB,gBAAgB,CAACiB,SAAD,CAAhB,CAA4B,CAA5B,CAAlB;MACA,IAAMI,UAAU,GAAGrB,gBAAgB,CAACiB,SAAD,CAAhB,CAA4B,CAA5B,CAAnB;MAEA,eAAO,IAAAK,aAAA,EAAQN,MAAR,CAAP,eACE,gCAAC,YAAD;QAAA,QAAoBC,SAApB;QAAA,UAAuCD;MAAvC,iBACE,gCAAC,iBAAD,CAAO,KAAP,qBACE,gCAAC,UAAD,6BADF,CADF,eAIE,gCAAC,KAAD;QAAA;MAAA,WAJF,eAKE,gCAAC,MAAD;QAAA,QACO,QADP;QAAA,QAGQG,SAHR;QAAA,eAIeA,SAJf;QAAA;QAAA,WAMW,KAAKI;MANhB,iBAQE,gCAAC,SAAD,4BARF,CALF,CADF;IAkBD;;;EAjDuBC,e;;iCAApBnB,W,iBACiB,a;iCADjBA,W,WAGWoB,K;iCAHXpB,W,kBAKkB;EACpBqB,YAAY,EAAE;AADM,C;iCALlBrB,W,iBASiBsB,sB;;eA2CR,IAAAC,gBAAA,EAAgBvB,WAAhB,C"}
1
+ {"version":3,"file":"InputSearch.js","names":["MAP_SIZE_TO_ICON","m","SearchM","CloseM","l","InputSearch","e","handlers","value","Value","Input","SInputSearch","SClose","Addon","asProps","size","styles","finalSize","context","hideClose","IconClose","IconSearch","sstyled","handleClear","Component","style","defaultValue","selectContext","createComponent"],"sources":["../../src/InputSearch.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport SearchM from '@semcore/icon/Search/m';\nimport CloseM from '@semcore/icon/Close/m';\nimport Input from '@semcore/input';\nimport { selectContext } from './context';\n\nimport style from './style/input-search.shadow.css';\n\nconst MAP_SIZE_TO_ICON = {\n m: [SearchM, CloseM],\n l: [SearchM, CloseM],\n};\n\nclass InputSearch extends Component {\n static displayName = 'InputSearch';\n\n static style = style;\n\n static defaultProps = {\n defaultValue: '',\n };\n\n static contextType = selectContext;\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleClear = (e) => {\n this.handlers.value('', e);\n };\n\n render() {\n const Value = Root;\n const SInputSearch = Input;\n const SClose = Input.Addon;\n const { size, value, styles } = this.asProps;\n const finalSize = size || this.context.size;\n const hideClose = !value;\n const IconClose = MAP_SIZE_TO_ICON[finalSize][1];\n const IconSearch = MAP_SIZE_TO_ICON[finalSize][0];\n\n return sstyled(styles)(\n <SInputSearch size={finalSize} styles={styles}>\n <Input.Addon>\n <IconSearch />\n </Input.Addon>\n <Value render={Input.Value} autoFocus />\n <SClose\n role=\"button\"\n /* hide through css because the width of the input changes */\n hide={hideClose}\n aria-hidden={hideClose}\n interactive\n aria-label=\"Clear search field\"\n onClick={this.handleClear}\n >\n <IconClose />\n </SClose>\n </SInputSearch>,\n );\n }\n}\n\nexport default createComponent(InputSearch);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAMA,gBAAgB,GAAG;EACvBC,CAAC,EAAE,CAACC,aAAD,EAAUC,cAAV,CADoB;EAEvBC,CAAC,EAAE,CAACF,aAAD,EAAUC,cAAV;AAFoB,CAAzB;;IAKME,W;;;;;;;;;;;;;;;oGAiBU,UAACC,CAAD,EAAO;MACnB,MAAKC,QAAL,CAAcC,KAAd,CAAoB,EAApB,EAAwBF,CAAxB;IACD,C;;;;;;WARD,6BAAoB;MAClB,OAAO;QACLE,KAAK,EAAE;MADF,CAAP;IAGD;;;WAMD,kBAAS;MAAA;MAAA;;MACP,IAAMC,KAAK,GAcQC,iBAAA,CAAMD,KAdzB;MACA,IAAME,YAAY,GAAGD,iBAArB;MACA,IAAME,MAAM,GAAGF,iBAAA,CAAMG,KAArB;MACA,oBAAgC,KAAKC,OAArC;MAAA,IAAQC,IAAR,iBAAQA,IAAR;MAAA,IAAcP,KAAd,iBAAcA,KAAd;MAAA,IAAqBQ,MAArB,iBAAqBA,MAArB;MACA,IAAMC,SAAS,GAAGF,IAAI,IAAI,KAAKG,OAAL,CAAaH,IAAvC;MACA,IAAMI,SAAS,GAAG,CAACX,KAAnB;MACA,IAAMY,SAAS,GAAGpB,gBAAgB,CAACiB,SAAD,CAAhB,CAA4B,CAA5B,CAAlB;MACA,IAAMI,UAAU,GAAGrB,gBAAgB,CAACiB,SAAD,CAAhB,CAA4B,CAA5B,CAAnB;MAEA,eAAO,IAAAK,aAAA,EAAQN,MAAR,CAAP,eACE,gCAAC,YAAD;QAAA,QAAoBC,SAApB;QAAA,UAAuCD;MAAvC,iBACE,gCAAC,iBAAD,CAAO,KAAP,qBACE,gCAAC,UAAD,6BADF,CADF,eAIE,gCAAC,KAAD;QAAA;MAAA,WAJF,eAKE,gCAAC,MAAD;QAAA,QACO,QADP;QAAA,QAGQG,SAHR;QAAA,eAIeA,SAJf;QAAA;QAAA,cAMa,oBANb;QAAA,WAOW,KAAKI;MAPhB,iBASE,gCAAC,SAAD,4BATF,CALF,CADF;IAmBD;;;EAlDuBC,e;;iCAApBnB,W,iBACiB,a;iCADjBA,W,WAGWoB,K;iCAHXpB,W,kBAKkB;EACpBqB,YAAY,EAAE;AADM,C;iCALlBrB,W,iBASiBsB,sB;;eA4CR,IAAAC,gBAAA,EAAgBvB,WAAhB,C"}
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
- ".___SOptionCheckbox_1nai2_gg_{margin-top:2px;margin-right:8px;margin-bottom:auto;position:relative;flex-shrink:0}.___SOptionCheckbox_1nai2_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_1nai2_gg_{width:16px;height:16px}.___SOptionCheckbox_1nai2_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_1nai2_gg_._size_l_1nai2_gg_{width:20px;height:20px}.___SOptionCheckbox_1nai2_gg_._size_l_1nai2_gg_:after{background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTEgMS41TDQuNzUgNy43NSAxIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=\")}.___SOptionCheckbox_1nai2_gg_.__checked_1nai2_gg_:before{background-color:#008ff8;border-color:#008ff8}.___SOptionCheckbox_1nai2_gg_.__theme_1nai2_gg_:before{border-color:var(--theme_1nai2)}.___SOptionCheckbox_1nai2_gg_.__theme_1nai2_gg_.__checked_1nai2_gg_:before{background-color:var(--theme_1nai2);border-color:var(--theme_1nai2)}.___SOptionCheckbox_1nai2_gg_.__selected_1nai2_gg_{background-color:rgba(196,229,254,.7)}.___SOptionCheckbox_1nai2_gg_.__selected_1nai2_gg_:hover{background-color:rgba(196,229,254,.7)}"
81
+ ".___SOptionCheckbox_say6j_gg_{margin-top:2px;margin-right:8px;margin-bottom:auto;position:relative;flex-shrink:0}.___SOptionCheckbox_say6j_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_say6j_gg_{width:16px;height:16px}.___SOptionCheckbox_say6j_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_say6j_gg_._size_l_say6j_gg_{width:20px;height:20px}.___SOptionCheckbox_say6j_gg_._size_l_say6j_gg_:after{background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTEgMS41TDQuNzUgNy43NSAxIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=\")}.___SOptionCheckbox_say6j_gg_.__checked_say6j_gg_:before{background-color:#008ff8;border-color:#008ff8}.___SOptionCheckbox_say6j_gg_.__theme_say6j_gg_:before{border-color:var(--theme_say6j)}.___SOptionCheckbox_say6j_gg_.__theme_say6j_gg_.__checked_say6j_gg_:before{background-color:var(--theme_say6j);border-color:var(--theme_say6j)}.___SOptionCheckbox_say6j_gg_.__selected_say6j_gg_{background-color:rgba(196,229,254,.7)}.___SOptionCheckbox_say6j_gg_.__selected_say6j_gg_:hover{background-color:rgba(196,229,254,.7)}"
82
82
  /*__inner_css_end__*/
83
- , "1nai2_gg_")
83
+ , "say6j_gg_")
84
84
  /*__reshadow_css_end__*/
85
85
  , {
86
- "__SOptionCheckbox": "___SOptionCheckbox_1nai2_gg_",
87
- "_size_l": "_size_l_1nai2_gg_",
88
- "_checked": "__checked_1nai2_gg_",
89
- "_theme": "__theme_1nai2_gg_",
90
- "--theme": "--theme_1nai2",
91
- "_selected": "__selected_1nai2_gg_"
86
+ "__SOptionCheckbox": "___SOptionCheckbox_say6j_gg_",
87
+ "_size_l": "_size_l_say6j_gg_",
88
+ "_checked": "__checked_say6j_gg_",
89
+ "_theme": "__theme_say6j_gg_",
90
+ "--theme": "--theme_say6j",
91
+ "_selected": "__selected_say6j_gg_"
92
92
  });
93
93
 
94
94
  function isSelectedOption(value, valueOption) {
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.d.js.map
@@ -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":""}
@@ -28,16 +28,16 @@ var style = (
28
28
  /*__reshadow_css_start__*/
29
29
  _sstyled.insert(
30
30
  /*__inner_css_start__*/
31
- ".___SInputSearch_1jop7_gg_._size_m_1jop7_gg_{height:32px}.___SClose_1jop7_gg_.__hide_1jop7_gg_{visibility:hidden}.___SOutline_1jop7_gg_{top:-1px;left:-1px;width:100%;border-radius:6px 6px 0 0}"
31
+ ".___SInputSearch_1fqxs_gg_._size_m_1fqxs_gg_{height:32px}.___SClose_1fqxs_gg_.__hide_1fqxs_gg_{visibility:hidden}.___SOutline_1fqxs_gg_{top:-1px;left:-1px;width:100%;border-radius:6px 6px 0 0}"
32
32
  /*__inner_css_end__*/
33
- , "1jop7_gg_")
33
+ , "1fqxs_gg_")
34
34
  /*__reshadow_css_end__*/
35
35
  , {
36
- "__SInputSearch": "___SInputSearch_1jop7_gg_",
37
- "_size_m": "_size_m_1jop7_gg_",
38
- "__SClose": "___SClose_1jop7_gg_",
39
- "_hide": "__hide_1jop7_gg_",
40
- "__SOutline": "___SOutline_1jop7_gg_"
36
+ "__SInputSearch": "___SInputSearch_1fqxs_gg_",
37
+ "_size_m": "_size_m_1fqxs_gg_",
38
+ "__SClose": "___SClose_1fqxs_gg_",
39
+ "_hide": "__hide_1fqxs_gg_",
40
+ "__SOutline": "___SOutline_1fqxs_gg_"
41
41
  });
42
42
  var MAP_SIZE_TO_ICON = {
43
43
  m: [SearchM, CloseM],
@@ -101,6 +101,7 @@ var InputSearch = /*#__PURE__*/function (_Component) {
101
101
  "hide": hideClose,
102
102
  "aria-hidden": hideClose,
103
103
  "interactive": true,
104
+ "aria-label": "Clear search field",
104
105
  "onClick": this.handleClear
105
106
  }), /*#__PURE__*/React.createElement(IconClose, _ref2.cn("IconClose", {}))));
106
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InputSearch.js","names":["React","createComponent","Component","sstyled","Root","SearchM","CloseM","Input","selectContext","MAP_SIZE_TO_ICON","m","l","InputSearch","e","handlers","value","Value","SInputSearch","SClose","Addon","asProps","size","styles","finalSize","context","hideClose","IconClose","IconSearch","handleClear","style","defaultValue"],"sources":["../../src/InputSearch.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport SearchM from '@semcore/icon/Search/m';\nimport CloseM from '@semcore/icon/Close/m';\nimport Input from '@semcore/input';\nimport { selectContext } from './context';\n\nimport style from './style/input-search.shadow.css';\n\nconst MAP_SIZE_TO_ICON = {\n m: [SearchM, CloseM],\n l: [SearchM, CloseM],\n};\n\nclass InputSearch extends Component {\n static displayName = 'InputSearch';\n\n static style = style;\n\n static defaultProps = {\n defaultValue: '',\n };\n\n static contextType = selectContext;\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleClear = (e) => {\n this.handlers.value('', e);\n };\n\n render() {\n const Value = Root;\n const SInputSearch = Input;\n const SClose = Input.Addon;\n const { size, value, styles } = this.asProps;\n const finalSize = size || this.context.size;\n const hideClose = !value;\n const IconClose = MAP_SIZE_TO_ICON[finalSize][1];\n const IconSearch = MAP_SIZE_TO_ICON[finalSize][0];\n\n return sstyled(styles)(\n <SInputSearch size={finalSize} styles={styles}>\n <Input.Addon>\n <IconSearch />\n </Input.Addon>\n <Value render={Input.Value} autoFocus />\n <SClose\n role=\"button\"\n /* hide through css because the width of the input changes */\n hide={hideClose}\n aria-hidden={hideClose}\n interactive\n onClick={this.handleClear}\n >\n <IconClose />\n </SClose>\n </SInputSearch>,\n );\n }\n}\n\nexport default createComponent(InputSearch);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,OAAOC,OAAP,MAAoB,wBAApB;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AACA,OAAOC,KAAP,MAAkB,gBAAlB;AACA,SAASC,aAAT,QAA8B,WAA9B;;;;;;;;;;;;;;;;;;AAIA,IAAMC,gBAAgB,GAAG;EACvBC,CAAC,EAAE,CAACL,OAAD,EAAUC,MAAV,CADoB;EAEvBK,CAAC,EAAE,CAACN,OAAD,EAAUC,MAAV;AAFoB,CAAzB;;IAKMM,W;;;;;;;;;;;;;;;;kEAiBU,UAACC,CAAD,EAAO;MACnB,MAAKC,QAAL,CAAcC,KAAd,CAAoB,EAApB,EAAwBF,CAAxB;IACD,C;;;;;;;WARD,6BAAoB;MAClB,OAAO;QACLE,KAAK,EAAE;MADF,CAAP;IAGD;;;WAMD,kBAAS;MAAA;MAAA;;MACP,IAAMC,KAAK,GAcQT,KAAK,CAACS,KAdzB;MACA,IAAMC,YAAY,GAAGV,KAArB;MACA,IAAMW,MAAM,GAAGX,KAAK,CAACY,KAArB;MACA,oBAAgC,KAAKC,OAArC;MAAA,IAAQC,IAAR,iBAAQA,IAAR;MAAA,IAAcN,KAAd,iBAAcA,KAAd;MAAA,IAAqBO,MAArB,iBAAqBA,MAArB;MACA,IAAMC,SAAS,GAAGF,IAAI,IAAI,KAAKG,OAAL,CAAaH,IAAvC;MACA,IAAMI,SAAS,GAAG,CAACV,KAAnB;MACA,IAAMW,SAAS,GAAGjB,gBAAgB,CAACc,SAAD,CAAhB,CAA4B,CAA5B,CAAlB;MACA,IAAMI,UAAU,GAAGlB,gBAAgB,CAACc,SAAD,CAAhB,CAA4B,CAA5B,CAAnB;MAEA,eAAOpB,OAAO,CAACmB,MAAD,CAAd,eACE,oBAAC,YAAD;QAAA,QAAoBC,SAApB;QAAA,UAAuCD;MAAvC,iBACE,oBAAC,KAAD,CAAO,KAAP,qBACE,oBAAC,UAAD,6BADF,CADF,eAIE,oBAAC,KAAD;QAAA;MAAA,WAJF,eAKE,oBAAC,MAAD;QAAA,QACO,QADP;QAAA,QAGQG,SAHR;QAAA,eAIeA,SAJf;QAAA;QAAA,WAMW,KAAKG;MANhB,iBAQE,oBAAC,SAAD,4BARF,CALF,CADF;IAkBD;;;;EAjDuB1B,S;;gBAApBU,W,iBACiB,a;;gBADjBA,W,WAGWiB,K;;gBAHXjB,W,kBAKkB;EACpBkB,YAAY,EAAE;AADM,C;;gBALlBlB,W,iBASiBJ,a;;AA2CvB,eAAeP,eAAe,CAACW,WAAD,CAA9B"}
1
+ {"version":3,"file":"InputSearch.js","names":["React","createComponent","Component","sstyled","Root","SearchM","CloseM","Input","selectContext","MAP_SIZE_TO_ICON","m","l","InputSearch","e","handlers","value","Value","SInputSearch","SClose","Addon","asProps","size","styles","finalSize","context","hideClose","IconClose","IconSearch","handleClear","style","defaultValue"],"sources":["../../src/InputSearch.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport SearchM from '@semcore/icon/Search/m';\nimport CloseM from '@semcore/icon/Close/m';\nimport Input from '@semcore/input';\nimport { selectContext } from './context';\n\nimport style from './style/input-search.shadow.css';\n\nconst MAP_SIZE_TO_ICON = {\n m: [SearchM, CloseM],\n l: [SearchM, CloseM],\n};\n\nclass InputSearch extends Component {\n static displayName = 'InputSearch';\n\n static style = style;\n\n static defaultProps = {\n defaultValue: '',\n };\n\n static contextType = selectContext;\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleClear = (e) => {\n this.handlers.value('', e);\n };\n\n render() {\n const Value = Root;\n const SInputSearch = Input;\n const SClose = Input.Addon;\n const { size, value, styles } = this.asProps;\n const finalSize = size || this.context.size;\n const hideClose = !value;\n const IconClose = MAP_SIZE_TO_ICON[finalSize][1];\n const IconSearch = MAP_SIZE_TO_ICON[finalSize][0];\n\n return sstyled(styles)(\n <SInputSearch size={finalSize} styles={styles}>\n <Input.Addon>\n <IconSearch />\n </Input.Addon>\n <Value render={Input.Value} autoFocus />\n <SClose\n role=\"button\"\n /* hide through css because the width of the input changes */\n hide={hideClose}\n aria-hidden={hideClose}\n interactive\n aria-label=\"Clear search field\"\n onClick={this.handleClear}\n >\n <IconClose />\n </SClose>\n </SInputSearch>,\n );\n }\n}\n\nexport default createComponent(InputSearch);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,OAAOC,OAAP,MAAoB,wBAApB;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AACA,OAAOC,KAAP,MAAkB,gBAAlB;AACA,SAASC,aAAT,QAA8B,WAA9B;;;;;;;;;;;;;;;;;;AAIA,IAAMC,gBAAgB,GAAG;EACvBC,CAAC,EAAE,CAACL,OAAD,EAAUC,MAAV,CADoB;EAEvBK,CAAC,EAAE,CAACN,OAAD,EAAUC,MAAV;AAFoB,CAAzB;;IAKMM,W;;;;;;;;;;;;;;;;kEAiBU,UAACC,CAAD,EAAO;MACnB,MAAKC,QAAL,CAAcC,KAAd,CAAoB,EAApB,EAAwBF,CAAxB;IACD,C;;;;;;;WARD,6BAAoB;MAClB,OAAO;QACLE,KAAK,EAAE;MADF,CAAP;IAGD;;;WAMD,kBAAS;MAAA;MAAA;;MACP,IAAMC,KAAK,GAcQT,KAAK,CAACS,KAdzB;MACA,IAAMC,YAAY,GAAGV,KAArB;MACA,IAAMW,MAAM,GAAGX,KAAK,CAACY,KAArB;MACA,oBAAgC,KAAKC,OAArC;MAAA,IAAQC,IAAR,iBAAQA,IAAR;MAAA,IAAcN,KAAd,iBAAcA,KAAd;MAAA,IAAqBO,MAArB,iBAAqBA,MAArB;MACA,IAAMC,SAAS,GAAGF,IAAI,IAAI,KAAKG,OAAL,CAAaH,IAAvC;MACA,IAAMI,SAAS,GAAG,CAACV,KAAnB;MACA,IAAMW,SAAS,GAAGjB,gBAAgB,CAACc,SAAD,CAAhB,CAA4B,CAA5B,CAAlB;MACA,IAAMI,UAAU,GAAGlB,gBAAgB,CAACc,SAAD,CAAhB,CAA4B,CAA5B,CAAnB;MAEA,eAAOpB,OAAO,CAACmB,MAAD,CAAd,eACE,oBAAC,YAAD;QAAA,QAAoBC,SAApB;QAAA,UAAuCD;MAAvC,iBACE,oBAAC,KAAD,CAAO,KAAP,qBACE,oBAAC,UAAD,6BADF,CADF,eAIE,oBAAC,KAAD;QAAA;MAAA,WAJF,eAKE,oBAAC,MAAD;QAAA,QACO,QADP;QAAA,QAGQG,SAHR;QAAA,eAIeA,SAJf;QAAA;QAAA,cAMa,oBANb;QAAA,WAOW,KAAKG;MAPhB,iBASE,oBAAC,SAAD,4BATF,CALF,CADF;IAmBD;;;;EAlDuB1B,S;;gBAApBU,W,iBACiB,a;;gBADjBA,W,WAGWiB,K;;gBAHXjB,W,kBAKkB;EACpBkB,YAAY,EAAE;AADM,C;;gBALlBlB,W,iBASiBJ,a;;AA4CvB,eAAeP,eAAe,CAACW,WAAD,CAA9B"}
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
- ".___SOptionCheckbox_1nai2_gg_{margin-top:2px;margin-right:8px;margin-bottom:auto;position:relative;flex-shrink:0}.___SOptionCheckbox_1nai2_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_1nai2_gg_{width:16px;height:16px}.___SOptionCheckbox_1nai2_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_1nai2_gg_._size_l_1nai2_gg_{width:20px;height:20px}.___SOptionCheckbox_1nai2_gg_._size_l_1nai2_gg_:after{background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTEgMS41TDQuNzUgNy43NSAxIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=\")}.___SOptionCheckbox_1nai2_gg_.__checked_1nai2_gg_:before{background-color:#008ff8;border-color:#008ff8}.___SOptionCheckbox_1nai2_gg_.__theme_1nai2_gg_:before{border-color:var(--theme_1nai2)}.___SOptionCheckbox_1nai2_gg_.__theme_1nai2_gg_.__checked_1nai2_gg_:before{background-color:var(--theme_1nai2);border-color:var(--theme_1nai2)}.___SOptionCheckbox_1nai2_gg_.__selected_1nai2_gg_{background-color:rgba(196,229,254,.7)}.___SOptionCheckbox_1nai2_gg_.__selected_1nai2_gg_:hover{background-color:rgba(196,229,254,.7)}"
47
+ ".___SOptionCheckbox_say6j_gg_{margin-top:2px;margin-right:8px;margin-bottom:auto;position:relative;flex-shrink:0}.___SOptionCheckbox_say6j_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_say6j_gg_{width:16px;height:16px}.___SOptionCheckbox_say6j_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_say6j_gg_._size_l_say6j_gg_{width:20px;height:20px}.___SOptionCheckbox_say6j_gg_._size_l_say6j_gg_:after{background-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTEgMS41TDQuNzUgNy43NSAxIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=\")}.___SOptionCheckbox_say6j_gg_.__checked_say6j_gg_:before{background-color:#008ff8;border-color:#008ff8}.___SOptionCheckbox_say6j_gg_.__theme_say6j_gg_:before{border-color:var(--theme_say6j)}.___SOptionCheckbox_say6j_gg_.__theme_say6j_gg_.__checked_say6j_gg_:before{background-color:var(--theme_say6j);border-color:var(--theme_say6j)}.___SOptionCheckbox_say6j_gg_.__selected_say6j_gg_{background-color:rgba(196,229,254,.7)}.___SOptionCheckbox_say6j_gg_.__selected_say6j_gg_:hover{background-color:rgba(196,229,254,.7)}"
48
48
  /*__inner_css_end__*/
49
- , "1nai2_gg_")
49
+ , "say6j_gg_")
50
50
  /*__reshadow_css_end__*/
51
51
  , {
52
- "__SOptionCheckbox": "___SOptionCheckbox_1nai2_gg_",
53
- "_size_l": "_size_l_1nai2_gg_",
54
- "_checked": "__checked_1nai2_gg_",
55
- "_theme": "__theme_1nai2_gg_",
56
- "--theme": "--theme_1nai2",
57
- "_selected": "__selected_1nai2_gg_"
52
+ "__SOptionCheckbox": "___SOptionCheckbox_say6j_gg_",
53
+ "_size_l": "_size_l_say6j_gg_",
54
+ "_checked": "__checked_say6j_gg_",
55
+ "_theme": "__theme_say6j_gg_",
56
+ "--theme": "--theme_say6j",
57
+ "_selected": "__selected_say6j_gg_"
58
58
  });
59
59
 
60
60
  function isSelectedOption(value, valueOption) {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.js.map
@@ -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.2",
4
+ "version": "3.1.4",
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": "build --source=js",
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"
@@ -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;
@@ -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;