@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.
@@ -1,76 +1,147 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import m, { useState as O } from "react";
3
- import { Close as k, Search as w } from "@mui/icons-material";
4
- import { F, I as R, a as _ } from "../../FormControl-BiAFm76F.js";
5
- import { O as j } from "../../OutlinedInput-BEVE8VZQ.js";
6
- import { I as h } from "../../IconButton-CQJ8wZE8.js";
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: f = "",
9
- label: l = "Search",
10
- placeholder: p,
11
- disableLabel: s = !1,
12
- fullWidth: u = !1,
13
- iconSize: t = "medium",
14
- sx: I,
15
- onChange: i,
16
- onSubmit: r
17
- }, g) => {
18
- const [a, o] = O(f), C = (n) => {
19
- o(n.target.value), i && i(n.target.value);
20
- }, d = (n) => {
21
- r && r(a);
22
- }, v = (n) => {
23
- n.key === "Enter" && d();
24
- }, x = () => {
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
- m.useImperativeHandle(g, () => ({
30
+ k.useImperativeHandle(F, () => ({
28
31
  reset() {
29
- x();
32
+ K();
30
33
  }
31
34
  }));
32
- const y = () => {
33
- o(""), r && r("");
35
+ const f = () => {
36
+ h(""), a && a("");
34
37
  };
35
- return /* @__PURE__ */ c(F, { sx: I, size: "small", variant: "outlined", fullWidth: u, children: [
36
- !s && /* @__PURE__ */ e(R, { htmlFor: "search-input", children: l }),
37
- /* @__PURE__ */ e(
38
- j,
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: s ? "" : l,
43
- value: a,
44
- placeholder: p,
45
- onChange: C,
46
- onKeyDown: v,
47
- endAdornment: /* @__PURE__ */ c(_, { position: "end", children: [
48
- a.length > 0 && /* @__PURE__ */ e(
49
- h,
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: y,
55
+ onClick: f,
53
56
  edge: "end",
54
- size: t,
57
+ size: n,
55
58
  color: "error",
56
- children: /* @__PURE__ */ e(k, { fontSize: t })
59
+ children: /* @__PURE__ */ e(m, { fontSize: n })
57
60
  }
58
61
  ),
59
62
  /* @__PURE__ */ e(
60
- h,
63
+ t,
61
64
  {
62
65
  "aria-label": "search",
63
66
  onClick: d,
64
67
  edge: "end",
65
- size: t,
66
- children: /* @__PURE__ */ e(w, { fontSize: t })
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
- }, H = m.forwardRef(z);
144
+ }, L = k.forwardRef(z);
74
145
  export {
75
- H as SearchInput
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;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.1.2",
4
+ "version": "1.1.3",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",