@unitedstatespowersquadrons/components 1.2.6-pre.9 → 1.2.7-pre.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.
@@ -108,7 +108,7 @@ const BaseActionButton = (props: BaseActionButtonProps) => {
108
108
  target={newTab ? "_blank" : undefined}
109
109
  title={title}
110
110
  >
111
- <button className={classNames("action-button", classes.button, className)} type="button">
111
+ <button className={classNames("action-button", classes.button, className)} tabIndex={-1} type="button">
112
112
  {children}
113
113
  </button>
114
114
  </a>
@@ -1,6 +1,7 @@
1
1
  import React, { createContext, useContext, useMemo } from "react";
2
2
  import { Draft, produce } from "immer";
3
3
  import { useImmerReducer } from "use-immer";
4
+ import ActionCable, { Cable } from "actioncable";
4
5
  import { ReducerHandler } from "./types";
5
6
 
6
7
  interface InitialAppProps<AppState> {
@@ -10,10 +11,14 @@ interface InitialAppProps<AppState> {
10
11
 
11
12
  export default function buildReducer<AppState, AppAction>(
12
13
  reducer: (draft: Draft<AppState>, action: AppAction) => void,
13
- handlers: ReducerHandler<AppAction>[] = []
14
+ handlers: ReducerHandler<AppAction>[] = [],
15
+ actionCableUrl?: string
14
16
  ) {
15
17
  const StateContext = createContext<AppState | null>(null);
16
18
  const DispatchContext = createContext<React.Dispatch<AppAction> | null>(null);
19
+ const CableContext = createContext<Cable | null>(null);
20
+
21
+ const cable = actionCableUrl ? ActionCable.createConsumer(actionCableUrl) : null;
17
22
 
18
23
  function AppProvider(props: InitialAppProps<AppState>) {
19
24
  const [providerState, dispatch] = useImmerReducer(reducer, props.initialState, (state: AppState) => {
@@ -30,9 +35,11 @@ export default function buildReducer<AppState, AppAction>(
30
35
 
31
36
  return (
32
37
  <StateContext.Provider value={providerState}>
33
- <DispatchContext.Provider value={wrappedDispatch}>
34
- {props.children}
35
- </DispatchContext.Provider>
38
+ <CableContext.Provider value={cable}>
39
+ <DispatchContext.Provider value={wrappedDispatch}>
40
+ {props.children}
41
+ </DispatchContext.Provider>
42
+ </CableContext.Provider>
36
43
  </StateContext.Provider>
37
44
  );
38
45
  }
package/Styles.tsx CHANGED
@@ -30,9 +30,7 @@ const colorizeButton = (color: ButtonColorName) => {
30
30
  const shadow = Colors.button.background.shadow[color];
31
31
 
32
32
  return({
33
- "&:active": {
34
- boxShadow: `0 0 2px 2px ${Colors.button.glow}`,
35
- },
33
+ "&:active": { boxShadow: `0 0 2px 2px ${Colors.button.glow}` },
36
34
  "&:hover": {
37
35
  background: `linear-gradient(180deg, ${shadow} 0%, ${hover} 20%, ${hover} 80%, ${shadow} 100%) !important`,
38
36
  fontWeight: "normal",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.2.6-pre.9",
3
+ "version": "1.2.7-pre.1",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {
@@ -17,6 +17,8 @@
17
17
  },
18
18
  "homepage": "https://github.com/unitedstatespowersquadrons/components#readme",
19
19
  "dependencies": {
20
+ "@rails/actioncable": "^8.0.200",
21
+ "@types/actioncable": "^5.2.11",
20
22
  "classnames": "^2.5.1",
21
23
  "immer": "^10.1.1",
22
24
  "react": "^19.1.0",