brd-ui-kit 0.1.91 → 0.1.93

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.
Files changed (30) hide show
  1. package/dist/brd-ui-kit.css +1 -1
  2. package/dist/components/forms/form-input-search.d.ts +11 -0
  3. package/dist/components/forms/index.d.ts +2 -0
  4. package/dist/components/input-search/index.d.ts +1 -1
  5. package/dist/components/input-search/input-search.d.ts +4 -1
  6. package/dist/components/ui/icon/icon-map.d.ts +4 -0
  7. package/dist/components-forms-form-input-search.cjs +2 -0
  8. package/dist/components-forms-form-input-search.cjs.map +1 -0
  9. package/dist/components-forms-form-input-search.js +56 -0
  10. package/dist/components-forms-form-input-search.js.map +1 -0
  11. package/dist/components-forms.cjs +1 -1
  12. package/dist/components-forms.js +10 -8
  13. package/dist/components-forms.js.map +1 -1
  14. package/dist/components-input-contact-input-contact.cjs +3 -3
  15. package/dist/components-input-contact-input-contact.cjs.map +1 -1
  16. package/dist/components-input-contact-input-contact.js +1 -1
  17. package/dist/components-input-contact-input-contact.js.map +1 -1
  18. package/dist/components-input-search-input-search.cjs +1 -1
  19. package/dist/components-input-search-input-search.cjs.map +1 -1
  20. package/dist/components-input-search-input-search.js +62 -50
  21. package/dist/components-input-search-input-search.js.map +1 -1
  22. package/dist/components-ui-icon-icon-map.cjs +1 -1
  23. package/dist/components-ui-icon-icon-map.cjs.map +1 -1
  24. package/dist/components-ui-icon-icon-map.js +72 -68
  25. package/dist/components-ui-icon-icon-map.js.map +1 -1
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.ts +3 -2
  28. package/dist/index.js +34 -32
  29. package/dist/index.js.map +1 -1
  30. package/package.json +1 -1
@@ -0,0 +1,56 @@
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { a as V, C as F } from "./index.esm-CFsbc_Iq.js";
3
+ import { getValidationState as x } from "./utils-get-validation-state.js";
4
+ import { InputSearch as y } from "./components-input-search-input-search.js";
5
+ const T = ({
6
+ name: t,
7
+ optionName: e,
8
+ rules: a,
9
+ disabled: i,
10
+ onOptionChange: l,
11
+ ...d
12
+ }) => {
13
+ const {
14
+ control: h,
15
+ setValue: c,
16
+ formState: { errors: m, touchedFields: f, isSubmitted: g }
17
+ } = V();
18
+ return /* @__PURE__ */ u(
19
+ F,
20
+ {
21
+ name: t,
22
+ rules: a,
23
+ control: h,
24
+ render: ({ field: { onChange: p, value: r = "" } }) => {
25
+ const o = typeof r == "string" ? r : String(r ?? ""), [C, S] = x(
26
+ t,
27
+ o,
28
+ m,
29
+ f,
30
+ g
31
+ );
32
+ return /* @__PURE__ */ u(
33
+ y,
34
+ {
35
+ ...d,
36
+ value: o,
37
+ onChange: (n, s) => {
38
+ p(n), e && c(e, s ?? null, {
39
+ shouldDirty: !0,
40
+ shouldTouch: !0,
41
+ shouldValidate: !0
42
+ }), l?.(n, s);
43
+ },
44
+ disabled: i,
45
+ isValid: C,
46
+ error: S
47
+ }
48
+ );
49
+ }
50
+ }
51
+ );
52
+ };
53
+ export {
54
+ T as FormInputSearch
55
+ };
56
+ //# sourceMappingURL=components-forms-form-input-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-forms-form-input-search.js","sources":["../src/components/forms/form-input-search.tsx"],"sourcesContent":["import { Controller, useFormContext, type RegisterOptions } from \"react-hook-form\";\n\nimport { getValidationState } from \"@/utils/get-validation-state\";\nimport {\n InputSearch,\n type InputSearchOption,\n type InputSearchProps,\n} from \"../input-search\";\n\ntype Props<T = unknown> = Omit<\n InputSearchProps<T>,\n \"value\" | \"onChange\" | \"disabled\" | \"isValid\" | \"error\"\n> & {\n name: string;\n optionName?: string;\n rules?: RegisterOptions;\n disabled?: boolean;\n onOptionChange?: (value: string, option?: InputSearchOption<T>) => void;\n};\n\nexport const FormInputSearch = <T,>({\n name,\n optionName,\n rules,\n disabled,\n onOptionChange,\n ...rest\n}: Props<T>) => {\n const {\n control,\n setValue,\n formState: { errors, touchedFields, isSubmitted },\n } = useFormContext();\n\n return (\n <Controller\n name={name}\n rules={rules}\n control={control}\n render={({ field: { onChange, value = \"\" } }) => {\n const currentValue = typeof value === \"string\" ? value : String(value ?? \"\");\n const [isValid, errorMsg] = getValidationState(\n name,\n currentValue,\n errors,\n touchedFields,\n isSubmitted,\n );\n\n const handleChange = (nextValue: string, option?: InputSearchOption<T>) => {\n onChange(nextValue);\n\n if (optionName) {\n setValue(optionName, option ?? null, {\n shouldDirty: true,\n shouldTouch: true,\n shouldValidate: true,\n });\n }\n\n onOptionChange?.(nextValue, option);\n };\n\n return (\n <InputSearch\n {...rest}\n value={currentValue}\n onChange={handleChange}\n disabled={disabled}\n isValid={isValid}\n error={errorMsg}\n />\n );\n }}\n />\n );\n};\n\nexport type { Props as FormInputSearchProps };\n"],"names":["FormInputSearch","name","optionName","rules","disabled","onOptionChange","rest","control","setValue","errors","touchedFields","isSubmitted","useFormContext","jsx","Controller","onChange","value","currentValue","isValid","errorMsg","getValidationState","InputSearch","nextValue","option"],"mappings":";;;;AAoBO,MAAMA,IAAkB,CAAK;AAAA,EAClC,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,GAAGC;AACL,MAAgB;AACd,QAAM;AAAA,IACJ,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAW,EAAE,QAAAC,GAAQ,eAAAC,GAAe,aAAAC,EAAA;AAAA,EAAY,IAC9CC,EAAA;AAEJ,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAb;AAAA,MACA,OAAAE;AAAA,MACA,SAAAI;AAAA,MACA,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAAQ,GAAU,OAAAC,IAAQ,GAAA,QAAW;AAC/C,cAAMC,IAAe,OAAOD,KAAU,WAAWA,IAAQ,OAAOA,KAAS,EAAE,GACrE,CAACE,GAASC,CAAQ,IAAIC;AAAA,UAC1BnB;AAAA,UACAgB;AAAA,UACAR;AAAA,UACAC;AAAA,UACAC;AAAA,QAAA;AAiBF,eACE,gBAAAE;AAAA,UAACQ;AAAA,UAAA;AAAA,YACE,GAAGf;AAAA,YACJ,OAAOW;AAAA,YACP,UAlBiB,CAACK,GAAmBC,MAAkC;AACzE,cAAAR,EAASO,CAAS,GAEdpB,KACFM,EAASN,GAAYqB,KAAU,MAAM;AAAA,gBACnC,aAAa;AAAA,gBACb,aAAa;AAAA,gBACb,gBAAgB;AAAA,cAAA,CACjB,GAGHlB,IAAiBiB,GAAWC,CAAM;AAAA,YACpC;AAAA,YAOI,UAAAnB;AAAA,YACA,SAAAc;AAAA,YACA,OAAOC;AAAA,UAAA;AAAA,QAAA;AAAA,MAGb;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./components-forms-form.cjs"),r=require("./components-forms-form-avatar-uploader.cjs"),e=require("./components-forms-form-contact-input.cjs"),m=require("./components-forms-form-files-uploader.cjs"),t=require("./components-forms-form-input.cjs"),n=require("./components-forms-form-input-password.cjs"),s=require("./components-forms-form-Input-phone.cjs"),c=require("./components-forms-form-select.cjs"),p=require("./components-forms-form-select-calendar.cjs"),a=require("./components-forms-form-textarea.cjs"),u=require("./components-forms-form-toggle-group.cjs"),F=require("./components-forms-from-checkbox.cjs");exports.Form=o.Form;exports.FormAvatar=r.FormAvatar;exports.FormContactInput=e.FormContactInput;exports.FormFilesUploader=m.FormFilesUploader;exports.FormInput=t.FormInput;exports.FormInputPassword=n.FormInputPassword;exports.FormInputPhone=s.FormInputPhone;exports.FormSelect=c.FormSelect;exports.FormSelectCalendar=p.FormSelectCalendar;exports.FormTextarea=a.FormTextarea;exports.FormToggleGroup=u.FormToggleGroup;exports.FormCheckbox=F.FormCheckbox;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./components-forms-form.cjs"),r=require("./components-forms-form-avatar-uploader.cjs"),e=require("./components-forms-form-contact-input.cjs"),m=require("./components-forms-form-files-uploader.cjs"),n=require("./components-forms-form-input.cjs"),t=require("./components-forms-form-input-password.cjs"),s=require("./components-forms-form-Input-phone.cjs"),c=require("./components-forms-form-input-search.cjs"),p=require("./components-forms-form-select.cjs"),u=require("./components-forms-form-select-calendar.cjs"),a=require("./components-forms-form-textarea.cjs"),F=require("./components-forms-form-toggle-group.cjs"),f=require("./components-forms-from-checkbox.cjs");exports.Form=o.Form;exports.FormAvatar=r.FormAvatar;exports.FormContactInput=e.FormContactInput;exports.FormFilesUploader=m.FormFilesUploader;exports.FormInput=n.FormInput;exports.FormInputPassword=t.FormInputPassword;exports.FormInputPhone=s.FormInputPhone;exports.FormInputSearch=c.FormInputSearch;exports.FormSelect=p.FormSelect;exports.FormSelectCalendar=u.FormSelectCalendar;exports.FormTextarea=a.FormTextarea;exports.FormToggleGroup=F.FormToggleGroup;exports.FormCheckbox=f.FormCheckbox;
2
2
  //# sourceMappingURL=components-forms.cjs.map
@@ -5,23 +5,25 @@ import { FormFilesUploader as f } from "./components-forms-form-files-uploader.j
5
5
  import { FormInput as n } from "./components-forms-form-input.js";
6
6
  import { FormInputPassword as u } from "./components-forms-form-input-password.js";
7
7
  import { FormInputPhone as I } from "./components-forms-form-Input-phone.js";
8
- import { FormSelect as s } from "./components-forms-form-select.js";
8
+ import { FormInputSearch as h } from "./components-forms-form-input-search.js";
9
+ import { FormSelect as C } from "./components-forms-form-select.js";
9
10
  import { FormSelectCalendar as g } from "./components-forms-form-select-calendar.js";
10
- import { FormTextarea as P } from "./components-forms-form-textarea.js";
11
- import { FormToggleGroup as T } from "./components-forms-form-toggle-group.js";
12
- import { FormCheckbox as i } from "./components-forms-from-checkbox.js";
11
+ import { FormTextarea as T } from "./components-forms-form-textarea.js";
12
+ import { FormToggleGroup as i } from "./components-forms-form-toggle-group.js";
13
+ import { FormCheckbox as v } from "./components-forms-from-checkbox.js";
13
14
  export {
14
15
  e as Form,
15
16
  t as FormAvatar,
16
- i as FormCheckbox,
17
+ v as FormCheckbox,
17
18
  x as FormContactInput,
18
19
  f as FormFilesUploader,
19
20
  n as FormInput,
20
21
  u as FormInputPassword,
21
22
  I as FormInputPhone,
22
- s as FormSelect,
23
+ h as FormInputSearch,
24
+ C as FormSelect,
23
25
  g as FormSelectCalendar,
24
- P as FormTextarea,
25
- T as FormToggleGroup
26
+ T as FormTextarea,
27
+ i as FormToggleGroup
26
28
  };
27
29
  //# sourceMappingURL=components-forms.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components-forms.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"components-forms.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),P=require("brd-phosphor-strokes-icons/icons/CaretDown"),j=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-DC5xl6KF.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");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
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-DC5xl6KF.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");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: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;
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
+ 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;
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 { 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 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":"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,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,OAAO,EAC/C,CAAE,SAAAC,EAAU,UAAAC,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CmB,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"}
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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AAI,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"}
@@ -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 z-100 my-2 flex w-full
219
+ className: `border-inp-hover-border bg-primary-bg absolute z-100 mt-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 { 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 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,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AAoB;AAAA,cAACE;AAAA,cAAA;AAAA,gBACC,MAAMP;AAAA,gBACN,MAAK;AAAA,gBACL,SAAStB,EAAsBQ,CAAI;AAAA,cAAA;AAAA,YAAA;AAAA,UACrC;AAAA,UAGJ;AAAA,YACE,IAAI;AAAA,YACJ,UAAU;AAAA,YACV,WACE,gBAAAmB;AAAA,cAACE;AAAA,cAAA;AAAA,gBACC,MAAMN;AAAA,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 { 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,GAqBMC,IAAa,CAACC,MAAsB;AACxC,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IAGb,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IAGb,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,QACT,WAAW;AAAA,MAAA;AAAA,IAGf;AACE,aAAO,CAAA;AAAA,EAAC;AAEd,GAEMC,IAAwB,CAACD,OAAuB;AAAA,EACpD,SAASE;AAAA,IACP;AAAA,MACEH,EAAWC,CAAI,EAAE,WAAW,6BAA6B;AAAA,MACzDD,EAAWC,CAAI,EAAE,aAAa,2BAA2B;AAAA,EAAA;AAAA,EAE7D,MAAM;AACR,IAEaG,KAAe,CAACC,MAAiB;AAC5C,QAAM,EAAE,YAAAC,GAAY,iBAAAC,GAAiB,cAAAC,GAAc,GAAGC,MAASJ,GAEzD,CAACK,GAAMC,CAAO,IAAIC,EAAsB,OAAO,GAC/C,EAA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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,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime");require("./approval-log.view-DC5xl6KF.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");const t=require("react");require("./calendar-BClkfQSD.cjs");require("brd-phosphor-strokes-icons/icons");const i=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.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");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");const R=300,S=({options:r,value:c,onChange:o,onSearch:q,placeholder:f="Выберите...",searchPlaceholder:d="Поиск...",emptyText:h="Ничего не найдено",loadingText:C="Загрузка...",loading:j=!1,disabled:m=!1,className:v,renderOption:b,debounceMs:x=R})=>{const[l,n]=t.useState(""),a=t.useRef(null);t.useEffect(()=>{if(q)return a.current=setTimeout(()=>{q(l)},x),()=>{a.current&&clearTimeout(a.current)}},[x,q,l]);const s=t.useMemo(()=>r.find(e=>e.value===c)??null,[r,c]),g=t.useMemo(()=>{if(q)return r;const e=l.trim().toLowerCase();return e?r.filter(E=>E.label.toLowerCase().includes(e)):r},[q,r,l]),y=s?s.label:f,I=e=>{if(!e||e.value===c){o?.(""),n("");return}o?.(e.value,e),n("")};return u.jsxs(i.Combobox,{items:r,value:s,onInputValueChange:n,onValueChange:m?void 0:I,children:[u.jsx(i.ComboboxInput,{disabled:m,className:v,placeholder:s?y:d}),u.jsxs(i.ComboboxContent,{children:[u.jsx(i.ComboboxEmpty,{children:j?C:h}),u.jsx(i.ComboboxList,{children:g.map(e=>u.jsx(i.ComboboxItem,{value:e,children:b?b(e):u.jsx("div",{className:"hover:bg-primary-hover-bg w-full px-4 py-2",children:e.label})},e.value))})]})]})};exports.InputSearch=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime");require("./approval-log.view-DC5xl6KF.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");const l=require("react");require("./calendar-BClkfQSD.cjs");require("brd-phosphor-strokes-icons/icons");const u=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.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");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");const R=300,_=({options:i,value:n,onChange:b,onSearch:q,placeholder:v="Выберите...",searchPlaceholder:C="Поиск...",emptyText:d="Ничего не найдено",loadingText:j="Загрузка...",loading:g=!1,disabled:t=!1,showClear:I=!1,isValid:x,className:S,error:T,renderOption:f,debounceMs:h=R})=>{const[a,s]=l.useState(""),c=l.useRef(null);l.useEffect(()=>{if(q)return c.current=setTimeout(()=>{q(a)},h),()=>{c.current&&clearTimeout(c.current)}},[h,q,a]);const y={...x===!0&&!t&&{"aria-valid":!0},...x===!1&&!t&&{"aria-invalid":!0},disabled:t},o=l.useMemo(()=>i.find(e=>e.value===n)??null,[i,n]),E=l.useMemo(()=>{if(q)return i;const e=a.trim().toLowerCase();return e?i.filter(m=>m.label.toLowerCase().includes(e)):i},[q,i,a]),V=o?o.label:v,L=e=>{if(!e||e.value===n){b?.(""),s("");return}b?.(e.value,e),s("")};return r.jsx(u.ComboboxField,{error:T,children:r.jsxs(u.Combobox,{items:E,value:o,itemToStringLabel:e=>e.label,itemToStringValue:e=>e.value,isItemEqualToValue:(e,m)=>e.value===m.value,onInputValueChange:s,onValueChange:t?void 0:L,children:[r.jsx(u.ComboboxInput,{...y,disabled:t,className:S,placeholder:o?V:C,showClear:I}),r.jsxs(u.ComboboxContent,{children:[r.jsx(u.ComboboxEmpty,{children:g?j:d}),r.jsx(u.ComboboxList,{children:e=>r.jsx(u.ComboboxItem,{value:e,children:f?f(e):r.jsx("div",{className:"hover:bg-primary-hover-bg w-full px-4 py-2",children:e.label})},e.value)})]})]})})};exports.InputSearch=_;
2
2
  //# sourceMappingURL=components-input-search-input-search.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"components-input-search-input-search.cjs","sources":["../src/components/input-search/input-search.tsx"],"sourcesContent":["import {\n Combobox,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n} from \"@/index\";\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nexport type InputSearchOption<T = unknown> = {\n value: string;\n label: string;\n meta?: T;\n};\n\ntype InputSearchProps<T = unknown> = {\n options: InputSearchOption<T>[];\n value?: string;\n onChange?: (value: string, option?: InputSearchOption<T>) => void;\n onSearch?: (search: string) => void;\n placeholder?: string;\n searchPlaceholder?: string;\n emptyText?: string;\n loadingText?: string;\n loading?: boolean;\n disabled?: boolean;\n className?: string;\n renderOption?: (option: InputSearchOption<T>) => ReactNode;\n debounceMs?: number;\n};\n\nconst DEBOUNCE_MS = 300;\n\nexport const InputSearch = <T,>({\n options,\n value,\n onChange,\n onSearch,\n placeholder = \"Выберите...\",\n searchPlaceholder = \"Поиск...\",\n emptyText = \"Ничего не найдено\",\n loadingText = \"Загрузка...\",\n loading = false,\n disabled = false,\n className,\n renderOption,\n debounceMs = DEBOUNCE_MS,\n}: InputSearchProps<T>) => {\n const [searchValue, setSearchValue] = useState(\"\");\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (!onSearch) return;\n\n timerRef.current = setTimeout(() => {\n onSearch(searchValue);\n }, debounceMs);\n\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n };\n }, [debounceMs, onSearch, searchValue]);\n\n const selectedOption = useMemo(\n () => options.find((option) => option.value === value) ?? null,\n [options, value],\n );\n\n const filteredOptions = useMemo(() => {\n if (onSearch) return options;\n\n const normalizedSearch = searchValue.trim().toLowerCase();\n if (!normalizedSearch) return options;\n\n return options.filter((option) =>\n option.label.toLowerCase().includes(normalizedSearch),\n );\n }, [onSearch, options, searchValue]);\n\n const inputPlaceholder = selectedOption ? selectedOption.label : placeholder;\n\n const handleChange = (option: InputSearchOption<T> | null) => {\n if (!option || option.value === value) {\n onChange?.(\"\");\n setSearchValue(\"\");\n return;\n }\n\n onChange?.(option.value, option);\n setSearchValue(\"\");\n };\n\n return (\n <Combobox\n items={options}\n value={selectedOption}\n onInputValueChange={setSearchValue}\n onValueChange={disabled ? undefined : handleChange}\n >\n <ComboboxInput\n disabled={disabled}\n className={className}\n placeholder={selectedOption ? inputPlaceholder : searchPlaceholder}\n />\n\n <ComboboxContent>\n <ComboboxEmpty>{loading ? loadingText : emptyText}</ComboboxEmpty>\n <ComboboxList>\n {filteredOptions.map((option) => (\n <ComboboxItem\n key={option.value}\n value={option}\n >\n {renderOption ? (\n renderOption(option)\n ) : (\n <div className=\"hover:bg-primary-hover-bg w-full px-4 py-2\">\n {option.label}\n </div>\n )}\n </ComboboxItem>\n ))}\n </ComboboxList>\n </ComboboxContent>\n </Combobox>\n );\n};\n\nexport type { InputSearchProps };\n"],"names":["DEBOUNCE_MS","InputSearch","options","value","onChange","onSearch","placeholder","searchPlaceholder","emptyText","loadingText","loading","disabled","className","renderOption","debounceMs","searchValue","setSearchValue","useState","timerRef","useRef","useEffect","selectedOption","useMemo","option","filteredOptions","normalizedSearch","inputPlaceholder","handleChange","jsxs","Combobox","jsx","ComboboxInput","ComboboxContent","ComboboxEmpty","ComboboxList","ComboboxItem"],"mappings":"2lGAgCA,MAAMA,EAAc,IAEPC,EAAc,CAAK,CAC9B,QAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,YAAAC,EAAc,cACd,kBAAAC,EAAoB,WACpB,UAAAC,EAAY,oBACZ,YAAAC,EAAc,cACd,QAAAC,EAAU,GACV,SAAAC,EAAW,GACX,UAAAC,EACA,aAAAC,EACA,WAAAC,EAAad,CACf,IAA2B,CACzB,KAAM,CAACe,EAAaC,CAAc,EAAIC,EAAAA,SAAS,EAAE,EAC3CC,EAAWC,EAAAA,OAA6C,IAAI,EAElEC,EAAAA,UAAU,IAAM,CACd,GAAKf,EAEL,OAAAa,EAAS,QAAU,WAAW,IAAM,CAClCb,EAASU,CAAW,CACtB,EAAGD,CAAU,EAEN,IAAM,CACPI,EAAS,SACX,aAAaA,EAAS,OAAO,CAEjC,CACF,EAAG,CAACJ,EAAYT,EAAUU,CAAW,CAAC,EAEtC,MAAMM,EAAiBC,EAAAA,QACrB,IAAMpB,EAAQ,KAAMqB,GAAWA,EAAO,QAAUpB,CAAK,GAAK,KAC1D,CAACD,EAASC,CAAK,CAAA,EAGXqB,EAAkBF,EAAAA,QAAQ,IAAM,CACpC,GAAIjB,EAAU,OAAOH,EAErB,MAAMuB,EAAmBV,EAAY,KAAA,EAAO,YAAA,EAC5C,OAAKU,EAEEvB,EAAQ,OAAQqB,GACrBA,EAAO,MAAM,YAAA,EAAc,SAASE,CAAgB,CAAA,EAHxBvB,CAKhC,EAAG,CAACG,EAAUH,EAASa,CAAW,CAAC,EAE7BW,EAAmBL,EAAiBA,EAAe,MAAQf,EAE3DqB,EAAgBJ,GAAwC,CAC5D,GAAI,CAACA,GAAUA,EAAO,QAAUpB,EAAO,CACrCC,IAAW,EAAE,EACbY,EAAe,EAAE,EACjB,MACF,CAEAZ,IAAWmB,EAAO,MAAOA,CAAM,EAC/BP,EAAe,EAAE,CACnB,EAEA,OACEY,EAAAA,KAACC,EAAAA,SAAA,CACC,MAAO3B,EACP,MAAOmB,EACP,mBAAoBL,EACpB,cAAeL,EAAW,OAAYgB,EAEtC,SAAA,CAAAG,EAAAA,IAACC,EAAAA,cAAA,CACC,SAAApB,EACA,UAAAC,EACA,YAAaS,EAAiBK,EAAmBnB,CAAA,CAAA,SAGlDyB,EAAAA,gBAAA,CACC,SAAA,CAAAF,EAAAA,IAACG,EAAAA,cAAA,CAAe,SAAAvB,EAAUD,EAAcD,EAAU,EAClDsB,EAAAA,IAACI,EAAAA,aAAA,CACE,SAAAV,EAAgB,IAAKD,GACpBO,EAAAA,IAACK,EAAAA,aAAA,CAEC,MAAOZ,EAEN,SAAAV,EACCA,EAAaU,CAAM,QAElB,MAAA,CAAI,UAAU,6CACZ,SAAAA,EAAO,KAAA,CACV,CAAA,EARGA,EAAO,KAAA,CAWf,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CAGN"}
1
+ {"version":3,"file":"components-input-search-input-search.cjs","sources":["../src/components/input-search/input-search.tsx"],"sourcesContent":["import {\n Combobox,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxField,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n} from \"@/index\";\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nexport type InputSearchOption<T = unknown> = {\n value: string;\n label: string;\n meta?: T;\n};\n\ntype InputSearchProps<T = unknown> = {\n options: InputSearchOption<T>[];\n value?: string;\n onChange?: (value: string, option?: InputSearchOption<T>) => void;\n onSearch?: (search: string) => void;\n placeholder?: string;\n searchPlaceholder?: string;\n emptyText?: string;\n loadingText?: string;\n loading?: boolean;\n disabled?: boolean;\n className?: string;\n renderOption?: (option: InputSearchOption<T>) => ReactNode;\n debounceMs?: number;\n showClear?: boolean;\n isValid?: boolean;\n error?: string;\n};\n\nconst DEBOUNCE_MS = 300;\n\nexport const InputSearch = <T,>({\n options,\n value,\n onChange,\n onSearch,\n placeholder = \"Выберите...\",\n searchPlaceholder = \"Поиск...\",\n emptyText = \"Ничего не найдено\",\n loadingText = \"Загрузка...\",\n loading = false,\n disabled = false,\n showClear = false,\n isValid,\n className,\n error,\n renderOption,\n debounceMs = DEBOUNCE_MS,\n}: InputSearchProps<T>) => {\n const [searchValue, setSearchValue] = useState(\"\");\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (!onSearch) return;\n\n timerRef.current = setTimeout(() => {\n onSearch(searchValue);\n }, debounceMs);\n\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n };\n }, [debounceMs, onSearch, searchValue]);\n\n const validationProps = {\n ...(isValid === true && !disabled && { \"aria-valid\": true }),\n ...(isValid === false && !disabled && { \"aria-invalid\": true }),\n disabled,\n };\n\n const selectedOption = useMemo(\n () => options.find((option) => option.value === value) ?? null,\n [options, value],\n );\n\n const filteredOptions = useMemo(() => {\n if (onSearch) return options;\n\n const normalizedSearch = searchValue.trim().toLowerCase();\n if (!normalizedSearch) return options;\n\n return options.filter((option) =>\n option.label.toLowerCase().includes(normalizedSearch),\n );\n }, [onSearch, options, searchValue]);\n\n const inputPlaceholder = selectedOption ? selectedOption.label : placeholder;\n\n const handleChange = (option: InputSearchOption<T> | null) => {\n if (!option || option.value === value) {\n onChange?.(\"\");\n setSearchValue(\"\");\n return;\n }\n\n onChange?.(option.value, option);\n setSearchValue(\"\");\n };\n\n return (\n <ComboboxField error={error}>\n <Combobox\n items={filteredOptions}\n value={selectedOption}\n itemToStringLabel={(option) => option.label}\n itemToStringValue={(option) => option.value}\n isItemEqualToValue={(option, currentValue) =>\n option.value === currentValue.value\n }\n onInputValueChange={setSearchValue}\n onValueChange={disabled ? undefined : handleChange}\n >\n <ComboboxInput\n {...validationProps}\n disabled={disabled}\n className={className}\n placeholder={selectedOption ? inputPlaceholder : searchPlaceholder}\n showClear={showClear}\n />\n\n <ComboboxContent>\n <ComboboxEmpty>{loading ? loadingText : emptyText}</ComboboxEmpty>\n <ComboboxList>\n {(option: InputSearchOption<T>) => (\n <ComboboxItem\n key={option.value}\n value={option}\n >\n {renderOption ? (\n renderOption(option)\n ) : (\n <div className=\"hover:bg-primary-hover-bg w-full px-4 py-2\">\n {option.label}\n </div>\n )}\n </ComboboxItem>\n )}\n </ComboboxList>\n </ComboboxContent>\n </Combobox>\n </ComboboxField>\n );\n};\n\nexport type { InputSearchProps };\n"],"names":["DEBOUNCE_MS","InputSearch","options","value","onChange","onSearch","placeholder","searchPlaceholder","emptyText","loadingText","loading","disabled","showClear","isValid","className","error","renderOption","debounceMs","searchValue","setSearchValue","useState","timerRef","useRef","useEffect","validationProps","selectedOption","useMemo","option","filteredOptions","normalizedSearch","inputPlaceholder","handleChange","jsx","ComboboxField","jsxs","Combobox","currentValue","ComboboxInput","ComboboxContent","ComboboxEmpty","ComboboxList","ComboboxItem"],"mappings":"2lGAoCA,MAAMA,EAAc,IAEPC,EAAc,CAAK,CAC9B,QAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,YAAAC,EAAc,cACd,kBAAAC,EAAoB,WACpB,UAAAC,EAAY,oBACZ,YAAAC,EAAc,cACd,QAAAC,EAAU,GACV,SAAAC,EAAW,GACX,UAAAC,EAAY,GACZ,QAAAC,EACA,UAAAC,EACA,MAAAC,EACA,aAAAC,EACA,WAAAC,EAAajB,CACf,IAA2B,CACzB,KAAM,CAACkB,EAAaC,CAAc,EAAIC,EAAAA,SAAS,EAAE,EAC3CC,EAAWC,EAAAA,OAA6C,IAAI,EAElEC,EAAAA,UAAU,IAAM,CACd,GAAKlB,EAEL,OAAAgB,EAAS,QAAU,WAAW,IAAM,CAClChB,EAASa,CAAW,CACtB,EAAGD,CAAU,EAEN,IAAM,CACPI,EAAS,SACX,aAAaA,EAAS,OAAO,CAEjC,CACF,EAAG,CAACJ,EAAYZ,EAAUa,CAAW,CAAC,EAEtC,MAAMM,EAAkB,CACtB,GAAI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DwB,EAAAA,IAACQ,EAAAA,aAAA,CACE,SAACb,GACAK,EAAAA,IAACS,EAAAA,aAAA,CAEC,MAAOd,EAEN,SAAAX,EACCA,EAAaW,CAAM,QAElB,MAAA,CAAI,UAAU,6CACZ,SAAAA,EAAO,KAAA,CACV,CAAA,EARGA,EAAO,KAAA,CAUd,CAEJ,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,EAEJ,CAEJ"}
@@ -1,4 +1,4 @@
1
- import { jsxs as f, jsx as o } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as h } from "react/jsx-runtime";
2
2
  import "./approval-log.view-CZoufOXF.js";
3
3
  import "./lib-utils.js";
4
4
  import "class-variance-authority";
@@ -8,10 +8,10 @@ import "./components-ui-button-button.styles.js";
8
8
  import "./components-ui-card-card.js";
9
9
  import "./components-ui-checkbox-checkbox.js";
10
10
  import "brd-phosphor-strokes-icons/icons/CaretDown";
11
- import { useState as w, useRef as y, useEffect as L, useMemo as b } from "react";
11
+ import { useState as S, useRef as j, useEffect as N, useMemo as v } from "react";
12
12
  import "./calendar-B78l3uF9.js";
13
13
  import "brd-phosphor-strokes-icons/icons";
14
- import { Combobox as j, ComboboxInput as N, ComboboxContent as O, ComboboxEmpty as R, ComboboxList as T, ComboboxItem as z } from "./components-ui-combobox-combobox.js";
14
+ import { ComboboxField as O, Combobox as P, ComboboxInput as R, ComboboxContent as q, ComboboxEmpty as z, ComboboxList as B, ComboboxItem as D } from "./components-ui-combobox-combobox.js";
15
15
  import "./components-ui-dialog-dialog.js";
16
16
  import "./components-ui-label-label.js";
17
17
  import "./components-ui-separator-separator.js";
@@ -60,78 +60,90 @@ import "brd-phosphor-strokes-icons/icons/TelegramLogo";
60
60
  import "brd-phosphor-strokes-icons/icons/WhatsAppLogoFilled";
61
61
  import "./components-input-phone-input-phone.js";
62
62
  import "./components-card-info-card-info.styles.js";
63
- const B = 300, Fr = ({
63
+ const F = 300, Qr = ({
64
64
  options: t,
65
- value: p,
66
- onChange: a,
67
- onSearch: m,
68
- placeholder: h = "Выберите...",
65
+ value: l,
66
+ onChange: c,
67
+ onSearch: i,
68
+ placeholder: C = "Выберите...",
69
69
  searchPlaceholder: d = "Поиск...",
70
- emptyText: C = "Ничего не найдено",
71
- loadingText: x = "Загрузка...",
72
- loading: v = !1,
73
- disabled: n = !1,
74
- className: g,
75
- renderOption: c,
76
- debounceMs: s = B
70
+ emptyText: x = "Ничего не найдено",
71
+ loadingText: g = "Загрузка...",
72
+ loading: E = !1,
73
+ disabled: m = !1,
74
+ showClear: I = !1,
75
+ isValid: s,
76
+ className: T,
77
+ error: V,
78
+ renderOption: f,
79
+ debounceMs: b = F
77
80
  }) => {
78
- const [i, l] = w(""), u = y(null);
79
- L(() => {
80
- if (m)
81
+ const [e, a] = S(""), u = j(null);
82
+ N(() => {
83
+ if (i)
81
84
  return u.current = setTimeout(() => {
82
- m(i);
83
- }, s), () => {
85
+ i(e);
86
+ }, b), () => {
84
87
  u.current && clearTimeout(u.current);
85
88
  };
86
- }, [s, m, i]);
87
- const e = b(
88
- () => t.find((r) => r.value === p) ?? null,
89
- [t, p]
90
- ), E = b(() => {
91
- if (m) return t;
92
- const r = i.trim().toLowerCase();
89
+ }, [b, i, e]);
90
+ const L = {
91
+ ...s === !0 && !m && { "aria-valid": !0 },
92
+ ...s === !1 && !m && { "aria-invalid": !0 },
93
+ disabled: m
94
+ }, p = v(
95
+ () => t.find((r) => r.value === l) ?? null,
96
+ [t, l]
97
+ ), w = v(() => {
98
+ if (i) return t;
99
+ const r = e.trim().toLowerCase();
93
100
  return r ? t.filter(
94
- (V) => V.label.toLowerCase().includes(r)
101
+ (n) => n.label.toLowerCase().includes(r)
95
102
  ) : t;
96
- }, [m, t, i]), I = e ? e.label : h;
97
- return /* @__PURE__ */ f(
98
- j,
103
+ }, [i, t, e]), y = p ? p.label : C;
104
+ return /* @__PURE__ */ o(O, { error: V, children: /* @__PURE__ */ h(
105
+ P,
99
106
  {
100
- items: t,
101
- value: e,
102
- onInputValueChange: l,
103
- onValueChange: n ? void 0 : (r) => {
104
- if (!r || r.value === p) {
105
- a?.(""), l("");
107
+ items: w,
108
+ value: p,
109
+ itemToStringLabel: (r) => r.label,
110
+ itemToStringValue: (r) => r.value,
111
+ isItemEqualToValue: (r, n) => r.value === n.value,
112
+ onInputValueChange: a,
113
+ onValueChange: m ? void 0 : (r) => {
114
+ if (!r || r.value === l) {
115
+ c?.(""), a("");
106
116
  return;
107
117
  }
108
- a?.(r.value, r), l("");
118
+ c?.(r.value, r), a("");
109
119
  },
110
120
  children: [
111
121
  /* @__PURE__ */ o(
112
- N,
122
+ R,
113
123
  {
114
- disabled: n,
115
- className: g,
116
- placeholder: e ? I : d
124
+ ...L,
125
+ disabled: m,
126
+ className: T,
127
+ placeholder: p ? y : d,
128
+ showClear: I
117
129
  }
118
130
  ),
119
- /* @__PURE__ */ f(O, { children: [
120
- /* @__PURE__ */ o(R, { children: v ? x : C }),
121
- /* @__PURE__ */ o(T, { children: E.map((r) => /* @__PURE__ */ o(
122
- z,
131
+ /* @__PURE__ */ h(q, { children: [
132
+ /* @__PURE__ */ o(z, { children: E ? g : x }),
133
+ /* @__PURE__ */ o(B, { children: (r) => /* @__PURE__ */ o(
134
+ D,
123
135
  {
124
136
  value: r,
125
- children: c ? c(r) : /* @__PURE__ */ o("div", { className: "hover:bg-primary-hover-bg w-full px-4 py-2", children: r.label })
137
+ children: f ? f(r) : /* @__PURE__ */ o("div", { className: "hover:bg-primary-hover-bg w-full px-4 py-2", children: r.label })
126
138
  },
127
139
  r.value
128
- )) })
140
+ ) })
129
141
  ] })
130
142
  ]
131
143
  }
132
- );
144
+ ) });
133
145
  };
134
146
  export {
135
- Fr as InputSearch
147
+ Qr as InputSearch
136
148
  };
137
149
  //# sourceMappingURL=components-input-search-input-search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components-input-search-input-search.js","sources":["../src/components/input-search/input-search.tsx"],"sourcesContent":["import {\n Combobox,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n} from \"@/index\";\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nexport type InputSearchOption<T = unknown> = {\n value: string;\n label: string;\n meta?: T;\n};\n\ntype InputSearchProps<T = unknown> = {\n options: InputSearchOption<T>[];\n value?: string;\n onChange?: (value: string, option?: InputSearchOption<T>) => void;\n onSearch?: (search: string) => void;\n placeholder?: string;\n searchPlaceholder?: string;\n emptyText?: string;\n loadingText?: string;\n loading?: boolean;\n disabled?: boolean;\n className?: string;\n renderOption?: (option: InputSearchOption<T>) => ReactNode;\n debounceMs?: number;\n};\n\nconst DEBOUNCE_MS = 300;\n\nexport const InputSearch = <T,>({\n options,\n value,\n onChange,\n onSearch,\n placeholder = \"Выберите...\",\n searchPlaceholder = \"Поиск...\",\n emptyText = \"Ничего не найдено\",\n loadingText = \"Загрузка...\",\n loading = false,\n disabled = false,\n className,\n renderOption,\n debounceMs = DEBOUNCE_MS,\n}: InputSearchProps<T>) => {\n const [searchValue, setSearchValue] = useState(\"\");\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (!onSearch) return;\n\n timerRef.current = setTimeout(() => {\n onSearch(searchValue);\n }, debounceMs);\n\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n };\n }, [debounceMs, onSearch, searchValue]);\n\n const selectedOption = useMemo(\n () => options.find((option) => option.value === value) ?? null,\n [options, value],\n );\n\n const filteredOptions = useMemo(() => {\n if (onSearch) return options;\n\n const normalizedSearch = searchValue.trim().toLowerCase();\n if (!normalizedSearch) return options;\n\n return options.filter((option) =>\n option.label.toLowerCase().includes(normalizedSearch),\n );\n }, [onSearch, options, searchValue]);\n\n const inputPlaceholder = selectedOption ? selectedOption.label : placeholder;\n\n const handleChange = (option: InputSearchOption<T> | null) => {\n if (!option || option.value === value) {\n onChange?.(\"\");\n setSearchValue(\"\");\n return;\n }\n\n onChange?.(option.value, option);\n setSearchValue(\"\");\n };\n\n return (\n <Combobox\n items={options}\n value={selectedOption}\n onInputValueChange={setSearchValue}\n onValueChange={disabled ? undefined : handleChange}\n >\n <ComboboxInput\n disabled={disabled}\n className={className}\n placeholder={selectedOption ? inputPlaceholder : searchPlaceholder}\n />\n\n <ComboboxContent>\n <ComboboxEmpty>{loading ? loadingText : emptyText}</ComboboxEmpty>\n <ComboboxList>\n {filteredOptions.map((option) => (\n <ComboboxItem\n key={option.value}\n value={option}\n >\n {renderOption ? (\n renderOption(option)\n ) : (\n <div className=\"hover:bg-primary-hover-bg w-full px-4 py-2\">\n {option.label}\n </div>\n )}\n </ComboboxItem>\n ))}\n </ComboboxList>\n </ComboboxContent>\n </Combobox>\n );\n};\n\nexport type { InputSearchProps };\n"],"names":["DEBOUNCE_MS","InputSearch","options","value","onChange","onSearch","placeholder","searchPlaceholder","emptyText","loadingText","loading","disabled","className","renderOption","debounceMs","searchValue","setSearchValue","useState","timerRef","useRef","useEffect","selectedOption","useMemo","option","filteredOptions","normalizedSearch","inputPlaceholder","jsxs","Combobox","jsx","ComboboxInput","ComboboxContent","ComboboxEmpty","ComboboxList","ComboboxItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,IAAc,KAEPC,KAAc,CAAK;AAAA,EAC9B,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,mBAAAC,IAAoB;AAAA,EACpB,WAAAC,IAAY;AAAA,EACZ,aAAAC,IAAc;AAAA,EACd,SAAAC,IAAU;AAAA,EACV,UAAAC,IAAW;AAAA,EACX,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC,IAAad;AACf,MAA2B;AACzB,QAAM,CAACe,GAAaC,CAAc,IAAIC,EAAS,EAAE,GAC3CC,IAAWC,EAA6C,IAAI;AAElE,EAAAC,EAAU,MAAM;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AtB,IAAUD,IAAcD,GAAU;AAAA,UAClD,gBAAAqB,EAACI,GAAA,EACE,UAAAT,EAAgB,IAAI,CAACD,MACpB,gBAAAM;AAAA,YAACK;AAAA,YAAA;AAAA,cAEC,OAAOX;AAAA,cAEN,UAAAV,IACCA,EAAaU,CAAM,sBAElB,OAAA,EAAI,WAAU,8CACZ,UAAAA,EAAO,MAAA,CACV;AAAA,YAAA;AAAA,YARGA,EAAO;AAAA,UAAA,CAWf,EAAA,CACH;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"components-input-search-input-search.js","sources":["../src/components/input-search/input-search.tsx"],"sourcesContent":["import {\n Combobox,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxField,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n} from \"@/index\";\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\n\nexport type InputSearchOption<T = unknown> = {\n value: string;\n label: string;\n meta?: T;\n};\n\ntype InputSearchProps<T = unknown> = {\n options: InputSearchOption<T>[];\n value?: string;\n onChange?: (value: string, option?: InputSearchOption<T>) => void;\n onSearch?: (search: string) => void;\n placeholder?: string;\n searchPlaceholder?: string;\n emptyText?: string;\n loadingText?: string;\n loading?: boolean;\n disabled?: boolean;\n className?: string;\n renderOption?: (option: InputSearchOption<T>) => ReactNode;\n debounceMs?: number;\n showClear?: boolean;\n isValid?: boolean;\n error?: string;\n};\n\nconst DEBOUNCE_MS = 300;\n\nexport const InputSearch = <T,>({\n options,\n value,\n onChange,\n onSearch,\n placeholder = \"Выберите...\",\n searchPlaceholder = \"Поиск...\",\n emptyText = \"Ничего не найдено\",\n loadingText = \"Загрузка...\",\n loading = false,\n disabled = false,\n showClear = false,\n isValid,\n className,\n error,\n renderOption,\n debounceMs = DEBOUNCE_MS,\n}: InputSearchProps<T>) => {\n const [searchValue, setSearchValue] = useState(\"\");\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (!onSearch) return;\n\n timerRef.current = setTimeout(() => {\n onSearch(searchValue);\n }, debounceMs);\n\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n };\n }, [debounceMs, onSearch, searchValue]);\n\n const validationProps = {\n ...(isValid === true && !disabled && { \"aria-valid\": true }),\n ...(isValid === false && !disabled && { \"aria-invalid\": true }),\n disabled,\n };\n\n const selectedOption = useMemo(\n () => options.find((option) => option.value === value) ?? null,\n [options, value],\n );\n\n const filteredOptions = useMemo(() => {\n if (onSearch) return options;\n\n const normalizedSearch = searchValue.trim().toLowerCase();\n if (!normalizedSearch) return options;\n\n return options.filter((option) =>\n option.label.toLowerCase().includes(normalizedSearch),\n );\n }, [onSearch, options, searchValue]);\n\n const inputPlaceholder = selectedOption ? selectedOption.label : placeholder;\n\n const handleChange = (option: InputSearchOption<T> | null) => {\n if (!option || option.value === value) {\n onChange?.(\"\");\n setSearchValue(\"\");\n return;\n }\n\n onChange?.(option.value, option);\n setSearchValue(\"\");\n };\n\n return (\n <ComboboxField error={error}>\n <Combobox\n items={filteredOptions}\n value={selectedOption}\n itemToStringLabel={(option) => option.label}\n itemToStringValue={(option) => option.value}\n isItemEqualToValue={(option, currentValue) =>\n option.value === currentValue.value\n }\n onInputValueChange={setSearchValue}\n onValueChange={disabled ? undefined : handleChange}\n >\n <ComboboxInput\n {...validationProps}\n disabled={disabled}\n className={className}\n placeholder={selectedOption ? inputPlaceholder : searchPlaceholder}\n showClear={showClear}\n />\n\n <ComboboxContent>\n <ComboboxEmpty>{loading ? loadingText : emptyText}</ComboboxEmpty>\n <ComboboxList>\n {(option: InputSearchOption<T>) => (\n <ComboboxItem\n key={option.value}\n value={option}\n >\n {renderOption ? (\n renderOption(option)\n ) : (\n <div className=\"hover:bg-primary-hover-bg w-full px-4 py-2\">\n {option.label}\n </div>\n )}\n </ComboboxItem>\n )}\n </ComboboxList>\n </ComboboxContent>\n </Combobox>\n </ComboboxField>\n );\n};\n\nexport type { InputSearchProps };\n"],"names":["DEBOUNCE_MS","InputSearch","options","value","onChange","onSearch","placeholder","searchPlaceholder","emptyText","loadingText","loading","disabled","showClear","isValid","className","error","renderOption","debounceMs","searchValue","setSearchValue","useState","timerRef","useRef","useEffect","validationProps","selectedOption","useMemo","option","filteredOptions","normalizedSearch","inputPlaceholder","jsx","ComboboxField","jsxs","Combobox","currentValue","ComboboxInput","ComboboxContent","ComboboxEmpty","ComboboxList","ComboboxItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAMA,IAAc,KAEPC,KAAc,CAAK;AAAA,EAC9B,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,mBAAAC,IAAoB;AAAA,EACpB,WAAAC,IAAY;AAAA,EACZ,aAAAC,IAAc;AAAA,EACd,SAAAC,IAAU;AAAA,EACV,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC,IAAajB;AACf,MAA2B;AACzB,QAAM,CAACkB,GAAaC,CAAc,IAAIC,EAAS,EAAE,GAC3CC,IAAWC,EAA6C,IAAI;AAElE,EAAAC,EAAU,MAAM;AACd,QAAKlB;AAEL,aAAAgB,EAAS,UAAU,WAAW,MAAM;AAClC,QAAAhB,EAASa,CAAW;AAAA,MACtB,GAAGD,CAAU,GAEN,MAAM;AACX,QAAII,EAAS,WACX,aAAaA,EAAS,OAAO;AAAA,MAEjC;AAAA,EACF,GAAG,CAACJ,GAAYZ,GAAUa,CAAW,CAAC;AAEtC,QAAMM,IAAkB;AAAA,IACtB,GAAIX,MAAY,MAAQ,CAACF,KAAY,EAAE,cAAc,GAAA;AAAA,IACrD,GAAIE,MAAY,MAAS,CAACF,KAAY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EACC,UAAA;AAAA,UAAA,gBAAAN,EAACO,GAAA,EAAe,UAAA5B,IAAUD,IAAcD,GAAU;AAAA,UAClD,gBAAAuB,EAACQ,GAAA,EACE,UAAA,CAACZ,MACA,gBAAAI;AAAA,YAACS;AAAA,YAAA;AAAA,cAEC,OAAOb;AAAA,cAEN,UAAAX,IACCA,EAAaW,CAAM,sBAElB,OAAA,EAAI,WAAU,8CACZ,UAAAA,EAAO,MAAA,CACV;AAAA,YAAA;AAAA,YARGA,EAAO;AAAA,UAAA,EAUd,CAEJ;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("brd-phosphor-strokes-icons/icons"),r={"arrow-counter-clockwise":e.ArrowCounterClockwise,"arrow-down-left":e.ArrowDownLeft,"arrow-u-down-left":e.ArrowUDownLeft,"bell-ringing":e.BellRinging,"bounding-box":e.BoundingBox,briefcase:e.Briefcase,building:e.Building,buildings:e.Buildings,"calendar-dots":e.CalendarDots,"caret-down":e.CaretDown,"caret-left":e.CaretLeft,"caret-left-filled":e.CaretLeftFilled,"caret-right":e.CaretRight,"caret-right-filled":e.CaretRightFilled,"caret-up":e.CaretUp,"caret-up-down":e.CaretUpDown,"chart-line":e.ChartLine,"chat-circle":e.ChatCircle,check:e.Check,"check-circle":e.CheckCircle,clock:e.Clock,"columns-plus-right":e.ColumnsPlusRight,copy:e.Copy,"credit-card":e.CreditCard,"dots-three":e.DotsThree,"download-simple":e.DownloadSimple,envelope:e.Envelope,"envelope-simple":e.EnvelopeSimple,eye:e.Eye,"eye-slash":e.EyeSlash,"file-text":e.FileText,folder:e.Folder,funnel:e.Funnel,gear:e.Gear,hash:e.Hash,info:e.Info,link:e.Link,"list-bullets":e.ListBullets,"lock-key":e.LockKey,"magnifying-glass":e.MagnifyingGlass,"max-logo":e.MaxLogo,package:e.Package,"paper-plane-tilt":e.PaperPlaneTilt,pencil:e.Pencil,"pencil-simple":e.PencilSimple,phone:e.Phone,plus:e.Plus,"presentation-chart":e.PresentationChart,question:e.Question,"share-network":e.ShareNetwork,"spinner-gap":e.SpinnerGap,"squares-four":e.SquaresFour,"telegram-logo":e.TelegramLogo,trash:e.Trash,"user-circle-gear":e.UserCircleGear,users:e.Users,"users-four":e.UsersFour,warning:e.Warning,"warning-circle":e.WarningCircle,"whats-app-logo-filled":e.WhatsAppLogoFilled,wrench:e.Wrench,x:e.X,"x-circle":e.XCircle},l=Object.keys(r);exports.iconComponents=r;exports.supportedIconTypes=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("brd-phosphor-strokes-icons/icons"),r={"arrow-counter-clockwise":e.ArrowCounterClockwise,"arrow-down-left":e.ArrowDownLeft,"arrow-u-down-left":e.ArrowUDownLeft,"bell-ringing":e.BellRinging,"bounding-box":e.BoundingBox,briefcase:e.Briefcase,building:e.Building,buildings:e.Buildings,"calendar-dots":e.CalendarDots,"caret-down":e.CaretDown,"caret-left":e.CaretLeft,"caret-left-filled":e.CaretLeftFilled,"caret-right":e.CaretRight,"caret-right-filled":e.CaretRightFilled,"caret-up":e.CaretUp,"caret-up-down":e.CaretUpDown,"chart-line":e.ChartLine,"chat-circle":e.ChatCircle,check:e.Check,"check-circle":e.CheckCircle,clock:e.Clock,"columns-plus-right":e.ColumnsPlusRight,copy:e.Copy,"credit-card":e.CreditCard,"dots-three":e.DotsThree,"download-simple":e.DownloadSimple,envelope:e.Envelope,"envelope-simple":e.EnvelopeSimple,eye:e.Eye,"eye-slash":e.EyeSlash,"file-text":e.FileText,folder:e.Folder,funnel:e.Funnel,gear:e.Gear,hash:e.Hash,info:e.Info,link:e.Link,"list-bullets":e.ListBullets,"lock-key":e.LockKey,"magnifying-glass":e.MagnifyingGlass,"max-logo":e.MaxLogo,package:e.Package,"paper-plane-tilt":e.PaperPlaneTilt,pencil:e.Pencil,"pencil-simple":e.PencilSimple,phone:e.Phone,plus:e.Plus,"presentation-chart":e.PresentationChart,question:e.Question,"share-network":e.ShareNetwork,"spinner-gap":e.SpinnerGap,"squares-four":e.SquaresFour,"telegram-logo":e.TelegramLogo,trash:e.Trash,"user-circle-gear":e.UserCircleGear,users:e.Users,"users-four":e.UsersFour,warning:e.Warning,"warning-circle":e.WarningCircle,"whats-app-logo-filled":e.WhatsAppLogoFilled,wrench:e.Wrench,x:e.X,"x-circle":e.XCircle,"clipboard-text":e.ClipboardText,"chart-line-up":e.ChartLineUp,"currency-circle-dollar":e.CurrencyCircleDollar,"shield-check":e.ShieldCheck},l=Object.keys(r);exports.iconComponents=r;exports.supportedIconTypes=l;
2
2
  //# sourceMappingURL=components-ui-icon-icon-map.cjs.map