@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
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { useRef as L, useCallback as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { DEFAULT_THRESHOLD as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as R, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as L, useCallback as g, useEffect as x } from "react";
|
|
3
|
+
import { cn as I } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_THRESHOLD as O, ROOT_CLASSES as D, MANUAL_BTN_CLASSES as T, END_CLASSES as j, LOADER_CLASSES as k, SPINNER_CLASSES as F } from "./InfiniteScroll.const.js";
|
|
5
|
+
const B = (N) => {
|
|
6
6
|
const {
|
|
7
|
-
onLoadMore:
|
|
7
|
+
onLoadMore: c,
|
|
8
8
|
hasMore: e,
|
|
9
|
-
loading:
|
|
10
|
-
threshold: l =
|
|
11
|
-
manual:
|
|
12
|
-
loader:
|
|
9
|
+
loading: n = !1,
|
|
10
|
+
threshold: l = O,
|
|
11
|
+
manual: s = !1,
|
|
12
|
+
loader: i,
|
|
13
13
|
endMessage: d,
|
|
14
|
-
loadMoreLabel:
|
|
15
|
-
inverse:
|
|
16
|
-
children:
|
|
17
|
-
className:
|
|
18
|
-
testId:
|
|
19
|
-
...
|
|
20
|
-
} = N, o = L(null), f = L(
|
|
21
|
-
f.current =
|
|
22
|
-
const a =
|
|
23
|
-
f.current || !e ||
|
|
24
|
-
}, [
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
29
|
-
const
|
|
30
|
-
(
|
|
31
|
-
var
|
|
32
|
-
(
|
|
14
|
+
loadMoreLabel: E = "Load more",
|
|
15
|
+
inverse: t = !1,
|
|
16
|
+
children: v,
|
|
17
|
+
className: b,
|
|
18
|
+
testId: p,
|
|
19
|
+
...A
|
|
20
|
+
} = N, o = L(null), f = L(n);
|
|
21
|
+
f.current = n;
|
|
22
|
+
const a = g(() => {
|
|
23
|
+
f.current || !e || c();
|
|
24
|
+
}, [c, e]);
|
|
25
|
+
x(() => {
|
|
26
|
+
if (s || !e) return;
|
|
27
|
+
const S = o.current;
|
|
28
|
+
if (!S) return;
|
|
29
|
+
const u = new IntersectionObserver(
|
|
30
|
+
(C) => {
|
|
31
|
+
var h;
|
|
32
|
+
(h = C[0]) != null && h.isIntersecting && a();
|
|
33
33
|
},
|
|
34
34
|
{ threshold: 0, rootMargin: `${Math.round(l * 100)}px` }
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
}, [
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
!
|
|
43
|
-
!
|
|
44
|
-
e &&
|
|
45
|
-
!e && d && /* @__PURE__ */ r("div", { className:
|
|
36
|
+
return u.observe(S), () => u.disconnect();
|
|
37
|
+
}, [s, e, a, l]);
|
|
38
|
+
const m = /* @__PURE__ */ r("div", { className: k, children: /* @__PURE__ */ r("div", { className: F }) }), M = /* @__PURE__ */ R(_, { children: [
|
|
39
|
+
t && e && !s && /* @__PURE__ */ r("div", { ref: o, className: "bear-h-px" }),
|
|
40
|
+
t && n && (i ?? m),
|
|
41
|
+
v,
|
|
42
|
+
!t && n && (i ?? m),
|
|
43
|
+
!t && e && !s && /* @__PURE__ */ r("div", { ref: o, className: "bear-h-px" }),
|
|
44
|
+
e && s && !n && /* @__PURE__ */ r("button", { type: "button", onClick: a, className: T, children: E }),
|
|
45
|
+
!e && d && /* @__PURE__ */ r("div", { className: j, children: d })
|
|
46
46
|
] });
|
|
47
|
-
return /* @__PURE__ */ r("div", { className:
|
|
47
|
+
return /* @__PURE__ */ r("div", { className: I(D, b), "data-testid": p, ...A, children: M });
|
|
48
48
|
};
|
|
49
49
|
export {
|
|
50
|
-
|
|
50
|
+
B as InfiniteScroll
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),t=require("react"),v=require("../../utils/cn.cjs"),P=require("./MentionsInput.utils.cjs"),U={sm:"bear-h-8 bear-text-sm bear-px-3",md:"bear-h-10 bear-text-base bear-px-4",lg:"bear-h-12 bear-text-lg bear-px-5"},V=({value:x,defaultValue:O="",onChange:s,onMentionSelect:h,options:D,trigger:l="@",placeholder:M="Type @ to mention...",disabled:w=!1,maxSuggestions:S=5,filterOptions:N=P.defaultFilter,size:T="md",fullWidth:L=!1,className:$})=>{const[A,k]=t.useState(O),[i,K]=t.useState(""),[Q,f]=t.useState(!1),[u,d]=t.useState(0),[p,B]=t.useState(null),g=t.useRef(null),q=t.useRef(null),y=t.useRef(null),a=x??A,o=N(D,i).slice(0,S),I=Q&&i.length>=0,z=t.useCallback(()=>{const e=a.lastIndexOf(l);if(e===-1)return{query:"",start:null};const r=a.slice(e+l.length),n=r.indexOf(" ");return{query:n===-1?r:r.slice(0,n),start:e}},[a,l]);t.useEffect(()=>{const{query:e,start:r}=z();K(e),B(r),f(r!==null&&!e.includes(" "))},[a,z]),t.useEffect(()=>{d(0)},[i]),t.useEffect(()=>{if(u>=0&&y.current){const e=y.current.children[u];e==null||e.scrollIntoView({block:"nearest"})}},[u]),t.useEffect(()=>{const e=r=>{g.current&&!g.current.contains(r.target)&&f(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const E=e=>{const r=new RegExp(`${l}(\\w+)`,"g"),n=[];let b;for(;(b=r.exec(e))!==null;)n.push(b[1]);return[...new Set(n)]},F=e=>{const r=e.target.value;x===void 0&&k(r),s==null||s(r,E(r))},R=e=>{var j;if(p==null)return;const r=a.slice(0,p),n=a.slice(p+l.length+i.length),b=`${l}${e.value}`,m=r+b+" "+n;x===void 0&&k(m),s==null||s(m,E(m)),h==null||h(e),f(!1),(j=q.current)==null||j.focus()},H=e=>{if(!(!I||o.length===0)){if(e.key==="ArrowDown"){e.preventDefault(),d(r=>Math.min(r+1,o.length-1));return}if(e.key==="ArrowUp"){e.preventDefault(),d(r=>Math.max(r-1,0));return}if(e.key==="Enter"||e.key==="Tab"){e.preventDefault();const r=o[u];r&&R(r);return}e.key==="Escape"&&f(!1)}};return c.jsxs("div",{ref:g,className:v.cn("Bear-MentionsInput bear-relative",L&&"bear-w-full",$),children:[c.jsx("input",{ref:q,type:"text",value:a,onChange:F,onKeyDown:H,placeholder:M,disabled:w,className:v.cn("bear-w-full bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-900 bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-500 dark:placeholder:bear-text-zinc-500 bear-outline-none bear-transition-colors focus:bear-border-bear-500 focus:bear-ring-2 focus:bear-ring-bear-500/20",w&&"bear-opacity-50 bear-cursor-not-allowed",U[T])}),I&&o.length>0&&c.jsx("div",{ref:y,className:"bear-absolute bear-z-50 bear-mt-1 bear-w-full bear-max-h-48 bear-overflow-auto bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-800 bear-py-1 bear-shadow-lg",children:o.map((e,r)=>c.jsxs("button",{type:"button",className:v.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-left bear-text-gray-800 dark:bear-text-zinc-200 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-transition-colors",r===u&&"bear-bg-gray-100 dark:bear-bg-zinc-700"),onMouseEnter:()=>d(r),onClick:()=>R(e),children:[e.avatar&&c.jsx("span",{className:"bear-shrink-0",children:e.avatar}),c.jsx("span",{children:e.label})]},e.value))})]})};exports.MentionsInput=V;
|
|
@@ -1,130 +1,126 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
1
|
+
import { jsxs as L, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useRef as v, useCallback as P, useEffect as h } from "react";
|
|
3
|
+
import { cn as k } from "../../utils/cn.js";
|
|
4
|
+
import { defaultFilter as S } from "./MentionsInput.utils.js";
|
|
5
|
+
const W = {
|
|
5
6
|
sm: "bear-h-8 bear-text-sm bear-px-3",
|
|
6
7
|
md: "bear-h-10 bear-text-base bear-px-4",
|
|
7
8
|
lg: "bear-h-12 bear-text-lg bear-px-5"
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, Z = ({
|
|
14
|
-
value: o,
|
|
15
|
-
defaultValue: m = "",
|
|
16
|
-
onChange: t,
|
|
17
|
-
onMentionSelect: s,
|
|
9
|
+
}, C = ({
|
|
10
|
+
value: p,
|
|
11
|
+
defaultValue: M = "",
|
|
12
|
+
onChange: n,
|
|
13
|
+
onMentionSelect: m,
|
|
18
14
|
options: T,
|
|
19
|
-
trigger:
|
|
15
|
+
trigger: s = "@",
|
|
20
16
|
placeholder: $ = "Type @ to mention...",
|
|
21
|
-
disabled:
|
|
17
|
+
disabled: z = !1,
|
|
22
18
|
maxSuggestions: j = 5,
|
|
23
|
-
filterOptions: A =
|
|
19
|
+
filterOptions: A = S,
|
|
24
20
|
size: K = "md",
|
|
25
21
|
fullWidth: Q = !1,
|
|
26
22
|
className: B
|
|
27
23
|
}) => {
|
|
28
|
-
const [F,
|
|
29
|
-
const e =
|
|
24
|
+
const [F, I] = b(M), [i, H] = b(""), [U, u] = b(!1), [l, d] = b(0), [x, V] = b(null), g = v(null), q = v(null), y = v(null), t = p ?? F, o = A(T, i).slice(0, j), E = U && i.length >= 0, D = P(() => {
|
|
25
|
+
const e = t.lastIndexOf(s);
|
|
30
26
|
if (e === -1) return { query: "", start: null };
|
|
31
|
-
const r =
|
|
32
|
-
return { query:
|
|
33
|
-
}, [
|
|
34
|
-
|
|
35
|
-
const { query: e, start: r } =
|
|
36
|
-
H(e),
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
if (
|
|
41
|
-
const e = y.current.children[
|
|
27
|
+
const r = t.slice(e + s.length), a = r.indexOf(" ");
|
|
28
|
+
return { query: a === -1 ? r : r.slice(0, a), start: e };
|
|
29
|
+
}, [t, s]);
|
|
30
|
+
h(() => {
|
|
31
|
+
const { query: e, start: r } = D();
|
|
32
|
+
H(e), V(r), u(r !== null && !e.includes(" "));
|
|
33
|
+
}, [t, D]), h(() => {
|
|
34
|
+
d(0);
|
|
35
|
+
}, [i]), h(() => {
|
|
36
|
+
if (l >= 0 && y.current) {
|
|
37
|
+
const e = y.current.children[l];
|
|
42
38
|
e == null || e.scrollIntoView({ block: "nearest" });
|
|
43
39
|
}
|
|
44
|
-
}, [
|
|
40
|
+
}, [l]), h(() => {
|
|
45
41
|
const e = (r) => {
|
|
46
|
-
|
|
42
|
+
g.current && !g.current.contains(r.target) && u(!1);
|
|
47
43
|
};
|
|
48
44
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
49
45
|
}, []);
|
|
50
46
|
const O = (e) => {
|
|
51
|
-
const r = new RegExp(`${
|
|
52
|
-
let
|
|
53
|
-
for (; (
|
|
54
|
-
|
|
55
|
-
return [...new Set(
|
|
56
|
-
},
|
|
47
|
+
const r = new RegExp(`${s}(\\w+)`, "g"), a = [];
|
|
48
|
+
let c;
|
|
49
|
+
for (; (c = r.exec(e)) !== null; )
|
|
50
|
+
a.push(c[1]);
|
|
51
|
+
return [...new Set(a)];
|
|
52
|
+
}, G = (e) => {
|
|
57
53
|
const r = e.target.value;
|
|
58
|
-
|
|
54
|
+
p === void 0 && I(r), n == null || n(r, O(r));
|
|
59
55
|
}, N = (e) => {
|
|
60
56
|
var R;
|
|
61
|
-
if (
|
|
62
|
-
const r =
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
if (!(!
|
|
57
|
+
if (x == null) return;
|
|
58
|
+
const r = t.slice(0, x), a = t.slice(x + s.length + i.length), c = `${s}${e.value}`, w = r + c + " " + a;
|
|
59
|
+
p === void 0 && I(w), n == null || n(w, O(w)), m == null || m(e), u(!1), (R = q.current) == null || R.focus();
|
|
60
|
+
}, J = (e) => {
|
|
61
|
+
if (!(!E || o.length === 0)) {
|
|
66
62
|
if (e.key === "ArrowDown") {
|
|
67
|
-
e.preventDefault(),
|
|
63
|
+
e.preventDefault(), d((r) => Math.min(r + 1, o.length - 1));
|
|
68
64
|
return;
|
|
69
65
|
}
|
|
70
66
|
if (e.key === "ArrowUp") {
|
|
71
|
-
e.preventDefault(),
|
|
67
|
+
e.preventDefault(), d((r) => Math.max(r - 1, 0));
|
|
72
68
|
return;
|
|
73
69
|
}
|
|
74
70
|
if (e.key === "Enter" || e.key === "Tab") {
|
|
75
71
|
e.preventDefault();
|
|
76
|
-
const r =
|
|
72
|
+
const r = o[l];
|
|
77
73
|
r && N(r);
|
|
78
74
|
return;
|
|
79
75
|
}
|
|
80
|
-
e.key === "Escape" &&
|
|
76
|
+
e.key === "Escape" && u(!1);
|
|
81
77
|
}
|
|
82
78
|
};
|
|
83
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ L(
|
|
84
80
|
"div",
|
|
85
81
|
{
|
|
86
|
-
ref:
|
|
87
|
-
className:
|
|
82
|
+
ref: g,
|
|
83
|
+
className: k(
|
|
88
84
|
"Bear-MentionsInput bear-relative",
|
|
89
85
|
Q && "bear-w-full",
|
|
90
86
|
B
|
|
91
87
|
),
|
|
92
88
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ f(
|
|
94
90
|
"input",
|
|
95
91
|
{
|
|
96
|
-
ref:
|
|
92
|
+
ref: q,
|
|
97
93
|
type: "text",
|
|
98
|
-
value:
|
|
99
|
-
onChange:
|
|
100
|
-
onKeyDown:
|
|
94
|
+
value: t,
|
|
95
|
+
onChange: G,
|
|
96
|
+
onKeyDown: J,
|
|
101
97
|
placeholder: $,
|
|
102
|
-
disabled:
|
|
103
|
-
className:
|
|
98
|
+
disabled: z,
|
|
99
|
+
className: k(
|
|
104
100
|
"bear-w-full bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-900 bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-500 dark:placeholder:bear-text-zinc-500 bear-outline-none bear-transition-colors focus:bear-border-bear-500 focus:bear-ring-2 focus:bear-ring-bear-500/20",
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
z && "bear-opacity-50 bear-cursor-not-allowed",
|
|
102
|
+
W[K]
|
|
107
103
|
)
|
|
108
104
|
}
|
|
109
105
|
),
|
|
110
|
-
|
|
106
|
+
E && o.length > 0 && /* @__PURE__ */ f(
|
|
111
107
|
"div",
|
|
112
108
|
{
|
|
113
109
|
ref: y,
|
|
114
110
|
className: "bear-absolute bear-z-50 bear-mt-1 bear-w-full bear-max-h-48 bear-overflow-auto bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-800 bear-py-1 bear-shadow-lg",
|
|
115
|
-
children:
|
|
111
|
+
children: o.map((e, r) => /* @__PURE__ */ L(
|
|
116
112
|
"button",
|
|
117
113
|
{
|
|
118
114
|
type: "button",
|
|
119
|
-
className:
|
|
115
|
+
className: k(
|
|
120
116
|
"bear-w-full bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-left bear-text-gray-800 dark:bear-text-zinc-200 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-transition-colors",
|
|
121
|
-
r ===
|
|
117
|
+
r === l && "bear-bg-gray-100 dark:bear-bg-zinc-700"
|
|
122
118
|
),
|
|
123
|
-
onMouseEnter: () =>
|
|
119
|
+
onMouseEnter: () => d(r),
|
|
124
120
|
onClick: () => N(e),
|
|
125
121
|
children: [
|
|
126
|
-
e.avatar && /* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
122
|
+
e.avatar && /* @__PURE__ */ f("span", { className: "bear-shrink-0", children: e.avatar }),
|
|
123
|
+
/* @__PURE__ */ f("span", { children: e.label })
|
|
128
124
|
]
|
|
129
125
|
},
|
|
130
126
|
e.value
|
|
@@ -136,5 +132,5 @@ const J = {
|
|
|
136
132
|
);
|
|
137
133
|
};
|
|
138
134
|
export {
|
|
139
|
-
|
|
135
|
+
C as MentionsInput
|
|
140
136
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(l,r)=>{const e=r.toLowerCase();return l.filter(t=>t.value.toLowerCase().includes(e)||String(t.label).toLowerCase().includes(e))};exports.defaultFilter=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../utils/cn.cjs");require("react");const u=require("../Icon/Icon.cjs"),r=require("./PageNav.const.cjs"),p=({size:a})=>e.jsx(u.Icon,{size:a,children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}),h=({size:a})=>e.jsx(u.Icon,{size:a,children:e.jsx("polyline",{points:"9 6 15 12 9 18"})}),d=({item:a,direction:l,linkClass:n,labelClass:b,iconClass:t,sizeClass:x,iconSize:c})=>{const s=l==="prev",o=a.href?"a":"button",j=a.href?{href:a.href}:{type:"button",onClick:a.onClick};return e.jsxs(o,{...j,className:i.cn("bear-flex bear-flex-col bear-gap-1 bear-no-underline bear-min-w-0",s?"bear-items-start":"bear-items-end bear-ml-auto",n,x),children:[e.jsx("span",{className:i.cn("bear-text-[10px] bear-font-semibold bear-uppercase bear-tracking-wider",b),children:s?"Previous":"Next"}),e.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1.5 bear-font-medium",children:[s&&e.jsx("span",{className:i.cn("bear-flex-shrink-0",t),children:a.icon??e.jsx(p,{size:c})}),e.jsx("span",{className:"bear-truncate",children:a.label}),!s&&e.jsx("span",{className:i.cn("bear-flex-shrink-0",t),children:a.icon??e.jsx(h,{size:c})})]})]})},f=({prev:a,next:l,size:n="md",variant:b="default",className:t,testId:x,"aria-label":c="Page navigation"})=>{if(!a&&!l)return null;const s=r.VARIANT_CLASSES[b],o=r.ICON_SIZE[n];return e.jsxs("nav",{"data-testid":x,className:i.cn(r.ROOT_CLASS,"bear-flex bear-items-start bear-justify-between bear-gap-4 bear-border-t bear-border-zinc-700/50",r.SIZE_CLASSES[n],t),"aria-label":c,children:[a?e.jsx(d,{item:a,direction:"prev",linkClass:s.link,labelClass:s.label,iconClass:s.icon,sizeClass:r.LINK_SIZE[n],iconSize:o}):e.jsx("span",{}),l?e.jsx(d,{item:l,direction:"next",linkClass:s.link,labelClass:s.label,iconClass:s.icon,sizeClass:r.LINK_SIZE[n],iconSize:o}):e.jsx("span",{})]})};exports.PageNav=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-PageNav",r={xs:"bear-text-xs bear-py-3",sm:"bear-text-sm bear-py-4",md:"bear-text-sm bear-py-6",lg:"bear-text-base bear-py-8",xl:"bear-text-lg bear-py-10"},a={xs:"bear-px-2 bear-py-1",sm:"bear-px-3 bear-py-1.5",md:"bear-px-4 bear-py-2",lg:"bear-px-5 bear-py-2.5",xl:"bear-px-6 bear-py-3"},b={default:{link:"bear-text-zinc-400 hover:bear-text-pink-400 bear-transition-colors",label:"bear-text-zinc-500",icon:"bear-text-pink-500"},outlined:{link:"bear-border bear-border-zinc-700 bear-rounded-lg hover:bear-border-pink-500 hover:bear-text-pink-400 bear-transition-all",label:"bear-text-zinc-500",icon:"bear-text-pink-500"},filled:{link:"bear-bg-zinc-800/50 bear-rounded-lg hover:bear-bg-pink-500/10 hover:bear-text-pink-400 bear-transition-all",label:"bear-text-zinc-500",icon:"bear-text-pink-500"}},t={xs:12,sm:14,md:16,lg:18,xl:20};exports.ICON_SIZE=t;exports.LINK_SIZE=a;exports.ROOT_CLASS=e;exports.SIZE_CLASSES=r;exports.VARIANT_CLASSES=b;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BearSize } from '../../types';
|
|
2
|
+
export declare const ROOT_CLASS = "Bear-PageNav";
|
|
3
|
+
export declare const SIZE_CLASSES: Record<BearSize, string>;
|
|
4
|
+
export declare const LINK_SIZE: Record<BearSize, string>;
|
|
5
|
+
export declare const VARIANT_CLASSES: {
|
|
6
|
+
default: {
|
|
7
|
+
link: string;
|
|
8
|
+
label: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
};
|
|
11
|
+
outlined: {
|
|
12
|
+
link: string;
|
|
13
|
+
label: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
};
|
|
16
|
+
filled: {
|
|
17
|
+
link: string;
|
|
18
|
+
label: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const ICON_SIZE: Record<BearSize, number>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const e = "Bear-PageNav", r = {
|
|
2
|
+
xs: "bear-text-xs bear-py-3",
|
|
3
|
+
sm: "bear-text-sm bear-py-4",
|
|
4
|
+
md: "bear-text-sm bear-py-6",
|
|
5
|
+
lg: "bear-text-base bear-py-8",
|
|
6
|
+
xl: "bear-text-lg bear-py-10"
|
|
7
|
+
}, a = {
|
|
8
|
+
xs: "bear-px-2 bear-py-1",
|
|
9
|
+
sm: "bear-px-3 bear-py-1.5",
|
|
10
|
+
md: "bear-px-4 bear-py-2",
|
|
11
|
+
lg: "bear-px-5 bear-py-2.5",
|
|
12
|
+
xl: "bear-px-6 bear-py-3"
|
|
13
|
+
}, b = {
|
|
14
|
+
default: {
|
|
15
|
+
link: "bear-text-zinc-400 hover:bear-text-pink-400 bear-transition-colors",
|
|
16
|
+
label: "bear-text-zinc-500",
|
|
17
|
+
icon: "bear-text-pink-500"
|
|
18
|
+
},
|
|
19
|
+
outlined: {
|
|
20
|
+
link: "bear-border bear-border-zinc-700 bear-rounded-lg hover:bear-border-pink-500 hover:bear-text-pink-400 bear-transition-all",
|
|
21
|
+
label: "bear-text-zinc-500",
|
|
22
|
+
icon: "bear-text-pink-500"
|
|
23
|
+
},
|
|
24
|
+
filled: {
|
|
25
|
+
link: "bear-bg-zinc-800/50 bear-rounded-lg hover:bear-bg-pink-500/10 hover:bear-text-pink-400 bear-transition-all",
|
|
26
|
+
label: "bear-text-zinc-500",
|
|
27
|
+
icon: "bear-text-pink-500"
|
|
28
|
+
}
|
|
29
|
+
}, t = {
|
|
30
|
+
xs: 12,
|
|
31
|
+
sm: 14,
|
|
32
|
+
md: 16,
|
|
33
|
+
lg: 18,
|
|
34
|
+
xl: 20
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
t as ICON_SIZE,
|
|
38
|
+
a as LINK_SIZE,
|
|
39
|
+
e as ROOT_CLASS,
|
|
40
|
+
r as SIZE_CLASSES,
|
|
41
|
+
b as VARIANT_CLASSES
|
|
42
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { cn as l } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Icon as f } from "../Icon/Icon.js";
|
|
5
|
+
import { ICON_SIZE as C, LINK_SIZE as d, VARIANT_CLASSES as u, SIZE_CLASSES as N, ROOT_CLASS as x } from "./PageNav.const.js";
|
|
6
|
+
const S = ({ size: e }) => /* @__PURE__ */ a(f, { size: e, children: /* @__PURE__ */ a("polyline", { points: "15 18 9 12 15 6" }) }), g = ({ size: e }) => /* @__PURE__ */ a(f, { size: e, children: /* @__PURE__ */ a("polyline", { points: "9 6 15 12 9 18" }) }), m = ({ item: e, direction: s, linkClass: n, labelClass: c, iconClass: i, sizeClass: b, iconSize: t }) => {
|
|
7
|
+
const r = s === "prev", o = e.href ? "a" : "button", h = e.href ? { href: e.href } : { type: "button", onClick: e.onClick };
|
|
8
|
+
return /* @__PURE__ */ p(
|
|
9
|
+
o,
|
|
10
|
+
{
|
|
11
|
+
...h,
|
|
12
|
+
className: l(
|
|
13
|
+
"bear-flex bear-flex-col bear-gap-1 bear-no-underline bear-min-w-0",
|
|
14
|
+
r ? "bear-items-start" : "bear-items-end bear-ml-auto",
|
|
15
|
+
n,
|
|
16
|
+
b
|
|
17
|
+
),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ a("span", { className: l("bear-text-[10px] bear-font-semibold bear-uppercase bear-tracking-wider", c), children: r ? "Previous" : "Next" }),
|
|
20
|
+
/* @__PURE__ */ p("span", { className: "bear-flex bear-items-center bear-gap-1.5 bear-font-medium", children: [
|
|
21
|
+
r && /* @__PURE__ */ a("span", { className: l("bear-flex-shrink-0", i), children: e.icon ?? /* @__PURE__ */ a(S, { size: t }) }),
|
|
22
|
+
/* @__PURE__ */ a("span", { className: "bear-truncate", children: e.label }),
|
|
23
|
+
!r && /* @__PURE__ */ a("span", { className: l("bear-flex-shrink-0", i), children: e.icon ?? /* @__PURE__ */ a(g, { size: t }) })
|
|
24
|
+
] })
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}, E = ({
|
|
29
|
+
prev: e,
|
|
30
|
+
next: s,
|
|
31
|
+
size: n = "md",
|
|
32
|
+
variant: c = "default",
|
|
33
|
+
className: i,
|
|
34
|
+
testId: b,
|
|
35
|
+
"aria-label": t = "Page navigation"
|
|
36
|
+
}) => {
|
|
37
|
+
if (!e && !s) return null;
|
|
38
|
+
const r = u[c], o = C[n];
|
|
39
|
+
return /* @__PURE__ */ p(
|
|
40
|
+
"nav",
|
|
41
|
+
{
|
|
42
|
+
"data-testid": b,
|
|
43
|
+
className: l(
|
|
44
|
+
x,
|
|
45
|
+
"bear-flex bear-items-start bear-justify-between bear-gap-4 bear-border-t bear-border-zinc-700/50",
|
|
46
|
+
N[n],
|
|
47
|
+
i
|
|
48
|
+
),
|
|
49
|
+
"aria-label": t,
|
|
50
|
+
children: [
|
|
51
|
+
e ? /* @__PURE__ */ a(
|
|
52
|
+
m,
|
|
53
|
+
{
|
|
54
|
+
item: e,
|
|
55
|
+
direction: "prev",
|
|
56
|
+
linkClass: r.link,
|
|
57
|
+
labelClass: r.label,
|
|
58
|
+
iconClass: r.icon,
|
|
59
|
+
sizeClass: d[n],
|
|
60
|
+
iconSize: o
|
|
61
|
+
}
|
|
62
|
+
) : /* @__PURE__ */ a("span", {}),
|
|
63
|
+
s ? /* @__PURE__ */ a(
|
|
64
|
+
m,
|
|
65
|
+
{
|
|
66
|
+
item: s,
|
|
67
|
+
direction: "next",
|
|
68
|
+
linkClass: r.link,
|
|
69
|
+
labelClass: r.label,
|
|
70
|
+
iconClass: r.icon,
|
|
71
|
+
sizeClass: d[n],
|
|
72
|
+
iconSize: o
|
|
73
|
+
}
|
|
74
|
+
) : /* @__PURE__ */ a("span", {})
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
E as PageNav
|
|
81
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BearSize } from '../../types';
|
|
3
|
+
export interface PageNavItem {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface PageNavProps {
|
|
10
|
+
prev?: PageNavItem | null;
|
|
11
|
+
next?: PageNavItem | null;
|
|
12
|
+
size?: BearSize;
|
|
13
|
+
variant?: 'default' | 'outlined' | 'filled';
|
|
14
|
+
className?: string;
|
|
15
|
+
testId?: string;
|
|
16
|
+
'aria-label'?: string;
|
|
17
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../utils/cn.cjs");require("react");const m={sm:"bear-h-1.5",md:"bear-h-2.5",lg:"bear-h-4"},f={default:"bear-bg-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../utils/cn.cjs");require("react");const m={sm:"bear-h-1.5",md:"bear-h-2.5",lg:"bear-h-4"},f={default:"bear-bg-bear-500",success:"bear-bg-green-500",warning:"bear-bg-amber-500",danger:"bear-bg-red-500",info:"bear-bg-blue-500"},x=({value:b,max:n=100,size:l="md",color:o="default",showLabel:i=!1,labelPosition:d="outside",striped:r=!1,animated:c=!1,indeterminate:a=!1,className:g,testId:u})=>{const s=Math.min(100,Math.max(0,b/n*100));return e.jsxs("div",{className:t.cn("bear-w-full",g),"data-testid":u,children:[i&&d==="outside"&&e.jsxs("div",{className:"bear-flex bear-justify-between bear-mb-1",children:[e.jsx("span",{className:"bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200",children:"Progress"}),e.jsxs("span",{className:"bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200",children:[Math.round(s),"%"]})]}),e.jsx("div",{className:t.cn("bear-w-full bear-bg-gray-200 dark:bear-bg-gray-700 bear-rounded-full bear-overflow-hidden",m[l]),children:e.jsx("div",{className:t.cn("bear-h-full bear-rounded-full bear-transition-all bear-duration-300 bear-ease-out","bear-flex bear-items-center bear-justify-center",f[o],r&&"bear-bg-stripes",c&&"bear-animate-stripes",a&&"bear-animate-indeterminate"),style:{width:a?"50%":`${s}%`,backgroundSize:r?"1rem 1rem":void 0,backgroundImage:r?"linear-gradient(45deg, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent)":void 0},role:"progressbar","aria-valuenow":a?void 0:b,"aria-valuemin":0,"aria-valuemax":n,children:i&&d==="inside"&&l==="lg"&&!a&&e.jsxs("span",{className:"bear-text-xs bear-font-medium bear-text-white",children:[Math.round(s),"%"]})})})]})};exports.Progress=x;
|
|
@@ -6,20 +6,20 @@ const f = {
|
|
|
6
6
|
md: "bear-h-2.5",
|
|
7
7
|
lg: "bear-h-4"
|
|
8
8
|
}, h = {
|
|
9
|
-
default: "bear-bg-
|
|
9
|
+
default: "bear-bg-bear-500",
|
|
10
10
|
success: "bear-bg-green-500",
|
|
11
|
-
warning: "bear-bg-
|
|
11
|
+
warning: "bear-bg-amber-500",
|
|
12
12
|
danger: "bear-bg-red-500",
|
|
13
13
|
info: "bear-bg-blue-500"
|
|
14
14
|
}, y = ({
|
|
15
15
|
value: n,
|
|
16
16
|
max: l = 100,
|
|
17
17
|
size: d = "md",
|
|
18
|
-
color:
|
|
18
|
+
color: m = "default",
|
|
19
19
|
showLabel: i = !1,
|
|
20
20
|
labelPosition: o = "outside",
|
|
21
21
|
striped: r = !1,
|
|
22
|
-
animated:
|
|
22
|
+
animated: g = !1,
|
|
23
23
|
indeterminate: e = !1,
|
|
24
24
|
className: c,
|
|
25
25
|
testId: u
|
|
@@ -46,9 +46,9 @@ const f = {
|
|
|
46
46
|
className: b(
|
|
47
47
|
"bear-h-full bear-rounded-full bear-transition-all bear-duration-300 bear-ease-out",
|
|
48
48
|
"bear-flex bear-items-center bear-justify-center",
|
|
49
|
-
h[
|
|
49
|
+
h[m],
|
|
50
50
|
r && "bear-bg-stripes",
|
|
51
|
-
|
|
51
|
+
g && "bear-animate-stripes",
|
|
52
52
|
e && "bear-animate-indeterminate"
|
|
53
53
|
),
|
|
54
54
|
style: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),n=require("../../utils/cn.cjs"),j=require("../Icon/Icon.cjs"),l=require("./PropsPlayground.const.cjs"),_=require("./PropsPlayground.utils.cjs"),$=({size:b})=>e.jsx(j.Icon,{size:b,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),q=({size:b})=>e.jsx(j.Icon,{size:b,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),I=({size:b})=>e.jsxs(j.Icon,{size:b,children:[e.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),e.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),e.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),e.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),e.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),e.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),e.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]}),O=({config:b,render:z,title:y="Props",size:S="md",defaultCollapsed:C=!1,showReset:w=!0,columns:P=3,className:L,testId:k})=>{const u=c.useMemo(()=>_.getDefaults(b),[b]),[g,f]=c.useState(u),[p,E]=c.useState(C),o=c.useCallback((r,s)=>{f(i=>({...i,[r]:s}))},[]),A=c.useCallback(()=>{f(u)},[u]),t=l.SIZE_CLASSES[S],N=Object.keys(b).length,m=n.cn("bear-w-full bear-rounded-md bear-border bear-border-zinc-700","bear-bg-zinc-800 bear-text-zinc-100","placeholder:bear-text-zinc-500","focus:bear-outline-none focus:bear-ring-2 focus:bear-ring-pink-500/30 focus:bear-border-pink-500","bear-transition-colors",t.input);return e.jsxs("div",{"data-testid":k,className:n.cn(l.ROOT_CLASS,"bear-rounded-lg bear-border bear-border-zinc-700 bear-overflow-hidden",L),children:[e.jsxs("button",{type:"button",onClick:()=>E(r=>!r),className:n.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-font-medium bear-transition-colors","bear-bg-zinc-800/60 hover:bear-bg-zinc-800","bear-text-zinc-200 bear-border-b bear-border-zinc-700","bear-px-4 bear-py-3",t.text),children:[e.jsx("span",{className:"bear-text-pink-500",children:p?e.jsx(q,{size:12}):e.jsx($,{size:12})}),e.jsx("span",{className:"bear-text-pink-500",children:e.jsx(I,{size:14})}),e.jsx("span",{className:"bear-font-semibold",children:y}),e.jsxs("span",{className:"bear-ml-auto bear-flex bear-items-center bear-gap-2",children:[e.jsxs("span",{className:"bear-text-[10px] bear-font-medium bear-text-zinc-500",children:[N," ",N===1?"control":"controls"]}),w&&!p&&e.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),A()},className:"bear-text-[10px] bear-font-semibold bear-text-pink-500 hover:bear-text-pink-400 hover:bear-underline",children:"Reset"})]})]}),!p&&e.jsx("div",{className:n.cn("bear-bg-zinc-900/50",t.padding),children:e.jsx("div",{className:n.cn("bear-grid",t.gap,l.COLUMN_CLASSES[P]),children:Object.entries(b).map(([r,s])=>{const i=g[r],d=r.replace(/([A-Z])/g," $1").replace(/^./,a=>a.toUpperCase()).trim();if(s.type==="boolean"){const a=i===!0;return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsx("span",{className:n.cn("bear-block bear-font-semibold bear-uppercase bear-tracking-wider bear-text-pink-500 bear-mb-2",t.label),children:l.TYPE_LABELS.boolean}),e.jsxs("label",{className:"bear-flex bear-items-center bear-gap-2.5 bear-cursor-pointer",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":a,onClick:()=>o(r,!a),className:n.cn("bear-relative bear-inline-flex bear-h-5 bear-w-9 bear-flex-shrink-0 bear-rounded-full bear-border-2 bear-border-transparent bear-transition-colors",a?"bear-bg-pink-500":"bear-bg-zinc-600"),children:e.jsx("span",{className:n.cn("bear-pointer-events-none bear-inline-block bear-h-4 bear-w-4 bear-transform bear-rounded-full bear-bg-white bear-shadow bear-transition",a?"bear-translate-x-4":"bear-translate-x-0")})}),e.jsx("span",{className:n.cn("bear-font-medium bear-text-zinc-200 bear-truncate",t.text),children:d})]})]},r)}if(s.type==="select"&&s.options)return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-pink-500",t.label),children:l.TYPE_LABELS.select})]}),e.jsx("select",{id:`pp-${r}`,value:String(i),onChange:a=>{const x=s.options.find(h=>String(h.value)===a.target.value);o(r,x?x.value:a.target.value)},className:n.cn(m,"bear-cursor-pointer bear-appearance-none"),children:s.options.map(a=>e.jsx("option",{value:String(a.value),children:a.label},String(a.value)))})]},r);if(s.type==="number"){const a=Number(i),x=Number.isNaN(a)?s.default:a;return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-pink-500",t.label),children:l.TYPE_LABELS.number})]}),e.jsx("input",{id:`pp-${r}`,type:"number",value:x,min:s.min,max:s.max,step:s.step,onChange:h=>{const v=h.target.valueAsNumber;o(r,Number.isNaN(v)?s.default:v)},className:m})]},r)}return e.jsxs("div",{className:"bear-rounded-lg bear-border bear-border-zinc-700/60 bear-bg-zinc-800/30 bear-p-3",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-1.5",children:[e.jsx("label",{htmlFor:`pp-${r}`,className:n.cn("bear-font-medium bear-text-zinc-300 bear-truncate",t.label),children:d}),e.jsx("span",{className:n.cn("bear-font-semibold bear-uppercase bear-tracking-wider bear-text-pink-500",t.label),children:l.TYPE_LABELS.string})]}),e.jsx("input",{id:`pp-${r}`,type:"text",value:String(i??""),onChange:a=>o(r,a.target.value),placeholder:s.placeholder,className:m})]},r)})})}),e.jsx("div",{className:"bear-border-t bear-border-zinc-700 bear-p-6 bear-bg-zinc-900 bear-flex bear-items-center bear-justify-center bear-min-h-[180px]",children:e.jsx("div",{className:"bear-w-full",children:z(g)})})]})};exports.PropsPlayground=O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Bear-PropsPlayground",a={xs:{padding:"bear-p-2",text:"bear-text-[10px]",gap:"bear-gap-2",label:"bear-text-[9px]",input:"bear-px-1.5 bear-py-0.5 bear-text-[10px]"},sm:{padding:"bear-p-3",text:"bear-text-xs",gap:"bear-gap-2",label:"bear-text-[10px]",input:"bear-px-2 bear-py-1 bear-text-xs"},md:{padding:"bear-p-4",text:"bear-text-sm",gap:"bear-gap-3",label:"bear-text-[11px]",input:"bear-px-2.5 bear-py-1.5 bear-text-xs"},lg:{padding:"bear-p-5",text:"bear-text-sm",gap:"bear-gap-3",label:"bear-text-xs",input:"bear-px-3 bear-py-2 bear-text-sm"},xl:{padding:"bear-p-6",text:"bear-text-base",gap:"bear-gap-4",label:"bear-text-sm",input:"bear-px-3.5 bear-py-2.5 bear-text-base"}},t={1:"bear-grid-cols-1",2:"bear-grid-cols-2",3:"bear-grid-cols-3",4:"bear-grid-cols-4"},r={boolean:"bool",select:"select",number:"num",string:"str"};exports.COLUMN_CLASSES=t;exports.ROOT_CLASS=e;exports.SIZE_CLASSES=a;exports.TYPE_LABELS=r;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BearSize } from '../../types';
|
|
2
|
+
export declare const ROOT_CLASS = "Bear-PropsPlayground";
|
|
3
|
+
export declare const SIZE_CLASSES: Record<BearSize, {
|
|
4
|
+
padding: string;
|
|
5
|
+
text: string;
|
|
6
|
+
gap: string;
|
|
7
|
+
label: string;
|
|
8
|
+
input: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const COLUMN_CLASSES: Record<number, string>;
|
|
11
|
+
export declare const TYPE_LABELS: Record<string, string>;
|