@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,51 +1,28 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
24
2
  import * as S from "./styles";
25
3
  import { Typography } from "@gobolt/genesis/components";
26
4
  import { useGenesis } from "@gobolt/genesis/providers";
27
5
  import { getBadgeStateIcon } from "@gobolt/genesis/utils/icon-util";
28
6
  import { HiOutlineX } from "react-icons/hi";
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";
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";
34
11
  if (!label) {
35
- return (_jsx(S.Badge, __assign({ label: label, role: "badge", state: state, disabled: isDisabled, style: {
12
+ return (_jsx(S.Badge, { label: label, role: "badge", state: state, disabled: isDisabled, style: {
36
13
  padding: "4px 4px",
37
- }, "$hasHover": hasHover }, rest, { children: _jsx("div", { style: {
14
+ }, "$hasHover": hasHover, ...rest, children: _jsx("div", { style: {
38
15
  display: "flex",
39
16
  justifyContent: "center",
40
17
  alignItems: "center",
41
- }, children: getBadgeStateIcon(state, backgroundColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon) }) })));
18
+ }, children: getBadgeStateIcon(state, backgroundColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon) }) }));
42
19
  }
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
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
44
21
  ? theme.colors.status.disabled.default
45
22
  : textColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon), _jsx(Typography, { variant: size === "small" ? "label3" : "label2", color: isDisabled
46
23
  ? theme.colors.status.disabled.default
47
24
  : textColor || theme.colors.status[state].onsurface,
48
25
  // @ts-ignore
49
- isDisabled: isDisabled, children: label }), hasClose ? (_jsx(HiOutlineX, { color: theme.colors.status[state].onsurface })) : null] })));
26
+ isDisabled: isDisabled, children: label }), hasClose ? (_jsx(HiOutlineX, { color: theme.colors.status[state].onsurface })) : null] }));
50
27
  };
51
28
  export default Badge;
@@ -1,13 +1,4 @@
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
- }
11
3
  export declare const getGenesisClass: (theme: GenesisTheme, state: State, label?: string, disabled?: boolean, $backgroundColor?: string, $hasHover?: boolean) => string;
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 {};
4
+ export declare const Badge: any;
@@ -1,21 +1,46 @@
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 styled from "@gobolt/genesis/utils/styled";
6
- var getBorderColor = function (theme, state) {
2
+ const getBorderColor = (theme, state) => {
7
3
  if (state === "hollow") {
8
4
  return theme.colors.inputs.surface.border;
9
5
  }
10
6
  return theme.colors.status[state].surface;
11
7
  };
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;
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, }) => {
19
44
  return getGenesisClass(theme, state, label, disabled, $backgroundColor, $hasHover);
20
- });
21
- var templateObject_1;
45
+ }}
46
+ `;
@@ -1,36 +1,13 @@
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
- var getState = function (state, isSelected) {
3
+ const getState = (state, isSelected) => {
26
4
  if (isSelected) {
27
5
  return "selected";
28
6
  }
29
7
  return state === "active" || state === "disabled" ? state : "active";
30
8
  };
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 })));
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 }));
35
12
  };
36
13
  export default Button;
@@ -1,32 +1,9 @@
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 "./icon-button-styles";
25
3
  import { TYPE } from "../../constants";
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 })));
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 }));
31
8
  };
32
9
  export default IconButton;
@@ -1,12 +1 @@
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 {};
1
+ export declare const Button: any;
@@ -1,23 +1,76 @@
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 styled from "@gobolt/genesis/utils/styled";
6
- var getPadding = function (size, sizing) {
2
+ const getPadding = (size, sizing) => {
7
3
  if (size === "small") {
8
- return "".concat(sizing.Size1, "px ").concat(sizing.Size1, "px");
4
+ return `${sizing.Size1}px ${sizing.Size1}px`;
9
5
  }
10
- return "".concat(sizing.Size2, "px ").concat(sizing.Size2, "px");
6
+ return `${sizing.Size2}px ${sizing.Size2}px`;
11
7
  };
12
- var getVariant = function (_a, $themeType, $state, size, $isSelected) {
13
- var colors = _a.colors, sizing = _a.sizing, borderRadius = _a.borderRadius, components = _a.components;
14
- return "\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n color: ".concat(colors[$themeType][$state].color, ";\n font-size: ").concat(sizing.Size4, "px;\n line-height: ").concat(sizing.Size6, "px;\n letter-spacing: 0;\n font-weight: 400;\n border-width: 1px;\n cursor: pointer;\n width: auto; !important;\n height: auto; !important;\n\n background-color:").concat($isSelected
8
+ const getVariant = ({ colors, sizing, borderRadius, components }, $themeType, $state, size, $isSelected) => {
9
+ return `
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ text-align: center;
14
+ color: ${colors[$themeType][$state].color};
15
+ font-size: ${sizing.Size4}px;
16
+ line-height: ${sizing.Size6}px;
17
+ letter-spacing: 0;
18
+ font-weight: 400;
19
+ border-width: 1px;
20
+ cursor: pointer;
21
+ width: auto; !important;
22
+ height: auto; !important;
23
+
24
+ background-color:${$isSelected
15
25
  ? colors[$themeType].hover.backgroundColor
16
- : colors[$themeType][$state].backgroundColor, ";\n padding: ").concat(getPadding(size, sizing), ";\n\n box-shadow: ").concat($themeType === "utility" ? "0px 1px 2px 0px #00000026" : "none", ";\n\n border-radius: ").concat(borderRadius.BorderRadiusMd, "px;\n gap: ").concat(components.button.gap, "px;\n border-style: solid;\n border-color: ").concat(colors[$themeType][$state].borderColor, ";\n \n transition: all 0.2s ease-in-out;\n\n &:hover {\n color: ").concat(colors[$themeType].hover.color, ";\n background-color: ").concat(colors[$themeType].hover.backgroundColor, ";\n border-color: ").concat(colors[$themeType].hover.borderColor, ";\n }\n\n &:active {\n color: ").concat(colors[$themeType].pressed.color, ";\n background-color: ").concat(colors[$themeType].pressed.backgroundColor, ";\n border-color: ").concat(colors[$themeType].pressed.borderColor, ";\n }\n\n &:focus-visible {\n outline: none;\n color: ").concat(colors[$themeType].focussed.color, ";\n background-color: ").concat(colors[$themeType].focussed.backgroundColor, ";\n box-shadow: 0 0 0 1px #fff, 0 0 0 4px ").concat(colors[$themeType].focussed.ringColor, ";\n border-radius: ").concat(borderRadius.BorderRadiusMd, "px;\n border-color: ").concat(colors[$themeType].focussed.borderColor, ";\n transition: box-shadow 0.2s ease-in-out;\n }\n\n &:disabled {\n color: ").concat(colors[$themeType].disabled.color, ";\n background-color: ").concat(colors[$themeType].disabled.backgroundColor, ";\n border-color: ").concat(colors[$themeType].disabled.borderColor, ";\n cursor: not-allowed;\n }\n ");
26
+ : colors[$themeType][$state].backgroundColor};
27
+ padding: ${getPadding(size, sizing)};
28
+
29
+ box-shadow: ${$themeType === "utility" ? "0px 1px 2px 0px #00000026" : "none"};
30
+
31
+ border-radius: ${borderRadius.BorderRadiusMd}px;
32
+ gap: ${components.button.gap}px;
33
+ border-style: solid;
34
+ border-color: ${colors[$themeType][$state].borderColor};
35
+
36
+ transition: all 0.2s ease-in-out;
37
+
38
+ &:hover {
39
+ color: ${colors[$themeType].hover.color};
40
+ background-color: ${colors[$themeType].hover.backgroundColor};
41
+ border-color: ${colors[$themeType].hover.borderColor};
42
+ }
43
+
44
+ &:active {
45
+ color: ${colors[$themeType].pressed.color};
46
+ background-color: ${colors[$themeType].pressed.backgroundColor};
47
+ border-color: ${colors[$themeType].pressed.borderColor};
48
+ }
49
+
50
+ &:focus-visible {
51
+ outline: none;
52
+ color: ${colors[$themeType].focussed.color};
53
+ background-color: ${colors[$themeType].focussed.backgroundColor};
54
+ box-shadow: 0 0 0 1px #fff, 0 0 0 4px ${colors[$themeType].focussed.ringColor};
55
+ border-radius: ${borderRadius.BorderRadiusMd}px;
56
+ border-color: ${colors[$themeType].focussed.borderColor};
57
+ transition: box-shadow 0.2s ease-in-out;
58
+ }
59
+
60
+ &:disabled {
61
+ color: ${colors[$themeType].disabled.color};
62
+ background-color: ${colors[$themeType].disabled.backgroundColor};
63
+ border-color: ${colors[$themeType].disabled.borderColor};
64
+ cursor: not-allowed;
65
+ }
66
+ `;
17
67
  };
18
- var getGenesisButtonClass = function (theme, $themeType, $state, size, $isSelected) { return "\n font-family: 'Inter', sans-serif;\n ".concat(getVariant(theme, $themeType, $state, size, $isSelected), "\n"); };
19
- export var Button = styled.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
20
- var theme = _a.theme, $themeType = _a.$themeType, $state = _a.$state, size = _a.size, $isSelected = _a.$isSelected;
68
+ const getGenesisButtonClass = (theme, $themeType, $state, size, $isSelected) => `
69
+ font-family: 'Inter', sans-serif;
70
+ ${getVariant(theme, $themeType, $state, size, $isSelected)}
71
+ `;
72
+ export const Button = styled.button `
73
+ ${({ theme, $themeType, $state, size, $isSelected }) => {
21
74
  return getGenesisButtonClass(theme, $themeType, $state, size, $isSelected);
22
- });
23
- var templateObject_1;
75
+ }}
76
+ `;
@@ -1,16 +1 @@
1
- import type { ButtonProps as AntButtonProperties } from "antd/es/button";
2
- import { type GenesisTheme } from "@gobolt/genesis/styles/theme/genesis-theme.types";
3
- interface StyledButtonProperties extends Omit<AntButtonProperties, "type" | "size"> {
4
- theme?: GenesisTheme;
5
- $themeType?: "primary" | "secondary" | "tertiary" | "destructive" | "utility" | "icon";
6
- $state?: "active" | "hover" | "pressed" | "focus" | "disabled" | "selected";
7
- children?: React.ReactNode;
8
- $isIconButton?: 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<Omit<AntButtonProperties & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>, "ref"> & {
12
- ref?: ((instance: HTMLButtonElement | HTMLAnchorElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement | HTMLAnchorElement> | null | undefined;
13
- }, StyledButtonProperties>> & string & Omit<import("react").ForwardRefExoticComponent<AntButtonProperties & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
14
- Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
15
- }, keyof import("react").Component<any, {}, any>>;
16
- export {};
1
+ export declare const Button: any;
@@ -1,60 +1,118 @@
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 styled from "@gobolt/genesis/utils/styled";
6
2
  import { Button as AntButton } from "antd";
7
- var getPadding = function (size, $themeType, sizing, $isIconButton) {
3
+ const getPadding = (size, $themeType, sizing, $isIconButton) => {
8
4
  if ($isIconButton && (size === "normal" || size === "large")) {
9
- return "".concat(sizing.Size2, "px ").concat(sizing.Size2, "px");
5
+ return `${sizing.Size2}px ${sizing.Size2}px`;
10
6
  }
11
7
  if ($isIconButton && size === "small") {
12
- return "".concat(sizing.Size1, "px ").concat(sizing.Size1, "px");
8
+ return `${sizing.Size1}px ${sizing.Size1}px`;
13
9
  }
14
10
  // utility button padding is different from the main button
15
11
  if ($themeType === "utility" && size === "small") {
16
- return "".concat(sizing.Size1_5, "px ").concat(sizing.Size2, "px");
12
+ return `${sizing.Size1_5}px ${sizing.Size2}px`;
17
13
  }
18
14
  if ($themeType === "utility" && (size === "normal" || size === "large")) {
19
- return "".concat(sizing.Size2_5, "px ").concat(sizing.Size3, "px");
15
+ return `${sizing.Size2_5}px ${sizing.Size3}px`;
20
16
  }
21
17
  if (size === "small") {
22
- return "".concat(sizing.Size1_5, "px ").concat(sizing.Size4, "px");
18
+ return `${sizing.Size1_5}px ${sizing.Size4}px`;
23
19
  }
24
20
  if (size === "normal" || size === "large") {
25
- return "".concat(sizing.Size2_5, "px ").concat(sizing.Size6, "px");
21
+ return `${sizing.Size2_5}px ${sizing.Size6}px`;
26
22
  }
27
- return "".concat(sizing.Size2, "px ").concat(sizing.Size2, "px");
23
+ return `${sizing.Size2}px ${sizing.Size2}px`;
28
24
  };
29
- var getHeight = function (size) {
25
+ const getHeight = (size) => {
30
26
  if (size === "normal" || size === "large") {
31
- return "40px";
27
+ return `40px`;
32
28
  }
33
29
  if (size === "small") {
34
- return "32px";
30
+ return `32px`;
35
31
  }
36
- return "40px";
32
+ return `40px`;
37
33
  };
38
- var getWidth = function (size, $isIconButton) {
34
+ const getWidth = (size, $isIconButton) => {
39
35
  if (!$isIconButton) {
40
- return "auto";
36
+ return `auto`;
41
37
  }
42
38
  if (size === "normal" || size === "large") {
43
- return "40px";
39
+ return `40px`;
44
40
  }
45
41
  if (size === "small") {
46
- return "32px";
42
+ return `32px`;
47
43
  }
48
- return "40px";
44
+ return `40px`;
49
45
  };
50
- var getVariant = function (_a, $themeType, $state, size, $isIconButton) {
51
- var colors = _a.colors, sizing = _a.sizing, borderRadius = _a.borderRadius, components = _a.components;
52
- var backgroundColor = colors[$themeType][$state].backgroundColor;
53
- return "\n &.ant-btn {\n \n color: ".concat(colors[$themeType][$state].color, ";\n font-size: ").concat(sizing.Size4, "px;\n line-height: ").concat(sizing.Size6, "px;\n letter-spacing: 0;\n font-weight: 400;\n border-width: 1px;\n line-height: 1 !important;\n\n width: ").concat(getWidth(size, $isIconButton), "; !important;\n height: ").concat(getHeight(size), "; !important;\n\n background-color: ").concat(colors[$themeType][$state].backgroundColor, ";\n padding: ").concat(getPadding(size, $themeType, sizing, $isIconButton), ";\n\n box-shadow: ").concat($themeType === "utility" ? "0px 1px 2px 0px #00000026" : "none", ";\n\n border-radius: ").concat(borderRadius.BorderRadiusMd, "px;\n gap: ").concat(components.button.gap, "px;\n border-style: solid;\n border-color: ").concat(colors[$themeType][$state].borderColor, ";\n \n transition: all 0.2s ease-in-out;\n\n &:hover {\n color: ").concat(colors[$themeType].hover.color, ";\n background-color: ").concat(colors[$themeType].hover.backgroundColor, ";\n border-color: ").concat(colors[$themeType].hover.borderColor, ";\n }\n\n &:active {\n color: ").concat(colors[$themeType].pressed.color, ";\n background-color: ").concat(colors[$themeType].pressed.backgroundColor, ";\n border-color: ").concat(colors[$themeType].pressed.borderColor, ";\n }\n\n &:focus-visible {\n outline: none;\n color: ").concat(colors[$themeType].focussed.color, ";\n background-color: ").concat(colors[$themeType].focussed.backgroundColor, ";\n box-shadow: 0 0 0 1px #fff, 0 0 0 4px ").concat(colors[$themeType].focussed.ringColor, ";\n border-radius: ").concat(borderRadius.BorderRadiusMd, "px;\n border-color: ").concat(colors[$themeType].focussed.borderColor, ";\n transition: box-shadow 0.2s ease-in-out;\n }\n\n &:disabled {\n color: ").concat(colors[$themeType].disabled.color, ";\n background-color: ").concat(colors[$themeType].disabled.backgroundColor, ";\n border-color: ").concat(colors[$themeType].disabled.borderColor, ";\n cursor: not-allowed;\n }\n \n }\n \n ");
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
+ `;
54
106
  };
55
- var getGenesisButtonClass = function (theme, $themeType, $state, $isIconButton, size) { return "\n &.ant-btn {\n font-family: 'Inter', sans-serif;\n \n ".concat(getVariant(theme, $themeType, $state, size, $isIconButton), "\n } \n"); };
56
- export var Button = styled(AntButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
57
- var theme = _a.theme, $themeType = _a.$themeType, $state = _a.$state, children = _a.children, $isIconButton = _a.$isIconButton, size = _a.size;
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 }) => {
58
116
  return getGenesisButtonClass(theme, $themeType, $state, $isIconButton, size);
59
- });
60
- var templateObject_1;
117
+ }}
118
+ `;
@@ -1,44 +1,21 @@
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 React from "react";
25
3
  import * as S from "./styles";
26
4
  import { STATE } from "../../constants";
27
5
  import DropdownChevron from "../shared/DropdownChevron";
28
6
  import { Select } from "antd";
29
- var Input = React.forwardRef(function (_a, ref) {
30
- var _b = _a.state, state = _b === void 0 ? STATE.active : _b, _c = _a.size, size = _c === void 0 ? "normal" : _c, onChange = _a.onChange, value = _a.value, rest = __rest(_a, ["state", "size", "onChange", "value"]);
7
+ const Input = React.forwardRef(({ state = STATE.active, size = "normal", onChange, value, ...rest }, ref) => {
31
8
  // make sure rest.type is ignored in the final output
32
9
  // we don't want the rest type "number" to be passed to the input
33
10
  // since we have our own version of type
34
- var type = rest.type, validRest = __rest(rest, ["type"]);
11
+ const { type, ...validRest } = rest;
35
12
  // If addonAfter is a Select, use our custom chevron
36
- var addonAfter = React.isValidElement(rest.addonAfter) && rest.addonAfter.type === Select
13
+ const addonAfter = React.isValidElement(rest.addonAfter) && rest.addonAfter.type === Select
37
14
  ? React.cloneElement(rest.addonAfter, {
38
15
  suffixIcon: _jsx(DropdownChevron, {}),
39
16
  })
40
17
  : rest.addonAfter;
41
- var handleChange = React.useCallback(function (e) {
18
+ const handleChange = React.useCallback((e) => {
42
19
  if (onChange) {
43
20
  onChange({
44
21
  event: "inputChange",
@@ -48,9 +25,9 @@ var Input = React.forwardRef(function (_a, ref) {
48
25
  });
49
26
  }
50
27
  }, [onChange]);
51
- return (_jsx(S.Input, __assign({}, validRest, { ref: ref, size: size, state: state, disabled: state === "disabled" || rest.disabled, addonAfter: addonAfter, style: {
28
+ return (_jsx(S.Input, { ...validRest, ref: ref, size: size, state: state, disabled: state === "disabled" || rest.disabled, addonAfter: addonAfter, style: {
52
29
  height: size === "normal" || size === "large" ? "40px" : "32px",
53
- }, onChange: handleChange, value: value })));
30
+ }, onChange: handleChange, value: value }));
54
31
  });
55
32
  Input.displayName = "Input";
56
33
  Input.__ANT_INPUT = true;
@@ -1,18 +1 @@
1
- import type { InputProps as AntInputProperties } from "antd";
2
- import { STATE } from "@gobolt/genesis/constants";
3
- import type { InputRef } from "antd";
4
- interface InputStyledProperties extends Omit<AntInputProperties, "size"> {
5
- state?: keyof typeof STATE;
6
- size?: "normal" | "small" | "large";
7
- value?: string;
8
- }
9
- export declare const Input: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<AntInputProperties & import("react").RefAttributes<InputRef>, "ref"> & {
10
- ref?: ((instance: InputRef | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<InputRef> | null | undefined;
11
- }, InputStyledProperties>> & string & Omit<import("react").ForwardRefExoticComponent<AntInputProperties & import("react").RefAttributes<InputRef>> & {
12
- Group: import("react").FC<import("antd/es/input").GroupProps>;
13
- Search: import("react").ForwardRefExoticComponent<import("antd/es/input").SearchProps & import("react").RefAttributes<InputRef>>;
14
- TextArea: import("react").ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
15
- Password: import("react").ForwardRefExoticComponent<import("antd/es/input").PasswordProps & import("react").RefAttributes<InputRef>>;
16
- OTP: import("react").ForwardRefExoticComponent<import("antd/es/input/OTP").OTPProps & import("react").RefAttributes<import("antd/es/input/OTP").OTPRef>>;
17
- }, keyof import("react").Component<any, {}, any>>;
18
- export {};
1
+ export declare const Input: any;