@reportportal/ui-kit 0.0.1-alpha.242 → 0.0.1-alpha.243

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,14 @@
1
+ import { useState as r, useEffect as c } from "react";
2
+ const i = () => {
3
+ const [a, o] = r(!1);
4
+ return c(() => {
5
+ const s = (e) => {
6
+ var t;
7
+ e.key === "CapsLock" ? o((n) => !n) : o(((t = e.getModifierState) == null ? void 0 : t.call(e, "CapsLock")) ?? !1);
8
+ };
9
+ return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
10
+ }, []), { capsLockOn: a };
11
+ };
12
+ export {
13
+ i as u
14
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/ui-kit",
3
- "version": "0.0.1-alpha.242",
3
+ "version": "0.0.1-alpha.243",
4
4
  "description": "The UI-kit library for ReportPortal Design System.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -9,6 +9,7 @@
9
9
  "build:storybook": "storybook build",
10
10
  "type-check": "tsc --noEmit",
11
11
  "lint": "npm run type-check && eslint \"src/**/*.{js,jsx,ts,tsx}\"",
12
+ "deps:cycles": "madge --circular src/",
12
13
  "format": "npm run lint -- --fix",
13
14
  "test": "vitest",
14
15
  "test:coverage": "vitest run --coverage",
@@ -94,6 +95,7 @@
94
95
  "husky": "^8.0.3",
95
96
  "jsdom": "^25.0.1",
96
97
  "lint-staged": "^13.2.3",
98
+ "madge": "^8.0.0",
97
99
  "prettier": "^3.0.1",
98
100
  "react": "18.2.0",
99
101
  "react-dom": "18.2.0",
@@ -101,6 +103,7 @@
101
103
  "storybook": "^8.6.14",
102
104
  "typescript": "^5.0.2",
103
105
  "vite": "^4.5.14",
106
+ "vite-plugin-circular-dependency": "^0.6.0",
104
107
  "vite-plugin-dts": "^3.4.0",
105
108
  "vite-plugin-svgr": "^3.2.0",
106
109
  "vite-tsconfig-paths": "^4.2.0",
@@ -1,167 +0,0 @@
1
- import { jsx as n, jsxs as s, Fragment as E } from "react/jsx-runtime";
2
- import { forwardRef as W, useRef as X, useId as Y, useState as b } from "react";
3
- import { c as Z } from "./bind-06a7ff84.js";
4
- import { S as q } from "./clear-53660571.js";
5
- import { a as nn, S as en } from "./openedEye-8fa4c67d.js";
6
- import { B as tn } from "./baseIconButton-251479f7.js";
7
- import { S as on } from "./spinLoader-c4a53718.js";
8
- import { M as sn } from "./maxValueDisplay-9be01a75.js";
9
- import { FieldLabel as an } from "./fieldLabel.js";
10
- const cn = "_collapsed_18d9y_11", rn = "_field_18d9y_23", dn = "_placeholder_18d9y_48", ln = "_disabled_18d9y_51", _n = "_error_18d9y_54", pn = "_touched_18d9y_54", un = "_input_18d9y_73", mn = "_icon_18d9y_1", fn = "_text_18d9y_171", hn = {
11
- "icon-container": "_icon-container_18d9y_1",
12
- "icon-container-additional": "_icon-container-additional_18d9y_1",
13
- "icon-container-end": "_icon-container-end_18d9y_1",
14
- "icon-container-start": "_icon-container-start_18d9y_1",
15
- collapsed: cn,
16
- field: rn,
17
- "default-width": "_default-width_18d9y_35",
18
- placeholder: dn,
19
- disabled: ln,
20
- error: _n,
21
- touched: pn,
22
- "max-length-display": "_max-length-display_18d9y_61",
23
- "input-container": "_input-container_18d9y_73",
24
- "type-password": "_type-password_18d9y_77",
25
- input: un,
26
- "eye-icon": "_eye-icon_18d9y_81",
27
- icon: mn,
28
- "start-icon": "_start-icon_18d9y_127",
29
- "clear-icon": "_clear-icon_18d9y_128",
30
- "additional-content": "_additional-content_18d9y_164",
31
- text: fn,
32
- "error-text": "_error-text_18d9y_191",
33
- "help-text": "_help-text_18d9y_195"
34
- }, e = Z.bind(hn), Bn = W(
35
- ({
36
- value: o = "",
37
- className: v,
38
- classNameHelpText: C,
39
- error: r,
40
- placeholder: u,
41
- disabled: a = !1,
42
- onChange: T,
43
- touched: m = !1,
44
- title: V,
45
- label: d,
46
- helpText: l,
47
- defaultWidth: k = !0,
48
- startIcon: f,
49
- endIcon: h,
50
- clearable: I = !1,
51
- onClear: y,
52
- isRequired: x = !1,
53
- hasDoubleMessage: L = !1,
54
- type: c = "text",
55
- displayError: P = !0,
56
- collapsible: R = !1,
57
- loading: j = !1,
58
- maxLengthDisplay: H,
59
- onFocus: O = () => {
60
- },
61
- onBlur: U = () => {
62
- },
63
- ...$
64
- }, z) => {
65
- const A = X(null), _ = z || A, w = Y(), [N, g] = b(!1), [S, F] = b(!1), G = (t) => {
66
- g(!0), O(t);
67
- }, J = (t) => {
68
- g(!1), U(t);
69
- }, K = () => {
70
- var t;
71
- y && (y(o), (t = _.current) == null || t.focus());
72
- }, D = P && r && m, M = /* @__PURE__ */ n("span", { className: e("text", "help-text", C), children: l }), Q = () => c !== "password" ? c : S ? "text" : "password", B = (t) => {
73
- t.preventDefault(), F(!0);
74
- }, i = (t) => {
75
- t.preventDefault(), F(!1);
76
- };
77
- return /* @__PURE__ */ s(E, { children: [
78
- d && /* @__PURE__ */ n(an, { isRequired: x, htmlFor: w, children: d }),
79
- /* @__PURE__ */ s(
80
- "div",
81
- {
82
- className: e("field", v, {
83
- error: r,
84
- touched: m,
85
- disabled: a,
86
- "default-width": k,
87
- collapsed: R && !N && !o
88
- }),
89
- title: V,
90
- children: [
91
- j ? /* @__PURE__ */ n(on, {}) : f && /* @__PURE__ */ n(
92
- "span",
93
- {
94
- className: e("icon-container-start"),
95
- onClick: () => {
96
- var p;
97
- (p = _.current) == null || p.focus();
98
- },
99
- children: /* @__PURE__ */ n("span", { className: e("icon", { "start-icon": !N }), children: f })
100
- }
101
- ),
102
- /* @__PURE__ */ s("span", { className: e("input-container", `type-${c}`), children: [
103
- /* @__PURE__ */ n(
104
- "input",
105
- {
106
- ref: _,
107
- type: Q(),
108
- className: e("input"),
109
- value: o,
110
- disabled: a,
111
- id: w,
112
- onChange: T,
113
- onFocus: G,
114
- onBlur: J,
115
- ...$
116
- }
117
- ),
118
- c === "password" && o && /* @__PURE__ */ n(
119
- tn,
120
- {
121
- className: e("eye-icon"),
122
- onMouseDown: B,
123
- onMouseLeave: i,
124
- onMouseUp: i,
125
- onTouchStart: B,
126
- onTouchEnd: i,
127
- onTouchCancel: i,
128
- children: S ? /* @__PURE__ */ n(nn, {}) : /* @__PURE__ */ n(en, {})
129
- }
130
- ),
131
- u && !o && /* @__PURE__ */ s("span", { className: e("placeholder"), children: [
132
- u,
133
- x && !d && /* @__PURE__ */ n("span", { className: e("asterisk") })
134
- ] })
135
- ] }),
136
- /* @__PURE__ */ n(
137
- sn,
138
- {
139
- className: e("max-length-display"),
140
- value: o.length,
141
- maxValue: H
142
- }
143
- ),
144
- I && o.length > 0 && /* @__PURE__ */ n("span", { className: e("icon-container-end"), children: /* @__PURE__ */ n(
145
- "button",
146
- {
147
- type: "button",
148
- className: e("clear-icon", { disabled: a }),
149
- onClick: K,
150
- onMouseDown: (t) => t.preventDefault(),
151
- children: /* @__PURE__ */ n(q, {})
152
- }
153
- ) }),
154
- h && /* @__PURE__ */ n("span", { className: e("icon-container-end"), children: /* @__PURE__ */ n("span", { className: e("icon"), children: h }) })
155
- ]
156
- }
157
- ),
158
- (D || l) && /* @__PURE__ */ n("div", { className: e("additional-content", { disabled: a }), children: D ? /* @__PURE__ */ s(E, { children: [
159
- /* @__PURE__ */ n("span", { className: e("text", "error-text"), children: r }),
160
- L && M
161
- ] }) : l && M })
162
- ] });
163
- }
164
- );
165
- export {
166
- Bn as F
167
- };