@rubenpazch/patient-search 2.0.0

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,36 @@
1
+ import React from 'react';
2
+
3
+ type SearchSize = "sm" | "md" | "lg";
4
+ type PatientSearchPatient = {
5
+ id: string | number;
6
+ first_name: string;
7
+ last_name: string;
8
+ email?: string | null;
9
+ phone?: string | null;
10
+ dni?: string | null;
11
+ active: boolean;
12
+ };
13
+ type PatientSearchLabels = {
14
+ searchPlaceholder: string;
15
+ resultsTitle: string;
16
+ activeStatus: string;
17
+ inactiveStatus: string;
18
+ noResultsTitle: string;
19
+ noResultsHint: string;
20
+ createNewPatient: string;
21
+ withSearchTerm: string;
22
+ dniLabel: string;
23
+ };
24
+ interface PatientSearchProps {
25
+ onSelectPatient: (patient: PatientSearchPatient) => void;
26
+ onSearchPatients?: (searchTerm: string) => Promise<{
27
+ patients?: PatientSearchPatient[];
28
+ } | PatientSearchPatient[]>;
29
+ onCreateNewPatient?: (searchTerm: string) => void;
30
+ labels: PatientSearchLabels;
31
+ size?: SearchSize;
32
+ initialSearchTerm?: string;
33
+ }
34
+ declare const PatientSearch: React.FC<PatientSearchProps>;
35
+
36
+ export { PatientSearch as default };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,575 @@
1
+ import * as require$$0 from 'react';
2
+ import require$$0__default, { useState, useRef, useEffect } from 'react';
3
+
4
+ var jsxRuntime = {exports: {}};
5
+
6
+ var reactJsxRuntime_production = {};
7
+
8
+ /**
9
+ * @license React
10
+ * react-jsx-runtime.production.js
11
+ *
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+
18
+ var hasRequiredReactJsxRuntime_production;
19
+
20
+ function requireReactJsxRuntime_production () {
21
+ if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
22
+ hasRequiredReactJsxRuntime_production = 1;
23
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
24
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
25
+ function jsxProd(type, config, maybeKey) {
26
+ var key = null;
27
+ void 0 !== maybeKey && (key = "" + maybeKey);
28
+ void 0 !== config.key && (key = "" + config.key);
29
+ if ("key" in config) {
30
+ maybeKey = {};
31
+ for (var propName in config)
32
+ "key" !== propName && (maybeKey[propName] = config[propName]);
33
+ } else maybeKey = config;
34
+ config = maybeKey.ref;
35
+ return {
36
+ $$typeof: REACT_ELEMENT_TYPE,
37
+ type: type,
38
+ key: key,
39
+ ref: void 0 !== config ? config : null,
40
+ props: maybeKey
41
+ };
42
+ }
43
+ reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
44
+ reactJsxRuntime_production.jsx = jsxProd;
45
+ reactJsxRuntime_production.jsxs = jsxProd;
46
+ return reactJsxRuntime_production;
47
+ }
48
+
49
+ var reactJsxRuntime_development = {};
50
+
51
+ /**
52
+ * @license React
53
+ * react-jsx-runtime.development.js
54
+ *
55
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
56
+ *
57
+ * This source code is licensed under the MIT license found in the
58
+ * LICENSE file in the root directory of this source tree.
59
+ */
60
+
61
+ var hasRequiredReactJsxRuntime_development;
62
+
63
+ function requireReactJsxRuntime_development () {
64
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
65
+ hasRequiredReactJsxRuntime_development = 1;
66
+ "production" !== process.env.NODE_ENV &&
67
+ (function () {
68
+ function getComponentNameFromType(type) {
69
+ if (null == type) return null;
70
+ if ("function" === typeof type)
71
+ return type.$$typeof === REACT_CLIENT_REFERENCE
72
+ ? null
73
+ : type.displayName || type.name || null;
74
+ if ("string" === typeof type) return type;
75
+ switch (type) {
76
+ case REACT_FRAGMENT_TYPE:
77
+ return "Fragment";
78
+ case REACT_PROFILER_TYPE:
79
+ return "Profiler";
80
+ case REACT_STRICT_MODE_TYPE:
81
+ return "StrictMode";
82
+ case REACT_SUSPENSE_TYPE:
83
+ return "Suspense";
84
+ case REACT_SUSPENSE_LIST_TYPE:
85
+ return "SuspenseList";
86
+ case REACT_ACTIVITY_TYPE:
87
+ return "Activity";
88
+ }
89
+ if ("object" === typeof type)
90
+ switch (
91
+ ("number" === typeof type.tag &&
92
+ console.error(
93
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
94
+ ),
95
+ type.$$typeof)
96
+ ) {
97
+ case REACT_PORTAL_TYPE:
98
+ return "Portal";
99
+ case REACT_CONTEXT_TYPE:
100
+ return type.displayName || "Context";
101
+ case REACT_CONSUMER_TYPE:
102
+ return (type._context.displayName || "Context") + ".Consumer";
103
+ case REACT_FORWARD_REF_TYPE:
104
+ var innerType = type.render;
105
+ type = type.displayName;
106
+ type ||
107
+ ((type = innerType.displayName || innerType.name || ""),
108
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
109
+ return type;
110
+ case REACT_MEMO_TYPE:
111
+ return (
112
+ (innerType = type.displayName || null),
113
+ null !== innerType
114
+ ? innerType
115
+ : getComponentNameFromType(type.type) || "Memo"
116
+ );
117
+ case REACT_LAZY_TYPE:
118
+ innerType = type._payload;
119
+ type = type._init;
120
+ try {
121
+ return getComponentNameFromType(type(innerType));
122
+ } catch (x) {}
123
+ }
124
+ return null;
125
+ }
126
+ function testStringCoercion(value) {
127
+ return "" + value;
128
+ }
129
+ function checkKeyStringCoercion(value) {
130
+ try {
131
+ testStringCoercion(value);
132
+ var JSCompiler_inline_result = !1;
133
+ } catch (e) {
134
+ JSCompiler_inline_result = true;
135
+ }
136
+ if (JSCompiler_inline_result) {
137
+ JSCompiler_inline_result = console;
138
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
139
+ var JSCompiler_inline_result$jscomp$0 =
140
+ ("function" === typeof Symbol &&
141
+ Symbol.toStringTag &&
142
+ value[Symbol.toStringTag]) ||
143
+ value.constructor.name ||
144
+ "Object";
145
+ JSCompiler_temp_const.call(
146
+ JSCompiler_inline_result,
147
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
148
+ JSCompiler_inline_result$jscomp$0
149
+ );
150
+ return testStringCoercion(value);
151
+ }
152
+ }
153
+ function getTaskName(type) {
154
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
155
+ if (
156
+ "object" === typeof type &&
157
+ null !== type &&
158
+ type.$$typeof === REACT_LAZY_TYPE
159
+ )
160
+ return "<...>";
161
+ try {
162
+ var name = getComponentNameFromType(type);
163
+ return name ? "<" + name + ">" : "<...>";
164
+ } catch (x) {
165
+ return "<...>";
166
+ }
167
+ }
168
+ function getOwner() {
169
+ var dispatcher = ReactSharedInternals.A;
170
+ return null === dispatcher ? null : dispatcher.getOwner();
171
+ }
172
+ function UnknownOwner() {
173
+ return Error("react-stack-top-frame");
174
+ }
175
+ function hasValidKey(config) {
176
+ if (hasOwnProperty.call(config, "key")) {
177
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
178
+ if (getter && getter.isReactWarning) return false;
179
+ }
180
+ return void 0 !== config.key;
181
+ }
182
+ function defineKeyPropWarningGetter(props, displayName) {
183
+ function warnAboutAccessingKey() {
184
+ specialPropKeyWarningShown ||
185
+ ((specialPropKeyWarningShown = true),
186
+ console.error(
187
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
188
+ displayName
189
+ ));
190
+ }
191
+ warnAboutAccessingKey.isReactWarning = true;
192
+ Object.defineProperty(props, "key", {
193
+ get: warnAboutAccessingKey,
194
+ configurable: true
195
+ });
196
+ }
197
+ function elementRefGetterWithDeprecationWarning() {
198
+ var componentName = getComponentNameFromType(this.type);
199
+ didWarnAboutElementRef[componentName] ||
200
+ ((didWarnAboutElementRef[componentName] = true),
201
+ console.error(
202
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
203
+ ));
204
+ componentName = this.props.ref;
205
+ return void 0 !== componentName ? componentName : null;
206
+ }
207
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
208
+ var refProp = props.ref;
209
+ type = {
210
+ $$typeof: REACT_ELEMENT_TYPE,
211
+ type: type,
212
+ key: key,
213
+ props: props,
214
+ _owner: owner
215
+ };
216
+ null !== (void 0 !== refProp ? refProp : null)
217
+ ? Object.defineProperty(type, "ref", {
218
+ enumerable: false,
219
+ get: elementRefGetterWithDeprecationWarning
220
+ })
221
+ : Object.defineProperty(type, "ref", { enumerable: false, value: null });
222
+ type._store = {};
223
+ Object.defineProperty(type._store, "validated", {
224
+ configurable: false,
225
+ enumerable: false,
226
+ writable: true,
227
+ value: 0
228
+ });
229
+ Object.defineProperty(type, "_debugInfo", {
230
+ configurable: false,
231
+ enumerable: false,
232
+ writable: true,
233
+ value: null
234
+ });
235
+ Object.defineProperty(type, "_debugStack", {
236
+ configurable: false,
237
+ enumerable: false,
238
+ writable: true,
239
+ value: debugStack
240
+ });
241
+ Object.defineProperty(type, "_debugTask", {
242
+ configurable: false,
243
+ enumerable: false,
244
+ writable: true,
245
+ value: debugTask
246
+ });
247
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
248
+ return type;
249
+ }
250
+ function jsxDEVImpl(
251
+ type,
252
+ config,
253
+ maybeKey,
254
+ isStaticChildren,
255
+ debugStack,
256
+ debugTask
257
+ ) {
258
+ var children = config.children;
259
+ if (void 0 !== children)
260
+ if (isStaticChildren)
261
+ if (isArrayImpl(children)) {
262
+ for (
263
+ isStaticChildren = 0;
264
+ isStaticChildren < children.length;
265
+ isStaticChildren++
266
+ )
267
+ validateChildKeys(children[isStaticChildren]);
268
+ Object.freeze && Object.freeze(children);
269
+ } else
270
+ console.error(
271
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
272
+ );
273
+ else validateChildKeys(children);
274
+ if (hasOwnProperty.call(config, "key")) {
275
+ children = getComponentNameFromType(type);
276
+ var keys = Object.keys(config).filter(function (k) {
277
+ return "key" !== k;
278
+ });
279
+ isStaticChildren =
280
+ 0 < keys.length
281
+ ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
282
+ : "{key: someKey}";
283
+ didWarnAboutKeySpread[children + isStaticChildren] ||
284
+ ((keys =
285
+ 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
286
+ console.error(
287
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
288
+ isStaticChildren,
289
+ children,
290
+ keys,
291
+ children
292
+ ),
293
+ (didWarnAboutKeySpread[children + isStaticChildren] = true));
294
+ }
295
+ children = null;
296
+ void 0 !== maybeKey &&
297
+ (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
298
+ hasValidKey(config) &&
299
+ (checkKeyStringCoercion(config.key), (children = "" + config.key));
300
+ if ("key" in config) {
301
+ maybeKey = {};
302
+ for (var propName in config)
303
+ "key" !== propName && (maybeKey[propName] = config[propName]);
304
+ } else maybeKey = config;
305
+ children &&
306
+ defineKeyPropWarningGetter(
307
+ maybeKey,
308
+ "function" === typeof type
309
+ ? type.displayName || type.name || "Unknown"
310
+ : type
311
+ );
312
+ return ReactElement(
313
+ type,
314
+ children,
315
+ maybeKey,
316
+ getOwner(),
317
+ debugStack,
318
+ debugTask
319
+ );
320
+ }
321
+ function validateChildKeys(node) {
322
+ isValidElement(node)
323
+ ? node._store && (node._store.validated = 1)
324
+ : "object" === typeof node &&
325
+ null !== node &&
326
+ node.$$typeof === REACT_LAZY_TYPE &&
327
+ ("fulfilled" === node._payload.status
328
+ ? isValidElement(node._payload.value) &&
329
+ node._payload.value._store &&
330
+ (node._payload.value._store.validated = 1)
331
+ : node._store && (node._store.validated = 1));
332
+ }
333
+ function isValidElement(object) {
334
+ return (
335
+ "object" === typeof object &&
336
+ null !== object &&
337
+ object.$$typeof === REACT_ELEMENT_TYPE
338
+ );
339
+ }
340
+ var React = require$$0__default,
341
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
342
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
343
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
344
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
345
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
346
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
347
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
348
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
349
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
350
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
351
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
352
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
353
+ REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
354
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
355
+ ReactSharedInternals =
356
+ React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
357
+ hasOwnProperty = Object.prototype.hasOwnProperty,
358
+ isArrayImpl = Array.isArray,
359
+ createTask = console.createTask
360
+ ? console.createTask
361
+ : function () {
362
+ return null;
363
+ };
364
+ React = {
365
+ react_stack_bottom_frame: function (callStackForError) {
366
+ return callStackForError();
367
+ }
368
+ };
369
+ var specialPropKeyWarningShown;
370
+ var didWarnAboutElementRef = {};
371
+ var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
372
+ React,
373
+ UnknownOwner
374
+ )();
375
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
376
+ var didWarnAboutKeySpread = {};
377
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
378
+ reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
379
+ var trackActualOwner =
380
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
381
+ return jsxDEVImpl(
382
+ type,
383
+ config,
384
+ maybeKey,
385
+ false,
386
+ trackActualOwner
387
+ ? Error("react-stack-top-frame")
388
+ : unknownOwnerDebugStack,
389
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
390
+ );
391
+ };
392
+ reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
393
+ var trackActualOwner =
394
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
395
+ return jsxDEVImpl(
396
+ type,
397
+ config,
398
+ maybeKey,
399
+ true,
400
+ trackActualOwner
401
+ ? Error("react-stack-top-frame")
402
+ : unknownOwnerDebugStack,
403
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
404
+ );
405
+ };
406
+ })();
407
+ return reactJsxRuntime_development;
408
+ }
409
+
410
+ var hasRequiredJsxRuntime;
411
+
412
+ function requireJsxRuntime () {
413
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
414
+ hasRequiredJsxRuntime = 1;
415
+
416
+ if (process.env.NODE_ENV === 'production') {
417
+ jsxRuntime.exports = requireReactJsxRuntime_production();
418
+ } else {
419
+ jsxRuntime.exports = requireReactJsxRuntime_development();
420
+ }
421
+ return jsxRuntime.exports;
422
+ }
423
+
424
+ var jsxRuntimeExports = requireJsxRuntime();
425
+
426
+ var r,o={exports:{}},t={};var l,n,a={};
427
+ /**
428
+ * @license React
429
+ * react-jsx-runtime.development.js
430
+ *
431
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
432
+ *
433
+ * This source code is licensed under the MIT license found in the
434
+ * LICENSE file in the root directory of this source tree.
435
+ */function i(){return l||(l=1,"production"!==process.env.NODE_ENV&&function(){function e(s){if(null==s)return null;if("function"==typeof s)return s.$$typeof===M?null:s.displayName||s.name||null;if("string"==typeof s)return s;switch(s){case x:return "Fragment";case p:return "Profiler";case v:return "StrictMode";case f:return "Suspense";case C:return "SuspenseList";case N:return "Activity"}if("object"==typeof s)switch("number"==typeof s.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case u:return "Portal";case j:return s.displayName||"Context";case g:return (s._context.displayName||"Context")+".Consumer";case k:var r=s.render;return (s=s.displayName)||(s=""!==(s=r.displayName||r.name||"")?"ForwardRef("+s+")":"ForwardRef"),s;case L:return null!==(r=s.displayName||null)?r:e(s.type)||"Memo";case y:r=s._payload,s=s._init;try{return e(s(r))}catch(e){}}return null}function r(e){return ""+e}function o(e){try{r(e);var s=!1;}catch(e){s=true;}if(s){var o=(s=console).error,t="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),r(e)}}function t(s){if(s===x)return "<>";if("object"==typeof s&&null!==s&&s.$$typeof===y)return "<...>";try{var r=e(s);return r?"<"+r+">":"<...>"}catch(e){return "<...>"}}function l(){return Error("react-stack-top-frame")}function n(){var s=e(this.type);return B[s]||(B[s]=true,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(s=this.props.ref)?s:null}function i(s,r,t,l,a,i){var h,m=r.children;if(void 0!==m)if(l)if(z(m)){for(l=0;l<m.length;l++)c(m[l]);Object.freeze&&Object.freeze(m);}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else c(m);if(b.call(r,"key")){m=e(s);var u=Object.keys(r).filter(function(e){return "key"!==e});l=0<u.length?"{key: someKey, "+u.join(": ..., ")+": ...}":"{key: someKey}",W[m+l]||(u=0<u.length?"{"+u.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',l,m,u,m),W[m+l]=true);}if(m=null,void 0!==t&&(o(t),m=""+t),function(e){if(b.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return false}return void 0!==e.key}(r)&&(o(r.key),m=""+r.key),"key"in r)for(var x in t={},r)"key"!==x&&(t[x]=r[x]);else t=r;return m&&function(e,s){function r(){d||(d=true,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",s));}r.isReactWarning=true,Object.defineProperty(e,"key",{get:r,configurable:true});}(t,"function"==typeof s?s.displayName||s.name||"Unknown":s),function(e,s,r,o,t,l){var a=r.ref;return e={$$typeof:w,type:e,key:s,props:r,_owner:o},null!==(void 0!==a?a:null)?Object.defineProperty(e,"ref",{enumerable:false,get:n}):Object.defineProperty(e,"ref",{enumerable:false,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(e,"_debugStack",{configurable:false,enumerable:false,writable:true,value:t}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:l}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(s,m,t,null===(h=$.A)?null:h.getOwner(),a,i)}function c(e){h(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===y&&("fulfilled"===e._payload.status?h(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function h(e){return "object"==typeof e&&null!==e&&e.$$typeof===w}var d,m=require$$0__default,w=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),j=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),M=Symbol.for("react.client.reference"),$=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,b=Object.prototype.hasOwnProperty,z=Array.isArray,H=console.createTask?console.createTask:function(){return null},B={},V=(m={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(m,l)(),Z=H(t(l)),W={};a.Fragment=x,a.jsx=function(e,s,r){var o=1e4>$.recentlyCreatedOwnerStacks++;return i(e,s,r,false,o?Error("react-stack-top-frame"):V,o?H(t(e)):Z)},a.jsxs=function(e,s,r){var o=1e4>$.recentlyCreatedOwnerStacks++;return i(e,s,r,true,o?Error("react-stack-top-frame"):V,o?H(t(e)):Z)};}()),a}var c=(n||(n=1,"production"===process.env.NODE_ENV?o.exports=function(){if(r)return t;r=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(s,r,o){var t=null;if(void 0!==o&&(t=""+o),void 0!==r.key&&(t=""+r.key),"key"in r)for(var l in o={},r)"key"!==l&&(o[l]=r[l]);else o=r;return r=o.ref,{$$typeof:e,type:s,key:t,ref:void 0!==r?r:null,props:o}}return t.Fragment=s,t.jsx=o,t.jsxs=o,t}():o.exports=i()),o.exports);function Ce({className:e="",size:s="md"}){const r=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} ${e}`;return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:r,"aria-label":"Plus",children:c.jsx("path",{d:"M12 4v16m8-8H4"})})}const He=({className:e="",size:s="md",color:r="currentColor"})=>c.jsxs("svg",{className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} animate-spin ${e}`,fill:"none",stroke:r,viewBox:"0 0 24 24",children:[c.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),c.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]});const Ee=({className:e="",size:s="md",color:r="currentColor"})=>c.jsxs("svg",{className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} ${e}`,fill:"none",stroke:r,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),c.jsx("circle",{cx:"12",cy:"7",r:"4"})]});const Xe={outlined:"material-symbols-outlined",rounded:"material-symbols-rounded",sharp:"material-symbols-sharp"},Ye=require$$0.forwardRef(({name:e,variant:s="outlined",size:r="md",fill:o=0,weight:t=400,grade:l=0,opticalSize:n=24,style:a,className:i,...h},d)=>{const m=(e=>"number"==typeof e?e:"sm"===e?16:"md"===e?20:24)(r),w=`"FILL" ${o}, "wght" ${t}, "GRAD" ${l}, "opsz" ${n}`;return c.jsx("span",{ref:d,"aria-hidden":"true",className:Xe[s]+(i?` ${i}`:""),style:{fontVariationSettings:w,fontSize:m,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",...a},...h,children:e})});Ye.displayName="MaterialIcon";
436
+
437
+ function styleInject(css, ref) {
438
+ if ( ref === void 0 ) ref = {};
439
+ var insertAt = ref.insertAt;
440
+
441
+ if (typeof document === 'undefined') { return; }
442
+
443
+ var head = document.head || document.getElementsByTagName('head')[0];
444
+ var style = document.createElement('style');
445
+ style.type = 'text/css';
446
+
447
+ if (insertAt === 'top') {
448
+ if (head.firstChild) {
449
+ head.insertBefore(style, head.firstChild);
450
+ } else {
451
+ head.appendChild(style);
452
+ }
453
+ } else {
454
+ head.appendChild(style);
455
+ }
456
+
457
+ if (style.styleSheet) {
458
+ style.styleSheet.cssText = css;
459
+ } else {
460
+ style.appendChild(document.createTextNode(css));
461
+ }
462
+ }
463
+
464
+ var css_248z = ".PatientSearch-module_root__zTVVD {\n position: relative;\n width: 100%;\n}\n\n.PatientSearch-module_sizeSM__03j3N {\n max-width: 24rem;\n}\n\n.PatientSearch-module_sizeMD__nBLGE {\n max-width: 42rem;\n}\n\n.PatientSearch-module_sizeLG__XrG-E {\n max-width: 48rem;\n}\n\n.PatientSearch-module_inputWrapper__p4A5i {\n position: relative;\n}\n\n.PatientSearch-module_iconWrapper__3ALRt {\n position: absolute;\n inset-block: 0;\n left: 0;\n display: flex;\n align-items: center;\n padding-left: 0.75rem;\n pointer-events: none;\n}\n\n.PatientSearch-module_icon__Y7R4n {\n color: #9ca3af;\n}\n\n.PatientSearch-module_iconSM__igbM5 {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n.PatientSearch-module_iconMD__X6PHz {\n width: 1.5rem;\n height: 1.5rem;\n}\n\n.PatientSearch-module_iconLG__2hcLU {\n width: 1.75rem;\n height: 1.75rem;\n}\n\n.PatientSearch-module_input__rf8h4 {\n width: 100%;\n border: 2px solid #d1d5db;\n border-radius: 0.5rem;\n outline: none;\n background: #ffffff;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);\n color: #111827;\n}\n\n.PatientSearch-module_input__rf8h4:focus {\n border-color: transparent;\n box-shadow: 0 0 0 2px #3b82f6;\n}\n\n.PatientSearch-module_inputSM__dOHod {\n padding: 0.5rem 1rem 0.5rem 2.5rem;\n font-size: 0.875rem;\n}\n\n.PatientSearch-module_inputMD__qsc7w {\n padding: 0.75rem 1rem 0.75rem 3rem;\n font-size: 1rem;\n}\n\n.PatientSearch-module_inputLG__nSshn {\n padding: 1rem 1rem 1rem 3.5rem;\n font-size: 1.125rem;\n}\n\n.PatientSearch-module_spinnerWrapper__hQ2-M {\n position: absolute;\n inset-block: 0;\n right: 0;\n display: flex;\n align-items: center;\n padding-right: 1rem;\n}\n\n.PatientSearch-module_spinner__K-4tv {\n color: #2563eb;\n}\n\n.PatientSearch-module_dropdown__dXnOa {\n position: absolute;\n z-index: 50;\n width: 100%;\n margin-top: 0.5rem;\n background: #ffffff;\n border-radius: 0.75rem;\n border: 1px solid #e5e7eb;\n box-shadow:\n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n max-height: 24rem;\n overflow-y: auto;\n}\n\n.PatientSearch-module_resultsHeader__AVkCQ {\n padding: 0.5rem 1rem;\n font-size: 0.75rem;\n font-weight: 600;\n text-transform: uppercase;\n color: #6b7280;\n background: #f9fafb;\n}\n\n.PatientSearch-module_resultButton__RNO53 {\n width: 100%;\n padding: 0.75rem 1rem;\n text-align: left;\n background: transparent;\n border: none;\n border-bottom: 1px solid #f3f4f6;\n cursor: pointer;\n transition: background-color 0.2s ease;\n}\n\n.PatientSearch-module_resultButton__RNO53:hover {\n background: #eff6ff;\n}\n\n.PatientSearch-module_resultButtonHighlighted__QIaEZ {\n background: #eff6ff;\n}\n\n.PatientSearch-module_resultContent__s48zw {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n}\n\n.PatientSearch-module_avatar__Yc4OV {\n width: 2.5rem;\n height: 2.5rem;\n background: #dbeafe;\n border-radius: 9999px;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.PatientSearch-module_avatarText__vT-d7 {\n color: #2563eb;\n font-weight: 500;\n font-size: 0.875rem;\n}\n\n.PatientSearch-module_resultDetails__x-w5D {\n flex: 1;\n min-width: 0;\n}\n\n.PatientSearch-module_patientName__nmkyN {\n font-size: 0.875rem;\n font-weight: 500;\n color: #111827;\n margin: 0;\n}\n\n.PatientSearch-module_patientEmail__1W1LS {\n font-size: 0.875rem;\n color: #6b7280;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: 0;\n}\n\n.PatientSearch-module_patientDni__dFO7a {\n font-size: 0.75rem;\n color: #9ca3af;\n margin: 0;\n}\n\n.PatientSearch-module_statusBadge__FbiKb {\n display: inline-flex;\n align-items: center;\n padding: 0.125rem 0.625rem;\n border-radius: 9999px;\n font-size: 0.75rem;\n font-weight: 500;\n}\n\n.PatientSearch-module_statusActive__Z0Ag1 {\n background: #d1fae5;\n color: #065f46;\n}\n\n.PatientSearch-module_statusInactive__BI2SM {\n background: #f3f4f6;\n color: #1f2937;\n}\n\n.PatientSearch-module_noResults__kLmFF {\n padding: 2rem 1rem;\n text-align: center;\n}\n\n.PatientSearch-module_noResultsIcon__ld0Ry {\n margin: 0 auto;\n color: #9ca3af;\n}\n\n.PatientSearch-module_noResultsTitle__CKFA8 {\n margin-top: 0.5rem;\n font-size: 0.875rem;\n color: #4b5563;\n}\n\n.PatientSearch-module_noResultsHint__5GF6i {\n margin-top: 0.25rem;\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.PatientSearch-module_createButton__zmTRQ {\n width: 100%;\n padding: 0.75rem 1rem;\n text-align: left;\n background: transparent;\n border: none;\n border-top: 2px solid #e5e7eb;\n cursor: pointer;\n transition: background-color 0.2s ease;\n}\n\n.PatientSearch-module_createButton__zmTRQ:hover {\n background: #ecfdf3;\n}\n\n.PatientSearch-module_createButtonHighlighted__mJSvX {\n background: #ecfdf3;\n}\n\n.PatientSearch-module_createContent__AjXGO {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n}\n\n.PatientSearch-module_createIconWrapper__epP2f {\n width: 2.5rem;\n height: 2.5rem;\n background: #dcfce7;\n border-radius: 9999px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.PatientSearch-module_createIcon__DlnY3 {\n color: #16a34a;\n}\n\n.PatientSearch-module_createTitle__Ai46p {\n font-size: 0.875rem;\n font-weight: 500;\n color: #16a34a;\n margin: 0;\n}\n\n.PatientSearch-module_createSubtitle__2wYqU {\n margin-top: 0.125rem;\n font-size: 0.75rem;\n color: #6b7280;\n}\n\n.PatientSearch-module_highlight__61pMO {\n background: #fde68a;\n font-weight: 600;\n}\n";
465
+ var styles = {"root":"PatientSearch-module_root__zTVVD","sizeSM":"PatientSearch-module_sizeSM__03j3N","sizeMD":"PatientSearch-module_sizeMD__nBLGE","sizeLG":"PatientSearch-module_sizeLG__XrG-E","inputWrapper":"PatientSearch-module_inputWrapper__p4A5i","iconWrapper":"PatientSearch-module_iconWrapper__3ALRt","icon":"PatientSearch-module_icon__Y7R4n","iconSM":"PatientSearch-module_iconSM__igbM5","iconMD":"PatientSearch-module_iconMD__X6PHz","iconLG":"PatientSearch-module_iconLG__2hcLU","input":"PatientSearch-module_input__rf8h4","inputSM":"PatientSearch-module_inputSM__dOHod","inputMD":"PatientSearch-module_inputMD__qsc7w","inputLG":"PatientSearch-module_inputLG__nSshn","spinnerWrapper":"PatientSearch-module_spinnerWrapper__hQ2-M","spinner":"PatientSearch-module_spinner__K-4tv","dropdown":"PatientSearch-module_dropdown__dXnOa","resultsHeader":"PatientSearch-module_resultsHeader__AVkCQ","resultButton":"PatientSearch-module_resultButton__RNO53","resultButtonHighlighted":"PatientSearch-module_resultButtonHighlighted__QIaEZ","resultContent":"PatientSearch-module_resultContent__s48zw","avatar":"PatientSearch-module_avatar__Yc4OV","avatarText":"PatientSearch-module_avatarText__vT-d7","resultDetails":"PatientSearch-module_resultDetails__x-w5D","patientName":"PatientSearch-module_patientName__nmkyN","patientEmail":"PatientSearch-module_patientEmail__1W1LS","patientDni":"PatientSearch-module_patientDni__dFO7a","statusBadge":"PatientSearch-module_statusBadge__FbiKb","statusActive":"PatientSearch-module_statusActive__Z0Ag1","statusInactive":"PatientSearch-module_statusInactive__BI2SM","noResults":"PatientSearch-module_noResults__kLmFF","noResultsIcon":"PatientSearch-module_noResultsIcon__ld0Ry","noResultsTitle":"PatientSearch-module_noResultsTitle__CKFA8","noResultsHint":"PatientSearch-module_noResultsHint__5GF6i","createButton":"PatientSearch-module_createButton__zmTRQ","createButtonHighlighted":"PatientSearch-module_createButtonHighlighted__mJSvX","createContent":"PatientSearch-module_createContent__AjXGO","createIconWrapper":"PatientSearch-module_createIconWrapper__epP2f","createIcon":"PatientSearch-module_createIcon__DlnY3","createTitle":"PatientSearch-module_createTitle__Ai46p","createSubtitle":"PatientSearch-module_createSubtitle__2wYqU","highlight":"PatientSearch-module_highlight__61pMO"};
466
+ styleInject(css_248z);
467
+
468
+ const classNames = (...classes) => classes.filter(Boolean).join(" ");
469
+ const PatientSearch = ({ onSelectPatient, onSearchPatients, onCreateNewPatient, labels, size = "md", initialSearchTerm = "", }) => {
470
+ const [searchTerm, setSearchTerm] = useState(initialSearchTerm);
471
+ const [results, setResults] = useState([]);
472
+ const [isOpen, setIsOpen] = useState(false);
473
+ const [loading, setLoading] = useState(false);
474
+ const [highlightedIndex, setHighlightedIndex] = useState(-1);
475
+ const searchRef = useRef(null);
476
+ // Close dropdown when clicking outside
477
+ useEffect(() => {
478
+ const handleClickOutside = (event) => {
479
+ if (searchRef.current &&
480
+ !searchRef.current.contains(event.target)) {
481
+ setIsOpen(false);
482
+ }
483
+ };
484
+ document.addEventListener("mousedown", handleClickOutside);
485
+ return () => document.removeEventListener("mousedown", handleClickOutside);
486
+ }, []);
487
+ // Search patients
488
+ useEffect(() => {
489
+ const searchPatients = async () => {
490
+ if (searchTerm.trim().length < 2) {
491
+ setResults([]);
492
+ setIsOpen(false);
493
+ return;
494
+ }
495
+ setLoading(true);
496
+ setIsOpen(true);
497
+ try {
498
+ if (!onSearchPatients) {
499
+ setResults([]);
500
+ return;
501
+ }
502
+ const response = await onSearchPatients(searchTerm);
503
+ const patients = Array.isArray(response)
504
+ ? response
505
+ : response?.patients;
506
+ setResults(patients ?? []);
507
+ }
508
+ catch (error) {
509
+ setResults([]);
510
+ }
511
+ finally {
512
+ setLoading(false);
513
+ }
514
+ };
515
+ const debounceTimer = setTimeout(searchPatients, 300);
516
+ return () => clearTimeout(debounceTimer);
517
+ }, [searchTerm]);
518
+ // Keyboard navigation
519
+ const handleKeyDown = (e) => {
520
+ if (!isOpen)
521
+ return;
522
+ switch (e.key) {
523
+ case "ArrowDown":
524
+ e.preventDefault();
525
+ setHighlightedIndex((prev) => prev < results.length ? prev + 1 : prev);
526
+ break;
527
+ case "ArrowUp":
528
+ e.preventDefault();
529
+ setHighlightedIndex((prev) => (prev > -1 ? prev - 1 : -1));
530
+ break;
531
+ case "Enter":
532
+ e.preventDefault();
533
+ if (highlightedIndex === -1 || highlightedIndex === results.length) {
534
+ // Create new patient
535
+ onCreateNewPatient?.(searchTerm);
536
+ }
537
+ else if (highlightedIndex >= 0 && highlightedIndex < results.length) {
538
+ // Select highlighted patient
539
+ onSelectPatient(results[highlightedIndex]);
540
+ setIsOpen(false);
541
+ setSearchTerm("");
542
+ }
543
+ break;
544
+ case "Escape":
545
+ setIsOpen(false);
546
+ break;
547
+ }
548
+ };
549
+ const handleSelectPatient = (patient) => {
550
+ onSelectPatient(patient);
551
+ setIsOpen(false);
552
+ setSearchTerm("");
553
+ setHighlightedIndex(-1);
554
+ };
555
+ const handleCreateNew = () => {
556
+ onCreateNewPatient?.(searchTerm);
557
+ };
558
+ const highlightMatch = (text, search) => {
559
+ if (!search.trim())
560
+ return text;
561
+ const regex = new RegExp(`(${search})`, "gi");
562
+ const parts = text.split(regex);
563
+ return parts.map((part, index) => regex.test(part) ? (jsxRuntimeExports.jsx("mark", { className: styles.highlight, children: part }, index)) : (part));
564
+ };
565
+ return (jsxRuntimeExports.jsxs("div", { ref: searchRef, className: classNames(styles.root, styles[`size${size.toUpperCase()}`]), children: [jsxRuntimeExports.jsxs("div", { className: styles.inputWrapper, children: [jsxRuntimeExports.jsx("div", { className: styles.iconWrapper, children: jsxRuntimeExports.jsx("svg", { className: classNames(styles.icon, styles[`icon${size.toUpperCase()}`]), fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }), jsxRuntimeExports.jsx("input", { type: "text", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), onKeyDown: handleKeyDown, onFocus: () => searchTerm.length >= 2 && setIsOpen(true), placeholder: labels.searchPlaceholder, className: classNames(styles.input, styles[`input${size.toUpperCase()}`]) }), loading && (jsxRuntimeExports.jsx("div", { className: styles.spinnerWrapper, children: jsxRuntimeExports.jsx(He, { size: "md", className: styles.spinner }) }))] }), isOpen && searchTerm.length >= 2 && (jsxRuntimeExports.jsxs("div", { className: styles.dropdown, children: [results.length > 0 ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("div", { className: styles.resultsHeader, children: [labels.resultsTitle, ": ", results.length, " ", results.length === 1 ? "" : "s"] }), results.map((patient, index) => (jsxRuntimeExports.jsx("button", { onClick: () => handleSelectPatient(patient), onMouseEnter: () => setHighlightedIndex(index), className: classNames(styles.resultButton, highlightedIndex === index &&
566
+ styles.resultButtonHighlighted), children: jsxRuntimeExports.jsxs("div", { className: styles.resultContent, children: [jsxRuntimeExports.jsx("div", { className: styles.avatar, children: jsxRuntimeExports.jsxs("span", { className: styles.avatarText, children: [patient.first_name.charAt(0), patient.last_name.charAt(0)] }) }), jsxRuntimeExports.jsxs("div", { className: styles.resultDetails, children: [jsxRuntimeExports.jsx("p", { className: styles.patientName, children: highlightMatch(`${patient.first_name} ${patient.last_name}`, searchTerm) }), jsxRuntimeExports.jsx("p", { className: styles.patientEmail, children: patient.email &&
567
+ highlightMatch(patient.email, searchTerm) }), patient.dni && (jsxRuntimeExports.jsxs("p", { className: styles.patientDni, children: [labels.dniLabel, ":", " ", highlightMatch(patient.dni, searchTerm)] }))] }), jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsx("span", { className: classNames(styles.statusBadge, patient.active
568
+ ? styles.statusActive
569
+ : styles.statusInactive), children: patient.active
570
+ ? labels.activeStatus
571
+ : labels.inactiveStatus }) })] }) }, patient.id)))] })) : !loading ? (jsxRuntimeExports.jsxs("div", { className: styles.noResults, children: [jsxRuntimeExports.jsx(Ee, { size: "lg", className: styles.noResultsIcon }), jsxRuntimeExports.jsx("p", { className: styles.noResultsTitle, children: labels.noResultsTitle }), jsxRuntimeExports.jsx("p", { className: styles.noResultsHint, children: labels.noResultsHint })] })) : null, jsxRuntimeExports.jsx("button", { onClick: handleCreateNew, onMouseEnter: () => setHighlightedIndex(results.length), className: classNames(styles.createButton, highlightedIndex === results.length &&
572
+ styles.createButtonHighlighted), children: jsxRuntimeExports.jsxs("div", { className: styles.createContent, children: [jsxRuntimeExports.jsx("div", { className: styles.createIconWrapper, children: jsxRuntimeExports.jsx(Ce, { size: "md", className: styles.createIcon }) }), jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("p", { className: styles.createTitle, children: labels.createNewPatient }), searchTerm && (jsxRuntimeExports.jsxs("p", { className: styles.createSubtitle, children: [labels.withSearchTerm, ": \"", searchTerm, "\""] }))] })] }) })] }))] }));
573
+ };
574
+
575
+ export { PatientSearch as default };