@spear-ai/spectral 1.3.44 → 1.3.45
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/dist/Input.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'id'> & Bas
|
|
|
8
8
|
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
9
9
|
prefix?: string;
|
|
10
10
|
showClearButton?: boolean;
|
|
11
|
+
suppressHydrationWarning?: boolean;
|
|
11
12
|
type?: InputType;
|
|
12
13
|
value?: string;
|
|
13
14
|
};
|
|
@@ -18,6 +19,7 @@ export declare const Input: import('react').ForwardRefExoticComponent<Omit<Input
|
|
|
18
19
|
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
19
20
|
prefix?: string;
|
|
20
21
|
showClearButton?: boolean;
|
|
22
|
+
suppressHydrationWarning?: boolean;
|
|
21
23
|
type?: InputType;
|
|
22
24
|
value?: string;
|
|
23
25
|
} & import('react').RefAttributes<HTMLInputElement>>;
|
package/dist/Input.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
3
|
import { jsx as t, jsxs as I } from "react/jsx-runtime";
|
|
4
|
-
import { usePasswordVisibility as
|
|
4
|
+
import { usePasswordVisibility as U, usePrefixWidth as X, useClearOnFocus as Y } from "./Input/InputUtils.js";
|
|
5
5
|
import "./Icons/AnnotationsIcon.js";
|
|
6
6
|
import "./Icons/CalendarIcon.js";
|
|
7
|
-
import { CheckCircleIcon as
|
|
7
|
+
import { CheckCircleIcon as Z } from "./Icons/CheckCircleIcon.js";
|
|
8
8
|
import "./Icons/CheckSquareIcon.js";
|
|
9
9
|
import "./Icons/ChevronDownIcon.js";
|
|
10
10
|
import "./Icons/ChevronUpIcon.js";
|
|
11
11
|
import "./Icons/ClockIcon.js";
|
|
12
|
-
import { CloseCircleIcon as
|
|
12
|
+
import { CloseCircleIcon as _ } from "./Icons/CloseCircleIcon.js";
|
|
13
13
|
import "./Icons/CloseIcon.js";
|
|
14
14
|
import "./Icons/DashboardIcon.js";
|
|
15
15
|
import "./Icons/DeleteIcon.js";
|
|
16
16
|
import "./Icons/DurationIcon.js";
|
|
17
17
|
import "./Icons/EraserIcon.js";
|
|
18
|
-
import { ErrorIcon as
|
|
19
|
-
import { EyeClosedIcon as
|
|
18
|
+
import { ErrorIcon as q } from "./Icons/ErrorIcon.js";
|
|
19
|
+
import { EyeClosedIcon as tt } from "./Icons/EyeClosedIcon.js";
|
|
20
20
|
import "./Icons/EyeClosedIcon2.js";
|
|
21
|
-
import { EyeOpenIcon as
|
|
21
|
+
import { EyeOpenIcon as et } from "./Icons/EyeOpenIcon.js";
|
|
22
22
|
import "./Icons/GoToFirstIcon.js";
|
|
23
23
|
import "./Icons/GoToLastIcon.js";
|
|
24
24
|
import "./Icons/HarmonicCursorsIcon.js";
|
|
@@ -27,7 +27,7 @@ import "./Icons/LabelIcon.js";
|
|
|
27
27
|
import "./Icons/LassoIcon.js";
|
|
28
28
|
import "./Icons/LineToolIcon.js";
|
|
29
29
|
import "./Icons/LiveViewIcon.js";
|
|
30
|
-
import { LoaderIcon as
|
|
30
|
+
import { LoaderIcon as rt } from "./Icons/LoaderIcon.js";
|
|
31
31
|
import "./Icons/LocationIcon.js";
|
|
32
32
|
import "./Icons/LogoutIcon.js";
|
|
33
33
|
import "./Icons/MetadataIcon.js";
|
|
@@ -45,10 +45,10 @@ import "./Icons/WarningIcon.js";
|
|
|
45
45
|
import "./Icons/ZoomAllIcon.js";
|
|
46
46
|
import "./Icons/ZoomXIcon.js";
|
|
47
47
|
import "./Icons/ZoomYIcon.js";
|
|
48
|
-
import { useFormFieldId as
|
|
48
|
+
import { useFormFieldId as ot, getAriaProps as it, getInputClasses as st, useFormFieldState as at, getFormFieldCSSProperties as nt, ErrorMessage as pt } from "./utils/formFieldUtils.js";
|
|
49
49
|
import { c as N } from "./twUtils-CRiPKpXj.js";
|
|
50
|
-
import { forwardRef as
|
|
51
|
-
const
|
|
50
|
+
import { forwardRef as lt, useRef as ct, useCallback as m } from "react";
|
|
51
|
+
const mt = (p) => ({
|
|
52
52
|
email: "email",
|
|
53
53
|
password: "current-password",
|
|
54
54
|
tel: "tel",
|
|
@@ -57,7 +57,7 @@ const ct = (p) => ({
|
|
|
57
57
|
number: "off",
|
|
58
58
|
date: "off",
|
|
59
59
|
"datetime-local": "off"
|
|
60
|
-
})[p] || "off",
|
|
60
|
+
})[p] || "off", dt = lt(
|
|
61
61
|
({
|
|
62
62
|
className: p,
|
|
63
63
|
clearOnFocus: d = !1,
|
|
@@ -71,39 +71,40 @@ const ct = (p) => ({
|
|
|
71
71
|
onFocus: C,
|
|
72
72
|
prefix: a,
|
|
73
73
|
showClearButton: z = !1,
|
|
74
|
+
suppressHydrationWarning: P = !0,
|
|
74
75
|
state: e = "default",
|
|
75
76
|
type: n = "text",
|
|
76
77
|
value: g = "",
|
|
77
78
|
required: x,
|
|
78
|
-
"aria-label":
|
|
79
|
-
"aria-describedby":
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
const l =
|
|
79
|
+
"aria-label": R,
|
|
80
|
+
"aria-describedby": $,
|
|
81
|
+
...k
|
|
82
|
+
}, S) => {
|
|
83
|
+
const l = ot(E, f), w = `${l}-error`, { isDisabled: V, isLoading: M, isInvalid: O } = at(F, e), j = it(e, x, w, $), A = ct(null), r = S || A, { isVisible: c, toggleVisibility: B, inputType: H } = U(), { prefixWidth: L, prefixRef: W } = X(a), { handleFocus: y } = Y(d, b), D = m(
|
|
83
84
|
(o) => {
|
|
84
85
|
h?.(o);
|
|
85
86
|
},
|
|
86
87
|
[h]
|
|
87
|
-
),
|
|
88
|
+
), T = m(
|
|
88
89
|
(o) => {
|
|
89
90
|
y(o, C);
|
|
90
91
|
},
|
|
91
92
|
[y, C]
|
|
92
|
-
),
|
|
93
|
+
), G = m(() => {
|
|
93
94
|
r.current && (r.current.value = "", r.current.dispatchEvent(new Event("input", { bubbles: !0 })), r.current.focus());
|
|
94
|
-
}, [r]), v = z && g.length > 0,
|
|
95
|
+
}, [r]), v = z && g.length > 0, J = () => {
|
|
95
96
|
const o = "absolute right-4 top-1/2 -translate-y-1/2 text-input-icon hover:text-input-icon--hover focus:outline-none cursor-pointer", s = {
|
|
96
97
|
password: () => /* @__PURE__ */ t(
|
|
97
98
|
"button",
|
|
98
99
|
{
|
|
99
100
|
className: o,
|
|
100
101
|
type: "button",
|
|
101
|
-
onClick:
|
|
102
|
+
onClick: B,
|
|
102
103
|
"aria-label": c ? `Hide ${i}` : `Show ${i}`,
|
|
103
104
|
"aria-pressed": c,
|
|
104
105
|
"aria-controls": l,
|
|
105
106
|
"data-testid": "input-password-toggle",
|
|
106
|
-
children: c ? /* @__PURE__ */ t(
|
|
107
|
+
children: c ? /* @__PURE__ */ t(tt, { size: 22 }) : /* @__PURE__ */ t(et, { size: 22 })
|
|
107
108
|
}
|
|
108
109
|
),
|
|
109
110
|
clear: () => /* @__PURE__ */ t(
|
|
@@ -111,60 +112,61 @@ const ct = (p) => ({
|
|
|
111
112
|
{
|
|
112
113
|
className: o,
|
|
113
114
|
type: "button",
|
|
114
|
-
onClick:
|
|
115
|
+
onClick: G,
|
|
115
116
|
"aria-label": `Clear ${i}`,
|
|
116
117
|
"data-testid": "input-clear-button",
|
|
117
|
-
children: /* @__PURE__ */ t(
|
|
118
|
+
children: /* @__PURE__ */ t(_, { size: 24 })
|
|
118
119
|
}
|
|
119
120
|
),
|
|
120
|
-
loading: () => /* @__PURE__ */ t("div", { className: "absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "input-loading-icon", children: /* @__PURE__ */ t(
|
|
121
|
-
error: () => /* @__PURE__ */ t("div", { className: "text-danger-400 absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "input-error-icon", children: /* @__PURE__ */ t(
|
|
122
|
-
success: () => /* @__PURE__ */ t("div", { className: "text-success-400 absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "input-success-icon", children: /* @__PURE__ */ t(
|
|
121
|
+
loading: () => /* @__PURE__ */ t("div", { className: "absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "input-loading-icon", children: /* @__PURE__ */ t(rt, { size: 24 }) }),
|
|
122
|
+
error: () => /* @__PURE__ */ t("div", { className: "text-danger-400 absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "input-error-icon", children: /* @__PURE__ */ t(q, { size: 24 }) }),
|
|
123
|
+
success: () => /* @__PURE__ */ t("div", { className: "text-success-400 absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "input-success-icon", children: /* @__PURE__ */ t(Z, { size: 24 }) })
|
|
123
124
|
};
|
|
124
|
-
return n === "password" ? s.password() : v ? s.clear() :
|
|
125
|
-
},
|
|
126
|
-
|
|
125
|
+
return n === "password" ? s.password() : v ? s.clear() : M ? s.loading() : e === "success" ? s.success() : e === "error" ? s.error() : null;
|
|
126
|
+
}, K = N(
|
|
127
|
+
st(e, p),
|
|
127
128
|
"[text-indent:var(--prefix-width)]",
|
|
128
129
|
v && "pr-10"
|
|
129
|
-
),
|
|
130
|
+
), Q = N(
|
|
130
131
|
"pointer-events-none absolute inset-y-0 left-4 flex items-center text-base text-input-text-prefix opacity-100 peer-disabled:opacity-50"
|
|
131
132
|
);
|
|
132
133
|
return /* @__PURE__ */ t("div", { className: "w-full space-y-1.5", "data-testid": "input-root", children: /* @__PURE__ */ I("div", { className: "relative", "data-testid": "input-wrapper", children: [
|
|
133
134
|
/* @__PURE__ */ I("div", { className: "relative", children: [
|
|
134
|
-
a && /* @__PURE__ */ t("span", { ref:
|
|
135
|
+
a && /* @__PURE__ */ t("span", { ref: W, className: Q, children: a }),
|
|
135
136
|
/* @__PURE__ */ t(
|
|
136
137
|
"input",
|
|
137
138
|
{
|
|
138
139
|
id: l,
|
|
139
140
|
name: f,
|
|
140
141
|
ref: r,
|
|
141
|
-
type: n === "password" ?
|
|
142
|
+
type: n === "password" ? H : n,
|
|
142
143
|
value: g,
|
|
143
|
-
disabled:
|
|
144
|
+
disabled: V,
|
|
144
145
|
required: x,
|
|
145
|
-
autoComplete:
|
|
146
|
-
className:
|
|
146
|
+
autoComplete: mt(n),
|
|
147
|
+
className: K,
|
|
147
148
|
onChange: b,
|
|
148
|
-
onFocus:
|
|
149
|
-
onBlur:
|
|
149
|
+
onFocus: T,
|
|
150
|
+
onBlur: D,
|
|
150
151
|
placeholder: i,
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
suppressHydrationWarning: P,
|
|
153
|
+
...j,
|
|
154
|
+
...k,
|
|
153
155
|
"data-testid": "input-input",
|
|
154
156
|
"data-state": e,
|
|
155
|
-
style:
|
|
156
|
-
"--prefix-width": a ? `${
|
|
157
|
+
style: nt({
|
|
158
|
+
"--prefix-width": a ? `${L}px` : "0px"
|
|
157
159
|
}),
|
|
158
|
-
"aria-label":
|
|
160
|
+
"aria-label": R || i
|
|
159
161
|
}
|
|
160
162
|
),
|
|
161
|
-
|
|
163
|
+
J()
|
|
162
164
|
] }),
|
|
163
|
-
|
|
165
|
+
O && u && /* @__PURE__ */ t(pt, { id: w, message: u })
|
|
164
166
|
] }) });
|
|
165
167
|
}
|
|
166
168
|
);
|
|
167
|
-
|
|
169
|
+
dt.displayName = "Input";
|
|
168
170
|
export {
|
|
169
|
-
|
|
171
|
+
dt as Input
|
|
170
172
|
};
|
|
@@ -8,6 +8,7 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'id'> & Bas
|
|
|
8
8
|
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
9
9
|
prefix?: string;
|
|
10
10
|
showClearButton?: boolean;
|
|
11
|
+
suppressHydrationWarning?: boolean;
|
|
11
12
|
type?: InputType;
|
|
12
13
|
value?: string;
|
|
13
14
|
};
|
|
@@ -18,6 +19,7 @@ export declare const Input: import('react').ForwardRefExoticComponent<Omit<Input
|
|
|
18
19
|
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
19
20
|
prefix?: string;
|
|
20
21
|
showClearButton?: boolean;
|
|
22
|
+
suppressHydrationWarning?: boolean;
|
|
21
23
|
type?: InputType;
|
|
22
24
|
value?: string;
|
|
23
25
|
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,mBAAmB,EAGzB,MAAM,OAAO,CAAA;AAEd,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,gBAAgB,CAAA;AAE5G,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC,GACxE,kBAAkB,GAAG;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IAClD,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAgBH,eAAO,MAAM,KAAK;
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAK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