@unitedstatespowersquadrons/components 1.4.0 → 1.4.2-1

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/ActionButton.tsx CHANGED
@@ -18,6 +18,11 @@ const useStyles = createUseStyles({
18
18
  grayGray: { ...Styles.gray },
19
19
  greenColored: { ...Styles.colorizeButton("green") },
20
20
  greenGray: { ...Styles.green },
21
+ inline: {
22
+ display: "inline-flex !important",
23
+ margin: "0 0.25em",
24
+ verticalAlign: "middle",
25
+ },
21
26
  noMargin: { marginTop: "0" },
22
27
  orangeColored: { ...Styles.colorizeButton("orange") },
23
28
  orangeGray: { ...Styles.orange },
@@ -65,10 +70,10 @@ interface InlineProps {
65
70
  inline?: boolean;
66
71
  }
67
72
 
68
- export interface ActionButtonHrefProps extends CoreActionButtonProps, HrefProps, InlineProps {}
69
- export interface ActionButtonMethodProps extends CoreActionButtonProps, MethodProps {}
70
- export interface ActionButtonOnClickProps extends CoreActionButtonProps, OnClickProps {}
71
- export interface ActionButtonFormProps extends CoreActionButtonProps, FormProps {}
73
+ export type ActionButtonHrefProps = CoreActionButtonProps & HrefProps & InlineProps;
74
+ export type ActionButtonMethodProps = CoreActionButtonProps & MethodProps & InlineProps;
75
+ export type ActionButtonOnClickProps = CoreActionButtonProps & OnClickProps & InlineProps;
76
+ export type ActionButtonFormProps = CoreActionButtonProps & FormProps & InlineProps;
72
77
 
73
78
  export type ActionButtonProps =
74
79
  | ActionButtonHrefProps
@@ -113,11 +118,11 @@ const ActionButton = (props: ActionButtonProps) => {
113
118
  };
114
119
 
115
120
  if ("onClick" in props) {
116
- const { confirm, onClick } = props;
121
+ const { confirm, inline, onClick } = props;
117
122
 
118
123
  return(
119
124
  <BaseActionButton
120
- className={classNames(classes.button, colorClassName, sizeClassName(), className)}
125
+ className={classNames(classes.button, colorClassName, sizeClassName(), inline && classes.inline, className)}
121
126
  confirm={confirm}
122
127
  id={id}
123
128
  onClick={onClick}
@@ -127,11 +132,11 @@ const ActionButton = (props: ActionButtonProps) => {
127
132
  </BaseActionButton>
128
133
  );
129
134
  } else if ("method" in props) {
130
- const { confirm, href, method } = props;
135
+ const { confirm, href, inline, method } = props;
131
136
 
132
137
  return(
133
138
  <BaseActionButton
134
- className={classNames(classes.button, colorClassName, sizeClassName(), className)}
139
+ className={classNames(classes.button, colorClassName, sizeClassName(), inline && classes.inline, className)}
135
140
  confirm={confirm}
136
141
  href={href}
137
142
  id={id}
@@ -149,6 +154,7 @@ const ActionButton = (props: ActionButtonProps) => {
149
154
  colorClassName,
150
155
  sizeClassName(),
151
156
  rightIcon ? classes.rightIcon : "",
157
+ inline && classes.inline,
152
158
  className
153
159
  );
154
160
 
@@ -165,7 +171,7 @@ const ActionButton = (props: ActionButtonProps) => {
165
171
  </BaseActionButton>
166
172
  );
167
173
  } else if ("formId" in props) {
168
- const { confirm, formId } = props;
174
+ const { confirm, formId, inline } = props;
169
175
 
170
176
  const onClick: OnClickHandler = () => {
171
177
  const externalForm = document.getElementById(formId) as HTMLFormElement | undefined;
@@ -177,7 +183,7 @@ const ActionButton = (props: ActionButtonProps) => {
177
183
 
178
184
  return(
179
185
  <BaseActionButton
180
- className={classNames(classes.button, colorClassName, sizeClassName(), className)}
186
+ className={classNames(classes.button, colorClassName, sizeClassName(), inline && classes.inline, className)}
181
187
  confirm={confirm}
182
188
  id={id}
183
189
  onClick={onClick}
package/IconButton.tsx CHANGED
@@ -1,17 +1,24 @@
1
1
  import React from "react";
2
2
  import { createUseStyles } from "react-jss";
3
3
  import classNames from "classnames";
4
+ import { ButtonColorName } from "./Colors";
4
5
  import FontAwesomeIcon, { FontAwesomeProps } from "./FontAwesomeIcon";
5
6
  import BaseActionButton from "./BaseActionButton";
6
7
  import { HrefProps, MethodProps, OnClickProps } from "./types";
7
8
  import Styles from "./Styles";
8
9
 
9
10
  const useStyles = createUseStyles({
11
+ blue: { ...Styles.blue },
12
+ darkGray: { ...Styles.darkGray },
13
+ gray: { ...Styles.gray },
14
+ green: { ...Styles.green },
10
15
  icon: {
11
- ...Styles.blue,
12
16
  cursor: "pointer",
13
17
  fontSize: "1.1em",
14
18
  },
19
+ orange: { ...Styles.orange },
20
+ purple: { ...Styles.purple },
21
+ red: { ...Styles.red },
15
22
  wrapperLink: {
16
23
  display: "inline-block",
17
24
  margin: "0",
@@ -21,6 +28,7 @@ const useStyles = createUseStyles({
21
28
 
22
29
  interface CoreIconProps extends FontAwesomeProps {
23
30
  className?: string;
31
+ color?: ButtonColorName;
24
32
  id?: string | undefined;
25
33
  title: string;
26
34
  }
@@ -35,12 +43,12 @@ export type IconButtonProps =
35
43
  | IconButtonOnClickProps;
36
44
 
37
45
  const IconButton = (props: IconButtonProps) => {
38
- const { className, fa, icon, id, mode, style, title } = props;
46
+ const { className, color, fa, icon, id, mode, style, title } = props;
39
47
  const classes = useStyles();
40
48
 
41
- const configuredIcon = <FontAwesomeIcon css={className} fa={fa} icon={icon} mode={mode} style={style} />;
42
-
43
- const combinedClassName = classNames(classes.icon, className);
49
+ const colorClassName = classes[color ?? "blue"];
50
+ const combinedClassName = classNames(classes.icon, colorClassName, className);
51
+ const configuredIcon = <FontAwesomeIcon css={combinedClassName} fa={fa} icon={icon} mode={mode} style={style} />;
44
52
 
45
53
  if ("onClick" in props) {
46
54
  const { confirm, onClick } = props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.4.0",
3
+ "version": "1.4.2-1",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {