brd-ui-kit 0.1.61 → 0.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brd-ui-kit.css +1 -1
- package/dist/components/contact-input/contact-input.d.ts +20 -0
- package/dist/components/contact-input/index.d.ts +2 -0
- package/dist/components/contact-input.d.ts +2 -0
- package/dist/components-contact-input-contact-input.cjs +7 -0
- package/dist/components-contact-input-contact-input.cjs.map +1 -0
- package/dist/components-contact-input-contact-input.js +196 -0
- package/dist/components-contact-input-contact-input.js.map +1 -0
- package/dist/components-contact-input.cjs +2 -0
- package/dist/components-contact-input.cjs.map +1 -0
- package/dist/components-contact-input.js +5 -0
- package/dist/components-contact-input.js.map +1 -0
- package/dist/components-ui-combobox-combobox.cjs.map +1 -1
- package/dist/components-ui-combobox-combobox.js +14 -2
- package/dist/components-ui-combobox-combobox.js.map +1 -1
- package/dist/components-ui-icon-overrides.cjs +1 -1
- package/dist/components-ui-icon-overrides.cjs.map +1 -1
- package/dist/components-ui-icon-overrides.js +28 -31
- package/dist/components-ui-icon-overrides.js.map +1 -1
- package/dist/constants/contact-input.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +10 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import './brd-ui-kit.css';/* empty css */
|
|
3
|
+
import { cn as a } from "./lib-utils.js";
|
|
4
|
+
import "class-variance-authority";
|
|
5
|
+
import { useState as b, useRef as w, useEffect as C } from "react";
|
|
6
|
+
import "./components-ui-badge-badge.styles.js";
|
|
7
|
+
import { Button as y } from "./components-ui-button-button.js";
|
|
8
|
+
import "./components-ui-button-button.styles.js";
|
|
9
|
+
import "./components-ui-card-card.js";
|
|
10
|
+
import "./components-ui-checkbox-checkbox.js";
|
|
11
|
+
import { Icon as l } from "./components-ui-icon-icon.js";
|
|
12
|
+
import "./components-ui-combobox-combobox.js";
|
|
13
|
+
import "./components-ui-dialog-dialog.js";
|
|
14
|
+
import "./components-ui-label-label.js";
|
|
15
|
+
import "./components-ui-separator-separator.js";
|
|
16
|
+
import "./components-ui-field-field.styles.js";
|
|
17
|
+
import "./components-ui-input-input.styles.js";
|
|
18
|
+
import "./components-ui-textarea-textarea.js";
|
|
19
|
+
import "./components-ui-input-group-input-group.styles.js";
|
|
20
|
+
import "./components-ui-navigation-item-navigation-item.styles.js";
|
|
21
|
+
import "./components-ui-navigation-menu-navigation-menu.styles.js";
|
|
22
|
+
import "./components-ui-pagination-pagination.js";
|
|
23
|
+
import "./components-ui-progress-progress.js";
|
|
24
|
+
import "./components-ui-radio-group-radio-group.js";
|
|
25
|
+
import "./components-ui-switch-switch.js";
|
|
26
|
+
import "./components-ui-table-table.js";
|
|
27
|
+
import "./components-ui-tabs-tabs.js";
|
|
28
|
+
import "./components-ui-tooltip-tooltip.js";
|
|
29
|
+
import "./components-ui-typography-typography.styles.js";
|
|
30
|
+
import { usePopupControls as B } from "./hooks-usePopupControls.js";
|
|
31
|
+
import "lucide-react";
|
|
32
|
+
import "./components-app-pagination-app-pagination.styles.js";
|
|
33
|
+
import "./components-app-sidebar-app-sidebar.styles.js";
|
|
34
|
+
import { InputField as N } from "./components-input-field-input-field.js";
|
|
35
|
+
import "./components-select-field-select-field.js";
|
|
36
|
+
import "./lodash-FemA_LCk.js";
|
|
37
|
+
import "./chart-D15EtNmb.js";
|
|
38
|
+
import "./index-C4iHL8Gs.js";
|
|
39
|
+
import "./index-C6N9aMq_.js";
|
|
40
|
+
const j = [
|
|
41
|
+
{
|
|
42
|
+
label: "Мобильный",
|
|
43
|
+
icon: "phone"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: "Telegram",
|
|
47
|
+
icon: "telegram"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: "WhatsApp",
|
|
51
|
+
icon: "whats-app"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: "Max",
|
|
55
|
+
icon: "max"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: "E-mail",
|
|
59
|
+
icon: "mail"
|
|
60
|
+
}
|
|
61
|
+
], p = (i) => {
|
|
62
|
+
switch (i) {
|
|
63
|
+
case "max":
|
|
64
|
+
return {
|
|
65
|
+
viewBox: "0 0 16 16",
|
|
66
|
+
bgColor: "bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]"
|
|
67
|
+
};
|
|
68
|
+
case "telegram":
|
|
69
|
+
return {
|
|
70
|
+
viewBox: "0 0 17 17",
|
|
71
|
+
bgColor: "bg-[#289AD2]"
|
|
72
|
+
};
|
|
73
|
+
case "whats-app":
|
|
74
|
+
return {
|
|
75
|
+
viewBox: "0 0 18 18",
|
|
76
|
+
bgColor: "bg-[#00C202]",
|
|
77
|
+
textColor: "text-[#00C202]"
|
|
78
|
+
};
|
|
79
|
+
default:
|
|
80
|
+
return {
|
|
81
|
+
viewBox: "0 0 24 24"
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}, ce = (i) => {
|
|
85
|
+
const [r, u] = b("phone"), { isOpened: n, openPopup: d, closePopup: m } = B(), s = w(null);
|
|
86
|
+
C(() => {
|
|
87
|
+
const e = (t) => {
|
|
88
|
+
s.current && !s.current.contains(t.target) && m();
|
|
89
|
+
};
|
|
90
|
+
return n && document.addEventListener("mousedown", e), () => {
|
|
91
|
+
document.removeEventListener("mousedown", e);
|
|
92
|
+
};
|
|
93
|
+
}, [n, m]);
|
|
94
|
+
const x = (e) => {
|
|
95
|
+
switch (e) {
|
|
96
|
+
case "phone":
|
|
97
|
+
return "+7 (999) 999-99-99";
|
|
98
|
+
case "telegram":
|
|
99
|
+
return "@username";
|
|
100
|
+
case "whats-app":
|
|
101
|
+
return "+7 (999) 999-99-99";
|
|
102
|
+
case "max":
|
|
103
|
+
return "ID пользователя Max";
|
|
104
|
+
case "mail":
|
|
105
|
+
return "example@mail.com";
|
|
106
|
+
default:
|
|
107
|
+
return "Введите значение";
|
|
108
|
+
}
|
|
109
|
+
}, f = (e) => () => {
|
|
110
|
+
u(e), m();
|
|
111
|
+
};
|
|
112
|
+
return /* @__PURE__ */ c("div", { className: a("relative", i.classes?.container), children: [
|
|
113
|
+
/* @__PURE__ */ o(
|
|
114
|
+
N,
|
|
115
|
+
{
|
|
116
|
+
...i,
|
|
117
|
+
date: [
|
|
118
|
+
{
|
|
119
|
+
id: "0",
|
|
120
|
+
position: "inline-start",
|
|
121
|
+
component: /* @__PURE__ */ o(
|
|
122
|
+
l,
|
|
123
|
+
{
|
|
124
|
+
type: r,
|
|
125
|
+
classes: {
|
|
126
|
+
wrapper: a(
|
|
127
|
+
`flex h-5.5 w-5.5 items-center justify-center rounded-sm p-[3.5px]
|
|
128
|
+
${p(r).bgColor ?? "bg-primary-inverse-hover-bg"}
|
|
129
|
+
${p(r).textColor ?? "text-primary-inverse-text"}`
|
|
130
|
+
)
|
|
131
|
+
},
|
|
132
|
+
viewBox: p(r).viewBox
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "1",
|
|
138
|
+
position: "inline-end",
|
|
139
|
+
component: /* @__PURE__ */ o(
|
|
140
|
+
l,
|
|
141
|
+
{
|
|
142
|
+
type: n ? "chevron-up" : "chevron",
|
|
143
|
+
className: "cursor-pointer",
|
|
144
|
+
onClick: d
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
placeholder: x(r)
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
n && /* @__PURE__ */ o(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: `border-inp-hover-border absolute my-2 flex w-full flex-col rounded-xl
|
|
156
|
+
border`,
|
|
157
|
+
ref: s,
|
|
158
|
+
children: j.map(({ label: e, icon: t }) => {
|
|
159
|
+
const { bgColor: h, textColor: v, viewBox: g } = p(t);
|
|
160
|
+
return /* @__PURE__ */ c(
|
|
161
|
+
y,
|
|
162
|
+
{
|
|
163
|
+
variant: "ghost",
|
|
164
|
+
className: "flex w-full justify-start",
|
|
165
|
+
type: "button",
|
|
166
|
+
onClick: f(t),
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ o(
|
|
169
|
+
l,
|
|
170
|
+
{
|
|
171
|
+
type: t,
|
|
172
|
+
className: "text-primary-inverse-text",
|
|
173
|
+
classes: {
|
|
174
|
+
wrapper: a(
|
|
175
|
+
`flex h-5.5 w-5.5 items-center justify-center rounded-sm
|
|
176
|
+
${h ?? "bg-primary-inverse-hover-bg"}
|
|
177
|
+
${v ?? "text-primary-inverse-text"}`
|
|
178
|
+
)
|
|
179
|
+
},
|
|
180
|
+
viewBox: g
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
e
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
e
|
|
187
|
+
);
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
] });
|
|
192
|
+
};
|
|
193
|
+
export {
|
|
194
|
+
ce as ContactInput
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=components-contact-input-contact-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-contact-input-contact-input.js","sources":["../src/constants/contact-input.ts","../src/components/contact-input/contact-input.tsx"],"sourcesContent":["import type { TOption } from \"@/components/contact-input/contact-input\";\n\nexport const OPTIONS: TOption[] = [\n {\n label: \"Мобильный\",\n icon: \"phone\",\n },\n {\n label: \"Telegram\",\n icon: \"telegram\",\n },\n {\n label: \"WhatsApp\",\n icon: \"whats-app\",\n },\n {\n label: \"Max\",\n icon: \"max\",\n },\n {\n label: \"E-mail\",\n icon: \"mail\",\n },\n];\n","import { OPTIONS } from \"@/constants/contact-input\";\nimport { Button, Icon, InputField, cn, usePopupControls, type IconTypes } from \"@/index\";\nimport { useEffect, useRef, useState } from \"react\";\n\nexport type TOption = {\n label: string;\n icon: TypesChange;\n};\n\ntype TypesChange = Extract<\n IconTypes,\n \"telegram\" | \"whats-app\" | \"max\" | \"phone\" | \"mail\"\n>;\n\ntype BaseProps = {\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};\n\ntype InputFieldProps = BaseProps & React.ComponentPropsWithRef<\"input\">;\n\n// TODO: заменить цвета\nconst iconStyles = (icon: IconTypes) => {\n switch (icon) {\n case \"max\":\n return {\n viewBox: \"0 0 16 16\",\n bgColor: \"bg-[linear-gradient(135deg,#9933DD_0%,#2831B9_50%,#44CCFF_100%)]\",\n };\n\n case \"telegram\":\n return {\n viewBox: \"0 0 17 17\",\n bgColor: \"bg-[#289AD2]\",\n };\n\n case \"whats-app\":\n return {\n viewBox: \"0 0 18 18\",\n bgColor: \"bg-[#00C202]\",\n textColor: \"text-[#00C202]\",\n };\n\n default:\n return {\n viewBox: \"0 0 24 24\",\n };\n }\n};\n\nexport const ContactInput = (props: InputFieldProps) => {\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\":\n return \"@username\";\n case \"whats-app\":\n return \"+7 (999) 999-99-99\";\n case \"max\":\n return \"ID пользователя Max\";\n case \"mail\":\n return \"example@mail.com\";\n default:\n return \"Введите значение\";\n }\n };\n\n const handleTypeChange = (type: TypesChange) => {\n return () => {\n setType(type);\n closePopup();\n };\n };\n\n return (\n <div className={cn(\"relative\", props.classes?.container)}>\n <InputField\n {...props}\n date={[\n {\n id: \"0\",\n position: \"inline-start\",\n component: (\n <Icon\n type={type}\n classes={{\n wrapper: cn(\n `flex h-5.5 w-5.5 items-center justify-center rounded-sm p-[3.5px]\n ${iconStyles(type).bgColor ?? \"bg-primary-inverse-hover-bg\"}\n ${iconStyles(type).textColor ?? \"text-primary-inverse-text\"}`,\n ),\n }}\n viewBox={iconStyles(type).viewBox}\n />\n ),\n },\n {\n id: \"1\",\n position: \"inline-end\",\n component: (\n <Icon\n type={isOpened ? \"chevron-up\" : \"chevron\"}\n className=\"cursor-pointer\"\n onClick={openPopup}\n />\n ),\n },\n ]}\n placeholder={getPlaceholder(type)}\n />\n\n {isOpened && (\n <div\n className=\"border-inp-hover-border absolute my-2 flex w-full flex-col rounded-xl\n border\"\n ref={wrapperRef}\n >\n {OPTIONS.map(({ label, icon }) => {\n const { bgColor, textColor, viewBox } = iconStyles(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 <Icon\n type={icon}\n className=\"text-primary-inverse-text\"\n classes={{\n wrapper: cn(\n `flex h-5.5 w-5.5 items-center justify-center rounded-sm\n ${bgColor ?? \"bg-primary-inverse-hover-bg\"}\n ${textColor ?? \"text-primary-inverse-text\"}`,\n ),\n }}\n viewBox={viewBox}\n />\n\n {label}\n </Button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport type { InputFieldProps as ContactInputProps };\n"],"names":["OPTIONS","iconStyles","icon","ContactInput","props","type","setType","useState","isOpened","openPopup","closePopup","usePopupControls","wrapperRef","useRef","useEffect","handleClickOutside","event","getPlaceholder","handleTypeChange","jsxs","cn","jsx","InputField","Icon","label","bgColor","textColor","viewBox","Button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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AuB,GAAS,WAAAC,GAAW,SAAAC,EAAA,IAAY1B,EAAWC,CAAI;AAEvD,iBACE,gBAAAiB;AAAA,YAACS;AAAA,YAAA;AAAA,cAEC,SAAQ;AAAA,cACR,WAAU;AAAA,cACV,MAAK;AAAA,cACL,SAASV,EAAiBhB,CAAI;AAAA,cAE9B,UAAA;AAAA,gBAAA,gBAAAmB;AAAA,kBAACE;AAAA,kBAAA;AAAA,oBACC,MAAMrB;AAAA,oBACN,WAAU;AAAA,oBACV,SAAS;AAAA,sBACP,SAASkB;AAAA,wBACP;AAAA,wBACEK,KAAW,6BAA6B;AAAA,wBACxCC,KAAa,2BAA2B;AAAA,sBAAA;AAAA,oBAC5C;AAAA,oBAEF,SAAAC;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGDH;AAAA,cAAA;AAAA,YAAA;AAAA,YAnBIA;AAAA,UAAA;AAAA,QAsBX,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-contact-input.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-contact-input.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|