@rubenpazch/image-upload 3.1.0 → 3.2.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.
- package/README.md +21 -18
- package/dist/ImageUpload.d.ts +31 -1
- package/dist/ImageUpload.d.ts.map +1 -1
- package/dist/index.cjs.js +148 -20
- package/dist/index.d.ts +31 -1
- package/dist/index.esm.js +148 -20
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -19,24 +19,27 @@ npm install @rubenpazch/image-upload
|
|
|
19
19
|
|
|
20
20
|
El `ref` apunta al `<input type="file">`.
|
|
21
21
|
|
|
22
|
-
| Prop
|
|
23
|
-
|
|
|
24
|
-
| `onUpload`
|
|
25
|
-
| `acceptedFormats`
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
22
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
23
|
+
| -------------------- | --------------------------------------------------------------------------------------- | ---- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| `onUpload` | `(file: File, onProgress?: ((fraction: number) => void) \| undefined) => Promise<void>` | sí | | Sube el archivo. Si quien llama puede seguir la petición (XHR, axios `onUploadProgress`…), informa la fracción enviada (0..1) con `onProgress` y se muestra una barra de avance; si no, solo un indicador de carga. |
|
|
25
|
+
| `acceptedFormats` | `string[]` | | `["image/jpeg", "image/png", "image/svg+xml"]` | |
|
|
26
|
+
| `allowCameraCapture` | `boolean` | | `false` | Muestra "Tomar foto" para capturar con la cámara del equipo (getUserMedia). Solo en escritorio: en celulares y tablets el selector de archivos ya ofrece la cámara nativa. Requiere aceptar algún `image/*`. |
|
|
27
|
+
| `className` | `string` | | `` | |
|
|
28
|
+
| `currentFileIsPdf` | `boolean` | | `false` | El archivo actual es un PDF aunque su URL no termine en `.pdf` (p. ej. una URL `blob:` sin extensión). |
|
|
29
|
+
| `currentFileName` | `string` | | | Nombre sugerido al descargar el archivo actual. |
|
|
30
|
+
| `currentImageUrl` | `string` | | | |
|
|
31
|
+
| `disabled` | `boolean` | | `false` | |
|
|
32
|
+
| `error` | `string` | | | Error externo (validación del formulario). |
|
|
33
|
+
| `hint` | `string` | | | Texto de ayuda bajo el campo. |
|
|
34
|
+
| `id` | `string` | | | |
|
|
35
|
+
| `label` | `string` | | | |
|
|
36
|
+
| `labels` | `Partial<ImageUploadLabels>` | | | Textos de la interfaz; por defecto en español. |
|
|
37
|
+
| `maxSizeMB` | `number` | | `5` | |
|
|
38
|
+
| `name` | `string` | | | |
|
|
39
|
+
| `onRemove` | `() => Promise<void>` | | | |
|
|
40
|
+
| `previewHeight` | `number` | | `200` | |
|
|
41
|
+
| `previewWidth` | `number` | | `200` | |
|
|
42
|
+
| `required` | `boolean` | | `false` | |
|
|
40
43
|
|
|
41
44
|
## DEFAULT_IMAGE_UPLOAD_LABELS
|
|
42
45
|
|
package/dist/ImageUpload.d.ts
CHANGED
|
@@ -2,6 +2,12 @@ import React from "react";
|
|
|
2
2
|
export type ImageUploadLabels = {
|
|
3
3
|
uploadImage: string;
|
|
4
4
|
uploading: string;
|
|
5
|
+
/** Con `{percent}`: se muestra mientras sube si `onUpload` informa el avance. */
|
|
6
|
+
uploadingPercent: string;
|
|
7
|
+
/** Archivo enviado al 100 %, esperando la respuesta del servidor. */
|
|
8
|
+
processing: string;
|
|
9
|
+
/** Nombre accesible de la barra de avance. */
|
|
10
|
+
progressLabel: string;
|
|
5
11
|
invalidFileType: string;
|
|
6
12
|
fileSizeExceeded: string;
|
|
7
13
|
uploadFailed: string;
|
|
@@ -17,12 +23,30 @@ export type ImageUploadLabels = {
|
|
|
17
23
|
uploadError: string;
|
|
18
24
|
pdfDocument: string;
|
|
19
25
|
previewAltText: string;
|
|
26
|
+
takePhoto: string;
|
|
27
|
+
capturePhoto: string;
|
|
28
|
+
cancelCamera: string;
|
|
29
|
+
cameraInstructions: string;
|
|
30
|
+
cameraError: string;
|
|
31
|
+
cameraCaptureFailed: string;
|
|
20
32
|
};
|
|
21
33
|
export declare const DEFAULT_IMAGE_UPLOAD_LABELS: ImageUploadLabels;
|
|
22
34
|
export interface ImageUploadProps {
|
|
23
35
|
label?: string;
|
|
24
36
|
currentImageUrl?: string;
|
|
25
|
-
|
|
37
|
+
/**
|
|
38
|
+
* El archivo actual es un PDF aunque su URL no termine en `.pdf`
|
|
39
|
+
* (p. ej. una URL `blob:` sin extensión).
|
|
40
|
+
*/
|
|
41
|
+
currentFileIsPdf?: boolean;
|
|
42
|
+
/** Nombre sugerido al descargar el archivo actual. */
|
|
43
|
+
currentFileName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Sube el archivo. Si quien llama puede seguir la petición (XHR, axios
|
|
46
|
+
* `onUploadProgress`…), informa la fracción enviada (0..1) con `onProgress`
|
|
47
|
+
* y se muestra una barra de avance; si no, solo un indicador de carga.
|
|
48
|
+
*/
|
|
49
|
+
onUpload: (file: File, onProgress?: (fraction: number) => void) => Promise<void>;
|
|
26
50
|
onRemove?: () => Promise<void>;
|
|
27
51
|
maxSizeMB?: number;
|
|
28
52
|
acceptedFormats?: string[];
|
|
@@ -39,6 +63,12 @@ export interface ImageUploadProps {
|
|
|
39
63
|
name?: string;
|
|
40
64
|
/** Textos de la interfaz; por defecto en español. */
|
|
41
65
|
labels?: Partial<ImageUploadLabels>;
|
|
66
|
+
/**
|
|
67
|
+
* Muestra "Tomar foto" para capturar con la cámara del equipo
|
|
68
|
+
* (getUserMedia). Solo en escritorio: en celulares y tablets el selector de
|
|
69
|
+
* archivos ya ofrece la cámara nativa. Requiere aceptar algún `image/*`.
|
|
70
|
+
*/
|
|
71
|
+
allowCameraCapture?: boolean;
|
|
42
72
|
}
|
|
43
73
|
/** El `ref` apunta al `<input type="file">`. */
|
|
44
74
|
declare const ImageUpload: React.ForwardRefExoticComponent<ImageUploadProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../src/ImageUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../src/ImageUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAkB3D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,gBAAgB,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,iBA4BzC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,EAAE,CACR,IAAI,EAAE,IAAI,EACV,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,KACpC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAWD,gDAAgD;AAChD,QAAA,MAAM,WAAW,2FA8hBhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -429,7 +429,7 @@ var jsxRuntimeExports = requireJsxRuntime();
|
|
|
429
429
|
|
|
430
430
|
var e$3={exports:{}};
|
|
431
431
|
|
|
432
|
-
var r$
|
|
432
|
+
var r$6={};
|
|
433
433
|
|
|
434
434
|
/**
|
|
435
435
|
* @license React
|
|
@@ -439,9 +439,9 @@ var r$5={};
|
|
|
439
439
|
*
|
|
440
440
|
* This source code is licensed under the MIT license found in the
|
|
441
441
|
* LICENSE file in the root directory of this source tree.
|
|
442
|
-
*/var e$2;function t$4(){if(e$2)return r$
|
|
442
|
+
*/var e$2;function t$4(){if(e$2)return r$6;e$2=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$6.Fragment=o,r$6.jsx=n,r$6.jsxs=n,r$6}
|
|
443
443
|
|
|
444
|
-
var r$
|
|
444
|
+
var r$5={};
|
|
445
445
|
|
|
446
446
|
/**
|
|
447
447
|
* @license React
|
|
@@ -451,17 +451,19 @@ var r$4={};
|
|
|
451
451
|
*
|
|
452
452
|
* This source code is licensed under the MIT license found in the
|
|
453
453
|
* LICENSE file in the root directory of this source tree.
|
|
454
|
-
*/var t$3;function n(){return t$3||(t$3=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=React,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$
|
|
454
|
+
*/var t$3;function n(){return t$3||(t$3=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=React,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$5.Fragment=d,r$5.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$5.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$5}
|
|
455
455
|
|
|
456
456
|
var t$2;function s$1(){return t$2||(t$2=1,"production"===process.env.NODE_ENV?e$3.exports=t$4():e$3.exports=n()),e$3.exports}
|
|
457
457
|
|
|
458
|
-
var r$
|
|
458
|
+
var r$4=s$1();
|
|
459
|
+
|
|
460
|
+
const e$1=({className:e="",size:r="md"})=>{const t={sm:16,md:20,lg:24},a=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`;return r$4.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:a,"aria-hidden":"true",children:r$4.jsx("path",{d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})};
|
|
459
461
|
|
|
460
|
-
const
|
|
462
|
+
const r$3=({className:r="",size:e="md",color:t="currentColor"})=>{const o={sm:16,md:20,lg:24};return r$4.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$4.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r$4.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"})]})};
|
|
461
463
|
|
|
462
|
-
const r$2=({
|
|
464
|
+
const t$1={sm:16,md:24,lg:32},r$2=({size:r="md",color:s="currentColor",className:e="",...a})=>{const i="string"==typeof r?t$1[r]||24:r;return r$4.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 48 48",fill:"none",stroke:s,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:`icon icon-tabler icon-tabler-upload ${e}`.trim(),...a,children:r$4.jsx("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02"})})};r$2.displayName="UploadIcon";
|
|
463
465
|
|
|
464
|
-
const
|
|
466
|
+
const i$1={sm:16,md:20,lg:24};function r$1({size:r="md",title:t,...o}){return r$4.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i$1[r],height:i$1[r],fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",role:t?"img":void 0,"aria-hidden":!t||void 0,focusable:"false",...o,children:[t&&r$4.jsx("title",{children:t}),r$4.jsx("path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}),r$4.jsx("circle",{cx:"12",cy:"13",r:"3"})]})}
|
|
465
467
|
|
|
466
468
|
var e,r={exports:{}},t={};var a,l,i={};
|
|
467
469
|
/**
|
|
@@ -472,7 +474,7 @@ var e,r={exports:{}},t={};var a,l,i={};
|
|
|
472
474
|
*
|
|
473
475
|
* This source code is licensed under the MIT license found in the
|
|
474
476
|
* LICENSE file in the root directory of this source tree.
|
|
475
|
-
*/function c(){return a||(a=1,"production"!==process.env.NODE_ENV&&function(){function o(n){if(null==n)return null;if("function"==typeof n)return n.$$typeof===E?null:n.displayName||n.name||null;if("string"==typeof n)return n;switch(n){case p:return "Fragment";case g:return "Profiler";case f:return "StrictMode";case h:return "Suspense";case B:return "SuspenseList";case w:return "Activity"}if("object"==typeof n)switch("number"==typeof n.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case b:return "Portal";case v:return n.displayName||"Context";case y:return (n._context.displayName||"Context")+".Consumer";case x:var e=n.render;return (n=n.displayName)||(n=""!==(n=e.displayName||e.name||"")?"ForwardRef("+n+")":"ForwardRef"),n;case k:return null!==(e=n.displayName||null)?e:o(n.type)||"Memo";case S:e=n._payload,n=n._init;try{return o(n(e))}catch(n){}}return null}function e(n){return ""+n}function r(n){try{e(n);var o=!1;}catch(n){o=true;}if(o){var r=(o=console).error,t="function"==typeof Symbol&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return r.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),e(n)}}function t(n){if(n===p)return "<>";if("object"==typeof n&&null!==n&&n.$$typeof===S)return "<...>";try{var e=o(n);return e?"<"+e+">":"<...>"}catch(n){return "<...>"}}function a(){return Error("react-stack-top-frame")}function l(){var n=o(this.type);return P[n]||(P[n]=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!==(n=this.props.ref)?n:null}function c(n,e,t,a,i,c){var s,_=e.children;if(void 0!==_)if(a)if(j(_)){for(a=0;a<_.length;a++)u(_[a]);Object.freeze&&Object.freeze(_);}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 u(_);if(N.call(e,"key")){_=o(n);var b=Object.keys(e).filter(function(n){return "key"!==n});a=0<b.length?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}",C[_+a]||(b=0<b.length?"{"+b.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,_,b,_),C[_+a]=true);}if(_=null,void 0!==t&&(r(t),_=""+t),function(n){if(N.call(n,"key")){var o=Object.getOwnPropertyDescriptor(n,"key").get;if(o&&o.isReactWarning)return false}return void 0!==n.key}(e)&&(r(e.key),_=""+e.key),"key"in e)for(var p in t={},e)"key"!==p&&(t[p]=e[p]);else t=e;return _&&function(n,o){function e(){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)",o));}e.isReactWarning=true,Object.defineProperty(n,"key",{get:e,configurable:true});}(t,"function"==typeof n?n.displayName||n.name||"Unknown":n),function(n,o,e,r,t,a){var i=e.ref;return n={$$typeof:m,type:n,key:o,props:e,_owner:r},null!==(void 0!==i?i:null)?Object.defineProperty(n,"ref",{enumerable:false,get:l}):Object.defineProperty(n,"ref",{enumerable:false,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(n,"_debugStack",{configurable:false,enumerable:false,writable:true,value:t}),Object.defineProperty(n,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}(n,_,t,null===(s=O.A)?null:s.getOwner(),i,c)}function u(n){s(n)?n._store&&(n._store.validated=1):"object"==typeof n&&null!==n&&n.$$typeof===S&&("fulfilled"===n._payload.status?s(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1));}function s(n){return "object"==typeof n&&null!==n&&n.$$typeof===m}var d,_=React,m=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),v=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),O=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,j=Array.isArray,I=console.createTask?console.createTask:function(){return null},P={},z=(_={react_stack_bottom_frame:function(n){return n()}}).react_stack_bottom_frame.bind(_,a)(),W=I(t(a)),C={};i.Fragment=p,i.jsx=function(n,o,e){var r=1e4>O.recentlyCreatedOwnerStacks++;return c(n,o,e,false,r?Error("react-stack-top-frame"):z,r?I(t(n)):W)},i.jsxs=function(n,o,e){var r=1e4>O.recentlyCreatedOwnerStacks++;return c(n,o,e,true,r?Error("react-stack-top-frame"):z,r?I(t(n)):W)};}()),i}var u=(l||(l=1,"production"===process.env.NODE_ENV?r.exports=function(){if(e)return t;e=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(o,e,r){var t=null;if(void 0!==r&&(t=""+r),void 0!==e.key&&(t=""+e.key),"key"in e)for(var a in r={},e)"key"!==a&&(r[a]=e[a]);else r=e;return e=r.ref,{$$typeof:n,type:o,key:t,ref:void 0!==e?e:null,props:r}}return t.Fragment=o,t.jsx=r,t.jsxs=r,t}():r.exports=c()),r.exports);var s={root:"Button-module_root__CbGH4",sizeSmall:"Button-module_sizeSmall__cwk1u",sizeMedium:"Button-module_sizeMedium__WI9SU",sizeLarge:"Button-module_sizeLarge__DCsOs",disabled:"Button-module_disabled__JgtZl",fullWidth:"Button-module_fullWidth__dOsPn",noElevation:"Button-module_noElevation__I6-zN",loading:"Button-module_loading__fZbPs",loadingWrapper:"Button-module_loadingWrapper__NrZp3",content:"Button-module_content__xCYa9",contentHidden:"Button-module_contentHidden__lJy-Z",startIcon:"Button-module_startIcon__x3190",endIcon:"Button-module_endIcon__9vUum",text:"Button-module_text__5mE0X",textPrimary:"Button-module_textPrimary__vfnk5",textSecondary:"Button-module_textSecondary__a3EiY",textSuccess:"Button-module_textSuccess__F84Hf",textError:"Button-module_textError__47t2-",textWarning:"Button-module_textWarning__sUoJ4",textInfo:"Button-module_textInfo__eHIQf",contained:"Button-module_contained__ihcEr",containedPrimary:"Button-module_containedPrimary__QABiB",containedSecondary:"Button-module_containedSecondary__Amyuq",containedSuccess:"Button-module_containedSuccess__klgok",containedError:"Button-module_containedError__WOxWG",containedWarning:"Button-module_containedWarning__dFc-N",containedInfo:"Button-module_containedInfo__PLgZO",outlined:"Button-module_outlined__3QTXD",outlinedPrimary:"Button-module_outlinedPrimary__fKrCf",outlinedSecondary:"Button-module_outlinedSecondary__n7OpX",outlinedSuccess:"Button-module_outlinedSuccess__Y2Plg",outlinedError:"Button-module_outlinedError__6NJ-J",outlinedWarning:"Button-module_outlinedWarning__aXlYk",outlinedInfo:"Button-module_outlinedInfo__hpDkF",spinner:"Button-module_spinner__vwfOT",spin:"Button-module_spin__fjXhP",spinnerCircle:"Button-module_spinnerCircle__7vRpf",spinnerDash:"Button-module_spinnerDash__y8Dii"};!function(n,o){ void 0===o&&(o={});var e=o.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===e&&r.firstChild?r.insertBefore(t,r.firstChild):r.appendChild(t),t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));}}(".Button-module_root__CbGH4 {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n font-family: var(--lb-font-sans);\n font-weight: var(--lb-font-weight-medium);\n border: 1px solid transparent;\n line-height: 1.75;\n white-space: nowrap;\n background: transparent;\n color: inherit;\n cursor: pointer;\n border-radius: var(--lb-radius-md);\n transition:\n background-color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n border-color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.Button-module_root__CbGH4:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px\n color-mix(in srgb, var(--lb-color-ring) 50%, transparent);\n}\n\n/* Size variants */\n.Button-module_sizeSmall__cwk1u {\n padding: 0.25rem 0.625rem;\n font-size: var(--lb-font-size-sm);\n min-height: 1.875rem;\n}\n\n.Button-module_sizeMedium__WI9SU {\n padding: 0.375rem 1rem;\n font-size: var(--lb-font-size-sm);\n min-height: 2.25rem;\n}\n\n.Button-module_sizeLarge__DCsOs {\n padding: 0.5rem 1.375rem;\n font-size: var(--lb-font-size-md);\n min-height: 2.625rem;\n}\n\n/* Disabled state */\n/* Combined with `.root` so it beats variant colors (e.g. .containedPrimary)\n regardless of source order (higher specificity). */\n.Button-module_root__CbGH4.Button-module_disabled__JgtZl {\n background: var(--lb-color-muted);\n background-color: var(--lb-color-muted);\n color: var(--lb-color-muted-foreground);\n border-color: transparent;\n cursor: not-allowed;\n pointer-events: none;\n box-shadow: none;\n opacity: 1;\n}\n\n/* Full width */\n.Button-module_fullWidth__dOsPn {\n width: 100%;\n}\n\n/* No elevation */\n.Button-module_noElevation__I6-zN {\n box-shadow: none !important;\n}\n\n/* Loading state */\n.Button-module_loading__fZbPs {\n pointer-events: none;\n}\n\n.Button-module_loadingWrapper__NrZp3 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.Button-module_content__xCYa9 {\n display: inline-flex;\n align-items: inherit;\n justify-content: inherit;\n gap: 0.5rem;\n}\n\n.Button-module_contentHidden__lJy-Z {\n opacity: 0;\n}\n\n.Button-module_startIcon__x3190,\n.Button-module_endIcon__9vUum {\n display: inherit;\n font-size: 1.25em;\n line-height: 1;\n}\n\n/* Variant: text */\n.Button-module_text__5mE0X {\n padding: 0.375rem 0.5rem;\n}\n\n.Button-module_text__5mE0X:hover {\n background-color: rgba(0, 0, 0, 0.04);\n}\n\n/* ============================================\n COLOR STYLES - TEXT VARIANT\n ============================================ */\n\n/* Primary */\n.Button-module_textPrimary__vfnk5 {\n color: var(--lb-color-primary);\n}\n.Button-module_textPrimary__vfnk5:hover {\n background-color: color-mix(in srgb, var(--lb-color-primary) 6%, transparent);\n}\n\n/* Secondary */\n.Button-module_textSecondary__a3EiY {\n color: var(--lb-color-neutral-600);\n}\n.Button-module_textSecondary__a3EiY:hover {\n background-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 6%,\n transparent\n );\n}\n\n/* Success */\n.Button-module_textSuccess__F84Hf {\n color: var(--lb-color-success);\n}\n.Button-module_textSuccess__F84Hf:hover {\n background-color: color-mix(in srgb, var(--lb-color-success) 6%, transparent);\n}\n\n/* Error */\n.Button-module_textError__47t2- {\n color: var(--lb-color-danger);\n}\n.Button-module_textError__47t2-:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger) 6%, transparent);\n}\n\n/* Warning */\n.Button-module_textWarning__sUoJ4 {\n color: var(--lb-color-warning);\n}\n.Button-module_textWarning__sUoJ4:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning) 6%, transparent);\n}\n\n/* Info */\n.Button-module_textInfo__eHIQf {\n color: var(--lb-color-info);\n}\n.Button-module_textInfo__eHIQf:hover {\n background-color: color-mix(in srgb, var(--lb-color-info) 6%, transparent);\n}\n\n/* ============================================\n COLOR STYLES - CONTAINED VARIANT\n ============================================ */\n\n/* Contained base */\n.Button-module_contained__ihcEr {\n box-shadow:\n 0px 3px 1px -2px rgba(0, 0, 0, 0.2),\n 0px 2px 2px 0px rgba(0, 0, 0, 0.14),\n 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n}\n\n.Button-module_contained__ihcEr:hover {\n box-shadow:\n 0px 2px 4px -1px rgba(0, 0, 0, 0.2),\n 0px 4px 5px 0px rgba(0, 0, 0, 0.14),\n 0px 1px 10px 0px rgba(0, 0, 0, 0.12);\n}\n\n.Button-module_contained__ihcEr:active {\n box-shadow:\n 0px 5px 5px -3px rgba(0, 0, 0, 0.2),\n 0px 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0px 3px 14px 2px rgba(0, 0, 0, 0.12);\n}\n\n/* Primary */\n.Button-module_containedPrimary__QABiB {\n background-color: var(--lb-color-primary);\n color: var(--lb-color-primary-foreground);\n}\n.Button-module_containedPrimary__QABiB:hover {\n background-color: var(--lb-color-primary-hover);\n}\n\n/* Secondary */\n.Button-module_containedSecondary__Amyuq {\n background-color: var(--lb-color-neutral-600);\n color: var(--lb-color-primary-foreground);\n}\n.Button-module_containedSecondary__Amyuq:hover {\n background-color: var(--lb-color-neutral-700);\n}\n\n/* Success */\n.Button-module_containedSuccess__klgok {\n background-color: var(--lb-color-success);\n color: var(--lb-color-success-foreground);\n}\n.Button-module_containedSuccess__klgok:hover {\n background-color: color-mix(in srgb, var(--lb-color-success), black 12%);\n}\n\n/* Error */\n.Button-module_containedError__WOxWG {\n background-color: var(--lb-color-danger);\n color: var(--lb-color-danger-foreground);\n}\n.Button-module_containedError__WOxWG:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger), black 12%);\n}\n\n/* Warning */\n.Button-module_containedWarning__dFc-N {\n background-color: var(--lb-color-warning);\n color: var(--lb-color-warning-foreground);\n}\n.Button-module_containedWarning__dFc-N:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning), black 12%);\n}\n\n/* Info */\n.Button-module_containedInfo__PLgZO {\n background-color: var(--lb-color-info);\n color: var(--lb-color-info-foreground);\n}\n.Button-module_containedInfo__PLgZO:hover {\n background-color: color-mix(in srgb, var(--lb-color-info), black 12%);\n}\n\n/* ============================================\n COLOR STYLES - OUTLINED VARIANT\n ============================================ */\n\n/* Outlined base */\n.Button-module_outlined__3QTXD {\n border: 1px solid var(--lb-color-border);\n}\n\n/* Primary */\n.Button-module_outlinedPrimary__fKrCf {\n color: var(--lb-color-primary);\n border-color: color-mix(in srgb, var(--lb-color-primary) 50%, transparent);\n}\n.Button-module_outlinedPrimary__fKrCf:hover {\n background-color: color-mix(in srgb, var(--lb-color-primary) 6%, transparent);\n border-color: var(--lb-color-primary);\n}\n\n/* Secondary */\n.Button-module_outlinedSecondary__n7OpX {\n color: var(--lb-color-neutral-600);\n border-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 50%,\n transparent\n );\n}\n.Button-module_outlinedSecondary__n7OpX:hover {\n background-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 6%,\n transparent\n );\n border-color: var(--lb-color-neutral-600);\n}\n\n/* Success */\n.Button-module_outlinedSuccess__Y2Plg {\n color: var(--lb-color-success);\n border-color: color-mix(in srgb, var(--lb-color-success) 50%, transparent);\n}\n.Button-module_outlinedSuccess__Y2Plg:hover {\n background-color: color-mix(in srgb, var(--lb-color-success) 6%, transparent);\n border-color: var(--lb-color-success);\n}\n\n/* Error */\n.Button-module_outlinedError__6NJ-J {\n color: var(--lb-color-danger);\n border-color: color-mix(in srgb, var(--lb-color-danger) 50%, transparent);\n}\n.Button-module_outlinedError__6NJ-J:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger) 6%, transparent);\n border-color: var(--lb-color-danger);\n}\n\n/* Warning */\n.Button-module_outlinedWarning__aXlYk {\n color: var(--lb-color-warning);\n border-color: color-mix(in srgb, var(--lb-color-warning) 50%, transparent);\n}\n.Button-module_outlinedWarning__aXlYk:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning) 6%, transparent);\n border-color: var(--lb-color-warning);\n}\n\n/* Info */\n.Button-module_outlinedInfo__hpDkF {\n color: var(--lb-color-info);\n border-color: color-mix(in srgb, var(--lb-color-info) 50%, transparent);\n}\n.Button-module_outlinedInfo__hpDkF:hover {\n background-color: color-mix(in srgb, var(--lb-color-info) 6%, transparent);\n border-color: var(--lb-color-info);\n}\n\n/* Spinner animation */\n.Button-module_spinner__vwfOT {\n display: inline-flex;\n animation: Button-module_spin__fjXhP 0.8s linear infinite;\n}\n\n.Button-module_spinnerCircle__7vRpf {\n stroke-dasharray: 50;\n stroke-dashoffset: 25;\n animation: Button-module_spinnerDash__y8Dii 1.5s ease-in-out infinite;\n}\n\n@keyframes Button-module_spin__fjXhP {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes Button-module_spinnerDash__y8Dii {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n}\n");const d=(...n)=>n.filter(Boolean).join(" "),_={small:s.sizeSmall,medium:s.sizeMedium,large:s.sizeLarge},m=({size:n})=>{const o={small:14,medium:18,large:22}[n];return u.jsx("svg",{className:s.spinner,width:o,height:o,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsx("circle",{className:s.spinnerCircle,cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})})},b=React.forwardRef((n,e)=>{const{variant:r="text",color:t="primary",size:a="medium",component:l,className:i,loading:c=false,startIcon:b,endIcon:p,fullWidth:f=false,disableElevation:g=false,children:y,...v}=n,x=shared.toLegacySize(a),h="disabled"in n&&n.disabled,B="href"in n?n.href:void 0,k=l||(B?"a":"button"),S=h||c,w=d(s.root,s[r],((n,o)=>{const e=`${o}${n.charAt(0).toUpperCase()}${n.slice(1)}`;return s[e]||""})(t,r),_[x],S?s.disabled:void 0,f?s.fullWidth:void 0,g?s.noElevation:void 0,c?s.loading:void 0,i),E="button"===k?{disabled:S}:{},O="a"===k?{href:B,"aria-disabled":S}:{};return u.jsxs(k,{ref:e,className:w,...E,...O,...v,children:[c&&u.jsx("span",{className:s.loadingWrapper,children:u.jsx(m,{size:x})}),u.jsxs("span",{className:d(s.content,c?s.contentHidden:void 0),children:[b&&u.jsx("span",{className:s.startIcon,children:b}),y,p&&u.jsx("span",{className:s.endIcon,children:p})]})]})});b.displayName="Button";
|
|
477
|
+
*/function c(){return a||(a=1,"production"!==process.env.NODE_ENV&&function(){function o(n){if(null==n)return null;if("function"==typeof n)return n.$$typeof===E?null:n.displayName||n.name||null;if("string"==typeof n)return n;switch(n){case p:return "Fragment";case g:return "Profiler";case f:return "StrictMode";case h:return "Suspense";case B:return "SuspenseList";case w:return "Activity"}if("object"==typeof n)switch("number"==typeof n.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case b:return "Portal";case v:return n.displayName||"Context";case y:return (n._context.displayName||"Context")+".Consumer";case x:var e=n.render;return (n=n.displayName)||(n=""!==(n=e.displayName||e.name||"")?"ForwardRef("+n+")":"ForwardRef"),n;case k:return null!==(e=n.displayName||null)?e:o(n.type)||"Memo";case S:e=n._payload,n=n._init;try{return o(n(e))}catch(n){}}return null}function e(n){return ""+n}function r(n){try{e(n);var o=!1;}catch(n){o=true;}if(o){var r=(o=console).error,t="function"==typeof Symbol&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return r.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),e(n)}}function t(n){if(n===p)return "<>";if("object"==typeof n&&null!==n&&n.$$typeof===S)return "<...>";try{var e=o(n);return e?"<"+e+">":"<...>"}catch(n){return "<...>"}}function a(){return Error("react-stack-top-frame")}function l(){var n=o(this.type);return P[n]||(P[n]=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!==(n=this.props.ref)?n:null}function c(n,e,t,a,i,c){var s,_=e.children;if(void 0!==_)if(a)if(j(_)){for(a=0;a<_.length;a++)u(_[a]);Object.freeze&&Object.freeze(_);}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 u(_);if(N.call(e,"key")){_=o(n);var b=Object.keys(e).filter(function(n){return "key"!==n});a=0<b.length?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}",C[_+a]||(b=0<b.length?"{"+b.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,_,b,_),C[_+a]=true);}if(_=null,void 0!==t&&(r(t),_=""+t),function(n){if(N.call(n,"key")){var o=Object.getOwnPropertyDescriptor(n,"key").get;if(o&&o.isReactWarning)return false}return void 0!==n.key}(e)&&(r(e.key),_=""+e.key),"key"in e)for(var p in t={},e)"key"!==p&&(t[p]=e[p]);else t=e;return _&&function(n,o){function e(){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)",o));}e.isReactWarning=true,Object.defineProperty(n,"key",{get:e,configurable:true});}(t,"function"==typeof n?n.displayName||n.name||"Unknown":n),function(n,o,e,r,t,a){var i=e.ref;return n={$$typeof:m,type:n,key:o,props:e,_owner:r},null!==(void 0!==i?i:null)?Object.defineProperty(n,"ref",{enumerable:false,get:l}):Object.defineProperty(n,"ref",{enumerable:false,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(n,"_debugStack",{configurable:false,enumerable:false,writable:true,value:t}),Object.defineProperty(n,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}(n,_,t,null===(s=O.A)?null:s.getOwner(),i,c)}function u(n){s(n)?n._store&&(n._store.validated=1):"object"==typeof n&&null!==n&&n.$$typeof===S&&("fulfilled"===n._payload.status?s(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1));}function s(n){return "object"==typeof n&&null!==n&&n.$$typeof===m}var d,_=React,m=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),v=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),O=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,j=Array.isArray,I=console.createTask?console.createTask:function(){return null},P={},z=(_={react_stack_bottom_frame:function(n){return n()}}).react_stack_bottom_frame.bind(_,a)(),W=I(t(a)),C={};i.Fragment=p,i.jsx=function(n,o,e){var r=1e4>O.recentlyCreatedOwnerStacks++;return c(n,o,e,false,r?Error("react-stack-top-frame"):z,r?I(t(n)):W)},i.jsxs=function(n,o,e){var r=1e4>O.recentlyCreatedOwnerStacks++;return c(n,o,e,true,r?Error("react-stack-top-frame"):z,r?I(t(n)):W)};}()),i}var u=(l||(l=1,"production"===process.env.NODE_ENV?r.exports=function(){if(e)return t;e=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(o,e,r){var t=null;if(void 0!==r&&(t=""+r),void 0!==e.key&&(t=""+e.key),"key"in e)for(var a in r={},e)"key"!==a&&(r[a]=e[a]);else r=e;return e=r.ref,{$$typeof:n,type:o,key:t,ref:void 0!==e?e:null,props:r}}return t.Fragment=o,t.jsx=r,t.jsxs=r,t}():r.exports=c()),r.exports);var s={root:"Button-module_root__CbGH4",sizeSmall:"Button-module_sizeSmall__cwk1u",sizeMedium:"Button-module_sizeMedium__WI9SU",sizeLarge:"Button-module_sizeLarge__DCsOs",disabled:"Button-module_disabled__JgtZl",fullWidth:"Button-module_fullWidth__dOsPn",noElevation:"Button-module_noElevation__I6-zN",loading:"Button-module_loading__fZbPs",loadingWrapper:"Button-module_loadingWrapper__NrZp3",content:"Button-module_content__xCYa9",contentHidden:"Button-module_contentHidden__lJy-Z",startIcon:"Button-module_startIcon__x3190",endIcon:"Button-module_endIcon__9vUum",text:"Button-module_text__5mE0X",textPrimary:"Button-module_textPrimary__vfnk5",textSecondary:"Button-module_textSecondary__a3EiY",textSuccess:"Button-module_textSuccess__F84Hf",textError:"Button-module_textError__47t2-",textWarning:"Button-module_textWarning__sUoJ4",textInfo:"Button-module_textInfo__eHIQf",contained:"Button-module_contained__ihcEr",containedPrimary:"Button-module_containedPrimary__QABiB",containedSecondary:"Button-module_containedSecondary__Amyuq",containedSuccess:"Button-module_containedSuccess__klgok",containedError:"Button-module_containedError__WOxWG",containedWarning:"Button-module_containedWarning__dFc-N",containedInfo:"Button-module_containedInfo__PLgZO",outlined:"Button-module_outlined__3QTXD",outlinedPrimary:"Button-module_outlinedPrimary__fKrCf",outlinedSecondary:"Button-module_outlinedSecondary__n7OpX",outlinedSuccess:"Button-module_outlinedSuccess__Y2Plg",outlinedError:"Button-module_outlinedError__6NJ-J",outlinedWarning:"Button-module_outlinedWarning__aXlYk",outlinedInfo:"Button-module_outlinedInfo__hpDkF",spinner:"Button-module_spinner__vwfOT",spin:"Button-module_spin__fjXhP",spinnerCircle:"Button-module_spinnerCircle__7vRpf",spinnerDash:"Button-module_spinnerDash__y8Dii"};!function(n,o){ void 0===o&&(o={});var e=o.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===e&&r.firstChild?r.insertBefore(t,r.firstChild):r.appendChild(t),t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));}}(".Button-module_root__CbGH4 {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n font-family: var(--lb-font-sans);\n font-weight: var(--lb-font-weight-medium);\n border: 1px solid transparent;\n line-height: 1.75;\n white-space: nowrap;\n background: transparent;\n color: inherit;\n cursor: pointer;\n border-radius: var(--lb-radius-md);\n transition:\n background-color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n border-color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.Button-module_root__CbGH4:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px\n color-mix(in srgb, var(--lb-color-ring) 50%, transparent);\n}\n\n/* Size variants */\n.Button-module_sizeSmall__cwk1u {\n padding: 0.25rem 0.625rem;\n font-size: var(--lb-font-size-sm);\n min-height: 1.875rem;\n}\n\n.Button-module_sizeMedium__WI9SU {\n padding: 0.375rem 1rem;\n font-size: var(--lb-font-size-sm);\n min-height: 2.25rem;\n}\n\n.Button-module_sizeLarge__DCsOs {\n padding: 0.5rem 1.375rem;\n font-size: var(--lb-font-size-md);\n min-height: 2.625rem;\n}\n\n/* Disabled state */\n/* Combined with `.root` so it beats variant colors (e.g. .containedPrimary)\n regardless of source order (higher specificity). */\n.Button-module_root__CbGH4.Button-module_disabled__JgtZl {\n background: var(--lb-color-muted);\n background-color: var(--lb-color-muted);\n color: var(--lb-color-muted-foreground);\n border-color: transparent;\n cursor: not-allowed;\n pointer-events: none;\n box-shadow: none;\n opacity: 1;\n}\n\n/* Full width */\n.Button-module_fullWidth__dOsPn {\n width: 100%;\n}\n\n/* No elevation */\n.Button-module_noElevation__I6-zN {\n box-shadow: none !important;\n}\n\n/* Loading state */\n.Button-module_loading__fZbPs {\n pointer-events: none;\n}\n\n.Button-module_loadingWrapper__NrZp3 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.Button-module_content__xCYa9 {\n display: inline-flex;\n align-items: inherit;\n justify-content: inherit;\n gap: 0.5rem;\n}\n\n.Button-module_contentHidden__lJy-Z {\n opacity: 0;\n}\n\n.Button-module_startIcon__x3190,\n.Button-module_endIcon__9vUum {\n display: inherit;\n font-size: 1.25em;\n line-height: 1;\n}\n\n/* Variant: text */\n.Button-module_text__5mE0X {\n padding: 0.375rem 0.5rem;\n}\n\n.Button-module_text__5mE0X:hover {\n background-color: rgba(0, 0, 0, 0.04);\n}\n\n/* ============================================\n COLOR STYLES - TEXT VARIANT\n ============================================ */\n\n/* Primary */\n.Button-module_textPrimary__vfnk5 {\n color: var(--lb-color-primary);\n}\n.Button-module_textPrimary__vfnk5:hover {\n background-color: color-mix(in srgb, var(--lb-color-primary) 6%, transparent);\n}\n\n/* Secondary */\n.Button-module_textSecondary__a3EiY {\n color: var(--lb-color-neutral-600);\n}\n.Button-module_textSecondary__a3EiY:hover {\n background-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 6%,\n transparent\n );\n}\n\n/* Success */\n.Button-module_textSuccess__F84Hf {\n color: var(--lb-color-success);\n}\n.Button-module_textSuccess__F84Hf:hover {\n background-color: color-mix(in srgb, var(--lb-color-success) 6%, transparent);\n}\n\n/* Error */\n.Button-module_textError__47t2- {\n color: var(--lb-color-danger);\n}\n.Button-module_textError__47t2-:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger) 6%, transparent);\n}\n\n/* Warning */\n.Button-module_textWarning__sUoJ4 {\n color: var(--lb-color-warning);\n}\n.Button-module_textWarning__sUoJ4:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning) 6%, transparent);\n}\n\n/* Info */\n.Button-module_textInfo__eHIQf {\n color: var(--lb-color-info);\n}\n.Button-module_textInfo__eHIQf:hover {\n background-color: color-mix(in srgb, var(--lb-color-info) 6%, transparent);\n}\n\n/* ============================================\n COLOR STYLES - CONTAINED VARIANT\n ============================================ */\n\n/* Contained base */\n.Button-module_contained__ihcEr {\n box-shadow:\n 0px 3px 1px -2px rgba(0, 0, 0, 0.2),\n 0px 2px 2px 0px rgba(0, 0, 0, 0.14),\n 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n}\n\n.Button-module_contained__ihcEr:hover {\n box-shadow:\n 0px 2px 4px -1px rgba(0, 0, 0, 0.2),\n 0px 4px 5px 0px rgba(0, 0, 0, 0.14),\n 0px 1px 10px 0px rgba(0, 0, 0, 0.12);\n}\n\n.Button-module_contained__ihcEr:active {\n box-shadow:\n 0px 5px 5px -3px rgba(0, 0, 0, 0.2),\n 0px 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0px 3px 14px 2px rgba(0, 0, 0, 0.12);\n}\n\n/* Primary */\n.Button-module_containedPrimary__QABiB {\n background-color: var(--lb-color-primary);\n color: var(--lb-color-primary-foreground);\n}\n.Button-module_containedPrimary__QABiB:hover {\n background-color: var(--lb-color-primary-hover);\n}\n\n/* Secondary */\n.Button-module_containedSecondary__Amyuq {\n background-color: var(--lb-color-neutral-600);\n color: var(--lb-color-primary-foreground);\n}\n.Button-module_containedSecondary__Amyuq:hover {\n background-color: var(--lb-color-neutral-700);\n}\n\n/* Success */\n.Button-module_containedSuccess__klgok {\n background-color: var(--lb-color-success);\n color: var(--lb-color-success-foreground);\n}\n.Button-module_containedSuccess__klgok:hover {\n background-color: color-mix(in srgb, var(--lb-color-success), black 12%);\n}\n\n/* Error */\n.Button-module_containedError__WOxWG {\n background-color: var(--lb-color-danger);\n color: var(--lb-color-danger-foreground);\n}\n.Button-module_containedError__WOxWG:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger), black 12%);\n}\n\n/* Warning */\n.Button-module_containedWarning__dFc-N {\n background-color: var(--lb-color-warning);\n color: var(--lb-color-warning-foreground);\n}\n.Button-module_containedWarning__dFc-N:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning), black 12%);\n}\n\n/* Info */\n.Button-module_containedInfo__PLgZO {\n background-color: var(--lb-color-info);\n color: var(--lb-color-info-foreground);\n}\n.Button-module_containedInfo__PLgZO:hover {\n background-color: color-mix(in srgb, var(--lb-color-info), black 12%);\n}\n\n/* ============================================\n COLOR STYLES - OUTLINED VARIANT\n ============================================ */\n\n/* Outlined base */\n.Button-module_outlined__3QTXD {\n border: 1px solid var(--lb-color-border);\n}\n\n/* Primary */\n.Button-module_outlinedPrimary__fKrCf {\n color: var(--lb-color-primary);\n border-color: color-mix(in srgb, var(--lb-color-primary) 50%, transparent);\n}\n.Button-module_outlinedPrimary__fKrCf:hover {\n background-color: color-mix(in srgb, var(--lb-color-primary) 6%, transparent);\n border-color: var(--lb-color-primary);\n}\n\n/* Secondary */\n.Button-module_outlinedSecondary__n7OpX {\n color: var(--lb-color-neutral-600);\n border-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 50%,\n transparent\n );\n}\n.Button-module_outlinedSecondary__n7OpX:hover {\n background-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 6%,\n transparent\n );\n border-color: var(--lb-color-neutral-600);\n}\n\n/* Success */\n.Button-module_outlinedSuccess__Y2Plg {\n color: var(--lb-color-success);\n border-color: color-mix(in srgb, var(--lb-color-success) 50%, transparent);\n}\n.Button-module_outlinedSuccess__Y2Plg:hover {\n background-color: color-mix(in srgb, var(--lb-color-success) 6%, transparent);\n border-color: var(--lb-color-success);\n}\n\n/* Error */\n.Button-module_outlinedError__6NJ-J {\n color: var(--lb-color-danger);\n border-color: color-mix(in srgb, var(--lb-color-danger) 50%, transparent);\n}\n.Button-module_outlinedError__6NJ-J:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger) 6%, transparent);\n border-color: var(--lb-color-danger);\n}\n\n/* Warning */\n.Button-module_outlinedWarning__aXlYk {\n color: var(--lb-color-warning);\n border-color: color-mix(in srgb, var(--lb-color-warning) 50%, transparent);\n}\n.Button-module_outlinedWarning__aXlYk:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning) 6%, transparent);\n border-color: var(--lb-color-warning);\n}\n\n/* Info */\n.Button-module_outlinedInfo__hpDkF {\n color: var(--lb-color-info);\n border-color: color-mix(in srgb, var(--lb-color-info) 50%, transparent);\n}\n.Button-module_outlinedInfo__hpDkF:hover {\n background-color: color-mix(in srgb, var(--lb-color-info) 6%, transparent);\n border-color: var(--lb-color-info);\n}\n\n/* Spinner animation */\n.Button-module_spinner__vwfOT {\n display: inline-flex;\n animation: Button-module_spin__fjXhP 0.8s linear infinite;\n}\n\n.Button-module_spinnerCircle__7vRpf {\n stroke-dasharray: 50;\n stroke-dashoffset: 25;\n animation: Button-module_spinnerDash__y8Dii 1.5s ease-in-out infinite;\n}\n\n@keyframes Button-module_spin__fjXhP {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes Button-module_spinnerDash__y8Dii {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n}\n");const d=(...n)=>n.filter(Boolean).join(" "),_={small:s.sizeSmall,medium:s.sizeMedium,large:s.sizeLarge},m=({size:n})=>{const o={small:14,medium:18,large:22}[n];return u.jsx("svg",{className:s.spinner,width:o,height:o,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsx("circle",{className:s.spinnerCircle,cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})})},b=React.forwardRef((n,e)=>{const{variant:r="text",color:t="primary",size:a="medium",component:l,className:i,loading:c=false,startIcon:b,endIcon:p,fullWidth:f=false,disableElevation:g=false,children:y,...v}=n,x=shared.toLegacySize(a),h="disabled"in n&&n.disabled,B="href"in n?n.href:void 0,k=l||(B?"a":"button"),S=h||c,w=d(s.root,s[r],((n,o)=>{const e=`${o}${n.charAt(0).toUpperCase()}${n.slice(1)}`;return s[e]||""})(t,r),_[x],S?s.disabled:void 0,f?s.fullWidth:void 0,g?s.noElevation:void 0,c?s.loading:void 0,i),E="button"===k?{disabled:S,type:"type"in n&&n.type||"button"}:{},O="a"===k?{href:B,"aria-disabled":S}:{};return u.jsxs(k,{ref:e,className:w,...E,...O,"aria-busy":c||void 0,...v,children:[c&&u.jsx("span",{className:s.loadingWrapper,children:u.jsx(m,{size:x})}),u.jsxs("span",{className:d(s.content,c?s.contentHidden:void 0),children:[b&&u.jsx("span",{className:s.startIcon,children:b}),y,p&&u.jsx("span",{className:s.endIcon,children:p})]})]})});b.displayName="Button";
|
|
476
478
|
|
|
477
479
|
function styleInject(css, ref) {
|
|
478
480
|
if ( ref === void 0 ) ref = {};
|
|
@@ -501,8 +503,8 @@ function styleInject(css, ref) {
|
|
|
501
503
|
}
|
|
502
504
|
}
|
|
503
505
|
|
|
504
|
-
var css_248z = ".ImageUpload-module_container__KfRP7 {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n width: 100%;\n max-width: 520px;\n}\n\n.ImageUpload-module_label__KrvGJ {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--lb-color-neutral-700);\n}\n\n.ImageUpload-module_content__h1n0w {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n\n.ImageUpload-module_dropzone__r29hi {\n position: relative;\n border: 2px dashed var(--lb-color-neutral-300);\n border-radius: 0.75rem;\n padding: 1.5rem;\n background: var(--lb-color-background);\n transition:\n border-color 150ms ease,\n background-color 150ms ease;\n cursor: pointer;\n}\n\n.ImageUpload-module_dropzoneActive__gKHgT {\n border-color: var(--lb-color-
|
|
505
|
-
var styles = {"container":"ImageUpload-module_container__KfRP7","label":"ImageUpload-module_label__KrvGJ","content":"ImageUpload-module_content__h1n0w","dropzone":"ImageUpload-module_dropzone__r29hi","dropzoneActive":"ImageUpload-module_dropzoneActive__gKHgT","dropzoneDisabled":"ImageUpload-module_dropzoneDisabled__sroj7","dropzoneFilled":"ImageUpload-module_dropzoneFilled__mW0tg","inputHidden":"ImageUpload-module_inputHidden__zyeM2","uploading":"ImageUpload-module_uploading__P5wVR","uploadingIcon":"ImageUpload-module_uploadingIcon__uSwpq","uploadingText":"ImageUpload-module_uploadingText__t0BkQ","preview":"ImageUpload-module_preview__CqJi-","imagePreview":"ImageUpload-module_imagePreview__22wJp","previewImage":"ImageUpload-module_previewImage__FpdIn","pdfPreview":"ImageUpload-module_pdfPreview__D6OCc","pdfIcon":"ImageUpload-module_pdfIcon__DIdkd","pdfLabel":"ImageUpload-module_pdfLabel__Ff-Al","linkGroup":"ImageUpload-module_linkGroup__mZFWH","linkPrimary":"ImageUpload-module_linkPrimary__byUBf","linkSecondary":"ImageUpload-module_linkSecondary__2E4IZ","actions":"ImageUpload-module_actions__hX2N3","prompt":"ImageUpload-module_prompt__Cm0R6","uploadIcon":"ImageUpload-module_uploadIcon__g9U0X","promptText":"ImageUpload-module_promptText__-d7wp","promptAction":"ImageUpload-module_promptAction__qFDjq","helperText":"ImageUpload-module_helperText__AbZRs","error":"ImageUpload-module_error__TBlHx","errorTitle":"ImageUpload-module_errorTitle__ktusO","errorMessage":"ImageUpload-module_errorMessage__RTkNU","hint":"ImageUpload-module_hint__RFWtZ"};
|
|
506
|
+
var css_248z = ".ImageUpload-module_container__KfRP7 {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n width: 100%;\n max-width: 520px;\n}\n\n.ImageUpload-module_label__KrvGJ {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--lb-color-neutral-700);\n}\n\n.ImageUpload-module_content__h1n0w {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n\n.ImageUpload-module_dropzone__r29hi {\n position: relative;\n border: 2px dashed var(--lb-color-neutral-300);\n border-radius: 0.75rem;\n padding: 1.5rem;\n background: var(--lb-color-background);\n transition:\n border-color 150ms ease,\n background-color 150ms ease;\n cursor: pointer;\n}\n\n.ImageUpload-module_dropzoneActive__gKHgT {\n border-color: var(--lb-color-primary-accent);\n background: var(--lb-color-primary-subtle);\n}\n\n.ImageUpload-module_dropzoneDisabled__sroj7 {\n opacity: 0.55;\n cursor: not-allowed;\n}\n\n.ImageUpload-module_dropzoneFilled__mW0tg {\n background: var(--lb-color-neutral-50);\n}\n\n.ImageUpload-module_inputHidden__zyeM2 {\n display: none;\n}\n\n.ImageUpload-module_uploading__P5wVR {\n text-align: center;\n}\n\n.ImageUpload-module_uploadingIcon__uSwpq {\n margin: 0 auto 0.5rem;\n color: var(--lb-color-primary);\n}\n\n.ImageUpload-module_uploadingText__t0BkQ {\n font-size: 0.875rem;\n color: var(--lb-color-neutral-600);\n}\n\n.ImageUpload-module_preview__CqJi- {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.75rem;\n}\n\n.ImageUpload-module_imagePreview__22wJp {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.5rem;\n}\n\n.ImageUpload-module_previewImage__FpdIn {\n object-fit: contain;\n border-radius: 0.75rem;\n}\n\n.ImageUpload-module_pdfPreview__D6OCc {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.5rem;\n}\n\n.ImageUpload-module_pdfIcon__DIdkd {\n width: 4rem;\n height: 4rem;\n color: var(--lb-color-danger);\n}\n\n.ImageUpload-module_pdfLabel__Ff-Al {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--lb-color-neutral-600);\n}\n\n.ImageUpload-module_linkGroup__mZFWH {\n display: flex;\n gap: 0.75rem;\n}\n\n.ImageUpload-module_linkPrimary__byUBf {\n font-size: 0.875rem;\n color: var(--lb-color-primary);\n text-decoration: underline;\n}\n\n.ImageUpload-module_linkPrimary__byUBf:hover {\n color: var(--lb-color-primary-hover);\n}\n\n.ImageUpload-module_linkSecondary__2E4IZ {\n font-size: 0.875rem;\n color: var(--lb-color-success);\n text-decoration: underline;\n}\n\n.ImageUpload-module_linkSecondary__2E4IZ:hover {\n color: var(--lb-color-emerald-strong);\n}\n\n.ImageUpload-module_actions__hX2N3 {\n display: flex;\n gap: 0.5rem;\n}\n\n.ImageUpload-module_prompt__Cm0R6 {\n text-align: center;\n}\n\n.ImageUpload-module_uploadIcon__g9U0X {\n margin: 0 auto;\n color: var(--lb-color-neutral-400);\n}\n\n.ImageUpload-module_promptText__-d7wp {\n margin-top: 0.5rem;\n font-size: 0.875rem;\n color: var(--lb-color-neutral-600);\n}\n\n.ImageUpload-module_promptAction__qFDjq {\n font-weight: 600;\n color: var(--lb-color-primary);\n}\n\n.ImageUpload-module_helperText__AbZRs {\n margin-top: 0.25rem;\n font-size: 0.75rem;\n color: var(--lb-color-neutral-500);\n}\n\n.ImageUpload-module_error__TBlHx {\n border-radius: 0.5rem;\n background: var(--lb-color-red-subtle);\n padding: 1rem;\n}\n\n.ImageUpload-module_errorTitle__ktusO {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--lb-color-red-strong);\n margin: 0;\n}\n\n.ImageUpload-module_errorMessage__RTkNU {\n margin-top: 0.5rem;\n font-size: 0.875rem;\n color: var(--lb-color-red-strong);\n}\n\n.ImageUpload-module_hint__RFWtZ {\n margin: 0.25rem 0 0;\n font-size: var(--lb-font-size-xs);\n color: var(--lb-color-muted-foreground);\n}\n\n/* Avance de la subida */\n.ImageUpload-module_progressTrack__KnVtZ {\n width: 100%;\n max-width: 20rem;\n height: var(--lb-space-2);\n margin: var(--lb-space-3) auto 0;\n overflow: hidden;\n border-radius: var(--lb-radius-full);\n background: var(--lb-color-neutral-200);\n}\n\n.ImageUpload-module_progressBar__Gs2QW {\n height: 100%;\n border-radius: var(--lb-radius-full);\n background: var(--lb-color-primary);\n transition: width 200ms ease;\n}\n\n.ImageUpload-module_progressBarDone__ytoLa {\n animation: ImageUpload-module_progressPulse__Llz4V 1.2s ease-in-out infinite;\n}\n\n@keyframes ImageUpload-module_progressPulse__Llz4V {\n 50% {\n opacity: 0.55;\n }\n}\n\n/* Captura con la cámara */\n.ImageUpload-module_cameraPrompt__6l58r {\n margin-top: var(--lb-space-3);\n}\n\n.ImageUpload-module_camera__J-hJe {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--lb-space-4);\n background: var(--lb-color-overlay);\n}\n\n.ImageUpload-module_cameraBody__2XMvx {\n width: 100%;\n max-width: 28rem;\n padding: var(--lb-space-4);\n border-radius: var(--lb-radius-lg);\n background: var(--lb-color-background);\n box-shadow: var(--lb-shadow-lg);\n}\n\n.ImageUpload-module_cameraVideo__d0vbj {\n display: block;\n width: 100%;\n max-height: 60vh;\n border-radius: var(--lb-radius-md);\n background: var(--lb-color-neutral-900);\n}\n\n.ImageUpload-module_cameraText__Y99KB {\n margin: var(--lb-space-2) 0 0;\n text-align: center;\n font-size: var(--lb-font-size-sm);\n color: var(--lb-color-muted-foreground);\n}\n\n.ImageUpload-module_cameraErrorText__4m74n {\n margin: var(--lb-space-2) 0 0;\n text-align: center;\n font-size: var(--lb-font-size-sm);\n color: var(--lb-color-danger);\n}\n\n.ImageUpload-module_cameraActions__E1vy- {\n display: flex;\n justify-content: center;\n gap: var(--lb-space-3);\n margin-top: var(--lb-space-4);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ImageUpload-module_progressBar__Gs2QW {\n transition: none;\n }\n .ImageUpload-module_progressBarDone__ytoLa {\n animation: none;\n }\n}\n";
|
|
507
|
+
var styles = {"container":"ImageUpload-module_container__KfRP7","label":"ImageUpload-module_label__KrvGJ","content":"ImageUpload-module_content__h1n0w","dropzone":"ImageUpload-module_dropzone__r29hi","dropzoneActive":"ImageUpload-module_dropzoneActive__gKHgT","dropzoneDisabled":"ImageUpload-module_dropzoneDisabled__sroj7","dropzoneFilled":"ImageUpload-module_dropzoneFilled__mW0tg","inputHidden":"ImageUpload-module_inputHidden__zyeM2","uploading":"ImageUpload-module_uploading__P5wVR","uploadingIcon":"ImageUpload-module_uploadingIcon__uSwpq","uploadingText":"ImageUpload-module_uploadingText__t0BkQ","preview":"ImageUpload-module_preview__CqJi-","imagePreview":"ImageUpload-module_imagePreview__22wJp","previewImage":"ImageUpload-module_previewImage__FpdIn","pdfPreview":"ImageUpload-module_pdfPreview__D6OCc","pdfIcon":"ImageUpload-module_pdfIcon__DIdkd","pdfLabel":"ImageUpload-module_pdfLabel__Ff-Al","linkGroup":"ImageUpload-module_linkGroup__mZFWH","linkPrimary":"ImageUpload-module_linkPrimary__byUBf","linkSecondary":"ImageUpload-module_linkSecondary__2E4IZ","actions":"ImageUpload-module_actions__hX2N3","prompt":"ImageUpload-module_prompt__Cm0R6","uploadIcon":"ImageUpload-module_uploadIcon__g9U0X","promptText":"ImageUpload-module_promptText__-d7wp","promptAction":"ImageUpload-module_promptAction__qFDjq","helperText":"ImageUpload-module_helperText__AbZRs","error":"ImageUpload-module_error__TBlHx","errorTitle":"ImageUpload-module_errorTitle__ktusO","errorMessage":"ImageUpload-module_errorMessage__RTkNU","hint":"ImageUpload-module_hint__RFWtZ","progressTrack":"ImageUpload-module_progressTrack__KnVtZ","progressBar":"ImageUpload-module_progressBar__Gs2QW","progressBarDone":"ImageUpload-module_progressBarDone__ytoLa","cameraPrompt":"ImageUpload-module_cameraPrompt__6l58r","camera":"ImageUpload-module_camera__J-hJe","cameraBody":"ImageUpload-module_cameraBody__2XMvx","cameraVideo":"ImageUpload-module_cameraVideo__d0vbj","cameraText":"ImageUpload-module_cameraText__Y99KB","cameraErrorText":"ImageUpload-module_cameraErrorText__4m74n","cameraActions":"ImageUpload-module_cameraActions__E1vy-"};
|
|
506
508
|
styleInject(css_248z);
|
|
507
509
|
|
|
508
510
|
const classNames = (...classes) => classes.filter(Boolean).join(" ");
|
|
@@ -510,6 +512,9 @@ const interpolate = (template, values) => template.replace(/\{(\w+)\}/g, (_, key
|
|
|
510
512
|
const DEFAULT_IMAGE_UPLOAD_LABELS = {
|
|
511
513
|
uploadImage: "Subir imagen",
|
|
512
514
|
uploading: "Subiendo…",
|
|
515
|
+
uploadingPercent: "Subiendo… {percent} %",
|
|
516
|
+
processing: "Procesando…",
|
|
517
|
+
progressLabel: "Avance de la subida",
|
|
513
518
|
invalidFileType: "Formato no permitido. Usa: {formats}",
|
|
514
519
|
fileSizeExceeded: "El archivo pesa {size} MB; el máximo es {maxSize} MB",
|
|
515
520
|
uploadFailed: "No se pudo subir el archivo",
|
|
@@ -525,9 +530,24 @@ const DEFAULT_IMAGE_UPLOAD_LABELS = {
|
|
|
525
530
|
uploadError: "Error al subir",
|
|
526
531
|
pdfDocument: "Documento PDF",
|
|
527
532
|
previewAltText: "Vista previa",
|
|
533
|
+
takePhoto: "Tomar foto",
|
|
534
|
+
capturePhoto: "Capturar",
|
|
535
|
+
cancelCamera: "Cancelar",
|
|
536
|
+
cameraInstructions: "Encuadra el documento y captura la foto",
|
|
537
|
+
cameraError: "No se pudo acceder a la cámara. Revisa los permisos del navegador.",
|
|
538
|
+
cameraCaptureFailed: "No se pudo capturar la foto. Intenta de nuevo.",
|
|
539
|
+
};
|
|
540
|
+
/** Celulares y tablets ya abren la cámara nativa desde el selector de archivos. */
|
|
541
|
+
const esEscritorio = () => {
|
|
542
|
+
if (typeof navigator === "undefined")
|
|
543
|
+
return false;
|
|
544
|
+
const ua = navigator.userAgent;
|
|
545
|
+
const tablet = /iPad|Tablet|PlayBook|Silk|(Android(?!.*Mobile))/i.test(ua);
|
|
546
|
+
const movil = /Mobi|iPhone|iPod|Android.*Mobile|Windows Phone/i.test(ua);
|
|
547
|
+
return !movil && !tablet;
|
|
528
548
|
};
|
|
529
549
|
/** El `ref` apunta al `<input type="file">`. */
|
|
530
|
-
const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageUrl, onUpload, onRemove, maxSizeMB = 5, acceptedFormats = ["image/jpeg", "image/png", "image/svg+xml"], previewWidth = 200, previewHeight = 200, className = "", disabled = false, required = false, hint, error: errorProp, id, name, labels: labelsProp, }, ref) {
|
|
550
|
+
const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageUrl, currentFileIsPdf = false, currentFileName, onUpload, onRemove, maxSizeMB = 5, acceptedFormats = ["image/jpeg", "image/png", "image/svg+xml"], previewWidth = 200, previewHeight = 200, className = "", disabled = false, required = false, hint, error: errorProp, id, name, labels: labelsProp, allowCameraCapture = false, }, ref) {
|
|
531
551
|
const labels = { ...DEFAULT_IMAGE_UPLOAD_LABELS, ...labelsProp };
|
|
532
552
|
const generatedId = React.useId();
|
|
533
553
|
const inputId = id ?? generatedId;
|
|
@@ -536,9 +556,26 @@ const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageU
|
|
|
536
556
|
const displayLabel = label || labels.uploadImage;
|
|
537
557
|
const [preview, setPreview] = React.useState(currentImageUrl || null);
|
|
538
558
|
const [uploading, setUploading] = React.useState(false);
|
|
559
|
+
// Fracción ya enviada; null mientras no se conoce
|
|
560
|
+
const [progress, setProgress] = React.useState(null);
|
|
539
561
|
const [error, setError] = React.useState(null);
|
|
540
562
|
const [dragActive, setDragActive] = React.useState(false);
|
|
541
563
|
const fileInputRef = React.useRef(null);
|
|
564
|
+
const [cameraOpen, setCameraOpen] = React.useState(false);
|
|
565
|
+
const [cameraError, setCameraError] = React.useState(null);
|
|
566
|
+
const videoRef = React.useRef(null);
|
|
567
|
+
const streamRef = React.useRef(null);
|
|
568
|
+
const captureButtonRef = React.useRef(null);
|
|
569
|
+
const cameraSupported = allowCameraCapture &&
|
|
570
|
+
typeof navigator !== "undefined" &&
|
|
571
|
+
!!navigator.mediaDevices &&
|
|
572
|
+
typeof navigator.mediaDevices.getUserMedia === "function" &&
|
|
573
|
+
acceptedFormats.some((format) => format.startsWith("image/")) &&
|
|
574
|
+
esEscritorio();
|
|
575
|
+
const captureMimeType = acceptedFormats.includes("image/png") &&
|
|
576
|
+
!acceptedFormats.includes("image/jpeg")
|
|
577
|
+
? "image/png"
|
|
578
|
+
: "image/jpeg";
|
|
542
579
|
React.useImperativeHandle(ref, () => fileInputRef.current);
|
|
543
580
|
const shownError = error ?? errorProp ?? null;
|
|
544
581
|
const describedBy = [hint && hintId, shownError && errorId].filter(Boolean).join(" ") ||
|
|
@@ -587,7 +624,8 @@ const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageU
|
|
|
587
624
|
// Upload file
|
|
588
625
|
try {
|
|
589
626
|
setUploading(true);
|
|
590
|
-
|
|
627
|
+
setProgress(null);
|
|
628
|
+
await onUpload(file, (fraction) => setProgress(Math.max(0, Math.min(1, fraction))));
|
|
591
629
|
}
|
|
592
630
|
catch (err) {
|
|
593
631
|
setError(err instanceof Error ? err.message : labels.uploadFailed);
|
|
@@ -595,6 +633,7 @@ const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageU
|
|
|
595
633
|
}
|
|
596
634
|
finally {
|
|
597
635
|
setUploading(false);
|
|
636
|
+
setProgress(null);
|
|
598
637
|
}
|
|
599
638
|
};
|
|
600
639
|
const handleInputChange = (e) => {
|
|
@@ -645,20 +684,109 @@ const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageU
|
|
|
645
684
|
fileInputRef.current?.click();
|
|
646
685
|
}
|
|
647
686
|
};
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
687
|
+
// Abre o cierra la cámara junto con la vista de captura
|
|
688
|
+
React.useEffect(() => {
|
|
689
|
+
if (!cameraOpen)
|
|
690
|
+
return;
|
|
691
|
+
let active = true;
|
|
692
|
+
captureButtonRef.current?.focus();
|
|
693
|
+
(async () => {
|
|
694
|
+
try {
|
|
695
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
696
|
+
video: { facingMode: { ideal: "environment" } },
|
|
697
|
+
audio: false,
|
|
698
|
+
});
|
|
699
|
+
if (!active) {
|
|
700
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
streamRef.current = stream;
|
|
704
|
+
// Conectar o reproducir puede fallar (políticas de autoplay); no es crítico
|
|
705
|
+
try {
|
|
706
|
+
if (videoRef.current) {
|
|
707
|
+
videoRef.current.srcObject = stream;
|
|
708
|
+
await videoRef.current.play();
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
catch {
|
|
712
|
+
/* sin vista previa del video */
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
catch {
|
|
716
|
+
if (active) {
|
|
717
|
+
setCameraError(labels.cameraError);
|
|
718
|
+
setCameraOpen(false);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
})();
|
|
722
|
+
return () => {
|
|
723
|
+
active = false;
|
|
724
|
+
streamRef.current?.getTracks().forEach((track) => track.stop());
|
|
725
|
+
streamRef.current = null;
|
|
726
|
+
};
|
|
727
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
728
|
+
}, [cameraOpen]);
|
|
729
|
+
const openCamera = () => {
|
|
730
|
+
setError(null);
|
|
731
|
+
setCameraError(null);
|
|
732
|
+
setCameraOpen(true);
|
|
733
|
+
};
|
|
734
|
+
const capturePhoto = async () => {
|
|
735
|
+
const video = videoRef.current;
|
|
736
|
+
if (!video || !video.videoWidth) {
|
|
737
|
+
setCameraError(labels.cameraCaptureFailed);
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
const canvas = document.createElement("canvas");
|
|
741
|
+
canvas.width = video.videoWidth;
|
|
742
|
+
canvas.height = video.videoHeight;
|
|
743
|
+
const ctx = canvas.getContext("2d");
|
|
744
|
+
if (!ctx) {
|
|
745
|
+
setCameraError(labels.cameraCaptureFailed);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
749
|
+
const blob = await new Promise((resolve) => canvas.toBlob((result) => resolve(result), captureMimeType, 0.92));
|
|
750
|
+
if (!blob) {
|
|
751
|
+
setCameraError(labels.cameraCaptureFailed);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
const extension = captureMimeType === "image/png" ? "png" : "jpg";
|
|
755
|
+
const file = new File([blob], `camara-${Date.now()}.${extension}`, {
|
|
756
|
+
type: captureMimeType,
|
|
757
|
+
});
|
|
758
|
+
setCameraOpen(false); // la limpieza del efecto apaga la cámara
|
|
759
|
+
await handleFileChange(file);
|
|
760
|
+
};
|
|
761
|
+
const cameraButton = cameraSupported && (jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "secondary", size: "small", startIcon: jsxRuntimeExports.jsx(r$1, { size: "sm" }), onClick: (event) => {
|
|
762
|
+
event.stopPropagation();
|
|
763
|
+
openCamera();
|
|
764
|
+
}, disabled: disabled || uploading, children: labels.takePhoto }));
|
|
765
|
+
const isPdf = !!preview &&
|
|
766
|
+
(preview.endsWith(".pdf") ||
|
|
767
|
+
preview === "PDF_PLACEHOLDER" ||
|
|
768
|
+
currentImageUrl?.endsWith(".pdf") ||
|
|
769
|
+
(currentFileIsPdf && preview === currentImageUrl));
|
|
770
|
+
const percent = progress === null ? null : Math.round(progress * 100);
|
|
771
|
+
return (jsxRuntimeExports.jsxs("div", { className: classNames(styles.container, className), "data-testid": "image-upload", children: [jsxRuntimeExports.jsxs("label", { htmlFor: inputId, className: styles.label, children: [displayLabel, required && jsxRuntimeExports.jsx("span", { "aria-hidden": "true", children: " *" })] }), jsxRuntimeExports.jsxs("div", { className: styles.content, children: [jsxRuntimeExports.jsxs("div", { onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, onClick: handleClick, className: classNames(styles.dropzone, dragActive && styles.dropzoneActive, disabled && styles.dropzoneDisabled, Boolean(preview) && styles.dropzoneFilled), "data-testid": "image-upload-dropzone", children: [jsxRuntimeExports.jsx("input", { ref: fileInputRef, id: inputId, name: name, required: required, "aria-invalid": shownError ? true : undefined, "aria-describedby": describedBy, type: "file", onChange: handleInputChange, accept: acceptedFormats.join(","), className: styles.inputHidden, disabled: disabled || uploading, "data-testid": "image-upload-input" }), uploading ? (jsxRuntimeExports.jsxs("div", { className: styles.uploading, "data-testid": "image-upload-progress", children: [jsxRuntimeExports.jsx(r$3, { size: "lg", className: styles.uploadingIcon }), jsxRuntimeExports.jsx("p", { className: styles.uploadingText, "aria-live": "polite", children: percent === null
|
|
772
|
+
? labels.uploading
|
|
773
|
+
: percent >= 100
|
|
774
|
+
? labels.processing
|
|
775
|
+
: interpolate(labels.uploadingPercent, { percent }) }), percent !== null && (jsxRuntimeExports.jsx("div", { role: "progressbar", "aria-label": labels.progressLabel, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent, className: styles.progressTrack, children: jsxRuntimeExports.jsx("div", { className: classNames(styles.progressBar, percent >= 100 && styles.progressBarDone), style: { width: `${percent}%` } }) }))] })) : preview ? (jsxRuntimeExports.jsxs("div", { className: styles.preview, children: [isPdf ? (jsxRuntimeExports.jsxs("div", { className: styles.pdfPreview, children: [jsxRuntimeExports.jsx(e$1, { className: styles.pdfIcon }), jsxRuntimeExports.jsx("p", { className: styles.pdfLabel, children: labels.pdfDocument }), currentImageUrl && (jsxRuntimeExports.jsxs("div", { className: styles.linkGroup, children: [jsxRuntimeExports.jsx("a", { href: currentImageUrl, target: "_blank", rel: "noopener noreferrer", className: styles.linkPrimary, onClick: (e) => e.stopPropagation(), children: labels.viewDocument }), jsxRuntimeExports.jsx("a", { href: currentImageUrl, download: currentFileName ?? "", target: "_blank", rel: "noopener noreferrer", className: styles.linkSecondary, onClick: (e) => e.stopPropagation(), children: labels.downloadDocument })] }))] })) : (jsxRuntimeExports.jsxs("div", { className: styles.imagePreview, children: [jsxRuntimeExports.jsx("img", { src: preview, alt: labels.previewAltText, style: {
|
|
651
776
|
maxWidth: previewWidth,
|
|
652
777
|
maxHeight: previewHeight,
|
|
653
|
-
}, className: styles.previewImage }), currentImageUrl && (jsxRuntimeExports.jsxs("div", { className: styles.linkGroup, children: [jsxRuntimeExports.jsx("a", { href: currentImageUrl, target: "_blank", rel: "noopener noreferrer", className: styles.linkPrimary, onClick: (e) => e.stopPropagation(), children: labels.viewDocument }), jsxRuntimeExports.jsx("a", { href: currentImageUrl, download:
|
|
778
|
+
}, className: styles.previewImage }), currentImageUrl && (jsxRuntimeExports.jsxs("div", { className: styles.linkGroup, children: [jsxRuntimeExports.jsx("a", { href: currentImageUrl, target: "_blank", rel: "noopener noreferrer", className: styles.linkPrimary, onClick: (e) => e.stopPropagation(), children: labels.viewDocument }), jsxRuntimeExports.jsx("a", { href: currentImageUrl, download: currentFileName ?? "", target: "_blank", rel: "noopener noreferrer", className: styles.linkSecondary, onClick: (e) => e.stopPropagation(), children: labels.downloadImage })] }))] })), jsxRuntimeExports.jsxs("div", { className: styles.actions, children: [jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "secondary", size: "small", onClick: (event) => {
|
|
654
779
|
event.stopPropagation();
|
|
655
780
|
handleClick();
|
|
656
|
-
}, disabled: disabled, children: labels.changeImage }), onRemove && (jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "warning", size: "small", onClick: (event) => {
|
|
781
|
+
}, disabled: disabled, children: labels.changeImage }), cameraButton, onRemove && (jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "warning", size: "small", onClick: (event) => {
|
|
657
782
|
event.stopPropagation();
|
|
658
783
|
handleRemove();
|
|
659
|
-
}, disabled: disabled, children: labels.remove }))] })] })) : (jsxRuntimeExports.jsxs("div", { className: styles.prompt, children: [jsxRuntimeExports.jsx(r$
|
|
784
|
+
}, disabled: disabled, children: labels.remove }))] })] })) : (jsxRuntimeExports.jsxs("div", { className: styles.prompt, children: [jsxRuntimeExports.jsx(r$2, { className: styles.uploadIcon }), jsxRuntimeExports.jsxs("p", { className: styles.promptText, children: [jsxRuntimeExports.jsx("span", { className: styles.promptAction, children: labels.clickToUpload }), " ", labels.dragAndDrop] }), jsxRuntimeExports.jsxs("p", { className: styles.helperText, children: [acceptedFormats
|
|
660
785
|
.map((format) => format.split("/")[1].toUpperCase())
|
|
661
|
-
.join(", "), " ", labels.upTo, " ", maxSizeMB, "MB"] })] }))] }), hint && !shownError && (jsxRuntimeExports.jsx("p", { id: hintId, className: styles.hint, children: hint })), shownError && (jsxRuntimeExports.jsxs("div", { id: errorId, className: styles.error, role: "alert", children: [jsxRuntimeExports.jsx("h3", { className: styles.errorTitle, children: labels.uploadError }), jsxRuntimeExports.jsx("p", { className: styles.errorMessage, children: shownError })] }))
|
|
786
|
+
.join(", "), " ", labels.upTo, " ", maxSizeMB, "MB"] }), cameraButton && (jsxRuntimeExports.jsx("div", { className: styles.cameraPrompt, children: cameraButton }))] }))] }), hint && !shownError && (jsxRuntimeExports.jsx("p", { id: hintId, className: styles.hint, children: hint })), shownError && (jsxRuntimeExports.jsxs("div", { id: errorId, className: styles.error, role: "alert", children: [jsxRuntimeExports.jsx("h3", { className: styles.errorTitle, children: labels.uploadError }), jsxRuntimeExports.jsx("p", { className: styles.errorMessage, children: shownError })] })), cameraError && !cameraOpen && (jsxRuntimeExports.jsx("div", { className: styles.error, role: "alert", children: jsxRuntimeExports.jsx("p", { className: styles.errorMessage, children: cameraError }) }))] }), cameraOpen && (jsxRuntimeExports.jsx("div", { className: styles.camera, role: "dialog", "aria-modal": "true", "aria-label": labels.takePhoto, onKeyDown: (event) => {
|
|
787
|
+
if (event.key === "Escape")
|
|
788
|
+
setCameraOpen(false);
|
|
789
|
+
}, children: jsxRuntimeExports.jsxs("div", { className: styles.cameraBody, children: [jsxRuntimeExports.jsx("video", { ref: videoRef, playsInline: true, muted: true, className: styles.cameraVideo }), jsxRuntimeExports.jsx("p", { className: styles.cameraText, children: labels.cameraInstructions }), cameraError && (jsxRuntimeExports.jsx("p", { className: styles.cameraErrorText, children: cameraError })), jsxRuntimeExports.jsxs("div", { className: styles.cameraActions, children: [jsxRuntimeExports.jsx(b, { ref: captureButtonRef, type: "button", startIcon: jsxRuntimeExports.jsx(r$1, { size: "sm" }), onClick: capturePhoto, disabled: uploading, children: labels.capturePhoto }), jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "secondary", onClick: () => setCameraOpen(false), children: labels.cancelCamera })] })] }) }))] }));
|
|
662
790
|
});
|
|
663
791
|
|
|
664
792
|
exports.DEFAULT_IMAGE_UPLOAD_LABELS = DEFAULT_IMAGE_UPLOAD_LABELS;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ import React from 'react';
|
|
|
3
3
|
type ImageUploadLabels = {
|
|
4
4
|
uploadImage: string;
|
|
5
5
|
uploading: string;
|
|
6
|
+
/** Con `{percent}`: se muestra mientras sube si `onUpload` informa el avance. */
|
|
7
|
+
uploadingPercent: string;
|
|
8
|
+
/** Archivo enviado al 100 %, esperando la respuesta del servidor. */
|
|
9
|
+
processing: string;
|
|
10
|
+
/** Nombre accesible de la barra de avance. */
|
|
11
|
+
progressLabel: string;
|
|
6
12
|
invalidFileType: string;
|
|
7
13
|
fileSizeExceeded: string;
|
|
8
14
|
uploadFailed: string;
|
|
@@ -18,12 +24,30 @@ type ImageUploadLabels = {
|
|
|
18
24
|
uploadError: string;
|
|
19
25
|
pdfDocument: string;
|
|
20
26
|
previewAltText: string;
|
|
27
|
+
takePhoto: string;
|
|
28
|
+
capturePhoto: string;
|
|
29
|
+
cancelCamera: string;
|
|
30
|
+
cameraInstructions: string;
|
|
31
|
+
cameraError: string;
|
|
32
|
+
cameraCaptureFailed: string;
|
|
21
33
|
};
|
|
22
34
|
declare const DEFAULT_IMAGE_UPLOAD_LABELS: ImageUploadLabels;
|
|
23
35
|
interface ImageUploadProps {
|
|
24
36
|
label?: string;
|
|
25
37
|
currentImageUrl?: string;
|
|
26
|
-
|
|
38
|
+
/**
|
|
39
|
+
* El archivo actual es un PDF aunque su URL no termine en `.pdf`
|
|
40
|
+
* (p. ej. una URL `blob:` sin extensión).
|
|
41
|
+
*/
|
|
42
|
+
currentFileIsPdf?: boolean;
|
|
43
|
+
/** Nombre sugerido al descargar el archivo actual. */
|
|
44
|
+
currentFileName?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Sube el archivo. Si quien llama puede seguir la petición (XHR, axios
|
|
47
|
+
* `onUploadProgress`…), informa la fracción enviada (0..1) con `onProgress`
|
|
48
|
+
* y se muestra una barra de avance; si no, solo un indicador de carga.
|
|
49
|
+
*/
|
|
50
|
+
onUpload: (file: File, onProgress?: (fraction: number) => void) => Promise<void>;
|
|
27
51
|
onRemove?: () => Promise<void>;
|
|
28
52
|
maxSizeMB?: number;
|
|
29
53
|
acceptedFormats?: string[];
|
|
@@ -40,6 +64,12 @@ interface ImageUploadProps {
|
|
|
40
64
|
name?: string;
|
|
41
65
|
/** Textos de la interfaz; por defecto en español. */
|
|
42
66
|
labels?: Partial<ImageUploadLabels>;
|
|
67
|
+
/**
|
|
68
|
+
* Muestra "Tomar foto" para capturar con la cámara del equipo
|
|
69
|
+
* (getUserMedia). Solo en escritorio: en celulares y tablets el selector de
|
|
70
|
+
* archivos ya ofrece la cámara nativa. Requiere aceptar algún `image/*`.
|
|
71
|
+
*/
|
|
72
|
+
allowCameraCapture?: boolean;
|
|
43
73
|
}
|
|
44
74
|
/** El `ref` apunta al `<input type="file">`. */
|
|
45
75
|
declare const ImageUpload: React.ForwardRefExoticComponent<ImageUploadProps & React.RefAttributes<HTMLInputElement>>;
|
package/dist/index.esm.js
CHANGED
|
@@ -425,7 +425,7 @@ var jsxRuntimeExports = requireJsxRuntime();
|
|
|
425
425
|
|
|
426
426
|
var e$3={exports:{}};
|
|
427
427
|
|
|
428
|
-
var r$
|
|
428
|
+
var r$6={};
|
|
429
429
|
|
|
430
430
|
/**
|
|
431
431
|
* @license React
|
|
@@ -435,9 +435,9 @@ var r$5={};
|
|
|
435
435
|
*
|
|
436
436
|
* This source code is licensed under the MIT license found in the
|
|
437
437
|
* LICENSE file in the root directory of this source tree.
|
|
438
|
-
*/var e$2;function t$4(){if(e$2)return r$
|
|
438
|
+
*/var e$2;function t$4(){if(e$2)return r$6;e$2=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$6.Fragment=o,r$6.jsx=n,r$6.jsxs=n,r$6}
|
|
439
439
|
|
|
440
|
-
var r$
|
|
440
|
+
var r$5={};
|
|
441
441
|
|
|
442
442
|
/**
|
|
443
443
|
* @license React
|
|
@@ -447,17 +447,19 @@ var r$4={};
|
|
|
447
447
|
*
|
|
448
448
|
* This source code is licensed under the MIT license found in the
|
|
449
449
|
* LICENSE file in the root directory of this source tree.
|
|
450
|
-
*/var t$3;function n(){return t$3||(t$3=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=React,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$
|
|
450
|
+
*/var t$3;function n(){return t$3||(t$3=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=React,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$5.Fragment=d,r$5.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$5.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$5}
|
|
451
451
|
|
|
452
452
|
var t$2;function s$1(){return t$2||(t$2=1,"production"===process.env.NODE_ENV?e$3.exports=t$4():e$3.exports=n()),e$3.exports}
|
|
453
453
|
|
|
454
|
-
var r$
|
|
454
|
+
var r$4=s$1();
|
|
455
|
+
|
|
456
|
+
const e$1=({className:e="",size:r="md"})=>{const t={sm:16,md:20,lg:24},a=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`;return r$4.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:a,"aria-hidden":"true",children:r$4.jsx("path",{d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})};
|
|
455
457
|
|
|
456
|
-
const
|
|
458
|
+
const r$3=({className:r="",size:e="md",color:t="currentColor"})=>{const o={sm:16,md:20,lg:24};return r$4.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$4.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r$4.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"})]})};
|
|
457
459
|
|
|
458
|
-
const r$2=({
|
|
460
|
+
const t$1={sm:16,md:24,lg:32},r$2=({size:r="md",color:s="currentColor",className:e="",...a})=>{const i="string"==typeof r?t$1[r]||24:r;return r$4.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 48 48",fill:"none",stroke:s,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:`icon icon-tabler icon-tabler-upload ${e}`.trim(),...a,children:r$4.jsx("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02"})})};r$2.displayName="UploadIcon";
|
|
459
461
|
|
|
460
|
-
const
|
|
462
|
+
const i$1={sm:16,md:20,lg:24};function r$1({size:r="md",title:t,...o}){return r$4.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i$1[r],height:i$1[r],fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",role:t?"img":void 0,"aria-hidden":!t||void 0,focusable:"false",...o,children:[t&&r$4.jsx("title",{children:t}),r$4.jsx("path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}),r$4.jsx("circle",{cx:"12",cy:"13",r:"3"})]})}
|
|
461
463
|
|
|
462
464
|
var e,r={exports:{}},t={};var a,l,i={};
|
|
463
465
|
/**
|
|
@@ -468,7 +470,7 @@ var e,r={exports:{}},t={};var a,l,i={};
|
|
|
468
470
|
*
|
|
469
471
|
* This source code is licensed under the MIT license found in the
|
|
470
472
|
* LICENSE file in the root directory of this source tree.
|
|
471
|
-
*/function c(){return a||(a=1,"production"!==process.env.NODE_ENV&&function(){function o(n){if(null==n)return null;if("function"==typeof n)return n.$$typeof===E?null:n.displayName||n.name||null;if("string"==typeof n)return n;switch(n){case p:return "Fragment";case g:return "Profiler";case f:return "StrictMode";case h:return "Suspense";case B:return "SuspenseList";case w:return "Activity"}if("object"==typeof n)switch("number"==typeof n.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case b:return "Portal";case v:return n.displayName||"Context";case y:return (n._context.displayName||"Context")+".Consumer";case x:var e=n.render;return (n=n.displayName)||(n=""!==(n=e.displayName||e.name||"")?"ForwardRef("+n+")":"ForwardRef"),n;case k:return null!==(e=n.displayName||null)?e:o(n.type)||"Memo";case S:e=n._payload,n=n._init;try{return o(n(e))}catch(n){}}return null}function e(n){return ""+n}function r(n){try{e(n);var o=!1;}catch(n){o=true;}if(o){var r=(o=console).error,t="function"==typeof Symbol&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return r.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),e(n)}}function t(n){if(n===p)return "<>";if("object"==typeof n&&null!==n&&n.$$typeof===S)return "<...>";try{var e=o(n);return e?"<"+e+">":"<...>"}catch(n){return "<...>"}}function a(){return Error("react-stack-top-frame")}function l(){var n=o(this.type);return P[n]||(P[n]=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!==(n=this.props.ref)?n:null}function c(n,e,t,a,i,c){var s,_=e.children;if(void 0!==_)if(a)if(j(_)){for(a=0;a<_.length;a++)u(_[a]);Object.freeze&&Object.freeze(_);}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 u(_);if(N.call(e,"key")){_=o(n);var b=Object.keys(e).filter(function(n){return "key"!==n});a=0<b.length?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}",C[_+a]||(b=0<b.length?"{"+b.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,_,b,_),C[_+a]=true);}if(_=null,void 0!==t&&(r(t),_=""+t),function(n){if(N.call(n,"key")){var o=Object.getOwnPropertyDescriptor(n,"key").get;if(o&&o.isReactWarning)return false}return void 0!==n.key}(e)&&(r(e.key),_=""+e.key),"key"in e)for(var p in t={},e)"key"!==p&&(t[p]=e[p]);else t=e;return _&&function(n,o){function e(){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)",o));}e.isReactWarning=true,Object.defineProperty(n,"key",{get:e,configurable:true});}(t,"function"==typeof n?n.displayName||n.name||"Unknown":n),function(n,o,e,r,t,a){var i=e.ref;return n={$$typeof:m,type:n,key:o,props:e,_owner:r},null!==(void 0!==i?i:null)?Object.defineProperty(n,"ref",{enumerable:false,get:l}):Object.defineProperty(n,"ref",{enumerable:false,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(n,"_debugStack",{configurable:false,enumerable:false,writable:true,value:t}),Object.defineProperty(n,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}(n,_,t,null===(s=O.A)?null:s.getOwner(),i,c)}function u(n){s(n)?n._store&&(n._store.validated=1):"object"==typeof n&&null!==n&&n.$$typeof===S&&("fulfilled"===n._payload.status?s(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1));}function s(n){return "object"==typeof n&&null!==n&&n.$$typeof===m}var d,_=React,m=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),v=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),O=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,j=Array.isArray,I=console.createTask?console.createTask:function(){return null},P={},z=(_={react_stack_bottom_frame:function(n){return n()}}).react_stack_bottom_frame.bind(_,a)(),W=I(t(a)),C={};i.Fragment=p,i.jsx=function(n,o,e){var r=1e4>O.recentlyCreatedOwnerStacks++;return c(n,o,e,false,r?Error("react-stack-top-frame"):z,r?I(t(n)):W)},i.jsxs=function(n,o,e){var r=1e4>O.recentlyCreatedOwnerStacks++;return c(n,o,e,true,r?Error("react-stack-top-frame"):z,r?I(t(n)):W)};}()),i}var u=(l||(l=1,"production"===process.env.NODE_ENV?r.exports=function(){if(e)return t;e=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(o,e,r){var t=null;if(void 0!==r&&(t=""+r),void 0!==e.key&&(t=""+e.key),"key"in e)for(var a in r={},e)"key"!==a&&(r[a]=e[a]);else r=e;return e=r.ref,{$$typeof:n,type:o,key:t,ref:void 0!==e?e:null,props:r}}return t.Fragment=o,t.jsx=r,t.jsxs=r,t}():r.exports=c()),r.exports);var s={root:"Button-module_root__CbGH4",sizeSmall:"Button-module_sizeSmall__cwk1u",sizeMedium:"Button-module_sizeMedium__WI9SU",sizeLarge:"Button-module_sizeLarge__DCsOs",disabled:"Button-module_disabled__JgtZl",fullWidth:"Button-module_fullWidth__dOsPn",noElevation:"Button-module_noElevation__I6-zN",loading:"Button-module_loading__fZbPs",loadingWrapper:"Button-module_loadingWrapper__NrZp3",content:"Button-module_content__xCYa9",contentHidden:"Button-module_contentHidden__lJy-Z",startIcon:"Button-module_startIcon__x3190",endIcon:"Button-module_endIcon__9vUum",text:"Button-module_text__5mE0X",textPrimary:"Button-module_textPrimary__vfnk5",textSecondary:"Button-module_textSecondary__a3EiY",textSuccess:"Button-module_textSuccess__F84Hf",textError:"Button-module_textError__47t2-",textWarning:"Button-module_textWarning__sUoJ4",textInfo:"Button-module_textInfo__eHIQf",contained:"Button-module_contained__ihcEr",containedPrimary:"Button-module_containedPrimary__QABiB",containedSecondary:"Button-module_containedSecondary__Amyuq",containedSuccess:"Button-module_containedSuccess__klgok",containedError:"Button-module_containedError__WOxWG",containedWarning:"Button-module_containedWarning__dFc-N",containedInfo:"Button-module_containedInfo__PLgZO",outlined:"Button-module_outlined__3QTXD",outlinedPrimary:"Button-module_outlinedPrimary__fKrCf",outlinedSecondary:"Button-module_outlinedSecondary__n7OpX",outlinedSuccess:"Button-module_outlinedSuccess__Y2Plg",outlinedError:"Button-module_outlinedError__6NJ-J",outlinedWarning:"Button-module_outlinedWarning__aXlYk",outlinedInfo:"Button-module_outlinedInfo__hpDkF",spinner:"Button-module_spinner__vwfOT",spin:"Button-module_spin__fjXhP",spinnerCircle:"Button-module_spinnerCircle__7vRpf",spinnerDash:"Button-module_spinnerDash__y8Dii"};!function(n,o){ void 0===o&&(o={});var e=o.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===e&&r.firstChild?r.insertBefore(t,r.firstChild):r.appendChild(t),t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));}}(".Button-module_root__CbGH4 {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n font-family: var(--lb-font-sans);\n font-weight: var(--lb-font-weight-medium);\n border: 1px solid transparent;\n line-height: 1.75;\n white-space: nowrap;\n background: transparent;\n color: inherit;\n cursor: pointer;\n border-radius: var(--lb-radius-md);\n transition:\n background-color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n border-color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.Button-module_root__CbGH4:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px\n color-mix(in srgb, var(--lb-color-ring) 50%, transparent);\n}\n\n/* Size variants */\n.Button-module_sizeSmall__cwk1u {\n padding: 0.25rem 0.625rem;\n font-size: var(--lb-font-size-sm);\n min-height: 1.875rem;\n}\n\n.Button-module_sizeMedium__WI9SU {\n padding: 0.375rem 1rem;\n font-size: var(--lb-font-size-sm);\n min-height: 2.25rem;\n}\n\n.Button-module_sizeLarge__DCsOs {\n padding: 0.5rem 1.375rem;\n font-size: var(--lb-font-size-md);\n min-height: 2.625rem;\n}\n\n/* Disabled state */\n/* Combined with `.root` so it beats variant colors (e.g. .containedPrimary)\n regardless of source order (higher specificity). */\n.Button-module_root__CbGH4.Button-module_disabled__JgtZl {\n background: var(--lb-color-muted);\n background-color: var(--lb-color-muted);\n color: var(--lb-color-muted-foreground);\n border-color: transparent;\n cursor: not-allowed;\n pointer-events: none;\n box-shadow: none;\n opacity: 1;\n}\n\n/* Full width */\n.Button-module_fullWidth__dOsPn {\n width: 100%;\n}\n\n/* No elevation */\n.Button-module_noElevation__I6-zN {\n box-shadow: none !important;\n}\n\n/* Loading state */\n.Button-module_loading__fZbPs {\n pointer-events: none;\n}\n\n.Button-module_loadingWrapper__NrZp3 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.Button-module_content__xCYa9 {\n display: inline-flex;\n align-items: inherit;\n justify-content: inherit;\n gap: 0.5rem;\n}\n\n.Button-module_contentHidden__lJy-Z {\n opacity: 0;\n}\n\n.Button-module_startIcon__x3190,\n.Button-module_endIcon__9vUum {\n display: inherit;\n font-size: 1.25em;\n line-height: 1;\n}\n\n/* Variant: text */\n.Button-module_text__5mE0X {\n padding: 0.375rem 0.5rem;\n}\n\n.Button-module_text__5mE0X:hover {\n background-color: rgba(0, 0, 0, 0.04);\n}\n\n/* ============================================\n COLOR STYLES - TEXT VARIANT\n ============================================ */\n\n/* Primary */\n.Button-module_textPrimary__vfnk5 {\n color: var(--lb-color-primary);\n}\n.Button-module_textPrimary__vfnk5:hover {\n background-color: color-mix(in srgb, var(--lb-color-primary) 6%, transparent);\n}\n\n/* Secondary */\n.Button-module_textSecondary__a3EiY {\n color: var(--lb-color-neutral-600);\n}\n.Button-module_textSecondary__a3EiY:hover {\n background-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 6%,\n transparent\n );\n}\n\n/* Success */\n.Button-module_textSuccess__F84Hf {\n color: var(--lb-color-success);\n}\n.Button-module_textSuccess__F84Hf:hover {\n background-color: color-mix(in srgb, var(--lb-color-success) 6%, transparent);\n}\n\n/* Error */\n.Button-module_textError__47t2- {\n color: var(--lb-color-danger);\n}\n.Button-module_textError__47t2-:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger) 6%, transparent);\n}\n\n/* Warning */\n.Button-module_textWarning__sUoJ4 {\n color: var(--lb-color-warning);\n}\n.Button-module_textWarning__sUoJ4:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning) 6%, transparent);\n}\n\n/* Info */\n.Button-module_textInfo__eHIQf {\n color: var(--lb-color-info);\n}\n.Button-module_textInfo__eHIQf:hover {\n background-color: color-mix(in srgb, var(--lb-color-info) 6%, transparent);\n}\n\n/* ============================================\n COLOR STYLES - CONTAINED VARIANT\n ============================================ */\n\n/* Contained base */\n.Button-module_contained__ihcEr {\n box-shadow:\n 0px 3px 1px -2px rgba(0, 0, 0, 0.2),\n 0px 2px 2px 0px rgba(0, 0, 0, 0.14),\n 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n}\n\n.Button-module_contained__ihcEr:hover {\n box-shadow:\n 0px 2px 4px -1px rgba(0, 0, 0, 0.2),\n 0px 4px 5px 0px rgba(0, 0, 0, 0.14),\n 0px 1px 10px 0px rgba(0, 0, 0, 0.12);\n}\n\n.Button-module_contained__ihcEr:active {\n box-shadow:\n 0px 5px 5px -3px rgba(0, 0, 0, 0.2),\n 0px 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0px 3px 14px 2px rgba(0, 0, 0, 0.12);\n}\n\n/* Primary */\n.Button-module_containedPrimary__QABiB {\n background-color: var(--lb-color-primary);\n color: var(--lb-color-primary-foreground);\n}\n.Button-module_containedPrimary__QABiB:hover {\n background-color: var(--lb-color-primary-hover);\n}\n\n/* Secondary */\n.Button-module_containedSecondary__Amyuq {\n background-color: var(--lb-color-neutral-600);\n color: var(--lb-color-primary-foreground);\n}\n.Button-module_containedSecondary__Amyuq:hover {\n background-color: var(--lb-color-neutral-700);\n}\n\n/* Success */\n.Button-module_containedSuccess__klgok {\n background-color: var(--lb-color-success);\n color: var(--lb-color-success-foreground);\n}\n.Button-module_containedSuccess__klgok:hover {\n background-color: color-mix(in srgb, var(--lb-color-success), black 12%);\n}\n\n/* Error */\n.Button-module_containedError__WOxWG {\n background-color: var(--lb-color-danger);\n color: var(--lb-color-danger-foreground);\n}\n.Button-module_containedError__WOxWG:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger), black 12%);\n}\n\n/* Warning */\n.Button-module_containedWarning__dFc-N {\n background-color: var(--lb-color-warning);\n color: var(--lb-color-warning-foreground);\n}\n.Button-module_containedWarning__dFc-N:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning), black 12%);\n}\n\n/* Info */\n.Button-module_containedInfo__PLgZO {\n background-color: var(--lb-color-info);\n color: var(--lb-color-info-foreground);\n}\n.Button-module_containedInfo__PLgZO:hover {\n background-color: color-mix(in srgb, var(--lb-color-info), black 12%);\n}\n\n/* ============================================\n COLOR STYLES - OUTLINED VARIANT\n ============================================ */\n\n/* Outlined base */\n.Button-module_outlined__3QTXD {\n border: 1px solid var(--lb-color-border);\n}\n\n/* Primary */\n.Button-module_outlinedPrimary__fKrCf {\n color: var(--lb-color-primary);\n border-color: color-mix(in srgb, var(--lb-color-primary) 50%, transparent);\n}\n.Button-module_outlinedPrimary__fKrCf:hover {\n background-color: color-mix(in srgb, var(--lb-color-primary) 6%, transparent);\n border-color: var(--lb-color-primary);\n}\n\n/* Secondary */\n.Button-module_outlinedSecondary__n7OpX {\n color: var(--lb-color-neutral-600);\n border-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 50%,\n transparent\n );\n}\n.Button-module_outlinedSecondary__n7OpX:hover {\n background-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 6%,\n transparent\n );\n border-color: var(--lb-color-neutral-600);\n}\n\n/* Success */\n.Button-module_outlinedSuccess__Y2Plg {\n color: var(--lb-color-success);\n border-color: color-mix(in srgb, var(--lb-color-success) 50%, transparent);\n}\n.Button-module_outlinedSuccess__Y2Plg:hover {\n background-color: color-mix(in srgb, var(--lb-color-success) 6%, transparent);\n border-color: var(--lb-color-success);\n}\n\n/* Error */\n.Button-module_outlinedError__6NJ-J {\n color: var(--lb-color-danger);\n border-color: color-mix(in srgb, var(--lb-color-danger) 50%, transparent);\n}\n.Button-module_outlinedError__6NJ-J:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger) 6%, transparent);\n border-color: var(--lb-color-danger);\n}\n\n/* Warning */\n.Button-module_outlinedWarning__aXlYk {\n color: var(--lb-color-warning);\n border-color: color-mix(in srgb, var(--lb-color-warning) 50%, transparent);\n}\n.Button-module_outlinedWarning__aXlYk:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning) 6%, transparent);\n border-color: var(--lb-color-warning);\n}\n\n/* Info */\n.Button-module_outlinedInfo__hpDkF {\n color: var(--lb-color-info);\n border-color: color-mix(in srgb, var(--lb-color-info) 50%, transparent);\n}\n.Button-module_outlinedInfo__hpDkF:hover {\n background-color: color-mix(in srgb, var(--lb-color-info) 6%, transparent);\n border-color: var(--lb-color-info);\n}\n\n/* Spinner animation */\n.Button-module_spinner__vwfOT {\n display: inline-flex;\n animation: Button-module_spin__fjXhP 0.8s linear infinite;\n}\n\n.Button-module_spinnerCircle__7vRpf {\n stroke-dasharray: 50;\n stroke-dashoffset: 25;\n animation: Button-module_spinnerDash__y8Dii 1.5s ease-in-out infinite;\n}\n\n@keyframes Button-module_spin__fjXhP {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes Button-module_spinnerDash__y8Dii {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n}\n");const d=(...n)=>n.filter(Boolean).join(" "),_={small:s.sizeSmall,medium:s.sizeMedium,large:s.sizeLarge},m=({size:n})=>{const o={small:14,medium:18,large:22}[n];return u.jsx("svg",{className:s.spinner,width:o,height:o,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsx("circle",{className:s.spinnerCircle,cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})})},b=React.forwardRef((n,e)=>{const{variant:r="text",color:t="primary",size:a="medium",component:l,className:i,loading:c=false,startIcon:b,endIcon:p,fullWidth:f=false,disableElevation:g=false,children:y,...v}=n,x=toLegacySize(a),h="disabled"in n&&n.disabled,B="href"in n?n.href:void 0,k=l||(B?"a":"button"),S=h||c,w=d(s.root,s[r],((n,o)=>{const e=`${o}${n.charAt(0).toUpperCase()}${n.slice(1)}`;return s[e]||""})(t,r),_[x],S?s.disabled:void 0,f?s.fullWidth:void 0,g?s.noElevation:void 0,c?s.loading:void 0,i),E="button"===k?{disabled:S}:{},O="a"===k?{href:B,"aria-disabled":S}:{};return u.jsxs(k,{ref:e,className:w,...E,...O,...v,children:[c&&u.jsx("span",{className:s.loadingWrapper,children:u.jsx(m,{size:x})}),u.jsxs("span",{className:d(s.content,c?s.contentHidden:void 0),children:[b&&u.jsx("span",{className:s.startIcon,children:b}),y,p&&u.jsx("span",{className:s.endIcon,children:p})]})]})});b.displayName="Button";
|
|
473
|
+
*/function c(){return a||(a=1,"production"!==process.env.NODE_ENV&&function(){function o(n){if(null==n)return null;if("function"==typeof n)return n.$$typeof===E?null:n.displayName||n.name||null;if("string"==typeof n)return n;switch(n){case p:return "Fragment";case g:return "Profiler";case f:return "StrictMode";case h:return "Suspense";case B:return "SuspenseList";case w:return "Activity"}if("object"==typeof n)switch("number"==typeof n.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case b:return "Portal";case v:return n.displayName||"Context";case y:return (n._context.displayName||"Context")+".Consumer";case x:var e=n.render;return (n=n.displayName)||(n=""!==(n=e.displayName||e.name||"")?"ForwardRef("+n+")":"ForwardRef"),n;case k:return null!==(e=n.displayName||null)?e:o(n.type)||"Memo";case S:e=n._payload,n=n._init;try{return o(n(e))}catch(n){}}return null}function e(n){return ""+n}function r(n){try{e(n);var o=!1;}catch(n){o=true;}if(o){var r=(o=console).error,t="function"==typeof Symbol&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return r.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),e(n)}}function t(n){if(n===p)return "<>";if("object"==typeof n&&null!==n&&n.$$typeof===S)return "<...>";try{var e=o(n);return e?"<"+e+">":"<...>"}catch(n){return "<...>"}}function a(){return Error("react-stack-top-frame")}function l(){var n=o(this.type);return P[n]||(P[n]=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!==(n=this.props.ref)?n:null}function c(n,e,t,a,i,c){var s,_=e.children;if(void 0!==_)if(a)if(j(_)){for(a=0;a<_.length;a++)u(_[a]);Object.freeze&&Object.freeze(_);}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 u(_);if(N.call(e,"key")){_=o(n);var b=Object.keys(e).filter(function(n){return "key"!==n});a=0<b.length?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}",C[_+a]||(b=0<b.length?"{"+b.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,_,b,_),C[_+a]=true);}if(_=null,void 0!==t&&(r(t),_=""+t),function(n){if(N.call(n,"key")){var o=Object.getOwnPropertyDescriptor(n,"key").get;if(o&&o.isReactWarning)return false}return void 0!==n.key}(e)&&(r(e.key),_=""+e.key),"key"in e)for(var p in t={},e)"key"!==p&&(t[p]=e[p]);else t=e;return _&&function(n,o){function e(){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)",o));}e.isReactWarning=true,Object.defineProperty(n,"key",{get:e,configurable:true});}(t,"function"==typeof n?n.displayName||n.name||"Unknown":n),function(n,o,e,r,t,a){var i=e.ref;return n={$$typeof:m,type:n,key:o,props:e,_owner:r},null!==(void 0!==i?i:null)?Object.defineProperty(n,"ref",{enumerable:false,get:l}):Object.defineProperty(n,"ref",{enumerable:false,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(n,"_debugStack",{configurable:false,enumerable:false,writable:true,value:t}),Object.defineProperty(n,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}(n,_,t,null===(s=O.A)?null:s.getOwner(),i,c)}function u(n){s(n)?n._store&&(n._store.validated=1):"object"==typeof n&&null!==n&&n.$$typeof===S&&("fulfilled"===n._payload.status?s(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1));}function s(n){return "object"==typeof n&&null!==n&&n.$$typeof===m}var d,_=React,m=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),v=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),O=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,j=Array.isArray,I=console.createTask?console.createTask:function(){return null},P={},z=(_={react_stack_bottom_frame:function(n){return n()}}).react_stack_bottom_frame.bind(_,a)(),W=I(t(a)),C={};i.Fragment=p,i.jsx=function(n,o,e){var r=1e4>O.recentlyCreatedOwnerStacks++;return c(n,o,e,false,r?Error("react-stack-top-frame"):z,r?I(t(n)):W)},i.jsxs=function(n,o,e){var r=1e4>O.recentlyCreatedOwnerStacks++;return c(n,o,e,true,r?Error("react-stack-top-frame"):z,r?I(t(n)):W)};}()),i}var u=(l||(l=1,"production"===process.env.NODE_ENV?r.exports=function(){if(e)return t;e=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(o,e,r){var t=null;if(void 0!==r&&(t=""+r),void 0!==e.key&&(t=""+e.key),"key"in e)for(var a in r={},e)"key"!==a&&(r[a]=e[a]);else r=e;return e=r.ref,{$$typeof:n,type:o,key:t,ref:void 0!==e?e:null,props:r}}return t.Fragment=o,t.jsx=r,t.jsxs=r,t}():r.exports=c()),r.exports);var s={root:"Button-module_root__CbGH4",sizeSmall:"Button-module_sizeSmall__cwk1u",sizeMedium:"Button-module_sizeMedium__WI9SU",sizeLarge:"Button-module_sizeLarge__DCsOs",disabled:"Button-module_disabled__JgtZl",fullWidth:"Button-module_fullWidth__dOsPn",noElevation:"Button-module_noElevation__I6-zN",loading:"Button-module_loading__fZbPs",loadingWrapper:"Button-module_loadingWrapper__NrZp3",content:"Button-module_content__xCYa9",contentHidden:"Button-module_contentHidden__lJy-Z",startIcon:"Button-module_startIcon__x3190",endIcon:"Button-module_endIcon__9vUum",text:"Button-module_text__5mE0X",textPrimary:"Button-module_textPrimary__vfnk5",textSecondary:"Button-module_textSecondary__a3EiY",textSuccess:"Button-module_textSuccess__F84Hf",textError:"Button-module_textError__47t2-",textWarning:"Button-module_textWarning__sUoJ4",textInfo:"Button-module_textInfo__eHIQf",contained:"Button-module_contained__ihcEr",containedPrimary:"Button-module_containedPrimary__QABiB",containedSecondary:"Button-module_containedSecondary__Amyuq",containedSuccess:"Button-module_containedSuccess__klgok",containedError:"Button-module_containedError__WOxWG",containedWarning:"Button-module_containedWarning__dFc-N",containedInfo:"Button-module_containedInfo__PLgZO",outlined:"Button-module_outlined__3QTXD",outlinedPrimary:"Button-module_outlinedPrimary__fKrCf",outlinedSecondary:"Button-module_outlinedSecondary__n7OpX",outlinedSuccess:"Button-module_outlinedSuccess__Y2Plg",outlinedError:"Button-module_outlinedError__6NJ-J",outlinedWarning:"Button-module_outlinedWarning__aXlYk",outlinedInfo:"Button-module_outlinedInfo__hpDkF",spinner:"Button-module_spinner__vwfOT",spin:"Button-module_spin__fjXhP",spinnerCircle:"Button-module_spinnerCircle__7vRpf",spinnerDash:"Button-module_spinnerDash__y8Dii"};!function(n,o){ void 0===o&&(o={});var e=o.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===e&&r.firstChild?r.insertBefore(t,r.firstChild):r.appendChild(t),t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));}}(".Button-module_root__CbGH4 {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n font-family: var(--lb-font-sans);\n font-weight: var(--lb-font-weight-medium);\n border: 1px solid transparent;\n line-height: 1.75;\n white-space: nowrap;\n background: transparent;\n color: inherit;\n cursor: pointer;\n border-radius: var(--lb-radius-md);\n transition:\n background-color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n border-color 250ms cubic-bezier(0.4, 0, 0.2, 1),\n box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.Button-module_root__CbGH4:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px\n color-mix(in srgb, var(--lb-color-ring) 50%, transparent);\n}\n\n/* Size variants */\n.Button-module_sizeSmall__cwk1u {\n padding: 0.25rem 0.625rem;\n font-size: var(--lb-font-size-sm);\n min-height: 1.875rem;\n}\n\n.Button-module_sizeMedium__WI9SU {\n padding: 0.375rem 1rem;\n font-size: var(--lb-font-size-sm);\n min-height: 2.25rem;\n}\n\n.Button-module_sizeLarge__DCsOs {\n padding: 0.5rem 1.375rem;\n font-size: var(--lb-font-size-md);\n min-height: 2.625rem;\n}\n\n/* Disabled state */\n/* Combined with `.root` so it beats variant colors (e.g. .containedPrimary)\n regardless of source order (higher specificity). */\n.Button-module_root__CbGH4.Button-module_disabled__JgtZl {\n background: var(--lb-color-muted);\n background-color: var(--lb-color-muted);\n color: var(--lb-color-muted-foreground);\n border-color: transparent;\n cursor: not-allowed;\n pointer-events: none;\n box-shadow: none;\n opacity: 1;\n}\n\n/* Full width */\n.Button-module_fullWidth__dOsPn {\n width: 100%;\n}\n\n/* No elevation */\n.Button-module_noElevation__I6-zN {\n box-shadow: none !important;\n}\n\n/* Loading state */\n.Button-module_loading__fZbPs {\n pointer-events: none;\n}\n\n.Button-module_loadingWrapper__NrZp3 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.Button-module_content__xCYa9 {\n display: inline-flex;\n align-items: inherit;\n justify-content: inherit;\n gap: 0.5rem;\n}\n\n.Button-module_contentHidden__lJy-Z {\n opacity: 0;\n}\n\n.Button-module_startIcon__x3190,\n.Button-module_endIcon__9vUum {\n display: inherit;\n font-size: 1.25em;\n line-height: 1;\n}\n\n/* Variant: text */\n.Button-module_text__5mE0X {\n padding: 0.375rem 0.5rem;\n}\n\n.Button-module_text__5mE0X:hover {\n background-color: rgba(0, 0, 0, 0.04);\n}\n\n/* ============================================\n COLOR STYLES - TEXT VARIANT\n ============================================ */\n\n/* Primary */\n.Button-module_textPrimary__vfnk5 {\n color: var(--lb-color-primary);\n}\n.Button-module_textPrimary__vfnk5:hover {\n background-color: color-mix(in srgb, var(--lb-color-primary) 6%, transparent);\n}\n\n/* Secondary */\n.Button-module_textSecondary__a3EiY {\n color: var(--lb-color-neutral-600);\n}\n.Button-module_textSecondary__a3EiY:hover {\n background-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 6%,\n transparent\n );\n}\n\n/* Success */\n.Button-module_textSuccess__F84Hf {\n color: var(--lb-color-success);\n}\n.Button-module_textSuccess__F84Hf:hover {\n background-color: color-mix(in srgb, var(--lb-color-success) 6%, transparent);\n}\n\n/* Error */\n.Button-module_textError__47t2- {\n color: var(--lb-color-danger);\n}\n.Button-module_textError__47t2-:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger) 6%, transparent);\n}\n\n/* Warning */\n.Button-module_textWarning__sUoJ4 {\n color: var(--lb-color-warning);\n}\n.Button-module_textWarning__sUoJ4:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning) 6%, transparent);\n}\n\n/* Info */\n.Button-module_textInfo__eHIQf {\n color: var(--lb-color-info);\n}\n.Button-module_textInfo__eHIQf:hover {\n background-color: color-mix(in srgb, var(--lb-color-info) 6%, transparent);\n}\n\n/* ============================================\n COLOR STYLES - CONTAINED VARIANT\n ============================================ */\n\n/* Contained base */\n.Button-module_contained__ihcEr {\n box-shadow:\n 0px 3px 1px -2px rgba(0, 0, 0, 0.2),\n 0px 2px 2px 0px rgba(0, 0, 0, 0.14),\n 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n}\n\n.Button-module_contained__ihcEr:hover {\n box-shadow:\n 0px 2px 4px -1px rgba(0, 0, 0, 0.2),\n 0px 4px 5px 0px rgba(0, 0, 0, 0.14),\n 0px 1px 10px 0px rgba(0, 0, 0, 0.12);\n}\n\n.Button-module_contained__ihcEr:active {\n box-shadow:\n 0px 5px 5px -3px rgba(0, 0, 0, 0.2),\n 0px 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0px 3px 14px 2px rgba(0, 0, 0, 0.12);\n}\n\n/* Primary */\n.Button-module_containedPrimary__QABiB {\n background-color: var(--lb-color-primary);\n color: var(--lb-color-primary-foreground);\n}\n.Button-module_containedPrimary__QABiB:hover {\n background-color: var(--lb-color-primary-hover);\n}\n\n/* Secondary */\n.Button-module_containedSecondary__Amyuq {\n background-color: var(--lb-color-neutral-600);\n color: var(--lb-color-primary-foreground);\n}\n.Button-module_containedSecondary__Amyuq:hover {\n background-color: var(--lb-color-neutral-700);\n}\n\n/* Success */\n.Button-module_containedSuccess__klgok {\n background-color: var(--lb-color-success);\n color: var(--lb-color-success-foreground);\n}\n.Button-module_containedSuccess__klgok:hover {\n background-color: color-mix(in srgb, var(--lb-color-success), black 12%);\n}\n\n/* Error */\n.Button-module_containedError__WOxWG {\n background-color: var(--lb-color-danger);\n color: var(--lb-color-danger-foreground);\n}\n.Button-module_containedError__WOxWG:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger), black 12%);\n}\n\n/* Warning */\n.Button-module_containedWarning__dFc-N {\n background-color: var(--lb-color-warning);\n color: var(--lb-color-warning-foreground);\n}\n.Button-module_containedWarning__dFc-N:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning), black 12%);\n}\n\n/* Info */\n.Button-module_containedInfo__PLgZO {\n background-color: var(--lb-color-info);\n color: var(--lb-color-info-foreground);\n}\n.Button-module_containedInfo__PLgZO:hover {\n background-color: color-mix(in srgb, var(--lb-color-info), black 12%);\n}\n\n/* ============================================\n COLOR STYLES - OUTLINED VARIANT\n ============================================ */\n\n/* Outlined base */\n.Button-module_outlined__3QTXD {\n border: 1px solid var(--lb-color-border);\n}\n\n/* Primary */\n.Button-module_outlinedPrimary__fKrCf {\n color: var(--lb-color-primary);\n border-color: color-mix(in srgb, var(--lb-color-primary) 50%, transparent);\n}\n.Button-module_outlinedPrimary__fKrCf:hover {\n background-color: color-mix(in srgb, var(--lb-color-primary) 6%, transparent);\n border-color: var(--lb-color-primary);\n}\n\n/* Secondary */\n.Button-module_outlinedSecondary__n7OpX {\n color: var(--lb-color-neutral-600);\n border-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 50%,\n transparent\n );\n}\n.Button-module_outlinedSecondary__n7OpX:hover {\n background-color: color-mix(\n in srgb,\n var(--lb-color-neutral-600) 6%,\n transparent\n );\n border-color: var(--lb-color-neutral-600);\n}\n\n/* Success */\n.Button-module_outlinedSuccess__Y2Plg {\n color: var(--lb-color-success);\n border-color: color-mix(in srgb, var(--lb-color-success) 50%, transparent);\n}\n.Button-module_outlinedSuccess__Y2Plg:hover {\n background-color: color-mix(in srgb, var(--lb-color-success) 6%, transparent);\n border-color: var(--lb-color-success);\n}\n\n/* Error */\n.Button-module_outlinedError__6NJ-J {\n color: var(--lb-color-danger);\n border-color: color-mix(in srgb, var(--lb-color-danger) 50%, transparent);\n}\n.Button-module_outlinedError__6NJ-J:hover {\n background-color: color-mix(in srgb, var(--lb-color-danger) 6%, transparent);\n border-color: var(--lb-color-danger);\n}\n\n/* Warning */\n.Button-module_outlinedWarning__aXlYk {\n color: var(--lb-color-warning);\n border-color: color-mix(in srgb, var(--lb-color-warning) 50%, transparent);\n}\n.Button-module_outlinedWarning__aXlYk:hover {\n background-color: color-mix(in srgb, var(--lb-color-warning) 6%, transparent);\n border-color: var(--lb-color-warning);\n}\n\n/* Info */\n.Button-module_outlinedInfo__hpDkF {\n color: var(--lb-color-info);\n border-color: color-mix(in srgb, var(--lb-color-info) 50%, transparent);\n}\n.Button-module_outlinedInfo__hpDkF:hover {\n background-color: color-mix(in srgb, var(--lb-color-info) 6%, transparent);\n border-color: var(--lb-color-info);\n}\n\n/* Spinner animation */\n.Button-module_spinner__vwfOT {\n display: inline-flex;\n animation: Button-module_spin__fjXhP 0.8s linear infinite;\n}\n\n.Button-module_spinnerCircle__7vRpf {\n stroke-dasharray: 50;\n stroke-dashoffset: 25;\n animation: Button-module_spinnerDash__y8Dii 1.5s ease-in-out infinite;\n}\n\n@keyframes Button-module_spin__fjXhP {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes Button-module_spinnerDash__y8Dii {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n}\n");const d=(...n)=>n.filter(Boolean).join(" "),_={small:s.sizeSmall,medium:s.sizeMedium,large:s.sizeLarge},m=({size:n})=>{const o={small:14,medium:18,large:22}[n];return u.jsx("svg",{className:s.spinner,width:o,height:o,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u.jsx("circle",{className:s.spinnerCircle,cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})})},b=React.forwardRef((n,e)=>{const{variant:r="text",color:t="primary",size:a="medium",component:l,className:i,loading:c=false,startIcon:b,endIcon:p,fullWidth:f=false,disableElevation:g=false,children:y,...v}=n,x=toLegacySize(a),h="disabled"in n&&n.disabled,B="href"in n?n.href:void 0,k=l||(B?"a":"button"),S=h||c,w=d(s.root,s[r],((n,o)=>{const e=`${o}${n.charAt(0).toUpperCase()}${n.slice(1)}`;return s[e]||""})(t,r),_[x],S?s.disabled:void 0,f?s.fullWidth:void 0,g?s.noElevation:void 0,c?s.loading:void 0,i),E="button"===k?{disabled:S,type:"type"in n&&n.type||"button"}:{},O="a"===k?{href:B,"aria-disabled":S}:{};return u.jsxs(k,{ref:e,className:w,...E,...O,"aria-busy":c||void 0,...v,children:[c&&u.jsx("span",{className:s.loadingWrapper,children:u.jsx(m,{size:x})}),u.jsxs("span",{className:d(s.content,c?s.contentHidden:void 0),children:[b&&u.jsx("span",{className:s.startIcon,children:b}),y,p&&u.jsx("span",{className:s.endIcon,children:p})]})]})});b.displayName="Button";
|
|
472
474
|
|
|
473
475
|
function styleInject(css, ref) {
|
|
474
476
|
if ( ref === void 0 ) ref = {};
|
|
@@ -497,8 +499,8 @@ function styleInject(css, ref) {
|
|
|
497
499
|
}
|
|
498
500
|
}
|
|
499
501
|
|
|
500
|
-
var css_248z = ".ImageUpload-module_container__KfRP7 {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n width: 100%;\n max-width: 520px;\n}\n\n.ImageUpload-module_label__KrvGJ {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--lb-color-neutral-700);\n}\n\n.ImageUpload-module_content__h1n0w {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n\n.ImageUpload-module_dropzone__r29hi {\n position: relative;\n border: 2px dashed var(--lb-color-neutral-300);\n border-radius: 0.75rem;\n padding: 1.5rem;\n background: var(--lb-color-background);\n transition:\n border-color 150ms ease,\n background-color 150ms ease;\n cursor: pointer;\n}\n\n.ImageUpload-module_dropzoneActive__gKHgT {\n border-color: var(--lb-color-
|
|
501
|
-
var styles = {"container":"ImageUpload-module_container__KfRP7","label":"ImageUpload-module_label__KrvGJ","content":"ImageUpload-module_content__h1n0w","dropzone":"ImageUpload-module_dropzone__r29hi","dropzoneActive":"ImageUpload-module_dropzoneActive__gKHgT","dropzoneDisabled":"ImageUpload-module_dropzoneDisabled__sroj7","dropzoneFilled":"ImageUpload-module_dropzoneFilled__mW0tg","inputHidden":"ImageUpload-module_inputHidden__zyeM2","uploading":"ImageUpload-module_uploading__P5wVR","uploadingIcon":"ImageUpload-module_uploadingIcon__uSwpq","uploadingText":"ImageUpload-module_uploadingText__t0BkQ","preview":"ImageUpload-module_preview__CqJi-","imagePreview":"ImageUpload-module_imagePreview__22wJp","previewImage":"ImageUpload-module_previewImage__FpdIn","pdfPreview":"ImageUpload-module_pdfPreview__D6OCc","pdfIcon":"ImageUpload-module_pdfIcon__DIdkd","pdfLabel":"ImageUpload-module_pdfLabel__Ff-Al","linkGroup":"ImageUpload-module_linkGroup__mZFWH","linkPrimary":"ImageUpload-module_linkPrimary__byUBf","linkSecondary":"ImageUpload-module_linkSecondary__2E4IZ","actions":"ImageUpload-module_actions__hX2N3","prompt":"ImageUpload-module_prompt__Cm0R6","uploadIcon":"ImageUpload-module_uploadIcon__g9U0X","promptText":"ImageUpload-module_promptText__-d7wp","promptAction":"ImageUpload-module_promptAction__qFDjq","helperText":"ImageUpload-module_helperText__AbZRs","error":"ImageUpload-module_error__TBlHx","errorTitle":"ImageUpload-module_errorTitle__ktusO","errorMessage":"ImageUpload-module_errorMessage__RTkNU","hint":"ImageUpload-module_hint__RFWtZ"};
|
|
502
|
+
var css_248z = ".ImageUpload-module_container__KfRP7 {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n width: 100%;\n max-width: 520px;\n}\n\n.ImageUpload-module_label__KrvGJ {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--lb-color-neutral-700);\n}\n\n.ImageUpload-module_content__h1n0w {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n\n.ImageUpload-module_dropzone__r29hi {\n position: relative;\n border: 2px dashed var(--lb-color-neutral-300);\n border-radius: 0.75rem;\n padding: 1.5rem;\n background: var(--lb-color-background);\n transition:\n border-color 150ms ease,\n background-color 150ms ease;\n cursor: pointer;\n}\n\n.ImageUpload-module_dropzoneActive__gKHgT {\n border-color: var(--lb-color-primary-accent);\n background: var(--lb-color-primary-subtle);\n}\n\n.ImageUpload-module_dropzoneDisabled__sroj7 {\n opacity: 0.55;\n cursor: not-allowed;\n}\n\n.ImageUpload-module_dropzoneFilled__mW0tg {\n background: var(--lb-color-neutral-50);\n}\n\n.ImageUpload-module_inputHidden__zyeM2 {\n display: none;\n}\n\n.ImageUpload-module_uploading__P5wVR {\n text-align: center;\n}\n\n.ImageUpload-module_uploadingIcon__uSwpq {\n margin: 0 auto 0.5rem;\n color: var(--lb-color-primary);\n}\n\n.ImageUpload-module_uploadingText__t0BkQ {\n font-size: 0.875rem;\n color: var(--lb-color-neutral-600);\n}\n\n.ImageUpload-module_preview__CqJi- {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.75rem;\n}\n\n.ImageUpload-module_imagePreview__22wJp {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.5rem;\n}\n\n.ImageUpload-module_previewImage__FpdIn {\n object-fit: contain;\n border-radius: 0.75rem;\n}\n\n.ImageUpload-module_pdfPreview__D6OCc {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.5rem;\n}\n\n.ImageUpload-module_pdfIcon__DIdkd {\n width: 4rem;\n height: 4rem;\n color: var(--lb-color-danger);\n}\n\n.ImageUpload-module_pdfLabel__Ff-Al {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--lb-color-neutral-600);\n}\n\n.ImageUpload-module_linkGroup__mZFWH {\n display: flex;\n gap: 0.75rem;\n}\n\n.ImageUpload-module_linkPrimary__byUBf {\n font-size: 0.875rem;\n color: var(--lb-color-primary);\n text-decoration: underline;\n}\n\n.ImageUpload-module_linkPrimary__byUBf:hover {\n color: var(--lb-color-primary-hover);\n}\n\n.ImageUpload-module_linkSecondary__2E4IZ {\n font-size: 0.875rem;\n color: var(--lb-color-success);\n text-decoration: underline;\n}\n\n.ImageUpload-module_linkSecondary__2E4IZ:hover {\n color: var(--lb-color-emerald-strong);\n}\n\n.ImageUpload-module_actions__hX2N3 {\n display: flex;\n gap: 0.5rem;\n}\n\n.ImageUpload-module_prompt__Cm0R6 {\n text-align: center;\n}\n\n.ImageUpload-module_uploadIcon__g9U0X {\n margin: 0 auto;\n color: var(--lb-color-neutral-400);\n}\n\n.ImageUpload-module_promptText__-d7wp {\n margin-top: 0.5rem;\n font-size: 0.875rem;\n color: var(--lb-color-neutral-600);\n}\n\n.ImageUpload-module_promptAction__qFDjq {\n font-weight: 600;\n color: var(--lb-color-primary);\n}\n\n.ImageUpload-module_helperText__AbZRs {\n margin-top: 0.25rem;\n font-size: 0.75rem;\n color: var(--lb-color-neutral-500);\n}\n\n.ImageUpload-module_error__TBlHx {\n border-radius: 0.5rem;\n background: var(--lb-color-red-subtle);\n padding: 1rem;\n}\n\n.ImageUpload-module_errorTitle__ktusO {\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--lb-color-red-strong);\n margin: 0;\n}\n\n.ImageUpload-module_errorMessage__RTkNU {\n margin-top: 0.5rem;\n font-size: 0.875rem;\n color: var(--lb-color-red-strong);\n}\n\n.ImageUpload-module_hint__RFWtZ {\n margin: 0.25rem 0 0;\n font-size: var(--lb-font-size-xs);\n color: var(--lb-color-muted-foreground);\n}\n\n/* Avance de la subida */\n.ImageUpload-module_progressTrack__KnVtZ {\n width: 100%;\n max-width: 20rem;\n height: var(--lb-space-2);\n margin: var(--lb-space-3) auto 0;\n overflow: hidden;\n border-radius: var(--lb-radius-full);\n background: var(--lb-color-neutral-200);\n}\n\n.ImageUpload-module_progressBar__Gs2QW {\n height: 100%;\n border-radius: var(--lb-radius-full);\n background: var(--lb-color-primary);\n transition: width 200ms ease;\n}\n\n.ImageUpload-module_progressBarDone__ytoLa {\n animation: ImageUpload-module_progressPulse__Llz4V 1.2s ease-in-out infinite;\n}\n\n@keyframes ImageUpload-module_progressPulse__Llz4V {\n 50% {\n opacity: 0.55;\n }\n}\n\n/* Captura con la cámara */\n.ImageUpload-module_cameraPrompt__6l58r {\n margin-top: var(--lb-space-3);\n}\n\n.ImageUpload-module_camera__J-hJe {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--lb-space-4);\n background: var(--lb-color-overlay);\n}\n\n.ImageUpload-module_cameraBody__2XMvx {\n width: 100%;\n max-width: 28rem;\n padding: var(--lb-space-4);\n border-radius: var(--lb-radius-lg);\n background: var(--lb-color-background);\n box-shadow: var(--lb-shadow-lg);\n}\n\n.ImageUpload-module_cameraVideo__d0vbj {\n display: block;\n width: 100%;\n max-height: 60vh;\n border-radius: var(--lb-radius-md);\n background: var(--lb-color-neutral-900);\n}\n\n.ImageUpload-module_cameraText__Y99KB {\n margin: var(--lb-space-2) 0 0;\n text-align: center;\n font-size: var(--lb-font-size-sm);\n color: var(--lb-color-muted-foreground);\n}\n\n.ImageUpload-module_cameraErrorText__4m74n {\n margin: var(--lb-space-2) 0 0;\n text-align: center;\n font-size: var(--lb-font-size-sm);\n color: var(--lb-color-danger);\n}\n\n.ImageUpload-module_cameraActions__E1vy- {\n display: flex;\n justify-content: center;\n gap: var(--lb-space-3);\n margin-top: var(--lb-space-4);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ImageUpload-module_progressBar__Gs2QW {\n transition: none;\n }\n .ImageUpload-module_progressBarDone__ytoLa {\n animation: none;\n }\n}\n";
|
|
503
|
+
var styles = {"container":"ImageUpload-module_container__KfRP7","label":"ImageUpload-module_label__KrvGJ","content":"ImageUpload-module_content__h1n0w","dropzone":"ImageUpload-module_dropzone__r29hi","dropzoneActive":"ImageUpload-module_dropzoneActive__gKHgT","dropzoneDisabled":"ImageUpload-module_dropzoneDisabled__sroj7","dropzoneFilled":"ImageUpload-module_dropzoneFilled__mW0tg","inputHidden":"ImageUpload-module_inputHidden__zyeM2","uploading":"ImageUpload-module_uploading__P5wVR","uploadingIcon":"ImageUpload-module_uploadingIcon__uSwpq","uploadingText":"ImageUpload-module_uploadingText__t0BkQ","preview":"ImageUpload-module_preview__CqJi-","imagePreview":"ImageUpload-module_imagePreview__22wJp","previewImage":"ImageUpload-module_previewImage__FpdIn","pdfPreview":"ImageUpload-module_pdfPreview__D6OCc","pdfIcon":"ImageUpload-module_pdfIcon__DIdkd","pdfLabel":"ImageUpload-module_pdfLabel__Ff-Al","linkGroup":"ImageUpload-module_linkGroup__mZFWH","linkPrimary":"ImageUpload-module_linkPrimary__byUBf","linkSecondary":"ImageUpload-module_linkSecondary__2E4IZ","actions":"ImageUpload-module_actions__hX2N3","prompt":"ImageUpload-module_prompt__Cm0R6","uploadIcon":"ImageUpload-module_uploadIcon__g9U0X","promptText":"ImageUpload-module_promptText__-d7wp","promptAction":"ImageUpload-module_promptAction__qFDjq","helperText":"ImageUpload-module_helperText__AbZRs","error":"ImageUpload-module_error__TBlHx","errorTitle":"ImageUpload-module_errorTitle__ktusO","errorMessage":"ImageUpload-module_errorMessage__RTkNU","hint":"ImageUpload-module_hint__RFWtZ","progressTrack":"ImageUpload-module_progressTrack__KnVtZ","progressBar":"ImageUpload-module_progressBar__Gs2QW","progressBarDone":"ImageUpload-module_progressBarDone__ytoLa","cameraPrompt":"ImageUpload-module_cameraPrompt__6l58r","camera":"ImageUpload-module_camera__J-hJe","cameraBody":"ImageUpload-module_cameraBody__2XMvx","cameraVideo":"ImageUpload-module_cameraVideo__d0vbj","cameraText":"ImageUpload-module_cameraText__Y99KB","cameraErrorText":"ImageUpload-module_cameraErrorText__4m74n","cameraActions":"ImageUpload-module_cameraActions__E1vy-"};
|
|
502
504
|
styleInject(css_248z);
|
|
503
505
|
|
|
504
506
|
const classNames = (...classes) => classes.filter(Boolean).join(" ");
|
|
@@ -506,6 +508,9 @@ const interpolate = (template, values) => template.replace(/\{(\w+)\}/g, (_, key
|
|
|
506
508
|
const DEFAULT_IMAGE_UPLOAD_LABELS = {
|
|
507
509
|
uploadImage: "Subir imagen",
|
|
508
510
|
uploading: "Subiendo…",
|
|
511
|
+
uploadingPercent: "Subiendo… {percent} %",
|
|
512
|
+
processing: "Procesando…",
|
|
513
|
+
progressLabel: "Avance de la subida",
|
|
509
514
|
invalidFileType: "Formato no permitido. Usa: {formats}",
|
|
510
515
|
fileSizeExceeded: "El archivo pesa {size} MB; el máximo es {maxSize} MB",
|
|
511
516
|
uploadFailed: "No se pudo subir el archivo",
|
|
@@ -521,9 +526,24 @@ const DEFAULT_IMAGE_UPLOAD_LABELS = {
|
|
|
521
526
|
uploadError: "Error al subir",
|
|
522
527
|
pdfDocument: "Documento PDF",
|
|
523
528
|
previewAltText: "Vista previa",
|
|
529
|
+
takePhoto: "Tomar foto",
|
|
530
|
+
capturePhoto: "Capturar",
|
|
531
|
+
cancelCamera: "Cancelar",
|
|
532
|
+
cameraInstructions: "Encuadra el documento y captura la foto",
|
|
533
|
+
cameraError: "No se pudo acceder a la cámara. Revisa los permisos del navegador.",
|
|
534
|
+
cameraCaptureFailed: "No se pudo capturar la foto. Intenta de nuevo.",
|
|
535
|
+
};
|
|
536
|
+
/** Celulares y tablets ya abren la cámara nativa desde el selector de archivos. */
|
|
537
|
+
const esEscritorio = () => {
|
|
538
|
+
if (typeof navigator === "undefined")
|
|
539
|
+
return false;
|
|
540
|
+
const ua = navigator.userAgent;
|
|
541
|
+
const tablet = /iPad|Tablet|PlayBook|Silk|(Android(?!.*Mobile))/i.test(ua);
|
|
542
|
+
const movil = /Mobi|iPhone|iPod|Android.*Mobile|Windows Phone/i.test(ua);
|
|
543
|
+
return !movil && !tablet;
|
|
524
544
|
};
|
|
525
545
|
/** El `ref` apunta al `<input type="file">`. */
|
|
526
|
-
const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageUrl, onUpload, onRemove, maxSizeMB = 5, acceptedFormats = ["image/jpeg", "image/png", "image/svg+xml"], previewWidth = 200, previewHeight = 200, className = "", disabled = false, required = false, hint, error: errorProp, id, name, labels: labelsProp, }, ref) {
|
|
546
|
+
const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageUrl, currentFileIsPdf = false, currentFileName, onUpload, onRemove, maxSizeMB = 5, acceptedFormats = ["image/jpeg", "image/png", "image/svg+xml"], previewWidth = 200, previewHeight = 200, className = "", disabled = false, required = false, hint, error: errorProp, id, name, labels: labelsProp, allowCameraCapture = false, }, ref) {
|
|
527
547
|
const labels = { ...DEFAULT_IMAGE_UPLOAD_LABELS, ...labelsProp };
|
|
528
548
|
const generatedId = React.useId();
|
|
529
549
|
const inputId = id ?? generatedId;
|
|
@@ -532,9 +552,26 @@ const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageU
|
|
|
532
552
|
const displayLabel = label || labels.uploadImage;
|
|
533
553
|
const [preview, setPreview] = useState(currentImageUrl || null);
|
|
534
554
|
const [uploading, setUploading] = useState(false);
|
|
555
|
+
// Fracción ya enviada; null mientras no se conoce
|
|
556
|
+
const [progress, setProgress] = useState(null);
|
|
535
557
|
const [error, setError] = useState(null);
|
|
536
558
|
const [dragActive, setDragActive] = useState(false);
|
|
537
559
|
const fileInputRef = useRef(null);
|
|
560
|
+
const [cameraOpen, setCameraOpen] = useState(false);
|
|
561
|
+
const [cameraError, setCameraError] = useState(null);
|
|
562
|
+
const videoRef = useRef(null);
|
|
563
|
+
const streamRef = useRef(null);
|
|
564
|
+
const captureButtonRef = useRef(null);
|
|
565
|
+
const cameraSupported = allowCameraCapture &&
|
|
566
|
+
typeof navigator !== "undefined" &&
|
|
567
|
+
!!navigator.mediaDevices &&
|
|
568
|
+
typeof navigator.mediaDevices.getUserMedia === "function" &&
|
|
569
|
+
acceptedFormats.some((format) => format.startsWith("image/")) &&
|
|
570
|
+
esEscritorio();
|
|
571
|
+
const captureMimeType = acceptedFormats.includes("image/png") &&
|
|
572
|
+
!acceptedFormats.includes("image/jpeg")
|
|
573
|
+
? "image/png"
|
|
574
|
+
: "image/jpeg";
|
|
538
575
|
React.useImperativeHandle(ref, () => fileInputRef.current);
|
|
539
576
|
const shownError = error ?? errorProp ?? null;
|
|
540
577
|
const describedBy = [hint && hintId, shownError && errorId].filter(Boolean).join(" ") ||
|
|
@@ -583,7 +620,8 @@ const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageU
|
|
|
583
620
|
// Upload file
|
|
584
621
|
try {
|
|
585
622
|
setUploading(true);
|
|
586
|
-
|
|
623
|
+
setProgress(null);
|
|
624
|
+
await onUpload(file, (fraction) => setProgress(Math.max(0, Math.min(1, fraction))));
|
|
587
625
|
}
|
|
588
626
|
catch (err) {
|
|
589
627
|
setError(err instanceof Error ? err.message : labels.uploadFailed);
|
|
@@ -591,6 +629,7 @@ const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageU
|
|
|
591
629
|
}
|
|
592
630
|
finally {
|
|
593
631
|
setUploading(false);
|
|
632
|
+
setProgress(null);
|
|
594
633
|
}
|
|
595
634
|
};
|
|
596
635
|
const handleInputChange = (e) => {
|
|
@@ -641,20 +680,109 @@ const ImageUpload = React.forwardRef(function ImageUpload({ label, currentImageU
|
|
|
641
680
|
fileInputRef.current?.click();
|
|
642
681
|
}
|
|
643
682
|
};
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
683
|
+
// Abre o cierra la cámara junto con la vista de captura
|
|
684
|
+
useEffect(() => {
|
|
685
|
+
if (!cameraOpen)
|
|
686
|
+
return;
|
|
687
|
+
let active = true;
|
|
688
|
+
captureButtonRef.current?.focus();
|
|
689
|
+
(async () => {
|
|
690
|
+
try {
|
|
691
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
692
|
+
video: { facingMode: { ideal: "environment" } },
|
|
693
|
+
audio: false,
|
|
694
|
+
});
|
|
695
|
+
if (!active) {
|
|
696
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
streamRef.current = stream;
|
|
700
|
+
// Conectar o reproducir puede fallar (políticas de autoplay); no es crítico
|
|
701
|
+
try {
|
|
702
|
+
if (videoRef.current) {
|
|
703
|
+
videoRef.current.srcObject = stream;
|
|
704
|
+
await videoRef.current.play();
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
catch {
|
|
708
|
+
/* sin vista previa del video */
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
catch {
|
|
712
|
+
if (active) {
|
|
713
|
+
setCameraError(labels.cameraError);
|
|
714
|
+
setCameraOpen(false);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
})();
|
|
718
|
+
return () => {
|
|
719
|
+
active = false;
|
|
720
|
+
streamRef.current?.getTracks().forEach((track) => track.stop());
|
|
721
|
+
streamRef.current = null;
|
|
722
|
+
};
|
|
723
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
724
|
+
}, [cameraOpen]);
|
|
725
|
+
const openCamera = () => {
|
|
726
|
+
setError(null);
|
|
727
|
+
setCameraError(null);
|
|
728
|
+
setCameraOpen(true);
|
|
729
|
+
};
|
|
730
|
+
const capturePhoto = async () => {
|
|
731
|
+
const video = videoRef.current;
|
|
732
|
+
if (!video || !video.videoWidth) {
|
|
733
|
+
setCameraError(labels.cameraCaptureFailed);
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
const canvas = document.createElement("canvas");
|
|
737
|
+
canvas.width = video.videoWidth;
|
|
738
|
+
canvas.height = video.videoHeight;
|
|
739
|
+
const ctx = canvas.getContext("2d");
|
|
740
|
+
if (!ctx) {
|
|
741
|
+
setCameraError(labels.cameraCaptureFailed);
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
745
|
+
const blob = await new Promise((resolve) => canvas.toBlob((result) => resolve(result), captureMimeType, 0.92));
|
|
746
|
+
if (!blob) {
|
|
747
|
+
setCameraError(labels.cameraCaptureFailed);
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
const extension = captureMimeType === "image/png" ? "png" : "jpg";
|
|
751
|
+
const file = new File([blob], `camara-${Date.now()}.${extension}`, {
|
|
752
|
+
type: captureMimeType,
|
|
753
|
+
});
|
|
754
|
+
setCameraOpen(false); // la limpieza del efecto apaga la cámara
|
|
755
|
+
await handleFileChange(file);
|
|
756
|
+
};
|
|
757
|
+
const cameraButton = cameraSupported && (jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "secondary", size: "small", startIcon: jsxRuntimeExports.jsx(r$1, { size: "sm" }), onClick: (event) => {
|
|
758
|
+
event.stopPropagation();
|
|
759
|
+
openCamera();
|
|
760
|
+
}, disabled: disabled || uploading, children: labels.takePhoto }));
|
|
761
|
+
const isPdf = !!preview &&
|
|
762
|
+
(preview.endsWith(".pdf") ||
|
|
763
|
+
preview === "PDF_PLACEHOLDER" ||
|
|
764
|
+
currentImageUrl?.endsWith(".pdf") ||
|
|
765
|
+
(currentFileIsPdf && preview === currentImageUrl));
|
|
766
|
+
const percent = progress === null ? null : Math.round(progress * 100);
|
|
767
|
+
return (jsxRuntimeExports.jsxs("div", { className: classNames(styles.container, className), "data-testid": "image-upload", children: [jsxRuntimeExports.jsxs("label", { htmlFor: inputId, className: styles.label, children: [displayLabel, required && jsxRuntimeExports.jsx("span", { "aria-hidden": "true", children: " *" })] }), jsxRuntimeExports.jsxs("div", { className: styles.content, children: [jsxRuntimeExports.jsxs("div", { onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, onClick: handleClick, className: classNames(styles.dropzone, dragActive && styles.dropzoneActive, disabled && styles.dropzoneDisabled, Boolean(preview) && styles.dropzoneFilled), "data-testid": "image-upload-dropzone", children: [jsxRuntimeExports.jsx("input", { ref: fileInputRef, id: inputId, name: name, required: required, "aria-invalid": shownError ? true : undefined, "aria-describedby": describedBy, type: "file", onChange: handleInputChange, accept: acceptedFormats.join(","), className: styles.inputHidden, disabled: disabled || uploading, "data-testid": "image-upload-input" }), uploading ? (jsxRuntimeExports.jsxs("div", { className: styles.uploading, "data-testid": "image-upload-progress", children: [jsxRuntimeExports.jsx(r$3, { size: "lg", className: styles.uploadingIcon }), jsxRuntimeExports.jsx("p", { className: styles.uploadingText, "aria-live": "polite", children: percent === null
|
|
768
|
+
? labels.uploading
|
|
769
|
+
: percent >= 100
|
|
770
|
+
? labels.processing
|
|
771
|
+
: interpolate(labels.uploadingPercent, { percent }) }), percent !== null && (jsxRuntimeExports.jsx("div", { role: "progressbar", "aria-label": labels.progressLabel, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent, className: styles.progressTrack, children: jsxRuntimeExports.jsx("div", { className: classNames(styles.progressBar, percent >= 100 && styles.progressBarDone), style: { width: `${percent}%` } }) }))] })) : preview ? (jsxRuntimeExports.jsxs("div", { className: styles.preview, children: [isPdf ? (jsxRuntimeExports.jsxs("div", { className: styles.pdfPreview, children: [jsxRuntimeExports.jsx(e$1, { className: styles.pdfIcon }), jsxRuntimeExports.jsx("p", { className: styles.pdfLabel, children: labels.pdfDocument }), currentImageUrl && (jsxRuntimeExports.jsxs("div", { className: styles.linkGroup, children: [jsxRuntimeExports.jsx("a", { href: currentImageUrl, target: "_blank", rel: "noopener noreferrer", className: styles.linkPrimary, onClick: (e) => e.stopPropagation(), children: labels.viewDocument }), jsxRuntimeExports.jsx("a", { href: currentImageUrl, download: currentFileName ?? "", target: "_blank", rel: "noopener noreferrer", className: styles.linkSecondary, onClick: (e) => e.stopPropagation(), children: labels.downloadDocument })] }))] })) : (jsxRuntimeExports.jsxs("div", { className: styles.imagePreview, children: [jsxRuntimeExports.jsx("img", { src: preview, alt: labels.previewAltText, style: {
|
|
647
772
|
maxWidth: previewWidth,
|
|
648
773
|
maxHeight: previewHeight,
|
|
649
|
-
}, className: styles.previewImage }), currentImageUrl && (jsxRuntimeExports.jsxs("div", { className: styles.linkGroup, children: [jsxRuntimeExports.jsx("a", { href: currentImageUrl, target: "_blank", rel: "noopener noreferrer", className: styles.linkPrimary, onClick: (e) => e.stopPropagation(), children: labels.viewDocument }), jsxRuntimeExports.jsx("a", { href: currentImageUrl, download:
|
|
774
|
+
}, className: styles.previewImage }), currentImageUrl && (jsxRuntimeExports.jsxs("div", { className: styles.linkGroup, children: [jsxRuntimeExports.jsx("a", { href: currentImageUrl, target: "_blank", rel: "noopener noreferrer", className: styles.linkPrimary, onClick: (e) => e.stopPropagation(), children: labels.viewDocument }), jsxRuntimeExports.jsx("a", { href: currentImageUrl, download: currentFileName ?? "", target: "_blank", rel: "noopener noreferrer", className: styles.linkSecondary, onClick: (e) => e.stopPropagation(), children: labels.downloadImage })] }))] })), jsxRuntimeExports.jsxs("div", { className: styles.actions, children: [jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "secondary", size: "small", onClick: (event) => {
|
|
650
775
|
event.stopPropagation();
|
|
651
776
|
handleClick();
|
|
652
|
-
}, disabled: disabled, children: labels.changeImage }), onRemove && (jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "warning", size: "small", onClick: (event) => {
|
|
777
|
+
}, disabled: disabled, children: labels.changeImage }), cameraButton, onRemove && (jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "warning", size: "small", onClick: (event) => {
|
|
653
778
|
event.stopPropagation();
|
|
654
779
|
handleRemove();
|
|
655
|
-
}, disabled: disabled, children: labels.remove }))] })] })) : (jsxRuntimeExports.jsxs("div", { className: styles.prompt, children: [jsxRuntimeExports.jsx(r$
|
|
780
|
+
}, disabled: disabled, children: labels.remove }))] })] })) : (jsxRuntimeExports.jsxs("div", { className: styles.prompt, children: [jsxRuntimeExports.jsx(r$2, { className: styles.uploadIcon }), jsxRuntimeExports.jsxs("p", { className: styles.promptText, children: [jsxRuntimeExports.jsx("span", { className: styles.promptAction, children: labels.clickToUpload }), " ", labels.dragAndDrop] }), jsxRuntimeExports.jsxs("p", { className: styles.helperText, children: [acceptedFormats
|
|
656
781
|
.map((format) => format.split("/")[1].toUpperCase())
|
|
657
|
-
.join(", "), " ", labels.upTo, " ", maxSizeMB, "MB"] })] }))] }), hint && !shownError && (jsxRuntimeExports.jsx("p", { id: hintId, className: styles.hint, children: hint })), shownError && (jsxRuntimeExports.jsxs("div", { id: errorId, className: styles.error, role: "alert", children: [jsxRuntimeExports.jsx("h3", { className: styles.errorTitle, children: labels.uploadError }), jsxRuntimeExports.jsx("p", { className: styles.errorMessage, children: shownError })] }))
|
|
782
|
+
.join(", "), " ", labels.upTo, " ", maxSizeMB, "MB"] }), cameraButton && (jsxRuntimeExports.jsx("div", { className: styles.cameraPrompt, children: cameraButton }))] }))] }), hint && !shownError && (jsxRuntimeExports.jsx("p", { id: hintId, className: styles.hint, children: hint })), shownError && (jsxRuntimeExports.jsxs("div", { id: errorId, className: styles.error, role: "alert", children: [jsxRuntimeExports.jsx("h3", { className: styles.errorTitle, children: labels.uploadError }), jsxRuntimeExports.jsx("p", { className: styles.errorMessage, children: shownError })] })), cameraError && !cameraOpen && (jsxRuntimeExports.jsx("div", { className: styles.error, role: "alert", children: jsxRuntimeExports.jsx("p", { className: styles.errorMessage, children: cameraError }) }))] }), cameraOpen && (jsxRuntimeExports.jsx("div", { className: styles.camera, role: "dialog", "aria-modal": "true", "aria-label": labels.takePhoto, onKeyDown: (event) => {
|
|
783
|
+
if (event.key === "Escape")
|
|
784
|
+
setCameraOpen(false);
|
|
785
|
+
}, children: jsxRuntimeExports.jsxs("div", { className: styles.cameraBody, children: [jsxRuntimeExports.jsx("video", { ref: videoRef, playsInline: true, muted: true, className: styles.cameraVideo }), jsxRuntimeExports.jsx("p", { className: styles.cameraText, children: labels.cameraInstructions }), cameraError && (jsxRuntimeExports.jsx("p", { className: styles.cameraErrorText, children: cameraError })), jsxRuntimeExports.jsxs("div", { className: styles.cameraActions, children: [jsxRuntimeExports.jsx(b, { ref: captureButtonRef, type: "button", startIcon: jsxRuntimeExports.jsx(r$1, { size: "sm" }), onClick: capturePhoto, disabled: uploading, children: labels.capturePhoto }), jsxRuntimeExports.jsx(b, { type: "button", variant: "outlined", color: "secondary", onClick: () => setCameraOpen(false), children: labels.cancelCamera })] })] }) }))] }));
|
|
658
786
|
});
|
|
659
787
|
|
|
660
788
|
export { DEFAULT_IMAGE_UPLOAD_LABELS, ImageUpload as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubenpazch/image-upload",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "ImageUpload component",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "^19.0.0",
|
|
31
31
|
"react-dom": "^19.0.0",
|
|
32
|
-
"@rubenpazch/tokens": "0.
|
|
32
|
+
"@rubenpazch/tokens": "0.5.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@rubenpazch/button": "^6.2.
|
|
36
|
-
"@rubenpazch/icons": "^6.
|
|
35
|
+
"@rubenpazch/button": "^6.2.5",
|
|
36
|
+
"@rubenpazch/icons": "^6.6.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@rubenpazch/typescript-config": "3.0.0"
|