@xyo-network/react-chain-shared 1.3.3 → 1.3.5

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.
@@ -2,15 +2,26 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/components/menu-item/ActiveMenuItem.tsx
5
- import { MenuItem, styled } from "@mui/material";
5
+ import { MenuItem, styled, useTheme } from "@mui/material";
6
6
  import React from "react";
7
7
  var ActiveMenuItem = /* @__PURE__ */ __name(({ active, children, sx, ...props }) => {
8
+ const theme = useTheme();
8
9
  return /* @__PURE__ */ React.createElement(StyledMenuItem, {
9
10
  disableRipple: true,
10
11
  sx: {
11
- borderLeft: /* @__PURE__ */ __name((theme) => `5px solid ${active ? theme.palette.secondary.light : "transparent"}`, "borderLeft"),
12
- backgroundColor: /* @__PURE__ */ __name((theme) => active ? theme.palette.secondary.dark : "transparent", "backgroundColor"),
13
- color: active ? "white" : "inherit",
12
+ // left border color and background color for active state
13
+ "borderLeft": `5px solid ${active ? theme.vars.palette.secondary.light : "transparent"}`,
14
+ "backgroundColor": active ? theme.vars.palette.secondary.dark : "transparent",
15
+ // force white text color for active state for improved readability with background color
16
+ "color": active ? "white" : "unset",
17
+ "&:hover": {
18
+ // overriding default hover color and backgroundColor since active state conflicts visually with
19
+ // default styles of MenuItem hover
20
+ ...active ? {
21
+ backgroundColor: theme.vars.palette.secondary.dark
22
+ } : {},
23
+ color: active ? "white" : "unset"
24
+ },
14
25
  ...sx
15
26
  },
16
27
  ...props
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/menu-item/ActiveMenuItem.tsx"],"sourcesContent":["import type { MenuItemProps, Theme } from '@mui/material'\nimport { MenuItem, styled } from '@mui/material'\nimport React from 'react'\n\nexport const ActiveMenuItem: React.FC<MenuItemProps & { active?: boolean }> = ({\n active, children, sx, ...props\n}) => {\n return (\n <StyledMenuItem\n disableRipple\n sx={{\n borderLeft: (theme: Theme) => `5px solid ${active ? theme.palette.secondary.light : 'transparent'}`,\n backgroundColor: (theme: Theme) => active ? theme.palette.secondary.dark : 'transparent',\n color: active ? 'white' : 'inherit',\n ...sx,\n }}\n {...props}\n >\n {children}\n </StyledMenuItem>\n )\n}\n\nconst StyledMenuItem = styled(MenuItem, { name: 'StyledMenuItem' })(({ theme }) => ({\n display: 'flex-inline',\n flexDirection: 'row',\n gap: theme.spacing(1),\n padding: 0,\n paddingLeft: theme.spacing(1),\n marginBottom: theme.spacing(1),\n}))\n"],"mappings":";;;;AACA,SAASA,UAAUC,cAAc;AACjC,OAAOC,WAAW;AAEX,IAAMC,iBAAiE,wBAAC,EAC7EC,QAAQC,UAAUC,IAAI,GAAGC,MAAAA,MAC1B;AACC,SACE,sBAAA,cAACC,gBAAAA;IACCC,eAAAA;IACAH,IAAI;MACFI,YAAY,wBAACC,UAAiB,aAAaP,SAASO,MAAMC,QAAQC,UAAUC,QAAQ,aAAA,IAAxE;MACZC,iBAAiB,wBAACJ,UAAiBP,SAASO,MAAMC,QAAQC,UAAUG,OAAO,eAA1D;MACjBC,OAAOb,SAAS,UAAU;MAC1B,GAAGE;IACL;IACC,GAAGC;KAEHF,QAAAA;AAGP,GAjB8E;AAmB9E,IAAMG,iBAAiBU,OAAOC,UAAU;EAAEC,MAAM;AAAiB,CAAA,EAAG,CAAC,EAAET,MAAK,OAAQ;EAClFU,SAAS;EACTC,eAAe;EACfC,KAAKZ,MAAMa,QAAQ,CAAA;EACnBC,SAAS;EACTC,aAAaf,MAAMa,QAAQ,CAAA;EAC3BG,cAAchB,MAAMa,QAAQ,CAAA;AAC9B,EAAA;","names":["MenuItem","styled","React","ActiveMenuItem","active","children","sx","props","StyledMenuItem","disableRipple","borderLeft","theme","palette","secondary","light","backgroundColor","dark","color","styled","MenuItem","name","display","flexDirection","gap","spacing","padding","paddingLeft","marginBottom"]}
1
+ {"version":3,"sources":["../../src/components/menu-item/ActiveMenuItem.tsx"],"sourcesContent":["import type { MenuItemProps } from '@mui/material'\nimport {\n MenuItem, styled, useTheme,\n} from '@mui/material'\nimport React from 'react'\n\nexport const ActiveMenuItem: React.FC<MenuItemProps & { active?: boolean }> = ({\n active, children, sx, ...props\n}) => {\n const theme = useTheme()\n return (\n <StyledMenuItem\n disableRipple\n sx={{\n // left border color and background color for active state\n 'borderLeft': `5px solid ${active ? theme.vars.palette.secondary.light : 'transparent'}`,\n 'backgroundColor': active ? theme.vars.palette.secondary.dark : 'transparent',\n // force white text color for active state for improved readability with background color\n 'color': active ? 'white' : 'unset',\n '&:hover': {\n // overriding default hover color and backgroundColor since active state conflicts visually with\n // default styles of MenuItem hover\n ...(active ? { backgroundColor: theme.vars.palette.secondary.dark } : {}),\n color: active ? 'white' : 'unset',\n },\n ...sx,\n }}\n {...props}\n >\n {children}\n </StyledMenuItem>\n )\n}\n\nconst StyledMenuItem = styled(MenuItem, { name: 'StyledMenuItem' })(({ theme }) => ({\n display: 'flex-inline',\n flexDirection: 'row',\n gap: theme.spacing(1),\n padding: 0,\n paddingLeft: theme.spacing(1),\n marginBottom: theme.spacing(1),\n}))\n"],"mappings":";;;;AACA,SACEA,UAAUC,QAAQC,gBACb;AACP,OAAOC,WAAW;AAEX,IAAMC,iBAAiE,wBAAC,EAC7EC,QAAQC,UAAUC,IAAI,GAAGC,MAAAA,MAC1B;AACC,QAAMC,QAAQC,SAAAA;AACd,SACE,sBAAA,cAACC,gBAAAA;IACCC,eAAAA;IACAL,IAAI;;MAEF,cAAc,aAAaF,SAASI,MAAMI,KAAKC,QAAQC,UAAUC,QAAQ,aAAA;MACzE,mBAAmBX,SAASI,MAAMI,KAAKC,QAAQC,UAAUE,OAAO;;MAEhE,SAASZ,SAAS,UAAU;MAC5B,WAAW;;;QAGT,GAAIA,SAAS;UAAEa,iBAAiBT,MAAMI,KAAKC,QAAQC,UAAUE;QAAK,IAAI,CAAC;QACvEE,OAAOd,SAAS,UAAU;MAC5B;MACA,GAAGE;IACL;IACC,GAAGC;KAEHF,QAAAA;AAGP,GA1B8E;AA4B9E,IAAMK,iBAAiBS,OAAOC,UAAU;EAAEC,MAAM;AAAiB,CAAA,EAAG,CAAC,EAAEb,MAAK,OAAQ;EAClFc,SAAS;EACTC,eAAe;EACfC,KAAKhB,MAAMiB,QAAQ,CAAA;EACnBC,SAAS;EACTC,aAAanB,MAAMiB,QAAQ,CAAA;EAC3BG,cAAcpB,MAAMiB,QAAQ,CAAA;AAC9B,EAAA;","names":["MenuItem","styled","useTheme","React","ActiveMenuItem","active","children","sx","props","theme","useTheme","StyledMenuItem","disableRipple","vars","palette","secondary","light","dark","backgroundColor","color","styled","MenuItem","name","display","flexDirection","gap","spacing","padding","paddingLeft","marginBottom"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ActiveMenuItem.d.ts","sourceRoot":"","sources":["../../../../src/components/menu-item/ActiveMenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAS,MAAM,eAAe,CAAA;AAEzD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAiBzE,CAAA"}
1
+ {"version":3,"file":"ActiveMenuItem.d.ts","sourceRoot":"","sources":["../../../../src/components/menu-item/ActiveMenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAIlD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CA0BzE,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/react-chain-shared",
4
- "version": "1.3.3",
4
+ "version": "1.3.5",
5
5
  "description": "XYO Layer One React SDK",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -42,8 +42,8 @@
42
42
  "@emotion/styled": "^11.14.0",
43
43
  "@mui/material": "^7.0.2",
44
44
  "@types/react": "^19.1.2",
45
- "@xylabs/ts-scripts-yarn3": "^6.3.4",
46
- "@xylabs/tsconfig-react": "^6.3.4",
45
+ "@xylabs/ts-scripts-yarn3": "^6.3.5",
46
+ "@xylabs/tsconfig-react": "^6.3.5",
47
47
  "react": "^19.1.0",
48
48
  "react-dom": "^19.1.0",
49
49
  "typescript": "^5.8.3"
@@ -1,17 +1,28 @@
1
- import type { MenuItemProps, Theme } from '@mui/material'
2
- import { MenuItem, styled } from '@mui/material'
1
+ import type { MenuItemProps } from '@mui/material'
2
+ import {
3
+ MenuItem, styled, useTheme,
4
+ } from '@mui/material'
3
5
  import React from 'react'
4
6
 
5
7
  export const ActiveMenuItem: React.FC<MenuItemProps & { active?: boolean }> = ({
6
8
  active, children, sx, ...props
7
9
  }) => {
10
+ const theme = useTheme()
8
11
  return (
9
12
  <StyledMenuItem
10
13
  disableRipple
11
14
  sx={{
12
- borderLeft: (theme: Theme) => `5px solid ${active ? theme.palette.secondary.light : 'transparent'}`,
13
- backgroundColor: (theme: Theme) => active ? theme.palette.secondary.dark : 'transparent',
14
- color: active ? 'white' : 'inherit',
15
+ // left border color and background color for active state
16
+ 'borderLeft': `5px solid ${active ? theme.vars.palette.secondary.light : 'transparent'}`,
17
+ 'backgroundColor': active ? theme.vars.palette.secondary.dark : 'transparent',
18
+ // force white text color for active state for improved readability with background color
19
+ 'color': active ? 'white' : 'unset',
20
+ '&:hover': {
21
+ // overriding default hover color and backgroundColor since active state conflicts visually with
22
+ // default styles of MenuItem hover
23
+ ...(active ? { backgroundColor: theme.vars.palette.secondary.dark } : {}),
24
+ color: active ? 'white' : 'unset',
25
+ },
15
26
  ...sx,
16
27
  }}
17
28
  {...props}
@@ -0,0 +1 @@
1
+ import type {} from '@mui/material/themeCssVarsAugmentation'