@semcore/radio 6.43.0-prerelease.4 → 6.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
- ## [6.43.0] - 2025-02-27
5
+ ## [6.43.0] - 2025-03-14
6
6
 
7
- ### Changed
7
+ ### Added
8
8
 
9
- - Version minor update due to children dependencies update (`@semcore/utils` [4.45.1 ~> 4.47.1], `@semcore/flex-box` [5.40.1 ~> 5.41.0], `@semcore/core` [2.38.1 ~> 2.39.0]).
9
+ - Build for ESM.
10
10
 
11
11
  ## [6.42.1] - 2025-02-05
12
12
 
@@ -0,0 +1,273 @@
1
+ import N from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import G from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import v from "@babel/runtime/helpers/esm/objectSpread2";
4
+ import k from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import R from "@babel/runtime/helpers/esm/classCallCheck";
6
+ import V from "@babel/runtime/helpers/esm/createClass";
7
+ import D from "@babel/runtime/helpers/esm/inherits";
8
+ import T from "@babel/runtime/helpers/esm/createSuper";
9
+ import c from "@babel/runtime/helpers/esm/defineProperty";
10
+ import { sstyled as Y } from "@semcore/utils/lib/core/index";
11
+ import w, { CONTEXT_COMPONENT as j, assignProps as P, Component as E, sstyled as m } from "@semcore/core";
12
+ import l from "react";
13
+ import { Flex as Z, Box as I, InvalidStateBox as ee } from "@semcore/flex-box";
14
+ import A, { callAllEventHandlers as H } from "@semcore/utils/lib/assignProps";
15
+ import re from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
16
+ import te from "@semcore/utils/lib/enhances/resolveColorEnhance";
17
+ import O, { inputProps as ae } from "@semcore/utils/lib/inputProps";
18
+ import { inputProps as Ie } from "@semcore/utils/lib/inputProps";
19
+ import { useColorResolver as oe } from "@semcore/utils/lib/use/useColorResolver";
20
+ import _e from "@semcore/utils/lib/logger";
21
+ import { Text as ie } from "@semcore/typography";
22
+ var ne = ["size", "state", "theme", "keyboardFocused", "value", "tag", "disabled", "includeInputProps", "resolveColor"], le = ["children", "Children"], B = (
23
+ /*__reshadow_css_start__*/
24
+ (Y.insert(
25
+ /*__inner_css_start__*/
26
+ '.___SRadio_1d5zc_gg_{display:inline-flex;align-items:flex-start;cursor:pointer}.___SRadio_1d5zc_gg_ .___SText_1d5zc_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary, #191b23)}.___SRadio_1d5zc_gg_ .___SText_1d5zc_gg_.__color_1d5zc_gg_{color:var(--color_1d5zc)}.___SRadio_1d5zc_gg_.__disabled_1d5zc_gg_{pointer-events:none}.___SText_1d5zc_gg_._size_m_1d5zc_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SText_1d5zc_gg_._size_l_1d5zc_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SValue_1d5zc_gg_{position:relative;flex-shrink:0;padding:0;outline:0;z-index:0;margin-top:var(--intergalactic-spacing-05x, 2px)}.___SValue_1d5zc_gg_::after,.___SValue_1d5zc_gg_::before{content:"";position:absolute;right:0;bottom:0;border-radius:50%;background:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SValue_1d5zc_gg_::before{top:0;left:0;border:1px solid;transition:calc(var(--intergalactic-duration-control, 200)*1ms) all ease-in-out}.___SValue_1d5zc_gg_::after{top:50%;left:50%;transform:translate(-50%,-50%);width:0;height:0}.___SValue_1d5zc_gg_.__disabled_1d5zc_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SValue_1d5zc_gg_._size_m_1d5zc_gg_{width:16px;height:16px}.___SValue_1d5zc_gg_._size_m_1d5zc_gg_ .___SInvalidPattern_1d5zc_gg_:before{width:14px;height:14px}.___SValue_1d5zc_gg_._size_l_1d5zc_gg_{width:20px;height:20px}.___SValue_1d5zc_gg_._size_l_1d5zc_gg_ .___SInvalidPattern_1d5zc_gg_:before{width:18px;height:18px}.___SValue_1d5zc_gg_._state_normal_1d5zc_gg_::before{border-color:var(--intergalactic-border-primary, #c4c7cf)}.___SValue_1d5zc_gg_._state_invalid_1d5zc_gg_::before{border-color:var(--intergalactic-border-critical-active, #d1002f)}.___SControl_1d5zc_gg_{position:absolute;clip:rect(1px,1px,1px,1px)}.___SControl_1d5zc_gg_:checked~.___SValue_1d5zc_gg_::before{border-color:var(--intergalactic-control-primary-info, #008ff8);background-color:var(--intergalactic-control-primary-info, #008ff8)}.___SControl_1d5zc_gg_:checked~.___SValue_1d5zc_gg_._size_m_1d5zc_gg_::after{width:6px;height:6px}.___SControl_1d5zc_gg_:checked~.___SValue_1d5zc_gg_._size_l_1d5zc_gg_::after{width:8px;height:8px}.___SValue_1d5zc_gg_._state_normal_1d5zc_gg_.__keyboardFocused_1d5zc_gg_::before{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));border-color:var(--intergalactic-border-info-active, #006dca)}.___SValue_1d5zc_gg_._state_invalid_1d5zc_gg_.__keyboardFocused_1d5zc_gg_::before{box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SControl_1d5zc_gg_:checked~.___SValue_1d5zc_gg_.__theme_1d5zc_gg_::before{border-color:var(--theme_1d5zc);background-color:var(--theme_1d5zc)}.___SValue_1d5zc_gg_._state_normal_1d5zc_gg_.__theme_1d5zc_gg_::before{border-color:var(--theme_1d5zc)}.___SInvalidPattern_1d5zc_gg_{background:0 0;overflow:hidden}.___SInvalidPattern_1d5zc_gg_:before{content:"";position:absolute;top:1px;left:1px;border-radius:50%;background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(209, 0, 47, 1) 0, rgba(209, 0, 47, 1) 2px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}',
27
+ "1d5zc_gg_"
28
+ ), {
29
+ __SRadio: "___SRadio_1d5zc_gg_",
30
+ _disabled: "__disabled_1d5zc_gg_",
31
+ __SText: "___SText_1d5zc_gg_",
32
+ _size_m: "_size_m_1d5zc_gg_",
33
+ _size_l: "_size_l_1d5zc_gg_",
34
+ __SValue: "___SValue_1d5zc_gg_",
35
+ _state_normal: "_state_normal_1d5zc_gg_",
36
+ _state_invalid: "_state_invalid_1d5zc_gg_",
37
+ __SControl: "___SControl_1d5zc_gg_",
38
+ _keyboardFocused: "__keyboardFocused_1d5zc_gg_",
39
+ _theme: "__theme_1d5zc_gg_",
40
+ "--theme": "--theme_1d5zc",
41
+ _color: "__color_1d5zc_gg_",
42
+ "--color": "--color_1d5zc",
43
+ __SInvalidPattern: "___SInvalidPattern_1d5zc_gg_"
44
+ })
45
+ ), $ = /* @__PURE__ */ function(g) {
46
+ D(i, g);
47
+ var o = T(i);
48
+ function i() {
49
+ return R(this, i), o.apply(this, arguments);
50
+ }
51
+ return V(i, [{
52
+ key: "uncontrolledProps",
53
+ value: function() {
54
+ return {
55
+ value: null
56
+ };
57
+ }
58
+ }, {
59
+ key: "setContext",
60
+ value: function() {
61
+ var r = this.asProps, e = r.theme, a = r.size, _ = r.name, n = r.value, s = r.onChange, d = r.disabled;
62
+ return {
63
+ onChange: s,
64
+ value: n,
65
+ theme: e,
66
+ size: a,
67
+ name: _,
68
+ disabled: d
69
+ };
70
+ }
71
+ }, {
72
+ key: "render",
73
+ value: function() {
74
+ var r = this.asProps, e = this.asProps.Children;
75
+ return /* @__PURE__ */ l.createElement(Z, P({
76
+ direction: "column",
77
+ role: "group",
78
+ __excludeProps: ["onChange"]
79
+ }, r), /* @__PURE__ */ l.createElement(e, null));
80
+ }
81
+ }]), i;
82
+ }(E);
83
+ c($, "displayName", "RadioGroup");
84
+ c($, "defaultProps", {
85
+ defaultValue: null
86
+ });
87
+ var U = w($), S = /* @__PURE__ */ function(g) {
88
+ D(i, g);
89
+ var o = T(i);
90
+ function i() {
91
+ var t;
92
+ R(this, i);
93
+ for (var r = arguments.length, e = new Array(r), a = 0; a < r; a++)
94
+ e[a] = arguments[a];
95
+ return t = o.call.apply(o, [this].concat(e)), c(k(t), "state", {
96
+ hoistedDisabled: void 0
97
+ }), c(k(t), "hoistDisabled", function(_) {
98
+ _e.warn(!0, "Don't set disabled on Radio.Value or Radio.Text, set it on Radio or on RadioGroup (for all items) instead. Otherwise it will produce wrong SSR output.", t.asProps["data-ui-name"]), t.setState({
99
+ hoistedDisabled: _
100
+ });
101
+ }), t;
102
+ }
103
+ return V(i, [{
104
+ key: "getTextProps",
105
+ value: function() {
106
+ var r = A(this.asProps, this.context), e = r.size, a = e === void 0 ? "m" : e, _ = r.disabled, n = r.label, s = this.state.hoistedDisabled, d = {
107
+ size: a,
108
+ children: n,
109
+ disabled: _ ?? s,
110
+ hoistDisabled: this.hoistDisabled,
111
+ rootDisabled: this.props.disabled
112
+ };
113
+ return d;
114
+ }
115
+ }, {
116
+ key: "getValueProps",
117
+ value: function() {
118
+ var r, e = A(this.asProps, this.context), a = e.size, _ = a === void 0 ? "m" : a, n = e.state, s = n === void 0 ? "normal" : n, d = e.theme, p = e.disabled, z = e.name, u = this.asProps, h = u.value, f = u.checked, x = this.state.hoistedDisabled;
119
+ return {
120
+ size: (r = this.props.size) !== null && r !== void 0 ? r : _,
121
+ disabled: p ?? x,
122
+ state: s,
123
+ theme: d,
124
+ value: h,
125
+ checked: f,
126
+ name: z,
127
+ hoistDisabled: this.hoistDisabled,
128
+ rootDisabled: this.props.disabled
129
+ };
130
+ }
131
+ }, {
132
+ key: "render",
133
+ value: function() {
134
+ var r = this.asProps, e, a = I, _ = this.asProps, n = _.styles, s = _.Children, d = _.children;
135
+ return e = m(n), /* @__PURE__ */ l.createElement(a, e.cn("SRadio", v({}, P({
136
+ tag: "label",
137
+ __excludeProps: ["onChange", "label", "disabled"]
138
+ }, r))), d ? /* @__PURE__ */ l.createElement(s, e.cn("Children", {})) : /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(C.Value, null), /* @__PURE__ */ l.createElement(C.Text, null)));
139
+ }
140
+ }]), i;
141
+ }(E);
142
+ c(S, "displayName", "Radio");
143
+ c(S, "style", B);
144
+ c(S, "contextType", U[j]);
145
+ var b = /* @__PURE__ */ function(g) {
146
+ D(i, g);
147
+ var o = T(i);
148
+ function i() {
149
+ var t;
150
+ R(this, i);
151
+ for (var r = arguments.length, e = new Array(r), a = 0; a < r; a++)
152
+ e[a] = arguments[a];
153
+ return t = o.call.apply(o, [this].concat(e)), c(k(t), "bindHandlerChange", function(_) {
154
+ return function(n) {
155
+ typeof t.context.onChange == "function" && t.context.onChange(_, n);
156
+ };
157
+ }), t;
158
+ }
159
+ return V(i, [{
160
+ key: "uncontrolledProps",
161
+ value: function() {
162
+ return {
163
+ checked: function(e) {
164
+ return e.target.checked;
165
+ }
166
+ };
167
+ }
168
+ }, {
169
+ key: "getControlProps",
170
+ value: function() {
171
+ var r = this.context.value, e = this.asProps, a = e.forwardRef, _ = e.includeInputProps, n = e.state, s = e.value, d = O(this.asProps, _), p = G(d, 1), z = p[0], u = s ?? "", h = v(v({
172
+ ref: a,
173
+ state: n
174
+ }, z), {}, {
175
+ value: u
176
+ });
177
+ if (r !== void 0) {
178
+ var f = this.props, x = f.onChange;
179
+ f.onClick, h.checked = r === u, h.onChange = H(x, this.bindHandlerChange(u));
180
+ }
181
+ return h;
182
+ }
183
+ }, {
184
+ key: "getRadioMarkProps",
185
+ value: function() {
186
+ var r = this.context.value, e = this.asProps, a = e.size, _ = e.state, n = e.theme, s = e.keyboardFocused, d = e.value, p = e.tag, z = e.disabled, u = e.includeInputProps, h = e.resolveColor, f = N(e, ne), x = O(f, u), F = G(x, 2), J = F[0], y = F[1];
187
+ y.children, y.Children;
188
+ var K = N(y, le), L = d ?? "", M = v({
189
+ theme: n,
190
+ size: a,
191
+ state: _,
192
+ keyboardFocused: s,
193
+ disabled: z,
194
+ resolveColor: h,
195
+ checked: J.checked
196
+ }, K);
197
+ if (r !== void 0) {
198
+ var Q = this.props.onClick;
199
+ p !== "label" && (M.onClick = H(Q, this.bindHandlerChange(L)));
200
+ }
201
+ return M;
202
+ }
203
+ }, {
204
+ key: "componentDidUpdate",
205
+ value: function() {
206
+ this.asProps.rootDisabled !== this.asProps.disabled && this.asProps.hoistDisabled(this.asProps.disabled);
207
+ }
208
+ }, {
209
+ key: "componentDidMount",
210
+ value: function() {
211
+ this.asProps.rootDisabled !== this.asProps.disabled && this.asProps.hoistDisabled(this.asProps.disabled);
212
+ }
213
+ }, {
214
+ key: "render",
215
+ value: function() {
216
+ var r, e = this.asProps, a = e.styles, _ = e.children, n = e.Children;
217
+ return _ ? (r = m(a), /* @__PURE__ */ l.createElement(n, r.cn("Children", {}))) : (m(a), /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(C.Value.Control, null), /* @__PURE__ */ l.createElement(C.Value.RadioMark, null)));
218
+ }
219
+ }]), i;
220
+ }(E);
221
+ c(b, "defaultProps", {
222
+ includeInputProps: ae,
223
+ defaultChecked: !1
224
+ });
225
+ c(b, "enhance", [re(), te()]);
226
+ c(b, "displayName", "Value");
227
+ c(b, "contextType", U[j]);
228
+ c(b, "style", B);
229
+ var W = function(o) {
230
+ var i = arguments[0], t, r = I, e = o.styles, a = o.state;
231
+ return t = m(e), /* @__PURE__ */ l.createElement(r, t.cn("SControl", v({}, P({
232
+ tag: "input",
233
+ type: "radio",
234
+ "aria-invalid": a === "invalid"
235
+ }, i))));
236
+ };
237
+ W.displayName = "Control";
238
+ var X = function(o) {
239
+ var i = arguments[0], t, r = I, e = ee, a = o.theme, _ = o.styles, n = o.resolveColor, s = o.state, d = o.checked;
240
+ return t = m(_), /* @__PURE__ */ l.createElement(r, t.cn("SValue", v({}, P({
241
+ tag: "div",
242
+ "use:theme": n(a),
243
+ "aria-hidden": !0
244
+ }, i))), s === "invalid" && !d && /* @__PURE__ */ l.createElement(e, t.cn("SInvalidPattern", {})));
245
+ };
246
+ X.displayName = "RadioMark";
247
+ var q = function(o) {
248
+ var i = arguments[0], t, r = ie, e = o.styles, a = o.color;
249
+ l.useEffect(function() {
250
+ o.rootDisabled !== o.disabled && o.hoistDisabled(o.disabled);
251
+ }, [o.rootDisabled, o.disabled, o.hoistDisabled]);
252
+ var _ = oe();
253
+ return t = m(e), /* @__PURE__ */ l.createElement(r, t.cn("SText", v({}, P({
254
+ tag: "span",
255
+ "use:color": _(a)
256
+ }, i))));
257
+ };
258
+ q.displayName = "Text";
259
+ var se = w(b, {
260
+ Control: W,
261
+ RadioMark: X
262
+ }), C = w(S, {
263
+ Text: q,
264
+ Value: se
265
+ }), Te = function(o) {
266
+ return o;
267
+ };
268
+ export {
269
+ U as RadioGroup,
270
+ C as default,
271
+ Ie as inputProps,
272
+ Te as wrapRadioGroup
273
+ };
@@ -0,0 +1,8 @@
1
+ import { RadioGroup as p, default as a, wrapRadioGroup as t } from "./Radio.mjs";
2
+ import { inputProps as d } from "@semcore/utils/lib/inputProps";
3
+ export {
4
+ p as RadioGroup,
5
+ a as default,
6
+ d as inputProps,
7
+ t as wrapRadioGroup
8
+ };
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "@semcore/radio",
3
3
  "description": "Semrush Radio Component",
4
- "version": "6.43.0-prerelease.4",
4
+ "version": "6.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/utils": "4.47.1-prerelease.4",
13
- "@semcore/flex-box": "5.41.0-prerelease.4",
14
- "@semcore/typography": "5.52.0-prerelease.4"
17
+ "@semcore/utils": "4.48.0",
18
+ "@semcore/flex-box": "5.41.0",
19
+ "@semcore/typography": "5.52.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
+ );