brd-ui-kit 0.1.94 → 0.1.97
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/{approval-log.view-BMiYO7Cf.cjs → approval-log.view-DICzq_XG.cjs} +2 -2
- package/dist/{approval-log.view-BMiYO7Cf.cjs.map → approval-log.view-DICzq_XG.cjs.map} +1 -1
- package/dist/{approval-log.view-D_-VDB_3.js → approval-log.view-DiYnnYJc.js} +2 -1
- package/dist/{approval-log.view-D_-VDB_3.js.map → approval-log.view-DiYnnYJc.js.map} +1 -1
- package/dist/brd-ui-kit.css +1 -1
- package/dist/components/checklist/checklist.d.ts +18 -0
- package/dist/components/checklist/index.d.ts +1 -0
- package/dist/components/checklist.d.ts +2 -0
- package/dist/components/stepper/index.d.ts +1 -0
- package/dist/components/stepper/stepper.d.ts +11 -0
- package/dist/components/stepper/stepper.styles.d.ts +4 -0
- package/dist/components/stepper.d.ts +2 -0
- package/dist/components/ui/checkbox/checkbox.d.ts +4 -6
- package/dist/components/ui/checkbox/checkbox.styles.d.ts +6 -1
- package/dist/components-approval-log-approval-log.cjs +1 -1
- package/dist/components-approval-log-approval-log.cjs.map +1 -1
- package/dist/components-approval-log-approval-log.js +4 -3
- package/dist/components-approval-log-approval-log.js.map +1 -1
- package/dist/components-approval-log-approval-log.view.cjs +1 -1
- package/dist/components-approval-log-approval-log.view.js +3 -2
- package/dist/components-approval-log-approval-log.view.js.map +1 -1
- package/dist/components-avatar-uploader-avatar-uploader.cjs +1 -1
- package/dist/components-avatar-uploader-avatar-uploader.cjs.map +1 -1
- package/dist/components-avatar-uploader-avatar-uploader.js +4 -3
- package/dist/components-avatar-uploader-avatar-uploader.js.map +1 -1
- package/dist/components-basic-avatar-basic-avatar.cjs +1 -1
- package/dist/components-basic-avatar-basic-avatar.js +3 -2
- package/dist/components-basic-avatar-basic-avatar.js.map +1 -1
- package/dist/components-basic-avatar.cjs +1 -1
- package/dist/components-basic-avatar.js +1 -1
- package/dist/components-checkbox-group-checkbox-group.cjs +1 -1
- package/dist/components-checkbox-group-checkbox-group.cjs.map +1 -1
- package/dist/components-checkbox-group-checkbox-group.js +4 -3
- package/dist/components-checkbox-group-checkbox-group.js.map +1 -1
- package/dist/components-checklist-checklist.cjs +3 -0
- package/dist/components-checklist-checklist.cjs.map +1 -0
- package/dist/components-checklist-checklist.js +61 -0
- package/dist/components-checklist-checklist.js.map +1 -0
- package/dist/components-checklist.cjs +2 -0
- package/dist/components-checklist.cjs.map +1 -0
- package/dist/components-checklist.js +5 -0
- package/dist/components-checklist.js.map +1 -0
- package/dist/components-input-contact-input-contact.cjs +1 -1
- package/dist/components-input-contact-input-contact.cjs.map +1 -1
- package/dist/components-input-contact-input-contact.js +4 -3
- package/dist/components-input-contact-input-contact.js.map +1 -1
- package/dist/components-input-search-input-search.cjs +1 -1
- package/dist/components-input-search-input-search.cjs.map +1 -1
- package/dist/components-input-search-input-search.js +4 -3
- package/dist/components-input-search-input-search.js.map +1 -1
- package/dist/components-stepper-stepper.cjs +2 -0
- package/dist/components-stepper-stepper.cjs.map +1 -0
- package/dist/components-stepper-stepper.js +46 -0
- package/dist/components-stepper-stepper.js.map +1 -0
- package/dist/components-stepper-stepper.styles.cjs +2 -0
- package/dist/components-stepper-stepper.styles.cjs.map +1 -0
- package/dist/components-stepper-stepper.styles.js +18 -0
- package/dist/components-stepper-stepper.styles.js.map +1 -0
- package/dist/components-stepper.cjs +2 -0
- package/dist/components-stepper.cjs.map +1 -0
- package/dist/components-stepper.js +5 -0
- package/dist/components-stepper.js.map +1 -0
- package/dist/components-story-drawer-story-drawer.cjs +1 -1
- package/dist/components-story-drawer-story-drawer.cjs.map +1 -1
- package/dist/components-story-drawer-story-drawer.js +4 -3
- package/dist/components-story-drawer-story-drawer.js.map +1 -1
- package/dist/components-ui-checkbox-checkbox.cjs +1 -1
- package/dist/components-ui-checkbox-checkbox.cjs.map +1 -1
- package/dist/components-ui-checkbox-checkbox.js +13 -13
- package/dist/components-ui-checkbox-checkbox.js.map +1 -1
- package/dist/components-ui-checkbox-checkbox.styles.cjs +11 -1
- package/dist/components-ui-checkbox-checkbox.styles.cjs.map +1 -1
- package/dist/components-ui-checkbox-checkbox.styles.js +27 -17
- package/dist/components-ui-checkbox-checkbox.styles.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/package.json +19 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-avatar-uploader-avatar-uploader.js","sources":["../src/components/avatar-uploader/avatar-uploader.tsx"],"sourcesContent":["import { cn } from \"@/index\";\nimport { useMemo } from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport { BasicAvatar, type BasicAvatarProps } from \"../basic-avatar\";\nimport { Typography } from \"../ui/typography\";\n\ntype Props = {\n maxFiles?: number;\n src?: string;\n fullName: string;\n accept?: string[];\n avatarProps?: BasicAvatarProps;\n containerClassName?: string;\n onChange?: (src: string | null) => void;\n};\n\nconst DEFAULT_MAX_FILES = 1;\nconst DEFAULT_ACCEPT = [\".jpg\", \".png\"];\n\nexport const AvatarUpload = ({\n src,\n fullName,\n maxFiles = DEFAULT_MAX_FILES,\n accept = DEFAULT_ACCEPT,\n avatarProps,\n containerClassName,\n onChange,\n}: Props) => {\n const initials = useMemo(() => {\n const [firstName = \"\", lastName = \"\"] = fullName.split(\" \");\n const first = firstName.charAt(0);\n const last = lastName.charAt(0);\n\n return (first + last).toUpperCase() || \"?\";\n }, [fullName]);\n\n const { getRootProps, getInputProps } = useDropzone({\n accept: { \"image/*\": accept },\n maxFiles,\n onDrop: (files) => {\n if (files.length === 0) return;\n const previewUrl = URL.createObjectURL(files[0]);\n onChange?.(previewUrl);\n },\n });\n\n const removeAvatar = (e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n onChange?.(null);\n };\n\n return (\n <div\n {...getRootProps()}\n className={cn(\n `bg-info-new-bg flex h-18 w-18 cursor-pointer items-center justify-center\n overflow-hidden rounded-full transition-colors`,\n containerClassName,\n )}\n >\n <input {...getInputProps()} />\n {src ? (\n <BasicAvatar\n {...avatarProps}\n image={{\n src,\n }}\n initials={{ text: initials }}\n hasBadge\n onClick={removeAvatar}\n />\n ) : (\n <Typography\n variant=\"body-xxl-medium\"\n className=\"text-info-new-text flex items-center justify-center\"\n >\n {initials}\n </Typography>\n )}\n </div>\n );\n};\n\nexport type { Props as AvatarUploadProps };\n"],"names":["DEFAULT_MAX_FILES","DEFAULT_ACCEPT","AvatarUpload","src","fullName","maxFiles","accept","avatarProps","containerClassName","onChange","initials","useMemo","firstName","lastName","first","last","getRootProps","getInputProps","useDropzone","files","previewUrl","removeAvatar","e","jsxs","cn","jsx","BasicAvatar","Typography"],"mappings":"
|
|
1
|
+
{"version":3,"file":"components-avatar-uploader-avatar-uploader.js","sources":["../src/components/avatar-uploader/avatar-uploader.tsx"],"sourcesContent":["import { cn } from \"@/index\";\nimport { useMemo } from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport { BasicAvatar, type BasicAvatarProps } from \"../basic-avatar\";\nimport { Typography } from \"../ui/typography\";\n\ntype Props = {\n maxFiles?: number;\n src?: string;\n fullName: string;\n accept?: string[];\n avatarProps?: BasicAvatarProps;\n containerClassName?: string;\n onChange?: (src: string | null) => void;\n};\n\nconst DEFAULT_MAX_FILES = 1;\nconst DEFAULT_ACCEPT = [\".jpg\", \".png\"];\n\nexport const AvatarUpload = ({\n src,\n fullName,\n maxFiles = DEFAULT_MAX_FILES,\n accept = DEFAULT_ACCEPT,\n avatarProps,\n containerClassName,\n onChange,\n}: Props) => {\n const initials = useMemo(() => {\n const [firstName = \"\", lastName = \"\"] = fullName.split(\" \");\n const first = firstName.charAt(0);\n const last = lastName.charAt(0);\n\n return (first + last).toUpperCase() || \"?\";\n }, [fullName]);\n\n const { getRootProps, getInputProps } = useDropzone({\n accept: { \"image/*\": accept },\n maxFiles,\n onDrop: (files) => {\n if (files.length === 0) return;\n const previewUrl = URL.createObjectURL(files[0]);\n onChange?.(previewUrl);\n },\n });\n\n const removeAvatar = (e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n onChange?.(null);\n };\n\n return (\n <div\n {...getRootProps()}\n className={cn(\n `bg-info-new-bg flex h-18 w-18 cursor-pointer items-center justify-center\n overflow-hidden rounded-full transition-colors`,\n containerClassName,\n )}\n >\n <input {...getInputProps()} />\n {src ? (\n <BasicAvatar\n {...avatarProps}\n image={{\n src,\n }}\n initials={{ text: initials }}\n hasBadge\n onClick={removeAvatar}\n />\n ) : (\n <Typography\n variant=\"body-xxl-medium\"\n className=\"text-info-new-text flex items-center justify-center\"\n >\n {initials}\n </Typography>\n )}\n </div>\n );\n};\n\nexport type { Props as AvatarUploadProps };\n"],"names":["DEFAULT_MAX_FILES","DEFAULT_ACCEPT","AvatarUpload","src","fullName","maxFiles","accept","avatarProps","containerClassName","onChange","initials","useMemo","firstName","lastName","first","last","getRootProps","getInputProps","useDropzone","files","previewUrl","removeAvatar","e","jsxs","cn","jsx","BasicAvatar","Typography"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,IAAoB,GACpBC,IAAiB,CAAC,QAAQ,MAAM,GAEzBC,KAAe,CAAC;AAAA,EAC3B,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAWL;AAAA,EACX,QAAAM,IAASL;AAAA,EACT,aAAAM;AAAA,EACA,oBAAAC;AAAA,EACA,UAAAC;AACF,MAAa;AACX,QAAMC,IAAWC,EAAQ,MAAM;AAC7B,UAAM,CAACC,IAAY,IAAIC,IAAW,EAAE,IAAIT,EAAS,MAAM,GAAG,GACpDU,IAAQF,EAAU,OAAO,CAAC,GAC1BG,IAAOF,EAAS,OAAO,CAAC;AAE9B,YAAQC,IAAQC,GAAM,YAAA,KAAiB;AAAA,EACzC,GAAG,CAACX,CAAQ,CAAC,GAEP,EAAE,cAAAY,GAAc,eAAAC,EAAA,IAAkBC,EAAY;AAAA,IAClD,QAAQ,EAAE,WAAWZ,EAAA;AAAA,IACrB,UAAAD;AAAA,IACA,QAAQ,CAACc,MAAU;AACjB,UAAIA,EAAM,WAAW,EAAG;AACxB,YAAMC,IAAa,IAAI,gBAAgBD,EAAM,CAAC,CAAC;AAC/C,MAAAV,IAAWW,CAAU;AAAA,IACvB;AAAA,EAAA,CACD,GAEKC,IAAe,CAACC,MAAwC;AAC5D,IAAAA,EAAE,gBAAA,GACFb,IAAW,IAAI;AAAA,EACjB;AAEA,SACE,gBAAAc;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGP,EAAA;AAAA,MACJ,WAAWQ;AAAA,QACT;AAAA;AAAA,QAEAhB;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAA,gBAAAiB,EAAC,SAAA,EAAO,GAAGR,EAAA,EAAc,CAAG;AAAA,QAC3Bd,IACC,gBAAAsB;AAAA,UAACC;AAAA,UAAA;AAAA,YACE,GAAGnB;AAAA,YACJ,OAAO;AAAA,cACL,KAAAJ;AAAA,YAAA;AAAA,YAEF,UAAU,EAAE,MAAMO,EAAA;AAAA,YAClB,UAAQ;AAAA,YACR,SAASW;AAAA,UAAA;AAAA,QAAA,IAGX,gBAAAI;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,WAAU;AAAA,YAET,UAAAjB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");const e=require("./approval-log.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");const e=require("./approval-log.view-DICzq_XG.cjs");require("./lib-utils.cjs");require("class-variance-authority");require("./components-ui-badge-badge.styles.cjs");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");require("brd-phosphor-strokes-icons/icons/CaretDown");require("react");require("./calendar-BClkfQSD.cjs");require("./components-ui-icon-icon.cjs");require("brd-phosphor-strokes-icons/icons");require("./components-ui-combobox-combobox.cjs");require("./components-ui-dialog-dialog.cjs");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.cjs");require("./components-ui-typography-typography.styles.cjs");require("./components-ui-avatar-avatar.cjs");require("./utils-helpers.cjs");require("brd-phosphor-strokes-icons/icons/CaretLeft");require("brd-phosphor-strokes-icons/icons/CaretRight");require("./components-app-pagination-app-pagination.styles.cjs");require("brd-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");require("brd-phosphor-strokes-icons/icons/Eye");require("brd-phosphor-strokes-icons/icons/EyeSlash");require("./components-select-field-select-field.cjs");require("./lodash-kqhtUJfz.cjs");require("./chart-9H_9wEfR.cjs");require("brd-phosphor-strokes-icons/icons/CheckCircle");require("brd-phosphor-strokes-icons/icons/Info");require("brd-phosphor-strokes-icons/icons/SpinnerGap");require("brd-phosphor-strokes-icons/icons/Warning");require("brd-phosphor-strokes-icons/icons/X");require("brd-phosphor-strokes-icons/icons/XCircle");require("./index-DGxwh2Ms.cjs");require("./index-fTTv8YY8.cjs");require("brd-phosphor-strokes-icons/icons/Plus");require("brd-phosphor-strokes-icons/icons/CaretUp");require("brd-phosphor-strokes-icons/icons/EnvelopeSimple");require("brd-phosphor-strokes-icons/icons/MaxLogo");require("brd-phosphor-strokes-icons/icons/Phone");require("brd-phosphor-strokes-icons/icons/TelegramLogo");require("brd-phosphor-strokes-icons/icons/WhatsAppLogoFilled");require("./components-input-phone-input-phone.cjs");require("./components-card-info-card-info.styles.cjs");require("./components-stepper-stepper.styles.cjs");exports.BasicAvatar=e.BasicAvatar;
|
|
2
2
|
//# sourceMappingURL=components-basic-avatar-basic-avatar.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import { B as
|
|
2
|
+
import { B as Ar } from "./approval-log.view-DiYnnYJc.js";
|
|
3
3
|
import "./lib-utils.js";
|
|
4
4
|
import "class-variance-authority";
|
|
5
5
|
import "./components-ui-badge-badge.styles.js";
|
|
@@ -64,7 +64,8 @@ import "brd-phosphor-strokes-icons/icons/TelegramLogo";
|
|
|
64
64
|
import "brd-phosphor-strokes-icons/icons/WhatsAppLogoFilled";
|
|
65
65
|
import "./components-input-phone-input-phone.js";
|
|
66
66
|
import "./components-card-info-card-info.styles.js";
|
|
67
|
+
import "./components-stepper-stepper.styles.js";
|
|
67
68
|
export {
|
|
68
|
-
|
|
69
|
+
Ar as BasicAvatar
|
|
69
70
|
};
|
|
70
71
|
//# sourceMappingURL=components-basic-avatar-basic-avatar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-basic-avatar-basic-avatar.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components-basic-avatar-basic-avatar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./approval-log.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./approval-log.view-DICzq_XG.cjs");exports.BasicAvatar=a.BasicAvatar;
|
|
2
2
|
//# sourceMappingURL=components-basic-avatar.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("./approval-log.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("./approval-log.view-DICzq_XG.cjs");const A=require("./lib-utils.cjs");require("class-variance-authority");require("./components-ui-badge-badge.styles.cjs");const h=require("./components-ui-button-button.cjs");require("./components-ui-button-button.styles.cjs");require("./components-ui-card-card.cjs");const g=require("./components-ui-checkbox-checkbox.cjs");require("brd-phosphor-strokes-icons/icons/CaretDown");const B=require("./hooks-usePopupControls.cjs");require("./calendar-BClkfQSD.cjs");const q=require("./components-ui-icon-icon.cjs");require("brd-phosphor-strokes-icons/icons");require("./components-ui-combobox-combobox.cjs");require("./components-ui-dialog-dialog.cjs");const o=require("react"),j=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");const d=require("./components-ui-typography-typography.cjs");require("./components-ui-typography-typography.styles.cjs");require("brd-phosphor-strokes-icons/icons/CaretLeft");require("brd-phosphor-strokes-icons/icons/CaretRight");require("./components-app-pagination-app-pagination.styles.cjs");require("brd-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 L=require("./components-input-field-input-field.cjs");require("brd-phosphor-strokes-icons/icons/Eye");require("brd-phosphor-strokes-icons/icons/EyeSlash");require("./components-select-field-select-field.cjs");require("./lodash-kqhtUJfz.cjs");require("./chart-9H_9wEfR.cjs");require("brd-phosphor-strokes-icons/icons/CheckCircle");require("brd-phosphor-strokes-icons/icons/Info");require("brd-phosphor-strokes-icons/icons/SpinnerGap");require("brd-phosphor-strokes-icons/icons/Warning");require("brd-phosphor-strokes-icons/icons/X");require("brd-phosphor-strokes-icons/icons/XCircle");const k=require("./index-DGxwh2Ms.cjs");require("./index-fTTv8YY8.cjs");require("brd-phosphor-strokes-icons/icons/Plus");require("brd-phosphor-strokes-icons/icons/CaretUp");require("brd-phosphor-strokes-icons/icons/EnvelopeSimple");require("brd-phosphor-strokes-icons/icons/MaxLogo");require("brd-phosphor-strokes-icons/icons/Phone");require("brd-phosphor-strokes-icons/icons/TelegramLogo");require("brd-phosphor-strokes-icons/icons/WhatsAppLogoFilled");require("./components-input-phone-input-phone.cjs");require("./components-card-info-card-info.styles.cjs");require("./components-stepper-stepper.styles.cjs");const R=50,V=({data:s,errTexts:c,label:v="Нужно проверить для расчета",dataEmpty:_="Нет данных",btnAddText:C="Добавить свой пункт",onChange:u})=>{const p=o.useRef(null),{isOpened:N,openPopup:w}=B.usePopupControls(),[a,x]=o.useState(""),b=o.useMemo(()=>s.flatMap(r=>r.items.map(t=>t.value)),[s]),D=o.useMemo(()=>s.flatMap(r=>r.items.filter(t=>t.checked).map(t=>t.value)),[s]).length===b.length&&b.length>0,y=o.useCallback(()=>{setTimeout(()=>{p.current&&p.current.scrollTo({top:p.current.scrollHeight,behavior:"smooth"})},R)},[]),O=r=>{const t=s.map(n=>({...n,items:n.items.map(i=>({...i,checked:r}))}));u(t)},F=o.useCallback((r,t)=>{const n=s.map(i=>i.id!==r?i:{...i,items:i.items.map(l=>l.value===t?{...l,checked:!l.checked}:l)});u(n)},[s,u]),M=o.useCallback((r,t)=>{const n=s.map(i=>i.id!==r?i:{...i,items:i.items.filter(l=>l.value!==t)});u(n)},[s,u]),f=o.useCallback(()=>{if(a.trim().length===0){k.toast.error(c?.empty?.title,{description:c?.empty?.description});return}if(s[s.length-1].items.some(l=>l.value===a.trim())){k.toast.error(c?.add?.title,{description:c?.add?.description});return}const n={value:a.trim(),label:a.trim(),checked:!1},i=s.map((l,m)=>m===s.length-1?{...l,items:[...l.items,n]}:l);u(i),x(""),y()},[a,s,u,y,c?.empty?.title,c?.empty?.description,c?.add?.title,c?.add?.description]),S=o.useCallback(r=>{const t=r.target.value;x(t)},[]);return e.jsxs("div",{className:"border-delicate-border flex h-full max-w-200 flex-col rounded-xl border",children:[e.jsx("div",{className:"bg-primary-bg rounded-t-xl px-8 py-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(g.Checkbox,{id:"all",checked:D,onCheckedChange:O}),e.jsx(j.Label,{htmlFor:"all",children:e.jsx(d.Typography,{variant:"body-lg-semibold",className:"text-primary-text",children:v})})]})}),e.jsx("div",{ref:p,className:"bg-secondary-bg flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto",children:s.map(({id:r,name:t,items:n})=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`bg-tertiary-bg border-delicate-border border-t border-b px-8
|
|
2
2
|
py-2`,children:e.jsx(d.Typography,{variant:"body-sm-medium",className:"text-primary-text",children:t})}),n.length>0?n.map(({value:i,label:l,checked:m},I)=>{const T=I===n.length-1;return e.jsx("div",{className:A.cn(`${T&&"mb-2"}`),children:e.jsxs("div",{className:`bg-primary-bg hover:bg-primary-hover-bg flex
|
|
3
3
|
justify-between px-8 py-4`,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(g.Checkbox,{id:`checkbox-${i}`,checked:m,onCheckedChange:()=>F(r,i)}),e.jsx(j.Label,{htmlFor:`checkbox-${i}`,children:e.jsx(d.Typography,{variant:"body-md-regular",className:"text-primary-text",children:l})})]}),e.jsx(h.Button,{variant:"circleGhost",onClick:()=>M(r,i),children:e.jsx(q.Icon,{type:"x",className:"text-secondary-text cursor-pointer"})})]})},i)}):null,n.length===0&&e.jsx(d.Typography,{className:"px-8 py-4 text-center",children:_})]},r))}),N?e.jsx(L.InputField,{value:a,onChange:S,placeholder:"Написать свой пункт",classes:{fieldset:"flex-none! overflow-hidden"},onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),f())},date:[{id:0,position:"inline-end",component:e.jsx(h.Button,{variant:"circleGhost",onClick:f,children:e.jsx(q.Icon,{type:"x-circle",className:"text-secondary-text rotate-45"})})}]}):e.jsxs(h.Button,{variant:"secondary",className:"border-delicate-border w-full overflow-hidden border-t",onClick:w,children:[e.jsx(d.Typography,{children:C}),e.jsx(q.Icon,{type:"plus",size:"small",className:"text-primary-text"})]})]})};exports.CheckboxGroup=V;
|
|
4
4
|
//# sourceMappingURL=components-checkbox-group-checkbox-group.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-checkbox-group-checkbox-group.cjs","sources":["../src/components/checkbox-group/checkbox-group.tsx"],"sourcesContent":["import {\n Button,\n Checkbox,\n cn,\n Icon,\n InputField,\n Label,\n sonner,\n Typography,\n usePopupControls,\n} from \"@/index\";\nimport { useCallback, useMemo, useRef, useState, type ChangeEvent } from \"react\";\nimport { Fragment } from \"react/jsx-runtime\";\n\ntype CheckboxGroupOptionItem = {\n value: string;\n label: string;\n checked: boolean;\n};\n\ntype CheckboxGroupOption = {\n id: number;\n name: string;\n items: CheckboxGroupOptionItem[];\n};\n\ntype Props = {\n data: CheckboxGroupOption[];\n onChange: (values: CheckboxGroupOption[]) => void;\n errTexts?: {\n add?: {\n title?: string;\n description?: string;\n };\n empty?: {\n title?: string;\n description?: string;\n };\n };\n label?: string;\n dataEmpty?: string;\n btnAddText?: string;\n};\n\nconst DEFAULT_MS_SCROLL_TO_BOTTOM = 50;\n\nexport const CheckboxGroup = ({\n data,\n errTexts,\n label = \"Нужно проверить для расчета\",\n dataEmpty = \"Нет данных\",\n btnAddText = \"Добавить свой пункт\",\n onChange,\n}: Props) => {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n\n const { isOpened, openPopup: openAdd } = usePopupControls();\n const [value, setValue] = useState(\"\");\n\n const allValues = useMemo(() => {\n return data.flatMap((values) => values.items.map((item) => item.value));\n }, [data]);\n\n const selectedValues = useMemo(() => {\n return data.flatMap((values) =>\n values.items.filter((item) => item.checked).map((item) => item.value),\n );\n }, [data]);\n\n const isAllSelected =\n selectedValues.length === allValues.length && allValues.length > 0;\n\n const scrollToBottom = useCallback(() => {\n setTimeout(() => {\n if (scrollContainerRef.current) {\n scrollContainerRef.current.scrollTo({\n top: scrollContainerRef.current.scrollHeight,\n behavior: \"smooth\",\n });\n }\n }, DEFAULT_MS_SCROLL_TO_BOTTOM);\n }, []);\n\n const handleSelectAll = (checked: boolean) => {\n const newData = data.map((values) => ({\n ...values,\n items: values.items.map((item) => ({\n ...item,\n checked,\n })),\n }));\n onChange(newData);\n };\n\n const handleCheckboxChange = useCallback(\n (categoryId: number, itemValue: string) => {\n const newData = data.map((category) => {\n if (category.id !== categoryId) return category;\n return {\n ...category,\n items: category.items.map((item) =>\n item.value === itemValue ? { ...item, checked: !item.checked } : item,\n ),\n };\n });\n onChange(newData);\n },\n [data, onChange],\n );\n\n const handleOptionDelete = useCallback(\n (categoryId: number, itemValue: string) => {\n const newData = data.map((category) => {\n if (category.id !== categoryId) return category;\n return {\n ...category,\n items: category.items.filter((item) => item.value !== itemValue),\n };\n });\n onChange(newData);\n },\n [data, onChange],\n );\n\n const handleAddOption = useCallback(() => {\n if (value.trim().length === 0) {\n sonner.error(errTexts?.empty?.title, {\n description: errTexts?.empty?.description,\n });\n return;\n }\n\n const lastCategory = data[data.length - 1];\n\n const isExist = lastCategory.items.some((item) => item.value === value.trim());\n\n if (isExist) {\n sonner.error(errTexts?.add?.title, {\n description: errTexts?.add?.description,\n });\n return;\n }\n\n const newItem: CheckboxGroupOptionItem = {\n value: value.trim(),\n label: value.trim(),\n checked: false,\n };\n\n const newData = data.map((values, index) => {\n if (index === data.length - 1) {\n return {\n ...values,\n items: [...values.items, newItem],\n };\n }\n return values;\n });\n\n onChange(newData);\n setValue(\"\");\n scrollToBottom();\n }, [\n value,\n data,\n onChange,\n scrollToBottom,\n errTexts?.empty?.title,\n errTexts?.empty?.description,\n errTexts?.add?.title,\n errTexts?.add?.description,\n ]);\n\n const handleChangeValue = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n setValue(value);\n }, []);\n\n return (\n <div\n className=\"border-delicate-border flex h-full max-w-200 flex-col rounded-xl border\"\n >\n <div className=\"bg-primary-bg rounded-t-xl px-8 py-6\">\n <div className=\"flex items-center gap-4\">\n <Checkbox\n id=\"all\"\n checked={isAllSelected}\n onCheckedChange={handleSelectAll}\n />\n <Label htmlFor=\"all\">\n <Typography\n variant=\"body-lg-semibold\"\n className=\"text-primary-text\"\n >\n {label}\n </Typography>\n </Label>\n </div>\n </div>\n\n <div\n ref={scrollContainerRef}\n className=\"bg-secondary-bg flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto\"\n >\n {data.map(({ id, name, items }) => {\n return (\n <Fragment key={id}>\n <div\n className=\"bg-tertiary-bg border-delicate-border border-t border-b px-8\n py-2\"\n >\n <Typography\n variant=\"body-sm-medium\"\n className=\"text-primary-text\"\n >\n {name}\n </Typography>\n </div>\n\n {items.length > 0\n ? items.map(({ value, label, checked }, index) => {\n const lastItem = index === items.length - 1;\n\n return (\n <div\n key={value}\n className={cn(`${lastItem && \"mb-2\"}`)}\n >\n <div\n className=\"bg-primary-bg hover:bg-primary-hover-bg flex\n justify-between px-8 py-4\"\n >\n <div className=\"flex items-center gap-4\">\n <Checkbox\n id={`checkbox-${value}`}\n checked={checked}\n onCheckedChange={() => handleCheckboxChange(id, value)}\n />\n <Label htmlFor={`checkbox-${value}`}>\n <Typography\n variant=\"body-md-regular\"\n className=\"text-primary-text\"\n >\n {label}\n </Typography>\n </Label>\n </div>\n\n <Button\n variant=\"circleGhost\"\n onClick={() => handleOptionDelete(id, value)}\n >\n <Icon\n type=\"x\"\n className=\"text-secondary-text cursor-pointer\"\n />\n </Button>\n </div>\n </div>\n );\n })\n : null}\n {items.length === 0 && (\n <Typography className=\"px-8 py-4 text-center\">{dataEmpty}</Typography>\n )}\n </Fragment>\n );\n })}\n </div>\n\n {isOpened ? (\n <InputField\n value={value}\n onChange={handleChangeValue}\n placeholder=\"Написать свой пункт\"\n classes={{\n fieldset: \"flex-none! overflow-hidden\",\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n handleAddOption();\n }\n }}\n date={[\n {\n id: 0,\n position: \"inline-end\",\n component: (\n <Button\n variant=\"circleGhost\"\n onClick={handleAddOption}\n >\n <Icon\n type=\"x-circle\"\n className=\"text-secondary-text rotate-45\"\n />\n </Button>\n ),\n },\n ]}\n />\n ) : (\n <Button\n variant=\"secondary\"\n className=\"border-delicate-border w-full overflow-hidden border-t\"\n onClick={openAdd}\n >\n <Typography>{btnAddText}</Typography>\n <Icon\n type=\"plus\"\n size=\"small\"\n className=\"text-primary-text\"\n />\n </Button>\n )}\n </div>\n );\n};\n\nexport type { CheckboxGroupOption, CheckboxGroupOptionItem, Props as CheckboxGroupProps };\n"],"names":["DEFAULT_MS_SCROLL_TO_BOTTOM","CheckboxGroup","data","errTexts","label","dataEmpty","btnAddText","onChange","scrollContainerRef","useRef","isOpened","openAdd","usePopupControls","value","setValue","useState","allValues","useMemo","values","item","isAllSelected","scrollToBottom","useCallback","handleSelectAll","checked","newData","handleCheckboxChange","categoryId","itemValue","category","handleOptionDelete","handleAddOption","sonner","newItem","index","handleChangeValue","e","jsxs","jsx","Checkbox","Label","Typography","id","name","items","Fragment","lastItem","cn","Button","Icon","InputField"],"mappings":"+0GA4CA,MAAMA,EAA8B,GAEvBC,EAAgB,CAAC,CAC5B,KAAAC,EACA,SAAAC,EACA,MAAAC,EAAQ,8BACR,UAAAC,EAAY,aACZ,WAAAC,EAAa,sBACb,SAAAC,CACF,IAAa,CACX,MAAMC,EAAqBC,EAAAA,OAAuB,IAAI,EAEhD,CAAE,SAAAC,EAAU,UAAWC,CAAA,EAAYC,EAAAA,iBAAA,EACnC,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAE/BC,EAAYC,EAAAA,QAAQ,IACjBf,EAAK,QAASgB,GAAWA,EAAO,MAAM,IAAKC,GAASA,EAAK,KAAK,CAAC,EACrE,CAACjB,CAAI,CAAC,EAQHkB,EANiBH,EAAAA,QAAQ,IACtBf,EAAK,QAASgB,GACnBA,EAAO,MAAM,OAAQC,GAASA,EAAK,OAAO,EAAE,IAAKA,GAASA,EAAK,KAAK,CAAA,EAErE,CAACjB,CAAI,CAAC,EAGQ,SAAWc,EAAU,QAAUA,EAAU,OAAS,EAE7DK,EAAiBC,EAAAA,YAAY,IAAM,CACvC,WAAW,IAAM,CACXd,EAAmB,SACrBA,EAAmB,QAAQ,SAAS,CAClC,IAAKA,EAAmB,QAAQ,aAChC,SAAU,QAAA,CACX,CAEL,EAAGR,CAA2B,CAChC,EAAG,CAAA,CAAE,EAECuB,EAAmBC,GAAqB,CAC5C,MAAMC,EAAUvB,EAAK,IAAKgB,IAAY,CACpC,GAAGA,EACH,MAAOA,EAAO,MAAM,IAAKC,IAAU,CACjC,GAAGA,EACH,QAAAK,CAAA,EACA,CAAA,EACF,EACFjB,EAASkB,CAAO,CAClB,EAEMC,EAAuBJ,EAA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AA,KAAA,CACC,KAAK,OACL,KAAK,QACL,UAAU,mBAAA,CAAA,CACZ,CAAA,CAAA,CACF,CAAA,CAAA,CAIR"}
|
|
1
|
+
{"version":3,"file":"components-checkbox-group-checkbox-group.cjs","sources":["../src/components/checkbox-group/checkbox-group.tsx"],"sourcesContent":["import {\n Button,\n Checkbox,\n cn,\n Icon,\n InputField,\n Label,\n sonner,\n Typography,\n usePopupControls,\n} from \"@/index\";\nimport { useCallback, useMemo, useRef, useState, type ChangeEvent } from \"react\";\nimport { Fragment } from \"react/jsx-runtime\";\n\ntype CheckboxGroupOptionItem = {\n value: string;\n label: string;\n checked: boolean;\n};\n\ntype CheckboxGroupOption = {\n id: number;\n name: string;\n items: CheckboxGroupOptionItem[];\n};\n\ntype Props = {\n data: CheckboxGroupOption[];\n onChange: (values: CheckboxGroupOption[]) => void;\n errTexts?: {\n add?: {\n title?: string;\n description?: string;\n };\n empty?: {\n title?: string;\n description?: string;\n };\n };\n label?: string;\n dataEmpty?: string;\n btnAddText?: string;\n};\n\nconst DEFAULT_MS_SCROLL_TO_BOTTOM = 50;\n\nexport const CheckboxGroup = ({\n data,\n errTexts,\n label = \"Нужно проверить для расчета\",\n dataEmpty = \"Нет данных\",\n btnAddText = \"Добавить свой пункт\",\n onChange,\n}: Props) => {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n\n const { isOpened, openPopup: openAdd } = usePopupControls();\n const [value, setValue] = useState(\"\");\n\n const allValues = useMemo(() => {\n return data.flatMap((values) => values.items.map((item) => item.value));\n }, [data]);\n\n const selectedValues = useMemo(() => {\n return data.flatMap((values) =>\n values.items.filter((item) => item.checked).map((item) => item.value),\n );\n }, [data]);\n\n const isAllSelected =\n selectedValues.length === allValues.length && allValues.length > 0;\n\n const scrollToBottom = useCallback(() => {\n setTimeout(() => {\n if (scrollContainerRef.current) {\n scrollContainerRef.current.scrollTo({\n top: scrollContainerRef.current.scrollHeight,\n behavior: \"smooth\",\n });\n }\n }, DEFAULT_MS_SCROLL_TO_BOTTOM);\n }, []);\n\n const handleSelectAll = (checked: boolean) => {\n const newData = data.map((values) => ({\n ...values,\n items: values.items.map((item) => ({\n ...item,\n checked,\n })),\n }));\n onChange(newData);\n };\n\n const handleCheckboxChange = useCallback(\n (categoryId: number, itemValue: string) => {\n const newData = data.map((category) => {\n if (category.id !== categoryId) return category;\n return {\n ...category,\n items: category.items.map((item) =>\n item.value === itemValue ? { ...item, checked: !item.checked } : item,\n ),\n };\n });\n onChange(newData);\n },\n [data, onChange],\n );\n\n const handleOptionDelete = useCallback(\n (categoryId: number, itemValue: string) => {\n const newData = data.map((category) => {\n if (category.id !== categoryId) return category;\n return {\n ...category,\n items: category.items.filter((item) => item.value !== itemValue),\n };\n });\n onChange(newData);\n },\n [data, onChange],\n );\n\n const handleAddOption = useCallback(() => {\n if (value.trim().length === 0) {\n sonner.error(errTexts?.empty?.title, {\n description: errTexts?.empty?.description,\n });\n return;\n }\n\n const lastCategory = data[data.length - 1];\n\n const isExist = lastCategory.items.some((item) => item.value === value.trim());\n\n if (isExist) {\n sonner.error(errTexts?.add?.title, {\n description: errTexts?.add?.description,\n });\n return;\n }\n\n const newItem: CheckboxGroupOptionItem = {\n value: value.trim(),\n label: value.trim(),\n checked: false,\n };\n\n const newData = data.map((values, index) => {\n if (index === data.length - 1) {\n return {\n ...values,\n items: [...values.items, newItem],\n };\n }\n return values;\n });\n\n onChange(newData);\n setValue(\"\");\n scrollToBottom();\n }, [\n value,\n data,\n onChange,\n scrollToBottom,\n errTexts?.empty?.title,\n errTexts?.empty?.description,\n errTexts?.add?.title,\n errTexts?.add?.description,\n ]);\n\n const handleChangeValue = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n setValue(value);\n }, []);\n\n return (\n <div\n className=\"border-delicate-border flex h-full max-w-200 flex-col rounded-xl border\"\n >\n <div className=\"bg-primary-bg rounded-t-xl px-8 py-6\">\n <div className=\"flex items-center gap-4\">\n <Checkbox\n id=\"all\"\n checked={isAllSelected}\n onCheckedChange={handleSelectAll}\n />\n <Label htmlFor=\"all\">\n <Typography\n variant=\"body-lg-semibold\"\n className=\"text-primary-text\"\n >\n {label}\n </Typography>\n </Label>\n </div>\n </div>\n\n <div\n ref={scrollContainerRef}\n className=\"bg-secondary-bg flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto\"\n >\n {data.map(({ id, name, items }) => {\n return (\n <Fragment key={id}>\n <div\n className=\"bg-tertiary-bg border-delicate-border border-t border-b px-8\n py-2\"\n >\n <Typography\n variant=\"body-sm-medium\"\n className=\"text-primary-text\"\n >\n {name}\n </Typography>\n </div>\n\n {items.length > 0\n ? items.map(({ value, label, checked }, index) => {\n const lastItem = index === items.length - 1;\n\n return (\n <div\n key={value}\n className={cn(`${lastItem && \"mb-2\"}`)}\n >\n <div\n className=\"bg-primary-bg hover:bg-primary-hover-bg flex\n justify-between px-8 py-4\"\n >\n <div className=\"flex items-center gap-4\">\n <Checkbox\n id={`checkbox-${value}`}\n checked={checked}\n onCheckedChange={() => handleCheckboxChange(id, value)}\n />\n <Label htmlFor={`checkbox-${value}`}>\n <Typography\n variant=\"body-md-regular\"\n className=\"text-primary-text\"\n >\n {label}\n </Typography>\n </Label>\n </div>\n\n <Button\n variant=\"circleGhost\"\n onClick={() => handleOptionDelete(id, value)}\n >\n <Icon\n type=\"x\"\n className=\"text-secondary-text cursor-pointer\"\n />\n </Button>\n </div>\n </div>\n );\n })\n : null}\n {items.length === 0 && (\n <Typography className=\"px-8 py-4 text-center\">{dataEmpty}</Typography>\n )}\n </Fragment>\n );\n })}\n </div>\n\n {isOpened ? (\n <InputField\n value={value}\n onChange={handleChangeValue}\n placeholder=\"Написать свой пункт\"\n classes={{\n fieldset: \"flex-none! overflow-hidden\",\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n handleAddOption();\n }\n }}\n date={[\n {\n id: 0,\n position: \"inline-end\",\n component: (\n <Button\n variant=\"circleGhost\"\n onClick={handleAddOption}\n >\n <Icon\n type=\"x-circle\"\n className=\"text-secondary-text rotate-45\"\n />\n </Button>\n ),\n },\n ]}\n />\n ) : (\n <Button\n variant=\"secondary\"\n className=\"border-delicate-border w-full overflow-hidden border-t\"\n onClick={openAdd}\n >\n <Typography>{btnAddText}</Typography>\n <Icon\n type=\"plus\"\n size=\"small\"\n className=\"text-primary-text\"\n />\n </Button>\n )}\n </div>\n );\n};\n\nexport type { CheckboxGroupOption, CheckboxGroupOptionItem, Props as CheckboxGroupProps };\n"],"names":["DEFAULT_MS_SCROLL_TO_BOTTOM","CheckboxGroup","data","errTexts","label","dataEmpty","btnAddText","onChange","scrollContainerRef","useRef","isOpened","openAdd","usePopupControls","value","setValue","useState","allValues","useMemo","values","item","isAllSelected","scrollToBottom","useCallback","handleSelectAll","checked","newData","handleCheckboxChange","categoryId","itemValue","category","handleOptionDelete","handleAddOption","sonner","newItem","index","handleChangeValue","e","jsxs","jsx","Checkbox","Label","Typography","id","name","items","Fragment","lastItem","cn","Button","Icon","InputField"],"mappings":"k4GA4CA,MAAMA,EAA8B,GAEvBC,EAAgB,CAAC,CAC5B,KAAAC,EACA,SAAAC,EACA,MAAAC,EAAQ,8BACR,UAAAC,EAAY,aACZ,WAAAC,EAAa,sBACb,SAAAC,CACF,IAAa,CACX,MAAMC,EAAqBC,EAAAA,OAAuB,IAAI,EAEhD,CAAE,SAAAC,EAAU,UAAWC,CAAA,EAAYC,EAAAA,iBAAA,EACnC,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAE/BC,EAAYC,EAAAA,QAAQ,IACjBf,EAAK,QAASgB,GAAWA,EAAO,MAAM,IAAKC,GAASA,EAAK,KAAK,CAAC,EACrE,CAACjB,CAAI,CAAC,EAQHkB,EANiBH,EAAAA,QAAQ,IACtBf,EAAK,QAASgB,GACnBA,EAAO,MAAM,OAAQC,GAASA,EAAK,OAAO,EAAE,IAAKA,GAASA,EAAK,KAAK,CAAA,EAErE,CAACjB,CAAI,CAAC,EAGQ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,GAAM,CACZA,EAAE,MAAQ,UACZA,EAAE,eAAA,EACFL,EAAA,EAEJ,EACA,KAAM,CACJ,CACE,GAAI,EACJ,SAAU,aACV,UACEO,EAAAA,IAACU,EAAAA,OAAA,CACC,QAAQ,cACR,QAASjB,EAET,SAAAO,EAAAA,IAACW,EAAAA,KAAA,CACC,KAAK,WACL,UAAU,+BAAA,CAAA,CACZ,CAAA,CACF,CAEJ,CACF,CAAA,EAGFZ,EAAAA,KAACW,EAAAA,OAAA,CACC,QAAQ,YACR,UAAU,yDACV,QAASrC,EAET,SAAA,CAAA2B,EAAAA,IAACG,EAAAA,YAAY,SAAAnC,CAAA,CAAW,EACxBgC,EAAAA,IAACW,EAAAA,KAAA,CACC,KAAK,OACL,KAAK,QACL,UAAU,mBAAA,CAAA,CACZ,CAAA,CAAA,CACF,CAAA,CAAA,CAIR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as s, jsx as r, Fragment as B } from "react/jsx-runtime";
|
|
2
|
-
import "./approval-log.view-
|
|
2
|
+
import "./approval-log.view-DiYnnYJc.js";
|
|
3
3
|
import { cn as G } from "./lib-utils.js";
|
|
4
4
|
import "class-variance-authority";
|
|
5
5
|
import "./components-ui-badge-badge.styles.js";
|
|
@@ -64,7 +64,8 @@ import "brd-phosphor-strokes-icons/icons/TelegramLogo";
|
|
|
64
64
|
import "brd-phosphor-strokes-icons/icons/WhatsAppLogoFilled";
|
|
65
65
|
import "./components-input-phone-input-phone.js";
|
|
66
66
|
import "./components-card-info-card-info.styles.js";
|
|
67
|
-
|
|
67
|
+
import "./components-stepper-stepper.styles.js";
|
|
68
|
+
const H = 50, it = ({
|
|
68
69
|
data: i,
|
|
69
70
|
errTexts: n,
|
|
70
71
|
label: D = "Нужно проверить для расчета",
|
|
@@ -301,6 +302,6 @@ const H = 50, ot = ({
|
|
|
301
302
|
);
|
|
302
303
|
};
|
|
303
304
|
export {
|
|
304
|
-
|
|
305
|
+
it as CheckboxGroup
|
|
305
306
|
};
|
|
306
307
|
//# sourceMappingURL=components-checkbox-group-checkbox-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-checkbox-group-checkbox-group.js","sources":["../src/components/checkbox-group/checkbox-group.tsx"],"sourcesContent":["import {\n Button,\n Checkbox,\n cn,\n Icon,\n InputField,\n Label,\n sonner,\n Typography,\n usePopupControls,\n} from \"@/index\";\nimport { useCallback, useMemo, useRef, useState, type ChangeEvent } from \"react\";\nimport { Fragment } from \"react/jsx-runtime\";\n\ntype CheckboxGroupOptionItem = {\n value: string;\n label: string;\n checked: boolean;\n};\n\ntype CheckboxGroupOption = {\n id: number;\n name: string;\n items: CheckboxGroupOptionItem[];\n};\n\ntype Props = {\n data: CheckboxGroupOption[];\n onChange: (values: CheckboxGroupOption[]) => void;\n errTexts?: {\n add?: {\n title?: string;\n description?: string;\n };\n empty?: {\n title?: string;\n description?: string;\n };\n };\n label?: string;\n dataEmpty?: string;\n btnAddText?: string;\n};\n\nconst DEFAULT_MS_SCROLL_TO_BOTTOM = 50;\n\nexport const CheckboxGroup = ({\n data,\n errTexts,\n label = \"Нужно проверить для расчета\",\n dataEmpty = \"Нет данных\",\n btnAddText = \"Добавить свой пункт\",\n onChange,\n}: Props) => {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n\n const { isOpened, openPopup: openAdd } = usePopupControls();\n const [value, setValue] = useState(\"\");\n\n const allValues = useMemo(() => {\n return data.flatMap((values) => values.items.map((item) => item.value));\n }, [data]);\n\n const selectedValues = useMemo(() => {\n return data.flatMap((values) =>\n values.items.filter((item) => item.checked).map((item) => item.value),\n );\n }, [data]);\n\n const isAllSelected =\n selectedValues.length === allValues.length && allValues.length > 0;\n\n const scrollToBottom = useCallback(() => {\n setTimeout(() => {\n if (scrollContainerRef.current) {\n scrollContainerRef.current.scrollTo({\n top: scrollContainerRef.current.scrollHeight,\n behavior: \"smooth\",\n });\n }\n }, DEFAULT_MS_SCROLL_TO_BOTTOM);\n }, []);\n\n const handleSelectAll = (checked: boolean) => {\n const newData = data.map((values) => ({\n ...values,\n items: values.items.map((item) => ({\n ...item,\n checked,\n })),\n }));\n onChange(newData);\n };\n\n const handleCheckboxChange = useCallback(\n (categoryId: number, itemValue: string) => {\n const newData = data.map((category) => {\n if (category.id !== categoryId) return category;\n return {\n ...category,\n items: category.items.map((item) =>\n item.value === itemValue ? { ...item, checked: !item.checked } : item,\n ),\n };\n });\n onChange(newData);\n },\n [data, onChange],\n );\n\n const handleOptionDelete = useCallback(\n (categoryId: number, itemValue: string) => {\n const newData = data.map((category) => {\n if (category.id !== categoryId) return category;\n return {\n ...category,\n items: category.items.filter((item) => item.value !== itemValue),\n };\n });\n onChange(newData);\n },\n [data, onChange],\n );\n\n const handleAddOption = useCallback(() => {\n if (value.trim().length === 0) {\n sonner.error(errTexts?.empty?.title, {\n description: errTexts?.empty?.description,\n });\n return;\n }\n\n const lastCategory = data[data.length - 1];\n\n const isExist = lastCategory.items.some((item) => item.value === value.trim());\n\n if (isExist) {\n sonner.error(errTexts?.add?.title, {\n description: errTexts?.add?.description,\n });\n return;\n }\n\n const newItem: CheckboxGroupOptionItem = {\n value: value.trim(),\n label: value.trim(),\n checked: false,\n };\n\n const newData = data.map((values, index) => {\n if (index === data.length - 1) {\n return {\n ...values,\n items: [...values.items, newItem],\n };\n }\n return values;\n });\n\n onChange(newData);\n setValue(\"\");\n scrollToBottom();\n }, [\n value,\n data,\n onChange,\n scrollToBottom,\n errTexts?.empty?.title,\n errTexts?.empty?.description,\n errTexts?.add?.title,\n errTexts?.add?.description,\n ]);\n\n const handleChangeValue = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n setValue(value);\n }, []);\n\n return (\n <div\n className=\"border-delicate-border flex h-full max-w-200 flex-col rounded-xl border\"\n >\n <div className=\"bg-primary-bg rounded-t-xl px-8 py-6\">\n <div className=\"flex items-center gap-4\">\n <Checkbox\n id=\"all\"\n checked={isAllSelected}\n onCheckedChange={handleSelectAll}\n />\n <Label htmlFor=\"all\">\n <Typography\n variant=\"body-lg-semibold\"\n className=\"text-primary-text\"\n >\n {label}\n </Typography>\n </Label>\n </div>\n </div>\n\n <div\n ref={scrollContainerRef}\n className=\"bg-secondary-bg flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto\"\n >\n {data.map(({ id, name, items }) => {\n return (\n <Fragment key={id}>\n <div\n className=\"bg-tertiary-bg border-delicate-border border-t border-b px-8\n py-2\"\n >\n <Typography\n variant=\"body-sm-medium\"\n className=\"text-primary-text\"\n >\n {name}\n </Typography>\n </div>\n\n {items.length > 0\n ? items.map(({ value, label, checked }, index) => {\n const lastItem = index === items.length - 1;\n\n return (\n <div\n key={value}\n className={cn(`${lastItem && \"mb-2\"}`)}\n >\n <div\n className=\"bg-primary-bg hover:bg-primary-hover-bg flex\n justify-between px-8 py-4\"\n >\n <div className=\"flex items-center gap-4\">\n <Checkbox\n id={`checkbox-${value}`}\n checked={checked}\n onCheckedChange={() => handleCheckboxChange(id, value)}\n />\n <Label htmlFor={`checkbox-${value}`}>\n <Typography\n variant=\"body-md-regular\"\n className=\"text-primary-text\"\n >\n {label}\n </Typography>\n </Label>\n </div>\n\n <Button\n variant=\"circleGhost\"\n onClick={() => handleOptionDelete(id, value)}\n >\n <Icon\n type=\"x\"\n className=\"text-secondary-text cursor-pointer\"\n />\n </Button>\n </div>\n </div>\n );\n })\n : null}\n {items.length === 0 && (\n <Typography className=\"px-8 py-4 text-center\">{dataEmpty}</Typography>\n )}\n </Fragment>\n );\n })}\n </div>\n\n {isOpened ? (\n <InputField\n value={value}\n onChange={handleChangeValue}\n placeholder=\"Написать свой пункт\"\n classes={{\n fieldset: \"flex-none! overflow-hidden\",\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n handleAddOption();\n }\n }}\n date={[\n {\n id: 0,\n position: \"inline-end\",\n component: (\n <Button\n variant=\"circleGhost\"\n onClick={handleAddOption}\n >\n <Icon\n type=\"x-circle\"\n className=\"text-secondary-text rotate-45\"\n />\n </Button>\n ),\n },\n ]}\n />\n ) : (\n <Button\n variant=\"secondary\"\n className=\"border-delicate-border w-full overflow-hidden border-t\"\n onClick={openAdd}\n >\n <Typography>{btnAddText}</Typography>\n <Icon\n type=\"plus\"\n size=\"small\"\n className=\"text-primary-text\"\n />\n </Button>\n )}\n </div>\n );\n};\n\nexport type { CheckboxGroupOption, CheckboxGroupOptionItem, Props as CheckboxGroupProps };\n"],"names":["DEFAULT_MS_SCROLL_TO_BOTTOM","CheckboxGroup","data","errTexts","label","dataEmpty","btnAddText","onChange","scrollContainerRef","useRef","isOpened","openAdd","usePopupControls","value","setValue","useState","allValues","useMemo","values","item","isAllSelected","scrollToBottom","useCallback","handleSelectAll","checked","newData","handleCheckboxChange","categoryId","itemValue","category","handleOptionDelete","handleAddOption","sonner","newItem","index","handleChangeValue","jsxs","jsx","Checkbox","Label","Typography","id","name","items","Fragment","lastItem","cn","Button","Icon","InputField"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAMA,IAA8B,IAEvBC,KAAgB,CAAC;AAAA,EAC5B,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,UAAAC;AACF,MAAa;AACX,QAAMC,IAAqBC,EAAuB,IAAI,GAEhD,EAAE,UAAAC,GAAU,WAAWC,EAAA,IAAYC,EAAA,GACnC,CAACC,GAAOC,CAAQ,IAAIC,EAAS,EAAE,GAE/BC,IAAYC,EAAQ,MACjBf,EAAK,QAAQ,CAACgB,MAAWA,EAAO,MAAM,IAAI,CAACC,MAASA,EAAK,KAAK,CAAC,GACrE,CAACjB,CAAI,CAAC,GAQHkB,IANiBH,EAAQ,MACtBf,EAAK;AAAA,IAAQ,CAACgB,MACnBA,EAAO,MAAM,OAAO,CAACC,MAASA,E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A,kBAACU;AAAA,kBAAA;AAAA,oBACC,SAAQ;AAAA,oBACR,SAAShB;AAAA,oBAET,UAAA,gBAAAM;AAAA,sBAACW;AAAA,sBAAA;AAAA,wBACC,MAAK;AAAA,wBACL,WAAU;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACZ;AAAA,gBAAA;AAAA,cACF;AAAA,YAEJ;AAAA,UACF;AAAA,QAAA,IAGF,gBAAAZ;AAAA,UAACW;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,SAASpC;AAAA,YAET,UAAA;AAAA,cAAA,gBAAA0B,EAACG,KAAY,UAAAlC,EAAA,CAAW;AAAA,cACxB,gBAAA+B;AAAA,gBAACW;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,MAAK;AAAA,kBACL,WAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACZ;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
1
|
+
{"version":3,"file":"components-checkbox-group-checkbox-group.js","sources":["../src/components/checkbox-group/checkbox-group.tsx"],"sourcesContent":["import {\n Button,\n Checkbox,\n cn,\n Icon,\n InputField,\n Label,\n sonner,\n Typography,\n usePopupControls,\n} from \"@/index\";\nimport { useCallback, useMemo, useRef, useState, type ChangeEvent } from \"react\";\nimport { Fragment } from \"react/jsx-runtime\";\n\ntype CheckboxGroupOptionItem = {\n value: string;\n label: string;\n checked: boolean;\n};\n\ntype CheckboxGroupOption = {\n id: number;\n name: string;\n items: CheckboxGroupOptionItem[];\n};\n\ntype Props = {\n data: CheckboxGroupOption[];\n onChange: (values: CheckboxGroupOption[]) => void;\n errTexts?: {\n add?: {\n title?: string;\n description?: string;\n };\n empty?: {\n title?: string;\n description?: string;\n };\n };\n label?: string;\n dataEmpty?: string;\n btnAddText?: string;\n};\n\nconst DEFAULT_MS_SCROLL_TO_BOTTOM = 50;\n\nexport const CheckboxGroup = ({\n data,\n errTexts,\n label = \"Нужно проверить для расчета\",\n dataEmpty = \"Нет данных\",\n btnAddText = \"Добавить свой пункт\",\n onChange,\n}: Props) => {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n\n const { isOpened, openPopup: openAdd } = usePopupControls();\n const [value, setValue] = useState(\"\");\n\n const allValues = useMemo(() => {\n return data.flatMap((values) => values.items.map((item) => item.value));\n }, [data]);\n\n const selectedValues = useMemo(() => {\n return data.flatMap((values) =>\n values.items.filter((item) => item.checked).map((item) => item.value),\n );\n }, [data]);\n\n const isAllSelected =\n selectedValues.length === allValues.length && allValues.length > 0;\n\n const scrollToBottom = useCallback(() => {\n setTimeout(() => {\n if (scrollContainerRef.current) {\n scrollContainerRef.current.scrollTo({\n top: scrollContainerRef.current.scrollHeight,\n behavior: \"smooth\",\n });\n }\n }, DEFAULT_MS_SCROLL_TO_BOTTOM);\n }, []);\n\n const handleSelectAll = (checked: boolean) => {\n const newData = data.map((values) => ({\n ...values,\n items: values.items.map((item) => ({\n ...item,\n checked,\n })),\n }));\n onChange(newData);\n };\n\n const handleCheckboxChange = useCallback(\n (categoryId: number, itemValue: string) => {\n const newData = data.map((category) => {\n if (category.id !== categoryId) return category;\n return {\n ...category,\n items: category.items.map((item) =>\n item.value === itemValue ? { ...item, checked: !item.checked } : item,\n ),\n };\n });\n onChange(newData);\n },\n [data, onChange],\n );\n\n const handleOptionDelete = useCallback(\n (categoryId: number, itemValue: string) => {\n const newData = data.map((category) => {\n if (category.id !== categoryId) return category;\n return {\n ...category,\n items: category.items.filter((item) => item.value !== itemValue),\n };\n });\n onChange(newData);\n },\n [data, onChange],\n );\n\n const handleAddOption = useCallback(() => {\n if (value.trim().length === 0) {\n sonner.error(errTexts?.empty?.title, {\n description: errTexts?.empty?.description,\n });\n return;\n }\n\n const lastCategory = data[data.length - 1];\n\n const isExist = lastCategory.items.some((item) => item.value === value.trim());\n\n if (isExist) {\n sonner.error(errTexts?.add?.title, {\n description: errTexts?.add?.description,\n });\n return;\n }\n\n const newItem: CheckboxGroupOptionItem = {\n value: value.trim(),\n label: value.trim(),\n checked: false,\n };\n\n const newData = data.map((values, index) => {\n if (index === data.length - 1) {\n return {\n ...values,\n items: [...values.items, newItem],\n };\n }\n return values;\n });\n\n onChange(newData);\n setValue(\"\");\n scrollToBottom();\n }, [\n value,\n data,\n onChange,\n scrollToBottom,\n errTexts?.empty?.title,\n errTexts?.empty?.description,\n errTexts?.add?.title,\n errTexts?.add?.description,\n ]);\n\n const handleChangeValue = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n setValue(value);\n }, []);\n\n return (\n <div\n className=\"border-delicate-border flex h-full max-w-200 flex-col rounded-xl border\"\n >\n <div className=\"bg-primary-bg rounded-t-xl px-8 py-6\">\n <div className=\"flex items-center gap-4\">\n <Checkbox\n id=\"all\"\n checked={isAllSelected}\n onCheckedChange={handleSelectAll}\n />\n <Label htmlFor=\"all\">\n <Typography\n variant=\"body-lg-semibold\"\n className=\"text-primary-text\"\n >\n {label}\n </Typography>\n </Label>\n </div>\n </div>\n\n <div\n ref={scrollContainerRef}\n className=\"bg-secondary-bg flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto\"\n >\n {data.map(({ id, name, items }) => {\n return (\n <Fragment key={id}>\n <div\n className=\"bg-tertiary-bg border-delicate-border border-t border-b px-8\n py-2\"\n >\n <Typography\n variant=\"body-sm-medium\"\n className=\"text-primary-text\"\n >\n {name}\n </Typography>\n </div>\n\n {items.length > 0\n ? items.map(({ value, label, checked }, index) => {\n const lastItem = index === items.length - 1;\n\n return (\n <div\n key={value}\n className={cn(`${lastItem && \"mb-2\"}`)}\n >\n <div\n className=\"bg-primary-bg hover:bg-primary-hover-bg flex\n justify-between px-8 py-4\"\n >\n <div className=\"flex items-center gap-4\">\n <Checkbox\n id={`checkbox-${value}`}\n checked={checked}\n onCheckedChange={() => handleCheckboxChange(id, value)}\n />\n <Label htmlFor={`checkbox-${value}`}>\n <Typography\n variant=\"body-md-regular\"\n className=\"text-primary-text\"\n >\n {label}\n </Typography>\n </Label>\n </div>\n\n <Button\n variant=\"circleGhost\"\n onClick={() => handleOptionDelete(id, value)}\n >\n <Icon\n type=\"x\"\n className=\"text-secondary-text cursor-pointer\"\n />\n </Button>\n </div>\n </div>\n );\n })\n : null}\n {items.length === 0 && (\n <Typography className=\"px-8 py-4 text-center\">{dataEmpty}</Typography>\n )}\n </Fragment>\n );\n })}\n </div>\n\n {isOpened ? (\n <InputField\n value={value}\n onChange={handleChangeValue}\n placeholder=\"Написать свой пункт\"\n classes={{\n fieldset: \"flex-none! overflow-hidden\",\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n handleAddOption();\n }\n }}\n date={[\n {\n id: 0,\n position: \"inline-end\",\n component: (\n <Button\n variant=\"circleGhost\"\n onClick={handleAddOption}\n >\n <Icon\n type=\"x-circle\"\n className=\"text-secondary-text rotate-45\"\n />\n </Button>\n ),\n },\n ]}\n />\n ) : (\n <Button\n variant=\"secondary\"\n className=\"border-delicate-border w-full overflow-hidden border-t\"\n onClick={openAdd}\n >\n <Typography>{btnAddText}</Typography>\n <Icon\n type=\"plus\"\n size=\"small\"\n className=\"text-primary-text\"\n />\n </Button>\n )}\n </div>\n );\n};\n\nexport type { CheckboxGroupOption, CheckboxGroupOptionItem, Props as CheckboxGroupProps };\n"],"names":["DEFAULT_MS_SCROLL_TO_BOTTOM","CheckboxGroup","data","errTexts","label","dataEmpty","btnAddText","onChange","scrollContainerRef","useRef","isOpened","openAdd","usePopupControls","value","setValue","useState","allValues","useMemo","values","item","isAllSelected","scrollToBottom","useCallback","handleSelectAll","checked","newData","handleCheckboxChange","categoryId","itemValue","category","handleOptionDelete","handleAddOption","sonner","newItem","index","handleChangeValue","jsxs","jsx","Checkbox","Label","Typography","id","name","items","Fragment","lastItem","cn","Button","Icon","InputField"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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StringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("./components-ui-checkbox-checkbox.cjs"),s=require("./components-ui-typography-typography.cjs");require("./components-ui-typography-typography.styles.cjs");const l=require("./lib-utils.cjs"),p=({data:t,onChange:d,label:n,className:o,checkboxVariant:a})=>{const i=e=>()=>{const h=t.map(c=>c.id!==e?c:{...c,completed:!c.completed});d(h)};return r.jsxs("div",{children:[n&&r.jsx(s.Typography,{className:l.cn("text-sub-label-text mb-1",o?.label),variant:"body-sm-regular",children:n}),r.jsx("div",{className:"border-delicate-border w-full rounded-2xl border",children:t.map(e=>r.jsxs("div",{className:`not-last:border-delicate-border flex items-center gap-4 px-2.5 py-3
|
|
2
|
+
not-last:border-b`,children:[r.jsx(b.Checkbox,{checked:e.completed,variant:a,onCheckedChange:i(e.id),className:o?.checkbox}),r.jsx(s.Typography,{className:l.cn(`${e.completed&&"text-sub-label-text line-through"}`,o?.description),variant:"body-md-regular",children:e.description})]},e.id))})]})};exports.Checklist=p;
|
|
3
|
+
//# sourceMappingURL=components-checklist-checklist.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-checklist-checklist.cjs","sources":["../src/components/checklist/checklist.tsx"],"sourcesContent":["import { Checkbox } from \"@/components/ui/checkbox\";\nimport { Typography } from \"../ui/typography\";\nimport { cn } from \"@/lib/utils\";\n\nexport type ChecklistData = {\n id: number;\n description: string;\n completed: boolean;\n};\n\ntype Props = {\n data: ChecklistData[];\n onChange: (values: ChecklistData[]) => void;\n label?: string;\n className?: {\n label?: string;\n checkbox?: string;\n description?: string;\n };\n checkboxVariant?: \"round\" | \"square\";\n};\n\nexport const Checklist = ({\n data,\n onChange,\n label,\n className,\n checkboxVariant,\n}: Props) => {\n const handleCheckboxChange = (id: number) => () => {\n const newData = data.map((item) => {\n if (item.id !== id) return item;\n return { ...item, completed: !item.completed };\n });\n onChange(newData);\n };\n\n return (\n <div>\n {label && (\n <Typography\n className={cn(\"text-sub-label-text mb-1\", className?.label)}\n variant=\"body-sm-regular\"\n >\n {label}\n </Typography>\n )}\n <div className=\"border-delicate-border w-full rounded-2xl border\">\n {data.map((item) => (\n <div\n className=\"not-last:border-delicate-border flex items-center gap-4 px-2.5 py-3\n not-last:border-b\"\n key={item.id}\n >\n <Checkbox\n checked={item.completed}\n variant={checkboxVariant}\n onCheckedChange={handleCheckboxChange(item.id)}\n className={className?.checkbox}\n />\n <Typography\n className={cn(\n `${item.completed && \"text-sub-label-text line-through\"}`,\n className?.description,\n )}\n variant=\"body-md-regular\"\n >\n {item.description}\n </Typography>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["Checklist","data","onChange","label","className","checkboxVariant","handleCheckboxChange","id","newData","item","jsx","Typography","cn","jsxs","Checkbox"],"mappings":"8TAsBaA,EAAY,CAAC,CACxB,KAAAC,EACA,SAAAC,EACA,MAAAC,EACA,UAAAC,EACA,gBAAAC,CACF,IAAa,CACX,MAAMC,EAAwBC,GAAe,IAAM,CACjD,MAAMC,EAAUP,EAAK,IAAKQ,GACpBA,EAAK,KAAOF,EAAWE,EACpB,CAAE,GAAGA,EAAM,UAAW,CAACA,EAAK,SAAA,CACpC,EACDP,EAASM,CAAO,CAClB,EAEA,cACG,MAAA,CACE,SAAA,CAAAL,GACCO,EAAAA,IAACC,EAAAA,WAAA,CACC,UAAWC,EAAAA,GAAG,2BAA4BR,GAAW,KAAK,EAC1D,QAAQ,kBAEP,SAAAD,CAAA,CAAA,QAGJ,MAAA,CAAI,UAAU,mDACZ,SAAAF,EAAK,IAAKQ,GACTI,EAAAA,KAAC,MAAA,CACC,UAAU;AAAA,iCAIV,SAAA,CAAAH,EAAAA,IAACI,EAAAA,SAAA,CACC,QAASL,EAAK,UACd,QAASJ,EACT,gBAAiBC,EAAqBG,EAAK,EAAE,EAC7C,UAAWL,GAAW,QAAA,CAAA,EAExBM,EAAAA,IAACC,EAAAA,WAAA,CACC,UAAWC,EAAAA,GACT,GAAGH,EAAK,WAAa,kCAAkC,GACvDL,GAAW,WAAA,EAEb,QAAQ,kBAEP,SAAAK,EAAK,WAAA,CAAA,CACR,CAAA,EAhBKA,EAAK,EAAA,CAkBb,CAAA,CACH,CAAA,EACF,CAEJ"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox as h } from "./components-ui-checkbox-checkbox.js";
|
|
3
|
+
import { Typography as n } from "./components-ui-typography-typography.js";
|
|
4
|
+
import "./components-ui-typography-typography.styles.js";
|
|
5
|
+
import { cn as a } from "./lib-utils.js";
|
|
6
|
+
const k = ({
|
|
7
|
+
data: t,
|
|
8
|
+
onChange: i,
|
|
9
|
+
label: c,
|
|
10
|
+
className: d,
|
|
11
|
+
checkboxVariant: s
|
|
12
|
+
}) => {
|
|
13
|
+
const p = (e) => () => {
|
|
14
|
+
const b = t.map((r) => r.id !== e ? r : { ...r, completed: !r.completed });
|
|
15
|
+
i(b);
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
18
|
+
c && /* @__PURE__ */ o(
|
|
19
|
+
n,
|
|
20
|
+
{
|
|
21
|
+
className: a("text-sub-label-text mb-1", d?.label),
|
|
22
|
+
variant: "body-sm-regular",
|
|
23
|
+
children: c
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ o("div", { className: "border-delicate-border w-full rounded-2xl border", children: t.map((e) => /* @__PURE__ */ l(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: `not-last:border-delicate-border flex items-center gap-4 px-2.5 py-3
|
|
30
|
+
not-last:border-b`,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ o(
|
|
33
|
+
h,
|
|
34
|
+
{
|
|
35
|
+
checked: e.completed,
|
|
36
|
+
variant: s,
|
|
37
|
+
onCheckedChange: p(e.id),
|
|
38
|
+
className: d?.checkbox
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ o(
|
|
42
|
+
n,
|
|
43
|
+
{
|
|
44
|
+
className: a(
|
|
45
|
+
`${e.completed && "text-sub-label-text line-through"}`,
|
|
46
|
+
d?.description
|
|
47
|
+
),
|
|
48
|
+
variant: "body-md-regular",
|
|
49
|
+
children: e.description
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
e.id
|
|
55
|
+
)) })
|
|
56
|
+
] });
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
k as Checklist
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=components-checklist-checklist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-checklist-checklist.js","sources":["../src/components/checklist/checklist.tsx"],"sourcesContent":["import { Checkbox } from \"@/components/ui/checkbox\";\nimport { Typography } from \"../ui/typography\";\nimport { cn } from \"@/lib/utils\";\n\nexport type ChecklistData = {\n id: number;\n description: string;\n completed: boolean;\n};\n\ntype Props = {\n data: ChecklistData[];\n onChange: (values: ChecklistData[]) => void;\n label?: string;\n className?: {\n label?: string;\n checkbox?: string;\n description?: string;\n };\n checkboxVariant?: \"round\" | \"square\";\n};\n\nexport const Checklist = ({\n data,\n onChange,\n label,\n className,\n checkboxVariant,\n}: Props) => {\n const handleCheckboxChange = (id: number) => () => {\n const newData = data.map((item) => {\n if (item.id !== id) return item;\n return { ...item, completed: !item.completed };\n });\n onChange(newData);\n };\n\n return (\n <div>\n {label && (\n <Typography\n className={cn(\"text-sub-label-text mb-1\", className?.label)}\n variant=\"body-sm-regular\"\n >\n {label}\n </Typography>\n )}\n <div className=\"border-delicate-border w-full rounded-2xl border\">\n {data.map((item) => (\n <div\n className=\"not-last:border-delicate-border flex items-center gap-4 px-2.5 py-3\n not-last:border-b\"\n key={item.id}\n >\n <Checkbox\n checked={item.completed}\n variant={checkboxVariant}\n onCheckedChange={handleCheckboxChange(item.id)}\n className={className?.checkbox}\n />\n <Typography\n className={cn(\n `${item.completed && \"text-sub-label-text line-through\"}`,\n className?.description,\n )}\n variant=\"body-md-regular\"\n >\n {item.description}\n </Typography>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["Checklist","data","onChange","label","className","checkboxVariant","handleCheckboxChange","id","newData","item","jsx","Typography","cn","jsxs","Checkbox"],"mappings":";;;;;AAsBO,MAAMA,IAAY,CAAC;AAAA,EACxB,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AACF,MAAa;AACX,QAAMC,IAAuB,CAACC,MAAe,MAAM;AACjD,UAAMC,IAAUP,EAAK,IAAI,CAACQ,MACpBA,EAAK,OAAOF,IAAWE,IACpB,EAAE,GAAGA,GAAM,WAAW,CAACA,EAAK,UAAA,CACpC;AACD,IAAAP,EAASM,CAAO;AAAA,EAClB;AAEA,2BACG,OAAA,EACE,UAAA;AAAA,IAAAL,KACC,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAWC,EAAG,4BAA4BR,GAAW,KAAK;AAAA,QAC1D,SAAQ;AAAA,QAEP,UAAAD;AAAA,MAAA;AAAA,IAAA;AAAA,sBAGJ,OAAA,EAAI,WAAU,oDACZ,UAAAF,EAAK,IAAI,CAACQ,MACT,gBAAAI;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA;AAAA,QAIV,UAAA;AAAA,UAAA,gBAAAH;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,SAASL,EAAK;AAAA,cACd,SAASJ;AAAA,cACT,iBAAiBC,EAAqBG,EAAK,EAAE;AAAA,cAC7C,WAAWL,GAAW;AAAA,YAAA;AAAA,UAAA;AAAA,UAExB,gBAAAM;AAAA,YAACC;AAAA,YAAA;AAAA,cACC,WAAWC;AAAA,gBACT,GAAGH,EAAK,aAAa,kCAAkC;AAAA,gBACvDL,GAAW;AAAA,cAAA;AAAA,cAEb,SAAQ;AAAA,cAEP,UAAAK,EAAK;AAAA,YAAA;AAAA,UAAA;AAAA,QACR;AAAA,MAAA;AAAA,MAhBKA,EAAK;AAAA,IAAA,CAkBb,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-checklist.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-checklist.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),j=require("brd-phosphor-strokes-icons/icons/CaretDown"),y=require("brd-phosphor-strokes-icons/icons/CaretUp"),_=require("brd-phosphor-strokes-icons/icons/EnvelopeSimple"),k=require("brd-phosphor-strokes-icons/icons/MaxLogo"),S=require("brd-phosphor-strokes-icons/icons/Phone"),i=require("./components-icons-stroke-icon.cjs"),T=require("brd-phosphor-strokes-icons/icons/TelegramLogo"),L=require("brd-phosphor-strokes-icons/icons/WhatsAppLogoFilled");require("./approval-log.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),j=require("brd-phosphor-strokes-icons/icons/CaretDown"),y=require("brd-phosphor-strokes-icons/icons/CaretUp"),_=require("brd-phosphor-strokes-icons/icons/EnvelopeSimple"),k=require("brd-phosphor-strokes-icons/icons/MaxLogo"),S=require("brd-phosphor-strokes-icons/icons/Phone"),i=require("./components-icons-stroke-icon.cjs"),T=require("brd-phosphor-strokes-icons/icons/TelegramLogo"),L=require("brd-phosphor-strokes-icons/icons/WhatsAppLogoFilled");require("./approval-log.view-DICzq_XG.cjs");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-BClkfQSD.cjs");require("brd-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("brd-phosphor-strokes-icons/icons/CaretLeft");require("brd-phosphor-strokes-icons/icons/CaretRight");require("./components-app-pagination-app-pagination.styles.cjs");require("brd-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("brd-phosphor-strokes-icons/icons/Eye");require("brd-phosphor-strokes-icons/icons/EyeSlash");require("./components-select-field-select-field.cjs");require("./lodash-kqhtUJfz.cjs");require("./chart-9H_9wEfR.cjs");require("brd-phosphor-strokes-icons/icons/CheckCircle");require("brd-phosphor-strokes-icons/icons/Info");require("brd-phosphor-strokes-icons/icons/SpinnerGap");require("brd-phosphor-strokes-icons/icons/Warning");require("brd-phosphor-strokes-icons/icons/X");require("brd-phosphor-strokes-icons/icons/XCircle");require("./index-DGxwh2Ms.cjs");require("./index-fTTv8YY8.cjs");require("brd-phosphor-strokes-icons/icons/Plus");const D=require("./components-input-phone-input-phone.cjs");require("./components-card-info-card-info.styles.cjs");require("./components-stepper-stepper.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
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?y.CaretUp:j.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 mt-2 flex w-full
|
|
4
4
|
flex-col rounded-xl border`,ref:l,children:E.map(({label:e,icon:t})=>{const P=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:P,size:"medium",className:"text-primary-inverse-text",classes:a(t)}),e]},e)})})]})};exports.InputContact=O;
|
|
@@ -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 { 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 { OPTIONS } from \"@/constants/contact-input\";\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 disabled?: boolean;\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 mt-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":"qxGAEO,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,EAqBMC,EAAcC,GAAsB,CACxC,OAAQA,EAAA,CACN,IAAK,WACH,MAAO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,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 { 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 { OPTIONS } from \"@/constants/contact-input\";\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 disabled?: boolean;\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 mt-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":"w0GAEO,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,EAqBMC,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,UAAW,2BAAA,EAGf,QACE,MAAO,CAAA,CAAC,CAEd,EAEMC,EAAyBD,IAAuB,CACpD,QAASE,EAAAA,GACP;AAAA,MACEH,EAAWC,CAAI,EAAE,SAAW,6BAA6B;AAAA,MACzDD,EAAWC,CAAI,EAAE,WAAa,2BAA2B,EAAA,EAE7D,KAAM,iBACR,GAEaG,EAAgBC,GAAiB,CAC5C,KAAM,CAAE,WAAAC,EAAY,gBAAAC,EAAiB,aAAAC,EAAc,GAAGC,GAASJ,EAEzD,CAACK,EAAMC,CAAO,EAAIC,EAAAA,SAAsB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,YAAaQ,EAAeZ,CAAI,CAAA,CAAA,EAGlCmB,EAAAA,IAACG,EAAAA,WAAA,CACE,GAAGzB,EACH,GAAGE,EACJ,KAAM,CACJ,CACE,GAAI,IACJ,SAAU,eACV,UACEoB,EAAAA,IAACE,EAAAA,WAAA,CACC,KAAMP,EACN,KAAK,SACL,QAAStB,EAAsBQ,CAAI,CAAA,CAAA,CACrC,EAGJ,CACE,GAAI,IACJ,SAAU,aACV,UACEmB,EAAAA,IAACE,EAAAA,WAAA,CACC,KAAMN,EACN,KAAK,SACL,UAAU,iBACV,QAASX,CAAA,CAAA,CACX,CAEJ,EAEF,YAAaQ,EAAeZ,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"}
|
|
@@ -7,7 +7,7 @@ import { Phone as S } from "brd-phosphor-strokes-icons/icons/Phone";
|
|
|
7
7
|
import { StrokeIcon as n } from "./components-icons-stroke-icon.js";
|
|
8
8
|
import { TelegramLogo as D } from "brd-phosphor-strokes-icons/icons/TelegramLogo";
|
|
9
9
|
import { WhatsAppLogoFilled as E } from "brd-phosphor-strokes-icons/icons/WhatsAppLogoFilled";
|
|
10
|
-
import "./approval-log.view-
|
|
10
|
+
import "./approval-log.view-DiYnnYJc.js";
|
|
11
11
|
import { cn as C } from "./lib-utils.js";
|
|
12
12
|
import "class-variance-authority";
|
|
13
13
|
import "./components-ui-badge-badge.styles.js";
|
|
@@ -63,6 +63,7 @@ import "./index-C6N9aMq_.js";
|
|
|
63
63
|
import "brd-phosphor-strokes-icons/icons/Plus";
|
|
64
64
|
import { InputPhone as _ } from "./components-input-phone-input-phone.js";
|
|
65
65
|
import "./components-card-info-card-info.styles.js";
|
|
66
|
+
import "./components-stepper-stepper.styles.js";
|
|
66
67
|
const B = [
|
|
67
68
|
{
|
|
68
69
|
label: "Мобильный",
|
|
@@ -115,7 +116,7 @@ const B = [
|
|
|
115
116
|
${x(t).textColor ?? "text-primary-inverse-text"}`
|
|
116
117
|
),
|
|
117
118
|
icon: "size-5 shrink-0"
|
|
118
|
-
}),
|
|
119
|
+
}), Zo = (t) => {
|
|
119
120
|
const { inputProps: b, inputPhoneProps: v, onTypeChange: w, ...a } = t, [r, y] = j("phone"), { isOpened: m, openPopup: c, closePopup: p } = O(), l = F(null);
|
|
120
121
|
A(() => {
|
|
121
122
|
const o = (i) => {
|
|
@@ -249,6 +250,6 @@ const B = [
|
|
|
249
250
|
] });
|
|
250
251
|
};
|
|
251
252
|
export {
|
|
252
|
-
|
|
253
|
+
Zo as InputContact
|
|
253
254
|
};
|
|
254
255
|
//# sourceMappingURL=components-input-contact-input-contact.js.map
|