@fangzsx/component-library 0.0.10 → 0.0.12

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 (38) hide show
  1. package/dist/Box-DPlM16yK.js +30 -0
  2. package/dist/ButtonBase-qMhxbNdC.js +878 -0
  3. package/dist/FormLabel-DKoCtSGZ.js +600 -0
  4. package/dist/{Paper-CAUsv8qs.js → Paper-DyRh03We.js} +54 -51
  5. package/dist/SwitchBase-DStPyUhD.js +311 -0
  6. package/dist/Typography-B0rSrz7H.js +253 -0
  7. package/dist/components/AppBarPublic/index.js +83 -105
  8. package/dist/components/Button/index.js +1 -1
  9. package/dist/components/Checkbox/index.js +103 -607
  10. package/dist/components/CheckboxGroup/index.d.ts +17 -0
  11. package/dist/components/CheckboxGroup/index.js +68 -0
  12. package/dist/components/Dropdown/index.d.ts +22 -0
  13. package/dist/components/Dropdown/index.js +120 -0
  14. package/dist/components/FlatBanner/index.d.ts +1 -0
  15. package/dist/components/FlatBanner/index.js +21 -17
  16. package/dist/components/LinearProgress/index.d.ts +3 -0
  17. package/dist/components/LinearProgress/index.js +19 -0
  18. package/dist/components/MediaCardWithAction/index.d.ts +2 -1
  19. package/dist/components/MediaCardWithAction/index.js +167 -445
  20. package/dist/components/RadioButtonGroup/index.d.ts +17 -0
  21. package/dist/components/RadioButtonGroup/index.js +836 -0
  22. package/dist/components/TextFieldInput/index.d.ts +15 -0
  23. package/dist/components/TextFieldInput/index.js +6578 -0
  24. package/dist/{createSvgIcon-DAI5icic.js → createSvgIcon-Dj0SJuc1.js} +8 -7
  25. package/dist/generateUtilityClasses-BCID9NF1.js +2806 -0
  26. package/dist/{index-DGepNtNg.js → index-CoBGCD2e.js} +143 -158
  27. package/dist/index-o1i1vy-V.js +73 -0
  28. package/dist/main.d.ts +4 -1
  29. package/dist/main.js +17 -11
  30. package/dist/mergeSlotProps-C-n2ing7.js +62 -0
  31. package/dist/useId-CK6Kn3Tn.js +21 -0
  32. package/dist/useSlot-S2pEBHE8.js +161 -0
  33. package/dist/useTimeout-BWi4JTOH.js +635 -0
  34. package/package.json +1 -1
  35. package/dist/ButtonBase-CAtBagnK.js +0 -4293
  36. package/dist/assets/index2.css +0 -1
  37. package/dist/components/Input/index.d.ts +0 -1
  38. package/dist/components/Input/index.js +0 -11
@@ -0,0 +1,17 @@
1
+ export interface CheckboxOption {
2
+ name: string;
3
+ label: string;
4
+ defaultChecked?: boolean;
5
+ }
6
+ export interface CheckboxGroupProps {
7
+ label: string;
8
+ options: CheckboxOption[];
9
+ required?: boolean;
10
+ minChecked?: number;
11
+ maxChecked?: number;
12
+ errorMessage?: string;
13
+ helperText?: string;
14
+ onChange?: (checkedValues: string[]) => void;
15
+ sx?: any;
16
+ }
17
+ export declare function CheckboxGroup({ options, required, minChecked, maxChecked, errorMessage, helperText, onChange, sx, }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,68 @@
1
+ import { jsxs as I, jsx as l } from "react/jsx-runtime";
2
+ import { FormControl as E, FormGroup as G, FormControlLabel as L, Checkbox as O, FormHelperText as i } from "@mui/material";
3
+ import { useState as m } from "react";
4
+ function w({
5
+ options: a,
6
+ required: h = !1,
7
+ minChecked: t,
8
+ maxChecked: r,
9
+ errorMessage: c,
10
+ helperText: u,
11
+ onChange: f,
12
+ sx: b
13
+ }) {
14
+ const [n, p] = m(
15
+ a.reduce((e, o) => ({
16
+ ...e,
17
+ [o.name]: o.defaultChecked || !1
18
+ }), {})
19
+ ), [g, v] = m(!1), F = (e) => {
20
+ v(!0);
21
+ const o = {
22
+ ...n,
23
+ [e.target.name]: e.target.checked
24
+ };
25
+ p(o);
26
+ const $ = Object.keys(o).filter(
27
+ (x) => o[x]
28
+ );
29
+ f && f($);
30
+ }, s = Object.values(n).filter(Boolean).length, d = g && (t !== void 0 && s < t || r !== void 0 && s > r), j = () => c || (t !== void 0 && s < t ? `Please select at least ${t} option${t > 1 ? "s" : ""}` : r !== void 0 && s > r ? `Please select no more than ${r} option${r > 1 ? "s" : ""}` : "");
31
+ return /* @__PURE__ */ I(
32
+ E,
33
+ {
34
+ required: h,
35
+ error: d,
36
+ component: "fieldset",
37
+ sx: { m: 3, ...b },
38
+ variant: "standard",
39
+ children: [
40
+ /* @__PURE__ */ l(G, { children: a.map((e) => /* @__PURE__ */ l(
41
+ L,
42
+ {
43
+ sx: {
44
+ color: "#404A58",
45
+ "& .MuiFormControlLabel-label": {
46
+ fontSize: "16px"
47
+ }
48
+ },
49
+ control: /* @__PURE__ */ l(
50
+ O,
51
+ {
52
+ checked: n[e.name] || !1,
53
+ onChange: F,
54
+ name: e.name
55
+ }
56
+ ),
57
+ label: e.label
58
+ },
59
+ e.name
60
+ )) }),
61
+ d ? /* @__PURE__ */ l(i, { children: j() }) : u ? /* @__PURE__ */ l(i, { children: u }) : null
62
+ ]
63
+ }
64
+ );
65
+ }
66
+ export {
67
+ w as CheckboxGroup
68
+ };
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface DropdownItem {
4
+ id: string;
5
+ label: string;
6
+ disabled?: boolean;
7
+ icon?: ReactNode;
8
+ description?: string;
9
+ customContent?: ReactNode;
10
+ activeIcon?: ReactNode;
11
+ }
12
+ interface DropdownProps {
13
+ items: DropdownItem[];
14
+ activeItemId?: string;
15
+ onItemSelect?: (item: DropdownItem) => void;
16
+ buttonIcon?: ReactNode;
17
+ buttonSx?: object;
18
+ menuMinWidth?: number;
19
+ renderCustomItem?: (item: DropdownItem, isActive: boolean) => ReactNode;
20
+ }
21
+ export declare function Dropdown({ items, activeItemId, onItemSelect, buttonIcon, buttonSx, menuMinWidth, renderCustomItem }: DropdownProps): import("react/jsx-runtime").JSX.Element;
22
+ export {};
@@ -0,0 +1,120 @@
1
+ import { jsxs as d, jsx as r, Fragment as y } from "react/jsx-runtime";
2
+ import { ExpandMoreOutlined as C } from "@mui/icons-material";
3
+ import { Box as I, IconButton as v, Menu as M, MenuItem as k, ListItemIcon as w, ListItemText as j } from "@mui/material";
4
+ import { useState as B } from "react";
5
+ import { c as t } from "../../colors-BYtTt7gN.js";
6
+ function L({
7
+ items: h,
8
+ activeItemId: e,
9
+ onItemSelect: p,
10
+ buttonIcon: u,
11
+ buttonSx: f = {},
12
+ menuMinWidth: g = 200,
13
+ renderCustomItem: c
14
+ }) {
15
+ const [i, s] = B(null), l = !!i, x = (o) => {
16
+ s(o.currentTarget);
17
+ }, a = () => {
18
+ s(null);
19
+ }, m = (o) => {
20
+ o.disabled || (p?.(o), a());
21
+ }, b = (o) => {
22
+ const n = e === o.id;
23
+ return c ? c(o, n) : o.customContent ? o.customContent : /* @__PURE__ */ d(y, { children: [
24
+ (o.icon || n && o.activeIcon) && /* @__PURE__ */ r(w, { sx: { minWidth: 36 }, children: n && o.activeIcon ? o.activeIcon : o.icon }),
25
+ /* @__PURE__ */ r(
26
+ j,
27
+ {
28
+ primary: o.label,
29
+ secondary: o.description,
30
+ slotProps: {
31
+ secondary: {
32
+ variant: "caption",
33
+ sx: { color: t.grey600 }
34
+ }
35
+ }
36
+ }
37
+ )
38
+ ] });
39
+ };
40
+ return /* @__PURE__ */ d(
41
+ I,
42
+ {
43
+ sx: {
44
+ display: "flex",
45
+ flexDirection: "column",
46
+ alignItems: "center",
47
+ justifyContent: "center",
48
+ bgcolor: "#f5f5f5",
49
+ borderRadius: "10px"
50
+ },
51
+ children: [
52
+ /* @__PURE__ */ r(
53
+ v,
54
+ {
55
+ onClick: x,
56
+ sx: {
57
+ width: "100%",
58
+ height: "100%",
59
+ padding: 0,
60
+ color: "white",
61
+ bgcolor: "white",
62
+ borderRadius: "10px",
63
+ "&:hover": {
64
+ bgcolor: t.grey50
65
+ },
66
+ ...f
67
+ },
68
+ children: u || /* @__PURE__ */ r(
69
+ C,
70
+ {
71
+ sx: {
72
+ transform: l ? "rotate(180deg)" : "rotate(0deg)",
73
+ transition: "transform 0.2s ease",
74
+ color: t.grey600
75
+ }
76
+ }
77
+ )
78
+ }
79
+ ),
80
+ /* @__PURE__ */ r(
81
+ M,
82
+ {
83
+ anchorEl: i,
84
+ open: l,
85
+ onClose: a,
86
+ anchorOrigin: {
87
+ vertical: "bottom",
88
+ horizontal: "right"
89
+ },
90
+ transformOrigin: {
91
+ vertical: "top",
92
+ horizontal: "right"
93
+ },
94
+ slotProps: {
95
+ paper: {
96
+ sx: {
97
+ minWidth: g,
98
+ mt: 1
99
+ }
100
+ }
101
+ },
102
+ children: h.map((o) => /* @__PURE__ */ r(
103
+ k,
104
+ {
105
+ onClick: () => m(o),
106
+ selected: e === o.id,
107
+ disabled: o.disabled,
108
+ children: b(o)
109
+ },
110
+ o.id
111
+ ))
112
+ }
113
+ )
114
+ ]
115
+ }
116
+ );
117
+ }
118
+ export {
119
+ L as Dropdown
120
+ };
@@ -4,6 +4,7 @@ type BannerProps = {
4
4
  type: "warning" | "info" | "success" | "error";
5
5
  title: string;
6
6
  description: string | ReactNode;
7
+ withIcon: boolean;
7
8
  };
8
9
  export declare function FlatBanner(props: BannerProps): import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -1,32 +1,36 @@
1
- import { jsx as r, jsxs as a } from "react/jsx-runtime";
2
- import { Card as p, Box as t, Typography as i } from "@mui/material";
1
+ import { jsx as n, jsxs as i } from "react/jsx-runtime";
2
+ import { ErrorOutline as C, CheckCircle as f, InfoOutlineRounded as g, WarningAmberRounded as x } from "@mui/icons-material";
3
+ import { Card as m, Box as e, Typography as t } from "@mui/material";
3
4
  import { c as o } from "../../colors-BYtTt7gN.js";
4
- const d = {
5
- warning: { titleColor: o.warning800, bgColor: o.warning50 },
6
- info: { titleColor: o.primary800, bgColor: o.primary50 },
7
- success: { titleColor: o.secondary800, bgColor: o.secondary50 },
8
- error: { titleColor: o.destructive800, bgColor: o.destructive50 }
5
+ const b = {
6
+ warning: { titleColor: o.warning800, bgColor: o.warning50, icon: x, iconColor: "#f59e0b" },
7
+ info: { titleColor: o.primary800, bgColor: o.primary50, icon: g, iconColor: "#f59e0b" },
8
+ success: { titleColor: o.secondary800, bgColor: o.secondary50, icon: f, iconColor: "#10b981" },
9
+ error: { titleColor: o.destructive800, bgColor: o.destructive50, icon: C, iconColor: "#ef4444" }
9
10
  };
10
- function f(l) {
11
- const { type: n, title: c, description: s } = l, e = d[n];
12
- return /* @__PURE__ */ r(
13
- p,
11
+ function I(c) {
12
+ const { type: l, title: s, description: d, withIcon: a } = c, r = b[l], p = r.icon;
13
+ return /* @__PURE__ */ n(
14
+ m,
14
15
  {
15
16
  sx: {
16
17
  display: "flex",
17
- backgroundColor: e.bgColor,
18
+ backgroundColor: r.bgColor,
18
19
  borderRadius: "5px",
19
20
  py: 1.5,
20
21
  px: 2,
21
22
  boxShadow: 2
22
23
  },
23
- children: /* @__PURE__ */ r(t, { display: "flex", alignItems: "center", gap: 2, children: /* @__PURE__ */ a(t, { children: [
24
- /* @__PURE__ */ r(i, { sx: { fontWeight: 700, fontSize: 16, color: e.titleColor, mb: 0.5 }, children: c }),
25
- /* @__PURE__ */ r(i, { sx: { color: o.grey800, fontSize: "13px" }, children: s })
26
- ] }) })
24
+ children: /* @__PURE__ */ i(e, { display: "flex", alignItems: "center", justifyContent: "center", gap: 2, children: [
25
+ a && /* @__PURE__ */ n(p, { sx: { color: r.iconColor, fontSize: "24px", display: { xs: "none", md: "block" } } }),
26
+ /* @__PURE__ */ i(e, { children: [
27
+ /* @__PURE__ */ n(t, { sx: { fontWeight: 700, fontSize: 16, color: r.titleColor, mb: 0.5 }, children: s }),
28
+ /* @__PURE__ */ n(t, { sx: { color: o.grey800, fontSize: "13px" }, children: d })
29
+ ] })
30
+ ] })
27
31
  }
28
32
  );
29
33
  }
30
34
  export {
31
- f as FlatBanner
35
+ I as FlatBanner
32
36
  };
@@ -0,0 +1,3 @@
1
+ import { LinearProgressProps } from '@mui/material';
2
+
3
+ export declare function LinearProgress(props: LinearProgressProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { LinearProgress as n } from "@mui/material";
3
+ import { B as a } from "../../Box-DPlM16yK.js";
4
+ function c(o) {
5
+ const { sx: e, value: s = 0, color: i, ...t } = o;
6
+ return /* @__PURE__ */ r(a, { sx: { width: "100%", minWidth: "100px" }, children: /* @__PURE__ */ r(
7
+ n,
8
+ {
9
+ variant: "determinate",
10
+ color: i,
11
+ value: s,
12
+ ...t,
13
+ sx: { ...e }
14
+ }
15
+ ) });
16
+ }
17
+ export {
18
+ c as LinearProgress
19
+ };
@@ -5,6 +5,7 @@ interface MediaCardWithActionProps {
5
5
  description: string;
6
6
  buttonLabel: string;
7
7
  disabled?: boolean;
8
+ action: () => void;
8
9
  }
9
- export declare function MediaCardWithAction({ image, imageAlt, title, description, buttonLabel, disabled }: MediaCardWithActionProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function MediaCardWithAction({ image, imageAlt, title, description, buttonLabel, disabled, action, }: MediaCardWithActionProps): import("react/jsx-runtime").JSX.Element;
10
11
  export {};