brd-ui-kit 0.1.80 → 0.1.81
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/brd-ui-kit.css +1 -1
- package/dist/calendar-PqChui7l.cjs.map +1 -1
- package/dist/calendar-XWqEaWHP.js.map +1 -1
- package/dist/components/basic-modal/basic-modal.d.ts +4 -2
- package/dist/components/transfer-list/index.d.ts +1 -1
- package/dist/components/transfer-list/transfer-list-card.d.ts +1 -1
- package/dist/components/ui/calendar/calendar.d.ts +1 -0
- package/dist/components/ui/calendar/index.d.ts +1 -1
- package/dist/components/ui/dialog/dialog.d.ts +4 -2
- package/dist/components/ui/dialog/dialog.styles.d.ts +6 -1
- package/dist/components-basic-modal-basic-modal.cjs +1 -1
- package/dist/components-basic-modal-basic-modal.cjs.map +1 -1
- package/dist/components-basic-modal-basic-modal.js +30 -24
- package/dist/components-basic-modal-basic-modal.js.map +1 -1
- package/dist/components-input-contact-input-contact.cjs +3 -3
- package/dist/components-input-contact-input-contact.cjs.map +1 -1
- package/dist/components-input-contact-input-contact.js +8 -8
- package/dist/components-input-contact-input-contact.js.map +1 -1
- package/dist/components-transfer-list-transfer-list-card.cjs +4 -1
- package/dist/components-transfer-list-transfer-list-card.cjs.map +1 -1
- package/dist/components-transfer-list-transfer-list-card.js +190 -4
- package/dist/components-transfer-list-transfer-list-card.js.map +1 -1
- package/dist/components-transfer-list-transfer-list.cjs +1 -1
- package/dist/components-transfer-list-transfer-list.cjs.map +1 -1
- package/dist/components-transfer-list-transfer-list.js +32 -30
- package/dist/components-transfer-list-transfer-list.js.map +1 -1
- package/dist/components-ui-dialog-dialog.cjs +1 -1
- package/dist/components-ui-dialog-dialog.cjs.map +1 -1
- package/dist/components-ui-dialog-dialog.js +49 -42
- package/dist/components-ui-dialog-dialog.js.map +1 -1
- package/dist/components-ui-dialog-dialog.styles.cjs +1 -1
- package/dist/components-ui-dialog-dialog.styles.cjs.map +1 -1
- package/dist/components-ui-dialog-dialog.styles.js +34 -17
- package/dist/components-ui-dialog-dialog.styles.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
- package/dist/transfer-list-card-3JPB-sdd.js +0 -525
- package/dist/transfer-list-card-3JPB-sdd.js.map +0 -1
- package/dist/transfer-list-card-D2oGp-Rw.cjs +0 -28
- package/dist/transfer-list-card-D2oGp-Rw.cjs.map +0 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { dialogContentPositionVariants } from '../ui/dialog/dialog.styles';
|
|
1
3
|
type Props = {
|
|
2
4
|
open: boolean;
|
|
3
5
|
onOpenChange: (value: boolean) => void;
|
|
@@ -16,6 +18,6 @@ type Props = {
|
|
|
16
18
|
footer?: React.ReactNode;
|
|
17
19
|
showCloseButton?: boolean;
|
|
18
20
|
ariaDescribedby?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare const BasicModal: ({ open, onOpenChange, title, cancelLabel, confirmLabel, onConfirm, children, classes, footer, showCloseButton, ariaDescribedby, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
} & VariantProps<typeof dialogContentPositionVariants>;
|
|
22
|
+
export declare const BasicModal: ({ open, onOpenChange, title, cancelLabel, confirmLabel, onConfirm, children, classes, footer, showCloseButton, ariaDescribedby, positionX, positionY, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TransferList } from './transfer-list';
|
|
1
|
+
export { TransferList, type TransferListItem } from './transfer-list';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
import { DayPicker, DayButton } from 'react-day-picker';
|
|
3
3
|
import { Button } from '../button';
|
|
4
|
+
export { type DateRange } from 'react-day-picker';
|
|
4
5
|
type CalendarSize = "sm" | "md" | "lg";
|
|
5
6
|
type CalendarPreset = {
|
|
6
7
|
text: string;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
1
2
|
import { ComponentPropsWithRef, HTMLAttributes, FC, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
+
import { dialogContentPositionVariants } from './dialog.styles';
|
|
2
4
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
5
|
type DialogOverlayProps = ComponentPropsWithRef<typeof DialogPrimitive.Overlay>;
|
|
4
6
|
type DialogContentProps = ComponentPropsWithRef<typeof DialogPrimitive.Content> & {
|
|
5
7
|
showCloseButton?: boolean;
|
|
6
|
-
}
|
|
8
|
+
} & VariantProps<typeof dialogContentPositionVariants>;
|
|
7
9
|
type DialogTitleProps = ComponentPropsWithRef<typeof DialogPrimitive.Title>;
|
|
8
10
|
type DialogDescriptionProps = ComponentPropsWithRef<typeof DialogPrimitive.Description>;
|
|
9
11
|
declare const Dialog: FC<DialogPrimitive.DialogProps>;
|
|
@@ -15,7 +17,7 @@ declare const DialogOverlay: {
|
|
|
15
17
|
displayName: string | undefined;
|
|
16
18
|
};
|
|
17
19
|
declare const DialogContent: {
|
|
18
|
-
({ className, children, showCloseButton, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
({ className, children, showCloseButton, positionX, positionY, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element;
|
|
19
21
|
displayName: string | undefined;
|
|
20
22
|
};
|
|
21
23
|
declare const DialogHeader: {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
1
2
|
export declare const dialogOverlayClassNames: readonly ["data-open:animate-in data-closed:animate-out data-closed:fade-out-0", "data-open:fade-in-0 duration-100", "bg-primary-inverse-bg/20 fixed inset-0 isolate z-30"];
|
|
2
|
-
export declare const dialogContentClassNames: readonly ["fixed
|
|
3
|
+
export declare const dialogContentClassNames: readonly ["fixed z-50 grid gap-8 bg-primary-bg p-6 shadow-[0px_10px_40px_0px_rgba(0,0,0,0.15)] duration-200", "rounded-[8px]", "[&>[data-base-ui-portal]]:absolute [&>[data-base-ui-portal]]:h-0 [&>[data-base-ui-portal]]:w-0 [&>[data-base-ui-portal]]:overflow-visible", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0", "data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"];
|
|
4
|
+
export declare const dialogContentPositionVariants: (props?: ({
|
|
5
|
+
positionX?: "left" | "right" | "center" | null | undefined;
|
|
6
|
+
positionY?: "bottom" | "top" | "center" | null | undefined;
|
|
7
|
+
} & ClassProp) | undefined) => string;
|
|
3
8
|
export declare const dialogCloseClassNames: readonly ["absolute cursor-pointer right-6 top-7 inline-flex size-5 items-center justify-center rounded-sm text-secondary-text", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inp-focus-border", "disabled:pointer-events-none"];
|
|
4
9
|
export declare const dialogHeaderClassNames: readonly ["flex flex-col gap-1.5 pr-10 text-left"];
|
|
5
10
|
export declare const dialogFooterClassNames: readonly ["flex flex-col-reverse sm:flex-row sm:justify-end gap-4 [&>*]:flex-1"];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("class-variance-authority");const n=require("./components-ui-button-button.cjs");require("./components-ui-button-button.styles.cjs");const i=require("./components-ui-dialog-dialog.cjs"),_=({open:a,onOpenChange:r,title:t,cancelLabel:c="Отмена",confirmLabel:s="Ок",onConfirm:d,children:u,classes:o,footer:l,showCloseButton:j=!1,ariaDescribedby:m=void 0,positionX:x,positionY:h})=>{const b=()=>{r(!1)},g=()=>{d?.(),r(!1)},v=l===void 0?e.jsxs(i.DialogFooter,{className:o?.footer,children:[e.jsx(n.Button,{variant:"secondary",onClick:b,children:c}),e.jsx(n.Button,{onClick:g,children:s})]}):l;return e.jsx(i.Dialog,{open:a,onOpenChange:r,children:e.jsxs(i.DialogContent,{"aria-describedby":m,showCloseButton:j,positionX:x,positionY:h,className:o?.content,children:[t&&e.jsx(i.DialogHeader,{className:o?.header,children:e.jsx(i.DialogTitle,{className:o?.title,children:t})}),e.jsx("div",{className:o?.body,children:u}),v]})})};exports.BasicModal=_;
|
|
2
2
|
//# sourceMappingURL=components-basic-modal-basic-modal.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-basic-modal-basic-modal.cjs","sources":["../src/components/basic-modal/basic-modal.tsx"],"sourcesContent":["import { Button } from \"../ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"../ui/dialog\";\n\ntype Props = {\n open: boolean;\n onOpenChange: (value: boolean) => void;\n title?: React.ReactNode | string;\n cancelLabel?: string;\n confirmLabel?: string;\n onConfirm?: () => void;\n classes?: {\n content?: string;\n header?: string;\n body?: string;\n footer?: string;\n title?: string;\n };\n children: React.ReactNode;\n footer?: React.ReactNode;\n showCloseButton?: boolean;\n ariaDescribedby?: string;\n}
|
|
1
|
+
{"version":3,"file":"components-basic-modal-basic-modal.cjs","sources":["../src/components/basic-modal/basic-modal.tsx"],"sourcesContent":["import { type VariantProps } from \"class-variance-authority\";\nimport { Button } from \"../ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"../ui/dialog\";\nimport type { dialogContentPositionVariants } from \"../ui/dialog/dialog.styles\";\n\ntype Props = {\n open: boolean;\n onOpenChange: (value: boolean) => void;\n title?: React.ReactNode | string;\n cancelLabel?: string;\n confirmLabel?: string;\n onConfirm?: () => void;\n classes?: {\n content?: string;\n header?: string;\n body?: string;\n footer?: string;\n title?: string;\n };\n children: React.ReactNode;\n footer?: React.ReactNode;\n showCloseButton?: boolean;\n ariaDescribedby?: string;\n} & VariantProps<typeof dialogContentPositionVariants>;\n\nexport const BasicModal = ({\n open,\n onOpenChange,\n title,\n cancelLabel = \"Отмена\",\n confirmLabel = \"Ок\",\n onConfirm,\n children,\n classes,\n footer,\n showCloseButton = false,\n ariaDescribedby = undefined,\n positionX,\n positionY,\n}: Props) => {\n const handleCancelClick = () => {\n onOpenChange(false);\n };\n\n const handleConfirmClick = () => {\n onConfirm?.();\n onOpenChange(false);\n };\n\n const resolvedFooter =\n footer === undefined ? (\n <DialogFooter className={classes?.footer}>\n <Button\n variant=\"secondary\"\n onClick={handleCancelClick}\n >\n {cancelLabel}\n </Button>\n <Button onClick={handleConfirmClick}>{confirmLabel}</Button>\n </DialogFooter>\n ) : (\n footer\n );\n\n return (\n <Dialog\n open={open}\n onOpenChange={onOpenChange}\n >\n <DialogContent\n aria-describedby={ariaDescribedby}\n showCloseButton={showCloseButton}\n positionX={positionX}\n positionY={positionY}\n className={classes?.content}\n >\n {title && (\n <DialogHeader className={classes?.header}>\n <DialogTitle className={classes?.title}>{title}</DialogTitle>\n </DialogHeader>\n )}\n <div className={classes?.body}>{children}</div>\n {resolvedFooter}\n </DialogContent>\n </Dialog>\n );\n};\n"],"names":["BasicModal","open","onOpenChange","title","cancelLabel","confirmLabel","onConfirm","children","classes","footer","showCloseButton","ariaDescribedby","positionX","positionY","handleCancelClick","handleConfirmClick","resolvedFooter","DialogFooter","jsx","Button","Dialog","jsxs","DialogContent","DialogHeader","DialogTitle"],"mappings":"uTA+BaA,EAAa,CAAC,CACzB,KAAAC,EACA,aAAAC,EACA,MAAAC,EACA,YAAAC,EAAc,SACd,aAAAC,EAAe,KACf,UAAAC,EACA,SAAAC,EACA,QAAAC,EACA,OAAAC,EACA,gBAAAC,EAAkB,GAClB,gBAAAC,EAAkB,OAClB,UAAAC,EACA,UAAAC,CACF,IAAa,CACX,MAAMC,EAAoB,IAAM,CAC9BZ,EAAa,EAAK,CACpB,EAEMa,EAAqB,IAAM,CAC/BT,IAAA,EACAJ,EAAa,EAAK,CACpB,EAEMc,EACJP,IAAW,cACRQ,eAAA,CAAa,UAAWT,GAAS,OAChC,SAAA,CAAAU,EAAAA,IAACC,EAAAA,OAAA,CACC,QAAQ,YACR,QAASL,EAER,SAAAV,CAAA,CAAA,EAEHc,EAAAA,IAACC,EAAAA,OAAA,CAAO,QAASJ,EAAqB,SAAAV,CAAA,CAAa,CAAA,CAAA,CACrD,EAEAI,EAGJ,OACES,EAAAA,IAACE,EAAAA,OAAA,CACC,KAAAnB,EACA,aAAAC,EAEA,SAAAmB,EAAAA,KAACC,EAAAA,cAAA,CACC,mBAAkBX,EAClB,gBAAAD,EACA,UAAAE,EACA,UAAAC,EACA,UAAWL,GAAS,QAEnB,SAAA,CAAAL,GACCe,EAAAA,IAACK,eAAA,CAAa,UAAWf,GAAS,OAChC,SAAAU,EAAAA,IAACM,EAAAA,YAAA,CAAY,UAAWhB,GAAS,MAAQ,SAAAL,CAAA,CAAM,EACjD,EAEFe,EAAAA,IAAC,MAAA,CAAI,UAAWV,GAAS,KAAO,SAAAD,EAAS,EACxCS,CAAA,CAAA,CAAA,CACH,CAAA,CAGN"}
|
|
@@ -1,49 +1,55 @@
|
|
|
1
1
|
import { jsxs as a, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import "class-variance-authority";
|
|
2
3
|
import { Button as c } from "./components-ui-button-button.js";
|
|
3
4
|
import "./components-ui-button-button.styles.js";
|
|
4
|
-
import { DialogFooter as
|
|
5
|
-
const
|
|
6
|
-
open:
|
|
5
|
+
import { DialogFooter as p, Dialog as b, DialogContent as g, DialogHeader as x, DialogTitle as y } from "./components-ui-dialog-dialog.js";
|
|
6
|
+
const M = ({
|
|
7
|
+
open: t,
|
|
7
8
|
onOpenChange: r,
|
|
8
|
-
title:
|
|
9
|
-
cancelLabel:
|
|
9
|
+
title: e,
|
|
10
|
+
cancelLabel: d = "Отмена",
|
|
10
11
|
confirmLabel: n = "Ок",
|
|
11
|
-
onConfirm:
|
|
12
|
-
children:
|
|
12
|
+
onConfirm: m,
|
|
13
|
+
children: s,
|
|
13
14
|
classes: i,
|
|
14
|
-
footer:
|
|
15
|
+
footer: l,
|
|
15
16
|
showCloseButton: h = !1,
|
|
16
|
-
ariaDescribedby: f = void 0
|
|
17
|
+
ariaDescribedby: f = void 0,
|
|
18
|
+
positionX: v,
|
|
19
|
+
positionY: C
|
|
17
20
|
}) => {
|
|
18
|
-
const
|
|
21
|
+
const D = () => {
|
|
19
22
|
r(!1);
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
+
}, N = () => {
|
|
24
|
+
m?.(), r(!1);
|
|
25
|
+
}, k = l === void 0 ? /* @__PURE__ */ a(p, { className: i?.footer, children: [
|
|
23
26
|
/* @__PURE__ */ o(
|
|
24
27
|
c,
|
|
25
28
|
{
|
|
26
29
|
variant: "secondary",
|
|
27
|
-
onClick:
|
|
28
|
-
children:
|
|
30
|
+
onClick: D,
|
|
31
|
+
children: d
|
|
29
32
|
}
|
|
30
33
|
),
|
|
31
|
-
/* @__PURE__ */ o(c, { onClick:
|
|
32
|
-
] }) :
|
|
34
|
+
/* @__PURE__ */ o(c, { onClick: N, children: n })
|
|
35
|
+
] }) : l;
|
|
33
36
|
return /* @__PURE__ */ o(
|
|
34
|
-
|
|
37
|
+
b,
|
|
35
38
|
{
|
|
36
|
-
open:
|
|
39
|
+
open: t,
|
|
37
40
|
onOpenChange: r,
|
|
38
41
|
children: /* @__PURE__ */ a(
|
|
39
|
-
|
|
42
|
+
g,
|
|
40
43
|
{
|
|
41
44
|
"aria-describedby": f,
|
|
42
45
|
showCloseButton: h,
|
|
46
|
+
positionX: v,
|
|
47
|
+
positionY: C,
|
|
48
|
+
className: i?.content,
|
|
43
49
|
children: [
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */ o("div", { className: i?.body, children:
|
|
46
|
-
|
|
50
|
+
e && /* @__PURE__ */ o(x, { className: i?.header, children: /* @__PURE__ */ o(y, { className: i?.title, children: e }) }),
|
|
51
|
+
/* @__PURE__ */ o("div", { className: i?.body, children: s }),
|
|
52
|
+
k
|
|
47
53
|
]
|
|
48
54
|
}
|
|
49
55
|
)
|
|
@@ -51,6 +57,6 @@ const B = ({
|
|
|
51
57
|
);
|
|
52
58
|
};
|
|
53
59
|
export {
|
|
54
|
-
|
|
60
|
+
M as BasicModal
|
|
55
61
|
};
|
|
56
62
|
//# sourceMappingURL=components-basic-modal-basic-modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-basic-modal-basic-modal.js","sources":["../src/components/basic-modal/basic-modal.tsx"],"sourcesContent":["import { Button } from \"../ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"../ui/dialog\";\n\ntype Props = {\n open: boolean;\n onOpenChange: (value: boolean) => void;\n title?: React.ReactNode | string;\n cancelLabel?: string;\n confirmLabel?: string;\n onConfirm?: () => void;\n classes?: {\n content?: string;\n header?: string;\n body?: string;\n footer?: string;\n title?: string;\n };\n children: React.ReactNode;\n footer?: React.ReactNode;\n showCloseButton?: boolean;\n ariaDescribedby?: string;\n}
|
|
1
|
+
{"version":3,"file":"components-basic-modal-basic-modal.js","sources":["../src/components/basic-modal/basic-modal.tsx"],"sourcesContent":["import { type VariantProps } from \"class-variance-authority\";\nimport { Button } from \"../ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"../ui/dialog\";\nimport type { dialogContentPositionVariants } from \"../ui/dialog/dialog.styles\";\n\ntype Props = {\n open: boolean;\n onOpenChange: (value: boolean) => void;\n title?: React.ReactNode | string;\n cancelLabel?: string;\n confirmLabel?: string;\n onConfirm?: () => void;\n classes?: {\n content?: string;\n header?: string;\n body?: string;\n footer?: string;\n title?: string;\n };\n children: React.ReactNode;\n footer?: React.ReactNode;\n showCloseButton?: boolean;\n ariaDescribedby?: string;\n} & VariantProps<typeof dialogContentPositionVariants>;\n\nexport const BasicModal = ({\n open,\n onOpenChange,\n title,\n cancelLabel = \"Отмена\",\n confirmLabel = \"Ок\",\n onConfirm,\n children,\n classes,\n footer,\n showCloseButton = false,\n ariaDescribedby = undefined,\n positionX,\n positionY,\n}: Props) => {\n const handleCancelClick = () => {\n onOpenChange(false);\n };\n\n const handleConfirmClick = () => {\n onConfirm?.();\n onOpenChange(false);\n };\n\n const resolvedFooter =\n footer === undefined ? (\n <DialogFooter className={classes?.footer}>\n <Button\n variant=\"secondary\"\n onClick={handleCancelClick}\n >\n {cancelLabel}\n </Button>\n <Button onClick={handleConfirmClick}>{confirmLabel}</Button>\n </DialogFooter>\n ) : (\n footer\n );\n\n return (\n <Dialog\n open={open}\n onOpenChange={onOpenChange}\n >\n <DialogContent\n aria-describedby={ariaDescribedby}\n showCloseButton={showCloseButton}\n positionX={positionX}\n positionY={positionY}\n className={classes?.content}\n >\n {title && (\n <DialogHeader className={classes?.header}>\n <DialogTitle className={classes?.title}>{title}</DialogTitle>\n </DialogHeader>\n )}\n <div className={classes?.body}>{children}</div>\n {resolvedFooter}\n </DialogContent>\n </Dialog>\n );\n};\n"],"names":["BasicModal","open","onOpenChange","title","cancelLabel","confirmLabel","onConfirm","children","classes","footer","showCloseButton","ariaDescribedby","positionX","positionY","handleCancelClick","handleConfirmClick","resolvedFooter","DialogFooter","jsx","Button","Dialog","jsxs","DialogContent","DialogHeader","DialogTitle"],"mappings":";;;;;AA+BO,MAAMA,IAAa,CAAC;AAAA,EACzB,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,iBAAAC,IAAkB;AAAA,EAClB,WAAAC;AAAA,EACA,WAAAC;AACF,MAAa;AACX,QAAMC,IAAoB,MAAM;AAC9B,IAAAZ,EAAa,EAAK;AAAA,EACpB,GAEMa,IAAqB,MAAM;AAC/B,IAAAT,IAAA,GACAJ,EAAa,EAAK;AAAA,EACpB,GAEMc,IACJP,MAAW,2BACRQ,GAAA,EAAa,WAAWT,GAAS,QAChC,UAAA;AAAA,IAAA,gBAAAU;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,SAASL;AAAA,QAER,UAAAV;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH,gBAAAc,EAACC,GAAA,EAAO,SAASJ,GAAqB,UAAAV,EAAA,CAAa;AAAA,EAAA,EAAA,CACrD,IAEAI;AAGJ,SACE,gBAAAS;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,MAAAnB;AAAA,MACA,cAAAC;AAAA,MAEA,UAAA,gBAAAmB;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,oBAAkBX;AAAA,UAClB,iBAAAD;AAAA,UACA,WAAAE;AAAA,UACA,WAAAC;AAAA,UACA,WAAWL,GAAS;AAAA,UAEnB,UAAA;AAAA,YAAAL,KACC,gBAAAe,EAACK,GAAA,EAAa,WAAWf,GAAS,QAChC,UAAA,gBAAAU,EAACM,GAAA,EAAY,WAAWhB,GAAS,OAAQ,UAAAL,EAAA,CAAM,GACjD;AAAA,YAEF,gBAAAe,EAAC,OAAA,EAAI,WAAWV,GAAS,MAAO,UAAAD,GAAS;AAAA,YACxCS;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./brd-ui-kit.css');const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./brd-ui-kit.css');const r=require("react/jsx-runtime"),P=require("phosphor-strokes-icons/icons/CaretDown"),j=require("phosphor-strokes-icons/icons/CaretUp"),_=require("phosphor-strokes-icons/icons/EnvelopeSimple"),k=require("phosphor-strokes-icons/icons/MaxLogo"),S=require("phosphor-strokes-icons/icons/Phone"),i=require("./components-icons-stroke-icon.cjs"),T=require("phosphor-strokes-icons/icons/TelegramLogo"),L=require("phosphor-strokes-icons/icons/WhatsAppLogoFilled");;/* empty css */const b=require("./lib-utils.cjs");require("class-variance-authority");require("./components-ui-badge-badge.styles.cjs");const z=require("./components-ui-button-button.cjs");require("./components-ui-button-button.styles.cjs");require("./components-ui-card-card.cjs");require("./components-ui-checkbox-checkbox.cjs");const F=require("./hooks-usePopupControls.cjs");require("./calendar-PqChui7l.cjs");require("phosphor-strokes-icons/icons");require("./components-ui-combobox-combobox.cjs");require("./components-ui-dialog-dialog.cjs");const c=require("react");require("./components-ui-label-label.cjs");require("./components-ui-separator-separator.cjs");require("./components-ui-field-field.styles.cjs");require("./components-ui-input-input.styles.cjs");require("./components-ui-textarea-textarea.cjs");require("./components-ui-input-group-input-group.styles.cjs");require("./components-ui-navigation-item-navigation-item.styles.cjs");require("./components-ui-navigation-menu-navigation-menu.styles.cjs");require("./components-ui-pagination-pagination.cjs");require("./components-ui-progress-progress.cjs");require("./components-ui-radio-group-radio-group.cjs");require("./components-ui-switch-switch.cjs");require("./components-ui-toggle-toggle.styles.cjs");require("./components-ui-toggle-group-toggle-group.cjs");require("./components-ui-table-table.cjs");require("./components-ui-tabs-tabs.cjs");require("./components-ui-tooltip-tooltip.cjs");require("./components-ui-typography-typography.styles.cjs");require("phosphor-strokes-icons/icons/CaretLeft");require("phosphor-strokes-icons/icons/CaretRight");require("./components-app-pagination-app-pagination.styles.cjs");require("phosphor-strokes-icons/icons/CaretUpDown");require("./components-app-sidebar-app-sidebar.styles.cjs");require("./components-data-table-data-table.styles.cjs");require("./components-ui-dropdown-menu-dropdown-menu.styles.cjs");const N=require("./components-input-field-input-field.cjs");require("phosphor-strokes-icons/icons/Eye");require("phosphor-strokes-icons/icons/EyeSlash");require("./components-select-field-select-field.cjs");require("./lodash-kqhtUJfz.cjs");require("./chart-9H_9wEfR.cjs");require("phosphor-strokes-icons/icons/CheckCircle");require("phosphor-strokes-icons/icons/Info");require("phosphor-strokes-icons/icons/SpinnerGap");require("phosphor-strokes-icons/icons/Warning");require("phosphor-strokes-icons/icons/X");require("phosphor-strokes-icons/icons/XCircle");require("./index-DGxwh2Ms.cjs");require("./index-fTTv8YY8.cjs");require("phosphor-strokes-icons/icons/Plus");const D=require("./components-input-phone-input-phone.cjs");require("./components-card-info-card-info.styles.cjs");const E=[{label:"Мобильный",icon:"phone"},{label:"Telegram",icon:"telegram-logo"},{label:"WhatsApp",icon:"whats-app-logo-filled"},{label:"Max",icon:"max-logo"},{label:"E-mail",icon:"envelope-simple"}],h={phone:S.Phone,"telegram-logo":T.TelegramLogo,"whats-app-logo-filled":L.WhatsAppLogoFilled,"max-logo":k.MaxLogo,"envelope-simple":_.EnvelopeSimple},x=o=>{switch(o){case"max-logo":return{bgColor:"bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]"};case"telegram-logo":return{bgColor:"bg-[#289AD2]"};case"whats-app-logo-filled":return{bgColor:"bg-[#00C202]",textColor:"text-primary-inverse-text"};default:return{}}},a=o=>({wrapper:b.cn(`flex h-5.5 w-5.5 shrink-0 items-center justify-center rounded-sm
|
|
2
2
|
${x(o).bgColor??"bg-primary-inverse-hover-bg"}
|
|
3
|
-
${x(o).textColor??"text-primary-inverse-text"}`),icon:"size-5 shrink-0"}),O=o=>{const{inputProps:
|
|
4
|
-
flex-col rounded-xl border`,ref:l,children:E.map(({label:e,icon:t})=>{const
|
|
3
|
+
${x(o).textColor??"text-primary-inverse-text"}`),icon:"size-5 shrink-0"}),O=o=>{const{inputProps:C,inputPhoneProps:f,onTypeChange:v,...p}=o,[n,I]=c.useState("phone"),{isOpened:s,openPopup:q,closePopup:u}=F.usePopupControls(),l=c.useRef(null);c.useEffect(()=>{const e=t=>{l.current&&!l.current.contains(t.target)&&u()};return s&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[s,u]);const m=e=>{switch(e){case"phone":return"+7 (999) 999-99-99";case"telegram-logo":return"@username";case"whats-app-logo-filled":return"+7 (999) 999-99-99";case"max-logo":return"ID пользователя Max";case"envelope-simple":return"example@mail.com";default:return"Введите значение"}},w=e=>()=>{I(e),v?.(e),u()},d=h[n],g=s?j.CaretUp:P.CaretDown;return r.jsxs("div",{className:b.cn("relative",o.classes?.container),children:[["telegram-logo","max-logo","envelope-simple"].includes(n)?r.jsx(N.InputField,{...C,...p,date:[{id:"0",position:"inline-start",component:r.jsx(i.StrokeIcon,{icon:d,size:"medium",classes:a(n)})},{id:"1",position:"inline-end",component:r.jsx(i.StrokeIcon,{icon:g,size:"medium",className:"cursor-pointer",onClick:q})}],placeholder:m(n)}):r.jsx(D.InputPhone,{...f,...p,date:[{id:"0",position:"inline-start",component:r.jsx(i.StrokeIcon,{icon:d,size:"medium",classes:a(n)})},{id:"1",position:"inline-end",component:r.jsx(i.StrokeIcon,{icon:g,size:"medium",className:"cursor-pointer",onClick:q})}],placeholder:m(n)}),s&&r.jsx("div",{className:`border-inp-hover-border bg-primary-bg absolute z-100 my-2 flex w-full
|
|
4
|
+
flex-col rounded-xl border`,ref:l,children:E.map(({label:e,icon:t})=>{const y=h[t];return r.jsxs(z.Button,{variant:"ghost",className:"flex w-full justify-start",type:"button",onClick:w(t),children:[r.jsx(i.StrokeIcon,{icon:y,size:"medium",className:"text-primary-inverse-text",classes:a(t)}),e]},e)})})]})};exports.InputContact=O;
|
|
5
5
|
//# sourceMappingURL=components-input-contact-input-contact.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-input-contact-input-contact.cjs","sources":["../src/constants/contact-input.ts","../src/components/input-contact/input-contact.tsx"],"sourcesContent":["import type { TOption } from \"@/components/input-contact/input-contact\";\n\nexport const OPTIONS: TOption[] = [\n {\n label: \"Мобильный\",\n icon: \"phone\",\n },\n {\n label: \"Telegram\",\n icon: \"telegram-logo\",\n },\n {\n label: \"WhatsApp\",\n icon: \"whats-app-logo-filled\",\n },\n {\n label: \"Max\",\n icon: \"max-logo\",\n },\n {\n label: \"E-mail\",\n icon: \"envelope-simple\",\n },\n];\n","import { OPTIONS } from \"@/constants/contact-input\";\nimport { CaretDown } from \"@/components/icons/CaretDown\";\nimport { CaretUp } from \"@/components/icons/CaretUp\";\nimport { EnvelopeSimple } from \"@/components/icons/EnvelopeSimple\";\nimport { MaxLogo } from \"@/components/icons/MaxLogo\";\nimport { Phone } from \"@/components/icons/Phone\";\nimport { StrokeIcon, type StrokeIconComponent } from \"@/components/icons/stroke-icon\";\nimport { TelegramLogo } from \"@/components/icons/TelegramLogo\";\nimport { WhatsAppLogoFilled } from \"@/components/icons/WhatsAppLogoFilled\";\nimport {\n Button,\n InputField,\n InputPhone,\n cn,\n usePopupControls,\n type InputPhoneProps,\n} from \"@/index\";\nimport { useEffect, useRef, useState } from \"react\";\n\nexport type TOption = {\n label: string;\n icon: TypesChange;\n};\n\ntype TypesChange =\n | \"phone\"\n | \"telegram-logo\"\n | \"whats-app-logo-filled\"\n | \"max-logo\"\n | \"envelope-simple\";\n\nconst contactIcons: Record<TypesChange, StrokeIconComponent> = {\n phone: Phone,\n \"telegram-logo\": TelegramLogo,\n \"whats-app-logo-filled\": WhatsAppLogoFilled,\n \"max-logo\": MaxLogo,\n \"envelope-simple\": EnvelopeSimple,\n};\n\ntype Props = {\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n container?: string;\n };\n value?: string;\n name?: string;\n onTypeChange?: (type: TypesChange) => void;\n inputProps: React.ComponentPropsWithRef<\"input\">;\n inputPhoneProps: InputPhoneProps;\n};\n\n// TODO: заменить цвета\nconst iconStyles = (icon: TypesChange) => {\n switch (icon) {\n case \"max-logo\":\n return {\n bgColor: \"bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]\",\n };\n\n case \"telegram-logo\":\n return {\n bgColor: \"bg-[#289AD2]\",\n };\n\n case \"whats-app-logo-filled\":\n return {\n bgColor: \"bg-[#00C202]\",\n textColor: \"text-[#00C202]\",\n };\n\n default:\n return {};\n }\n};\n\nconst getContactIconClasses = (icon: TypesChange) => ({\n wrapper: cn(\n `flex h-5.5 w-5.5 shrink-0 items-center justify-center rounded-sm\n ${iconStyles(icon).bgColor ?? \"bg-primary-inverse-hover-bg\"}\n ${iconStyles(icon).textColor ?? \"text-primary-inverse-text\"}`,\n ),\n icon: \"size-5 shrink-0\",\n});\n\nexport const InputContact = (props: Props) => {\n const { inputProps, inputPhoneProps, onTypeChange, ...rest } = props;\n\n const [type, setType] = useState<TypesChange>(\"phone\");\n const { isOpened, openPopup, closePopup } = usePopupControls();\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) {\n closePopup();\n }\n };\n\n if (isOpened) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [isOpened, closePopup]);\n\n const getPlaceholder = (type: TypesChange): string => {\n switch (type) {\n case \"phone\":\n return \"+7 (999) 999-99-99\";\n case \"telegram-logo\":\n return \"@username\";\n case \"whats-app-logo-filled\":\n return \"+7 (999) 999-99-99\";\n case \"max-logo\":\n return \"ID пользователя Max\";\n case \"envelope-simple\":\n return \"example@mail.com\";\n default:\n return \"Введите значение\";\n }\n };\n\n const handleTypeChange = (type: TypesChange) => {\n return () => {\n setType(type);\n onTypeChange?.(type);\n closePopup();\n };\n };\n\n const SelectedIcon = contactIcons[type];\n const ToggleIcon = isOpened ? CaretUp : CaretDown;\n\n return (\n <div className={cn(\"relative\", props.classes?.container)}>\n {[\"telegram-logo\", \"max-logo\", \"envelope-simple\"].includes(type) ? (\n <InputField\n {...inputProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n ) : (\n <InputPhone\n {...inputPhoneProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n )}\n\n {isOpened && (\n <div\n className=\"border-inp-hover-border bg-primary-bg absolute my-2 flex w-full\n flex-col rounded-xl border\"\n ref={wrapperRef}\n >\n {OPTIONS.map(({ label, icon }) => {\n const OptionIcon = contactIcons[icon];\n\n return (\n <Button\n key={label}\n variant=\"ghost\"\n className=\"flex w-full justify-start\"\n type=\"button\"\n onClick={handleTypeChange(icon)}\n >\n <StrokeIcon\n icon={OptionIcon}\n size=\"medium\"\n className=\"text-primary-inverse-text\"\n classes={getContactIconClasses(icon)}\n />\n\n {label}\n </Button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport type { Props as InputContactProps, TypesChange };\n"],"names":["OPTIONS","contactIcons","Phone","TelegramLogo","WhatsAppLogoFilled","MaxLogo","EnvelopeSimple","iconStyles","icon","getContactIconClasses","cn","InputContact","props","inputProps","inputPhoneProps","onTypeChange","rest","type","setType","useState","isOpened","openPopup","closePopup","usePopupControls","wrapperRef","useRef","useEffect","handleClickOutside","event","getPlaceholder","handleTypeChange","SelectedIcon","ToggleIcon","CaretUp","CaretDown","jsxs","jsx","InputField","StrokeIcon","InputPhone","label","OptionIcon","Button"],"mappings":"2rGAEO,MAAMA,EAA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,CAAI,CAAA,CAAA,EAInCG,GACCgB,EAAAA,IAAC,MAAA,CACC,UAAU;AAAA,wCAEV,IAAKZ,EAEJ,WAAQ,IAAI,CAAC,CAAE,MAAAgB,EAAO,KAAAhC,KAAW,CAChC,MAAMiC,EAAaxC,EAAaO,CAAI,EAEpC,OACE2B,EAAAA,KAACO,EAAAA,OAAA,CAEC,QAAQ,QACR,UAAU,4BACV,KAAK,SACL,QAASZ,EAAiBtB,CAAI,EAE9B,SAAA,CAAA4B,EAAAA,IAACE,EAAAA,WAAA,CACC,KAAMG,EACN,KAAK,SACL,UAAU,4BACV,QAAShC,EAAsBD,CAAI,CAAA,CAAA,EAGpCgC,CAAA,CAAA,EAbIA,CAAA,CAgBX,CAAC,CAAA,CAAA,CACH,EAEJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"components-input-contact-input-contact.cjs","sources":["../src/constants/contact-input.ts","../src/components/input-contact/input-contact.tsx"],"sourcesContent":["import type { TOption } from \"@/components/input-contact/input-contact\";\n\nexport const OPTIONS: TOption[] = [\n {\n label: \"Мобильный\",\n icon: \"phone\",\n },\n {\n label: \"Telegram\",\n icon: \"telegram-logo\",\n },\n {\n label: \"WhatsApp\",\n icon: \"whats-app-logo-filled\",\n },\n {\n label: \"Max\",\n icon: \"max-logo\",\n },\n {\n label: \"E-mail\",\n icon: \"envelope-simple\",\n },\n];\n","import { OPTIONS } from \"@/constants/contact-input\";\nimport { CaretDown } from \"@/components/icons/CaretDown\";\nimport { CaretUp } from \"@/components/icons/CaretUp\";\nimport { EnvelopeSimple } from \"@/components/icons/EnvelopeSimple\";\nimport { MaxLogo } from \"@/components/icons/MaxLogo\";\nimport { Phone } from \"@/components/icons/Phone\";\nimport { StrokeIcon, type StrokeIconComponent } from \"@/components/icons/stroke-icon\";\nimport { TelegramLogo } from \"@/components/icons/TelegramLogo\";\nimport { WhatsAppLogoFilled } from \"@/components/icons/WhatsAppLogoFilled\";\nimport {\n Button,\n InputField,\n InputPhone,\n cn,\n usePopupControls,\n type InputPhoneProps,\n} from \"@/index\";\nimport { useEffect, useRef, useState } from \"react\";\n\nexport type TOption = {\n label: string;\n icon: TypesChange;\n};\n\ntype TypesChange =\n | \"phone\"\n | \"telegram-logo\"\n | \"whats-app-logo-filled\"\n | \"max-logo\"\n | \"envelope-simple\";\n\nconst contactIcons: Record<TypesChange, StrokeIconComponent> = {\n phone: Phone,\n \"telegram-logo\": TelegramLogo,\n \"whats-app-logo-filled\": WhatsAppLogoFilled,\n \"max-logo\": MaxLogo,\n \"envelope-simple\": EnvelopeSimple,\n};\n\ntype Props = {\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n container?: string;\n };\n value?: string;\n name?: string;\n onTypeChange?: (type: TypesChange) => void;\n inputProps: React.ComponentPropsWithRef<\"input\">;\n inputPhoneProps: InputPhoneProps;\n};\n\n// TODO: заменить цвета\nconst iconStyles = (icon: TypesChange) => {\n switch (icon) {\n case \"max-logo\":\n return {\n bgColor: \"bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]\",\n };\n\n case \"telegram-logo\":\n return {\n bgColor: \"bg-[#289AD2]\",\n };\n\n case \"whats-app-logo-filled\":\n return {\n bgColor: \"bg-[#00C202]\",\n textColor: \"text-primary-inverse-text\",\n };\n\n default:\n return {};\n }\n};\n\nconst getContactIconClasses = (icon: TypesChange) => ({\n wrapper: cn(\n `flex h-5.5 w-5.5 shrink-0 items-center justify-center rounded-sm\n ${iconStyles(icon).bgColor ?? \"bg-primary-inverse-hover-bg\"}\n ${iconStyles(icon).textColor ?? \"text-primary-inverse-text\"}`,\n ),\n icon: \"size-5 shrink-0\",\n});\n\nexport const InputContact = (props: Props) => {\n const { inputProps, inputPhoneProps, onTypeChange, ...rest } = props;\n\n const [type, setType] = useState<TypesChange>(\"phone\");\n const { isOpened, openPopup, closePopup } = usePopupControls();\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) {\n closePopup();\n }\n };\n\n if (isOpened) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [isOpened, closePopup]);\n\n const getPlaceholder = (type: TypesChange): string => {\n switch (type) {\n case \"phone\":\n return \"+7 (999) 999-99-99\";\n case \"telegram-logo\":\n return \"@username\";\n case \"whats-app-logo-filled\":\n return \"+7 (999) 999-99-99\";\n case \"max-logo\":\n return \"ID пользователя Max\";\n case \"envelope-simple\":\n return \"example@mail.com\";\n default:\n return \"Введите значение\";\n }\n };\n\n const handleTypeChange = (type: TypesChange) => {\n return () => {\n setType(type);\n onTypeChange?.(type);\n closePopup();\n };\n };\n\n const SelectedIcon = contactIcons[type];\n const ToggleIcon = isOpened ? CaretUp : CaretDown;\n\n return (\n <div className={cn(\"relative\", props.classes?.container)}>\n {[\"telegram-logo\", \"max-logo\", \"envelope-simple\"].includes(type) ? (\n <InputField\n {...inputProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n ) : (\n <InputPhone\n {...inputPhoneProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n )}\n\n {isOpened && (\n <div\n className=\"border-inp-hover-border bg-primary-bg absolute z-100 my-2 flex w-full\n flex-col rounded-xl border\"\n ref={wrapperRef}\n >\n {OPTIONS.map(({ label, icon }) => {\n const OptionIcon = contactIcons[icon];\n\n return (\n <Button\n key={label}\n variant=\"ghost\"\n className=\"flex w-full justify-start\"\n type=\"button\"\n onClick={handleTypeChange(icon)}\n >\n <StrokeIcon\n icon={OptionIcon}\n size=\"medium\"\n className=\"text-primary-inverse-text\"\n classes={getContactIconClasses(icon)}\n />\n\n {label}\n </Button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport type { Props as InputContactProps, TypesChange };\n"],"names":["OPTIONS","contactIcons","Phone","TelegramLogo","WhatsAppLogoFilled","MaxLogo","EnvelopeSimple","iconStyles","icon","getContactIconClasses","cn","InputContact","props","inputProps","inputPhoneProps","onTypeChange","rest","type","setType","useState","isOpened","openPopup","closePopup","usePopupControls","wrapperRef","useRef","useEffect","handleClickOutside","event","getPlaceholder","handleTypeChange","SelectedIcon","ToggleIcon","CaretUp","CaretDown","jsxs","jsx","InputField","StrokeIcon","InputPhone","label","OptionIcon","Button"],"mappings":"2rGAEO,MAAMA,EAAqB,CAChC,CACE,MAAO,YACP,KAAM,OAAA,EAER,CACE,MAAO,WACP,KAAM,eAAA,EAER,CACE,MAAO,WACP,KAAM,uBAAA,EAER,CACE,MAAO,MACP,KAAM,UAAA,EAER,CACE,MAAO,SACP,KAAM,iBAAA,CAEV,ECQMC,EAAyD,CAC7D,MAAOC,EAAAA,MACP,gBAAiBC,EAAAA,aACjB,wBAAyBC,EAAAA,mBACzB,WAAYC,EAAAA,QACZ,kBAAmBC,EAAAA,cACrB,EAoBMC,EAAcC,GAAsB,CACxC,OAAQA,EAAA,CACN,IAAK,WACH,MAAO,CACL,QAAS,kEAAA,EAGb,IAAK,gBACH,MAAO,CACL,QAAS,cAAA,EAGb,IAAK,wBACH,MAAO,CACL,QAAS,eACT,UAA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H,EAEJ,CAEJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as f, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { CaretDown as k } from "phosphor-strokes-icons/icons/CaretDown";
|
|
3
|
-
import { CaretUp as
|
|
4
|
-
import { EnvelopeSimple as
|
|
5
|
-
import { MaxLogo as
|
|
3
|
+
import { CaretUp as z } from "phosphor-strokes-icons/icons/CaretUp";
|
|
4
|
+
import { EnvelopeSimple as N } from "phosphor-strokes-icons/icons/EnvelopeSimple";
|
|
5
|
+
import { MaxLogo as T } from "phosphor-strokes-icons/icons/MaxLogo";
|
|
6
6
|
import { Phone as S } from "phosphor-strokes-icons/icons/Phone";
|
|
7
7
|
import { StrokeIcon as n } from "./components-icons-stroke-icon.js";
|
|
8
8
|
import { TelegramLogo as D } from "phosphor-strokes-icons/icons/TelegramLogo";
|
|
@@ -88,8 +88,8 @@ const B = [
|
|
|
88
88
|
phone: S,
|
|
89
89
|
"telegram-logo": D,
|
|
90
90
|
"whats-app-logo-filled": E,
|
|
91
|
-
"max-logo":
|
|
92
|
-
"envelope-simple":
|
|
91
|
+
"max-logo": T,
|
|
92
|
+
"envelope-simple": N
|
|
93
93
|
}, x = (t) => {
|
|
94
94
|
switch (t) {
|
|
95
95
|
case "max-logo":
|
|
@@ -103,7 +103,7 @@ const B = [
|
|
|
103
103
|
case "whats-app-logo-filled":
|
|
104
104
|
return {
|
|
105
105
|
bgColor: "bg-[#00C202]",
|
|
106
|
-
textColor: "text-
|
|
106
|
+
textColor: "text-primary-inverse-text"
|
|
107
107
|
};
|
|
108
108
|
default:
|
|
109
109
|
return {};
|
|
@@ -142,7 +142,7 @@ const B = [
|
|
|
142
142
|
}
|
|
143
143
|
}, I = (o) => () => {
|
|
144
144
|
y(o), w?.(o), p();
|
|
145
|
-
}, d = h[r], g = m ?
|
|
145
|
+
}, d = h[r], g = m ? z : k;
|
|
146
146
|
return /* @__PURE__ */ f("div", { className: C("relative", t.classes?.container), children: [
|
|
147
147
|
["telegram-logo", "max-logo", "envelope-simple"].includes(r) ? /* @__PURE__ */ e(
|
|
148
148
|
M,
|
|
@@ -216,7 +216,7 @@ const B = [
|
|
|
216
216
|
m && /* @__PURE__ */ e(
|
|
217
217
|
"div",
|
|
218
218
|
{
|
|
219
|
-
className: `border-inp-hover-border bg-primary-bg absolute my-2 flex w-full
|
|
219
|
+
className: `border-inp-hover-border bg-primary-bg absolute z-100 my-2 flex w-full
|
|
220
220
|
flex-col rounded-xl border`,
|
|
221
221
|
ref: l,
|
|
222
222
|
children: B.map(({ label: o, icon: i }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-input-contact-input-contact.js","sources":["../src/constants/contact-input.ts","../src/components/input-contact/input-contact.tsx"],"sourcesContent":["import type { TOption } from \"@/components/input-contact/input-contact\";\n\nexport const OPTIONS: TOption[] = [\n {\n label: \"Мобильный\",\n icon: \"phone\",\n },\n {\n label: \"Telegram\",\n icon: \"telegram-logo\",\n },\n {\n label: \"WhatsApp\",\n icon: \"whats-app-logo-filled\",\n },\n {\n label: \"Max\",\n icon: \"max-logo\",\n },\n {\n label: \"E-mail\",\n icon: \"envelope-simple\",\n },\n];\n","import { OPTIONS } from \"@/constants/contact-input\";\nimport { CaretDown } from \"@/components/icons/CaretDown\";\nimport { CaretUp } from \"@/components/icons/CaretUp\";\nimport { EnvelopeSimple } from \"@/components/icons/EnvelopeSimple\";\nimport { MaxLogo } from \"@/components/icons/MaxLogo\";\nimport { Phone } from \"@/components/icons/Phone\";\nimport { StrokeIcon, type StrokeIconComponent } from \"@/components/icons/stroke-icon\";\nimport { TelegramLogo } from \"@/components/icons/TelegramLogo\";\nimport { WhatsAppLogoFilled } from \"@/components/icons/WhatsAppLogoFilled\";\nimport {\n Button,\n InputField,\n InputPhone,\n cn,\n usePopupControls,\n type InputPhoneProps,\n} from \"@/index\";\nimport { useEffect, useRef, useState } from \"react\";\n\nexport type TOption = {\n label: string;\n icon: TypesChange;\n};\n\ntype TypesChange =\n | \"phone\"\n | \"telegram-logo\"\n | \"whats-app-logo-filled\"\n | \"max-logo\"\n | \"envelope-simple\";\n\nconst contactIcons: Record<TypesChange, StrokeIconComponent> = {\n phone: Phone,\n \"telegram-logo\": TelegramLogo,\n \"whats-app-logo-filled\": WhatsAppLogoFilled,\n \"max-logo\": MaxLogo,\n \"envelope-simple\": EnvelopeSimple,\n};\n\ntype Props = {\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n container?: string;\n };\n value?: string;\n name?: string;\n onTypeChange?: (type: TypesChange) => void;\n inputProps: React.ComponentPropsWithRef<\"input\">;\n inputPhoneProps: InputPhoneProps;\n};\n\n// TODO: заменить цвета\nconst iconStyles = (icon: TypesChange) => {\n switch (icon) {\n case \"max-logo\":\n return {\n bgColor: \"bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]\",\n };\n\n case \"telegram-logo\":\n return {\n bgColor: \"bg-[#289AD2]\",\n };\n\n case \"whats-app-logo-filled\":\n return {\n bgColor: \"bg-[#00C202]\",\n textColor: \"text-[#00C202]\",\n };\n\n default:\n return {};\n }\n};\n\nconst getContactIconClasses = (icon: TypesChange) => ({\n wrapper: cn(\n `flex h-5.5 w-5.5 shrink-0 items-center justify-center rounded-sm\n ${iconStyles(icon).bgColor ?? \"bg-primary-inverse-hover-bg\"}\n ${iconStyles(icon).textColor ?? \"text-primary-inverse-text\"}`,\n ),\n icon: \"size-5 shrink-0\",\n});\n\nexport const InputContact = (props: Props) => {\n const { inputProps, inputPhoneProps, onTypeChange, ...rest } = props;\n\n const [type, setType] = useState<TypesChange>(\"phone\");\n const { isOpened, openPopup, closePopup } = usePopupControls();\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) {\n closePopup();\n }\n };\n\n if (isOpened) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [isOpened, closePopup]);\n\n const getPlaceholder = (type: TypesChange): string => {\n switch (type) {\n case \"phone\":\n return \"+7 (999) 999-99-99\";\n case \"telegram-logo\":\n return \"@username\";\n case \"whats-app-logo-filled\":\n return \"+7 (999) 999-99-99\";\n case \"max-logo\":\n return \"ID пользователя Max\";\n case \"envelope-simple\":\n return \"example@mail.com\";\n default:\n return \"Введите значение\";\n }\n };\n\n const handleTypeChange = (type: TypesChange) => {\n return () => {\n setType(type);\n onTypeChange?.(type);\n closePopup();\n };\n };\n\n const SelectedIcon = contactIcons[type];\n const ToggleIcon = isOpened ? CaretUp : CaretDown;\n\n return (\n <div className={cn(\"relative\", props.classes?.container)}>\n {[\"telegram-logo\", \"max-logo\", \"envelope-simple\"].includes(type) ? (\n <InputField\n {...inputProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n ) : (\n <InputPhone\n {...inputPhoneProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n )}\n\n {isOpened && (\n <div\n className=\"border-inp-hover-border bg-primary-bg absolute my-2 flex w-full\n flex-col rounded-xl border\"\n ref={wrapperRef}\n >\n {OPTIONS.map(({ label, icon }) => {\n const OptionIcon = contactIcons[icon];\n\n return (\n <Button\n key={label}\n variant=\"ghost\"\n className=\"flex w-full justify-start\"\n type=\"button\"\n onClick={handleTypeChange(icon)}\n >\n <StrokeIcon\n icon={OptionIcon}\n size=\"medium\"\n className=\"text-primary-inverse-text\"\n classes={getContactIconClasses(icon)}\n />\n\n {label}\n </Button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport type { Props as InputContactProps, TypesChange };\n"],"names":["OPTIONS","contactIcons","Phone","TelegramLogo","WhatsAppLogoFilled","MaxLogo","EnvelopeSimple","iconStyles","icon","getContactIconClasses","cn","InputContact","props","inputProps","inputPhoneProps","onTypeChange","rest","type","setType","useState","isOpened","openPopup","closePopup","usePopupControls","wrapperRef","useRef","useEffect","handleClickOutside","event","getPlaceholder","handleTypeChange","SelectedIcon","ToggleIcon","CaretUp","CaretDown","jsxs","jsx","InputField","StrokeIcon","InputPhone","label","OptionIcon","Button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,IAAqB;AAAA,EAChC;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAEV,GCQMC,IAAyD;AAAA,EAC7D,OAAOC;AAAA,EACP,iBAAiBC;AAAA,EACjB,yBAAyBC;AAAA,EACzB,YAAYC;AAAA,EACZ,mBAAmBC;AACrB,GAoBMC,IAAa,CAACC,MAAsB;AACxC,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,S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AAA,gBACN,MAAK;AAAA,gBACL,WAAU;AAAA,gBACV,SAASX;AAAA,cAAA;AAAA,YAAA;AAAA,UACX;AAAA,QAEJ;AAAA,QAEF,aAAaQ,EAAeZ,CAAI;AAAA,MAAA;AAAA,IAAA;AAAA,IAInCG,KACC,gBAAAgB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA;AAAA,QAEV,KAAKZ;AAAA,QAEJ,YAAQ,IAAI,CAAC,EAAE,OAAAgB,GAAO,MAAAhC,QAAW;AAChC,gBAAMiC,IAAaxC,EAAaO,CAAI;AAEpC,iBACE,gBAAA2B;AAAA,YAACO;AAAA,YAAA;AAAA,cAEC,SAAQ;AAAA,cACR,WAAU;AAAA,cACV,MAAK;AAAA,cACL,SAASZ,EAAiBtB,CAAI;AAAA,cAE9B,UAAA;AAAA,gBAAA,gBAAA4B;AAAA,kBAACE;AAAA,kBAAA;AAAA,oBACC,MAAMG;AAAA,oBACN,MAAK;AAAA,oBACL,WAAU;AAAA,oBACV,SAAShC,EAAsBD,CAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGpCgC;AAAA,cAAA;AAAA,YAAA;AAAA,YAbIA;AAAA,UAAA;AAAA,QAgBX,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"components-input-contact-input-contact.js","sources":["../src/constants/contact-input.ts","../src/components/input-contact/input-contact.tsx"],"sourcesContent":["import type { TOption } from \"@/components/input-contact/input-contact\";\n\nexport const OPTIONS: TOption[] = [\n {\n label: \"Мобильный\",\n icon: \"phone\",\n },\n {\n label: \"Telegram\",\n icon: \"telegram-logo\",\n },\n {\n label: \"WhatsApp\",\n icon: \"whats-app-logo-filled\",\n },\n {\n label: \"Max\",\n icon: \"max-logo\",\n },\n {\n label: \"E-mail\",\n icon: \"envelope-simple\",\n },\n];\n","import { OPTIONS } from \"@/constants/contact-input\";\nimport { CaretDown } from \"@/components/icons/CaretDown\";\nimport { CaretUp } from \"@/components/icons/CaretUp\";\nimport { EnvelopeSimple } from \"@/components/icons/EnvelopeSimple\";\nimport { MaxLogo } from \"@/components/icons/MaxLogo\";\nimport { Phone } from \"@/components/icons/Phone\";\nimport { StrokeIcon, type StrokeIconComponent } from \"@/components/icons/stroke-icon\";\nimport { TelegramLogo } from \"@/components/icons/TelegramLogo\";\nimport { WhatsAppLogoFilled } from \"@/components/icons/WhatsAppLogoFilled\";\nimport {\n Button,\n InputField,\n InputPhone,\n cn,\n usePopupControls,\n type InputPhoneProps,\n} from \"@/index\";\nimport { useEffect, useRef, useState } from \"react\";\n\nexport type TOption = {\n label: string;\n icon: TypesChange;\n};\n\ntype TypesChange =\n | \"phone\"\n | \"telegram-logo\"\n | \"whats-app-logo-filled\"\n | \"max-logo\"\n | \"envelope-simple\";\n\nconst contactIcons: Record<TypesChange, StrokeIconComponent> = {\n phone: Phone,\n \"telegram-logo\": TelegramLogo,\n \"whats-app-logo-filled\": WhatsAppLogoFilled,\n \"max-logo\": MaxLogo,\n \"envelope-simple\": EnvelopeSimple,\n};\n\ntype Props = {\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n container?: string;\n };\n value?: string;\n name?: string;\n onTypeChange?: (type: TypesChange) => void;\n inputProps: React.ComponentPropsWithRef<\"input\">;\n inputPhoneProps: InputPhoneProps;\n};\n\n// TODO: заменить цвета\nconst iconStyles = (icon: TypesChange) => {\n switch (icon) {\n case \"max-logo\":\n return {\n bgColor: \"bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]\",\n };\n\n case \"telegram-logo\":\n return {\n bgColor: \"bg-[#289AD2]\",\n };\n\n case \"whats-app-logo-filled\":\n return {\n bgColor: \"bg-[#00C202]\",\n textColor: \"text-primary-inverse-text\",\n };\n\n default:\n return {};\n }\n};\n\nconst getContactIconClasses = (icon: TypesChange) => ({\n wrapper: cn(\n `flex h-5.5 w-5.5 shrink-0 items-center justify-center rounded-sm\n ${iconStyles(icon).bgColor ?? \"bg-primary-inverse-hover-bg\"}\n ${iconStyles(icon).textColor ?? \"text-primary-inverse-text\"}`,\n ),\n icon: \"size-5 shrink-0\",\n});\n\nexport const InputContact = (props: Props) => {\n const { inputProps, inputPhoneProps, onTypeChange, ...rest } = props;\n\n const [type, setType] = useState<TypesChange>(\"phone\");\n const { isOpened, openPopup, closePopup } = usePopupControls();\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) {\n closePopup();\n }\n };\n\n if (isOpened) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [isOpened, closePopup]);\n\n const getPlaceholder = (type: TypesChange): string => {\n switch (type) {\n case \"phone\":\n return \"+7 (999) 999-99-99\";\n case \"telegram-logo\":\n return \"@username\";\n case \"whats-app-logo-filled\":\n return \"+7 (999) 999-99-99\";\n case \"max-logo\":\n return \"ID пользователя Max\";\n case \"envelope-simple\":\n return \"example@mail.com\";\n default:\n return \"Введите значение\";\n }\n };\n\n const handleTypeChange = (type: TypesChange) => {\n return () => {\n setType(type);\n onTypeChange?.(type);\n closePopup();\n };\n };\n\n const SelectedIcon = contactIcons[type];\n const ToggleIcon = isOpened ? CaretUp : CaretDown;\n\n return (\n <div className={cn(\"relative\", props.classes?.container)}>\n {[\"telegram-logo\", \"max-logo\", \"envelope-simple\"].includes(type) ? (\n <InputField\n {...inputProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n ) : (\n <InputPhone\n {...inputPhoneProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n )}\n\n {isOpened && (\n <div\n className=\"border-inp-hover-border bg-primary-bg absolute z-100 my-2 flex w-full\n flex-col rounded-xl border\"\n ref={wrapperRef}\n >\n {OPTIONS.map(({ label, icon }) => {\n const OptionIcon = contactIcons[icon];\n\n return (\n <Button\n key={label}\n variant=\"ghost\"\n className=\"flex w-full justify-start\"\n type=\"button\"\n onClick={handleTypeChange(icon)}\n >\n <StrokeIcon\n icon={OptionIcon}\n size=\"medium\"\n className=\"text-primary-inverse-text\"\n classes={getContactIconClasses(icon)}\n />\n\n {label}\n </Button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport type { Props as InputContactProps, TypesChange };\n"],"names":["OPTIONS","contactIcons","Phone","TelegramLogo","WhatsAppLogoFilled","MaxLogo","EnvelopeSimple","iconStyles","icon","getContactIconClasses","cn","InputContact","props","inputProps","inputPhoneProps","onTypeChange","rest","type","setType","useState","isOpened","openPopup","closePopup","usePopupControls","wrapperRef","useRef","useEffect","handleClickOutside","event","getPlaceholder","handleTypeChange","SelectedIcon","ToggleIcon","CaretUp","CaretDown","jsxs","jsx","InputField","StrokeIcon","InputPhone","label","OptionIcon","Button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,IAAqB;AAAA,EAChC;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA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AAEJ;"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("./lib-utils.cjs"),f=require("./components-basic-tooltip-basic-tooltip.cjs"),i=require("./components-ui-button-button.cjs");require("./components-ui-button-button.styles.cjs");const t=require("./components-ui-icon-icon.cjs");require("phosphor-strokes-icons/icons");const o=require("./components-ui-typography-typography.cjs");require("./components-ui-typography-typography.styles.cjs");const N=({items:h,selectedSet:g,onSelectItem:u,onMoveItem:n,direction:x,headerIcon:l,headerButton:s,showHeaderTooltip:j=!1,showFooterIcons:d=!1})=>{const r=x==="right",p=r?"caret-right":"caret-left",y=r?"check-circle":"x-circle",m=r?"text-success-text":"text-error-text";return e.jsxs("div",{className:`bg-secondary-bg border-delicate-border flex h-full min-h-0 w-97.5
|
|
2
|
+
flex-col rounded-xl border`,children:[e.jsxs("div",{className:b.cn("bg-primary-bg flex items-center rounded-t-xl px-7.5 py-4",x==="left"?"gap-6":"justify-between"),children:[e.jsxs("div",{className:"w-fit",children:[s&&!r&&e.jsx(i.Button,{variant:"circleGhost",onClick:s.onClick,disabled:s.disabled,children:e.jsx(t.Icon,{type:s.icon,className:"text-placeholder-text"})}),j&&e.jsx(f.BasicTooltip,{place:"left",arrow:!0,text:e.jsx(o.Typography,{variant:"body-xxs-regular",className:"w-fit",children:"Переносите пункты туда или обратно с помощью клика на них"}),children:e.jsx(t.Icon,{type:"info",className:"text-placeholder-text"})}),l&&e.jsx(t.Icon,{type:l.type,className:l.className})]}),e.jsx(o.Typography,{variant:"body-lg-semibold",className:"text-primary-text",children:r?"Нужно для расчета":"Уже есть для расчета"}),s&&r&&e.jsx(i.Button,{variant:"circleGhost",onClick:s.onClick,disabled:s.disabled,children:e.jsx(t.Icon,{type:s.icon,className:"text-placeholder-text"})})]}),e.jsx("div",{className:`border-delicate-border flex min-h-0 flex-1 flex-col gap-2
|
|
3
|
+
overflow-y-auto border-t`,children:h.map(c=>e.jsxs("div",{className:b.cn(`bg-primary-bg flex cursor-pointer items-center justify-between gap-4 px-8
|
|
4
|
+
py-4`,g.has(c.id)&&"bg-primary-hover-bg"),onClick:()=>u(c.id),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[d?e.jsx(i.Button,{variant:"circleGhost",onClick:a=>{a.stopPropagation(),n(c.id)},children:e.jsx(t.Icon,{type:p,className:"text-placeholder-text"})}):e.jsx(t.Icon,{type:y,size:25,strokeWidth:1.5,className:m}),e.jsx(o.Typography,{variant:"body-md-regular",className:"text-primary-text",children:c.label})]}),d?e.jsx(t.Icon,{type:y,size:25,strokeWidth:1.5,className:m}):e.jsx(i.Button,{variant:"circleGhost",onClick:a=>{a.stopPropagation(),n(c.id)},children:e.jsx(t.Icon,{type:p,className:"text-placeholder-text"})})]},c.id))})]})};exports.TransferListCard=N;
|
|
2
5
|
//# sourceMappingURL=components-transfer-list-transfer-list-card.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-transfer-list-transfer-list-card.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"components-transfer-list-transfer-list-card.cjs","sources":["../src/components/transfer-list/transfer-list-card.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { BasicTooltip } from \"../basic-tooltip\";\nimport { Button } from \"../ui/button\";\nimport { Icon } from \"../ui/icon\";\nimport { Typography } from \"../ui/typography\";\nimport type { TransferListItem } from \"./transfer-list\";\nimport type { IconTypes } from \"@/types/types\";\n\ntype Props = {\n items: TransferListItem[];\n selectedSet: Set<string>;\n onSelectItem: (id: string) => void;\n onMoveItem: (itemId: string) => void;\n direction: \"left\" | \"right\";\n headerIcon?: {\n type: IconTypes;\n className: string;\n };\n headerButton?: {\n icon: IconTypes;\n onClick: () => void;\n disabled: boolean;\n };\n showHeaderTooltip?: boolean;\n showFooterIcons?: boolean;\n};\n\nexport const TransferListCard = ({\n items,\n selectedSet,\n onSelectItem,\n onMoveItem,\n direction,\n headerIcon,\n headerButton,\n showHeaderTooltip = false,\n showFooterIcons = false,\n}: Props) => {\n const isMovingToRight = direction === \"right\";\n const moveIcon = isMovingToRight ? \"caret-right\" : \"caret-left\";\n const footerIcon = isMovingToRight ? \"check-circle\" : \"x-circle\";\n const footerIconClassName = isMovingToRight ? \"text-success-text\" : \"text-error-text\";\n\n return (\n <div\n className=\"bg-secondary-bg border-delicate-border flex h-full min-h-0 w-97.5\n flex-col rounded-xl border\"\n >\n <div\n className={cn(\n \"bg-primary-bg flex items-center rounded-t-xl px-7.5 py-4\",\n direction === \"left\" ? \"gap-6\" : \"justify-between\",\n )}\n >\n <div className=\"w-fit\">\n {headerButton && !isMovingToRight && (\n <Button\n variant=\"circleGhost\"\n onClick={headerButton.onClick}\n disabled={headerButton.disabled}\n >\n <Icon\n type={headerButton.icon}\n className=\"text-placeholder-text\"\n />\n </Button>\n )}\n {showHeaderTooltip && (\n <BasicTooltip\n place=\"left\"\n arrow\n text={\n <Typography\n variant=\"body-xxs-regular\"\n className=\"w-fit\"\n >\n Переносите пункты туда или обратно с помощью клика на них\n </Typography>\n }\n >\n <Icon\n type=\"info\"\n className=\"text-placeholder-text\"\n />\n </BasicTooltip>\n )}\n {headerIcon && (\n <Icon\n type={headerIcon.type}\n className={headerIcon.className}\n />\n )}\n </div>\n\n <Typography\n variant=\"body-lg-semibold\"\n className=\"text-primary-text\"\n >\n {isMovingToRight ? \"Нужно для расчета\" : \"Уже есть для расчета\"}\n </Typography>\n\n {headerButton && isMovingToRight && (\n <Button\n variant=\"circleGhost\"\n onClick={headerButton.onClick}\n disabled={headerButton.disabled}\n >\n <Icon\n type={headerButton.icon}\n className=\"text-placeholder-text\"\n />\n </Button>\n )}\n </div>\n\n <div\n className=\"border-delicate-border flex min-h-0 flex-1 flex-col gap-2\n overflow-y-auto border-t\"\n >\n {items.map((item) => (\n <div\n key={item.id}\n className={cn(\n `bg-primary-bg flex cursor-pointer items-center justify-between gap-4 px-8\n py-4`,\n selectedSet.has(item.id) && \"bg-primary-hover-bg\",\n )}\n onClick={() => onSelectItem(item.id)}\n >\n <div className=\"flex items-center gap-4\">\n {showFooterIcons ? (\n <Button\n variant=\"circleGhost\"\n onClick={(e) => {\n e.stopPropagation();\n onMoveItem(item.id);\n }}\n >\n <Icon\n type={moveIcon}\n className=\"text-placeholder-text\"\n />\n </Button>\n ) : (\n <Icon\n type={footerIcon}\n size={25}\n strokeWidth={1.5}\n className={footerIconClassName}\n />\n )}\n\n <Typography\n variant=\"body-md-regular\"\n className=\"text-primary-text\"\n >\n {item.label}\n </Typography>\n </div>\n\n {!showFooterIcons ? (\n <Button\n variant=\"circleGhost\"\n onClick={(e) => {\n e.stopPropagation();\n onMoveItem(item.id);\n }}\n >\n <Icon\n type={moveIcon}\n className=\"text-placeholder-text\"\n />\n </Button>\n ) : (\n <Icon\n type={footerIcon}\n size={25}\n strokeWidth={1.5}\n className={footerIconClassName}\n />\n )}\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["TransferListCard","items","selectedSet","onSelectItem","onMoveItem","direction","headerIcon","headerButton","showHeaderTooltip","showFooterIcons","isMovingToRight","moveIcon","footerIcon","footerIconClassName","jsxs","cn","jsx","Button","Icon","BasicTooltip","Typography","item","e"],"mappings":"igBA2BO,MAAMA,EAAmB,CAAC,CAC/B,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,WAAAC,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,kBAAAC,EAAoB,GACpB,gBAAAC,EAAkB,EACpB,IAAa,CACX,MAAMC,EAAkBL,IAAc,QAChCM,EAAWD,EAAkB,cAAgB,aAC7CE,EAAaF,EAAkB,eAAiB,WAChDG,EAAsBH,EAAkB,oBAAsB,kBAEpE,OACEI,EAAAA,KAAC,MAAA,CACC,UAAU;AAAA,oCAGV,SAAA,CAAAA,EAA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