@forgedevstack/bear 1.1.4 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/components/Anchor/Anchor.cjs +1 -1
- package/dist/components/Anchor/Anchor.js +37 -45
- package/dist/components/Anchor/Anchor.utils.cjs +1 -0
- package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
- package/dist/components/Anchor/Anchor.utils.js +12 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +60 -67
- package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
- package/dist/components/BackTop/BackTop.cjs +1 -1
- package/dist/components/BackTop/BackTop.js +10 -11
- 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 +12 -5
- package/dist/components/Button/Button.d.ts +0 -27
- package/dist/components/Button/Button.js +93 -105
- package/dist/components/Button/Button.types.d.ts +1 -0
- package/dist/components/Button/Button.utils.cjs +1 -0
- package/dist/components/Button/Button.utils.d.ts +2 -0
- package/dist/components/Button/Button.utils.js +5 -0
- package/dist/components/Button/useSpotlight.cjs +1 -0
- package/dist/components/Button/useSpotlight.d.ts +21 -0
- package/dist/components/Button/useSpotlight.js +28 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -0
- package/dist/components/Chart/Chart.const.js +21 -0
- package/dist/components/Chart/Chart.js +55 -71
- package/dist/components/Chart/Chart.utils.cjs +1 -0
- package/dist/components/Chart/Chart.utils.js +5 -0
- package/dist/components/Confetti/Confetti.cjs +1 -1
- package/dist/components/Confetti/Confetti.js +37 -34
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +31 -30
- package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
- package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
- package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
- package/dist/components/Dock/Dock.cjs +1 -1
- package/dist/components/Dock/Dock.js +38 -43
- package/dist/components/Dock/Dock.utils.cjs +1 -0
- package/dist/components/Dock/Dock.utils.d.ts +1 -0
- package/dist/components/Dock/Dock.utils.js +10 -0
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +59 -60
- package/dist/components/FileTree/FileTree.cjs +1 -1
- package/dist/components/FileTree/FileTree.js +20 -32
- package/dist/components/FileTree/FileTree.utils.cjs +1 -0
- package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
- package/dist/components/FileTree/FileTree.utils.js +15 -0
- package/dist/components/GradientText/GradientText.cjs +1 -1
- package/dist/components/GradientText/GradientText.js +27 -29
- package/dist/components/Icon/icons/bear.cjs +1 -0
- package/dist/components/Icon/icons/bear.d.ts +12 -0
- package/dist/components/Icon/icons/bear.js +47 -0
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +18 -0
- package/dist/components/Icon/index.js +17 -15
- package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
- package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +64 -68
- package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
- package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
- package/dist/components/PageNav/PageNav.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.d.ts +22 -0
- package/dist/components/PageNav/PageNav.const.js +42 -0
- package/dist/components/PageNav/PageNav.d.ts +3 -0
- package/dist/components/PageNav/PageNav.js +81 -0
- package/dist/components/PageNav/PageNav.types.d.ts +17 -0
- package/dist/components/PageNav/index.d.ts +2 -0
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +6 -6
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
- package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
- package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
- package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
- package/dist/components/PropsPlayground/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +28 -30
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.js +24 -24
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.js +89 -94
- package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
- package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.utils.js +10 -0
- package/dist/components/SliderRange/SliderRange.cjs +1 -1
- package/dist/components/SliderRange/SliderRange.js +61 -63
- package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
- package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.utils.js +7 -0
- package/dist/components/Spotlight/Spotlight.cjs +1 -1
- package/dist/components/Spotlight/Spotlight.js +62 -73
- package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
- package/dist/components/Spotlight/Spotlight.utils.js +18 -0
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.js +39 -38
- package/dist/components/Tabs/Tabs.types.d.ts +3 -1
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +18 -17
- package/dist/components/Toast/Toast.utils.cjs +1 -0
- package/dist/components/Toast/Toast.utils.d.ts +1 -0
- package/dist/components/Toast/Toast.utils.js +4 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +10 -11
- package/dist/components/Tour/Tour.cjs +1 -1
- package/dist/components/Tour/Tour.js +1 -2
- package/dist/components/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/VirtualList/VirtualList.js +38 -43
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +66 -62
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +60 -58
- package/dist/hooks/useResizeObserver/index.d.ts +2 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
- package/dist/icons.cjs +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +175 -169
- package/dist/styles/_base.css +7 -3
- package/dist/styles.css +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -284,6 +284,25 @@ const buttonProps: ButtonProps = {
|
|
|
284
284
|
<Button {...buttonProps} />
|
|
285
285
|
```
|
|
286
286
|
|
|
287
|
+
## How Bear Compares
|
|
288
|
+
|
|
289
|
+
| Feature | Bear UI | MUI | Ant Design | Chakra UI |
|
|
290
|
+
|---------|---------|-----|------------|-----------|
|
|
291
|
+
| **Tailwind CSS native** | Yes | No | No | Partial (v3) |
|
|
292
|
+
| **Bundle (tree-shaken)** | ~18 kB | ~80 kB | ~120 kB | ~45 kB |
|
|
293
|
+
| **Dark mode** | `dark:` variants, zero JS | Runtime theme swap | CSS vars + config | ColorMode context |
|
|
294
|
+
| **TypeScript** | 100 % | 100 % | 100 % | 100 % |
|
|
295
|
+
| **Components** | 60+ | 50+ | 60+ | 30+ |
|
|
296
|
+
| **Theming** | BearProvider + Tailwind | Emotion/styled | Less/CSS vars | Styled System |
|
|
297
|
+
| **Modular CSS** | `@BearInclude` PostCSS | N/A | N/A | N/A |
|
|
298
|
+
| **React 18 / 19** | Yes | Yes | Yes | Yes |
|
|
299
|
+
| **Zero runtime CSS-in-JS** | Yes | No (Emotion) | No (Less) | No (Emotion) |
|
|
300
|
+
| **Built-in i18n** | Portal (en/es) | MUI X | ConfigProvider | N/A |
|
|
301
|
+
|
|
302
|
+
## Contributing
|
|
303
|
+
|
|
304
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on adding components, coding rules, and the portal development workflow.
|
|
305
|
+
|
|
287
306
|
## License
|
|
288
307
|
|
|
289
308
|
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),u=require("react"),f=require("../../utils/cn.cjs"),L=require("../Typography/Typography.cjs"),s=require("./Anchor.const.cjs"),N=require("./Anchor.utils.cjs"),C=S=>{const{links:T,offset:c=s.DEFAULT_OFFSET,affix:h=!1,affixTop:g=s.DEFAULT_AFFIX_TOP,targetOffset:b=s.DEFAULT_TARGET_OFFSET,onClick:i,className:m,testId:A,...I}=S,[v,_]=u.useState(null),l=u.useRef(null),a=N.collectIds(T),p=u.useCallback(e=>{const n=document.getElementById(e);if(n){const t=n.getBoundingClientRect().top+window.scrollY-b;window.scrollTo({top:t,behavior:"smooth"})}i==null||i(e)},[b,i]);u.useEffect(()=>{if(a.length!==0)return l.current=new IntersectionObserver(e=>{const n=e.filter(t=>t.isIntersecting).sort((t,o)=>{const r=t.boundingClientRect.top,x=o.boundingClientRect.top;return Math.abs(r-c)-Math.abs(x-c)});if(n.length>0){const o=n[0].target.id;a.includes(o)&&_(o)}},{rootMargin:`-${c}px 0px -50% 0px`,threshold:[0,.25,.5,.75,1]}),a.forEach(e=>{var t;const n=document.getElementById(e);n&&((t=l.current)==null||t.observe(n))}),()=>{var e;(e=l.current)==null||e.disconnect(),l.current=null}},[a.join(","),c]);const E=(e,n)=>{var o;const t=v===e.id;return d.jsxs("div",{className:f.cn(n&&s.NESTED_LINK_INDENT),children:[d.jsx("div",{role:"button",tabIndex:0,onClick:()=>p(e.id),onKeyDown:r=>r.key==="Enter"&&p(e.id),className:f.cn(s.LINK_CLASSES,t&&s.ACTIVE_LINK_CLASSES),children:d.jsx(L.Typography,{variant:"body2",className:f.cn(t&&"bear-font-medium"),children:e.label})}),(o=e.children)==null?void 0:o.map(r=>E(r,!0))]},e.id)},y=f.cn(s.ROOT_CLASS,s.ROOT_CLASSES,h&&"bear-sticky",m);return d.jsx("nav",{className:y,style:h?{top:g}:void 0,"data-testid":A,...I,children:T.map(e=>E(e,!1))})};exports.Anchor=C;
|
|
@@ -1,91 +1,83 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d, jsxs as L } from "react/jsx-runtime";
|
|
2
2
|
import { useState as N, useRef as C, useCallback as x, useEffect as y } from "react";
|
|
3
|
-
import { cn as
|
|
3
|
+
import { cn as a } from "../../utils/cn.js";
|
|
4
4
|
import { Typography as F } from "../Typography/Typography.js";
|
|
5
5
|
import { DEFAULT_OFFSET as O, DEFAULT_AFFIX_TOP as R, DEFAULT_TARGET_OFFSET as w, ROOT_CLASSES as D, ROOT_CLASS as K, ACTIVE_LINK_CLASSES as j, LINK_CLASSES as B, NESTED_LINK_INDENT as M } from "./Anchor.const.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
a.forEach((c) => {
|
|
9
|
-
var i;
|
|
10
|
-
r.push(c.id), (i = c.children) != null && i.length && n(c.children);
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
return n(p), r;
|
|
14
|
-
}
|
|
15
|
-
const Y = (p) => {
|
|
6
|
+
import { collectIds as U } from "./Anchor.utils.js";
|
|
7
|
+
const k = (E) => {
|
|
16
8
|
const {
|
|
17
|
-
links:
|
|
18
|
-
offset:
|
|
19
|
-
affix:
|
|
20
|
-
affixTop:
|
|
21
|
-
targetOffset:
|
|
22
|
-
onClick:
|
|
23
|
-
className:
|
|
9
|
+
links: f,
|
|
10
|
+
offset: r = O,
|
|
11
|
+
affix: m = !1,
|
|
12
|
+
affixTop: b = R,
|
|
13
|
+
targetOffset: u = w,
|
|
14
|
+
onClick: c,
|
|
15
|
+
className: h,
|
|
24
16
|
testId: I,
|
|
25
17
|
...S
|
|
26
|
-
} =
|
|
18
|
+
} = E, [g, v] = N(null), i = C(null), l = U(f), p = x(
|
|
27
19
|
(t) => {
|
|
28
20
|
const o = document.getElementById(t);
|
|
29
21
|
if (o) {
|
|
30
|
-
const e = o.getBoundingClientRect().top + window.scrollY -
|
|
22
|
+
const e = o.getBoundingClientRect().top + window.scrollY - u;
|
|
31
23
|
window.scrollTo({ top: e, behavior: "smooth" });
|
|
32
24
|
}
|
|
33
|
-
|
|
25
|
+
c == null || c(t);
|
|
34
26
|
},
|
|
35
|
-
[
|
|
27
|
+
[u, c]
|
|
36
28
|
);
|
|
37
29
|
y(() => {
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
30
|
+
if (l.length !== 0)
|
|
31
|
+
return i.current = new IntersectionObserver(
|
|
40
32
|
(t) => {
|
|
41
33
|
const o = t.filter((e) => e.isIntersecting).sort((e, s) => {
|
|
42
|
-
const
|
|
43
|
-
return Math.abs(
|
|
34
|
+
const n = e.boundingClientRect.top, _ = s.boundingClientRect.top;
|
|
35
|
+
return Math.abs(n - r) - Math.abs(_ - r);
|
|
44
36
|
});
|
|
45
37
|
if (o.length > 0) {
|
|
46
38
|
const s = o[0].target.id;
|
|
47
|
-
|
|
39
|
+
l.includes(s) && v(s);
|
|
48
40
|
}
|
|
49
41
|
},
|
|
50
|
-
{ rootMargin: `-${
|
|
51
|
-
),
|
|
42
|
+
{ rootMargin: `-${r}px 0px -50% 0px`, threshold: [0, 0.25, 0.5, 0.75, 1] }
|
|
43
|
+
), l.forEach((t) => {
|
|
52
44
|
var e;
|
|
53
45
|
const o = document.getElementById(t);
|
|
54
|
-
o && ((e =
|
|
46
|
+
o && ((e = i.current) == null || e.observe(o));
|
|
55
47
|
}), () => {
|
|
56
48
|
var t;
|
|
57
|
-
(t =
|
|
49
|
+
(t = i.current) == null || t.disconnect(), i.current = null;
|
|
58
50
|
};
|
|
59
|
-
}, [
|
|
51
|
+
}, [l.join(","), r]);
|
|
60
52
|
const T = (t, o) => {
|
|
61
53
|
var s;
|
|
62
54
|
const e = g === t.id;
|
|
63
|
-
return /* @__PURE__ */ L("div", { className:
|
|
64
|
-
/* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ L("div", { className: a(o && M), children: [
|
|
56
|
+
/* @__PURE__ */ d(
|
|
65
57
|
"div",
|
|
66
58
|
{
|
|
67
59
|
role: "button",
|
|
68
60
|
tabIndex: 0,
|
|
69
|
-
onClick: () =>
|
|
70
|
-
onKeyDown: (
|
|
71
|
-
className:
|
|
72
|
-
children: /* @__PURE__ */
|
|
61
|
+
onClick: () => p(t.id),
|
|
62
|
+
onKeyDown: (n) => n.key === "Enter" && p(t.id),
|
|
63
|
+
className: a(B, e && j),
|
|
64
|
+
children: /* @__PURE__ */ d(F, { variant: "body2", className: a(e && "bear-font-medium"), children: t.label })
|
|
73
65
|
}
|
|
74
66
|
),
|
|
75
|
-
(s = t.children) == null ? void 0 : s.map((
|
|
67
|
+
(s = t.children) == null ? void 0 : s.map((n) => T(n, !0))
|
|
76
68
|
] }, t.id);
|
|
77
|
-
}, A =
|
|
78
|
-
return /* @__PURE__ */
|
|
69
|
+
}, A = a(K, D, m && "bear-sticky", h);
|
|
70
|
+
return /* @__PURE__ */ d(
|
|
79
71
|
"nav",
|
|
80
72
|
{
|
|
81
73
|
className: A,
|
|
82
|
-
style:
|
|
74
|
+
style: m ? { top: b } : void 0,
|
|
83
75
|
"data-testid": I,
|
|
84
76
|
...S,
|
|
85
|
-
children:
|
|
77
|
+
children: f.map((t) => T(t, !1))
|
|
86
78
|
}
|
|
87
79
|
);
|
|
88
80
|
};
|
|
89
81
|
export {
|
|
90
|
-
|
|
82
|
+
k as Anchor
|
|
91
83
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(n){const e=[],l=o=>{o.forEach(c=>{var t;e.push(c.id),(t=c.children)!=null&&t.length&&l(c.children)})};return l(n),e}exports.collectIds=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),d=require("../../utils/cn.cjs"),I=require("./Autocomplete.utils.cjs"),O=({options:j,value:o="",onChange:n,onSelect:u,placeholder:N="Start typing...",label:y,helperText:h,error:c,disabled:i=!1,freeSolo:p=!1,loading:w=!1,filterOptions:A=I.defaultFilter,className:D,testId:E})=>{const[f,s]=t.useState(!1),[b,g]=t.useState(-1),x=t.useRef(null),k=t.useRef(null),m=t.useRef(null),l=A(j,o);t.useEffect(()=>{const e=a=>{x.current&&!x.current.contains(a.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),t.useEffect(()=>{g(-1)},[o]),t.useEffect(()=>{if(b>=0&&m.current){const e=m.current.children[b];e&&e.scrollIntoView({block:"nearest"})}},[b]);const R=e=>{const a=e.target.value;n==null||n(a),s(!0)},v=e=>{var a;n==null||n(e.label),u==null||u(e),s(!1),(a=k.current)==null||a.blur()},z=e=>{if(!f){(e.key==="ArrowDown"||e.key==="ArrowUp")&&(s(!0),e.preventDefault());return}switch(e.key){case"ArrowDown":e.preventDefault(),g(a=>a<l.length-1?a+1:0);break;case"ArrowUp":e.preventDefault(),g(a=>a>0?a-1:l.length-1);break;case"Enter":e.preventDefault(),b>=0&&l[b]?v(l[b]):p&&o&&s(!1);break;case"Escape":s(!1);break}};return r.jsxs("div",{className:d.cn("bear-w-full bear-relative",D),ref:x,"data-testid":E,children:[y&&r.jsx("label",{className:"bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200 bear-mb-1.5",children:y}),r.jsxs("div",{className:"bear-relative",children:[r.jsx("input",{ref:k,type:"text",value:o,onChange:R,onFocus:()=>s(!0),onKeyDown:z,placeholder:N,disabled:i,className:d.cn("bear-w-full bear-px-4 bear-py-2.5 bear-pr-10 bear-rounded-lg bear-border","bear-bg-white dark:bear-bg-gray-900","bear-text-sm bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400","bear-transition-colors bear-outline-none",c?"bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20":"bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-amber-500 focus:bear-ring-2 focus:bear-ring-amber-500/20",i&&"bear-opacity-50 bear-cursor-not-allowed bear-bg-gray-100 dark:bear-bg-gray-800")}),r.jsx("div",{className:"bear-absolute bear-right-3 bear-top-1/2 bear-transform bear--translate-y-1/2",children:w?r.jsxs("svg",{className:"bear-animate-spin bear-w-4 bear-h-4 bear-text-gray-400",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{className:"bear-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"bear-opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):r.jsx("svg",{className:"bear-w-4 bear-h-4 bear-text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]}),f&&!i&&l.length>0&&r.jsx("div",{ref:m,className:"bear-absolute bear-z-50 bear-w-full bear-mt-1 bear-py-1 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-max-h-60 bear-overflow-auto",children:l.map((e,a)=>r.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>v(e),className:d.cn("bear-w-full bear-px-4 bear-py-2 bear-text-left bear-text-sm bear-transition-colors","bear-text-gray-900 dark:bear-text-white",a===b?"bear-bg-amber-50 dark:bear-bg-amber-900/20":"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-700",e.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),children:[r.jsx("div",{className:"bear-font-medium",children:e.label}),e.description&&r.jsx("div",{className:"bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-mt-0.5",children:e.description})]},e.value))}),f&&!i&&l.length===0&&o&&!w&&r.jsx("div",{className:"bear-absolute bear-z-50 bear-w-full bear-mt-1 bear-py-3 bear-px-4 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-text-sm bear-text-gray-500",children:p?"Press Enter to use this value":"No results found"}),(h||c)&&r.jsx("p",{className:d.cn("bear-mt-1.5 bear-text-xs",c?"bear-text-red-500":"bear-text-gray-500 dark:bear-text-gray-400"),children:c||h})]})};exports.Autocomplete=O;
|
|
@@ -1,119 +1,112 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
helperText: v,
|
|
20
|
-
error: c,
|
|
21
|
-
disabled: d = !1,
|
|
22
|
-
freeSolo: N = !1,
|
|
23
|
-
loading: D = !1,
|
|
24
|
-
filterOptions: z = C,
|
|
25
|
-
className: I,
|
|
1
|
+
import { jsxs as d, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useRef as h, useEffect as x } from "react";
|
|
3
|
+
import { cn as c } from "../../utils/cn.js";
|
|
4
|
+
import { defaultFilter as V } from "./Autocomplete.utils.js";
|
|
5
|
+
const M = ({
|
|
6
|
+
options: E,
|
|
7
|
+
value: o = "",
|
|
8
|
+
onChange: l,
|
|
9
|
+
onSelect: u,
|
|
10
|
+
placeholder: z = "Start typing...",
|
|
11
|
+
label: p,
|
|
12
|
+
helperText: w,
|
|
13
|
+
error: n,
|
|
14
|
+
disabled: i = !1,
|
|
15
|
+
freeSolo: k = !1,
|
|
16
|
+
loading: v = !1,
|
|
17
|
+
filterOptions: I = V,
|
|
18
|
+
className: L,
|
|
26
19
|
testId: O
|
|
27
20
|
}) => {
|
|
28
|
-
const [m,
|
|
29
|
-
|
|
21
|
+
const [m, t] = A(!1), [b, f] = A(-1), g = h(null), N = h(null), y = h(null), s = I(E, o);
|
|
22
|
+
x(() => {
|
|
30
23
|
const e = (r) => {
|
|
31
|
-
|
|
24
|
+
g.current && !g.current.contains(r.target) && t(!1);
|
|
32
25
|
};
|
|
33
26
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
34
|
-
}, []),
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
if (
|
|
38
|
-
const e =
|
|
27
|
+
}, []), x(() => {
|
|
28
|
+
f(-1);
|
|
29
|
+
}, [o]), x(() => {
|
|
30
|
+
if (b >= 0 && y.current) {
|
|
31
|
+
const e = y.current.children[b];
|
|
39
32
|
e && e.scrollIntoView({ block: "nearest" });
|
|
40
33
|
}
|
|
41
|
-
}, [
|
|
34
|
+
}, [b]);
|
|
42
35
|
const R = (e) => {
|
|
43
36
|
const r = e.target.value;
|
|
44
|
-
|
|
45
|
-
},
|
|
37
|
+
l == null || l(r), t(!0);
|
|
38
|
+
}, D = (e) => {
|
|
46
39
|
var r;
|
|
47
|
-
|
|
40
|
+
l == null || l(e.label), u == null || u(e), t(!1), (r = N.current) == null || r.blur();
|
|
48
41
|
}, j = (e) => {
|
|
49
42
|
if (!m) {
|
|
50
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && (
|
|
43
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (t(!0), e.preventDefault());
|
|
51
44
|
return;
|
|
52
45
|
}
|
|
53
46
|
switch (e.key) {
|
|
54
47
|
case "ArrowDown":
|
|
55
|
-
e.preventDefault(),
|
|
56
|
-
(r) => r <
|
|
48
|
+
e.preventDefault(), f(
|
|
49
|
+
(r) => r < s.length - 1 ? r + 1 : 0
|
|
57
50
|
);
|
|
58
51
|
break;
|
|
59
52
|
case "ArrowUp":
|
|
60
|
-
e.preventDefault(),
|
|
61
|
-
(r) => r > 0 ? r - 1 :
|
|
53
|
+
e.preventDefault(), f(
|
|
54
|
+
(r) => r > 0 ? r - 1 : s.length - 1
|
|
62
55
|
);
|
|
63
56
|
break;
|
|
64
57
|
case "Enter":
|
|
65
|
-
e.preventDefault(),
|
|
58
|
+
e.preventDefault(), b >= 0 && s[b] ? D(s[b]) : k && o && t(!1);
|
|
66
59
|
break;
|
|
67
60
|
case "Escape":
|
|
68
|
-
|
|
61
|
+
t(!1);
|
|
69
62
|
break;
|
|
70
63
|
}
|
|
71
64
|
};
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
|
|
74
|
-
/* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ d("div", { className: c("bear-w-full bear-relative", L), ref: g, "data-testid": O, children: [
|
|
66
|
+
p && /* @__PURE__ */ a("label", { className: "bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200 bear-mb-1.5", children: p }),
|
|
67
|
+
/* @__PURE__ */ d("div", { className: "bear-relative", children: [
|
|
75
68
|
/* @__PURE__ */ a(
|
|
76
69
|
"input",
|
|
77
70
|
{
|
|
78
|
-
ref:
|
|
71
|
+
ref: N,
|
|
79
72
|
type: "text",
|
|
80
|
-
value:
|
|
73
|
+
value: o,
|
|
81
74
|
onChange: R,
|
|
82
|
-
onFocus: () =>
|
|
75
|
+
onFocus: () => t(!0),
|
|
83
76
|
onKeyDown: j,
|
|
84
|
-
placeholder:
|
|
85
|
-
disabled:
|
|
86
|
-
className:
|
|
77
|
+
placeholder: z,
|
|
78
|
+
disabled: i,
|
|
79
|
+
className: c(
|
|
87
80
|
"bear-w-full bear-px-4 bear-py-2.5 bear-pr-10 bear-rounded-lg bear-border",
|
|
88
81
|
"bear-bg-white dark:bear-bg-gray-900",
|
|
89
82
|
"bear-text-sm bear-text-gray-900 dark:bear-text-white",
|
|
90
83
|
"placeholder:bear-text-gray-400",
|
|
91
84
|
"bear-transition-colors bear-outline-none",
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
n ? "bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20" : "bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-amber-500 focus:bear-ring-2 focus:bear-ring-amber-500/20",
|
|
86
|
+
i && "bear-opacity-50 bear-cursor-not-allowed bear-bg-gray-100 dark:bear-bg-gray-800"
|
|
94
87
|
)
|
|
95
88
|
}
|
|
96
89
|
),
|
|
97
|
-
/* @__PURE__ */ a("div", { className: "bear-absolute bear-right-3 bear-top-1/2 bear-transform bear--translate-y-1/2", children:
|
|
90
|
+
/* @__PURE__ */ a("div", { className: "bear-absolute bear-right-3 bear-top-1/2 bear-transform bear--translate-y-1/2", children: v ? /* @__PURE__ */ d("svg", { className: "bear-animate-spin bear-w-4 bear-h-4 bear-text-gray-400", viewBox: "0 0 24 24", fill: "none", children: [
|
|
98
91
|
/* @__PURE__ */ a("circle", { className: "bear-opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
99
92
|
/* @__PURE__ */ a("path", { className: "bear-opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
100
93
|
] }) : /* @__PURE__ */ a("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) })
|
|
101
94
|
] }),
|
|
102
|
-
m && !
|
|
95
|
+
m && !i && s.length > 0 && /* @__PURE__ */ a(
|
|
103
96
|
"div",
|
|
104
97
|
{
|
|
105
|
-
ref:
|
|
98
|
+
ref: y,
|
|
106
99
|
className: "bear-absolute bear-z-50 bear-w-full bear-mt-1 bear-py-1 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-max-h-60 bear-overflow-auto",
|
|
107
|
-
children:
|
|
100
|
+
children: s.map((e, r) => /* @__PURE__ */ d(
|
|
108
101
|
"button",
|
|
109
102
|
{
|
|
110
103
|
type: "button",
|
|
111
104
|
disabled: e.disabled,
|
|
112
|
-
onClick: () =>
|
|
113
|
-
className:
|
|
105
|
+
onClick: () => D(e),
|
|
106
|
+
className: c(
|
|
114
107
|
"bear-w-full bear-px-4 bear-py-2 bear-text-left bear-text-sm bear-transition-colors",
|
|
115
108
|
"bear-text-gray-900 dark:bear-text-white",
|
|
116
|
-
r ===
|
|
109
|
+
r === b ? "bear-bg-amber-50 dark:bear-bg-amber-900/20" : "hover:bear-bg-gray-50 dark:hover:bear-bg-gray-700",
|
|
117
110
|
e.disabled && "bear-opacity-50 bear-cursor-not-allowed"
|
|
118
111
|
),
|
|
119
112
|
children: [
|
|
@@ -125,13 +118,13 @@ const C = (g, b) => {
|
|
|
125
118
|
))
|
|
126
119
|
}
|
|
127
120
|
),
|
|
128
|
-
m && !
|
|
129
|
-
(
|
|
121
|
+
m && !i && s.length === 0 && o && !v && /* @__PURE__ */ a("div", { className: "bear-absolute bear-z-50 bear-w-full bear-mt-1 bear-py-3 bear-px-4 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-text-sm bear-text-gray-500", children: k ? "Press Enter to use this value" : "No results found" }),
|
|
122
|
+
(w || n) && /* @__PURE__ */ a("p", { className: c(
|
|
130
123
|
"bear-mt-1.5 bear-text-xs",
|
|
131
|
-
|
|
132
|
-
), children:
|
|
124
|
+
n ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
|
|
125
|
+
), children: n || w })
|
|
133
126
|
] });
|
|
134
127
|
};
|
|
135
128
|
export {
|
|
136
|
-
|
|
129
|
+
M as Autocomplete
|
|
137
130
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(r,o)=>{const e=o.toLowerCase();return r.filter(t=>{var l;return t.label.toLowerCase().includes(e)||t.value.toLowerCase().includes(e)||((l=t.description)==null?void 0:l.toLowerCase().includes(e))})};exports.defaultFilter=s;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const t = (l, s) => {
|
|
2
|
+
const e = s.toLowerCase();
|
|
3
|
+
return l.filter(
|
|
4
|
+
(o) => {
|
|
5
|
+
var r;
|
|
6
|
+
return o.label.toLowerCase().includes(e) || o.value.toLowerCase().includes(e) || ((r = o.description) == null ? void 0 : r.toLowerCase().includes(e));
|
|
7
|
+
}
|
|
8
|
+
);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
t as defaultFilter
|
|
12
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),s=require("react"),v=require("../../utils/cn.cjs"),y=require("../Button/Button.cjs"),o=require("./BackTop.const.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),s=require("react"),v=require("../../utils/cn.cjs"),y=require("../Button/Button.cjs"),o=require("./BackTop.const.cjs"),_=({bottom:a=o.BACKTOP_DEFAULTS.BOTTOM,right:l=o.BACKTOP_DEFAULTS.RIGHT,visibleAt:b=o.BACKTOP_DEFAULTS.VISIBLE_AT,duration:c=o.BACKTOP_DEFAULTS.DURATION,target:i,children:p,size:u=o.BACKTOP_DEFAULTS.SIZE,variant:h=o.BACKTOP_DEFAULTS.VARIANT,animated:A=o.BACKTOP_DEFAULTS.ANIMATED,className:S,testId:w,onClick:r,...B})=>{const[f,E]=s.useState(!1),t=o.BACKTOP_SIZES[u],n=s.useCallback(()=>i?i():typeof window<"u"?window:null,[i]);s.useEffect(()=>{const e=n();if(!e)return;const T=()=>{const g=e===window?window.scrollY||document.documentElement.scrollTop:e.scrollTop;E(g>=b)};return e.addEventListener("scroll",T,{passive:!0}),T(),()=>{e.removeEventListener("scroll",T)}},[n,b]);const m=s.useCallback(()=>{const e=n();e&&(r==null||r(),e===window?window.scrollTo({top:0,behavior:c>0?"smooth":"auto"}):e.scrollTo({top:0,behavior:c>0?"smooth":"auto"}))},[n,c,r]),L=d.jsx("svg",{width:t.iconSize,height:t.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M18 15l-6-6-6 6"})}),O=u==="sm"?"sm":u==="lg"?"lg":"md";return d.jsx(y.Button,{variant:h,size:O,className:v.cn("Bear-BackTop","!bear-rounded-full !bear-p-0","!bear-fixed !bear-shadow-lg bear-z-[9999]",A&&"bear-transition-all bear-duration-300 bear-ease-out",f?"bear-opacity-100 bear-translate-y-0 bear-scale-100":"bear-opacity-0 bear-translate-y-5 bear-scale-75 bear-pointer-events-none",S),style:{bottom:typeof a=="number"?`${a}px`:a,right:typeof l=="number"?`${l}px`:l,width:t.width,height:t.height,minWidth:t.width},onClick:m,"aria-label":"Scroll to top","data-testid":w,...B,children:p||L})};exports.BackTop=_;
|
|
@@ -18,19 +18,19 @@ const V = ({
|
|
|
18
18
|
onClick: r,
|
|
19
19
|
...S
|
|
20
20
|
}) => {
|
|
21
|
-
const [
|
|
21
|
+
const [g, v] = y(!1), t = z[c], n = b(() => i ? i() : typeof window < "u" ? window : null, [i]);
|
|
22
22
|
A(() => {
|
|
23
23
|
const e = n();
|
|
24
24
|
if (!e) return;
|
|
25
25
|
const d = () => {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const I = e === window ? window.scrollY || document.documentElement.scrollTop : e.scrollTop;
|
|
27
|
+
v(I >= u);
|
|
28
28
|
};
|
|
29
29
|
return e.addEventListener("scroll", d, { passive: !0 }), d(), () => {
|
|
30
30
|
e.removeEventListener("scroll", d);
|
|
31
31
|
};
|
|
32
32
|
}, [n, u]);
|
|
33
|
-
const
|
|
33
|
+
const B = b(() => {
|
|
34
34
|
const e = n();
|
|
35
35
|
e && (r == null || r(), e === window ? window.scrollTo({
|
|
36
36
|
top: 0,
|
|
@@ -39,7 +39,7 @@ const V = ({
|
|
|
39
39
|
top: 0,
|
|
40
40
|
behavior: a > 0 ? "smooth" : "auto"
|
|
41
41
|
}));
|
|
42
|
-
}, [n, a, r]),
|
|
42
|
+
}, [n, a, r]), E = /* @__PURE__ */ p(
|
|
43
43
|
"svg",
|
|
44
44
|
{
|
|
45
45
|
width: t.iconSize,
|
|
@@ -61,9 +61,9 @@ const V = ({
|
|
|
61
61
|
className: x(
|
|
62
62
|
"Bear-BackTop",
|
|
63
63
|
"!bear-rounded-full !bear-p-0",
|
|
64
|
-
"!bear-fixed !bear-shadow-lg",
|
|
64
|
+
"!bear-fixed !bear-shadow-lg bear-z-[9999]",
|
|
65
65
|
f && "bear-transition-all bear-duration-300 bear-ease-out",
|
|
66
|
-
|
|
66
|
+
g ? "bear-opacity-100 bear-translate-y-0 bear-scale-100" : "bear-opacity-0 bear-translate-y-5 bear-scale-75 bear-pointer-events-none",
|
|
67
67
|
h
|
|
68
68
|
),
|
|
69
69
|
style: {
|
|
@@ -71,14 +71,13 @@ const V = ({
|
|
|
71
71
|
right: typeof l == "number" ? `${l}px` : l,
|
|
72
72
|
width: t.width,
|
|
73
73
|
height: t.height,
|
|
74
|
-
minWidth: t.width
|
|
75
|
-
zIndex: 9999
|
|
74
|
+
minWidth: t.width
|
|
76
75
|
},
|
|
77
|
-
onClick:
|
|
76
|
+
onClick: B,
|
|
78
77
|
"aria-label": "Scroll to top",
|
|
79
78
|
"data-testid": w,
|
|
80
79
|
...S,
|
|
81
|
-
children: m ||
|
|
80
|
+
children: m || E
|
|
82
81
|
}
|
|
83
82
|
);
|
|
84
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),g=require("react"),s=require("../../utils/cn.cjs"),Q=require("../Spinner/Spinner.cjs"),j=require("../Typography/Typography.cjs"),X=require("../../hooks/useBearStyles.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const ee=require("../../context/BearProvider.cjs"),n=require("./Button.constants.cjs"),q=require("./Button.utils.cjs"),re=require("./useSpotlight.cjs"),O=g.forwardRef((V,i)=>{var C,$;const{variant:e="primary",size:l="md",loading:c=!1,loadingText:h,fullWidth:E=!1,icon:b,iconPosition:_="left",leftIcon:w,rightIcon:A,textVariant:y="inherit",iconOnly:v=!1,spotlight:x=!1,spotlightColor:R="rgba(255, 255, 255, 0.35)",spotlightSize:u=150,disabled:U,className:k,children:z,testId:L,bis:P,style:Z,onMouseMove:D,onMouseEnter:F,onMouseLeave:H,...W}=V,Y=U||c,p=X.useBearStyles(P,Z),N=w??(b&&_==="left"?b:void 0),T=A??(b&&_==="right"?b:void 0),a=g.useContext(ee.BearContext),f=(($=(C=a==null?void 0:a.components)==null?void 0:C.Button)==null?void 0:$.root)||{},I=(a==null?void 0:a.customVariants)||{},B=!q.isBuiltInVariant(e)&&e in I,t=B?I[e]:null,{spotlightRef:S,position:M,isHovered:G,handlers:m}=re.useSpotlight({enabled:x,onMouseMove:D,onMouseEnter:F,onMouseLeave:H}),o=n.VARIANT_DEFAULTS[e]||n.VARIANT_DEFAULTS.primary,J=g.useMemo(()=>B&&t?{backgroundColor:`var(--bear-${e}-bg, ${t.bg})`,color:t.text||"#ffffff",borderColor:t.border,"--bear-ring-color":t.ring||t.bg,...f,...p}:{backgroundColor:`var(--bear-btn-${e}-bg, ${o.bg})`,color:e==="outline"||e==="ghost"?`var(--bear-btn-${e}-text, ${o.text||"inherit"})`:"white",borderColor:e==="outline"?`var(--bear-btn-${e}-border, ${o.border||o.bg})`:void 0,"--bear-ring-color":`var(--bear-btn-${e}-ring, ${o.ring})`,...f,...p},[e,o,f,p,B,t]),K=g.useCallback(d=>{S.current=d,typeof i=="function"?i(d):i&&(i.current=d)},[i,S]);return r.jsxs("button",{ref:K,disabled:Y,"aria-busy":c||void 0,style:J,className:s.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",v?n.BUTTON_ICON_ONLY_SIZE[l]:n.BUTTON_SIZE[l],v&&"bear-rounded-lg",q.isBuiltInVariant(e)?n.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",E&&"bear-w-full",c&&"bear-cursor-wait",k),"data-testid":L,onMouseMove:m.handleMouseMove,onMouseEnter:m.handleMouseEnter,onMouseLeave:m.handleMouseLeave,...W,children:[x&&r.jsx("span",{className:s.cn("Bear-Button__spotlight","bear-absolute bear-left-0 bear-top-0 bear-rounded-full bear-pointer-events-none bear-z-[1]","bear-transition-opacity bear-duration-150 bear-ease-out",G?"bear-opacity-100":"bear-opacity-0"),"aria-hidden":"true",style:{width:u,height:u,background:`radial-gradient(circle at center, ${R} 0%, transparent 70%)`,transform:`translate(${M.x-u/2}px, ${M.y-u/2}px)`,mixBlendMode:"overlay"}}),c&&r.jsxs("span",{className:s.cn("Bear-Button__loading bear-inline-flex bear-items-center bear-gap-2 bear-relative bear-z-10",!h&&"bear-absolute"),children:[r.jsx(Q.Spinner,{size:l==="xs"?"xs":"sm",className:"Bear-Button__spinner"}),h&&r.jsx(j.Typography,{variant:y,className:"Bear-Button__text",children:h})]}),r.jsxs("span",{className:s.cn("Bear-Button__content bear-inline-flex bear-items-center bear-gap-inherit bear-relative bear-z-10",c&&"bear-invisible"),children:[N&&r.jsx("span",{className:s.cn("Bear-Button__icon Bear-Button__icon--left bear-inline-flex bear-shrink-0",n.BUTTON_ICON_SIZE[l]),children:N}),r.jsx(j.Typography,{variant:y,className:"Bear-Button__text",children:z}),T&&r.jsx("span",{className:s.cn("Bear-Button__icon Bear-Button__icon--right bear-inline-flex bear-shrink-0",n.BUTTON_ICON_SIZE[l]),children:T})]})]})});O.displayName="Button";exports.Button=O;
|
|
@@ -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={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"},
|
|
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:"bear-w-6 bear-h-6 bear-p-0",sm:"bear-w-8 bear-h-8 bear-p-0",md:"bear-w-10 bear-h-10 bear-p-0",lg:"bear-w-12 bear-h-12 bear-p-0",xl:"bear-w-14 bear-h-14 bear-p-0"},a={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"},b={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
|
+
`},o={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_ONLY_SIZE=e;exports.BUTTON_ICON_SIZE=a;exports.BUTTON_SIZE=r;exports.BUTTON_VARIANT=b;exports.VARIANT_DEFAULTS=o;
|
|
@@ -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_ONLY_SIZE: Record<BearSize, string>;
|
|
3
4
|
export declare const BUTTON_ICON_SIZE: Record<BearSize, string>;
|
|
4
5
|
/**
|
|
5
6
|
* Button variants using CSS variables for full customization
|
|
@@ -5,12 +5,18 @@ 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: "bear-w-6 bear-h-6 bear-p-0",
|
|
9
|
+
sm: "bear-w-8 bear-h-8 bear-p-0",
|
|
10
|
+
md: "bear-w-10 bear-h-10 bear-p-0",
|
|
11
|
+
lg: "bear-w-12 bear-h-12 bear-p-0",
|
|
12
|
+
xl: "bear-w-14 bear-h-14 bear-p-0"
|
|
13
|
+
}, a = {
|
|
8
14
|
xs: "[&_svg]:bear-w-3 [&_svg]:bear-h-3",
|
|
9
15
|
sm: "[&_svg]:bear-w-4 [&_svg]:bear-h-4",
|
|
10
16
|
md: "[&_svg]:bear-w-5 [&_svg]:bear-h-5",
|
|
11
17
|
lg: "[&_svg]:bear-w-5 [&_svg]:bear-h-5",
|
|
12
18
|
xl: "[&_svg]:bear-w-6 [&_svg]:bear-h-6"
|
|
13
|
-
},
|
|
19
|
+
}, b = {
|
|
14
20
|
primary: `
|
|
15
21
|
bear-btn-primary
|
|
16
22
|
bear-text-white bear-relative bear-overflow-hidden
|
|
@@ -66,7 +72,7 @@ const r = {
|
|
|
66
72
|
focus:bear-ring-2 focus:bear-ring-offset-2
|
|
67
73
|
disabled:bear-opacity-50 disabled:bear-cursor-not-allowed
|
|
68
74
|
`
|
|
69
|
-
},
|
|
75
|
+
}, o = {
|
|
70
76
|
primary: { bg: "var(--bear-primary-500)", hover: "var(--bear-primary-600)", active: "var(--bear-primary-700)", ring: "var(--bear-primary-500)" },
|
|
71
77
|
secondary: { bg: "var(--bear-secondary-500)", hover: "var(--bear-secondary-600)", active: "var(--bear-secondary-700)", ring: "var(--bear-secondary-500)" },
|
|
72
78
|
success: { bg: "var(--bear-success-500)", hover: "var(--bear-success-600)", active: "var(--bear-success-700)", ring: "var(--bear-success-500)" },
|
|
@@ -78,8 +84,9 @@ const r = {
|
|
|
78
84
|
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)" }
|
|
79
85
|
};
|
|
80
86
|
export {
|
|
81
|
-
e as
|
|
87
|
+
e as BUTTON_ICON_ONLY_SIZE,
|
|
88
|
+
a as BUTTON_ICON_SIZE,
|
|
82
89
|
r as BUTTON_SIZE,
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
b as BUTTON_VARIANT,
|
|
91
|
+
o as VARIANT_DEFAULTS
|
|
85
92
|
};
|