@arthurzakharov/ui-kit 3.14.0 → 3.15.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.
@@ -0,0 +1 @@
1
+ ._Radio_1trgm_1{display:inline-flex;flex-direction:column}._WithLabel_1trgm_6{display:flex;width:100%;gap:var(--rm-ui-padding-sm)}._Content_1trgm_12{display:inline-flex}._Horizontal_1trgm_16{flex-direction:row;gap:var(--rm-ui-padding-lg)}._Vertical_1trgm_21{flex-direction:column;gap:var(--rm-ui-padding-xxs)}._Label_1trgm_26{position:relative;display:inline-flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rm-ui-padding-xs)}._Label_1trgm_26:hover{cursor:pointer}._ErrorMessage_1trgm_39{padding-top:var(--rm-ui-padding-xxs)}
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  import { ChoiceProps, CaptionProps } from '../../primitives';
2
3
  import { Interactive, RadioChoice } from '../../utils';
3
4
  import { Base } from '../../../utils/types';
@@ -7,5 +8,6 @@ export interface RadioProps extends Base, Interactive<string> {
7
8
  iconSize?: ChoiceProps['size'];
8
9
  textSize?: CaptionProps['size'];
9
10
  message?: string;
11
+ label?: ReactNode;
10
12
  }
11
- export declare const Radio: ({ id, value, disabled, state, onChange, onFocus, onBlur, choices, orientation, iconSize, textSize, message, ...base }: RadioProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const Radio: ({ id, value, disabled, state, onChange, onFocus, onBlur, choices, orientation, iconSize, textSize, message, label, ...base }: RadioProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,111 +1,97 @@
1
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
- import { clsx as p, baseProps as _ } from "../../../utils/functions/functions.util.js";
3
- import { FadeSlide as k } from "../../../animations/fade-slide/fade-slide.component.js";
1
+ import { jsxs as u, jsx as r } from "react/jsx-runtime";
2
+ import { baseProps as g, clsx as f } from "../../../utils/functions/functions.util.js";
3
+ import { FadeSlide as $ } from "../../../animations/fade-slide/fade-slide.component.js";
4
4
  import "../../primitives/box/box.component.js";
5
- import { Caption as I } from "../../primitives/caption/caption.component.js";
6
- import { Choice as V } from "../../primitives/choice/choice.component.js";
7
- import { ErrorMessage as y } from "../../primitives/error-message/error-message.component.js";
8
- import { HiddenInput as F } from "../../primitives/hidden-input/hidden-input.component.js";
5
+ import { Caption as F } from "../../primitives/caption/caption.component.js";
6
+ import { Choice as j } from "../../primitives/choice/choice.component.js";
7
+ import { ErrorMessage as B } from "../../primitives/error-message/error-message.component.js";
8
+ import { HiddenInput as w } from "../../primitives/hidden-input/hidden-input.component.js";
9
9
  import "../../../utils/content/content.component.js";
10
- import { RadioLabel as j } from "../../primitives/radio-label/radio-label.component.js";
10
+ import { RadioLabel as P } from "../../primitives/radio-label/radio-label.component.js";
11
11
  import "lucide-react";
12
- import { getChoiceId as B } from "../../utils/functions/functions.util.js";
13
- import { useControlInteraction as $ } from "../../utils/hooks/use-control-interaction/use-control-interaction.hook.js";
14
- import '../../../assets/radio-VoXwCoAp.css';const P = "_Radio_rt0wk_1", S = "_Content_rt0wk_6", q = "_Horizontal_rt0wk_10", A = "_Vertical_rt0wk_15", D = "_Label_rt0wk_20", G = "_ErrorMessage_rt0wk_33", o = {
15
- Radio: P,
16
- Content: S,
17
- Horizontal: q,
18
- Vertical: A,
19
- Label: D,
20
- ErrorMessage: G
21
- }, ar = ({
12
+ import { Text as S } from "../../../components/text/text.component.js";
13
+ import { getChoiceId as T } from "../../utils/functions/functions.util.js";
14
+ import { useControlInteraction as q } from "../../utils/hooks/use-control-interaction/use-control-interaction.hook.js";
15
+ import '../../../assets/radio-D4fKo4f0.css';const A = "_Radio_1trgm_1", D = "_WithLabel_1trgm_6", G = "_Content_1trgm_12", J = "_Horizontal_1trgm_16", K = "_Vertical_1trgm_21", O = "_Label_1trgm_26", Q = "_ErrorMessage_1trgm_39", o = {
16
+ Radio: A,
17
+ WithLabel: D,
18
+ Content: G,
19
+ Horizontal: J,
20
+ Vertical: K,
21
+ Label: O,
22
+ ErrorMessage: Q
23
+ }, U = (t, a) => t == null || t === !1 || t === "" ? null : typeof t == "string" || typeof t == "number" ? /* @__PURE__ */ r(S, { tag: "div", weight: "medium", size: "body", color: "text-primary", "data-testid": `${a}-label`, children: t }) : /* @__PURE__ */ r("div", { "data-testid": `${a}-label`, children: t }), ct = ({
22
24
  // Interactive props
23
- id: e,
24
- value: u = "",
25
- disabled: a = !1,
26
- state: s = "idle",
27
- onChange: f,
28
- onFocus: C,
29
- onBlur: g,
25
+ id: t,
26
+ value: a = "",
27
+ disabled: n = !1,
28
+ state: d = "idle",
29
+ onChange: h,
30
+ onFocus: v,
31
+ onBlur: L,
30
32
  // Radio props
31
- choices: h,
33
+ choices: C,
32
34
  orientation: l = "horizontal",
33
- iconSize: v = "md",
34
- textSize: z = "body",
35
- message: m = "",
35
+ iconSize: z = "md",
36
+ textSize: x = "body",
37
+ message: c = "",
38
+ label: e,
36
39
  // Base props
37
- ...d
40
+ ...p
38
41
  }) => {
39
- const { emitChange: w, handleFocus: x, handleBlur: E } = $({
40
- id: e,
41
- disabled: a,
42
- onChange: f,
43
- onFocus: C,
44
- onBlur: g
45
- });
46
- return /* @__PURE__ */ c(
47
- "div",
48
- {
49
- "data-testid": _(d, "data-testid", "radio"),
50
- className: p(o.Radio, _(d, "className")),
51
- children: [
52
- /* @__PURE__ */ r(
53
- "div",
54
- {
55
- className: p(o.Content, {
56
- [o.Horizontal]: l === "horizontal",
57
- [o.Vertical]: l === "vertical"
58
- }),
59
- children: h.map((t, M, R) => {
60
- const i = B(e, t.value, M);
61
- return /* @__PURE__ */ r(
62
- j,
63
- {
64
- id: i,
65
- value: u,
66
- state: s,
67
- choice: t,
68
- choices: R,
69
- children: ({ focused: b, hovered: H, checked: n, state: L }) => /* @__PURE__ */ c("div", { className: o.Label, children: [
70
- /* @__PURE__ */ r(
71
- V,
72
- {
73
- type: "radio",
74
- size: v,
75
- state: L,
76
- checked: n,
77
- focused: b,
78
- hovered: H,
79
- disabled: a
80
- }
81
- ),
82
- /* @__PURE__ */ r(
83
- F,
84
- {
85
- type: "radio",
86
- id: i,
87
- value: t.value,
88
- name: e,
89
- checked: n,
90
- disabled: a,
91
- onChange: (J, N) => w(t.value, N),
92
- onFocus: x,
93
- onBlur: E
94
- }
95
- ),
96
- /* @__PURE__ */ r(I, { text: t.label, size: z, checked: n })
97
- ] })
98
- },
99
- i
100
- );
101
- })
102
- }
103
- ),
104
- /* @__PURE__ */ r(k, { name: "message", condition: s === "error" && !!m, children: /* @__PURE__ */ r(y, { text: m, className: o.ErrorMessage }) })
105
- ]
106
- }
107
- );
42
+ const { emitChange: y, handleFocus: E, handleBlur: M } = q({
43
+ id: t,
44
+ disabled: n,
45
+ onChange: h,
46
+ onFocus: v,
47
+ onBlur: L
48
+ }), _ = g(p, "data-testid", "radio"), R = e != null && e !== !1 && e !== "";
49
+ return /* @__PURE__ */ u("div", { "data-testid": _, className: f(o.Radio, { [o.WithLabel]: R }, g(p, "className")), children: [
50
+ U(e, _),
51
+ /* @__PURE__ */ r(
52
+ "div",
53
+ {
54
+ className: f(o.Content, {
55
+ [o.Horizontal]: l === "horizontal",
56
+ [o.Vertical]: l === "vertical"
57
+ }),
58
+ children: C.map((i, H, N) => {
59
+ const s = T(t, i.value, H);
60
+ return /* @__PURE__ */ r(P, { id: s, value: a, state: d, choice: i, choices: N, children: ({ focused: b, hovered: I, checked: m, state: V }) => /* @__PURE__ */ u("div", { className: o.Label, children: [
61
+ /* @__PURE__ */ r(
62
+ j,
63
+ {
64
+ type: "radio",
65
+ size: z,
66
+ state: V,
67
+ checked: m,
68
+ focused: b,
69
+ hovered: I,
70
+ disabled: n
71
+ }
72
+ ),
73
+ /* @__PURE__ */ r(
74
+ w,
75
+ {
76
+ type: "radio",
77
+ id: s,
78
+ value: i.value,
79
+ name: t,
80
+ checked: m,
81
+ disabled: n,
82
+ onChange: (X, W) => y(i.value, W),
83
+ onFocus: E,
84
+ onBlur: M
85
+ }
86
+ ),
87
+ /* @__PURE__ */ r(F, { text: i.label, size: x, checked: m })
88
+ ] }) }, s);
89
+ })
90
+ }
91
+ ),
92
+ /* @__PURE__ */ r($, { name: "message", condition: d === "error" && !!c, children: /* @__PURE__ */ r(B, { text: c, className: o.ErrorMessage }) })
93
+ ] });
108
94
  };
109
95
  export {
110
- ar as Radio
96
+ ct as Radio
111
97
  };
@@ -10,6 +10,7 @@ import { ErrorMessage as k } from "../../primitives/error-message/error-message.
10
10
  import { Label as C } from "../../primitives/label/label.component.js";
11
11
  import "react";
12
12
  import { Input as j } from "../input/input.component.js";
13
+ import "../../../components/text/text.component.js";
13
14
  import '../../../assets/text-field-ycFvAkxr.css';const D = "_TextField_diews_1", O = "_Box_diews_10", q = "_Content_diews_14", y = "_Label_diews_30", z = "_Idle_diews_40", G = "_Active_diews_45", H = "_Placeholder_diews_50", J = "_PlaceholderText_diews_57", K = "_ErrorMessage_diews_65", Q = "_Input_diews_69", R = "_MaskStart_diews_73", e = {
14
15
  TextField: D,
15
16
  Box: O,
@@ -22,7 +23,7 @@ import '../../../assets/text-field-ycFvAkxr.css';const D = "_TextField_diews_1",
22
23
  ErrorMessage: K,
23
24
  Input: Q,
24
25
  MaskStart: R
25
- }, le = ({
26
+ }, ie = ({
26
27
  // Interactive props
27
28
  id: d,
28
29
  value: s = "",
@@ -38,9 +39,9 @@ import '../../../assets/text-field-ycFvAkxr.css';const D = "_TextField_diews_1",
38
39
  message: m = "",
39
40
  placeholder: _ = "",
40
41
  // Base props
41
- ...x
42
+ ...p
42
43
  }) => {
43
- const { value: p, setTrue: T, setFalse: A } = f(!1), { value: a, setTrue: S, setFalse: b } = f(!1), r = a || !!s || p, B = !i && !!_ && a && !s && !p, N = !!m && l === "error", g = (o) => {
44
+ const { value: x, setTrue: T, setFalse: A } = f(!1), { value: a, setTrue: S, setFalse: b } = f(!1), r = a || !!s || x, B = !i && !!_ && a && !s && !x, N = !!m && l === "error", g = (o) => {
44
45
  S(), I?.(o);
45
46
  }, E = (o) => {
46
47
  b(), F?.(o);
@@ -48,8 +49,8 @@ import '../../../assets/text-field-ycFvAkxr.css';const D = "_TextField_diews_1",
48
49
  return /* @__PURE__ */ n(
49
50
  "div",
50
51
  {
51
- "data-testid": u(x, "data-testid", "text-field"),
52
- className: c(e.TextField, u(x, "className")),
52
+ "data-testid": u(p, "data-testid", "text-field"),
53
+ className: c(e.TextField, u(p, "className")),
53
54
  children: [
54
55
  /* @__PURE__ */ n($, { state: l, focused: a, className: e.Box, children: [
55
56
  /* @__PURE__ */ t(
@@ -101,5 +102,5 @@ import '../../../assets/text-field-ycFvAkxr.css';const D = "_TextField_diews_1",
101
102
  );
102
103
  };
103
104
  export {
104
- le as TextField
105
+ ie as TextField
105
106
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arthurzakharov/ui-kit",
3
3
  "private": false,
4
- "version": "3.14.0",
4
+ "version": "3.15.0",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -1 +0,0 @@
1
- ._Radio_rt0wk_1{display:inline-flex;flex-direction:column}._Content_rt0wk_6{display:inline-flex}._Horizontal_rt0wk_10{flex-direction:row;gap:var(--rm-ui-padding-lg)}._Vertical_rt0wk_15{flex-direction:column;gap:var(--rm-ui-padding-xxs)}._Label_rt0wk_20{position:relative;display:inline-flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rm-ui-padding-xs)}._Label_rt0wk_20:hover{cursor:pointer}._ErrorMessage_rt0wk_33{padding-top:var(--rm-ui-padding-xxs)}