@unitedstatespowersquadrons/components 1.4.8 → 1.4.10

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
@@ -14,6 +14,10 @@ const useStyles = createUseStyles({
14
14
  button: { ...Styles.button },
15
15
  darkGrayColored: { ...Styles.colorizeButton("darkGray") },
16
16
  darkGrayGray: { ...Styles.darkGray },
17
+ disabled: {
18
+ opacity: 0.5,
19
+ pointerEvents: "none",
20
+ },
17
21
  grayColored: { ...Styles.colorizeButton("gray") },
18
22
  grayGray: { ...Styles.gray },
19
23
  greenColored: { ...Styles.colorizeButton("green") },
@@ -54,6 +58,7 @@ const useStyles = createUseStyles({
54
58
  interface CoreActionButtonBaseProps extends FontAwesomeProps {
55
59
  className?: string | undefined;
56
60
  color: ButtonColorName;
61
+ disabled?: boolean | undefined;
57
62
  grayMode?: boolean | undefined;
58
63
  id?: string;
59
64
  rightIcon?: boolean;
@@ -99,7 +104,22 @@ export type ActionButtonProps =
99
104
 
100
105
  const ActionButton = (props: ActionButtonProps) => {
101
106
  const {
102
- className, color, fa, fontSize, grayMode, icon, id, margin, mode, rightIcon, size, style, subtext, text, title,
107
+ className,
108
+ color,
109
+ disabled,
110
+ fa,
111
+ fontSize,
112
+ grayMode,
113
+ icon,
114
+ id,
115
+ margin,
116
+ mode,
117
+ rightIcon,
118
+ size,
119
+ style,
120
+ subtext,
121
+ text,
122
+ title,
103
123
  } = props;
104
124
  const classes = useStyles({
105
125
  ...(fontSize !== undefined && { fontSize }),
@@ -107,6 +127,7 @@ const ActionButton = (props: ActionButtonProps) => {
107
127
  });
108
128
 
109
129
  const colorClassName = classes[`${color}${grayMode ? "Gray" : "Colored"}`];
130
+ const disabledClassName = disabled ? classes.disabled : "";
110
131
 
111
132
  const sizeClassName = () => {
112
133
  switch (size) {
@@ -144,7 +165,13 @@ const ActionButton = (props: ActionButtonProps) => {
144
165
  return(
145
166
  <BaseActionButton
146
167
  className={classNames(
147
- classes.button, colorClassName, sizeClassName(), classes.sizing, inline && classes.inline, className
168
+ classes.button,
169
+ colorClassName,
170
+ sizeClassName(),
171
+ classes.sizing,
172
+ inline && classes.inline,
173
+ disabledClassName,
174
+ className
148
175
  )}
149
176
  confirm={confirm}
150
177
  id={id}
@@ -160,7 +187,13 @@ const ActionButton = (props: ActionButtonProps) => {
160
187
  return(
161
188
  <BaseActionButton
162
189
  className={classNames(
163
- classes.button, colorClassName, sizeClassName(), classes.sizing, inline && classes.inline, className
190
+ classes.button,
191
+ colorClassName,
192
+ sizeClassName(),
193
+ classes.sizing,
194
+ inline && classes.inline,
195
+ disabledClassName,
196
+ className
164
197
  )}
165
198
  confirm={confirm}
166
199
  href={href}
@@ -181,6 +214,7 @@ const ActionButton = (props: ActionButtonProps) => {
181
214
  classes.sizing,
182
215
  rightIcon ? classes.rightIcon : "",
183
216
  inline && classes.inline,
217
+ disabledClassName,
184
218
  className
185
219
  );
186
220
 
@@ -210,7 +244,13 @@ const ActionButton = (props: ActionButtonProps) => {
210
244
  return(
211
245
  <BaseActionButton
212
246
  className={classNames(
213
- classes.button, colorClassName, sizeClassName(), classes.sizing, inline && classes.inline, className
247
+ classes.button,
248
+ colorClassName,
249
+ sizeClassName(),
250
+ classes.sizing,
251
+ inline && classes.inline,
252
+ disabledClassName,
253
+ className
214
254
  )}
215
255
  confirm={confirm}
216
256
  id={id}
@@ -13,9 +13,9 @@ const SuiteBadge = (props: Props) => {
13
13
 
14
14
  if (!suite || !suite.status) return null;
15
15
 
16
- const { headBranch, conclusion, skipCi, status } = suite;
16
+ const { headBranch, conclusion, skipCi, status, workflowName } = suite;
17
17
 
18
- const badge = <Check conclusion={conclusion} label={headBranch} skipCi={skipCi} status={status} />;
18
+ const badge = <Check conclusion={conclusion} label={workflowName || headBranch} skipCi={skipCi} status={status} />;
19
19
 
20
20
  if (!repo || conclusion === "success") return badge;
21
21
 
package/Badges/types.ts CHANGED
@@ -27,6 +27,7 @@ export interface CheckSuite {
27
27
  skipCi: boolean;
28
28
  latestCheckRunsCount: number;
29
29
  checkRuns?: CheckRun[];
30
+ workflowName?: string;
30
31
  }
31
32
 
32
33
  interface Commit {
package/eslint.config.mjs CHANGED
@@ -1,270 +1,22 @@
1
- import globals from "globals";
2
- import eslint from "@eslint/js";
3
- import stylisticJs from "@stylistic/eslint-plugin";
4
- import perfectionist from "eslint-plugin-perfectionist";
5
- import react from "eslint-plugin-react";
6
- import reactHooks from "eslint-plugin-react-hooks";
7
- import importPlugin from "eslint-plugin-import";
8
- import importNewlines from "eslint-plugin-import-newlines";
9
1
  import tseslint from "typescript-eslint";
2
+ import { eslintConfig } from "@unitedstatespowersquadrons/eslint-config";
10
3
 
11
4
  export default tseslint.config(
12
- eslint.configs.recommended,
13
- tseslint.configs.recommendedTypeChecked,
14
5
  {
15
- languageOptions: {
16
- globals: globals.browser,
17
- parserOptions: {
18
- projectService: true,
19
- tsconfigRootDir: import.meta.dirname,
20
- },
21
- },
6
+ files: ["**/*.js", "**/*.ts", "**/*.tsx"],
7
+ extends: [eslintConfig],
22
8
  },
23
9
  {
24
10
  rules: {
25
- "indent": ["error", 2],
26
- "linebreak-style": ["error", "unix"],
27
- "max-len": ["error", 120],
28
- "no-case-declarations": "error",
29
- "no-var": "error",
30
- "prefer-const": "error",
31
- "quotes": ["error", "double"],
32
- "semi": ["error", "always"],
33
- "sort-keys": ["error", "asc", { caseSensitive: true, minKeys: 2, natural: false }],
34
- "sort-imports": [
35
- "error",
36
- {
37
- "ignoreCase": true,
38
- "ignoreDeclarationSort": true,
39
- }
40
- ],
41
- "arrow-parens": ["error", "as-needed"],
42
- "comma-dangle": [
43
- "error",
44
- {
45
- "arrays": "always-multiline",
46
- "exports": "always-multiline",
47
- "functions": "never",
48
- "imports": "always-multiline",
49
- "objects": "always-multiline"
50
- }
51
- ],
52
- "constructor-super": "error",
53
- "curly": ["error", "multi-line"],
54
- "dot-notation": "off", // This is superseded by @typescript-eslint/dot-notation
55
- "eqeqeq": ["error", "smart"],
56
- "guard-for-in": "error",
57
- "id-blacklist": "error",
58
- "id-match": "error",
59
- "max-classes-per-file": ["error", 1],
60
- "max-len": [
61
- "error",
62
- {
63
- "code": 120,
64
- }
65
- ],
66
- "new-parens": "error",
67
- "no-bitwise": "error",
68
- "no-caller": "error",
69
- "no-cond-assign": "error",
70
- "no-console": "error",
71
- "no-debugger": "error",
72
- "no-eval": "error",
73
- "no-fallthrough": "error",
74
- "no-new-wrappers": "error",
75
- "no-shadow": "off", // This is superseded by @typescript-eslint/no-shadow
76
- "no-throw-literal": "error",
77
- "no-trailing-spaces": "error",
78
- "no-undef-init": "error",
79
- "no-unsafe-finally": "error",
80
- "no-unused-expressions": [
81
- "error",
82
- {
83
- "allowShortCircuit": true
84
- }
85
- ],
86
- "no-unused-labels": "error",
87
- "no-var": "error",
88
- "object-curly-spacing": ["error", "always"],
89
- "object-shorthand": "error",
90
- "one-var": ["error", "never"],
91
- "prefer-const": "error",
92
- "prefer-rest-params": "error",
93
- "prefer-spread": "error",
94
- "quote-props": ["error", "as-needed"],
95
- "quotes": ["error", "double", { "allowTemplateLiterals": true, "avoidEscape": true }],
96
- "radix": "error",
97
- "sort-keys": "error",
98
- "spaced-comment": "error",
99
- "use-isnan": "error",
100
-
101
- "@typescript-eslint/adjacent-overload-signatures": "error",
102
- "@typescript-eslint/array-type": "error",
103
- "@typescript-eslint/await-thenable": "error",
104
- "@typescript-eslint/ban-ts-comment": "error",
105
- "@typescript-eslint/dot-notation": "error",
106
- "@typescript-eslint/explicit-member-accessibility": "error",
107
- "@typescript-eslint/no-array-constructor": "error",
108
- "@typescript-eslint/no-extra-non-null-assertion": "error",
109
- "@typescript-eslint/no-floating-promises": "error",
110
- "@typescript-eslint/no-for-in-array": "error",
111
- "@typescript-eslint/no-implied-eval": "error",
112
- "@typescript-eslint/no-misused-new": "error",
113
- "@typescript-eslint/no-misused-promises": "error",
114
- "@typescript-eslint/no-namespace": "error",
115
- "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
116
- "@typescript-eslint/no-shadow": [
117
- "error",
118
- {
119
- "hoist": "all"
120
- }
121
- ],
122
- "@typescript-eslint/no-this-alias": "error",
123
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
124
- "@typescript-eslint/no-unsafe-call": "error",
125
- "@typescript-eslint/no-unsafe-return": "error",
126
- "@typescript-eslint/no-var-requires": "error",
127
- "@typescript-eslint/prefer-as-const": "error",
128
- "@typescript-eslint/prefer-for-of": "error",
129
- "@typescript-eslint/prefer-function-type": "error",
130
- "@typescript-eslint/prefer-includes": "error",
131
- "@typescript-eslint/prefer-namespace-keyword": "error",
132
- "@typescript-eslint/prefer-regexp-exec": "error",
133
- "@typescript-eslint/require-await": "error",
134
- "@typescript-eslint/triple-slash-reference": "error",
135
- "@typescript-eslint/unified-signatures": "error",
136
- "@typescript-eslint/no-restricted-types": "error",
137
- "@typescript-eslint/no-empty-object-type": "error",
138
- "@typescript-eslint/no-wrapper-object-types": "error",
139
-
140
- "stylistic/member-delimiter-style": [
141
- "error",
142
- {
143
- "multiline": {
144
- "delimiter": "semi",
145
- "requireLast": true
146
- },
147
- "singleline": {
148
- "delimiter": "semi",
149
- "requireLast": false
150
- }
151
- }
152
- ],
153
- "stylistic/no-extra-semi": "error",
154
- "stylistic/semi": ["error", "always"],
155
- "stylistic/no-multiple-empty-lines": "error",
156
- "perfectionist/sort-jsx-props": "error",
157
- "stylistic/eol-last": "error",
158
- "stylistic/array-element-newline": [
159
- "error",
160
- {
161
- "ArrayExpression": "consistent",
162
- "ArrayPattern": { "minItems": 5 },
163
- }
164
- ],
165
- "stylistic/object-property-newline": [
166
- "error",
167
- {
168
- // "ArrayExpression": "consistent",
169
- "allowAllPropertiesOnSameLine": true,
170
- }
171
- ],
172
-
173
- "react/display-name": "error",
174
- "react/jsx-boolean-value": ["error", "always"],
175
- "react/jsx-closing-bracket-location": "error",
176
- "react/jsx-equals-spacing": ["error", "never"],
177
- "react/jsx-key": ["error", { "checkFragmentShorthand": false }],
178
- "react/jsx-no-comment-textnodes": "error",
179
- "react/jsx-no-duplicate-props": "error",
180
- "react/jsx-no-target-blank": "error",
181
- "react/jsx-no-undef": "error",
182
- "react/jsx-uses-react": "error",
183
- "react/jsx-uses-vars": "error",
184
- "react/jsx-wrap-multilines": "error",
185
- "react/no-children-prop": "error",
186
- "react/no-danger-with-children": "error",
187
- "react/no-deprecated": "error",
188
- "react/no-direct-mutation-state": "error",
189
- "react/no-find-dom-node": "error",
190
- "react/no-is-mounted": "error",
191
- "react/no-render-return-value": "error",
192
- "react/no-string-refs": ["error", { "noTemplateLiterals": true }],
193
- "react/no-unescaped-entities": "error",
194
- "react/no-unknown-property": "error",
195
- "react/no-unsafe": 0,
196
- "react/prop-types": "off", // Use typescript to validate types.
197
- "react/react-in-jsx-scope": "error",
198
- "react/require-render-return": "error",
199
- "react/self-closing-comp": [
200
- "error",
201
- {
202
- "component": true,
203
- "html": true
204
- }
205
- ],
206
-
207
- "react-hooks/exhaustive-deps": "error",
208
- "react-hooks/rules-of-hooks": "error",
209
-
210
- "import/order": [
211
- "error",
212
- {
213
- "groups": [
214
- "builtin",
215
- "external", // "package"
216
- "object",
217
- "internal",
218
- "index", // "./"
219
- "sibling", // "./directory"
220
- "parent", // "../directory"
221
- // Then the omitted imports: type, unknown
222
- ],
223
- }
224
- ],
225
-
226
- "import-newlines/enforce": [
227
- "error",
228
- {
229
- "items": 5,
230
- "max-len": 120,
231
- "semi": false
232
- }
233
- ],
234
- },
235
- settings: {
236
- react: {
237
- createClass: "createReactClass",
238
- pragma: "React",
239
- version: "detect",
240
- },
11
+ indent: ["error", 2],
241
12
  },
242
13
  },
243
14
  {
244
15
  ignores: [
245
- "tmp/*",
246
- "coverage/*",
247
- "public/*",
248
- "vendor/*",
249
- "app/assets/*",
250
- "app/javascript/controllers/*",
251
- "app/javascript/application.js",
252
- "app/javascript/mount.tsx",
253
- "eslint.config.mjs",
254
16
  "vitest.config.ts",
255
17
  "vitest.setup.ts",
256
18
  "**/*.test.ts",
257
19
  "**/*.test.tsx",
258
20
  ],
259
21
  },
260
- {
261
- plugins: {
262
- "stylistic": stylisticJs,
263
- "perfectionist": perfectionist,
264
- "react": react,
265
- "react-hooks": reactHooks,
266
- "import": importPlugin,
267
- "import-newlines": importNewlines,
268
- },
269
- },
270
22
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.4.8",
3
+ "version": "1.4.10",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {
@@ -21,7 +21,6 @@
21
21
  "@rails/actioncable": "^8.0.200",
22
22
  "@types/rails__actioncable": "^6.1.11",
23
23
  "classnames": "^2.5.1",
24
- "eslint-plugin-perfectionist": "^5.9.0",
25
24
  "immer": "^10.1.1",
26
25
  "javascript-time-ago": "^2.6.4",
27
26
  "react": "^19.1.0",
@@ -30,17 +29,13 @@
30
29
  "use-immer": "^0.11.0"
31
30
  },
32
31
  "devDependencies": {
33
- "@stylistic/eslint-plugin": "^5.1.0",
34
32
  "@testing-library/dom": "^10.4.1",
35
33
  "@testing-library/jest-dom": "^6.6.0",
36
34
  "@testing-library/react": "^16.3.0",
37
35
  "@types/react": "^19.1.8",
38
36
  "@types/react-dom": "^19.1.6",
37
+ "@unitedstatespowersquadrons/eslint-config": "^1.0.8",
39
38
  "eslint": "^9.30.1",
40
- "eslint-plugin-import": "^2.32.0",
41
- "eslint-plugin-import-newlines": "^1.4.0",
42
- "eslint-plugin-react": "^7.37.5",
43
- "eslint-plugin-react-hooks": "^5.2.0",
44
39
  "jsdom": "^26.1.0",
45
40
  "typescript": "^5.8.3",
46
41
  "typescript-eslint": "^8.36.0",