@bolio-ui/core 3.0.0-alpha.1 → 3.0.0

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 (254) hide show
  1. package/dist/Alert/Alert.d.ts +20 -0
  2. package/dist/Alert/index.d.ts +3 -0
  3. package/dist/Alert/index.js +16 -0
  4. package/dist/BolioUIProvider/index.js +7 -6
  5. package/dist/Button/index.js +3 -3
  6. package/dist/ButtonDropdown/index.js +3 -2
  7. package/dist/Calendar/index.js +2 -2
  8. package/dist/Chip/Chip.d.ts +17 -0
  9. package/dist/Chip/ChipContext.d.ts +11 -0
  10. package/dist/Chip/ChipGroup.d.ts +16 -0
  11. package/dist/Chip/index.d.ts +9 -0
  12. package/dist/Chip/index.js +15 -0
  13. package/dist/ColorInput/index.js +3 -2
  14. package/dist/Combobox/index.js +3 -2
  15. package/dist/Command/index.js +9 -8
  16. package/dist/ContextMenu/index.js +5 -4
  17. package/dist/CssBaseline/index.js +2 -2
  18. package/dist/DatePicker/index.js +4 -3
  19. package/dist/DateRangePicker/index.js +4 -3
  20. package/dist/Drawer/index.js +6 -5
  21. package/dist/Grid/Grid.d.ts +16 -16
  22. package/dist/Grid/GridContainer.d.ts +16 -16
  23. package/dist/ImageZoom/ImageZoom.d.ts +14 -0
  24. package/dist/ImageZoom/index.d.ts +3 -0
  25. package/dist/ImageZoom/index.js +17 -0
  26. package/dist/Mention/Mention.d.ts +25 -0
  27. package/dist/Mention/index.d.ts +3 -0
  28. package/dist/Mention/index.js +17 -0
  29. package/dist/Menu/index.js +4 -3
  30. package/dist/Modal/index.js +8 -7
  31. package/dist/Note/Note.d.ts +10 -0
  32. package/dist/Note/index.js +3 -2
  33. package/dist/Popover/index.js +4 -3
  34. package/dist/Select/index.js +7 -6
  35. package/dist/Splitter/Splitter.d.ts +14 -0
  36. package/dist/Splitter/SplitterContext.d.ts +6 -0
  37. package/dist/Splitter/SplitterPanel.d.ts +13 -0
  38. package/dist/Splitter/index.d.ts +9 -0
  39. package/dist/Splitter/index.js +14 -0
  40. package/dist/Table/Table.d.ts +11 -1
  41. package/dist/Table/TableBody.d.ts +8 -2
  42. package/dist/Table/TableColumn.d.ts +2 -0
  43. package/dist/Table/TableHead.d.ts +9 -1
  44. package/dist/Table/TableSelectBox.d.ts +9 -0
  45. package/dist/Table/TableTypes.d.ts +8 -0
  46. package/dist/Table/index.d.ts +1 -1
  47. package/dist/Table/index.js +3 -3
  48. package/dist/Toolbar/Toolbar.d.ts +11 -0
  49. package/dist/Toolbar/ToolbarSeparator.d.ts +4 -0
  50. package/dist/Toolbar/index.d.ts +9 -0
  51. package/dist/Toolbar/index.js +14 -0
  52. package/dist/Tooltip/index.js +3 -2
  53. package/dist/Tour/Tour.d.ts +26 -0
  54. package/dist/Tour/index.d.ts +3 -0
  55. package/dist/Tour/index.js +24 -0
  56. package/dist/{chunk-PGQYW6YF.js → chunk-25NFUHLR.js} +12 -8
  57. package/dist/{chunk-AFBCMW2I.js → chunk-26KDVRFS.js} +1 -3
  58. package/dist/{chunk-4ZGR7UMX.js → chunk-4DH6SOK4.js} +10 -6
  59. package/dist/chunk-CGS2MT3G.js +10 -0
  60. package/dist/{chunk-6ZBFUZSL.js → chunk-CU6SNPIM.js} +25 -22
  61. package/dist/chunk-CY5KTINE.js +107 -0
  62. package/dist/{chunk-IJGIEX5J.js → chunk-DEMQXB46.js} +6 -2
  63. package/dist/{chunk-AVO2SK2I.js → chunk-DYYSUJ35.js} +2 -2
  64. package/dist/chunk-EUYSKHRS.js +13 -0
  65. package/dist/chunk-FFEAKF3A.js +220 -0
  66. package/dist/{chunk-XLPOECCE.js → chunk-FLUNRVVG.js} +12 -7
  67. package/dist/chunk-FQWH4PDK.js +165 -0
  68. package/dist/chunk-FSO65ZAH.js +249 -0
  69. package/dist/{chunk-2EYJZXS4.js → chunk-ICACLCJR.js} +13 -8
  70. package/dist/{chunk-XF4TPE2W.js → chunk-IL7L3BEL.js} +7 -2
  71. package/dist/{chunk-MGHMAZRL.js → chunk-KRSISARC.js} +7 -3
  72. package/dist/{chunk-4QA7Z7VP.js → chunk-M64V32WO.js} +6 -3
  73. package/dist/chunk-Q3I54DUS.js +131 -0
  74. package/dist/chunk-REWKR7S3.js +109 -0
  75. package/dist/{chunk-SGWX6H4Y.js → chunk-RWRFOGCU.js} +6 -2
  76. package/dist/chunk-SJVWKNGY.js +236 -0
  77. package/dist/{chunk-P245HSVB.js → chunk-TLVSZCKU.js} +2 -1
  78. package/dist/{chunk-AG2NWQYL.js → chunk-WCTANCLG.js} +3 -1
  79. package/dist/{chunk-TDJGMSGT.js → chunk-WIIDIZYK.js} +3 -1
  80. package/dist/{chunk-DIMJQLWY.js → chunk-XUNC7RB7.js} +9 -5
  81. package/dist/{chunk-GGCVPMXO.js → chunk-Y432C24Z.js} +2 -2
  82. package/dist/{chunk-TKICX5R6.js → chunk-Y5CFWIGV.js} +227 -35
  83. package/dist/{chunk-GYFW5NLU.js → chunk-YLLPYRJH.js} +34 -11
  84. package/dist/css/Alert.css +53 -0
  85. package/dist/css/ButtonDropdown-ButtonDropdownItem.css +0 -1
  86. package/dist/css/ButtonGroup.css +0 -1
  87. package/dist/css/Calendar.css +0 -1
  88. package/dist/css/Carousel.css +0 -1
  89. package/dist/css/Chip-ChipGroup.css +8 -0
  90. package/dist/css/Chip.css +65 -0
  91. package/dist/css/ColorInput.css +7 -3
  92. package/dist/css/ColorPicker.css +5 -4
  93. package/dist/css/Combobox.css +1 -2
  94. package/dist/css/DatePicker.css +1 -3
  95. package/dist/css/DateRangePicker.css +7 -3
  96. package/dist/css/Dropzone.css +0 -3
  97. package/dist/css/Fieldset-FieldsetGroup.css +0 -1
  98. package/dist/css/ImageZoom.css +93 -0
  99. package/dist/css/Input.css +1 -1
  100. package/dist/css/Mention.css +93 -0
  101. package/dist/css/Menu-MenuList.css +0 -1
  102. package/dist/css/Modal-ModalAction.css +6 -1
  103. package/dist/css/Modal-ModalActions.css +9 -2
  104. package/dist/css/NumberInput.css +1 -1
  105. package/dist/css/PinInput.css +1 -1
  106. package/dist/css/Radio.css +0 -1
  107. package/dist/css/SegmentedControl.css +0 -1
  108. package/dist/css/Select-SelectDropdown.css +0 -1
  109. package/dist/css/Select-SelectOption.css +0 -1
  110. package/dist/css/Select.css +0 -1
  111. package/dist/css/Splitter.css +77 -0
  112. package/dist/css/Table-TableBody.css +10 -0
  113. package/dist/css/Table-TableHead.css +41 -0
  114. package/dist/css/Table-TableSelectBox.css +11 -0
  115. package/dist/css/TagsInput.css +1 -2
  116. package/dist/css/Textarea.css +1 -1
  117. package/dist/css/Toggle.css +0 -1
  118. package/dist/css/Toolbar.css +32 -0
  119. package/dist/css/Tour.css +81 -0
  120. package/dist/css/use-toasts-toast-item.css +0 -1
  121. package/dist/index.d.ts +15 -1
  122. package/dist/index.js +92 -62
  123. package/dist/styles.css +3571 -2997
  124. package/dist/utils/surface.d.ts +6 -0
  125. package/esm/Alert/Alert.d.ts +20 -0
  126. package/esm/Alert/index.d.ts +3 -0
  127. package/esm/Alert/index.js +16 -0
  128. package/esm/BolioUIProvider/index.js +6 -5
  129. package/esm/Button/index.js +2 -2
  130. package/esm/ButtonDropdown/index.js +2 -1
  131. package/esm/Calendar/index.js +1 -1
  132. package/esm/Chip/Chip.d.ts +17 -0
  133. package/esm/Chip/ChipContext.d.ts +11 -0
  134. package/esm/Chip/ChipGroup.d.ts +16 -0
  135. package/esm/Chip/index.d.ts +9 -0
  136. package/esm/Chip/index.js +15 -0
  137. package/esm/ColorInput/index.js +2 -1
  138. package/esm/Combobox/index.js +2 -1
  139. package/esm/Command/index.js +8 -7
  140. package/esm/ContextMenu/index.js +4 -3
  141. package/esm/CssBaseline/index.js +1 -1
  142. package/esm/DatePicker/index.js +3 -2
  143. package/esm/DateRangePicker/index.js +3 -2
  144. package/esm/Drawer/index.js +5 -4
  145. package/esm/Grid/Grid.d.ts +16 -16
  146. package/esm/Grid/GridContainer.d.ts +16 -16
  147. package/esm/ImageZoom/ImageZoom.d.ts +14 -0
  148. package/esm/ImageZoom/index.d.ts +3 -0
  149. package/esm/ImageZoom/index.js +17 -0
  150. package/esm/Mention/Mention.d.ts +25 -0
  151. package/esm/Mention/index.d.ts +3 -0
  152. package/esm/Mention/index.js +17 -0
  153. package/esm/Menu/index.js +3 -2
  154. package/esm/Modal/index.js +7 -6
  155. package/esm/Note/Note.d.ts +10 -0
  156. package/esm/Note/index.js +2 -1
  157. package/esm/Popover/index.js +3 -2
  158. package/esm/Select/index.js +6 -5
  159. package/esm/Splitter/Splitter.d.ts +14 -0
  160. package/esm/Splitter/SplitterContext.d.ts +6 -0
  161. package/esm/Splitter/SplitterPanel.d.ts +13 -0
  162. package/esm/Splitter/index.d.ts +9 -0
  163. package/esm/Splitter/index.js +14 -0
  164. package/esm/Table/Table.d.ts +11 -1
  165. package/esm/Table/TableBody.d.ts +8 -2
  166. package/esm/Table/TableColumn.d.ts +2 -0
  167. package/esm/Table/TableHead.d.ts +9 -1
  168. package/esm/Table/TableSelectBox.d.ts +9 -0
  169. package/esm/Table/TableTypes.d.ts +8 -0
  170. package/esm/Table/index.d.ts +1 -1
  171. package/esm/Table/index.js +2 -2
  172. package/esm/Toolbar/Toolbar.d.ts +11 -0
  173. package/esm/Toolbar/ToolbarSeparator.d.ts +4 -0
  174. package/esm/Toolbar/index.d.ts +9 -0
  175. package/esm/Toolbar/index.js +14 -0
  176. package/esm/Tooltip/index.js +2 -1
  177. package/esm/Tour/Tour.d.ts +26 -0
  178. package/esm/Tour/index.d.ts +3 -0
  179. package/esm/Tour/index.js +24 -0
  180. package/esm/{chunk-PGQYW6YF.js → chunk-25NFUHLR.js} +7 -3
  181. package/esm/{chunk-AFBCMW2I.js → chunk-26KDVRFS.js} +2 -4
  182. package/esm/{chunk-4ZGR7UMX.js → chunk-4DH6SOK4.js} +10 -6
  183. package/esm/chunk-CGS2MT3G.js +10 -0
  184. package/esm/{chunk-6ZBFUZSL.js → chunk-CU6SNPIM.js} +15 -12
  185. package/esm/chunk-CY5KTINE.js +107 -0
  186. package/esm/{chunk-IJGIEX5J.js → chunk-DEMQXB46.js} +6 -2
  187. package/esm/{chunk-AVO2SK2I.js → chunk-DYYSUJ35.js} +1 -1
  188. package/esm/chunk-EUYSKHRS.js +13 -0
  189. package/esm/chunk-FFEAKF3A.js +220 -0
  190. package/esm/{chunk-XLPOECCE.js → chunk-FLUNRVVG.js} +11 -6
  191. package/esm/chunk-FQWH4PDK.js +165 -0
  192. package/esm/chunk-FSO65ZAH.js +249 -0
  193. package/esm/{chunk-2EYJZXS4.js → chunk-ICACLCJR.js} +8 -3
  194. package/esm/{chunk-XF4TPE2W.js → chunk-IL7L3BEL.js} +7 -2
  195. package/esm/{chunk-MGHMAZRL.js → chunk-KRSISARC.js} +7 -3
  196. package/esm/{chunk-4QA7Z7VP.js → chunk-M64V32WO.js} +5 -2
  197. package/esm/chunk-Q3I54DUS.js +131 -0
  198. package/esm/chunk-REWKR7S3.js +109 -0
  199. package/esm/{chunk-SGWX6H4Y.js → chunk-RWRFOGCU.js} +6 -2
  200. package/esm/chunk-SJVWKNGY.js +236 -0
  201. package/esm/{chunk-P245HSVB.js → chunk-TLVSZCKU.js} +2 -1
  202. package/esm/{chunk-AG2NWQYL.js → chunk-WCTANCLG.js} +3 -1
  203. package/esm/{chunk-TDJGMSGT.js → chunk-WIIDIZYK.js} +3 -1
  204. package/esm/{chunk-DIMJQLWY.js → chunk-XUNC7RB7.js} +9 -5
  205. package/esm/{chunk-GGCVPMXO.js → chunk-Y432C24Z.js} +1 -1
  206. package/esm/chunk-Y5CFWIGV.js +543 -0
  207. package/esm/{chunk-GYFW5NLU.js → chunk-YLLPYRJH.js} +30 -7
  208. package/esm/css/Alert.css +53 -0
  209. package/esm/css/ButtonDropdown-ButtonDropdownItem.css +0 -1
  210. package/esm/css/ButtonGroup.css +0 -1
  211. package/esm/css/Calendar.css +0 -1
  212. package/esm/css/Carousel.css +0 -1
  213. package/esm/css/Chip-ChipGroup.css +8 -0
  214. package/esm/css/Chip.css +65 -0
  215. package/esm/css/ColorInput.css +7 -3
  216. package/esm/css/ColorPicker.css +5 -4
  217. package/esm/css/Combobox.css +1 -2
  218. package/esm/css/DatePicker.css +1 -3
  219. package/esm/css/DateRangePicker.css +7 -3
  220. package/esm/css/Dropzone.css +0 -3
  221. package/esm/css/Fieldset-FieldsetGroup.css +0 -1
  222. package/esm/css/ImageZoom.css +93 -0
  223. package/esm/css/Input.css +1 -1
  224. package/esm/css/Mention.css +93 -0
  225. package/esm/css/Menu-MenuList.css +0 -1
  226. package/esm/css/Modal-ModalAction.css +6 -1
  227. package/esm/css/Modal-ModalActions.css +9 -2
  228. package/esm/css/NumberInput.css +1 -1
  229. package/esm/css/PinInput.css +1 -1
  230. package/esm/css/Radio.css +0 -1
  231. package/esm/css/SegmentedControl.css +0 -1
  232. package/esm/css/Select-SelectDropdown.css +0 -1
  233. package/esm/css/Select-SelectOption.css +0 -1
  234. package/esm/css/Select.css +0 -1
  235. package/esm/css/Splitter.css +77 -0
  236. package/esm/css/Table-TableBody.css +10 -0
  237. package/esm/css/Table-TableHead.css +41 -0
  238. package/esm/css/Table-TableSelectBox.css +11 -0
  239. package/esm/css/TagsInput.css +1 -2
  240. package/esm/css/Textarea.css +1 -1
  241. package/esm/css/Toggle.css +0 -1
  242. package/esm/css/Toolbar.css +32 -0
  243. package/esm/css/Tour.css +81 -0
  244. package/esm/css/use-toasts-toast-item.css +0 -1
  245. package/esm/index.d.ts +15 -1
  246. package/esm/index.js +109 -79
  247. package/esm/styles.css +3206 -2632
  248. package/esm/utils/surface.d.ts +6 -0
  249. package/package.json +1 -1
  250. package/esm/chunk-TKICX5R6.js +0 -351
  251. package/dist/{chunk-DXHNQANX.js → chunk-TPZUTHTQ.js} +3 -3
  252. package/dist/{chunk-TKIUVNKP.js → chunk-XKJDF225.js} +2 -2
  253. package/esm/{chunk-DXHNQANX.js → chunk-TPZUTHTQ.js} +3 -3
  254. package/esm/{chunk-TKIUVNKP.js → chunk-XKJDF225.js} +3 -3
@@ -0,0 +1,543 @@
1
+ import {
2
+ Pagination_default
3
+ } from "./chunk-E5EDUOQT.js";
4
+ import {
5
+ use_real_shape_default
6
+ } from "./chunk-HKOESPKZ.js";
7
+ import {
8
+ use_resize_default
9
+ } from "./chunk-JJFOGZ6V.js";
10
+ import {
11
+ log_warning_default
12
+ } from "./chunk-AXYDJGTN.js";
13
+ import {
14
+ use_scale_default,
15
+ with_scale_default
16
+ } from "./chunk-MAICNLTY.js";
17
+ import {
18
+ use_theme_default
19
+ } from "./chunk-V5I4ORQQ.js";
20
+ import {
21
+ joinClasses,
22
+ use_classes_default
23
+ } from "./chunk-5KUROAEP.js";
24
+
25
+ // core/Table/Table.tsx
26
+ import React5, {
27
+ useCallback,
28
+ useEffect as useEffect3,
29
+ useImperativeHandle,
30
+ useMemo as useMemo2,
31
+ useRef as useRef2,
32
+ useState
33
+ } from "react";
34
+
35
+ // core/Table/TableHead.tsx
36
+ import { useMemo } from "react";
37
+
38
+ // core/Table/TableSelectBox.tsx
39
+ import { useEffect, useRef } from "react";
40
+
41
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Table/TableSelectBox.module.css.bolio-css-module-source
42
+ var TableSelectBox_module_css_default = { "box": "TableSelectBox-module_box__UXj-E" };
43
+
44
+ // core/Table/TableSelectBox.tsx
45
+ import { jsx } from "react/jsx-runtime";
46
+ function TableSelectBox({
47
+ checked,
48
+ indeterminate = false,
49
+ label,
50
+ onChange
51
+ }) {
52
+ const ref = useRef(null);
53
+ useEffect(() => {
54
+ if (ref.current) ref.current.indeterminate = indeterminate;
55
+ }, [indeterminate]);
56
+ return /* @__PURE__ */ jsx(
57
+ "input",
58
+ {
59
+ ref,
60
+ type: "checkbox",
61
+ className: TableSelectBox_module_css_default.box,
62
+ checked,
63
+ "aria-label": label,
64
+ onChange,
65
+ onClick: (event) => event.stopPropagation()
66
+ }
67
+ );
68
+ }
69
+ var TableSelectBox_default = TableSelectBox;
70
+
71
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Table/TableHead.module.css.bolio-css-module-source
72
+ var TableHead_module_css_default = { "thead": "TableHead-module_thead__zMtMt", "th": "TableHead-module_th__GzIce", "theadBox": "TableHead-module_theadBox__6QaBJ", "selectCell": "TableHead-module_selectCell__JRdGg", "sortButton": "TableHead-module_sortButton__whwp3", "sortIcon": "TableHead-module_sortIcon__VsHqp", "sorted": "TableHead-module_sorted__-6XtK" };
73
+
74
+ // core/Table/TableHead.tsx
75
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
76
+ var SELECT_WIDTH = 40;
77
+ var makeColgroup = (fullWidth, columns, leading) => {
78
+ const width = fullWidth - leading;
79
+ const unsetWidthCount = columns.filter((c) => !c.width).length;
80
+ const customWidthTotal = columns.reduce((pre, current) => {
81
+ return current.width ? pre + current.width : pre;
82
+ }, 0);
83
+ const averageWidth = (width - customWidthTotal) / unsetWidthCount;
84
+ if (averageWidth <= 0) return /* @__PURE__ */ jsx2("colgroup", {});
85
+ return /* @__PURE__ */ jsxs("colgroup", { children: [
86
+ leading > 0 && /* @__PURE__ */ jsx2("col", { width: leading }),
87
+ columns.map((column, index) => /* @__PURE__ */ jsx2("col", { width: column.width || averageWidth }, `colgroup-${index}`))
88
+ ] });
89
+ };
90
+ var TableHead = (props) => {
91
+ const theme = use_theme_default();
92
+ const { columns, width, sort, onSort, selection } = props;
93
+ const isScalableWidth = useMemo(
94
+ () => columns.find((item) => !!item.width),
95
+ [columns]
96
+ );
97
+ const colgroup = useMemo(() => {
98
+ if (!isScalableWidth) return /* @__PURE__ */ jsx2("colgroup", {});
99
+ return makeColgroup(width, columns, selection ? SELECT_WIDTH : 0);
100
+ }, [isScalableWidth, width, columns, selection]);
101
+ const theadStyle = {
102
+ "--table-head-text-color": theme.palette.accents_5,
103
+ "--table-head-bg": theme.palette.accents_1,
104
+ "--table-head-border-color": theme.palette.border,
105
+ "--table-head-radius": theme.layout.radius,
106
+ "--table-head-sorted-color": theme.palette.foreground,
107
+ "--table-head-focus-color": theme.palette.primary
108
+ };
109
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
110
+ colgroup,
111
+ /* @__PURE__ */ jsx2("thead", { className: TableHead_module_css_default.thead, style: theadStyle, children: /* @__PURE__ */ jsxs("tr", { children: [
112
+ selection && /* @__PURE__ */ jsx2("th", { className: joinClasses(TableHead_module_css_default.th, TableHead_module_css_default.selectCell), children: /* @__PURE__ */ jsx2("div", { className: TableHead_module_css_default.theadBox, children: /* @__PURE__ */ jsx2(
113
+ TableSelectBox_default,
114
+ {
115
+ checked: selection.checked,
116
+ indeterminate: selection.indeterminate,
117
+ label: selection.label,
118
+ onChange: selection.onToggle
119
+ }
120
+ ) }) }),
121
+ columns.map((column, index) => {
122
+ const prop = String(column.prop);
123
+ const direction = sort && sort.prop === prop ? sort.direction : null;
124
+ return /* @__PURE__ */ jsx2(
125
+ "th",
126
+ {
127
+ className: joinClasses(TableHead_module_css_default.th, column.className),
128
+ "aria-sort": column.sortable ? direction === "asc" ? "ascending" : direction === "desc" ? "descending" : "none" : void 0,
129
+ children: /* @__PURE__ */ jsx2("div", { className: TableHead_module_css_default.theadBox, children: column.sortable ? /* @__PURE__ */ jsxs(
130
+ "button",
131
+ {
132
+ type: "button",
133
+ className: TableHead_module_css_default.sortButton,
134
+ onClick: () => onSort && onSort(prop),
135
+ children: [
136
+ column.label,
137
+ /* @__PURE__ */ jsx2(
138
+ "svg",
139
+ {
140
+ viewBox: "0 0 24 24",
141
+ width: "1em",
142
+ height: "1em",
143
+ fill: "none",
144
+ stroke: "currentColor",
145
+ strokeWidth: "2",
146
+ strokeLinecap: "round",
147
+ strokeLinejoin: "round",
148
+ className: joinClasses(TableHead_module_css_default.sortIcon, {
149
+ [TableHead_module_css_default.sorted]: direction !== null
150
+ }),
151
+ "aria-hidden": "true",
152
+ children: /* @__PURE__ */ jsx2(
153
+ "path",
154
+ {
155
+ d: direction === "asc" ? "M12 19V5M5 12l7-7 7 7" : direction === "desc" ? "M12 5v14M19 12l-7 7-7-7" : "M8 9l4-4 4 4M8 15l4 4 4-4"
156
+ }
157
+ )
158
+ }
159
+ )
160
+ ]
161
+ }
162
+ ) : column.label })
163
+ },
164
+ `table-th-${prop}-${index}`
165
+ );
166
+ })
167
+ ] }) })
168
+ ] });
169
+ };
170
+ TableHead.displayName = "BolioUITableHead";
171
+ var TableHead_default = TableHead;
172
+
173
+ // core/Table/TableCell.tsx
174
+ import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
175
+ var TableCell = ({
176
+ columns,
177
+ row,
178
+ rowIndex,
179
+ emptyText,
180
+ onCellClick
181
+ }) => {
182
+ return /* @__PURE__ */ jsx3(Fragment2, { children: columns.map((column, index) => {
183
+ const currentRowValue = row[column.prop];
184
+ const cellValue = currentRowValue || emptyText;
185
+ const shouldBeRenderElement = column.renderHandler(
186
+ currentRowValue,
187
+ row,
188
+ rowIndex
189
+ );
190
+ return /* @__PURE__ */ jsx3(
191
+ "td",
192
+ {
193
+ onClick: () => onCellClick && onCellClick(currentRowValue, rowIndex, index),
194
+ className: column.className,
195
+ children: /* @__PURE__ */ jsx3("div", { className: "cell", children: shouldBeRenderElement ? shouldBeRenderElement : cellValue })
196
+ },
197
+ `row-td-${index}-${String(column.prop)}`
198
+ );
199
+ }) });
200
+ };
201
+ var TableCell_default = TableCell;
202
+
203
+ // core/Table/TableContext.ts
204
+ import React3 from "react";
205
+ var defaultContext = {
206
+ columns: [],
207
+ updateColumn: () => {
208
+ }
209
+ };
210
+ var TableContext = React3.createContext(defaultContext);
211
+ var useTableContext = () => React3.useContext(TableContext);
212
+
213
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Table/TableBody.module.css.bolio-css-module-source
214
+ var TableBody_module_css_default = { "tr": "TableBody-module_tr__lTn-M", "hover": "TableBody-module_hover__AjVlq", "selected": "TableBody-module_selected__7adtQ", "selectCell": "TableBody-module_selectCell__S8ZZn" };
215
+
216
+ // core/Table/TableBody.tsx
217
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
218
+ var TableBody = ({
219
+ data,
220
+ keys,
221
+ selection,
222
+ hover,
223
+ emptyText,
224
+ onRow,
225
+ onCell,
226
+ rowClassName
227
+ }) => {
228
+ const theme = use_theme_default();
229
+ const { columns } = useTableContext();
230
+ const rowClickHandler = (row, index) => {
231
+ if (onRow) onRow(row, index);
232
+ };
233
+ const trStyle = {
234
+ "--table-body-hover-bg": theme.palette.accents_1,
235
+ "--table-body-border-color": theme.palette.border,
236
+ "--table-body-text-color": theme.palette.accents_6,
237
+ "--table-body-selected-bg": `color-mix(in srgb, ${theme.palette.primary} 10%, transparent)`
238
+ };
239
+ return /* @__PURE__ */ jsx4("tbody", { children: data.map((row, index) => {
240
+ const className = rowClassName(row, index);
241
+ const selected = Boolean(selection == null ? void 0 : selection.keys.includes(keys[index]));
242
+ return /* @__PURE__ */ jsxs2(
243
+ "tr",
244
+ {
245
+ className: joinClasses(
246
+ TableBody_module_css_default.tr,
247
+ { [TableBody_module_css_default.hover]: hover, [TableBody_module_css_default.selected]: selected },
248
+ className
249
+ ),
250
+ onClick: () => rowClickHandler(row, index),
251
+ style: trStyle,
252
+ children: [
253
+ selection && /* @__PURE__ */ jsx4("td", { className: TableBody_module_css_default.selectCell, children: /* @__PURE__ */ jsx4("div", { className: "cell", children: /* @__PURE__ */ jsx4(
254
+ TableSelectBox_default,
255
+ {
256
+ checked: selected,
257
+ label: selection.label,
258
+ onChange: () => selection.onToggle(keys[index])
259
+ }
260
+ ) }) }),
261
+ /* @__PURE__ */ jsx4(
262
+ TableCell_default,
263
+ {
264
+ columns,
265
+ row,
266
+ rowIndex: index,
267
+ emptyText,
268
+ onCellClick: onCell
269
+ }
270
+ )
271
+ ]
272
+ },
273
+ `tbody-row-${index}`
274
+ );
275
+ }) });
276
+ };
277
+ TableBody.displayName = "BolioUITableBody";
278
+ var TableBody_default = TableBody;
279
+
280
+ // core/Table/TableColumn.tsx
281
+ import { useEffect as useEffect2 } from "react";
282
+ var defaultRender = () => {
283
+ };
284
+ var TableColumn = (columnProps) => {
285
+ const {
286
+ children,
287
+ prop,
288
+ label,
289
+ width,
290
+ className = "",
291
+ sortable = false,
292
+ sorter,
293
+ render: renderHandler = defaultRender
294
+ } = columnProps;
295
+ const { updateColumn } = useTableContext();
296
+ const safeProp = String(prop).trim();
297
+ if (!safeProp) {
298
+ log_warning_default('The props "prop" is required.', "Table.Column");
299
+ }
300
+ useEffect2(() => {
301
+ updateColumn({
302
+ label: children || label,
303
+ prop: safeProp,
304
+ width,
305
+ className,
306
+ sortable,
307
+ sorter,
308
+ renderHandler
309
+ });
310
+ }, [
311
+ children,
312
+ label,
313
+ safeProp,
314
+ width,
315
+ className,
316
+ sortable,
317
+ sorter,
318
+ renderHandler,
319
+ updateColumn
320
+ ]);
321
+ return null;
322
+ };
323
+ TableColumn.displayName = "BolioUITableColumn";
324
+ var TableColumn_default = TableColumn;
325
+
326
+ // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Table/Table.module.css.bolio-css-module-source
327
+ var Table_module_css_default = { "table": "Table-module_table__H9ZOx", "footer": "Table-module_footer__7eFVi" };
328
+
329
+ // core/Table/Table.tsx
330
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
331
+ var noKeys = [];
332
+ var compareValues = (a, b) => typeof a === "number" && typeof b === "number" ? a - b : String(a != null ? a : "").localeCompare(String(b != null ? b : ""), void 0, {
333
+ numeric: true,
334
+ sensitivity: "base"
335
+ });
336
+ var defaultProps = {
337
+ hover: true,
338
+ initialData: [],
339
+ emptyText: "",
340
+ className: "",
341
+ rowClassName: () => ""
342
+ };
343
+ function TableComponent(tableProps, forwardedRef) {
344
+ var _a, _b;
345
+ const {
346
+ children,
347
+ data: customData,
348
+ initialData = defaultProps.initialData,
349
+ hover = defaultProps.hover,
350
+ emptyText = defaultProps.emptyText,
351
+ onRow,
352
+ onCell,
353
+ onChange,
354
+ pagination,
355
+ className = defaultProps.className,
356
+ rowClassName = defaultProps.rowClassName,
357
+ sort: customSort,
358
+ initialSort = null,
359
+ onSortChange,
360
+ selectable = false,
361
+ rowKey,
362
+ selectedKeys: customKeys,
363
+ initialSelectedKeys = noKeys,
364
+ onSelectionChange,
365
+ selectRowLabel = "Select row",
366
+ selectAllLabel = "Select all rows",
367
+ style,
368
+ ...props
369
+ } = tableProps;
370
+ const theme = use_theme_default();
371
+ const { SCALES } = use_scale_default();
372
+ const tableRef = useRef2(null);
373
+ useImperativeHandle(forwardedRef, () => tableRef.current);
374
+ const [{ width }, updateShape] = use_real_shape_default(tableRef);
375
+ const [columns, setColumns] = useState([]);
376
+ const [data, setData] = useState(initialData);
377
+ const updateColumn = useCallback(
378
+ (column) => {
379
+ setColumns((last) => {
380
+ const hasColumn = last.find((item) => item.prop === column.prop);
381
+ if (!hasColumn) return [...last, column];
382
+ return last.map((item) => {
383
+ if (item.prop !== column.prop) return item;
384
+ return column;
385
+ });
386
+ });
387
+ },
388
+ []
389
+ );
390
+ const contextValue = useMemo2(
391
+ () => ({
392
+ columns,
393
+ updateColumn
394
+ }),
395
+ [columns, updateColumn]
396
+ );
397
+ useEffect3(() => {
398
+ if (typeof customData === "undefined") return;
399
+ setData(customData);
400
+ }, [customData]);
401
+ use_resize_default(() => updateShape());
402
+ const [selfSort, setSelfSort] = useState(initialSort);
403
+ const sort = customSort !== void 0 ? customSort : selfSort;
404
+ const [selfKeys, setSelfKeys] = useState(initialSelectedKeys);
405
+ const selectedKeys = customKeys !== void 0 ? customKeys : selfKeys;
406
+ const keyOf = (row, index) => typeof rowKey === "function" ? rowKey(row) : rowKey !== void 0 ? row[rowKey] : index;
407
+ const sortedEntries = useMemo2(() => {
408
+ const entries = data.map((row, index) => ({ row, key: keyOf(row, index) }));
409
+ const column = sort && columns.find((item) => item.prop === sort.prop);
410
+ if (!sort || !column || (pagination == null ? void 0 : pagination.total) !== void 0) return entries;
411
+ const direction = sort.direction === "desc" ? -1 : 1;
412
+ const compare = column.sorter || ((a, b) => compareValues(a[column.prop], b[column.prop]));
413
+ return [...entries].sort((a, b) => direction * compare(a.row, b.row));
414
+ }, [data, sort, columns, pagination == null ? void 0 : pagination.total, rowKey]);
415
+ const [selfPage, setSelfPage] = useState(1);
416
+ const pageSize = pagination ? Math.max(1, pagination.pageSize) : 0;
417
+ const totalRows = (_a = pagination == null ? void 0 : pagination.total) != null ? _a : data.length;
418
+ const pageCount = pagination ? Math.ceil(totalRows / pageSize) : 0;
419
+ const page = Math.min((_b = pagination == null ? void 0 : pagination.page) != null ? _b : selfPage, Math.max(pageCount, 1));
420
+ const pageEntries = pagination && pagination.total === void 0 ? sortedEntries.slice((page - 1) * pageSize, page * pageSize) : sortedEntries;
421
+ const rows = pageEntries.map((entry) => entry.row);
422
+ const pageKeys = pageEntries.map((entry) => entry.key);
423
+ const sortHandler = (prop) => {
424
+ const next = !sort || sort.prop !== prop ? { prop, direction: "asc" } : sort.direction === "asc" ? { prop, direction: "desc" } : null;
425
+ setSelfSort(next);
426
+ if (onSortChange) onSortChange(next);
427
+ };
428
+ const selectKeys = (next) => {
429
+ setSelfKeys(next);
430
+ if (onSelectionChange)
431
+ onSelectionChange(
432
+ next,
433
+ sortedEntries.filter((entry) => next.includes(entry.key)).map((entry) => entry.row)
434
+ );
435
+ };
436
+ const toggleKey = (key) => selectKeys(
437
+ selectedKeys.includes(key) ? selectedKeys.filter((item) => item !== key) : [...selectedKeys, key]
438
+ );
439
+ const inView = pageKeys.filter((key) => selectedKeys.includes(key)).length;
440
+ const toggleAll = () => selectKeys(
441
+ inView === pageKeys.length ? selectedKeys.filter((key) => !pageKeys.includes(key)) : [
442
+ ...selectedKeys,
443
+ ...pageKeys.filter((key) => !selectedKeys.includes(key))
444
+ ]
445
+ );
446
+ const pageChangeHandler = (next) => {
447
+ if (next === page) return;
448
+ setSelfPage(next);
449
+ if (pagination == null ? void 0 : pagination.onPageChange) pagination.onPageChange(next);
450
+ };
451
+ const tableStyle = {
452
+ "--table-font-size": SCALES.font(1),
453
+ "--table-select-accent": theme.palette.primary,
454
+ "--table-width": SCALES.width(1, "100%"),
455
+ "--table-height": SCALES.height(1, "auto"),
456
+ "--table-padding-top": SCALES.pt(0),
457
+ "--table-padding-right": SCALES.pr(0),
458
+ "--table-padding-bottom": SCALES.pb(0),
459
+ "--table-padding-left": SCALES.pl(0),
460
+ "--table-margin-top": SCALES.mt(0),
461
+ "--table-margin-right": SCALES.mr(0),
462
+ "--table-margin-bottom": SCALES.mb(0),
463
+ "--table-margin-left": SCALES.ml(0),
464
+ ...style
465
+ };
466
+ return (
467
+ // the context is typed for any row: each Table provides its own
468
+ /* @__PURE__ */ jsxs3(
469
+ TableContext.Provider,
470
+ {
471
+ value: contextValue,
472
+ children: [
473
+ /* @__PURE__ */ jsxs3(
474
+ "table",
475
+ {
476
+ ref: tableRef,
477
+ className: use_classes_default(Table_module_css_default.table, className),
478
+ ...props,
479
+ style: tableStyle,
480
+ children: [
481
+ /* @__PURE__ */ jsx5(
482
+ TableHead_default,
483
+ {
484
+ columns,
485
+ width,
486
+ sort,
487
+ onSort: sortHandler,
488
+ selection: selectable ? {
489
+ checked: pageKeys.length > 0 && inView === pageKeys.length,
490
+ indeterminate: inView > 0 && inView < pageKeys.length,
491
+ label: selectAllLabel,
492
+ onToggle: toggleAll
493
+ } : void 0
494
+ }
495
+ ),
496
+ /* @__PURE__ */ jsx5(
497
+ TableBody_default,
498
+ {
499
+ data: rows,
500
+ keys: pageKeys,
501
+ selection: selectable ? {
502
+ keys: selectedKeys,
503
+ label: selectRowLabel,
504
+ onToggle: toggleKey
505
+ } : void 0,
506
+ hover,
507
+ emptyText,
508
+ onRow,
509
+ onCell,
510
+ rowClassName
511
+ }
512
+ ),
513
+ children
514
+ ]
515
+ }
516
+ ),
517
+ pageCount > 1 && /* @__PURE__ */ jsx5("div", { className: Table_module_css_default.footer, children: /* @__PURE__ */ jsx5(
518
+ Pagination_default,
519
+ {
520
+ count: pageCount,
521
+ page,
522
+ onChange: pageChangeHandler
523
+ }
524
+ ) })
525
+ ]
526
+ }
527
+ )
528
+ );
529
+ }
530
+ TableComponent.displayName = "BolioUITable";
531
+ TableComponent.Column = TableColumn_default;
532
+ var Table = with_scale_default(
533
+ React5.forwardRef(TableComponent)
534
+ );
535
+ Table.Column = TableColumn_default;
536
+ var Table_default = Table;
537
+
538
+ // core/Table/index.ts
539
+ var Table_default2 = Table_default;
540
+
541
+ export {
542
+ Table_default2 as Table_default
543
+ };
@@ -6,10 +6,13 @@ import {
6
6
  fromISO,
7
7
  startOfDay,
8
8
  toISO
9
- } from "./chunk-P245HSVB.js";
9
+ } from "./chunk-TLVSZCKU.js";
10
10
  import {
11
11
  use_click_away_default
12
12
  } from "./chunk-DGXZP4VJ.js";
13
+ import {
14
+ getSurface
15
+ } from "./chunk-EUYSKHRS.js";
13
16
  import {
14
17
  use_scale_default,
15
18
  with_scale_default
@@ -18,6 +21,7 @@ import {
18
21
  use_theme_default
19
22
  } from "./chunk-V5I4ORQQ.js";
20
23
  import {
24
+ joinClasses,
21
25
  use_classes_default
22
26
  } from "./chunk-5KUROAEP.js";
23
27
 
@@ -25,10 +29,12 @@ import {
25
29
  import React, { useEffect, useRef, useState } from "react";
26
30
 
27
31
  // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/DateRangePicker/DateRangePicker.module.css.bolio-css-module-source
28
- var DateRangePicker_module_css_default = { "daterange": "DateRangePicker-module_daterange__id9HF", "field": "DateRangePicker-module_field__4UZhH", "input": "DateRangePicker-module_input__h9sDj", "separator": "DateRangePicker-module_separator__StR3E", "toggle": "DateRangePicker-module_toggle__gNukh", "popup": "DateRangePicker-module_popup__hKExw" };
32
+ var DateRangePicker_module_css_default = { "daterange": "DateRangePicker-module_daterange__id9HF", "field": "DateRangePicker-module_field__4UZhH", "input": "DateRangePicker-module_input__h9sDj", "separator": "DateRangePicker-module_separator__StR3E", "toggle": "DateRangePicker-module_toggle__gNukh", "popup": "DateRangePicker-module_popup__hKExw", "alignEnd": "DateRangePicker-module_alignEnd__DgOia" };
29
33
 
30
34
  // core/DateRangePicker/DateRangePicker.tsx
31
35
  import { jsx, jsxs } from "react/jsx-runtime";
36
+ var TWO_MONTHS_EM = 46;
37
+ var ONE_MONTH_EM = 22;
32
38
  var emptyRange = [null, null];
33
39
  var format = (date) => date ? toISO(date) : "";
34
40
  var DateRangePickerComponent = React.forwardRef(
@@ -57,6 +63,7 @@ var DateRangePickerComponent = React.forwardRef(
57
63
  ...props
58
64
  }, ref) => {
59
65
  const theme = use_theme_default();
66
+ const surface = getSurface(theme);
60
67
  const { SCALES } = use_scale_default();
61
68
  const colors = getColors(theme.palette, type, disabled, {
62
69
  filled,
@@ -72,6 +79,7 @@ var DateRangePickerComponent = React.forwardRef(
72
79
  const endText = format(end);
73
80
  const [texts, setTexts] = useState({ start: startText, end: endText });
74
81
  const [open, setOpen] = useState(false);
82
+ const [fit, setFit] = useState({ months: 2, alignEnd: false });
75
83
  useEffect(() => {
76
84
  setTexts({ start: startText, end: endText });
77
85
  }, [startText, endText]);
@@ -97,6 +105,18 @@ var DateRangePickerComponent = React.forwardRef(
97
105
  commit(edge === "start" ? [date, other] : [other, date]);
98
106
  };
99
107
  const blurHandler = () => setTexts({ start: startText, end: endText });
108
+ const toggle = () => {
109
+ const root = rootRef.current;
110
+ if (!open && root) {
111
+ const em = parseFloat(getComputedStyle(root).fontSize) || 16;
112
+ const room = document.documentElement.clientWidth - root.getBoundingClientRect().left;
113
+ setFit({
114
+ months: room >= TWO_MONTHS_EM * em ? 2 : 1,
115
+ alignEnd: room < ONE_MONTH_EM * em
116
+ });
117
+ }
118
+ setOpen((last) => !last);
119
+ };
100
120
  const pick = (next) => {
101
121
  var _a;
102
122
  commit(next);
@@ -124,7 +144,8 @@ var DateRangePickerComponent = React.forwardRef(
124
144
  "--daterange-margin-right": SCALES.mr(0),
125
145
  "--daterange-margin-bottom": SCALES.mb(0),
126
146
  "--daterange-margin-left": SCALES.ml(0),
127
- "--daterange-bg": theme.palette.background,
147
+ "--daterange-bg": surface.bg,
148
+ "--calendar-popup-hover": surface.hover,
128
149
  "--daterange-border-color": theme.palette.border,
129
150
  "--daterange-radius": rounded ? "25px" : theme.layout.radius,
130
151
  "--daterange-popup-radius": theme.layout.radius,
@@ -138,7 +159,7 @@ var DateRangePickerComponent = React.forwardRef(
138
159
  "--daterange-separator-color": colors.iconColor,
139
160
  "--daterange-toggle-color": colors.iconColor,
140
161
  "--daterange-toggle-hover-color": colors.color,
141
- "--daterange-shadow": theme.expressiveness.shadowMedium,
162
+ "--daterange-shadow": surface.shadow,
142
163
  ...style
143
164
  };
144
165
  const inputProps = {
@@ -195,7 +216,7 @@ var DateRangePickerComponent = React.forwardRef(
195
216
  "aria-haspopup": "dialog",
196
217
  "aria-expanded": open,
197
218
  disabled,
198
- onClick: () => setOpen((last) => !last),
219
+ onClick: toggle,
199
220
  children: /* @__PURE__ */ jsxs(
200
221
  "svg",
201
222
  {
@@ -222,13 +243,15 @@ var DateRangePickerComponent = React.forwardRef(
222
243
  {
223
244
  role: "dialog",
224
245
  "aria-label": calendarLabel,
225
- className: DateRangePicker_module_css_default.popup,
246
+ className: joinClasses(DateRangePicker_module_css_default.popup, {
247
+ [DateRangePicker_module_css_default.alignEnd]: fit.alignEnd
248
+ }),
226
249
  onKeyDown: keyDownHandler,
227
250
  children: /* @__PURE__ */ jsx(
228
251
  Calendar_default,
229
252
  {
230
253
  mode: "range",
231
- numberOfMonths: 2,
254
+ numberOfMonths: fit.months,
232
255
  autoFocus: true,
233
256
  value: range,
234
257
  min,