@gobolt/genesis 0.3.21 → 0.3.22

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 (60) hide show
  1. package/dist/Table/Table.d.ts +51 -0
  2. package/dist/Table/Table.js +14 -0
  3. package/dist/Table/TableControls/CustomPagination.d.ts +13 -0
  4. package/dist/Table/TableControls/CustomPagination.js +158 -0
  5. package/dist/Table/TableControls/PaginationNumber.d.ts +7 -0
  6. package/dist/Table/TableControls/PaginationNumber.js +30 -0
  7. package/dist/Table/styles.d.ts +14 -0
  8. package/dist/Table/styles.js +64 -0
  9. package/dist/Table/useTable.d.ts +26 -0
  10. package/dist/Table/useTable.js +141 -0
  11. package/dist/Typography/Typography.d.ts +17 -0
  12. package/dist/Typography/Typography.js +16 -0
  13. package/dist/Typography/index.d.ts +2 -0
  14. package/dist/Typography/index.js +1 -0
  15. package/dist/Typography/styles.d.ts +3 -0
  16. package/dist/Typography/styles.js +54 -0
  17. package/dist/components/Badge/Badge.js +9 -32
  18. package/dist/components/Badge/styles.d.ts +1 -10
  19. package/dist/components/Badge/styles.js +39 -14
  20. package/dist/components/Button/Button.js +4 -27
  21. package/dist/components/Button/IconButton.js +4 -27
  22. package/dist/components/Button/icon-button-styles.d.ts +1 -12
  23. package/dist/components/Button/icon-button-styles.js +69 -16
  24. package/dist/components/Button/styles.d.ts +1 -16
  25. package/dist/components/Button/styles.js +88 -30
  26. package/dist/components/Input/Input.js +6 -29
  27. package/dist/components/Input/styles.d.ts +1 -18
  28. package/dist/components/Input/styles.js +146 -42
  29. package/dist/components/Select/Select.js +101 -125
  30. package/dist/components/Select/SelectTrigger.js +71 -57
  31. package/dist/components/Table/Table.js +8 -27
  32. package/dist/components/Table/TableControls/CustomPagination.js +50 -66
  33. package/dist/components/Table/TableControls/PaginationNumber.js +27 -43
  34. package/dist/components/Table/TableControls/PrimaryTableControlsRow.js +16 -17
  35. package/dist/components/Table/TableControls/SecondaryTableControlsRow.js +14 -36
  36. package/dist/components/Table/TableControls/TableControls.js +3 -4
  37. package/dist/components/Table/TablePagination.js +4 -21
  38. package/dist/components/Table/__mocks__/table-mocks.js +15 -24
  39. package/dist/components/Table/styles.d.ts +1 -15
  40. package/dist/components/Table/styles.js +57 -13
  41. package/dist/components/Table/useTable.js +69 -166
  42. package/dist/components/TableWithControls/TableWithControls.js +6 -7
  43. package/dist/components/TableWithControls/useTableWithControls.js +82 -63
  44. package/dist/components/Tooltip/Tooltip.js +1 -2
  45. package/dist/components/Tooltip/styles.d.ts +1 -14
  46. package/dist/components/Tooltip/styles.js +23 -14
  47. package/dist/components/Typography/Typography.js +6 -29
  48. package/dist/components/Typography/styles.d.ts +3 -21
  49. package/dist/components/Typography/styles.js +41 -24
  50. package/dist/components/UtilityButton/UtilityButton.js +4 -27
  51. package/dist/components/shared/DropdownChevron.js +3 -14
  52. package/dist/constants/index.js +14 -14
  53. package/dist/genesis-theme.types.d.ts +263 -0
  54. package/dist/genesis-theme.types.js +6 -0
  55. package/dist/index.js +89 -0
  56. package/dist/styled.d.ts +1 -0
  57. package/dist/styled.js +44 -0
  58. package/dist/utils/icon-util.d.ts +2 -2
  59. package/dist/utils/icon-util.js +16 -19
  60. package/package.json +1 -1
@@ -1,68 +1,83 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
2
  import React from "react";
7
3
  import styled from "@gobolt/genesis/utils/styled";
8
4
  import DropdownChevron from "../shared/DropdownChevron";
9
5
  import { Typography } from "@gobolt/genesis/components";
10
- var getBackgroundColor = function (colors, disabled, $variant) {
6
+ const getBackgroundColor = (colors, disabled, $variant) => {
11
7
  if ($variant === "simple")
12
8
  return "#F4F4F4";
13
9
  if (disabled)
14
10
  return "#F4F4F4";
15
11
  return "#fff";
16
12
  };
17
- var TriggerWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: ", ";\n opacity: ", ";\n position: relative;\n box-shadow: ", ";\n transition: all 0.2s ease-in-out;\n min-height: ", ";\n\n &:focus-visible {\n outline: none;\n }\n\n &:focus {\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.12),\n 0 0 0 3px\n ", ";\n }\n\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: ", ";\n opacity: ", ";\n position: relative;\n box-shadow: ", ";\n transition: all 0.2s ease-in-out;\n min-height: ", ";\n\n &:focus-visible {\n outline: none;\n }\n\n &:focus {\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.12),\n 0 0 0 3px\n ", ";\n }\n\n ", "\n"])), function (_a) {
18
- var $disabled = _a.$disabled;
19
- return ($disabled ? "not-allowed" : "pointer");
20
- }, function (_a) {
21
- var $disabled = _a.$disabled;
22
- return ($disabled ? 0.4 : 1);
23
- }, function (_a) {
24
- var $variant = _a.$variant;
25
- return $variant === "simple" ? "none" : "0px 1px 2px 0px rgba(0, 0, 0, 0.12)";
26
- }, function (_a) {
27
- var $variant = _a.$variant;
28
- return ($variant === "simple" ? "32px" : "40px");
29
- }, function (_a) {
30
- var theme = _a.theme, _b = _a.$themeType, $themeType = _b === void 0 ? "primary" : _b;
31
- return theme.colors[$themeType].focussed.ringColor;
32
- }, function (_a) {
33
- var _b;
34
- var $variant = _a.$variant, theme = _a.theme, $disabled = _a.$disabled;
35
- return $variant === "simple"
36
- ? "\n padding: ".concat(theme.sizing.Size1, " ").concat(theme.sizing.Size2, ";\n background: ").concat($disabled ? theme.colors.inputs.surface.disabled : "rgba(0, 0, 0, 0.04)", ";\n border: none;\n border-radius: ").concat(theme.borderRadius.BorderRadiusSm, "px;\n min-height: ").concat(function (_a) {
37
- var $variant = _a.$variant;
38
- return ($variant === "simple" ? "32px" : "40px");
39
- }, ";\n\n &:hover {\n border: none;\n }\n ")
40
- : "\n padding: ".concat(theme.sizing.Size1, " ").concat(theme.sizing.Size2, ";\n background: ").concat($disabled
41
- ? theme.colors.inputs.surface.disabled
42
- : (_b = theme.colors.surface.default) === null || _b === void 0 ? void 0 : _b.backgroundColor, ";\n border: 1px solid #9a9a9a;\n border-radius: ").concat(theme.borderRadius.BorderRadiusSm, "px;\n min-height: ").concat(function (_a) {
43
- var $variant = _a.$variant;
44
- return ($variant === "simple" ? "32px" : "40px");
45
- }, ";\n\n &:hover {\n border-color: rgba(0, 0, 0, 0.2);\n }\n ");
46
- });
47
- var ValueContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", "px;\n flex: 1;\n padding: 4px 8px;\n"], ["\n display: flex;\n align-items: center;\n gap: ", "px;\n flex: 1;\n padding: 4px 8px;\n"])), function (_a) {
48
- var theme = _a.theme;
49
- return theme.sizing.Size2;
50
- });
51
- var ChevronContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: ", ";\n margin-left: ", ";\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: ", ";\n margin-left: ", ";\n"])), function (_a) {
52
- var $variant = _a.$variant;
53
- return ($variant === "simple" ? "4px" : "4px");
54
- }, function (_a) {
55
- var $variant = _a.$variant;
56
- return ($variant === "simple" ? "4px" : "0");
57
- });
58
- var SelectTrigger = function (_a) {
59
- var _b = _a.type, type = _b === void 0 ? "primary" : _b, theme = _a.theme, state = _a.state, value = _a.value, _c = _a.placeholder, placeholder = _c === void 0 ? "Select..." : _c, open = _a.open, onClick = _a.onClick, renderValue = _a.renderValue, _d = _a.options, options = _d === void 0 ? [] : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.variant, variant = _f === void 0 ? "none" : _f;
60
- var handleClick = React.useCallback(function () {
13
+ const TriggerWrapper = styled.div `
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: space-between;
17
+ cursor: ${({ $disabled }) => ($disabled ? "not-allowed" : "pointer")};
18
+ opacity: ${({ $disabled }) => ($disabled ? 0.4 : 1)};
19
+ position: relative;
20
+ box-shadow: ${({ $variant }) => $variant === "simple" ? "none" : "0px 1px 2px 0px rgba(0, 0, 0, 0.12)"};
21
+ transition: all 0.2s ease-in-out;
22
+ min-height: ${({ $variant }) => ($variant === "simple" ? "32px" : "40px")};
23
+
24
+ &:focus-visible {
25
+ outline: none;
26
+ }
27
+
28
+ &:focus {
29
+ box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.12),
30
+ 0 0 0 3px
31
+ ${({ theme, $themeType = "primary" }) => theme.colors[$themeType].focussed.ringColor};
32
+ }
33
+
34
+ ${({ $variant, theme, $disabled }) => $variant === "simple"
35
+ ? `
36
+ padding: ${theme.sizing.Size1} ${theme.sizing.Size2};
37
+ background: ${$disabled ? theme.colors.inputs.surface.disabled : "rgba(0, 0, 0, 0.04)"};
38
+ border: none;
39
+ border-radius: ${theme.borderRadius.BorderRadiusSm}px;
40
+ min-height: ${({ $variant }) => ($variant === "simple" ? "32px" : "40px")};
41
+
42
+ &:hover {
43
+ border: none;
44
+ }
45
+ `
46
+ : `
47
+ padding: ${theme.sizing.Size1} ${theme.sizing.Size2};
48
+ background: ${$disabled
49
+ ? theme.colors.inputs.surface.disabled
50
+ : theme.colors.surface.default?.backgroundColor};
51
+ border: 1px solid #9a9a9a;
52
+ border-radius: ${theme.borderRadius.BorderRadiusSm}px;
53
+ min-height: ${({ $variant }) => ($variant === "simple" ? "32px" : "40px")};
54
+
55
+ &:hover {
56
+ border-color: rgba(0, 0, 0, 0.2);
57
+ }
58
+ `}
59
+ `;
60
+ const ValueContainer = styled.div `
61
+ display: flex;
62
+ align-items: center;
63
+ gap: ${({ theme }) => theme.sizing.Size2}px;
64
+ flex: 1;
65
+ padding: 4px 8px;
66
+ `;
67
+ const ChevronContainer = styled.div `
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ margin-right: ${({ $variant }) => ($variant === "simple" ? "4px" : "4px")};
72
+ margin-left: ${({ $variant }) => ($variant === "simple" ? "4px" : "0")};
73
+ `;
74
+ const SelectTrigger = ({ type = "primary", theme, state, value, placeholder = "Select...", open, onClick, renderValue, options = [], disabled = false, variant = "none", }) => {
75
+ const handleClick = React.useCallback(() => {
61
76
  if (disabled)
62
77
  return;
63
- onClick === null || onClick === void 0 ? void 0 : onClick();
78
+ onClick?.();
64
79
  }, [disabled, onClick]);
65
- var displayValue = React.useMemo(function () {
80
+ const displayValue = React.useMemo(() => {
66
81
  if (!value)
67
82
  return null;
68
83
  if (renderValue)
@@ -70,20 +85,19 @@ var SelectTrigger = function (_a) {
70
85
  if (Array.isArray(value)) {
71
86
  if (value.length === 0)
72
87
  return null;
73
- var selectedLabels = value
88
+ const selectedLabels = value
74
89
  .map(String)
75
- .map(function (v) { var _a; return (_a = options.find(function (opt) { return opt.value === v; })) === null || _a === void 0 ? void 0 : _a.label; })
90
+ .map((v) => options.find((opt) => opt.value === v)?.label)
76
91
  .filter(Boolean);
77
92
  return selectedLabels.length > 0
78
93
  ? selectedLabels.join(", ")
79
- : "".concat(value.length, " selected");
94
+ : `${value.length} selected`;
80
95
  }
81
- var selectedOption = options.find(function (opt) { return opt.value === String(value); });
82
- return (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || value.toString();
96
+ const selectedOption = options.find((opt) => opt.value === String(value));
97
+ return selectedOption?.label || value.toString();
83
98
  }, [value, renderValue, options]);
84
99
  return (_jsxs(TriggerWrapper, { "$themeType": type, "$state": state, onClick: handleClick, tabIndex: disabled ? -1 : 0, role: "button", "$disabled": disabled, "$variant": variant, style: {
85
100
  backgroundColor: getBackgroundColor(theme, disabled, variant),
86
101
  }, children: [_jsx(ValueContainer, { "$variant": variant, children: displayValue ? (_jsx(Typography, { variant: "body2", color: disabled ? "copy-light" : "copy", children: displayValue })) : (_jsx(Typography, { variant: "body2", color: disabled ? "copy-light" : "copy-light", children: placeholder })) }), _jsx(ChevronContainer, { "$variant": variant, children: _jsx(DropdownChevron, {}) })] }));
87
102
  };
88
103
  export default SelectTrigger;
89
- var templateObject_1, templateObject_2, templateObject_3;
@@ -1,33 +1,14 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
1
  import { jsx as _jsx } from "react/jsx-runtime";
24
2
  import * as S from "./styles";
25
3
  import CustomPagination, { PaginationStyle, } from "./TableControls/CustomPagination";
26
- function Table(_a) {
27
- var columns = _a.columns, dataSource = _a.dataSource, _b = _a.rowKey, rowKey = _b === void 0 ? "id" : _b, _c = _a.size, size = _c === void 0 ? "small" : _c, onChange = _a.onChange, rowSelection = _a.rowSelection, pagination = _a.pagination, _d = _a.isMainContentCell, isMainContentCell = _d === void 0 ? false : _d, rest = __rest(_a, ["columns", "dataSource", "rowKey", "size", "onChange", "rowSelection", "pagination", "isMainContentCell"]);
28
- var paginationConfig = pagination === false
4
+ function Table({ columns, dataSource, rowKey = "id", size = "small", onChange, rowSelection, pagination, isMainContentCell = false, ...rest }) {
5
+ const paginationConfig = pagination === false
29
6
  ? false
30
- : __assign(__assign({}, pagination), { itemRender: undefined, render: function (properties) { return (_jsx(CustomPagination, __assign({}, properties, { paginationStyle: (pagination === null || pagination === void 0 ? void 0 : pagination.paginationStyle) || PaginationStyle.SIMPLE }))); } });
31
- return (_jsx(S.Table, __assign({ "data-testid": "Table", dataSource: dataSource, columns: columns, rowKey: rowKey, locale: { emptyText: "No Data" }, size: size, onChange: onChange, rowSelection: rowSelection, pagination: paginationConfig, "$isMainContentCell": isMainContentCell }, rest)));
7
+ : {
8
+ ...pagination,
9
+ itemRender: undefined, // Clear any existing itemRender to avoid conflicts
10
+ render: (properties) => (_jsx(CustomPagination, { ...properties, paginationStyle: pagination?.paginationStyle || PaginationStyle.SIMPLE })),
11
+ };
12
+ return (_jsx(S.Table, { "data-testid": "Table", dataSource: dataSource, columns: columns, rowKey: rowKey, locale: { emptyText: "No Data" }, size: size, onChange: onChange, rowSelection: rowSelection, pagination: paginationConfig, "$isMainContentCell": isMainContentCell, ...rest }));
32
13
  }
33
14
  export default Table;
@@ -1,18 +1,3 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- var __rest = (this && this.__rest) || function (s, e) {
6
- var t = {};
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
8
- t[p] = s[p];
9
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
10
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
11
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
12
- t[p[i]] = s[p[i]];
13
- }
14
- return t;
15
- };
16
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
2
  import styled from "styled-components";
18
3
  import { PaginationNumber } from "./PaginationNumber";
@@ -23,50 +8,54 @@ export var PaginationStyle;
23
8
  PaginationStyle["CENTERED"] = "centered";
24
9
  PaginationStyle["END_FOCUSED"] = "endFocused";
25
10
  })(PaginationStyle || (PaginationStyle = {}));
26
- var PaginationContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n margin: 0;\n gap: 0 0;\n"], ["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n margin: 0;\n gap: 0 0;\n"])));
27
- var ChevronButton = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: transparent;\n border: none;\n color: ", ";\n font-size: 32px;\n height: 40px;\n border-radius: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n margin-right: ", ";\n margin-left: ", ";\n transition: color 0.2s;\n"], ["\n background: transparent;\n border: none;\n color: ", ";\n font-size: 32px;\n height: 40px;\n border-radius: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n margin-right: ", ";\n margin-left: ", ";\n transition: color 0.2s;\n"])), function (_a) {
28
- var theme = _a.theme, disabled = _a.disabled;
29
- return disabled ? theme.colors.onsurface["copy-light"] || "#B0B0B0" : "#222";
30
- }, function (_a) {
31
- var disabled = _a.disabled;
32
- return (disabled ? "not-allowed" : "pointer");
33
- }, function (_a) {
34
- var $right = _a.$right;
35
- return ($right ? "0" : "8px");
36
- }, function (_a) {
37
- var $right = _a.$right;
38
- return ($right ? "8px" : "0");
39
- });
40
- var ChevronIcon = function (_a) {
41
- var _b = _a.left, left = _b === void 0 ? false : _b;
42
- return (_jsx("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: left ? "M17.5 21L11.5 14L17.5 7" : "M10.5 7L16.5 14L10.5 21", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
43
- };
44
- var getSimplePages = function (current, total) {
11
+ const PaginationContainer = styled.div `
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: flex-start;
15
+ margin: 0;
16
+ gap: 0 0;
17
+ `;
18
+ const ChevronButton = styled.button `
19
+ background: transparent;
20
+ border: none;
21
+ color: ${({ theme, disabled }) => disabled ? theme.colors.onsurface["copy-light"] || "#B0B0B0" : "#222"};
22
+ font-size: 32px;
23
+ height: 40px;
24
+ border-radius: 10px;
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ cursor: ${({ disabled }) => (disabled ? "not-allowed" : "pointer")};
29
+ margin-right: ${({ $right }) => ($right ? "0" : "8px")};
30
+ margin-left: ${({ $right }) => ($right ? "8px" : "0")};
31
+ transition: color 0.2s;
32
+ `;
33
+ const ChevronIcon = ({ left = false }) => (_jsx("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: left ? "M17.5 21L11.5 14L17.5 7" : "M10.5 7L16.5 14L10.5 21", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
34
+ const getSimplePages = (current, total) => {
45
35
  // Always show 1-5, but don't exceed total
46
- var pages = [];
47
- for (var index = 1; index <= Math.min(5, total); index++) {
36
+ const pages = [];
37
+ for (let index = 1; index <= Math.min(5, total); index++) {
48
38
  pages.push(index);
49
39
  }
50
40
  return pages;
51
41
  };
52
- var CustomPagination = function (_a) {
53
- var _b = _a.paginationStyle, paginationStyle = _b === void 0 ? PaginationStyle.SIMPLE : _b, _c = _a.current, current = _c === void 0 ? 1 : _c, _d = _a.total, total = _d === void 0 ? 1 : _d, _e = _a.pageSize, pageSize = _e === void 0 ? 10 : _e, onChange = _a.onChange, properties = __rest(_a, ["paginationStyle", "current", "total", "pageSize", "onChange"]);
54
- var pageCount = Math.ceil(total / pageSize);
55
- var handleChange = function (page) {
42
+ const CustomPagination = ({ paginationStyle = PaginationStyle.SIMPLE, current = 1, total = 1, pageSize = 10, onChange, ...properties }) => {
43
+ const pageCount = Math.ceil(total / pageSize);
44
+ const handleChange = (page) => {
56
45
  if (onChange)
57
46
  onChange(page, pageSize);
58
47
  };
59
48
  if (paginationStyle === PaginationStyle.SIMPLE) {
60
- var pages = getSimplePages(current, pageCount);
61
- return (_jsxs(PaginationContainer, { children: [_jsx(ChevronButton, { onClick: function () { return handleChange(current - 1); }, disabled: current === 1, "aria-label": "Previous Page", children: _jsx(ChevronIcon, { left: true }) }), pages.map(function (number_) { return (_jsx(PaginationNumber, { active: number_ === current, onClick: function () { return handleChange(number_); }, "aria-label": "Page ".concat(number_), children: number_ }, number_)); }), _jsx(ChevronButton, { onClick: function () { return handleChange(current + 1); }, disabled: current === pageCount, "aria-label": "Next Page", "$right": true, children: _jsx(ChevronIcon, {}) })] }));
49
+ const pages = getSimplePages(current, pageCount);
50
+ return (_jsxs(PaginationContainer, { children: [_jsx(ChevronButton, { onClick: () => handleChange(current - 1), disabled: current === 1, "aria-label": "Previous Page", children: _jsx(ChevronIcon, { left: true }) }), pages.map((number_) => (_jsx(PaginationNumber, { active: number_ === current, onClick: () => handleChange(number_), "aria-label": `Page ${number_}`, children: number_ }, number_))), _jsx(ChevronButton, { onClick: () => handleChange(current + 1), disabled: current === pageCount, "aria-label": "Next Page", "$right": true, children: _jsx(ChevronIcon, {}) })] }));
62
51
  }
63
52
  if (paginationStyle === PaginationStyle.TRUNCATED) {
64
53
  // Show 1 2 3 4 5 ... last
65
- var pages = [];
66
- for (var index = 1; index <= Math.min(5, pageCount); index++) {
54
+ const pages = [];
55
+ for (let index = 1; index <= Math.min(5, pageCount); index++) {
67
56
  pages.push(index);
68
57
  }
69
- return (_jsxs(PaginationContainer, { children: [_jsx(ChevronButton, { onClick: function () { return handleChange(current - 1); }, disabled: current === 1, "aria-label": "Previous Page", children: _jsx(ChevronIcon, { left: true }) }), pages.map(function (number_) { return (_jsx(PaginationNumber, { active: number_ === current, onClick: function () { return handleChange(number_); }, "aria-label": "Page ".concat(number_), children: number_ }, number_)); }), pageCount > 5 && (_jsxs(_Fragment, { children: [_jsx("span", { style: {
58
+ return (_jsxs(PaginationContainer, { children: [_jsx(ChevronButton, { onClick: () => handleChange(current - 1), disabled: current === 1, "aria-label": "Previous Page", children: _jsx(ChevronIcon, { left: true }) }), pages.map((number_) => (_jsx(PaginationNumber, { active: number_ === current, onClick: () => handleChange(number_), "aria-label": `Page ${number_}`, children: number_ }, number_))), pageCount > 5 && (_jsxs(_Fragment, { children: [_jsx("span", { style: {
70
59
  color: "#7F7F7F",
71
60
  fontWeight: 600,
72
61
  fontSize: 16,
@@ -75,16 +64,16 @@ var CustomPagination = function (_a) {
75
64
  alignItems: "center",
76
65
  justifyContent: "center",
77
66
  paddingBottom: 10,
78
- }, children: "..." }), _jsx(PaginationNumber, { active: current === pageCount, onClick: function () { return handleChange(pageCount); }, "aria-label": "Page ".concat(pageCount), children: pageCount }, pageCount)] })), _jsx(ChevronButton, { onClick: function () { return handleChange(current + 1); }, disabled: current === pageCount, "aria-label": "Next Page", "$right": true, children: _jsx(ChevronIcon, {}) })] }));
67
+ }, children: "..." }), _jsx(PaginationNumber, { active: current === pageCount, onClick: () => handleChange(pageCount), "aria-label": `Page ${pageCount}`, children: pageCount }, pageCount)] })), _jsx(ChevronButton, { onClick: () => handleChange(current + 1), disabled: current === pageCount, "aria-label": "Next Page", "$right": true, children: _jsx(ChevronIcon, {}) })] }));
79
68
  }
80
69
  if (paginationStyle === PaginationStyle.CENTERED) {
81
70
  // Show 1 ... left mid mid mid mid ... last
82
71
  // Always show 5 numbers, current centered if possible
83
- var pages = [];
84
- var visibleCount = 5;
85
- var sideCount = 2; // numbers to show on each side of current
86
- var start = Math.max(2, current - 2);
87
- var end = Math.min(pageCount - 1, current + 2);
72
+ const pages = [];
73
+ const visibleCount = 5;
74
+ const sideCount = 2; // numbers to show on each side of current
75
+ let start = Math.max(2, current - 2);
76
+ let end = Math.min(pageCount - 1, current + 2);
88
77
  // Adjust if near the start
89
78
  if (current <= 3) {
90
79
  start = 2;
@@ -104,7 +93,7 @@ var CustomPagination = function (_a) {
104
93
  pages.push("left-ellipsis");
105
94
  }
106
95
  // Show middle pages
107
- for (var index = start; index <= end; index++) {
96
+ for (let index = start; index <= end; index++) {
108
97
  pages.push(index);
109
98
  }
110
99
  // Show right ellipsis if needed
@@ -115,7 +104,7 @@ var CustomPagination = function (_a) {
115
104
  if (pageCount > 1) {
116
105
  pages.push(pageCount);
117
106
  }
118
- return (_jsxs(PaginationContainer, { children: [_jsx(ChevronButton, { onClick: function () { return handleChange(current - 1); }, disabled: current === 1, "aria-label": "Previous Page", children: _jsx(ChevronIcon, { left: true }) }), pages.map(function (number_, index) {
107
+ return (_jsxs(PaginationContainer, { children: [_jsx(ChevronButton, { onClick: () => handleChange(current - 1), disabled: current === 1, "aria-label": "Previous Page", children: _jsx(ChevronIcon, { left: true }) }), pages.map((number_, index) => {
119
108
  if (number_ === "left-ellipsis" || number_ === "right-ellipsis") {
120
109
  return (_jsx("span", { style: {
121
110
  color: "#7F7F7FB0",
@@ -129,14 +118,12 @@ var CustomPagination = function (_a) {
129
118
  paddingBottom: 10,
130
119
  }, children: "..." }, number_ + index));
131
120
  }
132
- return (_jsx(PaginationNumber, { active: number_ === current, onClick: function () {
133
- return typeof number_ === "number" && handleChange(number_);
134
- }, "aria-label": "Page ".concat(number_), children: number_ }, number_));
135
- }), _jsx(ChevronButton, { onClick: function () { return handleChange(current + 1); }, disabled: current === pageCount, "aria-label": "Next Page", "$right": true, children: _jsx(ChevronIcon, {}) })] }));
121
+ return (_jsx(PaginationNumber, { active: number_ === current, onClick: () => typeof number_ === "number" && handleChange(number_), "aria-label": `Page ${number_}`, children: number_ }, number_));
122
+ }), _jsx(ChevronButton, { onClick: () => handleChange(current + 1), disabled: current === pageCount, "aria-label": "Next Page", "$right": true, children: _jsx(ChevronIcon, {}) })] }));
136
123
  }
137
124
  if (paginationStyle === PaginationStyle.END_FOCUSED) {
138
125
  // Show 1 ... last 5 pages
139
- var pages = [];
126
+ const pages = [];
140
127
  // Always show first page
141
128
  pages.push(1);
142
129
  // If more than 6 pages, show ellipsis
@@ -144,11 +131,11 @@ var CustomPagination = function (_a) {
144
131
  pages.push("left-ellipsis");
145
132
  }
146
133
  // Show last 5 pages
147
- var start = Math.max(2, pageCount - 4);
148
- for (var index = start; index <= pageCount; index++) {
134
+ const start = Math.max(2, pageCount - 4);
135
+ for (let index = start; index <= pageCount; index++) {
149
136
  pages.push(index);
150
137
  }
151
- return (_jsxs(PaginationContainer, { children: [_jsx(ChevronButton, { onClick: function () { return handleChange(current - 1); }, disabled: current === 1, "aria-label": "Previous Page", children: _jsx(ChevronIcon, { left: true }) }), pages.map(function (number_, index) {
138
+ return (_jsxs(PaginationContainer, { children: [_jsx(ChevronButton, { onClick: () => handleChange(current - 1), disabled: current === 1, "aria-label": "Previous Page", children: _jsx(ChevronIcon, { left: true }) }), pages.map((number_, index) => {
152
139
  if (number_ === "left-ellipsis") {
153
140
  return (_jsx("span", { style: {
154
141
  color: "#7F7F7F",
@@ -162,13 +149,10 @@ var CustomPagination = function (_a) {
162
149
  paddingBottom: 10,
163
150
  }, children: "..." }, number_ + index));
164
151
  }
165
- return (_jsx(PaginationNumber, { active: number_ === current, onClick: function () {
166
- return typeof number_ === "number" && handleChange(number_);
167
- }, "aria-label": "Page ".concat(number_), children: number_ }, number_));
168
- }), _jsx(ChevronButton, { onClick: function () { return handleChange(current + 1); }, disabled: current === pageCount, "aria-label": "Next Page", "$right": true, children: _jsx(ChevronIcon, {}) })] }));
152
+ return (_jsx(PaginationNumber, { active: number_ === current, onClick: () => typeof number_ === "number" && handleChange(number_), "aria-label": `Page ${number_}`, children: number_ }, number_));
153
+ }), _jsx(ChevronButton, { onClick: () => handleChange(current + 1), disabled: current === pageCount, "aria-label": "Next Page", "$right": true, children: _jsx(ChevronIcon, {}) })] }));
169
154
  }
170
155
  // Fallback for other styles (not implemented yet)
171
156
  return null;
172
157
  };
173
158
  export default CustomPagination;
174
- var templateObject_1, templateObject_2;
@@ -1,46 +1,30 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- var __rest = (this && this.__rest) || function (s, e) {
17
- var t = {};
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
- t[p] = s[p];
20
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
- t[p[i]] = s[p[i]];
24
- }
25
- return t;
26
- };
27
1
  import { jsx as _jsx } from "react/jsx-runtime";
28
2
  import styled from "styled-components";
29
3
  import Typography from "../../Typography";
30
- var NumberButton = styled.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n color: ", ";\n border: none;\n border-radius: 4px;\n min-width: 24px;\n height: 24px;\n padding: 4px 7px;\n font-size: 16px;\n font-weight: 600;\n margin: 0 4px;\n cursor: pointer;\n transition: background 0.2s, color 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: inherit;\n white-space: nowrap;\n\n &:hover {\n background: ", ";\n color: #fff;\n }\n"], ["\n background: ", ";\n color: ", ";\n border: none;\n border-radius: 4px;\n min-width: 24px;\n height: 24px;\n padding: 4px 7px;\n font-size: 16px;\n font-weight: 600;\n margin: 0 4px;\n cursor: pointer;\n transition: background 0.2s, color 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: inherit;\n white-space: nowrap;\n\n &:hover {\n background: ", ";\n color: #fff;\n }\n"])), function (_a) {
31
- var $active = _a.$active, theme = _a.theme;
32
- return $active ? theme.colors.primary.default.backgroundColor : "transparent";
33
- }, function (_a) {
34
- var $active = _a.$active, theme = _a.theme;
35
- return $active ? "#fff" : theme.colors.onsurface["copy-light"] || "#6C6C6C";
36
- }, function (_a) {
37
- var $active = _a.$active, theme = _a.theme;
38
- return $active
39
- ? theme.colors.primary.default.backgroundColor
40
- : theme.colors.primary.default.backgroundColor + "22";
41
- });
42
- export var PaginationNumber = function (_a) {
43
- var active = _a.active, children = _a.children, properties = __rest(_a, ["active", "children"]);
44
- return (_jsx(NumberButton, __assign({ "$active": active, "aria-current": active ? "page" : undefined }, properties, { children: _jsx(Typography, { variant: "digits3", color: active ? "white" : "#6C6C6C", children: children }) })));
45
- };
46
- var templateObject_1;
4
+ const NumberButton = styled.button `
5
+ background: ${({ $active, theme }) => $active ? theme.colors.primary.default.backgroundColor : "transparent"};
6
+ color: ${({ $active, theme }) => $active ? "#fff" : theme.colors.onsurface["copy-light"] || "#6C6C6C"};
7
+ border: none;
8
+ border-radius: 4px;
9
+ min-width: 24px;
10
+ height: 24px;
11
+ padding: 4px 7px;
12
+ font-size: 16px;
13
+ font-weight: 600;
14
+ margin: 0 4px;
15
+ cursor: pointer;
16
+ transition: background 0.2s, color 0.2s;
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ font-family: inherit;
21
+ white-space: nowrap;
22
+
23
+ &:hover {
24
+ background: ${({ $active, theme }) => $active
25
+ ? theme.colors.primary.default.backgroundColor
26
+ : theme.colors.primary.default.backgroundColor + "22"};
27
+ color: #fff;
28
+ }
29
+ `;
30
+ export const PaginationNumber = ({ active, children, ...properties }) => (_jsx(NumberButton, { "$active": active, "aria-current": active ? "page" : undefined, ...properties, children: _jsx(Typography, { variant: "digits3", color: active ? "white" : "#6C6C6C", children: children }) }));
@@ -8,43 +8,42 @@ import { HiMiniAdjustmentsVertical } from "react-icons/hi2";
8
8
  import { HiSearch } from "react-icons/hi";
9
9
  import { HiOutlineSortAscending, HiOutlineSortDescending, } from "react-icons/hi";
10
10
  import { FiSettings } from "react-icons/fi";
11
- var PrimaryTableControlsRow = function (_a) {
12
- var sortOptions = _a.sortOptions, _b = _a.searchByPlaceholder, searchByPlaceholder = _b === void 0 ? "" : _b, _c = _a.searchField, searchField = _c === void 0 ? "address" : _c, _d = _a.isSortedAscending, isSortedAscending = _d === void 0 ? true : _d, _e = _a.searchValue, searchValue = _e === void 0 ? "" : _e, _f = _a.selectedSortOption, selectedSortOption = _f === void 0 ? "" : _f, onChange = _a.onChange;
13
- var onInputChange = function (actionEvent) {
14
- onChange === null || onChange === void 0 ? void 0 : onChange({
11
+ const PrimaryTableControlsRow = ({ sortOptions, searchByPlaceholder = "", searchField = "address", isSortedAscending = true, searchValue = "", selectedSortOption = "", onChange, }) => {
12
+ const onInputChange = (actionEvent) => {
13
+ onChange?.({
15
14
  event: "inputChange",
16
15
  payload: actionEvent.payload,
17
16
  });
18
17
  };
19
- var onSortChange = function (value) {
20
- var sortActionEvent = {
18
+ const onSortChange = (value) => {
19
+ const sortActionEvent = {
21
20
  event: "primarySortChange",
22
- payload: { value: value },
21
+ payload: { value },
23
22
  };
24
- onChange === null || onChange === void 0 ? void 0 : onChange(sortActionEvent);
23
+ onChange?.(sortActionEvent);
25
24
  };
26
- var onFilterClick = function () {
27
- var filterActionEvent = {
25
+ const onFilterClick = () => {
26
+ const filterActionEvent = {
28
27
  event: "filterClick",
29
28
  payload: {},
30
29
  };
31
- onChange === null || onChange === void 0 ? void 0 : onChange(filterActionEvent);
30
+ onChange?.(filterActionEvent);
32
31
  };
33
- var onSettingsClick = function () {
34
- var settingsActionEvent = {
32
+ const onSettingsClick = () => {
33
+ const settingsActionEvent = {
35
34
  event: "settingsClick",
36
35
  payload: {},
37
36
  };
38
- onChange === null || onChange === void 0 ? void 0 : onChange(settingsActionEvent);
37
+ onChange?.(settingsActionEvent);
39
38
  };
40
- var onOrderClick = function () {
41
- var ascendingActionEvent = {
39
+ const onOrderClick = () => {
40
+ const ascendingActionEvent = {
42
41
  event: "orderClick",
43
42
  payload: {
44
43
  value: isSortedAscending ? "desc" : "asc",
45
44
  },
46
45
  };
47
- onChange === null || onChange === void 0 ? void 0 : onChange(ascendingActionEvent);
46
+ onChange?.(ascendingActionEvent);
48
47
  };
49
48
  return (_jsxs("div", { style: {
50
49
  display: "flex",
@@ -1,26 +1,9 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
18
2
  import Badge from "../../Badge";
19
3
  import Typography from "../../Typography";
20
4
  import Tooltip from "../../Tooltip";
21
5
  import { getIcon } from "../../../utils/icon-util";
22
- var GroupItem = function (_a) {
23
- var title = _a.title, items = _a.items, onGroupItemClick = _a.onGroupItemClick;
6
+ const GroupItem = ({ title, items, onGroupItemClick }) => {
24
7
  if (items.length === 0)
25
8
  return null;
26
9
  return (_jsxs(_Fragment, { children: [_jsx(Tooltip, { tip: title, children: _jsx("div", { style: {
@@ -29,37 +12,32 @@ var GroupItem = function (_a) {
29
12
  alignItems: "center",
30
13
  width: 24,
31
14
  height: 24,
32
- }, children: getIcon(title) }) }), _jsx("div", { style: { display: "flex", gap: 4 }, children: items.map(function (item) { return (_jsx(Badge, { label: item, hasClose: true, state: "generic", size: "small", onClick: function () { return onGroupItemClick(title, item); } }, item.toString())); }) })] }));
15
+ }, children: getIcon(title) }) }), _jsx("div", { style: { display: "flex", gap: 4 }, children: items.map((item) => (_jsx(Badge, { label: item, hasClose: true, state: "generic", size: "small", onClick: () => onGroupItemClick(title, item) }, item.toString()))) })] }));
33
16
  };
34
- var GroupsRow = function (_a) {
35
- var groups = _a.groups, onGroupItemClick = _a.onGroupItemClick;
17
+ const GroupsRow = ({ groups, onGroupItemClick }) => {
36
18
  if (!groups)
37
19
  return null;
38
- var groupArray = Object.entries(groups).map(function (_a) {
39
- var _b = __read(_a, 2), title = _b[0], items = _b[1];
40
- return ({
41
- title: title,
42
- items: items,
43
- });
44
- });
20
+ const groupArray = Object.entries(groups).map(([title, items]) => ({
21
+ title,
22
+ items,
23
+ }));
45
24
  return (_jsx("div", { style: { display: "flex", gap: 4 }, children: groupArray.length > 0
46
- ? groupArray.map(function (group) { return (_jsx(GroupItem, { title: group.title, items: group.items, onGroupItemClick: onGroupItemClick }, group.title)); })
25
+ ? groupArray.map((group) => (_jsx(GroupItem, { title: group.title, items: group.items, onGroupItemClick: onGroupItemClick }, group.title)))
47
26
  : null }));
48
27
  };
49
- var SecondaryTableControlsRow = function (_a) {
50
- var groups = _a.groups, totalRecords = _a.totalRecords, onChange = _a.onChange;
51
- var onGroupItemClick = function (title, item) {
52
- var groupItemClickEvent = {
28
+ const SecondaryTableControlsRow = ({ groups, totalRecords, onChange, }) => {
29
+ const onGroupItemClick = (title, item) => {
30
+ const groupItemClickEvent = {
53
31
  event: "groupItemClick",
54
- payload: { title: title, item: item },
32
+ payload: { title, item },
55
33
  };
56
- onChange === null || onChange === void 0 ? void 0 : onChange(groupItemClickEvent);
34
+ onChange?.(groupItemClickEvent);
57
35
  };
58
36
  return (_jsxs("div", { style: {
59
37
  display: "flex",
60
38
  justifyContent: "space-between",
61
39
  alignItems: "flex-end",
62
40
  marginTop: 8,
63
- }, children: [_jsx(GroupsRow, { groups: groups, onGroupItemClick: onGroupItemClick }), totalRecords > 0 ? (_jsx(Typography, { variant: "body2", color: "#6C6C6C", children: "".concat(totalRecords, " results") })) : null] }));
41
+ }, children: [_jsx(GroupsRow, { groups: groups, onGroupItemClick: onGroupItemClick }), totalRecords > 0 ? (_jsx(Typography, { variant: "body2", color: "#6C6C6C", children: `${totalRecords} results` })) : null] }));
64
42
  };
65
43
  export default SecondaryTableControlsRow;