bonkers-ui 2.0.2 → 2.0.4
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/README.md +25 -40
- package/_types/colors.d.ts +2 -0
- package/_types/colors.js +1 -1
- package/_types/colors.js.map +1 -1
- package/assets/UiBerRank.css +1 -0
- package/assets/UiButton.css +0 -0
- package/assets/UiCheckbox.css +1 -0
- package/assets/UiInputRange.css +1 -0
- package/assets/UiRadio.css +1 -0
- package/assets/UiSelect.css +1 -0
- package/assets/UiToggle.css +1 -0
- package/bonkers.css +243 -0
- package/components/UiAccordion/UiAccordion.InfoDropdown.js +31 -0
- package/components/UiAccordion/UiAccordion.InfoDropdown.js.map +1 -0
- package/components/UiAccordion/UiAccordion.base.js +13 -0
- package/components/UiAccordion/UiAccordion.base.js.map +1 -0
- package/components/UiAccordion/UiAccordion.context.js +39 -0
- package/components/UiAccordion/UiAccordion.context.js.map +1 -0
- package/components/UiAccordion/UiAccordionItem.base.js +43 -0
- package/components/UiAccordion/UiAccordionItem.base.js.map +1 -0
- package/components/UiAccordion/_types.js +5 -0
- package/components/UiAccordion/_types.js.map +1 -0
- package/components/UiAccordion/index.d.ts +1 -0
- package/components/UiAccordion/index.js +13 -0
- package/{index.js.map → components/UiAccordion/index.js.map} +1 -1
- package/components/UiAlert/UiAlert.d.ts +1 -0
- package/components/UiAlert/UiAlert.js +12 -10
- package/components/UiAlert/UiAlert.js.map +1 -1
- package/components/UiBerRank/UiBerRank.d.ts +1 -0
- package/components/UiBerRank/UiBerRank.js +35 -31
- package/components/UiBerRank/UiBerRank.js.map +1 -1
- package/components/UiBerRank/_types.js +6 -5
- package/components/UiBerRank/_types.js.map +1 -1
- package/components/UiButton/UiButton.d.ts +1 -0
- package/components/UiButton/UiButton.js +260 -103
- package/components/UiButton/UiButton.js.map +1 -1
- package/components/UiButton/_types.d.ts +15 -9
- package/components/UiButton/_types.js +1 -1
- package/components/UiButton/_types.js.map +1 -1
- package/components/UiCheckbox/UiCheckbox.d.ts +1 -0
- package/components/UiCheckbox/UiCheckbox.js +48 -42
- package/components/UiCheckbox/UiCheckbox.js.map +1 -1
- package/components/UiCheckbox/index.d.ts +1 -0
- package/components/UiCheckbox/index.js +4 -2
- package/components/UiCheckbox/index.js.map +1 -1
- package/components/UiIcon/UiIcon.d.ts +1 -0
- package/components/UiIcon/UiIcon.js +10 -9
- package/components/UiIcon/UiIcon.js.map +1 -1
- package/components/UiIconBadge/UiIconBadge.d.ts +3 -0
- package/components/UiIconBadge/UiIconBadge.js +35 -0
- package/components/UiIconBadge/UiIconBadge.js.map +1 -0
- package/components/UiIconBadge/_types.d.ts +15 -0
- package/components/UiIconBadge/_types.js +5 -0
- package/components/UiIconBadge/_types.js.map +1 -0
- package/components/UiIconBadge/index.d.ts +2 -0
- package/components/UiIconBadge/index.js +7 -0
- package/components/UiIconBadge/index.js.map +1 -0
- package/components/UiInput/UiInput.base.d.ts +1 -0
- package/components/UiInput/UiInput.base.js +13 -12
- package/components/UiInput/UiInput.base.js.map +1 -1
- package/components/UiInputRange/UiInputRange.d.ts +1 -0
- package/components/UiInputRange/UiInputRange.js +31 -28
- package/components/UiInputRange/UiInputRange.js.map +1 -1
- package/components/UiList/UiList.d.ts +3 -1
- package/components/UiList/UiList.js +23 -18
- package/components/UiList/UiList.js.map +1 -1
- package/components/UiList/UiListItem.d.ts +1 -0
- package/components/UiList/UiListItem.js +6 -5
- package/components/UiList/UiListItem.js.map +1 -1
- package/components/UiList/_types.d.ts +4 -0
- package/components/UiList/_types.js +4 -3
- package/components/UiList/_types.js.map +1 -1
- package/components/UiNotificationBadge/UiNotificationBadge.d.ts +6 -5
- package/components/UiNotificationBadge/UiNotificationBadge.js +48 -83
- package/components/UiNotificationBadge/UiNotificationBadge.js.map +1 -1
- package/components/UiNotificationBadge/_types.d.ts +8 -0
- package/components/UiNotificationBadge/_types.js +4 -2
- package/components/UiNotificationBadge/_types.js.map +1 -1
- package/components/UiPills/UiPills.d.ts +1 -0
- package/components/UiPills/UiPills.js +16 -14
- package/components/UiPills/UiPills.js.map +1 -1
- package/components/UiPlainRadio/UiPlainRadio.d.ts +1 -0
- package/components/UiPlainRadio/UiPlainRadio.js +66 -51
- package/components/UiPlainRadio/UiPlainRadio.js.map +1 -1
- package/components/UiProductCard/UiProductCard.d.ts +1 -0
- package/components/UiProductCard/UiProductCard.js +24 -27
- package/components/UiProductCard/UiProductCard.js.map +1 -1
- package/components/UiProgress/UiProgress.d.ts +1 -0
- package/components/UiProgress/UiProgress.js +17 -15
- package/components/UiProgress/UiProgress.js.map +1 -1
- package/components/UiRadio/UiRadio.js +19 -13
- package/components/UiRadio/UiRadio.js.map +1 -1
- package/components/UiRadioFancy/UiRadioFancy.d.ts +9 -4
- package/components/UiRadioFancy/UiRadioFancy.js +41 -29
- package/components/UiRadioFancy/UiRadioFancy.js.map +1 -1
- package/components/UiRadioFancy/_types.d.ts +1 -1
- package/components/UiRadioFancy/_types.js +2 -2
- package/components/UiRadioFancy/_types.js.map +1 -1
- package/components/UiSelect/UiSelect.d.ts +1 -0
- package/components/UiSelect/UiSelect.js +99 -0
- package/components/UiSelect/UiSelect.js.map +1 -0
- package/components/UiSelect/index.js +5 -0
- package/components/UiSelect/index.js.map +1 -0
- package/components/UiSkeleton/UiSkeleton.d.ts +1 -0
- package/components/UiSkeleton/UiSkeleton.js +42 -41
- package/components/UiSkeleton/UiSkeleton.js.map +1 -1
- package/components/UiSnackbar/UiSnackbar.d.ts +10 -0
- package/components/UiSnackbar/UiSnackbar.js +67 -0
- package/components/UiSnackbar/UiSnackbar.js.map +1 -0
- package/components/UiSnackbar/_types.d.ts +7 -0
- package/components/UiSnackbar/_types.js +5 -0
- package/components/UiSnackbar/_types.js.map +1 -0
- package/components/UiSnackbar/index.d.ts +1 -0
- package/components/UiSnackbar/index.js +5 -0
- package/components/UiSnackbar/index.js.map +1 -0
- package/components/UiStars/UiStars.d.ts +18 -0
- package/components/UiStars/UiStars.js +57 -0
- package/components/UiStars/UiStars.js.map +1 -0
- package/components/UiStars/_types.d.ts +12 -0
- package/components/UiStars/_types.js +6 -0
- package/components/UiStars/_types.js.map +1 -0
- package/components/UiStars/index.d.ts +3 -0
- package/components/UiStars/index.js +7 -0
- package/components/UiStars/index.js.map +1 -0
- package/components/UiTable/UiTable.js +10 -9
- package/components/UiTable/UiTable.js.map +1 -1
- package/components/UiTable/UiTableCell.js +13 -12
- package/components/UiTable/UiTableCell.js.map +1 -1
- package/components/UiTable/UiTableRow.js +10 -9
- package/components/UiTable/UiTableRow.js.map +1 -1
- package/components/UiTabs/UiTabs.d.ts +1 -0
- package/components/UiTabs/UiTabs.js +21 -18
- package/components/UiTabs/UiTabs.js.map +1 -1
- package/components/UiToggle/UiToggle.d.ts +7 -4
- package/components/UiToggle/UiToggle.js +117 -91
- package/components/UiToggle/UiToggle.js.map +1 -1
- package/components/UiTypography/UiTypography.js +12 -10
- package/components/UiTypography/UiTypography.js.map +1 -1
- package/eslint.config.mjs +4 -3
- package/helper.d.ts +31 -0
- package/index.d.ts +24 -20
- package/package.json +43 -42
- package/stories/Colors/Colors.d.ts +2 -0
- package/stories/FontSizes/FontSizes.d.ts +2 -0
- package/stories/Spacings/Spacings.d.ts +2 -0
- package/bonkers-ui.css +0 -1
- package/bonkers-ui.umd.js +0 -103
- package/bonkers-ui.umd.js.map +0 -1
- package/components/UiBerRank/UiBerRank.module.css.js +0 -10
- package/components/UiBerRank/UiBerRank.module.css.js.map +0 -1
- package/components/UiButton/UiButton.module.css.js +0 -8
- package/components/UiButton/UiButton.module.css.js.map +0 -1
- package/components/UiCheckbox/UiCheckbox.module.css.js +0 -15
- package/components/UiCheckbox/UiCheckbox.module.css.js.map +0 -1
- package/components/UiInputRange/UiInputRange.module.css.js +0 -8
- package/components/UiInputRange/UiInputRange.module.css.js.map +0 -1
- package/components/UiRadio/UiRadio.module.css.js +0 -10
- package/components/UiRadio/UiRadio.module.css.js.map +0 -1
- package/index.js +0 -43
- package/plugin.ts +0 -160
- package/postcss.config.mjs +0 -9
- package/src/_styles/_backdropBlur.json +0 -10
- package/src/_styles/_colors.json +0 -81
- package/src/_styles/_fontSizes.json +0 -12
- package/src/_styles/_shadow.json +0 -8
- package/src/_styles/_spacing.json +0 -16
- package/tailwind.config.ts +0 -15
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import o from "classnames";
|
|
4
|
-
import { UiTypography as
|
|
5
|
-
import {
|
|
6
|
-
import { EColors as
|
|
7
|
-
const
|
|
4
|
+
import { UiTypography as p } from "../UiTypography/UiTypography.js";
|
|
5
|
+
import { ETextWeight as d, ETypographySizes as f } from "../UiTypography/_types.js";
|
|
6
|
+
import { EColors as h } from "../../_types/colors.js";
|
|
7
|
+
const b = ({
|
|
8
8
|
progressText: i,
|
|
9
9
|
max: e,
|
|
10
10
|
min: l,
|
|
11
|
-
current: s
|
|
11
|
+
current: s,
|
|
12
|
+
className: t
|
|
12
13
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
"ui-progress"
|
|
14
|
+
const a = (s - l) / (e - l) * 100;
|
|
15
|
+
return /* @__PURE__ */ m("div", { className: o(
|
|
16
|
+
"ui-progress",
|
|
17
|
+
t
|
|
16
18
|
), children: [
|
|
17
19
|
/* @__PURE__ */ r("div", { className: o(
|
|
18
20
|
"relative",
|
|
19
|
-
"h-
|
|
21
|
+
"h-xxs ",
|
|
20
22
|
"w-full",
|
|
21
23
|
"overflow-hidden",
|
|
22
24
|
"rounded-3xl",
|
|
@@ -38,15 +40,15 @@ const y = ({
|
|
|
38
40
|
"duration-300"
|
|
39
41
|
),
|
|
40
42
|
style: {
|
|
41
|
-
width: `${
|
|
43
|
+
width: `${a}%`
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
) }),
|
|
45
47
|
i && /* @__PURE__ */ r(
|
|
46
|
-
|
|
48
|
+
p,
|
|
47
49
|
{
|
|
48
|
-
color:
|
|
49
|
-
size:
|
|
50
|
+
color: h.PRIMARY_700,
|
|
51
|
+
size: f.SM,
|
|
50
52
|
weight: d.SEMI_BOLD,
|
|
51
53
|
children: i
|
|
52
54
|
}
|
|
@@ -54,6 +56,6 @@ const y = ({
|
|
|
54
56
|
] });
|
|
55
57
|
};
|
|
56
58
|
export {
|
|
57
|
-
|
|
59
|
+
b as UiProgress
|
|
58
60
|
};
|
|
59
61
|
//# sourceMappingURL=UiProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiProgress.js","sources":["../../../src/components/UiProgress/UiProgress.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport { EColors, ETextWeight, ETypographySizes, UiTypography } from \"../UiTypography\";\n\ninterface IUiProgress {\n\tmin: number\n\tmax: number\n\tcurrent: number\n\tprogressText?: string\n\n}\n\nexport const UiProgress: React.FC<IUiProgress> = ({\n\tprogressText,\n\tmax,\n\tmin,\n\tcurrent\n\n}) => {\n\tconst filler = ((current - min) / (max - min)) * 100;\n\n\treturn (\n\t\t<div className={ cx(\n\t\t\t\"ui-progress\"\n\t\t) }>\n\t\t\t<div className={ cx(\n\t\t\t\t\"relative\",\n\t\t\t\t\"h-
|
|
1
|
+
{"version":3,"file":"UiProgress.js","sources":["../../../src/components/UiProgress/UiProgress.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport { EColors, ETextWeight, ETypographySizes, UiTypography } from \"../UiTypography\";\n\ninterface IUiProgress {\n\tmin: number\n\tmax: number\n\tcurrent: number\n\tprogressText?: string\n\tclassName?: string\n}\n\nexport const UiProgress: React.FC<IUiProgress> = ({\n\tprogressText,\n\tmax,\n\tmin,\n\tcurrent,\n\tclassName\n\n}) => {\n\tconst filler = ((current - min) / (max - min)) * 100;\n\n\treturn (\n\t\t<div className={ cx(\n\t\t\t\"ui-progress\",\n\t\t\tclassName\n\t\t) }>\n\t\t\t<div className={ cx(\n\t\t\t\t\"relative\",\n\t\t\t\t\"h-xxs \",\n\t\t\t\t\"w-full\",\n\t\t\t\t\"overflow-hidden\",\n\t\t\t\t\"rounded-3xl\",\n\t\t\t\t\"bg-primary-50\",\n\t\t\t\t\"mb-xxs\"\n\t\t\t) } >\n\t\t\t\t<div className={ cx(\n\t\t\t\t\t\"ui-progress__bar-fill\",\n\t\t\t\t\t\"absolute\",\n\t\t\t\t\t\"left-0\",\n\t\t\t\t\t\"top-0\",\n\t\t\t\t\t\"z-10\",\n\t\t\t\t\t\"h-full\",\n\t\t\t\t\t\"rounded-2xl\",\n\t\t\t\t\t\"bg-primary-700\",\n\t\t\t\t\t\"transition-all\",\n\t\t\t\t\t\"duration-300\"\n\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: `${filler}%`\n\t\t\t\t} }>\n\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ progressText && (\n\t\t\t\t<UiTypography\n\t\t\t\t\tcolor={ EColors.PRIMARY_700 }\n\t\t\t\t\tsize={ ETypographySizes.SM }\n\t\t\t\t\tweight={ ETextWeight.SEMI_BOLD }\n\t\t\t\t>\n\t\t\t\t\t{ progressText }\n\t\t\t\t</UiTypography>\n\t\t\t) }\n\n\t\t</div>\n\n\t);\n};\n"],"names":["UiProgress","progressText","max","min","current","className","filler","jsxs","cx","jsx","UiTypography","EColors","ETypographySizes","ETextWeight"],"mappings":";;;;;;AAYO,MAAMA,IAAoC,CAAC;AAAA,EACjD,cAAAC;AAAA,EACA,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAED,MAAM;AACL,QAAMC,KAAWF,IAAUD,MAAQD,IAAMC,KAAQ;AAGhD,SAAA,gBAAAI,EAAC,SAAI,WAAYC;AAAA,IAChB;AAAA,IACAH;AAAA,EAEA,GAAA,UAAA;AAAA,IAAA,gBAAAI,EAAC,SAAI,WAAYD;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAEA,GAAA,UAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QAAI,WAAYD;AAAA,UAChB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAED;AAAA,QACA,OAAQ;AAAA,UACP,OAAO,GAAGF,CAAM;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA,GAGD;AAAA,IACEL,KACD,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACA,OAAQC,EAAQ;AAAA,QAChB,MAAOC,EAAiB;AAAA,QACxB,QAASC,EAAY;AAAA,QAEnB,UAAAZ;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAGF;AAGF;"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as y, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import a from "classnames";
|
|
4
|
-
import d from "./UiRadio.module.css.js";
|
|
5
4
|
import { EJustify as e } from "../../_types/align.js";
|
|
6
|
-
const
|
|
5
|
+
import '../../assets/UiRadio.css';const b = "_UiRadio__custom_wei69_1", R = "_UiRadio__dot_wei69_4", d = {
|
|
6
|
+
UiRadio__custom: b,
|
|
7
|
+
UiRadio__dot: R
|
|
8
|
+
}, g = {
|
|
7
9
|
[e.START]: "justify-start",
|
|
8
10
|
[e.END]: "justify-end",
|
|
9
11
|
[e.CENTER]: "justify-center",
|
|
@@ -18,18 +20,20 @@ const y = {
|
|
|
18
20
|
disabled: r = !1,
|
|
19
21
|
onChange: t,
|
|
20
22
|
checked: p = !1,
|
|
21
|
-
children: i
|
|
23
|
+
children: i,
|
|
24
|
+
className: u,
|
|
25
|
+
tabIndex: m
|
|
22
26
|
}) => {
|
|
23
|
-
const
|
|
27
|
+
const _ = (f) => {
|
|
24
28
|
!r && t && t(f.target.value);
|
|
25
29
|
};
|
|
26
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ y("label", { className: a(
|
|
27
31
|
"UiRadio",
|
|
28
32
|
"group",
|
|
29
33
|
"grid",
|
|
30
34
|
"grid-flow-col",
|
|
31
35
|
"cursor-pointer",
|
|
32
|
-
|
|
36
|
+
g[l],
|
|
33
37
|
{
|
|
34
38
|
"pointer-events-none": r,
|
|
35
39
|
"items-center gap-xxs": i
|
|
@@ -44,8 +48,9 @@ const y = {
|
|
|
44
48
|
value: s,
|
|
45
49
|
disabled: r,
|
|
46
50
|
checked: p,
|
|
47
|
-
onChange:
|
|
48
|
-
className: "peer absolute appearance-none"
|
|
51
|
+
onChange: _,
|
|
52
|
+
className: "peer absolute appearance-none",
|
|
53
|
+
tabIndex: m
|
|
49
54
|
}
|
|
50
55
|
),
|
|
51
56
|
/* @__PURE__ */ o("span", { className: a(
|
|
@@ -62,11 +67,12 @@ const y = {
|
|
|
62
67
|
"group-focus:border-secondary-alt-700",
|
|
63
68
|
"peer-checked:border-2",
|
|
64
69
|
"peer-checked:border-primary",
|
|
65
|
-
"peer-checked:
|
|
66
|
-
"peer-checked:
|
|
70
|
+
"hover:peer-checked:border-primary-600",
|
|
71
|
+
"active:peer-checked:border-primary-800",
|
|
67
72
|
"peer-focus:shadow-border-primary",
|
|
68
73
|
"peer-disabled:border-secondary-alt-400",
|
|
69
|
-
"peer-disabled:bg-secondary-alt-200"
|
|
74
|
+
"peer-disabled:bg-secondary-alt-200",
|
|
75
|
+
u
|
|
70
76
|
), children: /* @__PURE__ */ o("span", { className: a(
|
|
71
77
|
d.UiRadio__dot,
|
|
72
78
|
"absolute",
|
|
@@ -75,7 +81,7 @@ const y = {
|
|
|
75
81
|
"block",
|
|
76
82
|
"size-xxs",
|
|
77
83
|
"rounded-full",
|
|
78
|
-
"bg-primary
|
|
84
|
+
"bg-primary"
|
|
79
85
|
) }) }),
|
|
80
86
|
i
|
|
81
87
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiRadio.js","sources":["../../../src/components/UiRadio/UiRadio.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport styles from \"./UiRadio.module.css\";\nimport { EJustify } from \"../../_types/align\";\n\nexport type TUiRadioProps = {\n\tchildren?: React.ReactNode;\n\tname: string;\n\tvalue: string;\n\tinvertOrder?: boolean;\n\tjustify?: EJustify;\n\tdisabled?: boolean;\n\tchecked?: boolean;\n\tonChange: (value: string) => void;\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, \"onChange\" | \"checked\" | \"value\" | \"name\">;\n\nconst justificationClasses = {\n\t[EJustify.START]: \"justify-start\",\n\t[EJustify.END]: \"justify-end\",\n\t[EJustify.CENTER]: \"justify-center\",\n\t[EJustify.BETWEEN]: \"justify-between\",\n\t[EJustify.AROUND]: \"justify-around\",\n\t[EJustify.EVENLY]: \"justify-evenly\"\n};\n\nexport const UiRadio: React.FC<TUiRadioProps> = ({\n\tname,\n\tvalue,\n\tinvertOrder = false,\n\tjustify = EJustify.START,\n\tdisabled = false,\n\tonChange,\n\tchecked = false,\n\tchildren\n}) => {\n\n\tconst handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\tif (!disabled && onChange) {\n\t\t\tonChange(event.target.value);\n\t\t}\n\t};\n\n\treturn (\n\t\t<label className={\n\t\t\tcx(\"UiRadio\",\n\t\t\t\t\"group\",\n\t\t\t\t\"grid\",\n\t\t\t\t\"grid-flow-col\",\n\t\t\t\t\"cursor-pointer\",\n\t\t\t\tjustificationClasses[justify],\n\t\t\t\t{\n\t\t\t\t\t\"pointer-events-none\": disabled,\n\t\t\t\t\t\"items-center gap-xxs\": children\n\t\t\t\t}\n\t\t\t) }>\n\t\t\t<input\n\t\t\t\tid={ value }\n\t\t\t\tname={ name.toString() }\n\t\t\t\ttype=\"radio\"\n\t\t\t\tvalue={ value }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tchecked={ checked }\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tclassName=\"peer absolute appearance-none\"\n\t\t\t/>\n\t\t\t<span className={ cx(\n\t\t\t\tstyles.UiRadio__custom,\n\t\t\t\tinvertOrder && \"order-last\",\n\t\t\t\t\"relative\",\n\t\t\t\t\"block\",\n\t\t\t\t\"size-md\",\n\t\t\t\t\"rounded-full\",\n\t\t\t\t\"border\",\n\t\t\t\t\"border-secondary-alt\",\n\t\t\t\t\"bg-white\",\n\t\t\t\t\"group-hover:border-secondary-alt-700\",\n\t\t\t\t\"group-focus:border-secondary-alt-700\",\n\t\t\t\t\"peer-checked:border-2\",\n\t\t\t\t\"peer-checked:border-primary\",\n\t\t\t\t\"peer-checked:
|
|
1
|
+
{"version":3,"file":"UiRadio.js","sources":["../../../src/components/UiRadio/UiRadio.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport styles from \"./UiRadio.module.css\";\nimport { EJustify } from \"../../_types/align\";\n\nexport type TUiRadioProps = {\n\tchildren?: React.ReactNode;\n\tname: string;\n\tvalue: string;\n\tinvertOrder?: boolean;\n\tjustify?: EJustify;\n\tdisabled?: boolean;\n\tchecked?: boolean;\n\tonChange: (value: string) => void;\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, \"onChange\" | \"checked\" | \"value\" | \"name\">;\n\nconst justificationClasses = {\n\t[EJustify.START]: \"justify-start\",\n\t[EJustify.END]: \"justify-end\",\n\t[EJustify.CENTER]: \"justify-center\",\n\t[EJustify.BETWEEN]: \"justify-between\",\n\t[EJustify.AROUND]: \"justify-around\",\n\t[EJustify.EVENLY]: \"justify-evenly\"\n};\n\nexport const UiRadio: React.FC<TUiRadioProps> = ({\n\tname,\n\tvalue,\n\tinvertOrder = false,\n\tjustify = EJustify.START,\n\tdisabled = false,\n\tonChange,\n\tchecked = false,\n\tchildren,\n\tclassName,\n\ttabIndex\n}) => {\n\n\tconst handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\tif (!disabled && onChange) {\n\t\t\tonChange(event.target.value);\n\t\t}\n\t};\n\n\treturn (\n\t\t<label className={\n\t\t\tcx(\"UiRadio\",\n\t\t\t\t\"group\",\n\t\t\t\t\"grid\",\n\t\t\t\t\"grid-flow-col\",\n\t\t\t\t\"cursor-pointer\",\n\t\t\t\tjustificationClasses[justify],\n\t\t\t\t{\n\t\t\t\t\t\"pointer-events-none\": disabled,\n\t\t\t\t\t\"items-center gap-xxs\": children\n\t\t\t\t}\n\t\t\t) }>\n\t\t\t<input\n\t\t\t\tid={ value }\n\t\t\t\tname={ name.toString() }\n\t\t\t\ttype=\"radio\"\n\t\t\t\tvalue={ value }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tchecked={ checked }\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tclassName=\"peer absolute appearance-none\"\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t/>\n\t\t\t<span className={ cx(\n\t\t\t\tstyles.UiRadio__custom,\n\t\t\t\tinvertOrder && \"order-last\",\n\t\t\t\t\"relative\",\n\t\t\t\t\"block\",\n\t\t\t\t\"size-md\",\n\t\t\t\t\"rounded-full\",\n\t\t\t\t\"border\",\n\t\t\t\t\"border-secondary-alt\",\n\t\t\t\t\"bg-white\",\n\t\t\t\t\"group-hover:border-secondary-alt-700\",\n\t\t\t\t\"group-focus:border-secondary-alt-700\",\n\t\t\t\t\"peer-checked:border-2\",\n\t\t\t\t\"peer-checked:border-primary\",\n\t\t\t\t\"hover:peer-checked:border-primary-600\",\n\t\t\t\t\"active:peer-checked:border-primary-800\",\n\t\t\t\t\"peer-focus:shadow-border-primary\",\n\t\t\t\t\"peer-disabled:border-secondary-alt-400\",\n\t\t\t\t\"peer-disabled:bg-secondary-alt-200\",\n\t\t\t\tclassName,\n\t\t\t) }>\n\t\t\t\t<span className={ cx(\n\t\t\t\t\tstyles.UiRadio__dot,\n\t\t\t\t\t\"absolute\",\n\t\t\t\t\t\"left-2/4\",\n\t\t\t\t\t\"top-2/4\",\n\t\t\t\t\t\"block\",\n\t\t\t\t\t\"size-xxs\",\n\t\t\t\t\t\"rounded-full\",\n\t\t\t\t\t\"bg-primary\",\n\t\t\t\t) } />\n\t\t\t</span>\n\t\t\t{ children }\n\t\t</label>\n\t);\n};\n"],"names":["justificationClasses","EJustify","UiRadio","name","value","invertOrder","justify","disabled","onChange","checked","children","className","tabIndex","handleChange","event","jsxs","cx","jsx","styles"],"mappings":";;;;;;;GAgBMA,IAAuB;AAAA,EAC5B,CAACC,EAAS,KAAK,GAAG;AAAA,EAClB,CAACA,EAAS,GAAG,GAAG;AAAA,EAChB,CAACA,EAAS,MAAM,GAAG;AAAA,EACnB,CAACA,EAAS,OAAO,GAAG;AAAA,EACpB,CAACA,EAAS,MAAM,GAAG;AAAA,EACnB,CAACA,EAAS,MAAM,GAAG;AACpB,GAEaC,IAAmC,CAAC;AAAA,EAChD,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,SAAAC,IAAUL,EAAS;AAAA,EACnB,UAAAM,IAAW;AAAA,EACX,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AACD,MAAM;AAEC,QAAAC,IAAe,CAACC,MAA+C;AAChE,IAAA,CAACP,KAAYC,KACPA,EAAAM,EAAM,OAAO,KAAK;AAAA,EAE7B;AAGC,SAAA,gBAAAC,EAAC,WAAM,WACNC;AAAA,IAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAhB,EAAqBM,CAAO;AAAA,IAC5B;AAAA,MACC,uBAAuBC;AAAA,MACvB,wBAAwBG;AAAA,IAAA;AAAA,EAG1B,GAAA,UAAA;AAAA,IAAA,gBAAAO;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,IAAKb;AAAA,QACL,MAAOD,EAAK,SAAS;AAAA,QACrB,MAAK;AAAA,QACL,OAAAC;AAAA,QACA,UAAAG;AAAA,QACA,SAAAE;AAAA,QACA,UAAWI;AAAA,QACX,WAAU;AAAA,QACV,UAAAD;AAAA,MAAA;AAAA,IACD;AAAA,IACA,gBAAAK,EAAC,UAAK,WAAYD;AAAA,MACjBE,EAAO;AAAA,MACPb,KAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACAM;AAAA,IACD,GACC,UAAC,gBAAAM,EAAA,QAAA,EAAK,WAAYD;AAAA,MACjBE,EAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,OACG,EACL,CAAA;AAAA,IACER;AAAA,EAAA,GACH;AAEF;"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
-
|
|
3
|
+
import { ERadioTypes } from './_types';
|
|
4
|
+
export type TUiRadioFancy = {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
icon?: IconProp;
|
|
6
7
|
disabled?: boolean;
|
|
8
|
+
active?: boolean;
|
|
7
9
|
subHeader?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
className?: string;
|
|
11
|
+
radioType?: ERadioTypes;
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "checked" | "value" | "name">;
|
|
15
|
+
export declare const UiRadioFancy: React.FC<TUiRadioFancy>;
|
|
@@ -1,46 +1,58 @@
|
|
|
1
1
|
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import
|
|
4
|
-
import { UiIcon as
|
|
5
|
-
import { ESize as
|
|
3
|
+
import t from "classnames";
|
|
4
|
+
import { UiIcon as f } from "../UiIcon/UiIcon.js";
|
|
5
|
+
import { ESize as u } from "../../_types/sizing.js";
|
|
6
6
|
import "@fortawesome/fontawesome-svg-core";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { ERadioTypes as a } from "./_types.js";
|
|
8
|
+
const h = {
|
|
9
|
+
[a.DEFAULT]: "items-center",
|
|
10
|
+
[a.COMPACT]: "items-start flex-col"
|
|
11
|
+
}, w = ({
|
|
12
|
+
children: i,
|
|
13
|
+
icon: s,
|
|
10
14
|
disabled: e,
|
|
11
|
-
subHeader:
|
|
12
|
-
|
|
15
|
+
subHeader: n,
|
|
16
|
+
active: c,
|
|
17
|
+
radioType: l = a.DEFAULT,
|
|
18
|
+
value: d,
|
|
19
|
+
onChange: p,
|
|
20
|
+
className: m
|
|
21
|
+
}) => /* @__PURE__ */ o("label", { className: t(
|
|
13
22
|
"ui-radio-fancy",
|
|
14
23
|
"relative",
|
|
15
24
|
{
|
|
16
25
|
"pointer-events-none": e
|
|
17
|
-
}
|
|
26
|
+
},
|
|
27
|
+
m
|
|
18
28
|
), children: [
|
|
19
|
-
/* @__PURE__ */ r("input", { className: "group peer absolute appearance-none", type: "radio" }),
|
|
20
|
-
/* @__PURE__ */ o("div", { className:
|
|
29
|
+
/* @__PURE__ */ r("input", { className: "group peer absolute appearance-none", type: "radio", checked: c, onChange: () => p(d) }),
|
|
30
|
+
/* @__PURE__ */ o("div", { className: t(
|
|
21
31
|
"box-border",
|
|
22
|
-
"size-full",
|
|
23
32
|
"cursor-pointer",
|
|
24
33
|
"rounded-lg",
|
|
25
|
-
"border
|
|
34
|
+
"border",
|
|
26
35
|
"bg-white",
|
|
27
36
|
"p-sm",
|
|
28
|
-
"hover:border-
|
|
29
|
-
"peer-focus:
|
|
30
|
-
"peer-
|
|
37
|
+
"hover:border-secondary-alt-700",
|
|
38
|
+
"peer-focus:outline ",
|
|
39
|
+
"peer-focus:outline-4",
|
|
40
|
+
"peer-focus:outline-primary-300",
|
|
41
|
+
"peer-checked:shadow-border-primary-600",
|
|
42
|
+
"peer-checked:border-0",
|
|
43
|
+
"active:peer-checked:bg-secondary-alt-200",
|
|
44
|
+
"hover:peer-checked:shadow-border-primary-700",
|
|
31
45
|
"flex",
|
|
32
|
-
"items-center",
|
|
33
46
|
"gap-sm",
|
|
34
47
|
"text-sm",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
48
|
+
c ? "peer-focus:outline-offset-2" : "peer-focus:outline-offset-0",
|
|
49
|
+
e ? "border-secondary-alt-400 text-secondary-alt-500 peer-checked:shadow-border-primary-disabled" : "border-secondary-alt-600",
|
|
50
|
+
h[l]
|
|
39
51
|
), children: [
|
|
40
52
|
/* @__PURE__ */ r(
|
|
41
53
|
"div",
|
|
42
54
|
{
|
|
43
|
-
className:
|
|
55
|
+
className: t(
|
|
44
56
|
"relative",
|
|
45
57
|
"grid",
|
|
46
58
|
"size-fit",
|
|
@@ -53,22 +65,22 @@ const u = ({
|
|
|
53
65
|
"bg-primary": !e
|
|
54
66
|
}
|
|
55
67
|
),
|
|
56
|
-
children:
|
|
57
|
-
|
|
68
|
+
children: s ? /* @__PURE__ */ r(
|
|
69
|
+
f,
|
|
58
70
|
{
|
|
59
|
-
name:
|
|
60
|
-
size:
|
|
71
|
+
name: s,
|
|
72
|
+
size: u.SM
|
|
61
73
|
}
|
|
62
74
|
) : null
|
|
63
75
|
}
|
|
64
76
|
),
|
|
65
77
|
/* @__PURE__ */ o("div", { className: "flex flex-col", children: [
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */ r("div", { className: "text-xs font-normal text-secondary-alt-400", children:
|
|
78
|
+
i,
|
|
79
|
+
/* @__PURE__ */ r("div", { className: "text-xs font-normal text-secondary-alt-400", children: n })
|
|
68
80
|
] })
|
|
69
81
|
] })
|
|
70
82
|
] });
|
|
71
83
|
export {
|
|
72
|
-
|
|
84
|
+
w as UiRadioFancy
|
|
73
85
|
};
|
|
74
86
|
//# sourceMappingURL=UiRadioFancy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiRadioFancy.js","sources":["../../../src/components/UiRadioFancy/UiRadioFancy.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport { UiIcon } from \"../UiIcon\";\nimport { ESize } from \"../../_types/sizing\";\nimport { type IconProp } from \"@fortawesome/fontawesome-svg-core\";\n\
|
|
1
|
+
{"version":3,"file":"UiRadioFancy.js","sources":["../../../src/components/UiRadioFancy/UiRadioFancy.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport { UiIcon } from \"../UiIcon\";\nimport { ESize } from \"../../_types/sizing\";\nimport { type IconProp } from \"@fortawesome/fontawesome-svg-core\";\nimport { ERadioTypes } from \"./_types\";\n\nexport type TUiRadioFancy = {\n\tchildren: React.ReactNode\n\ticon?: IconProp\n\tdisabled?: boolean;\n\tactive?: boolean;\n\tsubHeader?: string;\n\tclassName?: string;\n\tradioType?: ERadioTypes;\n\tvalue: string;\n\tonChange: (value: string) => void;\n\n}& Omit<React.InputHTMLAttributes<HTMLInputElement>, \"onChange\" | \"checked\" | \"value\" | \"name\">;\n\nconst typeClasses = {\n\t[ERadioTypes.DEFAULT]: \"items-center\",\n\t[ERadioTypes.COMPACT]: \"items-start flex-col\"\n};\n\nexport const UiRadioFancy: React.FC<TUiRadioFancy> = ({\n\tchildren,\n\ticon,\n\tdisabled,\n\tsubHeader,\n\tactive,\n\tradioType = ERadioTypes.DEFAULT,\n\tvalue,\n\tonChange,\n\tclassName\n\n}) => {\n\treturn (\n\t\t<label className={ cx(\n\t\t\t\"ui-radio-fancy\",\n\t\t\t\"relative\",\n\t\t\t{\n\t\t\t\t\"pointer-events-none\": disabled\n\t\t\t},\n\t\t\tclassName\n\t\t) }>\n\t\t\t<input className=\"group peer absolute appearance-none\" type=\"radio\" checked={ active } onChange={ ()=> onChange(value) }/>\n\n\t\t\t<div className={ cx(\n\t\t\t\t\"box-border\",\n\t\t\t\t\"cursor-pointer\",\n\t\t\t\t\"rounded-lg\",\n\t\t\t\t\"border\",\n\t\t\t\t\"bg-white\",\n\t\t\t\t\"p-sm\",\n\t\t\t\t\"hover:border-secondary-alt-700\",\n\t\t\t\t\"peer-focus:outline \",\n\t\t\t\t\"peer-focus:outline-4\",\n\t\t\t\t\"peer-focus:outline-primary-300\",\n\t\t\t\t\"peer-checked:shadow-border-primary-600\",\n\t\t\t\t\"peer-checked:border-0\",\n\t\t\t\t\"active:peer-checked:bg-secondary-alt-200\",\n\t\t\t\t\"hover:peer-checked:shadow-border-primary-700\",\n\t\t\t\t\"flex\",\n\t\t\t\t\"gap-sm\",\n\t\t\t\t\"text-sm\",\n\t\t\t\tactive\n\t\t\t\t\t? \"peer-focus:outline-offset-2\"\n\t\t\t\t\t: \"peer-focus:outline-offset-0\",\n\t\t\t\tdisabled\n\t\t\t\t\t? \"border-secondary-alt-400 text-secondary-alt-500 peer-checked:shadow-border-primary-disabled\"\n\t\t\t\t\t: \"border-secondary-alt-600\",\n\n\t\t\t\ttypeClasses[radioType],\n\n\t\t\t) }>\n\t\t\t\t<div className={ cx(\n\t\t\t\t\t\"relative\",\n\t\t\t\t\t\"grid\",\n\t\t\t\t\t\"size-fit\",\n\t\t\t\t\t\"rounded-full\",\n\t\t\t\t\t\"place-items-center\",\n\t\t\t\t\t\"text-white\",\n\t\t\t\t\t\"p-xxs\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\"bg-primary-300\": disabled,\n\t\t\t\t\t\t\"bg-primary\": !disabled\n\t\t\t\t\t}\n\n\t\t\t\t) }\n\t\t\t\t>\n\n\t\t\t\t\t{\n\t\t\t\t\t\ticon\n\t\t\t\t\t\t\t? <UiIcon\n\t\t\t\t\t\t\t\tname={ icon }\n\t\t\t\t\t\t\t\tsize={ ESize.SM }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t: null\n\t\t\t\t\t}\n\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex flex-col\">\n\t\t\t\t\t{ children }\n\t\t\t\t\t<div className=\"text-xs font-normal text-secondary-alt-400\">{ subHeader }</div>\n\t\t\t\t</div>\n\n\t\t\t</div>\n\n\t\t</label>\n\n\t);\n};\n"],"names":["typeClasses","ERadioTypes","UiRadioFancy","children","icon","disabled","subHeader","active","radioType","value","onChange","className","jsxs","cx","jsx","UiIcon","ESize"],"mappings":";;;;;;;AAoBA,MAAMA,IAAc;AAAA,EACnB,CAACC,EAAY,OAAO,GAAG;AAAA,EACvB,CAACA,EAAY,OAAO,GAAG;AACxB,GAEaC,IAAwC,CAAC;AAAA,EACrD,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC,IAAYP,EAAY;AAAA,EACxB,OAAAQ;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAED,MAEE,gBAAAC,EAAC,WAAM,WAAYC;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,IACC,uBAAuBR;AAAA,EACxB;AAAA,EACAM;AAEA,GAAA,UAAA;AAAA,EAAC,gBAAAG,EAAA,SAAA,EAAM,WAAU,uCAAsC,MAAK,SAAQ,SAAUP,GAAS,UAAW,MAAKG,EAASD,CAAK,EAAG,CAAA;AAAA,EAExH,gBAAAG,EAAC,SAAI,WAAYC;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAN,IACG,gCACA;AAAA,IACHF,IACG,gGACA;AAAA,IAEHL,EAAYQ,CAAS;AAAA,EAGrB,GAAA,UAAA;AAAA,IAAA,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QAAI,WAAYD;AAAA,UAChB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,YACC,kBAAkBR;AAAA,YAClB,cAAc,CAACA;AAAA,UAAA;AAAA,QAGjB;AAAA,QAIE,UACGD,IAAA,gBAAAU;AAAA,UAACC;AAAA,UAAA;AAAA,YACF,MAAOX;AAAA,YACP,MAAOY,EAAM;AAAA,UAAA;AAAA,QAAA,IAEZ;AAAA,MAAA;AAAA,IAGL;AAAA,IAEA,gBAAAJ,EAAC,OAAI,EAAA,WAAU,iBACZ,UAAA;AAAA,MAAAT;AAAA,MACD,gBAAAW,EAAA,OAAA,EAAI,WAAU,8CAA+C,UAAWR,EAAA,CAAA;AAAA,IAAA,EAC1E,CAAA;AAAA,EAAA,EAED,CAAA;AAAA,GAED;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t = /* @__PURE__ */ ((r) => (r.DEFAULT = "default", r.COMPACT = "compact", r))(t || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
t as ERadioTypes
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=_types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.js","sources":["../../../src/components/UiRadioFancy/_types.ts"],"sourcesContent":["export enum ERadioTypes {\n\
|
|
1
|
+
{"version":3,"file":"_types.js","sources":["../../../src/components/UiRadioFancy/_types.ts"],"sourcesContent":["export enum ERadioTypes {\n\tDEFAULT = \"default\",\n\tCOMPACT = \"compact\"\n}\n"],"names":["ERadioTypes"],"mappings":"AAAY,IAAAA,sBAAAA,OACXA,EAAA,UAAU,WACVA,EAAA,UAAU,WAFCA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -6,6 +6,7 @@ type TSelectProps = {
|
|
|
6
6
|
value?: string | number | readonly string[];
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
postfixIcon?: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
9
10
|
onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
10
11
|
} & React.SelectHTMLAttributes<HTMLSelectElement>;
|
|
11
12
|
export declare const UiSelect: React.FC<TSelectProps>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import d from "react";
|
|
3
|
+
import b from "classnames";
|
|
4
|
+
import { UiTypography as m } from "../UiTypography/UiTypography.js";
|
|
5
|
+
import { ETypographySizes as u } from "../UiTypography/_types.js";
|
|
6
|
+
import { EColors as f } from "../../_types/colors.js";
|
|
7
|
+
import '../../assets/UiSelect.css';const S = "_UiSelect_1fbno_1", w = {
|
|
8
|
+
UiSelect: S
|
|
9
|
+
}, z = ({
|
|
10
|
+
children: p,
|
|
11
|
+
heading: o,
|
|
12
|
+
subLabel: n,
|
|
13
|
+
disabled: s,
|
|
14
|
+
onChange: r,
|
|
15
|
+
className: h,
|
|
16
|
+
placeholder: a,
|
|
17
|
+
postfixIcon: i,
|
|
18
|
+
...l
|
|
19
|
+
}) => {
|
|
20
|
+
const [v, x] = d.useState(l.value || l.defaultValue || ""), y = d.useCallback(
|
|
21
|
+
(c) => {
|
|
22
|
+
x(c.target.value), r == null || r(c);
|
|
23
|
+
},
|
|
24
|
+
[r]
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ t("div", { className: h, children: [
|
|
27
|
+
o ? /* @__PURE__ */ e(
|
|
28
|
+
m,
|
|
29
|
+
{
|
|
30
|
+
size: u.MD,
|
|
31
|
+
className: "mb-xxs",
|
|
32
|
+
children: o
|
|
33
|
+
}
|
|
34
|
+
) : null,
|
|
35
|
+
/* @__PURE__ */ t("div", { className: b(
|
|
36
|
+
w.UiSelect,
|
|
37
|
+
"relative",
|
|
38
|
+
"rounded-xl",
|
|
39
|
+
"border",
|
|
40
|
+
"hover:border-secondary-alt-700",
|
|
41
|
+
s ? ["pointer-events-none", "border-secondary-alt-300", "bg-secondary-alt-200"] : ["border-secondary-alt-500", "bg-white"]
|
|
42
|
+
), children: [
|
|
43
|
+
/* @__PURE__ */ t(
|
|
44
|
+
"select",
|
|
45
|
+
{
|
|
46
|
+
...l,
|
|
47
|
+
className: `m-0
|
|
48
|
+
w-full
|
|
49
|
+
cursor-pointer
|
|
50
|
+
appearance-none
|
|
51
|
+
border-0
|
|
52
|
+
bg-transparent
|
|
53
|
+
p-sm
|
|
54
|
+
italic
|
|
55
|
+
text-secondary-alt
|
|
56
|
+
outline-0
|
|
57
|
+
`,
|
|
58
|
+
disabled: s,
|
|
59
|
+
value: v,
|
|
60
|
+
onChange: y,
|
|
61
|
+
children: [
|
|
62
|
+
a ? /* @__PURE__ */ e("option", { value: "", disabled: !0, hidden: !0, children: a }) : null,
|
|
63
|
+
p
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ e("div", { className: "absolute right-sm top-1/2 -translate-y-1/2", children: i || /* @__PURE__ */ e(
|
|
68
|
+
"svg",
|
|
69
|
+
{
|
|
70
|
+
width: "16",
|
|
71
|
+
height: "16",
|
|
72
|
+
viewBox: "0 0 16 16",
|
|
73
|
+
fill: "none",
|
|
74
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
75
|
+
children: /* @__PURE__ */ e(
|
|
76
|
+
"path",
|
|
77
|
+
{
|
|
78
|
+
d: "M13.25 6.8125L8.5 11.2812C8.34375 11.4375 8.15625 11.5 8 11.5C7.8125 11.5 7.625 11.4375 7.46875 11.3125L2.71875 6.8125C2.40625 6.53125 2.40625 6.0625 2.6875 5.75C2.96875 5.4375 3.4375 5.4375 3.75 5.71875L8 9.71875L12.2188 5.71875C12.5312 5.4375 13 5.4375 13.2812 5.75C13.5625 6.0625 13.5625 6.53125 13.25 6.8125Z",
|
|
79
|
+
fill: "currentColor"
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
) })
|
|
84
|
+
] }),
|
|
85
|
+
n ? /* @__PURE__ */ e(
|
|
86
|
+
m,
|
|
87
|
+
{
|
|
88
|
+
size: u.SM,
|
|
89
|
+
color: f.SECONDARY_ALT,
|
|
90
|
+
className: "mt-xxs",
|
|
91
|
+
children: n
|
|
92
|
+
}
|
|
93
|
+
) : null
|
|
94
|
+
] });
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
z as UiSelect
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=UiSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UiSelect.js","sources":["../../../src/components/UiSelect/UiSelect.tsx"],"sourcesContent":["import React from \"react\";\nimport cx from \"classnames\";\nimport { UiTypography, ETypographySizes, EColors } from \"../UiTypography\";\nimport styles from \"./UiSelect.module.css\";\n\ntype TSelectProps = {\n\theading?: string\n\tsubLabel?: string;\n\tdisabled?: boolean;\n\tvalue?: string | number | readonly string[];\n\tplaceholder?: string;\n\tpostfixIcon?: React.ReactNode;\n\tclassName?: string;\n\tonChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void;\n} & React.SelectHTMLAttributes<HTMLSelectElement>\n\nexport const UiSelect: React.FC<TSelectProps> = ({\n\tchildren,\n\theading,\n\tsubLabel,\n\tdisabled,\n\tonChange,\n\tclassName,\n\tplaceholder,\n\tpostfixIcon,\n\t...rest\n}) => {\n\tconst [value, setValue] = React.useState(rest.value || rest.defaultValue || \"\");\n\tconst handleChange = React.useCallback(\n\t\t(event: React.ChangeEvent<HTMLSelectElement>) => {\n\t\t\tsetValue(event.target.value);\n\t\t\tonChange?.(event);\n\t\t},\n\t\t[onChange],\n\t);\n\treturn (\n\t\t<div className={ className }>\n\t\t\t{ heading\n\t\t\t\t? <UiTypography\n\t\t\t\t\tsize={ ETypographySizes.MD }\n\t\t\t\t\tclassName=\"mb-xxs\">\n\t\t\t\t\t{ heading }\n\t\t\t\t</UiTypography>\n\t\t\t\t: null\n\t\t\t}\n\t\t\t<div className={ cx(styles.UiSelect, \"relative\",\n\t\t\t\t\"rounded-xl\",\n\t\t\t\t\"border\",\n\t\t\t\t\"hover:border-secondary-alt-700\",\n\t\t\t\tdisabled\n\t\t\t\t\t? [\"pointer-events-none\", \"border-secondary-alt-300\", \"bg-secondary-alt-200\"]\n\t\t\t\t\t: [\"border-secondary-alt-500\", \"bg-white\"]\n\t\t\t) }>\n\t\t\t\t<select\n\t\t\t\t\t{ ...rest }\n\t\t\t\t\tclassName=\"m-0\n\t\t\t\t\tw-full\n\t\t\t\t\tcursor-pointer\n\t\t\t\t\tappearance-none\n\t\t\t\t\tborder-0\n\t\t\t\t\tbg-transparent\n\t\t\t\t\tp-sm\n\t\t\t\t\titalic\n\t\t\t\t\ttext-secondary-alt\n\t\t\t\t\toutline-0\n\t\t\t\t\t\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t>\n\t\t\t\t\t{ placeholder ? <option value={ \"\" } disabled hidden>{ placeholder }</option> : null }\n\t\t\t\t\t{ children }\n\t\t\t\t</select>\n\t\t\t\t<div className=\"absolute right-sm top-1/2 -translate-y-1/2\">\n\t\t\t\t\t{ postfixIcon\n\t\t\t\t\t\t? postfixIcon\n\t\t\t\t\t\t: (<svg\n\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\td=\"M13.25 6.8125L8.5 11.2812C8.34375 11.4375 8.15625 11.5 8 11.5C7.8125 11.5 7.625 11.4375 7.46875 11.3125L2.71875 6.8125C2.40625 6.53125 2.40625 6.0625 2.6875 5.75C2.96875 5.4375 3.4375 5.4375 3.75 5.71875L8 9.71875L12.2188 5.71875C12.5312 5.4375 13 5.4375 13.2812 5.75C13.5625 6.0625 13.5625 6.53125 13.25 6.8125Z\"\n\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</svg>)\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ subLabel\n\t\t\t\t? (<UiTypography\n\t\t\t\t\tsize={ ETypographySizes.SM }\n\t\t\t\t\tcolor={ EColors.SECONDARY_ALT }\n\t\t\t\t\tclassName=\"mt-xxs\"\n\t\t\t\t>\n\t\t\t\t\t{ subLabel }\n\t\t\t\t</UiTypography>)\n\t\t\t\t: null\n\t\t\t}\n\t\t</div>\n\t);\n};\n"],"names":["UiSelect","children","heading","subLabel","disabled","onChange","className","placeholder","postfixIcon","rest","value","setValue","React","handleChange","event","jsxs","jsx","UiTypography","ETypographySizes","cx","styles","EColors"],"mappings":";;;;;;;;GAgBaA,IAAmC,CAAC;AAAA,EAChD,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACC,QAAA,CAACC,GAAOC,CAAQ,IAAIC,EAAM,SAASH,EAAK,SAASA,EAAK,gBAAgB,EAAE,GACxEI,IAAeD,EAAM;AAAA,IAC1B,CAACE,MAAgD;AACvC,MAAAH,EAAAG,EAAM,OAAO,KAAK,GAC3BT,KAAA,QAAAA,EAAWS;AAAA,IACZ;AAAA,IACA,CAACT,CAAQ;AAAA,EACV;AAEC,SAAA,gBAAAU,EAAC,SAAI,WAAAT,GACF,UAAA;AAAA,IACCJ,IAAA,gBAAAc;AAAA,MAACC;AAAA,MAAA;AAAA,QACF,MAAOC,EAAiB;AAAA,QACxB,WAAU;AAAA,QACR,UAAAhB;AAAA,MAAA;AAAA,IAAA,IAED;AAAA,IAEH,gBAAAa,EAAC,SAAI,WAAYI;AAAA,MAAGC,EAAO;AAAA,MAAU;AAAA,MACpC;AAAA,MACA;AAAA,MACA;AAAA,MACAhB,IACG,CAAC,uBAAuB,4BAA4B,sBAAsB,IAC1E,CAAC,4BAA4B,UAAU;AAAA,IAE1C,GAAA,UAAA;AAAA,MAAA,gBAAAW;AAAA,QAAC;AAAA,QAAA;AAAA,UACE,GAAGN;AAAA,UACL,WAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAWV,UAAAL;AAAA,UACA,OAAAM;AAAA,UACA,UAAWG;AAAA,UAET,UAAA;AAAA,YAAcN,IAAA,gBAAAS,EAAC,YAAO,OAAQ,IAAK,UAAQ,IAAC,QAAM,IAAG,UAAAT,EAAA,CAAa,IAAY;AAAA,YAC9EN;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,MACC,gBAAAe,EAAA,OAAA,EAAI,WAAU,8CACZ,eAEE,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACH,OAAM;AAAA,UACN,QAAO;AAAA,UACP,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAM;AAAA,UAEN,UAAA,gBAAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,GAAE;AAAA,cACF,MAAK;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MAAA,EAGH,CAAA;AAAA,IAAA,GACD;AAAA,IACEb,IACE,gBAAAa;AAAA,MAACC;AAAA,MAAA;AAAA,QACH,MAAOC,EAAiB;AAAA,QACxB,OAAQG,EAAQ;AAAA,QAChB,WAAU;AAAA,QAER,UAAAlB;AAAA,MAAA;AAAA,IAAA,IAED;AAAA,EAAA,GAEJ;AAEF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|