@semcore/pills 5.43.1 → 16.0.0-prerelease.2

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,12 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [16.0.0] - 2025-01-09
6
+
7
+ ### Changed
8
+
9
+ - `keyboardFocusEnhance` to css `:focus-visible` property.
10
+
5
11
  ## [5.43.1] - 2025-03-20
6
12
 
7
13
  ### Changed
package/lib/cjs/Pills.js CHANGED
@@ -13,29 +13,26 @@ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/hel
13
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
14
  var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _index = require("@semcore/utils/lib/core/index");
17
- var _core = _interopRequireWildcard(require("@semcore/core"));
16
+ var _core = require("@semcore/core");
18
17
  var _react = _interopRequireDefault(require("react"));
19
18
  var _flexBox = require("@semcore/flex-box");
20
19
  var _neighborLocation = _interopRequireWildcard(require("@semcore/neighbor-location"));
21
- var _keyboardFocusEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/keyboardFocusEnhance"));
22
- var _addonTextChildren = _interopRequireDefault(require("@semcore/utils/lib/addonTextChildren"));
23
- var _a11yEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/a11yEnhance"));
24
- var _logger = _interopRequireDefault(require("@semcore/utils/lib/logger"));
20
+ var _addonTextChildren = _interopRequireDefault(require("@semcore/core/lib/utils/addonTextChildren"));
21
+ var _a11yEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/a11yEnhance"));
22
+ var _logger = _interopRequireDefault(require("@semcore/core/lib/utils/logger"));
25
23
  /*__reshadow-styles__:"./style/pills.shadow.css"*/
26
- var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/".___SPills_15aj4_gg_{display:inline-flex;align-items:center;justify-content:center;isolation:isolate;outline:0}.___SPills_15aj4_gg_.__keyboardFocused_15aj4_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1}.___SPill_15aj4_gg_{display:inline-flex;align-items:center;justify-content:center;line-height:normal;position:relative;touch-action:manipulation;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;overflow:visible;outline:0;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid var(--intergalactic-border-primary, #c4c7cf);border-radius:var(--intergalactic-control-rounded, 6px)}.___SPill_15aj4_gg_::-moz-focus-inner{border:0;padding:0}.___SPill_15aj4_gg_:active,.___SPill_15aj4_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPill_15aj4_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none;background:var(--intergalactic-bg-primary-neutral-hover, #f4f5f9)}}.___SPill_15aj4_gg_.__selected_15aj4_gg_{background:var(--intergalactic-control-secondary-info, rgba(0, 143, 248, 0.1));border-color:var(--intergalactic-border-info-active, #006dca);z-index:1}.___SPill_15aj4_gg_.__disabled_15aj4_gg_{cursor:default;pointer-events:none}.___SPill_15aj4_gg_.__disabled_15aj4_gg_>*{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SPill_15aj4_gg_.__keyboardFocused_15aj4_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1}.___SText_15aj4_gg_{color:var(--intergalactic-text-primary, #191b23);display:inline-flex}.___SAddon_15aj4_gg_{color:var(--intergalactic-text-secondary, #6c6e79);display:inline-flex;align-items:center;justify-content:center}.___SPill_15aj4_gg_._size_m_15aj4_gg_{height:var(--intergalactic-form-control-m, 28px);min-width:var(--intergalactic-form-control-m, 28px);font-size:var(--intergalactic-fs-200, 14px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SText_15aj4_gg_,.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SText_15aj4_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:only-child{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_{height:var(--intergalactic-form-control-l, 40px);min-width:var(--intergalactic-form-control-l, 40px);font-size:var(--intergalactic-fs-300, 16px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:only-child,.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SText_15aj4_gg_:only-child{margin-left:var(--intergalactic-spacing-3x, 12px);margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._neighborLocation_right_15aj4_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SPill_15aj4_gg_._neighborLocation_both_15aj4_gg_{border-radius:0;margin-left:-1px}.___SPill_15aj4_gg_._neighborLocation_left_15aj4_gg_{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}" /*__inner_css_end__*/, "15aj4_gg_") /*__reshadow_css_end__*/, {
27
- "__SPills": "___SPills_15aj4_gg_",
28
- "_keyboardFocused": "__keyboardFocused_15aj4_gg_",
29
- "__SPill": "___SPill_15aj4_gg_",
30
- "_selected": "__selected_15aj4_gg_",
31
- "__SText": "___SText_15aj4_gg_",
32
- "__SAddon": "___SAddon_15aj4_gg_",
33
- "_neighborLocation_right": "_neighborLocation_right_15aj4_gg_",
34
- "_neighborLocation_both": "_neighborLocation_both_15aj4_gg_",
35
- "_neighborLocation_left": "_neighborLocation_left_15aj4_gg_",
36
- "_disabled": "__disabled_15aj4_gg_",
37
- "_size_m": "_size_m_15aj4_gg_",
38
- "_size_l": "_size_l_15aj4_gg_"
24
+ var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SPill_1m0ra_gg_,.___SPills_1m0ra_gg_{display:inline-flex;align-items:center;justify-content:center;border-radius:var(--intergalactic-control-rounded, 6px)}.___SPills_1m0ra_gg_{isolation:isolate}.___SPill_1m0ra_gg_{line-height:normal;position:relative;touch-action:manipulation;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;overflow:visible;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SPill_1m0ra_gg_::-moz-focus-inner{border:0;padding:0}.___SPill_1m0ra_gg_:active{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPill_1m0ra_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none;background:var(--intergalactic-bg-primary-neutral-hover, #f4f5f9)}}.___SPill_1m0ra_gg_.__selected_1m0ra_gg_{background:var(--intergalactic-control-secondary-info, rgba(0, 143, 248, 0.1));border-color:var(--intergalactic-border-info-active, #006dca)}.___SPill_1m0ra_gg_:active,.___SPill_1m0ra_gg_:focus-visible{z-index:1}@media (hover:hover){.___SPill_1m0ra_gg_:hover{z-index:1}}.___SPill_1m0ra_gg_.__disabled_1m0ra_gg_{cursor:default;pointer-events:none}.___SPill_1m0ra_gg_.__disabled_1m0ra_gg_>*{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SText_1m0ra_gg_{color:var(--intergalactic-text-primary, #191b23);display:inline-flex}.___SAddon_1m0ra_gg_{color:var(--intergalactic-text-secondary, #6c6e79);display:inline-flex;align-items:center;justify-content:center}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_{height:var(--intergalactic-form-control-m, 28px);min-width:var(--intergalactic-form-control-m, 28px);font-size:var(--intergalactic-fs-200, 14px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SText_1m0ra_gg_,.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SText_1m0ra_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:only-child{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_{height:var(--intergalactic-form-control-l, 40px);min-width:var(--intergalactic-form-control-l, 40px);font-size:var(--intergalactic-fs-300, 16px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:only-child,.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SText_1m0ra_gg_:only-child{margin-left:var(--intergalactic-spacing-3x, 12px);margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._neighborLocation_right_1m0ra_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SPill_1m0ra_gg_._neighborLocation_both_1m0ra_gg_{border-radius:0;margin-left:-1px}.___SPill_1m0ra_gg_._neighborLocation_left_1m0ra_gg_{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}" /*__inner_css_end__*/, "1m0ra_gg_") /*__reshadow_css_end__*/, {
25
+ "__SPills": "___SPills_1m0ra_gg_",
26
+ "__SPill": "___SPill_1m0ra_gg_",
27
+ "_selected": "__selected_1m0ra_gg_",
28
+ "__SText": "___SText_1m0ra_gg_",
29
+ "__SAddon": "___SAddon_1m0ra_gg_",
30
+ "_neighborLocation_right": "_neighborLocation_right_1m0ra_gg_",
31
+ "_neighborLocation_both": "_neighborLocation_both_1m0ra_gg_",
32
+ "_neighborLocation_left": "_neighborLocation_left_1m0ra_gg_",
33
+ "_disabled": "__disabled_1m0ra_gg_",
34
+ "_size_m": "_size_m_1m0ra_gg_",
35
+ "_size_l": "_size_l_1m0ra_gg_"
39
36
  });
40
37
  var optionsA11yEnhance = {
41
38
  onNeighborChange: function onNeighborChange(neighborElement, props) {
@@ -156,7 +153,7 @@ var RootPills = /*#__PURE__*/function (_Component) {
156
153
  behavior: behavior !== null && behavior !== void 0 ? behavior : 'auto'
157
154
  };
158
155
  });
159
- (0, _defineProperty2["default"])(RootPills, "enhance", [(0, _a11yEnhance["default"])(optionsA11yEnhance), (0, _keyboardFocusEnhance["default"])()]);
156
+ (0, _defineProperty2["default"])(RootPills, "enhance", [(0, _a11yEnhance["default"])(optionsA11yEnhance)]);
160
157
  function Pill(props) {
161
158
  var _ref2 = arguments[0],
162
159
  _ref6;
@@ -181,6 +178,7 @@ function Pill(props) {
181
178
  return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SPill, _ref6.cn("SPill", (0, _objectSpread2["default"])({}, (0, _core.assignProps)((0, _objectSpread2["default"])({
182
179
  "tag": 'button',
183
180
  "type": 'button',
181
+ "tabIndex": 0,
184
182
  "neighborLocation": neighborLocation,
185
183
  "aria-disabled": disabled
186
184
  }, roleAreaProps), _ref2))), addonLeft ? /*#__PURE__*/_react["default"].createElement(Pills.Item.Addon, {
@@ -189,7 +187,6 @@ function Pill(props) {
189
187
  tag: addonRight
190
188
  }) : null);
191
189
  }
192
- Pill.enhance = [(0, _keyboardFocusEnhance["default"])()];
193
190
  function Text(props) {
194
191
  var _ref3 = arguments[0],
195
192
  _ref7;
@@ -206,7 +203,7 @@ function Addon(props) {
206
203
  "tag": 'span'
207
204
  }, _ref4))));
208
205
  }
209
- var Pills = (0, _core["default"])(RootPills, {
206
+ var Pills = (0, _core.createComponent)(RootPills, {
210
207
  Item: [Pill, {
211
208
  Text: Text,
212
209
  Addon: Addon
@@ -1 +1 @@
1
- {"version":3,"file":"Pills.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_neighborLocation","_keyboardFocusEnhance","_addonTextChildren","_a11yEnhance","_logger","style","_index","sstyled","insert","optionsA11yEnhance","onNeighborChange","neighborElement","props","focus","behavior","click","childSelector","RootPills","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","value","e","handlers","event","key","preventDefault","startIndex","type","selectable","itemValues","element","itemRefs","disabled","undefined","_createClass2","componentDidMount","log","warn","asProps","uncontrolledProps","getItemProps","index","_this$asProps","size","isSelected","selected","tabIndex","onClick","bindHandlerClick","onKeyDown","bindHandleKeyDown","render","_ref","_ref5","SPills","Box","_this$asProps2","Children","styles","controlsLength","createElement","cn","_objectSpread2","assignProps","Component","_ref9","defaultValue","a11yEnhance","keyboardFocusEnhance","Pill","_ref2","arguments[0]","_ref6","SPill","addonLeft","addonRight","neighborLocation","useNeighborLocationDetect","roleAreaProps","role","Pills","Item","Addon","tag","addonTextChildren","Text","enhance","_ref3","_ref7","SText","_ref4","_ref8","SAddon","createComponent","wrapPills","wrapper","exports","_default"],"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';\nimport a11yEnhance from '@semcore/utils/lib/enhances/a11yEnhance';\nimport log from '@semcore/utils/lib/logger';\n\nimport style from './style/pills.shadow.css';\n\nconst optionsA11yEnhance = {\n onNeighborChange: (neighborElement, props) => {\n if (neighborElement) {\n neighborElement.focus();\n if (props.behavior === 'auto' || props.behavior === 'radio') {\n neighborElement.click();\n }\n }\n },\n childSelector: (props) =>\n props.behavior === 'auto' || props.behavior === 'radio' ? ['role', 'radio'] : ['role', 'tab'],\n};\n\nclass RootPills extends Component {\n static displayName = 'Pills';\n static style = style;\n static defaultProps = ({ behavior }) => ({\n size: 'm',\n defaultValue: null,\n behavior: behavior ?? 'auto',\n });\n itemValues = [];\n static enhance = [a11yEnhance(optionsA11yEnhance), keyboardFocusEnhance()];\n\n componentDidMount() {\n log.warn(\n this.asProps.behavior === 'tabs',\n 'Use behavior `manual` instead of `tabs`. \\n`tabs` is deprecated and will be removed in the next major release.',\n 'Pills',\n );\n\n log.warn(\n this.asProps.behavior === 'radio',\n 'Use behavior `auto` (or nothing, it is default value) instead of `radio`. \\n`radio` is deprecated and will be removed in the next major release.',\n 'Pills',\n );\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 bindHandleKeyDown = (value) => (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.handlers.value(value, event);\n }\n };\n\n getItemProps(props, index) {\n const { value, size, disabled, behavior } = this.asProps;\n const isSelected = value === props.value;\n\n this.itemValues[index] = props.value;\n return {\n index: index,\n size,\n disabled,\n selected: isSelected,\n behavior,\n tabIndex: isSelected ? 0 : -1,\n onClick: this.bindHandlerClick(props.value),\n onKeyDown: this.bindHandleKeyDown(props.value),\n };\n }\n\n changeIndex = (startIndex, type) => {\n let selectable = false;\n\n while (!selectable && startIndex >= 0 && startIndex < this.itemValues.length) {\n if (type === 'increment') startIndex++;\n if (type === 'decrement') startIndex--;\n\n const element = this.itemRefs[startIndex];\n\n if (element?.disabled === false) {\n selectable = true;\n }\n }\n\n return startIndex >= 0 && startIndex < this.itemValues.length ? startIndex : undefined;\n };\n\n render() {\n const SPills = Root;\n const { Children, styles, controlsLength, disabled, behavior, value } = this.asProps;\n\n return sstyled(styles)(\n <SPills\n render={Box}\n role={behavior === 'radio' || behavior === 'auto' ? 'radiogroup' : 'tablist'}\n aria-disabled={disabled}\n use:tabIndex={value !== null ? -1 : 0}\n >\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, behavior } = props;\n const neighborLocation = useNeighborLocationDetect(index);\n const roleAreaProps = {};\n if (behavior === 'radio' || behavior === 'auto') {\n roleAreaProps.role = 'radio';\n roleAreaProps['aria-checked'] = selected;\n } else {\n roleAreaProps.role = 'tab';\n roleAreaProps['aria-selected'] = selected;\n }\n return sstyled(styles)(\n <SPill\n render={Box}\n tag='button'\n type='button'\n neighborLocation={neighborLocation}\n aria-disabled={disabled}\n {...roleAreaProps}\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 const wrapPills = (wrapper) => wrapper;\n\nexport default Pills;\n"],"mappings":";;;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,qBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,kBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,YAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,OAAA,GAAAN,sBAAA,CAAAF,OAAA;AAA4C;AAAA,IAAAS,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI5C,IAAMC,kBAAkB,GAAG;EACzBC,gBAAgB,EAAE,SAAAA,iBAACC,eAAe,EAAEC,KAAK,EAAK;IAC5C,IAAID,eAAe,EAAE;MACnBA,eAAe,CAACE,KAAK,EAAE;MACvB,IAAID,KAAK,CAACE,QAAQ,KAAK,MAAM,IAAIF,KAAK,CAACE,QAAQ,KAAK,OAAO,EAAE;QAC3DH,eAAe,CAAC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QAAA"}
1
+ {"version":3,"file":"Pills.js","names":["_core","require","_react","_interopRequireDefault","_flexBox","_neighborLocation","_interopRequireWildcard","_addonTextChildren","_a11yEnhance","_logger","style","sstyled","insert","optionsA11yEnhance","onNeighborChange","neighborElement","props","focus","behavior","click","childSelector","RootPills","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","value","e","handlers","event","key","preventDefault","startIndex","type","selectable","itemValues","element","itemRefs","disabled","undefined","_createClass2","componentDidMount","log","warn","asProps","uncontrolledProps","getItemProps","index","_this$asProps","size","isSelected","selected","tabIndex","onClick","bindHandlerClick","onKeyDown","bindHandleKeyDown","render","_ref","_ref5","SPills","Box","_this$asProps2","Children","styles","controlsLength","createElement","cn","_objectSpread2","assignProps","Component","_ref9","defaultValue","a11yEnhance","Pill","_ref2","arguments[0]","_ref6","SPill","addonLeft","addonRight","neighborLocation","useNeighborLocationDetect","roleAreaProps","role","Pills","Item","Addon","tag","addonTextChildren","Text","_ref3","_ref7","SText","_ref4","_ref8","SAddon","createComponent","wrapPills","wrapper","exports","_default"],"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 addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport a11yEnhance from '@semcore/core/lib/utils/enhances/a11yEnhance';\nimport log from '@semcore/core/lib/utils/logger';\n\nimport style from './style/pills.shadow.css';\n\nconst optionsA11yEnhance = {\n onNeighborChange: (neighborElement, props) => {\n if (neighborElement) {\n neighborElement.focus();\n if (props.behavior === 'auto' || props.behavior === 'radio') {\n neighborElement.click();\n }\n }\n },\n childSelector: (props) =>\n props.behavior === 'auto' || props.behavior === 'radio' ? ['role', 'radio'] : ['role', 'tab'],\n};\n\nclass RootPills extends Component {\n static displayName = 'Pills';\n static style = style;\n static defaultProps = ({ behavior }) => ({\n size: 'm',\n defaultValue: null,\n behavior: behavior ?? 'auto',\n });\n itemValues = [];\n static enhance = [a11yEnhance(optionsA11yEnhance)];\n\n componentDidMount() {\n log.warn(\n this.asProps.behavior === 'tabs',\n 'Use behavior `manual` instead of `tabs`. \\n`tabs` is deprecated and will be removed in the next major release.',\n 'Pills',\n );\n\n log.warn(\n this.asProps.behavior === 'radio',\n 'Use behavior `auto` (or nothing, it is default value) instead of `radio`. \\n`radio` is deprecated and will be removed in the next major release.',\n 'Pills',\n );\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 bindHandleKeyDown = (value) => (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.handlers.value(value, event);\n }\n };\n\n getItemProps(props, index) {\n const { value, size, disabled, behavior } = this.asProps;\n const isSelected = value === props.value;\n\n this.itemValues[index] = props.value;\n return {\n index: index,\n size,\n disabled,\n selected: isSelected,\n behavior,\n tabIndex: isSelected ? 0 : -1,\n onClick: this.bindHandlerClick(props.value),\n onKeyDown: this.bindHandleKeyDown(props.value),\n };\n }\n\n changeIndex = (startIndex, type) => {\n let selectable = false;\n\n while (!selectable && startIndex >= 0 && startIndex < this.itemValues.length) {\n if (type === 'increment') startIndex++;\n if (type === 'decrement') startIndex--;\n\n const element = this.itemRefs[startIndex];\n\n if (element?.disabled === false) {\n selectable = true;\n }\n }\n\n return startIndex >= 0 && startIndex < this.itemValues.length ? startIndex : undefined;\n };\n\n render() {\n const SPills = Root;\n const { Children, styles, controlsLength, disabled, behavior, value } = this.asProps;\n\n return sstyled(styles)(\n <SPills\n render={Box}\n role={behavior === 'radio' || behavior === 'auto' ? 'radiogroup' : 'tablist'}\n aria-disabled={disabled}\n use:tabIndex={value !== null ? -1 : 0}\n >\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, behavior } = props;\n const neighborLocation = useNeighborLocationDetect(index);\n const roleAreaProps = {};\n if (behavior === 'radio' || behavior === 'auto') {\n roleAreaProps.role = 'radio';\n roleAreaProps['aria-checked'] = selected;\n } else {\n roleAreaProps.role = 'tab';\n roleAreaProps['aria-selected'] = selected;\n }\n return sstyled(styles)(\n <SPill\n render={Box}\n tag='button'\n type='button'\n tabIndex={0}\n neighborLocation={neighborLocation}\n aria-disabled={disabled}\n {...roleAreaProps}\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\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 const wrapPills = (wrapper) => wrapper;\n\nexport default Pills;\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,YAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,OAAA,GAAAN,sBAAA,CAAAF,OAAA;AAAiD;AAAA,IAAAS,KAAA,+BAAAV,KAAA,CAAAW,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIjD,IAAMC,kBAAkB,GAAG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AZA,SAASA,CAAIC,OAAO;EAAA,OAAKA,OAAO;AAAA;AAACC,OAAA,CAAAF,SAAA,GAAAA,SAAA;AAAA,IAAAG,QAAA,GAE/BhB,KAAK;AAAAe,OAAA,cAAAC,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';\nimport { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type PillsValue = string | number | boolean | null;\n\n/** @deprecated */\nexport interface IPillsProps<T extends PillsValue = PillsValue>\n extends PillsProps<T>,\n UnknownProperties {}\nexport type PillsProps<T extends PillsValue = PillsValue> = NeighborLocationProps &\n KeyboardFocusProps &\n BoxProps & {\n /** Pills size */\n size?: 'l' | 'm';\n /** Disabled state */\n disabled?: boolean;\n /** Called when the selection is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLSpanElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Value for the selected pill */\n value?: T;\n /** Default value for the selected pill */\n defaultValue?: T;\n /** Sets semantic role for corresponding behavior,\n * when set to `auto` pressing left and right arrows\n * selects corresponding sibling pill.\n *\n * It's recommended to use `auto` behavior in forms\n * while `manual` behavior for navigation and layout.\n * @default tabs\n */\n behavior?: /** @deprecated use `manual` */\n | 'tabs'\n /** @deprecated use `auto` */\n | 'radio'\n | 'auto'\n | 'manual';\n };\n\n/** @deprecated */\nexport interface IPillProps extends PillProps, UnknownProperties {}\nexport type PillProps = BoxProps &\n NeighborItemProps &\n KeyboardFocusProps & {\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\n/** @deprecated */\nexport interface IPillsContext extends PillsContext, UnknownProperties {}\nexport type PillsContext = {\n getItemProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IPillsHandlers extends PillsHandlers, UnknownProperties {}\nexport type PillsHandlers = {\n value: (value: PillsValue) => void;\n};\n\ntype IntergalacticPillsComponent<PropsExtending = {}> = (<\n Value extends PillsValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n PillsProps<Value>,\n PillsContext,\n [handlers: PillsHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', PillsProps>;\n\ndeclare const Pills: IntergalacticPillsComponent & {\n Item: Intergalactic.Component<'button', PillProps, [handlers: PillsHandlers]> & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\ndeclare const wrapPills: <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticPillsComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => IntergalacticPillsComponent<PropsExtending>;\nexport { wrapPills };\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 { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';\nimport { KeyboardFocusProps } from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';\n\nexport type PillsValue = string | number | boolean | null;\n\n/** @deprecated */\nexport interface IPillsProps<T extends PillsValue = PillsValue>\n extends PillsProps<T>,\n UnknownProperties {}\nexport type PillsProps<T extends PillsValue = PillsValue> = NeighborLocationProps &\n KeyboardFocusProps &\n BoxProps & {\n /** Pills size */\n size?: 'l' | 'm';\n /** Disabled state */\n disabled?: boolean;\n /** Called when the selection is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLSpanElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Value for the selected pill */\n value?: T;\n /** Default value for the selected pill */\n defaultValue?: T;\n /** Sets semantic role for corresponding behavior,\n * when set to `auto` pressing left and right arrows\n * selects corresponding sibling pill.\n *\n * It's recommended to use `auto` behavior in forms\n * while `manual` behavior for navigation and layout.\n * @default tabs\n */\n behavior?: /** @deprecated use `manual` */\n | 'tabs'\n /** @deprecated use `auto` */\n | 'radio'\n | 'auto'\n | 'manual';\n };\n\n/** @deprecated */\nexport interface IPillProps extends PillProps, UnknownProperties {}\nexport type PillProps = BoxProps &\n NeighborItemProps &\n KeyboardFocusProps & {\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\n/** @deprecated */\nexport interface IPillsContext extends PillsContext, UnknownProperties {}\nexport type PillsContext = {\n getItemProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IPillsHandlers extends PillsHandlers, UnknownProperties {}\nexport type PillsHandlers = {\n value: (value: PillsValue) => void;\n};\n\ntype IntergalacticPillsComponent<PropsExtending = {}> = (<\n Value extends PillsValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n PillsProps<Value>,\n PillsContext,\n [handlers: PillsHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', PillsProps>;\n\ndeclare const Pills: IntergalacticPillsComponent & {\n Item: Intergalactic.Component<'button', PillProps, [handlers: PillsHandlers]> & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\ndeclare const wrapPills: <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticPillsComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => IntergalacticPillsComponent<PropsExtending>;\nexport { wrapPills };\n\nexport default Pills;\n"],"mappings":""}
@@ -3,12 +3,7 @@ SPills {
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  isolation: isolate;
6
- outline: none;
7
- }
8
-
9
- SPills[keyboardFocused]:focus {
10
- box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));
11
- z-index: 1;
6
+ border-radius: var(--intergalactic-control-rounded, 6px);
12
7
  }
13
8
 
14
9
  SPill {
@@ -27,7 +22,6 @@ SPill {
27
22
  text-decoration: none;
28
23
  -webkit-tap-highlight-color: transparent;
29
24
  overflow: visible;
30
- outline: 0;
31
25
  text-align: center;
32
26
  vertical-align: middle;
33
27
  font-family: inherit;
@@ -42,8 +36,7 @@ SPill {
42
36
  }
43
37
 
44
38
  &:active,
45
- &:hover,
46
- &:focus {
39
+ &:hover {
47
40
  outline: 0;
48
41
  text-decoration: none;
49
42
  }
@@ -56,6 +49,8 @@ SPill {
56
49
  SPill[selected] {
57
50
  background: var(--intergalactic-control-secondary-info, rgba(0, 143, 248, 0.1));
58
51
  border-color: var(--intergalactic-border-info-active, #006dca);
52
+ }
53
+ SPill:focus-visible, SPill:hover, SPill:active {
59
54
  z-index: 1;
60
55
  }
61
56
 
@@ -69,11 +64,6 @@ SPill[disabled] {
69
64
  }
70
65
  }
71
66
 
72
- SPill[keyboardFocused] {
73
- box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));
74
- z-index: 1;
75
- }
76
-
77
67
  SText {
78
68
  color: var(--intergalactic-text-primary, #191b23);
79
69
  display: inline-flex;
package/lib/es6/Pills.js CHANGED
@@ -5,33 +5,31 @@ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized
5
5
  import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _createSuper from "@babel/runtime/helpers/createSuper";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
8
+ import { sstyled as _sstyled } from "@semcore/core";
9
9
  import { assignProps as _assignProps4 } from "@semcore/core";
10
10
  import { assignProps as _assignProps3 } from "@semcore/core";
11
11
  import { assignProps as _assignProps2 } from "@semcore/core";
12
12
  import { assignProps as _assignProps } from "@semcore/core";
13
13
  import React from 'react';
14
- import createComponent, { Component, sstyled, Root } from '@semcore/core';
14
+ import { createComponent, Component, sstyled, Root } from '@semcore/core';
15
15
  import { Box } from '@semcore/flex-box';
16
16
  import NeighborLocation, { useNeighborLocationDetect } from '@semcore/neighbor-location';
17
- import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
18
- import addonTextChildren from '@semcore/utils/lib/addonTextChildren';
19
- import a11yEnhance from '@semcore/utils/lib/enhances/a11yEnhance';
20
- import log from '@semcore/utils/lib/logger';
17
+ import addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';
18
+ import a11yEnhance from '@semcore/core/lib/utils/enhances/a11yEnhance';
19
+ import log from '@semcore/core/lib/utils/logger';
21
20
  /*__reshadow-styles__:"./style/pills.shadow.css"*/
22
- var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SPills_15aj4_gg_{display:inline-flex;align-items:center;justify-content:center;isolation:isolate;outline:0}.___SPills_15aj4_gg_.__keyboardFocused_15aj4_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1}.___SPill_15aj4_gg_{display:inline-flex;align-items:center;justify-content:center;line-height:normal;position:relative;touch-action:manipulation;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;overflow:visible;outline:0;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid var(--intergalactic-border-primary, #c4c7cf);border-radius:var(--intergalactic-control-rounded, 6px)}.___SPill_15aj4_gg_::-moz-focus-inner{border:0;padding:0}.___SPill_15aj4_gg_:active,.___SPill_15aj4_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPill_15aj4_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none;background:var(--intergalactic-bg-primary-neutral-hover, #f4f5f9)}}.___SPill_15aj4_gg_.__selected_15aj4_gg_{background:var(--intergalactic-control-secondary-info, rgba(0, 143, 248, 0.1));border-color:var(--intergalactic-border-info-active, #006dca);z-index:1}.___SPill_15aj4_gg_.__disabled_15aj4_gg_{cursor:default;pointer-events:none}.___SPill_15aj4_gg_.__disabled_15aj4_gg_>*{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SPill_15aj4_gg_.__keyboardFocused_15aj4_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1}.___SText_15aj4_gg_{color:var(--intergalactic-text-primary, #191b23);display:inline-flex}.___SAddon_15aj4_gg_{color:var(--intergalactic-text-secondary, #6c6e79);display:inline-flex;align-items:center;justify-content:center}.___SPill_15aj4_gg_._size_m_15aj4_gg_{height:var(--intergalactic-form-control-m, 28px);min-width:var(--intergalactic-form-control-m, 28px);font-size:var(--intergalactic-fs-200, 14px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SText_15aj4_gg_,.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SText_15aj4_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:only-child{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_{height:var(--intergalactic-form-control-l, 40px);min-width:var(--intergalactic-form-control-l, 40px);font-size:var(--intergalactic-fs-300, 16px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:only-child,.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SText_15aj4_gg_:only-child{margin-left:var(--intergalactic-spacing-3x, 12px);margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._neighborLocation_right_15aj4_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SPill_15aj4_gg_._neighborLocation_both_15aj4_gg_{border-radius:0;margin-left:-1px}.___SPill_15aj4_gg_._neighborLocation_left_15aj4_gg_{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}" /*__inner_css_end__*/, "15aj4_gg_") /*__reshadow_css_end__*/, {
23
- "__SPills": "___SPills_15aj4_gg_",
24
- "_keyboardFocused": "__keyboardFocused_15aj4_gg_",
25
- "__SPill": "___SPill_15aj4_gg_",
26
- "_selected": "__selected_15aj4_gg_",
27
- "__SText": "___SText_15aj4_gg_",
28
- "__SAddon": "___SAddon_15aj4_gg_",
29
- "_neighborLocation_right": "_neighborLocation_right_15aj4_gg_",
30
- "_neighborLocation_both": "_neighborLocation_both_15aj4_gg_",
31
- "_neighborLocation_left": "_neighborLocation_left_15aj4_gg_",
32
- "_disabled": "__disabled_15aj4_gg_",
33
- "_size_m": "_size_m_15aj4_gg_",
34
- "_size_l": "_size_l_15aj4_gg_"
21
+ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SPill_1m0ra_gg_,.___SPills_1m0ra_gg_{display:inline-flex;align-items:center;justify-content:center;border-radius:var(--intergalactic-control-rounded, 6px)}.___SPills_1m0ra_gg_{isolation:isolate}.___SPill_1m0ra_gg_{line-height:normal;position:relative;touch-action:manipulation;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;overflow:visible;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SPill_1m0ra_gg_::-moz-focus-inner{border:0;padding:0}.___SPill_1m0ra_gg_:active{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPill_1m0ra_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none;background:var(--intergalactic-bg-primary-neutral-hover, #f4f5f9)}}.___SPill_1m0ra_gg_.__selected_1m0ra_gg_{background:var(--intergalactic-control-secondary-info, rgba(0, 143, 248, 0.1));border-color:var(--intergalactic-border-info-active, #006dca)}.___SPill_1m0ra_gg_:active,.___SPill_1m0ra_gg_:focus-visible{z-index:1}@media (hover:hover){.___SPill_1m0ra_gg_:hover{z-index:1}}.___SPill_1m0ra_gg_.__disabled_1m0ra_gg_{cursor:default;pointer-events:none}.___SPill_1m0ra_gg_.__disabled_1m0ra_gg_>*{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SText_1m0ra_gg_{color:var(--intergalactic-text-primary, #191b23);display:inline-flex}.___SAddon_1m0ra_gg_{color:var(--intergalactic-text-secondary, #6c6e79);display:inline-flex;align-items:center;justify-content:center}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_{height:var(--intergalactic-form-control-m, 28px);min-width:var(--intergalactic-form-control-m, 28px);font-size:var(--intergalactic-fs-200, 14px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SText_1m0ra_gg_,.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SText_1m0ra_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:only-child{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_{height:var(--intergalactic-form-control-l, 40px);min-width:var(--intergalactic-form-control-l, 40px);font-size:var(--intergalactic-fs-300, 16px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:only-child,.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SText_1m0ra_gg_:only-child{margin-left:var(--intergalactic-spacing-3x, 12px);margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._neighborLocation_right_1m0ra_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SPill_1m0ra_gg_._neighborLocation_both_1m0ra_gg_{border-radius:0;margin-left:-1px}.___SPill_1m0ra_gg_._neighborLocation_left_1m0ra_gg_{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}" /*__inner_css_end__*/, "1m0ra_gg_") /*__reshadow_css_end__*/, {
22
+ "__SPills": "___SPills_1m0ra_gg_",
23
+ "__SPill": "___SPill_1m0ra_gg_",
24
+ "_selected": "__selected_1m0ra_gg_",
25
+ "__SText": "___SText_1m0ra_gg_",
26
+ "__SAddon": "___SAddon_1m0ra_gg_",
27
+ "_neighborLocation_right": "_neighborLocation_right_1m0ra_gg_",
28
+ "_neighborLocation_both": "_neighborLocation_both_1m0ra_gg_",
29
+ "_neighborLocation_left": "_neighborLocation_left_1m0ra_gg_",
30
+ "_disabled": "__disabled_1m0ra_gg_",
31
+ "_size_m": "_size_m_1m0ra_gg_",
32
+ "_size_l": "_size_l_1m0ra_gg_"
35
33
  });
36
34
  var optionsA11yEnhance = {
37
35
  onNeighborChange: function onNeighborChange(neighborElement, props) {
@@ -152,7 +150,7 @@ _defineProperty(RootPills, "defaultProps", function (_ref9) {
152
150
  behavior: behavior !== null && behavior !== void 0 ? behavior : 'auto'
153
151
  };
154
152
  });
155
- _defineProperty(RootPills, "enhance", [a11yEnhance(optionsA11yEnhance), keyboardFocusEnhance()]);
153
+ _defineProperty(RootPills, "enhance", [a11yEnhance(optionsA11yEnhance)]);
156
154
  function Pill(props) {
157
155
  var _ref2 = arguments[0],
158
156
  _ref6;
@@ -177,6 +175,7 @@ function Pill(props) {
177
175
  return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SPill, _ref6.cn("SPill", _objectSpread({}, _assignProps2(_objectSpread({
178
176
  "tag": 'button',
179
177
  "type": 'button',
178
+ "tabIndex": 0,
180
179
  "neighborLocation": neighborLocation,
181
180
  "aria-disabled": disabled
182
181
  }, roleAreaProps), _ref2))), addonLeft ? /*#__PURE__*/React.createElement(Pills.Item.Addon, {
@@ -185,7 +184,6 @@ function Pill(props) {
185
184
  tag: addonRight
186
185
  }) : null);
187
186
  }
188
- Pill.enhance = [keyboardFocusEnhance()];
189
187
  function Text(props) {
190
188
  var _ref3 = arguments[0],
191
189
  _ref7;
@@ -1 +1 @@
1
- {"version":3,"file":"Pills.js","names":["React","createComponent","Component","sstyled","Root","Box","NeighborLocation","useNeighborLocationDetect","keyboardFocusEnhance","addonTextChildren","a11yEnhance","log","style","_sstyled","insert","optionsA11yEnhance","onNeighborChange","neighborElement","props","focus","behavior","click","childSelector","RootPills","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","value","e","handlers","event","key","preventDefault","startIndex","type","selectable","itemValues","element","itemRefs","disabled","undefined","_createClass","componentDidMount","warn","asProps","uncontrolledProps","getItemProps","index","_this$asProps","size","isSelected","selected","tabIndex","onClick","bindHandlerClick","onKeyDown","bindHandleKeyDown","render","_ref","_ref5","SPills","_this$asProps2","Children","styles","controlsLength","createElement","cn","_objectSpread","_assignProps","_ref9","defaultValue","Pill","_ref2","arguments[0]","_ref6","SPill","addonLeft","addonRight","neighborLocation","roleAreaProps","role","_assignProps2","Pills","Item","Addon","tag","Text","enhance","_ref3","_ref7","SText","_assignProps3","_ref4","_ref8","SAddon","_assignProps4","wrapPills","wrapper"],"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';\nimport a11yEnhance from '@semcore/utils/lib/enhances/a11yEnhance';\nimport log from '@semcore/utils/lib/logger';\n\nimport style from './style/pills.shadow.css';\n\nconst optionsA11yEnhance = {\n onNeighborChange: (neighborElement, props) => {\n if (neighborElement) {\n neighborElement.focus();\n if (props.behavior === 'auto' || props.behavior === 'radio') {\n neighborElement.click();\n }\n }\n },\n childSelector: (props) =>\n props.behavior === 'auto' || props.behavior === 'radio' ? ['role', 'radio'] : ['role', 'tab'],\n};\n\nclass RootPills extends Component {\n static displayName = 'Pills';\n static style = style;\n static defaultProps = ({ behavior }) => ({\n size: 'm',\n defaultValue: null,\n behavior: behavior ?? 'auto',\n });\n itemValues = [];\n static enhance = [a11yEnhance(optionsA11yEnhance), keyboardFocusEnhance()];\n\n componentDidMount() {\n log.warn(\n this.asProps.behavior === 'tabs',\n 'Use behavior `manual` instead of `tabs`. \\n`tabs` is deprecated and will be removed in the next major release.',\n 'Pills',\n );\n\n log.warn(\n this.asProps.behavior === 'radio',\n 'Use behavior `auto` (or nothing, it is default value) instead of `radio`. \\n`radio` is deprecated and will be removed in the next major release.',\n 'Pills',\n );\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 bindHandleKeyDown = (value) => (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.handlers.value(value, event);\n }\n };\n\n getItemProps(props, index) {\n const { value, size, disabled, behavior } = this.asProps;\n const isSelected = value === props.value;\n\n this.itemValues[index] = props.value;\n return {\n index: index,\n size,\n disabled,\n selected: isSelected,\n behavior,\n tabIndex: isSelected ? 0 : -1,\n onClick: this.bindHandlerClick(props.value),\n onKeyDown: this.bindHandleKeyDown(props.value),\n };\n }\n\n changeIndex = (startIndex, type) => {\n let selectable = false;\n\n while (!selectable && startIndex >= 0 && startIndex < this.itemValues.length) {\n if (type === 'increment') startIndex++;\n if (type === 'decrement') startIndex--;\n\n const element = this.itemRefs[startIndex];\n\n if (element?.disabled === false) {\n selectable = true;\n }\n }\n\n return startIndex >= 0 && startIndex < this.itemValues.length ? startIndex : undefined;\n };\n\n render() {\n const SPills = Root;\n const { Children, styles, controlsLength, disabled, behavior, value } = this.asProps;\n\n return sstyled(styles)(\n <SPills\n render={Box}\n role={behavior === 'radio' || behavior === 'auto' ? 'radiogroup' : 'tablist'}\n aria-disabled={disabled}\n use:tabIndex={value !== null ? -1 : 0}\n >\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, behavior } = props;\n const neighborLocation = useNeighborLocationDetect(index);\n const roleAreaProps = {};\n if (behavior === 'radio' || behavior === 'auto') {\n roleAreaProps.role = 'radio';\n roleAreaProps['aria-checked'] = selected;\n } else {\n roleAreaProps.role = 'tab';\n roleAreaProps['aria-selected'] = selected;\n }\n return sstyled(styles)(\n <SPill\n render={Box}\n tag='button'\n type='button'\n neighborLocation={neighborLocation}\n aria-disabled={disabled}\n {...roleAreaProps}\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 const wrapPills = (wrapper) => wrapper;\n\nexport default Pills;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,gBAAgB,IAAIC,yBAAyB,QAAQ,4BAA4B;AACxF,OAAOC,oBAAoB,MAAM,kDAAkD;AACnF,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,WAAW,MAAM,yCA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,EAALA;EAAM,CAAC;AAC9B,CAAC,CAAC;AAEF,OAAO,IAAMY,SAAS,GAAG,SAAZA,SAASA,CAAIC,OAAO;EAAA,OAAKA,OAAO;AAAA;AAE7C,eAAef,KAAK"}
1
+ {"version":3,"file":"Pills.js","names":["React","createComponent","Component","sstyled","Root","Box","NeighborLocation","useNeighborLocationDetect","addonTextChildren","a11yEnhance","log","style","_sstyled","insert","optionsA11yEnhance","onNeighborChange","neighborElement","props","focus","behavior","click","childSelector","RootPills","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","value","e","handlers","event","key","preventDefault","startIndex","type","selectable","itemValues","element","itemRefs","disabled","undefined","_createClass","componentDidMount","warn","asProps","uncontrolledProps","getItemProps","index","_this$asProps","size","isSelected","selected","tabIndex","onClick","bindHandlerClick","onKeyDown","bindHandleKeyDown","render","_ref","_ref5","SPills","_this$asProps2","Children","styles","controlsLength","createElement","cn","_objectSpread","_assignProps","_ref9","defaultValue","Pill","_ref2","arguments[0]","_ref6","SPill","addonLeft","addonRight","neighborLocation","roleAreaProps","role","_assignProps2","Pills","Item","Addon","tag","Text","_ref3","_ref7","SText","_assignProps3","_ref4","_ref8","SAddon","_assignProps4","wrapPills","wrapper"],"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 addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport a11yEnhance from '@semcore/core/lib/utils/enhances/a11yEnhance';\nimport log from '@semcore/core/lib/utils/logger';\n\nimport style from './style/pills.shadow.css';\n\nconst optionsA11yEnhance = {\n onNeighborChange: (neighborElement, props) => {\n if (neighborElement) {\n neighborElement.focus();\n if (props.behavior === 'auto' || props.behavior === 'radio') {\n neighborElement.click();\n }\n }\n },\n childSelector: (props) =>\n props.behavior === 'auto' || props.behavior === 'radio' ? ['role', 'radio'] : ['role', 'tab'],\n};\n\nclass RootPills extends Component {\n static displayName = 'Pills';\n static style = style;\n static defaultProps = ({ behavior }) => ({\n size: 'm',\n defaultValue: null,\n behavior: behavior ?? 'auto',\n });\n itemValues = [];\n static enhance = [a11yEnhance(optionsA11yEnhance)];\n\n componentDidMount() {\n log.warn(\n this.asProps.behavior === 'tabs',\n 'Use behavior `manual` instead of `tabs`. \\n`tabs` is deprecated and will be removed in the next major release.',\n 'Pills',\n );\n\n log.warn(\n this.asProps.behavior === 'radio',\n 'Use behavior `auto` (or nothing, it is default value) instead of `radio`. \\n`radio` is deprecated and will be removed in the next major release.',\n 'Pills',\n );\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 bindHandleKeyDown = (value) => (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.handlers.value(value, event);\n }\n };\n\n getItemProps(props, index) {\n const { value, size, disabled, behavior } = this.asProps;\n const isSelected = value === props.value;\n\n this.itemValues[index] = props.value;\n return {\n index: index,\n size,\n disabled,\n selected: isSelected,\n behavior,\n tabIndex: isSelected ? 0 : -1,\n onClick: this.bindHandlerClick(props.value),\n onKeyDown: this.bindHandleKeyDown(props.value),\n };\n }\n\n changeIndex = (startIndex, type) => {\n let selectable = false;\n\n while (!selectable && startIndex >= 0 && startIndex < this.itemValues.length) {\n if (type === 'increment') startIndex++;\n if (type === 'decrement') startIndex--;\n\n const element = this.itemRefs[startIndex];\n\n if (element?.disabled === false) {\n selectable = true;\n }\n }\n\n return startIndex >= 0 && startIndex < this.itemValues.length ? startIndex : undefined;\n };\n\n render() {\n const SPills = Root;\n const { Children, styles, controlsLength, disabled, behavior, value } = this.asProps;\n\n return sstyled(styles)(\n <SPills\n render={Box}\n role={behavior === 'radio' || behavior === 'auto' ? 'radiogroup' : 'tablist'}\n aria-disabled={disabled}\n use:tabIndex={value !== null ? -1 : 0}\n >\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, behavior } = props;\n const neighborLocation = useNeighborLocationDetect(index);\n const roleAreaProps = {};\n if (behavior === 'radio' || behavior === 'auto') {\n roleAreaProps.role = 'radio';\n roleAreaProps['aria-checked'] = selected;\n } else {\n roleAreaProps.role = 'tab';\n roleAreaProps['aria-selected'] = selected;\n }\n return sstyled(styles)(\n <SPill\n render={Box}\n tag='button'\n type='button'\n tabIndex={0}\n neighborLocation={neighborLocation}\n aria-disabled={disabled}\n {...roleAreaProps}\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\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 const wrapPills = (wrapper) => wrapper;\n\nexport default Pills;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,gBAAgB,IAAIC,yBAAyB,QAAQ,4BAA4B;AACxF,OAAOC,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,WAAW,MAAM,8CAA8C;AACtE,OAAOC,GAAG,MAAM,gCAAgC;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EA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"sourcesContent":["import React from 'react';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';\nimport { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type PillsValue = string | number | boolean | null;\n\n/** @deprecated */\nexport interface IPillsProps<T extends PillsValue = PillsValue>\n extends PillsProps<T>,\n UnknownProperties {}\nexport type PillsProps<T extends PillsValue = PillsValue> = NeighborLocationProps &\n KeyboardFocusProps &\n BoxProps & {\n /** Pills size */\n size?: 'l' | 'm';\n /** Disabled state */\n disabled?: boolean;\n /** Called when the selection is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLSpanElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Value for the selected pill */\n value?: T;\n /** Default value for the selected pill */\n defaultValue?: T;\n /** Sets semantic role for corresponding behavior,\n * when set to `auto` pressing left and right arrows\n * selects corresponding sibling pill.\n *\n * It's recommended to use `auto` behavior in forms\n * while `manual` behavior for navigation and layout.\n * @default tabs\n */\n behavior?: /** @deprecated use `manual` */\n | 'tabs'\n /** @deprecated use `auto` */\n | 'radio'\n | 'auto'\n | 'manual';\n };\n\n/** @deprecated */\nexport interface IPillProps extends PillProps, UnknownProperties {}\nexport type PillProps = BoxProps &\n NeighborItemProps &\n KeyboardFocusProps & {\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\n/** @deprecated */\nexport interface IPillsContext extends PillsContext, UnknownProperties {}\nexport type PillsContext = {\n getItemProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IPillsHandlers extends PillsHandlers, UnknownProperties {}\nexport type PillsHandlers = {\n value: (value: PillsValue) => void;\n};\n\ntype IntergalacticPillsComponent<PropsExtending = {}> = (<\n Value extends PillsValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n PillsProps<Value>,\n PillsContext,\n [handlers: PillsHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', PillsProps>;\n\ndeclare const Pills: IntergalacticPillsComponent & {\n Item: Intergalactic.Component<'button', PillProps, [handlers: PillsHandlers]> & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\ndeclare const wrapPills: <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticPillsComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => IntergalacticPillsComponent<PropsExtending>;\nexport { wrapPills };\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 { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';\nimport { KeyboardFocusProps } from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';\n\nexport type PillsValue = string | number | boolean | null;\n\n/** @deprecated */\nexport interface IPillsProps<T extends PillsValue = PillsValue>\n extends PillsProps<T>,\n UnknownProperties {}\nexport type PillsProps<T extends PillsValue = PillsValue> = NeighborLocationProps &\n KeyboardFocusProps &\n BoxProps & {\n /** Pills size */\n size?: 'l' | 'm';\n /** Disabled state */\n disabled?: boolean;\n /** Called when the selection is changed */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLSpanElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Value for the selected pill */\n value?: T;\n /** Default value for the selected pill */\n defaultValue?: T;\n /** Sets semantic role for corresponding behavior,\n * when set to `auto` pressing left and right arrows\n * selects corresponding sibling pill.\n *\n * It's recommended to use `auto` behavior in forms\n * while `manual` behavior for navigation and layout.\n * @default tabs\n */\n behavior?: /** @deprecated use `manual` */\n | 'tabs'\n /** @deprecated use `auto` */\n | 'radio'\n | 'auto'\n | 'manual';\n };\n\n/** @deprecated */\nexport interface IPillProps extends PillProps, UnknownProperties {}\nexport type PillProps = BoxProps &\n NeighborItemProps &\n KeyboardFocusProps & {\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\n/** @deprecated */\nexport interface IPillsContext extends PillsContext, UnknownProperties {}\nexport type PillsContext = {\n getItemProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IPillsHandlers extends PillsHandlers, UnknownProperties {}\nexport type PillsHandlers = {\n value: (value: PillsValue) => void;\n};\n\ntype IntergalacticPillsComponent<PropsExtending = {}> = (<\n Value extends PillsValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n PillsProps<Value>,\n PillsContext,\n [handlers: PillsHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', PillsProps>;\n\ndeclare const Pills: IntergalacticPillsComponent & {\n Item: Intergalactic.Component<'button', PillProps, [handlers: PillsHandlers]> & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\ndeclare const wrapPills: <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticPillsComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => IntergalacticPillsComponent<PropsExtending>;\nexport { wrapPills };\n\nexport default Pills;\n"],"mappings":""}
@@ -3,12 +3,7 @@ SPills {
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  isolation: isolate;
6
- outline: none;
7
- }
8
-
9
- SPills[keyboardFocused]:focus {
10
- box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));
11
- z-index: 1;
6
+ border-radius: var(--intergalactic-control-rounded, 6px);
12
7
  }
13
8
 
14
9
  SPill {
@@ -27,7 +22,6 @@ SPill {
27
22
  text-decoration: none;
28
23
  -webkit-tap-highlight-color: transparent;
29
24
  overflow: visible;
30
- outline: 0;
31
25
  text-align: center;
32
26
  vertical-align: middle;
33
27
  font-family: inherit;
@@ -42,8 +36,7 @@ SPill {
42
36
  }
43
37
 
44
38
  &:active,
45
- &:hover,
46
- &:focus {
39
+ &:hover {
47
40
  outline: 0;
48
41
  text-decoration: none;
49
42
  }
@@ -56,6 +49,8 @@ SPill {
56
49
  SPill[selected] {
57
50
  background: var(--intergalactic-control-secondary-info, rgba(0, 143, 248, 0.1));
58
51
  border-color: var(--intergalactic-border-info-active, #006dca);
52
+ }
53
+ SPill:focus-visible, SPill:hover, SPill:active {
59
54
  z-index: 1;
60
55
  }
61
56
 
@@ -69,11 +64,6 @@ SPill[disabled] {
69
64
  }
70
65
  }
71
66
 
72
- SPill[keyboardFocused] {
73
- box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));
74
- z-index: 1;
75
- }
76
-
77
67
  SText {
78
68
  color: var(--intergalactic-text-primary, #191b23);
79
69
  display: inline-flex;
package/lib/esm/Pills.mjs CHANGED
@@ -1,63 +1,60 @@
1
- import f from "@babel/runtime/helpers/esm/objectSpread2";
2
- import k from "@babel/runtime/helpers/esm/classCallCheck";
1
+ import u from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import z from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import w from "@babel/runtime/helpers/esm/createClass";
4
- import v from "@babel/runtime/helpers/esm/assertThisInitialized";
4
+ import p from "@babel/runtime/helpers/esm/assertThisInitialized";
5
5
  import L from "@babel/runtime/helpers/esm/inherits";
6
6
  import A from "@babel/runtime/helpers/esm/createSuper";
7
7
  import d from "@babel/runtime/helpers/esm/defineProperty";
8
- import { sstyled as C } from "@semcore/utils/lib/core/index";
9
- import T, { sstyled as j, assignProps as x, Component as E } from "@semcore/core";
8
+ import { sstyled as f, createComponent as k, assignProps as P, Component as C } from "@semcore/core";
10
9
  import s from "react";
11
- import { Box as P } from "@semcore/flex-box";
12
- import D, { useNeighborLocationDetect as N } from "@semcore/neighbor-location";
13
- import y from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
14
- import R from "@semcore/utils/lib/addonTextChildren";
15
- import F from "@semcore/utils/lib/enhances/a11yEnhance";
16
- import S from "@semcore/utils/lib/logger";
17
- var V = (
10
+ import { Box as S } from "@semcore/flex-box";
11
+ import T, { useNeighborLocationDetect as E } from "@semcore/neighbor-location";
12
+ import D from "@semcore/core/lib/utils/addonTextChildren";
13
+ import N from "@semcore/core/lib/utils/enhances/a11yEnhance";
14
+ import y from "@semcore/core/lib/utils/logger";
15
+ var R = (
18
16
  /*__reshadow_css_start__*/
19
- (C.insert(
17
+ (f.insert(
20
18
  /*__inner_css_start__*/
21
- ".___SPills_15aj4_gg_{display:inline-flex;align-items:center;justify-content:center;isolation:isolate;outline:0}.___SPills_15aj4_gg_.__keyboardFocused_15aj4_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1}.___SPill_15aj4_gg_{display:inline-flex;align-items:center;justify-content:center;line-height:normal;position:relative;touch-action:manipulation;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;overflow:visible;outline:0;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid var(--intergalactic-border-primary, #c4c7cf);border-radius:var(--intergalactic-control-rounded, 6px)}.___SPill_15aj4_gg_::-moz-focus-inner{border:0;padding:0}.___SPill_15aj4_gg_:active,.___SPill_15aj4_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPill_15aj4_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none;background:var(--intergalactic-bg-primary-neutral-hover, #f4f5f9)}}.___SPill_15aj4_gg_.__selected_15aj4_gg_{background:var(--intergalactic-control-secondary-info, rgba(0, 143, 248, 0.1));border-color:var(--intergalactic-border-info-active, #006dca);z-index:1}.___SPill_15aj4_gg_.__disabled_15aj4_gg_{cursor:default;pointer-events:none}.___SPill_15aj4_gg_.__disabled_15aj4_gg_>*{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SPill_15aj4_gg_.__keyboardFocused_15aj4_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1}.___SText_15aj4_gg_{color:var(--intergalactic-text-primary, #191b23);display:inline-flex}.___SAddon_15aj4_gg_{color:var(--intergalactic-text-secondary, #6c6e79);display:inline-flex;align-items:center;justify-content:center}.___SPill_15aj4_gg_._size_m_15aj4_gg_{height:var(--intergalactic-form-control-m, 28px);min-width:var(--intergalactic-form-control-m, 28px);font-size:var(--intergalactic-fs-200, 14px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SText_15aj4_gg_,.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SText_15aj4_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_m_15aj4_gg_ .___SAddon_15aj4_gg_:only-child{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_{height:var(--intergalactic-form-control-l, 40px);min-width:var(--intergalactic-form-control-l, 40px);font-size:var(--intergalactic-fs-300, 16px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:only-child,.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SText_15aj4_gg_:only-child{margin-left:var(--intergalactic-spacing-3x, 12px);margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._size_l_15aj4_gg_ .___SAddon_15aj4_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_15aj4_gg_._neighborLocation_right_15aj4_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SPill_15aj4_gg_._neighborLocation_both_15aj4_gg_{border-radius:0;margin-left:-1px}.___SPill_15aj4_gg_._neighborLocation_left_15aj4_gg_{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}",
22
- "15aj4_gg_"
19
+ ".___SPill_1m0ra_gg_,.___SPills_1m0ra_gg_{display:inline-flex;align-items:center;justify-content:center;border-radius:var(--intergalactic-control-rounded, 6px)}.___SPills_1m0ra_gg_{isolation:isolate}.___SPill_1m0ra_gg_{line-height:normal;position:relative;touch-action:manipulation;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;overflow:visible;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer;background:var(--intergalactic-bg-primary-neutral, #ffffff);border:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SPill_1m0ra_gg_::-moz-focus-inner{border:0;padding:0}.___SPill_1m0ra_gg_:active{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPill_1m0ra_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none;background:var(--intergalactic-bg-primary-neutral-hover, #f4f5f9)}}.___SPill_1m0ra_gg_.__selected_1m0ra_gg_{background:var(--intergalactic-control-secondary-info, rgba(0, 143, 248, 0.1));border-color:var(--intergalactic-border-info-active, #006dca)}.___SPill_1m0ra_gg_:active,.___SPill_1m0ra_gg_:focus-visible{z-index:1}@media (hover:hover){.___SPill_1m0ra_gg_:hover{z-index:1}}.___SPill_1m0ra_gg_.__disabled_1m0ra_gg_{cursor:default;pointer-events:none}.___SPill_1m0ra_gg_.__disabled_1m0ra_gg_>*{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SText_1m0ra_gg_{color:var(--intergalactic-text-primary, #191b23);display:inline-flex}.___SAddon_1m0ra_gg_{color:var(--intergalactic-text-secondary, #6c6e79);display:inline-flex;align-items:center;justify-content:center}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_{height:var(--intergalactic-form-control-m, 28px);min-width:var(--intergalactic-form-control-m, 28px);font-size:var(--intergalactic-fs-200, 14px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SText_1m0ra_gg_,.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SText_1m0ra_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_m_1m0ra_gg_ .___SAddon_1m0ra_gg_:only-child{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_{height:var(--intergalactic-form-control-l, 40px);min-width:var(--intergalactic-form-control-l, 40px);font-size:var(--intergalactic-fs-300, 16px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:only-child,.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SText_1m0ra_gg_:only-child{margin-left:var(--intergalactic-spacing-3x, 12px);margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._size_l_1m0ra_gg_ .___SAddon_1m0ra_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_1m0ra_gg_._neighborLocation_right_1m0ra_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SPill_1m0ra_gg_._neighborLocation_both_1m0ra_gg_{border-radius:0;margin-left:-1px}.___SPill_1m0ra_gg_._neighborLocation_left_1m0ra_gg_{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}",
20
+ "1m0ra_gg_"
23
21
  ), {
24
- __SPills: "___SPills_15aj4_gg_",
25
- _keyboardFocused: "__keyboardFocused_15aj4_gg_",
26
- __SPill: "___SPill_15aj4_gg_",
27
- _selected: "__selected_15aj4_gg_",
28
- __SText: "___SText_15aj4_gg_",
29
- __SAddon: "___SAddon_15aj4_gg_",
30
- _neighborLocation_right: "_neighborLocation_right_15aj4_gg_",
31
- _neighborLocation_both: "_neighborLocation_both_15aj4_gg_",
32
- _neighborLocation_left: "_neighborLocation_left_15aj4_gg_",
33
- _disabled: "__disabled_15aj4_gg_",
34
- _size_m: "_size_m_15aj4_gg_",
35
- _size_l: "_size_l_15aj4_gg_"
22
+ __SPills: "___SPills_1m0ra_gg_",
23
+ __SPill: "___SPill_1m0ra_gg_",
24
+ _selected: "__selected_1m0ra_gg_",
25
+ __SText: "___SText_1m0ra_gg_",
26
+ __SAddon: "___SAddon_1m0ra_gg_",
27
+ _neighborLocation_right: "_neighborLocation_right_1m0ra_gg_",
28
+ _neighborLocation_both: "_neighborLocation_both_1m0ra_gg_",
29
+ _neighborLocation_left: "_neighborLocation_left_1m0ra_gg_",
30
+ _disabled: "__disabled_1m0ra_gg_",
31
+ _size_m: "_size_m_1m0ra_gg_",
32
+ _size_l: "_size_l_1m0ra_gg_"
36
33
  })
37
- ), H = {
38
- onNeighborChange: function(a, r) {
39
- a && (a.focus(), (r.behavior === "auto" || r.behavior === "radio") && a.click());
34
+ ), j = {
35
+ onNeighborChange: function(r, _) {
36
+ r && (r.focus(), (_.behavior === "auto" || _.behavior === "radio") && r.click());
40
37
  },
41
- childSelector: function(a) {
42
- return a.behavior === "auto" || a.behavior === "radio" ? ["role", "radio"] : ["role", "tab"];
38
+ childSelector: function(r) {
39
+ return r.behavior === "auto" || r.behavior === "radio" ? ["role", "radio"] : ["role", "tab"];
43
40
  }
44
- }, m = /* @__PURE__ */ function(_) {
45
- L(r, _);
46
- var a = A(r);
47
- function r() {
41
+ }, v = /* @__PURE__ */ function(a) {
42
+ L(_, a);
43
+ var r = A(_);
44
+ function _() {
48
45
  var i;
49
- k(this, r);
46
+ z(this, _);
50
47
  for (var l = arguments.length, o = new Array(l), n = 0; n < l; n++)
51
48
  o[n] = arguments[n];
52
- return i = a.call.apply(a, [this].concat(o)), d(v(i), "itemValues", []), d(v(i), "bindHandlerClick", function(e) {
49
+ return i = r.call.apply(r, [this].concat(o)), d(p(i), "itemValues", []), d(p(i), "bindHandlerClick", function(e) {
53
50
  return function(t) {
54
51
  i.handlers.value(e, t);
55
52
  };
56
- }), d(v(i), "bindHandleKeyDown", function(e) {
53
+ }), d(p(i), "bindHandleKeyDown", function(e) {
57
54
  return function(t) {
58
55
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), i.handlers.value(e, t));
59
56
  };
60
- }), d(v(i), "changeIndex", function(e, t) {
57
+ }), d(p(i), "changeIndex", function(e, t) {
61
58
  for (var c = !1; !c && e >= 0 && e < i.itemValues.length; ) {
62
59
  t === "increment" && e++, t === "decrement" && e--;
63
60
  var g = i.itemRefs[e];
@@ -66,10 +63,10 @@ var V = (
66
63
  return e >= 0 && e < i.itemValues.length ? e : void 0;
67
64
  }), i;
68
65
  }
69
- return w(r, [{
66
+ return w(_, [{
70
67
  key: "componentDidMount",
71
68
  value: function() {
72
- S.warn(this.asProps.behavior === "tabs", "Use behavior `manual` instead of `tabs`. \n`tabs` is deprecated and will be removed in the next major release.", "Pills"), S.warn(this.asProps.behavior === "radio", "Use behavior `auto` (or nothing, it is default value) instead of `radio`. \n`radio` is deprecated and will be removed in the next major release.", "Pills");
69
+ y.warn(this.asProps.behavior === "tabs", "Use behavior `manual` instead of `tabs`. \n`tabs` is deprecated and will be removed in the next major release.", "Pills"), y.warn(this.asProps.behavior === "radio", "Use behavior `auto` (or nothing, it is default value) instead of `radio`. \n`radio` is deprecated and will be removed in the next major release.", "Pills");
73
70
  }
74
71
  }, {
75
72
  key: "uncontrolledProps",
@@ -81,14 +78,14 @@ var V = (
81
78
  }, {
82
79
  key: "getItemProps",
83
80
  value: function(l, o) {
84
- var n = this.asProps, e = n.value, t = n.size, c = n.disabled, g = n.behavior, u = e === l.value;
81
+ var n = this.asProps, e = n.value, t = n.size, c = n.disabled, g = n.behavior, m = e === l.value;
85
82
  return this.itemValues[o] = l.value, {
86
83
  index: o,
87
84
  size: t,
88
85
  disabled: c,
89
- selected: u,
86
+ selected: m,
90
87
  behavior: g,
91
- tabIndex: u ? 0 : -1,
88
+ tabIndex: m ? 0 : -1,
92
89
  onClick: this.bindHandlerClick(l.value),
93
90
  onKeyDown: this.bindHandleKeyDown(l.value)
94
91
  };
@@ -96,63 +93,63 @@ var V = (
96
93
  }, {
97
94
  key: "render",
98
95
  value: function() {
99
- var l = this.asProps, o, n = P, e = this.asProps, t = e.Children, c = e.styles, g = e.controlsLength, u = e.disabled, b = e.behavior, h = e.value;
100
- return o = j(c), /* @__PURE__ */ s.createElement(n, o.cn("SPills", f({}, x({
96
+ var l = this.asProps, o, n = S, e = this.asProps, t = e.Children, c = e.styles, g = e.controlsLength, m = e.disabled, b = e.behavior, h = e.value;
97
+ return o = f(c), /* @__PURE__ */ s.createElement(n, o.cn("SPills", u({}, P({
101
98
  role: b === "radio" || b === "auto" ? "radiogroup" : "tablist",
102
- "aria-disabled": u,
99
+ "aria-disabled": m,
103
100
  "use:tabIndex": h !== null ? -1 : 0
104
- }, l))), /* @__PURE__ */ s.createElement(D, o.cn("NeighborLocation", {
101
+ }, l))), /* @__PURE__ */ s.createElement(T, o.cn("NeighborLocation", {
105
102
  controlsLength: g
106
103
  }), /* @__PURE__ */ s.createElement(t, o.cn("Children", {}))));
107
104
  }
108
- }]), r;
109
- }(E);
110
- d(m, "displayName", "Pills");
111
- d(m, "style", V);
112
- d(m, "defaultProps", function(_) {
113
- var a = _.behavior;
105
+ }]), _;
106
+ }(C);
107
+ d(v, "displayName", "Pills");
108
+ d(v, "style", R);
109
+ d(v, "defaultProps", function(a) {
110
+ var r = a.behavior;
114
111
  return {
115
112
  size: "m",
116
113
  defaultValue: null,
117
- behavior: a ?? "auto"
114
+ behavior: r ?? "auto"
118
115
  };
119
116
  });
120
- d(m, "enhance", [F(H), y()]);
121
- function z(_) {
122
- var a = arguments[0], r, i = P, l = _.Children, o = _.styles, n = _.addonLeft, e = _.addonRight, t = _.selected, c = _.disabled, g = _.index, u = _.behavior, b = N(g), h = {};
123
- return u === "radio" || u === "auto" ? (h.role = "radio", h["aria-checked"] = t) : (h.role = "tab", h["aria-selected"] = t), r = j(o), /* @__PURE__ */ s.createElement(i, r.cn("SPill", f({}, x(f({
117
+ d(v, "enhance", [N(j)]);
118
+ function I(a) {
119
+ var r = arguments[0], _, i = S, l = a.Children, o = a.styles, n = a.addonLeft, e = a.addonRight, t = a.selected, c = a.disabled, g = a.index, m = a.behavior, b = E(g), h = {};
120
+ return m === "radio" || m === "auto" ? (h.role = "radio", h["aria-checked"] = t) : (h.role = "tab", h["aria-selected"] = t), _ = f(o), /* @__PURE__ */ s.createElement(i, _.cn("SPill", u({}, P(u({
124
121
  tag: "button",
125
122
  type: "button",
123
+ tabIndex: 0,
126
124
  neighborLocation: b,
127
125
  "aria-disabled": c
128
- }, h), a))), n ? /* @__PURE__ */ s.createElement(p.Item.Addon, {
126
+ }, h), r))), n ? /* @__PURE__ */ s.createElement(x.Item.Addon, {
129
127
  tag: n
130
- }) : null, R(l, p.Item.Text, p.Item.Addon), e ? /* @__PURE__ */ s.createElement(p.Item.Addon, {
128
+ }) : null, D(l, x.Item.Text, x.Item.Addon), e ? /* @__PURE__ */ s.createElement(x.Item.Addon, {
131
129
  tag: e
132
130
  }) : null);
133
131
  }
134
- z.enhance = [y()];
135
- function I(_) {
136
- var a = arguments[0], r, i = P;
137
- return r = j(_.styles), /* @__PURE__ */ s.createElement(i, r.cn("SText", f({}, x({
132
+ function V(a) {
133
+ var r = arguments[0], _, i = S;
134
+ return _ = f(a.styles), /* @__PURE__ */ s.createElement(i, _.cn("SText", u({}, P({
138
135
  tag: "span"
139
- }, a))));
136
+ }, r))));
140
137
  }
141
- function K(_) {
142
- var a = arguments[0], r, i = P;
143
- return r = j(_.styles), /* @__PURE__ */ s.createElement(i, r.cn("SAddon", f({}, x({
138
+ function H(a) {
139
+ var r = arguments[0], _, i = S;
140
+ return _ = f(a.styles), /* @__PURE__ */ s.createElement(i, _.cn("SAddon", u({}, P({
144
141
  tag: "span"
145
- }, a))));
142
+ }, r))));
146
143
  }
147
- var p = T(m, {
148
- Item: [z, {
149
- Text: I,
150
- Addon: K
144
+ var x = k(v, {
145
+ Item: [I, {
146
+ Text: V,
147
+ Addon: H
151
148
  }]
152
- }), _e = function(a) {
153
- return a;
149
+ }), Z = function(r) {
150
+ return r;
154
151
  };
155
152
  export {
156
- p as default,
157
- _e as wrapPills
153
+ x as default,
154
+ Z as wrapPills
158
155
  };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
3
3
  import { Box, BoxProps } from '@semcore/flex-box';
4
4
  import { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';
5
- import { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
5
+ import { KeyboardFocusProps } from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';
6
6
 
7
7
  export type PillsValue = string | number | boolean | null;
8
8
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/pills",
3
3
  "description": "Semrush Pills Component",
4
- "version": "5.43.1",
4
+ "version": "16.0.0-prerelease.2",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,14 +14,11 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/flex-box": "5.41.1",
18
- "@semcore/neighbor-location": "4.40.1",
19
- "@semcore/utils": "4.48.1"
17
+ "@semcore/flex-box": "16.0.0-prerelease.2",
18
+ "@semcore/neighbor-location": "16.0.0-prerelease.2"
20
19
  },
21
20
  "peerDependencies": {
22
- "@semcore/core": "^2.17.5",
23
- "react": "16.8 - 18",
24
- "react-dom": "16.8 - 18"
21
+ "@semcore/base-components": "^16.0.0-prerelease.2"
25
22
  },
26
23
  "repository": {
27
24
  "type": "git",