@bodynarf/react.components 1.8.21 → 1.9.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 (256) hide show
  1. package/common.scss +3 -2
  2. package/components/accordion/component/index.d.ts +2 -2
  3. package/components/accordion/component/index.d.ts.map +1 -1
  4. package/components/accordion/component/index.js +4 -4
  5. package/components/accordion/types.d.ts +1 -1
  6. package/components/accordion/types.d.ts.map +1 -1
  7. package/components/anchor/component/index.d.ts +1 -1
  8. package/components/anchor/component/index.d.ts.map +1 -1
  9. package/components/anchor/component/index.js +6 -6
  10. package/components/anchor/components/anchorWithIcon/index.d.ts +3 -2
  11. package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -1
  12. package/components/anchor/components/anchorWithIcon/index.js +14 -9
  13. package/components/anchor/components/simpleAnchor/index.d.ts +3 -2
  14. package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -1
  15. package/components/anchor/components/simpleAnchor/index.js +8 -2
  16. package/components/anchor/types.d.ts +2 -6
  17. package/components/anchor/types.d.ts.map +1 -1
  18. package/components/breadcrumbs/component/index.d.ts +34 -0
  19. package/components/breadcrumbs/component/index.d.ts.map +1 -0
  20. package/components/breadcrumbs/component/index.js +21 -0
  21. package/components/breadcrumbs/index.d.ts +3 -0
  22. package/components/breadcrumbs/index.d.ts.map +1 -0
  23. package/components/breadcrumbs/index.js +2 -0
  24. package/components/breadcrumbs/types.d.ts +13 -0
  25. package/components/breadcrumbs/types.d.ts.map +1 -0
  26. package/components/button/component/index.d.ts +1 -1
  27. package/components/button/component/index.d.ts.map +1 -1
  28. package/components/button/component/index.js +4 -8
  29. package/components/button/components/buttonWithIcon/index.d.ts +3 -2
  30. package/components/button/components/buttonWithIcon/index.d.ts.map +1 -1
  31. package/components/button/components/buttonWithIcon/index.js +14 -9
  32. package/components/button/components/simpleButton/index.d.ts +3 -2
  33. package/components/button/components/simpleButton/index.d.ts.map +1 -1
  34. package/components/button/components/simpleButton/index.js +8 -2
  35. package/components/button/types.d.ts +1 -1
  36. package/components/button/types.d.ts.map +1 -1
  37. package/components/button/types.js +0 -3
  38. package/components/dropdown/component/index.d.ts +1 -1
  39. package/components/dropdown/component/index.d.ts.map +1 -1
  40. package/components/dropdown/component/index.js +5 -8
  41. package/components/dropdown/component/style.scss +5 -1
  42. package/components/dropdown/components/compact/index.d.ts +2 -2
  43. package/components/dropdown/components/compact/index.d.ts.map +1 -1
  44. package/components/dropdown/components/compact/index.js +12 -9
  45. package/components/dropdown/components/item/index.d.ts +1 -1
  46. package/components/dropdown/components/item/index.d.ts.map +1 -1
  47. package/components/dropdown/components/item/index.js +34 -2
  48. package/components/dropdown/components/label/index.d.ts +1 -1
  49. package/components/dropdown/components/label/index.d.ts.map +1 -1
  50. package/components/dropdown/components/label/index.js +41 -9
  51. package/components/dropdown/components/withLabel/index.d.ts +2 -2
  52. package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
  53. package/components/dropdown/components/withLabel/index.js +14 -12
  54. package/components/dropdown/types.d.ts +13 -2
  55. package/components/dropdown/types.d.ts.map +1 -1
  56. package/components/icon/component/index.d.ts +2 -2
  57. package/components/icon/component/index.d.ts.map +1 -1
  58. package/components/icon/component/index.js +9 -5
  59. package/components/icon/types.d.ts +2 -4
  60. package/components/icon/types.d.ts.map +1 -1
  61. package/components/index.d.ts +0 -1
  62. package/components/index.d.ts.map +1 -1
  63. package/components/index.js +0 -1
  64. package/components/paginator/component/index.d.ts +2 -2
  65. package/components/paginator/component/index.d.ts.map +1 -1
  66. package/components/paginator/component/index.js +19 -14
  67. package/components/paginator/types.d.ts +3 -5
  68. package/components/paginator/types.d.ts.map +1 -1
  69. package/components/primitives/checkbox/component/index.d.ts +2 -2
  70. package/components/primitives/checkbox/component/index.d.ts.map +1 -1
  71. package/components/primitives/checkbox/component/index.js +15 -17
  72. package/components/primitives/checkbox/types.d.ts +2 -2
  73. package/components/primitives/checkbox/types.d.ts.map +1 -1
  74. package/components/primitives/color/component/index.d.ts.map +1 -1
  75. package/components/primitives/color/components/picker/index.d.ts +11 -29
  76. package/components/primitives/color/components/picker/index.d.ts.map +1 -1
  77. package/components/primitives/color/components/picker/index.js +20 -17
  78. package/components/primitives/color/components/withLabel/index.d.ts +1 -1
  79. package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
  80. package/components/primitives/color/components/withLabel/index.js +8 -30
  81. package/components/primitives/color/components/withoutLabel/index.d.ts +1 -1
  82. package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
  83. package/components/primitives/color/components/withoutLabel/index.js +3 -13
  84. package/components/primitives/color/types.d.ts +1 -1
  85. package/components/primitives/color/types.d.ts.map +1 -1
  86. package/components/primitives/date/component/index.d.ts +2 -2
  87. package/components/primitives/date/component/index.d.ts.map +1 -1
  88. package/components/primitives/date/component/index.js +12 -27
  89. package/components/primitives/date/types.d.ts +2 -2
  90. package/components/primitives/date/types.d.ts.map +1 -1
  91. package/components/primitives/index.d.ts +0 -1
  92. package/components/primitives/index.d.ts.map +1 -1
  93. package/components/primitives/index.js +0 -1
  94. package/components/primitives/internal/componentWithLabel/index.d.ts +17 -0
  95. package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -0
  96. package/components/primitives/internal/componentWithLabel/index.js +26 -0
  97. package/components/primitives/internal/hint/index.d.ts +13 -0
  98. package/components/primitives/internal/hint/index.d.ts.map +1 -0
  99. package/components/primitives/internal/hint/index.js +47 -0
  100. package/components/primitives/multiline/component/index.d.ts +1 -1
  101. package/components/primitives/multiline/component/index.d.ts.map +1 -1
  102. package/components/primitives/multiline/component/index.js +5 -8
  103. package/components/primitives/multiline/components/withLabel/index.d.ts +6 -0
  104. package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -0
  105. package/components/primitives/multiline/components/withLabel/index.js +29 -0
  106. package/components/primitives/multiline/components/withoutLabel/index.d.ts +6 -0
  107. package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -0
  108. package/components/primitives/multiline/components/withoutLabel/index.js +28 -0
  109. package/components/primitives/multiline/types.d.ts +1 -1
  110. package/components/primitives/multiline/types.d.ts.map +1 -1
  111. package/components/primitives/number/component/index.d.ts +1 -1
  112. package/components/primitives/number/component/index.d.ts.map +1 -1
  113. package/components/primitives/number/component/index.js +5 -8
  114. package/components/primitives/number/components/withLabel/index.d.ts +2 -2
  115. package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
  116. package/components/primitives/number/components/withLabel/index.js +12 -27
  117. package/components/primitives/number/components/withoutLabel/index.d.ts +2 -2
  118. package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
  119. package/components/primitives/number/components/withoutLabel/index.js +11 -9
  120. package/components/primitives/number/types.d.ts +1 -1
  121. package/components/primitives/number/types.d.ts.map +1 -1
  122. package/components/primitives/password/component/index.d.ts +1 -1
  123. package/components/primitives/password/component/index.d.ts.map +1 -1
  124. package/components/primitives/password/component/index.js +5 -6
  125. package/components/primitives/password/components/withLabel/index.d.ts +2 -2
  126. package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
  127. package/components/primitives/password/components/withLabel/index.js +14 -30
  128. package/components/primitives/password/components/withoutLabel/index.d.ts +2 -2
  129. package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
  130. package/components/primitives/password/components/withoutLabel/index.js +13 -11
  131. package/components/primitives/password/types.d.ts +1 -1
  132. package/components/primitives/password/types.d.ts.map +1 -1
  133. package/components/primitives/text/component/index.d.ts +1 -1
  134. package/components/primitives/text/component/index.d.ts.map +1 -1
  135. package/components/primitives/text/component/index.js +5 -8
  136. package/components/primitives/text/components/withLabel/index.d.ts +6 -0
  137. package/components/primitives/text/components/withLabel/index.d.ts.map +1 -0
  138. package/components/primitives/text/components/withLabel/index.js +29 -0
  139. package/components/primitives/text/components/withoutLabel/index.d.ts +6 -0
  140. package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -0
  141. package/components/primitives/text/components/withoutLabel/index.js +28 -0
  142. package/components/primitives/text/types.d.ts +1 -1
  143. package/components/primitives/text/types.d.ts.map +1 -1
  144. package/components/search/component/index.d.ts +2 -2
  145. package/components/search/component/index.d.ts.map +1 -1
  146. package/components/search/component/index.js +16 -10
  147. package/components/search/types.d.ts +2 -2
  148. package/components/search/types.d.ts.map +1 -1
  149. package/components/table/component/index.d.ts +43 -0
  150. package/components/table/component/index.d.ts.map +1 -0
  151. package/components/table/component/index.js +27 -0
  152. package/components/table/components/heading/index.d.ts +13 -0
  153. package/components/table/components/heading/index.d.ts.map +1 -0
  154. package/components/table/components/heading/index.js +21 -0
  155. package/components/table/index.d.ts +3 -0
  156. package/components/table/index.d.ts.map +1 -0
  157. package/components/table/index.js +2 -0
  158. package/components/table/types.d.ts +18 -0
  159. package/components/table/types.d.ts.map +1 -0
  160. package/components/tabs/component/index.d.ts +3 -3
  161. package/components/tabs/component/index.d.ts.map +1 -1
  162. package/components/tabs/component/index.js +14 -8
  163. package/components/tabs/components/item/index.d.ts +1 -1
  164. package/components/tabs/components/item/index.d.ts.map +1 -1
  165. package/components/tabs/components/item/index.js +4 -3
  166. package/components/tabs/types.d.ts +1 -12
  167. package/components/tabs/types.d.ts.map +1 -1
  168. package/components/tabs/types.js +0 -12
  169. package/components/tag/component/index.d.ts +2 -2
  170. package/components/tag/component/index.d.ts.map +1 -1
  171. package/components/tag/component/index.js +13 -7
  172. package/components/tag/types.d.ts +1 -1
  173. package/components/tag/types.d.ts.map +1 -1
  174. package/hooks/usePagination.d.ts.map +1 -1
  175. package/hooks/usePagination.js +11 -2
  176. package/index.d.ts +1 -0
  177. package/index.d.ts.map +1 -1
  178. package/index.js +1 -0
  179. package/package.json +11 -4
  180. package/readme.md +2 -0
  181. package/tsconfig.tsbuildinfo +1 -1
  182. package/types/baseElementProps.d.ts +11 -0
  183. package/types/baseElementProps.d.ts.map +1 -0
  184. package/types/baseElementProps.js +1 -0
  185. package/{components/primitives/types/baseProps.d.ts → types/baseInputElementProps.d.ts} +10 -4
  186. package/types/baseInputElementProps.d.ts.map +1 -0
  187. package/types/baseInputElementProps.js +1 -0
  188. package/types/dataAttributes.d.ts +9 -0
  189. package/types/dataAttributes.d.ts.map +1 -0
  190. package/types/dataAttributes.js +1 -0
  191. package/types/elementColor.d.ts +18 -0
  192. package/types/elementColor.d.ts.map +1 -0
  193. package/types/elementColor.js +18 -0
  194. package/types/elementIcon.d.ts +22 -0
  195. package/types/elementIcon.d.ts.map +1 -0
  196. package/types/elementIcon.js +1 -0
  197. package/types/elementPosition.d.ts +12 -0
  198. package/types/elementPosition.d.ts.map +1 -0
  199. package/types/elementPosition.js +10 -0
  200. package/types/elementSize.d.ts +12 -0
  201. package/types/elementSize.d.ts.map +1 -0
  202. package/types/elementSize.js +12 -0
  203. package/types/hintConfiguration.d.ts +13 -0
  204. package/types/hintConfiguration.d.ts.map +1 -0
  205. package/types/hintConfiguration.js +1 -0
  206. package/types/index.d.ts +11 -0
  207. package/types/index.d.ts.map +1 -0
  208. package/types/index.js +10 -0
  209. package/{components/primitives/types/label.d.ts → types/labelConfiguration.d.ts} +3 -3
  210. package/types/labelConfiguration.d.ts.map +1 -0
  211. package/types/labelConfiguration.js +1 -0
  212. package/{components/primitives/types → types}/validation/index.d.ts +1 -1
  213. package/types/validation/index.d.ts.map +1 -0
  214. package/{components/primitives/types → types}/validation/index.js +1 -1
  215. package/{components/primitives/types → types}/validation/state.d.ts +2 -2
  216. package/types/validation/state.d.ts.map +1 -0
  217. package/{components/primitives/types → types}/validation/state.js +0 -1
  218. package/{components/primitives/types → types}/validation/status.d.ts +1 -1
  219. package/types/validation/status.d.ts.map +1 -0
  220. package/{components/primitives/types → types}/validation/status.js +1 -2
  221. package/utils/dataAttributes.d.ts +1 -1
  222. package/utils/dataAttributes.d.ts.map +1 -1
  223. package/utils/index.d.ts +1 -1
  224. package/utils/index.d.ts.map +1 -1
  225. package/utils/index.js +1 -1
  226. package/utils/validation.d.ts +11 -0
  227. package/utils/validation.d.ts.map +1 -0
  228. package/utils/validation.js +20 -0
  229. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +0 -6
  230. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +0 -1
  231. package/components/primitives/multiline/components/multilineWithLabel/index.js +0 -44
  232. package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts +0 -6
  233. package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +0 -1
  234. package/components/primitives/multiline/components/multilineWithoutLabel/index.js +0 -26
  235. package/components/primitives/text/components/textWithLabel/index.d.ts +0 -6
  236. package/components/primitives/text/components/textWithLabel/index.d.ts.map +0 -1
  237. package/components/primitives/text/components/textWithLabel/index.js +0 -44
  238. package/components/primitives/text/components/textWithoutLabel/index.d.ts +0 -6
  239. package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +0 -1
  240. package/components/primitives/text/components/textWithoutLabel/index.js +0 -26
  241. package/components/primitives/types/baseProps.d.ts.map +0 -1
  242. package/components/primitives/types/index.d.ts +0 -4
  243. package/components/primitives/types/index.d.ts.map +0 -1
  244. package/components/primitives/types/index.js +0 -3
  245. package/components/primitives/types/label.d.ts.map +0 -1
  246. package/components/primitives/types/validation/index.d.ts.map +0 -1
  247. package/components/primitives/types/validation/state.d.ts.map +0 -1
  248. package/components/primitives/types/validation/status.d.ts.map +0 -1
  249. package/components/types.d.ts +0 -78
  250. package/components/types.d.ts.map +0 -1
  251. package/components/types.js +0 -41
  252. package/utils/formValidation.d.ts +0 -16
  253. package/utils/formValidation.d.ts.map +0 -1
  254. package/utils/formValidation.js +0 -35
  255. /package/components/{primitives/types/baseProps.js → breadcrumbs/types.js} +0 -0
  256. /package/components/{primitives/types/label.js → table/types.js} +0 -0
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ import { BaseElementProps } from "../../../types";
3
+ import { SortColumn, TableHeading } from "..";
4
+ /** Table props type */
5
+ export interface TableProps<TItem> extends BaseElementProps {
6
+ /** Header row */
7
+ headings: Array<TableHeading<TItem>>;
8
+ /** Table body */
9
+ children?: React.ReactNode;
10
+ /** Add border to all cells */
11
+ hasBorder?: boolean;
12
+ /** Is row hover effect active */
13
+ hoverable?: boolean;
14
+ /** Reduce space between cells */
15
+ narrow?: boolean;
16
+ /** Use all container width */
17
+ fullWidth?: boolean;
18
+ /** Is header sticks to page on scroll */
19
+ hasStickyHeader?: boolean;
20
+ /**
21
+ * Header has border.
22
+ * @description Applied only with `hasStickyHeader` sets as `true`. Adds border effect
23
+ */
24
+ headerWithBorder?: boolean;
25
+ /** Header has no borders */
26
+ headerBorderless?: boolean;
27
+ /**
28
+ * Should rows be stripped.
29
+ * @description Even rows will have gray background
30
+ */
31
+ zebra?: boolean;
32
+ /** Current sort column */
33
+ currentSortColumn?: SortColumn<TItem>;
34
+ /** Header click handler */
35
+ onHeaderClick?: (columnName: TableHeading<TItem>) => void;
36
+ }
37
+ /**
38
+ * Tiny table component.
39
+ * If no sorting is use - use `any` as generic param
40
+ */
41
+ declare function Table<TItem>({ headings, hasBorder, hoverable, narrow, fullWidth, zebra, headerBorderless, hasStickyHeader, headerWithBorder, currentSortColumn, onHeaderClick, children, className, title, data, }: TableProps<TItem>): JSX.Element;
42
+ export default Table;
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/table/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAG9C,uBAAuB;AACvB,MAAM,WAAW,UAAU,CAAC,KAAK,CAAE,SAAQ,gBAAgB;IACvD,iBAAiB;IACjB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAErC,iBAAiB;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,8BAA8B;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yCAAyC;IACzC,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;MAGE;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,4BAA4B;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;MAGE;IACF,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAEtC,2BAA2B;IAC3B,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED;;;GAGG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,EAClB,QAAQ,EACR,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAChE,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,aAAa,EAChC,QAAQ,EAER,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CA0CjC;AAED,eAAe,KAAK,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { mapDataAttributes } from "../../../utils";
4
+ import TableHeader from "../components/heading";
5
+ /**
6
+ * Tiny table component.
7
+ * If no sorting is use - use `any` as generic param
8
+ */
9
+ function Table({ headings, hasBorder, hoverable, narrow, fullWidth, zebra, headerBorderless, hasStickyHeader, headerWithBorder, currentSortColumn, onHeaderClick, children, className, title, data, }) {
10
+ const elClassName = getClassName([
11
+ "table",
12
+ className,
13
+ hasBorder ? "is-bordered" : "",
14
+ hoverable ? "is-hoverable" : "",
15
+ narrow ? "is-narrow" : "",
16
+ fullWidth ? "is-fullwidth" : "",
17
+ zebra ? "is-striped" : "",
18
+ hasStickyHeader ? "has-sticky-header" : "",
19
+ headerWithBorder ? "has-borderless-header has-shadow-bordered-header" : "",
20
+ headerBorderless ? "has-borderless-header" : "",
21
+ ]);
22
+ const dataAttributes = isNullOrUndefined(data)
23
+ ? undefined
24
+ : mapDataAttributes(data);
25
+ return (_jsxs("table", { className: elClassName, title: title, ...dataAttributes, children: [_jsx("thead", { children: _jsx("tr", { children: headings.map((heading, i) => _jsx(TableHeader, { ...heading, sortColumn: currentSortColumn, onClick: onHeaderClick }, i)) }) }), _jsx("tbody", { children: children })] }));
26
+ }
27
+ export default Table;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { SortColumn, TableHeading } from "../../types";
3
+ /** Table heading cell component props */
4
+ export interface TableHeaderProps<TItem> extends TableHeading<TItem> {
5
+ /** Current sort column */
6
+ sortColumn?: SortColumn<TItem>;
7
+ /** Cell click handler */
8
+ onClick?: (column: TableHeading<TItem>) => void;
9
+ }
10
+ /** Table heading cell */
11
+ declare function TableHeader<TItem>(props: TableHeaderProps<TItem>): JSX.Element;
12
+ export default TableHeader;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/components/heading/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,yCAAyC;AACzC,MAAM,WAAW,gBAAgB,CAAC,KAAK,CAAE,SAAQ,YAAY,CAAC,KAAK,CAAC;IAChE,0BAA0B;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAE/B,yBAAyB;IACzB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CACnD;AAED,yBAAyB;AACzB,iBAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAoCvE;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
4
+ import Icon from "../../../icon";
5
+ /** Table heading cell */
6
+ function TableHeader(props) {
7
+ const { className, caption, name, sortable, sortColumn, onClick } = props;
8
+ const onHeaderClick = useCallback(() => {
9
+ if (sortable && !isNullOrUndefined(onClick)) {
10
+ onClick(props);
11
+ }
12
+ }, [onClick, props, sortable]);
13
+ const containerClassName = getClassName([
14
+ className,
15
+ sortable ? "is-clickable" : "",
16
+ ]);
17
+ return (_jsx("th", { className: containerClassName, onClick: onHeaderClick, children: _jsxs("div", { children: [_jsx("span", { children: caption }), sortable && sortColumn?.columnName === name
18
+ &&
19
+ _jsx(Icon, { className: "ml-1", name: `sort-alpha-down${sortColumn.ascending ? "" : "-alt"}` })] }) }));
20
+ }
21
+ export default TableHeader;
@@ -0,0 +1,3 @@
1
+ export { default } from "./component";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from "./component";
2
+ export * from "./types";
@@ -0,0 +1,18 @@
1
+ export interface TableHeading<TItem> {
2
+ /** Caption to display */
3
+ caption: string;
4
+ /** Is column sortable */
5
+ sortable: boolean;
6
+ /** Class names */
7
+ className: string;
8
+ /** Name of model column*/
9
+ name?: keyof TItem;
10
+ }
11
+ /** Generic sort column model */
12
+ export interface SortColumn<TModel> {
13
+ /** Column name */
14
+ columnName: keyof TModel;
15
+ /** Is column sorted ascending */
16
+ ascending: boolean;
17
+ }
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/table/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY,CAAC,KAAK;IAC/B,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAEhB,0BAA0B;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAElB,kBAAkB;IAClB,SAAS,EAAE,MAAM,CAAC;IAElB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,KAAK,CAAC;CACtB;AAED,gCAAgC;AAChC,MAAM,WAAW,UAAU,CAAC,MAAM;IAC9B,kBAAkB;IAClB,UAAU,EAAE,MAAM,MAAM,CAAC;IAEzB,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;CACtB"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { BaseElementProps, ElementPosition, ElementSize } from "../../../types";
2
3
  import "./style.scss";
3
- import { BaseElementProps, ElementSize } from "../..";
4
- import { TabItem, TabsPosition, TabsStyle } from "../../tabs";
4
+ import { TabItem, TabsStyle } from "..";
5
5
  /** Tabs component props type */
6
6
  export interface TabsProps extends BaseElementProps {
7
7
  /** Tabs */
@@ -19,7 +19,7 @@ export interface TabsProps extends BaseElementProps {
19
19
  */
20
20
  size?: ElementSize;
21
21
  /** Component position */
22
- position?: TabsPosition;
22
+ position?: ElementPosition;
23
23
  /** Component style */
24
24
  style?: TabsStyle;
25
25
  /** Is component tabs should take all width of parent */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tabs/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGxE,gCAAgC;AAChC,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,WAAW;IACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAEtB,8CAA8C;IAC9C,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAE5C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,YAAY,CAAC;IAExB,sBAAsB;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,IAAI,4GAMP,SAAS,KAAG,WA6Ed,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tabs/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG5E,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAGxC,gCAAgC;AAChC,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,WAAW;IACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAEtB,8CAA8C;IAC9C,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAE5C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B,sBAAsB;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AASD;;;GAGG;AACH,QAAA,MAAM,IAAI,4GAQP,SAAS,KAAG,WA8Ed,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,16 +1,22 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useState, useEffect, useRef } from "react";
3
3
  import { getClassName, isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
4
- import "./style.scss";
5
- import { ElementSize } from "../..";
4
+ import { ElementPosition, ElementSize } from "../../../types";
6
5
  import { mapDataAttributes } from "../../../utils";
7
- import { TabsPosition, TabsStyle } from "../../tabs";
8
- import TabItemComponent from "../../tabs/components/item";
6
+ import "./style.scss";
7
+ import { TabsStyle } from "..";
8
+ import TabItemComponent from "../components/item";
9
+ /** Tab position to element class name map */
10
+ const positionToClassNameMap = new Map([
11
+ [ElementPosition.Left, ""],
12
+ [ElementPosition.Center, "is-centered"],
13
+ [ElementPosition.Right, "is-right"],
14
+ ]);
9
15
  /**
10
16
  * Tabs panel
11
17
  * @throws Items are empty
12
18
  */
13
- const Tabs = ({ items, onActiveItemChange, defaultActive = items[0], size, position = TabsPosition.left, style = TabsStyle.default, fullWidth = false, className, title, data, }) => {
19
+ const Tabs = ({ items, onActiveItemChange, defaultActive = items[0], size, position = ElementPosition.Left, style = TabsStyle.default, fullWidth = false, className, title, data, }) => {
14
20
  if (items.length === 0) {
15
21
  throw new Error("Invalid configuration. Tab items must be defined");
16
22
  }
@@ -41,16 +47,16 @@ const Tabs = ({ items, onActiveItemChange, defaultActive = items[0], size, posit
41
47
  const elClassName = getClassName([
42
48
  "bbr-tabs",
43
49
  "tabs",
44
- position,
50
+ className,
51
+ positionToClassNameMap.get(position),
45
52
  getSizeClassName(size, [ElementSize.Normal]),
46
53
  style,
47
54
  fullWidth ? "is-fullwidth" : "",
48
- className,
49
55
  ]);
50
56
  const dataAttributes = isNullOrUndefined(data)
51
57
  ? undefined
52
58
  : mapDataAttributes(data);
53
- return (_jsx("nav", { className: elClassName, onClick: onTabsClick, title: title, ...dataAttributes, children: _jsx("ul", { children: items.map(item => _jsx(TabItemComponent, { item: item, activeItem: activeItem.id }, item.id)) }) }));
59
+ return (_jsx("nav", { onClick: onTabsClick, className: elClassName, title: title, ...dataAttributes, children: _jsx("ul", { children: items.map(item => _jsx(TabItemComponent, { item: item, activeItem: activeItem.id }, item.id)) }) }));
54
60
  };
55
61
  export default Tabs;
56
62
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { TabItem as Item } from "../../../tabs";
2
+ import { TabItem as Item } from "../..";
3
3
  /** Tabs panel single tab item component props type */
4
4
  export interface TabItemProps {
5
5
  /** Tab item */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/tabs/components/item/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAEvD,sDAAsD;AACtD,MAAM,WAAW,YAAY;IACzB,eAAe;IACf,IAAI,EAAE,IAAI,CAAC;IAEX,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,2CAA2C;AAC3C,QAAA,MAAM,OAAO,yBAEV,YAAY,KAAG,WAqBjB,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/tabs/components/item/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,OAAO,CAAC;AAExC,sDAAsD;AACtD,MAAM,WAAW,YAAY;IACzB,eAAe;IACf,IAAI,EAAE,IAAI,CAAC;IAEX,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,2CAA2C;AAC3C,QAAA,MAAM,OAAO,yBAEV,YAAY,KAAG,WAqBjB,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { ElementPosition } from "../../../../types";
3
4
  import Icon from "../../../icon";
4
5
  /** Tabs panel single tab item component */
5
6
  const TabItem = ({ item, activeItem }) => {
@@ -20,8 +21,8 @@ const TabItemWithIcon = ({ item, activeItem }) => {
20
21
  "bbr-tabs__tab",
21
22
  activeItem === item.id ? "is-active" : undefined,
22
23
  ]);
23
- if (iconConfig.position === "left") {
24
- return (_jsx("li", { className: className, "data-item-id": item.id, children: _jsxs("a", { children: [_jsx(Icon, { ...iconConfig }), _jsx("span", { children: item.caption })] }) }, item.id));
24
+ if (iconConfig.position === ElementPosition.Right) {
25
+ return (_jsx("li", { className: className, "data-item-id": item.id, children: _jsxs("a", { children: [_jsx("span", { children: item.caption }), _jsx(Icon, { ...iconConfig })] }) }, item.id));
25
26
  }
26
- return (_jsx("li", { className: className, "data-item-id": item.id, children: _jsxs("a", { children: [_jsx("span", { children: item.caption }), _jsx(Icon, { ...iconConfig })] }) }, item.id));
27
+ return (_jsx("li", { className: className, "data-item-id": item.id, children: _jsxs("a", { children: [_jsx(Icon, { ...iconConfig }), _jsx("span", { children: item.caption })] }) }, item.id));
27
28
  };
@@ -1,4 +1,4 @@
1
- import { ElementIcon } from "..";
1
+ import { ElementIcon } from "../../types";
2
2
  /** Tabs component style */
3
3
  export declare enum TabsStyle {
4
4
  /**
@@ -20,17 +20,6 @@ export declare enum TabsStyle {
20
20
  */
21
21
  radioButtonRounded = "is-toggle is-toggle-rounded"
22
22
  }
23
- /**
24
- * Tabs items position on component
25
- */
26
- export declare enum TabsPosition {
27
- /** On the left side. Default value */
28
- "left" = "",
29
- /** Center*/
30
- "center" = "is-centered",
31
- /** Pulled to right */
32
- "right" = "is-right"
33
- }
34
23
  /** Tab item */
35
24
  export interface TabItem {
36
25
  /** Unique identifier across all tab items */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,2BAA2B;AAC3B,oBAAY,SAAS;IACjB;;;OAGG;IACH,OAAO,KAAK;IAEZ;;;OAGG;IACH,KAAK,aAAa;IAElB;;OAEG;IACH,WAAW,cAAc;IAEzB;;OAEG;IACH,kBAAkB,gCAAgC;CACrD;AAED;;GAEG;AACH,oBAAY,YAAY;IACpB,sCAAsC;IACtC,MAAM,KAAK;IAEX,YAAY;IACZ,QAAQ,gBAAgB;IAExB,sBAAsB;IACtB,OAAO,aAAa;CACvB;AAED,eAAe;AACf,MAAM,WAAW,OAAO;IACpB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IAEX,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAEhB,yBAAyB;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,2BAA2B;AAC3B,oBAAY,SAAS;IACjB;;;OAGG;IACH,OAAO,KAAK;IAEZ;;;OAGG;IACH,KAAK,aAAa;IAElB;;OAEG;IACH,WAAW,cAAc;IAEzB;;OAEG;IACH,kBAAkB,gCAAgC;CACrD;AAED,eAAe;AACf,MAAM,WAAW,OAAO;IACpB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IAEX,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAEhB,yBAAyB;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB"}
@@ -20,15 +20,3 @@ export var TabsStyle;
20
20
  */
21
21
  TabsStyle["radioButtonRounded"] = "is-toggle is-toggle-rounded";
22
22
  })(TabsStyle || (TabsStyle = {}));
23
- /**
24
- * Tabs items position on component
25
- */
26
- export var TabsPosition;
27
- (function (TabsPosition) {
28
- /** On the left side. Default value */
29
- TabsPosition["left"] = "";
30
- /** Center*/
31
- TabsPosition["center"] = "is-centered";
32
- /** Pulled to right */
33
- TabsPosition["right"] = "is-right";
34
- })(TabsPosition || (TabsPosition = {}));
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { TagProps } from "../../tag";
2
+ import { TagProps } from "..";
3
3
  import "./style.scss";
4
4
  /** Single tag item */
5
- declare const Tag: ({ content, size, style, rounded, lightColor, customColor, onClick, className, title, }: TagProps) => JSX.Element;
5
+ declare const Tag: ({ content, size, style, rounded, lightColor, customColor, onClick, className, title, data, }: TagProps) => JSX.Element;
6
6
  export default Tag;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tag/component/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,cAAc,CAAC;AAEtB,sBAAsB;AACtB,QAAA,MAAM,GAAG,2FAQN,QAAQ,KAAG,WA+Bb,CAAC;AAEF,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tag/component/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAE9B,OAAO,cAAc,CAAC;AAEtB,sBAAsB;AACtB,QAAA,MAAM,GAAG,iGAQN,QAAQ,KAAG,WAuCb,CAAC;AAEF,eAAe,GAAG,CAAC"}
@@ -1,26 +1,32 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
- import { ElementColor, ElementSize } from "../..";
3
+ import { ElementColor, ElementSize } from "../../../types";
4
+ import { mapDataAttributes } from "../../../utils";
4
5
  import "./style.scss";
5
6
  /** Single tag item */
6
- const Tag = ({ content, size = ElementSize.Normal, style = ElementColor.Default, rounded = false, lightColor = false, customColor, onClick, className, title, }) => {
7
+ const Tag = ({ content, size = ElementSize.Normal, style = ElementColor.Default, rounded = false, lightColor = false, customColor, onClick, className, title, data, }) => {
7
8
  if (!isNullOrUndefined(customColor)) {
8
9
  style = ElementColor.Default;
9
10
  }
10
11
  const elClassName = getClassName([
11
12
  "bbr-tag",
12
13
  "tag",
14
+ className,
13
15
  style === ElementColor.Default ? "" : `is-${style}`,
14
16
  !isNullOrUndefined(customColor) ? "bbr-tag--custom" : "",
15
17
  lightColor && isNullOrUndefined(customColor) ? "is-light" : "",
16
18
  rounded ? "is-rounded" : "",
17
19
  size === ElementSize.Normal || size === ElementSize.Small ? "" : `is-${size}`,
18
20
  isNullOrUndefined(onClick) ? "" : "bbr-tag--clickable",
19
- className,
20
21
  ]);
21
- return (_jsx("span", { className: elClassName, onClick: onClick, title: title, color: customColor?.color, style: {
22
- color: customColor?.color,
23
- backgroundColor: customColor?.backgroundColor,
24
- }, children: content }));
22
+ const dataAttributes = isNullOrUndefined(data)
23
+ ? undefined
24
+ : mapDataAttributes(data);
25
+ return (_jsx("span", { onClick: onClick, className: elClassName, style: isNullOrUndefined(customColor)
26
+ ? undefined
27
+ : {
28
+ color: customColor?.color,
29
+ backgroundColor: customColor?.backgroundColor,
30
+ }, title: title, ...dataAttributes, children: content }));
25
31
  };
26
32
  export default Tag;
@@ -1,4 +1,4 @@
1
- import { BaseElementProps, ElementColor, ElementSize } from "..";
1
+ import { BaseElementProps, ElementColor, ElementSize } from "../../types";
2
2
  /** Tag item prop types */
3
3
  export interface TagProps extends BaseElementProps {
4
4
  /** Tag content */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/tag/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9E,0BAA0B;AAC1B,MAAM,WAAW,QAAS,SAAQ,gBAAgB;IAC9C,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAEhB;;;MAGE;IACF,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,0BAA0B;IAC1B,WAAW,CAAC,EAAE;QACV,iBAAiB;QACjB,KAAK,EAAE,MAAM,CAAC;QAEd,uBAAuB;QACvB,eAAe,EAAE,MAAM,CAAC;KAC3B,CAAC;CACL"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/tag/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzE,0BAA0B;AAC1B,MAAM,WAAW,QAAS,SAAQ,gBAAgB;IAC9C,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAEhB;;;MAGE;IACF,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,0BAA0B;IAC1B,WAAW,CAAC,EAAE;QACV,iBAAiB;QACjB,KAAK,EAAE,MAAM,CAAC;QAEd,uBAAuB;QACvB,eAAe,EAAE,MAAM,CAAC;KAC3B,CAAC;CACL"}
@@ -1 +1 @@
1
- {"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../src/hooks/usePagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA6C,MAAM,OAAO,CAAC;AAElF,2BAA2B;AAC3B,MAAM,WAAW,eAAe;IAC5B,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IAEpB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;IAEnB,6BAA6B;IAC7B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAKD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,WACd,MAAM,SACR,MAAM,aACF,MAAM,6DAEQ,MAAM,GAAG,CAAC,KAAK,MAAM,GAAG,CAAC,CAwBpD,CAAC"}
1
+ {"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../src/hooks/usePagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqD,MAAM,OAAO,CAAC;AAE1F,2BAA2B;AAC3B,MAAM,WAAW,eAAe;IAC5B,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IAEpB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;IAEnB,6BAA6B;IAC7B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAKD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,WACd,MAAM,SACR,MAAM,aACF,MAAM,6DAEQ,MAAM,GAAG,CAAC,KAAK,MAAM,GAAG,CAAC,CAiCpD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useMemo, useState } from "react";
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  /** Default page size */
3
3
  const defaultPageSize = 30;
4
4
  /**
@@ -23,6 +23,15 @@ export const usePagination = (length, size = defaultPageSize, initPage = 1, depe
23
23
  pagesCount: count,
24
24
  onPageChange: onChange
25
25
  }), [currentPage, count, onChange]);
26
- useEffect(() => setCurrentPage(1), dependencies);
26
+ const isInitialRender = useRef(true);
27
+ useEffect(() => {
28
+ if (isInitialRender.current) {
29
+ isInitialRender.current = false;
30
+ }
31
+ else {
32
+ setCurrentPage(1);
33
+ }
34
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35
+ }, dependencies);
27
36
  return [state, paginate];
28
37
  };
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./components";
2
2
  export * from "./hooks";
3
+ export * from "./types";
3
4
  export * from "./utils";
4
5
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./components";
2
2
  export * from "./hooks";
3
+ export * from "./types";
3
4
  export * from "./utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodynarf/react.components",
3
- "version": "1.8.21",
3
+ "version": "1.9.0",
4
4
  "author": {
5
5
  "name": "Artem",
6
6
  "email": "bodynar@gmail.com"
@@ -23,16 +23,23 @@
23
23
  "scripts": {
24
24
  "build": "npx tsc && tsc-alias -p tsconfig.json",
25
25
  "copy_styles": "copyfiles -u 1 src/**/*.scss dist",
26
- "copy_main" : "copyfiles package.json readme.md dist",
26
+ "copy_main": "copyfiles package.json readme.md dist",
27
27
  "transfer": "npm run copy_styles && npm run copy_main",
28
28
  "build_transfer": "npm run build && npm run transfer",
29
- "prepublish": "npm run build_transfer && cd dist && npm pack --dry-run",
30
- "publish_pkg": "npm run build_transfer && cd dist && npm publish --access=public"
29
+ "prepublish": "npm run build_transfer && cd dist && npm pack",
30
+ "publish_pkg": "npm run build_transfer && cd dist && npm publish --access=public",
31
+ "lint": "npx eslint src/**/*.ts src/**/*.tsx"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@types/react": "^18.0.11",
34
35
  "@types/react-dom": "^18.0.5",
36
+ "@typescript-eslint/eslint-plugin": "^6.4.1",
37
+ "@typescript-eslint/parser": "^6.4.1",
35
38
  "copyfiles": "^2.4.1",
39
+ "eslint": "^8.48.0",
40
+ "eslint-plugin-import": "^2.28.1",
41
+ "eslint-plugin-react": "^7.33.2",
42
+ "eslint-plugin-react-hooks": "^4.6.0",
36
43
  "tsc-alias": "^1.8.6",
37
44
  "typescript": "^4.7.3"
38
45
  },
package/readme.md CHANGED
@@ -37,6 +37,8 @@ Simple react components based on html elements.
37
37
  - **Button** - button that allows user to interact with system by clicking it _(assume everyone knows what is button)_
38
38
  - **Icon** - *see p.4 of installation*
39
39
  - **Tag** - small component stands for tag visualization
40
+ - **BreadCrumbs** - speaks for it self
41
+ - **Table** - table with sortable headers
40
42
 
41
43
  ### Complex components
42
44
  Complex components is set of components built via combining simple components or represent complex logical component