@fangzsx/component-library 0.0.24 → 0.0.26

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,19 @@
1
+ const c = "#1D252D", n = "#566376", s = "#E6EAED", o = "#F4F7F9", r = "#053E72", t = "#27A4E8", E = "#C8EDFE", F = "#E6F6FF", e = "#055C56", y = "#E6FEEE", a = "#8E3007", i = "#FFF9F0", g = "#800711", p = "#FFECEB", d = {
2
+ grey800: c,
3
+ grey600: n,
4
+ grey100: s,
5
+ grey50: o,
6
+ primary800: r,
7
+ primary500: t,
8
+ primary100: E,
9
+ primary50: F,
10
+ secondary800: e,
11
+ secondary50: y,
12
+ warning800: a,
13
+ warning50: i,
14
+ destructive800: g,
15
+ destructive50: p
16
+ };
17
+ export {
18
+ d as c
19
+ };
@@ -3,7 +3,7 @@ import { c as E } from "../../createSvgIcon-C0YrvByi.js";
3
3
  import { Stack as w, Popper as $, ClickAwayListener as D, Paper as U } from "@mui/material";
4
4
  import * as C from "react";
5
5
  import { useState as Z } from "react";
6
- import { C as G, B as b } from "../../index-BPIwhwks.js";
6
+ import { C as G, B as b } from "../../index-CS-LWC7Z.js";
7
7
  import { g as V, a as A, c as l, P as r } from "../../generateUtilityClasses-BCID9NF1.js";
8
8
  import { u as H, s as B, c as T, a as h, m as v } from "../../DefaultPropsProvider-DVX_ssOt.js";
9
9
  import { c as I, a as F } from "../../useTimeout-DmOXPFt0.js";
@@ -1,7 +1,7 @@
1
1
  import { jsx as o, jsxs as i } from "react/jsx-runtime";
2
2
  import { ErrorOutline as d, CheckCircle as a, InfoOutlined as m, WarningAmber as h } from "@mui/icons-material";
3
3
  import { Card as g, Box as c, Typography as e } from "@mui/material";
4
- import { c as n } from "../../colors-BYtTt7gN.js";
4
+ import { c as n } from "../../colors-DvNGPCDl.js";
5
5
  const y = {
6
6
  warning: { icon: h, color: "#f59e0b" },
7
7
  info: { icon: m, color: n.primary500 },
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
- import "../../colors-BYtTt7gN.js";
3
- import { B as p } from "../../index-BPIwhwks.js";
2
+ import "../../colors-DvNGPCDl.js";
3
+ import { B as p } from "../../index-CS-LWC7Z.js";
4
4
  export {
5
5
  p as Button
6
6
  };
@@ -2,7 +2,7 @@ import { jsxs as d, jsx as r, Fragment as y } from "react/jsx-runtime";
2
2
  import { ExpandMoreOutlined as C } from "@mui/icons-material";
3
3
  import { Box as I, IconButton as v, Menu as M, MenuItem as k, ListItemIcon as w, ListItemText as j } from "@mui/material";
4
4
  import { useState as B } from "react";
5
- import { c as t } from "../../colors-BYtTt7gN.js";
5
+ import { c as t } from "../../colors-DvNGPCDl.js";
6
6
  function L({
7
7
  items: h,
8
8
  activeItemId: e,
@@ -1,7 +1,7 @@
1
1
  import { jsx as n, jsxs as i } from "react/jsx-runtime";
2
2
  import { ErrorOutline as C, CheckCircle as f, InfoOutlineRounded as g, WarningAmberRounded as x } from "@mui/icons-material";
3
3
  import { Card as m, Box as e, Typography as t } from "@mui/material";
4
- import { c as o } from "../../colors-BYtTt7gN.js";
4
+ import { c as o } from "../../colors-DvNGPCDl.js";
5
5
  const b = {
6
6
  warning: { titleColor: o.warning800, bgColor: o.warning50, icon: x, iconColor: "#f59e0b" },
7
7
  info: { titleColor: o.primary800, bgColor: o.primary50, icon: g, iconColor: "#f59e0b" },
@@ -1,5 +1,5 @@
1
1
  import { jsx as d, jsxs as x } from "react/jsx-runtime";
2
- import { B as A } from "../../index-BPIwhwks.js";
2
+ import { B as A } from "../../index-CS-LWC7Z.js";
3
3
  import * as u from "react";
4
4
  import { g as m, a as f, P as e } from "../../generateUtilityClasses-BCID9NF1.js";
5
5
  import { u as C, s as g, c as y, a as b } from "../../DefaultPropsProvider-DVX_ssOt.js";
@@ -0,0 +1,24 @@
1
+ import { default as React } from 'react';
2
+
3
+ interface PromoCodeProps {
4
+ /** Current promo code value */
5
+ value: string;
6
+ /** Called when promo code input changes */
7
+ onChange: (value: string) => void;
8
+ /** Called when user submits the code */
9
+ onApply: () => void;
10
+ /** Called when user removes applied code */
11
+ onRemove: () => void;
12
+ /** Shows loader while validating */
13
+ isLoading?: boolean;
14
+ /** Whether a valid code is currently applied */
15
+ isApplied?: boolean;
16
+ /** e.g. "20% off" */
17
+ discountLabel?: string;
18
+ /** Error message to display (falsy = no error) */
19
+ errorMessage?: string;
20
+ /** Input placeholder text */
21
+ placeholder?: string;
22
+ }
23
+ declare const PromoCode: React.FC<PromoCodeProps>;
24
+ export default PromoCode;
@@ -0,0 +1,138 @@
1
+ import { jsxs as B, jsx as o } from "react/jsx-runtime";
2
+ import { Close as D, LocalOffer as I } from "@mui/icons-material";
3
+ import { Box as c, Chip as S, IconButton as A, Typography as h, TextField as R, InputAdornment as T, CircularProgress as W, Button as k } from "@mui/material";
4
+ import { useState as w, useRef as O, useEffect as P, useCallback as i } from "react";
5
+ import { c as r } from "../../colors-DvNGPCDl.js";
6
+ const M = ({
7
+ value: e,
8
+ onChange: m,
9
+ onApply: d,
10
+ onRemove: a,
11
+ isLoading: x = !1,
12
+ isApplied: y = !1,
13
+ discountLabel: f = "",
14
+ errorMessage: l = "",
15
+ placeholder: C = "Add promotional code"
16
+ }) => {
17
+ const [s, p] = w(!1), u = O(null);
18
+ P(() => {
19
+ s && u.current?.focus();
20
+ }, [s]);
21
+ const t = i(() => {
22
+ e?.trim() && d?.();
23
+ }, [e, d]), b = i(
24
+ (n) => {
25
+ n.key === "Enter" && t();
26
+ },
27
+ [t]
28
+ ), g = i(() => {
29
+ if (!e?.trim()) {
30
+ p(!1);
31
+ return;
32
+ }
33
+ t();
34
+ }, [e, t]), z = i(() => {
35
+ a?.(), p(!1);
36
+ }, [a]);
37
+ return y ? /* @__PURE__ */ B(c, { mt: 0.5, children: [
38
+ /* @__PURE__ */ o(
39
+ S,
40
+ {
41
+ icon: /* @__PURE__ */ o(I, { sx: { fontSize: 16 } }),
42
+ label: e,
43
+ onDelete: z,
44
+ deleteIcon: /* @__PURE__ */ o(A, { size: "small", sx: { p: 0.25 }, children: /* @__PURE__ */ o(D, { sx: { fontSize: 16 } }) }),
45
+ sx: {
46
+ bgcolor: r.primary50,
47
+ color: r.primary500,
48
+ fontWeight: 600,
49
+ fontSize: "0.875rem",
50
+ px: 1,
51
+ py: 2.5,
52
+ borderRadius: "5px",
53
+ "& .MuiChip-icon": { color: r.primary500 },
54
+ "& .MuiChip-deleteIcon": { color: r.primary500, ml: 1.5 },
55
+ "&:hover": { bgcolor: r.primary100 }
56
+ }
57
+ }
58
+ ),
59
+ f && /* @__PURE__ */ o(
60
+ h,
61
+ {
62
+ variant: "caption",
63
+ fontWeight: 500,
64
+ color: "text.secondary",
65
+ display: "block",
66
+ mt: 0.5,
67
+ children: f
68
+ }
69
+ )
70
+ ] }) : s ? /* @__PURE__ */ o(c, { mt: 2, children: /* @__PURE__ */ o(
71
+ R,
72
+ {
73
+ inputRef: u,
74
+ value: e ?? "",
75
+ placeholder: C,
76
+ onChange: (n) => m?.(n.target.value),
77
+ onBlur: g,
78
+ onKeyDown: b,
79
+ error: !!l,
80
+ helperText: l || void 0,
81
+ size: "small",
82
+ fullWidth: !0,
83
+ FormHelperTextProps: { sx: { fontSize: "0.625rem", ml: 0 } },
84
+ InputProps: {
85
+ endAdornment: /* @__PURE__ */ o(T, { position: "end", children: x ? /* @__PURE__ */ o(W, { size: 20 }) : e?.trim() && !l && /* @__PURE__ */ o(
86
+ h,
87
+ {
88
+ component: "span",
89
+ fontWeight: 700,
90
+ color: "primary",
91
+ sx: { cursor: "pointer", fontSize: "0.875rem", color: r.primary500 },
92
+ onMouseDown: (n) => {
93
+ n.preventDefault(), t();
94
+ },
95
+ children: "Apply"
96
+ }
97
+ ) }),
98
+ sx: {
99
+ borderRadius: "5px",
100
+ height: 40,
101
+ bgcolor: "white",
102
+ borderColor: "#C4CBD4"
103
+ }
104
+ },
105
+ sx: {
106
+ "& .MuiOutlinedInput-root": {
107
+ "& fieldset": { borderColor: "#C4CBD4" }
108
+ }
109
+ }
110
+ }
111
+ ) }) : /* @__PURE__ */ o(c, { mt: 2, mb: 2, children: /* @__PURE__ */ o(
112
+ k,
113
+ {
114
+ variant: "text",
115
+ onClick: () => {
116
+ m?.(""), p(!0);
117
+ },
118
+ sx: {
119
+ bgcolor: r.grey50,
120
+ color: r.grey600,
121
+ fontWeight: 600,
122
+ fontSize: "14px",
123
+ textTransform: "none",
124
+ borderRadius: "5px",
125
+ px: 1.5,
126
+ py: 1.25,
127
+ "&:hover": {
128
+ bgcolor: r.primary50,
129
+ color: r.primary500
130
+ }
131
+ },
132
+ children: "Add promo code"
133
+ }
134
+ ) });
135
+ };
136
+ export {
137
+ M as default
138
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as c, jsxs as U } from "react/jsx-runtime";
2
- import { c as P } from "./colors-BYtTt7gN.js";
2
+ import { c as P } from "./colors-DvNGPCDl.js";
3
3
  import * as k from "react";
4
4
  import { g as G, a as _, c as i, P as t } from "./generateUtilityClasses-BCID9NF1.js";
5
5
  import { u as A, s as f, c as R, a as H, m as O, b as so, r as lo } from "./DefaultPropsProvider-DVX_ssOt.js";
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AppBarPublic as e } from "./components/AppBarPublic/index.js";
2
2
  import { Banner as p } from "./components/Banner/index.js";
3
- import { B as f } from "./index-BPIwhwks.js";
3
+ import { B as f } from "./index-CS-LWC7Z.js";
4
4
  import { CheckBox as a } from "./components/Checkbox/index.js";
5
5
  import { ScrollableDialog as i } from "./components/Dialog/index.js";
6
6
  import { CheckboxGroup as B } from "./components/CheckboxGroup/index.js";
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.24",
5
+ "version": "0.0.26",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",
@@ -1,18 +0,0 @@
1
- const c = "#1D252D", n = "#566376", s = "#E6EAED", o = "#F4F7F9", t = "#053E72", r = "#27A4E8", E = "#E6F6FF", F = "#055C56", e = "#E6FEEE", y = "#8E3007", a = "#FFF9F0", i = "#800711", g = "#FFECEB", d = {
2
- grey800: c,
3
- grey600: n,
4
- grey100: s,
5
- grey50: o,
6
- primary800: t,
7
- primary500: r,
8
- primary50: E,
9
- secondary800: F,
10
- secondary50: e,
11
- warning800: y,
12
- warning50: a,
13
- destructive800: i,
14
- destructive50: g
15
- };
16
- export {
17
- d as c
18
- };