@smartbooks-ai/layout 0.0.3 → 0.0.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.
Files changed (149) hide show
  1. package/dist/components/PageHeader/PageHeader.d.ts +6 -0
  2. package/dist/components/PageHeader/PageHeader.d.ts.map +1 -0
  3. package/dist/components/PageHeader/PageHeader.js +4 -0
  4. package/dist/components/PageHeader/index.d.ts +2 -0
  5. package/dist/components/PageHeader/index.d.ts.map +1 -0
  6. package/dist/components/PageHeader/index.js +1 -0
  7. package/dist/components/PageHeader/styles.d.ts +9 -0
  8. package/dist/components/PageHeader/styles.d.ts.map +1 -0
  9. package/dist/components/PageHeader/styles.js +28 -0
  10. package/dist/components/PageWithMenuLayout/AppSelect/index.d.ts +12 -0
  11. package/dist/components/PageWithMenuLayout/AppSelect/index.d.ts.map +1 -0
  12. package/dist/components/PageWithMenuLayout/AppSelect/index.js +27 -0
  13. package/dist/components/PageWithMenuLayout/AppSelect/styles.d.ts +10 -0
  14. package/dist/components/PageWithMenuLayout/AppSelect/styles.d.ts.map +1 -0
  15. package/dist/components/PageWithMenuLayout/AppSelect/styles.js +27 -0
  16. package/dist/components/PageWithMenuLayout/LogoHeaderImage.d.ts +4 -0
  17. package/dist/components/PageWithMenuLayout/LogoHeaderImage.d.ts.map +1 -0
  18. package/dist/components/PageWithMenuLayout/LogoHeaderImage.js +3 -0
  19. package/dist/components/PageWithMenuLayout/LogoHeaderText.d.ts +4 -0
  20. package/dist/components/PageWithMenuLayout/LogoHeaderText.d.ts.map +1 -0
  21. package/dist/components/PageWithMenuLayout/LogoHeaderText.js +3 -0
  22. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/MenuItemWithChildren.d.ts +13 -0
  23. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/MenuItemWithChildren.d.ts.map +1 -0
  24. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/MenuItemWithChildren.js +49 -0
  25. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/styles.d.ts +53 -0
  26. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/styles.d.ts.map +1 -0
  27. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/styles.js +127 -0
  28. package/dist/components/PageWithMenuLayout/MenuSelect/index.d.ts +12 -0
  29. package/dist/components/PageWithMenuLayout/MenuSelect/index.d.ts.map +1 -0
  30. package/dist/components/PageWithMenuLayout/MenuSelect/index.js +24 -0
  31. package/dist/components/PageWithMenuLayout/MenuSelect/styles.d.ts +22 -0
  32. package/dist/components/PageWithMenuLayout/MenuSelect/styles.d.ts.map +1 -0
  33. package/dist/components/PageWithMenuLayout/MenuSelect/styles.js +84 -0
  34. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/ConsolidationIcon.d.ts +3 -0
  35. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/ConsolidationIcon.d.ts.map +1 -0
  36. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/ConsolidationIcon.js +3 -0
  37. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/MultiSubscriptionsMenuItems.d.ts +10 -0
  38. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/MultiSubscriptionsMenuItems.d.ts.map +1 -0
  39. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/MultiSubscriptionsMenuItems.js +40 -0
  40. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/index.d.ts +2 -0
  41. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/index.d.ts.map +1 -0
  42. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/index.js +1 -0
  43. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/styles.d.ts +5 -0
  44. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/styles.d.ts.map +1 -0
  45. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/styles.js +9 -0
  46. package/dist/components/PageWithMenuLayout/PageWithMenuLayout.d.ts +15 -0
  47. package/dist/components/PageWithMenuLayout/PageWithMenuLayout.d.ts.map +1 -0
  48. package/dist/components/PageWithMenuLayout/PageWithMenuLayout.js +15 -0
  49. package/dist/components/PageWithMenuLayout/UserProfileSelect/index.d.ts +9 -0
  50. package/dist/components/PageWithMenuLayout/UserProfileSelect/index.d.ts.map +1 -0
  51. package/dist/components/PageWithMenuLayout/UserProfileSelect/index.js +16 -0
  52. package/dist/components/PageWithMenuLayout/UserProfileSelect/styles.d.ts +4 -0
  53. package/dist/components/PageWithMenuLayout/UserProfileSelect/styles.d.ts.map +1 -0
  54. package/dist/components/PageWithMenuLayout/UserProfileSelect/styles.js +7 -0
  55. package/dist/components/PageWithMenuLayout/index.d.ts +9 -0
  56. package/dist/components/PageWithMenuLayout/index.d.ts.map +1 -0
  57. package/dist/components/PageWithMenuLayout/index.js +8 -0
  58. package/dist/components/PageWithMenuLayout/styles.d.ts +33 -0
  59. package/dist/components/PageWithMenuLayout/styles.d.ts.map +1 -0
  60. package/dist/components/PageWithMenuLayout/styles.js +91 -0
  61. package/dist/components/PageWithMenuLayout/types.d.ts +13 -0
  62. package/dist/components/PageWithMenuLayout/types.d.ts.map +1 -0
  63. package/dist/components/PageWithMenuLayout/types.js +1 -0
  64. package/dist/components/PageWithMenuLayout/useMenuToggle.d.ts +6 -0
  65. package/dist/components/PageWithMenuLayout/useMenuToggle.d.ts.map +1 -0
  66. package/dist/components/PageWithMenuLayout/useMenuToggle.js +13 -0
  67. package/dist/components/index.d.ts +4 -0
  68. package/dist/components/index.d.ts.map +1 -0
  69. package/dist/components/index.js +3 -0
  70. package/dist/hooks/index.d.ts +3 -0
  71. package/dist/hooks/index.d.ts.map +1 -0
  72. package/dist/hooks/index.js +2 -0
  73. package/dist/hooks/useIsAuthorized.d.ts +13 -0
  74. package/dist/hooks/useIsAuthorized.d.ts.map +1 -0
  75. package/dist/hooks/useIsAuthorized.js +15 -0
  76. package/dist/hooks/useToggle.d.ts +10 -0
  77. package/dist/hooks/useToggle.d.ts.map +1 -0
  78. package/dist/hooks/useToggle.js +17 -0
  79. package/dist/index.d.ts +7 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +6 -0
  82. package/dist/package-isolation.test.d.ts +2 -0
  83. package/dist/package-isolation.test.d.ts.map +1 -0
  84. package/dist/package-isolation.test.js +47 -0
  85. package/dist/security/AuthorizedContent/index.d.ts +18 -0
  86. package/dist/security/AuthorizedContent/index.d.ts.map +1 -0
  87. package/dist/security/AuthorizedContent/index.js +41 -0
  88. package/dist/security/AuthorizedContent/state.d.ts +9 -0
  89. package/dist/security/AuthorizedContent/state.d.ts.map +1 -0
  90. package/dist/security/AuthorizedContent/state.js +9 -0
  91. package/dist/security/AuthorizedContent/useAuthorizationState.d.ts +12 -0
  92. package/dist/security/AuthorizedContent/useAuthorizationState.d.ts.map +1 -0
  93. package/dist/security/AuthorizedContent/useAuthorizationState.js +22 -0
  94. package/dist/security/ProfileContext/ProfileContext.d.ts +22 -0
  95. package/dist/security/ProfileContext/ProfileContext.d.ts.map +1 -0
  96. package/dist/security/ProfileContext/ProfileContext.js +11 -0
  97. package/dist/security/ProfileContext/index.d.ts +5 -0
  98. package/dist/security/ProfileContext/index.d.ts.map +1 -0
  99. package/dist/security/ProfileContext/index.js +4 -0
  100. package/dist/security/ProfileContext/types.d.ts +8 -0
  101. package/dist/security/ProfileContext/types.d.ts.map +1 -0
  102. package/dist/security/ProfileContext/types.js +8 -0
  103. package/dist/security/ProfileContext/useProfile.d.ts +2 -0
  104. package/dist/security/ProfileContext/useProfile.d.ts.map +1 -0
  105. package/dist/security/ProfileContext/useProfile.js +5 -0
  106. package/dist/security/UserProfile.d.ts +12 -0
  107. package/dist/security/UserProfile.d.ts.map +1 -0
  108. package/dist/security/UserProfile.js +25 -0
  109. package/dist/security/index.d.ts +3 -0
  110. package/dist/security/index.d.ts.map +1 -0
  111. package/dist/security/index.js +2 -0
  112. package/dist/theme/colorPrimitives.d.ts +3 -0
  113. package/dist/theme/colorPrimitives.d.ts.map +1 -0
  114. package/dist/theme/colorPrimitives.js +105 -0
  115. package/dist/theme/colors.d.ts +3 -0
  116. package/dist/theme/colors.d.ts.map +1 -0
  117. package/dist/theme/colors.js +75 -0
  118. package/dist/theme/font.d.ts +4 -0
  119. package/dist/theme/font.d.ts.map +1 -0
  120. package/dist/theme/font.js +24 -0
  121. package/dist/theme/globalStyles.d.ts +2 -0
  122. package/dist/theme/globalStyles.d.ts.map +1 -0
  123. package/dist/theme/globalStyles.js +50 -0
  124. package/dist/theme/index.d.ts +2 -0
  125. package/dist/theme/index.d.ts.map +1 -0
  126. package/dist/theme/index.js +197 -0
  127. package/dist/theme/radius.d.ts +3 -0
  128. package/dist/theme/radius.d.ts.map +1 -0
  129. package/dist/theme/radius.js +10 -0
  130. package/dist/theme/spacing.d.ts +3 -0
  131. package/dist/theme/spacing.d.ts.map +1 -0
  132. package/dist/theme/spacing.js +10 -0
  133. package/dist/theme/typography.d.ts +4 -0
  134. package/dist/theme/typography.d.ts.map +1 -0
  135. package/dist/theme/typography.js +32 -0
  136. package/dist/utils/assertNever.d.ts +15 -0
  137. package/dist/utils/assertNever.d.ts.map +1 -0
  138. package/dist/utils/assertNever.js +14 -0
  139. package/dist/utils/index.d.ts +3 -0
  140. package/dist/utils/index.d.ts.map +1 -0
  141. package/dist/utils/index.js +2 -0
  142. package/dist/utils/shouldNotForwardPropsWithKeys.d.ts +3 -0
  143. package/dist/utils/shouldNotForwardPropsWithKeys.d.ts.map +1 -0
  144. package/dist/utils/shouldNotForwardPropsWithKeys.js +3 -0
  145. package/package.json +8 -4
  146. package/src/components/PageWithMenuLayout/PageWithMenuLayout.tsx +3 -6
  147. package/src/components/PageWithMenuLayout/useMenuToggle.ts +19 -0
  148. package/tsconfig.layout.tsbuildinfo +1 -1
  149. package/package/tsconfig.layout.tsbuildinfo +0 -1
@@ -0,0 +1,197 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { ThemeProvider as EmotionThemeProvider, css } from '@emotion/react';
4
+ import ExpandedMoreRoundedIcon from '@mui/icons-material/ExpandMoreRounded';
5
+ import { listItemTextClasses } from '@mui/material';
6
+ import { buttonClasses } from '@mui/material/Button';
7
+ import CssBaseline from '@mui/material/CssBaseline';
8
+ import { ThemeProvider as MUIThemeProvider, StyledEngineProvider, createTheme, } from '@mui/material/styles';
9
+ import { rem } from 'polished';
10
+ import { Link as RouterLink } from 'react-router';
11
+ import { colorPrimitives } from './colorPrimitives';
12
+ import { colors } from './colors';
13
+ import { font } from './font';
14
+ import GlobalStyles from './globalStyles';
15
+ import { radius } from './radius';
16
+ import { spacing } from './spacing';
17
+ import typography from './typography';
18
+ const LinkBehavior = forwardRef(({ href, ...other }, ref) => _jsx(RouterLink, { ref: ref, to: href, ...other }));
19
+ const muiTextField = {
20
+ defaultProps: {
21
+ variant: 'outlined',
22
+ margin: 'normal',
23
+ size: 'small',
24
+ InputLabelProps: { shrink: true },
25
+ SelectProps: { displayEmpty: true },
26
+ },
27
+ };
28
+ const muiOutlinedInput = {
29
+ styleOverrides: {
30
+ notchedOutline: css `
31
+ border-color: ${colorPrimitives.darkNavy[100]};
32
+ `,
33
+ },
34
+ };
35
+ const muiTheme = {
36
+ shape: { borderRadius: 6 },
37
+ typography,
38
+ components: {
39
+ MuiCssBaseline: {
40
+ styleOverrides: {
41
+ a: css `
42
+ color: '#000000';
43
+
44
+ text-decoration: none;
45
+ `,
46
+ },
47
+ },
48
+ MuiAccordionDetails: {
49
+ styleOverrides: {
50
+ root: css `
51
+ display: flex;
52
+
53
+ flex-direction: column;
54
+
55
+ row-gap: ${spacing.xxs};
56
+ `,
57
+ },
58
+ },
59
+ MuiDialogContent: {
60
+ styleOverrides: {
61
+ root: css `
62
+ display: flex;
63
+
64
+ flex-direction: column;
65
+
66
+ row-gap: ${spacing.sm};
67
+
68
+ min-width: 30rem;
69
+ `,
70
+ },
71
+ },
72
+ MuiCheckbox: {
73
+ defaultProps: {
74
+ size: 'small',
75
+ },
76
+ },
77
+ MuiFormControlLabel: {
78
+ styleOverrides: {
79
+ label: css `
80
+ overflow: hidden;
81
+ text-overflow: ellipsis;
82
+
83
+ font: ${font.body2};
84
+
85
+ white-space: nowrap;
86
+ `,
87
+ },
88
+ },
89
+ MuiInputBase: {
90
+ defaultProps: {
91
+ disableInjectingGlobalStyles: true,
92
+ },
93
+ },
94
+ MuiTextField: muiTextField,
95
+ MuiPickersTextField: muiTextField,
96
+ MuiAccordion: {
97
+ defaultProps: {
98
+ elevation: 3,
99
+ slotProps: { transition: { unmountOnExit: true } },
100
+ },
101
+ },
102
+ MuiAccordionSummary: {
103
+ defaultProps: {
104
+ expandIcon: _jsx(ExpandedMoreRoundedIcon, {}),
105
+ },
106
+ },
107
+ MuiLink: {
108
+ defaultProps: {
109
+ component: LinkBehavior,
110
+ },
111
+ styleOverrides: {
112
+ root: ({ theme }) => css `
113
+ color: ${theme.palette.primary.main};
114
+
115
+ text-decoration-color: inherit;
116
+ text-underline-offset: 0.25rem;
117
+
118
+ &:hover {
119
+ color: ${theme.palette.primary.dark};
120
+ }
121
+ `,
122
+ },
123
+ },
124
+ MuiOutlinedInput: muiOutlinedInput,
125
+ MuiPickersOutlinedInput: muiOutlinedInput,
126
+ MuiButtonGroup: {
127
+ defaultProps: {
128
+ disableRipple: true,
129
+ },
130
+ },
131
+ MuiMenuItem: {
132
+ styleOverrides: {
133
+ root: css `
134
+ font: ${font.body3};
135
+ `,
136
+ },
137
+ },
138
+ MuiButtonBase: {
139
+ styleOverrides: {
140
+ root: css `
141
+ &.${buttonClasses.outlined} {
142
+ border: 0.0625rem solid ${colorPrimitives.darkNavy[100]};
143
+
144
+ &:hover {
145
+ /* For button groups - we should bring the border of hovered button in front of the other ones */
146
+ z-index: 1;
147
+
148
+ background: none;
149
+ border: 0.0625rem solid ${colorPrimitives.darkNavy[800]};
150
+ }
151
+ }
152
+ `,
153
+ },
154
+ defaultProps: {
155
+ disableRipple: true,
156
+ LinkComponent: LinkBehavior,
157
+ type: 'button',
158
+ },
159
+ },
160
+ MuiTooltip: {
161
+ styleOverrides: {
162
+ tooltip: css `
163
+ font: ${font.body3};
164
+
165
+ line-height: 1.5;
166
+
167
+ letter-spacing: 0.05rem;
168
+
169
+ background-color: ${colorPrimitives.darkNavy[900]};
170
+ `,
171
+ },
172
+ },
173
+ MuiSelect: {
174
+ styleOverrides: {
175
+ select: css `
176
+ .${listItemTextClasses.root} {
177
+ margin-top: ${rem(2)};
178
+ margin-bottom: ${rem(2)};
179
+ }
180
+ `,
181
+ },
182
+ },
183
+ },
184
+ };
185
+ const themeValue = {
186
+ ...muiTheme,
187
+ my: {
188
+ font,
189
+ radius,
190
+ spacing,
191
+ colors,
192
+ },
193
+ };
194
+ const theme = createTheme(themeValue);
195
+ export function ThemeProvider(props) {
196
+ return (_jsx(StyledEngineProvider, { injectFirst: true, children: _jsx(MUIThemeProvider, { theme: theme, children: _jsxs(EmotionThemeProvider, { theme: theme, children: [_jsx(CssBaseline, {}), _jsx(GlobalStyles, {}), props.children] }) }) }));
197
+ }
@@ -0,0 +1,3 @@
1
+ import { Theme } from '@emotion/react';
2
+ export declare const radius: Theme['my']['radius'];
3
+ //# sourceMappingURL=radius.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radius.d.ts","sourceRoot":"","sources":["../../src/theme/radius.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CASxC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export const radius = {
2
+ sq: '0',
3
+ xs: '0.125rem',
4
+ sm: '0.25rem',
5
+ md: '0.5rem',
6
+ lg: '0.75rem',
7
+ xl: '1rem',
8
+ xxl: '1.5rem',
9
+ xxxl: '2rem',
10
+ };
@@ -0,0 +1,3 @@
1
+ import { Theme } from '@emotion/react';
2
+ export declare const spacing: Theme['my']['spacing'];
3
+ //# sourceMappingURL=spacing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../../src/theme/spacing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,CAS1C,CAAC"}
@@ -0,0 +1,10 @@
1
+ export const spacing = {
2
+ xxxs: '0.25rem',
3
+ xxs: '0.5rem',
4
+ xs: '0.75rem',
5
+ sm: '1rem',
6
+ md: '1.5rem',
7
+ lg: '2rem',
8
+ xl: '2.5rem',
9
+ xxl: '3rem',
10
+ };
@@ -0,0 +1,4 @@
1
+ import { TypographyVariantsOptions } from '@mui/material';
2
+ declare const typography: TypographyVariantsOptions;
3
+ export default typography;
4
+ //# sourceMappingURL=typography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/theme/typography.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAgB3E,QAAA,MAAM,UAAU,EAAE,yBAqBjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { FONT_FAMILY, font } from './font';
2
+ const stylesForFont = (fontName) => ({
3
+ font: font[fontName],
4
+ // This is needed to prevent overrides
5
+ fontFamily: undefined,
6
+ fontWeight: undefined,
7
+ fontSize: undefined,
8
+ lineHeight: undefined,
9
+ });
10
+ const typography = {
11
+ fontFamily: FONT_FAMILY,
12
+ fontWeightRegular: 400,
13
+ fontWeightMedium: 600,
14
+ fontWeightBold: 700,
15
+ h1: stylesForFont('h1'),
16
+ h2: stylesForFont('h2'),
17
+ h3: stylesForFont('h3'),
18
+ h4: stylesForFont('h4'),
19
+ h5: stylesForFont('h5'),
20
+ h6: stylesForFont('h6'),
21
+ subtitle1: stylesForFont('subtitle1'),
22
+ subtitle2: stylesForFont('subtitle2'),
23
+ body1: stylesForFont('body1'),
24
+ body2: stylesForFont('body2'),
25
+ caption: stylesForFont('caption'),
26
+ overline: stylesForFont('overline'),
27
+ button: {
28
+ ...stylesForFont('button1'),
29
+ textTransform: 'inherit',
30
+ },
31
+ };
32
+ export default typography;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @example
3
+ * const a: 'one' | 'two' = 'one';
4
+ *
5
+ * switch(a) {
6
+ * case 'one':
7
+ * return 1;
8
+ * case 'two':
9
+ * return 2;
10
+ * default:
11
+ * return assertNever(a); // Works fine, but if we change the type of `a` to `'one' | 'two' | 'three'` then we get an error here
12
+ * }
13
+ */
14
+ export declare const assertNever: (input: never) => never;
15
+ //# sourceMappingURL=assertNever.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertNever.d.ts","sourceRoot":"","sources":["../../src/utils/assertNever.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,KAAG,KAAc,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @example
3
+ * const a: 'one' | 'two' = 'one';
4
+ *
5
+ * switch(a) {
6
+ * case 'one':
7
+ * return 1;
8
+ * case 'two':
9
+ * return 2;
10
+ * default:
11
+ * return assertNever(a); // Works fine, but if we change the type of `a` to `'one' | 'two' | 'three'` then we get an error here
12
+ * }
13
+ */
14
+ export const assertNever = (input) => input;
@@ -0,0 +1,3 @@
1
+ export { assertNever } from './assertNever';
2
+ export { shouldNotForwardPropsWithKeys } from './shouldNotForwardPropsWithKeys';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { assertNever } from './assertNever';
2
+ export { shouldNotForwardPropsWithKeys } from './shouldNotForwardPropsWithKeys';
@@ -0,0 +1,3 @@
1
+ import { StyledOptions } from '@emotion/styled';
2
+ export declare const shouldNotForwardPropsWithKeys: <TCustomProps extends object>(keys: (keyof TCustomProps)[]) => StyledOptions<TCustomProps>;
3
+ //# sourceMappingURL=shouldNotForwardPropsWithKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shouldNotForwardPropsWithKeys.d.ts","sourceRoot":"","sources":["../../src/utils/shouldNotForwardPropsWithKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,6BAA6B,GAAI,YAAY,SAAS,MAAM,EACvE,MAAM,CAAC,MAAM,YAAY,CAAC,EAAE,KAC3B,aAAa,CAAC,YAAY,CAE3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export const shouldNotForwardPropsWithKeys = (keys) => ({
2
+ shouldForwardProp: (propName) => !keys.map((key) => key.toString()).includes(propName.toString()),
3
+ });
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@smartbooks-ai/layout",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "type": "module",
6
- "main": "./dist/index.ts",
6
+ "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
+ "author": "smartbooks",
9
10
  "exports": {
10
11
  ".": {
11
- "import": "./dist/index.ts",
12
+ "import": "./dist/index.js",
12
13
  "types": "./dist/index.d.ts"
13
14
  }
14
15
  },
@@ -42,7 +43,10 @@
42
43
  "vitest": "^4.0.16"
43
44
  },
44
45
  "dependencies": {
45
- "@smartbooks-ai/api-client": "0.0.1",
46
+ "@smartbooks-ai/api-client": "0.0.5",
46
47
  "use-resize-observer": "^9.1.0"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
47
51
  }
48
52
  }
@@ -10,36 +10,33 @@ import LogoHeaderText from './LogoHeaderText';
10
10
  import { AppSelect, MenuItemWithChildren, UserProfileSelect } from './index';
11
11
  import * as Styled from './styles';
12
12
  import { MenuStructure } from './types';
13
+ import { useMenuToggle } from './useMenuToggle';
13
14
 
14
15
  import { UserProfile } from '../../security/UserProfile';
15
16
 
16
17
  export type PageWithMenuLayoutProps = {
17
- isExpanded: boolean;
18
- toggleIsExpanded: () => void;
19
18
  resolvedCompanyCode?: string;
20
19
  topMenu?: MenuStructure;
21
20
  bottomMenu: MenuStructure;
22
21
  profile: UserProfile | null;
23
22
  tenantCode?: string;
24
23
  switchToCompany: (company: AvailableCompany) => Promise<void>;
25
- openMenu: () => void;
26
24
  logout: () => void;
27
25
  additionalOutletContent?: React.ReactNode;
28
26
  };
29
27
 
30
28
  export const PageWithMenuLayout: React.FC<PageWithMenuLayoutProps> = ({
31
- isExpanded,
32
- toggleIsExpanded,
33
29
  resolvedCompanyCode,
34
30
  topMenu,
35
31
  bottomMenu,
36
32
  profile,
37
33
  tenantCode,
38
34
  switchToCompany,
39
- openMenu,
40
35
  logout,
41
36
  additionalOutletContent,
42
37
  }) => {
38
+ const { isExpanded, openMenu, toggleIsExpanded } = useMenuToggle();
39
+
43
40
  return (
44
41
  <>
45
42
  <Styled.LockMenuButton onClick={toggleIsExpanded} isExpanded={isExpanded}>
@@ -0,0 +1,19 @@
1
+ import { useEffect, useMemo } from 'react';
2
+
3
+ import { useProfile, useToggle } from '@smartbooks-ai/layout';
4
+
5
+ export const useMenuToggle = () => {
6
+ const { value: isExpanded, toggle: toggleIsExpanded, switchOn: openMenu, switchOff: closeMenu } = useToggle(true);
7
+
8
+ const { profile } = useProfile();
9
+
10
+ const tenants = profile?.allowedTenants;
11
+
12
+ const tenantsWithCompanies = useMemo(() => tenants?.filter(({ companies }) => companies.length > 0) ?? [], [tenants]);
13
+
14
+ useEffect(() => {
15
+ if (tenants && !tenantsWithCompanies.length) closeMenu();
16
+ }, [closeMenu, tenants, tenantsWithCompanies.length]);
17
+
18
+ return { isExpanded, toggleIsExpanded, openMenu };
19
+ };