@unitedstatespowersquadrons/components 1.2.22 → 1.2.24

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.
@@ -10,6 +10,7 @@ const useStyles = createUseStyles({
10
10
  border: "none",
11
11
  padding: "0",
12
12
  },
13
+ wrapperLink: { textDecoration: "none" },
13
14
  });
14
15
 
15
16
  interface CoreBaseActionButtonProps {
@@ -101,7 +102,7 @@ const BaseActionButton = (props: BaseActionButtonProps) => {
101
102
 
102
103
  return(
103
104
  <a
104
- className={linkClassName}
105
+ className={classNames(classes.wrapperLink, linkClassName)}
105
106
  href={href}
106
107
  id={id}
107
108
  rel={newTab ? "noreferrer" : undefined}
package/Readme.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # USPS React Components Library
2
2
 
3
+ ![NPM Version](https://img.shields.io/npm/v/@unitedstatespowersquadrons/components)
3
4
  [![Testing Status](https://github.com/unitedstatespowersquadrons/components/actions/workflows/main.yml/badge.svg)](https://github.com/unitedstatespowersquadrons/components/actions)
4
5
 
5
6
  ## Usage
@@ -46,12 +47,28 @@ More detailed information is available for [Toasts](Toasts/Readme.md) usage.
46
47
 
47
48
  ## Reducer
48
49
 
49
- To create a reducer, follow the following pattern, follow the pattern described
50
- in [Reducer/Example](Reducer/Example).
50
+ To create a reducer, follow the pattern described in [Reducer/Example](Reducer/Example).
51
51
 
52
52
  There is also an example in `appstate.tsx` for if you only need access to app
53
53
  state, but do not have any dispatchable events.
54
54
 
55
+ ## Shared TSC Config
56
+
57
+ To include the TSC config from this library, create `./tsconfig.json`:
58
+
59
+ ```json
60
+ {
61
+ "extends": "./node_modules/@unitedstatespowersquadrons/components/tsconfig.json",
62
+ "exclude": [
63
+ "**/proto",
64
+ "node_modules",
65
+ "public",
66
+ "vendor",
67
+ "tmp"
68
+ ]
69
+ }
70
+ ```
71
+
55
72
  ## Automated Testing
56
73
 
57
74
  GitHub Actions will automatically run `eslint` and `tsc` on branch pushes.
package/Styles.tsx CHANGED
@@ -59,6 +59,11 @@ const Styles = {
59
59
  textDecoration: "none",
60
60
  width: "fit-content",
61
61
  },
62
+ flexColumn: {
63
+ display: "flex",
64
+ flexDirection: "column",
65
+ gap: "0.5em",
66
+ },
62
67
  flexRow: {
63
68
  alignItems: "center",
64
69
  display: "flex",
package/Toasts/Readme.md CHANGED
@@ -5,16 +5,15 @@ root components, while supporting app state and reducer dispatching.
5
5
 
6
6
  ```tsx
7
7
  // NewComponent.tsx
8
+ import { Toasts } from "@unitedstatespowersquadrons/components";
8
9
  import { useAppState, useAppDispatch } from "./reducer";
9
- import { createDismissToast, Toasts } from "../shared";
10
10
 
11
11
  const NewComponent = () => {
12
12
  const { toasts } = useAppState();
13
13
  const dispatch = useAppDispatch();
14
- const dismissToast = createDismissToast(dispatch);
15
14
 
16
15
  return (
17
- <Toasts dismiss={dismissToast} toasts={toasts} />
16
+ <Toasts dispatch={dispatch} toasts={toasts} />
18
17
  );
19
18
  };
20
19
 
@@ -23,8 +22,7 @@ export default NewComponent;
23
22
 
24
23
  ```tsx
25
24
  // reducer.tsx
26
- import { Toast, ToastAppAction, ToastProps } from "../shared";
27
- import { addToast, handleToasts } from "./reducerHelpers";
25
+ import { addToast, handleToasts, Toast, ToastAppAction, ToastProps } from "@unitedstatespowersquadrons/components";
28
26
 
29
27
  export type AppAction =
30
28
  // ...
@@ -73,38 +71,3 @@ function reducer(draft: Draft<AppState>, action: AppAction) {
73
71
  // ...
74
72
  };
75
73
  ```
76
-
77
- ```tsx
78
- // reducerHelpers.tsx
79
- import { Draft } from "immer";
80
- import { AppState } from "./types";
81
- import { Toast, ToastProps } from "../shared";
82
-
83
- export const handleToasts = (draft: Draft<AppState>, toasts: Toast[]) => {
84
- if (toasts.length > 0) {
85
- toasts.forEach(toast => addToast(draft, toast));
86
- }
87
- };
88
-
89
- export const addToast = (draft: Draft<AppState>, toastOptions: Proto.Shared.Toast) => {
90
- const { body, status, timeout, title } = toastOptions;
91
-
92
- const id = draft.toastId = draft.toastId ? draft.toastId + 1 : 1;
93
-
94
- const toast = { body, id, status, timeout, title } as ToastProps;
95
-
96
- if (!draft.toasts) draft.toasts = [];
97
-
98
- // Do not store multiple identical toasts
99
- if (draft.toasts.some(t => {
100
- return (
101
- toast.body === t.body &&
102
- toast.status === t.status &&
103
- toast.title === t.title
104
- );
105
- })) return;
106
-
107
- draft.toasts.push(toast);
108
- };
109
-
110
- ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.2.22",
3
+ "version": "1.2.24",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {