@gobolt/genesis 0.1.3 → 0.1.6
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.
- package/README.md +4 -6
- package/dist/{Typography-B2J8CPnt.js → Typography-8BO7aTuQ.js} +7 -6
- package/dist/components/Avatar/Avatar.js +4 -3
- package/dist/components/Avatar/__tests__/Avatar.test.js +1 -1
- package/dist/components/Badge/Badge.js +4 -3
- package/dist/components/Badge/__tests__/Badge.test.js +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Breadcrumb/__tests__/Breadcrumb.test.js +1 -1
- package/dist/components/Button/Button.d.ts +4 -3
- package/dist/components/Button/Button.js +28 -24
- package/dist/components/Button/IconButton.d.ts +8 -0
- package/dist/components/Button/IconButton.js +29 -0
- package/dist/components/Button/UtilityButton.d.ts +5 -0
- package/dist/components/Button/UtilityButton.js +29 -0
- package/dist/components/Button/__stories__/Button.stories.d.ts +0 -4
- package/dist/components/Button/__stories__/IconButton.stories.d.ts +8 -0
- package/dist/components/Button/__stories__/UtilityButton.stories.d.ts +7 -0
- package/dist/components/Button/__tests__/Button.test.js +5 -4
- package/dist/components/Button/icon-button-styles.d.ts +12 -0
- package/dist/components/Button/icon-button-styles.js +65 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/Button/index.js +6 -2
- package/dist/components/Button/styles.d.ts +4 -3
- package/dist/components/Button/styles.js +37 -37
- package/dist/components/Card/__tests__/Card.test.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +4 -3
- package/dist/components/Checkbox/__tests__/Checkbox.test.js +1 -1
- package/dist/components/Dashboard/__stories__/DashboardLayoutContent.js +4 -3
- package/dist/components/Dashboard/__stories__/DashboardLayoutHeader.js +5 -4
- package/dist/components/Dashboard/__tests__/Dashboard.test.js +1 -1
- package/dist/components/DatePicker/__tests__/DatePicker.test.js +1 -1
- package/dist/components/DateRangePicker/__tests__/DateRangePicker.test.js +1 -1
- package/dist/components/ErrorBoundary/ErrorBoundary.js +8 -7
- package/dist/components/ErrorBoundary/__tests__/ErrorBoundary.test.js +1 -1
- package/dist/components/ErrorBoundaryFallback/ErrorBoundaryFallback.js +4 -3
- package/dist/components/Form/Form.js +1 -1
- package/dist/components/Form/__stories__/FormStory.js +26 -25
- package/dist/components/Form/__tests__/form.test.js +2 -2
- package/dist/components/Form/index.js +1 -1
- package/dist/components/FormBrandon/Form.js +1 -1
- package/dist/components/FormBrandon/__stories__/FormStory.js +4 -3
- package/dist/components/FormBrandon/__tests__/form.test.js +1 -1
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/__tests__/Input.test.js +1 -1
- package/dist/components/Layout/Content/ResponsiveContent.js +4 -3
- package/dist/components/Layout/MainLayout/MainLayout.js +1 -1
- package/dist/components/Layout/__tests__/Layout.test.js +1 -1
- package/dist/components/Message/Message.js +11 -10
- package/dist/components/Message/__tests__/Message.test.js +1 -1
- package/dist/components/Notification/Notification.js +4 -3
- package/dist/components/Notification/NotificationBadge/__tests__/NotificationBadge.test.js +1 -1
- package/dist/components/Notification/__tests__/Notification.test.js +1 -1
- package/dist/components/Popover/__tests__/Popover.test.js +1 -1
- package/dist/components/Progress/Progress.js +44 -50
- package/dist/components/Progress/Progress.util.js +4 -3
- package/dist/components/Progress/ProgressText.js +4 -3
- package/dist/components/Progress/__tests__/Progress.test.js +1 -1
- package/dist/components/Radio/Radio.js +4 -3
- package/dist/components/Radio/RadioGroup.js +1 -1
- package/dist/components/Radio/__tests__/RadioGroup.test.js +1 -1
- package/dist/components/Row/Row.js +1 -1
- package/dist/components/Row/RowActions/RowActions.js +4 -3
- package/dist/components/Row/RowLabelValue/RowLabelValue.js +5 -4
- package/dist/components/Row/__tests__/Row.test.js +1 -1
- package/dist/components/SegmentedControls/__tests__/SegmentedControls.test.js +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/__tests__/Select.test.js +1 -1
- package/dist/components/Shapes/__tests__/Shapes.test.js +1 -1
- package/dist/components/Switch/__stories__/Switch.stories.d.ts +2 -1
- package/dist/components/Switch/__tests__/Switch.test.js +1 -1
- package/dist/components/Table/__mocks__/table-mocks.js +6 -5
- package/dist/components/Table/__tests__/Table.test.js +1 -1
- package/dist/components/Tabs/__tests__/Tabs.test.js +1 -1
- package/dist/components/Tile/__tests__/Tile.test.js +1 -1
- package/dist/components/Toast/Toast.js +3 -2
- package/dist/components/Toast/__tests__/Toast.test.js +2 -2
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +4 -3
- package/dist/components/Tooltip/__tests__/Tooltip.test.js +1 -1
- package/dist/components/Typography/Typography.js +1 -1
- package/dist/components/Typography/__tests__/Typography.test.js +2 -2
- package/dist/components/Typography/index.js +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +56 -52
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +14 -13
- package/dist/genesis/GenesisThemeBreakdown.js +4 -3
- package/dist/index.js +61 -57
- package/dist/providers/GenesisProvider.js +1 -1
- package/dist/providers/ToastProvider.js +5 -4
- package/dist/providers/index.js +1 -1
- package/dist/providers/useGenesis.js +1 -1
- package/dist/{setup-aZdxWCJq.js → setup-rcqlwLGQ.js} +1 -1
- package/dist/styles/design-tokens/border-tokens/BorderTokenList.js +4 -3
- package/dist/styles/design-tokens/sizing-tokens/SizingTokenList.js +7 -6
- package/dist/styles/design-tokens/variables.d.ts +2 -0
- package/dist/styles/design-tokens/variables.js +581 -579
- package/dist/styles/theme/genesis-theme.d.ts +2 -0
- package/dist/styles/theme/genesis-theme.js +306 -247
- package/dist/styles/theme/genesis-theme.types.d.ts +7 -0
- package/dist/styles/theme/theme-tree/ThemeTree.js +4 -3
- package/dist/test/setup.js +2 -2
- package/package.json +13 -1
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
</div>
|
|
5
|
-
</div>
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://storage.googleapis.com/labs-media/images/genesis-conveyor-mark.svg" width="150" alt="Genesis logo">
|
|
3
|
+
</p>
|
|
6
4
|
|
|
7
5
|
# GENESIS Design System
|
|
8
6
|
|
|
@@ -47,7 +45,7 @@ npm install @gobolt/genesis
|
|
|
47
45
|
The `GenesisProvider` must included within the application as it supplies the Genesis Theme.
|
|
48
46
|
|
|
49
47
|
```jsx
|
|
50
|
-
import { Button, GenesisProvider } from '@gobolt/genesis
|
|
48
|
+
import { Button, GenesisProvider } from '@gobolt/genesis;
|
|
51
49
|
|
|
52
50
|
const Demo = () = {
|
|
53
51
|
|
|
@@ -8,6 +8,7 @@ import "./components/Badge/styles.js";
|
|
|
8
8
|
import { n as mt, d as Ot } from "./styled-components.browser.esm-C47QHsU4.js";
|
|
9
9
|
import "./components/Breadcrumb/styles.js";
|
|
10
10
|
import "./components/Button/styles.js";
|
|
11
|
+
import "./components/Button/icon-button-styles.js";
|
|
11
12
|
import "./components/Card/styles.js";
|
|
12
13
|
import "./components/Checkbox/styles.js";
|
|
13
14
|
import "./components/DateRangePicker/DateRangePicker.js";
|
|
@@ -444,7 +445,7 @@ function ze(t) {
|
|
|
444
445
|
}
|
|
445
446
|
const kt = b.createContext(
|
|
446
447
|
void 0
|
|
447
|
-
), Pe = ({ closeToast: t, toastProps: e, message: o, state: a, action: r }) => /* @__PURE__ */ v(De, { message: o, state: a, close: t, action: r }),
|
|
448
|
+
), Pe = ({ closeToast: t, toastProps: e, message: o, state: a, action: r }) => /* @__PURE__ */ v(De, { message: o, state: a, close: t, action: r }), Ao = ({ children: t }) => {
|
|
448
449
|
const e = mt(), o = (a, r, n) => {
|
|
449
450
|
h.success((s) => /* @__PURE__ */ v(
|
|
450
451
|
Pe,
|
|
@@ -502,7 +503,7 @@ const kt = b.createContext(
|
|
|
502
503
|
theme: e,
|
|
503
504
|
toast: o
|
|
504
505
|
};
|
|
505
|
-
}, Ae = J.Item,
|
|
506
|
+
}, Ae = J.Item, So = Object.assign(
|
|
506
507
|
({ children: t, ...e }) => {
|
|
507
508
|
const { breakpoint: o } = nt();
|
|
508
509
|
return /* @__PURE__ */ v(J, { role: "form", ...e, children: t });
|
|
@@ -519,7 +520,7 @@ const kt = b.createContext(
|
|
|
519
520
|
cursor: ${({ $isDisabled: t }) => t ? "not-allowed" : "pointer"};
|
|
520
521
|
pointer-events: ${({ $isDisabled: t }) => t ? "none" : "auto"};
|
|
521
522
|
position: relative;
|
|
522
|
-
`,
|
|
523
|
+
`, Bo = ({ id: t, label: e, selectedId: o, onChange: a, isDisabled: r }) => {
|
|
523
524
|
const [n, s] = B(!1), [f, c] = B(!1), [d, u] = B(!1), x = M(null);
|
|
524
525
|
X(() => {
|
|
525
526
|
s(o === t);
|
|
@@ -707,12 +708,12 @@ const kt = b.createContext(
|
|
|
707
708
|
);
|
|
708
709
|
};
|
|
709
710
|
export {
|
|
710
|
-
|
|
711
|
+
So as F,
|
|
711
712
|
yt as R,
|
|
712
713
|
De as T,
|
|
713
714
|
rt as a,
|
|
714
|
-
|
|
715
|
-
|
|
715
|
+
Bo as b,
|
|
716
|
+
Ao as c,
|
|
716
717
|
Ae as d,
|
|
717
718
|
kt as e,
|
|
718
719
|
Ne as f,
|
|
@@ -2,9 +2,10 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import { Avatar as a } from "./styles.js";
|
|
3
3
|
import "../Badge/styles.js";
|
|
4
4
|
import "../../providers/BreakpointThemeProvider.js";
|
|
5
|
-
import { a as e } from "../../Typography-
|
|
5
|
+
import { a as e } from "../../Typography-8BO7aTuQ.js";
|
|
6
6
|
import "../Breadcrumb/styles.js";
|
|
7
7
|
import "../Button/styles.js";
|
|
8
|
+
import "../Button/icon-button-styles.js";
|
|
8
9
|
import "../Card/styles.js";
|
|
9
10
|
import "../Checkbox/styles.js";
|
|
10
11
|
import "../DateRangePicker/DateRangePicker.js";
|
|
@@ -29,7 +30,7 @@ import "../Tabs/styles.js";
|
|
|
29
30
|
import "../Tile/styles.js";
|
|
30
31
|
import "../Toast/styles.js";
|
|
31
32
|
import "../Tooltip/styles.js";
|
|
32
|
-
const
|
|
33
|
+
const O = ({
|
|
33
34
|
size: r = 64,
|
|
34
35
|
shape: o = "circle",
|
|
35
36
|
imageUrl: i,
|
|
@@ -58,5 +59,5 @@ const N = ({
|
|
|
58
59
|
}
|
|
59
60
|
);
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
+
O as default
|
|
62
63
|
};
|
|
@@ -3,8 +3,9 @@ import { Badge as e } from "./styles.js";
|
|
|
3
3
|
import "../Avatar/styles.js";
|
|
4
4
|
import "../Breadcrumb/styles.js";
|
|
5
5
|
import "../../providers/BreakpointThemeProvider.js";
|
|
6
|
-
import { u as a, a as d } from "../../Typography-
|
|
6
|
+
import { u as a, a as d } from "../../Typography-8BO7aTuQ.js";
|
|
7
7
|
import "../Button/styles.js";
|
|
8
|
+
import "../Button/icon-button-styles.js";
|
|
8
9
|
import "../Card/styles.js";
|
|
9
10
|
import "../Checkbox/styles.js";
|
|
10
11
|
import "../DateRangePicker/DateRangePicker.js";
|
|
@@ -30,7 +31,7 @@ import "../Tabs/styles.js";
|
|
|
30
31
|
import "../Tile/styles.js";
|
|
31
32
|
import "../Toast/styles.js";
|
|
32
33
|
import "../Tooltip/styles.js";
|
|
33
|
-
const n = !1,
|
|
34
|
+
const n = !1, Q = ({ label: r, state: o = "info", isDisabled: t, ...p }) => {
|
|
34
35
|
const { theme: i } = a();
|
|
35
36
|
return r ? /* @__PURE__ */ m(
|
|
36
37
|
e,
|
|
@@ -67,5 +68,5 @@ const n = !1, P = ({ label: r, state: o = "info", isDisabled: t, ...p }) => {
|
|
|
67
68
|
);
|
|
68
69
|
};
|
|
69
70
|
export {
|
|
70
|
-
|
|
71
|
+
Q as default
|
|
71
72
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { BreadcrumbWrapper as s, Breadcrumb as i } from "./styles.js";
|
|
3
3
|
import "../../providers/BreakpointThemeProvider.js";
|
|
4
|
-
import { u as m } from "../../Typography-
|
|
4
|
+
import { u as m } from "../../Typography-8BO7aTuQ.js";
|
|
5
5
|
const c = ({ items: e, isDisabled: a = !1 }) => {
|
|
6
6
|
const { breakpoint: o } = m();
|
|
7
7
|
return /* @__PURE__ */ r(s, { $isDisabled: a, children: /* @__PURE__ */ r(i, { items: e, breakpoint: o, role: "navigation" }) });
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { default as React, MouseEvent } from 'react';
|
|
2
2
|
import { ButtonProps as AntButtonProps } from 'antd/es/button';
|
|
3
3
|
import { STATE } from '../../constants';
|
|
4
|
-
type ButtonThemeType = "primary" | "secondary" | "tertiary" | "utility";
|
|
5
|
-
export interface ButtonProps extends Omit<AntButtonProps, "type"> {
|
|
4
|
+
type ButtonThemeType = "primary" | "secondary" | "tertiary" | "utility" | "icon";
|
|
5
|
+
export interface ButtonProps extends Omit<AntButtonProps, "type" | "size"> {
|
|
6
6
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
themeType?: ButtonThemeType;
|
|
9
9
|
state?: keyof typeof STATE;
|
|
10
10
|
isIconButton?: boolean;
|
|
11
|
-
size?: "
|
|
11
|
+
size?: "small" | "normal" | "large";
|
|
12
|
+
isSelected?: boolean;
|
|
12
13
|
}
|
|
13
14
|
declare const Button: React.FC<ButtonProps>;
|
|
14
15
|
export default Button;
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Button as
|
|
3
|
-
const
|
|
4
|
-
children:
|
|
5
|
-
onClick:
|
|
6
|
-
themeType:
|
|
7
|
-
state:
|
|
8
|
-
isIconButton:
|
|
9
|
-
size:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { Button as c } from "./styles.js";
|
|
3
|
+
const l = (t, e) => e ? "selected" : t === "active" || t === "disabled" ? t : "active", f = ({
|
|
4
|
+
children: t,
|
|
5
|
+
onClick: e,
|
|
6
|
+
themeType: n = "primary",
|
|
7
|
+
state: o = "active",
|
|
8
|
+
isIconButton: r = !1,
|
|
9
|
+
size: i = "normal",
|
|
10
|
+
isSelected: d,
|
|
11
|
+
...a
|
|
12
|
+
}) => {
|
|
13
|
+
const s = l(o, d);
|
|
14
|
+
return /* @__PURE__ */ u(
|
|
15
|
+
c,
|
|
16
|
+
{
|
|
17
|
+
onClick: e,
|
|
18
|
+
$themeType: n,
|
|
19
|
+
$state: s,
|
|
20
|
+
disabled: o === "disabled" || a.disabled,
|
|
21
|
+
$isIconButton: r,
|
|
22
|
+
size: i,
|
|
23
|
+
...a,
|
|
24
|
+
children: t
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
24
28
|
export {
|
|
25
|
-
|
|
29
|
+
f as default
|
|
26
30
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ButtonProps } from './Button';
|
|
2
|
+
export interface IconButtonProps extends Omit<ButtonProps, "themeType" | "size"> {
|
|
3
|
+
icon: React.ReactNode;
|
|
4
|
+
size?: "small" | "normal" | "large";
|
|
5
|
+
isSelected?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const IconButton: ({ isSelected, state, onClick, icon, size, ...rest }: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default IconButton;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Button as m } from "./icon-button-styles.js";
|
|
3
|
+
import { TYPE as r } from "../../constants/index.js";
|
|
4
|
+
const f = ({
|
|
5
|
+
isSelected: o = !1,
|
|
6
|
+
state: e = "active",
|
|
7
|
+
onClick: i,
|
|
8
|
+
icon: d,
|
|
9
|
+
size: a = "small",
|
|
10
|
+
...t
|
|
11
|
+
}) => {
|
|
12
|
+
const c = e === "active" || e === "disabled" ? e : "active", l = r.icon;
|
|
13
|
+
return /* @__PURE__ */ n(
|
|
14
|
+
m,
|
|
15
|
+
{
|
|
16
|
+
onClick: i,
|
|
17
|
+
$themeType: l,
|
|
18
|
+
$state: c,
|
|
19
|
+
disabled: e === "disabled" || t.disabled,
|
|
20
|
+
size: a,
|
|
21
|
+
$isSelected: o,
|
|
22
|
+
...t,
|
|
23
|
+
children: d
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
f as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ButtonProps } from './Button';
|
|
2
|
+
export interface UtilityButtonProps extends Omit<ButtonProps, "themeType"> {
|
|
3
|
+
}
|
|
4
|
+
declare const UtilityButton: ({ children, onClick, state, isIconButton, size, ...rest }: UtilityButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default UtilityButton;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import n from "./Button.js";
|
|
3
|
+
import { TYPE as s } from "../../constants/index.js";
|
|
4
|
+
const f = ({
|
|
5
|
+
children: o,
|
|
6
|
+
onClick: e,
|
|
7
|
+
state: t = "active",
|
|
8
|
+
isIconButton: a = !1,
|
|
9
|
+
size: d = "normal",
|
|
10
|
+
...i
|
|
11
|
+
}) => {
|
|
12
|
+
const l = t === "active" || t === "disabled" ? t : "active", r = s.utility;
|
|
13
|
+
return /* @__PURE__ */ m(
|
|
14
|
+
n,
|
|
15
|
+
{
|
|
16
|
+
onClick: e,
|
|
17
|
+
themeType: r,
|
|
18
|
+
state: l,
|
|
19
|
+
disabled: t === "disabled" || i.disabled,
|
|
20
|
+
isIconButton: a,
|
|
21
|
+
size: d,
|
|
22
|
+
...i,
|
|
23
|
+
children: o
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
f as default
|
|
29
|
+
};
|
|
@@ -7,9 +7,5 @@ export declare const Focussed: Story;
|
|
|
7
7
|
export declare const Primary: Story;
|
|
8
8
|
export declare const Secondary: Story;
|
|
9
9
|
export declare const Tertiary: Story;
|
|
10
|
-
export declare const Utility: Story;
|
|
11
|
-
export declare const SmallUtility: Story;
|
|
12
10
|
export declare const LeftIcon: Story;
|
|
13
11
|
export declare const RightIcon: Story;
|
|
14
|
-
export declare const Icon: Story;
|
|
15
|
-
export declare const UtilityIcon: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { default as IconButton } from '../IconButton';
|
|
3
|
+
declare const meta: Meta<typeof IconButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof IconButton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Focussed: Story;
|
|
8
|
+
export declare const Selected: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { default as UtilityButton } from '../UtilityButton';
|
|
3
|
+
declare const meta: Meta<typeof UtilityButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof UtilityButton>;
|
|
6
|
+
export declare const Primary: Story;
|
|
7
|
+
export declare const Icon: Story;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { a as r, s as
|
|
3
|
-
import
|
|
2
|
+
import { a as r, s as i } from "../../../setup-rcqlwLGQ.js";
|
|
3
|
+
import n from "../Button.js";
|
|
4
|
+
import "../icon-button-styles.js";
|
|
4
5
|
import { v as m } from "../../../vi.B5EKKJdE-BsDIxc7v.js";
|
|
5
6
|
describe("<Button />", () => {
|
|
6
7
|
let e;
|
|
@@ -10,8 +11,8 @@ describe("<Button />", () => {
|
|
|
10
11
|
themeType: "primary"
|
|
11
12
|
};
|
|
12
13
|
});
|
|
13
|
-
const t = () => r(/* @__PURE__ */ o(
|
|
14
|
+
const t = () => r(/* @__PURE__ */ o(n, { ...e, children: "Ship it!" }));
|
|
14
15
|
it("should render the button", () => {
|
|
15
|
-
t(), expect(
|
|
16
|
+
t(), expect(i.getByText("Ship it!")).toBeInTheDocument();
|
|
16
17
|
});
|
|
17
18
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GenesisTheme } from '../../styles/theme/genesis-theme.types';
|
|
2
|
+
interface StyledIconButtonProps {
|
|
3
|
+
theme?: GenesisTheme;
|
|
4
|
+
$themeType?: "primary" | "secondary" | "tertiary" | "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>, StyledIconButtonProps>> & string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { d as u } from "../../styled-components.browser.esm-C47QHsU4.js";
|
|
2
|
+
const b = (o, d) => (console.log("Icon padding: size", o), o === "small" ? `${d.Size1}px ${d.Size1}px` : `${d.Size2}px ${d.Size2}px`), c = ({ colors: o, sizing: d, borderRadius: n, components: a }, r, i, l, t) => `
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
text-align: center;
|
|
7
|
+
color: ${o[r][i].color};
|
|
8
|
+
font-size: ${d.Size4}px;
|
|
9
|
+
line-height: ${d.Size6}px;
|
|
10
|
+
letter-spacing: 0;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
border-width: 1px;
|
|
13
|
+
|
|
14
|
+
width: auto; !important;
|
|
15
|
+
height: auto; !important;
|
|
16
|
+
|
|
17
|
+
background-color:${t ? o[r].hover.backgroundColor : o[r][i].backgroundColor};
|
|
18
|
+
padding: ${b(l, d)};
|
|
19
|
+
|
|
20
|
+
box-shadow: ${r === "utility" ? "0px 1px 2px 0px #00000026" : "none"};
|
|
21
|
+
|
|
22
|
+
border-radius: ${n.BorderRadiusMd}px;
|
|
23
|
+
gap: ${a.button.gap}px;
|
|
24
|
+
border-style: solid;
|
|
25
|
+
border-color: ${o[r][i].borderColor};
|
|
26
|
+
|
|
27
|
+
transition: all 0.2s ease-in-out;
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
color: ${o[r].hover.color};
|
|
31
|
+
background-color: ${o[r].hover.backgroundColor};
|
|
32
|
+
border-color: ${o[r].hover.borderColor};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:active {
|
|
36
|
+
color: ${o[r].pressed.color};
|
|
37
|
+
background-color: ${o[r].pressed.backgroundColor};
|
|
38
|
+
border-color: ${o[r].pressed.borderColor};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:focus-visible {
|
|
42
|
+
outline: none;
|
|
43
|
+
color: ${o[r].focussed.color};
|
|
44
|
+
background-color: ${o[r].focussed.backgroundColor};
|
|
45
|
+
box-shadow: 0 0 0 1px #fff, 0 0 0 4px ${o[r].focussed.ringColor};
|
|
46
|
+
border-radius: ${n.BorderRadiusMd}px;
|
|
47
|
+
border-color: ${o[r].focussed.borderColor};
|
|
48
|
+
transition: box-shadow 0.2s ease-in-out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:disabled {
|
|
52
|
+
color: ${o[r].disabled.color};
|
|
53
|
+
background-color: ${o[r].disabled.backgroundColor};
|
|
54
|
+
border-color: ${o[r].disabled.borderColor};
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
`, s = (o, d, n, a, r) => `
|
|
58
|
+
font-family: 'Inter', sans-serif;
|
|
59
|
+
${c(o, d, n, a, r)}
|
|
60
|
+
`, g = u.button`
|
|
61
|
+
${({ theme: o, $themeType: d, $state: n, size: a, $isSelected: r }) => s(o, d, n, a, r)}
|
|
62
|
+
`;
|
|
63
|
+
export {
|
|
64
|
+
g as Button
|
|
65
|
+
};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { default } from './Button';
|
|
2
2
|
export type { ButtonProps } from './Button';
|
|
3
|
+
export { default as UtilityButton } from './UtilityButton';
|
|
4
|
+
export type { UtilityButtonProps } from './UtilityButton';
|
|
5
|
+
export { default as IconButton } from './IconButton';
|
|
6
|
+
export type { IconButtonProps } from './IconButton';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as e } from "./Button.js";
|
|
2
|
+
import { default as r } from "./UtilityButton.js";
|
|
3
|
+
import { default as u } from "./IconButton.js";
|
|
2
4
|
export {
|
|
3
|
-
|
|
5
|
+
u as IconButton,
|
|
6
|
+
r as UtilityButton,
|
|
7
|
+
e as default
|
|
4
8
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ButtonProps as AntButtonProps } from 'antd/es/button';
|
|
2
2
|
import { GenesisTheme } from '../../styles/theme/genesis-theme.types';
|
|
3
|
-
interface StyledButtonProps extends AntButtonProps {
|
|
3
|
+
interface StyledButtonProps extends Omit<AntButtonProps, "type" | "size"> {
|
|
4
4
|
theme?: GenesisTheme;
|
|
5
|
-
$themeType?: "primary" | "secondary" | "tertiary" | "utility";
|
|
6
|
-
$state?: "active" | "hover" | "pressed" | "focus" | "disabled";
|
|
5
|
+
$themeType?: "primary" | "secondary" | "tertiary" | "utility" | "icon";
|
|
6
|
+
$state?: "active" | "hover" | "pressed" | "focus" | "disabled" | "selected";
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
$isIconButton?: boolean;
|
|
9
|
+
size?: "small" | "normal" | "large";
|
|
9
10
|
}
|
|
10
11
|
export declare const Button: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<Omit<AntButtonProps & import('react').RefAttributes<HTMLAnchorElement | HTMLButtonElement>, "ref"> & {
|
|
11
12
|
ref?: import('react').Ref<HTMLAnchorElement | HTMLButtonElement>;
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import { B as
|
|
3
|
-
const
|
|
1
|
+
import { d as b } from "../../styled-components.browser.esm-C47QHsU4.js";
|
|
2
|
+
import { B as x } from "../../button-CYVlK7G0.js";
|
|
3
|
+
const c = (r, a, d, l) => l && (r === "normal" || r === "large") ? `${d.Size2}px ${d.Size2}px` : l && r === "small" ? `${d.Size1}px ${d.Size1}px` : a === "utility" && r === "small" ? `${d.Size1_5}px ${d.Size2}px` : a === "utility" && (r === "normal" || r === "large") ? `${d.Size3}px ${d.Size2_5}px` : r === "small" ? `${d.Size1_5}px ${d.Size4}px` : r === "normal" || r === "large" ? `${d.Size2_5}px ${d.Size6}px` : `${d.Size2}px ${d.Size2}px`, i = ({ colors: r, sizing: a, borderRadius: d, components: l }, o, n, u, t) => (r[o][n].backgroundColor, `
|
|
4
4
|
&.ant-btn {
|
|
5
5
|
|
|
6
|
-
color: ${o
|
|
7
|
-
font-size: ${
|
|
8
|
-
line-height: ${
|
|
6
|
+
color: ${r[o][n].color};
|
|
7
|
+
font-size: ${a.Size4}px;
|
|
8
|
+
line-height: ${a.Size6}px;
|
|
9
9
|
letter-spacing: 0;
|
|
10
10
|
font-weight: 400;
|
|
11
11
|
border-width: 1px;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
width: auto; !important;
|
|
14
|
+
height: auto; !important;
|
|
14
15
|
|
|
15
|
-
background-color: ${o
|
|
16
|
-
padding: ${
|
|
16
|
+
background-color: ${r[o][n].backgroundColor};
|
|
17
|
+
padding: ${c(u, o, a, t)};
|
|
17
18
|
|
|
18
|
-
box-shadow: ${
|
|
19
|
+
box-shadow: ${o === "utility" ? "0px 1px 2px 0px #00000026" : "none"};
|
|
19
20
|
|
|
20
|
-
border-radius: ${
|
|
21
|
-
gap: ${
|
|
21
|
+
border-radius: ${d.BorderRadiusMd}px;
|
|
22
|
+
gap: ${l.button.gap}px;
|
|
22
23
|
border-style: solid;
|
|
23
|
-
border-color: ${o
|
|
24
|
+
border-color: ${r[o][n].borderColor};
|
|
24
25
|
|
|
25
26
|
transition: all 0.2s ease-in-out;
|
|
26
27
|
|
|
27
28
|
&:hover {
|
|
28
|
-
color: ${o
|
|
29
|
-
background-color: ${o
|
|
30
|
-
border-color: ${o
|
|
29
|
+
color: ${r[o].hover.color};
|
|
30
|
+
background-color: ${r[o].hover.backgroundColor};
|
|
31
|
+
border-color: ${r[o].hover.borderColor};
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
&:active {
|
|
34
|
-
color: ${o
|
|
35
|
-
background-color: ${o
|
|
36
|
-
border-color: ${o
|
|
35
|
+
color: ${r[o].pressed.color};
|
|
36
|
+
background-color: ${r[o].pressed.backgroundColor};
|
|
37
|
+
border-color: ${r[o].pressed.borderColor};
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
&:focus-visible {
|
|
40
41
|
outline: none;
|
|
41
|
-
color: ${o
|
|
42
|
-
background-color: ${o
|
|
43
|
-
box-shadow: 0 0 0 1px #fff, 0 0 0 4px ${o
|
|
44
|
-
border-radius: ${
|
|
45
|
-
border-color: ${o
|
|
42
|
+
color: ${r[o].focussed.color};
|
|
43
|
+
background-color: ${r[o].focussed.backgroundColor};
|
|
44
|
+
box-shadow: 0 0 0 1px #fff, 0 0 0 4px ${r[o].focussed.ringColor};
|
|
45
|
+
border-radius: ${d.BorderRadiusMd}px;
|
|
46
|
+
border-color: ${r[o].focussed.borderColor};
|
|
46
47
|
transition: box-shadow 0.2s ease-in-out;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
&:disabled {
|
|
50
|
-
color: ${o
|
|
51
|
-
background-color: ${o
|
|
52
|
-
border-color: ${o
|
|
51
|
+
color: ${r[o].disabled.color};
|
|
52
|
+
background-color: ${r[o].disabled.backgroundColor};
|
|
53
|
+
border-color: ${r[o].disabled.borderColor};
|
|
53
54
|
cursor: not-allowed;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
`), f = (r, a, d, l, o) => `
|
|
57
58
|
&.ant-btn {
|
|
58
59
|
font-family: 'Inter', sans-serif;
|
|
59
60
|
|
|
60
|
-
${
|
|
61
|
+
${i(r, a, d, o, l)}
|
|
61
62
|
}
|
|
62
|
-
`,
|
|
63
|
-
${({ theme:
|
|
64
|
-
o,
|
|
65
|
-
d,
|
|
66
|
-
n,
|
|
67
|
-
a,
|
|
63
|
+
`, $ = b(x)`
|
|
64
|
+
${({ theme: r, $themeType: a, $state: d, children: l, $isIconButton: o, size: n }) => f(
|
|
68
65
|
r,
|
|
69
|
-
|
|
66
|
+
a,
|
|
67
|
+
d,
|
|
68
|
+
o,
|
|
69
|
+
n
|
|
70
70
|
)}
|
|
71
71
|
`;
|
|
72
72
|
export {
|
|
73
|
-
|
|
73
|
+
$ as Button
|
|
74
74
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { StyledCheckbox as p } from "./styles.js";
|
|
3
3
|
import "../../providers/BreakpointThemeProvider.js";
|
|
4
|
-
import { u as e, a as d } from "../../Typography-
|
|
4
|
+
import { u as e, a as d } from "../../Typography-8BO7aTuQ.js";
|
|
5
5
|
import { TYPE as a } from "../../constants/index.js";
|
|
6
6
|
import "../Avatar/styles.js";
|
|
7
7
|
import "../Badge/styles.js";
|
|
8
8
|
import "../Breadcrumb/styles.js";
|
|
9
9
|
import "../Button/styles.js";
|
|
10
|
+
import "../Button/icon-button-styles.js";
|
|
10
11
|
import "../Card/styles.js";
|
|
11
12
|
import "../DateRangePicker/DateRangePicker.js";
|
|
12
13
|
import "react";
|
|
@@ -30,7 +31,7 @@ import "../Tabs/styles.js";
|
|
|
30
31
|
import "../Tile/styles.js";
|
|
31
32
|
import "../Toast/styles.js";
|
|
32
33
|
import "../Tooltip/styles.js";
|
|
33
|
-
const
|
|
34
|
+
const N = ({ state: o = "active", label: t, ...i }) => {
|
|
34
35
|
const { breakpoint: s } = e(), m = a.secondary;
|
|
35
36
|
return t ? /* @__PURE__ */ r(
|
|
36
37
|
p,
|
|
@@ -48,5 +49,5 @@ const M = ({ state: o = "active", label: t, ...i }) => {
|
|
|
48
49
|
);
|
|
49
50
|
};
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
N as default
|
|
52
53
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { a as c, s as t } from "../../../setup-
|
|
2
|
+
import { a as c, s as t } from "../../../setup-rcqlwLGQ.js";
|
|
3
3
|
import s from "../Checkbox.js";
|
|
4
4
|
import { d as a, i as r, g as d } from "../../../vi.B5EKKJdE-BsDIxc7v.js";
|
|
5
5
|
a("Checkbox", () => {
|