@fangzsx/component-library 0.0.40 → 0.0.41

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.
@@ -0,0 +1,32 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface SectionAction {
4
+ /** Icon element to render */
5
+ icon: ReactNode;
6
+ /** Click handler */
7
+ onClick: () => void;
8
+ /** Accessible label for the button */
9
+ ariaLabel?: string;
10
+ /** Disable the action button */
11
+ disabled?: boolean;
12
+ }
13
+ export interface CollapsibleSectionProps {
14
+ title: string;
15
+ children?: ReactNode;
16
+ defaultExpanded?: boolean;
17
+ expanded?: boolean;
18
+ onChange?: (expanded: boolean) => void;
19
+ /** Optional icon displayed before the title */
20
+ icon?: ReactNode;
21
+ /** One or more action buttons rendered on the right side of the header */
22
+ actions?: SectionAction[];
23
+ disabled?: boolean;
24
+ sx?: object;
25
+ }
26
+ export interface LabelValueProps {
27
+ label: string;
28
+ children?: ReactNode;
29
+ gutterBottom?: boolean;
30
+ }
31
+ export declare function LabelValue({ label, children, gutterBottom }: LabelValueProps): import("react/jsx-runtime").JSX.Element;
32
+ export declare function CollapsibleSection({ title, children, defaultExpanded, expanded: controlledExpanded, onChange, icon, actions, disabled, sx, }: CollapsibleSectionProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,90 @@
1
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
+ import { useState as I } from "react";
3
+ import { Accordion as A, AccordionSummary as S, Box as d, Typography as s, IconButton as M, AccordionDetails as j } from "@mui/material";
4
+ import { c as k } from "../../createSvgIcon-C0YrvByi.js";
5
+ const w = k(/* @__PURE__ */ e("path", {
6
+ d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
7
+ }), "ExpandMore");
8
+ function L({ label: i, children: t, gutterBottom: a = !0 }) {
9
+ return /* @__PURE__ */ r(d, { sx: { mb: a ? 2.5 : 0 }, children: [
10
+ /* @__PURE__ */ e(s, { variant: "body2", fontWeight: 600, gutterBottom: !0, children: i }),
11
+ typeof t == "string" ? /* @__PURE__ */ e(s, { variant: "body2", color: "text.secondary", children: t }) : t
12
+ ] });
13
+ }
14
+ function W({
15
+ title: i,
16
+ children: t,
17
+ defaultExpanded: a = !1,
18
+ expanded: c,
19
+ onChange: f,
20
+ icon: x,
21
+ actions: l,
22
+ disabled: m = !1,
23
+ sx: u
24
+ }) {
25
+ const [b, g] = I(a), p = c !== void 0, h = p ? c : b;
26
+ function y(n, o) {
27
+ p || g(o), f?.(o);
28
+ }
29
+ function v(n, o) {
30
+ n.stopPropagation(), o.onClick();
31
+ }
32
+ return /* @__PURE__ */ r(
33
+ A,
34
+ {
35
+ expanded: h,
36
+ onChange: y,
37
+ disabled: m,
38
+ disableGutters: !0,
39
+ elevation: 0,
40
+ sx: {
41
+ border: "1px solid",
42
+ borderColor: "divider",
43
+ borderRadius: 2,
44
+ "&::before": { display: "none" },
45
+ overflow: "hidden",
46
+ ...u
47
+ },
48
+ children: [
49
+ /* @__PURE__ */ r(
50
+ S,
51
+ {
52
+ expandIcon: /* @__PURE__ */ e(w, {}),
53
+ sx: {
54
+ flexDirection: "row-reverse",
55
+ gap: 1,
56
+ "& .MuiAccordionSummary-content": {
57
+ display: "flex",
58
+ alignItems: "center",
59
+ justifyContent: "space-between",
60
+ my: 1
61
+ }
62
+ },
63
+ children: [
64
+ /* @__PURE__ */ r(d, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
65
+ x,
66
+ /* @__PURE__ */ e(s, { variant: "subtitle1", fontWeight: 500, children: i })
67
+ ] }),
68
+ l && l.length > 0 && /* @__PURE__ */ e(d, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: l.map((n, o) => /* @__PURE__ */ e(
69
+ M,
70
+ {
71
+ size: "small",
72
+ disabled: n.disabled,
73
+ onClick: (C) => v(C, n),
74
+ "aria-label": n.ariaLabel ?? `Action ${o + 1}`,
75
+ children: n.icon
76
+ },
77
+ o
78
+ )) })
79
+ ]
80
+ }
81
+ ),
82
+ /* @__PURE__ */ e(j, { sx: { pt: 0, px: 4, pb: 3 }, children: t })
83
+ ]
84
+ }
85
+ );
86
+ }
87
+ export {
88
+ W as CollapsibleSection,
89
+ L as LabelValue
90
+ };
package/dist/main.d.ts CHANGED
@@ -2,6 +2,7 @@ export { AppBarPublic } from './components/AppBarPublic';
2
2
  export { Banner } from './components/Banner';
3
3
  export { Button } from './components/Button';
4
4
  export { CheckBox } from './components/Checkbox';
5
+ export { CollapsibleSection } from './components/CollapsibleSection';
5
6
  export { ScrollableDialog as Dialog } from './components/Dialog';
6
7
  export { CheckboxGroup } from './components/CheckboxGroup';
7
8
  export { Dropdown } from './components/Dropdown';
package/dist/main.js CHANGED
@@ -2,39 +2,41 @@ import { AppBarPublic as e } from "./components/AppBarPublic/index.js";
2
2
  import { Banner as p } from "./components/Banner/index.js";
3
3
  import { B as m } from "./index-D9x5yU0s.js";
4
4
  import { CheckBox as a } from "./components/Checkbox/index.js";
5
+ import { CollapsibleSection as l } from "./components/CollapsibleSection/index.js";
5
6
  import { ScrollableDialog as d } from "./components/Dialog/index.js";
6
- import { CheckboxGroup as l } from "./components/CheckboxGroup/index.js";
7
- import { Dropdown as B } from "./components/Dropdown/index.js";
8
- import { DropdownOptions as s } from "./components/DropdownOptions/index.js";
9
- import { FlatBanner as D } from "./components/FlatBanner/index.js";
10
- import { ImageUpload as g } from "./components/ImageUpload/index.js";
11
- import { Label as P } from "./components/Label/index.js";
12
- import { LinearProgress as A } from "./components/LinearProgress/index.js";
13
- import { MediaCardWithAction as F } from "./components/MediaCardWithAction/index.js";
14
- import { PhoneAndCountryDropdown as I } from "./components/PhoneAndCountryDropdown/index.js";
15
- import { PromoCode as S } from "./components/PromoCode/index.js";
16
- import { RadioButtonGroup as y } from "./components/RadioButtonGroup/index.js";
17
- import { Stepper as O } from "./components/Stepper/index.js";
18
- import { Text as U } from "./components/Text/index.js";
19
- import { TextFieldInput as j } from "./components/TextFieldInput/index.js";
7
+ import { CheckboxGroup as B } from "./components/CheckboxGroup/index.js";
8
+ import { Dropdown as s } from "./components/Dropdown/index.js";
9
+ import { DropdownOptions as b } from "./components/DropdownOptions/index.js";
10
+ import { FlatBanner as g } from "./components/FlatBanner/index.js";
11
+ import { ImageUpload as P } from "./components/ImageUpload/index.js";
12
+ import { Label as A } from "./components/Label/index.js";
13
+ import { LinearProgress as k } from "./components/LinearProgress/index.js";
14
+ import { MediaCardWithAction as G } from "./components/MediaCardWithAction/index.js";
15
+ import { PhoneAndCountryDropdown as L } from "./components/PhoneAndCountryDropdown/index.js";
16
+ import { PromoCode as y } from "./components/PromoCode/index.js";
17
+ import { RadioButtonGroup as O } from "./components/RadioButtonGroup/index.js";
18
+ import { Stepper as U } from "./components/Stepper/index.js";
19
+ import { Text as j } from "./components/Text/index.js";
20
+ import { TextFieldInput as v } from "./components/TextFieldInput/index.js";
20
21
  export {
21
22
  e as AppBarPublic,
22
23
  p as Banner,
23
24
  m as Button,
24
25
  a as CheckBox,
25
- l as CheckboxGroup,
26
+ B as CheckboxGroup,
27
+ l as CollapsibleSection,
26
28
  d as Dialog,
27
- B as Dropdown,
28
- s as DropdownOptions,
29
- D as FlatBanner,
30
- g as ImageUpload,
31
- P as Label,
32
- A as LinearProgress,
33
- F as MediaCardWithAction,
34
- I as PhoneAndCountryDropdown,
35
- S as PromoCode,
36
- y as RadioButtonGroup,
37
- O as Stepper,
38
- U as Text,
39
- j as TextFieldInput
29
+ s as Dropdown,
30
+ b as DropdownOptions,
31
+ g as FlatBanner,
32
+ P as ImageUpload,
33
+ A as Label,
34
+ k as LinearProgress,
35
+ G as MediaCardWithAction,
36
+ L as PhoneAndCountryDropdown,
37
+ y as PromoCode,
38
+ O as RadioButtonGroup,
39
+ U as Stepper,
40
+ j as Text,
41
+ v as TextFieldInput
40
42
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fangzsx/component-library",
3
3
  "author": "Jay Gilbert Garzon",
4
4
  "private": false,
5
- "version": "0.0.40",
5
+ "version": "0.0.41",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",