@forgedevstack/bear 1.2.0 → 1.2.1

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 (178) hide show
  1. package/README.md +4 -0
  2. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  3. package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
  4. package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
  5. package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
  6. package/dist/components/Autocomplete/Autocomplete.js +110 -72
  7. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  8. package/dist/components/BottomSheet/BottomSheet.js +74 -53
  9. package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
  10. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
  11. package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
  12. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
  13. package/dist/components/Breadcrumbs/index.d.ts +1 -1
  14. package/dist/components/Cascader/Cascader.cjs +1 -1
  15. package/dist/components/Cascader/Cascader.const.cjs +1 -1
  16. package/dist/components/Cascader/Cascader.const.d.ts +1 -1
  17. package/dist/components/Cascader/Cascader.const.js +1 -1
  18. package/dist/components/Cascader/Cascader.js +109 -146
  19. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
  20. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
  21. package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
  22. package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
  23. package/dist/components/Chart/BarChart.cjs +1 -0
  24. package/dist/components/Chart/BarChart.d.ts +3 -0
  25. package/dist/components/Chart/BarChart.js +65 -0
  26. package/dist/components/Chart/Chart.cjs +1 -1
  27. package/dist/components/Chart/Chart.const.cjs +1 -1
  28. package/dist/components/Chart/Chart.const.d.ts +7 -0
  29. package/dist/components/Chart/Chart.const.js +12 -2
  30. package/dist/components/Chart/Chart.d.ts +1 -13
  31. package/dist/components/Chart/Chart.js +18 -204
  32. package/dist/components/Chart/Chart.types.d.ts +7 -1
  33. package/dist/components/Chart/LineChart.cjs +1 -0
  34. package/dist/components/Chart/LineChart.d.ts +3 -0
  35. package/dist/components/Chart/LineChart.js +73 -0
  36. package/dist/components/Chart/PieChart.cjs +1 -0
  37. package/dist/components/Chart/PieChart.d.ts +3 -0
  38. package/dist/components/Chart/PieChart.js +110 -0
  39. package/dist/components/Chart/index.d.ts +4 -1
  40. package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
  41. package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
  42. package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
  43. package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
  44. package/dist/components/ColorPicker/ColorPicker.js +135 -73
  45. package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
  46. package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
  47. package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
  48. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  49. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
  50. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
  51. package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
  52. package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
  53. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
  54. package/dist/components/CreditInput/CreditInput.cjs +1 -1
  55. package/dist/components/CreditInput/CreditInput.js +80 -78
  56. package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
  57. package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
  58. package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
  59. package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
  60. package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
  61. package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
  62. package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
  63. package/dist/components/DiffSquares/DiffSquares.js +70 -0
  64. package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
  65. package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
  66. package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
  67. package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
  68. package/dist/components/DiffSquares/index.d.ts +2 -0
  69. package/dist/components/Drawer/Drawer.cjs +1 -1
  70. package/dist/components/Drawer/Drawer.js +41 -41
  71. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  72. package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
  73. package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
  74. package/dist/components/Dropdown/Dropdown.const.js +10 -0
  75. package/dist/components/Dropdown/Dropdown.d.ts +0 -1
  76. package/dist/components/Dropdown/Dropdown.js +102 -92
  77. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
  78. package/dist/components/Gauge/Gauge.cjs +1 -1
  79. package/dist/components/Gauge/Gauge.js +61 -50
  80. package/dist/components/Gauge/Gauge.types.d.ts +2 -0
  81. package/dist/components/HoverCard/HoverCard.cjs +6 -6
  82. package/dist/components/HoverCard/HoverCard.js +72 -54
  83. package/dist/components/Icon/icons/status.js +1 -1
  84. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  85. package/dist/components/MentionsInput/MentionsInput.js +106 -83
  86. package/dist/components/Menu/Menu.cjs +1 -1
  87. package/dist/components/Menu/Menu.js +91 -80
  88. package/dist/components/Modal/Modal.cjs +1 -1
  89. package/dist/components/Modal/Modal.const.cjs +1 -1
  90. package/dist/components/Modal/Modal.const.d.ts +1 -1
  91. package/dist/components/Modal/Modal.const.js +1 -1
  92. package/dist/components/Modal/Modal.js +50 -44
  93. package/dist/components/Modal/Modal.types.d.ts +6 -0
  94. package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
  95. package/dist/components/MultiSelect/MultiSelect.js +123 -78
  96. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
  97. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
  98. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
  99. package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
  100. package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
  101. package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
  102. package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
  103. package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
  104. package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
  105. package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
  106. package/dist/components/OTPInput/OTPInput.cjs +1 -1
  107. package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
  108. package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
  109. package/dist/components/OTPInput/OTPInput.const.js +14 -0
  110. package/dist/components/OTPInput/OTPInput.js +99 -65
  111. package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
  112. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  113. package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
  114. package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
  115. package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
  116. package/dist/components/PhoneInput/PhoneInput.js +88 -83
  117. package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
  118. package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
  119. package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
  120. package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
  121. package/dist/components/Popconfirm/Popconfirm.js +71 -51
  122. package/dist/components/Popover/Popover.cjs +1 -1
  123. package/dist/components/Popover/Popover.js +36 -31
  124. package/dist/components/Portal/Portal.cjs +1 -1
  125. package/dist/components/Portal/Portal.d.ts +0 -3
  126. package/dist/components/Portal/Portal.js +4 -10
  127. package/dist/components/Select/Select.cjs +1 -1
  128. package/dist/components/Select/Select.js +71 -51
  129. package/dist/components/Stepper/Stepper.cjs +1 -1
  130. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  131. package/dist/components/Stepper/Stepper.const.d.ts +3 -2
  132. package/dist/components/Stepper/Stepper.const.js +15 -14
  133. package/dist/components/Stepper/Stepper.d.ts +0 -7
  134. package/dist/components/Stepper/Stepper.js +164 -117
  135. package/dist/components/Stepper/Stepper.types.d.ts +3 -0
  136. package/dist/components/Tabs/TabList.cjs +1 -1
  137. package/dist/components/Tabs/TabList.js +72 -57
  138. package/dist/components/Tabs/Tabs.types.d.ts +4 -2
  139. package/dist/components/Tabs/index.d.ts +2 -2
  140. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
  141. package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
  142. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  143. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
  144. package/dist/components/Toast/Toast.cjs +1 -1
  145. package/dist/components/Toast/Toast.js +86 -82
  146. package/dist/components/Toast/Toast.types.d.ts +2 -0
  147. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  148. package/dist/components/Tooltip/Tooltip.js +52 -44
  149. package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
  150. package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
  151. package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
  152. package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
  153. package/dist/components/TreeSelect/TreeSelect.js +120 -88
  154. package/dist/components/Watermark/Watermark.cjs +1 -1
  155. package/dist/components/Watermark/Watermark.const.cjs +1 -1
  156. package/dist/components/Watermark/Watermark.const.d.ts +6 -3
  157. package/dist/components/Watermark/Watermark.const.js +13 -11
  158. package/dist/components/Watermark/Watermark.js +87 -61
  159. package/dist/components/Watermark/Watermark.types.d.ts +2 -0
  160. package/dist/components/index.cjs +1 -1
  161. package/dist/components/index.d.ts +5 -3
  162. package/dist/components/index.js +292 -286
  163. package/dist/hooks/index.cjs +1 -1
  164. package/dist/hooks/index.d.ts +1 -1
  165. package/dist/hooks/index.js +55 -54
  166. package/dist/hooks/useClickOutside.cjs +1 -1
  167. package/dist/hooks/useClickOutside.d.ts +4 -11
  168. package/dist/hooks/useClickOutside.js +26 -7
  169. package/dist/index.cjs +1 -1
  170. package/dist/index.js +386 -379
  171. package/dist/styles/_effects.css +17 -0
  172. package/dist/styles.css +1 -1
  173. package/dist/utils/maxVisible.utils.cjs +1 -0
  174. package/dist/utils/maxVisible.utils.d.ts +12 -0
  175. package/dist/utils/maxVisible.utils.js +15 -0
  176. package/package.json +1 -1
  177. package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
  178. package/dist/components/HoverCard/HoverCard.utils.js +0 -23
@@ -1,41 +1,41 @@
1
- import { jsxs as n, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
2
  import { useState as R, useCallback as v } from "react";
3
- import { cn as o } from "../../../../utils/cn.js";
3
+ import { cn as n } from "../../../../utils/cn.js";
4
4
  import { TIMEPICKER_DEFAULT_TRANSLATIONS as B, CLOCK_HOURS_12 as L, TIMEPICKER_FOOTER_CLASSES as D, TIMEPICKER_CLEAR_BUTTON_CLASSES as K, TIMEPICKER_CONFIRM_BUTTON_CLASSES as z, TIMEPICKER_DROPDOWN_CLASSES as w } from "../../TimePicker.constants.js";
5
5
  import { ClockFaceSvg as F } from "../../helpers/ClockFaceSvg.js";
6
- const x = "bear-text-blue-600 dark:bear-text-blue-400 bear-font-bold bear-bg-blue-50 dark:bear-bg-blue-900/30 bear-rounded bear-px-1", _ = "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-300 bear-cursor-pointer bear-px-1", G = ({
7
- selectedHour: i,
6
+ const k = "bear-text-pink-600 dark:bear-text-pink-400 bear-font-bold bear-bg-pink-50 dark:bear-bg-pink-900/30 bear-rounded bear-px-1", x = "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-300 bear-cursor-pointer bear-px-1", G = ({
7
+ selectedHour: b,
8
8
  setSelectedHour: s,
9
9
  selectedMinute: d,
10
10
  setSelectedMinute: m,
11
- period: u,
12
- setPeriod: k,
11
+ period: _,
12
+ setPeriod: p,
13
13
  format: a,
14
- hours: p,
14
+ hours: u,
15
15
  minutes: h,
16
16
  timeValue: T,
17
17
  clearable: S,
18
- onChange: l,
18
+ onChange: o,
19
19
  onConfirm: E,
20
20
  onClose: C,
21
21
  translations: N
22
22
  }) => {
23
- const [I, c] = R("hour"), b = { ...B, ...N }, P = a === "12h" ? i === 12 ? 12 : i % 12 : i, y = d, A = P.toString().padStart(2, "0"), M = y.toString().padStart(2, "0"), O = a === "12h" ? [...L] : p, t = I === "hour", f = t ? O : h, g = v((r) => {
23
+ const [I, c] = R("hour"), i = { ...B, ...N }, P = a === "12h" ? b === 12 ? 12 : b % 12 : b, y = d, A = P.toString().padStart(2, "0"), M = y.toString().padStart(2, "0"), O = a === "12h" ? [...L] : u, t = I === "hour", f = t ? O : h, g = v((r) => {
24
24
  t ? (s(a === "12h" && r === 0 ? 12 : r), c("minute")) : m(r);
25
25
  }, [t, a, s, m]);
26
- return /* @__PURE__ */ n("div", { className: o(w, "Bear-TimePicker__dial bear-w-72"), children: [
27
- /* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2", children: b.selectTime }),
28
- /* @__PURE__ */ n("div", { className: "Bear-TimePicker__dial-display bear-flex bear-items-center bear-justify-center bear-gap-1 bear-mb-4", children: [
26
+ return /* @__PURE__ */ l("div", { className: n(w, "Bear-TimePicker__dial bear-w-72"), children: [
27
+ /* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2", children: i.selectTime }),
28
+ /* @__PURE__ */ l("div", { className: "Bear-TimePicker__dial-display bear-flex bear-items-center bear-justify-center bear-gap-1 bear-mb-4", children: [
29
29
  /* @__PURE__ */ e(
30
30
  "button",
31
31
  {
32
32
  type: "button",
33
33
  onClick: () => c("hour"),
34
- className: o(
34
+ className: n(
35
35
  "Bear-TimePicker__dial-hour-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",
36
- t ? x : _
36
+ t ? k : x
37
37
  ),
38
- "aria-label": b.hour,
38
+ "aria-label": i.hour,
39
39
  children: A
40
40
  }
41
41
  ),
@@ -45,21 +45,21 @@ const x = "bear-text-blue-600 dark:bear-text-blue-400 bear-font-bold bear-bg-blu
45
45
  {
46
46
  type: "button",
47
47
  onClick: () => c("minute"),
48
- className: o(
48
+ className: n(
49
49
  "Bear-TimePicker__dial-minute-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",
50
- t ? _ : x
50
+ t ? x : k
51
51
  ),
52
- "aria-label": b.minute,
52
+ "aria-label": i.minute,
53
53
  children: M
54
54
  }
55
55
  ),
56
56
  a === "12h" && /* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-period bear-flex bear-flex-col bear-gap-0.5 bear-ml-2", children: ["AM", "PM"].map((r) => /* @__PURE__ */ e(
57
57
  "button",
58
58
  {
59
- onClick: () => k(r),
60
- className: o(
59
+ onClick: () => p(r),
60
+ className: n(
61
61
  "Bear-TimePicker__dial-period-btn bear-px-2 bear-py-0.5 bear-rounded bear-text-sm bear-transition-colors",
62
- u === r ? "bear-text-blue-600 dark:bear-text-blue-400 bear-font-medium" : "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-400"
62
+ _ === r ? "bear-text-pink-600 dark:bear-text-pink-400 bear-font-medium" : "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-400"
63
63
  ),
64
64
  children: r
65
65
  },
@@ -72,16 +72,16 @@ const x = "bear-text-blue-600 dark:bear-text-blue-400 bear-font-bold bear-bg-blu
72
72
  values: f,
73
73
  isHourMode: t,
74
74
  format: a,
75
- selectedHour: i,
75
+ selectedHour: b,
76
76
  selectedMinute: d,
77
77
  onSelect: g
78
78
  }
79
79
  ) }),
80
- /* @__PURE__ */ n("div", { className: D, children: [
80
+ /* @__PURE__ */ l("div", { className: D, children: [
81
81
  S && T && /* @__PURE__ */ e("button", { onClick: () => {
82
- l == null || l(null), C();
83
- }, className: K, children: b.cancel }),
84
- /* @__PURE__ */ e("button", { onClick: E, className: z, children: b.ok })
82
+ o == null || o(null), C();
83
+ }, className: K, children: i.cancel }),
84
+ /* @__PURE__ */ e("button", { onClick: E, className: z, children: i.ok })
85
85
  ] })
86
86
  ] });
87
87
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("../../../utils/cn.cjs");require("react");const e=require("../TimePicker.constants.cjs"),x=16,S=14,O=.85,R=.6,b=30,n=90,l=Math.PI/180,f=({values:o,isHourMode:t,format:_,selectedHour:a,selectedMinute:C,onSelect:A,className:L})=>{const N=c=>t?(c*b-n)*l:(c*(360/o.length)-n)*l,E=(t?(_==="12h"?a===12?0:a%12:a)*b-n:C*6-n)*l;return r.jsxs("svg",{viewBox:"0 0 200 200",className:m.cn("Bear-TimePicker__clock-face bear-w-full bear-h-full",L),children:[r.jsx("circle",{cx:e.CLOCK_CENTER,cy:e.CLOCK_CENTER,r:e.CLOCK_RADIUS,className:"Bear-TimePicker__clock-face-circle bear-fill-none bear-stroke-gray-200 dark:bear-stroke-zinc-700 bear-stroke-2"}),o.map((c,h)=>{const T=N(h),s=e.CLOCK_CENTER+e.CLOCK_RADIUS*O*Math.cos(T),i=e.CLOCK_CENTER+e.CLOCK_RADIUS*O*Math.sin(T),k=t?_==="12h"?c===12?a===12:a%12===c:a===c:C===c;return r.jsxs("g",{onClick:()=>A(c),className:"Bear-TimePicker__clock-face-item bear-cursor-pointer",children:[r.jsx("circle",{cx:s,cy:i,r:x,fill:"transparent"}),k&&r.jsx("circle",{cx:s,cy:i,r:S,className:"Bear-TimePicker__clock-face-dot bear-fill-blue-500"}),r.jsx("text",{x:s,y:i,textAnchor:"middle",dominantBaseline:"middle",className:m.cn("Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",k?"bear-fill-white":"bear-fill-gray-700 dark:bear-fill-zinc-300"),children:typeof c=="number"?c.toString().padStart(2,"0"):c})]},c)}),r.jsx("line",{x1:e.CLOCK_CENTER,y1:e.CLOCK_CENTER,x2:e.CLOCK_CENTER+e.CLOCK_RADIUS*R*Math.cos(E),y2:e.CLOCK_CENTER+e.CLOCK_RADIUS*R*Math.sin(E),className:"Bear-TimePicker__clock-face-hand bear-stroke-blue-500 bear-stroke-2",strokeLinecap:"round"})]})};exports.ClockFaceSvg=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("../../../utils/cn.cjs");require("react");const e=require("../TimePicker.constants.cjs"),x=16,S=14,O=.85,R=.6,A=30,a=90,l=Math.PI/180,f=({values:o,isHourMode:t,format:_,selectedHour:n,selectedMinute:C,onSelect:L,className:N})=>{const b=c=>t?(c*A-a)*l:(c*(360/o.length)-a)*l,E=(t?(_==="12h"?n===12?0:n%12:n)*A-a:C*6-a)*l;return r.jsxs("svg",{viewBox:"0 0 200 200",className:m.cn("Bear-TimePicker__clock-face bear-w-full bear-h-full",N),children:[r.jsx("circle",{cx:e.CLOCK_CENTER,cy:e.CLOCK_CENTER,r:e.CLOCK_RADIUS,className:"Bear-TimePicker__clock-face-circle bear-fill-none bear-stroke-gray-200 dark:bear-stroke-zinc-700 bear-stroke-2"}),o.map((c,h)=>{const T=b(h),i=e.CLOCK_CENTER+e.CLOCK_RADIUS*O*Math.cos(T),s=e.CLOCK_CENTER+e.CLOCK_RADIUS*O*Math.sin(T),k=t?_==="12h"?c===12?n===12:n%12===c:n===c:C===c;return r.jsxs("g",{onClick:()=>L(c),className:"Bear-TimePicker__clock-face-item bear-cursor-pointer",children:[r.jsx("circle",{cx:i,cy:s,r:x,fill:"transparent"}),k&&r.jsx("circle",{cx:i,cy:s,r:S,className:"Bear-TimePicker__clock-face-dot bear-fill-pink-500"}),r.jsx("text",{x:i,y:s,textAnchor:"middle",dominantBaseline:"middle",className:m.cn("Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",k?"bear-fill-white":"bear-fill-gray-700 dark:bear-fill-zinc-300"),children:typeof c=="number"?c.toString().padStart(2,"0"):c})]},c)}),r.jsx("line",{x1:e.CLOCK_CENTER,y1:e.CLOCK_CENTER,x2:e.CLOCK_CENTER+e.CLOCK_RADIUS*R*Math.cos(E),y2:e.CLOCK_CENTER+e.CLOCK_RADIUS*R*Math.sin(E),className:"Bear-TimePicker__clock-face-hand bear-stroke-pink-500 bear-stroke-2",strokeLinecap:"round"})]})};exports.ClockFaceSvg=f;
@@ -1,18 +1,18 @@
1
- import { jsxs as T, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as b, jsx as a } from "react/jsx-runtime";
2
2
  import { cn as A } from "../../../utils/cn.js";
3
3
  import "react";
4
4
  import { CLOCK_RADIUS as n, CLOCK_CENTER as c } from "../TimePicker.constants.js";
5
- const I = 16, O = 14, E = 0.85, x = 0.6, N = 30, t = 90, s = Math.PI / 180, C = ({
5
+ const I = 16, O = 14, p = 0.85, E = 0.6, x = 30, t = 90, s = Math.PI / 180, C = ({
6
6
  values: _,
7
7
  isHourMode: i,
8
8
  format: m,
9
9
  selectedHour: r,
10
10
  selectedMinute: k,
11
- onSelect: g,
12
- className: p
11
+ onSelect: N,
12
+ className: g
13
13
  }) => {
14
- const d = (e) => i ? (e * N - t) * s : (e * (360 / _.length) - t) * s, b = (i ? (m === "12h" ? r === 12 ? 0 : r % 12 : r) * N - t : k * 6 - t) * s;
15
- return /* @__PURE__ */ T("svg", { viewBox: "0 0 200 200", className: A("Bear-TimePicker__clock-face bear-w-full bear-h-full", p), children: [
14
+ const d = (e) => i ? (e * x - t) * s : (e * (360 / _.length) - t) * s, f = (i ? (m === "12h" ? r === 12 ? 0 : r % 12 : r) * x - t : k * 6 - t) * s;
15
+ return /* @__PURE__ */ b("svg", { viewBox: "0 0 200 200", className: A("Bear-TimePicker__clock-face bear-w-full bear-h-full", g), children: [
16
16
  /* @__PURE__ */ a(
17
17
  "circle",
18
18
  {
@@ -23,25 +23,25 @@ const I = 16, O = 14, E = 0.85, x = 0.6, N = 30, t = 90, s = Math.PI / 180, C =
23
23
  }
24
24
  ),
25
25
  _.map((e, S) => {
26
- const f = d(S), l = c + n * E * Math.cos(f), o = c + n * E * Math.sin(f), h = i ? m === "12h" ? e === 12 ? r === 12 : r % 12 === e : r === e : k === e;
27
- return /* @__PURE__ */ T(
26
+ const h = d(S), o = c + n * p * Math.cos(h), l = c + n * p * Math.sin(h), T = i ? m === "12h" ? e === 12 ? r === 12 : r % 12 === e : r === e : k === e;
27
+ return /* @__PURE__ */ b(
28
28
  "g",
29
29
  {
30
- onClick: () => g(e),
30
+ onClick: () => N(e),
31
31
  className: "Bear-TimePicker__clock-face-item bear-cursor-pointer",
32
32
  children: [
33
- /* @__PURE__ */ a("circle", { cx: l, cy: o, r: I, fill: "transparent" }),
34
- h && /* @__PURE__ */ a("circle", { cx: l, cy: o, r: O, className: "Bear-TimePicker__clock-face-dot bear-fill-blue-500" }),
33
+ /* @__PURE__ */ a("circle", { cx: o, cy: l, r: I, fill: "transparent" }),
34
+ T && /* @__PURE__ */ a("circle", { cx: o, cy: l, r: O, className: "Bear-TimePicker__clock-face-dot bear-fill-pink-500" }),
35
35
  /* @__PURE__ */ a(
36
36
  "text",
37
37
  {
38
- x: l,
39
- y: o,
38
+ x: o,
39
+ y: l,
40
40
  textAnchor: "middle",
41
41
  dominantBaseline: "middle",
42
42
  className: A(
43
43
  "Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",
44
- h ? "bear-fill-white" : "bear-fill-gray-700 dark:bear-fill-zinc-300"
44
+ T ? "bear-fill-white" : "bear-fill-gray-700 dark:bear-fill-zinc-300"
45
45
  ),
46
46
  children: typeof e == "number" ? e.toString().padStart(2, "0") : e
47
47
  }
@@ -56,9 +56,9 @@ const I = 16, O = 14, E = 0.85, x = 0.6, N = 30, t = 90, s = Math.PI / 180, C =
56
56
  {
57
57
  x1: c,
58
58
  y1: c,
59
- x2: c + n * x * Math.cos(b),
60
- y2: c + n * x * Math.sin(b),
61
- className: "Bear-TimePicker__clock-face-hand bear-stroke-blue-500 bear-stroke-2",
59
+ x2: c + n * E * Math.cos(f),
60
+ y2: c + n * E * Math.sin(f),
61
+ className: "Bear-TimePicker__clock-face-hand bear-stroke-pink-500 bear-stroke-2",
62
62
  strokeLinecap: "round"
63
63
  }
64
64
  )
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),y=require("../../utils/cn.cjs"),w=require("./Toast.utils.cjs"),p={success:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),info:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),warning:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),error:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},k=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),C={success:"bear-bg-green-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white",warning:"bear-bg-amber-500 bear-text-white",error:"bear-bg-red-500 bear-text-white"},S={"top-left":"bear-top-4 bear-left-4","top-center":"bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2","top-right":"bear-top-4 bear-right-4","bottom-left":"bear-bottom-4 bear-left-4","bottom-center":"bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2","bottom-right":"bear-bottom-4 bear-right-4"},v=s.createContext(null),I=()=>{const i=s.useContext(v);if(!i)throw new Error("useToast must be used within a ToastProvider");return i},N=({message:i,title:c,severity:b="info",duration:n=5e3,closable:l=!0,icon:r,action:x,onClose:a,onRemove:u,className:m})=>{const[f,d]=s.useState(!1);s.useEffect(()=>{if(n>0){const t=setTimeout(()=>{d(!0),setTimeout(()=>{u(),a==null||a()},200)},n);return()=>clearTimeout(t)}},[n,u,a]);const g=()=>{d(!0),setTimeout(()=>{u(),a==null||a()},200)},h=()=>r===!1?null:r||p[b];return e.jsxs("div",{role:"alert",className:y.cn("bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]","bear-transition-all bear-duration-200",f?"bear-opacity-0 bear-translate-x-2":"bear-opacity-100 bear-translate-x-0",C[b],m),children:[h()&&e.jsx("span",{className:"bear-flex-shrink-0 bear-mt-0.5",children:h()}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[c&&e.jsx("div",{className:"bear-font-semibold bear-mb-0.5",children:c}),e.jsx("div",{className:"bear-text-sm bear-opacity-90",children:i})]}),x&&e.jsx("div",{className:"bear-flex-shrink-0",children:x}),l&&e.jsx("button",{type:"button",onClick:g,className:"bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer","aria-label":"Close",children:e.jsx(k,{})})]})},T=({position:i="top-right",maxToasts:c=5,className:b})=>{const n=s.useContext(v);if(!n)return null;const{_toasts:l,_removeToast:r}=n,x=l.slice(0,c);return e.jsx("div",{className:y.cn("bear-fixed bear-z-50 bear-flex bear-flex-col bear-gap-2",S[i],b),children:x.map(a=>e.jsx(N,{...a,onRemove:()=>r(a.id)},a.id))})},E=({children:i,position:c="top-right"})=>{const[b,n]=s.useState([]),l=s.useCallback(t=>{n(o=>o.filter(j=>j.id!==t))},[]),r=s.useCallback(t=>{const o=t.id||w.generateId();return n(j=>[...j,{...t,id:o}]),o},[]),x=s.useCallback(t=>r(t),[r]),a=s.useCallback((t,o)=>r({message:t,severity:"success",...o}),[r]),u=s.useCallback((t,o)=>r({message:t,severity:"info",...o}),[r]),m=s.useCallback((t,o)=>r({message:t,severity:"warning",...o}),[r]),f=s.useCallback((t,o)=>r({message:t,severity:"error",...o}),[r]),d=s.useCallback(t=>l(t),[l]),g=s.useCallback(()=>n([]),[]),h={toast:x,success:a,info:u,warning:m,error:f,dismiss:d,dismissAll:g,_toasts:b,_removeToast:l};return e.jsxs(v.Provider,{value:h,children:[i,e.jsx(T,{position:c})]})};exports.ToastContainer=T;exports.ToastProvider=E;exports.useToast=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),y=require("../../utils/cn.cjs"),T=require("./Toast.utils.cjs"),p={success:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),info:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),warning:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),error:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},k=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),C={success:"bear-bg-green-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white",warning:"bear-bg-amber-500 bear-text-white",error:"bear-bg-red-500 bear-text-white"},I={"top-left":"bear-top-4 bear-left-4","top-center":"bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2","top-right":"bear-top-4 bear-right-4","bottom-left":"bear-bottom-4 bear-left-4","bottom-center":"bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2","bottom-right":"bear-bottom-4 bear-right-4"},v=r.createContext(null),E=()=>{const i=r.useContext(v);if(!i)throw new Error("useToast must be used within a ToastProvider");return i},N=({message:i,title:c,severity:b="info",duration:n=5e3,closable:l=!0,icon:s,action:x,onClose:o,onRemove:u,className:g,autoScroll:f=!1})=>{const[j,m]=r.useState(!1),d=r.useRef(null);r.useEffect(()=>{f&&d.current&&d.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[f]),r.useEffect(()=>{if(n>0){const h=setTimeout(()=>{m(!0),setTimeout(()=>{u(),o==null||o()},200)},n);return()=>clearTimeout(h)}},[n,u,o]);const t=()=>{m(!0),setTimeout(()=>{u(),o==null||o()},200)},a=()=>s===!1?null:s||p[b];return e.jsxs("div",{ref:d,role:"alert",className:y.cn("bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]","bear-transition-all bear-duration-200",j?"bear-opacity-0 bear-translate-x-2":"bear-opacity-100 bear-translate-x-0",C[b],g),children:[a()&&e.jsx("span",{className:"bear-flex-shrink-0 bear-mt-0.5",children:a()}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[c&&e.jsx("div",{className:"bear-font-semibold bear-mb-0.5",children:c}),e.jsx("div",{className:"bear-text-sm bear-opacity-90",children:i})]}),x&&e.jsx("div",{className:"bear-flex-shrink-0",children:x}),l&&e.jsx("button",{type:"button",onClick:t,className:"bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer","aria-label":"Close",children:e.jsx(k,{})})]})},w=({position:i="top-right",maxToasts:c=5,className:b})=>{const n=r.useContext(v);if(!n)return null;const{_toasts:l,_removeToast:s}=n,x=l.slice(0,c);return e.jsx("div",{className:y.cn("bear-fixed bear-z-[11000] bear-flex bear-flex-col bear-gap-2",I[i],b),children:x.map(o=>e.jsx(N,{...o,onRemove:()=>s(o.id)},o.id))})},S=({children:i,position:c="top-right"})=>{const[b,n]=r.useState([]),l=r.useCallback(t=>{n(a=>a.filter(h=>h.id!==t))},[]),s=r.useCallback(t=>{const a=t.id||T.generateId();return n(h=>[...h,{...t,id:a}]),a},[]),x=r.useCallback(t=>s(t),[s]),o=r.useCallback((t,a)=>s({message:t,severity:"success",...a}),[s]),u=r.useCallback((t,a)=>s({message:t,severity:"info",...a}),[s]),g=r.useCallback((t,a)=>s({message:t,severity:"warning",...a}),[s]),f=r.useCallback((t,a)=>s({message:t,severity:"error",...a}),[s]),j=r.useCallback(t=>l(t),[l]),m=r.useCallback(()=>n([]),[]),d={toast:x,success:o,info:u,warning:g,error:f,dismiss:j,dismissAll:m,_toasts:b,_removeToast:l};return e.jsxs(v.Provider,{value:d,children:[i,e.jsx(w,{position:c})]})};exports.ToastContainer=w;exports.ToastProvider=S;exports.useToast=E;
@@ -1,159 +1,163 @@
1
- import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
- import { createContext as I, useContext as y, useState as T, useCallback as i, useEffect as N } from "react";
3
- import { cn as k } from "../../utils/cn.js";
4
- import { generateId as E } from "./Toast.utils.js";
5
- const S = {
6
- success: /* @__PURE__ */ c("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
1
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
+ import { createContext as N, useContext as T, useState as k, useCallback as n, useRef as E, useEffect as y } from "react";
3
+ import { cn as I } from "../../utils/cn.js";
4
+ import { generateId as S } from "./Toast.utils.js";
5
+ const _ = {
6
+ success: /* @__PURE__ */ l("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
7
7
  /* @__PURE__ */ e("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
8
8
  /* @__PURE__ */ e("polyline", { points: "22 4 12 14.01 9 11.01" })
9
9
  ] }),
10
- info: /* @__PURE__ */ c("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
10
+ info: /* @__PURE__ */ l("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
11
11
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
12
12
  /* @__PURE__ */ e("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
13
13
  /* @__PURE__ */ e("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
14
14
  ] }),
15
- warning: /* @__PURE__ */ c("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
15
+ warning: /* @__PURE__ */ l("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
16
16
  /* @__PURE__ */ e("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
17
17
  /* @__PURE__ */ e("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
18
18
  /* @__PURE__ */ e("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
19
19
  ] }),
20
- error: /* @__PURE__ */ c("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
20
+ error: /* @__PURE__ */ l("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
21
21
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
22
22
  /* @__PURE__ */ e("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
23
23
  /* @__PURE__ */ e("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
24
24
  ] })
25
- }, _ = () => /* @__PURE__ */ c("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
25
+ }, B = () => /* @__PURE__ */ l("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
26
26
  /* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
27
27
  /* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
28
- ] }), B = {
28
+ ] }), W = {
29
29
  success: "bear-bg-green-500 bear-text-white",
30
30
  info: "bear-bg-blue-500 bear-text-white",
31
31
  warning: "bear-bg-amber-500 bear-text-white",
32
32
  error: "bear-bg-red-500 bear-text-white"
33
- }, W = {
33
+ }, C = {
34
34
  "top-left": "bear-top-4 bear-left-4",
35
35
  "top-center": "bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2",
36
36
  "top-right": "bear-top-4 bear-right-4",
37
37
  "bottom-left": "bear-bottom-4 bear-left-4",
38
38
  "bottom-center": "bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2",
39
39
  "bottom-right": "bear-bottom-4 bear-right-4"
40
- }, w = I(null), z = () => {
41
- const n = y(w);
42
- if (!n)
40
+ }, w = N(null), M = () => {
41
+ const i = T(w);
42
+ if (!i)
43
43
  throw new Error("useToast must be used within a ToastProvider");
44
- return n;
45
- }, C = ({
46
- message: n,
44
+ return i;
45
+ }, L = ({
46
+ message: i,
47
47
  title: b,
48
- severity: d = "info",
48
+ severity: h = "info",
49
49
  duration: o = 5e3,
50
- closable: l = !0,
50
+ closable: c = !0,
51
51
  icon: t,
52
- action: h,
53
- onClose: a,
52
+ action: d,
53
+ onClose: s,
54
54
  onRemove: x,
55
- className: f
55
+ className: p,
56
+ autoScroll: m = !1
56
57
  }) => {
57
- const [g, m] = T(!1);
58
- N(() => {
58
+ const [v, g] = k(!1), u = E(null);
59
+ y(() => {
60
+ m && u.current && u.current.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
61
+ }, [m]), y(() => {
59
62
  if (o > 0) {
60
- const r = setTimeout(() => {
61
- m(!0), setTimeout(() => {
62
- x(), a == null || a();
63
+ const f = setTimeout(() => {
64
+ g(!0), setTimeout(() => {
65
+ x(), s == null || s();
63
66
  }, 200);
64
67
  }, o);
65
- return () => clearTimeout(r);
68
+ return () => clearTimeout(f);
66
69
  }
67
- }, [o, x, a]);
68
- const p = () => {
69
- m(!0), setTimeout(() => {
70
- x(), a == null || a();
70
+ }, [o, x, s]);
71
+ const r = () => {
72
+ g(!0), setTimeout(() => {
73
+ x(), s == null || s();
71
74
  }, 200);
72
- }, u = () => t === !1 ? null : t || S[d];
73
- return /* @__PURE__ */ c(
75
+ }, a = () => t === !1 ? null : t || _[h];
76
+ return /* @__PURE__ */ l(
74
77
  "div",
75
78
  {
79
+ ref: u,
76
80
  role: "alert",
77
- className: k(
81
+ className: I(
78
82
  "bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]",
79
83
  "bear-transition-all bear-duration-200",
80
- g ? "bear-opacity-0 bear-translate-x-2" : "bear-opacity-100 bear-translate-x-0",
81
- B[d],
82
- f
84
+ v ? "bear-opacity-0 bear-translate-x-2" : "bear-opacity-100 bear-translate-x-0",
85
+ W[h],
86
+ p
83
87
  ),
84
88
  children: [
85
- u() && /* @__PURE__ */ e("span", { className: "bear-flex-shrink-0 bear-mt-0.5", children: u() }),
86
- /* @__PURE__ */ c("div", { className: "bear-flex-1 bear-min-w-0", children: [
89
+ a() && /* @__PURE__ */ e("span", { className: "bear-flex-shrink-0 bear-mt-0.5", children: a() }),
90
+ /* @__PURE__ */ l("div", { className: "bear-flex-1 bear-min-w-0", children: [
87
91
  b && /* @__PURE__ */ e("div", { className: "bear-font-semibold bear-mb-0.5", children: b }),
88
- /* @__PURE__ */ e("div", { className: "bear-text-sm bear-opacity-90", children: n })
92
+ /* @__PURE__ */ e("div", { className: "bear-text-sm bear-opacity-90", children: i })
89
93
  ] }),
90
- h && /* @__PURE__ */ e("div", { className: "bear-flex-shrink-0", children: h }),
91
- l && /* @__PURE__ */ e(
94
+ d && /* @__PURE__ */ e("div", { className: "bear-flex-shrink-0", children: d }),
95
+ c && /* @__PURE__ */ e(
92
96
  "button",
93
97
  {
94
98
  type: "button",
95
- onClick: p,
99
+ onClick: r,
96
100
  className: "bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer",
97
101
  "aria-label": "Close",
98
- children: /* @__PURE__ */ e(_, {})
102
+ children: /* @__PURE__ */ e(B, {})
99
103
  }
100
104
  )
101
105
  ]
102
106
  }
103
107
  );
104
- }, L = ({
105
- position: n = "top-right",
108
+ }, P = ({
109
+ position: i = "top-right",
106
110
  maxToasts: b = 5,
107
- className: d
111
+ className: h
108
112
  }) => {
109
- const o = y(w);
113
+ const o = T(w);
110
114
  if (!o) return null;
111
- const { _toasts: l, _removeToast: t } = o, h = l.slice(0, b);
115
+ const { _toasts: c, _removeToast: t } = o, d = c.slice(0, b);
112
116
  return /* @__PURE__ */ e(
113
117
  "div",
114
118
  {
115
- className: k(
116
- "bear-fixed bear-z-50 bear-flex bear-flex-col bear-gap-2",
117
- W[n],
118
- d
119
+ className: I(
120
+ "bear-fixed bear-z-[11000] bear-flex bear-flex-col bear-gap-2",
121
+ C[i],
122
+ h
119
123
  ),
120
- children: h.map((a) => /* @__PURE__ */ e(
121
- C,
124
+ children: d.map((s) => /* @__PURE__ */ e(
125
+ L,
122
126
  {
123
- ...a,
124
- onRemove: () => t(a.id)
127
+ ...s,
128
+ onRemove: () => t(s.id)
125
129
  },
126
- a.id
130
+ s.id
127
131
  ))
128
132
  }
129
133
  );
130
- }, M = ({
131
- children: n,
134
+ }, O = ({
135
+ children: i,
132
136
  position: b = "top-right"
133
137
  }) => {
134
- const [d, o] = T([]), l = i((r) => {
135
- o((s) => s.filter((v) => v.id !== r));
136
- }, []), t = i((r) => {
137
- const s = r.id || E();
138
- return o((v) => [...v, { ...r, id: s }]), s;
139
- }, []), h = i((r) => t(r), [t]), a = i((r, s) => t({ message: r, severity: "success", ...s }), [t]), x = i((r, s) => t({ message: r, severity: "info", ...s }), [t]), f = i((r, s) => t({ message: r, severity: "warning", ...s }), [t]), g = i((r, s) => t({ message: r, severity: "error", ...s }), [t]), m = i((r) => l(r), [l]), p = i(() => o([]), []), u = {
140
- toast: h,
141
- success: a,
138
+ const [h, o] = k([]), c = n((r) => {
139
+ o((a) => a.filter((f) => f.id !== r));
140
+ }, []), t = n((r) => {
141
+ const a = r.id || S();
142
+ return o((f) => [...f, { ...r, id: a }]), a;
143
+ }, []), d = n((r) => t(r), [t]), s = n((r, a) => t({ message: r, severity: "success", ...a }), [t]), x = n((r, a) => t({ message: r, severity: "info", ...a }), [t]), p = n((r, a) => t({ message: r, severity: "warning", ...a }), [t]), m = n((r, a) => t({ message: r, severity: "error", ...a }), [t]), v = n((r) => c(r), [c]), g = n(() => o([]), []), u = {
144
+ toast: d,
145
+ success: s,
142
146
  info: x,
143
- warning: f,
144
- error: g,
145
- dismiss: m,
146
- dismissAll: p,
147
- _toasts: d,
148
- _removeToast: l
147
+ warning: p,
148
+ error: m,
149
+ dismiss: v,
150
+ dismissAll: g,
151
+ _toasts: h,
152
+ _removeToast: c
149
153
  };
150
- return /* @__PURE__ */ c(w.Provider, { value: u, children: [
151
- n,
152
- /* @__PURE__ */ e(L, { position: b })
154
+ return /* @__PURE__ */ l(w.Provider, { value: u, children: [
155
+ i,
156
+ /* @__PURE__ */ e(P, { position: b })
153
157
  ] });
154
158
  };
155
159
  export {
156
- L as ToastContainer,
157
- M as ToastProvider,
158
- z as useToast
160
+ P as ToastContainer,
161
+ O as ToastProvider,
162
+ M as useToast
159
163
  };
@@ -22,6 +22,8 @@ export interface ToastProps {
22
22
  onClose?: () => void;
23
23
  /** Additional CSS class */
24
24
  className?: string;
25
+ /** Scroll the toast into view when it appears */
26
+ autoScroll?: boolean;
25
27
  }
26
28
  export interface ToastContainerProps {
27
29
  /** Position of toast container */
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),r=require("react"),j=require("react-dom"),k=require("../../utils/cn.cjs"),v=({content:m,children:x,position:w,placement:R,delay:y=200,className:T,disabled:M=!1})=>{const c=R||w||"top",[l,d]=r.useState(!1),[b,B]=r.useState({x:0,y:0}),u=r.useRef(null),h=r.useRef(null),n=r.useRef(),f=r.useCallback(()=>{if(!u.current||!h.current)return;const e=u.current.getBoundingClientRect(),t=h.current.getBoundingClientRect(),s=8;let o=0,i=0;switch(c){case"top":o=e.left+(e.width-t.width)/2,i=e.top-t.height-s;break;case"bottom":o=e.left+(e.width-t.width)/2,i=e.bottom+s;break;case"left":o=e.left-t.width-s,i=e.top+(e.height-t.height)/2;break;case"right":o=e.right+s,i=e.top+(e.height-t.height)/2;break}o=Math.max(8,Math.min(o,window.innerWidth-t.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-t.height-8)),B({x:o,y:i})},[c]),g=()=>{M||(n.current=setTimeout(()=>{d(!0)},y))},p=()=>{n.current&&clearTimeout(n.current),d(!1)};return r.useEffect(()=>{l&&f()},[l,f]),r.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:u,onMouseEnter:g,onMouseLeave:p,onFocus:g,onBlur:p,className:"Bear-Tooltip__trigger bear-inline-block",children:x}),l&&j.createPortal(a.jsx("div",{ref:h,role:"tooltip",style:{left:b.x,top:b.y},className:k.cn("bear-fixed bear-z-[9999]","Bear-Tooltip",`Bear-Tooltip--${c}`,"bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-800 bear-text-white bear-text-sm","bear-border bear-border-gray-700","bear-shadow-lg","bear-animate-in bear-fade-in bear-duration-150",T),children:a.jsx("span",{className:"Bear-Tooltip__content",children:m})}),document.body)]})};exports.Tooltip=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),t=require("react"),M=require("react-dom"),B=require("../../utils/cn.cjs"),j=({content:p,children:w,position:x,placement:R,delay:v=200,className:y,disabled:T=!1})=>{const u=R||x||"top",[i,b]=t.useState(!1),[f,E]=t.useState({x:0,y:0}),d=t.useRef(null),h=t.useRef(null),s=t.useRef(),c=t.useCallback(()=>{if(!d.current||!h.current)return;const e=d.current.getBoundingClientRect(),r=h.current.getBoundingClientRect(),l=8;let o=0,n=0;switch(u){case"top":o=e.left+(e.width-r.width)/2,n=e.top-r.height-l;break;case"bottom":o=e.left+(e.width-r.width)/2,n=e.bottom+l;break;case"left":o=e.left-r.width-l,n=e.top+(e.height-r.height)/2;break;case"right":o=e.right+l,n=e.top+(e.height-r.height)/2;break}o=Math.max(8,Math.min(o,window.innerWidth-r.width-8)),n=Math.max(8,Math.min(n,window.innerHeight-r.height-8)),E({x:o,y:n})},[u]),g=()=>{T||(s.current=setTimeout(()=>{b(!0)},v))},m=()=>{s.current&&clearTimeout(s.current),b(!1)};return t.useEffect(()=>{i&&c()},[i,c]),t.useEffect(()=>{if(!i)return;const e=()=>{requestAnimationFrame(()=>c())};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[i,c]),t.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:d,onMouseEnter:g,onMouseLeave:m,onFocus:g,onBlur:m,className:"Bear-Tooltip__trigger bear-inline-block",children:w}),i&&M.createPortal(a.jsx("div",{ref:h,role:"tooltip",style:{left:f.x,top:f.y},className:B.cn("bear-fixed bear-z-[11000]","Bear-Tooltip",`Bear-Tooltip--${u}`,"bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-800 bear-text-white bear-text-sm","bear-border bear-border-gray-700","bear-shadow-lg","bear-animate-in bear-fade-in bear-duration-150",y),children:a.jsx("span",{className:"Bear-Tooltip__content",children:p})}),document.body)]})};exports.Tooltip=j;