@forgedevstack/bear 1.1.4 → 1.1.9

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 (179) hide show
  1. package/README.md +21 -2
  2. package/dist/components/Anchor/Anchor.cjs +1 -1
  3. package/dist/components/Anchor/Anchor.js +37 -45
  4. package/dist/components/Anchor/Anchor.utils.cjs +1 -0
  5. package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
  6. package/dist/components/Anchor/Anchor.utils.js +12 -0
  7. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  8. package/dist/components/Autocomplete/Autocomplete.js +60 -67
  9. package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
  10. package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
  11. package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
  12. package/dist/components/BackTop/BackTop.cjs +1 -1
  13. package/dist/components/BackTop/BackTop.js +10 -11
  14. package/dist/components/BearLogo/BearLogo.d.ts +2 -7
  15. package/dist/components/BearLogo/BearLogo.types.d.ts +15 -0
  16. package/dist/components/BearLogo/EmberLogo.d.ts +1 -8
  17. package/dist/components/BearLogo/index.d.ts +1 -2
  18. package/dist/components/Biometric/Biometric.cjs +1 -0
  19. package/dist/components/Biometric/Biometric.d.ts +3 -0
  20. package/dist/components/Biometric/Biometric.js +123 -0
  21. package/dist/components/Biometric/Biometric.types.d.ts +35 -0
  22. package/dist/components/Biometric/BiometricIcon.cjs +1 -0
  23. package/dist/components/Biometric/BiometricIcon.d.ts +3 -0
  24. package/dist/components/Biometric/BiometricIcon.js +45 -0
  25. package/dist/components/Biometric/index.d.ts +3 -0
  26. package/dist/components/Biometric/useBiometric.cjs +1 -0
  27. package/dist/components/Biometric/useBiometric.d.ts +2 -0
  28. package/dist/components/Biometric/useBiometric.js +21 -0
  29. package/dist/components/Button/Button.cjs +1 -1
  30. package/dist/components/Button/Button.constants.cjs +2 -2
  31. package/dist/components/Button/Button.constants.d.ts +1 -0
  32. package/dist/components/Button/Button.constants.js +12 -5
  33. package/dist/components/Button/Button.d.ts +0 -27
  34. package/dist/components/Button/Button.js +93 -105
  35. package/dist/components/Button/Button.types.d.ts +1 -0
  36. package/dist/components/Button/Button.utils.cjs +1 -0
  37. package/dist/components/Button/Button.utils.d.ts +2 -0
  38. package/dist/components/Button/Button.utils.js +5 -0
  39. package/dist/components/Button/useSpotlight.cjs +1 -0
  40. package/dist/components/Button/useSpotlight.d.ts +21 -0
  41. package/dist/components/Button/useSpotlight.js +28 -0
  42. package/dist/components/Chart/Chart.cjs +1 -1
  43. package/dist/components/Chart/Chart.const.cjs +1 -0
  44. package/dist/components/Chart/Chart.const.js +21 -0
  45. package/dist/components/Chart/Chart.js +55 -71
  46. package/dist/components/Chart/Chart.utils.cjs +1 -0
  47. package/dist/components/Chart/Chart.utils.js +5 -0
  48. package/dist/components/Confetti/Confetti.cjs +1 -1
  49. package/dist/components/Confetti/Confetti.js +37 -34
  50. package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
  51. package/dist/components/ContextMenu/ContextMenu.js +31 -30
  52. package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
  53. package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
  54. package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
  55. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  56. package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
  57. package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
  58. package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
  59. package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
  60. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  61. package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -1
  62. package/dist/components/DateRangePicker/DateRangePicker.const.js +12 -13
  63. package/dist/components/DateRangePicker/DateRangePicker.js +107 -81
  64. package/dist/components/Dock/Dock.cjs +1 -1
  65. package/dist/components/Dock/Dock.js +38 -43
  66. package/dist/components/Dock/Dock.utils.cjs +1 -0
  67. package/dist/components/Dock/Dock.utils.d.ts +1 -0
  68. package/dist/components/Dock/Dock.utils.js +10 -0
  69. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  70. package/dist/components/Dropdown/Dropdown.js +77 -74
  71. package/dist/components/FileTree/FileTree.cjs +1 -1
  72. package/dist/components/FileTree/FileTree.js +20 -32
  73. package/dist/components/FileTree/FileTree.utils.cjs +1 -0
  74. package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
  75. package/dist/components/FileTree/FileTree.utils.js +15 -0
  76. package/dist/components/GradientText/GradientText.cjs +1 -1
  77. package/dist/components/GradientText/GradientText.js +27 -29
  78. package/dist/components/Icon/icons/bear.cjs +1 -0
  79. package/dist/components/Icon/icons/bear.d.ts +12 -0
  80. package/dist/components/Icon/icons/bear.js +47 -0
  81. package/dist/components/Icon/index.cjs +1 -1
  82. package/dist/components/Icon/index.d.ts +18 -0
  83. package/dist/components/Icon/index.js +17 -15
  84. package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
  85. package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
  86. package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
  87. package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
  88. package/dist/components/Input/Input.cjs +1 -1
  89. package/dist/components/Input/Input.js +153 -101
  90. package/dist/components/Input/Input.types.d.ts +8 -2
  91. package/dist/components/Input/index.d.ts +1 -1
  92. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  93. package/dist/components/MentionsInput/MentionsInput.js +64 -68
  94. package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
  95. package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
  96. package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
  97. package/dist/components/PageNav/PageNav.cjs +1 -0
  98. package/dist/components/PageNav/PageNav.const.cjs +1 -0
  99. package/dist/components/PageNav/PageNav.const.d.ts +22 -0
  100. package/dist/components/PageNav/PageNav.const.js +42 -0
  101. package/dist/components/PageNav/PageNav.d.ts +3 -0
  102. package/dist/components/PageNav/PageNav.js +81 -0
  103. package/dist/components/PageNav/PageNav.types.d.ts +17 -0
  104. package/dist/components/PageNav/index.d.ts +2 -0
  105. package/dist/components/Popover/Popover.cjs +1 -1
  106. package/dist/components/Popover/Popover.js +76 -76
  107. package/dist/components/Progress/Progress.cjs +1 -1
  108. package/dist/components/Progress/Progress.js +6 -6
  109. package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
  110. package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
  111. package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
  112. package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
  113. package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
  114. package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
  115. package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
  116. package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
  117. package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
  118. package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
  119. package/dist/components/PropsPlayground/index.d.ts +2 -0
  120. package/dist/components/Select/Select.cjs +1 -1
  121. package/dist/components/Select/Select.js +54 -53
  122. package/dist/components/SignPad/SignPad.cjs +1 -1
  123. package/dist/components/SignPad/SignPad.js +24 -24
  124. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  125. package/dist/components/Skeleton/Skeleton.js +89 -94
  126. package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
  127. package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
  128. package/dist/components/Skeleton/Skeleton.utils.js +10 -0
  129. package/dist/components/SliderRange/SliderRange.cjs +1 -1
  130. package/dist/components/SliderRange/SliderRange.js +61 -63
  131. package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
  132. package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
  133. package/dist/components/SliderRange/SliderRange.utils.js +7 -0
  134. package/dist/components/Spotlight/Spotlight.cjs +1 -1
  135. package/dist/components/Spotlight/Spotlight.js +62 -73
  136. package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
  137. package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
  138. package/dist/components/Spotlight/Spotlight.utils.js +18 -0
  139. package/dist/components/Tabs/TabList.cjs +1 -0
  140. package/dist/components/Tabs/TabList.d.ts +3 -0
  141. package/dist/components/Tabs/TabList.js +69 -0
  142. package/dist/components/Tabs/TabPanel.cjs +1 -0
  143. package/dist/components/Tabs/TabPanel.d.ts +3 -0
  144. package/dist/components/Tabs/TabPanel.js +13 -0
  145. package/dist/components/Tabs/Tabs.cjs +1 -1
  146. package/dist/components/Tabs/Tabs.d.ts +2 -27
  147. package/dist/components/Tabs/Tabs.js +43 -61
  148. package/dist/components/Tabs/Tabs.types.d.ts +7 -1
  149. package/dist/components/Tabs/index.d.ts +3 -1
  150. package/dist/components/Toast/Toast.cjs +1 -1
  151. package/dist/components/Toast/Toast.js +18 -17
  152. package/dist/components/Toast/Toast.utils.cjs +1 -0
  153. package/dist/components/Toast/Toast.utils.d.ts +1 -0
  154. package/dist/components/Toast/Toast.utils.js +4 -0
  155. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  156. package/dist/components/Tooltip/Tooltip.js +10 -11
  157. package/dist/components/Tour/Tour.cjs +1 -1
  158. package/dist/components/Tour/Tour.js +1 -2
  159. package/dist/components/VirtualList/VirtualList.cjs +1 -1
  160. package/dist/components/VirtualList/VirtualList.js +38 -43
  161. package/dist/components/index.cjs +1 -1
  162. package/dist/components/index.d.ts +9 -2
  163. package/dist/components/index.js +311 -300
  164. package/dist/hooks/index.cjs +1 -1
  165. package/dist/hooks/index.d.ts +2 -0
  166. package/dist/hooks/index.js +60 -58
  167. package/dist/hooks/useResizeObserver/index.d.ts +2 -0
  168. package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
  169. package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
  170. package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
  171. package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
  172. package/dist/icons.cjs +1 -0
  173. package/dist/icons.d.ts +2 -0
  174. package/dist/icons.js +6 -0
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.js +397 -384
  177. package/dist/styles/_base.css +7 -3
  178. package/dist/styles.css +1 -1
  179. package/package.json +6 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("react"),m=require("../../utils/cn.cjs"),x=require("./Spotlight.const.cjs"),R=(s,l)=>{var i,p;const n=l.toLowerCase();return!!(s.label.toLowerCase().includes(n)||(i=s.description)!=null&&i.toLowerCase().includes(n)||(p=s.keywords)!=null&&p.some(y=>y.toLowerCase().includes(n)))},E=(s,l)=>{if(!l)return s;const n=s.toLowerCase().indexOf(l.toLowerCase());return n===-1?s:r.jsxs(r.Fragment,{children:[s.slice(0,n),r.jsx("mark",{className:"Bear-Spotlight__highlight bear-bg-yellow-200 dark:bear-bg-yellow-800 bear-text-inherit bear-rounded-sm bear-px-0.5",children:s.slice(n,n+l.length)}),s.slice(n+l.length)]})},U=s=>{const{actions:l,open:n,onOpenChange:i,placeholder:p=x.DEFAULT_PLACEHOLDER,shortcutKey:y=x.DEFAULT_SHORTCUT_KEY,shortcutMod:v=!0,nothingFoundMessage:L=x.DEFAULT_NOTHING_FOUND,highlightMatches:S=!0,limit:f=x.DEFAULT_LIMIT,filter:k,className:B,style:D,testId:T}=s,[I,A]=b.useState(!1),[o,j]=b.useState(""),[h,u]=b.useState(0),N=b.useRef(null),C=b.useRef(null),g=n??I,d=b.useCallback(e=>{A(e),i==null||i(e),e||(j(""),u(0))},[i]);b.useEffect(()=>{const e=a=>{(v?a.metaKey||a.ctrlKey:!0)&&a.key.toLowerCase()===y.toLowerCase()&&(a.preventDefault(),d(!g)),a.key==="Escape"&&g&&d(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y,v,g,d]),b.useEffect(()=>{g&&setTimeout(()=>{var e;return(e=N.current)==null?void 0:e.focus()},x.FOCUS_DELAY)},[g]);const c=b.useMemo(()=>k?k(o,l).slice(0,f):o?l.filter(e=>R(e,o)).slice(0,f):l.slice(0,f),[l,o,k,f]),O=b.useMemo(()=>{const e=new Map;return c.forEach(a=>{const t=a.group||"";e.has(t)||e.set(t,[]),e.get(t).push(a)}),e},[c]),M=b.useCallback(e=>{if(e.key==="ArrowDown")e.preventDefault(),u(a=>Math.min(a+1,c.length-1));else if(e.key==="ArrowUp")e.preventDefault(),u(a=>Math.max(a-1,0));else if(e.key==="Enter"&&c[h]){e.preventDefault();const a=c[h];a.disabled||(a.onTrigger(),d(!1))}},[c,h,d]);if(b.useEffect(()=>{const e=C.current;if(!e)return;const a=e.querySelector('[data-active="true"]');a==null||a.scrollIntoView({block:"nearest"})},[h]),!g)return null;let _=-1;return r.jsxs("div",{className:m.cn("Bear-Spotlight","bear-fixed bear-inset-0 bear-flex bear-items-start bear-justify-center bear-pt-[15vh]"),style:{zIndex:x.SPOTLIGHT_Z_INDEX},"data-testid":T,children:[r.jsx("div",{className:"Bear-Spotlight__backdrop bear-absolute bear-inset-0 bear-bg-black/50 dark:bear-bg-black/70 bear-backdrop-blur-sm",onClick:()=>d(!1),"aria-hidden":"true"}),r.jsxs("div",{className:m.cn("Bear-Spotlight__dialog","bear-relative bear-w-full bear-max-w-[560px] bear-mx-4","bear-bg-white dark:bear-bg-gray-900","bear-rounded-xl bear-shadow-2xl","bear-border bear-border-gray-200 dark:bear-border-gray-700","bear-overflow-hidden",B),style:D,role:"dialog","aria-label":"Search",children:[r.jsxs("div",{className:"Bear-Spotlight__search bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-gray-700",children:[r.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"bear-text-gray-400 dark:bear-text-gray-500 bear-shrink-0",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("input",{ref:N,type:"text",value:o,onChange:e=>{j(e.target.value),u(0)},onKeyDown:M,placeholder:p,className:m.cn("Bear-Spotlight__input","bear-flex-1 bear-bg-transparent bear-outline-none bear-text-base","bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400 dark:placeholder:bear-text-gray-500"),autoComplete:"off",spellCheck:!1}),r.jsx("kbd",{className:"bear-hidden sm:bear-inline-flex bear-items-center bear-px-1.5 bear-py-0.5 bear-rounded bear-text-[10px] bear-font-mono bear-text-gray-400 dark:bear-text-gray-500 bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"ESC"})]}),r.jsxs("div",{ref:C,className:"Bear-Spotlight__results bear-max-h-[400px] bear-overflow-y-auto bear-py-2",role:"listbox",children:[c.length===0&&r.jsx("div",{className:"Bear-Spotlight__empty bear-px-4 bear-py-8 bear-text-center bear-text-gray-500 dark:bear-text-gray-400 bear-text-sm",children:L}),Array.from(O.entries()).map(([e,a])=>r.jsxs("div",{className:"Bear-Spotlight__group",children:[e&&r.jsx("div",{className:"Bear-Spotlight__group-title bear-px-4 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500",children:e}),a.map(t=>{_++;const w=_===h,F=_;return r.jsxs("button",{className:m.cn("Bear-Spotlight__action","bear-w-full bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2.5 bear-text-left bear-cursor-pointer","bear-transition-colors bear-duration-100",w?"bear-bg-gray-100 dark:bear-bg-gray-800":"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",t.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),"data-active":w,onMouseEnter:()=>u(F),onClick:()=>{t.disabled||(t.onTrigger(),d(!1))},role:"option","aria-selected":w,"aria-disabled":t.disabled,children:[t.icon&&r.jsx("span",{className:"Bear-Spotlight__action-icon bear-text-gray-500 dark:bear-text-gray-400 bear-shrink-0",children:t.icon}),r.jsxs("div",{className:"Bear-Spotlight__action-body bear-flex-1 bear-min-w-0",children:[r.jsx("div",{className:"Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate",children:S?E(t.label,o):t.label}),t.description&&r.jsx("div",{className:"Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",children:S?E(t.description,o):t.description})]}),t.rightSection&&r.jsx("span",{className:"Bear-Spotlight__action-right bear-shrink-0",children:t.rightSection})]},t.id)})]},e))]}),r.jsxs("div",{className:"Bear-Spotlight__footer bear-border-t bear-border-gray-200 dark:bear-border-gray-700 bear-px-4 bear-py-2 bear-flex bear-items-center bear-gap-4 bear-text-[11px] bear-text-gray-400 dark:bear-text-gray-500",children:[r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↑↓"}),"navigate"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↵"}),"select"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"esc"}),"close"]})]})]})]})};exports.Spotlight=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),h=require("../../utils/cn.cjs"),o=require("./Spotlight.const.cjs"),m=require("./Spotlight.utils.cjs"),U=N=>{const{actions:g,open:E,onOpenChange:x,placeholder:B=o.DEFAULT_PLACEHOLDER,shortcutKey:k=o.DEFAULT_SHORTCUT_KEY,shortcutMod:_=!0,nothingFoundMessage:T=o.DEFAULT_NOTHING_FOUND,highlightMatches:v=!0,limit:p=o.DEFAULT_LIMIT,filter:u,className:D,style:C,testId:I}=N,[L,A]=s.useState(!1),[b,S]=s.useState(""),[d,c]=s.useState(0),j=s.useRef(null),w=s.useRef(null),n=E??L,l=s.useCallback(e=>{A(e),x==null||x(e),e||(S(""),c(0))},[x]);s.useEffect(()=>{const e=a=>{(_?a.metaKey||a.ctrlKey:!0)&&a.key.toLowerCase()===k.toLowerCase()&&(a.preventDefault(),l(!n)),a.key==="Escape"&&n&&l(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[k,_,n,l]),s.useEffect(()=>{n&&setTimeout(()=>{var e;return(e=j.current)==null?void 0:e.focus()},o.FOCUS_DELAY)},[n]);const i=s.useMemo(()=>u?u(b,g).slice(0,p):b?g.filter(e=>m.matchAction(e,b)).slice(0,p):g.slice(0,p),[g,b,u,p]),M=s.useMemo(()=>{const e=new Map;return i.forEach(a=>{const t=a.group||"";e.has(t)||e.set(t,[]),e.get(t).push(a)}),e},[i]),O=s.useCallback(e=>{if(e.key==="ArrowDown")e.preventDefault(),c(a=>Math.min(a+1,i.length-1));else if(e.key==="ArrowUp")e.preventDefault(),c(a=>Math.max(a-1,0));else if(e.key==="Enter"&&i[d]){e.preventDefault();const a=i[d];a.disabled||(a.onTrigger(),l(!1))}},[i,d,l]);if(s.useEffect(()=>{const e=w.current;if(!e)return;const a=e.querySelector('[data-active="true"]');a==null||a.scrollIntoView({block:"nearest"})},[d]),!n)return null;let y=-1;return r.jsxs("div",{className:h.cn("Bear-Spotlight","bear-fixed bear-inset-0 bear-flex bear-items-start bear-justify-center bear-pt-[15vh]"),style:{zIndex:o.SPOTLIGHT_Z_INDEX},"data-testid":I,children:[r.jsx("div",{className:"Bear-Spotlight__backdrop bear-absolute bear-inset-0 bear-bg-black/50 dark:bear-bg-black/70 bear-backdrop-blur-sm",onClick:()=>l(!1),"aria-hidden":"true"}),r.jsxs("div",{className:h.cn("Bear-Spotlight__dialog","bear-relative bear-w-full bear-max-w-[560px] bear-mx-4","bear-bg-white dark:bear-bg-gray-900","bear-rounded-xl bear-shadow-2xl","bear-border bear-border-gray-200 dark:bear-border-gray-700","bear-overflow-hidden",D),style:C,role:"dialog","aria-label":"Search",children:[r.jsxs("div",{className:"Bear-Spotlight__search bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-gray-700",children:[r.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,className:"bear-text-gray-400 dark:bear-text-gray-500 bear-shrink-0",children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("input",{ref:j,type:"text",value:b,onChange:e=>{S(e.target.value),c(0)},onKeyDown:O,placeholder:B,className:h.cn("Bear-Spotlight__input","bear-flex-1 bear-bg-transparent bear-outline-none bear-text-base","bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400 dark:placeholder:bear-text-gray-500"),autoComplete:"off",spellCheck:!1}),r.jsx("kbd",{className:"bear-hidden sm:bear-inline-flex bear-items-center bear-px-1.5 bear-py-0.5 bear-rounded bear-text-[10px] bear-font-mono bear-text-gray-400 dark:bear-text-gray-500 bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"ESC"})]}),r.jsxs("div",{ref:w,className:"Bear-Spotlight__results bear-max-h-[400px] bear-overflow-y-auto bear-py-2",role:"listbox",children:[i.length===0&&r.jsx("div",{className:"Bear-Spotlight__empty bear-px-4 bear-py-8 bear-text-center bear-text-gray-500 dark:bear-text-gray-400 bear-text-sm",children:T}),Array.from(M.entries()).map(([e,a])=>r.jsxs("div",{className:"Bear-Spotlight__group",children:[e&&r.jsx("div",{className:"Bear-Spotlight__group-title bear-px-4 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500",children:e}),a.map(t=>{y++;const f=y===d,R=y;return r.jsxs("button",{className:h.cn("Bear-Spotlight__action","bear-w-full bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2.5 bear-text-left bear-cursor-pointer","bear-transition-colors bear-duration-100",f?"bear-bg-gray-100 dark:bear-bg-gray-800":"hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",t.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),"data-active":f,onMouseEnter:()=>c(R),onClick:()=>{t.disabled||(t.onTrigger(),l(!1))},role:"option","aria-selected":f,"aria-disabled":t.disabled,children:[t.icon&&r.jsx("span",{className:"Bear-Spotlight__action-icon bear-text-gray-500 dark:bear-text-gray-400 bear-shrink-0",children:t.icon}),r.jsxs("div",{className:"Bear-Spotlight__action-body bear-flex-1 bear-min-w-0",children:[r.jsx("div",{className:"Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate",children:v?m.highlightText(t.label,b):t.label}),t.description&&r.jsx("div",{className:"Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",children:v?m.highlightText(t.description,b):t.description})]}),t.rightSection&&r.jsx("span",{className:"Bear-Spotlight__action-right bear-shrink-0",children:t.rightSection})]},t.id)})]},e))]}),r.jsxs("div",{className:"Bear-Spotlight__footer bear-border-t bear-border-gray-200 dark:bear-border-gray-700 bear-px-4 bear-py-2 bear-flex bear-items-center bear-gap-4 bear-text-[11px] bear-text-gray-400 dark:bear-text-gray-500",children:[r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↑↓"}),"navigate"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"↵"}),"select"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("kbd",{className:"bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700",children:"esc"}),"close"]})]})]})]})};exports.Spotlight=U;
@@ -1,100 +1,89 @@
1
- import { jsxs as b, jsx as t, Fragment as G } from "react/jsx-runtime";
2
- import { useState as w, useRef as E, useCallback as D, useEffect as v, useMemo as T } from "react";
3
- import { cn as m } from "../../utils/cn.js";
4
- import { DEFAULT_PLACEHOLDER as P, DEFAULT_SHORTCUT_KEY as Y, DEFAULT_NOTHING_FOUND as z, DEFAULT_LIMIT as Q, FOCUS_DELAY as V, SPOTLIGHT_Z_INDEX as W } from "./Spotlight.const.js";
5
- const X = (l, s) => {
6
- var o, u;
7
- const i = s.toLowerCase();
8
- return !!(l.label.toLowerCase().includes(i) || (o = l.description) != null && o.toLowerCase().includes(i) || (u = l.keywords) != null && u.some((y) => y.toLowerCase().includes(i)));
9
- }, I = (l, s) => {
10
- if (!s) return l;
11
- const i = l.toLowerCase().indexOf(s.toLowerCase());
12
- return i === -1 ? l : /* @__PURE__ */ b(G, { children: [
13
- l.slice(0, i),
14
- /* @__PURE__ */ t("mark", { className: "Bear-Spotlight__highlight bear-bg-yellow-200 dark:bear-bg-yellow-800 bear-text-inherit bear-rounded-sm bear-px-0.5", children: l.slice(i, i + s.length) }),
15
- l.slice(i + s.length)
16
- ] });
17
- }, ee = (l) => {
1
+ import { jsxs as b, jsx as t } from "react/jsx-runtime";
2
+ import { useState as u, useRef as B, useCallback as E, useEffect as f, useMemo as D } from "react";
3
+ import { cn as h } from "../../utils/cn.js";
4
+ import { DEFAULT_PLACEHOLDER as q, DEFAULT_SHORTCUT_KEY as G, DEFAULT_NOTHING_FOUND as P, DEFAULT_LIMIT as Y, FOCUS_DELAY as z, SPOTLIGHT_Z_INDEX as Q } from "./Spotlight.const.js";
5
+ import { matchAction as V, highlightText as T } from "./Spotlight.utils.js";
6
+ const ee = (I) => {
18
7
  const {
19
- actions: s,
20
- open: i,
21
- onOpenChange: o,
22
- placeholder: u = P,
23
- shortcutKey: y = Y,
24
- shortcutMod: N = !0,
25
- nothingFoundMessage: A = z,
26
- highlightMatches: S = !0,
27
- limit: x = Q,
28
- filter: f,
8
+ actions: c,
9
+ open: L,
10
+ onOpenChange: g,
11
+ placeholder: A = q,
12
+ shortcutKey: k = G,
13
+ shortcutMod: _ = !0,
14
+ nothingFoundMessage: C = P,
15
+ highlightMatches: v = !0,
16
+ limit: p = Y,
17
+ filter: y,
29
18
  className: O,
30
19
  style: M,
31
- testId: F
32
- } = l, [U, K] = w(!1), [n, L] = w(""), [p, h] = w(0), B = E(null), C = E(null), g = i ?? U, d = D(
20
+ testId: U
21
+ } = I, [F, K] = u(!1), [l, w] = u(""), [n, d] = u(0), N = B(null), S = B(null), o = L ?? F, s = E(
33
22
  (e) => {
34
- K(e), o == null || o(e), e || (L(""), h(0));
23
+ K(e), g == null || g(e), e || (w(""), d(0));
35
24
  },
36
- [o]
25
+ [g]
37
26
  );
38
- v(() => {
27
+ f(() => {
39
28
  const e = (r) => {
40
- (N ? r.metaKey || r.ctrlKey : !0) && r.key.toLowerCase() === y.toLowerCase() && (r.preventDefault(), d(!g)), r.key === "Escape" && g && d(!1);
29
+ (_ ? r.metaKey || r.ctrlKey : !0) && r.key.toLowerCase() === k.toLowerCase() && (r.preventDefault(), s(!o)), r.key === "Escape" && o && s(!1);
41
30
  };
42
31
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
43
- }, [y, N, g, d]), v(() => {
44
- g && setTimeout(() => {
32
+ }, [k, _, o, s]), f(() => {
33
+ o && setTimeout(() => {
45
34
  var e;
46
- return (e = B.current) == null ? void 0 : e.focus();
47
- }, V);
48
- }, [g]);
49
- const c = T(() => f ? f(n, s).slice(0, x) : n ? s.filter((e) => X(e, n)).slice(0, x) : s.slice(0, x), [s, n, f, x]), R = T(() => {
35
+ return (e = N.current) == null ? void 0 : e.focus();
36
+ }, z);
37
+ }, [o]);
38
+ const i = D(() => y ? y(l, c).slice(0, p) : l ? c.filter((e) => V(e, l)).slice(0, p) : c.slice(0, p), [c, l, y, p]), R = D(() => {
50
39
  const e = /* @__PURE__ */ new Map();
51
- return c.forEach((r) => {
40
+ return i.forEach((r) => {
52
41
  const a = r.group || "";
53
42
  e.has(a) || e.set(a, []), e.get(a).push(r);
54
43
  }), e;
55
- }, [c]), H = D(
44
+ }, [i]), H = E(
56
45
  (e) => {
57
46
  if (e.key === "ArrowDown")
58
- e.preventDefault(), h((r) => Math.min(r + 1, c.length - 1));
47
+ e.preventDefault(), d((r) => Math.min(r + 1, i.length - 1));
59
48
  else if (e.key === "ArrowUp")
60
- e.preventDefault(), h((r) => Math.max(r - 1, 0));
61
- else if (e.key === "Enter" && c[p]) {
49
+ e.preventDefault(), d((r) => Math.max(r - 1, 0));
50
+ else if (e.key === "Enter" && i[n]) {
62
51
  e.preventDefault();
63
- const r = c[p];
64
- r.disabled || (r.onTrigger(), d(!1));
52
+ const r = i[n];
53
+ r.disabled || (r.onTrigger(), s(!1));
65
54
  }
66
55
  },
67
- [c, p, d]
56
+ [i, n, s]
68
57
  );
69
- if (v(() => {
70
- const e = C.current;
58
+ if (f(() => {
59
+ const e = S.current;
71
60
  if (!e) return;
72
61
  const r = e.querySelector('[data-active="true"]');
73
62
  r == null || r.scrollIntoView({ block: "nearest" });
74
- }, [p]), !g) return null;
75
- let k = -1;
63
+ }, [n]), !o) return null;
64
+ let x = -1;
76
65
  return /* @__PURE__ */ b(
77
66
  "div",
78
67
  {
79
- className: m(
68
+ className: h(
80
69
  "Bear-Spotlight",
81
70
  "bear-fixed bear-inset-0 bear-flex bear-items-start bear-justify-center bear-pt-[15vh]"
82
71
  ),
83
- style: { zIndex: W },
84
- "data-testid": F,
72
+ style: { zIndex: Q },
73
+ "data-testid": U,
85
74
  children: [
86
75
  /* @__PURE__ */ t(
87
76
  "div",
88
77
  {
89
78
  className: "Bear-Spotlight__backdrop bear-absolute bear-inset-0 bear-bg-black/50 dark:bear-bg-black/70 bear-backdrop-blur-sm",
90
- onClick: () => d(!1),
79
+ onClick: () => s(!1),
91
80
  "aria-hidden": "true"
92
81
  }
93
82
  ),
94
83
  /* @__PURE__ */ b(
95
84
  "div",
96
85
  {
97
- className: m(
86
+ className: h(
98
87
  "Bear-Spotlight__dialog",
99
88
  "bear-relative bear-w-full bear-max-w-[560px] bear-mx-4",
100
89
  "bear-bg-white dark:bear-bg-gray-900",
@@ -127,15 +116,15 @@ const X = (l, s) => {
127
116
  /* @__PURE__ */ t(
128
117
  "input",
129
118
  {
130
- ref: B,
119
+ ref: N,
131
120
  type: "text",
132
- value: n,
121
+ value: l,
133
122
  onChange: (e) => {
134
- L(e.target.value), h(0);
123
+ w(e.target.value), d(0);
135
124
  },
136
125
  onKeyDown: H,
137
- placeholder: u,
138
- className: m(
126
+ placeholder: A,
127
+ className: h(
139
128
  "Bear-Spotlight__input",
140
129
  "bear-flex-1 bear-bg-transparent bear-outline-none bear-text-base",
141
130
  "bear-text-gray-900 dark:bear-text-white",
@@ -150,39 +139,39 @@ const X = (l, s) => {
150
139
  /* @__PURE__ */ b(
151
140
  "div",
152
141
  {
153
- ref: C,
142
+ ref: S,
154
143
  className: "Bear-Spotlight__results bear-max-h-[400px] bear-overflow-y-auto bear-py-2",
155
144
  role: "listbox",
156
145
  children: [
157
- c.length === 0 && /* @__PURE__ */ t("div", { className: "Bear-Spotlight__empty bear-px-4 bear-py-8 bear-text-center bear-text-gray-500 dark:bear-text-gray-400 bear-text-sm", children: A }),
146
+ i.length === 0 && /* @__PURE__ */ t("div", { className: "Bear-Spotlight__empty bear-px-4 bear-py-8 bear-text-center bear-text-gray-500 dark:bear-text-gray-400 bear-text-sm", children: C }),
158
147
  Array.from(R.entries()).map(([e, r]) => /* @__PURE__ */ b("div", { className: "Bear-Spotlight__group", children: [
159
148
  e && /* @__PURE__ */ t("div", { className: "Bear-Spotlight__group-title bear-px-4 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500", children: e }),
160
149
  r.map((a) => {
161
- k++;
162
- const _ = k === p, j = k;
150
+ x++;
151
+ const m = x === n, j = x;
163
152
  return /* @__PURE__ */ b(
164
153
  "button",
165
154
  {
166
- className: m(
155
+ className: h(
167
156
  "Bear-Spotlight__action",
168
157
  "bear-w-full bear-flex bear-items-center bear-gap-3 bear-px-4 bear-py-2.5 bear-text-left bear-cursor-pointer",
169
158
  "bear-transition-colors bear-duration-100",
170
- _ ? "bear-bg-gray-100 dark:bear-bg-gray-800" : "hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",
159
+ m ? "bear-bg-gray-100 dark:bear-bg-gray-800" : "hover:bear-bg-gray-50 dark:hover:bear-bg-gray-800/50",
171
160
  a.disabled && "bear-opacity-50 bear-cursor-not-allowed"
172
161
  ),
173
- "data-active": _,
174
- onMouseEnter: () => h(j),
162
+ "data-active": m,
163
+ onMouseEnter: () => d(j),
175
164
  onClick: () => {
176
- a.disabled || (a.onTrigger(), d(!1));
165
+ a.disabled || (a.onTrigger(), s(!1));
177
166
  },
178
167
  role: "option",
179
- "aria-selected": _,
168
+ "aria-selected": m,
180
169
  "aria-disabled": a.disabled,
181
170
  children: [
182
171
  a.icon && /* @__PURE__ */ t("span", { className: "Bear-Spotlight__action-icon bear-text-gray-500 dark:bear-text-gray-400 bear-shrink-0", children: a.icon }),
183
172
  /* @__PURE__ */ b("div", { className: "Bear-Spotlight__action-body bear-flex-1 bear-min-w-0", children: [
184
- /* @__PURE__ */ t("div", { className: "Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate", children: S ? I(a.label, n) : a.label }),
185
- a.description && /* @__PURE__ */ t("div", { className: "Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate", children: S ? I(a.description, n) : a.description })
173
+ /* @__PURE__ */ t("div", { className: "Bear-Spotlight__action-label bear-text-sm bear-font-medium bear-text-gray-900 dark:bear-text-white bear-truncate", children: v ? T(a.label, l) : a.label }),
174
+ a.description && /* @__PURE__ */ t("div", { className: "Bear-Spotlight__action-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate", children: v ? T(a.description, l) : a.description })
186
175
  ] }),
187
176
  a.rightSection && /* @__PURE__ */ t("span", { className: "Bear-Spotlight__action-right bear-shrink-0", children: a.rightSection })
188
177
  ]
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=(e,t)=>{var s,o;const r=t.toLowerCase();return!!(e.label.toLowerCase().includes(r)||(s=e.description)!=null&&s.toLowerCase().includes(r)||(o=e.keywords)!=null&&o.some(n=>n.toLowerCase().includes(r)))},a=(e,t)=>{if(!t)return e;const r=e.toLowerCase().indexOf(t.toLowerCase());return r===-1?e:i.jsxs(i.Fragment,{children:[e.slice(0,r),i.jsx("mark",{className:"Bear-Spotlight__highlight bear-bg-yellow-200 dark:bear-bg-yellow-800 bear-text-inherit bear-rounded-sm bear-px-0.5",children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})};exports.highlightText=a;exports.matchAction=l;
@@ -0,0 +1,3 @@
1
+ import { SpotlightAction } from './Spotlight.types';
2
+ export declare const matchAction: (action: SpotlightAction, query: string) => boolean;
3
+ export declare const highlightText: (text: string, query: string) => React.ReactNode;
@@ -0,0 +1,18 @@
1
+ import { jsxs as n, Fragment as l, jsx as a } from "react/jsx-runtime";
2
+ const h = (e, s) => {
3
+ var o, i;
4
+ const r = s.toLowerCase();
5
+ return !!(e.label.toLowerCase().includes(r) || (o = e.description) != null && o.toLowerCase().includes(r) || (i = e.keywords) != null && i.some((t) => t.toLowerCase().includes(r)));
6
+ }, d = (e, s) => {
7
+ if (!s) return e;
8
+ const r = e.toLowerCase().indexOf(s.toLowerCase());
9
+ return r === -1 ? e : /* @__PURE__ */ n(l, { children: [
10
+ e.slice(0, r),
11
+ /* @__PURE__ */ a("mark", { className: "Bear-Spotlight__highlight bear-bg-yellow-200 dark:bear-bg-yellow-800 bear-text-inherit bear-rounded-sm bear-px-0.5", children: e.slice(r, r + s.length) }),
12
+ e.slice(r + s.length)
13
+ ] });
14
+ };
15
+ export {
16
+ d as highlightText,
17
+ h as matchAction
18
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),l=require("react"),x=require("../../utils/cn.cjs"),C=require("../Dropdown/Dropdown.cjs"),j=require("../Icon/index.cjs"),q=require("./Tabs.cjs");function k(a){var o;return l.isValidElement(a)&&typeof a.type!="string"&&((o=a.props)==null?void 0:o.id)!=null}const E=({children:a,maxVisibleTabs:o,wrap:y=!1,className:f})=>{const u=l.useContext(q.TabsContext);if(!u)throw new Error("TabList must be used within Tabs");const{activeTab:s,setActiveTab:g,variant:t}=u,m=l.Children.toArray(a).filter(k),i=m.map(e=>({id:e.props.id,label:e.props.children,disabled:e.props.disabled})),b=s?[s,...i.map(e=>e.id).filter(e=>e!==s)]:i.map(e=>e.id),v=o??b.length,T=b.slice(0,v),c=b.slice(v),d=c.includes(s),h=x.cn("Bear-Tabs__list",`Bear-Tabs__list--${t}`,"bear-flex bear-gap-1",y&&"bear-flex-wrap",t==="line"&&"bear-border-b",t==="pills"&&"bear-p-1 bear-rounded-lg",t==="enclosed"&&"bear-border-b",f),w={...t==="line"||t==="enclosed"?{borderColor:"var(--bear-border-default)"}:{},...t==="pills"?{backgroundColor:"var(--bear-bg-tertiary)"}:{}};return n.jsxs("div",{role:"tablist",className:h,style:w,children:[o!=null?T.map(e=>{const r=m.find(p=>p.props.id===e);return r?l.cloneElement(r,{key:r.props.id}):null}):a,o!=null&&c.length>0&&n.jsx(C.Dropdown,{placement:"bottom-start",closeOnSelect:!0,trigger:n.jsx("button",{type:"button",role:"tab","aria-haspopup":"listbox","aria-label":"More tabs",className:x.cn("bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors bear-border-0 bear-cursor-pointer",t==="pills"&&"bear-rounded-md",d&&"bear-shadow-sm",!d&&"hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]"),style:d?{backgroundColor:"var(--bear-bg-primary)",color:"var(--bear-text-primary)"}:{color:"var(--bear-text-muted)"},children:n.jsx(j.BearIcons.MoreHorizIcon,{size:18})}),items:c.map(e=>{const r=i.find(p=>p.id===e);return{key:e,label:(r==null?void 0:r.label)??e,disabled:r==null?void 0:r.disabled,onClick:()=>g(e)}})})]})};exports.TabList=E;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { TabListProps } from './Tabs.types';
3
+ export declare const TabList: FC<TabListProps>;
@@ -0,0 +1,69 @@
1
+ import { jsxs as w, jsx as d } from "react/jsx-runtime";
2
+ import { useContext as T, Children as k, cloneElement as E, isValidElement as I } from "react";
3
+ import { cn as f } from "../../utils/cn.js";
4
+ import { Dropdown as _ } from "../Dropdown/Dropdown.js";
5
+ import { BearIcons as A } from "../Icon/index.js";
6
+ import { TabsContext as B } from "./Tabs.js";
7
+ function M(o) {
8
+ var a;
9
+ return I(o) && typeof o.type != "string" && ((a = o.props) == null ? void 0 : a.id) != null;
10
+ }
11
+ const H = ({ children: o, maxVisibleTabs: a, wrap: v = !1, className: y }) => {
12
+ const c = T(B);
13
+ if (!c) throw new Error("TabList must be used within Tabs");
14
+ const { activeTab: s, setActiveTab: g, variant: t } = c, m = k.toArray(o).filter(M), l = m.map((e) => ({ id: e.props.id, label: e.props.children, disabled: e.props.disabled })), n = s ? [s, ...l.map((e) => e.id).filter((e) => e !== s)] : l.map((e) => e.id), u = a ?? n.length, x = n.slice(0, u), b = n.slice(u), i = b.includes(s), h = f(
15
+ "Bear-Tabs__list",
16
+ `Bear-Tabs__list--${t}`,
17
+ "bear-flex bear-gap-1",
18
+ v && "bear-flex-wrap",
19
+ t === "line" && "bear-border-b",
20
+ t === "pills" && "bear-p-1 bear-rounded-lg",
21
+ t === "enclosed" && "bear-border-b",
22
+ y
23
+ ), C = {
24
+ ...t === "line" || t === "enclosed" ? { borderColor: "var(--bear-border-default)" } : {},
25
+ ...t === "pills" ? { backgroundColor: "var(--bear-bg-tertiary)" } : {}
26
+ };
27
+ return /* @__PURE__ */ w("div", { role: "tablist", className: h, style: C, children: [
28
+ a != null ? x.map((e) => {
29
+ const r = m.find((p) => p.props.id === e);
30
+ return r ? E(r, { key: r.props.id }) : null;
31
+ }) : o,
32
+ a != null && b.length > 0 && /* @__PURE__ */ d(
33
+ _,
34
+ {
35
+ placement: "bottom-start",
36
+ closeOnSelect: !0,
37
+ trigger: /* @__PURE__ */ d(
38
+ "button",
39
+ {
40
+ type: "button",
41
+ role: "tab",
42
+ "aria-haspopup": "listbox",
43
+ "aria-label": "More tabs",
44
+ className: f(
45
+ "bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors bear-border-0 bear-cursor-pointer",
46
+ t === "pills" && "bear-rounded-md",
47
+ i && "bear-shadow-sm",
48
+ !i && "hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]"
49
+ ),
50
+ style: i ? { backgroundColor: "var(--bear-bg-primary)", color: "var(--bear-text-primary)" } : { color: "var(--bear-text-muted)" },
51
+ children: /* @__PURE__ */ d(A.MoreHorizIcon, { size: 18 })
52
+ }
53
+ ),
54
+ items: b.map((e) => {
55
+ const r = l.find((p) => p.id === e);
56
+ return {
57
+ key: e,
58
+ label: (r == null ? void 0 : r.label) ?? e,
59
+ disabled: r == null ? void 0 : r.disabled,
60
+ onClick: () => g(e)
61
+ };
62
+ })
63
+ }
64
+ )
65
+ ] });
66
+ };
67
+ export {
68
+ H as TabList
69
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("react"),c=require("../../utils/cn.cjs"),i=require("./Tabs.cjs"),u=({tabId:t,children:n,className:r})=>{const e=o.useContext(i.TabsContext);if(!e)throw new Error("TabPanel must be used within Tabs");const{activeTab:a}=e;return a!==t?null:s.jsx("div",{role:"tabpanel",className:c.cn("Bear-Tabs__panel bear-py-4",r),children:n})};exports.TabPanel=u;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { TabPanelProps } from './Tabs.types';
3
+ export declare const TabPanel: FC<TabPanelProps>;
@@ -0,0 +1,13 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useContext as s } from "react";
3
+ import { cn as i } from "../../utils/cn.js";
4
+ import { TabsContext as m } from "./Tabs.js";
5
+ const f = ({ tabId: r, children: e, className: o }) => {
6
+ const t = s(m);
7
+ if (!t) throw new Error("TabPanel must be used within Tabs");
8
+ const { activeTab: a } = t;
9
+ return a !== r ? null : /* @__PURE__ */ n("div", { role: "tabpanel", className: i("Bear-Tabs__panel bear-py-4", o), children: e });
10
+ };
11
+ export {
12
+ f as TabPanel
13
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("react"),s=require("../../utils/cn.cjs"),d=i.createContext(null),T=({children:a,defaultTab:t,variant:r="line",onChange:e,className:o,testId:l})=>{const[x,g]=i.useState(t),b=c=>{g(c),e==null||e(c)};return n.jsx(d.Provider,{value:{activeTab:x,setActiveTab:b,variant:r},children:n.jsx("div",{className:s.cn("Bear-Tabs",o),"data-testid":l,children:a})})},y=({children:a,className:t})=>{const r=i.useContext(d);if(!r)throw new Error("TabList must be used within Tabs");const{variant:e}=r;return n.jsx("div",{role:"tablist",className:s.cn("Bear-Tabs__list",`Bear-Tabs__list--${e}`,"bear-flex bear-gap-1",e==="line"&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",e==="pills"&&"bear-bg-gray-100 dark:bear-bg-gray-800 bear-p-1 bear-rounded-lg",e==="enclosed"&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",t),children:a})},v=({id:a,children:t,disabled:r=!1,icon:e})=>{const o=i.useContext(d);if(!o)throw new Error("Tab must be used within Tabs");const{activeTab:l,setActiveTab:x,variant:g}=o,b=l===a,c="bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors",u={line:s.cn("bear-border-b-2 bear--mb-px",b?"bear-border-pink-500 bear-text-pink-600 dark:bear-text-pink-400":"bear-border-transparent bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-border-gray-300"),pills:s.cn("bear-rounded-md",b?"bear-bg-white dark:bear-bg-gray-700 bear-text-gray-900 dark:bear-text-white bear-shadow-sm":"bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"),enclosed:s.cn("bear-rounded-t-lg bear-border bear-border-transparent",b?"bear-bg-white dark:bear-bg-gray-900 bear-border-gray-200 dark:bear-border-gray-700 bear-border-b-white dark:bear-border-b-gray-900 bear--mb-px bear-text-gray-900 dark:bear-text-white":"bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white")};return n.jsxs("button",{role:"tab","aria-selected":b,disabled:r,onClick:()=>!r&&x(a),className:s.cn("Bear-Tabs__tab",b&&"Bear-Tabs__tab--active",c,u[g],r&&"Bear-Tabs__tab--disabled bear-opacity-50 bear-cursor-not-allowed"),children:[e&&n.jsx("span",{className:"Bear-Tabs__tab-icon",children:e}),n.jsx("span",{className:"Bear-Tabs__tab-label",children:t})]})},h=({tabId:a,children:t,className:r})=>{const e=i.useContext(d);if(!e)throw new Error("TabPanel must be used within Tabs");const{activeTab:o}=e;return o!==a?null:n.jsx("div",{role:"tabpanel",className:s.cn("Bear-Tabs__panel bear-py-4",r),children:t})};exports.Tab=v;exports.TabList=y;exports.TabPanel=h;exports.Tabs=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),m=require("react"),b=require("../../utils/cn.cjs"),x=m.createContext(null),T=({children:o,value:n,defaultTab:e,variant:c="line",onChange:a,className:l,testId:d})=>{const[t,r]=m.useState(e),i=n!==void 0,v=i?n:t,u=p=>{i||r(p),a==null||a(p)};return s.jsx(x.Provider,{value:{activeTab:v,setActiveTab:u,variant:c},children:s.jsx("div",{className:b.cn("Bear-Tabs",l),"data-testid":d,children:o})})},y=({id:o,children:n,disabled:e=!1,icon:c})=>{const a=m.useContext(x);if(!a)throw new Error("Tab must be used within Tabs");const{activeTab:l,setActiveTab:d,variant:t}=a,r=l===o,i="bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors",v={line:b.cn("bear-border-b-2 bear--mb-px",r?"bear-border-pink-500 bear-text-pink-600 dark:bear-text-pink-400":"bear-border-transparent hover:bear-border-[var(--bear-border-default)]"),pills:b.cn("bear-rounded-md",r&&"bear-shadow-sm"),enclosed:b.cn("bear-rounded-t-lg bear-border bear-border-transparent",r&&"bear--mb-px")},u=e?void 0:r?t==="pills"?{backgroundColor:"var(--bear-bg-primary)",color:"var(--bear-text-primary)"}:t==="enclosed"?{backgroundColor:"var(--bear-bg-primary)",borderColor:"var(--bear-border-default)",borderBottomColor:"var(--bear-bg-primary)",color:"var(--bear-text-primary)"}:void 0:{color:"var(--bear-text-muted)"};return s.jsxs("button",{role:"tab","aria-selected":r,disabled:e,onClick:()=>!e&&d(o),className:b.cn("Bear-Tabs__tab",r&&"Bear-Tabs__tab--active",i,v[t],!r&&"hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]",e&&"Bear-Tabs__tab--disabled bear-opacity-50 bear-cursor-not-allowed"),style:u,children:[c&&s.jsx("span",{className:"Bear-Tabs__tab-icon",children:c}),s.jsx("span",{className:"Bear-Tabs__tab-label",children:n})]})};exports.Tab=y;exports.Tabs=T;exports.TabsContext=x;
@@ -1,30 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { TabsProps, TabListProps, TabProps, TabPanelProps } from './Tabs.types';
3
- /**
4
- * Tabs - Tabbed interface for organizing content
5
- *
6
- * @example
7
- * ```tsx
8
- * <Tabs defaultTab="tab1" variant="line">
9
- * <TabList>
10
- * <Tab id="tab1">Tab 1</Tab>
11
- * <Tab id="tab2">Tab 2</Tab>
12
- * </TabList>
13
- * <TabPanel tabId="tab1">Content 1</TabPanel>
14
- * <TabPanel tabId="tab2">Content 2</TabPanel>
15
- * </Tabs>
16
- * ```
17
- */
2
+ import { TabsContextValue, TabsProps, TabProps } from './Tabs.types';
3
+ export declare const TabsContext: import('react').Context<TabsContextValue | null>;
18
4
  export declare const Tabs: FC<TabsProps>;
19
- /**
20
- * TabList - Container for tab buttons
21
- */
22
- export declare const TabList: FC<TabListProps>;
23
- /**
24
- * Tab - Individual tab button
25
- */
26
5
  export declare const Tab: FC<TabProps>;
27
- /**
28
- * TabPanel - Content panel for a tab
29
- */
30
- export declare const TabPanel: FC<TabPanelProps>;
@@ -1,84 +1,66 @@
1
- import { jsxs as T, jsx as n } from "react/jsx-runtime";
2
- import { createContext as p, useContext as g, useState as m } from "react";
3
- import { cn as s } from "../../utils/cn.js";
4
- const d = p(null), k = ({
5
- children: a,
6
- defaultTab: t,
7
- variant: e = "line",
8
- onChange: r,
9
- className: o,
10
- testId: c
1
+ import { jsxs as u, jsx as l } from "react/jsx-runtime";
2
+ import { createContext as T, useContext as y, useState as f } from "react";
3
+ import { cn as b } from "../../utils/cn.js";
4
+ const x = T(null), C = ({
5
+ children: o,
6
+ value: s,
7
+ defaultTab: e,
8
+ variant: n = "line",
9
+ onChange: a,
10
+ className: c,
11
+ testId: d
11
12
  }) => {
12
- const [l, x] = m(t), b = (i) => {
13
- x(i), r == null || r(i);
13
+ const [t, r] = f(e), i = s !== void 0, m = i ? s : t, v = (p) => {
14
+ i || r(p), a == null || a(p);
14
15
  };
15
- return /* @__PURE__ */ n(d.Provider, { value: { activeTab: l, setActiveTab: b, variant: e }, children: /* @__PURE__ */ n("div", { className: s("Bear-Tabs", o), "data-testid": c, children: a }) });
16
- }, w = ({ children: a, className: t }) => {
17
- const e = g(d);
18
- if (!e) throw new Error("TabList must be used within Tabs");
19
- const { variant: r } = e;
20
- return /* @__PURE__ */ n(
21
- "div",
22
- {
23
- role: "tablist",
24
- className: s(
25
- "Bear-Tabs__list",
26
- `Bear-Tabs__list--${r}`,
27
- "bear-flex bear-gap-1",
28
- r === "line" && "bear-border-b bear-border-gray-200 dark:bear-border-gray-700",
29
- r === "pills" && "bear-bg-gray-100 dark:bear-bg-gray-800 bear-p-1 bear-rounded-lg",
30
- r === "enclosed" && "bear-border-b bear-border-gray-200 dark:bear-border-gray-700",
31
- t
32
- ),
33
- children: a
34
- }
35
- );
36
- }, _ = ({ id: a, children: t, disabled: e = !1, icon: r }) => {
37
- const o = g(d);
38
- if (!o) throw new Error("Tab must be used within Tabs");
39
- const { activeTab: c, setActiveTab: l, variant: x } = o, b = c === a, i = "bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors", y = {
40
- line: s(
16
+ return /* @__PURE__ */ l(x.Provider, { value: { activeTab: m, setActiveTab: v, variant: n }, children: /* @__PURE__ */ l("div", { className: b("Bear-Tabs", c), "data-testid": d, children: o }) });
17
+ }, g = ({ id: o, children: s, disabled: e = !1, icon: n }) => {
18
+ const a = y(x);
19
+ if (!a) throw new Error("Tab must be used within Tabs");
20
+ const { activeTab: c, setActiveTab: d, variant: t } = a, r = c === o, i = "bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors", m = {
21
+ line: b(
41
22
  "bear-border-b-2 bear--mb-px",
42
- b ? "bear-border-pink-500 bear-text-pink-600 dark:bear-text-pink-400" : "bear-border-transparent bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-border-gray-300"
23
+ r ? "bear-border-pink-500 bear-text-pink-600 dark:bear-text-pink-400" : "bear-border-transparent hover:bear-border-[var(--bear-border-default)]"
43
24
  ),
44
- pills: s(
25
+ pills: b(
45
26
  "bear-rounded-md",
46
- b ? "bear-bg-white dark:bear-bg-gray-700 bear-text-gray-900 dark:bear-text-white bear-shadow-sm" : "bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"
27
+ r && "bear-shadow-sm"
47
28
  ),
48
- enclosed: s(
29
+ enclosed: b(
49
30
  "bear-rounded-t-lg bear-border bear-border-transparent",
50
- b ? "bear-bg-white dark:bear-bg-gray-900 bear-border-gray-200 dark:bear-border-gray-700 bear-border-b-white dark:bear-border-b-gray-900 bear--mb-px bear-text-gray-900 dark:bear-text-white" : "bear-text-gray-600 dark:bear-text-gray-400 hover:bear-text-gray-900 dark:hover:bear-text-white"
31
+ r && "bear--mb-px"
51
32
  )
52
- };
53
- return /* @__PURE__ */ T(
33
+ }, v = e ? void 0 : r ? t === "pills" ? { backgroundColor: "var(--bear-bg-primary)", color: "var(--bear-text-primary)" } : t === "enclosed" ? {
34
+ backgroundColor: "var(--bear-bg-primary)",
35
+ borderColor: "var(--bear-border-default)",
36
+ borderBottomColor: "var(--bear-bg-primary)",
37
+ color: "var(--bear-text-primary)"
38
+ } : void 0 : { color: "var(--bear-text-muted)" };
39
+ return /* @__PURE__ */ u(
54
40
  "button",
55
41
  {
56
42
  role: "tab",
57
- "aria-selected": b,
43
+ "aria-selected": r,
58
44
  disabled: e,
59
- onClick: () => !e && l(a),
60
- className: s(
45
+ onClick: () => !e && d(o),
46
+ className: b(
61
47
  "Bear-Tabs__tab",
62
- b && "Bear-Tabs__tab--active",
48
+ r && "Bear-Tabs__tab--active",
63
49
  i,
64
- y[x],
50
+ m[t],
51
+ !r && "hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]",
65
52
  e && "Bear-Tabs__tab--disabled bear-opacity-50 bear-cursor-not-allowed"
66
53
  ),
54
+ style: v,
67
55
  children: [
68
- r && /* @__PURE__ */ n("span", { className: "Bear-Tabs__tab-icon", children: r }),
69
- /* @__PURE__ */ n("span", { className: "Bear-Tabs__tab-label", children: t })
56
+ n && /* @__PURE__ */ l("span", { className: "Bear-Tabs__tab-icon", children: n }),
57
+ /* @__PURE__ */ l("span", { className: "Bear-Tabs__tab-label", children: s })
70
58
  ]
71
59
  }
72
60
  );
73
- }, f = ({ tabId: a, children: t, className: e }) => {
74
- const r = g(d);
75
- if (!r) throw new Error("TabPanel must be used within Tabs");
76
- const { activeTab: o } = r;
77
- return o !== a ? null : /* @__PURE__ */ n("div", { role: "tabpanel", className: s("Bear-Tabs__panel bear-py-4", e), children: t });
78
61
  };
79
62
  export {
80
- _ as Tab,
81
- w as TabList,
82
- f as TabPanel,
83
- k as Tabs
63
+ g as Tab,
64
+ C as Tabs,
65
+ x as TabsContext
84
66
  };
@@ -7,7 +7,9 @@ export interface TabsContextValue {
7
7
  export interface TabsProps {
8
8
  /** Tab panels */
9
9
  children: ReactNode;
10
- /** Default active tab */
10
+ /** Controlled active tab (when set, defaultTab is ignored) */
11
+ value?: string;
12
+ /** Default active tab (uncontrolled) */
11
13
  defaultTab: string;
12
14
  /** Visual variant */
13
15
  variant?: 'line' | 'pills' | 'enclosed';
@@ -21,6 +23,10 @@ export interface TabsProps {
21
23
  export interface TabListProps {
22
24
  /** Tab buttons */
23
25
  children: ReactNode;
26
+ /** Max number of visible tabs before overflow (e.g. 5); rest go in "..." dropdown. Selected tab is always shown first. */
27
+ maxVisibleTabs?: number;
28
+ /** Allow tabs to wrap to next line (flex-wrap), no breakpoints */
29
+ wrap?: boolean;
24
30
  /** Custom class name */
25
31
  className?: string;
26
32
  }
@@ -1,2 +1,4 @@
1
- export { Tabs, TabList, Tab, TabPanel } from './Tabs';
1
+ export { Tabs, Tab, TabsContext } from './Tabs';
2
+ export { TabList } from './TabList';
3
+ export { TabPanel } from './TabPanel';
2
4
  export type { TabsProps, TabListProps, TabProps, TabPanelProps, TabsContextValue } from './Tabs.types';