@serhii.olishevskyi/docs 1.2.2 → 1.2.3
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.d.mts +28 -3
- package/dist/index.d.ts +28 -3
- package/dist/index.js +138 -7
- package/dist/index.mjs +145 -2
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { ReactNode } from 'react';
|
|
3
3
|
import { TextFieldProps, SelectProps, SelectChangeEvent, IconButtonProps, TooltipProps, SxProps, Theme, TypographyProps } from '@mui/material';
|
|
4
|
+
import { SystemProps } from '@mui/system';
|
|
4
5
|
import * as _supabase_supabase_js from '@supabase/supabase-js';
|
|
5
6
|
import { SupabaseClient, User, Session } from '@supabase/supabase-js';
|
|
6
7
|
import * as i18next from 'i18next';
|
|
@@ -303,6 +304,25 @@ interface ExpandableNoteComponentProps extends Omit<TypographyProps, 'children'>
|
|
|
303
304
|
label?: React__default.ReactNode;
|
|
304
305
|
}
|
|
305
306
|
|
|
307
|
+
interface PageLink {
|
|
308
|
+
text: ReactNode;
|
|
309
|
+
href?: string;
|
|
310
|
+
external?: boolean;
|
|
311
|
+
onClick?: React__default.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
312
|
+
hidden?: boolean;
|
|
313
|
+
}
|
|
314
|
+
interface PageLinkWidgetProps {
|
|
315
|
+
overrideNamespace?: string;
|
|
316
|
+
title: ReactNode;
|
|
317
|
+
subheader?: ReactNode;
|
|
318
|
+
description: ReactNode;
|
|
319
|
+
icon?: React__default.ReactElement;
|
|
320
|
+
links: PageLink[];
|
|
321
|
+
actionButtonText?: ReactNode;
|
|
322
|
+
bgcolor?: SystemProps<Theme>['bgcolor'];
|
|
323
|
+
onActionButtonClick?: () => void;
|
|
324
|
+
}
|
|
325
|
+
|
|
306
326
|
declare const UI: {
|
|
307
327
|
Inputs: {
|
|
308
328
|
TextField: React$1.FC<TextFieldComponentProps>;
|
|
@@ -325,8 +345,13 @@ declare const UI: {
|
|
|
325
345
|
ExpandableNote: React$1.FC<ExpandableNoteComponentProps>;
|
|
326
346
|
};
|
|
327
347
|
Widgets: {
|
|
328
|
-
|
|
329
|
-
|
|
348
|
+
Locales: {
|
|
349
|
+
ProtectedLanguageSelector: React$1.FC<{}>;
|
|
350
|
+
PublicLanguageSelector: React$1.FC<{}>;
|
|
351
|
+
};
|
|
352
|
+
Pages: {
|
|
353
|
+
PageLinkWidget: React$1.FC<PageLinkWidgetProps>;
|
|
354
|
+
};
|
|
330
355
|
};
|
|
331
356
|
};
|
|
332
357
|
|
|
@@ -667,4 +692,4 @@ declare const Hooks: {
|
|
|
667
692
|
};
|
|
668
693
|
};
|
|
669
694
|
|
|
670
|
-
export { type AIConfig, type AIGenerateOptions, AIProvider, type AIProviderProps, type AIProviderType, AppSettingsProvider, AuthProvider, BreadcrumbProvider, type CompanyMember, type ConfirmOptions, type ConfirmResult, ConfirmationProvider, type ConfirmationProviderProps, type CopyClipboardButtonComponentProps, type DialogSeverity, type DisplayState, type EmailInputComponentProps, type ExpandableNoteComponentProps, type FullCompanyMemberItem, Hooks, type Language, LocalizationProvider, type Membership, type MembershipRole, type MyAvatarComponentProps, type NumberInputComponentProps, Providers, type SaveCompanyUserPayload, type SearchComponentProps, type SelectComponentProps, type SelectOption, Services, type SupabaseConfig, SupabaseProvider, type SupabaseProviderProps, type TextFieldComponentProps, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, ToastProvider, type ToastType, type TranslatableTooltipComponentProps, TranslateProvider, TranslateText, TranslationEditProvider, type TypographyConfig, UI, type UrlComponentProps as UrlProps, type UserAvatarComponentProps, type UserGroupedSessions, type UserPopoverComponentProps, type UserProfile, type UserRoleChipComponentProps, type UserSessionItem, type UserSettings, UserSettingsProvider, type UserStatusChipComponentProps, type UserStatusType, defaultUserSettings, initI18n, useAI, useAppSettings, useAppTheme, useAuth, useBreadcrumb, useConfirmation, useLocalization, useSupabase, useToast, useTranslationEdit, useTranslationNamespace, useUserSettings };
|
|
695
|
+
export { type AIConfig, type AIGenerateOptions, AIProvider, type AIProviderProps, type AIProviderType, AppSettingsProvider, AuthProvider, BreadcrumbProvider, type CompanyMember, type ConfirmOptions, type ConfirmResult, ConfirmationProvider, type ConfirmationProviderProps, type CopyClipboardButtonComponentProps, type DialogSeverity, type DisplayState, type EmailInputComponentProps, type ExpandableNoteComponentProps, type FullCompanyMemberItem, Hooks, type Language, LocalizationProvider, type Membership, type MembershipRole, type MyAvatarComponentProps, type NumberInputComponentProps, type PageLink, type PageLinkWidgetProps, Providers, type SaveCompanyUserPayload, type SearchComponentProps, type SelectComponentProps, type SelectOption, Services, type SupabaseConfig, SupabaseProvider, type SupabaseProviderProps, type TextFieldComponentProps, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, ToastProvider, type ToastType, type TranslatableTooltipComponentProps, TranslateProvider, TranslateText, TranslationEditProvider, type TypographyConfig, UI, type UrlComponentProps as UrlProps, type UserAvatarComponentProps, type UserGroupedSessions, type UserPopoverComponentProps, type UserProfile, type UserRoleChipComponentProps, type UserSessionItem, type UserSettings, UserSettingsProvider, type UserStatusChipComponentProps, type UserStatusType, defaultUserSettings, initI18n, useAI, useAppSettings, useAppTheme, useAuth, useBreadcrumb, useConfirmation, useLocalization, useSupabase, useToast, useTranslationEdit, useTranslationNamespace, useUserSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { ReactNode } from 'react';
|
|
3
3
|
import { TextFieldProps, SelectProps, SelectChangeEvent, IconButtonProps, TooltipProps, SxProps, Theme, TypographyProps } from '@mui/material';
|
|
4
|
+
import { SystemProps } from '@mui/system';
|
|
4
5
|
import * as _supabase_supabase_js from '@supabase/supabase-js';
|
|
5
6
|
import { SupabaseClient, User, Session } from '@supabase/supabase-js';
|
|
6
7
|
import * as i18next from 'i18next';
|
|
@@ -303,6 +304,25 @@ interface ExpandableNoteComponentProps extends Omit<TypographyProps, 'children'>
|
|
|
303
304
|
label?: React__default.ReactNode;
|
|
304
305
|
}
|
|
305
306
|
|
|
307
|
+
interface PageLink {
|
|
308
|
+
text: ReactNode;
|
|
309
|
+
href?: string;
|
|
310
|
+
external?: boolean;
|
|
311
|
+
onClick?: React__default.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
312
|
+
hidden?: boolean;
|
|
313
|
+
}
|
|
314
|
+
interface PageLinkWidgetProps {
|
|
315
|
+
overrideNamespace?: string;
|
|
316
|
+
title: ReactNode;
|
|
317
|
+
subheader?: ReactNode;
|
|
318
|
+
description: ReactNode;
|
|
319
|
+
icon?: React__default.ReactElement;
|
|
320
|
+
links: PageLink[];
|
|
321
|
+
actionButtonText?: ReactNode;
|
|
322
|
+
bgcolor?: SystemProps<Theme>['bgcolor'];
|
|
323
|
+
onActionButtonClick?: () => void;
|
|
324
|
+
}
|
|
325
|
+
|
|
306
326
|
declare const UI: {
|
|
307
327
|
Inputs: {
|
|
308
328
|
TextField: React$1.FC<TextFieldComponentProps>;
|
|
@@ -325,8 +345,13 @@ declare const UI: {
|
|
|
325
345
|
ExpandableNote: React$1.FC<ExpandableNoteComponentProps>;
|
|
326
346
|
};
|
|
327
347
|
Widgets: {
|
|
328
|
-
|
|
329
|
-
|
|
348
|
+
Locales: {
|
|
349
|
+
ProtectedLanguageSelector: React$1.FC<{}>;
|
|
350
|
+
PublicLanguageSelector: React$1.FC<{}>;
|
|
351
|
+
};
|
|
352
|
+
Pages: {
|
|
353
|
+
PageLinkWidget: React$1.FC<PageLinkWidgetProps>;
|
|
354
|
+
};
|
|
330
355
|
};
|
|
331
356
|
};
|
|
332
357
|
|
|
@@ -667,4 +692,4 @@ declare const Hooks: {
|
|
|
667
692
|
};
|
|
668
693
|
};
|
|
669
694
|
|
|
670
|
-
export { type AIConfig, type AIGenerateOptions, AIProvider, type AIProviderProps, type AIProviderType, AppSettingsProvider, AuthProvider, BreadcrumbProvider, type CompanyMember, type ConfirmOptions, type ConfirmResult, ConfirmationProvider, type ConfirmationProviderProps, type CopyClipboardButtonComponentProps, type DialogSeverity, type DisplayState, type EmailInputComponentProps, type ExpandableNoteComponentProps, type FullCompanyMemberItem, Hooks, type Language, LocalizationProvider, type Membership, type MembershipRole, type MyAvatarComponentProps, type NumberInputComponentProps, Providers, type SaveCompanyUserPayload, type SearchComponentProps, type SelectComponentProps, type SelectOption, Services, type SupabaseConfig, SupabaseProvider, type SupabaseProviderProps, type TextFieldComponentProps, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, ToastProvider, type ToastType, type TranslatableTooltipComponentProps, TranslateProvider, TranslateText, TranslationEditProvider, type TypographyConfig, UI, type UrlComponentProps as UrlProps, type UserAvatarComponentProps, type UserGroupedSessions, type UserPopoverComponentProps, type UserProfile, type UserRoleChipComponentProps, type UserSessionItem, type UserSettings, UserSettingsProvider, type UserStatusChipComponentProps, type UserStatusType, defaultUserSettings, initI18n, useAI, useAppSettings, useAppTheme, useAuth, useBreadcrumb, useConfirmation, useLocalization, useSupabase, useToast, useTranslationEdit, useTranslationNamespace, useUserSettings };
|
|
695
|
+
export { type AIConfig, type AIGenerateOptions, AIProvider, type AIProviderProps, type AIProviderType, AppSettingsProvider, AuthProvider, BreadcrumbProvider, type CompanyMember, type ConfirmOptions, type ConfirmResult, ConfirmationProvider, type ConfirmationProviderProps, type CopyClipboardButtonComponentProps, type DialogSeverity, type DisplayState, type EmailInputComponentProps, type ExpandableNoteComponentProps, type FullCompanyMemberItem, Hooks, type Language, LocalizationProvider, type Membership, type MembershipRole, type MyAvatarComponentProps, type NumberInputComponentProps, type PageLink, type PageLinkWidgetProps, Providers, type SaveCompanyUserPayload, type SearchComponentProps, type SelectComponentProps, type SelectOption, Services, type SupabaseConfig, SupabaseProvider, type SupabaseProviderProps, type TextFieldComponentProps, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, ToastProvider, type ToastType, type TranslatableTooltipComponentProps, TranslateProvider, TranslateText, TranslationEditProvider, type TypographyConfig, UI, type UrlComponentProps as UrlProps, type UserAvatarComponentProps, type UserGroupedSessions, type UserPopoverComponentProps, type UserProfile, type UserRoleChipComponentProps, type UserSessionItem, type UserSettings, UserSettingsProvider, type UserStatusChipComponentProps, type UserStatusType, defaultUserSettings, initI18n, useAI, useAppSettings, useAppTheme, useAuth, useBreadcrumb, useConfirmation, useLocalization, useSupabase, useToast, useTranslationEdit, useTranslationNamespace, useUserSettings };
|
package/dist/index.js
CHANGED
|
@@ -4400,6 +4400,132 @@ var ExpandableNoteComponent = ({
|
|
|
4400
4400
|
);
|
|
4401
4401
|
};
|
|
4402
4402
|
|
|
4403
|
+
// src/UI/widgets/page/PageLinkWidget.tsx
|
|
4404
|
+
var import_icons_material3 = require("@mui/icons-material");
|
|
4405
|
+
var import_material21 = require("@mui/material");
|
|
4406
|
+
var import_react28 = __toESM(require("react"));
|
|
4407
|
+
var import_react_router_dom = require("react-router-dom");
|
|
4408
|
+
init_context();
|
|
4409
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4410
|
+
var PageLinkWidget = ({
|
|
4411
|
+
overrideNamespace,
|
|
4412
|
+
title,
|
|
4413
|
+
subheader,
|
|
4414
|
+
description,
|
|
4415
|
+
icon,
|
|
4416
|
+
links,
|
|
4417
|
+
actionButtonText,
|
|
4418
|
+
onActionButtonClick,
|
|
4419
|
+
bgcolor
|
|
4420
|
+
}) => {
|
|
4421
|
+
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
4422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4423
|
+
import_material21.Card,
|
|
4424
|
+
{
|
|
4425
|
+
sx: (theme) => ({
|
|
4426
|
+
height: "100%",
|
|
4427
|
+
display: "flex",
|
|
4428
|
+
flexDirection: "column",
|
|
4429
|
+
boxShadow: 3,
|
|
4430
|
+
bgcolor,
|
|
4431
|
+
color: bgcolor ? typeof bgcolor === "string" && bgcolor.includes(".") ? theme.palette.getContrastText(
|
|
4432
|
+
bgcolor.split(".").reduce((acc, key) => acc[key], theme.palette)
|
|
4433
|
+
) : typeof bgcolor === "function" ? theme.palette.getContrastText(bgcolor(theme)) : theme.palette.getContrastText(bgcolor) : "text.primary"
|
|
4434
|
+
}),
|
|
4435
|
+
children: [
|
|
4436
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4437
|
+
import_material21.CardHeader,
|
|
4438
|
+
{
|
|
4439
|
+
avatar: icon ? import_react28.default.cloneElement(icon, {
|
|
4440
|
+
sx: { color: bgcolor ? "inherit" : "primary", ...icon.props.sx }
|
|
4441
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons_material3.Settings, { color: bgcolor ? "inherit" : "primary" }),
|
|
4442
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "h6", component: "div", color: "inherit", children: typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: title }) : title }),
|
|
4443
|
+
subheader: subheader && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "body2", sx: { opacity: 0.8, color: "inherit" }, children: typeof subheader === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: subheader }) : subheader })
|
|
4444
|
+
}
|
|
4445
|
+
),
|
|
4446
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Divider, { sx: { borderColor: "inherit", opacity: 0.2 } }),
|
|
4447
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material21.CardContent, { sx: { flexGrow: 1 }, children: [
|
|
4448
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "body2", sx: { opacity: 0.85, color: "inherit" }, children: typeof description === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: description }) : description }),
|
|
4449
|
+
links && links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.List, { dense: true, disablePadding: true, children: links.filter((f) => !f.hidden).map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4450
|
+
import_material21.ListItem,
|
|
4451
|
+
{
|
|
4452
|
+
disablePadding: true,
|
|
4453
|
+
sx: {
|
|
4454
|
+
mt: 1,
|
|
4455
|
+
// Запрещаем ListItem менять цвет фона при наведении
|
|
4456
|
+
"&:hover": {
|
|
4457
|
+
backgroundColor: "transparent"
|
|
4458
|
+
}
|
|
4459
|
+
},
|
|
4460
|
+
children: [
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4462
|
+
import_material21.ListItemIcon,
|
|
4463
|
+
{
|
|
4464
|
+
sx: { minWidth: 30, cursor: "pointer", color: "inherit" },
|
|
4465
|
+
onClick: () => {
|
|
4466
|
+
if (link?.href) navigate(link.href);
|
|
4467
|
+
},
|
|
4468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons_material3.ArrowRight, { fontSize: "small", color: "inherit" })
|
|
4469
|
+
}
|
|
4470
|
+
),
|
|
4471
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.ListItemText, { children: link.onClick ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4472
|
+
import_material21.Button,
|
|
4473
|
+
{
|
|
4474
|
+
size: "small",
|
|
4475
|
+
variant: "text",
|
|
4476
|
+
color: bgcolor ? "inherit" : "primary",
|
|
4477
|
+
onClick: link.onClick,
|
|
4478
|
+
sx: {
|
|
4479
|
+
fontWeight: 500,
|
|
4480
|
+
textTransform: "none",
|
|
4481
|
+
// Отключает автоматические заглавные буквы (UPPERCASE)
|
|
4482
|
+
padding: 0,
|
|
4483
|
+
minWidth: "auto",
|
|
4484
|
+
justifyContent: "flex-start",
|
|
4485
|
+
textAlign: "left",
|
|
4486
|
+
transition: "opacity 0.2s ease-in-out",
|
|
4487
|
+
"&:hover": {
|
|
4488
|
+
opacity: 0.75,
|
|
4489
|
+
backgroundColor: "transparent",
|
|
4490
|
+
// Убирает стандартную серую подложку при ховере кнопки
|
|
4491
|
+
textDecoration: "underline"
|
|
4492
|
+
// Эффект подчеркивания, как у ссылки
|
|
4493
|
+
}
|
|
4494
|
+
},
|
|
4495
|
+
children: link.text
|
|
4496
|
+
}
|
|
4497
|
+
) : link.href ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4498
|
+
import_material21.Link,
|
|
4499
|
+
{
|
|
4500
|
+
component: import_react_router_dom.Link,
|
|
4501
|
+
to: link.href,
|
|
4502
|
+
target: link.external ? "_blank" : "_self",
|
|
4503
|
+
rel: link.external ? "noopener noreferrer" : "",
|
|
4504
|
+
underline: "hover",
|
|
4505
|
+
color: bgcolor ? "inherit" : "primary",
|
|
4506
|
+
sx: {
|
|
4507
|
+
fontWeight: 500,
|
|
4508
|
+
display: "inline-block",
|
|
4509
|
+
transition: "opacity 0.2s ease-in-out",
|
|
4510
|
+
"&:hover": {
|
|
4511
|
+
opacity: 0.75,
|
|
4512
|
+
backgroundColor: "transparent"
|
|
4513
|
+
}
|
|
4514
|
+
},
|
|
4515
|
+
children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
|
|
4516
|
+
}
|
|
4517
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "body2", sx: { fontWeight: 500, color: "inherit" }, children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text }) })
|
|
4518
|
+
]
|
|
4519
|
+
},
|
|
4520
|
+
index
|
|
4521
|
+
)) })
|
|
4522
|
+
] }),
|
|
4523
|
+
actionButtonText && onActionButtonClick && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.CardActions, { sx: { justifyContent: "flex-end", padding: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Button, { size: "small", variant: "contained", onClick: onActionButtonClick, children: typeof actionButtonText === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: actionButtonText }) : actionButtonText }) })
|
|
4524
|
+
]
|
|
4525
|
+
}
|
|
4526
|
+
);
|
|
4527
|
+
};
|
|
4528
|
+
|
|
4403
4529
|
// src/UI/index.ts
|
|
4404
4530
|
var UI = {
|
|
4405
4531
|
Inputs: {
|
|
@@ -4426,8 +4552,13 @@ var UI = {
|
|
|
4426
4552
|
Row: FormRow,
|
|
4427
4553
|
},*/
|
|
4428
4554
|
Widgets: {
|
|
4429
|
-
|
|
4430
|
-
|
|
4555
|
+
Locales: {
|
|
4556
|
+
ProtectedLanguageSelector: LanguageSelector,
|
|
4557
|
+
PublicLanguageSelector
|
|
4558
|
+
},
|
|
4559
|
+
Pages: {
|
|
4560
|
+
PageLinkWidget
|
|
4561
|
+
}
|
|
4431
4562
|
}
|
|
4432
4563
|
};
|
|
4433
4564
|
|
|
@@ -4454,16 +4585,16 @@ var Services = {
|
|
|
4454
4585
|
};
|
|
4455
4586
|
|
|
4456
4587
|
// src/hooks/useUserStatus.ts
|
|
4457
|
-
var
|
|
4588
|
+
var import_react29 = require("react");
|
|
4458
4589
|
init_deviceId();
|
|
4459
4590
|
init_context();
|
|
4460
4591
|
var ONLINE_THRESHOLD_MINUTES = 2;
|
|
4461
4592
|
var AWAY_THRESHOLD_MINUTES = 15;
|
|
4462
4593
|
var useUserStatus2 = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
4463
4594
|
const supabase = useSupabase();
|
|
4464
|
-
const [status, setStatus] = (0,
|
|
4465
|
-
const [lastSeen, setLastSeen] = (0,
|
|
4466
|
-
const lastSeenRef = (0,
|
|
4595
|
+
const [status, setStatus] = (0, import_react29.useState)("offline");
|
|
4596
|
+
const [lastSeen, setLastSeen] = (0, import_react29.useState)(initialLastSeenAt ?? null);
|
|
4597
|
+
const lastSeenRef = (0, import_react29.useRef)(initialLastSeenAt ?? null);
|
|
4467
4598
|
lastSeenRef.current = lastSeen;
|
|
4468
4599
|
const calculateStatus = (isOnline, lastSeenIso) => {
|
|
4469
4600
|
if (isOnline) return "online";
|
|
@@ -4479,7 +4610,7 @@ var useUserStatus2 = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
|
4479
4610
|
}
|
|
4480
4611
|
return "offline";
|
|
4481
4612
|
};
|
|
4482
|
-
(0,
|
|
4613
|
+
(0, import_react29.useEffect)(() => {
|
|
4483
4614
|
if (!userId) return;
|
|
4484
4615
|
let isMounted = true;
|
|
4485
4616
|
const isSelf = currentAuthUserId && userId === currentAuthUserId;
|
package/dist/index.mjs
CHANGED
|
@@ -1653,6 +1653,144 @@ var ExpandableNoteComponent = ({
|
|
|
1653
1653
|
);
|
|
1654
1654
|
};
|
|
1655
1655
|
|
|
1656
|
+
// src/UI/widgets/page/PageLinkWidget.tsx
|
|
1657
|
+
import { ArrowRight, Settings } from "@mui/icons-material";
|
|
1658
|
+
import {
|
|
1659
|
+
Button as Button2,
|
|
1660
|
+
Card,
|
|
1661
|
+
CardActions,
|
|
1662
|
+
CardContent,
|
|
1663
|
+
CardHeader,
|
|
1664
|
+
Divider,
|
|
1665
|
+
List,
|
|
1666
|
+
ListItem,
|
|
1667
|
+
ListItemIcon,
|
|
1668
|
+
ListItemText as ListItemText2,
|
|
1669
|
+
Typography as Typography6,
|
|
1670
|
+
Link as MuiLink
|
|
1671
|
+
} from "@mui/material";
|
|
1672
|
+
import React10 from "react";
|
|
1673
|
+
import { Link as RouterLink, useNavigate } from "react-router-dom";
|
|
1674
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1675
|
+
var PageLinkWidget = ({
|
|
1676
|
+
overrideNamespace,
|
|
1677
|
+
title,
|
|
1678
|
+
subheader,
|
|
1679
|
+
description,
|
|
1680
|
+
icon,
|
|
1681
|
+
links,
|
|
1682
|
+
actionButtonText,
|
|
1683
|
+
onActionButtonClick,
|
|
1684
|
+
bgcolor
|
|
1685
|
+
}) => {
|
|
1686
|
+
const navigate = useNavigate();
|
|
1687
|
+
return /* @__PURE__ */ jsxs10(
|
|
1688
|
+
Card,
|
|
1689
|
+
{
|
|
1690
|
+
sx: (theme) => ({
|
|
1691
|
+
height: "100%",
|
|
1692
|
+
display: "flex",
|
|
1693
|
+
flexDirection: "column",
|
|
1694
|
+
boxShadow: 3,
|
|
1695
|
+
bgcolor,
|
|
1696
|
+
color: bgcolor ? typeof bgcolor === "string" && bgcolor.includes(".") ? theme.palette.getContrastText(
|
|
1697
|
+
bgcolor.split(".").reduce((acc, key) => acc[key], theme.palette)
|
|
1698
|
+
) : typeof bgcolor === "function" ? theme.palette.getContrastText(bgcolor(theme)) : theme.palette.getContrastText(bgcolor) : "text.primary"
|
|
1699
|
+
}),
|
|
1700
|
+
children: [
|
|
1701
|
+
/* @__PURE__ */ jsx11(
|
|
1702
|
+
CardHeader,
|
|
1703
|
+
{
|
|
1704
|
+
avatar: icon ? React10.cloneElement(icon, {
|
|
1705
|
+
sx: { color: bgcolor ? "inherit" : "primary", ...icon.props.sx }
|
|
1706
|
+
}) : /* @__PURE__ */ jsx11(Settings, { color: bgcolor ? "inherit" : "primary" }),
|
|
1707
|
+
title: /* @__PURE__ */ jsx11(Typography6, { variant: "h6", component: "div", color: "inherit", children: typeof title === "string" ? /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace, children: title }) : title }),
|
|
1708
|
+
subheader: subheader && /* @__PURE__ */ jsx11(Typography6, { variant: "body2", sx: { opacity: 0.8, color: "inherit" }, children: typeof subheader === "string" ? /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace, children: subheader }) : subheader })
|
|
1709
|
+
}
|
|
1710
|
+
),
|
|
1711
|
+
/* @__PURE__ */ jsx11(Divider, { sx: { borderColor: "inherit", opacity: 0.2 } }),
|
|
1712
|
+
/* @__PURE__ */ jsxs10(CardContent, { sx: { flexGrow: 1 }, children: [
|
|
1713
|
+
/* @__PURE__ */ jsx11(Typography6, { variant: "body2", sx: { opacity: 0.85, color: "inherit" }, children: typeof description === "string" ? /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace, children: description }) : description }),
|
|
1714
|
+
links && links.length > 0 && /* @__PURE__ */ jsx11(List, { dense: true, disablePadding: true, children: links.filter((f) => !f.hidden).map((link, index) => /* @__PURE__ */ jsxs10(
|
|
1715
|
+
ListItem,
|
|
1716
|
+
{
|
|
1717
|
+
disablePadding: true,
|
|
1718
|
+
sx: {
|
|
1719
|
+
mt: 1,
|
|
1720
|
+
// Запрещаем ListItem менять цвет фона при наведении
|
|
1721
|
+
"&:hover": {
|
|
1722
|
+
backgroundColor: "transparent"
|
|
1723
|
+
}
|
|
1724
|
+
},
|
|
1725
|
+
children: [
|
|
1726
|
+
/* @__PURE__ */ jsx11(
|
|
1727
|
+
ListItemIcon,
|
|
1728
|
+
{
|
|
1729
|
+
sx: { minWidth: 30, cursor: "pointer", color: "inherit" },
|
|
1730
|
+
onClick: () => {
|
|
1731
|
+
if (link?.href) navigate(link.href);
|
|
1732
|
+
},
|
|
1733
|
+
children: /* @__PURE__ */ jsx11(ArrowRight, { fontSize: "small", color: "inherit" })
|
|
1734
|
+
}
|
|
1735
|
+
),
|
|
1736
|
+
/* @__PURE__ */ jsx11(ListItemText2, { children: link.onClick ? /* @__PURE__ */ jsx11(
|
|
1737
|
+
Button2,
|
|
1738
|
+
{
|
|
1739
|
+
size: "small",
|
|
1740
|
+
variant: "text",
|
|
1741
|
+
color: bgcolor ? "inherit" : "primary",
|
|
1742
|
+
onClick: link.onClick,
|
|
1743
|
+
sx: {
|
|
1744
|
+
fontWeight: 500,
|
|
1745
|
+
textTransform: "none",
|
|
1746
|
+
// Отключает автоматические заглавные буквы (UPPERCASE)
|
|
1747
|
+
padding: 0,
|
|
1748
|
+
minWidth: "auto",
|
|
1749
|
+
justifyContent: "flex-start",
|
|
1750
|
+
textAlign: "left",
|
|
1751
|
+
transition: "opacity 0.2s ease-in-out",
|
|
1752
|
+
"&:hover": {
|
|
1753
|
+
opacity: 0.75,
|
|
1754
|
+
backgroundColor: "transparent",
|
|
1755
|
+
// Убирает стандартную серую подложку при ховере кнопки
|
|
1756
|
+
textDecoration: "underline"
|
|
1757
|
+
// Эффект подчеркивания, как у ссылки
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
children: link.text
|
|
1761
|
+
}
|
|
1762
|
+
) : link.href ? /* @__PURE__ */ jsx11(
|
|
1763
|
+
MuiLink,
|
|
1764
|
+
{
|
|
1765
|
+
component: RouterLink,
|
|
1766
|
+
to: link.href,
|
|
1767
|
+
target: link.external ? "_blank" : "_self",
|
|
1768
|
+
rel: link.external ? "noopener noreferrer" : "",
|
|
1769
|
+
underline: "hover",
|
|
1770
|
+
color: bgcolor ? "inherit" : "primary",
|
|
1771
|
+
sx: {
|
|
1772
|
+
fontWeight: 500,
|
|
1773
|
+
display: "inline-block",
|
|
1774
|
+
transition: "opacity 0.2s ease-in-out",
|
|
1775
|
+
"&:hover": {
|
|
1776
|
+
opacity: 0.75,
|
|
1777
|
+
backgroundColor: "transparent"
|
|
1778
|
+
}
|
|
1779
|
+
},
|
|
1780
|
+
children: typeof link.text === "string" ? /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace, children: link.text }) : link.text
|
|
1781
|
+
}
|
|
1782
|
+
) : /* @__PURE__ */ jsx11(Typography6, { variant: "body2", sx: { fontWeight: 500, color: "inherit" }, children: typeof link.text === "string" ? /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace, children: link.text }) : link.text }) })
|
|
1783
|
+
]
|
|
1784
|
+
},
|
|
1785
|
+
index
|
|
1786
|
+
)) })
|
|
1787
|
+
] }),
|
|
1788
|
+
actionButtonText && onActionButtonClick && /* @__PURE__ */ jsx11(CardActions, { sx: { justifyContent: "flex-end", padding: 2 }, children: /* @__PURE__ */ jsx11(Button2, { size: "small", variant: "contained", onClick: onActionButtonClick, children: typeof actionButtonText === "string" ? /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace, children: actionButtonText }) : actionButtonText }) })
|
|
1789
|
+
]
|
|
1790
|
+
}
|
|
1791
|
+
);
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1656
1794
|
// src/UI/index.ts
|
|
1657
1795
|
var UI = {
|
|
1658
1796
|
Inputs: {
|
|
@@ -1679,8 +1817,13 @@ var UI = {
|
|
|
1679
1817
|
Row: FormRow,
|
|
1680
1818
|
},*/
|
|
1681
1819
|
Widgets: {
|
|
1682
|
-
|
|
1683
|
-
|
|
1820
|
+
Locales: {
|
|
1821
|
+
ProtectedLanguageSelector: LanguageSelector,
|
|
1822
|
+
PublicLanguageSelector
|
|
1823
|
+
},
|
|
1824
|
+
Pages: {
|
|
1825
|
+
PageLinkWidget
|
|
1826
|
+
}
|
|
1684
1827
|
}
|
|
1685
1828
|
};
|
|
1686
1829
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serhii.olishevskyi/docs",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "DOCS.UA react packages",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@google/genai": "^2.27.0",
|
|
38
38
|
"@supabase/supabase-js": "^2.117.2",
|
|
39
|
-
"moment": "^2.31.0"
|
|
39
|
+
"moment": "^2.31.0",
|
|
40
|
+
"react-router-dom": "^7.18.4"
|
|
40
41
|
}
|
|
41
42
|
}
|