@semcore/pills 5.43.1 → 16.0.0-prerelease.10

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,158 +1,195 @@
1
- import f from "@babel/runtime/helpers/esm/objectSpread2";
2
- import k from "@babel/runtime/helpers/esm/classCallCheck";
3
- import w from "@babel/runtime/helpers/esm/createClass";
4
- import v from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import L from "@babel/runtime/helpers/esm/inherits";
6
- import A from "@babel/runtime/helpers/esm/createSuper";
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";
10
- 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 = (
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
+ import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
9
+ import React from "react";
10
+ import { Box } from "@semcore/flex-box";
11
+ import NeighborLocation, { useNeighborLocationDetect } from "@semcore/neighbor-location";
12
+ import addonTextChildren from "@semcore/core/lib/utils/addonTextChildren";
13
+ import a11yEnhance from "@semcore/core/lib/utils/enhances/a11yEnhance";
14
+ import log from "@semcore/core/lib/utils/logger";
15
+ var style = (
18
16
  /*__reshadow_css_start__*/
19
- (C.insert(
17
+ (sstyled.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
+ );
35
+ var optionsA11yEnhance = {
36
+ onNeighborChange: function onNeighborChange(neighborElement, props) {
37
+ if (neighborElement) {
38
+ neighborElement.focus();
39
+ if (props.behavior === "auto" || props.behavior === "radio") {
40
+ neighborElement.click();
41
+ }
42
+ }
40
43
  },
41
- childSelector: function(a) {
42
- return a.behavior === "auto" || a.behavior === "radio" ? ["role", "radio"] : ["role", "tab"];
44
+ childSelector: function childSelector(props) {
45
+ return props.behavior === "auto" || props.behavior === "radio" ? ["role", "radio"] : ["role", "tab"];
43
46
  }
44
- }, m = /* @__PURE__ */ function(_) {
45
- L(r, _);
46
- var a = A(r);
47
- function r() {
48
- var i;
49
- k(this, r);
50
- for (var l = arguments.length, o = new Array(l), n = 0; n < l; n++)
51
- o[n] = arguments[n];
52
- return i = a.call.apply(a, [this].concat(o)), d(v(i), "itemValues", []), d(v(i), "bindHandlerClick", function(e) {
53
- return function(t) {
54
- i.handlers.value(e, t);
47
+ };
48
+ var RootPills = /* @__PURE__ */ function(_Component) {
49
+ _inherits(RootPills2, _Component);
50
+ var _super = _createSuper(RootPills2);
51
+ function RootPills2() {
52
+ var _this;
53
+ _classCallCheck(this, RootPills2);
54
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
55
+ args[_key] = arguments[_key];
56
+ }
57
+ _this = _super.call.apply(_super, [this].concat(args));
58
+ _defineProperty(_assertThisInitialized(_this), "itemValues", []);
59
+ _defineProperty(_assertThisInitialized(_this), "bindHandlerClick", function(value) {
60
+ return function(e) {
61
+ _this.handlers.value(value, e);
55
62
  };
56
- }), d(v(i), "bindHandleKeyDown", function(e) {
57
- return function(t) {
58
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), i.handlers.value(e, t));
63
+ });
64
+ _defineProperty(_assertThisInitialized(_this), "bindHandleKeyDown", function(value) {
65
+ return function(event) {
66
+ if (event.key === "Enter" || event.key === " ") {
67
+ event.preventDefault();
68
+ _this.handlers.value(value, event);
69
+ }
59
70
  };
60
- }), d(v(i), "changeIndex", function(e, t) {
61
- for (var c = !1; !c && e >= 0 && e < i.itemValues.length; ) {
62
- t === "increment" && e++, t === "decrement" && e--;
63
- var g = i.itemRefs[e];
64
- (g == null ? void 0 : g.disabled) === !1 && (c = !0);
71
+ });
72
+ _defineProperty(_assertThisInitialized(_this), "changeIndex", function(startIndex, type) {
73
+ var selectable = false;
74
+ while (!selectable && startIndex >= 0 && startIndex < _this.itemValues.length) {
75
+ if (type === "increment") startIndex++;
76
+ if (type === "decrement") startIndex--;
77
+ var element = _this.itemRefs[startIndex];
78
+ if ((element === null || element === void 0 ? void 0 : element.disabled) === false) {
79
+ selectable = true;
80
+ }
65
81
  }
66
- return e >= 0 && e < i.itemValues.length ? e : void 0;
67
- }), i;
82
+ return startIndex >= 0 && startIndex < _this.itemValues.length ? startIndex : void 0;
83
+ });
84
+ return _this;
68
85
  }
69
- return w(r, [{
86
+ _createClass(RootPills2, [{
70
87
  key: "componentDidMount",
71
- 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");
88
+ value: function componentDidMount() {
89
+ log.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");
90
+ log.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
91
  }
74
92
  }, {
75
93
  key: "uncontrolledProps",
76
- value: function() {
94
+ value: function uncontrolledProps() {
77
95
  return {
78
96
  value: null
79
97
  };
80
98
  }
81
99
  }, {
82
100
  key: "getItemProps",
83
- 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;
85
- return this.itemValues[o] = l.value, {
86
- index: o,
87
- size: t,
88
- disabled: c,
89
- selected: u,
90
- behavior: g,
91
- tabIndex: u ? 0 : -1,
92
- onClick: this.bindHandlerClick(l.value),
93
- onKeyDown: this.bindHandleKeyDown(l.value)
101
+ value: function getItemProps(props, index) {
102
+ var _this$asProps = this.asProps, value = _this$asProps.value, size = _this$asProps.size, disabled = _this$asProps.disabled, behavior = _this$asProps.behavior;
103
+ var isSelected = value === props.value;
104
+ this.itemValues[index] = props.value;
105
+ return {
106
+ index,
107
+ size,
108
+ disabled,
109
+ selected: isSelected,
110
+ behavior,
111
+ tabIndex: isSelected ? 0 : -1,
112
+ onClick: this.bindHandlerClick(props.value),
113
+ onKeyDown: this.bindHandleKeyDown(props.value)
94
114
  };
95
115
  }
96
116
  }, {
97
117
  key: "render",
98
- 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({
101
- role: b === "radio" || b === "auto" ? "radiogroup" : "tablist",
102
- "aria-disabled": u,
103
- "use:tabIndex": h !== null ? -1 : 0
104
- }, l))), /* @__PURE__ */ s.createElement(D, o.cn("NeighborLocation", {
105
- controlsLength: g
106
- }), /* @__PURE__ */ s.createElement(t, o.cn("Children", {}))));
118
+ value: function render() {
119
+ var _ref = this.asProps, _ref5;
120
+ var SPills = Box;
121
+ var _this$asProps2 = this.asProps, Children = _this$asProps2.Children, styles = _this$asProps2.styles, controlsLength = _this$asProps2.controlsLength, disabled = _this$asProps2.disabled, behavior = _this$asProps2.behavior, value = _this$asProps2.value;
122
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SPills, _ref5.cn("SPills", _objectSpread({}, assignProps({
123
+ "role": behavior === "radio" || behavior === "auto" ? "radiogroup" : "tablist",
124
+ "aria-disabled": disabled,
125
+ "use:tabIndex": value !== null ? -1 : 0
126
+ }, _ref))), /* @__PURE__ */ React.createElement(NeighborLocation, _ref5.cn("NeighborLocation", {
127
+ "controlsLength": controlsLength
128
+ }), /* @__PURE__ */ React.createElement(Children, _ref5.cn("Children", {}))));
107
129
  }
108
- }]), r;
109
- }(E);
110
- d(m, "displayName", "Pills");
111
- d(m, "style", V);
112
- d(m, "defaultProps", function(_) {
113
- var a = _.behavior;
130
+ }]);
131
+ return RootPills2;
132
+ }(Component);
133
+ _defineProperty(RootPills, "displayName", "Pills");
134
+ _defineProperty(RootPills, "style", style);
135
+ _defineProperty(RootPills, "defaultProps", function(_ref9) {
136
+ var behavior = _ref9.behavior;
114
137
  return {
115
138
  size: "m",
116
139
  defaultValue: null,
117
- behavior: a ?? "auto"
140
+ behavior: behavior !== null && behavior !== void 0 ? behavior : "auto"
118
141
  };
119
142
  });
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({
124
- tag: "button",
125
- type: "button",
126
- neighborLocation: b,
127
- "aria-disabled": c
128
- }, h), a))), n ? /* @__PURE__ */ s.createElement(p.Item.Addon, {
129
- tag: n
130
- }) : null, R(l, p.Item.Text, p.Item.Addon), e ? /* @__PURE__ */ s.createElement(p.Item.Addon, {
131
- tag: e
143
+ _defineProperty(RootPills, "enhance", [a11yEnhance(optionsA11yEnhance)]);
144
+ function Pill(props) {
145
+ var _ref2 = arguments[0], _ref6;
146
+ var SPill = Box;
147
+ var Children = props.Children, styles = props.styles, addonLeft = props.addonLeft, addonRight = props.addonRight, selected = props.selected, disabled = props.disabled, index = props.index, behavior = props.behavior;
148
+ var neighborLocation = useNeighborLocationDetect(index);
149
+ var roleAreaProps = {};
150
+ if (behavior === "radio" || behavior === "auto") {
151
+ roleAreaProps.role = "radio";
152
+ roleAreaProps["aria-checked"] = selected;
153
+ } else {
154
+ roleAreaProps.role = "tab";
155
+ roleAreaProps["aria-selected"] = selected;
156
+ }
157
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SPill, _ref6.cn("SPill", _objectSpread({}, assignProps(_objectSpread({
158
+ "tag": "button",
159
+ "type": "button",
160
+ "tabIndex": 0,
161
+ "neighborLocation": neighborLocation,
162
+ "aria-disabled": disabled
163
+ }, roleAreaProps), _ref2))), addonLeft ? /* @__PURE__ */ React.createElement(Pills.Item.Addon, {
164
+ tag: addonLeft
165
+ }) : null, addonTextChildren(Children, Pills.Item.Text, Pills.Item.Addon), addonRight ? /* @__PURE__ */ React.createElement(Pills.Item.Addon, {
166
+ tag: addonRight
132
167
  }) : null);
133
168
  }
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({
138
- tag: "span"
139
- }, a))));
169
+ function Text(props) {
170
+ var _ref3 = arguments[0], _ref7;
171
+ var SText = Box;
172
+ return _ref7 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SText, _ref7.cn("SText", _objectSpread({}, assignProps({
173
+ "tag": "span"
174
+ }, _ref3))));
140
175
  }
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({
144
- tag: "span"
145
- }, a))));
176
+ function Addon(props) {
177
+ var _ref4 = arguments[0], _ref8;
178
+ var SAddon = Box;
179
+ return _ref8 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SAddon, _ref8.cn("SAddon", _objectSpread({}, assignProps({
180
+ "tag": "span"
181
+ }, _ref4))));
146
182
  }
147
- var p = T(m, {
148
- Item: [z, {
149
- Text: I,
150
- Addon: K
183
+ var Pills = createComponent(RootPills, {
184
+ Item: [Pill, {
185
+ Text,
186
+ Addon
151
187
  }]
152
- }), _e = function(a) {
153
- return a;
188
+ });
189
+ var wrapPills = function wrapPills2(wrapper) {
190
+ return wrapper;
154
191
  };
155
192
  export {
156
- p as default,
157
- _e as wrapPills
193
+ Pills as default,
194
+ wrapPills
158
195
  };
package/lib/esm/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { default as a, wrapPills as e } from "./Pills.mjs";
1
+ import { default as default2, wrapPills } from "./Pills.mjs";
2
2
  export {
3
- a as default,
4
- e as wrapPills
3
+ default2 as default,
4
+ wrapPills
5
5
  };
@@ -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.10",
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.10",
18
+ "@semcore/neighbor-location": "16.0.0-prerelease.10"
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.10"
25
22
  },
26
23
  "repository": {
27
24
  "type": "git",