brd-ui-kit 0.1.79 → 0.1.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/brd-ui-kit.css +1 -1
  2. package/dist/calendar-PqChui7l.cjs.map +1 -1
  3. package/dist/calendar-XWqEaWHP.js.map +1 -1
  4. package/dist/components/basic-modal/basic-modal.d.ts +4 -2
  5. package/dist/components/input-field/input-field.d.ts +2 -0
  6. package/dist/components/transfer-list/index.d.ts +1 -0
  7. package/dist/components/transfer-list/transfer-list-card.d.ts +22 -0
  8. package/dist/components/transfer-list/transfer-list.d.ts +12 -0
  9. package/dist/components/transfer-list.d.ts +2 -0
  10. package/dist/components/ui/calendar/calendar.d.ts +1 -0
  11. package/dist/components/ui/calendar/index.d.ts +1 -1
  12. package/dist/components/ui/dialog/dialog.d.ts +4 -2
  13. package/dist/components/ui/dialog/dialog.styles.d.ts +6 -1
  14. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +3 -3
  15. package/dist/components-basic-avatar-basic-avatar.cjs +2 -2
  16. package/dist/components-basic-avatar-basic-avatar.cjs.map +1 -1
  17. package/dist/components-basic-avatar-basic-avatar.js +35 -32
  18. package/dist/components-basic-avatar-basic-avatar.js.map +1 -1
  19. package/dist/components-basic-modal-basic-modal.cjs +1 -1
  20. package/dist/components-basic-modal-basic-modal.cjs.map +1 -1
  21. package/dist/components-basic-modal-basic-modal.js +30 -24
  22. package/dist/components-basic-modal-basic-modal.js.map +1 -1
  23. package/dist/components-input-contact-input-contact.cjs +3 -3
  24. package/dist/components-input-contact-input-contact.cjs.map +1 -1
  25. package/dist/components-input-contact-input-contact.js +8 -8
  26. package/dist/components-input-contact-input-contact.js.map +1 -1
  27. package/dist/components-input-field-input-field.cjs +1 -1
  28. package/dist/components-input-field-input-field.cjs.map +1 -1
  29. package/dist/components-input-field-input-field.js +44 -36
  30. package/dist/components-input-field-input-field.js.map +1 -1
  31. package/dist/components-transfer-list-transfer-list-card.cjs +5 -0
  32. package/dist/components-transfer-list-transfer-list-card.cjs.map +1 -0
  33. package/dist/components-transfer-list-transfer-list-card.js +194 -0
  34. package/dist/components-transfer-list-transfer-list-card.js.map +1 -0
  35. package/dist/components-transfer-list-transfer-list.cjs +2 -0
  36. package/dist/components-transfer-list-transfer-list.cjs.map +1 -0
  37. package/dist/components-transfer-list-transfer-list.js +123 -0
  38. package/dist/components-transfer-list-transfer-list.js.map +1 -0
  39. package/dist/components-transfer-list.cjs +2 -0
  40. package/dist/components-transfer-list.cjs.map +1 -0
  41. package/dist/components-transfer-list.js +5 -0
  42. package/dist/components-transfer-list.js.map +1 -0
  43. package/dist/components-ui-avatar-avatar.cjs.map +1 -1
  44. package/dist/components-ui-avatar-avatar.js.map +1 -1
  45. package/dist/components-ui-dialog-dialog.cjs +1 -1
  46. package/dist/components-ui-dialog-dialog.cjs.map +1 -1
  47. package/dist/components-ui-dialog-dialog.js +49 -42
  48. package/dist/components-ui-dialog-dialog.js.map +1 -1
  49. package/dist/components-ui-dialog-dialog.styles.cjs +1 -1
  50. package/dist/components-ui-dialog-dialog.styles.cjs.map +1 -1
  51. package/dist/components-ui-dialog-dialog.styles.js +34 -17
  52. package/dist/components-ui-dialog-dialog.styles.js.map +1 -1
  53. package/dist/components-ui-dropdown-menu-dropdown-menu.cjs.map +1 -1
  54. package/dist/components-ui-dropdown-menu-dropdown-menu.js.map +1 -1
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.d.ts +2 -1
  57. package/dist/index.js +14 -12
  58. package/dist/index.js.map +1 -1
  59. package/package.json +10 -1
@@ -1,8 +1,8 @@
1
1
  import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
2
  import { CaretDown as k } from "phosphor-strokes-icons/icons/CaretDown";
3
- import { CaretUp as N } from "phosphor-strokes-icons/icons/CaretUp";
4
- import { EnvelopeSimple as T } from "phosphor-strokes-icons/icons/EnvelopeSimple";
5
- import { MaxLogo as z } from "phosphor-strokes-icons/icons/MaxLogo";
3
+ import { CaretUp as z } from "phosphor-strokes-icons/icons/CaretUp";
4
+ import { EnvelopeSimple as N } from "phosphor-strokes-icons/icons/EnvelopeSimple";
5
+ import { MaxLogo as T } from "phosphor-strokes-icons/icons/MaxLogo";
6
6
  import { Phone as S } from "phosphor-strokes-icons/icons/Phone";
7
7
  import { StrokeIcon as n } from "./components-icons-stroke-icon.js";
8
8
  import { TelegramLogo as D } from "phosphor-strokes-icons/icons/TelegramLogo";
@@ -88,8 +88,8 @@ const B = [
88
88
  phone: S,
89
89
  "telegram-logo": D,
90
90
  "whats-app-logo-filled": E,
91
- "max-logo": z,
92
- "envelope-simple": T
91
+ "max-logo": T,
92
+ "envelope-simple": N
93
93
  }, x = (t) => {
94
94
  switch (t) {
95
95
  case "max-logo":
@@ -103,7 +103,7 @@ const B = [
103
103
  case "whats-app-logo-filled":
104
104
  return {
105
105
  bgColor: "bg-[#00C202]",
106
- textColor: "text-[#00C202]"
106
+ textColor: "text-primary-inverse-text"
107
107
  };
108
108
  default:
109
109
  return {};
@@ -142,7 +142,7 @@ const B = [
142
142
  }
143
143
  }, I = (o) => () => {
144
144
  y(o), w?.(o), p();
145
- }, d = h[r], g = m ? N : k;
145
+ }, d = h[r], g = m ? z : k;
146
146
  return /* @__PURE__ */ f("div", { className: C("relative", t.classes?.container), children: [
147
147
  ["telegram-logo", "max-logo", "envelope-simple"].includes(r) ? /* @__PURE__ */ e(
148
148
  M,
@@ -216,7 +216,7 @@ const B = [
216
216
  m && /* @__PURE__ */ e(
217
217
  "div",
218
218
  {
219
- className: `border-inp-hover-border bg-primary-bg absolute my-2 flex w-full
219
+ className: `border-inp-hover-border bg-primary-bg absolute z-100 my-2 flex w-full
220
220
  flex-col rounded-xl border`,
221
221
  ref: l,
222
222
  children: B.map(({ label: o, icon: i }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"components-input-contact-input-contact.js","sources":["../src/constants/contact-input.ts","../src/components/input-contact/input-contact.tsx"],"sourcesContent":["import type { TOption } from \"@/components/input-contact/input-contact\";\n\nexport const OPTIONS: TOption[] = [\n {\n label: \"Мобильный\",\n icon: \"phone\",\n },\n {\n label: \"Telegram\",\n icon: \"telegram-logo\",\n },\n {\n label: \"WhatsApp\",\n icon: \"whats-app-logo-filled\",\n },\n {\n label: \"Max\",\n icon: \"max-logo\",\n },\n {\n label: \"E-mail\",\n icon: \"envelope-simple\",\n },\n];\n","import { OPTIONS } from \"@/constants/contact-input\";\nimport { CaretDown } from \"@/components/icons/CaretDown\";\nimport { CaretUp } from \"@/components/icons/CaretUp\";\nimport { EnvelopeSimple } from \"@/components/icons/EnvelopeSimple\";\nimport { MaxLogo } from \"@/components/icons/MaxLogo\";\nimport { Phone } from \"@/components/icons/Phone\";\nimport { StrokeIcon, type StrokeIconComponent } from \"@/components/icons/stroke-icon\";\nimport { TelegramLogo } from \"@/components/icons/TelegramLogo\";\nimport { WhatsAppLogoFilled } from \"@/components/icons/WhatsAppLogoFilled\";\nimport {\n Button,\n InputField,\n InputPhone,\n cn,\n usePopupControls,\n type InputPhoneProps,\n} from \"@/index\";\nimport { useEffect, useRef, useState } from \"react\";\n\nexport type TOption = {\n label: string;\n icon: TypesChange;\n};\n\ntype TypesChange =\n | \"phone\"\n | \"telegram-logo\"\n | \"whats-app-logo-filled\"\n | \"max-logo\"\n | \"envelope-simple\";\n\nconst contactIcons: Record<TypesChange, StrokeIconComponent> = {\n phone: Phone,\n \"telegram-logo\": TelegramLogo,\n \"whats-app-logo-filled\": WhatsAppLogoFilled,\n \"max-logo\": MaxLogo,\n \"envelope-simple\": EnvelopeSimple,\n};\n\ntype Props = {\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n container?: string;\n };\n value?: string;\n name?: string;\n onTypeChange?: (type: TypesChange) => void;\n inputProps: React.ComponentPropsWithRef<\"input\">;\n inputPhoneProps: InputPhoneProps;\n};\n\n// TODO: заменить цвета\nconst iconStyles = (icon: TypesChange) => {\n switch (icon) {\n case \"max-logo\":\n return {\n bgColor: \"bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]\",\n };\n\n case \"telegram-logo\":\n return {\n bgColor: \"bg-[#289AD2]\",\n };\n\n case \"whats-app-logo-filled\":\n return {\n bgColor: \"bg-[#00C202]\",\n textColor: \"text-[#00C202]\",\n };\n\n default:\n return {};\n }\n};\n\nconst getContactIconClasses = (icon: TypesChange) => ({\n wrapper: cn(\n `flex h-5.5 w-5.5 shrink-0 items-center justify-center rounded-sm\n ${iconStyles(icon).bgColor ?? \"bg-primary-inverse-hover-bg\"}\n ${iconStyles(icon).textColor ?? \"text-primary-inverse-text\"}`,\n ),\n icon: \"size-5 shrink-0\",\n});\n\nexport const InputContact = (props: Props) => {\n const { inputProps, inputPhoneProps, onTypeChange, ...rest } = props;\n\n const [type, setType] = useState<TypesChange>(\"phone\");\n const { isOpened, openPopup, closePopup } = usePopupControls();\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) {\n closePopup();\n }\n };\n\n if (isOpened) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [isOpened, closePopup]);\n\n const getPlaceholder = (type: TypesChange): string => {\n switch (type) {\n case \"phone\":\n return \"+7 (999) 999-99-99\";\n case \"telegram-logo\":\n return \"@username\";\n case \"whats-app-logo-filled\":\n return \"+7 (999) 999-99-99\";\n case \"max-logo\":\n return \"ID пользователя Max\";\n case \"envelope-simple\":\n return \"example@mail.com\";\n default:\n return \"Введите значение\";\n }\n };\n\n const handleTypeChange = (type: TypesChange) => {\n return () => {\n setType(type);\n onTypeChange?.(type);\n closePopup();\n };\n };\n\n const SelectedIcon = contactIcons[type];\n const ToggleIcon = isOpened ? CaretUp : CaretDown;\n\n return (\n <div className={cn(\"relative\", props.classes?.container)}>\n {[\"telegram-logo\", \"max-logo\", \"envelope-simple\"].includes(type) ? (\n <InputField\n {...inputProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n ) : (\n <InputPhone\n {...inputPhoneProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n )}\n\n {isOpened && (\n <div\n className=\"border-inp-hover-border bg-primary-bg absolute my-2 flex w-full\n flex-col rounded-xl border\"\n ref={wrapperRef}\n >\n {OPTIONS.map(({ label, icon }) => {\n const OptionIcon = contactIcons[icon];\n\n return (\n <Button\n key={label}\n variant=\"ghost\"\n className=\"flex w-full justify-start\"\n type=\"button\"\n onClick={handleTypeChange(icon)}\n >\n <StrokeIcon\n icon={OptionIcon}\n size=\"medium\"\n className=\"text-primary-inverse-text\"\n classes={getContactIconClasses(icon)}\n />\n\n {label}\n </Button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport type { Props as InputContactProps, TypesChange };\n"],"names":["OPTIONS","contactIcons","Phone","TelegramLogo","WhatsAppLogoFilled","MaxLogo","EnvelopeSimple","iconStyles","icon","getContactIconClasses","cn","InputContact","props","inputProps","inputPhoneProps","onTypeChange","rest","type","setType","useState","isOpened","openPopup","closePopup","usePopupControls","wrapperRef","useRef","useEffect","handleClickOutside","event","getPlaceholder","handleTypeChange","SelectedIcon","ToggleIcon","CaretUp","CaretDown","jsxs","jsx","InputField","StrokeIcon","InputPhone","label","OptionIcon","Button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,IAAqB;AAAA,EAChC;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAEV,GCQMC,IAAyD;AAAA,EAC7D,OAAOC;AAAA,EACP,iBAAiBC;AAAA,EACjB,yBAAyBC;AAAA,EACzB,YAAYC;AAAA,EACZ,mBAAmBC;AACrB,GAoBMC,IAAa,CAACC,MAAsB;AACxC,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,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,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A,cAE9B,UAAA;AAAA,gBAAA,gBAAA4B;AAAA,kBAACE;AAAA,kBAAA;AAAA,oBACC,MAAMG;AAAA,oBACN,MAAK;AAAA,oBACL,WAAU;AAAA,oBACV,SAAShC,EAAsBD,CAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGpCgC;AAAA,cAAA;AAAA,YAAA;AAAA,YAbIA;AAAA,UAAA;AAAA,QAgBX,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"components-input-contact-input-contact.js","sources":["../src/constants/contact-input.ts","../src/components/input-contact/input-contact.tsx"],"sourcesContent":["import type { TOption } from \"@/components/input-contact/input-contact\";\n\nexport const OPTIONS: TOption[] = [\n {\n label: \"Мобильный\",\n icon: \"phone\",\n },\n {\n label: \"Telegram\",\n icon: \"telegram-logo\",\n },\n {\n label: \"WhatsApp\",\n icon: \"whats-app-logo-filled\",\n },\n {\n label: \"Max\",\n icon: \"max-logo\",\n },\n {\n label: \"E-mail\",\n icon: \"envelope-simple\",\n },\n];\n","import { OPTIONS } from \"@/constants/contact-input\";\nimport { CaretDown } from \"@/components/icons/CaretDown\";\nimport { CaretUp } from \"@/components/icons/CaretUp\";\nimport { EnvelopeSimple } from \"@/components/icons/EnvelopeSimple\";\nimport { MaxLogo } from \"@/components/icons/MaxLogo\";\nimport { Phone } from \"@/components/icons/Phone\";\nimport { StrokeIcon, type StrokeIconComponent } from \"@/components/icons/stroke-icon\";\nimport { TelegramLogo } from \"@/components/icons/TelegramLogo\";\nimport { WhatsAppLogoFilled } from \"@/components/icons/WhatsAppLogoFilled\";\nimport {\n Button,\n InputField,\n InputPhone,\n cn,\n usePopupControls,\n type InputPhoneProps,\n} from \"@/index\";\nimport { useEffect, useRef, useState } from \"react\";\n\nexport type TOption = {\n label: string;\n icon: TypesChange;\n};\n\ntype TypesChange =\n | \"phone\"\n | \"telegram-logo\"\n | \"whats-app-logo-filled\"\n | \"max-logo\"\n | \"envelope-simple\";\n\nconst contactIcons: Record<TypesChange, StrokeIconComponent> = {\n phone: Phone,\n \"telegram-logo\": TelegramLogo,\n \"whats-app-logo-filled\": WhatsAppLogoFilled,\n \"max-logo\": MaxLogo,\n \"envelope-simple\": EnvelopeSimple,\n};\n\ntype Props = {\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n container?: string;\n };\n value?: string;\n name?: string;\n onTypeChange?: (type: TypesChange) => void;\n inputProps: React.ComponentPropsWithRef<\"input\">;\n inputPhoneProps: InputPhoneProps;\n};\n\n// TODO: заменить цвета\nconst iconStyles = (icon: TypesChange) => {\n switch (icon) {\n case \"max-logo\":\n return {\n bgColor: \"bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]\",\n };\n\n case \"telegram-logo\":\n return {\n bgColor: \"bg-[#289AD2]\",\n };\n\n case \"whats-app-logo-filled\":\n return {\n bgColor: \"bg-[#00C202]\",\n textColor: \"text-primary-inverse-text\",\n };\n\n default:\n return {};\n }\n};\n\nconst getContactIconClasses = (icon: TypesChange) => ({\n wrapper: cn(\n `flex h-5.5 w-5.5 shrink-0 items-center justify-center rounded-sm\n ${iconStyles(icon).bgColor ?? \"bg-primary-inverse-hover-bg\"}\n ${iconStyles(icon).textColor ?? \"text-primary-inverse-text\"}`,\n ),\n icon: \"size-5 shrink-0\",\n});\n\nexport const InputContact = (props: Props) => {\n const { inputProps, inputPhoneProps, onTypeChange, ...rest } = props;\n\n const [type, setType] = useState<TypesChange>(\"phone\");\n const { isOpened, openPopup, closePopup } = usePopupControls();\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) {\n closePopup();\n }\n };\n\n if (isOpened) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [isOpened, closePopup]);\n\n const getPlaceholder = (type: TypesChange): string => {\n switch (type) {\n case \"phone\":\n return \"+7 (999) 999-99-99\";\n case \"telegram-logo\":\n return \"@username\";\n case \"whats-app-logo-filled\":\n return \"+7 (999) 999-99-99\";\n case \"max-logo\":\n return \"ID пользователя Max\";\n case \"envelope-simple\":\n return \"example@mail.com\";\n default:\n return \"Введите значение\";\n }\n };\n\n const handleTypeChange = (type: TypesChange) => {\n return () => {\n setType(type);\n onTypeChange?.(type);\n closePopup();\n };\n };\n\n const SelectedIcon = contactIcons[type];\n const ToggleIcon = isOpened ? CaretUp : CaretDown;\n\n return (\n <div className={cn(\"relative\", props.classes?.container)}>\n {[\"telegram-logo\", \"max-logo\", \"envelope-simple\"].includes(type) ? (\n <InputField\n {...inputProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n ) : (\n <InputPhone\n {...inputPhoneProps}\n {...rest}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <StrokeIcon\n icon={SelectedIcon}\n size=\"medium\"\n classes={getContactIconClasses(type)}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <StrokeIcon\n icon={ToggleIcon}\n size=\"medium\"\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n )}\n\n {isOpened && (\n <div\n className=\"border-inp-hover-border bg-primary-bg absolute z-100 my-2 flex w-full\n flex-col rounded-xl border\"\n ref={wrapperRef}\n >\n {OPTIONS.map(({ label, icon }) => {\n const OptionIcon = contactIcons[icon];\n\n return (\n <Button\n key={label}\n variant=\"ghost\"\n className=\"flex w-full justify-start\"\n type=\"button\"\n onClick={handleTypeChange(icon)}\n >\n <StrokeIcon\n icon={OptionIcon}\n size=\"medium\"\n className=\"text-primary-inverse-text\"\n classes={getContactIconClasses(icon)}\n />\n\n {label}\n </Button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport type { Props as InputContactProps, TypesChange };\n"],"names":["OPTIONS","contactIcons","Phone","TelegramLogo","WhatsAppLogoFilled","MaxLogo","EnvelopeSimple","iconStyles","icon","getContactIconClasses","cn","InputContact","props","inputProps","inputPhoneProps","onTypeChange","rest","type","setType","useState","isOpened","openPopup","closePopup","usePopupControls","wrapperRef","useRef","useEffect","handleClickOutside","event","getPlaceholder","handleTypeChange","SelectedIcon","ToggleIcon","CaretUp","CaretDown","jsxs","jsx","InputField","StrokeIcon","InputPhone","label","OptionIcon","Button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,IAAqB;AAAA,EAChC;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER;AAAA,IACE,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAEV,GCQMC,IAAyD;AAAA,EAC7D,OAAOC;AAAA,EACP,iBAAiBC;AAAA,EACjB,yBAAyBC;AAAA,EACzB,YAAYC;AAAA,EACZ,mBAAmBC;AACrB,GAoBMC,IAAa,CAACC,MAAsB;AACxC,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IAGb,KAAK;AACH,aAAO;AAAA,QACL,SAAS;AAAA,MAAA;AA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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,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("./components-ui-field-field.cjs"),j=require("./components-ui-input-input.cjs"),o=require("./components-ui-input-group-input-group.cjs"),m=({date:p=[],isValid:l,disabled:e=!1,label:s,description:c,classes:u,ref:d,...a})=>{const t={...l===!0&&!e&&{"aria-valid":!0},...l===!1&&!e&&{"aria-invalid":!0},disabled:e};return n.jsx(i.FieldSet,{className:u?.fieldset,children:n.jsx(i.FieldGroup,{className:u?.fieldgroup,children:n.jsxs(i.Field,{className:u?.field,children:[s&&n.jsx(i.FieldLabel,{...t,children:s}),p.length>0?n.jsxs(o.InputGroup,{"data-slot":!0,children:[n.jsx(o.InputGroupInput,{ref:d,...a,...t,disabled:e}),p.map(r=>n.jsx(o.InputGroupAddon,{align:r.position,children:r.component},r.id))]}):n.jsx(j.Input,{ref:d,...a,...t,disabled:e}),c&&n.jsx(i.FieldDescription,{...t,children:c})]})})})};exports.InputField=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),t=require("./components-ui-field-field.cjs"),m=require("./components-ui-input-input.cjs"),o=require("./components-ui-input-group-input-group.cjs"),j=({date:p=[],isValid:l,disabled:e=!1,label:s,description:c,classes:i,ref:d,...a})=>{const u={...l===!0&&!e&&{"aria-valid":!0},...l===!1&&!e&&{"aria-invalid":!0},disabled:e};return n.jsx(t.FieldSet,{className:i?.fieldset,children:n.jsx(t.FieldGroup,{className:i?.fieldgroup,children:n.jsxs(t.Field,{className:i?.field,children:[s&&n.jsx(t.FieldLabel,{...u,children:s}),p.length>0?n.jsxs(o.InputGroup,{"data-slot":!0,className:i?.inputgroup,children:[n.jsx(o.InputGroupInput,{ref:d,...a,...u,disabled:e}),p.map(r=>n.jsx(o.InputGroupAddon,{align:r.position,className:i?.inputaddon,children:r.component},r.id))]}):n.jsx(m.Input,{ref:d,...a,...u,disabled:e}),c&&n.jsx(t.FieldDescription,{...u,children:c})]})})})};exports.InputField=j;
2
2
  //# sourceMappingURL=components-input-field-input-field.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"components-input-field-input-field.cjs","sources":["../src/components/input-field/input-field.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { Field, FieldDescription, FieldGroup, FieldLabel, FieldSet } from \"../ui/field\";\nimport { Input } from \"../ui/input\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"../ui/input-group\";\n\nexport type DateAddon = {\n id: string | number;\n position?: \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\" | null;\n component: ReactNode;\n};\n\ntype BaseProps = {\n date?: DateAddon[];\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n };\n};\n\ntype InputFieldProps = BaseProps & ComponentPropsWithRef<\"input\">;\n\nexport const InputField = ({\n date = [],\n isValid,\n disabled = false,\n label,\n description,\n classes,\n ref,\n ...rest\n}: InputFieldProps) => {\n const validationProps = {\n ...(isValid === true && !disabled && { \"aria-valid\": true }),\n ...(isValid === false && !disabled && { \"aria-invalid\": true }),\n disabled,\n };\n\n return (\n <FieldSet className={classes?.fieldset}>\n <FieldGroup className={classes?.fieldgroup}>\n <Field className={classes?.field}>\n {label && <FieldLabel {...validationProps}>{label}</FieldLabel>}\n {date.length > 0 ? (\n <InputGroup data-slot>\n <InputGroupInput\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n {date.map((e) => (\n <InputGroupAddon\n key={e.id}\n align={e.position}\n >\n {e.component}\n </InputGroupAddon>\n ))}\n </InputGroup>\n ) : (\n <Input\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n )}\n {description && (\n <FieldDescription {...validationProps}>{description}</FieldDescription>\n )}\n </Field>\n </FieldGroup>\n </FieldSet>\n );\n};\n\ntype InputProps = InputFieldProps;\n\nexport type { InputFieldProps, InputProps };\n"],"names":["InputField","date","isValid","disabled","label","description","classes","ref","rest","validationProps","jsx","FieldSet","FieldGroup","jsxs","Field","FieldLabel","InputGroup","InputGroupInput","e","InputGroupAddon","Input","FieldDescription"],"mappings":"wQAyBaA,EAAa,CAAC,CACzB,KAAAC,EAAO,CAAA,EACP,QAAAC,EACA,SAAAC,EAAW,GACX,MAAAC,EACA,YAAAC,EACA,QAAAC,EACA,IAAAC,EACA,GAAGC,CACL,IAAuB,CACrB,MAAMC,EAAkB,CACtB,GAAIP,IAAY,IAAQ,CAACC,GAAY,CAAE,aAAc,EAAA,EACrD,GAAID,IAAY,IAAS,CAACC,GAAY,CAAE,eAAgB,EAAA,EACxD,SAAAA,CAAA,EAGF,OACEO,EAAAA,IAACC,EAAAA,SAAA,CAAS,UAAWL,GAAS,SAC5B,SAAAI,EAAAA,IAACE,aAAA,CAAW,UAAWN,GAAS,WAC9B,SAAAO,OAACC,EAAAA,MAAA,CAAM,UAAWR,GAAS,MACxB,SAAA,CAAAF,GAASM,EAAAA,IAACK,aAAA,CAAY,GAAGN,EAAkB,SAAAL,EAAM,EACjDH,EAAK,OAAS,EACbY,EAAAA,KAACG,EAAAA,WAAA,CAAW,YAAS,GACnB,SAAA,CAAAN,EAAAA,IAACO,EAAAA,gBAAA,CACC,IAAAV,EACC,GAAGC,EACH,GAAGC,EACJ,SAAAN,CAAA,CAAA,EAEDF,EAAK,IAAKiB,GACTR,EAAAA,IAACS,EAAAA,gBAAA,CAEC,MAAOD,EAAE,SAER,SAAAA,EAAE,SAAA,EAHEA,EAAE,EAAA,CAKV,CAAA,CAAA,CACH,EAEAR,EAAAA,IAACU,EAAAA,MAAA,CACC,IAAAb,EACC,GAAGC,EACH,GAAGC,EACJ,SAAAN,CAAA,CAAA,EAGHE,GACCK,EAAAA,IAACW,EAAAA,iBAAA,CAAkB,GAAGZ,EAAkB,SAAAJ,CAAA,CAAY,CAAA,CAAA,CAExD,EACF,EACF,CAEJ"}
1
+ {"version":3,"file":"components-input-field-input-field.cjs","sources":["../src/components/input-field/input-field.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { Field, FieldDescription, FieldGroup, FieldLabel, FieldSet } from \"../ui/field\";\nimport { Input } from \"../ui/input\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"../ui/input-group\";\n\nexport type DateAddon = {\n id: string | number;\n position?: \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\" | null;\n component: ReactNode;\n};\n\ntype BaseProps = {\n date?: DateAddon[];\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n inputgroup?: string;\n inputaddon?: string;\n };\n};\n\ntype InputFieldProps = BaseProps & ComponentPropsWithRef<\"input\">;\n\nexport const InputField = ({\n date = [],\n isValid,\n disabled = false,\n label,\n description,\n classes,\n ref,\n ...rest\n}: InputFieldProps) => {\n const validationProps = {\n ...(isValid === true && !disabled && { \"aria-valid\": true }),\n ...(isValid === false && !disabled && { \"aria-invalid\": true }),\n disabled,\n };\n\n return (\n <FieldSet className={classes?.fieldset}>\n <FieldGroup className={classes?.fieldgroup}>\n <Field className={classes?.field}>\n {label && <FieldLabel {...validationProps}>{label}</FieldLabel>}\n {date.length > 0 ? (\n <InputGroup\n data-slot\n className={classes?.inputgroup}\n >\n <InputGroupInput\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n {date.map((e) => (\n <InputGroupAddon\n key={e.id}\n align={e.position}\n className={classes?.inputaddon}\n >\n {e.component}\n </InputGroupAddon>\n ))}\n </InputGroup>\n ) : (\n <Input\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n )}\n {description && (\n <FieldDescription {...validationProps}>{description}</FieldDescription>\n )}\n </Field>\n </FieldGroup>\n </FieldSet>\n );\n};\n\ntype InputProps = InputFieldProps;\n\nexport type { InputFieldProps, InputProps };\n"],"names":["InputField","date","isValid","disabled","label","description","classes","ref","rest","validationProps","jsx","FieldSet","FieldGroup","jsxs","Field","FieldLabel","InputGroup","InputGroupInput","e","InputGroupAddon","Input","FieldDescription"],"mappings":"wQA2BaA,EAAa,CAAC,CACzB,KAAAC,EAAO,CAAA,EACP,QAAAC,EACA,SAAAC,EAAW,GACX,MAAAC,EACA,YAAAC,EACA,QAAAC,EACA,IAAAC,EACA,GAAGC,CACL,IAAuB,CACrB,MAAMC,EAAkB,CACtB,GAAIP,IAAY,IAAQ,CAACC,GAAY,CAAE,aAAc,EAAA,EACrD,GAAID,IAAY,IAAS,CAACC,GAAY,CAAE,eAAgB,EAAA,EACxD,SAAAA,CAAA,EAGF,OACEO,EAAAA,IAACC,EAAAA,SAAA,CAAS,UAAWL,GAAS,SAC5B,SAAAI,EAAAA,IAACE,aAAA,CAAW,UAAWN,GAAS,WAC9B,SAAAO,OAACC,EAAAA,MAAA,CAAM,UAAWR,GAAS,MACxB,SAAA,CAAAF,GAASM,EAAAA,IAACK,aAAA,CAAY,GAAGN,EAAkB,SAAAL,EAAM,EACjDH,EAAK,OAAS,EACbY,EAAAA,KAACG,EAAAA,WAAA,CACC,YAAS,GACT,UAAWV,GAAS,WAEpB,SAAA,CAAAI,EAAAA,IAACO,EAAAA,gBAAA,CACC,IAAAV,EACC,GAAGC,EACH,GAAGC,EACJ,SAAAN,CAAA,CAAA,EAEDF,EAAK,IAAKiB,GACTR,EAAAA,IAACS,EAAAA,gBAAA,CAEC,MAAOD,EAAE,SACT,UAAWZ,GAAS,WAEnB,SAAAY,EAAE,SAAA,EAJEA,EAAE,EAAA,CAMV,CAAA,CAAA,CAAA,EAGHR,EAAAA,IAACU,EAAAA,MAAA,CACC,IAAAb,EACC,GAAGC,EACH,GAAGC,EACJ,SAAAN,CAAA,CAAA,EAGHE,GACCK,EAAAA,IAACW,EAAAA,iBAAA,CAAkB,GAAGZ,EAAkB,SAAAJ,CAAA,CAAY,CAAA,CAAA,CAExD,EACF,EACF,CAEJ"}
@@ -1,52 +1,60 @@
1
1
  import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
2
  import { FieldSet as c, FieldGroup as f, Field as h, FieldLabel as F, FieldDescription as I } from "./components-ui-field-field.js";
3
- import { Input as s } from "./components-ui-input-input.js";
4
- import { InputGroup as G, InputGroupInput as g, InputGroupAddon as v } from "./components-ui-input-group-input-group.js";
3
+ import { Input as N } from "./components-ui-input-input.js";
4
+ import { InputGroup as g, InputGroupInput as G, InputGroupAddon as s } from "./components-ui-input-group-input-group.js";
5
5
  const D = ({
6
- date: e = [],
7
- isValid: p,
6
+ date: p = [],
7
+ isValid: e,
8
8
  disabled: i = !1,
9
9
  label: l,
10
10
  description: u,
11
- classes: o,
12
- ref: m,
13
- ...a
11
+ classes: n,
12
+ ref: a,
13
+ ...m
14
14
  }) => {
15
- const n = {
16
- ...p === !0 && !i && { "aria-valid": !0 },
17
- ...p === !1 && !i && { "aria-invalid": !0 },
15
+ const o = {
16
+ ...e === !0 && !i && { "aria-valid": !0 },
17
+ ...e === !1 && !i && { "aria-invalid": !0 },
18
18
  disabled: i
19
19
  };
20
- return /* @__PURE__ */ r(c, { className: o?.fieldset, children: /* @__PURE__ */ r(f, { className: o?.fieldgroup, children: /* @__PURE__ */ d(h, { className: o?.field, children: [
21
- l && /* @__PURE__ */ r(F, { ...n, children: l }),
22
- e.length > 0 ? /* @__PURE__ */ d(G, { "data-slot": !0, children: [
23
- /* @__PURE__ */ r(
24
- g,
25
- {
26
- ref: m,
27
- ...a,
28
- ...n,
29
- disabled: i
30
- }
31
- ),
32
- e.map((t) => /* @__PURE__ */ r(
33
- v,
34
- {
35
- align: t.position,
36
- children: t.component
37
- },
38
- t.id
39
- ))
40
- ] }) : /* @__PURE__ */ r(
41
- s,
20
+ return /* @__PURE__ */ r(c, { className: n?.fieldset, children: /* @__PURE__ */ r(f, { className: n?.fieldgroup, children: /* @__PURE__ */ d(h, { className: n?.field, children: [
21
+ l && /* @__PURE__ */ r(F, { ...o, children: l }),
22
+ p.length > 0 ? /* @__PURE__ */ d(
23
+ g,
42
24
  {
43
- ref: m,
44
- ...a,
45
- ...n,
25
+ "data-slot": !0,
26
+ className: n?.inputgroup,
27
+ children: [
28
+ /* @__PURE__ */ r(
29
+ G,
30
+ {
31
+ ref: a,
32
+ ...m,
33
+ ...o,
34
+ disabled: i
35
+ }
36
+ ),
37
+ p.map((t) => /* @__PURE__ */ r(
38
+ s,
39
+ {
40
+ align: t.position,
41
+ className: n?.inputaddon,
42
+ children: t.component
43
+ },
44
+ t.id
45
+ ))
46
+ ]
47
+ }
48
+ ) : /* @__PURE__ */ r(
49
+ N,
50
+ {
51
+ ref: a,
52
+ ...m,
53
+ ...o,
46
54
  disabled: i
47
55
  }
48
56
  ),
49
- u && /* @__PURE__ */ r(I, { ...n, children: u })
57
+ u && /* @__PURE__ */ r(I, { ...o, children: u })
50
58
  ] }) }) });
51
59
  };
52
60
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"components-input-field-input-field.js","sources":["../src/components/input-field/input-field.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { Field, FieldDescription, FieldGroup, FieldLabel, FieldSet } from \"../ui/field\";\nimport { Input } from \"../ui/input\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"../ui/input-group\";\n\nexport type DateAddon = {\n id: string | number;\n position?: \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\" | null;\n component: ReactNode;\n};\n\ntype BaseProps = {\n date?: DateAddon[];\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n };\n};\n\ntype InputFieldProps = BaseProps & ComponentPropsWithRef<\"input\">;\n\nexport const InputField = ({\n date = [],\n isValid,\n disabled = false,\n label,\n description,\n classes,\n ref,\n ...rest\n}: InputFieldProps) => {\n const validationProps = {\n ...(isValid === true && !disabled && { \"aria-valid\": true }),\n ...(isValid === false && !disabled && { \"aria-invalid\": true }),\n disabled,\n };\n\n return (\n <FieldSet className={classes?.fieldset}>\n <FieldGroup className={classes?.fieldgroup}>\n <Field className={classes?.field}>\n {label && <FieldLabel {...validationProps}>{label}</FieldLabel>}\n {date.length > 0 ? (\n <InputGroup data-slot>\n <InputGroupInput\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n {date.map((e) => (\n <InputGroupAddon\n key={e.id}\n align={e.position}\n >\n {e.component}\n </InputGroupAddon>\n ))}\n </InputGroup>\n ) : (\n <Input\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n )}\n {description && (\n <FieldDescription {...validationProps}>{description}</FieldDescription>\n )}\n </Field>\n </FieldGroup>\n </FieldSet>\n );\n};\n\ntype InputProps = InputFieldProps;\n\nexport type { InputFieldProps, InputProps };\n"],"names":["InputField","date","isValid","disabled","label","description","classes","ref","rest","validationProps","jsx","FieldSet","FieldGroup","jsxs","Field","FieldLabel","InputGroup","InputGroupInput","e","InputGroupAddon","Input","FieldDescription"],"mappings":";;;;AAyBO,MAAMA,IAAa,CAAC;AAAA,EACzB,MAAAC,IAAO,CAAA;AAAA,EACP,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,KAAAC;AAAA,EACA,GAAGC;AACL,MAAuB;AACrB,QAAMC,IAAkB;AAAA,IACtB,GAAIP,MAAY,MAAQ,CAACC,KAAY,EAAE,cAAc,GAAA;AAAA,IACrD,GAAID,MAAY,MAAS,CAACC,KAAY,EAAE,gBAAgB,GAAA;AAAA,IACxD,UAAAA;AAAA,EAAA;AAGF,SACE,gBAAAO,EAACC,GAAA,EAAS,WAAWL,GAAS,UAC5B,UAAA,gBAAAI,EAACE,GAAA,EAAW,WAAWN,GAAS,YAC9B,UAAA,gBAAAO,EAACC,GAAA,EAAM,WAAWR,GAAS,OACxB,UAAA;AAAA,IAAAF,KAAS,gBAAAM,EAACK,GAAA,EAAY,GAAGN,GAAkB,UAAAL,GAAM;AAAA,IACjDH,EAAK,SAAS,IACb,gBAAAY,EAACG,GAAA,EAAW,aAAS,IACnB,UAAA;AAAA,MAAA,gBAAAN;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,KAAAV;AAAA,UACC,GAAGC;AAAA,UACH,GAAGC;AAAA,UACJ,UAAAN;AAAA,QAAA;AAAA,MAAA;AAAA,MAEDF,EAAK,IAAI,CAACiB,MACT,gBAAAR;AAAA,QAACS;AAAA,QAAA;AAAA,UAEC,OAAOD,EAAE;AAAA,UAER,UAAAA,EAAE;AAAA,QAAA;AAAA,QAHEA,EAAE;AAAA,MAAA,CAKV;AAAA,IAAA,EAAA,CACH,IAEA,gBAAAR;AAAA,MAACU;AAAA,MAAA;AAAA,QACC,KAAAb;AAAA,QACC,GAAGC;AAAA,QACH,GAAGC;AAAA,QACJ,UAAAN;AAAA,MAAA;AAAA,IAAA;AAAA,IAGHE,KACC,gBAAAK,EAACW,GAAA,EAAkB,GAAGZ,GAAkB,UAAAJ,EAAA,CAAY;AAAA,EAAA,EAAA,CAExD,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"components-input-field-input-field.js","sources":["../src/components/input-field/input-field.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { Field, FieldDescription, FieldGroup, FieldLabel, FieldSet } from \"../ui/field\";\nimport { Input } from \"../ui/input\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"../ui/input-group\";\n\nexport type DateAddon = {\n id: string | number;\n position?: \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\" | null;\n component: ReactNode;\n};\n\ntype BaseProps = {\n date?: DateAddon[];\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n inputgroup?: string;\n inputaddon?: string;\n };\n};\n\ntype InputFieldProps = BaseProps & ComponentPropsWithRef<\"input\">;\n\nexport const InputField = ({\n date = [],\n isValid,\n disabled = false,\n label,\n description,\n classes,\n ref,\n ...rest\n}: InputFieldProps) => {\n const validationProps = {\n ...(isValid === true && !disabled && { \"aria-valid\": true }),\n ...(isValid === false && !disabled && { \"aria-invalid\": true }),\n disabled,\n };\n\n return (\n <FieldSet className={classes?.fieldset}>\n <FieldGroup className={classes?.fieldgroup}>\n <Field className={classes?.field}>\n {label && <FieldLabel {...validationProps}>{label}</FieldLabel>}\n {date.length > 0 ? (\n <InputGroup\n data-slot\n className={classes?.inputgroup}\n >\n <InputGroupInput\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n {date.map((e) => (\n <InputGroupAddon\n key={e.id}\n align={e.position}\n className={classes?.inputaddon}\n >\n {e.component}\n </InputGroupAddon>\n ))}\n </InputGroup>\n ) : (\n <Input\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n )}\n {description && (\n <FieldDescription {...validationProps}>{description}</FieldDescription>\n )}\n </Field>\n </FieldGroup>\n </FieldSet>\n );\n};\n\ntype InputProps = InputFieldProps;\n\nexport type { InputFieldProps, InputProps };\n"],"names":["InputField","date","isValid","disabled","label","description","classes","ref","rest","validationProps","jsx","FieldSet","FieldGroup","jsxs","Field","FieldLabel","InputGroup","InputGroupInput","e","InputGroupAddon","Input","FieldDescription"],"mappings":";;;;AA2BO,MAAMA,IAAa,CAAC;AAAA,EACzB,MAAAC,IAAO,CAAA;AAAA,EACP,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,KAAAC;AAAA,EACA,GAAGC;AACL,MAAuB;AACrB,QAAMC,IAAkB;AAAA,IACtB,GAAIP,MAAY,MAAQ,CAACC,KAAY,EAAE,cAAc,GAAA;AAAA,IACrD,GAAID,MAAY,MAAS,CAACC,KAAY,EAAE,gBAAgB,GAAA;AAAA,IACxD,UAAAA;AAAA,EAAA;AAGF,SACE,gBAAAO,EAACC,GAAA,EAAS,WAAWL,GAAS,UAC5B,UAAA,gBAAAI,EAACE,GAAA,EAAW,WAAWN,GAAS,YAC9B,UAAA,gBAAAO,EAACC,GAAA,EAAM,WAAWR,GAAS,OACxB,UAAA;AAAA,IAAAF,KAAS,gBAAAM,EAACK,GAAA,EAAY,GAAGN,GAAkB,UAAAL,GAAM;AAAA,IACjDH,EAAK,SAAS,IACb,gBAAAY;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,aAAS;AAAA,QACT,WAAWV,GAAS;AAAA,QAEpB,UAAA;AAAA,UAAA,gBAAAI;AAAA,YAACO;AAAA,YAAA;AAAA,cACC,KAAAV;AAAA,cACC,GAAGC;AAAA,cACH,GAAGC;AAAA,cACJ,UAAAN;AAAA,YAAA;AAAA,UAAA;AAAA,UAEDF,EAAK,IAAI,CAACiB,MACT,gBAAAR;AAAA,YAACS;AAAA,YAAA;AAAA,cAEC,OAAOD,EAAE;AAAA,cACT,WAAWZ,GAAS;AAAA,cAEnB,UAAAY,EAAE;AAAA,YAAA;AAAA,YAJEA,EAAE;AAAA,UAAA,CAMV;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,IAGH,gBAAAR;AAAA,MAACU;AAAA,MAAA;AAAA,QACC,KAAAb;AAAA,QACC,GAAGC;AAAA,QACH,GAAGC;AAAA,QACJ,UAAAN;AAAA,MAAA;AAAA,IAAA;AAAA,IAGHE,KACC,gBAAAK,EAACW,GAAA,EAAkB,GAAGZ,GAAkB,UAAAJ,EAAA,CAAY;AAAA,EAAA,EAAA,CAExD,GACF,GACF;AAEJ;"}
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("./lib-utils.cjs"),f=require("./components-basic-tooltip-basic-tooltip.cjs"),i=require("./components-ui-button-button.cjs");require("./components-ui-button-button.styles.cjs");const t=require("./components-ui-icon-icon.cjs");require("phosphor-strokes-icons/icons");const o=require("./components-ui-typography-typography.cjs");require("./components-ui-typography-typography.styles.cjs");const N=({items:h,selectedSet:g,onSelectItem:u,onMoveItem:n,direction:x,headerIcon:l,headerButton:s,showHeaderTooltip:j=!1,showFooterIcons:d=!1})=>{const r=x==="right",p=r?"caret-right":"caret-left",y=r?"check-circle":"x-circle",m=r?"text-success-text":"text-error-text";return e.jsxs("div",{className:`bg-secondary-bg border-delicate-border flex h-full min-h-0 w-97.5
2
+ flex-col rounded-xl border`,children:[e.jsxs("div",{className:b.cn("bg-primary-bg flex items-center rounded-t-xl px-7.5 py-4",x==="left"?"gap-6":"justify-between"),children:[e.jsxs("div",{className:"w-fit",children:[s&&!r&&e.jsx(i.Button,{variant:"circleGhost",onClick:s.onClick,disabled:s.disabled,children:e.jsx(t.Icon,{type:s.icon,className:"text-placeholder-text"})}),j&&e.jsx(f.BasicTooltip,{place:"left",arrow:!0,text:e.jsx(o.Typography,{variant:"body-xxs-regular",className:"w-fit",children:"Переносите пункты туда или обратно с помощью клика на них"}),children:e.jsx(t.Icon,{type:"info",className:"text-placeholder-text"})}),l&&e.jsx(t.Icon,{type:l.type,className:l.className})]}),e.jsx(o.Typography,{variant:"body-lg-semibold",className:"text-primary-text",children:r?"Нужно для расчета":"Уже есть для расчета"}),s&&r&&e.jsx(i.Button,{variant:"circleGhost",onClick:s.onClick,disabled:s.disabled,children:e.jsx(t.Icon,{type:s.icon,className:"text-placeholder-text"})})]}),e.jsx("div",{className:`border-delicate-border flex min-h-0 flex-1 flex-col gap-2
3
+ overflow-y-auto border-t`,children:h.map(c=>e.jsxs("div",{className:b.cn(`bg-primary-bg flex cursor-pointer items-center justify-between gap-4 px-8
4
+ py-4`,g.has(c.id)&&"bg-primary-hover-bg"),onClick:()=>u(c.id),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[d?e.jsx(i.Button,{variant:"circleGhost",onClick:a=>{a.stopPropagation(),n(c.id)},children:e.jsx(t.Icon,{type:p,className:"text-placeholder-text"})}):e.jsx(t.Icon,{type:y,size:25,strokeWidth:1.5,className:m}),e.jsx(o.Typography,{variant:"body-md-regular",className:"text-primary-text",children:c.label})]}),d?e.jsx(t.Icon,{type:y,size:25,strokeWidth:1.5,className:m}):e.jsx(i.Button,{variant:"circleGhost",onClick:a=>{a.stopPropagation(),n(c.id)},children:e.jsx(t.Icon,{type:p,className:"text-placeholder-text"})})]},c.id))})]})};exports.TransferListCard=N;
5
+ //# sourceMappingURL=components-transfer-list-transfer-list-card.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-transfer-list-transfer-list-card.cjs","sources":["../src/components/transfer-list/transfer-list-card.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { BasicTooltip } from \"../basic-tooltip\";\nimport { Button } from \"../ui/button\";\nimport { Icon } from \"../ui/icon\";\nimport { Typography } from \"../ui/typography\";\nimport type { TransferListItem } from \"./transfer-list\";\nimport type { IconTypes } from \"@/types/types\";\n\ntype Props = {\n items: TransferListItem[];\n selectedSet: Set<string>;\n onSelectItem: (id: string) => void;\n onMoveItem: (itemId: string) => void;\n direction: \"left\" | \"right\";\n headerIcon?: {\n type: IconTypes;\n className: string;\n };\n headerButton?: {\n icon: IconTypes;\n onClick: () => void;\n disabled: boolean;\n };\n showHeaderTooltip?: boolean;\n showFooterIcons?: boolean;\n};\n\nexport const TransferListCard = ({\n items,\n selectedSet,\n onSelectItem,\n onMoveItem,\n direction,\n headerIcon,\n headerButton,\n showHeaderTooltip = false,\n showFooterIcons = false,\n}: Props) => {\n const isMovingToRight = direction === \"right\";\n const moveIcon = isMovingToRight ? \"caret-right\" : \"caret-left\";\n const footerIcon = isMovingToRight ? \"check-circle\" : \"x-circle\";\n const footerIconClassName = isMovingToRight ? \"text-success-text\" : \"text-error-text\";\n\n return (\n <div\n className=\"bg-secondary-bg border-delicate-border flex h-full min-h-0 w-97.5\n flex-col rounded-xl border\"\n >\n <div\n className={cn(\n \"bg-primary-bg flex items-center rounded-t-xl px-7.5 py-4\",\n direction === \"left\" ? \"gap-6\" : \"justify-between\",\n )}\n >\n <div className=\"w-fit\">\n {headerButton && !isMovingToRight && (\n <Button\n variant=\"circleGhost\"\n onClick={headerButton.onClick}\n disabled={headerButton.disabled}\n >\n <Icon\n type={headerButton.icon}\n className=\"text-placeholder-text\"\n />\n </Button>\n )}\n {showHeaderTooltip && (\n <BasicTooltip\n place=\"left\"\n arrow\n text={\n <Typography\n variant=\"body-xxs-regular\"\n className=\"w-fit\"\n >\n Переносите пункты туда или обратно с помощью клика на них\n </Typography>\n }\n >\n <Icon\n type=\"info\"\n className=\"text-placeholder-text\"\n />\n </BasicTooltip>\n )}\n {headerIcon && (\n <Icon\n type={headerIcon.type}\n className={headerIcon.className}\n />\n )}\n </div>\n\n <Typography\n variant=\"body-lg-semibold\"\n className=\"text-primary-text\"\n >\n {isMovingToRight ? \"Нужно для расчета\" : \"Уже есть для расчета\"}\n </Typography>\n\n {headerButton && isMovingToRight && (\n <Button\n variant=\"circleGhost\"\n onClick={headerButton.onClick}\n disabled={headerButton.disabled}\n >\n <Icon\n type={headerButton.icon}\n className=\"text-placeholder-text\"\n />\n </Button>\n )}\n </div>\n\n <div\n className=\"border-delicate-border flex min-h-0 flex-1 flex-col gap-2\n overflow-y-auto border-t\"\n >\n {items.map((item) => (\n <div\n key={item.id}\n className={cn(\n `bg-primary-bg flex cursor-pointer items-center justify-between gap-4 px-8\n py-4`,\n selectedSet.has(item.id) && \"bg-primary-hover-bg\",\n )}\n onClick={() => onSelectItem(item.id)}\n >\n <div className=\"flex items-center gap-4\">\n {showFooterIcons ? (\n <Button\n variant=\"circleGhost\"\n onClick={(e) => {\n e.stopPropagation();\n onMoveItem(item.id);\n }}\n >\n <Icon\n type={moveIcon}\n className=\"text-placeholder-text\"\n />\n </Button>\n ) : (\n <Icon\n type={footerIcon}\n size={25}\n strokeWidth={1.5}\n className={footerIconClassName}\n />\n )}\n\n <Typography\n variant=\"body-md-regular\"\n className=\"text-primary-text\"\n >\n {item.label}\n </Typography>\n </div>\n\n {!showFooterIcons ? (\n <Button\n variant=\"circleGhost\"\n onClick={(e) => {\n e.stopPropagation();\n onMoveItem(item.id);\n }}\n >\n <Icon\n type={moveIcon}\n className=\"text-placeholder-text\"\n />\n </Button>\n ) : (\n <Icon\n type={footerIcon}\n size={25}\n strokeWidth={1.5}\n className={footerIconClassName}\n />\n )}\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["TransferListCard","items","selectedSet","onSelectItem","onMoveItem","direction","headerIcon","headerButton","showHeaderTooltip","showFooterIcons","isMovingToRight","moveIcon","footerIcon","footerIconClassName","jsxs","cn","jsx","Button","Icon","BasicTooltip","Typography","item","e"],"mappings":"igBA2BO,MAAMA,EAAmB,CAAC,CAC/B,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,WAAAC,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,kBAAAC,EAAoB,GACpB,gBAAAC,EAAkB,EACpB,IAA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AAM,IAAKoB,GACVP,EAAAA,KAAC,MAAA,CAEC,UAAWC,EAAAA,GACT;AAAA,oBAEAb,EAAY,IAAImB,EAAK,EAAE,GAAK,qBAAA,EAE9B,QAAS,IAAMlB,EAAakB,EAAK,EAAE,EAEnC,SAAA,CAAAP,EAAAA,KAAC,MAAA,CAAI,UAAU,0BACZ,SAAA,CAAAL,EACCO,EAAAA,IAACC,EAAAA,OAAA,CACC,QAAQ,cACR,QAAUK,GAAM,CACdA,EAAE,gBAAA,EACFlB,EAAWiB,EAAK,EAAE,CACpB,EAEA,SAAAL,EAAAA,IAACE,EAAAA,KAAA,CACC,KAAMP,EACN,UAAU,uBAAA,CAAA,CACZ,CAAA,EAGFK,EAAAA,IAACE,EAAAA,KAAA,CACC,KAAMN,EACN,KAAM,GACN,YAAa,IACb,UAAWC,CAAA,CAAA,EAIfG,EAAAA,IAACI,EAAAA,WAAA,CACC,QAAQ,kBACR,UAAU,oBAET,SAAAC,EAAK,KAAA,CAAA,CACR,EACF,EAEEZ,EAcAO,EAAAA,IAACE,EAAAA,KAAA,CACC,KAAMN,EACN,KAAM,GACN,YAAa,IACb,UAAWC,CAAA,CAAA,EAjBbG,EAAAA,IAACC,EAAAA,OAAA,CACC,QAAQ,cACR,QAAUK,GAAM,CACdA,EAAE,gBAAA,EACFlB,EAAWiB,EAAK,EAAE,CACpB,EAEA,SAAAL,EAAAA,IAACE,EAAAA,KAAA,CACC,KAAMP,EACN,UAAU,uBAAA,CAAA,CACZ,CAAA,CAQF,CAAA,EA1DGU,EAAK,EAAA,CA6Db,CAAA,CAAA,CACH,CAAA,CAAA,CAGN"}
@@ -0,0 +1,194 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { cn as h } from "./lib-utils.js";
3
+ import { BasicTooltip as k } from "./components-basic-tooltip-basic-tooltip.js";
4
+ import { Button as c } from "./components-ui-button-button.js";
5
+ import "./components-ui-button-button.styles.js";
6
+ import { Icon as t } from "./components-ui-icon-icon.js";
7
+ import "phosphor-strokes-icons/icons";
8
+ import { Typography as d } from "./components-ui-typography-typography.js";
9
+ import "./components-ui-typography-typography.styles.js";
10
+ const L = ({
11
+ items: y,
12
+ selectedSet: g,
13
+ onSelectItem: N,
14
+ onMoveItem: n,
15
+ direction: p,
16
+ headerIcon: s,
17
+ headerButton: r,
18
+ showHeaderTooltip: v = !1,
19
+ showFooterIcons: m = !1
20
+ }) => {
21
+ const l = p === "right", x = l ? "caret-right" : "caret-left", f = l ? "check-circle" : "x-circle", b = l ? "text-success-text" : "text-error-text";
22
+ return /* @__PURE__ */ a(
23
+ "div",
24
+ {
25
+ className: `bg-secondary-bg border-delicate-border flex h-full min-h-0 w-97.5
26
+ flex-col rounded-xl border`,
27
+ children: [
28
+ /* @__PURE__ */ a(
29
+ "div",
30
+ {
31
+ className: h(
32
+ "bg-primary-bg flex items-center rounded-t-xl px-7.5 py-4",
33
+ p === "left" ? "gap-6" : "justify-between"
34
+ ),
35
+ children: [
36
+ /* @__PURE__ */ a("div", { className: "w-fit", children: [
37
+ r && !l && /* @__PURE__ */ e(
38
+ c,
39
+ {
40
+ variant: "circleGhost",
41
+ onClick: r.onClick,
42
+ disabled: r.disabled,
43
+ children: /* @__PURE__ */ e(
44
+ t,
45
+ {
46
+ type: r.icon,
47
+ className: "text-placeholder-text"
48
+ }
49
+ )
50
+ }
51
+ ),
52
+ v && /* @__PURE__ */ e(
53
+ k,
54
+ {
55
+ place: "left",
56
+ arrow: !0,
57
+ text: /* @__PURE__ */ e(
58
+ d,
59
+ {
60
+ variant: "body-xxs-regular",
61
+ className: "w-fit",
62
+ children: "Переносите пункты туда или обратно с помощью клика на них"
63
+ }
64
+ ),
65
+ children: /* @__PURE__ */ e(
66
+ t,
67
+ {
68
+ type: "info",
69
+ className: "text-placeholder-text"
70
+ }
71
+ )
72
+ }
73
+ ),
74
+ s && /* @__PURE__ */ e(
75
+ t,
76
+ {
77
+ type: s.type,
78
+ className: s.className
79
+ }
80
+ )
81
+ ] }),
82
+ /* @__PURE__ */ e(
83
+ d,
84
+ {
85
+ variant: "body-lg-semibold",
86
+ className: "text-primary-text",
87
+ children: l ? "Нужно для расчета" : "Уже есть для расчета"
88
+ }
89
+ ),
90
+ r && l && /* @__PURE__ */ e(
91
+ c,
92
+ {
93
+ variant: "circleGhost",
94
+ onClick: r.onClick,
95
+ disabled: r.disabled,
96
+ children: /* @__PURE__ */ e(
97
+ t,
98
+ {
99
+ type: r.icon,
100
+ className: "text-placeholder-text"
101
+ }
102
+ )
103
+ }
104
+ )
105
+ ]
106
+ }
107
+ ),
108
+ /* @__PURE__ */ e(
109
+ "div",
110
+ {
111
+ className: `border-delicate-border flex min-h-0 flex-1 flex-col gap-2
112
+ overflow-y-auto border-t`,
113
+ children: y.map((i) => /* @__PURE__ */ a(
114
+ "div",
115
+ {
116
+ className: h(
117
+ `bg-primary-bg flex cursor-pointer items-center justify-between gap-4 px-8
118
+ py-4`,
119
+ g.has(i.id) && "bg-primary-hover-bg"
120
+ ),
121
+ onClick: () => N(i.id),
122
+ children: [
123
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-4", children: [
124
+ m ? /* @__PURE__ */ e(
125
+ c,
126
+ {
127
+ variant: "circleGhost",
128
+ onClick: (o) => {
129
+ o.stopPropagation(), n(i.id);
130
+ },
131
+ children: /* @__PURE__ */ e(
132
+ t,
133
+ {
134
+ type: x,
135
+ className: "text-placeholder-text"
136
+ }
137
+ )
138
+ }
139
+ ) : /* @__PURE__ */ e(
140
+ t,
141
+ {
142
+ type: f,
143
+ size: 25,
144
+ strokeWidth: 1.5,
145
+ className: b
146
+ }
147
+ ),
148
+ /* @__PURE__ */ e(
149
+ d,
150
+ {
151
+ variant: "body-md-regular",
152
+ className: "text-primary-text",
153
+ children: i.label
154
+ }
155
+ )
156
+ ] }),
157
+ m ? /* @__PURE__ */ e(
158
+ t,
159
+ {
160
+ type: f,
161
+ size: 25,
162
+ strokeWidth: 1.5,
163
+ className: b
164
+ }
165
+ ) : /* @__PURE__ */ e(
166
+ c,
167
+ {
168
+ variant: "circleGhost",
169
+ onClick: (o) => {
170
+ o.stopPropagation(), n(i.id);
171
+ },
172
+ children: /* @__PURE__ */ e(
173
+ t,
174
+ {
175
+ type: x,
176
+ className: "text-placeholder-text"
177
+ }
178
+ )
179
+ }
180
+ )
181
+ ]
182
+ },
183
+ i.id
184
+ ))
185
+ }
186
+ )
187
+ ]
188
+ }
189
+ );
190
+ };
191
+ export {
192
+ L as TransferListCard
193
+ };
194
+ //# sourceMappingURL=components-transfer-list-transfer-list-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-transfer-list-transfer-list-card.js","sources":["../src/components/transfer-list/transfer-list-card.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { BasicTooltip } from \"../basic-tooltip\";\nimport { Button } from \"../ui/button\";\nimport { Icon } from \"../ui/icon\";\nimport { Typography } from \"../ui/typography\";\nimport type { TransferListItem } from \"./transfer-list\";\nimport type { IconTypes } from \"@/types/types\";\n\ntype Props = {\n items: TransferListItem[];\n selectedSet: Set<string>;\n onSelectItem: (id: string) => void;\n onMoveItem: (itemId: string) => void;\n direction: \"left\" | \"right\";\n headerIcon?: {\n type: IconTypes;\n className: string;\n };\n headerButton?: {\n icon: IconTypes;\n onClick: () => void;\n disabled: boolean;\n };\n showHeaderTooltip?: boolean;\n showFooterIcons?: boolean;\n};\n\nexport const TransferListCard = ({\n items,\n selectedSet,\n onSelectItem,\n onMoveItem,\n direction,\n headerIcon,\n headerButton,\n showHeaderTooltip = false,\n showFooterIcons = false,\n}: Props) => {\n const isMovingToRight = direction === \"right\";\n const moveIcon = isMovingToRight ? \"caret-right\" : \"caret-left\";\n const footerIcon = isMovingToRight ? \"check-circle\" : \"x-circle\";\n const footerIconClassName = isMovingToRight ? \"text-success-text\" : \"text-error-text\";\n\n return (\n <div\n className=\"bg-secondary-bg border-delicate-border flex h-full min-h-0 w-97.5\n flex-col rounded-xl border\"\n >\n <div\n className={cn(\n \"bg-primary-bg flex items-center rounded-t-xl px-7.5 py-4\",\n direction === \"left\" ? \"gap-6\" : \"justify-between\",\n )}\n >\n <div className=\"w-fit\">\n {headerButton && !isMovingToRight && (\n <Button\n variant=\"circleGhost\"\n onClick={headerButton.onClick}\n disabled={headerButton.disabled}\n >\n <Icon\n type={headerButton.icon}\n className=\"text-placeholder-text\"\n />\n </Button>\n )}\n {showHeaderTooltip && (\n <BasicTooltip\n place=\"left\"\n arrow\n text={\n <Typography\n variant=\"body-xxs-regular\"\n className=\"w-fit\"\n >\n Переносите пункты туда или обратно с помощью клика на них\n </Typography>\n }\n >\n <Icon\n type=\"info\"\n className=\"text-placeholder-text\"\n />\n </BasicTooltip>\n )}\n {headerIcon && (\n <Icon\n type={headerIcon.type}\n className={headerIcon.className}\n />\n )}\n </div>\n\n <Typography\n variant=\"body-lg-semibold\"\n className=\"text-primary-text\"\n >\n {isMovingToRight ? \"Нужно для расчета\" : \"Уже есть для расчета\"}\n </Typography>\n\n {headerButton && isMovingToRight && (\n <Button\n variant=\"circleGhost\"\n onClick={headerButton.onClick}\n disabled={headerButton.disabled}\n >\n <Icon\n type={headerButton.icon}\n className=\"text-placeholder-text\"\n />\n </Button>\n )}\n </div>\n\n <div\n className=\"border-delicate-border flex min-h-0 flex-1 flex-col gap-2\n overflow-y-auto border-t\"\n >\n {items.map((item) => (\n <div\n key={item.id}\n className={cn(\n `bg-primary-bg flex cursor-pointer items-center justify-between gap-4 px-8\n py-4`,\n selectedSet.has(item.id) && \"bg-primary-hover-bg\",\n )}\n onClick={() => onSelectItem(item.id)}\n >\n <div className=\"flex items-center gap-4\">\n {showFooterIcons ? (\n <Button\n variant=\"circleGhost\"\n onClick={(e) => {\n e.stopPropagation();\n onMoveItem(item.id);\n }}\n >\n <Icon\n type={moveIcon}\n className=\"text-placeholder-text\"\n />\n </Button>\n ) : (\n <Icon\n type={footerIcon}\n size={25}\n strokeWidth={1.5}\n className={footerIconClassName}\n />\n )}\n\n <Typography\n variant=\"body-md-regular\"\n className=\"text-primary-text\"\n >\n {item.label}\n </Typography>\n </div>\n\n {!showFooterIcons ? (\n <Button\n variant=\"circleGhost\"\n onClick={(e) => {\n e.stopPropagation();\n onMoveItem(item.id);\n }}\n >\n <Icon\n type={moveIcon}\n className=\"text-placeholder-text\"\n />\n </Button>\n ) : (\n <Icon\n type={footerIcon}\n size={25}\n strokeWidth={1.5}\n className={footerIconClassName}\n />\n )}\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["TransferListCard","items","selectedSet","onSelectItem","onMoveItem","direction","headerIcon","headerButton","showHeaderTooltip","showFooterIcons","isMovingToRight","moveIcon","footerIcon","footerIconClassName","jsxs","cn","jsx","Button","Icon","BasicTooltip","Typography","item","e"],"mappings":";;;;;;;;;AA2BO,MAAMA,IAAmB,CAAC;AAAA,EAC/B,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,iBAAAC,IAAkB;AACpB,MAAa;AACX,QAAMC,IAAkBL,MAAc,SAChCM,IAAWD,IAAkB,gBAAgB,cAC7CE,IAAaF,IAAkB,iBAAiB,YAChDG,IAAsBH,IAAkB,sBAAsB;AAEpE,SACE,gBAAAI;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA;AAAA,MAGV,UAAA;AAAA,QAAA,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC;AAAA,cACT;AAAA,cACAV,MAAc,SAAS,UAAU;AAAA,YAAA;AAAA,YAGnC,UAAA;AAAA,cAAA,gBAAAS,EAAC,OAAA,EAAI,WAAU,SACZ,UAAA;AAAA,gBAAAP,KAAgB,CAACG,KAChB,gBAAAM;AAAA,kBAACC;AAAA,kBAAA;AAAA,oBACC,SAAQ;AAAA,oBACR,SAASV,EAAa;AAAA,oBACtB,UAAUA,EAAa;AAAA,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;AAAA,wBAAA;AAAA,0BACC,MAAMP;AAAA,0BACN,WAAU;AAAA,wBAAA;AAAA,sBAAA;AAAA,oBACZ;AAAA,kBAAA;AAAA,gBAQF;AAAA,cAAA;AAAA,cA1DGU,EAAK;AAAA,YAAA,CA6Db;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),t=require("react"),M=require("./components-transfer-list-transfer-list-card.cjs"),b=require("./components-ui-button-button.cjs");require("./components-ui-button-button.styles.cjs");const p=require("./components-ui-icon-icon.cjs");require("phosphor-strokes-icons/icons");const d=!1,f=!0,L=({list:n,onChange:h})=>{const l=t.useMemo(()=>n.filter(e=>!e.inTarget),[n]),a=t.useMemo(()=>n.filter(e=>e.inTarget),[n]),[o,m]=t.useState([]),g=t.useMemo(()=>new Set(o),[o]),T=t.useMemo(()=>new Set(l.map(e=>e.id)),[l]),I=t.useMemo(()=>new Set(a.map(e=>e.id)),[a]),C=t.useMemo(()=>o.filter(e=>T.has(e)).length,[o,T]),_=t.useMemo(()=>o.filter(e=>I.has(e)).length,[o,I]),x=t.useCallback(e=>{m(s=>s.includes(e)?s.filter(i=>i!==e):[...s,e])},[]),r=t.useCallback((e,s)=>{const i=s??o;if(i.length===0)return;const v=new Set(i),w=n.map(u=>!v.has(u.id)||u.inTarget===e?u:{...u,inTarget:e});h(w),m([])},[n,h,o]),S=t.useCallback(e=>{r(e,n.filter(s=>s.inTarget!==e).map(s=>s.id))},[n,r]),j=t.useCallback(e=>{r(f,[e])},[r]),k=t.useCallback(e=>{r(d,[e])},[r]);return c.jsxs("div",{className:"flex h-full min-h-0 w-fit gap-6",children:[c.jsx(M.TransferListCard,{items:l,selectedSet:g,onSelectItem:x,onMoveItem:j,direction:"right",showHeaderTooltip:!0,headerButton:{icon:"caret-right",onClick:()=>S(f),disabled:l.length===0},showFooterIcons:!1}),c.jsxs("div",{className:"flex h-full flex-col justify-center gap-8",children:[c.jsx(b.Button,{variant:"circle",onClick:()=>r(f),disabled:C===0,children:c.jsx(p.Icon,{type:"caret-right",className:"text-placeholder-text"})}),c.jsx(b.Button,{variant:"circle",onClick:()=>r(d),disabled:_===0,children:c.jsx(p.Icon,{type:"caret-left",className:"text-placeholder-text"})})]}),c.jsx(M.TransferListCard,{items:a,selectedSet:g,onSelectItem:x,onMoveItem:k,direction:"left",headerButton:{icon:"caret-left",onClick:()=>S(d),disabled:a.length===0},showFooterIcons:!0})]})};exports.TransferList=L;
2
+ //# sourceMappingURL=components-transfer-list-transfer-list.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-transfer-list-transfer-list.cjs","sources":["../src/components/transfer-list/transfer-list.tsx"],"sourcesContent":["import { useCallback, useMemo, useState } from \"react\";\nimport { TransferListCard } from \"./transfer-list-card\";\nimport { Button } from \"../ui/button\";\nimport { Icon } from \"../ui/icon\";\n\nexport type TransferListItem = {\n id: string;\n label: string;\n disabled?: boolean;\n inTarget: boolean;\n};\n\ntype Props = {\n list: TransferListItem[];\n onChange: (item: TransferListItem[]) => void;\n};\n\nconst MOVE_TO_LEFT = false;\nconst MOVE_TO_RIGHT = true;\n\nexport const TransferList = ({ list, onChange }: Props) => {\n const leftItems = useMemo(() => list.filter((i) => !i.inTarget), [list]);\n const rightItems = useMemo(() => list.filter((i) => i.inTarget), [list]);\n\n const [selectedIds, setSelectedIds] = useState<string[]>([]);\n\n const selectedSet = useMemo(() => new Set(selectedIds), [selectedIds]);\n const leftIdSet = useMemo(() => new Set(leftItems.map((item) => item.id)), [leftItems]);\n const rightIdSet = useMemo(\n () => new Set(rightItems.map((item) => item.id)),\n [rightItems],\n );\n\n const selectedLeftCount = useMemo(\n () => selectedIds.filter((id) => leftIdSet.has(id)).length,\n [selectedIds, leftIdSet],\n );\n const selectedRightCount = useMemo(\n () => selectedIds.filter((id) => rightIdSet.has(id)).length,\n [selectedIds, rightIdSet],\n );\n\n const onSelectItem = useCallback((id: string) => {\n setSelectedIds((prev) =>\n prev.includes(id) ? prev.filter((itemId) => itemId !== id) : [...prev, id],\n );\n }, []);\n\n const moveSelectedItems = useCallback(\n (move: boolean, ids?: string[]) => {\n const resolvedIds = ids ?? selectedIds;\n if (resolvedIds.length === 0) return;\n\n const idsToMoveSet = new Set(resolvedIds);\n\n const newData = list.map((item) => {\n if (!idsToMoveSet.has(item.id) || item.inTarget === move) {\n return item;\n }\n\n return {\n ...item,\n inTarget: move,\n };\n });\n\n onChange(newData);\n setSelectedIds([]);\n },\n [list, onChange, selectedIds],\n );\n\n const allMoveSelectedItems = useCallback(\n (move: boolean) => {\n moveSelectedItems(\n move,\n list.filter((item) => item.inTarget !== move).map((item) => item.id),\n );\n },\n [list, moveSelectedItems],\n );\n\n const moveToRight = useCallback(\n (itemId: string) => {\n moveSelectedItems(MOVE_TO_RIGHT, [itemId]);\n },\n [moveSelectedItems],\n );\n\n const moveToLeft = useCallback(\n (itemId: string) => {\n moveSelectedItems(MOVE_TO_LEFT, [itemId]);\n },\n [moveSelectedItems],\n );\n\n return (\n <div className=\"flex h-full min-h-0 w-fit gap-6\">\n <TransferListCard\n items={leftItems}\n selectedSet={selectedSet}\n onSelectItem={onSelectItem}\n onMoveItem={moveToRight}\n direction=\"right\"\n showHeaderTooltip={true}\n headerButton={{\n icon: \"caret-right\",\n onClick: () => allMoveSelectedItems(MOVE_TO_RIGHT),\n disabled: leftItems.length === 0,\n }}\n showFooterIcons={false}\n />\n\n <div className=\"flex h-full flex-col justify-center gap-8\">\n <Button\n variant=\"circle\"\n onClick={() => moveSelectedItems(MOVE_TO_RIGHT)}\n disabled={selectedLeftCount === 0}\n >\n <Icon\n type=\"caret-right\"\n className=\"text-placeholder-text\"\n />\n </Button>\n\n <Button\n variant=\"circle\"\n onClick={() => moveSelectedItems(MOVE_TO_LEFT)}\n disabled={selectedRightCount === 0}\n >\n <Icon\n type=\"caret-left\"\n className=\"text-placeholder-text\"\n />\n </Button>\n </div>\n\n <TransferListCard\n items={rightItems}\n selectedSet={selectedSet}\n onSelectItem={onSelectItem}\n onMoveItem={moveToLeft}\n direction=\"left\"\n headerButton={{\n icon: \"caret-left\",\n onClick: () => allMoveSelectedItems(MOVE_TO_LEFT),\n disabled: rightItems.length === 0,\n }}\n showFooterIcons\n />\n </div>\n );\n};\n"],"names":["MOVE_TO_LEFT","MOVE_TO_RIGHT","TransferList","list","onChange","leftItems","useMemo","i","rightItems","selectedIds","setSelectedIds","useState","selectedSet","leftIdSet","item","rightIdSet","selectedLeftCount","id","selectedRightCount","onSelectItem","useCallback","prev","itemId","moveSelectedItems","move","ids","resolvedIds","idsToMoveSet","newData","allMoveSelectedItems","moveToRight","moveToLeft","jsxs","jsx","TransferListCard","Button","Icon"],"mappings":"mYAiBA,MAAMA,EAAe,GACfC,EAAgB,GAETC,EAAe,CAAC,CAAE,KAAAC,EAAM,SAAAC,KAAsB,CACzD,MAAMC,EAAYC,EAAAA,QAAQ,IAAMH,EAAK,OAAQI,GAAM,CAACA,EAAE,QAAQ,EAAG,CAACJ,CAAI,CAAC,EACjEK,EAAaF,EAAAA,QAAQ,IAAMH,EAAK,OAAQI,GAAMA,EAAE,QAAQ,EAAG,CAACJ,CAAI,CAAC,EAEjE,CAACM,EAAaC,CAAc,EAAIC,EAAAA,SAAmB,CAAA,CAAE,EAErDC,EAAcN,EAAAA,QAAQ,IAAM,IAAI,IAAIG,CAAW,EAAG,CAACA,CAAW,CAAC,EAC/DI,EAAYP,EAAAA,QAAQ,IAAM,IAAI,IAAID,EAAU,IAAKS,GAASA,EAAK,EAAE,CAAC,EAAG,CAACT,CAAS,CAAC,EAChFU,EAAaT,EAAAA,QACjB,IAAM,IAAI,IAAIE,EAAW,IAAKM,GAASA,EAAK,EAAE,CAAC,EAC/C,CAACN,CAAU,CAAA,EAGPQ,EAAoBV,EAAAA,QACxB,IAAMG,EAAY,OAAQQ,GAAOJ,EAAU,IAAII,CAA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