@fangzsx/component-library 0.0.11 → 0.0.13

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 (35) 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/LinearProgress/index.d.ts +3 -0
  15. package/dist/components/LinearProgress/index.js +19 -0
  16. package/dist/components/MediaCardWithAction/index.js +157 -436
  17. package/dist/components/RadioButtonGroup/index.d.ts +17 -0
  18. package/dist/components/RadioButtonGroup/index.js +836 -0
  19. package/dist/components/TextFieldInput/index.d.ts +15 -0
  20. package/dist/components/TextFieldInput/index.js +6578 -0
  21. package/dist/{createSvgIcon-DAI5icic.js → createSvgIcon-Dj0SJuc1.js} +8 -7
  22. package/dist/generateUtilityClasses-BCID9NF1.js +2806 -0
  23. package/dist/{index-DGepNtNg.js → index-CoBGCD2e.js} +143 -158
  24. package/dist/index-o1i1vy-V.js +73 -0
  25. package/dist/main.d.ts +5 -1
  26. package/dist/main.js +21 -13
  27. package/dist/mergeSlotProps-C-n2ing7.js +62 -0
  28. package/dist/useId-CK6Kn3Tn.js +21 -0
  29. package/dist/useSlot-S2pEBHE8.js +161 -0
  30. package/dist/useTimeout-BWi4JTOH.js +635 -0
  31. package/package.json +1 -1
  32. package/dist/ButtonBase-CAtBagnK.js +0 -4293
  33. package/dist/assets/index2.css +0 -1
  34. package/dist/components/Input/index.d.ts +0 -1
  35. 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
+ };
@@ -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
+ };