@forgedevstack/bear 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -0
- package/dist/components/AlertDialog/AlertDialog.const.cjs +1 -0
- package/dist/components/AlertDialog/AlertDialog.const.d.ts +5 -0
- package/dist/components/AlertDialog/AlertDialog.const.js +8 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +4 -0
- package/dist/components/AlertDialog/AlertDialog.js +107 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +34 -0
- package/dist/components/AlertDialog/index.d.ts +3 -0
- package/dist/components/AspectRatio/AspectRatio.cjs +1 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +3 -0
- package/dist/components/AspectRatio/AspectRatio.js +29 -0
- package/dist/components/AspectRatio/AspectRatio.types.d.ts +9 -0
- package/dist/components/AspectRatio/index.d.ts +2 -0
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +2 -2
- package/dist/components/Button/Button.constants.d.ts +1 -0
- package/dist/components/Button/Button.constants.js +10 -3
- package/dist/components/Button/Button.js +92 -84
- package/dist/components/Button/Button.types.d.ts +2 -0
- package/dist/components/FormField/FormField.cjs +1 -0
- package/dist/components/FormField/FormField.const.cjs +1 -0
- package/dist/components/FormField/FormField.const.d.ts +20 -0
- package/dist/components/FormField/FormField.const.js +23 -0
- package/dist/components/FormField/FormField.d.ts +3 -0
- package/dist/components/FormField/FormField.js +127 -0
- package/dist/components/FormField/FormField.types.d.ts +23 -0
- package/dist/components/FormField/index.d.ts +2 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +81 -44
- package/dist/components/Input/Input.types.d.ts +10 -0
- package/dist/components/Input/components/ClearIcon/ClearIcon.cjs +1 -0
- package/dist/components/Input/components/ClearIcon/ClearIcon.d.ts +7 -0
- package/dist/components/Input/components/ClearIcon/ClearIcon.js +25 -0
- package/dist/components/Input/components/ClearIcon/index.d.ts +1 -0
- package/dist/components/InputGroup/InputGroup.cjs +1 -0
- package/dist/components/InputGroup/InputGroup.d.ts +4 -0
- package/dist/components/InputGroup/InputGroup.js +63 -0
- package/dist/components/InputGroup/InputGroup.types.d.ts +23 -0
- package/dist/components/InputGroup/index.d.ts +2 -0
- package/dist/components/PasswordInput/PasswordInput.cjs +1 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/components/PasswordInput/PasswordInput.js +61 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +18 -0
- package/dist/components/PasswordInput/index.d.ts +2 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.cjs +1 -1
- package/dist/components/ResizableTextarea/ResizableTextarea.js +90 -54
- package/dist/components/ResizableTextarea/ResizableTextarea.types.d.ts +10 -0
- package/dist/components/RichEditor/RichEditor.cjs +1 -1
- package/dist/components/RichEditor/RichEditor.js +186 -169
- package/dist/components/RichEditor/RichEditor.types.d.ts +4 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +44 -34
- package/dist/index.cjs +1 -1
- package/dist/index.js +126 -116
- package/dist/styles.css +1 -1
- package/dist/types/component.types.d.ts +13 -0
- package/package.json +1 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),v=require("react-dom"),a=require("../../utils/cn.cjs"),u=require("../Button/Button.cjs"),_=require("../Typography/Typography.cjs"),t=require("./AlertDialog.const.cjs"),C=b=>{const{isOpen:o,onClose:i,onConfirm:A,title:g,description:l,confirmText:m="Confirm",cancelText:y="Cancel",confirmVariant:f="danger",loading:r=!1,loadingText:E,closeOnBackdrop:p=!1,closeOnEscape:s=!0,icon:n,className:x,testId:D}=b,c=d.useCallback(S=>{s&&S.key==="Escape"&&!r&&i()},[s,i,r]);if(d.useEffect(()=>(o&&(document.addEventListener("keydown",c),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=""}),[o,c]),!o)return null;const L=e.jsxs("div",{className:"Bear-AlertDialog bear-fixed bear-inset-0 bear-z-50 bear-flex bear-items-center bear-justify-center bear-p-4","data-testid":D,children:[e.jsx("div",{className:a.cn("Bear-AlertDialog__backdrop",t.ALERT_DIALOG_BACKDROP_CLASSES),onClick:p&&!r?i:void 0,"aria-hidden":"true"}),e.jsxs("div",{role:"alertdialog","aria-modal":"true","aria-labelledby":"alert-dialog-title","aria-describedby":l?"alert-dialog-description":void 0,className:a.cn("Bear-AlertDialog__container",t.ALERT_DIALOG_CONTAINER_CLASSES,"bear-p-6",x),children:[n&&e.jsx("div",{className:"Bear-AlertDialog__icon bear-mb-4 bear-flex bear-justify-center",children:n}),e.jsx(_.Typography,{variant:"h6",id:"alert-dialog-title",className:a.cn("Bear-AlertDialog__title",t.ALERT_DIALOG_TITLE_CLASSES,n&&"bear-text-center"),children:g}),l&&e.jsx(_.Typography,{variant:"body2",id:"alert-dialog-description",className:a.cn("Bear-AlertDialog__description",t.ALERT_DIALOG_DESCRIPTION_CLASSES,n&&"bear-text-center"),children:l}),e.jsxs("div",{className:a.cn("Bear-AlertDialog__footer",t.ALERT_DIALOG_FOOTER_CLASSES),children:[e.jsx(u.Button,{variant:"ghost",onClick:i,disabled:r,children:y}),e.jsx(u.Button,{variant:f,onClick:A,loading:r,loadingText:E,children:m})]})]})]});return v.createPortal(L,document.body)};exports.AlertDialog=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",r="bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all bear-animate-in bear-fade-in bear-zoom-in-95",a="bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white",b="bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2",t="bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";exports.ALERT_DIALOG_BACKDROP_CLASSES=e;exports.ALERT_DIALOG_CONTAINER_CLASSES=r;exports.ALERT_DIALOG_DESCRIPTION_CLASSES=b;exports.ALERT_DIALOG_FOOTER_CLASSES=t;exports.ALERT_DIALOG_TITLE_CLASSES=a;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ALERT_DIALOG_BACKDROP_CLASSES = "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity";
|
|
2
|
+
export declare const ALERT_DIALOG_CONTAINER_CLASSES = "bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all bear-animate-in bear-fade-in bear-zoom-in-95";
|
|
3
|
+
export declare const ALERT_DIALOG_TITLE_CLASSES = "bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white";
|
|
4
|
+
export declare const ALERT_DIALOG_DESCRIPTION_CLASSES = "bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2";
|
|
5
|
+
export declare const ALERT_DIALOG_FOOTER_CLASSES = "bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const e = "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity", r = "bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all bear-animate-in bear-fade-in bear-zoom-in-95", a = "bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white", b = "bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2", t = "bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";
|
|
2
|
+
export {
|
|
3
|
+
e as ALERT_DIALOG_BACKDROP_CLASSES,
|
|
4
|
+
r as ALERT_DIALOG_CONTAINER_CLASSES,
|
|
5
|
+
b as ALERT_DIALOG_DESCRIPTION_CLASSES,
|
|
6
|
+
t as ALERT_DIALOG_FOOTER_CLASSES,
|
|
7
|
+
a as ALERT_DIALOG_TITLE_CLASSES
|
|
8
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as y, useEffect as D } from "react";
|
|
3
|
+
import { createPortal as h } from "react-dom";
|
|
4
|
+
import { cn as a } from "../../utils/cn.js";
|
|
5
|
+
import { Button as s } from "../Button/Button.js";
|
|
6
|
+
import { Typography as m } from "../Typography/Typography.js";
|
|
7
|
+
import { ALERT_DIALOG_BACKDROP_CLASSES as T, ALERT_DIALOG_TITLE_CLASSES as O, ALERT_DIALOG_DESCRIPTION_CLASSES as x, ALERT_DIALOG_FOOTER_CLASSES as N, ALERT_DIALOG_CONTAINER_CLASSES as B } from "./AlertDialog.const.js";
|
|
8
|
+
const z = (_) => {
|
|
9
|
+
const {
|
|
10
|
+
isOpen: o,
|
|
11
|
+
onClose: t,
|
|
12
|
+
onConfirm: f,
|
|
13
|
+
title: b,
|
|
14
|
+
description: l,
|
|
15
|
+
confirmText: A = "Confirm",
|
|
16
|
+
cancelText: p = "Cancel",
|
|
17
|
+
confirmVariant: E = "danger",
|
|
18
|
+
loading: r = !1,
|
|
19
|
+
loadingText: g,
|
|
20
|
+
closeOnBackdrop: L = !1,
|
|
21
|
+
closeOnEscape: c = !0,
|
|
22
|
+
icon: i,
|
|
23
|
+
className: u,
|
|
24
|
+
testId: C
|
|
25
|
+
} = _, n = y(
|
|
26
|
+
(S) => {
|
|
27
|
+
c && S.key === "Escape" && !r && t();
|
|
28
|
+
},
|
|
29
|
+
[c, t, r]
|
|
30
|
+
);
|
|
31
|
+
if (D(() => (o && (document.addEventListener("keydown", n), document.body.style.overflow = "hidden"), () => {
|
|
32
|
+
document.removeEventListener("keydown", n), document.body.style.overflow = "";
|
|
33
|
+
}), [o, n]), !o) return null;
|
|
34
|
+
const v = /* @__PURE__ */ d(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: "Bear-AlertDialog bear-fixed bear-inset-0 bear-z-50 bear-flex bear-items-center bear-justify-center bear-p-4",
|
|
38
|
+
"data-testid": C,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ e(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: a("Bear-AlertDialog__backdrop", T),
|
|
44
|
+
onClick: L && !r ? t : void 0,
|
|
45
|
+
"aria-hidden": "true"
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ d(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
role: "alertdialog",
|
|
52
|
+
"aria-modal": "true",
|
|
53
|
+
"aria-labelledby": "alert-dialog-title",
|
|
54
|
+
"aria-describedby": l ? "alert-dialog-description" : void 0,
|
|
55
|
+
className: a("Bear-AlertDialog__container", B, "bear-p-6", u),
|
|
56
|
+
children: [
|
|
57
|
+
i && /* @__PURE__ */ e("div", { className: "Bear-AlertDialog__icon bear-mb-4 bear-flex bear-justify-center", children: i }),
|
|
58
|
+
/* @__PURE__ */ e(
|
|
59
|
+
m,
|
|
60
|
+
{
|
|
61
|
+
variant: "h6",
|
|
62
|
+
id: "alert-dialog-title",
|
|
63
|
+
className: a("Bear-AlertDialog__title", O, i && "bear-text-center"),
|
|
64
|
+
children: b
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
l && /* @__PURE__ */ e(
|
|
68
|
+
m,
|
|
69
|
+
{
|
|
70
|
+
variant: "body2",
|
|
71
|
+
id: "alert-dialog-description",
|
|
72
|
+
className: a("Bear-AlertDialog__description", x, i && "bear-text-center"),
|
|
73
|
+
children: l
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ d("div", { className: a("Bear-AlertDialog__footer", N), children: [
|
|
77
|
+
/* @__PURE__ */ e(
|
|
78
|
+
s,
|
|
79
|
+
{
|
|
80
|
+
variant: "ghost",
|
|
81
|
+
onClick: t,
|
|
82
|
+
disabled: r,
|
|
83
|
+
children: p
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ e(
|
|
87
|
+
s,
|
|
88
|
+
{
|
|
89
|
+
variant: E,
|
|
90
|
+
onClick: f,
|
|
91
|
+
loading: r,
|
|
92
|
+
loadingText: g,
|
|
93
|
+
children: A
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] })
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
return h(v, document.body);
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
z as AlertDialog
|
|
107
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BearVariant } from '../../types';
|
|
3
|
+
export interface AlertDialogProps {
|
|
4
|
+
/** Whether the dialog is open */
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** Callback when dialog should close (cancel/backdrop/escape) */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/** Callback when confirm action is triggered */
|
|
9
|
+
onConfirm: () => void;
|
|
10
|
+
/** Dialog title */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Dialog description / body text */
|
|
13
|
+
description?: string | ReactNode;
|
|
14
|
+
/** Confirm button text */
|
|
15
|
+
confirmText?: string;
|
|
16
|
+
/** Cancel button text */
|
|
17
|
+
cancelText?: string;
|
|
18
|
+
/** Variant for the confirm button */
|
|
19
|
+
confirmVariant?: BearVariant | (string & {});
|
|
20
|
+
/** Whether confirm action is in progress */
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
/** Loading text for confirm button */
|
|
23
|
+
loadingText?: string;
|
|
24
|
+
/** Whether clicking backdrop closes the dialog */
|
|
25
|
+
closeOnBackdrop?: boolean;
|
|
26
|
+
/** Whether pressing Escape closes the dialog */
|
|
27
|
+
closeOnEscape?: boolean;
|
|
28
|
+
/** Optional icon to show above the title */
|
|
29
|
+
icon?: ReactNode;
|
|
30
|
+
/** Additional class name */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Test ID */
|
|
33
|
+
testId?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),b=require("../../utils/cn.cjs"),r=l.forwardRef(({ratio:a=16/9,maxWidth:e,children:s,className:i,style:c,...n},o)=>t.jsx("div",{ref:o,className:b.cn("Bear-AspectRatio bear-relative bear-w-full bear-overflow-hidden",i),style:{maxWidth:typeof e=="number"?`${e}px`:e,...c},...n,children:t.jsx("div",{className:"Bear-AspectRatio__inner bear-w-full bear-relative",style:{paddingBottom:`${1/a*100}%`},children:t.jsx("div",{className:"Bear-AspectRatio__content bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center",children:s})})}));r.displayName="AspectRatio";exports.AspectRatio=r;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c } from "react";
|
|
3
|
+
import { cn as n } from "../../utils/cn.js";
|
|
4
|
+
const p = c(
|
|
5
|
+
({ ratio: a = 16 / 9, maxWidth: e, children: t, className: i, style: o, ...s }, l) => /* @__PURE__ */ r(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
ref: l,
|
|
9
|
+
className: n("Bear-AspectRatio bear-relative bear-w-full bear-overflow-hidden", i),
|
|
10
|
+
style: {
|
|
11
|
+
maxWidth: typeof e == "number" ? `${e}px` : e,
|
|
12
|
+
...o
|
|
13
|
+
},
|
|
14
|
+
...s,
|
|
15
|
+
children: /* @__PURE__ */ r(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
className: "Bear-AspectRatio__inner bear-w-full bear-relative",
|
|
19
|
+
style: { paddingBottom: `${1 / a * 100}%` },
|
|
20
|
+
children: /* @__PURE__ */ r("div", { className: "Bear-AspectRatio__content bear-absolute bear-inset-0 bear-flex bear-items-center bear-justify-center", children: t })
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
p.displayName = "AspectRatio";
|
|
27
|
+
export {
|
|
28
|
+
p as AspectRatio
|
|
29
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface AspectRatioProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Aspect ratio as a number (width / height). E.g. 16/9, 4/3, 1 */
|
|
4
|
+
ratio?: number;
|
|
5
|
+
/** Maximum width constraint */
|
|
6
|
+
maxWidth?: string | number;
|
|
7
|
+
/** Content to render inside the aspect ratio container */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),g=require("../../utils/cn.cjs"),ae=require("../Spinner/Spinner.cjs"),w=require("../Typography/Typography.cjs"),oe=require("../../hooks/useBearStyles.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const se=require("../../context/BearProvider.cjs"),o=require("./Button.constants.cjs"),O=x=>x in o.BUTTON_VARIANT,E=r.forwardRef((x,l)=>{var k,q;const{variant:e="primary",size:f="md",loading:c=!1,loadingText:_,fullWidth:M=!1,icon:p,iconPosition:C="left",leftIcon:P,rightIcon:U,textVariant:S="inherit",spotlight:u=!1,spotlightColor:z="rgba(255, 255, 255, 0.35)",spotlightSize:h=150,disabled:D,className:L,children:Z,testId:F,bis:H,style:X,onMouseMove:B,onMouseEnter:m,onMouseLeave:y,...Y}=x,W=D||c,v=oe.useBearStyles(H,X),R=P??(p&&C==="left"?p:void 0),$=U??(p&&C==="right"?p:void 0),s=r.useContext(se.BearContext),N=((q=(k=s==null?void 0:s.components)==null?void 0:k.Button)==null?void 0:q.root)||{},j=(s==null?void 0:s.customVariants)||{},T=!O(e)&&e in j,a=T?j[e]:null,b=r.useRef(null),[A,I]=r.useState({x:-1e3,y:-1e3}),[G,V]=r.useState(!1),J=r.useCallback(t=>{if(u&&b.current){const d=b.current.getBoundingClientRect(),re=t.clientX-d.left,ne=t.clientY-d.top;I({x:re,y:ne})}B==null||B(t)},[u,B]),K=r.useCallback(t=>{if(u&&(V(!0),b.current)){const d=b.current.getBoundingClientRect();I({x:t.clientX-d.left,y:t.clientY-d.top})}m==null||m(t)},[u,m]),Q=r.useCallback(t=>{V(!1),I({x:-1e3,y:-1e3}),y==null||y(t)},[y]),i=o.VARIANT_DEFAULTS[e]||o.VARIANT_DEFAULTS.primary,ee=r.useMemo(()=>T&&a?{backgroundColor:`var(--bear-${e}-bg, ${a.bg})`,color:a.text||"#ffffff",borderColor:a.border,"--bear-ring-color":a.ring||a.bg,...N,...v}:{backgroundColor:`var(--bear-btn-${e}-bg, ${i.bg})`,color:e==="outline"||e==="ghost"?`var(--bear-btn-${e}-text, ${i.text||"inherit"})`:"white",borderColor:e==="outline"?`var(--bear-btn-${e}-border, ${i.border||i.bg})`:void 0,"--bear-ring-color":`var(--bear-btn-${e}-ring, ${i.ring})`,...N,...v},[e,i,N,v,T,a]),te=r.useCallback(t=>{b.current=t,typeof l=="function"?l(t):l&&(l.current=t)},[l]);return n.jsxs("button",{ref:te,disabled:W,"aria-busy":c||void 0,style:ee,className:g.cn("Bear-Button","bear-inline-flex bear-items-center bear-justify-center bear-font-medium bear-rounded-lg bear-transition-all bear-duration-200 bear-outline-none bear-relative bear-overflow-hidden",o.BUTTON_SIZE[f],O(e)?o.BUTTON_VARIANT[e]:"bear-btn-custom bear-text-white focus:bear-ring-2 focus:bear-ring-offset-2 disabled:bear-opacity-50 disabled:bear-cursor-not-allowed hover:bear-brightness-110 active:bear-brightness-95",M&&"bear-w-full",c&&"bear-cursor-wait",L),"data-testid":F,onMouseMove:J,onMouseEnter:K,onMouseLeave:Q,...Y,children:[u&&n.jsx("span",{className:"Bear-Button__spotlight","aria-hidden":"true",style:{position:"absolute",pointerEvents:"none",left:0,top:0,width:h,height:h,borderRadius:"50%",background:`radial-gradient(circle at center, ${z} 0%, transparent 70%)`,opacity:G?1:0,transform:`translate(${A.x-h/2}px, ${A.y-h/2}px)`,transition:"opacity 0.15s ease-out",zIndex:1,mixBlendMode:"overlay"}}),c&&n.jsxs("span",{className:g.cn("Bear-Button__loading bear-inline-flex bear-items-center bear-gap-2 bear-relative bear-z-10",!_&&"bear-absolute"),children:[n.jsx(ae.Spinner,{size:f==="xs"?"xs":"sm",className:"Bear-Button__spinner"}),_&&n.jsx(w.Typography,{variant:S,className:"Bear-Button__text",children:_})]}),n.jsxs("span",{className:g.cn("Bear-Button__content bear-inline-flex bear-items-center bear-gap-inherit bear-relative bear-z-10",c&&"bear-invisible"),children:[R&&n.jsx("span",{className:g.cn("Bear-Button__icon Bear-Button__icon--left bear-inline-flex bear-shrink-0",o.BUTTON_ICON_SIZE[f]),children:R}),n.jsx(w.Typography,{variant:S,className:"Bear-Button__text",children:Z}),$&&n.jsx("span",{className:g.cn("Bear-Button__icon Bear-Button__icon--right bear-inline-flex bear-shrink-0",o.BUTTON_ICON_SIZE[f]),children:$})]})]})});E.displayName="Button";exports.Button=E;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r={xs:"bear-px-2 bear-py-1 bear-text-xs bear-gap-1",sm:"bear-px-3 bear-py-1.5 bear-text-sm bear-gap-1.5",md:"bear-px-4 bear-py-2 bear-text-sm bear-gap-2",lg:"bear-px-5 bear-py-2.5 bear-text-base bear-gap-2",xl:"bear-px-6 bear-py-3 bear-text-lg bear-gap-2.5"},e={primary:`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r={xs:"bear-px-2 bear-py-1 bear-text-xs bear-gap-1",sm:"bear-px-3 bear-py-1.5 bear-text-sm bear-gap-1.5",md:"bear-px-4 bear-py-2 bear-text-sm bear-gap-2",lg:"bear-px-5 bear-py-2.5 bear-text-base bear-gap-2",xl:"bear-px-6 bear-py-3 bear-text-lg bear-gap-2.5"},e={xs:"[&_svg]:bear-w-3 [&_svg]:bear-h-3",sm:"[&_svg]:bear-w-4 [&_svg]:bear-h-4",md:"[&_svg]:bear-w-5 [&_svg]:bear-h-5",lg:"[&_svg]:bear-w-5 [&_svg]:bear-h-5",xl:"[&_svg]:bear-w-6 [&_svg]:bear-h-6"},a={primary:`
|
|
2
2
|
bear-btn-primary
|
|
3
3
|
bear-text-white bear-relative bear-overflow-hidden
|
|
4
4
|
focus:bear-ring-2 focus:bear-ring-offset-2
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
bear-text-white bear-relative bear-overflow-hidden
|
|
45
45
|
focus:bear-ring-2 focus:bear-ring-offset-2
|
|
46
46
|
disabled:bear-opacity-50 disabled:bear-cursor-not-allowed
|
|
47
|
-
`},
|
|
47
|
+
`},b={primary:{bg:"var(--bear-primary-500)",hover:"var(--bear-primary-600)",active:"var(--bear-primary-700)",ring:"var(--bear-primary-500)"},secondary:{bg:"var(--bear-secondary-500)",hover:"var(--bear-secondary-600)",active:"var(--bear-secondary-700)",ring:"var(--bear-secondary-500)"},success:{bg:"var(--bear-success-500)",hover:"var(--bear-success-600)",active:"var(--bear-success-700)",ring:"var(--bear-success-500)"},warning:{bg:"var(--bear-warning-500)",hover:"var(--bear-warning-600)",active:"var(--bear-warning-700)",ring:"var(--bear-warning-500)"},danger:{bg:"var(--bear-danger-500)",hover:"var(--bear-danger-600)",active:"var(--bear-danger-700)",ring:"var(--bear-danger-500)"},info:{bg:"var(--bear-info-500)",hover:"var(--bear-info-600)",active:"var(--bear-info-700)",ring:"var(--bear-info-500)"},error:{bg:"var(--bear-danger-500)",hover:"var(--bear-danger-600)",active:"var(--bear-danger-700)",ring:"var(--bear-danger-500)"},ghost:{bg:"transparent",hover:"var(--bear-neutral-100)",active:"var(--bear-neutral-200)",text:"var(--bear-text-primary)",ring:"var(--bear-neutral-500)"},outline:{bg:"transparent",hover:"var(--bear-primary-50)",active:"var(--bear-primary-100)",border:"var(--bear-primary-500)",text:"var(--bear-primary-500)",ring:"var(--bear-primary-500)"}};exports.BUTTON_ICON_SIZE=e;exports.BUTTON_SIZE=r;exports.BUTTON_VARIANT=a;exports.VARIANT_DEFAULTS=b;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BearSize, BearVariant } from '../../types';
|
|
2
2
|
export declare const BUTTON_SIZE: Record<BearSize, string>;
|
|
3
|
+
export declare const BUTTON_ICON_SIZE: Record<BearSize, string>;
|
|
3
4
|
/**
|
|
4
5
|
* Button variants using CSS variables for full customization
|
|
5
6
|
* Colors can be overridden via:
|
|
@@ -5,6 +5,12 @@ const r = {
|
|
|
5
5
|
lg: "bear-px-5 bear-py-2.5 bear-text-base bear-gap-2",
|
|
6
6
|
xl: "bear-px-6 bear-py-3 bear-text-lg bear-gap-2.5"
|
|
7
7
|
}, e = {
|
|
8
|
+
xs: "[&_svg]:bear-w-3 [&_svg]:bear-h-3",
|
|
9
|
+
sm: "[&_svg]:bear-w-4 [&_svg]:bear-h-4",
|
|
10
|
+
md: "[&_svg]:bear-w-5 [&_svg]:bear-h-5",
|
|
11
|
+
lg: "[&_svg]:bear-w-5 [&_svg]:bear-h-5",
|
|
12
|
+
xl: "[&_svg]:bear-w-6 [&_svg]:bear-h-6"
|
|
13
|
+
}, a = {
|
|
8
14
|
primary: `
|
|
9
15
|
bear-btn-primary
|
|
10
16
|
bear-text-white bear-relative bear-overflow-hidden
|
|
@@ -60,7 +66,7 @@ const r = {
|
|
|
60
66
|
focus:bear-ring-2 focus:bear-ring-offset-2
|
|
61
67
|
disabled:bear-opacity-50 disabled:bear-cursor-not-allowed
|
|
62
68
|
`
|
|
63
|
-
},
|
|
69
|
+
}, b = {
|
|
64
70
|
primary: { bg: "var(--bear-primary-500)", hover: "var(--bear-primary-600)", active: "var(--bear-primary-700)", ring: "var(--bear-primary-500)" },
|
|
65
71
|
secondary: { bg: "var(--bear-secondary-500)", hover: "var(--bear-secondary-600)", active: "var(--bear-secondary-700)", ring: "var(--bear-secondary-500)" },
|
|
66
72
|
success: { bg: "var(--bear-success-500)", hover: "var(--bear-success-600)", active: "var(--bear-success-700)", ring: "var(--bear-success-500)" },
|
|
@@ -72,7 +78,8 @@ const r = {
|
|
|
72
78
|
outline: { bg: "transparent", hover: "var(--bear-primary-50)", active: "var(--bear-primary-100)", border: "var(--bear-primary-500)", text: "var(--bear-primary-500)", ring: "var(--bear-primary-500)" }
|
|
73
79
|
};
|
|
74
80
|
export {
|
|
81
|
+
e as BUTTON_ICON_SIZE,
|
|
75
82
|
r as BUTTON_SIZE,
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
a as BUTTON_VARIANT,
|
|
84
|
+
b as VARIANT_DEFAULTS
|
|
78
85
|
};
|
|
@@ -1,95 +1,97 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Spinner as
|
|
5
|
-
import { Typography as
|
|
6
|
-
import { useBearStyles as
|
|
1
|
+
import { jsxs as C, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as se, useContext as le, useRef as ce, useState as A, useCallback as B, useMemo as be } from "react";
|
|
3
|
+
import { cn as u } from "../../utils/cn.js";
|
|
4
|
+
import { Spinner as ue } from "../Spinner/Spinner.js";
|
|
5
|
+
import { Typography as E } from "../Typography/Typography.js";
|
|
6
|
+
import { useBearStyles as de } from "../../hooks/useBearStyles.js";
|
|
7
7
|
import "../../hooks/useBearComponent/useBearComponent.js";
|
|
8
|
-
import { BearContext as
|
|
9
|
-
import { VARIANT_DEFAULTS as
|
|
10
|
-
const
|
|
11
|
-
(
|
|
12
|
-
var
|
|
8
|
+
import { BearContext as fe } from "../../context/BearProvider.js";
|
|
9
|
+
import { VARIANT_DEFAULTS as P, BUTTON_ICON_SIZE as O, BUTTON_VARIANT as j, BUTTON_SIZE as me } from "./Button.constants.js";
|
|
10
|
+
const U = (y) => y in j, ge = se(
|
|
11
|
+
(y, i) => {
|
|
12
|
+
var z, M;
|
|
13
13
|
const {
|
|
14
14
|
variant: e = "primary",
|
|
15
|
-
size:
|
|
16
|
-
loading:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
size: d = "md",
|
|
16
|
+
loading: s = !1,
|
|
17
|
+
loadingText: v,
|
|
18
|
+
fullWidth: D = !1,
|
|
19
|
+
icon: f,
|
|
20
|
+
iconPosition: $ = "left",
|
|
21
|
+
leftIcon: H,
|
|
22
|
+
rightIcon: L,
|
|
23
|
+
textVariant: S = "inherit",
|
|
24
|
+
spotlight: l = !1,
|
|
25
|
+
spotlightColor: X = "rgba(255, 255, 255, 0.35)",
|
|
26
|
+
spotlightSize: m = 150,
|
|
27
|
+
disabled: Y,
|
|
28
|
+
className: Z,
|
|
29
|
+
children: F,
|
|
30
|
+
testId: W,
|
|
31
|
+
bis: q,
|
|
32
|
+
style: G,
|
|
33
|
+
onMouseMove: g,
|
|
34
|
+
onMouseEnter: p,
|
|
35
|
+
onMouseLeave: h,
|
|
36
|
+
...J
|
|
37
|
+
} = y, K = Y || s, x = de(q, G), T = H ?? (f && $ === "left" ? f : void 0), R = L ?? (f && $ === "right" ? f : void 0), n = le(fe), _ = ((M = (z = n == null ? void 0 : n.components) == null ? void 0 : z.Button) == null ? void 0 : M.root) || {}, w = (n == null ? void 0 : n.customVariants) || {}, N = !U(e) && e in w, r = N ? w[e] : null, c = ce(null), [V, I] = A({ x: -1e3, y: -1e3 }), [Q, k] = A(!1), ee = B((t) => {
|
|
38
|
+
if (l && c.current) {
|
|
39
|
+
const b = c.current.getBoundingClientRect(), ae = t.clientX - b.left, ie = t.clientY - b.top;
|
|
40
|
+
I({ x: ae, y: ie });
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
x: t.clientX -
|
|
47
|
-
y: t.clientY -
|
|
42
|
+
g == null || g(t);
|
|
43
|
+
}, [l, g]), te = B((t) => {
|
|
44
|
+
if (l && (k(!0), c.current)) {
|
|
45
|
+
const b = c.current.getBoundingClientRect();
|
|
46
|
+
I({
|
|
47
|
+
x: t.clientX - b.left,
|
|
48
|
+
y: t.clientY - b.top
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
|
|
53
|
-
}, [
|
|
51
|
+
p == null || p(t);
|
|
52
|
+
}, [l, p]), re = B((t) => {
|
|
53
|
+
k(!1), I({ x: -1e3, y: -1e3 }), h == null || h(t);
|
|
54
|
+
}, [h]), o = P[e] || P.primary, ne = be(() => N && r ? {
|
|
54
55
|
backgroundColor: `var(--bear-${e}-bg, ${r.bg})`,
|
|
55
56
|
color: r.text || "#ffffff",
|
|
56
57
|
borderColor: r.border,
|
|
57
58
|
"--bear-ring-color": r.ring || r.bg,
|
|
58
|
-
...
|
|
59
|
-
...
|
|
59
|
+
..._,
|
|
60
|
+
...x
|
|
60
61
|
} : {
|
|
61
62
|
backgroundColor: `var(--bear-btn-${e}-bg, ${o.bg})`,
|
|
62
63
|
color: e === "outline" || e === "ghost" ? `var(--bear-btn-${e}-text, ${o.text || "inherit"})` : "white",
|
|
63
64
|
borderColor: e === "outline" ? `var(--bear-btn-${e}-border, ${o.border || o.bg})` : void 0,
|
|
64
65
|
"--bear-ring-color": `var(--bear-btn-${e}-ring, ${o.ring})`,
|
|
65
|
-
...
|
|
66
|
-
...
|
|
67
|
-
}, [e, o,
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
return /* @__PURE__ */
|
|
66
|
+
..._,
|
|
67
|
+
...x
|
|
68
|
+
}, [e, o, _, x, N, r]), oe = B((t) => {
|
|
69
|
+
c.current = t, typeof i == "function" ? i(t) : i && (i.current = t);
|
|
70
|
+
}, [i]);
|
|
71
|
+
return /* @__PURE__ */ C(
|
|
71
72
|
"button",
|
|
72
73
|
{
|
|
73
|
-
ref:
|
|
74
|
-
disabled:
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
ref: oe,
|
|
75
|
+
disabled: K,
|
|
76
|
+
"aria-busy": s || void 0,
|
|
77
|
+
style: ne,
|
|
78
|
+
className: u(
|
|
77
79
|
"Bear-Button",
|
|
78
80
|
"bear-inline-flex bear-items-center bear-justify-center bear-font-medium bear-rounded-lg bear-transition-all bear-duration-200 bear-outline-none bear-relative bear-overflow-hidden",
|
|
79
|
-
|
|
81
|
+
me[d],
|
|
80
82
|
// Use built-in variant classes or custom variant base classes
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
U(e) ? j[e] : "bear-btn-custom bear-text-white focus:bear-ring-2 focus:bear-ring-offset-2 disabled:bear-opacity-50 disabled:bear-cursor-not-allowed hover:bear-brightness-110 active:bear-brightness-95",
|
|
84
|
+
D && "bear-w-full",
|
|
85
|
+
s && "bear-cursor-wait",
|
|
86
|
+
Z
|
|
85
87
|
),
|
|
86
|
-
"data-testid":
|
|
87
|
-
onMouseMove:
|
|
88
|
-
onMouseEnter:
|
|
89
|
-
onMouseLeave:
|
|
90
|
-
...
|
|
88
|
+
"data-testid": W,
|
|
89
|
+
onMouseMove: ee,
|
|
90
|
+
onMouseEnter: te,
|
|
91
|
+
onMouseLeave: re,
|
|
92
|
+
...J,
|
|
91
93
|
children: [
|
|
92
|
-
|
|
94
|
+
l && /* @__PURE__ */ a(
|
|
93
95
|
"span",
|
|
94
96
|
{
|
|
95
97
|
className: "Bear-Button__spotlight",
|
|
@@ -99,30 +101,36 @@ const A = (h) => h in P, me = oe(
|
|
|
99
101
|
pointerEvents: "none",
|
|
100
102
|
left: 0,
|
|
101
103
|
top: 0,
|
|
102
|
-
width:
|
|
103
|
-
height:
|
|
104
|
+
width: m,
|
|
105
|
+
height: m,
|
|
104
106
|
borderRadius: "50%",
|
|
105
|
-
background: `radial-gradient(circle at center, ${
|
|
106
|
-
opacity:
|
|
107
|
-
transform: `translate(${
|
|
107
|
+
background: `radial-gradient(circle at center, ${X} 0%, transparent 70%)`,
|
|
108
|
+
opacity: Q ? 1 : 0,
|
|
109
|
+
transform: `translate(${V.x - m / 2}px, ${V.y - m / 2}px)`,
|
|
108
110
|
transition: "opacity 0.15s ease-out",
|
|
109
111
|
zIndex: 1,
|
|
110
112
|
mixBlendMode: "overlay"
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
s && /* @__PURE__ */ C("span", { className: u(
|
|
117
|
+
"Bear-Button__loading bear-inline-flex bear-items-center bear-gap-2 bear-relative bear-z-10",
|
|
118
|
+
!v && "bear-absolute"
|
|
119
|
+
), children: [
|
|
120
|
+
/* @__PURE__ */ a(ue, { size: d === "xs" ? "xs" : "sm", className: "Bear-Button__spinner" }),
|
|
121
|
+
v && /* @__PURE__ */ a(E, { variant: S, className: "Bear-Button__text", children: v })
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ C(
|
|
116
124
|
"span",
|
|
117
125
|
{
|
|
118
|
-
className:
|
|
126
|
+
className: u(
|
|
119
127
|
"Bear-Button__content bear-inline-flex bear-items-center bear-gap-inherit bear-relative bear-z-10",
|
|
120
|
-
|
|
128
|
+
s && "bear-invisible"
|
|
121
129
|
),
|
|
122
130
|
children: [
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
|
|
131
|
+
T && /* @__PURE__ */ a("span", { className: u("Bear-Button__icon Bear-Button__icon--left bear-inline-flex bear-shrink-0", O[d]), children: T }),
|
|
132
|
+
/* @__PURE__ */ a(E, { variant: S, className: "Bear-Button__text", children: F }),
|
|
133
|
+
R && /* @__PURE__ */ a("span", { className: u("Bear-Button__icon Bear-Button__icon--right bear-inline-flex bear-shrink-0", O[d]), children: R })
|
|
126
134
|
]
|
|
127
135
|
}
|
|
128
136
|
)
|
|
@@ -131,7 +139,7 @@ const A = (h) => h in P, me = oe(
|
|
|
131
139
|
);
|
|
132
140
|
}
|
|
133
141
|
);
|
|
134
|
-
|
|
142
|
+
ge.displayName = "Button";
|
|
135
143
|
export {
|
|
136
|
-
|
|
144
|
+
ge as Button
|
|
137
145
|
};
|
|
@@ -21,6 +21,8 @@ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
|
|
|
21
21
|
size?: BearSize;
|
|
22
22
|
/** Whether button is in loading state */
|
|
23
23
|
loading?: boolean;
|
|
24
|
+
/** Text to display while loading (replaces children during loading) */
|
|
25
|
+
loadingText?: string;
|
|
24
26
|
/** Whether button takes full width */
|
|
25
27
|
fullWidth?: boolean;
|
|
26
28
|
/** Icon (shorthand for leftIcon or rightIcon based on iconPosition) */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),t=require("react"),r=require("../../utils/cn.cjs"),U=require("./FormField.const.cjs"),W=require("../../context/BearProvider.cjs"),q=t.forwardRef(({label:R,helperText:E,error:_,success:k,size:I="md",leftAddon:l,rightAddon:c,fullWidth:z=!1,required:M=!1,variant:m="outlined",className:L,disabled:g,value:x,defaultValue:u,placeholder:O,onFocus:s,onBlur:o,...p},P)=>{var C;const F=m==="filled",i=m==="standard",y=t.useContext(W.BearContext),e=(C=y==null?void 0:y.components)==null?void 0:C.FormField,D=e==null?void 0:e.root,T=e==null?void 0:e.input,Z=e==null?void 0:e.label,G=e==null?void 0:e.helper,j=e==null?void 0:e.addon,H=F?e==null?void 0:e.filled:i?e==null?void 0:e.standard:e==null?void 0:e.outlined,[n,B]=t.useState(!1),J=t.useId(),v=p.id??J,K=x!=null&&x!==""||u!=null&&u!=="",N=n||K,b=!!_,d=!!k&&!b,f=U.FORMFIELD_SIZE_CLASSES[I],w=_||k||E,Q=t.useCallback(h=>{B(!0),s==null||s(h)},[s]),S=t.useCallback(h=>{B(!1),o==null||o(h)},[o]);return a.jsxs("div",{className:r.cn("Bear-FormField bear-flex bear-flex-col bear-gap-1",z&&"bear-w-full"),style:D,children:[a.jsxs("div",{className:"Bear-FormField__wrapper bear-relative bear-flex bear-items-center",children:[l&&a.jsx("div",{className:"Bear-FormField__addon Bear-FormField__addon--left bear-absolute bear-left-3 bear-z-10 bear-text-gray-500 dark:bear-text-gray-400",style:j,children:l}),a.jsx("input",{ref:P,id:v,disabled:g,value:x,defaultValue:u,placeholder:N?O:void 0,"aria-invalid":b||void 0,onFocus:Q,onBlur:S,className:r.cn("Bear-FormField__input bear-peer bear-w-full bear-rounded-lg bear-border bear-outline-none bear-transition-all bear-duration-200",F?r.cn("bear-bg-gray-100 bear-border-transparent bear-rounded-t-lg bear-rounded-b-none bear-border-b-2","dark:bear-bg-gray-800",b?"bear-border-b-red-500":d?"bear-border-b-green-500":n?"bear-border-b-bear-500":"bear-border-b-gray-400 dark:bear-border-b-gray-500"):i?r.cn("bear-bg-transparent bear-rounded-none bear-border-0 bear-border-b-2",b?"bear-border-b-red-500":d?"bear-border-b-green-500":n?"bear-border-b-bear-500":"bear-border-b-gray-300 dark:bear-border-b-gray-600"):r.cn("bear-bg-white dark:bear-bg-gray-900",b?"bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/30":d?"bear-border-green-500 focus:bear-ring-2 focus:bear-ring-green-500/30":r.cn("bear-border-gray-300 dark:bear-border-gray-600","focus:bear-border-bear-500 focus:bear-ring-2 focus:bear-ring-bear-500/30","dark:focus:bear-border-bear-400")),"bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-400 dark:placeholder:bear-text-gray-500",g&&"bear-opacity-50 bear-cursor-not-allowed",l&&"bear-pl-10",c&&"bear-pr-10",f.field,i&&"focus:bear-ring-0",L),style:{...H,...T},...p}),a.jsxs("label",{htmlFor:v,className:r.cn("Bear-FormField__label bear-absolute bear-left-0 bear-pointer-events-none bear-origin-top-left","bear-transition-all bear-duration-200 bear-select-none",l?"bear-ml-10":"bear-ml-4",N?r.cn(F?f.labelFloat:i?"bear-top-0 bear--translate-y-1/2 bear-text-xs":"bear-top-0 bear--translate-y-1/2 bear-text-xs bear-px-1 bear-bg-white dark:bear-bg-gray-900",b?"bear-text-red-500":d?"bear-text-green-500":n?"bear-text-bear-500 dark:bear-text-bear-400":"bear-text-gray-500 dark:bear-text-gray-400"):r.cn(f.labelRest,"bear--translate-y-1/2","bear-text-gray-500 dark:bear-text-gray-400"),g&&"bear-opacity-50"),style:Z,children:[R,M&&a.jsx("span",{className:"bear-text-red-500 bear-ml-0.5",children:"*"})]}),c&&a.jsx("div",{className:"Bear-FormField__addon Bear-FormField__addon--right bear-absolute bear-right-3 bear-z-10 bear-text-gray-500 dark:bear-text-gray-400",style:j,children:c})]}),w&&a.jsx("p",{className:r.cn("Bear-FormField__helper bear-text-xs bear-ml-4",b?"bear-text-red-500":d?"bear-text-green-500":"bear-text-gray-500 dark:bear-text-gray-400"),style:G,children:w})]})});q.displayName="FormField";exports.FormField=q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={sm:{field:"bear-h-10 bear-text-sm bear-px-3 bear-pt-4 bear-pb-1",label:"bear-text-xs",labelFloat:"bear-top-1 bear-text-[10px]",labelRest:"bear-top-1/2 bear-text-sm"},md:{field:"bear-h-14 bear-text-base bear-px-4 bear-pt-5 bear-pb-2",label:"bear-text-sm",labelFloat:"bear-top-1.5 bear-text-xs",labelRest:"bear-top-1/2 bear-text-base"},lg:{field:"bear-h-16 bear-text-lg bear-px-5 bear-pt-6 bear-pb-2",label:"bear-text-base",labelFloat:"bear-top-2 bear-text-xs",labelRest:"bear-top-1/2 bear-text-lg"}};exports.FORMFIELD_SIZE_CLASSES=e;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const FORMFIELD_SIZE_CLASSES: {
|
|
2
|
+
readonly sm: {
|
|
3
|
+
readonly field: "bear-h-10 bear-text-sm bear-px-3 bear-pt-4 bear-pb-1";
|
|
4
|
+
readonly label: "bear-text-xs";
|
|
5
|
+
readonly labelFloat: "bear-top-1 bear-text-[10px]";
|
|
6
|
+
readonly labelRest: "bear-top-1/2 bear-text-sm";
|
|
7
|
+
};
|
|
8
|
+
readonly md: {
|
|
9
|
+
readonly field: "bear-h-14 bear-text-base bear-px-4 bear-pt-5 bear-pb-2";
|
|
10
|
+
readonly label: "bear-text-sm";
|
|
11
|
+
readonly labelFloat: "bear-top-1.5 bear-text-xs";
|
|
12
|
+
readonly labelRest: "bear-top-1/2 bear-text-base";
|
|
13
|
+
};
|
|
14
|
+
readonly lg: {
|
|
15
|
+
readonly field: "bear-h-16 bear-text-lg bear-px-5 bear-pt-6 bear-pb-2";
|
|
16
|
+
readonly label: "bear-text-base";
|
|
17
|
+
readonly labelFloat: "bear-top-2 bear-text-xs";
|
|
18
|
+
readonly labelRest: "bear-top-1/2 bear-text-lg";
|
|
19
|
+
};
|
|
20
|
+
};
|