@semcore/tab-line 4.40.0-prerelease.4 → 4.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
- ## [4.40.0] - 2025-02-27
5
+ ## [4.40.0] - 2025-03-14
6
6
 
7
- ### Changed
7
+ ### Added
8
8
 
9
- - Version minor update due to children dependencies update (`@semcore/flex-box` [5.40.1 ~> 5.41.0], `@semcore/neighbor-location` [4.38.1 ~> 4.39.0], `@semcore/utils` [4.45.1 ~> 4.47.1], `@semcore/core` [2.38.1 ~> 2.39.0]).
9
+ - Build for ESM.
10
10
 
11
11
  ## [4.39.1] - 2025-02-05
12
12
 
@@ -0,0 +1,204 @@
1
+ import m from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import y from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import I from "@babel/runtime/helpers/esm/createClass";
4
+ import d from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import k from "@babel/runtime/helpers/esm/inherits";
6
+ import C from "@babel/runtime/helpers/esm/createSuper";
7
+ import l from "@babel/runtime/helpers/esm/defineProperty";
8
+ import { sstyled as w } from "@semcore/utils/lib/core/index";
9
+ import P, { sstyled as h, assignProps as v, Component as R } from "@semcore/core";
10
+ import s from "react";
11
+ import { Box as p } from "@semcore/flex-box";
12
+ import z from "@semcore/utils/lib/addonTextChildren";
13
+ import A from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
14
+ import E from "@semcore/utils/lib/enhances/a11yEnhance";
15
+ import L from "@semcore/neighbor-location";
16
+ var N = (
17
+ /*__reshadow_css_start__*/
18
+ (w.insert(
19
+ /*__inner_css_start__*/
20
+ '.___STabLine_1ofgb_gg_{position:relative;display:flex;width:100%;max-width:100%}.___STabLine_1ofgb_gg_.__underlined_1ofgb_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___STabLineItem_1ofgb_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_1ofgb_gg_::-moz-focus-inner{border:0;padding:0}.___STabLineItem_1ofgb_gg_:active,.___STabLineItem_1ofgb_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___STabLineItem_1ofgb_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___STabLineItem_1ofgb_gg_::after,.___STabLineItem_1ofgb_gg_::before{content:"";position:absolute;left:0;bottom:-1px;height:3px;width:100%;background-color:transparent}.___STabLineItem_1ofgb_gg_::before{transition:background-color calc(var(--intergalactic-duration-control, 200)*1ms) ease-in-out}@media (hover:hover){.___STabLineItem_1ofgb_gg_:hover::before{background-color:var(--intergalactic-border-primary, #c4c7cf)}}.___STabLineItem_1ofgb_gg_.__selected_1ofgb_gg_::after{transition-delay:calc(var(--intergalactic-duration-control, 200)*1ms);background-color:var(--intergalactic-border-info-active, #006dca)}.___STabLineItem_1ofgb_gg_ .___SAddon_1ofgb_gg_:not(:last-child),.___STabLineItem_1ofgb_gg_ .___SText_1ofgb_gg_:not(:last-child){margin-right:var(--intergalactic-spacing-2x, 8px)}.___SCaret_1ofgb_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_1ofgb_gg_.__selected_1ofgb_gg_{flex-shrink:0}.___STabLineItem_1ofgb_gg_.__disabled_1ofgb_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___STabLineItem_1ofgb_gg_.__keyboardFocused_1ofgb_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SText_1ofgb_gg_{display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.___SAddon_1ofgb_gg_{display:inline-flex;align-items:center;justify-content:center}.___STabLineItem_1ofgb_gg_._size_m_1ofgb_gg_{height:28px;min-width:18px}.___STabLineItem_1ofgb_gg_._size_m_1ofgb_gg_ .___SText_1ofgb_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___STabLineItem_1ofgb_gg_._size_l_1ofgb_gg_{height:40px;min-width:26px}.___STabLineItem_1ofgb_gg_._size_l_1ofgb_gg_ .___SText_1ofgb_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___STabLineItem_1ofgb_gg_._neighborLocation_left_1ofgb_gg_{margin-right:0}@media (prefers-reduced-motion){.___STabLineItem_1ofgb_gg_.__selected_1ofgb_gg_::after,.___STabLineItem_1ofgb_gg_::after,.___STabLineItem_1ofgb_gg_::before{transition:none}.___SCaret_1ofgb_gg_{display:none}}',
21
+ "1ofgb_gg_"
22
+ ), {
23
+ __STabLine: "___STabLine_1ofgb_gg_",
24
+ _underlined: "__underlined_1ofgb_gg_",
25
+ __SCaret: "___SCaret_1ofgb_gg_",
26
+ __STabLineItem: "___STabLineItem_1ofgb_gg_",
27
+ _selected: "__selected_1ofgb_gg_",
28
+ _disabled: "__disabled_1ofgb_gg_",
29
+ _keyboardFocused: "__keyboardFocused_1ofgb_gg_",
30
+ __SText: "___SText_1ofgb_gg_",
31
+ __SAddon: "___SAddon_1ofgb_gg_",
32
+ _neighborLocation_left: "_neighborLocation_left_1ofgb_gg_",
33
+ _size_m: "_size_m_1ofgb_gg_",
34
+ _size_l: "_size_l_1ofgb_gg_"
35
+ })
36
+ ), V = {
37
+ onNeighborChange: function(o, n) {
38
+ o && (o.focus(), n.behavior === "auto" && o.click());
39
+ },
40
+ childSelector: ["role", "tab"]
41
+ }, b = /* @__PURE__ */ function(_) {
42
+ k(n, _);
43
+ var o = C(n);
44
+ function n() {
45
+ var e;
46
+ y(this, n);
47
+ for (var t = arguments.length, i = new Array(t), r = 0; r < t; r++)
48
+ i[r] = arguments[r];
49
+ return e = o.call.apply(o, [this].concat(i)), l(d(e), "state", {
50
+ animation: null
51
+ }), l(d(e), "prevValue", void 0), l(d(e), "itemRefs", {}), l(d(e), "containerRef", /* @__PURE__ */ s.createRef()), l(d(e), "animationStartTimeout", -1), l(d(e), "handleAnimationStart", function() {
52
+ var a;
53
+ ((a = e.state.animation) === null || a === void 0 ? void 0 : a.started) === !1 && e.setState({
54
+ animation: m(m({}, e.state.animation), {}, {
55
+ started: !0
56
+ })
57
+ });
58
+ }), l(d(e), "handleAnimationEnd", function() {
59
+ e.setState({
60
+ animation: null
61
+ });
62
+ }), l(d(e), "bindHandlerClick", function(a) {
63
+ return function(g) {
64
+ e.handlers.value(a, g);
65
+ };
66
+ }), e;
67
+ }
68
+ return I(n, [{
69
+ key: "uncontrolledProps",
70
+ value: function() {
71
+ return {
72
+ value: null
73
+ };
74
+ }
75
+ }, {
76
+ key: "componentDidUpdate",
77
+ value: function() {
78
+ this.prevValue !== null && this.asProps.value !== null && this.prevValue !== this.asProps.value && this.animate(), this.prevValue = this.asProps.value;
79
+ }
80
+ }, {
81
+ key: "componentDidMount",
82
+ value: function() {
83
+ this.prevValue = this.asProps.value;
84
+ }
85
+ }, {
86
+ key: "componentWillUnmount",
87
+ value: function() {
88
+ clearTimeout(this.animationStartTimeout);
89
+ }
90
+ }, {
91
+ key: "animate",
92
+ value: function() {
93
+ var t = this.itemRefs[this.prevValue], i = this.itemRefs[this.asProps.value], r = this.containerRef.current;
94
+ if (!(!t || !i || !r)) {
95
+ var a = r.getBoundingClientRect(), g = t.getBoundingClientRect(), c = i.getBoundingClientRect(), f = {
96
+ fromLeft: g.x - a.x,
97
+ fromWidth: g.width,
98
+ toLeft: c.x - a.x,
99
+ toWidth: c.width,
100
+ started: !1
101
+ };
102
+ this.setState({
103
+ animation: f
104
+ }), clearTimeout(this.animationStartTimeout), this.animationStartTimeout = setTimeout(this.handleAnimationStart, 0);
105
+ }
106
+ }
107
+ }, {
108
+ key: "getItemProps",
109
+ value: function(t, i) {
110
+ var r = this, a = this.asProps, g = a.value, c = a.size, f = g === t.value;
111
+ return {
112
+ size: c,
113
+ selected: f,
114
+ onClick: this.bindHandlerClick(t.value),
115
+ tabIndex: f ? 0 : -1,
116
+ "aria-selected": f,
117
+ ref: function(S) {
118
+ r.itemRefs[t.value] = S;
119
+ }
120
+ };
121
+ }
122
+ }, {
123
+ key: "getCaretProps",
124
+ value: function() {
125
+ var t = this.state.animation;
126
+ return t ? t.started ? {
127
+ style: {
128
+ left: t.toLeft,
129
+ width: t.toWidth
130
+ },
131
+ onTransitionEnd: this.handleAnimationEnd
132
+ } : {
133
+ style: {
134
+ left: t.fromLeft,
135
+ width: t.fromWidth
136
+ },
137
+ onTransitionEnd: this.handleAnimationEnd
138
+ } : {};
139
+ }
140
+ }, {
141
+ key: "render",
142
+ value: function() {
143
+ var t = this.asProps, i, r = p, a = "div", g = this.asProps, c = g.styles, f = g.Children, T = g.controlsLength, S = this.state.animation;
144
+ return i = h(c), /* @__PURE__ */ s.createElement(r, i.cn("STabLine", m({}, v({
145
+ role: "tablist",
146
+ ref: this.containerRef
147
+ }, t))), /* @__PURE__ */ s.createElement(L, i.cn("NeighborLocation", {
148
+ controlsLength: T
149
+ }), /* @__PURE__ */ s.createElement(f, i.cn("Children", {}))), S && /* @__PURE__ */ s.createElement(a, i.cn("SCaret", m({}, this.getCaretProps()))));
150
+ }
151
+ }]), n;
152
+ }(R);
153
+ l(b, "displayName", "TabLine");
154
+ l(b, "style", N);
155
+ l(b, "defaultProps", {
156
+ defaultValue: null,
157
+ size: "m",
158
+ underlined: !0,
159
+ behavior: "auto"
160
+ });
161
+ l(b, "enhance", [E(V)]);
162
+ function x(_) {
163
+ var o = arguments[0], n = p, e = _.Children, t = _.styles, i = _.addonLeft, r = _.addonRight, a = _.neighborLocation;
164
+ return /* @__PURE__ */ s.createElement(L.Detect, {
165
+ neighborLocation: a
166
+ }, function(g) {
167
+ var c;
168
+ return c = h(t), /* @__PURE__ */ s.createElement(n, c.cn("STabLineItem", m({}, v({
169
+ tag: "button",
170
+ neighborLocation: g,
171
+ type: "button",
172
+ role: "tab"
173
+ }, o))), i ? /* @__PURE__ */ s.createElement(u.Item.Addon, {
174
+ tag: i
175
+ }) : null, z(e, u.Item.Text, u.Item.Addon), r ? /* @__PURE__ */ s.createElement(u.Item.Addon, {
176
+ tag: r
177
+ }) : null);
178
+ });
179
+ }
180
+ x.enhance = [A()];
181
+ function W(_) {
182
+ var o = arguments[0], n, e = _.styles, t = p;
183
+ return n = h(e), /* @__PURE__ */ s.createElement(t, n.cn("SText", m({}, v({
184
+ tag: "span"
185
+ }, o))));
186
+ }
187
+ function D(_) {
188
+ var o = arguments[0], n, e = _.styles, t = p;
189
+ return n = h(e), /* @__PURE__ */ s.createElement(t, n.cn("SAddon", m({}, v({
190
+ tag: "span"
191
+ }, o))));
192
+ }
193
+ var u = P(b, {
194
+ Item: [x, {
195
+ Text: W,
196
+ Addon: D
197
+ }]
198
+ }), Z = function(o) {
199
+ return o;
200
+ };
201
+ export {
202
+ u as default,
203
+ Z as wrapTabLine
204
+ };
@@ -0,0 +1,5 @@
1
+ import { default as r, wrapTabLine as f } from "./TabLine.mjs";
2
+ export {
3
+ r as default,
4
+ f as wrapTabLine
5
+ };
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "@semcore/tab-line",
3
3
  "description": "Semrush TabLine Component",
4
- "version": "4.40.0-prerelease.4",
4
+ "version": "4.40.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
8
8
  "sideEffects": false,
9
9
  "author": "UI-kit team <ui-kit-team@semrush.com>",
10
10
  "license": "MIT",
11
+ "exports": {
12
+ "require": "./lib/cjs/index.js",
13
+ "import": "./lib/esm/index.mjs",
14
+ "types": "./lib/types/index.d.ts"
15
+ },
11
16
  "dependencies": {
12
- "@semcore/flex-box": "5.41.0-prerelease.4",
13
- "@semcore/neighbor-location": "4.39.0-prerelease.4",
14
- "@semcore/utils": "4.47.1-prerelease.4"
17
+ "@semcore/flex-box": "5.41.0",
18
+ "@semcore/neighbor-location": "4.40.0",
19
+ "@semcore/utils": "4.48.0"
15
20
  },
16
21
  "peerDependencies": {
17
- "@semcore/core": "^2.39.0-prerelease.4",
22
+ "@semcore/core": "^2.17.5",
18
23
  "react": "16.8 - 18",
19
24
  "react-dom": "16.8 - 18"
20
25
  },
@@ -28,6 +33,6 @@
28
33
  "@semcore/testing-utils": "1.0.0"
29
34
  },
30
35
  "scripts": {
31
- "build": "pnpm semcore-builder --source=js"
36
+ "build": "pnpm semcore-builder --source=js && pnpm vite build"
32
37
  }
33
38
  }
package/vite.config.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { defineConfig, mergeConfig } from 'vite';
2
+
3
+ import viteConfig from '../../commonVite.config';
4
+
5
+ export default mergeConfig(
6
+ viteConfig,
7
+ defineConfig({
8
+ build: {
9
+ lib: {
10
+ entry: './src/index.js',
11
+ },
12
+ rollupOptions: {
13
+ external: ['react', 'react-dom', 'react/jsx-runtime', /@babel\/runtime\/*/, /@semcore\/*/],
14
+ },
15
+ },
16
+ }),
17
+ );