@hybridcore/ui 1.1.2 → 1.1.3
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/components/search-input/index.js +119 -48
- package/dist/main.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,76 +1,147 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { Close as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import k, { useState as O } from "react";
|
|
3
|
+
import { Close as m, Search as u } from "@mui/icons-material";
|
|
4
|
+
import { FilledInput as b, Input as R } from "@mui/material";
|
|
5
|
+
import { F as _, I as j, a as g } from "../../FormControl-BiAFm76F.js";
|
|
6
|
+
import { O as v } from "../../OutlinedInput-BEVE8VZQ.js";
|
|
7
|
+
import { I as t } from "../../IconButton-CQJ8wZE8.js";
|
|
7
8
|
const z = ({
|
|
8
|
-
defaultValue:
|
|
9
|
-
label:
|
|
10
|
-
placeholder:
|
|
11
|
-
disableLabel:
|
|
12
|
-
fullWidth:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
o
|
|
9
|
+
defaultValue: x = "",
|
|
10
|
+
label: C = "Search",
|
|
11
|
+
placeholder: i,
|
|
12
|
+
disableLabel: I = !1,
|
|
13
|
+
fullWidth: w = !1,
|
|
14
|
+
variant: l = "outlined",
|
|
15
|
+
size: A = "small",
|
|
16
|
+
iconSize: n = "medium",
|
|
17
|
+
sx: D,
|
|
18
|
+
onChange: y,
|
|
19
|
+
onSubmit: a
|
|
20
|
+
}, F) => {
|
|
21
|
+
const [r, h] = O(x), c = (o) => {
|
|
22
|
+
h(o.target.value), y && y(o.target.value);
|
|
23
|
+
}, d = (o) => {
|
|
24
|
+
a && a(r);
|
|
25
|
+
}, p = (o) => {
|
|
26
|
+
o.key === "Enter" && d();
|
|
27
|
+
}, K = () => {
|
|
28
|
+
h("");
|
|
26
29
|
};
|
|
27
|
-
|
|
30
|
+
k.useImperativeHandle(F, () => ({
|
|
28
31
|
reset() {
|
|
29
|
-
|
|
32
|
+
K();
|
|
30
33
|
}
|
|
31
34
|
}));
|
|
32
|
-
const
|
|
33
|
-
|
|
35
|
+
const f = () => {
|
|
36
|
+
h(""), a && a("");
|
|
34
37
|
};
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
!
|
|
37
|
-
/* @__PURE__ */ e(
|
|
38
|
-
|
|
38
|
+
return /* @__PURE__ */ s(_, { sx: D, size: A, variant: l, fullWidth: w, children: [
|
|
39
|
+
!I && /* @__PURE__ */ e(j, { htmlFor: "search-input", children: C }),
|
|
40
|
+
l === "outlined" && /* @__PURE__ */ e(
|
|
41
|
+
v,
|
|
39
42
|
{
|
|
40
43
|
id: "search-input",
|
|
41
44
|
type: "text",
|
|
42
|
-
label:
|
|
43
|
-
value:
|
|
44
|
-
placeholder:
|
|
45
|
-
onChange:
|
|
46
|
-
onKeyDown:
|
|
47
|
-
endAdornment: /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
label: I ? "" : C,
|
|
46
|
+
value: r,
|
|
47
|
+
placeholder: i,
|
|
48
|
+
onChange: c,
|
|
49
|
+
onKeyDown: p,
|
|
50
|
+
endAdornment: /* @__PURE__ */ s(g, { position: "end", children: [
|
|
51
|
+
r.length > 0 && /* @__PURE__ */ e(
|
|
52
|
+
t,
|
|
50
53
|
{
|
|
51
54
|
"aria-label": "search",
|
|
52
|
-
onClick:
|
|
55
|
+
onClick: f,
|
|
53
56
|
edge: "end",
|
|
54
|
-
size:
|
|
57
|
+
size: n,
|
|
55
58
|
color: "error",
|
|
56
|
-
children: /* @__PURE__ */ e(
|
|
59
|
+
children: /* @__PURE__ */ e(m, { fontSize: n })
|
|
57
60
|
}
|
|
58
61
|
),
|
|
59
62
|
/* @__PURE__ */ e(
|
|
60
|
-
|
|
63
|
+
t,
|
|
61
64
|
{
|
|
62
65
|
"aria-label": "search",
|
|
63
66
|
onClick: d,
|
|
64
67
|
edge: "end",
|
|
65
|
-
size:
|
|
66
|
-
children: /* @__PURE__ */ e(
|
|
68
|
+
size: n,
|
|
69
|
+
children: /* @__PURE__ */ e(u, { fontSize: n })
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] })
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
l === "filled" && /* @__PURE__ */ e(
|
|
76
|
+
b,
|
|
77
|
+
{
|
|
78
|
+
id: "search-input",
|
|
79
|
+
type: "text",
|
|
80
|
+
value: r,
|
|
81
|
+
placeholder: i,
|
|
82
|
+
onChange: c,
|
|
83
|
+
onKeyDown: p,
|
|
84
|
+
endAdornment: /* @__PURE__ */ s(g, { position: "end", children: [
|
|
85
|
+
r.length > 0 && /* @__PURE__ */ e(
|
|
86
|
+
t,
|
|
87
|
+
{
|
|
88
|
+
"aria-label": "search",
|
|
89
|
+
onClick: f,
|
|
90
|
+
edge: "end",
|
|
91
|
+
size: n,
|
|
92
|
+
color: "error",
|
|
93
|
+
children: /* @__PURE__ */ e(m, { fontSize: n })
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ e(
|
|
97
|
+
t,
|
|
98
|
+
{
|
|
99
|
+
"aria-label": "search",
|
|
100
|
+
onClick: d,
|
|
101
|
+
edge: "end",
|
|
102
|
+
size: n,
|
|
103
|
+
children: /* @__PURE__ */ e(u, { fontSize: n })
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] })
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
l === "standard" && /* @__PURE__ */ e(
|
|
110
|
+
R,
|
|
111
|
+
{
|
|
112
|
+
id: "search-input",
|
|
113
|
+
type: "text",
|
|
114
|
+
value: r,
|
|
115
|
+
placeholder: i,
|
|
116
|
+
onChange: c,
|
|
117
|
+
onKeyDown: p,
|
|
118
|
+
endAdornment: /* @__PURE__ */ s(g, { position: "end", children: [
|
|
119
|
+
r.length > 0 && /* @__PURE__ */ e(
|
|
120
|
+
t,
|
|
121
|
+
{
|
|
122
|
+
"aria-label": "search",
|
|
123
|
+
onClick: f,
|
|
124
|
+
edge: "end",
|
|
125
|
+
size: n,
|
|
126
|
+
color: "error",
|
|
127
|
+
children: /* @__PURE__ */ e(m, { fontSize: n })
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ e(
|
|
131
|
+
t,
|
|
132
|
+
{
|
|
133
|
+
"aria-label": "search",
|
|
134
|
+
onClick: d,
|
|
135
|
+
edge: "end",
|
|
136
|
+
size: n,
|
|
137
|
+
children: /* @__PURE__ */ e(u, { fontSize: n })
|
|
67
138
|
}
|
|
68
139
|
)
|
|
69
140
|
] })
|
|
70
141
|
}
|
|
71
142
|
)
|
|
72
143
|
] });
|
|
73
|
-
},
|
|
144
|
+
}, L = k.forwardRef(z);
|
|
74
145
|
export {
|
|
75
|
-
|
|
146
|
+
L as SearchInput
|
|
76
147
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -590,6 +590,8 @@ declare interface SearchInputProps {
|
|
|
590
590
|
placeholder?: string;
|
|
591
591
|
fullWidth?: boolean;
|
|
592
592
|
disableLabel?: boolean;
|
|
593
|
+
variant?: "outlined" | "filled" | "standard";
|
|
594
|
+
size?: "small" | "medium";
|
|
593
595
|
iconSize?: "small" | "medium" | "large";
|
|
594
596
|
sx?: SxProps<Theme>;
|
|
595
597
|
onChange?(value: string): void;
|