@semcore/pills 4.2.1 → 4.3.0
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 +11 -47
- package/LICENSE +21 -0
- package/lib/cjs/Pills.js +22 -18
- package/lib/cjs/Pills.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/es6/Pills.js +23 -19
- package/lib/es6/Pills.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,53 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [4.
|
|
5
|
+
## [4.3.0] - 2022-10-10
|
|
6
6
|
|
|
7
7
|
### Changed
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
## [4.2.0] - 2022-09-30
|
|
12
|
-
|
|
13
|
-
### Fixed
|
|
9
|
+
- Added support for React 18 🔥
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## [4.1.6] - 2022-08-30
|
|
11
|
+
## [4.2.2] - 2022-10-07
|
|
18
12
|
|
|
19
13
|
### Changed
|
|
20
14
|
|
|
21
|
-
-
|
|
15
|
+
- Updated major dependency `@semcore/neighbor-location` [2.3.15 ~> 3.0.0]
|
|
22
16
|
|
|
23
|
-
## [4.1
|
|
24
|
-
|
|
25
|
-
### Changed
|
|
26
|
-
|
|
27
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.36.0 ~> 3.37.0], `@semcore/flex-box` [4.5.9 ~> 4.5.10], `@semcore/neighbor-location` [2.3.13 ~> 2.3.14]).
|
|
28
|
-
|
|
29
|
-
## [4.1.4] - 2022-08-11
|
|
30
|
-
|
|
31
|
-
### Changed
|
|
32
|
-
|
|
33
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.35.1 ~> 3.36.0], `@semcore/flex-box` [4.5.8 ~> 4.5.9], `@semcore/neighbor-location` [2.3.12 ~> 2.3.13]).
|
|
34
|
-
|
|
35
|
-
## [4.1.3] - 2022-07-22
|
|
17
|
+
## [4.2.1] - 2022-10-04
|
|
36
18
|
|
|
37
19
|
### Changed
|
|
38
20
|
|
|
39
|
-
- Version patch update due to children dependencies update (`@semcore/
|
|
21
|
+
- Version patch update due to children dependencies update (`@semcore/flex-box` [4.5.11 ~> 4.5.12], `@semcore/neighbor-location` [2.3.15 ~> 2.3.16], `@semcore/utils` [3.37.1 ~> 3.37.2]).
|
|
40
22
|
|
|
41
|
-
## [4.
|
|
23
|
+
## [4.2.0] - 2022-09-30
|
|
42
24
|
|
|
43
|
-
###
|
|
25
|
+
### Fixed
|
|
44
26
|
|
|
45
|
-
-
|
|
27
|
+
- Added essential accessibility attributes.
|
|
46
28
|
|
|
47
|
-
## [4.1.
|
|
29
|
+
## [4.1.6] - 2022-08-30
|
|
48
30
|
|
|
49
31
|
### Changed
|
|
50
32
|
|
|
51
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.
|
|
33
|
+
- Version patch update due to children dependencies update (`@semcore/utils` [3.37.0 ~> 3.37.1], `@semcore/flex-box` [4.5.10 ~> 4.5.11], `@semcore/neighbor-location` [2.3.14 ~> 2.3.15]).
|
|
52
34
|
|
|
53
35
|
## [4.1.0] - 2022-06-01
|
|
54
36
|
|
|
@@ -62,24 +44,6 @@ CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangel
|
|
|
62
44
|
|
|
63
45
|
- Version patch update due to children dependencies update (`@semcore/utils` [3.32.1 ~> 3.32.2], `@semcore/flex-box` [4.5.3 ~> 4.5.4], `@semcore/neighbor-location` [2.3.6 ~> 2.3.7], `@semcore/icon` [2.26.0 ~> 2.26.1], `@semcore/badge` [3.0.1 ~> 3.0.2]).
|
|
64
46
|
|
|
65
|
-
## [4.0.3] - 2022-05-23
|
|
66
|
-
|
|
67
|
-
### Changed
|
|
68
|
-
|
|
69
|
-
- Version patch update due to children dependencies update (`@semcore/icon` [2.25.1 ~> 2.26.0]).
|
|
70
|
-
|
|
71
|
-
## [4.0.2] - 2022-05-19
|
|
72
|
-
|
|
73
|
-
### Changed
|
|
74
|
-
|
|
75
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.32.0 ~> 3.32.1], `@semcore/flex-box` [4.5.1 ~> 4.5.3], `@semcore/neighbor-location` [2.3.5 ~> 2.3.6], `@semcore/icon` [2.25.0 ~> 2.25.1], `@semcore/badge` [3.0.0 ~> 3.0.1]).
|
|
76
|
-
|
|
77
|
-
## [4.0.1] - 2022-05-18
|
|
78
|
-
|
|
79
|
-
### Changed
|
|
80
|
-
|
|
81
|
-
- Version patch update due to children dependencies update (`@semcore/icon` [2.24.0 ~> 2.25.0]).
|
|
82
|
-
|
|
83
47
|
## [4.0.0] - 2022-05-17
|
|
84
48
|
|
|
85
49
|
### BREAK
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright ©, 2022, Semrush Inc. (written by Roman Lysov, Sergey Kobets, Mikhail Karachev, Julia Mnizhek, Elena Krasnopolskaia, Mikhail Sereniti).
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/lib/cjs/Pills.js
CHANGED
|
@@ -52,23 +52,23 @@ var style = (
|
|
|
52
52
|
/*__reshadow_css_start__*/
|
|
53
53
|
_core.sstyled.insert(
|
|
54
54
|
/*__inner_css_start__*/
|
|
55
|
-
".
|
|
55
|
+
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.___SPills_kl9a3_gg_ {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.___SPill_kl9a3_gg_ {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: normal;\n position: relative;\n touch-action: manipulation;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n box-shadow: none;\n outline: none;\n text-decoration: none;\n -webkit-tap-highlight-color: transparent;\n overflow: visible;\n outline: 0;\n text-align: center;\n vertical-align: middle;\n font-family: inherit;\n cursor: pointer;\n background: #ffffff;\n border: 1px solid #c4c7cf;\n border-radius: 6px\n}\n\n.___SPill_kl9a3_gg_::-moz-focus-inner {\n border: none;\n padding: 0;\n }\n\n.___SPill_kl9a3_gg_:active,\n .___SPill_kl9a3_gg_:hover,\n .___SPill_kl9a3_gg_:focus {\n outline: 0;\n text-decoration: none;\n }\n\n.___SPill_kl9a3_gg_:hover {\n background: rgba(138, 142, 155, 0.2);\n }\n\n.___SPill_kl9a3_gg_.__selected_kl9a3_gg_ {\n background: rgba(0, 143, 248, 0.2);\n border-color: #008ff8;\n z-index: 1;\n}\n\n.___SPill_kl9a3_gg_.__disabled_kl9a3_gg_ {\n cursor: default;\n pointer-events: none /* Disable link interactions */\n}\n\n.___SPill_kl9a3_gg_.__disabled_kl9a3_gg_ > * {\n opacity: 0.3;\n }\n\n.___SPill_kl9a3_gg_.__keyboardFocused_kl9a3_gg_ {\n box-shadow: 0 0 0 3px rgba(0, 143, 248, 0.2);\n}\n\n.___SText_kl9a3_gg_ {\n color: #191b23;\n display: inline-flex;\n}\n\n.___SAddon_kl9a3_gg_ {\n color: #6c6e79;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ {\n height: 28px;\n min-width: 28px;\n font-size: 14px\n}\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ .___SText_kl9a3_gg_ {\n margin-left: 8px;\n margin-right: 8px;\n }\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ .___SAddon_kl9a3_gg_:not(:only-child):first-child {\n margin-left: 8px;\n }\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ .___SAddon_kl9a3_gg_:not(:only-child):last-child {\n margin-right: 8px;\n }\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ .___SAddon_kl9a3_gg_:only-child {\n margin-left: 8px;\n margin-right: 8px;\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ {\n height: 40px;\n min-width: 40px;\n font-size: 16px\n}\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SText_kl9a3_gg_ {\n margin-left: 8px;\n margin-right: 8px\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SText_kl9a3_gg_:only-child {\n margin-left: 12px;\n margin-right: 12px;\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SAddon_kl9a3_gg_:not(:only-child):first-child {\n margin-left: 12px;\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SAddon_kl9a3_gg_:not(:only-child):last-child {\n margin-right: 12px;\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SAddon_kl9a3_gg_:only-child {\n margin-left: 12px;\n margin-right: 12px;\n }\n\n.___SPill_kl9a3_gg_._neighborLocation_right_kl9a3_gg_ {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.___SPill_kl9a3_gg_._neighborLocation_both_kl9a3_gg_ {\n border-radius: 0;\n margin-left: -1px;\n}\n\n.___SPill_kl9a3_gg_._neighborLocation_left_kl9a3_gg_ {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n margin-left: -1px;\n}\n"
|
|
56
56
|
/*__inner_css_end__*/
|
|
57
|
-
, "
|
|
57
|
+
, "kl9a3_gg_")
|
|
58
58
|
/*__reshadow_css_end__*/
|
|
59
59
|
, {
|
|
60
|
-
"__SPills": "
|
|
61
|
-
"__SPill": "
|
|
62
|
-
"_selected": "
|
|
63
|
-
"_disabled": "
|
|
64
|
-
"_keyboardFocused": "
|
|
65
|
-
"__SText": "
|
|
66
|
-
"__SAddon": "
|
|
67
|
-
"_size_m": "
|
|
68
|
-
"_size_l": "
|
|
69
|
-
"_neighborLocation_right": "
|
|
70
|
-
"_neighborLocation_both": "
|
|
71
|
-
"_neighborLocation_left": "
|
|
60
|
+
"__SPills": "___SPills_kl9a3_gg_",
|
|
61
|
+
"__SPill": "___SPill_kl9a3_gg_",
|
|
62
|
+
"_selected": "__selected_kl9a3_gg_",
|
|
63
|
+
"_disabled": "__disabled_kl9a3_gg_",
|
|
64
|
+
"_keyboardFocused": "__keyboardFocused_kl9a3_gg_",
|
|
65
|
+
"__SText": "___SText_kl9a3_gg_",
|
|
66
|
+
"__SAddon": "___SAddon_kl9a3_gg_",
|
|
67
|
+
"_size_m": "_size_m_kl9a3_gg_",
|
|
68
|
+
"_size_l": "_size_l_kl9a3_gg_",
|
|
69
|
+
"_neighborLocation_right": "_neighborLocation_right_kl9a3_gg_",
|
|
70
|
+
"_neighborLocation_both": "_neighborLocation_both_kl9a3_gg_",
|
|
71
|
+
"_neighborLocation_left": "_neighborLocation_left_kl9a3_gg_"
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
var RootPills = /*#__PURE__*/function (_Component) {
|
|
@@ -103,12 +103,13 @@ var RootPills = /*#__PURE__*/function (_Component) {
|
|
|
103
103
|
}
|
|
104
104
|
}, {
|
|
105
105
|
key: "getItemProps",
|
|
106
|
-
value: function getItemProps(props) {
|
|
106
|
+
value: function getItemProps(props, i) {
|
|
107
107
|
var _this$asProps = this.asProps,
|
|
108
108
|
value = _this$asProps.value,
|
|
109
109
|
size = _this$asProps.size,
|
|
110
110
|
disabled = _this$asProps.disabled;
|
|
111
111
|
return {
|
|
112
|
+
index: i,
|
|
112
113
|
size: size,
|
|
113
114
|
disabled: disabled,
|
|
114
115
|
selected: value === props.value,
|
|
@@ -155,11 +156,14 @@ function Pill(props) {
|
|
|
155
156
|
addonLeft = props.addonLeft,
|
|
156
157
|
addonRight = props.addonRight,
|
|
157
158
|
selected = props.selected,
|
|
158
|
-
disabled = props.disabled
|
|
159
|
+
disabled = props.disabled,
|
|
160
|
+
index = props.index;
|
|
161
|
+
var neighborLocation = (0, _neighborLocation.useNeighborLocationDetect)(index);
|
|
159
162
|
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SPill, _ref6.cn("SPill", _objectSpread({}, (0, _core.assignProps)({
|
|
160
|
-
"type": "button",
|
|
161
163
|
"tag": "button",
|
|
164
|
+
"type": "button",
|
|
162
165
|
"role": "radio",
|
|
166
|
+
"neighborLocation": neighborLocation,
|
|
163
167
|
"aria-checked": selected,
|
|
164
168
|
"aria-disabled": disabled
|
|
165
169
|
}, _ref2))), addonLeft ? /*#__PURE__*/_react["default"].createElement(Pills.Item.Addon, {
|
|
@@ -169,7 +173,7 @@ function Pill(props) {
|
|
|
169
173
|
}) : null);
|
|
170
174
|
}
|
|
171
175
|
|
|
172
|
-
Pill.enhance = [(0, _keyboardFocusEnhance["default"])()
|
|
176
|
+
Pill.enhance = [(0, _keyboardFocusEnhance["default"])()];
|
|
173
177
|
|
|
174
178
|
function Text(props) {
|
|
175
179
|
var _ref3 = arguments[0],
|
package/lib/cjs/Pills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pills.js","names":["RootPills","value","e","handlers","props","asProps","size","disabled","selected","onClick","bindHandlerClick","SPills","Box","Children","styles","controlsLength","sstyled","Component","style","defaultValue","Pill","SPill","addonLeft","addonRight","addonTextChildren","Pills","Item","Text","Addon","enhance","keyboardFocusEnhance","
|
|
1
|
+
{"version":3,"file":"Pills.js","names":["RootPills","value","e","handlers","props","i","asProps","size","disabled","index","selected","onClick","bindHandlerClick","SPills","Box","Children","styles","controlsLength","sstyled","Component","style","defaultValue","Pill","SPill","addonLeft","addonRight","neighborLocation","useNeighborLocationDetect","addonTextChildren","Pills","Item","Text","Addon","enhance","keyboardFocusEnhance","SText","SAddon","createComponent"],"sources":["../../src/Pills.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport NeighborLocation, { useNeighborLocationDetect } from '@semcore/neighbor-location';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\n\nimport style from './style/pills.shadow.css';\n\nclass RootPills extends Component {\n static displayName = 'Pills';\n static style = style;\n static defaultProps = {\n size: 'm',\n defaultValue: null,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n bindHandlerClick = (value) => (e) => {\n this.handlers.value(value, e);\n };\n\n getItemProps(props, i) {\n const { value, size, disabled } = this.asProps;\n return {\n index: i,\n size,\n disabled,\n selected: value === props.value,\n onClick: this.bindHandlerClick(props.value),\n };\n }\n\n render() {\n const SPills = Root;\n const { Children, styles, controlsLength, disabled } = this.asProps;\n\n return sstyled(styles)(\n <SPills render={Box} role=\"radiogroup\" aria-disabled={disabled}>\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n </SPills>,\n );\n }\n}\n\nfunction Pill(props) {\n const SPill = Root;\n const { Children, styles, addonLeft, addonRight, selected, disabled, index } = props;\n const neighborLocation = useNeighborLocationDetect(index);\n return sstyled(styles)(\n <SPill\n render={Box}\n tag=\"button\"\n type=\"button\"\n role=\"radio\"\n neighborLocation={neighborLocation}\n aria-checked={selected}\n aria-disabled={disabled}\n >\n {addonLeft ? <Pills.Item.Addon tag={addonLeft} /> : null}\n {addonTextChildren(Children, Pills.Item.Text, Pills.Item.Addon)}\n {addonRight ? <Pills.Item.Addon tag={addonRight} /> : null}\n </SPill>,\n );\n}\n\nPill.enhance = [keyboardFocusEnhance()];\n\nfunction Text(props) {\n const SText = Root;\n return sstyled(props.styles)(<SText render={Box} tag=\"span\" />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n return sstyled(props.styles)(<SAddon render={Box} tag=\"span\" />);\n}\n\nconst Pills = createComponent(RootPills, {\n Item: [Pill, { Text, Addon }],\n});\n\nexport default Pills;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIMA,S;;;;;;;;;;;;;;;yGAce,UAACC,KAAD;MAAA,OAAW,UAACC,CAAD,EAAO;QACnC,MAAKC,QAAL,CAAcF,KAAd,CAAoBA,KAApB,EAA2BC,CAA3B;MACD,CAFkB;IAAA,C;;;;;;WANnB,6BAAoB;MAClB,OAAO;QACLD,KAAK,EAAE;MADF,CAAP;IAGD;;;WAMD,sBAAaG,KAAb,EAAoBC,CAApB,EAAuB;MACrB,oBAAkC,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C,SAAhB,EAA2B;EACvC8B,IAAI,EAAE,CAACR,IAAD,EAAO;IAAES,IAAI,EAAJA,IAAF;IAAQC,KAAK,EAALA;EAAR,CAAP;AADiC,CAA3B,CAAd;eAIeH,K"}
|
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 from 'react';\nimport { CProps, PropGetterFn, ReturnEl } from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport { INeighborItemProps, INeighborLocationProps } from '@semcore/neighbor-location';\nimport { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type PillsValue = string | number | boolean;\n\nexport interface IPillsProps<T extends PillsValue = PillsValue> extends INeighborLocationProps {\n /** Pills size */\n size?: 'l' | 'm';\n /** Disabled state */\n disabled?: boolean;\n /** Called when the selection is changed */\n onChange?: (value: T, e?: React.SyntheticEvent<HTMLSpanElement>) => void;\n /** Value for the selected pill */\n value?: T;\n /** Default value for the selected pill */\n defaultValue?: T;\n}\n\nexport interface IPillProps extends IBoxProps, INeighborItemProps, IKeyboardFocusProps {\n /** Pill value */\n value?: PillsValue;\n /** Disabled state */\n disabled?: boolean;\n /** Selected state */\n selected?: boolean;\n /** Left addon text */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n}\n\nexport interface IPillsContext {\n getItemProps: PropGetterFn;\n}\n\nexport interface IPillsHandlers {\n value: (value: PillsValue) => void;\n}\n\ndeclare const Pills: (<T, V extends PillsValue = PillsValue>(\n props: CProps<IPillsProps<V> & T, IPillsContext, IPillsHandlers>,\n) => ReturnEl) & {\n Item: (<T>(props: CProps<IPillProps & T, {}, IPillsHandlers>) => ReturnEl) & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\nexport default Pills;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { CProps, PropGetterFn, ReturnEl } from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport { INeighborItemProps, INeighborLocationProps } from '@semcore/neighbor-location';\nimport { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type PillsValue = string | number | boolean | null;\n\nexport interface IPillsProps<T extends PillsValue = PillsValue> extends INeighborLocationProps {\n /** Pills size */\n size?: 'l' | 'm';\n /** Disabled state */\n disabled?: boolean;\n /** Called when the selection is changed */\n onChange?: (value: T, e?: React.SyntheticEvent<HTMLSpanElement>) => void;\n /** Value for the selected pill */\n value?: T;\n /** Default value for the selected pill */\n defaultValue?: T;\n}\n\nexport interface IPillProps extends IBoxProps, INeighborItemProps, IKeyboardFocusProps {\n /** Pill value */\n value?: PillsValue;\n /** Disabled state */\n disabled?: boolean;\n /** Selected state */\n selected?: boolean;\n /** Left addon text */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n}\n\nexport interface IPillsContext {\n getItemProps: PropGetterFn;\n}\n\nexport interface IPillsHandlers {\n value: (value: PillsValue) => void;\n}\n\ndeclare const Pills: (<T, V extends PillsValue = PillsValue>(\n props: CProps<IPillsProps<V> & T, IPillsContext, IPillsHandlers>,\n) => ReturnEl) & {\n Item: (<T>(props: CProps<IPillProps & T, {}, IPillsHandlers>) => ReturnEl) & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\nexport default Pills;\n"],"mappings":""}
|
package/lib/es6/Pills.js
CHANGED
|
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
22
|
import React from 'react';
|
|
23
23
|
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
24
24
|
import { Box } from '@semcore/flex-box';
|
|
25
|
-
import NeighborLocation, {
|
|
25
|
+
import NeighborLocation, { useNeighborLocationDetect } from '@semcore/neighbor-location';
|
|
26
26
|
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
27
27
|
import addonTextChildren from '@semcore/utils/lib/addonTextChildren';
|
|
28
28
|
|
|
@@ -31,23 +31,23 @@ var style = (
|
|
|
31
31
|
/*__reshadow_css_start__*/
|
|
32
32
|
_sstyled.insert(
|
|
33
33
|
/*__inner_css_start__*/
|
|
34
|
-
".
|
|
34
|
+
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.___SPills_kl9a3_gg_ {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.___SPill_kl9a3_gg_ {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: normal;\n position: relative;\n touch-action: manipulation;\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n box-shadow: none;\n outline: none;\n text-decoration: none;\n -webkit-tap-highlight-color: transparent;\n overflow: visible;\n outline: 0;\n text-align: center;\n vertical-align: middle;\n font-family: inherit;\n cursor: pointer;\n background: #ffffff;\n border: 1px solid #c4c7cf;\n border-radius: 6px\n}\n\n.___SPill_kl9a3_gg_::-moz-focus-inner {\n border: none;\n padding: 0;\n }\n\n.___SPill_kl9a3_gg_:active,\n .___SPill_kl9a3_gg_:hover,\n .___SPill_kl9a3_gg_:focus {\n outline: 0;\n text-decoration: none;\n }\n\n.___SPill_kl9a3_gg_:hover {\n background: rgba(138, 142, 155, 0.2);\n }\n\n.___SPill_kl9a3_gg_.__selected_kl9a3_gg_ {\n background: rgba(0, 143, 248, 0.2);\n border-color: #008ff8;\n z-index: 1;\n}\n\n.___SPill_kl9a3_gg_.__disabled_kl9a3_gg_ {\n cursor: default;\n pointer-events: none /* Disable link interactions */\n}\n\n.___SPill_kl9a3_gg_.__disabled_kl9a3_gg_ > * {\n opacity: 0.3;\n }\n\n.___SPill_kl9a3_gg_.__keyboardFocused_kl9a3_gg_ {\n box-shadow: 0 0 0 3px rgba(0, 143, 248, 0.2);\n}\n\n.___SText_kl9a3_gg_ {\n color: #191b23;\n display: inline-flex;\n}\n\n.___SAddon_kl9a3_gg_ {\n color: #6c6e79;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ {\n height: 28px;\n min-width: 28px;\n font-size: 14px\n}\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ .___SText_kl9a3_gg_ {\n margin-left: 8px;\n margin-right: 8px;\n }\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ .___SAddon_kl9a3_gg_:not(:only-child):first-child {\n margin-left: 8px;\n }\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ .___SAddon_kl9a3_gg_:not(:only-child):last-child {\n margin-right: 8px;\n }\n\n.___SPill_kl9a3_gg_._size_m_kl9a3_gg_ .___SAddon_kl9a3_gg_:only-child {\n margin-left: 8px;\n margin-right: 8px;\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ {\n height: 40px;\n min-width: 40px;\n font-size: 16px\n}\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SText_kl9a3_gg_ {\n margin-left: 8px;\n margin-right: 8px\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SText_kl9a3_gg_:only-child {\n margin-left: 12px;\n margin-right: 12px;\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SAddon_kl9a3_gg_:not(:only-child):first-child {\n margin-left: 12px;\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SAddon_kl9a3_gg_:not(:only-child):last-child {\n margin-right: 12px;\n }\n\n.___SPill_kl9a3_gg_._size_l_kl9a3_gg_ .___SAddon_kl9a3_gg_:only-child {\n margin-left: 12px;\n margin-right: 12px;\n }\n\n.___SPill_kl9a3_gg_._neighborLocation_right_kl9a3_gg_ {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.___SPill_kl9a3_gg_._neighborLocation_both_kl9a3_gg_ {\n border-radius: 0;\n margin-left: -1px;\n}\n\n.___SPill_kl9a3_gg_._neighborLocation_left_kl9a3_gg_ {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n margin-left: -1px;\n}\n"
|
|
35
35
|
/*__inner_css_end__*/
|
|
36
|
-
, "
|
|
36
|
+
, "kl9a3_gg_")
|
|
37
37
|
/*__reshadow_css_end__*/
|
|
38
38
|
, {
|
|
39
|
-
"__SPills": "
|
|
40
|
-
"__SPill": "
|
|
41
|
-
"_selected": "
|
|
42
|
-
"_disabled": "
|
|
43
|
-
"_keyboardFocused": "
|
|
44
|
-
"__SText": "
|
|
45
|
-
"__SAddon": "
|
|
46
|
-
"_size_m": "
|
|
47
|
-
"_size_l": "
|
|
48
|
-
"_neighborLocation_right": "
|
|
49
|
-
"_neighborLocation_both": "
|
|
50
|
-
"_neighborLocation_left": "
|
|
39
|
+
"__SPills": "___SPills_kl9a3_gg_",
|
|
40
|
+
"__SPill": "___SPill_kl9a3_gg_",
|
|
41
|
+
"_selected": "__selected_kl9a3_gg_",
|
|
42
|
+
"_disabled": "__disabled_kl9a3_gg_",
|
|
43
|
+
"_keyboardFocused": "__keyboardFocused_kl9a3_gg_",
|
|
44
|
+
"__SText": "___SText_kl9a3_gg_",
|
|
45
|
+
"__SAddon": "___SAddon_kl9a3_gg_",
|
|
46
|
+
"_size_m": "_size_m_kl9a3_gg_",
|
|
47
|
+
"_size_l": "_size_l_kl9a3_gg_",
|
|
48
|
+
"_neighborLocation_right": "_neighborLocation_right_kl9a3_gg_",
|
|
49
|
+
"_neighborLocation_both": "_neighborLocation_both_kl9a3_gg_",
|
|
50
|
+
"_neighborLocation_left": "_neighborLocation_left_kl9a3_gg_"
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
var RootPills = /*#__PURE__*/function (_Component) {
|
|
@@ -84,12 +84,13 @@ var RootPills = /*#__PURE__*/function (_Component) {
|
|
|
84
84
|
}
|
|
85
85
|
}, {
|
|
86
86
|
key: "getItemProps",
|
|
87
|
-
value: function getItemProps(props) {
|
|
87
|
+
value: function getItemProps(props, i) {
|
|
88
88
|
var _this$asProps = this.asProps,
|
|
89
89
|
value = _this$asProps.value,
|
|
90
90
|
size = _this$asProps.size,
|
|
91
91
|
disabled = _this$asProps.disabled;
|
|
92
92
|
return {
|
|
93
|
+
index: i,
|
|
93
94
|
size: size,
|
|
94
95
|
disabled: disabled,
|
|
95
96
|
selected: value === props.value,
|
|
@@ -139,11 +140,14 @@ function Pill(props) {
|
|
|
139
140
|
addonLeft = props.addonLeft,
|
|
140
141
|
addonRight = props.addonRight,
|
|
141
142
|
selected = props.selected,
|
|
142
|
-
disabled = props.disabled
|
|
143
|
+
disabled = props.disabled,
|
|
144
|
+
index = props.index;
|
|
145
|
+
var neighborLocation = useNeighborLocationDetect(index);
|
|
143
146
|
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SPill, _ref6.cn("SPill", _objectSpread({}, _assignProps2({
|
|
144
|
-
"type": "button",
|
|
145
147
|
"tag": "button",
|
|
148
|
+
"type": "button",
|
|
146
149
|
"role": "radio",
|
|
150
|
+
"neighborLocation": neighborLocation,
|
|
147
151
|
"aria-checked": selected,
|
|
148
152
|
"aria-disabled": disabled
|
|
149
153
|
}, _ref2))), addonLeft ? /*#__PURE__*/React.createElement(Pills.Item.Addon, {
|
|
@@ -153,7 +157,7 @@ function Pill(props) {
|
|
|
153
157
|
}) : null);
|
|
154
158
|
}
|
|
155
159
|
|
|
156
|
-
Pill.enhance = [keyboardFocusEnhance()
|
|
160
|
+
Pill.enhance = [keyboardFocusEnhance()];
|
|
157
161
|
|
|
158
162
|
function Text(props) {
|
|
159
163
|
var _ref3 = arguments[0],
|
package/lib/es6/Pills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pills.js","names":["React","createComponent","Component","sstyled","Root","Box","NeighborLocation","
|
|
1
|
+
{"version":3,"file":"Pills.js","names":["React","createComponent","Component","sstyled","Root","Box","NeighborLocation","useNeighborLocationDetect","keyboardFocusEnhance","addonTextChildren","RootPills","value","e","handlers","props","i","asProps","size","disabled","index","selected","onClick","bindHandlerClick","SPills","Children","styles","controlsLength","style","defaultValue","Pill","SPill","addonLeft","addonRight","neighborLocation","Pills","Item","Text","Addon","enhance","SText","SAddon"],"sources":["../../src/Pills.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport NeighborLocation, { useNeighborLocationDetect } from '@semcore/neighbor-location';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\n\nimport style from './style/pills.shadow.css';\n\nclass RootPills extends Component {\n static displayName = 'Pills';\n static style = style;\n static defaultProps = {\n size: 'm',\n defaultValue: null,\n };\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n bindHandlerClick = (value) => (e) => {\n this.handlers.value(value, e);\n };\n\n getItemProps(props, i) {\n const { value, size, disabled } = this.asProps;\n return {\n index: i,\n size,\n disabled,\n selected: value === props.value,\n onClick: this.bindHandlerClick(props.value),\n };\n }\n\n render() {\n const SPills = Root;\n const { Children, styles, controlsLength, disabled } = this.asProps;\n\n return sstyled(styles)(\n <SPills render={Box} role=\"radiogroup\" aria-disabled={disabled}>\n <NeighborLocation controlsLength={controlsLength}>\n <Children />\n </NeighborLocation>\n </SPills>,\n );\n }\n}\n\nfunction Pill(props) {\n const SPill = Root;\n const { Children, styles, addonLeft, addonRight, selected, disabled, index } = props;\n const neighborLocation = useNeighborLocationDetect(index);\n return sstyled(styles)(\n <SPill\n render={Box}\n tag=\"button\"\n type=\"button\"\n role=\"radio\"\n neighborLocation={neighborLocation}\n aria-checked={selected}\n aria-disabled={disabled}\n >\n {addonLeft ? <Pills.Item.Addon tag={addonLeft} /> : null}\n {addonTextChildren(Children, Pills.Item.Text, Pills.Item.Addon)}\n {addonRight ? <Pills.Item.Addon tag={addonRight} /> : null}\n </SPill>,\n );\n}\n\nPill.enhance = [keyboardFocusEnhance()];\n\nfunction Text(props) {\n const SText = Root;\n return sstyled(props.styles)(<SText render={Box} tag=\"span\" />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n return sstyled(props.styles)(<SAddon render={Box} tag=\"span\" />);\n}\n\nconst Pills = createComponent(RootPills, {\n Item: [Pill, { Text, Addon }],\n});\n\nexport default Pills;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,gBAAP,IAA2BC,yBAA3B,QAA4D,4BAA5D;AACA,OAAOC,oBAAP,MAAiC,kDAAjC;AACA,OAAOC,iBAAP,MAA8B,sCAA9B;;;;;;;;;;;;;;;;;;;;;;;;;;IAIMC,S;;;;;;;;;;;;;;;;uEAce,UAACC,KAAD;MAAA,OAAW,UAACC,CAAD,EAAO;QACnC,MAAKC,QAAL,CAAcF,KAAd,CAAoBA,KAApB,EAA2BC,CAA3B;MACD,CAFkB;IAAA,C;;;;;;;WANnB,6BAAoB;MAClB,OAAO;QACLD,KAAK,EAAE;MADF,CAAP;IAGD;;;WAMD,sBAAaG,KAAb,EAAoBC,CAApB,EAAuB;MACrB,oBAAkC,KAAKC,OAAvC;MAAA,IAAQL,KAAR,iBAAQA,KAAR;MAAA,IAAeM,IAAf,iBAAeA,IAAf;MAAA,IAAqBC,QAArB,iBAAqBA,QAArB;MACA,OAAO;QACLC,KAAK,EAAEJ,CADF;QAELE,IAAI,EAAJA,IAFK;QAGLC,QAAQ,EAARA,QAHK;QAILE,QAAQ,EAAET,KAAK,K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,KAAD;IAAA,OAEM,QAFN;IAAA,QAGO,QAHP;IAAA,QAIO,OAJP;IAAA,oBAKoBQ,gBALpB;IAAA,gBAMgBb,QANhB;IAAA,iBAOiBF;EAPjB,aASGa,SAAS,gBAAG,oBAAC,KAAD,CAAO,IAAP,CAAY,KAAZ;IAAkB,GAAG,EAAEA;EAAvB,EAAH,GAA0C,IATtD,EAUGtB,iBAAiB,CAACe,QAAD,EAAWU,KAAK,CAACC,IAAN,CAAWC,IAAtB,EAA4BF,KAAK,CAACC,IAAN,CAAWE,KAAvC,CAVpB,EAWGL,UAAU,gBAAG,oBAAC,KAAD,CAAO,IAAP,CAAY,KAAZ;IAAkB,GAAG,EAAEA;EAAvB,EAAH,GAA2C,IAXxD,CADF;AAeD;;AAEDH,IAAI,CAACS,OAAL,GAAe,CAAC9B,oBAAoB,EAArB,CAAf;;AAEA,SAAS4B,IAAT,CAActB,KAAd,EAAqB;EAAA;EAAA;;EACnB,IAAMyB,KAAK,GACiClC,GAD5C;EACA,eAAOF,OAAO,CAACW,KAAK,CAACW,MAAP,CAAd,eAA6B,oBAAC,KAAD;IAAA,OAAwB;EAAxB,YAA7B;AACD;;AAED,SAASY,KAAT,CAAevB,KAAf,EAAsB;EAAA;EAAA;;EACpB,IAAM0B,MAAM,GACiCnC,GAD7C;EACA,eAAOF,OAAO,CAACW,KAAK,CAACW,MAAP,CAAd,eAA6B,oBAAC,MAAD;IAAA,OAAyB;EAAzB,YAA7B;AACD;;AAED,IAAMS,KAAK,GAAGjC,eAAe,CAACS,SAAD,EAAY;EACvCyB,IAAI,EAAE,CAACN,IAAD,EAAO;IAAEO,IAAI,EAAJA,IAAF;IAAQC,KAAK,EAALA;EAAR,CAAP;AADiC,CAAZ,CAA7B;AAIA,eAAeH,KAAf"}
|
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 from 'react';\nimport { CProps, PropGetterFn, ReturnEl } from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport { INeighborItemProps, INeighborLocationProps } from '@semcore/neighbor-location';\nimport { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type PillsValue = string | number | boolean;\n\nexport interface IPillsProps<T extends PillsValue = PillsValue> extends INeighborLocationProps {\n /** Pills size */\n size?: 'l' | 'm';\n /** Disabled state */\n disabled?: boolean;\n /** Called when the selection is changed */\n onChange?: (value: T, e?: React.SyntheticEvent<HTMLSpanElement>) => void;\n /** Value for the selected pill */\n value?: T;\n /** Default value for the selected pill */\n defaultValue?: T;\n}\n\nexport interface IPillProps extends IBoxProps, INeighborItemProps, IKeyboardFocusProps {\n /** Pill value */\n value?: PillsValue;\n /** Disabled state */\n disabled?: boolean;\n /** Selected state */\n selected?: boolean;\n /** Left addon text */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n}\n\nexport interface IPillsContext {\n getItemProps: PropGetterFn;\n}\n\nexport interface IPillsHandlers {\n value: (value: PillsValue) => void;\n}\n\ndeclare const Pills: (<T, V extends PillsValue = PillsValue>(\n props: CProps<IPillsProps<V> & T, IPillsContext, IPillsHandlers>,\n) => ReturnEl) & {\n Item: (<T>(props: CProps<IPillProps & T, {}, IPillsHandlers>) => ReturnEl) & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\nexport default Pills;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { CProps, PropGetterFn, ReturnEl } from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport { INeighborItemProps, INeighborLocationProps } from '@semcore/neighbor-location';\nimport { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type PillsValue = string | number | boolean | null;\n\nexport interface IPillsProps<T extends PillsValue = PillsValue> extends INeighborLocationProps {\n /** Pills size */\n size?: 'l' | 'm';\n /** Disabled state */\n disabled?: boolean;\n /** Called when the selection is changed */\n onChange?: (value: T, e?: React.SyntheticEvent<HTMLSpanElement>) => void;\n /** Value for the selected pill */\n value?: T;\n /** Default value for the selected pill */\n defaultValue?: T;\n}\n\nexport interface IPillProps extends IBoxProps, INeighborItemProps, IKeyboardFocusProps {\n /** Pill value */\n value?: PillsValue;\n /** Disabled state */\n disabled?: boolean;\n /** Selected state */\n selected?: boolean;\n /** Left addon text */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n}\n\nexport interface IPillsContext {\n getItemProps: PropGetterFn;\n}\n\nexport interface IPillsHandlers {\n value: (value: PillsValue) => void;\n}\n\ndeclare const Pills: (<T, V extends PillsValue = PillsValue>(\n props: CProps<IPillsProps<V> & T, IPillsContext, IPillsHandlers>,\n) => ReturnEl) & {\n Item: (<T>(props: CProps<IPillProps & T, {}, IPillsHandlers>) => ReturnEl) & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\nexport default Pills;\n"],"mappings":""}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Box, IBoxProps } from '@semcore/flex-box';
|
|
|
4
4
|
import { INeighborItemProps, INeighborLocationProps } from '@semcore/neighbor-location';
|
|
5
5
|
import { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
6
6
|
|
|
7
|
-
export type PillsValue = string | number | boolean;
|
|
7
|
+
export type PillsValue = string | number | boolean | null;
|
|
8
8
|
|
|
9
9
|
export interface IPillsProps<T extends PillsValue = PillsValue> extends INeighborLocationProps {
|
|
10
10
|
/** Pills size */
|
package/package.json
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/pills",
|
|
3
3
|
"description": "Semrush Pills Component",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.3.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "pnpm semcore-builder --source=js",
|
|
13
|
-
"test": "jest"
|
|
14
|
-
},
|
|
15
11
|
"dependencies": {
|
|
16
12
|
"@semcore/flex-box": "^4",
|
|
17
|
-
"@semcore/neighbor-location": "^
|
|
13
|
+
"@semcore/neighbor-location": "^3",
|
|
18
14
|
"@semcore/utils": "^3.15"
|
|
19
15
|
},
|
|
20
16
|
"peerDependencies": {
|
|
21
|
-
"@semcore/core": "^1.
|
|
22
|
-
"react": "16.8 -
|
|
17
|
+
"@semcore/core": "^1.12",
|
|
18
|
+
"react": "16.8 - 18"
|
|
23
19
|
},
|
|
24
20
|
"jest": {
|
|
25
21
|
"preset": "@semcore/jest-preset-ui"
|
|
@@ -30,11 +26,16 @@
|
|
|
30
26
|
"directory": "semcore/pills"
|
|
31
27
|
},
|
|
32
28
|
"devDependencies": {
|
|
33
|
-
"@types/react": "
|
|
29
|
+
"@types/react": "18.0.21",
|
|
34
30
|
"@guidepup/playwright": "0.6.1",
|
|
35
31
|
"@playwright/test": "1.25.1",
|
|
36
32
|
"@semcore/badge": "*",
|
|
37
33
|
"@semcore/icon": "*",
|
|
38
|
-
"@semcore/jest-preset-ui": "1.0.0"
|
|
34
|
+
"@semcore/jest-preset-ui": "1.0.0",
|
|
35
|
+
"jest": "29.0.1"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "pnpm semcore-builder --source=js",
|
|
39
|
+
"test": "jest"
|
|
39
40
|
}
|
|
40
|
-
}
|
|
41
|
+
}
|