@semcore/tab-line 4.40.4-prerelease.0 → 4.41.0-prerelease.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,71 +1,55 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
+ import _callSuper from "@babel/runtime/helpers/esm/callSuper";
5
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
6
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- import { sstyled } from "@semcore/utils/lib/core/index";
9
- import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
7
+ import { sstyled, assignProps, Component, createComponent } from "@semcore/core";
8
+ import { Box, NeighborLocation } from "@semcore/base-components";
9
+ import addonTextChildren from "@semcore/core/lib/utils/addonTextChildren";
10
+ import a11yEnhance from "@semcore/core/lib/utils/enhances/a11yEnhance";
11
+ import { Text as Text$1 } from "@semcore/typography";
10
12
  import React from "react";
11
- import { Box } from "@semcore/flex-box";
12
- import addonTextChildren from "@semcore/utils/lib/addonTextChildren";
13
- import keyboardFocusEnhance from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
14
- import a11yEnhance from "@semcore/utils/lib/enhances/a11yEnhance";
15
- import NeighborLocation from "@semcore/neighbor-location";
16
13
  /*!__reshadow-styles__:"./style/tab-line.shadow.css"*/
17
14
  var style = (
18
15
  /*__reshadow_css_start__*/
19
16
  (sstyled.insert(
20
17
  /*__inner_css_start__*/
21
- '.___STabLine_6e1u5_gg_{position:relative;display:flex;width:100%;max-width:100%}.___STabLine_6e1u5_gg_.__underlined_6e1u5_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___STabLineItem_6e1u5_gg_{display:inline-flex;align-items:center;justify-content:center;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;border:0;background:0 0;color:var(--intergalactic-text-primary, #191b23);margin-right:var(--intergalactic-spacing-4x, 16px);font-weight:var(--intergalactic-medium, 500)}.___STabLineItem_6e1u5_gg_::-moz-focus-inner{border:0;padding:0}.___STabLineItem_6e1u5_gg_:active,.___STabLineItem_6e1u5_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___STabLineItem_6e1u5_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___STabLineItem_6e1u5_gg_::after,.___STabLineItem_6e1u5_gg_::before{content:"";position:absolute;left:0;bottom:-1px;height:3px;width:100%;background-color:transparent}.___STabLineItem_6e1u5_gg_::before{transition:background-color calc(var(--intergalactic-duration-control, 200)*1ms) ease-in-out}@media (hover:hover){.___STabLineItem_6e1u5_gg_:hover::before{background-color:var(--intergalactic-border-primary, #c4c7cf)}}.___STabLineItem_6e1u5_gg_.__selected_6e1u5_gg_::after{transition-delay:calc(var(--intergalactic-duration-control, 200)*1ms);background-color:var(--intergalactic-border-info-active, #006dca)}.___STabLineItem_6e1u5_gg_ .___SAddon_6e1u5_gg_:not(:last-child),.___STabLineItem_6e1u5_gg_ .___SText_6e1u5_gg_:not(:last-child){margin-right:var(--intergalactic-spacing-2x, 8px)}.___SCaret_6e1u5_gg_{position:absolute;bottom:-1px;height:3px;background-color:var(--intergalactic-border-info-active, #006dca);transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___STabLineItem_6e1u5_gg_.__selected_6e1u5_gg_{flex-shrink:0}.___STabLineItem_6e1u5_gg_.__disabled_6e1u5_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___STabLineItem_6e1u5_gg_.__keyboardFocused_6e1u5_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SText_6e1u5_gg_{display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.___SAddon_6e1u5_gg_{display:inline-flex;align-items:center;justify-content:center}.___STabLineItem_6e1u5_gg_._size_m_6e1u5_gg_{height:28px;min-width:18px}.___STabLineItem_6e1u5_gg_._size_m_6e1u5_gg_ .___SText_6e1u5_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___STabLineItem_6e1u5_gg_._size_l_6e1u5_gg_{height:40px;min-width:26px}.___STabLineItem_6e1u5_gg_._size_l_6e1u5_gg_ .___SText_6e1u5_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___STabLineItem_6e1u5_gg_._neighborLocation_left_6e1u5_gg_{margin-right:0}@media (prefers-reduced-motion){.___STabLineItem_6e1u5_gg_.__selected_6e1u5_gg_::after,.___STabLineItem_6e1u5_gg_::after,.___STabLineItem_6e1u5_gg_::before{transition:none}.___SCaret_6e1u5_gg_{display:none}}',
18
+ '.___STabLine_13cyw_gg_{position:relative;display:flex;width:100%;max-width:100%}.___STabLine_13cyw_gg_.__underlined_13cyw_gg_{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___STabLine_13cyw_gg_.__underlined_13cyw_gg_{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___STabLine_13cyw_gg_.__underlined_13cyw_gg_{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___STabLineItem_13cyw_gg_{display:inline-flex;align-items:center;justify-content:center;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;border:0;background:0 0;color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899));margin-right:var(--intergalactic-spacing-4x, 16px);font-weight:var(--intergalactic-medium, 500)}.___STabLineItem_13cyw_gg_::-moz-focus-inner{border:0;padding:0}.___STabLineItem_13cyw_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___STabLineItem_13cyw_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___STabLineItem_13cyw_gg_::after,.___STabLineItem_13cyw_gg_::before{content:"";position:absolute;left:0;bottom:-1px;height:3px;width:100%;background-color:transparent}.___STabLineItem_13cyw_gg_::before{transition:background-color calc(var(--intergalactic-duration-control, 200)*1ms) ease-in-out}@media (hover:hover){.___STabLineItem_13cyw_gg_:hover::before{background-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___STabLineItem_13cyw_gg_:hover::before{background-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___STabLineItem_13cyw_gg_:hover::before{background-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}}.___STabLineItem_13cyw_gg_.__selected_13cyw_gg_::after{transition-delay:calc(var(--intergalactic-duration-control, 200)*1ms);background-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386))}@supports (color:color(display-p3 0 0 0%)){.___STabLineItem_13cyw_gg_.__selected_13cyw_gg_::after{background-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386))}@media (color-gamut:p3){.___STabLineItem_13cyw_gg_.__selected_13cyw_gg_::after{background-color:var(--intergalactic-border-info-active, color(display-p3 0.01805 0.08334 0.73488 / 0.386))}}}.___STabLineItem_13cyw_gg_ .___SAddon_13cyw_gg_:not(:last-child),.___STabLineItem_13cyw_gg_ .___SText_13cyw_gg_:not(:last-child){margin-right:var(--intergalactic-spacing-2x, 8px)}.___SCaret_13cyw_gg_{position:absolute;bottom:-1px;height:3px;background:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386));transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}@supports (color:color(display-p3 0 0 0%)){.___SCaret_13cyw_gg_{background:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386))}@media (color-gamut:p3){.___SCaret_13cyw_gg_{background:var(--intergalactic-border-info-active, color(display-p3 0.01805 0.08334 0.73488 / 0.386))}}}.___STabLineItem_13cyw_gg_.__selected_13cyw_gg_{flex-shrink:0}.___STabLineItem_13cyw_gg_.__disabled_13cyw_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SAddon_13cyw_gg_{display:inline-flex;align-items:center;justify-content:center}.___STabLineItem_13cyw_gg_._size_m_13cyw_gg_{height:28px;min-width:18px}.___STabLineItem_13cyw_gg_._size_l_13cyw_gg_{height:40px;min-width:26px}.___STabLineItem_13cyw_gg_._neighborLocation_left_13cyw_gg_{margin-right:0}@media (prefers-reduced-motion){.___STabLineItem_13cyw_gg_.__selected_13cyw_gg_::after,.___STabLineItem_13cyw_gg_::after,.___STabLineItem_13cyw_gg_::before{transition:none}.___SCaret_13cyw_gg_{display:none}}',
22
19
  /*__inner_css_end__*/
23
- "6e1u5_gg_"
20
+ "13cyw_gg_"
24
21
  ), /*__reshadow_css_end__*/
25
22
  {
26
- "__STabLine": "___STabLine_6e1u5_gg_",
27
- "_underlined": "__underlined_6e1u5_gg_",
28
- "__SCaret": "___SCaret_6e1u5_gg_",
29
- "__STabLineItem": "___STabLineItem_6e1u5_gg_",
30
- "_selected": "__selected_6e1u5_gg_",
31
- "_disabled": "__disabled_6e1u5_gg_",
32
- "_keyboardFocused": "__keyboardFocused_6e1u5_gg_",
33
- "__SText": "___SText_6e1u5_gg_",
34
- "__SAddon": "___SAddon_6e1u5_gg_",
35
- "_neighborLocation_left": "_neighborLocation_left_6e1u5_gg_",
36
- "_size_m": "_size_m_6e1u5_gg_",
37
- "_size_l": "_size_l_6e1u5_gg_"
23
+ "__STabLine": "___STabLine_13cyw_gg_",
24
+ "_underlined": "__underlined_13cyw_gg_",
25
+ "__SCaret": "___SCaret_13cyw_gg_",
26
+ "__STabLineItem": "___STabLineItem_13cyw_gg_",
27
+ "_selected": "__selected_13cyw_gg_",
28
+ "_disabled": "__disabled_13cyw_gg_",
29
+ "__SAddon": "___SAddon_13cyw_gg_",
30
+ "_size_m": "_size_m_13cyw_gg_",
31
+ "_size_l": "_size_l_13cyw_gg_",
32
+ "_neighborLocation_left": "_neighborLocation_left_13cyw_gg_",
33
+ "__SText": "___SText_13cyw_gg_"
38
34
  })
39
35
  );
40
- var optionsA11yEnhance = {
41
- onNeighborChange: function onNeighborChange(neighborElement, props) {
42
- if (neighborElement) {
43
- neighborElement.focus();
44
- if (props.behavior === "auto") {
45
- neighborElement.click();
46
- }
47
- }
48
- },
49
- childSelector: ["role", "tab"]
50
- };
51
- var TabLineRoot = /* @__PURE__ */ function(_Component) {
52
- _inherits(TabLineRoot2, _Component);
53
- var _super = _createSuper(TabLineRoot2);
36
+ var TabLineRoot = /* @__PURE__ */ (function(_Component) {
54
37
  function TabLineRoot2() {
55
38
  var _this;
56
39
  _classCallCheck(this, TabLineRoot2);
57
40
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
58
41
  args[_key] = arguments[_key];
59
42
  }
60
- _this = _super.call.apply(_super, [this].concat(args));
61
- _defineProperty(_assertThisInitialized(_this), "state", {
43
+ _this = _callSuper(this, TabLineRoot2, [].concat(args));
44
+ _defineProperty(_this, "state", {
62
45
  animation: null
63
46
  });
64
- _defineProperty(_assertThisInitialized(_this), "prevValue", void 0);
65
- _defineProperty(_assertThisInitialized(_this), "itemRefs", {});
66
- _defineProperty(_assertThisInitialized(_this), "containerRef", /* @__PURE__ */ React.createRef());
67
- _defineProperty(_assertThisInitialized(_this), "animationStartTimeout", -1);
68
- _defineProperty(_assertThisInitialized(_this), "handleAnimationStart", function() {
47
+ _defineProperty(_this, "prevValue", void 0);
48
+ _defineProperty(_this, "itemRefs", {});
49
+ _defineProperty(_this, "containerRef", /* @__PURE__ */ React.createRef());
50
+ _defineProperty(_this, "animationStartTimeout", null);
51
+ _defineProperty(_this, "buttonRefsList", []);
52
+ _defineProperty(_this, "handleAnimationStart", function() {
69
53
  var _this$state$animation;
70
54
  if (((_this$state$animation = _this.state.animation) === null || _this$state$animation === void 0 ? void 0 : _this$state$animation.started) === false) {
71
55
  _this.setState({
@@ -75,19 +59,20 @@ var TabLineRoot = /* @__PURE__ */ function(_Component) {
75
59
  });
76
60
  }
77
61
  });
78
- _defineProperty(_assertThisInitialized(_this), "handleAnimationEnd", function() {
62
+ _defineProperty(_this, "handleAnimationEnd", function() {
79
63
  _this.setState({
80
64
  animation: null
81
65
  });
82
66
  });
83
- _defineProperty(_assertThisInitialized(_this), "bindHandlerClick", function(value) {
67
+ _defineProperty(_this, "bindHandlerClick", function(value) {
84
68
  return function(e) {
85
69
  _this.handlers.value(value, e);
86
70
  };
87
71
  });
88
72
  return _this;
89
73
  }
90
- _createClass(TabLineRoot2, [{
74
+ _inherits(TabLineRoot2, _Component);
75
+ return _createClass(TabLineRoot2, [{
91
76
  key: "uncontrolledProps",
92
77
  value: function uncontrolledProps() {
93
78
  return {
@@ -110,13 +95,16 @@ var TabLineRoot = /* @__PURE__ */ function(_Component) {
110
95
  }, {
111
96
  key: "componentWillUnmount",
112
97
  value: function componentWillUnmount() {
113
- clearTimeout(this.animationStartTimeout);
98
+ if (this.animationStartTimeout) {
99
+ clearTimeout(this.animationStartTimeout);
100
+ }
114
101
  }
115
102
  }, {
116
103
  key: "animate",
117
104
  value: function animate() {
118
- var fromNode = this.itemRefs[this.prevValue];
119
- var toNode = this.itemRefs[this.asProps.value];
105
+ if (this.prevValue === void 0 || this.asProps.value === void 0) return;
106
+ var fromNode = this.itemRefs[this.prevValue.toString()];
107
+ var toNode = this.itemRefs[this.asProps.value.toString()];
120
108
  var containerNode = this.containerRef.current;
121
109
  if (!fromNode || !toNode || !containerNode) return;
122
110
  var containerRect = containerNode.getBoundingClientRect();
@@ -132,7 +120,9 @@ var TabLineRoot = /* @__PURE__ */ function(_Component) {
132
120
  this.setState({
133
121
  animation
134
122
  });
135
- clearTimeout(this.animationStartTimeout);
123
+ if (this.animationStartTimeout) {
124
+ clearTimeout(this.animationStartTimeout);
125
+ }
136
126
  this.animationStartTimeout = setTimeout(this.handleAnimationStart, 0);
137
127
  }
138
128
  }, {
@@ -143,13 +133,27 @@ var TabLineRoot = /* @__PURE__ */ function(_Component) {
143
133
  var isSelected = value === props.value;
144
134
  return {
145
135
  size,
146
- selected: isSelected,
147
- onClick: this.bindHandlerClick(props.value),
148
- tabIndex: isSelected ? 0 : -1,
136
+ "selected": isSelected,
137
+ "onClick": this.bindHandlerClick(props.value),
138
+ "tabIndex": isSelected ? 0 : -1,
149
139
  "aria-selected": isSelected,
150
- ref: function ref(node) {
151
- _this2.itemRefs[props.value] = node;
152
- }
140
+ "ref": function ref(node) {
141
+ if (props.value === void 0) return;
142
+ _this2.itemRefs[props.value.toString()] = node;
143
+ },
144
+ "buttonRefsList": this.buttonRefsList,
145
+ index
146
+ };
147
+ }
148
+ }, {
149
+ key: "getItemTextProps",
150
+ value: function getItemTextProps(props, index) {
151
+ var tabLineSize = this.asProps.size;
152
+ var size = props.size ? props.size : tabLineSize === "m" ? 200 : 300;
153
+ return {
154
+ size,
155
+ buttonRefsList: this.buttonRefsList,
156
+ index
153
157
  };
154
158
  }
155
159
  }, {
@@ -180,10 +184,10 @@ var TabLineRoot = /* @__PURE__ */ function(_Component) {
180
184
  value: function render() {
181
185
  var _ref = this.asProps, _ref5;
182
186
  var STabLine = Box;
183
- var SCaret = "div";
187
+ var SCaret = Box;
184
188
  var _this$asProps2 = this.asProps, styles = _this$asProps2.styles, Children = _this$asProps2.Children, controlsLength = _this$asProps2.controlsLength;
185
189
  var animation = this.state.animation;
186
- return _ref5 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STabLine, _ref5.cn("STabLine", _objectSpread({}, assignProps({
190
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(STabLine, _ref5.cn("STabLine", _objectSpread({}, assignProps({
187
191
  "role": "tablist",
188
192
  "ref": this.containerRef
189
193
  }, _ref))), /* @__PURE__ */ React.createElement(NeighborLocation, _ref5.cn("NeighborLocation", {
@@ -191,8 +195,7 @@ var TabLineRoot = /* @__PURE__ */ function(_Component) {
191
195
  }), /* @__PURE__ */ React.createElement(Children, _ref5.cn("Children", {}))), animation && /* @__PURE__ */ React.createElement(SCaret, _ref5.cn("SCaret", _objectSpread({}, this.getCaretProps()))));
192
196
  }
193
197
  }]);
194
- return TabLineRoot2;
195
- }(Component);
198
+ })(Component);
196
199
  _defineProperty(TabLineRoot, "displayName", "TabLine");
197
200
  _defineProperty(TabLineRoot, "style", style);
198
201
  _defineProperty(TabLineRoot, "defaultProps", {
@@ -201,20 +204,34 @@ _defineProperty(TabLineRoot, "defaultProps", {
201
204
  underlined: true,
202
205
  behavior: "auto"
203
206
  });
204
- _defineProperty(TabLineRoot, "enhance", [a11yEnhance(optionsA11yEnhance)]);
207
+ _defineProperty(TabLineRoot, "enhance", [a11yEnhance({
208
+ onNeighborChange: function onNeighborChange(neighborElement, props) {
209
+ if (neighborElement) {
210
+ neighborElement.focus();
211
+ if (props.behavior === "auto") {
212
+ neighborElement.click();
213
+ }
214
+ }
215
+ },
216
+ childSelector: ["role", "tab"]
217
+ })]);
205
218
  function TabLineItem(props) {
206
219
  var _ref2 = arguments[0];
207
220
  var STabLineItem = Box;
208
- var Children = props.Children, styles = props.styles, addonLeft = props.addonLeft, addonRight = props.addonRight, neighborLocation = props.neighborLocation;
221
+ var Children = props.Children, styles = props.styles, addonLeft = props.addonLeft, addonRight = props.addonRight, neighborLocation = props.neighborLocation, buttonRefsList = props.buttonRefsList, index = props.index;
222
+ var buttonRef = React.useRef();
223
+ buttonRefsList[index] = buttonRef;
209
224
  return /* @__PURE__ */ React.createElement(NeighborLocation.Detect, {
210
225
  neighborLocation
211
226
  }, function(neighborLocation2) {
212
227
  var _ref6;
213
- return _ref6 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STabLineItem, _ref6.cn("STabLineItem", _objectSpread({}, assignProps({
228
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(STabLineItem, _ref6.cn("STabLineItem", _objectSpread({}, assignProps({
214
229
  "tag": "button",
230
+ "tabIndex": 0,
215
231
  "neighborLocation": neighborLocation2,
216
232
  "type": "button",
217
- "role": "tab"
233
+ "role": "tab",
234
+ "ref": buttonRef
218
235
  }, _ref2))), addonLeft ? /* @__PURE__ */ React.createElement(TabLine.Item.Addon, {
219
236
  tag: addonLeft
220
237
  }) : null, addonTextChildren(Children, TabLine.Item.Text, TabLine.Item.Addon), addonRight ? /* @__PURE__ */ React.createElement(TabLine.Item.Addon, {
@@ -222,20 +239,21 @@ function TabLineItem(props) {
222
239
  }) : null);
223
240
  });
224
241
  }
225
- TabLineItem.enhance = [keyboardFocusEnhance()];
226
242
  function Text(props) {
227
243
  var _ref3 = arguments[0], _ref7;
228
- var styles = props.styles;
229
- var SText = Box;
230
- return _ref7 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SText, _ref7.cn("SText", _objectSpread({}, assignProps({
231
- "tag": "span"
244
+ var styles = props.styles, _props$ellipsis = props.ellipsis, ellipsis = _props$ellipsis === void 0 ? true : _props$ellipsis, size = props.size, buttonRefsList = props.buttonRefsList, index = props.index;
245
+ var SText = Text$1;
246
+ return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref7.cn("SText", _objectSpread({}, assignProps({
247
+ "ellipsis": ellipsis,
248
+ "size": size,
249
+ "hint:triggerRef": buttonRefsList[index]
232
250
  }, _ref3))));
233
251
  }
234
252
  function Addon(props) {
235
253
  var _ref4 = arguments[0], _ref8;
236
254
  var styles = props.styles;
237
255
  var SAddon = Box;
238
- return _ref8 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SAddon, _ref8.cn("SAddon", _objectSpread({}, assignProps({
256
+ return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SAddon, _ref8.cn("SAddon", _objectSpread({}, assignProps({
239
257
  "tag": "span"
240
258
  }, _ref4))));
241
259
  }
@@ -0,0 +1 @@
1
+
package/lib/esm/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { default as default2, wrapTabLine } from "./TabLine.mjs";
2
+ import "./TabLine.type.mjs";
2
3
  export {
3
4
  default2 as default,
4
5
  wrapTabLine
@@ -6,7 +6,7 @@ STabLine {
6
6
  }
7
7
 
8
8
  STabLine[underlined] {
9
- border-bottom: 1px solid var(--intergalactic-border-primary, #c4c7cf);
9
+ border-bottom: 1px solid var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
10
10
  }
11
11
 
12
12
  STabLineItem {
@@ -24,14 +24,14 @@ STabLineItem {
24
24
  text-decoration: none;
25
25
  -webkit-tap-highlight-color: transparent;
26
26
  overflow: visible;
27
- outline: 0;
27
+ /*outline: 0;*/
28
28
  text-align: center;
29
29
  vertical-align: middle;
30
30
  font-family: inherit;
31
31
  cursor: pointer;
32
32
  border: none;
33
33
  background: transparent;
34
- color: var(--intergalactic-text-primary, #191b23);
34
+ color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));
35
35
  margin-right: var(--intergalactic-spacing-4x, 16px);
36
36
  font-weight: var(--intergalactic-medium, 500);
37
37
 
@@ -41,9 +41,7 @@ STabLineItem {
41
41
  }
42
42
 
43
43
  &:active,
44
- &:hover,
45
- &:focus {
46
- outline: 0;
44
+ &:hover {
47
45
  text-decoration: none;
48
46
  }
49
47
 
@@ -63,12 +61,12 @@ STabLineItem {
63
61
  }
64
62
 
65
63
  &:hover::before {
66
- background-color: var(--intergalactic-border-primary, #c4c7cf);
64
+ background-color: var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
67
65
  }
68
66
 
69
67
  &[selected]::after {
70
68
  transition-delay: calc(var(--intergalactic-duration-control, 200) * 1ms);
71
- background-color: var(--intergalactic-border-info-active, #006dca);
69
+ background-color: var(--intergalactic-border-info-active, oklch(0.382 0.248 264.2 / 0.386));
72
70
  }
73
71
 
74
72
  & SText:not(:last-child) {
@@ -84,7 +82,7 @@ SCaret {
84
82
  position: absolute;
85
83
  bottom: -1px;
86
84
  height: 3px;
87
- background-color: var(--intergalactic-border-info-active, #006dca);
85
+ background: var(--intergalactic-border-info-active, oklch(0.382 0.248 264.2 / 0.386));
88
86
  transition: calc(var(--intergalactic-duration-control, 200) * 1ms) all ease-in-out;
89
87
  }
90
88
 
@@ -93,23 +91,12 @@ STabLineItem[selected] {
93
91
  }
94
92
 
95
93
  STabLineItem[disabled] {
96
- opacity: var(--intergalactic-disabled-opacity, 0.3);
94
+ opacity: var(--intergalactic-disabled-opacity, 0.4);
97
95
  cursor: default;
98
96
  /* Disable link interactions */
99
97
  pointer-events: none;
100
98
  }
101
99
 
102
- STabLineItem[keyboardFocused] {
103
- box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));
104
- }
105
-
106
- SText {
107
- display: inline-block;
108
- white-space: nowrap;
109
- overflow: hidden;
110
- text-overflow: ellipsis;
111
- }
112
-
113
100
  SAddon {
114
101
  display: inline-flex;
115
102
  align-items: center;
@@ -119,21 +106,11 @@ SAddon {
119
106
  STabLineItem[size='m'] {
120
107
  height: 28px;
121
108
  min-width: 18px;
122
-
123
- & SText {
124
- font-size: var(--intergalactic-fs-200, 14px);
125
- line-height: var(--intergalactic-lh-200, 142%);
126
- }
127
109
  }
128
110
 
129
111
  STabLineItem[size='l'] {
130
112
  height: 40px;
131
113
  min-width: 26px;
132
-
133
- & SText {
134
- font-size: var(--intergalactic-fs-300, 16px);
135
- line-height: var(--intergalactic-lh-300, 150%);
136
- }
137
114
  }
138
115
 
139
116
  STabLineItem[neighborLocation='left'] {
@@ -156,4 +133,4 @@ STabLineItem[neighborLocation='left'] {
156
133
  SCaret {
157
134
  display: none;
158
135
  }
159
- }
136
+ }
@@ -0,0 +1,6 @@
1
+ import type { Intergalactic } from '@semcore/core';
2
+ import React from 'react';
3
+ import type { NSTabLine } from './TabLine.type';
4
+ declare const TabLine: NSTabLine.Component;
5
+ export declare const wrapTabLine: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<NSTabLine.WrapperComponent>> & PropsExtending) => React.ReactNode) => NSTabLine.WrapperComponent<PropsExtending>;
6
+ export default TabLine;
@@ -0,0 +1,80 @@
1
+ import type { Box, BoxProps, NeighborItemProps, NeighborLocationProps } from '@semcore/base-components';
2
+ import type { PropGetterFn, Intergalactic } from '@semcore/core';
3
+ import type { NSText } from '@semcore/typography';
4
+ import type React from 'react';
5
+ declare namespace NSTabLine {
6
+ type Value = string | number | boolean;
7
+ type Props<T extends NSTabLine.Value = NSTabLine.Value> = BoxProps & NeighborLocationProps & {
8
+ /** TabLine size
9
+ * @default m
10
+ * */
11
+ size?: 'm' | 'l' | false;
12
+ /** Adds a bottom border for the entire component
13
+ * @default true
14
+ * */
15
+ underlined?: boolean;
16
+ /** Is invoked when changing the selection */
17
+ onChange?: ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void) | React.Dispatch<React.SetStateAction<T>>;
18
+ /** Value of the selected tab */
19
+ value?: T;
20
+ /** Default value of the selected tab
21
+ * @default null
22
+ * */
23
+ defaultValue?: T;
24
+ /**
25
+ * Behavior of tabs.
26
+ * In `auto`, changes the tab immediately when press arrow.
27
+ * In `manual`, needs to press `space` or `enter` for select a choice.
28
+ * @default 'auto'
29
+ */
30
+ behavior?: 'auto' | 'manual';
31
+ };
32
+ type Ctx = {
33
+ getItemProps: PropGetterFn;
34
+ };
35
+ type Handlers = {
36
+ value: null;
37
+ };
38
+ namespace Item {
39
+ type Props = BoxProps & NeighborItemProps & {
40
+ /** Makes a tab selected. This property is determined automatically depending on the value. */
41
+ selected?: boolean;
42
+ /** Disabled state */
43
+ disabled?: boolean;
44
+ /** Tab value */
45
+ value?: NSTabLine.Value;
46
+ /** Left addon tag */
47
+ addonLeft?: React.ElementType;
48
+ /** Right addon tag */
49
+ addonRight?: React.ElementType;
50
+ };
51
+ namespace Text {
52
+ type Props = NSText.Props;
53
+ type Component = NSText.Component;
54
+ }
55
+ namespace Addon {
56
+ type Component = typeof Box;
57
+ }
58
+ type Component = Intergalactic.Component<'div', Props, {}, [handlers: NSTabLine.Handlers]> & {
59
+ Text: Text.Component;
60
+ Addon: Addon.Component;
61
+ };
62
+ }
63
+ type WrapperComponent<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', Props<V>, Ctx, [
64
+ handlers: Handlers
65
+ ]> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;
66
+ type Component = WrapperComponent & {
67
+ Item: Item.Component;
68
+ };
69
+ }
70
+ /** @deprecated It will be removed in v18. */
71
+ export type TabLineValue = NSTabLine.Value;
72
+ /** @deprecated It will be removed in v18. */
73
+ export type TabLineProps<T extends TabLineValue = TabLineValue> = NSTabLine.Props<T>;
74
+ /** @deprecated It will be removed in v18. */
75
+ export type TabLineItemProps = NSTabLine.Item.Props;
76
+ /** @deprecated It will be removed in v18. */
77
+ export type TabLineContext = NSTabLine.Ctx;
78
+ /** @deprecated It will be removed in v18. */
79
+ export type TabLineHandlers = NSTabLine.Handlers;
80
+ export type { NSTabLine };
@@ -1,104 +1,2 @@
1
- import React from 'react';
2
- import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
3
- import { Box, BoxProps } from '@semcore/flex-box';
4
- import { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';
5
- import { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
6
-
7
- export type TabLineValue = string | number | boolean;
8
-
9
- /** @deprecated */
10
- export interface ITabLineProps<T extends TabLineValue = TabLineValue>
11
- extends TabLineProps<T>,
12
- UnknownProperties {}
13
- export type TabLineProps<T extends TabLineValue = TabLineValue> = BoxProps &
14
- NeighborLocationProps & {
15
- /** TabLine size
16
- * @default m
17
- * */
18
- size?: 'm' | 'l' | false;
19
- /** Adds a bottom border for the entire component
20
- * @default true
21
- * */
22
- underlined?: boolean;
23
- /** Is invoked when changing the selection */
24
- onChange?:
25
- | ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void)
26
- | React.Dispatch<React.SetStateAction<T>>;
27
- /** Value of the selected tab */
28
- value?: T;
29
- /** Default value of the selected tab
30
- * @default null
31
- * */
32
- defaultValue?: T;
33
-
34
- /**
35
- * Behavior of tabs.
36
- * In `auto`, changes the tab immediately when press arrow.
37
- * In `manual`, needs to press `space` or `enter` for select a choice.
38
- * @default 'auto'
39
- */
40
- behavior?: 'auto' | 'manual';
41
- };
42
-
43
- /** @deprecated */
44
- export interface ITabLineItemProps extends TabLineItemProps, UnknownProperties {}
45
- export type TabLineItemProps = BoxProps &
46
- KeyboardFocusProps &
47
- NeighborItemProps & {
48
- /** Makes a tab selected. This property is determined automatically depending on the value. */
49
- selected?: boolean;
50
- /** Disabled state */
51
- disabled?: boolean;
52
- /** Tab value */
53
- value?: TabLineValue;
54
- /** Left addon tag */
55
- addonLeft?: React.ElementType;
56
- /** Right addon tag */
57
- addonRight?: React.ElementType;
58
- };
59
-
60
- /** @deprecated */
61
- export interface ITabLineContext extends TabLineContext, UnknownProperties {}
62
- export type TabLineContext = {
63
- getItemProps: PropGetterFn;
64
- };
65
-
66
- /** @deprecated */
67
- export interface ITabLineHandlers extends TabLineHandlers, UnknownProperties {}
68
- export type TabLineHandlers = {
69
- value: (value: TabLineValue) => void;
70
- };
71
-
72
- type IntergalacticTabLineComponent<PropsExtending = {}> = (<
73
- Value extends TabLineValue,
74
- Tag extends Intergalactic.Tag = 'div',
75
- >(
76
- props: Intergalactic.InternalTypings.ComponentProps<
77
- Tag,
78
- 'div',
79
- TabLineProps<Value>,
80
- TabLineContext,
81
- [handlers: TabLineHandlers]
82
- > &
83
- PropsExtending,
84
- ) => Intergalactic.InternalTypings.ComponentRenderingResults) &
85
- Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabLineProps>;
86
-
87
- declare const TabLine: IntergalacticTabLineComponent & {
88
- Item: Intergalactic.Component<'div', TabLineItemProps, {}, [handlers: TabLineHandlers]> & {
89
- Text: typeof Box;
90
- Addon: typeof Box;
91
- };
92
- };
93
-
94
- declare const wrapTabLine: <PropsExtending extends {}>(
95
- wrapper: (
96
- props: Intergalactic.InternalTypings.UntypeRefAndTag<
97
- Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticTabLineComponent>
98
- > &
99
- PropsExtending,
100
- ) => React.ReactNode,
101
- ) => IntergalacticTabLineComponent<PropsExtending>;
102
- export { wrapTabLine };
103
-
104
- export default TabLine;
1
+ export { default, wrapTabLine } from './TabLine';
2
+ export * from './TabLine.type';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/tab-line",
3
3
  "description": "Semrush TabLine Component",
4
- "version": "4.40.4-prerelease.0",
4
+ "version": "4.41.0-prerelease.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,12 +14,12 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/flex-box": "5.41.4-prerelease.0",
18
- "@semcore/neighbor-location": "4.40.4-prerelease.0",
19
- "@semcore/utils": "4.48.5-prerelease.0"
17
+ "@semcore/flex-box": "5.42.0-prerelease.0",
18
+ "@semcore/neighbor-location": "4.41.0-prerelease.0",
19
+ "@semcore/utils": "4.49.0-prerelease.0"
20
20
  },
21
21
  "peerDependencies": {
22
- "@semcore/core": "^2.39.4-prerelease.0",
22
+ "@semcore/core": "^2.40.0-prerelease.0",
23
23
  "react": "16.8 - 18",
24
24
  "react-dom": "16.8 - 18"
25
25
  },
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=index.d.js.map
@@ -1 +0,0 @@
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 TabLineValue = string | number | boolean;\n\n/** @deprecated */\nexport interface ITabLineProps<T extends TabLineValue = TabLineValue>\n extends TabLineProps<T>,\n UnknownProperties {}\nexport type TabLineProps<T extends TabLineValue = TabLineValue> = BoxProps &\n NeighborLocationProps & {\n /** TabLine size\n * @default m\n * */\n size?: 'm' | 'l' | false;\n /** Adds a bottom border for the entire component\n * @default true\n * */\n underlined?: boolean;\n /** Is invoked when changing the selection */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Value of the selected tab */\n value?: T;\n /** Default value of the selected tab\n * @default null\n * */\n defaultValue?: T;\n\n /**\n * Behavior of tabs.\n * In `auto`, changes the tab immediately when press arrow.\n * In `manual`, needs to press `space` or `enter` for select a choice.\n * @default 'auto'\n */\n behavior?: 'auto' | 'manual';\n };\n\n/** @deprecated */\nexport interface ITabLineItemProps extends TabLineItemProps, UnknownProperties {}\nexport type TabLineItemProps = BoxProps &\n KeyboardFocusProps &\n NeighborItemProps & {\n /** Makes a tab selected. This property is determined automatically depending on the value. */\n selected?: boolean;\n /** Disabled state */\n disabled?: boolean;\n /** Tab value */\n value?: TabLineValue;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n };\n\n/** @deprecated */\nexport interface ITabLineContext extends TabLineContext, UnknownProperties {}\nexport type TabLineContext = {\n getItemProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface ITabLineHandlers extends TabLineHandlers, UnknownProperties {}\nexport type TabLineHandlers = {\n value: (value: TabLineValue) => void;\n};\n\ntype IntergalacticTabLineComponent<PropsExtending = {}> = (<\n Value extends TabLineValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n TabLineProps<Value>,\n TabLineContext,\n [handlers: TabLineHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabLineProps>;\n\ndeclare const TabLine: IntergalacticTabLineComponent & {\n Item: Intergalactic.Component<'div', TabLineItemProps, {}, [handlers: TabLineHandlers]> & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\ndeclare const wrapTabLine: <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticTabLineComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => IntergalacticTabLineComponent<PropsExtending>;\nexport { wrapTabLine };\n\nexport default TabLine;\n"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.js.map