lm-web-controls 1.2.4 → 1.2.6

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.
@@ -1 +1 @@
1
- var n=function(){return n=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},n.apply(this,arguments)};function e(n,e,t,r){return new(t||(t=Promise))((function(o,a){function u(n){try{i(r.next(n))}catch(n){a(n)}}function c(n){try{i(r.throw(n))}catch(n){a(n)}}function i(n){var e;n.done?o(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(u,c)}i((r=r.apply(n,e||[])).next())}))}function t(n,e){var t,r,o,a,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(u=0)),u;)try{if(t=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(n,u)}catch(n){c=[6,n],r=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}"function"==typeof SuppressedError&&SuppressedError;export{n as __assign,e as __awaiter,t as __generator};
1
+ var r=function(){return r=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);return r},r.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;export{r as __assign};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{__awaiter as e,__generator as n}from"../../_virtual/_tslib.js";import t,{useState as a,useEffect as r}from"react";var i=function(e){var n=e.question,r=e.answer,i=e.icon,c=a(!1),s=c[0],o=c[1];return t.createElement("div",{className:"faq-item",onClick:function(){return o(!s)}},t.createElement("div",{className:"faq-question-container"},t.createElement("h3",{className:"faq-question"},n),t.createElement("img",{src:i,alt:"Toggle icon",className:"faq-icon ".concat(s?"rotate":"")})),t.createElement("div",{className:"faq-answer ".concat(s?"open":"closed")},t.createElement("p",null,r)))};function c(c){var s=this,o=c.faqSlug,l=c.title,u=void 0===l?"Frequently Asked Questions":l,m=c.icon,f=void 0===m?"../../images/accordion.png":m,q=a([]),d=q[0],v=q[1];return r((function(){o&&e(s,void 0,void 0,(function(){var e,t,a,r;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,fetch("https://client-api.leadmetrics.ai/api/client/v1/faqs/".concat(o),{headers:{"Api-Key":process.env.NEXT_PUBLIC_API_KEY||""}})];case 1:if(!(e=n.sent()).ok)throw new Error("Failed to fetch FAQs");return[4,e.json()];case 2:return t=n.sent(),a=t.items.map((function(e){return{question:e.question,answer:e.answer||"No answer provided.",icon:f}})),v(a),[3,4];case 3:return r=n.sent(),console.error(r),[3,4];case 4:return[2]}}))}))}),[o,f]),t.createElement("div",{className:"faq-main-container"},t.createElement("h2",{className:"faq-title"},u),t.createElement("div",{className:"faq-inner-container"},d.map((function(e,n){return t.createElement(i,{key:n,question:e.question,answer:e.answer,icon:e.icon})}))))}export{c as Faq};
2
+ import e,{useState as a}from"react";var n=function(n){var t=n.question,c=n.answer,r=n.icon,s=a(!1),i=s[0],l=s[1];return e.createElement("div",{className:"faq-item",onClick:function(){return l(!i)}},e.createElement("div",{className:"faq-question-container"},e.createElement("h3",{className:"faq-question"},t),e.createElement("img",{src:r,alt:"Toggle icon",className:"faq-icon ".concat(i?"rotate":"")})),e.createElement("div",{className:"faq-answer ".concat(i?"open":"closed")},e.createElement("p",null,c)))};function t(a){var t=a.faq,c=a.title,r=void 0===c?"Frequently Asked Questions":c,s=a.icon,i=void 0===s?"../../images/accordion.png":s,l=Array.isArray(t)?t:t.items;return e.createElement("div",{className:"faq-main-container"},e.createElement("h2",{className:"faq-title"},r),e.createElement("div",{className:"faq-inner-container"},l.length?l.map((function(a,t){return e.createElement(n,{key:t,question:a.question,answer:a.answer,icon:i})})):e.createElement("div",{className:"skeleton-container"},e.createElement("div",{className:"skeleton"}),e.createElement("div",{className:"skeleton"}))))}export{t as Faq};
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ .lm-slider{width:100%}.lm-back-to-top{align-items:center;display:flex;justify-content:center;position:fixed;transition-duration:.2s}.lm-back-to-top-svg{width:50%}.lm-hide-scroll-btn{transform:translateY(6rem)}.left-margin-xs{margin-left:5px}.reading-progress-bar-container{background-color:transparent;height:5px;left:0;position:fixed;top:0;width:100%;z-index:1000}.reading-progress-bar{height:100%;transform-origin:left;transition:width .2s ease-out}.faq-items{margin-top:1.5rem;width:100%}.faq-item{cursor:pointer;display:flex;flex-direction:column;transition:all .3s ease}.faq-question-container{align-items:center;display:flex;justify-content:space-between}.faq-icon{height:24px;transition:transform .3s ease;width:24px}.rotate{transform:rotate(45deg)}.faq-answer{max-height:0;opacity:0;overflow:hidden;transition:max-height .5s ease,opacity .5s ease}.faq-answer.open{max-height:360px;opacity:1}.skeleton-container{display:flex;flex-direction:column;gap:.5rem;width:100%}.skeleton{background-color:#e1e2e6;border-radius:.375rem;min-height:80px;overflow:hidden;position:relative;width:100%;&:after{animation:wave 1.5s linear infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.4),transparent);content:"";height:100%;left:0;position:absolute;top:0;width:100%}}@keyframes wave{0%{transform:translateX(-100%)}to{transform:translateX(100%)}}
@@ -1 +1,103 @@
1
- .lm-slider{width:100%}.lm-back-to-top{align-items:center;display:flex;justify-content:center;position:fixed;transition-duration:.2s}.lm-back-to-top-svg{width:50%}.lm-hide-scroll-btn{transform:translateY(6rem)}.left-margin-xs{margin-left:5px}.reading-progress-bar-container{background-color:transparent;height:5px;left:0;position:fixed;top:0;width:100%;z-index:1000}.reading-progress-bar{height:100%;transform-origin:left;transition:width .2s ease-out}.faq-items{margin-top:1.5rem;width:100%}.faq-item{cursor:pointer;display:flex;flex-direction:column;transition:all .3s ease}.faq-question-container{align-items:center;display:flex;justify-content:space-between}.faq-icon{height:24px;transition:transform .3s ease;width:24px}.rotate{transform:rotate(45deg)}.faq-answer{max-height:0;opacity:0;overflow:hidden;transition:max-height .5s ease,opacity .5s ease}.faq-answer.open{max-height:360px;opacity:1}
1
+ .lm-slider {
2
+ width: 100%;
3
+ }
4
+ .lm-back-to-top {
5
+ align-items: center;
6
+ display: flex;
7
+ justify-content: center;
8
+ position: fixed;
9
+ transition-duration: 0.2s;
10
+ }
11
+ .lm-back-to-top-svg {
12
+ width: 50%;
13
+ }
14
+ .lm-hide-scroll-btn {
15
+ transform: translateY(6rem);
16
+ }
17
+ .left-margin-xs {
18
+ margin-left: 5px;
19
+ }
20
+ .reading-progress-bar-container {
21
+ background-color: transparent;
22
+ height: 5px;
23
+ left: 0;
24
+ position: fixed;
25
+ top: 0;
26
+ width: 100%;
27
+ z-index: 1000;
28
+ }
29
+ .reading-progress-bar {
30
+ height: 100%;
31
+ transform-origin: left;
32
+ transition: width 0.2s ease-out;
33
+ }
34
+ .faq-items {
35
+ margin-top: 1.5rem;
36
+ width: 100%;
37
+ }
38
+ .faq-item {
39
+ cursor: pointer;
40
+ display: flex;
41
+ flex-direction: column;
42
+ transition: all 0.3s ease;
43
+ }
44
+ .faq-question-container {
45
+ align-items: center;
46
+ display: flex;
47
+ justify-content: space-between;
48
+ }
49
+ .faq-icon {
50
+ height: 24px;
51
+ transition: transform 0.3s ease;
52
+ width: 24px;
53
+ }
54
+ .rotate {
55
+ transform: rotate(45deg);
56
+ }
57
+ .faq-answer {
58
+ max-height: 0;
59
+ opacity: 0;
60
+ overflow: hidden;
61
+ transition: max-height 0.5s ease, opacity 0.5s ease;
62
+ }
63
+ .faq-answer.open {
64
+ max-height: 360px;
65
+ opacity: 1;
66
+ }
67
+ .skeleton-container {
68
+ display: flex;
69
+ flex-direction: column;
70
+ gap: 0.5rem;
71
+ width: 100%;
72
+ }
73
+ .skeleton {
74
+ background-color: #e1e2e6;
75
+ border-radius: 0.375rem;
76
+ min-height: 80px;
77
+ overflow: hidden;
78
+ position: relative;
79
+ width: 100%;
80
+ &:after {
81
+ animation: wave 1.5s linear infinite;
82
+ background: linear-gradient(
83
+ 90deg,
84
+ transparent,
85
+ hsla(0, 0%, 100%, 0.4),
86
+ transparent
87
+ );
88
+ content: "";
89
+ height: 100%;
90
+ left: 0;
91
+ position: absolute;
92
+ top: 0;
93
+ width: 100%;
94
+ }
95
+ }
96
+ @keyframes wave {
97
+ 0% {
98
+ transform: translateX(-100%);
99
+ }
100
+ to {
101
+ transform: translateX(100%);
102
+ }
103
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lm-web-controls",
3
- "version": "1.2.04",
3
+ "version": "1.2.06",
4
4
  "description": "leadmetrics-lm-web-controls",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -1,5 +1,5 @@
1
1
  import React, { Component, ChangeEvent } from "react";
2
-
2
+ import { FaqProps } from "../src";
3
3
  declare module "lm-web-controls" {
4
4
  type EmailProps = {
5
5
  value: string;
@@ -57,12 +57,6 @@ declare module "lm-web-controls" {
57
57
  contentSelector?: string;
58
58
  };
59
59
 
60
- type FaqProps = {
61
- faqSlug: string;
62
- title?: string;
63
- icon?: string;
64
- };
65
-
66
60
  export const Email: React.FC<EmailProps>;
67
61
  export const Copyright: React.FC<CopyrightProps>;
68
62
  export const Phone: React.FC<PhoneProps>;