@scbt-ecom/ui 0.88.0 → 0.89.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 (38) hide show
  1. package/dist/hooks.js +26 -40
  2. package/dist/hooks.js.map +1 -1
  3. package/dist/{index-B6tiFtIj.js → index-BFZfRLgg.js} +1916 -1913
  4. package/dist/index-BFZfRLgg.js.map +1 -0
  5. package/dist/lib/shared/hooks/index.d.ts +1 -1
  6. package/dist/lib/shared/hooks/useObserverWidgets.d.ts +7 -0
  7. package/dist/lib/shared/ui/customLink/index.d.ts +1 -1
  8. package/dist/lib/shared/ui/customLink/model/helpers.d.ts +2 -2
  9. package/dist/lib/shared/ui/icon/allowedIcons.d.ts +3 -3
  10. package/dist/lib/shared/ui/icon/iconsMap.d.ts +12 -0
  11. package/dist/lib/shared/ui/popover/Popover.d.ts +2 -1
  12. package/dist/lib/widgets/index.d.ts +1 -0
  13. package/dist/lib/widgets/userFeedback/UserFeedback.d.ts +11 -0
  14. package/dist/lib/widgets/userFeedback/index.d.ts +1 -0
  15. package/dist/lib/widgets/userFeedback/model/hooks/index.d.ts +1 -0
  16. package/dist/lib/widgets/userFeedback/model/hooks/useRating.d.ts +9 -0
  17. package/dist/lib/widgets/userFeedback/model/index.d.ts +3 -0
  18. package/dist/lib/widgets/userFeedback/model/schema.d.ts +8 -0
  19. package/dist/lib/widgets/userFeedback/model/types.d.ts +8 -0
  20. package/dist/lib/widgets/userFeedback/ui/FeedbackTrigger.d.ts +1 -0
  21. package/dist/lib/widgets/userFeedback/ui/SelectRating.d.ts +4 -0
  22. package/dist/lib/widgets/userFeedback/ui/Success.d.ts +3 -0
  23. package/dist/lib/widgets/userFeedback/ui/UserReviewForm.d.ts +7 -0
  24. package/dist/lib/widgets/userFeedback/ui/index.d.ts +4 -0
  25. package/dist/static/static/general/heart.svg +12 -0
  26. package/dist/static/static/status/succesCircle.svg +14 -0
  27. package/dist/ui.js +8 -5
  28. package/dist/ui.js.map +1 -1
  29. package/dist/useDebounce-5MeprqTX.js.map +1 -1
  30. package/dist/useFieldsProgress-C918amw-.js +41 -0
  31. package/dist/useFieldsProgress-C918amw-.js.map +1 -0
  32. package/dist/widget.js +1334 -1214
  33. package/dist/widget.js.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/index-B6tiFtIj.js.map +0 -1
  36. package/dist/lib/shared/hooks/useObserveElements.d.ts +0 -1
  37. package/dist/useFieldsProgress-CUlFPv4E.js +0 -26
  38. package/dist/useFieldsProgress-CUlFPv4E.js.map +0 -1
package/dist/hooks.js CHANGED
@@ -1,51 +1,37 @@
1
- import { d as x, a as C, b as I, c as A, e as L, u as O } from "./useDebounce-5MeprqTX.js";
2
- import { u as D, a as F } from "./useFieldsProgress-CUlFPv4E.js";
3
- import { useState as b, useEffect as m } from "react";
4
- const h = (i, r, t = !1) => {
5
- const [a, l] = b(t);
6
- return m(() => {
7
- const o = new IntersectionObserver((s) => {
8
- const c = s.filter((e) => e.isIntersecting).map((e) => e.target.id);
9
- l(c.some((e) => i.includes(e)));
10
- }, r), n = /* @__PURE__ */ new Map();
11
- return i.forEach((s) => {
12
- const c = document.getElementById(s);
13
- n.set(s, c), c && o.observe(c);
14
- }), () => {
15
- o.disconnect();
16
- };
17
- }, [i, r]), a;
18
- }, E = (i, r, t) => {
19
- const [a, l] = b(null);
20
- return m(() => {
1
+ import { d as C, a as E, b as A, c as L, e as R, u as f } from "./useDebounce-5MeprqTX.js";
2
+ import { u as F, b as H, a as O } from "./useFieldsProgress-C918amw-.js";
3
+ import { useState as p, useEffect as w } from "react";
4
+ const v = (r, n, e) => {
5
+ const [a, l] = p(null);
6
+ return w(() => {
21
7
  const o = () => {
22
- if (i.current && r.current) {
23
- const n = i.current.getBoundingClientRect(), s = r.current.getBoundingClientRect(), c = window.innerHeight;
24
- let e, u;
25
- const d = c - n.bottom;
26
- d >= s.height + t ? (e = n.bottom + t, u = "top") : n.top >= s.height + t ? (e = n.top - s.height - t * 2, u = "bottom") : (e = n.bottom + t, u = "top", r.current.style.maxHeight = `${d - t}px`), l({
27
- top: e,
28
- width: n.width,
29
- left: n.left,
30
- transformOrigin: u
8
+ if (r.current && n.current) {
9
+ const t = r.current.getBoundingClientRect(), c = n.current.getBoundingClientRect(), d = window.innerHeight;
10
+ let s, i;
11
+ const u = d - t.bottom;
12
+ u >= c.height + e ? (s = t.bottom + e, i = "top") : t.top >= c.height + e ? (s = t.top - c.height - e * 2, i = "bottom") : (s = t.bottom + e, i = "top", n.current.style.maxHeight = `${u - e}px`), l({
13
+ top: s,
14
+ width: t.width,
15
+ left: t.left,
16
+ transformOrigin: i
31
17
  });
32
18
  }
33
19
  };
34
20
  return o(), window.addEventListener("resize", o), window.addEventListener("orientationchange", o), () => {
35
21
  window.removeEventListener("resize", o), window.removeEventListener("orientationchange", o);
36
22
  };
37
- }, [i.current, r.current, t]), a;
23
+ }, [r.current, n.current, e]), a;
38
24
  };
39
25
  export {
40
- x as debounce,
41
- D as useBoolean,
42
- C as useClickOutside,
43
- I as useControlledForm,
44
- A as useDebounceCallback,
45
- L as useDebounceValue,
46
- O as useDevice,
47
- F as useFieldsProgress,
48
- E as useFloating,
49
- h as useObserveElements
26
+ C as debounce,
27
+ F as useBoolean,
28
+ E as useClickOutside,
29
+ A as useControlledForm,
30
+ L as useDebounceCallback,
31
+ R as useDebounceValue,
32
+ f as useDevice,
33
+ H as useFieldsProgress,
34
+ v as useFloating,
35
+ O as useObserverWidgets
50
36
  };
51
37
  //# sourceMappingURL=hooks.js.map
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sources":["../lib/shared/hooks/useObserveElements.ts","../lib/shared/hooks/useFloating.ts"],"sourcesContent":["'use client'\n\nimport { useEffect, useState } from 'react'\n\nexport const useObserveElements = (ids: string[], options?: IntersectionObserverInit, initialState = false): boolean => {\n const [isVisible, setIsVisible] = useState(initialState)\n\n useEffect(() => {\n const observer = new IntersectionObserver((entries) => {\n const visibleIds = entries.filter((entry) => entry.isIntersecting).map((entry) => entry.target.id)\n setIsVisible(visibleIds.some((id) => ids.includes(id)))\n }, options)\n\n const elementsMap = new Map<string, HTMLElement | null>()\n\n ids.forEach((id) => {\n const element = document.getElementById(id)\n elementsMap.set(id, element)\n if (element) {\n observer.observe(element)\n }\n })\n\n return () => {\n observer.disconnect()\n }\n }, [ids, options])\n\n return isVisible\n}\n","'use client'\n\nimport { useEffect, useState } from 'react'\n\ntype FloatingPosition = {\n top?: number\n left?: number\n width?: number\n transformOrigin?: string\n}\n\nexport const useFloating = (\n trigger: React.RefObject<HTMLElement>,\n list: React.RefObject<HTMLElement>,\n offset: number\n): FloatingPosition | null => {\n const [position, setPosition] = useState<FloatingPosition | null>(null)\n\n useEffect(() => {\n const updatePosition = () => {\n if (trigger.current && list.current) {\n const triggerRect = trigger.current.getBoundingClientRect()\n const listRect = list.current.getBoundingClientRect()\n const viewportHeight = window.innerHeight\n\n let top: number\n let transformOrigin: string\n\n const spaceBelow = viewportHeight - triggerRect.bottom\n const fitsBelow = spaceBelow >= listRect.height + offset\n\n if (fitsBelow) {\n top = triggerRect.bottom + offset\n transformOrigin = 'top'\n } else {\n const spaceAbove = triggerRect.top\n const fitsAbove = spaceAbove >= listRect.height + offset\n\n if (fitsAbove) {\n top = triggerRect.top - listRect.height - offset * 2\n transformOrigin = 'bottom'\n } else {\n top = triggerRect.bottom + offset\n transformOrigin = 'top'\n list.current.style.maxHeight = `${spaceBelow - offset}px`\n }\n }\n\n setPosition({\n top,\n width: triggerRect.width,\n left: triggerRect.left,\n transformOrigin\n })\n }\n }\n\n updatePosition()\n window.addEventListener('resize', updatePosition)\n window.addEventListener('orientationchange', updatePosition)\n\n return () => {\n window.removeEventListener('resize', updatePosition)\n window.removeEventListener('orientationchange', updatePosition)\n }\n }, [trigger.current, list.current, offset])\n\n return position\n}\n"],"names":["useObserveElements","ids","options","initialState","isVisible","setIsVisible","useState","useEffect","observer","entries","visibleIds","entry","id","elementsMap","element","useFloating","trigger","list","offset","position","setPosition","updatePosition","triggerRect","listRect","viewportHeight","top","transformOrigin","spaceBelow"],"mappings":";;;AAIO,MAAMA,IAAqB,CAACC,GAAeC,GAAoCC,IAAe,OAAmB;AACtH,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAASH,CAAY;AAEvD,SAAAI,EAAU,MAAM;AACd,UAAMC,IAAW,IAAI,qBAAqB,CAACC,MAAY;AACrD,YAAMC,IAAaD,EAAQ,OAAO,CAACE,MAAUA,EAAM,cAAc,EAAE,IAAI,CAACA,MAAUA,EAAM,OAAO,EAAE;AACpF,MAAAN,EAAAK,EAAW,KAAK,CAACE,MAAOX,EAAI,SAASW,CAAE,CAAC,CAAC;AAAA,OACrDV,CAAO,GAEJW,wBAAkB,IAAgC;AAEpD,WAAAZ,EAAA,QAAQ,CAACW,MAAO;AACZ,YAAAE,IAAU,SAAS,eAAeF,CAAE;AAC9B,MAAAC,EAAA,IAAID,GAAIE,CAAO,GACvBA,KACFN,EAAS,QAAQM,CAAO;AAAA,IAC1B,CACD,GAEM,MAAM;AACX,MAAAN,EAAS,WAAW;AAAA,IACtB;AAAA,EAAA,GACC,CAACP,GAAKC,CAAO,CAAC,GAEVE;AACT,GClBaW,IAAc,CACzBC,GACAC,GACAC,MAC4B;AAC5B,QAAM,CAACC,GAAUC,CAAW,IAAId,EAAkC,IAAI;AAEtE,SAAAC,EAAU,MAAM;AACd,UAAMc,IAAiB,MAAM;AACvB,UAAAL,EAAQ,WAAWC,EAAK,SAAS;AAC7B,cAAAK,IAAcN,EAAQ,QAAQ,sBAAsB,GACpDO,IAAWN,EAAK,QAAQ,sBAAsB,GAC9CO,IAAiB,OAAO;AAE1B,YAAAC,GACAC;AAEE,cAAAC,IAAaH,IAAiBF,EAAY;AAGhD,QAFkBK,KAAcJ,EAAS,SAASL,KAGhDO,IAAMH,EAAY,SAASJ,GACTQ,IAAA,SAECJ,EAAY,OACCC,EAAS,SAASL,KAGhDO,IAAMH,EAAY,MAAMC,EAAS,SAASL,IAAS,GACjCQ,IAAA,aAElBD,IAAMH,EAAY,SAASJ,GACTQ,IAAA,OAClBT,EAAK,QAAQ,MAAM,YAAY,GAAGU,IAAaT,CAAM,OAI7CE,EAAA;AAAA,UACV,KAAAK;AAAA,UACA,OAAOH,EAAY;AAAA,UACnB,MAAMA,EAAY;AAAA,UAClB,iBAAAI;AAAA,QAAA,CACD;AAAA,MAAA;AAAA,IAEL;AAEe,WAAAL,EAAA,GACR,OAAA,iBAAiB,UAAUA,CAAc,GACzC,OAAA,iBAAiB,qBAAqBA,CAAc,GAEpD,MAAM;AACJ,aAAA,oBAAoB,UAAUA,CAAc,GAC5C,OAAA,oBAAoB,qBAAqBA,CAAc;AAAA,IAChE;AAAA,EAAA,GACC,CAACL,EAAQ,SAASC,EAAK,SAASC,CAAM,CAAC,GAEnCC;AACT;"}
1
+ {"version":3,"file":"hooks.js","sources":["../lib/shared/hooks/useFloating.ts"],"sourcesContent":["'use client'\n\nimport { useEffect, useState } from 'react'\n\ntype FloatingPosition = {\n top?: number\n left?: number\n width?: number\n transformOrigin?: string\n}\n\nexport const useFloating = (\n trigger: React.RefObject<HTMLElement>,\n list: React.RefObject<HTMLElement>,\n offset: number\n): FloatingPosition | null => {\n const [position, setPosition] = useState<FloatingPosition | null>(null)\n\n useEffect(() => {\n const updatePosition = () => {\n if (trigger.current && list.current) {\n const triggerRect = trigger.current.getBoundingClientRect()\n const listRect = list.current.getBoundingClientRect()\n const viewportHeight = window.innerHeight\n\n let top: number\n let transformOrigin: string\n\n const spaceBelow = viewportHeight - triggerRect.bottom\n const fitsBelow = spaceBelow >= listRect.height + offset\n\n if (fitsBelow) {\n top = triggerRect.bottom + offset\n transformOrigin = 'top'\n } else {\n const spaceAbove = triggerRect.top\n const fitsAbove = spaceAbove >= listRect.height + offset\n\n if (fitsAbove) {\n top = triggerRect.top - listRect.height - offset * 2\n transformOrigin = 'bottom'\n } else {\n top = triggerRect.bottom + offset\n transformOrigin = 'top'\n list.current.style.maxHeight = `${spaceBelow - offset}px`\n }\n }\n\n setPosition({\n top,\n width: triggerRect.width,\n left: triggerRect.left,\n transformOrigin\n })\n }\n }\n\n updatePosition()\n window.addEventListener('resize', updatePosition)\n window.addEventListener('orientationchange', updatePosition)\n\n return () => {\n window.removeEventListener('resize', updatePosition)\n window.removeEventListener('orientationchange', updatePosition)\n }\n }, [trigger.current, list.current, offset])\n\n return position\n}\n"],"names":["useFloating","trigger","list","offset","position","setPosition","useState","useEffect","updatePosition","triggerRect","listRect","viewportHeight","top","transformOrigin","spaceBelow"],"mappings":";;;AAWO,MAAMA,IAAc,CACzBC,GACAC,GACAC,MAC4B;AAC5B,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAkC,IAAI;AAEtE,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAiB,MAAM;AACvB,UAAAP,EAAQ,WAAWC,EAAK,SAAS;AAC7B,cAAAO,IAAcR,EAAQ,QAAQ,sBAAsB,GACpDS,IAAWR,EAAK,QAAQ,sBAAsB,GAC9CS,IAAiB,OAAO;AAE1B,YAAAC,GACAC;AAEE,cAAAC,IAAaH,IAAiBF,EAAY;AAGhD,QAFkBK,KAAcJ,EAAS,SAASP,KAGhDS,IAAMH,EAAY,SAASN,GACTU,IAAA,SAECJ,EAAY,OACCC,EAAS,SAASP,KAGhDS,IAAMH,EAAY,MAAMC,EAAS,SAASP,IAAS,GACjCU,IAAA,aAElBD,IAAMH,EAAY,SAASN,GACTU,IAAA,OAClBX,EAAK,QAAQ,MAAM,YAAY,GAAGY,IAAaX,CAAM,OAI7CE,EAAA;AAAA,UACV,KAAAO;AAAA,UACA,OAAOH,EAAY;AAAA,UACnB,MAAMA,EAAY;AAAA,UAClB,iBAAAI;AAAA,QAAA,CACD;AAAA,MAAA;AAAA,IAEL;AAEe,WAAAL,EAAA,GACR,OAAA,iBAAiB,UAAUA,CAAc,GACzC,OAAA,iBAAiB,qBAAqBA,CAAc,GAEpD,MAAM;AACJ,aAAA,oBAAoB,UAAUA,CAAc,GAC5C,OAAA,oBAAoB,qBAAqBA,CAAc;AAAA,IAChE;AAAA,EAAA,GACC,CAACP,EAAQ,SAASC,EAAK,SAASC,CAAM,CAAC,GAEnCC;AACT;"}