@semcore/select 16.0.0-prerelease.15 → 16.0.0-prerelease.16
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 +9 -13
- package/lib/cjs/InputSearch.js.map +1 -1
- package/lib/es6/InputSearch.js +9 -13
- package/lib/es6/InputSearch.js.map +1 -1
- package/lib/esm/InputSearch.mjs +3 -5
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@ CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangel
|
|
|
8
8
|
|
|
9
9
|
- Major version.
|
|
10
10
|
|
|
11
|
+
## [4.51.1] - 2025-04-03
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Double call of `onChange` in InputSearch component.
|
|
16
|
+
|
|
17
|
+
## [4.51.0] - 2025-03-28
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Version minor update due to children dependencies update (`@semcore/button` [5.42.1 ~> 5.43.0], `@semcore/dropdown-menu` [4.46.1 ~> 4.47.0]).
|
|
22
|
+
|
|
11
23
|
## [4.50.1] - 2025-03-20
|
|
12
24
|
|
|
13
25
|
### Changed
|
package/lib/cjs/InputSearch.js
CHANGED
|
@@ -62,12 +62,8 @@ var InputSearchRoot = /*#__PURE__*/function (_Component) {
|
|
|
62
62
|
}, {
|
|
63
63
|
key: "getValueProps",
|
|
64
64
|
value: function getValueProps() {
|
|
65
|
-
var
|
|
66
|
-
value = _this$asProps.value,
|
|
67
|
-
getI18nText = _this$asProps.getI18nText;
|
|
65
|
+
var getI18nText = this.asProps.getI18nText;
|
|
68
66
|
return {
|
|
69
|
-
value: value,
|
|
70
|
-
onChange: this.handlers.value,
|
|
71
67
|
autoFocus: true,
|
|
72
68
|
ref: this.inputRef,
|
|
73
69
|
placeholder: getI18nText('Select.InputSearch.Value:placeholder'),
|
|
@@ -77,9 +73,9 @@ var InputSearchRoot = /*#__PURE__*/function (_Component) {
|
|
|
77
73
|
}, {
|
|
78
74
|
key: "getClearProps",
|
|
79
75
|
value: function getClearProps() {
|
|
80
|
-
var _this$
|
|
81
|
-
value = _this$
|
|
82
|
-
getI18nText = _this$
|
|
76
|
+
var _this$asProps = this.asProps,
|
|
77
|
+
value = _this$asProps.value,
|
|
78
|
+
getI18nText = _this$asProps.getI18nText;
|
|
83
79
|
return {
|
|
84
80
|
ref: this.closeIconRef,
|
|
85
81
|
/* hide through css because the width of the input changes */
|
|
@@ -96,11 +92,11 @@ var InputSearchRoot = /*#__PURE__*/function (_Component) {
|
|
|
96
92
|
_ref5;
|
|
97
93
|
var Value = InputSearch.Value;
|
|
98
94
|
var SInputSearch = _input["default"];
|
|
99
|
-
var _this$
|
|
100
|
-
size = _this$
|
|
101
|
-
styles = _this$
|
|
102
|
-
hasChildren = _this$
|
|
103
|
-
Children = _this$
|
|
95
|
+
var _this$asProps2 = this.asProps,
|
|
96
|
+
size = _this$asProps2.size,
|
|
97
|
+
styles = _this$asProps2.styles,
|
|
98
|
+
hasChildren = _this$asProps2.children,
|
|
99
|
+
Children = _this$asProps2.Children;
|
|
104
100
|
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SInputSearch, _ref5.cn("SInputSearch", {
|
|
105
101
|
"size": size || this.context.size || 'm',
|
|
106
102
|
"styles": styles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSearch.js","names":["_core","require","_react","_interopRequireDefault","_m","_m2","_input","_button","_context","_i18nEnhance","_intergalacticDynamicLocales","style","sstyled","insert","InputSearchRoot","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","e","handlers","value","setTimeout","document","activeElement","body","closeIconRef","current","_this$inputRef$curren","inputRef","focus","_createClass2","key","uncontrolledProps","getValueProps","
|
|
1
|
+
{"version":3,"file":"InputSearch.js","names":["_core","require","_react","_interopRequireDefault","_m","_m2","_input","_button","_context","_i18nEnhance","_intergalacticDynamicLocales","style","sstyled","insert","InputSearchRoot","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","e","handlers","value","setTimeout","document","activeElement","body","closeIconRef","current","_this$inputRef$curren","inputRef","focus","_createClass2","key","uncontrolledProps","getValueProps","getI18nText","asProps","autoFocus","ref","placeholder","getClearProps","_this$asProps","hide","onClick","handleClear","render","_ref","_ref5","Value","InputSearch","SInputSearch","Input","_this$asProps2","size","styles","hasChildren","children","Children","createElement","cn","context","Fragment","SearchIcon","_objectSpread2","assignProps","Clear","Component","i18nEnhance","localizedMessages","defaultValue","i18n","locale","selectContext","props","_ref2","arguments[0]","_ref6","SSearchIcon","Addon","SearchValue","_ref3","_ref7","SSearchValue","SearchClear","_ref4","_ref8","SSearchClear","ButtonLink","CloseM","createComponent","_default","exports"],"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 { ButtonLink } from '@semcore/button';\nimport { selectContext } from './context';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\nimport style from './style/input-search.shadow.css';\n\nclass InputSearchRoot extends Component {\n static displayName = 'InputSearch';\n\n static style = style;\n static enhance = [i18nEnhance(localizedMessages)];\n static defaultProps = {\n defaultValue: '',\n i18n: localizedMessages,\n locale: 'en',\n };\n inputRef = React.createRef();\n closeIconRef = React.createRef();\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 setTimeout(() => {\n if (\n document.activeElement === document.body ||\n document.activeElement === this.closeIconRef.current\n ) {\n this.inputRef.current?.focus();\n }\n }, 0);\n };\n\n getValueProps() {\n const { getI18nText } = this.asProps;\n return {\n autoFocus: true,\n ref: this.inputRef,\n placeholder: getI18nText('Select.InputSearch.Value:placeholder'),\n 'aria-label': getI18nText('Select.InputSearch.Value:aria-label'),\n };\n }\n getClearProps() {\n const { value, getI18nText } = this.asProps;\n return {\n ref: this.closeIconRef,\n /* hide through css because the width of the input changes */\n hide: !value,\n 'aria-hidden': !value,\n 'aria-label': getI18nText('clearSearch'),\n onClick: this.handleClear,\n };\n }\n\n render() {\n const Value = Root;\n const SInputSearch = Input;\n const { size, styles, children: hasChildren, Children } = this.asProps;\n\n return sstyled(styles)(\n <SInputSearch size={size || this.context.size || 'm'} styles={styles}>\n {hasChildren ? (\n <Children />\n ) : (\n <>\n <InputSearch.SearchIcon />\n <Value render={InputSearch.Value} />\n <InputSearch.Clear />\n </>\n )}\n </SInputSearch>,\n );\n }\n}\n\nconst SearchIcon = (props) => {\n const SSearchIcon = Root;\n const { styles } = props;\n return sstyled(styles)(\n <SSearchIcon render={Input.Addon}>\n <SearchM />\n </SSearchIcon>,\n );\n};\nconst SearchValue = (props) => {\n const SSearchValue = Root;\n const { styles } = props;\n return sstyled(styles)(<SSearchValue render={Input.Value} />);\n};\nconst SearchClear = (props) => {\n const SSearchClear = Root;\n const { styles } = props;\n return sstyled(styles)(<SSearchClear render={ButtonLink} addonLeft={CloseM} use={'secondary'} />);\n};\n\nconst InputSearch = createComponent(InputSearchRoot, {\n SearchIcon: SearchIcon,\n Value: SearchValue,\n Clear: SearchClear,\n});\n\nexport default InputSearch;\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,EAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,GAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAA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AAA,CAAA1B,EAAA,qBAAAI,cAAA,qBAAA9E,KAAA,CAAA+E,WAAA;IAAA,aAAgCwB,cAAM;IAAA,OAAO;EAAW,GAAAJ,KAAA,IAAI;AAClG,CAAC;AAED,IAAMnC,WAAW,GAAG,IAAAwC,qBAAe,EAAC1F,eAAe,EAAE;EACnD+D,UAAU,EAAEA,UAAU;EACtBd,KAAK,EAAE+B,WAAW;EAClBd,KAAK,EAAEkB;AACT,CAAC,CAAC;AAAC,IAAAO,QAAA,GAEYzC,WAAW;AAAA0C,OAAA,cAAAD,QAAA"}
|
package/lib/es6/InputSearch.js
CHANGED
|
@@ -60,12 +60,8 @@ var InputSearchRoot = /*#__PURE__*/function (_Component) {
|
|
|
60
60
|
}, {
|
|
61
61
|
key: "getValueProps",
|
|
62
62
|
value: function getValueProps() {
|
|
63
|
-
var
|
|
64
|
-
value = _this$asProps.value,
|
|
65
|
-
getI18nText = _this$asProps.getI18nText;
|
|
63
|
+
var getI18nText = this.asProps.getI18nText;
|
|
66
64
|
return {
|
|
67
|
-
value: value,
|
|
68
|
-
onChange: this.handlers.value,
|
|
69
65
|
autoFocus: true,
|
|
70
66
|
ref: this.inputRef,
|
|
71
67
|
placeholder: getI18nText('Select.InputSearch.Value:placeholder'),
|
|
@@ -75,9 +71,9 @@ var InputSearchRoot = /*#__PURE__*/function (_Component) {
|
|
|
75
71
|
}, {
|
|
76
72
|
key: "getClearProps",
|
|
77
73
|
value: function getClearProps() {
|
|
78
|
-
var _this$
|
|
79
|
-
value = _this$
|
|
80
|
-
getI18nText = _this$
|
|
74
|
+
var _this$asProps = this.asProps,
|
|
75
|
+
value = _this$asProps.value,
|
|
76
|
+
getI18nText = _this$asProps.getI18nText;
|
|
81
77
|
return {
|
|
82
78
|
ref: this.closeIconRef,
|
|
83
79
|
/* hide through css because the width of the input changes */
|
|
@@ -94,11 +90,11 @@ var InputSearchRoot = /*#__PURE__*/function (_Component) {
|
|
|
94
90
|
_ref5;
|
|
95
91
|
var Value = InputSearch.Value;
|
|
96
92
|
var SInputSearch = Input;
|
|
97
|
-
var _this$
|
|
98
|
-
size = _this$
|
|
99
|
-
styles = _this$
|
|
100
|
-
hasChildren = _this$
|
|
101
|
-
Children = _this$
|
|
93
|
+
var _this$asProps2 = this.asProps,
|
|
94
|
+
size = _this$asProps2.size,
|
|
95
|
+
styles = _this$asProps2.styles,
|
|
96
|
+
hasChildren = _this$asProps2.children,
|
|
97
|
+
Children = _this$asProps2.Children;
|
|
102
98
|
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SInputSearch, _ref5.cn("SInputSearch", {
|
|
103
99
|
"size": size || this.context.size || 'm',
|
|
104
100
|
"styles": styles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSearch.js","names":["React","createComponent","Component","sstyled","Root","SearchM","CloseM","Input","ButtonLink","selectContext","i18nEnhance","localizedMessages","style","_sstyled","insert","InputSearchRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","e","handlers","value","setTimeout","document","activeElement","body","closeIconRef","current","_this$inputRef$curren","inputRef","focus","_createClass","key","uncontrolledProps","getValueProps","
|
|
1
|
+
{"version":3,"file":"InputSearch.js","names":["React","createComponent","Component","sstyled","Root","SearchM","CloseM","Input","ButtonLink","selectContext","i18nEnhance","localizedMessages","style","_sstyled","insert","InputSearchRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","e","handlers","value","setTimeout","document","activeElement","body","closeIconRef","current","_this$inputRef$curren","inputRef","focus","_createClass","key","uncontrolledProps","getValueProps","getI18nText","asProps","autoFocus","ref","placeholder","getClearProps","_this$asProps","hide","onClick","handleClear","render","_ref","_ref5","Value","InputSearch","SInputSearch","_this$asProps2","size","styles","hasChildren","children","Children","createElement","cn","context","Fragment","SearchIcon","_objectSpread","_assignProps","Clear","defaultValue","i18n","locale","props","_ref2","arguments[0]","_ref6","SSearchIcon","Addon","_assignProps2","SearchValue","_ref3","_ref7","SSearchValue","_assignProps3","SearchClear","_ref4","_ref8","SSearchClear","_assignProps4"],"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 { ButtonLink } from '@semcore/button';\nimport { selectContext } from './context';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\nimport style from './style/input-search.shadow.css';\n\nclass InputSearchRoot extends Component {\n static displayName = 'InputSearch';\n\n static style = style;\n static enhance = [i18nEnhance(localizedMessages)];\n static defaultProps = {\n defaultValue: '',\n i18n: localizedMessages,\n locale: 'en',\n };\n inputRef = React.createRef();\n closeIconRef = React.createRef();\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 setTimeout(() => {\n if (\n document.activeElement === document.body ||\n document.activeElement === this.closeIconRef.current\n ) {\n this.inputRef.current?.focus();\n }\n }, 0);\n };\n\n getValueProps() {\n const { getI18nText } = this.asProps;\n return {\n autoFocus: true,\n ref: this.inputRef,\n placeholder: getI18nText('Select.InputSearch.Value:placeholder'),\n 'aria-label': getI18nText('Select.InputSearch.Value:aria-label'),\n };\n }\n getClearProps() {\n const { value, getI18nText } = this.asProps;\n return {\n ref: this.closeIconRef,\n /* hide through css because the width of the input changes */\n hide: !value,\n 'aria-hidden': !value,\n 'aria-label': getI18nText('clearSearch'),\n onClick: this.handleClear,\n };\n }\n\n render() {\n const Value = Root;\n const SInputSearch = Input;\n const { size, styles, children: hasChildren, Children } = this.asProps;\n\n return sstyled(styles)(\n <SInputSearch size={size || this.context.size || 'm'} styles={styles}>\n {hasChildren ? (\n <Children />\n ) : (\n <>\n <InputSearch.SearchIcon />\n <Value render={InputSearch.Value} />\n <InputSearch.Clear />\n </>\n )}\n </SInputSearch>,\n );\n }\n}\n\nconst SearchIcon = (props) => {\n const SSearchIcon = Root;\n const { styles } = props;\n return sstyled(styles)(\n <SSearchIcon render={Input.Addon}>\n <SearchM />\n </SSearchIcon>,\n );\n};\nconst SearchValue = (props) => {\n const SSearchValue = Root;\n const { styles } = props;\n return sstyled(styles)(<SSearchValue render={Input.Value} />);\n};\nconst SearchClear = (props) => {\n const SSearchClear = Root;\n const { styles } = props;\n return sstyled(styles)(<SSearchClear render={ButtonLink} addonLeft={CloseM} use={'secondary'} />);\n};\n\nconst InputSearch = createComponent(InputSearchRoot, {\n SearchIcon: SearchIcon,\n Value: SearchValue,\n Clear: SearchClear,\n});\n\nexport default InputSearch;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,OAAOC,OAAO,MAAM,wBAAwB;AAC5C,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,OAAOC,KAAK,MAAM,gBAAgB;AAClC,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,aAAa,QAAQ,WAAW;AACzC,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,iBAAiB,QAAQ,gDAAgD;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAI7EC,eAAe,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,eAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,eAAA;EAAA,SAAAA,gBAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,eAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ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,GAAKe,KAAK,CAAhBf,MAAM;EACd,OAAAwB,KAAA,GAAOzF,OAAO,CAACiE,MAAM,CAAC,eAACpE,KAAA,CAAAwE,aAAA,CAACqB,YAAY,EAAAD,KAAA,CAAAnB,EAAA,iBAAAI,aAAA,KAAAiB,aAAA,KAAAH,KAAA,IAAwB;AAC9D,CAAC;AACD,IAAMI,WAAW,GAAG,SAAdA,WAAWA,CAAIZ,KAAK,EAAK;EAAA,IAAAa,KAAA,GAAAX,YAAA;IAAAY,KAAA;EAC7B,IAAMC,YAAY,GAE2B1F,UAAU;EADvD,IAAQ4D,MAAM,GAAKe,KAAK,CAAhBf,MAAM;EACd,OAAA6B,KAAA,GAAO9F,OAAO,CAACiE,MAAM,CAAC,eAACpE,KAAA,CAAAwE,aAAA,CAAC0B,YAAY,EAAAD,KAAA,CAAAxB,EAAA,iBAAAI,aAAA,KAAAsB,aAAA;IAAA,aAAgC7F,MAAM;IAAA,OAAO;EAAW,GAAA0F,KAAA,IAAI;AAClG,CAAC;AAED,IAAMhC,WAAW,GAAG/D,eAAe,CAACc,eAAe,EAAE;EACnD6D,UAAU,EAAEA,UAAU;EACtBb,KAAK,EAAE2B,WAAW;EAClBX,KAAK,EAAEgB;AACT,CAAC,CAAC;AAEF,eAAe/B,WAAW"}
|
package/lib/esm/InputSearch.mjs
CHANGED
|
@@ -61,10 +61,8 @@ var InputSearchRoot = /* @__PURE__ */ function(_Component) {
|
|
|
61
61
|
}, {
|
|
62
62
|
key: "getValueProps",
|
|
63
63
|
value: function getValueProps() {
|
|
64
|
-
var
|
|
64
|
+
var getI18nText = this.asProps.getI18nText;
|
|
65
65
|
return {
|
|
66
|
-
value,
|
|
67
|
-
onChange: this.handlers.value,
|
|
68
66
|
autoFocus: true,
|
|
69
67
|
ref: this.inputRef,
|
|
70
68
|
placeholder: getI18nText("Select.InputSearch.Value:placeholder"),
|
|
@@ -74,7 +72,7 @@ var InputSearchRoot = /* @__PURE__ */ function(_Component) {
|
|
|
74
72
|
}, {
|
|
75
73
|
key: "getClearProps",
|
|
76
74
|
value: function getClearProps() {
|
|
77
|
-
var _this$
|
|
75
|
+
var _this$asProps = this.asProps, value = _this$asProps.value, getI18nText = _this$asProps.getI18nText;
|
|
78
76
|
return {
|
|
79
77
|
ref: this.closeIconRef,
|
|
80
78
|
/* hide through css because the width of the input changes */
|
|
@@ -90,7 +88,7 @@ var InputSearchRoot = /* @__PURE__ */ function(_Component) {
|
|
|
90
88
|
var _ref = this.asProps, _ref5;
|
|
91
89
|
var Value = InputSearch.Value;
|
|
92
90
|
var SInputSearch = Input;
|
|
93
|
-
var _this$
|
|
91
|
+
var _this$asProps2 = this.asProps, size = _this$asProps2.size, styles = _this$asProps2.styles, hasChildren = _this$asProps2.children, Children = _this$asProps2.Children;
|
|
94
92
|
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SInputSearch, _ref5.cn("SInputSearch", {
|
|
95
93
|
"size": size || this.context.size || "m",
|
|
96
94
|
"styles": styles
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/select",
|
|
3
3
|
"description": "Semrush Select Component",
|
|
4
|
-
"version": "16.0.0-prerelease.
|
|
4
|
+
"version": "16.0.0-prerelease.16",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
"types": "./lib/types/index.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@semcore/base-trigger": "16.0.0-prerelease.
|
|
17
|
-
"@semcore/button": "16.0.0-prerelease.
|
|
18
|
-
"@semcore/checkbox": "16.0.0-prerelease.
|
|
19
|
-
"@semcore/divider": "16.0.0-prerelease.
|
|
20
|
-
"@semcore/dropdown-menu": "16.0.0-prerelease.
|
|
21
|
-
"@semcore/dropdown": "16.0.0-prerelease.
|
|
22
|
-
"@semcore/icon": "16.0.0-prerelease.
|
|
23
|
-
"@semcore/input": "16.0.0-prerelease.
|
|
24
|
-
"@semcore/popper": "16.0.0-prerelease.
|
|
25
|
-
"@semcore/flex-box": "16.0.0-prerelease.
|
|
16
|
+
"@semcore/base-trigger": "16.0.0-prerelease.16",
|
|
17
|
+
"@semcore/button": "16.0.0-prerelease.16",
|
|
18
|
+
"@semcore/checkbox": "16.0.0-prerelease.16",
|
|
19
|
+
"@semcore/divider": "16.0.0-prerelease.16",
|
|
20
|
+
"@semcore/dropdown-menu": "16.0.0-prerelease.16",
|
|
21
|
+
"@semcore/dropdown": "16.0.0-prerelease.16",
|
|
22
|
+
"@semcore/icon": "16.0.0-prerelease.16",
|
|
23
|
+
"@semcore/input": "16.0.0-prerelease.16",
|
|
24
|
+
"@semcore/popper": "16.0.0-prerelease.16",
|
|
25
|
+
"@semcore/flex-box": "16.0.0-prerelease.16",
|
|
26
26
|
"classnames": "2.2.6"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@semcore/base-components": "^16.0.0-prerelease.
|
|
29
|
+
"@semcore/base-components": "^16.0.0-prerelease.16"
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|