@arthurzakharov/ui-kit 3.18.0 → 3.19.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
+ ._TextArea_15g66_1{display:flex;flex-direction:column}._Input_15g66_6{resize:none;outline:none;box-sizing:border-box;width:100%;border:none;border-radius:10px;padding:var(--rm-ui-padding-xs) var(--rm-ui-padding-sm);font-weight:var(--rm-ui-font-weight-medium);font-size:var(--rm-ui-font-size-body);line-height:var(--rm-ui-line-height-body);color:var(--rm-ui-color-text-primary)}._Input_15g66_6:hover{cursor:pointer}._Input_15g66_6:disabled{opacity:.33}._ErrorMessage_15g66_28{padding-top:var(--rm-ui-padding-xxs)}._FieldGroup_15g66_32{display:flex;flex-direction:column;gap:var(--rm-ui-padding-xs);width:100%}
@@ -1,8 +1,10 @@
1
1
  import { Interactive } from '../../utils';
2
2
  import { Base } from '../../../utils/types';
3
+ export type TextAreaPlaceholderPosition = 'inside' | 'outside';
3
4
  export interface TextAreaProps extends Base, Interactive<string> {
4
5
  placeholder?: string;
6
+ placeholderPosition?: TextAreaPlaceholderPosition;
5
7
  rows?: number;
6
8
  message?: string;
7
9
  }
8
- export declare const TextArea: ({ id, value, disabled, state, onChange, onFocus, onBlur, placeholder, rows, message, ...base }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const TextArea: ({ id, value, disabled, state, onChange, onFocus, onBlur, placeholder, placeholderPosition, rows, message, ...base }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,64 +1,70 @@
1
- import { jsxs as M, jsx as r } from "react/jsx-runtime";
2
- import { baseProps as t, clsx as N } from "../../../utils/functions/functions.util.js";
3
- import { FadeSlide as _ } from "../../../animations/fade-slide/fade-slide.component.js";
4
- import { Box as I } from "../../primitives/box/box.component.js";
1
+ import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
+ import { baseProps as s, clsx as B } from "../../../utils/functions/functions.util.js";
3
+ import { FadeSlide as C } from "../../../animations/fade-slide/fade-slide.component.js";
4
+ import { Box as G } from "../../primitives/box/box.component.js";
5
5
  import "../../../utils/content/content.component.js";
6
6
  import "lucide-react";
7
- import { ErrorMessage as C } from "../../primitives/error-message/error-message.component.js";
7
+ import { ErrorMessage as y } from "../../primitives/error-message/error-message.component.js";
8
8
  import "usehooks-ts";
9
- import { useControlInteraction as k } from "../../utils/hooks/use-control-interaction/use-control-interaction.hook.js";
10
- import '../../../assets/text-area-Dgc2jHSx.css';const B = "_Input_11gck_6", F = "_ErrorMessage_11gck_28", a = {
11
- Input: B,
12
- ErrorMessage: F
13
- }, w = ({
9
+ import { Text as b } from "../../../components/text/text.component.js";
10
+ import { useControlInteraction as j } from "../../utils/hooks/use-control-interaction/use-control-interaction.hook.js";
11
+ import '../../../assets/text-area-aZwGK7CT.css';const O = "_Input_15g66_6", T = "_ErrorMessage_15g66_28", $ = "_FieldGroup_15g66_32", t = {
12
+ Input: O,
13
+ ErrorMessage: T,
14
+ FieldGroup: $
15
+ }, J = ({
14
16
  // Interactive props
15
- id: o,
16
- value: c,
17
- disabled: s = !1,
17
+ id: a,
18
+ value: u,
19
+ disabled: i = !1,
18
20
  state: n = "idle",
19
- onChange: i,
20
- onFocus: l,
21
- onBlur: d,
21
+ onChange: g,
22
+ onFocus: x,
23
+ onBlur: f,
22
24
  // TextArea props
23
- placeholder: p = "",
24
- rows: u = 5,
25
- message: m = "",
25
+ placeholder: r = "",
26
+ placeholderPosition: h = "inside",
27
+ rows: _ = 5,
28
+ message: d = "",
26
29
  // Base props
27
- ...e
30
+ ...o
28
31
  }) => {
29
- const { focused: g, emitChange: x, handleFocus: f, handleBlur: h } = k({
30
- id: o,
31
- disabled: s,
32
- onChange: i,
33
- onFocus: l,
34
- onBlur: d
35
- });
36
- return /* @__PURE__ */ M(
32
+ const { focused: F, emitChange: N, handleFocus: E, handleBlur: I } = j({
33
+ id: a,
34
+ disabled: i,
35
+ onChange: g,
36
+ onFocus: x,
37
+ onBlur: f
38
+ }), m = s(o, "data-testid", "textarea"), c = h === "outside", M = c && !!r, l = /* @__PURE__ */ e(G, { state: n, focused: F, className: s(o, "className"), children: /* @__PURE__ */ e(
39
+ "textarea",
40
+ {
41
+ "data-testid": "textarea-input",
42
+ disabled: i,
43
+ id: a,
44
+ rows: _,
45
+ placeholder: c ? "" : r,
46
+ value: u,
47
+ className: t.Input,
48
+ onChange: (v) => N(v.target.value, "keyboard"),
49
+ onFocus: () => E(),
50
+ onBlur: () => I()
51
+ }
52
+ ) });
53
+ return /* @__PURE__ */ p(
37
54
  "div",
38
55
  {
39
- "data-testid": t(e, "data-testid", "textarea"),
40
- className: N(a.Container, t(e, "className")),
56
+ "data-testid": m,
57
+ className: B(t.Container, s(o, "className")),
41
58
  children: [
42
- /* @__PURE__ */ r(I, { state: n, focused: g, className: t(e, "className"), children: /* @__PURE__ */ r(
43
- "textarea",
44
- {
45
- "data-testid": "textarea-input",
46
- disabled: s,
47
- id: o,
48
- rows: u,
49
- placeholder: p,
50
- value: c,
51
- className: a.Input,
52
- onChange: (E) => x(E.target.value, "keyboard"),
53
- onFocus: () => f(),
54
- onBlur: () => h()
55
- }
56
- ) }),
57
- /* @__PURE__ */ r(_, { name: "text-message", condition: n === "error" && !!m, children: /* @__PURE__ */ r(C, { "data-testid": "textarea-error-message", text: m, className: a.ErrorMessage }) })
59
+ M ? /* @__PURE__ */ p("div", { className: t.FieldGroup, children: [
60
+ /* @__PURE__ */ e(b, { tag: "div", weight: "medium", size: "body", color: "text-primary", "data-testid": `${m}-label`, children: r }),
61
+ l
62
+ ] }) : l,
63
+ /* @__PURE__ */ e(C, { name: "text-message", condition: n === "error" && !!d, children: /* @__PURE__ */ e(y, { "data-testid": "textarea-error-message", text: d, className: t.ErrorMessage }) })
58
64
  ]
59
65
  }
60
66
  );
61
67
  };
62
68
  export {
63
- w as TextArea
69
+ J as TextArea
64
70
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arthurzakharov/ui-kit",
3
3
  "private": false,
4
- "version": "3.18.0",
4
+ "version": "3.19.0",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -1 +0,0 @@
1
- ._TextArea_11gck_1{display:flex;flex-direction:column}._Input_11gck_6{resize:none;outline:none;box-sizing:border-box;width:100%;border:none;border-radius:10px;padding:var(--rm-ui-padding-xs) var(--rm-ui-padding-sm);font-weight:var(--rm-ui-font-weight-medium);font-size:var(--rm-ui-font-size-body);line-height:var(--rm-ui-line-height-body);color:var(--rm-ui-color-text-primary)}._Input_11gck_6:hover{cursor:pointer}._Input_11gck_6:disabled{opacity:.33}._ErrorMessage_11gck_28{padding-top:var(--rm-ui-padding-xxs)}