@forgedevstack/bear 1.2.8 → 1.3.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/components/Backdrop/Backdrop.cjs +1 -1
- package/dist/components/Backdrop/Backdrop.const.cjs +1 -1
- package/dist/components/Backdrop/Backdrop.const.d.ts +4 -1
- package/dist/components/Backdrop/Backdrop.const.js +11 -8
- package/dist/components/Backdrop/Backdrop.js +39 -36
- package/dist/components/Backdrop/Backdrop.types.d.ts +1 -0
- package/dist/components/Backdrop/index.d.ts +1 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.d.ts +3 -0
- package/dist/components/Drawer/Drawer.const.js +14 -11
- package/dist/components/Drawer/Drawer.js +95 -82
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +3 -1
- package/dist/components/Modal/Modal.const.js +12 -9
- package/dist/components/Modal/Modal.js +45 -41
- package/dist/components/Modal/Modal.types.d.ts +1 -0
- package/dist/components/ModalsProvider/ModalsContext.cjs +1 -0
- package/dist/components/ModalsProvider/ModalsContext.d.ts +2 -0
- package/dist/components/ModalsProvider/ModalsContext.js +5 -0
- package/dist/components/ModalsProvider/ModalsProvider.cjs +1 -0
- package/dist/components/ModalsProvider/ModalsProvider.const.cjs +1 -0
- package/dist/components/ModalsProvider/ModalsProvider.const.d.ts +39 -0
- package/dist/components/ModalsProvider/ModalsProvider.const.js +40 -0
- package/dist/components/ModalsProvider/ModalsProvider.d.ts +3 -0
- package/dist/components/ModalsProvider/ModalsProvider.js +97 -0
- package/dist/components/ModalsProvider/ModalsProvider.types.d.ts +75 -0
- package/dist/components/ModalsProvider/ModalsProvider.utils.cjs +1 -0
- package/dist/components/ModalsProvider/ModalsProvider.utils.d.ts +8 -0
- package/dist/components/ModalsProvider/ModalsProvider.utils.js +24 -0
- package/dist/components/ModalsProvider/components/ModalsHost/ModalsHost.cjs +1 -0
- package/dist/components/ModalsProvider/components/ModalsHost/ModalsHost.d.ts +2 -0
- package/dist/components/ModalsProvider/components/ModalsHost/ModalsHost.js +24 -0
- package/dist/components/ModalsProvider/components/ModalsHost/index.d.ts +1 -0
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.cjs +1 -0
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.d.ts +2 -0
- package/dist/components/ModalsProvider/components/StackedModal/StackedModal.js +66 -0
- package/dist/components/ModalsProvider/components/StackedModal/index.d.ts +1 -0
- package/dist/components/ModalsProvider/components/index.d.ts +2 -0
- package/dist/components/ModalsProvider/hooks/index.d.ts +1 -0
- package/dist/components/ModalsProvider/hooks/useModals.cjs +1 -0
- package/dist/components/ModalsProvider/hooks/useModals.d.ts +2 -0
- package/dist/components/ModalsProvider/hooks/useModals.js +12 -0
- package/dist/components/ModalsProvider/index.d.ts +3 -0
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.cjs +1 -1
- package/dist/components/SignPad/SignPad.const.d.ts +13 -2
- package/dist/components/SignPad/SignPad.const.js +22 -13
- package/dist/components/SignPad/SignPad.js +127 -121
- package/dist/components/SignPad/SignPad.types.d.ts +2 -1
- package/dist/components/SignPad/SignPad.utils.cjs +1 -0
- package/dist/components/SignPad/SignPad.utils.d.ts +34 -0
- package/dist/components/SignPad/SignPad.utils.js +42 -0
- package/dist/components/Snackbar/Snackbar.cjs +1 -1
- package/dist/components/Snackbar/Snackbar.const.cjs +1 -1
- package/dist/components/Snackbar/Snackbar.const.d.ts +7 -1
- package/dist/components/Snackbar/Snackbar.const.js +21 -11
- package/dist/components/Snackbar/Snackbar.js +60 -59
- package/dist/components/StatCard/StatCard.cjs +1 -1
- package/dist/components/StatCard/StatCard.const.cjs +1 -0
- package/dist/components/StatCard/StatCard.const.d.ts +11 -1
- package/dist/components/StatCard/StatCard.const.js +14 -0
- package/dist/components/StatCard/StatCard.d.ts +0 -4
- package/dist/components/StatCard/StatCard.js +44 -32
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +23 -11
- package/dist/components/Stepper/Stepper.const.js +60 -48
- package/dist/components/Stepper/Stepper.js +126 -118
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.const.cjs +1 -1
- package/dist/components/Toast/Toast.const.d.ts +4 -1
- package/dist/components/Toast/Toast.const.js +20 -5
- package/dist/components/Toast/Toast.js +97 -110
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +389 -385
- package/dist/index.cjs +1 -1
- package/dist/index.js +504 -500
- package/dist/styles/_feedback.css +130 -0
- package/dist/styles/_overlays.css +24 -0
- package/dist/styles/main.css +2 -0
- package/dist/styles.css +193 -25
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("react"),i=require("../../utils/cn.cjs"),x=require("../Button/Button.cjs"),e=require("./SignPad.const.cjs"),l=require("./SignPad.utils.cjs"),Q=Y=>{const{onChange:a,width:g,height:C=e.SIGN_PAD_DEFAULT_HEIGHT,strokeColor:y,strokeWidth:A=e.SIGN_PAD_DEFAULT_STROKE_WIDTH,backgroundColor:B,placeholder:U=e.SIGN_PAD_DEFAULT_PLACEHOLDER,disabled:c=!1,readOnly:_=!1,showClear:L=!0,showSave:k=!1,clearText:j="Clear",saveText:F="Save",outputFormat:E=e.SIGN_PAD_DEFAULT_OUTPUT_FORMAT,outputQuality:D=e.SIGN_PAD_DEFAULT_OUTPUT_QUALITY,className:H,testId:V,...Z}=Y,o=n.useRef(null),p=n.useRef(null),f=n.useRef(null),I=n.useRef(!1),S=n.useRef(!1),[d,h]=n.useState(!1),[b,q]=n.useState(!1);n.useEffect(()=>{const t=()=>{q(l.isDocumentDarkMode())};t();const r=new MutationObserver(t);return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]);const N=y||(b?e.SIGN_PAD_STROKE_DARK:e.SIGN_PAD_STROKE_LIGHT),v=B||(b?e.SIGN_PAD_BG_DARK:e.SIGN_PAD_BG_LIGHT),R=n.useCallback(()=>{const t=o.current;t&&l.fillCanvasBackground(t,v)},[v]);n.useEffect(()=>{const t=o.current,r=p.current;if(!t||!r)return;const s=()=>{const W=r.getBoundingClientRect(),M=g??Math.round(W.width),m=C;M<=e.SIGN_PAD_EMPTY_SIZE||m<=e.SIGN_PAD_EMPTY_SIZE||l.syncCanvasSize(t,M,m,v,S.current)};s();const P=new ResizeObserver(s);return P.observe(r),()=>P.disconnect()},[g,C,v]),n.useEffect(()=>{S.current||R()},[R,b]);const T=n.useCallback(t=>{const r=o.current;if(!r)return{x:e.SIGN_PAD_EMPTY_SIZE,y:e.SIGN_PAD_EMPTY_SIZE};const s=l.resolveDrawClientPoint(t);return s?l.getCanvasPoint(r,s.x,s.y):{x:e.SIGN_PAD_EMPTY_SIZE,y:e.SIGN_PAD_EMPTY_SIZE}},[]),O=n.useCallback(t=>{if(c||_)return;t.preventDefault();const r=o.current,s=T(t);I.current=!0,f.current=s,r&&(l.strokeCanvasDot(r,s,N,A),S.current=!0,h(!0))},[c,_,T,N,A]),w=n.useCallback(t=>{if(!I.current||c||_)return;t.preventDefault();const r=o.current,s=f.current;if(!r||!s)return;const P=T(t);l.strokeCanvasSegment(r,s,P,N,A),f.current=P,S.current=!0,h(!0)},[c,_,N,A,T]),G=n.useCallback(()=>{if(I.current){const t=o.current;if(t&&a){const r=t.toDataURL(E,D);a(r)}}I.current=!1,f.current=null},[a,E,D]),K=n.useCallback(()=>{const t=o.current,r=t==null?void 0:t.getContext("2d");!t||!r||(r.clearRect(e.SIGN_PAD_EMPTY_SIZE,e.SIGN_PAD_EMPTY_SIZE,t.width,t.height),R(),S.current=!1,h(!1),a==null||a(null))},[R,a]),z=n.useCallback(()=>{const t=o.current;if(!t||!d)return;const r=t.toDataURL(E,D);a==null||a(r)},[d,a,E,D]);return u.jsxs("div",{"data-testid":V,className:i.cn("Bear-SignPad bear-w-full",e.SIGN_PAD_ROOT_CLASSES,c&&"Bear-SignPad--disabled bear-opacity-50",_&&"Bear-SignPad--readonly",H),...Z,children:[u.jsxs("div",{ref:p,className:i.cn("Bear-SignPad__canvas-wrapper bear-w-full bear-overflow-hidden","bear-touch-none",e.SIGN_PAD_CANVAS_WRAPPER_CLASSES,!c&&!_&&e.SIGN_PAD_CANVAS_WRAPPER_HOVER,c&&"bear-cursor-not-allowed",!c&&!_&&"bear-cursor-crosshair"),onMouseDown:O,onMouseMove:w,onMouseUp:G,onMouseLeave:G,onTouchStart:O,onTouchMove:w,onTouchEnd:G,children:[u.jsx("canvas",{ref:o,className:"Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full bear-touch-none",style:{height:C}}),!d&&u.jsx("div",{className:i.cn("Bear-SignPad__placeholder",e.SIGN_PAD_PLACEHOLDER_CLASSES,e.SIGN_PAD_OVERLAY_POINTER_CLASS),style:e.SIGN_PAD_OVERLAY_STYLE,children:U}),u.jsx("div",{className:i.cn("Bear-SignPad__line",e.SIGN_PAD_LINE_CLASSES,e.SIGN_PAD_OVERLAY_POINTER_CLASS),style:e.SIGN_PAD_OVERLAY_STYLE}),u.jsx("span",{className:i.cn("Bear-SignPad__x-mark",e.SIGN_PAD_X_MARK_CLASSES,e.SIGN_PAD_OVERLAY_POINTER_CLASS),style:e.SIGN_PAD_OVERLAY_STYLE,children:"×"})]}),(L||k)&&u.jsxs("div",{className:i.cn("Bear-SignPad__actions",e.SIGN_PAD_ACTIONS_CLASSES),children:[L&&u.jsx(x.Button,{size:"sm",variant:"ghost",onClick:K,disabled:c||!d,children:j}),k&&u.jsx(x.Button,{size:"sm",variant:"primary",onClick:z,disabled:c||!d,children:F})]})]})};exports.SignPad=Q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=200,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=200,S=2,A="Sign here",e="image/png",r=.92,I="#1f2937",D="#f3f4f6",P="#ffffff",t="#18181b",E="bear-inline-flex bear-flex-col bear-gap-2",N="bear-relative bear-rounded-lg bear-border-2 bear-border-dashed bear-border-gray-300 dark:bear-border-zinc-600",a="hover:bear-border-primary-400 dark:hover:bear-border-primary-500",L="bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center bear-text-gray-400 dark:bear-text-zinc-500 bear-text-sm bear-pointer-events-none",b="bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600 bear-pointer-events-none",n="bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold bear-pointer-events-none",o="bear-flex bear-gap-2 bear-justify-end",G="bear-pointer-events-none",T="rgba(0,0,0,0)",R=0,s=1,O="dark",c="bear-dark",C={pointerEvents:"none"},U=2,d=Math.PI*2;exports.SIGN_PAD_ACTIONS_CLASSES=o;exports.SIGN_PAD_BEAR_DARK_CLASS=c;exports.SIGN_PAD_BG_DARK=t;exports.SIGN_PAD_BG_LIGHT=P;exports.SIGN_PAD_CANVAS_WRAPPER_CLASSES=N;exports.SIGN_PAD_CANVAS_WRAPPER_HOVER=a;exports.SIGN_PAD_DEFAULT_HEIGHT=_;exports.SIGN_PAD_DEFAULT_OUTPUT_FORMAT=e;exports.SIGN_PAD_DEFAULT_OUTPUT_QUALITY=r;exports.SIGN_PAD_DEFAULT_PLACEHOLDER=A;exports.SIGN_PAD_DEFAULT_STROKE_WIDTH=S;exports.SIGN_PAD_EMPTY_SIZE=R;exports.SIGN_PAD_FULL_CIRCLE_RADIANS=d;exports.SIGN_PAD_HTML_DARK_CLASS=O;exports.SIGN_PAD_LINE_CLASSES=b;exports.SIGN_PAD_OVERLAY_POINTER_CLASS=G;exports.SIGN_PAD_OVERLAY_STYLE=C;exports.SIGN_PAD_PLACEHOLDER_CLASSES=L;exports.SIGN_PAD_ROOT_CLASSES=E;exports.SIGN_PAD_STROKE_DARK=D;exports.SIGN_PAD_STROKE_LIGHT=I;exports.SIGN_PAD_STROKE_RADIUS_DIVISOR=U;exports.SIGN_PAD_TRANSPARENT_FILL=T;exports.SIGN_PAD_UNIT_SCALE=s;exports.SIGN_PAD_X_MARK_CLASSES=n;
|
|
@@ -14,6 +14,17 @@ export declare const SIGN_PAD_ROOT_CLASSES = "bear-inline-flex bear-flex-col bea
|
|
|
14
14
|
export declare const SIGN_PAD_CANVAS_WRAPPER_CLASSES = "bear-relative bear-rounded-lg bear-border-2 bear-border-dashed bear-border-gray-300 dark:bear-border-zinc-600";
|
|
15
15
|
export declare const SIGN_PAD_CANVAS_WRAPPER_HOVER = "hover:bear-border-primary-400 dark:hover:bear-border-primary-500";
|
|
16
16
|
export declare const SIGN_PAD_PLACEHOLDER_CLASSES = "bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center bear-text-gray-400 dark:bear-text-zinc-500 bear-text-sm bear-pointer-events-none";
|
|
17
|
-
export declare const SIGN_PAD_LINE_CLASSES = "bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600";
|
|
18
|
-
export declare const SIGN_PAD_X_MARK_CLASSES = "bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold";
|
|
17
|
+
export declare const SIGN_PAD_LINE_CLASSES = "bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600 bear-pointer-events-none";
|
|
18
|
+
export declare const SIGN_PAD_X_MARK_CLASSES = "bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold bear-pointer-events-none";
|
|
19
19
|
export declare const SIGN_PAD_ACTIONS_CLASSES = "bear-flex bear-gap-2 bear-justify-end";
|
|
20
|
+
export declare const SIGN_PAD_OVERLAY_POINTER_CLASS = "bear-pointer-events-none";
|
|
21
|
+
export declare const SIGN_PAD_TRANSPARENT_FILL = "rgba(0,0,0,0)";
|
|
22
|
+
export declare const SIGN_PAD_EMPTY_SIZE = 0;
|
|
23
|
+
export declare const SIGN_PAD_UNIT_SCALE = 1;
|
|
24
|
+
export declare const SIGN_PAD_HTML_DARK_CLASS = "dark";
|
|
25
|
+
export declare const SIGN_PAD_BEAR_DARK_CLASS = "bear-dark";
|
|
26
|
+
export declare const SIGN_PAD_OVERLAY_STYLE: {
|
|
27
|
+
pointerEvents: "none";
|
|
28
|
+
};
|
|
29
|
+
export declare const SIGN_PAD_STROKE_RADIUS_DIVISOR = 2;
|
|
30
|
+
export declare const SIGN_PAD_FULL_CIRCLE_RADIANS: number;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
const e = 200, r = 2,
|
|
1
|
+
const e = 200, r = 2, _ = "Sign here", t = "image/png", a = 0.92, A = "#1f2937", S = "#f3f4f6", b = "#ffffff", n = "#18181b", o = "bear-inline-flex bear-flex-col bear-gap-2", I = "bear-relative bear-rounded-lg bear-border-2 bear-border-dashed bear-border-gray-300 dark:bear-border-zinc-600", D = "hover:bear-border-primary-400 dark:hover:bear-border-primary-500", s = "bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center bear-text-gray-400 dark:bear-text-zinc-500 bear-text-sm bear-pointer-events-none", P = "bear-absolute bear-bottom-8 bear-left-4 bear-right-4 bear-border-b bear-border-gray-300 dark:bear-border-zinc-600 bear-pointer-events-none", E = "bear-absolute bear-bottom-6 bear-left-4 bear-text-gray-400 dark:bear-text-zinc-500 bear-text-lg bear-font-bold bear-pointer-events-none", N = "bear-flex bear-gap-2 bear-justify-end", c = "bear-pointer-events-none", L = "rgba(0,0,0,0)", G = 0, R = 1, T = "dark", d = "bear-dark", i = { pointerEvents: "none" }, f = 2, C = Math.PI * 2;
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
N as SIGN_PAD_ACTIONS_CLASSES,
|
|
4
|
+
d as SIGN_PAD_BEAR_DARK_CLASS,
|
|
5
|
+
n as SIGN_PAD_BG_DARK,
|
|
6
|
+
b as SIGN_PAD_BG_LIGHT,
|
|
7
|
+
I as SIGN_PAD_CANVAS_WRAPPER_CLASSES,
|
|
7
8
|
D as SIGN_PAD_CANVAS_WRAPPER_HOVER,
|
|
8
9
|
e as SIGN_PAD_DEFAULT_HEIGHT,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
t as SIGN_PAD_DEFAULT_OUTPUT_FORMAT,
|
|
11
|
+
a as SIGN_PAD_DEFAULT_OUTPUT_QUALITY,
|
|
12
|
+
_ as SIGN_PAD_DEFAULT_PLACEHOLDER,
|
|
12
13
|
r as SIGN_PAD_DEFAULT_STROKE_WIDTH,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
G as SIGN_PAD_EMPTY_SIZE,
|
|
15
|
+
C as SIGN_PAD_FULL_CIRCLE_RADIANS,
|
|
16
|
+
T as SIGN_PAD_HTML_DARK_CLASS,
|
|
17
|
+
P as SIGN_PAD_LINE_CLASSES,
|
|
18
|
+
c as SIGN_PAD_OVERLAY_POINTER_CLASS,
|
|
19
|
+
i as SIGN_PAD_OVERLAY_STYLE,
|
|
20
|
+
s as SIGN_PAD_PLACEHOLDER_CLASSES,
|
|
21
|
+
o as SIGN_PAD_ROOT_CLASSES,
|
|
22
|
+
S as SIGN_PAD_STROKE_DARK,
|
|
23
|
+
A as SIGN_PAD_STROKE_LIGHT,
|
|
24
|
+
f as SIGN_PAD_STROKE_RADIUS_DIVISOR,
|
|
25
|
+
L as SIGN_PAD_TRANSPARENT_FILL,
|
|
26
|
+
R as SIGN_PAD_UNIT_SCALE,
|
|
18
27
|
E as SIGN_PAD_X_MARK_CLASSES
|
|
19
28
|
};
|
|
@@ -1,159 +1,165 @@
|
|
|
1
|
-
import { jsxs as T, jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { SIGN_PAD_DEFAULT_HEIGHT as
|
|
6
|
-
|
|
1
|
+
import { jsxs as T, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f, useState as F, useEffect as b, useCallback as i } from "react";
|
|
3
|
+
import { cn as u } from "../../utils/cn.js";
|
|
4
|
+
import { Button as H } from "../Button/Button.js";
|
|
5
|
+
import { SIGN_PAD_DEFAULT_HEIGHT as re, SIGN_PAD_DEFAULT_STROKE_WIDTH as te, SIGN_PAD_DEFAULT_PLACEHOLDER as ne, SIGN_PAD_DEFAULT_OUTPUT_FORMAT as ae, SIGN_PAD_DEFAULT_OUTPUT_QUALITY as se, SIGN_PAD_BG_DARK as oe, SIGN_PAD_BG_LIGHT as ce, SIGN_PAD_EMPTY_SIZE as o, SIGN_PAD_STROKE_DARK as ie, SIGN_PAD_STROKE_LIGHT as le, SIGN_PAD_OVERLAY_STYLE as L, SIGN_PAD_OVERLAY_POINTER_CLASS as G, SIGN_PAD_PLACEHOLDER_CLASSES as ue, SIGN_PAD_LINE_CLASSES as _e, SIGN_PAD_X_MARK_CLASSES as de, SIGN_PAD_CANVAS_WRAPPER_HOVER as Se, SIGN_PAD_CANVAS_WRAPPER_CLASSES as fe, SIGN_PAD_ACTIONS_CLASSES as Ae, SIGN_PAD_ROOT_CLASSES as Pe } from "./SignPad.const.js";
|
|
6
|
+
import { fillCanvasBackground as De, resolveDrawClientPoint as ve, getCanvasPoint as he, strokeCanvasDot as Ee, strokeCanvasSegment as Ne, isDocumentDarkMode as me, syncCanvasSize as pe } from "./SignPad.utils.js";
|
|
7
|
+
const Le = (K) => {
|
|
7
8
|
const {
|
|
8
|
-
onChange:
|
|
9
|
+
onChange: n,
|
|
9
10
|
width: w,
|
|
10
|
-
height:
|
|
11
|
-
strokeColor:
|
|
12
|
-
strokeWidth:
|
|
13
|
-
backgroundColor:
|
|
14
|
-
placeholder:
|
|
15
|
-
disabled:
|
|
16
|
-
readOnly:
|
|
17
|
-
showClear:
|
|
18
|
-
showSave:
|
|
11
|
+
height: C = re,
|
|
12
|
+
strokeColor: z,
|
|
13
|
+
strokeWidth: A = te,
|
|
14
|
+
backgroundColor: V,
|
|
15
|
+
placeholder: Y = ne,
|
|
16
|
+
disabled: a = !1,
|
|
17
|
+
readOnly: c = !1,
|
|
18
|
+
showClear: k = !0,
|
|
19
|
+
showSave: O = !1,
|
|
19
20
|
clearText: W = "Clear",
|
|
20
|
-
saveText:
|
|
21
|
-
outputFormat:
|
|
22
|
-
outputQuality:
|
|
23
|
-
className:
|
|
24
|
-
testId:
|
|
25
|
-
...
|
|
26
|
-
} =
|
|
27
|
-
|
|
21
|
+
saveText: j = "Save",
|
|
22
|
+
outputFormat: P = ae,
|
|
23
|
+
outputQuality: D = se,
|
|
24
|
+
className: Q,
|
|
25
|
+
testId: X,
|
|
26
|
+
...Z
|
|
27
|
+
} = K, s = f(null), M = f(null), v = f(null), h = f(!1), _ = f(!1), [d, I] = F(!1), [g, q] = F(!1);
|
|
28
|
+
b(() => {
|
|
28
29
|
const e = () => {
|
|
29
|
-
|
|
30
|
+
q(me());
|
|
30
31
|
};
|
|
31
32
|
e();
|
|
32
|
-
const
|
|
33
|
-
return
|
|
33
|
+
const r = new MutationObserver(e);
|
|
34
|
+
return r.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => r.disconnect();
|
|
34
35
|
}, []);
|
|
35
|
-
const
|
|
36
|
-
const e =
|
|
37
|
-
|
|
38
|
-
}, [
|
|
39
|
-
|
|
40
|
-
const e =
|
|
41
|
-
if (!e || !
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
36
|
+
const E = z || (g ? ie : le), N = V || (g ? oe : ce), m = i(() => {
|
|
37
|
+
const e = s.current;
|
|
38
|
+
e && De(e, N);
|
|
39
|
+
}, [N]);
|
|
40
|
+
b(() => {
|
|
41
|
+
const e = s.current, r = M.current;
|
|
42
|
+
if (!e || !r) return;
|
|
43
|
+
const t = () => {
|
|
44
|
+
const ee = r.getBoundingClientRect(), U = w ?? Math.round(ee.width), x = C;
|
|
45
|
+
U <= o || x <= o || pe(e, U, x, N, _.current);
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
}, [w,
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (n || s) return;
|
|
76
|
-
const t = g(e);
|
|
77
|
-
P.current = !0, A.current = t;
|
|
78
|
-
}, [n, s, g]), O = l((e) => {
|
|
79
|
-
if (!P.current || n || s) return;
|
|
80
|
-
const t = a.current, r = t == null ? void 0 : t.getContext("2d"), c = A.current;
|
|
81
|
-
if (!t || !r || !c) return;
|
|
82
|
-
const i = g(e);
|
|
83
|
-
r.beginPath(), r.moveTo(c.x, c.y), r.lineTo(i.x, i.y), r.strokeStyle = k, r.lineWidth = C, r.lineCap = "round", r.lineJoin = "round", r.stroke(), A.current = i, G(!0);
|
|
84
|
-
}, [n, s, k, C, g]), N = l(() => {
|
|
85
|
-
if (P.current) {
|
|
86
|
-
const e = a.current;
|
|
87
|
-
if (e && o) {
|
|
88
|
-
const t = e.toDataURL(f, v);
|
|
89
|
-
o(t);
|
|
47
|
+
t();
|
|
48
|
+
const S = new ResizeObserver(t);
|
|
49
|
+
return S.observe(r), () => S.disconnect();
|
|
50
|
+
}, [w, C, N]), b(() => {
|
|
51
|
+
_.current || m();
|
|
52
|
+
}, [m, g]);
|
|
53
|
+
const p = i((e) => {
|
|
54
|
+
const r = s.current;
|
|
55
|
+
if (!r) return { x: o, y: o };
|
|
56
|
+
const t = ve(e);
|
|
57
|
+
return t ? he(r, t.x, t.y) : { x: o, y: o };
|
|
58
|
+
}, []), y = i((e) => {
|
|
59
|
+
if (a || c) return;
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
const r = s.current, t = p(e);
|
|
62
|
+
h.current = !0, v.current = t, r && (Ee(r, t, E, A), _.current = !0, I(!0));
|
|
63
|
+
}, [a, c, p, E, A]), B = i((e) => {
|
|
64
|
+
if (!h.current || a || c) return;
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
const r = s.current, t = v.current;
|
|
67
|
+
if (!r || !t) return;
|
|
68
|
+
const S = p(e);
|
|
69
|
+
Ne(r, t, S, E, A), v.current = S, _.current = !0, I(!0);
|
|
70
|
+
}, [a, c, E, A, p]), R = i(() => {
|
|
71
|
+
if (h.current) {
|
|
72
|
+
const e = s.current;
|
|
73
|
+
if (e && n) {
|
|
74
|
+
const r = e.toDataURL(P, D);
|
|
75
|
+
n(r);
|
|
90
76
|
}
|
|
91
77
|
}
|
|
92
|
-
|
|
93
|
-
}, [
|
|
94
|
-
const e =
|
|
95
|
-
!e || !
|
|
96
|
-
}, [
|
|
97
|
-
const e =
|
|
98
|
-
if (!e || !
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
}, [
|
|
78
|
+
h.current = !1, v.current = null;
|
|
79
|
+
}, [n, P, D]), J = i(() => {
|
|
80
|
+
const e = s.current, r = e == null ? void 0 : e.getContext("2d");
|
|
81
|
+
!e || !r || (r.clearRect(o, o, e.width, e.height), m(), _.current = !1, I(!1), n == null || n(null));
|
|
82
|
+
}, [m, n]), $ = i(() => {
|
|
83
|
+
const e = s.current;
|
|
84
|
+
if (!e || !d) return;
|
|
85
|
+
const r = e.toDataURL(P, D);
|
|
86
|
+
n == null || n(r);
|
|
87
|
+
}, [d, n, P, D]);
|
|
102
88
|
return /* @__PURE__ */ T(
|
|
103
89
|
"div",
|
|
104
90
|
{
|
|
105
|
-
"data-testid":
|
|
106
|
-
className:
|
|
91
|
+
"data-testid": X,
|
|
92
|
+
className: u(
|
|
107
93
|
"Bear-SignPad bear-w-full",
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
Pe,
|
|
95
|
+
a && "Bear-SignPad--disabled bear-opacity-50",
|
|
96
|
+
c && "Bear-SignPad--readonly",
|
|
97
|
+
Q
|
|
112
98
|
),
|
|
113
|
-
...
|
|
99
|
+
...Z,
|
|
114
100
|
children: [
|
|
115
101
|
/* @__PURE__ */ T(
|
|
116
102
|
"div",
|
|
117
103
|
{
|
|
118
|
-
ref:
|
|
119
|
-
className:
|
|
104
|
+
ref: M,
|
|
105
|
+
className: u(
|
|
120
106
|
"Bear-SignPad__canvas-wrapper bear-w-full bear-overflow-hidden",
|
|
121
107
|
"bear-touch-none",
|
|
122
|
-
|
|
123
|
-
!
|
|
124
|
-
|
|
125
|
-
!
|
|
108
|
+
fe,
|
|
109
|
+
!a && !c && Se,
|
|
110
|
+
a && "bear-cursor-not-allowed",
|
|
111
|
+
!a && !c && "bear-cursor-crosshair"
|
|
126
112
|
),
|
|
113
|
+
onMouseDown: y,
|
|
114
|
+
onMouseMove: B,
|
|
115
|
+
onMouseUp: R,
|
|
116
|
+
onMouseLeave: R,
|
|
117
|
+
onTouchStart: y,
|
|
118
|
+
onTouchMove: B,
|
|
119
|
+
onTouchEnd: R,
|
|
127
120
|
children: [
|
|
128
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ l(
|
|
129
122
|
"canvas",
|
|
130
123
|
{
|
|
131
|
-
ref:
|
|
124
|
+
ref: s,
|
|
132
125
|
className: "Bear-SignPad__canvas bear-block bear-rounded-lg bear-w-full bear-touch-none",
|
|
133
|
-
style: { height:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
126
|
+
style: { height: C }
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
!d && /* @__PURE__ */ l(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: u("Bear-SignPad__placeholder", ue, G),
|
|
133
|
+
style: L,
|
|
134
|
+
children: Y
|
|
141
135
|
}
|
|
142
136
|
),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
/* @__PURE__ */ l(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: u("Bear-SignPad__line", _e, G),
|
|
141
|
+
style: L
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ l(
|
|
145
|
+
"span",
|
|
146
|
+
{
|
|
147
|
+
className: u("Bear-SignPad__x-mark", de, G),
|
|
148
|
+
style: L,
|
|
149
|
+
children: "×"
|
|
150
|
+
}
|
|
151
|
+
)
|
|
146
152
|
]
|
|
147
153
|
}
|
|
148
154
|
),
|
|
149
|
-
(
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
(k || O) && /* @__PURE__ */ T("div", { className: u("Bear-SignPad__actions", Ae), children: [
|
|
156
|
+
k && /* @__PURE__ */ l(H, { size: "sm", variant: "ghost", onClick: J, disabled: a || !d, children: W }),
|
|
157
|
+
O && /* @__PURE__ */ l(H, { size: "sm", variant: "primary", onClick: $, disabled: a || !d, children: j })
|
|
152
158
|
] })
|
|
153
159
|
]
|
|
154
160
|
}
|
|
155
161
|
);
|
|
156
162
|
};
|
|
157
163
|
export {
|
|
158
|
-
|
|
164
|
+
Le as SignPad
|
|
159
165
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
1
|
+
import { HTMLAttributes, MouseEvent, TouchEvent } from 'react';
|
|
2
|
+
export type SignPadDrawEvent = MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>;
|
|
2
3
|
export interface SignPadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
3
4
|
/** Callback when signature changes - receives base64 image data */
|
|
4
5
|
onChange?: (signature: string | null) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./SignPad.const.cjs"),c=t=>t==="transparent"?e.SIGN_PAD_TRANSPARENT_FILL:t,I=(t,i)=>{const n=t.getContext("2d");n&&(n.fillStyle=c(i),n.fillRect(e.SIGN_PAD_EMPTY_SIZE,e.SIGN_PAD_EMPTY_SIZE,t.width,t.height))},P=(t,i,n,_,s)=>{var l,r;if(t.width===i&&t.height===n)return;const o=s&&t.width>e.SIGN_PAD_EMPTY_SIZE&&t.height>e.SIGN_PAD_EMPTY_SIZE,S=document.createElement("canvas");o&&(S.width=t.width,S.height=t.height,(l=S.getContext("2d"))==null||l.drawImage(t,e.SIGN_PAD_EMPTY_SIZE,e.SIGN_PAD_EMPTY_SIZE)),t.width=i,t.height=n,I(t,_),o&&((r=t.getContext("2d"))==null||r.drawImage(S,e.SIGN_PAD_EMPTY_SIZE,e.SIGN_PAD_EMPTY_SIZE,i,n))},h=(t,i,n)=>{const _=t.getBoundingClientRect(),s=_.width===e.SIGN_PAD_EMPTY_SIZE?e.SIGN_PAD_UNIT_SCALE:t.width/_.width,o=_.height===e.SIGN_PAD_EMPTY_SIZE?e.SIGN_PAD_UNIT_SCALE:t.height/_.height;return{x:(i-_.left)*s,y:(n-_.top)*o}},u=(t,i,n,_,s)=>{const o=t.getContext("2d");o&&(o.beginPath(),o.moveTo(i.x,i.y),o.lineTo(n.x,n.y),o.strokeStyle=_,o.lineWidth=s,o.lineCap="round",o.lineJoin="round",o.stroke())},E=(t,i,n,_)=>{const s=t.getContext("2d");s&&(s.beginPath(),s.fillStyle=n,s.arc(i.x,i.y,_/e.SIGN_PAD_STROKE_RADIUS_DIVISOR,e.SIGN_PAD_EMPTY_SIZE,e.SIGN_PAD_FULL_CIRCLE_RADIANS),s.fill())},D=t=>t.touches&&t.touches.length>e.SIGN_PAD_EMPTY_SIZE?{x:t.touches[0].clientX,y:t.touches[0].clientY}:t.changedTouches&&t.changedTouches.length>e.SIGN_PAD_EMPTY_SIZE?{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}:typeof t.clientX=="number"&&typeof t.clientY=="number"?{x:t.clientX,y:t.clientY}:null,d=()=>{const t=document.documentElement.classList;return t.contains(e.SIGN_PAD_HTML_DARK_CLASS)||t.contains(e.SIGN_PAD_BEAR_DARK_CLASS)};exports.fillCanvasBackground=I;exports.getCanvasPoint=h;exports.isDocumentDarkMode=d;exports.resolveCanvasFill=c;exports.resolveDrawClientPoint=D;exports.strokeCanvasDot=E;exports.strokeCanvasSegment=u;exports.syncCanvasSize=P;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const resolveCanvasFill: (backgroundColor: string) => string;
|
|
2
|
+
export declare const fillCanvasBackground: (canvas: HTMLCanvasElement, backgroundColor: string) => void;
|
|
3
|
+
export declare const syncCanvasSize: (canvas: HTMLCanvasElement, width: number, height: number, backgroundColor: string, preserve: boolean) => void;
|
|
4
|
+
export declare const getCanvasPoint: (canvas: HTMLCanvasElement, clientX: number, clientY: number) => {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const strokeCanvasSegment: (canvas: HTMLCanvasElement, from: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}, to: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}, strokeColor: string, strokeWidth: number) => void;
|
|
15
|
+
export declare const strokeCanvasDot: (canvas: HTMLCanvasElement, point: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}, strokeColor: string, strokeWidth: number) => void;
|
|
19
|
+
export declare const resolveDrawClientPoint: (event: {
|
|
20
|
+
clientX?: number;
|
|
21
|
+
clientY?: number;
|
|
22
|
+
touches?: ArrayLike<{
|
|
23
|
+
clientX: number;
|
|
24
|
+
clientY: number;
|
|
25
|
+
}>;
|
|
26
|
+
changedTouches?: ArrayLike<{
|
|
27
|
+
clientX: number;
|
|
28
|
+
clientY: number;
|
|
29
|
+
}>;
|
|
30
|
+
}) => {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
} | null;
|
|
34
|
+
export declare const isDocumentDarkMode: () => boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SIGN_PAD_EMPTY_SIZE as o, SIGN_PAD_UNIT_SCALE as u, SIGN_PAD_STROKE_RADIUS_DIVISOR as d, SIGN_PAD_FULL_CIRCLE_RADIANS as g, SIGN_PAD_HTML_DARK_CLASS as _, SIGN_PAD_BEAR_DARK_CLASS as S, SIGN_PAD_TRANSPARENT_FILL as A } from "./SignPad.const.js";
|
|
2
|
+
const C = (t) => t === "transparent" ? A : t, f = (t, i) => {
|
|
3
|
+
const e = t.getContext("2d");
|
|
4
|
+
e && (e.fillStyle = C(i), e.fillRect(o, o, t.width, t.height));
|
|
5
|
+
}, x = (t, i, e, c, l) => {
|
|
6
|
+
var s, h;
|
|
7
|
+
if (t.width === i && t.height === e)
|
|
8
|
+
return;
|
|
9
|
+
const n = l && t.width > o && t.height > o, r = document.createElement("canvas");
|
|
10
|
+
n && (r.width = t.width, r.height = t.height, (s = r.getContext("2d")) == null || s.drawImage(t, o, o)), t.width = i, t.height = e, f(t, c), n && ((h = t.getContext("2d")) == null || h.drawImage(r, o, o, i, e));
|
|
11
|
+
}, D = (t, i, e) => {
|
|
12
|
+
const c = t.getBoundingClientRect(), l = c.width === o ? u : t.width / c.width, n = c.height === o ? u : t.height / c.height;
|
|
13
|
+
return {
|
|
14
|
+
x: (i - c.left) * l,
|
|
15
|
+
y: (e - c.top) * n
|
|
16
|
+
};
|
|
17
|
+
}, P = (t, i, e, c, l) => {
|
|
18
|
+
const n = t.getContext("2d");
|
|
19
|
+
n && (n.beginPath(), n.moveTo(i.x, i.y), n.lineTo(e.x, e.y), n.strokeStyle = c, n.lineWidth = l, n.lineCap = "round", n.lineJoin = "round", n.stroke());
|
|
20
|
+
}, m = (t, i, e, c) => {
|
|
21
|
+
const l = t.getContext("2d");
|
|
22
|
+
l && (l.beginPath(), l.fillStyle = e, l.arc(
|
|
23
|
+
i.x,
|
|
24
|
+
i.y,
|
|
25
|
+
c / d,
|
|
26
|
+
o,
|
|
27
|
+
g
|
|
28
|
+
), l.fill());
|
|
29
|
+
}, y = (t) => t.touches && t.touches.length > o ? { x: t.touches[0].clientX, y: t.touches[0].clientY } : t.changedTouches && t.changedTouches.length > o ? { x: t.changedTouches[0].clientX, y: t.changedTouches[0].clientY } : typeof t.clientX == "number" && typeof t.clientY == "number" ? { x: t.clientX, y: t.clientY } : null, R = () => {
|
|
30
|
+
const t = document.documentElement.classList;
|
|
31
|
+
return t.contains(_) || t.contains(S);
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
f as fillCanvasBackground,
|
|
35
|
+
D as getCanvasPoint,
|
|
36
|
+
R as isDocumentDarkMode,
|
|
37
|
+
C as resolveCanvasFill,
|
|
38
|
+
y as resolveDrawClientPoint,
|
|
39
|
+
m as strokeCanvasDot,
|
|
40
|
+
P as strokeCanvasSegment,
|
|
41
|
+
x as syncCanvasSize
|
|
42
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),j=require("react-dom"),L=require("../../utils/cn.cjs");require("react");const w=require("../../utils/generateBearId.utils.cjs"),z=require("../../utils/useBearId.cjs"),U=require("../../utils/liveRegion.utils.cjs"),X=require("../Paper/Paper.cjs"),u=require("../Flex/Flex.cjs"),C=require("../Typography/Typography.cjs"),M=require("../Progress/Progress.cjs"),Z=require("../CloseButton/CloseButton.cjs"),r=require("./Snackbar.const.cjs"),G=require("./hooks/useSnackbar.cjs"),H=(i,o,a,t)=>{const e={zIndex:r.SNACKBAR_Z_INDEX};return i==="top"?e.top=t:e.bottom=t,o==="left"?(e.left=a,e.right="auto"):o==="right"?(e.right=a,e.left="auto"):(e.left="50%",e.right="auto",e.transform="translateX(-50%)"),e},V=i=>{const{open:o,message:a,description:t,severity:e="default",action:d,autoHideDuration:p=r.SNACKBAR_DEFAULT_AUTO_HIDE_MS,onClose:c,anchorOrigin:_={vertical:"bottom",horizontal:"center"},offsetX:N=r.SNACKBAR_DEFAULT_OFFSET_X,offsetY:R=r.SNACKBAR_DEFAULT_OFFSET_Y,size:f="md",progress:h=null,progressPosition:S="bottom",progressColor:x="default",countdownProgress:k=!1,showCloseButton:O,closeOnClickOutside:I,container:E,id:y,testId:D,className:v}=i,P=z.useBearId("Snackbar"),q=w.resolveBearId(y,P),g=E??(typeof document<"u"?document.body:null),n=!!c,F=O??n,b=I??n,{surfaceRef:K,progressValue:A}=G.useSnackbar({open:o,autoHideDuration:p,onClose:c,countdownProgress:k,staticProgress:h,closeOnClickOutside:b});if(!o||!g)return null;const m=U.getBearLiveRegionProps(e),l=typeof A=="number",B=l?s.jsx(M.Progress,{value:A,size:"sm",color:x,className:"Bear-Snackbar__progress"}):null,T=s.jsxs(s.Fragment,{children:[b&&n&&s.jsx("div",{className:"Bear-Snackbar__backdrop bear-fixed bear-inset-0",style:{zIndex:r.SNACKBAR_BACKDROP_Z_INDEX},"aria-hidden":!0}),s.jsxs(X.Paper,{ref:K,id:q,"data-testid":D,role:m.role,"aria-live":m["aria-live"],elevation:4,rounded:"lg",padding:"none",background:r.SNACKBAR_PAPER_BACKGROUND,className:L.cn(r.SNACKBAR_ROOT_CLASS,r.SNACKBAR_SEVERITY_MODIFIER[e],r.SNACKBAR_SURFACE_CLASSES,r.SNACKBAR_BORDER_CLASSES,"bear-fixed bear-flex bear-flex-col bear-overflow-hidden",r.SNACKBAR_SIZE_PADDING[f],v),style:H(_.vertical,_.horizontal,N,R),children:[l&&S==="top"&&B,s.jsxs(u.Flex,{className:"Bear-Snackbar__content bear-w-full",align:"center",gap:3,children:[s.jsxs(u.Flex,{direction:"column",className:"Bear-Snackbar__text bear-flex-1 bear-min-w-0",gap:1,children:[a&&s.jsx(C.Typography,{variant:"body2",className:"Bear-Snackbar__message",children:a}),t&&s.jsx(C.Typography,{variant:"caption",color:r.SNACKBAR_DESCRIPTION_COLOR,className:"Bear-Snackbar__description",children:t})]}),d&&s.jsx(u.Flex,{className:"Bear-Snackbar__action bear-shrink-0",align:"center",children:d}),F&&n&&s.jsx(Z.CloseButton,{size:"sm",onClick:c,"aria-label":"Dismiss notification",className:"Bear-Snackbar__close bear-shrink-0"})]}),l&&S==="bottom"&&B]})]});return j.createPortal(T,g)};exports.Snackbar=V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A="Bear-Snackbar",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A="Bear-Snackbar",S=6e3,_=24,R=24,C=1400,N=1399,E={sm:"bear-px-3 bear-py-2",md:"bear-px-4 bear-py-3",lg:"bear-px-5 bear-py-4"},B="default",K="bear-shadow-xl",O="bear-border",D={default:`${A}--default`,success:`${A}--success`,info:`${A}--info`,warning:`${A}--warning`,error:`${A}--error`},e="secondary",o=50,s=100,n=0;exports.SNACKBAR_BACKDROP_Z_INDEX=N;exports.SNACKBAR_BORDER_CLASSES=O;exports.SNACKBAR_COUNTDOWN_TICK_MS=o;exports.SNACKBAR_DEFAULT_AUTO_HIDE_MS=S;exports.SNACKBAR_DEFAULT_OFFSET_X=_;exports.SNACKBAR_DEFAULT_OFFSET_Y=R;exports.SNACKBAR_DESCRIPTION_COLOR=e;exports.SNACKBAR_PAPER_BACKGROUND=B;exports.SNACKBAR_PROGRESS_MAX=s;exports.SNACKBAR_PROGRESS_MIN=n;exports.SNACKBAR_ROOT_CLASS=A;exports.SNACKBAR_SEVERITY_MODIFIER=D;exports.SNACKBAR_SIZE_PADDING=E;exports.SNACKBAR_SURFACE_CLASSES=K;exports.SNACKBAR_Z_INDEX=C;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SnackbarSeverity } from './Snackbar.types';
|
|
2
|
+
import { TypographyProps } from '../Typography/Typography.types';
|
|
1
3
|
export declare const SNACKBAR_ROOT_CLASS = "Bear-Snackbar";
|
|
2
4
|
export declare const SNACKBAR_DEFAULT_AUTO_HIDE_MS = 6000;
|
|
3
5
|
export declare const SNACKBAR_DEFAULT_OFFSET_X = 24;
|
|
@@ -7,7 +9,11 @@ export declare const SNACKBAR_BACKDROP_Z_INDEX = 1399;
|
|
|
7
9
|
export declare const SNACKBAR_ENTER_MS = 200;
|
|
8
10
|
export declare const SNACKBAR_EXIT_MS = 150;
|
|
9
11
|
export declare const SNACKBAR_SIZE_PADDING: Record<'sm' | 'md' | 'lg', string>;
|
|
10
|
-
export declare const
|
|
12
|
+
export declare const SNACKBAR_PAPER_BACKGROUND = "default";
|
|
13
|
+
export declare const SNACKBAR_SURFACE_CLASSES = "bear-shadow-xl";
|
|
14
|
+
export declare const SNACKBAR_BORDER_CLASSES = "bear-border";
|
|
15
|
+
export declare const SNACKBAR_SEVERITY_MODIFIER: Record<SnackbarSeverity, string>;
|
|
16
|
+
export declare const SNACKBAR_DESCRIPTION_COLOR: NonNullable<TypographyProps['color']>;
|
|
11
17
|
export declare const SNACKBAR_COUNTDOWN_TICK_MS = 50;
|
|
12
18
|
export declare const SNACKBAR_PROGRESS_MAX = 100;
|
|
13
19
|
export declare const SNACKBAR_PROGRESS_MIN = 0;
|
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
const A = "Bear-Snackbar",
|
|
1
|
+
const A = "Bear-Snackbar", S = 6e3, _ = 24, R = 24, C = 1400, s = 1399, n = {
|
|
2
2
|
sm: "bear-px-3 bear-py-2",
|
|
3
3
|
md: "bear-px-4 bear-py-3",
|
|
4
4
|
lg: "bear-px-5 bear-py-4"
|
|
5
|
-
},
|
|
5
|
+
}, o = "default", N = "bear-shadow-xl", r = "bear-border", c = {
|
|
6
|
+
default: `${A}--default`,
|
|
7
|
+
success: `${A}--success`,
|
|
8
|
+
info: `${A}--info`,
|
|
9
|
+
warning: `${A}--warning`,
|
|
10
|
+
error: `${A}--error`
|
|
11
|
+
}, e = "secondary", E = 50, t = 100, B = 0;
|
|
6
12
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
S as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
s as SNACKBAR_BACKDROP_Z_INDEX,
|
|
14
|
+
r as SNACKBAR_BORDER_CLASSES,
|
|
15
|
+
E as SNACKBAR_COUNTDOWN_TICK_MS,
|
|
16
|
+
S as SNACKBAR_DEFAULT_AUTO_HIDE_MS,
|
|
17
|
+
_ as SNACKBAR_DEFAULT_OFFSET_X,
|
|
18
|
+
R as SNACKBAR_DEFAULT_OFFSET_Y,
|
|
19
|
+
e as SNACKBAR_DESCRIPTION_COLOR,
|
|
20
|
+
o as SNACKBAR_PAPER_BACKGROUND,
|
|
21
|
+
t as SNACKBAR_PROGRESS_MAX,
|
|
22
|
+
B as SNACKBAR_PROGRESS_MIN,
|
|
14
23
|
A as SNACKBAR_ROOT_CLASS,
|
|
15
|
-
|
|
24
|
+
c as SNACKBAR_SEVERITY_MODIFIER,
|
|
25
|
+
n as SNACKBAR_SIZE_PADDING,
|
|
16
26
|
N as SNACKBAR_SURFACE_CLASSES,
|
|
17
|
-
|
|
27
|
+
C as SNACKBAR_Z_INDEX
|
|
18
28
|
};
|