orcs-design-system 3.2.4 → 3.2.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.
Files changed (96) hide show
  1. package/es/GlobalStyles.js +1 -31
  2. package/es/SystemThemeProvider.js +11 -5
  3. package/es/assets/Colour/Colour.stories.js +211 -0
  4. package/es/assets/Colour/index.js +3 -3
  5. package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
  6. package/es/components/ActionsMenu/index.js +144 -229
  7. package/es/components/Avatar/Avatar.stories.js +212 -196
  8. package/es/components/Avatar/index.js +280 -307
  9. package/es/components/Badge/Badge.stories.js +71 -46
  10. package/es/components/Badge/index.js +71 -74
  11. package/es/components/Box/Box.stories.js +51 -35
  12. package/es/components/Box/index.js +33 -34
  13. package/es/components/Button/Button.stories.js +161 -145
  14. package/es/components/Button/ButtonLink.stories.js +152 -139
  15. package/es/components/Button/index.js +79 -99
  16. package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
  17. package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
  18. package/es/components/ButtonGroup/index.js +103 -99
  19. package/es/components/Card/Card.stories.js +94 -62
  20. package/es/components/Card/index.js +50 -71
  21. package/es/components/Checkbox/Checkbox.stories.js +37 -43
  22. package/es/components/Checkbox/index.js +61 -76
  23. package/es/components/DatePicker/DatePicker.stories.js +86 -118
  24. package/es/components/DatePicker/index.js +71 -187
  25. package/es/components/Divider/Divider.stories.js +39 -42
  26. package/es/components/Divider/index.js +21 -27
  27. package/es/components/Expandable/Expandable.stories.js +46 -36
  28. package/es/components/Expandable/index.js +55 -82
  29. package/es/components/Flex/Flex.stories.js +19 -5
  30. package/es/components/Flex/FlexItem.stories.js +10 -9
  31. package/es/components/Flex/index.js +34 -27
  32. package/es/components/Grid/Grid.stories.js +129 -55
  33. package/es/components/Grid/index.js +25 -24
  34. package/es/components/Header/Header.stories.js +101 -92
  35. package/es/components/Header/index.js +433 -436
  36. package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
  37. package/es/components/HeaderSimple/index.js +73 -68
  38. package/es/components/Icon/Icon.stories.js +58 -57
  39. package/es/components/Icon/index.js +48 -46
  40. package/es/components/Loading/Loading.stories.js +32 -39
  41. package/es/components/Loading/index.js +44 -51
  42. package/es/components/Modal/Modal.stories.js +172 -153
  43. package/es/components/Modal/index.js +126 -134
  44. package/es/components/Notification/Notification.stories.js +59 -58
  45. package/es/components/Notification/index.js +123 -133
  46. package/es/components/Popover/Popover.stories.js +134 -102
  47. package/es/components/Popover/index.js +65 -111
  48. package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
  49. package/es/components/ProgressBar/index.js +29 -34
  50. package/es/components/RadioButton/RadioButton.stories.js +32 -37
  51. package/es/components/RadioButton/index.js +170 -184
  52. package/es/components/Range/Range.stories.js +19 -19
  53. package/es/components/Range/index.js +35 -45
  54. package/es/components/Select/Select.stories.js +107 -128
  55. package/es/components/Select/index.js +324 -336
  56. package/es/components/SideNav/NavItem.js +112 -122
  57. package/es/components/SideNav/SideNav.stories.js +84 -57
  58. package/es/components/SideNav/index.js +161 -185
  59. package/es/components/Sidebar/Sidebar.stories.js +50 -33
  60. package/es/components/Sidebar/index.js +152 -155
  61. package/es/components/Spacer/Spacer.stories.js +35 -32
  62. package/es/components/Spacer/index.js +20 -20
  63. package/es/components/StatusDot/StatusDot.stories.js +103 -90
  64. package/es/components/StatusDot/index.js +36 -38
  65. package/es/components/StyledLink/StyledLink.stories.js +68 -69
  66. package/es/components/StyledLink/index.js +47 -48
  67. package/es/components/Table/Table.stories.js +118 -112
  68. package/es/components/Table/getExpandColumnConfig.js +67 -62
  69. package/es/components/Table/index.js +24 -27
  70. package/es/components/Table/muiStyleOverrides.js +10 -8
  71. package/es/components/Tabs/Tab.stories.js +55 -38
  72. package/es/components/Tabs/TabsContainer.stories.js +30 -22
  73. package/es/components/Tabs/index.js +95 -92
  74. package/es/components/Tag/Tag.stories.js +250 -220
  75. package/es/components/Tag/index.js +118 -190
  76. package/es/components/TextArea/TextArea.stories.js +76 -89
  77. package/es/components/TextArea/index.js +117 -115
  78. package/es/components/TextInput/TextInput.stories.js +41 -61
  79. package/es/components/TextInput/index.js +127 -171
  80. package/es/components/Toggle/Toggle.stories.js +63 -62
  81. package/es/components/Toggle/index.js +43 -77
  82. package/es/components/TreeNav/TreeNav.stories.js +7 -8
  83. package/es/components/TreeNav/index.js +72 -69
  84. package/es/components/Typography/Typography.stories.js +174 -0
  85. package/es/components/Typography/index.js +252 -308
  86. package/es/components.test.js +1 -1
  87. package/es/hooks/isVisible.js +6 -10
  88. package/es/hooks/keepInView.js +27 -32
  89. package/es/hooks/keypress.js +14 -14
  90. package/es/hooks/useInputFocus.js +5 -5
  91. package/es/hooks/usePrevious.js +3 -3
  92. package/es/systemThemeCollapsed.js +53 -53
  93. package/es/systemtheme.js +53 -53
  94. package/es/utils/selectUtil.js +1 -1
  95. package/es/utils/selectUtil.test.js +6 -6
  96. package/package.json +29 -38
@@ -3,186 +3,199 @@ import Icon from "../Icon";
3
3
  import Spacer from "../Spacer";
4
4
  import Flex from "../Flex";
5
5
  import { VARIANT_COLORS, ButtonLink } from ".";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
7
  export default {
7
8
  title: "Components/Buttons/ButtonLink",
8
9
  component: ButtonLink
9
10
  };
10
- var link = "http://www.google.com";
11
- export var defaultButton = function defaultButton() {
12
- return /*#__PURE__*/React.createElement(ButtonLink, {
13
- href: link
14
- }, "Default button");
15
- };
11
+ const link = "http://www.google.com";
12
+ export const defaultButton = () => /*#__PURE__*/_jsx(ButtonLink, {
13
+ href: link,
14
+ children: "Default button"
15
+ });
16
16
  defaultButton.storyName = "Default button";
17
- export var variants = function variants() {
18
- return /*#__PURE__*/React.createElement(Spacer, {
19
- my: "3"
20
- }, Object.keys(VARIANT_COLORS).map(function (variant) {
21
- return /*#__PURE__*/React.createElement(ButtonLink, {
22
- large: true,
23
- key: variant,
24
- variant: variant,
25
- href: link
26
- }, variant);
27
- }));
28
- };
29
- export var alternateSize = function alternateSize() {
30
- return /*#__PURE__*/React.createElement(Spacer, {
31
- my: "3"
32
- }, /*#__PURE__*/React.createElement(ButtonLink, {
17
+ export const variants = () => /*#__PURE__*/_jsx(Spacer, {
18
+ my: "3",
19
+ children: Object.keys(VARIANT_COLORS).map(variant => /*#__PURE__*/_jsx(ButtonLink, {
20
+ large: true,
21
+ variant: variant,
22
+ href: link,
23
+ children: variant
24
+ }, variant))
25
+ });
26
+ export const alternateSize = () => /*#__PURE__*/_jsxs(Spacer, {
27
+ my: "3",
28
+ children: [/*#__PURE__*/_jsx(ButtonLink, {
33
29
  small: true,
34
- href: link
35
- }, "Small button"), /*#__PURE__*/React.createElement(ButtonLink, {
30
+ href: link,
31
+ children: "Small button"
32
+ }), /*#__PURE__*/_jsx(ButtonLink, {
36
33
  large: true,
37
- href: link
38
- }, "Large button"), /*#__PURE__*/React.createElement(ButtonLink, {
34
+ href: link,
35
+ children: "Large button"
36
+ }), /*#__PURE__*/_jsx(ButtonLink, {
39
37
  height: "xxxl",
40
- href: link
41
- }, "Specified height button"), /*#__PURE__*/React.createElement(ButtonLink, {
42
38
  href: link,
43
- width: "100px"
44
- }, "A multiple-line button with specified width"));
45
- };
39
+ children: "Specified height button"
40
+ }), /*#__PURE__*/_jsx(ButtonLink, {
41
+ href: link,
42
+ width: "100px",
43
+ children: "A multiple-line button with specified width"
44
+ })]
45
+ });
46
46
  alternateSize.storyName = "Alternate sizes";
47
- export var alternateColours = function alternateColours() {
48
- return /*#__PURE__*/React.createElement(Spacer, {
49
- my: "3"
50
- }, /*#__PURE__*/React.createElement(ButtonLink, {
47
+ export const alternateColours = () => /*#__PURE__*/_jsxs(Spacer, {
48
+ my: "3",
49
+ children: [/*#__PURE__*/_jsx(ButtonLink, {
51
50
  variant: "success",
52
- href: link
53
- }, "Success/green button"), /*#__PURE__*/React.createElement(ButtonLink, {
51
+ href: link,
52
+ children: "Success/green button"
53
+ }), /*#__PURE__*/_jsx(ButtonLink, {
54
54
  variant: "danger",
55
- href: link
56
- }, "Danger/red button"));
57
- };
55
+ href: link,
56
+ children: "Danger/red button"
57
+ })]
58
+ });
58
59
  alternateColours.storyName = "Alternate colours";
59
- export var ghost = function ghost() {
60
- return /*#__PURE__*/React.createElement(Spacer, {
61
- my: "3"
62
- }, /*#__PURE__*/React.createElement(ButtonLink, {
60
+ export const ghost = () => /*#__PURE__*/_jsxs(Spacer, {
61
+ my: "3",
62
+ children: [/*#__PURE__*/_jsx(ButtonLink, {
63
63
  small: true,
64
64
  variant: "ghost",
65
- href: link
66
- }, "Small ghost button"), /*#__PURE__*/React.createElement(ButtonLink, {
65
+ href: link,
66
+ children: "Small ghost button"
67
+ }), /*#__PURE__*/_jsx(ButtonLink, {
67
68
  variant: "ghost",
68
- href: link
69
- }, "Regular ghost button"), /*#__PURE__*/React.createElement(ButtonLink, {
69
+ href: link,
70
+ children: "Regular ghost button"
71
+ }), /*#__PURE__*/_jsx(ButtonLink, {
70
72
  large: true,
71
73
  variant: "ghost",
72
- href: link
73
- }, "Large ghost button"));
74
- };
74
+ href: link,
75
+ children: "Large ghost button"
76
+ })]
77
+ });
75
78
  ghost.storyName = "Ghost style";
76
- export var fullWidth = function fullWidth() {
77
- return /*#__PURE__*/React.createElement(ButtonLink, {
78
- fullWidth: true,
79
- href: link
80
- }, "Full width button");
81
- };
79
+ export const fullWidth = () => /*#__PURE__*/_jsx(ButtonLink, {
80
+ fullWidth: true,
81
+ href: link,
82
+ children: "Full width button"
83
+ });
82
84
  fullWidth.storyName = "Full width";
83
- export var disabled = function disabled() {
84
- return /*#__PURE__*/React.createElement(Spacer, {
85
- my: "r"
86
- }, /*#__PURE__*/React.createElement(ButtonLink, {
85
+ export const disabled = () => /*#__PURE__*/_jsxs(Spacer, {
86
+ my: "r",
87
+ children: [/*#__PURE__*/_jsx(ButtonLink, {
87
88
  disabled: true,
88
- href: link
89
- }, "Disabled button"), /*#__PURE__*/React.createElement(ButtonLink, {
89
+ href: link,
90
+ children: "Disabled button"
91
+ }), /*#__PURE__*/_jsx(ButtonLink, {
90
92
  variant: "disabled",
91
- href: link
92
- }, "Alternate way of making button disabled"));
93
- };
93
+ href: link,
94
+ children: "Alternate way of making button disabled"
95
+ })]
96
+ });
94
97
  disabled.storyName = "Disabled state";
95
- export var withIcon = function withIcon() {
96
- return /*#__PURE__*/React.createElement(Spacer, {
97
- my: "3"
98
- }, /*#__PURE__*/React.createElement(ButtonLink, {
98
+ export const withIcon = () => /*#__PURE__*/_jsxs(Spacer, {
99
+ my: "3",
100
+ children: [/*#__PURE__*/_jsxs(ButtonLink, {
99
101
  iconLeft: true,
100
102
  href: link,
101
- isLoading: true
102
- }, /*#__PURE__*/React.createElement(Icon, {
103
- icon: ["fas", "user-plus"]
104
- }), "Left aligned icon"), /*#__PURE__*/React.createElement(ButtonLink, {
103
+ isLoading: true,
104
+ children: [/*#__PURE__*/_jsx(Icon, {
105
+ icon: ["fas", "user-plus"]
106
+ }), "Left aligned icon"]
107
+ }), /*#__PURE__*/_jsxs(ButtonLink, {
105
108
  iconRight: true,
106
- href: link
107
- }, "Right aligned icon", /*#__PURE__*/React.createElement(Icon, {
108
- icon: ["fas", "download"]
109
- })), /*#__PURE__*/React.createElement(ButtonLink, {
109
+ href: link,
110
+ children: ["Right aligned icon", /*#__PURE__*/_jsx(Icon, {
111
+ icon: ["fas", "download"]
112
+ })]
113
+ }), /*#__PURE__*/_jsx(ButtonLink, {
110
114
  leftIcon: ["fas", "star"],
111
- href: link
112
- }, "Left icon magic!"));
113
- };
115
+ href: link,
116
+ children: "Left icon magic!"
117
+ })]
118
+ });
114
119
  withIcon.storyName = "With icon";
115
- export var iconOnly = function iconOnly() {
116
- return /*#__PURE__*/React.createElement(Spacer, {
117
- my: "3"
118
- }, /*#__PURE__*/React.createElement(ButtonLink, {
120
+ export const iconOnly = () => /*#__PURE__*/_jsxs(Spacer, {
121
+ my: "3",
122
+ children: [/*#__PURE__*/_jsx(ButtonLink, {
119
123
  small: true,
120
124
  iconOnly: true,
121
125
  p: "s",
122
- ariaLabel: /*#__PURE__*/React.createElement(Icon, {
126
+ ariaLabel: /*#__PURE__*/_jsx(Icon, {
123
127
  icon: ["fas", "download"]
124
128
  }),
125
- href: link
126
- }, /*#__PURE__*/React.createElement(Icon, {
127
- icon: ["far", "calendar-alt"]
128
- })), /*#__PURE__*/React.createElement(ButtonLink, {
129
+ href: link,
130
+ children: /*#__PURE__*/_jsx(Icon, {
131
+ icon: ["far", "calendar-alt"]
132
+ })
133
+ }), /*#__PURE__*/_jsx(ButtonLink, {
129
134
  iconOnly: true,
130
135
  p: "s",
131
136
  ariaLabel: "Show calendar",
132
- href: link
133
- }, /*#__PURE__*/React.createElement(Icon, {
134
- icon: ["far", "calendar-alt"]
135
- })), /*#__PURE__*/React.createElement(ButtonLink, {
137
+ href: link,
138
+ children: /*#__PURE__*/_jsx(Icon, {
139
+ icon: ["far", "calendar-alt"]
140
+ })
141
+ }), /*#__PURE__*/_jsx(ButtonLink, {
136
142
  large: true,
137
143
  iconOnly: true,
138
144
  p: "s",
139
145
  ariaLabel: "Show calendar",
140
- href: link
141
- }, /*#__PURE__*/React.createElement(Icon, {
142
- icon: ["far", "calendar-alt"]
143
- })), /*#__PURE__*/React.createElement(Flex, {
144
- alignItems: "center",
145
- mt: "r"
146
- }, /*#__PURE__*/React.createElement(Spacer, {
147
- mr: "r"
148
- }, /*#__PURE__*/React.createElement(ButtonLink, {
149
- iconOnly: true,
150
- variant: "success",
151
- href: link,
152
- width: "33px",
153
- height: "32px",
154
- ariaLabel: "Confirm"
155
- }, /*#__PURE__*/React.createElement(Icon, {
156
- icon: ["fas", "check"]
157
- })), /*#__PURE__*/React.createElement(ButtonLink, {
158
- iconOnly: true,
159
- variant: "successAlternate",
160
- href: link,
161
- width: "33px",
162
- height: "32px",
163
- ariaLabel: "Confirm"
164
- }, /*#__PURE__*/React.createElement(Icon, {
165
- icon: ["fas", "check"]
166
- })), /*#__PURE__*/React.createElement(ButtonLink, {
167
- iconOnly: true,
168
- variant: "danger",
169
146
  href: link,
170
- width: "33px",
171
- height: "32px",
172
- ariaLabel: "Cancel"
173
- }, /*#__PURE__*/React.createElement(Icon, {
174
- icon: ["fas", "times"]
175
- })), /*#__PURE__*/React.createElement(ButtonLink, {
176
- iconOnly: true,
177
- variant: "dangerAlternate",
178
- href: link,
179
- width: "33px",
180
- height: "32px",
181
- ariaLabel: "Cancel"
182
- }, /*#__PURE__*/React.createElement(Icon, {
183
- icon: ["fas", "times"]
184
- })))));
185
- };
147
+ children: /*#__PURE__*/_jsx(Icon, {
148
+ icon: ["far", "calendar-alt"]
149
+ })
150
+ }), /*#__PURE__*/_jsx(Flex, {
151
+ alignItems: "center",
152
+ mt: "r",
153
+ children: /*#__PURE__*/_jsxs(Spacer, {
154
+ mr: "r",
155
+ children: [/*#__PURE__*/_jsx(ButtonLink, {
156
+ iconOnly: true,
157
+ variant: "success",
158
+ href: link,
159
+ width: "33px",
160
+ height: "32px",
161
+ ariaLabel: "Confirm",
162
+ children: /*#__PURE__*/_jsx(Icon, {
163
+ icon: ["fas", "check"]
164
+ })
165
+ }), /*#__PURE__*/_jsx(ButtonLink, {
166
+ iconOnly: true,
167
+ variant: "successAlternate",
168
+ href: link,
169
+ width: "33px",
170
+ height: "32px",
171
+ ariaLabel: "Confirm",
172
+ children: /*#__PURE__*/_jsx(Icon, {
173
+ icon: ["fas", "check"]
174
+ })
175
+ }), /*#__PURE__*/_jsx(ButtonLink, {
176
+ iconOnly: true,
177
+ variant: "danger",
178
+ href: link,
179
+ width: "33px",
180
+ height: "32px",
181
+ ariaLabel: "Cancel",
182
+ children: /*#__PURE__*/_jsx(Icon, {
183
+ icon: ["fas", "times"]
184
+ })
185
+ }), /*#__PURE__*/_jsx(ButtonLink, {
186
+ iconOnly: true,
187
+ variant: "dangerAlternate",
188
+ href: link,
189
+ width: "33px",
190
+ height: "32px",
191
+ ariaLabel: "Cancel",
192
+ children: /*#__PURE__*/_jsx(Icon, {
193
+ icon: ["fas", "times"]
194
+ })
195
+ })]
196
+ })
197
+ })]
198
+ });
186
199
  iconOnly.storyName = "Icon only";
187
200
  defaultButton.__docgenInfo = {
188
201
  "description": "",
@@ -1,10 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _extends from "@babel/runtime/helpers/extends";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- import _typeof from "@babel/runtime/helpers/typeof";
5
- var _excluded = ["ariaLabel"];
6
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
1
  import React from "react";
9
2
  import styled, { ThemeProvider, css } from "styled-components";
10
3
  import PropTypes from "prop-types";
@@ -15,8 +8,9 @@ import Loading from "../Loading";
15
8
  import { themeGet } from "@styled-system/theme-get";
16
9
  import { Link } from "react-router-dom";
17
10
  import { omit } from "lodash";
18
- export var VARIANT_COLORS = {
19
- "default": {
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ export const VARIANT_COLORS = {
13
+ default: {
20
14
  background: "colors.primary",
21
15
  color: "colors.white",
22
16
  borderColor: "colors.primary",
@@ -102,80 +96,52 @@ export var VARIANT_COLORS = {
102
96
  }
103
97
  }
104
98
  };
105
- var getOutlineStyle = function getOutlineStyle(color) {
106
- return css(["outline:0;box-shadow:", ";"], function (props) {
107
- return [themeGet("shadows.thinOutline")(props), themeGet(color)(props)].join(" ");
108
- });
109
- };
110
- var addVariantColors = function addVariantColors(key) {
111
- var variantStyle = VARIANT_COLORS[key];
99
+ const getOutlineStyle = color => css(["outline:0;box-shadow:", ";"], props => [themeGet("shadows.thinOutline")(props), themeGet(color)(props)].join(" "));
100
+ const addVariantColors = key => {
101
+ const variantStyle = VARIANT_COLORS[key];
112
102
  return css(["background:", ";color:", ";border-color:", ";&:hover{background:", ";color:", ";border-color:", ";}", ""], themeGet(variantStyle.background), themeGet(variantStyle.color), themeGet(variantStyle.borderColor), themeGet(variantStyle.hovered.background), themeGet(variantStyle.hovered.color), themeGet(variantStyle.hovered.borderColor), variantStyle.focused && css(["&:focus{", "}"], getOutlineStyle(variantStyle.focused.outline)));
113
103
  };
114
- var getVariantStyle = function getVariantStyle(props) {
115
- var styles = Object.keys(VARIANT_COLORS).reduce(function (obj, key) {
104
+ const getVariantStyle = props => {
105
+ const styles = Object.keys(VARIANT_COLORS).reduce((obj, key) => {
116
106
  obj[key] = css(["", ""], addVariantColors(key));
117
107
  return obj;
118
108
  }, {});
119
109
  if (props.disabled) return styles.disabled;
120
- return styles[props.variant] || styles["default"];
110
+ return styles[props.variant] || styles.default;
121
111
  };
122
- var getSpace = function getSpace(getter) {
123
- return function (props) {
124
- return themeGet("space.".concat(getter(props)))(props);
125
- };
126
- };
127
- var buttonStyles = css(["background:", ";color:", ";border-color:", ";display:flex;align-items:center;justify-content:center;appearance:none;box-shadow:none;margin:0;text-decoration:none;text-align:center;font-family:", ";font-weight:", ";border-radius:", ";transition:", ";border-width:", ";cursor:", ";width:", ";height:auto;font-size:", ";padding:", " ", ";svg{margin-right:", ";margin-left:", ";}&:hover{background:", ";border-color:", ";border-width:", ";border-style:solid;}&:focus{outline:0;box-shadow:", " ", ";}", " ", ""], themeGet(VARIANT_COLORS["default"].background), themeGet(VARIANT_COLORS["default"].color), themeGet("colors.primary"), themeGet("fonts.main"), themeGet("fontWeights.2"), themeGet("radii.2"), themeGet("transition.transitionDefault"), themeGet("borderWidths.1"), function (props) {
128
- return props.disabled ? "not-allowed" : props.isLoading ? "progress" : "pointer";
129
- }, function (props) {
130
- return props.fullWidth ? "100%" : "auto";
131
- }, function (props) {
132
- var fontSize = 2;
112
+ const getSpace = getter => props => themeGet("space.".concat(getter(props)))(props);
113
+ const buttonStyles = css(["background:", ";color:", ";border-color:", ";display:flex;align-items:center;justify-content:center;appearance:none;box-shadow:none;margin:0;text-decoration:none;text-align:center;font-family:", ";font-weight:", ";border-radius:", ";transition:", ";border-width:", ";cursor:", ";width:", ";height:auto;font-size:", ";padding:", " ", ";svg{margin-right:", ";margin-left:", ";}&:hover{background:", ";border-color:", ";border-width:", ";border-style:solid;}&:focus{outline:0;box-shadow:", " ", ";}", " ", ""], themeGet(VARIANT_COLORS.default.background), themeGet(VARIANT_COLORS.default.color), themeGet("colors.primary"), themeGet("fonts.main"), themeGet("fontWeights.2"), themeGet("radii.2"), themeGet("transition.transitionDefault"), themeGet("borderWidths.1"), props => props.disabled ? "not-allowed" : props.isLoading ? "progress" : "pointer", props => props.fullWidth ? "100%" : "auto", props => {
114
+ let fontSize = 2;
133
115
  if (props.large && props.iconOnly) fontSize = 5;
134
116
  if (props.large) fontSize = 3;
135
117
  if (props.small) fontSize = 1;
136
118
  return themeGet("fontSizes.".concat(fontSize))(props);
137
- }, getSpace(function (props) {
138
- return props.large ? "s" : props.small ? "xxs" : "xs";
139
- }), getSpace(function (props) {
140
- return props.large ? "r" : props.small ? "s" : "between";
141
- }), getSpace(function (props) {
142
- return !props.iconLeft ? "" : props.small ? "xs" : "s";
143
- }), getSpace(function (props) {
144
- return !props.iconRight ? "" : props.small ? "xs" : "s";
145
- }), themeGet(VARIANT_COLORS["default"].hovered.background), themeGet("colors.primaryDark"), themeGet("borderWidths.1"), themeGet("shadows.thinOutline"), themeGet("colors.primaryDarker"), getVariantStyle, compose(space, layout, color, border));
146
- var attrs = function attrs(props) {
147
- return {
148
- "data-testid": props.dataTestId || props["data-testid"],
149
- disabled: props.disabled || props.variant == "disabled",
150
- className: "".concat(props.className || "", " variant-").concat(props.variant || "default")
151
- };
152
- };
153
- var StyledButton = styled("button").withConfig({
154
- shouldForwardProp: shouldForwardProp
119
+ }, getSpace(props => props.large ? "s" : props.small ? "xxs" : "xs"), getSpace(props => props.large ? "r" : props.small ? "s" : "between"), getSpace(props => !props.iconLeft ? "" : props.small ? "xs" : "s"), getSpace(props => !props.iconRight ? "" : props.small ? "xs" : "s"), themeGet(VARIANT_COLORS.default.hovered.background), themeGet("colors.primaryDark"), themeGet("borderWidths.1"), themeGet("shadows.thinOutline"), themeGet("colors.primaryDarker"), getVariantStyle, compose(space, layout, color, border));
120
+ const attrs = props => ({
121
+ "data-testid": props.dataTestId || props["data-testid"],
122
+ disabled: props.disabled || props.variant == "disabled",
123
+ className: "".concat(props.className || "", " variant-").concat(props.variant || "default")
124
+ });
125
+ const StyledButton = styled("button").withConfig({
126
+ shouldForwardProp
155
127
  }).attrs(attrs).withConfig({
156
128
  displayName: "Button__StyledButton",
157
129
  componentId: "sc-10uojnk-0"
158
130
  })(["", ""], buttonStyles);
159
- var linkStyles = css(["width:", ";display:", ";align-items:", ";"], function (props) {
160
- return props.width || "fit-content";
161
- }, function (props) {
162
- return props.height || props.width ? "flex" : props.display || "inline-block";
163
- }, function (props) {
164
- return props.alignItems || "center";
165
- });
166
- var StyledButtonLink = styled.a.withConfig({
167
- shouldForwardProp: shouldForwardProp
131
+ const linkStyles = css(["width:", ";display:", ";align-items:", ";"], props => props.width || "fit-content", props => props.height || props.width ? "flex" : props.display || "inline-block", props => props.alignItems || "center");
132
+ const StyledButtonLink = styled.a.withConfig({
133
+ shouldForwardProp
168
134
  }).attrs(attrs).withConfig({
169
135
  displayName: "Button__StyledButtonLink",
170
136
  componentId: "sc-10uojnk-1"
171
137
  })(["", " ", ""], buttonStyles, linkStyles);
172
- var StyledReactButtonLink = styled(Link).withConfig({
173
- shouldForwardProp: shouldForwardProp
138
+ const StyledReactButtonLink = styled(Link).withConfig({
139
+ shouldForwardProp
174
140
  }).attrs(attrs).withConfig({
175
141
  displayName: "Button__StyledReactButtonLink",
176
142
  componentId: "sc-10uojnk-2"
177
143
  })(["", " ", ""], buttonStyles, linkStyles);
178
- var buttonPropTypes = {
144
+ const buttonPropTypes = {
179
145
  /** Large button */
180
146
  large: PropTypes.bool,
181
147
  /** Small button */
@@ -205,62 +171,75 @@ var buttonPropTypes = {
205
171
  /** Specifies the `data-testid` attribute for testing. */
206
172
  dataTestId: PropTypes.string,
207
173
  /** Specifies aria-label for iconOnly buttons. This is only required if the iconOnly button is used, as it doesn't have supporting text for accessibility.*/
208
- ariaLabel: function ariaLabel(props, propName) {
174
+ ariaLabel: (props, propName) => {
209
175
  if (props.iconOnly && (props[propName] == null || props[propName] === "")) {
210
176
  return new Error("Missing prop `".concat(propName, "` not specified for Button component. When `iconOnly` is true, `").concat(propName, "` is required."));
211
177
  }
212
178
  if (props[propName] && typeof props[propName] !== "string") {
213
- return new Error("Invalid propType for `".concat(propName, "` supplied to Button component. Expected `string`, received `").concat(_typeof(props[propName]), "`."));
179
+ return new Error("Invalid propType for `".concat(propName, "` supplied to Button component. Expected `string`, received `").concat(typeof props[propName], "`."));
214
180
  }
215
181
  return null;
216
182
  },
217
183
  /** Specifies the color theme object. */
218
184
  theme: PropTypes.object
219
185
  };
220
- var renderButton = function renderButton(ButtonComponent, _ref) {
221
- var ariaLabel = _ref.ariaLabel,
222
- props = _objectWithoutProperties(_ref, _excluded);
223
- return /*#__PURE__*/React.createElement(ButtonComponent, _extends({
224
- borderStyle: "solid"
225
- }, props.ButtonStyles, props, {
186
+ const renderButton = (ButtonComponent, _ref) => {
187
+ let {
188
+ ariaLabel,
189
+ ...props
190
+ } = _ref;
191
+ return /*#__PURE__*/_jsxs(ButtonComponent, {
192
+ borderStyle: "solid",
193
+ ...props.ButtonStyles,
194
+ ...props,
226
195
  "aria-label": ariaLabel,
227
- ref: props.ref
228
- }), props.leftIcon && /*#__PURE__*/React.createElement(Icon, {
229
- icon: props.leftIcon,
230
- mr: props.small ? "xxs" : "xs"
231
- }), props.children, props.rightIcon && /*#__PURE__*/React.createElement(Icon, {
232
- icon: props.rightIcon,
233
- ml: props.small ? "xxs" : "xs"
234
- }), props.isLoading && /*#__PURE__*/React.createElement(Loading, {
235
- inverted: true,
236
- ml: "s"
237
- }));
196
+ ref: props.ref,
197
+ children: [props.leftIcon && /*#__PURE__*/_jsx(Icon, {
198
+ icon: props.leftIcon,
199
+ mr: props.small ? "xxs" : "xs"
200
+ }), props.children, props.rightIcon && /*#__PURE__*/_jsx(Icon, {
201
+ icon: props.rightIcon,
202
+ ml: props.small ? "xxs" : "xs"
203
+ }), props.isLoading && /*#__PURE__*/_jsx(Loading, {
204
+ inverted: true,
205
+ ml: "s"
206
+ })]
207
+ });
238
208
  };
239
- export var ButtonLink = /*#__PURE__*/React.forwardRef(function (props, ref) {
240
- var theme = props.theme;
241
- var component = renderButton(props.to ? StyledReactButtonLink : StyledButtonLink, _objectSpread(_objectSpread({}, omit(props, "isLoading")), {}, {
242
- ref: ref
243
- }));
244
- return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
245
- theme: theme
246
- }, component) : component;
209
+ export const ButtonLink = /*#__PURE__*/React.forwardRef((props, ref) => {
210
+ const {
211
+ theme
212
+ } = props;
213
+ const component = renderButton(props.to ? StyledReactButtonLink : StyledButtonLink, {
214
+ ...omit(props, "isLoading"),
215
+ ref
216
+ });
217
+ return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
218
+ theme: theme,
219
+ children: component
220
+ }) : component;
247
221
  });
248
- ButtonLink.propTypes = _objectSpread(_objectSpread({}, buttonPropTypes), {}, {
222
+ ButtonLink.propTypes = {
223
+ ...buttonPropTypes,
249
224
  target: PropTypes.string,
250
225
  /** Link to navigate user to */
251
226
  href: PropTypes.string
252
- });
227
+ };
253
228
  ButtonLink.defaultProps = {
254
229
  variant: "default"
255
230
  };
256
- export var Button = /*#__PURE__*/React.forwardRef(function (props, ref) {
257
- var theme = props.theme;
258
- var component = renderButton(StyledButton, _objectSpread(_objectSpread({}, props), {}, {
259
- ref: ref
260
- }));
261
- return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
262
- theme: theme
263
- }, component) : component;
231
+ export const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
232
+ const {
233
+ theme
234
+ } = props;
235
+ const component = renderButton(StyledButton, {
236
+ ...props,
237
+ ref
238
+ });
239
+ return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
240
+ theme: theme,
241
+ children: component
242
+ }) : component;
264
243
  });
265
244
  Button.__docgenInfo = {
266
245
  "description": "",
@@ -416,10 +395,11 @@ Button.__docgenInfo = {
416
395
  }
417
396
  };
418
397
  export default Button;
419
- Button.propTypes = _objectSpread(_objectSpread({}, buttonPropTypes), {}, {
398
+ Button.propTypes = {
399
+ ...buttonPropTypes,
420
400
  /** Function to run when the `Button` is clicked */
421
401
  onClick: PropTypes.func
422
- });
402
+ };
423
403
  Button.defaultProps = {
424
404
  variant: "default"
425
405
  };