@namuna-nur/ui-kit 1.10.6 → 1.10.8

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.
@@ -0,0 +1 @@
1
+ export declare const MEDIA_LABELS: Record<string, string>;
@@ -1,6 +1,5 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { ReplyMessage } from '..';
3
- type ReplyMessageStory = StoryObj<typeof ReplyMessage>;
1
+ import { Meta } from '@storybook/react';
2
+ import { ReplyMessageStory, ReplyMessage } from '..';
4
3
  declare const meta: Meta<typeof ReplyMessage>;
5
4
  export declare const Default: ReplyMessageStory;
6
5
  export declare const WithoutCloseButton: ReplyMessageStory;
@@ -1,3 +1,5 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ import { ReplyMessage } from '..';
1
3
  type MessageContentType = 'text' | 'image' | 'video' | 'audio' | 'file';
2
4
  export type ReplyMessageProps = {
3
5
  senderName: string;
@@ -19,4 +21,5 @@ export type ReplyMessageProps = {
19
21
  mediaIcon?: string;
20
22
  };
21
23
  };
24
+ export type ReplyMessageStory = StoryObj<typeof ReplyMessage>;
22
25
  export {};
@@ -0,0 +1 @@
1
+ export declare const getSubtitleText: (contentType: string, fileName?: string, messageText?: string) => string | null;
@@ -3,7 +3,7 @@ import { CardFiles } from './CardFiles';
3
3
  export type CardFilesProps = {
4
4
  title: string;
5
5
  file?: File | null;
6
- dateAndTime: Date | string;
6
+ dateTime: Date | string;
7
7
  className?: string;
8
8
  isDisabled: boolean;
9
9
  onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
@@ -27,7 +27,7 @@ export type CardFilesTokens = {
27
27
  basic: string;
28
28
  active: string;
29
29
  };
30
- dateAndTime: string;
30
+ dateTime: Date | string;
31
31
  fileName: string;
32
32
  sizeFile: string;
33
33
  disabled: string;
@@ -1,2 +1,2 @@
1
1
  import { ChatMessageProps } from '..';
2
- export declare const ChatMessage: ({ currentUserId, senderId, senderName, messages, avatar, isGroupChat, selectedMessages, onSelectedMessage, visibleSelections, classNames, onMessageAction, }: ChatMessageProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const ChatMessage: ({ currentUserId, senderId, senderName, messages, avatar, isGroupChat, selectedMessages, onSelectedMessage, visibleSelections, classNames, onMessageAction, mediaContent, }: ChatMessageProps) => import("react/jsx-runtime").JSX.Element;
@@ -20,6 +20,7 @@ export type ChatMessageProps = {
20
20
  selectedMessages?: string[];
21
21
  onSelectedMessage?: (id: string | undefined) => void;
22
22
  visibleSelections?: boolean;
23
+ mediaContent?: (message: MessageType, isMine: boolean) => React.ReactNode;
23
24
  classNames?: {
24
25
  root?: string;
25
26
  list?: string;
@@ -1,2 +1,2 @@
1
1
  import { DocumentMessageProps } from '..';
2
- export declare const DocumentMessage: ({ title, size, dateAndTime, timestamp, status, isMine, onClick, classNames, }: DocumentMessageProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const DocumentMessage: ({ title, size, dateTime, timestamp, status, isMine, onClick, classNames, }: DocumentMessageProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import { DocumentMessageProps } from '..';
2
- export declare const DocumentMessageData: DocumentMessageProps;
3
- export declare const DocumentMessageDeliveredData: DocumentMessageProps;
4
- export declare const DocumentMessageReceivedData: DocumentMessageProps;
2
+ export declare const DOCUMENT_MESSAGE_DATA: DocumentMessageProps;
3
+ export declare const DOCUMENT_MESSAGE_DELIVERED_DATA: DocumentMessageProps;
4
+ export declare const DOCUMENT_MESSAGE_RECEIVED_DATA: DocumentMessageProps;
@@ -4,7 +4,7 @@ export type DocumentMessageStatus = 'delivered' | 'read';
4
4
  export type DocumentMessageProps = {
5
5
  title: string;
6
6
  size: string;
7
- dateAndTime: Date | string;
7
+ dateTime: Date | string;
8
8
  timestamp?: Date | string;
9
9
  status?: DocumentMessageStatus;
10
10
  isMine?: boolean;
@@ -15,7 +15,7 @@ export type DocumentMessageProps = {
15
15
  content?: string;
16
16
  title?: string;
17
17
  size?: string;
18
- dateAndTime?: string;
18
+ dateTime?: string;
19
19
  footer?: string;
20
20
  };
21
21
  };
@@ -1,7 +1,7 @@
1
1
  export declare const FileCard: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
2
2
  name: string;
3
3
  size: number;
4
- dateAndTime: Date;
4
+ dateTime: Date | string;
5
5
  isDownloaded?: boolean;
6
6
  classNames?: {
7
7
  wrapper?: string;
@@ -4,7 +4,7 @@ import { FileCard } from './FileCard';
4
4
  export type FileCardProps = HTMLAttributes<HTMLDivElement> & {
5
5
  name: string;
6
6
  size: number;
7
- dateAndTime: Date;
7
+ dateTime: Date | string;
8
8
  isDownloaded?: boolean;
9
9
  classNames?: {
10
10
  wrapper?: string;
@@ -3,6 +3,14 @@ import { HTMLAttributes } from 'react';
3
3
  import { Message } from './Message';
4
4
  export type MessageStory = StoryObj<typeof Message>;
5
5
  export type MessageStatus = 'sent' | 'delivered' | 'read';
6
+ export type MessageMedia = {
7
+ type: 'image' | 'video' | 'file';
8
+ url: string;
9
+ mxcUrl: string;
10
+ filename: string;
11
+ mimetype: string;
12
+ size: number;
13
+ };
6
14
  export type MessageType = {
7
15
  id: string | undefined;
8
16
  text: string;
@@ -12,6 +20,7 @@ export type MessageType = {
12
20
  senderName: string;
13
21
  messageText: string;
14
22
  };
23
+ media?: MessageMedia;
15
24
  };
16
25
  export type MessageTokens = {
17
26
  base: string;
@@ -1,2 +1,2 @@
1
1
  import { PaymentCardProps } from '..';
2
- export declare const PaymentCard: ({ title, dateAndTime, onDelete, onDownload, onShow, firstStatus, lastStatus, firstStatusText, lastStatusText, price, classNames, }: PaymentCardProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const PaymentCard: ({ title, dateTime, onDelete, onDownload, onShow, firstStatus, lastStatus, firstStatusText, lastStatusText, price, classNames, }: PaymentCardProps) => import("react/jsx-runtime").JSX.Element;
@@ -3,7 +3,7 @@ import { PaymentCard } from '..';
3
3
  export type PaymentCardStory = StoryObj<typeof PaymentCard>;
4
4
  export type PaymentCardProps = {
5
5
  title: string;
6
- dateAndTime: Date | string;
6
+ dateTime: Date | string;
7
7
  onDelete?: (e: React.MouseEvent<HTMLButtonElement>) => void;
8
8
  onDownload?: (e: React.MouseEvent<HTMLButtonElement>) => void;
9
9
  onShow?: (e: React.MouseEvent<HTMLButtonElement>) => void;
@@ -1,3 +1,5 @@
1
1
  export declare const DATE_FORMAT_DAY_MONTH_YEAR_DOT = "yyyy.MM.dd";
2
2
  export declare const DATE_FORMAT_DAY_MONTH_YEAR_DASH = "yyyy-MM-dd";
3
3
  export declare function formatDateToDayMonthYear(date: Date | string, formatDate: string): string;
4
+ export declare function formatTime(date: Date | string): string;
5
+ export declare function formatDate(date: Date | string): string;
@@ -1,22 +1,28 @@
1
1
  import { format as c } from "date-fns";
2
- import { clsx as l } from "clsx";
3
- import { extendTailwindMerge as p } from "tailwind-merge";
4
- import { typographyTokens as i, colorTokens as f } from "../tokens/index.js";
5
- import { PieChart as u, LineChart as d } from "echarts/charts";
6
- import { GridComponent as M, TitleComponent as T, TooltipComponent as h, LegendComponent as y } from "echarts/components";
7
- import * as x from "echarts/core";
8
- import { CanvasRenderer as N } from "echarts/renderers";
9
- const R = "yyyy.MM.dd", S = "yyyy-MM-dd";
10
- function w(t, o) {
2
+ import { clsx as f } from "clsx";
3
+ import { extendTailwindMerge as l } from "tailwind-merge";
4
+ import { typographyTokens as m, colorTokens as p } from "../tokens/index.js";
5
+ import { PieChart as u, LineChart as M } from "echarts/charts";
6
+ import { GridComponent as T, TitleComponent as d, TooltipComponent as y, LegendComponent as _ } from "echarts/components";
7
+ import * as N from "echarts/core";
8
+ import { CanvasRenderer as h } from "echarts/renderers";
9
+ const w = "yyyy.MM.dd", k = "yyyy-MM-dd", O = "kk:mm", D = "dd.MM.yyyy HH:mm:ss";
10
+ function x(t, o) {
11
11
  return c(new Date(t), o);
12
12
  }
13
- const m = (t, { splitClassName: o } = { splitClassName: !0 }) => {
13
+ function z(t) {
14
+ return t ? c(new Date(t), O) : "";
15
+ }
16
+ function B(t) {
17
+ return x(t, D);
18
+ }
19
+ const i = (t, { splitClassName: o } = { splitClassName: !0 }) => {
14
20
  const e = {};
15
21
  return Object.keys(t).forEach((r) => {
16
22
  const [n, s] = o ? r.split("-") : ["", r], a = `text-${o ? n : r}`;
17
23
  e[a] || (e[a] = []), e[a].push(s);
18
24
  }), e;
19
- }, C = (t) => {
25
+ }, A = (t) => {
20
26
  const o = {};
21
27
  return Object.entries(t).forEach(([e, r]) => {
22
28
  const n = `text-${e}`;
@@ -24,42 +30,44 @@ const m = (t, { splitClassName: o } = { splitClassName: !0 }) => {
24
30
  (s) => !isNaN(Number(s))
25
31
  );
26
32
  }), o;
27
- }, _ = p({
33
+ }, C = l({
28
34
  extend: {
29
35
  classGroups: {
30
36
  "font-size": [
31
- m(i.textStyles.body),
32
- m(i.textStyles.headings, {
37
+ i(m.textStyles.body),
38
+ i(m.textStyles.headings, {
33
39
  splitClassName: !1
34
40
  }),
35
- m(i.textStyles.link, {
41
+ i(m.textStyles.link, {
36
42
  splitClassName: !1
37
43
  })
38
44
  ],
39
- "text-color": [C(f)]
45
+ "text-color": [A(p)]
40
46
  }
41
47
  }
42
- }), z = (...t) => _(l(t)), B = (t) => new Intl.NumberFormat("ru-RU").format(Number(t)), G = (t) => {
48
+ }), G = (...t) => C(f(t)), I = (t) => new Intl.NumberFormat("ru-RU").format(Number(t)), U = (t) => {
43
49
  const o = ["B", "KB", "MB", "GB"];
44
50
  if (t === 0) return "0 B";
45
51
  const e = Math.floor(Math.log(t) / Math.log(1024));
46
52
  return `${(t / Math.pow(1024, e)).toFixed(2)}${o[e]}`;
47
53
  };
48
- x.use([
49
- N,
54
+ N.use([
55
+ h,
50
56
  u,
51
- d,
52
57
  M,
53
58
  T,
54
- h,
55
- y
59
+ d,
60
+ y,
61
+ _
56
62
  ]);
57
63
  export {
58
- S as DATE_FORMAT_DAY_MONTH_YEAR_DASH,
59
- R as DATE_FORMAT_DAY_MONTH_YEAR_DOT,
60
- z as cn,
61
- m as convertToGroupedFontSizes,
62
- w as formatDateToDayMonthYear,
63
- G as formatFileSize,
64
- B as numberFormat
64
+ k as DATE_FORMAT_DAY_MONTH_YEAR_DASH,
65
+ w as DATE_FORMAT_DAY_MONTH_YEAR_DOT,
66
+ G as cn,
67
+ i as convertToGroupedFontSizes,
68
+ B as formatDate,
69
+ x as formatDateToDayMonthYear,
70
+ U as formatFileSize,
71
+ z as formatTime,
72
+ I as numberFormat
65
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namuna-nur/ui-kit",
3
- "version": "1.10.6",
3
+ "version": "1.10.8",
4
4
  "description": "UI Kit for Namuna NUR",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",