@rubenpazch/patient-search 3.0.0 → 3.0.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/README.md +26 -0
- package/dist/index.cjs.js +30 -24
- package/dist/index.esm.js +32 -8
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
# PatientSearch
|
|
2
2
|
|
|
3
3
|
Generated component package.
|
|
4
|
+
|
|
5
|
+
<!-- catalogo:inicio (generado por pnpm catalogo, no editar) -->
|
|
6
|
+
|
|
7
|
+
Buscador de pacientes con resultados y selección.
|
|
8
|
+
|
|
9
|
+
- **Usar cuando:** Elegir un paciente existente en apps clínicas u ópticas.
|
|
10
|
+
- **Evitar cuando:** Buscar otro tipo de registros: usa Autocomplete.
|
|
11
|
+
|
|
12
|
+
Se recomienda instalar el paquete completo `@rubenpazch/ui` (incluye este). Por separado:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @rubenpazch/patient-search
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## PatientSearch
|
|
19
|
+
|
|
20
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
21
|
+
| -------------------- | ---------------------------------------------------------------------------------------------------------------- | ---- | ----------- | ----------- |
|
|
22
|
+
| `labels` | `PatientSearchLabels` | sí | | |
|
|
23
|
+
| `onSelectPatient` | `(patient: PatientSearchPatient) => void` | sí | | |
|
|
24
|
+
| `initialSearchTerm` | `string` | | `` | |
|
|
25
|
+
| `onCreateNewPatient` | `(searchTerm: string) => void` | | | |
|
|
26
|
+
| `onSearchPatients` | `(searchTerm: string) => Promise<{ patients?: PatientSearchPatient[] \| undefined; } \| PatientSearchPatient[]>` | | | |
|
|
27
|
+
| `size` | `"sm" \| "md" \| "lg"` | | `md` | |
|
|
28
|
+
|
|
29
|
+
<!-- catalogo:fin -->
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,25 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var require$$0 = require('react');
|
|
4
4
|
|
|
5
|
-
function _interopNamespaceDefault(e) {
|
|
6
|
-
var n = Object.create(null);
|
|
7
|
-
if (e) {
|
|
8
|
-
Object.keys(e).forEach(function (k) {
|
|
9
|
-
if (k !== 'default') {
|
|
10
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return e[k]; }
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
n.default = e;
|
|
19
|
-
return Object.freeze(n);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var require$$0__namespace = /*#__PURE__*/_interopNamespaceDefault(require$$0);
|
|
23
|
-
|
|
24
5
|
var jsxRuntime = {exports: {}};
|
|
25
6
|
|
|
26
7
|
var reactJsxRuntime_production = {};
|
|
@@ -443,7 +424,22 @@ function requireJsxRuntime () {
|
|
|
443
424
|
|
|
444
425
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
445
426
|
|
|
446
|
-
var
|
|
427
|
+
var e$2={exports:{}};
|
|
428
|
+
|
|
429
|
+
var r$4={};
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* @license React
|
|
433
|
+
* react-jsx-runtime.production.js
|
|
434
|
+
*
|
|
435
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
436
|
+
*
|
|
437
|
+
* This source code is licensed under the MIT license found in the
|
|
438
|
+
* LICENSE file in the root directory of this source tree.
|
|
439
|
+
*/var e$1;function t$2(){if(e$1)return r$4;e$1=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function n(r,e,o){var n=null;if(void 0!==o&&(n=""+o),void 0!==e.key&&(n=""+e.key),"key"in e)for(var i in o={},e)"key"!==i&&(o[i]=e[i]);else o=e;return e=o.ref,{$$typeof:t,type:r,key:n,ref:void 0!==e?e:null,props:o}}return r$4.Fragment=o,r$4.jsx=n,r$4.jsxs=n,r$4}
|
|
440
|
+
|
|
441
|
+
var r$3={};
|
|
442
|
+
|
|
447
443
|
/**
|
|
448
444
|
* @license React
|
|
449
445
|
* react-jsx-runtime.development.js
|
|
@@ -452,7 +448,17 @@ var r,o={exports:{}},t={};var l,n,a={};
|
|
|
452
448
|
*
|
|
453
449
|
* This source code is licensed under the MIT license found in the
|
|
454
450
|
* LICENSE file in the root directory of this source tree.
|
|
455
|
-
*/function
|
|
451
|
+
*/var t$1;function n(){return t$1||(t$1=1,"production"!==process.env.NODE_ENV&&function(){function t(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===N?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return "Fragment";case _:return "Profiler";case b:return "StrictMode";case S:return "Suspense";case j:return "SuspenseList";case w:return "Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return "Portal";case g:return e.displayName||"Context";case v:return (e._context.displayName||"Context")+".Consumer";case k:var r=e.render;return (e=e.displayName)||(e=""!==(e=r.displayName||r.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case h:return null!==(r=e.displayName||null)?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch(e){}}return null}function n(e){return ""+e}function o(e){try{n(e);var r=!1;}catch(e){r=true;}if(r){var t=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),n(e)}}function a(e){if(e===d)return "<>";if("object"==typeof e&&null!==e&&e.$$typeof===O)return "<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch(e){return "<...>"}}function l(){return Error("react-stack-top-frame")}function i(){var e=t(this.type);return P[e]||(P[e]=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!==(e=this.props.ref)?e:null}function c(e,r,n,a,l,c){var u,y=r.children;if(void 0!==y)if(a)if(x(y)){for(a=0;a<y.length;a++)s(y[a]);Object.freeze&&Object.freeze(y);}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 s(y);if(T.call(r,"key")){y=t(e);var m=Object.keys(r).filter(function(e){return "key"!==e});a=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",C[y+a]||(m=0<m.length?"{"+m.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} />',a,y,m,y),C[y+a]=true);}if(y=null,void 0!==n&&(o(n),y=""+n),function(e){if(T.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return false}return void 0!==e.key}(r)&&(o(r.key),y=""+r.key),"key"in r)for(var d in n={},r)"key"!==d&&(n[d]=r[d]);else n=r;return y&&function(e,r){function t(){f||(f=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)",r));}t.isReactWarning=true,Object.defineProperty(e,"key",{get:t,configurable:true});}(n,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,r,t,n,o,a){var l=t.ref;return e={$$typeof:p,type:e,key:r,props:t,_owner:n},null!==(void 0!==l?l:null)?Object.defineProperty(e,"ref",{enumerable:false,get:i}):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:o}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,y,n,null===(u=R.A)?null:u.getOwner(),l,c)}function s(e){u(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===O&&("fulfilled"===e._payload.status?u(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function u(e){return "object"==typeof e&&null!==e&&e.$$typeof===p}var f,y=require$$0,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),g=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),R=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,x=Array.isArray,E=console.createTask?console.createTask:function(){return null},P={},$=(y={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(y,l)(),A=E(a(l)),C={};r$3.Fragment=d,r$3.jsx=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,false,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)},r$3.jsxs=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,true,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)};}()),r$3}
|
|
452
|
+
|
|
453
|
+
var t;function s(){return t||(t=1,"production"===process.env.NODE_ENV?e$2.exports=t$2():e$2.exports=n()),e$2.exports}
|
|
454
|
+
|
|
455
|
+
var r$2=s();
|
|
456
|
+
|
|
457
|
+
function e({className:e="",size:r="md"}){const t={sm:16,md:20,lg:24},o=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`;return r$2.jsx("svg",{width:t[r],height:t[r],xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,"aria-hidden":"true",children:r$2.jsx("path",{d:"M12 4v16m8-8H4"})})}
|
|
458
|
+
|
|
459
|
+
const r$1=({className:r="",size:e="md",color:t="currentColor"})=>{const o={sm:16,md:20,lg:24};return r$2.jsxs("svg",{width:o[e],height:o[e],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[e]} animate-spin ${r}`,fill:"none",stroke:t,viewBox:"0 0 24 24",children:[r$2.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r$2.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"})]})};
|
|
460
|
+
|
|
461
|
+
const r=({className:r="",size:e="md",color:o="currentColor"})=>{const t={sm:16,md:20,lg:24};return r$2.jsxs("svg",{width:t[e],height:t[e],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[e]} ${r}`,fill:"none",stroke:o,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r$2.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),r$2.jsx("circle",{cx:"12",cy:"7",r:"4"})]})};
|
|
456
462
|
|
|
457
463
|
function styleInject(css, ref) {
|
|
458
464
|
if ( ref === void 0 ) ref = {};
|
|
@@ -582,14 +588,14 @@ const PatientSearch = ({ onSelectPatient, onSearchPatients, onCreateNewPatient,
|
|
|
582
588
|
const parts = text.split(regex);
|
|
583
589
|
return parts.map((part, index) => regex.test(part) ? (jsxRuntimeExports.jsx("mark", { className: styles.highlight, children: part }, index)) : (part));
|
|
584
590
|
};
|
|
585
|
-
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(
|
|
591
|
+
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(r$1, { 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 &&
|
|
586
592
|
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 &&
|
|
587
593
|
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
|
|
588
594
|
? styles.statusActive
|
|
589
595
|
: styles.statusInactive), children: patient.active
|
|
590
596
|
? labels.activeStatus
|
|
591
|
-
: labels.inactiveStatus }) })] }) }, patient.id)))] })) : !loading ? (jsxRuntimeExports.jsxs("div", { className: styles.noResults, children: [jsxRuntimeExports.jsx(
|
|
592
|
-
styles.createButtonHighlighted), children: jsxRuntimeExports.jsxs("div", { className: styles.createContent, children: [jsxRuntimeExports.jsx("div", { className: styles.createIconWrapper, children: jsxRuntimeExports.jsx(
|
|
597
|
+
: labels.inactiveStatus }) })] }) }, patient.id)))] })) : !loading ? (jsxRuntimeExports.jsxs("div", { className: styles.noResults, children: [jsxRuntimeExports.jsx(r, { 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 &&
|
|
598
|
+
styles.createButtonHighlighted), children: jsxRuntimeExports.jsxs("div", { className: styles.createContent, children: [jsxRuntimeExports.jsx("div", { className: styles.createIconWrapper, children: jsxRuntimeExports.jsx(e, { 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, "\""] }))] })] }) })] }))] }));
|
|
593
599
|
};
|
|
594
600
|
|
|
595
601
|
module.exports = PatientSearch;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import require$$0__default, { useState, useRef, useEffect } from 'react';
|
|
1
|
+
import require$$0, { useState, useRef, useEffect } from 'react';
|
|
3
2
|
|
|
4
3
|
var jsxRuntime = {exports: {}};
|
|
5
4
|
|
|
@@ -337,7 +336,7 @@ function requireReactJsxRuntime_development () {
|
|
|
337
336
|
object.$$typeof === REACT_ELEMENT_TYPE
|
|
338
337
|
);
|
|
339
338
|
}
|
|
340
|
-
var React = require$$
|
|
339
|
+
var React = require$$0,
|
|
341
340
|
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
342
341
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
343
342
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
@@ -423,7 +422,22 @@ function requireJsxRuntime () {
|
|
|
423
422
|
|
|
424
423
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
425
424
|
|
|
426
|
-
var
|
|
425
|
+
var e$2={exports:{}};
|
|
426
|
+
|
|
427
|
+
var r$4={};
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* @license React
|
|
431
|
+
* react-jsx-runtime.production.js
|
|
432
|
+
*
|
|
433
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
434
|
+
*
|
|
435
|
+
* This source code is licensed under the MIT license found in the
|
|
436
|
+
* LICENSE file in the root directory of this source tree.
|
|
437
|
+
*/var e$1;function t$2(){if(e$1)return r$4;e$1=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function n(r,e,o){var n=null;if(void 0!==o&&(n=""+o),void 0!==e.key&&(n=""+e.key),"key"in e)for(var i in o={},e)"key"!==i&&(o[i]=e[i]);else o=e;return e=o.ref,{$$typeof:t,type:r,key:n,ref:void 0!==e?e:null,props:o}}return r$4.Fragment=o,r$4.jsx=n,r$4.jsxs=n,r$4}
|
|
438
|
+
|
|
439
|
+
var r$3={};
|
|
440
|
+
|
|
427
441
|
/**
|
|
428
442
|
* @license React
|
|
429
443
|
* react-jsx-runtime.development.js
|
|
@@ -432,7 +446,17 @@ var r,o={exports:{}},t={};var l,n,a={};
|
|
|
432
446
|
*
|
|
433
447
|
* This source code is licensed under the MIT license found in the
|
|
434
448
|
* LICENSE file in the root directory of this source tree.
|
|
435
|
-
*/function
|
|
449
|
+
*/var t$1;function n(){return t$1||(t$1=1,"production"!==process.env.NODE_ENV&&function(){function t(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===N?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return "Fragment";case _:return "Profiler";case b:return "StrictMode";case S:return "Suspense";case j:return "SuspenseList";case w:return "Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return "Portal";case g:return e.displayName||"Context";case v:return (e._context.displayName||"Context")+".Consumer";case k:var r=e.render;return (e=e.displayName)||(e=""!==(e=r.displayName||r.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case h:return null!==(r=e.displayName||null)?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch(e){}}return null}function n(e){return ""+e}function o(e){try{n(e);var r=!1;}catch(e){r=true;}if(r){var t=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),n(e)}}function a(e){if(e===d)return "<>";if("object"==typeof e&&null!==e&&e.$$typeof===O)return "<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch(e){return "<...>"}}function l(){return Error("react-stack-top-frame")}function i(){var e=t(this.type);return P[e]||(P[e]=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!==(e=this.props.ref)?e:null}function c(e,r,n,a,l,c){var u,y=r.children;if(void 0!==y)if(a)if(x(y)){for(a=0;a<y.length;a++)s(y[a]);Object.freeze&&Object.freeze(y);}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 s(y);if(T.call(r,"key")){y=t(e);var m=Object.keys(r).filter(function(e){return "key"!==e});a=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",C[y+a]||(m=0<m.length?"{"+m.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} />',a,y,m,y),C[y+a]=true);}if(y=null,void 0!==n&&(o(n),y=""+n),function(e){if(T.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return false}return void 0!==e.key}(r)&&(o(r.key),y=""+r.key),"key"in r)for(var d in n={},r)"key"!==d&&(n[d]=r[d]);else n=r;return y&&function(e,r){function t(){f||(f=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)",r));}t.isReactWarning=true,Object.defineProperty(e,"key",{get:t,configurable:true});}(n,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,r,t,n,o,a){var l=t.ref;return e={$$typeof:p,type:e,key:r,props:t,_owner:n},null!==(void 0!==l?l:null)?Object.defineProperty(e,"ref",{enumerable:false,get:i}):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:o}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,y,n,null===(u=R.A)?null:u.getOwner(),l,c)}function s(e){u(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===O&&("fulfilled"===e._payload.status?u(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function u(e){return "object"==typeof e&&null!==e&&e.$$typeof===p}var f,y=require$$0,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),g=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),R=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,x=Array.isArray,E=console.createTask?console.createTask:function(){return null},P={},$=(y={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(y,l)(),A=E(a(l)),C={};r$3.Fragment=d,r$3.jsx=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,false,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)},r$3.jsxs=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,true,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)};}()),r$3}
|
|
450
|
+
|
|
451
|
+
var t;function s(){return t||(t=1,"production"===process.env.NODE_ENV?e$2.exports=t$2():e$2.exports=n()),e$2.exports}
|
|
452
|
+
|
|
453
|
+
var r$2=s();
|
|
454
|
+
|
|
455
|
+
function e({className:e="",size:r="md"}){const t={sm:16,md:20,lg:24},o=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`;return r$2.jsx("svg",{width:t[r],height:t[r],xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,"aria-hidden":"true",children:r$2.jsx("path",{d:"M12 4v16m8-8H4"})})}
|
|
456
|
+
|
|
457
|
+
const r$1=({className:r="",size:e="md",color:t="currentColor"})=>{const o={sm:16,md:20,lg:24};return r$2.jsxs("svg",{width:o[e],height:o[e],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[e]} animate-spin ${r}`,fill:"none",stroke:t,viewBox:"0 0 24 24",children:[r$2.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r$2.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"})]})};
|
|
458
|
+
|
|
459
|
+
const r=({className:r="",size:e="md",color:o="currentColor"})=>{const t={sm:16,md:20,lg:24};return r$2.jsxs("svg",{width:t[e],height:t[e],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[e]} ${r}`,fill:"none",stroke:o,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r$2.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),r$2.jsx("circle",{cx:"12",cy:"7",r:"4"})]})};
|
|
436
460
|
|
|
437
461
|
function styleInject(css, ref) {
|
|
438
462
|
if ( ref === void 0 ) ref = {};
|
|
@@ -562,14 +586,14 @@ const PatientSearch = ({ onSelectPatient, onSearchPatients, onCreateNewPatient,
|
|
|
562
586
|
const parts = text.split(regex);
|
|
563
587
|
return parts.map((part, index) => regex.test(part) ? (jsxRuntimeExports.jsx("mark", { className: styles.highlight, children: part }, index)) : (part));
|
|
564
588
|
};
|
|
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(
|
|
589
|
+
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(r$1, { 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
590
|
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
591
|
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
592
|
? styles.statusActive
|
|
569
593
|
: styles.statusInactive), children: patient.active
|
|
570
594
|
? labels.activeStatus
|
|
571
|
-
: labels.inactiveStatus }) })] }) }, patient.id)))] })) : !loading ? (jsxRuntimeExports.jsxs("div", { className: styles.noResults, children: [jsxRuntimeExports.jsx(
|
|
572
|
-
styles.createButtonHighlighted), children: jsxRuntimeExports.jsxs("div", { className: styles.createContent, children: [jsxRuntimeExports.jsx("div", { className: styles.createIconWrapper, children: jsxRuntimeExports.jsx(
|
|
595
|
+
: labels.inactiveStatus }) })] }) }, patient.id)))] })) : !loading ? (jsxRuntimeExports.jsxs("div", { className: styles.noResults, children: [jsxRuntimeExports.jsx(r, { 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 &&
|
|
596
|
+
styles.createButtonHighlighted), children: jsxRuntimeExports.jsxs("div", { className: styles.createContent, children: [jsxRuntimeExports.jsx("div", { className: styles.createIconWrapper, children: jsxRuntimeExports.jsx(e, { 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
597
|
};
|
|
574
598
|
|
|
575
599
|
export { PatientSearch as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubenpazch/patient-search",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "PatientSearch component",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "^19.0.0",
|
|
31
31
|
"react-dom": "^19.0.0",
|
|
32
|
-
"@rubenpazch/tokens": "0.
|
|
32
|
+
"@rubenpazch/tokens": "0.4.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@rubenpazch/icons": "6.
|
|
35
|
+
"@rubenpazch/icons": "6.3.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@rubenpazch/typescript-config": "3.0.0"
|
|
@@ -40,6 +40,12 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
+
"lbyte": {
|
|
44
|
+
"categoria": "salud",
|
|
45
|
+
"resumen": "Buscador de pacientes con resultados y selección.",
|
|
46
|
+
"usarCuando": "Elegir un paciente existente en apps clínicas u ópticas.",
|
|
47
|
+
"evitarCuando": "Buscar otro tipo de registros: usa Autocomplete."
|
|
48
|
+
},
|
|
43
49
|
"scripts": {
|
|
44
50
|
"build": "rollup -c",
|
|
45
51
|
"test": "jest --passWithNoTests"
|