remoraid 1.1.0 → 2.0.0

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/dist/index.js DELETED
@@ -1,395 +0,0 @@
1
- "use client";
2
- // src/components/AppShell/NavbarMinimal/index.tsx
3
- import {
4
- Tooltip,
5
- UnstyledButton,
6
- Stack,
7
- rem,
8
- useMantineColorScheme,
9
- Flex,
10
- Paper,
11
- useMantineTheme,
12
- Divider,
13
- Indicator
14
- } from "@mantine/core";
15
- import {
16
- IconLogin,
17
- IconLogout,
18
- IconMoon,
19
- IconSun
20
- } from "@tabler/icons-react";
21
- import Link from "next/link";
22
- import { usePathname } from "next/navigation";
23
- import { useState } from "react";
24
-
25
- // src/lib/utils.ts
26
- import {
27
- px,
28
- rgba
29
- } from "@mantine/core";
30
- var co = (condition, value, fallback) => condition(value) ? value : fallback;
31
- var isMantinePrimaryShade = (primaryShade) => {
32
- if (isNaN(Number(primaryShade))) {
33
- return true;
34
- }
35
- return false;
36
- };
37
- var getCustomStyles = (theme, colorScheme) => {
38
- return {
39
- transparentBackground: colorScheme === "dark" ? rgba(theme.colors.dark[8], 0.8) : rgba(theme.white, 0.8),
40
- iconSize: "1.125em",
41
- primaryColor: theme.colors[theme.primaryColor][isMantinePrimaryShade(theme.primaryShade) ? theme.primaryShade[colorScheme === "auto" ? "light" : colorScheme] : theme.primaryShade],
42
- spacingPx: {
43
- xs: Number(co((v) => !Number.isNaN(v), Number(px(theme.spacing.xs)), 0)),
44
- sm: Number(co((v) => !Number.isNaN(v), Number(px(theme.spacing.sm)), 0)),
45
- md: Number(co((v) => !Number.isNaN(v), Number(px(theme.spacing.md)), 0)),
46
- lg: Number(co((v) => !Number.isNaN(v), Number(px(theme.spacing.lg)), 0)),
47
- xl: Number(co((v) => !Number.isNaN(v), Number(px(theme.spacing.xl)), 0))
48
- }
49
- };
50
- };
51
-
52
- // src/components/AppShell/NavbarMinimal/index.tsx
53
- import { jsxDEV } from "react/jsx-dev-runtime";
54
- function NavbarLink({
55
- icon: Icon2,
56
- label,
57
- active,
58
- onClick,
59
- href,
60
- indicator,
61
- settings
62
- }) {
63
- const [isHoveringRoleIndicator, setIsHoveringRoleIndicator] = useState(false);
64
- const iconProps = {
65
- size: settings.iconSize,
66
- stroke: 1.5
67
- };
68
- if (!href) {
69
- return /* @__PURE__ */ jsxDEV(Tooltip, {
70
- label,
71
- position: "right",
72
- transitionProps: { duration: 0 },
73
- children: /* @__PURE__ */ jsxDEV(UnstyledButton, {
74
- onClick,
75
- className: "remoraid-navbar-minimal-link",
76
- "data-active": active || undefined,
77
- w: settings.linkSize,
78
- h: settings.linkSize,
79
- children: /* @__PURE__ */ jsxDEV(Icon2, {
80
- ...iconProps
81
- }, undefined, false, undefined, this)
82
- }, undefined, false, undefined, this)
83
- }, undefined, false, undefined, this);
84
- }
85
- const button = /* @__PURE__ */ jsxDEV(UnstyledButton, {
86
- onClick,
87
- className: "remoraid-navbar-minimal-link",
88
- "data-active": active || undefined,
89
- w: settings.linkSize,
90
- h: settings.linkSize,
91
- component: Link,
92
- href,
93
- children: /* @__PURE__ */ jsxDEV(Icon2, {
94
- ...iconProps
95
- }, undefined, false, undefined, this)
96
- }, undefined, false, undefined, this);
97
- return /* @__PURE__ */ jsxDEV(Tooltip, {
98
- label,
99
- position: "right",
100
- transitionProps: { duration: 0 },
101
- children: indicator === undefined ? button : /* @__PURE__ */ jsxDEV(Indicator, {
102
- withBorder: true,
103
- size: 13,
104
- offset: 2,
105
- onMouseEnter: () => setIsHoveringRoleIndicator(true),
106
- onMouseLeave: () => setIsHoveringRoleIndicator(false),
107
- ...indicator(isHoveringRoleIndicator),
108
- children: button
109
- }, undefined, false, undefined, this)
110
- }, undefined, false, undefined, this);
111
- }
112
- var defaultSettings = {
113
- hiddenPages: [],
114
- linkSize: rem("50px"),
115
- iconSize: "50%",
116
- px: "sm",
117
- py: "md"
118
- };
119
- function NavbarMinimal({
120
- logo,
121
- pages,
122
- user,
123
- settings: settingsProp,
124
- linkIndicator,
125
- logoIndicator,
126
- onLogout
127
- }) {
128
- const pathname = usePathname();
129
- const theme = useMantineTheme();
130
- const { setColorScheme, colorScheme } = useMantineColorScheme();
131
- const { transparentBackground } = getCustomStyles(theme, colorScheme);
132
- const [isHoveringRoleIndicator, setIsHoveringRoleIndicator] = useState(false);
133
- const settings = settingsProp || defaultSettings;
134
- const links = pages.filter((link) => !settings.hiddenPages.includes(link.href)).map((link) => /* @__PURE__ */ jsxDEV(NavbarLink, {
135
- active: link.href === pathname,
136
- indicator: linkIndicator,
137
- settings,
138
- ...link
139
- }, link.label, false, undefined, this));
140
- const logoImage = logo({
141
- style: {
142
- cursor: "pointer",
143
- width: settings.linkSize,
144
- height: settings.linkSize
145
- }
146
- });
147
- return /* @__PURE__ */ jsxDEV(Paper, {
148
- h: "100%",
149
- py: settings.py,
150
- bg: transparentBackground,
151
- radius: 0,
152
- shadow: "md",
153
- children: /* @__PURE__ */ jsxDEV(Flex, {
154
- direction: "column",
155
- h: "100%",
156
- align: "center",
157
- px: settings.px,
158
- children: [
159
- logoIndicator === undefined ? logoImage : /* @__PURE__ */ jsxDEV(Indicator, {
160
- withBorder: true,
161
- offset: 2,
162
- size: 13,
163
- onMouseEnter: () => setIsHoveringRoleIndicator(true),
164
- onMouseLeave: () => setIsHoveringRoleIndicator(false),
165
- ...logoIndicator(isHoveringRoleIndicator),
166
- children: logoImage
167
- }, undefined, false, undefined, this),
168
- /* @__PURE__ */ jsxDEV(Divider, {
169
- my: "md",
170
- variant: "dashed",
171
- w: "100%"
172
- }, undefined, false, undefined, this),
173
- /* @__PURE__ */ jsxDEV(Stack, {
174
- justify: "flex-start",
175
- gap: 0,
176
- flex: 1,
177
- children: links
178
- }, undefined, false, undefined, this),
179
- /* @__PURE__ */ jsxDEV(Stack, {
180
- justify: "center",
181
- gap: 0,
182
- children: [
183
- user !== undefined && (user === null ? /* @__PURE__ */ jsxDEV(NavbarLink, {
184
- icon: IconLogin,
185
- label: "Login",
186
- href: "/login",
187
- active: pathname === "/login",
188
- settings
189
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV(NavbarLink, {
190
- icon: IconLogout,
191
- label: "Logout",
192
- onClick: () => {
193
- if (onLogout) {
194
- onLogout();
195
- }
196
- },
197
- href: "/login",
198
- settings
199
- }, undefined, false, undefined, this)),
200
- /* @__PURE__ */ jsxDEV(NavbarLink, {
201
- icon: colorScheme === "dark" ? IconSun : IconMoon,
202
- onClick: () => {
203
- if (colorScheme === "dark") {
204
- setColorScheme("light");
205
- } else {
206
- setColorScheme("dark");
207
- }
208
- },
209
- label: "Toggle Color Scheme",
210
- settings
211
- }, undefined, false, undefined, this)
212
- ]
213
- }, undefined, true, undefined, this)
214
- ]
215
- }, undefined, true, undefined, this)
216
- }, undefined, false, undefined, this);
217
- }
218
-
219
- // src/lib/navbar-utils.ts
220
- var defaultNavbarVariant = "minimal";
221
- var defaultNavbarSettings = {
222
- minimal: defaultSettings
223
- };
224
-
225
- // src/components/UserExperienceProvider/index.tsx
226
- import React, { useContext } from "react";
227
- import { useCookies } from "react-cookie";
228
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
229
- var defaultUserExperience = {
230
- navbarVariant: defaultNavbarVariant,
231
- navbarSettings: defaultNavbarSettings[defaultNavbarVariant],
232
- showWelcomeMessage: true
233
- };
234
- var userExperienceContext = React.createContext(defaultUserExperience);
235
- var updateUserExperienceContext = React.createContext(null);
236
- var useUserExperience = () => {
237
- return useContext(userExperienceContext);
238
- };
239
- var useUpdateUserExperience = () => {
240
- return useContext(updateUserExperienceContext);
241
- };
242
- function UserExperienceProvider({
243
- children
244
- }) {
245
- const [cookies, setCookie] = useCookies();
246
- const isUserExperience = (x) => {
247
- if (typeof x !== "object") {
248
- return false;
249
- }
250
- if (!("showWelcomeMessage" in x)) {
251
- return false;
252
- }
253
- if (!("navbarVariant" in x)) {
254
- return false;
255
- }
256
- if (!("navbarSettings" in x)) {
257
- return false;
258
- }
259
- if (typeof x.navbarSettings !== "object") {
260
- return false;
261
- }
262
- if (!("hiddenPages" in x.navbarSettings)) {
263
- return false;
264
- }
265
- if (!("linkSize" in x.navbarSettings)) {
266
- return false;
267
- }
268
- if (!("px" in x.navbarSettings)) {
269
- return false;
270
- }
271
- if (!("py" in x.navbarSettings)) {
272
- return false;
273
- }
274
- return true;
275
- };
276
- const userExperience = cookies["userExperience"] && isUserExperience(cookies["userExperience"]) ? cookies["userExperience"] : defaultUserExperience;
277
- const updateUserExperience = (p) => {
278
- if (typeof p === "function") {
279
- setCookie("userExperience", p(userExperience), { path: "/" });
280
- return;
281
- }
282
- setCookie("userExperience", p, { path: "/" });
283
- };
284
- return /* @__PURE__ */ jsxDEV2(updateUserExperienceContext.Provider, {
285
- value: updateUserExperience,
286
- children: /* @__PURE__ */ jsxDEV2(userExperienceContext.Provider, {
287
- value: userExperience,
288
- children
289
- }, undefined, false, undefined, this)
290
- }, undefined, false, undefined, this);
291
- }
292
- // src/components/AppShell/index.tsx
293
- import {
294
- AppShell as MantineAppShell,
295
- Burger,
296
- rem as rem2,
297
- Group as Group2,
298
- useMantineTheme as useMantineTheme3,
299
- useMantineColorScheme as useMantineColorScheme3,
300
- Paper as Paper2,
301
- px as px2
302
- } from "@mantine/core";
303
- import { useDisclosure } from "@mantine/hooks";
304
-
305
- // src/components/AppShell/Footer/index.tsx
306
- import { Group, useMantineColorScheme as useMantineColorScheme2, useMantineTheme as useMantineTheme2 } from "@mantine/core";
307
- import { IconPennant } from "@tabler/icons-react";
308
- import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
309
- function Footer() {
310
- const theme = useMantineTheme2();
311
- const { colorScheme } = useMantineColorScheme2();
312
- return /* @__PURE__ */ jsxDEV3(Group, {
313
- justify: "center",
314
- w: "100%",
315
- py: "md",
316
- children: /* @__PURE__ */ jsxDEV3(IconPennant, {
317
- size: 50,
318
- color: colorScheme === "dark" ? theme.colors.dark[8] : theme.colors.gray[3]
319
- }, undefined, false, undefined, this)
320
- }, undefined, false, undefined, this);
321
- }
322
-
323
- // src/components/AppShell/index.tsx
324
- import { jsxDEV as jsxDEV4, Fragment } from "react/jsx-dev-runtime";
325
- function AppShell({
326
- children,
327
- logo,
328
- pages,
329
- navbar,
330
- user
331
- }) {
332
- const theme = useMantineTheme3();
333
- const { colorScheme } = useMantineColorScheme3();
334
- const { spacingPx } = getCustomStyles(theme, colorScheme);
335
- const [opened, { toggle }] = useDisclosure();
336
- const navbarVariant = navbar && navbar.variant ? navbar.variant : defaultNavbarVariant;
337
- const navbarSettings = navbar && navbar.settings ? navbar.settings : defaultNavbarSettings[defaultNavbarVariant];
338
- const navbarLinkSizePx = co((v) => !Number.isNaN(v), Number(px2(navbarSettings.linkSize)), 0);
339
- const navbarPaddingPx = typeof navbarSettings.px === "number" ? navbarSettings.px : spacingPx[navbarSettings.px];
340
- return /* @__PURE__ */ jsxDEV4(MantineAppShell, {
341
- header: { height: 0 },
342
- navbar: {
343
- width: rem2(`${navbarLinkSizePx + 2 * navbarPaddingPx}px`),
344
- breakpoint: "sm",
345
- collapsed: { mobile: !opened }
346
- },
347
- bg: colorScheme === "dark" ? theme.colors.dark[9] : theme.colors.gray[0],
348
- children: [
349
- /* @__PURE__ */ jsxDEV4(MantineAppShell.Header, {
350
- withBorder: false,
351
- children: /* @__PURE__ */ jsxDEV4(Group2, {
352
- p: "md",
353
- bg: colorScheme === "dark" ? theme.colors.dark[8] : theme.colors.gray[3],
354
- hiddenFrom: "sm",
355
- children: /* @__PURE__ */ jsxDEV4(Burger, {
356
- opened,
357
- onClick: toggle,
358
- h: 20,
359
- size: 18
360
- }, undefined, false, undefined, this)
361
- }, undefined, false, undefined, this)
362
- }, undefined, false, undefined, this),
363
- /* @__PURE__ */ jsxDEV4(MantineAppShell.Navbar, {
364
- withBorder: false,
365
- children: navbarVariant === "minimal" && /* @__PURE__ */ jsxDEV4(NavbarMinimal, {
366
- logo,
367
- pages,
368
- user,
369
- ...navbar
370
- }, undefined, false, undefined, this)
371
- }, undefined, false, undefined, this),
372
- /* @__PURE__ */ jsxDEV4(MantineAppShell.Main, {
373
- children: /* @__PURE__ */ jsxDEV4(Fragment, {
374
- children: [
375
- /* @__PURE__ */ jsxDEV4(Paper2, {
376
- radius: 0,
377
- my: "md",
378
- h: 20,
379
- hiddenFrom: "sm"
380
- }, undefined, false, undefined, this),
381
- children,
382
- /* @__PURE__ */ jsxDEV4(Footer, {}, undefined, false, undefined, this)
383
- ]
384
- }, undefined, true, undefined, this)
385
- }, undefined, false, undefined, this)
386
- ]
387
- }, undefined, true, undefined, this);
388
- }
389
- export {
390
- useUserExperience,
391
- useUpdateUserExperience,
392
- defaultNavbarSettings,
393
- UserExperienceProvider,
394
- AppShell
395
- };
package/dist/ssc.d.ts DELETED
@@ -1,10 +0,0 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- import { PropsWithChildren } from 'react';
4
-
5
- export interface EnvironmentShellProps {
6
- vars: string[];
7
- }
8
- export function EnvironmentShell({ children, vars, }: PropsWithChildren<EnvironmentShellProps>): import("react").JSX.Element;
9
-
10
- export {};