@plurix/ecom-components 1.11.5 → 1.12.0

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 (63) hide show
  1. package/dist/main.d.ts +5 -0
  2. package/dist/main.js +14 -10
  3. package/dist/packages/SearchSugestions/components/Button/index.d.ts +13 -0
  4. package/dist/packages/SearchSugestions/components/Button/index.js +48 -0
  5. package/dist/packages/SearchSugestions/components/Button/showMoreOrLess.d.ts +1 -0
  6. package/dist/packages/SearchSugestions/components/Button/showMoreOrLess.js +6 -0
  7. package/dist/packages/SearchSugestions/components/Link/index.d.ts +10 -0
  8. package/dist/packages/SearchSugestions/components/Link/index.js +34 -0
  9. package/dist/packages/SearchSugestions/components/Link/navigation.d.ts +1 -0
  10. package/dist/packages/SearchSugestions/components/Link/navigation.js +8 -0
  11. package/dist/packages/SearchSugestions/components/SearchSuggestions/index.d.ts +4 -0
  12. package/dist/packages/SearchSugestions/components/SearchSuggestions/index.js +83 -0
  13. package/dist/packages/SearchSugestions/components/SearchText/Index.d.ts +10 -0
  14. package/dist/packages/SearchSugestions/components/SearchText/Index.js +37 -0
  15. package/dist/packages/SearchSugestions/index.d.ts +3 -0
  16. package/dist/packages/SearchSugestions/index.js +4 -0
  17. package/dist/packages/SearchSugestions/mocks.d.ts +4 -0
  18. package/dist/packages/SearchSugestions/mocks.js +16 -0
  19. package/dist/packages/SearchSugestions/styles/baseAllSuggestionsContainerStyle.d.ts +3 -0
  20. package/dist/packages/SearchSugestions/styles/baseAllSuggestionsContainerStyle.js +10 -0
  21. package/dist/packages/SearchSugestions/styles/baseButtonHoveredStyle.d.ts +3 -0
  22. package/dist/packages/SearchSugestions/styles/baseButtonHoveredStyle.js +7 -0
  23. package/dist/packages/SearchSugestions/styles/baseButtonStyle.d.ts +3 -0
  24. package/dist/packages/SearchSugestions/styles/baseButtonStyle.js +13 -0
  25. package/dist/packages/SearchSugestions/styles/baseSearchForStyle.d.ts +3 -0
  26. package/dist/packages/SearchSugestions/styles/baseSearchForStyle.js +9 -0
  27. package/dist/packages/SearchSugestions/styles/baseSearchForTermStyle.d.ts +3 -0
  28. package/dist/packages/SearchSugestions/styles/baseSearchForTermStyle.js +8 -0
  29. package/dist/packages/SearchSugestions/styles/baseSuggestionLinkHoveredStyle.d.ts +3 -0
  30. package/dist/packages/SearchSugestions/styles/baseSuggestionLinkHoveredStyle.js +7 -0
  31. package/dist/packages/SearchSugestions/styles/baseSuggestionLinkStyle.d.ts +3 -0
  32. package/dist/packages/SearchSugestions/styles/baseSuggestionLinkStyle.js +14 -0
  33. package/dist/packages/SearchSugestions/styles/baseTitleStyle.d.ts +3 -0
  34. package/dist/packages/SearchSugestions/styles/baseTitleStyle.js +9 -0
  35. package/dist/packages/SearchSugestions/types/ResponseApi.d.ts +10 -0
  36. package/dist/packages/SearchSugestions/types/ResponseApi.js +1 -0
  37. package/dist/packages/SearchSugestions/types/SearchSuggestionsProps.d.ts +24 -0
  38. package/dist/packages/SearchSugestions/types/SearchSuggestionsProps.js +1 -0
  39. package/dist/packages/Skeleton/components/SkeletonAnimation/SkeletonAnimation.d.ts +9 -0
  40. package/dist/packages/Skeleton/components/SkeletonAnimation/SkeletonAnimation.js +14 -0
  41. package/dist/packages/Skeleton/components/SkeletonContainer/SkeletonContainer.d.ts +15 -0
  42. package/dist/packages/Skeleton/components/SkeletonContainer/SkeletonContainer.js +22 -0
  43. package/dist/packages/Skeleton/components/SkeletonRender/SkeletonRender.d.ts +21 -0
  44. package/dist/packages/Skeleton/components/SkeletonRender/SkeletonRender.js +57 -0
  45. package/dist/packages/Skeleton/components/SkeletonTable/SkeletonTable.d.ts +12 -0
  46. package/dist/packages/Skeleton/components/SkeletonTable/SkeletonTable.js +18 -0
  47. package/dist/packages/Skeleton/components/SkeletonWrapper/SkeletonWrapper.d.ts +10 -0
  48. package/dist/packages/Skeleton/components/SkeletonWrapper/SkeletonWrapper.js +20 -0
  49. package/dist/packages/Skeleton/hooks/useResponsiveImages.d.ts +9 -0
  50. package/dist/packages/Skeleton/hooks/useResponsiveImages.js +34 -0
  51. package/dist/packages/Skeleton/index.d.ts +32 -0
  52. package/dist/packages/Skeleton/index.js +91 -0
  53. package/dist/packages/Skeleton/types/types.d.ts +42 -0
  54. package/dist/packages/Skeleton/types/types.js +1 -0
  55. package/dist/packages/Skeleton/utils/createStyleAnimation.d.ts +7 -0
  56. package/dist/packages/Skeleton/utils/createStyleAnimation.js +7 -0
  57. package/dist/packages/Skeleton/utils/createStyleCell.d.ts +18 -0
  58. package/dist/packages/Skeleton/utils/createStyleCell.js +19 -0
  59. package/dist/packages/Skeleton/utils/createStyleContainers.d.ts +33 -0
  60. package/dist/packages/Skeleton/utils/createStyleContainers.js +45 -0
  61. package/dist/packages/Skeleton/utils/createStyleTable.d.ts +12 -0
  62. package/dist/packages/Skeleton/utils/createStyleTable.js +9 -0
  63. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -10,3 +10,8 @@ export { ContactCard } from './packages/ContactCard/ContactCard';
10
10
  export * from './packages/ContactCard/ContactCard';
11
11
  export * from './types/ChangeOrderModal';
12
12
  export { ChangeOrderModal } from './packages/ChangeOrderModal/ChangeOrderModal';
13
+ export { Skeleton } from './packages/Skeleton';
14
+ export type { SkeletonProps } from './packages/Skeleton';
15
+ export { SearchSuggestions } from './packages/SearchSugestions/components/SearchSuggestions';
16
+ export type { SearchSuggestionsProps } from './packages/SearchSugestions/types/SearchSuggestionsProps';
17
+ export type { SearchSuggestionsApiResponse, Searches } from './packages/SearchSugestions/types/ResponseApi';
package/dist/main.js CHANGED
@@ -1,20 +1,24 @@
1
1
  import { CartClubAlert as e } from "./packages/CartClubAlert/CartClubAlert.js";
2
- import { Carousel as a } from "./packages/Carousel/Carousel.js";
2
+ import { Carousel as p } from "./packages/Carousel/Carousel.js";
3
3
  import { Coupons as f } from "./packages/Coupons/Coupons.js";
4
4
  import { Onboarding as x } from "./packages/Onboarding/Onboarding.js";
5
- import { Tour as C } from "./packages/Tour/Tour.js";
5
+ import { Tour as l } from "./packages/Tour/Tour.js";
6
6
  import { Regionalization as d } from "./packages/Regionalization/Regionalization.js";
7
- import { Modal as u } from "./packages/Modal/Modal.js";
8
- import { ContactCard as b } from "./packages/ContactCard/ContactCard.js";
9
- import { ChangeOrderModal as M } from "./packages/ChangeOrderModal/ChangeOrderModal.js";
7
+ import { Modal as i } from "./packages/Modal/Modal.js";
8
+ import { ContactCard as s } from "./packages/ContactCard/ContactCard.js";
9
+ import { ChangeOrderModal as b } from "./packages/ChangeOrderModal/ChangeOrderModal.js";
10
+ import { Skeleton as h } from "./packages/Skeleton/index.js";
11
+ import { SearchSuggestions as O } from "./packages/SearchSugestions/components/SearchSuggestions/index.js";
10
12
  export {
11
- a as Carousel,
13
+ p as Carousel,
12
14
  e as CartClubAlert,
13
- M as ChangeOrderModal,
14
- b as ContactCard,
15
+ b as ChangeOrderModal,
16
+ s as ContactCard,
15
17
  f as Coupons,
16
- u as Modal,
18
+ i as Modal,
17
19
  x as Onboarding,
18
20
  d as Regionalization,
19
- C as Tour
21
+ O as SearchSuggestions,
22
+ h as Skeleton,
23
+ l as Tour
20
24
  };
@@ -0,0 +1,13 @@
1
+ import { default as React, CSSProperties } from 'react';
2
+
3
+ interface ButtonProps {
4
+ itemsToShowQuantity: number;
5
+ itemsToShow: number;
6
+ setItemsToShowQuantity: (itemsToShowQuantity: number) => void;
7
+ showMoreSuggestionsText?: string;
8
+ showLessSuggestionsText?: string;
9
+ buttonStyle?: CSSProperties;
10
+ buttonHoveredStyle?: CSSProperties;
11
+ }
12
+ export declare const Button: React.FC<ButtonProps>;
13
+ export {};
@@ -0,0 +1,48 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useState as d } from "react";
3
+ import { showMoreOrLess as f } from "./showMoreOrLess.js";
4
+ import { baseButtonStyle as m } from "../../styles/baseButtonStyle.js";
5
+ import { baseButtonHoveredStyle as p } from "../../styles/baseButtonHoveredStyle.js";
6
+ const x = ({
7
+ itemsToShowQuantity: t,
8
+ itemsToShow: e,
9
+ setItemsToShowQuantity: r,
10
+ showMoreSuggestionsText: a,
11
+ showLessSuggestionsText: l,
12
+ buttonStyle: u,
13
+ buttonHoveredStyle: i
14
+ }) => {
15
+ const [c, s] = d(!1), o = {
16
+ ...m,
17
+ ...u
18
+ }, g = {
19
+ ...p,
20
+ ...i
21
+ };
22
+ return /* @__PURE__ */ n(
23
+ "div",
24
+ {
25
+ className: "suggestion-button-container",
26
+ style: { textAlign: "center" },
27
+ children: /* @__PURE__ */ n(
28
+ "button",
29
+ {
30
+ onClick: () => f(
31
+ e,
32
+ t,
33
+ r
34
+ ),
35
+ onMouseEnter: () => s(!0),
36
+ onMouseLeave: () => s(!1),
37
+ className: "suggestion-button",
38
+ style: c ? { ...o, ...g } : { ...o },
39
+ "data-testid": t === e ? "show" : "hide",
40
+ children: t === e ? a || "Ver todas as sugestões" : l || "Ocultar algumas sugestões"
41
+ }
42
+ )
43
+ }
44
+ );
45
+ };
46
+ export {
47
+ x as Button
48
+ };
@@ -0,0 +1 @@
1
+ export declare const showMoreOrLess: (itemsToShow: number, itemsToShowQuantity: number, setItemsToShowQuantity: (itemsToShow: number) => void) => void;
@@ -0,0 +1,6 @@
1
+ const f = (r, c, n) => {
2
+ n(c === r ? 1 / 0 : r);
3
+ };
4
+ export {
5
+ f as showMoreOrLess
6
+ };
@@ -0,0 +1,10 @@
1
+ import { default as React, CSSProperties } from 'react';
2
+
3
+ interface LinkProps {
4
+ href: string;
5
+ children: React.ReactNode;
6
+ suggestionLinkStyle?: CSSProperties;
7
+ suggestionLinkHoveredStyle?: CSSProperties;
8
+ }
9
+ export declare const Link: React.FC<LinkProps>;
10
+ export {};
@@ -0,0 +1,34 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { useState as m } from "react";
3
+ import { navigation as u } from "./navigation.js";
4
+ import { baseSuggestionLinkStyle as S } from "../../styles/baseSuggestionLinkStyle.js";
5
+ import { baseSuggestionLinkHoveredStyle as f } from "../../styles/baseSuggestionLinkHoveredStyle.js";
6
+ const y = ({
7
+ href: e,
8
+ children: n,
9
+ suggestionLinkStyle: i,
10
+ suggestionLinkHoveredStyle: s
11
+ }) => {
12
+ const [r, o] = m(!1), t = {
13
+ ...S,
14
+ ...i
15
+ }, a = {
16
+ ...f,
17
+ ...s
18
+ };
19
+ return /* @__PURE__ */ l(
20
+ "a",
21
+ {
22
+ href: e,
23
+ onClick: (g) => u(g, e),
24
+ onMouseEnter: () => o(!0),
25
+ onMouseLeave: () => o(!1),
26
+ className: "suggestion-link",
27
+ style: r ? { ...t, ...a } : { ...t },
28
+ children: n
29
+ }
30
+ );
31
+ };
32
+ export {
33
+ y as Link
34
+ };
@@ -0,0 +1 @@
1
+ export declare const navigation: (event: React.MouseEvent<HTMLElement>, href: string) => void;
@@ -0,0 +1,8 @@
1
+ const o = (t, n) => {
2
+ t.preventDefault(), window.history.pushState({}, "", n);
3
+ const e = new PopStateEvent("popstate");
4
+ window.dispatchEvent(e);
5
+ };
6
+ export {
7
+ o as navigation
8
+ };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { SearchSuggestionsProps } from '../../types/SearchSuggestionsProps';
3
+
4
+ export declare const SearchSuggestions: React.FC<SearchSuggestionsProps>;
@@ -0,0 +1,83 @@
1
+ import { jsxs as Q, jsx as s } from "react/jsx-runtime";
2
+ import { useState as S, useEffect as _ } from "react";
3
+ import { Link as k } from "../Link/index.js";
4
+ import { Button as q } from "../Button/index.js";
5
+ import { SearchText as A } from "../SearchText/Index.js";
6
+ import { baseTitleStyle as E } from "../../styles/baseTitleStyle.js";
7
+ import { baseAllSuggestionsContainerStyle as L } from "../../styles/baseAllSuggestionsContainerStyle.js";
8
+ const K = ({
9
+ searchSuggestions: n,
10
+ loading: l,
11
+ itemsToShow: t = 1 / 0,
12
+ searchFor: r,
13
+ loadingText: c,
14
+ searchForText: g,
15
+ titleText: u,
16
+ showMoreSuggestionsText: f,
17
+ showLessSuggestionsText: m,
18
+ searchForStyle: p,
19
+ searchForTermStyle: d,
20
+ titleStyle: y,
21
+ allSuggestionsContainerStyle: h,
22
+ suggestionLinkStyle: x,
23
+ suggestionLinkHoveredStyle: N,
24
+ buttonStyle: v,
25
+ buttonHoveredStyle: b,
26
+ urlSearch: i
27
+ }) => {
28
+ const [o, a] = S(t);
29
+ _(() => {
30
+ a(t);
31
+ }, [t]);
32
+ const j = t > 0 && n.length > t, B = (e) => i ? i.replace("{{term}}", e) : `/s/?q=${e}&sort=score_desc&page=0`;
33
+ return /* @__PURE__ */ Q("div", { className: "suggestions-main-container", children: [
34
+ r && /* @__PURE__ */ s(
35
+ A,
36
+ {
37
+ searchFor: r,
38
+ searchForText: g,
39
+ searchForStyle: p,
40
+ searchForTermStyle: d
41
+ }
42
+ ),
43
+ /* @__PURE__ */ s("h2", { style: { ...E, ...y }, children: u ?? "Ver por interesse:" }),
44
+ /* @__PURE__ */ s(
45
+ "div",
46
+ {
47
+ className: "suggestions-all_suggestions-container",
48
+ style: {
49
+ ...L,
50
+ ...h
51
+ },
52
+ children: l ? /* @__PURE__ */ s("span", { className: "suggestions-loading", children: c ?? "Carregando sugestões..." }) : n.map(({ term: e }, C) => {
53
+ const I = /* @__PURE__ */ s(
54
+ k,
55
+ {
56
+ href: B(e),
57
+ suggestionLinkStyle: x,
58
+ suggestionLinkHoveredStyle: N,
59
+ children: e
60
+ },
61
+ e
62
+ );
63
+ return t >= 0 && C + 1 <= o ? I : null;
64
+ })
65
+ }
66
+ ),
67
+ j && /* @__PURE__ */ s(
68
+ q,
69
+ {
70
+ itemsToShowQuantity: o,
71
+ setItemsToShowQuantity: a,
72
+ itemsToShow: t,
73
+ showMoreSuggestionsText: f,
74
+ showLessSuggestionsText: m,
75
+ buttonStyle: v,
76
+ buttonHoveredStyle: b
77
+ }
78
+ )
79
+ ] });
80
+ };
81
+ export {
82
+ K as SearchSuggestions
83
+ };
@@ -0,0 +1,10 @@
1
+ import { default as React, CSSProperties } from 'react';
2
+
3
+ interface SearchForProps {
4
+ searchFor: string;
5
+ searchForText?: string;
6
+ searchForStyle?: CSSProperties;
7
+ searchForTermStyle?: CSSProperties;
8
+ }
9
+ export declare const SearchText: React.FC<SearchForProps>;
10
+ export {};
@@ -0,0 +1,37 @@
1
+ import { jsxs as r } from "react/jsx-runtime";
2
+ import { baseSearchForStyle as o } from "../../styles/baseSearchForStyle.js";
3
+ import { baseSearchForTermStyle as c } from "../../styles/baseSearchForTermStyle.js";
4
+ const l = ({
5
+ searchFor: e,
6
+ searchForText: s,
7
+ searchForStyle: t,
8
+ searchForTermStyle: a
9
+ }) => /* @__PURE__ */ r(
10
+ "p",
11
+ {
12
+ className: "suggestion-search_for",
13
+ style: { ...o, ...t },
14
+ "data-testid": "search-for",
15
+ children: [
16
+ s ?? "Você pesquisou por ",
17
+ /* @__PURE__ */ r(
18
+ "span",
19
+ {
20
+ className: "suggestion-search_for-term",
21
+ style: { ...c, ...a },
22
+ children: [
23
+ "“",
24
+ e.replace(
25
+ e.charAt(0),
26
+ e.charAt(0).toUpperCase()
27
+ ),
28
+ "”"
29
+ ]
30
+ }
31
+ )
32
+ ]
33
+ }
34
+ );
35
+ export {
36
+ l as SearchText
37
+ };
@@ -0,0 +1,3 @@
1
+ export { SearchSuggestions } from './components/SearchSuggestions';
2
+ export type { SearchSuggestionsProps } from './types/SearchSuggestionsProps';
3
+ export type { SearchSuggestionsApiResponse, Searches } from './types/ResponseApi';
@@ -0,0 +1,4 @@
1
+ import { SearchSuggestions as r } from "./components/SearchSuggestions/index.js";
2
+ export {
3
+ r as SearchSuggestions
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare const mockSearchSuggestions: {
2
+ term: string;
3
+ }[];
4
+ export declare const mockSearchFor = "user search";
@@ -0,0 +1,16 @@
1
+ const t = [
2
+ { term: "test-term-1" },
3
+ { term: "test-term-2" },
4
+ { term: "test-term-3" },
5
+ { term: "test-term-4" },
6
+ { term: "test-term-5" },
7
+ { term: "test-term-6" },
8
+ { term: "test-term-7" },
9
+ { term: "test-term-8" },
10
+ { term: "test-term-9" },
11
+ { term: "test-term-10" }
12
+ ], e = "user search";
13
+ export {
14
+ e as mockSearchFor,
15
+ t as mockSearchSuggestions
16
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export declare const baseAllSuggestionsContainerStyle: CSSProperties;
@@ -0,0 +1,10 @@
1
+ const e = {
2
+ display: "flex",
3
+ alignItems: "center",
4
+ flexWrap: "wrap",
5
+ gap: "8px 4px",
6
+ margin: "8px 0"
7
+ };
8
+ export {
9
+ e as baseAllSuggestionsContainerStyle
10
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export declare const baseButtonHoveredStyle: CSSProperties;
@@ -0,0 +1,7 @@
1
+ const o = {
2
+ background: "transparent",
3
+ color: "var(--color-support-links, #00289C)"
4
+ };
5
+ export {
6
+ o as baseButtonHoveredStyle
7
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export declare const baseButtonStyle: CSSProperties;
@@ -0,0 +1,13 @@
1
+ const o = {
2
+ display: "inline-block",
3
+ border: "none",
4
+ background: "transparent",
5
+ color: "var(--color-support-links, #00289C)",
6
+ fontSize: "14px",
7
+ lineHeight: "18px",
8
+ textDecoration: "underline",
9
+ cursor: "pointer"
10
+ };
11
+ export {
12
+ o as baseButtonStyle
13
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export declare const baseSearchForStyle: CSSProperties;
@@ -0,0 +1,9 @@
1
+ const c = {
2
+ margin: "0 0 24px 0",
3
+ color: "var(--color-grayScale, #1c1c1c)",
4
+ fontSize: "16px",
5
+ lineHeight: "20px"
6
+ };
7
+ export {
8
+ c as baseSearchForStyle
9
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export declare const baseSearchForTermStyle: CSSProperties;
@@ -0,0 +1,8 @@
1
+ const e = {
2
+ fontSize: "20px",
3
+ fontWeight: 700,
4
+ lineHeight: "24px"
5
+ };
6
+ export {
7
+ e as baseSearchForTermStyle
8
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export declare const baseSuggestionLinkHoveredStyle: CSSProperties;
@@ -0,0 +1,7 @@
1
+ const o = {
2
+ background: "var(--color-main, #004A93)",
3
+ color: "var(--color-grayScale-white, #fff)"
4
+ };
5
+ export {
6
+ o as baseSuggestionLinkHoveredStyle
7
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export declare const baseSuggestionLinkStyle: CSSProperties;
@@ -0,0 +1,14 @@
1
+ const o = {
2
+ display: "inline-block",
3
+ padding: "8.5px 8px",
4
+ border: "1px solid var(--color-main, #004A93)",
5
+ borderRadius: "16px",
6
+ color: "var(--color-main, #004A93)",
7
+ fontSize: "11px",
8
+ lineHeight: "15px",
9
+ textTransform: "capitalize",
10
+ textDecoration: "none"
11
+ };
12
+ export {
13
+ o as baseSuggestionLinkStyle
14
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export declare const baseTitleStyle: CSSProperties;
@@ -0,0 +1,9 @@
1
+ const e = {
2
+ margin: 0,
3
+ fontSize: 20,
4
+ lineHeight: "24px",
5
+ color: "var(--color-grayScale, #1c1c1c)"
6
+ };
7
+ export {
8
+ e as baseTitleStyle
9
+ };
@@ -0,0 +1,10 @@
1
+ export interface SearchSuggestionsApiResponse {
2
+ data: {
3
+ searchSuggestions: {
4
+ searches: Searches[];
5
+ };
6
+ };
7
+ }
8
+ export interface Searches {
9
+ term: string;
10
+ }
@@ -0,0 +1,24 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export interface SearchSuggestionsProps {
4
+ searchSuggestions: Array<{
5
+ term: string;
6
+ }>;
7
+ loading: boolean;
8
+ itemsToShow?: number;
9
+ searchFor?: string;
10
+ loadingText?: string;
11
+ searchForText?: string;
12
+ titleText?: string;
13
+ showMoreSuggestionsText?: string;
14
+ showLessSuggestionsText?: string;
15
+ searchForStyle?: CSSProperties;
16
+ searchForTermStyle?: CSSProperties;
17
+ titleStyle?: CSSProperties;
18
+ allSuggestionsContainerStyle?: CSSProperties;
19
+ suggestionLinkStyle?: CSSProperties;
20
+ suggestionLinkHoveredStyle?: CSSProperties;
21
+ buttonStyle?: CSSProperties;
22
+ buttonHoveredStyle?: CSSProperties;
23
+ urlSearch?: string;
24
+ }
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { StyleAnimation } from '../../types/types';
3
+
4
+ interface SkeletonAnimationProps {
5
+ styleAnimation?: StyleAnimation;
6
+ children?: React.ReactNode;
7
+ }
8
+ export declare const SkeletonAnimation: React.FC<SkeletonAnimationProps>;
9
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ const o = ({
3
+ styleAnimation: t
4
+ }) => /* @__PURE__ */ e(
5
+ "div",
6
+ {
7
+ "data-testid": "skeleton-animation",
8
+ style: t,
9
+ className: "skeleton-animation"
10
+ }
11
+ );
12
+ export {
13
+ o as SkeletonAnimation
14
+ };
@@ -0,0 +1,15 @@
1
+ import { default as React, RefObject } from 'react';
2
+ import { StyleContainers } from '../../types/types';
3
+
4
+ interface SkeletonContainerProps {
5
+ skeletonContainer?: RefObject<HTMLDivElement>;
6
+ placeholder?: string;
7
+ styleContainers?: StyleContainers | {
8
+ position: 'relative';
9
+ } | {
10
+ cursor: 'progress';
11
+ };
12
+ children?: React.ReactNode;
13
+ }
14
+ export declare const SkeletonContainer: React.FC<SkeletonContainerProps>;
15
+ export {};
@@ -0,0 +1,22 @@
1
+ import { jsxs as s } from "react/jsx-runtime";
2
+ const a = ({
3
+ children: e,
4
+ skeletonContainer: t,
5
+ placeholder: n,
6
+ styleContainers: o
7
+ }) => /* @__PURE__ */ s(
8
+ "div",
9
+ {
10
+ "data-testid": "skeleton-container",
11
+ ref: t,
12
+ style: o,
13
+ className: "skeleton-container",
14
+ children: [
15
+ n,
16
+ e
17
+ ]
18
+ }
19
+ );
20
+ export {
21
+ a as SkeletonContainer
22
+ };
@@ -0,0 +1,21 @@
1
+ import { default as React, RefObject } from 'react';
2
+ import { StyleContainers, StyleTable, StyleCell, StyleAnimation } from '../../types/types';
3
+
4
+ interface SkeletonRenderProps {
5
+ count: number;
6
+ wrappers: number[];
7
+ rows: number;
8
+ tableRows: number[];
9
+ columns: number;
10
+ tableColumns: number[];
11
+ skeletonContainer?: RefObject<HTMLDivElement>;
12
+ placeholder: string | undefined;
13
+ styleContainers?: StyleContainers;
14
+ styleTable?: StyleTable;
15
+ styleCell?: StyleCell;
16
+ styleAnimation?: StyleAnimation;
17
+ animation: boolean | undefined;
18
+ children?: React.ReactNode;
19
+ }
20
+ export declare const SkeletonRender: React.FC<SkeletonRenderProps>;
21
+ export {};
@@ -0,0 +1,57 @@
1
+ import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
+ import { SkeletonContainer as m } from "../SkeletonContainer/SkeletonContainer.js";
3
+ import { SkeletonWrapper as g } from "../SkeletonWrapper/SkeletonWrapper.js";
4
+ import { SkeletonTable as v } from "../SkeletonTable/SkeletonTable.js";
5
+ import { SkeletonAnimation as f } from "../SkeletonAnimation/SkeletonAnimation.js";
6
+ const w = ({
7
+ count: S,
8
+ wrappers: d,
9
+ rows: i,
10
+ tableRows: k,
11
+ columns: h,
12
+ tableColumns: t,
13
+ skeletonContainer: c,
14
+ placeholder: u,
15
+ styleContainers: o,
16
+ styleTable: x,
17
+ styleCell: j,
18
+ styleAnimation: e,
19
+ animation: p
20
+ }) => S > 0 ? /* @__PURE__ */ r(
21
+ m,
22
+ {
23
+ skeletonContainer: c,
24
+ styleContainers: (o == null ? void 0 : o.cursor) && { cursor: "progress" },
25
+ children: d.map((l) => /* @__PURE__ */ r(
26
+ g,
27
+ {
28
+ styleContainers: o,
29
+ placeholder: u,
30
+ children: p && /* @__PURE__ */ r(f, { styleAnimation: e })
31
+ },
32
+ l
33
+ ))
34
+ }
35
+ ) : i > 0 && h > 0 ? /* @__PURE__ */ b(m, { styleContainers: { position: "relative" }, children: [
36
+ /* @__PURE__ */ r(
37
+ v,
38
+ {
39
+ tableRows: k,
40
+ tableColumns: t,
41
+ styleTable: x,
42
+ styleCell: j
43
+ }
44
+ ),
45
+ p && /* @__PURE__ */ r(f, { styleAnimation: e })
46
+ ] }) : /* @__PURE__ */ r(
47
+ m,
48
+ {
49
+ skeletonContainer: c,
50
+ styleContainers: o,
51
+ placeholder: u,
52
+ children: p && /* @__PURE__ */ r(f, { styleAnimation: e })
53
+ }
54
+ );
55
+ export {
56
+ w as SkeletonRender
57
+ };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { StyleTable, StyleCell } from '../../types/types';
3
+
4
+ interface SkeletonTableProps {
5
+ tableRows: number[];
6
+ tableColumns: number[];
7
+ styleTable?: StyleTable;
8
+ styleCell?: StyleCell;
9
+ children?: React.ReactNode;
10
+ }
11
+ export declare const SkeletonTable: React.FC<SkeletonTableProps>;
12
+ export {};
@@ -0,0 +1,18 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ const c = ({
3
+ tableRows: l,
4
+ tableColumns: t,
5
+ styleTable: s,
6
+ styleCell: a
7
+ }) => /* @__PURE__ */ e(
8
+ "table",
9
+ {
10
+ "data-testid": "skeleton-table",
11
+ style: s,
12
+ className: "skeleton-table",
13
+ children: /* @__PURE__ */ e("tbody", { style: { display: "block" }, children: l.map((o) => /* @__PURE__ */ e("tr", { style: { display: "block" }, children: t.map((d) => /* @__PURE__ */ e("td", { style: a }, d)) }, o)) })
14
+ }
15
+ );
16
+ export {
17
+ c as SkeletonTable
18
+ };
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { StyleContainers } from '../../types/types';
3
+
4
+ interface SkeletonWrapperProps {
5
+ placeholder?: string;
6
+ styleContainers?: StyleContainers;
7
+ children?: React.ReactNode;
8
+ }
9
+ export declare const SkeletonWrapper: React.FC<SkeletonWrapperProps>;
10
+ export {};
@@ -0,0 +1,20 @@
1
+ import { jsxs as s } from "react/jsx-runtime";
2
+ const a = ({
3
+ children: e,
4
+ placeholder: r,
5
+ styleContainers: t
6
+ }) => /* @__PURE__ */ s(
7
+ "div",
8
+ {
9
+ "data-testid": "skeleton-wrapper",
10
+ style: t,
11
+ className: "skeleton-wrapper",
12
+ children: [
13
+ r,
14
+ e
15
+ ]
16
+ }
17
+ );
18
+ export {
19
+ a as SkeletonWrapper
20
+ };
@@ -0,0 +1,9 @@
1
+ import { ResponsiveImage } from '../types/types';
2
+
3
+ declare const useResponsiveImages: (responsiveImage: undefined | ResponsiveImage | ResponsiveImage[], responsiveImageSSR: undefined | ResponsiveImage) => {
4
+ srcWidth: number;
5
+ srcHeight: number;
6
+ widthSkeletonContainer: number;
7
+ skeletonContainer: import('react').MutableRefObject<HTMLDivElement | null>;
8
+ };
9
+ export default useResponsiveImages;
@@ -0,0 +1,34 @@
1
+ import { useRef as B, useState as f, useEffect as b } from "react";
2
+ const E = (t, c) => {
3
+ const d = B(null), [e, l] = f(0), [u, w] = f(0), [o, h] = f(0), [y, k] = f(0), W = () => {
4
+ d.current && (l(d.current.offsetWidth), w(window.innerWidth));
5
+ }, H = (i) => {
6
+ i.sort((n, r) => n.breakIn && r.breakIn ? n.breakIn > r.breakIn ? 1 : -1 : !n.breakIn && r.breakIn ? 1 : n.breakIn && !r.breakIn ? -1 : n.srcWidth > r.srcWidth ? 1 : -1);
7
+ }, A = (i) => {
8
+ i.sort((n, r) => n.breakIn && r.breakIn && n.breakIn === r.breakIn ? n.srcWidth > r.srcWidth ? 1 : -1 : 0);
9
+ };
10
+ return b(() => (!c && t && window.addEventListener("resize", () => W()), () => window.removeEventListener("resize", () => W())), [t, c]), b(() => {
11
+ t && !c && (W(), Array.isArray(t) ? (H(t), A(t), h(t[0].srcWidth), k(t[0].srcHeight)) : (h(t.srcWidth), k(t.srcHeight)));
12
+ }, [d, t, c]), b(() => {
13
+ if (!c && t && Array.isArray(t) && t[0].breakIn)
14
+ for (const i in t) {
15
+ const n = t[i], r = t[+i + 1];
16
+ if (t[0].breakIn && t[0].breakIn >= u) {
17
+ h(t[0].srcWidth), k(t[0].srcHeight);
18
+ break;
19
+ }
20
+ if (n.breakIn !== void 0 && n.breakIn <= u && r) {
21
+ h(r.srcWidth), k(r.srcHeight);
22
+ break;
23
+ }
24
+ }
25
+ }, [u, t, c]), {
26
+ srcWidth: o,
27
+ srcHeight: y,
28
+ widthSkeletonContainer: e,
29
+ skeletonContainer: d
30
+ };
31
+ };
32
+ export {
33
+ E as default
34
+ };
@@ -0,0 +1,32 @@
1
+ import { default as React } from 'react';
2
+ import { ResponsiveImage } from './types/types';
3
+
4
+ export interface SkeletonProps {
5
+ width?: number | string;
6
+ height?: number | string;
7
+ margin?: number | 'auto';
8
+ padding?: number;
9
+ border?: true;
10
+ borderColor?: string;
11
+ borderRadius?: number;
12
+ circle?: true;
13
+ backgroundColor?: string;
14
+ color?: string;
15
+ cursor?: true;
16
+ placeholder?: string;
17
+ placeholderPosition?: {
18
+ horizontal: 'left' | 'center' | 'right';
19
+ vertical: 'top' | 'center' | 'bottom';
20
+ };
21
+ animation?: true;
22
+ animationColor?: string;
23
+ animationDuration?: number;
24
+ count?: number;
25
+ responsiveImage?: ResponsiveImage | ResponsiveImage[];
26
+ responsiveImageSSR?: ResponsiveImage;
27
+ table?: {
28
+ rows: number;
29
+ columns: number;
30
+ };
31
+ }
32
+ export declare const Skeleton: React.FC<SkeletonProps>;
@@ -0,0 +1,91 @@
1
+ import { jsx as E } from "react/jsx-runtime";
2
+ import { SkeletonRender as F } from "./components/SkeletonRender/SkeletonRender.js";
3
+ import G from "./hooks/useResponsiveImages.js";
4
+ import J from "./utils/createStyleContainers.js";
5
+ import K from "./utils/createStyleTable.js";
6
+ import L from "./utils/createStyleCell.js";
7
+ import M from "./utils/createStyleAnimation.js";
8
+ const $ = (h) => {
9
+ const {
10
+ width: s,
11
+ height: i = "1em",
12
+ margin: l,
13
+ padding: g,
14
+ border: a,
15
+ borderColor: c,
16
+ borderRadius: y,
17
+ circle: C,
18
+ backgroundColor: m = "#ccc",
19
+ color: b,
20
+ cursor: d,
21
+ placeholder: S,
22
+ placeholderPosition: o,
23
+ animation: t,
24
+ animationColor: w,
25
+ animationDuration: v,
26
+ count: r = 0,
27
+ responsiveImage: p,
28
+ responsiveImageSSR: f,
29
+ table: e = { rows: 0, columns: 0 }
30
+ } = h, { skeletonContainer: x, widthSkeletonContainer: k, srcWidth: R, srcHeight: A } = G(p, f), u = {
31
+ left: "flex-start",
32
+ top: "flex-start",
33
+ center: "center",
34
+ right: "flex-end",
35
+ bottom: "flex-end"
36
+ }, I = o ? u[o.horizontal] : void 0, P = o ? u[o.vertical] : void 0, n = (q) => Array.from({ length: q }, (N, B) => B), j = n(r), T = n(e.rows), z = n(e.columns), D = J({
37
+ width: s,
38
+ height: i,
39
+ margin: l,
40
+ padding: g,
41
+ border: a,
42
+ borderColor: c,
43
+ borderRadius: y,
44
+ circle: C,
45
+ backgroundColor: m,
46
+ color: b,
47
+ cursor: d,
48
+ placeholderPosition: o,
49
+ justifyContent: I,
50
+ alignItems: P,
51
+ animation: t,
52
+ count: r,
53
+ responsiveImage: p,
54
+ responsiveImageSSR: f,
55
+ widthSkeletonContainer: k,
56
+ srcWidth: R,
57
+ srcHeight: A
58
+ }), H = K({
59
+ width: s,
60
+ cursor: d,
61
+ animation: t
62
+ }), W = L({
63
+ height: i,
64
+ margin: l,
65
+ border: a,
66
+ borderColor: c,
67
+ backgroundColor: m,
68
+ table: e
69
+ }), _ = M(w, v);
70
+ return /* @__PURE__ */ E(
71
+ F,
72
+ {
73
+ count: r,
74
+ wrappers: j,
75
+ rows: e.rows,
76
+ tableRows: T,
77
+ columns: e.columns,
78
+ tableColumns: z,
79
+ skeletonContainer: x,
80
+ placeholder: S,
81
+ styleContainers: D,
82
+ styleTable: H,
83
+ styleCell: W,
84
+ styleAnimation: _,
85
+ animation: t
86
+ }
87
+ );
88
+ };
89
+ export {
90
+ $ as Skeleton
91
+ };
@@ -0,0 +1,42 @@
1
+ export interface ResponsiveImage {
2
+ srcWidth: number;
3
+ srcHeight: number;
4
+ breakIn?: number;
5
+ }
6
+ export type NumberStringUndefined = number | string | undefined;
7
+ export interface StyleContainers {
8
+ position: 'relative' | undefined;
9
+ display: 'flex' | undefined;
10
+ justifyContent: string | undefined;
11
+ alignItems: string | undefined;
12
+ width: NumberStringUndefined;
13
+ height: NumberStringUndefined;
14
+ margin: NumberStringUndefined;
15
+ padding: number | undefined;
16
+ paddingTop: string | undefined;
17
+ border: '1px solid' | undefined;
18
+ borderColor: string | undefined;
19
+ borderRadius: NumberStringUndefined;
20
+ backgroundColor: string;
21
+ color: string | undefined;
22
+ cursor: 'progress' | undefined;
23
+ }
24
+ export interface StyleTable {
25
+ position: 'relative' | undefined;
26
+ display: 'block';
27
+ width: NumberStringUndefined;
28
+ cursor: 'progress' | undefined;
29
+ }
30
+ export interface StyleCell {
31
+ display: 'inline-block';
32
+ width: NumberStringUndefined;
33
+ height: number | string;
34
+ margin: number | 'auto';
35
+ border: '1px solid' | undefined;
36
+ borderColor: string | undefined;
37
+ backgroundColor: string;
38
+ }
39
+ export interface StyleAnimation {
40
+ backgroundColor: string | '#ddd';
41
+ animationDuration: string | '3000ms';
42
+ }
@@ -0,0 +1,7 @@
1
+ import { StyleAnimation } from '../types/types';
2
+
3
+ interface CreateStyleAnimation {
4
+ (animationColor?: string, animationDuration?: number): StyleAnimation;
5
+ }
6
+ declare const createStyleAnimation: CreateStyleAnimation;
7
+ export default createStyleAnimation;
@@ -0,0 +1,7 @@
1
+ const o = (e, t) => ({
2
+ backgroundColor: e ?? "#ddd",
3
+ animationDuration: t ? `${t}ms` : "3000ms"
4
+ });
5
+ export {
6
+ o as default
7
+ };
@@ -0,0 +1,18 @@
1
+ import { StyleCell } from '../types/types';
2
+
3
+ interface CreateStyleCellParams {
4
+ height: number | string;
5
+ margin: number | 'auto' | undefined;
6
+ border: true | undefined;
7
+ borderColor: string | undefined;
8
+ backgroundColor: string;
9
+ table: {
10
+ rows: number;
11
+ columns: number;
12
+ };
13
+ }
14
+ interface CreateStyleCell {
15
+ (params: CreateStyleCellParams): StyleCell;
16
+ }
17
+ declare const createStyleCell: CreateStyleCell;
18
+ export default createStyleCell;
@@ -0,0 +1,19 @@
1
+ const s = ({
2
+ height: e,
3
+ margin: l,
4
+ border: o,
5
+ borderColor: t,
6
+ backgroundColor: d,
7
+ table: c
8
+ }) => ({
9
+ display: "inline-block",
10
+ backgroundColor: d,
11
+ width: l !== "auto" && l ? `calc(100% / ${c.columns} - ${3 * l}px)` : `calc(100% / ${c.columns} - 6px)`,
12
+ height: e,
13
+ margin: l ?? 2,
14
+ border: o ? "1px solid" : void 0,
15
+ borderColor: o && (t ?? "#000")
16
+ });
17
+ export {
18
+ s as default
19
+ };
@@ -0,0 +1,33 @@
1
+ import { ResponsiveImage, StyleContainers, NumberStringUndefined } from '../types/types';
2
+
3
+ interface CreateStyleContainerParams {
4
+ width: NumberStringUndefined;
5
+ height: number | string;
6
+ margin: NumberStringUndefined;
7
+ padding: number | undefined;
8
+ border: true | undefined;
9
+ borderColor: string | undefined;
10
+ borderRadius: number | undefined;
11
+ circle: true | undefined;
12
+ backgroundColor: string;
13
+ color: string | undefined;
14
+ cursor: true | undefined;
15
+ placeholderPosition: {
16
+ horizontal: string;
17
+ vertical: string;
18
+ } | undefined;
19
+ justifyContent: string | undefined;
20
+ alignItems: string | undefined;
21
+ animation: true | undefined;
22
+ count: number;
23
+ responsiveImage: ResponsiveImage | ResponsiveImage[] | undefined;
24
+ responsiveImageSSR: ResponsiveImage | undefined;
25
+ widthSkeletonContainer: number;
26
+ srcWidth: number | undefined;
27
+ srcHeight: number | undefined;
28
+ }
29
+ interface CreateStyleContainer {
30
+ (params: CreateStyleContainerParams): StyleContainers;
31
+ }
32
+ declare const createStyleContainers: CreateStyleContainer;
33
+ export default createStyleContainers;
@@ -0,0 +1,45 @@
1
+ const q = ({
2
+ width: e,
3
+ height: s,
4
+ margin: i,
5
+ padding: a,
6
+ border: t,
7
+ borderColor: c,
8
+ borderRadius: d,
9
+ circle: v,
10
+ backgroundColor: l,
11
+ color: p,
12
+ cursor: g,
13
+ placeholderPosition: h,
14
+ justifyContent: u,
15
+ alignItems: x,
16
+ animation: C,
17
+ count: f,
18
+ responsiveImage: b,
19
+ responsiveImageSSR: o,
20
+ widthSkeletonContainer: y,
21
+ srcWidth: r,
22
+ srcHeight: n
23
+ }) => {
24
+ const H = f > 0 ? "0 0 5px 0" : void 0, T = v ? "50%" : void 0, $ = b ? r && n && y * n / r : s, j = o ? void 0 : $, k = o ? `${o.srcHeight * 100 / o.srcWidth}%` : void 0;
25
+ return {
26
+ position: C ? "relative" : void 0,
27
+ width: e,
28
+ height: j,
29
+ margin: i || H,
30
+ padding: a,
31
+ paddingTop: k,
32
+ border: t ? "1px solid" : void 0,
33
+ borderColor: t && (c ?? "#000"),
34
+ borderRadius: d || T,
35
+ backgroundColor: l,
36
+ color: p,
37
+ cursor: g ? "progress" : void 0,
38
+ display: h ? "flex" : void 0,
39
+ justifyContent: u,
40
+ alignItems: x
41
+ };
42
+ };
43
+ export {
44
+ q as default
45
+ };
@@ -0,0 +1,12 @@
1
+ import { StyleTable, NumberStringUndefined } from '../types/types';
2
+
3
+ interface CreateStyleTableParams {
4
+ width: NumberStringUndefined;
5
+ animation: true | undefined;
6
+ cursor: true | undefined;
7
+ }
8
+ interface CreateStyleTable {
9
+ (params: CreateStyleTableParams): StyleTable;
10
+ }
11
+ declare const createStyleTable: CreateStyleTable;
12
+ export default createStyleTable;
@@ -0,0 +1,9 @@
1
+ const t = ({ width: e, animation: o, cursor: r }) => ({
2
+ display: "block",
3
+ width: e,
4
+ position: o ? "relative" : void 0,
5
+ cursor: r ? "progress" : void 0
6
+ });
7
+ export {
8
+ t as default
9
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@plurix/ecom-components",
3
3
  "author": "Plurix",
4
4
  "private": false,
5
- "version": "1.11.5",
5
+ "version": "1.12.0",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",