@saas-ui/react 3.0.0-alpha.4 → 3.0.0-alpha.6

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/chunk-2EUACKRH.js +26 -0
  3. package/dist/chunk-3Z2C27LI.js +51 -0
  4. package/dist/chunk-4TR3AOMG.js +33 -0
  5. package/dist/chunk-6LOMIKR5.js +69 -0
  6. package/dist/chunk-6ZNR6N2K.js +45 -0
  7. package/dist/chunk-7C3IZBNJ.js +38 -0
  8. package/dist/chunk-BCNPBZZK.js +45 -0
  9. package/dist/{chunk-KHRLZUV4.js → chunk-BFA5FCA2.js} +16 -1
  10. package/dist/chunk-CTOVNZVS.js +1 -0
  11. package/dist/chunk-DPMEXCSG.js +137 -0
  12. package/dist/chunk-F3CVOMG5.js +160 -0
  13. package/dist/chunk-FJFNGSPL.js +23 -0
  14. package/dist/chunk-GEPWRHHH.js +65 -0
  15. package/dist/chunk-HELHPHIQ.js +35 -0
  16. package/dist/chunk-I2RXEKTB.js +38 -0
  17. package/dist/chunk-L356FPLY.js +20 -0
  18. package/dist/chunk-LIYUBUOP.js +119 -0
  19. package/dist/chunk-M7FOBCOV.js +184 -0
  20. package/dist/chunk-NSD5HRIP.js +46 -0
  21. package/dist/chunk-QMG6HP7Z.js +87 -0
  22. package/dist/chunk-QSNSWCTM.js +32 -0
  23. package/dist/chunk-S3CQW7GD.js +100 -0
  24. package/dist/chunk-SA3OGTOO.js +23 -0
  25. package/dist/chunk-UCQ3LZIE.js +43 -0
  26. package/dist/chunk-ULAJ3JEO.js +32 -0
  27. package/dist/chunk-VF3BV2BY.js +87 -0
  28. package/dist/chunk-WYLMBMAH.js +22 -0
  29. package/dist/chunk-YWJZWB6I.js +1892 -0
  30. package/dist/chunk-ZWSZQZ5G.js +73 -0
  31. package/dist/components/app-shell/index.js +3 -40
  32. package/dist/components/avatar/index.cjs +69 -0
  33. package/dist/components/avatar/index.d.cts +18 -0
  34. package/dist/components/avatar/index.d.ts +18 -0
  35. package/dist/components/avatar/index.js +10 -0
  36. package/dist/components/breadcrumbs/index.js +3 -32
  37. package/dist/components/button/index.js +3 -40
  38. package/dist/components/checkbox/index.js +3 -15
  39. package/dist/components/command/index.js +3 -28
  40. package/dist/components/dialog/index.js +5 -67
  41. package/dist/components/drawer/index.d.cts +2 -2
  42. package/dist/components/drawer/index.d.ts +2 -2
  43. package/dist/components/drawer/index.js +5 -59
  44. package/dist/components/empty-state/index.js +3 -18
  45. package/dist/components/grid-list/index.js +3 -40
  46. package/dist/components/icon-badge/index.js +3 -33
  47. package/dist/components/link/index.js +2 -14
  48. package/dist/components/loading-overlay/index.js +5 -1885
  49. package/dist/components/menu/index.cjs +263 -0
  50. package/dist/components/menu/index.d.cts +30 -0
  51. package/dist/components/menu/index.d.ts +30 -0
  52. package/dist/components/menu/index.js +9 -0
  53. package/dist/components/navbar/index.d.cts +4 -4
  54. package/dist/components/navbar/index.d.ts +4 -4
  55. package/dist/components/navbar/index.js +3 -45
  56. package/dist/components/number-input/index.js +3 -26
  57. package/dist/components/password-input/index.js +4 -225
  58. package/dist/components/persona/index.js +6 -178
  59. package/dist/components/pin-input/index.js +3 -21
  60. package/dist/components/radio/index.js +4 -16
  61. package/dist/components/search-input/index.js +4 -114
  62. package/dist/components/segmented-control/index.cjs +2 -0
  63. package/dist/components/segmented-control/index.d.cts +2 -0
  64. package/dist/components/segmented-control/index.d.ts +2 -0
  65. package/dist/components/segmented-control/index.js +2 -0
  66. package/dist/components/select/index.js +4 -94
  67. package/dist/components/sidebar/index.d.cts +11 -11
  68. package/dist/components/sidebar/index.d.ts +11 -11
  69. package/dist/components/sidebar/index.js +7 -129
  70. package/dist/components/steps/index.js +5 -64
  71. package/dist/components/switch/index.js +3 -18
  72. package/dist/components/toaster/index.cjs +54 -0
  73. package/dist/components/toaster/index.d.cts +10 -0
  74. package/dist/components/toaster/index.d.ts +10 -0
  75. package/dist/components/toaster/index.js +10 -0
  76. package/dist/components/tooltip/index.cjs +57 -0
  77. package/dist/components/tooltip/index.d.cts +14 -0
  78. package/dist/components/tooltip/index.d.ts +14 -0
  79. package/dist/components/tooltip/index.js +8 -0
  80. package/dist/index.cjs +3707 -8
  81. package/dist/index.d.cts +37 -2
  82. package/dist/index.d.ts +37 -2
  83. package/dist/index.js +285 -4
  84. package/package.json +4 -4
@@ -1,231 +1,10 @@
1
1
  'use client'
2
2
  import {
3
- InputGroup
4
- } from "../../chunk-PKI6YH2V.js";
3
+ PasswordInput
4
+ } from "../../chunk-QMG6HP7Z.js";
5
+ import "../../chunk-F3CVOMG5.js";
6
+ import "../../chunk-PKI6YH2V.js";
5
7
  import "../../chunk-RTMS5TJN.js";
6
-
7
- // src/components/password-input/password-input.tsx
8
- import { forwardRef, useRef } from "react";
9
- import {
10
- IconButton,
11
- Input,
12
- mergeRefs,
13
- useControllableState
14
- } from "@chakra-ui/react";
15
-
16
- // ../../node_modules/react-icons/lib/iconBase.mjs
17
- import React2 from "react";
18
-
19
- // ../../node_modules/react-icons/lib/iconContext.mjs
20
- import React from "react";
21
- var DefaultContext = {
22
- color: void 0,
23
- size: void 0,
24
- className: void 0,
25
- style: void 0,
26
- attr: void 0
27
- };
28
- var IconContext = React.createContext && /* @__PURE__ */ React.createContext(DefaultContext);
29
-
30
- // ../../node_modules/react-icons/lib/iconBase.mjs
31
- var _excluded = ["attr", "size", "title"];
32
- function _objectWithoutProperties(source, excluded) {
33
- if (source == null) return {};
34
- var target = _objectWithoutPropertiesLoose(source, excluded);
35
- var key, i;
36
- if (Object.getOwnPropertySymbols) {
37
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
38
- for (i = 0; i < sourceSymbolKeys.length; i++) {
39
- key = sourceSymbolKeys[i];
40
- if (excluded.indexOf(key) >= 0) continue;
41
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
42
- target[key] = source[key];
43
- }
44
- }
45
- return target;
46
- }
47
- function _objectWithoutPropertiesLoose(source, excluded) {
48
- if (source == null) return {};
49
- var target = {};
50
- for (var key in source) {
51
- if (Object.prototype.hasOwnProperty.call(source, key)) {
52
- if (excluded.indexOf(key) >= 0) continue;
53
- target[key] = source[key];
54
- }
55
- }
56
- return target;
57
- }
58
- function _extends() {
59
- _extends = Object.assign ? Object.assign.bind() : function(target) {
60
- for (var i = 1; i < arguments.length; i++) {
61
- var source = arguments[i];
62
- for (var key in source) {
63
- if (Object.prototype.hasOwnProperty.call(source, key)) {
64
- target[key] = source[key];
65
- }
66
- }
67
- }
68
- return target;
69
- };
70
- return _extends.apply(this, arguments);
71
- }
72
- function ownKeys(e, r) {
73
- var t = Object.keys(e);
74
- if (Object.getOwnPropertySymbols) {
75
- var o = Object.getOwnPropertySymbols(e);
76
- r && (o = o.filter(function(r2) {
77
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
78
- })), t.push.apply(t, o);
79
- }
80
- return t;
81
- }
82
- function _objectSpread(e) {
83
- for (var r = 1; r < arguments.length; r++) {
84
- var t = null != arguments[r] ? arguments[r] : {};
85
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
86
- _defineProperty(e, r2, t[r2]);
87
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
88
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
89
- });
90
- }
91
- return e;
92
- }
93
- function _defineProperty(obj, key, value) {
94
- key = _toPropertyKey(key);
95
- if (key in obj) {
96
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
97
- } else {
98
- obj[key] = value;
99
- }
100
- return obj;
101
- }
102
- function _toPropertyKey(t) {
103
- var i = _toPrimitive(t, "string");
104
- return "symbol" == typeof i ? i : i + "";
105
- }
106
- function _toPrimitive(t, r) {
107
- if ("object" != typeof t || !t) return t;
108
- var e = t[Symbol.toPrimitive];
109
- if (void 0 !== e) {
110
- var i = e.call(t, r || "default");
111
- if ("object" != typeof i) return i;
112
- throw new TypeError("@@toPrimitive must return a primitive value.");
113
- }
114
- return ("string" === r ? String : Number)(t);
115
- }
116
- function Tree2Element(tree) {
117
- return tree && tree.map((node, i) => /* @__PURE__ */ React2.createElement(node.tag, _objectSpread({
118
- key: i
119
- }, node.attr), Tree2Element(node.child)));
120
- }
121
- function GenIcon(data) {
122
- return (props) => /* @__PURE__ */ React2.createElement(IconBase, _extends({
123
- attr: _objectSpread({}, data.attr)
124
- }, props), Tree2Element(data.child));
125
- }
126
- function IconBase(props) {
127
- var elem = (conf) => {
128
- var {
129
- attr,
130
- size,
131
- title
132
- } = props, svgProps = _objectWithoutProperties(props, _excluded);
133
- var computedSize = size || conf.size || "1em";
134
- var className;
135
- if (conf.className) className = conf.className;
136
- if (props.className) className = (className ? className + " " : "") + props.className;
137
- return /* @__PURE__ */ React2.createElement("svg", _extends({
138
- stroke: "currentColor",
139
- fill: "currentColor",
140
- strokeWidth: "0"
141
- }, conf.attr, attr, svgProps, {
142
- className,
143
- style: _objectSpread(_objectSpread({
144
- color: props.color || conf.color
145
- }, conf.style), props.style),
146
- height: computedSize,
147
- width: computedSize,
148
- xmlns: "http://www.w3.org/2000/svg"
149
- }), title && /* @__PURE__ */ React2.createElement("title", null, title), props.children);
150
- };
151
- return IconContext !== void 0 ? /* @__PURE__ */ React2.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
152
- }
153
-
154
- // ../../node_modules/react-icons/lu/index.mjs
155
- function LuEyeOff(props) {
156
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M9.88 9.88a3 3 0 1 0 4.24 4.24" }, "child": [] }, { "tag": "path", "attr": { "d": "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }, "child": [] }, { "tag": "path", "attr": { "d": "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }, "child": [] }, { "tag": "line", "attr": { "x1": "2", "x2": "22", "y1": "2", "y2": "22" }, "child": [] }] })(props);
157
- }
158
- function LuEye(props) {
159
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }, "child": [] }, { "tag": "circle", "attr": { "cx": "12", "cy": "12", "r": "3" }, "child": [] }] })(props);
160
- }
161
-
162
- // src/components/password-input/password-input.tsx
163
- import { jsx } from "react/jsx-runtime";
164
- var PasswordInput = forwardRef(
165
- function PasswordInput2(props, ref) {
166
- const {
167
- rootProps,
168
- defaultVisible,
169
- visible: visibleProp,
170
- onVisibleChange,
171
- visibilityIcon = { on: /* @__PURE__ */ jsx(LuEye, {}), off: /* @__PURE__ */ jsx(LuEyeOff, {}) },
172
- ...rest
173
- } = props;
174
- const [visible, setVisible] = useControllableState({
175
- value: visibleProp,
176
- defaultValue: defaultVisible || false,
177
- onChange: onVisibleChange
178
- });
179
- const inputRef = useRef(null);
180
- return /* @__PURE__ */ jsx(
181
- InputGroup,
182
- {
183
- width: "full",
184
- endElement: /* @__PURE__ */ jsx(
185
- VisibilityTrigger,
186
- {
187
- disabled: rest.disabled,
188
- onPointerDown: (e) => {
189
- if (rest.disabled) return;
190
- if (e.button !== 0) return;
191
- e.preventDefault();
192
- setVisible(!visible);
193
- },
194
- children: visible ? visibilityIcon.off : visibilityIcon.on
195
- }
196
- ),
197
- ...rootProps,
198
- children: /* @__PURE__ */ jsx(
199
- Input,
200
- {
201
- ...rest,
202
- ref: mergeRefs(ref, inputRef),
203
- type: visible ? "text" : "password"
204
- }
205
- )
206
- }
207
- );
208
- }
209
- );
210
- var VisibilityTrigger = forwardRef(
211
- function VisibilityTrigger2(props, ref) {
212
- return /* @__PURE__ */ jsx(
213
- IconButton,
214
- {
215
- tabIndex: -1,
216
- ref,
217
- me: "-2",
218
- aspectRatio: "square",
219
- size: "sm",
220
- variant: "ghost",
221
- colorPalette: "gray",
222
- height: "calc(100% - {spacing.2})",
223
- "aria-label": "Toggle password visibility",
224
- ...props
225
- }
226
- );
227
- }
228
- );
229
8
  export {
230
9
  PasswordInput
231
10
  };
@@ -1,184 +1,12 @@
1
1
  'use client'
2
- import "../../chunk-RTMS5TJN.js";
3
-
4
- // src/components/persona/persona.tsx
5
- import * as React2 from "react";
6
-
7
- // src/components/persona/persona-primitive.tsx
8
- import { forwardRef } from "react";
9
2
  import {
10
- Avatar,
11
- chakra
12
- } from "@chakra-ui/react";
13
- import { dataAttr } from "@saas-ui/core/utils";
14
-
15
- // src/components/persona/persona.context.ts
16
- import { createSlotRecipeContext } from "@chakra-ui/react";
17
- var {
18
- useStyles: usePersonaStyles,
19
- withProvider,
20
- withContext
21
- } = createSlotRecipeContext({
22
- key: "suiPersona"
23
- });
24
-
25
- // src/components/persona/persona-primitive.tsx
26
- import { jsx, jsxs } from "react/jsx-runtime";
27
- var PersonaRoot = withProvider(
28
- forwardRef((props, ref) => {
29
- const { outOfOffice, presence, ...rest } = props;
30
- return /* @__PURE__ */ jsx(
31
- chakra.div,
32
- {
33
- ref,
34
- ...rest,
35
- "data-out-of-office": dataAttr(outOfOffice),
36
- "data-presence": presence,
37
- css: [
38
- presence ? {
39
- "--persona-presence": `colors.presence.${presence}`
40
- } : void 0,
41
- rest.css
42
- ]
43
- }
44
- );
45
- }),
46
- "root"
47
- );
48
- var PersonaAvatar = forwardRef(
49
- (props, ref) => {
50
- const {
51
- name,
52
- getInitials = (name2) => name2 == null ? void 0 : name2[0],
53
- icon,
54
- loading,
55
- onError,
56
- src,
57
- srcSet,
58
- children,
59
- ...rest
60
- } = props;
61
- return /* @__PURE__ */ jsxs(Avatar.Root, { ref, ...rest, children: [
62
- /* @__PURE__ */ jsx(Avatar.Fallback, { children: getInitials(name) }),
63
- /* @__PURE__ */ jsx(
64
- Avatar.Image,
65
- {
66
- src,
67
- srcSet,
68
- loading,
69
- onError
70
- }
71
- ),
72
- children
73
- ] });
74
- }
75
- );
76
- var PersonaPresenceBadge = withContext("span", "presence");
77
- var PersonaDetails = withContext(
78
- "div",
79
- "details"
80
- );
81
- var PersonaLabel = withContext(
82
- "span",
83
- "label"
84
- );
85
- PersonaLabel.displayName = "PersonaLabel";
86
- var PersonaSecondaryLabel = withContext(
87
- "span",
88
- "secondaryLabel"
89
- );
90
- var PersonaTertiaryLabel = withContext(
91
- "span",
92
- "tertiaryLabel"
93
- );
94
-
95
- // src/components/persona/persona.tsx
96
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
97
- var Persona = React2.forwardRef(
98
- (props, ref) => {
99
- const {
100
- name,
101
- presence,
102
- presenceIcon,
103
- isOutOfOffice,
104
- label,
105
- secondaryLabel,
106
- tertiaryLabel,
107
- size,
108
- hideDetails,
109
- children,
110
- /** Avatar props */
111
- getInitials,
112
- icon,
113
- loading,
114
- onError,
115
- src,
116
- srcSet,
117
- ...rest
118
- } = props;
119
- return /* @__PURE__ */ jsxs2(
120
- PersonaRoot,
121
- {
122
- ref,
123
- outOfOffice: isOutOfOffice,
124
- presence,
125
- ...rest,
126
- children: [
127
- /* @__PURE__ */ jsx2(
128
- PersonaAvatar,
129
- {
130
- name,
131
- size,
132
- getInitials,
133
- icon,
134
- loading,
135
- onError,
136
- src,
137
- srcSet,
138
- children: /* @__PURE__ */ jsx2(PersonaPresenceBadge, { children: presenceIcon })
139
- }
140
- ),
141
- !hideDetails && /* @__PURE__ */ jsxs2(PersonaDetails, { children: [
142
- /* @__PURE__ */ jsx2(PersonaLabel, { children: label || name }),
143
- secondaryLabel && /* @__PURE__ */ jsx2(PersonaSecondaryLabel, { children: secondaryLabel }),
144
- tertiaryLabel && /* @__PURE__ */ jsx2(PersonaTertiaryLabel, { children: tertiaryLabel }),
145
- children
146
- ] })
147
- ]
148
- }
149
- );
150
- }
151
- );
152
- Persona.displayName = "Persona";
153
- var PersonaAvatar2 = React2.forwardRef(function PersonaAvatar3(props, ref) {
154
- return /* @__PURE__ */ jsx2(Persona, { ref, ...props, hideDetails: true });
155
- });
156
-
157
- // src/components/persona/presence.ts
158
- var defaultPresenceOptions = {
159
- online: {
160
- label: "Online",
161
- color: "presence.online"
162
- },
163
- offline: {
164
- label: "Offline",
165
- color: "presence.offline"
166
- },
167
- busy: {
168
- label: "Busy",
169
- color: "presence.busy"
170
- },
171
- dnd: {
172
- label: "Do-not-disturb",
173
- color: "presence.dnd"
174
- },
175
- away: {
176
- label: "Away",
177
- color: "presence.away"
178
- }
179
- };
3
+ Persona,
4
+ PersonaAvatar,
5
+ defaultPresenceOptions
6
+ } from "../../chunk-M7FOBCOV.js";
7
+ import "../../chunk-RTMS5TJN.js";
180
8
  export {
181
9
  Persona,
182
- PersonaAvatar2 as PersonaAvatar,
10
+ PersonaAvatar,
183
11
  defaultPresenceOptions
184
12
  };
@@ -1,26 +1,8 @@
1
1
  'use client'
2
+ import {
3
+ PinInput
4
+ } from "../../chunk-2EUACKRH.js";
2
5
  import "../../chunk-RTMS5TJN.js";
3
-
4
- // src/components/pin-input/pin-input.tsx
5
- import { forwardRef } from "react";
6
- import { PinInput as ChakraPinInput, Group } from "@chakra-ui/react";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- var PinInput = forwardRef(
9
- function PinInput2(props, ref) {
10
- const {
11
- pinLength = 4,
12
- inputProps,
13
- rootRef,
14
- attached,
15
- gap = attached ? 0 : 2,
16
- ...rest
17
- } = props;
18
- return /* @__PURE__ */ jsxs(ChakraPinInput.Root, { ref: rootRef, ...rest, children: [
19
- /* @__PURE__ */ jsx(ChakraPinInput.HiddenInput, { ref, ...inputProps }),
20
- /* @__PURE__ */ jsx(ChakraPinInput.Control, { children: /* @__PURE__ */ jsx(Group, { attached, gap, children: Array.from({ length: pinLength }).map((_, index) => /* @__PURE__ */ jsx(ChakraPinInput.Input, { index }, index)) }) })
21
- ] });
22
- }
23
- );
24
6
  export {
25
7
  PinInput
26
8
  };
@@ -1,21 +1,9 @@
1
1
  'use client'
2
+ import {
3
+ Radio,
4
+ RadioGroup
5
+ } from "../../chunk-WYLMBMAH.js";
2
6
  import "../../chunk-RTMS5TJN.js";
3
-
4
- // src/components/radio/radio.tsx
5
- import { forwardRef } from "react";
6
- import { RadioGroup as ChakraRadioGroup } from "@chakra-ui/react";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- var Radio = forwardRef(
9
- function Radio2(props, ref) {
10
- const { children, inputProps, rootRef, ...rest } = props;
11
- return /* @__PURE__ */ jsxs(ChakraRadioGroup.Item, { ref: rootRef, ...rest, children: [
12
- /* @__PURE__ */ jsx(ChakraRadioGroup.ItemHiddenInput, { ref, ...inputProps }),
13
- /* @__PURE__ */ jsx(ChakraRadioGroup.ItemIndicator, {}),
14
- children && /* @__PURE__ */ jsx(ChakraRadioGroup.ItemText, { children })
15
- ] });
16
- }
17
- );
18
- var RadioGroup = ChakraRadioGroup.Root;
19
7
  export {
20
8
  Radio,
21
9
  RadioGroup
@@ -1,120 +1,10 @@
1
1
  'use client'
2
- import "../../chunk-KTLWEUNW.js";
3
2
  import {
4
- CloseIcon,
5
- SearchIcon
6
- } from "../../chunk-VDXTEASE.js";
3
+ SearchInput
4
+ } from "../../chunk-LIYUBUOP.js";
5
+ import "../../chunk-KTLWEUNW.js";
6
+ import "../../chunk-VDXTEASE.js";
7
7
  import "../../chunk-RTMS5TJN.js";
8
-
9
- // src/components/search-input/search-input.tsx
10
- import React, { forwardRef } from "react";
11
- import {
12
- Group,
13
- IconButton,
14
- Input,
15
- InputElement,
16
- mergeRefs,
17
- useControllableState
18
- } from "@chakra-ui/react";
19
- import { callAll } from "@saas-ui/core/utils";
20
- import { jsx, jsxs } from "react/jsx-runtime";
21
- var SearchInput = forwardRef(
22
- (props, ref) => {
23
- const {
24
- placeholder = "Search",
25
- value: valueProp,
26
- defaultValue: defaultValueProp,
27
- size,
28
- variant,
29
- width = "full",
30
- icon = /* @__PURE__ */ jsx(SearchIcon, {}),
31
- resetIcon,
32
- endElement: endElementProp,
33
- onChange: onChangeProp,
34
- onReset: onResetProp,
35
- onKeyDown: onKeyDownProp,
36
- disabled,
37
- ...inputProps
38
- } = props;
39
- const inputRef = React.useRef(null);
40
- const [value, setValue] = useControllableState({
41
- value: valueProp,
42
- defaultValue: defaultValueProp
43
- });
44
- const onChange = React.useCallback(
45
- (e) => {
46
- setValue(e.target.value);
47
- },
48
- [setValue]
49
- );
50
- const onKeyDown = React.useCallback(
51
- (event) => {
52
- if (event.key === "Escape") {
53
- setValue("");
54
- onReset();
55
- }
56
- },
57
- [onResetProp, setValue]
58
- );
59
- const onReset = () => {
60
- var _a;
61
- setValue("");
62
- onResetProp == null ? void 0 : onResetProp();
63
- (_a = inputRef.current) == null ? void 0 : _a.focus();
64
- };
65
- const showReset = value && !props.disabled;
66
- const endElement = showReset ? /* @__PURE__ */ jsx(SearchInputResetButton, { size, children: resetIcon }) : endElementProp;
67
- return /* @__PURE__ */ jsxs(Group, { width, children: [
68
- /* @__PURE__ */ jsx(
69
- InputElement,
70
- {
71
- placement: "start",
72
- px: "0",
73
- aspectRatio: "9/10",
74
- fontSize: size,
75
- children: icon
76
- }
77
- ),
78
- /* @__PURE__ */ jsx(
79
- Input,
80
- {
81
- type: "text",
82
- placeholder,
83
- variant,
84
- size,
85
- value,
86
- disabled,
87
- ref: mergeRefs(ref, inputRef),
88
- onChange: callAll(onChange, onChangeProp),
89
- onKeyDown: callAll(onKeyDown, onKeyDownProp),
90
- ps: "calc(var(--input-height) - var(--input-height) / 10)",
91
- pe: "calc(var(--input-height) - var(--input-height) / 10)",
92
- ...inputProps
93
- }
94
- ),
95
- /* @__PURE__ */ jsx(InputElement, { placement: "end", children: endElement })
96
- ] });
97
- }
98
- );
99
- var SearchInputResetButton = forwardRef(
100
- (props, ref) => {
101
- const { children = /* @__PURE__ */ jsx(CloseIcon, {}), ...rest } = props;
102
- return /* @__PURE__ */ jsx(
103
- IconButton,
104
- {
105
- ref,
106
- variant: "ghost",
107
- "aria-label": "Reset search",
108
- me: "-2",
109
- aspectRatio: "square",
110
- height: "calc(100% - {spacing.2})",
111
- ...rest,
112
- children
113
- }
114
- );
115
- }
116
- );
117
- SearchInput.displayName = "SearchInput";
118
8
  export {
119
9
  SearchInput
120
10
  };
@@ -0,0 +1,2 @@
1
+ 'use client'
2
+ "use strict";
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+ 'use client'
2
+ import "../../chunk-CTOVNZVS.js";