sea-react-components 1.3.7 → 1.3.9

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/components/expandable-text/index.d.ts +9 -0
  2. package/dist/components/expandable-text/index.d.ts.map +1 -0
  3. package/dist/components/expandable-text/index.js +33 -0
  4. package/dist/components/input/index.d.ts +2 -1
  5. package/dist/components/input/index.d.ts.map +1 -1
  6. package/dist/components/input/index.js +3 -3
  7. package/dist/components/select/index.d.ts +4 -1
  8. package/dist/components/select/index.d.ts.map +1 -1
  9. package/dist/components/select/index.js +14 -4
  10. package/dist/components/textarea/index.d.ts +2 -1
  11. package/dist/components/textarea/index.d.ts.map +1 -1
  12. package/dist/components/textarea/index.js +3 -3
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -0
  16. package/dist/middleware/firebase-token-handler/index.d.ts +7 -0
  17. package/dist/middleware/firebase-token-handler/index.d.ts.map +1 -0
  18. package/dist/middleware/firebase-token-handler/index.js +22 -0
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/dist/utils/firebase/index.d.ts +1 -0
  21. package/dist/utils/firebase/index.d.ts.map +1 -0
  22. package/dist/utils/firebase/index.js +0 -0
  23. package/dist/utils/firebase-client/config.d.ts +1 -0
  24. package/dist/utils/firebase-client/config.d.ts.map +1 -0
  25. package/dist/utils/firebase-client/config.js +0 -0
  26. package/dist/utils/firebase-client/firebase.d.ts +15 -0
  27. package/dist/utils/firebase-client/firebase.d.ts.map +1 -0
  28. package/dist/utils/firebase-client/firebase.js +55 -0
  29. package/dist/utils/firebase-client/index.d.ts +3 -0
  30. package/dist/utils/firebase-client/index.d.ts.map +1 -0
  31. package/dist/utils/firebase-client/index.js +2 -0
  32. package/dist/utils/firebase-client/types.d.ts +17 -0
  33. package/dist/utils/firebase-client/types.d.ts.map +1 -0
  34. package/dist/utils/firebase-client/types.js +1 -0
  35. package/package.json +2 -2
@@ -0,0 +1,9 @@
1
+ export type Props = {
2
+ text: string;
3
+ maxLines?: number;
4
+ className?: string;
5
+ showMoreText?: string;
6
+ showLessText?: string;
7
+ };
8
+ export default function ExpandableText({ text, maxLines, className, showMoreText, showLessText, }: Props): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/expandable-text/index.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,IAAI,EACJ,QAAY,EACZ,SAAS,EACT,YAA0B,EAC1B,YAA0B,GAC3B,EAAE,KAAK,2CAoDP"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState, useRef, useEffect } from "react";
4
+ import clsx from "clsx";
5
+ export default function ExpandableText({ text, maxLines = 2, className, showMoreText = "Show more", showLessText = "Show less", }) {
6
+ var _a;
7
+ const [expanded, setExpanded] = useState(false);
8
+ const [truncated, setTruncated] = useState(false);
9
+ const [collapsedHeight, setCollapsedHeight] = useState(0);
10
+ const textRef = useRef(null);
11
+ // Measure collapsed height (max lines)
12
+ useEffect(() => {
13
+ if (textRef.current) {
14
+ const lineHeight = parseFloat(getComputedStyle(textRef.current).lineHeight || "16");
15
+ setCollapsedHeight(lineHeight * maxLines);
16
+ if (textRef.current.scrollHeight > lineHeight * maxLines) {
17
+ setTruncated(true);
18
+ }
19
+ else {
20
+ setTruncated(false);
21
+ }
22
+ }
23
+ }, [text, maxLines]);
24
+ const toggleExpanded = () => {
25
+ setExpanded((prev) => !prev);
26
+ };
27
+ return (_jsxs("div", { className: clsx("relative", className), children: [_jsx("div", { ref: textRef, className: "overflow-hidden transition-all duration-300 ease-in-out", style: {
28
+ maxHeight: expanded ? (_a = textRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight : collapsedHeight,
29
+ display: "-webkit-box",
30
+ WebkitBoxOrient: "vertical",
31
+ WebkitLineClamp: !expanded ? maxLines : "unset",
32
+ }, children: text }), truncated && (_jsx("button", { type: "button", onClick: toggleExpanded, className: "mt-1 text-primary hover:underline text-sm font-medium", children: expanded ? showLessText : showMoreText }))] }));
33
+ }
@@ -4,6 +4,7 @@ export type Props = {
4
4
  errorMessage?: string | boolean;
5
5
  start?: React.ReactNode | null;
6
6
  end?: React.ReactNode | null;
7
+ label?: string;
7
8
  } & React.InputHTMLAttributes<HTMLInputElement>;
8
- export default function Input({ errorMessage, className, start, end, ref, type, ...props }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export default function Input({ errorMessage, className, start, end, ref, type, label, ...props }: Props): import("react/jsx-runtime").JSX.Element;
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;IAC9C,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAC/B,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;CAC9B,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAChD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,YAAY,EACZ,SAAS,EACT,KAAY,EACZ,GAAU,EACV,GAAG,EACH,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,KAAK,2CAoDP"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;IAC9C,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAC/B,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,YAAY,EACZ,SAAS,EACT,KAAY,EACZ,GAAU,EACV,GAAG,EACH,IAAI,EACJ,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,2CA+DP"}
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Icon } from "@iconify/react";
4
4
  import clsx from "clsx";
5
5
  import { useState } from "react";
6
- export default function Input({ errorMessage, className, start = null, end = null, ref, type, ...props }) {
6
+ export default function Input({ errorMessage, className, start = null, end = null, ref, type, label, ...props }) {
7
7
  const [isFocused, setIsFocused] = useState(false);
8
8
  const [currentType, setCurrentType] = useState(type);
9
9
  if (type === "password") {
@@ -13,9 +13,9 @@ export default function Input({ errorMessage, className, start = null, end = nul
13
13
  ? "mdi:eye-outline"
14
14
  : "mdi:eye-off-outline", className: "w-5 h-5 text-primary" }) }));
15
15
  }
16
- return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: clsx("flex items-center justify-between gap-2 bg-white px-3 py-2 rounded-xl border-0.5 hover:border-primary", errorMessage
16
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [label && (_jsx("label", { htmlFor: props.id, className: "pl-1 text-sm text-foreground", children: label })), _jsxs("div", { className: clsx("flex items-center justify-between gap-2 bg-white px-3 py-2 rounded-xl border-0.5 hover:border-primary", errorMessage
17
17
  ? "border-error"
18
18
  : isFocused
19
19
  ? "border-primary"
20
- : "border-gray-200"), children: [start, _jsx("input", { ref: ref, type: currentType, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), className: clsx("outline-none text-text flex-1", className), ...props }), end] }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: errorMessage }))] }));
20
+ : "border-gray-200"), children: [start, _jsx("input", { ref: ref, id: props.id, type: currentType, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), "aria-invalid": !!errorMessage || undefined, className: clsx("outline-none text-text flex-1", className), ...props }), end] }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: typeof errorMessage === "string" ? errorMessage : "Invalid value" }))] }));
21
21
  }
@@ -12,6 +12,9 @@ export type Props<T> = {
12
12
  buttonClassName?: string;
13
13
  placeholder?: string;
14
14
  multiselect?: boolean;
15
+ disabled?: boolean;
16
+ label?: string;
15
17
  };
16
- export default function Select<T>({ name, options, values, setValues, errorMessage, buttonClassName, placeholder, multiselect, }: Props<T>): import("react/jsx-runtime").JSX.Element;
18
+ export default function Select<T>({ name, options, values, setValues, errorMessage, buttonClassName, placeholder, multiselect, disabled, // ✅ default false
19
+ label, }: Props<T>): import("react/jsx-runtime").JSX.Element;
17
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/select/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,MAAM,MAAM,YAA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E,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,EAChC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,SAAS,EACT,YAAY,EACZ,eAAe,EACf,WAAgB,EAChB,WAAmB,EACnB,QAAgB,EAAE,kBAAkB;AACpC,KAAK,GACN,EAAE,KAAK,CAAC,CAAC,CAAC,2CAkIV"}
@@ -3,11 +3,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useRef, useEffect } from "react";
4
4
  import { Icon } from "@iconify/react";
5
5
  import clsx from "clsx";
6
- export default function Select({ name, options, values, setValues, errorMessage, buttonClassName, placeholder = "Select an option", multiselect = false, }) {
6
+ export default function Select({ name, options, values, setValues, errorMessage, buttonClassName, placeholder = "", multiselect = false, disabled = false, // ✅ default false
7
+ label, }) {
7
8
  const [isOpen, setIsOpen] = useState(false);
8
9
  const containerRef = useRef(null);
9
10
  const selectedOptions = options.filter((o) => values.some((v) => Object.is(v, o.value)));
10
11
  const toggleOption = (option) => {
12
+ if (disabled)
13
+ return; // ✅ prevent selecting if disabled
11
14
  if (multiselect) {
12
15
  const isSelected = values.some((v) => Object.is(v, option.value));
13
16
  const updated = isSelected
@@ -21,6 +24,8 @@ export default function Select({ name, options, values, setValues, errorMessage,
21
24
  }
22
25
  };
23
26
  const removeSelected = (option) => {
27
+ if (disabled)
28
+ return; // ✅ prevent removing if disabled
24
29
  setValues(values.filter((v) => !Object.is(v, option.value)));
25
30
  };
26
31
  const handleClickOutside = (e) => {
@@ -33,14 +38,19 @@ export default function Select({ name, options, values, setValues, errorMessage,
33
38
  document.addEventListener("mousedown", handleClickOutside);
34
39
  return () => document.removeEventListener("mousedown", handleClickOutside);
35
40
  }, []);
36
- return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { ref: containerRef, className: "relative w-full", children: [_jsxs("div", { onClick: () => setIsOpen((o) => !o), className: clsx("text-text cursor-pointer flex items-center justify-between gap-2 bg-white px-3 py-2 rounded-md border-0.5", errorMessage
41
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [label && (_jsx("label", { htmlFor: name, className: "pl-1 text-sm text-foreground", children: label })), _jsxs("div", { ref: containerRef, className: "relative w-full", children: [_jsxs("div", { onClick: () => !disabled && setIsOpen((o) => !o), className: clsx("text-text flex items-center justify-between gap-2 px-3 py-2 rounded-md border-0.5", disabled
42
+ ? "bg-gray-100 text-gray-400 cursor-not-allowed"
43
+ : "bg-white cursor-pointer", errorMessage
37
44
  ? "border-error"
38
45
  : isOpen
39
46
  ? "border-primary"
40
- : "border-gray-200", buttonClassName), children: [multiselect ? (selectedOptions.length ? (_jsx("div", { className: "flex flex-wrap gap-2", children: selectedOptions.map((o, i) => (_jsxs("div", { className: "bg-primary bg-opacity-50 px-2 py-1 rounded-2xl flex items-center gap-1", children: [_jsx("div", { className: "text-black text-sm", children: o.label }), _jsx("button", { type: "button", onClick: (e) => {
47
+ : "border-gray-200", buttonClassName), children: [multiselect ? (selectedOptions.length ? (_jsx("div", { className: "flex flex-wrap gap-2", id: `${name}`, children: selectedOptions.map((o, i) => (_jsxs("div", { className: "bg-primary bg-opacity-50 px-2 py-1 rounded-2xl flex items-center gap-1", children: [_jsx("div", { className: "text-black text-sm", children: o.label }), !disabled && ( // hide close button if disabled
48
+ _jsx("button", { type: "button", onClick: (e) => {
41
49
  e.stopPropagation();
42
50
  removeSelected(o);
43
- }, children: _jsx(Icon, { icon: "line-md:close-small", className: "w-4 h-4" }) })] }, `${name}-${i}`))) })) : (_jsx("p", { className: "text-gray-500", children: placeholder }))) : selectedOptions[0] ? (_jsx("div", { children: selectedOptions[0].label })) : (_jsx("p", { className: "text-gray-500", children: placeholder })), _jsx(Icon, { icon: "iconamoon:arrow-down-2" })] }), isOpen && (_jsx("div", { className: "absolute left-0 mt-1 w-full z-50 bg-white border border-gray-200 rounded-md shadow-lg max-h-64 overflow-auto animate-fade-in", children: options.map((o, i) => {
51
+ }, children: _jsx(Icon, { icon: "line-md:close-small", className: "w-4 h-4" }) }))] }, `${name}-${i}`))) })) : (_jsx("p", { className: "text-gray-500", children: placeholder }))) : selectedOptions[0] ? (_jsx("div", { children: selectedOptions[0].label })) : (_jsx("p", { className: "text-gray-500", children: placeholder })), _jsx(Icon, { icon: "iconamoon:arrow-down-2" })] }), isOpen &&
52
+ !disabled && ( // ✅ prevent opening dropdown when disabled
53
+ _jsx("div", { className: "absolute left-0 mt-1 w-full z-50 bg-white border border-gray-200 rounded-md shadow-lg max-h-64 overflow-auto animate-fade-in", children: options.map((o, i) => {
44
54
  const isSelected = selectedOptions.some((s) => Object.is(s.value, o.value));
45
55
  return (_jsx("div", { onClick: () => toggleOption(o), className: clsx("px-4 py-2 cursor-pointer custom-animation", isSelected && "bg-primary text-white", !isSelected && "hover:bg-primary hover:bg-opacity-20"), children: o.label }, `${name}-option-${i}`));
46
56
  }) }))] }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: errorMessage }))] }));
@@ -2,6 +2,7 @@ import React, { LegacyRef } from "react";
2
2
  export type Props = {
3
3
  ref?: LegacyRef<HTMLTextAreaElement> | undefined;
4
4
  errorMessage?: string | boolean;
5
+ label?: string;
5
6
  } & React.TextareaHTMLAttributes<HTMLTextAreaElement>;
6
- export default function Textarea({ errorMessage, className, ref, ...props }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export default function Textarea({ errorMessage, className, ref, label, ...props }: Props): import("react/jsx-runtime").JSX.Element;
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/textarea/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;IACjD,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC,GAAG,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;AACtD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,YAAY,EACZ,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,KAAK,2CA4BP"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/textarea/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;IACjD,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;AAEtD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,YAAY,EACZ,SAAS,EACT,GAAG,EACH,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,2CAuCP"}
@@ -2,11 +2,11 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
4
  import { useState } from "react";
5
- export default function Textarea({ errorMessage, className, ref, ...props }) {
5
+ export default function Textarea({ errorMessage, className, ref, label, ...props }) {
6
6
  const [isFocused, setIsFocused] = useState(false);
7
- return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("div", { className: clsx("flex items-center justify-between gap-2 bg-white px-3 py-2 rounded-xl border-0.5 hover:border-primary", errorMessage
7
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [label && (_jsx("label", { htmlFor: props.id, className: "pl-1 text-sm text-foreground", children: label })), _jsx("div", { className: clsx("flex items-center justify-between gap-2 bg-white px-3 py-2 rounded-xl border-0.5 hover:border-primary", errorMessage
8
8
  ? "border-error"
9
9
  : isFocused
10
10
  ? "border-primary"
11
- : "border-gray-200"), children: _jsx("textarea", { ref: ref, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), className: clsx("outline-none text-text flex-1", className), ...props }) }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: errorMessage }))] }));
11
+ : "border-gray-200"), children: _jsx("textarea", { ref: ref, id: props.id, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), "aria-invalid": !!errorMessage || undefined, className: clsx("outline-none text-text flex-1", className), ...props }) }), errorMessage && (_jsx("p", { className: "pl-1 text-sm text-error", children: typeof errorMessage === "string" ? errorMessage : "Invalid value" }))] }));
12
12
  }
package/dist/index.d.ts CHANGED
@@ -51,6 +51,7 @@ export { default as MonthCalendar, Props as MonthCalendarProps, } from "./compon
51
51
  export { default as WeekCalendar, Props as WeekCalendarProps, } from "./components/week-calendar";
52
52
  export { default as DayCalendar, Props as DayCalendarProps, } from "./components/day-calendar";
53
53
  export { default as Loader, Props as LoaderProps } from "./components/loader";
54
+ export { default as ExpandableText, Props as ExpandableTextProps, } from "./components/expandable-text";
54
55
  export { default as ItemNouFound, Props as ItemNouFoundProps, } from "./components/item-not-found";
55
56
  export * from "./components/accordion";
56
57
  export { default as NotificationsMenu, Props as NotificationsMenuProps, } from "./components/notifications-menu";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK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O,IAAI,iBAAiB,EAC5B,KAAK,IAAI,sBAAsB,GAChC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,KAAK,IAAI,yBAAyB,GACnC,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -56,6 +56,7 @@ export { default as MonthCalendar, } from "./components/month-calendar";
56
56
  export { default as WeekCalendar, } from "./components/week-calendar";
57
57
  export { default as DayCalendar, } from "./components/day-calendar";
58
58
  export { default as Loader } from "./components/loader";
59
+ export { default as ExpandableText, } from "./components/expandable-text";
59
60
  export { default as ItemNouFound, } from "./components/item-not-found";
60
61
  export * from "./components/accordion";
61
62
  export { default as NotificationsMenu, } from "./components/notifications-menu";
@@ -0,0 +1,7 @@
1
+ import { FirebaseConfig, NotificationPayload } from "../../utils/firebase-client";
2
+ export default function FirebaseTokenHandler({ config, _onForegroundMessage, _onGetToken, }: Readonly<{
3
+ config: FirebaseConfig;
4
+ _onForegroundMessage?: (notification: NotificationPayload) => void;
5
+ _onGetToken?: (token: string) => void;
6
+ }>): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/middleware/firebase-token-handler/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAIL,cAAc,EACd,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,MAAM,EACN,oBAAoB,EACpB,WAAW,GACZ,EAAE,QAAQ,CAAC;IACV,MAAM,EAAE,cAAc,CAAC;IACvB,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC,2CAmBD"}
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import { initFirebase, requestForToken, onForegroundMessage, } from "../../utils/firebase-client";
5
+ export default function FirebaseTokenHandler({ config, _onForegroundMessage, _onGetToken, }) {
6
+ console.log("FirebaseTokenHandler");
7
+ useEffect(() => {
8
+ console.log("Init ...");
9
+ initFirebase(config);
10
+ requestForToken(config.vapidKey).then((token) => {
11
+ if (token) {
12
+ console.log("FCM Token:", token);
13
+ _onGetToken && _onGetToken(token);
14
+ }
15
+ });
16
+ onForegroundMessage((notification) => {
17
+ console.log("Foreground notification:", notification);
18
+ _onForegroundMessage && _onForegroundMessage(notification);
19
+ });
20
+ }, [config]);
21
+ return _jsx(_Fragment, {});
22
+ }
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/hoc/can-access-application/index.tsx","../src/hoc/with-authorization/index.tsx","../src/components/accordion/index.tsx","../src/components/activity-message/index.tsx","../src/components/alert/index.tsx","../src/components/auto-complete-input/index.tsx","../src/components/avatar/index.tsx","../src/components/badge/index.tsx","../src/components/breadcrumb/index.tsx","../src/components/button/index.tsx","../src/components/calendar/index.tsx","../src/components/cards-list/index.tsx","../src/components/carousel/index.tsx","../src/components/checkbox/index.tsx","../src/components/color-picker/index.tsx","../src/components/count-down/index.tsx","../src/components/day-calendar/index.tsx","../src/components/drawer/index.tsx","../src/components/editable-text/index.tsx","../src/components/file-input/index.tsx","../src/components/file-input/components/file-item/index.tsx","../src/components/icon/index.tsx","../src/components/input/index.tsx","../src/components/item-not-found/index.tsx","../src/components/list-item/index.tsx","../src/components/list-item/components/page-button/index.tsx","../src/components/list-item/components/pagination/index.tsx","../src/components/loader/index.tsx","../src/components/menu/index.tsx","../src/components/menu/menu-item/index.tsx","../src/components/modal/index.tsx","../src/components/month-calendar/index.tsx","../src/components/native-menu/index.tsx","../src/components/native-menu/native-menu-item/index.tsx","../src/components/not-authorized/index.tsx","../src/components/notifications-menu/index.tsx","../src/components/otp-input/index.tsx","../src/components/paper/index.tsx","../src/components/progress-bar/index.tsx","../src/components/radio-button/index.tsx","../src/components/search-input/index.tsx","../src/components/select/index.tsx","../src/components/skeleton/index.tsx","../src/components/stacked-avatars/index.tsx","../src/components/tab/index.tsx","../src/components/table/index.tsx","../src/components/text-editor/index.tsx","../src/components/text-editor/components/toolbar/index.tsx","../src/components/text-editor/utils/index.ts","../src/components/textarea/index.tsx","../src/components/toggle/index.tsx","../src/components/tooltip/index.tsx","../src/components/tree-checkbox/index.tsx","../src/components/tree-checkbox/components/tree-checkbox-item/index.tsx","../src/components/tree-checkbox/utils/index.ts","../src/components/week-calendar/index.tsx","../src/constants/index.ts","../src/hooks/list-items-hook/types.ts","../src/hooks/list-items-hook/usebulkactions.ts","../src/hooks/list-items-hook/usefilters.ts","../src/hooks/list-items-hook/usepagination.ts","../src/hooks/use-has-permission-access/index.ts","../src/hooks/user-has-application-access/index.ts","../src/middleware/must-auth/index.tsx","../src/utils/axios/index.ts","../src/utils/color/index.ts","../src/utils/cookie/index.ts","../src/utils/file/index.ts","../src/utils/jwt/index.ts","../src/utils/validation/index.ts"],"version":"5.6.3"}
1
+ {"root":["../src/index.ts","../src/hoc/can-access-application/index.tsx","../src/hoc/with-authorization/index.tsx","../src/components/accordion/index.tsx","../src/components/activity-message/index.tsx","../src/components/alert/index.tsx","../src/components/auto-complete-input/index.tsx","../src/components/avatar/index.tsx","../src/components/badge/index.tsx","../src/components/breadcrumb/index.tsx","../src/components/button/index.tsx","../src/components/calendar/index.tsx","../src/components/cards-list/index.tsx","../src/components/carousel/index.tsx","../src/components/checkbox/index.tsx","../src/components/color-picker/index.tsx","../src/components/count-down/index.tsx","../src/components/day-calendar/index.tsx","../src/components/drawer/index.tsx","../src/components/editable-text/index.tsx","../src/components/expandable-text/index.tsx","../src/components/file-input/index.tsx","../src/components/file-input/components/file-item/index.tsx","../src/components/icon/index.tsx","../src/components/input/index.tsx","../src/components/item-not-found/index.tsx","../src/components/list-item/index.tsx","../src/components/list-item/components/page-button/index.tsx","../src/components/list-item/components/pagination/index.tsx","../src/components/loader/index.tsx","../src/components/menu/index.tsx","../src/components/menu/menu-item/index.tsx","../src/components/modal/index.tsx","../src/components/month-calendar/index.tsx","../src/components/native-menu/index.tsx","../src/components/native-menu/native-menu-item/index.tsx","../src/components/not-authorized/index.tsx","../src/components/notifications-menu/index.tsx","../src/components/otp-input/index.tsx","../src/components/paper/index.tsx","../src/components/progress-bar/index.tsx","../src/components/radio-button/index.tsx","../src/components/search-input/index.tsx","../src/components/select/index.tsx","../src/components/skeleton/index.tsx","../src/components/stacked-avatars/index.tsx","../src/components/tab/index.tsx","../src/components/table/index.tsx","../src/components/text-editor/index.tsx","../src/components/text-editor/components/toolbar/index.tsx","../src/components/text-editor/utils/index.ts","../src/components/textarea/index.tsx","../src/components/toggle/index.tsx","../src/components/tooltip/index.tsx","../src/components/tree-checkbox/index.tsx","../src/components/tree-checkbox/components/tree-checkbox-item/index.tsx","../src/components/tree-checkbox/utils/index.ts","../src/components/week-calendar/index.tsx","../src/constants/index.ts","../src/hooks/list-items-hook/types.ts","../src/hooks/list-items-hook/usebulkactions.ts","../src/hooks/list-items-hook/usefilters.ts","../src/hooks/list-items-hook/usepagination.ts","../src/hooks/use-has-permission-access/index.ts","../src/hooks/user-has-application-access/index.ts","../src/middleware/must-auth/index.tsx","../src/utils/axios/index.ts","../src/utils/color/index.ts","../src/utils/cookie/index.ts","../src/utils/file/index.ts","../src/utils/jwt/index.ts","../src/utils/validation/index.ts"],"version":"5.6.3"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/firebase/index.ts"],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/utils/firebase-client/config.ts"],"names":[],"mappings":""}
File without changes
@@ -0,0 +1,15 @@
1
+ import { Messaging } from "firebase/messaging";
2
+ import { FirebaseConfig, NotificationPayload } from "./types";
3
+ /**
4
+ * Initialize Firebase and Messaging
5
+ */
6
+ export declare function initFirebase(config: FirebaseConfig): Messaging;
7
+ /**
8
+ * Get FCM token for this device/browser
9
+ */
10
+ export declare function requestForToken(vapidKey: string): Promise<string | null>;
11
+ /**
12
+ * Listen for foreground messages
13
+ */
14
+ export declare function onForegroundMessage(callback: (payload: NotificationPayload) => void): void;
15
+ //# sourceMappingURL=firebase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase.d.ts","sourceRoot":"","sources":["../../../src/utils/firebase-client/firebase.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,SAAS,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAK9D;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAc9D;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcxB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,GAC/C,IAAI,CAgBN"}
@@ -0,0 +1,55 @@
1
+ import { initializeApp } from "firebase/app";
2
+ import { getMessaging, getToken, onMessage, } from "firebase/messaging";
3
+ let appInstance = null;
4
+ let messagingInstance = null;
5
+ /**
6
+ * Initialize Firebase and Messaging
7
+ */
8
+ export function initFirebase(config) {
9
+ if (!appInstance) {
10
+ appInstance = initializeApp({
11
+ apiKey: config.apiKey,
12
+ authDomain: config.authDomain,
13
+ projectId: config.projectId,
14
+ storageBucket: config.storageBucket,
15
+ messagingSenderId: config.messagingSenderId,
16
+ appId: config.appId,
17
+ });
18
+ }
19
+ messagingInstance = getMessaging(appInstance);
20
+ return messagingInstance;
21
+ }
22
+ /**
23
+ * Get FCM token for this device/browser
24
+ */
25
+ export async function requestForToken(vapidKey) {
26
+ if (!messagingInstance) {
27
+ throw new Error("[firebase-notifications] Firebase not initialized. Call initFirebase first.");
28
+ }
29
+ try {
30
+ const token = await getToken(messagingInstance, { vapidKey });
31
+ return token;
32
+ }
33
+ catch (err) {
34
+ console.error("[firebase-notifications] Error fetching FCM token:", err);
35
+ return null;
36
+ }
37
+ }
38
+ /**
39
+ * Listen for foreground messages
40
+ */
41
+ export function onForegroundMessage(callback) {
42
+ if (!messagingInstance) {
43
+ throw new Error("[firebase-notifications] Firebase not initialized. Call initFirebase first.");
44
+ }
45
+ onMessage(messagingInstance, (payload) => {
46
+ var _a, _b, _c;
47
+ const notification = {
48
+ title: ((_a = payload.notification) === null || _a === void 0 ? void 0 : _a.title) || "Notification",
49
+ body: ((_b = payload.notification) === null || _b === void 0 ? void 0 : _b.body) || "",
50
+ icon: (_c = payload.notification) === null || _c === void 0 ? void 0 : _c.icon,
51
+ ...payload.data,
52
+ };
53
+ callback(notification);
54
+ });
55
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./firebase";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/firebase-client/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./firebase";
@@ -0,0 +1,17 @@
1
+ export interface FirebaseConfig {
2
+ apiKey: string;
3
+ authDomain: string;
4
+ projectId: string;
5
+ storageBucket: string;
6
+ messagingSenderId: string;
7
+ appId: string;
8
+ vapidKey?: string;
9
+ measurementId: string;
10
+ }
11
+ export interface NotificationPayload {
12
+ title: string;
13
+ body: string;
14
+ icon?: string;
15
+ [key: string]: any;
16
+ }
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/firebase-client/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sea-react-components",
3
3
  "description": "SEA react components library",
4
- "version": "1.3.7",
4
+ "version": "1.3.9",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "tsc --build && npx postcss src/styles.css -o dist/styles.css && npx postcss src/components/text-editor/style.css -o dist/components/text-editor/style.css",
@@ -45,7 +45,7 @@
45
45
  "jwt-decode": "^4.0.0",
46
46
  "lowlight": "^3.3.0",
47
47
  "react-dom": "^18.3.1",
48
- "sea-platform-helpers": "^1.5.6",
48
+ "sea-platform-helpers": "^1.5.7",
49
49
  "sea-react-components": "file:",
50
50
  "yup": "^1.5.0"
51
51
  },