@gobolt/genesis 0.3.22 → 0.3.23

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 (173) hide show
  1. package/dist/components/Badge/Badge.js +32 -9
  2. package/dist/components/Badge/styles.d.ts +10 -1
  3. package/dist/components/Badge/styles.js +14 -39
  4. package/dist/components/Button/Button.js +27 -4
  5. package/dist/components/Button/IconButton.js +27 -4
  6. package/dist/components/Button/components/Button/Button.d.ts +16 -0
  7. package/dist/components/Button/components/Button/Button.js +13 -0
  8. package/dist/components/Button/components/Button/styles.d.ts +1 -0
  9. package/dist/components/Button/components/Button/styles.js +118 -0
  10. package/dist/components/Button/constants/index.d.ts +163 -0
  11. package/dist/components/Button/constants/index.js +89 -0
  12. package/dist/components/Button/icon-button-styles.d.ts +12 -1
  13. package/dist/components/Button/icon-button-styles.js +16 -69
  14. package/dist/components/Button/styles.d.ts +16 -1
  15. package/dist/components/Button/styles.js +30 -88
  16. package/dist/components/Input/Input.js +29 -6
  17. package/dist/components/Input/styles.d.ts +18 -1
  18. package/dist/components/Input/styles.js +42 -146
  19. package/dist/components/Select/Select.js +125 -101
  20. package/dist/components/Select/SelectTrigger.js +57 -71
  21. package/dist/components/Table/Table.js +27 -8
  22. package/dist/components/Table/TableControls/CustomPagination.js +66 -50
  23. package/dist/components/Table/TableControls/PaginationNumber.js +43 -27
  24. package/dist/components/Table/TableControls/PrimaryTableControlsRow.js +17 -16
  25. package/dist/components/Table/TableControls/SecondaryTableControlsRow.js +36 -14
  26. package/dist/components/Table/TableControls/TableControls.js +4 -3
  27. package/dist/components/Table/TablePagination.js +21 -4
  28. package/dist/components/Table/__mocks__/table-mocks.js +24 -15
  29. package/dist/components/Table/styles.d.ts +15 -1
  30. package/dist/components/Table/styles.js +13 -57
  31. package/dist/components/Table/useTable.js +166 -69
  32. package/dist/components/TableWithControls/TableWithControls.js +7 -6
  33. package/dist/components/TableWithControls/components/Badge/Badge.d.ts +16 -0
  34. package/dist/components/TableWithControls/components/Badge/Badge.js +28 -0
  35. package/dist/components/TableWithControls/components/Badge/index.d.ts +2 -0
  36. package/dist/components/TableWithControls/components/Badge/index.js +1 -0
  37. package/dist/components/TableWithControls/components/Badge/styles.d.ts +4 -0
  38. package/dist/components/TableWithControls/components/Badge/styles.js +46 -0
  39. package/dist/components/TableWithControls/components/Button/Button.d.ts +16 -0
  40. package/dist/components/TableWithControls/components/Button/Button.js +13 -0
  41. package/dist/components/TableWithControls/components/Button/IconButton.d.ts +8 -0
  42. package/dist/components/TableWithControls/components/Button/IconButton.js +9 -0
  43. package/dist/components/TableWithControls/components/Button/icon-button-styles.d.ts +1 -0
  44. package/dist/components/TableWithControls/components/Button/icon-button-styles.js +76 -0
  45. package/dist/components/TableWithControls/components/Button/index.d.ts +4 -0
  46. package/dist/components/TableWithControls/components/Button/index.js +2 -0
  47. package/dist/components/TableWithControls/components/Button/styles.d.ts +1 -0
  48. package/dist/components/TableWithControls/components/Button/styles.js +118 -0
  49. package/dist/components/TableWithControls/components/Input/Input.d.ts +13 -0
  50. package/dist/components/TableWithControls/components/Input/Input.js +34 -0
  51. package/dist/components/TableWithControls/components/Input/index.d.ts +2 -0
  52. package/dist/components/TableWithControls/components/Input/index.js +1 -0
  53. package/dist/components/TableWithControls/components/Input/styles.d.ts +1 -0
  54. package/dist/components/TableWithControls/components/Input/styles.js +180 -0
  55. package/dist/components/TableWithControls/components/Select/Select.d.ts +26 -0
  56. package/dist/components/TableWithControls/components/Select/Select.js +175 -0
  57. package/dist/components/TableWithControls/components/Select/SelectTrigger.d.ts +23 -0
  58. package/dist/components/TableWithControls/components/Select/SelectTrigger.js +103 -0
  59. package/dist/components/TableWithControls/components/Select/index.d.ts +2 -0
  60. package/dist/components/TableWithControls/components/Select/index.js +1 -0
  61. package/dist/components/TableWithControls/components/Table/Table.d.ts +51 -0
  62. package/dist/components/TableWithControls/components/Table/Table.js +14 -0
  63. package/dist/components/TableWithControls/components/Table/TableControls/CustomPagination.d.ts +13 -0
  64. package/dist/components/TableWithControls/components/Table/TableControls/CustomPagination.js +158 -0
  65. package/dist/components/TableWithControls/components/Table/TableControls/PaginationNumber.d.ts +7 -0
  66. package/dist/components/TableWithControls/components/Table/TableControls/PaginationNumber.js +30 -0
  67. package/dist/components/TableWithControls/components/Table/TableControls/PrimaryTableControlsRow.d.ts +18 -0
  68. package/dist/components/TableWithControls/components/Table/TableControls/PrimaryTableControlsRow.js +77 -0
  69. package/dist/components/TableWithControls/components/Table/TableControls/SecondaryTableControlsRow.d.ts +11 -0
  70. package/dist/components/TableWithControls/components/Table/TableControls/SecondaryTableControlsRow.js +43 -0
  71. package/dist/components/TableWithControls/components/Table/TableControls/TableControls.d.ts +14 -0
  72. package/dist/components/TableWithControls/components/Table/TableControls/TableControls.js +13 -0
  73. package/dist/components/TableWithControls/components/Table/TableControls/index.d.ts +2 -0
  74. package/dist/components/TableWithControls/components/Table/TableControls/index.js +1 -0
  75. package/dist/components/TableWithControls/components/Table/TablePagination.d.ts +13 -0
  76. package/dist/components/TableWithControls/components/Table/TablePagination.js +11 -0
  77. package/dist/components/TableWithControls/components/Table/__mocks__/table-mocks.d.ts +20 -0
  78. package/dist/components/TableWithControls/components/Table/__mocks__/table-mocks.js +301 -0
  79. package/dist/components/TableWithControls/components/Table/index.d.ts +6 -0
  80. package/dist/components/TableWithControls/components/Table/index.js +3 -0
  81. package/dist/components/TableWithControls/components/Table/styles.d.ts +14 -0
  82. package/dist/components/TableWithControls/components/Table/styles.js +64 -0
  83. package/dist/components/TableWithControls/components/Table/useTable.d.ts +26 -0
  84. package/dist/components/TableWithControls/components/Table/useTable.js +141 -0
  85. package/dist/components/TableWithControls/components/TableWithControls/TableWithControls.d.ts +12 -0
  86. package/dist/components/TableWithControls/components/TableWithControls/TableWithControls.js +20 -0
  87. package/dist/components/TableWithControls/components/TableWithControls/useTableWithControls.d.ts +29 -0
  88. package/dist/components/TableWithControls/components/TableWithControls/useTableWithControls.js +136 -0
  89. package/dist/components/TableWithControls/components/Tooltip/Tooltip.d.ts +7 -0
  90. package/dist/components/TableWithControls/components/Tooltip/Tooltip.js +8 -0
  91. package/dist/components/TableWithControls/components/Tooltip/index.d.ts +2 -0
  92. package/dist/components/TableWithControls/components/Tooltip/index.js +1 -0
  93. package/dist/components/TableWithControls/components/Tooltip/styles.d.ts +6 -0
  94. package/dist/components/TableWithControls/components/Tooltip/styles.js +26 -0
  95. package/dist/components/TableWithControls/components/Typography/Typography.d.ts +17 -0
  96. package/dist/components/TableWithControls/components/Typography/Typography.js +16 -0
  97. package/dist/components/TableWithControls/components/Typography/index.d.ts +2 -0
  98. package/dist/components/TableWithControls/components/Typography/index.js +1 -0
  99. package/dist/components/TableWithControls/components/Typography/styles.d.ts +3 -0
  100. package/dist/components/TableWithControls/components/Typography/styles.js +54 -0
  101. package/dist/components/TableWithControls/components/UtilityButton/UtilityButton.d.ts +5 -0
  102. package/dist/components/TableWithControls/components/UtilityButton/UtilityButton.js +9 -0
  103. package/dist/components/TableWithControls/components/UtilityButton/index.d.ts +2 -0
  104. package/dist/components/TableWithControls/components/UtilityButton/index.js +1 -0
  105. package/dist/components/TableWithControls/components/shared/DropdownChevron.d.ts +2 -0
  106. package/dist/components/TableWithControls/components/shared/DropdownChevron.js +7 -0
  107. package/dist/components/TableWithControls/constants/index.d.ts +163 -0
  108. package/dist/components/TableWithControls/constants/index.js +89 -0
  109. package/dist/components/TableWithControls/types/events.d.ts +22 -0
  110. package/dist/components/TableWithControls/types/events.js +1 -0
  111. package/dist/components/TableWithControls/useTableWithControls.js +63 -82
  112. package/dist/components/TableWithControls/utils/icon-util.d.ts +3 -0
  113. package/dist/components/TableWithControls/utils/icon-util.js +116 -0
  114. package/dist/components/Tooltip/Tooltip.js +2 -1
  115. package/dist/components/Tooltip/styles.d.ts +14 -1
  116. package/dist/components/Tooltip/styles.js +14 -23
  117. package/dist/components/Typography/Typography.js +29 -6
  118. package/dist/components/Typography/styles.d.ts +21 -3
  119. package/dist/components/Typography/styles.js +24 -41
  120. package/dist/components/UtilityButton/UtilityButton.js +27 -4
  121. package/dist/components/UtilityButton/components/Button/Button.d.ts +16 -0
  122. package/dist/components/UtilityButton/components/Button/Button.js +13 -0
  123. package/dist/components/UtilityButton/components/Button/IconButton.d.ts +8 -0
  124. package/dist/components/UtilityButton/components/Button/IconButton.js +9 -0
  125. package/dist/components/UtilityButton/components/Button/icon-button-styles.d.ts +1 -0
  126. package/dist/components/UtilityButton/components/Button/icon-button-styles.js +76 -0
  127. package/dist/components/UtilityButton/components/Button/index.d.ts +4 -0
  128. package/dist/components/UtilityButton/components/Button/index.js +2 -0
  129. package/dist/components/UtilityButton/components/Button/styles.d.ts +1 -0
  130. package/dist/components/UtilityButton/components/Button/styles.js +118 -0
  131. package/dist/components/UtilityButton/components/UtilityButton/UtilityButton.d.ts +5 -0
  132. package/dist/components/UtilityButton/components/UtilityButton/UtilityButton.js +9 -0
  133. package/dist/components/UtilityButton/constants/index.d.ts +163 -0
  134. package/dist/components/UtilityButton/constants/index.js +89 -0
  135. package/dist/components/index.d.ts +6 -6
  136. package/dist/components/index.js +7 -0
  137. package/dist/components/index.ts +6 -6
  138. package/dist/components/shared/DropdownChevron.js +14 -3
  139. package/dist/index.d.ts +9 -9
  140. package/dist/index.js +10 -89
  141. package/dist/index.ts +9 -9
  142. package/dist/utils/icon-util.d.ts +2 -2
  143. package/dist/utils/icon-util.js +19 -16
  144. package/package.json +1 -1
  145. package/dist/components/Button/Button.tsx +0 -59
  146. package/dist/components/Table/Table.tsx +0 -112
  147. package/dist/components/Table/useTable.ts +0 -194
  148. package/dist/components/TableWithControls/TableWithControls.tsx +0 -54
  149. package/dist/components/TableWithControls/useTableWithControls.tsx +0 -161
  150. package/dist/components/UtilityButton/UtilityButton.tsx +0 -36
  151. package/dist/constants/index.ts +0 -98
  152. package/dist/genesis-theme.types.d.ts +0 -263
  153. package/dist/genesis-theme.types.js +0 -6
  154. package/dist/styled.d.ts +0 -1
  155. package/dist/styled.js +0 -44
  156. package/dist/styles/theme/genesis-theme.types.ts +0 -297
  157. package/dist/utils/styled.ts +0 -52
  158. /package/dist/{Table → components/Table/Table}/Table.d.ts +0 -0
  159. /package/dist/{Table → components/Table/Table}/Table.js +0 -0
  160. /package/dist/{Table → components/Table/Table}/TableControls/CustomPagination.d.ts +0 -0
  161. /package/dist/{Table → components/Table/Table}/TableControls/CustomPagination.js +0 -0
  162. /package/dist/{Table → components/Table/Table}/TableControls/PaginationNumber.d.ts +0 -0
  163. /package/dist/{Table → components/Table/Table}/TableControls/PaginationNumber.js +0 -0
  164. /package/dist/{Table → components/Table/Table}/styles.d.ts +0 -0
  165. /package/dist/{Table → components/Table/Table}/styles.js +0 -0
  166. /package/dist/{Table → components/Table/Table}/useTable.d.ts +0 -0
  167. /package/dist/{Table → components/Table/Table}/useTable.js +0 -0
  168. /package/dist/{Typography → components/Table/Typography}/Typography.d.ts +0 -0
  169. /package/dist/{Typography → components/Table/Typography}/Typography.js +0 -0
  170. /package/dist/{Typography → components/Table/Typography}/index.d.ts +0 -0
  171. /package/dist/{Typography → components/Table/Typography}/index.js +0 -0
  172. /package/dist/{Typography → components/Table/Typography}/styles.d.ts +0 -0
  173. /package/dist/{Typography → components/Table/Typography}/styles.js +0 -0
@@ -1,28 +1,51 @@
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
+ };
1
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
24
  import * as S from "./styles";
3
25
  import { Typography } from "@gobolt/genesis/components";
4
26
  import { useGenesis } from "@gobolt/genesis/providers";
5
27
  import { getBadgeStateIcon } from "@gobolt/genesis/utils/icon-util";
6
28
  import { HiOutlineX } from "react-icons/hi";
7
- const isBadgeIconFilled = false;
8
- const Badge = ({ label, state = "info", isDisabled, hasClose = false, onClick = () => { }, size = "normal", hasIcon = true, customIcon = null, backgroundColor = null, textColor = null, hasHover = false, ...rest }) => {
9
- const { theme } = useGenesis();
10
- const role = hasClose ? "button" : "badge";
29
+ var isBadgeIconFilled = false;
30
+ var Badge = function (_a) {
31
+ var label = _a.label, _b = _a.state, state = _b === void 0 ? "info" : _b, isDisabled = _a.isDisabled, _c = _a.hasClose, hasClose = _c === void 0 ? false : _c, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, _e = _a.size, size = _e === void 0 ? "normal" : _e, _f = _a.hasIcon, hasIcon = _f === void 0 ? true : _f, _g = _a.customIcon, customIcon = _g === void 0 ? null : _g, _h = _a.backgroundColor, backgroundColor = _h === void 0 ? null : _h, _j = _a.textColor, textColor = _j === void 0 ? null : _j, _k = _a.hasHover, hasHover = _k === void 0 ? false : _k, rest = __rest(_a, ["label", "state", "isDisabled", "hasClose", "onClick", "size", "hasIcon", "customIcon", "backgroundColor", "textColor", "hasHover"]);
32
+ var theme = useGenesis().theme;
33
+ var role = hasClose ? "button" : "badge";
11
34
  if (!label) {
12
- return (_jsx(S.Badge, { label: label, role: "badge", state: state, disabled: isDisabled, style: {
35
+ return (_jsx(S.Badge, __assign({ label: label, role: "badge", state: state, disabled: isDisabled, style: {
13
36
  padding: "4px 4px",
14
- }, "$hasHover": hasHover, ...rest, children: _jsx("div", { style: {
37
+ }, "$hasHover": hasHover }, rest, { children: _jsx("div", { style: {
15
38
  display: "flex",
16
39
  justifyContent: "center",
17
40
  alignItems: "center",
18
- }, children: getBadgeStateIcon(state, backgroundColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon) }) }));
41
+ }, children: getBadgeStateIcon(state, backgroundColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon) }) })));
19
42
  }
20
- return (_jsxs(S.Badge, { label: label, role: role, onClick: onClick, state: state, disabled: isDisabled, style: { cursor: role === "button" ? "pointer" : "default" }, "$backgroundColor": backgroundColor, "$hasHover": hasHover, ...rest, children: [getBadgeStateIcon(state, isDisabled
43
+ return (_jsxs(S.Badge, __assign({ label: label, role: role, onClick: onClick, state: state, disabled: isDisabled, style: { cursor: role === "button" ? "pointer" : "default" }, "$backgroundColor": backgroundColor, "$hasHover": hasHover }, rest, { children: [getBadgeStateIcon(state, isDisabled
21
44
  ? theme.colors.status.disabled.default
22
45
  : textColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon), _jsx(Typography, { variant: size === "small" ? "label3" : "label2", color: isDisabled
23
46
  ? theme.colors.status.disabled.default
24
47
  : textColor || theme.colors.status[state].onsurface,
25
48
  // @ts-ignore
26
- isDisabled: isDisabled, children: label }), hasClose ? (_jsx(HiOutlineX, { color: theme.colors.status[state].onsurface })) : null] }));
49
+ isDisabled: isDisabled, children: label }), hasClose ? (_jsx(HiOutlineX, { color: theme.colors.status[state].onsurface })) : null] })));
27
50
  };
28
51
  export default Badge;
@@ -1,4 +1,13 @@
1
1
  import { type GenesisTheme } from "@gobolt/genesis/styles/theme/genesis-theme.types";
2
2
  import { type State } from "./Badge";
3
+ interface StyledBadgeProperties {
4
+ theme?: GenesisTheme;
5
+ state?: State;
6
+ label?: string;
7
+ disabled?: boolean;
8
+ $backgroundColor?: string;
9
+ $hasHover?: boolean;
10
+ }
3
11
  export declare const getGenesisClass: (theme: GenesisTheme, state: State, label?: string, disabled?: boolean, $backgroundColor?: string, $hasHover?: boolean) => string;
4
- export declare const Badge: any;
12
+ export declare const Badge: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledBadgeProperties>> & string;
13
+ export {};
@@ -1,46 +1,21 @@
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
+ };
1
5
  import styled from "@gobolt/genesis/utils/styled";
2
- const getBorderColor = (theme, state) => {
6
+ var getBorderColor = function (theme, state) {
3
7
  if (state === "hollow") {
4
8
  return theme.colors.inputs.surface.border;
5
9
  }
6
10
  return theme.colors.status[state].surface;
7
11
  };
8
- export const getGenesisClass = (theme, state, label, disabled, $backgroundColor, $hasHover) => `
9
- display: inline-flex;
10
- align-self: inherit;
11
- gap: 4px;
12
- justify-content: center;
13
- align-items: center;
14
- position: relative;
15
- padding-top: ${theme.components.badge["ver-padding"]}px;
16
- padding-bottom: ${theme.components.badge["ver-padding"]}px;
17
- padding-left: ${theme.components.badge["left-padding"]}px;
18
- padding-right: ${theme.components.badge["right-padding"]}px;
19
- border-radius: ${theme.components.badge.radius}px;
20
- border: 1px solid ${getBorderColor(theme, state)};
21
- background-color: ${$backgroundColor || theme.colors.status[state].surface};
22
-
23
- &:not(:disabled):hover {
24
- ${$hasHover
25
- ? `background-color: ${theme.colors.status[state]["surface-hover"]};`
26
- : ""}
27
- }
28
-
29
- ${disabled
30
- ? `
31
- background-color: ${theme.colors.status.disabled.surface} !important;
32
- border-color: ${theme.colors.status.disabled} !important;
33
- border: none;
34
- cursor: not-allowed;
35
-
36
- &:hover {
37
- cursor: not-allowed;
38
- }
39
- `
40
- : ""}
41
- `;
42
- export const Badge = styled.div `
43
- ${({ theme, state, label, disabled, $backgroundColor, $hasHover, }) => {
12
+ export var getGenesisClass = function (theme, state, label, disabled, $backgroundColor, $hasHover) { return "\n display: inline-flex; \n align-self: inherit;\n gap: 4px;\n justify-content: center;\n align-items: center;\n position: relative;\n padding-top: ".concat(theme.components.badge["ver-padding"], "px;\n padding-bottom: ").concat(theme.components.badge["ver-padding"], "px;\n padding-left: ").concat(theme.components.badge["left-padding"], "px;\n padding-right: ").concat(theme.components.badge["right-padding"], "px;\n border-radius: ").concat(theme.components.badge.radius, "px;\n border: 1px solid ").concat(getBorderColor(theme, state), ";\n background-color: ").concat($backgroundColor || theme.colors.status[state].surface, ";\n\n &:not(:disabled):hover {\n ").concat($hasHover
13
+ ? "background-color: ".concat(theme.colors.status[state]["surface-hover"], ";")
14
+ : "", "\n }\n\n ").concat(disabled
15
+ ? "\n background-color: ".concat(theme.colors.status.disabled.surface, " !important;\n border-color: ").concat(theme.colors.status.disabled, " !important;\n border: none;\n cursor: not-allowed;\n\n &:hover {\n cursor: not-allowed;\n }\n ")
16
+ : "", "\n"); };
17
+ export var Badge = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
18
+ var theme = _a.theme, state = _a.state, label = _a.label, disabled = _a.disabled, $backgroundColor = _a.$backgroundColor, $hasHover = _a.$hasHover;
44
19
  return getGenesisClass(theme, state, label, disabled, $backgroundColor, $hasHover);
45
- }}
46
- `;
20
+ });
21
+ var templateObject_1;
@@ -1,13 +1,36 @@
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
+ };
1
23
  import { jsx as _jsx } from "react/jsx-runtime";
2
24
  import * as S from "./styles";
3
- const getState = (state, isSelected) => {
25
+ var getState = function (state, isSelected) {
4
26
  if (isSelected) {
5
27
  return "selected";
6
28
  }
7
29
  return state === "active" || state === "disabled" ? state : "active";
8
30
  };
9
- const Button = ({ children, onClick, themeType = "primary", state = "active", isIconButton = false, size = "normal", isSelected, ...rest }) => {
10
- const buttonState = getState(state, isSelected);
11
- return (_jsx(S.Button, { onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, "$isIconButton": isIconButton, size: size, ...rest, children: children }));
31
+ var Button = function (_a) {
32
+ var children = _a.children, onClick = _a.onClick, _b = _a.themeType, themeType = _b === void 0 ? "primary" : _b, _c = _a.state, state = _c === void 0 ? "active" : _c, _d = _a.isIconButton, isIconButton = _d === void 0 ? false : _d, _e = _a.size, size = _e === void 0 ? "normal" : _e, isSelected = _a.isSelected, rest = __rest(_a, ["children", "onClick", "themeType", "state", "isIconButton", "size", "isSelected"]);
33
+ var buttonState = getState(state, isSelected);
34
+ return (_jsx(S.Button, __assign({ onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, "$isIconButton": isIconButton, size: size }, rest, { children: children })));
12
35
  };
13
36
  export default Button;
@@ -1,9 +1,32 @@
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
+ };
1
23
  import { jsx as _jsx } from "react/jsx-runtime";
2
24
  import * as S from "./icon-button-styles";
3
25
  import { TYPE } from "../../constants";
4
- const IconButton = ({ isSelected = false, state = "active", onClick, icon, size = "small", ...rest }) => {
5
- const buttonState = state === "active" || state === "disabled" ? state : "active";
6
- const themeType = TYPE.icon;
7
- return (_jsx(S.Button, { onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, size: size, "$isSelected": isSelected, ...rest, children: icon }));
26
+ var IconButton = function (_a) {
27
+ var _b = _a.isSelected, isSelected = _b === void 0 ? false : _b, _c = _a.state, state = _c === void 0 ? "active" : _c, onClick = _a.onClick, icon = _a.icon, _d = _a.size, size = _d === void 0 ? "small" : _d, rest = __rest(_a, ["isSelected", "state", "onClick", "icon", "size"]);
28
+ var buttonState = state === "active" || state === "disabled" ? state : "active";
29
+ var themeType = TYPE.icon;
30
+ return (_jsx(S.Button, __assign({ onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, size: size, "$isSelected": isSelected }, rest, { children: icon })));
8
31
  };
9
32
  export default IconButton;
@@ -0,0 +1,16 @@
1
+ import React, { MouseEvent } from "react";
2
+ import type { ButtonProps as AntButtonProperties } from "antd/es/button";
3
+ import { STATE } from "../../constants";
4
+ type ButtonThemeType = "primary" | "secondary" | "tertiary" | "destructive" | "utility" | "icon";
5
+ export interface ButtonProps extends Omit<AntButtonProperties, "type" | "size"> {
6
+ onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
7
+ children?: React.ReactNode;
8
+ themeType?: ButtonThemeType;
9
+ state?: keyof typeof STATE;
10
+ isIconButton?: boolean;
11
+ size?: "small" | "normal" | "large";
12
+ isSelected?: boolean;
13
+ icon?: React.ReactNode;
14
+ }
15
+ declare const Button: React.FC<ButtonProps>;
16
+ export default Button;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as S from "./styles";
3
+ const getState = (state, isSelected) => {
4
+ if (isSelected) {
5
+ return "selected";
6
+ }
7
+ return state === "active" || state === "disabled" ? state : "active";
8
+ };
9
+ const Button = ({ children, onClick, themeType = "primary", state = "active", isIconButton = false, size = "normal", isSelected, ...rest }) => {
10
+ const buttonState = getState(state, isSelected);
11
+ return (_jsx(S.Button, { onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, "$isIconButton": isIconButton, size: size, ...rest, children: children }));
12
+ };
13
+ export default Button;
@@ -0,0 +1 @@
1
+ export declare const Button: any;
@@ -0,0 +1,118 @@
1
+ import styled from "@gobolt/genesis/utils/styled";
2
+ import { Button as AntButton } from "antd";
3
+ const getPadding = (size, $themeType, sizing, $isIconButton) => {
4
+ if ($isIconButton && (size === "normal" || size === "large")) {
5
+ return `${sizing.Size2}px ${sizing.Size2}px`;
6
+ }
7
+ if ($isIconButton && size === "small") {
8
+ return `${sizing.Size1}px ${sizing.Size1}px`;
9
+ }
10
+ // utility button padding is different from the main button
11
+ if ($themeType === "utility" && size === "small") {
12
+ return `${sizing.Size1_5}px ${sizing.Size2}px`;
13
+ }
14
+ if ($themeType === "utility" && (size === "normal" || size === "large")) {
15
+ return `${sizing.Size2_5}px ${sizing.Size3}px`;
16
+ }
17
+ if (size === "small") {
18
+ return `${sizing.Size1_5}px ${sizing.Size4}px`;
19
+ }
20
+ if (size === "normal" || size === "large") {
21
+ return `${sizing.Size2_5}px ${sizing.Size6}px`;
22
+ }
23
+ return `${sizing.Size2}px ${sizing.Size2}px`;
24
+ };
25
+ const getHeight = (size) => {
26
+ if (size === "normal" || size === "large") {
27
+ return `40px`;
28
+ }
29
+ if (size === "small") {
30
+ return `32px`;
31
+ }
32
+ return `40px`;
33
+ };
34
+ const getWidth = (size, $isIconButton) => {
35
+ if (!$isIconButton) {
36
+ return `auto`;
37
+ }
38
+ if (size === "normal" || size === "large") {
39
+ return `40px`;
40
+ }
41
+ if (size === "small") {
42
+ return `32px`;
43
+ }
44
+ return `40px`;
45
+ };
46
+ const getVariant = ({ colors, sizing, borderRadius, components }, $themeType, $state, size, $isIconButton) => {
47
+ const backgroundColor = colors[$themeType][$state].backgroundColor;
48
+ return `
49
+ &.ant-btn {
50
+
51
+ color: ${colors[$themeType][$state].color};
52
+ font-size: ${sizing.Size4}px;
53
+ line-height: ${sizing.Size6}px;
54
+ letter-spacing: 0;
55
+ font-weight: 400;
56
+ border-width: 1px;
57
+ line-height: 1 !important;
58
+
59
+ width: ${getWidth(size, $isIconButton)}; !important;
60
+ height: ${getHeight(size)}; !important;
61
+
62
+ background-color: ${colors[$themeType][$state].backgroundColor};
63
+ padding: ${getPadding(size, $themeType, sizing, $isIconButton)};
64
+
65
+ box-shadow: ${$themeType === "utility" ? "0px 1px 2px 0px #00000026" : "none"};
66
+
67
+ border-radius: ${borderRadius.BorderRadiusMd}px;
68
+ gap: ${components.button.gap}px;
69
+ border-style: solid;
70
+ border-color: ${colors[$themeType][$state].borderColor};
71
+
72
+ transition: all 0.2s ease-in-out;
73
+
74
+ &:hover {
75
+ color: ${colors[$themeType].hover.color};
76
+ background-color: ${colors[$themeType].hover.backgroundColor};
77
+ border-color: ${colors[$themeType].hover.borderColor};
78
+ }
79
+
80
+ &:active {
81
+ color: ${colors[$themeType].pressed.color};
82
+ background-color: ${colors[$themeType].pressed.backgroundColor};
83
+ border-color: ${colors[$themeType].pressed.borderColor};
84
+ }
85
+
86
+ &:focus-visible {
87
+ outline: none;
88
+ color: ${colors[$themeType].focussed.color};
89
+ background-color: ${colors[$themeType].focussed.backgroundColor};
90
+ box-shadow: 0 0 0 1px #fff, 0 0 0 4px ${colors[$themeType].focussed.ringColor};
91
+ border-radius: ${borderRadius.BorderRadiusMd}px;
92
+ border-color: ${colors[$themeType].focussed.borderColor};
93
+ transition: box-shadow 0.2s ease-in-out;
94
+ }
95
+
96
+ &:disabled {
97
+ color: ${colors[$themeType].disabled.color};
98
+ background-color: ${colors[$themeType].disabled.backgroundColor};
99
+ border-color: ${colors[$themeType].disabled.borderColor};
100
+ cursor: not-allowed;
101
+ }
102
+
103
+ }
104
+
105
+ `;
106
+ };
107
+ const getGenesisButtonClass = (theme, $themeType, $state, $isIconButton, size) => `
108
+ &.ant-btn {
109
+ font-family: 'Inter', sans-serif;
110
+
111
+ ${getVariant(theme, $themeType, $state, size, $isIconButton)}
112
+ }
113
+ `;
114
+ export const Button = styled(AntButton) `
115
+ ${({ theme, $themeType, $state, children, $isIconButton, size }) => {
116
+ return getGenesisButtonClass(theme, $themeType, $state, $isIconButton, size);
117
+ }}
118
+ `;
@@ -0,0 +1,163 @@
1
+ export declare const TYPE: {
2
+ primary: string;
3
+ secondary: string;
4
+ tertiary: string;
5
+ destructive: string;
6
+ utility: string;
7
+ icon: string;
8
+ };
9
+ export declare const BREAKPOINTS: {
10
+ wide: string;
11
+ medium: string;
12
+ narrow: string;
13
+ };
14
+ export declare const STATE: {
15
+ active: string;
16
+ hover: string;
17
+ pressed: string;
18
+ focussed: string;
19
+ disabled: string;
20
+ error: string;
21
+ success: string;
22
+ warning: string;
23
+ progress: string;
24
+ info: string;
25
+ filled: string;
26
+ generic: string;
27
+ removed: string;
28
+ hollow: string;
29
+ };
30
+ export declare const TYPOGRAPHY_VARIANT: {
31
+ display1: string;
32
+ display2: string;
33
+ display3: string;
34
+ heading1: string;
35
+ heading2: string;
36
+ heading3: string;
37
+ subHeading1: string;
38
+ subHeading2: string;
39
+ subHeading3: string;
40
+ body1: string;
41
+ body2: string;
42
+ body3: string;
43
+ body4: string;
44
+ body5: string;
45
+ message: string;
46
+ overline1: string;
47
+ overline2: string;
48
+ overline3: string;
49
+ label1: string;
50
+ label2: string;
51
+ label3: string;
52
+ link1: string;
53
+ link2: string;
54
+ link3: string;
55
+ digits1: string;
56
+ digits2: string;
57
+ digits3: string;
58
+ };
59
+ export declare const BUTTON_VARIANT: {
60
+ primary: string;
61
+ secondary: string;
62
+ tertiary: string;
63
+ };
64
+ export declare const SIZE: {
65
+ small: string;
66
+ medium: string;
67
+ large: string;
68
+ standard: string;
69
+ };
70
+ export declare const BADGE: {
71
+ appointment: string;
72
+ asn: string;
73
+ inventory: string;
74
+ parcel: string;
75
+ product: string;
76
+ route: string;
77
+ shipment: string;
78
+ shoppingCart: string;
79
+ system: string;
80
+ };
81
+ declare const _default: {
82
+ TYPE: {
83
+ primary: string;
84
+ secondary: string;
85
+ tertiary: string;
86
+ destructive: string;
87
+ utility: string;
88
+ icon: string;
89
+ };
90
+ BREAKPOINTS: {
91
+ wide: string;
92
+ medium: string;
93
+ narrow: string;
94
+ };
95
+ STATE: {
96
+ active: string;
97
+ hover: string;
98
+ pressed: string;
99
+ focussed: string;
100
+ disabled: string;
101
+ error: string;
102
+ success: string;
103
+ warning: string;
104
+ progress: string;
105
+ info: string;
106
+ filled: string;
107
+ generic: string;
108
+ removed: string;
109
+ hollow: string;
110
+ };
111
+ TYPOGRAPHY_VARIANT: {
112
+ display1: string;
113
+ display2: string;
114
+ display3: string;
115
+ heading1: string;
116
+ heading2: string;
117
+ heading3: string;
118
+ subHeading1: string;
119
+ subHeading2: string;
120
+ subHeading3: string;
121
+ body1: string;
122
+ body2: string;
123
+ body3: string;
124
+ body4: string;
125
+ body5: string;
126
+ message: string;
127
+ overline1: string;
128
+ overline2: string;
129
+ overline3: string;
130
+ label1: string;
131
+ label2: string;
132
+ label3: string;
133
+ link1: string;
134
+ link2: string;
135
+ link3: string;
136
+ digits1: string;
137
+ digits2: string;
138
+ digits3: string;
139
+ };
140
+ BUTTON_VARIANT: {
141
+ primary: string;
142
+ secondary: string;
143
+ tertiary: string;
144
+ };
145
+ SIZE: {
146
+ small: string;
147
+ medium: string;
148
+ large: string;
149
+ standard: string;
150
+ };
151
+ BADGE: {
152
+ appointment: string;
153
+ asn: string;
154
+ inventory: string;
155
+ parcel: string;
156
+ product: string;
157
+ route: string;
158
+ shipment: string;
159
+ shoppingCart: string;
160
+ system: string;
161
+ };
162
+ };
163
+ export default _default;
@@ -0,0 +1,89 @@
1
+ export const TYPE = {
2
+ primary: "primary",
3
+ secondary: "secondary",
4
+ tertiary: "tertiary",
5
+ destructive: "destructive",
6
+ utility: "utility",
7
+ icon: "icon",
8
+ };
9
+ export const BREAKPOINTS = {
10
+ wide: "wide",
11
+ medium: "medium",
12
+ narrow: "narrow",
13
+ };
14
+ export const STATE = {
15
+ active: "active",
16
+ hover: "hover",
17
+ pressed: "pressed",
18
+ focussed: "focus",
19
+ disabled: "disabled",
20
+ error: "error",
21
+ success: "success",
22
+ warning: "warning",
23
+ progress: "progress",
24
+ info: "info",
25
+ filled: "filled",
26
+ generic: "generic",
27
+ removed: "removed",
28
+ hollow: "hollow",
29
+ };
30
+ export const TYPOGRAPHY_VARIANT = {
31
+ display1: "display1",
32
+ display2: "display2",
33
+ display3: "display3",
34
+ heading1: "heading1",
35
+ heading2: "heading2",
36
+ heading3: "heading3",
37
+ subHeading1: "subHeading1",
38
+ subHeading2: "subHeading2",
39
+ subHeading3: "subHeading3",
40
+ body1: "body1",
41
+ body2: "body2",
42
+ body3: "body3",
43
+ body4: "body4",
44
+ body5: "body5",
45
+ message: "message",
46
+ overline1: "overline1",
47
+ overline2: "overline2",
48
+ overline3: "overline3",
49
+ label1: "label1",
50
+ label2: "label2",
51
+ label3: "label3",
52
+ link1: "link1",
53
+ link2: "link2",
54
+ link3: "link3",
55
+ digits1: "digits1",
56
+ digits2: "digits2",
57
+ digits3: "digits3",
58
+ };
59
+ export const BUTTON_VARIANT = {
60
+ primary: "primary",
61
+ secondary: "secondary",
62
+ tertiary: "tertiary",
63
+ };
64
+ export const SIZE = {
65
+ small: "small",
66
+ medium: "medium",
67
+ large: "large",
68
+ standard: "standard",
69
+ };
70
+ export const BADGE = {
71
+ appointment: "appointment",
72
+ asn: "asn",
73
+ inventory: "inventory",
74
+ parcel: "parcel",
75
+ product: "product",
76
+ route: "route",
77
+ shipment: "shipment",
78
+ shoppingCart: "shopping cart",
79
+ system: "system",
80
+ };
81
+ export default {
82
+ TYPE,
83
+ BREAKPOINTS,
84
+ STATE,
85
+ TYPOGRAPHY_VARIANT,
86
+ BUTTON_VARIANT,
87
+ SIZE,
88
+ BADGE,
89
+ };
@@ -1 +1,12 @@
1
- export declare const Button: any;
1
+ import { type GenesisTheme } from "@gobolt/genesis/styles/theme/genesis-theme.types";
2
+ interface StyledIconButtonProperties {
3
+ theme?: GenesisTheme;
4
+ $themeType?: "primary" | "secondary" | "tertiary" | "destructive" | "utility" | "icon";
5
+ $state?: "active" | "hover" | "pressed" | "focus" | "disabled" | "selected";
6
+ children?: React.ReactNode;
7
+ $isIconButton?: boolean;
8
+ $isSelected?: boolean;
9
+ size?: "small" | "normal" | "large";
10
+ }
11
+ export declare const Button: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, StyledIconButtonProperties>> & string;
12
+ export {};