@forgedevstack/bear 1.0.7 → 1.0.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.
Files changed (169) hide show
  1. package/dist/components/Alert/Alert.cjs +1 -1
  2. package/dist/components/Alert/Alert.const.cjs +1 -1
  3. package/dist/components/Alert/Alert.const.d.ts +4 -0
  4. package/dist/components/Alert/Alert.const.js +9 -15
  5. package/dist/components/Alert/Alert.js +43 -38
  6. package/dist/components/AppBar/AppBar.cjs +1 -1
  7. package/dist/components/AppBar/AppBar.js +20 -16
  8. package/dist/components/BackTop/BackTop.cjs +1 -0
  9. package/dist/components/BackTop/BackTop.const.cjs +1 -0
  10. package/dist/components/BackTop/BackTop.const.d.ts +34 -0
  11. package/dist/components/BackTop/BackTop.const.js +29 -0
  12. package/dist/components/BackTop/BackTop.d.ts +21 -0
  13. package/dist/components/BackTop/BackTop.js +87 -0
  14. package/dist/components/BackTop/BackTop.types.d.ts +28 -0
  15. package/dist/components/BackTop/index.d.ts +3 -0
  16. package/dist/components/Badge/Badge.constants.d.ts +4 -4
  17. package/dist/components/Badge/Badge.types.d.ts +3 -3
  18. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  19. package/dist/components/BottomSheet/BottomSheet.js +39 -38
  20. package/dist/components/Button/Button.cjs +1 -1
  21. package/dist/components/Button/Button.constants.cjs +38 -48
  22. package/dist/components/Button/Button.constants.d.ts +22 -3
  23. package/dist/components/Button/Button.constants.js +51 -50
  24. package/dist/components/Button/Button.d.ts +14 -7
  25. package/dist/components/Button/Button.js +123 -45
  26. package/dist/components/Button/Button.types.d.ts +22 -4
  27. package/dist/components/Calendar/Calendar.cjs +1 -1
  28. package/dist/components/Calendar/Calendar.js +3 -2
  29. package/dist/components/Card/Card.const.d.ts +2 -2
  30. package/dist/components/Card/Card.types.d.ts +2 -2
  31. package/dist/components/Chat/Chat.cjs +1 -0
  32. package/dist/components/Chat/Chat.const.cjs +1 -0
  33. package/dist/components/Chat/Chat.const.d.ts +26 -0
  34. package/dist/components/Chat/Chat.const.js +29 -0
  35. package/dist/components/Chat/Chat.d.ts +21 -0
  36. package/dist/components/Chat/Chat.js +179 -0
  37. package/dist/components/Chat/Chat.types.d.ts +55 -0
  38. package/dist/components/Chat/index.d.ts +2 -0
  39. package/dist/components/Confetti/Confetti.cjs +1 -0
  40. package/dist/components/Confetti/Confetti.const.cjs +1 -0
  41. package/dist/components/Confetti/Confetti.const.d.ts +16 -0
  42. package/dist/components/Confetti/Confetti.const.js +36 -0
  43. package/dist/components/Confetti/Confetti.d.ts +23 -0
  44. package/dist/components/Confetti/Confetti.js +94 -0
  45. package/dist/components/Confetti/Confetti.types.d.ts +50 -0
  46. package/dist/components/Confetti/index.d.ts +4 -0
  47. package/dist/components/Confetti/useConfetti.cjs +1 -0
  48. package/dist/components/Confetti/useConfetti.d.ts +13 -0
  49. package/dist/components/Confetti/useConfetti.js +12 -0
  50. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  51. package/dist/components/DatePicker/DatePicker.js +3 -2
  52. package/dist/components/DiffViewer/DiffViewer.cjs +1 -0
  53. package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -0
  54. package/dist/components/DiffViewer/DiffViewer.const.d.ts +18 -0
  55. package/dist/components/DiffViewer/DiffViewer.const.js +21 -0
  56. package/dist/components/DiffViewer/DiffViewer.d.ts +18 -0
  57. package/dist/components/DiffViewer/DiffViewer.js +127 -0
  58. package/dist/components/DiffViewer/DiffViewer.types.d.ts +40 -0
  59. package/dist/components/DiffViewer/DiffViewer.utils.cjs +3 -0
  60. package/dist/components/DiffViewer/DiffViewer.utils.d.ts +9 -0
  61. package/dist/components/DiffViewer/DiffViewer.utils.js +39 -0
  62. package/dist/components/DiffViewer/index.d.ts +2 -0
  63. package/dist/components/Drawer/Drawer.cjs +1 -1
  64. package/dist/components/Drawer/Drawer.js +35 -35
  65. package/dist/components/FloatingChat/FloatingChat.cjs +1 -0
  66. package/dist/components/FloatingChat/FloatingChat.const.cjs +1 -0
  67. package/dist/components/FloatingChat/FloatingChat.const.d.ts +12 -0
  68. package/dist/components/FloatingChat/FloatingChat.const.js +15 -0
  69. package/dist/components/FloatingChat/FloatingChat.d.ts +19 -0
  70. package/dist/components/FloatingChat/FloatingChat.js +144 -0
  71. package/dist/components/FloatingChat/FloatingChat.types.d.ts +44 -0
  72. package/dist/components/FloatingChat/index.d.ts +2 -0
  73. package/dist/components/JsonViewer/JsonViewer.cjs +1 -0
  74. package/dist/components/JsonViewer/JsonViewer.const.cjs +1 -0
  75. package/dist/components/JsonViewer/JsonViewer.const.d.ts +4 -0
  76. package/dist/components/JsonViewer/JsonViewer.const.js +24 -0
  77. package/dist/components/JsonViewer/JsonViewer.d.ts +17 -0
  78. package/dist/components/JsonViewer/JsonViewer.js +195 -0
  79. package/dist/components/JsonViewer/JsonViewer.types.d.ts +54 -0
  80. package/dist/components/JsonViewer/index.d.ts +2 -0
  81. package/dist/components/Kanban/Kanban.cjs +1 -1
  82. package/dist/components/Kanban/Kanban.js +18 -17
  83. package/dist/components/QRCode/QRCode.cjs +1 -0
  84. package/dist/components/QRCode/QRCode.const.cjs +1 -0
  85. package/dist/components/QRCode/QRCode.const.d.ts +21 -0
  86. package/dist/components/QRCode/QRCode.const.js +11 -0
  87. package/dist/components/QRCode/QRCode.d.ts +29 -0
  88. package/dist/components/QRCode/QRCode.js +68 -0
  89. package/dist/components/QRCode/QRCode.types.d.ts +32 -0
  90. package/dist/components/QRCode/QRCode.utils.cjs +1 -0
  91. package/dist/components/QRCode/QRCode.utils.d.ts +12 -0
  92. package/dist/components/QRCode/QRCode.utils.js +74 -0
  93. package/dist/components/QRCode/index.d.ts +3 -0
  94. package/dist/components/Spinner/Spinner.types.d.ts +2 -2
  95. package/dist/components/Terminal/Terminal.cjs +1 -0
  96. package/dist/components/Terminal/Terminal.const.cjs +1 -0
  97. package/dist/components/Terminal/Terminal.const.d.ts +32 -0
  98. package/dist/components/Terminal/Terminal.const.js +42 -0
  99. package/dist/components/Terminal/Terminal.d.ts +27 -0
  100. package/dist/components/Terminal/Terminal.js +155 -0
  101. package/dist/components/Terminal/Terminal.types.d.ts +49 -0
  102. package/dist/components/Terminal/index.d.ts +2 -0
  103. package/dist/components/Tour/Tour.cjs +1 -0
  104. package/dist/components/Tour/Tour.const.cjs +1 -0
  105. package/dist/components/Tour/Tour.const.d.ts +25 -0
  106. package/dist/components/Tour/Tour.const.js +38 -0
  107. package/dist/components/Tour/Tour.d.ts +17 -0
  108. package/dist/components/Tour/Tour.js +179 -0
  109. package/dist/components/Tour/Tour.types.d.ts +80 -0
  110. package/dist/components/Tour/index.d.ts +4 -0
  111. package/dist/components/Tour/useTour.cjs +1 -0
  112. package/dist/components/Tour/useTour.d.ts +14 -0
  113. package/dist/components/Tour/useTour.js +27 -0
  114. package/dist/components/Typography/Typography.cjs +1 -1
  115. package/dist/components/Typography/Typography.d.ts +5 -1
  116. package/dist/components/Typography/Typography.js +93 -57
  117. package/dist/components/Typography/Typography.types.d.ts +29 -2
  118. package/dist/components/index.cjs +1 -1
  119. package/dist/components/index.d.ts +19 -1
  120. package/dist/components/index.js +242 -218
  121. package/dist/context/BearProvider.cjs +1 -1
  122. package/dist/context/BearProvider.d.ts +110 -5
  123. package/dist/context/BearProvider.js +198 -53
  124. package/dist/context/defaultTheme.cjs +1 -1
  125. package/dist/context/defaultTheme.js +11 -11
  126. package/dist/hooks/index.cjs +1 -1
  127. package/dist/hooks/index.d.ts +14 -0
  128. package/dist/hooks/index.js +56 -39
  129. package/dist/hooks/useBearComponent/index.d.ts +2 -0
  130. package/dist/hooks/useBearComponent/useBearComponent.cjs +1 -0
  131. package/dist/hooks/useBearComponent/useBearComponent.d.ts +71 -0
  132. package/dist/hooks/useBearComponent/useBearComponent.js +54 -0
  133. package/dist/hooks/useBearComponent/useBearComponent.types.d.ts +40 -0
  134. package/dist/hooks/useIdle/index.d.ts +2 -0
  135. package/dist/hooks/useIdle/useIdle.cjs +1 -0
  136. package/dist/hooks/useIdle/useIdle.d.ts +22 -0
  137. package/dist/hooks/useIdle/useIdle.js +66 -0
  138. package/dist/hooks/useIdle/useIdle.types.d.ts +29 -0
  139. package/dist/hooks/useLongPress/index.d.ts +2 -0
  140. package/dist/hooks/useLongPress/useLongPress.cjs +1 -0
  141. package/dist/hooks/useLongPress/useLongPress.d.ts +17 -0
  142. package/dist/hooks/useLongPress/useLongPress.js +44 -0
  143. package/dist/hooks/useLongPress/useLongPress.types.d.ts +26 -0
  144. package/dist/hooks/useOnline/index.d.ts +2 -0
  145. package/dist/hooks/useOnline/useOnline.cjs +1 -0
  146. package/dist/hooks/useOnline/useOnline.d.ts +16 -0
  147. package/dist/hooks/useOnline/useOnline.js +25 -0
  148. package/dist/hooks/useOnline/useOnline.types.d.ts +15 -0
  149. package/dist/hooks/usePageVisibility/index.d.ts +2 -0
  150. package/dist/hooks/usePageVisibility/usePageVisibility.cjs +1 -0
  151. package/dist/hooks/usePageVisibility/usePageVisibility.d.ts +19 -0
  152. package/dist/hooks/usePageVisibility/usePageVisibility.js +26 -0
  153. package/dist/hooks/usePageVisibility/usePageVisibility.types.d.ts +15 -0
  154. package/dist/hooks/useSpotlight/index.d.ts +2 -0
  155. package/dist/hooks/useSpotlight/useSpotlight.cjs +1 -0
  156. package/dist/hooks/useSpotlight/useSpotlight.d.ts +24 -0
  157. package/dist/hooks/useSpotlight/useSpotlight.js +49 -0
  158. package/dist/hooks/useSpotlight/useSpotlight.types.d.ts +23 -0
  159. package/dist/hooks/useWebSocket/index.d.ts +2 -0
  160. package/dist/hooks/useWebSocket/useWebSocket.cjs +1 -0
  161. package/dist/hooks/useWebSocket/useWebSocket.d.ts +22 -0
  162. package/dist/hooks/useWebSocket/useWebSocket.js +75 -0
  163. package/dist/hooks/useWebSocket/useWebSocket.types.d.ts +44 -0
  164. package/dist/index.cjs +1 -1
  165. package/dist/index.js +324 -283
  166. package/dist/styles.css +1 -1
  167. package/dist/types/component.types.d.ts +125 -42
  168. package/dist/types/theme.types.d.ts +82 -0
  169. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ import { FC } from 'react';
2
+ import { FloatingChatProps } from './FloatingChat.types';
3
+ /**
4
+ * FloatingChat - Floating chat widget bubble
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * <FloatingChat
9
+ * messages={messages}
10
+ * onSend={handleSend}
11
+ * title="Support"
12
+ * subtitle="We're here to help!"
13
+ * position="bottom-right"
14
+ * badgeCount={2}
15
+ * />
16
+ * ```
17
+ */
18
+ export declare const FloatingChat: FC<FloatingChatProps>;
19
+ export default FloatingChat;
@@ -0,0 +1,144 @@
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { useState as I, useCallback as S } from "react";
3
+ import { createPortal as Z } from "react-dom";
4
+ import { cn as s } from "../../utils/cn.js";
5
+ import { useBear as q } from "../../context/BearProvider.js";
6
+ import { Button as A } from "../Button/Button.js";
7
+ import { Avatar as J } from "../Avatar/Avatar.js";
8
+ import { Typography as c } from "../Typography/Typography.js";
9
+ import { Badge as K } from "../Badge/Badge.js";
10
+ import { BearIcons as n } from "../Icon/index.js";
11
+ import { Chat as O } from "../Chat/Chat.js";
12
+ import { FLOATING_CHAT_DEFAULTS as a, CHAT_WINDOW_SIZE as m } from "./FloatingChat.const.js";
13
+ const lt = ({
14
+ messages: d,
15
+ onSend: E,
16
+ isLoading: z = !1,
17
+ isTyping: k = !1,
18
+ title: h = a.TITLE,
19
+ subtitle: B = a.SUBTITLE,
20
+ avatar: D,
21
+ position: f = a.POSITION,
22
+ bottom: p = a.BOTTOM,
23
+ side: v = a.SIDE,
24
+ defaultOpen: L = !1,
25
+ open: _,
26
+ onOpenChange: e,
27
+ trigger: y,
28
+ badgeCount: o,
29
+ header: x,
30
+ welcomeMessage: u = a.WELCOME_MESSAGE,
31
+ poweredBy: N,
32
+ className: F,
33
+ testId: W
34
+ }) => {
35
+ const { mode: $ } = q(), M = $ === "dark", [P, b] = I(L), [w, l] = I(!1), i = _ ?? P, g = S(() => {
36
+ const T = !i;
37
+ l(!0), b(T), e == null || e(T), setTimeout(() => l(!1), 300);
38
+ }, [i, e]), j = S(() => {
39
+ l(!0), b(!1), e == null || e(!1), setTimeout(() => l(!1), 300);
40
+ }, [e]), G = d.length === 0 && u ? [{ id: "welcome", content: u, sender: "bot", timestamp: /* @__PURE__ */ new Date() }] : d, H = {
41
+ bottom: `${p}px`,
42
+ [f === "bottom-right" ? "right" : "left"]: `${v}px`
43
+ }, U = {
44
+ bottom: `${p + 70}px`,
45
+ [f === "bottom-right" ? "right" : "left"]: `${v}px`,
46
+ width: m.width,
47
+ height: m.height
48
+ }, X = /* @__PURE__ */ r("div", { className: s("Bear-FloatingChat", F), "data-testid": W, children: [
49
+ (i || w) && /* @__PURE__ */ r(
50
+ "div",
51
+ {
52
+ className: s(
53
+ "fixed z-50 rounded-2xl overflow-hidden shadow-2xl",
54
+ "transition-all duration-300 ease-out",
55
+ i && !w ? "opacity-100 translate-y-0 scale-100" : "opacity-0 translate-y-4 scale-95 pointer-events-none"
56
+ ),
57
+ style: U,
58
+ children: [
59
+ x ? /* @__PURE__ */ t("div", { className: s(
60
+ "px-4 py-3",
61
+ M ? "bg-gray-800" : "bg-[var(--bear-primary-500)]"
62
+ ), children: x }) : /* @__PURE__ */ r(
63
+ "div",
64
+ {
65
+ className: s(
66
+ "px-4 py-3 flex items-center gap-3",
67
+ "bg-[var(--bear-primary-500)] text-white"
68
+ ),
69
+ children: [
70
+ /* @__PURE__ */ t(
71
+ J,
72
+ {
73
+ src: D,
74
+ initials: h[0],
75
+ size: "sm",
76
+ className: "ring-2 ring-white/20"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ r("div", { className: "flex-1", children: [
80
+ /* @__PURE__ */ t(c, { variant: "subtitle2", className: "text-white font-semibold", children: h }),
81
+ /* @__PURE__ */ t(c, { variant: "caption", className: "text-white/70", children: B })
82
+ ] }),
83
+ /* @__PURE__ */ t(
84
+ A,
85
+ {
86
+ variant: "ghost",
87
+ size: "sm",
88
+ onClick: j,
89
+ className: "!text-white hover:!bg-white/10",
90
+ children: /* @__PURE__ */ t(n.XIcon, { size: 18 })
91
+ }
92
+ )
93
+ ]
94
+ }
95
+ ),
96
+ /* @__PURE__ */ t(
97
+ O,
98
+ {
99
+ messages: G,
100
+ onSend: E,
101
+ isLoading: z,
102
+ isTyping: k,
103
+ showAvatars: !1,
104
+ height: m.height - 140,
105
+ className: "!rounded-none !border-0"
106
+ }
107
+ ),
108
+ N && /* @__PURE__ */ t("div", { className: "px-3 py-2 text-center border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ r(c, { variant: "caption", className: "opacity-50", children: [
109
+ "Powered by ",
110
+ N
111
+ ] }) })
112
+ ]
113
+ }
114
+ ),
115
+ /* @__PURE__ */ t("div", { className: "fixed z-50", style: H, children: y ? /* @__PURE__ */ t("div", { onClick: g, children: y }) : /* @__PURE__ */ r("div", { className: "relative", children: [
116
+ /* @__PURE__ */ t(
117
+ A,
118
+ {
119
+ variant: "primary",
120
+ onClick: g,
121
+ className: s(
122
+ "!w-14 !h-14 !rounded-full !p-0 shadow-lg",
123
+ "transition-transform duration-200",
124
+ i && "rotate-180"
125
+ ),
126
+ children: i ? /* @__PURE__ */ t(n.XIcon, { size: 24 }) : /* @__PURE__ */ t(n.ChatIcon, { size: 24 })
127
+ }
128
+ ),
129
+ !i && o && o > 0 && /* @__PURE__ */ t(
130
+ K,
131
+ {
132
+ variant: "danger",
133
+ size: "sm",
134
+ className: "absolute -top-1 -right-1 !min-w-[20px] !h-5",
135
+ children: o > 99 ? "99+" : o
136
+ }
137
+ )
138
+ ] }) })
139
+ ] });
140
+ return typeof document > "u" ? null : Z(X, document.body);
141
+ };
142
+ export {
143
+ lt as FloatingChat
144
+ };
@@ -0,0 +1,44 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChatMessage } from '../Chat/Chat.types';
3
+ export interface FloatingChatProps {
4
+ /** Chat messages */
5
+ messages: ChatMessage[];
6
+ /** Callback when user sends a message */
7
+ onSend?: (message: string) => void;
8
+ /** Loading state */
9
+ isLoading?: boolean;
10
+ /** Typing indicator */
11
+ isTyping?: boolean;
12
+ /** Chat title */
13
+ title?: string;
14
+ /** Chat subtitle */
15
+ subtitle?: string;
16
+ /** Avatar URL */
17
+ avatar?: string;
18
+ /** Position on screen */
19
+ position?: 'bottom-right' | 'bottom-left';
20
+ /** Distance from bottom */
21
+ bottom?: number;
22
+ /** Distance from side */
23
+ side?: number;
24
+ /** Initial open state */
25
+ defaultOpen?: boolean;
26
+ /** Controlled open state */
27
+ open?: boolean;
28
+ /** Callback when open state changes */
29
+ onOpenChange?: (open: boolean) => void;
30
+ /** Custom trigger button */
31
+ trigger?: ReactNode;
32
+ /** Badge count (e.g., unread messages) */
33
+ badgeCount?: number;
34
+ /** Header content */
35
+ header?: ReactNode;
36
+ /** Welcome message */
37
+ welcomeMessage?: string;
38
+ /** Show powered by */
39
+ poweredBy?: string;
40
+ /** Custom class name */
41
+ className?: string;
42
+ /** Test ID */
43
+ testId?: string;
44
+ }
@@ -0,0 +1,2 @@
1
+ export { FloatingChat } from './FloatingChat';
2
+ export type { FloatingChatProps } from './FloatingChat.types';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),S=require("../../utils/cn.cjs"),v=require("../../context/BearProvider.cjs"),A=require("../Typography/Typography.cjs"),I=require("../Button/Button.cjs"),g=require("../Icon/index.cjs"),u=require("./JsonViewer.const.cjs"),T=({name:r,value:s,path:d,depth:h,defaultExpandDepth:y,showDataTypes:j,showArrayIndices:x,onValueClick:c})=>{const[o,b]=i.useState(h<y),{mode:N}=v.useBear(),n=N==="dark"?u.DARK_THEME:u.DEFAULT_THEME,t=i.useMemo(()=>s===null?"null":Array.isArray(s)?"array":typeof s,[s]),p=t==="object"||t==="array",a=p&&Object.keys(s).length===0,f=i.useCallback(()=>{b(l=>!l)},[]),m=i.useCallback(()=>{c==null||c(d,s)},[d,s,c]),w=()=>{switch(t){case"string":return e.jsxs("span",{style:{color:n.string},className:"cursor-pointer hover:underline",onClick:m,children:['"',s,'"']});case"number":return e.jsx("span",{style:{color:n.number},className:"cursor-pointer hover:underline",onClick:m,children:String(s)});case"boolean":return e.jsx("span",{style:{color:n.boolean},className:"cursor-pointer hover:underline",onClick:m,children:String(s)});case"null":return e.jsx("span",{style:{color:n.null},className:"cursor-pointer hover:underline",onClick:m,children:"null"});default:return null}},k=()=>{if(!j)return null;const l=t==="array"?`Array(${s.length})`:t==="object"?"Object":t;return e.jsx("span",{className:"text-[10px] opacity-50 ml-1",children:l})};if(!p)return e.jsxs("div",{className:"flex items-center gap-1 py-0.5",children:[e.jsx("span",{className:"w-4"})," ",(x||typeof r=="string")&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:n.key},children:typeof r=="string"?`"${r}"`:r}),e.jsx("span",{style:{color:n.punctuation},children:":"})]}),w(),k()]});const B=Object.entries(s),q=t==="array"?"[":"{",E=t==="array"?"]":"}";return e.jsxs("div",{className:"py-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1 cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 rounded px-1 -mx-1",onClick:f,children:[e.jsx("span",{className:"w-4 flex items-center justify-center text-gray-400",children:a?null:o?e.jsx(g.BearIcons.ChevronDownIcon,{size:12}):e.jsx(g.BearIcons.ChevronRightIcon,{size:12})}),(x||typeof r=="string")&&r!==""&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:n.key},children:typeof r=="string"?`"${r}"`:r}),e.jsx("span",{style:{color:n.punctuation},children:":"})]}),e.jsx("span",{style:{color:n.bracket},children:q}),!o&&!a&&e.jsx("span",{className:"text-gray-400 text-xs",children:"..."}),(!o||a)&&e.jsx("span",{style:{color:n.bracket},children:E}),k()]}),o&&!a&&e.jsx("div",{className:"ml-4 border-l border-gray-200 dark:border-gray-700 pl-2",children:B.map(([l,C],F)=>e.jsx(T,{name:t==="array"?F:l,value:C,path:[...d,l],depth:h+1,defaultExpandDepth:y,showDataTypes:j,showArrayIndices:x,onValueClick:c},l))}),o&&!a&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"w-4"}),e.jsx("span",{style:{color:n.bracket},children:E})]})]})},J=({data:r,defaultExpandDepth:s=u.DEFAULT_EXPAND_DEPTH,showDataTypes:d=!1,showArrayIndices:h=!0,showCopyButton:y=!0,rootName:j="root",onValueClick:x,onCopy:c,className:o,testId:b})=>{const{mode:N}=v.useBear(),n=N==="dark"?u.DARK_THEME:u.DEFAULT_THEME,[t,p]=i.useState(!1),a=i.useCallback(async()=>{try{await navigator.clipboard.writeText(JSON.stringify(r,null,2)),p(!0),c==null||c(r),setTimeout(()=>p(!1),2e3)}catch(f){console.error("Failed to copy:",f)}},[r,c]);return e.jsxs("div",{className:S.cn("Bear-JsonViewer","rounded-lg overflow-hidden font-mono text-sm",o),style:{backgroundColor:n.background},"data-testid":b,children:[y&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsx(A.Typography,{variant:"caption",className:"opacity-60",children:"JSON"}),e.jsx(I.Button,{variant:"ghost",size:"sm",onClick:a,className:"!py-1 !px-2 !text-xs",children:t?e.jsxs(e.Fragment,{children:[e.jsx(g.BearIcons.CheckIcon,{size:12,className:"mr-1"}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx(g.BearIcons.CopyIcon,{size:12,className:"mr-1"}),"Copy"]})})]}),e.jsx("div",{className:"p-3 overflow-x-auto",children:e.jsx(T,{name:j||"",value:r,path:[],depth:0,defaultExpandDepth:s,showDataTypes:d,showArrayIndices:h,onValueClick:x})})]})};exports.JsonViewer=J;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=2,e={background:"var(--bear-bg-secondary, #f5f5f5)",string:"#22c55e",number:"#3b82f6",boolean:"#f59e0b",null:"#ef4444",key:"#ec4899",bracket:"var(--bear-text-secondary, #737373)",punctuation:"var(--bear-text-tertiary, #a3a3a3)"},r={background:"var(--bear-bg-secondary, #262626)",string:"#4ade80",number:"#60a5fa",boolean:"#fbbf24",null:"#f87171",key:"#f472b6",bracket:"var(--bear-text-secondary, #a3a3a3)",punctuation:"var(--bear-text-tertiary, #737373)"};exports.DARK_THEME=r;exports.DEFAULT_EXPAND_DEPTH=a;exports.DEFAULT_THEME=e;
@@ -0,0 +1,4 @@
1
+ import { JsonViewerTheme } from './JsonViewer.types';
2
+ export declare const DEFAULT_EXPAND_DEPTH = 2;
3
+ export declare const DEFAULT_THEME: JsonViewerTheme;
4
+ export declare const DARK_THEME: JsonViewerTheme;
@@ -0,0 +1,24 @@
1
+ const a = 2, e = {
2
+ background: "var(--bear-bg-secondary, #f5f5f5)",
3
+ string: "#22c55e",
4
+ number: "#3b82f6",
5
+ boolean: "#f59e0b",
6
+ null: "#ef4444",
7
+ key: "#ec4899",
8
+ bracket: "var(--bear-text-secondary, #737373)",
9
+ punctuation: "var(--bear-text-tertiary, #a3a3a3)"
10
+ }, r = {
11
+ background: "var(--bear-bg-secondary, #262626)",
12
+ string: "#4ade80",
13
+ number: "#60a5fa",
14
+ boolean: "#fbbf24",
15
+ null: "#f87171",
16
+ key: "#f472b6",
17
+ bracket: "var(--bear-text-secondary, #a3a3a3)",
18
+ punctuation: "var(--bear-text-tertiary, #737373)"
19
+ };
20
+ export {
21
+ r as DARK_THEME,
22
+ a as DEFAULT_EXPAND_DEPTH,
23
+ e as DEFAULT_THEME
24
+ };
@@ -0,0 +1,17 @@
1
+ import { FC } from 'react';
2
+ import { JsonViewerProps } from './JsonViewer.types';
3
+ /**
4
+ * JsonViewer - Pretty-print and explore JSON data
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * <JsonViewer
9
+ * data={{ name: 'John', age: 30, active: true }}
10
+ * defaultExpandDepth={3}
11
+ * showDataTypes
12
+ * showCopyButton
13
+ * />
14
+ * ```
15
+ */
16
+ export declare const JsonViewer: FC<JsonViewerProps>;
17
+ export default JsonViewer;
@@ -0,0 +1,195 @@
1
+ import { jsxs as o, jsx as e, Fragment as g } from "react/jsx-runtime";
2
+ import { useState as j, useCallback as v, useMemo as F } from "react";
3
+ import { cn as I } from "../../utils/cn.js";
4
+ import { useBear as T } from "../../context/BearProvider.js";
5
+ import { Typography as _ } from "../Typography/Typography.js";
6
+ import { Button as H } from "../Button/Button.js";
7
+ import { BearIcons as b } from "../Icon/index.js";
8
+ import { DARK_THEME as B, DEFAULT_THEME as C, DEFAULT_EXPAND_DEPTH as L } from "./JsonViewer.const.js";
9
+ const z = ({
10
+ name: r,
11
+ value: t,
12
+ path: d,
13
+ depth: h,
14
+ defaultExpandDepth: y,
15
+ showDataTypes: u,
16
+ showArrayIndices: p,
17
+ onValueClick: c
18
+ }) => {
19
+ const [l, x] = j(h < y), { mode: N } = T(), n = N === "dark" ? B : C, s = F(() => t === null ? "null" : Array.isArray(t) ? "array" : typeof t, [t]), m = s === "object" || s === "array", a = m && Object.keys(t).length === 0, k = v(() => {
20
+ x((i) => !i);
21
+ }, []), f = v(() => {
22
+ c == null || c(d, t);
23
+ }, [d, t, c]), A = () => {
24
+ switch (s) {
25
+ case "string":
26
+ return /* @__PURE__ */ o(
27
+ "span",
28
+ {
29
+ style: { color: n.string },
30
+ className: "cursor-pointer hover:underline",
31
+ onClick: f,
32
+ children: [
33
+ '"',
34
+ t,
35
+ '"'
36
+ ]
37
+ }
38
+ );
39
+ case "number":
40
+ return /* @__PURE__ */ e(
41
+ "span",
42
+ {
43
+ style: { color: n.number },
44
+ className: "cursor-pointer hover:underline",
45
+ onClick: f,
46
+ children: String(t)
47
+ }
48
+ );
49
+ case "boolean":
50
+ return /* @__PURE__ */ e(
51
+ "span",
52
+ {
53
+ style: { color: n.boolean },
54
+ className: "cursor-pointer hover:underline",
55
+ onClick: f,
56
+ children: String(t)
57
+ }
58
+ );
59
+ case "null":
60
+ return /* @__PURE__ */ e(
61
+ "span",
62
+ {
63
+ style: { color: n.null },
64
+ className: "cursor-pointer hover:underline",
65
+ onClick: f,
66
+ children: "null"
67
+ }
68
+ );
69
+ default:
70
+ return null;
71
+ }
72
+ }, E = () => {
73
+ if (!u) return null;
74
+ const i = s === "array" ? `Array(${t.length})` : s === "object" ? "Object" : s;
75
+ return /* @__PURE__ */ e("span", { className: "text-[10px] opacity-50 ml-1", children: i });
76
+ };
77
+ if (!m)
78
+ return /* @__PURE__ */ o("div", { className: "flex items-center gap-1 py-0.5", children: [
79
+ /* @__PURE__ */ e("span", { className: "w-4" }),
80
+ " ",
81
+ (p || typeof r == "string") && /* @__PURE__ */ o(g, { children: [
82
+ /* @__PURE__ */ e("span", { style: { color: n.key }, children: typeof r == "string" ? `"${r}"` : r }),
83
+ /* @__PURE__ */ e("span", { style: { color: n.punctuation }, children: ":" })
84
+ ] }),
85
+ A(),
86
+ E()
87
+ ] });
88
+ const J = Object.entries(t), O = s === "array" ? "[" : "{", w = s === "array" ? "]" : "}";
89
+ return /* @__PURE__ */ o("div", { className: "py-0.5", children: [
90
+ /* @__PURE__ */ o(
91
+ "div",
92
+ {
93
+ className: "flex items-center gap-1 cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 rounded px-1 -mx-1",
94
+ onClick: k,
95
+ children: [
96
+ /* @__PURE__ */ e("span", { className: "w-4 flex items-center justify-center text-gray-400", children: a ? null : l ? /* @__PURE__ */ e(b.ChevronDownIcon, { size: 12 }) : /* @__PURE__ */ e(b.ChevronRightIcon, { size: 12 }) }),
97
+ (p || typeof r == "string") && r !== "" && /* @__PURE__ */ o(g, { children: [
98
+ /* @__PURE__ */ e("span", { style: { color: n.key }, children: typeof r == "string" ? `"${r}"` : r }),
99
+ /* @__PURE__ */ e("span", { style: { color: n.punctuation }, children: ":" })
100
+ ] }),
101
+ /* @__PURE__ */ e("span", { style: { color: n.bracket }, children: O }),
102
+ !l && !a && /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "..." }),
103
+ (!l || a) && /* @__PURE__ */ e("span", { style: { color: n.bracket }, children: w }),
104
+ E()
105
+ ]
106
+ }
107
+ ),
108
+ l && !a && /* @__PURE__ */ e("div", { className: "ml-4 border-l border-gray-200 dark:border-gray-700 pl-2", children: J.map(([i, S], D) => /* @__PURE__ */ e(
109
+ z,
110
+ {
111
+ name: s === "array" ? D : i,
112
+ value: S,
113
+ path: [...d, i],
114
+ depth: h + 1,
115
+ defaultExpandDepth: y,
116
+ showDataTypes: u,
117
+ showArrayIndices: p,
118
+ onValueClick: c
119
+ },
120
+ i
121
+ )) }),
122
+ l && !a && /* @__PURE__ */ o("div", { className: "flex items-center", children: [
123
+ /* @__PURE__ */ e("span", { className: "w-4" }),
124
+ /* @__PURE__ */ e("span", { style: { color: n.bracket }, children: w })
125
+ ] })
126
+ ] });
127
+ }, G = ({
128
+ data: r,
129
+ defaultExpandDepth: t = L,
130
+ showDataTypes: d = !1,
131
+ showArrayIndices: h = !0,
132
+ showCopyButton: y = !0,
133
+ rootName: u = "root",
134
+ onValueClick: p,
135
+ onCopy: c,
136
+ className: l,
137
+ testId: x
138
+ }) => {
139
+ const { mode: N } = T(), n = N === "dark" ? B : C, [s, m] = j(!1), a = v(async () => {
140
+ try {
141
+ await navigator.clipboard.writeText(JSON.stringify(r, null, 2)), m(!0), c == null || c(r), setTimeout(() => m(!1), 2e3);
142
+ } catch (k) {
143
+ console.error("Failed to copy:", k);
144
+ }
145
+ }, [r, c]);
146
+ return /* @__PURE__ */ o(
147
+ "div",
148
+ {
149
+ className: I(
150
+ "Bear-JsonViewer",
151
+ "rounded-lg overflow-hidden font-mono text-sm",
152
+ l
153
+ ),
154
+ style: { backgroundColor: n.background },
155
+ "data-testid": x,
156
+ children: [
157
+ y && /* @__PURE__ */ o("div", { className: "flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700", children: [
158
+ /* @__PURE__ */ e(_, { variant: "caption", className: "opacity-60", children: "JSON" }),
159
+ /* @__PURE__ */ e(
160
+ H,
161
+ {
162
+ variant: "ghost",
163
+ size: "sm",
164
+ onClick: a,
165
+ className: "!py-1 !px-2 !text-xs",
166
+ children: s ? /* @__PURE__ */ o(g, { children: [
167
+ /* @__PURE__ */ e(b.CheckIcon, { size: 12, className: "mr-1" }),
168
+ "Copied!"
169
+ ] }) : /* @__PURE__ */ o(g, { children: [
170
+ /* @__PURE__ */ e(b.CopyIcon, { size: 12, className: "mr-1" }),
171
+ "Copy"
172
+ ] })
173
+ }
174
+ )
175
+ ] }),
176
+ /* @__PURE__ */ e("div", { className: "p-3 overflow-x-auto", children: /* @__PURE__ */ e(
177
+ z,
178
+ {
179
+ name: u || "",
180
+ value: r,
181
+ path: [],
182
+ depth: 0,
183
+ defaultExpandDepth: t,
184
+ showDataTypes: d,
185
+ showArrayIndices: h,
186
+ onValueClick: p
187
+ }
188
+ ) })
189
+ ]
190
+ }
191
+ );
192
+ };
193
+ export {
194
+ G as JsonViewer
195
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * JsonViewer component types
3
+ */
4
+ export interface JsonViewerProps {
5
+ /** JSON data to display */
6
+ data: unknown;
7
+ /** Number of levels to expand by default (default: 2) */
8
+ defaultExpandDepth?: number;
9
+ /** Expand all nodes */
10
+ expandAll?: boolean;
11
+ /** Collapse all nodes */
12
+ collapseAll?: boolean;
13
+ /** Show data types */
14
+ showDataTypes?: boolean;
15
+ /** Show array indices */
16
+ showArrayIndices?: boolean;
17
+ /** Show copy button */
18
+ showCopyButton?: boolean;
19
+ /** Enable search */
20
+ enableSearch?: boolean;
21
+ /** Custom theme colors */
22
+ theme?: JsonViewerTheme;
23
+ /** Root name (default: 'root') */
24
+ rootName?: string | false;
25
+ /** Callback when a value is clicked */
26
+ onValueClick?: (path: string[], value: unknown) => void;
27
+ /** Callback when copied */
28
+ onCopy?: (value: unknown) => void;
29
+ /** Custom class name */
30
+ className?: string;
31
+ /** Test ID */
32
+ testId?: string;
33
+ }
34
+ export interface JsonViewerTheme {
35
+ background?: string;
36
+ text?: string;
37
+ string?: string;
38
+ number?: string;
39
+ boolean?: string;
40
+ null?: string;
41
+ key?: string;
42
+ bracket?: string;
43
+ punctuation?: string;
44
+ }
45
+ export interface JsonNodeProps {
46
+ name: string | number;
47
+ value: unknown;
48
+ path: string[];
49
+ depth: number;
50
+ defaultExpandDepth: number;
51
+ showDataTypes: boolean;
52
+ showArrayIndices: boolean;
53
+ onValueClick?: (path: string[], value: unknown) => void;
54
+ }
@@ -0,0 +1,2 @@
1
+ export { JsonViewer } from './JsonViewer';
2
+ export type { JsonViewerProps, JsonViewerTheme } from './JsonViewer.types';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),K=require("react"),m=require("../../utils/cn.cjs");require("../../context/BearProvider.cjs");const P=require("../../hooks/useDragDrop/useDragDrop.cjs"),S="bear-kanban",$=({columns:n,onColumnsChange:o,onCardMove:p,renderCard:h,renderColumnHeader:u,disabled:y=!1,className:v})=>{const w=K.useCallback((r,e,i,b,d)=>{const l=n.find(a=>a.id===r),s=n.find(a=>a.id===e);if(!l||!s)return;const f=n.map(a=>{if(a.id===r){const c=a.cards.filter((x,g)=>g!==i);return{...a,cards:c}}if(a.id===e){const c=r===e&&i<b?b-1:b,x=[...a.cards];return x.splice(Math.max(0,c),0,d),{...a,cards:x}}return a});o==null||o(f),p==null||p(d.id,r,e,i,b)},[n,o,p]),{getDragProps:N,getDropProps:j,isDragging:_,draggedId:z,dragOverId:k}=P.useDragDrop({disabled:y,dragType:S,onDrop:(r,e,i,b,d)=>{var D;const l=String(r),s=String(e),f=l.split("-")[0],a=parseInt(l.split("-")[1],10)||0,c=s.endsWith("-col")?s.replace("-col",""):s.split("-")[0],x=s.endsWith("-col")?((D=n.find(q=>q.id===c))==null?void 0:D.cards.length)??0:parseInt(s.split("-")[1],10),g=d;g!=null&&g.id&&w(f,c,a,x,g)}});return t.jsx("div",{className:m.cn("Bear-Kanban bear-flex bear-gap-4 bear-overflow-x-auto bear-pb-4",y&&"bear-opacity-50 bear-pointer-events-none",v),children:n.map(r=>t.jsxs("div",{...j(`${r.id}-col`,r,0),className:m.cn("Bear-Kanban__column bear-flex-shrink-0 bear-w-72 bear-flex bear-flex-col bear-rounded-lg bear-bg-gray-100 dark:bear-bg-zinc-800/80 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transition-colors",k===`${r.id}-col`&&"bear-border-bear-500 bear-bg-bear-500/5"),children:[t.jsx("div",{className:"bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700",children:u?u(r):t.jsx("h3",{className:"bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white",children:r.title})}),t.jsx("div",{className:"bear-flex-1 bear-flex bear-flex-col bear-gap-2 bear-p-3 bear-min-h-[120px]",children:r.cards.map((e,i)=>{const b=`${r.id}-${i}`,d=_&&z===b;return t.jsx("div",{...j(b,e,i),...N(b,e,i),className:m.cn("Bear-Kanban__card bear-rounded-lg bear-bg-white dark:bear-bg-zinc-700/80 bear-border bear-border-gray-200 dark:bear-border-zinc-600 bear-p-3 bear-cursor-grab active:bear-cursor-grabbing bear-transition-all bear-shadow-sm",d&&"bear-opacity-50 bear-scale-95",k===b&&"bear-border-bear-500 bear-bg-bear-500/10"),children:h?h(e,r.id):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"bear-font-medium bear-text-gray-900 dark:bear-text-white",children:e.title}),e.description&&t.jsx("div",{className:"bear-text-sm bear-text-gray-600 dark:bear-text-zinc-400 bear-mt-1",children:e.description}),e.meta&&t.jsx("div",{className:"bear-text-xs bear-text-gray-500 dark:bear-text-zinc-500 bear-mt-2",children:e.meta})]})},e.id)})})]},r.id))})};exports.Kanban=$;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),K=require("react"),m=require("../../utils/cn.cjs");require("../../context/BearProvider.cjs");const P=require("../../hooks/useDragDrop/useDragDrop.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const S="bear-kanban",$=({columns:n,onColumnsChange:o,onCardMove:p,renderCard:h,renderColumnHeader:u,disabled:y=!1,className:v})=>{const w=K.useCallback((r,e,i,b,d)=>{const l=n.find(a=>a.id===r),s=n.find(a=>a.id===e);if(!l||!s)return;const f=n.map(a=>{if(a.id===r){const c=a.cards.filter((x,g)=>g!==i);return{...a,cards:c}}if(a.id===e){const c=r===e&&i<b?b-1:b,x=[...a.cards];return x.splice(Math.max(0,c),0,d),{...a,cards:x}}return a});o==null||o(f),p==null||p(d.id,r,e,i,b)},[n,o,p]),{getDragProps:N,getDropProps:j,isDragging:_,draggedId:z,dragOverId:k}=P.useDragDrop({disabled:y,dragType:S,onDrop:(r,e,i,b,d)=>{var D;const l=String(r),s=String(e),f=l.split("-")[0],a=parseInt(l.split("-")[1],10)||0,c=s.endsWith("-col")?s.replace("-col",""):s.split("-")[0],x=s.endsWith("-col")?((D=n.find(q=>q.id===c))==null?void 0:D.cards.length)??0:parseInt(s.split("-")[1],10),g=d;g!=null&&g.id&&w(f,c,a,x,g)}});return t.jsx("div",{className:m.cn("Bear-Kanban bear-flex bear-gap-4 bear-overflow-x-auto bear-pb-4",y&&"bear-opacity-50 bear-pointer-events-none",v),children:n.map(r=>t.jsxs("div",{...j(`${r.id}-col`,r,0),className:m.cn("Bear-Kanban__column bear-flex-shrink-0 bear-w-72 bear-flex bear-flex-col bear-rounded-lg bear-bg-gray-100 dark:bear-bg-zinc-800/80 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transition-colors",k===`${r.id}-col`&&"bear-border-bear-500 bear-bg-bear-500/5"),children:[t.jsx("div",{className:"bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700",children:u?u(r):t.jsx("h3",{className:"bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white",children:r.title})}),t.jsx("div",{className:"bear-flex-1 bear-flex bear-flex-col bear-gap-2 bear-p-3 bear-min-h-[120px]",children:r.cards.map((e,i)=>{const b=`${r.id}-${i}`,d=_&&z===b;return t.jsx("div",{...j(b,e,i),...N(b,e,i),className:m.cn("Bear-Kanban__card bear-rounded-lg bear-bg-white dark:bear-bg-zinc-700/80 bear-border bear-border-gray-200 dark:bear-border-zinc-600 bear-p-3 bear-cursor-grab active:bear-cursor-grabbing bear-transition-all bear-shadow-sm",d&&"bear-opacity-50 bear-scale-95",k===b&&"bear-border-bear-500 bear-bg-bear-500/10"),children:h?h(e,r.id):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"bear-font-medium bear-text-gray-900 dark:bear-text-white",children:e.title}),e.description&&t.jsx("div",{className:"bear-text-sm bear-text-gray-600 dark:bear-text-zinc-400 bear-mt-1",children:e.description}),e.meta&&t.jsx("div",{className:"bear-text-xs bear-text-gray-500 dark:bear-text-zinc-500 bear-mt-2",children:e.meta})]})},e.id)})})]},r.id))})};exports.Kanban=$;
@@ -3,9 +3,10 @@ import { useCallback as I } from "react";
3
3
  import { cn as f } from "../../utils/cn.js";
4
4
  import "../../context/BearProvider.js";
5
5
  import { useDragDrop as P } from "../../hooks/useDragDrop/useDragDrop.js";
6
- const S = "bear-kanban", O = ({
6
+ import "../../hooks/useBearComponent/useBearComponent.js";
7
+ const S = "bear-kanban", R = ({
7
8
  columns: d,
8
- onColumnsChange: o,
9
+ onColumnsChange: g,
9
10
  onCardMove: l,
10
11
  renderCard: h,
11
12
  renderColumnHeader: k,
@@ -13,30 +14,30 @@ const S = "bear-kanban", O = ({
13
14
  className: _
14
15
  }) => {
15
16
  const z = I(
16
- (r, e, t, b, n) => {
17
+ (r, e, b, t, n) => {
17
18
  const x = d.find((a) => a.id === r), s = d.find((a) => a.id === e);
18
19
  if (!x || !s) return;
19
20
  const m = d.map((a) => {
20
21
  if (a.id === r) {
21
- const c = a.cards.filter((g, p) => p !== t);
22
+ const c = a.cards.filter((o, p) => p !== b);
22
23
  return { ...a, cards: c };
23
24
  }
24
25
  if (a.id === e) {
25
- const c = r === e && t < b ? b - 1 : b, g = [...a.cards];
26
- return g.splice(Math.max(0, c), 0, n), { ...a, cards: g };
26
+ const c = r === e && b < t ? t - 1 : t, o = [...a.cards];
27
+ return o.splice(Math.max(0, c), 0, n), { ...a, cards: o };
27
28
  }
28
29
  return a;
29
30
  });
30
- o == null || o(m), l == null || l(n.id, r, e, t, b);
31
+ g == null || g(m), l == null || l(n.id, r, e, b, t);
31
32
  },
32
- [d, o, l]
33
+ [d, g, l]
33
34
  ), { getDragProps: u, getDropProps: w, isDragging: K, draggedId: $, dragOverId: N } = P({
34
35
  disabled: y,
35
36
  dragType: S,
36
- onDrop: (r, e, t, b, n) => {
37
+ onDrop: (r, e, b, t, n) => {
37
38
  var v;
38
- const x = String(r), s = String(e), m = x.split("-")[0], a = parseInt(x.split("-")[1], 10) || 0, c = s.endsWith("-col") ? s.replace("-col", "") : s.split("-")[0], g = s.endsWith("-col") ? ((v = d.find((j) => j.id === c)) == null ? void 0 : v.cards.length) ?? 0 : parseInt(s.split("-")[1], 10), p = n;
39
- p != null && p.id && z(m, c, a, g, p);
39
+ const x = String(r), s = String(e), m = x.split("-")[0], a = parseInt(x.split("-")[1], 10) || 0, c = s.endsWith("-col") ? s.replace("-col", "") : s.split("-")[0], o = s.endsWith("-col") ? ((v = d.find((j) => j.id === c)) == null ? void 0 : v.cards.length) ?? 0 : parseInt(s.split("-")[1], 10), p = n;
40
+ p != null && p.id && z(m, c, a, o, p);
40
41
  }
41
42
  });
42
43
  return /* @__PURE__ */ i(
@@ -57,17 +58,17 @@ const S = "bear-kanban", O = ({
57
58
  ),
58
59
  children: [
59
60
  /* @__PURE__ */ i("div", { className: "bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700", children: k ? k(r) : /* @__PURE__ */ i("h3", { className: "bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white", children: r.title }) }),
60
- /* @__PURE__ */ i("div", { className: "bear-flex-1 bear-flex bear-flex-col bear-gap-2 bear-p-3 bear-min-h-[120px]", children: r.cards.map((e, t) => {
61
- const b = `${r.id}-${t}`, n = K && $ === b;
61
+ /* @__PURE__ */ i("div", { className: "bear-flex-1 bear-flex bear-flex-col bear-gap-2 bear-p-3 bear-min-h-[120px]", children: r.cards.map((e, b) => {
62
+ const t = `${r.id}-${b}`, n = K && $ === t;
62
63
  return /* @__PURE__ */ i(
63
64
  "div",
64
65
  {
65
- ...w(b, e, t),
66
- ...u(b, e, t),
66
+ ...w(t, e, b),
67
+ ...u(t, e, b),
67
68
  className: f(
68
69
  "Bear-Kanban__card bear-rounded-lg bear-bg-white dark:bear-bg-zinc-700/80 bear-border bear-border-gray-200 dark:bear-border-zinc-600 bear-p-3 bear-cursor-grab active:bear-cursor-grabbing bear-transition-all bear-shadow-sm",
69
70
  n && "bear-opacity-50 bear-scale-95",
70
- N === b && "bear-border-bear-500 bear-bg-bear-500/10"
71
+ N === t && "bear-border-bear-500 bear-bg-bear-500/10"
71
72
  ),
72
73
  children: h ? h(e, r.id) : /* @__PURE__ */ D(B, { children: [
73
74
  /* @__PURE__ */ i("div", { className: "bear-font-medium bear-text-gray-900 dark:bear-text-white", children: e.title }),
@@ -86,5 +87,5 @@ const S = "bear-kanban", O = ({
86
87
  );
87
88
  };
88
89
  export {
89
- O as Kanban
90
+ R as Kanban
90
91
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),L=require("../../utils/cn.cjs"),r=require("./QRCode.const.cjs"),x=require("./QRCode.utils.cjs"),m=({value:s,size:t=r.QRCODE_DEFAULTS.SIZE,level:h=r.QRCODE_DEFAULTS.LEVEL,bgColor:d=r.QRCODE_DEFAULTS.BG_COLOR,fgColor:D=r.QRCODE_DEFAULTS.FG_COLOR,includeMargin:E=r.QRCODE_DEFAULTS.INCLUDE_MARGIN,imageUrl:R,imageSize:C=r.QRCODE_DEFAULTS.IMAGE_SIZE,className:O,style:Q,testId:S})=>{const l=g.useMemo(()=>{if(!s)return null;const o=x.generateQRMatrix(s,h),c=E?4:0,u=o.size+c*2,a=t/u,_=x.matrixToSvgPath(o,a,c*a);return{matrix:o,path:_,cellSize:a,margin:c,totalModules:u}},[s,h,t,E]);if(!l)return null;const i=t*C,n=(t-i)/2;return e.jsxs("svg",{className:L.cn("Bear-QRCode",O),width:t,height:t,viewBox:`0 0 ${t} ${t}`,style:Q,"data-testid":S,children:[e.jsx("rect",{width:t,height:t,fill:d}),e.jsx("path",{d:l.path,fill:D}),R&&e.jsxs("g",{children:[e.jsx("rect",{x:n-4,y:n-4,width:i+8,height:i+8,fill:d,rx:4}),e.jsx("image",{href:R,x:n,y:n,width:i,height:i,preserveAspectRatio:"xMidYMid slice"})]})]})};exports.QRCode=m;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E={SIZE:128,LEVEL:"M",BG_COLOR:"#ffffff",FG_COLOR:"#000000",INCLUDE_MARGIN:!0,IMAGE_SIZE:.2};exports.QRCODE_DEFAULTS=E;
@@ -0,0 +1,21 @@
1
+ export declare const QRCODE_DEFAULTS: {
2
+ readonly SIZE: 128;
3
+ readonly LEVEL: "M";
4
+ readonly BG_COLOR: "#ffffff";
5
+ readonly FG_COLOR: "#000000";
6
+ readonly INCLUDE_MARGIN: true;
7
+ readonly IMAGE_SIZE: 0.2;
8
+ readonly RENDER_AS: "svg";
9
+ };
10
+ export declare const QRCODE_ERROR_CORRECTION: {
11
+ readonly L: 0;
12
+ readonly M: 1;
13
+ readonly Q: 2;
14
+ readonly H: 3;
15
+ };
16
+ export declare const QRCODE_MODE: {
17
+ readonly NUMERIC: 1;
18
+ readonly ALPHANUMERIC: 2;
19
+ readonly BYTE: 4;
20
+ };
21
+ export declare const ALPHANUMERIC_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";