@campxdev/react-blueprint 0.1.1 → 0.1.2

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/.env ADDED
@@ -0,0 +1 @@
1
+ REACT_APP_API_HOST=http://localhost:3000
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "0.1.1",
4
- "publishConfig": {
5
- "access": "public"
6
- },
3
+ "version": "0.1.2",
4
+ "main":"./export.ts",
5
+ "private": false,
7
6
  "dependencies": {
8
7
  "@emotion/react": "^11.11.4",
9
8
  "@emotion/styled": "^11.11.5",
@@ -1,4 +1,5 @@
1
1
  import {
2
+ Box,
2
3
  CircularProgress,
3
4
  Autocomplete as MuiAutocomplete,
4
5
  TextField,
@@ -6,6 +7,8 @@ import {
6
7
  import axios from "axios";
7
8
  import { useReducer } from "react";
8
9
  import { campxAxios } from "../../../utils/campxAxios";
10
+ import { Typography } from "../../Typography/Typography";
11
+ import { OptionContainer } from "../styles";
9
12
 
10
13
  function sleep(duration: number): Promise<void> {
11
14
  return new Promise<void>((resolve) => {
@@ -91,7 +94,7 @@ const singleSelectReducer = (
91
94
  return { ...state, open: true };
92
95
  }
93
96
  case SingleSelectActionsTypes.CLOSE: {
94
- return { ...state, open: false };
97
+ return { ...state, open: false, loadingInternalOptions: false };
95
98
  }
96
99
  case SingleSelectActionsTypes.LOAD_INTERNAL_OPTIONS_START: {
97
100
  return { ...state, loadingInternalOptions: true };
@@ -135,14 +138,13 @@ export const SingleSelect = ({
135
138
  params: {
136
139
  limit: 10,
137
140
  offset: 0,
138
- skip: 0,
139
141
  },
140
142
  })
141
143
  .then((res) => res.data);
142
144
  dispatch({
143
145
  actionType: SingleSelectActionsTypes.SET_INTERNAL_OPTIONS,
144
146
  stateChanges: {
145
- options,
147
+ internalOptions: options,
146
148
  loadingInternalOptions: false,
147
149
  },
148
150
  });
@@ -180,6 +182,16 @@ export const SingleSelect = ({
180
182
  }}
181
183
  />
182
184
  )}
185
+ renderOption={(props, option: any) => {
186
+ return (
187
+ <Box component="li" {...props}>
188
+ <OptionContainer>
189
+ <Typography variant="label1">{option.label}</Typography>
190
+ <Typography variant="caption">{option?.subLabel}</Typography>
191
+ </OptionContainer>
192
+ </Box>
193
+ );
194
+ }}
183
195
  onOpen={handleOpen}
184
196
  onClose={() => {
185
197
  dispatch({
@@ -0,0 +1,6 @@
1
+ import { Box, styled } from "@mui/material";
2
+
3
+ export const OptionContainer = styled(Box)(({ theme }) => ({
4
+ display: "flex",
5
+ flexDirection: "column",
6
+ }));
@@ -1,8 +1,10 @@
1
1
  import axios from "axios";
2
2
  import Cookies from "js-cookie";
3
3
 
4
- const tenantCode = window.location.pathname.split("/")[1] ?? "campx";
5
- const institutionCode = window.location.pathname.split("/")[2] ?? "campx";
4
+ console.log(window.location.pathname.split("/"));
5
+
6
+ const tenantCode = "campx";
7
+ const institutionCode = "campx";
6
8
  const sessionKey = Cookies.get("campx_session_key");
7
9
  const isProduction = process.env.NODE_ENV === "production";
8
10
 
@@ -11,7 +13,9 @@ export const campxAxios = axios.create({
11
13
  withCredentials: true,
12
14
  headers: {
13
15
  "x-tenant-id": tenantCode,
14
- ...(!isProduction && sessionKey ? { campx_session_key: sessionKey } : {}),
16
+ ...(!isProduction
17
+ ? { campx_session_key: sessionKey || "6653ed32f34cbc245f22e7c8" }
18
+ : {}),
15
19
  "x-institution-id": institutionCode,
16
20
  },
17
21
  });