@rubenpazch/patient-search 3.0.0 → 3.0.2
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 +5 -5
- package/dist/index.esm.js +5 -5
- 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
|
@@ -443,7 +443,7 @@ function requireJsxRuntime () {
|
|
|
443
443
|
|
|
444
444
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
445
445
|
|
|
446
|
-
var r
|
|
446
|
+
var t,r={exports:{}},o={};var l,n,a={};
|
|
447
447
|
/**
|
|
448
448
|
* @license React
|
|
449
449
|
* react-jsx-runtime.development.js
|
|
@@ -452,7 +452,7 @@ var r,o={exports:{}},t={};var l,n,a={};
|
|
|
452
452
|
*
|
|
453
453
|
* This source code is licensed under the MIT license found in the
|
|
454
454
|
* LICENSE file in the root directory of this source tree.
|
|
455
|
-
*/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
|
|
455
|
+
*/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 u:return "Fragment";case v:return "Profiler";case x: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 g:return "Portal";case j:return s.displayName||"Context";case p:return (s._context.displayName||"Context")+".Consumer";case k:var t=s.render;return (s=s.displayName)||(s=""!==(s=t.displayName||t.name||"")?"ForwardRef("+s+")":"ForwardRef"),s;case L:return null!==(t=s.displayName||null)?t:e(s.type)||"Memo";case y:t=s._payload,s=s._init;try{return e(s(t))}catch(e){}}return null}function t(e){return ""+e}function r(e){try{t(e);var s=!1;}catch(e){s=true;}if(s){var r=(s=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),t(e)}}function o(s){if(s===u)return "<>";if("object"==typeof s&&null!==s&&s.$$typeof===y)return "<...>";try{var t=e(s);return t?"<"+t+">":"<...>"}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,t,o,l,a,i){var c,m=t.children;if(void 0!==m)if(l)if(z(m)){for(l=0;l<m.length;l++)h(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 h(m);if(b.call(t,"key")){m=e(s);var g=Object.keys(t).filter(function(e){return "key"!==e});l=0<g.length?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}",W[m+l]||(g=0<g.length?"{"+g.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,g,m),W[m+l]=true);}if(m=null,void 0!==o&&(r(o),m=""+o),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}(t)&&(r(t.key),m=""+t.key),"key"in t)for(var u in o={},t)"key"!==u&&(o[u]=t[u]);else o=t;return m&&function(e,s){function t(){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));}t.isReactWarning=true,Object.defineProperty(e,"key",{get:t,configurable:true});}(o,"function"==typeof s?s.displayName||s.name||"Unknown":s),function(e,s,t,r,o,l){var a=t.ref;return e={$$typeof:w,type:e,key:s,props:t,_owner:r},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:o}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:l}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(s,m,o,null===(c=$.A)?null:c.getOwner(),a,i)}function h(e){c(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===y&&("fulfilled"===e._payload.status?c(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function c(e){return "object"==typeof e&&null!==e&&e.$$typeof===w}var d,m=require$$0,w=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),p=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(o(l)),W={};a.Fragment=u,a.jsx=function(e,s,t){var r=1e4>$.recentlyCreatedOwnerStacks++;return i(e,s,t,false,r?Error("react-stack-top-frame"):V,r?H(o(e)):Z)},a.jsxs=function(e,s,t){var r=1e4>$.recentlyCreatedOwnerStacks++;return i(e,s,t,true,r?Error("react-stack-top-frame"):V,r?H(o(e)):Z)};}()),a}var h=(n||(n=1,"production"===process.env.NODE_ENV?r.exports=function(){if(t)return o;t=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function r(s,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var l in r={},t)"key"!==l&&(r[l]=t[l]);else r=t;return t=r.ref,{$$typeof:e,type:s,key:o,ref:void 0!==t?t:null,props:r}}return o.Fragment=s,o.jsx=r,o.jsxs=r,o}():r.exports=i()),r.exports);function qe({className:e="",size:s="md"}){const t={sm:16,md:20,lg:24},r=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} ${e}`;return h.jsx("svg",{width:t[s],height:t[s],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:h.jsx("path",{d:"M12 4v16m8-8H4"})})}const Pe=({className:e="",size:s="md",color:t="currentColor"})=>{const r={sm:16,md:20,lg:24};return h.jsxs("svg",{width:r[s],height:r[s],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} animate-spin ${e}`,fill:"none",stroke:t,viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.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 rs=({className:e="",size:s="md",color:t="currentColor"})=>{const r={sm:16,md:20,lg:24};return h.jsxs("svg",{width:r[s],height:r[s],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} ${e}`,fill:"none",stroke:t,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),h.jsx("circle",{cx:"12",cy:"7",r:"4"})]})};const ds={outlined:"material-symbols-outlined",rounded:"material-symbols-rounded",sharp:"material-symbols-sharp"},ms=require$$0__namespace.forwardRef(({name:e,variant:s="outlined",size:t="md",fill:r=0,weight:o=400,grade:l=0,opticalSize:n=24,style:a,className:i,...c},d)=>{const m=(e=>"number"==typeof e?e:"sm"===e?16:"md"===e?20:24)(t),w=`"FILL" ${r}, "wght" ${o}, "GRAD" ${l}, "opsz" ${n}`;return h.jsx("span",{ref:d,"aria-hidden":"true",className:ds[s]+(i?` ${i}`:""),style:{fontVariationSettings:w,fontSize:m,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",...a},...c,children:e})});ms.displayName="MaterialIcon";
|
|
456
456
|
|
|
457
457
|
function styleInject(css, ref) {
|
|
458
458
|
if ( ref === void 0 ) ref = {};
|
|
@@ -582,14 +582,14 @@ const PatientSearch = ({ onSelectPatient, onSearchPatients, onCreateNewPatient,
|
|
|
582
582
|
const parts = text.split(regex);
|
|
583
583
|
return parts.map((part, index) => regex.test(part) ? (jsxRuntimeExports.jsx("mark", { className: styles.highlight, children: part }, index)) : (part));
|
|
584
584
|
};
|
|
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(
|
|
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(Pe, { 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
586
|
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
587
|
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
588
|
? styles.statusActive
|
|
589
589
|
: styles.statusInactive), children: patient.active
|
|
590
590
|
? 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(
|
|
591
|
+
: labels.inactiveStatus }) })] }) }, patient.id)))] })) : !loading ? (jsxRuntimeExports.jsxs("div", { className: styles.noResults, children: [jsxRuntimeExports.jsx(rs, { 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 &&
|
|
592
|
+
styles.createButtonHighlighted), children: jsxRuntimeExports.jsxs("div", { className: styles.createContent, children: [jsxRuntimeExports.jsx("div", { className: styles.createIconWrapper, children: jsxRuntimeExports.jsx(qe, { 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
593
|
};
|
|
594
594
|
|
|
595
595
|
module.exports = PatientSearch;
|
package/dist/index.esm.js
CHANGED
|
@@ -423,7 +423,7 @@ function requireJsxRuntime () {
|
|
|
423
423
|
|
|
424
424
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
425
425
|
|
|
426
|
-
var r
|
|
426
|
+
var t,r={exports:{}},o={};var l,n,a={};
|
|
427
427
|
/**
|
|
428
428
|
* @license React
|
|
429
429
|
* react-jsx-runtime.development.js
|
|
@@ -432,7 +432,7 @@ var r,o={exports:{}},t={};var l,n,a={};
|
|
|
432
432
|
*
|
|
433
433
|
* This source code is licensed under the MIT license found in the
|
|
434
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
|
|
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 u:return "Fragment";case v:return "Profiler";case x: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 g:return "Portal";case j:return s.displayName||"Context";case p:return (s._context.displayName||"Context")+".Consumer";case k:var t=s.render;return (s=s.displayName)||(s=""!==(s=t.displayName||t.name||"")?"ForwardRef("+s+")":"ForwardRef"),s;case L:return null!==(t=s.displayName||null)?t:e(s.type)||"Memo";case y:t=s._payload,s=s._init;try{return e(s(t))}catch(e){}}return null}function t(e){return ""+e}function r(e){try{t(e);var s=!1;}catch(e){s=true;}if(s){var r=(s=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),t(e)}}function o(s){if(s===u)return "<>";if("object"==typeof s&&null!==s&&s.$$typeof===y)return "<...>";try{var t=e(s);return t?"<"+t+">":"<...>"}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,t,o,l,a,i){var c,m=t.children;if(void 0!==m)if(l)if(z(m)){for(l=0;l<m.length;l++)h(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 h(m);if(b.call(t,"key")){m=e(s);var g=Object.keys(t).filter(function(e){return "key"!==e});l=0<g.length?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}",W[m+l]||(g=0<g.length?"{"+g.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,g,m),W[m+l]=true);}if(m=null,void 0!==o&&(r(o),m=""+o),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}(t)&&(r(t.key),m=""+t.key),"key"in t)for(var u in o={},t)"key"!==u&&(o[u]=t[u]);else o=t;return m&&function(e,s){function t(){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));}t.isReactWarning=true,Object.defineProperty(e,"key",{get:t,configurable:true});}(o,"function"==typeof s?s.displayName||s.name||"Unknown":s),function(e,s,t,r,o,l){var a=t.ref;return e={$$typeof:w,type:e,key:s,props:t,_owner:r},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:o}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:l}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(s,m,o,null===(c=$.A)?null:c.getOwner(),a,i)}function h(e){c(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===y&&("fulfilled"===e._payload.status?c(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function c(e){return "object"==typeof e&&null!==e&&e.$$typeof===w}var d,m=require$$0__default,w=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),p=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(o(l)),W={};a.Fragment=u,a.jsx=function(e,s,t){var r=1e4>$.recentlyCreatedOwnerStacks++;return i(e,s,t,false,r?Error("react-stack-top-frame"):V,r?H(o(e)):Z)},a.jsxs=function(e,s,t){var r=1e4>$.recentlyCreatedOwnerStacks++;return i(e,s,t,true,r?Error("react-stack-top-frame"):V,r?H(o(e)):Z)};}()),a}var h=(n||(n=1,"production"===process.env.NODE_ENV?r.exports=function(){if(t)return o;t=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function r(s,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var l in r={},t)"key"!==l&&(r[l]=t[l]);else r=t;return t=r.ref,{$$typeof:e,type:s,key:o,ref:void 0!==t?t:null,props:r}}return o.Fragment=s,o.jsx=r,o.jsxs=r,o}():r.exports=i()),r.exports);function qe({className:e="",size:s="md"}){const t={sm:16,md:20,lg:24},r=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} ${e}`;return h.jsx("svg",{width:t[s],height:t[s],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:h.jsx("path",{d:"M12 4v16m8-8H4"})})}const Pe=({className:e="",size:s="md",color:t="currentColor"})=>{const r={sm:16,md:20,lg:24};return h.jsxs("svg",{width:r[s],height:r[s],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} animate-spin ${e}`,fill:"none",stroke:t,viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.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 rs=({className:e="",size:s="md",color:t="currentColor"})=>{const r={sm:16,md:20,lg:24};return h.jsxs("svg",{width:r[s],height:r[s],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[s]} ${e}`,fill:"none",stroke:t,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),h.jsx("circle",{cx:"12",cy:"7",r:"4"})]})};const ds={outlined:"material-symbols-outlined",rounded:"material-symbols-rounded",sharp:"material-symbols-sharp"},ms=require$$0.forwardRef(({name:e,variant:s="outlined",size:t="md",fill:r=0,weight:o=400,grade:l=0,opticalSize:n=24,style:a,className:i,...c},d)=>{const m=(e=>"number"==typeof e?e:"sm"===e?16:"md"===e?20:24)(t),w=`"FILL" ${r}, "wght" ${o}, "GRAD" ${l}, "opsz" ${n}`;return h.jsx("span",{ref:d,"aria-hidden":"true",className:ds[s]+(i?` ${i}`:""),style:{fontVariationSettings:w,fontSize:m,lineHeight:1,display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",...a},...c,children:e})});ms.displayName="MaterialIcon";
|
|
436
436
|
|
|
437
437
|
function styleInject(css, ref) {
|
|
438
438
|
if ( ref === void 0 ) ref = {};
|
|
@@ -562,14 +562,14 @@ const PatientSearch = ({ onSelectPatient, onSearchPatients, onCreateNewPatient,
|
|
|
562
562
|
const parts = text.split(regex);
|
|
563
563
|
return parts.map((part, index) => regex.test(part) ? (jsxRuntimeExports.jsx("mark", { className: styles.highlight, children: part }, index)) : (part));
|
|
564
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(
|
|
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(Pe, { 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
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
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
568
|
? styles.statusActive
|
|
569
569
|
: styles.statusInactive), children: patient.active
|
|
570
570
|
? 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(
|
|
571
|
+
: labels.inactiveStatus }) })] }) }, patient.id)))] })) : !loading ? (jsxRuntimeExports.jsxs("div", { className: styles.noResults, children: [jsxRuntimeExports.jsx(rs, { 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(qe, { 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
573
|
};
|
|
574
574
|
|
|
575
575
|
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.2",
|
|
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.2.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"
|