@forgedevstack/bear 1.2.0 → 1.2.2

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 (268) hide show
  1. package/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
  2. package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
  3. package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
  4. package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
  5. package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
  6. package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
  7. package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
  8. package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
  9. package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
  10. package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
  11. package/dist/components/AnimatedCounter/index.d.ts +2 -0
  12. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  13. package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
  14. package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
  15. package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
  16. package/dist/components/Autocomplete/Autocomplete.js +110 -72
  17. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  18. package/dist/components/BottomSheet/BottomSheet.js +74 -53
  19. package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
  20. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  21. package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
  22. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
  23. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  24. package/dist/components/Cascader/Cascader.cjs +1 -1
  25. package/dist/components/Cascader/Cascader.const.cjs +1 -1
  26. package/dist/components/Cascader/Cascader.const.d.ts +1 -1
  27. package/dist/components/Cascader/Cascader.const.js +1 -1
  28. package/dist/components/Cascader/Cascader.js +109 -146
  29. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
  30. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
  31. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
  32. package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
  33. package/dist/components/Chart/BarChart.cjs +1 -0
  34. package/dist/components/Chart/BarChart.d.ts +3 -0
  35. package/dist/components/Chart/BarChart.js +65 -0
  36. package/dist/components/Chart/Chart.cjs +1 -1
  37. package/dist/components/Chart/Chart.const.cjs +1 -1
  38. package/dist/components/Chart/Chart.const.d.ts +7 -0
  39. package/dist/components/Chart/Chart.const.js +12 -2
  40. package/dist/components/Chart/Chart.d.ts +1 -13
  41. package/dist/components/Chart/Chart.js +18 -204
  42. package/dist/components/Chart/Chart.types.d.ts +7 -1
  43. package/dist/components/Chart/LineChart.cjs +1 -0
  44. package/dist/components/Chart/LineChart.d.ts +3 -0
  45. package/dist/components/Chart/LineChart.js +73 -0
  46. package/dist/components/Chart/PieChart.cjs +1 -0
  47. package/dist/components/Chart/PieChart.d.ts +3 -0
  48. package/dist/components/Chart/PieChart.js +110 -0
  49. package/dist/components/Chart/index.d.ts +4 -1
  50. package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
  51. package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
  52. package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
  53. package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
  54. package/dist/components/ColorPicker/ColorPicker.js +135 -73
  55. package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
  56. package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
  57. package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
  58. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  59. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
  60. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
  61. package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
  62. package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
  63. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
  64. package/dist/components/CreditInput/CreditInput.cjs +1 -1
  65. package/dist/components/CreditInput/CreditInput.js +80 -78
  66. package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
  67. package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
  68. package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
  69. package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
  70. package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
  71. package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
  72. package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
  73. package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
  74. package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
  75. package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
  76. package/dist/components/CurrencyInput/index.d.ts +2 -0
  77. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  78. package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
  79. package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
  80. package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
  81. package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
  82. package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
  83. package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
  84. package/dist/components/DiffSquares/DiffSquares.js +70 -0
  85. package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
  86. package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
  87. package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
  88. package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
  89. package/dist/components/DiffSquares/index.d.ts +2 -0
  90. package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
  91. package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
  92. package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
  93. package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
  94. package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
  95. package/dist/components/DiffViewer/DiffViewer.js +97 -105
  96. package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
  97. package/dist/components/DiffViewer/index.d.ts +1 -1
  98. package/dist/components/Drawer/Drawer.cjs +1 -1
  99. package/dist/components/Drawer/Drawer.js +41 -41
  100. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  101. package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
  102. package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
  103. package/dist/components/Dropdown/Dropdown.const.js +10 -0
  104. package/dist/components/Dropdown/Dropdown.d.ts +0 -1
  105. package/dist/components/Dropdown/Dropdown.js +102 -92
  106. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
  107. package/dist/components/Gauge/Gauge.cjs +1 -1
  108. package/dist/components/Gauge/Gauge.js +61 -50
  109. package/dist/components/Gauge/Gauge.types.d.ts +2 -0
  110. package/dist/components/GlowCard/GlowCard.cjs +1 -0
  111. package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
  112. package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
  113. package/dist/components/GlowCard/GlowCard.const.js +13 -0
  114. package/dist/components/GlowCard/GlowCard.d.ts +3 -0
  115. package/dist/components/GlowCard/GlowCard.js +185 -0
  116. package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
  117. package/dist/components/GlowCard/index.d.ts +2 -0
  118. package/dist/components/Heatmap/Heatmap.cjs +1 -0
  119. package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
  120. package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
  121. package/dist/components/Heatmap/Heatmap.const.js +11 -0
  122. package/dist/components/Heatmap/Heatmap.d.ts +3 -0
  123. package/dist/components/Heatmap/Heatmap.js +103 -0
  124. package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
  125. package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
  126. package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
  127. package/dist/components/Heatmap/Heatmap.utils.js +18 -0
  128. package/dist/components/Heatmap/index.d.ts +2 -0
  129. package/dist/components/HoverCard/HoverCard.cjs +6 -6
  130. package/dist/components/HoverCard/HoverCard.js +72 -54
  131. package/dist/components/Icon/icons/status.js +1 -1
  132. package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
  133. package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
  134. package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
  135. package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
  136. package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
  137. package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
  138. package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
  139. package/dist/components/ImageAnnotation/index.d.ts +2 -0
  140. package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
  141. package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
  142. package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
  143. package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
  144. package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
  145. package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
  146. package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
  147. package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
  148. package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
  149. package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
  150. package/dist/components/MediaPlayer/index.d.ts +2 -0
  151. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  152. package/dist/components/MentionsInput/MentionsInput.js +106 -83
  153. package/dist/components/Menu/Menu.cjs +1 -1
  154. package/dist/components/Menu/Menu.js +91 -80
  155. package/dist/components/Modal/Modal.cjs +1 -1
  156. package/dist/components/Modal/Modal.const.cjs +1 -1
  157. package/dist/components/Modal/Modal.const.d.ts +1 -1
  158. package/dist/components/Modal/Modal.const.js +1 -1
  159. package/dist/components/Modal/Modal.js +50 -44
  160. package/dist/components/Modal/Modal.types.d.ts +6 -0
  161. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  162. package/dist/components/MultiSelect/MultiSelect.js +123 -78
  163. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
  164. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
  165. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
  166. package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
  167. package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
  168. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
  169. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
  170. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
  171. package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
  172. package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
  173. package/dist/components/OTPInput/OTPInput.cjs +1 -1
  174. package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
  175. package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
  176. package/dist/components/OTPInput/OTPInput.const.js +14 -0
  177. package/dist/components/OTPInput/OTPInput.js +99 -65
  178. package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
  179. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  180. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
  181. package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
  182. package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
  183. package/dist/components/PhoneInput/PhoneInput.js +88 -83
  184. package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
  185. package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
  186. package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
  187. package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
  188. package/dist/components/Popconfirm/Popconfirm.js +71 -51
  189. package/dist/components/Popover/Popover.cjs +1 -1
  190. package/dist/components/Popover/Popover.js +36 -31
  191. package/dist/components/Portal/Portal.cjs +1 -1
  192. package/dist/components/Portal/Portal.d.ts +0 -3
  193. package/dist/components/Portal/Portal.js +4 -10
  194. package/dist/components/Select/Select.cjs +1 -1
  195. package/dist/components/Select/Select.js +71 -51
  196. package/dist/components/Stepper/Stepper.cjs +1 -1
  197. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  198. package/dist/components/Stepper/Stepper.const.d.ts +26 -4
  199. package/dist/components/Stepper/Stepper.const.js +39 -20
  200. package/dist/components/Stepper/Stepper.d.ts +3 -10
  201. package/dist/components/Stepper/Stepper.js +189 -130
  202. package/dist/components/Stepper/Stepper.types.d.ts +14 -0
  203. package/dist/components/Stepper/Stepper.utils.cjs +1 -0
  204. package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
  205. package/dist/components/Stepper/Stepper.utils.js +19 -0
  206. package/dist/components/Stepper/components/StepperControls.cjs +1 -0
  207. package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
  208. package/dist/components/Stepper/components/StepperControls.js +32 -0
  209. package/dist/components/Stepper/index.d.ts +2 -1
  210. package/dist/components/Tabs/TabList.cjs +1 -1
  211. package/dist/components/Tabs/TabList.js +72 -57
  212. package/dist/components/Tabs/Tabs.types.d.ts +4 -2
  213. package/dist/components/Tabs/index.d.ts +2 -2
  214. package/dist/components/TagCloud/TagCloud.cjs +1 -0
  215. package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
  216. package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
  217. package/dist/components/TagCloud/TagCloud.const.js +8 -0
  218. package/dist/components/TagCloud/TagCloud.d.ts +3 -0
  219. package/dist/components/TagCloud/TagCloud.js +76 -0
  220. package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
  221. package/dist/components/TagCloud/index.d.ts +2 -0
  222. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
  223. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
  224. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  225. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
  226. package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
  227. package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
  228. package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
  229. package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
  230. package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
  231. package/dist/components/TimelineChart/TimelineChart.js +65 -0
  232. package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
  233. package/dist/components/TimelineChart/index.d.ts +2 -0
  234. package/dist/components/Toast/Toast.cjs +1 -1
  235. package/dist/components/Toast/Toast.js +86 -82
  236. package/dist/components/Toast/Toast.types.d.ts +2 -0
  237. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  238. package/dist/components/Tooltip/Tooltip.js +52 -44
  239. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  240. package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
  241. package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
  242. package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
  243. package/dist/components/TreeSelect/TreeSelect.js +120 -88
  244. package/dist/components/Watermark/Watermark.cjs +1 -1
  245. package/dist/components/Watermark/Watermark.const.cjs +1 -1
  246. package/dist/components/Watermark/Watermark.const.d.ts +6 -3
  247. package/dist/components/Watermark/Watermark.const.js +13 -11
  248. package/dist/components/Watermark/Watermark.js +87 -61
  249. package/dist/components/Watermark/Watermark.types.d.ts +2 -0
  250. package/dist/components/index.cjs +1 -1
  251. package/dist/components/index.d.ts +22 -4
  252. package/dist/components/index.js +319 -296
  253. package/dist/hooks/index.cjs +1 -1
  254. package/dist/hooks/index.d.ts +1 -1
  255. package/dist/hooks/index.js +55 -54
  256. package/dist/hooks/useClickOutside.cjs +1 -1
  257. package/dist/hooks/useClickOutside.d.ts +4 -11
  258. package/dist/hooks/useClickOutside.js +26 -7
  259. package/dist/index.cjs +1 -1
  260. package/dist/index.js +412 -388
  261. package/dist/styles/_effects.css +32 -0
  262. package/dist/styles.css +1 -1
  263. package/dist/utils/maxVisible.utils.cjs +1 -0
  264. package/dist/utils/maxVisible.utils.d.ts +12 -0
  265. package/dist/utils/maxVisible.utils.js +15 -0
  266. package/package.json +1 -1
  267. package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
  268. package/dist/components/HoverCard/HoverCard.utils.js +0 -23
@@ -1,151 +1,210 @@
1
- import { jsx as r, jsxs as l, Fragment as Z } from "react/jsx-runtime";
2
- import { forwardRef as b } from "react";
3
- import { cn as i } from "../../utils/cn.js";
4
- import { STEP_STATUS_CLASSES as I, STEP_LABEL_SIZES as z, STEP_LABEL_BASE as O, STEP_DESCRIPTION_CLASSES as g, STEP_WRAPPER_HORIZONTAL as H, STEP_WRAPPER_VERTICAL as W, STEPPER_HORIZONTAL_CLASSES as j, STEPPER_VERTICAL_CLASSES as D, STEPPER_BASE_CLASSES as V, STEP_INDICATOR_SIZES as F, STEP_INDICATOR_BASE as U, CONNECTOR_STATUS as L, CONNECTOR_HORIZONTAL as q, CONNECTOR_VERTICAL as G, CONNECTOR_BASE as J } from "./Stepper.const.js";
5
- import { Button as v } from "../Button/Button.js";
6
- const K = () => /* @__PURE__ */ r("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", children: /* @__PURE__ */ r("polyline", { points: "20 6 9 17 4 12" }) }), M = () => /* @__PURE__ */ l("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", children: [
7
- /* @__PURE__ */ r("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
8
- /* @__PURE__ */ r("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
9
- ] }), Q = b(
1
+ import { jsxs as i, Fragment as f, jsx as t } from "react/jsx-runtime";
2
+ import D, { forwardRef as oe, useState as ie, useEffect as le, useMemo as U } from "react";
3
+ import { useBearThemeOptional as se } from "../../context/BearProvider.js";
4
+ import { resolveMaxVisible as ae } from "../../utils/maxVisible.utils.js";
5
+ import { cn as s } from "../../utils/cn.js";
6
+ import { Typography as V } from "../Typography/Typography.js";
7
+ import { Dropdown as ce } from "../Dropdown/Dropdown.js";
8
+ import { BearIcons as de } from "../Icon/index.js";
9
+ import { STEP_WRAPPER_VERTICAL as Ee, STEPPER_HORIZONTAL_CLASSES as he, STEPPER_VERTICAL_CLASSES as _e, STEPPER_BASE_CLASSES as me, DEFAULT_ORIENTATION as Te, DEFAULT_SIZE as fe, DEFAULT_SHOW_NUMBERS as Se, DEFAULT_CLICKABLE as Ie, DEFAULT_SHOW_CONNECTORS as Oe, DEFAULT_CONNECTOR_STYLE as Ce, DEFAULT_ALTERNATIVE_LABEL as Ne, CONNECTOR_STATUS as S, CONNECTOR_VERTICAL as ue, CONNECTOR_BASE as Ae, OVERFLOW_LEFT_LABEL as Le, OVERFLOW_RIGHT_LABEL as ge, STEP_STATUS_CLASSES as u, STEP_INDICATOR_SIZES as Re, STEP_INDICATOR_BASE as M, STEP_LABEL_SIZES as pe, STEP_LABEL_BASE as ve, STEP_DESCRIPTION_CLASSES as we, ERROR_ICON_VIEWBOX as be, ERROR_ICON_SIZE as z, CHECK_ICON_VIEWBOX as Be, CHECK_ICON_SIZE as Z, CHECK_ICON_POINTS as Pe } from "./Stepper.const.js";
10
+ import { resolveStepStatus as K, resolveIndicatorContent as ye } from "./Stepper.utils.js";
11
+ const He = 1200, We = 16, Fe = 640, k = 3, De = () => /* @__PURE__ */ t("svg", { width: Z, height: Z, viewBox: Be, fill: "none", stroke: "currentColor", strokeWidth: "3", children: /* @__PURE__ */ t("polyline", { points: Pe }) }), Ue = () => /* @__PURE__ */ i("svg", { width: z, height: z, viewBox: be, fill: "none", stroke: "currentColor", strokeWidth: "3", children: [
12
+ /* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
13
+ /* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
14
+ ] }), Ve = oe(
10
15
  ({
11
- steps: s,
12
- activeStep: o,
13
- onStepClick: a,
14
- orientation: N = "horizontal",
15
- size: d = "md",
16
- showNumbers: f = !0,
17
- clickable: m = !1,
18
- showConnectors: T = !0,
19
- connectorStyle: _ = "solid",
20
- alternativeLabel: S = !1,
21
- completedIcon: p,
22
- errorIcon: u,
23
- testId: A,
24
- className: R,
25
- ...x
26
- }, y) => {
27
- const B = (e, t) => t.status ? t.status : e < o ? "completed" : e === o ? "active" : "pending", E = N === "horizontal", k = F[d], h = z[d], P = (e, t, n) => {
28
- const C = I[n];
29
- let c = null;
30
- return e.icon ? c = e.icon : n === "completed" ? c = p || /* @__PURE__ */ r(K, {}) : n === "error" ? c = u || /* @__PURE__ */ r(M, {}) : f && (c = t + 1), /* @__PURE__ */ r(
16
+ steps: o,
17
+ activeStep: E,
18
+ onStepClick: h,
19
+ orientation: X = Te,
20
+ size: A = fe,
21
+ showNumbers: j = Se,
22
+ clickable: L = Ie,
23
+ showConnectors: x = Oe,
24
+ connectorStyle: g = Ce,
25
+ alternativeLabel: R = Ne,
26
+ completedIcon: $,
27
+ errorIcon: G,
28
+ labelTypographyProps: Y,
29
+ descriptionTypographyProps: q,
30
+ maxVisibleSteps: I,
31
+ testId: J,
32
+ className: Q,
33
+ ...ee
34
+ }, re) => {
35
+ const p = se(), [O, ne] = ie(() => typeof window < "u" ? window.innerWidth : He);
36
+ le(() => {
37
+ const e = () => ne(window.innerWidth);
38
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
39
+ }, []);
40
+ const _ = U(() => {
41
+ if (I != null)
42
+ return ae(I, { width: O, theme: p });
43
+ if (O < Fe && o.length > k)
44
+ return k;
45
+ }, [I, O, p, o.length]), d = X === "horizontal", v = Re[A], w = pe[A], m = d && _ != null && o.length > _, { visibleIndices: b, leftHidden: B, rightHidden: C } = U(() => {
46
+ if (!m || _ == null)
47
+ return {
48
+ visibleIndices: o.map((c, N) => N),
49
+ leftHidden: [],
50
+ rightHidden: []
51
+ };
52
+ const e = _, r = Math.floor(e / 2), n = Math.max(0, Math.min(E - r, o.length - e)), l = Array.from({ length: e }, (c, N) => n + N), a = [], F = [];
53
+ for (let c = 0; c < n; c++) a.push(c);
54
+ for (let c = n + e; c < o.length; c++) F.push(c);
55
+ return { visibleIndices: l, leftHidden: a, rightHidden: F };
56
+ }, [m, _, o, E]), P = (e, r, n) => {
57
+ const l = u[n], a = ye(
58
+ e,
59
+ r,
60
+ n,
61
+ j,
62
+ $,
63
+ G,
64
+ /* @__PURE__ */ t(De, {}),
65
+ /* @__PURE__ */ t(Ue, {})
66
+ );
67
+ return /* @__PURE__ */ t(
31
68
  "div",
32
69
  {
33
- className: i(
34
- U,
35
- k,
36
- C.indicator,
37
- m && !e.disabled && "cursor-pointer hover:scale-105"
70
+ className: s(
71
+ M,
72
+ v,
73
+ l.indicator,
74
+ L && !e.disabled && "cursor-pointer hover:scale-105"
38
75
  ),
39
76
  onClick: () => {
40
- m && !e.disabled && a && a(t);
77
+ L && !e.disabled && h && h(r);
41
78
  },
42
- children: c
79
+ children: a
43
80
  }
44
81
  );
45
- }, w = (e) => {
46
- if (!T || e === s.length - 1) return null;
47
- const t = e < o;
48
- return /* @__PURE__ */ r(
82
+ }, T = (e, r) => {
83
+ if (!x || r) return null;
84
+ const n = e < E;
85
+ return d ? /* @__PURE__ */ t(
86
+ "div",
87
+ {
88
+ className: s(
89
+ "Bear-Stepper__connector flex-1 self-center mx-1",
90
+ "h-0.5 min-w-[12px] transition-colors",
91
+ n ? S.completed : S.pending,
92
+ g === "dashed" && "border-t-2 border-dashed bg-transparent"
93
+ )
94
+ }
95
+ ) : /* @__PURE__ */ t(
49
96
  "div",
50
97
  {
51
- className: i(
52
- J,
53
- E ? q : G,
54
- t ? L.completed : L.pending,
55
- _ === "dashed" && "border-t-2 border-dashed bg-transparent"
98
+ className: s(
99
+ Ae,
100
+ ue,
101
+ n ? S.completed : S.pending,
102
+ g === "dashed" && "border-t-2 border-dashed bg-transparent"
56
103
  )
57
104
  }
58
105
  );
59
- };
60
- return /* @__PURE__ */ r(
61
- "div",
62
- {
63
- ref: y,
64
- className: i(
106
+ }, y = (e, r) => {
107
+ const n = u[r], l = { ...Y, ...e.labelTypographyProps }, a = { ...q, ...e.descriptionTypographyProps };
108
+ return /* @__PURE__ */ i(f, { children: [
109
+ /* @__PURE__ */ t(
65
110
  V,
66
- E ? j : D,
67
- R
111
+ {
112
+ variant: "body2",
113
+ ...l,
114
+ className: s(ve, w.label, n.label, l == null ? void 0 : l.className),
115
+ children: e.label
116
+ }
117
+ ),
118
+ e.description && /* @__PURE__ */ t(
119
+ V,
120
+ {
121
+ variant: "caption",
122
+ ...a,
123
+ className: s(we, w.description, a == null ? void 0 : a.className),
124
+ children: e.description
125
+ }
126
+ )
127
+ ] });
128
+ }, H = (e, r) => {
129
+ const n = K(e, r, E);
130
+ return /* @__PURE__ */ i("div", { className: s("Bear-Stepper__content flex shrink-0", R ? "flex-col items-center" : "items-center gap-2"), children: [
131
+ P(e, r, n),
132
+ /* @__PURE__ */ t("div", { className: s(R && "text-center mt-2", "whitespace-nowrap"), children: y(e, n) })
133
+ ] });
134
+ }, te = (e, r) => {
135
+ const n = K(e, r, E);
136
+ return /* @__PURE__ */ i(f, { children: [
137
+ /* @__PURE__ */ t("div", { className: "flex-shrink-0 mr-4", children: P(e, r, n) }),
138
+ /* @__PURE__ */ i("div", { className: "flex-1 pt-0.5", children: [
139
+ y(e, n),
140
+ e.content && n === "active" && /* @__PURE__ */ t("div", { className: "mt-4", children: e.content })
141
+ ] })
142
+ ] });
143
+ }, W = (e, r) => /* @__PURE__ */ t("div", { className: "Bear-Stepper__overflow shrink-0", children: /* @__PURE__ */ t(
144
+ ce,
145
+ {
146
+ placement: "bottom-start",
147
+ closeOnSelect: !0,
148
+ trigger: /* @__PURE__ */ t(
149
+ "button",
150
+ {
151
+ type: "button",
152
+ className: s(
153
+ M,
154
+ v,
155
+ u.pending.indicator,
156
+ "bear-cursor-pointer bear-border-0"
157
+ ),
158
+ "aria-label": r === "left" ? Le : ge,
159
+ children: /* @__PURE__ */ t(de.MoreHorizIcon, { size: We })
160
+ }
68
161
  ),
69
- "data-testid": A,
70
- ...x,
71
- children: s.map((e, t) => {
72
- const n = B(t, e), C = I[n];
73
- return /* @__PURE__ */ l(
74
- "div",
75
- {
76
- className: i(
77
- "Bear-Stepper__step",
78
- E ? H : W
79
- ),
80
- children: [
81
- E ? (
82
- // Horizontal layout
83
- /* @__PURE__ */ l("div", { className: i("flex", S ? "flex-col items-center" : "items-center gap-3"), children: [
84
- P(e, t, n),
85
- /* @__PURE__ */ l("div", { className: i(S && "text-center mt-2"), children: [
86
- /* @__PURE__ */ r("div", { className: i(O, h.label, C.label), children: e.label }),
87
- e.description && /* @__PURE__ */ r("div", { className: i(g, h.description), children: e.description })
88
- ] })
89
- ] })
90
- ) : (
91
- // Vertical layout
92
- /* @__PURE__ */ l(Z, { children: [
93
- /* @__PURE__ */ r("div", { className: "flex-shrink-0 mr-4", children: P(e, t, n) }),
94
- /* @__PURE__ */ l("div", { className: "flex-1 pt-0.5", children: [
95
- /* @__PURE__ */ r("div", { className: i(O, h.label, C.label), children: e.label }),
96
- e.description && /* @__PURE__ */ r("div", { className: i(g, h.description), children: e.description }),
97
- e.content && n === "active" && /* @__PURE__ */ r("div", { className: "mt-4", children: e.content })
98
- ] })
99
- ] })
100
- ),
101
- w(t)
102
- ]
103
- },
104
- t
105
- );
106
- })
162
+ items: e.map((n) => ({
163
+ key: `step-${n}`,
164
+ label: o[n].label,
165
+ disabled: o[n].disabled,
166
+ onClick: () => {
167
+ o[n].disabled || h == null || h(n);
168
+ }
169
+ }))
170
+ }
171
+ ) }, `overflow-${r}`);
172
+ return /* @__PURE__ */ i(
173
+ "div",
174
+ {
175
+ ref: re,
176
+ className: s(me, d ? he : _e, Q),
177
+ "data-testid": J,
178
+ ...ee,
179
+ children: [
180
+ d && !m && o.map((e, r) => /* @__PURE__ */ i(D.Fragment, { children: [
181
+ H(e, r),
182
+ T(r, r === o.length - 1)
183
+ ] }, r)),
184
+ d && m && /* @__PURE__ */ i(f, { children: [
185
+ B.length > 0 && /* @__PURE__ */ i(f, { children: [
186
+ W(B, "left"),
187
+ T(-1, !1)
188
+ ] }),
189
+ b.map((e, r) => {
190
+ const n = o[e], l = r === b.length - 1 && C.length === 0;
191
+ return /* @__PURE__ */ i(D.Fragment, { children: [
192
+ H(n, e),
193
+ T(e, l)
194
+ ] }, e);
195
+ }),
196
+ C.length > 0 && W(C, "right")
197
+ ] }),
198
+ !d && o.map((e, r) => /* @__PURE__ */ i("div", { className: s("Bear-Stepper__step", Ee), children: [
199
+ te(e, r),
200
+ T(r, r === o.length - 1)
201
+ ] }, r))
202
+ ]
107
203
  }
108
204
  );
109
205
  }
110
206
  );
111
- Q.displayName = "Stepper";
112
- const X = b(
113
- ({
114
- activeStep: s,
115
- totalSteps: o,
116
- onPrev: a,
117
- onNext: N,
118
- onComplete: d,
119
- disablePrev: f = !1,
120
- disableNext: m = !1,
121
- prevLabel: T = "Previous",
122
- nextLabel: _ = "Next",
123
- completeLabel: S = "Complete",
124
- showIndicator: p = !0
125
- }, u) => {
126
- const A = s === 0, R = s === o - 1;
127
- return /* @__PURE__ */ l("div", { ref: u, className: "Bear-StepperControls flex items-center justify-between mt-6", children: [
128
- /* @__PURE__ */ r(
129
- v,
130
- {
131
- variant: "outline",
132
- onClick: a,
133
- disabled: A || f,
134
- children: T
135
- }
136
- ),
137
- p && /* @__PURE__ */ l("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
138
- "Step ",
139
- s + 1,
140
- " of ",
141
- o
142
- ] }),
143
- R ? /* @__PURE__ */ r(v, { variant: "primary", onClick: d, children: S }) : /* @__PURE__ */ r(v, { variant: "primary", onClick: N, disabled: m, children: _ })
144
- ] });
145
- }
146
- );
147
- X.displayName = "StepperControls";
207
+ Ve.displayName = "Stepper";
148
208
  export {
149
- Q as Stepper,
150
- X as StepperControls
209
+ Ve as Stepper
151
210
  };
@@ -1,4 +1,6 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
+ import { TypographyProps } from '../Typography/Typography.types';
3
+ import { MaxVisibleInput } from '../../utils/maxVisible.utils';
2
4
  export type StepperOrientation = 'horizontal' | 'vertical';
3
5
  export type StepStatus = 'pending' | 'active' | 'completed' | 'error';
4
6
  export type StepperSize = 'sm' | 'md' | 'lg';
@@ -15,6 +17,10 @@ export interface Step {
15
17
  disabled?: boolean;
16
18
  /** Optional content for this step */
17
19
  content?: ReactNode;
20
+ /** Per-step Typography props for the label */
21
+ labelTypographyProps?: Partial<TypographyProps>;
22
+ /** Per-step Typography props for the description */
23
+ descriptionTypographyProps?: Partial<TypographyProps>;
18
24
  }
19
25
  export interface StepperProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
20
26
  /** Array of steps */
@@ -41,8 +47,14 @@ export interface StepperProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onCh
41
47
  completedIcon?: ReactNode;
42
48
  /** Custom error icon */
43
49
  errorIcon?: ReactNode;
50
+ /** Typography props applied to all step labels (overridden by per-step labelTypographyProps) */
51
+ labelTypographyProps?: Partial<TypographyProps>;
52
+ /** Typography props applied to all step descriptions (overridden by per-step descriptionTypographyProps) */
53
+ descriptionTypographyProps?: Partial<TypographyProps>;
44
54
  /** Test ID */
45
55
  testId?: string;
56
+ /** When set on horizontal layout, show at most this many steps with dropdown menus for the rest (breakpoint map supported). */
57
+ maxVisibleSteps?: MaxVisibleInput;
46
58
  }
47
59
  export interface StepperControlsProps {
48
60
  /** Current step */
@@ -67,4 +79,6 @@ export interface StepperControlsProps {
67
79
  completeLabel?: string;
68
80
  /** Show step indicator */
69
81
  showIndicator?: boolean;
82
+ /** Step indicator format function (receives activeStep + 1 and totalSteps) */
83
+ indicatorFormat?: (current: number, total: number) => string;
70
84
  }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./Stepper.const.cjs");function l(e,t,r){return e.status?e.status:t<r?"completed":t===r?"active":"pending"}function a(e,t,r,n,o,u,c,i){if(e.icon)return e.icon;switch(r){case"completed":return o??c;case"error":return u??i;default:return n?t+s.STEP_NUMBER_OFFSET:null}}exports.resolveIndicatorContent=a;exports.resolveStepStatus=l;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { Step, StepStatus } from './Stepper.types';
3
+ /**
4
+ * Derives the visual status for a step based on its explicit status or its
5
+ * position relative to the active step.
6
+ */
7
+ export declare function resolveStepStatus(step: Step, index: number, activeStep: number): StepStatus;
8
+ /**
9
+ * Determines the indicator content for a step circle based on status, custom
10
+ * icons, and the showNumbers flag.
11
+ */
12
+ export declare function resolveIndicatorContent(step: Step, index: number, status: StepStatus, showNumbers: boolean, completedIcon: ReactNode | undefined, errorIcon: ReactNode | undefined, defaultCompletedIcon: ReactNode, defaultErrorIcon: ReactNode): ReactNode;
@@ -0,0 +1,19 @@
1
+ import { STEP_NUMBER_OFFSET as f } from "./Stepper.const.js";
2
+ function a(r, t, e) {
3
+ return r.status ? r.status : t < e ? "completed" : t === e ? "active" : "pending";
4
+ }
5
+ function l(r, t, e, n, u, o, i, c) {
6
+ if (r.icon) return r.icon;
7
+ switch (e) {
8
+ case "completed":
9
+ return u ?? i;
10
+ case "error":
11
+ return o ?? c;
12
+ default:
13
+ return n ? t + f : null;
14
+ }
15
+ }
16
+ export {
17
+ l as resolveIndicatorContent,
18
+ a as resolveStepStatus
19
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),A=require("react"),n=require("../../Button/Button.cjs"),F=require("../../Typography/Typography.cjs"),e=require("../Stepper.const.cjs"),o=A.forwardRef(({activeStep:t,totalSteps:s,onPrev:i,onNext:a,onComplete:l,disablePrev:c=!1,disableNext:T=!1,prevLabel:p=e.DEFAULT_PREV_LABEL,nextLabel:u=e.DEFAULT_NEXT_LABEL,completeLabel:E=e.DEFAULT_COMPLETE_LABEL,showIndicator:d=!0,indicatorFormat:_=e.DEFAULT_INDICATOR_FORMAT},L)=>{const S=t===e.FIRST_STEP_INDEX,y=t===s-e.LAST_STEP_OFFSET;return r.jsxs("div",{ref:L,className:"Bear-StepperControls flex items-center justify-between mt-6",children:[r.jsx(n.Button,{variant:"outline",onClick:i,disabled:S||c,children:p}),d&&r.jsx(F.Typography,{variant:"body2",className:"text-gray-500 dark:text-gray-400",children:_(t+e.LAST_STEP_OFFSET,s)}),y?r.jsx(n.Button,{variant:"primary",onClick:l,children:E}):r.jsx(n.Button,{variant:"primary",onClick:a,disabled:T,children:u})]})});o.displayName="StepperControls";exports.StepperControls=o;
@@ -0,0 +1,2 @@
1
+ import { StepperControlsProps } from '../Stepper.types';
2
+ export declare const StepperControls: import('react').ForwardRefExoticComponent<StepperControlsProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,32 @@
1
+ import { jsxs as A, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as y } from "react";
3
+ import { Button as t } from "../../Button/Button.js";
4
+ import { Typography as F } from "../../Typography/Typography.js";
5
+ import { DEFAULT_PREV_LABEL as C, DEFAULT_INDICATOR_FORMAT as S, LAST_STEP_OFFSET as o, DEFAULT_COMPLETE_LABEL as h, DEFAULT_NEXT_LABEL as x, FIRST_STEP_INDEX as D } from "../Stepper.const.js";
6
+ const N = y(
7
+ ({
8
+ activeStep: e,
9
+ totalSteps: i,
10
+ onPrev: a,
11
+ onNext: n,
12
+ onComplete: s,
13
+ disablePrev: l = !1,
14
+ disableNext: m = !1,
15
+ prevLabel: p = C,
16
+ nextLabel: E = x,
17
+ completeLabel: d = h,
18
+ showIndicator: T = !0,
19
+ indicatorFormat: L = S
20
+ }, c) => {
21
+ const _ = e === D, f = e === i - o;
22
+ return /* @__PURE__ */ A("div", { ref: c, className: "Bear-StepperControls flex items-center justify-between mt-6", children: [
23
+ /* @__PURE__ */ r(t, { variant: "outline", onClick: a, disabled: _ || l, children: p }),
24
+ T && /* @__PURE__ */ r(F, { variant: "body2", className: "text-gray-500 dark:text-gray-400", children: L(e + o, i) }),
25
+ f ? /* @__PURE__ */ r(t, { variant: "primary", onClick: s, children: d }) : /* @__PURE__ */ r(t, { variant: "primary", onClick: n, disabled: m, children: E })
26
+ ] });
27
+ }
28
+ );
29
+ N.displayName = "StepperControls";
30
+ export {
31
+ N as StepperControls
32
+ };
@@ -1,2 +1,3 @@
1
- export { Stepper, StepperControls } from './Stepper';
1
+ export { Stepper } from './Stepper';
2
+ export { StepperControls } from './components/StepperControls';
2
3
  export type { StepperProps, StepperControlsProps, Step, StepStatus, StepperOrientation, StepperSize } from './Stepper.types';
@@ -1 +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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("react"),C=require("../../utils/cn.cjs"),z=require("../../context/BearProvider.cjs"),B=require("../../utils/maxVisible.utils.cjs"),I=require("../Dropdown/Dropdown.cjs"),L=require("../Icon/index.cjs"),N=require("./Tabs.cjs");function S(n){var l;return o.isValidElement(n)&&typeof n.type!="string"&&((l=n.props)==null?void 0:l.id)!=null}const _=({children:n,maxVisibleTabs:l,wrap:i=!1,className:q})=>{const f=o.useContext(N.TabsContext);if(!f)throw new Error("TabList must be used within Tabs");const v=z.useBearThemeOptional(),[x,E]=o.useState(()=>typeof window<"u"?window.innerWidth:1200);o.useEffect(()=>{const e=()=>E(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a=o.useMemo(()=>B.resolveMaxVisible(l,{width:x,theme:v}),[l,x,v]),{activeTab:b,setActiveTab:M,variant:s}=f,w=o.Children.toArray(n).filter(S),c=w.map(e=>({id:e.props.id,label:e.props.children,disabled:e.props.disabled})),d=b?[b,...c.map(e=>e.id).filter(e=>e!==b)]:c.map(e=>e.id),h=a??d.length,k=d.slice(0,h),u=d.slice(h),p=u.includes(b),y=C.cn("Bear-Tabs__list",`Bear-Tabs__list--${s}`,a!=null&&!i&&"bear-flex bear-w-full bear-min-w-0 bear-items-stretch",(!a||i)&&"bear-flex bear-gap-1",i&&"bear-flex-wrap",!i&&!a&&"bear-gap-1",s==="line"&&"bear-border-b",s==="pills"&&"bear-p-1 bear-rounded-lg",s==="enclosed"&&"bear-border-b",q),g={...s==="line"||s==="enclosed"?{borderColor:"var(--bear-border-default)"}:{},...s==="pills"?{backgroundColor:"var(--bear-bg-tertiary)"}:{}},T=t.jsx(t.Fragment,{children:a!=null?k.map(e=>{const r=w.find(m=>m.props.id===e);return r?o.cloneElement(r,{key:r.props.id}):null}):n}),j=a!=null&&u.length>0?t.jsx("div",{className:"bear-flex bear-h-full bear-flex-shrink-0 bear-items-stretch",children:t.jsx(I.Dropdown,{placement:"bottom-end",closeOnSelect:!0,trigger:t.jsx("button",{type:"button",role:"tab","aria-haspopup":"listbox","aria-label":"More tabs",className:C.cn("bear-flex bear-h-full bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors bear-border-0 bear-cursor-pointer",s==="pills"&&"bear-rounded-md",p&&"bear-shadow-sm",!p&&"hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]"),style:p?{backgroundColor:"var(--bear-bg-primary)",color:"var(--bear-text-primary)"}:{color:"var(--bear-text-muted)"},children:t.jsx(L.BearIcons.MoreHorizIcon,{size:18})}),items:u.map(e=>{const r=c.find(m=>m.id===e);return{key:e,label:(r==null?void 0:r.label)??e,disabled:r==null?void 0:r.disabled,onClick:()=>M(e)}})})}):null;return a!=null&&!i?t.jsxs("div",{role:"tablist",className:y,style:g,children:[t.jsx("div",{className:"bear-flex bear-min-w-0 bear-flex-1 bear-items-center bear-gap-1 bear-overflow-x-auto bear-overflow-y-visible bear-flex-nowrap",children:T}),j]}):t.jsxs("div",{role:"tablist",className:y,style:g,children:[T,j]})};exports.TabList=_;
@@ -1,69 +1,84 @@
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;
1
+ import { jsx as s, Fragment as N, jsxs as T } from "react/jsx-runtime";
2
+ import { useContext as B, useState as L, useEffect as _, useMemo as A, Children as S, cloneElement as j, isValidElement as O } from "react";
3
+ import { cn as E } from "../../utils/cn.js";
4
+ import { useBearThemeOptional as R } from "../../context/BearProvider.js";
5
+ import { resolveMaxVisible as V } from "../../utils/maxVisible.utils.js";
6
+ import { Dropdown as W } from "../Dropdown/Dropdown.js";
7
+ import { BearIcons as D } from "../Icon/index.js";
8
+ import { TabsContext as F } from "./Tabs.js";
9
+ function H(a) {
10
+ var l;
11
+ return O(a) && typeof a.type != "string" && ((l = a.props) == null ? void 0 : l.id) != null;
10
12
  }
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(
13
+ const X = ({ children: a, maxVisibleTabs: l, wrap: n = !1, className: M }) => {
14
+ const u = B(F);
15
+ if (!u) throw new Error("TabList must be used within Tabs");
16
+ const f = R(), [v, k] = L(() => typeof window < "u" ? window.innerWidth : 1200);
17
+ _(() => {
18
+ const e = () => k(window.innerWidth);
19
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
20
+ }, []);
21
+ const o = A(
22
+ () => V(l, { width: v, theme: f }),
23
+ [l, v, f]
24
+ ), { activeTab: i, setActiveTab: z, variant: t } = u, w = S.toArray(a).filter(H), b = w.map((e) => ({ id: e.props.id, label: e.props.children, disabled: e.props.disabled })), d = i ? [i, ...b.map((e) => e.id).filter((e) => e !== i)] : b.map((e) => e.id), x = o ?? d.length, I = d.slice(0, x), c = d.slice(x), m = c.includes(i), h = E(
15
25
  "Bear-Tabs__list",
16
26
  `Bear-Tabs__list--${t}`,
17
- "bear-flex bear-gap-1",
18
- v && "bear-flex-wrap",
27
+ o != null && !n && "bear-flex bear-w-full bear-min-w-0 bear-items-stretch",
28
+ (!o || n) && "bear-flex bear-gap-1",
29
+ n && "bear-flex-wrap",
30
+ !n && !o && "bear-gap-1",
19
31
  t === "line" && "bear-border-b",
20
32
  t === "pills" && "bear-p-1 bear-rounded-lg",
21
33
  t === "enclosed" && "bear-border-b",
22
- y
23
- ), C = {
34
+ M
35
+ ), y = {
24
36
  ...t === "line" || t === "enclosed" ? { borderColor: "var(--bear-border-default)" } : {},
25
37
  ...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
- )
38
+ }, g = /* @__PURE__ */ s(N, { children: o != null ? I.map((e) => {
39
+ const r = w.find((p) => p.props.id === e);
40
+ return r ? j(r, { key: r.props.id }) : null;
41
+ }) : a }), C = o != null && c.length > 0 ? /* @__PURE__ */ s("div", { className: "bear-flex bear-h-full bear-flex-shrink-0 bear-items-stretch", children: /* @__PURE__ */ s(
42
+ W,
43
+ {
44
+ placement: "bottom-end",
45
+ closeOnSelect: !0,
46
+ trigger: /* @__PURE__ */ s(
47
+ "button",
48
+ {
49
+ type: "button",
50
+ role: "tab",
51
+ "aria-haspopup": "listbox",
52
+ "aria-label": "More tabs",
53
+ className: E(
54
+ "bear-flex bear-h-full bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-sm bear-font-medium bear-transition-colors bear-border-0 bear-cursor-pointer",
55
+ t === "pills" && "bear-rounded-md",
56
+ m && "bear-shadow-sm",
57
+ !m && "hover:bear-bg-[var(--bear-bg-tertiary)] hover:bear-text-[var(--bear-text-primary)]"
58
+ ),
59
+ style: m ? { backgroundColor: "var(--bear-bg-primary)", color: "var(--bear-text-primary)" } : { color: "var(--bear-text-muted)" },
60
+ children: /* @__PURE__ */ s(D.MoreHorizIcon, { size: 18 })
61
+ }
62
+ ),
63
+ items: c.map((e) => {
64
+ const r = b.find((p) => p.id === e);
65
+ return {
66
+ key: e,
67
+ label: (r == null ? void 0 : r.label) ?? e,
68
+ disabled: r == null ? void 0 : r.disabled,
69
+ onClick: () => z(e)
70
+ };
71
+ })
72
+ }
73
+ ) }) : null;
74
+ return o != null && !n ? /* @__PURE__ */ T("div", { role: "tablist", className: h, style: y, children: [
75
+ /* @__PURE__ */ s("div", { className: "bear-flex bear-min-w-0 bear-flex-1 bear-items-center bear-gap-1 bear-overflow-x-auto bear-overflow-y-visible bear-flex-nowrap", children: g }),
76
+ C
77
+ ] }) : /* @__PURE__ */ T("div", { role: "tablist", className: h, style: y, children: [
78
+ g,
79
+ C
65
80
  ] });
66
81
  };
67
82
  export {
68
- H as TabList
83
+ X as TabList
69
84
  };