@unitedstatespowersquadrons/components 1.2.25-2 → 1.2.26-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 +0 -21
- package/Colors.tsx +0 -3
- package/Flags/Officer.tsx +2 -7
- package/Flags/Signal.tsx +2 -7
- package/Flags/Signals.tsx +2 -7
- package/FontAwesomeIcon.tsx +0 -6
- package/IconButton.tsx +0 -17
- package/RailsForm.tsx +8 -9
- package/Reducer/buildReducer.tsx +0 -7
- package/Reducer/buildUnreducibleState.tsx +0 -5
- package/Reducer/wrapDispatch.tsx +3 -2
- package/SelectionIconButton.tsx +2 -7
- package/StripedTable/Body.tsx +2 -7
- package/StripedTable/Foot.tsx +2 -7
- package/StripedTable/Head.tsx +2 -7
- package/StripedTable/Table.tsx +2 -7
- package/StripedTable/TableStyles.ts +0 -3
- package/Styles.tsx +0 -3
- package/Toasts/Toast.tsx +3 -11
- package/Toasts/Toasts.tsx +3 -8
- package/Toasts/toastHelpers.ts +0 -17
- package/eslint.config.mjs +0 -1
- package/mount.tsx +0 -3
- package/package.json +1 -2
- package/railsFetchJson.tsx +1 -4
- package/types.ts +0 -9
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -99
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1633
- package/docs/enums/Toast_Status.html +0 -4
- package/docs/functions/ActionButton.html +0 -3
- package/docs/functions/FontAwesomeIcon.html +0 -3
- package/docs/functions/IconButton.html +0 -3
- package/docs/functions/OfficerFlag.html +0 -2
- package/docs/functions/RailsForm.html +0 -2
- package/docs/functions/SelectionIconButton.html +0 -2
- package/docs/functions/SignalFlag.html +0 -2
- package/docs/functions/SignalFlags.html +0 -2
- package/docs/functions/StripedBody.html +0 -2
- package/docs/functions/StripedHead.html +0 -2
- package/docs/functions/StripedTable.html +0 -2
- package/docs/functions/Toasts.html +0 -2
- package/docs/functions/addToast.html +0 -2
- package/docs/functions/buildReducer.html +0 -4
- package/docs/functions/buildUnreducibleState.html +0 -2
- package/docs/functions/createDismissToast.html +0 -3
- package/docs/functions/getCsrfTokenHeader.html +0 -1
- package/docs/functions/handleToasts.html +0 -2
- package/docs/functions/mount.html +0 -2
- package/docs/functions/railsFetchJson.html +0 -2
- package/docs/functions/removeToast.html +0 -2
- package/docs/functions/removeToastById.html +0 -3
- package/docs/functions/wrapDispatch.html +0 -1
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -33
- package/docs/interfaces/ActionButtonFormProps.html +0 -18
- package/docs/interfaces/ActionButtonHrefProps.html +0 -20
- package/docs/interfaces/ActionButtonMethodProps.html +0 -21
- package/docs/interfaces/ActionButtonOnClickProps.html +0 -18
- package/docs/interfaces/AppStateWithToasts.html +0 -3
- package/docs/interfaces/CoreActionButtonProps.html +0 -15
- package/docs/interfaces/FontAwesomeProps.html +0 -7
- package/docs/interfaces/GenericAppAction.html +0 -2
- package/docs/interfaces/IconButtonHrefProps.html +0 -13
- package/docs/interfaces/IconButtonMethodProps.html +0 -15
- package/docs/interfaces/IconButtonOnClickProps.html +0 -12
- package/docs/interfaces/RailsResponse.html +0 -4
- package/docs/interfaces/Toast.html +0 -7
- package/docs/interfaces/ToastProps.html +0 -8
- package/docs/media/Readme.md +0 -73
- package/docs/modules.html +0 -1
- package/docs/types/ActionButtonProps.html +0 -1
- package/docs/types/AppActionType.html +0 -1
- package/docs/types/ButtonColorName.html +0 -1
- package/docs/types/CableAction.html +0 -3
- package/docs/types/DismissFunc.html +0 -1
- package/docs/types/DispatchFunc.html +0 -1
- package/docs/types/DispatchHandler.html +0 -1
- package/docs/types/IconButtonProps.html +0 -1
- package/docs/types/OnClickHandler.html +0 -1
- package/docs/types/OnClickOrKeyboardHandler.html +0 -1
- package/docs/types/OnInputChangeHandler.html +0 -1
- package/docs/types/OnMouseMoveHandler.html +0 -1
- package/docs/types/RailsAppAction.html +0 -1
- package/docs/types/ReducerHandler.html +0 -1
- package/docs/types/ToastAppAction.html +0 -1
- package/docs/types/ToastRemoveAppAction.html +0 -1
- package/docs/variables/Colors.html +0 -2
- package/docs/variables/Flags.html +0 -4
- package/docs/variables/Striped.html +0 -4
- package/docs/variables/Styles.html +0 -2
- package/typedoc.json +0 -3
package/ActionButton.tsx
CHANGED
|
@@ -63,24 +63,9 @@ interface InlineProps {
|
|
|
63
63
|
inline?: boolean;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/**
|
|
67
|
-
* Props for a standard link button
|
|
68
|
-
*/
|
|
69
66
|
export interface ActionButtonHrefProps extends CoreActionButtonProps, HrefProps, InlineProps {}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Props for a link button with a form wrapper for HTTP verb requests
|
|
73
|
-
*/
|
|
74
67
|
export interface ActionButtonMethodProps extends CoreActionButtonProps, MethodProps {}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Props for a button with a custom `onClick` handler
|
|
78
|
-
*/
|
|
79
68
|
export interface ActionButtonOnClickProps extends CoreActionButtonProps, OnClickProps {}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Props for a button to submit a form
|
|
83
|
-
*/
|
|
84
69
|
export interface ActionButtonFormProps extends CoreActionButtonProps, FormProps {}
|
|
85
70
|
|
|
86
71
|
export type ActionButtonProps =
|
|
@@ -89,12 +74,6 @@ export type ActionButtonProps =
|
|
|
89
74
|
| ActionButtonOnClickProps
|
|
90
75
|
| ActionButtonFormProps;
|
|
91
76
|
|
|
92
|
-
/**
|
|
93
|
-
* Stylized button with icon and text, for handling dispatch actions, form
|
|
94
|
-
* submissions, and other general links
|
|
95
|
-
*
|
|
96
|
-
* @category Components
|
|
97
|
-
*/
|
|
98
77
|
const ActionButton = (props: ActionButtonProps) => {
|
|
99
78
|
const { className, color, fa, grayMode, icon, id, mode, rightIcon, size, style, subtext, text, title } = props;
|
|
100
79
|
const classes = useStyles();
|
package/Colors.tsx
CHANGED
package/Flags/Officer.tsx
CHANGED
|
@@ -9,7 +9,7 @@ type FlagRank =
|
|
|
9
9
|
| "PDLTC" | "PDC" | "DAIDE" | "DFLT" | "D1LT"
|
|
10
10
|
| "PNFLT" | "PSTFC" | "PRC" | "PVC" | "PCC" | "NAIDE" | "NFLT";
|
|
11
11
|
|
|
12
|
-
interface
|
|
12
|
+
interface Props {
|
|
13
13
|
className?: string;
|
|
14
14
|
flag?: string; // FlagRank | jobcode
|
|
15
15
|
format?: "svg" | "png";
|
|
@@ -19,12 +19,7 @@ interface OfficerProps {
|
|
|
19
19
|
size?: number | "thumb";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
* An officer flag image
|
|
24
|
-
*
|
|
25
|
-
* @category Components
|
|
26
|
-
*/
|
|
27
|
-
const OfficerFlag = (props: OfficerProps) => {
|
|
22
|
+
const OfficerFlag = (props: Props) => {
|
|
28
23
|
const { className, flag, format, jobcode, insignia, rank, size } = props;
|
|
29
24
|
|
|
30
25
|
if (!flag && !jobcode && !rank) {
|
package/Flags/Signal.tsx
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface Props {
|
|
4
4
|
alt?: string;
|
|
5
5
|
className?: string;
|
|
6
6
|
flag: string;
|
|
7
7
|
format?: "svg" | "png" | undefined;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* An individual signal flag image
|
|
12
|
-
*
|
|
13
|
-
* @category Components
|
|
14
|
-
*/
|
|
15
|
-
const SignalFlag = (props: SignalProps) => {
|
|
10
|
+
const SignalFlag = (props: Props) => {
|
|
16
11
|
const { alt, className, flag, format } = props;
|
|
17
12
|
|
|
18
13
|
const special = ["\uE000", "\uE001", "\uE002", "\uE003"];
|
package/Flags/Signals.tsx
CHANGED
|
@@ -14,7 +14,7 @@ type Size =
|
|
|
14
14
|
| "vertical"
|
|
15
15
|
| "center";
|
|
16
16
|
|
|
17
|
-
interface
|
|
17
|
+
interface Props {
|
|
18
18
|
className?: string;
|
|
19
19
|
format?: "svg" | "png";
|
|
20
20
|
orientation?: Orientation;
|
|
@@ -70,12 +70,7 @@ const useStyles = createUseStyles({
|
|
|
70
70
|
},
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
* A colleciton of signal flag images generated from a string
|
|
75
|
-
*
|
|
76
|
-
* @category Components
|
|
77
|
-
*/
|
|
78
|
-
const SignalFlags = (props: SignalsProps) => {
|
|
73
|
+
const SignalFlags = (props: Props) => {
|
|
79
74
|
const { className, format, orientation, size, text, title } = props;
|
|
80
75
|
const classes = useStyles();
|
|
81
76
|
|
package/FontAwesomeIcon.tsx
CHANGED
|
@@ -17,12 +17,6 @@ const useStyles = createUseStyles({
|
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* A formatted FontAwesome icon placeholder `<i>` tag, which will be replaced by
|
|
22
|
-
* the FontAwesome JS with the corresponding SVG
|
|
23
|
-
*
|
|
24
|
-
* @category Components
|
|
25
|
-
*/
|
|
26
20
|
const FontAwesomeIcon = (props: FontAwesomeProps) => {
|
|
27
21
|
const { css, fa, icon, mode, style, title } = props;
|
|
28
22
|
const classes = useStyles();
|
package/IconButton.tsx
CHANGED
|
@@ -25,19 +25,8 @@ interface CoreIconProps extends FontAwesomeProps {
|
|
|
25
25
|
title: string;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Props for a standard link button
|
|
30
|
-
*/
|
|
31
28
|
export interface IconButtonHrefProps extends CoreIconProps, HrefProps {}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Props for a link button with a form wrapper for HTTP verb requests
|
|
35
|
-
*/
|
|
36
29
|
export interface IconButtonMethodProps extends CoreIconProps, MethodProps {}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Props for a button with a custom `onClick` handler
|
|
40
|
-
*/
|
|
41
30
|
export interface IconButtonOnClickProps extends CoreIconProps, OnClickProps {}
|
|
42
31
|
|
|
43
32
|
export type IconButtonProps =
|
|
@@ -45,12 +34,6 @@ export type IconButtonProps =
|
|
|
45
34
|
| IconButtonMethodProps
|
|
46
35
|
| IconButtonOnClickProps;
|
|
47
36
|
|
|
48
|
-
/**
|
|
49
|
-
* Stylized icon-only button, for handling dispatch actions, form submissions,
|
|
50
|
-
* and other general links
|
|
51
|
-
*
|
|
52
|
-
* @category Components
|
|
53
|
-
*/
|
|
54
37
|
const IconButton = (props: IconButtonProps) => {
|
|
55
38
|
const { className, fa, icon, id, mode, style, title } = props;
|
|
56
39
|
const classes = useStyles();
|
package/RailsForm.tsx
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface Props {
|
|
4
4
|
action: string;
|
|
5
5
|
fileUpload?: boolean;
|
|
6
6
|
id?: string;
|
|
7
|
-
method?: "get" | "post";
|
|
7
|
+
method?: "get" | "post" | "put" | "patch" | "delete";
|
|
8
8
|
children: React.ReactNode[];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
* A `form` tag that includes the Rails CSRF params
|
|
13
|
-
*
|
|
14
|
-
* @category Components
|
|
15
|
-
*/
|
|
16
|
-
const RailsForm = (props: RailsFormProps) => {
|
|
11
|
+
const RailsForm = (props: Props) => {
|
|
17
12
|
const { action, children, fileUpload, id, method } = props;
|
|
18
13
|
|
|
19
14
|
const token = document.querySelector("meta[name='csrf-token']");
|
|
20
15
|
const csrfToken = token ? token.getAttribute("content")! : "";
|
|
21
16
|
|
|
17
|
+
const formMethod = method === "get" ? "get" : "post";
|
|
18
|
+
|
|
22
19
|
return(
|
|
23
|
-
<form action={action} encType={fileUpload ? "multipart/form-data" : undefined} id={id} method={
|
|
20
|
+
<form action={action} encType={fileUpload ? "multipart/form-data" : undefined} id={id} method={formMethod}>
|
|
24
21
|
<input name="authenticity_token" type="hidden" value={csrfToken} />
|
|
22
|
+
{method === formMethod ||
|
|
23
|
+
<input name="_method" type="hidden" value={method} />}
|
|
25
24
|
{children}
|
|
26
25
|
</form>
|
|
27
26
|
);
|
package/Reducer/buildReducer.tsx
CHANGED
|
@@ -9,13 +9,6 @@ interface InitialAppProps<AppState> {
|
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Construct the exports from a reducer
|
|
14
|
-
*
|
|
15
|
-
* @param reducer The specific reducer function for the component
|
|
16
|
-
* @param handlers Handlers for individual dispatch actions
|
|
17
|
-
* @returns { AppProvider, useAppCableSubscription, useAppDispatch, useAppState }
|
|
18
|
-
*/
|
|
19
12
|
export default function buildReducer<AppState, AppAction>(
|
|
20
13
|
reducer: (draft: Draft<AppState>, action: AppAction) => void,
|
|
21
14
|
handlers: ReducerHandler<AppAction>[] = []
|
|
@@ -5,11 +5,6 @@ interface InitialAppProps<AppState> {
|
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Construct the exports to access appState for a component without a reducer
|
|
10
|
-
*
|
|
11
|
-
* @returns { AppProvider, useAppState }
|
|
12
|
-
*/
|
|
13
8
|
export default function buildUnreducibleState<AppState>() {
|
|
14
9
|
const StateContext = createContext<AppState | null>(null);
|
|
15
10
|
|
package/Reducer/wrapDispatch.tsx
CHANGED
|
@@ -18,9 +18,10 @@ export default function wrapDispatch<
|
|
|
18
18
|
>(
|
|
19
19
|
dispatch: DispatchFunc<A>,
|
|
20
20
|
appActionTypes: AppActionType<A>[],
|
|
21
|
-
handler: DispatchHandler<A
|
|
21
|
+
handler: DispatchHandler<A>,
|
|
22
|
+
debounce?: boolean
|
|
22
23
|
): DispatchFunc<A> {
|
|
23
|
-
const updateDebounceTime = (("testEnv" in window) && window.testEnv) ? 50 : 250;
|
|
24
|
+
const updateDebounceTime = debounce ? ((("testEnv" in window) && window.testEnv) ? 50 : 250) : 0;
|
|
24
25
|
|
|
25
26
|
const updateHandler = async (action: A, signal: AbortSignal) => {
|
|
26
27
|
const handlerData = handler(action);
|
package/SelectionIconButton.tsx
CHANGED
|
@@ -7,17 +7,12 @@ const useStyles = createUseStyles({
|
|
|
7
7
|
icon: { cursor: "pointer" },
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
interface Props extends Omit<IconButtonOnClickProps, "icon"> {
|
|
11
11
|
id?: string;
|
|
12
12
|
selected: boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
* Stylized icon-only button, intended for handling add/remove dispatch actions
|
|
17
|
-
*
|
|
18
|
-
* @category Components
|
|
19
|
-
*/
|
|
20
|
-
const SelectionIconButton = (props: SelectionIconButtonProps) => {
|
|
15
|
+
const SelectionIconButton = (props: Props) => {
|
|
21
16
|
const { id, onClick, selected } = props;
|
|
22
17
|
const classes = useStyles();
|
|
23
18
|
|
package/StripedTable/Body.tsx
CHANGED
|
@@ -6,16 +6,11 @@ const useStyles = createUseStyles({
|
|
|
6
6
|
tbody: TableStyles.tbody,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
interface
|
|
9
|
+
interface Props {
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
* Table body with automatic row striping
|
|
15
|
-
*
|
|
16
|
-
* @category Components
|
|
17
|
-
*/
|
|
18
|
-
const Body = (props: BodyProps) => {
|
|
13
|
+
const Body = (props: Props) => {
|
|
19
14
|
const { children } = props;
|
|
20
15
|
const classes = useStyles();
|
|
21
16
|
|
package/StripedTable/Foot.tsx
CHANGED
|
@@ -6,16 +6,11 @@ const useStyles = createUseStyles({
|
|
|
6
6
|
tfoot: TableStyles.tfoot,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
interface
|
|
9
|
+
interface Props {
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
* Table foot with automatic row striping
|
|
15
|
-
*
|
|
16
|
-
* @category Components
|
|
17
|
-
*/
|
|
18
|
-
const Head = (props: FootProps) => {
|
|
13
|
+
const Head = (props: Props) => {
|
|
19
14
|
const { children } = props;
|
|
20
15
|
const classes = useStyles();
|
|
21
16
|
|
package/StripedTable/Head.tsx
CHANGED
|
@@ -6,16 +6,11 @@ const useStyles = createUseStyles({
|
|
|
6
6
|
thead: TableStyles.thead,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
interface
|
|
9
|
+
interface Props {
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
* Table head with automatic row striping
|
|
15
|
-
*
|
|
16
|
-
* @category Components
|
|
17
|
-
*/
|
|
18
|
-
const Head = (props: HeadProps) => {
|
|
13
|
+
const Head = (props: Props) => {
|
|
19
14
|
const { children } = props;
|
|
20
15
|
const classes = useStyles();
|
|
21
16
|
|
package/StripedTable/Table.tsx
CHANGED
|
@@ -10,7 +10,7 @@ const useStyles = createUseStyles({
|
|
|
10
10
|
tableStripedTbody: TableStyles.tableStripedTbody,
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
interface
|
|
13
|
+
interface Props {
|
|
14
14
|
borderCollapse?: boolean;
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
className?: string;
|
|
@@ -18,12 +18,7 @@ interface TableProps {
|
|
|
18
18
|
stripedTbody?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
* Table with automatic row striping
|
|
23
|
-
*
|
|
24
|
-
* @category Components
|
|
25
|
-
*/
|
|
26
|
-
const Table = (props: TableProps) => {
|
|
21
|
+
const Table = (props: Props) => {
|
|
27
22
|
const { borderCollapse, children, className, id, stripedTbody } = props;
|
|
28
23
|
const classes = useStyles();
|
|
29
24
|
|
package/Styles.tsx
CHANGED
package/Toasts/Toast.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { DismissFunc, Toast_Status, ToastProps } from "./types";
|
|
|
5
5
|
import FontAwesomeIcon from "../FontAwesomeIcon";
|
|
6
6
|
import Styles from "../Styles";
|
|
7
7
|
|
|
8
|
-
interface
|
|
8
|
+
interface Props {
|
|
9
9
|
dismiss: DismissFunc;
|
|
10
10
|
toast: ToastProps;
|
|
11
11
|
}
|
|
@@ -26,10 +26,7 @@ const useStyles = createUseStyles({
|
|
|
26
26
|
color: "#009900",
|
|
27
27
|
},
|
|
28
28
|
toast: {
|
|
29
|
-
"@media print, screen and (max-width: 1000px)": {
|
|
30
|
-
maxWidth: "100%",
|
|
31
|
-
width: "auto",
|
|
32
|
-
},
|
|
29
|
+
"@media print, screen and (max-width: 1000px)": { maxWidth: "100%" },
|
|
33
30
|
animation: "fadeIn 1s",
|
|
34
31
|
backgroundColor: "#EEEEEE",
|
|
35
32
|
border: "thin solid white",
|
|
@@ -72,12 +69,7 @@ const useStyles = createUseStyles({
|
|
|
72
69
|
visible: { opacity: "1" },
|
|
73
70
|
});
|
|
74
71
|
|
|
75
|
-
|
|
76
|
-
* An individual toast message
|
|
77
|
-
*
|
|
78
|
-
* @category Components
|
|
79
|
-
*/
|
|
80
|
-
const Toast = (props: ToastComponentProps) => {
|
|
72
|
+
const Toast = (props: Props) => {
|
|
81
73
|
const classes = useStyles();
|
|
82
74
|
|
|
83
75
|
const { dismiss, toast } = props;
|
package/Toasts/Toasts.tsx
CHANGED
|
@@ -23,9 +23,9 @@ type Props = DismissProps | DispatchProps;
|
|
|
23
23
|
const useStyles = createUseStyles({
|
|
24
24
|
toastsContainer: {
|
|
25
25
|
"@media print, screen and (max-width: 1000px)": {
|
|
26
|
-
fontSize: "
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
fontSize: "0.7em",
|
|
27
|
+
marginLeft: "0.5em",
|
|
28
|
+
maxWidth: "100%",
|
|
29
29
|
},
|
|
30
30
|
display: "flex",
|
|
31
31
|
flexDirection: "column",
|
|
@@ -38,11 +38,6 @@ const useStyles = createUseStyles({
|
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
* Container for handling toast messages
|
|
43
|
-
*
|
|
44
|
-
* @category Components
|
|
45
|
-
*/
|
|
46
41
|
const Toasts = (props: Props) => {
|
|
47
42
|
const { toasts } = props;
|
|
48
43
|
const classes = useStyles();
|
package/Toasts/toastHelpers.ts
CHANGED
|
@@ -2,10 +2,6 @@ import { Draft } from "immer";
|
|
|
2
2
|
import { Toast, ToastProps, ToastRemoveAppAction } from "./types";
|
|
3
3
|
import { AppStateWithToasts, DispatchFunc } from "../";
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Wrap a reducer's dispatch function to create the dismissToast function for a
|
|
7
|
-
* component
|
|
8
|
-
*/
|
|
9
5
|
export function createDismissToast(dispatch: DispatchFunc<ToastRemoveAppAction>) {
|
|
10
6
|
const dismissToast = (toastId: number) => {
|
|
11
7
|
dispatch({ toastId, type: "dismissToast" });
|
|
@@ -16,18 +12,12 @@ export function createDismissToast(dispatch: DispatchFunc<ToastRemoveAppAction>)
|
|
|
16
12
|
return dismissToast;
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
/**
|
|
20
|
-
* Handle toasts received from the server, or generated by an action
|
|
21
|
-
*/
|
|
22
15
|
export function handleToasts<T extends AppStateWithToasts>(draft: Draft<T>, toasts: Toast[]) {
|
|
23
16
|
if (toasts.length > 0) {
|
|
24
17
|
toasts.forEach(toast => addToast(draft, toast));
|
|
25
18
|
}
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
/**
|
|
29
|
-
* Add a toast to the current toasts container
|
|
30
|
-
*/
|
|
31
21
|
export function addToast<T extends AppStateWithToasts>(draft: Draft<T>, toastOptions: Toast) {
|
|
32
22
|
const { body, id, status, timeout, title } = toastOptions;
|
|
33
23
|
|
|
@@ -52,9 +42,6 @@ export function addToast<T extends AppStateWithToasts>(draft: Draft<T>, toastOpt
|
|
|
52
42
|
draft.toasts.push(toast);
|
|
53
43
|
}
|
|
54
44
|
|
|
55
|
-
/**
|
|
56
|
-
* Remove a toast from the current toasts container
|
|
57
|
-
*/
|
|
58
45
|
export function removeToast<T extends AppStateWithToasts>(draft: Draft<T>, toast: ToastProps) {
|
|
59
46
|
const beforeToasts: ToastProps[] = [];
|
|
60
47
|
const afterToasts: ToastProps[] = [];
|
|
@@ -74,10 +61,6 @@ export function removeToast<T extends AppStateWithToasts>(draft: Draft<T>, toast
|
|
|
74
61
|
});
|
|
75
62
|
}
|
|
76
63
|
|
|
77
|
-
/**
|
|
78
|
-
* Remove a toast from the current toasts container corresponding to a specific
|
|
79
|
-
* known toastId (usually, a static toast generated by the server)
|
|
80
|
-
*/
|
|
81
64
|
export function removeToastById<T extends AppStateWithToasts>(draft: Draft<T>, toastId: number) {
|
|
82
65
|
const toast = draft.toasts.find(t => t.id === toastId);
|
|
83
66
|
|
package/eslint.config.mjs
CHANGED
package/mount.tsx
CHANGED
|
@@ -28,9 +28,6 @@ const findComponent = (
|
|
|
28
28
|
return (current as Components)[componentName];
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* Mount React components to make them renderable in the UI
|
|
33
|
-
*/
|
|
34
31
|
export default function mount(components: NestedComponents): void {
|
|
35
32
|
document.addEventListener("DOMContentLoaded", () => {
|
|
36
33
|
const mountPoints = document.querySelectorAll("[data-react-component]");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unitedstatespowersquadrons/components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.26-1",
|
|
4
4
|
"description": "USPS shared React components library",
|
|
5
5
|
"main": "index.tsx",
|
|
6
6
|
"scripts": {
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"eslint-plugin-import-newlines": "^1.4.0",
|
|
38
38
|
"eslint-plugin-react": "^7.37.5",
|
|
39
39
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
40
|
-
"typedoc": "^0.28.14",
|
|
41
40
|
"typescript-eslint": "^8.36.0"
|
|
42
41
|
}
|
|
43
42
|
}
|
package/railsFetchJson.tsx
CHANGED
|
@@ -9,9 +9,6 @@ export const getCsrfTokenHeader = () => {
|
|
|
9
9
|
return token ? token.getAttribute("content")! : "";
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Wrapper for `fetch` that includes the Rail CSRF params
|
|
14
|
-
*/
|
|
15
12
|
const railsFetchJson = <T = object>(url: RequestInfo, options?: FetchJsonOptions) => {
|
|
16
13
|
options ||= {};
|
|
17
14
|
const optionHeaders = options.headers;
|
|
@@ -20,8 +17,8 @@ const railsFetchJson = <T = object>(url: RequestInfo, options?: FetchJsonOptions
|
|
|
20
17
|
...optionHeaders,
|
|
21
18
|
Credentials: "same-origin",
|
|
22
19
|
"X-CSRF-Token": getCsrfTokenHeader(),
|
|
20
|
+
"X-Exams-Client": "React-2025",
|
|
23
21
|
"X-Requested-With": "XMLHttpRequest",
|
|
24
|
-
"X-USPS-Client": "React-2025",
|
|
25
22
|
};
|
|
26
23
|
|
|
27
24
|
const jsonPost = options.method !== "GET" && options?.bodyJson;
|
package/types.ts
CHANGED
|
@@ -15,9 +15,6 @@ type OnClickOrKeyboardEvent =
|
|
|
15
15
|
| React.MouseEvent<HTMLButtonElement>
|
|
16
16
|
| React.KeyboardEvent<HTMLInputElement>;
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* @private
|
|
20
|
-
*/
|
|
21
18
|
export interface HrefProps {
|
|
22
19
|
href: string;
|
|
23
20
|
linkClassName?: string | undefined;
|
|
@@ -30,17 +27,11 @@ type HttpMethod =
|
|
|
30
27
|
| "PATCH" | "patch"
|
|
31
28
|
| "DELETE" | "delete";
|
|
32
29
|
|
|
33
|
-
/**
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
30
|
export interface MethodProps extends HrefProps {
|
|
37
31
|
confirm?: string | undefined;
|
|
38
32
|
method: HttpMethod;
|
|
39
33
|
}
|
|
40
34
|
|
|
41
|
-
/**
|
|
42
|
-
* @private
|
|
43
|
-
*/
|
|
44
35
|
export interface OnClickProps {
|
|
45
36
|
confirm?: string | undefined;
|
|
46
37
|
onClick: OnClickHandler;
|
package/docs/.nojekyll
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
package/docs/assets/hierarchy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
window.hierarchyData = "eJyVkrFuwyAQht/lZtIWxziWtzRS1KVqh25VBsu+yCiYq4CoQ+R378VDiqJYgoUB7uf7juMCjih4aL5lUYpNdRDg8GiwC5osb19A1dfVtiNCA1/U+vDp6MeDgJO2PTSFqgScneFTbQO6Y9uhf/4vfBrCaLi6M63nCyH4fnVNrm7VMAnYVPeUFEDC3Xw4aNM7tNyjqg/M4k4j2J5s2P6ipxFTGrsvz1WQazk7rGXksCOH2/nJX88hkE0ReZjJtikrISslZK1E8VLMZmU8ipjwxj8jxexhJu0bsMsC/B3DQH0uPkolCtRLAh92Z3R3yjWIY2kKPIcFhT25MZd/y6TAp+kPKrFfRA=="
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--light-hl-0: #AF00DB;
|
|
3
|
-
--dark-hl-0: #C586C0;
|
|
4
|
-
--light-hl-1: #000000;
|
|
5
|
-
--dark-hl-1: #D4D4D4;
|
|
6
|
-
--light-hl-2: #0000FF;
|
|
7
|
-
--dark-hl-2: #569CD6;
|
|
8
|
-
--light-hl-3: #A31515;
|
|
9
|
-
--dark-hl-3: #CE9178;
|
|
10
|
-
--light-hl-4: #795E26;
|
|
11
|
-
--dark-hl-4: #DCDCAA;
|
|
12
|
-
--light-hl-5: #001080;
|
|
13
|
-
--dark-hl-5: #9CDCFE;
|
|
14
|
-
--light-hl-6: #800000;
|
|
15
|
-
--dark-hl-6: #808080;
|
|
16
|
-
--light-hl-7: #800000;
|
|
17
|
-
--dark-hl-7: #569CD6;
|
|
18
|
-
--light-hl-8: #E50000;
|
|
19
|
-
--dark-hl-8: #9CDCFE;
|
|
20
|
-
--light-hl-9: #0000FF;
|
|
21
|
-
--dark-hl-9: #CE9178;
|
|
22
|
-
--light-hl-10: #0451A5;
|
|
23
|
-
--dark-hl-10: #9CDCFE;
|
|
24
|
-
--light-code-background: #FFFFFF;
|
|
25
|
-
--dark-code-background: #1E1E1E;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@media (prefers-color-scheme: light) { :root {
|
|
29
|
-
--hl-0: var(--light-hl-0);
|
|
30
|
-
--hl-1: var(--light-hl-1);
|
|
31
|
-
--hl-2: var(--light-hl-2);
|
|
32
|
-
--hl-3: var(--light-hl-3);
|
|
33
|
-
--hl-4: var(--light-hl-4);
|
|
34
|
-
--hl-5: var(--light-hl-5);
|
|
35
|
-
--hl-6: var(--light-hl-6);
|
|
36
|
-
--hl-7: var(--light-hl-7);
|
|
37
|
-
--hl-8: var(--light-hl-8);
|
|
38
|
-
--hl-9: var(--light-hl-9);
|
|
39
|
-
--hl-10: var(--light-hl-10);
|
|
40
|
-
--code-background: var(--light-code-background);
|
|
41
|
-
} }
|
|
42
|
-
|
|
43
|
-
@media (prefers-color-scheme: dark) { :root {
|
|
44
|
-
--hl-0: var(--dark-hl-0);
|
|
45
|
-
--hl-1: var(--dark-hl-1);
|
|
46
|
-
--hl-2: var(--dark-hl-2);
|
|
47
|
-
--hl-3: var(--dark-hl-3);
|
|
48
|
-
--hl-4: var(--dark-hl-4);
|
|
49
|
-
--hl-5: var(--dark-hl-5);
|
|
50
|
-
--hl-6: var(--dark-hl-6);
|
|
51
|
-
--hl-7: var(--dark-hl-7);
|
|
52
|
-
--hl-8: var(--dark-hl-8);
|
|
53
|
-
--hl-9: var(--dark-hl-9);
|
|
54
|
-
--hl-10: var(--dark-hl-10);
|
|
55
|
-
--code-background: var(--dark-code-background);
|
|
56
|
-
} }
|
|
57
|
-
|
|
58
|
-
:root[data-theme='light'] {
|
|
59
|
-
--hl-0: var(--light-hl-0);
|
|
60
|
-
--hl-1: var(--light-hl-1);
|
|
61
|
-
--hl-2: var(--light-hl-2);
|
|
62
|
-
--hl-3: var(--light-hl-3);
|
|
63
|
-
--hl-4: var(--light-hl-4);
|
|
64
|
-
--hl-5: var(--light-hl-5);
|
|
65
|
-
--hl-6: var(--light-hl-6);
|
|
66
|
-
--hl-7: var(--light-hl-7);
|
|
67
|
-
--hl-8: var(--light-hl-8);
|
|
68
|
-
--hl-9: var(--light-hl-9);
|
|
69
|
-
--hl-10: var(--light-hl-10);
|
|
70
|
-
--code-background: var(--light-code-background);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
:root[data-theme='dark'] {
|
|
74
|
-
--hl-0: var(--dark-hl-0);
|
|
75
|
-
--hl-1: var(--dark-hl-1);
|
|
76
|
-
--hl-2: var(--dark-hl-2);
|
|
77
|
-
--hl-3: var(--dark-hl-3);
|
|
78
|
-
--hl-4: var(--dark-hl-4);
|
|
79
|
-
--hl-5: var(--dark-hl-5);
|
|
80
|
-
--hl-6: var(--dark-hl-6);
|
|
81
|
-
--hl-7: var(--dark-hl-7);
|
|
82
|
-
--hl-8: var(--dark-hl-8);
|
|
83
|
-
--hl-9: var(--dark-hl-9);
|
|
84
|
-
--hl-10: var(--dark-hl-10);
|
|
85
|
-
--code-background: var(--dark-code-background);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.hl-0 { color: var(--hl-0); }
|
|
89
|
-
.hl-1 { color: var(--hl-1); }
|
|
90
|
-
.hl-2 { color: var(--hl-2); }
|
|
91
|
-
.hl-3 { color: var(--hl-3); }
|
|
92
|
-
.hl-4 { color: var(--hl-4); }
|
|
93
|
-
.hl-5 { color: var(--hl-5); }
|
|
94
|
-
.hl-6 { color: var(--hl-6); }
|
|
95
|
-
.hl-7 { color: var(--hl-7); }
|
|
96
|
-
.hl-8 { color: var(--hl-8); }
|
|
97
|
-
.hl-9 { color: var(--hl-9); }
|
|
98
|
-
.hl-10 { color: var(--hl-10); }
|
|
99
|
-
pre, code { background: var(--code-background); }
|