@bolio-ui/core 3.0.0-alpha.0 → 3.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/dist/BolioUIProvider/index.js +3 -3
  2. package/dist/Calendar/Calendar.d.ts +1 -0
  3. package/dist/Calendar/index.js +2 -2
  4. package/dist/Carousel/Carousel.d.ts +21 -0
  5. package/dist/Carousel/index.d.ts +3 -0
  6. package/dist/Carousel/index.js +14 -0
  7. package/dist/Collapse/Collapse.d.ts +3 -0
  8. package/dist/Collapse/index.js +3 -3
  9. package/dist/ColorInput/ColorInput.d.ts +24 -0
  10. package/dist/ColorInput/index.d.ts +3 -0
  11. package/dist/ColorInput/index.js +20 -0
  12. package/dist/ColorPicker/ColorPicker.d.ts +17 -0
  13. package/dist/ColorPicker/color-utils.d.ts +10 -0
  14. package/dist/ColorPicker/index.d.ts +3 -0
  15. package/dist/ColorPicker/index.js +14 -0
  16. package/dist/Command/index.js +4 -4
  17. package/dist/ContextMenu/ContextMenu.d.ts +13 -0
  18. package/dist/ContextMenu/index.d.ts +3 -0
  19. package/dist/ContextMenu/index.js +25 -0
  20. package/dist/CssBaseline/index.js +2 -2
  21. package/dist/DatePicker/index.js +3 -3
  22. package/dist/DateRangePicker/DateRangePicker.d.ts +29 -0
  23. package/dist/DateRangePicker/index.d.ts +3 -0
  24. package/dist/DateRangePicker/index.js +19 -0
  25. package/dist/Drawer/index.js +2 -2
  26. package/dist/Dropzone/Dropzone.d.ts +25 -0
  27. package/dist/Dropzone/DropzoneThumbnail.d.ts +9 -0
  28. package/dist/Dropzone/index.d.ts +3 -0
  29. package/dist/Dropzone/index.js +14 -0
  30. package/dist/ImageZoom/ImageZoom.d.ts +14 -0
  31. package/dist/ImageZoom/index.d.ts +3 -0
  32. package/dist/ImageZoom/index.js +17 -0
  33. package/dist/Menu/index.js +3 -3
  34. package/dist/Modal/index.js +2 -2
  35. package/dist/PinInput/PinInput.d.ts +25 -0
  36. package/dist/PinInput/index.d.ts +3 -0
  37. package/dist/PinInput/index.js +16 -0
  38. package/dist/SegmentedControl/SegmentedControl.d.ts +16 -0
  39. package/dist/SegmentedControl/SegmentedControlContext.d.ts +10 -0
  40. package/dist/SegmentedControl/SegmentedControlItem.d.ts +13 -0
  41. package/dist/SegmentedControl/index.d.ts +10 -0
  42. package/dist/SegmentedControl/index.js +14 -0
  43. package/dist/Select/SelectDropdown.d.ts +2 -0
  44. package/dist/Select/index.js +6 -6
  45. package/dist/Slider/index.js +3 -3
  46. package/dist/Splitter/Splitter.d.ts +14 -0
  47. package/dist/Splitter/SplitterContext.d.ts +6 -0
  48. package/dist/Splitter/SplitterPanel.d.ts +13 -0
  49. package/dist/Splitter/index.d.ts +9 -0
  50. package/dist/Splitter/index.js +14 -0
  51. package/dist/Table/Table.d.ts +11 -1
  52. package/dist/Table/TableBody.d.ts +8 -2
  53. package/dist/Table/TableColumn.d.ts +2 -0
  54. package/dist/Table/TableHead.d.ts +9 -1
  55. package/dist/Table/TableSelectBox.d.ts +9 -0
  56. package/dist/Table/TableTypes.d.ts +8 -0
  57. package/dist/Table/index.d.ts +1 -1
  58. package/dist/Table/index.js +3 -3
  59. package/dist/TagsInput/TagsInput.d.ts +26 -0
  60. package/dist/TagsInput/index.d.ts +3 -0
  61. package/dist/TagsInput/index.js +17 -0
  62. package/dist/Tour/Tour.d.ts +26 -0
  63. package/dist/Tour/index.d.ts +3 -0
  64. package/dist/Tour/index.js +23 -0
  65. package/dist/Tree/Tree.d.ts +17 -0
  66. package/dist/Tree/TreeContext.d.ts +17 -0
  67. package/dist/Tree/TreeNode.d.ts +8 -0
  68. package/dist/Tree/index.d.ts +3 -0
  69. package/dist/Tree/index.js +14 -0
  70. package/dist/chunk-2A4BSQ66.js +130 -0
  71. package/dist/{chunk-HIFS4JIO.js → chunk-2EYJZXS4.js} +7 -7
  72. package/dist/chunk-3S6G7WGK.js +109 -0
  73. package/dist/chunk-4X4ELIMQ.js +231 -0
  74. package/dist/{chunk-UVVBMWR4.js → chunk-AG2NWQYL.js} +18 -4
  75. package/dist/chunk-BHQRX76X.js +275 -0
  76. package/dist/{chunk-YHZFOVVI.js → chunk-DIMJQLWY.js} +27 -37
  77. package/dist/chunk-FFEAKF3A.js +220 -0
  78. package/dist/{chunk-6BCLZSSK.js → chunk-FL6J36B7.js} +5 -4
  79. package/dist/chunk-G4KB56RO.js +217 -0
  80. package/dist/chunk-IJGIEX5J.js +211 -0
  81. package/dist/chunk-K6UULETP.js +244 -0
  82. package/dist/chunk-MDSRXACM.js +212 -0
  83. package/dist/chunk-OKZRHSSG.js +271 -0
  84. package/dist/{chunk-IBC5BABS.js → chunk-P245HSVB.js} +190 -155
  85. package/dist/chunk-REWKR7S3.js +109 -0
  86. package/dist/chunk-STYC6O24.js +232 -0
  87. package/dist/{chunk-FQU5SKDF.js → chunk-WFGUAR7K.js} +58 -24
  88. package/dist/{chunk-6KMHJRCY.js → chunk-WIIDIZYK.js} +4 -1
  89. package/dist/chunk-X4TPC7HS.js +160 -0
  90. package/dist/{chunk-TKICX5R6.js → chunk-ZNDN2VPZ.js} +225 -33
  91. package/dist/css/Button-ButtonIcon.css +3 -2
  92. package/dist/css/ButtonDropdown-ButtonDropdownItem.css +0 -1
  93. package/dist/css/Calendar.css +11 -1
  94. package/dist/css/Carousel.css +127 -0
  95. package/dist/css/Collapse.css +29 -9
  96. package/dist/css/ColorInput.css +95 -0
  97. package/dist/css/ColorPicker.css +183 -0
  98. package/dist/css/ContextMenu.css +17 -0
  99. package/dist/css/DatePicker.css +1 -1
  100. package/dist/css/DateRangePicker.css +113 -0
  101. package/dist/css/Dropzone.css +160 -0
  102. package/dist/css/ImageZoom.css +93 -0
  103. package/dist/css/Input.css +3 -3
  104. package/dist/css/NumberInput.css +4 -4
  105. package/dist/css/PinInput.css +40 -0
  106. package/dist/css/SegmentedControl-SegmentedControlItem.css +65 -0
  107. package/dist/css/SegmentedControl.css +13 -0
  108. package/dist/css/Select-SelectDropdown.css +4 -2
  109. package/dist/css/Select-SelectMultipleValue.css +1 -0
  110. package/dist/css/Select-SelectOption.css +27 -7
  111. package/dist/css/Select.css +2 -1
  112. package/dist/css/Splitter.css +77 -0
  113. package/dist/css/Table-TableBody.css +10 -0
  114. package/dist/css/Table-TableHead.css +41 -0
  115. package/dist/css/Table-TableSelectBox.css +11 -0
  116. package/dist/css/TagsInput.css +99 -0
  117. package/dist/css/Tour.css +81 -0
  118. package/dist/css/Tree.css +88 -0
  119. package/dist/index.d.ts +27 -1
  120. package/dist/index.js +98 -46
  121. package/dist/styles.css +3902 -2520
  122. package/esm/BolioUIProvider/index.js +2 -2
  123. package/esm/Calendar/Calendar.d.ts +1 -0
  124. package/esm/Calendar/index.js +1 -1
  125. package/esm/Carousel/Carousel.d.ts +21 -0
  126. package/esm/Carousel/index.d.ts +3 -0
  127. package/esm/Carousel/index.js +14 -0
  128. package/esm/Collapse/Collapse.d.ts +3 -0
  129. package/esm/Collapse/index.js +2 -2
  130. package/esm/ColorInput/ColorInput.d.ts +24 -0
  131. package/esm/ColorInput/index.d.ts +3 -0
  132. package/esm/ColorInput/index.js +20 -0
  133. package/esm/ColorPicker/ColorPicker.d.ts +17 -0
  134. package/esm/ColorPicker/color-utils.d.ts +10 -0
  135. package/esm/ColorPicker/index.d.ts +3 -0
  136. package/esm/ColorPicker/index.js +14 -0
  137. package/esm/Command/index.js +4 -4
  138. package/esm/ContextMenu/ContextMenu.d.ts +13 -0
  139. package/esm/ContextMenu/index.d.ts +3 -0
  140. package/esm/ContextMenu/index.js +25 -0
  141. package/esm/CssBaseline/index.js +1 -1
  142. package/esm/DatePicker/index.js +2 -2
  143. package/esm/DateRangePicker/DateRangePicker.d.ts +29 -0
  144. package/esm/DateRangePicker/index.d.ts +3 -0
  145. package/esm/DateRangePicker/index.js +19 -0
  146. package/esm/Drawer/index.js +2 -2
  147. package/esm/Dropzone/Dropzone.d.ts +25 -0
  148. package/esm/Dropzone/DropzoneThumbnail.d.ts +9 -0
  149. package/esm/Dropzone/index.d.ts +3 -0
  150. package/esm/Dropzone/index.js +14 -0
  151. package/esm/ImageZoom/ImageZoom.d.ts +14 -0
  152. package/esm/ImageZoom/index.d.ts +3 -0
  153. package/esm/ImageZoom/index.js +17 -0
  154. package/esm/Menu/index.js +2 -2
  155. package/esm/Modal/index.js +2 -2
  156. package/esm/PinInput/PinInput.d.ts +25 -0
  157. package/esm/PinInput/index.d.ts +3 -0
  158. package/esm/PinInput/index.js +16 -0
  159. package/esm/SegmentedControl/SegmentedControl.d.ts +16 -0
  160. package/esm/SegmentedControl/SegmentedControlContext.d.ts +10 -0
  161. package/esm/SegmentedControl/SegmentedControlItem.d.ts +13 -0
  162. package/esm/SegmentedControl/index.d.ts +10 -0
  163. package/esm/SegmentedControl/index.js +14 -0
  164. package/esm/Select/SelectDropdown.d.ts +2 -0
  165. package/esm/Select/index.js +5 -5
  166. package/esm/Slider/index.js +2 -2
  167. package/esm/Splitter/Splitter.d.ts +14 -0
  168. package/esm/Splitter/SplitterContext.d.ts +6 -0
  169. package/esm/Splitter/SplitterPanel.d.ts +13 -0
  170. package/esm/Splitter/index.d.ts +9 -0
  171. package/esm/Splitter/index.js +14 -0
  172. package/esm/Table/Table.d.ts +11 -1
  173. package/esm/Table/TableBody.d.ts +8 -2
  174. package/esm/Table/TableColumn.d.ts +2 -0
  175. package/esm/Table/TableHead.d.ts +9 -1
  176. package/esm/Table/TableSelectBox.d.ts +9 -0
  177. package/esm/Table/TableTypes.d.ts +8 -0
  178. package/esm/Table/index.d.ts +1 -1
  179. package/esm/Table/index.js +2 -2
  180. package/esm/TagsInput/TagsInput.d.ts +26 -0
  181. package/esm/TagsInput/index.d.ts +3 -0
  182. package/esm/TagsInput/index.js +17 -0
  183. package/esm/Tour/Tour.d.ts +26 -0
  184. package/esm/Tour/index.d.ts +3 -0
  185. package/esm/Tour/index.js +23 -0
  186. package/esm/Tree/Tree.d.ts +17 -0
  187. package/esm/Tree/TreeContext.d.ts +17 -0
  188. package/esm/Tree/TreeNode.d.ts +8 -0
  189. package/esm/Tree/index.d.ts +3 -0
  190. package/esm/Tree/index.js +14 -0
  191. package/esm/chunk-2A4BSQ66.js +130 -0
  192. package/esm/{chunk-HIFS4JIO.js → chunk-2EYJZXS4.js} +4 -4
  193. package/esm/chunk-3S6G7WGK.js +109 -0
  194. package/esm/chunk-4X4ELIMQ.js +231 -0
  195. package/esm/{chunk-UVVBMWR4.js → chunk-AG2NWQYL.js} +18 -4
  196. package/esm/chunk-BHQRX76X.js +275 -0
  197. package/esm/{chunk-YHZFOVVI.js → chunk-DIMJQLWY.js} +27 -37
  198. package/esm/chunk-FFEAKF3A.js +220 -0
  199. package/esm/{chunk-6BCLZSSK.js → chunk-FL6J36B7.js} +4 -3
  200. package/esm/chunk-G4KB56RO.js +217 -0
  201. package/esm/chunk-IJGIEX5J.js +211 -0
  202. package/esm/chunk-K6UULETP.js +244 -0
  203. package/esm/chunk-MDSRXACM.js +212 -0
  204. package/esm/chunk-OKZRHSSG.js +271 -0
  205. package/esm/chunk-P245HSVB.js +450 -0
  206. package/esm/chunk-REWKR7S3.js +109 -0
  207. package/esm/chunk-STYC6O24.js +232 -0
  208. package/esm/{chunk-FQU5SKDF.js → chunk-WFGUAR7K.js} +60 -26
  209. package/esm/{chunk-6KMHJRCY.js → chunk-WIIDIZYK.js} +4 -1
  210. package/esm/chunk-X4TPC7HS.js +160 -0
  211. package/esm/chunk-ZNDN2VPZ.js +543 -0
  212. package/esm/css/Button-ButtonIcon.css +3 -2
  213. package/esm/css/ButtonDropdown-ButtonDropdownItem.css +0 -1
  214. package/esm/css/Calendar.css +11 -1
  215. package/esm/css/Carousel.css +127 -0
  216. package/esm/css/Collapse.css +29 -9
  217. package/esm/css/ColorInput.css +95 -0
  218. package/esm/css/ColorPicker.css +183 -0
  219. package/esm/css/ContextMenu.css +17 -0
  220. package/esm/css/DatePicker.css +1 -1
  221. package/esm/css/DateRangePicker.css +113 -0
  222. package/esm/css/Dropzone.css +160 -0
  223. package/esm/css/ImageZoom.css +93 -0
  224. package/esm/css/Input.css +3 -3
  225. package/esm/css/NumberInput.css +4 -4
  226. package/esm/css/PinInput.css +40 -0
  227. package/esm/css/SegmentedControl-SegmentedControlItem.css +65 -0
  228. package/esm/css/SegmentedControl.css +13 -0
  229. package/esm/css/Select-SelectDropdown.css +4 -2
  230. package/esm/css/Select-SelectMultipleValue.css +1 -0
  231. package/esm/css/Select-SelectOption.css +27 -7
  232. package/esm/css/Select.css +2 -1
  233. package/esm/css/Splitter.css +77 -0
  234. package/esm/css/Table-TableBody.css +10 -0
  235. package/esm/css/Table-TableHead.css +41 -0
  236. package/esm/css/Table-TableSelectBox.css +11 -0
  237. package/esm/css/TagsInput.css +99 -0
  238. package/esm/css/Tour.css +81 -0
  239. package/esm/css/Tree.css +88 -0
  240. package/esm/index.d.ts +27 -1
  241. package/esm/index.js +115 -63
  242. package/esm/styles.css +3564 -2182
  243. package/package.json +3 -3
  244. package/esm/chunk-IBC5BABS.js +0 -415
  245. package/esm/chunk-TKICX5R6.js +0 -351
  246. package/dist/{chunk-2PRUFY2Q.js → chunk-4ZGR7UMX.js} +2 -2
  247. package/dist/{chunk-FLK7EAOE.js → chunk-IUZV5Y27.js} +2 -2
  248. package/esm/{chunk-2PRUFY2Q.js → chunk-4ZGR7UMX.js} +3 -3
  249. package/esm/{chunk-FLK7EAOE.js → chunk-IUZV5Y27.js} +3 -3
@@ -35,47 +35,136 @@ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
35
35
  // core/Table/TableHead.tsx
36
36
 
37
37
 
38
+ // core/Table/TableSelectBox.tsx
39
+
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
+ var _jsxruntime = require('react/jsx-runtime');
46
+ function TableSelectBox({
47
+ checked,
48
+ indeterminate = false,
49
+ label,
50
+ onChange
51
+ }) {
52
+ const ref = _react.useRef.call(void 0, null);
53
+ _react.useEffect.call(void 0, () => {
54
+ if (ref.current) ref.current.indeterminate = indeterminate;
55
+ }, [indeterminate]);
56
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
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
+
38
71
  // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Table/TableHead.module.css.bolio-css-module-source
39
- var TableHead_module_css_default = { "thead": "TableHead-module_thead__zMtMt", "th": "TableHead-module_th__GzIce", "theadBox": "TableHead-module_theadBox__6QaBJ" };
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" };
40
73
 
41
74
  // core/Table/TableHead.tsx
42
- var _jsxruntime = require('react/jsx-runtime');
43
- var makeColgroup = (width, columns) => {
75
+
76
+ var SELECT_WIDTH = 40;
77
+ var makeColgroup = (fullWidth, columns, leading) => {
78
+ const width = fullWidth - leading;
44
79
  const unsetWidthCount = columns.filter((c) => !c.width).length;
45
80
  const customWidthTotal = columns.reduce((pre, current) => {
46
81
  return current.width ? pre + current.width : pre;
47
82
  }, 0);
48
83
  const averageWidth = (width - customWidthTotal) / unsetWidthCount;
49
84
  if (averageWidth <= 0) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "colgroup", {});
50
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "colgroup", { children: columns.map((column, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "col", { width: column.width || averageWidth }, `colgroup-${index}`)) });
85
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "colgroup", { children: [
86
+ leading > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "col", { width: leading }),
87
+ columns.map((column, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "col", { width: column.width || averageWidth }, `colgroup-${index}`))
88
+ ] });
51
89
  };
52
90
  var TableHead = (props) => {
53
91
  const theme = _chunkV5I4ORQQjs.use_theme_default.call(void 0, );
54
- const { columns, width } = props;
92
+ const { columns, width, sort, onSort, selection } = props;
55
93
  const isScalableWidth = _react.useMemo.call(void 0,
56
94
  () => columns.find((item) => !!item.width),
57
95
  [columns]
58
96
  );
59
97
  const colgroup = _react.useMemo.call(void 0, () => {
60
98
  if (!isScalableWidth) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "colgroup", {});
61
- return makeColgroup(width, columns);
62
- }, [isScalableWidth, width, columns]);
99
+ return makeColgroup(width, columns, selection ? SELECT_WIDTH : 0);
100
+ }, [isScalableWidth, width, columns, selection]);
63
101
  const theadStyle = {
64
102
  "--table-head-text-color": theme.palette.accents_5,
65
103
  "--table-head-bg": theme.palette.accents_1,
66
104
  "--table-head-border-color": theme.palette.border,
67
- "--table-head-radius": theme.layout.radius
105
+ "--table-head-radius": theme.layout.radius,
106
+ "--table-head-sorted-color": theme.palette.foreground,
107
+ "--table-head-focus-color": theme.palette.primary
68
108
  };
69
109
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
70
110
  colgroup,
71
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { className: TableHead_module_css_default.thead, style: theadStyle, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: columns.map((column, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
72
- "th",
73
- {
74
- className: _chunk5KUROAEPjs.joinClasses.call(void 0, TableHead_module_css_default.th, column.className),
75
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: TableHead_module_css_default.theadBox, children: column.label })
76
- },
77
- `table-th-${String(column.prop)}-${index}`
78
- )) }) })
111
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { className: TableHead_module_css_default.thead, style: theadStyle, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { children: [
112
+ selection && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: _chunk5KUROAEPjs.joinClasses.call(void 0, TableHead_module_css_default.th, TableHead_module_css_default.selectCell), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: TableHead_module_css_default.theadBox, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
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__ */ _jsxruntime.jsx.call(void 0,
125
+ "th",
126
+ {
127
+ className: _chunk5KUROAEPjs.joinClasses.call(void 0, TableHead_module_css_default.th, column.className),
128
+ "aria-sort": column.sortable ? direction === "asc" ? "ascending" : direction === "desc" ? "descending" : "none" : void 0,
129
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: TableHead_module_css_default.theadBox, children: column.sortable ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
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__ */ _jsxruntime.jsx.call(void 0,
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: _chunk5KUROAEPjs.joinClasses.call(void 0, TableHead_module_css_default.sortIcon, {
149
+ [TableHead_module_css_default.sorted]: direction !== null
150
+ }),
151
+ "aria-hidden": "true",
152
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
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
+ ] }) })
79
168
  ] });
80
169
  };
81
170
  TableHead.displayName = "BolioUITableHead";
@@ -122,12 +211,14 @@ var TableContext = _react2.default.createContext(defaultContext);
122
211
  var useTableContext = () => _react2.default.useContext(TableContext);
123
212
 
124
213
  // css-module-source:/Users/brunnoandrade/Desktop/BolioUI/bolio-ui/core/Table/TableBody.module.css.bolio-css-module-source
125
- var TableBody_module_css_default = { "tr": "TableBody-module_tr__lTn-M", "hover": "TableBody-module_hover__AjVlq" };
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" };
126
215
 
127
216
  // core/Table/TableBody.tsx
128
217
 
129
218
  var TableBody = ({
130
219
  data,
220
+ keys,
221
+ selection,
131
222
  hover,
132
223
  emptyText,
133
224
  onRow,
@@ -142,30 +233,42 @@ var TableBody = ({
142
233
  const trStyle = {
143
234
  "--table-body-hover-bg": theme.palette.accents_1,
144
235
  "--table-body-border-color": theme.palette.border,
145
- "--table-body-text-color": theme.palette.accents_6
236
+ "--table-body-text-color": theme.palette.accents_6,
237
+ "--table-body-selected-bg": `color-mix(in srgb, ${theme.palette.primary} 10%, transparent)`
146
238
  };
147
239
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: data.map((row, index) => {
148
240
  const className = rowClassName(row, index);
149
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
241
+ const selected = Boolean(selection == null ? void 0 : selection.keys.includes(keys[index]));
242
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
150
243
  "tr",
151
244
  {
152
245
  className: _chunk5KUROAEPjs.joinClasses.call(void 0,
153
246
  TableBody_module_css_default.tr,
154
- { [TableBody_module_css_default.hover]: hover },
247
+ { [TableBody_module_css_default.hover]: hover, [TableBody_module_css_default.selected]: selected },
155
248
  className
156
249
  ),
157
250
  onClick: () => rowClickHandler(row, index),
158
251
  style: trStyle,
159
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
160
- TableCell_default,
161
- {
162
- columns,
163
- row,
164
- rowIndex: index,
165
- emptyText,
166
- onCellClick: onCell
167
- }
168
- )
252
+ children: [
253
+ selection && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: TableBody_module_css_default.selectCell, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "cell", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
254
+ TableSelectBox_default,
255
+ {
256
+ checked: selected,
257
+ label: selection.label,
258
+ onChange: () => selection.onToggle(keys[index])
259
+ }
260
+ ) }) }),
261
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
262
+ TableCell_default,
263
+ {
264
+ columns,
265
+ row,
266
+ rowIndex: index,
267
+ emptyText,
268
+ onCellClick: onCell
269
+ }
270
+ )
271
+ ]
169
272
  },
170
273
  `tbody-row-${index}`
171
274
  );
@@ -185,6 +288,8 @@ var TableColumn = (columnProps) => {
185
288
  label,
186
289
  width,
187
290
  className = "",
291
+ sortable = false,
292
+ sorter,
188
293
  render: renderHandler = defaultRender
189
294
  } = columnProps;
190
295
  const { updateColumn } = useTableContext();
@@ -198,9 +303,21 @@ var TableColumn = (columnProps) => {
198
303
  prop: safeProp,
199
304
  width,
200
305
  className,
306
+ sortable,
307
+ sorter,
201
308
  renderHandler
202
309
  });
203
- }, [children, label, safeProp, width, className, renderHandler, updateColumn]);
310
+ }, [
311
+ children,
312
+ label,
313
+ safeProp,
314
+ width,
315
+ className,
316
+ sortable,
317
+ sorter,
318
+ renderHandler,
319
+ updateColumn
320
+ ]);
204
321
  return null;
205
322
  };
206
323
  TableColumn.displayName = "BolioUITableColumn";
@@ -211,6 +328,11 @@ var Table_module_css_default = { "table": "Table-module_table__H9ZOx", "footer":
211
328
 
212
329
  // core/Table/Table.tsx
213
330
 
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
+ });
214
336
  var defaultProps = {
215
337
  hover: true,
216
338
  initialData: [],
@@ -232,9 +354,20 @@ function TableComponent(tableProps, forwardedRef) {
232
354
  pagination,
233
355
  className = defaultProps.className,
234
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",
235
367
  style,
236
368
  ...props
237
369
  } = tableProps;
370
+ const theme = _chunkV5I4ORQQjs.use_theme_default.call(void 0, );
238
371
  const { SCALES } = _chunkMAICNLTYjs.use_scale_default.call(void 0, );
239
372
  const tableRef = _react.useRef.call(void 0, null);
240
373
  _react.useImperativeHandle.call(void 0, forwardedRef, () => tableRef.current);
@@ -266,12 +399,50 @@ function TableComponent(tableProps, forwardedRef) {
266
399
  setData(customData);
267
400
  }, [customData]);
268
401
  _chunkJJFOGZ6Vjs.use_resize_default.call(void 0, () => updateShape());
402
+ const [selfSort, setSelfSort] = _react.useState.call(void 0, initialSort);
403
+ const sort = customSort !== void 0 ? customSort : selfSort;
404
+ const [selfKeys, setSelfKeys] = _react.useState.call(void 0, 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 = _react.useMemo.call(void 0, () => {
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]);
269
415
  const [selfPage, setSelfPage] = _react.useState.call(void 0, 1);
270
416
  const pageSize = pagination ? Math.max(1, pagination.pageSize) : 0;
271
417
  const totalRows = (_a = pagination == null ? void 0 : pagination.total) != null ? _a : data.length;
272
418
  const pageCount = pagination ? Math.ceil(totalRows / pageSize) : 0;
273
419
  const page = Math.min((_b = pagination == null ? void 0 : pagination.page) != null ? _b : selfPage, Math.max(pageCount, 1));
274
- const rows = pagination && pagination.total === void 0 ? data.slice((page - 1) * pageSize, page * pageSize) : data;
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
+ );
275
446
  const pageChangeHandler = (next) => {
276
447
  if (next === page) return;
277
448
  setSelfPage(next);
@@ -279,6 +450,7 @@ function TableComponent(tableProps, forwardedRef) {
279
450
  };
280
451
  const tableStyle = {
281
452
  "--table-font-size": SCALES.font(1),
453
+ "--table-select-accent": theme.palette.primary,
282
454
  "--table-width": SCALES.width(1, "100%"),
283
455
  "--table-height": SCALES.height(1, "auto"),
284
456
  "--table-padding-top": SCALES.pt(0),
@@ -306,11 +478,31 @@ function TableComponent(tableProps, forwardedRef) {
306
478
  ...props,
307
479
  style: tableStyle,
308
480
  children: [
309
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TableHead_default, { columns, width }),
481
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
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
+ ),
310
496
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
311
497
  TableBody_default,
312
498
  {
313
499
  data: rows,
500
+ keys: pageKeys,
501
+ selection: selectable ? {
502
+ keys: selectedKeys,
503
+ label: selectRowLabel,
504
+ onToggle: toggleKey
505
+ } : void 0,
314
506
  hover,
315
507
  emptyText,
316
508
  onRow,
@@ -6,12 +6,13 @@
6
6
  flex-shrink: 0;
7
7
  color: var(--bolio-ui-button-color);
8
8
  z-index: 1;
9
+ font-size: calc(var(--bolio-ui-button-height) / 2.35);
9
10
  }
10
11
 
11
12
  .ButtonIcon-module_icon__faTDy svg {
12
13
  background: transparent;
13
- height: calc(var(--bolio-ui-button-height) / 2.35);
14
- width: calc(var(--bolio-ui-button-height) / 2.35);
14
+ height: 1em;
15
+ width: 1em;
15
16
  }
16
17
 
17
18
  }
@@ -2,7 +2,6 @@
2
2
  .ButtonDropdownItem-module_button__R-hYv {
3
3
  position: relative;
4
4
  -webkit-appearance: button;
5
- text-rendering: auto;
6
5
  display: inline-flex;
7
6
  flex: 1;
8
7
  justify-content: center;
@@ -11,6 +11,11 @@
11
11
  var(--calendar-margin-bottom) var(--calendar-margin-left);
12
12
  }
13
13
 
14
+ .Calendar-module_months__vypnr {
15
+ display: flex;
16
+ gap: 1.5em;
17
+ }
18
+
14
19
  .Calendar-module_header__d6VGN {
15
20
  display: flex;
16
21
  align-items: center;
@@ -18,6 +23,11 @@
18
23
  margin-bottom: 0.5em;
19
24
  }
20
25
 
26
+ .Calendar-module_navSpacer__TcVxJ {
27
+ flex-shrink: 0;
28
+ width: 2.5em;
29
+ }
30
+
21
31
  .Calendar-module_title__r0GX1 {
22
32
  font-weight: 600;
23
33
  text-transform: capitalize;
@@ -47,7 +57,7 @@
47
57
  font: inherit;
48
58
  color: inherit;
49
59
  cursor: pointer;
50
- background: transparent;
60
+ background-color: transparent;
51
61
  border: 1px solid transparent;
52
62
  border-radius: var(--calendar-radius);
53
63
  appearance: none;
@@ -0,0 +1,127 @@
1
+ @layer Carousel {
2
+ .Carousel-module_carousel__Rr2by {
3
+ box-sizing: border-box;
4
+ color: var(--carousel-color);
5
+ }
6
+
7
+ .Carousel-module_viewport__rbEeR {
8
+ position: relative;
9
+ display: flex;
10
+ gap: var(--carousel-gap);
11
+ overflow-x: auto;
12
+ scroll-snap-type: x mandatory;
13
+ scroll-behavior: smooth;
14
+ scrollbar-width: none;
15
+ border-radius: var(--carousel-radius);
16
+ }
17
+
18
+ .Carousel-module_viewport__rbEeR::-webkit-scrollbar {
19
+ display: none;
20
+ }
21
+
22
+ .Carousel-module_viewport__rbEeR:focus-visible {
23
+ outline: 2px solid var(--carousel-focus);
24
+ outline-offset: 2px;
25
+ }
26
+
27
+ @media (prefers-reduced-motion: reduce) {
28
+ .Carousel-module_viewport__rbEeR {
29
+ scroll-behavior: auto;
30
+ }
31
+ }
32
+
33
+ .Carousel-module_slide__xIqxO {
34
+ flex: 0 0
35
+ calc(
36
+ (100% - (var(--carousel-visible) - 1) * var(--carousel-gap)) /
37
+ var(--carousel-visible)
38
+ );
39
+ min-width: 0;
40
+ scroll-snap-align: start;
41
+ }
42
+
43
+ .Carousel-module_footer__ySplI {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: space-between;
47
+ gap: 0.75em;
48
+ margin-top: 0.75em;
49
+ }
50
+
51
+ .Carousel-module_control__SdAV- {
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ width: 2.25em;
56
+ height: 2.25em;
57
+ margin: 0;
58
+ padding: 0;
59
+ font: inherit;
60
+ color: inherit;
61
+ cursor: pointer;
62
+ background-color: transparent;
63
+ border: 1px solid var(--carousel-border);
64
+ border-radius: 50%;
65
+ appearance: none;
66
+ -webkit-appearance: none;
67
+ }
68
+
69
+ .Carousel-module_control__SdAV-:hover:not(:disabled) {
70
+ background-color: var(--carousel-hover-bg);
71
+ }
72
+
73
+ .Carousel-module_control__SdAV-:focus-visible,
74
+ .Carousel-module_indicator__YSuaU:focus-visible {
75
+ outline: 2px solid var(--carousel-focus);
76
+ outline-offset: 2px;
77
+ }
78
+
79
+ .Carousel-module_control__SdAV-:disabled {
80
+ cursor: not-allowed;
81
+ opacity: 0.4;
82
+ }
83
+
84
+ .Carousel-module_indicators__ZtrIN {
85
+ display: flex;
86
+ flex: 1;
87
+ align-items: center;
88
+ justify-content: center;
89
+ gap: 0.25em;
90
+ }
91
+
92
+ /* the dot is drawn inside a larger button, so it is easy to hit */
93
+ .Carousel-module_indicator__YSuaU {
94
+ position: relative;
95
+ width: 1.5em;
96
+ height: 1.5em;
97
+ margin: 0;
98
+ padding: 0;
99
+ cursor: pointer;
100
+ background-color: transparent;
101
+ border: 0;
102
+ appearance: none;
103
+ -webkit-appearance: none;
104
+ }
105
+
106
+ .Carousel-module_indicator__YSuaU::before {
107
+ position: absolute;
108
+ top: 50%;
109
+ left: 50%;
110
+ width: 0.5em;
111
+ height: 0.5em;
112
+ content: '';
113
+ background-color: var(--carousel-dot);
114
+ border-radius: 50%;
115
+ transform: translate(-50%, -50%);
116
+ transition: background-color 0.2s ease;
117
+ }
118
+
119
+ .Carousel-module_indicator__YSuaU[aria-current] {
120
+ cursor: default;
121
+ }
122
+
123
+ .Carousel-module_indicator__YSuaU[aria-current]::before {
124
+ background-color: var(--carousel-dot-active);
125
+ }
126
+
127
+ }
@@ -1,22 +1,42 @@
1
1
  @layer Collapse {
2
2
  .Collapse-module_view__wymqp {
3
3
  cursor: pointer;
4
- outline: none;
5
4
  }
6
5
 
7
- .Collapse-module_view__wymqp:focus-visible {
8
- outline: 2px solid var(--collapse-focus-color);
9
- outline-offset: 4px;
6
+ .Collapse-module_title__ceZ1h {
7
+ margin: 0;
8
+ font-size: 1em;
10
9
  }
11
10
 
12
- .Collapse-module_title__ceZ1h {
11
+ .Collapse-module_trigger__0Q0YR {
13
12
  display: flex;
14
13
  justify-content: space-between;
15
14
  align-items: center;
15
+ box-sizing: border-box;
16
+ width: 100%;
17
+ margin: 0;
18
+ padding: 0;
19
+ font: inherit;
20
+ text-align: left;
21
+ background: none;
22
+ border: 0;
23
+ outline: none;
24
+ cursor: pointer;
25
+ appearance: none;
26
+ -webkit-appearance: none;
16
27
  }
17
28
 
18
- .Collapse-module_title__ceZ1h h3 {
19
- margin: 0;
29
+ .Collapse-module_trigger__0Q0YR:focus-visible {
30
+ outline: 2px solid var(--collapse-focus-color);
31
+ outline-offset: 4px;
32
+ }
33
+
34
+ .Collapse-module_trigger__0Q0YR:disabled {
35
+ cursor: not-allowed;
36
+ opacity: 0.5;
37
+ }
38
+
39
+ .Collapse-module_label__tdCh3 {
20
40
  font-size: 1.5em;
21
41
  }
22
42
 
@@ -34,11 +54,11 @@
34
54
  }
35
55
 
36
56
  .Collapse-module_content__xZkpG > *:first-child {
37
- margin-top: 0;
57
+ margin-top: 0 !important;
38
58
  }
39
59
 
40
60
  .Collapse-module_content__xZkpG > *:last-child {
41
- margin-bottom: 0;
61
+ margin-bottom: 0 !important;
42
62
  }
43
63
 
44
64
  }