@forgedevstack/bear 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +100 -290
  2. package/dist/components/Alert/Alert.cjs +1 -1
  3. package/dist/components/Alert/Alert.const.cjs +1 -1
  4. package/dist/components/Alert/Alert.const.d.ts +1 -6
  5. package/dist/components/Alert/Alert.const.js +10 -30
  6. package/dist/components/Alert/Alert.js +49 -54
  7. package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
  8. package/dist/components/AlertDialog/AlertDialog.js +67 -84
  9. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  10. package/dist/components/BottomSheet/BottomSheet.js +72 -64
  11. package/dist/components/Calendar/Calendar.cjs +1 -1
  12. package/dist/components/Calendar/Calendar.js +122 -112
  13. package/dist/components/Chart/BarChart.cjs +1 -1
  14. package/dist/components/Chart/BarChart.js +37 -36
  15. package/dist/components/Chart/Chart.types.d.ts +2 -0
  16. package/dist/components/Chart/Chart.utils.cjs +1 -1
  17. package/dist/components/Chart/Chart.utils.d.ts +2 -0
  18. package/dist/components/Chart/Chart.utils.js +32 -31
  19. package/dist/components/Chart/FunnelChart.cjs +1 -1
  20. package/dist/components/Chart/FunnelChart.js +29 -28
  21. package/dist/components/Chart/LineChart.cjs +1 -1
  22. package/dist/components/Chart/LineChart.js +45 -44
  23. package/dist/components/Chart/PieChart.cjs +1 -1
  24. package/dist/components/Chart/PieChart.js +52 -51
  25. package/dist/components/Chart/RadarChart.cjs +1 -1
  26. package/dist/components/Chart/RadarChart.js +63 -62
  27. package/dist/components/Chart/index.d.ts +1 -1
  28. package/dist/components/ChipGroup/ChipGroup.cjs +1 -1
  29. package/dist/components/ChipGroup/ChipGroup.const.cjs +1 -1
  30. package/dist/components/ChipGroup/ChipGroup.const.d.ts +2 -0
  31. package/dist/components/ChipGroup/ChipGroup.const.js +6 -4
  32. package/dist/components/ChipGroup/ChipGroup.js +52 -48
  33. package/dist/components/CommandPalette/CommandItem.cjs +1 -0
  34. package/dist/components/CommandPalette/CommandItem.d.ts +6 -0
  35. package/dist/components/CommandPalette/CommandItem.js +39 -0
  36. package/dist/components/CommandPalette/CommandPalette.cjs +1 -1
  37. package/dist/components/CommandPalette/CommandPalette.js +129 -144
  38. package/dist/components/Drawer/Drawer.cjs +1 -1
  39. package/dist/components/Drawer/Drawer.js +72 -66
  40. package/dist/components/EmptyState/EmptyState.cjs +1 -1
  41. package/dist/components/EmptyState/EmptyState.const.cjs +1 -1
  42. package/dist/components/EmptyState/EmptyState.const.d.ts +5 -0
  43. package/dist/components/EmptyState/EmptyState.const.js +30 -15
  44. package/dist/components/EmptyState/EmptyState.js +35 -35
  45. package/dist/components/EmptyState/EmptyState.types.d.ts +2 -2
  46. package/dist/components/HoverCard/HoverCard.cjs +4 -3
  47. package/dist/components/HoverCard/HoverCard.const.cjs +1 -0
  48. package/dist/components/HoverCard/HoverCard.const.d.ts +1 -0
  49. package/dist/components/HoverCard/HoverCard.const.js +5 -0
  50. package/dist/components/HoverCard/HoverCard.js +62 -56
  51. package/dist/components/HoverCard/HoverCard.types.d.ts +7 -0
  52. package/dist/components/Menu/Menu.cjs +1 -1
  53. package/dist/components/Menu/Menu.const.cjs +1 -0
  54. package/dist/components/Menu/Menu.const.d.ts +2 -0
  55. package/dist/components/Menu/Menu.const.js +7 -0
  56. package/dist/components/Menu/Menu.d.ts +3 -9
  57. package/dist/components/Menu/Menu.js +57 -89
  58. package/dist/components/Menu/Menu.types.d.ts +8 -1
  59. package/dist/components/Menu/MenuDivider.cjs +1 -0
  60. package/dist/components/Menu/MenuDivider.d.ts +6 -0
  61. package/dist/components/Menu/MenuDivider.js +7 -0
  62. package/dist/components/Menu/MenuItem.cjs +1 -0
  63. package/dist/components/Menu/MenuItem.d.ts +6 -0
  64. package/dist/components/Menu/MenuItem.js +46 -0
  65. package/dist/components/Modal/Modal.cjs +1 -1
  66. package/dist/components/Modal/Modal.const.cjs +1 -1
  67. package/dist/components/Modal/Modal.const.d.ts +1 -0
  68. package/dist/components/Modal/Modal.const.js +15 -12
  69. package/dist/components/Modal/Modal.js +62 -59
  70. package/dist/components/Modal/Modal.types.d.ts +7 -0
  71. package/dist/components/ModalsProvider/components/StackedModal/StackedModal.cjs +1 -1
  72. package/dist/components/ModalsProvider/components/StackedModal/StackedModal.js +10 -9
  73. package/dist/components/OverlayPortal/OverlayPortal.cjs +1 -1
  74. package/dist/components/OverlayPortal/OverlayPortal.const.cjs +1 -1
  75. package/dist/components/OverlayPortal/OverlayPortal.const.d.ts +4 -0
  76. package/dist/components/OverlayPortal/OverlayPortal.const.js +21 -5
  77. package/dist/components/OverlayPortal/OverlayPortal.js +44 -38
  78. package/dist/components/Popover/Popover.cjs +1 -1
  79. package/dist/components/Popover/Popover.const.cjs +1 -0
  80. package/dist/components/Popover/Popover.const.d.ts +15 -1
  81. package/dist/components/Popover/Popover.const.js +24 -0
  82. package/dist/components/Popover/Popover.js +77 -73
  83. package/dist/components/Popover/Popover.types.d.ts +7 -0
  84. package/dist/components/Select/Select.cjs +1 -1
  85. package/dist/components/Select/Select.const.cjs +1 -1
  86. package/dist/components/Select/Select.const.d.ts +1 -0
  87. package/dist/components/Select/Select.const.js +7 -6
  88. package/dist/components/Select/Select.js +101 -96
  89. package/dist/components/Tabs/TabList.cjs +1 -1
  90. package/dist/components/Tabs/TabList.js +1 -1
  91. package/dist/components/Toast/Toast.cjs +1 -1
  92. package/dist/components/Toast/Toast.const.cjs +1 -1
  93. package/dist/components/Toast/Toast.const.d.ts +2 -0
  94. package/dist/components/Toast/Toast.const.js +11 -8
  95. package/dist/components/Toast/Toast.context.cjs +1 -0
  96. package/dist/components/Toast/Toast.context.d.ts +3 -0
  97. package/dist/components/Toast/Toast.context.js +11 -0
  98. package/dist/components/Toast/Toast.d.ts +4 -3
  99. package/dist/components/Toast/Toast.icons.cjs +1 -0
  100. package/dist/components/Toast/Toast.icons.d.ts +4 -0
  101. package/dist/components/Toast/Toast.icons.js +29 -0
  102. package/dist/components/Toast/Toast.js +32 -160
  103. package/dist/components/Toast/ToastContainer.cjs +1 -0
  104. package/dist/components/Toast/ToastContainer.d.ts +3 -0
  105. package/dist/components/Toast/ToastContainer.js +39 -0
  106. package/dist/components/Toast/ToastItem.cjs +1 -0
  107. package/dist/components/Toast/ToastItem.d.ts +5 -0
  108. package/dist/components/Toast/ToastItem.js +86 -0
  109. package/dist/components/ToggleGroup/ToggleGroup.cjs +1 -0
  110. package/dist/components/ToggleGroup/ToggleGroup.const.cjs +1 -0
  111. package/dist/components/ToggleGroup/ToggleGroup.const.d.ts +15 -0
  112. package/dist/components/ToggleGroup/ToggleGroup.const.js +33 -0
  113. package/dist/components/ToggleGroup/ToggleGroup.context.cjs +1 -0
  114. package/dist/components/ToggleGroup/ToggleGroup.context.d.ts +2 -0
  115. package/dist/components/ToggleGroup/ToggleGroup.context.js +5 -0
  116. package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
  117. package/dist/components/ToggleGroup/ToggleGroup.js +89 -0
  118. package/dist/components/ToggleGroup/ToggleGroup.types.d.ts +48 -0
  119. package/dist/components/ToggleGroup/ToggleGroupItem.cjs +1 -0
  120. package/dist/components/ToggleGroup/ToggleGroupItem.d.ts +2 -0
  121. package/dist/components/ToggleGroup/ToggleGroupItem.js +50 -0
  122. package/dist/components/ToggleGroup/hooks/useToggleGroupContext.cjs +1 -0
  123. package/dist/components/ToggleGroup/hooks/useToggleGroupContext.d.ts +1 -0
  124. package/dist/components/ToggleGroup/hooks/useToggleGroupContext.js +6 -0
  125. package/dist/components/ToggleGroup/index.d.ts +4 -0
  126. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  127. package/dist/components/Tooltip/Tooltip.const.cjs +1 -0
  128. package/dist/components/Tooltip/Tooltip.const.d.ts +8 -0
  129. package/dist/components/Tooltip/Tooltip.const.js +13 -0
  130. package/dist/components/Tooltip/Tooltip.js +59 -61
  131. package/dist/components/Tooltip/Tooltip.types.d.ts +7 -0
  132. package/dist/components/Transition/Transition.cjs +1 -1
  133. package/dist/components/Transition/Transition.const.cjs +1 -1
  134. package/dist/components/Transition/Transition.const.js +26 -8
  135. package/dist/components/Transition/Transition.js +77 -74
  136. package/dist/components/Transition/Transition.types.d.ts +8 -2
  137. package/dist/components/Typography/Typography.const.cjs +1 -1
  138. package/dist/components/Typography/Typography.const.js +2 -1
  139. package/dist/components/index.cjs +1 -1
  140. package/dist/components/index.d.ts +3 -1
  141. package/dist/components/index.js +429 -419
  142. package/dist/constants/generals.const.cjs +1 -1
  143. package/dist/constants/generals.const.js +85 -86
  144. package/dist/constants/numbers.const.cjs +1 -1
  145. package/dist/constants/numbers.const.d.ts +3 -0
  146. package/dist/constants/numbers.const.js +37 -34
  147. package/dist/hooks/index.cjs +1 -1
  148. package/dist/hooks/index.d.ts +2 -0
  149. package/dist/hooks/index.js +6 -4
  150. package/dist/hooks/useFixedAnchorPosition/index.d.ts +1 -1
  151. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs +1 -1
  152. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.d.ts +3 -0
  153. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js +17 -14
  154. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.types.d.ts +1 -1
  155. package/dist/hooks/useFocusTrap/index.d.ts +2 -0
  156. package/dist/hooks/useFocusTrap/useFocusTrap.cjs +1 -0
  157. package/dist/hooks/useFocusTrap/useFocusTrap.d.ts +3 -0
  158. package/dist/hooks/useFocusTrap/useFocusTrap.js +41 -0
  159. package/dist/hooks/useFocusTrap/useFocusTrap.types.d.ts +8 -0
  160. package/dist/hooks/useFocusTrap/useFocusTrap.utils.cjs +1 -0
  161. package/dist/hooks/useFocusTrap/useFocusTrap.utils.d.ts +1 -0
  162. package/dist/hooks/useFocusTrap/useFocusTrap.utils.js +23 -0
  163. package/dist/index.cjs +1 -1
  164. package/dist/index.js +580 -568
  165. package/dist/styles/_alerts.css +85 -4
  166. package/dist/styles/_drawer.css +60 -0
  167. package/dist/styles/_effects.css +33 -0
  168. package/dist/styles.css +231 -4
  169. package/package.json +3 -5
@@ -1,128 +1,128 @@
1
- import { jsxs as s, Fragment as ge, jsx as t } from "react/jsx-runtime";
2
- import { useMemo as L, useCallback as m } from "react";
3
- import { ZERO as Be } from "../../constants/numbers.const.js";
4
- import { BOOLEAN_TRUE as Ee } from "../../constants/generals.const.js";
5
- import { cn as R } from "../../utils/cn.js";
6
- import { useBearStyles as De } from "../../hooks/useBearStyles.js";
1
+ import { jsxs as c, Fragment as we, jsx as a } from "react/jsx-runtime";
2
+ import { useMemo as A, useCallback as m } from "react";
3
+ import { ZERO as oe } from "../../constants/numbers.const.js";
4
+ import { BOOLEAN_TRUE as De } from "../../constants/generals.const.js";
5
+ import { cn as M } from "../../utils/cn.js";
6
+ import { useBearStyles as Oe } from "../../hooks/useBearStyles.js";
7
7
  import "../../hooks/useBearComponent/useBearComponent.js";
8
8
  import "../../context/BearProvider.js";
9
9
  import { OVERLAY_OPEN_EFFECT_NONE as l } from "../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js";
10
- import { resolveOverlayEffects as we } from "../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.js";
10
+ import { resolveOverlayEffects as Te } from "../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.js";
11
11
  import "../FormControl/FormControl.context.js";
12
- import { ChevronsLeftIcon as Oe, ChevronLeftIcon as Te, ChevronRightIcon as Pe, ChevronsRightIcon as Le } from "@forgedevstack/bear-icons";
13
- import { OVERLAY_EFFECT_TRANSITION as Y } from "../OverlayPortal/OverlayPortal.const.js";
14
- import { Transition as Re } from "../Transition/Transition.js";
15
- import { DEFAULT_DURATION as Ye } from "../Transition/Transition.const.js";
12
+ import { ChevronsLeftIcon as Pe, ChevronLeftIcon as Le, ChevronRightIcon as Re, ChevronsRightIcon as Ye } from "@forgedevstack/bear-icons";
13
+ import { OVERLAY_EFFECT_TRANSITION as S } from "../OverlayPortal/OverlayPortal.const.js";
14
+ import { Transition as ie } from "../Transition/Transition.js";
15
+ import { DEFAULT_DURATION as be } from "../Transition/Transition.const.js";
16
16
  import { DEFAULT_WEEKDAYS as Ae, NUMBER as d, CALENDAR_DROPDOWN_Z_INDEX as Me, MONTHS as Se, WEEKEND_LABELS as We } from "./Calendar.const.js";
17
17
  import { isSameDay as _, buildCalendarGrid as Fe, reorderWeekdays as Ie, isWeekendDay as je } from "./Calendar.utils.js";
18
18
  import { DefaultHeaderLabel as He } from "./Calendar.helpers.js";
19
- const sr = (A) => {
19
+ const cr = (W) => {
20
20
  const {
21
- viewDate: M,
22
- value: S = null,
21
+ viewDate: F,
22
+ value: I = null,
23
23
  onSelect: C,
24
24
  onViewChange: n,
25
25
  minDate: z,
26
26
  maxDate: g,
27
- disabledDates: W = [],
28
- highlightedDates: F = [],
29
- weekdayLabels: I = Ae,
30
- firstDayOfWeek: k = d.ZERO,
27
+ disabledDates: j = [],
28
+ highlightedDates: H = [],
29
+ weekdayLabels: U = Ae,
30
+ firstDayOfWeek: x = d.ZERO,
31
31
  showWeekNumbers: Ue = !1,
32
32
  slots: e = {},
33
- clearable: te = !0,
33
+ clearable: de = !0,
34
34
  onClear: h,
35
- showTodayButton: ne = !0,
35
+ showTodayButton: se = !0,
36
36
  onToday: u,
37
- bis: oe,
38
- style: ie,
39
- inline: j = !1,
40
- className: be,
41
- open: H
42
- } = A, { openEffect: y, closeEffect: v } = we(A), i = M.getFullYear(), U = De(oe, ie), b = M.getMonth(), de = L(() => /* @__PURE__ */ new Date(), []), B = m(() => {
37
+ bis: ce,
38
+ style: le,
39
+ inline: G = !1,
40
+ className: me,
41
+ open: Z
42
+ } = W, { openEffect: y, closeEffect: v } = Te(W), i = F.getFullYear(), K = Oe(ce, le), b = F.getMonth(), he = A(() => /* @__PURE__ */ new Date(), []), B = m(() => {
43
43
  n == null || n(new Date(i - d.ONE, b, d.ONE));
44
- }, [i, b, n]), G = m(() => {
44
+ }, [i, b, n]), X = m(() => {
45
45
  n == null || n(new Date(i, b - d.ONE, d.ONE));
46
- }, [i, b, n]), Z = m(() => {
46
+ }, [i, b, n]), q = m(() => {
47
47
  n == null || n(new Date(i, b + d.ONE, d.ONE));
48
48
  }, [i, b, n]), E = m(() => {
49
49
  n == null || n(new Date(i + d.ONE, b, d.ONE));
50
- }, [i, b, n]), D = G, w = Z, ce = {
50
+ }, [i, b, n]), w = X, D = q, ue = {
51
51
  onPrevYear: B,
52
- onPrevMonth: G,
53
- onNextMonth: Z,
52
+ onPrevMonth: X,
53
+ onNextMonth: q,
54
54
  onNextYear: E
55
- }, se = m(
56
- (a) => z && a < z || g && a > g ? !0 : W.some((r) => _(r, a)),
57
- [z, g, W]
58
- ), le = m(
59
- (a) => F.some((r) => _(r, a)),
60
- [F]
61
- ), me = L(
62
- () => Fe(i, b, k),
63
- [i, b, k]
64
- ), K = L(
65
- () => Ie(I, k),
66
- [I, k]
67
- ), X = Se[b], O = S != null, he = j ? "Bear-Calendar Bear-Calendar--inline bear-block bear-w-full bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-none bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-p-4 bear-text-zinc-900 dark:bear-text-zinc-100" : "Bear-Calendar Bear-Calendar--dropdown bear-mt-2 bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-xl bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-p-4 bear-w-80 bear-text-zinc-900 dark:bear-text-zinc-100", q = j ? void 0 : { zIndex: Me }, ue = () => {
55
+ }, ye = m(
56
+ (t) => z && t < z || g && t > g ? !0 : j.some((r) => _(r, t)),
57
+ [z, g, j]
58
+ ), ve = m(
59
+ (t) => H.some((r) => _(r, t)),
60
+ [H]
61
+ ), pe = A(
62
+ () => Fe(i, b, x),
63
+ [i, b, x]
64
+ ), J = A(
65
+ () => Ie(U, x),
66
+ [U, x]
67
+ ), Q = Se[b], O = I != null, ke = G ? "Bear-Calendar Bear-Calendar--inline bear-block bear-w-full bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-none bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-p-4 bear-text-zinc-900 dark:bear-text-zinc-100" : "Bear-Calendar Bear-Calendar--dropdown bear-mt-2 bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-xl bear-border bear-border-zinc-200 dark:bear-border-zinc-700 bear-p-4 bear-w-80 bear-text-zinc-900 dark:bear-text-zinc-100", $ = G ? void 0 : { zIndex: Me }, xe = () => {
68
68
  if (e.header)
69
- return e.header({ month: X, year: i, onPrev: D, onNext: w, nav: ce });
70
- const a = e.navPrevYear, r = e.navPrev, o = e.navNext, c = e.navNextYear, f = e.headerLabel || He;
71
- return /* @__PURE__ */ s("div", { className: "Bear-Calendar__header bear-flex bear-items-center bear-justify-between bear-gap-1 bear-mb-4", children: [
72
- /* @__PURE__ */ s("div", { className: "Bear-Calendar__nav-left bear-flex bear-items-center bear-gap-0.5", children: [
73
- a ? a({ onClick: B }) : /* @__PURE__ */ t(
69
+ return e.header({ month: Q, year: i, onPrev: w, onNext: D, nav: ue });
70
+ const t = e.navPrevYear, r = e.navPrev, o = e.navNext, s = e.navNextYear, f = e.headerLabel || He;
71
+ return /* @__PURE__ */ c("div", { className: "Bear-Calendar__header bear-flex bear-items-center bear-justify-between bear-gap-1 bear-mb-4", children: [
72
+ /* @__PURE__ */ c("div", { className: "Bear-Calendar__nav-left bear-flex bear-items-center bear-gap-0.5", children: [
73
+ t ? t({ onClick: B }) : /* @__PURE__ */ a(
74
74
  "button",
75
75
  {
76
76
  type: "button",
77
77
  onClick: B,
78
78
  className: "Bear-Calendar__nav-btn bear-p-1.5 bear-rounded bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 bear-transition-colors",
79
79
  "aria-label": "Previous year",
80
- children: /* @__PURE__ */ t(Oe, { size: 16 })
80
+ children: /* @__PURE__ */ a(Pe, { size: 16 })
81
81
  }
82
82
  ),
83
- r ? r({ onClick: D }) : /* @__PURE__ */ t(
83
+ r ? r({ onClick: w }) : /* @__PURE__ */ a(
84
84
  "button",
85
85
  {
86
86
  type: "button",
87
- onClick: D,
87
+ onClick: w,
88
88
  className: "Bear-Calendar__nav-btn bear-p-1.5 bear-rounded bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 bear-transition-colors",
89
89
  "aria-label": "Previous month",
90
- children: /* @__PURE__ */ t(Te, { size: 16 })
90
+ children: /* @__PURE__ */ a(Le, { size: 16 })
91
91
  }
92
92
  )
93
93
  ] }),
94
- f({ month: X, year: i }),
95
- /* @__PURE__ */ s("div", { className: "Bear-Calendar__nav-right bear-flex bear-items-center bear-gap-0.5", children: [
96
- o ? o({ onClick: w }) : /* @__PURE__ */ t(
94
+ f({ month: Q, year: i }),
95
+ /* @__PURE__ */ c("div", { className: "Bear-Calendar__nav-right bear-flex bear-items-center bear-gap-0.5", children: [
96
+ o ? o({ onClick: D }) : /* @__PURE__ */ a(
97
97
  "button",
98
98
  {
99
99
  type: "button",
100
- onClick: w,
100
+ onClick: D,
101
101
  className: "Bear-Calendar__nav-btn bear-p-1.5 bear-rounded bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 bear-transition-colors",
102
102
  "aria-label": "Next month",
103
- children: /* @__PURE__ */ t(Pe, { size: 16 })
103
+ children: /* @__PURE__ */ a(Re, { size: 16 })
104
104
  }
105
105
  ),
106
- c ? c({ onClick: E }) : /* @__PURE__ */ t(
106
+ s ? s({ onClick: E }) : /* @__PURE__ */ a(
107
107
  "button",
108
108
  {
109
109
  type: "button",
110
110
  onClick: E,
111
111
  className: "Bear-Calendar__nav-btn bear-p-1.5 bear-rounded bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800 bear-transition-colors",
112
112
  "aria-label": "Next year",
113
- children: /* @__PURE__ */ t(Le, { size: 16 })
113
+ children: /* @__PURE__ */ a(Ye, { size: 16 })
114
114
  }
115
115
  )
116
116
  ] })
117
117
  ] });
118
- }, ye = () => {
119
- if (e.weekdays) return e.weekdays({ days: K });
120
- const a = e.weekday;
121
- return /* @__PURE__ */ t("div", { className: "Bear-Calendar__weekdays bear-grid bear-grid-cols-7 bear-gap-1 bear-mb-2", children: K.map(
122
- (r) => a ? /* @__PURE__ */ t("div", { children: a({ label: r }) }, r) : /* @__PURE__ */ t(
118
+ }, fe = () => {
119
+ if (e.weekdays) return e.weekdays({ days: J });
120
+ const t = e.weekday;
121
+ return /* @__PURE__ */ a("div", { className: "Bear-Calendar__weekdays bear-grid bear-grid-cols-7 bear-gap-1 bear-mb-2", children: J.map(
122
+ (r) => t ? /* @__PURE__ */ a("div", { children: t({ label: r }) }, r) : /* @__PURE__ */ a(
123
123
  "div",
124
124
  {
125
- className: R(
125
+ className: M(
126
126
  "Bear-Calendar__weekday bear-text-center bear-text-xs bear-font-medium bear-uppercase bear-text-zinc-500 dark:bear-text-zinc-400",
127
127
  We.includes(r) && "bear-text-red-500"
128
128
  ),
@@ -131,78 +131,88 @@ const sr = (A) => {
131
131
  r
132
132
  )
133
133
  ) });
134
- }, ve = (a, r) => {
135
- const { date: o, isCurrentMonth: c } = a, f = o.getDate(), _e = o.getDay(), Ce = je(_e), p = _(S, o), P = _(de, o), N = se(o), re = le(o), ae = () => {
134
+ }, Ne = (t, r) => {
135
+ const { date: o, isCurrentMonth: s } = t, f = o.getDate(), ge = o.getDay(), Be = je(ge), k = _(I, o), Y = _(he, o), N = ye(o), te = ve(o), ne = () => {
136
136
  N || C == null || C(o);
137
- }, ze = {
137
+ }, Ee = {
138
138
  date: o,
139
139
  day: f,
140
- isCurrentMonth: c,
141
- isSelected: p,
142
- isToday: P,
140
+ isCurrentMonth: s,
141
+ isSelected: k,
142
+ isToday: Y,
143
143
  isDisabled: N,
144
- isHighlighted: re,
145
- onClick: ae
144
+ isHighlighted: te,
145
+ onClick: ne
146
146
  };
147
- return e.day ? /* @__PURE__ */ t("span", { children: e.day(ze) }, r) : /* @__PURE__ */ t(
147
+ return e.day ? /* @__PURE__ */ a("span", { children: e.day(Ee) }, r) : /* @__PURE__ */ a(
148
148
  "button",
149
149
  {
150
150
  type: "button",
151
- onClick: ae,
151
+ onClick: ne,
152
152
  disabled: N,
153
- className: R(
153
+ className: M(
154
154
  "Bear-Calendar__day bear-w-8 bear-h-8 bear-rounded-full bear-text-sm bear-font-medium bear-transition-colors bear-flex bear-items-center bear-justify-center",
155
- p && "Bear-Calendar__day--selected bear-bg-primary-500 bear-text-white hover:bear-bg-primary-600",
156
- !p && P && "Bear-Calendar__day--today bear-ring-2 bear-ring-primary-500/50 bear-bg-transparent",
157
- !p && !P && (c ? Ce ? "Bear-Calendar__day--weekend bear-text-red-500 dark:bear-text-red-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800" : "bear-text-zinc-700 dark:bear-text-zinc-300 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800" : "Bear-Calendar__day--other bear-text-zinc-500 dark:bear-text-zinc-600 hover:bear-bg-zinc-50 dark:hover:bear-bg-zinc-800/50"),
158
- re && !p && "Bear-Calendar__day--highlighted bear-bg-primary-500/15",
155
+ k && "Bear-Calendar__day--selected bear-bg-primary-500 bear-text-white hover:bear-bg-primary-600",
156
+ !k && Y && "Bear-Calendar__day--today bear-ring-2 bear-ring-primary-500/50 bear-bg-transparent",
157
+ !k && !Y && (s ? Be ? "Bear-Calendar__day--weekend bear-text-red-500 dark:bear-text-red-400 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800" : "bear-text-zinc-700 dark:bear-text-zinc-300 hover:bear-bg-zinc-100 dark:hover:bear-bg-zinc-800" : "Bear-Calendar__day--other bear-text-zinc-500 dark:bear-text-zinc-600 hover:bear-bg-zinc-50 dark:hover:bear-bg-zinc-800/50"),
158
+ te && !k && "Bear-Calendar__day--highlighted bear-bg-primary-500/15",
159
159
  N && "Bear-Calendar__day--disabled bear-opacity-40 bear-cursor-not-allowed"
160
160
  ),
161
161
  children: f
162
162
  },
163
163
  r
164
164
  );
165
- }, pe = () => {
166
- const a = me.map((r, o) => ve(r, o));
167
- return e.daysGrid ? e.daysGrid({ children: a, className: "Bear-Calendar__grid bear-grid bear-grid-cols-7 bear-gap-1" }) : /* @__PURE__ */ t("div", { className: "Bear-Calendar__grid bear-grid bear-grid-cols-7 bear-gap-1", children: a });
168
- }, ke = () => {
169
- const a = te && O && h, r = ne && u;
170
- if (!a && !r) return null;
165
+ }, _e = () => {
166
+ const t = pe.map((r, o) => Ne(r, o));
167
+ return e.daysGrid ? e.daysGrid({ children: t, className: "Bear-Calendar__grid bear-grid bear-grid-cols-7 bear-gap-1" }) : /* @__PURE__ */ a("div", { className: "Bear-Calendar__grid bear-grid bear-grid-cols-7 bear-gap-1", children: t });
168
+ }, Ce = () => {
169
+ const t = de && O && h, r = se && u;
170
+ if (!t && !r) return null;
171
171
  if (e.footer) {
172
- const o = e.clearButton, c = e.todayButton;
172
+ const o = e.clearButton, s = e.todayButton;
173
173
  return e.footer({
174
- children: /* @__PURE__ */ s("div", { className: "Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700", children: [
175
- a && o ? o({ onClick: h, hasSelection: O }) : a ? /* @__PURE__ */ t("button", { type: "button", onClick: h, className: "Bear-Calendar__clear-btn bear-text-sm bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-text-zinc-700 dark:hover:bear-text-zinc-200 bear-transition-colors", children: "Clear" }) : /* @__PURE__ */ t("span", {}),
176
- r && c ? c({ onClick: u }) : r ? /* @__PURE__ */ t("button", { type: "button", onClick: u, className: "Bear-Calendar__today-btn bear-text-sm bear-text-primary-600 dark:bear-text-primary-400 hover:bear-text-primary-700 dark:hover:bear-text-primary-300 bear-font-medium", children: "Today" }) : null
174
+ children: /* @__PURE__ */ c("div", { className: "Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700", children: [
175
+ t && o ? o({ onClick: h, hasSelection: O }) : t ? /* @__PURE__ */ a("button", { type: "button", onClick: h, className: "Bear-Calendar__clear-btn bear-text-sm bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-text-zinc-700 dark:hover:bear-text-zinc-200 bear-transition-colors", children: "Clear" }) : /* @__PURE__ */ a("span", {}),
176
+ r && s ? s({ onClick: u }) : r ? /* @__PURE__ */ a("button", { type: "button", onClick: u, className: "Bear-Calendar__today-btn bear-text-sm bear-text-primary-600 dark:bear-text-primary-400 hover:bear-text-primary-700 dark:hover:bear-text-primary-300 bear-font-medium", children: "Today" }) : null
177
177
  ] })
178
178
  });
179
179
  }
180
- return e.clearButton && e.todayButton ? /* @__PURE__ */ s("div", { className: "Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700", children: [
181
- a && e.clearButton({ onClick: h, hasSelection: O }),
180
+ return e.clearButton && e.todayButton ? /* @__PURE__ */ c("div", { className: "Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700", children: [
181
+ t && e.clearButton({ onClick: h, hasSelection: O }),
182
182
  r && e.todayButton({ onClick: u })
183
- ] }) : /* @__PURE__ */ s("div", { className: "Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700", children: [
184
- a ? /* @__PURE__ */ t("button", { type: "button", onClick: h, className: "Bear-Calendar__clear-btn bear-text-sm bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-text-zinc-700 dark:hover:bear-text-zinc-200 bear-transition-colors", children: "Clear" }) : /* @__PURE__ */ t("span", {}),
185
- r ? /* @__PURE__ */ t("button", { type: "button", onClick: u, className: "Bear-Calendar__today-btn bear-text-sm bear-text-primary-400 hover:bear-text-primary-300 bear-font-medium bear-transition-colors", children: "Today" }) : null
183
+ ] }) : /* @__PURE__ */ c("div", { className: "Bear-Calendar__footer bear-flex bear-justify-between bear-gap-2 bear-mt-4 bear-pt-3 bear-border-t bear-border-zinc-200 dark:bear-border-zinc-700", children: [
184
+ t ? /* @__PURE__ */ a("button", { type: "button", onClick: h, className: "Bear-Calendar__clear-btn bear-text-sm bear-text-zinc-500 dark:bear-text-zinc-400 hover:bear-text-zinc-700 dark:hover:bear-text-zinc-200 bear-transition-colors", children: "Clear" }) : /* @__PURE__ */ a("span", {}),
185
+ r ? /* @__PURE__ */ a("button", { type: "button", onClick: u, className: "Bear-Calendar__today-btn bear-text-sm bear-text-primary-400 hover:bear-text-primary-300 bear-font-medium bear-transition-colors", children: "Today" }) : null
186
186
  ] });
187
- }, J = /* @__PURE__ */ s(ge, { children: [
188
- ue(),
189
- ye(),
190
- pe(),
191
- ke()
192
- ] }), Q = R(he, be), $ = Object.keys(U).length ? U : void 0, xe = q ? { ...$, ...q } : $, T = e.root ? e.root({ children: J, className: Q }) : /* @__PURE__ */ t("div", { className: Q, style: xe, children: J }), fe = H !== void 0, x = H ?? Ee;
193
- if (!(fe && (y !== l || v !== l)))
194
- return T;
195
- const V = x ? y : v, ee = V === l ? y === l ? v === l ? void 0 : Y[v] : Y[y] : Y[V], Ne = x && y === l || !x && v === l;
196
- return ee ? /* @__PURE__ */ t(
197
- Re,
187
+ }, T = /* @__PURE__ */ c(we, { children: [
188
+ xe(),
189
+ fe(),
190
+ _e(),
191
+ Ce()
192
+ ] }), P = M(ke, me), V = Object.keys(K).length ? K : void 0, ee = $ ? { ...V, ...$ } : V, L = e.root ? e.root({ children: T, className: P }) : /* @__PURE__ */ a("div", { className: P, style: ee, children: T }), ze = Z !== void 0, p = Z ?? De;
193
+ if (!(ze && (y !== l || v !== l)))
194
+ return L;
195
+ const re = p ? y : v, R = re === l ? y === l ? v === l ? void 0 : S[v] : S[y] : S[re], ae = p && y === l || !p && v === l;
196
+ return R ? e.root ? /* @__PURE__ */ a(
197
+ ie,
198
+ {
199
+ show: p,
200
+ name: R,
201
+ duration: ae ? oe : be,
202
+ children: L
203
+ }
204
+ ) : /* @__PURE__ */ a(
205
+ ie,
198
206
  {
199
- show: x,
200
- name: ee,
201
- duration: Ne ? Be : Ye,
207
+ show: p,
208
+ name: R,
209
+ duration: ae ? oe : be,
210
+ className: P,
211
+ style: ee,
202
212
  children: T
203
213
  }
204
- ) : T;
214
+ ) : L;
205
215
  };
206
216
  export {
207
- sr as Calendar
217
+ cr as Calendar
208
218
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../constants/numbers.const.cjs"),p=require("../../utils/cn.cjs");require("react");const V=require("../../utils/generateBearId.utils.cjs"),w=require("../../utils/useBearId.cjs"),c=require("./Chart.const.cjs"),x=require("./Chart.utils.cjs"),z=g=>{const{data:i,height:m=c.CHART.DEFAULT_HEIGHT,showLabels:h=!0,showValues:v=!1,animated:R=!0,color:$,orientation:b="vertical",barRadius:r=c.CHART.DEFAULT_BAR_RADIUS,barGap:A=c.CHART.DEFAULT_BAR_GAP,stacked:l=!1,className:E,id:N,testId:j,...T}=g,O=w.useBearId("BarChart"),k=V.resolveBearId(N,O),d=i.map(a=>x.getStackTotal(a.stacks,a.value)),q=Math.max(...d,s.ONE),t=b==="vertical",y={"--Bear-Chart-height":`${m}px`,"--Bear-Chart-gap":`${A}rem`};return e.jsx("div",{id:k,"data-testid":j,className:p.cn("Bear-Chart Bear-Chart--bar",t?"Bear-Chart--vertical":"Bear-Chart--horizontal",E),style:y,...T,children:e.jsx("div",{className:"Bear-Chart__track",children:i.map((a,u)=>{const C=l&&a.stacks&&a.stacks.length>s.ZERO?a.stacks:[a.value],o=d[u],I={"--Bear-Chart-size":`${o/q*c.CHART.VIEWBOX}%`};return e.jsxs("div",{className:"Bear-Chart__col",children:[h&&!t&&e.jsx("span",{className:"Bear-Chart__label",children:a.label}),e.jsx("div",{className:"Bear-Chart__plot",children:e.jsx("div",{className:p.cn("Bear-Chart__stack",R&&(t?"animate-grow-up":"animate-grow-right")),style:I,children:C.map((H,n)=>{const S=o>s.ZERO?H/o*c.CHART.VIEWBOX:s.ZERO,L=n===s.ZERO,B=n===C.length-s.ONE,_=l?t?B?`${r}px ${r}px 0 0`:"0":B?`0 ${r}px ${r}px 0`:"0":t?`${r}px ${r}px 0 0`:`0 ${r}px ${r}px 0`,P={"--Bear-Chart-segment":`${S}%`,"--Bear-Chart-color":x.getChartColor(l?n:u,a.color||$),"--Bear-Chart-radius":_};return e.jsx("div",{className:"Bear-Chart__segment",style:P},`${a.label}-${n}`)})})}),v&&e.jsx("span",{className:"Bear-Chart__value",children:o}),h&&t&&e.jsx("span",{className:"Bear-Chart__label",children:a.label})]},a.label)})})})};exports.BarChart=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../constants/numbers.const.cjs"),m=require("../../utils/cn.cjs");require("react");const w=require("../../utils/generateBearId.utils.cjs"),z=require("../../utils/useBearId.cjs"),c=require("./Chart.const.cjs"),i=require("./Chart.utils.cjs"),D=x=>{const{data:h,height:g=c.CHART.DEFAULT_HEIGHT,showLabels:d=!0,showValues:v=!1,animated:R=!0,motion:$,color:b,orientation:A="vertical",barRadius:r=c.CHART.DEFAULT_BAR_RADIUS,barGap:E=c.CHART.DEFAULT_BAR_GAP,stacked:l=!1,className:N,id:j,testId:T,...O}=x,k=z.useBearId("BarChart"),q=w.resolveBearId(j,k),u=h.map(a=>i.getStackTotal(a.stacks,a.value)),y=Math.max(...u,s.ONE),t=A==="vertical",I={"--Bear-Chart-height":`${g}px`,"--Bear-Chart-gap":`${E}rem`};return e.jsx("div",{id:q,"data-testid":T,className:m.cn("Bear-Chart Bear-Chart--bar",t?"Bear-Chart--vertical":"Bear-Chart--horizontal",N),style:I,...O,children:e.jsx("div",{className:"Bear-Chart__track",children:h.map((a,C)=>{const B=l&&a.stacks&&a.stacks.length>s.ZERO?a.stacks:[a.value],o=u[C],H={"--Bear-Chart-size":`${o/y*c.CHART.VIEWBOX}%`};return e.jsxs("div",{className:"Bear-Chart__col",children:[d&&!t&&e.jsx("span",{className:"Bear-Chart__label",children:a.label}),e.jsx("div",{className:"Bear-Chart__plot",children:e.jsx("div",{className:m.cn("Bear-Chart__stack",i.chartMotionClass(R,$,t?"animate-grow-up":"animate-grow-right")),style:H,children:B.map((S,n)=>{const L=o>s.ZERO?S/o*c.CHART.VIEWBOX:s.ZERO,P=n===s.ZERO,_=n===B.length-s.ONE,p=l?t?_?`${r}px ${r}px 0 0`:"0":_?`0 ${r}px ${r}px 0`:"0":t?`${r}px ${r}px 0 0`:`0 ${r}px ${r}px 0`,V={"--Bear-Chart-segment":`${L}%`,"--Bear-Chart-color":i.getChartColor(l?n:C,a.color||b),"--Bear-Chart-radius":p};return e.jsx("div",{className:"Bear-Chart__segment",style:V},`${a.label}-${n}`)})})}),v&&e.jsx("span",{className:"Bear-Chart__value",children:o}),d&&t&&e.jsx("span",{className:"Bear-Chart__label",children:a.label})]},a.label)})})})};exports.BarChart=D;
@@ -1,65 +1,66 @@
1
- import { jsx as t, jsxs as F } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as O } from "react/jsx-runtime";
2
2
  import { ONE as _, ZERO as h } from "../../constants/numbers.const.js";
3
3
  import { cn as u } from "../../utils/cn.js";
4
4
  import "react";
5
- import { resolveBearId as O } from "../../utils/generateBearId.utils.js";
6
- import { useBearId as P } from "../../utils/useBearId.js";
7
- import { CHART as s } from "./Chart.const.js";
8
- import { getStackTotal as U, getChartColor as G } from "./Chart.utils.js";
9
- const Q = ($) => {
5
+ import { resolveBearId as P } from "../../utils/generateBearId.utils.js";
6
+ import { useBearId as U } from "../../utils/useBearId.js";
7
+ import { CHART as e } from "./Chart.const.js";
8
+ import { getStackTotal as G, getChartColor as H, chartMotionClass as j } from "./Chart.utils.js";
9
+ const aa = ($) => {
10
10
  const {
11
11
  data: n,
12
- height: g = s.DEFAULT_HEIGHT,
12
+ height: g = e.DEFAULT_HEIGHT,
13
13
  showLabels: i = !0,
14
14
  showValues: v = !1,
15
15
  animated: N = !0,
16
- color: b,
17
- orientation: x = "vertical",
18
- barRadius: r = s.DEFAULT_BAR_RADIUS,
19
- barGap: f = s.DEFAULT_BAR_GAP,
16
+ motion: b,
17
+ color: x,
18
+ orientation: f = "vertical",
19
+ barRadius: r = e.DEFAULT_BAR_RADIUS,
20
+ barGap: k = e.DEFAULT_BAR_GAP,
20
21
  stacked: l = !1,
21
- className: k,
22
- id: A,
23
- testId: E,
24
- ...y
25
- } = $, I = P("BarChart"), R = O(A, I), m = n.map((a) => U(a.stacks, a.value)), T = Math.max(...m, _), e = x === "vertical", L = {
22
+ className: A,
23
+ id: E,
24
+ testId: y,
25
+ ...I
26
+ } = $, R = U("BarChart"), T = P(E, R), m = n.map((a) => G(a.stacks, a.value)), L = Math.max(...m, _), s = f === "vertical", S = {
26
27
  "--Bear-Chart-height": `${g}px`,
27
- "--Bear-Chart-gap": `${f}rem`
28
+ "--Bear-Chart-gap": `${k}rem`
28
29
  };
29
30
  return /* @__PURE__ */ t(
30
31
  "div",
31
32
  {
32
- id: R,
33
- "data-testid": E,
33
+ id: T,
34
+ "data-testid": y,
34
35
  className: u(
35
36
  "Bear-Chart Bear-Chart--bar",
36
- e ? "Bear-Chart--vertical" : "Bear-Chart--horizontal",
37
- k
37
+ s ? "Bear-Chart--vertical" : "Bear-Chart--horizontal",
38
+ A
38
39
  ),
39
- style: L,
40
- ...y,
40
+ style: S,
41
+ ...I,
41
42
  children: /* @__PURE__ */ t("div", { className: "Bear-Chart__track", children: n.map((a, p) => {
42
- const d = l && a.stacks && a.stacks.length > h ? a.stacks : [a.value], o = m[p], S = {
43
- "--Bear-Chart-size": `${o / T * s.VIEWBOX}%`
43
+ const d = l && a.stacks && a.stacks.length > h ? a.stacks : [a.value], o = m[p], V = {
44
+ "--Bear-Chart-size": `${o / L * e.VIEWBOX}%`
44
45
  };
45
- return /* @__PURE__ */ F("div", { className: "Bear-Chart__col", children: [
46
- i && !e && /* @__PURE__ */ t("span", { className: "Bear-Chart__label", children: a.label }),
46
+ return /* @__PURE__ */ O("div", { className: "Bear-Chart__col", children: [
47
+ i && !s && /* @__PURE__ */ t("span", { className: "Bear-Chart__label", children: a.label }),
47
48
  /* @__PURE__ */ t("div", { className: "Bear-Chart__plot", children: /* @__PURE__ */ t(
48
49
  "div",
49
50
  {
50
- className: u("Bear-Chart__stack", N && (e ? "animate-grow-up" : "animate-grow-right")),
51
- style: S,
52
- children: d.map((V, c) => {
53
- const w = o > h ? V / o * s.VIEWBOX : h, z = c === h, B = c === d.length - _, C = l ? e ? B ? `${r}px ${r}px 0 0` : "0" : B ? `0 ${r}px ${r}px 0` : "0" : e ? `${r}px ${r}px 0 0` : `0 ${r}px ${r}px 0`, D = {
54
- "--Bear-Chart-segment": `${w}%`,
55
- "--Bear-Chart-color": G(l ? c : p, a.color || b),
51
+ className: u("Bear-Chart__stack", j(N, b, s ? "animate-grow-up" : "animate-grow-right")),
52
+ style: V,
53
+ children: d.map((w, c) => {
54
+ const z = o > h ? w / o * e.VIEWBOX : h, D = c === h, B = c === d.length - _, C = l ? s ? B ? `${r}px ${r}px 0 0` : "0" : B ? `0 ${r}px ${r}px 0` : "0" : s ? `${r}px ${r}px 0 0` : `0 ${r}px ${r}px 0`, F = {
55
+ "--Bear-Chart-segment": `${z}%`,
56
+ "--Bear-Chart-color": H(l ? c : p, a.color || x),
56
57
  "--Bear-Chart-radius": C
57
58
  };
58
59
  return /* @__PURE__ */ t(
59
60
  "div",
60
61
  {
61
62
  className: "Bear-Chart__segment",
62
- style: D
63
+ style: F
63
64
  },
64
65
  `${a.label}-${c}`
65
66
  );
@@ -67,12 +68,12 @@ const Q = ($) => {
67
68
  }
68
69
  ) }),
69
70
  v && /* @__PURE__ */ t("span", { className: "Bear-Chart__value", children: o }),
70
- i && e && /* @__PURE__ */ t("span", { className: "Bear-Chart__label", children: a.label })
71
+ i && s && /* @__PURE__ */ t("span", { className: "Bear-Chart__label", children: a.label })
71
72
  ] }, a.label);
72
73
  }) })
73
74
  }
74
75
  );
75
76
  };
76
77
  export {
77
- Q as BarChart
78
+ aa as BarChart
78
79
  };
@@ -2,6 +2,7 @@ import { HTMLAttributes, ReactNode } from 'react';
2
2
  export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'funnel' | 'stacked';
3
3
  export type PieView = 'full' | 'half' | 'rose';
4
4
  export type ChartLegendPosition = 'right' | 'bottom' | 'none';
5
+ export type ChartMotion = 'grow' | 'fade' | 'scale' | 'none';
5
6
  export interface ChartDataPoint {
6
7
  label: string;
7
8
  value: number;
@@ -16,6 +17,7 @@ export interface ChartProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childr
16
17
  showLabels?: boolean;
17
18
  showValues?: boolean;
18
19
  animated?: boolean;
20
+ motion?: ChartMotion;
19
21
  color?: string;
20
22
  showGrid?: boolean;
21
23
  pieView?: PieView;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../../constants/numbers.const.cjs"),a=require("./Chart.const.cjs"),x=(r,c)=>c||a.DEFAULT_COLORS[r%a.DEFAULT_COLORS.length],o=(r,c,$=a.CHART.CENTER)=>{const t=r*Math.PI/a.CHART.HALF_SWEEP;return{x:$+c*Math.cos(t),y:$+c*Math.sin(t)}},T=(r,c)=>{const $=r*Math.PI/a.CHART.HALF_SWEEP;return{x:c*Math.cos($),y:c*Math.sin($)}},A=(r,c,$=E.ZERO,t=a.CHART.OUTER_RADIUS)=>{const e=$*t,n=o(r,t),R=o(c,t),O=o(r,e),s=o(c,e),C=c-r>a.CHART.LARGE_ARC_THRESHOLD?E.ONE:E.ZERO;return $>E.ZERO?`M ${n.x},${n.y} A ${t},${t} 0 ${C},1 ${R.x},${R.y} L ${s.x},${s.y} A ${e},${e} 0 ${C},0 ${O.x},${O.y} Z`:`M ${a.CHART.CENTER},${a.CHART.CENTER} L ${n.x},${n.y} A ${t},${t} 0 ${C},1 ${R.x},${R.y} Z`},l=(r,c=!0,$=!1)=>r.length===E.ZERO?"":$?r.reduce((t,e,n,R)=>{if(n===E.ZERO)return`M ${e.x},${e.y}`;const O=R[n-E.ONE];return`${t} L ${e.x},${O.y} L ${e.x},${e.y}`},""):c?r.reduce((t,e,n,R)=>{if(n===E.ZERO)return`M ${e.x},${e.y}`;const O=R[n-E.ONE],s=O.x+(e.x-O.x)/a.CHART.BEZIER_DIVISOR,C=e.x-(e.x-O.x)/a.CHART.BEZIER_DIVISOR;return`${t} C ${s},${O.y} ${C},${e.y} ${e.x},${e.y}`},""):r.reduce((t,e,n)=>`${t} ${n===E.ZERO?"M":"L"} ${e.x},${e.y}`,""),u=r=>{const c=Math.max(...r.map(n=>n.value)),$=Math.min(...r.map(n=>n.value)),t=c-$||E.ONE,e=r.length-E.ONE||E.ONE;return r.map((n,R)=>({x:R/e*a.CHART.VIEWBOX,y:a.CHART.VIEWBOX-(n.value-$)/t*a.CHART.LINE_Y_RANGE-a.CHART.LINE_Y_PAD}))},h=(r,c)=>!r||r.length===E.ZERO?c:r.reduce(($,t)=>$+t,E.ZERO);exports.calculateLinePoints=u;exports.createArcPath=A;exports.generateLinePath=l;exports.getChartColor=x;exports.getStackTotal=h;exports.polarOffset=T;exports.polarToCartesian=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("../../constants/numbers.const.cjs"),E=require("./Chart.const.cjs"),l=(e,t,a)=>!e||t==="none"?"":t==="fade"?"animate-fade-in":t==="scale"?"animate-scale-in":a,x=(e,t)=>t||E.DEFAULT_COLORS[e%E.DEFAULT_COLORS.length],o=(e,t,a=E.CHART.CENTER)=>{const n=e*Math.PI/E.CHART.HALF_SWEEP;return{x:a+t*Math.cos(n),y:a+t*Math.sin(n)}},T=(e,t)=>{const a=e*Math.PI/E.CHART.HALF_SWEEP;return{x:t*Math.cos(a),y:t*Math.sin(a)}},u=(e,t,a=$.ZERO,n=E.CHART.OUTER_RADIUS)=>{const r=a*n,c=o(e,n),s=o(t,n),R=o(e,r),O=o(t,r),C=t-e>E.CHART.LARGE_ARC_THRESHOLD?$.ONE:$.ZERO;return a>$.ZERO?`M ${c.x},${c.y} A ${n},${n} 0 ${C},1 ${s.x},${s.y} L ${O.x},${O.y} A ${r},${r} 0 ${C},0 ${R.x},${R.y} Z`:`M ${E.CHART.CENTER},${E.CHART.CENTER} L ${c.x},${c.y} A ${n},${n} 0 ${C},1 ${s.x},${s.y} Z`},A=(e,t=!0,a=!1)=>e.length===$.ZERO?"":a?e.reduce((n,r,c,s)=>{if(c===$.ZERO)return`M ${r.x},${r.y}`;const R=s[c-$.ONE];return`${n} L ${r.x},${R.y} L ${r.x},${r.y}`},""):t?e.reduce((n,r,c,s)=>{if(c===$.ZERO)return`M ${r.x},${r.y}`;const R=s[c-$.ONE],O=R.x+(r.x-R.x)/E.CHART.BEZIER_DIVISOR,C=r.x-(r.x-R.x)/E.CHART.BEZIER_DIVISOR;return`${n} C ${O},${R.y} ${C},${r.y} ${r.x},${r.y}`},""):e.reduce((n,r,c)=>`${n} ${c===$.ZERO?"M":"L"} ${r.x},${r.y}`,""),h=e=>{const t=Math.max(...e.map(c=>c.value)),a=Math.min(...e.map(c=>c.value)),n=t-a||$.ONE,r=e.length-$.ONE||$.ONE;return e.map((c,s)=>({x:s/r*E.CHART.VIEWBOX,y:E.CHART.VIEWBOX-(c.value-a)/n*E.CHART.LINE_Y_RANGE-E.CHART.LINE_Y_PAD}))},y=(e,t)=>!e||e.length===$.ZERO?t:e.reduce((a,n)=>a+n,$.ZERO);exports.calculateLinePoints=h;exports.chartMotionClass=l;exports.createArcPath=u;exports.generateLinePath=A;exports.getChartColor=x;exports.getStackTotal=y;exports.polarOffset=T;exports.polarToCartesian=o;
@@ -1,3 +1,5 @@
1
+ import { ChartMotion } from './Chart.types';
2
+ export declare const chartMotionClass: (animated: boolean, motion: ChartMotion | undefined, fallback: string) => string;
1
3
  export declare const getChartColor: (index: number, customColor?: string) => string;
2
4
  export declare const polarToCartesian: (angle: number, radius: number, center?: number) => {
3
5
  x: number;
@@ -1,41 +1,42 @@
1
- import { ZERO as y, ONE as o } from "../../constants/numbers.const.js";
2
- import { DEFAULT_COLORS as L, CHART as x } from "./Chart.const.js";
3
- const M = ($, n) => n || L[$ % L.length], h = ($, n, c = x.CENTER) => {
4
- const e = $ * Math.PI / x.HALF_SWEEP;
1
+ import { ZERO as s, ONE as f } from "../../constants/numbers.const.js";
2
+ import { DEFAULT_COLORS as h, CHART as a } from "./Chart.const.js";
3
+ const L = (r, t, c) => !r || t === "none" ? "" : t === "fade" ? "animate-fade-in" : t === "scale" ? "animate-scale-in" : c, M = (r, t) => t || h[r % h.length], y = (r, t, c = a.CENTER) => {
4
+ const n = r * Math.PI / a.HALF_SWEEP;
5
5
  return {
6
- x: c + n * Math.cos(e),
7
- y: c + n * Math.sin(e)
6
+ x: c + t * Math.cos(n),
7
+ y: c + t * Math.sin(n)
8
8
  };
9
- }, f = ($, n) => {
10
- const c = $ * Math.PI / x.HALF_SWEEP;
9
+ }, _ = (r, t) => {
10
+ const c = r * Math.PI / a.HALF_SWEEP;
11
11
  return {
12
- x: n * Math.cos(c),
13
- y: n * Math.sin(c)
12
+ x: t * Math.cos(c),
13
+ y: t * Math.sin(c)
14
14
  };
15
- }, _ = ($, n, c = y, e = x.OUTER_RADIUS) => {
16
- const r = c * e, t = h($, e), E = h(n, e), a = h($, r), I = h(n, r), s = n - $ > x.LARGE_ARC_THRESHOLD ? o : y;
17
- return c > y ? `M ${t.x},${t.y} A ${e},${e} 0 ${s},1 ${E.x},${E.y} L ${I.x},${I.y} A ${r},${r} 0 ${s},0 ${a.x},${a.y} Z` : `M ${x.CENTER},${x.CENTER} L ${t.x},${t.y} A ${e},${e} 0 ${s},1 ${E.x},${E.y} Z`;
18
- }, m = ($, n = !0, c = !1) => $.length === y ? "" : c ? $.reduce((e, r, t, E) => {
19
- if (t === y) return `M ${r.x},${r.y}`;
20
- const a = E[t - o];
21
- return `${e} L ${r.x},${a.y} L ${r.x},${r.y}`;
22
- }, "") : n ? $.reduce((e, r, t, E) => {
23
- if (t === y) return `M ${r.x},${r.y}`;
24
- const a = E[t - o], I = a.x + (r.x - a.x) / x.BEZIER_DIVISOR, s = r.x - (r.x - a.x) / x.BEZIER_DIVISOR;
25
- return `${e} C ${I},${a.y} ${s},${r.y} ${r.x},${r.y}`;
26
- }, "") : $.reduce((e, r, t) => `${e} ${t === y ? "M" : "L"} ${r.x},${r.y}`, ""), O = ($) => {
27
- const n = Math.max(...$.map((t) => t.value)), c = Math.min(...$.map((t) => t.value)), e = n - c || o, r = $.length - o || o;
28
- return $.map((t, E) => ({
29
- x: E / r * x.VIEWBOX,
30
- y: x.VIEWBOX - (t.value - c) / e * x.LINE_Y_RANGE - x.LINE_Y_PAD
15
+ }, m = (r, t, c = s, n = a.OUTER_RADIUS) => {
16
+ const e = c * n, $ = y(r, n), x = y(t, n), E = y(r, e), u = y(t, e), l = t - r > a.LARGE_ARC_THRESHOLD ? f : s;
17
+ return c > s ? `M ${$.x},${$.y} A ${n},${n} 0 ${l},1 ${x.x},${x.y} L ${u.x},${u.y} A ${e},${e} 0 ${l},0 ${E.x},${E.y} Z` : `M ${a.CENTER},${a.CENTER} L ${$.x},${$.y} A ${n},${n} 0 ${l},1 ${x.x},${x.y} Z`;
18
+ }, C = (r, t = !0, c = !1) => r.length === s ? "" : c ? r.reduce((n, e, $, x) => {
19
+ if ($ === s) return `M ${e.x},${e.y}`;
20
+ const E = x[$ - f];
21
+ return `${n} L ${e.x},${E.y} L ${e.x},${e.y}`;
22
+ }, "") : t ? r.reduce((n, e, $, x) => {
23
+ if ($ === s) return `M ${e.x},${e.y}`;
24
+ const E = x[$ - f], u = E.x + (e.x - E.x) / a.BEZIER_DIVISOR, l = e.x - (e.x - E.x) / a.BEZIER_DIVISOR;
25
+ return `${n} C ${u},${E.y} ${l},${e.y} ${e.x},${e.y}`;
26
+ }, "") : r.reduce((n, e, $) => `${n} ${$ === s ? "M" : "L"} ${e.x},${e.y}`, ""), O = (r) => {
27
+ const t = Math.max(...r.map(($) => $.value)), c = Math.min(...r.map(($) => $.value)), n = t - c || f, e = r.length - f || f;
28
+ return r.map(($, x) => ({
29
+ x: x / e * a.VIEWBOX,
30
+ y: a.VIEWBOX - ($.value - c) / n * a.LINE_Y_RANGE - a.LINE_Y_PAD
31
31
  }));
32
- }, A = ($, n) => !$ || $.length === y ? n : $.reduce((c, e) => c + e, y);
32
+ }, A = (r, t) => !r || r.length === s ? t : r.reduce((c, n) => c + n, s);
33
33
  export {
34
34
  O as calculateLinePoints,
35
- _ as createArcPath,
36
- m as generateLinePath,
35
+ L as chartMotionClass,
36
+ m as createArcPath,
37
+ C as generateLinePath,
37
38
  M as getChartColor,
38
39
  A as getStackTotal,
39
- f as polarOffset,
40
- h as polarToCartesian
40
+ _ as polarOffset,
41
+ y as polarToCartesian
41
42
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("../../constants/numbers.const.cjs"),s=require("../../utils/cn.cjs");require("react");const N=require("../../utils/generateBearId.utils.cjs"),_=require("../../utils/useBearId.cjs"),b=require("../Box/Box.cjs"),o=require("../Flex/Flex.cjs"),F=require("../Typography/Typography.cjs"),t=require("./Chart.const.cjs"),j=require("./Chart.utils.cjs"),E=l=>{const{data:a,height:c=t.CHART.DEFAULT_HEIGHT,showLabels:u=!0,showValues:i=!0,animated:h=!0,color:d,className:C,id:g,testId:m,...x}=l,B=_.useBearId("FunnelChart"),p=N.resolveBearId(g,B),I=Math.max(...a.map(e=>e.value),n.ONE),q={"--Bear-Chart-height":`${c}px`};return r.jsx(o.Flex,{id:p,"data-testid":m,direction:"column",gap:1,justify:"center",className:s.cn("Bear-Chart Bear-Chart--funnel",C),style:q,...x,children:a.map((e,y)=>{const T={"--Bear-Chart-size":`${Math.max(e.value/I*t.CHART.VIEWBOX,t.CHART.FUNNEL_MIN_WIDTH)}%`,"--Bear-Chart-step-height":`${t.CHART.VIEWBOX/Math.max(a.length,n.ONE)/2}%`,"--Bear-Chart-color":j.getChartColor(y,e.color||d)};return r.jsxs(o.Flex,{direction:"column",align:"center",gap:1,className:"bear-w-full",children:[r.jsx(b.Box,{className:s.cn("Bear-Chart__funnel-step bear-rounded-md",h&&"animate-grow-right"),style:T}),u&&r.jsxs(F.Typography,{variant:"caption",color:"muted",children:[e.label,i?` · ${e.value}`:""]})]},e.label)})})};exports.FunnelChart=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("../../constants/numbers.const.cjs"),s=require("../../utils/cn.cjs");require("react");const b=require("../../utils/generateBearId.utils.cjs"),F=require("../../utils/useBearId.cjs"),j=require("../Box/Box.cjs"),o=require("../Flex/Flex.cjs"),E=require("../Typography/Typography.cjs"),r=require("./Chart.const.cjs"),l=require("./Chart.utils.cjs"),H=c=>{const{data:a,height:u=r.CHART.DEFAULT_HEIGHT,showLabels:i=!0,showValues:h=!0,animated:d=!0,motion:C,color:m,className:g,id:x,testId:B,...p}=c,I=F.useBearId("FunnelChart"),q=b.resolveBearId(x,I),y=Math.max(...a.map(e=>e.value),n.ONE),T={"--Bear-Chart-height":`${u}px`};return t.jsx(o.Flex,{id:q,"data-testid":B,direction:"column",gap:1,justify:"center",className:s.cn("Bear-Chart Bear-Chart--funnel",g),style:T,...p,children:a.map((e,N)=>{const _={"--Bear-Chart-size":`${Math.max(e.value/y*r.CHART.VIEWBOX,r.CHART.FUNNEL_MIN_WIDTH)}%`,"--Bear-Chart-step-height":`${r.CHART.VIEWBOX/Math.max(a.length,n.ONE)/2}%`,"--Bear-Chart-color":l.getChartColor(N,e.color||m)};return t.jsxs(o.Flex,{direction:"column",align:"center",gap:1,className:"bear-w-full",children:[t.jsx(j.Box,{className:s.cn("Bear-Chart__funnel-step bear-rounded-md",l.chartMotionClass(d,C,"animate-grow-right")),style:_}),i&&t.jsxs(E.Typography,{variant:"caption",color:"muted",children:[e.label,h?` · ${e.value}`:""]})]},e.label)})})};exports.FunnelChart=H;