@net-advantage/nabs-ui-signature 0.22.0 → 0.24.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/dist/nabs-ui-signature.cjs +2 -2
- package/dist/nabs-ui-signature.js +47 -42
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);let t=require("react");
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);let t=require("react");function n(e,t){let n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function r(e,t){if(t.length!==0){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n+=1)e.lineTo(t[n].x,t[n].y);e.stroke()}}function i(e,t,n){e.fillStyle=n,e.fillRect(0,0,t.width,t.height)}var a=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),o=e((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,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)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,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.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,"ref",{enumerable:!1,value:null}):Object.defineProperty(e,"ref",{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}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 f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),
|
|
6
|
+
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),s=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=a():t.exports=o()}))();function c({label:e=`Signature`,helperText:a=`Use your mouse to draw your signature.`,value:o=``,disabled:c=!1,className:l=``,labelClassName:u=``,helperTextClassName:d=``,padClassName:f=``,canvasClassName:p=``,id:m,width:h=720,height:g=240,backgroundColor:_=`#ffffff`,penColor:v=`#0f172a`,penWidth:y=2.5,onChange:b,onBeginStroke:x,onEndStroke:S,onClear:C}){let w=(0,t.useId)(),T=m??`nabs-ui-signature-${w.replace(/:/g,``)}`,E=(0,t.useRef)(null),D=(0,t.useRef)(null),O=(0,t.useRef)(!1),k=(0,t.useRef)([]),[A,j]=(0,t.useState)(!o),M=[`nabs-ui-signature`,c?`nabs-ui-signature--disabled`:``,l].filter(Boolean).join(` `),N=[`nabs-ui-signature__label`,u].filter(Boolean).join(` `),P=[`nabs-ui-signature__helper`,d].filter(Boolean).join(` `),F=[`nabs-ui-signature__pad`,f].filter(Boolean).join(` `),I=[`nabs-ui-signature__canvas`,p].filter(Boolean).join(` `);(0,t.useEffect)(()=>{let e=E.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let n=window.devicePixelRatio||1,r=Math.round(h),a=Math.round(g);if(e.width=Math.round(r*n),e.height=Math.round(a*n),e.style.width=`${r}px`,e.style.height=`${a}px`,D.current=t,t.lineCap=`round`,t.lineJoin=`round`,t.lineWidth=y*n,t.strokeStyle=v,t.scale(n,n),i(t,e,_),o){let e=new Image;e.onload=()=>{t.clearRect(0,0,r,a),t.fillStyle=_,t.fillRect(0,0,r,a),t.drawImage(e,0,0,r,a),j(!1)},e.src=o}return()=>{D.current=null}},[_,v,y,o,h,g]);let L=e=>{b?.(e.toDataURL(`image/png`))},R=e=>{if(c||O.current)return;let t=E.current,r=D.current;!t||!r||(`pointerId`in e&&typeof e.pointerId==`number`&&t.setPointerCapture&&t.setPointerCapture(e.pointerId),O.current=!0,k.current=[n(e,t)],r.beginPath(),r.moveTo(k.current[0].x,k.current[0].y),x?.())},z=e=>{if(c||!O.current)return;let t=E.current,r=D.current;if(!t||!r)return;let i=n(e,t);k.current.push(i),r.lineTo(i.x,i.y),r.stroke(),j(!1)},B=e=>{let t=E.current,n=D.current;if(!(!t||!n||!O.current)){if(e&&`pointerId`in e&&typeof e.pointerId==`number`&&t.releasePointerCapture)try{t.releasePointerCapture(e.pointerId)}catch{}O.current=!1,r(n,k.current),k.current=[],L(t),S?.()}};return(0,s.jsxs)(`div`,{className:M,children:[(0,s.jsx)(`div`,{className:N,id:`${T}-label`,children:e}),a?(0,s.jsx)(`div`,{className:P,children:a}):null,(0,s.jsxs)(`div`,{className:F,children:[(0,s.jsx)(`canvas`,{id:T,ref:E,className:I,role:`img`,"aria-labelledby":`${T}-label`,"aria-label":e,onPointerDown:R,onPointerMove:z,onPointerUp:B,onPointerCancel:B,onPointerLeave:B,onMouseDown:R,onMouseMove:z,onMouseUp:B,onMouseLeave:B}),(0,s.jsx)(`div`,{className:`nabs-ui-signature__placeholder`,"aria-hidden":`true`,children:A?`Draw here`:null})]}),(0,s.jsx)(`div`,{className:`nabs-ui-signature__actions`,children:(0,s.jsx)(`button`,{type:`button`,className:`nabs-ui-signature__clearButton`,onClick:()=>{let e=E.current,t=D.current;!e||!t||(t.clearRect(0,0,e.width,e.height),i(t,e,_),j(!0),b?.(``),C?.())},disabled:c||A,children:`Clear`})})]})}exports.Signature=c;
|
|
@@ -3,7 +3,29 @@ import { useEffect as e, useId as t, useRef as n, useState as r } from "react";
|
|
|
3
3
|
var i = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), a = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
4
4
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
5
5
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
6
|
-
})
|
|
6
|
+
});
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/signature.utils.ts
|
|
9
|
+
function o(e, t) {
|
|
10
|
+
let n = t.getBoundingClientRect();
|
|
11
|
+
return {
|
|
12
|
+
x: e.clientX - n.left,
|
|
13
|
+
y: e.clientY - n.top
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function s(e, t) {
|
|
17
|
+
if (t.length !== 0) {
|
|
18
|
+
e.beginPath(), e.moveTo(t[0].x, t[0].y);
|
|
19
|
+
for (let n = 1; n < t.length; n += 1) e.lineTo(t[n].x, t[n].y);
|
|
20
|
+
e.stroke();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function c(e, t, n) {
|
|
24
|
+
e.fillStyle = n, e.fillRect(0, 0, t.width, t.height);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../../node_modules/.pnpm/react@19.2.7/node_modules/react/cjs/react-jsx-runtime.production.js
|
|
28
|
+
var l = /* @__PURE__ */ i(((e) => {
|
|
7
29
|
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
8
30
|
function r(e, n, r) {
|
|
9
31
|
var i = null;
|
|
@@ -18,7 +40,7 @@ var i = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
18
40
|
};
|
|
19
41
|
}
|
|
20
42
|
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
21
|
-
})),
|
|
43
|
+
})), u = /* @__PURE__ */ i(((e) => {
|
|
22
44
|
process.env.NODE_ENV !== "production" && (function() {
|
|
23
45
|
function t(e) {
|
|
24
46
|
if (e == null) return null;
|
|
@@ -176,30 +198,13 @@ var i = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
176
198
|
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
177
199
|
};
|
|
178
200
|
})();
|
|
179
|
-
})),
|
|
180
|
-
process.env.NODE_ENV === "production" ? t.exports =
|
|
201
|
+
})), d = (/* @__PURE__ */ i(((e, t) => {
|
|
202
|
+
process.env.NODE_ENV === "production" ? t.exports = l() : t.exports = u();
|
|
181
203
|
})))();
|
|
182
|
-
function
|
|
183
|
-
let
|
|
184
|
-
return {
|
|
185
|
-
x: e.clientX - n.left,
|
|
186
|
-
y: e.clientY - n.top
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
function u(e, t) {
|
|
190
|
-
if (t.length !== 0) {
|
|
191
|
-
e.beginPath(), e.moveTo(t[0].x, t[0].y);
|
|
192
|
-
for (let n = 1; n < t.length; n += 1) e.lineTo(t[n].x, t[n].y);
|
|
193
|
-
e.stroke();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
function d(e, t, n) {
|
|
197
|
-
e.fillStyle = n, e.fillRect(0, 0, t.width, t.height);
|
|
198
|
-
}
|
|
199
|
-
function f({ label: i = "Signature", helperText: a = "Use your mouse to draw your signature.", value: o = "", disabled: s = !1, className: f = "", labelClassName: p = "", helperTextClassName: m = "", padClassName: h = "", canvasClassName: g = "", id: _, width: v = 720, height: y = 240, backgroundColor: b = "#ffffff", penColor: x = "#0f172a", penWidth: S = 2.5, onChange: C, onBeginStroke: w, onEndStroke: T, onClear: E }) {
|
|
200
|
-
let D = t(), O = _ ?? `nabs-ui-signature-${D.replace(/:/g, "")}`, k = n(null), A = n(null), j = n(!1), M = n([]), [N, P] = r(!o), F = [
|
|
204
|
+
function f({ label: i = "Signature", helperText: a = "Use your mouse to draw your signature.", value: l = "", disabled: u = !1, className: f = "", labelClassName: p = "", helperTextClassName: m = "", padClassName: h = "", canvasClassName: g = "", id: _, width: v = 720, height: y = 240, backgroundColor: b = "#ffffff", penColor: x = "#0f172a", penWidth: S = 2.5, onChange: C, onBeginStroke: w, onEndStroke: T, onClear: E }) {
|
|
205
|
+
let D = t(), O = _ ?? `nabs-ui-signature-${D.replace(/:/g, "")}`, k = n(null), A = n(null), j = n(!1), M = n([]), [N, P] = r(!l), F = [
|
|
201
206
|
"nabs-ui-signature",
|
|
202
|
-
|
|
207
|
+
u ? "nabs-ui-signature--disabled" : "",
|
|
203
208
|
f
|
|
204
209
|
].filter(Boolean).join(" "), I = ["nabs-ui-signature__label", p].filter(Boolean).join(" "), L = ["nabs-ui-signature__helper", m].filter(Boolean).join(" "), R = ["nabs-ui-signature__pad", h].filter(Boolean).join(" "), z = ["nabs-ui-signature__canvas", g].filter(Boolean).join(" ");
|
|
205
210
|
e(() => {
|
|
@@ -208,11 +213,11 @@ function f({ label: i = "Signature", helperText: a = "Use your mouse to draw you
|
|
|
208
213
|
let t = e.getContext("2d");
|
|
209
214
|
if (!t) return;
|
|
210
215
|
let n = window.devicePixelRatio || 1, r = Math.round(v), i = Math.round(y);
|
|
211
|
-
if (e.width = Math.round(r * n), e.height = Math.round(i * n), e.style.width = `${r}px`, e.style.height = `${i}px`, A.current = t, t.lineCap = "round", t.lineJoin = "round", t.lineWidth = S * n, t.strokeStyle = x, t.scale(n, n),
|
|
216
|
+
if (e.width = Math.round(r * n), e.height = Math.round(i * n), e.style.width = `${r}px`, e.style.height = `${i}px`, A.current = t, t.lineCap = "round", t.lineJoin = "round", t.lineWidth = S * n, t.strokeStyle = x, t.scale(n, n), c(t, e, b), l) {
|
|
212
217
|
let e = new Image();
|
|
213
218
|
e.onload = () => {
|
|
214
219
|
t.clearRect(0, 0, r, i), t.fillStyle = b, t.fillRect(0, 0, r, i), t.drawImage(e, 0, 0, r, i), P(!1);
|
|
215
|
-
}, e.src =
|
|
220
|
+
}, e.src = l;
|
|
216
221
|
}
|
|
217
222
|
return () => {
|
|
218
223
|
A.current = null;
|
|
@@ -221,21 +226,21 @@ function f({ label: i = "Signature", helperText: a = "Use your mouse to draw you
|
|
|
221
226
|
b,
|
|
222
227
|
x,
|
|
223
228
|
S,
|
|
224
|
-
|
|
229
|
+
l,
|
|
225
230
|
v,
|
|
226
231
|
y
|
|
227
232
|
]);
|
|
228
233
|
let B = (e) => {
|
|
229
234
|
C?.(e.toDataURL("image/png"));
|
|
230
235
|
}, V = (e) => {
|
|
231
|
-
if (
|
|
236
|
+
if (u || j.current) return;
|
|
232
237
|
let t = k.current, n = A.current;
|
|
233
|
-
!t || !n || ("pointerId" in e && typeof e.pointerId == "number" && t.setPointerCapture && t.setPointerCapture(e.pointerId), j.current = !0, M.current = [
|
|
238
|
+
!t || !n || ("pointerId" in e && typeof e.pointerId == "number" && t.setPointerCapture && t.setPointerCapture(e.pointerId), j.current = !0, M.current = [o(e, t)], n.beginPath(), n.moveTo(M.current[0].x, M.current[0].y), w?.());
|
|
234
239
|
}, H = (e) => {
|
|
235
|
-
if (
|
|
240
|
+
if (u || !j.current) return;
|
|
236
241
|
let t = k.current, n = A.current;
|
|
237
242
|
if (!t || !n) return;
|
|
238
|
-
let r =
|
|
243
|
+
let r = o(e, t);
|
|
239
244
|
M.current.push(r), n.lineTo(r.x, r.y), n.stroke(), P(!1);
|
|
240
245
|
}, U = (e) => {
|
|
241
246
|
let t = k.current, n = A.current;
|
|
@@ -243,24 +248,24 @@ function f({ label: i = "Signature", helperText: a = "Use your mouse to draw you
|
|
|
243
248
|
if (e && "pointerId" in e && typeof e.pointerId == "number" && t.releasePointerCapture) try {
|
|
244
249
|
t.releasePointerCapture(e.pointerId);
|
|
245
250
|
} catch {}
|
|
246
|
-
j.current = !1,
|
|
251
|
+
j.current = !1, s(n, M.current), M.current = [], B(t), T?.();
|
|
247
252
|
}
|
|
248
253
|
};
|
|
249
|
-
return /* @__PURE__ */ (0,
|
|
254
|
+
return /* @__PURE__ */ (0, d.jsxs)("div", {
|
|
250
255
|
className: F,
|
|
251
256
|
children: [
|
|
252
|
-
/* @__PURE__ */ (0,
|
|
257
|
+
/* @__PURE__ */ (0, d.jsx)("div", {
|
|
253
258
|
className: I,
|
|
254
259
|
id: `${O}-label`,
|
|
255
260
|
children: i
|
|
256
261
|
}),
|
|
257
|
-
a ? /* @__PURE__ */ (0,
|
|
262
|
+
a ? /* @__PURE__ */ (0, d.jsx)("div", {
|
|
258
263
|
className: L,
|
|
259
264
|
children: a
|
|
260
265
|
}) : null,
|
|
261
|
-
/* @__PURE__ */ (0,
|
|
266
|
+
/* @__PURE__ */ (0, d.jsxs)("div", {
|
|
262
267
|
className: R,
|
|
263
|
-
children: [/* @__PURE__ */ (0,
|
|
268
|
+
children: [/* @__PURE__ */ (0, d.jsx)("canvas", {
|
|
264
269
|
id: O,
|
|
265
270
|
ref: k,
|
|
266
271
|
className: z,
|
|
@@ -276,22 +281,22 @@ function f({ label: i = "Signature", helperText: a = "Use your mouse to draw you
|
|
|
276
281
|
onMouseMove: H,
|
|
277
282
|
onMouseUp: U,
|
|
278
283
|
onMouseLeave: U
|
|
279
|
-
}), /* @__PURE__ */ (0,
|
|
284
|
+
}), /* @__PURE__ */ (0, d.jsx)("div", {
|
|
280
285
|
className: "nabs-ui-signature__placeholder",
|
|
281
286
|
"aria-hidden": "true",
|
|
282
287
|
children: N ? "Draw here" : null
|
|
283
288
|
})]
|
|
284
289
|
}),
|
|
285
|
-
/* @__PURE__ */ (0,
|
|
290
|
+
/* @__PURE__ */ (0, d.jsx)("div", {
|
|
286
291
|
className: "nabs-ui-signature__actions",
|
|
287
|
-
children: /* @__PURE__ */ (0,
|
|
292
|
+
children: /* @__PURE__ */ (0, d.jsx)("button", {
|
|
288
293
|
type: "button",
|
|
289
294
|
className: "nabs-ui-signature__clearButton",
|
|
290
295
|
onClick: () => {
|
|
291
296
|
let e = k.current, t = A.current;
|
|
292
|
-
!e || !t || (t.clearRect(0, 0, e.width, e.height),
|
|
297
|
+
!e || !t || (t.clearRect(0, 0, e.width, e.height), c(t, e, b), P(!0), C?.(""), E?.());
|
|
293
298
|
},
|
|
294
|
-
disabled:
|
|
299
|
+
disabled: u || N,
|
|
295
300
|
children: "Clear"
|
|
296
301
|
})
|
|
297
302
|
})
|