@semcore/pills 5.43.0-prerelease.4 → 5.43.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
- ## [5.43.0] - 2025-02-27
5
+ ## [5.43.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
  ## [5.42.1] - 2025-02-05
12
12
 
@@ -0,0 +1,158 @@
1
+ import h from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import k from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import L from "@babel/runtime/helpers/esm/createClass";
4
+ import b from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import A from "@babel/runtime/helpers/esm/inherits";
6
+ import C from "@babel/runtime/helpers/esm/createSuper";
7
+ import d from "@babel/runtime/helpers/esm/defineProperty";
8
+ import { sstyled as T } from "@semcore/utils/lib/core/index";
9
+ import E, { sstyled as w, assignProps as p, Component as D } from "@semcore/core";
10
+ import s from "react";
11
+ import { Box as P } from "@semcore/flex-box";
12
+ import j, { 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 = (
18
+ /*__reshadow_css_start__*/
19
+ (T.insert(
20
+ /*__inner_css_start__*/
21
+ ".___SPills_wxe59_gg_{display:inline-flex;align-items:center;justify-content:center;isolation:isolate;outline:0}.___SPills_wxe59_gg_.__keyboardFocused_wxe59_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1}.___SPill_wxe59_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_wxe59_gg_::-moz-focus-inner{border:0;padding:0}.___SPill_wxe59_gg_:active,.___SPill_wxe59_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPill_wxe59_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none;background:var(--intergalactic-bg-primary-neutral-hover, #f4f5f9)}}.___SPill_wxe59_gg_.__selected_wxe59_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_wxe59_gg_.__disabled_wxe59_gg_{cursor:default;pointer-events:none}.___SPill_wxe59_gg_.__disabled_wxe59_gg_>*{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SPill_wxe59_gg_.__keyboardFocused_wxe59_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1}.___SText_wxe59_gg_{color:var(--intergalactic-text-primary, #191b23);display:inline-flex}.___SAddon_wxe59_gg_{color:var(--intergalactic-text-secondary, #6c6e79);display:inline-flex;align-items:center;justify-content:center}.___SPill_wxe59_gg_._size_m_wxe59_gg_{height:var(--intergalactic-form-control-m, 28px);min-width:var(--intergalactic-form-control-m, 28px);font-size:var(--intergalactic-fs-200, 14px)}.___SPill_wxe59_gg_._size_l_wxe59_gg_ .___SText_wxe59_gg_,.___SPill_wxe59_gg_._size_m_wxe59_gg_ .___SText_wxe59_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_wxe59_gg_._size_m_wxe59_gg_ .___SAddon_wxe59_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPill_wxe59_gg_._size_m_wxe59_gg_ .___SAddon_wxe59_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_wxe59_gg_._size_m_wxe59_gg_ .___SAddon_wxe59_gg_:only-child{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SPill_wxe59_gg_._size_l_wxe59_gg_{height:var(--intergalactic-form-control-l, 40px);min-width:var(--intergalactic-form-control-l, 40px);font-size:var(--intergalactic-fs-300, 16px)}.___SPill_wxe59_gg_._size_l_wxe59_gg_ .___SAddon_wxe59_gg_:only-child,.___SPill_wxe59_gg_._size_l_wxe59_gg_ .___SText_wxe59_gg_:only-child{margin-left:var(--intergalactic-spacing-3x, 12px);margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_wxe59_gg_._size_l_wxe59_gg_ .___SAddon_wxe59_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SPill_wxe59_gg_._size_l_wxe59_gg_ .___SAddon_wxe59_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SPill_wxe59_gg_._neighborLocation_right_wxe59_gg_{border-top-right-radius:0;border-bottom-right-radius:0}.___SPill_wxe59_gg_._neighborLocation_both_wxe59_gg_{border-radius:0;margin-left:-1px}.___SPill_wxe59_gg_._neighborLocation_left_wxe59_gg_{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}",
22
+ "wxe59_gg_"
23
+ ), {
24
+ __SPills: "___SPills_wxe59_gg_",
25
+ _keyboardFocused: "__keyboardFocused_wxe59_gg_",
26
+ __SPill: "___SPill_wxe59_gg_",
27
+ _selected: "__selected_wxe59_gg_",
28
+ __SText: "___SText_wxe59_gg_",
29
+ __SAddon: "___SAddon_wxe59_gg_",
30
+ _neighborLocation_right: "_neighborLocation_right_wxe59_gg_",
31
+ _neighborLocation_both: "_neighborLocation_both_wxe59_gg_",
32
+ _neighborLocation_left: "_neighborLocation_left_wxe59_gg_",
33
+ _disabled: "__disabled_wxe59_gg_",
34
+ _size_m: "_size_m_wxe59_gg_",
35
+ _size_l: "_size_l_wxe59_gg_"
36
+ })
37
+ ), H = {
38
+ onNeighborChange: function(i, t) {
39
+ i && (i.focus(), (t.behavior === "auto" || t.behavior === "radio") && i.click());
40
+ },
41
+ childSelector: function(i) {
42
+ return i.behavior === "auto" || i.behavior === "radio" ? ["role", "radio"] : ["role", "tab"];
43
+ }
44
+ }, f = /* @__PURE__ */ function(r) {
45
+ A(t, r);
46
+ var i = C(t);
47
+ function t() {
48
+ var _;
49
+ k(this, t);
50
+ for (var l = arguments.length, o = new Array(l), n = 0; n < l; n++)
51
+ o[n] = arguments[n];
52
+ return _ = i.call.apply(i, [this].concat(o)), d(b(_), "itemValues", []), d(b(_), "bindHandlerClick", function(e) {
53
+ return function(a) {
54
+ _.handlers.value(e, a);
55
+ };
56
+ }), d(b(_), "bindHandleKeyDown", function(e) {
57
+ return function(a) {
58
+ (a.key === "Enter" || a.key === " ") && (a.preventDefault(), _.handlers.value(e, a));
59
+ };
60
+ }), d(b(_), "changeIndex", function(e, a) {
61
+ for (var c = !1; !c && e >= 0 && e < _.itemValues.length; ) {
62
+ a === "increment" && e++, a === "decrement" && e--;
63
+ var g = _.itemRefs[e];
64
+ (g == null ? void 0 : g.disabled) === !1 && (c = !0);
65
+ }
66
+ return e >= 0 && e < _.itemValues.length ? e : void 0;
67
+ }), _;
68
+ }
69
+ return L(t, [{
70
+ 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");
73
+ }
74
+ }, {
75
+ key: "uncontrolledProps",
76
+ value: function() {
77
+ return {
78
+ value: null
79
+ };
80
+ }
81
+ }, {
82
+ key: "getItemProps",
83
+ value: function(l, o) {
84
+ var n = this.asProps, e = n.value, a = n.size, c = n.disabled, g = n.behavior, x = e === l.value;
85
+ return this.itemValues[o] = l.value, {
86
+ index: o,
87
+ size: a,
88
+ disabled: c,
89
+ selected: x,
90
+ behavior: g,
91
+ tabIndex: x ? 0 : -1,
92
+ onClick: this.bindHandlerClick(l.value),
93
+ onKeyDown: this.bindHandleKeyDown(l.value)
94
+ };
95
+ }
96
+ }, {
97
+ key: "render",
98
+ value: function() {
99
+ var l = this.asProps, o, n = P, e = this.asProps, a = e.Children, c = e.styles, g = e.controlsLength, x = e.disabled, m = e.behavior, u = e.value;
100
+ return o = w(c), /* @__PURE__ */ s.createElement(n, o.cn("SPills", h({}, p({
101
+ role: m === "radio" || m === "auto" ? "radiogroup" : "tablist",
102
+ "aria-disabled": x,
103
+ "use:tabIndex": u !== null ? -1 : 0
104
+ }, l))), /* @__PURE__ */ s.createElement(j, o.cn("NeighborLocation", {
105
+ controlsLength: g
106
+ }), /* @__PURE__ */ s.createElement(a, o.cn("Children", {}))));
107
+ }
108
+ }]), t;
109
+ }(D);
110
+ d(f, "displayName", "Pills");
111
+ d(f, "style", V);
112
+ d(f, "defaultProps", function(r) {
113
+ var i = r.behavior;
114
+ return {
115
+ size: "m",
116
+ defaultValue: null,
117
+ behavior: i ?? "auto"
118
+ };
119
+ });
120
+ d(f, "enhance", [F(H), y()]);
121
+ function z(r) {
122
+ var i = arguments[0], t, _ = P, l = r.Children, o = r.styles, n = r.addonLeft, e = r.addonRight, a = r.selected, c = r.disabled, g = r.index, x = r.behavior, m = N(g), u = {};
123
+ return x === "radio" || x === "auto" ? (u.role = "radio", u["aria-checked"] = a) : (u.role = "tab", u["aria-selected"] = a), t = w(o), /* @__PURE__ */ s.createElement(_, t.cn("SPill", h({}, p(h({
124
+ tag: "button",
125
+ type: "button",
126
+ neighborLocation: m,
127
+ "aria-disabled": c
128
+ }, u), i))), n ? /* @__PURE__ */ s.createElement(v.Item.Addon, {
129
+ tag: n
130
+ }) : null, R(l, v.Item.Text, v.Item.Addon), e ? /* @__PURE__ */ s.createElement(v.Item.Addon, {
131
+ tag: e
132
+ }) : null);
133
+ }
134
+ z.enhance = [y()];
135
+ function I(r) {
136
+ var i = arguments[0], t, _ = P;
137
+ return t = w(r.styles), /* @__PURE__ */ s.createElement(_, t.cn("SText", h({}, p({
138
+ tag: "span"
139
+ }, i))));
140
+ }
141
+ function K(r) {
142
+ var i = arguments[0], t, _ = P;
143
+ return t = w(r.styles), /* @__PURE__ */ s.createElement(_, t.cn("SAddon", h({}, p({
144
+ tag: "span"
145
+ }, i))));
146
+ }
147
+ var v = E(f, {
148
+ Item: [z, {
149
+ Text: I,
150
+ Addon: K
151
+ }]
152
+ }), re = function(i) {
153
+ return i;
154
+ };
155
+ export {
156
+ v as default,
157
+ re as wrapPills
158
+ };
@@ -0,0 +1,5 @@
1
+ import { default as a, wrapPills as e } from "./Pills.mjs";
2
+ export {
3
+ a as default,
4
+ e as wrapPills
5
+ };
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "@semcore/pills",
3
3
  "description": "Semrush Pills Component",
4
- "version": "5.43.0-prerelease.4",
4
+ "version": "5.43.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
  },
@@ -30,6 +35,6 @@
30
35
  "@semcore/testing-utils": "1.0.0"
31
36
  },
32
37
  "scripts": {
33
- "build": "pnpm semcore-builder --source=js"
38
+ "build": "pnpm semcore-builder --source=js && pnpm vite build"
34
39
  }
35
40
  }
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
+ );