@manamerge/mana-atomic-ui 0.0.54 → 0.0.56

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 CHANGED
@@ -1,13 +1,16 @@
1
1
  ## to run the build:
2
+
2
3
  npm run rollup-build-lib
3
4
 
4
5
  ## to publish the build:
6
+
5
7
  # 1º we change the version
8
+
6
9
  ```bash
7
10
  npm run build
8
11
  npm publish
9
12
  ```
10
13
 
11
14
  ## to run the storybook
12
- yarn run storybook
13
15
 
16
+ yarn run storybook
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { ReactNode, AnchorHTMLAttributes, ElementType } from 'react';
1
+ import React, { ReactNode, FunctionComponent, SVGProps, AnchorHTMLAttributes, ElementType } from 'react';
2
2
 
3
3
  interface ButtonTypes {
4
4
  disabled?: boolean;
@@ -7,7 +7,7 @@ interface ButtonTypes {
7
7
  background?: string;
8
8
  alt?: string;
9
9
  children?: ReactNode;
10
- onClick?: (e: any) => void;
10
+ onClick?: React.MouseEventHandler<HTMLElement>;
11
11
  type?: "button" | "submit" | "reset" | undefined;
12
12
  color?: string;
13
13
  altColor?: string;
@@ -42,7 +42,7 @@ interface TextTypes {
42
42
  color?: string;
43
43
  fontSize?: string;
44
44
  lineHeight?: string;
45
- fontWeight?: string;
45
+ fontWeight?: string | number;
46
46
  tag?: keyof JSX.IntrinsicElements;
47
47
  onClick?: React.MouseEventHandler<HTMLElement>;
48
48
  }
@@ -64,6 +64,15 @@ interface HeadingTypes {
64
64
  }
65
65
  declare const Heading: React.FC<HeadingTypes>;
66
66
 
67
+ interface IconTypes {
68
+ className?: string;
69
+ svg: FunctionComponent<SVGProps<SVGSVGElement>>;
70
+ color?: string;
71
+ size?: string;
72
+ stroke?: string;
73
+ }
74
+ declare const Icon: React.FC<IconTypes>;
75
+
67
76
  interface LinkTypes extends AnchorHTMLAttributes<HTMLAnchorElement> {
68
77
  to?: string;
69
78
  color?: string;
@@ -78,4 +87,4 @@ interface LinkTypes extends AnchorHTMLAttributes<HTMLAnchorElement> {
78
87
  }
79
88
  declare const Link: React.FC<LinkTypes>;
80
89
 
81
- export { Button, Heading, Link, LinkTypes, Text };
90
+ export { Button, Heading, Icon, Link, LinkTypes, Text };
package/dist/index.js CHANGED
@@ -38,102 +38,106 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
38
38
  };
39
39
 
40
40
  const ButtonStyle = styled.button `
41
- ${(_a) => {
41
+ ${(_a) => {
42
42
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
43
43
  var { className, theme, disabled } = _a, props = __rest(_a, ["className", "theme", "disabled"]);
44
44
  const buttonStyles = (theme === null || theme === void 0 ? void 0 : theme.button[className]) || {};
45
45
  return css `
46
- /* Default State */
47
- background: ${disabled
46
+ /* Default State */
47
+ background: ${disabled
48
48
  ? props.background ||
49
49
  ((_b = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.disabled) === null || _b === void 0 ? void 0 : _b.background) ||
50
50
  "transparent"
51
51
  : props.background ||
52
52
  ((_c = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.default) === null || _c === void 0 ? void 0 : _c.background) ||
53
53
  "transparent"};
54
- color: ${disabled
54
+ color: ${disabled
55
55
  ? props.color || ((_d = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.disabled) === null || _d === void 0 ? void 0 : _d.text) || "inherit"
56
56
  : props.color || ((_e = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.default) === null || _e === void 0 ? void 0 : _e.text) || "inherit"};
57
- border: ${disabled
57
+ border: ${disabled
58
58
  ? props.border || ((_f = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.disabled) === null || _f === void 0 ? void 0 : _f.border) || "none"
59
59
  : props.border || ((_g = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.default) === null || _g === void 0 ? void 0 : _g.border) || "none"};
60
- opacity: ${disabled
60
+ opacity: ${disabled
61
61
  ? (props === null || props === void 0 ? void 0 : props.opacity) || ((_h = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.disabled) === null || _h === void 0 ? void 0 : _h.opacity) || 0.5
62
62
  : 1};
63
- text-transform: ${(buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.textTransform) || "none"};
64
- font-family: ${(buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.fontFamily) || "inherit"};
65
- font-weight: ${props.fontWeight || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.fontWeight) || "normal"};
66
- letter-spacing: ${props.letterSpacing ||
63
+ text-transform: ${(buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.textTransform) || "none"};
64
+ font-family: ${(buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.fontFamily) || "inherit"};
65
+ font-weight: ${props.fontWeight ||
66
+ (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.fontWeight) ||
67
+ "normal"};
68
+ letter-spacing: ${props.letterSpacing ||
67
69
  (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.letterSpacing) ||
68
70
  "normal"};
69
- font-size: ${props.text || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.fontSize) || "inherit"};
70
- line-height: ${props.lineHeight || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.lineHeight) || "normal"};
71
- padding: ${props.padding || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.padding) || "0"};
72
- border-radius: ${props.radius || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.borderRadius) || "0"};
73
- max-width: ${props.maxWidth || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.maxWidth) || "none"};
74
- max-height: ${props.maxHeight || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.maxHeight) || "none"};
75
- box-shadow: ${props.shadow || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.shadow) || "none"};
76
- transition: ${props.transition ||
71
+ font-size: ${props.text || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.fontSize) || "inherit"};
72
+ line-height: ${props.lineHeight ||
73
+ (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.lineHeight) ||
74
+ "normal"};
75
+ padding: ${props.padding || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.padding) || "0"};
76
+ border-radius: ${props.radius || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.borderRadius) || "0"};
77
+ max-width: ${props.maxWidth || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.maxWidth) || "none"};
78
+ max-height: ${props.maxHeight || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.maxHeight) || "none"};
79
+ box-shadow: ${props.shadow || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.shadow) || "none"};
80
+ transition: ${props.transition ||
77
81
  (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.transition) ||
78
82
  "all 0.2s ease"};
79
- display: ${props.display || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.display) || "inline-flex"};
80
- justify-content: ${(buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.justifyContent) || "center"};
81
- align-items: ${(buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.alignItems) || "center"};
82
- cursor: ${disabled
83
+ display: ${props.display || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.display) || "inline-flex"};
84
+ justify-content: ${(buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.justifyContent) || "center"};
85
+ align-items: ${(buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.alignItems) || "center"};
86
+ cursor: ${disabled
83
87
  ? "not-allowed"
84
88
  : props.cursor || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.cursor) || "pointer"};
85
- overflow: ${props.overflow || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.overflow) || "visible"};
86
- position: ${props.position || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.position) || "relative"};
87
- width: ${props.width || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.width) || "auto"};
88
- height: ${props.height || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.height) || "auto"};
89
- margin: ${props.margin || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.margin) || "0"};
90
- gap: ${props.gap || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.gap) || "0"};
89
+ overflow: ${props.overflow || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.overflow) || "visible"};
90
+ position: ${props.position || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.position) || "relative"};
91
+ width: ${props.width || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.width) || "auto"};
92
+ height: ${props.height || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.height) || "auto"};
93
+ margin: ${props.margin || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.margin) || "0"};
94
+ gap: ${props.gap || (buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.gap) || "0"};
91
95
 
92
- /* Hover State */
93
- &:hover {
94
- background: ${!disabled && ((_j = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.hover) === null || _j === void 0 ? void 0 : _j.background)};
95
- color: ${!disabled && ((_k = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.hover) === null || _k === void 0 ? void 0 : _k.text)};
96
- border: ${!disabled && ((_l = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.hover) === null || _l === void 0 ? void 0 : _l.border)};
97
- filter: ${!disabled && ((_m = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.hover) === null || _m === void 0 ? void 0 : _m.filter)};
98
- }
96
+ /* Hover State */
97
+ &:hover {
98
+ background: ${!disabled && ((_j = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.hover) === null || _j === void 0 ? void 0 : _j.background)};
99
+ color: ${!disabled && ((_k = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.hover) === null || _k === void 0 ? void 0 : _k.text)};
100
+ border: ${!disabled && ((_l = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.hover) === null || _l === void 0 ? void 0 : _l.border)};
101
+ filter: ${!disabled && ((_m = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.hover) === null || _m === void 0 ? void 0 : _m.filter)};
102
+ }
99
103
 
100
- /* Active State */
101
- &:active {
102
- background: ${!disabled && ((_o = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.active) === null || _o === void 0 ? void 0 : _o.background)};
103
- color: ${!disabled && ((_p = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.active) === null || _p === void 0 ? void 0 : _p.text)};
104
- border: ${!disabled && ((_q = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.active) === null || _q === void 0 ? void 0 : _q.border)};
105
- filter: ${(!disabled && ((_r = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.active) === null || _r === void 0 ? void 0 : _r.filter)) ||
104
+ /* Active State */
105
+ &:active {
106
+ background: ${!disabled && ((_o = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.active) === null || _o === void 0 ? void 0 : _o.background)};
107
+ color: ${!disabled && ((_p = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.active) === null || _p === void 0 ? void 0 : _p.text)};
108
+ border: ${!disabled && ((_q = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.active) === null || _q === void 0 ? void 0 : _q.border)};
109
+ filter: ${(!disabled && ((_r = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.active) === null || _r === void 0 ? void 0 : _r.filter)) ||
106
110
  "brightness(0.9)"};
107
- }
111
+ }
108
112
 
109
- /* Focus State */
110
- &:focus-visible {
111
- outline: 2px solid ${((_s = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.focus) === null || _s === void 0 ? void 0 : _s.outline) || "red"};
112
- outline-offset: 2px;
113
- }
114
- `;
113
+ /* Focus State */
114
+ &:focus-visible {
115
+ outline: 2px solid ${((_s = buttonStyles === null || buttonStyles === void 0 ? void 0 : buttonStyles.focus) === null || _s === void 0 ? void 0 : _s.outline) || "red"};
116
+ outline-offset: 2px;
117
+ }
118
+ `;
115
119
  }}
116
120
 
117
- /* Background as Image */
121
+ /* Background as Image */
118
122
  ${({ background }) => background &&
119
123
  css `
120
- background: center/cover url(${background});
121
- background-size: contain;
122
- background-repeat: no-repeat;
123
- `}
124
+ background: center/cover url(${background});
125
+ background-size: contain;
126
+ background-repeat: no-repeat;
127
+ `}
124
128
 
125
129
  /* Effects */
126
130
  ${({ effects }) => effects &&
127
131
  css `
128
- ${effects};
129
- `}
132
+ ${effects};
133
+ `}
130
134
  `;
131
135
  const ImgStyle = styled.svg `
132
- width: 1em;
133
- height: 1em;
136
+ width: 1em;
137
+ height: 1em;
134
138
  `;
135
139
 
136
- const Button = ({ className = "", disabled = false, image, opacity = "0", background, alt, children, onClick, type = "submit", color, altColor, frame, border, text, fill, effects, padding, flexbox, cursor, margin, display, radius, fontWeight, letterSpacing, shadow, transition, width, height, gap, align, }) => {
140
+ const Button = ({ className = "", disabled = false, image, opacity = "0", background, alt, children, onClick, type = "submit", color, altColor, frame, border, text, fill, effects, padding, flexbox, cursor, margin, display, radius, fontWeight, letterSpacing, shadow, transition, width, height, gap, align }) => {
137
141
  // Log a warning if both `children` and `alt` are missing for accessibility
138
142
  if (!children && !alt) {
139
143
  console.error(`Provide either "children" or "alt" property to the Button.`);
@@ -152,35 +156,39 @@ const Button = ({ className = "", disabled = false, image, opacity = "0", backgr
152
156
  };
153
157
 
154
158
  const TextContainer = styled.p `
155
- ${(_a) => {
159
+ ${(_a) => {
156
160
  var _b;
157
161
  var { className, theme } = _a, props = __rest(_a, ["className", "theme"]);
158
162
  const textStyles = ((_b = theme === null || theme === void 0 ? void 0 : theme.textStyles) === null || _b === void 0 ? void 0 : _b[className]) || {};
159
163
  return css `
160
- margin: ${props.margin || textStyles.margin};
161
- font-size: ${props.fontSize || textStyles.fontSize};
162
- line-height: ${props.lineHeight || textStyles.lineHeight};
163
- font-weight: ${props.fontWeight || textStyles.fontWeight || "regular"};
164
- color: ${props.color || textStyles.color};
165
- `;
164
+ margin: ${props.margin || textStyles.margin};
165
+ font-size: ${props.fontSize || textStyles.fontSize};
166
+ line-height: ${props.lineHeight || textStyles.lineHeight};
167
+ font-weight: ${props.fontWeight ||
168
+ textStyles.fontWeight ||
169
+ "regular"};
170
+ color: ${props.color || textStyles.color};
171
+ `;
166
172
  }};
167
173
  `;
168
174
  const TextContainerLabel = styled.label `
169
- ${(_a) => {
175
+ ${(_a) => {
170
176
  var _b;
171
177
  var { className, theme } = _a, props = __rest(_a, ["className", "theme"]);
172
178
  const textStyles = ((_b = theme === null || theme === void 0 ? void 0 : theme.textStyles) === null || _b === void 0 ? void 0 : _b[className]) || {};
173
179
  return css `
174
- margin: ${props.margin || textStyles.margin};
175
- font-size: ${props.fontSize || textStyles.fontSize};
176
- line-height: ${props.lineHeight || textStyles.lineHeight};
177
- font-weight: ${props.fontWeight || textStyles.fontWeight || "regular"};
178
- color: ${props.color || textStyles.color};
179
- `;
180
+ margin: ${props.margin || textStyles.margin};
181
+ font-size: ${props.fontSize || textStyles.fontSize};
182
+ line-height: ${props.lineHeight || textStyles.lineHeight};
183
+ font-weight: ${props.fontWeight ||
184
+ textStyles.fontWeight ||
185
+ "regular"};
186
+ color: ${props.color || textStyles.color};
187
+ `;
180
188
  }};
181
189
  `;
182
190
 
183
- const Text = ({ className, children, htmlFor, margin, color, fontSize, lineHeight, fontWeight, tag, onClick, }) => {
191
+ const Text = ({ className, children, htmlFor, margin, color, fontSize, lineHeight, fontWeight, tag, onClick }) => {
184
192
  // Determine which component to use
185
193
  const Wrapper = htmlFor
186
194
  ? TextContainerLabel
@@ -189,72 +197,96 @@ const Text = ({ className, children, htmlFor, margin, color, fontSize, lineHeigh
189
197
  };
190
198
 
191
199
  const HeadingContainer = styled.h1 `
192
- ${({ className, theme, color, margin, fontSize, fontWeight, lineHeight }) => {
200
+ ${({ className, theme, color, margin, fontSize, fontWeight, lineHeight }) => {
193
201
  const { media, heading } = theme;
194
202
  const { tinyMobileUp, largeMobileUp, superLargeDesktopUp } = media;
195
203
  const headingStyles = (heading === null || heading === void 0 ? void 0 : heading[className]) || {};
196
204
  const { mobile, tablet, desktop } = headingStyles;
197
205
  return css `
198
- ${tinyMobileUp} {
199
- font-size: ${(fontSize === null || fontSize === void 0 ? void 0 : fontSize.small) || mobile.fontSize};
200
- font-weight: ${(fontWeight === null || fontWeight === void 0 ? void 0 : fontWeight.small) || mobile.fontWeight};
201
- line-height: ${(lineHeight === null || lineHeight === void 0 ? void 0 : lineHeight.small) || mobile.lineHeight};
202
- color: ${color || (mobile === null || mobile === void 0 ? void 0 : mobile.color)};
203
- margin: ${(margin === null || margin === void 0 ? void 0 : margin.small) || mobile.margin};
204
- }
205
- ${largeMobileUp} {
206
- font-size: ${(fontSize === null || fontSize === void 0 ? void 0 : fontSize.medium) || tablet.fontSize};
207
- font-weight: ${(fontWeight === null || fontWeight === void 0 ? void 0 : fontWeight.medium) || tablet.fontWeight};
208
- line-height: ${(lineHeight === null || lineHeight === void 0 ? void 0 : lineHeight.medium) || tablet.lineHeight};
209
- color: ${color || (tablet === null || tablet === void 0 ? void 0 : tablet.color)};
210
- margin: ${(margin === null || margin === void 0 ? void 0 : margin.medium) || tablet.margin};
211
- }
212
- ${superLargeDesktopUp} {
213
- font-size: ${(fontSize === null || fontSize === void 0 ? void 0 : fontSize.big) || desktop.fontSize};
214
- font-weight: ${(fontWeight === null || fontWeight === void 0 ? void 0 : fontWeight.big) || desktop.fontWeight};
215
- line-height: ${(lineHeight === null || lineHeight === void 0 ? void 0 : lineHeight.big) || desktop.lineHeight};
216
- color: ${color || (desktop === null || desktop === void 0 ? void 0 : desktop.color)};
217
- margin: ${(margin === null || margin === void 0 ? void 0 : margin.big) || desktop.margin};
218
- }
219
- `;
206
+ ${tinyMobileUp} {
207
+ font-size: ${(fontSize === null || fontSize === void 0 ? void 0 : fontSize.small) || mobile.fontSize};
208
+ font-weight: ${(fontWeight === null || fontWeight === void 0 ? void 0 : fontWeight.small) || mobile.fontWeight};
209
+ line-height: ${(lineHeight === null || lineHeight === void 0 ? void 0 : lineHeight.small) || mobile.lineHeight};
210
+ color: ${color || (mobile === null || mobile === void 0 ? void 0 : mobile.color)};
211
+ margin: ${(margin === null || margin === void 0 ? void 0 : margin.small) || mobile.margin};
212
+ }
213
+ ${largeMobileUp} {
214
+ font-size: ${(fontSize === null || fontSize === void 0 ? void 0 : fontSize.medium) || tablet.fontSize};
215
+ font-weight: ${(fontWeight === null || fontWeight === void 0 ? void 0 : fontWeight.medium) || tablet.fontWeight};
216
+ line-height: ${(lineHeight === null || lineHeight === void 0 ? void 0 : lineHeight.medium) || tablet.lineHeight};
217
+ color: ${color || (tablet === null || tablet === void 0 ? void 0 : tablet.color)};
218
+ margin: ${(margin === null || margin === void 0 ? void 0 : margin.medium) || tablet.margin};
219
+ }
220
+ ${superLargeDesktopUp} {
221
+ font-size: ${(fontSize === null || fontSize === void 0 ? void 0 : fontSize.big) || desktop.fontSize};
222
+ font-weight: ${(fontWeight === null || fontWeight === void 0 ? void 0 : fontWeight.big) || desktop.fontWeight};
223
+ line-height: ${(lineHeight === null || lineHeight === void 0 ? void 0 : lineHeight.big) || desktop.lineHeight};
224
+ color: ${color || (desktop === null || desktop === void 0 ? void 0 : desktop.color)};
225
+ margin: ${(margin === null || margin === void 0 ? void 0 : margin.big) || desktop.margin};
226
+ }
227
+ `;
228
+ }}
229
+ `;
230
+
231
+ const Heading = ({ className, children, margin, color, fontSize, lineHeight, fontWeight }) => (React.createElement(HeadingContainer, { className: classNames("Heading", className), as: className, margin: margin, color: color, fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight }, children));
232
+
233
+ const StyledSvg = styled.svg `
234
+ ${(_a) => {
235
+ var { className, theme } = _a, props = __rest(_a, ["className", "theme"]);
236
+ const iconStyles = (theme === null || theme === void 0 ? void 0 : theme.icon[className]) || {};
237
+ return css `
238
+ width: ${props.size || (iconStyles === null || iconStyles === void 0 ? void 0 : iconStyles.size) || "auto"};
239
+ height: ${props.size || (iconStyles === null || iconStyles === void 0 ? void 0 : iconStyles.size) || "auto"};
240
+ fill: ${props.color || (iconStyles === null || iconStyles === void 0 ? void 0 : iconStyles.color)};
241
+ stroke: ${props.stroke || (iconStyles === null || iconStyles === void 0 ? void 0 : iconStyles.stroke)};
242
+ &:hover {
243
+ opacity: 0.8;
244
+ }
245
+ `;
220
246
  }}
221
247
  `;
222
248
 
223
- const Heading = ({ className, children, margin, color, fontSize, lineHeight, fontWeight, }) => (React.createElement(HeadingContainer, { className: classNames("Heading", className), as: className, margin: margin, color: color, fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight }, children));
249
+ const Icon = ({ className, svg: SvgIcon, color, size, stroke }) => {
250
+ if (!SvgIcon) {
251
+ console.error("No SVG provided to the Icon component.");
252
+ return null;
253
+ }
254
+ return (React.createElement(StyledSvg, { className: classNames("Icon", className), as: SvgIcon, size: size, color: color, stroke: stroke }));
255
+ };
224
256
 
225
257
  const StyledLink = styled.a `
226
- ${({ className, theme, underline, hoverUnderline, color, hoverColor, fontSize, lineHeight, fontWeight, }) => {
258
+ ${({ className, theme, underline, hoverUnderline, color, hoverColor, fontSize, lineHeight, fontWeight }) => {
227
259
  var _a;
228
260
  const linkStyles = (theme === null || theme === void 0 ? void 0 : theme.link[className]) || {};
229
261
  return css `
230
- font-size: ${fontSize || linkStyles.fontSize};
231
- line-height: ${lineHeight || linkStyles.lineHeight};
232
- font-weight: ${fontWeight || linkStyles.fontWeight || "regular"};
233
- color: ${color || (linkStyles === null || linkStyles === void 0 ? void 0 : linkStyles.color)};
234
- display: inline-block;
235
- text-decoration: ${underline ? "underline" : "none"};
236
- cursor: pointer; // add to theme is ever needed
237
- &:hover {
238
- text-decoration: ${hoverUnderline !== undefined
262
+ font-size: ${fontSize || linkStyles.fontSize};
263
+ line-height: ${lineHeight || linkStyles.lineHeight};
264
+ font-weight: ${fontWeight || linkStyles.fontWeight || "regular"};
265
+ color: ${color || (linkStyles === null || linkStyles === void 0 ? void 0 : linkStyles.color)};
266
+ display: inline-block;
267
+ text-decoration: ${underline ? "underline" : "none"};
268
+ cursor: pointer; // add to theme is ever needed
269
+ &:hover {
270
+ text-decoration: ${hoverUnderline !== undefined
239
271
  ? hoverUnderline
240
272
  ? "underline"
241
273
  : "none"
242
274
  : "underline"};
243
- color: ${hoverColor || ((_a = linkStyles.hover) === null || _a === void 0 ? void 0 : _a.color)};
244
- }
275
+ color: ${hoverColor || ((_a = linkStyles.hover) === null || _a === void 0 ? void 0 : _a.color)};
276
+ }
245
277
 
246
- &:focus {
247
- outline: 2px solid ${hoverColor || "darkblue"};
248
- outline-offset: 2px;
249
- }
278
+ &:focus {
279
+ outline: 2px solid ${hoverColor || "darkblue"};
280
+ outline-offset: 2px;
281
+ }
250
282
 
251
- &:disabled {
252
- pointer-events: none;
253
- color: gray;
254
- text-decoration: none;
255
- cursor: not-allowed;
256
- }
257
- `;
283
+ &:disabled {
284
+ pointer-events: none;
285
+ color: gray;
286
+ text-decoration: none;
287
+ cursor: not-allowed;
288
+ }
289
+ `;
258
290
  }};
259
291
  `;
260
292
 
@@ -271,10 +303,10 @@ const Link = (_a) => {
271
303
  : {
272
304
  href,
273
305
  target,
274
- rel: target === "_blank" ? "noopener noreferrer" : undefined,
306
+ rel: target === "_blank" ? "noopener noreferrer" : undefined
275
307
  };
276
- return (React.createElement(StyledLink, Object.assign({ className: classNames("Link", className), as: Component }, componentProps, props), children));
308
+ return (React.createElement(StyledLink, Object.assign({ className: classNames("Link", className), as: Component, fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight }, componentProps, props), children));
277
309
  };
278
310
 
279
- export { Button, Heading, Link, Text };
311
+ export { Button, Heading, Icon, Link, Text };
280
312
  //# sourceMappingURL=index.js.map